@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":"EditingActions.js","sources":["../../../../../../../../../../src/components/Table3/components/columns/internal/EditingActions.tsx"],"sourcesContent":["import React from 'react';\nimport cn from 'classnames';\nimport { CellContext, TableMeta, DisplayColumnDef } from '@tanstack/react-table';\nimport { Spinner } from '../../../../Spinner/Spinner';\nimport { SavingStatusValue, useEditing } from '../../../hooks/features/useEditing';\nimport { IconButton } from '../../../../IconButton/IconButton';\nimport { Menu } from '../../../../Menu/Menu';\nimport { RowContext } from '../../rows/RowContext';\nimport { DisplayCell } from '../cell/DisplayCell';\nimport { Header as ColumnHeader } from '../header/Header';\nimport { Footer } from '../footer/Footer';\nimport { useLocalization } from '../../../../Provider/Localization';\nimport useTimer from '../../../../../utils/hooks/useTimer';\nimport { Icon } from '../../../../Icon/Icon';\nimport { Tooltip } from '../../../../Tooltip/Tooltip';\nimport { Dialog } from '../../../../Dialog/Dialog';\nimport { Group } from '../../../../Group/Group';\nimport { Button } from '../../../../Button/Button';\nimport { lastCellIndex } from '../../rows/Row';\nimport { getColumnIndex } from '../../../util/editing';\n\nexport type EditingActionsProps<TType = unknown> = CellContext<TType, unknown> & {\n className?: string;\n isHovered: boolean;\n};\n\nconst savingIndicatorHideDelay = 3000;\n\nexport const COLUMN_ID = '__editing_actions';\n\ntype MemoedCellProps<TType = unknown> = CellContext<TType, unknown> & {\n hasChanges: boolean;\n isCurrentRow: boolean;\n editing: ReturnType<typeof useEditing>;\n rowIdentifier?: string;\n};\n\nconst MemoedCell = React.memo(function MemoedCell<TType = unknown>(props: MemoedCellProps<TType>) {\n const { hasChanges, isCurrentRow, row, editing, rowIdentifier, table } = props;\n\n const savingStatus = editing.getSavingStatus(row.id);\n const [isSavedIndicatorVisible, setIsSavingIndicatorVisible] = React.useState(false);\n const { texts } = useLocalization();\n const [clearConfirmationOpen, setClearConfirmationOpen] = React.useState(false);\n const columns = table.getAllFlatColumns();\n const column = columns.find(column => column.id === rowIdentifier);\n const rowIdentifierHeader = column?.columnDef.meta?.header;\n const edititngActionsRef = React.useRef<HTMLButtonElement | HTMLAnchorElement>(null);\n const tableMeta = table.options.meta as TableMeta<TType>;\n\n const handleSaved = () => {\n setIsSavingIndicatorVisible(false);\n editing.resetSavingStatus(row.id);\n };\n const timer = useTimer(savingIndicatorHideDelay, handleSaved);\n\n React.useEffect(() => {\n if (savingStatus && savingStatus === SavingStatusValue.Saved && !isSavedIndicatorVisible) {\n setIsSavingIndicatorVisible(true);\n timer.start();\n }\n }, [savingStatus]);\n\n React.useEffect(() => {\n tableMeta.shortcutsState.pause(clearConfirmationOpen);\n }, [clearConfirmationOpen]);\n\n let content;\n\n if (savingStatus) {\n if (savingStatus === SavingStatusValue.Saving) {\n content = (\n <Tooltip title={texts.table3.editing.saving.progress}>\n <Spinner delay={0} className=\"!text-grey-700 mr-1 !h-5 !w-5\" />\n </Tooltip>\n );\n } else if (isSavedIndicatorVisible) {\n content = (\n <Tooltip title={texts.table3.editing.saving.complete}>\n <Icon name=\"tick\" className=\"!text-grey-700 mr-1 !h-5 !w-5\" />\n </Tooltip>\n );\n }\n }\n\n if (editing.isEditing && isCurrentRow) {\n content = (\n <>\n {content}\n <IconButton\n ref={edititngActionsRef}\n appearance=\"transparent\"\n aria-label={texts.table3.editing.actions.tooltip}\n icon=\"more\"\n menu={menuProps => (\n <Menu {...menuProps}>\n <Menu.Content>\n <Menu.Item\n icon=\"tick\"\n disabled={!hasChanges}\n onClick={() => editing.saveChangesIfNeeded()}>\n {texts.table3.editing.actions.save}\n </Menu.Item>\n <Menu.Item\n icon=\"close\"\n disabled={!hasChanges}\n onClick={() => setClearConfirmationOpen(true)}>\n {texts.table3.editing.actions.clear}\n </Menu.Item>\n <Menu.Item icon=\"undo\" onClick={() => editing.toggleEditing(false)}>\n {texts.table3.editing.actions.exit}\n </Menu.Item>\n </Menu.Content>\n </Menu>\n )}\n tabIndex={isCurrentRow ? 0 : -1}\n />\n <Dialog\n size=\"xs\"\n open={clearConfirmationOpen}\n onClose={() => {\n setClearConfirmationOpen(false);\n requestAnimationFrame(() => {\n if (edititngActionsRef.current) {\n edititngActionsRef.current.focus();\n // When table looses focus, we need to re-set the last column index\n lastCellIndex.value = getColumnIndex(edititngActionsRef.current);\n }\n });\n }}>\n <Dialog.Content aria-label={texts.table3.editing.clearChangesConfirmationDialog.title}>\n <Dialog.Title>{texts.table3.editing.clearChangesConfirmationDialog.title}</Dialog.Title>\n\n <p>\n {texts.table3.editing.clearChangesConfirmationDialog.description\n .replace(\n '[ROW_IDENTIFIER]',\n rowIdentifier && rowIdentifierHeader ? rowIdentifierHeader : texts.table3.validation.index\n )\n .replace(\n '[ROW_IDENTIFIER_VALUE]',\n rowIdentifier && rowIdentifierHeader ? row.original[rowIdentifier] : row.index\n )}\n </p>\n\n <Dialog.Footer>\n <Group>\n <Dialog.Close>\n <Button tabIndex={0}>{texts.table3.editing.clearChangesConfirmationDialog.cancel}</Button>\n </Dialog.Close>\n <Dialog.Close>\n <Button tabIndex={0} appearance=\"primary\" autoFocus onClick={() => editing.resetChange(row.id)}>\n {texts.table3.editing.clearChangesConfirmationDialog.confirm}\n </Button>\n </Dialog.Close>\n </Group>\n </Dialog.Footer>\n </Dialog.Content>\n </Dialog>\n </>\n );\n }\n\n const contentClassName = cn('flex items-center justify-end text-right', { '-mb-2 -mt-2': isCurrentRow });\n return (\n <DisplayCell {...props} className={cn({ '!sticky': !!content })}>\n {content ? <span className={contentClassName}>{content}</span> : undefined}\n </DisplayCell>\n );\n}) as <TType = unknown>(props: MemoedCellProps<TType>) => JSX.Element;\n\ntype CellProps<TType = unknown> = CellContext<TType, unknown> & {\n rowIdentifier?: string;\n};\n\nfunction Cell<TType = unknown>(props: CellProps<TType>) {\n const { rowIndex } = React.useContext(RowContext);\n const tableMeta = props.table.options.meta as TableMeta<TType>;\n const changeset = tableMeta.editing.changes ? Object.keys(tableMeta.editing.changes) : [];\n\n return (\n <MemoedCell\n {...props}\n hasChanges={changeset.indexOf(props.row.id) >= 0}\n isCurrentRow={tableMeta.currentRow.currentRowIndex === rowIndex}\n editing={tableMeta.editing}\n />\n );\n}\n\nexport const EDITING_ACTIONS_WIDTH = 60;\n\nexport function createRowEditingActionsColumn<TType = unknown>(rowIdentifier?: string): DisplayColumnDef<TType, unknown> {\n return {\n id: COLUMN_ID,\n header: ColumnHeader,\n cell: (context: CellContext<TType, unknown>) => <Cell {...context} rowIdentifier={rowIdentifier} />,\n footer: Footer,\n meta: {\n align: 'right',\n className: cn(\n 'items-center print:opacity-0 [[role=\"table\"][data-editing=\"true\"]_&]:group-[[data-current=\"true\"]]/row:sticky right-0 !pl-0 !pr-1',\n '[[role=\"table\"][data-editing=\"true\"]_&]:group-[[data-current=\"true\"]]/row:shadow-[-6px_0px_6px_var(--table3-row-actions-shadow)]',\n 'group-[[data-current=\"true\"][data-selected=\"false\"]]/row:text-grey-200',\n 'group-[[data-selected=\"true\"]]/row:text-blue-100',\n 'group-[[data-selected=\"false\"]:hover]/row:text-grey-100'\n ),\n enableOrdering: false,\n enableSearch: false,\n enableTruncate: false,\n header: '',\n headerClassName: 'items-center !p-0',\n },\n // options\n enableResizing: false,\n size: EDITING_ACTIONS_WIDTH,\n minSize: EDITING_ACTIONS_WIDTH,\n };\n}\n"],"names":["savingIndicatorHideDelay","COLUMN_ID","MemoedCell","React","memo","props","hasChanges","isCurrentRow","row","editing","rowIdentifier","table","savingStatus","getSavingStatus","id","isSavedIndicatorVisible","setIsSavingIndicatorVisible","useState","texts","useLocalization","clearConfirmationOpen","setClearConfirmationOpen","columns","getAllFlatColumns","column","find","rowIdentifierHeader","_column$columnDef$met","columnDef","meta","header","edititngActionsRef","useRef","tableMeta","options","handleSaved","resetSavingStatus","timer","useTimer","useEffect","SavingStatusValue","Saved","start","shortcutsState","pause","content","Saving","Tooltip","title","table3","saving","progress","Spinner","delay","className","complete","Icon","name","isEditing","IconButton","ref","appearance","actions","tooltip","icon","menu","menuProps","Menu","Content","Item","disabled","onClick","saveChangesIfNeeded","save","clear","toggleEditing","exit","tabIndex","Dialog","size","open","onClose","requestAnimationFrame","current","focus","lastCellIndex","value","getColumnIndex","clearChangesConfirmationDialog","Title","description","replace","validation","index","original","Footer","Group","Close","Button","cancel","autoFocus","resetChange","confirm","contentClassName","cn","DisplayCell","undefined","Cell","rowIndex","useContext","RowContext","changeset","changes","Object","keys","indexOf","currentRow","currentRowIndex","EDITING_ACTIONS_WIDTH","createRowEditingActionsColumn","ColumnHeader","cell","context","footer","align","enableOrdering","enableSearch","enableTruncate","headerClassName","enableResizing","minSize"],"mappings":";;;;;;;;;;;;;;;;;;;;AA0BA,MAAMA,wBAAwB,GAAG,IAAI;MAExBC,SAAS,GAAG;AASzB,MAAMC,UAAU,gBAAGC,cAAK,CAACC,IAAI,CAAC,SAASF,UAAUA,CAAkBG,KAA6B;;EAC5F,MAAM;IAAEC,UAAU;IAAEC,YAAY;IAAEC,GAAG;IAAEC,OAAO;IAAEC,aAAa;IAAE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MAAM,CAACC,IAAI,CAACjF,SAAS,CAACxB,OAAO,CAACuG,OAAO,CAAC,GAAG,EAAE;EAEzF,oBACI7G,6BAACD,UAAU,oBACHG,KAAK;IACTC,UAAU,EAAEyG,SAAS,CAACI,OAAO,CAAC9G,KAAK,CAACG,GAAG,CAACM,EAAE,CAAC,IAAI,CAAC;IAChDP,YAAY,EAAE0B,SAAS,CAACmF,UAAU,CAACC,eAAe,KAAKT,QAAQ;IAC/DnG,OAAO,EAAEwB,SAAS,CAACxB;KACrB;AAEV;MAEa6G,qBAAqB,GAAG;SAErBC,6BAA6BA,CAAkB7G,aAAsB;EACjF,OAAO;IACHI,EAAE,EAAEb,SAAS;IACb6B,MAAM,EAAE0F,MAAY;IACpBC,IAAI,EAAGC,OAAoC,iBAAKvH,6BAACwG,IAAI,oBAAKe,OAAO;MAAEhH,aAAa,EAAEA;OAAiB;IACnGiH,MAAM,EAAE5B,MAAM;IACdlE,IAAI,EAAE;MACF+F,KAAK,EAAE,OAAO;MACdtE,SAAS,EAAEkD,EAAE,CACT,mIAAmI,EACnI,kIAAkI,EAClI,wEAAwE,EACxE,kDAAkD,EAClD,yDAAyD,CAC5D;MACDqB,cAAc,EAAE,KAAK;MACrBC,YAAY,EAAE,KAAK;MACnBC,cAAc,EAAE,KAAK;MACrBjG,MAAM,EAAE,EAAE;MACVkG,eAAe,EAAE;KACpB;;IAEDC,cAAc,EAAE,KAAK;IACrBlD,IAAI,EAAEuC,qBAAqB;IAC3BY,OAAO,EAAEZ;GACZ;AACL;;;;"}
|
1
|
+
{"version":3,"file":"EditingActions.js","sources":["../../../../../../../../../../src/components/Table3/components/columns/internal/EditingActions.tsx"],"sourcesContent":["import React from 'react';\nimport cn from 'classnames';\nimport { CellContext, TableMeta, DisplayColumnDef } from '@tanstack/react-table';\nimport { Spinner } from '../../../../Spinner/Spinner';\nimport { SavingStatusValue, useEditing } from '../../../hooks/features/useEditing';\nimport { IconButton } from '../../../../IconButton/IconButton';\nimport { Menu } from '../../../../Menu/Menu';\nimport { RowContext } from '../../rows/RowContext';\nimport { DisplayCell } from '../cell/DisplayCell';\nimport { Header as ColumnHeader } from '../header/Header';\nimport { Footer } from '../footer/Footer';\nimport { useLocalization } from '../../../../Provider/Localization';\nimport useTimer from '../../../../../utils/hooks/useTimer';\nimport { Icon } from '../../../../Icon/Icon';\nimport { Tooltip } from '../../../../Tooltip/Tooltip';\nimport { Dialog } from '../../../../Dialog/Dialog';\nimport { Group } from '../../../../Group/Group';\nimport { Button } from '../../../../Button/Button';\nimport { lastCellIndex } from '../../rows/Row';\nimport { getColumnIndex } from '../../../util/editing';\n\nexport type EditingActionsProps<TType = unknown> = CellContext<TType, unknown> & {\n className?: string;\n isHovered: boolean;\n};\n\nconst savingIndicatorHideDelay = 3000;\n\nexport const COLUMN_ID = '__editing_actions';\n\ntype MemoedCellProps<TType = unknown> = CellContext<TType, unknown> & {\n hasChanges: boolean;\n isActiveRow: boolean;\n editing: ReturnType<typeof useEditing>;\n rowIdentifier?: string;\n};\n\nconst MemoedCell = React.memo(function MemoedCell<TType = unknown>(props: MemoedCellProps<TType>) {\n const { hasChanges, isActiveRow, row, editing, rowIdentifier, table } = props;\n\n const savingStatus = editing.getSavingStatus(row.id);\n const [isSavedIndicatorVisible, setIsSavingIndicatorVisible] = React.useState(false);\n const { texts } = useLocalization();\n const [clearConfirmationOpen, setClearConfirmationOpen] = React.useState(false);\n const columns = table.getAllFlatColumns();\n const column = columns.find(column => column.id === rowIdentifier);\n const rowIdentifierHeader = column?.columnDef.meta?.header;\n const edititngActionsRef = React.useRef<HTMLButtonElement | HTMLAnchorElement>(null);\n const tableMeta = table.options.meta as TableMeta<TType>;\n\n const handleSaved = () => {\n setIsSavingIndicatorVisible(false);\n editing.resetSavingStatus(row.id);\n };\n const timer = useTimer(savingIndicatorHideDelay, handleSaved);\n\n React.useEffect(() => {\n if (savingStatus && savingStatus === SavingStatusValue.Saved && !isSavedIndicatorVisible) {\n setIsSavingIndicatorVisible(true);\n timer.start();\n }\n }, [savingStatus]);\n\n React.useEffect(() => {\n tableMeta.shortcutsState.pause(clearConfirmationOpen);\n }, [clearConfirmationOpen]);\n\n let content;\n\n if (savingStatus) {\n if (savingStatus === SavingStatusValue.Saving) {\n content = (\n <Tooltip title={texts.table3.editing.saving.progress}>\n <Spinner delay={0} className=\"!text-grey-700 mr-1 !h-5 !w-5\" />\n </Tooltip>\n );\n } else if (isSavedIndicatorVisible) {\n content = (\n <Tooltip title={texts.table3.editing.saving.complete}>\n <Icon name=\"tick\" className=\"!text-grey-700 mr-1 !h-5 !w-5\" />\n </Tooltip>\n );\n }\n }\n\n if (editing.isEditing && isActiveRow) {\n content = (\n <>\n {content}\n <IconButton\n ref={edititngActionsRef}\n appearance=\"transparent\"\n aria-label={texts.table3.editing.actions.tooltip}\n icon=\"more\"\n menu={menuProps => (\n <Menu {...menuProps}>\n <Menu.Content>\n <Menu.Item icon=\"tick\" disabled={!hasChanges} onClick={() => editing.saveChangesIfNeeded()}>\n {texts.table3.editing.actions.save}\n </Menu.Item>\n <Menu.Item icon=\"close\" disabled={!hasChanges} onClick={() => setClearConfirmationOpen(true)}>\n {texts.table3.editing.actions.clear}\n </Menu.Item>\n <Menu.Item icon=\"undo\" onClick={() => editing.toggleEditing(false)}>\n {texts.table3.editing.actions.exit}\n </Menu.Item>\n </Menu.Content>\n </Menu>\n )}\n tabIndex={isActiveRow ? 0 : -1}\n />\n <Dialog\n size=\"xs\"\n open={clearConfirmationOpen}\n onClose={() => {\n setClearConfirmationOpen(false);\n requestAnimationFrame(() => {\n if (edititngActionsRef.current) {\n edititngActionsRef.current.focus();\n // When table looses focus, we need to re-set the last column index\n lastCellIndex.value = getColumnIndex(edititngActionsRef.current);\n }\n });\n }}>\n <Dialog.Content aria-label={texts.table3.editing.clearChangesConfirmationDialog.title}>\n <Dialog.Title>{texts.table3.editing.clearChangesConfirmationDialog.title}</Dialog.Title>\n\n <p>\n {texts.table3.editing.clearChangesConfirmationDialog.description\n .replace(\n '[ROW_IDENTIFIER]',\n rowIdentifier && rowIdentifierHeader ? rowIdentifierHeader : texts.table3.validation.index\n )\n .replace(\n '[ROW_IDENTIFIER_VALUE]',\n rowIdentifier && rowIdentifierHeader ? row.original[rowIdentifier] : row.index\n )}\n </p>\n\n <Dialog.Footer>\n <Group>\n <Dialog.Close>\n <Button tabIndex={0}>{texts.table3.editing.clearChangesConfirmationDialog.cancel}</Button>\n </Dialog.Close>\n <Dialog.Close>\n <Button\n tabIndex={0}\n appearance=\"primary\"\n autoFocus\n onClick={() => editing.resetChange(row.id)}>\n {texts.table3.editing.clearChangesConfirmationDialog.confirm}\n </Button>\n </Dialog.Close>\n </Group>\n </Dialog.Footer>\n </Dialog.Content>\n </Dialog>\n </>\n );\n }\n\n const contentClassName = cn('flex items-center justify-end text-right', { '-mb-2 -mt-2': isActiveRow });\n return (\n <DisplayCell {...props} className={cn({ '!sticky': !!content })}>\n {content ? <span className={contentClassName}>{content}</span> : undefined}\n </DisplayCell>\n );\n}) as <TType = unknown>(props: MemoedCellProps<TType>) => JSX.Element;\n\ntype CellProps<TType = unknown> = CellContext<TType, unknown> & {\n rowIdentifier?: string;\n};\n\nfunction Cell<TType = unknown>(props: CellProps<TType>) {\n const { rowIndex } = React.useContext(RowContext);\n const tableMeta = props.table.options.meta as TableMeta<TType>;\n const changeset = tableMeta.editing.changes ? Object.keys(tableMeta.editing.changes) : [];\n\n return (\n <MemoedCell\n {...props}\n hasChanges={changeset.indexOf(props.row.id) >= 0}\n isActiveRow={tableMeta.rowActive.rowActiveIndex === rowIndex}\n editing={tableMeta.editing}\n />\n );\n}\n\nexport const EDITING_ACTIONS_WIDTH = 60;\n\nexport function createRowEditingActionsColumn<TType = unknown>(rowIdentifier?: string): DisplayColumnDef<TType, unknown> {\n return {\n id: COLUMN_ID,\n header: ColumnHeader,\n cell: (context: CellContext<TType, unknown>) => <Cell {...context} rowIdentifier={rowIdentifier} />,\n footer: Footer,\n meta: {\n align: 'right',\n className: cn(\n 'items-center print:opacity-0 [[role=\"table\"][data-editing=\"true\"]_&]:group-[[data-current=\"true\"]]/row:sticky right-0 !pl-0 !pr-1',\n '[[role=\"table\"][data-editing=\"true\"]_&]:group-[[data-current=\"true\"]]/row:shadow-[-6px_0px_6px_var(--table3-row-actions-shadow)]',\n 'group-[[data-current=\"true\"][data-selected=\"false\"]]/row:text-grey-200',\n 'group-[[data-selected=\"true\"]]/row:text-blue-100',\n 'group-[[data-selected=\"false\"]:hover]/row:text-grey-100'\n ),\n enableOrdering: false,\n enableSearch: false,\n enableTruncate: false,\n header: '',\n headerClassName: 'items-center !p-0',\n },\n // options\n enableResizing: false,\n size: EDITING_ACTIONS_WIDTH,\n minSize: EDITING_ACTIONS_WIDTH,\n };\n}\n"],"names":["savingIndicatorHideDelay","COLUMN_ID","MemoedCell","React","memo","props","hasChanges","isActiveRow","row","editing","rowIdentifier","table","savingStatus","getSavingStatus","id","isSavedIndicatorVisible","setIsSavingIndicatorVisible","useState","texts","useLocalization","clearConfirmationOpen","setClearConfirmationOpen","columns","getAllFlatColumns","column","find","rowIdentifierHeader","_column$columnDef$met","columnDef","meta","header","edititngActionsRef","useRef","tableMeta","options","handleSaved","resetSavingStatus","timer","useTimer","useEffect","SavingStatusValue","Saved","start","shortcutsState","pause","content","Saving","Tooltip","title","table3","saving","progress","Spinner","delay","className","complete","Icon","name","isEditing","IconButton","ref","appearance","actions","tooltip","icon","menu","menuProps","Menu","Content","Item","disabled","onClick","saveChangesIfNeeded","save","clear","toggleEditing","exit","tabIndex","Dialog","size","open","onClose","requestAnimationFrame","current","focus","lastCellIndex","value","getColumnIndex","clearChangesConfirmationDialog","Title","description","replace","validation","index","original","Footer","Group","Close","Button","cancel","autoFocus","resetChange","confirm","contentClassName","cn","DisplayCell","undefined","Cell","rowIndex","useContext","RowContext","changeset","changes","Object","keys","indexOf","rowActive","rowActiveIndex","EDITING_ACTIONS_WIDTH","createRowEditingActionsColumn","ColumnHeader","cell","context","footer","align","enableOrdering","enableSearch","enableT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package/dist/esm/packages/taco/src/components/Table3/components/columns/internal/Expansion.js
CHANGED
@@ -31,7 +31,7 @@ function Header(context) {
|
|
31
31
|
const MemoedCell = /*#__PURE__*/React__default.memo(function MemoedCell(props) {
|
32
32
|
const {
|
33
33
|
expandedRowRenderer,
|
34
|
-
|
34
|
+
isActiveRow,
|
35
35
|
isExpanded,
|
36
36
|
row,
|
37
37
|
table
|
@@ -48,7 +48,7 @@ const MemoedCell = /*#__PURE__*/React__default.memo(function MemoedCell(props) {
|
|
48
48
|
row.toggleExpanded();
|
49
49
|
};
|
50
50
|
const title = isExpanded ? texts.table3.columns.expansion.collapse : texts.table3.columns.expansion.expand;
|
51
|
-
const tabIndex =
|
51
|
+
const tabIndex = isActiveRow && !tableMeta.editing.isEditing ? 0 : -1;
|
52
52
|
content = /*#__PURE__*/React__default.createElement(Tooltip, {
|
53
53
|
title: title
|
54
54
|
}, /*#__PURE__*/React__default.createElement(IconButton, {
|
@@ -73,7 +73,7 @@ function Cell(props) {
|
|
73
73
|
const tableMeta = context.table.options.meta;
|
74
74
|
return /*#__PURE__*/React__default.createElement(MemoedCell, Object.assign({}, context, {
|
75
75
|
expandedRowRenderer: expandedRowRenderer,
|
76
|
-
|
76
|
+
isActiveRow: tableMeta.rowActive.rowActiveIndex === rowIndex,
|
77
77
|
isExpanded: context.row.getIsExpanded()
|
78
78
|
}));
|
79
79
|
}
|
package/dist/esm/packages/taco/src/components/Table3/components/columns/internal/Expansion.js.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"Expansion.js","sources":["../../../../../../../../../../src/components/Table3/components/columns/internal/Expansion.tsx"],"sourcesContent":["import React from 'react';\nimport { HeaderContext, CellContext, DisplayColumnDef, TableMeta } from '@tanstack/react-table';\nimport { Header as ColumnHeader } from '../header/Header';\nimport { DisplayCell } from '../cell/DisplayCell';\nimport { Tooltip } from '../../../../Tooltip/Tooltip';\nimport { IconButton } from '../../../../IconButton/IconButton';\nimport { useLocalization } from '../../../../Provider/Localization';\nimport { Table3RowExpansionRenderer } from '../../../types';\nimport { RowContext } from '../../rows/RowContext';\nimport { Footer } from '../footer/Footer';\n\nexport const COLUMN_ID = '__expansion';\n\nfunction Header<TType = unknown>(context: HeaderContext<TType, unknown>) {\n const { texts } = useLocalization();\n\n const isSomeRowsExpanded = context.table.getIsSomeRowsExpanded();\n const handleClick = event => {\n event.stopPropagation();\n context.table.toggleAllRowsExpanded(!isSomeRowsExpanded);\n };\n\n const title = isSomeRowsExpanded ? texts.table3.columns.expansion.collapseAll : texts.table3.columns.expansion.expandAll;\n\n return (\n <ColumnHeader {...context}>\n <Tooltip title={title}>\n <IconButton\n appearance=\"transparent\"\n icon={isSomeRowsExpanded ? 'chevron-down-double' : 'chevron-right-double'}\n onClick={handleClick}\n tabIndex={-1}\n title={title}\n />\n </Tooltip>\n </ColumnHeader>\n );\n}\n\ntype MemoedCellProps<TType = unknown> = CellContext<TType, unknown> & {\n expandedRowRenderer: Table3RowExpansionRenderer<TType>;\n
|
1
|
+
{"version":3,"file":"Expansion.js","sources":["../../../../../../../../../../src/components/Table3/components/columns/internal/Expansion.tsx"],"sourcesContent":["import React from 'react';\nimport { HeaderContext, CellContext, DisplayColumnDef, TableMeta } from '@tanstack/react-table';\nimport { Header as ColumnHeader } from '../header/Header';\nimport { DisplayCell } from '../cell/DisplayCell';\nimport { Tooltip } from '../../../../Tooltip/Tooltip';\nimport { IconButton } from '../../../../IconButton/IconButton';\nimport { useLocalization } from '../../../../Provider/Localization';\nimport { Table3RowExpansionRenderer } from '../../../types';\nimport { RowContext } from '../../rows/RowContext';\nimport { Footer } from '../footer/Footer';\n\nexport const COLUMN_ID = '__expansion';\n\nfunction Header<TType = unknown>(context: HeaderContext<TType, unknown>) {\n const { texts } = useLocalization();\n\n const isSomeRowsExpanded = context.table.getIsSomeRowsExpanded();\n const handleClick = event => {\n event.stopPropagation();\n context.table.toggleAllRowsExpanded(!isSomeRowsExpanded);\n };\n\n const title = isSomeRowsExpanded ? texts.table3.columns.expansion.collapseAll : texts.table3.columns.expansion.expandAll;\n\n return (\n <ColumnHeader {...context}>\n <Tooltip title={title}>\n <IconButton\n appearance=\"transparent\"\n icon={isSomeRowsExpanded ? 'chevron-down-double' : 'chevron-right-double'}\n onClick={handleClick}\n tabIndex={-1}\n title={title}\n />\n </Tooltip>\n </ColumnHeader>\n );\n}\n\ntype MemoedCellProps<TType = unknown> = CellContext<TType, unknown> & {\n expandedRowRenderer: Table3RowExpansionRenderer<TType>;\n isActiveRow: boolean;\n isExpanded: boolean;\n};\n\nconst MemoedCell = React.memo(function MemoedCell<TType = unknown>(props: MemoedCellProps<TType>) {\n const { expandedRowRenderer, isActiveRow, isExpanded, row, table } = props;\n const { texts } = useLocalization();\n const tableMeta = table.options.meta as TableMeta<TType>;\n\n const hasExpandedRow = expandedRowRenderer(row.original);\n\n let content;\n\n if (hasExpandedRow) {\n const handleClick = event => {\n event.stopPropagation();\n row.toggleExpanded();\n };\n const title = isExpanded ? texts.table3.columns.expansion.collapse : texts.table3.columns.expansion.expand;\n\n const tabIndex = isActiveRow && !tableMeta.editing.isEditing ? 0 : -1;\n\n content = (\n <Tooltip title={title}>\n <IconButton\n appearance=\"discrete\"\n className=\"-mt-1.5\"\n icon={isExpanded ? 'chevron-down' : 'chevron-right'}\n onClick={handleClick}\n tabIndex={tabIndex}\n title={title}\n />\n </Tooltip>\n );\n }\n\n return <DisplayCell {...props}>{content}</DisplayCell>;\n}) as <TType = unknown>(props: MemoedCellProps<TType>) => JSX.Element;\n\ntype CellProps<TType = unknown> = CellContext<TType, unknown> & {\n expandedRowRenderer: Table3RowExpansionRenderer<TType>;\n};\n\nfunction Cell<TType = unknown>(props: CellProps<TType>) {\n const { expandedRowRenderer, ...context } = props;\n const { rowIndex } = React.useContext(RowContext);\n const tableMeta = context.table.options.meta as TableMeta<TType>;\n\n return (\n <MemoedCell\n {...context}\n expandedRowRenderer={expandedRowRenderer}\n isActiveRow={tableMeta.rowActive.rowActiveIndex === rowIndex}\n isExpanded={context.row.getIsExpanded()}\n />\n );\n}\n\nexport function createRowExpansionColumn<TType = unknown>(\n expandedRowRenderer: Table3RowExpansionRenderer<TType>\n): DisplayColumnDef<TType, unknown> {\n return {\n id: COLUMN_ID,\n header: Header,\n cell: (context: CellContext<TType, unknown>) => <Cell {...context} expandedRowRenderer={expandedRowRenderer} />,\n footer: Footer,\n meta: {\n align: 'center',\n className: '!p-0 !pt-[var(--table3-cell-padding-y)]',\n enableOrdering: false,\n enableSearch: false,\n enableTruncate: false,\n header: '',\n headerClassName: 'items-center !p-0',\n },\n // options\n enableResizing: false,\n size: 40,\n };\n}\n"],"names":["COLUMN_ID","Header","context","texts","useLocalization","isSomeRowsExpanded","table","getIsSomeRowsExpanded","handleClick","event","stopPropagation","toggleAllRowsExpanded","title","table3","columns","expansion","collapseAll","expandAll","React","ColumnHeader","Tooltip","IconButton","appearance","icon","onClick","tabIndex","MemoedCell","memo","props","expandedRowRenderer","isActiveRow","isExpanded","row","tableMeta","options","meta","hasExpandedRow","original","content","toggleExpanded","collapse","expand","editing","isEditing","className","DisplayCell","Cell","rowIndex","useContext","RowContext","rowActive","rowActiveIndex","getIsExpanded","createRowExpansionColumn","id","header","cell","footer","Footer","align","enableOrdering","enableSearch","enableTruncate","headerClassName","enableResizing","size"],"mappings":";;;;;;;;;MAWaA,SAAS,GAAG;AAEzB,SAASC,MAAMA,CAAkBC,OAAsC;EACnE,MAAM;IAAEC;GAAO,GAAGC,eAAe,EAAE;EAEnC,MAAMC,kBAAkB,GAAGH,OAAO,CAACI,KAAK,CAACC,qBAAqB,EAAE;EAChE,MAAMC,WAAW,GAAGC,KAAK;IACrBA,KAAK,CAACC,eAAe,EAAE;IACvBR,OAAO,CAACI,KAAK,CAACK,qBAAqB,CAAC,CAACN,kBAAkB,CAAC;GAC3D;EAED,MAAMO,KAAK,GAAGP,kBAAkB,GAAGF,KAAK,CAACU,MAAM,CAACC,OAAO,CAACC,SAAS,CAACC,WAAW,GAAGb,KAAK,C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CHANGED
@@ -47,7 +47,7 @@ const Cell = /*#__PURE__*/React__default.memo(function MemoedCell(context) {
|
|
47
47
|
rowIndex
|
48
48
|
} = React__default.useContext(RowContext);
|
49
49
|
const tableMeta = context.table.options.meta;
|
50
|
-
const
|
50
|
+
const isActiveRow = tableMeta.rowActive.rowActiveIndex === rowIndex;
|
51
51
|
const isSelected = context.row.getIsSelected();
|
52
52
|
const title = isSelected ? texts.table3.columns.select.deselect : texts.table3.columns.select.select;
|
53
53
|
if (context.table.options.enableMultiRowSelection) {
|
@@ -74,7 +74,7 @@ const Cell = /*#__PURE__*/React__default.memo(function MemoedCell(context) {
|
|
74
74
|
onClick: handleClick,
|
75
75
|
// this is necessary to remove console spam from eslint
|
76
76
|
onChange: () => false,
|
77
|
-
tabIndex:
|
77
|
+
tabIndex: isActiveRow ? 0 : -1
|
78
78
|
})));
|
79
79
|
} else {
|
80
80
|
const className = cn('!mt-0', getRadioClassnames());
|
@@ -100,7 +100,7 @@ const Cell = /*#__PURE__*/React__default.memo(function MemoedCell(context) {
|
|
100
100
|
// we memo because we don't want the row re-rendering and removing focus from the checkbox
|
101
101
|
// we can't default to the standard comparison because we need currentRow off the table meta
|
102
102
|
// and we don't really care about re-rendering in any other scenario
|
103
|
-
return newTableMeta.
|
103
|
+
return newTableMeta.rowActive.rowActiveIndex === oldTableMeta.rowActive.rowActiveIndex && newProps.row.getIsSelected() !== oldProps.row.getIsSelected();
|
104
104
|
});
|
105
105
|
function createRowSelectionColumn(hasDrag, hasExpansion) {
|
106
106
|
const size = hasDrag && hasExpansion ? 22 : 40;
|
package/dist/esm/packages/taco/src/components/Table3/components/columns/internal/Selection.js.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"Selection.js","sources":["../../../../../../../../../../src/components/Table3/components/columns/internal/Selection.tsx"],"sourcesContent":["import React from 'react';\nimport { HeaderContext, CellContext, DisplayColumnDef, TableMeta } from '@tanstack/react-table';\nimport cn from 'classnames';\nimport { Checkbox } from '../../../../Checkbox/Checkbox';\nimport { Header as ColumnHeader } from '../header/Header';\nimport { DisplayCell } from '../cell/DisplayCell';\nimport { Tooltip } from '../../../../Tooltip/Tooltip';\nimport { useLocalization } from '../../../../Provider/Localization';\nimport { RowContext } from '../../rows/RowContext';\nimport { Footer } from '../footer/Footer';\nimport { getRadioClassnames } from '../../../../RadioGroup/util';\nimport { Shortcut } from '../../../../Shortcut/Shortcut';\n\nexport const COLUMN_ID = '__select';\n\nfunction Header<TType = unknown>(context: HeaderContext<TType, unknown>) {\n const { texts } = useLocalization();\n\n if (context.table.options.enableMultiRowSelection) {\n const isAllRowsSelected = context.table.getIsAllRowsSelected();\n const isSomeRowsSelected = context.table.getIsSomeRowsSelected();\n const title = isAllRowsSelected ? texts.table3.columns.select.deselectAll : texts.table3.columns.select.selectAll;\n\n return (\n <ColumnHeader {...context}>\n <Tooltip title={title}>\n <Checkbox\n aria-label={title}\n className=\"hover:border-blue !mt-0\"\n key={String(`${isAllRowsSelected}_${isSomeRowsSelected}`)}\n checked={isAllRowsSelected}\n indeterminate={isSomeRowsSelected}\n onChange={context.table.toggleAllRowsSelected}\n tabIndex={-1}\n />\n </Tooltip>\n </ColumnHeader>\n );\n } else {\n return <ColumnHeader {...context}></ColumnHeader>;\n }\n}\n\nconst toggleBetween = (fromRowIndex: number, toRowIndex: number): [number, number] => {\n const fromIndex = toRowIndex < fromRowIndex ? toRowIndex : fromRowIndex;\n const toIndex = toRowIndex > fromRowIndex ? toRowIndex : fromRowIndex;\n\n return [fromIndex, toIndex];\n};\n\nconst Cell = React.memo(\n function MemoedCell<TType = unknown>(context: CellContext<TType, unknown>) {\n const { texts } = useLocalization();\n const { rowIndex } = React.useContext(RowContext);\n const tableMeta = context.table.options.meta as TableMeta<TType>;\n\n const isCurrentRow = tableMeta.currentRow.currentRowIndex === rowIndex;\n const isSelected = context.row.getIsSelected();\n const title = isSelected ? texts.table3.columns.select.deselect : texts.table3.columns.select.select;\n\n if (context.table.options.enableMultiRowSelection) {\n const handleClick = (event: React.MouseEvent): void => {\n event.stopPropagation();\n\n if (event.shiftKey) {\n const [fromIndex, toIndex] = toggleBetween(\n tableMeta.rowSelection.lastSelectedRowIndex.current ?? 0,\n rowIndex\n );\n\n context.table\n .getRowModel()\n .rows.slice(fromIndex, toIndex + 1)\n .forEach(row => row.toggleSelected(true));\n } else {\n context.row.toggleSelected();\n }\n\n tableMeta.rowSelection.lastSelectedRowIndex.current = rowIndex;\n };\n\n return (\n <DisplayCell {...context}>\n <Tooltip\n title={\n <>\n {title}\n <Shortcut className=\"ml-2\" keys=\"Space\" />\n </>\n }>\n <Checkbox\n aria-label={title}\n className=\"!mt-0\"\n checked={isSelected}\n onClick={handleClick}\n // this is necessary to remove console spam from eslint\n onChange={() => false}\n tabIndex={isCurrentRow ? 0 : -1}\n />\n </Tooltip>\n </DisplayCell>\n );\n } else {\n const className = cn('!mt-0', getRadioClassnames());\n\n const handleClick = (event: React.MouseEvent): void => {\n event.stopPropagation();\n context.row.toggleSelected();\n tableMeta.rowSelection.lastSelectedRowIndex.current = rowIndex;\n };\n\n return (\n <DisplayCell {...context}>\n <button\n className={className}\n aria-checked={isSelected}\n onClick={handleClick}\n role=\"radio\"\n tabIndex={-1}\n type=\"button\">\n {isSelected ? <span className=\"h-2 w-2 rounded-full bg-white\" /> : null}\n </button>\n </DisplayCell>\n );\n }\n },\n function arePropsEqual(oldProps: CellContext<unknown, unknown>, newProps: CellContext<unknown, unknown>) {\n const oldTableMeta = oldProps.table.options.meta as TableMeta<unknown>;\n const newTableMeta = newProps.table.options.meta as TableMeta<unknown>;\n\n // we memo because we don't want the row re-rendering and removing focus from the checkbox\n // we can't default to the standard comparison because we need currentRow off the table meta\n // and we don't really care about re-rendering in any other scenario\n return (\n newTableMeta.currentRow.currentRowIndex === oldTableMeta.currentRow.currentRowIndex &&\n newProps.row.getIsSelected() !== oldProps.row.getIsSelected()\n );\n }\n) as <TType = unknown>(context: CellContext<TType, unknown>) => JSX.Element;\n\nexport function createRowSelectionColumn<TType = unknown>(\n hasDrag: boolean,\n hasExpansion: boolean\n): DisplayColumnDef<TType, unknown> {\n const size = hasDrag && hasExpansion ? 22 : 40;\n\n return {\n id: COLUMN_ID,\n header: Header,\n cell: Cell,\n footer: Footer,\n meta: {\n align: 'center',\n className: cn('!pt-[var(--table3-cell-padding-y)] !justify-end !p-0', {\n '!pr-0.5': hasExpansion,\n '!pr-3': !hasExpansion,\n }),\n enableOrdering: false,\n enableSearch: false,\n enableTruncate: false,\n header: '',\n headerClassName: cn('items-center !justify-end !p-0', { '!pr-0.5': hasExpansion, '!pr-3': !hasExpansion }),\n },\n // options\n enableResizing: false,\n size,\n minSize: size,\n };\n}\n"],"names":["COLUMN_ID","Header","context","texts","useLocalization","table","options","enableMultiRowSelection","isAllRowsSelected","getIsAllRowsSelected","isSomeRowsSelected","getIsSomeRowsSelected","title","table3","columns","select","deselectAll","selectAll","React","ColumnHeader","Tooltip","Checkbox","className","key","String","checked","indeterminate","onChange","toggleAllRowsSelected","tabIndex","toggleBetween","fromRowIndex","toRowIndex","fromIndex","toIndex","Cell","memo","MemoedCell","rowIndex","useContext","RowContext","tableMeta","meta","isCurrentRow","currentRow","currentRowIndex","isSelected","row","getIsSelected","deselect","handleClick","event","stopPropagation","shiftKey","_tableMeta$rowSelecti","rowSelection","lastSelectedRowIndex","current","getRowModel","rows","slice","forEach","toggleSelected","DisplayCell","Shortcut","keys","onClick","cn","getRadioClassnames","role","type","arePropsEqual","oldProps","newProps","oldTableMeta","newTableMeta","createRowSelectionColumn","hasDrag","hasExpansion","size","id","header","cell","footer","Footer","align","enableOrdering","enableSearch","enableTruncate","headerClassName","enableResizing","minSize"],"mappings":";;;;;;;;;;;;MAaaA,SAAS,GAAG;AAEzB,SAASC,MAAMA,CAAkBC,OAAsC;EACnE,MAAM;IAAEC;GAAO,GAAGC,eAAe,EAAE;EAEnC,IAAIF,OAAO,CAACG,KAAK,CAACC,OAAO,CAACC,uBAAuB,EAAE;IAC/C,MAA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F,OAAO,IAAIC,YAAY,GAAG,EAAE,GAAG,EAAE;EAE9C,OAAO;IACHE,EAAE,EAAEhF,SAAS;IACbiF,MAAM,EAAEhF,MAAM;IACdiF,IAAI,EAAE/C,IAAI;IACVgD,MAAM,EAAEC,MAAM;IACd1C,IAAI,EAAE;MACF2C,KAAK,EAAE,QAAQ;MACf/D,SAAS,EAAE6C,EAAE,CAAC,sDAAsD,EAAE;QAClE,SAAS,EAAEW,YAAY;QACvB,OAAO,EAAE,CAACA;OACb,CAAC;MACFQ,cAAc,EAAE,KAAK;MACrBC,YAAY,EAAE,KAAK;MACnBC,cAAc,EAAE,KAAK;MACrBP,MAAM,EAAE,EAAE;MACVQ,eAAe,EAAEtB,EAAE,CAAC,gCAAgC,EAAE;QAAE,SAAS,EAAEW,YAAY;QAAE,OAAO,EAAE,CAACA;OAAc;KAC5G;;IAEDY,cAAc,EAAE,KAAK;IACrBX,IAAI;IACJY,OAAO,EAAEZ;GACZ;AACL;;;;"}
|
1
|
+
{"version":3,"file":"Selection.js","sources":["../../../../../../../../../../src/components/Table3/components/columns/internal/Selection.tsx"],"sourcesContent":["import React from 'react';\nimport { HeaderContext, CellContext, DisplayColumnDef, TableMeta } from '@tanstack/react-table';\nimport cn from 'classnames';\nimport { Checkbox } from '../../../../Checkbox/Checkbox';\nimport { Header as ColumnHeader } from '../header/Header';\nimport { DisplayCell } from '../cell/DisplayCell';\nimport { Tooltip } from '../../../../Tooltip/Tooltip';\nimport { useLocalization } from '../../../../Provider/Localization';\nimport { RowContext } from '../../rows/RowContext';\nimport { Footer } from '../footer/Footer';\nimport { getRadioClassnames } from '../../../../RadioGroup/util';\nimport { Shortcut } from '../../../../Shortcut/Shortcut';\n\nexport const COLUMN_ID = '__select';\n\nfunction Header<TType = unknown>(context: HeaderContext<TType, unknown>) {\n const { texts } = useLocalization();\n\n if (context.table.options.enableMultiRowSelection) {\n const isAllRowsSelected = context.table.getIsAllRowsSelected();\n const isSomeRowsSelected = context.table.getIsSomeRowsSelected();\n const title = isAllRowsSelected ? texts.table3.columns.select.deselectAll : texts.table3.columns.select.selectAll;\n\n return (\n <ColumnHeader {...context}>\n <Tooltip title={title}>\n <Checkbox\n aria-label={title}\n className=\"hover:border-blue !mt-0\"\n key={String(`${isAllRowsSelected}_${isSomeRowsSelected}`)}\n checked={isAllRowsSelected}\n indeterminate={isSomeRowsSelected}\n onChange={context.table.toggleAllRowsSelected}\n tabIndex={-1}\n />\n </Tooltip>\n </ColumnHeader>\n );\n } else {\n return <ColumnHeader {...context}></ColumnHeader>;\n }\n}\n\nconst toggleBetween = (fromRowIndex: number, toRowIndex: number): [number, number] => {\n const fromIndex = toRowIndex < fromRowIndex ? toRowIndex : fromRowIndex;\n const toIndex = toRowIndex > fromRowIndex ? toRowIndex : fromRowIndex;\n\n return [fromIndex, toIndex];\n};\n\nconst Cell = React.memo(\n function MemoedCell<TType = unknown>(context: CellContext<TType, unknown>) {\n const { texts } = useLocalization();\n const { rowIndex } = React.useContext(RowContext);\n const tableMeta = context.table.options.meta as TableMeta<TType>;\n\n const isActiveRow = tableMeta.rowActive.rowActiveIndex === rowIndex;\n const isSelected = context.row.getIsSelected();\n const title = isSelected ? texts.table3.columns.select.deselect : texts.table3.columns.select.select;\n\n if (context.table.options.enableMultiRowSelection) {\n const handleClick = (event: React.MouseEvent): void => {\n event.stopPropagation();\n\n if (event.shiftKey) {\n const [fromIndex, toIndex] = toggleBetween(\n tableMeta.rowSelection.lastSelectedRowIndex.current ?? 0,\n rowIndex\n );\n\n context.table\n .getRowModel()\n .rows.slice(fromIndex, toIndex + 1)\n .forEach(row => row.toggleSelected(true));\n } else {\n context.row.toggleSelected();\n }\n\n tableMeta.rowSelection.lastSelectedRowIndex.current = rowIndex;\n };\n\n return (\n <DisplayCell {...context}>\n <Tooltip\n title={\n <>\n {title}\n <Shortcut className=\"ml-2\" keys=\"Space\" />\n </>\n }>\n <Checkbox\n aria-label={title}\n className=\"!mt-0\"\n checked={isSelected}\n onClick={handleClick}\n // this is necessary to remove console spam from eslint\n onChange={() => false}\n tabIndex={isActiveRow ? 0 : -1}\n />\n </Tooltip>\n </DisplayCell>\n );\n } else {\n const className = cn('!mt-0', getRadioClassnames());\n\n const handleClick = (event: React.MouseEvent): void => {\n event.stopPropagation();\n context.row.toggleSelected();\n tableMeta.rowSelection.lastSelectedRowIndex.current = rowIndex;\n };\n\n return (\n <DisplayCell {...context}>\n <button\n className={className}\n aria-checked={isSelected}\n onClick={handleClick}\n role=\"radio\"\n tabIndex={-1}\n type=\"button\">\n {isSelected ? <span className=\"h-2 w-2 rounded-full bg-white\" /> : null}\n </button>\n </DisplayCell>\n );\n }\n },\n function arePropsEqual(oldProps: CellContext<unknown, unknown>, newProps: CellContext<unknown, unknown>) {\n const oldTableMeta = oldProps.table.options.meta as TableMeta<unknown>;\n const newTableMeta = newProps.table.options.meta as TableMeta<unknown>;\n\n // we memo because we don't want the row re-rendering and removing focus from the checkbox\n // we can't default to the standard comparison because we need currentRow off the table meta\n // and we don't really care about re-rendering in any other scenario\n return (\n newTableMeta.rowActive.rowActiveIndex === oldTableMeta.rowActive.rowActiveIndex &&\n newProps.row.getIsSelected() !== oldProps.row.getIsSelected()\n );\n }\n) as <TType = unknown>(context: CellContext<TType, unknown>) => JSX.Element;\n\nexport function createRowSelectionColumn<TType = unknown>(\n hasDrag: boolean,\n hasExpansion: boolean\n): DisplayColumnDef<TType, unknown> {\n const size = hasDrag && hasExpansion ? 22 : 40;\n\n return {\n id: COLUMN_ID,\n header: Header,\n cell: Cell,\n footer: Footer,\n meta: {\n align: 'center',\n className: cn('!pt-[var(--table3-cell-padding-y)] !justify-end !p-0', {\n '!pr-0.5': hasExpansion,\n '!pr-3': !hasExpansion,\n }),\n enableOrdering: false,\n enableSearch: false,\n enableTruncate: false,\n header: '',\n headerClassName: cn('items-center !justify-end !p-0', { '!pr-0.5': hasExpansion, '!pr-3': !hasExpansion }),\n },\n // options\n enableResizing: false,\n size,\n minSize: size,\n };\n}\n"],"names":["COLUMN_ID","Header","context","texts","useLocalization","table","options","enableMultiRowSelection","isAllRowsSelected","getIsAllRowsSelected","isSomeRowsSelected","getIsSomeRowsSelected","title","table3","columns","select","deselectAll","selectAll","React","ColumnHeader","Tooltip","Checkbox","className","key","String","checked","indeterminate","onChange","toggleAllRowsSelected","tabIndex","toggleBetween","fromRowIndex","toRowIndex","fromIndex","toIndex","Cell","memo","MemoedCell","rowIndex","useContext","RowContext","tableMeta","meta","isActiveRow","rowActive","rowActiveIndex","isSelected","row","getIsSelected","deselect","handleClick","event","stopPropagation","shiftKey","_tableMeta$rowSelecti","rowSelection","lastSelectedRowIndex","current","getRowModel","rows","slice","forEach","toggleSelected","DisplayCell","Shortcut","keys","onClick","cn","getRadioClassnames","role","type","arePropsEqual","oldProps","newProps","oldTableMeta","newTableMeta","createRowSelectionColumn","hasDrag","hasExpansion","size","id","header","cell","footer","Footer","align","enableOrdering","enableSearch","enableTruncate","headerClassName","enableResizing","minSize"],"mappings":";;;;;;;;;;;;MAaaA,SAAS,GAAG;AAEzB,SAASC,MAAMA,CAAkBC,OAAsC;EACnE,MAAM;IAAEC;GAAO,GAAGC,eAAe,EAAE;EAEnC,IAAIF,OAAO,CAACG,KAAK,CAACC,OAAO,CAACC,uBAAuB,EAAE;IAC/C,MAAMC,iBAAiB,GAAGN,OAAO,CAACG,KAAK,CAACI,oBAAoB,EAAE;IAC9D,MAAMC,kBAAkB,GAAGR,OAAO,CAACG,KAAK,CAACM,qBAAqB,EAAE;IAChE,MAAMC,KAAK,GAAGJ,iBAAiB,GAAGL,KAAK,CAACU,MAAM,CAACC,OAAO,CAACC,MAAM,CAACC,WAAW,GAAGb,KAAK,CAACU,MAAM,CAACC,OAAO,CAACC,MAAM,CAACE,SAAS;IAEjH,oBACIC,6BAACC,QAAY,oBAAKjB,OAAO,gBACrBgB,6BAACE,OAAO;MAACR,KAAK,EAAEA;oBACZM,6BAACG,QAAQ;oBACOT,KAAK;MACjBU,SAAS,EAAC,yBAAyB;MACnCC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AAEtB,EAAE,CAAC,gCAAgC,EAAE;QAAE,SAAS,EAAEW,YAAY;QAAE,OAAO,EAAE,CAACA;OAAc;KAC5G;;IAEDY,cAAc,EAAE,KAAK;IACrBX,IAAI;IACJY,OAAO,EAAEZ;GACZ;AACL;;;;"}
|
@@ -1,5 +1,5 @@
|
|
1
1
|
import cn from 'classnames';
|
2
|
-
import {
|
2
|
+
import { getCellMinWidth } from '../../../../primitives/Table/useTable/util/columns.js';
|
3
3
|
|
4
4
|
const PRINT_MIN_COLUMN_SIZE = 20; // while printing, it accounts for minimum width each column can take
|
5
5
|
const getCellAlignmentClasses = (alignment = 'left') => {
|
@@ -9,18 +9,7 @@ const getCellAlignmentClasses = (alignment = 'left') => {
|
|
9
9
|
'justify-center text-center': alignment === 'center'
|
10
10
|
});
|
11
11
|
};
|
12
|
-
const getFontBasedMinColumnSize =
|
13
|
-
// The minimum column size are based on the minimum usuable width of Datepicker
|
14
|
-
switch (fontSize) {
|
15
|
-
case FONT_SIZE.small:
|
16
|
-
return 57;
|
17
|
-
case FONT_SIZE.large:
|
18
|
-
return 83;
|
19
|
-
default:
|
20
|
-
case FONT_SIZE.medium:
|
21
|
-
return 72;
|
22
|
-
}
|
23
|
-
};
|
12
|
+
const getFontBasedMinColumnSize = getCellMinWidth;
|
24
13
|
// Hiding input number spin buttons
|
25
14
|
const getInputAppearanceClassnames = () => {
|
26
15
|
return cn('[appearance:textfield] [&::-webkit-outer-spin-button]:appearance-none [&::-webkit-inner-spin-button]:appearance-none');
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"styles.js","sources":["../../../../../../../../../src/components/Table3/components/columns/styles.ts"],"sourcesContent":["import cn from 'classnames';\nimport { Table3ColumnAlignment
|
1
|
+
{"version":3,"file":"styles.js","sources":["../../../../../../../../../src/components/Table3/components/columns/styles.ts"],"sourcesContent":["import cn from 'classnames';\nimport { Table3ColumnAlignment } from '../../types';\nimport { getCellMinWidth } from '../../../../primitives/Table/useTable/util/columns';\n\nexport const PRINT_MIN_COLUMN_SIZE = 20; // while printing, it accounts for minimum width each column can take\n\nexport const getCellAlignmentClasses = (alignment: Table3ColumnAlignment = 'left') => {\n return cn({\n 'justify-start text-left': alignment === 'left',\n 'justify-end text-right': alignment === 'right',\n 'justify-center text-center': alignment === 'center',\n });\n};\n\nexport const getFontBasedMinColumnSize = getCellMinWidth;\n\n// Hiding input number spin buttons\nexport const getInputAppearanceClassnames = () => {\n return cn(\n '[appearance:textfield] [&::-webkit-outer-spin-button]:appearance-none [&::-webkit-inner-spin-button]:appearance-none'\n );\n};\n"],"names":["PRINT_MIN_COLUMN_SIZE","getCellAlignmentClasses","alignment","cn","getFontBasedMinColumnSize","getCellMinWidth","getInputAppearanceClassnames"],"mappings":";;;MAIaA,qBAAqB,GAAG,GAAG;MAE3BC,uBAAuB,GAAGA,CAACC,YAAmC,MAAM;EAC7E,OAAOC,EAAE,CAAC;IACN,yBAAyB,EAAED,SAAS,KAAK,MAAM;IAC/C,wBAAwB,EAAEA,SAAS,KAAK,OAAO;IAC/C,4BAA4B,EAAEA,SAAS,KAAK;GAC/C,CAAC;AACN;MAEaE,yBAAyB,GAAGC;AAEzC;MACaC,4BAA4B,GAAGA;EACxC,OAAOH,EAAE,CACL,sHAAsH,CACzH;AACL;;;;"}
|
@@ -14,7 +14,7 @@ function Row(props) {
|
|
14
14
|
var _tableMeta$validation, _tableMeta$validation2;
|
15
15
|
const focusManager = useFocusManager();
|
16
16
|
const tableMeta = props.table.options.meta;
|
17
|
-
const
|
17
|
+
const isActiveRow = tableMeta.rowActive.rowActiveIndex === props.index;
|
18
18
|
const isDraggingRow = tableMeta.rowDrag.dragging[props.row.id];
|
19
19
|
const isFirstRow = props.index === 0;
|
20
20
|
// we use non-css hovered state to determine whether to render actions or not, for performance
|
@@ -25,7 +25,7 @@ function Row(props) {
|
|
25
25
|
return;
|
26
26
|
}
|
27
27
|
if (event.key === 'Tab') {
|
28
|
-
tableMeta.
|
28
|
+
tableMeta.rowActive.setHoverStatePaused(true);
|
29
29
|
let focusedElement;
|
30
30
|
if (event.shiftKey) {
|
31
31
|
// looping backwards
|
@@ -37,7 +37,7 @@ function Row(props) {
|
|
37
37
|
// there are no previous elements to focus, go up a row or go outside the table
|
38
38
|
if (!isFirstRow) {
|
39
39
|
event.preventDefault();
|
40
|
-
tableMeta.
|
40
|
+
tableMeta.rowActive.setRowActiveIndex(props.index - 1);
|
41
41
|
setTimeout(() => focusManager.focusLast(FOCUS_MANAGER_OPTIONS), 1);
|
42
42
|
}
|
43
43
|
}
|
@@ -51,7 +51,7 @@ function Row(props) {
|
|
51
51
|
// there are no next elements to focus, go down a row or go outside the table
|
52
52
|
if (!props.isLastRow) {
|
53
53
|
event.preventDefault();
|
54
|
-
tableMeta.
|
54
|
+
tableMeta.rowActive.setRowActiveIndex(props.index + 1);
|
55
55
|
setTimeout(() => focusManager.focusFirst(FOCUS_MANAGER_OPTIONS), 1);
|
56
56
|
}
|
57
57
|
}
|
@@ -62,22 +62,24 @@ function Row(props) {
|
|
62
62
|
// rows are heavily memoized because performance in our table is critical
|
63
63
|
// be careful and selective about props that you pass to the row
|
64
64
|
const memoedProps = {
|
65
|
+
data: props.row.original,
|
65
66
|
// aria-grabbed is being deprecated but there is no current alternative api, we use it until there is
|
66
67
|
'aria-grabbed': isDraggingRow ? true : tableMeta.rowDrag.isEnabled ? false : undefined,
|
67
|
-
'data-current':
|
68
|
+
'data-current': isActiveRow,
|
68
69
|
'data-selected': props.row.getIsSelected(),
|
69
70
|
'data-invalid': hasError,
|
70
71
|
draggable: tableMeta.rowDrag.isEnabled,
|
71
72
|
index: props.index,
|
72
73
|
onClick: tableMeta.rowClick.handleClick,
|
73
|
-
onDrop: tableMeta.rowDrop.isEnabled ? tableMeta.rowDrop.handleDrop : undefined
|
74
|
-
onKeyDown: handleKeyDown
|
74
|
+
onDrop: tableMeta.rowDrop.isEnabled ? tableMeta.rowDrop.handleDrop : undefined
|
75
75
|
};
|
76
|
-
let output = /*#__PURE__*/React__default.createElement(MemoedRow, Object.assign({}, props, memoedProps
|
77
|
-
|
76
|
+
let output = /*#__PURE__*/React__default.createElement(MemoedRow, Object.assign({}, props, memoedProps, {
|
77
|
+
onKeyDown: handleKeyDown
|
78
|
+
}));
|
79
|
+
if (tableMeta.editing.isEditing && (isActiveRow || isHovered && !tableMeta.rowActive.isHoverStatePaused)) {
|
78
80
|
output = /*#__PURE__*/React__default.createElement(EditingRow, Object.assign({}, props, memoedProps, {
|
79
81
|
isFirstRow: isFirstRow,
|
80
|
-
|
82
|
+
setActiveRowIndex: tableMeta.rowActive.setRowActiveIndex
|
81
83
|
}));
|
82
84
|
}
|
83
85
|
// we store the row index in context because in a virtualised table the row index and the
|
@@ -113,7 +115,7 @@ function EditingRow(props) {
|
|
113
115
|
isFirstRow,
|
114
116
|
isLastRow,
|
115
117
|
onKeyDown,
|
116
|
-
|
118
|
+
setActiveRowIndex,
|
117
119
|
virtualiser,
|
118
120
|
...attributes
|
119
121
|
} = props;
|
@@ -122,14 +124,14 @@ function EditingRow(props) {
|
|
122
124
|
const handleClickCapture = event => {
|
123
125
|
lastCellIndex.value = getColumnIndex(event.target);
|
124
126
|
};
|
125
|
-
const
|
127
|
+
const handleNavigationBackwards = event => {
|
126
128
|
let focusedElement;
|
127
|
-
if (event.key === 'ArrowLeft') {
|
129
|
+
if (event.key === 'ArrowLeft' || event.key === 'Tab' && event.shiftKey) {
|
128
130
|
// We need to perform special behaviour when focus reaches the end of the row,
|
129
131
|
// so we don't need default browser behaviour.
|
130
132
|
event.stopPropagation();
|
131
133
|
event.preventDefault();
|
132
|
-
tableMeta.
|
134
|
+
tableMeta.rowActive.setHoverStatePaused(true);
|
133
135
|
// "CTRL + ArrowLeft" or "META + ArrowLeft" should focus first focusable element of the row
|
134
136
|
if (event.ctrlKey || event.metaKey) {
|
135
137
|
event.target.blur();
|
@@ -144,8 +146,8 @@ function EditingRow(props) {
|
|
144
146
|
// there are no previous elements to focus, go up a row (if there are rows above)
|
145
147
|
if (!isFirstRow || !event.currentTarget.contains(focusedElement)) {
|
146
148
|
event.preventDefault();
|
147
|
-
tableMeta.
|
148
|
-
tableMeta.
|
149
|
+
tableMeta.rowActive.setHoverStatePaused(true);
|
150
|
+
tableMeta.rowActive.setRowActiveIndex(props.index - 1);
|
149
151
|
setTimeout(() => {
|
150
152
|
focusedElement = focusManager.focusLast(FOCUS_MANAGER_OPTIONS);
|
151
153
|
// Need to update lastIndex when row got changed and last element got selected.
|
@@ -156,14 +158,14 @@ function EditingRow(props) {
|
|
156
158
|
}
|
157
159
|
}
|
158
160
|
};
|
159
|
-
const
|
161
|
+
const handleNavigationForward = event => {
|
160
162
|
let focusedElement;
|
161
|
-
if (event.key === 'ArrowRight') {
|
163
|
+
if (event.key === 'ArrowRight' || event.key === 'Tab' && !event.shiftKey) {
|
162
164
|
// We need to perform special behaviour when focus reaches the end of the row,
|
163
165
|
// so we don't need default browser behaviour.
|
164
166
|
event.stopPropagation();
|
165
167
|
event.preventDefault();
|
166
|
-
tableMeta.
|
168
|
+
tableMeta.rowActive.setHoverStatePaused(true);
|
167
169
|
// "CTRL + ArrowRight" or "META + ArrowRight" should focus last focusable element of the row
|
168
170
|
if (event.ctrlKey || event.metaKey) {
|
169
171
|
event.target.blur();
|
@@ -178,8 +180,8 @@ function EditingRow(props) {
|
|
178
180
|
// there are no next elements to focus, go down a row or go outside the table
|
179
181
|
if (!props.isLastRow && !event.currentTarget.contains(focusedElement)) {
|
180
182
|
event.preventDefault();
|
181
|
-
tableMeta.
|
182
|
-
tableMeta.
|
183
|
+
tableMeta.rowActive.setHoverStatePaused(true);
|
184
|
+
tableMeta.rowActive.setRowActiveIndex(props.index + 1);
|
183
185
|
setTimeout(() => {
|
184
186
|
focusedElement = focusManager.focusFirst(FOCUS_MANAGER_OPTIONS);
|
185
187
|
// Need to update lastIndex when row got changed and last element got selected.
|
@@ -192,22 +194,21 @@ function EditingRow(props) {
|
|
192
194
|
};
|
193
195
|
React__default.useEffect(() => {
|
194
196
|
// if some row stuck in hovered state, we heed to unhover it when hover state is paused
|
195
|
-
if (tableMeta.
|
197
|
+
if (tableMeta.rowActive.isHoverStatePaused) {
|
196
198
|
unhoverPreviousRow(props.tableRef);
|
197
199
|
}
|
198
|
-
}, [tableMeta.
|
200
|
+
}, [tableMeta.rowActive.isHoverStatePaused]);
|
199
201
|
const handleKeyDown = event => {
|
200
202
|
if (event.isDefaultPrevented() || event.isPropagationStopped() || tableMeta.editing.detailModeEditing || tableMeta.shortcutsState.isPaused) {
|
201
203
|
return;
|
202
204
|
}
|
203
|
-
|
204
|
-
|
205
|
-
handleArrowRightKey(event);
|
205
|
+
handleNavigationBackwards(event);
|
206
|
+
handleNavigationForward(event);
|
206
207
|
};
|
207
208
|
// this ensures we focus either on a field or on the same column when keyboard navigating up/down
|
208
209
|
React__default.useEffect(() => {
|
209
210
|
// When table in searching state, whe should prevent editing control to be focused, because it will cause search field to loose focus.
|
210
|
-
if (tableMeta.
|
211
|
+
if (tableMeta.rowActive.rowActiveIndex === props.index && !tableMeta.search.isSearching) {
|
211
212
|
if (lastCellIndex.value !== null) {
|
212
213
|
var _props$tableRef$curre;
|
213
214
|
const lastCellElement = (_props$tableRef$curre = props.tableRef.current) === null || _props$tableRef$curre === void 0 ? void 0 : _props$tableRef$curre.querySelector(`[role="row"][data-current="true"] [data-column-index="${lastCellIndex.value}"]`);
|
@@ -227,7 +228,7 @@ function EditingRow(props) {
|
|
227
228
|
// Need to subscribe to current row index and check is it a current row,
|
228
229
|
// for a situation where hovered row is the next row after current row...
|
229
230
|
// In this case row will not be re-rendered if user switch to next row, because hovered row also renders EditingRow.
|
230
|
-
}, [tableMeta.
|
231
|
+
}, [tableMeta.rowActive.rowActiveIndex, tableMeta.search.isSearching]);
|
231
232
|
return /*#__PURE__*/React__default.createElement(MemoedRow, Object.assign({}, attributes, {
|
232
233
|
onClickCapture: handleClickCapture,
|
233
234
|
onKeyDown: handleKeyDown
|
@@ -236,6 +237,7 @@ function EditingRow(props) {
|
|
236
237
|
const clickableElements = ['input', 'button', 'a', 'select', 'option', 'label', 'textarea'];
|
237
238
|
const MemoedRow = /*#__PURE__*/React__default.memo(function MemoedRow(props) {
|
238
239
|
const {
|
240
|
+
data,
|
239
241
|
index,
|
240
242
|
isLastRow: _1,
|
241
243
|
measureRef,
|
@@ -266,7 +268,7 @@ const MemoedRow = /*#__PURE__*/React__default.memo(function MemoedRow(props) {
|
|
266
268
|
onClickCapture(event);
|
267
269
|
}
|
268
270
|
// do this in the next frame, otherwise it remounts the row and prevents row actions on hover from being clickable
|
269
|
-
requestAnimationFrame(() => tableMeta.
|
271
|
+
requestAnimationFrame(() => tableMeta.rowActive.setRowActiveIndex(index));
|
270
272
|
};
|
271
273
|
const handleClick = event => {
|
272
274
|
if (typeof onClick === 'function') {
|
@@ -275,7 +277,7 @@ const MemoedRow = /*#__PURE__*/React__default.memo(function MemoedRow(props) {
|
|
275
277
|
if (!((_ref$current2 = ref.current) !== null && _ref$current2 !== void 0 && _ref$current2.contains(event.target)) || clickableElements.includes(clickedElement.tagName.toLowerCase()) || clickedElement.closest(clickableElements.map(tag => `[role=row] ${tag}`).join(','))) {
|
276
278
|
return;
|
277
279
|
}
|
278
|
-
onClick(
|
280
|
+
onClick(event, data);
|
279
281
|
}
|
280
282
|
};
|
281
283
|
const handleMouseEnter = () => {
|