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);