@economic/taco 2.45.0-alpha.3 → 2.45.0-alpha.31
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/charts/components/Area/AreaChart.d.ts +19 -0
- package/dist/charts/components/Bar/BarChart.d.ts +20 -0
- package/dist/charts/components/Donut/ActiveShape.d.ts +8 -0
- package/dist/charts/components/Donut/CenteredLabel.d.ts +11 -0
- package/dist/charts/components/Donut/DonutChart.d.ts +21 -0
- package/dist/charts/components/Donut/Legend.d.ts +13 -0
- package/dist/charts/components/Donut/util.d.ts +2 -0
- package/dist/charts/components/Legend.d.ts +16 -0
- package/dist/charts/components/Line/LineChart.d.ts +18 -0
- package/dist/charts/components/ResponsiveContainer.d.ts +5 -0
- package/dist/charts/components/Tooltip.d.ts +10 -0
- package/dist/charts/components/types.d.ts +5 -0
- package/dist/charts/utils/color.d.ts +3 -0
- package/dist/charts/utils/common.d.ts +37 -0
- package/dist/components/Alert/Alert.d.ts +1 -1
- package/dist/components/Hanger/Hanger.d.ts +1 -0
- package/dist/components/Icon/components/Autopay.d.ts +3 -0
- package/dist/components/Icon/components/AutopayPaused.d.ts +3 -0
- package/dist/components/Icon/components/Experiment.d.ts +3 -0
- package/dist/components/Icon/components/Person.d.ts +3 -0
- package/dist/components/Icon/components/PersonSolid.d.ts +3 -0
- package/dist/components/Icon/components/Wallet.d.ts +3 -0
- package/dist/components/Icon/components/index.d.ts +1 -1
- package/dist/components/Input/Input.d.ts +1 -1
- package/dist/components/Input/util.d.ts +5 -9
- package/dist/components/Listbox/util.d.ts +1 -1
- package/dist/components/Menu/components/Item.d.ts +1 -1
- package/dist/components/Menu/components/Link.d.ts +1 -1
- package/dist/components/Navigation2/components/Link.d.ts +1 -1
- package/dist/components/RadioGroup/RadioGroup.d.ts +3 -3
- package/dist/components/Report/Report.d.ts +4 -2
- package/dist/components/SearchInput2/SearchInput2.d.ts +2 -0
- package/dist/components/Select2/components/Option.d.ts +4 -4
- package/dist/components/Select2/components/Search.d.ts +1 -1
- package/dist/components/Table3/Table3.d.ts +3 -4
- package/dist/components/Table3/components/Row/Editing/CreateNewRow.d.ts +1 -3
- package/dist/components/Table3/components/Row/Editing/TemporaryRow.d.ts +1 -0
- package/dist/components/Table3/features/useEditingState.d.ts +13 -13
- package/dist/components/Table3/features/useTableEditing.d.ts +15 -14
- package/dist/components/Table3/types.d.ts +2 -0
- package/dist/components/Table3/util/editing.d.ts +3 -0
- package/dist/components/Tag/Tag.d.ts +1 -1
- package/dist/components/Tour/Tour.d.ts +2 -2
- package/dist/esm/index.css +148 -16
- package/dist/esm/packages/taco/src/charts/components/Area/AreaChart.js +67 -0
- package/dist/esm/packages/taco/src/charts/components/Area/AreaChart.js.map +1 -0
- package/dist/esm/packages/taco/src/charts/components/Bar/BarChart.js +120 -0
- package/dist/esm/packages/taco/src/charts/components/Bar/BarChart.js.map +1 -0
- package/dist/esm/packages/taco/src/charts/components/Donut/ActiveShape.js +47 -0
- package/dist/esm/packages/taco/src/charts/components/Donut/ActiveShape.js.map +1 -0
- package/dist/esm/packages/taco/src/charts/components/Donut/CenteredLabel.js +27 -0
- package/dist/esm/packages/taco/src/charts/components/Donut/CenteredLabel.js.map +1 -0
- package/dist/esm/packages/taco/src/charts/components/Donut/DonutChart.js +170 -0
- package/dist/esm/packages/taco/src/charts/components/Donut/DonutChart.js.map +1 -0
- package/dist/esm/packages/taco/src/charts/components/Donut/Legend.js +165 -0
- package/dist/esm/packages/taco/src/charts/components/Donut/Legend.js.map +1 -0
- package/dist/esm/packages/taco/src/charts/components/Donut/util.js +5 -0
- package/dist/esm/packages/taco/src/charts/components/Donut/util.js.map +1 -0
- package/dist/esm/packages/taco/src/charts/components/Legend.js +146 -0
- package/dist/esm/packages/taco/src/charts/components/Legend.js.map +1 -0
- package/dist/esm/packages/taco/src/charts/components/Line/LineChart.js +65 -0
- package/dist/esm/packages/taco/src/charts/components/Line/LineChart.js.map +1 -0
- package/dist/esm/packages/taco/src/charts/components/ResponsiveContainer.js +10 -0
- package/dist/esm/packages/taco/src/charts/components/ResponsiveContainer.js.map +1 -0
- package/dist/esm/packages/taco/src/charts/components/Tooltip.js +44 -0
- package/dist/esm/packages/taco/src/charts/components/Tooltip.js.map +1 -0
- package/dist/esm/packages/taco/src/charts/utils/color.js +24 -0
- package/dist/esm/packages/taco/src/charts/utils/color.js.map +1 -0
- package/dist/esm/packages/taco/src/charts/utils/common.js +34 -0
- package/dist/esm/packages/taco/src/charts/utils/common.js.map +1 -0
- package/dist/esm/packages/taco/src/components/Accordion/Accordion.js +6 -14
- package/dist/esm/packages/taco/src/components/Accordion/Accordion.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Alert/Alert.js +2 -0
- package/dist/esm/packages/taco/src/components/Alert/Alert.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Badge/Badge.js +9 -6
- package/dist/esm/packages/taco/src/components/Badge/Badge.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Banner/util.js +5 -0
- package/dist/esm/packages/taco/src/components/Banner/util.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Button/Button.js +2 -1
- package/dist/esm/packages/taco/src/components/Button/Button.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Card/Card.js +2 -2
- package/dist/esm/packages/taco/src/components/Card/Card.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Checkbox/Checkbox.js +3 -2
- package/dist/esm/packages/taco/src/components/Checkbox/Checkbox.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Combobox/useCombobox.js +9 -6
- package/dist/esm/packages/taco/src/components/Combobox/useCombobox.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Datepicker/Datepicker.js +13 -0
- package/dist/esm/packages/taco/src/components/Datepicker/Datepicker.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Datepicker/useDatepicker.js +9 -1
- package/dist/esm/packages/taco/src/components/Datepicker/useDatepicker.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Dialog/Dialog.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Dialog/components/Content.js +7 -5
- package/dist/esm/packages/taco/src/components/Dialog/components/Content.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Hanger/Hanger.js +4 -2
- package/dist/esm/packages/taco/src/components/Hanger/Hanger.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Header/components/Agreement/Avatar.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Header/components/AgreementSelector.js +2 -4
- package/dist/esm/packages/taco/src/components/Header/components/AgreementSelector.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Icon/components/Autopay.js +19 -0
- package/dist/esm/packages/taco/src/components/Icon/components/Autopay.js.map +1 -0
- package/dist/esm/packages/taco/src/components/Icon/components/AutopayPaused.js +19 -0
- package/dist/esm/packages/taco/src/components/Icon/components/AutopayPaused.js.map +1 -0
- package/dist/esm/packages/taco/src/components/Icon/components/Experiment.js +20 -0
- package/dist/esm/packages/taco/src/components/Icon/components/Experiment.js.map +1 -0
- package/dist/esm/packages/taco/src/components/Icon/components/Person.js +19 -0
- package/dist/esm/packages/taco/src/components/Icon/components/Person.js.map +1 -0
- package/dist/esm/packages/taco/src/components/Icon/components/PersonSolid.js +19 -0
- package/dist/esm/packages/taco/src/components/Icon/components/PersonSolid.js.map +1 -0
- package/dist/esm/packages/taco/src/components/Icon/components/Wallet.js +19 -0
- package/dist/esm/packages/taco/src/components/Icon/components/Wallet.js.map +1 -0
- package/dist/esm/packages/taco/src/components/Icon/components/index.js +12 -0
- package/dist/esm/packages/taco/src/components/Icon/components/index.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Input/util.js +1 -1
- package/dist/esm/packages/taco/src/components/Input/util.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Listbox/util.js +1 -7
- package/dist/esm/packages/taco/src/components/Listbox/util.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Menu/components/Content.js +5 -0
- package/dist/esm/packages/taco/src/components/Menu/components/Content.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Menu/components/Item.js.map +1 -1
- package/dist/esm/packages/taco/src/components/OverflowGroup/OverflowGroup.js.map +1 -1
- package/dist/esm/packages/taco/src/components/RadioGroup/RadioGroup.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Report/Report.js +2 -3
- package/dist/esm/packages/taco/src/components/Report/Report.js.map +1 -1
- package/dist/esm/packages/taco/src/components/ScrollArea/ScrollArea.js.map +1 -1
- package/dist/esm/packages/taco/src/components/SearchInput2/SearchInput2.js +6 -3
- package/dist/esm/packages/taco/src/components/SearchInput2/SearchInput2.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Select/Select.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Select/useSelect.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Select2/components/Create.js +10 -11
- package/dist/esm/packages/taco/src/components/Select2/components/Create.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Select2/components/Edit.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Select2/components/Option.js +7 -5
- package/dist/esm/packages/taco/src/components/Select2/components/Option.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Select2/components/Trigger.js +56 -19
- package/dist/esm/packages/taco/src/components/Select2/components/Trigger.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Shortcut/Shortcut.js +1 -1
- package/dist/esm/packages/taco/src/components/Shortcut/Shortcut.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 +1 -1
- package/dist/esm/packages/taco/src/components/Table/hooks/plugins/useRowSelect.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Table3/Table3.js +23 -12
- package/dist/esm/packages/taco/src/components/Table3/Table3.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Table3/components/Columns/Cell/Editing/RowMoveIndicator.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Table3/components/Columns/Cell/EditingControlCell.js +61 -36
- package/dist/esm/packages/taco/src/components/Table3/components/Columns/Cell/EditingControlCell.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Table3/components/Columns/Internal/EditingActionsMenu.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Table3/components/Editing/Alert.js +18 -10
- package/dist/esm/packages/taco/src/components/Table3/components/Editing/Alert.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Table3/components/Editing/DiscardChangesConfirmationDialog.js +0 -1
- package/dist/esm/packages/taco/src/components/Table3/components/Editing/DiscardChangesConfirmationDialog.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Table3/components/Row/Editing/CreateNewRow.js +6 -38
- package/dist/esm/packages/taco/src/components/Table3/components/Row/Editing/CreateNewRow.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Table3/components/Row/Editing/TemporaryRow.js +7 -6
- package/dist/esm/packages/taco/src/components/Table3/components/Row/Editing/TemporaryRow.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Table3/components/Toolbar/Editing/Editing.js +4 -0
- package/dist/esm/packages/taco/src/components/Table3/components/Toolbar/Editing/Editing.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Table3/features/useEditingState.js +80 -80
- package/dist/esm/packages/taco/src/components/Table3/features/useEditingState.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Table3/features/useTableEditing.js +69 -14
- package/dist/esm/packages/taco/src/components/Table3/features/useTableEditing.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Table3/listeners/useTableEditingListener.js +16 -22
- package/dist/esm/packages/taco/src/components/Table3/listeners/useTableEditingListener.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Table3/useTable3.js +8 -6
- package/dist/esm/packages/taco/src/components/Table3/useTable3.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Table3/util/editing.js +11 -4
- package/dist/esm/packages/taco/src/components/Table3/util/editing.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Tag/Tag.js +6 -4
- package/dist/esm/packages/taco/src/components/Tag/Tag.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Toast/Toaster.js +16 -2
- package/dist/esm/packages/taco/src/components/Toast/Toaster.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Tooltip/Tooltip.js +2 -2
- package/dist/esm/packages/taco/src/components/Tooltip/Tooltip.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Tour/Tour.js +2 -2
- package/dist/esm/packages/taco/src/components/Tour/Tour.js.map +1 -1
- package/dist/esm/packages/taco/src/hooks/useGlobalKeyDown.js.map +1 -1
- package/dist/esm/packages/taco/src/hooks/useIntersectionObserver.js.map +1 -1
- package/dist/esm/packages/taco/src/hooks/useLazyEffect.js +1 -1
- package/dist/esm/packages/taco/src/hooks/useLazyEffect.js.map +1 -1
- package/dist/esm/packages/taco/src/index.js +6 -1
- package/dist/esm/packages/taco/src/index.js.map +1 -1
- package/dist/esm/packages/taco/src/primitives/BubbleSelect.js +1 -1
- package/dist/esm/packages/taco/src/primitives/BubbleSelect.js.map +1 -1
- package/dist/esm/packages/taco/src/primitives/Collection/components/Root.js +5 -3
- package/dist/esm/packages/taco/src/primitives/Collection/components/Root.js.map +1 -1
- package/dist/esm/packages/taco/src/primitives/Sortable/components/Container.js +1 -1
- package/dist/esm/packages/taco/src/primitives/Sortable/components/Container.js.map +1 -1
- package/dist/esm/packages/taco/src/primitives/Sortable/components/Item.js.map +1 -1
- package/dist/esm/packages/taco/src/primitives/Table/Core/Table.js +8 -10
- package/dist/esm/packages/taco/src/primitives/Table/Core/Table.js.map +1 -1
- package/dist/esm/packages/taco/src/primitives/Table/Core/components/Body/Body.js +2 -0
- package/dist/esm/packages/taco/src/primitives/Table/Core/components/Body/Body.js.map +1 -1
- package/dist/esm/packages/taco/src/primitives/Table/Core/components/Body/EmptyStateBody.js +15 -2
- package/dist/esm/packages/taco/src/primitives/Table/Core/components/Body/EmptyStateBody.js.map +1 -1
- package/dist/esm/packages/taco/src/primitives/Table/Core/components/Columns/Internal/Actions.js +4 -3
- package/dist/esm/packages/taco/src/primitives/Table/Core/components/Columns/Internal/Actions.js.map +1 -1
- package/dist/esm/packages/taco/src/primitives/Table/Core/components/Columns/Internal/Drag.js +7 -0
- package/dist/esm/packages/taco/src/primitives/Table/Core/components/Columns/Internal/Drag.js.map +1 -1
- package/dist/esm/packages/taco/src/primitives/Table/Core/components/Columns/Internal/Expansion.js +11 -0
- package/dist/esm/packages/taco/src/primitives/Table/Core/components/Columns/Internal/Expansion.js.map +1 -1
- package/dist/esm/packages/taco/src/primitives/Table/Core/components/Columns/Internal/Selection.js +10 -7
- package/dist/esm/packages/taco/src/primitives/Table/Core/components/Columns/Internal/Selection.js.map +1 -1
- package/dist/esm/packages/taco/src/primitives/Table/Core/components/Footer/Footer.js +23 -6
- package/dist/esm/packages/taco/src/primitives/Table/Core/components/Footer/Footer.js.map +1 -1
- package/dist/esm/packages/taco/src/primitives/Table/Core/components/Footer/Summary.js +7 -6
- package/dist/esm/packages/taco/src/primitives/Table/Core/components/Footer/Summary.js.map +1 -1
- package/dist/esm/packages/taco/src/primitives/Table/Core/components/Header/Header.js +20 -6
- package/dist/esm/packages/taco/src/primitives/Table/Core/components/Header/Header.js.map +1 -1
- package/dist/esm/packages/taco/src/primitives/Table/Core/components/Header/components/Goto.js.map +1 -1
- package/dist/esm/packages/taco/src/primitives/Table/Core/components/Header/components/Resizer.js.map +1 -1
- package/dist/esm/packages/taco/src/primitives/Table/Core/components/Header/components/SortIndicator.js.map +1 -1
- package/dist/esm/packages/taco/src/primitives/Table/Core/components/Header/util.js.map +1 -1
- package/dist/esm/packages/taco/src/primitives/Table/Core/components/Row/BuiltIns/DisplayRow.js +7 -15
- package/dist/esm/packages/taco/src/primitives/Table/Core/components/Row/BuiltIns/DisplayRow.js.map +1 -1
- package/dist/esm/packages/taco/src/primitives/Table/Core/components/Row/BuiltIns/SkeletonRow.js +24 -22
- package/dist/esm/packages/taco/src/primitives/Table/Core/components/Row/BuiltIns/SkeletonRow.js.map +1 -1
- package/dist/esm/packages/taco/src/primitives/Table/Core/components/Row/Row.js +44 -5
- package/dist/esm/packages/taco/src/primitives/Table/Core/components/Row/Row.js.map +1 -1
- package/dist/esm/packages/taco/src/primitives/Table/Core/components/Row/RowContext.js +3 -2
- package/dist/esm/packages/taco/src/primitives/Table/Core/components/Row/RowContext.js.map +1 -1
- package/dist/esm/packages/taco/src/primitives/Table/Core/components/Toolbar/components/Filters/FilterContext.js +6 -0
- package/dist/esm/packages/taco/src/primitives/Table/Core/components/Toolbar/components/Filters/FilterContext.js.map +1 -0
- package/dist/esm/packages/taco/src/primitives/Table/Core/components/Toolbar/components/Filters/ManageFiltersPopover.js +5 -3
- package/dist/esm/packages/taco/src/primitives/Table/Core/components/Toolbar/components/Filters/ManageFiltersPopover.js.map +1 -1
- package/dist/esm/packages/taco/src/primitives/Table/Core/components/Toolbar/components/Filters/components/Filter.js +0 -2
- package/dist/esm/packages/taco/src/primitives/Table/Core/components/Toolbar/components/Filters/components/Filter.js.map +1 -1
- package/dist/esm/packages/taco/src/primitives/Table/Core/components/Toolbar/components/Filters/components/FilterColumn.js +2 -1
- package/dist/esm/packages/taco/src/primitives/Table/Core/components/Toolbar/components/Filters/components/FilterColumn.js.map +1 -1
- package/dist/esm/packages/taco/src/primitives/Table/Core/components/Toolbar/components/Filters/components/FilterComparator.js +4 -0
- package/dist/esm/packages/taco/src/primitives/Table/Core/components/Toolbar/components/Filters/components/FilterComparator.js.map +1 -1
- package/dist/esm/packages/taco/src/primitives/Table/Core/components/Toolbar/components/Filters/components/FilterValue.js +4 -4
- package/dist/esm/packages/taco/src/primitives/Table/Core/components/Toolbar/components/Filters/components/FilterValue.js.map +1 -1
- package/dist/esm/packages/taco/src/primitives/Table/Core/components/Toolbar/components/Print/Print.js +3 -1
- package/dist/esm/packages/taco/src/primitives/Table/Core/components/Toolbar/components/Print/Print.js.map +1 -1
- package/dist/esm/packages/taco/src/primitives/Table/Core/components/Toolbar/components/Search/Search.js +26 -4
- package/dist/esm/packages/taco/src/primitives/Table/Core/components/Toolbar/components/Search/Search.js.map +1 -1
- package/dist/esm/packages/taco/src/primitives/Table/Core/features/useTableGlobalShortcuts.js +2 -2
- package/dist/esm/packages/taco/src/primitives/Table/Core/features/useTableGlobalShortcuts.js.map +1 -1
- package/dist/esm/packages/taco/src/primitives/Table/Core/features/useTableRenderer.js +54 -56
- package/dist/esm/packages/taco/src/primitives/Table/Core/features/useTableRenderer.js.map +1 -1
- package/dist/esm/packages/taco/src/primitives/Table/Core/features/useTableStyleGrid.js +2 -2
- package/dist/esm/packages/taco/src/primitives/Table/Core/features/useTableStyleGrid.js.map +1 -1
- package/dist/esm/packages/taco/src/primitives/Table/Core/useTable.js +1 -1
- package/dist/esm/packages/taco/src/primitives/Table/Core/useTable.js.map +1 -1
- package/dist/esm/packages/taco/src/primitives/Table/types.js +3 -7
- package/dist/esm/packages/taco/src/primitives/Table/types.js.map +1 -1
- package/dist/esm/packages/taco/src/primitives/Table/useTableDataLoader.js +13 -12
- package/dist/esm/packages/taco/src/primitives/Table/useTableDataLoader.js.map +1 -1
- package/dist/esm/packages/taco/src/primitives/Table/useTableDataLoader2.js +224 -0
- package/dist/esm/packages/taco/src/primitives/Table/useTableDataLoader2.js.map +1 -0
- package/dist/esm/packages/taco/src/primitives/Table/useTableManager/features/useTableRowActions.js +11 -0
- package/dist/esm/packages/taco/src/primitives/Table/useTableManager/features/useTableRowActions.js.map +1 -1
- package/dist/esm/packages/taco/src/primitives/Table/useTableManager/features/useTableRowActive.js +1 -1
- package/dist/esm/packages/taco/src/primitives/Table/useTableManager/features/useTableRowActive.js.map +1 -1
- package/dist/esm/packages/taco/src/primitives/Table/useTableManager/features/useTableRowExpansion.js +2 -1
- package/dist/esm/packages/taco/src/primitives/Table/useTableManager/features/useTableRowExpansion.js.map +1 -1
- package/dist/esm/packages/taco/src/primitives/Table/useTableManager/features/useTableSearch.js +3 -2
- package/dist/esm/packages/taco/src/primitives/Table/useTableManager/features/useTableSearch.js.map +1 -1
- package/dist/esm/packages/taco/src/primitives/Table/useTableManager/features/useTableServerLoading.js +18 -8
- package/dist/esm/packages/taco/src/primitives/Table/useTableManager/features/useTableServerLoading.js.map +1 -1
- package/dist/esm/packages/taco/src/primitives/Table/useTableManager/listeners/useTableDataListener.js +3 -4
- package/dist/esm/packages/taco/src/primitives/Table/useTableManager/listeners/useTableDataListener.js.map +1 -1
- package/dist/esm/packages/taco/src/primitives/Table/useTableManager/listeners/useTableFilterListener.js +3 -1
- package/dist/esm/packages/taco/src/primitives/Table/useTableManager/listeners/useTableFilterListener.js.map +1 -1
- package/dist/esm/packages/taco/src/primitives/Table/useTableManager/listeners/useTableFontSizeListener.js +2 -1
- package/dist/esm/packages/taco/src/primitives/Table/useTableManager/listeners/useTableFontSizeListener.js.map +1 -1
- package/dist/esm/packages/taco/src/primitives/Table/useTableManager/listeners/useTableRowSelectionListener.js +4 -4
- package/dist/esm/packages/taco/src/primitives/Table/useTableManager/listeners/useTableRowSelectionListener.js.map +1 -1
- package/dist/esm/packages/taco/src/primitives/Table/useTableManager/listeners/useTableSearchListener.js +14 -13
- package/dist/esm/packages/taco/src/primitives/Table/useTableManager/listeners/useTableSearchListener.js.map +1 -1
- package/dist/esm/packages/taco/src/primitives/Table/useTableManager/listeners/useTableServerLoadingListener.js +7 -3
- package/dist/esm/packages/taco/src/primitives/Table/useTableManager/listeners/useTableServerLoadingListener.js.map +1 -1
- package/dist/esm/packages/taco/src/primitives/Table/useTableManager/listeners/useTableSettingsListener.js.map +1 -1
- package/dist/esm/packages/taco/src/primitives/Table/useTableManager/useTableManager.js +6 -5
- package/dist/esm/packages/taco/src/primitives/Table/useTableManager/useTableManager.js.map +1 -1
- package/dist/esm/packages/taco/src/primitives/Table/useTableManager/util/columns.js +4 -1
- package/dist/esm/packages/taco/src/primitives/Table/useTableManager/util/columns.js.map +1 -1
- package/dist/esm/packages/taco/src/primitives/Table/useTableManager/util/dataTypes.js +6 -2
- package/dist/esm/packages/taco/src/primitives/Table/useTableManager/util/dataTypes.js.map +1 -1
- package/dist/esm/packages/taco/src/primitives/Table/useTableManager/util/filtering.js +6 -0
- package/dist/esm/packages/taco/src/primitives/Table/useTableManager/util/filtering.js.map +1 -1
- package/dist/esm/packages/taco/src/primitives/Table/useTableManager/util/presets.js +7 -1
- package/dist/esm/packages/taco/src/primitives/Table/useTableManager/util/presets.js.map +1 -1
- package/dist/esm/packages/taco/src/primitives/Table/useTableManager/util/search.js +7 -1
- package/dist/esm/packages/taco/src/primitives/Table/useTableManager/util/search.js.map +1 -1
- package/dist/esm/packages/taco/src/primitives/Table/useTableManager/util/settings.js.map +1 -1
- package/dist/esm/packages/taco/src/primitives/Table/useTableManager/util/setup.js +20 -5
- package/dist/esm/packages/taco/src/primitives/Table/useTableManager/util/setup.js.map +1 -1
- package/dist/esm/packages/taco/src/primitives/Table/useTableManager/util/sorting.js.map +1 -1
- package/dist/esm/packages/taco/src/types.js.map +1 -1
- package/dist/esm/packages/taco/src/utils/dom.js +12 -1
- package/dist/esm/packages/taco/src/utils/dom.js.map +1 -1
- package/dist/esm/packages/taco/src/utils/tailwind.js +2 -0
- package/dist/esm/packages/taco/src/utils/tailwind.js.map +1 -1
- package/dist/esm/packages/taco/tailwind.colors.js +122 -0
- package/dist/esm/packages/taco/tailwind.colors.js.map +1 -0
- package/dist/hooks/useLazyDebouncedEffect.d.ts +2 -0
- package/dist/index.css +148 -16
- package/dist/index.d.ts +6 -0
- package/dist/primitives/Sortable/components/Container.d.ts +1 -1
- package/dist/primitives/Table/Core/Table.d.ts +1 -0
- package/dist/primitives/Table/Core/components/Body/EmptyStateBody.d.ts +1 -0
- package/dist/primitives/Table/Core/components/Body/util.d.ts +4 -4
- package/dist/primitives/Table/Core/components/Footer/Footer.d.ts +2 -2
- package/dist/primitives/Table/Core/components/Header/components/SortIndicator.d.ts +2 -2
- package/dist/primitives/Table/Core/components/Row/BuiltIns/SkeletonRow.d.ts +2 -2
- package/dist/primitives/Table/Core/components/Row/Row.d.ts +2 -0
- package/dist/primitives/Table/Core/components/Row/RowContext.d.ts +2 -1
- package/dist/primitives/Table/Core/components/Toolbar/components/Filters/FilterContext.d.ts +3 -0
- package/dist/primitives/Table/Core/components/Toolbar/components/Filters/components/Filter.d.ts +0 -1
- package/dist/primitives/Table/Core/components/Toolbar/components/Filters/components/FilterColumn.d.ts +0 -3
- package/dist/primitives/Table/Core/features/useTableRenderer.d.ts +1 -1
- package/dist/primitives/Table/Core/types.d.ts +2 -1
- package/dist/primitives/Table/types.d.ts +24 -16
- package/dist/primitives/Table/useTableDataLoader.d.ts +2 -2
- package/dist/primitives/Table/useTableDataLoader2.d.ts +23 -0
- package/dist/primitives/Table/useTableManager/features/useTableRowActions.d.ts +2 -0
- package/dist/primitives/Table/useTableManager/features/useTableRowExpansion.d.ts +2 -1
- package/dist/primitives/Table/useTableManager/features/useTableSearch.d.ts +4 -2
- package/dist/primitives/Table/useTableManager/features/useTableServerLoading.d.ts +6 -3
- package/dist/primitives/Table/useTableManager/listeners/useTableDataListener.d.ts +1 -1
- package/dist/primitives/Table/useTableManager/listeners/useTableSearchListener.d.ts +1 -2
- package/dist/primitives/Table/useTableManager/useTableManager.d.ts +2 -1
- package/dist/primitives/Table/useTableManager/util/columns.d.ts +2 -1
- package/dist/primitives/Table/useTableManager/util/dataTypes.d.ts +1 -1
- package/dist/primitives/Table/useTableManager/util/settings.d.ts +1 -1
- package/dist/taco.cjs.development.js +2055 -585
- package/dist/taco.cjs.development.js.map +1 -1
- package/dist/taco.cjs.production.min.js +1 -1
- package/dist/taco.cjs.production.min.js.map +1 -1
- package/dist/types.d.ts +1 -1
- package/dist/utils/dom.d.ts +2 -2
- package/package.json +9 -8
- package/tailwind.colors.js +121 -0
- package/tailwind.config.js +3 -2
- package/dist/components/Table3/components/Row/Editing/CreateRowButton.d.ts +0 -11
@@ -27,16 +27,16 @@ var CollapsiblePrimitive = require('@radix-ui/react-collapsible');
|
|
27
27
|
var PrimitiveSwitch = require('@radix-ui/react-switch');
|
28
28
|
var DropdownMenuPrimitive = require('@radix-ui/react-dropdown-menu');
|
29
29
|
var RadioGroupPrimitive = require('@radix-ui/react-radio-group');
|
30
|
-
var
|
30
|
+
var ReactDOM = _interopDefault(require('react-dom'));
|
31
31
|
var reactTable = require('@tanstack/react-table');
|
32
32
|
var get = _interopDefault(require('lodash/get'));
|
33
33
|
var reactVirtual = require('@tanstack/react-virtual');
|
34
|
-
var reactIntersectionObserver = require('react-intersection-observer');
|
35
34
|
var core = require('@dnd-kit/core');
|
36
35
|
var modifiers = require('@dnd-kit/modifiers');
|
37
36
|
var SortablePrimitive = require('@dnd-kit/sortable');
|
38
37
|
var utilities = require('@dnd-kit/utilities');
|
39
38
|
var reactTable$1 = require('react-table');
|
39
|
+
var reactIntersectionObserver = require('react-intersection-observer');
|
40
40
|
var reactWindow = require('react-window');
|
41
41
|
var InfiniteLoader = _interopDefault(require('react-window-infinite-loader'));
|
42
42
|
var set = _interopDefault(require('lodash/set'));
|
@@ -48,6 +48,7 @@ var setWith = _interopDefault(require('lodash/setWith'));
|
|
48
48
|
var TabsPrimitive = require('@radix-ui/react-tabs');
|
49
49
|
var Joyride = require('react-joyride');
|
50
50
|
var Joyride__default = _interopDefault(Joyride);
|
51
|
+
var Recharts = require('recharts');
|
51
52
|
|
52
53
|
const AVAILABLE_COLORS = ['green', 'yellow', 'red', 'blue', 'purple', 'brown', 'pink', 'orange', 'grey', 'transparent'];
|
53
54
|
const getColorByState = state => {
|
@@ -58,6 +59,8 @@ const getColorByState = state => {
|
|
58
59
|
return 'yellow';
|
59
60
|
case 'error':
|
60
61
|
return 'red';
|
62
|
+
case 'experiment':
|
63
|
+
return 'purple';
|
61
64
|
case 'success':
|
62
65
|
return 'green';
|
63
66
|
default:
|
@@ -390,6 +393,36 @@ function IconAttach(props, svgRef) {
|
|
390
393
|
}
|
391
394
|
var Attach = /*#__PURE__*/React.forwardRef(IconAttach);
|
392
395
|
|
396
|
+
function IconAutopayPaused(props, svgRef) {
|
397
|
+
return /*#__PURE__*/React.createElement("svg", Object.assign({
|
398
|
+
fill: "none",
|
399
|
+
xmlns: "http://www.w3.org/2000/svg",
|
400
|
+
viewBox: "0 0 24 24",
|
401
|
+
ref: svgRef
|
402
|
+
}, props), /*#__PURE__*/React.createElement("path", {
|
403
|
+
fillRule: "evenodd",
|
404
|
+
clipRule: "evenodd",
|
405
|
+
d: "M9.356 2.503a.743.743 0 10.449 1.417 9.323 9.323 0 011.909-.391 8.998 8.998 0 011.883.013.743.743 0 10.168-1.476 10.484 10.484 0 00-2.195-.016 10.81 10.81 0 00-2.214.453zM7.46 5.037a.743.743 0 10-.817-1.241c-.628.413-1.215.893-1.747 1.433-.52.528-.978 1.103-1.366 1.712a.743.743 0 101.253.798 8.928 8.928 0 011.17-1.467A9.28 9.28 0 017.46 5.037zm9.14-2.22a.743.743 0 00-.59 1.363 7.904 7.904 0 011.611.935c.484.363.914.776 1.287 1.229a.743.743 0 001.147-.945 9.004 9.004 0 00-1.54-1.472 9.387 9.387 0 00-1.915-1.11zM3.767 10.008a.743.743 0 10-1.432-.396A9.316 9.316 0 002 11.795a.743.743 0 101.485.048 7.83 7.83 0 01.282-1.835zm17.716-2.152a.743.743 0 10-1.389.529c.21.549.353 1.126.425 1.723a.743.743 0 101.476-.18 8.81 8.81 0 00-.512-2.072zm-9.28-.732c-.26 0-.527.127-.527.505v.406c-1.567.145-2.577 1.085-2.577 2.426 0 1.125.639 1.862 1.907 2.182l1.296.285c.836.18 1.167.435 1.167.87 0 .558-.441.923-1.26.923-.586 0-1.154-.244-1.67-.714-.332-.278-.54-.36-.796-.36-.412 0-.743.256-.743.709 0 .348.186.684.51.98.482.447 1.26.72 2.143.796v.354c0 .371.272.505.533.505.262 0 .529-.134.529-.505v-.366c1.625-.191 2.64-1.143 2.64-2.519 0-1.133-.652-1.845-1.978-2.156l-1.3-.27c-.738-.145-1.075-.424-1.075-.859 0-.488.436-.876 1.12-.876.581 0 .999.185 1.492.655.29.25.528.36.842.36.366 0 .667-.267.667-.65 0-.325-.174-.667-.499-.975-.43-.418-1.12-.685-1.892-.783v-.418c0-.372-.267-.505-.528-.505zm8.802 8.025a.743.743 0 00-.946.457 7.718 7.718 0 01-2.763 3.704 8.23 8.23 0 01-4.48 1.548 8.628 8.628 0 01-4.69-1.152c-.906-.524-1.649-1.03-2.262-1.749l.79.276a.743.743 0 10.49-1.404l-2.732-.952a.743.743 0 00-.946.458l-.997 2.86a.743.743 0 101.403.49l.45-1.294c.84 1.193 1.88 1.918 3.06 2.601a10.114 10.114 0 005.5 1.35 9.715 9.715 0 005.287-1.83 9.204 9.204 0 003.293-4.417.743.743 0 00-.457-.946z",
|
406
|
+
fill: "currentColor"
|
407
|
+
}));
|
408
|
+
}
|
409
|
+
var AutopayPaused = /*#__PURE__*/React.forwardRef(IconAutopayPaused);
|
410
|
+
|
411
|
+
function IconAutopay(props, svgRef) {
|
412
|
+
return /*#__PURE__*/React.createElement("svg", Object.assign({
|
413
|
+
fill: "none",
|
414
|
+
xmlns: "http://www.w3.org/2000/svg",
|
415
|
+
viewBox: "0 0 24 24",
|
416
|
+
ref: svgRef
|
417
|
+
}, props), /*#__PURE__*/React.createElement("path", {
|
418
|
+
fillRule: "evenodd",
|
419
|
+
clipRule: "evenodd",
|
420
|
+
d: "M1.367 6.142a.734.734 0 011.003.269l.83 1.438a9.885 9.885 0 017.774-5.769 9.993 9.993 0 015.73.975 10.135 10.135 0 014.249 4.002.734.734 0 01-1.272.734 8.667 8.667 0 00-3.633-3.422 8.525 8.525 0 00-4.888-.832 8.417 8.417 0 00-6.355 4.376l.749-.433a.734.734 0 01.734 1.271l-2.56 1.479a.734.734 0 01-1.004-.269L1.098 7.145a.734.734 0 01.27-1.003zm2.895 10.273a.734.734 0 011.003.269 7.627 7.627 0 003.384 3.09 8.195 8.195 0 004.668.668 8.64 8.64 0 004.376-2.005c.792-.684 1.427-1.318 1.895-2.138l-.731.422a.734.734 0 01-.734-1.27l2.495-1.442a.734.734 0 011.003.27l1.501 2.6a.734.734 0 01-1.271.734l-.683-1.183c-.6 1.326-1.485 2.229-2.516 3.118a10.107 10.107 0 01-5.122 2.346 9.664 9.664 0 01-5.504-.79 9.095 9.095 0 01-4.032-3.686.734.734 0 01.268-1.003zm7.382-8.75c0-.372.264-.498.522-.498s.521.132.521.499v.413c.763.097 1.446.361 1.87.774.321.304.493.642.493.963 0 .379-.298.643-.66.643-.309 0-.544-.11-.83-.356-.488-.464-.901-.648-1.475-.648-.676 0-1.107.384-1.107.866 0 .43.333.706 1.062.849l1.285.267c1.31.307 1.955 1.01 1.955 2.13 0 1.36-1.004 2.3-2.61 2.489v.361c0 .367-.264.5-.522.5s-.527-.133-.527-.5v-.35c-.872-.074-1.64-.344-2.116-.785-.322-.293-.505-.625-.505-.97 0-.447.327-.7.734-.7.252 0 .459.081.786.357.51.464 1.072.705 1.651.705.809 0 1.245-.361 1.245-.912 0-.43-.327-.682-1.153-.86l-1.281-.282c-1.253-.316-1.885-1.044-1.885-2.155 0-1.325.998-2.254 2.547-2.398v-.401z",
|
421
|
+
fill: "currentColor"
|
422
|
+
}));
|
423
|
+
}
|
424
|
+
var Autopay = /*#__PURE__*/React.forwardRef(IconAutopay);
|
425
|
+
|
393
426
|
function IconAutotextInsert(props, svgRef) {
|
394
427
|
return /*#__PURE__*/React.createElement("svg", Object.assign({
|
395
428
|
xmlns: "http://www.w3.org/2000/svg",
|
@@ -1584,6 +1617,22 @@ function IconExpenses(props, svgRef) {
|
|
1584
1617
|
}
|
1585
1618
|
var Expenses = /*#__PURE__*/React.forwardRef(IconExpenses);
|
1586
1619
|
|
1620
|
+
function IconExperiment(props, svgRef) {
|
1621
|
+
return /*#__PURE__*/React.createElement("svg", Object.assign({
|
1622
|
+
fill: "none",
|
1623
|
+
xmlns: "http://www.w3.org/2000/svg",
|
1624
|
+
viewBox: "0 0 20 20",
|
1625
|
+
ref: svgRef
|
1626
|
+
}, props), /*#__PURE__*/React.createElement("path", {
|
1627
|
+
fillRule: "evenodd",
|
1628
|
+
clipRule: "evenodd",
|
1629
|
+
d: "M8.962 9.26V5.313h2.843V9.28c0 .376.796 1.24 1.049 1.511L14.5 12.5c-.507.218-3.166-1.19-4.341-.211C7.159 14.789 6 13 6.5 12c.316-.632 2.462-1.803 2.462-2.74zm.24-4.469a.762.762 0 00-.752.772v3.696a.61.61 0 01-.177.43l-2.592 2.6c-.911.913-.281 2.502.992 2.502h7.154c1.25 0 1.89-1.538 1.027-2.466l-2.446-2.63a.61.61 0 01-.162-.415V5.563a.762.762 0 00-.752-.772H9.202z",
|
1630
|
+
fill: "currentColor",
|
1631
|
+
stroke: "currentColor"
|
1632
|
+
}));
|
1633
|
+
}
|
1634
|
+
var Experiment = /*#__PURE__*/React.forwardRef(IconExperiment);
|
1635
|
+
|
1587
1636
|
function IconExportToExcel(props, svgRef) {
|
1588
1637
|
return /*#__PURE__*/React.createElement("svg", Object.assign({
|
1589
1638
|
xmlns: "http://www.w3.org/2000/svg",
|
@@ -2625,6 +2674,21 @@ function IconPersonPlus(props, svgRef) {
|
|
2625
2674
|
}
|
2626
2675
|
var PersonPlus = /*#__PURE__*/React.forwardRef(IconPersonPlus);
|
2627
2676
|
|
2677
|
+
function IconPersonSolid(props, svgRef) {
|
2678
|
+
return /*#__PURE__*/React.createElement("svg", Object.assign({
|
2679
|
+
fill: "none",
|
2680
|
+
xmlns: "http://www.w3.org/2000/svg",
|
2681
|
+
viewBox: "0 0 24 24",
|
2682
|
+
ref: svgRef
|
2683
|
+
}, props), /*#__PURE__*/React.createElement("path", {
|
2684
|
+
fillRule: "evenodd",
|
2685
|
+
clipRule: "evenodd",
|
2686
|
+
d: "M12 11.5c4.553 0 7.21 2.43 7.969 7.29.24 1.537-.928 2.962-2.608 3.182-.144.018-.29.028-.435.028H7.074C5.376 22 4 20.74 4 19.187c0-.133.01-.266.03-.398C4.79 13.93 7.448 11.5 12 11.5zM12 2c2.112 0 3.825 1.903 3.825 4.25S14.112 10.5 12 10.5c-2.113 0-3.825-1.903-3.825-4.25S9.887 2 12 2z",
|
2687
|
+
fill: "currentColor"
|
2688
|
+
}));
|
2689
|
+
}
|
2690
|
+
var PersonSolid = /*#__PURE__*/React.forwardRef(IconPersonSolid);
|
2691
|
+
|
2628
2692
|
function IconPersonTick(props, svgRef) {
|
2629
2693
|
return /*#__PURE__*/React.createElement("svg", Object.assign({
|
2630
2694
|
xmlns: "http://www.w3.org/2000/svg",
|
@@ -2638,6 +2702,21 @@ function IconPersonTick(props, svgRef) {
|
|
2638
2702
|
}
|
2639
2703
|
var PersonTick = /*#__PURE__*/React.forwardRef(IconPersonTick);
|
2640
2704
|
|
2705
|
+
function IconPerson(props, svgRef) {
|
2706
|
+
return /*#__PURE__*/React.createElement("svg", Object.assign({
|
2707
|
+
fill: "none",
|
2708
|
+
xmlns: "http://www.w3.org/2000/svg",
|
2709
|
+
viewBox: "0 0 24 24",
|
2710
|
+
ref: svgRef
|
2711
|
+
}, props), /*#__PURE__*/React.createElement("path", {
|
2712
|
+
fillRule: "evenodd",
|
2713
|
+
clipRule: "evenodd",
|
2714
|
+
d: "M12 11.5c4.553 0 7.21 2.43 7.969 7.29.24 1.537-.928 2.962-2.608 3.182-.144.018-.29.028-.435.028H7.074C5.376 22 4 20.74 4 19.187c0-.133.01-.266.03-.398C4.79 13.93 7.448 11.5 12 11.5zm0 1.5c-3.684 0-5.696 1.84-6.346 6.002-.01.061-.015.123-.015.186 0 .68.565 1.238 1.288 1.305l.147.007h9.852c.068 0 .136-.004.203-.013.784-.103 1.329-.768 1.217-1.485C17.696 14.84 15.684 13 12 13zm0-11c2.112 0 3.825 1.903 3.825 4.25S14.112 10.5 12 10.5c-2.113 0-3.825-1.903-3.825-4.25S9.887 2 12 2zm0 1.5c-1.13 0-2.186 1.174-2.186 2.75S10.87 9 12 9s2.186-1.174 2.186-2.75S13.129 3.5 12 3.5z",
|
2715
|
+
fill: "currentColor"
|
2716
|
+
}));
|
2717
|
+
}
|
2718
|
+
var Person = /*#__PURE__*/React.forwardRef(IconPerson);
|
2719
|
+
|
2641
2720
|
function IconPhoneSolid(props, svgRef) {
|
2642
2721
|
return /*#__PURE__*/React.createElement("svg", Object.assign({
|
2643
2722
|
fill: "none",
|
@@ -3407,6 +3486,21 @@ function IconUnreconciled(props, svgRef) {
|
|
3407
3486
|
}
|
3408
3487
|
var Unreconciled = /*#__PURE__*/React.forwardRef(IconUnreconciled);
|
3409
3488
|
|
3489
|
+
function IconWallet(props, svgRef) {
|
3490
|
+
return /*#__PURE__*/React.createElement("svg", Object.assign({
|
3491
|
+
fill: "none",
|
3492
|
+
xmlns: "http://www.w3.org/2000/svg",
|
3493
|
+
viewBox: "0 0 24 24",
|
3494
|
+
ref: svgRef
|
3495
|
+
}, props), /*#__PURE__*/React.createElement("path", {
|
3496
|
+
fillRule: "evenodd",
|
3497
|
+
clipRule: "evenodd",
|
3498
|
+
d: "M4.75 4.5h14.5a.25.25 0 01.25.25V7H16a5 5 0 000 10h3.5v2.25a.25.25 0 01-.25.25H4.75a.25.25 0 01-.25-.25V4.75a.25.25 0 01.25-.25zM22 7h-1V4.75A1.75 1.75 0 0019.25 3H4.75A1.75 1.75 0 003 4.75v14.5c0 .966.784 1.75 1.75 1.75h14.5A1.75 1.75 0 0021 19.25V17h1a1 1 0 001-1V8a1 1 0 00-1-1zm-.5 1.5H16a3.5 3.5 0 100 7h5.5v-7zm-5.5 5a1.5 1.5 0 100-3 1.5 1.5 0 000 3z",
|
3499
|
+
fill: "currentColor"
|
3500
|
+
}));
|
3501
|
+
}
|
3502
|
+
var Wallet = /*#__PURE__*/React.forwardRef(IconWallet);
|
3503
|
+
|
3410
3504
|
function IconWarning(props, svgRef) {
|
3411
3505
|
return /*#__PURE__*/React.createElement("svg", Object.assign({
|
3412
3506
|
fill: "none",
|
@@ -3504,6 +3598,8 @@ const icons = {
|
|
3504
3598
|
'attach-cancel': AttachCancel,
|
3505
3599
|
'attach-warning': AttachWarning,
|
3506
3600
|
attach: Attach,
|
3601
|
+
'autopay-paused': AutopayPaused,
|
3602
|
+
autopay: Autopay,
|
3507
3603
|
'autotext-insert': AutotextInsert,
|
3508
3604
|
autotext: Autotext,
|
3509
3605
|
'basic-tabs': BasicTabs,
|
@@ -3594,6 +3690,7 @@ const icons = {
|
|
3594
3690
|
envelope: Envelope,
|
3595
3691
|
'expand-view': ExpandView,
|
3596
3692
|
expenses: Expenses,
|
3693
|
+
experiment: Experiment,
|
3597
3694
|
'export-to-excel': ExportToExcel,
|
3598
3695
|
'export-to-pdf': ExportToPdf,
|
3599
3696
|
export: Export,
|
@@ -3670,7 +3767,9 @@ const icons = {
|
|
3670
3767
|
'person-change': PersonChange,
|
3671
3768
|
'person-minus': PersonMinus,
|
3672
3769
|
'person-plus': PersonPlus,
|
3770
|
+
'person-solid': PersonSolid,
|
3673
3771
|
'person-tick': PersonTick,
|
3772
|
+
person: Person,
|
3674
3773
|
'phone-solid': PhoneSolid,
|
3675
3774
|
phone: Phone,
|
3676
3775
|
play: Play,
|
@@ -3729,6 +3828,7 @@ const icons = {
|
|
3729
3828
|
undo: Undo,
|
3730
3829
|
undock: Undock,
|
3731
3830
|
unreconciled: Unreconciled,
|
3831
|
+
wallet: Wallet,
|
3732
3832
|
warning: Warning,
|
3733
3833
|
webshop: Webshop,
|
3734
3834
|
website: Website,
|
@@ -3798,6 +3898,8 @@ const getIconName = state => {
|
|
3798
3898
|
return 'warning';
|
3799
3899
|
case 'error':
|
3800
3900
|
return 'close';
|
3901
|
+
case 'experiment':
|
3902
|
+
return 'experiment';
|
3801
3903
|
case 'success':
|
3802
3904
|
return 'tick';
|
3803
3905
|
default:
|
@@ -4038,33 +4140,25 @@ const Accordion = props => {
|
|
4038
4140
|
const context = React__default.useMemo(() => ({
|
4039
4141
|
as
|
4040
4142
|
}), [as]);
|
4041
|
-
const type = typeof defaultId === 'string' || typeof id === 'string' ? 'single' : 'multiple';
|
4042
4143
|
let valueProps;
|
4043
4144
|
if (defaultId) {
|
4044
|
-
valueProps =
|
4045
|
-
|
4046
|
-
defaultValue: defaultId
|
4047
|
-
} : {
|
4048
|
-
type: 'multiple',
|
4049
|
-
defaultValue: defaultId
|
4145
|
+
valueProps = {
|
4146
|
+
defaultValue: defaultId || undefined
|
4050
4147
|
};
|
4051
4148
|
} else {
|
4052
|
-
valueProps =
|
4053
|
-
type: 'single',
|
4054
|
-
onValueChange: onChange,
|
4055
|
-
value: id || undefined
|
4056
|
-
} : {
|
4057
|
-
type: 'multiple',
|
4149
|
+
valueProps = {
|
4058
4150
|
onValueChange: onChange,
|
4059
4151
|
value: id || undefined
|
4060
4152
|
};
|
4061
4153
|
}
|
4154
|
+
const type = typeof valueProps.defaultValue === 'string' || typeof valueProps.value === 'string' ? 'single' : 'multiple';
|
4062
4155
|
const className = cn('divide-y divide-grey-200', props.className);
|
4063
4156
|
return /*#__PURE__*/React__default.createElement(AccordionContext.Provider, {
|
4064
4157
|
value: context
|
4065
4158
|
}, /*#__PURE__*/React__default.createElement(AccordionPrimitive.Root, Object.assign({}, otherProps, valueProps, {
|
4066
4159
|
"data-taco": "accordion",
|
4067
|
-
className: className
|
4160
|
+
className: className,
|
4161
|
+
type: type
|
4068
4162
|
})));
|
4069
4163
|
};
|
4070
4164
|
Accordion.Item = Item;
|
@@ -4090,10 +4184,10 @@ const Badge = /*#__PURE__*/React.forwardRef(function Badge(props, ref) {
|
|
4090
4184
|
...otherProps
|
4091
4185
|
} = props;
|
4092
4186
|
const isTransparent = color === 'transparent';
|
4093
|
-
const className = cn('rounded-full border overflow-hidden whitespace-nowrap inline-flex items-center justify-center', {
|
4187
|
+
const className = cn('rounded-full border box-border overflow-hidden whitespace-nowrap inline-flex items-center justify-center', {
|
4094
4188
|
[`border ${getOutlineColorShadeClasses(color)}`]: outline,
|
4095
|
-
[`border-
|
4096
|
-
[`border-
|
4189
|
+
[`border-none font-normal ${getSubtleColorShadeClasses(color)}`]: subtle,
|
4190
|
+
[`border-none ${getColorShadeClasses(color)}`]: !outline && !subtle,
|
4097
4191
|
'h-4 min-w-0 py-0 px-1 text-xs': small,
|
4098
4192
|
'h-2 w-2 min-w-0': compact,
|
4099
4193
|
'font-bold': outline || !subtle,
|
@@ -4105,12 +4199,15 @@ const Badge = /*#__PURE__*/React.forwardRef(function Badge(props, ref) {
|
|
4105
4199
|
if (compact) {
|
4106
4200
|
return /*#__PURE__*/React.createElement(VisuallyHidden, null, children);
|
4107
4201
|
}
|
4202
|
+
const contentToRender = typeof children === 'string' ? /*#__PURE__*/React.createElement("span", {
|
4203
|
+
className: "items-center truncate"
|
4204
|
+
}, children) : children;
|
4108
4205
|
if (status) {
|
4109
4206
|
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("div", {
|
4110
|
-
className: cn('mr-1 h-2 w-2 rounded-full', getColorShadeClasses(color))
|
4111
|
-
}),
|
4207
|
+
className: cn('mr-1 h-2 w-2 shrink-0 rounded-full', getColorShadeClasses(color))
|
4208
|
+
}), contentToRender);
|
4112
4209
|
}
|
4113
|
-
return
|
4210
|
+
return contentToRender;
|
4114
4211
|
};
|
4115
4212
|
return /*#__PURE__*/React.createElement("span", Object.assign({}, otherProps, {
|
4116
4213
|
"aria-atomic": "true",
|
@@ -4138,6 +4235,11 @@ const getBannerIcon = type => {
|
|
4138
4235
|
icon: "close",
|
4139
4236
|
color: "red"
|
4140
4237
|
});
|
4238
|
+
case 'experiment':
|
4239
|
+
return /*#__PURE__*/React__default.createElement(BadgeIcon, {
|
4240
|
+
icon: "experiment",
|
4241
|
+
color: "purple"
|
4242
|
+
});
|
4141
4243
|
case 'warning':
|
4142
4244
|
return /*#__PURE__*/React__default.createElement(BadgeIcon, {
|
4143
4245
|
icon: "warning",
|
@@ -4230,6 +4332,9 @@ function isElementTriggeredFromContainer(element, container) {
|
|
4230
4332
|
return true;
|
4231
4333
|
}
|
4232
4334
|
const elementInDocument = document.querySelector(escapedSelector);
|
4335
|
+
if (elementInDocument === container) {
|
4336
|
+
return true;
|
4337
|
+
}
|
4233
4338
|
// if the element does exist, see if it is itself connected to somethng that was triggered from the container
|
4234
4339
|
if (elementInDocument) {
|
4235
4340
|
return isElementTriggeredFromContainer(elementInDocument, container);
|
@@ -4252,7 +4357,15 @@ function isElementInteractive(element) {
|
|
4252
4357
|
if (!element) {
|
4253
4358
|
return false;
|
4254
4359
|
}
|
4255
|
-
|
4360
|
+
const interactiveElements = ['A', 'BUTTON', 'INPUT', 'TEXTAREA', 'SELECT', 'LABEL', 'OPTION'];
|
4361
|
+
const isInteractive = interactiveElements.includes(element.tagName) && !element.hidden && !element.disabled && !element.readOnly;
|
4362
|
+
// sometimes buttons contain content like an icon, and we can't rely on pointer events being disabled
|
4363
|
+
// so search for a focusable parent
|
4364
|
+
if (!isInteractive) {
|
4365
|
+
const focusableParent = element.closest(FOCUSABLE_ELEMENTS.join(','));
|
4366
|
+
return focusableParent ? interactiveElements.includes(focusableParent.tagName) : false;
|
4367
|
+
}
|
4368
|
+
return isInteractive;
|
4256
4369
|
}
|
4257
4370
|
function isElementInsideTable3OrReport(element) {
|
4258
4371
|
return !!(element !== null && element !== void 0 && element.closest('[data-taco^=table]'));
|
@@ -4374,13 +4487,13 @@ const Tooltip = /*#__PURE__*/React.forwardRef(function Tooltip(props, ref) {
|
|
4374
4487
|
side: placement,
|
4375
4488
|
sideOffset: 3
|
4376
4489
|
}), /*#__PURE__*/React.createElement("div", {
|
4377
|
-
className: "xs:max-w-[theme(spacing.56)] max-w-[theme(spacing.32)] animate-[fade-in_150ms] rounded
|
4490
|
+
className: "xs:max-w-[theme(spacing.56)] max-w-[theme(spacing.32)] animate-[fade-in_150ms] rounded bg-blue-900 px-2 py-1 text-xs text-white print:hidden",
|
4378
4491
|
"data-taco": "tooltip",
|
4379
4492
|
style: {
|
4380
4493
|
transformOrigin: 'var(--radix-tooltip-content-transform-origin)'
|
4381
4494
|
}
|
4382
4495
|
}, /*#__PURE__*/React.createElement(TooltipPrimitive.Arrow, {
|
4383
|
-
className: "-mt-px fill-blue-900
|
4496
|
+
className: "-mt-px fill-blue-900 stroke-blue-900"
|
4384
4497
|
}), title))));
|
4385
4498
|
});
|
4386
4499
|
|
@@ -4866,7 +4979,8 @@ const Base$1 = /*#__PURE__*/React.forwardRef(function ButtonBase(props, ref) {
|
|
4866
4979
|
}, props.className);
|
4867
4980
|
return createButtonWithTooltip({
|
4868
4981
|
...otherProps,
|
4869
|
-
'data-taco': 'button'
|
4982
|
+
'data-taco': 'button',
|
4983
|
+
'data-appearance': appearance
|
4870
4984
|
}, className, ref);
|
4871
4985
|
});
|
4872
4986
|
const Button$1 = /*#__PURE__*/React.forwardRef(function Button(props, ref) {
|
@@ -5096,7 +5210,7 @@ const Content$2 = /*#__PURE__*/React.forwardRef(function CardContent(externalPro
|
|
5096
5210
|
...props
|
5097
5211
|
} = externalProps;
|
5098
5212
|
const className = cn('flex-grow overflow-auto', {
|
5099
|
-
'
|
5213
|
+
'px-4 pb-4': !noPadding
|
5100
5214
|
}, props.className);
|
5101
5215
|
return /*#__PURE__*/React.createElement("div", Object.assign({}, props, {
|
5102
5216
|
className: className,
|
@@ -5118,7 +5232,7 @@ const Card = /*#__PURE__*/React.forwardRef(function Card(props, ref) {
|
|
5118
5232
|
"data-taco": "card",
|
5119
5233
|
ref: ref
|
5120
5234
|
}), /*#__PURE__*/React.createElement("div", {
|
5121
|
-
className: "
|
5235
|
+
className: "flex justify-between px-4 pb-2 pt-4"
|
5122
5236
|
}, title && (/*#__PURE__*/React.createElement(Truncate, {
|
5123
5237
|
tooltip: title
|
5124
5238
|
}, /*#__PURE__*/React.createElement("h4", {
|
@@ -5187,8 +5301,9 @@ const Checkbox = /*#__PURE__*/React.forwardRef(function Checkbox(props, ref) {
|
|
5187
5301
|
...otherProps
|
5188
5302
|
} = props;
|
5189
5303
|
const id = useId(props.id);
|
5190
|
-
const className = cn('bg-white h-5 w-5 border rounded text-sm flex-shrink-0
|
5191
|
-
'self-start': !!label
|
5304
|
+
const className = cn('bg-white h-5 w-5 border rounded text-sm flex-shrink-0 focus-visible:yt-focus disabled:cursor-not-allowed text-white', {
|
5305
|
+
'self-start': !!label,
|
5306
|
+
'mt-[0.1rem]': !label
|
5192
5307
|
}, invalid ? {
|
5193
5308
|
'border-red-500 hover:border-red-700 aria-checked:border-red-500 aria-checked-mixed:border-red-500 aria-checked:bg-red-500 aria-checked-mixed:bg-red-500 aria-checked:hover:border-red-700 aria-checked-mixed:hover:border-red-700 aria-checked:hover:bg-red-700 aria-checked-mixed:hover:bg-red-700': !props.disabled,
|
5194
5309
|
'border-red-500/50 aria-checked:wcag-red-500/50 aria-checked-mixed:wcag-red-500/50': props.disabled
|
@@ -5254,7 +5369,7 @@ const getInputClasses = props => {
|
|
5254
5369
|
const disabled = props.disabled || !!props['aria-disabled'];
|
5255
5370
|
const readOnly = props.readOnly || !!props['aria-readonly'];
|
5256
5371
|
const invalid = props.invalid || !!props['aria-invalid'];
|
5257
|
-
return cn('peer text-black text-sm border font-normal not-italic no-underline rounded flex items-center leading-6 px-2 relative w-full text-ellipsis transition-colors transition-opacity ease-in min-h-[theme(spacing.8)] focus
|
5372
|
+
return cn('peer text-black text-sm border font-normal not-italic no-underline rounded flex items-center leading-6 px-2 relative w-full text-ellipsis transition-colors transition-opacity ease-in min-h-[theme(spacing.8)] focus:yt-focus',
|
5258
5373
|
// hide the arrow controls on input[type=number]
|
5259
5374
|
'[appearance:textfield] [&::-webkit-outer-spin-button]:appearance-none [&::-webkit-inner-spin-button]:appearance-none', {
|
5260
5375
|
'bg-white': !props.highlighted && !readOnly,
|
@@ -5758,13 +5873,7 @@ const searchForString = (child, value, strategy = 'includes') => {
|
|
5758
5873
|
}
|
5759
5874
|
return searchForString((_child$props3 = child.props) === null || _child$props3 === void 0 ? void 0 : _child$props3.children, value, strategy);
|
5760
5875
|
} else {
|
5761
|
-
|
5762
|
-
const valueLowerCase = String(value).toLowerCase();
|
5763
|
-
if (strategy === 'startsWith') {
|
5764
|
-
return childLowerCase.startsWith(valueLowerCase);
|
5765
|
-
} else {
|
5766
|
-
return childLowerCase.includes(valueLowerCase);
|
5767
|
-
}
|
5876
|
+
return child.toString().toLowerCase()[strategy](String(value).toLowerCase());
|
5768
5877
|
}
|
5769
5878
|
} catch {
|
5770
5879
|
return false;
|
@@ -5893,22 +6002,23 @@ const useCombobox = ({
|
|
5893
6002
|
const data = React.useMemo(() => shouldFilterData ? filterData(flattenedData, inputValue) : flattenedData, [shouldFilterData, inputValue, flattenedData]);
|
5894
6003
|
// listbox/select change value _with_ the index, but combobox changes on select of an index (click/enter), so we need state
|
5895
6004
|
const [currentIndex, setCurrentIndex] = React.useState(inputValue !== undefined ? getIndexFromValue(data, inputValue) : undefined);
|
5896
|
-
const setInputValueByIndex = index => {
|
6005
|
+
const setInputValueByIndex = (index, event) => {
|
5897
6006
|
if (index !== undefined) {
|
5898
6007
|
const option = data[index];
|
5899
6008
|
if (option && !option.disabled) {
|
5900
|
-
|
6009
|
+
const eventType = event !== null && event !== void 0 ? event : 'focusout';
|
6010
|
+
setInputValueByRef$1(inputRef.current, option.value, eventType);
|
5901
6011
|
}
|
5902
6012
|
}
|
5903
6013
|
};
|
5904
|
-
const setCurrentValue = index => {
|
6014
|
+
const setCurrentValue = (index, event) => {
|
5905
6015
|
if (index === undefined) {
|
5906
6016
|
return;
|
5907
6017
|
}
|
5908
6018
|
const option = data[index];
|
5909
6019
|
// if the selected option is not already selected, trigger blur event
|
5910
6020
|
if (option.value !== value) {
|
5911
|
-
setInputValueByIndex(index);
|
6021
|
+
setInputValueByIndex(index, event);
|
5912
6022
|
} else {
|
5913
6023
|
// if the selected option is already selected, refill input with its value
|
5914
6024
|
setInputValue(convertToInputValue(value));
|
@@ -6004,7 +6114,8 @@ const useCombobox = ({
|
|
6004
6114
|
}
|
6005
6115
|
case 'Tab':
|
6006
6116
|
{
|
6007
|
-
|
6117
|
+
// default focusout will trigger onBlur and we don't want to trigger it twice
|
6118
|
+
setCurrentValue(currentIndex, 'change');
|
6008
6119
|
setOpen(false);
|
6009
6120
|
return;
|
6010
6121
|
}
|
@@ -6019,7 +6130,8 @@ const useCombobox = ({
|
|
6019
6130
|
}
|
6020
6131
|
}
|
6021
6132
|
if (open) {
|
6022
|
-
|
6133
|
+
// we need to focusout to trigger onBlur as we are not actually blurring the input
|
6134
|
+
setCurrentValue(currentIndex, 'focusout');
|
6023
6135
|
setOpen(false);
|
6024
6136
|
}
|
6025
6137
|
return;
|
@@ -6292,6 +6404,12 @@ const useDatepicker = ({
|
|
6292
6404
|
setInternalValue(formattedValue !== null && formattedValue !== void 0 ? formattedValue : '');
|
6293
6405
|
}
|
6294
6406
|
}, [value]);
|
6407
|
+
const isDisabledDay = React.useMemo(() => {
|
6408
|
+
if (originalValueAsDate && calendar !== null && calendar !== void 0 && calendar.disabledDays) {
|
6409
|
+
return reactDayPicker.isMatch(originalValueAsDate, calendar === null || calendar === void 0 ? void 0 : calendar.disabledDays); // can happen if you type a disabled date in input.
|
6410
|
+
}
|
6411
|
+
return false;
|
6412
|
+
}, [originalValueAsDate]);
|
6295
6413
|
// event handlers
|
6296
6414
|
const handleInputBlur = event => {
|
6297
6415
|
event.persist();
|
@@ -6328,6 +6446,7 @@ const useDatepicker = ({
|
|
6328
6446
|
const inputProps = {
|
6329
6447
|
...props,
|
6330
6448
|
autoComplete: 'off',
|
6449
|
+
invalid: props.invalid || isDisabledDay,
|
6331
6450
|
onBlur: handleInputBlur,
|
6332
6451
|
onChange: handleInputChange,
|
6333
6452
|
onKeyDown: handleKeyDown,
|
@@ -6497,11 +6616,24 @@ const Datepicker = /*#__PURE__*/React.forwardRef(function Datepicker(props, ref)
|
|
6497
6616
|
e.preventDefault();
|
6498
6617
|
(_input$ref$current = input.ref.current) === null || _input$ref$current === void 0 ? void 0 : _input$ref$current.focus();
|
6499
6618
|
}, [input.ref]);
|
6619
|
+
// Allow preventing default keyDown behaviour if consumer (in our internal case it's Table3) wants to handle it.
|
6620
|
+
// We need to have this option for the situations, when Datepicker is used as inline edititng control in Table3,
|
6621
|
+
// without it, datepicker cannot be set into detailed editing mode by pressing "Enter",
|
6622
|
+
// because input.onKeydown is triggering 'focusout', which resets the detailed edititng mode.
|
6623
|
+
const handleInputKeyDown = event => {
|
6624
|
+
var _props$onKeyDown;
|
6625
|
+
(_props$onKeyDown = props.onKeyDown) === null || _props$onKeyDown === void 0 ? void 0 : _props$onKeyDown.call(props, event);
|
6626
|
+
if (!event.defaultPrevented) {
|
6627
|
+
var _input$onKeyDown;
|
6628
|
+
(_input$onKeyDown = input.onKeyDown) === null || _input$onKeyDown === void 0 ? void 0 : _input$onKeyDown.call(input, event);
|
6629
|
+
}
|
6630
|
+
};
|
6500
6631
|
return /*#__PURE__*/React.createElement("span", {
|
6501
6632
|
className: className,
|
6502
6633
|
"data-taco": "datepicker",
|
6503
6634
|
style: style
|
6504
6635
|
}, /*#__PURE__*/React.createElement(Input, Object.assign({}, input, {
|
6636
|
+
onKeyDown: handleInputKeyDown,
|
6505
6637
|
button: input.readOnly ? undefined : (/*#__PURE__*/React.createElement(IconButton, {
|
6506
6638
|
"aria-label": texts.datepicker.expand,
|
6507
6639
|
disabled: input.disabled || input.readOnly,
|
@@ -6680,8 +6812,10 @@ const Content$4 = /*#__PURE__*/React.forwardRef(function DialogContent(props, re
|
|
6680
6812
|
const {
|
6681
6813
|
texts
|
6682
6814
|
} = useLocalization();
|
6683
|
-
const className = cn('relative bg-white animate-[fade-in_150ms] rounded', getDialogPositionClassnames(), getDialogSizeClassnames(dialog.size), 'print:w-full print:h-
|
6684
|
-
const containerClassName = cn('bg-white p-6 rounded relative z-10 shadow print:p-0
|
6815
|
+
const className = cn('relative bg-white animate-[fade-in_150ms] rounded print:!static', getDialogPositionClassnames(), getDialogSizeClassnames(dialog.size), 'print:w-full print:h-max print:m-0 print:overflow-visible');
|
6816
|
+
const containerClassName = cn('bg-white p-6 rounded relative z-10 shadow print:p-0',
|
6817
|
+
// The `!fixed` property is crucial to ensure that when a draggable dialog is moved, the printed document still displays its content across the full page.
|
6818
|
+
'print:overflow-visible print:h-max print:!transform-none print:!inset-0 print:!m-0', {
|
6685
6819
|
'rounded-b-none': !!dialog.elements.extra
|
6686
6820
|
}, props.className);
|
6687
6821
|
const handleEscapeKeyDown = event => {
|
@@ -6718,7 +6852,7 @@ const Content$4 = /*#__PURE__*/React.forwardRef(function DialogContent(props, re
|
|
6718
6852
|
}), /*#__PURE__*/React.createElement("div", {
|
6719
6853
|
className: containerClassName,
|
6720
6854
|
"data-taco": "dialog"
|
6721
|
-
},
|
6855
|
+
}, output, dialog.draggable && (/*#__PURE__*/React.createElement("div", Object.assign({}, dragHandleProps, {
|
6722
6856
|
role: "button",
|
6723
6857
|
draggable: true,
|
6724
6858
|
"aria-grabbed": dragging,
|
@@ -6732,7 +6866,7 @@ const Content$4 = /*#__PURE__*/React.forwardRef(function DialogContent(props, re
|
|
6732
6866
|
"aria-label": texts.dialog.close,
|
6733
6867
|
className: "absolute right-0 top-0 mr-2 mt-2 print:hidden",
|
6734
6868
|
icon: "close"
|
6735
|
-
}))) : null)
|
6869
|
+
}))) : null), dialog.elements.drawer, dialog.elements.extra))));
|
6736
6870
|
});
|
6737
6871
|
|
6738
6872
|
const DialogDrawer = /*#__PURE__*/React.forwardRef(function DialogDrawer(props, ref) {
|
@@ -7440,7 +7574,8 @@ const Title$3 = /*#__PURE__*/React.forwardRef(function DialogTitle(props, ref) {
|
|
7440
7574
|
});
|
7441
7575
|
const Content$6 = /*#__PURE__*/React.forwardRef(function HangerContent(props, ref) {
|
7442
7576
|
const {
|
7443
|
-
placement: side
|
7577
|
+
placement: side,
|
7578
|
+
hideWhenDetached = false
|
7444
7579
|
} = props;
|
7445
7580
|
const context = React.useContext(HangerContext);
|
7446
7581
|
const {
|
@@ -7456,7 +7591,8 @@ const Content$6 = /*#__PURE__*/React.forwardRef(function HangerContent(props, re
|
|
7456
7591
|
onInteractOutside: handleInteractOutside,
|
7457
7592
|
side: side,
|
7458
7593
|
sideOffset: 1,
|
7459
|
-
ref: ref
|
7594
|
+
ref: ref,
|
7595
|
+
hideWhenDetached: hideWhenDetached
|
7460
7596
|
}, props.children, /*#__PURE__*/React.createElement(UnstyledArrow, {
|
7461
7597
|
className: "text-blue-500"
|
7462
7598
|
}), /*#__PURE__*/React.createElement(PopoverPrimitive.Close, {
|
@@ -8222,6 +8358,11 @@ const Content$8 = /*#__PURE__*/React.forwardRef(function MenuContent(props, ref)
|
|
8222
8358
|
if (child.props.shortcut) {
|
8223
8359
|
shortcuts.push(createShortcutKeyDownHandler(child.props.shortcut, event => {
|
8224
8360
|
event.preventDefault();
|
8361
|
+
const dialog = document.querySelector('[role="dialog"]');
|
8362
|
+
// Don't trigger the shortcut if it is outside of the dialog
|
8363
|
+
if (dialog && !(dialog !== null && dialog !== void 0 && dialog.contains(internalRef.current))) {
|
8364
|
+
return;
|
8365
|
+
}
|
8225
8366
|
menu === null || menu === void 0 ? void 0 : menu.open();
|
8226
8367
|
setTimeout(() => {
|
8227
8368
|
var _childrenRefs$current, _childrenRefs$current2;
|
@@ -8296,7 +8437,7 @@ const Shortcut = ({
|
|
8296
8437
|
className: className
|
8297
8438
|
}), texts.map(key => (/*#__PURE__*/React__default.createElement("kbd", {
|
8298
8439
|
key: key,
|
8299
|
-
className: "font-display text-grey-700 [[data-taco=tooltip]_&]:bg-grey-300/[0.25] rounded-sm bg-black/[0.09] px-1 text-center font-bold [[data-taco=tooltip]_&]:text-white"
|
8440
|
+
className: "font-display text-grey-700 [[data-taco=tooltip]_&]:bg-grey-300/[0.25] rounded-sm bg-black/[0.09] px-1 text-center font-bold [[data-appearance=danger]_&]:text-white [[data-appearance=primary]_&]:text-white [[data-taco=tooltip]_&]:text-white"
|
8300
8441
|
}, key))));
|
8301
8442
|
};
|
8302
8443
|
|
@@ -9668,6 +9809,20 @@ const insertToastWithoutDuplicates = (currentToasts, id, content, options, close
|
|
9668
9809
|
}
|
9669
9810
|
return nextToasts;
|
9670
9811
|
};
|
9812
|
+
const Portal$1 = props => {
|
9813
|
+
var _globalThis$document;
|
9814
|
+
const {
|
9815
|
+
children,
|
9816
|
+
container: containerProp,
|
9817
|
+
...portalProps
|
9818
|
+
} = props;
|
9819
|
+
const [mounted, setMounted] = React.useState(false);
|
9820
|
+
React.useLayoutEffect(() => setMounted(true), []);
|
9821
|
+
const container = containerProp || mounted && (globalThis === null || globalThis === void 0 ? void 0 : (_globalThis$document = globalThis.document) === null || _globalThis$document === void 0 ? void 0 : _globalThis$document.body);
|
9822
|
+
return container ? /*#__PURE__*/ReactDOM.createPortal(/*#__PURE__*/React.createElement("div", Object.assign({}, portalProps, {
|
9823
|
+
"data-taco": "portal"
|
9824
|
+
}), children), container) : null;
|
9825
|
+
};
|
9671
9826
|
const ToastProvider = ({
|
9672
9827
|
children,
|
9673
9828
|
...props
|
@@ -9759,7 +9914,7 @@ const ToastProvider = ({
|
|
9759
9914
|
}, []);
|
9760
9915
|
return /*#__PURE__*/React.createElement(ToastContext.Provider, Object.assign({}, props, {
|
9761
9916
|
value: toaster
|
9762
|
-
}), children, /*#__PURE__*/React.createElement(
|
9917
|
+
}), children, /*#__PURE__*/React.createElement(Portal$1, null, /*#__PURE__*/React.createElement("div", {
|
9763
9918
|
id: "yt-toast__container",
|
9764
9919
|
className: "pointer-events-all absolute !left-auto bottom-0 right-0 z-[1000] mb-4 mr-4 flex max-w-md flex-col items-end justify-end",
|
9765
9920
|
role: "log"
|
@@ -9835,12 +9990,9 @@ const fixedForwardRef = React__default.forwardRef;
|
|
9835
9990
|
TableFilterComparator[TableFilterComparator["HasAnyOf"] = 11] = "HasAnyOf";
|
9836
9991
|
TableFilterComparator[TableFilterComparator["HasAllOf"] = 12] = "HasAllOf";
|
9837
9992
|
TableFilterComparator[TableFilterComparator["HasNoneOf"] = 13] = "HasNoneOf";
|
9993
|
+
TableFilterComparator[TableFilterComparator["IsOneOf"] = 14] = "IsOneOf";
|
9994
|
+
TableFilterComparator[TableFilterComparator["IsNoneOf"] = 15] = "IsNoneOf";
|
9838
9995
|
})(exports.TableFilterComparator || (exports.TableFilterComparator = {}));
|
9839
|
-
(function (TableServerLoadAllState) {
|
9840
|
-
TableServerLoadAllState[TableServerLoadAllState["Incomplete"] = 0] = "Incomplete";
|
9841
|
-
TableServerLoadAllState[TableServerLoadAllState["Loading"] = 1] = "Loading";
|
9842
|
-
TableServerLoadAllState[TableServerLoadAllState["Completed"] = 2] = "Completed";
|
9843
|
-
})(exports.TableServerLoadAllState || (exports.TableServerLoadAllState = {}));
|
9844
9996
|
|
9845
9997
|
const dataTypes = {
|
9846
9998
|
auto: {
|
@@ -9878,9 +10030,13 @@ const dataTypes = {
|
|
9878
10030
|
if (value === undefined) {
|
9879
10031
|
return '';
|
9880
10032
|
}
|
9881
|
-
|
10033
|
+
const formatter = new Intl.NumberFormat(options === null || options === void 0 ? void 0 : (_options$localization2 = options.localization) === null || _options$localization2 === void 0 ? void 0 : _options$localization2.locale, {
|
9882
10034
|
minimumFractionDigits: 2
|
9883
|
-
})
|
10035
|
+
});
|
10036
|
+
const decimalSeperator = formatter.format(1.1).substring(1, 2);
|
10037
|
+
const localisedValue = formatter.format(Number(value));
|
10038
|
+
const localisedValueWithoutThousandsSeperator = decimalSeperator === '.' ? localisedValue.replace(',', '') : localisedValue.replace('.', '');
|
10039
|
+
return [localisedValue, localisedValueWithoutThousandsSeperator];
|
9884
10040
|
}
|
9885
10041
|
}
|
9886
10042
|
};
|
@@ -10004,6 +10160,12 @@ function columnFilterFn(value, filter) {
|
|
10004
10160
|
return Array.isArray(filter.value) && Array.isArray(value) ? filter.value.every(item => value.includes(item) === false) : false;
|
10005
10161
|
case exports.TableFilterComparator.HasAllOf:
|
10006
10162
|
return Array.isArray(filter.value) && Array.isArray(value) ? filter.value.filter(v => value.includes(v)).length === filter.value.length : false;
|
10163
|
+
case exports.TableFilterComparator.IsOneOf:
|
10164
|
+
if (!Array.isArray(filter.value)) return false;
|
10165
|
+
return filter.value.some(v => isWeakEqual$1(value, v));
|
10166
|
+
case exports.TableFilterComparator.IsNoneOf:
|
10167
|
+
if (!Array.isArray(filter.value)) return false;
|
10168
|
+
return filter.value.every(v => !isWeakEqual$1(value, v));
|
10007
10169
|
}
|
10008
10170
|
return false;
|
10009
10171
|
} catch (e) {
|
@@ -10028,7 +10190,13 @@ function isMatched(searchQuery, cellValue, dataType, localization) {
|
|
10028
10190
|
const cellDisplayValue = dataTypeProperties.getDisplayValue(cellValue, {
|
10029
10191
|
localization
|
10030
10192
|
});
|
10031
|
-
if (
|
10193
|
+
if (Array.isArray(cellDisplayValue)) {
|
10194
|
+
for (const displayValue of cellDisplayValue) {
|
10195
|
+
if (isWeakContains(displayValue, searchQuery)) {
|
10196
|
+
return true;
|
10197
|
+
}
|
10198
|
+
}
|
10199
|
+
} else if (cellDisplayValue !== undefined && isWeakContains(cellDisplayValue, searchQuery)) {
|
10032
10200
|
return true;
|
10033
10201
|
}
|
10034
10202
|
}
|
@@ -10201,6 +10369,9 @@ function unfreezeAllExternalColumns(leftPinnedState) {
|
|
10201
10369
|
function freezeUptoExternalColumn(index, columns) {
|
10202
10370
|
return columns.slice(0, index + 1);
|
10203
10371
|
}
|
10372
|
+
function getHiddenColumns(columnVisibility = {}) {
|
10373
|
+
return Object.keys(columnVisibility).filter(c => columnVisibility[c] === false);
|
10374
|
+
}
|
10204
10375
|
|
10205
10376
|
function getSettings(table) {
|
10206
10377
|
const meta = table.options.meta;
|
@@ -10298,7 +10469,10 @@ function processChildren(child, columns, defaultSizing, defaultSorting, defaultV
|
|
10298
10469
|
// To avoid errors caused by undefined row data values, we pass accessorFn as a preventive measure
|
10299
10470
|
// accessorKey can be dot notated strings, so we use lodash.get to access deeply nested children
|
10300
10471
|
accessorFn: row => get(row, accessorKey),
|
10301
|
-
header
|
10472
|
+
// The header can be either a string or a JSX.Element, but react-table expects it to be a string or a
|
10473
|
+
// renderer function, so `() => header` ensures compatibility when header is a JSX.Element.
|
10474
|
+
// If we just pass `() => header`, then we will loose truncation for string headers.
|
10475
|
+
header: typeof header === 'string' ? header : () => header,
|
10302
10476
|
// features
|
10303
10477
|
enableColumnFilter,
|
10304
10478
|
enableGlobalFilter,
|
@@ -10326,10 +10500,15 @@ function processChildren(child, columns, defaultSizing, defaultSorting, defaultV
|
|
10326
10500
|
column.cell = info => renderer(info.getValue(), info.row.original);
|
10327
10501
|
} else if (dataTypeProperties.getDisplayValue) {
|
10328
10502
|
const dataTypeRenderer = value => {
|
10329
|
-
var _dataTypeProperties$g
|
10330
|
-
|
10503
|
+
var _dataTypeProperties$g;
|
10504
|
+
const displayValue = (_dataTypeProperties$g = dataTypeProperties.getDisplayValue) === null || _dataTypeProperties$g === void 0 ? void 0 : _dataTypeProperties$g.call(dataTypeProperties, value, {
|
10331
10505
|
localization
|
10332
|
-
})
|
10506
|
+
});
|
10507
|
+
if (Array.isArray(displayValue)) {
|
10508
|
+
var _displayValue$;
|
10509
|
+
return (_displayValue$ = displayValue[0]) !== null && _displayValue$ !== void 0 ? _displayValue$ : value;
|
10510
|
+
}
|
10511
|
+
return displayValue !== null && displayValue !== void 0 ? displayValue : value;
|
10333
10512
|
};
|
10334
10513
|
column.cell = info => dataTypeRenderer(info.getValue());
|
10335
10514
|
column.meta.renderer = dataTypeRenderer;
|
@@ -10460,7 +10639,8 @@ function configureReactTableOptions(options, props, localization) {
|
|
10460
10639
|
getExpandedRowModel: reactTable.getExpandedRowModel(),
|
10461
10640
|
getGroupedRowModel: reactTable.getGroupedRowModel(),
|
10462
10641
|
getRowId,
|
10463
|
-
groupedColumnMode: false
|
10642
|
+
groupedColumnMode: false,
|
10643
|
+
keepPinnedRows: false
|
10464
10644
|
};
|
10465
10645
|
if (tableOptions.enableColumnResizing) {
|
10466
10646
|
tableOptions.columnResizeMode = 'onChange';
|
@@ -10482,6 +10662,12 @@ function configureReactTableOptions(options, props, localization) {
|
|
10482
10662
|
var _column$columnDef$met;
|
10483
10663
|
return ((_column$columnDef$met = column.columnDef.meta) === null || _column$columnDef$met === void 0 ? void 0 : _column$columnDef$met.enableSearch) !== false && column.getIsVisible();
|
10484
10664
|
};
|
10665
|
+
// enter controlled search mode (controlled could be local state, but usually the server)
|
10666
|
+
if (props.onChangeSearch) {
|
10667
|
+
if (props._experimentalDataLoader2) {
|
10668
|
+
tableOptions.manualFiltering = true;
|
10669
|
+
}
|
10670
|
+
}
|
10485
10671
|
}
|
10486
10672
|
if (tableOptions.enableSorting) {
|
10487
10673
|
// enter controlled sort mode (controlled could be local state, but usually the server)
|
@@ -10539,6 +10725,7 @@ const DEFAULT_PRESET = {
|
|
10539
10725
|
enableColumnHiding: false,
|
10540
10726
|
enableColumnResizing: false,
|
10541
10727
|
enableRowExpansion: false,
|
10728
|
+
enableRowExpansionAll: true,
|
10542
10729
|
enableRowSelection: false,
|
10543
10730
|
// custom -- common between all table types
|
10544
10731
|
enableColumnOrdering: false,
|
@@ -10565,6 +10752,7 @@ const presets = {
|
|
10565
10752
|
enableColumnHiding: true,
|
10566
10753
|
enableColumnResizing: true,
|
10567
10754
|
enableRowExpansion: true,
|
10755
|
+
enableRowExpansionAll: true,
|
10568
10756
|
enableRowSelection: true,
|
10569
10757
|
// custom -- common between all table types
|
10570
10758
|
enableColumnOrdering: true,
|
@@ -10590,6 +10778,7 @@ const presets = {
|
|
10590
10778
|
enableColumnHiding: false,
|
10591
10779
|
enableColumnResizing: false,
|
10592
10780
|
enableRowExpansion: true,
|
10781
|
+
enableRowExpansionAll: true,
|
10593
10782
|
enableRowSelection: true,
|
10594
10783
|
// custom -- common between all table types
|
10595
10784
|
enableColumnOrdering: false,
|
@@ -10615,6 +10804,7 @@ const presets = {
|
|
10615
10804
|
enableColumnHiding: false,
|
10616
10805
|
enableColumnResizing: false,
|
10617
10806
|
enableRowExpansion: true,
|
10807
|
+
enableRowExpansionAll: true,
|
10618
10808
|
enableRowSelection: false,
|
10619
10809
|
// custom -- common between all table types
|
10620
10810
|
enableColumnOrdering: false,
|
@@ -10632,7 +10822,7 @@ const presets = {
|
|
10632
10822
|
}
|
10633
10823
|
};
|
10634
10824
|
function getTableFeaturePreset(props) {
|
10635
|
-
var _props$enableRowActio, _props$enableRowClick, _props$enableRowDrag, _props$enableRowDrop, _props$enableRowGoto, _props$enableRowExpan, _props$enableRowSelec, _props$enableFilterin, _props$enableSearch, _props$enableSorting, _props$enableColumnFr, _props$enableColumnHi, _props$enableColumnRe, _props$enableColumnOr, _props$enableFontSize, _props$enableFooter, _props$enablePrinting, _props$enableRowActiv, _props$rowActions, _props$enableRowHeigh, _props$enableSaveSett;
|
10825
|
+
var _props$enableRowActio, _props$enableRowClick, _props$enableRowDrag, _props$enableRowDrop, _props$enableRowGoto, _props$enableRowExpan, _props$enableRowExpan2, _props$enableRowSelec, _props$enableFilterin, _props$enableSearch, _props$enableSorting, _props$enableColumnFr, _props$enableColumnHi, _props$enableColumnRe, _props$enableColumnOr, _props$enableFontSize, _props$enableFooter, _props$enablePrinting, _props$enableRowActiv, _props$rowActions, _props$enableRowHeigh, _props$enableSaveSett;
|
10636
10826
|
const presetOptions = props.preset ? presets[props.preset] : DEFAULT_PRESET;
|
10637
10827
|
const enableRowActions = (_props$enableRowActio = props.enableRowActions) !== null && _props$enableRowActio !== void 0 ? _props$enableRowActio : presetOptions.enableRowActions;
|
10638
10828
|
const enableRowClick = (_props$enableRowClick = props.enableRowClick) !== null && _props$enableRowClick !== void 0 ? _props$enableRowClick : presetOptions.enableRowClick;
|
@@ -10640,6 +10830,7 @@ function getTableFeaturePreset(props) {
|
|
10640
10830
|
const enableRowDrop = (_props$enableRowDrop = props.enableRowDrop) !== null && _props$enableRowDrop !== void 0 ? _props$enableRowDrop : presetOptions.enableRowDrop;
|
10641
10831
|
const enableRowGoto = (_props$enableRowGoto = props.enableRowGoto) !== null && _props$enableRowGoto !== void 0 ? _props$enableRowGoto : presetOptions.enableRowGoto;
|
10642
10832
|
const enableRowExpansion = (_props$enableRowExpan = props.enableRowExpansion) !== null && _props$enableRowExpan !== void 0 ? _props$enableRowExpan : presetOptions.enableRowExpansion;
|
10833
|
+
const enableRowExpansionAll = (_props$enableRowExpan2 = props.enableRowExpansionAll) !== null && _props$enableRowExpan2 !== void 0 ? _props$enableRowExpan2 : presetOptions.enableRowExpansionAll;
|
10643
10834
|
const enableRowSelection = (_props$enableRowSelec = props.enableRowSelection) !== null && _props$enableRowSelec !== void 0 ? _props$enableRowSelec : presetOptions.enableRowSelection;
|
10644
10835
|
return {
|
10645
10836
|
// react-table built-in
|
@@ -10664,6 +10855,7 @@ function getTableFeaturePreset(props) {
|
|
10664
10855
|
enableRowDrag: enableRowDrag && !!props.onRowDrag,
|
10665
10856
|
enableRowDrop: enableRowDrop && !!props.onRowDrop,
|
10666
10857
|
enableRowGoto: enableRowGoto && !!props.onRowGoto,
|
10858
|
+
enableRowExpansionAll: enableRowExpansion && enableRowExpansionAll && !!props.rowExpansionRenderer,
|
10667
10859
|
enableRowHeight: (_props$enableRowHeigh = props.enableRowHeight) !== null && _props$enableRowHeigh !== void 0 ? _props$enableRowHeigh : presetOptions.enableRowHeight,
|
10668
10860
|
enableSaveSettings: (_props$enableSaveSett = props.enableSaveSettings) !== null && _props$enableSaveSett !== void 0 ? _props$enableSaveSett : presetOptions.enableSaveSettings
|
10669
10861
|
};
|
@@ -10783,8 +10975,17 @@ function useTablePrintingSettings(tableId) {
|
|
10783
10975
|
|
10784
10976
|
const DEFAULT_ROW_ACTIONS_LENGTH = 4;
|
10785
10977
|
function useTableRowActions(isEnabled = false, rowActions, rowActionsLength = DEFAULT_ROW_ACTIONS_LENGTH) {
|
10978
|
+
const [handlers, setHandlers] = React__default.useState({});
|
10979
|
+
const registerHandler = (key, handler) => {
|
10980
|
+
return setHandlers(h => ({
|
10981
|
+
...h,
|
10982
|
+
[key]: handler
|
10983
|
+
}));
|
10984
|
+
};
|
10786
10985
|
return {
|
10986
|
+
handlers,
|
10787
10987
|
isEnabled,
|
10988
|
+
registerHandler,
|
10788
10989
|
rowActions: isEnabled ? rowActions : undefined,
|
10789
10990
|
rowActionsLength: rowActions ? Math.min(rowActions.length, rowActionsLength) : 0
|
10790
10991
|
};
|
@@ -10859,7 +11060,7 @@ function useTableRowActive(isEnabled = false, initialRowActiveIndex) {
|
|
10859
11060
|
return index;
|
10860
11061
|
});
|
10861
11062
|
}
|
10862
|
-
}, [rowActiveIndex,
|
11063
|
+
}, [rowActiveIndex, isEnabled]);
|
10863
11064
|
return {
|
10864
11065
|
isEnabled,
|
10865
11066
|
rowActiveIndex,
|
@@ -10908,9 +11109,10 @@ function useTableRowClick(isEnabled = false, onRowClick) {
|
|
10908
11109
|
};
|
10909
11110
|
}
|
10910
11111
|
|
10911
|
-
function useTableRowExpansion(isEnabled = false, rowExpansionRenderer) {
|
11112
|
+
function useTableRowExpansion(isEnabled = false, canExpandAll = true, rowExpansionRenderer) {
|
10912
11113
|
return {
|
10913
11114
|
isEnabled,
|
11115
|
+
canExpandAll,
|
10914
11116
|
rowExpansionRenderer: isEnabled ? rowExpansionRenderer : undefined
|
10915
11117
|
};
|
10916
11118
|
}
|
@@ -10974,7 +11176,7 @@ function useTableRowSelection(isEnabled = false) {
|
|
10974
11176
|
- Highlighting search results, this is custom and only uses the state part of globalFilter (to store the search query)
|
10975
11177
|
- Filtering of results, this is essentially the built in filtering, and relies on enableGlobalFilter being on or off
|
10976
11178
|
*/
|
10977
|
-
function useTableSearch(isEnabled = false, defaultEnableGlobalFilter = false) {
|
11179
|
+
function useTableSearch(isEnabled = false, onChangeSearch, defaultEnableGlobalFilter = false) {
|
10978
11180
|
const [enableGlobalFilter, _setEnableGlobalFilter] = React__default.useState(defaultEnableGlobalFilter);
|
10979
11181
|
function setEnableGlobalFilter(enabled, instance) {
|
10980
11182
|
_setEnableGlobalFilter(enabled);
|
@@ -10999,7 +11201,8 @@ function useTableSearch(isEnabled = false, defaultEnableGlobalFilter = false) {
|
|
10999
11201
|
highlightedColumnIndexes,
|
11000
11202
|
setHighlightedColumnIndexes,
|
11001
11203
|
currentHighlightColumnIndex,
|
11002
|
-
setCurrentHighlightColumnIndex
|
11204
|
+
setCurrentHighlightColumnIndex,
|
11205
|
+
handleSearch: isEnabled && typeof onChangeSearch === 'function' ? onChangeSearch : undefined
|
11003
11206
|
};
|
11004
11207
|
}
|
11005
11208
|
|
@@ -11209,9 +11412,10 @@ function useTableDataLoader(fetchPage, fetchAll, options = {
|
|
11209
11412
|
const _lastUsedSorting = React__default.useRef([]);
|
11210
11413
|
const _lastUsedFilters = React__default.useRef([]);
|
11211
11414
|
const _lastUsedSearch = React__default.useRef();
|
11415
|
+
const _lastUsedHiddenColumns = React__default.useRef([]);
|
11212
11416
|
const _lastUsedPageIndex = React__default.useRef();
|
11213
11417
|
const _forceReset = React__default.useRef(false);
|
11214
|
-
const loadPage = function (pageIndex, sorting, filters) {
|
11418
|
+
const loadPage = function (pageIndex, sorting, filters, hiddenColumns) {
|
11215
11419
|
try {
|
11216
11420
|
let reset = false;
|
11217
11421
|
// sorting or filters changed, reset everything
|
@@ -11233,9 +11437,10 @@ function useTableDataLoader(fetchPage, fetchAll, options = {
|
|
11233
11437
|
_lastUsedSorting.current = sorting;
|
11234
11438
|
// set the filters so we can track if it changed between loads
|
11235
11439
|
_lastUsedFilters.current = filters;
|
11440
|
+
_lastUsedHiddenColumns.current = hiddenColumns;
|
11236
11441
|
const _temp = _finallyRethrows(function () {
|
11237
11442
|
return _catch(function () {
|
11238
|
-
return Promise.resolve(fetchPage(pageIndex, pageSize, sorting, filters)).then(function (response) {
|
11443
|
+
return Promise.resolve(fetchPage(pageIndex, pageSize, sorting, filters, hiddenColumns)).then(function (response) {
|
11239
11444
|
// update state, here we do some "magic" to support "load in place"
|
11240
11445
|
setData(currentData => {
|
11241
11446
|
let nextData;
|
@@ -11264,14 +11469,15 @@ function useTableDataLoader(fetchPage, fetchAll, options = {
|
|
11264
11469
|
return Promise.reject(e);
|
11265
11470
|
}
|
11266
11471
|
};
|
11267
|
-
const loadAll = function (sorting, filters) {
|
11472
|
+
const loadAll = function (sorting, filters, hiddenColumns) {
|
11268
11473
|
try {
|
11269
11474
|
// set the sorting so we can track if it changed between loads
|
11270
11475
|
_lastUsedSorting.current = sorting;
|
11271
11476
|
// set the filters so we can track if it changed between loads
|
11272
11477
|
_lastUsedFilters.current = filters;
|
11478
|
+
_lastUsedHiddenColumns.current = hiddenColumns;
|
11273
11479
|
const _temp2 = _catch(function () {
|
11274
|
-
return Promise.resolve(fetchAll(sorting, filters)).then(function (response) {
|
11480
|
+
return Promise.resolve(fetchAll(sorting, filters, hiddenColumns)).then(function (response) {
|
11275
11481
|
length.current = response.length;
|
11276
11482
|
setData(() => {
|
11277
11483
|
let nextData;
|
@@ -11296,11 +11502,11 @@ function useTableDataLoader(fetchPage, fetchAll, options = {
|
|
11296
11502
|
_forceReset.current = true;
|
11297
11503
|
if (_lastUsedSearch.current) {
|
11298
11504
|
// we're searching, which means we need to refetch all with the correct sorting applied
|
11299
|
-
return loadAll(_lastUsedSorting.current, _lastUsedFilters.current);
|
11505
|
+
return loadAll(_lastUsedSorting.current, _lastUsedFilters.current, _lastUsedHiddenColumns.current);
|
11300
11506
|
} else {
|
11301
11507
|
var _lastUsedPageIndex$cu;
|
11302
11508
|
// load the last page that we scrolled to
|
11303
|
-
return loadPage((_lastUsedPageIndex$cu = _lastUsedPageIndex.current) !== null && _lastUsedPageIndex$cu !== void 0 ? _lastUsedPageIndex$cu : 0, _lastUsedSorting.current, _lastUsedFilters.current);
|
11509
|
+
return loadPage((_lastUsedPageIndex$cu = _lastUsedPageIndex.current) !== null && _lastUsedPageIndex$cu !== void 0 ? _lastUsedPageIndex$cu : 0, _lastUsedSorting.current, _lastUsedFilters.current, _lastUsedHiddenColumns.current);
|
11304
11510
|
}
|
11305
11511
|
} catch (e) {
|
11306
11512
|
return Promise.reject(e);
|
@@ -11312,13 +11518,12 @@ function useTableDataLoader(fetchPage, fetchAll, options = {
|
|
11312
11518
|
try {
|
11313
11519
|
if (_lastUsedSearch.current) {
|
11314
11520
|
// we're searching, which means we need to refetch all with the correct sorting applied
|
11315
|
-
loadAll(sorting, _lastUsedFilters.current);
|
11521
|
+
return loadAll(sorting, _lastUsedFilters.current, _lastUsedHiddenColumns.current);
|
11316
11522
|
} else {
|
11317
11523
|
var _lastUsedPageIndex$cu2;
|
11318
11524
|
// load the last page that we scrolled to
|
11319
|
-
loadPage((_lastUsedPageIndex$cu2 = _lastUsedPageIndex.current) !== null && _lastUsedPageIndex$cu2 !== void 0 ? _lastUsedPageIndex$cu2 : 0, sorting, _lastUsedFilters.current);
|
11525
|
+
return loadPage((_lastUsedPageIndex$cu2 = _lastUsedPageIndex.current) !== null && _lastUsedPageIndex$cu2 !== void 0 ? _lastUsedPageIndex$cu2 : 0, sorting, _lastUsedFilters.current, _lastUsedHiddenColumns.current);
|
11320
11526
|
}
|
11321
|
-
return Promise.resolve();
|
11322
11527
|
} catch (e) {
|
11323
11528
|
return Promise.reject(e);
|
11324
11529
|
}
|
@@ -11327,13 +11532,12 @@ function useTableDataLoader(fetchPage, fetchAll, options = {
|
|
11327
11532
|
try {
|
11328
11533
|
if (_lastUsedSearch.current) {
|
11329
11534
|
// we're searching, which means we need to refetch all with the correct sorting applied
|
11330
|
-
loadAll(_lastUsedSorting.current, filters);
|
11535
|
+
return loadAll(_lastUsedSorting.current, filters, _lastUsedHiddenColumns.current);
|
11331
11536
|
} else {
|
11332
11537
|
var _lastUsedPageIndex$cu3;
|
11333
11538
|
// load the last page that we scrolled to
|
11334
|
-
loadPage((_lastUsedPageIndex$cu3 = _lastUsedPageIndex.current) !== null && _lastUsedPageIndex$cu3 !== void 0 ? _lastUsedPageIndex$cu3 : 0, _lastUsedSorting.current, filters);
|
11539
|
+
return loadPage((_lastUsedPageIndex$cu3 = _lastUsedPageIndex.current) !== null && _lastUsedPageIndex$cu3 !== void 0 ? _lastUsedPageIndex$cu3 : 0, _lastUsedSorting.current, filters, _lastUsedHiddenColumns.current);
|
11335
11540
|
}
|
11336
|
-
return Promise.resolve();
|
11337
11541
|
} catch (e) {
|
11338
11542
|
return Promise.reject(e);
|
11339
11543
|
}
|
@@ -11361,10 +11565,17 @@ function useTableDataLoader(fetchPage, fetchAll, options = {
|
|
11361
11565
|
}, invalidate];
|
11362
11566
|
}
|
11363
11567
|
|
11364
|
-
function useTableServerLoading(loadPage, loadAll, pageSize = DEFAULT_PAGE_SIZE) {
|
11568
|
+
function useTableServerLoading(length, data, loadPage, loadAll, pages, pageSize = DEFAULT_PAGE_SIZE, _experimentalDataLoader2 = false) {
|
11365
11569
|
const isEnabled = !!loadPage && !!loadAll;
|
11366
11570
|
const [isReady, setReady] = React__default.useState(false);
|
11367
|
-
const [
|
11571
|
+
const [loading, setLoading] = React__default.useState(false);
|
11572
|
+
const hasLoadedAll = React__default.useMemo(() => {
|
11573
|
+
var _data$some;
|
11574
|
+
if (data.length !== length || !!((_data$some = data.some) !== null && _data$some !== void 0 && _data$some.call(data, x => x === undefined))) {
|
11575
|
+
return false;
|
11576
|
+
}
|
11577
|
+
return true;
|
11578
|
+
}, [data, length]);
|
11368
11579
|
let _loadPage;
|
11369
11580
|
let _loadAll;
|
11370
11581
|
let _loadAllIfNeeded;
|
@@ -11389,9 +11600,9 @@ function useTableServerLoading(loadPage, loadAll, pageSize = DEFAULT_PAGE_SIZE)
|
|
11389
11600
|
try {
|
11390
11601
|
const _temp2 = function () {
|
11391
11602
|
if (typeof loadAll === 'function') {
|
11392
|
-
|
11603
|
+
setLoading(true);
|
11393
11604
|
return Promise.resolve(loadAll(...args)).then(function () {
|
11394
|
-
|
11605
|
+
setLoading(false);
|
11395
11606
|
setReady(true);
|
11396
11607
|
});
|
11397
11608
|
}
|
@@ -11404,7 +11615,7 @@ function useTableServerLoading(loadPage, loadAll, pageSize = DEFAULT_PAGE_SIZE)
|
|
11404
11615
|
_loadAllIfNeeded = function (...args) {
|
11405
11616
|
try {
|
11406
11617
|
const _temp3 = function () {
|
11407
|
-
if (
|
11618
|
+
if (!hasLoadedAll) {
|
11408
11619
|
var _loadAll2;
|
11409
11620
|
return Promise.resolve((_loadAll2 = _loadAll) === null || _loadAll2 === void 0 ? void 0 : _loadAll2(...args)).then(function () {});
|
11410
11621
|
}
|
@@ -11415,14 +11626,18 @@ function useTableServerLoading(loadPage, loadAll, pageSize = DEFAULT_PAGE_SIZE)
|
|
11415
11626
|
}
|
11416
11627
|
};
|
11417
11628
|
}
|
11629
|
+
const pageCount = Math.ceil(length / pageSize);
|
11418
11630
|
return {
|
11631
|
+
pages,
|
11419
11632
|
isEnabled,
|
11420
11633
|
isReady,
|
11421
11634
|
loadPage: _loadPage,
|
11422
11635
|
loadAll: _loadAll,
|
11423
11636
|
loadAllIfNeeded: _loadAllIfNeeded,
|
11424
|
-
|
11425
|
-
pageSize
|
11637
|
+
loading,
|
11638
|
+
pageSize,
|
11639
|
+
pageCount,
|
11640
|
+
_experimentalDataLoader2
|
11426
11641
|
};
|
11427
11642
|
}
|
11428
11643
|
|
@@ -11494,22 +11709,21 @@ function useLazyEffect(effect, deps) {
|
|
11494
11709
|
const readyRef = React__default.useRef(false);
|
11495
11710
|
React__default.useEffect(() => {
|
11496
11711
|
if (readyRef.current) {
|
11497
|
-
effect();
|
11712
|
+
return effect();
|
11498
11713
|
} else {
|
11499
11714
|
readyRef.current = true;
|
11500
11715
|
}
|
11501
11716
|
}, deps);
|
11502
11717
|
}
|
11503
11718
|
|
11504
|
-
function useTableDataListener(table) {
|
11719
|
+
function useTableDataListener(table, length) {
|
11505
11720
|
const meta = table.options.meta;
|
11506
|
-
const rows = table.getRowModel().rows;
|
11507
11721
|
useLazyEffect(() => {
|
11508
11722
|
const rowActiveIndex = meta.rowActive.rowActiveIndex;
|
11509
|
-
if (rowActiveIndex !== undefined && rowActiveIndex >
|
11723
|
+
if (rowActiveIndex !== undefined && rowActiveIndex > length) {
|
11510
11724
|
meta.rowActive.setRowActiveIndex(0);
|
11511
11725
|
}
|
11512
|
-
}, [
|
11726
|
+
}, [length]);
|
11513
11727
|
}
|
11514
11728
|
|
11515
11729
|
// we use a listener, and not the internal "controlled" change handlers because we don't actually want consumers
|
@@ -11519,7 +11733,8 @@ function useTableFilterListener(table, onFilter) {
|
|
11519
11733
|
const columnFilters = table.getState().columnFilters;
|
11520
11734
|
useLazyEffect(() => {
|
11521
11735
|
if (table.options.enableColumnFilters && typeof onFilter === 'function') {
|
11522
|
-
|
11736
|
+
const hiddenColumns = getHiddenColumns(table.getState().columnVisibility);
|
11737
|
+
onFilter(columnFilters, hiddenColumns);
|
11523
11738
|
if (table.options.enableRowSelection) {
|
11524
11739
|
table.resetRowSelection();
|
11525
11740
|
}
|
@@ -11536,7 +11751,8 @@ function useTableFontSizeListener(table) {
|
|
11536
11751
|
table.setColumnSizing(sizes => {
|
11537
11752
|
return Object.fromEntries(Object.entries(sizes).map(([columnName, prevColumnSize]) => {
|
11538
11753
|
var _column$columnDef$min;
|
11539
|
-
|
11754
|
+
// table.getColumn(columName) throw error in strict dev mode. Related thread: https://github.com/TanStack/table/discussions/5505
|
11755
|
+
const column = table.getAllColumns().find(x => x.id === columnName);
|
11540
11756
|
if (isInternalColumn(columnName)) {
|
11541
11757
|
var _column$getSize;
|
11542
11758
|
return [columnName, (_column$getSize = column === null || column === void 0 ? void 0 : column.getSize()) !== null && _column$getSize !== void 0 ? _column$getSize : prevColumnSize];
|
@@ -11577,11 +11793,12 @@ function useTableRowHeightListener(table) {
|
|
11577
11793
|
}
|
11578
11794
|
|
11579
11795
|
function useTableRowSelectionListener(table, onRowSelect) {
|
11796
|
+
// note that the selected row model may not contain all rows in state when using server loading
|
11580
11797
|
const rows = table.getSelectedRowModel().flatRows;
|
11581
|
-
const
|
11798
|
+
const state = table.getState().rowSelection;
|
11582
11799
|
useLazyEffect(() => {
|
11583
11800
|
if (table.options.enableRowSelection && typeof onRowSelect === 'function') {
|
11584
|
-
onRowSelect(
|
11801
|
+
onRowSelect(rows.map(row => row.original), Object.keys(state));
|
11585
11802
|
}
|
11586
11803
|
/**
|
11587
11804
|
* Casting to a boolean, since enableRowSelection can be a function,
|
@@ -11589,33 +11806,33 @@ function useTableRowSelectionListener(table, onRowSelect) {
|
|
11589
11806
|
* we only need to know if selection was enabled or disabled, because enableRowSelection function
|
11590
11807
|
* will be applied directly to particular rows.
|
11591
11808
|
*/
|
11592
|
-
}, [!!table.options.enableRowSelection, JSON.stringify(
|
11809
|
+
}, [!!table.options.enableRowSelection, JSON.stringify(state)]);
|
11593
11810
|
}
|
11594
11811
|
|
11595
|
-
function useTableSearchListener(table
|
11812
|
+
function useTableSearchListener(table) {
|
11596
11813
|
const meta = table.options.meta;
|
11597
11814
|
const localization = useLocalization();
|
11598
|
-
const
|
11815
|
+
const hiddenColumns = getHiddenColumns(table.getState().columnVisibility);
|
11816
|
+
const query = table.getState().globalFilter;
|
11599
11817
|
// Need to re-run search when columns are getting shown/hidden.
|
11600
|
-
|
11601
|
-
if (meta.search.isEnabled
|
11602
|
-
const currentFilter =
|
11818
|
+
useLazyEffect(() => {
|
11819
|
+
if (meta.search.isEnabled) {
|
11820
|
+
const currentFilter = query;
|
11603
11821
|
requestAnimationFrame(() => {
|
11604
11822
|
table.resetGlobalFilter();
|
11605
11823
|
table.setGlobalFilter(currentFilter);
|
11606
11824
|
});
|
11825
|
+
if (meta.search.handleSearch && meta.search.enableGlobalFilter && query) {
|
11826
|
+
meta.search.handleSearch(query, hiddenColumns);
|
11827
|
+
}
|
11607
11828
|
}
|
11608
|
-
}, [
|
11829
|
+
}, [hiddenColumns.length]);
|
11609
11830
|
// recalculates highlighted indexes whenever something important changes
|
11610
|
-
|
11831
|
+
useLazyEffect(() => {
|
11611
11832
|
if (meta.search.isEnabled) {
|
11612
|
-
const query = table.getState().globalFilter;
|
11613
11833
|
resetHighlightedColumnIndexes(query, table, localization);
|
11614
|
-
if (typeof onChangeSearch === 'function') {
|
11615
|
-
onChangeSearch(query);
|
11616
|
-
}
|
11617
11834
|
}
|
11618
|
-
}, [meta.server.
|
11835
|
+
}, [meta.server.loading, meta.search.isEnabled, meta.search.enableGlobalFilter, table.getRowModel().rows.length, query, JSON.stringify(table.getState().sorting)]);
|
11619
11836
|
}
|
11620
11837
|
|
11621
11838
|
function useTableSettingsListener(table, onChangeSettings) {
|
@@ -11699,12 +11916,15 @@ function useTableSortingListener(table, onSort) {
|
|
11699
11916
|
}
|
11700
11917
|
|
11701
11918
|
function useTableServerLoadingListener(table, loadPage) {
|
11702
|
-
const
|
11703
|
-
const columnFilters = table.getState().columnFilters;
|
11919
|
+
const meta = table.options.meta;
|
11704
11920
|
// trigger load of the first page on mount
|
11705
11921
|
React__default.useEffect(() => {
|
11706
11922
|
if (loadPage) {
|
11707
|
-
|
11923
|
+
const sorting = table.getState().sorting;
|
11924
|
+
const columnFilters = table.getState().columnFilters;
|
11925
|
+
const hiddenColumns = getHiddenColumns(table.getState().columnVisibility);
|
11926
|
+
const search = meta.search.enableGlobalFilter ? table.getState().globalFilter : undefined;
|
11927
|
+
loadPage(0, sorting, columnFilters, hiddenColumns, search);
|
11708
11928
|
}
|
11709
11929
|
}, []);
|
11710
11930
|
}
|
@@ -11751,13 +11971,13 @@ function useTableManager(props, meta, internalColumns) {
|
|
11751
11971
|
const rowClick = useTableRowClick(options.enableRowClick, props.onRowClick);
|
11752
11972
|
const rowDrag = useTableRowDrag(options.enableRowDrag && !(meta !== null && meta !== void 0 && (_meta$editing = meta.editing) !== null && _meta$editing !== void 0 && _meta$editing.isEditing), props.onRowDrag);
|
11753
11973
|
const rowDrop = useTableRowDrop(options.enableRowDrop, props.onRowDrop);
|
11754
|
-
const rowExpansion = useTableRowExpansion(options.enableRowExpansion, props.rowExpansionRenderer);
|
11974
|
+
const rowExpansion = useTableRowExpansion(options.enableRowExpansion, options.enableRowExpansionAll, props.rowExpansionRenderer);
|
11755
11975
|
const rowGoto = useTableRowGoto(options.enableRowGoto, props.onRowGoto);
|
11756
11976
|
const rowGroups = useTableRowGroups(props.rowActionsForGroup);
|
11757
11977
|
const rowHeight = useTableRowHeight(options.enableRowHeight, settings.rowHeight);
|
11758
11978
|
const rowSelection = useTableRowSelection(!!options.enableRowSelection);
|
11759
|
-
const search = useTableSearch(options.enableSearch, settings.excludeUnmatchedRecordsInSearch);
|
11760
|
-
const server = useTableServerLoading(props.loadPage, props.loadAll, props.pageSize);
|
11979
|
+
const search = useTableSearch(options.enableSearch, props.onChangeSearch, settings.excludeUnmatchedRecordsInSearch);
|
11980
|
+
const server = useTableServerLoading(length, data, props.loadPage, props.loadAll, props.pages, props.pageSize, props._experimentalDataLoader2);
|
11761
11981
|
// TODO: memoise
|
11762
11982
|
// convert jsx column components into valid table columns
|
11763
11983
|
const {
|
@@ -11786,6 +12006,7 @@ function useTableManager(props, meta, internalColumns) {
|
|
11786
12006
|
fontSize,
|
11787
12007
|
footer,
|
11788
12008
|
length,
|
12009
|
+
onEvent: props.onEvent,
|
11789
12010
|
printing,
|
11790
12011
|
rowActions: rowActions,
|
11791
12012
|
rowActive,
|
@@ -11803,12 +12024,12 @@ function useTableManager(props, meta, internalColumns) {
|
|
11803
12024
|
}
|
11804
12025
|
});
|
11805
12026
|
// state listeners - we have these so that we don't have to control state outside the table
|
11806
|
-
useTableDataListener(instance);
|
12027
|
+
useTableDataListener(instance, length);
|
11807
12028
|
useTableFilterListener(instance, props.onChangeFilter);
|
11808
12029
|
useTableFontSizeListener(instance);
|
11809
12030
|
useTableRowHeightListener(instance);
|
11810
12031
|
useTableRowSelectionListener(instance, props.onRowSelect);
|
11811
|
-
useTableSearchListener(instance
|
12032
|
+
useTableSearchListener(instance);
|
11812
12033
|
useTableServerLoadingListener(instance, server.loadPage);
|
11813
12034
|
useTableSettingsListener(instance, setSettings);
|
11814
12035
|
useTableShortcutsListener(instance, props.shortcuts);
|
@@ -11877,9 +12098,9 @@ function useTableStyleGrid(tableId, table, fontSize) {
|
|
11877
12098
|
};
|
11878
12099
|
// printing grid
|
11879
12100
|
// we have to be specific so that nested tables don't inherit the same css
|
11880
|
-
const hiddenColumns = printHiddenColumns.map(id => `table[data-taco^='table']#${tableId} > thead > tr > th[data-cell-id='${id}']\n,table[data-taco^='table']#${tableId}
|
12101
|
+
const hiddenColumns = printHiddenColumns.map(id => `table[data-taco^='table']#${tableId} > thead > tr > th[data-cell-id='${id}']\n,table[data-taco^='table']#${tableId} tr > td[data-cell-id='${id}']\n`).join(',');
|
11881
12102
|
const stylesheet = `@media print { table[data-taco^='table']#${tableId} { grid-template-columns: repeat(${printGridTemplateColumns}, auto) !important; }
|
11882
|
-
table[data-taco^='table']#${tableId} [data-cell-id^='__']${hiddenColumns ? `, ${hiddenColumns}` : ''} { display: none; }}`;
|
12103
|
+
table[data-taco^='table']#${tableId} [data-cell-id^='__']${hiddenColumns ? `, ${hiddenColumns}` : ''} { display: none; } table[data-taco^='table']#${tableId} tr { page-break-inside: avoid; break-inside: avoid;}}`;
|
11883
12104
|
return {
|
11884
12105
|
style,
|
11885
12106
|
stylesheet
|
@@ -12034,7 +12255,7 @@ function useTableGlobalShortcuts(table, tableRef, scrollToIndex) {
|
|
12034
12255
|
if (isElementInsideOverlay(trigger) && !isSiblingElementInsideSameParentOverlay(trigger, tableRef.current) || isElementInteractive(trigger) && !isElementInsideOrTriggeredFromContainer(trigger, tableRef.current)) {
|
12035
12256
|
return;
|
12036
12257
|
}
|
12037
|
-
tableMeta.rowActive.handleKeyDown(event,
|
12258
|
+
tableMeta.rowActive.handleKeyDown(event, tableMeta.length, scrollToIndex);
|
12038
12259
|
tableMeta.rowSelection.handleKeyDown(event, table);
|
12039
12260
|
if (tableMeta.rowActive.rowActiveIndex !== undefined) {
|
12040
12261
|
var _rows$tableMeta$rowAc;
|
@@ -12047,7 +12268,7 @@ function useTableGlobalShortcuts(table, tableRef, scrollToIndex) {
|
|
12047
12268
|
};
|
12048
12269
|
},
|
12049
12270
|
// scrollToIndex function changes when row count changes, so it is important to update handlers
|
12050
|
-
[tableRef.current, tableMeta.rowActive.rowActiveIndex, scrollToIndex]);
|
12271
|
+
[tableRef.current, tableMeta.length, tableMeta.rowActive.rowActiveIndex, scrollToIndex]);
|
12051
12272
|
}
|
12052
12273
|
|
12053
12274
|
function useTableRef(table, ref) {
|
@@ -12070,57 +12291,131 @@ const ROW_HEIGHT_ESTIMATES = {
|
|
12070
12291
|
'extra-tall': 57
|
12071
12292
|
};
|
12072
12293
|
|
12294
|
+
const RowContext = /*#__PURE__*/React__default.createContext({
|
12295
|
+
hideInternalColumns: false,
|
12296
|
+
hideRowActions: false,
|
12297
|
+
isHovered: false,
|
12298
|
+
rowIndex: -1
|
12299
|
+
});
|
12300
|
+
|
12301
|
+
const DELAY_BEFORE_LOAD_MS = 250;
|
12302
|
+
/* anonymous functions will break the memoisation on each render, wrap handlers in callbacks */
|
12303
|
+
function Row(props) {
|
12304
|
+
const {
|
12305
|
+
renderer: RowRenderer,
|
12306
|
+
cellRenderer: CellRenderer,
|
12307
|
+
hideInternalColumns = false,
|
12308
|
+
hideRowActions = false,
|
12309
|
+
scrollDirection,
|
12310
|
+
skipPageLoading = false,
|
12311
|
+
...displayRowProps
|
12312
|
+
} = props;
|
12313
|
+
const tableMeta = props.table.options.meta;
|
12314
|
+
const isHovered = tableMeta.rowActive.rowHoverIndex === props.index;
|
12315
|
+
// context - it must be here for cells to read it, since they render alongside the row inside DisplayRow
|
12316
|
+
const contextValue = React__default.useMemo(() => ({
|
12317
|
+
isHovered,
|
12318
|
+
rowIndex: props.index,
|
12319
|
+
hideInternalColumns,
|
12320
|
+
hideRowActions
|
12321
|
+
}), [isHovered, props.index, hideInternalColumns, hideRowActions]);
|
12322
|
+
React__default.useEffect(() => {
|
12323
|
+
let timeout;
|
12324
|
+
if (tableMeta.server.isEnabled && tableMeta.server._experimentalDataLoader2 && !skipPageLoading) {
|
12325
|
+
const pageIndex = Math.floor(props.index / tableMeta.server.pageSize) * tableMeta.server.pageSize / tableMeta.server.pageSize;
|
12326
|
+
const sorting = props.table.getState().sorting;
|
12327
|
+
const filters = props.table.getState().columnFilters;
|
12328
|
+
const search = props.table.getState().globalFilter;
|
12329
|
+
const hiddenColumns = getHiddenColumns(props.table.getState().columnVisibility);
|
12330
|
+
const pageIndexesToFetch = [];
|
12331
|
+
// if there's no direction, it means the scroll bar got dropped un unloaded pages,
|
12332
|
+
// in that case, load forward and backward pages to prevent skeletons
|
12333
|
+
if (scrollDirection === 'backward' || !scrollDirection) {
|
12334
|
+
const backIndex = pageIndex - 1;
|
12335
|
+
if (backIndex > -1) {
|
12336
|
+
pageIndexesToFetch.push(backIndex);
|
12337
|
+
}
|
12338
|
+
}
|
12339
|
+
// always load the next page
|
12340
|
+
if ((scrollDirection === 'forward' || !scrollDirection) && pageIndex + 2 < tableMeta.server.pageCount) {
|
12341
|
+
pageIndexesToFetch.push(pageIndex + 1);
|
12342
|
+
}
|
12343
|
+
if (pageIndexesToFetch.length) {
|
12344
|
+
// the virtualiser fetches a page ahead, so this won't get called in most cases
|
12345
|
+
// but it provides a fallback for some edge cases
|
12346
|
+
timeout = setTimeout(() => {
|
12347
|
+
pageIndexesToFetch.forEach(index => {
|
12348
|
+
var _tableMeta$server$loa, _tableMeta$server;
|
12349
|
+
// this can be called by every row within the current page, but loadPage returns early if a pending request exists
|
12350
|
+
(_tableMeta$server$loa = (_tableMeta$server = tableMeta.server).loadPage) === null || _tableMeta$server$loa === void 0 ? void 0 : _tableMeta$server$loa.call(_tableMeta$server, index, sorting, filters, hiddenColumns, tableMeta.search.enableGlobalFilter ? search : undefined);
|
12351
|
+
});
|
12352
|
+
}, DELAY_BEFORE_LOAD_MS);
|
12353
|
+
}
|
12354
|
+
}
|
12355
|
+
return () => {
|
12356
|
+
clearTimeout(timeout);
|
12357
|
+
};
|
12358
|
+
}, [tableMeta.server.pages]);
|
12359
|
+
return /*#__PURE__*/React__default.createElement(RowContext.Provider, {
|
12360
|
+
value: contextValue
|
12361
|
+
}, /*#__PURE__*/React__default.createElement(RowRenderer, Object.assign({}, displayRowProps, {
|
12362
|
+
cellRenderer: CellRenderer
|
12363
|
+
})));
|
12364
|
+
}
|
12365
|
+
|
12366
|
+
const DELAY_BEFORE_LOAD_MS$1 = 150;
|
12073
12367
|
function SkeletonRow(props) {
|
12074
12368
|
const {
|
12075
12369
|
index,
|
12076
|
-
row,
|
12077
12370
|
table
|
12078
12371
|
} = props;
|
12079
12372
|
const tableMeta = table.options.meta;
|
12080
12373
|
if (tableMeta.server.isEnabled) {
|
12081
|
-
return /*#__PURE__*/React__default.createElement(RowWithServerLoading, Object.assign({}, props
|
12082
|
-
index: index
|
12083
|
-
}));
|
12374
|
+
return /*#__PURE__*/React__default.createElement(RowWithServerLoading, Object.assign({}, props));
|
12084
12375
|
}
|
12085
12376
|
return /*#__PURE__*/React__default.createElement(Skeleton, {
|
12086
|
-
cellsCount:
|
12377
|
+
cellsCount: table.getVisibleFlatColumns().length,
|
12378
|
+
index: index
|
12087
12379
|
});
|
12088
12380
|
}
|
12089
12381
|
function RowWithServerLoading(props) {
|
12090
12382
|
var _table$getState$group, _table$getState;
|
12091
12383
|
const {
|
12092
12384
|
index,
|
12093
|
-
row,
|
12094
12385
|
table
|
12095
12386
|
} = props;
|
12096
12387
|
const tableMeta = table.options.meta;
|
12097
12388
|
const pageIndex = Math.floor(index / tableMeta.server.pageSize) * tableMeta.server.pageSize / tableMeta.server.pageSize;
|
12098
|
-
const {
|
12099
|
-
ref,
|
12100
|
-
inView
|
12101
|
-
} = reactIntersectionObserver.useInView({
|
12102
|
-
threshold: 0,
|
12103
|
-
triggerOnce: true,
|
12104
|
-
initialInView: pageIndex === 0
|
12105
|
-
});
|
12106
12389
|
React__default.useEffect(() => {
|
12107
|
-
|
12108
|
-
|
12109
|
-
|
12390
|
+
let timeout;
|
12391
|
+
if (tableMeta.server.isEnabled) {
|
12392
|
+
const sorting = props.table.getState().sorting;
|
12393
|
+
const filters = props.table.getState().columnFilters;
|
12394
|
+
const search = props.table.getState().globalFilter;
|
12395
|
+
const hiddenColumns = getHiddenColumns(props.table.getState().columnVisibility);
|
12396
|
+
timeout = setTimeout(() => {
|
12397
|
+
var _tableMeta$server$loa, _tableMeta$server;
|
12398
|
+
(_tableMeta$server$loa = (_tableMeta$server = tableMeta.server).loadPage) === null || _tableMeta$server$loa === void 0 ? void 0 : _tableMeta$server$loa.call(_tableMeta$server, pageIndex, sorting, filters, hiddenColumns, tableMeta.search.enableGlobalFilter ? search : undefined);
|
12399
|
+
}, DELAY_BEFORE_LOAD_MS$1);
|
12110
12400
|
}
|
12111
|
-
|
12401
|
+
return () => {
|
12402
|
+
clearTimeout(timeout);
|
12403
|
+
};
|
12404
|
+
}, []);
|
12112
12405
|
const groupedCellCount = (_table$getState$group = (_table$getState = table.getState()) === null || _table$getState === void 0 ? void 0 : _table$getState.grouping.length) !== null && _table$getState$group !== void 0 ? _table$getState$group : 0;
|
12113
|
-
const ungroupedCellCount =
|
12406
|
+
const ungroupedCellCount = table.getVisibleFlatColumns().length - groupedCellCount;
|
12114
12407
|
return /*#__PURE__*/React__default.createElement(Skeleton, {
|
12115
12408
|
cellsCount: ungroupedCellCount,
|
12116
|
-
|
12409
|
+
index: index
|
12117
12410
|
});
|
12118
12411
|
}
|
12119
12412
|
const Skeleton = /*#__PURE__*/React__default.forwardRef(function Skeleton(props, ref) {
|
12120
12413
|
const {
|
12121
|
-
cellsCount
|
12414
|
+
cellsCount,
|
12415
|
+
index
|
12122
12416
|
} = props;
|
12123
12417
|
return /*#__PURE__*/React__default.createElement("tr", {
|
12418
|
+
"data-row-index": index,
|
12124
12419
|
ref: ref
|
12125
12420
|
}, Array(cellsCount).fill(null).map((_, index) => (/*#__PURE__*/React__default.createElement("td", {
|
12126
12421
|
key: index
|
@@ -12129,38 +12424,6 @@ const Skeleton = /*#__PURE__*/React__default.forwardRef(function Skeleton(props,
|
|
12129
12424
|
})))));
|
12130
12425
|
});
|
12131
12426
|
|
12132
|
-
const RowContext = /*#__PURE__*/React__default.createContext({
|
12133
|
-
isHovered: false,
|
12134
|
-
rowIndex: -1,
|
12135
|
-
hideRowActions: false
|
12136
|
-
});
|
12137
|
-
|
12138
|
-
/* anonymous functions will break the memoisation on each render, wrap handlers in callbacks */
|
12139
|
-
function Row(props) {
|
12140
|
-
const {
|
12141
|
-
renderer: RowRenderer,
|
12142
|
-
cellRenderer: CellRenderer,
|
12143
|
-
hideRowActions = false,
|
12144
|
-
...displayRowProps
|
12145
|
-
} = props;
|
12146
|
-
const tableMeta = props.table.options.meta;
|
12147
|
-
const isHovered = tableMeta.rowActive.rowHoverIndex === props.index;
|
12148
|
-
// context - it must be here for cells to read it, since they render alongside the row inside DisplayRow
|
12149
|
-
const contextValue = React__default.useMemo(() => ({
|
12150
|
-
isHovered,
|
12151
|
-
rowIndex: props.index,
|
12152
|
-
hideRowActions
|
12153
|
-
}), [isHovered, props.index, hideRowActions]);
|
12154
|
-
if (props.row.original === undefined) {
|
12155
|
-
return /*#__PURE__*/React__default.createElement(SkeletonRow, Object.assign({}, props));
|
12156
|
-
}
|
12157
|
-
return /*#__PURE__*/React__default.createElement(RowContext.Provider, {
|
12158
|
-
value: contextValue
|
12159
|
-
}, /*#__PURE__*/React__default.createElement(RowRenderer, Object.assign({}, displayRowProps, {
|
12160
|
-
cellRenderer: CellRenderer
|
12161
|
-
})));
|
12162
|
-
}
|
12163
|
-
|
12164
12427
|
// scroll padding end is designed to always show half of the next row
|
12165
12428
|
function getScrollPaddingEndOffset(table) {
|
12166
12429
|
const tableMeta = table.options.meta;
|
@@ -12185,31 +12448,34 @@ function getPaddingEndOffset(table, options) {
|
|
12185
12448
|
const bottomRows = (_table$getBottomRows = table.getBottomRows()) !== null && _table$getBottomRows !== void 0 ? _table$getBottomRows : [];
|
12186
12449
|
return ROW_HEIGHT_ESTIMATES.medium * ((_options$virtualiserP = options === null || options === void 0 ? void 0 : options.virtualiserPaddingEndOffset) !== null && _options$virtualiserP !== void 0 ? _options$virtualiserP : 1) * bottomRows.length;
|
12187
12450
|
}
|
12188
|
-
|
12189
|
-
|
12451
|
+
// A higher number ensure less scroll jumping for dynamic row heights, but too high can reduce performance. 8 worked well
|
12452
|
+
const OVERSCAN_ROW_COUNT = 8;
|
12453
|
+
function useTableRenderer(renderers, table, tableRef, length, defaultRowActiveIndex, options) {
|
12454
|
+
var _table$getState$group, _table$getCenterRows, _virtualItems$padding, _virtualItems$padding2, _virtualItems$padding3, _virtualItems$end, _virtualItems;
|
12190
12455
|
const tableMeta = table.options.meta;
|
12191
12456
|
const isTableRowGrouped = !!((_table$getState$group = table.getState().grouping) !== null && _table$getState$group !== void 0 && _table$getState$group.length);
|
12192
12457
|
const rows = (_table$getCenterRows = table.getCenterRows()) !== null && _table$getCenterRows !== void 0 ? _table$getCenterRows : [];
|
12193
|
-
// expanded rows
|
12194
|
-
const {
|
12195
|
-
createRowMeasurer,
|
12196
|
-
estimateSize
|
12197
|
-
} = useRowHeightVirtualisation(table);
|
12198
12458
|
// row groups
|
12199
12459
|
const rangeExtractor = useRowGroupVirtualisation(table);
|
12200
12460
|
// account for thead and tfoot in the scroll area - both are always medium row height
|
12201
12461
|
const scrollPaddingStart = ROW_HEIGHT_ESTIMATES.medium;
|
12462
|
+
const count = tableMeta.server.isEnabled && tableMeta.server._experimentalDataLoader2 ? length : rows.length;
|
12202
12463
|
const virtualiser = reactVirtual.useVirtualizer({
|
12203
|
-
count
|
12204
|
-
estimateSize
|
12464
|
+
count,
|
12465
|
+
estimateSize: () => {
|
12466
|
+
return tableMeta.rowHeight.height ? ROW_HEIGHT_ESTIMATES[tableMeta.rowHeight.height] : ROW_HEIGHT_ESTIMATES.medium;
|
12467
|
+
},
|
12205
12468
|
getScrollElement: () => tableRef.current,
|
12206
|
-
overscan: tableMeta.printing.isPrinting ?
|
12469
|
+
overscan: tableMeta.printing.isPrinting ? count : OVERSCAN_ROW_COUNT,
|
12207
12470
|
rangeExtractor,
|
12208
12471
|
// correctly sets the scroll padding offset, e.g. when keyboard navigating rows in the list
|
12209
12472
|
scrollPaddingStart,
|
12210
12473
|
scrollPaddingEnd: getScrollPaddingEndOffset(table),
|
12211
12474
|
paddingEnd: getPaddingEndOffset(table, options)
|
12212
12475
|
});
|
12476
|
+
React__default.useEffect(() => {
|
12477
|
+
virtualiser.measure();
|
12478
|
+
}, [table.getState().expanded]);
|
12213
12479
|
const totalSize = virtualiser.getTotalSize();
|
12214
12480
|
const virtualItems = virtualiser.getVirtualItems();
|
12215
12481
|
const scrollToIndex = React__default.useCallback((index, options = {
|
@@ -12223,19 +12489,19 @@ function useTableRenderer(renderers, table, tableRef, defaultRowActiveIndex, opt
|
|
12223
12489
|
if (tableRef.current) {
|
12224
12490
|
if (index === 0) {
|
12225
12491
|
virtualiser.scrollToOffset(0, notSmooth);
|
12226
|
-
} else if (index ===
|
12492
|
+
} else if (index === count - 1) {
|
12227
12493
|
// sometimes the last row doesn't fully show, so we just force scroll to the bottom
|
12228
12494
|
tableRef.current.scrollTop = tableRef.current.scrollHeight;
|
12229
12495
|
} else {
|
12230
12496
|
virtualiser.scrollToIndex(index, options);
|
12231
12497
|
}
|
12232
12498
|
}
|
12233
|
-
}, [virtualItems.length, tableRef.current, totalSize,
|
12499
|
+
}, [virtualItems.length, tableRef.current, totalSize, count]);
|
12234
12500
|
// use row 1 not 0, because 0 might be sticky in grouped tables and it's start value will always be 0
|
12235
|
-
const paddingStartIndex = isTableRowGrouped &&
|
12501
|
+
const paddingStartIndex = isTableRowGrouped && count > 1 ? 1 : 0;
|
12236
12502
|
const startValue = isTableRowGrouped ? ((_virtualItems$padding = virtualItems[paddingStartIndex]) === null || _virtualItems$padding === void 0 ? void 0 : _virtualItems$padding.start) - ((_virtualItems$padding2 = virtualItems[paddingStartIndex]) === null || _virtualItems$padding2 === void 0 ? void 0 : _virtualItems$padding2.size) : (_virtualItems$padding3 = virtualItems[paddingStartIndex]) === null || _virtualItems$padding3 === void 0 ? void 0 : _virtualItems$padding3.start;
|
12237
12503
|
// styling for offsetting rows - this "is" the virtualisation
|
12238
|
-
const [paddingTop, paddingBottom] = virtualItems.length > 0 ? [Math.max(0, startValue !== null && startValue !== void 0 ? startValue : 0), Math.max(0,
|
12504
|
+
const [paddingTop, paddingBottom] = virtualItems.length > 0 ? [Math.max(0, startValue !== null && startValue !== void 0 ? startValue : 0), Math.max(0, totalSize - ((_virtualItems$end = (_virtualItems = virtualItems[virtualItems.length - 1]) === null || _virtualItems === void 0 ? void 0 : _virtualItems.end) !== null && _virtualItems$end !== void 0 ? _virtualItems$end : 0))] : [0, 0];
|
12239
12505
|
// ensure default active rows are scrolled to
|
12240
12506
|
React__default.useEffect(() => {
|
12241
12507
|
if (defaultRowActiveIndex) {
|
@@ -12248,23 +12514,54 @@ function useTableRenderer(renderers, table, tableRef, defaultRowActiveIndex, opt
|
|
12248
12514
|
// rendered output
|
12249
12515
|
let style = {};
|
12250
12516
|
let content = null;
|
12251
|
-
|
12517
|
+
// bottom rows aren't virtualised (they're sticky) but we need to set the height
|
12518
|
+
if (count || table.getBottomRows().length) {
|
12252
12519
|
style = {
|
12253
12520
|
height: totalSize,
|
12254
|
-
paddingBottom,
|
12255
|
-
paddingTop
|
12521
|
+
paddingBottom: isNaN(paddingBottom) ? 0 : paddingBottom,
|
12522
|
+
paddingTop: isNaN(paddingTop) ? 0 : paddingTop
|
12256
12523
|
};
|
12524
|
+
}
|
12525
|
+
// only render non sticky rows
|
12526
|
+
if (count) {
|
12257
12527
|
content = virtualItems.map(virtualRow => {
|
12528
|
+
var _row, _virtualiser$scrollDi2;
|
12258
12529
|
// there appears to be a react-virtual bug where it inserts a single `undefined` item at the end of the row, which crashes here
|
12259
12530
|
if (!virtualRow) {
|
12260
12531
|
return null;
|
12261
12532
|
}
|
12262
|
-
|
12263
|
-
|
12533
|
+
let row;
|
12534
|
+
if (tableMeta.server.isEnabled && tableMeta.server._experimentalDataLoader2) {
|
12535
|
+
var _tableMeta$server$pag, _tableMeta$server$pag2;
|
12536
|
+
const currentPageIndex = Math.floor(virtualRow.index / tableMeta.server.pageSize) * tableMeta.server.pageSize / tableMeta.server.pageSize;
|
12537
|
+
const pagePosition = (_tableMeta$server$pag = (_tableMeta$server$pag2 = tableMeta.server.pages) === null || _tableMeta$server$pag2 === void 0 ? void 0 : _tableMeta$server$pag2.indexOf(currentPageIndex)) !== null && _tableMeta$server$pag !== void 0 ? _tableMeta$server$pag : -1;
|
12538
|
+
if (pagePosition > -1) {
|
12539
|
+
// "flatten" row indexes down into the dataloader2 dataset size
|
12540
|
+
// for example, with a page size of 100...
|
12541
|
+
// row index 14267 is actually one of index 67, 167, 267 etc within the dataset (depending on number of pages stored)
|
12542
|
+
const fakeIndex = pagePosition * tableMeta.server.pageSize + virtualRow.index % tableMeta.server.pageSize;
|
12543
|
+
row = rows[fakeIndex];
|
12544
|
+
}
|
12545
|
+
} else {
|
12546
|
+
row = rows[virtualRow.index];
|
12547
|
+
}
|
12548
|
+
if (!((_row = row) !== null && _row !== void 0 && _row.original)) {
|
12549
|
+
var _virtualiser$scrollDi;
|
12550
|
+
return /*#__PURE__*/React__default.createElement(SkeletonRow, {
|
12551
|
+
key: virtualRow.index,
|
12552
|
+
index: virtualRow.index,
|
12553
|
+
scrollDirection: (_virtualiser$scrollDi = virtualiser.scrollDirection) !== null && _virtualiser$scrollDi !== void 0 ? _virtualiser$scrollDi : undefined,
|
12554
|
+
table: table
|
12555
|
+
});
|
12556
|
+
}
|
12557
|
+
const measureRow = rowHeight => {
|
12558
|
+
virtualiser.resizeItem(virtualRow, rowHeight);
|
12559
|
+
};
|
12264
12560
|
return /*#__PURE__*/React__default.createElement(Row, {
|
12265
12561
|
key: row.id,
|
12266
12562
|
row: row,
|
12267
12563
|
index: virtualRow.index,
|
12564
|
+
scrollDirection: (_virtualiser$scrollDi2 = virtualiser.scrollDirection) !== null && _virtualiser$scrollDi2 !== void 0 ? _virtualiser$scrollDi2 : undefined,
|
12268
12565
|
table: table,
|
12269
12566
|
measureRow: measureRow,
|
12270
12567
|
renderer: renderers.row,
|
@@ -12278,43 +12575,6 @@ function useTableRenderer(renderers, table, tableRef, defaultRowActiveIndex, opt
|
|
12278
12575
|
scrollToIndex
|
12279
12576
|
};
|
12280
12577
|
}
|
12281
|
-
// support varying row heights - variable row heights, row expansion
|
12282
|
-
function useRowHeightVirtualisation(table) {
|
12283
|
-
const tableMeta = table.options.meta;
|
12284
|
-
const rows = table.getRowModel().rows;
|
12285
|
-
const expandedState = table.getState().expanded;
|
12286
|
-
const [expandedRowHeightsCache, setExpandedRowHeightsCache] = React__default.useState({});
|
12287
|
-
// look at all registered expanded row heights and use them to form a more accurate average size
|
12288
|
-
// it might be worth considering if taking the max, or an upper bound, would be better
|
12289
|
-
const averageExpandedRowHeight = React__default.useMemo(() => {
|
12290
|
-
const values = Object.values(expandedRowHeightsCache);
|
12291
|
-
return values.length ? values.reduce((a, b) => a + b, 0) / values.length : 0;
|
12292
|
-
}, [expandedRowHeightsCache]);
|
12293
|
-
// row heights
|
12294
|
-
const estimateSize = React__default.useCallback(index => {
|
12295
|
-
var _rows$index, _rows$index$getIsExpa;
|
12296
|
-
const rowHeight = tableMeta.rowHeight.height ? ROW_HEIGHT_ESTIMATES[tableMeta.rowHeight.height] : ROW_HEIGHT_ESTIMATES.medium;
|
12297
|
-
if (expandedState === true || (_rows$index = rows[index]) !== null && _rows$index !== void 0 && (_rows$index$getIsExpa = _rows$index.getIsExpanded) !== null && _rows$index$getIsExpa !== void 0 && _rows$index$getIsExpa.call(_rows$index)) {
|
12298
|
-
return rowHeight + averageExpandedRowHeight;
|
12299
|
-
}
|
12300
|
-
return rowHeight;
|
12301
|
-
}, [tableMeta.rowHeight.height, averageExpandedRowHeight, expandedState]);
|
12302
|
-
const createRowMeasurer = React__default.useCallback((resizeItem, virtualRow) => (rowHeight, expansionHeight) => {
|
12303
|
-
// register the expansion height so that it can be used to determine an average
|
12304
|
-
if (expansionHeight) {
|
12305
|
-
setExpandedRowHeightsCache(cache => ({
|
12306
|
-
...cache,
|
12307
|
-
[virtualRow.index]: expansionHeight
|
12308
|
-
}));
|
12309
|
-
}
|
12310
|
-
// update the whole row's size to include the expanded height
|
12311
|
-
resizeItem(virtualRow, rowHeight + (expansionHeight !== null && expansionHeight !== void 0 ? expansionHeight : 0));
|
12312
|
-
}, []);
|
12313
|
-
return {
|
12314
|
-
estimateSize,
|
12315
|
-
createRowMeasurer
|
12316
|
-
};
|
12317
|
-
}
|
12318
12578
|
// support virtualised row groups (where the row group headers are sticky)
|
12319
12579
|
function useRowGroupVirtualisation(table) {
|
12320
12580
|
const rows = table.getRowModel().rows;
|
@@ -12371,8 +12631,9 @@ function Actions$1(props) {
|
|
12371
12631
|
const {
|
12372
12632
|
texts
|
12373
12633
|
} = useLocalization();
|
12634
|
+
const tableMeta = table.options.meta;
|
12374
12635
|
// we don't want to document passing table, so it isn't on the type
|
12375
|
-
const visibleActions = actions.map(action => action(data, rowId, table)).filter(action => !!action);
|
12636
|
+
const visibleActions = actions.map(action => action(data, rowId, tableMeta.rowActions.handlers['cleanup'], table)).filter(action => !!action);
|
12376
12637
|
const actionsOnRow = visibleActions.length === actionsLength ? visibleActions : visibleActions.slice(0, actionsLength - 1);
|
12377
12638
|
const actionsInMenu = visibleActions.slice(visibleActions.length === actionsLength ? actionsLength : actionsLength - 1);
|
12378
12639
|
const className = cn('flex justify-end text-right bg-[inherit] shadow-[-6px_0px_6px_var(--table-row-actions-shadow)] print:hidden');
|
@@ -12411,9 +12672,9 @@ const Cell = /*#__PURE__*/React__default.memo(function MemoedCell(context) {
|
|
12411
12672
|
table
|
12412
12673
|
} = context;
|
12413
12674
|
const {
|
12675
|
+
hideRowActions,
|
12414
12676
|
isHovered,
|
12415
|
-
rowIndex
|
12416
|
-
hideRowActions
|
12677
|
+
rowIndex
|
12417
12678
|
} = React__default.useContext(RowContext);
|
12418
12679
|
const tableMeta = table.options.meta;
|
12419
12680
|
const actions = tableMeta.rowActions.rowActions;
|
@@ -12453,6 +12714,12 @@ function Cell$1() {
|
|
12453
12714
|
const {
|
12454
12715
|
texts
|
12455
12716
|
} = useLocalization();
|
12717
|
+
const {
|
12718
|
+
hideInternalColumns
|
12719
|
+
} = React__default.useContext(RowContext);
|
12720
|
+
if (hideInternalColumns) {
|
12721
|
+
return null;
|
12722
|
+
}
|
12456
12723
|
return /*#__PURE__*/React__default.createElement(Icon, {
|
12457
12724
|
"aria-label": texts.table.columns.drag.tooltip,
|
12458
12725
|
name: "drag",
|
@@ -12480,6 +12747,10 @@ function Header$3(context) {
|
|
12480
12747
|
const {
|
12481
12748
|
table
|
12482
12749
|
} = context;
|
12750
|
+
const tableMeta = table.options.meta;
|
12751
|
+
if (!tableMeta.rowExpansion.canExpandAll) {
|
12752
|
+
return null;
|
12753
|
+
}
|
12483
12754
|
const isSomeRowsExpanded = table.getIsSomeRowsExpanded();
|
12484
12755
|
const handleClick = event => {
|
12485
12756
|
event.stopPropagation();
|
@@ -12501,7 +12772,13 @@ function Cell$2(context) {
|
|
12501
12772
|
const {
|
12502
12773
|
texts
|
12503
12774
|
} = useLocalization();
|
12775
|
+
const {
|
12776
|
+
hideInternalColumns
|
12777
|
+
} = React__default.useContext(RowContext);
|
12504
12778
|
const tableMeta = context.table.options.meta;
|
12779
|
+
if (hideInternalColumns) {
|
12780
|
+
return null;
|
12781
|
+
}
|
12505
12782
|
const hasExpandedRow = (_tableMeta$rowExpansi = (_tableMeta$rowExpansi2 = tableMeta.rowExpansion).rowExpansionRenderer) === null || _tableMeta$rowExpansi === void 0 ? void 0 : _tableMeta$rowExpansi.call(_tableMeta$rowExpansi2, context.row.original);
|
12506
12783
|
if (hasExpandedRow) {
|
12507
12784
|
const isActiveRow = tableMeta.rowActive.rowActiveIndex === context.row.index;
|
@@ -12555,8 +12832,9 @@ function Header$4(context) {
|
|
12555
12832
|
}
|
12556
12833
|
const _temp = function () {
|
12557
12834
|
if (tableMeta.server.loadAllIfNeeded) {
|
12835
|
+
const hiddenColumns = getHiddenColumns(table.getState().columnVisibility);
|
12558
12836
|
// don't pass the search query because we need all data - not filtered data
|
12559
|
-
return Promise.resolve(tableMeta.server.loadAllIfNeeded(table.getState().sorting, table.getState().columnFilters)).then(function () {});
|
12837
|
+
return Promise.resolve(tableMeta.server.loadAllIfNeeded(table.getState().sorting, table.getState().columnFilters, hiddenColumns, tableMeta.search.enableGlobalFilter ? table.getState().globalFilter : undefined)).then(function () {});
|
12560
12838
|
}
|
12561
12839
|
}();
|
12562
12840
|
// load all data if that is possible
|
@@ -12572,7 +12850,7 @@ function Header$4(context) {
|
|
12572
12850
|
className: "hover:border-blue !-mt-px",
|
12573
12851
|
checked: isAllRowsSelected,
|
12574
12852
|
indeterminate: isSomeRowsSelected && !isAllRowsSelected,
|
12575
|
-
loading: tableMeta.server.
|
12853
|
+
loading: tableMeta.server.loading,
|
12576
12854
|
onChange: handleChange
|
12577
12855
|
}));
|
12578
12856
|
}
|
@@ -12591,10 +12869,11 @@ function Cell$3(context) {
|
|
12591
12869
|
table
|
12592
12870
|
} = context;
|
12593
12871
|
const {
|
12872
|
+
hideInternalColumns,
|
12594
12873
|
rowIndex
|
12595
12874
|
} = React__default.useContext(RowContext);
|
12596
12875
|
const tableMeta = table.options.meta;
|
12597
|
-
if (table.options.enableGrouping && (_table$getState$group = table.getState().grouping) !== null && _table$getState$group !== void 0 && _table$getState$group.length && !row.getIsGrouped()) {
|
12876
|
+
if (hideInternalColumns || table.options.enableGrouping && (_table$getState$group = table.getState().grouping) !== null && _table$getState$group !== void 0 && _table$getState$group.length && !row.getIsGrouped()) {
|
12598
12877
|
return null;
|
12599
12878
|
}
|
12600
12879
|
const isSelected = row.getIsGrouped() ? row.getIsAllSubRowsSelected() : row.getIsSelected();
|
@@ -12614,6 +12893,7 @@ function Cell$3(context) {
|
|
12614
12893
|
if (event.shiftKey) {
|
12615
12894
|
var _tableMeta$rowSelecti;
|
12616
12895
|
function _temp4() {
|
12896
|
+
const selectedRows = table.getRowModel().rows.slice(fromIndex, toIndex + 1);
|
12617
12897
|
table.setRowSelection(currentRowSelection => ({
|
12618
12898
|
...currentRowSelection,
|
12619
12899
|
...selectedRows.filter(row => row.getCanSelect()).reduce((state, row) => ({
|
@@ -12623,11 +12903,11 @@ function Cell$3(context) {
|
|
12623
12903
|
}));
|
12624
12904
|
}
|
12625
12905
|
const [fromIndex, toIndex] = toggleBetween((_tableMeta$rowSelecti = tableMeta.rowSelection.lastSelectedRowIndex.current) !== null && _tableMeta$rowSelecti !== void 0 ? _tableMeta$rowSelecti : 0, rowIndex);
|
12626
|
-
const selectedRows = table.getRowModel().rows.slice(fromIndex, toIndex + 1);
|
12627
12906
|
const _temp3 = function () {
|
12628
|
-
if (tableMeta.server.loadAllIfNeeded
|
12907
|
+
if (tableMeta.server.loadAllIfNeeded) {
|
12908
|
+
const hiddenColumns = getHiddenColumns(table.getState().columnVisibility);
|
12629
12909
|
// don't pass the search query because we need all data - not filtered data
|
12630
|
-
return Promise.resolve(tableMeta.server.loadAllIfNeeded(table.getState().sorting, table.getState().columnFilters)).then(function () {});
|
12910
|
+
return Promise.resolve(tableMeta.server.loadAllIfNeeded(table.getState().sorting, table.getState().columnFilters, hiddenColumns, tableMeta.search.enableGlobalFilter ? table.getState().globalFilter : undefined)).then(function () {});
|
12631
12911
|
}
|
12632
12912
|
}();
|
12633
12913
|
return _temp3 && _temp3.then ? _temp3.then(_temp4) : _temp4(_temp3);
|
@@ -12685,7 +12965,7 @@ function useTable(props, externalRef, renderers, meta, options) {
|
|
12685
12965
|
// configure the table
|
12686
12966
|
const manager = useTableManager(props, meta, INTERNAL_RENDERERS);
|
12687
12967
|
// configure the virtualised renderer
|
12688
|
-
const renderer = useTableRenderer(renderers, manager.instance, ref, props.defaultRowActiveIndex, options);
|
12968
|
+
const renderer = useTableRenderer(renderers, manager.instance, ref, manager.meta.length, props.defaultRowActiveIndex, options);
|
12689
12969
|
// configure dynamic styling
|
12690
12970
|
const {
|
12691
12971
|
style,
|
@@ -12905,7 +13185,7 @@ const DisplayRow = /*#__PURE__*/React__default.memo(function DisplayRow(props) {
|
|
12905
13185
|
if (tableMeta.rowActive.isEnabled) {
|
12906
13186
|
attributes['data-row-active'] = tableMeta.rowActive.rowActiveIndex === index ? true : undefined;
|
12907
13187
|
// we use capture because it let's us picks up clicks on components inside the row, e.g. checkboxes
|
12908
|
-
attributes.
|
13188
|
+
attributes.onClickCapture = handleClickCapture;
|
12909
13189
|
}
|
12910
13190
|
// row click
|
12911
13191
|
if (tableMeta.rowClick.isEnabled(row.original)) {
|
@@ -12981,8 +13261,12 @@ const DisplayRow = /*#__PURE__*/React__default.memo(function DisplayRow(props) {
|
|
12981
13261
|
}
|
12982
13262
|
const ref = React__default.useRef(null);
|
12983
13263
|
const expansionRef = React__default.useRef(null);
|
12984
|
-
|
12985
|
-
|
13264
|
+
React__default.useEffect(() => {
|
13265
|
+
var _ref$current$getBound, _ref$current, _expansionRef$current, _expansionRef$current2;
|
13266
|
+
const rowHeight = (_ref$current$getBound = (_ref$current = ref.current) === null || _ref$current === void 0 ? void 0 : _ref$current.getBoundingClientRect().height) !== null && _ref$current$getBound !== void 0 ? _ref$current$getBound : 0;
|
13267
|
+
const expansionHeight = (_expansionRef$current = (_expansionRef$current2 = expansionRef.current) === null || _expansionRef$current2 === void 0 ? void 0 : _expansionRef$current2.getBoundingClientRect().height) !== null && _expansionRef$current !== void 0 ? _expansionRef$current : 0;
|
13268
|
+
measureRow(rowHeight + expansionHeight);
|
13269
|
+
}, [expansionRef.current]);
|
12986
13270
|
const className = cn('group/row', otherAttributes.className, {
|
12987
13271
|
'hover:cursor-grab': tableMeta.rowDrag.isEnabled && typeof attributes.onClick !== 'function',
|
12988
13272
|
'hover:cursor-pointer': typeof attributes.onClick === 'function'
|
@@ -13005,18 +13289,6 @@ const DisplayRow = /*#__PURE__*/React__default.memo(function DisplayRow(props) {
|
|
13005
13289
|
className: "col-span-full"
|
13006
13290
|
}, expandedRow))) : null);
|
13007
13291
|
});
|
13008
|
-
function useSetVirtualisedRowHeight(measureRow, rowEl, expansionEl, isExpanded) {
|
13009
|
-
React__default.useEffect(() => {
|
13010
|
-
if (rowEl) {
|
13011
|
-
const height = rowEl.getBoundingClientRect().height;
|
13012
|
-
if (isExpanded && expansionEl) {
|
13013
|
-
measureRow(height, expansionEl.getBoundingClientRect().height);
|
13014
|
-
} else {
|
13015
|
-
measureRow(height);
|
13016
|
-
}
|
13017
|
-
}
|
13018
|
-
}, [isExpanded, rowEl, expansionEl]);
|
13019
|
-
}
|
13020
13292
|
|
13021
13293
|
function DisplayCell(props) {
|
13022
13294
|
const {
|
@@ -13418,6 +13690,21 @@ function getIsPinned(header) {
|
|
13418
13690
|
return (_header$subHeaders = header.subHeaders) !== null && _header$subHeaders !== void 0 && _header$subHeaders.length ? (_header$subHeaders$fi = header.subHeaders.find(x => x.column.getIsPinned())) === null || _header$subHeaders$fi === void 0 ? void 0 : _header$subHeaders$fi.column.getIsPinned() : header.column.getIsPinned();
|
13419
13691
|
}
|
13420
13692
|
|
13693
|
+
const HeaderContent = ({
|
13694
|
+
children,
|
13695
|
+
tooltip,
|
13696
|
+
isInternalColumnHeader
|
13697
|
+
}) => {
|
13698
|
+
if (isInternalColumnHeader || typeof children !== 'string') {
|
13699
|
+
return /*#__PURE__*/React__default.createElement(React__default.Fragment, null, children);
|
13700
|
+
}
|
13701
|
+
return /*#__PURE__*/React__default.createElement(Tooltip, {
|
13702
|
+
title: String(tooltip !== null && tooltip !== void 0 ? tooltip : children),
|
13703
|
+
placement: "top"
|
13704
|
+
}, /*#__PURE__*/React__default.createElement("span", {
|
13705
|
+
className: "truncate"
|
13706
|
+
}, children));
|
13707
|
+
};
|
13421
13708
|
function Header$5(props) {
|
13422
13709
|
var _header$column$column;
|
13423
13710
|
const {
|
@@ -13587,12 +13874,11 @@ const MemoedHeader = /*#__PURE__*/React__default.memo(function MemoedHeader(prop
|
|
13587
13874
|
"data-cell-pinned": isPinned ? isPinned : undefined,
|
13588
13875
|
style: style,
|
13589
13876
|
ref: setRef
|
13590
|
-
}), isPlaceholder ?
|
13591
|
-
|
13592
|
-
|
13593
|
-
|
13594
|
-
|
13595
|
-
}, children))), sortDirection ? /*#__PURE__*/React__default.createElement(SortIndicator, {
|
13877
|
+
}), !isPlaceholder ? (/*#__PURE__*/React__default.createElement(HeaderContent, {
|
13878
|
+
children: children,
|
13879
|
+
tooltip: tooltip,
|
13880
|
+
isInternalColumnHeader: !!isInternalColumn(id)
|
13881
|
+
})) : null, sortDirection ? /*#__PURE__*/React__default.createElement(SortIndicator, {
|
13596
13882
|
direction: sortDirection
|
13597
13883
|
}) : null, hasMenu ? (/*#__PURE__*/React__default.createElement(HeaderMenu, {
|
13598
13884
|
canFilter: canFilter,
|
@@ -13740,6 +14026,8 @@ function Body(props) {
|
|
13740
14026
|
onKeyDown: handleKeyDown,
|
13741
14027
|
onMouseLeave: handleMouseLeave,
|
13742
14028
|
onMouseMove: handleMouseMove,
|
14029
|
+
// Prevents menu dropdowns inside the row from being closed straight after being opened, wehn clicked on a menu trigger
|
14030
|
+
onFocus: e => e.stopPropagation(),
|
13743
14031
|
ref: ref
|
13744
14032
|
}));
|
13745
14033
|
}
|
@@ -13753,21 +14041,22 @@ function Summary(props) {
|
|
13753
14041
|
locale,
|
13754
14042
|
texts
|
13755
14043
|
} = useLocalization();
|
13756
|
-
const
|
14044
|
+
const tableMeta = table.options.meta;
|
14045
|
+
const length = tableMeta.length;
|
13757
14046
|
const currentLength = table.getRowModel().rows.length;
|
13758
14047
|
let label;
|
13759
14048
|
let count;
|
13760
14049
|
// row selection
|
13761
|
-
|
14050
|
+
// use table state and not the selected row model because of the way server loading works
|
14051
|
+
const rowsSelectedLength = Object.keys(table.getState().rowSelection).length;
|
13762
14052
|
if (rowsSelectedLength > 0) {
|
13763
14053
|
label = texts.table.footer.summary.selected;
|
13764
14054
|
count = /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement("strong", null, new Intl.NumberFormat(locale).format(rowsSelectedLength)), "\u00A0", texts.table.footer.summary.count, "\u00A0", /*#__PURE__*/React__default.createElement("strong", null, new Intl.NumberFormat(locale).format(length)));
|
13765
|
-
} else if ((_table$getState$colum = table.getState().columnFilters) !== null && _table$getState$colum !== void 0 && _table$getState$colum.length ||
|
14055
|
+
} else if (!tableMeta.server.isEnabled && ((_table$getState$colum = table.getState().columnFilters) !== null && _table$getState$colum !== void 0 && _table$getState$colum.length ||
|
13766
14056
|
// filtered data
|
13767
|
-
!!table.getState().globalFilter && table.options.enableGlobalFilter
|
13768
|
-
) {
|
14057
|
+
!!table.getState().globalFilter && table.options.enableGlobalFilter)) {
|
13769
14058
|
label = texts.table.footer.summary.records;
|
13770
|
-
count = /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement("strong", null, currentLength), "\u00A0", texts.table.footer.summary.count, "\u00A0", /*#__PURE__*/React__default.createElement("strong", null, new Intl.NumberFormat(locale).format(length)));
|
14059
|
+
count = /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement("strong", null, new Intl.NumberFormat(locale).format(currentLength)), "\u00A0", texts.table.footer.summary.count, "\u00A0", /*#__PURE__*/React__default.createElement("strong", null, new Intl.NumberFormat(locale).format(length)));
|
13771
14060
|
} else {
|
13772
14061
|
label = texts.table.footer.summary.records;
|
13773
14062
|
count = /*#__PURE__*/React__default.createElement("strong", null, new Intl.NumberFormat(locale).format(length));
|
@@ -13779,24 +14068,39 @@ function Summary(props) {
|
|
13779
14068
|
}
|
13780
14069
|
|
13781
14070
|
function Foot(props) {
|
13782
|
-
|
13783
|
-
|
14071
|
+
var _nonGroupedHeaders$fi;
|
14072
|
+
const {
|
14073
|
+
children,
|
14074
|
+
table,
|
14075
|
+
...attributes
|
14076
|
+
} = props;
|
14077
|
+
const tableMeta = table.options.meta;
|
14078
|
+
const nonGroupedHeaders = table.getFooterGroups()[0].headers.filter(header => !header.column.getIsGrouped());
|
14079
|
+
const firstVisibleExternalColumnIndex = (_nonGroupedHeaders$fi = nonGroupedHeaders.find(header => {
|
14080
|
+
var _header$column$column;
|
14081
|
+
return !isInternalColumn(header.id) && ((_header$column$column = header.column.columnDef.meta) === null || _header$column$column === void 0 ? void 0 : _header$column$column.enablePrinting) !== false;
|
14082
|
+
})) === null || _nonGroupedHeaders$fi === void 0 ? void 0 : _nonGroupedHeaders$fi.index;
|
14083
|
+
// During printing, the summary should be displayed in the first visible external column,
|
14084
|
+
// as internal and hidden columns are excluded from the printed document.
|
14085
|
+
// However, in the normal table view, the summary should appear in the first column.
|
14086
|
+
const summaryColumnIndex = tableMeta.printing.isPrinting ? firstVisibleExternalColumnIndex : 0;
|
14087
|
+
return /*#__PURE__*/React__default.createElement("tfoot", Object.assign({}, attributes), children, /*#__PURE__*/React__default.createElement("tr", null, nonGroupedHeaders.map((header, index) => (/*#__PURE__*/React__default.createElement(Footer$3, {
|
13784
14088
|
key: header.id,
|
13785
14089
|
header: header,
|
13786
|
-
|
14090
|
+
showSummary: index === summaryColumnIndex
|
13787
14091
|
})))));
|
13788
14092
|
}
|
13789
14093
|
function Footer$3(props) {
|
13790
14094
|
return /*#__PURE__*/React__default.createElement(MemoedFooter, {
|
13791
14095
|
footer: props.header,
|
13792
|
-
|
14096
|
+
showSummary: props.showSummary
|
13793
14097
|
});
|
13794
14098
|
}
|
13795
14099
|
const MemoedFooter = /*#__PURE__*/React__default.memo(function MemoedFooter(props) {
|
13796
14100
|
var _footer$subHeaders, _footer$subHeaders$fi;
|
13797
14101
|
const {
|
13798
14102
|
footer,
|
13799
|
-
|
14103
|
+
showSummary
|
13800
14104
|
} = props;
|
13801
14105
|
const columnMeta = footer.column.columnDef.meta;
|
13802
14106
|
// getIsPinned returns true for split header groups, even if the split group has no pinned sub headers
|
@@ -13809,7 +14113,8 @@ const MemoedFooter = /*#__PURE__*/React__default.memo(function MemoedFooter(prop
|
|
13809
14113
|
}
|
13810
14114
|
let content;
|
13811
14115
|
let align;
|
13812
|
-
|
14116
|
+
// Summary should only be appended to the first visible external column, as internal columns like the select column will be hidden in the print view.
|
14117
|
+
if (showSummary) {
|
13813
14118
|
align = 'left';
|
13814
14119
|
content = /*#__PURE__*/React__default.createElement(Summary, {
|
13815
14120
|
table: footer.getContext().table
|
@@ -13828,16 +14133,29 @@ const MemoedFooter = /*#__PURE__*/React__default.memo(function MemoedFooter(prop
|
|
13828
14133
|
});
|
13829
14134
|
|
13830
14135
|
function EmptyStateBody(props) {
|
14136
|
+
var _ref$current, _ref$current$parentNo;
|
13831
14137
|
const {
|
13832
14138
|
emptyState: Placeholder,
|
14139
|
+
isReady,
|
13833
14140
|
reason,
|
13834
14141
|
...attributes
|
13835
14142
|
} = props;
|
14143
|
+
const ref = React__default.useRef(null);
|
14144
|
+
if (!isReady) {
|
14145
|
+
return /*#__PURE__*/React__default.createElement("tbody", Object.assign({}, attributes, {
|
14146
|
+
className: "!auto-rows-fr"
|
14147
|
+
}));
|
14148
|
+
}
|
13836
14149
|
return /*#__PURE__*/React__default.createElement("tbody", Object.assign({}, attributes, {
|
13837
|
-
|
14150
|
+
ref: ref,
|
14151
|
+
className: "!auto-rows-fr",
|
14152
|
+
"data-taco": "empty-state"
|
13838
14153
|
}), /*#__PURE__*/React__default.createElement("tr", {
|
13839
|
-
className: "!auto-rows-fr"
|
14154
|
+
className: "!auto-rows-fr "
|
13840
14155
|
}, /*#__PURE__*/React__default.createElement("td", {
|
14156
|
+
style: {
|
14157
|
+
maxWidth: ref === null || ref === void 0 ? void 0 : (_ref$current = ref.current) === null || _ref$current === void 0 ? void 0 : (_ref$current$parentNo = _ref$current.parentNode) === null || _ref$current$parentNo === void 0 ? void 0 : _ref$current$parentNo.clientWidth
|
14158
|
+
},
|
13841
14159
|
className: "col-span-full !border-0 !p-0 hover:!bg-white"
|
13842
14160
|
}, Placeholder ? /*#__PURE__*/React__default.createElement(Placeholder, {
|
13843
14161
|
reason: reason
|
@@ -13856,6 +14174,7 @@ const SearchInput2 = /*#__PURE__*/React__default.forwardRef(function SearchInput
|
|
13856
14174
|
onClickFindPrevious: handleClickFindPrevious,
|
13857
14175
|
settingsContent,
|
13858
14176
|
shortcut,
|
14177
|
+
showTotal = true,
|
13859
14178
|
value,
|
13860
14179
|
...attributes
|
13861
14180
|
} = props;
|
@@ -13934,10 +14253,12 @@ const SearchInput2 = /*#__PURE__*/React__default.forwardRef(function SearchInput
|
|
13934
14253
|
}
|
13935
14254
|
if (hasFind && isActive) {
|
13936
14255
|
postfix = /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement("span", {
|
13937
|
-
className: "text-grey-700 flex h-4 items-center
|
13938
|
-
}, loading ? /*#__PURE__*/React__default.createElement(Spinner, {
|
14256
|
+
className: "text-grey-700 flex h-4 items-center"
|
14257
|
+
}, loading ? (/*#__PURE__*/React__default.createElement(Spinner, {
|
13939
14258
|
className: "h-4 w-4"
|
13940
|
-
}) :
|
14259
|
+
})) : showTotal ? (/*#__PURE__*/React__default.createElement("span", {
|
14260
|
+
className: "border-r border-black/[0.25] pr-2"
|
14261
|
+
}, `${findCurrent !== null && findCurrent !== void 0 ? findCurrent : 0}/${findTotal !== null && findTotal !== void 0 ? findTotal : 0}`)) : null), findCurrent ? (/*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement(IconButton, {
|
13941
14262
|
"aria-label": texts.searchInput.findPrevious,
|
13942
14263
|
className: "scale-75 !bg-transparent hover:!bg-black/[0.08] [&>svg]:scale-125",
|
13943
14264
|
icon: "chevron-up",
|
@@ -14041,6 +14362,7 @@ function Search$1(props) {
|
|
14041
14362
|
const scrollTo = rowIndex => scrollToIndex(rowIndex, {
|
14042
14363
|
align: 'center'
|
14043
14364
|
});
|
14365
|
+
const hiddenColumns = getHiddenColumns(table.getState().columnVisibility);
|
14044
14366
|
React__default.useEffect(() => {
|
14045
14367
|
if (tableMeta.search.highlightedColumnIndexes.length) {
|
14046
14368
|
scrollTo(tableMeta.search.highlightedColumnIndexes[0][0]);
|
@@ -14049,9 +14371,11 @@ function Search$1(props) {
|
|
14049
14371
|
const handleFocus = function () {
|
14050
14372
|
try {
|
14051
14373
|
const _temp = function () {
|
14052
|
-
if (tableMeta.server.loadAllIfNeeded) {
|
14374
|
+
if (tableMeta.server.loadAllIfNeeded && !tableMeta.server._experimentalDataLoader2) {
|
14053
14375
|
// don't pass the search query because we need all data - not filtered data
|
14054
|
-
return Promise.resolve(tableMeta.server.loadAllIfNeeded(table.getState().sorting, table.getState().columnFilters
|
14376
|
+
return Promise.resolve(tableMeta.server.loadAllIfNeeded(table.getState().sorting, table.getState().columnFilters, hiddenColumns,
|
14377
|
+
// the old data loader doesn't have server side search
|
14378
|
+
undefined)).then(function () {});
|
14055
14379
|
}
|
14056
14380
|
}();
|
14057
14381
|
// load all data if that is possible
|
@@ -14060,8 +14384,20 @@ function Search$1(props) {
|
|
14060
14384
|
return Promise.reject(e);
|
14061
14385
|
}
|
14062
14386
|
};
|
14387
|
+
const [loading, setLoading] = React__default.useState(false);
|
14388
|
+
const searchTimeoutRef = React__default.useRef();
|
14063
14389
|
const handleChange = query => {
|
14064
14390
|
table.setGlobalFilter(String(query !== null && query !== void 0 ? query : ''));
|
14391
|
+
if (tableMeta.search.enableGlobalFilter && tableMeta.search.handleSearch) {
|
14392
|
+
clearTimeout(searchTimeoutRef.current);
|
14393
|
+
searchTimeoutRef.current = setTimeout(() => {
|
14394
|
+
var _tableMeta$search$han, _tableMeta$search;
|
14395
|
+
setLoading(true);
|
14396
|
+
(_tableMeta$search$han = (_tableMeta$search = tableMeta.search).handleSearch) === null || _tableMeta$search$han === void 0 ? void 0 : _tableMeta$search$han.call(_tableMeta$search, query, hiddenColumns).then(() => {
|
14397
|
+
setLoading(false);
|
14398
|
+
});
|
14399
|
+
}, 150);
|
14400
|
+
}
|
14065
14401
|
};
|
14066
14402
|
const handleToggleExcludeUnmatchedResults = enabled => {
|
14067
14403
|
tableMeta.search.setEnableGlobalFilter(enabled, table);
|
@@ -14069,6 +14405,12 @@ function Search$1(props) {
|
|
14069
14405
|
var _ref$current;
|
14070
14406
|
return (_ref$current = ref.current) === null || _ref$current === void 0 ? void 0 : _ref$current.focus();
|
14071
14407
|
});
|
14408
|
+
if (tableMeta.search.handleSearch) {
|
14409
|
+
setLoading(true);
|
14410
|
+
tableMeta.search.handleSearch(enabled ? query : undefined, hiddenColumns).then(() => {
|
14411
|
+
setLoading(false);
|
14412
|
+
});
|
14413
|
+
}
|
14072
14414
|
};
|
14073
14415
|
const handleNextResult = () => {
|
14074
14416
|
if (!tableMeta.search.highlightedColumnIndexes.length) {
|
@@ -14112,7 +14454,7 @@ function Search$1(props) {
|
|
14112
14454
|
return /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement(SearchInput2, {
|
14113
14455
|
findCurrent: tableMeta.search.currentHighlightColumnIndex !== undefined ? tableMeta.search.currentHighlightColumnIndex + 1 : null,
|
14114
14456
|
findTotal: (_tableMeta$search$hig = (_tableMeta$search$hig2 = tableMeta.search.highlightedColumnIndexes) === null || _tableMeta$search$hig2 === void 0 ? void 0 : _tableMeta$search$hig2.length) !== null && _tableMeta$search$hig !== void 0 ? _tableMeta$search$hig : null,
|
14115
|
-
loading: tableMeta.server.
|
14457
|
+
loading: tableMeta.server._experimentalDataLoader2 ? loading : tableMeta.server.loading,
|
14116
14458
|
name: "table-search",
|
14117
14459
|
onClickFindPrevious: handlePreviousResult,
|
14118
14460
|
onClickFindNext: handleNextResult,
|
@@ -14127,6 +14469,7 @@ function Search$1(props) {
|
|
14127
14469
|
meta: true,
|
14128
14470
|
shift: false
|
14129
14471
|
},
|
14472
|
+
showTotal: !tableMeta.server._experimentalDataLoader2,
|
14130
14473
|
value: query
|
14131
14474
|
}));
|
14132
14475
|
}
|
@@ -14159,7 +14502,7 @@ function Container(externalProps) {
|
|
14159
14502
|
if (!(activeList !== null && activeList !== void 0 && activeList.id) || !(overList !== null && overList !== void 0 && overList.id) || activeList.id === overList.id) {
|
14160
14503
|
return;
|
14161
14504
|
}
|
14162
|
-
move
|
14505
|
+
move(active.id, activeList === null || activeList === void 0 ? void 0 : activeList.id, overList.id);
|
14163
14506
|
}
|
14164
14507
|
function handleDragEnd(event) {
|
14165
14508
|
const {
|
@@ -14480,9 +14823,11 @@ const Root = /*#__PURE__*/React__default.forwardRef(function CollectionRoot(prop
|
|
14480
14823
|
var _collection$querySele;
|
14481
14824
|
(_collection$querySele = collection.querySelector(`[aria-current]`)) === null || _collection$querySele === void 0 ? void 0 : _collection$querySele.removeAttribute('aria-current');
|
14482
14825
|
option.setAttribute('aria-current', 'true');
|
14483
|
-
|
14484
|
-
|
14485
|
-
|
14826
|
+
if (!props['aria-multiselectable']) {
|
14827
|
+
option.scrollIntoView({
|
14828
|
+
block: 'nearest'
|
14829
|
+
});
|
14830
|
+
}
|
14486
14831
|
setActiveIndex(index);
|
14487
14832
|
};
|
14488
14833
|
const setActiveIndexByElement = React__default.useCallback(option => {
|
@@ -14804,14 +15149,16 @@ const Tag$1 = /*#__PURE__*/React__default.forwardRef((props, ref) => {
|
|
14804
15149
|
ref: ref,
|
14805
15150
|
"data-taco": "tag"
|
14806
15151
|
}), /*#__PURE__*/React__default.createElement("span", {
|
14807
|
-
className: "truncate px-2",
|
15152
|
+
className: "flex items-center truncate px-2",
|
14808
15153
|
ref: textRef
|
14809
15154
|
}, icon ? typeof icon === 'string' ? (/*#__PURE__*/React__default.createElement(Icon, {
|
14810
15155
|
name: icon,
|
14811
|
-
className: "-ml-1
|
15156
|
+
className: "-ml-1 mr-1 !h-5 !w-5"
|
14812
15157
|
})) : (/*#__PURE__*/React__default.cloneElement(icon, {
|
14813
|
-
className: 'mr-1 -ml-1
|
14814
|
-
})) : null,
|
15158
|
+
className: cn(icon.props.className, 'mr-1 -ml-1')
|
15159
|
+
})) : null, /*#__PURE__*/React__default.createElement("span", {
|
15160
|
+
className: "truncate"
|
15161
|
+
}, children)), onDelete ? (/*#__PURE__*/React__default.createElement(Icon, {
|
14815
15162
|
name: "close",
|
14816
15163
|
onClick: onDelete,
|
14817
15164
|
className: "-ml-1.5 !h-6 !w-5 flex-shrink-0 cursor-pointer rounded-r p-0.5 hover:bg-black/5"
|
@@ -15088,12 +15435,13 @@ const Option$1 = /*#__PURE__*/React__default.forwardRef(function Select2Option(p
|
|
15088
15435
|
}), hasValue ? (/*#__PURE__*/React__default.createElement(Icon, {
|
15089
15436
|
name: "tick",
|
15090
15437
|
className: "pointer-events-none invisible -mx-0.5 !h-4 !w-4 group-aria-selected:visible"
|
15091
|
-
})) : null, isTag ? (/*#__PURE__*/React__default.createElement(Tag$1, {
|
15438
|
+
})) : null, typeof children !== 'string' ? (/*#__PURE__*/React__default.createElement("span", null, children)) : isTag ? (/*#__PURE__*/React__default.createElement(Tag$1, {
|
15092
15439
|
className: "pointer-events-none my-1",
|
15093
15440
|
color: color,
|
15094
15441
|
icon: prefix
|
15095
15442
|
}, children)) : (/*#__PURE__*/React__default.createElement(React__default.Fragment, null, prefix ? typeof prefix === 'string' ? /*#__PURE__*/React__default.createElement(Icon, {
|
15096
|
-
name: prefix
|
15443
|
+
name: prefix,
|
15444
|
+
className: "!h-5 !w-5"
|
15097
15445
|
}) : prefix : null, /*#__PURE__*/React__default.createElement("span", {
|
15098
15446
|
className: "flex w-full justify-between"
|
15099
15447
|
}, /*#__PURE__*/React__default.createElement("span", {
|
@@ -15102,9 +15450,10 @@ const Option$1 = /*#__PURE__*/React__default.forwardRef(function Select2Option(p
|
|
15102
15450
|
className: "text-grey-700 -mt-1.5 mb-1.5 text-xs"
|
15103
15451
|
}, description) : null), /*#__PURE__*/React__default.createElement("span", {
|
15104
15452
|
className: "flex flex-col self-center"
|
15105
|
-
}, postfix ? typeof postfix === 'string' ? /*#__PURE__*/React__default.createElement(Icon, {
|
15106
|
-
name: postfix
|
15107
|
-
|
15453
|
+
}, postfix ? typeof postfix === 'string' ? (/*#__PURE__*/React__default.createElement(Icon, {
|
15454
|
+
name: postfix,
|
15455
|
+
className: "!h-5 !w-5"
|
15456
|
+
})) : postfix : null)))), popover ? (/*#__PURE__*/React__default.createElement(IconButton, {
|
15108
15457
|
icon: "ellipsis-vertical",
|
15109
15458
|
appearance: "discrete",
|
15110
15459
|
className: cn('group-aria-current:visible invisible -mr-1 ml-auto !h-5 min-h-[theme(spacing.6)] !w-5 min-w-[theme(spacing.6)] hover:!bg-black/[.08] focus:!shadow-none group-hover:visible', {
|
@@ -15270,7 +15619,7 @@ const Single = /*#__PURE__*/React__default.forwardRef(function Select2TriggerSin
|
|
15270
15619
|
readOnly,
|
15271
15620
|
tags
|
15272
15621
|
} = useSelect2Context();
|
15273
|
-
const contentClassName = cn('truncate items-center gap-1');
|
15622
|
+
const contentClassName = cn('truncate flex items-center gap-1');
|
15274
15623
|
const currentValue = children.find(matchesValue(value));
|
15275
15624
|
let output;
|
15276
15625
|
if (placeholder && currentValue === undefined) {
|
@@ -15280,13 +15629,13 @@ const Single = /*#__PURE__*/React__default.forwardRef(function Select2TriggerSin
|
|
15280
15629
|
}, placeholder);
|
15281
15630
|
} else if (currentValue) {
|
15282
15631
|
if (tags && emptyValue !== value) {
|
15283
|
-
output = /*#__PURE__*/React__default.createElement(Tag$1, {
|
15632
|
+
if (typeof currentValue.props.children === 'string') output = /*#__PURE__*/React__default.createElement(Tag$1, {
|
15284
15633
|
className: "truncate",
|
15285
15634
|
color: currentValue.props.color,
|
15286
15635
|
disabled: disabled,
|
15287
15636
|
icon: currentValue.props.prefix,
|
15288
15637
|
readOnly: readOnly
|
15289
|
-
}, currentValue.props.children);
|
15638
|
+
}, currentValue.props.children);else output = currentValue.props.children;
|
15290
15639
|
} else {
|
15291
15640
|
output = /*#__PURE__*/React__default.createElement(React__default.Fragment, null, currentValue.props.prefix ? typeof currentValue.props.prefix === 'string' ? (/*#__PURE__*/React__default.createElement(Icon, {
|
15292
15641
|
name: currentValue.props.prefix,
|
@@ -15337,7 +15686,7 @@ const Multiple = /*#__PURE__*/React__default.forwardRef(function Select2TriggerM
|
|
15337
15686
|
}, valuesAsChildren.length === 0 ? (/*#__PURE__*/React__default.createElement(Placeholder, {
|
15338
15687
|
disabled: disabled,
|
15339
15688
|
readOnly: readOnly
|
15340
|
-
}, placeholder)) : valuesAsChildren.map(child => (/*#__PURE__*/React__default.createElement(Tag$1, {
|
15689
|
+
}, placeholder)) : valuesAsChildren.map(child => typeof child.props.children === 'string' ? (/*#__PURE__*/React__default.createElement(Tag$1, {
|
15341
15690
|
key: String(child.props.value),
|
15342
15691
|
className: "truncate",
|
15343
15692
|
color: tags ? child.props.color : undefined,
|
@@ -15351,7 +15700,23 @@ const Multiple = /*#__PURE__*/React__default.forwardRef(function Select2TriggerM
|
|
15351
15700
|
}
|
15352
15701
|
},
|
15353
15702
|
readOnly: readOnly
|
15354
|
-
}, child.props.children))
|
15703
|
+
}, child.props.children)) : (/*#__PURE__*/React__default.cloneElement(child.props.children, {
|
15704
|
+
key: String(child.props.value),
|
15705
|
+
className: '!pr-0 !pl-1.5',
|
15706
|
+
children: (/*#__PURE__*/React__default.createElement("span", {
|
15707
|
+
className: "flex items-center"
|
15708
|
+
}, child.props.children.props.children, /*#__PURE__*/React__default.createElement(Icon, {
|
15709
|
+
name: "close",
|
15710
|
+
onClick: event => {
|
15711
|
+
event === null || event === void 0 ? void 0 : event.stopPropagation();
|
15712
|
+
event === null || event === void 0 ? void 0 : event.preventDefault();
|
15713
|
+
if (!disabled && !readOnly) {
|
15714
|
+
setValue(child.props.value);
|
15715
|
+
}
|
15716
|
+
},
|
15717
|
+
className: "ml-0.5 !h-5 !w-5 shrink-0 cursor-pointer rounded-r p-0.5 hover:bg-black/5"
|
15718
|
+
})))
|
15719
|
+
})))));
|
15355
15720
|
} else {
|
15356
15721
|
content = /*#__PURE__*/React__default.createElement(MultipleValue, {
|
15357
15722
|
onClick: forwardClick,
|
@@ -15382,6 +15747,18 @@ const MultipleValue = ({
|
|
15382
15747
|
} = useSelect2Context();
|
15383
15748
|
const [contentRef, setContentRef] = React__default.useState(null);
|
15384
15749
|
const boundaryIndex = contentRef ? getIndexOfFirstChildOverflowingParent(contentRef, 30) : undefined;
|
15750
|
+
// Retrieves the relevant text content from any JSX.Element passed as a select option, handling nested elements, arrays, and direct text
|
15751
|
+
const getTooltipTitle = child => {
|
15752
|
+
const children = child.props.children;
|
15753
|
+
if (typeof children === 'string') return children;
|
15754
|
+
if (typeof children.props.children === 'string') {
|
15755
|
+
return children.props.children;
|
15756
|
+
}
|
15757
|
+
if (Array.isArray(children.props.children)) {
|
15758
|
+
return children.props.children.filter(item => typeof item === 'string');
|
15759
|
+
}
|
15760
|
+
return '';
|
15761
|
+
};
|
15385
15762
|
return /*#__PURE__*/React__default.createElement("div", {
|
15386
15763
|
className: "relative flex w-full items-center gap-1 overflow-hidden",
|
15387
15764
|
onClick: onClick
|
@@ -15392,26 +15769,35 @@ const MultipleValue = ({
|
|
15392
15769
|
disabled: disabled,
|
15393
15770
|
readOnly: readOnly
|
15394
15771
|
}, placeholder)) : valuesAsChildren.map((child, index) => {
|
15395
|
-
const
|
15396
|
-
|
15772
|
+
const classNames = {
|
15773
|
+
truncate: index === boundaryIndex,
|
15774
|
+
hidden: boundaryIndex !== undefined && boundaryIndex !== null ? index > boundaryIndex : false
|
15775
|
+
};
|
15776
|
+
let output;
|
15777
|
+
if (typeof child.props.children === 'string') {
|
15778
|
+
output = /*#__PURE__*/React__default.createElement(Tag$1, {
|
15779
|
+
key: String(child.props.value),
|
15780
|
+
className: cn('cursor-pointer', classNames),
|
15781
|
+
color: tags ? child.props.color : undefined,
|
15782
|
+
disabled: disabled,
|
15783
|
+
icon: child.props.prefix,
|
15784
|
+
readOnly: readOnly
|
15785
|
+
}, child.props.children);
|
15786
|
+
} else output = /*#__PURE__*/React__default.cloneElement(child.props.children, {
|
15397
15787
|
className: cn('cursor-pointer', {
|
15398
|
-
|
15399
|
-
|
15400
|
-
|
15401
|
-
|
15402
|
-
disabled: disabled,
|
15403
|
-
icon: child.props.prefix,
|
15404
|
-
readOnly: readOnly
|
15405
|
-
}, child.props.children);
|
15788
|
+
'shrink-0': index !== boundaryIndex
|
15789
|
+
}, classNames),
|
15790
|
+
key: String(child.props.value)
|
15791
|
+
});
|
15406
15792
|
if (index === boundaryIndex) {
|
15407
15793
|
return /*#__PURE__*/React__default.createElement(Tooltip, {
|
15408
15794
|
key: String(child.props.value),
|
15409
|
-
title: String(child
|
15410
|
-
},
|
15795
|
+
title: String(getTooltipTitle(child))
|
15796
|
+
}, output);
|
15411
15797
|
}
|
15412
|
-
return
|
15798
|
+
return output;
|
15413
15799
|
})), boundaryIndex !== undefined && boundaryIndex !== null && boundaryIndex < valuesAsChildren.length - 1 ? (/*#__PURE__*/React__default.createElement(Tooltip, {
|
15414
|
-
title: valuesAsChildren.slice(boundaryIndex + 1).map(child => child ? String(child
|
15800
|
+
title: valuesAsChildren.slice(boundaryIndex + 1).map(child => child ? String(getTooltipTitle(child)) : '').join(', ')
|
15415
15801
|
}, /*#__PURE__*/React__default.createElement(Badge, {
|
15416
15802
|
className: "flex-shrink-0"
|
15417
15803
|
}, "+", valuesAsChildren.length - (boundaryIndex + 1)))) : null);
|
@@ -15476,7 +15862,7 @@ const BubbleSelect = props => {
|
|
15476
15862
|
if (prevValue !== value && setValue) {
|
15477
15863
|
if (Array.isArray(value)) {
|
15478
15864
|
value.forEach(v => {
|
15479
|
-
const option = select.querySelector(`option[value='${v}']`);
|
15865
|
+
const option = select.querySelector(`option[value='${CSS.escape(v)}']`);
|
15480
15866
|
if (option) {
|
15481
15867
|
option.selected = true;
|
15482
15868
|
}
|
@@ -15604,20 +15990,19 @@ const useChildren = ({
|
|
15604
15990
|
};
|
15605
15991
|
|
15606
15992
|
const getNextColor = options => {
|
15607
|
-
|
15608
|
-
|
15609
|
-
|
15610
|
-
|
15611
|
-
|
15612
|
-
|
15613
|
-
|
15614
|
-
|
15615
|
-
}, {});
|
15616
|
-
options.forEach(option => {
|
15993
|
+
let occurrences = {};
|
15994
|
+
AVAILABLE_COLORS.filter(color => color !== 'transparent').forEach(color => {
|
15995
|
+
occurrences = {
|
15996
|
+
...occurrences,
|
15997
|
+
[color]: 0
|
15998
|
+
};
|
15999
|
+
});
|
16000
|
+
options.reduce((occurrences, option) => {
|
15617
16001
|
if (option.props.color) {
|
15618
16002
|
occurrences[option.props.color] = occurrences[option.props.color] ? occurrences[option.props.color] + 1 : 1;
|
15619
16003
|
}
|
15620
|
-
|
16004
|
+
return occurrences;
|
16005
|
+
}, occurrences);
|
15621
16006
|
const colors = Object.keys(occurrences);
|
15622
16007
|
if (colors.length) {
|
15623
16008
|
return colors.sort((a, b) => occurrences[a] - occurrences[b])[0];
|
@@ -16171,8 +16556,9 @@ function Print$1(props) {
|
|
16171
16556
|
const toastRef = toast.loading(texts.table.print.loading);
|
16172
16557
|
const _temp2 = function () {
|
16173
16558
|
if (tableMeta.server.isEnabled && tableMeta.server.loadAllIfNeeded) {
|
16559
|
+
const hiddenColumns = getHiddenColumns(table.getState().columnVisibility);
|
16174
16560
|
const _temp = _catch(function () {
|
16175
|
-
return Promise.resolve(tableMeta.server.loadAllIfNeeded(table.getState().sorting, table.getState().columnFilters)).then(function () {});
|
16561
|
+
return Promise.resolve(tableMeta.server.loadAllIfNeeded(table.getState().sorting, table.getState().columnFilters, hiddenColumns, tableMeta.search.enableGlobalFilter ? table.getState().globalFilter : undefined)).then(function () {});
|
16176
16562
|
}, function (error) {
|
16177
16563
|
const errorMessage = `${texts.table.print.error}: ${error}`;
|
16178
16564
|
console.error(errorMessage);
|
@@ -16286,10 +16672,11 @@ function guessComparatorsBasedOnControl(column) {
|
|
16286
16672
|
return getDataTypeProperties(columnMeta.dataType).filterComparators;
|
16287
16673
|
}
|
16288
16674
|
|
16675
|
+
const FilterContext = /*#__PURE__*/React__default.createContext([]);
|
16676
|
+
|
16289
16677
|
const FilterColumn = /*#__PURE__*/React__default.forwardRef((props, ref) => {
|
16290
16678
|
const {
|
16291
16679
|
allColumns,
|
16292
|
-
filters,
|
16293
16680
|
onChange: handleChange,
|
16294
16681
|
value = null,
|
16295
16682
|
...attributes
|
@@ -16297,6 +16684,7 @@ const FilterColumn = /*#__PURE__*/React__default.forwardRef((props, ref) => {
|
|
16297
16684
|
const {
|
16298
16685
|
texts
|
16299
16686
|
} = useLocalization();
|
16687
|
+
const filters = React__default.useContext(FilterContext);
|
16300
16688
|
const selectedColumn = allColumns.find(column => column.id === value);
|
16301
16689
|
const warning = selectedColumn && !selectedColumn.getIsVisible();
|
16302
16690
|
return /*#__PURE__*/React__default.createElement("div", {
|
@@ -16380,6 +16768,10 @@ function getComparatorText(comparator, texts, column) {
|
|
16380
16768
|
return texts.table.filters.comparators.hasAllOf;
|
16381
16769
|
case exports.TableFilterComparator.HasNoneOf:
|
16382
16770
|
return texts.table.filters.comparators.hasNoneOf;
|
16771
|
+
case exports.TableFilterComparator.IsOneOf:
|
16772
|
+
return texts.table.filters.comparators.isOneOf;
|
16773
|
+
case exports.TableFilterComparator.IsNoneOf:
|
16774
|
+
return texts.table.filters.comparators.isNoneOf;
|
16383
16775
|
default:
|
16384
16776
|
return '';
|
16385
16777
|
}
|
@@ -16462,7 +16854,7 @@ function Control(props) {
|
|
16462
16854
|
} = props;
|
16463
16855
|
const controlRenderer = column === null || column === void 0 ? void 0 : (_column$columnDef$met2 = column.columnDef.meta) === null || _column$columnDef$met2 === void 0 ? void 0 : _column$columnDef$met2.control;
|
16464
16856
|
const dataType = column === null || column === void 0 ? void 0 : (_column$columnDef$met3 = column.columnDef.meta) === null || _column$columnDef$met3 === void 0 ? void 0 : _column$columnDef$met3.dataType;
|
16465
|
-
const
|
16857
|
+
const filters = React__default.useContext(FilterContext);
|
16466
16858
|
React.useEffect(() => {
|
16467
16859
|
// Set value to false only after first render of the control (when it's undefined) after setting the FilterColumn value, because we don't want to change then the value every time filter is opened
|
16468
16860
|
if ((controlRenderer === 'switch' || controlRenderer === 'checkbox') && value === undefined) {
|
@@ -16473,9 +16865,8 @@ function Control(props) {
|
|
16473
16865
|
return /*#__PURE__*/React__default.cloneElement(controlRenderer({
|
16474
16866
|
...attributes,
|
16475
16867
|
setValue: value => onChange(value),
|
16476
|
-
value
|
16477
|
-
|
16478
|
-
}), {
|
16868
|
+
value
|
16869
|
+
}, undefined, filters), {
|
16479
16870
|
['data-query-selector']: querySelector,
|
16480
16871
|
className: 'focus:yt-focus'
|
16481
16872
|
});
|
@@ -16517,7 +16908,6 @@ function Filter$1(props) {
|
|
16517
16908
|
const {
|
16518
16909
|
allColumns,
|
16519
16910
|
filter,
|
16520
|
-
filters,
|
16521
16911
|
onChange: handleChange,
|
16522
16912
|
onRemove,
|
16523
16913
|
position
|
@@ -16592,7 +16982,6 @@ function Filter$1(props) {
|
|
16592
16982
|
className: "flex min-h-[theme(spacing.8)] w-14 flex-shrink-0 items-center justify-end pr-2 text-right"
|
16593
16983
|
}, position > 0 ? texts.table.filters.conditions.and : texts.table.filters.conditions.where), /*#__PURE__*/React__default.createElement(FilterColumn, {
|
16594
16984
|
allColumns: allColumns,
|
16595
|
-
filters: filters,
|
16596
16985
|
onChange: handleChangeColumn,
|
16597
16986
|
value: id,
|
16598
16987
|
ref: ref
|
@@ -16696,7 +17085,9 @@ function ManageFiltersPopover(props) {
|
|
16696
17085
|
};
|
16697
17086
|
return /*#__PURE__*/React__default.createElement(Popover, Object.assign({}, popoverProps, {
|
16698
17087
|
onChange: handleClose
|
16699
|
-
}), /*#__PURE__*/React__default.createElement(Popover.Content, null, /*#__PURE__*/React__default.createElement(
|
17088
|
+
}), /*#__PURE__*/React__default.createElement(Popover.Content, null, /*#__PURE__*/React__default.createElement(FilterContext.Provider, {
|
17089
|
+
value: filters
|
17090
|
+
}, /*#__PURE__*/React__default.createElement("div", {
|
16700
17091
|
className: "flex w-[40rem] flex-col gap-4"
|
16701
17092
|
}, /*#__PURE__*/React__default.createElement("div", {
|
16702
17093
|
className: "flex h-8"
|
@@ -16712,7 +17103,6 @@ function ManageFiltersPopover(props) {
|
|
16712
17103
|
key: `filter_${index}`,
|
16713
17104
|
allColumns: allColumns,
|
16714
17105
|
filter: filter,
|
16715
|
-
filters: filters,
|
16716
17106
|
position: index,
|
16717
17107
|
onChange: handleChangeFilter,
|
16718
17108
|
onRemove: filters.length > 0 && filters.some(f => f.id) || filters.length > 1 ? handleRemoveFilter : undefined
|
@@ -16728,7 +17118,7 @@ function ManageFiltersPopover(props) {
|
|
16728
17118
|
}, texts.table.filters.buttons.clear), /*#__PURE__*/React__default.createElement(Button$1, {
|
16729
17119
|
appearance: "primary",
|
16730
17120
|
onClick: handleApply
|
16731
|
-
}, texts.table.filters.buttons.apply)))));
|
17121
|
+
}, texts.table.filters.buttons.apply))))));
|
16732
17122
|
}
|
16733
17123
|
|
16734
17124
|
function Filters(props) {
|
@@ -16831,7 +17221,7 @@ function Table(props) {
|
|
16831
17221
|
}
|
16832
17222
|
Table.Toolbar = TableToolbar;
|
16833
17223
|
Table.Grid = TableGrid;
|
16834
|
-
function
|
17224
|
+
function getEmptyStateReason(table) {
|
16835
17225
|
if (table.instance.getFilteredRowModel().rows.length === 0 && table.instance.getCoreRowModel().rows.length !== 0) {
|
16836
17226
|
const state = table.instance.getState();
|
16837
17227
|
if (table.meta.search.enableGlobalFilter && !!state.globalFilter) {
|
@@ -16848,13 +17238,14 @@ function TableGrid(props) {
|
|
16848
17238
|
var _table$state$grouping;
|
16849
17239
|
const {
|
16850
17240
|
enableHorizontalArrowKeyNavigation,
|
17241
|
+
footerRows,
|
16851
17242
|
table,
|
16852
17243
|
...attributes
|
16853
17244
|
} = props;
|
16854
17245
|
const handleFocus = table.meta.rowActive.rowActiveIndex === undefined ? event => {
|
16855
17246
|
table.meta.rowActive.handleFocus(event, table.meta.length, table.renderer.scrollToIndex);
|
16856
17247
|
} : undefined;
|
16857
|
-
const
|
17248
|
+
const emptyStateReason = getEmptyStateReason(table);
|
16858
17249
|
return /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement("style", null, table.stylesheet), /*#__PURE__*/React__default.createElement(focus.FocusScope, null, /*#__PURE__*/React__default.createElement("table", Object.assign({}, attributes, {
|
16859
17250
|
id: table.id,
|
16860
17251
|
"data-table-font-size": table.meta.fontSize.size,
|
@@ -16870,18 +17261,15 @@ function TableGrid(props) {
|
|
16870
17261
|
style: table.style,
|
16871
17262
|
tabIndex: -1
|
16872
17263
|
}), /*#__PURE__*/React__default.createElement("thead", null, table.instance.getHeaderGroups().map(headerGroup => (/*#__PURE__*/React__default.createElement("tr", {
|
16873
|
-
key: headerGroup.id
|
16874
|
-
onFocus: event => {
|
16875
|
-
// prevents rowActive.handleFocus from running when clicking on column-header menus.
|
16876
|
-
event.stopPropagation();
|
16877
|
-
}
|
17264
|
+
key: headerGroup.id
|
16878
17265
|
}, headerGroup.headers.map(props => (/*#__PURE__*/React__default.createElement(Header$5, {
|
16879
17266
|
key: props.id,
|
16880
17267
|
header: props,
|
16881
17268
|
scrollToIndex: table.renderer.scrollToIndex
|
16882
|
-
}))))))),
|
17269
|
+
}))))))), emptyStateReason ? (/*#__PURE__*/React__default.createElement(EmptyStateBody, {
|
16883
17270
|
emptyState: props.table.props.emptyState,
|
16884
|
-
|
17271
|
+
isReady: table.meta.server.isEnabled ? table.meta.server.isReady : true,
|
17272
|
+
reason: emptyStateReason
|
16885
17273
|
})) : (/*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement(Body, {
|
16886
17274
|
enableHorizontalArrowKeyNavigation: enableHorizontalArrowKeyNavigation,
|
16887
17275
|
table: table.instance,
|
@@ -16893,12 +17281,11 @@ function TableGrid(props) {
|
|
16893
17281
|
} : table.renderer.style
|
16894
17282
|
}, table.renderer.rows, props.children), table.meta.footer.isEnabled ? /*#__PURE__*/React__default.createElement(Foot, {
|
16895
17283
|
table: table.instance
|
16896
|
-
}) : null)))));
|
17284
|
+
}, footerRows) : null)))));
|
16897
17285
|
}
|
16898
17286
|
|
16899
|
-
|
16900
|
-
|
16901
|
-
}
|
17287
|
+
const Column$1 = () => null;
|
17288
|
+
Column$1.displayName = 'Table3Column';
|
16902
17289
|
function Group$4(_) {
|
16903
17290
|
return null;
|
16904
17291
|
}
|
@@ -18452,7 +18839,7 @@ function willRowMoveAfterSorting(cell, change, rowIndex) {
|
|
18452
18839
|
if (rowIndex < rows.length - 1) {
|
18453
18840
|
miniSortRows.push(rows[rowIndex + 1]);
|
18454
18841
|
}
|
18455
|
-
const
|
18842
|
+
const resortedRows = [...miniSortRows].sort((rowA, rowB) => {
|
18456
18843
|
const sortFn = cell.column.getSortingFn();
|
18457
18844
|
const sortUndefined = cell.column.columnDef.sortUndefined;
|
18458
18845
|
if (!table.options.manualSorting && sortUndefined) {
|
@@ -18467,8 +18854,7 @@ function willRowMoveAfterSorting(cell, change, rowIndex) {
|
|
18467
18854
|
}
|
18468
18855
|
}
|
18469
18856
|
return sortFn(rowA, rowB, cell.column.id);
|
18470
|
-
};
|
18471
|
-
const resortedRows = [...miniSortRows].sort(sortRows);
|
18857
|
+
});
|
18472
18858
|
if (cell.column.getIsSorted() === 'desc') {
|
18473
18859
|
resortedRows.reverse();
|
18474
18860
|
}
|
@@ -18486,19 +18872,26 @@ const shortcut = {
|
|
18486
18872
|
meta: true,
|
18487
18873
|
shift: false
|
18488
18874
|
};
|
18875
|
+
function isTableScrolled(ref) {
|
18876
|
+
if (ref.current) {
|
18877
|
+
var _ref$current, _ref$current$querySel, _ref$current2, _ref$current2$querySe;
|
18878
|
+
const height = parseFloat(((_ref$current = ref.current) === null || _ref$current === void 0 ? void 0 : (_ref$current$querySel = _ref$current.querySelector('tbody')) === null || _ref$current$querySel === void 0 ? void 0 : _ref$current$querySel.style.height) || '0') + parseFloat(((_ref$current2 = ref.current) === null || _ref$current2 === void 0 ? void 0 : (_ref$current2$querySe = _ref$current2.querySelector('tbody')) === null || _ref$current2$querySe === void 0 ? void 0 : _ref$current2$querySe.style.paddingBottom) || '0');
|
18879
|
+
return height > ref.current.scrollHeight;
|
18880
|
+
}
|
18881
|
+
return false;
|
18882
|
+
}
|
18489
18883
|
|
18490
18884
|
function useTableEditingListener(table, tableRef, scrollToIndex) {
|
18491
18885
|
const tableMeta = table.options.meta;
|
18492
18886
|
const localization = useLocalization();
|
18493
|
-
// save when the row changes
|
18494
|
-
// store the last row active index, otherwise everytime tableMeta.editing.saveChanges changes the hook runs again
|
18495
|
-
const lastRowActiveIndexRef = React__default.useRef(tableMeta.rowActive.rowActiveIndex);
|
18496
18887
|
useLazyEffect(() => {
|
18497
|
-
|
18498
|
-
|
18499
|
-
|
18500
|
-
|
18501
|
-
|
18888
|
+
return () => {
|
18889
|
+
if (tableMeta.editing.isEditing && tableMeta.rowActive.rowActiveIndex !== undefined) {
|
18890
|
+
var _table$getRowModel$ro;
|
18891
|
+
tableMeta.editing.saveChanges(table, (_table$getRowModel$ro = table.getRowModel().rows[tableMeta.rowActive.rowActiveIndex]) === null || _table$getRowModel$ro === void 0 ? void 0 : _table$getRowModel$ro.id);
|
18892
|
+
}
|
18893
|
+
};
|
18894
|
+
}, [tableMeta.rowActive.rowActiveIndex]);
|
18502
18895
|
// show a warning if the user navigates away without triggering save, such as using the browser back/forward button
|
18503
18896
|
const hasChanges = tableMeta.editing.hasChanges();
|
18504
18897
|
React__default.useEffect(() => {
|
@@ -18524,9 +18917,9 @@ function useTableEditingListener(table, tableRef, scrollToIndex) {
|
|
18524
18917
|
const onClickOutside = event => {
|
18525
18918
|
if (tableMeta.editing.isEditing) {
|
18526
18919
|
const element = event.target;
|
18527
|
-
const
|
18920
|
+
const isTableOrIsInsideTable = element.tagName === 'TABLE' || element.tagName === 'TBODY' || element.getAttribute('data-taco') === 'backdrop' || element.getAttribute('data-table') === 'editing-toggle' || !document.body.contains(element) || isElementInsideOrTriggeredFromContainer(element, tableRef.current);
|
18528
18921
|
// users can click the white space below rows which could be inside the table, but a valid scenario to save
|
18529
|
-
if (!
|
18922
|
+
if (!isTableOrIsInsideTable) {
|
18530
18923
|
tableMeta.editing.saveChanges(table);
|
18531
18924
|
}
|
18532
18925
|
}
|
@@ -18534,18 +18927,13 @@ function useTableEditingListener(table, tableRef, scrollToIndex) {
|
|
18534
18927
|
document.addEventListener('click', onClickOutside);
|
18535
18928
|
return () => document.removeEventListener('click', onClickOutside);
|
18536
18929
|
}, [tableMeta.editing.isEditing, tableMeta.editing.saveChanges]);
|
18537
|
-
|
18538
|
-
|
18539
|
-
|
18540
|
-
|
18541
|
-
|
18542
|
-
|
18543
|
-
|
18544
|
-
} catch {
|
18545
|
-
tableMeta.editing.discardChanges(pendingChange.rowId, table);
|
18546
|
-
}
|
18547
|
-
});
|
18548
|
-
}, [rows.length]);
|
18930
|
+
React__default.useEffect(() => {
|
18931
|
+
if (tableMeta.editing.isEnabled) {
|
18932
|
+
tableMeta.rowActions.registerHandler('cleanup', rowId => {
|
18933
|
+
tableMeta.editing.discardChanges(rowId, table);
|
18934
|
+
});
|
18935
|
+
}
|
18936
|
+
}, []);
|
18549
18937
|
// shortcuts
|
18550
18938
|
useGlobalKeyDown(tableMeta.editing.isEnabled ? shortcut : undefined, event => {
|
18551
18939
|
event.preventDefault();
|
@@ -18573,6 +18961,7 @@ function reducer$2(state, action) {
|
|
18573
18961
|
{
|
18574
18962
|
const {
|
18575
18963
|
columnId,
|
18964
|
+
index,
|
18576
18965
|
row,
|
18577
18966
|
value
|
18578
18967
|
} = payload;
|
@@ -18582,7 +18971,8 @@ function reducer$2(state, action) {
|
|
18582
18971
|
...state.changes,
|
18583
18972
|
rows: setWith(state.changes.rows, `${rowId}.${columnId}`, value, Object),
|
18584
18973
|
originals: setWith(state.changes.originals, rowId, row, Object)
|
18585
|
-
}
|
18974
|
+
},
|
18975
|
+
indexes: setWith(state.indexes, rowId, index, Object)
|
18586
18976
|
};
|
18587
18977
|
}
|
18588
18978
|
case 'removeCellValue':
|
@@ -18616,6 +19006,7 @@ function reducer$2(state, action) {
|
|
18616
19006
|
{
|
18617
19007
|
const {
|
18618
19008
|
cellErrors,
|
19009
|
+
index,
|
18619
19010
|
moveReasons,
|
18620
19011
|
original,
|
18621
19012
|
value
|
@@ -18630,7 +19021,8 @@ function reducer$2(state, action) {
|
|
18630
19021
|
moveReasons: setWith(state.changes.moveReasons, rowId, moveReasons !== null && moveReasons !== void 0 ? moveReasons : state.changes.moveReasons[rowId], Object),
|
18631
19022
|
// status can be undefined, so don't use ??
|
18632
19023
|
status: setWith(state.changes.status, rowId, undefined, Object)
|
18633
|
-
}
|
19024
|
+
},
|
19025
|
+
indexes: setWith(state.indexes, rowId, index, Object)
|
18634
19026
|
};
|
18635
19027
|
}
|
18636
19028
|
case 'removeRow':
|
@@ -18648,6 +19040,7 @@ function reducer$2(state, action) {
|
|
18648
19040
|
originals: omit(state.changes.originals, rowId),
|
18649
19041
|
status: omit(state.changes.status, rowId)
|
18650
19042
|
},
|
19043
|
+
indexes: omit(state.indexes, rowId),
|
18651
19044
|
temporaryRows: state.temporaryRows.filter(row => row[rowIdentityAccessor] !== rowId)
|
18652
19045
|
};
|
18653
19046
|
}
|
@@ -18677,9 +19070,10 @@ function reducer$2(state, action) {
|
|
18677
19070
|
}
|
18678
19071
|
};
|
18679
19072
|
}
|
18680
|
-
case '
|
19073
|
+
case 'insertTemporaryRow':
|
18681
19074
|
{
|
18682
19075
|
const {
|
19076
|
+
index,
|
18683
19077
|
value
|
18684
19078
|
} = payload;
|
18685
19079
|
return {
|
@@ -18689,14 +19083,36 @@ function reducer$2(state, action) {
|
|
18689
19083
|
...state.changes,
|
18690
19084
|
rows: setWith(state.changes.rows, rowId, value, Object),
|
18691
19085
|
originals: setWith(state.changes.originals, rowId, value, Object)
|
18692
|
-
}
|
19086
|
+
},
|
19087
|
+
indexes: setWith(state.indexes, rowId, index, Object)
|
18693
19088
|
};
|
18694
19089
|
}
|
18695
19090
|
default:
|
18696
19091
|
return state;
|
18697
19092
|
}
|
18698
19093
|
}
|
18699
|
-
function usePendingChangesState(handleSave, handleChange, rowIdentityAccessor, validator) {
|
19094
|
+
function usePendingChangesState(handleSave, handleChange, handleDiscard, rowIdentityAccessor, validator) {
|
19095
|
+
const discardChanges = function (rowId, table) {
|
19096
|
+
try {
|
19097
|
+
// remove any new rows from pinned state before discarding them
|
19098
|
+
table.resetRowPinning(true);
|
19099
|
+
dispatch({
|
19100
|
+
type: 'removeRow',
|
19101
|
+
rowId,
|
19102
|
+
payload: {
|
19103
|
+
rowIdentityAccessor
|
19104
|
+
}
|
19105
|
+
});
|
19106
|
+
const _temp8 = function () {
|
19107
|
+
if (typeof handleDiscard === 'function') {
|
19108
|
+
return Promise.resolve(handleDiscard()).then(function () {});
|
19109
|
+
}
|
19110
|
+
}();
|
19111
|
+
return Promise.resolve(_temp8 && _temp8.then ? _temp8.then(function () {}) : void 0);
|
19112
|
+
} catch (e) {
|
19113
|
+
return Promise.reject(e);
|
19114
|
+
}
|
19115
|
+
};
|
18700
19116
|
const saveChanges = function (table, rowId = undefined) {
|
18701
19117
|
try {
|
18702
19118
|
let _exit = false;
|
@@ -18709,35 +19125,38 @@ function usePendingChangesState(handleSave, handleChange, rowIdentityAccessor, v
|
|
18709
19125
|
[rowId]: state.changes.rows[rowId]
|
18710
19126
|
} : state.changes.rows;
|
18711
19127
|
let completed = true;
|
18712
|
-
const
|
19128
|
+
const _temp7 = _forOf(Object.keys(changes), function (rowId) {
|
18713
19129
|
const status = getRowStatus(rowId);
|
18714
19130
|
return _catch(function () {
|
18715
|
-
|
19131
|
+
var _changes$rowId;
|
19132
|
+
function _temp6(_result) {
|
18716
19133
|
return _exit ? _result : Promise.resolve(handleSave(changeSet)).then(function () {
|
18717
19134
|
// cleanup changes, we don't need them after saving
|
18718
|
-
discardChanges(rowId, table)
|
18719
|
-
|
18720
|
-
|
18721
|
-
|
18722
|
-
|
18723
|
-
|
19135
|
+
return Promise.resolve(discardChanges(rowId, table)).then(function () {
|
19136
|
+
// show the saved status, then remove it after a delay
|
19137
|
+
setRowStatus(rowId, 'saved');
|
19138
|
+
setTimeout(() => {
|
19139
|
+
setRowStatus(rowId, undefined);
|
19140
|
+
}, DELAY_BEFORE_REMOVING_SAVE_STATUS);
|
19141
|
+
});
|
18724
19142
|
});
|
18725
19143
|
}
|
19144
|
+
const rowChanges = (_changes$rowId = changes[rowId]) !== null && _changes$rowId !== void 0 ? _changes$rowId : {};
|
18726
19145
|
// don't try to save if - already saving, or there are known errors
|
18727
|
-
if (status === 'saving' || status === 'errored') {
|
19146
|
+
if (!Object.keys(rowChanges).length || status === 'saving' || status === 'errored') {
|
18728
19147
|
return;
|
18729
19148
|
}
|
18730
19149
|
setRowStatus(rowId, 'saving');
|
18731
19150
|
const changeSet = {
|
18732
19151
|
...state.changes.originals[rowId],
|
18733
|
-
...
|
19152
|
+
...rowChanges
|
18734
19153
|
};
|
18735
19154
|
// if we had to create a temporary id, delete it first - it's our data, not theirs
|
18736
19155
|
if (isTemporaryRow(changeSet[rowIdentityAccessor])) {
|
18737
19156
|
delete changeSet[rowIdentityAccessor];
|
18738
19157
|
}
|
18739
19158
|
// re-run validation, maybe a cell is already invalid but has never been blurred
|
18740
|
-
const
|
19159
|
+
const _temp5 = function () {
|
18741
19160
|
if (validator) {
|
18742
19161
|
return Promise.resolve(validator(changeSet)).then(function (errors) {
|
18743
19162
|
if (errors && Object.keys(errors).length) {
|
@@ -18746,7 +19165,7 @@ function usePendingChangesState(handleSave, handleChange, rowIdentityAccessor, v
|
|
18746
19165
|
});
|
18747
19166
|
}
|
18748
19167
|
}();
|
18749
|
-
return
|
19168
|
+
return _temp5 && _temp5.then ? _temp5.then(_temp6) : _temp6(_temp5); // send new data to the server
|
18750
19169
|
}, function (error) {
|
18751
19170
|
var _error$response;
|
18752
19171
|
if (error instanceof ReferenceError || error instanceof TypeError || (error === null || error === void 0 ? void 0 : (_error$response = error.response) === null || _error$response === void 0 ? void 0 : _error$response.status) >= 500) {
|
@@ -18786,18 +19205,18 @@ function usePendingChangesState(handleSave, handleChange, rowIdentityAccessor, v
|
|
18786
19205
|
}, function () {
|
18787
19206
|
return _exit;
|
18788
19207
|
});
|
18789
|
-
return Promise.resolve(
|
19208
|
+
return Promise.resolve(_temp7 && _temp7.then ? _temp7.then(function (_result3) {
|
18790
19209
|
return _exit ? _result3 : completed;
|
18791
|
-
}) : _exit ?
|
19210
|
+
}) : _exit ? _temp7 : completed);
|
18792
19211
|
} catch (e) {
|
18793
19212
|
return Promise.reject(e);
|
18794
19213
|
}
|
18795
19214
|
};
|
18796
|
-
const onCellChanged = function (cell, rowIndex, shouldRunUpdaters = true) {
|
19215
|
+
const onCellChanged = function (cell, rowIndex, nextValue, shouldRunUpdaters = true) {
|
18797
19216
|
try {
|
18798
|
-
function
|
19217
|
+
function _temp4() {
|
18799
19218
|
var _state$changes$errors11;
|
18800
|
-
function
|
19219
|
+
function _temp2() {
|
18801
19220
|
// only set errors and move reasons for the cells we're currently acting on
|
18802
19221
|
// why? because the UX is not good if we set them for cells the user hasn't touched yet
|
18803
19222
|
const cellsToActOn = [cell.column.id, ...Object.keys(updatesForOtherCells)];
|
@@ -18828,6 +19247,7 @@ function usePendingChangesState(handleSave, handleChange, rowIdentityAccessor, v
|
|
18828
19247
|
rowId: cell.row.id,
|
18829
19248
|
payload: {
|
18830
19249
|
cellErrors: nextCellErrors,
|
19250
|
+
index: rowIndex,
|
18831
19251
|
moveReasons: nextMoveReasons,
|
18832
19252
|
value: nextChanges
|
18833
19253
|
}
|
@@ -18835,7 +19255,7 @@ function usePendingChangesState(handleSave, handleChange, rowIdentityAccessor, v
|
|
18835
19255
|
}
|
18836
19256
|
// create a projection of the next state, so we can act against it
|
18837
19257
|
const nextChanges = {
|
18838
|
-
...
|
19258
|
+
...changes,
|
18839
19259
|
...updatesForOtherCells
|
18840
19260
|
};
|
18841
19261
|
const nextMoveReasons = {
|
@@ -18844,29 +19264,35 @@ function usePendingChangesState(handleSave, handleChange, rowIdentityAccessor, v
|
|
18844
19264
|
const nextCellErrors = {
|
18845
19265
|
...((_state$changes$errors11 = state.changes.errors[cell.row.id]) === null || _state$changes$errors11 === void 0 ? void 0 : _state$changes$errors11.cells)
|
18846
19266
|
};
|
18847
|
-
// run validation
|
19267
|
+
// run validation - if there are changes, and if there is an original stored
|
18848
19268
|
let validationErrors = {};
|
18849
|
-
const
|
18850
|
-
if (validator) {
|
19269
|
+
const _temp = function () {
|
19270
|
+
if (validator && Object.keys(nextChanges).length && state.changes.originals[cell.row.id]) {
|
19271
|
+
// merge with the original so we get a full row
|
18851
19272
|
const nextRowValue = {
|
18852
19273
|
...state.changes.originals[cell.row.id],
|
18853
19274
|
...changes,
|
18854
19275
|
...updatesForOtherCells
|
18855
19276
|
};
|
18856
|
-
return Promise.resolve(validator(nextRowValue)).then(function (
|
18857
|
-
validationErrors =
|
19277
|
+
return Promise.resolve(validator(nextRowValue)).then(function (_validator) {
|
19278
|
+
validationErrors = _validator !== null && _validator !== void 0 ? _validator : {};
|
18858
19279
|
});
|
18859
19280
|
}
|
18860
19281
|
}();
|
18861
|
-
return
|
19282
|
+
return _temp && _temp.then ? _temp.then(_temp2) : _temp2(_temp);
|
18862
19283
|
}
|
18863
|
-
const changes =
|
18864
|
-
|
19284
|
+
const changes = nextValue !== undefined ? {
|
19285
|
+
...state.changes.rows[cell.row.id],
|
19286
|
+
[cell.column.id]: nextValue
|
19287
|
+
} : {
|
19288
|
+
...state.changes.rows[cell.row.id]
|
19289
|
+
};
|
19290
|
+
if (!Object.keys(changes).length) {
|
18865
19291
|
return Promise.resolve();
|
18866
19292
|
}
|
18867
19293
|
let updatesForOtherCells = {};
|
18868
19294
|
// run the updater handler if there is one, to see if there are any other cells to update
|
18869
|
-
const
|
19295
|
+
const _temp3 = function () {
|
18870
19296
|
if (typeof handleChange === 'function' && shouldRunUpdaters) {
|
18871
19297
|
const previousRowValue = {
|
18872
19298
|
...state.changes.originals[cell.row.id]
|
@@ -18880,42 +19306,11 @@ function usePendingChangesState(handleSave, handleChange, rowIdentityAccessor, v
|
|
18880
19306
|
});
|
18881
19307
|
}
|
18882
19308
|
}();
|
18883
|
-
return Promise.resolve(
|
19309
|
+
return Promise.resolve(_temp3 && _temp3.then ? _temp3.then(_temp4) : _temp4(_temp3));
|
18884
19310
|
} catch (e) {
|
18885
19311
|
return Promise.reject(e);
|
18886
19312
|
}
|
18887
19313
|
}; // general
|
18888
|
-
// rows
|
18889
|
-
const setRowValue = function (rowId, original, value) {
|
18890
|
-
try {
|
18891
|
-
function _temp2() {
|
18892
|
-
dispatch({
|
18893
|
-
type: 'updateRow',
|
18894
|
-
rowId,
|
18895
|
-
payload: {
|
18896
|
-
cellErrors,
|
18897
|
-
original,
|
18898
|
-
value
|
18899
|
-
}
|
18900
|
-
});
|
18901
|
-
}
|
18902
|
-
let cellErrors;
|
18903
|
-
const _temp = function () {
|
18904
|
-
if (validator) {
|
18905
|
-
const row = {
|
18906
|
-
...original,
|
18907
|
-
...value
|
18908
|
-
};
|
18909
|
-
return Promise.resolve(validator(row)).then(function (_validator) {
|
18910
|
-
cellErrors = _validator !== null && _validator !== void 0 ? _validator : {};
|
18911
|
-
});
|
18912
|
-
}
|
18913
|
-
}();
|
18914
|
-
return Promise.resolve(_temp && _temp.then ? _temp.then(_temp2) : _temp2(_temp));
|
18915
|
-
} catch (e) {
|
18916
|
-
return Promise.reject(e);
|
18917
|
-
}
|
18918
|
-
};
|
18919
19314
|
const localization = useLocalization();
|
18920
19315
|
const [state, dispatch] = React__default.useReducer(reducer$2, {
|
18921
19316
|
changes: {
|
@@ -18925,8 +19320,10 @@ function usePendingChangesState(handleSave, handleChange, rowIdentityAccessor, v
|
|
18925
19320
|
originals: {},
|
18926
19321
|
status: {}
|
18927
19322
|
},
|
19323
|
+
indexes: {},
|
18928
19324
|
temporaryRows: []
|
18929
19325
|
});
|
19326
|
+
// rows
|
18930
19327
|
function getRowValue(rowId) {
|
18931
19328
|
var _state$changes$rows$r, _state$changes$rows;
|
18932
19329
|
return (_state$changes$rows$r = (_state$changes$rows = state.changes.rows) === null || _state$changes$rows === void 0 ? void 0 : _state$changes$rows[rowId]) !== null && _state$changes$rows$r !== void 0 ? _state$changes$rows$r : undefined;
|
@@ -18964,23 +19361,24 @@ function usePendingChangesState(handleSave, handleChange, rowIdentityAccessor, v
|
|
18964
19361
|
}
|
18965
19362
|
});
|
18966
19363
|
}
|
18967
|
-
function
|
19364
|
+
function insertTemporaryRow(data, rowIndex) {
|
18968
19365
|
const newRowId = `${TEMPORARY_ROW_ID_PREFIX}${uuid.v4()}`;
|
18969
19366
|
const value = {
|
18970
19367
|
...data,
|
18971
19368
|
[rowIdentityAccessor]: newRowId
|
18972
19369
|
};
|
18973
19370
|
dispatch({
|
18974
|
-
type: '
|
19371
|
+
type: 'insertTemporaryRow',
|
18975
19372
|
rowId: newRowId,
|
18976
19373
|
payload: {
|
19374
|
+
index: rowIndex,
|
18977
19375
|
value
|
18978
19376
|
}
|
18979
19377
|
});
|
18980
19378
|
return newRowId;
|
18981
19379
|
}
|
18982
19380
|
// cells
|
18983
|
-
function setCellValue(cell, value) {
|
19381
|
+
function setCellValue(cell, rowIndex, value) {
|
18984
19382
|
const rowId = cell.row.id;
|
18985
19383
|
const columnId = cell.column.id;
|
18986
19384
|
// update if the change is different to the original value
|
@@ -18990,6 +19388,7 @@ function usePendingChangesState(handleSave, handleChange, rowIdentityAccessor, v
|
|
18990
19388
|
rowId,
|
18991
19389
|
payload: {
|
18992
19390
|
columnId,
|
19391
|
+
index: rowIndex,
|
18993
19392
|
row: cell.row.original,
|
18994
19393
|
value
|
18995
19394
|
}
|
@@ -19022,6 +19421,7 @@ function usePendingChangesState(handleSave, handleChange, rowIdentityAccessor, v
|
|
19022
19421
|
}
|
19023
19422
|
return rowsWithErrors.filter(hasRowErrorsShownInAlert).map(rowId => ({
|
19024
19423
|
rowId,
|
19424
|
+
index: state.indexes[rowId],
|
19025
19425
|
changes: state.changes.rows[rowId],
|
19026
19426
|
errors: state.changes.errors[rowId]
|
19027
19427
|
}));
|
@@ -19032,20 +19432,8 @@ function usePendingChangesState(handleSave, handleChange, rowIdentityAccessor, v
|
|
19032
19432
|
function hasChanges(rowId) {
|
19033
19433
|
return rowId ? !!state.changes.rows[rowId] : !!Object.keys(state.changes.rows).length;
|
19034
19434
|
}
|
19035
|
-
function discardChanges(rowId, table) {
|
19036
|
-
// remove any new rows from pinned state before discarding them
|
19037
|
-
table.resetRowPinning(true);
|
19038
|
-
dispatch({
|
19039
|
-
type: 'removeRow',
|
19040
|
-
rowId,
|
19041
|
-
payload: {
|
19042
|
-
rowIdentityAccessor
|
19043
|
-
}
|
19044
|
-
});
|
19045
|
-
}
|
19046
19435
|
return {
|
19047
19436
|
// row
|
19048
|
-
setRowValue,
|
19049
19437
|
getRowValue,
|
19050
19438
|
getRowMoveReason,
|
19051
19439
|
hasRowErrors,
|
@@ -19065,12 +19453,66 @@ function usePendingChangesState(handleSave, handleChange, rowIdentityAccessor, v
|
|
19065
19453
|
discardChanges,
|
19066
19454
|
hasSaved,
|
19067
19455
|
// new rows
|
19068
|
-
|
19456
|
+
insertTemporaryRow,
|
19069
19457
|
temporaryRows: state.temporaryRows
|
19070
19458
|
};
|
19071
19459
|
}
|
19072
19460
|
|
19073
|
-
function useTableEditing(isEnabled = false, handleSave, handleChange, rowIdentityAccessor, validator) {
|
19461
|
+
function useTableEditing(isEnabled = false, handleSave, handleChange, handleCreate, handleDiscard, rowIdentityAccessor, validator) {
|
19462
|
+
const createRow = function (table, row) {
|
19463
|
+
try {
|
19464
|
+
let _exit = false;
|
19465
|
+
function _temp2(_result) {
|
19466
|
+
if (_exit) return _result;
|
19467
|
+
const changeset = row !== null && row !== void 0 ? row : handleCreate();
|
19468
|
+
try {
|
19469
|
+
if (changeset) {
|
19470
|
+
// set the active row to the new row before toggling editing on
|
19471
|
+
const temporaryRows = tableMeta.editing.temporaryRows;
|
19472
|
+
const nextRowIndex = temporaryRows.length ? tableMeta.length + 1 : tableMeta.length;
|
19473
|
+
const newRowId = pendingChangesFns.insertTemporaryRow(changeset, nextRowIndex);
|
19474
|
+
// prep the row
|
19475
|
+
table.setRowPinning(currentState => {
|
19476
|
+
var _ref, _currentState$bottom;
|
19477
|
+
return {
|
19478
|
+
...currentState,
|
19479
|
+
bottom: (_ref = (_currentState$bottom = currentState.bottom) !== null && _currentState$bottom !== void 0 ? _currentState$bottom : []) === null || _ref === void 0 ? void 0 : _ref.concat(newRowId)
|
19480
|
+
};
|
19481
|
+
});
|
19482
|
+
// prep editing mode
|
19483
|
+
toggleDetailedMode(false);
|
19484
|
+
setLastFocusedCellIndex(undefined);
|
19485
|
+
// wait until set states have run
|
19486
|
+
requestAnimationFrame(() => {
|
19487
|
+
tableMeta.rowActive.setRowActiveIndex(nextRowIndex);
|
19488
|
+
table.resetRowSelection();
|
19489
|
+
if (!tableMeta.editing.isEditing) {
|
19490
|
+
setEditing(true);
|
19491
|
+
}
|
19492
|
+
});
|
19493
|
+
}
|
19494
|
+
} catch (error) {
|
19495
|
+
console.error(error);
|
19496
|
+
}
|
19497
|
+
}
|
19498
|
+
if (!handleCreate) {
|
19499
|
+
return Promise.resolve();
|
19500
|
+
}
|
19501
|
+
const tableMeta = table.options.meta;
|
19502
|
+
const _temp = function () {
|
19503
|
+
if (tableMeta.rowActive.rowActiveIndex !== undefined) {
|
19504
|
+
return Promise.resolve(tableMeta.editing.saveChanges(table)).then(function (saved) {
|
19505
|
+
if (!saved) {
|
19506
|
+
_exit = true;
|
19507
|
+
}
|
19508
|
+
});
|
19509
|
+
}
|
19510
|
+
}();
|
19511
|
+
return Promise.resolve(_temp && _temp.then ? _temp.then(_temp2) : _temp2(_temp));
|
19512
|
+
} catch (e) {
|
19513
|
+
return Promise.reject(e);
|
19514
|
+
}
|
19515
|
+
};
|
19074
19516
|
// used to switch the table into editing mode
|
19075
19517
|
const [isEditing, setEditing] = React__default.useState(false);
|
19076
19518
|
// used to switch the editing between "detailed" mode
|
@@ -19079,26 +19521,26 @@ function useTableEditing(isEnabled = false, handleSave, handleChange, rowIdentit
|
|
19079
19521
|
const createRowButtonRef = React__default.useRef(null);
|
19080
19522
|
// store the last focused cell, so that up/down arrow key navigation remains in the same column
|
19081
19523
|
const [lastFocusedCellIndex, setLastFocusedCellIndex] = React__default.useState(undefined);
|
19082
|
-
const pendingChangesFns = usePendingChangesState(handleSave, handleChange, rowIdentityAccessor, validator);
|
19524
|
+
const pendingChangesFns = usePendingChangesState(handleSave, handleChange, handleDiscard, rowIdentityAccessor, validator);
|
19083
19525
|
function toggleEditing(enabled, table, scrollToIndex) {
|
19084
|
-
|
19085
|
-
if (
|
19086
|
-
|
19087
|
-
|
19526
|
+
const tableMeta = table.options.meta;
|
19527
|
+
if (enabled) {
|
19528
|
+
var _tableMeta$rowActive$, _table$getRowModel$ro;
|
19529
|
+
const index = (_tableMeta$rowActive$ = tableMeta.rowActive.rowActiveIndex) !== null && _tableMeta$rowActive$ !== void 0 ? _tableMeta$rowActive$ : 0;
|
19530
|
+
if (tableMeta.rowActive.rowActiveIndex === undefined) {
|
19531
|
+
tableMeta.rowActive.setRowActiveIndex(index);
|
19532
|
+
}
|
19533
|
+
if (!isTemporaryRow((_table$getRowModel$ro = table.getRowModel().rows[index]) === null || _table$getRowModel$ro === void 0 ? void 0 : _table$getRowModel$ro.id)) {
|
19534
|
+
scrollToIndex(index);
|
19535
|
+
}
|
19536
|
+
} else if (!enabled) {
|
19088
19537
|
// reset detailed mode
|
19089
19538
|
toggleDetailedMode(false);
|
19090
19539
|
// reset the last index back to the first focusable element, when editing gets turned off
|
19091
19540
|
setLastFocusedCellIndex(undefined);
|
19092
19541
|
}
|
19093
|
-
const tableMeta = table.options.meta;
|
19094
|
-
const index = (_tableMeta$rowActive$ = tableMeta.rowActive.rowActiveIndex) !== null && _tableMeta$rowActive$ !== void 0 ? _tableMeta$rowActive$ : 0;
|
19095
|
-
if (tableMeta.rowActive.rowActiveIndex === undefined) {
|
19096
|
-
tableMeta.rowActive.setRowActiveIndex(index);
|
19097
|
-
}
|
19098
19542
|
setEditing(enabled);
|
19099
|
-
|
19100
|
-
scrollToIndex(index);
|
19101
|
-
}
|
19543
|
+
pendingChangesFns.saveChanges(table);
|
19102
19544
|
}
|
19103
19545
|
return {
|
19104
19546
|
isEnabled,
|
@@ -19108,6 +19550,7 @@ function useTableEditing(isEnabled = false, handleSave, handleChange, rowIdentit
|
|
19108
19550
|
toggleEditing: isEnabled ? toggleEditing : () => undefined,
|
19109
19551
|
lastFocusedCellIndex,
|
19110
19552
|
setLastFocusedCellIndex,
|
19553
|
+
createRow,
|
19111
19554
|
createRowButtonRef,
|
19112
19555
|
...pendingChangesFns
|
19113
19556
|
};
|
@@ -19364,24 +19807,32 @@ function EditingControlCell(props) {
|
|
19364
19807
|
var _cellRef$current;
|
19365
19808
|
return typeof type === 'function' && !!((_cellRef$current = cellRef.current) !== null && _cellRef$current !== void 0 && _cellRef$current.querySelector('[data-taco="Select2"],[data-taco="switch"],[data-taco="checkbox"]'));
|
19366
19809
|
}, [cellRef.current]);
|
19367
|
-
const handleChange = nextValue => {
|
19810
|
+
const handleChange = React__default.useCallback(nextValue => {
|
19368
19811
|
if (nextValue !== value) {
|
19369
|
-
tableMeta.editing.setCellValue(cell, nextValue);
|
19812
|
+
tableMeta.editing.setCellValue(cell, rowIndex, nextValue);
|
19370
19813
|
if (hasNonTextControl) {
|
19371
|
-
tableMeta.editing.onCellChanged(cell, rowIndex);
|
19814
|
+
requestAnimationFrame(() => tableMeta.editing.onCellChanged(cell, rowIndex, nextValue));
|
19372
19815
|
}
|
19373
19816
|
}
|
19374
|
-
};
|
19375
|
-
const
|
19376
|
-
|
19377
|
-
|
19378
|
-
|
19817
|
+
}, [hasNonTextControl, cell.row.id, cell.column.id, cell.row.original, rowIndex, value]);
|
19818
|
+
const blur = React__default.useCallback(function blur() {
|
19819
|
+
requestAnimationFrame(() => {
|
19820
|
+
tableMeta.editing.toggleDetailedMode(false);
|
19821
|
+
tableMeta.editing.onCellChanged(cell, rowIndex, undefined, !hasNonTextControl);
|
19822
|
+
});
|
19823
|
+
}, [hasNonTextControl, cell.row.id, cell.column.id, cell.row.original, rowIndex]);
|
19824
|
+
const handleBlur = React__default.useCallback(event => {
|
19825
|
+
if (isElementInsideOrTriggeredFromContainer(event.relatedTarget, event.currentTarget)) {
|
19826
|
+
return;
|
19827
|
+
}
|
19828
|
+
blur();
|
19829
|
+
}, [blur]);
|
19379
19830
|
// ensure that blur runs when the cell gets unmounted (when vertically arrow key navigating)
|
19380
19831
|
React__default.useEffect(() => {
|
19381
19832
|
const ref = cellRef.current;
|
19382
19833
|
return () => {
|
19383
19834
|
if (document.activeElement === ref || isElementInsideOrTriggeredFromContainer(document.activeElement, ref)) {
|
19384
|
-
|
19835
|
+
blur();
|
19385
19836
|
}
|
19386
19837
|
};
|
19387
19838
|
}, []);
|
@@ -19443,32 +19894,6 @@ const MemoedEditingCell = /*#__PURE__*/React__default.memo(function MemoedEditin
|
|
19443
19894
|
ref: controlRef,
|
19444
19895
|
tabIndex
|
19445
19896
|
};
|
19446
|
-
if (typeof type === 'function') {
|
19447
|
-
const controlFnProps = {
|
19448
|
-
...commonProps,
|
19449
|
-
invalid,
|
19450
|
-
setValue: onChange,
|
19451
|
-
value
|
19452
|
-
};
|
19453
|
-
return type(controlFnProps, {
|
19454
|
-
...row,
|
19455
|
-
...rowPendingChanges
|
19456
|
-
});
|
19457
|
-
}
|
19458
|
-
if (type === 'switch') {
|
19459
|
-
return /*#__PURE__*/React__default.createElement(Switch, Object.assign({}, commonProps, {
|
19460
|
-
checked: Boolean(value),
|
19461
|
-
onChange: onChange,
|
19462
|
-
ref: controlRef
|
19463
|
-
}));
|
19464
|
-
}
|
19465
|
-
if (type === 'checkbox') {
|
19466
|
-
return /*#__PURE__*/React__default.createElement(Checkbox, Object.assign({}, commonProps, {
|
19467
|
-
checked: Boolean(value),
|
19468
|
-
onChange: onChange,
|
19469
|
-
ref: controlRef
|
19470
|
-
}));
|
19471
|
-
}
|
19472
19897
|
const handleInputKeyDown = event => {
|
19473
19898
|
const target = event.target;
|
19474
19899
|
if (target.readOnly) {
|
@@ -19516,6 +19941,39 @@ const MemoedEditingCell = /*#__PURE__*/React__default.memo(function MemoedEditin
|
|
19516
19941
|
toggleDetailedMode(true);
|
19517
19942
|
}
|
19518
19943
|
};
|
19944
|
+
if (typeof type === 'function') {
|
19945
|
+
const controlFnProps = {
|
19946
|
+
...commonProps,
|
19947
|
+
invalid,
|
19948
|
+
setValue: onChange,
|
19949
|
+
onKeyDown: event => {
|
19950
|
+
const target = event.target || null;
|
19951
|
+
// it make sense to handle keydown for the custom edititng controls only if target is either input or textarea
|
19952
|
+
if (target && (target.tagName === 'INPUT' || target.tagName === 'TEXTAREA')) {
|
19953
|
+
handleInputKeyDown(event);
|
19954
|
+
}
|
19955
|
+
},
|
19956
|
+
value
|
19957
|
+
};
|
19958
|
+
return type(controlFnProps, {
|
19959
|
+
...row,
|
19960
|
+
...rowPendingChanges
|
19961
|
+
});
|
19962
|
+
}
|
19963
|
+
if (type === 'switch') {
|
19964
|
+
return /*#__PURE__*/React__default.createElement(Switch, Object.assign({}, commonProps, {
|
19965
|
+
checked: Boolean(value),
|
19966
|
+
onChange: onChange,
|
19967
|
+
ref: controlRef
|
19968
|
+
}));
|
19969
|
+
}
|
19970
|
+
if (type === 'checkbox') {
|
19971
|
+
return /*#__PURE__*/React__default.createElement(Checkbox, Object.assign({}, commonProps, {
|
19972
|
+
checked: Boolean(value),
|
19973
|
+
onChange: onChange,
|
19974
|
+
ref: controlRef
|
19975
|
+
}));
|
19976
|
+
}
|
19519
19977
|
const handleFocus = event => {
|
19520
19978
|
if (!isDetailedMode) {
|
19521
19979
|
event.target.select();
|
@@ -19529,11 +19987,21 @@ const MemoedEditingCell = /*#__PURE__*/React__default.memo(function MemoedEditin
|
|
19529
19987
|
props.onChange(newDate);
|
19530
19988
|
}
|
19531
19989
|
};
|
19990
|
+
const handleDatepickerInputKeyDown = event => {
|
19991
|
+
// When in detailed mode, we want to handle the change, when 'Enter' is pressed.
|
19992
|
+
// To make it possible, we just need to prevent handleInputKeyDown from being executed, and give the full control to Datepicker,
|
19993
|
+
// by doing this, Datepicker will exit "detailed mode" by itself when a valid date change event is triggered.
|
19994
|
+
// In any other cases we'll just execute the "handleInputKeyDown" handler.
|
19995
|
+
if (isDetailedMode && event.key === 'Enter' && event.target.value !== '') {
|
19996
|
+
return;
|
19997
|
+
}
|
19998
|
+
handleInputKeyDown(event);
|
19999
|
+
};
|
19532
20000
|
return /*#__PURE__*/React__default.createElement(Datepicker, Object.assign({}, commonProps, {
|
19533
20001
|
invalid: invalid,
|
19534
20002
|
onChange: handleChange,
|
19535
20003
|
onFocus: handleFocus,
|
19536
|
-
onKeyDown:
|
20004
|
+
onKeyDown: handleDatepickerInputKeyDown,
|
19537
20005
|
ref: controlRef,
|
19538
20006
|
value: valueAsDate
|
19539
20007
|
}));
|
@@ -19625,7 +20093,6 @@ function DiscardChangesConfirmationDialog(props) {
|
|
19625
20093
|
}, /*#__PURE__*/React__default.createElement(Dialog.Title, null, texts.table3.editing.clearChangesConfirmationDialog.title), /*#__PURE__*/React__default.createElement("p", null, texts.table3.editing.clearChangesConfirmationDialog.description), /*#__PURE__*/React__default.createElement(Dialog.Footer, null, /*#__PURE__*/React__default.createElement(Group, null, /*#__PURE__*/React__default.createElement(Dialog.Close, null, /*#__PURE__*/React__default.createElement(Button$1, {
|
19626
20094
|
tabIndex: 0
|
19627
20095
|
}, texts.table3.editing.clearChangesConfirmationDialog.cancel)), /*#__PURE__*/React__default.createElement(Dialog.Close, null, /*#__PURE__*/React__default.createElement(Button$1, {
|
19628
|
-
autoFocus: true,
|
19629
20096
|
tabIndex: 0,
|
19630
20097
|
appearance: "primary",
|
19631
20098
|
onClick: handleDiscard
|
@@ -19784,7 +20251,7 @@ const RENDERERS$1 = {
|
|
19784
20251
|
cell: Cell$5
|
19785
20252
|
};
|
19786
20253
|
function useTable3(props, ref) {
|
19787
|
-
const editing = useTableEditing(props.enableEditing, props.onEditingSave, props.onEditingChange, props.rowIdentityAccessor, props.validator);
|
20254
|
+
const editing = useTableEditing(props.enableEditing, props.onEditingSave, props.onEditingChange, props.onEditingCreate, props.onEditingDiscard, props.rowIdentityAccessor, props.validator);
|
19788
20255
|
const creationEnabled = editing.isEnabled && !!props.onEditingCreate;
|
19789
20256
|
// this gives me the performance heeby jeebies, but can't think of a better way to internalise the state
|
19790
20257
|
const data = React__default.useMemo(() => {
|
@@ -19799,20 +20266,19 @@ function useTable3(props, ref) {
|
|
19799
20266
|
data,
|
19800
20267
|
enableRowActions: editing.isEditing ? true : props.enableRowActions,
|
19801
20268
|
// Display EditingActionMenu instead of row actions while editing
|
19802
|
-
rowActions: editing.isEditing ? [(_, rowId, table) => {
|
20269
|
+
rowActions: editing.isEditing ? [(_, rowId, __, table) => {
|
19803
20270
|
const tableMeta = table.options.meta;
|
19804
20271
|
return /*#__PURE__*/React__default.createElement(EditingActionsMenu, {
|
19805
20272
|
hasChanges: editing.hasChanges(rowId),
|
19806
20273
|
hasErrors: editing.hasRowErrors(rowId),
|
19807
20274
|
onDiscard: () => {
|
20275
|
+
editing.discardChanges(rowId, table);
|
19808
20276
|
if (editing.temporaryRows.length) {
|
19809
|
-
|
19810
|
-
setTimeout(() => {
|
20277
|
+
requestAnimationFrame(() => {
|
19811
20278
|
var _editing$createRowBut;
|
19812
20279
|
return (_editing$createRowBut = editing.createRowButtonRef.current) === null || _editing$createRowBut === void 0 ? void 0 : _editing$createRowBut.focus();
|
19813
|
-
}
|
20280
|
+
});
|
19814
20281
|
}
|
19815
|
-
editing.discardChanges(rowId, table);
|
19816
20282
|
},
|
19817
20283
|
onEditingSave: function () {
|
19818
20284
|
try {
|
@@ -19837,6 +20303,9 @@ function useTable3(props, ref) {
|
|
19837
20303
|
React__default.useEffect(() => {
|
19838
20304
|
if (table.ref.current) {
|
19839
20305
|
table.ref.current.instance.toggleEditing = enabled => table.meta.editing.toggleEditing(enabled !== null && enabled !== void 0 ? enabled : editing => !editing, table.instance, table.renderer.scrollToIndex);
|
20306
|
+
if (props.onEditingCreate) {
|
20307
|
+
table.ref.current.instance.createRow = row => table.meta.editing.createRow(table.instance, row);
|
20308
|
+
}
|
19840
20309
|
}
|
19841
20310
|
}, [table.ref.current]);
|
19842
20311
|
return table;
|
@@ -19875,22 +20344,26 @@ function Alert$1(props) {
|
|
19875
20344
|
// generate links to each invalid row, to go into the error message
|
19876
20345
|
const links = [];
|
19877
20346
|
const visibleColumns = table.getVisibleFlatColumns().map(c => c.id);
|
19878
|
-
const rowIdentityColumn = tableMeta.rowIdentityAccessor && visibleColumns.includes(String(tableMeta.rowIdentityAccessor)) ?
|
20347
|
+
const rowIdentityColumn = tableMeta.rowIdentityAccessor && visibleColumns.includes(String(tableMeta.rowIdentityAccessor)) ?
|
20348
|
+
// table.getColumn(columName) throw error in strict dev mode. Related thread: https://github.com/TanStack/table/discussions/5505
|
20349
|
+
table.getAllColumns().find(x => x.id === String(tableMeta.rowIdentityAccessor)) : undefined;
|
19879
20350
|
pendingChangesWithErrors.forEach((pendingChangeWithError, index) => {
|
20351
|
+
var _row;
|
19880
20352
|
// if appropriate, concatenate the item with the text "and"
|
19881
20353
|
if (pendingChangesWithErrors.length > 1 && index === pendingChangesWithErrors.length - 1) {
|
19882
20354
|
// Add space before and after `messageAnd` text
|
19883
20355
|
links.push(` ${validationTexts.alert.messageAnd} `);
|
19884
20356
|
}
|
19885
|
-
|
20357
|
+
// note: if this row click functionality is removed, indexes can be removed from useEditingState
|
19886
20358
|
const handleClick = () => {
|
19887
20359
|
// if row is visible
|
19888
|
-
if (
|
19889
|
-
scrollToRow(
|
20360
|
+
if (pendingChangeWithError.index > -1) {
|
20361
|
+
scrollToRow(pendingChangeWithError.index);
|
20362
|
+
tableMeta.rowActive.setRowActiveIndex(pendingChangeWithError.index);
|
19890
20363
|
}
|
19891
20364
|
// if row is filtered out
|
19892
20365
|
else {
|
19893
|
-
setShowFilterResetDialog(pendingChangeWithError.
|
20366
|
+
setShowFilterResetDialog(pendingChangeWithError.index);
|
19894
20367
|
}
|
19895
20368
|
};
|
19896
20369
|
let tooltip;
|
@@ -19902,15 +20375,20 @@ function Alert$1(props) {
|
|
19902
20375
|
const columnName = (_table$getAllColumns$ = table.getAllColumns().find(column => column.id === firstCellErrorColumnId)) === null || _table$getAllColumns$ === void 0 ? void 0 : (_table$getAllColumns$2 = _table$getAllColumns$.columnDef.meta) === null || _table$getAllColumns$2 === void 0 ? void 0 : _table$getAllColumns$2.header;
|
19903
20376
|
tooltip = `${columnName}: ${pendingChangeWithError.errors.cells[firstCellErrorColumnId]}`;
|
19904
20377
|
}
|
19905
|
-
|
19906
|
-
|
19907
|
-
|
20378
|
+
let row;
|
20379
|
+
try {
|
20380
|
+
row = table.getRow(pendingChangeWithError.rowId).original;
|
20381
|
+
} catch {
|
20382
|
+
// because of server loading, some rows may not be accessible
|
20383
|
+
}
|
20384
|
+
links.push(/*#__PURE__*/React__default.createElement(Tooltip, {
|
20385
|
+
key: pendingChangeWithError.rowId,
|
19908
20386
|
title: tooltip
|
19909
20387
|
}, /*#__PURE__*/React__default.createElement("span", {
|
19910
20388
|
className: "text-blue",
|
19911
20389
|
onClick: handleClick,
|
19912
20390
|
role: "button"
|
19913
|
-
}, rowIdentityColumn ? row[rowIdentityColumn.id] :
|
20391
|
+
}, rowIdentityColumn ? (_row = row) === null || _row === void 0 ? void 0 : _row[rowIdentityColumn.id] : pendingChangeWithError.index + 1)));
|
19914
20392
|
// if appropriate, concatenate the item with the text ","
|
19915
20393
|
if (pendingChangesWithErrors.length > 2 && index < pendingChangesWithErrors.length - 2) {
|
19916
20394
|
links.push(', ');
|
@@ -19931,9 +20409,8 @@ function Alert$1(props) {
|
|
19931
20409
|
table.resetGlobalFilter();
|
19932
20410
|
table.resetColumnFilters();
|
19933
20411
|
requestAnimationFrame(() => {
|
19934
|
-
|
19935
|
-
|
19936
|
-
scrollToRow(rowIndex);
|
20412
|
+
if (showFilterResetDialog && showFilterResetDialog > -1) {
|
20413
|
+
scrollToRow(showFilterResetDialog);
|
19937
20414
|
}
|
19938
20415
|
setShowFilterResetDialog(false);
|
19939
20416
|
});
|
@@ -19977,7 +20454,11 @@ function Editing(props) {
|
|
19977
20454
|
const ref = React__default.useRef(null);
|
19978
20455
|
const tableMeta = table.options.meta;
|
19979
20456
|
const handleChange = enabled => {
|
20457
|
+
var _tableMeta$onEvent;
|
19980
20458
|
tableMeta.editing.toggleEditing(enabled, table, scrollToIndex);
|
20459
|
+
(_tableMeta$onEvent = tableMeta.onEvent) === null || _tableMeta$onEvent === void 0 ? void 0 : _tableMeta$onEvent.call(tableMeta, 'editing-mode', {
|
20460
|
+
enabled
|
20461
|
+
});
|
19981
20462
|
};
|
19982
20463
|
const tooltip = /*#__PURE__*/React__default.createElement(React__default.Fragment, null, texts.table3.editing.buttons.edit.tooltip, /*#__PURE__*/React__default.createElement(Shortcut, {
|
19983
20464
|
className: "ml-2",
|
@@ -19994,14 +20475,12 @@ function Editing(props) {
|
|
19994
20475
|
}
|
19995
20476
|
|
19996
20477
|
function CreateNewRow(props) {
|
19997
|
-
var _temporaryRows$0$tabl, _temporaryRows$, _table$getState$colum
|
20478
|
+
var _temporaryRows$0$tabl, _temporaryRows$, _table$getState$colum;
|
19998
20479
|
const {
|
19999
20480
|
buttonRef,
|
20000
|
-
|
20001
|
-
scrollToIndex,
|
20481
|
+
isScrolled,
|
20002
20482
|
table,
|
20003
|
-
tableMeta
|
20004
|
-
tableRef
|
20483
|
+
tableMeta
|
20005
20484
|
} = props;
|
20006
20485
|
const {
|
20007
20486
|
texts
|
@@ -20010,44 +20489,16 @@ function CreateNewRow(props) {
|
|
20010
20489
|
const temporaryRowId = (_temporaryRows$0$tabl = (_temporaryRows$ = temporaryRows[0]) === null || _temporaryRows$ === void 0 ? void 0 : _temporaryRows$[tableMeta.rowIdentityAccessor]) !== null && _temporaryRows$0$tabl !== void 0 ? _temporaryRows$0$tabl : '';
|
20011
20490
|
const isDisabled = !!table.getState().globalFilter || !!((_table$getState$colum = table.getState().columnFilters) !== null && _table$getState$colum !== void 0 && _table$getState$colum.length) || !!temporaryRowId && !!tableMeta.editing.hasRowErrors(temporaryRowId);
|
20012
20491
|
const isSaving = !!temporaryRowId && tableMeta.editing.getRowStatus(temporaryRowId) === 'saving';
|
20013
|
-
const
|
20492
|
+
const handleCreate = function () {
|
20014
20493
|
try {
|
20015
|
-
if (
|
20494
|
+
if (isDisabled) {
|
20016
20495
|
return Promise.resolve();
|
20017
20496
|
}
|
20018
|
-
return Promise.resolve(tableMeta.editing.
|
20019
|
-
if (!saved) {
|
20020
|
-
return;
|
20021
|
-
}
|
20022
|
-
const changeset = row !== null && row !== void 0 ? row : handleEditingCreate();
|
20023
|
-
try {
|
20024
|
-
if (changeset) {
|
20025
|
-
const rowId = tableMeta.editing.createRow(changeset);
|
20026
|
-
table.getRow(rowId).pin('bottom');
|
20027
|
-
// set the active row to the new row before toggling editing on
|
20028
|
-
const nextRowIndex = temporaryRows.length ? tableMeta.length + 1 : tableMeta.length;
|
20029
|
-
tableMeta.rowActive.setRowActiveIndex(nextRowIndex);
|
20030
|
-
tableMeta.editing.toggleEditing(true, table, scrollToIndex);
|
20031
|
-
tableMeta.editing.setLastFocusedCellIndex(0);
|
20032
|
-
}
|
20033
|
-
} catch (error) {
|
20034
|
-
console.error(error);
|
20035
|
-
}
|
20036
|
-
});
|
20497
|
+
return Promise.resolve(tableMeta.editing.createRow(table)).then(function () {});
|
20037
20498
|
} catch (e) {
|
20038
20499
|
return Promise.reject(e);
|
20039
20500
|
}
|
20040
20501
|
};
|
20041
|
-
// allow programmatic access to creating rows from outside the table
|
20042
|
-
React__default.useEffect(() => {
|
20043
|
-
var _tableRef$current;
|
20044
|
-
if (tableRef !== null && tableRef !== void 0 && (_tableRef$current = tableRef.current) !== null && _tableRef$current !== void 0 && _tableRef$current.instance) {
|
20045
|
-
tableRef.current.instance.createRow = createRow;
|
20046
|
-
}
|
20047
|
-
}, [tableRef === null || tableRef === void 0 ? void 0 : (_tableRef$current2 = tableRef.current) === null || _tableRef$current2 === void 0 ? void 0 : _tableRef$current2.instance, createRow]);
|
20048
|
-
const handleCreate = function () {
|
20049
|
-
return createRow();
|
20050
|
-
};
|
20051
20502
|
const shortcut = {
|
20052
20503
|
key: 'Enter',
|
20053
20504
|
meta: true
|
@@ -20062,11 +20513,9 @@ function CreateNewRow(props) {
|
|
20062
20513
|
keys: shortcut
|
20063
20514
|
});
|
20064
20515
|
}
|
20065
|
-
const isScrolled = tableRef.current ? tableRef.current.scrollHeight > tableRef.current.clientHeight : false;
|
20066
20516
|
const className = cn('group/row border-grey-300 !sticky z-[21]', {
|
20067
20517
|
'bottom-10': tableMeta.footer.isEnabled,
|
20068
20518
|
'bottom-0': !tableMeta.footer.isEnabled,
|
20069
|
-
'border-t-2': isScrolled,
|
20070
20519
|
'border-b': !isScrolled
|
20071
20520
|
});
|
20072
20521
|
return /*#__PURE__*/React__default.createElement("tr", {
|
@@ -20091,6 +20540,7 @@ function CreateNewRow(props) {
|
|
20091
20540
|
function TemporaryRow(props) {
|
20092
20541
|
const {
|
20093
20542
|
createRowButtonRef,
|
20543
|
+
isScrolled,
|
20094
20544
|
table,
|
20095
20545
|
tableMeta,
|
20096
20546
|
tableRef
|
@@ -20153,10 +20603,9 @@ function TemporaryRow(props) {
|
|
20153
20603
|
}
|
20154
20604
|
}
|
20155
20605
|
};
|
20156
|
-
const
|
20157
|
-
|
20158
|
-
'bottom-[calc(5rem_+
|
20159
|
-
'bottom-[calc(2.5rem_+_3px)] data-[row-editing-move]:bottom-[calc(2.5rem_+_2px)]': !tableMeta.footer.isEnabled,
|
20606
|
+
const className = cn('group/row border-grey-300 !sticky z-[22] print:hidden', {
|
20607
|
+
'bottom-[calc(5rem_+_2px)] data-[row-editing-move]:bottom-[calc(5rem_+_2px)]': tableMeta.footer.isEnabled,
|
20608
|
+
'bottom-[calc(2.5rem_+_2px)] data-[row-editing-move]:bottom-[calc(2.5rem_+_2px)]': !tableMeta.footer.isEnabled,
|
20160
20609
|
'border-t-2 shadow-[0px_-5px_20px_0px_rgba(0,0,0,0.1)] [&>td]:!border-b-0': isScrolled
|
20161
20610
|
});
|
20162
20611
|
return /*#__PURE__*/React__default.createElement(React__default.Fragment, null, table.getBottomRows().map(row => (/*#__PURE__*/React__default.createElement(Row, {
|
@@ -20170,14 +20619,13 @@ function TemporaryRow(props) {
|
|
20170
20619
|
className: className,
|
20171
20620
|
onKeyDown: handleKeyDown,
|
20172
20621
|
onKeyDownCapture: handleKeyDownCapture,
|
20173
|
-
|
20174
|
-
hideRowActions: !tableMeta.editing.isEditing
|
20622
|
+
hideInternalColumns: true,
|
20623
|
+
hideRowActions: !tableMeta.editing.isEditing,
|
20624
|
+
skipPageLoading: true
|
20175
20625
|
}))));
|
20176
20626
|
}
|
20177
20627
|
|
20178
|
-
|
20179
|
-
return null;
|
20180
|
-
}
|
20628
|
+
const Column$3 = () => null;
|
20181
20629
|
Column$3.displayName = 'Table3Column';
|
20182
20630
|
function Group$5(_) {
|
20183
20631
|
return null;
|
@@ -20190,8 +20638,25 @@ const BaseTable3 = /*#__PURE__*/fixedForwardRef(function BaseTable3(props, ref)
|
|
20190
20638
|
'data-table-editing-mode': (_table3$meta$editing = table3.meta.editing) !== null && _table3$meta$editing !== void 0 && _table3$meta$editing.isEditing ? (_table3$meta$editing2 = table3.meta.editing) !== null && _table3$meta$editing2 !== void 0 && _table3$meta$editing2.isDetailedMode ? 'detailed' : 'normal' : undefined,
|
20191
20639
|
enableHorizontalArrowKeyNavigation: table3.meta.editing.isEditing
|
20192
20640
|
};
|
20193
|
-
const
|
20641
|
+
const rowsById = table3.instance.getCoreRowModel().rowsById;
|
20642
|
+
const hasAlertErrors = table3.meta.editing.getErrorsShownInAlert().filter(row => {
|
20643
|
+
if (table3.meta.server._experimentalDataLoader2) {
|
20644
|
+
// consumers of dataloader2 need to run a cleanup function, as this would otherwise return false when pages are unloaded.
|
20645
|
+
return true;
|
20646
|
+
}
|
20647
|
+
return rowsById[row.rowId];
|
20648
|
+
}).length;
|
20194
20649
|
const hasCreateWorkflow = table3.meta.editing.isEnabled && props.onEditingCreate;
|
20650
|
+
const isScrolled = isTableScrolled(table3.ref);
|
20651
|
+
let createWorkflow;
|
20652
|
+
if (hasCreateWorkflow) {
|
20653
|
+
createWorkflow = /*#__PURE__*/React__default.createElement(CreateNewRow, {
|
20654
|
+
buttonRef: table3.meta.editing.createRowButtonRef,
|
20655
|
+
isScrolled: isScrolled,
|
20656
|
+
table: table3.instance,
|
20657
|
+
tableMeta: table3.meta
|
20658
|
+
});
|
20659
|
+
}
|
20195
20660
|
return /*#__PURE__*/React__default.createElement(Table, null, /*#__PURE__*/React__default.createElement(Table.Toolbar, {
|
20196
20661
|
table: table3
|
20197
20662
|
}, table3.meta.editing.isEnabled ? (/*#__PURE__*/React__default.createElement(Editing, {
|
@@ -20204,20 +20669,15 @@ const BaseTable3 = /*#__PURE__*/fixedForwardRef(function BaseTable3(props, ref)
|
|
20204
20669
|
tableRef: table3.ref
|
20205
20670
|
})) : null, /*#__PURE__*/React__default.createElement(Table.Grid, Object.assign({}, gridAttributes, {
|
20206
20671
|
"data-taco": "table3",
|
20672
|
+
footerRows: hasCreateWorkflow && isScrolled ? createWorkflow : undefined,
|
20207
20673
|
table: table3
|
20208
20674
|
}), hasCreateWorkflow ? (/*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement(TemporaryRow, {
|
20209
20675
|
createRowButtonRef: table3.meta.editing.createRowButtonRef,
|
20676
|
+
isScrolled: isScrolled,
|
20210
20677
|
table: table3.instance,
|
20211
20678
|
tableMeta: table3.meta,
|
20212
20679
|
tableRef: table3.ref
|
20213
|
-
}),
|
20214
|
-
buttonRef: table3.meta.editing.createRowButtonRef,
|
20215
|
-
onEditingCreate: props.onEditingCreate,
|
20216
|
-
scrollToIndex: table3.renderer.scrollToIndex,
|
20217
|
-
table: table3.instance,
|
20218
|
-
tableMeta: table3.meta,
|
20219
|
-
tableRef: table3.ref
|
20220
|
-
}))) : null));
|
20680
|
+
}), !isScrolled ? createWorkflow : null)) : null));
|
20221
20681
|
});
|
20222
20682
|
const Table3 = /*#__PURE__*/fixedForwardRef(function Table3(props, ref) {
|
20223
20683
|
const stringifiedChildren = String(props.children);
|
@@ -20453,6 +20913,796 @@ const Tour = props => {
|
|
20453
20913
|
};
|
20454
20914
|
Tour.Step = TourStep;
|
20455
20915
|
|
20916
|
+
// NOTE: this file is intentianally a js file so that it can be consumed by tailwind.config.js
|
20917
|
+
|
20918
|
+
const THEME_COLORS = {
|
20919
|
+
transparent: 'transparent',
|
20920
|
+
current: 'currentColor',
|
20921
|
+
white: '#fff',
|
20922
|
+
black: '#1c1c1c',
|
20923
|
+
brand: {
|
20924
|
+
vismaRed: '#E70641',
|
20925
|
+
paleOrange: '#FFF5E5',
|
20926
|
+
sunsetOrange: '#E89C2E',
|
20927
|
+
midnightBlue: '#29283E',
|
20928
|
+
coolBlue: '#F5F7F9'
|
20929
|
+
},
|
20930
|
+
grey: {
|
20931
|
+
lightest: '#fafafa',
|
20932
|
+
light: '#F6F6F6',
|
20933
|
+
DEFAULT: '#EBEBEB',
|
20934
|
+
dark: '#DDDDDD',
|
20935
|
+
darker: '#ACACAC',
|
20936
|
+
darkest: '#595959',
|
20937
|
+
darkNew: '#a5a6a9',
|
20938
|
+
50: '#fafafa',
|
20939
|
+
100: '#F6F6F6',
|
20940
|
+
200: '#EBEBEB',
|
20941
|
+
300: '#DDDDDD',
|
20942
|
+
500: '#ACACAC',
|
20943
|
+
700: '#595959',
|
20944
|
+
900: '#303030'
|
20945
|
+
},
|
20946
|
+
purple: {
|
20947
|
+
lightest: '#585c74',
|
20948
|
+
light: '#4b4f64',
|
20949
|
+
DEFAULT: '#3d4153',
|
20950
|
+
dark: '#353a48',
|
20951
|
+
darker: '#29283e',
|
20952
|
+
darkest: '#212032',
|
20953
|
+
darkNew_1: '#373647',
|
20954
|
+
darkNew_2: '#414050',
|
20955
|
+
100: '#EEE5FF',
|
20956
|
+
200: '#ddd1ff',
|
20957
|
+
300: '#CBBCFE',
|
20958
|
+
500: '#9270FA',
|
20959
|
+
700: '#6542D1',
|
20960
|
+
900: '#412970'
|
20961
|
+
},
|
20962
|
+
blue: {
|
20963
|
+
lightest: '#DEEBFF',
|
20964
|
+
light: '#75A0F5',
|
20965
|
+
DEFAULT: '#4573D2',
|
20966
|
+
dark: '#2B57B4',
|
20967
|
+
100: '#DEEBFF',
|
20968
|
+
200: '#AACCFF',
|
20969
|
+
300: '#75A0F5',
|
20970
|
+
500: '#4573D2',
|
20971
|
+
700: '#2B57B4',
|
20972
|
+
900: '#29283E'
|
20973
|
+
},
|
20974
|
+
red: {
|
20975
|
+
lightest: '#FFDAD2',
|
20976
|
+
light: '#E66568',
|
20977
|
+
DEFAULT: '#CE3F42',
|
20978
|
+
dark: '#950027',
|
20979
|
+
100: '#FFDAD2',
|
20980
|
+
200: '#f3a09d',
|
20981
|
+
300: '#E66568',
|
20982
|
+
500: '#CE3F42',
|
20983
|
+
700: '#950027',
|
20984
|
+
900: '#64001B'
|
20985
|
+
},
|
20986
|
+
green: {
|
20987
|
+
lightest: '#cdf0e7',
|
20988
|
+
light: '#52C7AB',
|
20989
|
+
DEFAULT: '#08AE87',
|
20990
|
+
dark: '#028465',
|
20991
|
+
100: '#cdf0e7',
|
20992
|
+
200: '#9be1ce',
|
20993
|
+
300: '#52C7AB',
|
20994
|
+
500: '#08AE87',
|
20995
|
+
700: '#028465',
|
20996
|
+
900: '#14493A'
|
20997
|
+
},
|
20998
|
+
yellow: {
|
20999
|
+
lightest: '#FFF1C3',
|
21000
|
+
light: '#FFD665',
|
21001
|
+
DEFAULT: '#FFBD3B',
|
21002
|
+
dark: '#e89c2e',
|
21003
|
+
100: '#FFF1C3',
|
21004
|
+
200: '#ffe494',
|
21005
|
+
300: '#FFD665',
|
21006
|
+
500: '#FFBD3B',
|
21007
|
+
700: '#e89c2e',
|
21008
|
+
900: '#733700'
|
21009
|
+
},
|
21010
|
+
pink: {
|
21011
|
+
100: '#FFE3F7',
|
21012
|
+
200: '#fcb9e9',
|
21013
|
+
300: '#F98EDB',
|
21014
|
+
500: '#E165BF',
|
21015
|
+
700: '#CF49AA',
|
21016
|
+
900: '#870062'
|
21017
|
+
},
|
21018
|
+
brown: {
|
21019
|
+
100: '#EEE0DA',
|
21020
|
+
200: '#DFCCC2',
|
21021
|
+
300: '#C4AB9E',
|
21022
|
+
500: '#93715D',
|
21023
|
+
700: '#73503B',
|
21024
|
+
900: '#45291F'
|
21025
|
+
},
|
21026
|
+
orange: {
|
21027
|
+
100: '#FFE3BB',
|
21028
|
+
200: '#FCCB80',
|
21029
|
+
300: '#FAB64D',
|
21030
|
+
500: '#F99702',
|
21031
|
+
700: '#EF7D00',
|
21032
|
+
900: '#4A2811'
|
21033
|
+
}
|
21034
|
+
};
|
21035
|
+
|
21036
|
+
const mapColor = (palette, prefix = '') => {
|
21037
|
+
return Object.keys(palette).reduce((accum, color) => {
|
21038
|
+
if (color === 'current') {
|
21039
|
+
return accum;
|
21040
|
+
} else if (typeof palette[color] === 'string') {
|
21041
|
+
return {
|
21042
|
+
...accum,
|
21043
|
+
[prefix ? color === 'DEFAULT' ? prefix : `${prefix}-${color}` : color]: palette[color]
|
21044
|
+
};
|
21045
|
+
} else {
|
21046
|
+
return {
|
21047
|
+
...accum,
|
21048
|
+
...mapColor(palette[color], color)
|
21049
|
+
};
|
21050
|
+
}
|
21051
|
+
}, {});
|
21052
|
+
};
|
21053
|
+
const colors = /*#__PURE__*/mapColor(THEME_COLORS);
|
21054
|
+
const getThemeColor = color => colors[color];
|
21055
|
+
|
21056
|
+
function Legend(props) {
|
21057
|
+
const {
|
21058
|
+
activeIndex,
|
21059
|
+
onMouseEnter,
|
21060
|
+
onMouseLeave,
|
21061
|
+
onClick,
|
21062
|
+
payload,
|
21063
|
+
layout,
|
21064
|
+
activeItems
|
21065
|
+
} = props;
|
21066
|
+
const [hoverIndex, setHoverIndex] = React.useState(null);
|
21067
|
+
const handleMouseEnter = (entry, index) => {
|
21068
|
+
setHoverIndex(index);
|
21069
|
+
if (activeItems[entry.dataKey]) onMouseEnter(entry, index);
|
21070
|
+
};
|
21071
|
+
const handleMouseLeave = () => {
|
21072
|
+
onMouseLeave();
|
21073
|
+
setHoverIndex(null);
|
21074
|
+
};
|
21075
|
+
const moreButton = moreButtonText => (/*#__PURE__*/React__default.createElement(Button$1, {
|
21076
|
+
appearance: "transparent",
|
21077
|
+
className: "text-grey-700"
|
21078
|
+
}, moreButtonText));
|
21079
|
+
return /*#__PURE__*/React__default.createElement("div", {
|
21080
|
+
className: "mx-auto w-auto max-w-full overflow-hidden"
|
21081
|
+
}, /*#__PURE__*/React__default.createElement("div", {
|
21082
|
+
className: cn('mb-0 ml-0 flex justify-center', {
|
21083
|
+
'flex-col': layout === 'vertical'
|
21084
|
+
})
|
21085
|
+
}, /*#__PURE__*/React__default.createElement(OverflowGroup, {
|
21086
|
+
className: "w-full items-center py-1",
|
21087
|
+
moreButton: moreButton
|
21088
|
+
}, payload.map((entry, index) => (/*#__PURE__*/React__default.createElement("span", {
|
21089
|
+
key: `${entry.dataKey}-${index}`,
|
21090
|
+
className: cn(' hover:bg-grey-100 cursor-pointer px-[8px] py-[2px] hover:rounded-[4px]', {
|
21091
|
+
'bg-grey-100 rounded': activeIndex === index
|
21092
|
+
}),
|
21093
|
+
onMouseEnter: () => handleMouseEnter(entry, index),
|
21094
|
+
onMouseLeave: handleMouseLeave,
|
21095
|
+
onClick: onClick ? () => onClick(entry) : undefined
|
21096
|
+
}, /*#__PURE__*/React__default.createElement("span", {
|
21097
|
+
className: "text-grey-700 flex items-center gap-[4px]"
|
21098
|
+
}, /*#__PURE__*/React__default.createElement("span", {
|
21099
|
+
className: cn('-mt-px ml-1 flex h-3 w-3 rounded-sm', {
|
21100
|
+
'border-grey-300 border !bg-white': !activeItems[entry.dataKey]
|
21101
|
+
}),
|
21102
|
+
style: {
|
21103
|
+
backgroundColor: entry.color
|
21104
|
+
}
|
21105
|
+
}, hoverIndex === index && activeItems[entry.dataKey] && (/*#__PURE__*/React__default.createElement(Icon, {
|
21106
|
+
name: "tick-bold",
|
21107
|
+
className: "!h-full !w-full text-white"
|
21108
|
+
}))), entry.value)))))));
|
21109
|
+
}
|
21110
|
+
|
21111
|
+
const Tooltip$2 = ({
|
21112
|
+
active,
|
21113
|
+
formatter,
|
21114
|
+
payload,
|
21115
|
+
style,
|
21116
|
+
singlePieDonutChart
|
21117
|
+
}) => {
|
21118
|
+
const getColor = entry => {
|
21119
|
+
var _ref, _entry$color;
|
21120
|
+
if (singlePieDonutChart) {
|
21121
|
+
// We use entry.payload.label because the payload structure differs between a Donut chart with a single pie
|
21122
|
+
// and one with multiple pies.
|
21123
|
+
return getThemeColor(entry.payload.color);
|
21124
|
+
}
|
21125
|
+
return (_ref = (_entry$color = entry.color) !== null && _entry$color !== void 0 ? _entry$color : entry.payload.fill) !== null && _ref !== void 0 ? _ref : 'blue-500';
|
21126
|
+
};
|
21127
|
+
if (active && payload && payload.length) {
|
21128
|
+
return /*#__PURE__*/React__default.createElement("dl", {
|
21129
|
+
className: "z-20 grid grid-cols-[max-content_max-content] gap-x-4 rounded-md bg-white p-4 text-xs shadow-[0px_0px_1px_rgba(0,0,0,0.1),_0px_6px_18px_rgba(47,51,68,0.2)]",
|
21130
|
+
style: style
|
21131
|
+
}, payload.map((entry, index) => (/*#__PURE__*/React__default.createElement(React__default.Fragment, {
|
21132
|
+
key: `${entry.name}-${index}`
|
21133
|
+
}, /*#__PURE__*/React__default.createElement("dt", {
|
21134
|
+
className: "text-grey-700 mb-0 flex items-center gap-1 font-normal"
|
21135
|
+
}, /*#__PURE__*/React__default.createElement("span", {
|
21136
|
+
className: "-mt-px h-2.5 w-2.5 rounded-sm",
|
21137
|
+
style: {
|
21138
|
+
background: getColor(entry)
|
21139
|
+
}
|
21140
|
+
}),
|
21141
|
+
// We use entry.payload.label because the payload structure differs between a Donut chart with a single pie
|
21142
|
+
// and one with multiple pies.
|
21143
|
+
singlePieDonutChart ? entry.payload.label : entry.name), /*#__PURE__*/React__default.createElement("dd", {
|
21144
|
+
className: "mb-0 text-right font-bold text-black "
|
21145
|
+
}, formatter ? formatter(entry.value) : entry.value)))));
|
21146
|
+
}
|
21147
|
+
return null;
|
21148
|
+
};
|
21149
|
+
|
21150
|
+
const getCartesianGridProps = () => ({
|
21151
|
+
vertical: false
|
21152
|
+
});
|
21153
|
+
const getXAxisProps = props => ({
|
21154
|
+
axisLine: false,
|
21155
|
+
dataKey: props.accessor,
|
21156
|
+
fontSize: 12,
|
21157
|
+
scale: props.xAxisScale,
|
21158
|
+
tickLine: false,
|
21159
|
+
tickFormatter: props.xAxisTickFormat
|
21160
|
+
});
|
21161
|
+
const getYAxisProps = props => ({
|
21162
|
+
axisLine: false,
|
21163
|
+
fontSize: 12,
|
21164
|
+
scale: props.yAxisScale,
|
21165
|
+
tickLine: false,
|
21166
|
+
tickFormatter: props.yAxisTickFormat
|
21167
|
+
});
|
21168
|
+
const getLegendProps = props => ({
|
21169
|
+
content: /*#__PURE__*/React__default.createElement(Legend, Object.assign({}, props))
|
21170
|
+
});
|
21171
|
+
const getTooltipProps = (props = undefined) => ({
|
21172
|
+
content: /*#__PURE__*/React__default.createElement(Tooltip$2, Object.assign({}, props)),
|
21173
|
+
wrapperStyle: {
|
21174
|
+
outline: 'none'
|
21175
|
+
}
|
21176
|
+
});
|
21177
|
+
|
21178
|
+
// A hacky fix for EC-50037 to make sure that Chart doesn't resize when it is inside a Card.
|
21179
|
+
const ResponsiveContainer = props => (/*#__PURE__*/React__default.createElement(Recharts.ResponsiveContainer, Object.assign({
|
21180
|
+
className: "!h-[calc(100%-1px)] !w-[calc(100%-1px)]"
|
21181
|
+
}, props)));
|
21182
|
+
|
21183
|
+
const Area = _ => null;
|
21184
|
+
const AreaChart = function AreaChart(externalProps) {
|
21185
|
+
const {
|
21186
|
+
children,
|
21187
|
+
data,
|
21188
|
+
formatter,
|
21189
|
+
...props
|
21190
|
+
} = externalProps;
|
21191
|
+
const [hoveredArea, setHoveredArea] = React.useState(null);
|
21192
|
+
const [activeAreas, setActiveAreas] = React.useState(() => {
|
21193
|
+
const areas = {};
|
21194
|
+
React__default.Children.forEach(children, child => {
|
21195
|
+
areas[child.props.accessor] = true;
|
21196
|
+
});
|
21197
|
+
return areas;
|
21198
|
+
});
|
21199
|
+
const handleLegendClick = entry => {
|
21200
|
+
setHoveredArea(null);
|
21201
|
+
setActiveAreas({
|
21202
|
+
...activeAreas,
|
21203
|
+
[entry.dataKey]: !activeAreas[entry.dataKey]
|
21204
|
+
});
|
21205
|
+
};
|
21206
|
+
return /*#__PURE__*/React__default.createElement(ResponsiveContainer, null, /*#__PURE__*/React__default.createElement(Recharts.AreaChart, {
|
21207
|
+
data: data,
|
21208
|
+
margin: {
|
21209
|
+
top: 10,
|
21210
|
+
right: 0,
|
21211
|
+
left: -25,
|
21212
|
+
bottom: 0
|
21213
|
+
}
|
21214
|
+
}, /*#__PURE__*/React__default.createElement(Recharts.CartesianGrid, Object.assign({}, getCartesianGridProps())), /*#__PURE__*/React__default.createElement(Recharts.XAxis, Object.assign({}, getXAxisProps(props))), /*#__PURE__*/React__default.createElement(Recharts.YAxis, Object.assign({}, getYAxisProps(props))), /*#__PURE__*/React__default.createElement(Recharts.Legend, Object.assign({}, getLegendProps({
|
21215
|
+
onClick: handleLegendClick,
|
21216
|
+
onMouseEnter: entry => setHoveredArea(entry.dataKey),
|
21217
|
+
onMouseLeave: () => setHoveredArea(null),
|
21218
|
+
activeItems: activeAreas
|
21219
|
+
}))), /*#__PURE__*/React__default.createElement(Recharts.Tooltip, Object.assign({}, getTooltipProps(), {
|
21220
|
+
formatter: formatter
|
21221
|
+
})), React__default.Children.map(children, child => {
|
21222
|
+
var _child$props$color, _child$props$color2, _child$props$color3;
|
21223
|
+
return /*#__PURE__*/React__default.createElement(Recharts.Area, {
|
21224
|
+
activeDot: {
|
21225
|
+
fill: getThemeColor((_child$props$color = child.props.color) !== null && _child$props$color !== void 0 ? _child$props$color : 'blue-300')
|
21226
|
+
},
|
21227
|
+
isAnimationActive: false,
|
21228
|
+
dataKey: child.props.accessor,
|
21229
|
+
dot: false,
|
21230
|
+
fill: getThemeColor((_child$props$color2 = child.props.color) !== null && _child$props$color2 !== void 0 ? _child$props$color2 : 'grey-100'),
|
21231
|
+
name: child.props.label,
|
21232
|
+
strokeWidth: 2,
|
21233
|
+
stroke: getThemeColor((_child$props$color3 = child.props.color) !== null && _child$props$color3 !== void 0 ? _child$props$color3 : 'grey-300'),
|
21234
|
+
stackId: child.props.stackId,
|
21235
|
+
hide: !activeAreas[child.props.accessor],
|
21236
|
+
opacity: hoveredArea && child.props.accessor !== hoveredArea ? 0.3 : 1
|
21237
|
+
});
|
21238
|
+
})));
|
21239
|
+
};
|
21240
|
+
AreaChart.Area = Area;
|
21241
|
+
|
21242
|
+
const Bar$1 = _ => null;
|
21243
|
+
const getXAxisVerticalProps = props => ({
|
21244
|
+
...getXAxisProps(props),
|
21245
|
+
...{
|
21246
|
+
type: 'number',
|
21247
|
+
dataKey: undefined
|
21248
|
+
}
|
21249
|
+
});
|
21250
|
+
const getYAxisVerticalProps = props => ({
|
21251
|
+
...getYAxisProps(props),
|
21252
|
+
...{
|
21253
|
+
dataKey: props.accessor,
|
21254
|
+
type: 'category'
|
21255
|
+
}
|
21256
|
+
});
|
21257
|
+
const BarChart = function BarChart(externalProps) {
|
21258
|
+
const {
|
21259
|
+
children,
|
21260
|
+
data,
|
21261
|
+
formatter,
|
21262
|
+
layout = 'horizontal',
|
21263
|
+
...props
|
21264
|
+
} = externalProps;
|
21265
|
+
const [activeIndex, setActiveIndex] = React__default.useState(undefined);
|
21266
|
+
const [hoveredBar, setHoveredBar] = React.useState(null);
|
21267
|
+
const [activeBars, setActiveBars] = React.useState(() => {
|
21268
|
+
const keys = {};
|
21269
|
+
React__default.Children.forEach(children, child => {
|
21270
|
+
keys[child.props.accessor] = true;
|
21271
|
+
});
|
21272
|
+
return keys;
|
21273
|
+
});
|
21274
|
+
// Recharts doesn't provide a way for us to know if a stacked bar is at the top or the bottom,
|
21275
|
+
// so we can't set proper radiuses without some "magic"
|
21276
|
+
const stacks = {};
|
21277
|
+
React__default.Children.forEach(children, child => {
|
21278
|
+
if (child.props.stackId) {
|
21279
|
+
if (!stacks[child.props.stackId]) {
|
21280
|
+
stacks[child.props.stackId] = [child.props.accessor];
|
21281
|
+
} else {
|
21282
|
+
stacks[child.props.stackId].push(child.props.accessor);
|
21283
|
+
}
|
21284
|
+
}
|
21285
|
+
});
|
21286
|
+
const handleLegendClick = entry => {
|
21287
|
+
setHoveredBar(null);
|
21288
|
+
setActiveBars({
|
21289
|
+
...activeBars,
|
21290
|
+
[entry.dataKey]: !activeBars[entry.dataKey]
|
21291
|
+
});
|
21292
|
+
};
|
21293
|
+
const handleLegendHover = (entry, index) => {
|
21294
|
+
setHoveredBar(entry.dataKey);
|
21295
|
+
setActiveIndex(index);
|
21296
|
+
};
|
21297
|
+
return /*#__PURE__*/React__default.createElement(ResponsiveContainer, null, /*#__PURE__*/React__default.createElement(Recharts.BarChart, {
|
21298
|
+
layout: layout,
|
21299
|
+
data: data,
|
21300
|
+
margin: {
|
21301
|
+
top: 10,
|
21302
|
+
right: 0,
|
21303
|
+
left: layout === 'vertical' ? 0 : -25,
|
21304
|
+
bottom: 0
|
21305
|
+
},
|
21306
|
+
onMouseMove: chartState => setActiveIndex(chartState.activeTooltipIndex),
|
21307
|
+
onMouseLeave: () => setActiveIndex(undefined)
|
21308
|
+
}, /*#__PURE__*/React__default.createElement(Recharts.CartesianGrid, Object.assign({}, getCartesianGridProps())), /*#__PURE__*/React__default.createElement(Recharts.XAxis, Object.assign({}, layout === 'vertical' ? getXAxisVerticalProps(props) : getXAxisProps(props))), /*#__PURE__*/React__default.createElement(Recharts.YAxis, Object.assign({}, layout === 'vertical' ? getYAxisVerticalProps(props) : getYAxisProps(props))), /*#__PURE__*/React__default.createElement(Recharts.Legend, Object.assign({}, getLegendProps({
|
21309
|
+
onClick: handleLegendClick,
|
21310
|
+
onMouseEnter: handleLegendHover,
|
21311
|
+
onMouseLeave: () => setHoveredBar(null),
|
21312
|
+
activeItems: activeBars
|
21313
|
+
}))), /*#__PURE__*/React__default.createElement(Recharts.Tooltip, Object.assign({}, getTooltipProps(), {
|
21314
|
+
formatter: formatter
|
21315
|
+
})), React__default.Children.map(children, child => (/*#__PURE__*/React__default.createElement(Recharts.Bar, {
|
21316
|
+
isAnimationActive: false,
|
21317
|
+
barSize: 16,
|
21318
|
+
dataKey: child.props.accessor,
|
21319
|
+
name: child.props.label,
|
21320
|
+
onMouseEnter: (_, index) => setActiveIndex(index),
|
21321
|
+
onMouseLeave: () => setActiveIndex(undefined),
|
21322
|
+
fill: getThemeColor(child.props.color ? `${child.props.color}` : `blue-300`),
|
21323
|
+
radius: getBarRadius(stacks, child.props.accessor, child.props.stackId, activeBars),
|
21324
|
+
stackId: child.props.stackId,
|
21325
|
+
style: child.props.stackId ? {
|
21326
|
+
stroke: '#fff',
|
21327
|
+
strokeWidth: '2px'
|
21328
|
+
} : undefined,
|
21329
|
+
hide: !activeBars[child.props.accessor]
|
21330
|
+
}, data.map((_, index) => (/*#__PURE__*/React__default.createElement(Recharts.Cell, {
|
21331
|
+
key: `cell-${index}`,
|
21332
|
+
opacity: hoveredBar && child.props.accessor !== hoveredBar || activeIndex !== undefined && activeIndex !== index ? 0.3 : 1
|
21333
|
+
}))))))));
|
21334
|
+
};
|
21335
|
+
BarChart.Bar = Bar$1;
|
21336
|
+
const getBarRadius = (stacks, accessor, stackId, activeBars) => {
|
21337
|
+
if (stackId && Array.isArray(stacks[stackId])) {
|
21338
|
+
const length = stacks[stackId].length - 1;
|
21339
|
+
const index = stacks[stackId].indexOf(accessor);
|
21340
|
+
if (Object.entries(activeBars).filter(item => item[0] !== accessor).every(item => !item[1])) {
|
21341
|
+
return [3, 3, 0, 0];
|
21342
|
+
}
|
21343
|
+
if (activeBars[stacks[stackId][index + 1]] === false) {
|
21344
|
+
return [index === 0 ? 0 : 3, index === 0 ? 0 : 3, index === length - 1 ? 0 : 3, index === length - 1 ? 0 : 3];
|
21345
|
+
}
|
21346
|
+
if (index !== 0 && index !== length) {
|
21347
|
+
return 0;
|
21348
|
+
}
|
21349
|
+
return [index === 0 ? 0 : 3, index === 0 ? 0 : 3, index === length ? 0 : 3, index === length ? 0 : 3];
|
21350
|
+
}
|
21351
|
+
return 3;
|
21352
|
+
};
|
21353
|
+
|
21354
|
+
const Legend$1 = ({
|
21355
|
+
legendPosition,
|
21356
|
+
hoveredItem,
|
21357
|
+
selectedItem,
|
21358
|
+
data,
|
21359
|
+
onClick,
|
21360
|
+
setHoveredItem,
|
21361
|
+
formatter,
|
21362
|
+
total,
|
21363
|
+
visibleItems,
|
21364
|
+
label
|
21365
|
+
}) => {
|
21366
|
+
const isTotalLegendSelected = selectedItem.length === data.length;
|
21367
|
+
const isTotalLegendHovered = hoveredItem.length === data.length;
|
21368
|
+
const handleMouseLeave = () => setHoveredItem([]);
|
21369
|
+
const renderLegendItem = (entry, index) => {
|
21370
|
+
const isTotal = entry === null;
|
21371
|
+
// We can't use `isTotal` here because TypeScript is unable to infer the type when `entry` is not null.
|
21372
|
+
const itemData = entry === null ? {
|
21373
|
+
id: 'total',
|
21374
|
+
label,
|
21375
|
+
value: total,
|
21376
|
+
color: 'grey-300'
|
21377
|
+
} : entry;
|
21378
|
+
const isSelected = isTotal ? isTotalLegendSelected : selectedItem.includes(itemData.id);
|
21379
|
+
const isHovered = isTotal ? isTotalLegendHovered : hoveredItem.includes(itemData.id);
|
21380
|
+
return /*#__PURE__*/React__default.createElement("li", {
|
21381
|
+
key: isTotal ? 'total' : `${itemData.label}-${index}`,
|
21382
|
+
className: cn('mr-2 flex cursor-pointer gap-2 rounded pl-0 pr-1', {
|
21383
|
+
'bg-grey-100': isHovered && (!isTotal || legendPosition === 'right'),
|
21384
|
+
'bg-grey-200': isSelected && (!isTotal || legendPosition === 'right')
|
21385
|
+
}),
|
21386
|
+
onClick: () => onClick(isTotal ? data : itemData),
|
21387
|
+
onMouseEnter: () => setHoveredItem(isTotal ? data.map(item => item.id) : [itemData.id]),
|
21388
|
+
onMouseLeave: handleMouseLeave
|
21389
|
+
}, legendPosition === 'bottom' ? (/*#__PURE__*/React__default.createElement("div", {
|
21390
|
+
className: "flex items-center gap-1"
|
21391
|
+
}, /*#__PURE__*/React__default.createElement("span", {
|
21392
|
+
className: cn('ml-1 h-3 w-3 rounded-sm', {
|
21393
|
+
'border-grey-300 border !bg-white': !visibleItems[itemData.id]
|
21394
|
+
}),
|
21395
|
+
style: {
|
21396
|
+
backgroundColor: getThemeColor(itemData.color)
|
21397
|
+
}
|
21398
|
+
}, visibleItems[itemData.id] && isHovered && (/*#__PURE__*/React__default.createElement(Icon, {
|
21399
|
+
name: "tick-bold",
|
21400
|
+
className: "mb-2.5 !h-full !w-full text-white"
|
21401
|
+
}))), /*#__PURE__*/React__default.createElement("div", null, itemData.label))) : (/*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement("span", {
|
21402
|
+
className: "ml-1 mt-1 h-9 w-2 rounded-[1px]",
|
21403
|
+
style: {
|
21404
|
+
backgroundColor: getThemeColor(itemData.color)
|
21405
|
+
}
|
21406
|
+
}), /*#__PURE__*/React__default.createElement("div", null, itemData.label, /*#__PURE__*/React__default.createElement("span", {
|
21407
|
+
className: "-mt-1 flex w-full text-lg font-bold"
|
21408
|
+
}, formatter ? formatter(itemData.value) : itemData.value)))));
|
21409
|
+
};
|
21410
|
+
const moreButton = moreButtonText => (/*#__PURE__*/React__default.createElement(Button$1, {
|
21411
|
+
appearance: "transparent",
|
21412
|
+
className: "text-grey-700"
|
21413
|
+
}, moreButtonText));
|
21414
|
+
const className = cn('flex-grow pl-4', {
|
21415
|
+
'w-full': legendPosition === 'bottom'
|
21416
|
+
});
|
21417
|
+
return /*#__PURE__*/React__default.createElement("div", {
|
21418
|
+
className: className
|
21419
|
+
}, /*#__PURE__*/React__default.createElement("ul", {
|
21420
|
+
className: cn('mb-0 ml-0 mt-4 flex justify-center space-y-1', legendPosition === 'right' ? 'flex-col gap-1' : 'flex-row')
|
21421
|
+
}, legendPosition === 'right' ? (/*#__PURE__*/React__default.createElement(React__default.Fragment, null, renderLegendItem(null), data.map(renderLegendItem))) : (/*#__PURE__*/React__default.createElement(OverflowGroup, {
|
21422
|
+
className: "w-full items-center py-1",
|
21423
|
+
moreButton: moreButton
|
21424
|
+
}, data.map(renderLegendItem)))));
|
21425
|
+
};
|
21426
|
+
|
21427
|
+
const DONUT_WIDTH = 16;
|
21428
|
+
const HOVER_DONUT_WIDTH = 10;
|
21429
|
+
|
21430
|
+
const CenteredLabel = ({
|
21431
|
+
radius,
|
21432
|
+
legendPosition,
|
21433
|
+
label,
|
21434
|
+
total,
|
21435
|
+
formatter,
|
21436
|
+
showLegend
|
21437
|
+
}) => {
|
21438
|
+
const totalInset = HOVER_DONUT_WIDTH + DONUT_WIDTH + DONUT_WIDTH;
|
21439
|
+
const diameter = radius * 2;
|
21440
|
+
return /*#__PURE__*/React__default.createElement("div", {
|
21441
|
+
className: "absolute mt-1 flex h-12 flex-col text-center",
|
21442
|
+
style: {
|
21443
|
+
top: `calc(${radius}px - (3rem / 2))`,
|
21444
|
+
left: legendPosition === 'right' ? `${totalInset}px` : `calc(50%-${diameter - 2 * totalInset})`,
|
21445
|
+
width: showLegend ? `${diameter - 2 * totalInset}px` : `${diameter}px`
|
21446
|
+
}
|
21447
|
+
}, /*#__PURE__*/React__default.createElement("span", {
|
21448
|
+
className: "w-full truncate text-lg font-bold"
|
21449
|
+
}, formatter ? formatter(total) : total), label);
|
21450
|
+
};
|
21451
|
+
|
21452
|
+
const ActiveShape = props => {
|
21453
|
+
var _getThemeColor;
|
21454
|
+
const {
|
21455
|
+
cx,
|
21456
|
+
cy,
|
21457
|
+
id,
|
21458
|
+
innerRadius,
|
21459
|
+
onClick,
|
21460
|
+
outerRadius = 0,
|
21461
|
+
pieColors,
|
21462
|
+
startAngle,
|
21463
|
+
endAngle,
|
21464
|
+
fill
|
21465
|
+
} = props;
|
21466
|
+
return /*#__PURE__*/React__default.createElement("g", {
|
21467
|
+
onClick: () => onClick(id),
|
21468
|
+
className: cn({
|
21469
|
+
'cursor-pointer': !!onClick
|
21470
|
+
})
|
21471
|
+
}, /*#__PURE__*/React__default.createElement(Recharts.Sector, {
|
21472
|
+
cx: cx,
|
21473
|
+
cy: cy,
|
21474
|
+
innerRadius: innerRadius,
|
21475
|
+
outerRadius: outerRadius,
|
21476
|
+
startAngle: startAngle,
|
21477
|
+
endAngle: endAngle,
|
21478
|
+
fill: fill
|
21479
|
+
}), /*#__PURE__*/React__default.createElement(Recharts.Sector, {
|
21480
|
+
cx: cx,
|
21481
|
+
cy: cy,
|
21482
|
+
startAngle: startAngle,
|
21483
|
+
endAngle: endAngle,
|
21484
|
+
innerRadius: outerRadius + 2,
|
21485
|
+
outerRadius: outerRadius + HOVER_DONUT_WIDTH,
|
21486
|
+
fill: id !== undefined ? (_getThemeColor = getThemeColor(pieColors[id])) !== null && _getThemeColor !== void 0 ? _getThemeColor : getThemeColor('blue-500') : getThemeColor('blue-500'),
|
21487
|
+
opacity: 0.3
|
21488
|
+
}));
|
21489
|
+
};
|
21490
|
+
|
21491
|
+
const Segment = _ => null;
|
21492
|
+
const DonutChart = function DonutChart({
|
21493
|
+
children,
|
21494
|
+
formatter,
|
21495
|
+
onClick,
|
21496
|
+
showLegend = false,
|
21497
|
+
legendPosition = 'bottom',
|
21498
|
+
label
|
21499
|
+
}) {
|
21500
|
+
const ref = React__default.useRef(null);
|
21501
|
+
const [radius, setRadius] = React__default.useState(0);
|
21502
|
+
const [hoveredItem, setHoveredItem] = React__default.useState([]);
|
21503
|
+
// used for right legends
|
21504
|
+
const [selectedItem, setSelectedItem] = React__default.useState([]);
|
21505
|
+
// used for bottom legends
|
21506
|
+
const [visibleItems, setVisibleItems] = React__default.useState(() => {
|
21507
|
+
const keys = {};
|
21508
|
+
React__default.Children.forEach(children, child => {
|
21509
|
+
keys[child.props.id] = true;
|
21510
|
+
});
|
21511
|
+
return keys;
|
21512
|
+
});
|
21513
|
+
React__default.useEffect(() => {
|
21514
|
+
if (ref.current) {
|
21515
|
+
var _ref$current$parentEl;
|
21516
|
+
const rect = (_ref$current$parentEl = ref.current.parentElement) === null || _ref$current$parentEl === void 0 ? void 0 : _ref$current$parentEl.getBoundingClientRect();
|
21517
|
+
if (rect) {
|
21518
|
+
const width = showLegend ? rect.width / 2 : rect.width;
|
21519
|
+
const max = rect.height < width ? rect.height : width;
|
21520
|
+
setRadius(max / 2);
|
21521
|
+
}
|
21522
|
+
}
|
21523
|
+
}, [showLegend]);
|
21524
|
+
const diameter = radius * 2; // get dimensions of the parent container to find the max radius, so we can fill the container AND always have a 16px wide donut
|
21525
|
+
const data = React__default.Children.map(children, child => ({
|
21526
|
+
id: child.props.id,
|
21527
|
+
color: child.props.color,
|
21528
|
+
label: child.props.label,
|
21529
|
+
value: child.props.value
|
21530
|
+
}));
|
21531
|
+
const displayedData = data.filter(child => visibleItems[child.id]);
|
21532
|
+
const total = displayedData.reduce((accum, entry) => accum + entry.value, 0);
|
21533
|
+
const showTooltip = (!showLegend || legendPosition === 'bottom') && displayedData.length > 0;
|
21534
|
+
const handleLegendClick = entry => {
|
21535
|
+
if (legendPosition === 'bottom' && !Array.isArray(entry)) {
|
21536
|
+
setVisibleItems({
|
21537
|
+
...visibleItems,
|
21538
|
+
[entry.id]: !visibleItems[entry.id]
|
21539
|
+
});
|
21540
|
+
} else {
|
21541
|
+
const nextSelectedItem = Array.isArray(entry) ? entry.map(entryItem => entryItem.id) : [entry.id];
|
21542
|
+
// Using slice to avoid mutation of the react state 'selectedItem'
|
21543
|
+
const isCurrentSegmentActive = selectedItem.slice().sort().join(',') === nextSelectedItem.sort().join(',');
|
21544
|
+
if (onClick && !isCurrentSegmentActive) {
|
21545
|
+
onClick(entry);
|
21546
|
+
}
|
21547
|
+
setSelectedItem(isCurrentSegmentActive ? [] : nextSelectedItem);
|
21548
|
+
}
|
21549
|
+
};
|
21550
|
+
const handlePieClick = React__default.useCallback(pieId => {
|
21551
|
+
if (onClick && pieId !== undefined) {
|
21552
|
+
const pieProps = displayedData.find(item => item.id === pieId);
|
21553
|
+
onClick(pieProps);
|
21554
|
+
}
|
21555
|
+
}, [onClick, displayedData]);
|
21556
|
+
const singlePieDonutChart = displayedData.length === 1;
|
21557
|
+
const activeShapeColor = React__default.useMemo(() => {
|
21558
|
+
const getSegmentColor = item => item.reduce((colors, itemId) => {
|
21559
|
+
const visibleHoveredItem = displayedData.find(dataItem => dataItem.id === itemId);
|
21560
|
+
if (visibleHoveredItem) {
|
21561
|
+
colors[visibleHoveredItem.id] = visibleHoveredItem.color;
|
21562
|
+
}
|
21563
|
+
return colors;
|
21564
|
+
}, {});
|
21565
|
+
const hoveredSegmentColor = getSegmentColor(hoveredItem);
|
21566
|
+
const selectedSegmentColor = getSegmentColor(selectedItem);
|
21567
|
+
return legendPosition === 'bottom' || hoveredItem.length !== 0 ? hoveredSegmentColor : selectedSegmentColor;
|
21568
|
+
}, [hoveredItem, selectedItem, legendPosition]);
|
21569
|
+
if (ref.current && !radius) {
|
21570
|
+
return null;
|
21571
|
+
}
|
21572
|
+
const getActiveIndex = () => {
|
21573
|
+
if (hoveredItem.length > 0) {
|
21574
|
+
return hoveredItem.map(itemId => displayedData.findIndex(element => element.id === itemId));
|
21575
|
+
}
|
21576
|
+
return selectedItem.map(selectedItemId => displayedData.findIndex(element => element.id === selectedItemId));
|
21577
|
+
};
|
21578
|
+
const content = () => {
|
21579
|
+
const elements = React__default.Children.toArray(children).filter(child => /*#__PURE__*/React__default.isValidElement(child) && visibleItems[child.props.id]);
|
21580
|
+
return elements.length > 0 ? elements.map((child, index) => {
|
21581
|
+
var _getThemeColor;
|
21582
|
+
return /*#__PURE__*/React__default.createElement(Recharts.Cell, {
|
21583
|
+
key: `cell-${index}`,
|
21584
|
+
name: child.props.label,
|
21585
|
+
fill: (_getThemeColor = getThemeColor(child.props.color)) !== null && _getThemeColor !== void 0 ? _getThemeColor : getThemeColor('blue-300')
|
21586
|
+
});
|
21587
|
+
}) : (/*#__PURE__*/React__default.createElement(Recharts.Cell, {
|
21588
|
+
key: "empty-chart",
|
21589
|
+
name: '',
|
21590
|
+
fill: getThemeColor('grey-200')
|
21591
|
+
}));
|
21592
|
+
};
|
21593
|
+
return /*#__PURE__*/React__default.createElement("div", {
|
21594
|
+
className: cn('relative h-full w-full', {
|
21595
|
+
[`flex `]: showLegend,
|
21596
|
+
'flex-col items-center': legendPosition === 'bottom'
|
21597
|
+
}),
|
21598
|
+
ref: ref
|
21599
|
+
}, /*#__PURE__*/React__default.createElement(CenteredLabel, {
|
21600
|
+
radius: radius,
|
21601
|
+
legendPosition: legendPosition,
|
21602
|
+
label: label,
|
21603
|
+
total: total,
|
21604
|
+
formatter: formatter,
|
21605
|
+
showLegend: showLegend
|
21606
|
+
}), /*#__PURE__*/React__default.createElement(Recharts.PieChart, {
|
21607
|
+
data: data,
|
21608
|
+
height: diameter,
|
21609
|
+
width: diameter,
|
21610
|
+
style: {
|
21611
|
+
transform: 'rotate(90deg) scale(-1,1)'
|
21612
|
+
}
|
21613
|
+
}, showTooltip ? (/*#__PURE__*/React__default.createElement(Recharts.Tooltip, Object.assign({}, getTooltipProps({
|
21614
|
+
style: {
|
21615
|
+
transform: 'rotate(90deg) scale(-1,1)'
|
21616
|
+
},
|
21617
|
+
singlePieDonutChart
|
21618
|
+
})))) : null, /*#__PURE__*/React__default.createElement(Recharts.Pie, {
|
21619
|
+
isAnimationActive: false,
|
21620
|
+
activeIndex: getActiveIndex(),
|
21621
|
+
activeShape: /*#__PURE__*/React__default.createElement(ActiveShape, {
|
21622
|
+
pieColors: activeShapeColor,
|
21623
|
+
onClick: handlePieClick
|
21624
|
+
}),
|
21625
|
+
data: displayedData.length > 0 ? displayedData : [],
|
21626
|
+
dataKey: "value",
|
21627
|
+
innerRadius: radius - HOVER_DONUT_WIDTH - DONUT_WIDTH,
|
21628
|
+
onMouseEnter: segment => displayedData.length > 0 && setHoveredItem([segment.id]),
|
21629
|
+
onMouseLeave: () => setHoveredItem([]),
|
21630
|
+
outerRadius: radius - HOVER_DONUT_WIDTH,
|
21631
|
+
paddingAngle: 2,
|
21632
|
+
// Prevents the pie group element from being focusable
|
21633
|
+
rootTabIndex: -1
|
21634
|
+
}, content())), showLegend && (/*#__PURE__*/React__default.createElement(Legend$1, {
|
21635
|
+
data: data,
|
21636
|
+
visibleItems: visibleItems,
|
21637
|
+
onClick: handleLegendClick,
|
21638
|
+
total: total,
|
21639
|
+
setHoveredItem: setHoveredItem,
|
21640
|
+
label: label,
|
21641
|
+
legendPosition: legendPosition,
|
21642
|
+
hoveredItem: hoveredItem,
|
21643
|
+
selectedItem: selectedItem,
|
21644
|
+
formatter: formatter
|
21645
|
+
})));
|
21646
|
+
};
|
21647
|
+
DonutChart.Segment = Segment;
|
21648
|
+
|
21649
|
+
const Line$1 = _ => null;
|
21650
|
+
const LineChart = function LineChart(externalProps) {
|
21651
|
+
const {
|
21652
|
+
children,
|
21653
|
+
data,
|
21654
|
+
formatter,
|
21655
|
+
...props
|
21656
|
+
} = externalProps;
|
21657
|
+
const [hoveredLine, setHoveredLine] = React.useState(null);
|
21658
|
+
const [activeLines, setActiveLines] = React.useState(() => {
|
21659
|
+
const keys = {};
|
21660
|
+
React__default.Children.forEach(children, child => {
|
21661
|
+
keys[child.props.accessor] = true;
|
21662
|
+
});
|
21663
|
+
return keys;
|
21664
|
+
});
|
21665
|
+
const handleLegendClick = entry => {
|
21666
|
+
setHoveredLine(null);
|
21667
|
+
setActiveLines({
|
21668
|
+
...activeLines,
|
21669
|
+
[entry.dataKey]: !activeLines[entry.dataKey]
|
21670
|
+
});
|
21671
|
+
};
|
21672
|
+
return /*#__PURE__*/React__default.createElement(ResponsiveContainer, null, /*#__PURE__*/React__default.createElement(Recharts.LineChart, {
|
21673
|
+
data: data,
|
21674
|
+
margin: {
|
21675
|
+
top: 10,
|
21676
|
+
right: 0,
|
21677
|
+
left: -25,
|
21678
|
+
bottom: 0
|
21679
|
+
}
|
21680
|
+
}, /*#__PURE__*/React__default.createElement(Recharts.CartesianGrid, Object.assign({}, getCartesianGridProps())), /*#__PURE__*/React__default.createElement(Recharts.XAxis, Object.assign({}, getXAxisProps(props))), /*#__PURE__*/React__default.createElement(Recharts.YAxis, Object.assign({}, getYAxisProps(props))), /*#__PURE__*/React__default.createElement(Recharts.Legend, Object.assign({}, getLegendProps({
|
21681
|
+
onClick: handleLegendClick,
|
21682
|
+
onMouseEnter: entry => setHoveredLine(entry.dataKey),
|
21683
|
+
onMouseLeave: () => setHoveredLine(null),
|
21684
|
+
activeItems: activeLines
|
21685
|
+
}))), /*#__PURE__*/React__default.createElement(Recharts.Tooltip, Object.assign({}, getTooltipProps(), {
|
21686
|
+
formatter: formatter
|
21687
|
+
})), React__default.Children.map(children, child => {
|
21688
|
+
var _child$props$color, _child$props$color2;
|
21689
|
+
return /*#__PURE__*/React__default.createElement(Recharts.Line, {
|
21690
|
+
activeDot: {
|
21691
|
+
fill: getThemeColor((_child$props$color = child.props.color) !== null && _child$props$color !== void 0 ? _child$props$color : 'blue-300')
|
21692
|
+
},
|
21693
|
+
dataKey: child.props.accessor,
|
21694
|
+
isAnimationActive: false,
|
21695
|
+
dot: false,
|
21696
|
+
name: child.props.label,
|
21697
|
+
stroke: getThemeColor((_child$props$color2 = child.props.color) !== null && _child$props$color2 !== void 0 ? _child$props$color2 : 'blue-300'),
|
21698
|
+
strokeWidth: 2,
|
21699
|
+
hide: !activeLines[child.props.accessor],
|
21700
|
+
opacity: hoveredLine && child.props.accessor !== hoveredLine ? 0.3 : 1
|
21701
|
+
});
|
21702
|
+
})));
|
21703
|
+
};
|
21704
|
+
LineChart.Line = Line$1;
|
21705
|
+
|
20456
21706
|
const Button$4 = /*#__PURE__*/React__default.forwardRef(function Button(props, ref) {
|
20457
21707
|
const {
|
20458
21708
|
...attributes
|
@@ -20725,15 +21975,13 @@ const AgreementDisplay = props => {
|
|
20725
21975
|
}));
|
20726
21976
|
};
|
20727
21977
|
|
20728
|
-
const Container$1 =
|
20729
|
-
children
|
20730
|
-
}) => {
|
21978
|
+
const Container$1 = props => {
|
20731
21979
|
return /*#__PURE__*/React__default.createElement("div", {
|
20732
21980
|
className: "-ml-2 flex flex-shrink-0 flex-grow-0 items-center gap-2 pr-2 xl:ml-auto xl:w-64",
|
20733
21981
|
"data-taco": "header-agreements"
|
20734
21982
|
}, /*#__PURE__*/React__default.createElement("span", {
|
20735
21983
|
className: "hidden h-8 w-px flex-shrink-0 flex-grow-0 bg-white/[0.3] xl:flex"
|
20736
|
-
}), children);
|
21984
|
+
}), props.children);
|
20737
21985
|
};
|
20738
21986
|
function AgreementSelector(props) {
|
20739
21987
|
const {
|
@@ -21166,6 +22414,223 @@ Navigation2.Link = Link$3;
|
|
21166
22414
|
Navigation2.Section = Section;
|
21167
22415
|
Navigation2.Content = Content$a;
|
21168
22416
|
|
22417
|
+
const DATASET_SIZE_MULTIPLIER = 15;
|
22418
|
+
function useTableDataLoader2(fetchPage, fetchAll, options = {
|
22419
|
+
pageSize: DEFAULT_PAGE_SIZE
|
22420
|
+
}) {
|
22421
|
+
const loadPage = function (pageIndex, sorting, filters, hiddenColumns, search, reset = false) {
|
22422
|
+
try {
|
22423
|
+
// if a request is already pending for this page (and it's not a reset), skip it
|
22424
|
+
if (_pendingPageRequests.current[pageIndex] && !reset) {
|
22425
|
+
return Promise.resolve();
|
22426
|
+
}
|
22427
|
+
const hasChangedData = JSON.stringify(sorting) !== JSON.stringify(_lastUsedSorting.current) || JSON.stringify(filters) !== JSON.stringify(_lastUsedFilters.current) || search !== _lastUsedSearch.current;
|
22428
|
+
// if the page is already loaded and has actual rows, abort
|
22429
|
+
if (data.cache[pageIndex] && data.cache[pageIndex][0] && !hasChangedData && !reset) {
|
22430
|
+
return Promise.resolve();
|
22431
|
+
}
|
22432
|
+
// create an id to track the update
|
22433
|
+
const requestId = uuid.v4();
|
22434
|
+
// set the page as loading, so that subsequent requests don't retrigger it
|
22435
|
+
_pendingPageRequests.current[pageIndex] = true;
|
22436
|
+
const _temp2 = _catch(function () {
|
22437
|
+
_lastRequestId.current = requestId;
|
22438
|
+
return Promise.resolve(fetchPage(pageIndex, pageSize, sorting, filters, hiddenColumns, search)).then(function (response) {
|
22439
|
+
length.current = response.length;
|
22440
|
+
// update state, here we do some "magic" to support "load in place"
|
22441
|
+
setData(currentData => {
|
22442
|
+
// if this request wasn't the last one, just return the current state to prevent weird updates
|
22443
|
+
if (_lastRequestId.current !== requestId) {
|
22444
|
+
return currentData;
|
22445
|
+
}
|
22446
|
+
const direction = getDirection(pageIndex, currentData.pages);
|
22447
|
+
const nextPages = getPages(pageIndex, currentData.lastFetchedPage, reset ? [] : currentData.pages, direction);
|
22448
|
+
// set values so we can track if they changed between loads
|
22449
|
+
_lastUsedSorting.current = sorting;
|
22450
|
+
_lastUsedFilters.current = filters;
|
22451
|
+
_lastUsedSearch.current = search;
|
22452
|
+
_lastUsedHiddenColumns.current = hiddenColumns;
|
22453
|
+
// cache data as an object to prevent any duplicates for pages
|
22454
|
+
let nextCache;
|
22455
|
+
if (reset || hasChangedData || !direction) {
|
22456
|
+
nextCache = nextPages.reduce((acc, p) => ({
|
22457
|
+
...acc,
|
22458
|
+
[p]: Array(pageSize).fill(undefined)
|
22459
|
+
}), {});
|
22460
|
+
} else {
|
22461
|
+
nextCache = {
|
22462
|
+
...currentData.cache
|
22463
|
+
};
|
22464
|
+
}
|
22465
|
+
nextCache[pageIndex] = response.data;
|
22466
|
+
// cleanup "unloaded" pages
|
22467
|
+
if (direction === 'forward' && currentData.rows.length >= DATASET_SIZE) {
|
22468
|
+
delete nextCache[currentData.pages[0]];
|
22469
|
+
} else if (direction === 'backward' && currentData.rows.length >= DATASET_SIZE) {
|
22470
|
+
delete nextCache[currentData.pages[currentData.pages.length - 1]];
|
22471
|
+
}
|
22472
|
+
// remap rows from the cached data - do it here and not in render to save some performance
|
22473
|
+
const rows = Object.values(nextCache).reduce((acc, p) => acc.concat(p), []);
|
22474
|
+
return {
|
22475
|
+
cache: nextCache,
|
22476
|
+
pages: nextPages,
|
22477
|
+
rows: rows,
|
22478
|
+
lastFetchedPage: pageIndex
|
22479
|
+
};
|
22480
|
+
});
|
22481
|
+
// reset pending requests
|
22482
|
+
delete _pendingPageRequests.current[pageIndex];
|
22483
|
+
});
|
22484
|
+
}, function () {});
|
22485
|
+
return Promise.resolve(_temp2 && _temp2.then ? _temp2.then(function () {}) : void 0);
|
22486
|
+
} catch (e) {
|
22487
|
+
return Promise.reject(e);
|
22488
|
+
}
|
22489
|
+
};
|
22490
|
+
const {
|
22491
|
+
pageSize
|
22492
|
+
} = options;
|
22493
|
+
const DATASET_SIZE = DATASET_SIZE_MULTIPLIER * pageSize;
|
22494
|
+
// track the data length, we don't know it until the first request
|
22495
|
+
const length = React__default.useRef(0);
|
22496
|
+
// data will be filled after the first request
|
22497
|
+
const [data, setData] = React__default.useState({
|
22498
|
+
rows: [],
|
22499
|
+
pages: [],
|
22500
|
+
cache: {},
|
22501
|
+
lastFetchedPage: undefined
|
22502
|
+
});
|
22503
|
+
// track which pages have been loaded to dedupe requests
|
22504
|
+
const _pendingPageRequests = React__default.useRef({});
|
22505
|
+
// it's possible to spam updates, e.g. sort, so we don't set state if the last request wasn't the current oen
|
22506
|
+
const _lastRequestId = React__default.useRef();
|
22507
|
+
// store last used properties
|
22508
|
+
const _lastUsedSorting = React__default.useRef([]);
|
22509
|
+
const _lastUsedFilters = React__default.useRef([]);
|
22510
|
+
const _lastUsedSearch = React__default.useRef();
|
22511
|
+
const _lastUsedHiddenColumns = React__default.useRef([]);
|
22512
|
+
const loadAll = function (sorting, filters, hiddenColumns, search) {
|
22513
|
+
try {
|
22514
|
+
// set values so we can track if they changed between loads
|
22515
|
+
_lastUsedSorting.current = sorting;
|
22516
|
+
_lastUsedFilters.current = filters;
|
22517
|
+
_lastUsedSearch.current = search;
|
22518
|
+
_lastUsedHiddenColumns.current = hiddenColumns;
|
22519
|
+
const _temp = _finallyRethrows(function () {
|
22520
|
+
return _catch(function () {
|
22521
|
+
return Promise.resolve(fetchAll(sorting, filters, hiddenColumns, search)).then(function (response) {
|
22522
|
+
length.current = response.length;
|
22523
|
+
const pages = [];
|
22524
|
+
const cache = {};
|
22525
|
+
const pageCount = Math.ceil(response.length / pageSize);
|
22526
|
+
Array.from(Array(pageCount).keys()).forEach(index => {
|
22527
|
+
pages.push(index);
|
22528
|
+
const startIndex = index * pageSize;
|
22529
|
+
cache[index] = response.data.slice(startIndex, startIndex + pageSize);
|
22530
|
+
});
|
22531
|
+
setData({
|
22532
|
+
cache,
|
22533
|
+
pages,
|
22534
|
+
rows: response.data,
|
22535
|
+
lastFetchedPage: undefined
|
22536
|
+
});
|
22537
|
+
});
|
22538
|
+
}, function () {});
|
22539
|
+
}, function (_wasThrown, _result) {
|
22540
|
+
// reset pending requests
|
22541
|
+
_pendingPageRequests.current = {};
|
22542
|
+
if (_wasThrown) throw _result;
|
22543
|
+
return _result;
|
22544
|
+
});
|
22545
|
+
return Promise.resolve(_temp && _temp.then ? _temp.then(function () {}) : void 0);
|
22546
|
+
} catch (e) {
|
22547
|
+
return Promise.reject(e);
|
22548
|
+
}
|
22549
|
+
};
|
22550
|
+
const invalidate = function () {
|
22551
|
+
try {
|
22552
|
+
// reset stuff
|
22553
|
+
_pendingPageRequests.current = {};
|
22554
|
+
// load the current page again
|
22555
|
+
return loadPage(getCurrentPage(data.pages), _lastUsedSorting.current, _lastUsedFilters.current, _lastUsedHiddenColumns.current, _lastUsedSearch.current, true);
|
22556
|
+
} catch (e) {
|
22557
|
+
return Promise.reject(e);
|
22558
|
+
}
|
22559
|
+
};
|
22560
|
+
const handleSort = function (sorting) {
|
22561
|
+
try {
|
22562
|
+
// reset before loading the current page
|
22563
|
+
_pendingPageRequests.current = {};
|
22564
|
+
return loadPage(getCurrentPage(data.pages), sorting, _lastUsedFilters.current, _lastUsedHiddenColumns.current, _lastUsedSearch.current, true);
|
22565
|
+
} catch (e) {
|
22566
|
+
return Promise.reject(e);
|
22567
|
+
}
|
22568
|
+
};
|
22569
|
+
const handleFilter = function (filters, hiddenColumns) {
|
22570
|
+
try {
|
22571
|
+
// reset before loading the current page
|
22572
|
+
_pendingPageRequests.current = {};
|
22573
|
+
return loadPage(0, _lastUsedSorting.current, filters, hiddenColumns, _lastUsedSearch.current, true);
|
22574
|
+
} catch (e) {
|
22575
|
+
return Promise.reject(e);
|
22576
|
+
}
|
22577
|
+
};
|
22578
|
+
const handleSearch = function (search, hiddenColumns) {
|
22579
|
+
try {
|
22580
|
+
// reset before loading the current page
|
22581
|
+
_pendingPageRequests.current = {};
|
22582
|
+
return loadPage(0, _lastUsedSorting.current, _lastUsedFilters.current, hiddenColumns, search, true);
|
22583
|
+
} catch (e) {
|
22584
|
+
return Promise.reject(e);
|
22585
|
+
}
|
22586
|
+
};
|
22587
|
+
return [{
|
22588
|
+
data: data.rows,
|
22589
|
+
pages: data.pages,
|
22590
|
+
length: length.current,
|
22591
|
+
loadAll,
|
22592
|
+
loadPage,
|
22593
|
+
onChangeFilter: handleFilter,
|
22594
|
+
onChangeSearch: handleSearch,
|
22595
|
+
onChangeSort: handleSort,
|
22596
|
+
pageSize,
|
22597
|
+
_experimentalDataLoader2: true
|
22598
|
+
}, invalidate];
|
22599
|
+
}
|
22600
|
+
function getCurrentPage(currentPages) {
|
22601
|
+
if (currentPages.length <= 2) {
|
22602
|
+
return currentPages[0];
|
22603
|
+
}
|
22604
|
+
// for even page lengths we can't know which is the current visible page - it could even be both
|
22605
|
+
// so we load one of them and rely on the "load next/previous page" functionality in row
|
22606
|
+
const middle = Math.floor(currentPages.length / 2);
|
22607
|
+
return currentPages[middle];
|
22608
|
+
}
|
22609
|
+
function getDirection(pageIndex, currentPages) {
|
22610
|
+
if (currentPages.length) {
|
22611
|
+
if (pageIndex === currentPages[currentPages.length - 1] + 1) {
|
22612
|
+
return 'forward';
|
22613
|
+
} else if (pageIndex === currentPages[0] - 1 || currentPages.length === 2 && currentPages[0] !== 0 && pageIndex === currentPages[0]) {
|
22614
|
+
return 'backward';
|
22615
|
+
}
|
22616
|
+
}
|
22617
|
+
return undefined;
|
22618
|
+
}
|
22619
|
+
function getPages(pageIndex, lastUsedPageIndex, currentPages, direction) {
|
22620
|
+
if (currentPages.length && (pageIndex === lastUsedPageIndex || currentPages.includes(pageIndex))) {
|
22621
|
+
return currentPages;
|
22622
|
+
}
|
22623
|
+
if (direction === 'forward') {
|
22624
|
+
const nextPages = currentPages.length === DATASET_SIZE_MULTIPLIER ? currentPages.slice(1) : currentPages;
|
22625
|
+
return nextPages.concat(pageIndex);
|
22626
|
+
}
|
22627
|
+
if (direction === 'backward') {
|
22628
|
+
const nextPages = currentPages.length === DATASET_SIZE_MULTIPLIER ? currentPages.slice(0, -1) : currentPages;
|
22629
|
+
return [pageIndex].concat(nextPages);
|
22630
|
+
}
|
22631
|
+
return [pageIndex];
|
22632
|
+
}
|
22633
|
+
|
21169
22634
|
const useBoundaryOverflowDetection = (ref, dependencies = []) => {
|
21170
22635
|
const [boundaryIndex, setBoundaryIndex] = React__default.useState();
|
21171
22636
|
const dimensions = useBoundingClientRectListener(ref, dependencies);
|
@@ -21199,10 +22664,12 @@ const useOnClickOutside = (ref, callback) => {
|
|
21199
22664
|
exports.Accordion = Accordion;
|
21200
22665
|
exports.Alert = Alert;
|
21201
22666
|
exports.AlertDialog = AlertDialog;
|
22667
|
+
exports.AreaChart = AreaChart;
|
21202
22668
|
exports.Backdrop = Backdrop;
|
21203
22669
|
exports.Badge = Badge;
|
21204
22670
|
exports.BadgeIcon = BadgeIcon;
|
21205
22671
|
exports.Banner = Banner;
|
22672
|
+
exports.BarChart = BarChart;
|
21206
22673
|
exports.Base = Base;
|
21207
22674
|
exports.Button = Button$1;
|
21208
22675
|
exports.Calendar = Calendar$1;
|
@@ -21213,6 +22680,7 @@ exports.Combobox = Combobox;
|
|
21213
22680
|
exports.DEFAULT_PAGE_SIZE = DEFAULT_PAGE_SIZE;
|
21214
22681
|
exports.Datepicker = Datepicker;
|
21215
22682
|
exports.Dialog = Dialog;
|
22683
|
+
exports.DonutChart = DonutChart;
|
21216
22684
|
exports.Drawer = Drawer;
|
21217
22685
|
exports.Field = Field;
|
21218
22686
|
exports.Form = Form;
|
@@ -21224,6 +22692,7 @@ exports.Icon = Icon;
|
|
21224
22692
|
exports.IconButton = IconButton;
|
21225
22693
|
exports.Input = Input;
|
21226
22694
|
exports.Layout = Layout$1;
|
22695
|
+
exports.LineChart = LineChart;
|
21227
22696
|
exports.List = List$1;
|
21228
22697
|
exports.Listbox = Listbox;
|
21229
22698
|
exports.LocalizationContext = LocalizationContext;
|
@@ -21301,6 +22770,7 @@ exports.useOnClickOutside = useOnClickOutside;
|
|
21301
22770
|
exports.usePagination = usePagination;
|
21302
22771
|
exports.useRadioGroup = useRadioGroup;
|
21303
22772
|
exports.useTableDataLoader = useTableDataLoader;
|
22773
|
+
exports.useTableDataLoader2 = useTableDataLoader2;
|
21304
22774
|
exports.useTableRowCreation = useTableRowCreation;
|
21305
22775
|
exports.useToast = useToast;
|
21306
22776
|
//# sourceMappingURL=taco.cjs.development.js.map
|