@economic/taco 2.16.0 → 2.17.1
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/components/Table3/Table3.d.ts +0 -2
- package/dist/components/Table3/components/columns/cell/EditingControl.d.ts +1 -1
- package/dist/components/Table3/components/columns/header/Header.d.ts +1 -1
- package/dist/components/Table3/components/columns/styles.d.ts +2 -2
- package/dist/components/Table3/components/rows/Row.d.ts +3 -1
- package/dist/components/Table3/hooks/features/useSearch.d.ts +1 -3
- package/dist/components/Table3/hooks/useTable.d.ts +21 -20
- package/dist/components/Table3/types.d.ts +15 -18
- package/dist/components/Table3/util/scrolling.d.ts +2 -0
- 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/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/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 +8 -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 +9 -9
- 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 +32 -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 +3 -3
- package/dist/esm/packages/taco/src/components/Table3/components/alert/ErrorAlert.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Table3/components/columns/cell/Cell.js +6 -6
- 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 +2 -2
- 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 +20 -16
- 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 +27 -3
- 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/controls/TextareaControl.js +2 -2
- 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 +2 -2
- 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 +7 -7
- 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 +32 -30
- 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/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 +15 -7
- 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 +10 -8
- 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/useSearch.js +1 -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/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 +0 -1
- 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 +127 -109
- 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 +3 -3
- 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/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/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 +834 -712
- 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 +11267 -13766
- 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/usePauseHoverState.d.ts +0 -6
- 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
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"Treeview.js","sources":["../../../../../../../src/components/Treeview/Treeview.tsx"],"sourcesContent":["import React from 'react';\nimport cn from 'classnames';\n\nexport type TreeviewItemProps = React.LinkHTMLAttributes<HTMLAnchorElement>;\n\nconst TreeviewItem = React.forwardRef(function TreeviewItem(props: TreeviewItemProps, ref: React.Ref<HTMLAnchorElement>) {\n return <a {...props} ref={ref} />;\n});\n\nexport type TreeviewGroupProps = Omit<React.LinkHTMLAttributes<HTMLDivElement>, 'className' | 'onClick' | 'title'> & {\n /** Add a classname to the treeview */\n className?: string | ((expanded: boolean) => string);\n /**\n * Set wheter the region is expanded, showing the children, or collapsed.\n * Default value is `false`\n */\n expanded?: boolean;\n /** Region is expanded at mount and can't be collapsed */\n fixed?: boolean;\n /** Handler called when user clicks the title of the group */\n onClick?: (event: React.MouseEvent<HTMLDivElement>, expanded: boolean) => void;\n /** Text displayed in the group's header */\n title: React.ReactNode | ((expanded: boolean) => React.ReactNode);\n};\n\nconst TreeviewGroup = React.forwardRef(function TreeviewGroup(props: TreeviewGroupProps, ref: React.Ref<HTMLDivElement>) {\n const {\n children,\n className: externalClassName,\n expanded: initialExpanded = false,\n title,\n fixed,\n onClick,\n ...otherProps\n } = props;\n const [expanded, setExpanded] = React.useState(fixed || initialExpanded);\n\n React.useEffect(() => {\n if (!fixed) {\n setExpanded(fixed || initialExpanded);\n }\n }, [fixed, initialExpanded]);\n\n const listClassName = cn('flex-col mb-0', {\n flex: expanded,\n hidden: !expanded,\n });\n\n const itemProps = {\n ...otherProps,\n 'aria-expanded': expanded,\n role: 'treeitem',\n tabIndex: -1,\n };\n\n const handleClick = (event: React.MouseEvent<HTMLDivElement>): void => {\n const nextState = !expanded;\n\n if (!fixed) {\n setExpanded(nextState);\n }\n\n if (onClick) {\n onClick(event, nextState);\n }\n };\n\n const className = typeof externalClassName === 'function' ? externalClassName(expanded) : externalClassName;\n\n return (\n <div {...itemProps} className={className} ref={ref}>\n <div onClick={handleClick}>{typeof title === 'function' ? title(expanded) : title}</div>\n <ul role=\"group\" className={listClassName}>\n {React.Children.toArray(children)\n .filter(item => !!item)\n .map((item, i) => (\n <li key={i} role=\"none\">\n {React.cloneElement(item as React.ReactElement<any>, { role: 'treeitem' })}\n </li>\n ))}\n </ul>\n </div>\n );\n});\n\nexport type TreeviewProps = React.HTMLAttributes<HTMLDivElement>;\n\nexport type ForwardedTreeviewWithStatics = React.ForwardRefExoticComponent<\n TreeviewProps & React.RefAttributes<HTMLDivElement>\n> & {\n /** Navigable link */\n Item: React.ForwardRefExoticComponent<TreeviewItemProps & React.RefAttributes<HTMLAnchorElement>>;\n /** Container for a set of related links, usually expandable */\n Group: React.ForwardRefExoticComponent<TreeviewGroupProps & React.RefAttributes<HTMLDivElement>>;\n};\n\nexport const Treeview = React.forwardRef(function Treeview(props: TreeviewProps, ref: React.Ref<HTMLDivElement>) {\n return <div {...props} ref={ref} role=\"tree\" />;\n}) as ForwardedTreeviewWithStatics;\n\nTreeview.Group = TreeviewGroup;\nTreeview.Item = TreeviewItem;\n"],"names":["TreeviewItem","React","forwardRef","props","ref","TreeviewGroup","children","className","externalClassName","expanded","initialExpanded","title","fixed","onClick","otherProps","setExpanded","useState","useEffect","listClassName","cn","flex","hidden","itemProps","role","tabIndex","handleClick","event","nextState","Children","toArray","filter","item","map","i","key","cloneElement","Treeview","Group","Item"],"mappings":";;;AAKA,MAAMA,YAAY,gBAAGC,cAAK,CAACC,UAAU,CAAC,SAASF,YAAYA,CAACG,KAAwB,EAAEC,GAAiC;EACnH,oBAAOH,oDAAOE,KAAK;IAAEC,GAAG,EAAEA;KAAO;AACrC,CAAC,CAAC;AAkBF,MAAMC,aAAa,gBAAGJ,cAAK,CAACC,UAAU,CAAC,SAASG,aAAaA,CAACF,KAAyB,EAAEC,GAA8B;EACnH,MAAM;IACFE,QAAQ;IACRC,SAAS,EAAEC,iBAAiB;IAC5BC,QAAQ,EAAEC,eAAe,GAAG,KAAK;IACjCC,KAAK;IACLC,KAAK;IACLC,OAAO;IACP,GAAGC;GACN,GAAGX,KAAK;EACT,MAAM,CAACM,QAAQ,EAAEM,WAAW,CAAC,GAAGd,cAAK,CAACe,QAAQ,CAACJ,KAAK,IAAIF,eAAe,CAAC;EAExET,cAAK,CAACgB,SAAS,CAAC;IACZ,IAAI,CAACL,KAAK,EAAE;MACRG,WAAW,CAACH,KAAK,IAAIF,eAAe,CAAC;;GAE5C,EAAE,CAACE,KAAK,EAAEF,eAAe,CAAC,CAAC;EAE5B,MAAMQ,aAAa,GAAGC,EAAE,CAAC,eAAe,EAAE;IACtCC,IAAI,EAAEX,QAAQ;IACdY,MAAM,EAAE,CAACZ;GACZ,CAAC;EAEF,MAAMa,SAAS,GAAG;IACd,GAAGR,UAAU;IACb,eAAe,EAAEL,QAAQ;IACzBc,IAAI,EAAE,UAAU;IAChBC,QAAQ,EAAE,CAAC;GACd;EAED,MAAMC,WAAW,GAAIC,KAAuC;IACxD,MAAMC,SAAS,GAAG,CAAClB,QAAQ;IAE3B,IAAI,CAACG,KAAK,EAAE;MACRG,WAAW,CAACY,SAAS,CAAC;;IAG1B,IAAId,OAAO,EAAE;MACTA,OAAO,CAACa,KAAK,EAAEC,SAAS,CAAC;;GAEhC;EAED,MAAMpB,SAAS,GAAG,OAAOC,iBAAiB,KAAK,UAAU,GAAGA,iBAAiB,CAACC,QAAQ,CAAC,GAAGD,iBAAiB;EAE3G,oBACIP,sDAASqB,SAAS;IAAEf,SAAS,EAAEA,SAAS;IAAEH,GAAG,EAAEA;mBAC3CH;IAAKY,OAAO,EAAEY;KAAc,OAAOd,KAAK,KAAK,UAAU,GAAGA,KAAK,CAACF,QAAQ,CAAC,GAAGE,KAAK,CAAO,eACxFV;IAAIsB,IAAI,EAAC,OAAO;IAAChB,SAAS,EAAEW;KACvBjB,cAAK,CAAC2B,QAAQ,CAACC,OAAO,CAACvB,QAAQ,CAAC,CAC5BwB,MAAM,CAACC,IAAI,IAAI,CAAC,CAACA,IAAI,CAAC,CACtBC,GAAG,CAAC,CAACD,IAAI,EAAEE,CAAC,
|
1
|
+
{"version":3,"file":"Treeview.js","sources":["../../../../../../../src/components/Treeview/Treeview.tsx"],"sourcesContent":["import React from 'react';\nimport cn from 'classnames';\n\nexport type TreeviewItemProps = React.LinkHTMLAttributes<HTMLAnchorElement>;\n\nconst TreeviewItem = React.forwardRef(function TreeviewItem(props: TreeviewItemProps, ref: React.Ref<HTMLAnchorElement>) {\n return <a {...props} ref={ref} />;\n});\n\nexport type TreeviewGroupProps = Omit<React.LinkHTMLAttributes<HTMLDivElement>, 'className' | 'onClick' | 'title'> & {\n /** Add a classname to the treeview */\n className?: string | ((expanded: boolean) => string);\n /**\n * Set wheter the region is expanded, showing the children, or collapsed.\n * Default value is `false`\n */\n expanded?: boolean;\n /** Region is expanded at mount and can't be collapsed */\n fixed?: boolean;\n /** Handler called when user clicks the title of the group */\n onClick?: (event: React.MouseEvent<HTMLDivElement>, expanded: boolean) => void;\n /** Text displayed in the group's header */\n title: React.ReactNode | ((expanded: boolean) => React.ReactNode);\n};\n\nconst TreeviewGroup = React.forwardRef(function TreeviewGroup(props: TreeviewGroupProps, ref: React.Ref<HTMLDivElement>) {\n const {\n children,\n className: externalClassName,\n expanded: initialExpanded = false,\n title,\n fixed,\n onClick,\n ...otherProps\n } = props;\n const [expanded, setExpanded] = React.useState(fixed || initialExpanded);\n\n React.useEffect(() => {\n if (!fixed) {\n setExpanded(fixed || initialExpanded);\n }\n }, [fixed, initialExpanded]);\n\n const listClassName = cn('flex-col mb-0', {\n flex: expanded,\n hidden: !expanded,\n });\n\n const itemProps = {\n ...otherProps,\n 'aria-expanded': expanded,\n role: 'treeitem',\n tabIndex: -1,\n };\n\n const handleClick = (event: React.MouseEvent<HTMLDivElement>): void => {\n const nextState = !expanded;\n\n if (!fixed) {\n setExpanded(nextState);\n }\n\n if (onClick) {\n onClick(event, nextState);\n }\n };\n\n const className = typeof externalClassName === 'function' ? externalClassName(expanded) : externalClassName;\n\n return (\n <div {...itemProps} className={className} ref={ref}>\n <div onClick={handleClick}>{typeof title === 'function' ? title(expanded) : title}</div>\n <ul role=\"group\" className={listClassName}>\n {React.Children.toArray(children)\n .filter(item => !!item)\n .map((item, i) => (\n <li key={i} role=\"none\">\n {React.cloneElement(item as React.ReactElement<any>, { role: 'treeitem' })}\n </li>\n ))}\n </ul>\n </div>\n );\n});\n\nexport type TreeviewProps = React.HTMLAttributes<HTMLDivElement>;\n\nexport type ForwardedTreeviewWithStatics = React.ForwardRefExoticComponent<\n TreeviewProps & React.RefAttributes<HTMLDivElement>\n> & {\n /** Navigable link */\n Item: React.ForwardRefExoticComponent<TreeviewItemProps & React.RefAttributes<HTMLAnchorElement>>;\n /** Container for a set of related links, usually expandable */\n Group: React.ForwardRefExoticComponent<TreeviewGroupProps & React.RefAttributes<HTMLDivElement>>;\n};\n\nexport const Treeview = React.forwardRef(function Treeview(props: TreeviewProps, ref: React.Ref<HTMLDivElement>) {\n return <div {...props} ref={ref} role=\"tree\" />;\n}) as ForwardedTreeviewWithStatics;\n\nTreeview.Group = TreeviewGroup;\nTreeview.Item = TreeviewItem;\n"],"names":["TreeviewItem","React","forwardRef","props","ref","TreeviewGroup","children","className","externalClassName","expanded","initialExpanded","title","fixed","onClick","otherProps","setExpanded","useState","useEffect","listClassName","cn","flex","hidden","itemProps","role","tabIndex","handleClick","event","nextState","Children","toArray","filter","item","map","i","key","cloneElement","Treeview","Group","Item"],"mappings":";;;AAKA,MAAMA,YAAY,gBAAGC,cAAK,CAACC,UAAU,CAAC,SAASF,YAAYA,CAACG,KAAwB,EAAEC,GAAiC;EACnH,oBAAOH,oDAAOE,KAAK;IAAEC,GAAG,EAAEA;KAAO;AACrC,CAAC,CAAC;AAkBF,MAAMC,aAAa,gBAAGJ,cAAK,CAACC,UAAU,CAAC,SAASG,aAAaA,CAACF,KAAyB,EAAEC,GAA8B;EACnH,MAAM;IACFE,QAAQ;IACRC,SAAS,EAAEC,iBAAiB;IAC5BC,QAAQ,EAAEC,eAAe,GAAG,KAAK;IACjCC,KAAK;IACLC,KAAK;IACLC,OAAO;IACP,GAAGC;GACN,GAAGX,KAAK;EACT,MAAM,CAACM,QAAQ,EAAEM,WAAW,CAAC,GAAGd,cAAK,CAACe,QAAQ,CAACJ,KAAK,IAAIF,eAAe,CAAC;EAExET,cAAK,CAACgB,SAAS,CAAC;IACZ,IAAI,CAACL,KAAK,EAAE;MACRG,WAAW,CAACH,KAAK,IAAIF,eAAe,CAAC;;GAE5C,EAAE,CAACE,KAAK,EAAEF,eAAe,CAAC,CAAC;EAE5B,MAAMQ,aAAa,GAAGC,EAAE,CAAC,eAAe,EAAE;IACtCC,IAAI,EAAEX,QAAQ;IACdY,MAAM,EAAE,CAACZ;GACZ,CAAC;EAEF,MAAMa,SAAS,GAAG;IACd,GAAGR,UAAU;IACb,eAAe,EAAEL,QAAQ;IACzBc,IAAI,EAAE,UAAU;IAChBC,QAAQ,EAAE,CAAC;GACd;EAED,MAAMC,WAAW,GAAIC,KAAuC;IACxD,MAAMC,SAAS,GAAG,CAAClB,QAAQ;IAE3B,IAAI,CAACG,KAAK,EAAE;MACRG,WAAW,CAACY,SAAS,CAAC;;IAG1B,IAAId,OAAO,EAAE;MACTA,OAAO,CAACa,KAAK,EAAEC,SAAS,CAAC;;GAEhC;EAED,MAAMpB,SAAS,GAAG,OAAOC,iBAAiB,KAAK,UAAU,GAAGA,iBAAiB,CAACC,QAAQ,CAAC,GAAGD,iBAAiB;EAE3G,oBACIP,sDAASqB,SAAS;IAAEf,SAAS,EAAEA,SAAS;IAAEH,GAAG,EAAEA;mBAC3CH;IAAKY,OAAO,EAAEY;KAAc,OAAOd,KAAK,KAAK,UAAU,GAAGA,KAAK,CAACF,QAAQ,CAAC,GAAGE,KAAK,CAAO,eACxFV;IAAIsB,IAAI,EAAC,OAAO;IAAChB,SAAS,EAAEW;KACvBjB,cAAK,CAAC2B,QAAQ,CAACC,OAAO,CAACvB,QAAQ,CAAC,CAC5BwB,MAAM,CAACC,IAAI,IAAI,CAAC,CAACA,IAAI,CAAC,CACtBC,GAAG,CAAC,CAACD,IAAI,EAAEE,CAAC,oBACThC;IAAIiC,GAAG,EAAED,CAAC;IAAEV,IAAI,EAAC;kBACZtB,cAAK,CAACkC,YAAY,CAACJ,IAA+B,EAAE;IAAER,IAAI,EAAE;GAAY,CAAC,CACzE,CACR,CAAC,CACL,CACH;AAEd,CAAC,CAAC;MAaWa,QAAQ,gBAAGnC,cAAK,CAACC,UAAU,CAAC,SAASkC,QAAQA,CAACjC,KAAoB,EAAEC,GAA8B;EAC3G,oBAAOH,sDAASE,KAAK;IAAEC,GAAG,EAAEA,GAAG;IAAEmB,IAAI,EAAC;KAAS;AACnD,CAAC;AAEDa,QAAQ,CAACC,KAAK,GAAGhC,aAAa;AAC9B+B,QAAQ,CAACE,IAAI,GAAGtC,YAAY;;;;"}
|
@@ -66,8 +66,9 @@ export { useLazyEffect } from './hooks/useLazyEffect.js';
|
|
66
66
|
export { Textarea } from './components/Textarea/Textarea.js';
|
67
67
|
export { useMatchMedia } from './hooks/useMatchMedia.js';
|
68
68
|
export { useIsLargeScreen } from './hooks/useIsLargeScreen.js';
|
69
|
+
export { fixedForwardRef } from './types.js';
|
69
70
|
export { useTable3DataLoader } from './components/Table3/hooks/useTableDataLoader.js';
|
70
|
-
export { Table3
|
71
|
+
export { Table3 } from './components/Table3/Table3.js';
|
71
72
|
export { Tabs } from './components/Tabs/Tabs.js';
|
72
73
|
export { Tour, TourStep } from './components/Tour/Tour.js';
|
73
74
|
export { Header } from './components/Header/Header.js';
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
1
|
+
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
@@ -0,0 +1,10 @@
|
|
1
|
+
// settings
|
2
|
+
var TableFontSizes;
|
3
|
+
(function (TableFontSizes) {
|
4
|
+
TableFontSizes["small"] = "small";
|
5
|
+
TableFontSizes["medium"] = "medium";
|
6
|
+
TableFontSizes["large"] = "large";
|
7
|
+
})(TableFontSizes || (TableFontSizes = {}));
|
8
|
+
|
9
|
+
export { TableFontSizes };
|
10
|
+
//# sourceMappingURL=types.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"types.js","sources":["../../../../../../../src/primitives/Table/types.ts"],"sourcesContent":["import { ColumnFilter as ReactTableColumnFilter, ColumnSort as ReactTableColumnSort } from '@tanstack/react-table';\n\nexport type TableRef = HTMLDivElement & {\n instance: {\n resetFiltering: () => void;\n resetRowExpansion: () => void;\n resetRowSelection: () => void;\n resetSorting: () => void;\n };\n};\n\n// settings\nexport enum TableFontSizes {\n small = 'small',\n medium = 'medium',\n large = 'large',\n}\nexport type TableFontSize = keyof typeof TableFontSizes;\n\n// columns\nexport type TableColumnFilter = ReactTableColumnFilter;\nexport type TableColumnSort = ReactTableColumnSort;\n\n// rows\nexport type TableRowClickHandler<TType = unknown> = (row: TType) => void;\nexport type TableRowGotoHandler = (\n column: string,\n query: string,\n sorting: TableColumnSort[],\n filters: TableColumnFilter[],\n search: string | undefined\n) => Promise<number>;\nexport type TableRowHeight = 'short' | 'medium' | 'tall' | 'extra-tall';\nexport type TableRowSelectHandler<TType = unknown> = (rows: TType[]) => void;\n\n// shortcuts\nexport type TableShortcutHandlerFn<TType = unknown> = (row: TType) => void;\nexport type TableShortcutHandlerObject<TType = unknown> = {\n handler: TableShortcutHandlerFn<TType>;\n meta?: boolean;\n shift?: boolean;\n};\n\n// table\nexport type TableFilterHandler = (filters: TableColumnFilter[]) => void;\nexport type TableScrollToIndexHandler = (index: number, options?: { align: 'start' | 'center' | 'end' | 'auto' }) => void;\nexport type TableServerLoadPageHandler = (\n pageIndex: number,\n sorting: TableColumnSort[],\n filters: TableColumnFilter[],\n search: string | undefined\n) => Promise<void>;\nexport type TableServerLoadAllHandler = (\n sorting: TableColumnSort[],\n filters: TableColumnFilter[],\n search: string | undefined\n) => Promise<void>;\nexport type TableShortcuts<TType = unknown> = Record<string, TableShortcutHandlerFn<TType> | TableShortcutHandlerObject<TType>>;\nexport type TableSortHandler = (sorting: TableColumnSort[]) => void;\n"],"names":["TableFontSizes"],"mappings":"AAWA;IACYA;AAAZ,WAAYA,cAAc;EACtBA,iCAAe;EACfA,mCAAiB;EACjBA,iCAAe;AACnB,CAAC,EAJWA,cAAc,KAAdA,cAAc;;;;"}
|
package/dist/esm/packages/taco/src/primitives/Table/useTable/features/useTableColumnOrdering.js.map
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"useTableColumnOrdering.js","sources":["../../../../../../../../../src/primitives/Table/useTable/features/useTableColumnOrdering.ts"],"sourcesContent":["export function useTableColumnOrdering(isEnabled = true) {\n return {\n isEnabled,\n };\n}\n"],"names":["useTableColumnOrdering","isEnabled"],"mappings":"SAAgBA,sBAAsBA,CAACC,SAAS,GAAG,IAAI;EACnD,OAAO;IACHA;GACH;AACL;;;;"}
|
@@ -1,6 +1,6 @@
|
|
1
1
|
import React__default from 'react';
|
2
2
|
|
3
|
-
function
|
3
|
+
function useTableFontSize(isEnabled = false, defaultFontSize = 'medium') {
|
4
4
|
const [size, setSize] = React__default.useState(defaultFontSize);
|
5
5
|
return {
|
6
6
|
isEnabled,
|
@@ -9,5 +9,5 @@ function useFontSize(isEnabled, defaultFontSize = 'medium') {
|
|
9
9
|
};
|
10
10
|
}
|
11
11
|
|
12
|
-
export {
|
13
|
-
//# sourceMappingURL=
|
12
|
+
export { useTableFontSize };
|
13
|
+
//# sourceMappingURL=useTableFontSize.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"useTableFontSize.js","sources":["../../../../../../../../../src/primitives/Table/useTable/features/useTableFontSize.ts"],"sourcesContent":["import React from 'react';\nimport { TableFontSize } from '../../types';\n\nexport function useTableFontSize(isEnabled = false, defaultFontSize: TableFontSize = 'medium') {\n const [size, setSize] = React.useState<TableFontSize>(defaultFontSize);\n\n return {\n isEnabled,\n size,\n setSize: isEnabled ? setSize : () => undefined,\n };\n}\n"],"names":["useTableFontSize","isEnabled","defaultFontSize","size","setSize","React","useState","undefined"],"mappings":";;SAGgBA,gBAAgBA,CAACC,SAAS,GAAG,KAAK,EAAEC,kBAAiC,QAAQ;EACzF,MAAM,CAACC,IAAI,EAAEC,OAAO,CAAC,GAAGC,cAAK,CAACC,QAAQ,CAAgBJ,eAAe,CAAC;EAEtE,OAAO;IACHD,SAAS;IACTE,IAAI;IACJC,OAAO,EAAEH,SAAS,GAAGG,OAAO,GAAG,MAAMG;GACxC;AACL;;;;"}
|
@@ -0,0 +1,14 @@
|
|
1
|
+
import React__default from 'react';
|
2
|
+
|
3
|
+
function useTablePrinting(isEnabled = false, defaultIsWarningVisible = true, id) {
|
4
|
+
const [isWarningVisibleForLargeDatasets, setIsWarningVisibleForLargeDatasets] = React__default.useState(defaultIsWarningVisible);
|
5
|
+
return {
|
6
|
+
isEnabled,
|
7
|
+
isPrinting: id.endsWith('_print'),
|
8
|
+
isWarningVisibleForLargeDatasets,
|
9
|
+
setIsWarningVisibleForLargeDatasets: isEnabled ? setIsWarningVisibleForLargeDatasets : () => undefined
|
10
|
+
};
|
11
|
+
}
|
12
|
+
|
13
|
+
export { useTablePrinting };
|
14
|
+
//# sourceMappingURL=useTablePrinting.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"useTablePrinting.js","sources":["../../../../../../../../../src/primitives/Table/useTable/features/useTablePrinting.ts"],"sourcesContent":["import React from 'react';\n\nexport function useTablePrinting(isEnabled = false, defaultIsWarningVisible = true, id: string) {\n const [isWarningVisibleForLargeDatasets, setIsWarningVisibleForLargeDatasets] = React.useState(defaultIsWarningVisible);\n\n return {\n isEnabled,\n isPrinting: id.endsWith('_print'), // this is a very naive implementation\n isWarningVisibleForLargeDatasets,\n setIsWarningVisibleForLargeDatasets: isEnabled ? setIsWarningVisibleForLargeDatasets : () => undefined,\n };\n}\n"],"names":["useTablePrinting","isEnabled","defaultIsWarningVisible","id","isWarningVisibleForLargeDatasets","setIsWarningVisibleForLargeDatasets","React","useState","isPrinting","endsWith","undefined"],"mappings":";;SAEgBA,gBAAgBA,CAACC,SAAS,GAAG,KAAK,EAAEC,uBAAuB,GAAG,IAAI,EAAEC,EAAU;EAC1F,MAAM,CAACC,gCAAgC,EAAEC,mCAAmC,CAAC,GAAGC,cAAK,CAACC,QAAQ,CAACL,uBAAuB,CAAC;EAEvH,OAAO;IACHD,SAAS;IACTO,UAAU,EAAEL,EAAE,CAACM,QAAQ,CAAC,QAAQ,CAAC;IACjCL,gCAAgC;IAChCC,mCAAmC,EAAEJ,SAAS,GAAGI,mCAAmC,GAAG,MAAMK;GAChG;AACL;;;;"}
|
@@ -0,0 +1,100 @@
|
|
1
|
+
import React__default from 'react';
|
2
|
+
import { useIsHoverStatePaused } from '../../../../hooks/useIsHoverStatePaused.js';
|
3
|
+
|
4
|
+
function focusFirstElementInActiveRow(tableRef) {
|
5
|
+
const selector = '[data-taco="table2-body"] [role="row"] [role="cell"]:first-child';
|
6
|
+
setTimeout(() => {
|
7
|
+
var _tableRef$current, _tableRef$current$que;
|
8
|
+
(_tableRef$current = tableRef.current) === null || _tableRef$current === void 0 ? void 0 : (_tableRef$current$que = _tableRef$current.querySelector(selector)) === null || _tableRef$current$que === void 0 ? void 0 : _tableRef$current$que.focus();
|
9
|
+
}, 1);
|
10
|
+
}
|
11
|
+
function useTableRowActive(isEnabled = false, initialRowActiveIndex) {
|
12
|
+
const [rowActiveIndex, setRowActiveIndex] = React__default.useState(initialRowActiveIndex);
|
13
|
+
const [isHoverStatePaused, setHoverStatePaused] = useIsHoverStatePaused();
|
14
|
+
const move = (direction, length, scrollToIndex) => setRowActiveIndex(currentIndex => {
|
15
|
+
const nextIndex = currentIndex !== undefined ? getNextIndex(direction, currentIndex, length) : 0;
|
16
|
+
scrollToIndex(direction === -1 ? nextIndex : nextIndex + 3);
|
17
|
+
return nextIndex;
|
18
|
+
});
|
19
|
+
const onKeyDown = React__default.useCallback((event, length, scrollToIndex, tableRef) => {
|
20
|
+
if (!isEnabled || event.defaultPrevented) {
|
21
|
+
return;
|
22
|
+
}
|
23
|
+
if (event.key === 'ArrowUp' || event.key === 'ArrowDown') {
|
24
|
+
setHoverStatePaused(true);
|
25
|
+
}
|
26
|
+
if (event.key === 'ArrowUp') {
|
27
|
+
event.preventDefault();
|
28
|
+
if (event.ctrlKey || event.metaKey) {
|
29
|
+
const newIndex = 0;
|
30
|
+
setRowActiveIndex(newIndex);
|
31
|
+
scrollToIndex(newIndex);
|
32
|
+
} else {
|
33
|
+
move(-1, length, scrollToIndex);
|
34
|
+
}
|
35
|
+
if (tableRef) {
|
36
|
+
focusFirstElementInActiveRow(tableRef);
|
37
|
+
}
|
38
|
+
return;
|
39
|
+
} else if (event.key === 'ArrowDown') {
|
40
|
+
event.preventDefault();
|
41
|
+
if (event.ctrlKey || event.metaKey) {
|
42
|
+
const newIndex = length - 1;
|
43
|
+
setRowActiveIndex(newIndex);
|
44
|
+
scrollToIndex(newIndex);
|
45
|
+
} else {
|
46
|
+
move(+1, length, scrollToIndex);
|
47
|
+
}
|
48
|
+
if (tableRef) {
|
49
|
+
focusFirstElementInActiveRow(tableRef);
|
50
|
+
}
|
51
|
+
return;
|
52
|
+
}
|
53
|
+
}, [isEnabled]);
|
54
|
+
const onFocus = React__default.useCallback((event, length, scrollToIndex) => {
|
55
|
+
if (!isEnabled || event.isDefaultPrevented()) {
|
56
|
+
return;
|
57
|
+
}
|
58
|
+
if (rowActiveIndex === undefined && length > 0) {
|
59
|
+
// do it in the next tick, otherwise it prevents internal focus from working
|
60
|
+
// meaning you have to tab twice to get to the first focusable element
|
61
|
+
setTimeout(() => {
|
62
|
+
setRowActiveIndex(index => {
|
63
|
+
if (index === undefined) {
|
64
|
+
scrollToIndex(0);
|
65
|
+
return 0;
|
66
|
+
}
|
67
|
+
return index;
|
68
|
+
});
|
69
|
+
}, 1);
|
70
|
+
}
|
71
|
+
}, [rowActiveIndex, length, isEnabled]);
|
72
|
+
const onMouseCapture = React__default.useCallback((event, length) => {
|
73
|
+
if (!isEnabled || event.isDefaultPrevented()) {
|
74
|
+
return;
|
75
|
+
}
|
76
|
+
if (rowActiveIndex === undefined && length > 0) {
|
77
|
+
event.preventDefault();
|
78
|
+
event.stopPropagation();
|
79
|
+
}
|
80
|
+
}, [rowActiveIndex, length, isEnabled]);
|
81
|
+
return {
|
82
|
+
isEnabled,
|
83
|
+
rowActiveIndex,
|
84
|
+
setRowActiveIndex: isEnabled ? setRowActiveIndex : () => undefined,
|
85
|
+
isHoverStatePaused,
|
86
|
+
setHoverStatePaused: isEnabled ? setHoverStatePaused : () => undefined,
|
87
|
+
handleFocus: isEnabled ? onFocus : () => undefined,
|
88
|
+
handleKeyDown: isEnabled ? onKeyDown : () => undefined,
|
89
|
+
handleMouseCapture: isEnabled ? onMouseCapture : () => undefined
|
90
|
+
};
|
91
|
+
}
|
92
|
+
function getNextIndex(direction, currentIndex, length) {
|
93
|
+
if (direction === -1) {
|
94
|
+
return currentIndex - 1 > 0 ? currentIndex - 1 : 0;
|
95
|
+
}
|
96
|
+
return currentIndex + 1 < length ? currentIndex + 1 : currentIndex;
|
97
|
+
}
|
98
|
+
|
99
|
+
export { useTableRowActive };
|
100
|
+
//# sourceMappingURL=useTableRowActive.js.map
|
package/dist/esm/packages/taco/src/primitives/Table/useTable/features/useTableRowActive.js.map
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"useTableRowActive.js","sources":["../../../../../../../../../src/primitives/Table/useTable/features/useTableRowActive.ts"],"sourcesContent":["import React from 'react';\nimport { TableRef, TableScrollToIndexHandler } from '../../types';\nimport { useIsHoverStatePaused } from '../../../../hooks/useIsHoverStatePaused';\n\nfunction focusFirstElementInActiveRow(tableRef: React.RefObject<TableRef>) {\n const selector = '[data-taco=\"table2-body\"] [role=\"row\"] [role=\"cell\"]:first-child';\n\n setTimeout(() => {\n (tableRef.current?.querySelector(selector) as HTMLElement)?.focus();\n }, 1);\n}\n\nexport function useTableRowActive(isEnabled = false, initialRowActiveIndex?: number) {\n const [rowActiveIndex, setRowActiveIndex] = React.useState<number | undefined>(initialRowActiveIndex);\n const [isHoverStatePaused, setHoverStatePaused] = useIsHoverStatePaused();\n\n const move = (direction: -1 | 1, length: number, scrollToIndex: TableScrollToIndexHandler) =>\n setRowActiveIndex(currentIndex => {\n const nextIndex = currentIndex !== undefined ? getNextIndex(direction, currentIndex, length) : 0;\n scrollToIndex(direction === -1 ? nextIndex : nextIndex + 3);\n return nextIndex;\n });\n\n const onKeyDown = React.useCallback(\n (\n event: KeyboardEvent,\n length: number,\n scrollToIndex: TableScrollToIndexHandler,\n tableRef?: React.RefObject<TableRef>\n ) => {\n if (!isEnabled || event.defaultPrevented) {\n return;\n }\n\n if (event.key === 'ArrowUp' || event.key === 'ArrowDown') {\n setHoverStatePaused(true);\n }\n\n if (event.key === 'ArrowUp') {\n event.preventDefault();\n\n if (event.ctrlKey || event.metaKey) {\n const newIndex = 0;\n setRowActiveIndex(newIndex);\n scrollToIndex(newIndex);\n } else {\n move(-1, length, scrollToIndex);\n }\n\n if (tableRef) {\n focusFirstElementInActiveRow(tableRef);\n }\n\n return;\n } else if (event.key === 'ArrowDown') {\n event.preventDefault();\n\n if (event.ctrlKey || event.metaKey) {\n const newIndex = length - 1;\n setRowActiveIndex(newIndex);\n scrollToIndex(newIndex);\n } else {\n move(+1, length, scrollToIndex);\n }\n\n if (tableRef) {\n focusFirstElementInActiveRow(tableRef);\n }\n\n return;\n }\n },\n [isEnabled]\n );\n\n const onFocus = React.useCallback(\n (event: React.FocusEvent, length: number, scrollToIndex: TableScrollToIndexHandler) => {\n if (!isEnabled || event.isDefaultPrevented()) {\n return;\n }\n\n if (rowActiveIndex === undefined && length > 0) {\n // do it in the next tick, otherwise it prevents internal focus from working\n // meaning you have to tab twice to get to the first focusable element\n setTimeout(() => {\n setRowActiveIndex(index => {\n if (index === undefined) {\n scrollToIndex(0);\n return 0;\n }\n return index;\n });\n }, 1);\n }\n },\n [rowActiveIndex, length, isEnabled]\n );\n\n const onMouseCapture = React.useCallback(\n (event: React.MouseEvent, length: number) => {\n if (!isEnabled || event.isDefaultPrevented()) {\n return;\n }\n\n if (rowActiveIndex === undefined && length > 0) {\n event.preventDefault();\n event.stopPropagation();\n }\n },\n [rowActiveIndex, length, isEnabled]\n );\n\n return {\n isEnabled,\n rowActiveIndex,\n setRowActiveIndex: isEnabled ? setRowActiveIndex : () => undefined,\n isHoverStatePaused,\n setHoverStatePaused: isEnabled ? setHoverStatePaused : () => undefined,\n handleFocus: isEnabled ? onFocus : () => undefined,\n handleKeyDown: isEnabled ? onKeyDown : () => undefined,\n handleMouseCapture: isEnabled ? onMouseCapture : () => undefined,\n };\n}\n\nfunction getNextIndex(direction: -1 | 1, currentIndex: number, length: number) {\n if (direction === -1) {\n return currentIndex - 1 > 0 ? currentIndex - 1 : 0;\n }\n\n return currentIndex + 1 < length ? currentIndex + 1 : currentIndex;\n}\n"],"names":["focusFirstElementInActiveRow","tableRef","selector","setTimeout","_tableRef$current","current","_tableRef$current$que","querySelector","focus","useTableRowActive","isEnabled","initialRowActiveIndex","rowActiveIndex","setRowActiveIndex","React","useState","isHoverStatePaused","setHoverStatePaused","useIsHoverStatePaused","move","direction","length","scrollToIndex","currentIndex","nextIndex","undefined","getNextIndex","onKeyDown","useCallback","event","defaultPrevented","key","preventDefault","ctrlKey","metaKey","newIndex","onFocus","isDefaultPrevented","index","onMouseCapture","stopPropagation","handleFocus","handleKeyDown","handleMouseCapture"],"mappings":";;;AAIA,SAASA,4BAA4BA,CAACC,QAAmC;EACrE,MAAMC,QAAQ,GAAG,kEAAkE;EAEnFC,UAAU,CAAC;;IACN,CAAAC,iBAAA,GAAAH,QAAQ,CAACI,OAAO,cAAAD,iBAAA,wBAAAE,qBAAA,GAAhBF,iBAAA,CAAkBG,aAAa,CAACL,QAAQ,CAAiB,cAAAI,qBAAA,uBAAzDA,qBAAA,CAA2DE,KAAK,EAAE;GACtE,EAAE,CAAC,CAAC;AACT;SAEgBC,iBAAiBA,CAACC,SAAS,GAAG,KAAK,EAAEC,qBAA8B;EAC/E,MAAM,CAACC,cAAc,EAAEC,iBAAiB,CAAC,GAAGC,cAAK,CAACC,QAAQ,CAAqBJ,qBAAqB,CAAC;EACrG,MAAM,CAACK,kBAAkB,EAAEC,mBAAmB,CAAC,GAAGC,qBAAqB,EAAE;EAEzE,MAAMC,IAAI,GAAGA,CAACC,SAAiB,EAAEC,MAAc,EAAEC,aAAwC,KACrFT,iBAAiB,CAACU,YAAY;IAC1B,MAAMC,SAAS,GAAGD,YAAY,KAAKE,SAAS,GAAGC,YAAY,CAACN,SAAS,EAAEG,YAAY,EAAEF,MAAM,CAAC,GAAG,CAAC;IAChGC,aAAa,CAACF,SAAS,KAAK,CAAC,CAAC,GAAGI,SAAS,GAAGA,SAAS,GAAG,CAAC,CAAC;IAC3D,OAAOA,SAAS;GACnB,CAAC;EAEN,MAAMG,SAAS,GAAGb,cAAK,CAACc,WAAW,CAC/B,CACIC,KAAoB,EACpBR,MAAc,EACdC,aAAwC,EACxCrB,QAAoC;IAEpC,IAAI,CAACS,SAAS,IAAImB,KAAK,CAACC,gBAAgB,EAAE;MACtC;;IAGJ,IAAID,KAAK,CAACE,GAAG,KAAK,SAAS,IAAIF,KAAK,CAACE,GAAG,KAAK,WAAW,EAAE;MACtDd,mBAAmB,CAAC,IAAI,CAAC;;IAG7B,IAAIY,KAAK,CAACE,GAAG,KAAK,SAAS,EAAE;MACzBF,KAAK,CAACG,cAAc,EAAE;MAEtB,IAAIH,KAAK,CAACI,OAAO,IAAIJ,KAAK,CAACK,OAAO,EAAE;QAChC,MAAMC,QAAQ,GAAG,CAAC;QAClBtB,iBAAiB,CAACsB,QAAQ,CAAC;QAC3Bb,aAAa,CAACa,QAAQ,CAAC;OAC1B,MAAM;QACHhB,IAAI,CAAC,CAAC,CAAC,EAAEE,MAAM,EAAEC,aAAa,CAAC;;MAGnC,IAAIrB,QAAQ,EAAE;QACVD,4BAA4B,CAACC,QAAQ,CAAC;;MAG1C;KACH,MAAM,IAAI4B,KAAK,CAACE,GAAG,KAAK,WAAW,EAAE;MAClCF,KAAK,CAACG,cAAc,EAAE;MAEtB,IAAIH,KAAK,CAACI,OAAO,IAAIJ,KAAK,CAACK,OAAO,EAAE;QAChC,MAAMC,QAAQ,GAAGd,MAAM,GAAG,CAAC;QAC3BR,iBAAiB,CAACsB,QAAQ,CAAC;QAC3Bb,aAAa,CAACa,QAAQ,CAAC;OAC1B,MAAM;QACHhB,IAAI,CAAC,CAAC,CAAC,EAAEE,MAAM,EAAEC,aAAa,CAAC;;MAGnC,IAAIrB,QAAQ,EAAE;QACVD,4BAA4B,CAACC,QAAQ,CAAC;;MAG1C;;GAEP,EACD,CAACS,SAAS,CAAC,CACd;EAED,MAAM0B,OAAO,GAAGtB,cAAK,CAACc,WAAW,CAC7B,CAACC,KAAuB,EAAER,MAAc,EAAEC,aAAwC;IAC9E,IAAI,CAACZ,SAAS,IAAImB,KAAK,CAACQ,kBAAkB,EAAE,EAAE;MAC1C;;IAGJ,IAAIzB,cAAc,KAAKa,SAAS,IAAIJ,MAAM,GAAG,CAAC,EAAE;;;MAG5ClB,UAAU,CAAC;QACPU,iBAAiB,CAACyB,KAAK;UACnB,IAAIA,KAAK,KAAKb,SAAS,EAAE;YACrBH,aAAa,CAAC,CAAC,CAAC;YAChB,OAAO,CAAC;;UAEZ,OAAOgB,KAAK;SACf,CAAC;OACL,EAAE,CAAC,CAAC;;GAEZ,EACD,CAAC1B,cAAc,EAAES,MAAM,EAAEX,SAAS,CAAC,CACtC;EAED,MAAM6B,cAAc,GAAGzB,cAAK,CAACc,WAAW,CACpC,CAACC,KAAuB,EAAER,MAAc;IACpC,IAAI,CAACX,SAAS,IAAImB,KAAK,CAACQ,kBAAkB,EAAE,EAAE;MAC1C;;IAGJ,IAAIzB,cAAc,KAAKa,SAAS,IAAIJ,MAAM,GAAG,CAAC,EAAE;MAC5CQ,KAAK,CAACG,cAAc,EAAE;MACtBH,KAAK,CAACW,eAAe,EAAE;;GAE9B,EACD,CAAC5B,cAAc,EAAES,MAAM,EAAEX,SAAS,CAAC,CACtC;EAED,OAAO;IACHA,SAAS;IACTE,cAAc;IACdC,iBAAiB,EAAEH,SAAS,GAAGG,iBAAiB,GAAG,MAAMY,SAAS;IAClET,kBAAkB;IAClBC,mBAAmB,EAAEP,SAAS,GAAGO,mBAAmB,GAAG,MAAMQ,SAAS;IACtEgB,WAAW,EAAE/B,SAAS,GAAG0B,OAAO,GAAG,MAAMX,SAAS;IAClDiB,aAAa,EAAEhC,SAAS,GAAGiB,SAAS,GAAG,MAAMF,SAAS;IACtDkB,kBAAkB,EAAEjC,SAAS,GAAG6B,cAAc,GAAG,MAAMd;GAC1D;AACL;AAEA,SAASC,YAAYA,CAACN,SAAiB,EAAEG,YAAoB,EAAEF,MAAc;EACzE,IAAID,SAAS,KAAK,CAAC,CAAC,EAAE;IAClB,OAAOG,YAAY,GAAG,CAAC,GAAG,CAAC,GAAGA,YAAY,GAAG,CAAC,GAAG,CAAC;;EAGtD,OAAOA,YAAY,GAAG,CAAC,GAAGF,MAAM,GAAGE,YAAY,GAAG,CAAC,GAAGA,YAAY;AACtE;;;;"}
|
@@ -0,0 +1,30 @@
|
|
1
|
+
import React__default from 'react';
|
2
|
+
|
3
|
+
function useTableRowClick(isEnabled = false, onRowClick) {
|
4
|
+
const handleKeyDown = React__default.useCallback(function (event, data) {
|
5
|
+
if (!isEnabled || typeof onRowClick !== 'function' || event.defaultPrevented) {
|
6
|
+
return;
|
7
|
+
}
|
8
|
+
if (data && event.key === 'Enter') {
|
9
|
+
event.preventDefault();
|
10
|
+
onRowClick(data);
|
11
|
+
return;
|
12
|
+
}
|
13
|
+
}, [isEnabled, onRowClick]);
|
14
|
+
const handleClick = React__default.useCallback(function (event, data) {
|
15
|
+
if (!isEnabled || typeof onRowClick !== 'function' || event.defaultPrevented) {
|
16
|
+
return;
|
17
|
+
}
|
18
|
+
event.preventDefault();
|
19
|
+
onRowClick(data);
|
20
|
+
return;
|
21
|
+
}, [isEnabled, onRowClick]);
|
22
|
+
return {
|
23
|
+
isEnabled,
|
24
|
+
handleClick,
|
25
|
+
handleKeyDown
|
26
|
+
};
|
27
|
+
}
|
28
|
+
|
29
|
+
export { useTableRowClick };
|
30
|
+
//# sourceMappingURL=useTableRowClick.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"useTableRowClick.js","sources":["../../../../../../../../../src/primitives/Table/useTable/features/useTableRowClick.ts"],"sourcesContent":["import React from 'react';\nimport { TableRowClickHandler } from '../../types';\n\nexport function useTableRowClick<TType = unknown>(isEnabled = false, onRowClick?: TableRowClickHandler<TType>) {\n const handleKeyDown = React.useCallback(\n function (event: KeyboardEvent, data: TType) {\n if (!isEnabled || typeof onRowClick !== 'function' || event.defaultPrevented) {\n return;\n }\n\n if (data && event.key === 'Enter') {\n event.preventDefault();\n onRowClick(data);\n return;\n }\n },\n [isEnabled, onRowClick]\n ) as <TType = unknown>(event: KeyboardEvent, data: TType) => void;\n\n const handleClick = React.useCallback(\n function (event: React.MouseEvent<HTMLDivElement>, data: TType) {\n if (!isEnabled || typeof onRowClick !== 'function' || event.defaultPrevented) {\n return;\n }\n\n event.preventDefault();\n onRowClick(data);\n return;\n },\n [isEnabled, onRowClick]\n );\n\n return {\n isEnabled,\n handleClick,\n handleKeyDown,\n };\n}\n"],"names":["useTableRowClick","isEnabled","onRowClick","handleKeyDown","React","useCallback","event","data","defaultPrevented","key","preventDefault","handleClick"],"mappings":";;SAGgBA,gBAAgBA,CAAkBC,SAAS,GAAG,KAAK,EAAEC,UAAwC;EACzG,MAAMC,aAAa,GAAGC,cAAK,CAACC,WAAW,CACnC,UAAUC,KAAoB,EAAEC,IAAW;IACvC,IAAI,CAACN,SAAS,IAAI,OAAOC,UAAU,KAAK,UAAU,IAAII,KAAK,CAACE,gBAAgB,EAAE;MAC1E;;IAGJ,IAAID,IAAI,IAAID,KAAK,CAACG,GAAG,KAAK,OAAO,EAAE;MAC/BH,KAAK,CAACI,cAAc,EAAE;MACtBR,UAAU,CAACK,IAAI,CAAC;MAChB;;GAEP,EACD,CAACN,SAAS,EAAEC,UAAU,CAAC,CACsC;EAEjE,MAAMS,WAAW,GAAGP,cAAK,CAACC,WAAW,CACjC,UAAUC,KAAuC,EAAEC,IAAW;IAC1D,IAAI,CAACN,SAAS,IAAI,OAAOC,UAAU,KAAK,UAAU,IAAII,KAAK,CAACE,gBAAgB,EAAE;MAC1E;;IAGJF,KAAK,CAACI,cAAc,EAAE;IACtBR,UAAU,CAACK,IAAI,CAAC;IAChB;GACH,EACD,CAACN,SAAS,EAAEC,UAAU,CAAC,CAC1B;EAED,OAAO;IACHD,SAAS;IACTU,WAAW;IACXR;GACH;AACL;;;;"}
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"useTableRowGoto.js","sources":["../../../../../../../../../src/primitives/Table/useTable/features/useTableRowGoto.ts"],"sourcesContent":["import { TableRowGotoHandler } from '../../types';\n\nexport function useTableRowGoto(isEnabled = false, handler?: TableRowGotoHandler) {\n return {\n isEnabled,\n handleGoto: isEnabled && handler ? handler : () => undefined,\n };\n}\n"],"names":["useTableRowGoto","isEnabled","handler","handleGoto","undefined"],"mappings":"SAEgBA,eAAeA,CAACC,SAAS,GAAG,KAAK,EAAEC,OAA6B;EAC5E,OAAO;IACHD,SAAS;IACTE,UAAU,EAAEF,SAAS,IAAIC,OAAO,GAAGA,OAAO,GAAG,MAAME;GACtD;AACL;;;;"}
|
@@ -0,0 +1,13 @@
|
|
1
|
+
import React__default from 'react';
|
2
|
+
|
3
|
+
function useTableRowHeight(isEnabled = false, defaultRowHeight = 'medium') {
|
4
|
+
const [height, setHeight] = React__default.useState(defaultRowHeight);
|
5
|
+
return {
|
6
|
+
isEnabled,
|
7
|
+
height,
|
8
|
+
setHeight: isEnabled ? setHeight : () => undefined
|
9
|
+
};
|
10
|
+
}
|
11
|
+
|
12
|
+
export { useTableRowHeight };
|
13
|
+
//# sourceMappingURL=useTableRowHeight.js.map
|
package/dist/esm/packages/taco/src/primitives/Table/useTable/features/useTableRowHeight.js.map
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"useTableRowHeight.js","sources":["../../../../../../../../../src/primitives/Table/useTable/features/useTableRowHeight.ts"],"sourcesContent":["import React from 'react';\nimport { TableRowHeight } from '../../types';\n\nexport function useTableRowHeight(isEnabled = false, defaultRowHeight: TableRowHeight = 'medium') {\n const [height, setHeight] = React.useState<TableRowHeight>(defaultRowHeight);\n\n return {\n isEnabled,\n height,\n setHeight: isEnabled ? setHeight : () => undefined,\n };\n}\n"],"names":["useTableRowHeight","isEnabled","defaultRowHeight","height","setHeight","React","useState","undefined"],"mappings":";;SAGgBA,iBAAiBA,CAACC,SAAS,GAAG,KAAK,EAAEC,mBAAmC,QAAQ;EAC5F,MAAM,CAACC,MAAM,EAAEC,SAAS,CAAC,GAAGC,cAAK,CAACC,QAAQ,CAAiBJ,gBAAgB,CAAC;EAE5E,OAAO;IACHD,SAAS;IACTE,MAAM;IACNC,SAAS,EAAEH,SAAS,GAAGG,SAAS,GAAG,MAAMG;GAC5C;AACL;;;;"}
|
@@ -0,0 +1,32 @@
|
|
1
|
+
import React__default from 'react';
|
2
|
+
|
3
|
+
function useTableRowSelection(isEnabled = false) {
|
4
|
+
const lastSelectedRowIndex = React__default.useRef();
|
5
|
+
const onKeyDown = React__default.useCallback((event, table) => {
|
6
|
+
if (!isEnabled || !table.options.enableRowSelection || event.defaultPrevented) {
|
7
|
+
return;
|
8
|
+
}
|
9
|
+
const rows = table.getRowModel().rows;
|
10
|
+
const tableMeta = table.options.meta;
|
11
|
+
if (event.key === ' ') {
|
12
|
+
event.preventDefault();
|
13
|
+
const rowActiveIndex = tableMeta.rowActive.rowActiveIndex;
|
14
|
+
if (rowActiveIndex !== undefined) {
|
15
|
+
var _rows$rowActiveIndex;
|
16
|
+
(_rows$rowActiveIndex = rows[rowActiveIndex]) === null || _rows$rowActiveIndex === void 0 ? void 0 : _rows$rowActiveIndex.toggleSelected();
|
17
|
+
}
|
18
|
+
return;
|
19
|
+
} else if ((event.ctrlKey || event.metaKey) && event.key === 'a') {
|
20
|
+
event.preventDefault();
|
21
|
+
table.toggleAllRowsSelected();
|
22
|
+
return;
|
23
|
+
}
|
24
|
+
}, [isEnabled]);
|
25
|
+
return {
|
26
|
+
handleKeyDown: isEnabled ? onKeyDown : () => undefined,
|
27
|
+
lastSelectedRowIndex
|
28
|
+
};
|
29
|
+
}
|
30
|
+
|
31
|
+
export { useTableRowSelection };
|
32
|
+
//# sourceMappingURL=useTableRowSelection.js.map
|
package/dist/esm/packages/taco/src/primitives/Table/useTable/features/useTableRowSelection.js.map
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"useTableRowSelection.js","sources":["../../../../../../../../../src/primitives/Table/useTable/features/useTableRowSelection.ts"],"sourcesContent":["import React from 'react';\nimport { Table as ReactTable, TableMeta as ReactTableMeta } from '@tanstack/react-table';\n\nexport function useTableRowSelection(isEnabled = false) {\n const lastSelectedRowIndex = React.useRef<number>();\n\n const onKeyDown = React.useCallback(\n <TType = unknown>(event: KeyboardEvent, table: ReactTable<TType>) => {\n if (!isEnabled || !table.options.enableRowSelection || event.defaultPrevented) {\n return;\n }\n\n const rows = table.getRowModel().rows;\n const tableMeta = table.options.meta as ReactTableMeta<TType>;\n\n if (event.key === ' ') {\n event.preventDefault();\n const rowActiveIndex = tableMeta.rowActive.rowActiveIndex;\n\n if (rowActiveIndex !== undefined) {\n rows[rowActiveIndex]?.toggleSelected();\n }\n\n return;\n } else if ((event.ctrlKey || event.metaKey) && event.key === 'a') {\n event.preventDefault();\n table.toggleAllRowsSelected();\n return;\n }\n },\n [isEnabled]\n ) as <TType = unknown>(event: KeyboardEvent, table: ReactTable<TType>) => void;\n\n return {\n handleKeyDown: isEnabled ? onKeyDown : () => undefined,\n lastSelectedRowIndex,\n };\n}\n"],"names":["useTableRowSelection","isEnabled","lastSelectedRowIndex","React","useRef","onKeyDown","useCallback","event","table","options","enableRowSelection","defaultPrevented","rows","getRowModel","tableMeta","meta","key","preventDefault","rowActiveIndex","rowActive","undefined","_rows$rowActiveIndex","toggleSelected","ctrlKey","metaKey","toggleAllRowsSelected","handleKeyDown"],"mappings":";;SAGgBA,oBAAoBA,CAACC,SAAS,GAAG,KAAK;EAClD,MAAMC,oBAAoB,GAAGC,cAAK,CAACC,MAAM,EAAU;EAEnD,MAAMC,SAAS,GAAGF,cAAK,CAACG,WAAW,CAC/B,CAAkBC,KAAoB,EAAEC,KAAwB;IAC5D,IAAI,CAACP,SAAS,IAAI,CAACO,KAAK,CAACC,OAAO,CAACC,kBAAkB,IAAIH,KAAK,CAACI,gBAAgB,EAAE;MAC3E;;IAGJ,MAAMC,IAAI,GAAGJ,KAAK,CAACK,WAAW,EAAE,CAACD,IAAI;IACrC,MAAME,SAAS,GAAGN,KAAK,CAACC,OAAO,CAACM,IAA6B;IAE7D,IAAIR,KAAK,CAACS,GAAG,KAAK,GAAG,EAAE;MACnBT,KAAK,CAACU,cAAc,EAAE;MACtB,MAAMC,cAAc,GAAGJ,SAAS,CAACK,SAAS,CAACD,cAAc;MAEzD,IAAIA,cAAc,KAAKE,SAAS,EAAE;QAAA,IAAAC,oBAAA;QAC9B,CAAAA,oBAAA,GAAAT,IAAI,CAACM,cAAc,CAAC,cAAAG,oBAAA,uBAApBA,oBAAA,CAAsBC,cAAc,EAAE;;MAG1C;KACH,MAAM,IAAI,CAACf,KAAK,CAACgB,OAAO,IAAIhB,KAAK,CAACiB,OAAO,KAAKjB,KAAK,CAACS,GAAG,KAAK,GAAG,EAAE;MAC9DT,KAAK,CAACU,cAAc,EAAE;MACtBT,KAAK,CAACiB,qBAAqB,EAAE;MAC7B;;GAEP,EACD,CAACxB,SAAS,CAAC,CAC+D;EAE9E,OAAO;IACHyB,aAAa,EAAEzB,SAAS,GAAGI,SAAS,GAAG,MAAMe,SAAS;IACtDlB;GACH;AACL;;;;"}
|
package/dist/esm/packages/taco/src/primitives/Table/useTable/features/useTableServerLoading.js.map
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"useTableServerLoading.js","sources":["../../../../../../../../../src/primitives/Table/useTable/features/useTableServerLoading.ts"],"sourcesContent":["import { TableServerLoadAllHandler, TableServerLoadPageHandler } from '../../types';\n\nexport function useTableServerLoading(loadPage?: TableServerLoadPageHandler, loadAll?: TableServerLoadAllHandler) {\n const isEnabled = !!loadPage && !!loadAll;\n\n return {\n isEnabled,\n loadPage,\n loadAll,\n };\n}\n"],"names":["useTableServerLoading","loadPage","loadAll","isEnabled"],"mappings":"SAEgBA,qBAAqBA,CAACC,QAAqC,EAAEC,OAAmC;EAC5G,MAAMC,SAAS,GAAG,CAAC,CAACF,QAAQ,IAAI,CAAC,CAACC,OAAO;EAEzC,OAAO;IACHC,SAAS;IACTF,QAAQ;IACRC;GACH;AACL;;;;"}
|
package/dist/esm/packages/taco/src/primitives/Table/useTable/listeners/useTableDataListener.js
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
import { useLazyEffect } from '../../../../hooks/useLazyEffect.js';
|
2
|
+
|
3
|
+
function useTableDataListener(table) {
|
4
|
+
const meta = table.options.meta;
|
5
|
+
const rows = table.getRowModel().rows;
|
6
|
+
useLazyEffect(() => {
|
7
|
+
const rowActiveIndex = meta.rowActive.rowActiveIndex;
|
8
|
+
if (rowActiveIndex !== undefined && rowActiveIndex > rows.length) {
|
9
|
+
meta.rowActive.setRowActiveIndex(0);
|
10
|
+
}
|
11
|
+
}, [rows.length]);
|
12
|
+
}
|
13
|
+
|
14
|
+
export { useTableDataListener };
|
15
|
+
//# sourceMappingURL=useTableDataListener.js.map
|
package/dist/esm/packages/taco/src/primitives/Table/useTable/listeners/useTableDataListener.js.map
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"useTableDataListener.js","sources":["../../../../../../../../../src/primitives/Table/useTable/listeners/useTableDataListener.ts"],"sourcesContent":["import { Table as ReactTable, TableMeta as ReactTableMeta } from '@tanstack/react-table';\nimport { useLazyEffect } from '../../../../hooks/useLazyEffect';\n\nexport function useTableDataListener<TType = unknown>(table: ReactTable<TType>) {\n const meta = table.options.meta as ReactTableMeta<TType>;\n const rows = table.getRowModel().rows;\n\n useLazyEffect(() => {\n const rowActiveIndex = meta.rowActive.rowActiveIndex;\n\n if (rowActiveIndex !== undefined && rowActiveIndex > rows.length) {\n meta.rowActive.setRowActiveIndex(0);\n }\n }, [rows.length]);\n}\n"],"names":["useTableDataListener","table","meta","options","rows","getRowModel","useLazyEffect","rowActiveIndex","rowActive","undefined","length","setRowActiveIndex"],"mappings":";;SAGgBA,oBAAoBA,CAAkBC,KAAwB;EAC1E,MAAMC,IAAI,GAAGD,KAAK,CAACE,OAAO,CAACD,IAA6B;EACxD,MAAME,IAAI,GAAGH,KAAK,CAACI,WAAW,EAAE,CAACD,IAAI;EAErCE,aAAa,CAAC;IACV,MAAMC,cAAc,GAAGL,IAAI,CAACM,SAAS,CAACD,cAAc;IAEpD,IAAIA,cAAc,KAAKE,SAAS,IAAIF,cAAc,GAAGH,IAAI,CAACM,MAAM,EAAE;MAC9DR,IAAI,CAACM,SAAS,CAACG,iBAAiB,CAAC,CAAC,CAAC;;GAE1C,EAAE,CAACP,IAAI,CAACM,MAAM,CAAC,CAAC;AACrB;;;;"}
|
@@ -3,7 +3,7 @@ import { useLazyEffect } from '../../../../hooks/useLazyEffect.js';
|
|
3
3
|
// we use a listener, and not the internal "controlled" change handlers because we don't actually want consumers
|
4
4
|
// to control the state outside the table. this listener is really here to let the consumer make a server request
|
5
5
|
// and provide the server with the filtering state, so that it can filter server side
|
6
|
-
function
|
6
|
+
function useTableFilterListener(table, onFilter) {
|
7
7
|
const columnFilters = table.getState().columnFilters;
|
8
8
|
useLazyEffect(() => {
|
9
9
|
if (table.options.enableColumnFilters && typeof onFilter === 'function') {
|
@@ -15,5 +15,5 @@ function useFilteringStateListener(table, onFilter) {
|
|
15
15
|
}, [table.options.enableColumnFilters, columnFilters]);
|
16
16
|
}
|
17
17
|
|
18
|
-
export {
|
19
|
-
//# sourceMappingURL=
|
18
|
+
export { useTableFilterListener };
|
19
|
+
//# sourceMappingURL=useTableFilterListener.js.map
|
package/dist/esm/packages/taco/src/primitives/Table/useTable/listeners/useTableFilterListener.js.map
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"useTableFilterListener.js","sources":["../../../../../../../../../src/primitives/Table/useTable/listeners/useTableFilterListener.ts"],"sourcesContent":["import { Table as ReactTable } from '@tanstack/react-table';\nimport { useLazyEffect } from '../../../../hooks/useLazyEffect';\nimport { TableFilterHandler } from '../../types';\n\n// we use a listener, and not the internal \"controlled\" change handlers because we don't actually want consumers\n// to control the state outside the table. this listener is really here to let the consumer make a server request\n// and provide the server with the filtering state, so that it can filter server side\nexport function useTableFilterListener<TType = unknown>(table: ReactTable<TType>, onFilter?: TableFilterHandler) {\n const columnFilters = table.getState().columnFilters;\n\n useLazyEffect(() => {\n if (table.options.enableColumnFilters && typeof onFilter === 'function') {\n onFilter(columnFilters);\n\n if (table.options.enableRowSelection) {\n table.resetRowSelection();\n }\n }\n }, [table.options.enableColumnFilters, columnFilters]);\n}\n"],"names":["useTableFilterListener","table","onFilter","columnFilters","getState","useLazyEffect","options","enableColumnFilters","enableRowSelection","resetRowSelection"],"mappings":";;AAIA;AACA;AACA;SACgBA,sBAAsBA,CAAkBC,KAAwB,EAAEC,QAA6B;EAC3G,MAAMC,aAAa,GAAGF,KAAK,CAACG,QAAQ,EAAE,CAACD,aAAa;EAEpDE,aAAa,CAAC;IACV,IAAIJ,KAAK,CAACK,OAAO,CAACC,mBAAmB,IAAI,OAAOL,QAAQ,KAAK,UAAU,EAAE;MACrEA,QAAQ,CAACC,aAAa,CAAC;MAEvB,IAAIF,KAAK,CAACK,OAAO,CAACE,kBAAkB,EAAE;QAClCP,KAAK,CAACQ,iBAAiB,EAAE;;;GAGpC,EAAE,CAACR,KAAK,CAACK,OAAO,CAACC,mBAAmB,EAAEJ,aAAa,CAAC,CAAC;AAC1D;;;;"}
|
package/dist/esm/packages/taco/src/primitives/Table/useTable/listeners/useTableFontSizeListener.js
ADDED
@@ -0,0 +1,40 @@
|
|
1
|
+
import React__default from 'react';
|
2
|
+
import { TableFontSizes } from '../../types.js';
|
3
|
+
import { getCellMinWidth } from '../util/columns.js';
|
4
|
+
import { useLazyEffect } from '../../../../hooks/useLazyEffect.js';
|
5
|
+
|
6
|
+
function useTableFontSizeListener(table) {
|
7
|
+
const meta = table.options.meta;
|
8
|
+
const previousFontSizeRef = React__default.useRef(meta.fontSize.size);
|
9
|
+
useLazyEffect(() => {
|
10
|
+
const cellWidthDifference = getCellWidthDifference(`${previousFontSizeRef.current}-${meta.fontSize.size}`);
|
11
|
+
table.setColumnSizing(sizes => {
|
12
|
+
const minColumnSize = getCellMinWidth(meta.fontSize.size);
|
13
|
+
return Object.fromEntries(Object.entries(sizes).map(([columnName, prevColumnSize]) => {
|
14
|
+
// Prevents width value in the setting to go below the minColumnSize
|
15
|
+
const newSize = Math.max(minColumnSize, prevColumnSize + cellWidthDifference);
|
16
|
+
return [columnName, newSize];
|
17
|
+
}));
|
18
|
+
});
|
19
|
+
previousFontSizeRef.current = meta.fontSize.size;
|
20
|
+
}, [meta.fontSize.size]);
|
21
|
+
}
|
22
|
+
function getCellWidthDifference(fontSizeKey) {
|
23
|
+
switch (fontSizeKey) {
|
24
|
+
case `${TableFontSizes.small}-${TableFontSizes.medium}`:
|
25
|
+
case `${TableFontSizes.medium}-${TableFontSizes.large}`:
|
26
|
+
return 8;
|
27
|
+
case `${TableFontSizes.medium}-${TableFontSizes.small}`:
|
28
|
+
case `${TableFontSizes.large}-${TableFontSizes.medium}`:
|
29
|
+
return -8;
|
30
|
+
case `${TableFontSizes.small}-${TableFontSizes.large}`:
|
31
|
+
return 16;
|
32
|
+
case `${TableFontSizes.large}-${TableFontSizes.small}`:
|
33
|
+
return -16;
|
34
|
+
default:
|
35
|
+
return 0;
|
36
|
+
}
|
37
|
+
}
|
38
|
+
|
39
|
+
export { useTableFontSizeListener };
|
40
|
+
//# sourceMappingURL=useTableFontSizeListener.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"useTableFontSizeListener.js","sources":["../../../../../../../../../src/primitives/Table/useTable/listeners/useTableFontSizeListener.ts"],"sourcesContent":["import React from 'react';\nimport { Table as ReactTable, TableMeta as ReactTableMeta } from '@tanstack/react-table';\nimport { useLazyEffect } from '../../../../hooks/useLazyEffect';\nimport { TableFontSizes } from '../../types';\nimport { getCellMinWidth } from '../util/columns';\n\nexport function useTableFontSizeListener<TType = unknown>(table: ReactTable<TType>) {\n const meta = table.options.meta as ReactTableMeta<TType>;\n const previousFontSizeRef = React.useRef(meta.fontSize.size);\n\n useLazyEffect(() => {\n const cellWidthDifference = getCellWidthDifference(`${previousFontSizeRef.current}-${meta.fontSize.size}`);\n\n table.setColumnSizing(sizes => {\n const minColumnSize = getCellMinWidth(meta.fontSize.size);\n\n return Object.fromEntries(\n Object.entries(sizes).map(([columnName, prevColumnSize]) => {\n // Prevents width value in the setting to go below the minColumnSize\n const newSize = Math.max(minColumnSize, prevColumnSize + cellWidthDifference);\n return [columnName, newSize];\n })\n );\n });\n previousFontSizeRef.current = meta.fontSize.size;\n }, [meta.fontSize.size]);\n}\n\nfunction getCellWidthDifference(fontSizeKey: string) {\n switch (fontSizeKey) {\n case `${TableFontSizes.small}-${TableFontSizes.medium}`:\n case `${TableFontSizes.medium}-${TableFontSizes.large}`:\n return 8;\n\n case `${TableFontSizes.medium}-${TableFontSizes.small}`:\n case `${TableFontSizes.large}-${TableFontSizes.medium}`:\n return -8;\n\n case `${TableFontSizes.small}-${TableFontSizes.large}`:\n return 16;\n\n case `${TableFontSizes.large}-${TableFontSizes.small}`:\n return -16;\n\n default:\n return 0;\n }\n}\n"],"names":["useTableFontSizeListener","table","meta","options","previousFontSizeRef","React","useRef","fontSize","size","useLazyEffect","cellWidthDifference","getCellWidthDifference","current","setColumnSizing","sizes","minColumnSize","getCellMinWidth","Object","fromEntries","entries","map","columnName","prevColumnSize","newSize","Math","max","fontSizeKey","TableFontSizes","small","medium","large"],"mappings":";;;;;SAMgBA,wBAAwBA,CAAkBC,KAAwB;EAC9E,MAAMC,IAAI,GAAGD,KAAK,CAACE,OAAO,CAACD,IAA6B;EACxD,MAAME,mBAAmB,GAAGC,cAAK,CAACC,MAAM,CAACJ,IAAI,CAACK,QAAQ,CAACC,IAAI,CAAC;EAE5DC,aAAa,CAAC;IACV,MAAMC,mBAAmB,GAAGC,sBAAsB,IAAIP,mBAAmB,CAACQ,WAAWV,IAAI,CAACK,QAAQ,CAACC,MAAM,CAAC;IAE1GP,KAAK,CAACY,eAAe,CAACC,KAAK;MACvB,MAAMC,aAAa,GAAGC,eAAe,CAACd,IAAI,CAACK,QAAQ,CAACC,IAAI,CAAC;MAEzD,OAAOS,MAAM,CAACC,WAAW,CACrBD,MAAM,CAACE,OAAO,CAACL,KAAK,CAAC,CAACM,GAAG,CAAC,CAAC,CAACC,UAAU,EAAEC,cAAc,CAAC;;QAEnD,MAAMC,OAAO,GAAGC,IAAI,CAACC,GAAG,CAACV,aAAa,EAAEO,cAAc,GAAGZ,mBAAmB,CAAC;QAC7E,OAAO,CAACW,UAAU,EAAEE,OAAO,CAAC;OAC/B,CAAC,CACL;KACJ,CAAC;IACFnB,mBAAmB,CAACQ,OAAO,GAAGV,IAAI,CAACK,QAAQ,CAACC,IAAI;GACnD,EAAE,CAACN,IAAI,CAACK,QAAQ,CAACC,IAAI,CAAC,CAAC;AAC5B;AAEA,SAASG,sBAAsBA,CAACe,WAAmB;EAC/C,QAAQA,WAAW;IACf,QAAQC,cAAc,CAACC,SAASD,cAAc,CAACE,QAAQ;IACvD,QAAQF,cAAc,CAACE,UAAUF,cAAc,CAACG,OAAO;MACnD,OAAO,CAAC;IAEZ,QAAQH,cAAc,CAACE,UAAUF,cAAc,CAACC,OAAO;IACvD,QAAQD,cAAc,CAACG,SAASH,cAAc,CAACE,QAAQ;MACnD,OAAO,CAAC,CAAC;IAEb,QAAQF,cAAc,CAACC,SAASD,cAAc,CAACG,OAAO;MAClD,OAAO,EAAE;IAEb,QAAQH,cAAc,CAACG,SAASH,cAAc,CAACC,OAAO;MAClD,OAAO,CAAC,EAAE;IAEd;MACI,OAAO,CAAC;;AAEpB;;;;"}
|
@@ -1,10 +1,9 @@
|
|
1
1
|
import { useLazyEffect } from '../../../../hooks/useLazyEffect.js';
|
2
2
|
|
3
|
-
function
|
4
|
-
const
|
3
|
+
function useTableRowSelectionListener(table, onRowSelect) {
|
4
|
+
const selectedRows = table.getSelectedRowModel().rows;
|
5
5
|
useLazyEffect(() => {
|
6
6
|
if (table.options.enableRowSelection && typeof onRowSelect === 'function') {
|
7
|
-
const selectedRows = table.getSelectedRowModel().rows;
|
8
7
|
if (table.options.enableMultiRowSelection) {
|
9
8
|
onRowSelect(selectedRows.map(row => row.original));
|
10
9
|
} else {
|
@@ -12,8 +11,8 @@ function useRowSelectionListener(table, onRowSelect) {
|
|
12
11
|
onRowSelect((_ref = [(_selectedRows$ = selectedRows[0]) === null || _selectedRows$ === void 0 ? void 0 : _selectedRows$.original]) !== null && _ref !== void 0 ? _ref : []);
|
13
12
|
}
|
14
13
|
}
|
15
|
-
}, [table.options.enableRowSelection,
|
14
|
+
}, [table.options.enableRowSelection, table.options.enableMultiRowSelection, selectedRows]);
|
16
15
|
}
|
17
16
|
|
18
|
-
export {
|
19
|
-
//# sourceMappingURL=
|
17
|
+
export { useTableRowSelectionListener };
|
18
|
+
//# sourceMappingURL=useTableRowSelectionListener.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"useTableRowSelectionListener.js","sources":["../../../../../../../../../src/primitives/Table/useTable/listeners/useTableRowSelectionListener.ts"],"sourcesContent":["import { Table as ReactTable } from '@tanstack/react-table';\nimport { useLazyEffect } from '../../../../hooks/useLazyEffect';\nimport { TableRowSelectHandler } from '../../types';\n\nexport function useTableRowSelectionListener<TType = unknown>(\n table: ReactTable<TType>,\n onRowSelect?: TableRowSelectHandler<TType>\n) {\n const selectedRows = table.getSelectedRowModel().rows;\n\n useLazyEffect(() => {\n if (table.options.enableRowSelection && typeof onRowSelect === 'function') {\n if (table.options.enableMultiRowSelection) {\n onRowSelect(selectedRows.map(row => row.original));\n } else {\n onRowSelect([selectedRows[0]?.original] ?? []);\n }\n }\n }, [table.options.enableRowSelection, table.options.enableMultiRowSelection, selectedRows]);\n}\n"],"names":["useTableRowSelectionListener","table","onRowSelect","selectedRows","getSelectedRowModel","rows","useLazyEffect","options","enableRowSelection","enableMultiRowSelection","map","row","original","_ref","_selectedRows$"],"mappings":";;SAIgBA,4BAA4BA,CACxCC,KAAwB,EACxBC,WAA0C;EAE1C,MAAMC,YAAY,GAAGF,KAAK,CAACG,mBAAmB,EAAE,CAACC,IAAI;EAErDC,aAAa,CAAC;IACV,IAAIL,KAAK,CAACM,OAAO,CAACC,kBAAkB,IAAI,OAAON,WAAW,KAAK,UAAU,EAAE;MACvE,IAAID,KAAK,CAACM,OAAO,CAACE,uBAAuB,EAAE;QACvCP,WAAW,CAACC,YAAY,CAACO,GAAG,CAACC,GAAG,IAAIA,GAAG,CAACC,QAAQ,CAAC,CAAC;OACrD,MAAM;QAAA,IAAAC,IAAA,EAAAC,cAAA;QACHZ,WAAW,EAAAW,IAAA,GAAC,EAAAC,cAAA,GAACX,YAAY,CAAC,CAAC,CAAC,cAAAW,cAAA,uBAAfA,cAAA,CAAiBF,QAAQ,CAAC,cAAAC,IAAA,cAAAA,IAAA,GAAI,EAAE,CAAC;;;GAGzD,EAAE,CAACZ,KAAK,CAACM,OAAO,CAACC,kBAAkB,EAAEP,KAAK,CAACM,OAAO,CAACE,uBAAuB,EAAEN,YAAY,CAAC,CAAC;AAC/F;;;;"}
|
@@ -1,6 +1,6 @@
|
|
1
1
|
import React__default from 'react';
|
2
2
|
|
3
|
-
function
|
3
|
+
function useTableServerLoadingListener(table, loadPage) {
|
4
4
|
const sorting = table.getState().sorting;
|
5
5
|
const columnFilters = table.getState().columnFilters;
|
6
6
|
const search = table.getState().globalFilter;
|
@@ -12,5 +12,5 @@ function useServerLoadingListener(table, loadPage) {
|
|
12
12
|
}, []);
|
13
13
|
}
|
14
14
|
|
15
|
-
export {
|
16
|
-
//# sourceMappingURL=
|
15
|
+
export { useTableServerLoadingListener };
|
16
|
+
//# sourceMappingURL=useTableServerLoadingListener.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"useTableServerLoadingListener.js","sources":["../../../../../../../../../src/primitives/Table/useTable/listeners/useTableServerLoadingListener.ts"],"sourcesContent":["import React from 'react';\nimport { Table as ReactTable } from '@tanstack/react-table';\nimport { TableServerLoadPageHandler } from '../../types';\n\nexport function useTableServerLoadingListener<TType = unknown>(table: ReactTable<TType>, loadPage?: TableServerLoadPageHandler) {\n const sorting = table.getState().sorting;\n const columnFilters = table.getState().columnFilters;\n const search = table.getState().globalFilter;\n\n // trigger load of the first page on mount\n React.useEffect(() => {\n if (loadPage) {\n loadPage(0, sorting, columnFilters, search);\n }\n }, []);\n}\n"],"names":["useTableServerLoadingListener","table","loadPage","sorting","getState","columnFilters","search","globalFilter","React","useEffect"],"mappings":";;SAIgBA,6BAA6BA,CAAkBC,KAAwB,EAAEC,QAAqC;EAC1H,MAAMC,OAAO,GAAGF,KAAK,CAACG,QAAQ,EAAE,CAACD,OAAO;EACxC,MAAME,aAAa,GAAGJ,KAAK,CAACG,QAAQ,EAAE,CAACC,aAAa;EACpD,MAAMC,MAAM,GAAGL,KAAK,CAACG,QAAQ,EAAE,CAACG,YAAY;;EAG5CC,cAAK,CAACC,SAAS,CAAC;IACZ,IAAIP,QAAQ,EAAE;MACVA,QAAQ,CAAC,CAAC,EAAEC,OAAO,EAAEE,aAAa,EAAEC,MAAM,CAAC;;GAElD,EAAE,EAAE,CAAC;AACV;;;;"}
|
@@ -1,15 +1,15 @@
|
|
1
1
|
import React__default from 'react';
|
2
2
|
import { createShortcutKeyDownHandler } from '../../../../utils/keyboard.js';
|
3
3
|
|
4
|
-
function
|
4
|
+
function useTableShortcutsListener(table, shortcuts) {
|
5
5
|
const meta = table.options.meta;
|
6
6
|
const rows = table.getRowModel().rows;
|
7
7
|
React__default.useEffect(() => {
|
8
8
|
const shortcutKeys = Object.keys(shortcuts !== null && shortcuts !== void 0 ? shortcuts : {});
|
9
9
|
const globalHandlers = [];
|
10
10
|
// convert the shortcut into the correct format to register it
|
11
|
-
if (shortcuts && shortcutKeys.length && meta.
|
12
|
-
const
|
11
|
+
if (shortcuts && shortcutKeys.length && meta.rowActive.rowActiveIndex !== undefined) {
|
12
|
+
const rowActive = rows[meta.rowActive.rowActiveIndex];
|
13
13
|
shortcutKeys.forEach(key => {
|
14
14
|
const handler = shortcuts[key];
|
15
15
|
let keyDownHandler;
|
@@ -30,7 +30,7 @@ function useShortcutsListener(table, shortcuts) {
|
|
30
30
|
}
|
31
31
|
globalHandlers.push(createShortcutKeyDownHandler(keyDownHandlerOptions, event => {
|
32
32
|
event.preventDefault();
|
33
|
-
keyDownHandler(
|
33
|
+
keyDownHandler(rowActive === null || rowActive === void 0 ? void 0 : rowActive.original);
|
34
34
|
}));
|
35
35
|
});
|
36
36
|
}
|
@@ -42,8 +42,8 @@ function useShortcutsListener(table, shortcuts) {
|
|
42
42
|
document.removeEventListener('keydown', handler);
|
43
43
|
});
|
44
44
|
};
|
45
|
-
}, [shortcuts, meta.
|
45
|
+
}, [shortcuts, meta.rowActive.rowActiveIndex, rows.length]);
|
46
46
|
}
|
47
47
|
|
48
|
-
export {
|
49
|
-
//# sourceMappingURL=
|
48
|
+
export { useTableShortcutsListener };
|
49
|
+
//# sourceMappingURL=useTableShortcutsListener.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"useTableShortcutsListener.js","sources":["../../../../../../../../../src/primitives/Table/useTable/listeners/useTableShortcutsListener.ts"],"sourcesContent":["import React from 'react';\nimport { Table as ReactTable, TableMeta as ReactTableMeta } from '@tanstack/react-table';\nimport { KeyDownHandlerOptions, createShortcutKeyDownHandler } from '../../../../utils/keyboard';\nimport { TableShortcutHandlerObject, TableShortcuts } from '../../types';\n\nexport function useTableShortcutsListener<TType = unknown>(\n table: ReactTable<TType>,\n shortcuts: TableShortcuts<TType> | undefined\n) {\n const meta = table.options.meta as ReactTableMeta<TType>;\n const rows = table.getRowModel().rows;\n\n React.useEffect(() => {\n const shortcutKeys = Object.keys(shortcuts ?? {});\n const globalHandlers: Array<(event: KeyboardEvent) => void> = [];\n\n // convert the shortcut into the correct format to register it\n if (shortcuts && shortcutKeys.length && meta.rowActive.rowActiveIndex !== undefined) {\n const rowActive = rows[meta.rowActive.rowActiveIndex];\n\n shortcutKeys.forEach(key => {\n const handler = shortcuts[key];\n\n let keyDownHandler;\n let keyDownHandlerOptions: KeyDownHandlerOptions;\n\n if (typeof handler === 'function') {\n keyDownHandler = handler;\n keyDownHandlerOptions = {\n key,\n };\n } else {\n const handlerObject = handler as TableShortcutHandlerObject<TType>;\n keyDownHandler = handlerObject.handler;\n keyDownHandlerOptions = {\n key,\n meta: handlerObject.meta,\n shift: handlerObject.shift,\n };\n }\n\n globalHandlers.push(\n createShortcutKeyDownHandler(keyDownHandlerOptions, event => {\n event.preventDefault();\n keyDownHandler(rowActive?.original);\n })\n );\n });\n }\n\n globalHandlers.forEach(handler => {\n document.addEventListener('keydown', handler);\n });\n\n return () => {\n globalHandlers.forEach(handler => {\n document.removeEventListener('keydown', handler);\n });\n };\n }, [shortcuts, meta.rowActive.rowActiveIndex, rows.length]);\n}\n"],"names":["useTableShortcutsListener","table","shortcuts","meta","options","rows","getRowModel","React","useEffect","shortcutKeys","Object","keys","globalHandlers","length","rowActive","rowActiveIndex","undefined","forEach","key","handler","keyDownHandler","keyDownHandlerOptions","handlerObject","shift","push","createShortcutKeyDownHandler","event","preventDefault","original","document","addEventListener","removeEventListener"],"mappings":";;;SAKgBA,yBAAyBA,CACrCC,KAAwB,EACxBC,SAA4C;EAE5C,MAAMC,IAAI,GAAGF,KAAK,CAACG,OAAO,CAACD,IAA6B;EACxD,MAAME,IAAI,GAAGJ,KAAK,CAACK,WAAW,EAAE,CAACD,IAAI;EAErCE,cAAK,CAACC,SAAS,CAAC;IACZ,MAAMC,YAAY,GAAGC,MAAM,CAACC,IAAI,CAACT,SAAS,aAATA,SAAS,cAATA,SAAS,GAAI,EAAE,CAAC;IACjD,MAAMU,cAAc,GAA0C,EAAE;;IAGhE,IAAIV,SAAS,IAAIO,YAAY,CAACI,MAAM,IAAIV,IAAI,CAACW,SAAS,CAACC,cAAc,KAAKC,SAAS,EAAE;MACjF,MAAMF,SAAS,GAAGT,IAAI,CAACF,IAAI,CAACW,SAAS,CAACC,cAAc,CAAC;MAErDN,YAAY,CAACQ,OAAO,CAACC,GAAG;QACpB,MAAMC,OAAO,GAAGjB,SAAS,CAACgB,GAAG,CAAC;QAE9B,IAAIE,cAAc;QAClB,IAAIC,qBAA4C;QAEhD,IAAI,OAAOF,OAAO,KAAK,UAAU,EAAE;UAC/BC,cAAc,GAAGD,OAAO;UACxBE,qBAAqB,GAAG;YACpBH;WACH;SACJ,MAAM;UACH,MAAMI,aAAa,GAAGH,OAA4C;UAClEC,cAAc,GAAGE,aAAa,CAACH,OAAO;UACtCE,qBAAqB,GAAG;YACpBH,GAAG;YACHf,IAAI,EAAEmB,aAAa,CAACnB,IAAI;YACxBoB,KAAK,EAAED,aAAa,CAACC;WACxB;;QAGLX,cAAc,CAACY,IAAI,CACfC,4BAA4B,CAACJ,qBAAqB,EAAEK,KAAK;UACrDA,KAAK,CAACC,cAAc,EAAE;UACtBP,cAAc,CAACN,SAAS,aAATA,SAAS,uBAATA,SAAS,CAAEc,QAAQ,CAAC;SACtC,CAAC,CACL;OACJ,CAAC;;IAGNhB,cAAc,CAACK,OAAO,CAACE,OAAO;MAC1BU,QAAQ,CAACC,gBAAgB,CAAC,SAAS,EAAEX,OAAO,CAAC;KAChD,CAAC;IAEF,OAAO;MACHP,cAAc,CAACK,OAAO,CAACE,OAAO;QAC1BU,QAAQ,CAACE,mBAAmB,CAAC,SAAS,EAAEZ,OAAO,CAAC;OACnD,CAAC;KACL;GACJ,EAAE,CAACjB,SAAS,EAAEC,IAAI,CAACW,SAAS,CAACC,cAAc,EAAEV,IAAI,CAACQ,MAAM,CAAC,CAAC;AAC/D;;;;"}
|