@economic/taco 2.24.0 → 2.25.0
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/components/Provider/Localization.d.ts +2 -0
- package/dist/components/Report/Report.d.ts +2 -2
- 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/util.d.ts +2 -0
- package/dist/components/Report/types.d.ts +2 -2
- package/dist/components/Select2/Select2.d.ts +18 -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/hooks/useTable.d.ts +8 -8
- package/dist/components/Table3/types.d.ts +2 -0
- 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 +2 -0
- package/dist/esm/packages/taco/src/components/Provider/Localization.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Report/components/Body/Body.js +3 -1
- 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/Summary.js +1 -1
- 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/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 +19 -11
- 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/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/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/styles/useCssGridStylesheet.js +1 -1
- 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/Select2/Select2.js +3 -3
- package/dist/esm/packages/taco/src/components/Select2/Select2.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/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/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/hooks/useTable.js +16 -16
- 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/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.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/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/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} +3 -3
- package/dist/esm/packages/taco/src/primitives/Table/useTableManager/useTableManager.js.map +1 -0
- 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/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/primitives/Table/types.d.ts +5 -16
- package/dist/primitives/Table/useTableManager/types.d.ts +13 -0
- package/dist/primitives/Table/{useTable/useTable.d.ts → useTableManager/useTableManager.d.ts} +3 -2
- package/dist/primitives/Table/useTableManager/util/presets.d.ts +2 -0
- package/dist/primitives/Table/{useTable → useTableManager}/util/setup.d.ts +5 -4
- package/dist/taco.cjs.development.js +98 -27
- 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/package.json +2 -2
- package/types.json +9609 -8428
- 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.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/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/useTablePrinting.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}/features/useTableSettings.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/useTableSettingsListener.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/columns.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/settings.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/useTablePrinting.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/settings.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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G0B,WAAW,CAAC;;;IAItC,OAAO9B,SAAS,CAACoC,GAAG,CAAC,CAACC,IAAI,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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cAAc,EAAE7C,KAAK,IAAIA,KAAK,CAAC8C,cAAc;IAC/C;AAEV;;;;"}
|
@@ -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,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,CAAC,IAAI,CAACC,aAAa,CAACD,CAAC,CAAC,CAAC;EACnE,MAAME,GAAG,GAAGC,cAAK,CAACC,MAAM,CAAoB,IAAI,CAAC;EAEjD,MAAMC,QAAQ,GAAG;IAAEC,GAAG,EAAE,GAAG;IAAEC,IAAI,EAAE,IAAI;IAAEC,KAAK,EAAE;GAAM;EAEtD,MAAMC,WAAW,G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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
10
|
|
11
11
|
const placeholderFilter = {
|
@@ -26,15 +26,19 @@ function ManageFiltersPopover(props) {
|
|
26
26
|
texts
|
27
27
|
} = useLocalization();
|
28
28
|
const allColumns = table.getAllLeafColumns().filter(column => !isInternalColumn(column.id)).sort(sortByHeader);
|
29
|
-
const
|
29
|
+
const columnFilters = table.getState().columnFilters;
|
30
30
|
// state, since we "apply" filters - our filter values have a special shape, so we force to our type
|
31
|
-
const [filters, setFilters] = React__default.useState(
|
32
|
-
// filters
|
31
|
+
const [filters, setFilters] = React__default.useState(columnFilters.length ? columnFilters : [placeholderFilter]);
|
32
|
+
// this runs if filters are set outside (e.g. through column header)
|
33
33
|
React__default.useEffect(() => {
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
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]);
|
38
42
|
// filters
|
39
43
|
const handleChangeFilter = (position, filter) => {
|
40
44
|
setFilters(currentFilters => {
|
@@ -77,8 +81,12 @@ function ManageFiltersPopover(props) {
|
|
77
81
|
table.resetColumnFilters();
|
78
82
|
setFilters([placeholderFilter]);
|
79
83
|
};
|
80
|
-
const handleClose =
|
81
|
-
|
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
|
+
}
|
82
90
|
};
|
83
91
|
return /*#__PURE__*/React__default.createElement(Popover, Object.assign({}, popoverProps, {
|
84
92
|
onChange: handleClose
|
@@ -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';\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 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[]>(appliedFilters.length ? appliedFilters : [placeholderFilter]);\n\n // filters might reset from the outside\n React.useEffect(() => {\n if (appliedFilters.length === 0) {\n setFilters([placeholderFilter]);\n }\n }, [appliedFilters]);\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 = () => {\n setFilters(appliedFilters.length === 0 ? [placeholderFilter] : appliedFilters);\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","appliedFilters","getState","columnFilters","filters","setFilters","React","useState","useEffect","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","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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aAA2B,eAC5C3B,6BAAC+C,MAAM;IAACC,UAAU,EAAC,SAAS;IAACC,OAAO,EAAEpC;aAE7B,CACL,CACN,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,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e,OAAO,CAACyD,IAAI,CAACjC,CAAC,IAAIA,CAAC,CAAC/C,EAAE,CAAC,IAAKuB,OAAO,CAACf,MAAM,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;;;;"}
|
@@ -5,6 +5,7 @@ import { Datepicker } from '../../../../../../Datepicker/Datepicker.js';
|
|
5
5
|
import { TableFilterComparator } from '../../../../../../../primitives/Table/types.js';
|
6
6
|
import { Switch } from '../../../../../../Switch/Switch.js';
|
7
7
|
|
8
|
+
const querySelector = 'filter-value';
|
8
9
|
function FilterValue(props) {
|
9
10
|
const {
|
10
11
|
column,
|
@@ -26,6 +27,7 @@ function FilterValue(props) {
|
|
26
27
|
return /*#__PURE__*/React__default.createElement(Input, {
|
27
28
|
"aria-label": texts.table3.filters.emptyFilter.value,
|
28
29
|
className: "flex-grow",
|
30
|
+
"data-query-selector": querySelector,
|
29
31
|
disabled: true,
|
30
32
|
value: texts.table3.filters.emptyFilter.value
|
31
33
|
});
|
@@ -35,10 +37,12 @@ function FilterValue(props) {
|
|
35
37
|
className: "flex flex-grow items-center gap-2"
|
36
38
|
}, /*#__PURE__*/React__default.createElement(Control, {
|
37
39
|
column: column,
|
40
|
+
"data-query-selector": querySelector,
|
38
41
|
onChange: value => handleChange([value, toValue]),
|
39
42
|
value: fromValue
|
40
43
|
}), /*#__PURE__*/React__default.createElement(Control, {
|
41
44
|
column: column,
|
45
|
+
"data-query-selector": querySelector,
|
42
46
|
onChange: value => handleChange([fromValue, value]),
|
43
47
|
value: toValue
|
44
48
|
}));
|
@@ -47,11 +51,13 @@ function FilterValue(props) {
|
|
47
51
|
className: "flex flex-grow items-center gap-2"
|
48
52
|
}, /*#__PURE__*/React__default.createElement(Control, {
|
49
53
|
column: column,
|
54
|
+
"data-query-selector": querySelector,
|
50
55
|
onChange: value => handleChange([isNaN(value) ? undefined : value, toValue]),
|
51
56
|
placeholder: "from",
|
52
57
|
value: fromValue !== null && fromValue !== void 0 ? fromValue : ''
|
53
58
|
}), /*#__PURE__*/React__default.createElement(Control, {
|
54
59
|
column: column,
|
60
|
+
"data-query-selector": querySelector,
|
55
61
|
onChange: value => handleChange([fromValue, isNaN(value) ? undefined : value]),
|
56
62
|
placeholder: "to",
|
57
63
|
value: toValue !== null && toValue !== void 0 ? toValue : ''
|
@@ -60,6 +66,7 @@ function FilterValue(props) {
|
|
60
66
|
return /*#__PURE__*/React__default.createElement(Control, {
|
61
67
|
comparator: comparator,
|
62
68
|
column: column,
|
69
|
+
"data-query-selector": querySelector,
|
63
70
|
onChange: handleChange,
|
64
71
|
value: value
|
65
72
|
});
|
@@ -81,10 +88,13 @@ function Control(props) {
|
|
81
88
|
}
|
82
89
|
}, []);
|
83
90
|
if (typeof controlRenderer === 'function') {
|
84
|
-
return controlRenderer({
|
91
|
+
return /*#__PURE__*/React__default.cloneElement(controlRenderer({
|
85
92
|
...attributes,
|
86
93
|
setValue: value => onChange(value),
|
87
94
|
value
|
95
|
+
}), {
|
96
|
+
['data-query-selector']: querySelector,
|
97
|
+
className: 'focus:yt-focus'
|
88
98
|
});
|
89
99
|
} else if (controlRenderer === 'datepicker' || dataType === 'datetime') {
|
90
100
|
return /*#__PURE__*/React__default.createElement(Datepicker, Object.assign({}, attributes, {
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"FilterValue.js","sources":["../../../../../../../../../../../../src/components/Report/components/Toolbar/components/Filters/components/FilterValue.tsx"],"sourcesContent":["import React, { useEffect } from 'react';\nimport { Column as ReactTableColumn } from '@tanstack/react-table';\nimport { Input } from '../../../../../../Input/Input';\nimport { Datepicker } from '../../../../../../Datepicker/Datepicker';\nimport { Switch } from '../../../../../../Switch/Switch';\nimport { useLocalization } from '../../../../../../Provider/Localization';\nimport { TableFilterComparator } from '../../../../../../../primitives/Table/types';\n\nexport type FilterValueProps<TType = unknown> = {\n column?: ReactTableColumn<TType, unknown>;\n comparator: TableFilterComparator;\n onChange: (value: any) => void;\n value: any;\n};\n\nexport function FilterValue<TType = unknown>(props: FilterValueProps<TType>) {\n const { column, comparator, onChange: handleChange, value } = props;\n const { texts } = useLocalization();\n\n if (comparator === TableFilterComparator.IsEmpty || comparator === TableFilterComparator.IsNotEmpty) {\n return null;\n }\n\n if (comparator === TableFilterComparator.IsBetween) {\n const fromValue = Array.isArray(value) ? value[0] : undefined;\n const toValue = Array.isArray(value) ? value[1] : undefined;\n\n if (column === undefined) {\n return (\n <Input\n aria-label={texts.table3.filters.emptyFilter.value}\n className=\"flex-grow\"\n disabled\n value={texts.table3.filters.emptyFilter.value}\n />\n );\n }\n\n if (column.columnDef.meta?.dataType === 'datetime') {\n return (\n <div className=\"flex flex-grow items-center gap-2\">\n <Control
|
1
|
+
{"version":3,"file":"FilterValue.js","sources":["../../../../../../../../../../../../src/components/Report/components/Toolbar/components/Filters/components/FilterValue.tsx"],"sourcesContent":["import React, { useEffect } from 'react';\nimport { Column as ReactTableColumn } from '@tanstack/react-table';\nimport { Input } from '../../../../../../Input/Input';\nimport { Datepicker } from '../../../../../../Datepicker/Datepicker';\nimport { Switch } from '../../../../../../Switch/Switch';\nimport { useLocalization } from '../../../../../../Provider/Localization';\nimport { TableFilterComparator } from '../../../../../../../primitives/Table/types';\n\nexport type FilterValueProps<TType = unknown> = {\n column?: ReactTableColumn<TType, unknown>;\n comparator: TableFilterComparator;\n onChange: (value: any) => void;\n value: any;\n};\n\nconst querySelector = 'filter-value';\n\nexport function FilterValue<TType = unknown>(props: FilterValueProps<TType>) {\n const { column, comparator, onChange: handleChange, value } = props;\n const { texts } = useLocalization();\n\n if (comparator === TableFilterComparator.IsEmpty || comparator === TableFilterComparator.IsNotEmpty) {\n return null;\n }\n\n if (comparator === TableFilterComparator.IsBetween) {\n const fromValue = Array.isArray(value) ? value[0] : undefined;\n const toValue = Array.isArray(value) ? value[1] : undefined;\n\n if (column === undefined) {\n return (\n <Input\n aria-label={texts.table3.filters.emptyFilter.value}\n className=\"flex-grow\"\n data-query-selector={querySelector}\n disabled\n value={texts.table3.filters.emptyFilter.value}\n />\n );\n }\n\n if (column.columnDef.meta?.dataType === 'datetime') {\n return (\n <div className=\"flex flex-grow items-center gap-2\">\n <Control\n column={column}\n data-query-selector={querySelector}\n onChange={value => handleChange([value, toValue])}\n value={fromValue}\n />\n <Control\n column={column}\n data-query-selector={querySelector}\n onChange={value => handleChange([fromValue, value])}\n value={toValue}\n />\n </div>\n );\n }\n\n return (\n <div className=\"flex flex-grow items-center gap-2\">\n <Control\n column={column}\n data-query-selector={querySelector}\n onChange={value => handleChange([isNaN(value) ? undefined : value, toValue])}\n placeholder=\"from\"\n value={fromValue ?? ''}\n />\n <Control\n column={column}\n data-query-selector={querySelector}\n onChange={value => handleChange([fromValue, isNaN(value) ? undefined : value])}\n placeholder=\"to\"\n value={toValue ?? ''}\n />\n </div>\n );\n }\n return (\n <Control\n comparator={comparator}\n column={column}\n data-query-selector={querySelector}\n onChange={handleChange}\n value={value}\n />\n );\n}\n\nfunction Control(props) {\n const { column, comparator, onChange, value, ...attributes } = props;\n const controlRenderer = column?.columnDef.meta?.control;\n const dataType = column?.columnDef.meta?.dataType;\n\n useEffect(() => {\n if (controlRenderer === 'switch') {\n onChange(false);\n }\n }, []);\n\n if (typeof controlRenderer === 'function') {\n return React.cloneElement(\n controlRenderer({\n ...attributes,\n setValue: value => onChange(value),\n value,\n }),\n { ['data-query-selector']: querySelector, className: 'focus:yt-focus' }\n );\n } else if (controlRenderer === 'datepicker' || dataType === 'datetime') {\n return <Datepicker {...attributes} onChange={event => onChange((event as any).detail)} value={value as Date} />;\n } else if (controlRenderer === 'switch') {\n return <Switch {...attributes} className=\"m-1.5\" checked={Boolean(value)} onChange={onChange} />;\n } else if ((controlRenderer === 'input' || controlRenderer === undefined) && dataType === 'number') {\n return (\n <Input\n {...attributes}\n className=\"flex-grow\"\n type=\"number\"\n onChange={event => onChange(event.target.valueAsNumber)}\n value={String(value ?? '')}\n />\n );\n }\n\n return (\n <Input\n disabled={!column}\n {...attributes}\n className=\"flex-grow\"\n onChange={event => onChange(event.target.value)}\n value={String(value ?? '')}\n />\n );\n}\n"],"names":["querySelector","FilterValue","props","column","comparator","onChange","handleChange","value","texts","useLocalization","TableFilterComparator","IsEmpty","IsNotEmpty","IsBetween","_column$columnDef$met","fromValue","Array","isArray","undefined","toValue","React","Input","table3","filters","emptyFilter","className","disabled","columnDef","meta","dataType","Control","isNaN","placeholder","attributes","controlRenderer","_column$columnDef$met2","control","_column$columnDef$met3","useEffect","cloneElement","setValue","Datepicker","event","detail","Switch","checked","Boolean","type","target","valueAsNumber","String"],"mappings":";;;;;;;AAeA,MAAMA,aAAa,GAAG,cAAc;SAEpBC,WAAWA,CAAkBC,KAA8B;EACvE,MAAM;IAAEC,MAAM;IAAEC,UAAU;IAAEC,QAAQ,EAAEC,YAAY;IAAEC;GAAO,GAAGL,KAAK;EACnE,MAAM;IAAEM;GAAO,GAAGC,eAAe,EAAE;EAEnC,IAAIL,UAAU,KAAKM,qBAAqB,CAACC,OAAO,IAAIP,UAAU,KAAKM,qBAAqB,CAACE,UAAU,EAAE;IACjG,OAAO,IAAI;;EAGf,IAAIR,UAAU,KAAKM,qBAAqB,CAACG,SAAS,EAAE;IAAA,IAAAC,qBAAA;IAChD,MAAMC,SAAS,GAAGC,KAAK,CA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|
var _a$columnDef$meta, _a$columnDef$meta$hea, _a$columnDef$meta$hea2, _b$columnDef$meta;
|
3
3
|
return (_a$columnDef$meta = a.columnDef.meta) === null || _a$columnDef$meta === void 0 ? void 0 : (_a$columnDef$meta$hea = _a$columnDef$meta.header) === null || _a$columnDef$meta$hea === void 0 ? void 0 : (_a$columnDef$meta$hea2 = _a$columnDef$meta$hea.localeCompare) === null || _a$columnDef$meta$hea2 === void 0 ? void 0 : _a$columnDef$meta$hea2.call(_a$columnDef$meta$hea, (_b$columnDef$meta = b.columnDef.meta) === null || _b$columnDef$meta === void 0 ? void 0 : _b$columnDef$meta.header);
|
4
4
|
}
|
5
|
+
function isEmptyFilter(filter) {
|
6
|
+
return !filter.value.hasOwnProperty('value'); // eslint-disable-line no-prototype-builtins
|
7
|
+
}
|
5
8
|
|
6
|
-
export { sortByHeader };
|
9
|
+
export { isEmptyFilter, sortByHeader };
|
7
10
|
//# sourceMappingURL=util.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"util.js","sources":["../../../../../../../../../../../src/components/Report/components/Toolbar/components/Filters/util.ts"],"sourcesContent":["import { Column as ReactTableColumn } from '@tanstack/react-table';\n\nexport function sortByHeader<TType = unknown>(a: ReactTableColumn<TType>, b: ReactTableColumn<TType>) {\n return (a.columnDef.meta?.header as string)?.localeCompare?.(b.columnDef.meta?.header as string);\n}\n"],"names":["sortByHeader","a","b","_a$columnDef$meta","columnDef","meta","_a$columnDef$meta$hea","header","_a$columnDef$meta$hea2","localeCompare","call","_b$columnDef$meta"],"mappings":"
|
1
|
+
{"version":3,"file":"util.js","sources":["../../../../../../../../../../../src/components/Report/components/Toolbar/components/Filters/util.ts"],"sourcesContent":["import { Column as ReactTableColumn } from '@tanstack/react-table';\nimport { TableFilter } from '../../../../../../primitives/Table/types';\n\nexport function sortByHeader<TType = unknown>(a: ReactTableColumn<TType>, b: ReactTableColumn<TType>) {\n return (a.columnDef.meta?.header as string)?.localeCompare?.(b.columnDef.meta?.header as string);\n}\n\nexport function isEmptyFilter(filter: TableFilter) {\n return !filter.value.hasOwnProperty('value'); // eslint-disable-line no-prototype-builtins\n}\n"],"names":["sortByHeader","a","b","_a$columnDef$meta","columnDef","meta","_a$columnDef$meta$hea","header","_a$columnDef$meta$hea2","localeCompare","call","_b$columnDef$meta","isEmptyFilter","filter","value","hasOwnProperty"],"mappings":"SAGgBA,YAAYA,CAAkBC,CAA0B,EAAEC,CAA0B;;EAChG,QAAAC,iBAAA,GAAQF,CAAC,CAACG,SAAS,CAACC,IAAI,cAAAF,iBAAA,wBAAAG,qBAAA,GAAhBH,iBAAA,CAAkBI,MAAiB,cAAAD,qBAAA,wBAAAE,sBAAA,GAAnCF,qBAAA,CAAqCG,aAAa,cAAAD,sBAAA,uBAAlDA,sBAAA,CAAAE,IAAA,CAAAJ,qBAAA,GAAAK,iBAAA,GAAqDT,CAAC,CAACE,SAAS,CAACC,IAAI,cAAAM,iBAAA,uBAAhBA,iBAAA,CAAkBJ,MAAgB,CAAC;AACpG;SAEgBK,aAAaA,CAACC,MAAmB;EAC7C,OAAO,CAACA,MAAM,CAACC,KAAK,CAACC,cAAc,CAAC,OAAO,CAAC,CAAC;AACjD;;;;"}
|
@@ -5,7 +5,7 @@ import { useLocalization } from '../../../../../Provider/Localization.js';
|
|
5
5
|
import { Checkbox } from '../../../../../Checkbox/Checkbox.js';
|
6
6
|
import { Input } from '../../../../../Input/Input.js';
|
7
7
|
import { Popover } from '../../../../../Popover/Popover.js';
|
8
|
-
import { isInternalColumn, ensureOrdering } from '../../../../../../primitives/Table/
|
8
|
+
import { isInternalColumn, ensureOrdering } from '../../../../../../primitives/Table/useTableManager/util/columns.js';
|
9
9
|
import { Container } from '../../../../../../primitives/Sortable/components/Container.js';
|
10
10
|
import { arrayMove } from '@dnd-kit/sortable';
|
11
11
|
import { Item } from '../../../../../../primitives/Sortable/components/Item.js';
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"HideOrOrderPopover.js","sources":["../../../../../../../../../../../src/components/Report/components/Toolbar/components/Settings/HideOrOrderPopover.tsx"],"sourcesContent":["import React from 'react';\nimport cn from 'clsx';\nimport { Table as ReactTable, Column as ReactTableColumn, TableMeta as ReactTableMeta } from '@tanstack/react-table';\nimport { Popover, PopoverProps } from '../../../../../Popover/Popover';\nimport { Input } from '../../../../../Input/Input';\nimport * as SortablePrimitive from '../../../../../../primitives/Sortable/Sortable';\nimport { Icon } from '../../../../../Icon/Icon';\nimport { Checkbox } from '../../../../../Checkbox/Checkbox';\nimport { useLocalization } from '../../../../../Provider/Localization';\nimport { ensureOrdering, isInternalColumn } from '../../../../../../primitives/Table/useTable/util/columns';\n\ntype ColumnProps<TType = unknown> = React.HTMLAttributes<HTMLDivElement> & {\n column: ReactTableColumn<TType, unknown>;\n draggable?: boolean;\n};\n\nconst Column = React.forwardRef(function Column<TType = unknown>(props: ColumnProps<TType>, ref: React.Ref<HTMLDivElement>) {\n const { column, draggable = false, ...dragAttributes } = props;\n const canHide = column.getCanHide();\n\n const className = cn('group/column flex items-center gap-x-2 rounded py-1 px-2', {\n 'hover:bg-grey-200': canHide || draggable,\n 'hover:cursor-pointer': canHide,\n 'active:cursor-move active:bg-grey-300': draggable,\n });\n\n const attributes = draggable ? dragAttributes : undefined;\n const isVisible = column.getIsVisible();\n const parentHeader = column.parent?.columnDef?.header;\n\n return (\n <div {...attributes} className={className} onClick={() => column.toggleVisibility(!isVisible)} ref={ref}>\n {draggable ? <Icon name=\"drag\" className=\"text-grey-500 group-hover/column:text-grey-700 -mx-2 !h-5\" /> : null}\n <span className=\"flex-grow truncate\">\n {column.columnDef.meta?.header}\n {parentHeader ? <span className=\"italic\">({parentHeader})</span> : null}\n </span>\n {canHide ? <Checkbox checked={isVisible} onChange={() => column.toggleVisibility(!isVisible)} /> : null}\n </div>\n );\n});\n\nexport type HideOrOrderPopoverProps<TType = unknown> = PopoverProps & {\n table: ReactTable<TType>;\n};\n\nexport function HideOrOrderPopover<TType = unknown>(props: HideOrOrderPopoverProps<TType>) {\n const { table, trigger, ...popoverProps } = props;\n const { texts } = useLocalization();\n const [query, setQuery] = React.useState('');\n const allColumns = table.getAllLeafColumns();\n const tableMeta = table.options.meta as ReactTableMeta<TType>;\n const columns = React.useMemo(\n () =>\n allColumns\n .filter(column => !isInternalColumn(column.id))\n .filter(column =>\n query?.length\n ? column.columnDef.meta?.header.toLowerCase().includes(query.toLowerCase()) ||\n column.parent?.columnDef.meta?.header.toLowerCase().includes(query.toLowerCase())\n : true\n ),\n [allColumns, query]\n );\n\n const listClassName = 'flex max-h-64 flex-col gap-y-px overflow-auto';\n\n const handleReorder = (activeId, overId) => {\n if (columns.find(column => column.id === overId && column.columnDef.meta?.enableOrdering === false)) {\n return;\n }\n\n table.setColumnOrder((currentOrder = []) =>\n ensureOrdering(\n allColumns,\n SortablePrimitive.arrayMove(\n currentOrder,\n currentOrder.findIndex(c => c === activeId),\n currentOrder.findIndex(c => c === overId)\n )\n )\n );\n };\n\n return (\n <Popover {...popoverProps} anchor={trigger}>\n <Popover.Content>\n <div className=\"flex max-w-sm flex-col gap-2\">\n {table.options.enableHiding ? (\n <Input\n onChange={event => setQuery(event.target.value)}\n placeholder={texts.table3.columnSettings.search}\n value={query}\n />\n ) : null}\n {tableMeta.columnOrdering.isEnabled && columns.length && !query?.length ? (\n <SortablePrimitive.Container reorder={handleReorder}>\n <SortablePrimitive.List id=\"columns\" className={listClassName}>\n {columns\n .filter(column => !column.getIsGrouped())\n .map(column => (\n <SortablePrimitive.Item\n key={column.id}\n id={column.id}\n disabled={!column.columnDef.meta?.enableOrdering}\n asChild>\n <Column column={column as any} draggable={column.columnDef.meta?.enableOrdering} />\n </SortablePrimitive.Item>\n ))}\n </SortablePrimitive.List>\n </SortablePrimitive.Container>\n ) : (\n <div className={listClassName}>\n {columns.length\n ? columns.map(column => <Column column={column as any} key={column.id} />)\n : texts.table3.columnSettings.noResults}\n </div>\n )}\n </div>\n </Popover.Content>\n </Popover>\n );\n}\n"],"names":["Column","React","forwardRef","props","ref","column","draggable","dragAttributes","canHide","getCanHide","className","cn","attributes","undefined","isVisible","getIsVisible","parentHeader","_column$parent","parent","_column$parent$column","columnDef","header","onClick","toggleVisibility","Icon","name","meta","_column$columnDef$met","Checkbox","checked","onChange","HideOrOrderPopover","table","trigger","popoverProps","texts","useLocalization","query","setQuery","useState","allColumns","getAllLeafColumns","tableMeta","options","columns","useMemo","filter","isInternalColumn","id","_column$columnDef$met2","_column$parent2","_column$parent2$colum","length","toLowerCase","includes","listClassName","handleReorder","activeId","overId","find","_column$columnDef$met3","enableOrdering","setColumnOrder","currentOrder","ensureOrdering","SortablePrimitive","findIndex","c","Popover","anchor","Content","enableHiding","Input","event","target","value","placeholder","table3","columnSettings","search","columnOrdering","isEnabled","reorder","getIsGrouped","map","_column$columnDef$met4","_column$columnDef$met5","key","disabled","asChild","noResults"],"mappings":";;;;;;;;;;;;;AAgBA,MAAMA,MAAM,gBAAGC,cAAK,CAACC,UAAU,CAAC,SAASF,MAAMA,CAAkBG,KAAyB,EAAEC,GAA8B;;EACtH,MAAM;IAAEC,MAAM;IAAEC,SAAS,GAAG,KAAK;IAAE,GAAGC;GAAgB,GAAGJ,KAAK;EAC9D,MAAMK,OAAO,GAAGH,MAAM,CAACI,UAAU,EAAE;EAEnC,MAAMC,SAAS,GAAGC,EAAE,CAAC,0DAA0D,EAAE;IAC7E,mBAAmB,EAAEH,OAAO,IAAIF,SAAS;IACzC,sBAAsB,EAAEE,OAAO;IAC/B,uCAAuC,EAAEF;GAC5C,CAAC;EAEF,MAAMM,UAAU,GAAGN,SAAS,GAAGC,cAAc,GAAGM,SAAS;EACzD,MAAMC,SAAS,GAAGT,MAAM,CAACU,YAAY,EAAE;EACvC,MAAMC,YAAY,IAAAC,cAAA,GAAGZ,MAAM,CAACa,MAAM,cAAAD,cAAA,wBAAAE,qBAAA,GAAbF,cAAA,CAAeG,SAAS,cAAAD,qBAAA,uBAAxBA,qBAAA,CAA0BE,MAAM;EAErD,oBACIpB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AAG,EAAElF,MAAM,CAAC2C;IAAM,CAAC,GACxEb,KAAK,CAAC0C,MAAM,CAACC,cAAc,CAACY,SAAS,CACzC,CACT,CACC,CACQ,CACZ;AAElB;;;;"}
|
1
|
+
{"version":3,"file":"HideOrOrderPopover.js","sources":["../../../../../../../../../../../src/components/Report/components/Toolbar/components/Settings/HideOrOrderPopover.tsx"],"sourcesContent":["import React from 'react';\nimport cn from 'clsx';\nimport { Table as ReactTable, Column as ReactTableColumn, TableMeta as ReactTableMeta } from '@tanstack/react-table';\nimport { Popover, PopoverProps } from '../../../../../Popover/Popover';\nimport { Input } from '../../../../../Input/Input';\nimport * as SortablePrimitive from '../../../../../../primitives/Sortable/Sortable';\nimport { Icon } from '../../../../../Icon/Icon';\nimport { Checkbox } from '../../../../../Checkbox/Checkbox';\nimport { useLocalization } from '../../../../../Provider/Localization';\nimport { ensureOrdering, isInternalColumn } from '../../../../../../primitives/Table/useTableManager/util/columns';\n\ntype ColumnProps<TType = unknown> = React.HTMLAttributes<HTMLDivElement> & {\n column: ReactTableColumn<TType, unknown>;\n draggable?: boolean;\n};\n\nconst Column = React.forwardRef(function Column<TType = unknown>(props: ColumnProps<TType>, ref: React.Ref<HTMLDivElement>) {\n const { column, draggable = false, ...dragAttributes } = props;\n const canHide = column.getCanHide();\n\n const className = cn('group/column flex items-center gap-x-2 rounded py-1 px-2', {\n 'hover:bg-grey-200': canHide || draggable,\n 'hover:cursor-pointer': canHide,\n 'active:cursor-move active:bg-grey-300': draggable,\n });\n\n const attributes = draggable ? dragAttributes : undefined;\n const isVisible = column.getIsVisible();\n const parentHeader = column.parent?.columnDef?.header;\n\n return (\n <div {...attributes} className={className} onClick={() => column.toggleVisibility(!isVisible)} ref={ref}>\n {draggable ? <Icon name=\"drag\" className=\"text-grey-500 group-hover/column:text-grey-700 -mx-2 !h-5\" /> : null}\n <span className=\"flex-grow truncate\">\n {column.columnDef.meta?.header}\n {parentHeader ? <span className=\"italic\">({parentHeader})</span> : null}\n </span>\n {canHide ? <Checkbox checked={isVisible} onChange={() => column.toggleVisibility(!isVisible)} /> : null}\n </div>\n );\n});\n\nexport type HideOrOrderPopoverProps<TType = unknown> = PopoverProps & {\n table: ReactTable<TType>;\n};\n\nexport function HideOrOrderPopover<TType = unknown>(props: HideOrOrderPopoverProps<TType>) {\n const { table, trigger, ...popoverProps } = props;\n const { texts } = useLocalization();\n const [query, setQuery] = React.useState('');\n const allColumns = table.getAllLeafColumns();\n const tableMeta = table.options.meta as ReactTableMeta<TType>;\n const columns = React.useMemo(\n () =>\n allColumns\n .filter(column => !isInternalColumn(column.id))\n .filter(column =>\n query?.length\n ? column.columnDef.meta?.header.toLowerCase().includes(query.toLowerCase()) ||\n column.parent?.columnDef.meta?.header.toLowerCase().includes(query.toLowerCase())\n : true\n ),\n [allColumns, query]\n );\n\n const listClassName = 'flex max-h-64 flex-col gap-y-px overflow-auto';\n\n const handleReorder = (activeId, overId) => {\n if (columns.find(column => column.id === overId && column.columnDef.meta?.enableOrdering === false)) {\n return;\n }\n\n table.setColumnOrder((currentOrder = []) =>\n ensureOrdering(\n allColumns,\n SortablePrimitive.arrayMove(\n currentOrder,\n currentOrder.findIndex(c => c === activeId),\n currentOrder.findIndex(c => c === overId)\n )\n )\n );\n };\n\n return (\n <Popover {...popoverProps} anchor={trigger}>\n <Popover.Content>\n <div className=\"flex max-w-sm flex-col gap-2\">\n {table.options.enableHiding ? (\n <Input\n onChange={event => setQuery(event.target.value)}\n placeholder={texts.table3.columnSettings.search}\n value={query}\n />\n ) : null}\n {tableMeta.columnOrdering.isEnabled && columns.length && !query?.length ? (\n <SortablePrimitive.Container reorder={handleReorder}>\n <SortablePrimitive.List id=\"columns\" className={listClassName}>\n {columns\n .filter(column => !column.getIsGrouped())\n .map(column => (\n <SortablePrimitive.Item\n key={column.id}\n id={column.id}\n disabled={!column.columnDef.meta?.enableOrdering}\n asChild>\n <Column column={column as any} draggable={column.columnDef.meta?.enableOrdering} />\n </SortablePrimitive.Item>\n ))}\n </SortablePrimitive.List>\n </SortablePrimitive.Container>\n ) : (\n <div className={listClassName}>\n {columns.length\n ? columns.map(column => <Column column={column as any} key={column.id} />)\n : texts.table3.columnSettings.noResults}\n </div>\n )}\n </div>\n </Popover.Content>\n </Popover>\n );\n}\n"],"names":["Column","React","forwardRef","props","ref","column","draggable","dragAttributes","canHide","getCanHide","className","cn","attributes","undefined","isVisible","getIsVisible","parentHeader","_column$parent","parent","_column$parent$column","columnDef","header","onClick","toggleVisibility","Icon","name","meta","_column$columnDef$met","Checkbox","checked","onChange","HideOrOrderPopover","table","trigger","popoverProps","texts","useLocalization","query","setQuery","useState","allColumns","getAllLeafColumns","tableMeta","options","columns","useMemo","filter","isInternalColumn","id","_column$columnDef$met2","_column$parent2","_column$parent2$colum","length","toLowerCase","includes","listClassName","handleReorder","activeId","overId","find","_column$columnDef$met3","enableOrdering","setColumnOrder","currentOrder","ensureOrdering","SortablePrimitive","findIndex","c","Popover","anchor","Content","enableHiding","Input","event","target","value","placeholder","table3","columnSettings","search","columnOrdering","isEnabled","reorder","getIsGrouped","map","_column$columnDef$met4","_column$columnDef$met5","key","disabled","asChild","noResults"],"mappings":";;;;;;;;;;;;;AAgBA,MAAMA,MAAM,gBAAGC,cAAK,CAACC,UAAU,CAAC,SAASF,MAAMA,CAAkBG,KAAyB,EAAEC,GAA8B;;EACtH,MAAM;IAAEC,MAAM;IAAEC,SAAS,GAAG,KAAK;IAAE,GAAGC;GAAgB,GAAGJ,KAAK;EAC9D,MAAMK,OAAO,GAAGH,MAAM,CAACI,UAAU,EAAE;EAEnC,MAAMC,SAAS,GAAGC,EAAE,CAAC,0DAA0D,EAAE;IAC7E,mBAAmB,EAAEH,OAAO,IAAIF,SAAS;IACzC,sBAAsB,EAAEE,OAAO;IAC/B,uCAAuC,EAAEF;GAC5C,CAAC;EAEF,MAAMM,UAAU,GAAGN,SAAS,GAAGC,cAAc,GAAGM,SAAS;EACzD,MAAMC,SAAS,GAAGT,MAAM,CAACU,YAAY,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;GAC5B,CAAC,CACe,CACC,mBAE9B5D;IAAKS,SAAS,EAAE6C;KACXX,OAAO,CAACQ,MAAM,GACTR,OAAO,CAACwC,GAAG,CAAC/E,MAAM,iBAAIJ,6BAACD,MAAM;IAACK,MAAM,EAAEA,MAAa;IAAEkF,GAAG,EAAElF,MAAM,CAAC2C;IAAM,CAAC,GACxEb,KAAK,CAAC0C,MAAM,CAACC,cAAc,CAACY,SAAS,CACzC,CACT,CACC,CACQ,CACZ;AAElB;;;;"}
|
@@ -3,7 +3,7 @@ import { IconButton } from '../../../../../IconButton/IconButton.js';
|
|
3
3
|
import { useLocalization } from '../../../../../Provider/Localization.js';
|
4
4
|
import { Menu } from '../../../../../Menu/Menu.js';
|
5
5
|
import { FontSizes } from '../../../../../../types.js';
|
6
|
-
import { getSettings } from '../../../../../../primitives/Table/
|
6
|
+
import { getSettings } from '../../../../../../primitives/Table/useTableManager/util/settings.js';
|
7
7
|
import { HideOrOrderPopover } from './HideOrOrderPopover.js';
|
8
8
|
|
9
9
|
function Settings(props) {
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"Settings.js","sources":["../../../../../../../../../../../src/components/Report/components/Toolbar/components/Settings/Settings.tsx"],"sourcesContent":["import React from 'react';\nimport { Table as ReactTable, TableMeta as ReactTableMeta } from '@tanstack/react-table';\nimport { IconButton } from '../../../../../IconButton/IconButton';\nimport { useLocalization } from '../../../../../Provider/Localization';\nimport { Menu } from '../../../../../Menu/Menu';\nimport { HideOrOrderPopover } from './HideOrOrderPopover';\nimport { ReportCustomSettingsRenderer } from '../../../../types';\nimport { getSettings } from '../../../../../../primitives/Table/useTable/util/settings';\nimport { FontSizes } from '../../../../../../types';\nimport { IconName } from '../../../../../Icon/Icon';\n\nexport type SettingsProps<TType = unknown> = {\n customSettings?: ReportCustomSettingsRenderer;\n table: ReactTable<TType>;\n};\n\nexport function Settings<TType = unknown>(props: SettingsProps<TType>) {\n const { customSettings, table } = props;\n const { texts } = useLocalization();\n const tableMeta = table.options.meta as ReactTableMeta<TType>;\n\n const canHideOrOrder = table.options.enableHiding || tableMeta.columnOrdering.isEnabled;\n const canChangeFontSize = tableMeta.fontSize.isEnabled;\n const canChangeRowHeight = tableMeta.rowHeight.isEnabled;\n\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 'columnSettings': {\n if (canHideOrOrder) {\n popoverElement = popoverProps => (\n <HideOrOrderPopover {...popoverProps} open onChange={handleClosePopover} table={table} />\n );\n }\n }\n }\n }\n\n return (\n <IconButton\n aria-label={texts.table3.otherOptions.tooltip}\n icon=\"sliders\"\n menu={\n popoverElement\n ? undefined\n : menuProps => (\n <Menu {...menuProps}>\n <Menu.Content align=\"end\">\n {canHideOrOrder ? (\n <Menu.Item icon=\"columns\" onClick={() => setPopover('columnSettings')}>\n {texts.table3.columnSettings.button}\n </Menu.Item>\n ) : null}\n {canHideOrOrder && (canChangeRowHeight || canChangeFontSize || customSettings) ? (\n <Menu.Separator />\n ) : null}\n {canChangeRowHeight ? (\n <Menu.Item\n icon={`height-${tableMeta.rowHeight.height}` as IconName}\n subMenu={() => <RowHeightMenuItem tableMeta={tableMeta} />}>\n {texts.table3.rowHeight.tooltip}\n </Menu.Item>\n ) : null}\n {canChangeFontSize ? (\n <Menu.Item icon=\"font-size\" subMenu={() => <FontSizeMenuItem tableMeta={tableMeta} />}>\n {texts.table3.fontSize.tooltip}\n </Menu.Item>\n ) : null}\n\n {customSettings ? (\n <>\n {canChangeRowHeight || canChangeFontSize ? <Menu.Separator /> : null}\n {customSettings(getSettings(table)).map((item, index) => (\n <React.Fragment key={index}>{item}</React.Fragment>\n ))}\n </>\n ) : null}\n </Menu.Content>\n </Menu>\n )\n }\n popover={popoverElement}\n onClickCapture={event => event.preventDefault()}\n tooltip={texts.table3.otherOptions.tooltip}\n />\n );\n}\n\nfunction FontSizeMenuItem<TType = unknown>({ tableMeta }: { tableMeta: ReactTableMeta<TType> }) {\n const { texts } = useLocalization();\n\n return (\n <Menu.SubMenu>\n <Menu.RadioGroup onChange={tableMeta.fontSize.setSize as any} value={tableMeta.fontSize.size}>\n <Menu.RadioGroup.Item value={FontSizes.small}>{texts.table3.fontSize.sizes.small}</Menu.RadioGroup.Item>\n <Menu.RadioGroup.Item value={FontSizes.medium}>{texts.table3.fontSize.sizes.medium}</Menu.RadioGroup.Item>\n <Menu.RadioGroup.Item disabled={tableMeta.rowHeight.height === 'short'} value={FontSizes.large}>\n {texts.table3.fontSize.sizes.large}\n </Menu.RadioGroup.Item>\n </Menu.RadioGroup>\n </Menu.SubMenu>\n );\n}\n\nfunction RowHeightMenuItem<TType = unknown>({ tableMeta }: { tableMeta: ReactTableMeta<TType> }) {\n const { texts } = useLocalization();\n\n return (\n <Menu.SubMenu>\n <Menu.RadioGroup onChange={tableMeta.rowHeight.setHeight as any} value={tableMeta.rowHeight.height}>\n <Menu.RadioGroup.Item value=\"short\">{texts.table3.rowHeight.sizes.short}</Menu.RadioGroup.Item>\n <Menu.RadioGroup.Item value=\"medium\">{texts.table3.rowHeight.sizes.medium}</Menu.RadioGroup.Item>\n <Menu.RadioGroup.Item value=\"tall\">{texts.table3.rowHeight.sizes.tall}</Menu.RadioGroup.Item>\n <Menu.RadioGroup.Item value=\"extra-tall\">{texts.table3.rowHeight.sizes.extraTall}</Menu.RadioGroup.Item>\n </Menu.RadioGroup>\n </Menu.SubMenu>\n );\n}\n"],"names":["Settings","props","customSettings","table","texts","useLocalization","tableMeta","options","meta","canHideOrOrder","enableHiding","columnOrdering","isEnabled","canChangeFontSize","fontSize","canChangeRowHeight","rowHeight","popover","setPopover","React","useState","undefined","popoverElement","handleClosePopover","popoverProps","HideOrOrderPopover","open","onChange","IconButton","table3","otherOptions","tooltip","icon","menu","menuProps","Menu","Content","align","Item","onClick","columnSettings","button","Separator","height","subMenu","RowHeightMenuItem","FontSizeMenuItem","getSettings","map","item","index","Fragment","key","onClickCapture","event","preventDefault","SubMenu","RadioGroup","setSize","value","size","FontSizes","small","sizes","medium","disabled","large","setHeight","short","tall","extraTall"],"mappings":";;;;;;;;SAgBgBA,QAAQA,CAAkBC,KAA2B;EACjE,MAAM;IAAEC,cAAc;IAAEC;GAAO,GAAGF,KAAK;EACvC,MAAM;IAAEG;GAAO,GAAGC,eAAe,EAAE;EACnC,MAAMC,SAAS,GAAGH,KAAK,CAACI,OAAO,CAACC,IAA6B;EAE7D,MAAMC,cAAc,GAAGN,KAAK,CAACI,OAAO,CAACG,YAAY,IAAIJ,SAAS,CAACK,cAAc,CAACC,SAAS;EACvF,MAAMC,iBAAiB,GAAGP,SAAS,CAACQ,QAAQ,CAACF,SAAS;EACtD,MAAMG,kBAAkB,GAAGT,SAAS,CAACU,SAAS,CAACJ,SAAS;EAExD,MAAM,CAACK,OAAO,EAAEC,UAAU,CAAC,GAAGC,cAAK,CAACC,QAAQ,CAAqBC,SAAS,CAAC;EAE3E,IAAIC,cAAc;EAElB,IAAIL,OAAO,EAAE;IACT,MAAMM,kBAAkB,GAAGA,MAAML,UAAU,CAACG,SAAS,CAAC;IAEtD,QAAQJ,OAAO;MACX,KAAK,gBAAgB;QAAE;UACnB,IAAIR,cAAc,EAAE;YAChBa,cAAc,GAAGE,YAAY,mBACzBL,6BAACM,kBAAkB,oBAAKD,YAAY;cAAEE,IAAI;cAACC,QAAQ,EAAEJ,kBAAkB;cAAEpB,KAAK,EAAEA;eAAS,CAC5F;;;;;EAMjB,oBACIgB,6BAACS,UAAU;kBACKxB,KAAK,CAACyB,MAAM,CAACC,YAAY,CAACC,OAAO;IAC7CC,IAAI,EAAC,SAAS;IACdC,IAAI,EACAX,cAAc,GACRD,SAAS,GACTa,SAAS,mBACLf,6BAACgB,IAAI,oBAAKD,SAAS,gBACff,6BAACgB,IAAI,CAACC,OAAO;MAACC,KAAK,EAAC;OACf5B,cAAc,kBACXU,6BAACgB,IAAI,CAACG,IAAI;MAACN,IAAI,EAAC,SAAS;MAACO,OAA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;IAACqB,KAAK,EAAC;KAAUvD,KAAK,CAACyB,MAAM,CAACb,SAAS,CAAC+C,KAAK,CAACC,MAAM,CAAwB,eACjG7C,6BAACgB,IAAI,CAACsB,UAAU,CAACnB,IAAI;IAACqB,KAAK,EAAC;KAAQvD,KAAK,CAACyB,MAAM,CAACb,SAAS,CAAC+C,KAAK,CAACM,IAAI,CAAwB,eAC7FlD,6BAACgB,IAAI,CAACsB,UAAU,CAACnB,IAAI;IAACqB,KAAK,EAAC;KAAcvD,KAAK,CAACyB,MAAM,CAACb,SAAS,CAAC+C,KAAK,CAACO,SAAS,CAAwB,CAC1F,CACP;AAEvB;;;;"}
|
1
|
+
{"version":3,"file":"Settings.js","sources":["../../../../../../../../../../../src/components/Report/components/Toolbar/components/Settings/Settings.tsx"],"sourcesContent":["import React from 'react';\nimport { Table as ReactTable, TableMeta as ReactTableMeta } from '@tanstack/react-table';\nimport { IconButton } from '../../../../../IconButton/IconButton';\nimport { useLocalization } from '../../../../../Provider/Localization';\nimport { Menu } from '../../../../../Menu/Menu';\nimport { HideOrOrderPopover } from './HideOrOrderPopover';\nimport { ReportCustomSettingsRenderer } from '../../../../types';\nimport { getSettings } from '../../../../../../primitives/Table/useTableManager/util/settings';\nimport { FontSizes } from '../../../../../../types';\nimport { IconName } from '../../../../../Icon/Icon';\n\nexport type SettingsProps<TType = unknown> = {\n customSettings?: ReportCustomSettingsRenderer;\n table: ReactTable<TType>;\n};\n\nexport function Settings<TType = unknown>(props: SettingsProps<TType>) {\n const { customSettings, table } = props;\n const { texts } = useLocalization();\n const tableMeta = table.options.meta as ReactTableMeta<TType>;\n\n const canHideOrOrder = table.options.enableHiding || tableMeta.columnOrdering.isEnabled;\n const canChangeFontSize = tableMeta.fontSize.isEnabled;\n const canChangeRowHeight = tableMeta.rowHeight.isEnabled;\n\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 'columnSettings': {\n if (canHideOrOrder) {\n popoverElement = popoverProps => (\n <HideOrOrderPopover {...popoverProps} open onChange={handleClosePopover} table={table} />\n );\n }\n }\n }\n }\n\n return (\n <IconButton\n aria-label={texts.table3.otherOptions.tooltip}\n icon=\"sliders\"\n menu={\n popoverElement\n ? undefined\n : menuProps => (\n <Menu {...menuProps}>\n <Menu.Content align=\"end\">\n {canHideOrOrder ? (\n <Menu.Item icon=\"columns\" onClick={() => setPopover('columnSettings')}>\n {texts.table3.columnSettings.button}\n </Menu.Item>\n ) : null}\n {canHideOrOrder && (canChangeRowHeight || canChangeFontSize || customSettings) ? (\n <Menu.Separator />\n ) : null}\n {canChangeRowHeight ? (\n <Menu.Item\n icon={`height-${tableMeta.rowHeight.height}` as IconName}\n subMenu={() => <RowHeightMenuItem tableMeta={tableMeta} />}>\n {texts.table3.rowHeight.tooltip}\n </Menu.Item>\n ) : null}\n {canChangeFontSize ? (\n <Menu.Item icon=\"font-size\" subMenu={() => <FontSizeMenuItem tableMeta={tableMeta} />}>\n {texts.table3.fontSize.tooltip}\n </Menu.Item>\n ) : null}\n\n {customSettings ? (\n <>\n {canChangeRowHeight || canChangeFontSize ? <Menu.Separator /> : null}\n {customSettings(getSettings(table)).map((item, index) => (\n <React.Fragment key={index}>{item}</React.Fragment>\n ))}\n </>\n ) : null}\n </Menu.Content>\n </Menu>\n )\n }\n popover={popoverElement}\n onClickCapture={event => event.preventDefault()}\n tooltip={texts.table3.otherOptions.tooltip}\n />\n );\n}\n\nfunction FontSizeMenuItem<TType = unknown>({ tableMeta }: { tableMeta: ReactTableMeta<TType> }) {\n const { texts } = useLocalization();\n\n return (\n <Menu.SubMenu>\n <Menu.RadioGroup onChange={tableMeta.fontSize.setSize as any} value={tableMeta.fontSize.size}>\n <Menu.RadioGroup.Item value={FontSizes.small}>{texts.table3.fontSize.sizes.small}</Menu.RadioGroup.Item>\n <Menu.RadioGroup.Item value={FontSizes.medium}>{texts.table3.fontSize.sizes.medium}</Menu.RadioGroup.Item>\n <Menu.RadioGroup.Item disabled={tableMeta.rowHeight.height === 'short'} value={FontSizes.large}>\n {texts.table3.fontSize.sizes.large}\n </Menu.RadioGroup.Item>\n </Menu.RadioGroup>\n </Menu.SubMenu>\n );\n}\n\nfunction RowHeightMenuItem<TType = unknown>({ tableMeta }: { tableMeta: ReactTableMeta<TType> }) {\n const { texts } = useLocalization();\n\n return (\n <Menu.SubMenu>\n <Menu.RadioGroup onChange={tableMeta.rowHeight.setHeight as any} value={tableMeta.rowHeight.height}>\n <Menu.RadioGroup.Item value=\"short\">{texts.table3.rowHeight.sizes.short}</Menu.RadioGroup.Item>\n <Menu.RadioGroup.Item value=\"medium\">{texts.table3.rowHeight.sizes.medium}</Menu.RadioGroup.Item>\n <Menu.RadioGroup.Item value=\"tall\">{texts.table3.rowHeight.sizes.tall}</Menu.RadioGroup.Item>\n <Menu.RadioGroup.Item value=\"extra-tall\">{texts.table3.rowHeight.sizes.extraTall}</Menu.RadioGroup.Item>\n </Menu.RadioGroup>\n </Menu.SubMenu>\n );\n}\n"],"names":["Settings","props","customSettings","table","texts","useLocalization","tableMeta","options","meta","canHideOrOrder","enableHiding","columnOrdering","isEnabled","canChangeFontSize","fontSize","canChangeRowHeight","rowHeight","popover","setPopover","React","useState","undefined","popoverElement","handleClosePopover","popoverProps","HideOrOrderPopover","open","onChange","IconButton","table3","otherOptions","tooltip","icon","menu","menuProps","Menu","Content","align","Item","onClick","columnSettings","button","Separator","height","subMenu","RowHeightMenuItem","FontSizeMenuItem","getSettings","map","item","index","Fragment","key","onClickCapture","event","preventDefault","SubMenu","RadioGroup","setSize","value","size","FontSizes","small","sizes","medium","disabled","large","setHeight","short","tall","extraTall"],"mappings":";;;;;;;;SAgBgBA,QAAQA,CAAkBC,KAA2B;EACjE,MAAM;IAAEC,cAAc;IAAEC;GAAO,GAAGF,KAAK;EACvC,MAAM;IAAEG;GAAO,GAAGC,eAAe,EAAE;EACnC,MAAMC,SAAS,GAAGH,KAAK,CAACI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I,CAACsB,UAAU,CAACnB,IAAI;IAACqB,KAAK,EAAC;KAAcvD,KAAK,CAACyB,MAAM,CAACb,SAAS,CAAC+C,KAAK,CAACO,SAAS,CAAwB,CAC1F,CACP;AAEvB;;;;"}
|
@@ -1,5 +1,5 @@
|
|
1
1
|
import React__default from 'react';
|
2
|
-
import { getCellMinWidth } from '../../../primitives/Table/
|
2
|
+
import { getCellMinWidth } from '../../../primitives/Table/useTableManager/util/columns.js';
|
3
3
|
|
4
4
|
function useCssGridStylesheet(tableId, table, fontSize) {
|
5
5
|
const tableMeta = table.options.meta;
|