@economic/taco 2.15.0 → 2.17.0
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/components/Drawer/Drawer.d.ts +5 -1
- package/dist/components/Provider/Localization.d.ts +19 -0
- package/dist/components/SearchInput2/SearchInput2.d.ts +1 -0
- package/dist/components/Table3/Table3.d.ts +0 -2
- package/dist/components/Table3/components/alert/ErrorAlert.d.ts +10 -0
- package/dist/components/Table3/components/columns/cell/DisplayCell.d.ts +5 -2
- package/dist/components/Table3/components/columns/cell/EditingCell.d.ts +3 -0
- package/dist/components/Table3/components/columns/cell/EditingControl.d.ts +1 -1
- package/dist/components/Table3/components/columns/cell/Highlight.d.ts +2 -0
- package/dist/components/Table3/components/columns/header/Header.d.ts +1 -1
- package/dist/components/Table3/components/columns/internal/EditingActions.d.ts +1 -1
- package/dist/components/Table3/components/columns/styles.d.ts +2 -2
- package/dist/components/Table3/components/rows/Row.d.ts +5 -1
- package/dist/components/Table3/components/rows/RowContext.d.ts +1 -0
- package/dist/components/Table3/hooks/features/useEditing.d.ts +12 -11
- package/dist/components/Table3/hooks/features/{usePauseHoverState.d.ts → usePauseShortcuts.d.ts} +1 -2
- package/dist/components/Table3/hooks/features/useSearch.d.ts +3 -3
- package/dist/components/Table3/hooks/features/useValidation.d.ts +13 -0
- package/dist/components/Table3/hooks/useTable.d.ts +25 -20
- package/dist/components/Table3/types.d.ts +41 -19
- package/dist/components/Table3/util/editing.d.ts +6 -0
- package/dist/components/Table3/util/scrolling.d.ts +2 -0
- package/dist/esm/index.css +108 -33
- package/dist/esm/packages/taco/src/components/Banner/Banner.js +2 -2
- package/dist/esm/packages/taco/src/components/Banner/Banner.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Calendar/Calendar.js +4 -4
- package/dist/esm/packages/taco/src/components/Calendar/Calendar.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Combobox/Combobox.js +3 -3
- package/dist/esm/packages/taco/src/components/Combobox/Combobox.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Combobox/useCombobox.js +2 -1
- package/dist/esm/packages/taco/src/components/Combobox/useCombobox.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Datepicker/Datepicker.js +6 -6
- package/dist/esm/packages/taco/src/components/Datepicker/Datepicker.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Dialog/components/Content.js +3 -3
- package/dist/esm/packages/taco/src/components/Dialog/components/Content.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Drawer/Drawer.js +7 -2
- package/dist/esm/packages/taco/src/components/Drawer/Drawer.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Drawer/components/Content.js +7 -7
- package/dist/esm/packages/taco/src/components/Drawer/components/Content.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Field/Field.js +2 -2
- package/dist/esm/packages/taco/src/components/Field/Field.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Header/components/Agreement/Item.js +2 -2
- package/dist/esm/packages/taco/src/components/Header/components/Agreement/Item.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Header/components/AgreementSelector.js +4 -4
- package/dist/esm/packages/taco/src/components/Header/components/AgreementSelector.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Header/components/Link.js +2 -2
- package/dist/esm/packages/taco/src/components/Header/components/Link.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Icon/Icon.js +2 -2
- package/dist/esm/packages/taco/src/components/Icon/Icon.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Layout/components/Sidebar.js +2 -2
- package/dist/esm/packages/taco/src/components/Layout/components/Sidebar.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Listbox/ScrollableList.js +6 -6
- package/dist/esm/packages/taco/src/components/Listbox/ScrollableList.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Menu/components/Item.js +4 -4
- package/dist/esm/packages/taco/src/components/Menu/components/Item.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Navigation/Navigation.js +2 -2
- package/dist/esm/packages/taco/src/components/Navigation/Navigation.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Navigation2/components/Link.js +3 -3
- package/dist/esm/packages/taco/src/components/Navigation2/components/Link.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Navigation2/components/Section.js +2 -2
- package/dist/esm/packages/taco/src/components/Navigation2/components/Section.js.map +1 -1
- package/dist/esm/packages/taco/src/components/OverflowGroup/OverflowGroup.js +1 -1
- package/dist/esm/packages/taco/src/components/OverflowGroup/OverflowGroup.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Pagination/PageNumbers.js +2 -2
- package/dist/esm/packages/taco/src/components/Pagination/PageNumbers.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Pagination/Pagination.js +5 -5
- package/dist/esm/packages/taco/src/components/Pagination/Pagination.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Popover/Popover.js +2 -2
- package/dist/esm/packages/taco/src/components/Popover/Popover.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Provider/Localization.js +19 -0
- package/dist/esm/packages/taco/src/components/Provider/Localization.js.map +1 -1
- package/dist/esm/packages/taco/src/components/SearchInput/SearchInput.js +2 -2
- package/dist/esm/packages/taco/src/components/SearchInput/SearchInput.js.map +1 -1
- package/dist/esm/packages/taco/src/components/SearchInput2/SearchInput2.js +12 -8
- package/dist/esm/packages/taco/src/components/SearchInput2/SearchInput2.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Select/useSelect.js +2 -2
- package/dist/esm/packages/taco/src/components/Select/useSelect.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Select2/Select2.js +7 -7
- package/dist/esm/packages/taco/src/components/Select2/Select2.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Select2/components/Edit.js +8 -8
- package/dist/esm/packages/taco/src/components/Select2/components/Edit.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Select2/components/Option.js +5 -5
- package/dist/esm/packages/taco/src/components/Select2/components/Option.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Select2/components/Trigger.js +10 -10
- package/dist/esm/packages/taco/src/components/Select2/components/Trigger.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Shortcut/Shortcut.js +2 -2
- package/dist/esm/packages/taco/src/components/Shortcut/Shortcut.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Table/components/BaseTable.js +3 -3
- package/dist/esm/packages/taco/src/components/Table/components/BaseTable.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Table/components/WindowedTable.js +2 -2
- package/dist/esm/packages/taco/src/components/Table/components/WindowedTable.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Table/hooks/plugins/useRowActions.js +10 -10
- package/dist/esm/packages/taco/src/components/Table/hooks/plugins/useRowActions.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Table/util/renderColumn.js +2 -2
- package/dist/esm/packages/taco/src/components/Table/util/renderColumn.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Table3/Table3.js +37 -30
- package/dist/esm/packages/taco/src/components/Table3/Table3.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Table3/components/alert/ErrorAlert.js +154 -0
- package/dist/esm/packages/taco/src/components/Table3/components/alert/ErrorAlert.js.map +1 -0
- package/dist/esm/packages/taco/src/components/Table3/components/columns/cell/Cell.js +54 -9
- package/dist/esm/packages/taco/src/components/Table3/components/columns/cell/Cell.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Table3/components/columns/cell/DisplayCell.js +9 -57
- package/dist/esm/packages/taco/src/components/Table3/components/columns/cell/DisplayCell.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Table3/components/columns/cell/EditingCell.js +72 -41
- package/dist/esm/packages/taco/src/components/Table3/components/columns/cell/EditingCell.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Table3/components/columns/cell/EditingControl.js +41 -17
- package/dist/esm/packages/taco/src/components/Table3/components/columns/cell/EditingControl.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Table3/components/columns/cell/Highlight.js +41 -0
- package/dist/esm/packages/taco/src/components/Table3/components/columns/cell/Highlight.js.map +1 -0
- package/dist/esm/packages/taco/src/components/Table3/components/columns/cell/controls/TextareaControl.js +23 -14
- package/dist/esm/packages/taco/src/components/Table3/components/columns/cell/controls/TextareaControl.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Table3/components/columns/footer/Footer.js +3 -3
- package/dist/esm/packages/taco/src/components/Table3/components/columns/footer/Footer.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Table3/components/columns/header/Group.js +1 -1
- package/dist/esm/packages/taco/src/components/Table3/components/columns/header/Group.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Table3/components/columns/header/Header.js +9 -9
- package/dist/esm/packages/taco/src/components/Table3/components/columns/header/Header.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Table3/components/columns/header/Menu.js +37 -6
- package/dist/esm/packages/taco/src/components/Table3/components/columns/header/Menu.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Table3/components/columns/internal/Actions.js +12 -12
- package/dist/esm/packages/taco/src/components/Table3/components/columns/internal/Actions.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Table3/components/columns/internal/Drag.js +2 -2
- package/dist/esm/packages/taco/src/components/Table3/components/columns/internal/Drag.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Table3/components/columns/internal/EditingActions.js +63 -23
- package/dist/esm/packages/taco/src/components/Table3/components/columns/internal/EditingActions.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Table3/components/columns/internal/Expansion.js +3 -3
- package/dist/esm/packages/taco/src/components/Table3/components/columns/internal/Expansion.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Table3/components/columns/internal/Selection.js +3 -3
- package/dist/esm/packages/taco/src/components/Table3/components/columns/internal/Selection.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Table3/components/columns/styles.js +2 -13
- package/dist/esm/packages/taco/src/components/Table3/components/columns/styles.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Table3/components/rows/Row.js +67 -57
- package/dist/esm/packages/taco/src/components/Table3/components/rows/Row.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Table3/components/rows/RowContext.js +2 -1
- package/dist/esm/packages/taco/src/components/Table3/components/rows/RowContext.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Table3/components/rows/SkeletonRow.js +2 -2
- package/dist/esm/packages/taco/src/components/Table3/components/rows/SkeletonRow.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Table3/components/toolbar/ColumnSettings.js +8 -6
- package/dist/esm/packages/taco/src/components/Table3/components/toolbar/ColumnSettings.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Table3/components/toolbar/Filter/filters/Filters.js +23 -8
- package/dist/esm/packages/taco/src/components/Table3/components/toolbar/Filter/filters/Filters.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Table3/components/toolbar/Filter/filters/components/FilterColumn.js +2 -2
- package/dist/esm/packages/taco/src/components/Table3/components/toolbar/Filter/filters/components/FilterColumn.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Table3/components/toolbar/Filter/filters/components/FilterComparator.js +2 -2
- package/dist/esm/packages/taco/src/components/Table3/components/toolbar/Filter/filters/components/FilterComparator.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Table3/components/toolbar/PrintButton/PrintButton.js +16 -16
- package/dist/esm/packages/taco/src/components/Table3/components/toolbar/PrintButton/PrintButton.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Table3/components/toolbar/PrintButton/PrintIFrame.js +1 -0
- package/dist/esm/packages/taco/src/components/Table3/components/toolbar/PrintButton/PrintIFrame.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Table3/components/toolbar/Search.js +53 -4
- package/dist/esm/packages/taco/src/components/Table3/components/toolbar/Search.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Table3/components/toolbar/Settings.js +8 -8
- package/dist/esm/packages/taco/src/components/Table3/components/toolbar/Settings.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Table3/hooks/features/useEditing.js +185 -101
- package/dist/esm/packages/taco/src/components/Table3/hooks/features/useEditing.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Table3/hooks/features/usePauseShortcuts.js +12 -0
- package/dist/esm/packages/taco/src/components/Table3/hooks/features/usePauseShortcuts.js.map +1 -0
- package/dist/esm/packages/taco/src/components/Table3/hooks/features/useSearch.js +4 -2
- package/dist/esm/packages/taco/src/components/Table3/hooks/features/useSearch.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Table3/hooks/features/useValidation.js +178 -0
- package/dist/esm/packages/taco/src/components/Table3/hooks/features/useValidation.js.map +1 -0
- package/dist/esm/packages/taco/src/components/Table3/hooks/listeners/useEditingStateListener.js +3 -3
- package/dist/esm/packages/taco/src/components/Table3/hooks/listeners/useEditingStateListener.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Table3/hooks/listeners/useSettingsStateListener.js +1 -49
- package/dist/esm/packages/taco/src/components/Table3/hooks/listeners/useSettingsStateListener.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Table3/hooks/useConvertChildrenToColumns.js +1 -2
- package/dist/esm/packages/taco/src/components/Table3/hooks/useConvertChildrenToColumns.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Table3/hooks/useCssVars.js +0 -2
- package/dist/esm/packages/taco/src/components/Table3/hooks/useCssVars.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Table3/hooks/useTable.js +135 -111
- package/dist/esm/packages/taco/src/components/Table3/hooks/useTable.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Table3/strategies/virtualised.js +4 -4
- package/dist/esm/packages/taco/src/components/Table3/strategies/virtualised.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Table3/types.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Table3/util/editing.js +21 -1
- package/dist/esm/packages/taco/src/components/Table3/util/editing.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Table3/util/scrolling.js +53 -0
- package/dist/esm/packages/taco/src/components/Table3/util/scrolling.js.map +1 -0
- package/dist/esm/packages/taco/src/components/Tag/Tag.js +4 -4
- package/dist/esm/packages/taco/src/components/Tag/Tag.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Toast/Toaster.js +2 -2
- package/dist/esm/packages/taco/src/components/Toast/Toaster.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Tour/Tour.js +4 -4
- package/dist/esm/packages/taco/src/components/Tour/Tour.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Treeview/Treeview.js +2 -2
- package/dist/esm/packages/taco/src/components/Treeview/Treeview.js.map +1 -1
- package/dist/esm/packages/taco/src/index.js +2 -1
- package/dist/esm/packages/taco/src/index.js.map +1 -1
- package/dist/esm/packages/taco/src/primitives/Table/types.js +10 -0
- package/dist/esm/packages/taco/src/primitives/Table/types.js.map +1 -0
- package/dist/esm/packages/taco/src/primitives/Table/useTable/features/useTableColumnOrdering.js +8 -0
- package/dist/esm/packages/taco/src/primitives/Table/useTable/features/useTableColumnOrdering.js.map +1 -0
- package/dist/esm/packages/taco/src/{components/Table3/hooks/features/useFontSize.js → primitives/Table/useTable/features/useTableFontSize.js} +3 -3
- package/dist/esm/packages/taco/src/primitives/Table/useTable/features/useTableFontSize.js.map +1 -0
- package/dist/esm/packages/taco/src/primitives/Table/useTable/features/useTablePrinting.js +14 -0
- package/dist/esm/packages/taco/src/primitives/Table/useTable/features/useTablePrinting.js.map +1 -0
- package/dist/esm/packages/taco/src/primitives/Table/useTable/features/useTableRowActive.js +100 -0
- package/dist/esm/packages/taco/src/primitives/Table/useTable/features/useTableRowActive.js.map +1 -0
- package/dist/esm/packages/taco/src/primitives/Table/useTable/features/useTableRowClick.js +30 -0
- package/dist/esm/packages/taco/src/primitives/Table/useTable/features/useTableRowClick.js.map +1 -0
- package/dist/esm/packages/taco/src/primitives/Table/useTable/features/useTableRowGoto.js +9 -0
- package/dist/esm/packages/taco/src/primitives/Table/useTable/features/useTableRowGoto.js.map +1 -0
- package/dist/esm/packages/taco/src/primitives/Table/useTable/features/useTableRowHeight.js +13 -0
- package/dist/esm/packages/taco/src/primitives/Table/useTable/features/useTableRowHeight.js.map +1 -0
- package/dist/esm/packages/taco/src/primitives/Table/useTable/features/useTableRowSelection.js +32 -0
- package/dist/esm/packages/taco/src/primitives/Table/useTable/features/useTableRowSelection.js.map +1 -0
- package/dist/esm/packages/taco/src/primitives/Table/useTable/features/useTableServerLoading.js +11 -0
- package/dist/esm/packages/taco/src/primitives/Table/useTable/features/useTableServerLoading.js.map +1 -0
- package/dist/esm/packages/taco/src/primitives/Table/useTable/listeners/useTableDataListener.js +15 -0
- package/dist/esm/packages/taco/src/primitives/Table/useTable/listeners/useTableDataListener.js.map +1 -0
- package/dist/esm/packages/taco/src/{components/Table3/hooks/listeners/useFilteringStateListener.js → primitives/Table/useTable/listeners/useTableFilterListener.js} +3 -3
- package/dist/esm/packages/taco/src/primitives/Table/useTable/listeners/useTableFilterListener.js.map +1 -0
- package/dist/esm/packages/taco/src/primitives/Table/useTable/listeners/useTableFontSizeListener.js +40 -0
- package/dist/esm/packages/taco/src/primitives/Table/useTable/listeners/useTableFontSizeListener.js.map +1 -0
- package/dist/esm/packages/taco/src/{components/Table3/hooks/listeners/useRowSelectionListener.js → primitives/Table/useTable/listeners/useTableRowSelectionListener.js} +5 -6
- package/dist/esm/packages/taco/src/primitives/Table/useTable/listeners/useTableRowSelectionListener.js.map +1 -0
- package/dist/esm/packages/taco/src/{components/Table3/hooks/listeners/useServerLoadingListener.js → primitives/Table/useTable/listeners/useTableServerLoadingListener.js} +3 -3
- package/dist/esm/packages/taco/src/primitives/Table/useTable/listeners/useTableServerLoadingListener.js.map +1 -0
- package/dist/esm/packages/taco/src/{components/Table3/hooks/listeners/useShortcutsListener.js → primitives/Table/useTable/listeners/useTableShortcutsListener.js} +7 -7
- package/dist/esm/packages/taco/src/primitives/Table/useTable/listeners/useTableShortcutsListener.js.map +1 -0
- package/dist/esm/packages/taco/src/{components/Table3/hooks/listeners/useSortingStateListener.js → primitives/Table/useTable/listeners/useTableSortingListener.js} +6 -4
- package/dist/esm/packages/taco/src/primitives/Table/useTable/listeners/useTableSortingListener.js.map +1 -0
- package/dist/esm/packages/taco/src/{components/Table3/hooks/features/useColumnOrdering.js → primitives/Table/useTable/util/columns.js} +24 -15
- package/dist/esm/packages/taco/src/primitives/Table/useTable/util/columns.js.map +1 -0
- package/dist/esm/packages/taco/src/types.js +6 -0
- package/dist/esm/packages/taco/src/types.js.map +1 -0
- package/dist/esm/packages/taco/src/utils/date.js +0 -1
- package/dist/esm/packages/taco/src/utils/date.js.map +1 -1
- package/dist/index.css +108 -33
- package/dist/primitives/Table/types.d.ts +35 -0
- package/dist/primitives/Table/useTable/features/useTableColumnOrdering.d.ts +3 -0
- package/dist/primitives/Table/useTable/features/useTableFontSize.d.ts +7 -0
- package/dist/primitives/Table/useTable/features/useTablePrinting.d.ts +7 -0
- package/dist/primitives/Table/useTable/features/useTableRowActive.d.ts +12 -0
- package/dist/primitives/Table/useTable/features/useTableRowClick.d.ts +7 -0
- package/dist/primitives/Table/useTable/features/useTableRowGoto.d.ts +5 -0
- package/dist/primitives/Table/useTable/features/useTableRowHeight.d.ts +7 -0
- package/dist/primitives/Table/useTable/features/useTableRowSelection.d.ts +6 -0
- package/dist/primitives/Table/useTable/features/useTableServerLoading.d.ts +6 -0
- package/dist/primitives/Table/useTable/listeners/useTableDataListener.d.ts +2 -0
- package/dist/primitives/Table/useTable/listeners/useTableFilterListener.d.ts +3 -0
- package/dist/primitives/Table/useTable/listeners/useTableFontSizeListener.d.ts +2 -0
- package/dist/primitives/Table/useTable/listeners/useTableRowSelectionListener.d.ts +3 -0
- package/dist/primitives/Table/useTable/listeners/useTableServerLoadingListener.d.ts +3 -0
- package/dist/primitives/Table/useTable/listeners/useTableShortcutsListener.d.ts +3 -0
- package/dist/primitives/Table/useTable/listeners/useTableSortingListener.d.ts +3 -0
- package/dist/primitives/Table/useTable/util/columns.d.ts +4 -0
- package/dist/taco.cjs.development.js +2294 -1543
- package/dist/taco.cjs.development.js.map +1 -1
- package/dist/taco.cjs.production.min.js +1 -1
- package/dist/taco.cjs.production.min.js.map +1 -1
- package/dist/types.d.ts +5 -0
- package/package.json +3 -3
- package/types.json +13547 -12953
- package/dist/components/Table3/hooks/features/useColumnOrdering.d.ts +0 -6
- package/dist/components/Table3/hooks/features/useCurrentRow.d.ts +0 -11
- package/dist/components/Table3/hooks/features/useFontSize.d.ts +0 -7
- package/dist/components/Table3/hooks/features/usePrinting.d.ts +0 -8
- package/dist/components/Table3/hooks/features/useRowClick.d.ts +0 -6
- package/dist/components/Table3/hooks/features/useRowGoto.d.ts +0 -5
- package/dist/components/Table3/hooks/features/useRowHeight.d.ts +0 -7
- package/dist/components/Table3/hooks/features/useRowSelection.d.ts +0 -6
- package/dist/components/Table3/hooks/listeners/useCurrentRowListener.d.ts +0 -2
- package/dist/components/Table3/hooks/listeners/useFilteringStateListener.d.ts +0 -3
- package/dist/components/Table3/hooks/listeners/useRowSelectionListener.d.ts +0 -3
- package/dist/components/Table3/hooks/listeners/useServerLoadingListener.d.ts +0 -3
- package/dist/components/Table3/hooks/listeners/useShortcutsListener.d.ts +0 -3
- package/dist/components/Table3/hooks/listeners/useSortingStateListener.d.ts +0 -3
- package/dist/esm/packages/taco/src/components/Table3/hooks/features/useColumnOrdering.js.map +0 -1
- package/dist/esm/packages/taco/src/components/Table3/hooks/features/useCurrentRow.js +0 -93
- package/dist/esm/packages/taco/src/components/Table3/hooks/features/useCurrentRow.js.map +0 -1
- package/dist/esm/packages/taco/src/components/Table3/hooks/features/useFontSize.js.map +0 -1
- package/dist/esm/packages/taco/src/components/Table3/hooks/features/usePauseHoverState.js +0 -22
- package/dist/esm/packages/taco/src/components/Table3/hooks/features/usePauseHoverState.js.map +0 -1
- package/dist/esm/packages/taco/src/components/Table3/hooks/features/usePrinting.js +0 -14
- package/dist/esm/packages/taco/src/components/Table3/hooks/features/usePrinting.js.map +0 -1
- package/dist/esm/packages/taco/src/components/Table3/hooks/features/useRowClick.js +0 -25
- package/dist/esm/packages/taco/src/components/Table3/hooks/features/useRowClick.js.map +0 -1
- package/dist/esm/packages/taco/src/components/Table3/hooks/features/useRowGoto.js +0 -9
- package/dist/esm/packages/taco/src/components/Table3/hooks/features/useRowGoto.js.map +0 -1
- package/dist/esm/packages/taco/src/components/Table3/hooks/features/useRowHeight.js +0 -27
- package/dist/esm/packages/taco/src/components/Table3/hooks/features/useRowHeight.js.map +0 -1
- package/dist/esm/packages/taco/src/components/Table3/hooks/features/useRowSelection.js +0 -32
- package/dist/esm/packages/taco/src/components/Table3/hooks/features/useRowSelection.js.map +0 -1
- package/dist/esm/packages/taco/src/components/Table3/hooks/listeners/useCurrentRowListener.js +0 -15
- package/dist/esm/packages/taco/src/components/Table3/hooks/listeners/useCurrentRowListener.js.map +0 -1
- package/dist/esm/packages/taco/src/components/Table3/hooks/listeners/useFilteringStateListener.js.map +0 -1
- package/dist/esm/packages/taco/src/components/Table3/hooks/listeners/useRowSelectionListener.js.map +0 -1
- package/dist/esm/packages/taco/src/components/Table3/hooks/listeners/useServerLoadingListener.js.map +0 -1
- package/dist/esm/packages/taco/src/components/Table3/hooks/listeners/useShortcutsListener.js.map +0 -1
- package/dist/esm/packages/taco/src/components/Table3/hooks/listeners/useSortingStateListener.js.map +0 -1
@@ -0,0 +1,178 @@
|
|
1
|
+
import React__default from 'react';
|
2
|
+
|
3
|
+
function useValidation(onCellValidate, onRowValidate) {
|
4
|
+
const [validationState, dispatch] = React__default.useReducer(validationReducer, {
|
5
|
+
errors: null,
|
6
|
+
draftErrors: null
|
7
|
+
});
|
8
|
+
function getCellError(cell) {
|
9
|
+
var _validationState$draf, _validationState$erro;
|
10
|
+
return validationState.draftErrors && ((_validationState$draf = validationState.draftErrors[cell.row.id]) === null || _validationState$draf === void 0 ? void 0 : _validationState$draf[cell.column.id]) || (validationState.errors ? (_validationState$erro = validationState.errors[cell.row.id]) === null || _validationState$erro === void 0 ? void 0 : _validationState$erro[cell.column.id] : undefined);
|
11
|
+
}
|
12
|
+
function setCellError(rowId, cellId, error) {
|
13
|
+
dispatch({
|
14
|
+
type: ValidationActionType.SET_CELL_ERROR,
|
15
|
+
payload: {
|
16
|
+
rowId,
|
17
|
+
cellId,
|
18
|
+
error
|
19
|
+
}
|
20
|
+
});
|
21
|
+
}
|
22
|
+
function setRowErrors(rowId, errors) {
|
23
|
+
dispatch({
|
24
|
+
type: ValidationActionType.SET_ROW_ERROR,
|
25
|
+
payload: {
|
26
|
+
rowId,
|
27
|
+
errors
|
28
|
+
}
|
29
|
+
});
|
30
|
+
}
|
31
|
+
function confirmErrors(rowId) {
|
32
|
+
dispatch({
|
33
|
+
type: ValidationActionType.CONFIRN_ERRORS,
|
34
|
+
payload: {
|
35
|
+
rowId
|
36
|
+
}
|
37
|
+
});
|
38
|
+
}
|
39
|
+
function resetErrors(rowId, cellId) {
|
40
|
+
dispatch({
|
41
|
+
type: ValidationActionType.RESET_ERRORS,
|
42
|
+
payload: {
|
43
|
+
rowId,
|
44
|
+
cellId
|
45
|
+
}
|
46
|
+
});
|
47
|
+
}
|
48
|
+
const setErrors = (errors, rowId, cellId) => {
|
49
|
+
if (cellId) {
|
50
|
+
setCellError(rowId, cellId, errors[cellId]);
|
51
|
+
} else {
|
52
|
+
setRowErrors(rowId, errors);
|
53
|
+
}
|
54
|
+
};
|
55
|
+
const validate = (rowId, row, cellId) => {
|
56
|
+
let validationPromise;
|
57
|
+
if (cellId && onCellValidate) {
|
58
|
+
validationPromise = onCellValidate(row[cellId], cellId, row);
|
59
|
+
} else if (onRowValidate) {
|
60
|
+
validationPromise = onRowValidate(row);
|
61
|
+
} else {
|
62
|
+
validationPromise = new Promise(resolve => {
|
63
|
+
resolve();
|
64
|
+
});
|
65
|
+
}
|
66
|
+
validationPromise.then(() => {
|
67
|
+
// Need to reset previous errors,
|
68
|
+
// since promise resolve is the only place where we consider that previous errors is not relevant anymore.
|
69
|
+
resetErrors(rowId, cellId);
|
70
|
+
}).catch(errors => {
|
71
|
+
setErrors(errors, rowId, cellId);
|
72
|
+
});
|
73
|
+
return validationPromise;
|
74
|
+
};
|
75
|
+
return {
|
76
|
+
validate,
|
77
|
+
setCellError,
|
78
|
+
setRowErrors,
|
79
|
+
confirmErrors,
|
80
|
+
getCellError,
|
81
|
+
resetErrors,
|
82
|
+
errors: validationState.errors,
|
83
|
+
draftErrors: validationState.draftErrors
|
84
|
+
};
|
85
|
+
}
|
86
|
+
// Taking care of reseting/removing errors for particular cell/row and reseting errors object to null, when no errors at all.
|
87
|
+
function _resetErrors(errors, rowId, columnId) {
|
88
|
+
let currentErrors = errors ? {
|
89
|
+
...errors
|
90
|
+
} : {};
|
91
|
+
if (currentErrors && currentErrors[rowId]) {
|
92
|
+
if (columnId) {
|
93
|
+
delete currentErrors[rowId][columnId];
|
94
|
+
const rowErrorsSet = Object.keys(currentErrors[rowId]);
|
95
|
+
if (rowErrorsSet.length === 0) {
|
96
|
+
delete currentErrors[rowId];
|
97
|
+
}
|
98
|
+
} else {
|
99
|
+
delete currentErrors[rowId];
|
100
|
+
}
|
101
|
+
}
|
102
|
+
const errorsSet = Object.keys(currentErrors);
|
103
|
+
if (errorsSet.length === 0) {
|
104
|
+
currentErrors = null;
|
105
|
+
}
|
106
|
+
return currentErrors;
|
107
|
+
}
|
108
|
+
var ValidationActionType;
|
109
|
+
(function (ValidationActionType) {
|
110
|
+
ValidationActionType[ValidationActionType["SET_CELL_ERROR"] = 0] = "SET_CELL_ERROR";
|
111
|
+
ValidationActionType[ValidationActionType["SET_ROW_ERROR"] = 1] = "SET_ROW_ERROR";
|
112
|
+
ValidationActionType[ValidationActionType["CONFIRN_ERRORS"] = 2] = "CONFIRN_ERRORS";
|
113
|
+
ValidationActionType[ValidationActionType["RESET_ERRORS"] = 3] = "RESET_ERRORS";
|
114
|
+
})(ValidationActionType || (ValidationActionType = {}));
|
115
|
+
function validationReducer(state, action) {
|
116
|
+
var _state$draftErrors, _state$draftErrors2;
|
117
|
+
switch (action.type) {
|
118
|
+
// Saves cell error into draft errors state.
|
119
|
+
case ValidationActionType.SET_CELL_ERROR:
|
120
|
+
return {
|
121
|
+
...state,
|
122
|
+
draftErrors: {
|
123
|
+
...state.draftErrors,
|
124
|
+
[action.payload.rowId]: {
|
125
|
+
...((_state$draftErrors = state.draftErrors) === null || _state$draftErrors === void 0 ? void 0 : _state$draftErrors[action.payload.rowId]),
|
126
|
+
[action.payload.cellId]: action.payload.error
|
127
|
+
}
|
128
|
+
}
|
129
|
+
};
|
130
|
+
// Saves row errors into draft errors state.
|
131
|
+
case ValidationActionType.SET_ROW_ERROR:
|
132
|
+
return {
|
133
|
+
...state,
|
134
|
+
draftErrors: {
|
135
|
+
...state.draftErrors,
|
136
|
+
[action.payload.rowId]: {
|
137
|
+
...((_state$draftErrors2 = state.draftErrors) === null || _state$draftErrors2 === void 0 ? void 0 : _state$draftErrors2[action.payload.rowId]),
|
138
|
+
...action.payload.errors
|
139
|
+
}
|
140
|
+
}
|
141
|
+
};
|
142
|
+
// Promotes errors from draft into confirmed state (When user moves to next/prev row)
|
143
|
+
case ValidationActionType.CONFIRN_ERRORS:
|
144
|
+
{
|
145
|
+
const newDraftErrors = {
|
146
|
+
...state.draftErrors
|
147
|
+
};
|
148
|
+
const confirmedRow = {
|
149
|
+
...newDraftErrors[action.payload.rowId]
|
150
|
+
};
|
151
|
+
delete newDraftErrors[action.payload.rowId];
|
152
|
+
return {
|
153
|
+
draftErrors: newDraftErrors,
|
154
|
+
errors: {
|
155
|
+
...state.errors,
|
156
|
+
[action.payload.rowId]: confirmedRow
|
157
|
+
}
|
158
|
+
};
|
159
|
+
}
|
160
|
+
// Resets all errors for particular row or cell if cell id is passed.
|
161
|
+
// We need to reset both confirmed and draft errors, for the situations,
|
162
|
+
// when user is getting back to the row wich already had error.
|
163
|
+
case ValidationActionType.RESET_ERRORS:
|
164
|
+
{
|
165
|
+
const newDraftErrors = _resetErrors(state.draftErrors, action.payload.rowId, action.payload.cellId);
|
166
|
+
const newErrors = _resetErrors(state.errors, action.payload.rowId, action.payload.cellId);
|
167
|
+
return {
|
168
|
+
errors: newErrors,
|
169
|
+
draftErrors: newDraftErrors
|
170
|
+
};
|
171
|
+
}
|
172
|
+
default:
|
173
|
+
return state;
|
174
|
+
}
|
175
|
+
}
|
176
|
+
|
177
|
+
export { useValidation };
|
178
|
+
//# sourceMappingURL=useValidation.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"useValidation.js","sources":["../../../../../../../../../src/components/Table3/hooks/features/useValidation.ts"],"sourcesContent":["import React from 'react';\nimport * as _ from 'lodash';\nimport { Cell as RTCell } from '@tanstack/react-table';\nimport { RowErrors, Table3CellValidationHandler, Table3RowValidationHandler } from '../../types';\n\nexport type Table3Validation<TType = unknown> = {\n validate: (rowId: string, row: TType, cellId?: string) => Promise<void | RowErrors>;\n setCellError: (rowId: string, cellId: string, error: string) => void;\n setRowErrors: (rowId: string, errors: Record<string, string>) => void;\n confirmErrors: (rowId: string) => void;\n getCellError: <T extends TType>(cell: RTCell<T, unknown>) => string | undefined;\n resetErrors: (rowId: string, cellId?: string) => void;\n errors: Record<string, RowErrors> | null;\n draftErrors: Record<string, RowErrors> | null;\n};\n\nexport function useValidation<TType = unknown>(\n onCellValidate?: Table3CellValidationHandler<TType>,\n onRowValidate?: Table3RowValidationHandler<TType>\n): Table3Validation<TType> {\n const [validationState, dispatch] = React.useReducer(validationReducer, { errors: null, draftErrors: null });\n\n function getCellError<T extends TType>(cell: RTCell<T, unknown>) {\n return (\n (validationState.draftErrors && validationState.draftErrors[cell.row.id]?.[cell.column.id]) ||\n (validationState.errors ? validationState.errors[cell.row.id]?.[cell.column.id] : undefined)\n );\n }\n\n function setCellError(rowId: string, cellId: string, error: string) {\n dispatch({\n type: ValidationActionType.SET_CELL_ERROR,\n payload: { rowId, cellId, error },\n });\n }\n\n function setRowErrors(rowId: string, errors: Record<string, string>) {\n dispatch({\n type: ValidationActionType.SET_ROW_ERROR,\n payload: { rowId, errors },\n });\n }\n\n function confirmErrors(rowId: string) {\n dispatch({\n type: ValidationActionType.CONFIRN_ERRORS,\n payload: { rowId },\n });\n }\n\n function resetErrors(rowId: string, cellId?: string) {\n dispatch({\n type: ValidationActionType.RESET_ERRORS,\n payload: { rowId, cellId },\n });\n }\n\n const setErrors = (errors: RowErrors, rowId: string, cellId?: string) => {\n if (cellId) {\n setCellError(rowId, cellId, errors[cellId]);\n } else {\n setRowErrors(rowId, errors);\n }\n };\n\n const validate = (rowId: string, row: TType, cellId?: string) => {\n let validationPromise: Promise<RowErrors | void>;\n if (cellId && onCellValidate) {\n validationPromise = onCellValidate(row[cellId], cellId, row);\n } else if (onRowValidate) {\n validationPromise = onRowValidate(row);\n } else {\n validationPromise = new Promise(resolve => {\n resolve();\n });\n }\n\n validationPromise\n .then(() => {\n // Need to reset previous errors,\n // since promise resolve is the only place where we consider that previous errors is not relevant anymore.\n resetErrors(rowId, cellId);\n })\n .catch((errors: RowErrors) => {\n setErrors(errors, rowId, cellId);\n });\n\n return validationPromise;\n };\n\n return {\n validate,\n setCellError,\n setRowErrors,\n confirmErrors,\n getCellError,\n resetErrors,\n errors: validationState.errors,\n draftErrors: validationState.draftErrors,\n };\n}\n\n// Taking care of reseting/removing errors for particular cell/row and reseting errors object to null, when no errors at all.\nfunction _resetErrors(\n errors: Record<string, RowErrors> | null,\n rowId: string,\n columnId?: string\n): Record<string, RowErrors> | null {\n let currentErrors: Record<string, RowErrors> | null = errors ? { ...errors } : {};\n\n if (currentErrors && currentErrors[rowId]) {\n if (columnId) {\n delete currentErrors[rowId][columnId];\n const rowErrorsSet = Object.keys(currentErrors[rowId]);\n if (rowErrorsSet.length === 0) {\n delete currentErrors[rowId];\n }\n } else {\n delete currentErrors[rowId];\n }\n }\n\n const errorsSet = Object.keys(currentErrors);\n if (errorsSet.length === 0) {\n currentErrors = null;\n }\n\n return currentErrors;\n}\n\nenum ValidationActionType {\n SET_CELL_ERROR,\n SET_ROW_ERROR,\n CONFIRN_ERRORS,\n RESET_ERRORS,\n}\n\ntype ValidationState = {\n // According to UX requirement, while user still editing current row, the error alert should not be yet shown,\n // and row should not be highlighted in red, but error still need to be shown on a cell level when user moving from cell to cell.\n // This means that we need to maintain some kind of draft validation errors as well as confirmed errors.\n draftErrors: Record<string, RowErrors> | null;\n // sets of row errors\n errors: Record<string, RowErrors> | null;\n};\n\ntype ValidationAction =\n | { type: ValidationActionType.SET_CELL_ERROR; payload: { rowId: string; cellId: string; error: string } }\n | { type: ValidationActionType.SET_ROW_ERROR; payload: { rowId: string; errors: RowErrors } }\n | { type: ValidationActionType.CONFIRN_ERRORS; payload: { rowId: string } }\n | { type: ValidationActionType.RESET_ERRORS; payload: { rowId: string; cellId?: string } };\n\nfunction validationReducer(state: ValidationState, action: ValidationAction): ValidationState {\n switch (action.type) {\n // Saves cell error into draft errors state.\n case ValidationActionType.SET_CELL_ERROR:\n return {\n ...state,\n draftErrors: {\n ...state.draftErrors,\n [action.payload.rowId]: {\n ...state.draftErrors?.[action.payload.rowId],\n [action.payload.cellId]: action.payload.error,\n },\n },\n };\n\n // Saves row errors into draft errors state.\n case ValidationActionType.SET_ROW_ERROR:\n return {\n ...state,\n draftErrors: {\n ...state.draftErrors,\n [action.payload.rowId]: {\n ...state.draftErrors?.[action.payload.rowId],\n ...action.payload.errors,\n },\n },\n };\n\n // Promotes errors from draft into confirmed state (When user moves to next/prev row)\n case ValidationActionType.CONFIRN_ERRORS: {\n const newDraftErrors = { ...state.draftErrors };\n const confirmedRow = { ...newDraftErrors[action.payload.rowId] };\n delete newDraftErrors[action.payload.rowId];\n return {\n draftErrors: newDraftErrors,\n errors: {\n ...state.errors,\n [action.payload.rowId]: confirmedRow,\n },\n };\n }\n\n // Resets all errors for particular row or cell if cell id is passed.\n // We need to reset both confirmed and draft errors, for the situations,\n // when user is getting back to the row wich already had error.\n case ValidationActionType.RESET_ERRORS: {\n const newDraftErrors = _resetErrors(state.draftErrors, action.payload.rowId, action.payload.cellId);\n const newErrors = _resetErrors(state.errors, action.payload.rowId, action.payload.cellId);\n return {\n errors: newErrors,\n draftErrors: newDraftErrors,\n };\n }\n\n default:\n return state;\n }\n}\n"],"names":["useValidation","onCellValidate","onRowValidate","validationState","dispatch","React","useReducer","validationReducer","errors","draftErrors","getCellError","cell","_validationState$draf","row","id","column","_validationState$erro","undefined","setCellError","rowId","cellId","error","type","ValidationActionType","SET_CELL_ERROR","payload","setRowErrors","SET_ROW_ERROR","confirmErrors","CONFIRN_ERRORS","resetErrors","RESET_ERRORS","setErrors","validate","validationPromise","Promise","resolve","then","catch","_resetErrors","columnId","currentErrors","rowErrorsSet","Object","keys","length","errorsSet","state","action","_state$draftErrors","_state$draftErrors2","newDraftErrors","confirmedRow","newErrors"],"mappings":";;SAgBgBA,aAAaA,CACzBC,cAAmD,EACnDC,aAAiD;EAEjD,MAAM,CAACC,eAAe,EAAEC,QAAQ,CAAC,GAAGC,cAAK,CAACC,UAAU,CAACC,iBAAiB,EAAE;IAAEC,MAAM,EAAE,IAAI;IAAEC,WAAW,EAAE;GAAM,CAAC;EAE5G,SAASC,YAAYA,CAAkBC,IAAwB;;IAC3D,OACKR,eAAe,CAACM,WAAW,MAAAG,qBAAA,GAAIT,eAAe,CAACM,WAAW,CAACE,IAAI,CAACE,GAAG,CAACC,EAAE,CAAC,cAAAF,qBAAA,uBAAxCA,qBAAA,CAA2CD,IAAI,CAACI,MAAM,CAACD,EAAE,CAAC,MACzFX,eAAe,CAACK,MAAM,IAAAQ,qBAAA,GAAGb,eAAe,CAACK,MAAM,CAACG,IAAI,CAACE,GAAG,CAACC,EAAE,CAAC,cAAAE,qBAAA,uBAAnCA,qBAAA,CAAsCL,IAAI,CAACI,MAAM,CAACD,EAAE,CAAC,GAAGG,SAAS,CAAC;;EAIpG,SAASC,YAAYA,CAACC,KAAa,EAAEC,MAAc,EAAEC,KAAa;IAC9DjB,QAAQ,CAAC;MACLkB,IAAI,EAAEC,oBAAoB,CAACC,cAAc;MACzCC,OAAO,EAAE;QAAEN,KAAK;QAAEC,MAAM;QAAEC;;KAC7B,CAAC;;EAGN,SAASK,YAAYA,CAACP,KAAa,EAAE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nG,MAAMiC,SAAS,GAAGd,YAAY,CAACQ,KAAK,CAACvC,MAAM,EAAEwC,MAAM,CAACvB,OAAO,CAACN,KAAK,EAAE6B,MAAM,CAACvB,OAAO,CAACL,MAAM,CAAC;QACzF,OAAO;UACHZ,MAAM,EAAE6C,SAAS;UACjB5C,WAAW,EAAE0C;SAChB;;IAGL;MACI,OAAOJ,KAAK;;AAExB;;;;"}
|
package/dist/esm/packages/taco/src/components/Table3/hooks/listeners/useEditingStateListener.js
CHANGED
@@ -9,7 +9,7 @@ function useEditingStateListener(table) {
|
|
9
9
|
meta.editing.saveChangesIfNeeded();
|
10
10
|
});
|
11
11
|
}
|
12
|
-
}, [meta.
|
12
|
+
}, [meta.rowActive.rowActiveIndex]);
|
13
13
|
// save if editing gets toggled off
|
14
14
|
React__default.useEffect(() => {
|
15
15
|
if (meta.editing.isEnabled) {
|
@@ -17,8 +17,8 @@ function useEditingStateListener(table) {
|
|
17
17
|
requestAnimationFrame(() => {
|
18
18
|
meta.editing.saveChangesIfNeeded();
|
19
19
|
});
|
20
|
-
} else if (meta.
|
21
|
-
meta.
|
20
|
+
} else if (meta.rowActive.rowActiveIndex === undefined) {
|
21
|
+
meta.rowActive.setRowActiveIndex(0);
|
22
22
|
}
|
23
23
|
}
|
24
24
|
}, [meta.editing.isEditing]);
|
package/dist/esm/packages/taco/src/components/Table3/hooks/listeners/useEditingStateListener.js.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"useEditingStateListener.js","sources":["../../../../../../../../../src/components/Table3/hooks/listeners/useEditingStateListener.ts"],"sourcesContent":["import React from 'react';\nimport { Table as RTable, TableMeta } from '@tanstack/react-table';\n\nexport function useEditingStateListener<TType = unknown>(table: RTable<TType>) {\n const meta = table.options.meta as TableMeta<TType>;\n\n // save when the row changes\n React.useEffect(() => {\n if (meta.editing.isEnabled && meta.editing.isEditing) {\n requestAnimationFrame(() => {\n meta.editing.saveChangesIfNeeded();\n });\n }\n }, [meta.
|
1
|
+
{"version":3,"file":"useEditingStateListener.js","sources":["../../../../../../../../../src/components/Table3/hooks/listeners/useEditingStateListener.ts"],"sourcesContent":["import React from 'react';\nimport { Table as RTable, TableMeta } from '@tanstack/react-table';\n\nexport function useEditingStateListener<TType = unknown>(table: RTable<TType>) {\n const meta = table.options.meta as TableMeta<TType>;\n\n // save when the row changes\n React.useEffect(() => {\n if (meta.editing.isEnabled && meta.editing.isEditing) {\n requestAnimationFrame(() => {\n meta.editing.saveChangesIfNeeded();\n });\n }\n }, [meta.rowActive.rowActiveIndex]);\n\n // save if editing gets toggled off\n React.useEffect(() => {\n if (meta.editing.isEnabled) {\n if (!meta.editing.isEditing) {\n requestAnimationFrame(() => {\n meta.editing.saveChangesIfNeeded();\n });\n } else if (meta.rowActive.rowActiveIndex === undefined) {\n meta.rowActive.setRowActiveIndex(0);\n }\n }\n }, [meta.editing.isEditing]);\n}\n"],"names":["useEditingStateListener","table","meta","options","React","useEffect","editing","isEnabled","isEditing","requestAnimationFrame","saveChangesIfNeeded","rowActive","rowActiveIndex","undefined","setRowActiveIndex"],"mappings":";;SAGgBA,uBAAuBA,CAAkBC,KAAoB;EACzE,MAAMC,IAAI,GAAGD,KAAK,CAACE,OAAO,CAACD,IAAwB;;EAGnDE,cAAK,CAACC,SAAS,CAAC;IACZ,IAAIH,IAAI,CAACI,OAAO,CAACC,SAAS,IAAIL,IAAI,CAACI,OAAO,CAACE,SAAS,EAAE;MAClDC,qBAAqB,CAAC;QAClBP,IAAI,CAACI,OAAO,CAACI,mBAAmB,EAAE;OACrC,CAAC;;GAET,EAAE,CAACR,IAAI,CAACS,SAAS,CAACC,cAAc,CAAC,CAAC;;EAGnCR,cAAK,CAACC,SAAS,CAAC;IACZ,IAAIH,IAAI,CAACI,OAAO,CAACC,SAAS,EAAE;MACxB,IAAI,CAACL,IAAI,CAACI,OAAO,CAACE,SAAS,EAAE;QACzBC,qBAAqB,CAAC;UAClBP,IAAI,CAACI,OAAO,CAACI,mBAAmB,EAAE;SACrC,CAAC;OACL,MAAM,IAAIR,IAAI,CAACS,SAAS,CAACC,cAAc,KAAKC,SAAS,EAAE;QACpDX,IAAI,CAACS,SAAS,CAACG,iBAAiB,CAAC,CAAC,CAAC;;;GAG9C,EAAE,CAACZ,IAAI,CAACI,OAAO,CAACE,SAAS,CAAC,CAAC;AAChC;;;;"}
|
package/dist/esm/packages/taco/src/components/Table3/hooks/listeners/useSettingsStateListener.js
CHANGED
@@ -1,56 +1,8 @@
|
|
1
1
|
import React__default from 'react';
|
2
|
-
import { FONT_SIZE } from '../../components/toolbar/FontSize.js';
|
3
|
-
import { getFontBasedMinColumnSize } from '../../components/columns/styles.js';
|
4
2
|
|
5
3
|
function useSettingsStateListener(table, onChangeSettings) {
|
6
4
|
const meta = table.options.meta;
|
7
5
|
const state = table.getState();
|
8
|
-
const prevFontSize = React__default.useRef(meta.fontSize.size);
|
9
|
-
React__default.useEffect(() => {
|
10
|
-
const newFontSize = meta.fontSize.size;
|
11
|
-
const oldFontSize = prevFontSize.current;
|
12
|
-
const {
|
13
|
-
small,
|
14
|
-
medium,
|
15
|
-
large
|
16
|
-
} = FONT_SIZE;
|
17
|
-
let columnSizeChange = 0;
|
18
|
-
switch (`${oldFontSize}-${newFontSize}`) {
|
19
|
-
case `${small}-${medium}`:
|
20
|
-
columnSizeChange = 8;
|
21
|
-
break;
|
22
|
-
case `${small}-${large}`:
|
23
|
-
columnSizeChange = 16;
|
24
|
-
break;
|
25
|
-
case `${medium}-${small}`:
|
26
|
-
columnSizeChange = -8;
|
27
|
-
break;
|
28
|
-
case `${medium}-${large}`:
|
29
|
-
columnSizeChange = 8;
|
30
|
-
break;
|
31
|
-
case `${large}-${small}`:
|
32
|
-
columnSizeChange = -16;
|
33
|
-
break;
|
34
|
-
case `${large}-${medium}`:
|
35
|
-
columnSizeChange = -8;
|
36
|
-
break;
|
37
|
-
default:
|
38
|
-
columnSizeChange = 0;
|
39
|
-
break;
|
40
|
-
}
|
41
|
-
prevFontSize.current = newFontSize;
|
42
|
-
if (columnSizeChange === 0) {
|
43
|
-
return;
|
44
|
-
}
|
45
|
-
table.setColumnSizing(sizes => {
|
46
|
-
const minColumnSize = getFontBasedMinColumnSize(newFontSize);
|
47
|
-
return Object.fromEntries(Object.entries(sizes).map(([columnName, prevColumnSize]) => {
|
48
|
-
// Prevents width value in the setting to go below the minColumnSize
|
49
|
-
const newSize = Math.max(minColumnSize, prevColumnSize + columnSizeChange);
|
50
|
-
return [columnName, newSize];
|
51
|
-
}));
|
52
|
-
});
|
53
|
-
}, [meta.fontSize.size]);
|
54
6
|
React__default.useEffect(() => {
|
55
7
|
let handler;
|
56
8
|
if (typeof onChangeSettings === 'function') {
|
@@ -59,7 +11,7 @@ function useSettingsStateListener(table, onChangeSettings) {
|
|
59
11
|
}, 250);
|
60
12
|
}
|
61
13
|
return () => clearTimeout(handler);
|
62
|
-
}, [meta.columnFreezing.frozenColumnIndex, state.columnOrder, state.columnSizing, state.columnVisibility, meta.search.excludeUnmatchedResults, meta.fontSize.size, meta.rowHeight.height, meta.printing.
|
14
|
+
}, [meta.columnFreezing.frozenColumnIndex, state.columnOrder, state.columnSizing, state.columnVisibility, meta.search.excludeUnmatchedResults, meta.fontSize.size, meta.rowHeight.height, meta.printing.isWarningVisibleForLargeDatasets, state.sorting]);
|
63
15
|
}
|
64
16
|
|
65
17
|
export { useSettingsStateListener };
|
package/dist/esm/packages/taco/src/components/Table3/hooks/listeners/useSettingsStateListener.js.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"useSettingsStateListener.js","sources":["../../../../../../../../../src/components/Table3/hooks/listeners/useSettingsStateListener.ts"],"sourcesContent":["import React from 'react';\nimport { Table as RTable, TableMeta } from '@tanstack/react-table';\nimport { Table3SettingsHandler } from '../../types';\
|
1
|
+
{"version":3,"file":"useSettingsStateListener.js","sources":["../../../../../../../../../src/components/Table3/hooks/listeners/useSettingsStateListener.ts"],"sourcesContent":["import React from 'react';\nimport { Table as RTable, TableMeta } from '@tanstack/react-table';\nimport { Table3SettingsHandler } from '../../types';\n\nexport function useSettingsStateListener<TType = unknown>(\n table: RTable<TType>,\n onChangeSettings: Table3SettingsHandler | undefined\n) {\n const meta = table.options.meta as TableMeta<TType>;\n const state = table.getState();\n\n React.useEffect(() => {\n let handler;\n\n if (typeof onChangeSettings === 'function') {\n handler = setTimeout(() => {\n onChangeSettings(meta.getSettings());\n }, 250);\n }\n\n return () => clearTimeout(handler);\n }, [\n meta.columnFreezing.frozenColumnIndex,\n state.columnOrder,\n state.columnSizing,\n state.columnVisibility,\n meta.search.excludeUnmatchedResults,\n meta.fontSize.size,\n meta.rowHeight.height,\n meta.printing.isWarningVisibleForLargeDatasets,\n state.sorting,\n ]);\n}\n"],"names":["useSettingsStateListener","table","onChangeSettings","meta","options","state","getState","React","useEffect","handler","setTimeout","getSettings","clearTimeout","columnFreezing","frozenColumnIndex","columnOrder","columnSizing","columnVisibility","search","excludeUnmatchedResults","fontSize","size","rowHeight","height","printing","isWarningVisibleForLargeDatasets","sorting"],"mappings":";;SAIgBA,wBAAwBA,CACpCC,KAAoB,EACpBC,gBAAmD;EAEnD,MAAMC,IAAI,GAAGF,KAAK,CAACG,OAAO,CAACD,IAAwB;EACnD,MAAME,KAAK,GAAGJ,KAAK,CAACK,QAAQ,EAAE;EAE9BC,cAAK,CAACC,SAAS,CAAC;IACZ,IAAIC,OAAO;IAEX,IAAI,OAAOP,gBAAgB,KAAK,UAAU,EAAE;MACxCO,OAAO,GAAGC,UAAU,CAAC;QACjBR,gBAAgB,CAACC,IAAI,CAACQ,WAAW,EAAE,CAAC;OACvC,EAAE,GAAG,CAAC;;IAGX,OAAO,MAAMC,YAAY,CAACH,OAAO,CAAC;GACrC,EAAE,CACCN,IAAI,CAACU,cAAc,CAACC,iBAAiB,EACrCT,KAAK,CAACU,WAAW,EACjBV,KAAK,CAACW,YAAY,EAClBX,KAAK,CAACY,gBAAgB,EACtBd,IAAI,CAACe,MAAM,CAACC,uBAAuB,EACnChB,IAAI,CAACiB,QAAQ,CAACC,IAAI,EAClBlB,IAAI,CAACmB,SAAS,CAACC,MAAM,EACrBpB,IAAI,CAACqB,QAAQ,CAACC,gCAAgC,EAC9CpB,KAAK,CAACqB,OAAO,CAChB,CAAC;AACN;;;;"}
|
@@ -114,7 +114,6 @@ function useConvertChildrenToColumns(props, options, editing) {
|
|
114
114
|
// compiler cannot get filtering out undefined items, so using the type casting here
|
115
115
|
.filter(child => !!child); // need to remove undefined array items after processing the children
|
116
116
|
}
|
117
|
-
|
118
117
|
const columns = processChildren(props.children);
|
119
118
|
if (options.enableRowExpansion && props.expandedRowRenderer) {
|
120
119
|
columns.unshift(columnHelper.display(createRowExpansionColumn(props.expandedRowRenderer)));
|
@@ -129,7 +128,7 @@ function useConvertChildrenToColumns(props, options, editing) {
|
|
129
128
|
columns.push(columnHelper.display(createRowActionsColumn()));
|
130
129
|
}
|
131
130
|
if (editing.isEnabled && editing.isEditing) {
|
132
|
-
columns.push(columnHelper.display(createRowEditingActionsColumn()));
|
131
|
+
columns.push(columnHelper.display(createRowEditingActionsColumn(props.rowIdentifier)));
|
133
132
|
}
|
134
133
|
return {
|
135
134
|
columns,
|
package/dist/esm/packages/taco/src/components/Table3/hooks/useConvertChildrenToColumns.js.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"useConvertChildrenToColumns.js","sources":["../../../../../../../../src/components/Table3/hooks/useConvertChildrenToColumns.tsx"],"sourcesContent":["import React from 'react';\nimport {\n ColumnDef,\n ColumnSizingState,\n createColumnHelper,\n ColumnSort,\n VisibilityState,\n GroupColumnDef,\n} from '@tanstack/react-table';\nimport { Table3ColumnProps, Table3Props, Table3Options, Table3ColumnDataType, Table3SortFn, Table3GroupProps } from '../types';\nimport { Header } from '../components/columns/header/Header';\nimport { Footer } from '../components/columns/footer/Footer';\nimport { Cell } from '../components/columns/cell/Cell';\nimport { createRowSelectionColumn } from '../components/columns/internal/Selection';\nimport { getFontBasedMinColumnSize } from '../components/columns/styles';\nimport { createRowActionsColumn } from '../components/columns/internal/Actions';\nimport { createRowExpansionColumn } from '../components/columns/internal/Expansion';\nimport { createRowDragColumn } from '../components/columns/internal/Drag';\nimport { createRowEditingActionsColumn } from '../components/columns/internal/EditingActions';\nimport { useEditing } from './features/useEditing';\nimport { Group } from '../components/columns/header/Group';\n\nfunction getSortingFn<TType = unknown>(dataType?: Table3ColumnDataType, customFnOrBuiltIn?: Table3SortFn<TType>) {\n if (typeof customFnOrBuiltIn === 'function') {\n return (rowA, rowB, columnId) => customFnOrBuiltIn(rowA.original, rowB.original, columnId);\n }\n\n // if a built in is being used, just return that\n if (customFnOrBuiltIn) {\n return customFnOrBuiltIn;\n }\n\n // some times we alias based on the type\n if (dataType && dataType !== 'boolean' && dataType !== 'number') {\n return dataType;\n }\n\n // otherwise fall back to auto\n return 'auto';\n}\n\nexport function useConvertChildrenToColumns<TType = unknown>(\n props: Table3Props<TType>,\n options: Table3Options,\n editing: ReturnType<typeof useEditing>\n) {\n const minColumnSize = getFontBasedMinColumnSize(props?.defaultSettings?.fontSize);\n // It's important to memoise column definitions, because it prevents columns like \"Drag column\" to re-render on every state change,\n // and break dragging at the moment it happens.\n return React.useMemo(() => {\n const columnHelper = createColumnHelper<TType>();\n\n const defaultColumnSizing: ColumnSizingState = {};\n const defaultColumnVisibility: VisibilityState = {};\n const defaultSorting: ColumnSort[] = [];\n\n function processChild<TType>(child: React.ReactChild | React.ReactFragment | React.ReactPortal) {\n if (\n React.isValidElement<Table3ColumnProps<TType>>(child) &&\n (child as any).type?.displayName === 'Table3Column' &&\n child.props.accessor\n ) {\n if (child.props.defaultWidth) {\n defaultColumnSizing[child.props.accessor as string] =\n child.props.defaultWidth === 'grow' ? '1fr' : (child.props.defaultWidth as any);\n }\n\n if (child.props.defaultHidden && options.enableColumnHiding) {\n defaultColumnVisibility[child.props.accessor as string] = false;\n }\n\n if (child.props.sort !== undefined) {\n defaultSorting.push({\n id: child.props.accessor as string,\n desc: child.props.sort === 'desc',\n });\n }\n\n // return regular column definition\n return {\n accessorKey: child.props.accessor,\n id: child.props.accessor as string,\n header: Header,\n cell: Cell,\n footer: Footer,\n // sizing\n minSize: minColumnSize,\n enableResizing: child.props.enableResizing ?? true,\n // filtering\n enableColumnFilter: child.props.enableFiltering ?? true,\n filterFn: 'tacoFilter' as any,\n // sorting\n enableSorting: child.props.enableSorting ?? true,\n sortingFn: getSortingFn<TType>(child.props.dataType, child.props.sortFn),\n sortDescFirst: false,\n sortUndefined: 1,\n // visibility\n enableHiding: child.props.enableHiding ?? true,\n // custom options\n meta: {\n align: child.props.align,\n className: child.props.className,\n control: child.props.control,\n dataType: child.props.dataType,\n enableOrdering: child.props.enableOrdering ?? true,\n enablePrinting: child.props.enablePrinting ?? true,\n enableSearch: child.props.enableSearch ?? true,\n enableTruncate: child.props.enableTruncate ?? false,\n filters: child.props.filters,\n footer: child.props.footer,\n header: child.props.header,\n headerClassName: child.props.headerClassName,\n menu: child.props.menu,\n renderer: child.props.renderer,\n tooltip: child.props.tooltip,\n },\n };\n } else if (\n React.isValidElement<Table3GroupProps>(child) &&\n (child as any).type?.displayName === 'Table3Group' &&\n child.props.children\n ) {\n // return column group definition\n return columnHelper.group({\n id: child.props.id,\n header: Group,\n columns: processChildren(child.props.children),\n meta: {\n align: 'center',\n enableOrdering: false,\n enableSearch: false,\n enableTruncate: false,\n header: child.props.header,\n },\n });\n }\n return;\n }\n\n function processChildren<TType = unknown>(\n children: (JSX.Element | boolean | null | undefined)[]\n ): Array<ColumnDef<TType> | GroupColumnDef<TType>> {\n return (\n React.Children.toArray(children)\n .map(processChild)\n // compiler cannot get filtering out undefined items, so using the type casting here\n .filter(child => !!child) as Array<ColumnDef<TType> | GroupColumnDef<TType>>\n ); // need to remove undefined array items after processing the children\n }\n\n const columns: ColumnDef<TType>[] = processChildren(props.children);\n\n if (options.enableRowExpansion && props.expandedRowRenderer) {\n columns.unshift(columnHelper.display(createRowExpansionColumn(props.expandedRowRenderer)));\n }\n\n if (options.enableRowSelection) {\n columns.unshift(\n columnHelper.display(\n createRowSelectionColumn<TType>(!!(options.enableRowDrag && props.onRowDrag), !!props.expandedRowRenderer)\n )\n );\n }\n\n if (options.enableRowDrag && props.onRowDrag) {\n columns.unshift(columnHelper.display(createRowDragColumn(props.onRowDrag)));\n }\n\n if (props.actionsForRow?.length) {\n columns.push(columnHelper.display(createRowActionsColumn<TType>()));\n }\n\n if (editing.isEnabled && editing.isEditing) {\n columns.push(columnHelper.display(createRowEditingActionsColumn<TType>()));\n }\n\n return { columns, defaultColumnSizing, defaultColumnVisibility, defaultSorting };\n }, [editing.isEditing]);\n}\n"],"names":["getSortingFn","dataType","customFnOrBuiltIn","rowA","rowB","columnId","original","useConvertChildrenToColumns","props","options","editing","minColumnSize","getFontBasedMinColumnSize","_props$defaultSetting","defaultSettings","fontSize","React","useMemo","columnHelper","createColumnHelper","defaultColumnSizing","defaultColumnVisibility","defaultSorting","processChild","child","isValidElement","_child$type","type","displayName","accessor","_child$props$enableRe","_child$props$enableFi","_child$props$enableSo","_child$props$enableHi","_child$props$enableOr","_child$props$enablePr","_child$props$enableSe","_child$props$enableTr","defaultWidth","defaultHidden","enableColumnHiding","sort","undefined","push","id","desc","accessorKey","header","Header","cell","Cell","footer","Footer","minSize","enableResizing","enableColumnFilter","enableFiltering","filterFn","enableSorting","sortingFn","sortFn","sortDescFirst","sortUndefined","enableHiding","meta","align","className","control","enableOrdering","enablePrinting","enableSearch","enableTruncate","filters","headerClassName","menu","renderer","tooltip","_child$type2","children","group","Group","columns","processChildren","Children","toArray","map","filter","enableRowExpansion","expandedRowRenderer","unshift","display","createRowExpansionColumn","enableRowSelection","createRowSelectionColumn","enableRowDrag","onRowDrag","createRowDragColumn","_props$actionsForRow","actionsForRow","length","createRowActionsColumn","isEnabled","isEditing","createRowEditingActionsColumn"],"mappings":";;;;;;;;;;;;;AAsBA,SAASA,YAAYA,CAAkBC,QAA+B,EAAEC,iBAAuC;EAC3G,IAAI,OAAOA,iBAA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CAACuF,SAAS,CAAC,EAAE,CAAC,CAACvF,KAAK,CAACgF,mBAAmB,CAAC,CAC7G,CACJ;;IAGL,IAAI/E,OAAO,CAACqF,aAAa,IAAItF,KAAK,CAACuF,SAAS,EAAE;MAC1Cd,OAAO,CAACQ,OAAO,CAACvE,YAAY,CAACwE,OAAO,CAACM,mBAAmB,CAACxF,KAAK,CAACuF,SAAS,CAAC,CAAC,CAAC;;IAG/E,KAAAE,oBAAA,GAAIzF,KAAK,CAAC0F,aAAa,cAAAD,oBAAA,eAAnBA,oBAAA,CAAqBE,MAAM,EAAE;MAC7BlB,OAAO,CAACtC,IAAI,CAACzB,YAAY,CAACwE,OAAO,CAACU,sBAAsB,EAAS,CAAC,CAAC;;IAGvE,IAAI1F,OAAO,CAAC2F,SAAS,IAAI3F,OAAO,CAAC4F,SAAS,EAAE;MACxCrB,OAAO,CAACtC,IAAI,CAACzB,YAAY,CAACwE,OAAO,CAACa,6BAA6B,EAAS,CAAC,CAAC;;IAG9E,OAAO;MAAEtB,OAAO;MAAE7D,mBAAmB;MAAEC,uBAAuB;MAAEC;KAAgB;GACnF,EAAE,CAACZ,OAAO,CAAC4F,SAAS,CAAC,CAAC;AAC3B;;;;"}
|
1
|
+
{"version":3,"file":"useConvertChildrenToColumns.js","sources":["../../../../../../../../src/components/Table3/hooks/useConvertChildrenToColumns.tsx"],"sourcesContent":["import React from 'react';\nimport {\n ColumnDef,\n ColumnSizingState,\n createColumnHelper,\n ColumnSort,\n VisibilityState,\n GroupColumnDef,\n} from '@tanstack/react-table';\nimport { Table3ColumnProps, Table3Props, Table3Options, Table3ColumnDataType, Table3SortFn, Table3GroupProps } from '../types';\nimport { Header } from '../components/columns/header/Header';\nimport { Footer } from '../components/columns/footer/Footer';\nimport { Cell } from '../components/columns/cell/Cell';\nimport { createRowSelectionColumn } from '../components/columns/internal/Selection';\nimport { getFontBasedMinColumnSize } from '../components/columns/styles';\nimport { createRowActionsColumn } from '../components/columns/internal/Actions';\nimport { createRowExpansionColumn } from '../components/columns/internal/Expansion';\nimport { createRowDragColumn } from '../components/columns/internal/Drag';\nimport { createRowEditingActionsColumn } from '../components/columns/internal/EditingActions';\nimport { useEditing } from './features/useEditing';\nimport { Group } from '../components/columns/header/Group';\n\nfunction getSortingFn<TType = unknown>(dataType?: Table3ColumnDataType, customFnOrBuiltIn?: Table3SortFn<TType>) {\n if (typeof customFnOrBuiltIn === 'function') {\n return (rowA, rowB, columnId) => customFnOrBuiltIn(rowA.original, rowB.original, columnId);\n }\n\n // if a built in is being used, just return that\n if (customFnOrBuiltIn) {\n return customFnOrBuiltIn;\n }\n\n // some times we alias based on the type\n if (dataType && dataType !== 'boolean' && dataType !== 'number') {\n return dataType;\n }\n\n // otherwise fall back to auto\n return 'auto';\n}\n\nexport function useConvertChildrenToColumns<TType = unknown>(\n props: Table3Props<TType>,\n options: Table3Options,\n editing: ReturnType<typeof useEditing>\n) {\n const minColumnSize = getFontBasedMinColumnSize(props?.defaultSettings?.fontSize);\n // It's important to memoise column definitions, because it prevents columns like \"Drag column\" to re-render on every state change,\n // and break dragging at the moment it happens.\n return React.useMemo(() => {\n const columnHelper = createColumnHelper<TType>();\n\n const defaultColumnSizing: ColumnSizingState = {};\n const defaultColumnVisibility: VisibilityState = {};\n const defaultSorting: ColumnSort[] = [];\n\n function processChild<TType>(child: React.ReactChild | React.ReactFragment | React.ReactPortal) {\n if (\n React.isValidElement<Table3ColumnProps<TType>>(child) &&\n (child as any).type?.displayName === 'Table3Column' &&\n child.props.accessor\n ) {\n if (child.props.defaultWidth) {\n defaultColumnSizing[child.props.accessor as string] =\n child.props.defaultWidth === 'grow' ? '1fr' : (child.props.defaultWidth as any);\n }\n\n if (child.props.defaultHidden && options.enableColumnHiding) {\n defaultColumnVisibility[child.props.accessor as string] = false;\n }\n\n if (child.props.sort !== undefined) {\n defaultSorting.push({\n id: child.props.accessor as string,\n desc: child.props.sort === 'desc',\n });\n }\n\n // return regular column definition\n return {\n accessorKey: child.props.accessor,\n id: child.props.accessor as string,\n header: Header,\n cell: Cell,\n footer: Footer,\n // sizing\n minSize: minColumnSize,\n enableResizing: child.props.enableResizing ?? true,\n // filtering\n enableColumnFilter: child.props.enableFiltering ?? true,\n filterFn: 'tacoFilter' as any,\n // sorting\n enableSorting: child.props.enableSorting ?? true,\n sortingFn: getSortingFn<TType>(child.props.dataType, child.props.sortFn),\n sortDescFirst: false,\n sortUndefined: 1,\n // visibility\n enableHiding: child.props.enableHiding ?? true,\n // custom options\n meta: {\n align: child.props.align,\n className: child.props.className,\n control: child.props.control,\n dataType: child.props.dataType,\n enableOrdering: child.props.enableOrdering ?? true,\n enablePrinting: child.props.enablePrinting ?? true,\n enableSearch: child.props.enableSearch ?? true,\n enableTruncate: child.props.enableTruncate ?? false,\n filters: child.props.filters,\n footer: child.props.footer,\n header: child.props.header,\n headerClassName: child.props.headerClassName,\n menu: child.props.menu,\n renderer: child.props.renderer,\n tooltip: child.props.tooltip,\n },\n };\n } else if (\n React.isValidElement<Table3GroupProps>(child) &&\n (child as any).type?.displayName === 'Table3Group' &&\n child.props.children\n ) {\n // return column group definition\n return columnHelper.group({\n id: child.props.id,\n header: Group,\n columns: processChildren(child.props.children),\n meta: {\n align: 'center',\n enableOrdering: false,\n enableSearch: false,\n enableTruncate: false,\n header: child.props.header,\n },\n });\n }\n return;\n }\n\n function processChildren<TType = unknown>(\n children: (JSX.Element | boolean | null | undefined)[]\n ): Array<ColumnDef<TType> | GroupColumnDef<TType>> {\n return (\n React.Children.toArray(children)\n .map(processChild)\n // compiler cannot get filtering out undefined items, so using the type casting here\n .filter(child => !!child) as Array<ColumnDef<TType> | GroupColumnDef<TType>>\n ); // need to remove undefined array items after processing the children\n }\n\n const columns: ColumnDef<TType>[] = processChildren(props.children);\n\n if (options.enableRowExpansion && props.expandedRowRenderer) {\n columns.unshift(columnHelper.display(createRowExpansionColumn(props.expandedRowRenderer)));\n }\n\n if (options.enableRowSelection) {\n columns.unshift(\n columnHelper.display(\n createRowSelectionColumn<TType>(!!(options.enableRowDrag && props.onRowDrag), !!props.expandedRowRenderer)\n )\n );\n }\n\n if (options.enableRowDrag && props.onRowDrag) {\n columns.unshift(columnHelper.display(createRowDragColumn(props.onRowDrag)));\n }\n\n if (props.actionsForRow?.length) {\n columns.push(columnHelper.display(createRowActionsColumn<TType>()));\n }\n\n if (editing.isEnabled && editing.isEditing) {\n columns.push(columnHelper.display(createRowEditingActionsColumn<TType>(props.rowIdentifier)));\n }\n\n return { columns, defaultColumnSizing, defaultColumnVisibility, defaultSorting };\n }, [editing.isEditing]);\n}\n"],"names":["getSortingFn","dataType","customFnOrBuiltIn","rowA","rowB","columnId","original","useConvertChildrenToColumns","props","options","editing","minColumnSize","getFontBasedMinColumnSize","_props$defaultSetting","defaultSettings","fontSize","React","useMemo","columnHelper","createColumnHelper","defaultColumnSizing","defaultColumnVisibility","defaultSorting","processChild","child","isValidElement","_child$type","type","displayName","accessor","_child$props$enableRe","_child$props$enableFi","_child$props$enableSo","_child$props$enableHi","_child$props$enableOr","_child$props$enablePr","_child$props$enableSe","_child$props$enableTr","defaultWidth","defaultHidden","enableColumnHiding","sort","undefined","push","id","desc","accessorKey","header","Header","cell","Cell","footer","Footer","minSize","enableResizing","enableColumnFilter","enableFiltering","filterFn","enableSorting","sortingFn","sortFn","sortDescFirst","sortUndefined","enableHiding","meta","align","className","control","enableOrdering","enablePrinting","enableSearch","enableTruncate","filters","headerClassName","menu","renderer","tooltip","_child$type2","children","group","Group","columns","processChildren","Children","toArray","map","filter","enableRowExpansion","expandedRowRenderer","unshift","display","createRowExpansionColumn","enableRowSelection","createRowSelectionColumn","enableRowDrag","onRowDrag","createRowDragColumn","_props$actionsForRow","actionsForRow","length","createRowActionsColumn","isEnabled","isEditing","createRowEditingActionsColumn","rowIdentifier"],"mappings":";;;;;;;;;;;;;AAsBA,SAASA,YAAYA,CAAkBC,QAA+B,EAAEC,iBAAuC;EAC3G,IAAI,OAAOA,iBAAiB,KAAK,UAAU,EAAE;IACzC,OAA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AACvF,KAAK,CAACgF,mBAAmB,CAAC,CAC7G,CACJ;;IAGL,IAAI/E,OAAO,CAACqF,aAAa,IAAItF,KAAK,CAACuF,SAAS,EAAE;MAC1Cd,OAAO,CAACQ,OAAO,CAACvE,YAAY,CAACwE,OAAO,CAACM,mBAAmB,CAACxF,KAAK,CAACuF,SAAS,CAAC,CAAC,CAAC;;IAG/E,KAAAE,oBAAA,GAAIzF,KAAK,CAAC0F,aAAa,cAAAD,oBAAA,eAAnBA,oBAAA,CAAqBE,MAAM,EAAE;MAC7BlB,OAAO,CAACtC,IAAI,CAACzB,YAAY,CAACwE,OAAO,CAACU,sBAAsB,EAAS,CAAC,CAAC;;IAGvE,IAAI1F,OAAO,CAAC2F,SAAS,IAAI3F,OAAO,CAAC4F,SAAS,EAAE;MACxCrB,OAAO,CAACtC,IAAI,CAACzB,YAAY,CAACwE,OAAO,CAACa,6BAA6B,CAAQ/F,KAAK,CAACgG,aAAa,CAAC,CAAC,CAAC;;IAGjG,OAAO;MAAEvB,OAAO;MAAE7D,mBAAmB;MAAEC,uBAAuB;MAAEC;KAAgB;GACnF,EAAE,CAACZ,OAAO,CAAC4F,SAAS,CAAC,CAAC;AAC3B;;;;"}
|
@@ -14,7 +14,6 @@ const getCellHeightPadding = (height, fontSize) => {
|
|
14
14
|
// py-1.5
|
15
15
|
}
|
16
16
|
}
|
17
|
-
|
18
17
|
case 'tall':
|
19
18
|
{
|
20
19
|
switch (fontSize) {
|
@@ -61,7 +60,6 @@ const getCellWidthPadding = fontSize => {
|
|
61
60
|
// py-1.5
|
62
61
|
}
|
63
62
|
};
|
64
|
-
|
65
63
|
const useCssVars = (height, fontSize) => {
|
66
64
|
const style = {
|
67
65
|
'--table3-cell-padding-x': getCellWidthPadding(fontSize),
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"useCssVars.js","sources":["../../../../../../../../src/components/Table3/hooks/useCssVars.ts"],"sourcesContent":["import { FONT_SIZE } from '../components/toolbar/FontSize';\nimport { Table3FontSize, Table3RowHeight } from '../types';\n\n// we cannot just use a fixed height because our rows need to grow in height (images, edit mode validation etc)\nconst getCellHeightPadding = (height: Table3RowHeight, fontSize: Table3FontSize) => {\n // TODO: can we get the rem values from tailwind\n switch (height) {\n case 'short': {\n switch (fontSize) {\n case FONT_SIZE.small:\n return '8px';\n\n default:\n return '6px'; // py-1.5\n }\n }\n\n case 'tall': {\n switch (fontSize) {\n case FONT_SIZE.small:\n return '16px';\n\n case FONT_SIZE.large:\n return '12px';\n\n default:\n return '14px';\n }\n }\n\n case 'extra-tall': {\n switch (fontSize) {\n case FONT_SIZE.small:\n return '22px';\n\n case FONT_SIZE.large:\n return '18px';\n\n default:\n return '20px';\n }\n }\n\n default: {\n switch (fontSize) {\n case FONT_SIZE.small:\n return '12px';\n\n case FONT_SIZE.large:\n return '8px';\n\n default:\n return '10px';\n }\n }\n }\n};\n\nconst getCellWidthPadding = (fontSize: Table3FontSize) => {\n switch (fontSize) {\n case FONT_SIZE.small:\n return '8px';\n\n case FONT_SIZE.medium:\n return '12px';\n\n default:\n return '16px'; // py-1.5\n }\n};\n\nexport const useCssVars = (height: Table3RowHeight, fontSize: Table3FontSize) => {\n const style = {\n '--table3-cell-padding-x': getCellWidthPadding(fontSize),\n '--table3-cell-padding-y': getCellHeightPadding(height, fontSize),\n };\n\n return { style };\n};\n"],"names":["getCellHeightPadding","height","fontSize","FONT_SIZE","small","large","getCellWidthPadding","medium","useCssVars","style"],"mappings":";;AAGA;AACA,MAAMA,oBAAoB,GAAGA,CAACC,MAAuB,EAAEC,QAAwB;;EAE3E,QAAQD,MAAM;IACV,KAAK,OAAO;MAAE;QACV,QAAQC,QAAQ;UACZ,KAAKC,SAAS,CAACC,KAAK;YAChB,OAAO,KAAK;UAEhB;YACI,OAAO,KAAK
|
1
|
+
{"version":3,"file":"useCssVars.js","sources":["../../../../../../../../src/components/Table3/hooks/useCssVars.ts"],"sourcesContent":["import { FONT_SIZE } from '../components/toolbar/FontSize';\nimport { Table3FontSize, Table3RowHeight } from '../types';\n\n// we cannot just use a fixed height because our rows need to grow in height (images, edit mode validation etc)\nconst getCellHeightPadding = (height: Table3RowHeight, fontSize: Table3FontSize) => {\n // TODO: can we get the rem values from tailwind\n switch (height) {\n case 'short': {\n switch (fontSize) {\n case FONT_SIZE.small:\n return '8px';\n\n default:\n return '6px'; // py-1.5\n }\n }\n\n case 'tall': {\n switch (fontSize) {\n case FONT_SIZE.small:\n return '16px';\n\n case FONT_SIZE.large:\n return '12px';\n\n default:\n return '14px';\n }\n }\n\n case 'extra-tall': {\n switch (fontSize) {\n case FONT_SIZE.small:\n return '22px';\n\n case FONT_SIZE.large:\n return '18px';\n\n default:\n return '20px';\n }\n }\n\n default: {\n switch (fontSize) {\n case FONT_SIZE.small:\n return '12px';\n\n case FONT_SIZE.large:\n return '8px';\n\n default:\n return '10px';\n }\n }\n }\n};\n\nconst getCellWidthPadding = (fontSize: Table3FontSize) => {\n switch (fontSize) {\n case FONT_SIZE.small:\n return '8px';\n\n case FONT_SIZE.medium:\n return '12px';\n\n default:\n return '16px'; // py-1.5\n }\n};\n\nexport const useCssVars = (height: Table3RowHeight, fontSize: Table3FontSize) => {\n const style = {\n '--table3-cell-padding-x': getCellWidthPadding(fontSize),\n '--table3-cell-padding-y': getCellHeightPadding(height, fontSize),\n };\n\n return { style };\n};\n"],"names":["getCellHeightPadding","height","fontSize","FONT_SIZE","small","large","getCellWidthPadding","medium","useCssVars","style"],"mappings":";;AAGA;AACA,MAAMA,oBAAoB,GAAGA,CAACC,MAAuB,EAAEC,QAAwB;;EAE3E,QAAQD,MAAM;IACV,KAAK,OAAO;MAAE;QACV,QAAQC,QAAQ;UACZ,KAAKC,SAAS,CAACC,KAAK;YAChB,OAAO,KAAK;UAEhB;YACI,OAAO,KAAK;;;;IAIxB,KAAK,MAAM;MAAE;QACT,QAAQF,QAAQ;UACZ,KAAKC,SAAS,CAACC,KAAK;YAChB,OAAO,MAAM;UAEjB,KAAKD,SAAS,CAACE,KAAK;YAChB,OAAO,MAAM;UAEjB;YACI,OAAO,MAAM;;;IAIzB,KAAK,YAAY;MAAE;QACf,QAAQH,QAAQ;UACZ,KAAKC,SAAS,CAACC,KAAK;YAChB,OAAO,MAAM;UAEjB,KAAKD,SAAS,CAACE,KAAK;YAChB,OAAO,MAAM;UAEjB;YACI,OAAO,MAAM;;;IAIzB;MAAS;QACL,QAAQH,QAAQ;UACZ,KAAKC,SAAS,CAACC,KAAK;YAChB,OAAO,MAAM;UAEjB,KAAKD,SAAS,CAACE,KAAK;YAChB,OAAO,KAAK;UAEhB;YACI,OAAO,MAAM;;;;AAIjC,CAAC;AAED,MAAMC,mBAAmB,GAAIJ,QAAwB;EACjD,QAAQA,QAAQ;IACZ,KAAKC,SAAS,CAACC,KAAK;MAChB,OAAO,KAAK;IAEhB,KAAKD,SAAS,CAACI,MAAM;MACjB,OAAO,MAAM;IAEjB;MACI,OAAO,MAAM;;;AAEzB,CAAC;MAEYC,UAAU,GAAGA,CAACP,MAAuB,EAAEC,QAAwB;EACxE,MAAMO,KAAK,GAAG;IACV,yBAAyB,EAAEH,mBAAmB,CAACJ,QAAQ,CAAC;IACxD,yBAAyB,EAAEF,oBAAoB,CAACC,MAAM,EAAEC,QAAQ;GACnE;EAED,OAAO;IAAEO;GAAO;AACpB;;;;"}
|