From 3597bec7c44f0791452ef30ac41b544f639b7c78 Mon Sep 17 00:00:00 2001 From: Jan Prochazka Date: Thu, 18 Nov 2021 18:14:40 +0100 Subject: [PATCH] form view min max cell width --- packages/web/src/datagrid/DataGridCell.svelte | 18 +++++++++++++++++- packages/web/src/formview/FormView.svelte | 5 ++++- 2 files changed, 21 insertions(+), 2 deletions(-) diff --git a/packages/web/src/datagrid/DataGridCell.svelte b/packages/web/src/datagrid/DataGridCell.svelte index 705d3306..1fc87ccc 100644 --- a/packages/web/src/datagrid/DataGridCell.svelte +++ b/packages/web/src/datagrid/DataGridCell.svelte @@ -46,6 +46,8 @@ export let rowData; export let colIndex = undefined; export let allowHintField = false; + export let maxWidth = null; + export let minWidth = null; export let isSelected = false; export let isFrameSelected = false; @@ -64,6 +66,20 @@ export let onDictionaryLookup = null; $: value = col.isStructured ? _.get(rowData || {}, col.uniquePath) : (rowData || {})[col.uniqueName]; + + function computeStyle(maxWidth, col) { + let res = ''; + + if (col.width != null) { + res += `width:${col.width}px; min-width:${col.width}px; max-width:${col.width}px;`; + } else { + if (maxWidth != null) res += `max-width:${maxWidth}px;`; + if (minWidth != null) res += `min-width:${minWidth}px;`; + } + return res; + } + + $: style = computeStyle(maxWidth, col); {#if hideContent} diff --git a/packages/web/src/formview/FormView.svelte b/packages/web/src/formview/FormView.svelte index 43489ff0..7ee3bea5 100644 --- a/packages/web/src/formview/FormView.svelte +++ b/packages/web/src/formview/FormView.svelte @@ -197,6 +197,7 @@ export let onNavigate; let wrapperHeight = 1; + let wrapperWidth = 1; $: rowHeight = $dataGridRowHeight; let currentCell = [0, 0]; @@ -491,7 +492,7 @@
-
+
{#each columnChunks as chunk, chunkIndex} {#each chunk as col, rowIndex} @@ -525,6 +526,8 @@