@vuu-ui/vuu-table 2.1.18 → 2.1.19-beta.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +13 -16
- package/src/CellFocusState.mjs +25 -0
- package/src/Row.mjs +83 -0
- package/src/Table.css.js +441 -0
- package/src/Table.mjs +297 -0
- package/src/VirtualColSpan.mjs +12 -0
- package/src/applyHighlighting.mjs +28 -0
- package/src/bulk-edit/BulkEditPanel.css.js +27 -0
- package/src/bulk-edit/BulkEditPanel.mjs +77 -0
- package/src/bulk-edit/ColumnCascadingUpdateEditor.css.js +86 -0
- package/src/bulk-edit/ColumnCascadingUpdateEditor.mjs +59 -0
- package/src/bulk-edit/InsertNewRowEditor.css.js +86 -0
- package/src/bulk-edit/InsertNewRowEditor.mjs +59 -0
- package/src/bulk-edit/useBulkEditPanel.mjs +61 -0
- package/src/bulk-edit/useColumnCascadingEditor.mjs +124 -0
- package/src/cell-block/CellBlock.css.js +95 -0
- package/src/cell-block/CellBlock.mjs +32 -0
- package/src/cell-block/cellblock-utils.mjs +114 -0
- package/src/cell-block/useCellBlockSelection.mjs +245 -0
- package/src/cell-renderers/checkbox-cell/CheckboxCell.css.js +16 -0
- package/src/cell-renderers/checkbox-cell/CheckboxCell.mjs +56 -0
- package/src/cell-renderers/checkbox-cell/index.mjs +1 -0
- package/src/cell-renderers/checkbox-row-selector/CheckboxRowSelectorCell.css.js +19 -0
- package/src/cell-renderers/checkbox-row-selector/CheckboxRowSelectorCell.mjs +34 -0
- package/src/cell-renderers/checkbox-row-selector/index.mjs +1 -0
- package/src/cell-renderers/index.mjs +4 -0
- package/src/cell-renderers/input-cell/InputCell.css.js +81 -0
- package/src/cell-renderers/input-cell/InputCell.mjs +73 -0
- package/src/cell-renderers/input-cell/index.mjs +1 -0
- package/src/cell-renderers/input-cell/useInputCell.mjs +199 -0
- package/src/cell-renderers/toggle-cell/ToggleCell.css.js +31 -0
- package/src/cell-renderers/toggle-cell/ToggleCell.mjs +47 -0
- package/src/cell-renderers/toggle-cell/index.mjs +1 -0
- package/src/column-header-pill/ColumnHeaderPill.css.js +34 -0
- package/src/column-header-pill/ColumnHeaderPill.mjs +39 -0
- package/src/column-header-pill/GroupColumnPill.css.js +10 -0
- package/src/column-header-pill/GroupColumnPill.mjs +33 -0
- package/src/column-header-pill/SortIndicator.css.js +15 -0
- package/src/column-header-pill/SortIndicator.mjs +29 -0
- package/src/column-header-pill/index.mjs +3 -0
- package/src/column-resizing/ColumnResizer.css.js +32 -0
- package/src/column-resizing/ColumnResizer.mjs +69 -0
- package/src/column-resizing/index.mjs +2 -0
- package/src/column-resizing/useTableColumnResize.mjs +57 -0
- package/src/data-row/DataRow.mjs +298 -0
- package/src/header-cell/GroupHeaderCell.css.js +91 -0
- package/src/header-cell/GroupHeaderCell.mjs +98 -0
- package/src/header-cell/HeaderCell.css.js +182 -0
- package/src/header-cell/HeaderCell.mjs +126 -0
- package/src/header-cell/index.mjs +2 -0
- package/src/index.mjs +20 -0
- package/src/pagination/PaginationControl.css.js +18 -0
- package/src/pagination/PaginationControl.mjs +34 -0
- package/src/pagination/index.mjs +1 -0
- package/src/pagination/usePagination.mjs +29 -0
- package/src/table-cell/TableCell.css.js +67 -0
- package/src/table-cell/TableCell.mjs +54 -0
- package/src/table-cell/TableGroupCell.css.js +91 -0
- package/src/table-cell/TableGroupCell.mjs +61 -0
- package/src/table-cell/index.mjs +2 -0
- package/src/table-config/useTableConfig.mjs +49 -0
- package/src/table-config.mjs +38 -0
- package/src/table-data-source/DataRowMovingWindow.mjs +66 -0
- package/src/table-data-source/useDataSource.mjs +177 -0
- package/src/table-dom-utils.mjs +162 -0
- package/src/table-header/HeaderProvider.mjs +14 -0
- package/src/table-header/TableHeader.mjs +182 -0
- package/src/table-header/index.mjs +2 -0
- package/src/table-header/useTableHeader.mjs +69 -0
- package/src/useCell.mjs +22 -0
- package/src/useCellEditing.mjs +58 -0
- package/src/useCellFocus.mjs +112 -0
- package/src/useControlledTableNavigation.mjs +34 -0
- package/src/useEditableCell.mjs +18 -0
- package/src/useInitialValue.mjs +6 -0
- package/src/useKeyboardNavigation.mjs +275 -0
- package/src/useMeasuredHeight.mjs +44 -0
- package/src/useResizeObserver.mjs +118 -0
- package/src/useRowClassNameGenerators.mjs +21 -0
- package/src/useSelection.mjs +101 -0
- package/src/useTable.mjs +588 -0
- package/src/useTableContextMenu.mjs +54 -0
- package/src/useTableModel.mjs +344 -0
- package/src/useTableScroll.mjs +382 -0
- package/src/useTableViewport.mjs +120 -0
- package/types/VirtualColSpan.d.ts +2 -2
- package/types/cell-renderers/toggle-cell/ToggleCell.d.ts +1 -1
- package/types/useTable.d.ts +3 -3
- package/cjs/CellFocusState.js +0 -45
- package/cjs/CellFocusState.js.map +0 -1
- package/cjs/Row.js +0 -116
- package/cjs/Row.js.map +0 -1
- package/cjs/Table.css.js +0 -6
- package/cjs/Table.css.js.map +0 -1
- package/cjs/Table.js +0 -455
- package/cjs/Table.js.map +0 -1
- package/cjs/VirtualColSpan.js +0 -19
- package/cjs/VirtualColSpan.js.map +0 -1
- package/cjs/applyHighlighting.js +0 -33
- package/cjs/applyHighlighting.js.map +0 -1
- package/cjs/bulk-edit/BulkEditPanel.css.js +0 -6
- package/cjs/bulk-edit/BulkEditPanel.css.js.map +0 -1
- package/cjs/bulk-edit/BulkEditPanel.js +0 -107
- package/cjs/bulk-edit/BulkEditPanel.js.map +0 -1
- package/cjs/bulk-edit/ColumnCascadingUpdateEditor.css.js +0 -6
- package/cjs/bulk-edit/ColumnCascadingUpdateEditor.css.js.map +0 -1
- package/cjs/bulk-edit/ColumnCascadingUpdateEditor.js +0 -80
- package/cjs/bulk-edit/ColumnCascadingUpdateEditor.js.map +0 -1
- package/cjs/bulk-edit/InsertNewRowEditor.css.js +0 -6
- package/cjs/bulk-edit/InsertNewRowEditor.css.js.map +0 -1
- package/cjs/bulk-edit/InsertNewRowEditor.js +0 -80
- package/cjs/bulk-edit/InsertNewRowEditor.js.map +0 -1
- package/cjs/bulk-edit/useBulkEditPanel.js +0 -70
- package/cjs/bulk-edit/useBulkEditPanel.js.map +0 -1
- package/cjs/bulk-edit/useColumnCascadingEditor.js +0 -143
- package/cjs/bulk-edit/useColumnCascadingEditor.js.map +0 -1
- package/cjs/cell-block/CellBlock.css.js +0 -6
- package/cjs/cell-block/CellBlock.css.js.map +0 -1
- package/cjs/cell-block/CellBlock.js +0 -45
- package/cjs/cell-block/CellBlock.js.map +0 -1
- package/cjs/cell-block/cellblock-utils.js +0 -125
- package/cjs/cell-block/cellblock-utils.js.map +0 -1
- package/cjs/cell-block/useCellBlockSelection.js +0 -257
- package/cjs/cell-block/useCellBlockSelection.js.map +0 -1
- package/cjs/cell-renderers/checkbox-cell/CheckboxCell.css.js +0 -6
- package/cjs/cell-renderers/checkbox-cell/CheckboxCell.css.js.map +0 -1
- package/cjs/cell-renderers/checkbox-cell/CheckboxCell.js +0 -67
- package/cjs/cell-renderers/checkbox-cell/CheckboxCell.js.map +0 -1
- package/cjs/cell-renderers/checkbox-row-selector/CheckboxRowSelectorCell.css.js +0 -6
- package/cjs/cell-renderers/checkbox-row-selector/CheckboxRowSelectorCell.css.js.map +0 -1
- package/cjs/cell-renderers/checkbox-row-selector/CheckboxRowSelectorCell.js +0 -51
- package/cjs/cell-renderers/checkbox-row-selector/CheckboxRowSelectorCell.js.map +0 -1
- package/cjs/cell-renderers/input-cell/InputCell.css.js +0 -6
- package/cjs/cell-renderers/input-cell/InputCell.css.js.map +0 -1
- package/cjs/cell-renderers/input-cell/InputCell.js +0 -63
- package/cjs/cell-renderers/input-cell/InputCell.js.map +0 -1
- package/cjs/cell-renderers/input-cell/useInputCell.js +0 -211
- package/cjs/cell-renderers/input-cell/useInputCell.js.map +0 -1
- package/cjs/cell-renderers/toggle-cell/ToggleCell.css.js +0 -6
- package/cjs/cell-renderers/toggle-cell/ToggleCell.css.js.map +0 -1
- package/cjs/cell-renderers/toggle-cell/ToggleCell.js +0 -66
- package/cjs/cell-renderers/toggle-cell/ToggleCell.js.map +0 -1
- package/cjs/column-header-pill/ColumnHeaderPill.css.js +0 -6
- package/cjs/column-header-pill/ColumnHeaderPill.css.js.map +0 -1
- package/cjs/column-header-pill/ColumnHeaderPill.js +0 -53
- package/cjs/column-header-pill/ColumnHeaderPill.js.map +0 -1
- package/cjs/column-header-pill/GroupColumnPill.css.js +0 -6
- package/cjs/column-header-pill/GroupColumnPill.css.js.map +0 -1
- package/cjs/column-header-pill/GroupColumnPill.js +0 -29
- package/cjs/column-header-pill/GroupColumnPill.js.map +0 -1
- package/cjs/column-header-pill/SortIndicator.css.js +0 -6
- package/cjs/column-header-pill/SortIndicator.css.js.map +0 -1
- package/cjs/column-header-pill/SortIndicator.js +0 -27
- package/cjs/column-header-pill/SortIndicator.js.map +0 -1
- package/cjs/column-resizing/ColumnResizer.css.js +0 -6
- package/cjs/column-resizing/ColumnResizer.css.js.map +0 -1
- package/cjs/column-resizing/ColumnResizer.js +0 -82
- package/cjs/column-resizing/ColumnResizer.js.map +0 -1
- package/cjs/column-resizing/useTableColumnResize.js +0 -55
- package/cjs/column-resizing/useTableColumnResize.js.map +0 -1
- package/cjs/data-row/DataRow.js +0 -262
- package/cjs/data-row/DataRow.js.map +0 -1
- package/cjs/header-cell/GroupHeaderCell.css.js +0 -6
- package/cjs/header-cell/GroupHeaderCell.css.js.map +0 -1
- package/cjs/header-cell/GroupHeaderCell.js +0 -127
- package/cjs/header-cell/GroupHeaderCell.js.map +0 -1
- package/cjs/header-cell/HeaderCell.css.js +0 -6
- package/cjs/header-cell/HeaderCell.css.js.map +0 -1
- package/cjs/header-cell/HeaderCell.js +0 -139
- package/cjs/header-cell/HeaderCell.js.map +0 -1
- package/cjs/index.js +0 -64
- package/cjs/index.js.map +0 -1
- package/cjs/pagination/PaginationControl.css.js +0 -6
- package/cjs/pagination/PaginationControl.css.js.map +0 -1
- package/cjs/pagination/PaginationControl.js +0 -38
- package/cjs/pagination/PaginationControl.js.map +0 -1
- package/cjs/pagination/usePagination.js +0 -36
- package/cjs/pagination/usePagination.js.map +0 -1
- package/cjs/table-cell/TableCell.css.js +0 -6
- package/cjs/table-cell/TableCell.css.js.map +0 -1
- package/cjs/table-cell/TableCell.js +0 -75
- package/cjs/table-cell/TableCell.js.map +0 -1
- package/cjs/table-cell/TableGroupCell.css.js +0 -6
- package/cjs/table-cell/TableGroupCell.css.js.map +0 -1
- package/cjs/table-cell/TableGroupCell.js +0 -65
- package/cjs/table-cell/TableGroupCell.js.map +0 -1
- package/cjs/table-config/useTableConfig.js +0 -67
- package/cjs/table-config/useTableConfig.js.map +0 -1
- package/cjs/table-config.js +0 -35
- package/cjs/table-config.js.map +0 -1
- package/cjs/table-data-source/DataRowMovingWindow.js +0 -99
- package/cjs/table-data-source/DataRowMovingWindow.js.map +0 -1
- package/cjs/table-data-source/useDataSource.js +0 -236
- package/cjs/table-data-source/useDataSource.js.map +0 -1
- package/cjs/table-dom-utils.js +0 -206
- package/cjs/table-dom-utils.js.map +0 -1
- package/cjs/table-header/HeaderProvider.js +0 -18
- package/cjs/table-header/HeaderProvider.js.map +0 -1
- package/cjs/table-header/TableHeader.js +0 -180
- package/cjs/table-header/TableHeader.js.map +0 -1
- package/cjs/table-header/useTableHeader.js +0 -87
- package/cjs/table-header/useTableHeader.js.map +0 -1
- package/cjs/useCell.js +0 -26
- package/cjs/useCell.js.map +0 -1
- package/cjs/useCellEditing.js +0 -77
- package/cjs/useCellEditing.js.map +0 -1
- package/cjs/useCellFocus.js +0 -119
- package/cjs/useCellFocus.js.map +0 -1
- package/cjs/useControlledTableNavigation.js +0 -46
- package/cjs/useControlledTableNavigation.js.map +0 -1
- package/cjs/useEditableCell.js +0 -27
- package/cjs/useEditableCell.js.map +0 -1
- package/cjs/useKeyboardNavigation.js +0 -323
- package/cjs/useKeyboardNavigation.js.map +0 -1
- package/cjs/useMeasuredHeight.js +0 -51
- package/cjs/useMeasuredHeight.js.map +0 -1
- package/cjs/useRowClassNameGenerators.js +0 -34
- package/cjs/useRowClassNameGenerators.js.map +0 -1
- package/cjs/useSelection.js +0 -130
- package/cjs/useSelection.js.map +0 -1
- package/cjs/useTable.js +0 -742
- package/cjs/useTable.js.map +0 -1
- package/cjs/useTableContextMenu.js +0 -76
- package/cjs/useTableContextMenu.js.map +0 -1
- package/cjs/useTableModel.js +0 -421
- package/cjs/useTableModel.js.map +0 -1
- package/cjs/useTableScroll.js +0 -464
- package/cjs/useTableScroll.js.map +0 -1
- package/cjs/useTableViewport.js +0 -137
- package/cjs/useTableViewport.js.map +0 -1
- package/esm/CellFocusState.js +0 -43
- package/esm/CellFocusState.js.map +0 -1
- package/esm/Row.js +0 -114
- package/esm/Row.js.map +0 -1
- package/esm/Table.css.js +0 -4
- package/esm/Table.css.js.map +0 -1
- package/esm/Table.js +0 -453
- package/esm/Table.js.map +0 -1
- package/esm/VirtualColSpan.js +0 -17
- package/esm/VirtualColSpan.js.map +0 -1
- package/esm/applyHighlighting.js +0 -31
- package/esm/applyHighlighting.js.map +0 -1
- package/esm/bulk-edit/BulkEditPanel.css.js +0 -4
- package/esm/bulk-edit/BulkEditPanel.css.js.map +0 -1
- package/esm/bulk-edit/BulkEditPanel.js +0 -105
- package/esm/bulk-edit/BulkEditPanel.js.map +0 -1
- package/esm/bulk-edit/ColumnCascadingUpdateEditor.css.js +0 -4
- package/esm/bulk-edit/ColumnCascadingUpdateEditor.css.js.map +0 -1
- package/esm/bulk-edit/ColumnCascadingUpdateEditor.js +0 -78
- package/esm/bulk-edit/ColumnCascadingUpdateEditor.js.map +0 -1
- package/esm/bulk-edit/InsertNewRowEditor.css.js +0 -4
- package/esm/bulk-edit/InsertNewRowEditor.css.js.map +0 -1
- package/esm/bulk-edit/InsertNewRowEditor.js +0 -78
- package/esm/bulk-edit/InsertNewRowEditor.js.map +0 -1
- package/esm/bulk-edit/useBulkEditPanel.js +0 -68
- package/esm/bulk-edit/useBulkEditPanel.js.map +0 -1
- package/esm/bulk-edit/useColumnCascadingEditor.js +0 -141
- package/esm/bulk-edit/useColumnCascadingEditor.js.map +0 -1
- package/esm/cell-block/CellBlock.css.js +0 -4
- package/esm/cell-block/CellBlock.css.js.map +0 -1
- package/esm/cell-block/CellBlock.js +0 -43
- package/esm/cell-block/CellBlock.js.map +0 -1
- package/esm/cell-block/cellblock-utils.js +0 -116
- package/esm/cell-block/cellblock-utils.js.map +0 -1
- package/esm/cell-block/useCellBlockSelection.js +0 -255
- package/esm/cell-block/useCellBlockSelection.js.map +0 -1
- package/esm/cell-renderers/checkbox-cell/CheckboxCell.css.js +0 -4
- package/esm/cell-renderers/checkbox-cell/CheckboxCell.css.js.map +0 -1
- package/esm/cell-renderers/checkbox-cell/CheckboxCell.js +0 -65
- package/esm/cell-renderers/checkbox-cell/CheckboxCell.js.map +0 -1
- package/esm/cell-renderers/checkbox-row-selector/CheckboxRowSelectorCell.css.js +0 -4
- package/esm/cell-renderers/checkbox-row-selector/CheckboxRowSelectorCell.css.js.map +0 -1
- package/esm/cell-renderers/checkbox-row-selector/CheckboxRowSelectorCell.js +0 -49
- package/esm/cell-renderers/checkbox-row-selector/CheckboxRowSelectorCell.js.map +0 -1
- package/esm/cell-renderers/input-cell/InputCell.css.js +0 -4
- package/esm/cell-renderers/input-cell/InputCell.css.js.map +0 -1
- package/esm/cell-renderers/input-cell/InputCell.js +0 -61
- package/esm/cell-renderers/input-cell/InputCell.js.map +0 -1
- package/esm/cell-renderers/input-cell/useInputCell.js +0 -209
- package/esm/cell-renderers/input-cell/useInputCell.js.map +0 -1
- package/esm/cell-renderers/toggle-cell/ToggleCell.css.js +0 -4
- package/esm/cell-renderers/toggle-cell/ToggleCell.css.js.map +0 -1
- package/esm/cell-renderers/toggle-cell/ToggleCell.js +0 -64
- package/esm/cell-renderers/toggle-cell/ToggleCell.js.map +0 -1
- package/esm/column-header-pill/ColumnHeaderPill.css.js +0 -4
- package/esm/column-header-pill/ColumnHeaderPill.css.js.map +0 -1
- package/esm/column-header-pill/ColumnHeaderPill.js +0 -51
- package/esm/column-header-pill/ColumnHeaderPill.js.map +0 -1
- package/esm/column-header-pill/GroupColumnPill.css.js +0 -4
- package/esm/column-header-pill/GroupColumnPill.css.js.map +0 -1
- package/esm/column-header-pill/GroupColumnPill.js +0 -27
- package/esm/column-header-pill/GroupColumnPill.js.map +0 -1
- package/esm/column-header-pill/SortIndicator.css.js +0 -4
- package/esm/column-header-pill/SortIndicator.css.js.map +0 -1
- package/esm/column-header-pill/SortIndicator.js +0 -25
- package/esm/column-header-pill/SortIndicator.js.map +0 -1
- package/esm/column-resizing/ColumnResizer.css.js +0 -4
- package/esm/column-resizing/ColumnResizer.css.js.map +0 -1
- package/esm/column-resizing/ColumnResizer.js +0 -80
- package/esm/column-resizing/ColumnResizer.js.map +0 -1
- package/esm/column-resizing/useTableColumnResize.js +0 -53
- package/esm/column-resizing/useTableColumnResize.js.map +0 -1
- package/esm/data-row/DataRow.js +0 -260
- package/esm/data-row/DataRow.js.map +0 -1
- package/esm/header-cell/GroupHeaderCell.css.js +0 -4
- package/esm/header-cell/GroupHeaderCell.css.js.map +0 -1
- package/esm/header-cell/GroupHeaderCell.js +0 -125
- package/esm/header-cell/GroupHeaderCell.js.map +0 -1
- package/esm/header-cell/HeaderCell.css.js +0 -4
- package/esm/header-cell/HeaderCell.css.js.map +0 -1
- package/esm/header-cell/HeaderCell.js +0 -137
- package/esm/header-cell/HeaderCell.js.map +0 -1
- package/esm/index.js +0 -27
- package/esm/index.js.map +0 -1
- package/esm/pagination/PaginationControl.css.js +0 -4
- package/esm/pagination/PaginationControl.css.js.map +0 -1
- package/esm/pagination/PaginationControl.js +0 -36
- package/esm/pagination/PaginationControl.js.map +0 -1
- package/esm/pagination/usePagination.js +0 -34
- package/esm/pagination/usePagination.js.map +0 -1
- package/esm/table-cell/TableCell.css.js +0 -4
- package/esm/table-cell/TableCell.css.js.map +0 -1
- package/esm/table-cell/TableCell.js +0 -73
- package/esm/table-cell/TableCell.js.map +0 -1
- package/esm/table-cell/TableGroupCell.css.js +0 -4
- package/esm/table-cell/TableGroupCell.css.js.map +0 -1
- package/esm/table-cell/TableGroupCell.js +0 -63
- package/esm/table-cell/TableGroupCell.js.map +0 -1
- package/esm/table-config/useTableConfig.js +0 -65
- package/esm/table-config/useTableConfig.js.map +0 -1
- package/esm/table-config.js +0 -33
- package/esm/table-config.js.map +0 -1
- package/esm/table-data-source/DataRowMovingWindow.js +0 -97
- package/esm/table-data-source/DataRowMovingWindow.js.map +0 -1
- package/esm/table-data-source/useDataSource.js +0 -234
- package/esm/table-data-source/useDataSource.js.map +0 -1
- package/esm/table-dom-utils.js +0 -188
- package/esm/table-dom-utils.js.map +0 -1
- package/esm/table-header/HeaderProvider.js +0 -15
- package/esm/table-header/HeaderProvider.js.map +0 -1
- package/esm/table-header/TableHeader.js +0 -178
- package/esm/table-header/TableHeader.js.map +0 -1
- package/esm/table-header/useTableHeader.js +0 -85
- package/esm/table-header/useTableHeader.js.map +0 -1
- package/esm/useCell.js +0 -24
- package/esm/useCell.js.map +0 -1
- package/esm/useCellEditing.js +0 -75
- package/esm/useCellEditing.js.map +0 -1
- package/esm/useCellFocus.js +0 -117
- package/esm/useCellFocus.js.map +0 -1
- package/esm/useControlledTableNavigation.js +0 -43
- package/esm/useControlledTableNavigation.js.map +0 -1
- package/esm/useEditableCell.js +0 -25
- package/esm/useEditableCell.js.map +0 -1
- package/esm/useKeyboardNavigation.js +0 -319
- package/esm/useKeyboardNavigation.js.map +0 -1
- package/esm/useMeasuredHeight.js +0 -49
- package/esm/useMeasuredHeight.js.map +0 -1
- package/esm/useRowClassNameGenerators.js +0 -32
- package/esm/useRowClassNameGenerators.js.map +0 -1
- package/esm/useSelection.js +0 -128
- package/esm/useSelection.js.map +0 -1
- package/esm/useTable.js +0 -740
- package/esm/useTable.js.map +0 -1
- package/esm/useTableContextMenu.js +0 -73
- package/esm/useTableContextMenu.js.map +0 -1
- package/esm/useTableModel.js +0 -419
- package/esm/useTableModel.js.map +0 -1
- package/esm/useTableScroll.js +0 -461
- package/esm/useTableScroll.js.map +0 -1
- package/esm/useTableViewport.js +0 -135
- package/esm/useTableViewport.js.map +0 -1
|
@@ -0,0 +1,245 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import { isArrowKey, queryClosest } from "@vuu-ui/vuu-utils";
|
|
3
|
+
import { useCallback, useRef, useState } from "react";
|
|
4
|
+
import { getAriaCellPos, getNextCellPos, getTableCell } from "../table-dom-utils.mjs";
|
|
5
|
+
import { CellBlock } from "./CellBlock.mjs";
|
|
6
|
+
import { getTableCellBlock, getTextFromCells, isNullCellBox, outsideBox, refState, setElementBox, updateCellBlockClassName } from "./cellblock-utils.mjs";
|
|
7
|
+
const clone = (posTuple)=>posTuple.slice();
|
|
8
|
+
const NullHandler = ()=>console.error("no handler installed");
|
|
9
|
+
const mouseHandlers = {
|
|
10
|
+
mouseMove: NullHandler,
|
|
11
|
+
mouseMovePreDrag: NullHandler,
|
|
12
|
+
mouseUp: NullHandler,
|
|
13
|
+
mouseUpPreDrag: NullHandler
|
|
14
|
+
};
|
|
15
|
+
const mouseType = (name)=>name.startsWith("mouseMove") ? "mousemove" : "mouseup";
|
|
16
|
+
const DRAG_THRESHOLD = 5;
|
|
17
|
+
const useCellBlockSelection = ({ allowCellBlockSelection, columnCount = 0, containerRef, onSelectCellBlock, rowCount = 0 })=>{
|
|
18
|
+
const [cellBlock, setCellBlock] = useState(null);
|
|
19
|
+
const stateRef = useRef(refState);
|
|
20
|
+
const handlersRef = useRef(mouseHandlers);
|
|
21
|
+
const handleCopy = useCallback(async ()=>{
|
|
22
|
+
const { startCell, endCell } = stateRef.current;
|
|
23
|
+
if (startCell && endCell) {
|
|
24
|
+
const tsvText = getTextFromCells(startCell, endCell);
|
|
25
|
+
const type = "text/plain";
|
|
26
|
+
const blob = new Blob([
|
|
27
|
+
tsvText
|
|
28
|
+
], {
|
|
29
|
+
type
|
|
30
|
+
});
|
|
31
|
+
const data = [
|
|
32
|
+
new ClipboardItem({
|
|
33
|
+
[type]: blob
|
|
34
|
+
})
|
|
35
|
+
];
|
|
36
|
+
await navigator.clipboard.write(data);
|
|
37
|
+
}
|
|
38
|
+
}, []);
|
|
39
|
+
const cellBlockRef = useCallback((el)=>{
|
|
40
|
+
stateRef.current.cellBlock = el;
|
|
41
|
+
}, []);
|
|
42
|
+
const createCellBlock = useCallback((method = "mouse")=>{
|
|
43
|
+
const { startBox, startCell } = stateRef.current;
|
|
44
|
+
if (startCell) {
|
|
45
|
+
const table = queryClosest(startCell, ".vuuTable");
|
|
46
|
+
if (table) table.classList.add(`vuu-cellblock-select-in-progress-${method}`);
|
|
47
|
+
setElementBox(startCell, startBox);
|
|
48
|
+
startCell.classList.add("vuu-cellblock-start");
|
|
49
|
+
setCellBlock(/*#__PURE__*/ jsx(CellBlock, {
|
|
50
|
+
onCopy: handleCopy,
|
|
51
|
+
ref: cellBlockRef
|
|
52
|
+
}));
|
|
53
|
+
}
|
|
54
|
+
}, [
|
|
55
|
+
cellBlockRef,
|
|
56
|
+
handleCopy
|
|
57
|
+
]);
|
|
58
|
+
const initializeStateRef = useCallback(()=>{
|
|
59
|
+
const { cellBlock, cellBlockClassName, startCell, endCell } = stateRef.current;
|
|
60
|
+
if (startCell) startCell.classList.remove("vuu-cellblock-start");
|
|
61
|
+
if (endCell) endCell.classList.remove("vuu-cellblock-end");
|
|
62
|
+
if (cellBlock?.classList.contains(cellBlockClassName)) cellBlock.classList.remove(cellBlockClassName);
|
|
63
|
+
const { endBox, startBox } = refState;
|
|
64
|
+
stateRef.current = {
|
|
65
|
+
...refState,
|
|
66
|
+
cellBlock,
|
|
67
|
+
endBox: {
|
|
68
|
+
...endBox
|
|
69
|
+
},
|
|
70
|
+
endPos: [
|
|
71
|
+
-1,
|
|
72
|
+
-1
|
|
73
|
+
],
|
|
74
|
+
startBox: {
|
|
75
|
+
...startBox
|
|
76
|
+
},
|
|
77
|
+
startPos: [
|
|
78
|
+
-1,
|
|
79
|
+
-1
|
|
80
|
+
]
|
|
81
|
+
};
|
|
82
|
+
}, []);
|
|
83
|
+
const addMouseListener = useCallback((mouseOperation, handler)=>{
|
|
84
|
+
window.addEventListener(mouseType(mouseOperation), handler);
|
|
85
|
+
handlersRef.current[mouseOperation] = handler;
|
|
86
|
+
}, []);
|
|
87
|
+
const removeMouseListener = useCallback((name)=>{
|
|
88
|
+
window.removeEventListener(mouseType(name), handlersRef.current[name]);
|
|
89
|
+
}, []);
|
|
90
|
+
handlersRef.current.mouseMove = useCallback((evt)=>{
|
|
91
|
+
const { clientX: x, clientY: y } = evt;
|
|
92
|
+
const { endBox, startBox } = stateRef.current;
|
|
93
|
+
if (outsideBox(startBox, x, y) && outsideBox(endBox, x, y)) {
|
|
94
|
+
const cell = queryClosest(evt.target, ".vuuTableCell, .vuuCellBlock");
|
|
95
|
+
if (cell?.classList.contains("vuuTableCell")) {
|
|
96
|
+
setElementBox(cell, endBox);
|
|
97
|
+
stateRef.current.endCell = cell;
|
|
98
|
+
updateCellBlockClassName(stateRef.current);
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
}, []);
|
|
102
|
+
handlersRef.current.mouseUp = useCallback((evt)=>{
|
|
103
|
+
removeMouseListener("mouseMove");
|
|
104
|
+
removeMouseListener("mouseUp");
|
|
105
|
+
const { cellBlock, endCell, startCell } = stateRef.current;
|
|
106
|
+
const table = queryClosest(evt.target, ".vuuTable");
|
|
107
|
+
endCell?.classList.add("vuu-cellblock-end");
|
|
108
|
+
if (table) table.classList.remove("vuu-cellblock-select-in-progress-mouse");
|
|
109
|
+
if (startCell && endCell) {
|
|
110
|
+
const tableCellBlock = getTableCellBlock(startCell, endCell);
|
|
111
|
+
onSelectCellBlock?.(tableCellBlock);
|
|
112
|
+
}
|
|
113
|
+
if (cellBlock) cellBlock.focus();
|
|
114
|
+
}, [
|
|
115
|
+
onSelectCellBlock,
|
|
116
|
+
removeMouseListener
|
|
117
|
+
]);
|
|
118
|
+
handlersRef.current.mouseMovePreDrag = useCallback((evt)=>{
|
|
119
|
+
const { current: state } = stateRef;
|
|
120
|
+
const { mouseStartX, mouseStartY } = state;
|
|
121
|
+
const x = state.mousePosX = evt.clientX;
|
|
122
|
+
const y = state.mousePosY = evt.clientY;
|
|
123
|
+
const distance = Math.max(Math.abs(x - mouseStartX), Math.abs(y - mouseStartY));
|
|
124
|
+
if (distance > DRAG_THRESHOLD) {
|
|
125
|
+
createCellBlock("mouse");
|
|
126
|
+
const { mouseMove, mouseUp } = handlersRef.current;
|
|
127
|
+
removeMouseListener("mouseMovePreDrag");
|
|
128
|
+
removeMouseListener("mouseUpPreDrag");
|
|
129
|
+
addMouseListener("mouseMove", mouseMove);
|
|
130
|
+
addMouseListener("mouseUp", mouseUp);
|
|
131
|
+
}
|
|
132
|
+
}, [
|
|
133
|
+
addMouseListener,
|
|
134
|
+
createCellBlock,
|
|
135
|
+
removeMouseListener
|
|
136
|
+
]);
|
|
137
|
+
handlersRef.current.mouseUpPreDrag = useCallback(()=>{
|
|
138
|
+
removeMouseListener("mouseMovePreDrag");
|
|
139
|
+
removeMouseListener("mouseUpPreDrag");
|
|
140
|
+
}, [
|
|
141
|
+
removeMouseListener
|
|
142
|
+
]);
|
|
143
|
+
const handleNativeMouseOver = useCallback((evt)=>{
|
|
144
|
+
const cell = queryClosest(evt.target, ".vuuTableCell");
|
|
145
|
+
if (cell) {
|
|
146
|
+
stateRef.current.endPos = getAriaCellPos(cell);
|
|
147
|
+
stateRef.current.endCell?.classList.remove("vuu-cellblock-end");
|
|
148
|
+
stateRef.current.endCell = cell;
|
|
149
|
+
setElementBox(cell, stateRef.current.endBox);
|
|
150
|
+
updateCellBlockClassName(stateRef.current);
|
|
151
|
+
cell?.classList.add("vuu-cellblock-end");
|
|
152
|
+
}
|
|
153
|
+
}, []);
|
|
154
|
+
const handleNativeMouseUp = useCallback(()=>{
|
|
155
|
+
window.removeEventListener("mouseover", handleNativeMouseOver);
|
|
156
|
+
}, [
|
|
157
|
+
handleNativeMouseOver
|
|
158
|
+
]);
|
|
159
|
+
const handleMouseDown = useCallback((evt)=>{
|
|
160
|
+
if (0 === evt.button) {
|
|
161
|
+
initializeStateRef();
|
|
162
|
+
const { current: state } = stateRef;
|
|
163
|
+
const cell = queryClosest(evt.target, ".vuuTableCell");
|
|
164
|
+
if (cell) {
|
|
165
|
+
state.startCell = cell;
|
|
166
|
+
state.mouseStartX = evt.clientX;
|
|
167
|
+
state.mouseStartY = evt.clientY;
|
|
168
|
+
const { mouseMovePreDrag, mouseUpPreDrag } = handlersRef.current;
|
|
169
|
+
addMouseListener("mouseMovePreDrag", mouseMovePreDrag);
|
|
170
|
+
addMouseListener("mouseUpPreDrag", mouseUpPreDrag);
|
|
171
|
+
console.log("register mouse enter");
|
|
172
|
+
window.addEventListener("mouseover", handleNativeMouseOver);
|
|
173
|
+
window.addEventListener("mouseup", handleNativeMouseUp);
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
}, [
|
|
177
|
+
addMouseListener,
|
|
178
|
+
handleNativeMouseOver,
|
|
179
|
+
handleNativeMouseUp,
|
|
180
|
+
initializeStateRef
|
|
181
|
+
]);
|
|
182
|
+
const nativeKeyDownHandlerRef = useRef(NullHandler);
|
|
183
|
+
const handleNativeKeyUp = useCallback((evt)=>{
|
|
184
|
+
if ("Shift" === evt.key) {
|
|
185
|
+
const { endCell } = stateRef.current;
|
|
186
|
+
const table = queryClosest(evt.target, ".vuuTable");
|
|
187
|
+
endCell?.classList.add("vuu-cellblock-end");
|
|
188
|
+
if (table) table.classList.remove("vuu-cellblock-select-in-progress-keyboard");
|
|
189
|
+
window.removeEventListener("keydown", nativeKeyDownHandlerRef.current, {
|
|
190
|
+
capture: true
|
|
191
|
+
});
|
|
192
|
+
window.removeEventListener("keyup", handleNativeKeyUp, {
|
|
193
|
+
capture: true
|
|
194
|
+
});
|
|
195
|
+
}
|
|
196
|
+
}, []);
|
|
197
|
+
const handleNativeKeyDown = nativeKeyDownHandlerRef.current = useCallback(({ key })=>{
|
|
198
|
+
if (isArrowKey(key)) {
|
|
199
|
+
const { endBox, endPos, startBox } = stateRef.current;
|
|
200
|
+
if (isNullCellBox(startBox)) createCellBlock("keyboard");
|
|
201
|
+
const nextCell = getNextCellPos(key, endPos, columnCount, rowCount);
|
|
202
|
+
stateRef.current.endPos = nextCell;
|
|
203
|
+
const cell = getTableCell(containerRef, nextCell);
|
|
204
|
+
stateRef.current.endCell = cell;
|
|
205
|
+
setElementBox(cell, endBox);
|
|
206
|
+
updateCellBlockClassName(stateRef.current);
|
|
207
|
+
}
|
|
208
|
+
}, [
|
|
209
|
+
columnCount,
|
|
210
|
+
containerRef,
|
|
211
|
+
createCellBlock,
|
|
212
|
+
rowCount
|
|
213
|
+
]);
|
|
214
|
+
const handleKeyDown = useCallback((evt)=>{
|
|
215
|
+
console.log("[useCellBlockSelection] handleKeyDown (only interested in Shift key)");
|
|
216
|
+
if ("Shift" === evt.key) {
|
|
217
|
+
initializeStateRef();
|
|
218
|
+
const cell = queryClosest(evt.target, ".vuuTableCell");
|
|
219
|
+
if (cell) {
|
|
220
|
+
const startPos = getAriaCellPos(cell);
|
|
221
|
+
stateRef.current.startPos = startPos;
|
|
222
|
+
stateRef.current.endPos = clone(startPos);
|
|
223
|
+
const { current: state } = stateRef;
|
|
224
|
+
state.startCell = cell;
|
|
225
|
+
window.addEventListener("keydown", handleNativeKeyDown, {
|
|
226
|
+
capture: true
|
|
227
|
+
});
|
|
228
|
+
window.addEventListener("keyup", handleNativeKeyUp, {
|
|
229
|
+
capture: true
|
|
230
|
+
});
|
|
231
|
+
evt.preventDefault();
|
|
232
|
+
}
|
|
233
|
+
}
|
|
234
|
+
}, [
|
|
235
|
+
handleNativeKeyDown,
|
|
236
|
+
handleNativeKeyUp,
|
|
237
|
+
initializeStateRef
|
|
238
|
+
]);
|
|
239
|
+
return {
|
|
240
|
+
cellBlock,
|
|
241
|
+
onKeyDown: allowCellBlockSelection ? handleKeyDown : void 0,
|
|
242
|
+
onMouseDown: allowCellBlockSelection ? handleMouseDown : void 0
|
|
243
|
+
};
|
|
244
|
+
};
|
|
245
|
+
export { useCellBlockSelection };
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
const css = `
|
|
2
|
+
.vuuCheckboxCell-checkbox {
|
|
3
|
+
border: 2px solid #0000;
|
|
4
|
+
|
|
5
|
+
& input:focus-visible + .saltCheckboxIcon {
|
|
6
|
+
outline: none;
|
|
7
|
+
}
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
.vuuTableCell-editable .vuuCheckboxCell-checkbox:focus-within {
|
|
11
|
+
border: solid 2px var(--salt-focused-outlineColor);
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
`;
|
|
16
|
+
export default css;
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import { memo, useCallback } from "react";
|
|
3
|
+
import { Checkbox } from "@salt-ds/core";
|
|
4
|
+
import { dataColumnAndKeyUnchanged, dispatchCustomEvent, isRpcSuccess, registerComponent } from "@vuu-ui/vuu-utils";
|
|
5
|
+
import { useComponentCssInjection } from "@salt-ds/styles";
|
|
6
|
+
import { useWindow } from "@salt-ds/window";
|
|
7
|
+
import CheckboxCell from "./CheckboxCell.css";
|
|
8
|
+
const classBase = "vuuCheckboxCell";
|
|
9
|
+
const CheckboxCell_CheckboxCell = /*#__PURE__*/ memo(({ column, dataRow, onEdit })=>{
|
|
10
|
+
const targetWindow = useWindow();
|
|
11
|
+
useComponentCssInjection({
|
|
12
|
+
testId: "vuu-checkbox-cell",
|
|
13
|
+
css: CheckboxCell,
|
|
14
|
+
window: targetWindow
|
|
15
|
+
});
|
|
16
|
+
const isChecked = !!dataRow[column.name];
|
|
17
|
+
const handleCommit = useCallback((value)=>async (evt)=>{
|
|
18
|
+
const res = await onEdit?.({
|
|
19
|
+
previousValue: isChecked,
|
|
20
|
+
value
|
|
21
|
+
}, "commit");
|
|
22
|
+
if (isRpcSuccess(res)) dispatchCustomEvent(evt.target, "vuu-commit");
|
|
23
|
+
return res;
|
|
24
|
+
}, [
|
|
25
|
+
isChecked,
|
|
26
|
+
onEdit
|
|
27
|
+
]);
|
|
28
|
+
const handleKeyDown = useCallback(async (evt)=>{
|
|
29
|
+
if ("Enter" === evt.key) {
|
|
30
|
+
const res = await onEdit?.({
|
|
31
|
+
previousValue: isChecked,
|
|
32
|
+
value: !isChecked
|
|
33
|
+
}, "commit");
|
|
34
|
+
if (isRpcSuccess(res)) dispatchCustomEvent(evt.target, "vuu-commit");
|
|
35
|
+
}
|
|
36
|
+
}, [
|
|
37
|
+
isChecked,
|
|
38
|
+
onEdit
|
|
39
|
+
]);
|
|
40
|
+
const className = `${classBase}-checkbox`;
|
|
41
|
+
return column.editable ? /*#__PURE__*/ jsx(Checkbox, {
|
|
42
|
+
checked: isChecked,
|
|
43
|
+
className: className,
|
|
44
|
+
onClick: handleCommit(!isChecked),
|
|
45
|
+
onKeyDown: handleKeyDown
|
|
46
|
+
}) : /*#__PURE__*/ jsx(Checkbox, {
|
|
47
|
+
checked: isChecked,
|
|
48
|
+
className: className,
|
|
49
|
+
disabled: true
|
|
50
|
+
});
|
|
51
|
+
}, dataColumnAndKeyUnchanged);
|
|
52
|
+
CheckboxCell_CheckboxCell.displayName = "CheckboxCell";
|
|
53
|
+
registerComponent("checkbox-cell", CheckboxCell_CheckboxCell, "cell-renderer", {
|
|
54
|
+
serverDataType: "boolean"
|
|
55
|
+
});
|
|
56
|
+
export { CheckboxCell_CheckboxCell as CheckboxCell };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./CheckboxCell.mjs";
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
const css = `
|
|
2
|
+
.vuuTableCell {
|
|
3
|
+
& .vuuCheckboxRowSelector {
|
|
4
|
+
align-items: center;
|
|
5
|
+
height: 100%;
|
|
6
|
+
|
|
7
|
+
& .saltCheckboxIcon {
|
|
8
|
+
margin-top: 0;
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
& .vuuCheckboxRowSelectorIcon {
|
|
13
|
+
margin-top: calc(var(--row-height) / 2 - 6px);
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
`;
|
|
19
|
+
export default css;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import { registerComponent } from "@vuu-ui/vuu-utils";
|
|
3
|
+
import { Checkbox } from "@salt-ds/core";
|
|
4
|
+
import { useComponentCssInjection } from "@salt-ds/styles";
|
|
5
|
+
import { useWindow } from "@salt-ds/window";
|
|
6
|
+
import CheckboxRowSelectorCell from "./CheckboxRowSelectorCell.css";
|
|
7
|
+
import { useCallback } from "react";
|
|
8
|
+
const inputProps = {
|
|
9
|
+
"aria-label": "Press space to select row"
|
|
10
|
+
};
|
|
11
|
+
const CheckboxRowSelectorCell_CheckboxRowSelectorCell = ({ dataRow })=>{
|
|
12
|
+
const targetWindow = useWindow();
|
|
13
|
+
useComponentCssInjection({
|
|
14
|
+
testId: "vuu-checkbox-row-selector-cell",
|
|
15
|
+
css: CheckboxRowSelectorCell,
|
|
16
|
+
window: targetWindow
|
|
17
|
+
});
|
|
18
|
+
const isChecked = !!dataRow.isSelected;
|
|
19
|
+
const handleClick = useCallback((e)=>{
|
|
20
|
+
const target = e.target;
|
|
21
|
+
if ("INPUT" !== target.tagName) e.stopPropagation();
|
|
22
|
+
}, []);
|
|
23
|
+
return /*#__PURE__*/ jsx(Checkbox, {
|
|
24
|
+
checked: isChecked,
|
|
25
|
+
className: "vuuCheckboxRowSelector",
|
|
26
|
+
inputProps: inputProps,
|
|
27
|
+
onClick: handleClick
|
|
28
|
+
});
|
|
29
|
+
};
|
|
30
|
+
CheckboxRowSelectorCell_CheckboxRowSelectorCell.displayName = "CheckboxCell";
|
|
31
|
+
registerComponent("checkbox-row-selector-cell", CheckboxRowSelectorCell_CheckboxRowSelectorCell, "cell-renderer", {
|
|
32
|
+
serverDataType: "boolean"
|
|
33
|
+
});
|
|
34
|
+
export { CheckboxRowSelectorCell_CheckboxRowSelectorCell as CheckboxRowSelectorCell };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./CheckboxRowSelectorCell.mjs";
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
const css = `
|
|
2
|
+
.vuuTableCell.vuuTableCell-editable {
|
|
3
|
+
& .vuuTableInputCell.saltInput-primary {
|
|
4
|
+
--salt-focused-outlineStyle: none;
|
|
5
|
+
--saltInput-height: var(--vuu-table-embedded-control-height);
|
|
6
|
+
--saltInput-minHeight: var(--saltInput-height);
|
|
7
|
+
border-radius: 2px;
|
|
8
|
+
font-weight: 500;
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
.vuuTableInputCell {
|
|
13
|
+
--edit-indicator-color: var(--salt-editable-borderColor);
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
.vuuTableInputCell-icon {
|
|
17
|
+
--vuu-icon-height: 13px;
|
|
18
|
+
--vuu-icon-left: 0;
|
|
19
|
+
--vuu-icon-size: 15px;
|
|
20
|
+
--vuu-icon-width: 12px;
|
|
21
|
+
cursor: pointer;
|
|
22
|
+
border-radius: 10px;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
.vuuTableInputCell-error.saltInput-bordered.saltInput {
|
|
26
|
+
border-color: var(--salt-status-error-foreground-informative);
|
|
27
|
+
|
|
28
|
+
& .saltInput-startAdornmentContainer {
|
|
29
|
+
& .vuuTableInputCell-icon {
|
|
30
|
+
--vuu-icon-color: var(--salt-status-error-bold-background);
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
& .saltInput-endAdornmentContainer {
|
|
35
|
+
& .vuuTableInputCell-icon {
|
|
36
|
+
--vuu-icon-color: var(--salt-status-error-bold-background);
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
.vuuTableInputCell-warning.saltInput-bordered.saltInput {
|
|
42
|
+
border-color: var(--salt-status-warning-foreground-informative);
|
|
43
|
+
|
|
44
|
+
& .saltInput-startAdornmentContainer {
|
|
45
|
+
& .vuuTableInputCell-icon {
|
|
46
|
+
--vuu-icon-color: var(--salt-status-warning-bold-background);
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
& .saltInput-endAdornmentContainer {
|
|
51
|
+
& .vuuTableInputCell-icon {
|
|
52
|
+
--vuu-icon-color: var(--salt-status-warning-bold-background);
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
.vuuTableCell-right {
|
|
58
|
+
& .saltInput-input {
|
|
59
|
+
text-align: right;
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
.vuuTableInputCell-edited {
|
|
64
|
+
border-left: solid var(--vuuTableInputCell-edited-color, var(--edit-indicator-color)) 4px !important;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
.vuuTableInputCell-error {
|
|
68
|
+
--edit-indicator-color: var(--salt-status-error-foreground-informative);
|
|
69
|
+
outline: var(--vuuTableCell-outline, solid var(--salt-status-error-foreground-informative) 2px);
|
|
70
|
+
outline-offset: -2px;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
.vuuTableInputCell-warning {
|
|
74
|
+
--edit-indicator-color: var(--salt-status-warning-foreground-informative);
|
|
75
|
+
outline: var(--vuuTableCell-outline, solid var(--salt-status-warning-foreground-informative) 2px);
|
|
76
|
+
outline-offset: -2px;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
|
|
80
|
+
`;
|
|
81
|
+
export default css;
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import { Input, Tooltip } from "@salt-ds/core";
|
|
3
|
+
import { useComponentCssInjection } from "@salt-ds/styles";
|
|
4
|
+
import { useWindow } from "@salt-ds/window";
|
|
5
|
+
import { Icon } from "@vuu-ui/vuu-ui-controls";
|
|
6
|
+
import { dataDescriptorTypeToVuuRowDataItemType, getVuuEditMessage, registerComponent } from "@vuu-ui/vuu-utils";
|
|
7
|
+
import clsx from "clsx";
|
|
8
|
+
import InputCell from "./InputCell.css";
|
|
9
|
+
import { useInputCell } from "./useInputCell.mjs";
|
|
10
|
+
const classBase = "vuuTableInputCell";
|
|
11
|
+
const InputCell_InputCell = ({ column, dataRow, editedDuringCurrentSession, onEdit })=>{
|
|
12
|
+
const targetWindow = useWindow();
|
|
13
|
+
useComponentCssInjection({
|
|
14
|
+
testId: "vuu-input-cell",
|
|
15
|
+
css: InputCell,
|
|
16
|
+
window: targetWindow
|
|
17
|
+
});
|
|
18
|
+
const dataValue = dataRow[column.name];
|
|
19
|
+
const { align = "left" } = column;
|
|
20
|
+
const { editing, warningMessage, previousValue = "", ...editProps } = useInputCell({
|
|
21
|
+
column,
|
|
22
|
+
onEdit,
|
|
23
|
+
type: dataDescriptorTypeToVuuRowDataItemType(column),
|
|
24
|
+
value: dataValue
|
|
25
|
+
});
|
|
26
|
+
const editRejected = getVuuEditMessage(dataRow, column, previousValue);
|
|
27
|
+
const endAdornment = editRejected && "left" === align ? /*#__PURE__*/ jsx(Tooltip, {
|
|
28
|
+
content: editRejected,
|
|
29
|
+
placement: "right",
|
|
30
|
+
children: /*#__PURE__*/ jsx(Icon, {
|
|
31
|
+
className: `${classBase}-icon`,
|
|
32
|
+
name: "error"
|
|
33
|
+
})
|
|
34
|
+
}) : warningMessage && "left" === align ? /*#__PURE__*/ jsx(Tooltip, {
|
|
35
|
+
content: warningMessage,
|
|
36
|
+
placement: "right",
|
|
37
|
+
children: /*#__PURE__*/ jsx(Icon, {
|
|
38
|
+
className: `${classBase}-icon`,
|
|
39
|
+
name: "error"
|
|
40
|
+
})
|
|
41
|
+
}) : void 0;
|
|
42
|
+
const startAdornment = editRejected && "right" === align ? /*#__PURE__*/ jsx(Tooltip, {
|
|
43
|
+
content: editRejected,
|
|
44
|
+
placement: "right",
|
|
45
|
+
children: /*#__PURE__*/ jsx(Icon, {
|
|
46
|
+
className: `${classBase}-icon`,
|
|
47
|
+
name: "error"
|
|
48
|
+
})
|
|
49
|
+
}) : warningMessage && "right" === align ? /*#__PURE__*/ jsx(Tooltip, {
|
|
50
|
+
content: warningMessage,
|
|
51
|
+
placement: "left",
|
|
52
|
+
children: /*#__PURE__*/ jsx(Icon, {
|
|
53
|
+
className: `${classBase}-icon`,
|
|
54
|
+
name: "error"
|
|
55
|
+
})
|
|
56
|
+
}) : void 0;
|
|
57
|
+
return /*#__PURE__*/ jsx(Input, {
|
|
58
|
+
...editProps,
|
|
59
|
+
bordered: true,
|
|
60
|
+
className: clsx(classBase, {
|
|
61
|
+
[`${classBase}-edited`]: true === editedDuringCurrentSession,
|
|
62
|
+
[`${classBase}-error`]: void 0 !== warningMessage,
|
|
63
|
+
[`${classBase}-warning`]: void 0 !== editRejected,
|
|
64
|
+
vuuEditing: editing
|
|
65
|
+
}),
|
|
66
|
+
endAdornment: endAdornment,
|
|
67
|
+
startAdornment: startAdornment
|
|
68
|
+
});
|
|
69
|
+
};
|
|
70
|
+
registerComponent("input-cell", InputCell_InputCell, "cell-renderer", {
|
|
71
|
+
userCanAssign: false
|
|
72
|
+
});
|
|
73
|
+
export { InputCell_InputCell as InputCell };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./InputCell.mjs";
|