@economic/taco 2.23.0 → 2.25.0
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/components/Card/Card.d.ts +1 -0
- package/dist/components/Checkbox/Checkbox.d.ts +2 -0
- package/dist/components/Provider/Localization.d.ts +6 -0
- package/dist/components/Report/Report.d.ts +2 -2
- package/dist/components/Report/components/Body/Body.d.ts +0 -1
- package/dist/components/Report/components/Footer/Summary.d.ts +0 -1
- package/dist/components/Report/components/Header/Header.d.ts +3 -0
- package/dist/components/Report/components/Header/components/Menu.d.ts +3 -0
- package/dist/components/Report/components/Toolbar/components/Filters/components/Filter.d.ts +2 -2
- package/dist/components/Report/components/Toolbar/components/Filters/components/FilterColumn.d.ts +5 -2
- package/dist/components/Report/components/Toolbar/components/Filters/util.d.ts +2 -0
- package/dist/components/Report/types.d.ts +2 -2
- package/dist/components/Report/useReport.d.ts +0 -1
- package/dist/components/Select2/Select2.d.ts +22 -0
- package/dist/components/Select2/hooks/useChildren.d.ts +1 -0
- package/dist/components/Table/Table.d.ts +1 -1
- package/dist/components/Table/components/BaseTable.d.ts +1 -1
- package/dist/components/Table/hooks/useRowCreation.d.ts +2 -2
- package/dist/components/Table/hooks/useTable.d.ts +5 -5
- package/dist/components/Table/hooks/useTableKeyboardNavigation.d.ts +2 -2
- package/dist/components/Table/types.d.ts +37 -37
- package/dist/components/Table/util/sortTypes.d.ts +2 -2
- package/dist/components/Table/util.d.ts +4 -4
- package/dist/components/Table3/components/toolbar/Filter/filters/components/Filter.d.ts +2 -2
- package/dist/components/Table3/components/toolbar/Filter/filters/components/FilterColumn.d.ts +5 -2
- package/dist/components/Table3/hooks/useTable.d.ts +8 -8
- package/dist/components/Table3/types.d.ts +2 -0
- package/dist/esm/index.css +55 -46
- package/dist/esm/packages/taco/src/components/Button/util.js +8 -8
- package/dist/esm/packages/taco/src/components/Button/util.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Card/Card.js +2 -1
- package/dist/esm/packages/taco/src/components/Card/Card.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Checkbox/Checkbox.js +11 -2
- package/dist/esm/packages/taco/src/components/Checkbox/Checkbox.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Listbox/ScrollableList.js +1 -1
- package/dist/esm/packages/taco/src/components/Menu/components/Trigger.js +12 -1
- package/dist/esm/packages/taco/src/components/Menu/components/Trigger.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Provider/Localization.js +7 -1
- package/dist/esm/packages/taco/src/components/Provider/Localization.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Report/Report.js +3 -8
- package/dist/esm/packages/taco/src/components/Report/Report.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Report/components/Body/Body.js +4 -3
- package/dist/esm/packages/taco/src/components/Report/components/Body/Body.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Report/components/Cell/Cell.js +1 -1
- package/dist/esm/packages/taco/src/components/Report/components/Cell/Cell.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Report/components/Cell/GroupedCell.js +1 -1
- package/dist/esm/packages/taco/src/components/Report/components/Cell/GroupedCell.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Report/components/Cell/util.js +1 -1
- package/dist/esm/packages/taco/src/components/Report/components/Cell/util.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Report/components/Footer/Footer.js +14 -2
- package/dist/esm/packages/taco/src/components/Report/components/Footer/Footer.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Report/components/Footer/Summary.js +3 -3
- package/dist/esm/packages/taco/src/components/Report/components/Footer/Summary.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Report/components/Header/Header.js +18 -1
- package/dist/esm/packages/taco/src/components/Report/components/Header/Header.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Report/components/Header/components/Menu.js +10 -1
- package/dist/esm/packages/taco/src/components/Report/components/Header/components/Menu.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Report/components/Header/util.js +1 -1
- package/dist/esm/packages/taco/src/components/Report/components/Header/util.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Report/components/Internal/Selection.js +47 -11
- package/dist/esm/packages/taco/src/components/Report/components/Internal/Selection.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Report/components/Toolbar/components/Filters/Filters.js +13 -1
- package/dist/esm/packages/taco/src/components/Report/components/Toolbar/components/Filters/Filters.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Report/components/Toolbar/components/Filters/ManageFiltersPopover.js +44 -51
- package/dist/esm/packages/taco/src/components/Report/components/Toolbar/components/Filters/ManageFiltersPopover.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Report/components/Toolbar/components/Filters/components/Filter.js +14 -7
- package/dist/esm/packages/taco/src/components/Report/components/Toolbar/components/Filters/components/Filter.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Report/components/Toolbar/components/Filters/components/FilterColumn.js +4 -3
- package/dist/esm/packages/taco/src/components/Report/components/Toolbar/components/Filters/components/FilterColumn.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Report/components/Toolbar/components/Filters/components/FilterValue.js +11 -1
- package/dist/esm/packages/taco/src/components/Report/components/Toolbar/components/Filters/components/FilterValue.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Report/components/Toolbar/components/Filters/util.js +4 -1
- package/dist/esm/packages/taco/src/components/Report/components/Toolbar/components/Filters/util.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Report/components/Toolbar/components/Print/Print.js +10 -8
- package/dist/esm/packages/taco/src/components/Report/components/Toolbar/components/Print/Print.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Report/components/Toolbar/components/Settings/HideOrOrderPopover.js +1 -1
- package/dist/esm/packages/taco/src/components/Report/components/Toolbar/components/Settings/HideOrOrderPopover.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Report/components/Toolbar/components/Settings/Settings.js +1 -1
- package/dist/esm/packages/taco/src/components/Report/components/Toolbar/components/Settings/Settings.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Report/listeners/useTableRowActiveListener.js +2 -2
- package/dist/esm/packages/taco/src/components/Report/listeners/useTableRowActiveListener.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Report/styles/useCssGridStylesheet.js +8 -5
- package/dist/esm/packages/taco/src/components/Report/styles/useCssGridStylesheet.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Report/useReport.js +3 -3
- package/dist/esm/packages/taco/src/components/Report/useReport.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Report/util/useTableGlobalShortcuts.js +3 -10
- package/dist/esm/packages/taco/src/components/Report/util/useTableGlobalShortcuts.js.map +1 -1
- package/dist/esm/packages/taco/src/components/SearchInput2/SearchInput2.js +2 -1
- package/dist/esm/packages/taco/src/components/SearchInput2/SearchInput2.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Select2/Select2.js +43 -4
- package/dist/esm/packages/taco/src/components/Select2/Select2.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Select2/hooks/useChildren.js +1 -1
- package/dist/esm/packages/taco/src/components/Select2/hooks/useChildren.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Table/components/PaginatedTable.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Table/components/Table.js.map +1 -1
- 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.map +1 -1
- package/dist/esm/packages/taco/src/components/Table/hooks/useRowCreation.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Table/hooks/useTable.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Table/hooks/useTableKeyboardNavigation.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Table/util/renderRow.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Table/util/sortTypes.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Table/util.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Table3/Table3.js +4 -6
- package/dist/esm/packages/taco/src/components/Table3/Table3.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Table3/components/columns/footer/Summary.js +1 -1
- package/dist/esm/packages/taco/src/components/Table3/components/columns/footer/Summary.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Table3/components/columns/internal/Selection.js +66 -14
- 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 +1 -1
- package/dist/esm/packages/taco/src/components/Table3/components/columns/styles.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Table3/components/toolbar/ColumnSettings.js +1 -1
- 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 +27 -44
- 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/Filter.js +14 -7
- package/dist/esm/packages/taco/src/components/Table3/components/toolbar/Filter/filters/components/Filter.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Table3/components/toolbar/Filter/filters/components/FilterColumn.js +4 -3
- 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 +1 -1
- 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 +2 -0
- 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 -1
- package/dist/esm/packages/taco/src/components/Table3/hooks/features/useSettings.js +1 -1
- package/dist/esm/packages/taco/src/components/Table3/hooks/listeners/useSettingsStateListener.js +3 -1
- package/dist/esm/packages/taco/src/components/Table3/hooks/listeners/useSettingsStateListener.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Table3/hooks/useTable.js +26 -19
- package/dist/esm/packages/taco/src/components/Table3/hooks/useTable.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Table3/types.js.map +1 -1
- package/dist/esm/packages/taco/src/hooks/useLocalStorage.js.map +1 -1
- package/dist/esm/packages/taco/src/index.js +1 -1
- package/dist/esm/packages/taco/src/primitives/Button.js +1 -0
- package/dist/esm/packages/taco/src/primitives/Button.js.map +1 -1
- package/dist/esm/packages/taco/src/primitives/Table/types.js.map +1 -1
- package/dist/esm/packages/taco/src/primitives/Table/useTableManager/features/useTableColumnFreezing.js.map +1 -0
- package/dist/esm/packages/taco/src/primitives/Table/useTableManager/features/useTableColumnOrdering.js.map +1 -0
- package/dist/esm/packages/taco/src/primitives/Table/useTableManager/features/useTableFontSize.js.map +1 -0
- package/dist/esm/packages/taco/src/primitives/Table/useTableManager/features/useTableFooter.js.map +1 -0
- package/dist/esm/packages/taco/src/primitives/Table/useTableManager/features/useTablePrinting.js +36 -0
- package/dist/esm/packages/taco/src/primitives/Table/useTableManager/features/useTablePrinting.js.map +1 -0
- package/dist/esm/packages/taco/src/primitives/Table/useTableManager/features/useTableRef.js.map +1 -0
- package/dist/esm/packages/taco/src/primitives/Table/useTableManager/features/useTableRowActions.js.map +1 -0
- package/dist/esm/packages/taco/src/primitives/Table/useTableManager/features/useTableRowActive.js.map +1 -0
- package/dist/esm/packages/taco/src/primitives/Table/useTableManager/features/useTableRowClick.js.map +1 -0
- package/dist/esm/packages/taco/src/primitives/Table/useTableManager/features/useTableRowExpansion.js.map +1 -0
- package/dist/esm/packages/taco/src/primitives/Table/useTableManager/features/useTableRowGoto.js.map +1 -0
- package/dist/esm/packages/taco/src/primitives/Table/useTableManager/features/useTableRowGroups.js.map +1 -0
- package/dist/esm/packages/taco/src/primitives/Table/useTableManager/features/useTableRowHeight.js.map +1 -0
- package/dist/esm/packages/taco/src/primitives/Table/useTableManager/features/useTableRowSelection.js.map +1 -0
- package/dist/esm/packages/taco/src/primitives/Table/useTableManager/features/useTableSearch.js.map +1 -0
- package/dist/esm/packages/taco/src/primitives/Table/useTableManager/features/useTableServerLoading.js.map +1 -0
- package/dist/esm/packages/taco/src/primitives/Table/{useTable → useTableManager}/features/useTableSettings.js +1 -2
- package/dist/esm/packages/taco/src/primitives/Table/useTableManager/features/useTableSettings.js.map +1 -0
- package/dist/esm/packages/taco/src/primitives/Table/useTableManager/listeners/useTableDataListener.js.map +1 -0
- package/dist/esm/packages/taco/src/primitives/Table/useTableManager/listeners/useTableFilterListener.js.map +1 -0
- package/dist/esm/packages/taco/src/primitives/Table/useTableManager/listeners/useTableFontSizeListener.js.map +1 -0
- package/dist/esm/packages/taco/src/primitives/Table/useTableManager/listeners/useTableRowHeightListener.js.map +1 -0
- package/dist/esm/packages/taco/src/primitives/Table/useTableManager/listeners/useTableRowSelectionListener.js.map +1 -0
- package/dist/esm/packages/taco/src/primitives/Table/useTableManager/listeners/useTableSearchListener.js.map +1 -0
- package/dist/esm/packages/taco/src/primitives/Table/useTableManager/listeners/useTableServerLoadingListener.js.map +1 -0
- package/dist/esm/packages/taco/src/primitives/Table/{useTable → useTableManager}/listeners/useTableSettingsListener.js +1 -1
- package/dist/esm/packages/taco/src/primitives/Table/useTableManager/listeners/useTableSettingsListener.js.map +1 -0
- package/dist/esm/packages/taco/src/primitives/Table/useTableManager/listeners/useTableShortcutsListener.js.map +1 -0
- package/dist/esm/packages/taco/src/primitives/Table/useTableManager/listeners/useTableSortingListener.js.map +1 -0
- package/dist/esm/packages/taco/src/primitives/Table/{useTable/useTable.js → useTableManager/useTableManager.js} +10 -8
- package/dist/esm/packages/taco/src/primitives/Table/useTableManager/useTableManager.js.map +1 -0
- package/dist/esm/packages/taco/src/primitives/Table/{useTable → useTableManager}/util/columns.js +33 -7
- package/dist/esm/packages/taco/src/primitives/Table/useTableManager/util/columns.js.map +1 -0
- package/dist/esm/packages/taco/src/primitives/Table/useTableManager/util/filtering.js.map +1 -0
- package/dist/esm/packages/taco/src/primitives/Table/useTableManager/util/presets.js.map +1 -0
- package/dist/esm/packages/taco/src/primitives/Table/useTableManager/util/search.js.map +1 -0
- package/dist/esm/packages/taco/src/primitives/Table/{useTable → useTableManager}/util/settings.js +0 -1
- package/dist/esm/packages/taco/src/primitives/Table/useTableManager/util/settings.js.map +1 -0
- package/dist/esm/packages/taco/src/primitives/Table/useTableManager/util/setup.js.map +1 -0
- package/dist/esm/packages/taco/src/primitives/Table/useTableManager/util/sorting.js.map +1 -0
- package/dist/esm/packages/taco/src/utils/dom.js +12 -3
- package/dist/esm/packages/taco/src/utils/dom.js.map +1 -1
- package/dist/esm/packages/taco/src/utils/keyboard.js +2 -2
- package/dist/esm/packages/taco/src/utils/keyboard.js.map +1 -1
- package/dist/hooks/useLocalStorage.d.ts +2 -1
- package/dist/index.css +55 -46
- package/dist/primitives/Table/types.d.ts +5 -18
- package/dist/primitives/Table/useTableManager/features/useTablePrinting.d.ts +15 -0
- package/dist/primitives/Table/useTableManager/types.d.ts +13 -0
- package/dist/primitives/Table/{useTable/useTable.d.ts → useTableManager/useTableManager.d.ts} +4 -3
- package/dist/primitives/Table/useTableManager/util/presets.d.ts +2 -0
- package/dist/primitives/Table/{useTable → useTableManager}/util/settings.d.ts +0 -1
- package/dist/primitives/Table/{useTable → useTableManager}/util/setup.d.ts +5 -4
- package/dist/taco.cjs.development.js +603 -408
- 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/utils/dom.d.ts +3 -1
- package/package.json +2 -2
- package/types.json +10314 -9345
- package/dist/components/Report/components/Toolbar/components/Filters/components/Placeholder.d.ts +0 -12
- package/dist/components/Table3/components/toolbar/Filter/filters/components/Placeholder.d.ts +0 -12
- package/dist/esm/packages/taco/src/components/Report/components/Toolbar/components/Filters/components/Placeholder.js +0 -41
- package/dist/esm/packages/taco/src/components/Report/components/Toolbar/components/Filters/components/Placeholder.js.map +0 -1
- package/dist/esm/packages/taco/src/components/Table3/components/toolbar/Filter/filters/components/Placeholder.js +0 -41
- package/dist/esm/packages/taco/src/components/Table3/components/toolbar/Filter/filters/components/Placeholder.js.map +0 -1
- package/dist/esm/packages/taco/src/primitives/Table/useTable/features/useTableColumnFreezing.js.map +0 -1
- package/dist/esm/packages/taco/src/primitives/Table/useTable/features/useTableColumnOrdering.js.map +0 -1
- package/dist/esm/packages/taco/src/primitives/Table/useTable/features/useTableFontSize.js.map +0 -1
- package/dist/esm/packages/taco/src/primitives/Table/useTable/features/useTableFooter.js.map +0 -1
- package/dist/esm/packages/taco/src/primitives/Table/useTable/features/useTablePrinting.js +0 -16
- package/dist/esm/packages/taco/src/primitives/Table/useTable/features/useTablePrinting.js.map +0 -1
- package/dist/esm/packages/taco/src/primitives/Table/useTable/features/useTableRef.js.map +0 -1
- package/dist/esm/packages/taco/src/primitives/Table/useTable/features/useTableRowActions.js.map +0 -1
- package/dist/esm/packages/taco/src/primitives/Table/useTable/features/useTableRowActive.js.map +0 -1
- package/dist/esm/packages/taco/src/primitives/Table/useTable/features/useTableRowClick.js.map +0 -1
- package/dist/esm/packages/taco/src/primitives/Table/useTable/features/useTableRowExpansion.js.map +0 -1
- package/dist/esm/packages/taco/src/primitives/Table/useTable/features/useTableRowGoto.js.map +0 -1
- package/dist/esm/packages/taco/src/primitives/Table/useTable/features/useTableRowGroups.js.map +0 -1
- package/dist/esm/packages/taco/src/primitives/Table/useTable/features/useTableRowHeight.js.map +0 -1
- package/dist/esm/packages/taco/src/primitives/Table/useTable/features/useTableRowSelection.js.map +0 -1
- package/dist/esm/packages/taco/src/primitives/Table/useTable/features/useTableSearch.js.map +0 -1
- package/dist/esm/packages/taco/src/primitives/Table/useTable/features/useTableServerLoading.js.map +0 -1
- package/dist/esm/packages/taco/src/primitives/Table/useTable/features/useTableSettings.js.map +0 -1
- package/dist/esm/packages/taco/src/primitives/Table/useTable/listeners/useTableDataListener.js.map +0 -1
- package/dist/esm/packages/taco/src/primitives/Table/useTable/listeners/useTableFilterListener.js.map +0 -1
- package/dist/esm/packages/taco/src/primitives/Table/useTable/listeners/useTableFontSizeListener.js.map +0 -1
- package/dist/esm/packages/taco/src/primitives/Table/useTable/listeners/useTableRowHeightListener.js.map +0 -1
- package/dist/esm/packages/taco/src/primitives/Table/useTable/listeners/useTableRowSelectionListener.js.map +0 -1
- package/dist/esm/packages/taco/src/primitives/Table/useTable/listeners/useTableSearchListener.js.map +0 -1
- package/dist/esm/packages/taco/src/primitives/Table/useTable/listeners/useTableServerLoadingListener.js.map +0 -1
- package/dist/esm/packages/taco/src/primitives/Table/useTable/listeners/useTableSettingsListener.js.map +0 -1
- package/dist/esm/packages/taco/src/primitives/Table/useTable/listeners/useTableShortcutsListener.js.map +0 -1
- package/dist/esm/packages/taco/src/primitives/Table/useTable/listeners/useTableSortingListener.js.map +0 -1
- package/dist/esm/packages/taco/src/primitives/Table/useTable/useTable.js.map +0 -1
- package/dist/esm/packages/taco/src/primitives/Table/useTable/util/columns.js.map +0 -1
- package/dist/esm/packages/taco/src/primitives/Table/useTable/util/filtering.js.map +0 -1
- package/dist/esm/packages/taco/src/primitives/Table/useTable/util/presets.js.map +0 -1
- package/dist/esm/packages/taco/src/primitives/Table/useTable/util/search.js.map +0 -1
- package/dist/esm/packages/taco/src/primitives/Table/useTable/util/settings.js.map +0 -1
- package/dist/esm/packages/taco/src/primitives/Table/useTable/util/setup.js.map +0 -1
- package/dist/esm/packages/taco/src/primitives/Table/useTable/util/sorting.js.map +0 -1
- package/dist/primitives/Table/useTable/features/useTablePrinting.d.ts +0 -8
- package/dist/primitives/Table/useTable/util/presets.d.ts +0 -2
- /package/dist/esm/packages/taco/src/primitives/Table/{useTable → useTableManager}/features/useTableColumnFreezing.js +0 -0
- /package/dist/esm/packages/taco/src/primitives/Table/{useTable → useTableManager}/features/useTableColumnOrdering.js +0 -0
- /package/dist/esm/packages/taco/src/primitives/Table/{useTable → useTableManager}/features/useTableFontSize.js +0 -0
- /package/dist/esm/packages/taco/src/primitives/Table/{useTable → useTableManager}/features/useTableFooter.js +0 -0
- /package/dist/esm/packages/taco/src/primitives/Table/{useTable → useTableManager}/features/useTableRef.js +0 -0
- /package/dist/esm/packages/taco/src/primitives/Table/{useTable → useTableManager}/features/useTableRowActions.js +0 -0
- /package/dist/esm/packages/taco/src/primitives/Table/{useTable → useTableManager}/features/useTableRowActive.js +0 -0
- /package/dist/esm/packages/taco/src/primitives/Table/{useTable → useTableManager}/features/useTableRowClick.js +0 -0
- /package/dist/esm/packages/taco/src/primitives/Table/{useTable → useTableManager}/features/useTableRowExpansion.js +0 -0
- /package/dist/esm/packages/taco/src/primitives/Table/{useTable → useTableManager}/features/useTableRowGoto.js +0 -0
- /package/dist/esm/packages/taco/src/primitives/Table/{useTable → useTableManager}/features/useTableRowGroups.js +0 -0
- /package/dist/esm/packages/taco/src/primitives/Table/{useTable → useTableManager}/features/useTableRowHeight.js +0 -0
- /package/dist/esm/packages/taco/src/primitives/Table/{useTable → useTableManager}/features/useTableRowSelection.js +0 -0
- /package/dist/esm/packages/taco/src/primitives/Table/{useTable → useTableManager}/features/useTableSearch.js +0 -0
- /package/dist/esm/packages/taco/src/primitives/Table/{useTable → useTableManager}/features/useTableServerLoading.js +0 -0
- /package/dist/esm/packages/taco/src/primitives/Table/{useTable → useTableManager}/listeners/useTableDataListener.js +0 -0
- /package/dist/esm/packages/taco/src/primitives/Table/{useTable → useTableManager}/listeners/useTableFilterListener.js +0 -0
- /package/dist/esm/packages/taco/src/primitives/Table/{useTable → useTableManager}/listeners/useTableFontSizeListener.js +0 -0
- /package/dist/esm/packages/taco/src/primitives/Table/{useTable → useTableManager}/listeners/useTableRowHeightListener.js +0 -0
- /package/dist/esm/packages/taco/src/primitives/Table/{useTable → useTableManager}/listeners/useTableRowSelectionListener.js +0 -0
- /package/dist/esm/packages/taco/src/primitives/Table/{useTable → useTableManager}/listeners/useTableSearchListener.js +0 -0
- /package/dist/esm/packages/taco/src/primitives/Table/{useTable → useTableManager}/listeners/useTableServerLoadingListener.js +0 -0
- /package/dist/esm/packages/taco/src/primitives/Table/{useTable → useTableManager}/listeners/useTableShortcutsListener.js +0 -0
- /package/dist/esm/packages/taco/src/primitives/Table/{useTable → useTableManager}/listeners/useTableSortingListener.js +0 -0
- /package/dist/esm/packages/taco/src/primitives/Table/{useTable → useTableManager}/util/filtering.js +0 -0
- /package/dist/esm/packages/taco/src/primitives/Table/{useTable → useTableManager}/util/presets.js +0 -0
- /package/dist/esm/packages/taco/src/primitives/Table/{useTable → useTableManager}/util/search.js +0 -0
- /package/dist/esm/packages/taco/src/primitives/Table/{useTable → useTableManager}/util/setup.js +0 -0
- /package/dist/esm/packages/taco/src/primitives/Table/{useTable → useTableManager}/util/sorting.js +0 -0
- /package/dist/primitives/Table/{useTable → useTableManager}/features/useTableColumnFreezing.d.ts +0 -0
- /package/dist/primitives/Table/{useTable → useTableManager}/features/useTableColumnOrdering.d.ts +0 -0
- /package/dist/primitives/Table/{useTable → useTableManager}/features/useTableFontSize.d.ts +0 -0
- /package/dist/primitives/Table/{useTable → useTableManager}/features/useTableFooter.d.ts +0 -0
- /package/dist/primitives/Table/{useTable → useTableManager}/features/useTableRef.d.ts +0 -0
- /package/dist/primitives/Table/{useTable → useTableManager}/features/useTableRowActions.d.ts +0 -0
- /package/dist/primitives/Table/{useTable → useTableManager}/features/useTableRowActive.d.ts +0 -0
- /package/dist/primitives/Table/{useTable → useTableManager}/features/useTableRowClick.d.ts +0 -0
- /package/dist/primitives/Table/{useTable → useTableManager}/features/useTableRowExpansion.d.ts +0 -0
- /package/dist/primitives/Table/{useTable → useTableManager}/features/useTableRowGoto.d.ts +0 -0
- /package/dist/primitives/Table/{useTable → useTableManager}/features/useTableRowGroups.d.ts +0 -0
- /package/dist/primitives/Table/{useTable → useTableManager}/features/useTableRowHeight.d.ts +0 -0
- /package/dist/primitives/Table/{useTable → useTableManager}/features/useTableRowSelection.d.ts +0 -0
- /package/dist/primitives/Table/{useTable → useTableManager}/features/useTableSearch.d.ts +0 -0
- /package/dist/primitives/Table/{useTable → useTableManager}/features/useTableServerLoading.d.ts +0 -0
- /package/dist/primitives/Table/{useTable → useTableManager}/features/useTableSettings.d.ts +0 -0
- /package/dist/primitives/Table/{useTable → useTableManager}/listeners/useTableDataListener.d.ts +0 -0
- /package/dist/primitives/Table/{useTable → useTableManager}/listeners/useTableFilterListener.d.ts +0 -0
- /package/dist/primitives/Table/{useTable → useTableManager}/listeners/useTableFontSizeListener.d.ts +0 -0
- /package/dist/primitives/Table/{useTable → useTableManager}/listeners/useTableRowHeightListener.d.ts +0 -0
- /package/dist/primitives/Table/{useTable → useTableManager}/listeners/useTableRowSelectionListener.d.ts +0 -0
- /package/dist/primitives/Table/{useTable → useTableManager}/listeners/useTableSearchListener.d.ts +0 -0
- /package/dist/primitives/Table/{useTable → useTableManager}/listeners/useTableServerLoadingListener.d.ts +0 -0
- /package/dist/primitives/Table/{useTable → useTableManager}/listeners/useTableSettingsListener.d.ts +0 -0
- /package/dist/primitives/Table/{useTable → useTableManager}/listeners/useTableShortcutsListener.d.ts +0 -0
- /package/dist/primitives/Table/{useTable → useTableManager}/listeners/useTableSortingListener.d.ts +0 -0
- /package/dist/primitives/Table/{useTable → useTableManager}/util/columns.d.ts +0 -0
- /package/dist/primitives/Table/{useTable → useTableManager}/util/columns.spec.d.ts +0 -0
- /package/dist/primitives/Table/{useTable → useTableManager}/util/filtering.d.ts +0 -0
- /package/dist/primitives/Table/{useTable → useTableManager}/util/search.d.ts +0 -0
- /package/dist/primitives/Table/{useTable → useTableManager}/util/sorting.d.ts +0 -0
@@ -16,7 +16,7 @@ function Summary(props) {
|
|
16
16
|
let label;
|
17
17
|
let count;
|
18
18
|
// row selection
|
19
|
-
const rowsSelectedLength = table.
|
19
|
+
const rowsSelectedLength = table.getSelectedRowModel().rows.length;
|
20
20
|
if (rowsSelectedLength > 0) {
|
21
21
|
label = texts.table3.footer.summary.selected;
|
22
22
|
count = /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement("strong", null, new Intl.NumberFormat(locale).format(rowsSelectedLength)), "\u00A0", texts.table3.footer.summary.count, "\u00A0", /*#__PURE__*/React__default.createElement("strong", null, new Intl.NumberFormat(locale).format(length)));
|
package/dist/esm/packages/taco/src/components/Table3/components/columns/footer/Summary.js.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"Summary.js","sources":["../../../../../../../../../../src/components/Table3/components/columns/footer/Summary.tsx"],"sourcesContent":["import React from 'react';\nimport { Table as RTable, TableMeta } from '@tanstack/react-table';\nimport { useLocalization } from '../../../../Provider/Localization';\n\nexport type FooterSummaryProps<TType = unknown> = {\n currentLength: number;\n length: number;\n table: RTable<TType>;\n};\n\nexport function Summary<TType = unknown>(props: FooterSummaryProps<TType>) {\n const { currentLength, length, table } = props;\n const tableMeta = table.options.meta as TableMeta<TType>;\n const { locale, texts } = useLocalization();\n\n let label;\n let count;\n\n // row selection\n const rowsSelectedLength = table.
|
1
|
+
{"version":3,"file":"Summary.js","sources":["../../../../../../../../../../src/components/Table3/components/columns/footer/Summary.tsx"],"sourcesContent":["import React from 'react';\nimport { Table as RTable, TableMeta } from '@tanstack/react-table';\nimport { useLocalization } from '../../../../Provider/Localization';\n\nexport type FooterSummaryProps<TType = unknown> = {\n currentLength: number;\n length: number;\n table: RTable<TType>;\n};\n\nexport function Summary<TType = unknown>(props: FooterSummaryProps<TType>) {\n const { currentLength, length, table } = props;\n const tableMeta = table.options.meta as TableMeta<TType>;\n const { locale, texts } = useLocalization();\n\n let label;\n let count;\n\n // row selection\n const rowsSelectedLength = table.getSelectedRowModel().rows.length;\n\n if (rowsSelectedLength > 0) {\n label = texts.table3.footer.summary.selected;\n count = (\n <>\n <strong>{new Intl.NumberFormat(locale).format(rowsSelectedLength)}</strong> \n {texts.table3.footer.summary.count} \n <strong>{new Intl.NumberFormat(locale).format(length)}</strong>\n </>\n );\n } else if (\n table.getState().columnFilters?.length || // filtered data\n // @ts-expect-error: fixing type issue while report and table3 TableMeta definitions live in parallel\n (!!table.getState().globalFilter && tableMeta.search.excludeUnmatchedResults) // search with hide enabled\n ) {\n label = texts.table3.footer.summary.records;\n count = (\n <>\n <strong>{currentLength}</strong> \n {texts.table3.footer.summary.count} \n <strong>{new Intl.NumberFormat(locale).format(length)}</strong>\n </>\n );\n } else {\n label = texts.table3.footer.summary.records;\n count = <strong>{new Intl.NumberFormat(locale).format(length)}</strong>;\n }\n\n return (\n <div\n className=\"sticky bottom-0 left-0 z-40 -mt-10 flex h-10 w-fit items-center whitespace-nowrap bg-white px-4 !pr-3 shadow-[6px_0px_6px_theme(colors.white)]\"\n data-taco=\"table2-footer-summary\">\n {label} {count}\n </div>\n );\n}\n"],"names":["Summary","props","currentLength","length","table","tableMeta","options","meta","locale","texts","useLocalization","label","count","rowsSelectedLength","getSelectedRowModel","rows","table3","footer","summary","selected","React","Intl","NumberFormat","format","_table$getState$colum","getState","columnFilters","globalFilter","search","excludeUnmatchedResults","records","className"],"mappings":";;;SAUgBA,OAAOA,CAAkBC,KAAgC;;EACrE,MAAM;IAAEC,aAAa;IAAEC,MAAM;IAAEC;GAAO,GAAGH,KAAK;EAC9C,MAAMI,SAAS,GAAGD,KAAK,CAACE,OAAO,CAACC,IAAwB;EACxD,MAAM;IAAEC,MAAM;IAAEC;GAAO,GAAGC,eAAe,EAAE;EAE3C,IAAIC,KAAK;EACT,IAAIC,KAAK;;EAGT,MAAMC,kBAAkB,GAAGT,KAAK,CAACU,mBAAmB,EAAE,CAACC,IAAI,CAACZ,MAAM;EAElE,IAAIU,kBAAkB,GAAG,CAAC,EAAE;IACxBF,KAAK,GAAGF,KAAK,CAACO,MAAM,CAACC,MAAM,CAACC,OAAO,CAACC,QAAQ;IAC5CP,KAAK,gBACDQ,yEACIA,6CAAS,IAAIC,IAAI,CAACC,YAAY,CAACd,MAAM,CAAC,CAACe,MAAM,CAACV,kBAAkB,CAAC,CAAU,YAC1EJ,KAAK,CAACO,MAAM,CAACC,MAAM,CAACC,OAAO,CAACN,KAAK,yBAClCQ,6CAAS,IAAIC,IAAI,CAACC,YAAY,CAACd,MAAM,CAAC,CAACe,MAAM,CAACpB,MAAM,CAAC,CAAU,CAEtE;GACJ,MAAM,IACH,CAAAqB,qBAAA,GAAApB,KAAK,CAACqB,QAAQ,EAAE,CAACC,aAAa,cAAAF,qBAAA,eAA9BA,qBAAA,CAAgCrB,MAAM;;;EAErC,CAAC,CAACC,KAAK,CAACqB,QAAQ,EAAE,CAACE,YAAY,IAAItB,SAAS,CAACuB,MAAM,CAACC,uBAAwB;IAC/E;IACElB,KAAK,GAAGF,KAAK,CAACO,MAAM,CAACC,MAAM,CAACC,OAAO,CAACY,OAAO;IAC3ClB,KAAK,gBACDQ,yEACIA,6CAASlB,aAAa,CAAU,YAC/BO,KAAK,CAACO,MAAM,CAACC,MAAM,CAACC,OAAO,CAACN,KAAK,yBAClCQ,6CAAS,IAAIC,IAAI,CAACC,YAAY,CAACd,MAAM,CAAC,CAACe,MAAM,CAACpB,MAAM,CAAC,CAAU,CAEtE;GACJ,MAAM;IACHQ,KAAK,GAAGF,KAAK,CAACO,MAAM,CAACC,MAAM,CAACC,OAAO,CAACY,OAAO;IAC3ClB,KAAK,gBAAGQ,6CAAS,IAAIC,IAAI,CAACC,YAAY,CAACd,MAAM,CAAC,CAACe,MAAM,CAACpB,MAAM,CAAC,CAAU;;EAG3E,oBACIiB;IACIW,SAAS,EAAC,gJAAgJ;iBAChJ;KACTpB,KAAK,YAAQC,KAAK,CACjB;AAEd;;;;"}
|
package/dist/esm/packages/taco/src/components/Table3/components/columns/internal/Selection.js
CHANGED
@@ -5,6 +5,7 @@ import { useLocalization } from '../../../../Provider/Localization.js';
|
|
5
5
|
import { Checkbox } from '../../../../Checkbox/Checkbox.js';
|
6
6
|
import { Shortcut } from '../../../../Shortcut/Shortcut.js';
|
7
7
|
import { getRadioClassnames } from '../../../../RadioGroup/util.js';
|
8
|
+
import { TableServerLoadAllState } from '../../../../../primitives/Table/types.js';
|
8
9
|
import { Header as Header$1 } from '../header/Header.js';
|
9
10
|
import { RowContext } from '../../rows/RowContext.js';
|
10
11
|
import { DisplayCell } from '../cell/DisplayCell.js';
|
@@ -19,6 +20,25 @@ function Header(context) {
|
|
19
20
|
const isAllRowsSelected = context.table.getIsAllRowsSelected();
|
20
21
|
const isSomeRowsSelected = context.table.getIsSomeRowsSelected();
|
21
22
|
const title = isAllRowsSelected ? texts.table3.columns.select.deselectAll : texts.table3.columns.select.selectAll;
|
23
|
+
const tableMeta = context.table.options.meta;
|
24
|
+
const isServerloading = tableMeta.server.loadAllStatus === TableServerLoadAllState.Loading;
|
25
|
+
const isLoadingAll = isAllRowsSelected && isServerloading;
|
26
|
+
const isLoadingPreviousRows = tableMeta.rowSelection.lastSelectedRowIndex !== undefined && isServerloading;
|
27
|
+
const toggleSelectAll = function () {
|
28
|
+
try {
|
29
|
+
const _temp = function () {
|
30
|
+
if (!isServerloading) {
|
31
|
+
var _tableMeta$server, _tableMeta$server$loa;
|
32
|
+
return Promise.resolve((_tableMeta$server = tableMeta.server) === null || _tableMeta$server === void 0 ? void 0 : (_tableMeta$server$loa = _tableMeta$server.loadAllIfNeeded) === null || _tableMeta$server$loa === void 0 ? void 0 : _tableMeta$server$loa.call(_tableMeta$server, context.table.getState().sorting, context.table.getState().columnFilters, undefined)).then(function () {
|
33
|
+
context.table.toggleAllRowsSelected(!isAllRowsSelected);
|
34
|
+
});
|
35
|
+
}
|
36
|
+
}();
|
37
|
+
return Promise.resolve(_temp && _temp.then ? _temp.then(function () {}) : void 0);
|
38
|
+
} catch (e) {
|
39
|
+
return Promise.reject(e);
|
40
|
+
}
|
41
|
+
};
|
22
42
|
return /*#__PURE__*/React__default.createElement(Header$1, Object.assign({}, context), /*#__PURE__*/React__default.createElement(Tooltip, {
|
23
43
|
title: title
|
24
44
|
}, /*#__PURE__*/React__default.createElement(Checkbox, {
|
@@ -27,8 +47,9 @@ function Header(context) {
|
|
27
47
|
key: String(`${isAllRowsSelected}_${isSomeRowsSelected}`),
|
28
48
|
checked: isAllRowsSelected,
|
29
49
|
indeterminate: isSomeRowsSelected,
|
30
|
-
onChange:
|
31
|
-
tabIndex: -1
|
50
|
+
onChange: toggleSelectAll,
|
51
|
+
tabIndex: -1,
|
52
|
+
loading: isLoadingAll || isLoadingPreviousRows
|
32
53
|
})));
|
33
54
|
} else {
|
34
55
|
return /*#__PURE__*/React__default.createElement(Header$1, Object.assign({}, context));
|
@@ -50,18 +71,49 @@ const Cell = /*#__PURE__*/React__default.memo(function MemoedCell(context) {
|
|
50
71
|
const isActiveRow = tableMeta.rowActive.rowActiveIndex === rowIndex;
|
51
72
|
const isSelected = context.row.getIsSelected();
|
52
73
|
const title = isSelected ? texts.table3.columns.select.deselect : texts.table3.columns.select.select;
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
var _tableMeta$rowSelecti;
|
58
|
-
const [fromIndex, toIndex] = toggleBetween((_tableMeta$rowSelecti = tableMeta.rowSelection.lastSelectedRowIndex.current) !== null && _tableMeta$rowSelecti !== void 0 ? _tableMeta$rowSelecti : 0, rowIndex);
|
59
|
-
context.table.getRowModel().rows.slice(fromIndex, toIndex + 1).forEach(row => row.toggleSelected(true));
|
60
|
-
} else {
|
61
|
-
context.row.toggleSelected();
|
74
|
+
const handleCheckboxClick = function (event) {
|
75
|
+
try {
|
76
|
+
function _temp5() {
|
77
|
+
tableMeta.rowSelection.lastSelectedRowIndex.current = rowIndex;
|
62
78
|
}
|
63
|
-
|
64
|
-
|
79
|
+
event.stopPropagation();
|
80
|
+
const _temp4 = function () {
|
81
|
+
if (event.shiftKey) {
|
82
|
+
var _tableMeta$rowSelecti;
|
83
|
+
function _temp3() {
|
84
|
+
const currentlySelected = context.table.getSelectedRowModel().rows;
|
85
|
+
// concat currently selected with selection range and get rid of duplicates using "Set".
|
86
|
+
// converting allSelected array into updater object: {[row.id]: true}
|
87
|
+
const allSelected = [...new Set(currentlySelected.concat(selectionRangeRows))];
|
88
|
+
const updater = allSelected.reduce((obj, row) => Object.assign(obj, {
|
89
|
+
[row.id]: true
|
90
|
+
}), {});
|
91
|
+
context.table.setRowSelection(updater);
|
92
|
+
}
|
93
|
+
const [fromIndex, toIndex] = toggleBetween((_tableMeta$rowSelecti = tableMeta.rowSelection.lastSelectedRowIndex.current) !== null && _tableMeta$rowSelecti !== void 0 ? _tableMeta$rowSelecti : 0, rowIndex);
|
94
|
+
const selectionRangeRows = context.table.getRowModel().rows.slice(fromIndex, toIndex + 1);
|
95
|
+
// Table data loader filling-in all the rest of unloaded items with the undefined values,
|
96
|
+
// so we can easily check if at least one of the rows in the selection range is undefined,
|
97
|
+
// then it means that we need to call load all.
|
98
|
+
const hasUndefinedRows = selectionRangeRows.some(row => row.original === undefined);
|
99
|
+
const _temp2 = function () {
|
100
|
+
if (hasUndefinedRows) {
|
101
|
+
var _tableMeta$server2, _tableMeta$server2$lo;
|
102
|
+
// We don't need to await and freeze UI
|
103
|
+
return Promise.resolve((_tableMeta$server2 = tableMeta.server) === null || _tableMeta$server2 === void 0 ? void 0 : (_tableMeta$server2$lo = _tableMeta$server2.loadAllIfNeeded) === null || _tableMeta$server2$lo === void 0 ? void 0 : _tableMeta$server2$lo.call(_tableMeta$server2, context.table.getState().sorting, context.table.getState().columnFilters, undefined)).then(function () {});
|
104
|
+
}
|
105
|
+
}();
|
106
|
+
return _temp2 && _temp2.then ? _temp2.then(_temp3) : _temp3(_temp2);
|
107
|
+
} else {
|
108
|
+
context.row.toggleSelected();
|
109
|
+
}
|
110
|
+
}();
|
111
|
+
return Promise.resolve(_temp4 && _temp4.then ? _temp4.then(_temp5) : _temp5(_temp4));
|
112
|
+
} catch (e) {
|
113
|
+
return Promise.reject(e);
|
114
|
+
}
|
115
|
+
};
|
116
|
+
if (context.table.options.enableMultiRowSelection) {
|
65
117
|
return /*#__PURE__*/React__default.createElement(DisplayCell, Object.assign({}, context), /*#__PURE__*/React__default.createElement(Tooltip, {
|
66
118
|
title: /*#__PURE__*/React__default.createElement(React__default.Fragment, null, title, /*#__PURE__*/React__default.createElement(Shortcut, {
|
67
119
|
className: "ml-2",
|
@@ -71,7 +123,7 @@ const Cell = /*#__PURE__*/React__default.memo(function MemoedCell(context) {
|
|
71
123
|
"aria-label": title,
|
72
124
|
className: "!mt-0",
|
73
125
|
checked: isSelected,
|
74
|
-
onClick:
|
126
|
+
onClick: handleCheckboxClick,
|
75
127
|
// this is necessary to remove console spam from eslint
|
76
128
|
onChange: () => false,
|
77
129
|
tabIndex: isActiveRow ? 0 : -1
|
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 'clsx';\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,GAAG,EAAEC,MAAM,IAAIhB,qBAAqBE,oBAAoB,CAAC;MACzDe,OAAO,EAAEjB,iBAAiB;MAC1BkB,aAAa,EAAEhB,kBAAkB;MACjCiB,QAAQ,EAAEzB,OAAO,CAACG,KAAK,CAACuB,qBAAqB;MAC7CC,QA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{"version":3,"file":"Selection.js","sources":["../../../../../../../../../../src/components/Table3/components/columns/internal/Selection.tsx"],"sourcesContent":["import React from 'react';\nimport { HeaderContext, CellContext, DisplayColumnDef, TableMeta, RowSelectionState } from '@tanstack/react-table';\nimport cn from 'clsx';\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';\nimport { TableServerLoadAllState } from '../../../../../primitives/Table/types';\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 const tableMeta = context.table.options.meta as TableMeta<TType>;\n const isServerloading = tableMeta.server.loadAllStatus === TableServerLoadAllState.Loading;\n const isLoadingAll = isAllRowsSelected && isServerloading;\n const isLoadingPreviousRows = tableMeta.rowSelection.lastSelectedRowIndex !== undefined && isServerloading;\n\n const toggleSelectAll = async () => {\n if (!isServerloading) {\n await tableMeta.server?.loadAllIfNeeded?.(\n context.table.getState().sorting,\n context.table.getState().columnFilters,\n undefined\n );\n context.table.toggleAllRowsSelected(!isAllRowsSelected);\n }\n };\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={toggleSelectAll}\n tabIndex={-1}\n loading={isLoadingAll || isLoadingPreviousRows}\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 const handleCheckboxClick = async (event: React.MouseEvent) => {\n event.stopPropagation();\n\n if (event.shiftKey) {\n const [fromIndex, toIndex] = toggleBetween(tableMeta.rowSelection.lastSelectedRowIndex.current ?? 0, rowIndex);\n\n const selectionRangeRows = context.table.getRowModel().rows.slice(fromIndex, toIndex + 1);\n\n // Table data loader filling-in all the rest of unloaded items with the undefined values,\n // so we can easily check if at least one of the rows in the selection range is undefined,\n // then it means that we need to call load all.\n const hasUndefinedRows = selectionRangeRows.some(row => row.original === undefined);\n\n if (hasUndefinedRows) {\n // We don't need to await and freeze UI\n await tableMeta.server?.loadAllIfNeeded?.(\n context.table.getState().sorting,\n context.table.getState().columnFilters,\n undefined\n );\n }\n\n const currentlySelected = context.table.getSelectedRowModel().rows;\n // concat currently selected with selection range and get rid of duplicates using \"Set\".\n const allSelected = [...new Set(currentlySelected.concat(selectionRangeRows))];\n // converting allSelected array into updater object: {[row.id]: true}\n const updater: RowSelectionState = allSelected.reduce((obj, row) => Object.assign(obj, { [row.id]: true }), {});\n\n context.table.setRowSelection(updater);\n } else {\n context.row.toggleSelected();\n }\n\n tableMeta.rowSelection.lastSelectedRowIndex.current = rowIndex;\n };\n\n if (context.table.options.enableMultiRowSelection) {\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={handleCheckboxClick}\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","tableMeta","meta","isServerloading","server","loadAllStatus","TableServerLoadAllState","Loading","isLoadingAll","isLoadingPreviousRows","rowSelection","lastSelectedRowIndex","undefined","toggleSelectAll","_tableMeta$server","_tableMeta$server$loa","Promise","resolve","loadAllIfNeeded","call","getState","sorting","columnFilters","then","toggleAllRowsSelected","_temp","e","reject","React","ColumnHeader","Tooltip","Checkbox","className","key","String","checked","indeterminate","onChange","tabIndex","loading","toggleBetween","fromRowIndex","toRowIndex","fromIndex","toIndex","Cell","memo","MemoedCell","rowIndex","useContext","RowContext","isActiveRow","rowActive","rowActiveIndex","isSelected","row","getIsSelected","deselect","handleCheckboxClick","event","current","stopPropagation","_temp4","shiftKey","_tableMeta$rowSelecti","_temp3","currentlySelected","getSelectedRowModel","rows","allSelected","Set","concat","selectionRangeRows","updater","reduce","obj","Object","assign","id","setRowSelection","getRowModel","slice","hasUndefinedRows","some","original","_temp2","_tableMeta$server2","_tableMeta$server2$lo","toggleSelected","_temp5","DisplayCell","Shortcut","keys","onClick","cn","getRadioClassnames","handleClick","role","type","arePropsEqual","oldProps","newProps","oldTableMeta","newTableMeta","createRowSelectionColumn","hasDrag","hasExpansion","size","header","cell","footer","Footer","align","enableOrdering","enableSearch","enableTruncate","headerClassName","enableResizing","minSize"],"mappings":";;;;;;;;;;;;;MAcaA,SAAS,GAAG;AAEzB,SAASC,MAAMA,CAAkBC,OAAsC;EACnE,MAAM;IAAEC;GAAO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H5B,EAAE,EAAE/F,SAAS;IACb6H,MAAM,EAAE5H,MAAM;IACd6H,IAAI,EAAEhE,IAAI;IACViE,MAAM,EAAEC,MAAM;IACd7G,IAAI,EAAE;MACF8G,KAAK,EAAE,QAAQ;MACfhF,SAAS,EAAE8D,EAAE,CAAC,sDAAsD,EAAE;QAClE,SAAS,EAAEY,YAAY;QACvB,OAAO,EAAE,CAACA;OACb,CAAC;MACFO,cAAc,EAAE,KAAK;MACrBC,YAAY,EAAE,KAAK;MACnBC,cAAc,EAAE,KAAK;MACrBP,MAAM,EAAE,EAAE;MACVQ,eAAe,EAAEtB,EAAE,CAAC,gCAAgC,EAAE;QAAE,SAAS,EAAEY,YAAY;QAAE,OAAO,EAAE,CAACA;OAAc;KAC5G;;IAEDW,cAAc,EAAE,KAAK;IACrBV,IAAI;IACJW,OAAO,EAAEX;GACZ;AACL;;;;"}
|
@@ -1,5 +1,5 @@
|
|
1
1
|
import cn from 'clsx';
|
2
|
-
import { getCellMinWidth } from '../../../../primitives/Table/
|
2
|
+
import { getCellMinWidth } from '../../../../primitives/Table/useTableManager/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') => {
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"styles.js","sources":["../../../../../../../../../src/components/Table3/components/columns/styles.ts"],"sourcesContent":["import cn from 'clsx';\nimport { Table3ColumnAlignment } from '../../types';\nimport { getCellMinWidth } from '../../../../primitives/Table/
|
1
|
+
{"version":3,"file":"styles.js","sources":["../../../../../../../../../src/components/Table3/components/columns/styles.ts"],"sourcesContent":["import cn from 'clsx';\nimport { Table3ColumnAlignment } from '../../types';\nimport { getCellMinWidth } from '../../../../primitives/Table/useTableManager/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;;;;"}
|
@@ -5,7 +5,7 @@ import { useLocalization } from '../../../Provider/Localization.js';
|
|
5
5
|
import { Checkbox } from '../../../Checkbox/Checkbox.js';
|
6
6
|
import { Input } from '../../../Input/Input.js';
|
7
7
|
import { Popover } from '../../../Popover/Popover.js';
|
8
|
-
import { ensureOrdering } from '../../../../primitives/Table/
|
8
|
+
import { ensureOrdering } from '../../../../primitives/Table/useTableManager/util/columns.js';
|
9
9
|
import { Container } from '../../../../primitives/Sortable/components/Container.js';
|
10
10
|
import { arrayMove } from '@dnd-kit/sortable';
|
11
11
|
import { Item } from '../../../../primitives/Sortable/components/Item.js';
|
package/dist/esm/packages/taco/src/components/Table3/components/toolbar/ColumnSettings.js.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"ColumnSettings.js","sources":["../../../../../../../../../src/components/Table3/components/toolbar/ColumnSettings.tsx"],"sourcesContent":["import React from 'react';\nimport cn from 'clsx';\nimport { Table as RTable, Column as RTColumn, TableMeta } from '@tanstack/react-table';\nimport { isInternalColumn } from '../../util/columns';\nimport { useLocalization } from '../../../Provider/Localization';\nimport { Checkbox } from '../../../Checkbox/Checkbox';\nimport { Popover, PopoverProps } from '../../../Popover/Popover';\nimport { Input } from '../../../Input/Input';\nimport * as SortablePrimitive from '../../../../primitives/Sortable/Sortable';\nimport { Icon } from '../../../Icon/Icon';\nimport { ensureOrdering } from '../../../../primitives/Table/useTable/util/columns';\nimport { COLUMN_ID as ACTIONS_COLUMN_ID } from '../../components/columns/internal/Actions';\nimport { COLUMN_ID as EDITING_ACTIONS_COLUMN_ID } from '../../components/columns/internal/EditingActions';\n\ntype ColumnProps<TType = unknown> = React.HTMLAttributes<HTMLDivElement> & {\n column: RTColumn<TType, unknown>;\n draggable?: boolean;\n};\n\nconst Column = React.forwardRef(function Column<TType = unknown>(props: ColumnProps<TType>, ref: React.Ref<HTMLDivElement>) {\n const { column, draggable = false, ...dragAttributes } = props;\n const canHide = column.getCanHide();\n\n const className = cn('group/column flex items-center gap-x-2 rounded py-1 px-2', {\n 'hover:bg-grey-200': canHide || draggable,\n 'hover:cursor-pointer': canHide,\n 'active:cursor-move active:bg-grey-300': draggable,\n });\n\n const attributes = draggable ? dragAttributes : undefined;\n const isVisible = column.getIsVisible();\n\n const parentText = column.parent ? column.parent?.columnDef.meta?.header : null;\n\n return (\n <div {...attributes} key={column.id} className={className} onClick={() => column.toggleVisibility(!isVisible)} ref={ref}>\n {draggable ? <Icon name=\"drag\" className=\"text-grey-500 group-hover/column:text-grey-700 -mx-2 !h-5\" /> : null}\n <span className=\"flex-grow truncate\">\n {column.columnDef.meta?.header}\n {parentText ? <span className=\"italic\"> ({parentText})</span> : null}\n </span>\n {canHide ? <Checkbox checked={isVisible} onChange={() => column.toggleVisibility(!isVisible)} /> : null}\n </div>\n );\n});\n\nexport type ColumnSettingsProps<TType = unknown> = PopoverProps & {\n table: RTable<TType>;\n};\n\nexport function ColumnSettingsPopover<TType = unknown>(props: ColumnSettingsProps<TType>) {\n const { table, trigger, ...popoverProps } = props;\n const { texts } = useLocalization();\n const [query, setQuery] = React.useState('');\n const allColumns = table.getAllLeafColumns();\n const tableMeta = table.options.meta as TableMeta<TType>;\n const columns = React.useMemo(\n () =>\n allColumns\n .filter(column => !isInternalColumn(column.id))\n .filter(column =>\n query?.length\n ? column.columnDef.meta?.header.toLowerCase().includes(query.toLowerCase()) ||\n column.parent?.columnDef.meta?.header.toLowerCase().includes(query.toLowerCase())\n : true\n ),\n [allColumns, query]\n );\n\n const listClassName = 'flex max-h-64 flex-col gap-y-px overflow-auto';\n\n const handleReorder = (activeId, overId) => {\n if (columns.find(column => column.id === overId && column.columnDef.meta?.enableOrdering === false)) {\n return;\n }\n\n table.setColumnOrder(currentOrder =>\n ensureOrdering(\n allColumns,\n SortablePrimitive.arrayMove(\n currentOrder,\n currentOrder.findIndex(c => c === activeId),\n currentOrder.findIndex(c => c === overId)\n ),\n [ACTIONS_COLUMN_ID, EDITING_ACTIONS_COLUMN_ID]\n )\n );\n };\n\n return (\n <Popover {...popoverProps} anchor={trigger}>\n <Popover.Content>\n <div className=\"flex max-w-sm flex-col gap-2\">\n {table.options.enableHiding ? (\n <Input\n onChange={event => setQuery(event.target.value)}\n placeholder={texts.table3.columnSettings.search}\n value={query}\n />\n ) : null}\n {tableMeta.columnOrdering.isEnabled && columns.length && !query?.length ? (\n <SortablePrimitive.Container reorder={handleReorder}>\n <SortablePrimitive.List id=\"columns\" className={listClassName}>\n {columns.map(column => (\n <SortablePrimitive.Item\n key={column.id}\n id={column.id}\n disabled={!column.columnDef.meta?.enableOrdering}\n asChild>\n <Column column={column as any} draggable={column.columnDef.meta?.enableOrdering} />\n </SortablePrimitive.Item>\n ))}\n </SortablePrimitive.List>\n </SortablePrimitive.Container>\n ) : (\n <div className={listClassName}>\n {columns.length\n ? columns.map(column => <Column column={column as any} key={column.id} />)\n : texts.table3.columnSettings.noResults}\n </div>\n )}\n </div>\n </Popover.Content>\n </Popover>\n );\n}\n"],"names":["Column","React","forwardRef","props","ref","column","draggable","dragAttributes","canHide","getCanHide","className","cn","attributes","undefined","isVisible","getIsVisible","parentText","parent","_column$parent","_column$parent$column","columnDef","meta","header","key","id","onClick","toggleVisibility","Icon","name","_column$columnDef$met","Checkbox","checked","onChange","ColumnSettingsPopover","table","trigger","popoverProps","texts","useLocalization","query","setQuery","useState","allColumns","getAllLeafColumns","tableMeta","options","columns","useMemo","filter","isInternalColumn","_column$columnDef$met2","_column$parent2","_column$parent2$colum","length","toLowerCase","includes","listClassName","handleReorder","activeId","overId","find","_column$columnDef$met3","enableOrdering","setColumnOrder","currentOrder","ensureOrdering","SortablePrimitive","findIndex","c","ACTIONS_COLUMN_ID","EDITING_ACTIONS_COLUMN_ID","Popover","anchor","Content","enableHiding","Input","event","target","value","placeholder","table3","columnSettings","search","columnOrdering","isEnabled","reorder","map","_column$columnDef$met4","_column$columnDef$met5","disabled","asChild","noResults"],"mappings":";;;;;;;;;;;;;;;;AAmBA,MAAMA,MAAM,gBAAGC,cAAK,CAACC,UAAU,CAAC,SAASF,MAAMA,CAAkBG,KAAyB,EAAEC,GAA8B;;EACtH,MAAM;IAAEC,MAAM;IAAEC,SAAS,GAAG,KAAK;IAAE,GAAGC;GAAgB,GAAGJ,KAAK;EAC9D,MAAMK,OAAO,GAAGH,MAAM,CAACI,UAAU,EAAE;EAEnC,MAAMC,SAAS,GAAGC,EAAE,CAAC,0DAA0D,EAAE;IAC7E,mBAAmB,EAAEH,OAAO,IAAIF,SAAS;IACzC,sBAAsB,EAAEE,OAAO;IAC/B,uCAAuC,EAAEF;GAC5C,CAAC;EAEF,MAAMM,UAAU,GAAGN,SAAS,GAAGC,cAAc,GAAGM,SAAS;EACzD,MAAMC,SAAS,GAAGT,MAAM,CAACU,YAAY,EAAE;EAEvC,MAAMC,UAAU,GAAGX,MAAM,CAACY,MAAM,IAAAC,c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,CACmB,CACC,mBAE9B7D;IAAKS,SAAS,EAAE8C;KACXV,OAAO,CAACO,MAAM,GACTP,OAAO,CAACwC,GAAG,CAACjF,MAAM,iBAAIJ,6BAACD,MAAM;IAACK,MAAM,EAAEA,MAAa;IAAEkB,GAAG,EAAElB,MAAM,CAACmB;IAAM,CAAC,GACxEa,KAAK,CAAC2C,MAAM,CAACC,cAAc,CAACU,SAAS,CACzC,CACT,CACC,CACQ,CACZ;AAElB;;;;"}
|
1
|
+
{"version":3,"file":"ColumnSettings.js","sources":["../../../../../../../../../src/components/Table3/components/toolbar/ColumnSettings.tsx"],"sourcesContent":["import React from 'react';\nimport cn from 'clsx';\nimport { Table as RTable, Column as RTColumn, TableMeta } from '@tanstack/react-table';\nimport { isInternalColumn } from '../../util/columns';\nimport { useLocalization } from '../../../Provider/Localization';\nimport { Checkbox } from '../../../Checkbox/Checkbox';\nimport { Popover, PopoverProps } from '../../../Popover/Popover';\nimport { Input } from '../../../Input/Input';\nimport * as SortablePrimitive from '../../../../primitives/Sortable/Sortable';\nimport { Icon } from '../../../Icon/Icon';\nimport { ensureOrdering } from '../../../../primitives/Table/useTableManager/util/columns';\nimport { COLUMN_ID as ACTIONS_COLUMN_ID } from '../../components/columns/internal/Actions';\nimport { COLUMN_ID as EDITING_ACTIONS_COLUMN_ID } from '../../components/columns/internal/EditingActions';\n\ntype ColumnProps<TType = unknown> = React.HTMLAttributes<HTMLDivElement> & {\n column: RTColumn<TType, unknown>;\n draggable?: boolean;\n};\n\nconst Column = React.forwardRef(function Column<TType = unknown>(props: ColumnProps<TType>, ref: React.Ref<HTMLDivElement>) {\n const { column, draggable = false, ...dragAttributes } = props;\n const canHide = column.getCanHide();\n\n const className = cn('group/column flex items-center gap-x-2 rounded py-1 px-2', {\n 'hover:bg-grey-200': canHide || draggable,\n 'hover:cursor-pointer': canHide,\n 'active:cursor-move active:bg-grey-300': draggable,\n });\n\n const attributes = draggable ? dragAttributes : undefined;\n const isVisible = column.getIsVisible();\n\n const parentText = column.parent ? column.parent?.columnDef.meta?.header : null;\n\n return (\n <div {...attributes} key={column.id} className={className} onClick={() => column.toggleVisibility(!isVisible)} ref={ref}>\n {draggable ? <Icon name=\"drag\" className=\"text-grey-500 group-hover/column:text-grey-700 -mx-2 !h-5\" /> : null}\n <span className=\"flex-grow truncate\">\n {column.columnDef.meta?.header}\n {parentText ? <span className=\"italic\"> ({parentText})</span> : null}\n </span>\n {canHide ? <Checkbox checked={isVisible} onChange={() => column.toggleVisibility(!isVisible)} /> : null}\n </div>\n );\n});\n\nexport type ColumnSettingsProps<TType = unknown> = PopoverProps & {\n table: RTable<TType>;\n};\n\nexport function ColumnSettingsPopover<TType = unknown>(props: ColumnSettingsProps<TType>) {\n const { table, trigger, ...popoverProps } = props;\n const { texts } = useLocalization();\n const [query, setQuery] = React.useState('');\n const allColumns = table.getAllLeafColumns();\n const tableMeta = table.options.meta as TableMeta<TType>;\n const columns = React.useMemo(\n () =>\n allColumns\n .filter(column => !isInternalColumn(column.id))\n .filter(column =>\n query?.length\n ? column.columnDef.meta?.header.toLowerCase().includes(query.toLowerCase()) ||\n column.parent?.columnDef.meta?.header.toLowerCase().includes(query.toLowerCase())\n : true\n ),\n [allColumns, query]\n );\n\n const listClassName = 'flex max-h-64 flex-col gap-y-px overflow-auto';\n\n const handleReorder = (activeId, overId) => {\n if (columns.find(column => column.id === overId && column.columnDef.meta?.enableOrdering === false)) {\n return;\n }\n\n table.setColumnOrder(currentOrder =>\n ensureOrdering(\n allColumns,\n SortablePrimitive.arrayMove(\n currentOrder,\n currentOrder.findIndex(c => c === activeId),\n currentOrder.findIndex(c => c === overId)\n ),\n [ACTIONS_COLUMN_ID, EDITING_ACTIONS_COLUMN_ID]\n )\n );\n };\n\n return (\n <Popover {...popoverProps} anchor={trigger}>\n <Popover.Content>\n <div className=\"flex max-w-sm flex-col gap-2\">\n {table.options.enableHiding ? (\n <Input\n onChange={event => setQuery(event.target.value)}\n placeholder={texts.table3.columnSettings.search}\n value={query}\n />\n ) : null}\n {tableMeta.columnOrdering.isEnabled && columns.length && !query?.length ? (\n <SortablePrimitive.Container reorder={handleReorder}>\n <SortablePrimitive.List id=\"columns\" className={listClassName}>\n {columns.map(column => (\n <SortablePrimitive.Item\n key={column.id}\n id={column.id}\n disabled={!column.columnDef.meta?.enableOrdering}\n asChild>\n <Column column={column as any} draggable={column.columnDef.meta?.enableOrdering} />\n </SortablePrimitive.Item>\n ))}\n </SortablePrimitive.List>\n </SortablePrimitive.Container>\n ) : (\n <div className={listClassName}>\n {columns.length\n ? columns.map(column => <Column column={column as any} key={column.id} />)\n : texts.table3.columnSettings.noResults}\n </div>\n )}\n </div>\n </Popover.Content>\n </Popover>\n );\n}\n"],"names":["Column","React","forwardRef","props","ref","column","draggable","dragAttributes","canHide","getCanHide","className","cn","attributes","undefined","isVisible","getIsVisible","parentText","parent","_column$parent","_column$parent$column","columnDef","meta","header","key","id","onClick","toggleVisibility","Icon","name","_column$columnDef$met","Checkbox","checked","onChange","ColumnSettingsPopover","table","trigger","popoverProps","texts","useLocalization","query","setQuery","useState","allColumns","getAllLeafColumns","tableMeta","options","columns","useMemo","filter","isInternalColumn","_column$columnDef$met2","_column$parent2","_column$parent2$colum","length","toLowerCase","includes","listClassName","handleReorder","activeId","overId","find","_column$columnDef$met3","enableOrdering","setColumnOrder","currentOrder","ensureOrdering","SortablePrimitive","findIndex","c","ACTIONS_COLUMN_ID","EDITING_ACTIONS_COLUMN_ID","Popover","anchor","Content","enableHiding","Input","event","target","value","placeholder","table3","columnSettings","search","columnOrdering","isEnabled","reorder","map","_column$columnDef$met4","_column$columnDef$met5","disabled","asChild","noResults"],"mappings":";;;;;;;;;;;;;;;;AAmBA,MAAMA,MAAM,gBAAGC,cAAK,CAACC,UAAU,CAAC,SAASF,MAAMA,CAAkBG,KAAyB,EAAEC,GAA8B;;EACtH,MAAM;IAAEC,MAAM;IAAEC,SAAS,GAAG,KAAK;IAAE,GAAGC;GAAgB,GAAGJ,KAAK;EAC9D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M,CAACmB,EAAE;MACdA,EAAE,EAAEnB,MAAM,CAACmB,EAAE;MACbiE,QAAQ,EAAE,GAAAF,sBAAA,GAAClF,MAAM,CAACe,SAAS,CAACC,IAAI,cAAAkE,sBAAA,eAArBA,sBAAA,CAAuBzB,cAAc;MAChD4B,OAAO;oBACPzF,6BAACD,MAAM;MAACK,MAAM,EAAEA,MAAa;MAAEC,SAAS,GAAAkF,sBAAA,GAAEnF,MAAM,CAACe,SAAS,CAACC,IAAI,cAAAmE,sBAAA,uBAArBA,sBAAA,CAAuB1B;MAAkB,CAC9D;GAC5B,CAAC,CACmB,CACC,mBAE9B7D;IAAKS,SAAS,EAAE8C;KACXV,OAAO,CAACO,MAAM,GACTP,OAAO,CAACwC,GAAG,CAACjF,MAAM,iBAAIJ,6BAACD,MAAM;IAACK,MAAM,EAAEA,MAAa;IAAEkB,GAAG,EAAElB,MAAM,CAACmB;IAAM,CAAC,GACxEa,KAAK,CAAC2C,MAAM,CAACC,cAAc,CAACU,SAAS,CACzC,CACT,CACC,CACQ,CACZ;AAElB;;;;"}
|
package/dist/esm/packages/taco/src/components/Table3/components/toolbar/Filter/filters/Filters.js
CHANGED
@@ -10,13 +10,19 @@ import { Shortcut } from '../../../../../Shortcut/Shortcut.js';
|
|
10
10
|
import { useIsLargeScreen } from '../../../../../../hooks/useIsLargeScreen.js';
|
11
11
|
import { isInternalColumn } from '../../../../util/columns.js';
|
12
12
|
import { Table3FilterComparator } from '../../../../types.js';
|
13
|
-
import { Placeholder } from './components/Placeholder.js';
|
14
13
|
import { Filter } from './components/Filter.js';
|
15
14
|
|
16
15
|
function sortByHeader(a, b) {
|
17
16
|
var _a$columnDef$meta, _a$columnDef$meta$hea, _a$columnDef$meta$hea2, _b$columnDef$meta;
|
18
17
|
return (_a$columnDef$meta = a.columnDef.meta) === null || _a$columnDef$meta === void 0 ? void 0 : (_a$columnDef$meta$hea = _a$columnDef$meta.header) === null || _a$columnDef$meta$hea === void 0 ? void 0 : (_a$columnDef$meta$hea2 = _a$columnDef$meta$hea.localeCompare) === null || _a$columnDef$meta$hea2 === void 0 ? void 0 : _a$columnDef$meta$hea2.call(_a$columnDef$meta$hea, (_b$columnDef$meta = b.columnDef.meta) === null || _b$columnDef$meta === void 0 ? void 0 : _b$columnDef$meta.header);
|
19
18
|
}
|
19
|
+
const placeholderFilter = {
|
20
|
+
id: null,
|
21
|
+
value: {
|
22
|
+
comparator: Table3FilterComparator.Contains,
|
23
|
+
value: undefined
|
24
|
+
}
|
25
|
+
};
|
20
26
|
function FiltersButton(props) {
|
21
27
|
const {
|
22
28
|
total,
|
@@ -36,41 +42,28 @@ function FiltersButton(props) {
|
|
36
42
|
shift: true
|
37
43
|
};
|
38
44
|
// state, since we "apply" filters
|
39
|
-
const [filters, setFilters] = React__default.useState(appliedFilters);
|
40
|
-
const [placeholderCount, setPlaceholderCount] = React__default.useState(1);
|
45
|
+
const [filters, setFilters] = React__default.useState(appliedFilters.length ? appliedFilters : [placeholderFilter]);
|
41
46
|
// filters
|
42
|
-
const handleChangeFilter = (
|
47
|
+
const handleChangeFilter = (position, filter) => {
|
43
48
|
setFilters(currentFilters => {
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
49
|
+
return currentFilters.map((current, index) => {
|
50
|
+
if (index === position) {
|
51
|
+
return filter;
|
52
|
+
}
|
53
|
+
return current;
|
54
|
+
});
|
48
55
|
});
|
49
56
|
};
|
50
|
-
const handleRemoveFilter =
|
51
|
-
if (filters.length === 1
|
52
|
-
|
57
|
+
const handleRemoveFilter = position => {
|
58
|
+
if (filters.length === 1) {
|
59
|
+
setFilters([placeholderFilter]);
|
60
|
+
return;
|
53
61
|
}
|
54
|
-
setFilters(currentFilters => currentFilters.filter(
|
55
|
-
};
|
56
|
-
// placeholders
|
57
|
-
const handleCreateFilterFromPlaceholder = columnId => {
|
58
|
-
setFilters(currentFilters => [...currentFilters, {
|
59
|
-
id: columnId,
|
60
|
-
value: {
|
61
|
-
comparator: Table3FilterComparator.Contains,
|
62
|
-
value: undefined
|
63
|
-
}
|
64
|
-
}]);
|
65
|
-
handleRemovePlaceholder();
|
66
|
-
};
|
67
|
-
const handleCreatePlaceholder = () => {
|
68
|
-
setPlaceholderCount(count => count + 1);
|
62
|
+
setFilters(currentFilters => currentFilters.filter((_, index) => index !== position));
|
69
63
|
};
|
70
|
-
const
|
71
|
-
|
64
|
+
const handleCreateNew = () => {
|
65
|
+
setFilters(filters.concat(placeholderFilter));
|
72
66
|
};
|
73
|
-
//
|
74
67
|
const handleApply = () => {
|
75
68
|
table.setColumnFilters(() => {
|
76
69
|
const newFilters = filters.filter(f => {
|
@@ -90,20 +83,17 @@ function FiltersButton(props) {
|
|
90
83
|
};
|
91
84
|
const handleClear = () => {
|
92
85
|
table.resetColumnFilters();
|
93
|
-
setFilters([]);
|
94
|
-
setPlaceholderCount(1);
|
86
|
+
setFilters([placeholderFilter]);
|
95
87
|
};
|
96
88
|
const handleClose = React__default.useCallback(open => {
|
97
89
|
if (!open) {
|
98
|
-
setFilters(appliedFilters);
|
99
|
-
setPlaceholderCount(appliedFilters.length === 0 ? 1 : 0);
|
90
|
+
setFilters(appliedFilters.length === 0 ? [placeholderFilter] : appliedFilters);
|
100
91
|
}
|
101
92
|
}, [appliedFilters]);
|
102
93
|
// Because filters can be reset from outside
|
103
94
|
React__default.useEffect(() => {
|
104
95
|
if (appliedFilters.length === 0) {
|
105
|
-
setFilters([]);
|
106
|
-
setPlaceholderCount(1);
|
96
|
+
setFilters([placeholderFilter]);
|
107
97
|
}
|
108
98
|
}, [appliedFilters]);
|
109
99
|
const buttonProps = {
|
@@ -133,19 +123,12 @@ function FiltersButton(props) {
|
|
133
123
|
filters: filters,
|
134
124
|
position: index,
|
135
125
|
onChange: handleChangeFilter,
|
136
|
-
onRemove: handleRemoveFilter
|
137
|
-
}))), [...Array(placeholderCount)].map((_, index) => ( /*#__PURE__*/React__default.createElement(Placeholder, {
|
138
|
-
key: `placeholder_${index}`,
|
139
|
-
allColumns: allColumns,
|
140
|
-
filters: filters,
|
141
|
-
position: filters.length + index,
|
142
|
-
onCreate: handleCreateFilterFromPlaceholder,
|
143
|
-
onRemove: placeholderCount > 1 || filters.length > 0 ? handleRemovePlaceholder : undefined
|
126
|
+
onRemove: filters.length > 0 && filters.some(f => f.id) || filters.length > 1 ? handleRemoveFilter : undefined
|
144
127
|
}))), /*#__PURE__*/React__default.createElement("div", {
|
145
128
|
className: "justify-start"
|
146
129
|
}, /*#__PURE__*/React__default.createElement(Button, {
|
147
130
|
appearance: "discrete",
|
148
|
-
onClick:
|
131
|
+
onClick: handleCreateNew
|
149
132
|
}, "+ ", texts.table3.filters.buttons.addFilter))), /*#__PURE__*/React__default.createElement(Group, {
|
150
133
|
className: "ml-auto"
|
151
134
|
}, /*#__PURE__*/React__default.createElement(Popover.Close, null, /*#__PURE__*/React__default.createElement(Button, null, "Cancel")), /*#__PURE__*/React__default.createElement(Button, {
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"Filters.js","sources":["../../../../../../../../../../../src/components/Table3/components/toolbar/Filter/filters/Filters.tsx"],"sourcesContent":["import React from 'react';\nimport cn from 'clsx';\nimport { Table as RTable, Column as RTColumn } from '@tanstack/react-table';\nimport { Button } from '../../../../../Button/Button';\nimport { Icon } from '../../../../../Icon/Icon';\nimport { Popover } from '../../../../../Popover/Popover';\nimport { Table3FilterValue, Table3FilterComparator, Table3Filter, ColumnFilter } from '../../../../types';\nimport { Shortcut } from '../../../../../Shortcut/Shortcut';\nimport { useLocalization } from '../../../../../Provider/Localization';\nimport { isInternalColumn } from '../../../../util/columns';\nimport { Placeholder } from './components/Placeholder';\nimport { Filter } from './components/Filter';\nimport { Group } from '../../../../../Group/Group';\nimport { useIsLargeScreen } from '../../../../../../hooks/useIsLargeScreen';\nimport { IconButton } from '../../../../../IconButton/IconButton';\n\nfunction sortByHeader<TType = unknown>(a: RTColumn<TType>, b: RTColumn<TType>) {\n return (a.columnDef.meta?.header as string)?.localeCompare?.(b.columnDef.meta?.header as string);\n}\n\nexport type FiltersProps<TType = unknown> = {\n total: number;\n table: RTable<TType>;\n};\n\nexport function FiltersButton<TType = unknown>(props: FiltersProps<TType>) {\n const { total, table } = props;\n const { locale, texts } = useLocalization();\n const ref = React.useRef<HTMLButtonElement>(null);\n const isLargeScreen = useIsLargeScreen();\n const allColumns = table\n .getAllLeafColumns()\n .filter(column => !isInternalColumn(column.id))\n .sort(sortByHeader);\n const appliedFilters = table.getState().columnFilters as Table3Filter[];\n\n const shortcut = { key: 'f', meta: true, shift: true };\n\n // state, since we \"apply\" filters\n const [filters, setFilters] = React.useState<Table3Filter[]>(appliedFilters);\n const [placeholderCount, setPlaceholderCount] = React.useState(1);\n\n // filters\n const handleChangeFilter = (currentId: string | null, filter: { id: string | null; value: Table3FilterValue }) => {\n setFilters(currentFilters => {\n const nextFilters = [...currentFilters];\n const index = nextFilters.findIndex(f => f.id === currentId);\n nextFilters[index] = filter;\n return nextFilters;\n });\n };\n\n const handleRemoveFilter = (columnId: string | null) => {\n if (filters.length === 1 && placeholderCount === 0) {\n setPlaceholderCount(count => count + 1);\n }\n\n setFilters(currentFilters => currentFilters.filter(f => f.id !== columnId));\n };\n\n // placeholders\n const handleCreateFilterFromPlaceholder = (columnId: string) => {\n setFilters(currentFilters => [\n ...currentFilters,\n {\n id: columnId,\n value: {\n comparator: Table3FilterComparator.Contains,\n value: undefined,\n },\n },\n ]);\n handleRemovePlaceholder();\n };\n\n const handleCreatePlaceholder = () => {\n setPlaceholderCount(count => count + 1);\n };\n\n const handleRemovePlaceholder = () => {\n setPlaceholderCount(count => count - 1);\n };\n\n //\n const handleApply = () => {\n table.setColumnFilters(() => {\n const newFilters = filters.filter(f => {\n if (f.id === null) {\n return false;\n }\n\n const controlRenderer = (allColumns.find(c => c.id === f.id) as RTColumn<TType, unknown>)?.columnDef.meta\n ?.control;\n if (\n f.value.comparator === Table3FilterComparator.IsEmpty ||\n f.value.comparator === Table3FilterComparator.IsNotEmpty ||\n controlRenderer === 'switch'\n ) {\n return true;\n }\n return !!f.value.value;\n });\n // Compiler didn't get that we stripped out filters with null ids, so we still need to cast a ColumnFilter type here\n return newFilters as ColumnFilter[];\n });\n };\n\n const handleClear = () => {\n table.resetColumnFilters();\n setFilters([]);\n setPlaceholderCount(1);\n };\n\n const handleClose = React.useCallback(\n (open: boolean) => {\n if (!open) {\n setFilters(appliedFilters);\n setPlaceholderCount(appliedFilters.length === 0 ? 1 : 0);\n }\n },\n [appliedFilters]\n );\n\n // Because filters can be reset from outside\n React.useEffect(() => {\n if (appliedFilters.length === 0) {\n setFilters([]);\n setPlaceholderCount(1);\n }\n }, [appliedFilters]);\n\n const buttonProps = {\n 'aria-label': texts.table3.filters.tooltip,\n className: cn({ '!wcag-blue-100': appliedFilters.length }),\n shortcut,\n popover: popoverProps => (\n <Popover {...popoverProps} onChange={handleClose}>\n <Popover.Content>\n <div className=\"flex w-[40rem] flex-col gap-4\">\n <div className=\"flex h-8\">\n <div className=\"flex w-full items-center gap-2\">\n <h4 className=\"mb-0 inline-flex\">{texts.table3.filters.button}</h4>\n <p className=\"text-grey-700 mb-0 mr-auto mt-px inline-flex\">\n {texts.table3.filters.total\n .replace(\n '[CURRENT]',\n new Intl.NumberFormat(locale).format(table.getFilteredRowModel().rows.length)\n )\n .replace('[TOTAL]', new Intl.NumberFormat(locale).format(total))}\n </p>\n </div>\n </div>\n <div className=\"flex flex-col gap-2\">\n {filters.map((filter, index) => (\n <Filter\n key={`filter_${index}`}\n allColumns={allColumns as RTColumn<unknown, unknown>[]}\n filter={filter}\n filters={filters}\n position={index}\n onChange={handleChangeFilter}\n onRemove={handleRemoveFilter}\n />\n ))}\n {[...Array(placeholderCount)].map((_, index) => (\n <Placeholder\n key={`placeholder_${index}`}\n allColumns={allColumns as RTColumn<unknown, unknown>[]}\n filters={filters}\n position={filters.length + index}\n onCreate={handleCreateFilterFromPlaceholder as any}\n onRemove={placeholderCount > 1 || filters.length > 0 ? handleRemovePlaceholder : undefined}\n />\n ))}\n <div className=\"justify-start\">\n <Button appearance=\"discrete\" onClick={handleCreatePlaceholder}>\n + {texts.table3.filters.buttons.addFilter}\n </Button>\n </div>\n </div>\n <Group className=\"ml-auto\">\n <Popover.Close>\n <Button>Cancel</Button>\n </Popover.Close>\n <Button onClick={handleClear}>Clear</Button>\n <Button appearance=\"primary\" onClick={handleApply}>\n Apply\n </Button>\n </Group>\n </div>\n </Popover.Content>\n </Popover>\n ),\n ref,\n tooltip: (\n <>\n {texts.table3.filters.tooltip}\n <Shortcut className=\"ml-2\" keys={{ key: 'f', meta: true, shift: true }} />\n </>\n ),\n };\n\n if (!isLargeScreen && !appliedFilters.length) {\n return <IconButton {...buttonProps} icon=\"filter\" />;\n }\n return (\n <Button {...buttonProps}>\n <Icon className={cn({ '-mr-1.5': !isLargeScreen })} name={appliedFilters.length ? 'filter-solid' : 'filter'} />\n {isLargeScreen ? texts.table3.filters.button : ''}\n {appliedFilters.length ? `(${appliedFilters.length})` : ''}\n </Button>\n );\n}\n"],"names":["sortByHeader","a","b","_a$columnDef$meta","columnDef","meta","_a$columnDef$meta$hea","header","_a$columnDef$meta$hea2","localeCompare","call","_b$columnDef$meta","FiltersButton","props","total","table","locale","texts","useLocalization","ref","React","useRef","isLargeScreen","useIsLargeScreen","allColumns","getAllLeafColumns","filter","column","isInternalColumn","id","sort","appliedFilters","getState","columnFilters","shortcut","key","shift","filters","setFilters","useState","placeholderCount","setPlaceholderCount","handleChangeFilter","currentId","currentFilters","nextFilters","index","findIndex","f","handleRemoveFilter","columnId","length","count","handleCreateFilterFromPlaceholder","value","comparator","Table3FilterComparator","Contains","undefined","handleRemovePlaceholder","handleCreatePlaceholder","handleApply","setColumnFilters","newFilters","controlRenderer","_allColumns$find","find","c","_allColumns$find$colu","control","IsEmpty","IsNotEmpty","handleClear","resetColumnFilters","handleClose","useCallback","open","useEffect","buttonProps","table3","tooltip","className","cn","popover","popoverProps","Popover","onChange","Content","button","replace","Intl","NumberFormat","format","getFilteredRowModel","rows","map","Filter","position","onRemove","Array","_","Placeholder","onCreate","Button","appearance","onClick","buttons","addFilter","Group","Close","Shortcut","keys","IconButton","icon","Icon","name"],"mappings":";;;;;;;;;;;;;;;AAgBA,SAASA,YAAYA,CAAkBC,CAAkB,EAAEC,CAAkB;;EACzE,QAAAC,iBAAA,GAAQF,CAAC,CAACG,SAAS,CAACC,IAAI,cAAAF,iBAAA,wBAAAG,qBAAA,GAAhBH,iBAAA,CAAkBI,MAAiB,cAAAD,qBAAA,wBAAAE,sBAAA,GAAnCF,qBAAA,CAAqCG,aAAa,cAAAD,sBAAA,uBAAlDA,sBAAA,CAAAE,IAAA,CAAAJ,qBAAA,GAAAK,iBAAA,GAAqDT,CAAC,CAACE,SAAS,CAACC,IAAI,cAAAM,iBAAA,uBAAhBA,iBAAA,CAAkBJ,MAAgB,CAAC;AACpG;SAOgBK,aAAaA,CAAkBC,KAA0B;EACrE,MAAM;IAAEC,KAAK;IAAEC;GAAO,GAAGF,KAAK;EAC9B,MAAM;IAAEG,MAAM;IAAEC;GAAO,GAAGC,eAAe,EAAE;EAC3C,MAAMC,GAAG,GAAGC,cAAK,CAACC,MAAM,CAAoB,IAAI,CAAC;EACjD,MAAMC,aAAa,GAAGC,gBAAgB,EAAE;EACxC,MAAMC,UAAU,GAAGT,KAAK,CACnBU,iBAAiB,EAAE,CACnBC,MAAM,CAACC,MAAM,IAAI,CAACC,gBAAgB,CAACD,MAAM,CAACE,EAAE,CAAC,CAAC,CAC9CC,IAAI,CAAC9B,YAAY,CAAC;EACvB,MAAM+B,cAAc,GAAGhB,KAAK,CAACiB,QAAQ,EAAE,CAACC,aAA+B;EAEvE,MAAMC,QAAQ,GAAG;IAAEC,GAAG,EAAE,GAAG;IAAE9B,IAAI,EAAE,IAAI;IAAE+B,KAAK,EAAE;GAAM;;EAGtD,MAAM,CAACC,OAAO,EAAEC,UAAU,CAAC,GAAGlB,cAAK,CAACmB,QAAQ,CAAiBR,cAAc,CAAC;EAC5E,MAAM,CAACS,gBA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EAExD,oBACI7F,6BAACmF,MAAM,oBAAKzB,WAAW,gBACnB1D,6BAAC8F,IAAI;IAACjC,SAAS,EAAEC,EAAE,CAAC;MAAE,SAAS,EAAE,CAAC5D;KAAe,CAAC;IAAE6F,IAAI,EAAEpF,cAAc,CAACoB,MAAM,GAAG,cAAc,GAAG;IAAY,EAC9G7B,aAAa,GAAGL,KAAK,CAAC8D,MAAM,CAAC1C,OAAO,CAACmD,MAAM,GAAG,EAAE,EAChDzD,cAAc,CAACoB,MAAM,OAAOpB,cAAc,CAACoB,SAAS,GAAG,EAAE,CACrD;AAEjB;;;;"}
|
1
|
+
{"version":3,"file":"Filters.js","sources":["../../../../../../../../../../../src/components/Table3/components/toolbar/Filter/filters/Filters.tsx"],"sourcesContent":["import React from 'react';\nimport cn from 'clsx';\nimport { Table as RTable, Column as RTColumn } from '@tanstack/react-table';\nimport { Button } from '../../../../../Button/Button';\nimport { Icon } from '../../../../../Icon/Icon';\nimport { Popover } from '../../../../../Popover/Popover';\nimport { Table3FilterValue, Table3FilterComparator, Table3Filter, ColumnFilter } from '../../../../types';\nimport { Shortcut } from '../../../../../Shortcut/Shortcut';\nimport { useLocalization } from '../../../../../Provider/Localization';\nimport { isInternalColumn } from '../../../../util/columns';\nimport { Filter } from './components/Filter';\nimport { Group } from '../../../../../Group/Group';\nimport { useIsLargeScreen } from '../../../../../../hooks/useIsLargeScreen';\nimport { IconButton } from '../../../../../IconButton/IconButton';\n\nfunction sortByHeader<TType = unknown>(a: RTColumn<TType>, b: RTColumn<TType>) {\n return (a.columnDef.meta?.header as string)?.localeCompare?.(b.columnDef.meta?.header as string);\n}\n\nexport type FiltersProps<TType = unknown> = {\n total: number;\n table: RTable<TType>;\n};\n\nconst placeholderFilter: Table3Filter = { id: null, value: { comparator: Table3FilterComparator.Contains, value: undefined } };\n\nexport function FiltersButton<TType = unknown>(props: FiltersProps<TType>) {\n const { total, table } = props;\n const { locale, texts } = useLocalization();\n const ref = React.useRef<HTMLButtonElement>(null);\n const isLargeScreen = useIsLargeScreen();\n const allColumns = table\n .getAllLeafColumns()\n .filter(column => !isInternalColumn(column.id))\n .sort(sortByHeader);\n\n const appliedFilters = table.getState().columnFilters as Table3Filter[];\n const shortcut = { key: 'f', meta: true, shift: true };\n\n // state, since we \"apply\" filters\n const [filters, setFilters] = React.useState<Table3Filter[]>(appliedFilters.length ? appliedFilters : [placeholderFilter]);\n\n // filters\n const handleChangeFilter = (position: number, filter: { id: string | null; value: Table3FilterValue }) => {\n setFilters(currentFilters => {\n return currentFilters.map((current, index) => {\n if (index === position) {\n return filter;\n }\n return current;\n });\n });\n };\n\n const handleRemoveFilter = position => {\n if (filters.length === 1) {\n setFilters([placeholderFilter]);\n return;\n }\n\n setFilters(currentFilters => currentFilters.filter((_, index) => index !== position));\n };\n\n const handleCreateNew = () => {\n setFilters(filters.concat(placeholderFilter));\n };\n\n const handleApply = () => {\n table.setColumnFilters(() => {\n const newFilters = filters.filter(f => {\n if (f.id === null) {\n return false;\n }\n\n const controlRenderer = (allColumns.find(c => c.id === f.id) as RTColumn<TType, unknown>)?.columnDef.meta\n ?.control;\n if (\n f.value.comparator === Table3FilterComparator.IsEmpty ||\n f.value.comparator === Table3FilterComparator.IsNotEmpty ||\n controlRenderer === 'switch'\n ) {\n return true;\n }\n return !!f.value.value;\n });\n // Compiler didn't get that we stripped out filters with null ids, so we still need to cast a ColumnFilter type here\n return newFilters as ColumnFilter[];\n });\n };\n\n const handleClear = () => {\n table.resetColumnFilters();\n setFilters([placeholderFilter]);\n };\n\n const handleClose = React.useCallback(\n (open: boolean) => {\n if (!open) {\n setFilters(appliedFilters.length === 0 ? [placeholderFilter] : appliedFilters);\n }\n },\n [appliedFilters]\n );\n\n // Because filters can be reset from outside\n React.useEffect(() => {\n if (appliedFilters.length === 0) {\n setFilters([placeholderFilter]);\n }\n }, [appliedFilters]);\n\n const buttonProps = {\n 'aria-label': texts.table3.filters.tooltip,\n className: cn({ '!wcag-blue-100': appliedFilters.length }),\n shortcut,\n popover: popoverProps => (\n <Popover {...popoverProps} onChange={handleClose}>\n <Popover.Content>\n <div className=\"flex w-[40rem] flex-col gap-4\">\n <div className=\"flex h-8\">\n <div className=\"flex w-full items-center gap-2\">\n <h4 className=\"mb-0 inline-flex\">{texts.table3.filters.button}</h4>\n <p className=\"text-grey-700 mb-0 mr-auto mt-px inline-flex\">\n {texts.table3.filters.total\n .replace(\n '[CURRENT]',\n new Intl.NumberFormat(locale).format(table.getFilteredRowModel().rows.length)\n )\n .replace('[TOTAL]', new Intl.NumberFormat(locale).format(total))}\n </p>\n </div>\n </div>\n <div className=\"flex flex-col gap-2\">\n {filters.map((filter, index) => (\n <Filter\n key={`filter_${index}`}\n allColumns={allColumns}\n filter={filter}\n filters={filters}\n position={index}\n onChange={handleChangeFilter}\n onRemove={\n (filters.length > 0 && filters.some(f => f.id)) || filters.length > 1\n ? handleRemoveFilter\n : undefined\n }\n />\n ))}\n <div className=\"justify-start\">\n <Button appearance=\"discrete\" onClick={handleCreateNew}>\n + {texts.table3.filters.buttons.addFilter}\n </Button>\n </div>\n </div>\n <Group className=\"ml-auto\">\n <Popover.Close>\n <Button>Cancel</Button>\n </Popover.Close>\n <Button onClick={handleClear}>Clear</Button>\n <Button appearance=\"primary\" onClick={handleApply}>\n Apply\n </Button>\n </Group>\n </div>\n </Popover.Content>\n </Popover>\n ),\n ref,\n tooltip: (\n <>\n {texts.table3.filters.tooltip}\n <Shortcut className=\"ml-2\" keys={{ key: 'f', meta: true, shift: true }} />\n </>\n ),\n };\n\n if (!isLargeScreen && !appliedFilters.length) {\n return <IconButton {...buttonProps} icon=\"filter\" />;\n }\n return (\n <Button {...buttonProps}>\n <Icon className={cn({ '-mr-1.5': !isLargeScreen })} name={appliedFilters.length ? 'filter-solid' : 'filter'} />\n {isLargeScreen ? texts.table3.filters.button : ''}\n {appliedFilters.length ? `(${appliedFilters.length})` : ''}\n </Button>\n );\n}\n"],"names":["sortByHeader","a","b","_a$columnDef$meta","columnDef","meta","_a$columnDef$meta$hea","header","_a$columnDef$meta$hea2","localeCompare","call","_b$columnDef$meta","placeholderFilter","id","value","comparator","Table3FilterComparator","Contains","undefined","FiltersButton","props","total","table","locale","texts","useLocalization","ref","React","useRef","isLargeScreen","useIsLargeScreen","allColumns","getAllLeafColumns","filter","column","isInternalColumn","sort","appliedFilters","getState","columnFilters","shortcut","key","shift","filters","setFilters","useState","length","handleChangeFilter","position","currentFilters","map","current","index","handleRemoveFilter","_","handleCreateNew","concat","handleApply","setColumnFilters","newFilters","f","controlRenderer","_allColumns$find","find","c","_allColumns$find$colu","control","IsEmpty","IsNotEmpty","handleClear","resetColumnFilters","handleClose","useCallback","open","useEffect","buttonProps","table3","tooltip","className","cn","popover","popoverProps","Popover","onChange","Content","button","replace","Intl","NumberFormat","format","getFilteredRowModel","rows","Filter","onRemove","some","Button","appearance","onClick","buttons","addFilter","Group","Close","Shortcut","keys","IconButton","icon","Icon","name"],"mappings":";;;;;;;;;;;;;;AAeA,SAASA,YAAYA,CAAkBC,CAAkB,EAAEC,CAAkB;;EACzE,QAAAC,iBAAA,GAAQF,CAAC,CAACG,SAAS,CAACC,IAAI,cAAAF,iBAAA,wBAAAG,qBAAA,GAAhBH,iBAAA,CAAkBI,MAAiB,cAAAD,qBAAA,wBAAAE,sBAAA,GAAnCF,qBAAA,CAAqCG,aAAa,cAAAD,sBAAA,uBAAlDA,sBAAA,CAAAE,IAAA,CAAAJ,qBAAA,GAAAK,iBAAA,GAAqDT,CAAC,CAACE,SAAS,CAACC,IAAI,cAAAM,iBAAA,uBAAhBA,iBAAA,CAAkBJ,MAAgB,CAAC;AACpG;AAOA,MAAMK,iBAAiB,GAAiB;EAAEC,EAAE,EAAE,IAAI;EAAEC,KAAK,EAAE;IAAEC,UAAU,EAAEC,sBAAsB,CAACC,QAAQ;IAAEH,KAAK,EAAEI;;CAAa;SAE9GC,aAAaA,CAAkBC,KAA0B;EACrE,MAAM;IAAEC,KAAK;IAAEC;GAAO,GAAGF,KAAK;EA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AAG;IAAY,EAC9GjB,aAAa,GAAGL,KAAK,CAACoD,MAAM,CAACjC,OAAO,CAAC0C,MAAM,GAAG,EAAE,EAChDhD,cAAc,CAACS,MAAM,OAAOT,cAAc,CAACS,SAAS,GAAG,EAAE,CACrD;AAEjB;;;;"}
|
@@ -19,6 +19,7 @@ function Filter(props) {
|
|
19
19
|
texts
|
20
20
|
} = useLocalization();
|
21
21
|
const column = allColumns.find(c => c.id === filter.id);
|
22
|
+
const ref = React__default.useRef(null);
|
22
23
|
const {
|
23
24
|
id,
|
24
25
|
value: {
|
@@ -37,7 +38,7 @@ function Filter(props) {
|
|
37
38
|
comparator: null,
|
38
39
|
value: null
|
39
40
|
};
|
40
|
-
handleChange(
|
41
|
+
handleChange(position, {
|
41
42
|
id: columnId,
|
42
43
|
value
|
43
44
|
});
|
@@ -47,7 +48,7 @@ function Filter(props) {
|
|
47
48
|
if (comparator === Table3FilterComparator.IsEmpty || comparator === Table3FilterComparator.IsNotEmpty) {
|
48
49
|
nextValue = undefined;
|
49
50
|
}
|
50
|
-
handleChange(
|
51
|
+
handleChange(position, {
|
51
52
|
id,
|
52
53
|
value: {
|
53
54
|
comparator,
|
@@ -56,7 +57,7 @@ function Filter(props) {
|
|
56
57
|
});
|
57
58
|
};
|
58
59
|
const handleChangeValue = value => {
|
59
|
-
handleChange(
|
60
|
+
handleChange(position, {
|
60
61
|
id,
|
61
62
|
value: {
|
62
63
|
...filter.value,
|
@@ -64,7 +65,12 @@ function Filter(props) {
|
|
64
65
|
}
|
65
66
|
});
|
66
67
|
};
|
67
|
-
const handleRemove = () => onRemove(
|
68
|
+
const handleRemove = () => onRemove === null || onRemove === void 0 ? void 0 : onRemove(position);
|
69
|
+
React__default.useEffect(() => {
|
70
|
+
if (ref.current && !id) {
|
71
|
+
ref.current.focus(); // after adding a new filter placeholder, we want to focus it right way.
|
72
|
+
}
|
73
|
+
}, [id]);
|
68
74
|
return /*#__PURE__*/React__default.createElement("div", {
|
69
75
|
className: "flex items-start gap-2"
|
70
76
|
}, /*#__PURE__*/React__default.createElement("div", {
|
@@ -73,7 +79,8 @@ function Filter(props) {
|
|
73
79
|
allColumns: allColumns,
|
74
80
|
filters: filters,
|
75
81
|
onChange: handleChangeColumn,
|
76
|
-
value: id
|
82
|
+
value: id,
|
83
|
+
ref: ref
|
77
84
|
}), /*#__PURE__*/React__default.createElement(FilterComparator, {
|
78
85
|
column: column,
|
79
86
|
onChange: handleChangeComparator,
|
@@ -83,12 +90,12 @@ function Filter(props) {
|
|
83
90
|
comparator: comparator,
|
84
91
|
onChange: handleChangeValue,
|
85
92
|
value: value
|
86
|
-
}), /*#__PURE__*/React__default.createElement(IconButton, {
|
93
|
+
}), onRemove ? /*#__PURE__*/React__default.createElement(IconButton, {
|
87
94
|
appearance: "discrete",
|
88
95
|
className: "ml-auto",
|
89
96
|
icon: "close",
|
90
97
|
onClick: handleRemove
|
91
|
-
}));
|
98
|
+
}) : null);
|
92
99
|
}
|
93
100
|
|
94
101
|
export { Filter };
|