@economic/taco 2.45.0-alpha.3 → 2.45.0-alpha.30
Sign up to get free protection for your applications and to get access to all the features.
- 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/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 +4 -5
- 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 +23 -18
- package/dist/components/Table3/features/useTableEditing.d.ts +24 -19
- 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/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 +10 -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 +4 -2
- package/dist/esm/packages/taco/src/components/Dialog/components/Content.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Drawer/components/Content.js +2 -2
- package/dist/esm/packages/taco/src/components/Drawer/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/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/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/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/Select2/Select2.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/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/hooks/plugins/useRowActions.js +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/EditingControlCell.js +58 -35
- 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 +2 -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 +81 -81
- 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 +9 -1
- 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/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/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/Menu.js +3 -1
- package/dist/esm/packages/taco/src/primitives/Table/Core/components/Header/components/Menu.js.map +1 -1
- package/dist/esm/packages/taco/src/primitives/Table/Core/components/Row/BuiltIns/DisplayRow.js +1 -1
- 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 +3 -1
- 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 +43 -12
- 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/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/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/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/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 +1 -0
- package/dist/primitives/Table/types.d.ts +23 -15
- 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/taco.cjs.development.js +2036 -520
- 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 -7
- package/tailwind.colors.js +121 -0
- package/tailwind.config.js +4 -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();
|
@@ -6313,6 +6431,7 @@ const useDatepicker = ({
|
|
6313
6431
|
setInternalValue(event.target.value);
|
6314
6432
|
};
|
6315
6433
|
const handleChange = date => {
|
6434
|
+
// Update both the input value and calendar view date when selecting a date
|
6316
6435
|
setInputValueByRef(inputRef.current, format(date, formatting.date), 'focusout');
|
6317
6436
|
};
|
6318
6437
|
const handleKeyDown = event => {
|
@@ -6328,6 +6447,7 @@ const useDatepicker = ({
|
|
6328
6447
|
const inputProps = {
|
6329
6448
|
...props,
|
6330
6449
|
autoComplete: 'off',
|
6450
|
+
invalid: props.invalid || isDisabledDay,
|
6331
6451
|
onBlur: handleInputBlur,
|
6332
6452
|
onChange: handleInputChange,
|
6333
6453
|
onKeyDown: handleKeyDown,
|
@@ -6497,11 +6617,24 @@ const Datepicker = /*#__PURE__*/React.forwardRef(function Datepicker(props, ref)
|
|
6497
6617
|
e.preventDefault();
|
6498
6618
|
(_input$ref$current = input.ref.current) === null || _input$ref$current === void 0 ? void 0 : _input$ref$current.focus();
|
6499
6619
|
}, [input.ref]);
|
6620
|
+
// Allow preventing default keyDown behaviour if consumer (in our internal case it's Table3) wants to handle it.
|
6621
|
+
// We need to have this option for the situations, when Datepicker is used as inline edititng control in Table3,
|
6622
|
+
// without it, datepicker cannot be set into detailed editing mode by pressing "Enter",
|
6623
|
+
// because input.onKeydown is triggering 'focusout', which resets the detailed edititng mode.
|
6624
|
+
const handleInputKeyDown = event => {
|
6625
|
+
var _props$onKeyDown;
|
6626
|
+
(_props$onKeyDown = props.onKeyDown) === null || _props$onKeyDown === void 0 ? void 0 : _props$onKeyDown.call(props, event);
|
6627
|
+
if (!event.defaultPrevented) {
|
6628
|
+
var _input$onKeyDown;
|
6629
|
+
(_input$onKeyDown = input.onKeyDown) === null || _input$onKeyDown === void 0 ? void 0 : _input$onKeyDown.call(input, event);
|
6630
|
+
}
|
6631
|
+
};
|
6500
6632
|
return /*#__PURE__*/React.createElement("span", {
|
6501
6633
|
className: className,
|
6502
6634
|
"data-taco": "datepicker",
|
6503
6635
|
style: style
|
6504
6636
|
}, /*#__PURE__*/React.createElement(Input, Object.assign({}, input, {
|
6637
|
+
onKeyDown: handleInputKeyDown,
|
6505
6638
|
button: input.readOnly ? undefined : (/*#__PURE__*/React.createElement(IconButton, {
|
6506
6639
|
"aria-label": texts.datepicker.expand,
|
6507
6640
|
disabled: input.disabled || input.readOnly,
|
@@ -6680,8 +6813,10 @@ const Content$4 = /*#__PURE__*/React.forwardRef(function DialogContent(props, re
|
|
6680
6813
|
const {
|
6681
6814
|
texts
|
6682
6815
|
} = 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
|
6816
|
+
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');
|
6817
|
+
const containerClassName = cn('bg-white p-6 rounded relative z-10 shadow print:p-0',
|
6818
|
+
// 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.
|
6819
|
+
'print:overflow-visible print:h-max print:!transform-none print:!inset-0 print:!m-0', {
|
6685
6820
|
'rounded-b-none': !!dialog.elements.extra
|
6686
6821
|
}, props.className);
|
6687
6822
|
const handleEscapeKeyDown = event => {
|
@@ -7210,7 +7345,7 @@ const DrawerContent = /*#__PURE__*/React__default.forwardRef(function Content(pr
|
|
7210
7345
|
ref: contentRef,
|
7211
7346
|
"data-taco": "drawer",
|
7212
7347
|
className: containerClassName
|
7213
|
-
}, output, /*#__PURE__*/React__default.createElement("div", Object.assign({
|
7348
|
+
}, /*#__PURE__*/React__default.createElement(React__default.Fragment, null, output, /*#__PURE__*/React__default.createElement("div", Object.assign({
|
7214
7349
|
className: dragHandlerClassName
|
7215
7350
|
}, dragHandleProps, {
|
7216
7351
|
"data-testid": "resize-handler",
|
@@ -7223,7 +7358,7 @@ const DrawerContent = /*#__PURE__*/React__default.forwardRef(function Content(pr
|
|
7223
7358
|
"aria-label": texts.drawer.close,
|
7224
7359
|
className: "absolute right-0 top-0 mr-2 mt-4",
|
7225
7360
|
icon: "close"
|
7226
|
-
}))) : null);
|
7361
|
+
}))) : null));
|
7227
7362
|
const styleProp = {
|
7228
7363
|
...style,
|
7229
7364
|
...{
|
@@ -7440,7 +7575,8 @@ const Title$3 = /*#__PURE__*/React.forwardRef(function DialogTitle(props, ref) {
|
|
7440
7575
|
});
|
7441
7576
|
const Content$6 = /*#__PURE__*/React.forwardRef(function HangerContent(props, ref) {
|
7442
7577
|
const {
|
7443
|
-
placement: side
|
7578
|
+
placement: side,
|
7579
|
+
hideWhenDetached = false
|
7444
7580
|
} = props;
|
7445
7581
|
const context = React.useContext(HangerContext);
|
7446
7582
|
const {
|
@@ -7456,7 +7592,8 @@ const Content$6 = /*#__PURE__*/React.forwardRef(function HangerContent(props, re
|
|
7456
7592
|
onInteractOutside: handleInteractOutside,
|
7457
7593
|
side: side,
|
7458
7594
|
sideOffset: 1,
|
7459
|
-
ref: ref
|
7595
|
+
ref: ref,
|
7596
|
+
hideWhenDetached: hideWhenDetached
|
7460
7597
|
}, props.children, /*#__PURE__*/React.createElement(UnstyledArrow, {
|
7461
7598
|
className: "text-blue-500"
|
7462
7599
|
}), /*#__PURE__*/React.createElement(PopoverPrimitive.Close, {
|
@@ -8222,6 +8359,11 @@ const Content$8 = /*#__PURE__*/React.forwardRef(function MenuContent(props, ref)
|
|
8222
8359
|
if (child.props.shortcut) {
|
8223
8360
|
shortcuts.push(createShortcutKeyDownHandler(child.props.shortcut, event => {
|
8224
8361
|
event.preventDefault();
|
8362
|
+
const dialog = document.querySelector('[role="dialog"]');
|
8363
|
+
// Don't trigger the shortcut if it is outside of the dialog
|
8364
|
+
if (dialog && !(dialog !== null && dialog !== void 0 && dialog.contains(internalRef.current))) {
|
8365
|
+
return;
|
8366
|
+
}
|
8225
8367
|
menu === null || menu === void 0 ? void 0 : menu.open();
|
8226
8368
|
setTimeout(() => {
|
8227
8369
|
var _childrenRefs$current, _childrenRefs$current2;
|
@@ -8296,7 +8438,7 @@ const Shortcut = ({
|
|
8296
8438
|
className: className
|
8297
8439
|
}), texts.map(key => (/*#__PURE__*/React__default.createElement("kbd", {
|
8298
8440
|
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"
|
8441
|
+
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
8442
|
}, key))));
|
8301
8443
|
};
|
8302
8444
|
|
@@ -9668,6 +9810,20 @@ const insertToastWithoutDuplicates = (currentToasts, id, content, options, close
|
|
9668
9810
|
}
|
9669
9811
|
return nextToasts;
|
9670
9812
|
};
|
9813
|
+
const Portal$1 = props => {
|
9814
|
+
var _globalThis$document;
|
9815
|
+
const {
|
9816
|
+
children,
|
9817
|
+
container: containerProp,
|
9818
|
+
...portalProps
|
9819
|
+
} = props;
|
9820
|
+
const [mounted, setMounted] = React.useState(false);
|
9821
|
+
React.useLayoutEffect(() => setMounted(true), []);
|
9822
|
+
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);
|
9823
|
+
return container ? /*#__PURE__*/ReactDOM.createPortal(/*#__PURE__*/React.createElement("div", Object.assign({}, portalProps, {
|
9824
|
+
"data-taco": "portal"
|
9825
|
+
}), children), container) : null;
|
9826
|
+
};
|
9671
9827
|
const ToastProvider = ({
|
9672
9828
|
children,
|
9673
9829
|
...props
|
@@ -9759,7 +9915,7 @@ const ToastProvider = ({
|
|
9759
9915
|
}, []);
|
9760
9916
|
return /*#__PURE__*/React.createElement(ToastContext.Provider, Object.assign({}, props, {
|
9761
9917
|
value: toaster
|
9762
|
-
}), children, /*#__PURE__*/React.createElement(
|
9918
|
+
}), children, /*#__PURE__*/React.createElement(Portal$1, null, /*#__PURE__*/React.createElement("div", {
|
9763
9919
|
id: "yt-toast__container",
|
9764
9920
|
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
9921
|
role: "log"
|
@@ -9835,12 +9991,9 @@ const fixedForwardRef = React__default.forwardRef;
|
|
9835
9991
|
TableFilterComparator[TableFilterComparator["HasAnyOf"] = 11] = "HasAnyOf";
|
9836
9992
|
TableFilterComparator[TableFilterComparator["HasAllOf"] = 12] = "HasAllOf";
|
9837
9993
|
TableFilterComparator[TableFilterComparator["HasNoneOf"] = 13] = "HasNoneOf";
|
9994
|
+
TableFilterComparator[TableFilterComparator["IsOneOf"] = 14] = "IsOneOf";
|
9995
|
+
TableFilterComparator[TableFilterComparator["IsNoneOf"] = 15] = "IsNoneOf";
|
9838
9996
|
})(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
9997
|
|
9845
9998
|
const dataTypes = {
|
9846
9999
|
auto: {
|
@@ -9878,9 +10031,13 @@ const dataTypes = {
|
|
9878
10031
|
if (value === undefined) {
|
9879
10032
|
return '';
|
9880
10033
|
}
|
9881
|
-
|
10034
|
+
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
10035
|
minimumFractionDigits: 2
|
9883
|
-
})
|
10036
|
+
});
|
10037
|
+
const decimalSeperator = formatter.format(1.1).substring(1, 2);
|
10038
|
+
const localisedValue = formatter.format(Number(value));
|
10039
|
+
const localisedValueWithoutThousandsSeperator = decimalSeperator === '.' ? localisedValue.replace(',', '') : localisedValue.replace('.', '');
|
10040
|
+
return [localisedValue, localisedValueWithoutThousandsSeperator];
|
9884
10041
|
}
|
9885
10042
|
}
|
9886
10043
|
};
|
@@ -10004,6 +10161,12 @@ function columnFilterFn(value, filter) {
|
|
10004
10161
|
return Array.isArray(filter.value) && Array.isArray(value) ? filter.value.every(item => value.includes(item) === false) : false;
|
10005
10162
|
case exports.TableFilterComparator.HasAllOf:
|
10006
10163
|
return Array.isArray(filter.value) && Array.isArray(value) ? filter.value.filter(v => value.includes(v)).length === filter.value.length : false;
|
10164
|
+
case exports.TableFilterComparator.IsOneOf:
|
10165
|
+
if (!Array.isArray(filter.value)) return false;
|
10166
|
+
return filter.value.some(v => isWeakEqual$1(value, v));
|
10167
|
+
case exports.TableFilterComparator.IsNoneOf:
|
10168
|
+
if (!Array.isArray(filter.value)) return false;
|
10169
|
+
return filter.value.every(v => !isWeakEqual$1(value, v));
|
10007
10170
|
}
|
10008
10171
|
return false;
|
10009
10172
|
} catch (e) {
|
@@ -10028,7 +10191,13 @@ function isMatched(searchQuery, cellValue, dataType, localization) {
|
|
10028
10191
|
const cellDisplayValue = dataTypeProperties.getDisplayValue(cellValue, {
|
10029
10192
|
localization
|
10030
10193
|
});
|
10031
|
-
if (
|
10194
|
+
if (Array.isArray(cellDisplayValue)) {
|
10195
|
+
for (const displayValue of cellDisplayValue) {
|
10196
|
+
if (isWeakContains(displayValue, searchQuery)) {
|
10197
|
+
return true;
|
10198
|
+
}
|
10199
|
+
}
|
10200
|
+
} else if (cellDisplayValue !== undefined && isWeakContains(cellDisplayValue, searchQuery)) {
|
10032
10201
|
return true;
|
10033
10202
|
}
|
10034
10203
|
}
|
@@ -10201,6 +10370,9 @@ function unfreezeAllExternalColumns(leftPinnedState) {
|
|
10201
10370
|
function freezeUptoExternalColumn(index, columns) {
|
10202
10371
|
return columns.slice(0, index + 1);
|
10203
10372
|
}
|
10373
|
+
function getHiddenColumns(columnVisibility = {}) {
|
10374
|
+
return Object.keys(columnVisibility).filter(c => columnVisibility[c] === false);
|
10375
|
+
}
|
10204
10376
|
|
10205
10377
|
function getSettings(table) {
|
10206
10378
|
const meta = table.options.meta;
|
@@ -10298,7 +10470,10 @@ function processChildren(child, columns, defaultSizing, defaultSorting, defaultV
|
|
10298
10470
|
// To avoid errors caused by undefined row data values, we pass accessorFn as a preventive measure
|
10299
10471
|
// accessorKey can be dot notated strings, so we use lodash.get to access deeply nested children
|
10300
10472
|
accessorFn: row => get(row, accessorKey),
|
10301
|
-
header
|
10473
|
+
// The header can be either a string or a JSX.Element, but react-table expects it to be a string or a
|
10474
|
+
// renderer function, so `() => header` ensures compatibility when header is a JSX.Element.
|
10475
|
+
// If we just pass `() => header`, then we will loose truncation for string headers.
|
10476
|
+
header: typeof header === 'string' ? header : () => header,
|
10302
10477
|
// features
|
10303
10478
|
enableColumnFilter,
|
10304
10479
|
enableGlobalFilter,
|
@@ -10326,10 +10501,15 @@ function processChildren(child, columns, defaultSizing, defaultSorting, defaultV
|
|
10326
10501
|
column.cell = info => renderer(info.getValue(), info.row.original);
|
10327
10502
|
} else if (dataTypeProperties.getDisplayValue) {
|
10328
10503
|
const dataTypeRenderer = value => {
|
10329
|
-
var _dataTypeProperties$g
|
10330
|
-
|
10504
|
+
var _dataTypeProperties$g;
|
10505
|
+
const displayValue = (_dataTypeProperties$g = dataTypeProperties.getDisplayValue) === null || _dataTypeProperties$g === void 0 ? void 0 : _dataTypeProperties$g.call(dataTypeProperties, value, {
|
10331
10506
|
localization
|
10332
|
-
})
|
10507
|
+
});
|
10508
|
+
if (Array.isArray(displayValue)) {
|
10509
|
+
var _displayValue$;
|
10510
|
+
return (_displayValue$ = displayValue[0]) !== null && _displayValue$ !== void 0 ? _displayValue$ : value;
|
10511
|
+
}
|
10512
|
+
return displayValue !== null && displayValue !== void 0 ? displayValue : value;
|
10333
10513
|
};
|
10334
10514
|
column.cell = info => dataTypeRenderer(info.getValue());
|
10335
10515
|
column.meta.renderer = dataTypeRenderer;
|
@@ -10460,7 +10640,8 @@ function configureReactTableOptions(options, props, localization) {
|
|
10460
10640
|
getExpandedRowModel: reactTable.getExpandedRowModel(),
|
10461
10641
|
getGroupedRowModel: reactTable.getGroupedRowModel(),
|
10462
10642
|
getRowId,
|
10463
|
-
groupedColumnMode: false
|
10643
|
+
groupedColumnMode: false,
|
10644
|
+
keepPinnedRows: false
|
10464
10645
|
};
|
10465
10646
|
if (tableOptions.enableColumnResizing) {
|
10466
10647
|
tableOptions.columnResizeMode = 'onChange';
|
@@ -10482,6 +10663,12 @@ function configureReactTableOptions(options, props, localization) {
|
|
10482
10663
|
var _column$columnDef$met;
|
10483
10664
|
return ((_column$columnDef$met = column.columnDef.meta) === null || _column$columnDef$met === void 0 ? void 0 : _column$columnDef$met.enableSearch) !== false && column.getIsVisible();
|
10484
10665
|
};
|
10666
|
+
// enter controlled search mode (controlled could be local state, but usually the server)
|
10667
|
+
if (props.onChangeSearch) {
|
10668
|
+
if (props._experimentalDataLoader2) {
|
10669
|
+
tableOptions.manualFiltering = true;
|
10670
|
+
}
|
10671
|
+
}
|
10485
10672
|
}
|
10486
10673
|
if (tableOptions.enableSorting) {
|
10487
10674
|
// enter controlled sort mode (controlled could be local state, but usually the server)
|
@@ -10539,6 +10726,7 @@ const DEFAULT_PRESET = {
|
|
10539
10726
|
enableColumnHiding: false,
|
10540
10727
|
enableColumnResizing: false,
|
10541
10728
|
enableRowExpansion: false,
|
10729
|
+
enableRowExpansionAll: true,
|
10542
10730
|
enableRowSelection: false,
|
10543
10731
|
// custom -- common between all table types
|
10544
10732
|
enableColumnOrdering: false,
|
@@ -10565,6 +10753,7 @@ const presets = {
|
|
10565
10753
|
enableColumnHiding: true,
|
10566
10754
|
enableColumnResizing: true,
|
10567
10755
|
enableRowExpansion: true,
|
10756
|
+
enableRowExpansionAll: true,
|
10568
10757
|
enableRowSelection: true,
|
10569
10758
|
// custom -- common between all table types
|
10570
10759
|
enableColumnOrdering: true,
|
@@ -10590,6 +10779,7 @@ const presets = {
|
|
10590
10779
|
enableColumnHiding: false,
|
10591
10780
|
enableColumnResizing: false,
|
10592
10781
|
enableRowExpansion: true,
|
10782
|
+
enableRowExpansionAll: true,
|
10593
10783
|
enableRowSelection: true,
|
10594
10784
|
// custom -- common between all table types
|
10595
10785
|
enableColumnOrdering: false,
|
@@ -10615,6 +10805,7 @@ const presets = {
|
|
10615
10805
|
enableColumnHiding: false,
|
10616
10806
|
enableColumnResizing: false,
|
10617
10807
|
enableRowExpansion: true,
|
10808
|
+
enableRowExpansionAll: true,
|
10618
10809
|
enableRowSelection: false,
|
10619
10810
|
// custom -- common between all table types
|
10620
10811
|
enableColumnOrdering: false,
|
@@ -10632,7 +10823,7 @@ const presets = {
|
|
10632
10823
|
}
|
10633
10824
|
};
|
10634
10825
|
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;
|
10826
|
+
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
10827
|
const presetOptions = props.preset ? presets[props.preset] : DEFAULT_PRESET;
|
10637
10828
|
const enableRowActions = (_props$enableRowActio = props.enableRowActions) !== null && _props$enableRowActio !== void 0 ? _props$enableRowActio : presetOptions.enableRowActions;
|
10638
10829
|
const enableRowClick = (_props$enableRowClick = props.enableRowClick) !== null && _props$enableRowClick !== void 0 ? _props$enableRowClick : presetOptions.enableRowClick;
|
@@ -10640,6 +10831,7 @@ function getTableFeaturePreset(props) {
|
|
10640
10831
|
const enableRowDrop = (_props$enableRowDrop = props.enableRowDrop) !== null && _props$enableRowDrop !== void 0 ? _props$enableRowDrop : presetOptions.enableRowDrop;
|
10641
10832
|
const enableRowGoto = (_props$enableRowGoto = props.enableRowGoto) !== null && _props$enableRowGoto !== void 0 ? _props$enableRowGoto : presetOptions.enableRowGoto;
|
10642
10833
|
const enableRowExpansion = (_props$enableRowExpan = props.enableRowExpansion) !== null && _props$enableRowExpan !== void 0 ? _props$enableRowExpan : presetOptions.enableRowExpansion;
|
10834
|
+
const enableRowExpansionAll = (_props$enableRowExpan2 = props.enableRowExpansionAll) !== null && _props$enableRowExpan2 !== void 0 ? _props$enableRowExpan2 : presetOptions.enableRowExpansionAll;
|
10643
10835
|
const enableRowSelection = (_props$enableRowSelec = props.enableRowSelection) !== null && _props$enableRowSelec !== void 0 ? _props$enableRowSelec : presetOptions.enableRowSelection;
|
10644
10836
|
return {
|
10645
10837
|
// react-table built-in
|
@@ -10664,6 +10856,7 @@ function getTableFeaturePreset(props) {
|
|
10664
10856
|
enableRowDrag: enableRowDrag && !!props.onRowDrag,
|
10665
10857
|
enableRowDrop: enableRowDrop && !!props.onRowDrop,
|
10666
10858
|
enableRowGoto: enableRowGoto && !!props.onRowGoto,
|
10859
|
+
enableRowExpansionAll: enableRowExpansion && enableRowExpansionAll && !!props.rowExpansionRenderer,
|
10667
10860
|
enableRowHeight: (_props$enableRowHeigh = props.enableRowHeight) !== null && _props$enableRowHeigh !== void 0 ? _props$enableRowHeigh : presetOptions.enableRowHeight,
|
10668
10861
|
enableSaveSettings: (_props$enableSaveSett = props.enableSaveSettings) !== null && _props$enableSaveSett !== void 0 ? _props$enableSaveSett : presetOptions.enableSaveSettings
|
10669
10862
|
};
|
@@ -10783,8 +10976,17 @@ function useTablePrintingSettings(tableId) {
|
|
10783
10976
|
|
10784
10977
|
const DEFAULT_ROW_ACTIONS_LENGTH = 4;
|
10785
10978
|
function useTableRowActions(isEnabled = false, rowActions, rowActionsLength = DEFAULT_ROW_ACTIONS_LENGTH) {
|
10979
|
+
const [handlers, setHandlers] = React__default.useState({});
|
10980
|
+
const registerHandler = (key, handler) => {
|
10981
|
+
return setHandlers(h => ({
|
10982
|
+
...h,
|
10983
|
+
[key]: handler
|
10984
|
+
}));
|
10985
|
+
};
|
10786
10986
|
return {
|
10987
|
+
handlers,
|
10787
10988
|
isEnabled,
|
10989
|
+
registerHandler,
|
10788
10990
|
rowActions: isEnabled ? rowActions : undefined,
|
10789
10991
|
rowActionsLength: rowActions ? Math.min(rowActions.length, rowActionsLength) : 0
|
10790
10992
|
};
|
@@ -10859,7 +11061,7 @@ function useTableRowActive(isEnabled = false, initialRowActiveIndex) {
|
|
10859
11061
|
return index;
|
10860
11062
|
});
|
10861
11063
|
}
|
10862
|
-
}, [rowActiveIndex,
|
11064
|
+
}, [rowActiveIndex, isEnabled]);
|
10863
11065
|
return {
|
10864
11066
|
isEnabled,
|
10865
11067
|
rowActiveIndex,
|
@@ -10908,9 +11110,10 @@ function useTableRowClick(isEnabled = false, onRowClick) {
|
|
10908
11110
|
};
|
10909
11111
|
}
|
10910
11112
|
|
10911
|
-
function useTableRowExpansion(isEnabled = false, rowExpansionRenderer) {
|
11113
|
+
function useTableRowExpansion(isEnabled = false, canExpandAll = true, rowExpansionRenderer) {
|
10912
11114
|
return {
|
10913
11115
|
isEnabled,
|
11116
|
+
canExpandAll,
|
10914
11117
|
rowExpansionRenderer: isEnabled ? rowExpansionRenderer : undefined
|
10915
11118
|
};
|
10916
11119
|
}
|
@@ -10974,7 +11177,7 @@ function useTableRowSelection(isEnabled = false) {
|
|
10974
11177
|
- Highlighting search results, this is custom and only uses the state part of globalFilter (to store the search query)
|
10975
11178
|
- Filtering of results, this is essentially the built in filtering, and relies on enableGlobalFilter being on or off
|
10976
11179
|
*/
|
10977
|
-
function useTableSearch(isEnabled = false, defaultEnableGlobalFilter = false) {
|
11180
|
+
function useTableSearch(isEnabled = false, onChangeSearch, defaultEnableGlobalFilter = false) {
|
10978
11181
|
const [enableGlobalFilter, _setEnableGlobalFilter] = React__default.useState(defaultEnableGlobalFilter);
|
10979
11182
|
function setEnableGlobalFilter(enabled, instance) {
|
10980
11183
|
_setEnableGlobalFilter(enabled);
|
@@ -10999,7 +11202,8 @@ function useTableSearch(isEnabled = false, defaultEnableGlobalFilter = false) {
|
|
10999
11202
|
highlightedColumnIndexes,
|
11000
11203
|
setHighlightedColumnIndexes,
|
11001
11204
|
currentHighlightColumnIndex,
|
11002
|
-
setCurrentHighlightColumnIndex
|
11205
|
+
setCurrentHighlightColumnIndex,
|
11206
|
+
handleSearch: isEnabled && typeof onChangeSearch === 'function' ? onChangeSearch : undefined
|
11003
11207
|
};
|
11004
11208
|
}
|
11005
11209
|
|
@@ -11209,9 +11413,10 @@ function useTableDataLoader(fetchPage, fetchAll, options = {
|
|
11209
11413
|
const _lastUsedSorting = React__default.useRef([]);
|
11210
11414
|
const _lastUsedFilters = React__default.useRef([]);
|
11211
11415
|
const _lastUsedSearch = React__default.useRef();
|
11416
|
+
const _lastUsedHiddenColumns = React__default.useRef([]);
|
11212
11417
|
const _lastUsedPageIndex = React__default.useRef();
|
11213
11418
|
const _forceReset = React__default.useRef(false);
|
11214
|
-
const loadPage = function (pageIndex, sorting, filters) {
|
11419
|
+
const loadPage = function (pageIndex, sorting, filters, hiddenColumns) {
|
11215
11420
|
try {
|
11216
11421
|
let reset = false;
|
11217
11422
|
// sorting or filters changed, reset everything
|
@@ -11233,9 +11438,10 @@ function useTableDataLoader(fetchPage, fetchAll, options = {
|
|
11233
11438
|
_lastUsedSorting.current = sorting;
|
11234
11439
|
// set the filters so we can track if it changed between loads
|
11235
11440
|
_lastUsedFilters.current = filters;
|
11441
|
+
_lastUsedHiddenColumns.current = hiddenColumns;
|
11236
11442
|
const _temp = _finallyRethrows(function () {
|
11237
11443
|
return _catch(function () {
|
11238
|
-
return Promise.resolve(fetchPage(pageIndex, pageSize, sorting, filters)).then(function (response) {
|
11444
|
+
return Promise.resolve(fetchPage(pageIndex, pageSize, sorting, filters, hiddenColumns)).then(function (response) {
|
11239
11445
|
// update state, here we do some "magic" to support "load in place"
|
11240
11446
|
setData(currentData => {
|
11241
11447
|
let nextData;
|
@@ -11264,14 +11470,15 @@ function useTableDataLoader(fetchPage, fetchAll, options = {
|
|
11264
11470
|
return Promise.reject(e);
|
11265
11471
|
}
|
11266
11472
|
};
|
11267
|
-
const loadAll = function (sorting, filters) {
|
11473
|
+
const loadAll = function (sorting, filters, hiddenColumns) {
|
11268
11474
|
try {
|
11269
11475
|
// set the sorting so we can track if it changed between loads
|
11270
11476
|
_lastUsedSorting.current = sorting;
|
11271
11477
|
// set the filters so we can track if it changed between loads
|
11272
11478
|
_lastUsedFilters.current = filters;
|
11479
|
+
_lastUsedHiddenColumns.current = hiddenColumns;
|
11273
11480
|
const _temp2 = _catch(function () {
|
11274
|
-
return Promise.resolve(fetchAll(sorting, filters)).then(function (response) {
|
11481
|
+
return Promise.resolve(fetchAll(sorting, filters, hiddenColumns)).then(function (response) {
|
11275
11482
|
length.current = response.length;
|
11276
11483
|
setData(() => {
|
11277
11484
|
let nextData;
|
@@ -11296,11 +11503,11 @@ function useTableDataLoader(fetchPage, fetchAll, options = {
|
|
11296
11503
|
_forceReset.current = true;
|
11297
11504
|
if (_lastUsedSearch.current) {
|
11298
11505
|
// we're searching, which means we need to refetch all with the correct sorting applied
|
11299
|
-
return loadAll(_lastUsedSorting.current, _lastUsedFilters.current);
|
11506
|
+
return loadAll(_lastUsedSorting.current, _lastUsedFilters.current, _lastUsedHiddenColumns.current);
|
11300
11507
|
} else {
|
11301
11508
|
var _lastUsedPageIndex$cu;
|
11302
11509
|
// 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);
|
11510
|
+
return loadPage((_lastUsedPageIndex$cu = _lastUsedPageIndex.current) !== null && _lastUsedPageIndex$cu !== void 0 ? _lastUsedPageIndex$cu : 0, _lastUsedSorting.current, _lastUsedFilters.current, _lastUsedHiddenColumns.current);
|
11304
11511
|
}
|
11305
11512
|
} catch (e) {
|
11306
11513
|
return Promise.reject(e);
|
@@ -11312,13 +11519,12 @@ function useTableDataLoader(fetchPage, fetchAll, options = {
|
|
11312
11519
|
try {
|
11313
11520
|
if (_lastUsedSearch.current) {
|
11314
11521
|
// we're searching, which means we need to refetch all with the correct sorting applied
|
11315
|
-
loadAll(sorting, _lastUsedFilters.current);
|
11522
|
+
return loadAll(sorting, _lastUsedFilters.current, _lastUsedHiddenColumns.current);
|
11316
11523
|
} else {
|
11317
11524
|
var _lastUsedPageIndex$cu2;
|
11318
11525
|
// 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);
|
11526
|
+
return loadPage((_lastUsedPageIndex$cu2 = _lastUsedPageIndex.current) !== null && _lastUsedPageIndex$cu2 !== void 0 ? _lastUsedPageIndex$cu2 : 0, sorting, _lastUsedFilters.current, _lastUsedHiddenColumns.current);
|
11320
11527
|
}
|
11321
|
-
return Promise.resolve();
|
11322
11528
|
} catch (e) {
|
11323
11529
|
return Promise.reject(e);
|
11324
11530
|
}
|
@@ -11327,13 +11533,12 @@ function useTableDataLoader(fetchPage, fetchAll, options = {
|
|
11327
11533
|
try {
|
11328
11534
|
if (_lastUsedSearch.current) {
|
11329
11535
|
// we're searching, which means we need to refetch all with the correct sorting applied
|
11330
|
-
loadAll(_lastUsedSorting.current, filters);
|
11536
|
+
return loadAll(_lastUsedSorting.current, filters, _lastUsedHiddenColumns.current);
|
11331
11537
|
} else {
|
11332
11538
|
var _lastUsedPageIndex$cu3;
|
11333
11539
|
// 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);
|
11540
|
+
return loadPage((_lastUsedPageIndex$cu3 = _lastUsedPageIndex.current) !== null && _lastUsedPageIndex$cu3 !== void 0 ? _lastUsedPageIndex$cu3 : 0, _lastUsedSorting.current, filters, _lastUsedHiddenColumns.current);
|
11335
11541
|
}
|
11336
|
-
return Promise.resolve();
|
11337
11542
|
} catch (e) {
|
11338
11543
|
return Promise.reject(e);
|
11339
11544
|
}
|
@@ -11361,10 +11566,17 @@ function useTableDataLoader(fetchPage, fetchAll, options = {
|
|
11361
11566
|
}, invalidate];
|
11362
11567
|
}
|
11363
11568
|
|
11364
|
-
function useTableServerLoading(loadPage, loadAll, pageSize = DEFAULT_PAGE_SIZE) {
|
11569
|
+
function useTableServerLoading(length, data, loadPage, loadAll, pages, pageSize = DEFAULT_PAGE_SIZE, _experimentalDataLoader2 = false) {
|
11365
11570
|
const isEnabled = !!loadPage && !!loadAll;
|
11366
11571
|
const [isReady, setReady] = React__default.useState(false);
|
11367
|
-
const [
|
11572
|
+
const [loading, setLoading] = React__default.useState(false);
|
11573
|
+
const hasLoadedAll = React__default.useMemo(() => {
|
11574
|
+
var _data$some;
|
11575
|
+
if (data.length !== length || !!((_data$some = data.some) !== null && _data$some !== void 0 && _data$some.call(data, x => x === undefined))) {
|
11576
|
+
return false;
|
11577
|
+
}
|
11578
|
+
return true;
|
11579
|
+
}, [data, length]);
|
11368
11580
|
let _loadPage;
|
11369
11581
|
let _loadAll;
|
11370
11582
|
let _loadAllIfNeeded;
|
@@ -11389,9 +11601,9 @@ function useTableServerLoading(loadPage, loadAll, pageSize = DEFAULT_PAGE_SIZE)
|
|
11389
11601
|
try {
|
11390
11602
|
const _temp2 = function () {
|
11391
11603
|
if (typeof loadAll === 'function') {
|
11392
|
-
|
11604
|
+
setLoading(true);
|
11393
11605
|
return Promise.resolve(loadAll(...args)).then(function () {
|
11394
|
-
|
11606
|
+
setLoading(false);
|
11395
11607
|
setReady(true);
|
11396
11608
|
});
|
11397
11609
|
}
|
@@ -11404,7 +11616,7 @@ function useTableServerLoading(loadPage, loadAll, pageSize = DEFAULT_PAGE_SIZE)
|
|
11404
11616
|
_loadAllIfNeeded = function (...args) {
|
11405
11617
|
try {
|
11406
11618
|
const _temp3 = function () {
|
11407
|
-
if (
|
11619
|
+
if (!hasLoadedAll) {
|
11408
11620
|
var _loadAll2;
|
11409
11621
|
return Promise.resolve((_loadAll2 = _loadAll) === null || _loadAll2 === void 0 ? void 0 : _loadAll2(...args)).then(function () {});
|
11410
11622
|
}
|
@@ -11415,14 +11627,18 @@ function useTableServerLoading(loadPage, loadAll, pageSize = DEFAULT_PAGE_SIZE)
|
|
11415
11627
|
}
|
11416
11628
|
};
|
11417
11629
|
}
|
11630
|
+
const pageCount = Math.ceil(length / pageSize);
|
11418
11631
|
return {
|
11632
|
+
pages,
|
11419
11633
|
isEnabled,
|
11420
11634
|
isReady,
|
11421
11635
|
loadPage: _loadPage,
|
11422
11636
|
loadAll: _loadAll,
|
11423
11637
|
loadAllIfNeeded: _loadAllIfNeeded,
|
11424
|
-
|
11425
|
-
pageSize
|
11638
|
+
loading,
|
11639
|
+
pageSize,
|
11640
|
+
pageCount,
|
11641
|
+
_experimentalDataLoader2
|
11426
11642
|
};
|
11427
11643
|
}
|
11428
11644
|
|
@@ -11494,22 +11710,21 @@ function useLazyEffect(effect, deps) {
|
|
11494
11710
|
const readyRef = React__default.useRef(false);
|
11495
11711
|
React__default.useEffect(() => {
|
11496
11712
|
if (readyRef.current) {
|
11497
|
-
effect();
|
11713
|
+
return effect();
|
11498
11714
|
} else {
|
11499
11715
|
readyRef.current = true;
|
11500
11716
|
}
|
11501
11717
|
}, deps);
|
11502
11718
|
}
|
11503
11719
|
|
11504
|
-
function useTableDataListener(table) {
|
11720
|
+
function useTableDataListener(table, length) {
|
11505
11721
|
const meta = table.options.meta;
|
11506
|
-
const rows = table.getRowModel().rows;
|
11507
11722
|
useLazyEffect(() => {
|
11508
11723
|
const rowActiveIndex = meta.rowActive.rowActiveIndex;
|
11509
|
-
if (rowActiveIndex !== undefined && rowActiveIndex >
|
11724
|
+
if (rowActiveIndex !== undefined && rowActiveIndex > length) {
|
11510
11725
|
meta.rowActive.setRowActiveIndex(0);
|
11511
11726
|
}
|
11512
|
-
}, [
|
11727
|
+
}, [length]);
|
11513
11728
|
}
|
11514
11729
|
|
11515
11730
|
// we use a listener, and not the internal "controlled" change handlers because we don't actually want consumers
|
@@ -11519,7 +11734,8 @@ function useTableFilterListener(table, onFilter) {
|
|
11519
11734
|
const columnFilters = table.getState().columnFilters;
|
11520
11735
|
useLazyEffect(() => {
|
11521
11736
|
if (table.options.enableColumnFilters && typeof onFilter === 'function') {
|
11522
|
-
|
11737
|
+
const hiddenColumns = getHiddenColumns(table.getState().columnVisibility);
|
11738
|
+
onFilter(columnFilters, hiddenColumns);
|
11523
11739
|
if (table.options.enableRowSelection) {
|
11524
11740
|
table.resetRowSelection();
|
11525
11741
|
}
|
@@ -11536,7 +11752,8 @@ function useTableFontSizeListener(table) {
|
|
11536
11752
|
table.setColumnSizing(sizes => {
|
11537
11753
|
return Object.fromEntries(Object.entries(sizes).map(([columnName, prevColumnSize]) => {
|
11538
11754
|
var _column$columnDef$min;
|
11539
|
-
|
11755
|
+
// table.getColumn(columName) throw error in strict dev mode. Related thread: https://github.com/TanStack/table/discussions/5505
|
11756
|
+
const column = table.getAllColumns().find(x => x.id === columnName);
|
11540
11757
|
if (isInternalColumn(columnName)) {
|
11541
11758
|
var _column$getSize;
|
11542
11759
|
return [columnName, (_column$getSize = column === null || column === void 0 ? void 0 : column.getSize()) !== null && _column$getSize !== void 0 ? _column$getSize : prevColumnSize];
|
@@ -11577,11 +11794,12 @@ function useTableRowHeightListener(table) {
|
|
11577
11794
|
}
|
11578
11795
|
|
11579
11796
|
function useTableRowSelectionListener(table, onRowSelect) {
|
11797
|
+
// note that the selected row model may not contain all rows in state when using server loading
|
11580
11798
|
const rows = table.getSelectedRowModel().flatRows;
|
11581
|
-
const
|
11799
|
+
const state = table.getState().rowSelection;
|
11582
11800
|
useLazyEffect(() => {
|
11583
11801
|
if (table.options.enableRowSelection && typeof onRowSelect === 'function') {
|
11584
|
-
onRowSelect(
|
11802
|
+
onRowSelect(rows.map(row => row.original), Object.keys(state));
|
11585
11803
|
}
|
11586
11804
|
/**
|
11587
11805
|
* Casting to a boolean, since enableRowSelection can be a function,
|
@@ -11589,33 +11807,33 @@ function useTableRowSelectionListener(table, onRowSelect) {
|
|
11589
11807
|
* we only need to know if selection was enabled or disabled, because enableRowSelection function
|
11590
11808
|
* will be applied directly to particular rows.
|
11591
11809
|
*/
|
11592
|
-
}, [!!table.options.enableRowSelection, JSON.stringify(
|
11810
|
+
}, [!!table.options.enableRowSelection, JSON.stringify(state)]);
|
11593
11811
|
}
|
11594
11812
|
|
11595
|
-
function useTableSearchListener(table
|
11813
|
+
function useTableSearchListener(table) {
|
11596
11814
|
const meta = table.options.meta;
|
11597
11815
|
const localization = useLocalization();
|
11598
|
-
const
|
11816
|
+
const hiddenColumns = getHiddenColumns(table.getState().columnVisibility);
|
11817
|
+
const query = table.getState().globalFilter;
|
11599
11818
|
// Need to re-run search when columns are getting shown/hidden.
|
11600
|
-
|
11601
|
-
if (meta.search.isEnabled
|
11602
|
-
const currentFilter =
|
11819
|
+
useLazyEffect(() => {
|
11820
|
+
if (meta.search.isEnabled) {
|
11821
|
+
const currentFilter = query;
|
11603
11822
|
requestAnimationFrame(() => {
|
11604
11823
|
table.resetGlobalFilter();
|
11605
11824
|
table.setGlobalFilter(currentFilter);
|
11606
11825
|
});
|
11826
|
+
if (meta.search.handleSearch && meta.search.enableGlobalFilter && query) {
|
11827
|
+
meta.search.handleSearch(query, hiddenColumns);
|
11828
|
+
}
|
11607
11829
|
}
|
11608
|
-
}, [
|
11830
|
+
}, [hiddenColumns.length]);
|
11609
11831
|
// recalculates highlighted indexes whenever something important changes
|
11610
|
-
|
11832
|
+
useLazyEffect(() => {
|
11611
11833
|
if (meta.search.isEnabled) {
|
11612
|
-
const query = table.getState().globalFilter;
|
11613
11834
|
resetHighlightedColumnIndexes(query, table, localization);
|
11614
|
-
if (typeof onChangeSearch === 'function') {
|
11615
|
-
onChangeSearch(query);
|
11616
|
-
}
|
11617
11835
|
}
|
11618
|
-
}, [meta.server.
|
11836
|
+
}, [meta.server.loading, meta.search.isEnabled, meta.search.enableGlobalFilter, table.getRowModel().rows.length, query, JSON.stringify(table.getState().sorting)]);
|
11619
11837
|
}
|
11620
11838
|
|
11621
11839
|
function useTableSettingsListener(table, onChangeSettings) {
|
@@ -11699,12 +11917,15 @@ function useTableSortingListener(table, onSort) {
|
|
11699
11917
|
}
|
11700
11918
|
|
11701
11919
|
function useTableServerLoadingListener(table, loadPage) {
|
11702
|
-
const
|
11703
|
-
const columnFilters = table.getState().columnFilters;
|
11920
|
+
const meta = table.options.meta;
|
11704
11921
|
// trigger load of the first page on mount
|
11705
11922
|
React__default.useEffect(() => {
|
11706
11923
|
if (loadPage) {
|
11707
|
-
|
11924
|
+
const sorting = table.getState().sorting;
|
11925
|
+
const columnFilters = table.getState().columnFilters;
|
11926
|
+
const hiddenColumns = getHiddenColumns(table.getState().columnVisibility);
|
11927
|
+
const search = meta.search.enableGlobalFilter ? table.getState().globalFilter : undefined;
|
11928
|
+
loadPage(0, sorting, columnFilters, hiddenColumns, search);
|
11708
11929
|
}
|
11709
11930
|
}, []);
|
11710
11931
|
}
|
@@ -11751,13 +11972,13 @@ function useTableManager(props, meta, internalColumns) {
|
|
11751
11972
|
const rowClick = useTableRowClick(options.enableRowClick, props.onRowClick);
|
11752
11973
|
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
11974
|
const rowDrop = useTableRowDrop(options.enableRowDrop, props.onRowDrop);
|
11754
|
-
const rowExpansion = useTableRowExpansion(options.enableRowExpansion, props.rowExpansionRenderer);
|
11975
|
+
const rowExpansion = useTableRowExpansion(options.enableRowExpansion, options.enableRowExpansionAll, props.rowExpansionRenderer);
|
11755
11976
|
const rowGoto = useTableRowGoto(options.enableRowGoto, props.onRowGoto);
|
11756
11977
|
const rowGroups = useTableRowGroups(props.rowActionsForGroup);
|
11757
11978
|
const rowHeight = useTableRowHeight(options.enableRowHeight, settings.rowHeight);
|
11758
11979
|
const rowSelection = useTableRowSelection(!!options.enableRowSelection);
|
11759
|
-
const search = useTableSearch(options.enableSearch, settings.excludeUnmatchedRecordsInSearch);
|
11760
|
-
const server = useTableServerLoading(props.loadPage, props.loadAll, props.pageSize);
|
11980
|
+
const search = useTableSearch(options.enableSearch, props.onChangeSearch, settings.excludeUnmatchedRecordsInSearch);
|
11981
|
+
const server = useTableServerLoading(length, data, props.loadPage, props.loadAll, props.pages, props.pageSize, props._experimentalDataLoader2);
|
11761
11982
|
// TODO: memoise
|
11762
11983
|
// convert jsx column components into valid table columns
|
11763
11984
|
const {
|
@@ -11786,6 +12007,7 @@ function useTableManager(props, meta, internalColumns) {
|
|
11786
12007
|
fontSize,
|
11787
12008
|
footer,
|
11788
12009
|
length,
|
12010
|
+
onEvent: props.onEvent,
|
11789
12011
|
printing,
|
11790
12012
|
rowActions: rowActions,
|
11791
12013
|
rowActive,
|
@@ -11803,12 +12025,12 @@ function useTableManager(props, meta, internalColumns) {
|
|
11803
12025
|
}
|
11804
12026
|
});
|
11805
12027
|
// state listeners - we have these so that we don't have to control state outside the table
|
11806
|
-
useTableDataListener(instance);
|
12028
|
+
useTableDataListener(instance, length);
|
11807
12029
|
useTableFilterListener(instance, props.onChangeFilter);
|
11808
12030
|
useTableFontSizeListener(instance);
|
11809
12031
|
useTableRowHeightListener(instance);
|
11810
12032
|
useTableRowSelectionListener(instance, props.onRowSelect);
|
11811
|
-
useTableSearchListener(instance
|
12033
|
+
useTableSearchListener(instance);
|
11812
12034
|
useTableServerLoadingListener(instance, server.loadPage);
|
11813
12035
|
useTableSettingsListener(instance, setSettings);
|
11814
12036
|
useTableShortcutsListener(instance, props.shortcuts);
|
@@ -11877,9 +12099,9 @@ function useTableStyleGrid(tableId, table, fontSize) {
|
|
11877
12099
|
};
|
11878
12100
|
// printing grid
|
11879
12101
|
// 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}
|
12102
|
+
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
12103
|
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; }}`;
|
12104
|
+
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
12105
|
return {
|
11884
12106
|
style,
|
11885
12107
|
stylesheet
|
@@ -12034,7 +12256,7 @@ function useTableGlobalShortcuts(table, tableRef, scrollToIndex) {
|
|
12034
12256
|
if (isElementInsideOverlay(trigger) && !isSiblingElementInsideSameParentOverlay(trigger, tableRef.current) || isElementInteractive(trigger) && !isElementInsideOrTriggeredFromContainer(trigger, tableRef.current)) {
|
12035
12257
|
return;
|
12036
12258
|
}
|
12037
|
-
tableMeta.rowActive.handleKeyDown(event,
|
12259
|
+
tableMeta.rowActive.handleKeyDown(event, tableMeta.length, scrollToIndex);
|
12038
12260
|
tableMeta.rowSelection.handleKeyDown(event, table);
|
12039
12261
|
if (tableMeta.rowActive.rowActiveIndex !== undefined) {
|
12040
12262
|
var _rows$tableMeta$rowAc;
|
@@ -12047,7 +12269,7 @@ function useTableGlobalShortcuts(table, tableRef, scrollToIndex) {
|
|
12047
12269
|
};
|
12048
12270
|
},
|
12049
12271
|
// scrollToIndex function changes when row count changes, so it is important to update handlers
|
12050
|
-
[tableRef.current, tableMeta.rowActive.rowActiveIndex, scrollToIndex]);
|
12272
|
+
[tableRef.current, tableMeta.length, tableMeta.rowActive.rowActiveIndex, scrollToIndex]);
|
12051
12273
|
}
|
12052
12274
|
|
12053
12275
|
function useTableRef(table, ref) {
|
@@ -12070,57 +12292,131 @@ const ROW_HEIGHT_ESTIMATES = {
|
|
12070
12292
|
'extra-tall': 57
|
12071
12293
|
};
|
12072
12294
|
|
12295
|
+
const RowContext = /*#__PURE__*/React__default.createContext({
|
12296
|
+
hideInternalColumns: false,
|
12297
|
+
hideRowActions: false,
|
12298
|
+
isHovered: false,
|
12299
|
+
rowIndex: -1
|
12300
|
+
});
|
12301
|
+
|
12302
|
+
const DELAY_BEFORE_LOAD_MS = 250;
|
12303
|
+
/* anonymous functions will break the memoisation on each render, wrap handlers in callbacks */
|
12304
|
+
function Row(props) {
|
12305
|
+
const {
|
12306
|
+
renderer: RowRenderer,
|
12307
|
+
cellRenderer: CellRenderer,
|
12308
|
+
hideInternalColumns = false,
|
12309
|
+
hideRowActions = false,
|
12310
|
+
scrollDirection,
|
12311
|
+
skipPageLoading = false,
|
12312
|
+
...displayRowProps
|
12313
|
+
} = props;
|
12314
|
+
const tableMeta = props.table.options.meta;
|
12315
|
+
const isHovered = tableMeta.rowActive.rowHoverIndex === props.index;
|
12316
|
+
// context - it must be here for cells to read it, since they render alongside the row inside DisplayRow
|
12317
|
+
const contextValue = React__default.useMemo(() => ({
|
12318
|
+
isHovered,
|
12319
|
+
rowIndex: props.index,
|
12320
|
+
hideInternalColumns,
|
12321
|
+
hideRowActions
|
12322
|
+
}), [isHovered, props.index, hideInternalColumns, hideRowActions]);
|
12323
|
+
React__default.useEffect(() => {
|
12324
|
+
let timeout;
|
12325
|
+
if (tableMeta.server.isEnabled && tableMeta.server._experimentalDataLoader2 && !skipPageLoading) {
|
12326
|
+
const pageIndex = Math.floor(props.index / tableMeta.server.pageSize) * tableMeta.server.pageSize / tableMeta.server.pageSize;
|
12327
|
+
const sorting = props.table.getState().sorting;
|
12328
|
+
const filters = props.table.getState().columnFilters;
|
12329
|
+
const search = props.table.getState().globalFilter;
|
12330
|
+
const hiddenColumns = getHiddenColumns(props.table.getState().columnVisibility);
|
12331
|
+
const pageIndexesToFetch = [];
|
12332
|
+
// if there's no direction, it means the scroll bar got dropped un unloaded pages,
|
12333
|
+
// in that case, load forward and backward pages to prevent skeletons
|
12334
|
+
if (scrollDirection === 'backward' || !scrollDirection) {
|
12335
|
+
const backIndex = pageIndex - 1;
|
12336
|
+
if (backIndex > -1) {
|
12337
|
+
pageIndexesToFetch.push(backIndex);
|
12338
|
+
}
|
12339
|
+
}
|
12340
|
+
// always load the next page
|
12341
|
+
if ((scrollDirection === 'forward' || !scrollDirection) && pageIndex + 2 < tableMeta.server.pageCount) {
|
12342
|
+
pageIndexesToFetch.push(pageIndex + 1);
|
12343
|
+
}
|
12344
|
+
if (pageIndexesToFetch.length) {
|
12345
|
+
// the virtualiser fetches a page ahead, so this won't get called in most cases
|
12346
|
+
// but it provides a fallback for some edge cases
|
12347
|
+
timeout = setTimeout(() => {
|
12348
|
+
pageIndexesToFetch.forEach(index => {
|
12349
|
+
var _tableMeta$server$loa, _tableMeta$server;
|
12350
|
+
// this can be called by every row within the current page, but loadPage returns early if a pending request exists
|
12351
|
+
(_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);
|
12352
|
+
});
|
12353
|
+
}, DELAY_BEFORE_LOAD_MS);
|
12354
|
+
}
|
12355
|
+
}
|
12356
|
+
return () => {
|
12357
|
+
clearTimeout(timeout);
|
12358
|
+
};
|
12359
|
+
}, [tableMeta.server.pages]);
|
12360
|
+
return /*#__PURE__*/React__default.createElement(RowContext.Provider, {
|
12361
|
+
value: contextValue
|
12362
|
+
}, /*#__PURE__*/React__default.createElement(RowRenderer, Object.assign({}, displayRowProps, {
|
12363
|
+
cellRenderer: CellRenderer
|
12364
|
+
})));
|
12365
|
+
}
|
12366
|
+
|
12367
|
+
const DELAY_BEFORE_LOAD_MS$1 = 150;
|
12073
12368
|
function SkeletonRow(props) {
|
12074
12369
|
const {
|
12075
12370
|
index,
|
12076
|
-
row,
|
12077
12371
|
table
|
12078
12372
|
} = props;
|
12079
12373
|
const tableMeta = table.options.meta;
|
12080
12374
|
if (tableMeta.server.isEnabled) {
|
12081
|
-
return /*#__PURE__*/React__default.createElement(RowWithServerLoading, Object.assign({}, props
|
12082
|
-
index: index
|
12083
|
-
}));
|
12375
|
+
return /*#__PURE__*/React__default.createElement(RowWithServerLoading, Object.assign({}, props));
|
12084
12376
|
}
|
12085
12377
|
return /*#__PURE__*/React__default.createElement(Skeleton, {
|
12086
|
-
cellsCount:
|
12378
|
+
cellsCount: table.getVisibleFlatColumns().length,
|
12379
|
+
index: index
|
12087
12380
|
});
|
12088
12381
|
}
|
12089
12382
|
function RowWithServerLoading(props) {
|
12090
12383
|
var _table$getState$group, _table$getState;
|
12091
12384
|
const {
|
12092
12385
|
index,
|
12093
|
-
row,
|
12094
12386
|
table
|
12095
12387
|
} = props;
|
12096
12388
|
const tableMeta = table.options.meta;
|
12097
12389
|
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
12390
|
React__default.useEffect(() => {
|
12107
|
-
|
12108
|
-
|
12109
|
-
|
12391
|
+
let timeout;
|
12392
|
+
if (tableMeta.server.isEnabled) {
|
12393
|
+
const sorting = props.table.getState().sorting;
|
12394
|
+
const filters = props.table.getState().columnFilters;
|
12395
|
+
const search = props.table.getState().globalFilter;
|
12396
|
+
const hiddenColumns = getHiddenColumns(props.table.getState().columnVisibility);
|
12397
|
+
timeout = setTimeout(() => {
|
12398
|
+
var _tableMeta$server$loa, _tableMeta$server;
|
12399
|
+
(_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);
|
12400
|
+
}, DELAY_BEFORE_LOAD_MS$1);
|
12110
12401
|
}
|
12111
|
-
|
12402
|
+
return () => {
|
12403
|
+
clearTimeout(timeout);
|
12404
|
+
};
|
12405
|
+
}, []);
|
12112
12406
|
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 =
|
12407
|
+
const ungroupedCellCount = table.getVisibleFlatColumns().length - groupedCellCount;
|
12114
12408
|
return /*#__PURE__*/React__default.createElement(Skeleton, {
|
12115
12409
|
cellsCount: ungroupedCellCount,
|
12116
|
-
|
12410
|
+
index: index
|
12117
12411
|
});
|
12118
12412
|
}
|
12119
12413
|
const Skeleton = /*#__PURE__*/React__default.forwardRef(function Skeleton(props, ref) {
|
12120
12414
|
const {
|
12121
|
-
cellsCount
|
12415
|
+
cellsCount,
|
12416
|
+
index
|
12122
12417
|
} = props;
|
12123
12418
|
return /*#__PURE__*/React__default.createElement("tr", {
|
12419
|
+
"data-row-index": index,
|
12124
12420
|
ref: ref
|
12125
12421
|
}, Array(cellsCount).fill(null).map((_, index) => (/*#__PURE__*/React__default.createElement("td", {
|
12126
12422
|
key: index
|
@@ -12129,38 +12425,6 @@ const Skeleton = /*#__PURE__*/React__default.forwardRef(function Skeleton(props,
|
|
12129
12425
|
})))));
|
12130
12426
|
});
|
12131
12427
|
|
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
12428
|
// scroll padding end is designed to always show half of the next row
|
12165
12429
|
function getScrollPaddingEndOffset(table) {
|
12166
12430
|
const tableMeta = table.options.meta;
|
@@ -12185,8 +12449,8 @@ function getPaddingEndOffset(table, options) {
|
|
12185
12449
|
const bottomRows = (_table$getBottomRows = table.getBottomRows()) !== null && _table$getBottomRows !== void 0 ? _table$getBottomRows : [];
|
12186
12450
|
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
12451
|
}
|
12188
|
-
function useTableRenderer(renderers, table, tableRef, defaultRowActiveIndex, options) {
|
12189
|
-
var _table$getState$group, _table$getCenterRows, _virtualItems$padding, _virtualItems$padding2, _virtualItems$padding3,
|
12452
|
+
function useTableRenderer(renderers, table, tableRef, length, defaultRowActiveIndex, options) {
|
12453
|
+
var _table$getState$group, _table$getCenterRows, _virtualItems$padding, _virtualItems$padding2, _virtualItems$padding3, _virtualItems$end, _virtualItems;
|
12190
12454
|
const tableMeta = table.options.meta;
|
12191
12455
|
const isTableRowGrouped = !!((_table$getState$group = table.getState().grouping) !== null && _table$getState$group !== void 0 && _table$getState$group.length);
|
12192
12456
|
const rows = (_table$getCenterRows = table.getCenterRows()) !== null && _table$getCenterRows !== void 0 ? _table$getCenterRows : [];
|
@@ -12199,11 +12463,12 @@ function useTableRenderer(renderers, table, tableRef, defaultRowActiveIndex, opt
|
|
12199
12463
|
const rangeExtractor = useRowGroupVirtualisation(table);
|
12200
12464
|
// account for thead and tfoot in the scroll area - both are always medium row height
|
12201
12465
|
const scrollPaddingStart = ROW_HEIGHT_ESTIMATES.medium;
|
12466
|
+
const count = tableMeta.server.isEnabled && tableMeta.server._experimentalDataLoader2 ? length : rows.length;
|
12202
12467
|
const virtualiser = reactVirtual.useVirtualizer({
|
12203
|
-
count
|
12468
|
+
count,
|
12204
12469
|
estimateSize,
|
12205
12470
|
getScrollElement: () => tableRef.current,
|
12206
|
-
overscan: tableMeta.printing.isPrinting ?
|
12471
|
+
overscan: tableMeta.printing.isPrinting ? count : undefined,
|
12207
12472
|
rangeExtractor,
|
12208
12473
|
// correctly sets the scroll padding offset, e.g. when keyboard navigating rows in the list
|
12209
12474
|
scrollPaddingStart,
|
@@ -12223,19 +12488,19 @@ function useTableRenderer(renderers, table, tableRef, defaultRowActiveIndex, opt
|
|
12223
12488
|
if (tableRef.current) {
|
12224
12489
|
if (index === 0) {
|
12225
12490
|
virtualiser.scrollToOffset(0, notSmooth);
|
12226
|
-
} else if (index ===
|
12491
|
+
} else if (index === count - 1) {
|
12227
12492
|
// sometimes the last row doesn't fully show, so we just force scroll to the bottom
|
12228
12493
|
tableRef.current.scrollTop = tableRef.current.scrollHeight;
|
12229
12494
|
} else {
|
12230
12495
|
virtualiser.scrollToIndex(index, options);
|
12231
12496
|
}
|
12232
12497
|
}
|
12233
|
-
}, [virtualItems.length, tableRef.current, totalSize,
|
12498
|
+
}, [virtualItems.length, tableRef.current, totalSize, count]);
|
12234
12499
|
// 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 &&
|
12500
|
+
const paddingStartIndex = isTableRowGrouped && count > 1 ? 1 : 0;
|
12236
12501
|
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
12502
|
// 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,
|
12503
|
+
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
12504
|
// ensure default active rows are scrolled to
|
12240
12505
|
React__default.useEffect(() => {
|
12241
12506
|
if (defaultRowActiveIndex) {
|
@@ -12248,23 +12513,52 @@ function useTableRenderer(renderers, table, tableRef, defaultRowActiveIndex, opt
|
|
12248
12513
|
// rendered output
|
12249
12514
|
let style = {};
|
12250
12515
|
let content = null;
|
12251
|
-
|
12516
|
+
// bottom rows aren't virtualised (they're sticky) but we need to set the height
|
12517
|
+
if (count || table.getBottomRows().length) {
|
12252
12518
|
style = {
|
12253
12519
|
height: totalSize,
|
12254
|
-
paddingBottom,
|
12255
|
-
paddingTop
|
12520
|
+
paddingBottom: isNaN(paddingBottom) ? 0 : paddingBottom,
|
12521
|
+
paddingTop: isNaN(paddingTop) ? 0 : paddingTop
|
12256
12522
|
};
|
12523
|
+
}
|
12524
|
+
// only render non sticky rows
|
12525
|
+
if (count) {
|
12257
12526
|
content = virtualItems.map(virtualRow => {
|
12527
|
+
var _row, _virtualiser$scrollDi2;
|
12258
12528
|
// 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
12529
|
if (!virtualRow) {
|
12260
12530
|
return null;
|
12261
12531
|
}
|
12262
|
-
|
12532
|
+
let row;
|
12533
|
+
if (tableMeta.server.isEnabled && tableMeta.server._experimentalDataLoader2) {
|
12534
|
+
var _tableMeta$server$pag, _tableMeta$server$pag2;
|
12535
|
+
const currentPageIndex = Math.floor(virtualRow.index / tableMeta.server.pageSize) * tableMeta.server.pageSize / tableMeta.server.pageSize;
|
12536
|
+
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;
|
12537
|
+
if (pagePosition > -1) {
|
12538
|
+
// "flatten" row indexes down into the dataloader2 dataset size
|
12539
|
+
// for example, with a page size of 100...
|
12540
|
+
// row index 14267 is actually one of index 67, 167, 267 etc within the dataset (depending on number of pages stored)
|
12541
|
+
const fakeIndex = pagePosition * tableMeta.server.pageSize + virtualRow.index % tableMeta.server.pageSize;
|
12542
|
+
row = rows[fakeIndex];
|
12543
|
+
}
|
12544
|
+
} else {
|
12545
|
+
row = rows[virtualRow.index];
|
12546
|
+
}
|
12547
|
+
if (!((_row = row) !== null && _row !== void 0 && _row.original)) {
|
12548
|
+
var _virtualiser$scrollDi;
|
12549
|
+
return /*#__PURE__*/React__default.createElement(SkeletonRow, {
|
12550
|
+
key: virtualRow.index,
|
12551
|
+
index: virtualRow.index,
|
12552
|
+
scrollDirection: (_virtualiser$scrollDi = virtualiser.scrollDirection) !== null && _virtualiser$scrollDi !== void 0 ? _virtualiser$scrollDi : undefined,
|
12553
|
+
table: table
|
12554
|
+
});
|
12555
|
+
}
|
12263
12556
|
const measureRow = createRowMeasurer(virtualiser.resizeItem, virtualRow);
|
12264
12557
|
return /*#__PURE__*/React__default.createElement(Row, {
|
12265
12558
|
key: row.id,
|
12266
12559
|
row: row,
|
12267
12560
|
index: virtualRow.index,
|
12561
|
+
scrollDirection: (_virtualiser$scrollDi2 = virtualiser.scrollDirection) !== null && _virtualiser$scrollDi2 !== void 0 ? _virtualiser$scrollDi2 : undefined,
|
12268
12562
|
table: table,
|
12269
12563
|
measureRow: measureRow,
|
12270
12564
|
renderer: renderers.row,
|
@@ -12371,8 +12665,9 @@ function Actions$1(props) {
|
|
12371
12665
|
const {
|
12372
12666
|
texts
|
12373
12667
|
} = useLocalization();
|
12668
|
+
const tableMeta = table.options.meta;
|
12374
12669
|
// 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);
|
12670
|
+
const visibleActions = actions.map(action => action(data, rowId, tableMeta.rowActions.handlers['cleanup'], table)).filter(action => !!action);
|
12376
12671
|
const actionsOnRow = visibleActions.length === actionsLength ? visibleActions : visibleActions.slice(0, actionsLength - 1);
|
12377
12672
|
const actionsInMenu = visibleActions.slice(visibleActions.length === actionsLength ? actionsLength : actionsLength - 1);
|
12378
12673
|
const className = cn('flex justify-end text-right bg-[inherit] shadow-[-6px_0px_6px_var(--table-row-actions-shadow)] print:hidden');
|
@@ -12411,9 +12706,9 @@ const Cell = /*#__PURE__*/React__default.memo(function MemoedCell(context) {
|
|
12411
12706
|
table
|
12412
12707
|
} = context;
|
12413
12708
|
const {
|
12709
|
+
hideRowActions,
|
12414
12710
|
isHovered,
|
12415
|
-
rowIndex
|
12416
|
-
hideRowActions
|
12711
|
+
rowIndex
|
12417
12712
|
} = React__default.useContext(RowContext);
|
12418
12713
|
const tableMeta = table.options.meta;
|
12419
12714
|
const actions = tableMeta.rowActions.rowActions;
|
@@ -12453,6 +12748,12 @@ function Cell$1() {
|
|
12453
12748
|
const {
|
12454
12749
|
texts
|
12455
12750
|
} = useLocalization();
|
12751
|
+
const {
|
12752
|
+
hideInternalColumns
|
12753
|
+
} = React__default.useContext(RowContext);
|
12754
|
+
if (hideInternalColumns) {
|
12755
|
+
return null;
|
12756
|
+
}
|
12456
12757
|
return /*#__PURE__*/React__default.createElement(Icon, {
|
12457
12758
|
"aria-label": texts.table.columns.drag.tooltip,
|
12458
12759
|
name: "drag",
|
@@ -12480,6 +12781,10 @@ function Header$3(context) {
|
|
12480
12781
|
const {
|
12481
12782
|
table
|
12482
12783
|
} = context;
|
12784
|
+
const tableMeta = table.options.meta;
|
12785
|
+
if (!tableMeta.rowExpansion.canExpandAll) {
|
12786
|
+
return null;
|
12787
|
+
}
|
12483
12788
|
const isSomeRowsExpanded = table.getIsSomeRowsExpanded();
|
12484
12789
|
const handleClick = event => {
|
12485
12790
|
event.stopPropagation();
|
@@ -12501,7 +12806,13 @@ function Cell$2(context) {
|
|
12501
12806
|
const {
|
12502
12807
|
texts
|
12503
12808
|
} = useLocalization();
|
12809
|
+
const {
|
12810
|
+
hideInternalColumns
|
12811
|
+
} = React__default.useContext(RowContext);
|
12504
12812
|
const tableMeta = context.table.options.meta;
|
12813
|
+
if (hideInternalColumns) {
|
12814
|
+
return null;
|
12815
|
+
}
|
12505
12816
|
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
12817
|
if (hasExpandedRow) {
|
12507
12818
|
const isActiveRow = tableMeta.rowActive.rowActiveIndex === context.row.index;
|
@@ -12555,8 +12866,9 @@ function Header$4(context) {
|
|
12555
12866
|
}
|
12556
12867
|
const _temp = function () {
|
12557
12868
|
if (tableMeta.server.loadAllIfNeeded) {
|
12869
|
+
const hiddenColumns = getHiddenColumns(table.getState().columnVisibility);
|
12558
12870
|
// 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 () {});
|
12871
|
+
return Promise.resolve(tableMeta.server.loadAllIfNeeded(table.getState().sorting, table.getState().columnFilters, hiddenColumns, tableMeta.search.enableGlobalFilter ? table.getState().globalFilter : undefined)).then(function () {});
|
12560
12872
|
}
|
12561
12873
|
}();
|
12562
12874
|
// load all data if that is possible
|
@@ -12572,7 +12884,7 @@ function Header$4(context) {
|
|
12572
12884
|
className: "hover:border-blue !-mt-px",
|
12573
12885
|
checked: isAllRowsSelected,
|
12574
12886
|
indeterminate: isSomeRowsSelected && !isAllRowsSelected,
|
12575
|
-
loading: tableMeta.server.
|
12887
|
+
loading: tableMeta.server.loading,
|
12576
12888
|
onChange: handleChange
|
12577
12889
|
}));
|
12578
12890
|
}
|
@@ -12591,10 +12903,11 @@ function Cell$3(context) {
|
|
12591
12903
|
table
|
12592
12904
|
} = context;
|
12593
12905
|
const {
|
12906
|
+
hideInternalColumns,
|
12594
12907
|
rowIndex
|
12595
12908
|
} = React__default.useContext(RowContext);
|
12596
12909
|
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()) {
|
12910
|
+
if (hideInternalColumns || table.options.enableGrouping && (_table$getState$group = table.getState().grouping) !== null && _table$getState$group !== void 0 && _table$getState$group.length && !row.getIsGrouped()) {
|
12598
12911
|
return null;
|
12599
12912
|
}
|
12600
12913
|
const isSelected = row.getIsGrouped() ? row.getIsAllSubRowsSelected() : row.getIsSelected();
|
@@ -12614,6 +12927,7 @@ function Cell$3(context) {
|
|
12614
12927
|
if (event.shiftKey) {
|
12615
12928
|
var _tableMeta$rowSelecti;
|
12616
12929
|
function _temp4() {
|
12930
|
+
const selectedRows = table.getRowModel().rows.slice(fromIndex, toIndex + 1);
|
12617
12931
|
table.setRowSelection(currentRowSelection => ({
|
12618
12932
|
...currentRowSelection,
|
12619
12933
|
...selectedRows.filter(row => row.getCanSelect()).reduce((state, row) => ({
|
@@ -12623,11 +12937,11 @@ function Cell$3(context) {
|
|
12623
12937
|
}));
|
12624
12938
|
}
|
12625
12939
|
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
12940
|
const _temp3 = function () {
|
12628
|
-
if (tableMeta.server.loadAllIfNeeded
|
12941
|
+
if (tableMeta.server.loadAllIfNeeded) {
|
12942
|
+
const hiddenColumns = getHiddenColumns(table.getState().columnVisibility);
|
12629
12943
|
// 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 () {});
|
12944
|
+
return Promise.resolve(tableMeta.server.loadAllIfNeeded(table.getState().sorting, table.getState().columnFilters, hiddenColumns, tableMeta.search.enableGlobalFilter ? table.getState().globalFilter : undefined)).then(function () {});
|
12631
12945
|
}
|
12632
12946
|
}();
|
12633
12947
|
return _temp3 && _temp3.then ? _temp3.then(_temp4) : _temp4(_temp3);
|
@@ -12685,7 +12999,7 @@ function useTable(props, externalRef, renderers, meta, options) {
|
|
12685
12999
|
// configure the table
|
12686
13000
|
const manager = useTableManager(props, meta, INTERNAL_RENDERERS);
|
12687
13001
|
// configure the virtualised renderer
|
12688
|
-
const renderer = useTableRenderer(renderers, manager.instance, ref, props.defaultRowActiveIndex, options);
|
13002
|
+
const renderer = useTableRenderer(renderers, manager.instance, ref, manager.meta.length, props.defaultRowActiveIndex, options);
|
12689
13003
|
// configure dynamic styling
|
12690
13004
|
const {
|
12691
13005
|
style,
|
@@ -12905,7 +13219,7 @@ const DisplayRow = /*#__PURE__*/React__default.memo(function DisplayRow(props) {
|
|
12905
13219
|
if (tableMeta.rowActive.isEnabled) {
|
12906
13220
|
attributes['data-row-active'] = tableMeta.rowActive.rowActiveIndex === index ? true : undefined;
|
12907
13221
|
// we use capture because it let's us picks up clicks on components inside the row, e.g. checkboxes
|
12908
|
-
attributes.
|
13222
|
+
attributes.onClickCapture = handleClickCapture;
|
12909
13223
|
}
|
12910
13224
|
// row click
|
12911
13225
|
if (tableMeta.rowClick.isEnabled(row.original)) {
|
@@ -13379,7 +13693,9 @@ function HeaderMenu(props) {
|
|
13379
13693
|
return /*#__PURE__*/React__default.createElement(IconButton, {
|
13380
13694
|
className: className,
|
13381
13695
|
icon: "more",
|
13382
|
-
menu: popoverElement ? undefined : menuProps => (/*#__PURE__*/React__default.createElement(Menu$1, Object.assign({}, menuProps), /*#__PURE__*/React__default.createElement(Menu$1.Content,
|
13696
|
+
menu: popoverElement ? undefined : menuProps => (/*#__PURE__*/React__default.createElement(Menu$1, Object.assign({}, menuProps), /*#__PURE__*/React__default.createElement(Menu$1.Content, {
|
13697
|
+
onFocusOutside: event => event.preventDefault()
|
13698
|
+
}, memoedMenuItems))),
|
13383
13699
|
popover: popoverElement,
|
13384
13700
|
onClickCapture: event => event.preventDefault(),
|
13385
13701
|
onKeyDown: event => {
|
@@ -13418,6 +13734,21 @@ function getIsPinned(header) {
|
|
13418
13734
|
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
13735
|
}
|
13420
13736
|
|
13737
|
+
const HeaderContent = ({
|
13738
|
+
children,
|
13739
|
+
tooltip,
|
13740
|
+
isInternalColumnHeader
|
13741
|
+
}) => {
|
13742
|
+
if (isInternalColumnHeader || typeof children !== 'string') {
|
13743
|
+
return /*#__PURE__*/React__default.createElement(React__default.Fragment, null, children);
|
13744
|
+
}
|
13745
|
+
return /*#__PURE__*/React__default.createElement(Tooltip, {
|
13746
|
+
title: String(tooltip !== null && tooltip !== void 0 ? tooltip : children),
|
13747
|
+
placement: "top"
|
13748
|
+
}, /*#__PURE__*/React__default.createElement("span", {
|
13749
|
+
className: "truncate"
|
13750
|
+
}, children));
|
13751
|
+
};
|
13421
13752
|
function Header$5(props) {
|
13422
13753
|
var _header$column$column;
|
13423
13754
|
const {
|
@@ -13587,12 +13918,11 @@ const MemoedHeader = /*#__PURE__*/React__default.memo(function MemoedHeader(prop
|
|
13587
13918
|
"data-cell-pinned": isPinned ? isPinned : undefined,
|
13588
13919
|
style: style,
|
13589
13920
|
ref: setRef
|
13590
|
-
}), isPlaceholder ?
|
13591
|
-
|
13592
|
-
|
13593
|
-
|
13594
|
-
|
13595
|
-
}, children))), sortDirection ? /*#__PURE__*/React__default.createElement(SortIndicator, {
|
13921
|
+
}), !isPlaceholder ? (/*#__PURE__*/React__default.createElement(HeaderContent, {
|
13922
|
+
children: children,
|
13923
|
+
tooltip: tooltip,
|
13924
|
+
isInternalColumnHeader: !!isInternalColumn(id)
|
13925
|
+
})) : null, sortDirection ? /*#__PURE__*/React__default.createElement(SortIndicator, {
|
13596
13926
|
direction: sortDirection
|
13597
13927
|
}) : null, hasMenu ? (/*#__PURE__*/React__default.createElement(HeaderMenu, {
|
13598
13928
|
canFilter: canFilter,
|
@@ -13740,6 +14070,8 @@ function Body(props) {
|
|
13740
14070
|
onKeyDown: handleKeyDown,
|
13741
14071
|
onMouseLeave: handleMouseLeave,
|
13742
14072
|
onMouseMove: handleMouseMove,
|
14073
|
+
// Prevents menu dropdowns inside the row from being closed straight after being opened, wehn clicked on a menu trigger
|
14074
|
+
onFocus: e => e.stopPropagation(),
|
13743
14075
|
ref: ref
|
13744
14076
|
}));
|
13745
14077
|
}
|
@@ -13753,21 +14085,22 @@ function Summary(props) {
|
|
13753
14085
|
locale,
|
13754
14086
|
texts
|
13755
14087
|
} = useLocalization();
|
13756
|
-
const
|
14088
|
+
const tableMeta = table.options.meta;
|
14089
|
+
const length = tableMeta.length;
|
13757
14090
|
const currentLength = table.getRowModel().rows.length;
|
13758
14091
|
let label;
|
13759
14092
|
let count;
|
13760
14093
|
// row selection
|
13761
|
-
|
14094
|
+
// use table state and not the selected row model because of the way server loading works
|
14095
|
+
const rowsSelectedLength = Object.keys(table.getState().rowSelection).length;
|
13762
14096
|
if (rowsSelectedLength > 0) {
|
13763
14097
|
label = texts.table.footer.summary.selected;
|
13764
14098
|
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 ||
|
14099
|
+
} else if (!tableMeta.server.isEnabled && ((_table$getState$colum = table.getState().columnFilters) !== null && _table$getState$colum !== void 0 && _table$getState$colum.length ||
|
13766
14100
|
// filtered data
|
13767
|
-
!!table.getState().globalFilter && table.options.enableGlobalFilter
|
13768
|
-
) {
|
14101
|
+
!!table.getState().globalFilter && table.options.enableGlobalFilter)) {
|
13769
14102
|
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)));
|
14103
|
+
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
14104
|
} else {
|
13772
14105
|
label = texts.table.footer.summary.records;
|
13773
14106
|
count = /*#__PURE__*/React__default.createElement("strong", null, new Intl.NumberFormat(locale).format(length));
|
@@ -13779,24 +14112,39 @@ function Summary(props) {
|
|
13779
14112
|
}
|
13780
14113
|
|
13781
14114
|
function Foot(props) {
|
13782
|
-
|
13783
|
-
|
14115
|
+
var _nonGroupedHeaders$fi;
|
14116
|
+
const {
|
14117
|
+
children,
|
14118
|
+
table,
|
14119
|
+
...attributes
|
14120
|
+
} = props;
|
14121
|
+
const tableMeta = table.options.meta;
|
14122
|
+
const nonGroupedHeaders = table.getFooterGroups()[0].headers.filter(header => !header.column.getIsGrouped());
|
14123
|
+
const firstVisibleExternalColumnIndex = (_nonGroupedHeaders$fi = nonGroupedHeaders.find(header => {
|
14124
|
+
var _header$column$column;
|
14125
|
+
return !isInternalColumn(header.id) && ((_header$column$column = header.column.columnDef.meta) === null || _header$column$column === void 0 ? void 0 : _header$column$column.enablePrinting) !== false;
|
14126
|
+
})) === null || _nonGroupedHeaders$fi === void 0 ? void 0 : _nonGroupedHeaders$fi.index;
|
14127
|
+
// During printing, the summary should be displayed in the first visible external column,
|
14128
|
+
// as internal and hidden columns are excluded from the printed document.
|
14129
|
+
// However, in the normal table view, the summary should appear in the first column.
|
14130
|
+
const summaryColumnIndex = tableMeta.printing.isPrinting ? firstVisibleExternalColumnIndex : 0;
|
14131
|
+
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
14132
|
key: header.id,
|
13785
14133
|
header: header,
|
13786
|
-
|
14134
|
+
showSummary: index === summaryColumnIndex
|
13787
14135
|
})))));
|
13788
14136
|
}
|
13789
14137
|
function Footer$3(props) {
|
13790
14138
|
return /*#__PURE__*/React__default.createElement(MemoedFooter, {
|
13791
14139
|
footer: props.header,
|
13792
|
-
|
14140
|
+
showSummary: props.showSummary
|
13793
14141
|
});
|
13794
14142
|
}
|
13795
14143
|
const MemoedFooter = /*#__PURE__*/React__default.memo(function MemoedFooter(props) {
|
13796
14144
|
var _footer$subHeaders, _footer$subHeaders$fi;
|
13797
14145
|
const {
|
13798
14146
|
footer,
|
13799
|
-
|
14147
|
+
showSummary
|
13800
14148
|
} = props;
|
13801
14149
|
const columnMeta = footer.column.columnDef.meta;
|
13802
14150
|
// getIsPinned returns true for split header groups, even if the split group has no pinned sub headers
|
@@ -13809,7 +14157,8 @@ const MemoedFooter = /*#__PURE__*/React__default.memo(function MemoedFooter(prop
|
|
13809
14157
|
}
|
13810
14158
|
let content;
|
13811
14159
|
let align;
|
13812
|
-
|
14160
|
+
// 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.
|
14161
|
+
if (showSummary) {
|
13813
14162
|
align = 'left';
|
13814
14163
|
content = /*#__PURE__*/React__default.createElement(Summary, {
|
13815
14164
|
table: footer.getContext().table
|
@@ -13828,16 +14177,29 @@ const MemoedFooter = /*#__PURE__*/React__default.memo(function MemoedFooter(prop
|
|
13828
14177
|
});
|
13829
14178
|
|
13830
14179
|
function EmptyStateBody(props) {
|
14180
|
+
var _ref$current, _ref$current$parentNo;
|
13831
14181
|
const {
|
13832
14182
|
emptyState: Placeholder,
|
14183
|
+
isReady,
|
13833
14184
|
reason,
|
13834
14185
|
...attributes
|
13835
14186
|
} = props;
|
14187
|
+
const ref = React__default.useRef(null);
|
14188
|
+
if (!isReady) {
|
14189
|
+
return /*#__PURE__*/React__default.createElement("tbody", Object.assign({}, attributes, {
|
14190
|
+
className: "!auto-rows-fr"
|
14191
|
+
}));
|
14192
|
+
}
|
13836
14193
|
return /*#__PURE__*/React__default.createElement("tbody", Object.assign({}, attributes, {
|
13837
|
-
|
14194
|
+
ref: ref,
|
14195
|
+
className: "!auto-rows-fr",
|
14196
|
+
"data-taco": "empty-state"
|
13838
14197
|
}), /*#__PURE__*/React__default.createElement("tr", {
|
13839
|
-
className: "!auto-rows-fr"
|
14198
|
+
className: "!auto-rows-fr "
|
13840
14199
|
}, /*#__PURE__*/React__default.createElement("td", {
|
14200
|
+
style: {
|
14201
|
+
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
|
14202
|
+
},
|
13841
14203
|
className: "col-span-full !border-0 !p-0 hover:!bg-white"
|
13842
14204
|
}, Placeholder ? /*#__PURE__*/React__default.createElement(Placeholder, {
|
13843
14205
|
reason: reason
|
@@ -13856,6 +14218,7 @@ const SearchInput2 = /*#__PURE__*/React__default.forwardRef(function SearchInput
|
|
13856
14218
|
onClickFindPrevious: handleClickFindPrevious,
|
13857
14219
|
settingsContent,
|
13858
14220
|
shortcut,
|
14221
|
+
showTotal = true,
|
13859
14222
|
value,
|
13860
14223
|
...attributes
|
13861
14224
|
} = props;
|
@@ -13934,10 +14297,12 @@ const SearchInput2 = /*#__PURE__*/React__default.forwardRef(function SearchInput
|
|
13934
14297
|
}
|
13935
14298
|
if (hasFind && isActive) {
|
13936
14299
|
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, {
|
14300
|
+
className: "text-grey-700 flex h-4 items-center"
|
14301
|
+
}, loading ? (/*#__PURE__*/React__default.createElement(Spinner, {
|
13939
14302
|
className: "h-4 w-4"
|
13940
|
-
}) :
|
14303
|
+
})) : showTotal ? (/*#__PURE__*/React__default.createElement("span", {
|
14304
|
+
className: "border-r border-black/[0.25] pr-2"
|
14305
|
+
}, `${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
14306
|
"aria-label": texts.searchInput.findPrevious,
|
13942
14307
|
className: "scale-75 !bg-transparent hover:!bg-black/[0.08] [&>svg]:scale-125",
|
13943
14308
|
icon: "chevron-up",
|
@@ -14041,6 +14406,7 @@ function Search$1(props) {
|
|
14041
14406
|
const scrollTo = rowIndex => scrollToIndex(rowIndex, {
|
14042
14407
|
align: 'center'
|
14043
14408
|
});
|
14409
|
+
const hiddenColumns = getHiddenColumns(table.getState().columnVisibility);
|
14044
14410
|
React__default.useEffect(() => {
|
14045
14411
|
if (tableMeta.search.highlightedColumnIndexes.length) {
|
14046
14412
|
scrollTo(tableMeta.search.highlightedColumnIndexes[0][0]);
|
@@ -14049,9 +14415,11 @@ function Search$1(props) {
|
|
14049
14415
|
const handleFocus = function () {
|
14050
14416
|
try {
|
14051
14417
|
const _temp = function () {
|
14052
|
-
if (tableMeta.server.loadAllIfNeeded) {
|
14418
|
+
if (tableMeta.server.loadAllIfNeeded && !tableMeta.server._experimentalDataLoader2) {
|
14053
14419
|
// 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
|
14420
|
+
return Promise.resolve(tableMeta.server.loadAllIfNeeded(table.getState().sorting, table.getState().columnFilters, hiddenColumns,
|
14421
|
+
// the old data loader doesn't have server side search
|
14422
|
+
undefined)).then(function () {});
|
14055
14423
|
}
|
14056
14424
|
}();
|
14057
14425
|
// load all data if that is possible
|
@@ -14060,8 +14428,20 @@ function Search$1(props) {
|
|
14060
14428
|
return Promise.reject(e);
|
14061
14429
|
}
|
14062
14430
|
};
|
14431
|
+
const [loading, setLoading] = React__default.useState(false);
|
14432
|
+
const searchTimeoutRef = React__default.useRef();
|
14063
14433
|
const handleChange = query => {
|
14064
14434
|
table.setGlobalFilter(String(query !== null && query !== void 0 ? query : ''));
|
14435
|
+
if (tableMeta.search.enableGlobalFilter && tableMeta.search.handleSearch) {
|
14436
|
+
clearTimeout(searchTimeoutRef.current);
|
14437
|
+
searchTimeoutRef.current = setTimeout(() => {
|
14438
|
+
var _tableMeta$search$han, _tableMeta$search;
|
14439
|
+
setLoading(true);
|
14440
|
+
(_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(() => {
|
14441
|
+
setLoading(false);
|
14442
|
+
});
|
14443
|
+
}, 150);
|
14444
|
+
}
|
14065
14445
|
};
|
14066
14446
|
const handleToggleExcludeUnmatchedResults = enabled => {
|
14067
14447
|
tableMeta.search.setEnableGlobalFilter(enabled, table);
|
@@ -14069,6 +14449,12 @@ function Search$1(props) {
|
|
14069
14449
|
var _ref$current;
|
14070
14450
|
return (_ref$current = ref.current) === null || _ref$current === void 0 ? void 0 : _ref$current.focus();
|
14071
14451
|
});
|
14452
|
+
if (tableMeta.search.handleSearch) {
|
14453
|
+
setLoading(true);
|
14454
|
+
tableMeta.search.handleSearch(enabled ? query : undefined, hiddenColumns).then(() => {
|
14455
|
+
setLoading(false);
|
14456
|
+
});
|
14457
|
+
}
|
14072
14458
|
};
|
14073
14459
|
const handleNextResult = () => {
|
14074
14460
|
if (!tableMeta.search.highlightedColumnIndexes.length) {
|
@@ -14112,7 +14498,7 @@ function Search$1(props) {
|
|
14112
14498
|
return /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement(SearchInput2, {
|
14113
14499
|
findCurrent: tableMeta.search.currentHighlightColumnIndex !== undefined ? tableMeta.search.currentHighlightColumnIndex + 1 : null,
|
14114
14500
|
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.
|
14501
|
+
loading: tableMeta.server._experimentalDataLoader2 ? loading : tableMeta.server.loading,
|
14116
14502
|
name: "table-search",
|
14117
14503
|
onClickFindPrevious: handlePreviousResult,
|
14118
14504
|
onClickFindNext: handleNextResult,
|
@@ -14127,6 +14513,7 @@ function Search$1(props) {
|
|
14127
14513
|
meta: true,
|
14128
14514
|
shift: false
|
14129
14515
|
},
|
14516
|
+
showTotal: !tableMeta.server._experimentalDataLoader2,
|
14130
14517
|
value: query
|
14131
14518
|
}));
|
14132
14519
|
}
|
@@ -14480,9 +14867,11 @@ const Root = /*#__PURE__*/React__default.forwardRef(function CollectionRoot(prop
|
|
14480
14867
|
var _collection$querySele;
|
14481
14868
|
(_collection$querySele = collection.querySelector(`[aria-current]`)) === null || _collection$querySele === void 0 ? void 0 : _collection$querySele.removeAttribute('aria-current');
|
14482
14869
|
option.setAttribute('aria-current', 'true');
|
14483
|
-
|
14484
|
-
|
14485
|
-
|
14870
|
+
if (!props['aria-multiselectable']) {
|
14871
|
+
option.scrollIntoView({
|
14872
|
+
block: 'nearest'
|
14873
|
+
});
|
14874
|
+
}
|
14486
14875
|
setActiveIndex(index);
|
14487
14876
|
};
|
14488
14877
|
const setActiveIndexByElement = React__default.useCallback(option => {
|
@@ -14804,14 +15193,16 @@ const Tag$1 = /*#__PURE__*/React__default.forwardRef((props, ref) => {
|
|
14804
15193
|
ref: ref,
|
14805
15194
|
"data-taco": "tag"
|
14806
15195
|
}), /*#__PURE__*/React__default.createElement("span", {
|
14807
|
-
className: "truncate px-2",
|
15196
|
+
className: "flex items-center truncate px-2",
|
14808
15197
|
ref: textRef
|
14809
15198
|
}, icon ? typeof icon === 'string' ? (/*#__PURE__*/React__default.createElement(Icon, {
|
14810
15199
|
name: icon,
|
14811
|
-
className: "-ml-1
|
15200
|
+
className: "-ml-1 mr-1 !h-5 !w-5"
|
14812
15201
|
})) : (/*#__PURE__*/React__default.cloneElement(icon, {
|
14813
|
-
className: 'mr-1 -ml-1
|
14814
|
-
})) : null,
|
15202
|
+
className: cn(icon.props.className, 'mr-1 -ml-1')
|
15203
|
+
})) : null, /*#__PURE__*/React__default.createElement("span", {
|
15204
|
+
className: "truncate"
|
15205
|
+
}, children)), onDelete ? (/*#__PURE__*/React__default.createElement(Icon, {
|
14815
15206
|
name: "close",
|
14816
15207
|
onClick: onDelete,
|
14817
15208
|
className: "-ml-1.5 !h-6 !w-5 flex-shrink-0 cursor-pointer rounded-r p-0.5 hover:bg-black/5"
|
@@ -15088,12 +15479,13 @@ const Option$1 = /*#__PURE__*/React__default.forwardRef(function Select2Option(p
|
|
15088
15479
|
}), hasValue ? (/*#__PURE__*/React__default.createElement(Icon, {
|
15089
15480
|
name: "tick",
|
15090
15481
|
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, {
|
15482
|
+
})) : null, typeof children !== 'string' ? (/*#__PURE__*/React__default.createElement("span", null, children)) : isTag ? (/*#__PURE__*/React__default.createElement(Tag$1, {
|
15092
15483
|
className: "pointer-events-none my-1",
|
15093
15484
|
color: color,
|
15094
15485
|
icon: prefix
|
15095
15486
|
}, children)) : (/*#__PURE__*/React__default.createElement(React__default.Fragment, null, prefix ? typeof prefix === 'string' ? /*#__PURE__*/React__default.createElement(Icon, {
|
15096
|
-
name: prefix
|
15487
|
+
name: prefix,
|
15488
|
+
className: "!h-5 !w-5"
|
15097
15489
|
}) : prefix : null, /*#__PURE__*/React__default.createElement("span", {
|
15098
15490
|
className: "flex w-full justify-between"
|
15099
15491
|
}, /*#__PURE__*/React__default.createElement("span", {
|
@@ -15102,9 +15494,10 @@ const Option$1 = /*#__PURE__*/React__default.forwardRef(function Select2Option(p
|
|
15102
15494
|
className: "text-grey-700 -mt-1.5 mb-1.5 text-xs"
|
15103
15495
|
}, description) : null), /*#__PURE__*/React__default.createElement("span", {
|
15104
15496
|
className: "flex flex-col self-center"
|
15105
|
-
}, postfix ? typeof postfix === 'string' ? /*#__PURE__*/React__default.createElement(Icon, {
|
15106
|
-
name: postfix
|
15107
|
-
|
15497
|
+
}, postfix ? typeof postfix === 'string' ? (/*#__PURE__*/React__default.createElement(Icon, {
|
15498
|
+
name: postfix,
|
15499
|
+
className: "!h-5 !w-5"
|
15500
|
+
})) : postfix : null)))), popover ? (/*#__PURE__*/React__default.createElement(IconButton, {
|
15108
15501
|
icon: "ellipsis-vertical",
|
15109
15502
|
appearance: "discrete",
|
15110
15503
|
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 +15663,7 @@ const Single = /*#__PURE__*/React__default.forwardRef(function Select2TriggerSin
|
|
15270
15663
|
readOnly,
|
15271
15664
|
tags
|
15272
15665
|
} = useSelect2Context();
|
15273
|
-
const contentClassName = cn('truncate items-center gap-1');
|
15666
|
+
const contentClassName = cn('truncate flex items-center gap-1');
|
15274
15667
|
const currentValue = children.find(matchesValue(value));
|
15275
15668
|
let output;
|
15276
15669
|
if (placeholder && currentValue === undefined) {
|
@@ -15280,13 +15673,13 @@ const Single = /*#__PURE__*/React__default.forwardRef(function Select2TriggerSin
|
|
15280
15673
|
}, placeholder);
|
15281
15674
|
} else if (currentValue) {
|
15282
15675
|
if (tags && emptyValue !== value) {
|
15283
|
-
output = /*#__PURE__*/React__default.createElement(Tag$1, {
|
15676
|
+
if (typeof currentValue.props.children === 'string') output = /*#__PURE__*/React__default.createElement(Tag$1, {
|
15284
15677
|
className: "truncate",
|
15285
15678
|
color: currentValue.props.color,
|
15286
15679
|
disabled: disabled,
|
15287
15680
|
icon: currentValue.props.prefix,
|
15288
15681
|
readOnly: readOnly
|
15289
|
-
}, currentValue.props.children);
|
15682
|
+
}, currentValue.props.children);else output = currentValue.props.children;
|
15290
15683
|
} else {
|
15291
15684
|
output = /*#__PURE__*/React__default.createElement(React__default.Fragment, null, currentValue.props.prefix ? typeof currentValue.props.prefix === 'string' ? (/*#__PURE__*/React__default.createElement(Icon, {
|
15292
15685
|
name: currentValue.props.prefix,
|
@@ -15337,7 +15730,7 @@ const Multiple = /*#__PURE__*/React__default.forwardRef(function Select2TriggerM
|
|
15337
15730
|
}, valuesAsChildren.length === 0 ? (/*#__PURE__*/React__default.createElement(Placeholder, {
|
15338
15731
|
disabled: disabled,
|
15339
15732
|
readOnly: readOnly
|
15340
|
-
}, placeholder)) : valuesAsChildren.map(child => (/*#__PURE__*/React__default.createElement(Tag$1, {
|
15733
|
+
}, placeholder)) : valuesAsChildren.map(child => typeof child.props.children === 'string' ? (/*#__PURE__*/React__default.createElement(Tag$1, {
|
15341
15734
|
key: String(child.props.value),
|
15342
15735
|
className: "truncate",
|
15343
15736
|
color: tags ? child.props.color : undefined,
|
@@ -15351,7 +15744,23 @@ const Multiple = /*#__PURE__*/React__default.forwardRef(function Select2TriggerM
|
|
15351
15744
|
}
|
15352
15745
|
},
|
15353
15746
|
readOnly: readOnly
|
15354
|
-
}, child.props.children))
|
15747
|
+
}, child.props.children)) : (/*#__PURE__*/React__default.cloneElement(child.props.children, {
|
15748
|
+
key: String(child.props.value),
|
15749
|
+
className: '!pr-0 !pl-1.5',
|
15750
|
+
children: (/*#__PURE__*/React__default.createElement("span", {
|
15751
|
+
className: "flex items-center"
|
15752
|
+
}, child.props.children.props.children, /*#__PURE__*/React__default.createElement(Icon, {
|
15753
|
+
name: "close",
|
15754
|
+
onClick: event => {
|
15755
|
+
event === null || event === void 0 ? void 0 : event.stopPropagation();
|
15756
|
+
event === null || event === void 0 ? void 0 : event.preventDefault();
|
15757
|
+
if (!disabled && !readOnly) {
|
15758
|
+
setValue(child.props.value);
|
15759
|
+
}
|
15760
|
+
},
|
15761
|
+
className: "ml-0.5 !h-5 !w-5 shrink-0 cursor-pointer rounded-r p-0.5 hover:bg-black/5"
|
15762
|
+
})))
|
15763
|
+
})))));
|
15355
15764
|
} else {
|
15356
15765
|
content = /*#__PURE__*/React__default.createElement(MultipleValue, {
|
15357
15766
|
onClick: forwardClick,
|
@@ -15382,6 +15791,18 @@ const MultipleValue = ({
|
|
15382
15791
|
} = useSelect2Context();
|
15383
15792
|
const [contentRef, setContentRef] = React__default.useState(null);
|
15384
15793
|
const boundaryIndex = contentRef ? getIndexOfFirstChildOverflowingParent(contentRef, 30) : undefined;
|
15794
|
+
// Retrieves the relevant text content from any JSX.Element passed as a select option, handling nested elements, arrays, and direct text
|
15795
|
+
const getTooltipTitle = child => {
|
15796
|
+
const children = child.props.children;
|
15797
|
+
if (typeof children === 'string') return children;
|
15798
|
+
if (typeof children.props.children === 'string') {
|
15799
|
+
return children.props.children;
|
15800
|
+
}
|
15801
|
+
if (Array.isArray(children.props.children)) {
|
15802
|
+
return children.props.children.filter(item => typeof item === 'string');
|
15803
|
+
}
|
15804
|
+
return '';
|
15805
|
+
};
|
15385
15806
|
return /*#__PURE__*/React__default.createElement("div", {
|
15386
15807
|
className: "relative flex w-full items-center gap-1 overflow-hidden",
|
15387
15808
|
onClick: onClick
|
@@ -15392,26 +15813,35 @@ const MultipleValue = ({
|
|
15392
15813
|
disabled: disabled,
|
15393
15814
|
readOnly: readOnly
|
15394
15815
|
}, placeholder)) : valuesAsChildren.map((child, index) => {
|
15395
|
-
const
|
15396
|
-
|
15816
|
+
const classNames = {
|
15817
|
+
truncate: index === boundaryIndex,
|
15818
|
+
hidden: boundaryIndex !== undefined && boundaryIndex !== null ? index > boundaryIndex : false
|
15819
|
+
};
|
15820
|
+
let output;
|
15821
|
+
if (typeof child.props.children === 'string') {
|
15822
|
+
output = /*#__PURE__*/React__default.createElement(Tag$1, {
|
15823
|
+
key: String(child.props.value),
|
15824
|
+
className: cn('cursor-pointer', classNames),
|
15825
|
+
color: tags ? child.props.color : undefined,
|
15826
|
+
disabled: disabled,
|
15827
|
+
icon: child.props.prefix,
|
15828
|
+
readOnly: readOnly
|
15829
|
+
}, child.props.children);
|
15830
|
+
} else output = /*#__PURE__*/React__default.cloneElement(child.props.children, {
|
15397
15831
|
className: cn('cursor-pointer', {
|
15398
|
-
|
15399
|
-
|
15400
|
-
|
15401
|
-
|
15402
|
-
disabled: disabled,
|
15403
|
-
icon: child.props.prefix,
|
15404
|
-
readOnly: readOnly
|
15405
|
-
}, child.props.children);
|
15832
|
+
'shrink-0': index !== boundaryIndex
|
15833
|
+
}, classNames),
|
15834
|
+
key: String(child.props.value)
|
15835
|
+
});
|
15406
15836
|
if (index === boundaryIndex) {
|
15407
15837
|
return /*#__PURE__*/React__default.createElement(Tooltip, {
|
15408
15838
|
key: String(child.props.value),
|
15409
|
-
title: String(child
|
15410
|
-
},
|
15839
|
+
title: String(getTooltipTitle(child))
|
15840
|
+
}, output);
|
15411
15841
|
}
|
15412
|
-
return
|
15842
|
+
return output;
|
15413
15843
|
})), boundaryIndex !== undefined && boundaryIndex !== null && boundaryIndex < valuesAsChildren.length - 1 ? (/*#__PURE__*/React__default.createElement(Tooltip, {
|
15414
|
-
title: valuesAsChildren.slice(boundaryIndex + 1).map(child => child ? String(child
|
15844
|
+
title: valuesAsChildren.slice(boundaryIndex + 1).map(child => child ? String(getTooltipTitle(child)) : '').join(', ')
|
15415
15845
|
}, /*#__PURE__*/React__default.createElement(Badge, {
|
15416
15846
|
className: "flex-shrink-0"
|
15417
15847
|
}, "+", valuesAsChildren.length - (boundaryIndex + 1)))) : null);
|
@@ -15476,7 +15906,7 @@ const BubbleSelect = props => {
|
|
15476
15906
|
if (prevValue !== value && setValue) {
|
15477
15907
|
if (Array.isArray(value)) {
|
15478
15908
|
value.forEach(v => {
|
15479
|
-
const option = select.querySelector(`option[value='${v}']`);
|
15909
|
+
const option = select.querySelector(`option[value='${CSS.escape(v)}']`);
|
15480
15910
|
if (option) {
|
15481
15911
|
option.selected = true;
|
15482
15912
|
}
|
@@ -15604,20 +16034,19 @@ const useChildren = ({
|
|
15604
16034
|
};
|
15605
16035
|
|
15606
16036
|
const getNextColor = options => {
|
15607
|
-
|
15608
|
-
|
15609
|
-
|
15610
|
-
|
15611
|
-
|
15612
|
-
|
15613
|
-
|
15614
|
-
|
15615
|
-
}, {});
|
15616
|
-
options.forEach(option => {
|
16037
|
+
let occurrences = {};
|
16038
|
+
AVAILABLE_COLORS.filter(color => color !== 'transparent').forEach(color => {
|
16039
|
+
occurrences = {
|
16040
|
+
...occurrences,
|
16041
|
+
[color]: 0
|
16042
|
+
};
|
16043
|
+
});
|
16044
|
+
options.reduce((occurrences, option) => {
|
15617
16045
|
if (option.props.color) {
|
15618
16046
|
occurrences[option.props.color] = occurrences[option.props.color] ? occurrences[option.props.color] + 1 : 1;
|
15619
16047
|
}
|
15620
|
-
|
16048
|
+
return occurrences;
|
16049
|
+
}, occurrences);
|
15621
16050
|
const colors = Object.keys(occurrences);
|
15622
16051
|
if (colors.length) {
|
15623
16052
|
return colors.sort((a, b) => occurrences[a] - occurrences[b])[0];
|
@@ -16171,8 +16600,9 @@ function Print$1(props) {
|
|
16171
16600
|
const toastRef = toast.loading(texts.table.print.loading);
|
16172
16601
|
const _temp2 = function () {
|
16173
16602
|
if (tableMeta.server.isEnabled && tableMeta.server.loadAllIfNeeded) {
|
16603
|
+
const hiddenColumns = getHiddenColumns(table.getState().columnVisibility);
|
16174
16604
|
const _temp = _catch(function () {
|
16175
|
-
return Promise.resolve(tableMeta.server.loadAllIfNeeded(table.getState().sorting, table.getState().columnFilters)).then(function () {});
|
16605
|
+
return Promise.resolve(tableMeta.server.loadAllIfNeeded(table.getState().sorting, table.getState().columnFilters, hiddenColumns, tableMeta.search.enableGlobalFilter ? table.getState().globalFilter : undefined)).then(function () {});
|
16176
16606
|
}, function (error) {
|
16177
16607
|
const errorMessage = `${texts.table.print.error}: ${error}`;
|
16178
16608
|
console.error(errorMessage);
|
@@ -16286,10 +16716,11 @@ function guessComparatorsBasedOnControl(column) {
|
|
16286
16716
|
return getDataTypeProperties(columnMeta.dataType).filterComparators;
|
16287
16717
|
}
|
16288
16718
|
|
16719
|
+
const FilterContext = /*#__PURE__*/React__default.createContext([]);
|
16720
|
+
|
16289
16721
|
const FilterColumn = /*#__PURE__*/React__default.forwardRef((props, ref) => {
|
16290
16722
|
const {
|
16291
16723
|
allColumns,
|
16292
|
-
filters,
|
16293
16724
|
onChange: handleChange,
|
16294
16725
|
value = null,
|
16295
16726
|
...attributes
|
@@ -16297,6 +16728,7 @@ const FilterColumn = /*#__PURE__*/React__default.forwardRef((props, ref) => {
|
|
16297
16728
|
const {
|
16298
16729
|
texts
|
16299
16730
|
} = useLocalization();
|
16731
|
+
const filters = React__default.useContext(FilterContext);
|
16300
16732
|
const selectedColumn = allColumns.find(column => column.id === value);
|
16301
16733
|
const warning = selectedColumn && !selectedColumn.getIsVisible();
|
16302
16734
|
return /*#__PURE__*/React__default.createElement("div", {
|
@@ -16380,6 +16812,10 @@ function getComparatorText(comparator, texts, column) {
|
|
16380
16812
|
return texts.table.filters.comparators.hasAllOf;
|
16381
16813
|
case exports.TableFilterComparator.HasNoneOf:
|
16382
16814
|
return texts.table.filters.comparators.hasNoneOf;
|
16815
|
+
case exports.TableFilterComparator.IsOneOf:
|
16816
|
+
return texts.table.filters.comparators.isOneOf;
|
16817
|
+
case exports.TableFilterComparator.IsNoneOf:
|
16818
|
+
return texts.table.filters.comparators.isNoneOf;
|
16383
16819
|
default:
|
16384
16820
|
return '';
|
16385
16821
|
}
|
@@ -16462,6 +16898,7 @@ function Control(props) {
|
|
16462
16898
|
} = props;
|
16463
16899
|
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
16900
|
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;
|
16901
|
+
const filters = React__default.useContext(FilterContext);
|
16465
16902
|
const ref = React__default.useRef(null);
|
16466
16903
|
React.useEffect(() => {
|
16467
16904
|
// 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
|
@@ -16475,7 +16912,7 @@ function Control(props) {
|
|
16475
16912
|
setValue: value => onChange(value),
|
16476
16913
|
value,
|
16477
16914
|
ref
|
16478
|
-
}), {
|
16915
|
+
}, undefined, filters), {
|
16479
16916
|
['data-query-selector']: querySelector,
|
16480
16917
|
className: 'focus:yt-focus'
|
16481
16918
|
});
|
@@ -16517,7 +16954,6 @@ function Filter$1(props) {
|
|
16517
16954
|
const {
|
16518
16955
|
allColumns,
|
16519
16956
|
filter,
|
16520
|
-
filters,
|
16521
16957
|
onChange: handleChange,
|
16522
16958
|
onRemove,
|
16523
16959
|
position
|
@@ -16592,7 +17028,6 @@ function Filter$1(props) {
|
|
16592
17028
|
className: "flex min-h-[theme(spacing.8)] w-14 flex-shrink-0 items-center justify-end pr-2 text-right"
|
16593
17029
|
}, position > 0 ? texts.table.filters.conditions.and : texts.table.filters.conditions.where), /*#__PURE__*/React__default.createElement(FilterColumn, {
|
16594
17030
|
allColumns: allColumns,
|
16595
|
-
filters: filters,
|
16596
17031
|
onChange: handleChangeColumn,
|
16597
17032
|
value: id,
|
16598
17033
|
ref: ref
|
@@ -16696,7 +17131,9 @@ function ManageFiltersPopover(props) {
|
|
16696
17131
|
};
|
16697
17132
|
return /*#__PURE__*/React__default.createElement(Popover, Object.assign({}, popoverProps, {
|
16698
17133
|
onChange: handleClose
|
16699
|
-
}), /*#__PURE__*/React__default.createElement(Popover.Content, null, /*#__PURE__*/React__default.createElement(
|
17134
|
+
}), /*#__PURE__*/React__default.createElement(Popover.Content, null, /*#__PURE__*/React__default.createElement(FilterContext.Provider, {
|
17135
|
+
value: filters
|
17136
|
+
}, /*#__PURE__*/React__default.createElement("div", {
|
16700
17137
|
className: "flex w-[40rem] flex-col gap-4"
|
16701
17138
|
}, /*#__PURE__*/React__default.createElement("div", {
|
16702
17139
|
className: "flex h-8"
|
@@ -16712,7 +17149,6 @@ function ManageFiltersPopover(props) {
|
|
16712
17149
|
key: `filter_${index}`,
|
16713
17150
|
allColumns: allColumns,
|
16714
17151
|
filter: filter,
|
16715
|
-
filters: filters,
|
16716
17152
|
position: index,
|
16717
17153
|
onChange: handleChangeFilter,
|
16718
17154
|
onRemove: filters.length > 0 && filters.some(f => f.id) || filters.length > 1 ? handleRemoveFilter : undefined
|
@@ -16728,7 +17164,7 @@ function ManageFiltersPopover(props) {
|
|
16728
17164
|
}, texts.table.filters.buttons.clear), /*#__PURE__*/React__default.createElement(Button$1, {
|
16729
17165
|
appearance: "primary",
|
16730
17166
|
onClick: handleApply
|
16731
|
-
}, texts.table.filters.buttons.apply)))));
|
17167
|
+
}, texts.table.filters.buttons.apply))))));
|
16732
17168
|
}
|
16733
17169
|
|
16734
17170
|
function Filters(props) {
|
@@ -16831,7 +17267,7 @@ function Table(props) {
|
|
16831
17267
|
}
|
16832
17268
|
Table.Toolbar = TableToolbar;
|
16833
17269
|
Table.Grid = TableGrid;
|
16834
|
-
function
|
17270
|
+
function getEmptyStateReason(table) {
|
16835
17271
|
if (table.instance.getFilteredRowModel().rows.length === 0 && table.instance.getCoreRowModel().rows.length !== 0) {
|
16836
17272
|
const state = table.instance.getState();
|
16837
17273
|
if (table.meta.search.enableGlobalFilter && !!state.globalFilter) {
|
@@ -16848,13 +17284,14 @@ function TableGrid(props) {
|
|
16848
17284
|
var _table$state$grouping;
|
16849
17285
|
const {
|
16850
17286
|
enableHorizontalArrowKeyNavigation,
|
17287
|
+
footerRows,
|
16851
17288
|
table,
|
16852
17289
|
...attributes
|
16853
17290
|
} = props;
|
16854
17291
|
const handleFocus = table.meta.rowActive.rowActiveIndex === undefined ? event => {
|
16855
17292
|
table.meta.rowActive.handleFocus(event, table.meta.length, table.renderer.scrollToIndex);
|
16856
17293
|
} : undefined;
|
16857
|
-
const
|
17294
|
+
const emptyStateReason = getEmptyStateReason(table);
|
16858
17295
|
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
17296
|
id: table.id,
|
16860
17297
|
"data-table-font-size": table.meta.fontSize.size,
|
@@ -16870,18 +17307,15 @@ function TableGrid(props) {
|
|
16870
17307
|
style: table.style,
|
16871
17308
|
tabIndex: -1
|
16872
17309
|
}), /*#__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
|
-
}
|
17310
|
+
key: headerGroup.id
|
16878
17311
|
}, headerGroup.headers.map(props => (/*#__PURE__*/React__default.createElement(Header$5, {
|
16879
17312
|
key: props.id,
|
16880
17313
|
header: props,
|
16881
17314
|
scrollToIndex: table.renderer.scrollToIndex
|
16882
|
-
}))))))),
|
17315
|
+
}))))))), emptyStateReason ? (/*#__PURE__*/React__default.createElement(EmptyStateBody, {
|
16883
17316
|
emptyState: props.table.props.emptyState,
|
16884
|
-
|
17317
|
+
isReady: table.meta.server.isEnabled ? table.meta.server.isReady : true,
|
17318
|
+
reason: emptyStateReason
|
16885
17319
|
})) : (/*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement(Body, {
|
16886
17320
|
enableHorizontalArrowKeyNavigation: enableHorizontalArrowKeyNavigation,
|
16887
17321
|
table: table.instance,
|
@@ -16893,12 +17327,11 @@ function TableGrid(props) {
|
|
16893
17327
|
} : table.renderer.style
|
16894
17328
|
}, table.renderer.rows, props.children), table.meta.footer.isEnabled ? /*#__PURE__*/React__default.createElement(Foot, {
|
16895
17329
|
table: table.instance
|
16896
|
-
}) : null)))));
|
17330
|
+
}, footerRows) : null)))));
|
16897
17331
|
}
|
16898
17332
|
|
16899
|
-
|
16900
|
-
|
16901
|
-
}
|
17333
|
+
const Column$1 = () => null;
|
17334
|
+
Column$1.displayName = 'Table3Column';
|
16902
17335
|
function Group$4(_) {
|
16903
17336
|
return null;
|
16904
17337
|
}
|
@@ -18486,19 +18919,26 @@ const shortcut = {
|
|
18486
18919
|
meta: true,
|
18487
18920
|
shift: false
|
18488
18921
|
};
|
18922
|
+
function isTableScrolled(ref) {
|
18923
|
+
if (ref.current) {
|
18924
|
+
var _ref$current, _ref$current$querySel, _ref$current2, _ref$current2$querySe;
|
18925
|
+
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');
|
18926
|
+
return height > ref.current.scrollHeight;
|
18927
|
+
}
|
18928
|
+
return false;
|
18929
|
+
}
|
18489
18930
|
|
18490
18931
|
function useTableEditingListener(table, tableRef, scrollToIndex) {
|
18491
18932
|
const tableMeta = table.options.meta;
|
18492
18933
|
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
18934
|
useLazyEffect(() => {
|
18497
|
-
|
18498
|
-
|
18499
|
-
|
18500
|
-
|
18501
|
-
|
18935
|
+
return () => {
|
18936
|
+
if (tableMeta.editing.isEditing && tableMeta.rowActive.rowActiveIndex !== undefined) {
|
18937
|
+
var _table$getRowModel$ro;
|
18938
|
+
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);
|
18939
|
+
}
|
18940
|
+
};
|
18941
|
+
}, [tableMeta.rowActive.rowActiveIndex]);
|
18502
18942
|
// show a warning if the user navigates away without triggering save, such as using the browser back/forward button
|
18503
18943
|
const hasChanges = tableMeta.editing.hasChanges();
|
18504
18944
|
React__default.useEffect(() => {
|
@@ -18524,9 +18964,9 @@ function useTableEditingListener(table, tableRef, scrollToIndex) {
|
|
18524
18964
|
const onClickOutside = event => {
|
18525
18965
|
if (tableMeta.editing.isEditing) {
|
18526
18966
|
const element = event.target;
|
18527
|
-
const
|
18967
|
+
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
18968
|
// users can click the white space below rows which could be inside the table, but a valid scenario to save
|
18529
|
-
if (!
|
18969
|
+
if (!isTableOrIsInsideTable) {
|
18530
18970
|
tableMeta.editing.saveChanges(table);
|
18531
18971
|
}
|
18532
18972
|
}
|
@@ -18534,18 +18974,13 @@ function useTableEditingListener(table, tableRef, scrollToIndex) {
|
|
18534
18974
|
document.addEventListener('click', onClickOutside);
|
18535
18975
|
return () => document.removeEventListener('click', onClickOutside);
|
18536
18976
|
}, [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]);
|
18977
|
+
React__default.useEffect(() => {
|
18978
|
+
if (tableMeta.editing.isEnabled) {
|
18979
|
+
tableMeta.rowActions.registerHandler('cleanup', rowId => {
|
18980
|
+
tableMeta.editing.discardChanges(rowId, table);
|
18981
|
+
});
|
18982
|
+
}
|
18983
|
+
}, []);
|
18549
18984
|
// shortcuts
|
18550
18985
|
useGlobalKeyDown(tableMeta.editing.isEnabled ? shortcut : undefined, event => {
|
18551
18986
|
event.preventDefault();
|
@@ -18573,6 +19008,7 @@ function reducer$2(state, action) {
|
|
18573
19008
|
{
|
18574
19009
|
const {
|
18575
19010
|
columnId,
|
19011
|
+
index,
|
18576
19012
|
row,
|
18577
19013
|
value
|
18578
19014
|
} = payload;
|
@@ -18582,7 +19018,8 @@ function reducer$2(state, action) {
|
|
18582
19018
|
...state.changes,
|
18583
19019
|
rows: setWith(state.changes.rows, `${rowId}.${columnId}`, value, Object),
|
18584
19020
|
originals: setWith(state.changes.originals, rowId, row, Object)
|
18585
|
-
}
|
19021
|
+
},
|
19022
|
+
indexes: setWith(state.indexes, rowId, index, Object)
|
18586
19023
|
};
|
18587
19024
|
}
|
18588
19025
|
case 'removeCellValue':
|
@@ -18616,6 +19053,7 @@ function reducer$2(state, action) {
|
|
18616
19053
|
{
|
18617
19054
|
const {
|
18618
19055
|
cellErrors,
|
19056
|
+
index,
|
18619
19057
|
moveReasons,
|
18620
19058
|
original,
|
18621
19059
|
value
|
@@ -18625,12 +19063,13 @@ function reducer$2(state, action) {
|
|
18625
19063
|
changes: {
|
18626
19064
|
...state.changes,
|
18627
19065
|
rows: setWith(state.changes.rows, rowId, value, Object),
|
18628
|
-
errors: setWith(state.changes.errors, `${rowId}.cells`, cellErrors !== null && cellErrors !== void 0 ? cellErrors : state.changes.errors
|
19066
|
+
errors: setWith(state.changes.errors, `${rowId}.cells`, cellErrors !== null && cellErrors !== void 0 ? cellErrors : state.changes.errors[rowId], Object),
|
18629
19067
|
originals: setWith(state.changes.originals, rowId, original !== null && original !== void 0 ? original : state.changes.originals[rowId], Object),
|
18630
19068
|
moveReasons: setWith(state.changes.moveReasons, rowId, moveReasons !== null && moveReasons !== void 0 ? moveReasons : state.changes.moveReasons[rowId], Object),
|
18631
19069
|
// status can be undefined, so don't use ??
|
18632
19070
|
status: setWith(state.changes.status, rowId, undefined, Object)
|
18633
|
-
}
|
19071
|
+
},
|
19072
|
+
indexes: setWith(state.indexes, rowId, index, Object)
|
18634
19073
|
};
|
18635
19074
|
}
|
18636
19075
|
case 'removeRow':
|
@@ -18648,6 +19087,7 @@ function reducer$2(state, action) {
|
|
18648
19087
|
originals: omit(state.changes.originals, rowId),
|
18649
19088
|
status: omit(state.changes.status, rowId)
|
18650
19089
|
},
|
19090
|
+
indexes: omit(state.indexes, rowId),
|
18651
19091
|
temporaryRows: state.temporaryRows.filter(row => row[rowIdentityAccessor] !== rowId)
|
18652
19092
|
};
|
18653
19093
|
}
|
@@ -18677,9 +19117,10 @@ function reducer$2(state, action) {
|
|
18677
19117
|
}
|
18678
19118
|
};
|
18679
19119
|
}
|
18680
|
-
case '
|
19120
|
+
case 'insertTemporaryRow':
|
18681
19121
|
{
|
18682
19122
|
const {
|
19123
|
+
index,
|
18683
19124
|
value
|
18684
19125
|
} = payload;
|
18685
19126
|
return {
|
@@ -18689,14 +19130,36 @@ function reducer$2(state, action) {
|
|
18689
19130
|
...state.changes,
|
18690
19131
|
rows: setWith(state.changes.rows, rowId, value, Object),
|
18691
19132
|
originals: setWith(state.changes.originals, rowId, value, Object)
|
18692
|
-
}
|
19133
|
+
},
|
19134
|
+
indexes: setWith(state.indexes, rowId, index, Object)
|
18693
19135
|
};
|
18694
19136
|
}
|
18695
19137
|
default:
|
18696
19138
|
return state;
|
18697
19139
|
}
|
18698
19140
|
}
|
18699
|
-
function usePendingChangesState(handleSave, handleChange, rowIdentityAccessor, validator) {
|
19141
|
+
function usePendingChangesState(handleSave, handleChange, handleDiscard, rowIdentityAccessor, validator) {
|
19142
|
+
const discardChanges = function (rowId, table) {
|
19143
|
+
try {
|
19144
|
+
// remove any new rows from pinned state before discarding them
|
19145
|
+
table.resetRowPinning(true);
|
19146
|
+
dispatch({
|
19147
|
+
type: 'removeRow',
|
19148
|
+
rowId,
|
19149
|
+
payload: {
|
19150
|
+
rowIdentityAccessor
|
19151
|
+
}
|
19152
|
+
});
|
19153
|
+
const _temp8 = function () {
|
19154
|
+
if (typeof handleDiscard === 'function') {
|
19155
|
+
return Promise.resolve(handleDiscard()).then(function () {});
|
19156
|
+
}
|
19157
|
+
}();
|
19158
|
+
return Promise.resolve(_temp8 && _temp8.then ? _temp8.then(function () {}) : void 0);
|
19159
|
+
} catch (e) {
|
19160
|
+
return Promise.reject(e);
|
19161
|
+
}
|
19162
|
+
};
|
18700
19163
|
const saveChanges = function (table, rowId = undefined) {
|
18701
19164
|
try {
|
18702
19165
|
let _exit = false;
|
@@ -18709,35 +19172,38 @@ function usePendingChangesState(handleSave, handleChange, rowIdentityAccessor, v
|
|
18709
19172
|
[rowId]: state.changes.rows[rowId]
|
18710
19173
|
} : state.changes.rows;
|
18711
19174
|
let completed = true;
|
18712
|
-
const
|
19175
|
+
const _temp7 = _forOf(Object.keys(changes), function (rowId) {
|
18713
19176
|
const status = getRowStatus(rowId);
|
18714
19177
|
return _catch(function () {
|
18715
|
-
|
19178
|
+
var _changes$rowId;
|
19179
|
+
function _temp6(_result) {
|
18716
19180
|
return _exit ? _result : Promise.resolve(handleSave(changeSet)).then(function () {
|
18717
19181
|
// cleanup changes, we don't need them after saving
|
18718
|
-
discardChanges(rowId, table)
|
18719
|
-
|
18720
|
-
|
18721
|
-
|
18722
|
-
|
18723
|
-
|
19182
|
+
return Promise.resolve(discardChanges(rowId, table)).then(function () {
|
19183
|
+
// show the saved status, then remove it after a delay
|
19184
|
+
setRowStatus(rowId, 'saved');
|
19185
|
+
setTimeout(() => {
|
19186
|
+
setRowStatus(rowId, undefined);
|
19187
|
+
}, DELAY_BEFORE_REMOVING_SAVE_STATUS);
|
19188
|
+
});
|
18724
19189
|
});
|
18725
19190
|
}
|
19191
|
+
const rowChanges = (_changes$rowId = changes[rowId]) !== null && _changes$rowId !== void 0 ? _changes$rowId : {};
|
18726
19192
|
// don't try to save if - already saving, or there are known errors
|
18727
|
-
if (status === 'saving' || status === 'errored') {
|
19193
|
+
if (!Object.keys(rowChanges).length || status === 'saving' || status === 'errored') {
|
18728
19194
|
return;
|
18729
19195
|
}
|
18730
19196
|
setRowStatus(rowId, 'saving');
|
18731
19197
|
const changeSet = {
|
18732
19198
|
...state.changes.originals[rowId],
|
18733
|
-
...
|
19199
|
+
...rowChanges
|
18734
19200
|
};
|
18735
19201
|
// if we had to create a temporary id, delete it first - it's our data, not theirs
|
18736
19202
|
if (isTemporaryRow(changeSet[rowIdentityAccessor])) {
|
18737
19203
|
delete changeSet[rowIdentityAccessor];
|
18738
19204
|
}
|
18739
19205
|
// re-run validation, maybe a cell is already invalid but has never been blurred
|
18740
|
-
const
|
19206
|
+
const _temp5 = function () {
|
18741
19207
|
if (validator) {
|
18742
19208
|
return Promise.resolve(validator(changeSet)).then(function (errors) {
|
18743
19209
|
if (errors && Object.keys(errors).length) {
|
@@ -18746,7 +19212,7 @@ function usePendingChangesState(handleSave, handleChange, rowIdentityAccessor, v
|
|
18746
19212
|
});
|
18747
19213
|
}
|
18748
19214
|
}();
|
18749
|
-
return
|
19215
|
+
return _temp5 && _temp5.then ? _temp5.then(_temp6) : _temp6(_temp5); // send new data to the server
|
18750
19216
|
}, function (error) {
|
18751
19217
|
var _error$response;
|
18752
19218
|
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 +19252,18 @@ function usePendingChangesState(handleSave, handleChange, rowIdentityAccessor, v
|
|
18786
19252
|
}, function () {
|
18787
19253
|
return _exit;
|
18788
19254
|
});
|
18789
|
-
return Promise.resolve(
|
19255
|
+
return Promise.resolve(_temp7 && _temp7.then ? _temp7.then(function (_result3) {
|
18790
19256
|
return _exit ? _result3 : completed;
|
18791
|
-
}) : _exit ?
|
19257
|
+
}) : _exit ? _temp7 : completed);
|
18792
19258
|
} catch (e) {
|
18793
19259
|
return Promise.reject(e);
|
18794
19260
|
}
|
18795
19261
|
};
|
18796
|
-
const onCellChanged = function (cell, rowIndex, shouldRunUpdaters = true) {
|
19262
|
+
const onCellChanged = function (cell, rowIndex, nextValue, shouldRunUpdaters = true) {
|
18797
19263
|
try {
|
18798
|
-
function
|
19264
|
+
function _temp4() {
|
18799
19265
|
var _state$changes$errors11;
|
18800
|
-
function
|
19266
|
+
function _temp2() {
|
18801
19267
|
// only set errors and move reasons for the cells we're currently acting on
|
18802
19268
|
// why? because the UX is not good if we set them for cells the user hasn't touched yet
|
18803
19269
|
const cellsToActOn = [cell.column.id, ...Object.keys(updatesForOtherCells)];
|
@@ -18828,6 +19294,7 @@ function usePendingChangesState(handleSave, handleChange, rowIdentityAccessor, v
|
|
18828
19294
|
rowId: cell.row.id,
|
18829
19295
|
payload: {
|
18830
19296
|
cellErrors: nextCellErrors,
|
19297
|
+
index: rowIndex,
|
18831
19298
|
moveReasons: nextMoveReasons,
|
18832
19299
|
value: nextChanges
|
18833
19300
|
}
|
@@ -18835,7 +19302,7 @@ function usePendingChangesState(handleSave, handleChange, rowIdentityAccessor, v
|
|
18835
19302
|
}
|
18836
19303
|
// create a projection of the next state, so we can act against it
|
18837
19304
|
const nextChanges = {
|
18838
|
-
...
|
19305
|
+
...changes,
|
18839
19306
|
...updatesForOtherCells
|
18840
19307
|
};
|
18841
19308
|
const nextMoveReasons = {
|
@@ -18844,29 +19311,35 @@ function usePendingChangesState(handleSave, handleChange, rowIdentityAccessor, v
|
|
18844
19311
|
const nextCellErrors = {
|
18845
19312
|
...((_state$changes$errors11 = state.changes.errors[cell.row.id]) === null || _state$changes$errors11 === void 0 ? void 0 : _state$changes$errors11.cells)
|
18846
19313
|
};
|
18847
|
-
// run validation
|
19314
|
+
// run validation - if there are changes, and if there is an original stored
|
18848
19315
|
let validationErrors = {};
|
18849
|
-
const
|
18850
|
-
if (validator) {
|
19316
|
+
const _temp = function () {
|
19317
|
+
if (validator && Object.keys(nextChanges).length && state.changes.originals[cell.row.id]) {
|
19318
|
+
// merge with the original so we get a full row
|
18851
19319
|
const nextRowValue = {
|
18852
19320
|
...state.changes.originals[cell.row.id],
|
18853
19321
|
...changes,
|
18854
19322
|
...updatesForOtherCells
|
18855
19323
|
};
|
18856
|
-
return Promise.resolve(validator(nextRowValue)).then(function (
|
18857
|
-
validationErrors =
|
19324
|
+
return Promise.resolve(validator(nextRowValue)).then(function (_validator) {
|
19325
|
+
validationErrors = _validator !== null && _validator !== void 0 ? _validator : {};
|
18858
19326
|
});
|
18859
19327
|
}
|
18860
19328
|
}();
|
18861
|
-
return
|
19329
|
+
return _temp && _temp.then ? _temp.then(_temp2) : _temp2(_temp);
|
18862
19330
|
}
|
18863
|
-
const changes =
|
18864
|
-
|
19331
|
+
const changes = nextValue !== undefined ? {
|
19332
|
+
...state.changes.rows[cell.row.id],
|
19333
|
+
[cell.column.id]: nextValue
|
19334
|
+
} : {
|
19335
|
+
...state.changes.rows[cell.row.id]
|
19336
|
+
};
|
19337
|
+
if (!Object.keys(changes).length) {
|
18865
19338
|
return Promise.resolve();
|
18866
19339
|
}
|
18867
19340
|
let updatesForOtherCells = {};
|
18868
19341
|
// run the updater handler if there is one, to see if there are any other cells to update
|
18869
|
-
const
|
19342
|
+
const _temp3 = function () {
|
18870
19343
|
if (typeof handleChange === 'function' && shouldRunUpdaters) {
|
18871
19344
|
const previousRowValue = {
|
18872
19345
|
...state.changes.originals[cell.row.id]
|
@@ -18880,42 +19353,11 @@ function usePendingChangesState(handleSave, handleChange, rowIdentityAccessor, v
|
|
18880
19353
|
});
|
18881
19354
|
}
|
18882
19355
|
}();
|
18883
|
-
return Promise.resolve(
|
19356
|
+
return Promise.resolve(_temp3 && _temp3.then ? _temp3.then(_temp4) : _temp4(_temp3));
|
18884
19357
|
} catch (e) {
|
18885
19358
|
return Promise.reject(e);
|
18886
19359
|
}
|
18887
19360
|
}; // 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
19361
|
const localization = useLocalization();
|
18920
19362
|
const [state, dispatch] = React__default.useReducer(reducer$2, {
|
18921
19363
|
changes: {
|
@@ -18925,8 +19367,10 @@ function usePendingChangesState(handleSave, handleChange, rowIdentityAccessor, v
|
|
18925
19367
|
originals: {},
|
18926
19368
|
status: {}
|
18927
19369
|
},
|
19370
|
+
indexes: {},
|
18928
19371
|
temporaryRows: []
|
18929
19372
|
});
|
19373
|
+
// rows
|
18930
19374
|
function getRowValue(rowId) {
|
18931
19375
|
var _state$changes$rows$r, _state$changes$rows;
|
18932
19376
|
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 +19408,24 @@ function usePendingChangesState(handleSave, handleChange, rowIdentityAccessor, v
|
|
18964
19408
|
}
|
18965
19409
|
});
|
18966
19410
|
}
|
18967
|
-
function
|
19411
|
+
function insertTemporaryRow(data, rowIndex) {
|
18968
19412
|
const newRowId = `${TEMPORARY_ROW_ID_PREFIX}${uuid.v4()}`;
|
18969
19413
|
const value = {
|
18970
19414
|
...data,
|
18971
19415
|
[rowIdentityAccessor]: newRowId
|
18972
19416
|
};
|
18973
19417
|
dispatch({
|
18974
|
-
type: '
|
19418
|
+
type: 'insertTemporaryRow',
|
18975
19419
|
rowId: newRowId,
|
18976
19420
|
payload: {
|
19421
|
+
index: rowIndex,
|
18977
19422
|
value
|
18978
19423
|
}
|
18979
19424
|
});
|
18980
19425
|
return newRowId;
|
18981
19426
|
}
|
18982
19427
|
// cells
|
18983
|
-
function setCellValue(cell, value) {
|
19428
|
+
function setCellValue(cell, rowIndex, value) {
|
18984
19429
|
const rowId = cell.row.id;
|
18985
19430
|
const columnId = cell.column.id;
|
18986
19431
|
// update if the change is different to the original value
|
@@ -18990,6 +19435,7 @@ function usePendingChangesState(handleSave, handleChange, rowIdentityAccessor, v
|
|
18990
19435
|
rowId,
|
18991
19436
|
payload: {
|
18992
19437
|
columnId,
|
19438
|
+
index: rowIndex,
|
18993
19439
|
row: cell.row.original,
|
18994
19440
|
value
|
18995
19441
|
}
|
@@ -19022,6 +19468,7 @@ function usePendingChangesState(handleSave, handleChange, rowIdentityAccessor, v
|
|
19022
19468
|
}
|
19023
19469
|
return rowsWithErrors.filter(hasRowErrorsShownInAlert).map(rowId => ({
|
19024
19470
|
rowId,
|
19471
|
+
index: state.indexes[rowId],
|
19025
19472
|
changes: state.changes.rows[rowId],
|
19026
19473
|
errors: state.changes.errors[rowId]
|
19027
19474
|
}));
|
@@ -19032,20 +19479,8 @@ function usePendingChangesState(handleSave, handleChange, rowIdentityAccessor, v
|
|
19032
19479
|
function hasChanges(rowId) {
|
19033
19480
|
return rowId ? !!state.changes.rows[rowId] : !!Object.keys(state.changes.rows).length;
|
19034
19481
|
}
|
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
19482
|
return {
|
19047
19483
|
// row
|
19048
|
-
setRowValue,
|
19049
19484
|
getRowValue,
|
19050
19485
|
getRowMoveReason,
|
19051
19486
|
hasRowErrors,
|
@@ -19065,12 +19500,66 @@ function usePendingChangesState(handleSave, handleChange, rowIdentityAccessor, v
|
|
19065
19500
|
discardChanges,
|
19066
19501
|
hasSaved,
|
19067
19502
|
// new rows
|
19068
|
-
|
19503
|
+
insertTemporaryRow,
|
19069
19504
|
temporaryRows: state.temporaryRows
|
19070
19505
|
};
|
19071
19506
|
}
|
19072
19507
|
|
19073
|
-
function useTableEditing(isEnabled = false, handleSave, handleChange, rowIdentityAccessor, validator) {
|
19508
|
+
function useTableEditing(isEnabled = false, handleSave, handleChange, handleCreate, handleDiscard, rowIdentityAccessor, validator) {
|
19509
|
+
const createRow = function (table, row) {
|
19510
|
+
try {
|
19511
|
+
let _exit = false;
|
19512
|
+
function _temp2(_result) {
|
19513
|
+
if (_exit) return _result;
|
19514
|
+
const changeset = row !== null && row !== void 0 ? row : handleCreate();
|
19515
|
+
try {
|
19516
|
+
if (changeset) {
|
19517
|
+
// set the active row to the new row before toggling editing on
|
19518
|
+
const temporaryRows = tableMeta.editing.temporaryRows;
|
19519
|
+
const nextRowIndex = temporaryRows.length ? tableMeta.length + 1 : tableMeta.length;
|
19520
|
+
const newRowId = pendingChangesFns.insertTemporaryRow(changeset, nextRowIndex);
|
19521
|
+
// prep the row
|
19522
|
+
table.setRowPinning(currentState => {
|
19523
|
+
var _ref, _currentState$bottom;
|
19524
|
+
return {
|
19525
|
+
...currentState,
|
19526
|
+
bottom: (_ref = (_currentState$bottom = currentState.bottom) !== null && _currentState$bottom !== void 0 ? _currentState$bottom : []) === null || _ref === void 0 ? void 0 : _ref.concat(newRowId)
|
19527
|
+
};
|
19528
|
+
});
|
19529
|
+
// prep editing mode
|
19530
|
+
toggleDetailedMode(false);
|
19531
|
+
setLastFocusedCellIndex(undefined);
|
19532
|
+
// wait until set states have run
|
19533
|
+
requestAnimationFrame(() => {
|
19534
|
+
tableMeta.rowActive.setRowActiveIndex(nextRowIndex);
|
19535
|
+
table.resetRowSelection();
|
19536
|
+
if (!tableMeta.editing.isEditing) {
|
19537
|
+
setEditing(true);
|
19538
|
+
}
|
19539
|
+
});
|
19540
|
+
}
|
19541
|
+
} catch (error) {
|
19542
|
+
console.error(error);
|
19543
|
+
}
|
19544
|
+
}
|
19545
|
+
if (!handleCreate) {
|
19546
|
+
return Promise.resolve();
|
19547
|
+
}
|
19548
|
+
const tableMeta = table.options.meta;
|
19549
|
+
const _temp = function () {
|
19550
|
+
if (tableMeta.rowActive.rowActiveIndex !== undefined) {
|
19551
|
+
return Promise.resolve(tableMeta.editing.saveChanges(table)).then(function (saved) {
|
19552
|
+
if (!saved) {
|
19553
|
+
_exit = true;
|
19554
|
+
}
|
19555
|
+
});
|
19556
|
+
}
|
19557
|
+
}();
|
19558
|
+
return Promise.resolve(_temp && _temp.then ? _temp.then(_temp2) : _temp2(_temp));
|
19559
|
+
} catch (e) {
|
19560
|
+
return Promise.reject(e);
|
19561
|
+
}
|
19562
|
+
};
|
19074
19563
|
// used to switch the table into editing mode
|
19075
19564
|
const [isEditing, setEditing] = React__default.useState(false);
|
19076
19565
|
// used to switch the editing between "detailed" mode
|
@@ -19079,26 +19568,26 @@ function useTableEditing(isEnabled = false, handleSave, handleChange, rowIdentit
|
|
19079
19568
|
const createRowButtonRef = React__default.useRef(null);
|
19080
19569
|
// store the last focused cell, so that up/down arrow key navigation remains in the same column
|
19081
19570
|
const [lastFocusedCellIndex, setLastFocusedCellIndex] = React__default.useState(undefined);
|
19082
|
-
const pendingChangesFns = usePendingChangesState(handleSave, handleChange, rowIdentityAccessor, validator);
|
19571
|
+
const pendingChangesFns = usePendingChangesState(handleSave, handleChange, handleDiscard, rowIdentityAccessor, validator);
|
19083
19572
|
function toggleEditing(enabled, table, scrollToIndex) {
|
19084
|
-
|
19085
|
-
if (
|
19086
|
-
|
19087
|
-
|
19573
|
+
const tableMeta = table.options.meta;
|
19574
|
+
if (enabled) {
|
19575
|
+
var _tableMeta$rowActive$, _table$getRowModel$ro;
|
19576
|
+
const index = (_tableMeta$rowActive$ = tableMeta.rowActive.rowActiveIndex) !== null && _tableMeta$rowActive$ !== void 0 ? _tableMeta$rowActive$ : 0;
|
19577
|
+
if (tableMeta.rowActive.rowActiveIndex === undefined) {
|
19578
|
+
tableMeta.rowActive.setRowActiveIndex(index);
|
19579
|
+
}
|
19580
|
+
if (!isTemporaryRow((_table$getRowModel$ro = table.getRowModel().rows[index]) === null || _table$getRowModel$ro === void 0 ? void 0 : _table$getRowModel$ro.id)) {
|
19581
|
+
scrollToIndex(index);
|
19582
|
+
}
|
19583
|
+
} else if (!enabled) {
|
19088
19584
|
// reset detailed mode
|
19089
19585
|
toggleDetailedMode(false);
|
19090
19586
|
// reset the last index back to the first focusable element, when editing gets turned off
|
19091
19587
|
setLastFocusedCellIndex(undefined);
|
19092
19588
|
}
|
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
19589
|
setEditing(enabled);
|
19099
|
-
|
19100
|
-
scrollToIndex(index);
|
19101
|
-
}
|
19590
|
+
pendingChangesFns.saveChanges(table);
|
19102
19591
|
}
|
19103
19592
|
return {
|
19104
19593
|
isEnabled,
|
@@ -19108,6 +19597,7 @@ function useTableEditing(isEnabled = false, handleSave, handleChange, rowIdentit
|
|
19108
19597
|
toggleEditing: isEnabled ? toggleEditing : () => undefined,
|
19109
19598
|
lastFocusedCellIndex,
|
19110
19599
|
setLastFocusedCellIndex,
|
19600
|
+
createRow,
|
19111
19601
|
createRowButtonRef,
|
19112
19602
|
...pendingChangesFns
|
19113
19603
|
};
|
@@ -19364,24 +19854,30 @@ function EditingControlCell(props) {
|
|
19364
19854
|
var _cellRef$current;
|
19365
19855
|
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
19856
|
}, [cellRef.current]);
|
19367
|
-
const handleChange = nextValue => {
|
19857
|
+
const handleChange = React__default.useCallback(nextValue => {
|
19368
19858
|
if (nextValue !== value) {
|
19369
|
-
tableMeta.editing.setCellValue(cell, nextValue);
|
19859
|
+
tableMeta.editing.setCellValue(cell, rowIndex, nextValue);
|
19370
19860
|
if (hasNonTextControl) {
|
19371
|
-
tableMeta.editing.onCellChanged(cell, rowIndex);
|
19861
|
+
requestAnimationFrame(() => tableMeta.editing.onCellChanged(cell, rowIndex, nextValue));
|
19372
19862
|
}
|
19373
19863
|
}
|
19374
|
-
};
|
19375
|
-
const
|
19864
|
+
}, [hasNonTextControl, cell.row.id, cell.column.id, cell.row.original, rowIndex, value]);
|
19865
|
+
const blur = React__default.useCallback(function blur() {
|
19376
19866
|
tableMeta.editing.toggleDetailedMode(false);
|
19377
|
-
tableMeta.editing.onCellChanged(cell, rowIndex, !hasNonTextControl);
|
19378
|
-
};
|
19867
|
+
tableMeta.editing.onCellChanged(cell, rowIndex, undefined, !hasNonTextControl);
|
19868
|
+
}, [hasNonTextControl, cell.row.id, cell.column.id, cell.row.original, rowIndex]);
|
19869
|
+
const handleBlur = React__default.useCallback(event => {
|
19870
|
+
if (isElementInsideOrTriggeredFromContainer(event.relatedTarget, event.currentTarget)) {
|
19871
|
+
return;
|
19872
|
+
}
|
19873
|
+
blur();
|
19874
|
+
}, [blur]);
|
19379
19875
|
// ensure that blur runs when the cell gets unmounted (when vertically arrow key navigating)
|
19380
19876
|
React__default.useEffect(() => {
|
19381
19877
|
const ref = cellRef.current;
|
19382
19878
|
return () => {
|
19383
19879
|
if (document.activeElement === ref || isElementInsideOrTriggeredFromContainer(document.activeElement, ref)) {
|
19384
|
-
|
19880
|
+
blur();
|
19385
19881
|
}
|
19386
19882
|
};
|
19387
19883
|
}, []);
|
@@ -19443,32 +19939,6 @@ const MemoedEditingCell = /*#__PURE__*/React__default.memo(function MemoedEditin
|
|
19443
19939
|
ref: controlRef,
|
19444
19940
|
tabIndex
|
19445
19941
|
};
|
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
19942
|
const handleInputKeyDown = event => {
|
19473
19943
|
const target = event.target;
|
19474
19944
|
if (target.readOnly) {
|
@@ -19516,6 +19986,39 @@ const MemoedEditingCell = /*#__PURE__*/React__default.memo(function MemoedEditin
|
|
19516
19986
|
toggleDetailedMode(true);
|
19517
19987
|
}
|
19518
19988
|
};
|
19989
|
+
if (typeof type === 'function') {
|
19990
|
+
const controlFnProps = {
|
19991
|
+
...commonProps,
|
19992
|
+
invalid,
|
19993
|
+
setValue: onChange,
|
19994
|
+
onKeyDown: event => {
|
19995
|
+
const target = event.target || null;
|
19996
|
+
// it make sense to handle keydown for the custom edititng controls only if target is either input or textarea
|
19997
|
+
if (target && (target.tagName === 'INPUT' || target.tagName === 'TEXTAREA')) {
|
19998
|
+
handleInputKeyDown(event);
|
19999
|
+
}
|
20000
|
+
},
|
20001
|
+
value
|
20002
|
+
};
|
20003
|
+
return type(controlFnProps, {
|
20004
|
+
...row,
|
20005
|
+
...rowPendingChanges
|
20006
|
+
});
|
20007
|
+
}
|
20008
|
+
if (type === 'switch') {
|
20009
|
+
return /*#__PURE__*/React__default.createElement(Switch, Object.assign({}, commonProps, {
|
20010
|
+
checked: Boolean(value),
|
20011
|
+
onChange: onChange,
|
20012
|
+
ref: controlRef
|
20013
|
+
}));
|
20014
|
+
}
|
20015
|
+
if (type === 'checkbox') {
|
20016
|
+
return /*#__PURE__*/React__default.createElement(Checkbox, Object.assign({}, commonProps, {
|
20017
|
+
checked: Boolean(value),
|
20018
|
+
onChange: onChange,
|
20019
|
+
ref: controlRef
|
20020
|
+
}));
|
20021
|
+
}
|
19519
20022
|
const handleFocus = event => {
|
19520
20023
|
if (!isDetailedMode) {
|
19521
20024
|
event.target.select();
|
@@ -19529,11 +20032,21 @@ const MemoedEditingCell = /*#__PURE__*/React__default.memo(function MemoedEditin
|
|
19529
20032
|
props.onChange(newDate);
|
19530
20033
|
}
|
19531
20034
|
};
|
20035
|
+
const handleDatepickerInputKeyDown = event => {
|
20036
|
+
// When in detailed mode, we want to handle the change, when 'Enter' is pressed.
|
20037
|
+
// To make it possible, we just need to prevent handleInputKeyDown from being executed, and give the full control to Datepicker,
|
20038
|
+
// by doing this, Datepicker will exit "detailed mode" by itself when a valid date change event is triggered.
|
20039
|
+
// In any other cases we'll just execute the "handleInputKeyDown" handler.
|
20040
|
+
if (isDetailedMode && event.key === 'Enter' && event.target.value !== '') {
|
20041
|
+
return;
|
20042
|
+
}
|
20043
|
+
handleInputKeyDown(event);
|
20044
|
+
};
|
19532
20045
|
return /*#__PURE__*/React__default.createElement(Datepicker, Object.assign({}, commonProps, {
|
19533
20046
|
invalid: invalid,
|
19534
20047
|
onChange: handleChange,
|
19535
20048
|
onFocus: handleFocus,
|
19536
|
-
onKeyDown:
|
20049
|
+
onKeyDown: handleDatepickerInputKeyDown,
|
19537
20050
|
ref: controlRef,
|
19538
20051
|
value: valueAsDate
|
19539
20052
|
}));
|
@@ -19625,7 +20138,6 @@ function DiscardChangesConfirmationDialog(props) {
|
|
19625
20138
|
}, /*#__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
20139
|
tabIndex: 0
|
19627
20140
|
}, texts.table3.editing.clearChangesConfirmationDialog.cancel)), /*#__PURE__*/React__default.createElement(Dialog.Close, null, /*#__PURE__*/React__default.createElement(Button$1, {
|
19628
|
-
autoFocus: true,
|
19629
20141
|
tabIndex: 0,
|
19630
20142
|
appearance: "primary",
|
19631
20143
|
onClick: handleDiscard
|
@@ -19661,7 +20173,8 @@ function EditingActionsMenu(props) {
|
|
19661
20173
|
icon: "more",
|
19662
20174
|
onKeyDown: handleKeyDown,
|
19663
20175
|
menu: menuProps => (/*#__PURE__*/React__default.createElement(Menu$1, Object.assign({}, menuProps), /*#__PURE__*/React__default.createElement(Menu$1.Content, {
|
19664
|
-
onKeyDown: handleMenuContentKeyDown
|
20176
|
+
onKeyDown: handleMenuContentKeyDown,
|
20177
|
+
onFocusOutside: event => event.preventDefault()
|
19665
20178
|
}, /*#__PURE__*/React__default.createElement(Menu$1.Item, {
|
19666
20179
|
icon: "tick",
|
19667
20180
|
disabled: !hasChanges || hasErrors,
|
@@ -19784,7 +20297,7 @@ const RENDERERS$1 = {
|
|
19784
20297
|
cell: Cell$5
|
19785
20298
|
};
|
19786
20299
|
function useTable3(props, ref) {
|
19787
|
-
const editing = useTableEditing(props.enableEditing, props.onEditingSave, props.onEditingChange, props.rowIdentityAccessor, props.validator);
|
20300
|
+
const editing = useTableEditing(props.enableEditing, props.onEditingSave, props.onEditingChange, props.onEditingCreate, props.onEditingDiscard, props.rowIdentityAccessor, props.validator);
|
19788
20301
|
const creationEnabled = editing.isEnabled && !!props.onEditingCreate;
|
19789
20302
|
// this gives me the performance heeby jeebies, but can't think of a better way to internalise the state
|
19790
20303
|
const data = React__default.useMemo(() => {
|
@@ -19799,20 +20312,19 @@ function useTable3(props, ref) {
|
|
19799
20312
|
data,
|
19800
20313
|
enableRowActions: editing.isEditing ? true : props.enableRowActions,
|
19801
20314
|
// Display EditingActionMenu instead of row actions while editing
|
19802
|
-
rowActions: editing.isEditing ? [(_, rowId, table) => {
|
20315
|
+
rowActions: editing.isEditing ? [(_, rowId, __, table) => {
|
19803
20316
|
const tableMeta = table.options.meta;
|
19804
20317
|
return /*#__PURE__*/React__default.createElement(EditingActionsMenu, {
|
19805
20318
|
hasChanges: editing.hasChanges(rowId),
|
19806
20319
|
hasErrors: editing.hasRowErrors(rowId),
|
19807
20320
|
onDiscard: () => {
|
20321
|
+
editing.discardChanges(rowId, table);
|
19808
20322
|
if (editing.temporaryRows.length) {
|
19809
|
-
|
19810
|
-
setTimeout(() => {
|
20323
|
+
requestAnimationFrame(() => {
|
19811
20324
|
var _editing$createRowBut;
|
19812
20325
|
return (_editing$createRowBut = editing.createRowButtonRef.current) === null || _editing$createRowBut === void 0 ? void 0 : _editing$createRowBut.focus();
|
19813
|
-
}
|
20326
|
+
});
|
19814
20327
|
}
|
19815
|
-
editing.discardChanges(rowId, table);
|
19816
20328
|
},
|
19817
20329
|
onEditingSave: function () {
|
19818
20330
|
try {
|
@@ -19837,6 +20349,9 @@ function useTable3(props, ref) {
|
|
19837
20349
|
React__default.useEffect(() => {
|
19838
20350
|
if (table.ref.current) {
|
19839
20351
|
table.ref.current.instance.toggleEditing = enabled => table.meta.editing.toggleEditing(enabled !== null && enabled !== void 0 ? enabled : editing => !editing, table.instance, table.renderer.scrollToIndex);
|
20352
|
+
if (props.onEditingCreate) {
|
20353
|
+
table.ref.current.instance.createRow = row => table.meta.editing.createRow(table.instance, row);
|
20354
|
+
}
|
19840
20355
|
}
|
19841
20356
|
}, [table.ref.current]);
|
19842
20357
|
return table;
|
@@ -19875,22 +20390,26 @@ function Alert$1(props) {
|
|
19875
20390
|
// generate links to each invalid row, to go into the error message
|
19876
20391
|
const links = [];
|
19877
20392
|
const visibleColumns = table.getVisibleFlatColumns().map(c => c.id);
|
19878
|
-
const rowIdentityColumn = tableMeta.rowIdentityAccessor && visibleColumns.includes(String(tableMeta.rowIdentityAccessor)) ?
|
20393
|
+
const rowIdentityColumn = tableMeta.rowIdentityAccessor && visibleColumns.includes(String(tableMeta.rowIdentityAccessor)) ?
|
20394
|
+
// table.getColumn(columName) throw error in strict dev mode. Related thread: https://github.com/TanStack/table/discussions/5505
|
20395
|
+
table.getAllColumns().find(x => x.id === String(tableMeta.rowIdentityAccessor)) : undefined;
|
19879
20396
|
pendingChangesWithErrors.forEach((pendingChangeWithError, index) => {
|
20397
|
+
var _row;
|
19880
20398
|
// if appropriate, concatenate the item with the text "and"
|
19881
20399
|
if (pendingChangesWithErrors.length > 1 && index === pendingChangesWithErrors.length - 1) {
|
19882
20400
|
// Add space before and after `messageAnd` text
|
19883
20401
|
links.push(` ${validationTexts.alert.messageAnd} `);
|
19884
20402
|
}
|
19885
|
-
|
20403
|
+
// note: if this row click functionality is removed, indexes can be removed from useEditingState
|
19886
20404
|
const handleClick = () => {
|
19887
20405
|
// if row is visible
|
19888
|
-
if (
|
19889
|
-
scrollToRow(
|
20406
|
+
if (pendingChangeWithError.index > -1) {
|
20407
|
+
scrollToRow(pendingChangeWithError.index);
|
20408
|
+
tableMeta.rowActive.setRowActiveIndex(pendingChangeWithError.index);
|
19890
20409
|
}
|
19891
20410
|
// if row is filtered out
|
19892
20411
|
else {
|
19893
|
-
setShowFilterResetDialog(pendingChangeWithError.
|
20412
|
+
setShowFilterResetDialog(pendingChangeWithError.index);
|
19894
20413
|
}
|
19895
20414
|
};
|
19896
20415
|
let tooltip;
|
@@ -19902,7 +20421,12 @@ function Alert$1(props) {
|
|
19902
20421
|
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
20422
|
tooltip = `${columnName}: ${pendingChangeWithError.errors.cells[firstCellErrorColumnId]}`;
|
19904
20423
|
}
|
19905
|
-
|
20424
|
+
let row = undefined;
|
20425
|
+
try {
|
20426
|
+
row = table.getRow(pendingChangeWithError.rowId).original;
|
20427
|
+
} catch {
|
20428
|
+
// because of server loading, some rows may not be accessible
|
20429
|
+
}
|
19906
20430
|
links.push(/*#__PURE__*/React__default.createElement(Tooltip, {
|
19907
20431
|
key: pendingChangeWithError.rowId,
|
19908
20432
|
title: tooltip
|
@@ -19910,7 +20434,7 @@ function Alert$1(props) {
|
|
19910
20434
|
className: "text-blue",
|
19911
20435
|
onClick: handleClick,
|
19912
20436
|
role: "button"
|
19913
|
-
}, rowIdentityColumn ? row[rowIdentityColumn.id] :
|
20437
|
+
}, rowIdentityColumn ? (_row = row) === null || _row === void 0 ? void 0 : _row[rowIdentityColumn.id] : pendingChangeWithError.index + 1)));
|
19914
20438
|
// if appropriate, concatenate the item with the text ","
|
19915
20439
|
if (pendingChangesWithErrors.length > 2 && index < pendingChangesWithErrors.length - 2) {
|
19916
20440
|
links.push(', ');
|
@@ -19931,9 +20455,8 @@ function Alert$1(props) {
|
|
19931
20455
|
table.resetGlobalFilter();
|
19932
20456
|
table.resetColumnFilters();
|
19933
20457
|
requestAnimationFrame(() => {
|
19934
|
-
|
19935
|
-
|
19936
|
-
scrollToRow(rowIndex);
|
20458
|
+
if (showFilterResetDialog && showFilterResetDialog > -1) {
|
20459
|
+
scrollToRow(showFilterResetDialog);
|
19937
20460
|
}
|
19938
20461
|
setShowFilterResetDialog(false);
|
19939
20462
|
});
|
@@ -19977,7 +20500,11 @@ function Editing(props) {
|
|
19977
20500
|
const ref = React__default.useRef(null);
|
19978
20501
|
const tableMeta = table.options.meta;
|
19979
20502
|
const handleChange = enabled => {
|
20503
|
+
var _tableMeta$onEvent;
|
19980
20504
|
tableMeta.editing.toggleEditing(enabled, table, scrollToIndex);
|
20505
|
+
(_tableMeta$onEvent = tableMeta.onEvent) === null || _tableMeta$onEvent === void 0 ? void 0 : _tableMeta$onEvent.call(tableMeta, 'editing-mode', {
|
20506
|
+
enabled
|
20507
|
+
});
|
19981
20508
|
};
|
19982
20509
|
const tooltip = /*#__PURE__*/React__default.createElement(React__default.Fragment, null, texts.table3.editing.buttons.edit.tooltip, /*#__PURE__*/React__default.createElement(Shortcut, {
|
19983
20510
|
className: "ml-2",
|
@@ -19994,14 +20521,12 @@ function Editing(props) {
|
|
19994
20521
|
}
|
19995
20522
|
|
19996
20523
|
function CreateNewRow(props) {
|
19997
|
-
var _temporaryRows$0$tabl, _temporaryRows$, _table$getState$colum
|
20524
|
+
var _temporaryRows$0$tabl, _temporaryRows$, _table$getState$colum;
|
19998
20525
|
const {
|
19999
20526
|
buttonRef,
|
20000
|
-
|
20001
|
-
scrollToIndex,
|
20527
|
+
isScrolled,
|
20002
20528
|
table,
|
20003
|
-
tableMeta
|
20004
|
-
tableRef
|
20529
|
+
tableMeta
|
20005
20530
|
} = props;
|
20006
20531
|
const {
|
20007
20532
|
texts
|
@@ -20010,44 +20535,16 @@ function CreateNewRow(props) {
|
|
20010
20535
|
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
20536
|
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
20537
|
const isSaving = !!temporaryRowId && tableMeta.editing.getRowStatus(temporaryRowId) === 'saving';
|
20013
|
-
const
|
20538
|
+
const handleCreate = function () {
|
20014
20539
|
try {
|
20015
|
-
if (
|
20540
|
+
if (isDisabled) {
|
20016
20541
|
return Promise.resolve();
|
20017
20542
|
}
|
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
|
-
});
|
20543
|
+
return Promise.resolve(tableMeta.editing.createRow(table)).then(function () {});
|
20037
20544
|
} catch (e) {
|
20038
20545
|
return Promise.reject(e);
|
20039
20546
|
}
|
20040
20547
|
};
|
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
20548
|
const shortcut = {
|
20052
20549
|
key: 'Enter',
|
20053
20550
|
meta: true
|
@@ -20062,11 +20559,9 @@ function CreateNewRow(props) {
|
|
20062
20559
|
keys: shortcut
|
20063
20560
|
});
|
20064
20561
|
}
|
20065
|
-
const isScrolled = tableRef.current ? tableRef.current.scrollHeight > tableRef.current.clientHeight : false;
|
20066
20562
|
const className = cn('group/row border-grey-300 !sticky z-[21]', {
|
20067
20563
|
'bottom-10': tableMeta.footer.isEnabled,
|
20068
20564
|
'bottom-0': !tableMeta.footer.isEnabled,
|
20069
|
-
'border-t-2': isScrolled,
|
20070
20565
|
'border-b': !isScrolled
|
20071
20566
|
});
|
20072
20567
|
return /*#__PURE__*/React__default.createElement("tr", {
|
@@ -20091,6 +20586,7 @@ function CreateNewRow(props) {
|
|
20091
20586
|
function TemporaryRow(props) {
|
20092
20587
|
const {
|
20093
20588
|
createRowButtonRef,
|
20589
|
+
isScrolled,
|
20094
20590
|
table,
|
20095
20591
|
tableMeta,
|
20096
20592
|
tableRef
|
@@ -20153,10 +20649,9 @@ function TemporaryRow(props) {
|
|
20153
20649
|
}
|
20154
20650
|
}
|
20155
20651
|
};
|
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,
|
20652
|
+
const className = cn('group/row border-grey-300 !sticky z-[22] print:hidden', {
|
20653
|
+
'bottom-[calc(5rem_+_2px)] data-[row-editing-move]:bottom-[calc(5rem_+_2px)]': tableMeta.footer.isEnabled,
|
20654
|
+
'bottom-[calc(2.5rem_+_2px)] data-[row-editing-move]:bottom-[calc(2.5rem_+_2px)]': !tableMeta.footer.isEnabled,
|
20160
20655
|
'border-t-2 shadow-[0px_-5px_20px_0px_rgba(0,0,0,0.1)] [&>td]:!border-b-0': isScrolled
|
20161
20656
|
});
|
20162
20657
|
return /*#__PURE__*/React__default.createElement(React__default.Fragment, null, table.getBottomRows().map(row => (/*#__PURE__*/React__default.createElement(Row, {
|
@@ -20170,14 +20665,13 @@ function TemporaryRow(props) {
|
|
20170
20665
|
className: className,
|
20171
20666
|
onKeyDown: handleKeyDown,
|
20172
20667
|
onKeyDownCapture: handleKeyDownCapture,
|
20173
|
-
|
20174
|
-
hideRowActions: !tableMeta.editing.isEditing
|
20668
|
+
hideInternalColumns: true,
|
20669
|
+
hideRowActions: !tableMeta.editing.isEditing,
|
20670
|
+
skipPageLoading: true
|
20175
20671
|
}))));
|
20176
20672
|
}
|
20177
20673
|
|
20178
|
-
|
20179
|
-
return null;
|
20180
|
-
}
|
20674
|
+
const Column$3 = () => null;
|
20181
20675
|
Column$3.displayName = 'Table3Column';
|
20182
20676
|
function Group$5(_) {
|
20183
20677
|
return null;
|
@@ -20190,8 +20684,25 @@ const BaseTable3 = /*#__PURE__*/fixedForwardRef(function BaseTable3(props, ref)
|
|
20190
20684
|
'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
20685
|
enableHorizontalArrowKeyNavigation: table3.meta.editing.isEditing
|
20192
20686
|
};
|
20193
|
-
const
|
20687
|
+
const rowsById = table3.instance.getCoreRowModel().rowsById;
|
20688
|
+
const hasAlertErrors = table3.meta.editing.getErrorsShownInAlert().filter(row => {
|
20689
|
+
if (table3.meta.server._experimentalDataLoader2) {
|
20690
|
+
// consumers of dataloader2 need to run a cleanup function, as this would otherwise return false when pages are unloaded.
|
20691
|
+
return true;
|
20692
|
+
}
|
20693
|
+
return rowsById[row.rowId];
|
20694
|
+
}).length;
|
20194
20695
|
const hasCreateWorkflow = table3.meta.editing.isEnabled && props.onEditingCreate;
|
20696
|
+
const isScrolled = isTableScrolled(table3.ref);
|
20697
|
+
let createWorkflow;
|
20698
|
+
if (hasCreateWorkflow) {
|
20699
|
+
createWorkflow = /*#__PURE__*/React__default.createElement(CreateNewRow, {
|
20700
|
+
buttonRef: table3.meta.editing.createRowButtonRef,
|
20701
|
+
isScrolled: isScrolled,
|
20702
|
+
table: table3.instance,
|
20703
|
+
tableMeta: table3.meta
|
20704
|
+
});
|
20705
|
+
}
|
20195
20706
|
return /*#__PURE__*/React__default.createElement(Table, null, /*#__PURE__*/React__default.createElement(Table.Toolbar, {
|
20196
20707
|
table: table3
|
20197
20708
|
}, table3.meta.editing.isEnabled ? (/*#__PURE__*/React__default.createElement(Editing, {
|
@@ -20204,20 +20715,15 @@ const BaseTable3 = /*#__PURE__*/fixedForwardRef(function BaseTable3(props, ref)
|
|
20204
20715
|
tableRef: table3.ref
|
20205
20716
|
})) : null, /*#__PURE__*/React__default.createElement(Table.Grid, Object.assign({}, gridAttributes, {
|
20206
20717
|
"data-taco": "table3",
|
20718
|
+
footerRows: hasCreateWorkflow && isScrolled ? createWorkflow : undefined,
|
20207
20719
|
table: table3
|
20208
20720
|
}), hasCreateWorkflow ? (/*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement(TemporaryRow, {
|
20209
20721
|
createRowButtonRef: table3.meta.editing.createRowButtonRef,
|
20722
|
+
isScrolled: isScrolled,
|
20210
20723
|
table: table3.instance,
|
20211
20724
|
tableMeta: table3.meta,
|
20212
20725
|
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));
|
20726
|
+
}), !isScrolled ? createWorkflow : null)) : null));
|
20221
20727
|
});
|
20222
20728
|
const Table3 = /*#__PURE__*/fixedForwardRef(function Table3(props, ref) {
|
20223
20729
|
const stringifiedChildren = String(props.children);
|
@@ -20453,6 +20959,796 @@ const Tour = props => {
|
|
20453
20959
|
};
|
20454
20960
|
Tour.Step = TourStep;
|
20455
20961
|
|
20962
|
+
// NOTE: this file is intentianally a js file so that it can be consumed by tailwind.config.js
|
20963
|
+
|
20964
|
+
const THEME_COLORS = {
|
20965
|
+
transparent: 'transparent',
|
20966
|
+
current: 'currentColor',
|
20967
|
+
white: '#fff',
|
20968
|
+
black: '#1c1c1c',
|
20969
|
+
brand: {
|
20970
|
+
vismaRed: '#E70641',
|
20971
|
+
paleOrange: '#FFF5E5',
|
20972
|
+
sunsetOrange: '#E89C2E',
|
20973
|
+
midnightBlue: '#29283E',
|
20974
|
+
coolBlue: '#F5F7F9'
|
20975
|
+
},
|
20976
|
+
grey: {
|
20977
|
+
lightest: '#fafafa',
|
20978
|
+
light: '#F6F6F6',
|
20979
|
+
DEFAULT: '#EBEBEB',
|
20980
|
+
dark: '#DDDDDD',
|
20981
|
+
darker: '#ACACAC',
|
20982
|
+
darkest: '#595959',
|
20983
|
+
darkNew: '#a5a6a9',
|
20984
|
+
50: '#fafafa',
|
20985
|
+
100: '#F6F6F6',
|
20986
|
+
200: '#EBEBEB',
|
20987
|
+
300: '#DDDDDD',
|
20988
|
+
500: '#ACACAC',
|
20989
|
+
700: '#595959',
|
20990
|
+
900: '#303030'
|
20991
|
+
},
|
20992
|
+
purple: {
|
20993
|
+
lightest: '#585c74',
|
20994
|
+
light: '#4b4f64',
|
20995
|
+
DEFAULT: '#3d4153',
|
20996
|
+
dark: '#353a48',
|
20997
|
+
darker: '#29283e',
|
20998
|
+
darkest: '#212032',
|
20999
|
+
darkNew_1: '#373647',
|
21000
|
+
darkNew_2: '#414050',
|
21001
|
+
100: '#EEE5FF',
|
21002
|
+
200: '#ddd1ff',
|
21003
|
+
300: '#CBBCFE',
|
21004
|
+
500: '#9270FA',
|
21005
|
+
700: '#6542D1',
|
21006
|
+
900: '#412970'
|
21007
|
+
},
|
21008
|
+
blue: {
|
21009
|
+
lightest: '#DEEBFF',
|
21010
|
+
light: '#75A0F5',
|
21011
|
+
DEFAULT: '#4573D2',
|
21012
|
+
dark: '#2B57B4',
|
21013
|
+
100: '#DEEBFF',
|
21014
|
+
200: '#AACCFF',
|
21015
|
+
300: '#75A0F5',
|
21016
|
+
500: '#4573D2',
|
21017
|
+
700: '#2B57B4',
|
21018
|
+
900: '#29283E'
|
21019
|
+
},
|
21020
|
+
red: {
|
21021
|
+
lightest: '#FFDAD2',
|
21022
|
+
light: '#E66568',
|
21023
|
+
DEFAULT: '#CE3F42',
|
21024
|
+
dark: '#950027',
|
21025
|
+
100: '#FFDAD2',
|
21026
|
+
200: '#f3a09d',
|
21027
|
+
300: '#E66568',
|
21028
|
+
500: '#CE3F42',
|
21029
|
+
700: '#950027',
|
21030
|
+
900: '#64001B'
|
21031
|
+
},
|
21032
|
+
green: {
|
21033
|
+
lightest: '#cdf0e7',
|
21034
|
+
light: '#52C7AB',
|
21035
|
+
DEFAULT: '#08AE87',
|
21036
|
+
dark: '#028465',
|
21037
|
+
100: '#cdf0e7',
|
21038
|
+
200: '#9be1ce',
|
21039
|
+
300: '#52C7AB',
|
21040
|
+
500: '#08AE87',
|
21041
|
+
700: '#028465',
|
21042
|
+
900: '#14493A'
|
21043
|
+
},
|
21044
|
+
yellow: {
|
21045
|
+
lightest: '#FFF1C3',
|
21046
|
+
light: '#FFD665',
|
21047
|
+
DEFAULT: '#FFBD3B',
|
21048
|
+
dark: '#e89c2e',
|
21049
|
+
100: '#FFF1C3',
|
21050
|
+
200: '#ffe494',
|
21051
|
+
300: '#FFD665',
|
21052
|
+
500: '#FFBD3B',
|
21053
|
+
700: '#e89c2e',
|
21054
|
+
900: '#733700'
|
21055
|
+
},
|
21056
|
+
pink: {
|
21057
|
+
100: '#FFE3F7',
|
21058
|
+
200: '#fcb9e9',
|
21059
|
+
300: '#F98EDB',
|
21060
|
+
500: '#E165BF',
|
21061
|
+
700: '#CF49AA',
|
21062
|
+
900: '#870062'
|
21063
|
+
},
|
21064
|
+
brown: {
|
21065
|
+
100: '#EEE0DA',
|
21066
|
+
200: '#DFCCC2',
|
21067
|
+
300: '#C4AB9E',
|
21068
|
+
500: '#93715D',
|
21069
|
+
700: '#73503B',
|
21070
|
+
900: '#45291F'
|
21071
|
+
},
|
21072
|
+
orange: {
|
21073
|
+
100: '#FFE3BB',
|
21074
|
+
200: '#FCCB80',
|
21075
|
+
300: '#FAB64D',
|
21076
|
+
500: '#F99702',
|
21077
|
+
700: '#EF7D00',
|
21078
|
+
900: '#4A2811'
|
21079
|
+
}
|
21080
|
+
};
|
21081
|
+
|
21082
|
+
const mapColor = (palette, prefix = '') => {
|
21083
|
+
return Object.keys(palette).reduce((accum, color) => {
|
21084
|
+
if (color === 'current') {
|
21085
|
+
return accum;
|
21086
|
+
} else if (typeof palette[color] === 'string') {
|
21087
|
+
return {
|
21088
|
+
...accum,
|
21089
|
+
[prefix ? color === 'DEFAULT' ? prefix : `${prefix}-${color}` : color]: palette[color]
|
21090
|
+
};
|
21091
|
+
} else {
|
21092
|
+
return {
|
21093
|
+
...accum,
|
21094
|
+
...mapColor(palette[color], color)
|
21095
|
+
};
|
21096
|
+
}
|
21097
|
+
}, {});
|
21098
|
+
};
|
21099
|
+
const colors = /*#__PURE__*/mapColor(THEME_COLORS);
|
21100
|
+
const getThemeColor = color => colors[color];
|
21101
|
+
|
21102
|
+
function Legend(props) {
|
21103
|
+
const {
|
21104
|
+
activeIndex,
|
21105
|
+
onMouseEnter,
|
21106
|
+
onMouseLeave,
|
21107
|
+
onClick,
|
21108
|
+
payload,
|
21109
|
+
layout,
|
21110
|
+
activeItems
|
21111
|
+
} = props;
|
21112
|
+
const [hoverIndex, setHoverIndex] = React.useState(null);
|
21113
|
+
const handleMouseEnter = (entry, index) => {
|
21114
|
+
setHoverIndex(index);
|
21115
|
+
if (activeItems[entry.dataKey]) onMouseEnter(entry, index);
|
21116
|
+
};
|
21117
|
+
const handleMouseLeave = () => {
|
21118
|
+
onMouseLeave();
|
21119
|
+
setHoverIndex(null);
|
21120
|
+
};
|
21121
|
+
const moreButton = moreButtonText => (/*#__PURE__*/React__default.createElement(Button$1, {
|
21122
|
+
appearance: "transparent",
|
21123
|
+
className: "text-grey-700"
|
21124
|
+
}, moreButtonText));
|
21125
|
+
return /*#__PURE__*/React__default.createElement("div", {
|
21126
|
+
className: "mx-auto w-auto max-w-full overflow-hidden"
|
21127
|
+
}, /*#__PURE__*/React__default.createElement("div", {
|
21128
|
+
className: cn('mb-0 ml-0 flex justify-center', {
|
21129
|
+
'flex-col': layout === 'vertical'
|
21130
|
+
})
|
21131
|
+
}, /*#__PURE__*/React__default.createElement(OverflowGroup, {
|
21132
|
+
className: "w-full items-center py-1",
|
21133
|
+
moreButton: moreButton
|
21134
|
+
}, payload.map((entry, index) => (/*#__PURE__*/React__default.createElement("span", {
|
21135
|
+
key: `${entry.dataKey}-${index}`,
|
21136
|
+
className: cn(' hover:bg-grey-100 cursor-pointer px-[8px] py-[2px] hover:rounded-[4px]', {
|
21137
|
+
'bg-grey-100 rounded': activeIndex === index
|
21138
|
+
}),
|
21139
|
+
onMouseEnter: () => handleMouseEnter(entry, index),
|
21140
|
+
onMouseLeave: handleMouseLeave,
|
21141
|
+
onClick: onClick ? () => onClick(entry) : undefined
|
21142
|
+
}, /*#__PURE__*/React__default.createElement("span", {
|
21143
|
+
className: "text-grey-700 flex items-center gap-[4px]"
|
21144
|
+
}, /*#__PURE__*/React__default.createElement("span", {
|
21145
|
+
className: cn('-mt-px ml-1 flex h-3 w-3 rounded-sm', {
|
21146
|
+
'border-grey-300 border !bg-white': !activeItems[entry.dataKey]
|
21147
|
+
}),
|
21148
|
+
style: {
|
21149
|
+
backgroundColor: entry.color
|
21150
|
+
}
|
21151
|
+
}, hoverIndex === index && activeItems[entry.dataKey] && (/*#__PURE__*/React__default.createElement(Icon, {
|
21152
|
+
name: "tick-bold",
|
21153
|
+
className: "!h-full !w-full text-white"
|
21154
|
+
}))), entry.value)))))));
|
21155
|
+
}
|
21156
|
+
|
21157
|
+
const Tooltip$2 = ({
|
21158
|
+
active,
|
21159
|
+
formatter,
|
21160
|
+
payload,
|
21161
|
+
style,
|
21162
|
+
singlePieDonutChart
|
21163
|
+
}) => {
|
21164
|
+
const getColor = entry => {
|
21165
|
+
var _ref, _entry$color;
|
21166
|
+
if (singlePieDonutChart) {
|
21167
|
+
// We use entry.payload.label because the payload structure differs between a Donut chart with a single pie
|
21168
|
+
// and one with multiple pies.
|
21169
|
+
return getThemeColor(entry.payload.color);
|
21170
|
+
}
|
21171
|
+
return (_ref = (_entry$color = entry.color) !== null && _entry$color !== void 0 ? _entry$color : entry.payload.fill) !== null && _ref !== void 0 ? _ref : 'blue-500';
|
21172
|
+
};
|
21173
|
+
if (active && payload && payload.length) {
|
21174
|
+
return /*#__PURE__*/React__default.createElement("dl", {
|
21175
|
+
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)]",
|
21176
|
+
style: style
|
21177
|
+
}, payload.map((entry, index) => (/*#__PURE__*/React__default.createElement(React__default.Fragment, {
|
21178
|
+
key: `${entry.name}-${index}`
|
21179
|
+
}, /*#__PURE__*/React__default.createElement("dt", {
|
21180
|
+
className: "text-grey-700 mb-0 flex items-center gap-1 font-normal"
|
21181
|
+
}, /*#__PURE__*/React__default.createElement("span", {
|
21182
|
+
className: "-mt-px h-2.5 w-2.5 rounded-sm",
|
21183
|
+
style: {
|
21184
|
+
background: getColor(entry)
|
21185
|
+
}
|
21186
|
+
}),
|
21187
|
+
// We use entry.payload.label because the payload structure differs between a Donut chart with a single pie
|
21188
|
+
// and one with multiple pies.
|
21189
|
+
singlePieDonutChart ? entry.payload.label : entry.name), /*#__PURE__*/React__default.createElement("dd", {
|
21190
|
+
className: "mb-0 text-right font-bold text-black "
|
21191
|
+
}, formatter ? formatter(entry.value) : entry.value)))));
|
21192
|
+
}
|
21193
|
+
return null;
|
21194
|
+
};
|
21195
|
+
|
21196
|
+
const getCartesianGridProps = () => ({
|
21197
|
+
vertical: false
|
21198
|
+
});
|
21199
|
+
const getXAxisProps = props => ({
|
21200
|
+
axisLine: false,
|
21201
|
+
dataKey: props.accessor,
|
21202
|
+
fontSize: 12,
|
21203
|
+
scale: props.xAxisScale,
|
21204
|
+
tickLine: false,
|
21205
|
+
tickFormatter: props.xAxisTickFormat
|
21206
|
+
});
|
21207
|
+
const getYAxisProps = props => ({
|
21208
|
+
axisLine: false,
|
21209
|
+
fontSize: 12,
|
21210
|
+
scale: props.yAxisScale,
|
21211
|
+
tickLine: false,
|
21212
|
+
tickFormatter: props.yAxisTickFormat
|
21213
|
+
});
|
21214
|
+
const getLegendProps = props => ({
|
21215
|
+
content: /*#__PURE__*/React__default.createElement(Legend, Object.assign({}, props))
|
21216
|
+
});
|
21217
|
+
const getTooltipProps = (props = undefined) => ({
|
21218
|
+
content: /*#__PURE__*/React__default.createElement(Tooltip$2, Object.assign({}, props)),
|
21219
|
+
wrapperStyle: {
|
21220
|
+
outline: 'none'
|
21221
|
+
}
|
21222
|
+
});
|
21223
|
+
|
21224
|
+
// A hacky fix for EC-50037 to make sure that Chart doesn't resize when it is inside a Card.
|
21225
|
+
const ResponsiveContainer = props => (/*#__PURE__*/React__default.createElement(Recharts.ResponsiveContainer, Object.assign({
|
21226
|
+
className: "!h-[calc(100%-1px)] !w-[calc(100%-1px)]"
|
21227
|
+
}, props)));
|
21228
|
+
|
21229
|
+
const Area = _ => null;
|
21230
|
+
const AreaChart = function AreaChart(externalProps) {
|
21231
|
+
const {
|
21232
|
+
children,
|
21233
|
+
data,
|
21234
|
+
formatter,
|
21235
|
+
...props
|
21236
|
+
} = externalProps;
|
21237
|
+
const [hoveredArea, setHoveredArea] = React.useState(null);
|
21238
|
+
const [activeAreas, setActiveAreas] = React.useState(() => {
|
21239
|
+
const areas = {};
|
21240
|
+
React__default.Children.forEach(children, child => {
|
21241
|
+
areas[child.props.accessor] = true;
|
21242
|
+
});
|
21243
|
+
return areas;
|
21244
|
+
});
|
21245
|
+
const handleLegendClick = entry => {
|
21246
|
+
setHoveredArea(null);
|
21247
|
+
setActiveAreas({
|
21248
|
+
...activeAreas,
|
21249
|
+
[entry.dataKey]: !activeAreas[entry.dataKey]
|
21250
|
+
});
|
21251
|
+
};
|
21252
|
+
return /*#__PURE__*/React__default.createElement(ResponsiveContainer, null, /*#__PURE__*/React__default.createElement(Recharts.AreaChart, {
|
21253
|
+
data: data,
|
21254
|
+
margin: {
|
21255
|
+
top: 10,
|
21256
|
+
right: 0,
|
21257
|
+
left: -25,
|
21258
|
+
bottom: 0
|
21259
|
+
}
|
21260
|
+
}, /*#__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({
|
21261
|
+
onClick: handleLegendClick,
|
21262
|
+
onMouseEnter: entry => setHoveredArea(entry.dataKey),
|
21263
|
+
onMouseLeave: () => setHoveredArea(null),
|
21264
|
+
activeItems: activeAreas
|
21265
|
+
}))), /*#__PURE__*/React__default.createElement(Recharts.Tooltip, Object.assign({}, getTooltipProps(), {
|
21266
|
+
formatter: formatter
|
21267
|
+
})), React__default.Children.map(children, child => {
|
21268
|
+
var _child$props$color, _child$props$color2, _child$props$color3;
|
21269
|
+
return /*#__PURE__*/React__default.createElement(Recharts.Area, {
|
21270
|
+
activeDot: {
|
21271
|
+
fill: getThemeColor((_child$props$color = child.props.color) !== null && _child$props$color !== void 0 ? _child$props$color : 'blue-300')
|
21272
|
+
},
|
21273
|
+
isAnimationActive: false,
|
21274
|
+
dataKey: child.props.accessor,
|
21275
|
+
dot: false,
|
21276
|
+
fill: getThemeColor((_child$props$color2 = child.props.color) !== null && _child$props$color2 !== void 0 ? _child$props$color2 : 'grey-100'),
|
21277
|
+
name: child.props.label,
|
21278
|
+
strokeWidth: 2,
|
21279
|
+
stroke: getThemeColor((_child$props$color3 = child.props.color) !== null && _child$props$color3 !== void 0 ? _child$props$color3 : 'grey-300'),
|
21280
|
+
stackId: child.props.stackId,
|
21281
|
+
hide: !activeAreas[child.props.accessor],
|
21282
|
+
opacity: hoveredArea && child.props.accessor !== hoveredArea ? 0.3 : 1
|
21283
|
+
});
|
21284
|
+
})));
|
21285
|
+
};
|
21286
|
+
AreaChart.Area = Area;
|
21287
|
+
|
21288
|
+
const Bar$1 = _ => null;
|
21289
|
+
const getXAxisVerticalProps = props => ({
|
21290
|
+
...getXAxisProps(props),
|
21291
|
+
...{
|
21292
|
+
type: 'number',
|
21293
|
+
dataKey: undefined
|
21294
|
+
}
|
21295
|
+
});
|
21296
|
+
const getYAxisVerticalProps = props => ({
|
21297
|
+
...getYAxisProps(props),
|
21298
|
+
...{
|
21299
|
+
dataKey: props.accessor,
|
21300
|
+
type: 'category'
|
21301
|
+
}
|
21302
|
+
});
|
21303
|
+
const BarChart = function BarChart(externalProps) {
|
21304
|
+
const {
|
21305
|
+
children,
|
21306
|
+
data,
|
21307
|
+
formatter,
|
21308
|
+
layout = 'horizontal',
|
21309
|
+
...props
|
21310
|
+
} = externalProps;
|
21311
|
+
const [activeIndex, setActiveIndex] = React__default.useState(undefined);
|
21312
|
+
const [hoveredBar, setHoveredBar] = React__default.useState(null);
|
21313
|
+
const [activeBars, setActiveBars] = React__default.useState(() => {
|
21314
|
+
const keys = {};
|
21315
|
+
React__default.Children.forEach(children, child => {
|
21316
|
+
keys[child.props.accessor] = true;
|
21317
|
+
});
|
21318
|
+
return keys;
|
21319
|
+
});
|
21320
|
+
// Recharts doesn't provide a way for us to know if a stacked bar is at the top or the bottom,
|
21321
|
+
// so we can't set proper radiuses without some "magic"
|
21322
|
+
const stacks = {};
|
21323
|
+
React__default.Children.forEach(children, child => {
|
21324
|
+
if (child.props.stackId) {
|
21325
|
+
if (!stacks[child.props.stackId]) {
|
21326
|
+
stacks[child.props.stackId] = [child.props.accessor];
|
21327
|
+
} else {
|
21328
|
+
stacks[child.props.stackId].push(child.props.accessor);
|
21329
|
+
}
|
21330
|
+
}
|
21331
|
+
});
|
21332
|
+
const handleLegendClick = entry => {
|
21333
|
+
setHoveredBar(null);
|
21334
|
+
setActiveBars({
|
21335
|
+
...activeBars,
|
21336
|
+
[entry.dataKey]: !activeBars[entry.dataKey]
|
21337
|
+
});
|
21338
|
+
};
|
21339
|
+
const handleLegendHover = (entry, index) => {
|
21340
|
+
setHoveredBar(entry.dataKey);
|
21341
|
+
setActiveIndex(index);
|
21342
|
+
};
|
21343
|
+
return /*#__PURE__*/React__default.createElement(ResponsiveContainer, null, /*#__PURE__*/React__default.createElement(Recharts.BarChart, {
|
21344
|
+
layout: layout,
|
21345
|
+
data: data,
|
21346
|
+
margin: {
|
21347
|
+
top: 10,
|
21348
|
+
right: 0,
|
21349
|
+
left: layout === 'vertical' ? 0 : -25,
|
21350
|
+
bottom: 0
|
21351
|
+
},
|
21352
|
+
onMouseMove: chartState => setActiveIndex(chartState.activeTooltipIndex),
|
21353
|
+
onMouseLeave: () => setActiveIndex(undefined)
|
21354
|
+
}, /*#__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({
|
21355
|
+
onClick: handleLegendClick,
|
21356
|
+
onMouseEnter: handleLegendHover,
|
21357
|
+
onMouseLeave: () => setHoveredBar(null),
|
21358
|
+
activeItems: activeBars
|
21359
|
+
}))), /*#__PURE__*/React__default.createElement(Recharts.Tooltip, Object.assign({}, getTooltipProps(), {
|
21360
|
+
formatter: formatter
|
21361
|
+
})), React__default.Children.map(children, child => (/*#__PURE__*/React__default.createElement(Recharts.Bar, {
|
21362
|
+
isAnimationActive: false,
|
21363
|
+
barSize: 16,
|
21364
|
+
dataKey: child.props.accessor,
|
21365
|
+
name: child.props.label,
|
21366
|
+
onMouseEnter: (_, index) => setActiveIndex(index),
|
21367
|
+
onMouseLeave: () => setActiveIndex(undefined),
|
21368
|
+
fill: getThemeColor(child.props.color ? `${child.props.color}` : `blue-300`),
|
21369
|
+
radius: getBarRadius(stacks, child.props.accessor, child.props.stackId, activeBars),
|
21370
|
+
stackId: child.props.stackId,
|
21371
|
+
style: child.props.stackId ? {
|
21372
|
+
stroke: '#fff',
|
21373
|
+
strokeWidth: '2px'
|
21374
|
+
} : undefined,
|
21375
|
+
hide: !activeBars[child.props.accessor]
|
21376
|
+
}, data.map((_, index) => (/*#__PURE__*/React__default.createElement(Recharts.Cell, {
|
21377
|
+
key: `cell-${index}`,
|
21378
|
+
opacity: hoveredBar && child.props.accessor !== hoveredBar || activeIndex !== undefined && activeIndex !== index ? 0.3 : 1
|
21379
|
+
}))))))));
|
21380
|
+
};
|
21381
|
+
BarChart.Bar = Bar$1;
|
21382
|
+
const getBarRadius = (stacks, accessor, stackId, activeBars) => {
|
21383
|
+
if (stackId && Array.isArray(stacks[stackId])) {
|
21384
|
+
const length = stacks[stackId].length - 1;
|
21385
|
+
const index = stacks[stackId].indexOf(accessor);
|
21386
|
+
if (Object.entries(activeBars).filter(item => item[0] !== accessor).every(item => !item[1])) {
|
21387
|
+
return [3, 3, 0, 0];
|
21388
|
+
}
|
21389
|
+
if (activeBars[stacks[stackId][index + 1]] === false) {
|
21390
|
+
return [index === 0 ? 0 : 3, index === 0 ? 0 : 3, index === length - 1 ? 0 : 3, index === length - 1 ? 0 : 3];
|
21391
|
+
}
|
21392
|
+
if (index !== 0 && index !== length) {
|
21393
|
+
return 0;
|
21394
|
+
}
|
21395
|
+
return [index === 0 ? 0 : 3, index === 0 ? 0 : 3, index === length ? 0 : 3, index === length ? 0 : 3];
|
21396
|
+
}
|
21397
|
+
return 3;
|
21398
|
+
};
|
21399
|
+
|
21400
|
+
const Legend$1 = ({
|
21401
|
+
legendPosition,
|
21402
|
+
hoveredItem,
|
21403
|
+
selectedItem,
|
21404
|
+
data,
|
21405
|
+
onClick,
|
21406
|
+
setHoveredItem,
|
21407
|
+
formatter,
|
21408
|
+
total,
|
21409
|
+
visibleItems,
|
21410
|
+
label
|
21411
|
+
}) => {
|
21412
|
+
const isTotalLegendSelected = selectedItem.length === data.length;
|
21413
|
+
const isTotalLegendHovered = hoveredItem.length === data.length;
|
21414
|
+
const handleMouseLeave = () => setHoveredItem([]);
|
21415
|
+
const renderLegendItem = (entry, index) => {
|
21416
|
+
const isTotal = entry === null;
|
21417
|
+
// We can't use `isTotal` here because TypeScript is unable to infer the type when `entry` is not null.
|
21418
|
+
const itemData = entry === null ? {
|
21419
|
+
id: 'total',
|
21420
|
+
label,
|
21421
|
+
value: total,
|
21422
|
+
color: 'grey-300'
|
21423
|
+
} : entry;
|
21424
|
+
const isSelected = isTotal ? isTotalLegendSelected : selectedItem.includes(itemData.id);
|
21425
|
+
const isHovered = isTotal ? isTotalLegendHovered : hoveredItem.includes(itemData.id);
|
21426
|
+
return /*#__PURE__*/React__default.createElement("li", {
|
21427
|
+
key: isTotal ? 'total' : `${itemData.label}-${index}`,
|
21428
|
+
className: cn('mr-2 flex cursor-pointer gap-2 rounded pl-0 pr-1', {
|
21429
|
+
'bg-grey-100': isHovered && (!isTotal || legendPosition === 'right'),
|
21430
|
+
'bg-grey-200': isSelected && (!isTotal || legendPosition === 'right')
|
21431
|
+
}),
|
21432
|
+
onClick: () => onClick(isTotal ? data : itemData),
|
21433
|
+
onMouseEnter: () => setHoveredItem(isTotal ? data.map(item => item.id) : [itemData.id]),
|
21434
|
+
onMouseLeave: handleMouseLeave
|
21435
|
+
}, legendPosition === 'bottom' ? (/*#__PURE__*/React__default.createElement("div", {
|
21436
|
+
className: "flex items-center gap-1"
|
21437
|
+
}, /*#__PURE__*/React__default.createElement("span", {
|
21438
|
+
className: cn('ml-1 h-3 w-3 rounded-sm', {
|
21439
|
+
'border-grey-300 border !bg-white': !visibleItems[itemData.id]
|
21440
|
+
}),
|
21441
|
+
style: {
|
21442
|
+
backgroundColor: getThemeColor(itemData.color)
|
21443
|
+
}
|
21444
|
+
}, visibleItems[itemData.id] && isHovered && (/*#__PURE__*/React__default.createElement(Icon, {
|
21445
|
+
name: "tick-bold",
|
21446
|
+
className: "mb-2.5 !h-full !w-full text-white"
|
21447
|
+
}))), /*#__PURE__*/React__default.createElement("div", null, itemData.label))) : (/*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement("span", {
|
21448
|
+
className: "ml-1 mt-1 h-9 w-2 rounded-[1px]",
|
21449
|
+
style: {
|
21450
|
+
backgroundColor: getThemeColor(itemData.color)
|
21451
|
+
}
|
21452
|
+
}), /*#__PURE__*/React__default.createElement("div", null, itemData.label, /*#__PURE__*/React__default.createElement("span", {
|
21453
|
+
className: "-mt-1 flex w-full text-lg font-bold"
|
21454
|
+
}, formatter ? formatter(itemData.value) : itemData.value)))));
|
21455
|
+
};
|
21456
|
+
const moreButton = moreButtonText => (/*#__PURE__*/React__default.createElement(Button$1, {
|
21457
|
+
appearance: "transparent",
|
21458
|
+
className: "text-grey-700"
|
21459
|
+
}, moreButtonText));
|
21460
|
+
const className = cn('flex-grow pl-4', {
|
21461
|
+
'w-full': legendPosition === 'bottom'
|
21462
|
+
});
|
21463
|
+
return /*#__PURE__*/React__default.createElement("div", {
|
21464
|
+
className: className
|
21465
|
+
}, /*#__PURE__*/React__default.createElement("ul", {
|
21466
|
+
className: cn('mb-0 ml-0 mt-4 flex justify-center space-y-1', legendPosition === 'right' ? 'flex-col gap-1' : 'flex-row')
|
21467
|
+
}, legendPosition === 'right' ? (/*#__PURE__*/React__default.createElement(React__default.Fragment, null, renderLegendItem(null), data.map(renderLegendItem))) : (/*#__PURE__*/React__default.createElement(OverflowGroup, {
|
21468
|
+
className: "w-full items-center py-1",
|
21469
|
+
moreButton: moreButton
|
21470
|
+
}, data.map(renderLegendItem)))));
|
21471
|
+
};
|
21472
|
+
|
21473
|
+
const DONUT_WIDTH = 16;
|
21474
|
+
const HOVER_DONUT_WIDTH = 10;
|
21475
|
+
|
21476
|
+
const CenteredLabel = ({
|
21477
|
+
radius,
|
21478
|
+
legendPosition,
|
21479
|
+
label,
|
21480
|
+
total,
|
21481
|
+
formatter,
|
21482
|
+
showLegend
|
21483
|
+
}) => {
|
21484
|
+
const totalInset = HOVER_DONUT_WIDTH + DONUT_WIDTH + DONUT_WIDTH;
|
21485
|
+
const diameter = radius * 2;
|
21486
|
+
return /*#__PURE__*/React__default.createElement("div", {
|
21487
|
+
className: "absolute mt-1 flex h-12 flex-col text-center",
|
21488
|
+
style: {
|
21489
|
+
top: `calc(${radius}px - (3rem / 2))`,
|
21490
|
+
left: legendPosition === 'right' ? `${totalInset}px` : `calc(50%-${diameter - 2 * totalInset})`,
|
21491
|
+
width: showLegend ? `${diameter - 2 * totalInset}px` : `${diameter}px`
|
21492
|
+
}
|
21493
|
+
}, /*#__PURE__*/React__default.createElement("span", {
|
21494
|
+
className: "w-full truncate text-lg font-bold"
|
21495
|
+
}, formatter ? formatter(total) : total), label);
|
21496
|
+
};
|
21497
|
+
|
21498
|
+
const ActiveShape = props => {
|
21499
|
+
var _getThemeColor;
|
21500
|
+
const {
|
21501
|
+
cx,
|
21502
|
+
cy,
|
21503
|
+
id,
|
21504
|
+
innerRadius,
|
21505
|
+
onClick,
|
21506
|
+
outerRadius = 0,
|
21507
|
+
pieColors,
|
21508
|
+
startAngle,
|
21509
|
+
endAngle,
|
21510
|
+
fill
|
21511
|
+
} = props;
|
21512
|
+
return /*#__PURE__*/React__default.createElement("g", {
|
21513
|
+
onClick: () => onClick(id),
|
21514
|
+
className: cn({
|
21515
|
+
'cursor-pointer': !!onClick
|
21516
|
+
})
|
21517
|
+
}, /*#__PURE__*/React__default.createElement(Recharts.Sector, {
|
21518
|
+
cx: cx,
|
21519
|
+
cy: cy,
|
21520
|
+
innerRadius: innerRadius,
|
21521
|
+
outerRadius: outerRadius,
|
21522
|
+
startAngle: startAngle,
|
21523
|
+
endAngle: endAngle,
|
21524
|
+
fill: fill
|
21525
|
+
}), /*#__PURE__*/React__default.createElement(Recharts.Sector, {
|
21526
|
+
cx: cx,
|
21527
|
+
cy: cy,
|
21528
|
+
startAngle: startAngle,
|
21529
|
+
endAngle: endAngle,
|
21530
|
+
innerRadius: outerRadius + 2,
|
21531
|
+
outerRadius: outerRadius + HOVER_DONUT_WIDTH,
|
21532
|
+
fill: id !== undefined ? (_getThemeColor = getThemeColor(pieColors[id])) !== null && _getThemeColor !== void 0 ? _getThemeColor : getThemeColor('blue-500') : getThemeColor('blue-500'),
|
21533
|
+
opacity: 0.3
|
21534
|
+
}));
|
21535
|
+
};
|
21536
|
+
|
21537
|
+
const Segment = _ => null;
|
21538
|
+
const DonutChart = function DonutChart({
|
21539
|
+
children,
|
21540
|
+
formatter,
|
21541
|
+
onClick,
|
21542
|
+
showLegend = false,
|
21543
|
+
legendPosition = 'bottom',
|
21544
|
+
label
|
21545
|
+
}) {
|
21546
|
+
const ref = React__default.useRef(null);
|
21547
|
+
const [radius, setRadius] = React__default.useState(0);
|
21548
|
+
const [hoveredItem, setHoveredItem] = React__default.useState([]);
|
21549
|
+
// used for right legends
|
21550
|
+
const [selectedItem, setSelectedItem] = React__default.useState([]);
|
21551
|
+
// used for bottom legends
|
21552
|
+
const [visibleItems, setVisibleItems] = React__default.useState(() => {
|
21553
|
+
const keys = {};
|
21554
|
+
React__default.Children.forEach(children, child => {
|
21555
|
+
keys[child.props.id] = true;
|
21556
|
+
});
|
21557
|
+
return keys;
|
21558
|
+
});
|
21559
|
+
React__default.useEffect(() => {
|
21560
|
+
if (ref.current) {
|
21561
|
+
var _ref$current$parentEl;
|
21562
|
+
const rect = (_ref$current$parentEl = ref.current.parentElement) === null || _ref$current$parentEl === void 0 ? void 0 : _ref$current$parentEl.getBoundingClientRect();
|
21563
|
+
if (rect) {
|
21564
|
+
const width = showLegend ? rect.width / 2 : rect.width;
|
21565
|
+
const max = rect.height < width ? rect.height : width;
|
21566
|
+
setRadius(max / 2);
|
21567
|
+
}
|
21568
|
+
}
|
21569
|
+
}, [showLegend]);
|
21570
|
+
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
|
21571
|
+
const data = React__default.Children.map(children, child => ({
|
21572
|
+
id: child.props.id,
|
21573
|
+
color: child.props.color,
|
21574
|
+
label: child.props.label,
|
21575
|
+
value: child.props.value
|
21576
|
+
}));
|
21577
|
+
const displayedData = data.filter(child => visibleItems[child.id]);
|
21578
|
+
const total = displayedData.reduce((accum, entry) => accum + entry.value, 0);
|
21579
|
+
const showTooltip = (!showLegend || legendPosition === 'bottom') && displayedData.length > 0;
|
21580
|
+
const handleLegendClick = entry => {
|
21581
|
+
if (legendPosition === 'bottom' && !Array.isArray(entry)) {
|
21582
|
+
setVisibleItems({
|
21583
|
+
...visibleItems,
|
21584
|
+
[entry.id]: !visibleItems[entry.id]
|
21585
|
+
});
|
21586
|
+
} else {
|
21587
|
+
const nextSelectedItem = Array.isArray(entry) ? entry.map(entryItem => entryItem.id) : [entry.id];
|
21588
|
+
// Using slice to avoid mutation of the react state 'selectedItem'
|
21589
|
+
const isCurrentSegmentActive = selectedItem.slice().sort().join(',') === nextSelectedItem.sort().join(',');
|
21590
|
+
if (onClick && !isCurrentSegmentActive) {
|
21591
|
+
onClick(entry);
|
21592
|
+
}
|
21593
|
+
setSelectedItem(isCurrentSegmentActive ? [] : nextSelectedItem);
|
21594
|
+
}
|
21595
|
+
};
|
21596
|
+
const handlePieClick = React__default.useCallback(pieId => {
|
21597
|
+
if (onClick && pieId !== undefined) {
|
21598
|
+
const pieProps = displayedData.find(item => item.id === pieId);
|
21599
|
+
onClick(pieProps);
|
21600
|
+
}
|
21601
|
+
}, [onClick, displayedData]);
|
21602
|
+
const singlePieDonutChart = displayedData.length === 1;
|
21603
|
+
const activeShapeColor = React__default.useMemo(() => {
|
21604
|
+
const getSegmentColor = item => item.reduce((colors, itemId) => {
|
21605
|
+
const visibleHoveredItem = displayedData.find(dataItem => dataItem.id === itemId);
|
21606
|
+
if (visibleHoveredItem) {
|
21607
|
+
colors[visibleHoveredItem.id] = visibleHoveredItem.color;
|
21608
|
+
}
|
21609
|
+
return colors;
|
21610
|
+
}, {});
|
21611
|
+
const hoveredSegmentColor = getSegmentColor(hoveredItem);
|
21612
|
+
const selectedSegmentColor = getSegmentColor(selectedItem);
|
21613
|
+
return legendPosition === 'bottom' || hoveredItem.length !== 0 ? hoveredSegmentColor : selectedSegmentColor;
|
21614
|
+
}, [hoveredItem, selectedItem, legendPosition]);
|
21615
|
+
if (ref.current && !radius) {
|
21616
|
+
return null;
|
21617
|
+
}
|
21618
|
+
const getActiveIndex = () => {
|
21619
|
+
if (hoveredItem.length > 0) {
|
21620
|
+
return hoveredItem.map(itemId => displayedData.findIndex(element => element.id === itemId));
|
21621
|
+
}
|
21622
|
+
return selectedItem.map(selectedItemId => displayedData.findIndex(element => element.id === selectedItemId));
|
21623
|
+
};
|
21624
|
+
const content = () => {
|
21625
|
+
const elements = React__default.Children.toArray(children).filter(child => /*#__PURE__*/React__default.isValidElement(child) && visibleItems[child.props.id]);
|
21626
|
+
return elements.length > 0 ? elements.map((child, index) => {
|
21627
|
+
var _getThemeColor;
|
21628
|
+
return /*#__PURE__*/React__default.createElement(Recharts.Cell, {
|
21629
|
+
key: `cell-${index}`,
|
21630
|
+
name: child.props.label,
|
21631
|
+
fill: (_getThemeColor = getThemeColor(child.props.color)) !== null && _getThemeColor !== void 0 ? _getThemeColor : getThemeColor('blue-300')
|
21632
|
+
});
|
21633
|
+
}) : (/*#__PURE__*/React__default.createElement(Recharts.Cell, {
|
21634
|
+
key: "empty-chart",
|
21635
|
+
name: '',
|
21636
|
+
fill: getThemeColor('grey-200')
|
21637
|
+
}));
|
21638
|
+
};
|
21639
|
+
return /*#__PURE__*/React__default.createElement("div", {
|
21640
|
+
className: cn('relative h-full w-full', {
|
21641
|
+
[`flex `]: showLegend,
|
21642
|
+
'flex-col items-center': legendPosition === 'bottom'
|
21643
|
+
}),
|
21644
|
+
ref: ref
|
21645
|
+
}, /*#__PURE__*/React__default.createElement(CenteredLabel, {
|
21646
|
+
radius: radius,
|
21647
|
+
legendPosition: legendPosition,
|
21648
|
+
label: label,
|
21649
|
+
total: total,
|
21650
|
+
formatter: formatter,
|
21651
|
+
showLegend: showLegend
|
21652
|
+
}), /*#__PURE__*/React__default.createElement(Recharts.PieChart, {
|
21653
|
+
data: data,
|
21654
|
+
height: diameter,
|
21655
|
+
width: diameter,
|
21656
|
+
style: {
|
21657
|
+
transform: 'rotate(90deg) scale(-1,1)'
|
21658
|
+
}
|
21659
|
+
}, showTooltip ? (/*#__PURE__*/React__default.createElement(Recharts.Tooltip, Object.assign({}, getTooltipProps({
|
21660
|
+
style: {
|
21661
|
+
transform: 'rotate(90deg) scale(-1,1)'
|
21662
|
+
},
|
21663
|
+
singlePieDonutChart
|
21664
|
+
})))) : null, /*#__PURE__*/React__default.createElement(Recharts.Pie, {
|
21665
|
+
isAnimationActive: false,
|
21666
|
+
activeIndex: getActiveIndex(),
|
21667
|
+
activeShape: /*#__PURE__*/React__default.createElement(ActiveShape, {
|
21668
|
+
pieColors: activeShapeColor,
|
21669
|
+
onClick: handlePieClick
|
21670
|
+
}),
|
21671
|
+
data: displayedData.length > 0 ? displayedData : [],
|
21672
|
+
dataKey: "value",
|
21673
|
+
innerRadius: radius - HOVER_DONUT_WIDTH - DONUT_WIDTH,
|
21674
|
+
onMouseEnter: segment => displayedData.length > 0 && setHoveredItem([segment.id]),
|
21675
|
+
onMouseLeave: () => setHoveredItem([]),
|
21676
|
+
outerRadius: radius - HOVER_DONUT_WIDTH,
|
21677
|
+
paddingAngle: 2,
|
21678
|
+
// Prevents the pie group element from being focusable
|
21679
|
+
rootTabIndex: -1
|
21680
|
+
}, content())), showLegend && (/*#__PURE__*/React__default.createElement(Legend$1, {
|
21681
|
+
data: data,
|
21682
|
+
visibleItems: visibleItems,
|
21683
|
+
onClick: handleLegendClick,
|
21684
|
+
total: total,
|
21685
|
+
setHoveredItem: setHoveredItem,
|
21686
|
+
label: label,
|
21687
|
+
legendPosition: legendPosition,
|
21688
|
+
hoveredItem: hoveredItem,
|
21689
|
+
selectedItem: selectedItem,
|
21690
|
+
formatter: formatter
|
21691
|
+
})));
|
21692
|
+
};
|
21693
|
+
DonutChart.Segment = Segment;
|
21694
|
+
|
21695
|
+
const Line$1 = _ => null;
|
21696
|
+
const LineChart = function LineChart(externalProps) {
|
21697
|
+
const {
|
21698
|
+
children,
|
21699
|
+
data,
|
21700
|
+
formatter,
|
21701
|
+
...props
|
21702
|
+
} = externalProps;
|
21703
|
+
const [hoveredLine, setHoveredLine] = React.useState(null);
|
21704
|
+
const [activeLines, setActiveLines] = React.useState(() => {
|
21705
|
+
const keys = {};
|
21706
|
+
React__default.Children.forEach(children, child => {
|
21707
|
+
keys[child.props.accessor] = true;
|
21708
|
+
});
|
21709
|
+
return keys;
|
21710
|
+
});
|
21711
|
+
const handleLegendClick = entry => {
|
21712
|
+
setHoveredLine(null);
|
21713
|
+
setActiveLines({
|
21714
|
+
...activeLines,
|
21715
|
+
[entry.dataKey]: !activeLines[entry.dataKey]
|
21716
|
+
});
|
21717
|
+
};
|
21718
|
+
return /*#__PURE__*/React__default.createElement(ResponsiveContainer, null, /*#__PURE__*/React__default.createElement(Recharts.LineChart, {
|
21719
|
+
data: data,
|
21720
|
+
margin: {
|
21721
|
+
top: 10,
|
21722
|
+
right: 0,
|
21723
|
+
left: -25,
|
21724
|
+
bottom: 0
|
21725
|
+
}
|
21726
|
+
}, /*#__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({
|
21727
|
+
onClick: handleLegendClick,
|
21728
|
+
onMouseEnter: entry => setHoveredLine(entry.dataKey),
|
21729
|
+
onMouseLeave: () => setHoveredLine(null),
|
21730
|
+
activeItems: activeLines
|
21731
|
+
}))), /*#__PURE__*/React__default.createElement(Recharts.Tooltip, Object.assign({}, getTooltipProps(), {
|
21732
|
+
formatter: formatter
|
21733
|
+
})), React__default.Children.map(children, child => {
|
21734
|
+
var _child$props$color, _child$props$color2;
|
21735
|
+
return /*#__PURE__*/React__default.createElement(Recharts.Line, {
|
21736
|
+
activeDot: {
|
21737
|
+
fill: getThemeColor((_child$props$color = child.props.color) !== null && _child$props$color !== void 0 ? _child$props$color : 'blue-300')
|
21738
|
+
},
|
21739
|
+
dataKey: child.props.accessor,
|
21740
|
+
isAnimationActive: false,
|
21741
|
+
dot: false,
|
21742
|
+
name: child.props.label,
|
21743
|
+
stroke: getThemeColor((_child$props$color2 = child.props.color) !== null && _child$props$color2 !== void 0 ? _child$props$color2 : 'blue-300'),
|
21744
|
+
strokeWidth: 2,
|
21745
|
+
hide: !activeLines[child.props.accessor],
|
21746
|
+
opacity: hoveredLine && child.props.accessor !== hoveredLine ? 0.3 : 1
|
21747
|
+
});
|
21748
|
+
})));
|
21749
|
+
};
|
21750
|
+
LineChart.Line = Line$1;
|
21751
|
+
|
20456
21752
|
const Button$4 = /*#__PURE__*/React__default.forwardRef(function Button(props, ref) {
|
20457
21753
|
const {
|
20458
21754
|
...attributes
|
@@ -20725,15 +22021,13 @@ const AgreementDisplay = props => {
|
|
20725
22021
|
}));
|
20726
22022
|
};
|
20727
22023
|
|
20728
|
-
const Container$1 =
|
20729
|
-
children
|
20730
|
-
}) => {
|
22024
|
+
const Container$1 = props => {
|
20731
22025
|
return /*#__PURE__*/React__default.createElement("div", {
|
20732
22026
|
className: "-ml-2 flex flex-shrink-0 flex-grow-0 items-center gap-2 pr-2 xl:ml-auto xl:w-64",
|
20733
22027
|
"data-taco": "header-agreements"
|
20734
22028
|
}, /*#__PURE__*/React__default.createElement("span", {
|
20735
22029
|
className: "hidden h-8 w-px flex-shrink-0 flex-grow-0 bg-white/[0.3] xl:flex"
|
20736
|
-
}), children);
|
22030
|
+
}), props.children);
|
20737
22031
|
};
|
20738
22032
|
function AgreementSelector(props) {
|
20739
22033
|
const {
|
@@ -21166,6 +22460,223 @@ Navigation2.Link = Link$3;
|
|
21166
22460
|
Navigation2.Section = Section;
|
21167
22461
|
Navigation2.Content = Content$a;
|
21168
22462
|
|
22463
|
+
const DATASET_SIZE_MULTIPLIER = 15;
|
22464
|
+
function useTableDataLoader2(fetchPage, fetchAll, options = {
|
22465
|
+
pageSize: DEFAULT_PAGE_SIZE
|
22466
|
+
}) {
|
22467
|
+
const loadPage = function (pageIndex, sorting, filters, hiddenColumns, search, reset = false) {
|
22468
|
+
try {
|
22469
|
+
// if a request is already pending for this page (and it's not a reset), skip it
|
22470
|
+
if (_pendingPageRequests.current[pageIndex] && !reset) {
|
22471
|
+
return Promise.resolve();
|
22472
|
+
}
|
22473
|
+
const hasChangedData = JSON.stringify(sorting) !== JSON.stringify(_lastUsedSorting.current) || JSON.stringify(filters) !== JSON.stringify(_lastUsedFilters.current) || search !== _lastUsedSearch.current;
|
22474
|
+
// if the page is already loaded and has actual rows, abort
|
22475
|
+
if (data.cache[pageIndex] && data.cache[pageIndex][0] && !hasChangedData && !reset) {
|
22476
|
+
return Promise.resolve();
|
22477
|
+
}
|
22478
|
+
// create an id to track the update
|
22479
|
+
const requestId = uuid.v4();
|
22480
|
+
// set the page as loading, so that subsequent requests don't retrigger it
|
22481
|
+
_pendingPageRequests.current[pageIndex] = true;
|
22482
|
+
const _temp2 = _catch(function () {
|
22483
|
+
_lastRequestId.current = requestId;
|
22484
|
+
return Promise.resolve(fetchPage(pageIndex, pageSize, sorting, filters, hiddenColumns, search)).then(function (response) {
|
22485
|
+
length.current = response.length;
|
22486
|
+
// update state, here we do some "magic" to support "load in place"
|
22487
|
+
setData(currentData => {
|
22488
|
+
// if this request wasn't the last one, just return the current state to prevent weird updates
|
22489
|
+
if (_lastRequestId.current !== requestId) {
|
22490
|
+
return currentData;
|
22491
|
+
}
|
22492
|
+
const direction = getDirection(pageIndex, currentData.pages);
|
22493
|
+
const nextPages = getPages(pageIndex, currentData.lastFetchedPage, reset ? [] : currentData.pages, direction);
|
22494
|
+
// set values so we can track if they changed between loads
|
22495
|
+
_lastUsedSorting.current = sorting;
|
22496
|
+
_lastUsedFilters.current = filters;
|
22497
|
+
_lastUsedSearch.current = search;
|
22498
|
+
_lastUsedHiddenColumns.current = hiddenColumns;
|
22499
|
+
// cache data as an object to prevent any duplicates for pages
|
22500
|
+
let nextCache;
|
22501
|
+
if (reset || hasChangedData || !direction) {
|
22502
|
+
nextCache = nextPages.reduce((acc, p) => ({
|
22503
|
+
...acc,
|
22504
|
+
[p]: Array(pageSize).fill(undefined)
|
22505
|
+
}), {});
|
22506
|
+
} else {
|
22507
|
+
nextCache = {
|
22508
|
+
...currentData.cache
|
22509
|
+
};
|
22510
|
+
}
|
22511
|
+
nextCache[pageIndex] = response.data;
|
22512
|
+
// cleanup "unloaded" pages
|
22513
|
+
if (direction === 'forward' && currentData.rows.length >= DATASET_SIZE) {
|
22514
|
+
delete nextCache[currentData.pages[0]];
|
22515
|
+
} else if (direction === 'backward' && currentData.rows.length >= DATASET_SIZE) {
|
22516
|
+
delete nextCache[currentData.pages[currentData.pages.length - 1]];
|
22517
|
+
}
|
22518
|
+
// remap rows from the cached data - do it here and not in render to save some performance
|
22519
|
+
const rows = Object.values(nextCache).reduce((acc, p) => acc.concat(p), []);
|
22520
|
+
return {
|
22521
|
+
cache: nextCache,
|
22522
|
+
pages: nextPages,
|
22523
|
+
rows: rows,
|
22524
|
+
lastFetchedPage: pageIndex
|
22525
|
+
};
|
22526
|
+
});
|
22527
|
+
// reset pending requests
|
22528
|
+
delete _pendingPageRequests.current[pageIndex];
|
22529
|
+
});
|
22530
|
+
}, function () {});
|
22531
|
+
return Promise.resolve(_temp2 && _temp2.then ? _temp2.then(function () {}) : void 0);
|
22532
|
+
} catch (e) {
|
22533
|
+
return Promise.reject(e);
|
22534
|
+
}
|
22535
|
+
};
|
22536
|
+
const {
|
22537
|
+
pageSize
|
22538
|
+
} = options;
|
22539
|
+
const DATASET_SIZE = DATASET_SIZE_MULTIPLIER * pageSize;
|
22540
|
+
// track the data length, we don't know it until the first request
|
22541
|
+
const length = React__default.useRef(0);
|
22542
|
+
// data will be filled after the first request
|
22543
|
+
const [data, setData] = React__default.useState({
|
22544
|
+
rows: [],
|
22545
|
+
pages: [],
|
22546
|
+
cache: {},
|
22547
|
+
lastFetchedPage: undefined
|
22548
|
+
});
|
22549
|
+
// track which pages have been loaded to dedupe requests
|
22550
|
+
const _pendingPageRequests = React__default.useRef({});
|
22551
|
+
// it's possible to spam updates, e.g. sort, so we don't set state if the last request wasn't the current oen
|
22552
|
+
const _lastRequestId = React__default.useRef();
|
22553
|
+
// store last used properties
|
22554
|
+
const _lastUsedSorting = React__default.useRef([]);
|
22555
|
+
const _lastUsedFilters = React__default.useRef([]);
|
22556
|
+
const _lastUsedSearch = React__default.useRef();
|
22557
|
+
const _lastUsedHiddenColumns = React__default.useRef([]);
|
22558
|
+
const loadAll = function (sorting, filters, hiddenColumns, search) {
|
22559
|
+
try {
|
22560
|
+
// set values so we can track if they changed between loads
|
22561
|
+
_lastUsedSorting.current = sorting;
|
22562
|
+
_lastUsedFilters.current = filters;
|
22563
|
+
_lastUsedSearch.current = search;
|
22564
|
+
_lastUsedHiddenColumns.current = hiddenColumns;
|
22565
|
+
const _temp = _finallyRethrows(function () {
|
22566
|
+
return _catch(function () {
|
22567
|
+
return Promise.resolve(fetchAll(sorting, filters, hiddenColumns, search)).then(function (response) {
|
22568
|
+
length.current = response.length;
|
22569
|
+
const pages = [];
|
22570
|
+
const cache = {};
|
22571
|
+
const pageCount = Math.ceil(response.length / pageSize);
|
22572
|
+
Array.from(Array(pageCount).keys()).forEach(index => {
|
22573
|
+
pages.push(index);
|
22574
|
+
const startIndex = index * pageSize;
|
22575
|
+
cache[index] = response.data.slice(startIndex, startIndex + pageSize);
|
22576
|
+
});
|
22577
|
+
setData({
|
22578
|
+
cache,
|
22579
|
+
pages,
|
22580
|
+
rows: response.data,
|
22581
|
+
lastFetchedPage: undefined
|
22582
|
+
});
|
22583
|
+
});
|
22584
|
+
}, function () {});
|
22585
|
+
}, function (_wasThrown, _result) {
|
22586
|
+
// reset pending requests
|
22587
|
+
_pendingPageRequests.current = {};
|
22588
|
+
if (_wasThrown) throw _result;
|
22589
|
+
return _result;
|
22590
|
+
});
|
22591
|
+
return Promise.resolve(_temp && _temp.then ? _temp.then(function () {}) : void 0);
|
22592
|
+
} catch (e) {
|
22593
|
+
return Promise.reject(e);
|
22594
|
+
}
|
22595
|
+
};
|
22596
|
+
const invalidate = function () {
|
22597
|
+
try {
|
22598
|
+
// reset stuff
|
22599
|
+
_pendingPageRequests.current = {};
|
22600
|
+
// load the current page again
|
22601
|
+
return loadPage(getCurrentPage(data.pages), _lastUsedSorting.current, _lastUsedFilters.current, _lastUsedHiddenColumns.current, _lastUsedSearch.current, true);
|
22602
|
+
} catch (e) {
|
22603
|
+
return Promise.reject(e);
|
22604
|
+
}
|
22605
|
+
};
|
22606
|
+
const handleSort = function (sorting) {
|
22607
|
+
try {
|
22608
|
+
// reset before loading the current page
|
22609
|
+
_pendingPageRequests.current = {};
|
22610
|
+
return loadPage(getCurrentPage(data.pages), sorting, _lastUsedFilters.current, _lastUsedHiddenColumns.current, _lastUsedSearch.current, true);
|
22611
|
+
} catch (e) {
|
22612
|
+
return Promise.reject(e);
|
22613
|
+
}
|
22614
|
+
};
|
22615
|
+
const handleFilter = function (filters, hiddenColumns) {
|
22616
|
+
try {
|
22617
|
+
// reset before loading the current page
|
22618
|
+
_pendingPageRequests.current = {};
|
22619
|
+
return loadPage(0, _lastUsedSorting.current, filters, hiddenColumns, _lastUsedSearch.current, true);
|
22620
|
+
} catch (e) {
|
22621
|
+
return Promise.reject(e);
|
22622
|
+
}
|
22623
|
+
};
|
22624
|
+
const handleSearch = function (search, hiddenColumns) {
|
22625
|
+
try {
|
22626
|
+
// reset before loading the current page
|
22627
|
+
_pendingPageRequests.current = {};
|
22628
|
+
return loadPage(0, _lastUsedSorting.current, _lastUsedFilters.current, hiddenColumns, search, true);
|
22629
|
+
} catch (e) {
|
22630
|
+
return Promise.reject(e);
|
22631
|
+
}
|
22632
|
+
};
|
22633
|
+
return [{
|
22634
|
+
data: data.rows,
|
22635
|
+
pages: data.pages,
|
22636
|
+
length: length.current,
|
22637
|
+
loadAll,
|
22638
|
+
loadPage,
|
22639
|
+
onChangeFilter: handleFilter,
|
22640
|
+
onChangeSearch: handleSearch,
|
22641
|
+
onChangeSort: handleSort,
|
22642
|
+
pageSize,
|
22643
|
+
_experimentalDataLoader2: true
|
22644
|
+
}, invalidate];
|
22645
|
+
}
|
22646
|
+
function getCurrentPage(currentPages) {
|
22647
|
+
if (currentPages.length <= 2) {
|
22648
|
+
return currentPages[0];
|
22649
|
+
}
|
22650
|
+
// for even page lengths we can't know which is the current visible page - it could even be both
|
22651
|
+
// so we load one of them and rely on the "load next/previous page" functionality in row
|
22652
|
+
const middle = Math.floor(currentPages.length / 2);
|
22653
|
+
return currentPages[middle];
|
22654
|
+
}
|
22655
|
+
function getDirection(pageIndex, currentPages) {
|
22656
|
+
if (currentPages.length) {
|
22657
|
+
if (pageIndex === currentPages[currentPages.length - 1] + 1) {
|
22658
|
+
return 'forward';
|
22659
|
+
} else if (pageIndex === currentPages[0] - 1 || currentPages.length === 2 && currentPages[0] !== 0 && pageIndex === currentPages[0]) {
|
22660
|
+
return 'backward';
|
22661
|
+
}
|
22662
|
+
}
|
22663
|
+
return undefined;
|
22664
|
+
}
|
22665
|
+
function getPages(pageIndex, lastUsedPageIndex, currentPages, direction) {
|
22666
|
+
if (currentPages.length && (pageIndex === lastUsedPageIndex || currentPages.includes(pageIndex))) {
|
22667
|
+
return currentPages;
|
22668
|
+
}
|
22669
|
+
if (direction === 'forward') {
|
22670
|
+
const nextPages = currentPages.length === DATASET_SIZE_MULTIPLIER ? currentPages.slice(1) : currentPages;
|
22671
|
+
return nextPages.concat(pageIndex);
|
22672
|
+
}
|
22673
|
+
if (direction === 'backward') {
|
22674
|
+
const nextPages = currentPages.length === DATASET_SIZE_MULTIPLIER ? currentPages.slice(0, -1) : currentPages;
|
22675
|
+
return [pageIndex].concat(nextPages);
|
22676
|
+
}
|
22677
|
+
return [pageIndex];
|
22678
|
+
}
|
22679
|
+
|
21169
22680
|
const useBoundaryOverflowDetection = (ref, dependencies = []) => {
|
21170
22681
|
const [boundaryIndex, setBoundaryIndex] = React__default.useState();
|
21171
22682
|
const dimensions = useBoundingClientRectListener(ref, dependencies);
|
@@ -21199,10 +22710,12 @@ const useOnClickOutside = (ref, callback) => {
|
|
21199
22710
|
exports.Accordion = Accordion;
|
21200
22711
|
exports.Alert = Alert;
|
21201
22712
|
exports.AlertDialog = AlertDialog;
|
22713
|
+
exports.AreaChart = AreaChart;
|
21202
22714
|
exports.Backdrop = Backdrop;
|
21203
22715
|
exports.Badge = Badge;
|
21204
22716
|
exports.BadgeIcon = BadgeIcon;
|
21205
22717
|
exports.Banner = Banner;
|
22718
|
+
exports.BarChart = BarChart;
|
21206
22719
|
exports.Base = Base;
|
21207
22720
|
exports.Button = Button$1;
|
21208
22721
|
exports.Calendar = Calendar$1;
|
@@ -21213,6 +22726,7 @@ exports.Combobox = Combobox;
|
|
21213
22726
|
exports.DEFAULT_PAGE_SIZE = DEFAULT_PAGE_SIZE;
|
21214
22727
|
exports.Datepicker = Datepicker;
|
21215
22728
|
exports.Dialog = Dialog;
|
22729
|
+
exports.DonutChart = DonutChart;
|
21216
22730
|
exports.Drawer = Drawer;
|
21217
22731
|
exports.Field = Field;
|
21218
22732
|
exports.Form = Form;
|
@@ -21224,6 +22738,7 @@ exports.Icon = Icon;
|
|
21224
22738
|
exports.IconButton = IconButton;
|
21225
22739
|
exports.Input = Input;
|
21226
22740
|
exports.Layout = Layout$1;
|
22741
|
+
exports.LineChart = LineChart;
|
21227
22742
|
exports.List = List$1;
|
21228
22743
|
exports.Listbox = Listbox;
|
21229
22744
|
exports.LocalizationContext = LocalizationContext;
|
@@ -21301,6 +22816,7 @@ exports.useOnClickOutside = useOnClickOutside;
|
|
21301
22816
|
exports.usePagination = usePagination;
|
21302
22817
|
exports.useRadioGroup = useRadioGroup;
|
21303
22818
|
exports.useTableDataLoader = useTableDataLoader;
|
22819
|
+
exports.useTableDataLoader2 = useTableDataLoader2;
|
21304
22820
|
exports.useTableRowCreation = useTableRowCreation;
|
21305
22821
|
exports.useToast = useToast;
|
21306
22822
|
//# sourceMappingURL=taco.cjs.development.js.map
|