@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
package/dist/esm/packages/taco/src/components/Report/components/Header/components/Menu.js.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"Menu.js","sources":["../../../../../../../../../../src/components/Report/components/Header/components/Menu.tsx"],"sourcesContent":["import React from 'react';\nimport cn from 'clsx';\nimport { IconButton } from '../../../../IconButton/IconButton';\nimport { Menu as MenuPrimitive } from '../../../../Menu/Menu';\nimport { useLocalization } from '../../../../Provider/Localization';\nimport { GotoPopover } from './Goto';\nimport { TableColumnMenu, TableColumnSortDirection } from '../../../../../primitives/Table/types';\n\nexport type HeaderMenuProps = React.ButtonHTMLAttributes<HTMLButtonElement> & {\n canGoto: boolean;\n canHide: boolean;\n canPin: boolean;\n canSort: boolean;\n customMenu?: TableColumnMenu;\n index: number;\n onGoto?: (query: string) => Promise<number>;\n onHide?: (event: unknown) => void;\n onPin?: (index: number | undefined) => void;\n onSortToggle?: (sortDirection: TableColumnSortDirection | false) => void;\n // scrollToIndex: TableStrategy['scrollToIndex'];\n setRowActiveIndex: (index: number) => void;\n sortDirection?: TableColumnSortDirection | false;\n};\n\nexport function HeaderMenu(props: HeaderMenuProps) {\n const {\n canGoto,\n canHide,\n canPin,\n canSort,\n customMenu,\n index,\n onGoto: handleGoto,\n onHide: handleHide,\n onPin: handlePin,\n onSortToggle: handleSortToggle,\n // scrollToIndex,\n setRowActiveIndex,\n sortDirection,\n } = props;\n const { texts } = useLocalization();\n const [popover, setPopover] = React.useState<string | undefined>(undefined);\n\n let popoverElement;\n\n if (popover) {\n const handleClosePopover = () => setPopover(undefined);\n\n switch (popover) {\n case 'goto': {\n if (handleGoto) {\n const goto = async (query: string) => {\n try {\n const index = await handleGoto(query);\n // scroll to first, row active might not be enabled\n //scrollToIndex(index + 2, { align: 'center' });\n setRowActiveIndex(index);\n } catch (e) {\n console.error(e);\n //\n } finally {\n handleClosePopover();\n }\n };\n popoverElement = props => <GotoPopover {...props} open onChange={handleClosePopover} onGoto={goto} />;\n }\n }\n }\n }\n\n const memoedMenuItems = React.useMemo(() => {\n const menuItems: JSX.Element[] = [];\n\n if (canHide && handleHide) {\n // we do this in the next tick, otherwise the menu closes and react throws a \"state update on unmounted component\" error\n const handleClick = event => setTimeout(() => handleHide(event), 1);\n\n menuItems.push(\n <MenuPrimitive.Item icon=\"eye-off\" onClick={handleClick}>\n {texts.table3.columns.menu.hideColumn}\n </MenuPrimitive.Item>\n );\n }\n\n if (canSort) {\n menuItems.push(\n <MenuPrimitive.Item\n icon=\"sort-by\"\n subMenu={() => (\n <MenuPrimitive.SubMenu>\n <MenuPrimitive.RadioGroup onChange={handleSortToggle as any} value={sortDirection}>\n <MenuPrimitive.RadioGroup.Item value=\"asc\">\n {texts.table3.columns.menu.sortingOrder.ascending}\n </MenuPrimitive.RadioGroup.Item>\n <MenuPrimitive.RadioGroup.Item value=\"desc\">\n {texts.table3.columns.menu.sortingOrder.descending}\n </MenuPrimitive.RadioGroup.Item>\n <MenuPrimitive.RadioGroup.Item value={false}>\n {texts.table3.columns.menu.sortingOrder.unsorted}\n </MenuPrimitive.RadioGroup.Item>\n </MenuPrimitive.RadioGroup>\n </MenuPrimitive.SubMenu>\n )}>\n {texts.table3.columns.menu.sorting}\n </MenuPrimitive.Item>\n );\n }\n\n if (canGoto) {\n menuItems.push(\n <MenuPrimitive.Item icon=\"move\" onClick={() => setPopover('goto')} shortcut=\"g\">\n {texts.table3.columns.menu.gotoRow}...\n </MenuPrimitive.Item>\n );\n }\n\n if (canPin && handlePin) {\n menuItems.push(\n <MenuPrimitive.Item icon=\"column-freeze\" onClick={() => handlePin(index)}>\n {index === 0\n ? texts.table3.columns.menu.freezeFirstColumn\n : texts.table3.columns.menu.freezeUptoColumn.replace('[TOTAL]', String(index + 1))}\n </MenuPrimitive.Item>\n );\n\n menuItems.push(\n <MenuPrimitive.Item icon=\"column-unfreeze\" onClick={() => handlePin(undefined)}>\n {texts.table3.columns.menu.unfreezeColumns}\n </MenuPrimitive.Item>\n );\n }\n\n if (customMenu) {\n const menu = customMenu({ trigger: undefined });\n const customItems = React.Children.toArray(menu.props.children.props.children) as JSX.Element[];\n\n if (customItems.length) {\n if (menuItems.length) {\n menuItems.push(<MenuPrimitive.Separator />);\n }\n\n menuItems.push(...customItems);\n }\n }\n\n return menuItems.map((item, key) => React.cloneElement(item, { key }));\n }, [canGoto, canHide, canPin, canSort, customMenu, handleGoto, handleSortToggle, index, sortDirection]);\n\n // can't use display: none because the button needs to be focusable\n const className = cn(\n // positioning\n 'justify-end -mr-1 overflow-hidden',\n // sizing\n '!h-6 !w-0 !min-h-[theme(spacing.6)] !min-w-0',\n // visible - hover\n 'group-hover/header:!w-6 group-hover/header:!min-w-[theme(spacing.6)]',\n // visible - expanded\n 'aria-expanded:!w-6 aria-expanded:!min-w-[theme(spacing.6)]',\n // visible - focus\n 'focus:!w-6 focus:!min-w-[theme(spacing.6)]',\n {\n '!w-6 !min-w-[theme(spacing.6)]': !!popoverElement,\n },\n props.className\n );\n\n return (\n <IconButton\n className={className}\n icon=\"more\"\n menu={\n popoverElement\n ? undefined\n : menuProps => (\n <MenuPrimitive {...menuProps}>\n <MenuPrimitive.Content>{memoedMenuItems}</MenuPrimitive.Content>\n </MenuPrimitive>\n )\n }\n popover={popoverElement}\n onClickCapture={event => event.preventDefault()}\n />\n );\n}\n"],"names":["HeaderMenu","props","canGoto","canHide","canPin","canSort","customMenu","index","onGoto","handleGoto","onHide","handleHide","onPin","handlePin","onSortToggle","handleSortToggle","setRowActiveIndex","sortDirection","texts","useLocalization","popover","setPopover","React","useState","undefined","popoverElement","handleClosePopover","goto","query","Promise","resolve","then","e","console","error","_wasThrown","_result","_temp","reject","GotoPopover","open","onChange","memoedMenuItems","useMemo","menuItems","handleClick","event","setTimeout","push","MenuPrimitive","Item","icon","onClick","table3","columns","menu","hideColumn","subMenu","SubMenu","RadioGroup","value","sortingOrder","ascending","descending","unsorted","sorting","shortcut","gotoRow","freezeFirstColumn","freezeUptoColumn","replace","String","unfreezeColumns","trigger","customItems","Children","toArray","children","length","Separator","map","item","key","cloneElement","className","cn","IconButton","menuProps","Content","onClickCapture","preventDefault"],"mappings":";;;;;;;;SAwBgBA,UAAUA,CAACC,KAAsB;EAC7C,MAAM;IACFC,OAAO;IACPC,OAAO;IACPC,MAAM;IACNC,OAAO;IACPC,UAAU;IACVC,KAAK;IACLC,MAAM,EAAEC,UAAU;IAClBC,MAAM,EAAE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I,EAAEC,GAAG,kBAAK5D,cAAK,CAAC6D,YAAY,CAACF,IAAI,EAAE;MAAEC;KAAK,CAAC,CAAC;GACzE,EAAE,CAAChF,OAAO,EAAEC,OAAO,EAAEC,MAAM,EAAEC,OAAO,EAAEC,UAAU,EAAEG,UAAU,EAAEM,gBAAgB,EAAER,KAAK,EAAEU,aAAa,CAAC,CAAC;;EAGvG,MAAMmE,SAAS,GAAGC,EAAE;;EAEhB,mCAAmC;;EAEnC,8CAA8C;;EAE9C,sEAAsE;;EAEtE,4DAA4D;;EAE5D,4CAA4C,EAC5C;IACI,gCAAgC,EAAE,CAAC,CAAC5D;GACvC,EACDxB,KAAK,CAACmF,SAAS,CAClB;EAED,oBACI9D,6BAACgE,UAAU;IACPF,SAAS,EAAEA,SAAS;IACpBjC,IAAI,EAAC,MAAM;IACXI,IAAI,EACA9B,cAAc,GACRD,SAAS,GACT+D,SAAS,mBACLjE,6BAAC2B,IAAa,oBAAKsC,SAAS,gBACxBjE,6BAAC2B,IAAa,CAACuC,OAAO,QAAE9C,eAAe,CAAyB,CACpD,CACnB;IAEXtB,OAAO,EAAEK,cAAc;IACvBgE,cAAc,EAAE3C,KAAK,IAAIA,KAAK,CAAC4C,cAAc;IAC/C;AAEV;;;;"}
|
1
|
+
{"version":3,"file":"Menu.js","sources":["../../../../../../../../../../src/components/Report/components/Header/components/Menu.tsx"],"sourcesContent":["import React from 'react';\nimport cn from 'clsx';\nimport { IconButton } from '../../../../IconButton/IconButton';\nimport { Menu as MenuPrimitive } from '../../../../Menu/Menu';\nimport { useLocalization } from '../../../../Provider/Localization';\nimport { GotoPopover } from './Goto';\nimport { TableColumnMenu, TableColumnSortDirection } from '../../../../../primitives/Table/types';\n\nexport type HeaderMenuProps = React.ButtonHTMLAttributes<HTMLButtonElement> & {\n canFilter: boolean;\n canGoto: boolean;\n canHide: boolean;\n canPin: boolean;\n canSort: boolean;\n customMenu?: TableColumnMenu;\n index: number;\n isFiltered: boolean;\n onFilter?: () => void;\n onGoto?: (query: string) => Promise<number>;\n onHide?: (event: unknown) => void;\n onPin?: (index: number | undefined) => void;\n onSortToggle?: (sortDirection: TableColumnSortDirection | false) => void;\n // scrollToIndex: TableStrategy['scrollToIndex'];\n setRowActiveIndex: (index: number) => void;\n sortDirection?: TableColumnSortDirection | false;\n};\n\nexport function HeaderMenu(props: HeaderMenuProps) {\n const {\n canFilter,\n canGoto,\n canHide,\n canPin,\n canSort,\n customMenu,\n index,\n isFiltered,\n onFilter: handleFilter,\n onGoto: handleGoto,\n onHide: handleHide,\n onPin: handlePin,\n onSortToggle: handleSortToggle,\n // scrollToIndex,\n setRowActiveIndex,\n sortDirection,\n } = props;\n const { texts } = useLocalization();\n const [popover, setPopover] = React.useState<string | undefined>(undefined);\n\n let popoverElement;\n\n if (popover) {\n const handleClosePopover = () => setPopover(undefined);\n\n switch (popover) {\n case 'goto': {\n if (handleGoto) {\n const goto = async (query: string) => {\n try {\n const index = await handleGoto(query);\n // scroll to first, row active might not be enabled\n //scrollToIndex(index + 2, { align: 'center' });\n setRowActiveIndex(index);\n } catch (e) {\n console.error(e);\n //\n } finally {\n handleClosePopover();\n }\n };\n popoverElement = props => <GotoPopover {...props} open onChange={handleClosePopover} onGoto={goto} />;\n }\n }\n }\n }\n\n const memoedMenuItems = React.useMemo(() => {\n const menuItems: JSX.Element[] = [];\n\n if (canHide && handleHide) {\n // we do this in the next tick, otherwise the menu closes and react throws a \"state update on unmounted component\" error\n const handleClick = event => setTimeout(() => handleHide(event), 1);\n\n menuItems.push(\n <MenuPrimitive.Item icon=\"eye-off\" onClick={handleClick}>\n {texts.table3.columns.menu.hideColumn}\n </MenuPrimitive.Item>\n );\n }\n\n if (canSort) {\n menuItems.push(\n <MenuPrimitive.Item\n icon=\"sort-by\"\n subMenu={() => (\n <MenuPrimitive.SubMenu>\n <MenuPrimitive.RadioGroup onChange={handleSortToggle as any} value={sortDirection}>\n <MenuPrimitive.RadioGroup.Item value=\"asc\">\n {texts.table3.columns.menu.sortingOrder.ascending}\n </MenuPrimitive.RadioGroup.Item>\n <MenuPrimitive.RadioGroup.Item value=\"desc\">\n {texts.table3.columns.menu.sortingOrder.descending}\n </MenuPrimitive.RadioGroup.Item>\n <MenuPrimitive.RadioGroup.Item value={false}>\n {texts.table3.columns.menu.sortingOrder.unsorted}\n </MenuPrimitive.RadioGroup.Item>\n </MenuPrimitive.RadioGroup>\n </MenuPrimitive.SubMenu>\n )}>\n {texts.table3.columns.menu.sorting}\n </MenuPrimitive.Item>\n );\n }\n\n if (canGoto) {\n menuItems.push(\n <MenuPrimitive.Item icon=\"move\" onClick={() => setPopover('goto')} shortcut=\"g\">\n {texts.table3.columns.menu.gotoRow}...\n </MenuPrimitive.Item>\n );\n }\n\n if (canPin && handlePin) {\n menuItems.push(\n <MenuPrimitive.Item icon=\"column-freeze\" onClick={() => handlePin(index)}>\n {index === 0\n ? texts.table3.columns.menu.freezeFirstColumn\n : texts.table3.columns.menu.freezeUptoColumn.replace('[TOTAL]', String(index + 1))}\n </MenuPrimitive.Item>\n );\n\n menuItems.push(\n <MenuPrimitive.Item icon=\"column-unfreeze\" onClick={() => handlePin(undefined)}>\n {texts.table3.columns.menu.unfreezeColumns}\n </MenuPrimitive.Item>\n );\n }\n if (canFilter && handleFilter) {\n menuItems.push(\n <MenuPrimitive.Item icon={isFiltered ? 'filter-solid' : 'filter'} onClick={() => handleFilter()}>\n {isFiltered ? texts.table3.columns.menu.editFilter : texts.table3.columns.menu.filter}\n </MenuPrimitive.Item>\n );\n }\n\n if (customMenu) {\n const menu = customMenu({ trigger: undefined });\n const customItems = React.Children.toArray(menu.props.children.props.children) as JSX.Element[];\n\n if (customItems.length) {\n if (menuItems.length) {\n menuItems.push(<MenuPrimitive.Separator />);\n }\n\n menuItems.push(...customItems);\n }\n }\n\n return menuItems.map((item, key) => React.cloneElement(item, { key }));\n }, [\n canFilter,\n canGoto,\n canHide,\n canPin,\n canSort,\n customMenu,\n handleGoto,\n handleSortToggle,\n index,\n isFiltered,\n sortDirection,\n ]);\n\n // can't use display: none because the button needs to be focusable\n const className = cn(\n // positioning\n 'justify-end -mr-1 overflow-hidden',\n // sizing\n '!h-6 !w-0 !min-h-[theme(spacing.6)] !min-w-0',\n // visible - hover\n 'group-hover/header:!w-6 group-hover/header:!min-w-[theme(spacing.6)]',\n // visible - expanded\n 'aria-expanded:!w-6 aria-expanded:!min-w-[theme(spacing.6)]',\n // visible - focus\n 'focus:!w-6 focus:!min-w-[theme(spacing.6)]',\n {\n '!w-6 !min-w-[theme(spacing.6)]': !!popoverElement,\n },\n props.className\n );\n\n return (\n <IconButton\n className={className}\n icon=\"more\"\n menu={\n popoverElement\n ? undefined\n : menuProps => (\n <MenuPrimitive {...menuProps}>\n <MenuPrimitive.Content>{memoedMenuItems}</MenuPrimitive.Content>\n </MenuPrimitive>\n )\n }\n popover={popoverElement}\n onClickCapture={event => event.preventDefault()}\n />\n );\n}\n"],"names":["HeaderMenu","props","canFilter","canGoto","canHide","canPin","canSort","customMenu","index","isFiltered","onFilter","handleFilter","onGoto","handleGoto","onHide","handleHide","onPin","handlePin","onSortToggle","handleSortToggle","setRowActiveIndex","sortDirection","texts","useLocalization","popover","setPopover","React","useState","undefined","popoverElement","handleClosePopover","goto","query","Promise","resolve","then","e","console","error","_wasThrown","_result","_temp","reject","GotoPopover","open","onChange","memoedMenuItems","useMemo","menuItems","handleClick","event","setTimeout","push","MenuPrimitive","Item","icon","onClick","table3","columns","menu","hideColumn","subMenu","SubMenu","RadioGroup","value","sortingOrder","ascending","descending","unsorted","sorting","shortcut","gotoRow","freezeFirstColumn","freezeUptoColumn","replace","String","unfreezeColumns","editFilter","filter","trigger","customItems","Children","toArray","children","length","Separator","map","item","key","cloneElement","className","cn","IconButton","menuProps","Content","onClickCapture","preventDefault"],"mappings":";;;;;;;;SA2BgBA,UAAUA,CAACC,KAAsB;EAC7C,MAAM;IACFC,SAAS;IACTC,OAAO;IACPC,OAAO;IACPC,MAAM;IACNC,OAAO;IACPC,UAAU;I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|
@@ -1,5 +1,5 @@
|
|
1
1
|
import React__default from 'react';
|
2
|
-
import { isInternalColumn } from '../../../../primitives/Table/
|
2
|
+
import { isInternalColumn } from '../../../../primitives/Table/useTableManager/util/columns.js';
|
3
3
|
|
4
4
|
function useSetInitialColumnSizing(id, defaultWidth, width, element, canMeasureSize, setColumnSizing) {
|
5
5
|
React__default.useEffect(() => {
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"util.js","sources":["../../../../../../../../../src/components/Report/components/Header/util.ts"],"sourcesContent":["import React from 'react';\nimport { Header as ReactTableHeader, ColumnPinningPosition as ReactTableColumnPinningPosition } from '@tanstack/react-table';\nimport { TableColumnWidth } from '../../../../primitives/Table/types';\nimport { isInternalColumn } from '../../../../primitives/Table/
|
1
|
+
{"version":3,"file":"util.js","sources":["../../../../../../../../../src/components/Report/components/Header/util.ts"],"sourcesContent":["import React from 'react';\nimport { Header as ReactTableHeader, ColumnPinningPosition as ReactTableColumnPinningPosition } from '@tanstack/react-table';\nimport { TableColumnWidth } from '../../../../primitives/Table/types';\nimport { isInternalColumn } from '../../../../primitives/Table/useTableManager/util/columns';\n\nexport function useSetInitialColumnSizing(\n id: string,\n defaultWidth: TableColumnWidth | undefined,\n width: TableColumnWidth | undefined,\n element: HTMLTableCellElement | null,\n canMeasureSize: boolean,\n setColumnSizing: any\n) {\n React.useEffect(() => {\n // columns that aren't set to grow must set a pixel width...\n // otherwise when scrolling through the table, the column widths adjust based on the content\n // of the column, this is because to the virtualisation mounting new rows and unmounting old ones\n if (canMeasureSize && element && !Number.isInteger(width) && !isInternalColumn(id) && defaultWidth !== 'grow') {\n setColumnSizing(sizes => ({\n ...sizes,\n [id]: element.getBoundingClientRect().width,\n }));\n }\n }, [element, canMeasureSize, width]);\n}\n\nexport function getIsPinned<TType = unknown>(\n header: ReactTableHeader<TType, unknown>\n): ReactTableColumnPinningPosition | undefined {\n // TODO: Is there a native function that does this check for groups?\n return header.subHeaders?.length\n ? header.subHeaders.find(x => x.column.getIsPinned())?.column.getIsPinned()\n : header.column.getIsPinned();\n}\n"],"names":["useSetInitialColumnSizing","id","defaultWidth","width","element","canMeasureSize","setColumnSizing","React","useEffect","Number","isInteger","isInternalColumn","sizes","getBoundingClientRect","getIsPinned","header","_header$subHeaders","subHeaders","length","_header$subHeaders$fi","find","x","column"],"mappings":";;;SAKgBA,yBAAyBA,CACrCC,EAAU,EACVC,YAA0C,EAC1CC,KAAmC,EACnCC,OAAoC,EACpCC,cAAuB,EACvBC,eAAoB;EAEpBC,cAAK,CAACC,SAAS,CAAC;;;;IAIZ,IAAIH,cAAc,IAAID,OAAO,IAAI,CAACK,MAAM,CAACC,SAAS,CAACP,KAAK,CAAC,IAAI,CAACQ,gBAAgB,CAACV,EAAE,CAAC,IAAIC,YAAY,KAAK,MAAM,EAAE;MAC3GI,eAAe,CAACM,KAAK,KAAK;QACtB,GAAGA,KAAK;QACR,CAACX,EAAE,GAAGG,OAAO,CAACS,qBAAqB,EAAE,CAACV;OACzC,CAAC,CAAC;;GAEV,EAAE,CAACC,OAAO,EAAEC,cAAc,EAAEF,KAAK,CAAC,CAAC;AACxC;SAEgBW,WAAWA,CACvBC,MAAwC;;;EAGxC,OAAO,CAAAC,kBAAA,GAAAD,MAAM,CAACE,UAAU,cAAAD,kBAAA,eAAjBA,kBAAA,CAAmBE,MAAM,IAAAC,qBAAA,GAC1BJ,MAAM,CAACE,UAAU,CAACG,IAAI,CAACC,CAAC,IAAIA,CAAC,CAACC,MAAM,CAACR,WAAW,EAAE,CAAC,cAAAK,qBAAA,uBAAnDA,qBAAA,CAAqDG,MAAM,CAACR,WAAW,EAAE,GACzEC,MAAM,CAACO,MAAM,CAACR,WAAW,EAAE;AACrC;;;;"}
|
@@ -5,6 +5,8 @@ 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';
|
9
|
+
import { RowContext } from '../Row/RowContext.js';
|
8
10
|
|
9
11
|
function Header(context) {
|
10
12
|
const {
|
@@ -43,6 +45,7 @@ function Header(context) {
|
|
43
45
|
key: String(`${isAllRowsSelected}_${isSomeRowsSelected}`),
|
44
46
|
checked: isAllRowsSelected,
|
45
47
|
indeterminate: isSomeRowsSelected,
|
48
|
+
loading: tableMeta.server.loadAllStatus === TableServerLoadAllState.Loading,
|
46
49
|
onChange: handleChange
|
47
50
|
}));
|
48
51
|
}
|
@@ -62,6 +65,9 @@ function Cell(context) {
|
|
62
65
|
row,
|
63
66
|
table
|
64
67
|
} = context;
|
68
|
+
const {
|
69
|
+
rowIndex
|
70
|
+
} = React__default.useContext(RowContext);
|
65
71
|
const tableMeta = table.options.meta;
|
66
72
|
if (table.options.enableGrouping && (_table$getState$group = table.getState().grouping) !== null && _table$getState$group !== void 0 && _table$getState$group.length && !row.getIsGrouped()) {
|
67
73
|
return null;
|
@@ -69,18 +75,48 @@ function Cell(context) {
|
|
69
75
|
const isSelected = row.getIsGrouped() ? row.getIsAllSubRowsSelected() : row.getIsSelected();
|
70
76
|
const title = isSelected ? texts.table3.columns.select.deselect : texts.table3.columns.select.select;
|
71
77
|
if (table.options.enableMultiRowSelection) {
|
72
|
-
const handleClick = event
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
const
|
79
|
-
|
80
|
-
|
81
|
-
|
78
|
+
const handleClick = function (event) {
|
79
|
+
try {
|
80
|
+
function _temp7() {
|
81
|
+
tableMeta.rowSelection.lastSelectedRowIndex.current = row.index;
|
82
|
+
}
|
83
|
+
event.stopPropagation();
|
84
|
+
const _temp6 = function () {
|
85
|
+
if (row.getIsGrouped()) {
|
86
|
+
row.subRows.forEach(row => row.toggleSelected());
|
87
|
+
} else {
|
88
|
+
const _temp5 = function () {
|
89
|
+
if (event.shiftKey) {
|
90
|
+
var _tableMeta$rowSelecti;
|
91
|
+
function _temp4() {
|
92
|
+
table.setRowSelection(currentRowSelection => ({
|
93
|
+
...currentRowSelection,
|
94
|
+
...selectedRows.reduce((state, row) => ({
|
95
|
+
...state,
|
96
|
+
[row.id]: true
|
97
|
+
}), {})
|
98
|
+
}));
|
99
|
+
}
|
100
|
+
const [fromIndex, toIndex] = toggleBetween((_tableMeta$rowSelecti = tableMeta.rowSelection.lastSelectedRowIndex.current) !== null && _tableMeta$rowSelecti !== void 0 ? _tableMeta$rowSelecti : 0, rowIndex);
|
101
|
+
const selectedRows = table.getRowModel().rows.slice(fromIndex, toIndex + 1);
|
102
|
+
const _temp3 = function () {
|
103
|
+
if (tableMeta.server.loadAllIfNeeded && selectedRows.some(row => row.original === undefined)) {
|
104
|
+
// don't pass the search query because we need all data - not filtered data
|
105
|
+
return Promise.resolve(tableMeta.server.loadAllIfNeeded(table.getState().sorting, table.getState().columnFilters, undefined)).then(function () {});
|
106
|
+
}
|
107
|
+
}();
|
108
|
+
return _temp3 && _temp3.then ? _temp3.then(_temp4) : _temp4(_temp3);
|
109
|
+
} else {
|
110
|
+
row.toggleSelected();
|
111
|
+
}
|
112
|
+
}();
|
113
|
+
if (_temp5 && _temp5.then) return _temp5.then(function () {});
|
114
|
+
}
|
115
|
+
}();
|
116
|
+
return Promise.resolve(_temp6 && _temp6.then ? _temp6.then(_temp7) : _temp7(_temp6));
|
117
|
+
} catch (e) {
|
118
|
+
return Promise.reject(e);
|
82
119
|
}
|
83
|
-
tableMeta.rowSelection.lastSelectedRowIndex.current = row.index;
|
84
120
|
};
|
85
121
|
return /*#__PURE__*/React__default.createElement(Tooltip, {
|
86
122
|
title: /*#__PURE__*/React__default.createElement(React__default.Fragment, null, title, /*#__PURE__*/React__default.createElement(Shortcut, {
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"Selection.js","sources":["../../../../../../../../../src/components/Report/components/Internal/Selection.tsx"],"sourcesContent":["import React from 'react';\nimport {\n HeaderContext as ReactTableHeaderContext,\n CellContext as ReactTableCellContext,\n TableMeta as ReactTableMeta,\n} from '@tanstack/react-table';\nimport cn from 'clsx';\nimport { useLocalization } from '../../../Provider/Localization';\nimport { Tooltip } from '../../../Tooltip/Tooltip';\nimport { Checkbox } from '../../../Checkbox/Checkbox';\nimport { Shortcut } from '../../../Shortcut/Shortcut';\nimport { getRadioClassnames } from '../../../RadioGroup/util';\n\nexport function Header<TType = unknown>(context: ReactTableHeaderContext<TType, unknown>) {\n const { texts } = useLocalization();\n const { table } = context;\n const tableMeta = table.options.meta as ReactTableMeta<TType>;\n\n if (table.options.enableMultiRowSelection) {\n const isAllRowsSelected = table.getIsAllRowsSelected();\n const isSomeRowsSelected = table.getIsSomeRowsSelected();\n const title = isAllRowsSelected ? texts.table3.columns.select.deselectAll : texts.table3.columns.select.selectAll;\n\n const handleChange = async (checked: boolean) => {\n // load all data if that is possible\n if (tableMeta.server.loadAllIfNeeded) {\n // don't pass the search query because we need all data - not filtered data\n await tableMeta.server.loadAllIfNeeded(table.getState().sorting, table.getState().columnFilters, undefined);\n }\n\n table.toggleAllRowsSelected(checked);\n };\n\n return (\n <Tooltip title={title}>\n <Checkbox\n aria-label={title}\n className=\"hover:border-blue !-mt-px\"\n key={String(`${isAllRowsSelected}_${isSomeRowsSelected}`)}\n checked={isAllRowsSelected}\n indeterminate={isSomeRowsSelected}\n onChange={handleChange}\n />\n </Tooltip>\n );\n }\n\n return null;\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\nexport function Cell<TType = unknown>(context: ReactTableCellContext<TType, unknown>) {\n const { texts } = useLocalization();\n const { row, table } = context;\n const tableMeta = table.options.meta as ReactTableMeta<TType>;\n\n if (table.options.enableGrouping && table.getState().grouping?.length && !row.getIsGrouped()) {\n return null;\n }\n\n const isSelected = row.getIsGrouped() ? row.getIsAllSubRowsSelected() : row.getIsSelected();\n const title = isSelected ? texts.table3.columns.select.deselect : texts.table3.columns.select.select;\n\n if (table.options.enableMultiRowSelection) {\n const handleClick = (event: React.MouseEvent): void => {\n event.stopPropagation();\n\n if (row.getIsGrouped()) {\n row.subRows.forEach(row => row.toggleSelected());\n } else if (event.shiftKey) {\n const [fromIndex, toIndex] = toggleBetween(tableMeta.rowSelection.lastSelectedRowIndex.current ?? 0, row.index);\n\n table\n .getRowModel()\n .rows.slice(fromIndex, toIndex + 1)\n .forEach(row => row.toggleSelected(true));\n } else {\n row.toggleSelected();\n }\n\n tableMeta.rowSelection.lastSelectedRowIndex.current = row.index;\n };\n\n return (\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 />\n </Tooltip>\n );\n } else {\n const className = cn('!mt-0', getRadioClassnames());\n\n const handleClick = (event: React.MouseEvent): void => {\n event.stopPropagation();\n row.toggleSelected();\n tableMeta.rowSelection.lastSelectedRowIndex.current = row.index;\n };\n\n return (\n <button className={className} aria-checked={isSelected} onClick={handleClick} role=\"radio\" type=\"button\">\n {isSelected ? <span className=\"h-2 w-2 rounded-full bg-white\" /> : null}\n </button>\n );\n }\n}\n"],"names":["Header","context","texts","useLocalization","table","tableMeta","options","meta","enableMultiRowSelection","isAllRowsSelected","getIsAllRowsSelected","isSomeRowsSelected","getIsSomeRowsSelected","title","table3","columns","select","deselectAll","selectAll","handleChange","checked","toggleAllRowsSelected","_temp","server","loadAllIfNeeded","Promise","resolve","getState","sorting","columnFilters","undefined","then","_temp2","e","reject","React","Tooltip","Checkbox","className","key","String","indeterminate","onChange","toggleBetween","fromRowIndex","toRowIndex","fromIndex","toIndex","Cell","row","enableGrouping","_table$getState$group","grouping","length","getIsGrouped","isSelected","getIsAllSubRowsSelected","getIsSelected","deselect","handleClick","event","stopPropagation","subRows","forEach","toggleSelected","shiftKey","_tableMeta$rowSelecti","rowSelection","lastSelectedRowIndex","current","index","getRowModel","rows","slice","Shortcut","keys","onClick","cn","getRadioClassnames","role","type"],"mappings":";;;;;;;;SAagBA,MAAMA,CAAkBC,OAAgD;EACpF,MAAM;IAAEC;GAAO,GAAGC,eAAe,EAAE;EACnC,MAAM;IAAEC;GAAO,GAAGH,OAAO;EACzB,MAAMI,SAAS,GAAGD,KAAK,CAACE,OAAO,CAACC,IAA6B;EAE7D,IAAIH,KAAK,CAACE,OAAO,CAACE,uBAAuB,EAAE;IACvC,MAAMC,iBAAiB,GAAGL,KAAK,CAACM,oBAAoB,EAAE;IACtD,MAAMC,kBAAkB,GAAGP,KAAK,CAACQ,qBAAqB,EAAE;IACxD,MAAMC,KAAK,GAAGJ,iBAAiB,GAAGP,KAAK,CAACY,MAAM,CAACC,OAAO,CAACC,MAAM,CAACC,WAAW,GAAGf,KAAK,CAACY,MAAM,CAACC,OAAO,CAACC,MAAM,CAACE,SAAS;IAEjH,MAAMC,YAAY,aAAUC,OAAgB;MAAA;;UAOxChB,KAAK,CAACiB,qBAAqB,CAACD,OAAO,CAAC;;QAAC,MAAAE,KAAA;UAAA,IALjCjB,SAAS,CAACkB,MAAM,CAACC,eAAe;;YAChC,OAAAC,OAAA,CAAAC,OAAA,CACMrB,SAAS,CAACkB,MAAM,CAACC,eAAe,CAACpB,KAAK,CAACuB,QAAQ,EAAE,CAACC,OAAO,EAAExB,KAAK,CAACuB,QAAQ,EAAE,CAACE,aAAa,EAAEC,SAAS,CAAC,EAAAC,IAAA;;;;QAH/G,OAAAN,OAAA,CAAAC,OAAA,CAAAJ,KAAA,IAAAA,KAAA,CAAAS,IAAA,GAAAT,KAAA,CAAAS,IAAA,CAAAC,MAAA,IAAAA,MAAA,CAAAV,KAAA;OAOH,QAAAW,CAAA;QAAA,OAAAR,OAA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,EAAEC,kBAAkB,EAAE,CAAC;IAEnD,MAAMnB,WAAW,GAAIC,KAAuB;MACxCA,KAAK,CAACC,eAAe,EAAE;MACvBZ,GAAG,CAACe,cAAc,EAAE;MACpB3D,SAAS,CAAC8D,YAAY,CAACC,oBAAoB,CAACC,OAAO,GAAGpB,GAAG,CAACqB,KAAK;KAClE;IAED,oBACInC;MAAQG,SAAS,EAAEA,SAAS;sBAAgBiB,UAAU;MAAEqB,OAAO,EAAEjB,WAAW;MAAEoB,IAAI,EAAC,OAAO;MAACC,IAAI,EAAC;OAC3FzB,UAAU,gBAAGpB;MAAMG,SAAS,EAAC;MAAkC,GAAG,IAAI,CAClE;;AAGrB;;;;"}
|
1
|
+
{"version":3,"file":"Selection.js","sources":["../../../../../../../../../src/components/Report/components/Internal/Selection.tsx"],"sourcesContent":["import React from 'react';\nimport {\n HeaderContext as ReactTableHeaderContext,\n CellContext as ReactTableCellContext,\n TableMeta as ReactTableMeta,\n RowSelectionState,\n} from '@tanstack/react-table';\nimport cn from 'clsx';\nimport { useLocalization } from '../../../Provider/Localization';\nimport { Tooltip } from '../../../Tooltip/Tooltip';\nimport { Checkbox } from '../../../Checkbox/Checkbox';\nimport { Shortcut } from '../../../Shortcut/Shortcut';\nimport { getRadioClassnames } from '../../../RadioGroup/util';\nimport { TableServerLoadAllState } from '../../../../primitives/Table/types';\nimport { RowContext } from '../Row/RowContext';\n\nexport function Header<TType = unknown>(context: ReactTableHeaderContext<TType, unknown>) {\n const { texts } = useLocalization();\n const { table } = context;\n const tableMeta = table.options.meta as ReactTableMeta<TType>;\n\n if (table.options.enableMultiRowSelection) {\n const isAllRowsSelected = table.getIsAllRowsSelected();\n const isSomeRowsSelected = table.getIsSomeRowsSelected();\n const title = isAllRowsSelected ? texts.table3.columns.select.deselectAll : texts.table3.columns.select.selectAll;\n\n const handleChange = async (checked: boolean) => {\n // load all data if that is possible\n if (tableMeta.server.loadAllIfNeeded) {\n // don't pass the search query because we need all data - not filtered data\n await tableMeta.server.loadAllIfNeeded(table.getState().sorting, table.getState().columnFilters, undefined);\n }\n\n table.toggleAllRowsSelected(checked);\n };\n\n return (\n <Tooltip title={title}>\n <Checkbox\n aria-label={title}\n className=\"hover:border-blue !-mt-px\"\n key={String(`${isAllRowsSelected}_${isSomeRowsSelected}`)}\n checked={isAllRowsSelected}\n indeterminate={isSomeRowsSelected}\n loading={tableMeta.server.loadAllStatus === TableServerLoadAllState.Loading}\n onChange={handleChange}\n />\n </Tooltip>\n );\n }\n\n return null;\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\nexport function Cell<TType = unknown>(context: ReactTableCellContext<TType, unknown>) {\n const { texts } = useLocalization();\n const { row, table } = context;\n const { rowIndex } = React.useContext(RowContext);\n const tableMeta = table.options.meta as ReactTableMeta<TType>;\n\n if (table.options.enableGrouping && table.getState().grouping?.length && !row.getIsGrouped()) {\n return null;\n }\n\n const isSelected = row.getIsGrouped() ? row.getIsAllSubRowsSelected() : row.getIsSelected();\n const title = isSelected ? texts.table3.columns.select.deselect : texts.table3.columns.select.select;\n\n if (table.options.enableMultiRowSelection) {\n const handleClick = async (event: React.MouseEvent) => {\n event.stopPropagation();\n\n if (row.getIsGrouped()) {\n row.subRows.forEach(row => row.toggleSelected());\n } else if (event.shiftKey) {\n const [fromIndex, toIndex] = toggleBetween(tableMeta.rowSelection.lastSelectedRowIndex.current ?? 0, rowIndex);\n const selectedRows = table.getRowModel().rows.slice(fromIndex, toIndex + 1);\n\n if (tableMeta.server.loadAllIfNeeded && selectedRows.some(row => row.original === undefined)) {\n // don't pass the search query because we need all data - not filtered data\n await tableMeta.server.loadAllIfNeeded(table.getState().sorting, table.getState().columnFilters, undefined);\n }\n\n table.setRowSelection((currentRowSelection: RowSelectionState) => ({\n ...currentRowSelection,\n ...selectedRows.reduce((state, row) => ({ ...state, [row.id]: true }), {}),\n }));\n } else {\n row.toggleSelected();\n }\n\n tableMeta.rowSelection.lastSelectedRowIndex.current = row.index;\n };\n\n return (\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 />\n </Tooltip>\n );\n } else {\n const className = cn('!mt-0', getRadioClassnames());\n\n const handleClick = (event: React.MouseEvent): void => {\n event.stopPropagation();\n row.toggleSelected();\n tableMeta.rowSelection.lastSelectedRowIndex.current = row.index;\n };\n\n return (\n <button className={className} aria-checked={isSelected} onClick={handleClick} role=\"radio\" type=\"button\">\n {isSelected ? <span className=\"h-2 w-2 rounded-full bg-white\" /> : null}\n </button>\n );\n }\n}\n"],"names":["Header","context","texts","useLocalization","table","tableMeta","options","meta","enableMultiRowSelection","isAllRowsSelected","getIsAllRowsSelected","isSomeRowsSelected","getIsSomeRowsSelected","title","table3","columns","select","deselectAll","selectAll","handleChange","checked","toggleAllRowsSelected","_temp","server","loadAllIfNeeded","Promise","resolve","getState","sorting","columnFilters","undefined","then","_temp2","e","reject","React","Tooltip","Checkbox","className","key","String","indeterminate","loading","loadAllStatus","TableServerLoadAllState","Loading","onChange","toggleBetween","fromRowIndex","toRowIndex","fromIndex","toIndex","Cell","row","rowIndex","useContext","RowContext","enableGrouping","_table$getState$group","grouping","length","getIsGrouped","isSelected","getIsAllSubRowsSelected","getIsSelected","deselect","handleClick","event","rowSelection","lastSelectedRowIndex","current","index","stopPropagation","_temp6","subRows","forEach","toggleSelected","_temp5","shiftKey","_tableMeta$rowSelecti","_temp4","setRowSelection","currentRowSelection","selectedRows","reduce","state","id","getRowModel","rows","slice","_temp3","some","original","_temp7","Shortcut","keys","onClick","cn","getRadioClassnames","role","type"],"mappings":";;;;;;;;;;SAgBgBA,MAAMA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B,WAAW;MAAEiC,IAAI,EAAC,OAAO;MAACC,IAAI,EAAC;OAC3FtC,UAAU,gBAAG3B;MAAMG,SAAS,EAAC;MAAkC,GAAG,IAAI,CAClE;;AAGrB;;;;"}
|
@@ -5,6 +5,7 @@ import { useLocalization } from '../../../../../Provider/Localization.js';
|
|
5
5
|
import { Button } from '../../../../../Button/Button.js';
|
6
6
|
import { Shortcut } from '../../../../../Shortcut/Shortcut.js';
|
7
7
|
import { useIsLargeScreen } from '../../../../../../hooks/useIsLargeScreen.js';
|
8
|
+
import { isEmptyFilter } from './util.js';
|
8
9
|
import { ManageFiltersPopover } from './ManageFiltersPopover.js';
|
9
10
|
|
10
11
|
function Filters(props) {
|
@@ -16,7 +17,9 @@ function Filters(props) {
|
|
16
17
|
texts
|
17
18
|
} = useLocalization();
|
18
19
|
const isLargeScreen = useIsLargeScreen();
|
19
|
-
const
|
20
|
+
const columnFilters = table.getState().columnFilters;
|
21
|
+
const appliedFilters = columnFilters.filter(f => !isEmptyFilter(f));
|
22
|
+
const ref = React__default.useRef(null);
|
20
23
|
const shortcut = {
|
21
24
|
key: 'f',
|
22
25
|
meta: true,
|
@@ -30,11 +33,20 @@ function Filters(props) {
|
|
30
33
|
table: table
|
31
34
|
})),
|
32
35
|
shortcut,
|
36
|
+
ref,
|
33
37
|
tooltip: ( /*#__PURE__*/React__default.createElement(React__default.Fragment, null, texts.table3.filters.tooltip, /*#__PURE__*/React__default.createElement(Shortcut, {
|
34
38
|
className: "ml-2",
|
35
39
|
keys: shortcut
|
36
40
|
})))
|
37
41
|
};
|
42
|
+
React__default.useEffect(() => {
|
43
|
+
const emptyFilter = columnFilters.find(isEmptyFilter);
|
44
|
+
// we set an empty filter when adding a filter through a column header.
|
45
|
+
if (emptyFilter) {
|
46
|
+
var _ref$current;
|
47
|
+
(_ref$current = ref.current) === null || _ref$current === void 0 ? void 0 : _ref$current.click();
|
48
|
+
}
|
49
|
+
}, [columnFilters]);
|
38
50
|
if (!isLargeScreen && !appliedFilters.length) {
|
39
51
|
return /*#__PURE__*/React__default.createElement(IconButton, Object.assign({}, buttonProps, {
|
40
52
|
icon: "filter"
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"Filters.js","sources":["../../../../../../../../../../../src/components/Report/components/Toolbar/components/Filters/Filters.tsx"],"sourcesContent":["import React from 'react';\nimport { Table as ReactTable } from '@tanstack/react-table';\nimport { useIsLargeScreen } from '../../../../../../hooks/useIsLargeScreen';\nimport { useLocalization } from '../../../../../Provider/Localization';\nimport { IconButton } from '../../../../../IconButton/IconButton';\nimport { Button } from '../../../../../Button/Button';\nimport { Icon } from '../../../../../Icon/Icon';\nimport { Shortcut } from '../../../../../Shortcut/Shortcut';\nimport { ManageFiltersPopover } from './ManageFiltersPopover';\n\nexport type FiltersProps<TType = unknown> = {\n length: number;\n table: ReactTable<TType>;\n};\n\nexport function Filters<TType = unknown>(props: FiltersProps<TType>) {\n const { length, table } = props;\n const { texts } = useLocalization();\n const isLargeScreen = useIsLargeScreen();\n const
|
1
|
+
{"version":3,"file":"Filters.js","sources":["../../../../../../../../../../../src/components/Report/components/Toolbar/components/Filters/Filters.tsx"],"sourcesContent":["import React from 'react';\nimport { Table as ReactTable } from '@tanstack/react-table';\nimport { useIsLargeScreen } from '../../../../../../hooks/useIsLargeScreen';\nimport { useLocalization } from '../../../../../Provider/Localization';\nimport { IconButton } from '../../../../../IconButton/IconButton';\nimport { Button } from '../../../../../Button/Button';\nimport { Icon } from '../../../../../Icon/Icon';\nimport { Shortcut } from '../../../../../Shortcut/Shortcut';\nimport { ManageFiltersPopover } from './ManageFiltersPopover';\nimport { TableFilter } from '../../../../../../primitives/Table/types';\nimport { isEmptyFilter } from './util';\n\nexport type FiltersProps<TType = unknown> = {\n length: number;\n table: ReactTable<TType>;\n};\n\nexport function Filters<TType = unknown>(props: FiltersProps<TType>) {\n const { length, table } = props;\n const { texts } = useLocalization();\n const isLargeScreen = useIsLargeScreen();\n const columnFilters = table.getState().columnFilters as TableFilter[];\n const appliedFilters = columnFilters.filter(f => !isEmptyFilter(f));\n const ref = React.useRef<HTMLButtonElement>(null);\n\n const shortcut = { key: 'f', meta: true, shift: true };\n\n const buttonProps = {\n 'aria-label': texts.table3.filters.tooltip,\n className: appliedFilters.length ? '!wcag-blue-100' : undefined,\n popover: popoverProps => <ManageFiltersPopover {...popoverProps} length={length} table={table} />,\n shortcut,\n ref,\n tooltip: (\n <>\n {texts.table3.filters.tooltip}\n <Shortcut className=\"ml-2\" keys={shortcut} />\n </>\n ),\n };\n\n React.useEffect(() => {\n const emptyFilter = columnFilters.find(isEmptyFilter);\n\n // we set an empty filter when adding a filter through a column header.\n if (emptyFilter) {\n ref.current?.click();\n }\n }, [columnFilters]);\n\n if (!isLargeScreen && !appliedFilters.length) {\n return <IconButton {...buttonProps} icon=\"filter\" />;\n }\n\n return (\n <Button {...buttonProps}>\n <Icon className={!isLargeScreen ? '-mr-1.5' : undefined} name={appliedFilters.length ? 'filter-solid' : 'filter'} />\n {isLargeScreen ? texts.table3.filters.button : ''}\n {appliedFilters.length ? `(${appliedFilters.length})` : ''}\n </Button>\n );\n}\n"],"names":["Filters","props","length","table","texts","useLocalization","isLargeScreen","useIsLargeScreen","columnFilters","getState","appliedFilters","filter","f","isEmptyFilter","ref","React","useRef","shortcut","key","meta","shift","buttonProps","table3","filters","tooltip","className","undefined","popover","popoverProps","ManageFiltersPopover","Shortcut","keys","useEffect","emptyFilter","find","_ref$current","current","click","IconButton","icon","Button","Icon","name","button"],"mappings":";;;;;;;;;;SAiBgBA,OAAOA,CAAkBC,KAA0B;EAC/D,MAAM;IAAEC,MAAM;IAAEC;GAAO,GAAGF,KAAK;EAC/B,MAAM;IAAEG;GAAO,GAAGC,eAAe,EAAE;EACnC,MAAMC,aAAa,GAAGC,gBAAgB,EAAE;EACxC,MAAMC,aAAa,GAAGL,KAAK,CAACM,QAAQ,EAAE,CAACD,aAA8B;EACrE,MAAME,cAAc,GAAGF,aAAa,CAACG,MAAM,CAACC,C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EAAEhC,cAAc,CAACR,MAAM,GAAG,cAAc,GAAG;IAAY,EACnHI,aAAa,GAAGF,KAAK,CAACkB,MAAM,CAACC,OAAO,CAACoB,MAAM,GAAG,EAAE,EAChDjC,cAAc,CAACR,MAAM,OAAOQ,cAAc,CAACR,SAAS,GAAG,EAAE,CACrD;AAEjB;;;;"}
|
@@ -3,12 +3,18 @@ import { useLocalization } from '../../../../../Provider/Localization.js';
|
|
3
3
|
import { Button } from '../../../../../Button/Button.js';
|
4
4
|
import { Popover } from '../../../../../Popover/Popover.js';
|
5
5
|
import { Group } from '../../../../../Group/Group.js';
|
6
|
-
import { isInternalColumn } from '../../../../../../primitives/Table/
|
6
|
+
import { isInternalColumn } from '../../../../../../primitives/Table/useTableManager/util/columns.js';
|
7
7
|
import { TableFilterComparator } from '../../../../../../primitives/Table/types.js';
|
8
|
-
import { sortByHeader } from './util.js';
|
8
|
+
import { sortByHeader, isEmptyFilter } from './util.js';
|
9
9
|
import { Filter } from './components/Filter.js';
|
10
|
-
import { Placeholder } from './components/Placeholder.js';
|
11
10
|
|
11
|
+
const placeholderFilter = {
|
12
|
+
id: '',
|
13
|
+
value: {
|
14
|
+
comparator: TableFilterComparator.Contains,
|
15
|
+
value: undefined
|
16
|
+
}
|
17
|
+
};
|
12
18
|
function ManageFiltersPopover(props) {
|
13
19
|
const {
|
14
20
|
length,
|
@@ -20,54 +26,46 @@ function ManageFiltersPopover(props) {
|
|
20
26
|
texts
|
21
27
|
} = useLocalization();
|
22
28
|
const allColumns = table.getAllLeafColumns().filter(column => !isInternalColumn(column.id)).sort(sortByHeader);
|
23
|
-
const
|
29
|
+
const columnFilters = table.getState().columnFilters;
|
24
30
|
// state, since we "apply" filters - our filter values have a special shape, so we force to our type
|
25
|
-
const [filters, setFilters] = React__default.useState(
|
26
|
-
|
27
|
-
// filters might reset from the outside
|
31
|
+
const [filters, setFilters] = React__default.useState(columnFilters.length ? columnFilters : [placeholderFilter]);
|
32
|
+
// this runs if filters are set outside (e.g. through column header)
|
28
33
|
React__default.useEffect(() => {
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
+
setFilters(columnFilters.length === 0 ? [placeholderFilter] : columnFilters);
|
35
|
+
// focus the filter value, as we preset the column/comparator.
|
36
|
+
requestAnimationFrame(() => {
|
37
|
+
const filterValues = document.querySelectorAll('[data-query-selector="filter-value"]');
|
38
|
+
const lastFilter = filterValues.length ? filterValues[filterValues.length - 1] : undefined;
|
39
|
+
lastFilter === null || lastFilter === void 0 ? void 0 : lastFilter.focus();
|
40
|
+
});
|
41
|
+
}, [columnFilters]);
|
34
42
|
// filters
|
35
|
-
const handleChangeFilter = (
|
43
|
+
const handleChangeFilter = (position, filter) => {
|
36
44
|
setFilters(currentFilters => {
|
37
|
-
|
38
|
-
|
39
|
-
|
45
|
+
return currentFilters.map((current, index) => {
|
46
|
+
if (index === position) {
|
47
|
+
return filter;
|
48
|
+
}
|
49
|
+
return current;
|
50
|
+
});
|
40
51
|
});
|
41
52
|
};
|
42
|
-
const handleRemoveFilter =
|
43
|
-
if (filters.length === 1
|
44
|
-
|
53
|
+
const handleRemoveFilter = position => {
|
54
|
+
if (filters.length === 1) {
|
55
|
+
setFilters([placeholderFilter]);
|
56
|
+
return;
|
45
57
|
}
|
46
|
-
setFilters(currentFilters => currentFilters.filter(
|
47
|
-
};
|
48
|
-
// placeholders
|
49
|
-
const handleCreateFilterFromPlaceholder = columnId => {
|
50
|
-
setFilters(currentFilters => [...currentFilters, {
|
51
|
-
id: columnId,
|
52
|
-
value: {
|
53
|
-
comparator: TableFilterComparator.Contains,
|
54
|
-
value: undefined
|
55
|
-
}
|
56
|
-
}]);
|
57
|
-
handleRemovePlaceholder();
|
58
|
+
setFilters(currentFilters => currentFilters.filter((_, index) => index !== position));
|
58
59
|
};
|
59
|
-
const
|
60
|
-
|
61
|
-
};
|
62
|
-
const handleRemovePlaceholder = () => {
|
63
|
-
setPlaceholderCount(count => count - 1);
|
60
|
+
const handleCreate = () => {
|
61
|
+
setFilters(filters.concat(placeholderFilter));
|
64
62
|
};
|
65
63
|
//
|
66
64
|
const handleApply = () => {
|
67
65
|
table.setColumnFilters(() => {
|
68
66
|
const newFilters = filters.filter(f => {
|
69
67
|
var _allColumns$find, _allColumns$find$colu;
|
70
|
-
if (f.id === null) {
|
68
|
+
if (f.id === null || f.id === '') {
|
71
69
|
return false;
|
72
70
|
}
|
73
71
|
const controlRenderer = (_allColumns$find = allColumns.find(c => c.id === f.id)) === null || _allColumns$find === void 0 ? void 0 : (_allColumns$find$colu = _allColumns$find.columnDef.meta) === null || _allColumns$find$colu === void 0 ? void 0 : _allColumns$find$colu.control;
|
@@ -81,12 +79,14 @@ function ManageFiltersPopover(props) {
|
|
81
79
|
};
|
82
80
|
const handleClear = () => {
|
83
81
|
table.resetColumnFilters();
|
84
|
-
setFilters([]);
|
85
|
-
setPlaceholderCount(1);
|
82
|
+
setFilters([placeholderFilter]);
|
86
83
|
};
|
87
|
-
const handleClose =
|
88
|
-
|
89
|
-
|
84
|
+
const handleClose = open => {
|
85
|
+
if (!open) {
|
86
|
+
const nonEmptyFilters = columnFilters.filter(f => !isEmptyFilter(f));
|
87
|
+
table.setColumnFilters(nonEmptyFilters);
|
88
|
+
setFilters(nonEmptyFilters.length === 0 ? [placeholderFilter] : nonEmptyFilters);
|
89
|
+
}
|
90
90
|
};
|
91
91
|
return /*#__PURE__*/React__default.createElement(Popover, Object.assign({}, popoverProps, {
|
92
92
|
onChange: handleClose
|
@@ -109,19 +109,12 @@ function ManageFiltersPopover(props) {
|
|
109
109
|
filters: filters,
|
110
110
|
position: index,
|
111
111
|
onChange: handleChangeFilter,
|
112
|
-
onRemove: handleRemoveFilter
|
113
|
-
}))), [...Array(placeholderCount)].map((_, index) => ( /*#__PURE__*/React__default.createElement(Placeholder, {
|
114
|
-
key: `placeholder_${index}`,
|
115
|
-
allColumns: allColumns,
|
116
|
-
filters: filters,
|
117
|
-
position: filters.length + index,
|
118
|
-
onCreate: handleCreateFilterFromPlaceholder,
|
119
|
-
onRemove: placeholderCount > 1 || filters.length > 0 ? handleRemovePlaceholder : undefined
|
112
|
+
onRemove: filters.length > 0 && filters.some(f => f.id) || filters.length > 1 ? handleRemoveFilter : undefined
|
120
113
|
}))), /*#__PURE__*/React__default.createElement("div", {
|
121
114
|
className: "justify-start"
|
122
115
|
}, /*#__PURE__*/React__default.createElement(Button, {
|
123
116
|
appearance: "discrete",
|
124
|
-
onClick:
|
117
|
+
onClick: handleCreate
|
125
118
|
}, "+ ", texts.table3.filters.buttons.addFilter))), /*#__PURE__*/React__default.createElement(Group, {
|
126
119
|
className: "ml-auto"
|
127
120
|
}, /*#__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":"ManageFiltersPopover.js","sources":["../../../../../../../../../../../src/components/Report/components/Toolbar/components/Filters/ManageFiltersPopover.tsx"],"sourcesContent":["import React from 'react';\nimport { Table as ReactTable } from '@tanstack/react-table';\nimport { Popover } from '../../../../../Popover/Popover';\nimport { useLocalization } from '../../../../../Provider/Localization';\nimport { Button } from '../../../../../Button/Button';\nimport { Group } from '../../../../../Group/Group';\nimport { sortByHeader } from './util';\nimport { isInternalColumn } from '../../../../../../primitives/Table/useTable/util/columns';\nimport { TableFilter, TableFilterComparator, TableFilterValue } from '../../../../../../primitives/Table/types';\nimport { Filter } from './components/Filter';\nimport { Placeholder } from './components/Placeholder';\n\nexport type ManageFiltersPopoverProps<TType = unknown> = {\n length: number;\n table: ReactTable<TType>;\n};\n\nexport function ManageFiltersPopover<TType = unknown>(props: ManageFiltersPopoverProps<TType>) {\n const { length, table, ...popoverProps } = props;\n const { locale, texts } = useLocalization();\n\n const allColumns = table\n .getAllLeafColumns()\n .filter(column => !isInternalColumn(column.id))\n .sort(sortByHeader);\n\n const appliedFilters = table.getState().columnFilters as TableFilter[];\n\n // state, since we \"apply\" filters - our filter values have a special shape, so we force to our type\n const [filters, setFilters] = React.useState<TableFilter[]>(table.getState().columnFilters as TableFilter[]);\n const [placeholderCount, setPlaceholderCount] = React.useState(1);\n\n // filters might reset from the outside\n React.useEffect(() => {\n if (appliedFilters.length === 0) {\n setFilters([]);\n setPlaceholderCount(1);\n }\n }, [appliedFilters]);\n\n // filters\n const handleChangeFilter = (currentId: string | null, filter: { id: string; value: TableFilterValue }) => {\n setFilters(currentFilters => {\n const nextFilters = [...currentFilters];\n nextFilters[nextFilters.findIndex(f => f.id === currentId)] = 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: TableFilterComparator.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)?.columnDef.meta?.control;\n\n if (\n f.value.comparator === TableFilterComparator.IsEmpty ||\n f.value.comparator === TableFilterComparator.IsNotEmpty ||\n controlRenderer === 'switch'\n ) {\n return true;\n }\n\n return !!f.value.value;\n });\n\n return newFilters;\n });\n };\n\n const handleClear = () => {\n table.resetColumnFilters();\n setFilters([]);\n setPlaceholderCount(1);\n };\n\n const handleClose = () => {\n setFilters(appliedFilters);\n setPlaceholderCount(appliedFilters.length ? 0 : 1);\n };\n\n return (\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(length))}\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={handleRemoveFilter}\n />\n ))}\n {[...Array(placeholderCount)].map((_, index) => (\n <Placeholder\n key={`placeholder_${index}`}\n allColumns={allColumns}\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}\n"],"names":["ManageFiltersPopover","props","length","table","popoverProps","locale","texts","useLocalization","allColumns","getAllLeafColumns","filter","column","isInternalColumn","id","sort","sortByHeader","appliedFilters","getState","columnFilters","filters","setFilters","React","useState","placeholderCount","setPlaceholderCount","useEffect","handleChangeFilter","currentId","currentFilters","nextFilters","findIndex","f","handleRemoveFilter","columnId","count","handleCreateFilterFromPlaceholder","value","comparator","TableFilterComparator","Contains","undefined","handleRemovePlaceholder","handleCreatePlaceholder","handleApply","setColumnFilters","newFilters","controlRenderer","_allColumns$find","find","c","_allColumns$find$colu","columnDef","meta","control","IsEmpty","IsNotEmpty","handleClear","resetColumnFilters","handleClose","Popover","onChange","Content","className","table3","button","total","replace","Intl","NumberFormat","format","getFilteredRowModel","rows","map","index","Filter","key","position","onRemove","Array","_","Placeholder","onCreate","Button","appearance","onClick","buttons","addFilter","Group","Close"],"mappings":";;;;;;;;;;;SAiBgBA,oBAAoBA,CAAkBC,KAAuC;EACzF,MAAM;IAAEC,MAAM;IAAEC,KAAK;IAAE,GAAGC;GAAc,GAAGH,KAAK;EAChD,MAAM;IAAEI,MAAM;IAAEC;GAAO,GAAGC,eAAe,EAAE;EAE3C,MAAMC,UAAU,GAAGL,KAAK,CACnBM,iBAAiB,EAAE,CACnBC,MAAM,CAACC,MAAM,IAAI,CAACC,gBAAgB,CAACD,MAAM,CAACE,EAAE,CAAC,CAAC,CAC9CC,IAAI,CAACC,YAAY,CAAC;EAEvB,MAAMC,cAAc,GAAGb,KAAK,CAACc,QAAQ,EAAE,CAACC,aAA8B;;EAGtE,MAAM,CAACC,OAAO,EAAEC,UAAU,CAAC,GAAGC,cAAK,CAACC,QAAQ,CAAgBnB,KAAK,CAACc,QAAQ,EAAE,CAACC,aAA8B,CAAC;EAC5G,MAAM,CAACK,gBAAgB,EAAEC,mBAAmB,CAAC,GAAGH,cAAK,CAACC,QAAQ,CAAC,CAAC,CAAC;;EAGjED,cAAK,CAACI,SAAS,CAAC;IACZ,IAAIT,cAAc,CAACd,MAAM,KAAK,CAAC,EAAE;MAC7BkB,UAAU,CAAC,EAAE,CAAC;MACdI,mBAAmB,CAAC,CAAC,CAAC;;GAE7B,EAAE,CAACR,cAAc,CAAC,CAAC;;EAGpB,MAAMU,kBAAkB,GAAGA,CAACC,SAAwB,EAAEjB,MAA+C;IACjGU,UAAU,CAACQ,cAAc;MACrB,MAAMC,WAAW,GAAG,CAAC,GAAGD,cAAc,CAAC;MACvCC,WAAW,CAACA,WAAW,CAACC,SAAS,CAACC,CA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CACQ,CACZ;AAElB;;;;"}
|
1
|
+
{"version":3,"file":"ManageFiltersPopover.js","sources":["../../../../../../../../../../../src/components/Report/components/Toolbar/components/Filters/ManageFiltersPopover.tsx"],"sourcesContent":["import React from 'react';\nimport { Table as ReactTable } from '@tanstack/react-table';\nimport { Popover } from '../../../../../Popover/Popover';\nimport { useLocalization } from '../../../../../Provider/Localization';\nimport { Button } from '../../../../../Button/Button';\nimport { Group } from '../../../../../Group/Group';\nimport { isEmptyFilter, sortByHeader } from './util';\nimport { isInternalColumn } from '../../../../../../primitives/Table/useTableManager/util/columns';\nimport { TableFilter, TableFilterComparator, TableFilterValue } from '../../../../../../primitives/Table/types';\nimport { Filter } from './components/Filter';\n\nexport type ManageFiltersPopoverProps<TType = unknown> = {\n length: number;\n table: ReactTable<TType>;\n};\n\nconst placeholderFilter: TableFilter = { id: '', value: { comparator: TableFilterComparator.Contains, value: undefined } };\n\nexport function ManageFiltersPopover<TType = unknown>(props: ManageFiltersPopoverProps<TType>) {\n const { length, table, ...popoverProps } = props;\n const { locale, texts } = useLocalization();\n\n const allColumns = table\n .getAllLeafColumns()\n .filter(column => !isInternalColumn(column.id))\n .sort(sortByHeader);\n\n const columnFilters = table.getState().columnFilters as TableFilter[];\n\n // state, since we \"apply\" filters - our filter values have a special shape, so we force to our type\n const [filters, setFilters] = React.useState<TableFilter[]>(columnFilters.length ? columnFilters : [placeholderFilter]);\n\n // this runs if filters are set outside (e.g. through column header)\n React.useEffect(() => {\n setFilters(columnFilters.length === 0 ? [placeholderFilter] : columnFilters);\n\n // focus the filter value, as we preset the column/comparator.\n requestAnimationFrame(() => {\n const filterValues = document.querySelectorAll('[data-query-selector=\"filter-value\"]');\n const lastFilter = filterValues.length ? filterValues[filterValues.length - 1] : undefined;\n\n (lastFilter as HTMLElement)?.focus();\n });\n }, [columnFilters]);\n\n // filters\n const handleChangeFilter = (position: number, filter: { id: string; value: TableFilterValue }) => {\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 handleCreate = () => {\n setFilters(filters.concat(placeholderFilter));\n };\n\n //\n const handleApply = () => {\n table.setColumnFilters(() => {\n const newFilters = filters.filter(f => {\n if (f.id === null || f.id === '') {\n return false;\n }\n\n const controlRenderer = allColumns.find(c => c.id === f.id)?.columnDef.meta?.control;\n\n if (\n f.value.comparator === TableFilterComparator.IsEmpty ||\n f.value.comparator === TableFilterComparator.IsNotEmpty ||\n controlRenderer === 'switch'\n ) {\n return true;\n }\n\n return !!f.value.value;\n });\n\n return newFilters;\n });\n };\n\n const handleClear = () => {\n table.resetColumnFilters();\n setFilters([placeholderFilter]);\n };\n\n const handleClose = (open: boolean) => {\n if (!open) {\n const nonEmptyFilters = columnFilters.filter(f => !isEmptyFilter(f));\n table.setColumnFilters(nonEmptyFilters);\n setFilters(nonEmptyFilters.length === 0 ? [placeholderFilter] : nonEmptyFilters);\n }\n };\n\n return (\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(length))}\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={handleCreate}>\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}\n"],"names":["placeholderFilter","id","value","comparator","TableFilterComparator","Contains","undefined","ManageFiltersPopover","props","length","table","popoverProps","locale","texts","useLocalization","allColumns","getAllLeafColumns","filter","column","isInternalColumn","sort","sortByHeader","columnFilters","getState","filters","setFilters","React","useState","useEffect","requestAnimationFrame","filterValues","document","querySelectorAll","lastFilter","focus","handleChangeFilter","position","currentFilters","map","current","index","handleRemoveFilter","_","handleCreate","concat","handleApply","setColumnFilters","newFilters","f","controlRenderer","_allColumns$find","find","c","_allColumns$find$colu","columnDef","meta","control","IsEmpty","IsNotEmpty","handleClear","resetColumnFilters","handleClose","open","nonEmptyFilters","isEmptyFilter","Popover","onChange","Content","className","table3","button","total","replace","Intl","NumberFormat","format","getFilteredRowModel","rows","Filter","key","onRemove","some","Button","appearance","onClick","buttons","addFilter","Group","Close"],"mappings":";;;;;;;;;;AAgBA,MAAMA,iBAAiB,GAAgB;EAAEC,EAAE,EAAE,EAAE;EAAEC,KAAK,EAAE;IAAEC,UAAU,EAAEC,qBAAqB,CAACC,QAAQ;IAAEH,KAAK,EAAEI;;CAAa;SAE1GC,oBAAoBA,CAAkBC,KAAuC;EACzF,MAAM;IAAEC,MAAM;IAAEC,KAAK;IAAE,GAAGC;GAAc,GAAGH,KAAK;EAChD,MAAM;IAAEI,MAAM;IAAEC;GAAO,GAAGC,eAAe,EAAE;EAE3C,MAAMC,UAAU,GAAGL,KAAK,CACnBM,iBAAiB,EAAE,CACnBC,MAAM,CAACC,MAAM,IAAI,CAACC,gBAAgB,CAACD,M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,GAAG,CAAC,GAC/DgC,kBAAkB,GAClBnC;IAEZ,CACL,CAAC,eACFoB;IAAK0C,SAAS,EAAC;kBACX1C,6BAACwD,MAAM;IAACC,UAAU,EAAC,UAAU;IAACC,OAAO,EAAEzC;WAChC9B,KAAK,CAACwD,MAAM,CAAC7C,OAAO,CAAC6D,OAAO,CAACC,SAAS,CACpC,CACP,CACJ,eACN5D,6BAAC6D,KAAK;IAACnB,SAAS,EAAC;kBACb1C,6BAACuC,OAAO,CAACuB,KAAK,qBACV9D,6BAACwD,MAAM,iBAAgB,CACX,eAChBxD,6BAACwD,MAAM;IAACE,OAAO,EAAEzB;aAA2B,eAC5CjC,6BAACwD,MAAM;IAACC,UAAU,EAAC,SAAS;IAACC,OAAO,EAAEvC;aAE7B,CACL,CACN,CACQ,CACZ;AAElB;;;;"}
|
@@ -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: TableFilterComparator.Contains,
|
38
39
|
value: undefined
|
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 === TableFilterComparator.IsEmpty || comparator === TableFilterComparator.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 };
|