@economic/taco 2.45.0-alpha.2 → 2.45.0-alpha.25
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/Combobox/Combobox.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/Content.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/Menu/components/SubMenu.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/Select/Select.d.ts +5 -19
- 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/Columns/Internal/EditingActionsMenu.d.ts +2 -2
- 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 +74 -12
- 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/Button/util.js +1 -1
- package/dist/esm/packages/taco/src/components/Button/util.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/Combobox.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Combobox/useCombobox.js +18 -17
- 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 +0 -9
- 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 +25 -9
- 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 +4 -3
- 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 -37
- 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/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 +70 -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 +16 -5
- 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/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 +7 -5
- 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/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/Cell/BuiltIns/GroupedCell.js +23 -16
- package/dist/esm/packages/taco/src/primitives/Table/Core/components/Columns/Cell/BuiltIns/GroupedCell.js.map +1 -1
- package/dist/esm/packages/taco/src/primitives/Table/Core/components/Columns/Internal/Actions.js +6 -4
- 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 +7 -2
- 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/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 +5 -2
- 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 +5 -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 +16 -4
- 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 +74 -12
- 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/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 +18 -14
- 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/util/columns.d.ts +2 -1
- package/dist/primitives/Table/useTableManager/util/dataTypes.d.ts +1 -1
- package/dist/taco.cjs.development.js +1988 -512
- 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 +14 -13
- package/tailwind.colors.js +121 -0
- package/tailwind.config.js +3 -2
- package/dist/components/Table3/components/Row/Editing/CreateRowButton.d.ts +0 -11
@@ -31,12 +31,12 @@ var reactPortal = require('@radix-ui/react-portal');
|
|
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,18 +4487,18 @@ 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
|
|
4387
4500
|
const getButtonClasses = () => {
|
4388
|
-
return 'flex-shrink-0 min-h-[theme(spacing.8)] min-w-[theme(spacing.8)] gap-1 h-max leading-5 inline-flex items-center justify-center focus-visible:yt-focus aria-disabled:cursor-not-allowed';
|
4501
|
+
return 'flex-shrink-0 min-h-[theme(spacing.8)] min-w-[theme(spacing.8)] gap-1 h-max leading-5 inline-flex items-center justify-center focus-visible:yt-focus data-[state=instant-open]:yt-focus aria-disabled:cursor-not-allowed';
|
4389
4502
|
};
|
4390
4503
|
const getAppearanceClasses = (value, icon = false) => {
|
4391
4504
|
switch (value) {
|
@@ -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;
|
@@ -5897,7 +6006,7 @@ const useCombobox = ({
|
|
5897
6006
|
if (index !== undefined) {
|
5898
6007
|
const option = data[index];
|
5899
6008
|
if (option && !option.disabled) {
|
5900
|
-
|
6009
|
+
handleChange(option.value);
|
5901
6010
|
}
|
5902
6011
|
}
|
5903
6012
|
};
|
@@ -5919,7 +6028,7 @@ const useCombobox = ({
|
|
5919
6028
|
if (defaultValue && !value) {
|
5920
6029
|
setInputValueByIndex(getIndexFromValue(data, defaultValue));
|
5921
6030
|
}
|
5922
|
-
}, [
|
6031
|
+
}, [defaultValue]);
|
5923
6032
|
// update input value if it changed 'externally', e.g. clicking/entering an item in the listbox, from a modal etc
|
5924
6033
|
React.useEffect(() => {
|
5925
6034
|
if (value !== undefined && value !== inputValue) {
|
@@ -5954,22 +6063,27 @@ const useCombobox = ({
|
|
5954
6063
|
setCurrentIndex(undefined);
|
5955
6064
|
}
|
5956
6065
|
}, [open]);
|
6066
|
+
const handleChange = nextValue => {
|
6067
|
+
//const event = createCustomEvent('change');
|
6068
|
+
if (onChange && nextValue !== String(value)) {
|
6069
|
+
const item = findByValue(flattenedData, nextValue);
|
6070
|
+
const sanitizedItem = sanitizeItem(item);
|
6071
|
+
onChange(sanitizedItem === null || sanitizedItem === void 0 ? void 0 : sanitizedItem.value);
|
6072
|
+
}
|
6073
|
+
};
|
5957
6074
|
// event handlers
|
5958
6075
|
const handleInputBlur = event => {
|
5959
|
-
event.persist();
|
5960
6076
|
if (listRef.current && event.relatedTarget === listRef.current) {
|
5961
6077
|
event.preventDefault();
|
5962
6078
|
return;
|
5963
6079
|
}
|
5964
|
-
//
|
5965
|
-
if (
|
5966
|
-
|
5967
|
-
|
5968
|
-
|
5969
|
-
|
5970
|
-
|
5971
|
-
}
|
5972
|
-
onChange(event);
|
6080
|
+
// listbox is open
|
6081
|
+
if (currentIndex !== undefined) {
|
6082
|
+
setCurrentValue(currentIndex);
|
6083
|
+
} else if (inputValue !== value) {
|
6084
|
+
handleChange(inputValue);
|
6085
|
+
} else if (inputValue === '') {
|
6086
|
+
handleChange(undefined);
|
5973
6087
|
}
|
5974
6088
|
if (props.onBlur) {
|
5975
6089
|
props.onBlur(event);
|
@@ -5983,12 +6097,10 @@ const useCombobox = ({
|
|
5983
6097
|
setOpen(true);
|
5984
6098
|
}
|
5985
6099
|
if (onClick) {
|
5986
|
-
event.persist();
|
5987
6100
|
onClick(event);
|
5988
6101
|
}
|
5989
6102
|
};
|
5990
6103
|
const handleInputKeyDown = event => {
|
5991
|
-
event.persist();
|
5992
6104
|
if (!event.ctrlKey && !event.metaKey) {
|
5993
6105
|
switch (event.key) {
|
5994
6106
|
case 'Backspace':
|
@@ -6004,7 +6116,6 @@ const useCombobox = ({
|
|
6004
6116
|
}
|
6005
6117
|
case 'Tab':
|
6006
6118
|
{
|
6007
|
-
setCurrentValue(currentIndex);
|
6008
6119
|
setOpen(false);
|
6009
6120
|
return;
|
6010
6121
|
}
|
@@ -6057,7 +6168,6 @@ const useCombobox = ({
|
|
6057
6168
|
}
|
6058
6169
|
}
|
6059
6170
|
if (!event.isDefaultPrevented() && onKeyDown) {
|
6060
|
-
event.persist();
|
6061
6171
|
onKeyDown(event);
|
6062
6172
|
}
|
6063
6173
|
};
|
@@ -6292,6 +6402,12 @@ const useDatepicker = ({
|
|
6292
6402
|
setInternalValue(formattedValue !== null && formattedValue !== void 0 ? formattedValue : '');
|
6293
6403
|
}
|
6294
6404
|
}, [value]);
|
6405
|
+
const isDisabledDay = React.useMemo(() => {
|
6406
|
+
if (originalValueAsDate && calendar !== null && calendar !== void 0 && calendar.disabledDays) {
|
6407
|
+
return reactDayPicker.isMatch(originalValueAsDate, calendar === null || calendar === void 0 ? void 0 : calendar.disabledDays); // can happen if you type a disabled date in input.
|
6408
|
+
}
|
6409
|
+
return false;
|
6410
|
+
}, [originalValueAsDate]);
|
6295
6411
|
// event handlers
|
6296
6412
|
const handleInputBlur = event => {
|
6297
6413
|
event.persist();
|
@@ -6313,6 +6429,7 @@ const useDatepicker = ({
|
|
6313
6429
|
setInternalValue(event.target.value);
|
6314
6430
|
};
|
6315
6431
|
const handleChange = date => {
|
6432
|
+
// Update both the input value and calendar view date when selecting a date
|
6316
6433
|
setInputValueByRef(inputRef.current, format(date, formatting.date), 'focusout');
|
6317
6434
|
};
|
6318
6435
|
const handleKeyDown = event => {
|
@@ -6328,6 +6445,7 @@ const useDatepicker = ({
|
|
6328
6445
|
const inputProps = {
|
6329
6446
|
...props,
|
6330
6447
|
autoComplete: 'off',
|
6448
|
+
invalid: props.invalid || isDisabledDay,
|
6331
6449
|
onBlur: handleInputBlur,
|
6332
6450
|
onChange: handleInputChange,
|
6333
6451
|
onKeyDown: handleKeyDown,
|
@@ -6497,11 +6615,24 @@ const Datepicker = /*#__PURE__*/React.forwardRef(function Datepicker(props, ref)
|
|
6497
6615
|
e.preventDefault();
|
6498
6616
|
(_input$ref$current = input.ref.current) === null || _input$ref$current === void 0 ? void 0 : _input$ref$current.focus();
|
6499
6617
|
}, [input.ref]);
|
6618
|
+
// Allow preventing default keyDown behaviour if consumer (in our internal case it's Table3) wants to handle it.
|
6619
|
+
// We need to have this option for the situations, when Datepicker is used as inline edititng control in Table3,
|
6620
|
+
// without it, datepicker cannot be set into detailed editing mode by pressing "Enter",
|
6621
|
+
// because input.onKeydown is triggering 'focusout', which resets the detailed edititng mode.
|
6622
|
+
const handleInputKeyDown = event => {
|
6623
|
+
var _props$onKeyDown;
|
6624
|
+
(_props$onKeyDown = props.onKeyDown) === null || _props$onKeyDown === void 0 ? void 0 : _props$onKeyDown.call(props, event);
|
6625
|
+
if (!event.defaultPrevented) {
|
6626
|
+
var _input$onKeyDown;
|
6627
|
+
(_input$onKeyDown = input.onKeyDown) === null || _input$onKeyDown === void 0 ? void 0 : _input$onKeyDown.call(input, event);
|
6628
|
+
}
|
6629
|
+
};
|
6500
6630
|
return /*#__PURE__*/React.createElement("span", {
|
6501
6631
|
className: className,
|
6502
6632
|
"data-taco": "datepicker",
|
6503
6633
|
style: style
|
6504
6634
|
}, /*#__PURE__*/React.createElement(Input, Object.assign({}, input, {
|
6635
|
+
onKeyDown: handleInputKeyDown,
|
6505
6636
|
button: input.readOnly ? undefined : (/*#__PURE__*/React.createElement(IconButton, {
|
6506
6637
|
"aria-label": texts.datepicker.expand,
|
6507
6638
|
disabled: input.disabled || input.readOnly,
|
@@ -6680,8 +6811,10 @@ const Content$4 = /*#__PURE__*/React.forwardRef(function DialogContent(props, re
|
|
6680
6811
|
const {
|
6681
6812
|
texts
|
6682
6813
|
} = 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
|
6814
|
+
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');
|
6815
|
+
const containerClassName = cn('bg-white p-6 rounded relative z-10 shadow print:p-0',
|
6816
|
+
// 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.
|
6817
|
+
'print:overflow-visible print:h-max print:!transform-none print:!inset-0 print:!m-0', {
|
6685
6818
|
'rounded-b-none': !!dialog.elements.extra
|
6686
6819
|
}, props.className);
|
6687
6820
|
const handleEscapeKeyDown = event => {
|
@@ -7210,7 +7343,7 @@ const DrawerContent = /*#__PURE__*/React__default.forwardRef(function Content(pr
|
|
7210
7343
|
ref: contentRef,
|
7211
7344
|
"data-taco": "drawer",
|
7212
7345
|
className: containerClassName
|
7213
|
-
}, output, /*#__PURE__*/React__default.createElement("div", Object.assign({
|
7346
|
+
}, /*#__PURE__*/React__default.createElement(React__default.Fragment, null, output, /*#__PURE__*/React__default.createElement("div", Object.assign({
|
7214
7347
|
className: dragHandlerClassName
|
7215
7348
|
}, dragHandleProps, {
|
7216
7349
|
"data-testid": "resize-handler",
|
@@ -7223,7 +7356,7 @@ const DrawerContent = /*#__PURE__*/React__default.forwardRef(function Content(pr
|
|
7223
7356
|
"aria-label": texts.drawer.close,
|
7224
7357
|
className: "absolute right-0 top-0 mr-2 mt-4",
|
7225
7358
|
icon: "close"
|
7226
|
-
}))) : null);
|
7359
|
+
}))) : null));
|
7227
7360
|
const styleProp = {
|
7228
7361
|
...style,
|
7229
7362
|
...{
|
@@ -7440,7 +7573,8 @@ const Title$3 = /*#__PURE__*/React.forwardRef(function DialogTitle(props, ref) {
|
|
7440
7573
|
});
|
7441
7574
|
const Content$6 = /*#__PURE__*/React.forwardRef(function HangerContent(props, ref) {
|
7442
7575
|
const {
|
7443
|
-
placement: side
|
7576
|
+
placement: side,
|
7577
|
+
hideWhenDetached = false
|
7444
7578
|
} = props;
|
7445
7579
|
const context = React.useContext(HangerContext);
|
7446
7580
|
const {
|
@@ -7456,7 +7590,8 @@ const Content$6 = /*#__PURE__*/React.forwardRef(function HangerContent(props, re
|
|
7456
7590
|
onInteractOutside: handleInteractOutside,
|
7457
7591
|
side: side,
|
7458
7592
|
sideOffset: 1,
|
7459
|
-
ref: ref
|
7593
|
+
ref: ref,
|
7594
|
+
hideWhenDetached: hideWhenDetached
|
7460
7595
|
}, props.children, /*#__PURE__*/React.createElement(UnstyledArrow, {
|
7461
7596
|
className: "text-blue-500"
|
7462
7597
|
}), /*#__PURE__*/React.createElement(PopoverPrimitive.Close, {
|
@@ -8222,6 +8357,11 @@ const Content$8 = /*#__PURE__*/React.forwardRef(function MenuContent(props, ref)
|
|
8222
8357
|
if (child.props.shortcut) {
|
8223
8358
|
shortcuts.push(createShortcutKeyDownHandler(child.props.shortcut, event => {
|
8224
8359
|
event.preventDefault();
|
8360
|
+
const dialog = document.querySelector('[role="dialog"]');
|
8361
|
+
// Don't trigger the shortcut if it is outside of the dialog
|
8362
|
+
if (dialog && !(dialog !== null && dialog !== void 0 && dialog.contains(internalRef.current))) {
|
8363
|
+
return;
|
8364
|
+
}
|
8225
8365
|
menu === null || menu === void 0 ? void 0 : menu.open();
|
8226
8366
|
setTimeout(() => {
|
8227
8367
|
var _childrenRefs$current, _childrenRefs$current2;
|
@@ -8296,7 +8436,7 @@ const Shortcut = ({
|
|
8296
8436
|
className: className
|
8297
8437
|
}), texts.map(key => (/*#__PURE__*/React__default.createElement("kbd", {
|
8298
8438
|
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"
|
8439
|
+
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
8440
|
}, key))));
|
8301
8441
|
};
|
8302
8442
|
|
@@ -9364,16 +9504,8 @@ const BaseSelect = /*#__PURE__*/React.forwardRef(function BaseSelect(props, ref)
|
|
9364
9504
|
});
|
9365
9505
|
const Select = /*#__PURE__*/React.forwardRef(function Select(props, ref) {
|
9366
9506
|
const {
|
9367
|
-
editable,
|
9368
9507
|
...otherProps
|
9369
9508
|
} = props;
|
9370
|
-
if (editable) {
|
9371
|
-
return /*#__PURE__*/React.createElement(Combobox, Object.assign({}, otherProps, {
|
9372
|
-
dialog: undefined,
|
9373
|
-
inline: true,
|
9374
|
-
ref: ref
|
9375
|
-
}));
|
9376
|
-
}
|
9377
9509
|
return /*#__PURE__*/React.createElement(BaseSelect, Object.assign({}, otherProps, {
|
9378
9510
|
ref: ref
|
9379
9511
|
}));
|
@@ -9835,12 +9967,9 @@ const fixedForwardRef = React__default.forwardRef;
|
|
9835
9967
|
TableFilterComparator[TableFilterComparator["HasAnyOf"] = 11] = "HasAnyOf";
|
9836
9968
|
TableFilterComparator[TableFilterComparator["HasAllOf"] = 12] = "HasAllOf";
|
9837
9969
|
TableFilterComparator[TableFilterComparator["HasNoneOf"] = 13] = "HasNoneOf";
|
9970
|
+
TableFilterComparator[TableFilterComparator["IsOneOf"] = 14] = "IsOneOf";
|
9971
|
+
TableFilterComparator[TableFilterComparator["IsNoneOf"] = 15] = "IsNoneOf";
|
9838
9972
|
})(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
9973
|
|
9845
9974
|
const dataTypes = {
|
9846
9975
|
auto: {
|
@@ -9878,9 +10007,13 @@ const dataTypes = {
|
|
9878
10007
|
if (value === undefined) {
|
9879
10008
|
return '';
|
9880
10009
|
}
|
9881
|
-
|
10010
|
+
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
10011
|
minimumFractionDigits: 2
|
9883
|
-
})
|
10012
|
+
});
|
10013
|
+
const decimalSeperator = formatter.format(1.1).substring(1, 2);
|
10014
|
+
const localisedValue = formatter.format(Number(value));
|
10015
|
+
const localisedValueWithoutThousandsSeperator = decimalSeperator === '.' ? localisedValue.replace(',', '') : localisedValue.replace('.', '');
|
10016
|
+
return [localisedValue, localisedValueWithoutThousandsSeperator];
|
9884
10017
|
}
|
9885
10018
|
}
|
9886
10019
|
};
|
@@ -10004,6 +10137,12 @@ function columnFilterFn(value, filter) {
|
|
10004
10137
|
return Array.isArray(filter.value) && Array.isArray(value) ? filter.value.every(item => value.includes(item) === false) : false;
|
10005
10138
|
case exports.TableFilterComparator.HasAllOf:
|
10006
10139
|
return Array.isArray(filter.value) && Array.isArray(value) ? filter.value.filter(v => value.includes(v)).length === filter.value.length : false;
|
10140
|
+
case exports.TableFilterComparator.IsOneOf:
|
10141
|
+
if (!Array.isArray(filter.value)) return false;
|
10142
|
+
return filter.value.some(v => isWeakEqual$1(value, v));
|
10143
|
+
case exports.TableFilterComparator.IsNoneOf:
|
10144
|
+
if (!Array.isArray(filter.value)) return false;
|
10145
|
+
return filter.value.every(v => !isWeakEqual$1(value, v));
|
10007
10146
|
}
|
10008
10147
|
return false;
|
10009
10148
|
} catch (e) {
|
@@ -10028,7 +10167,13 @@ function isMatched(searchQuery, cellValue, dataType, localization) {
|
|
10028
10167
|
const cellDisplayValue = dataTypeProperties.getDisplayValue(cellValue, {
|
10029
10168
|
localization
|
10030
10169
|
});
|
10031
|
-
if (
|
10170
|
+
if (Array.isArray(cellDisplayValue)) {
|
10171
|
+
for (const displayValue of cellDisplayValue) {
|
10172
|
+
if (isWeakContains(displayValue, searchQuery)) {
|
10173
|
+
return true;
|
10174
|
+
}
|
10175
|
+
}
|
10176
|
+
} else if (cellDisplayValue !== undefined && isWeakContains(cellDisplayValue, searchQuery)) {
|
10032
10177
|
return true;
|
10033
10178
|
}
|
10034
10179
|
}
|
@@ -10201,6 +10346,9 @@ function unfreezeAllExternalColumns(leftPinnedState) {
|
|
10201
10346
|
function freezeUptoExternalColumn(index, columns) {
|
10202
10347
|
return columns.slice(0, index + 1);
|
10203
10348
|
}
|
10349
|
+
function getHiddenColumns(columnVisibility = {}) {
|
10350
|
+
return Object.keys(columnVisibility).filter(c => columnVisibility[c] === false);
|
10351
|
+
}
|
10204
10352
|
|
10205
10353
|
function getSettings(table) {
|
10206
10354
|
const meta = table.options.meta;
|
@@ -10326,10 +10474,15 @@ function processChildren(child, columns, defaultSizing, defaultSorting, defaultV
|
|
10326
10474
|
column.cell = info => renderer(info.getValue(), info.row.original);
|
10327
10475
|
} else if (dataTypeProperties.getDisplayValue) {
|
10328
10476
|
const dataTypeRenderer = value => {
|
10329
|
-
var _dataTypeProperties$g
|
10330
|
-
|
10477
|
+
var _dataTypeProperties$g;
|
10478
|
+
const displayValue = (_dataTypeProperties$g = dataTypeProperties.getDisplayValue) === null || _dataTypeProperties$g === void 0 ? void 0 : _dataTypeProperties$g.call(dataTypeProperties, value, {
|
10331
10479
|
localization
|
10332
|
-
})
|
10480
|
+
});
|
10481
|
+
if (Array.isArray(displayValue)) {
|
10482
|
+
var _displayValue$;
|
10483
|
+
return (_displayValue$ = displayValue[0]) !== null && _displayValue$ !== void 0 ? _displayValue$ : value;
|
10484
|
+
}
|
10485
|
+
return displayValue !== null && displayValue !== void 0 ? displayValue : value;
|
10333
10486
|
};
|
10334
10487
|
column.cell = info => dataTypeRenderer(info.getValue());
|
10335
10488
|
column.meta.renderer = dataTypeRenderer;
|
@@ -10460,7 +10613,8 @@ function configureReactTableOptions(options, props, localization) {
|
|
10460
10613
|
getExpandedRowModel: reactTable.getExpandedRowModel(),
|
10461
10614
|
getGroupedRowModel: reactTable.getGroupedRowModel(),
|
10462
10615
|
getRowId,
|
10463
|
-
groupedColumnMode: false
|
10616
|
+
groupedColumnMode: false,
|
10617
|
+
keepPinnedRows: false
|
10464
10618
|
};
|
10465
10619
|
if (tableOptions.enableColumnResizing) {
|
10466
10620
|
tableOptions.columnResizeMode = 'onChange';
|
@@ -10482,6 +10636,12 @@ function configureReactTableOptions(options, props, localization) {
|
|
10482
10636
|
var _column$columnDef$met;
|
10483
10637
|
return ((_column$columnDef$met = column.columnDef.meta) === null || _column$columnDef$met === void 0 ? void 0 : _column$columnDef$met.enableSearch) !== false && column.getIsVisible();
|
10484
10638
|
};
|
10639
|
+
// enter controlled search mode (controlled could be local state, but usually the server)
|
10640
|
+
if (props.onChangeSearch) {
|
10641
|
+
if (props._experimentalDataLoader2) {
|
10642
|
+
tableOptions.manualFiltering = true;
|
10643
|
+
}
|
10644
|
+
}
|
10485
10645
|
}
|
10486
10646
|
if (tableOptions.enableSorting) {
|
10487
10647
|
// enter controlled sort mode (controlled could be local state, but usually the server)
|
@@ -10539,6 +10699,7 @@ const DEFAULT_PRESET = {
|
|
10539
10699
|
enableColumnHiding: false,
|
10540
10700
|
enableColumnResizing: false,
|
10541
10701
|
enableRowExpansion: false,
|
10702
|
+
enableRowExpansionAll: true,
|
10542
10703
|
enableRowSelection: false,
|
10543
10704
|
// custom -- common between all table types
|
10544
10705
|
enableColumnOrdering: false,
|
@@ -10565,6 +10726,7 @@ const presets = {
|
|
10565
10726
|
enableColumnHiding: true,
|
10566
10727
|
enableColumnResizing: true,
|
10567
10728
|
enableRowExpansion: true,
|
10729
|
+
enableRowExpansionAll: true,
|
10568
10730
|
enableRowSelection: true,
|
10569
10731
|
// custom -- common between all table types
|
10570
10732
|
enableColumnOrdering: true,
|
@@ -10590,6 +10752,7 @@ const presets = {
|
|
10590
10752
|
enableColumnHiding: false,
|
10591
10753
|
enableColumnResizing: false,
|
10592
10754
|
enableRowExpansion: true,
|
10755
|
+
enableRowExpansionAll: true,
|
10593
10756
|
enableRowSelection: true,
|
10594
10757
|
// custom -- common between all table types
|
10595
10758
|
enableColumnOrdering: false,
|
@@ -10615,6 +10778,7 @@ const presets = {
|
|
10615
10778
|
enableColumnHiding: false,
|
10616
10779
|
enableColumnResizing: false,
|
10617
10780
|
enableRowExpansion: true,
|
10781
|
+
enableRowExpansionAll: true,
|
10618
10782
|
enableRowSelection: false,
|
10619
10783
|
// custom -- common between all table types
|
10620
10784
|
enableColumnOrdering: false,
|
@@ -10632,7 +10796,7 @@ const presets = {
|
|
10632
10796
|
}
|
10633
10797
|
};
|
10634
10798
|
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;
|
10799
|
+
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
10800
|
const presetOptions = props.preset ? presets[props.preset] : DEFAULT_PRESET;
|
10637
10801
|
const enableRowActions = (_props$enableRowActio = props.enableRowActions) !== null && _props$enableRowActio !== void 0 ? _props$enableRowActio : presetOptions.enableRowActions;
|
10638
10802
|
const enableRowClick = (_props$enableRowClick = props.enableRowClick) !== null && _props$enableRowClick !== void 0 ? _props$enableRowClick : presetOptions.enableRowClick;
|
@@ -10640,6 +10804,7 @@ function getTableFeaturePreset(props) {
|
|
10640
10804
|
const enableRowDrop = (_props$enableRowDrop = props.enableRowDrop) !== null && _props$enableRowDrop !== void 0 ? _props$enableRowDrop : presetOptions.enableRowDrop;
|
10641
10805
|
const enableRowGoto = (_props$enableRowGoto = props.enableRowGoto) !== null && _props$enableRowGoto !== void 0 ? _props$enableRowGoto : presetOptions.enableRowGoto;
|
10642
10806
|
const enableRowExpansion = (_props$enableRowExpan = props.enableRowExpansion) !== null && _props$enableRowExpan !== void 0 ? _props$enableRowExpan : presetOptions.enableRowExpansion;
|
10807
|
+
const enableRowExpansionAll = (_props$enableRowExpan2 = props.enableRowExpansionAll) !== null && _props$enableRowExpan2 !== void 0 ? _props$enableRowExpan2 : presetOptions.enableRowExpansionAll;
|
10643
10808
|
const enableRowSelection = (_props$enableRowSelec = props.enableRowSelection) !== null && _props$enableRowSelec !== void 0 ? _props$enableRowSelec : presetOptions.enableRowSelection;
|
10644
10809
|
return {
|
10645
10810
|
// react-table built-in
|
@@ -10664,6 +10829,7 @@ function getTableFeaturePreset(props) {
|
|
10664
10829
|
enableRowDrag: enableRowDrag && !!props.onRowDrag,
|
10665
10830
|
enableRowDrop: enableRowDrop && !!props.onRowDrop,
|
10666
10831
|
enableRowGoto: enableRowGoto && !!props.onRowGoto,
|
10832
|
+
enableRowExpansionAll: enableRowExpansion && enableRowExpansionAll && !!props.rowExpansionRenderer,
|
10667
10833
|
enableRowHeight: (_props$enableRowHeigh = props.enableRowHeight) !== null && _props$enableRowHeigh !== void 0 ? _props$enableRowHeigh : presetOptions.enableRowHeight,
|
10668
10834
|
enableSaveSettings: (_props$enableSaveSett = props.enableSaveSettings) !== null && _props$enableSaveSett !== void 0 ? _props$enableSaveSett : presetOptions.enableSaveSettings
|
10669
10835
|
};
|
@@ -10783,8 +10949,17 @@ function useTablePrintingSettings(tableId) {
|
|
10783
10949
|
|
10784
10950
|
const DEFAULT_ROW_ACTIONS_LENGTH = 4;
|
10785
10951
|
function useTableRowActions(isEnabled = false, rowActions, rowActionsLength = DEFAULT_ROW_ACTIONS_LENGTH) {
|
10952
|
+
const [handlers, setHandlers] = React__default.useState({});
|
10953
|
+
const registerHandler = (key, handler) => {
|
10954
|
+
return setHandlers(h => ({
|
10955
|
+
...h,
|
10956
|
+
[key]: handler
|
10957
|
+
}));
|
10958
|
+
};
|
10786
10959
|
return {
|
10960
|
+
handlers,
|
10787
10961
|
isEnabled,
|
10962
|
+
registerHandler,
|
10788
10963
|
rowActions: isEnabled ? rowActions : undefined,
|
10789
10964
|
rowActionsLength: rowActions ? Math.min(rowActions.length, rowActionsLength) : 0
|
10790
10965
|
};
|
@@ -10859,7 +11034,7 @@ function useTableRowActive(isEnabled = false, initialRowActiveIndex) {
|
|
10859
11034
|
return index;
|
10860
11035
|
});
|
10861
11036
|
}
|
10862
|
-
}, [rowActiveIndex,
|
11037
|
+
}, [rowActiveIndex, isEnabled]);
|
10863
11038
|
return {
|
10864
11039
|
isEnabled,
|
10865
11040
|
rowActiveIndex,
|
@@ -10908,9 +11083,10 @@ function useTableRowClick(isEnabled = false, onRowClick) {
|
|
10908
11083
|
};
|
10909
11084
|
}
|
10910
11085
|
|
10911
|
-
function useTableRowExpansion(isEnabled = false, rowExpansionRenderer) {
|
11086
|
+
function useTableRowExpansion(isEnabled = false, canExpandAll = true, rowExpansionRenderer) {
|
10912
11087
|
return {
|
10913
11088
|
isEnabled,
|
11089
|
+
canExpandAll,
|
10914
11090
|
rowExpansionRenderer: isEnabled ? rowExpansionRenderer : undefined
|
10915
11091
|
};
|
10916
11092
|
}
|
@@ -10974,7 +11150,7 @@ function useTableRowSelection(isEnabled = false) {
|
|
10974
11150
|
- Highlighting search results, this is custom and only uses the state part of globalFilter (to store the search query)
|
10975
11151
|
- Filtering of results, this is essentially the built in filtering, and relies on enableGlobalFilter being on or off
|
10976
11152
|
*/
|
10977
|
-
function useTableSearch(isEnabled = false, defaultEnableGlobalFilter = false) {
|
11153
|
+
function useTableSearch(isEnabled = false, onChangeSearch, defaultEnableGlobalFilter = false) {
|
10978
11154
|
const [enableGlobalFilter, _setEnableGlobalFilter] = React__default.useState(defaultEnableGlobalFilter);
|
10979
11155
|
function setEnableGlobalFilter(enabled, instance) {
|
10980
11156
|
_setEnableGlobalFilter(enabled);
|
@@ -10999,7 +11175,8 @@ function useTableSearch(isEnabled = false, defaultEnableGlobalFilter = false) {
|
|
10999
11175
|
highlightedColumnIndexes,
|
11000
11176
|
setHighlightedColumnIndexes,
|
11001
11177
|
currentHighlightColumnIndex,
|
11002
|
-
setCurrentHighlightColumnIndex
|
11178
|
+
setCurrentHighlightColumnIndex,
|
11179
|
+
handleSearch: isEnabled && typeof onChangeSearch === 'function' ? onChangeSearch : undefined
|
11003
11180
|
};
|
11004
11181
|
}
|
11005
11182
|
|
@@ -11209,9 +11386,10 @@ function useTableDataLoader(fetchPage, fetchAll, options = {
|
|
11209
11386
|
const _lastUsedSorting = React__default.useRef([]);
|
11210
11387
|
const _lastUsedFilters = React__default.useRef([]);
|
11211
11388
|
const _lastUsedSearch = React__default.useRef();
|
11389
|
+
const _lastUsedHiddenColumns = React__default.useRef([]);
|
11212
11390
|
const _lastUsedPageIndex = React__default.useRef();
|
11213
11391
|
const _forceReset = React__default.useRef(false);
|
11214
|
-
const loadPage = function (pageIndex, sorting, filters) {
|
11392
|
+
const loadPage = function (pageIndex, sorting, filters, hiddenColumns) {
|
11215
11393
|
try {
|
11216
11394
|
let reset = false;
|
11217
11395
|
// sorting or filters changed, reset everything
|
@@ -11233,9 +11411,10 @@ function useTableDataLoader(fetchPage, fetchAll, options = {
|
|
11233
11411
|
_lastUsedSorting.current = sorting;
|
11234
11412
|
// set the filters so we can track if it changed between loads
|
11235
11413
|
_lastUsedFilters.current = filters;
|
11414
|
+
_lastUsedHiddenColumns.current = hiddenColumns;
|
11236
11415
|
const _temp = _finallyRethrows(function () {
|
11237
11416
|
return _catch(function () {
|
11238
|
-
return Promise.resolve(fetchPage(pageIndex, pageSize, sorting, filters)).then(function (response) {
|
11417
|
+
return Promise.resolve(fetchPage(pageIndex, pageSize, sorting, filters, hiddenColumns)).then(function (response) {
|
11239
11418
|
// update state, here we do some "magic" to support "load in place"
|
11240
11419
|
setData(currentData => {
|
11241
11420
|
let nextData;
|
@@ -11264,14 +11443,15 @@ function useTableDataLoader(fetchPage, fetchAll, options = {
|
|
11264
11443
|
return Promise.reject(e);
|
11265
11444
|
}
|
11266
11445
|
};
|
11267
|
-
const loadAll = function (sorting, filters) {
|
11446
|
+
const loadAll = function (sorting, filters, hiddenColumns) {
|
11268
11447
|
try {
|
11269
11448
|
// set the sorting so we can track if it changed between loads
|
11270
11449
|
_lastUsedSorting.current = sorting;
|
11271
11450
|
// set the filters so we can track if it changed between loads
|
11272
11451
|
_lastUsedFilters.current = filters;
|
11452
|
+
_lastUsedHiddenColumns.current = hiddenColumns;
|
11273
11453
|
const _temp2 = _catch(function () {
|
11274
|
-
return Promise.resolve(fetchAll(sorting, filters)).then(function (response) {
|
11454
|
+
return Promise.resolve(fetchAll(sorting, filters, hiddenColumns)).then(function (response) {
|
11275
11455
|
length.current = response.length;
|
11276
11456
|
setData(() => {
|
11277
11457
|
let nextData;
|
@@ -11296,11 +11476,11 @@ function useTableDataLoader(fetchPage, fetchAll, options = {
|
|
11296
11476
|
_forceReset.current = true;
|
11297
11477
|
if (_lastUsedSearch.current) {
|
11298
11478
|
// we're searching, which means we need to refetch all with the correct sorting applied
|
11299
|
-
return loadAll(_lastUsedSorting.current, _lastUsedFilters.current);
|
11479
|
+
return loadAll(_lastUsedSorting.current, _lastUsedFilters.current, _lastUsedHiddenColumns.current);
|
11300
11480
|
} else {
|
11301
11481
|
var _lastUsedPageIndex$cu;
|
11302
11482
|
// 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);
|
11483
|
+
return loadPage((_lastUsedPageIndex$cu = _lastUsedPageIndex.current) !== null && _lastUsedPageIndex$cu !== void 0 ? _lastUsedPageIndex$cu : 0, _lastUsedSorting.current, _lastUsedFilters.current, _lastUsedHiddenColumns.current);
|
11304
11484
|
}
|
11305
11485
|
} catch (e) {
|
11306
11486
|
return Promise.reject(e);
|
@@ -11312,13 +11492,12 @@ function useTableDataLoader(fetchPage, fetchAll, options = {
|
|
11312
11492
|
try {
|
11313
11493
|
if (_lastUsedSearch.current) {
|
11314
11494
|
// we're searching, which means we need to refetch all with the correct sorting applied
|
11315
|
-
loadAll(sorting, _lastUsedFilters.current);
|
11495
|
+
return loadAll(sorting, _lastUsedFilters.current, _lastUsedHiddenColumns.current);
|
11316
11496
|
} else {
|
11317
11497
|
var _lastUsedPageIndex$cu2;
|
11318
11498
|
// 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);
|
11499
|
+
return loadPage((_lastUsedPageIndex$cu2 = _lastUsedPageIndex.current) !== null && _lastUsedPageIndex$cu2 !== void 0 ? _lastUsedPageIndex$cu2 : 0, sorting, _lastUsedFilters.current, _lastUsedHiddenColumns.current);
|
11320
11500
|
}
|
11321
|
-
return Promise.resolve();
|
11322
11501
|
} catch (e) {
|
11323
11502
|
return Promise.reject(e);
|
11324
11503
|
}
|
@@ -11327,13 +11506,12 @@ function useTableDataLoader(fetchPage, fetchAll, options = {
|
|
11327
11506
|
try {
|
11328
11507
|
if (_lastUsedSearch.current) {
|
11329
11508
|
// we're searching, which means we need to refetch all with the correct sorting applied
|
11330
|
-
loadAll(_lastUsedSorting.current, filters);
|
11509
|
+
return loadAll(_lastUsedSorting.current, filters, _lastUsedHiddenColumns.current);
|
11331
11510
|
} else {
|
11332
11511
|
var _lastUsedPageIndex$cu3;
|
11333
11512
|
// 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);
|
11513
|
+
return loadPage((_lastUsedPageIndex$cu3 = _lastUsedPageIndex.current) !== null && _lastUsedPageIndex$cu3 !== void 0 ? _lastUsedPageIndex$cu3 : 0, _lastUsedSorting.current, filters, _lastUsedHiddenColumns.current);
|
11335
11514
|
}
|
11336
|
-
return Promise.resolve();
|
11337
11515
|
} catch (e) {
|
11338
11516
|
return Promise.reject(e);
|
11339
11517
|
}
|
@@ -11361,10 +11539,17 @@ function useTableDataLoader(fetchPage, fetchAll, options = {
|
|
11361
11539
|
}, invalidate];
|
11362
11540
|
}
|
11363
11541
|
|
11364
|
-
function useTableServerLoading(loadPage, loadAll, pageSize = DEFAULT_PAGE_SIZE) {
|
11542
|
+
function useTableServerLoading(length, data, loadPage, loadAll, pages, pageSize = DEFAULT_PAGE_SIZE, _experimentalDataLoader2 = false) {
|
11365
11543
|
const isEnabled = !!loadPage && !!loadAll;
|
11366
11544
|
const [isReady, setReady] = React__default.useState(false);
|
11367
|
-
const [
|
11545
|
+
const [loading, setLoading] = React__default.useState(false);
|
11546
|
+
const hasLoadedAll = React__default.useMemo(() => {
|
11547
|
+
var _data$some;
|
11548
|
+
if (data.length !== length || !!((_data$some = data.some) !== null && _data$some !== void 0 && _data$some.call(data, x => x === undefined))) {
|
11549
|
+
return false;
|
11550
|
+
}
|
11551
|
+
return true;
|
11552
|
+
}, [data, length]);
|
11368
11553
|
let _loadPage;
|
11369
11554
|
let _loadAll;
|
11370
11555
|
let _loadAllIfNeeded;
|
@@ -11389,9 +11574,9 @@ function useTableServerLoading(loadPage, loadAll, pageSize = DEFAULT_PAGE_SIZE)
|
|
11389
11574
|
try {
|
11390
11575
|
const _temp2 = function () {
|
11391
11576
|
if (typeof loadAll === 'function') {
|
11392
|
-
|
11577
|
+
setLoading(true);
|
11393
11578
|
return Promise.resolve(loadAll(...args)).then(function () {
|
11394
|
-
|
11579
|
+
setLoading(false);
|
11395
11580
|
setReady(true);
|
11396
11581
|
});
|
11397
11582
|
}
|
@@ -11404,7 +11589,7 @@ function useTableServerLoading(loadPage, loadAll, pageSize = DEFAULT_PAGE_SIZE)
|
|
11404
11589
|
_loadAllIfNeeded = function (...args) {
|
11405
11590
|
try {
|
11406
11591
|
const _temp3 = function () {
|
11407
|
-
if (
|
11592
|
+
if (!hasLoadedAll) {
|
11408
11593
|
var _loadAll2;
|
11409
11594
|
return Promise.resolve((_loadAll2 = _loadAll) === null || _loadAll2 === void 0 ? void 0 : _loadAll2(...args)).then(function () {});
|
11410
11595
|
}
|
@@ -11415,14 +11600,18 @@ function useTableServerLoading(loadPage, loadAll, pageSize = DEFAULT_PAGE_SIZE)
|
|
11415
11600
|
}
|
11416
11601
|
};
|
11417
11602
|
}
|
11603
|
+
const pageCount = Math.ceil(length / pageSize);
|
11418
11604
|
return {
|
11605
|
+
pages,
|
11419
11606
|
isEnabled,
|
11420
11607
|
isReady,
|
11421
11608
|
loadPage: _loadPage,
|
11422
11609
|
loadAll: _loadAll,
|
11423
11610
|
loadAllIfNeeded: _loadAllIfNeeded,
|
11424
|
-
|
11425
|
-
pageSize
|
11611
|
+
loading,
|
11612
|
+
pageSize,
|
11613
|
+
pageCount,
|
11614
|
+
_experimentalDataLoader2
|
11426
11615
|
};
|
11427
11616
|
}
|
11428
11617
|
|
@@ -11494,22 +11683,21 @@ function useLazyEffect(effect, deps) {
|
|
11494
11683
|
const readyRef = React__default.useRef(false);
|
11495
11684
|
React__default.useEffect(() => {
|
11496
11685
|
if (readyRef.current) {
|
11497
|
-
effect();
|
11686
|
+
return effect();
|
11498
11687
|
} else {
|
11499
11688
|
readyRef.current = true;
|
11500
11689
|
}
|
11501
11690
|
}, deps);
|
11502
11691
|
}
|
11503
11692
|
|
11504
|
-
function useTableDataListener(table) {
|
11693
|
+
function useTableDataListener(table, length) {
|
11505
11694
|
const meta = table.options.meta;
|
11506
|
-
const rows = table.getRowModel().rows;
|
11507
11695
|
useLazyEffect(() => {
|
11508
11696
|
const rowActiveIndex = meta.rowActive.rowActiveIndex;
|
11509
|
-
if (rowActiveIndex !== undefined && rowActiveIndex >
|
11697
|
+
if (rowActiveIndex !== undefined && rowActiveIndex > length) {
|
11510
11698
|
meta.rowActive.setRowActiveIndex(0);
|
11511
11699
|
}
|
11512
|
-
}, [
|
11700
|
+
}, [length]);
|
11513
11701
|
}
|
11514
11702
|
|
11515
11703
|
// we use a listener, and not the internal "controlled" change handlers because we don't actually want consumers
|
@@ -11519,7 +11707,8 @@ function useTableFilterListener(table, onFilter) {
|
|
11519
11707
|
const columnFilters = table.getState().columnFilters;
|
11520
11708
|
useLazyEffect(() => {
|
11521
11709
|
if (table.options.enableColumnFilters && typeof onFilter === 'function') {
|
11522
|
-
|
11710
|
+
const hiddenColumns = getHiddenColumns(table.getState().columnVisibility);
|
11711
|
+
onFilter(columnFilters, hiddenColumns);
|
11523
11712
|
if (table.options.enableRowSelection) {
|
11524
11713
|
table.resetRowSelection();
|
11525
11714
|
}
|
@@ -11536,7 +11725,8 @@ function useTableFontSizeListener(table) {
|
|
11536
11725
|
table.setColumnSizing(sizes => {
|
11537
11726
|
return Object.fromEntries(Object.entries(sizes).map(([columnName, prevColumnSize]) => {
|
11538
11727
|
var _column$columnDef$min;
|
11539
|
-
|
11728
|
+
// table.getColumn(columName) throw error in strict dev mode. Related thread: https://github.com/TanStack/table/discussions/5505
|
11729
|
+
const column = table.getAllColumns().find(x => x.id === columnName);
|
11540
11730
|
if (isInternalColumn(columnName)) {
|
11541
11731
|
var _column$getSize;
|
11542
11732
|
return [columnName, (_column$getSize = column === null || column === void 0 ? void 0 : column.getSize()) !== null && _column$getSize !== void 0 ? _column$getSize : prevColumnSize];
|
@@ -11577,11 +11767,12 @@ function useTableRowHeightListener(table) {
|
|
11577
11767
|
}
|
11578
11768
|
|
11579
11769
|
function useTableRowSelectionListener(table, onRowSelect) {
|
11770
|
+
// note that the selected row model may not contain all rows in state when using server loading
|
11580
11771
|
const rows = table.getSelectedRowModel().flatRows;
|
11581
|
-
const
|
11772
|
+
const state = table.getState().rowSelection;
|
11582
11773
|
useLazyEffect(() => {
|
11583
11774
|
if (table.options.enableRowSelection && typeof onRowSelect === 'function') {
|
11584
|
-
onRowSelect(
|
11775
|
+
onRowSelect(rows.map(row => row.original), Object.keys(state));
|
11585
11776
|
}
|
11586
11777
|
/**
|
11587
11778
|
* Casting to a boolean, since enableRowSelection can be a function,
|
@@ -11589,33 +11780,33 @@ function useTableRowSelectionListener(table, onRowSelect) {
|
|
11589
11780
|
* we only need to know if selection was enabled or disabled, because enableRowSelection function
|
11590
11781
|
* will be applied directly to particular rows.
|
11591
11782
|
*/
|
11592
|
-
}, [!!table.options.enableRowSelection, JSON.stringify(
|
11783
|
+
}, [!!table.options.enableRowSelection, JSON.stringify(state)]);
|
11593
11784
|
}
|
11594
11785
|
|
11595
|
-
function useTableSearchListener(table
|
11786
|
+
function useTableSearchListener(table) {
|
11596
11787
|
const meta = table.options.meta;
|
11597
11788
|
const localization = useLocalization();
|
11598
|
-
const
|
11789
|
+
const hiddenColumns = getHiddenColumns(table.getState().columnVisibility);
|
11790
|
+
const query = table.getState().globalFilter;
|
11599
11791
|
// Need to re-run search when columns are getting shown/hidden.
|
11600
|
-
|
11601
|
-
if (meta.search.isEnabled
|
11602
|
-
const currentFilter =
|
11792
|
+
useLazyEffect(() => {
|
11793
|
+
if (meta.search.isEnabled) {
|
11794
|
+
const currentFilter = query;
|
11603
11795
|
requestAnimationFrame(() => {
|
11604
11796
|
table.resetGlobalFilter();
|
11605
11797
|
table.setGlobalFilter(currentFilter);
|
11606
11798
|
});
|
11799
|
+
if (meta.search.handleSearch && meta.search.enableGlobalFilter && query) {
|
11800
|
+
meta.search.handleSearch(query, hiddenColumns);
|
11801
|
+
}
|
11607
11802
|
}
|
11608
|
-
}, [
|
11803
|
+
}, [hiddenColumns.length]);
|
11609
11804
|
// recalculates highlighted indexes whenever something important changes
|
11610
|
-
|
11805
|
+
useLazyEffect(() => {
|
11611
11806
|
if (meta.search.isEnabled) {
|
11612
|
-
const query = table.getState().globalFilter;
|
11613
11807
|
resetHighlightedColumnIndexes(query, table, localization);
|
11614
|
-
if (typeof onChangeSearch === 'function') {
|
11615
|
-
onChangeSearch(query);
|
11616
|
-
}
|
11617
11808
|
}
|
11618
|
-
}, [meta.server.
|
11809
|
+
}, [meta.server.loading, meta.search.isEnabled, meta.search.enableGlobalFilter, table.getRowModel().rows.length, query, JSON.stringify(table.getState().sorting)]);
|
11619
11810
|
}
|
11620
11811
|
|
11621
11812
|
function useTableSettingsListener(table, onChangeSettings) {
|
@@ -11699,12 +11890,15 @@ function useTableSortingListener(table, onSort) {
|
|
11699
11890
|
}
|
11700
11891
|
|
11701
11892
|
function useTableServerLoadingListener(table, loadPage) {
|
11702
|
-
const
|
11703
|
-
const columnFilters = table.getState().columnFilters;
|
11893
|
+
const meta = table.options.meta;
|
11704
11894
|
// trigger load of the first page on mount
|
11705
11895
|
React__default.useEffect(() => {
|
11706
11896
|
if (loadPage) {
|
11707
|
-
|
11897
|
+
const sorting = table.getState().sorting;
|
11898
|
+
const columnFilters = table.getState().columnFilters;
|
11899
|
+
const hiddenColumns = getHiddenColumns(table.getState().columnVisibility);
|
11900
|
+
const search = meta.search.enableGlobalFilter ? table.getState().globalFilter : undefined;
|
11901
|
+
loadPage(0, sorting, columnFilters, hiddenColumns, search);
|
11708
11902
|
}
|
11709
11903
|
}, []);
|
11710
11904
|
}
|
@@ -11751,13 +11945,13 @@ function useTableManager(props, meta, internalColumns) {
|
|
11751
11945
|
const rowClick = useTableRowClick(options.enableRowClick, props.onRowClick);
|
11752
11946
|
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
11947
|
const rowDrop = useTableRowDrop(options.enableRowDrop, props.onRowDrop);
|
11754
|
-
const rowExpansion = useTableRowExpansion(options.enableRowExpansion, props.rowExpansionRenderer);
|
11948
|
+
const rowExpansion = useTableRowExpansion(options.enableRowExpansion, options.enableRowExpansionAll, props.rowExpansionRenderer);
|
11755
11949
|
const rowGoto = useTableRowGoto(options.enableRowGoto, props.onRowGoto);
|
11756
11950
|
const rowGroups = useTableRowGroups(props.rowActionsForGroup);
|
11757
11951
|
const rowHeight = useTableRowHeight(options.enableRowHeight, settings.rowHeight);
|
11758
11952
|
const rowSelection = useTableRowSelection(!!options.enableRowSelection);
|
11759
|
-
const search = useTableSearch(options.enableSearch, settings.excludeUnmatchedRecordsInSearch);
|
11760
|
-
const server = useTableServerLoading(props.loadPage, props.loadAll, props.pageSize);
|
11953
|
+
const search = useTableSearch(options.enableSearch, props.onChangeSearch, settings.excludeUnmatchedRecordsInSearch);
|
11954
|
+
const server = useTableServerLoading(length, data, props.loadPage, props.loadAll, props.pages, props.pageSize, props._experimentalDataLoader2);
|
11761
11955
|
// TODO: memoise
|
11762
11956
|
// convert jsx column components into valid table columns
|
11763
11957
|
const {
|
@@ -11803,12 +11997,12 @@ function useTableManager(props, meta, internalColumns) {
|
|
11803
11997
|
}
|
11804
11998
|
});
|
11805
11999
|
// state listeners - we have these so that we don't have to control state outside the table
|
11806
|
-
useTableDataListener(instance);
|
12000
|
+
useTableDataListener(instance, length);
|
11807
12001
|
useTableFilterListener(instance, props.onChangeFilter);
|
11808
12002
|
useTableFontSizeListener(instance);
|
11809
12003
|
useTableRowHeightListener(instance);
|
11810
12004
|
useTableRowSelectionListener(instance, props.onRowSelect);
|
11811
|
-
useTableSearchListener(instance
|
12005
|
+
useTableSearchListener(instance);
|
11812
12006
|
useTableServerLoadingListener(instance, server.loadPage);
|
11813
12007
|
useTableSettingsListener(instance, setSettings);
|
11814
12008
|
useTableShortcutsListener(instance, props.shortcuts);
|
@@ -11877,9 +12071,9 @@ function useTableStyleGrid(tableId, table, fontSize) {
|
|
11877
12071
|
};
|
11878
12072
|
// printing grid
|
11879
12073
|
// 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}
|
12074
|
+
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
12075
|
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; }}`;
|
12076
|
+
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
12077
|
return {
|
11884
12078
|
style,
|
11885
12079
|
stylesheet
|
@@ -12034,7 +12228,7 @@ function useTableGlobalShortcuts(table, tableRef, scrollToIndex) {
|
|
12034
12228
|
if (isElementInsideOverlay(trigger) && !isSiblingElementInsideSameParentOverlay(trigger, tableRef.current) || isElementInteractive(trigger) && !isElementInsideOrTriggeredFromContainer(trigger, tableRef.current)) {
|
12035
12229
|
return;
|
12036
12230
|
}
|
12037
|
-
tableMeta.rowActive.handleKeyDown(event,
|
12231
|
+
tableMeta.rowActive.handleKeyDown(event, tableMeta.length, scrollToIndex);
|
12038
12232
|
tableMeta.rowSelection.handleKeyDown(event, table);
|
12039
12233
|
if (tableMeta.rowActive.rowActiveIndex !== undefined) {
|
12040
12234
|
var _rows$tableMeta$rowAc;
|
@@ -12047,7 +12241,7 @@ function useTableGlobalShortcuts(table, tableRef, scrollToIndex) {
|
|
12047
12241
|
};
|
12048
12242
|
},
|
12049
12243
|
// scrollToIndex function changes when row count changes, so it is important to update handlers
|
12050
|
-
[tableRef.current, tableMeta.rowActive.rowActiveIndex, scrollToIndex]);
|
12244
|
+
[tableRef.current, tableMeta.length, tableMeta.rowActive.rowActiveIndex, scrollToIndex]);
|
12051
12245
|
}
|
12052
12246
|
|
12053
12247
|
function useTableRef(table, ref) {
|
@@ -12070,57 +12264,131 @@ const ROW_HEIGHT_ESTIMATES = {
|
|
12070
12264
|
'extra-tall': 57
|
12071
12265
|
};
|
12072
12266
|
|
12267
|
+
const RowContext = /*#__PURE__*/React__default.createContext({
|
12268
|
+
hideInternalColumns: false,
|
12269
|
+
hideRowActions: false,
|
12270
|
+
isHovered: false,
|
12271
|
+
rowIndex: -1
|
12272
|
+
});
|
12273
|
+
|
12274
|
+
const DELAY_BEFORE_LOAD_MS = 250;
|
12275
|
+
/* anonymous functions will break the memoisation on each render, wrap handlers in callbacks */
|
12276
|
+
function Row(props) {
|
12277
|
+
const {
|
12278
|
+
renderer: RowRenderer,
|
12279
|
+
cellRenderer: CellRenderer,
|
12280
|
+
hideInternalColumns = false,
|
12281
|
+
hideRowActions = false,
|
12282
|
+
scrollDirection,
|
12283
|
+
skipPageLoading = false,
|
12284
|
+
...displayRowProps
|
12285
|
+
} = props;
|
12286
|
+
const tableMeta = props.table.options.meta;
|
12287
|
+
const isHovered = tableMeta.rowActive.rowHoverIndex === props.index;
|
12288
|
+
// context - it must be here for cells to read it, since they render alongside the row inside DisplayRow
|
12289
|
+
const contextValue = React__default.useMemo(() => ({
|
12290
|
+
isHovered,
|
12291
|
+
rowIndex: props.index,
|
12292
|
+
hideInternalColumns,
|
12293
|
+
hideRowActions
|
12294
|
+
}), [isHovered, props.index, hideInternalColumns, hideRowActions]);
|
12295
|
+
React__default.useEffect(() => {
|
12296
|
+
let timeout;
|
12297
|
+
if (tableMeta.server.isEnabled && tableMeta.server._experimentalDataLoader2 && !skipPageLoading) {
|
12298
|
+
const pageIndex = Math.floor(props.index / tableMeta.server.pageSize) * tableMeta.server.pageSize / tableMeta.server.pageSize;
|
12299
|
+
const sorting = props.table.getState().sorting;
|
12300
|
+
const filters = props.table.getState().columnFilters;
|
12301
|
+
const search = props.table.getState().globalFilter;
|
12302
|
+
const hiddenColumns = getHiddenColumns(props.table.getState().columnVisibility);
|
12303
|
+
const pageIndexesToFetch = [];
|
12304
|
+
// if there's no direction, it means the scroll bar got dropped un unloaded pages,
|
12305
|
+
// in that case, load forward and backward pages to prevent skeletons
|
12306
|
+
if (scrollDirection === 'backward' || !scrollDirection) {
|
12307
|
+
const backIndex = pageIndex - 1;
|
12308
|
+
if (backIndex > -1) {
|
12309
|
+
pageIndexesToFetch.push(backIndex);
|
12310
|
+
}
|
12311
|
+
}
|
12312
|
+
// always load the next page
|
12313
|
+
if ((scrollDirection === 'forward' || !scrollDirection) && pageIndex + 2 < tableMeta.server.pageCount) {
|
12314
|
+
pageIndexesToFetch.push(pageIndex + 1);
|
12315
|
+
}
|
12316
|
+
if (pageIndexesToFetch.length) {
|
12317
|
+
// the virtualiser fetches a page ahead, so this won't get called in most cases
|
12318
|
+
// but it provides a fallback for some edge cases
|
12319
|
+
timeout = setTimeout(() => {
|
12320
|
+
pageIndexesToFetch.forEach(index => {
|
12321
|
+
var _tableMeta$server$loa, _tableMeta$server;
|
12322
|
+
// this can be called by every row within the current page, but loadPage returns early if a pending request exists
|
12323
|
+
(_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);
|
12324
|
+
});
|
12325
|
+
}, DELAY_BEFORE_LOAD_MS);
|
12326
|
+
}
|
12327
|
+
}
|
12328
|
+
return () => {
|
12329
|
+
clearTimeout(timeout);
|
12330
|
+
};
|
12331
|
+
}, [tableMeta.server.pages]);
|
12332
|
+
return /*#__PURE__*/React__default.createElement(RowContext.Provider, {
|
12333
|
+
value: contextValue
|
12334
|
+
}, /*#__PURE__*/React__default.createElement(RowRenderer, Object.assign({}, displayRowProps, {
|
12335
|
+
cellRenderer: CellRenderer
|
12336
|
+
})));
|
12337
|
+
}
|
12338
|
+
|
12339
|
+
const DELAY_BEFORE_LOAD_MS$1 = 150;
|
12073
12340
|
function SkeletonRow(props) {
|
12074
12341
|
const {
|
12075
12342
|
index,
|
12076
|
-
row,
|
12077
12343
|
table
|
12078
12344
|
} = props;
|
12079
12345
|
const tableMeta = table.options.meta;
|
12080
12346
|
if (tableMeta.server.isEnabled) {
|
12081
|
-
return /*#__PURE__*/React__default.createElement(RowWithServerLoading, Object.assign({}, props
|
12082
|
-
index: index
|
12083
|
-
}));
|
12347
|
+
return /*#__PURE__*/React__default.createElement(RowWithServerLoading, Object.assign({}, props));
|
12084
12348
|
}
|
12085
12349
|
return /*#__PURE__*/React__default.createElement(Skeleton, {
|
12086
|
-
cellsCount:
|
12350
|
+
cellsCount: table.getVisibleFlatColumns().length,
|
12351
|
+
index: index
|
12087
12352
|
});
|
12088
12353
|
}
|
12089
12354
|
function RowWithServerLoading(props) {
|
12090
12355
|
var _table$getState$group, _table$getState;
|
12091
12356
|
const {
|
12092
12357
|
index,
|
12093
|
-
row,
|
12094
12358
|
table
|
12095
12359
|
} = props;
|
12096
12360
|
const tableMeta = table.options.meta;
|
12097
12361
|
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
12362
|
React__default.useEffect(() => {
|
12107
|
-
|
12108
|
-
|
12109
|
-
|
12363
|
+
let timeout;
|
12364
|
+
if (tableMeta.server.isEnabled) {
|
12365
|
+
const sorting = props.table.getState().sorting;
|
12366
|
+
const filters = props.table.getState().columnFilters;
|
12367
|
+
const search = props.table.getState().globalFilter;
|
12368
|
+
const hiddenColumns = getHiddenColumns(props.table.getState().columnVisibility);
|
12369
|
+
timeout = setTimeout(() => {
|
12370
|
+
var _tableMeta$server$loa, _tableMeta$server;
|
12371
|
+
(_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);
|
12372
|
+
}, DELAY_BEFORE_LOAD_MS$1);
|
12110
12373
|
}
|
12111
|
-
|
12374
|
+
return () => {
|
12375
|
+
clearTimeout(timeout);
|
12376
|
+
};
|
12377
|
+
}, []);
|
12112
12378
|
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 =
|
12379
|
+
const ungroupedCellCount = table.getVisibleFlatColumns().length - groupedCellCount;
|
12114
12380
|
return /*#__PURE__*/React__default.createElement(Skeleton, {
|
12115
12381
|
cellsCount: ungroupedCellCount,
|
12116
|
-
|
12382
|
+
index: index
|
12117
12383
|
});
|
12118
12384
|
}
|
12119
12385
|
const Skeleton = /*#__PURE__*/React__default.forwardRef(function Skeleton(props, ref) {
|
12120
12386
|
const {
|
12121
|
-
cellsCount
|
12387
|
+
cellsCount,
|
12388
|
+
index
|
12122
12389
|
} = props;
|
12123
12390
|
return /*#__PURE__*/React__default.createElement("tr", {
|
12391
|
+
"data-row-index": index,
|
12124
12392
|
ref: ref
|
12125
12393
|
}, Array(cellsCount).fill(null).map((_, index) => (/*#__PURE__*/React__default.createElement("td", {
|
12126
12394
|
key: index
|
@@ -12129,38 +12397,6 @@ const Skeleton = /*#__PURE__*/React__default.forwardRef(function Skeleton(props,
|
|
12129
12397
|
})))));
|
12130
12398
|
});
|
12131
12399
|
|
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
12400
|
// scroll padding end is designed to always show half of the next row
|
12165
12401
|
function getScrollPaddingEndOffset(table) {
|
12166
12402
|
const tableMeta = table.options.meta;
|
@@ -12185,8 +12421,8 @@ function getPaddingEndOffset(table, options) {
|
|
12185
12421
|
const bottomRows = (_table$getBottomRows = table.getBottomRows()) !== null && _table$getBottomRows !== void 0 ? _table$getBottomRows : [];
|
12186
12422
|
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
12423
|
}
|
12188
|
-
function useTableRenderer(renderers, table, tableRef, defaultRowActiveIndex, options) {
|
12189
|
-
var _table$getState$group, _table$getCenterRows, _virtualItems$padding, _virtualItems$padding2, _virtualItems$padding3,
|
12424
|
+
function useTableRenderer(renderers, table, tableRef, length, defaultRowActiveIndex, options) {
|
12425
|
+
var _table$getState$group, _table$getCenterRows, _virtualItems$padding, _virtualItems$padding2, _virtualItems$padding3, _virtualItems$end, _virtualItems;
|
12190
12426
|
const tableMeta = table.options.meta;
|
12191
12427
|
const isTableRowGrouped = !!((_table$getState$group = table.getState().grouping) !== null && _table$getState$group !== void 0 && _table$getState$group.length);
|
12192
12428
|
const rows = (_table$getCenterRows = table.getCenterRows()) !== null && _table$getCenterRows !== void 0 ? _table$getCenterRows : [];
|
@@ -12199,11 +12435,12 @@ function useTableRenderer(renderers, table, tableRef, defaultRowActiveIndex, opt
|
|
12199
12435
|
const rangeExtractor = useRowGroupVirtualisation(table);
|
12200
12436
|
// account for thead and tfoot in the scroll area - both are always medium row height
|
12201
12437
|
const scrollPaddingStart = ROW_HEIGHT_ESTIMATES.medium;
|
12438
|
+
const count = tableMeta.server.isEnabled && tableMeta.server._experimentalDataLoader2 ? length : rows.length;
|
12202
12439
|
const virtualiser = reactVirtual.useVirtualizer({
|
12203
|
-
count
|
12440
|
+
count,
|
12204
12441
|
estimateSize,
|
12205
12442
|
getScrollElement: () => tableRef.current,
|
12206
|
-
overscan: tableMeta.printing.isPrinting ?
|
12443
|
+
overscan: tableMeta.printing.isPrinting ? count : undefined,
|
12207
12444
|
rangeExtractor,
|
12208
12445
|
// correctly sets the scroll padding offset, e.g. when keyboard navigating rows in the list
|
12209
12446
|
scrollPaddingStart,
|
@@ -12223,19 +12460,19 @@ function useTableRenderer(renderers, table, tableRef, defaultRowActiveIndex, opt
|
|
12223
12460
|
if (tableRef.current) {
|
12224
12461
|
if (index === 0) {
|
12225
12462
|
virtualiser.scrollToOffset(0, notSmooth);
|
12226
|
-
} else if (index ===
|
12463
|
+
} else if (index === count - 1) {
|
12227
12464
|
// sometimes the last row doesn't fully show, so we just force scroll to the bottom
|
12228
12465
|
tableRef.current.scrollTop = tableRef.current.scrollHeight;
|
12229
12466
|
} else {
|
12230
12467
|
virtualiser.scrollToIndex(index, options);
|
12231
12468
|
}
|
12232
12469
|
}
|
12233
|
-
}, [virtualItems.length, tableRef.current, totalSize,
|
12470
|
+
}, [virtualItems.length, tableRef.current, totalSize, count]);
|
12234
12471
|
// 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 &&
|
12472
|
+
const paddingStartIndex = isTableRowGrouped && count > 1 ? 1 : 0;
|
12236
12473
|
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
12474
|
// 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,
|
12475
|
+
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
12476
|
// ensure default active rows are scrolled to
|
12240
12477
|
React__default.useEffect(() => {
|
12241
12478
|
if (defaultRowActiveIndex) {
|
@@ -12248,23 +12485,52 @@ function useTableRenderer(renderers, table, tableRef, defaultRowActiveIndex, opt
|
|
12248
12485
|
// rendered output
|
12249
12486
|
let style = {};
|
12250
12487
|
let content = null;
|
12251
|
-
|
12488
|
+
// bottom rows aren't virtualised (they're sticky) but we need to set the height
|
12489
|
+
if (count || table.getBottomRows().length) {
|
12252
12490
|
style = {
|
12253
12491
|
height: totalSize,
|
12254
|
-
paddingBottom,
|
12255
|
-
paddingTop
|
12492
|
+
paddingBottom: isNaN(paddingBottom) ? 0 : paddingBottom,
|
12493
|
+
paddingTop: isNaN(paddingTop) ? 0 : paddingTop
|
12256
12494
|
};
|
12495
|
+
}
|
12496
|
+
// only render non sticky rows
|
12497
|
+
if (count) {
|
12257
12498
|
content = virtualItems.map(virtualRow => {
|
12499
|
+
var _row, _virtualiser$scrollDi2;
|
12258
12500
|
// 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
12501
|
if (!virtualRow) {
|
12260
12502
|
return null;
|
12261
12503
|
}
|
12262
|
-
|
12504
|
+
let row;
|
12505
|
+
if (tableMeta.server.isEnabled && tableMeta.server._experimentalDataLoader2) {
|
12506
|
+
var _tableMeta$server$pag, _tableMeta$server$pag2;
|
12507
|
+
const currentPageIndex = Math.floor(virtualRow.index / tableMeta.server.pageSize) * tableMeta.server.pageSize / tableMeta.server.pageSize;
|
12508
|
+
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;
|
12509
|
+
if (pagePosition > -1) {
|
12510
|
+
// "flatten" row indexes down into the dataloader2 dataset size
|
12511
|
+
// for example, with a page size of 100...
|
12512
|
+
// row index 14267 is actually one of index 67, 167, 267 etc within the dataset (depending on number of pages stored)
|
12513
|
+
const fakeIndex = pagePosition * tableMeta.server.pageSize + virtualRow.index % tableMeta.server.pageSize;
|
12514
|
+
row = rows[fakeIndex];
|
12515
|
+
}
|
12516
|
+
} else {
|
12517
|
+
row = rows[virtualRow.index];
|
12518
|
+
}
|
12519
|
+
if (!((_row = row) !== null && _row !== void 0 && _row.original)) {
|
12520
|
+
var _virtualiser$scrollDi;
|
12521
|
+
return /*#__PURE__*/React__default.createElement(SkeletonRow, {
|
12522
|
+
key: virtualRow.index,
|
12523
|
+
index: virtualRow.index,
|
12524
|
+
scrollDirection: (_virtualiser$scrollDi = virtualiser.scrollDirection) !== null && _virtualiser$scrollDi !== void 0 ? _virtualiser$scrollDi : undefined,
|
12525
|
+
table: table
|
12526
|
+
});
|
12527
|
+
}
|
12263
12528
|
const measureRow = createRowMeasurer(virtualiser.resizeItem, virtualRow);
|
12264
12529
|
return /*#__PURE__*/React__default.createElement(Row, {
|
12265
12530
|
key: row.id,
|
12266
12531
|
row: row,
|
12267
12532
|
index: virtualRow.index,
|
12533
|
+
scrollDirection: (_virtualiser$scrollDi2 = virtualiser.scrollDirection) !== null && _virtualiser$scrollDi2 !== void 0 ? _virtualiser$scrollDi2 : undefined,
|
12268
12534
|
table: table,
|
12269
12535
|
measureRow: measureRow,
|
12270
12536
|
renderer: renderers.row,
|
@@ -12371,8 +12637,9 @@ function Actions$1(props) {
|
|
12371
12637
|
const {
|
12372
12638
|
texts
|
12373
12639
|
} = useLocalization();
|
12640
|
+
const tableMeta = table.options.meta;
|
12374
12641
|
// 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);
|
12642
|
+
const visibleActions = actions.map(action => action(data, rowId, tableMeta.rowActions.handlers['cleanup'], table)).filter(action => !!action);
|
12376
12643
|
const actionsOnRow = visibleActions.length === actionsLength ? visibleActions : visibleActions.slice(0, actionsLength - 1);
|
12377
12644
|
const actionsInMenu = visibleActions.slice(visibleActions.length === actionsLength ? actionsLength : actionsLength - 1);
|
12378
12645
|
const className = cn('flex justify-end text-right bg-[inherit] shadow-[-6px_0px_6px_var(--table-row-actions-shadow)] print:hidden');
|
@@ -12411,9 +12678,9 @@ const Cell = /*#__PURE__*/React__default.memo(function MemoedCell(context) {
|
|
12411
12678
|
table
|
12412
12679
|
} = context;
|
12413
12680
|
const {
|
12681
|
+
hideRowActions,
|
12414
12682
|
isHovered,
|
12415
|
-
rowIndex
|
12416
|
-
hideRowActions
|
12683
|
+
rowIndex
|
12417
12684
|
} = React__default.useContext(RowContext);
|
12418
12685
|
const tableMeta = table.options.meta;
|
12419
12686
|
const actions = tableMeta.rowActions.rowActions;
|
@@ -12421,7 +12688,8 @@ const Cell = /*#__PURE__*/React__default.memo(function MemoedCell(context) {
|
|
12421
12688
|
const isActiveRow = tableMeta.rowActive.rowActiveIndex === rowIndex;
|
12422
12689
|
const isResizingColumn = !!table.getState().columnSizingInfo.isResizingColumn;
|
12423
12690
|
const isHoverStatePaused = tableMeta.rowActive.isHoverStatePaused;
|
12424
|
-
|
12691
|
+
const isRowGrouped = row.getIsGrouped();
|
12692
|
+
if (!hideRowActions && !isRowGrouped && actions !== null && actions !== void 0 && actions.length && (isActiveRow || isHovered && !isHoverStatePaused && !isResizingColumn)) {
|
12425
12693
|
return /*#__PURE__*/React__default.createElement(Actions$1, {
|
12426
12694
|
actions: actions,
|
12427
12695
|
actionsLength: actionsLength,
|
@@ -12452,6 +12720,12 @@ function Cell$1() {
|
|
12452
12720
|
const {
|
12453
12721
|
texts
|
12454
12722
|
} = useLocalization();
|
12723
|
+
const {
|
12724
|
+
hideInternalColumns
|
12725
|
+
} = React__default.useContext(RowContext);
|
12726
|
+
if (hideInternalColumns) {
|
12727
|
+
return null;
|
12728
|
+
}
|
12455
12729
|
return /*#__PURE__*/React__default.createElement(Icon, {
|
12456
12730
|
"aria-label": texts.table.columns.drag.tooltip,
|
12457
12731
|
name: "drag",
|
@@ -12479,6 +12753,10 @@ function Header$3(context) {
|
|
12479
12753
|
const {
|
12480
12754
|
table
|
12481
12755
|
} = context;
|
12756
|
+
const tableMeta = table.options.meta;
|
12757
|
+
if (!tableMeta.rowExpansion.canExpandAll) {
|
12758
|
+
return null;
|
12759
|
+
}
|
12482
12760
|
const isSomeRowsExpanded = table.getIsSomeRowsExpanded();
|
12483
12761
|
const handleClick = event => {
|
12484
12762
|
event.stopPropagation();
|
@@ -12500,7 +12778,13 @@ function Cell$2(context) {
|
|
12500
12778
|
const {
|
12501
12779
|
texts
|
12502
12780
|
} = useLocalization();
|
12781
|
+
const {
|
12782
|
+
hideInternalColumns
|
12783
|
+
} = React__default.useContext(RowContext);
|
12503
12784
|
const tableMeta = context.table.options.meta;
|
12785
|
+
if (hideInternalColumns) {
|
12786
|
+
return null;
|
12787
|
+
}
|
12504
12788
|
const hasExpandedRow = (_tableMeta$rowExpansi = (_tableMeta$rowExpansi2 = tableMeta.rowExpansion).rowExpansionRenderer) === null || _tableMeta$rowExpansi === void 0 ? void 0 : _tableMeta$rowExpansi.call(_tableMeta$rowExpansi2, context.row.original);
|
12505
12789
|
if (hasExpandedRow) {
|
12506
12790
|
const isActiveRow = tableMeta.rowActive.rowActiveIndex === context.row.index;
|
@@ -12554,8 +12838,9 @@ function Header$4(context) {
|
|
12554
12838
|
}
|
12555
12839
|
const _temp = function () {
|
12556
12840
|
if (tableMeta.server.loadAllIfNeeded) {
|
12841
|
+
const hiddenColumns = getHiddenColumns(table.getState().columnVisibility);
|
12557
12842
|
// don't pass the search query because we need all data - not filtered data
|
12558
|
-
return Promise.resolve(tableMeta.server.loadAllIfNeeded(table.getState().sorting, table.getState().columnFilters)).then(function () {});
|
12843
|
+
return Promise.resolve(tableMeta.server.loadAllIfNeeded(table.getState().sorting, table.getState().columnFilters, hiddenColumns, tableMeta.search.enableGlobalFilter ? table.getState().globalFilter : undefined)).then(function () {});
|
12559
12844
|
}
|
12560
12845
|
}();
|
12561
12846
|
// load all data if that is possible
|
@@ -12571,7 +12856,7 @@ function Header$4(context) {
|
|
12571
12856
|
className: "hover:border-blue !-mt-px",
|
12572
12857
|
checked: isAllRowsSelected,
|
12573
12858
|
indeterminate: isSomeRowsSelected && !isAllRowsSelected,
|
12574
|
-
loading: tableMeta.server.
|
12859
|
+
loading: tableMeta.server.loading,
|
12575
12860
|
onChange: handleChange
|
12576
12861
|
}));
|
12577
12862
|
}
|
@@ -12590,10 +12875,11 @@ function Cell$3(context) {
|
|
12590
12875
|
table
|
12591
12876
|
} = context;
|
12592
12877
|
const {
|
12878
|
+
hideInternalColumns,
|
12593
12879
|
rowIndex
|
12594
12880
|
} = React__default.useContext(RowContext);
|
12595
12881
|
const tableMeta = table.options.meta;
|
12596
|
-
if (table.options.enableGrouping && (_table$getState$group = table.getState().grouping) !== null && _table$getState$group !== void 0 && _table$getState$group.length && !row.getIsGrouped()) {
|
12882
|
+
if (hideInternalColumns || table.options.enableGrouping && (_table$getState$group = table.getState().grouping) !== null && _table$getState$group !== void 0 && _table$getState$group.length && !row.getIsGrouped()) {
|
12597
12883
|
return null;
|
12598
12884
|
}
|
12599
12885
|
const isSelected = row.getIsGrouped() ? row.getIsAllSubRowsSelected() : row.getIsSelected();
|
@@ -12613,6 +12899,7 @@ function Cell$3(context) {
|
|
12613
12899
|
if (event.shiftKey) {
|
12614
12900
|
var _tableMeta$rowSelecti;
|
12615
12901
|
function _temp4() {
|
12902
|
+
const selectedRows = table.getRowModel().rows.slice(fromIndex, toIndex + 1);
|
12616
12903
|
table.setRowSelection(currentRowSelection => ({
|
12617
12904
|
...currentRowSelection,
|
12618
12905
|
...selectedRows.filter(row => row.getCanSelect()).reduce((state, row) => ({
|
@@ -12622,11 +12909,11 @@ function Cell$3(context) {
|
|
12622
12909
|
}));
|
12623
12910
|
}
|
12624
12911
|
const [fromIndex, toIndex] = toggleBetween((_tableMeta$rowSelecti = tableMeta.rowSelection.lastSelectedRowIndex.current) !== null && _tableMeta$rowSelecti !== void 0 ? _tableMeta$rowSelecti : 0, rowIndex);
|
12625
|
-
const selectedRows = table.getRowModel().rows.slice(fromIndex, toIndex + 1);
|
12626
12912
|
const _temp3 = function () {
|
12627
|
-
if (tableMeta.server.loadAllIfNeeded
|
12913
|
+
if (tableMeta.server.loadAllIfNeeded) {
|
12914
|
+
const hiddenColumns = getHiddenColumns(table.getState().columnVisibility);
|
12628
12915
|
// don't pass the search query because we need all data - not filtered data
|
12629
|
-
return Promise.resolve(tableMeta.server.loadAllIfNeeded(table.getState().sorting, table.getState().columnFilters)).then(function () {});
|
12916
|
+
return Promise.resolve(tableMeta.server.loadAllIfNeeded(table.getState().sorting, table.getState().columnFilters, hiddenColumns, tableMeta.search.enableGlobalFilter ? table.getState().globalFilter : undefined)).then(function () {});
|
12630
12917
|
}
|
12631
12918
|
}();
|
12632
12919
|
return _temp3 && _temp3.then ? _temp3.then(_temp4) : _temp4(_temp3);
|
@@ -12684,7 +12971,7 @@ function useTable(props, externalRef, renderers, meta, options) {
|
|
12684
12971
|
// configure the table
|
12685
12972
|
const manager = useTableManager(props, meta, INTERNAL_RENDERERS);
|
12686
12973
|
// configure the virtualised renderer
|
12687
|
-
const renderer = useTableRenderer(renderers, manager.instance, ref, props.defaultRowActiveIndex, options);
|
12974
|
+
const renderer = useTableRenderer(renderers, manager.instance, ref, manager.meta.length, props.defaultRowActiveIndex, options);
|
12688
12975
|
// configure dynamic styling
|
12689
12976
|
const {
|
12690
12977
|
style,
|
@@ -12797,7 +13084,9 @@ function GroupedCell(props) {
|
|
12797
13084
|
} = React__default.useContext(RowContext);
|
12798
13085
|
const isActiveRow = tableMeta.rowActive.rowActiveIndex === rowIndex;
|
12799
13086
|
const canShowActions = isActiveRow || isHovered && !tableMeta.rowActive.isHoverStatePaused;
|
12800
|
-
|
13087
|
+
// Set colSpan based on the count of visible cells, including '__actions' and non-internal columns, so that
|
13088
|
+
// rowGroupActions aligns with rowActions.
|
13089
|
+
const colSpan = cell.row.getVisibleCells().filter(c => c.column.id === '__actions' || !isInternalColumn(c.column.id)).length - 1;
|
12801
13090
|
const content = (_ref = (_columnMeta$renderer = (_columnMeta$renderer2 = columnMeta.renderer) === null || _columnMeta$renderer2 === void 0 ? void 0 : _columnMeta$renderer2.call(columnMeta, cell.getValue(), cell.row.original)) !== null && _columnMeta$renderer !== void 0 ? _columnMeta$renderer : cell.getValue()) !== null && _ref !== void 0 ? _ref : null;
|
12802
13091
|
const subRows = cell.getContext().row.subRows.map(row => row.original);
|
12803
13092
|
return /*#__PURE__*/React__default.createElement(MemoedGroupedCell, Object.assign({}, attributes, {
|
@@ -12822,22 +13111,27 @@ const MemoedGroupedCell = /*#__PURE__*/React__default.memo(function MemoedGroupe
|
|
12822
13111
|
table,
|
12823
13112
|
...attributes
|
12824
13113
|
} = props;
|
12825
|
-
return
|
12826
|
-
|
12827
|
-
|
12828
|
-
|
12829
|
-
|
12830
|
-
|
12831
|
-
|
12832
|
-
|
12833
|
-
|
12834
|
-
|
12835
|
-
|
12836
|
-
|
12837
|
-
|
12838
|
-
|
12839
|
-
|
12840
|
-
|
13114
|
+
return (
|
13115
|
+
/*#__PURE__*/
|
13116
|
+
// pr-1 is needed to align group row actions with row actions in sibling rows, if present
|
13117
|
+
React__default.createElement("td", Object.assign({}, attributes, {
|
13118
|
+
className: "!pr-1",
|
13119
|
+
ref: cellRef,
|
13120
|
+
style: {
|
13121
|
+
gridColumn: `span ${colSpan} / span ${colSpan}`
|
13122
|
+
}
|
13123
|
+
}), /*#__PURE__*/React__default.createElement("span", {
|
13124
|
+
className: "grow"
|
13125
|
+
}, children), rowActions !== null && rowActions !== void 0 && rowActions.length && canShowActions ? (/*#__PURE__*/React__default.createElement(Actions$1, {
|
13126
|
+
actions: rowActions,
|
13127
|
+
actionsLength: 4,
|
13128
|
+
data: subRows,
|
13129
|
+
isActiveRow: true,
|
13130
|
+
rowId: rowId,
|
13131
|
+
table: table
|
13132
|
+
})) : null)
|
13133
|
+
);
|
13134
|
+
});
|
12841
13135
|
|
12842
13136
|
function Cell$4(props) {
|
12843
13137
|
const {
|
@@ -12897,7 +13191,7 @@ const DisplayRow = /*#__PURE__*/React__default.memo(function DisplayRow(props) {
|
|
12897
13191
|
if (tableMeta.rowActive.isEnabled) {
|
12898
13192
|
attributes['data-row-active'] = tableMeta.rowActive.rowActiveIndex === index ? true : undefined;
|
12899
13193
|
// we use capture because it let's us picks up clicks on components inside the row, e.g. checkboxes
|
12900
|
-
attributes.
|
13194
|
+
attributes.onClickCapture = handleClickCapture;
|
12901
13195
|
}
|
12902
13196
|
// row click
|
12903
13197
|
if (tableMeta.rowClick.isEnabled(row.original)) {
|
@@ -12979,10 +13273,13 @@ const DisplayRow = /*#__PURE__*/React__default.memo(function DisplayRow(props) {
|
|
12979
13273
|
'hover:cursor-grab': tableMeta.rowDrag.isEnabled && typeof attributes.onClick !== 'function',
|
12980
13274
|
'hover:cursor-pointer': typeof attributes.onClick === 'function'
|
12981
13275
|
});
|
13276
|
+
const isGrouped = row.getIsGrouped();
|
12982
13277
|
return /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement("tr", Object.assign({}, attributes, {
|
12983
13278
|
className: className,
|
12984
13279
|
ref: ref
|
12985
|
-
}), children, row.getVisibleCells()
|
13280
|
+
}), children, row.getVisibleCells()
|
13281
|
+
// Filter out the row actions cell from rendering in Grouped Row
|
13282
|
+
.filter(cell => !(isGrouped && cell.column.id === '__actions')).map((cell, cellIndex) => (/*#__PURE__*/React__default.createElement(Cell$4, {
|
12986
13283
|
key: cell.id,
|
12987
13284
|
cell: cell,
|
12988
13285
|
index: cellIndex,
|
@@ -13368,7 +13665,9 @@ function HeaderMenu(props) {
|
|
13368
13665
|
return /*#__PURE__*/React__default.createElement(IconButton, {
|
13369
13666
|
className: className,
|
13370
13667
|
icon: "more",
|
13371
|
-
menu: popoverElement ? undefined : menuProps => (/*#__PURE__*/React__default.createElement(Menu$1, Object.assign({}, menuProps), /*#__PURE__*/React__default.createElement(Menu$1.Content,
|
13668
|
+
menu: popoverElement ? undefined : menuProps => (/*#__PURE__*/React__default.createElement(Menu$1, Object.assign({}, menuProps), /*#__PURE__*/React__default.createElement(Menu$1.Content, {
|
13669
|
+
onFocusOutside: event => event.preventDefault()
|
13670
|
+
}, memoedMenuItems))),
|
13372
13671
|
popover: popoverElement,
|
13373
13672
|
onClickCapture: event => event.preventDefault(),
|
13374
13673
|
onKeyDown: event => {
|
@@ -13742,21 +14041,22 @@ function Summary(props) {
|
|
13742
14041
|
locale,
|
13743
14042
|
texts
|
13744
14043
|
} = useLocalization();
|
13745
|
-
const
|
14044
|
+
const tableMeta = table.options.meta;
|
14045
|
+
const length = tableMeta.length;
|
13746
14046
|
const currentLength = table.getRowModel().rows.length;
|
13747
14047
|
let label;
|
13748
14048
|
let count;
|
13749
14049
|
// row selection
|
13750
|
-
|
14050
|
+
// use table state and not the selected row model because of the way server loading works
|
14051
|
+
const rowsSelectedLength = Object.keys(table.getState().rowSelection).length;
|
13751
14052
|
if (rowsSelectedLength > 0) {
|
13752
14053
|
label = texts.table.footer.summary.selected;
|
13753
14054
|
count = /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement("strong", null, new Intl.NumberFormat(locale).format(rowsSelectedLength)), "\u00A0", texts.table.footer.summary.count, "\u00A0", /*#__PURE__*/React__default.createElement("strong", null, new Intl.NumberFormat(locale).format(length)));
|
13754
|
-
} else if ((_table$getState$colum = table.getState().columnFilters) !== null && _table$getState$colum !== void 0 && _table$getState$colum.length ||
|
14055
|
+
} else if (!tableMeta.server.isEnabled && ((_table$getState$colum = table.getState().columnFilters) !== null && _table$getState$colum !== void 0 && _table$getState$colum.length ||
|
13755
14056
|
// filtered data
|
13756
|
-
!!table.getState().globalFilter && table.options.enableGlobalFilter
|
13757
|
-
) {
|
14057
|
+
!!table.getState().globalFilter && table.options.enableGlobalFilter)) {
|
13758
14058
|
label = texts.table.footer.summary.records;
|
13759
|
-
count = /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement("strong", null, currentLength), "\u00A0", texts.table.footer.summary.count, "\u00A0", /*#__PURE__*/React__default.createElement("strong", null, new Intl.NumberFormat(locale).format(length)));
|
14059
|
+
count = /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement("strong", null, new Intl.NumberFormat(locale).format(currentLength)), "\u00A0", texts.table.footer.summary.count, "\u00A0", /*#__PURE__*/React__default.createElement("strong", null, new Intl.NumberFormat(locale).format(length)));
|
13760
14060
|
} else {
|
13761
14061
|
label = texts.table.footer.summary.records;
|
13762
14062
|
count = /*#__PURE__*/React__default.createElement("strong", null, new Intl.NumberFormat(locale).format(length));
|
@@ -13768,8 +14068,13 @@ function Summary(props) {
|
|
13768
14068
|
}
|
13769
14069
|
|
13770
14070
|
function Foot(props) {
|
13771
|
-
const
|
13772
|
-
|
14071
|
+
const {
|
14072
|
+
children,
|
14073
|
+
table,
|
14074
|
+
...attributes
|
14075
|
+
} = props;
|
14076
|
+
const nonGroupedHeaders = table.getFooterGroups()[0].headers.filter(header => !header.column.getIsGrouped());
|
14077
|
+
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, {
|
13773
14078
|
key: header.id,
|
13774
14079
|
header: header,
|
13775
14080
|
index: index
|
@@ -13817,16 +14122,29 @@ const MemoedFooter = /*#__PURE__*/React__default.memo(function MemoedFooter(prop
|
|
13817
14122
|
});
|
13818
14123
|
|
13819
14124
|
function EmptyStateBody(props) {
|
14125
|
+
var _ref$current, _ref$current$parentNo;
|
13820
14126
|
const {
|
13821
14127
|
emptyState: Placeholder,
|
14128
|
+
isReady,
|
13822
14129
|
reason,
|
13823
14130
|
...attributes
|
13824
14131
|
} = props;
|
14132
|
+
const ref = React__default.useRef(null);
|
14133
|
+
if (!isReady) {
|
14134
|
+
return /*#__PURE__*/React__default.createElement("tbody", Object.assign({}, attributes, {
|
14135
|
+
className: "!auto-rows-fr"
|
14136
|
+
}));
|
14137
|
+
}
|
13825
14138
|
return /*#__PURE__*/React__default.createElement("tbody", Object.assign({}, attributes, {
|
13826
|
-
|
14139
|
+
ref: ref,
|
14140
|
+
className: "!auto-rows-fr",
|
14141
|
+
"data-taco": "empty-state"
|
13827
14142
|
}), /*#__PURE__*/React__default.createElement("tr", {
|
13828
|
-
className: "!auto-rows-fr"
|
14143
|
+
className: "!auto-rows-fr "
|
13829
14144
|
}, /*#__PURE__*/React__default.createElement("td", {
|
14145
|
+
style: {
|
14146
|
+
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
|
14147
|
+
},
|
13830
14148
|
className: "col-span-full !border-0 !p-0 hover:!bg-white"
|
13831
14149
|
}, Placeholder ? /*#__PURE__*/React__default.createElement(Placeholder, {
|
13832
14150
|
reason: reason
|
@@ -13845,6 +14163,7 @@ const SearchInput2 = /*#__PURE__*/React__default.forwardRef(function SearchInput
|
|
13845
14163
|
onClickFindPrevious: handleClickFindPrevious,
|
13846
14164
|
settingsContent,
|
13847
14165
|
shortcut,
|
14166
|
+
showTotal = true,
|
13848
14167
|
value,
|
13849
14168
|
...attributes
|
13850
14169
|
} = props;
|
@@ -13923,10 +14242,12 @@ const SearchInput2 = /*#__PURE__*/React__default.forwardRef(function SearchInput
|
|
13923
14242
|
}
|
13924
14243
|
if (hasFind && isActive) {
|
13925
14244
|
postfix = /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement("span", {
|
13926
|
-
className: "text-grey-700 flex h-4 items-center
|
13927
|
-
}, loading ? /*#__PURE__*/React__default.createElement(Spinner, {
|
14245
|
+
className: "text-grey-700 flex h-4 items-center"
|
14246
|
+
}, loading ? (/*#__PURE__*/React__default.createElement(Spinner, {
|
13928
14247
|
className: "h-4 w-4"
|
13929
|
-
}) :
|
14248
|
+
})) : showTotal ? (/*#__PURE__*/React__default.createElement("span", {
|
14249
|
+
className: "border-r border-black/[0.25] pr-2"
|
14250
|
+
}, `${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, {
|
13930
14251
|
"aria-label": texts.searchInput.findPrevious,
|
13931
14252
|
className: "scale-75 !bg-transparent hover:!bg-black/[0.08] [&>svg]:scale-125",
|
13932
14253
|
icon: "chevron-up",
|
@@ -14030,6 +14351,7 @@ function Search$1(props) {
|
|
14030
14351
|
const scrollTo = rowIndex => scrollToIndex(rowIndex, {
|
14031
14352
|
align: 'center'
|
14032
14353
|
});
|
14354
|
+
const hiddenColumns = getHiddenColumns(table.getState().columnVisibility);
|
14033
14355
|
React__default.useEffect(() => {
|
14034
14356
|
if (tableMeta.search.highlightedColumnIndexes.length) {
|
14035
14357
|
scrollTo(tableMeta.search.highlightedColumnIndexes[0][0]);
|
@@ -14038,9 +14360,11 @@ function Search$1(props) {
|
|
14038
14360
|
const handleFocus = function () {
|
14039
14361
|
try {
|
14040
14362
|
const _temp = function () {
|
14041
|
-
if (tableMeta.server.loadAllIfNeeded) {
|
14363
|
+
if (tableMeta.server.loadAllIfNeeded && !tableMeta.server._experimentalDataLoader2) {
|
14042
14364
|
// don't pass the search query because we need all data - not filtered data
|
14043
|
-
return Promise.resolve(tableMeta.server.loadAllIfNeeded(table.getState().sorting, table.getState().columnFilters
|
14365
|
+
return Promise.resolve(tableMeta.server.loadAllIfNeeded(table.getState().sorting, table.getState().columnFilters, hiddenColumns,
|
14366
|
+
// the old data loader doesn't have server side search
|
14367
|
+
undefined)).then(function () {});
|
14044
14368
|
}
|
14045
14369
|
}();
|
14046
14370
|
// load all data if that is possible
|
@@ -14049,8 +14373,20 @@ function Search$1(props) {
|
|
14049
14373
|
return Promise.reject(e);
|
14050
14374
|
}
|
14051
14375
|
};
|
14376
|
+
const [loading, setLoading] = React__default.useState(false);
|
14377
|
+
const searchTimeoutRef = React__default.useRef();
|
14052
14378
|
const handleChange = query => {
|
14053
14379
|
table.setGlobalFilter(String(query !== null && query !== void 0 ? query : ''));
|
14380
|
+
if (tableMeta.search.enableGlobalFilter && tableMeta.search.handleSearch) {
|
14381
|
+
clearTimeout(searchTimeoutRef.current);
|
14382
|
+
searchTimeoutRef.current = setTimeout(() => {
|
14383
|
+
var _tableMeta$search$han, _tableMeta$search;
|
14384
|
+
setLoading(true);
|
14385
|
+
(_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(() => {
|
14386
|
+
setLoading(false);
|
14387
|
+
});
|
14388
|
+
}, 150);
|
14389
|
+
}
|
14054
14390
|
};
|
14055
14391
|
const handleToggleExcludeUnmatchedResults = enabled => {
|
14056
14392
|
tableMeta.search.setEnableGlobalFilter(enabled, table);
|
@@ -14058,6 +14394,12 @@ function Search$1(props) {
|
|
14058
14394
|
var _ref$current;
|
14059
14395
|
return (_ref$current = ref.current) === null || _ref$current === void 0 ? void 0 : _ref$current.focus();
|
14060
14396
|
});
|
14397
|
+
if (tableMeta.search.handleSearch) {
|
14398
|
+
setLoading(true);
|
14399
|
+
tableMeta.search.handleSearch(enabled ? query : undefined, hiddenColumns).then(() => {
|
14400
|
+
setLoading(false);
|
14401
|
+
});
|
14402
|
+
}
|
14061
14403
|
};
|
14062
14404
|
const handleNextResult = () => {
|
14063
14405
|
if (!tableMeta.search.highlightedColumnIndexes.length) {
|
@@ -14101,7 +14443,7 @@ function Search$1(props) {
|
|
14101
14443
|
return /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement(SearchInput2, {
|
14102
14444
|
findCurrent: tableMeta.search.currentHighlightColumnIndex !== undefined ? tableMeta.search.currentHighlightColumnIndex + 1 : null,
|
14103
14445
|
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,
|
14104
|
-
loading: tableMeta.server.
|
14446
|
+
loading: tableMeta.server._experimentalDataLoader2 ? loading : tableMeta.server.loading,
|
14105
14447
|
name: "table-search",
|
14106
14448
|
onClickFindPrevious: handlePreviousResult,
|
14107
14449
|
onClickFindNext: handleNextResult,
|
@@ -14116,6 +14458,7 @@ function Search$1(props) {
|
|
14116
14458
|
meta: true,
|
14117
14459
|
shift: false
|
14118
14460
|
},
|
14461
|
+
showTotal: !tableMeta.server._experimentalDataLoader2,
|
14119
14462
|
value: query
|
14120
14463
|
}));
|
14121
14464
|
}
|
@@ -14469,9 +14812,11 @@ const Root = /*#__PURE__*/React__default.forwardRef(function CollectionRoot(prop
|
|
14469
14812
|
var _collection$querySele;
|
14470
14813
|
(_collection$querySele = collection.querySelector(`[aria-current]`)) === null || _collection$querySele === void 0 ? void 0 : _collection$querySele.removeAttribute('aria-current');
|
14471
14814
|
option.setAttribute('aria-current', 'true');
|
14472
|
-
|
14473
|
-
|
14474
|
-
|
14815
|
+
if (!props['aria-multiselectable']) {
|
14816
|
+
option.scrollIntoView({
|
14817
|
+
block: 'nearest'
|
14818
|
+
});
|
14819
|
+
}
|
14475
14820
|
setActiveIndex(index);
|
14476
14821
|
};
|
14477
14822
|
const setActiveIndexByElement = React__default.useCallback(option => {
|
@@ -14793,14 +15138,16 @@ const Tag$1 = /*#__PURE__*/React__default.forwardRef((props, ref) => {
|
|
14793
15138
|
ref: ref,
|
14794
15139
|
"data-taco": "tag"
|
14795
15140
|
}), /*#__PURE__*/React__default.createElement("span", {
|
14796
|
-
className: "truncate px-2",
|
15141
|
+
className: "flex items-center truncate px-2",
|
14797
15142
|
ref: textRef
|
14798
15143
|
}, icon ? typeof icon === 'string' ? (/*#__PURE__*/React__default.createElement(Icon, {
|
14799
15144
|
name: icon,
|
14800
|
-
className: "-ml-1
|
15145
|
+
className: "-ml-1 mr-1 !h-5 !w-5"
|
14801
15146
|
})) : (/*#__PURE__*/React__default.cloneElement(icon, {
|
14802
|
-
className: 'mr-1 -ml-1
|
14803
|
-
})) : null,
|
15147
|
+
className: cn(icon.props.className, 'mr-1 -ml-1')
|
15148
|
+
})) : null, /*#__PURE__*/React__default.createElement("span", {
|
15149
|
+
className: "truncate"
|
15150
|
+
}, children)), onDelete ? (/*#__PURE__*/React__default.createElement(Icon, {
|
14804
15151
|
name: "close",
|
14805
15152
|
onClick: onDelete,
|
14806
15153
|
className: "-ml-1.5 !h-6 !w-5 flex-shrink-0 cursor-pointer rounded-r p-0.5 hover:bg-black/5"
|
@@ -15077,12 +15424,13 @@ const Option$1 = /*#__PURE__*/React__default.forwardRef(function Select2Option(p
|
|
15077
15424
|
}), hasValue ? (/*#__PURE__*/React__default.createElement(Icon, {
|
15078
15425
|
name: "tick",
|
15079
15426
|
className: "pointer-events-none invisible -mx-0.5 !h-4 !w-4 group-aria-selected:visible"
|
15080
|
-
})) : null, isTag ? (/*#__PURE__*/React__default.createElement(Tag$1, {
|
15427
|
+
})) : null, typeof children !== 'string' ? (/*#__PURE__*/React__default.createElement("span", null, children)) : isTag ? (/*#__PURE__*/React__default.createElement(Tag$1, {
|
15081
15428
|
className: "pointer-events-none my-1",
|
15082
15429
|
color: color,
|
15083
15430
|
icon: prefix
|
15084
15431
|
}, children)) : (/*#__PURE__*/React__default.createElement(React__default.Fragment, null, prefix ? typeof prefix === 'string' ? /*#__PURE__*/React__default.createElement(Icon, {
|
15085
|
-
name: prefix
|
15432
|
+
name: prefix,
|
15433
|
+
className: "!h-5 !w-5"
|
15086
15434
|
}) : prefix : null, /*#__PURE__*/React__default.createElement("span", {
|
15087
15435
|
className: "flex w-full justify-between"
|
15088
15436
|
}, /*#__PURE__*/React__default.createElement("span", {
|
@@ -15091,9 +15439,10 @@ const Option$1 = /*#__PURE__*/React__default.forwardRef(function Select2Option(p
|
|
15091
15439
|
className: "text-grey-700 -mt-1.5 mb-1.5 text-xs"
|
15092
15440
|
}, description) : null), /*#__PURE__*/React__default.createElement("span", {
|
15093
15441
|
className: "flex flex-col self-center"
|
15094
|
-
}, postfix ? typeof postfix === 'string' ? /*#__PURE__*/React__default.createElement(Icon, {
|
15095
|
-
name: postfix
|
15096
|
-
|
15442
|
+
}, postfix ? typeof postfix === 'string' ? (/*#__PURE__*/React__default.createElement(Icon, {
|
15443
|
+
name: postfix,
|
15444
|
+
className: "!h-5 !w-5"
|
15445
|
+
})) : postfix : null)))), popover ? (/*#__PURE__*/React__default.createElement(IconButton, {
|
15097
15446
|
icon: "ellipsis-vertical",
|
15098
15447
|
appearance: "discrete",
|
15099
15448
|
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', {
|
@@ -15259,7 +15608,7 @@ const Single = /*#__PURE__*/React__default.forwardRef(function Select2TriggerSin
|
|
15259
15608
|
readOnly,
|
15260
15609
|
tags
|
15261
15610
|
} = useSelect2Context();
|
15262
|
-
const contentClassName = cn('truncate items-center gap-1');
|
15611
|
+
const contentClassName = cn('truncate flex items-center gap-1');
|
15263
15612
|
const currentValue = children.find(matchesValue(value));
|
15264
15613
|
let output;
|
15265
15614
|
if (placeholder && currentValue === undefined) {
|
@@ -15269,13 +15618,13 @@ const Single = /*#__PURE__*/React__default.forwardRef(function Select2TriggerSin
|
|
15269
15618
|
}, placeholder);
|
15270
15619
|
} else if (currentValue) {
|
15271
15620
|
if (tags && emptyValue !== value) {
|
15272
|
-
output = /*#__PURE__*/React__default.createElement(Tag$1, {
|
15621
|
+
if (typeof currentValue.props.children === 'string') output = /*#__PURE__*/React__default.createElement(Tag$1, {
|
15273
15622
|
className: "truncate",
|
15274
15623
|
color: currentValue.props.color,
|
15275
15624
|
disabled: disabled,
|
15276
15625
|
icon: currentValue.props.prefix,
|
15277
15626
|
readOnly: readOnly
|
15278
|
-
}, currentValue.props.children);
|
15627
|
+
}, currentValue.props.children);else output = currentValue.props.children;
|
15279
15628
|
} else {
|
15280
15629
|
output = /*#__PURE__*/React__default.createElement(React__default.Fragment, null, currentValue.props.prefix ? typeof currentValue.props.prefix === 'string' ? (/*#__PURE__*/React__default.createElement(Icon, {
|
15281
15630
|
name: currentValue.props.prefix,
|
@@ -15326,7 +15675,7 @@ const Multiple = /*#__PURE__*/React__default.forwardRef(function Select2TriggerM
|
|
15326
15675
|
}, valuesAsChildren.length === 0 ? (/*#__PURE__*/React__default.createElement(Placeholder, {
|
15327
15676
|
disabled: disabled,
|
15328
15677
|
readOnly: readOnly
|
15329
|
-
}, placeholder)) : valuesAsChildren.map(child => (/*#__PURE__*/React__default.createElement(Tag$1, {
|
15678
|
+
}, placeholder)) : valuesAsChildren.map(child => typeof child.props.children === 'string' ? (/*#__PURE__*/React__default.createElement(Tag$1, {
|
15330
15679
|
key: String(child.props.value),
|
15331
15680
|
className: "truncate",
|
15332
15681
|
color: tags ? child.props.color : undefined,
|
@@ -15340,7 +15689,23 @@ const Multiple = /*#__PURE__*/React__default.forwardRef(function Select2TriggerM
|
|
15340
15689
|
}
|
15341
15690
|
},
|
15342
15691
|
readOnly: readOnly
|
15343
|
-
}, child.props.children))
|
15692
|
+
}, child.props.children)) : (/*#__PURE__*/React__default.cloneElement(child.props.children, {
|
15693
|
+
key: String(child.props.value),
|
15694
|
+
className: '!pr-0 !pl-1.5',
|
15695
|
+
children: (/*#__PURE__*/React__default.createElement("span", {
|
15696
|
+
className: "flex items-center"
|
15697
|
+
}, child.props.children.props.children, /*#__PURE__*/React__default.createElement(Icon, {
|
15698
|
+
name: "close",
|
15699
|
+
onClick: event => {
|
15700
|
+
event === null || event === void 0 ? void 0 : event.stopPropagation();
|
15701
|
+
event === null || event === void 0 ? void 0 : event.preventDefault();
|
15702
|
+
if (!disabled && !readOnly) {
|
15703
|
+
setValue(child.props.value);
|
15704
|
+
}
|
15705
|
+
},
|
15706
|
+
className: "ml-0.5 !h-5 !w-5 shrink-0 cursor-pointer rounded-r p-0.5 hover:bg-black/5"
|
15707
|
+
})))
|
15708
|
+
})))));
|
15344
15709
|
} else {
|
15345
15710
|
content = /*#__PURE__*/React__default.createElement(MultipleValue, {
|
15346
15711
|
onClick: forwardClick,
|
@@ -15371,6 +15736,18 @@ const MultipleValue = ({
|
|
15371
15736
|
} = useSelect2Context();
|
15372
15737
|
const [contentRef, setContentRef] = React__default.useState(null);
|
15373
15738
|
const boundaryIndex = contentRef ? getIndexOfFirstChildOverflowingParent(contentRef, 30) : undefined;
|
15739
|
+
// Retrieves the relevant text content from any JSX.Element passed as a select option, handling nested elements, arrays, and direct text
|
15740
|
+
const getTooltipTitle = child => {
|
15741
|
+
const children = child.props.children;
|
15742
|
+
if (typeof children === 'string') return children;
|
15743
|
+
if (typeof children.props.children === 'string') {
|
15744
|
+
return children.props.children;
|
15745
|
+
}
|
15746
|
+
if (Array.isArray(children.props.children)) {
|
15747
|
+
return children.props.children.filter(item => typeof item === 'string');
|
15748
|
+
}
|
15749
|
+
return '';
|
15750
|
+
};
|
15374
15751
|
return /*#__PURE__*/React__default.createElement("div", {
|
15375
15752
|
className: "relative flex w-full items-center gap-1 overflow-hidden",
|
15376
15753
|
onClick: onClick
|
@@ -15381,26 +15758,35 @@ const MultipleValue = ({
|
|
15381
15758
|
disabled: disabled,
|
15382
15759
|
readOnly: readOnly
|
15383
15760
|
}, placeholder)) : valuesAsChildren.map((child, index) => {
|
15384
|
-
const
|
15385
|
-
|
15761
|
+
const classNames = {
|
15762
|
+
truncate: index === boundaryIndex,
|
15763
|
+
hidden: boundaryIndex !== undefined && boundaryIndex !== null ? index > boundaryIndex : false
|
15764
|
+
};
|
15765
|
+
let output;
|
15766
|
+
if (typeof child.props.children === 'string') {
|
15767
|
+
output = /*#__PURE__*/React__default.createElement(Tag$1, {
|
15768
|
+
key: String(child.props.value),
|
15769
|
+
className: cn('cursor-pointer', classNames),
|
15770
|
+
color: tags ? child.props.color : undefined,
|
15771
|
+
disabled: disabled,
|
15772
|
+
icon: child.props.prefix,
|
15773
|
+
readOnly: readOnly
|
15774
|
+
}, child.props.children);
|
15775
|
+
} else output = /*#__PURE__*/React__default.cloneElement(child.props.children, {
|
15386
15776
|
className: cn('cursor-pointer', {
|
15387
|
-
|
15388
|
-
|
15389
|
-
|
15390
|
-
|
15391
|
-
disabled: disabled,
|
15392
|
-
icon: child.props.prefix,
|
15393
|
-
readOnly: readOnly
|
15394
|
-
}, child.props.children);
|
15777
|
+
'shrink-0': index !== boundaryIndex
|
15778
|
+
}, classNames),
|
15779
|
+
key: String(child.props.value)
|
15780
|
+
});
|
15395
15781
|
if (index === boundaryIndex) {
|
15396
15782
|
return /*#__PURE__*/React__default.createElement(Tooltip, {
|
15397
15783
|
key: String(child.props.value),
|
15398
|
-
title: String(child
|
15399
|
-
},
|
15784
|
+
title: String(getTooltipTitle(child))
|
15785
|
+
}, output);
|
15400
15786
|
}
|
15401
|
-
return
|
15787
|
+
return output;
|
15402
15788
|
})), boundaryIndex !== undefined && boundaryIndex !== null && boundaryIndex < valuesAsChildren.length - 1 ? (/*#__PURE__*/React__default.createElement(Tooltip, {
|
15403
|
-
title: valuesAsChildren.slice(boundaryIndex + 1).map(child => child ? String(child
|
15789
|
+
title: valuesAsChildren.slice(boundaryIndex + 1).map(child => child ? String(getTooltipTitle(child)) : '').join(', ')
|
15404
15790
|
}, /*#__PURE__*/React__default.createElement(Badge, {
|
15405
15791
|
className: "flex-shrink-0"
|
15406
15792
|
}, "+", valuesAsChildren.length - (boundaryIndex + 1)))) : null);
|
@@ -15465,7 +15851,7 @@ const BubbleSelect = props => {
|
|
15465
15851
|
if (prevValue !== value && setValue) {
|
15466
15852
|
if (Array.isArray(value)) {
|
15467
15853
|
value.forEach(v => {
|
15468
|
-
const option = select.querySelector(`option[value='${v}']`);
|
15854
|
+
const option = select.querySelector(`option[value='${CSS.escape(v)}']`);
|
15469
15855
|
if (option) {
|
15470
15856
|
option.selected = true;
|
15471
15857
|
}
|
@@ -15593,20 +15979,19 @@ const useChildren = ({
|
|
15593
15979
|
};
|
15594
15980
|
|
15595
15981
|
const getNextColor = options => {
|
15596
|
-
|
15597
|
-
|
15598
|
-
|
15599
|
-
|
15600
|
-
|
15601
|
-
|
15602
|
-
|
15603
|
-
|
15604
|
-
}, {});
|
15605
|
-
options.forEach(option => {
|
15982
|
+
let occurrences = {};
|
15983
|
+
AVAILABLE_COLORS.filter(color => color !== 'transparent').forEach(color => {
|
15984
|
+
occurrences = {
|
15985
|
+
...occurrences,
|
15986
|
+
[color]: 0
|
15987
|
+
};
|
15988
|
+
});
|
15989
|
+
options.reduce((occurrences, option) => {
|
15606
15990
|
if (option.props.color) {
|
15607
15991
|
occurrences[option.props.color] = occurrences[option.props.color] ? occurrences[option.props.color] + 1 : 1;
|
15608
15992
|
}
|
15609
|
-
|
15993
|
+
return occurrences;
|
15994
|
+
}, occurrences);
|
15610
15995
|
const colors = Object.keys(occurrences);
|
15611
15996
|
if (colors.length) {
|
15612
15997
|
return colors.sort((a, b) => occurrences[a] - occurrences[b])[0];
|
@@ -16160,8 +16545,9 @@ function Print$1(props) {
|
|
16160
16545
|
const toastRef = toast.loading(texts.table.print.loading);
|
16161
16546
|
const _temp2 = function () {
|
16162
16547
|
if (tableMeta.server.isEnabled && tableMeta.server.loadAllIfNeeded) {
|
16548
|
+
const hiddenColumns = getHiddenColumns(table.getState().columnVisibility);
|
16163
16549
|
const _temp = _catch(function () {
|
16164
|
-
return Promise.resolve(tableMeta.server.loadAllIfNeeded(table.getState().sorting, table.getState().columnFilters)).then(function () {});
|
16550
|
+
return Promise.resolve(tableMeta.server.loadAllIfNeeded(table.getState().sorting, table.getState().columnFilters, hiddenColumns, tableMeta.search.enableGlobalFilter ? table.getState().globalFilter : undefined)).then(function () {});
|
16165
16551
|
}, function (error) {
|
16166
16552
|
const errorMessage = `${texts.table.print.error}: ${error}`;
|
16167
16553
|
console.error(errorMessage);
|
@@ -16275,10 +16661,11 @@ function guessComparatorsBasedOnControl(column) {
|
|
16275
16661
|
return getDataTypeProperties(columnMeta.dataType).filterComparators;
|
16276
16662
|
}
|
16277
16663
|
|
16664
|
+
const FilterContext = /*#__PURE__*/React__default.createContext([]);
|
16665
|
+
|
16278
16666
|
const FilterColumn = /*#__PURE__*/React__default.forwardRef((props, ref) => {
|
16279
16667
|
const {
|
16280
16668
|
allColumns,
|
16281
|
-
filters,
|
16282
16669
|
onChange: handleChange,
|
16283
16670
|
value = null,
|
16284
16671
|
...attributes
|
@@ -16286,6 +16673,7 @@ const FilterColumn = /*#__PURE__*/React__default.forwardRef((props, ref) => {
|
|
16286
16673
|
const {
|
16287
16674
|
texts
|
16288
16675
|
} = useLocalization();
|
16676
|
+
const filters = React__default.useContext(FilterContext);
|
16289
16677
|
const selectedColumn = allColumns.find(column => column.id === value);
|
16290
16678
|
const warning = selectedColumn && !selectedColumn.getIsVisible();
|
16291
16679
|
return /*#__PURE__*/React__default.createElement("div", {
|
@@ -16369,6 +16757,10 @@ function getComparatorText(comparator, texts, column) {
|
|
16369
16757
|
return texts.table.filters.comparators.hasAllOf;
|
16370
16758
|
case exports.TableFilterComparator.HasNoneOf:
|
16371
16759
|
return texts.table.filters.comparators.hasNoneOf;
|
16760
|
+
case exports.TableFilterComparator.IsOneOf:
|
16761
|
+
return texts.table.filters.comparators.isOneOf;
|
16762
|
+
case exports.TableFilterComparator.IsNoneOf:
|
16763
|
+
return texts.table.filters.comparators.isNoneOf;
|
16372
16764
|
default:
|
16373
16765
|
return '';
|
16374
16766
|
}
|
@@ -16451,6 +16843,7 @@ function Control(props) {
|
|
16451
16843
|
} = props;
|
16452
16844
|
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;
|
16453
16845
|
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;
|
16846
|
+
const filters = React__default.useContext(FilterContext);
|
16454
16847
|
const ref = React__default.useRef(null);
|
16455
16848
|
React.useEffect(() => {
|
16456
16849
|
// 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
|
@@ -16464,7 +16857,7 @@ function Control(props) {
|
|
16464
16857
|
setValue: value => onChange(value),
|
16465
16858
|
value,
|
16466
16859
|
ref
|
16467
|
-
}), {
|
16860
|
+
}, undefined, filters), {
|
16468
16861
|
['data-query-selector']: querySelector,
|
16469
16862
|
className: 'focus:yt-focus'
|
16470
16863
|
});
|
@@ -16506,7 +16899,6 @@ function Filter$1(props) {
|
|
16506
16899
|
const {
|
16507
16900
|
allColumns,
|
16508
16901
|
filter,
|
16509
|
-
filters,
|
16510
16902
|
onChange: handleChange,
|
16511
16903
|
onRemove,
|
16512
16904
|
position
|
@@ -16581,7 +16973,6 @@ function Filter$1(props) {
|
|
16581
16973
|
className: "flex min-h-[theme(spacing.8)] w-14 flex-shrink-0 items-center justify-end pr-2 text-right"
|
16582
16974
|
}, position > 0 ? texts.table.filters.conditions.and : texts.table.filters.conditions.where), /*#__PURE__*/React__default.createElement(FilterColumn, {
|
16583
16975
|
allColumns: allColumns,
|
16584
|
-
filters: filters,
|
16585
16976
|
onChange: handleChangeColumn,
|
16586
16977
|
value: id,
|
16587
16978
|
ref: ref
|
@@ -16685,7 +17076,9 @@ function ManageFiltersPopover(props) {
|
|
16685
17076
|
};
|
16686
17077
|
return /*#__PURE__*/React__default.createElement(Popover, Object.assign({}, popoverProps, {
|
16687
17078
|
onChange: handleClose
|
16688
|
-
}), /*#__PURE__*/React__default.createElement(Popover.Content, null, /*#__PURE__*/React__default.createElement(
|
17079
|
+
}), /*#__PURE__*/React__default.createElement(Popover.Content, null, /*#__PURE__*/React__default.createElement(FilterContext.Provider, {
|
17080
|
+
value: filters
|
17081
|
+
}, /*#__PURE__*/React__default.createElement("div", {
|
16689
17082
|
className: "flex w-[40rem] flex-col gap-4"
|
16690
17083
|
}, /*#__PURE__*/React__default.createElement("div", {
|
16691
17084
|
className: "flex h-8"
|
@@ -16701,7 +17094,6 @@ function ManageFiltersPopover(props) {
|
|
16701
17094
|
key: `filter_${index}`,
|
16702
17095
|
allColumns: allColumns,
|
16703
17096
|
filter: filter,
|
16704
|
-
filters: filters,
|
16705
17097
|
position: index,
|
16706
17098
|
onChange: handleChangeFilter,
|
16707
17099
|
onRemove: filters.length > 0 && filters.some(f => f.id) || filters.length > 1 ? handleRemoveFilter : undefined
|
@@ -16717,7 +17109,7 @@ function ManageFiltersPopover(props) {
|
|
16717
17109
|
}, texts.table.filters.buttons.clear), /*#__PURE__*/React__default.createElement(Button$1, {
|
16718
17110
|
appearance: "primary",
|
16719
17111
|
onClick: handleApply
|
16720
|
-
}, texts.table.filters.buttons.apply)))));
|
17112
|
+
}, texts.table.filters.buttons.apply))))));
|
16721
17113
|
}
|
16722
17114
|
|
16723
17115
|
function Filters(props) {
|
@@ -16820,7 +17212,7 @@ function Table(props) {
|
|
16820
17212
|
}
|
16821
17213
|
Table.Toolbar = TableToolbar;
|
16822
17214
|
Table.Grid = TableGrid;
|
16823
|
-
function
|
17215
|
+
function getEmptyStateReason(table) {
|
16824
17216
|
if (table.instance.getFilteredRowModel().rows.length === 0 && table.instance.getCoreRowModel().rows.length !== 0) {
|
16825
17217
|
const state = table.instance.getState();
|
16826
17218
|
if (table.meta.search.enableGlobalFilter && !!state.globalFilter) {
|
@@ -16837,13 +17229,14 @@ function TableGrid(props) {
|
|
16837
17229
|
var _table$state$grouping;
|
16838
17230
|
const {
|
16839
17231
|
enableHorizontalArrowKeyNavigation,
|
17232
|
+
footerRows,
|
16840
17233
|
table,
|
16841
17234
|
...attributes
|
16842
17235
|
} = props;
|
16843
17236
|
const handleFocus = table.meta.rowActive.rowActiveIndex === undefined ? event => {
|
16844
17237
|
table.meta.rowActive.handleFocus(event, table.meta.length, table.renderer.scrollToIndex);
|
16845
17238
|
} : undefined;
|
16846
|
-
const
|
17239
|
+
const emptyStateReason = getEmptyStateReason(table);
|
16847
17240
|
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, {
|
16848
17241
|
id: table.id,
|
16849
17242
|
"data-table-font-size": table.meta.fontSize.size,
|
@@ -16864,9 +17257,10 @@ function TableGrid(props) {
|
|
16864
17257
|
key: props.id,
|
16865
17258
|
header: props,
|
16866
17259
|
scrollToIndex: table.renderer.scrollToIndex
|
16867
|
-
}))))))),
|
17260
|
+
}))))))), emptyStateReason ? (/*#__PURE__*/React__default.createElement(EmptyStateBody, {
|
16868
17261
|
emptyState: props.table.props.emptyState,
|
16869
|
-
|
17262
|
+
isReady: table.meta.server.isEnabled ? table.meta.server.isReady : true,
|
17263
|
+
reason: emptyStateReason
|
16870
17264
|
})) : (/*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement(Body, {
|
16871
17265
|
enableHorizontalArrowKeyNavigation: enableHorizontalArrowKeyNavigation,
|
16872
17266
|
table: table.instance,
|
@@ -16878,12 +17272,11 @@ function TableGrid(props) {
|
|
16878
17272
|
} : table.renderer.style
|
16879
17273
|
}, table.renderer.rows, props.children), table.meta.footer.isEnabled ? /*#__PURE__*/React__default.createElement(Foot, {
|
16880
17274
|
table: table.instance
|
16881
|
-
}) : null)))));
|
17275
|
+
}, footerRows) : null)))));
|
16882
17276
|
}
|
16883
17277
|
|
16884
|
-
|
16885
|
-
|
16886
|
-
}
|
17278
|
+
const Column$1 = () => null;
|
17279
|
+
Column$1.displayName = 'Table3Column';
|
16887
17280
|
function Group$4(_) {
|
16888
17281
|
return null;
|
16889
17282
|
}
|
@@ -18471,19 +18864,26 @@ const shortcut = {
|
|
18471
18864
|
meta: true,
|
18472
18865
|
shift: false
|
18473
18866
|
};
|
18867
|
+
function isTableScrolled(ref) {
|
18868
|
+
if (ref.current) {
|
18869
|
+
var _ref$current, _ref$current$querySel, _ref$current2, _ref$current2$querySe;
|
18870
|
+
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');
|
18871
|
+
return height > ref.current.scrollHeight;
|
18872
|
+
}
|
18873
|
+
return false;
|
18874
|
+
}
|
18474
18875
|
|
18475
18876
|
function useTableEditingListener(table, tableRef, scrollToIndex) {
|
18476
18877
|
const tableMeta = table.options.meta;
|
18477
18878
|
const localization = useLocalization();
|
18478
|
-
// save when the row changes
|
18479
|
-
// store the last row active index, otherwise everytime tableMeta.editing.saveChanges changes the hook runs again
|
18480
|
-
const lastRowActiveIndexRef = React__default.useRef(tableMeta.rowActive.rowActiveIndex);
|
18481
18879
|
useLazyEffect(() => {
|
18482
|
-
|
18483
|
-
|
18484
|
-
|
18485
|
-
|
18486
|
-
|
18880
|
+
return () => {
|
18881
|
+
if (tableMeta.editing.isEditing && tableMeta.rowActive.rowActiveIndex !== undefined) {
|
18882
|
+
var _table$getRowModel$ro;
|
18883
|
+
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);
|
18884
|
+
}
|
18885
|
+
};
|
18886
|
+
}, [tableMeta.rowActive.rowActiveIndex]);
|
18487
18887
|
// show a warning if the user navigates away without triggering save, such as using the browser back/forward button
|
18488
18888
|
const hasChanges = tableMeta.editing.hasChanges();
|
18489
18889
|
React__default.useEffect(() => {
|
@@ -18509,9 +18909,9 @@ function useTableEditingListener(table, tableRef, scrollToIndex) {
|
|
18509
18909
|
const onClickOutside = event => {
|
18510
18910
|
if (tableMeta.editing.isEditing) {
|
18511
18911
|
const element = event.target;
|
18512
|
-
const
|
18912
|
+
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);
|
18513
18913
|
// users can click the white space below rows which could be inside the table, but a valid scenario to save
|
18514
|
-
if (!
|
18914
|
+
if (!isTableOrIsInsideTable) {
|
18515
18915
|
tableMeta.editing.saveChanges(table);
|
18516
18916
|
}
|
18517
18917
|
}
|
@@ -18519,18 +18919,13 @@ function useTableEditingListener(table, tableRef, scrollToIndex) {
|
|
18519
18919
|
document.addEventListener('click', onClickOutside);
|
18520
18920
|
return () => document.removeEventListener('click', onClickOutside);
|
18521
18921
|
}, [tableMeta.editing.isEditing, tableMeta.editing.saveChanges]);
|
18522
|
-
|
18523
|
-
|
18524
|
-
|
18525
|
-
|
18526
|
-
|
18527
|
-
|
18528
|
-
|
18529
|
-
} catch {
|
18530
|
-
tableMeta.editing.discardChanges(pendingChange.rowId, table);
|
18531
|
-
}
|
18532
|
-
});
|
18533
|
-
}, [rows.length]);
|
18922
|
+
React__default.useEffect(() => {
|
18923
|
+
if (tableMeta.editing.isEnabled) {
|
18924
|
+
tableMeta.rowActions.registerHandler('cleanup', rowId => {
|
18925
|
+
tableMeta.editing.discardChanges(rowId, table);
|
18926
|
+
});
|
18927
|
+
}
|
18928
|
+
}, []);
|
18534
18929
|
// shortcuts
|
18535
18930
|
useGlobalKeyDown(tableMeta.editing.isEnabled ? shortcut : undefined, event => {
|
18536
18931
|
event.preventDefault();
|
@@ -18558,6 +18953,7 @@ function reducer$2(state, action) {
|
|
18558
18953
|
{
|
18559
18954
|
const {
|
18560
18955
|
columnId,
|
18956
|
+
index,
|
18561
18957
|
row,
|
18562
18958
|
value
|
18563
18959
|
} = payload;
|
@@ -18567,7 +18963,8 @@ function reducer$2(state, action) {
|
|
18567
18963
|
...state.changes,
|
18568
18964
|
rows: setWith(state.changes.rows, `${rowId}.${columnId}`, value, Object),
|
18569
18965
|
originals: setWith(state.changes.originals, rowId, row, Object)
|
18570
|
-
}
|
18966
|
+
},
|
18967
|
+
indexes: setWith(state.indexes, rowId, index, Object)
|
18571
18968
|
};
|
18572
18969
|
}
|
18573
18970
|
case 'removeCellValue':
|
@@ -18601,6 +18998,7 @@ function reducer$2(state, action) {
|
|
18601
18998
|
{
|
18602
18999
|
const {
|
18603
19000
|
cellErrors,
|
19001
|
+
index,
|
18604
19002
|
moveReasons,
|
18605
19003
|
original,
|
18606
19004
|
value
|
@@ -18610,12 +19008,13 @@ function reducer$2(state, action) {
|
|
18610
19008
|
changes: {
|
18611
19009
|
...state.changes,
|
18612
19010
|
rows: setWith(state.changes.rows, rowId, value, Object),
|
18613
|
-
errors: setWith(state.changes.errors, `${rowId}.cells`, cellErrors !== null && cellErrors !== void 0 ? cellErrors : state.changes.errors
|
19011
|
+
errors: setWith(state.changes.errors, `${rowId}.cells`, cellErrors !== null && cellErrors !== void 0 ? cellErrors : state.changes.errors[rowId], Object),
|
18614
19012
|
originals: setWith(state.changes.originals, rowId, original !== null && original !== void 0 ? original : state.changes.originals[rowId], Object),
|
18615
19013
|
moveReasons: setWith(state.changes.moveReasons, rowId, moveReasons !== null && moveReasons !== void 0 ? moveReasons : state.changes.moveReasons[rowId], Object),
|
18616
19014
|
// status can be undefined, so don't use ??
|
18617
19015
|
status: setWith(state.changes.status, rowId, undefined, Object)
|
18618
|
-
}
|
19016
|
+
},
|
19017
|
+
indexes: setWith(state.indexes, rowId, index, Object)
|
18619
19018
|
};
|
18620
19019
|
}
|
18621
19020
|
case 'removeRow':
|
@@ -18633,6 +19032,7 @@ function reducer$2(state, action) {
|
|
18633
19032
|
originals: omit(state.changes.originals, rowId),
|
18634
19033
|
status: omit(state.changes.status, rowId)
|
18635
19034
|
},
|
19035
|
+
indexes: omit(state.indexes, rowId),
|
18636
19036
|
temporaryRows: state.temporaryRows.filter(row => row[rowIdentityAccessor] !== rowId)
|
18637
19037
|
};
|
18638
19038
|
}
|
@@ -18662,9 +19062,10 @@ function reducer$2(state, action) {
|
|
18662
19062
|
}
|
18663
19063
|
};
|
18664
19064
|
}
|
18665
|
-
case '
|
19065
|
+
case 'insertTemporaryRow':
|
18666
19066
|
{
|
18667
19067
|
const {
|
19068
|
+
index,
|
18668
19069
|
value
|
18669
19070
|
} = payload;
|
18670
19071
|
return {
|
@@ -18674,14 +19075,36 @@ function reducer$2(state, action) {
|
|
18674
19075
|
...state.changes,
|
18675
19076
|
rows: setWith(state.changes.rows, rowId, value, Object),
|
18676
19077
|
originals: setWith(state.changes.originals, rowId, value, Object)
|
18677
|
-
}
|
19078
|
+
},
|
19079
|
+
indexes: setWith(state.indexes, rowId, index, Object)
|
18678
19080
|
};
|
18679
19081
|
}
|
18680
19082
|
default:
|
18681
19083
|
return state;
|
18682
19084
|
}
|
18683
19085
|
}
|
18684
|
-
function usePendingChangesState(handleSave, handleChange, rowIdentityAccessor, validator) {
|
19086
|
+
function usePendingChangesState(handleSave, handleChange, handleDiscard, rowIdentityAccessor, validator) {
|
19087
|
+
const discardChanges = function (rowId, table) {
|
19088
|
+
try {
|
19089
|
+
// remove any new rows from pinned state before discarding them
|
19090
|
+
table.resetRowPinning(true);
|
19091
|
+
dispatch({
|
19092
|
+
type: 'removeRow',
|
19093
|
+
rowId,
|
19094
|
+
payload: {
|
19095
|
+
rowIdentityAccessor
|
19096
|
+
}
|
19097
|
+
});
|
19098
|
+
const _temp8 = function () {
|
19099
|
+
if (typeof handleDiscard === 'function') {
|
19100
|
+
return Promise.resolve(handleDiscard()).then(function () {});
|
19101
|
+
}
|
19102
|
+
}();
|
19103
|
+
return Promise.resolve(_temp8 && _temp8.then ? _temp8.then(function () {}) : void 0);
|
19104
|
+
} catch (e) {
|
19105
|
+
return Promise.reject(e);
|
19106
|
+
}
|
19107
|
+
};
|
18685
19108
|
const saveChanges = function (table, rowId = undefined) {
|
18686
19109
|
try {
|
18687
19110
|
let _exit = false;
|
@@ -18694,35 +19117,38 @@ function usePendingChangesState(handleSave, handleChange, rowIdentityAccessor, v
|
|
18694
19117
|
[rowId]: state.changes.rows[rowId]
|
18695
19118
|
} : state.changes.rows;
|
18696
19119
|
let completed = true;
|
18697
|
-
const
|
19120
|
+
const _temp7 = _forOf(Object.keys(changes), function (rowId) {
|
18698
19121
|
const status = getRowStatus(rowId);
|
18699
19122
|
return _catch(function () {
|
18700
|
-
|
19123
|
+
var _changes$rowId;
|
19124
|
+
function _temp6(_result) {
|
18701
19125
|
return _exit ? _result : Promise.resolve(handleSave(changeSet)).then(function () {
|
18702
19126
|
// cleanup changes, we don't need them after saving
|
18703
|
-
discardChanges(rowId, table)
|
18704
|
-
|
18705
|
-
|
18706
|
-
|
18707
|
-
|
18708
|
-
|
19127
|
+
return Promise.resolve(discardChanges(rowId, table)).then(function () {
|
19128
|
+
// show the saved status, then remove it after a delay
|
19129
|
+
setRowStatus(rowId, 'saved');
|
19130
|
+
setTimeout(() => {
|
19131
|
+
setRowStatus(rowId, undefined);
|
19132
|
+
}, DELAY_BEFORE_REMOVING_SAVE_STATUS);
|
19133
|
+
});
|
18709
19134
|
});
|
18710
19135
|
}
|
19136
|
+
const rowChanges = (_changes$rowId = changes[rowId]) !== null && _changes$rowId !== void 0 ? _changes$rowId : {};
|
18711
19137
|
// don't try to save if - already saving, or there are known errors
|
18712
|
-
if (status === 'saving' || status === 'errored') {
|
19138
|
+
if (!Object.keys(rowChanges).length || status === 'saving' || status === 'errored') {
|
18713
19139
|
return;
|
18714
19140
|
}
|
18715
19141
|
setRowStatus(rowId, 'saving');
|
18716
19142
|
const changeSet = {
|
18717
19143
|
...state.changes.originals[rowId],
|
18718
|
-
...
|
19144
|
+
...rowChanges
|
18719
19145
|
};
|
18720
19146
|
// if we had to create a temporary id, delete it first - it's our data, not theirs
|
18721
19147
|
if (isTemporaryRow(changeSet[rowIdentityAccessor])) {
|
18722
19148
|
delete changeSet[rowIdentityAccessor];
|
18723
19149
|
}
|
18724
19150
|
// re-run validation, maybe a cell is already invalid but has never been blurred
|
18725
|
-
const
|
19151
|
+
const _temp5 = function () {
|
18726
19152
|
if (validator) {
|
18727
19153
|
return Promise.resolve(validator(changeSet)).then(function (errors) {
|
18728
19154
|
if (errors && Object.keys(errors).length) {
|
@@ -18731,7 +19157,7 @@ function usePendingChangesState(handleSave, handleChange, rowIdentityAccessor, v
|
|
18731
19157
|
});
|
18732
19158
|
}
|
18733
19159
|
}();
|
18734
|
-
return
|
19160
|
+
return _temp5 && _temp5.then ? _temp5.then(_temp6) : _temp6(_temp5); // send new data to the server
|
18735
19161
|
}, function (error) {
|
18736
19162
|
var _error$response;
|
18737
19163
|
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) {
|
@@ -18771,18 +19197,18 @@ function usePendingChangesState(handleSave, handleChange, rowIdentityAccessor, v
|
|
18771
19197
|
}, function () {
|
18772
19198
|
return _exit;
|
18773
19199
|
});
|
18774
|
-
return Promise.resolve(
|
19200
|
+
return Promise.resolve(_temp7 && _temp7.then ? _temp7.then(function (_result3) {
|
18775
19201
|
return _exit ? _result3 : completed;
|
18776
|
-
}) : _exit ?
|
19202
|
+
}) : _exit ? _temp7 : completed);
|
18777
19203
|
} catch (e) {
|
18778
19204
|
return Promise.reject(e);
|
18779
19205
|
}
|
18780
19206
|
};
|
18781
|
-
const onCellChanged = function (cell, rowIndex, shouldRunUpdaters = true) {
|
19207
|
+
const onCellChanged = function (cell, rowIndex, nextValue, shouldRunUpdaters = true) {
|
18782
19208
|
try {
|
18783
|
-
function
|
19209
|
+
function _temp4() {
|
18784
19210
|
var _state$changes$errors11;
|
18785
|
-
function
|
19211
|
+
function _temp2() {
|
18786
19212
|
// only set errors and move reasons for the cells we're currently acting on
|
18787
19213
|
// why? because the UX is not good if we set them for cells the user hasn't touched yet
|
18788
19214
|
const cellsToActOn = [cell.column.id, ...Object.keys(updatesForOtherCells)];
|
@@ -18813,6 +19239,7 @@ function usePendingChangesState(handleSave, handleChange, rowIdentityAccessor, v
|
|
18813
19239
|
rowId: cell.row.id,
|
18814
19240
|
payload: {
|
18815
19241
|
cellErrors: nextCellErrors,
|
19242
|
+
index: rowIndex,
|
18816
19243
|
moveReasons: nextMoveReasons,
|
18817
19244
|
value: nextChanges
|
18818
19245
|
}
|
@@ -18820,7 +19247,7 @@ function usePendingChangesState(handleSave, handleChange, rowIdentityAccessor, v
|
|
18820
19247
|
}
|
18821
19248
|
// create a projection of the next state, so we can act against it
|
18822
19249
|
const nextChanges = {
|
18823
|
-
...
|
19250
|
+
...changes,
|
18824
19251
|
...updatesForOtherCells
|
18825
19252
|
};
|
18826
19253
|
const nextMoveReasons = {
|
@@ -18829,29 +19256,35 @@ function usePendingChangesState(handleSave, handleChange, rowIdentityAccessor, v
|
|
18829
19256
|
const nextCellErrors = {
|
18830
19257
|
...((_state$changes$errors11 = state.changes.errors[cell.row.id]) === null || _state$changes$errors11 === void 0 ? void 0 : _state$changes$errors11.cells)
|
18831
19258
|
};
|
18832
|
-
// run validation
|
19259
|
+
// run validation - if there are changes, and if there is an original stored
|
18833
19260
|
let validationErrors = {};
|
18834
|
-
const
|
18835
|
-
if (validator) {
|
19261
|
+
const _temp = function () {
|
19262
|
+
if (validator && Object.keys(nextChanges).length && state.changes.originals[cell.row.id]) {
|
19263
|
+
// merge with the original so we get a full row
|
18836
19264
|
const nextRowValue = {
|
18837
19265
|
...state.changes.originals[cell.row.id],
|
18838
19266
|
...changes,
|
18839
19267
|
...updatesForOtherCells
|
18840
19268
|
};
|
18841
|
-
return Promise.resolve(validator(nextRowValue)).then(function (
|
18842
|
-
validationErrors =
|
19269
|
+
return Promise.resolve(validator(nextRowValue)).then(function (_validator) {
|
19270
|
+
validationErrors = _validator !== null && _validator !== void 0 ? _validator : {};
|
18843
19271
|
});
|
18844
19272
|
}
|
18845
19273
|
}();
|
18846
|
-
return
|
19274
|
+
return _temp && _temp.then ? _temp.then(_temp2) : _temp2(_temp);
|
18847
19275
|
}
|
18848
|
-
const changes =
|
18849
|
-
|
19276
|
+
const changes = nextValue !== undefined ? {
|
19277
|
+
...state.changes.rows[cell.row.id],
|
19278
|
+
[cell.column.id]: nextValue
|
19279
|
+
} : {
|
19280
|
+
...state.changes.rows[cell.row.id]
|
19281
|
+
};
|
19282
|
+
if (!Object.keys(changes).length) {
|
18850
19283
|
return Promise.resolve();
|
18851
19284
|
}
|
18852
19285
|
let updatesForOtherCells = {};
|
18853
19286
|
// run the updater handler if there is one, to see if there are any other cells to update
|
18854
|
-
const
|
19287
|
+
const _temp3 = function () {
|
18855
19288
|
if (typeof handleChange === 'function' && shouldRunUpdaters) {
|
18856
19289
|
const previousRowValue = {
|
18857
19290
|
...state.changes.originals[cell.row.id]
|
@@ -18865,42 +19298,11 @@ function usePendingChangesState(handleSave, handleChange, rowIdentityAccessor, v
|
|
18865
19298
|
});
|
18866
19299
|
}
|
18867
19300
|
}();
|
18868
|
-
return Promise.resolve(
|
19301
|
+
return Promise.resolve(_temp3 && _temp3.then ? _temp3.then(_temp4) : _temp4(_temp3));
|
18869
19302
|
} catch (e) {
|
18870
19303
|
return Promise.reject(e);
|
18871
19304
|
}
|
18872
19305
|
}; // general
|
18873
|
-
// rows
|
18874
|
-
const setRowValue = function (rowId, original, value) {
|
18875
|
-
try {
|
18876
|
-
function _temp2() {
|
18877
|
-
dispatch({
|
18878
|
-
type: 'updateRow',
|
18879
|
-
rowId,
|
18880
|
-
payload: {
|
18881
|
-
cellErrors,
|
18882
|
-
original,
|
18883
|
-
value
|
18884
|
-
}
|
18885
|
-
});
|
18886
|
-
}
|
18887
|
-
let cellErrors;
|
18888
|
-
const _temp = function () {
|
18889
|
-
if (validator) {
|
18890
|
-
const row = {
|
18891
|
-
...original,
|
18892
|
-
...value
|
18893
|
-
};
|
18894
|
-
return Promise.resolve(validator(row)).then(function (_validator) {
|
18895
|
-
cellErrors = _validator !== null && _validator !== void 0 ? _validator : {};
|
18896
|
-
});
|
18897
|
-
}
|
18898
|
-
}();
|
18899
|
-
return Promise.resolve(_temp && _temp.then ? _temp.then(_temp2) : _temp2(_temp));
|
18900
|
-
} catch (e) {
|
18901
|
-
return Promise.reject(e);
|
18902
|
-
}
|
18903
|
-
};
|
18904
19306
|
const localization = useLocalization();
|
18905
19307
|
const [state, dispatch] = React__default.useReducer(reducer$2, {
|
18906
19308
|
changes: {
|
@@ -18910,8 +19312,10 @@ function usePendingChangesState(handleSave, handleChange, rowIdentityAccessor, v
|
|
18910
19312
|
originals: {},
|
18911
19313
|
status: {}
|
18912
19314
|
},
|
19315
|
+
indexes: {},
|
18913
19316
|
temporaryRows: []
|
18914
19317
|
});
|
19318
|
+
// rows
|
18915
19319
|
function getRowValue(rowId) {
|
18916
19320
|
var _state$changes$rows$r, _state$changes$rows;
|
18917
19321
|
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;
|
@@ -18949,23 +19353,24 @@ function usePendingChangesState(handleSave, handleChange, rowIdentityAccessor, v
|
|
18949
19353
|
}
|
18950
19354
|
});
|
18951
19355
|
}
|
18952
|
-
function
|
19356
|
+
function insertTemporaryRow(data, rowIndex) {
|
18953
19357
|
const newRowId = `${TEMPORARY_ROW_ID_PREFIX}${uuid.v4()}`;
|
18954
19358
|
const value = {
|
18955
19359
|
...data,
|
18956
19360
|
[rowIdentityAccessor]: newRowId
|
18957
19361
|
};
|
18958
19362
|
dispatch({
|
18959
|
-
type: '
|
19363
|
+
type: 'insertTemporaryRow',
|
18960
19364
|
rowId: newRowId,
|
18961
19365
|
payload: {
|
19366
|
+
index: rowIndex,
|
18962
19367
|
value
|
18963
19368
|
}
|
18964
19369
|
});
|
18965
19370
|
return newRowId;
|
18966
19371
|
}
|
18967
19372
|
// cells
|
18968
|
-
function setCellValue(cell, value) {
|
19373
|
+
function setCellValue(cell, rowIndex, value) {
|
18969
19374
|
const rowId = cell.row.id;
|
18970
19375
|
const columnId = cell.column.id;
|
18971
19376
|
// update if the change is different to the original value
|
@@ -18975,6 +19380,7 @@ function usePendingChangesState(handleSave, handleChange, rowIdentityAccessor, v
|
|
18975
19380
|
rowId,
|
18976
19381
|
payload: {
|
18977
19382
|
columnId,
|
19383
|
+
index: rowIndex,
|
18978
19384
|
row: cell.row.original,
|
18979
19385
|
value
|
18980
19386
|
}
|
@@ -19007,6 +19413,7 @@ function usePendingChangesState(handleSave, handleChange, rowIdentityAccessor, v
|
|
19007
19413
|
}
|
19008
19414
|
return rowsWithErrors.filter(hasRowErrorsShownInAlert).map(rowId => ({
|
19009
19415
|
rowId,
|
19416
|
+
index: state.indexes[rowId],
|
19010
19417
|
changes: state.changes.rows[rowId],
|
19011
19418
|
errors: state.changes.errors[rowId]
|
19012
19419
|
}));
|
@@ -19017,20 +19424,8 @@ function usePendingChangesState(handleSave, handleChange, rowIdentityAccessor, v
|
|
19017
19424
|
function hasChanges(rowId) {
|
19018
19425
|
return rowId ? !!state.changes.rows[rowId] : !!Object.keys(state.changes.rows).length;
|
19019
19426
|
}
|
19020
|
-
function discardChanges(rowId, table) {
|
19021
|
-
// remove any new rows from pinned state before discarding them
|
19022
|
-
table.resetRowPinning(true);
|
19023
|
-
dispatch({
|
19024
|
-
type: 'removeRow',
|
19025
|
-
rowId,
|
19026
|
-
payload: {
|
19027
|
-
rowIdentityAccessor
|
19028
|
-
}
|
19029
|
-
});
|
19030
|
-
}
|
19031
19427
|
return {
|
19032
19428
|
// row
|
19033
|
-
setRowValue,
|
19034
19429
|
getRowValue,
|
19035
19430
|
getRowMoveReason,
|
19036
19431
|
hasRowErrors,
|
@@ -19050,12 +19445,66 @@ function usePendingChangesState(handleSave, handleChange, rowIdentityAccessor, v
|
|
19050
19445
|
discardChanges,
|
19051
19446
|
hasSaved,
|
19052
19447
|
// new rows
|
19053
|
-
|
19448
|
+
insertTemporaryRow,
|
19054
19449
|
temporaryRows: state.temporaryRows
|
19055
19450
|
};
|
19056
19451
|
}
|
19057
19452
|
|
19058
|
-
function useTableEditing(isEnabled = false, handleSave, handleChange, rowIdentityAccessor, validator) {
|
19453
|
+
function useTableEditing(isEnabled = false, handleSave, handleChange, handleCreate, handleDiscard, rowIdentityAccessor, validator) {
|
19454
|
+
const createRow = function (table, row) {
|
19455
|
+
try {
|
19456
|
+
let _exit = false;
|
19457
|
+
function _temp2(_result) {
|
19458
|
+
if (_exit) return _result;
|
19459
|
+
const changeset = row !== null && row !== void 0 ? row : handleCreate();
|
19460
|
+
try {
|
19461
|
+
if (changeset) {
|
19462
|
+
// set the active row to the new row before toggling editing on
|
19463
|
+
const temporaryRows = tableMeta.editing.temporaryRows;
|
19464
|
+
const nextRowIndex = temporaryRows.length ? tableMeta.length + 1 : tableMeta.length;
|
19465
|
+
const newRowId = pendingChangesFns.insertTemporaryRow(changeset, nextRowIndex);
|
19466
|
+
// prep the row
|
19467
|
+
table.setRowPinning(currentState => {
|
19468
|
+
var _ref, _currentState$bottom;
|
19469
|
+
return {
|
19470
|
+
...currentState,
|
19471
|
+
bottom: (_ref = (_currentState$bottom = currentState.bottom) !== null && _currentState$bottom !== void 0 ? _currentState$bottom : []) === null || _ref === void 0 ? void 0 : _ref.concat(newRowId)
|
19472
|
+
};
|
19473
|
+
});
|
19474
|
+
// prep editing mode
|
19475
|
+
toggleDetailedMode(false);
|
19476
|
+
setLastFocusedCellIndex(undefined);
|
19477
|
+
// wait until set states have run
|
19478
|
+
requestAnimationFrame(() => {
|
19479
|
+
tableMeta.rowActive.setRowActiveIndex(nextRowIndex);
|
19480
|
+
table.resetRowSelection();
|
19481
|
+
if (!tableMeta.editing.isEditing) {
|
19482
|
+
setEditing(true);
|
19483
|
+
}
|
19484
|
+
});
|
19485
|
+
}
|
19486
|
+
} catch (error) {
|
19487
|
+
console.error(error);
|
19488
|
+
}
|
19489
|
+
}
|
19490
|
+
if (!handleCreate) {
|
19491
|
+
return Promise.resolve();
|
19492
|
+
}
|
19493
|
+
const tableMeta = table.options.meta;
|
19494
|
+
const _temp = function () {
|
19495
|
+
if (tableMeta.rowActive.rowActiveIndex !== undefined) {
|
19496
|
+
return Promise.resolve(tableMeta.editing.saveChanges(table)).then(function (saved) {
|
19497
|
+
if (!saved) {
|
19498
|
+
_exit = true;
|
19499
|
+
}
|
19500
|
+
});
|
19501
|
+
}
|
19502
|
+
}();
|
19503
|
+
return Promise.resolve(_temp && _temp.then ? _temp.then(_temp2) : _temp2(_temp));
|
19504
|
+
} catch (e) {
|
19505
|
+
return Promise.reject(e);
|
19506
|
+
}
|
19507
|
+
};
|
19059
19508
|
// used to switch the table into editing mode
|
19060
19509
|
const [isEditing, setEditing] = React__default.useState(false);
|
19061
19510
|
// used to switch the editing between "detailed" mode
|
@@ -19064,26 +19513,27 @@ function useTableEditing(isEnabled = false, handleSave, handleChange, rowIdentit
|
|
19064
19513
|
const createRowButtonRef = React__default.useRef(null);
|
19065
19514
|
// store the last focused cell, so that up/down arrow key navigation remains in the same column
|
19066
19515
|
const [lastFocusedCellIndex, setLastFocusedCellIndex] = React__default.useState(undefined);
|
19067
|
-
const pendingChangesFns = usePendingChangesState(handleSave, handleChange, rowIdentityAccessor, validator);
|
19516
|
+
const pendingChangesFns = usePendingChangesState(handleSave, handleChange, handleDiscard, rowIdentityAccessor, validator);
|
19068
19517
|
function toggleEditing(enabled, table, scrollToIndex) {
|
19069
|
-
|
19070
|
-
if (
|
19071
|
-
|
19072
|
-
|
19518
|
+
const tableMeta = table.options.meta;
|
19519
|
+
if (enabled) {
|
19520
|
+
var _tableMeta$rowActive$, _table$getRowModel$ro;
|
19521
|
+
const index = (_tableMeta$rowActive$ = tableMeta.rowActive.rowActiveIndex) !== null && _tableMeta$rowActive$ !== void 0 ? _tableMeta$rowActive$ : 0;
|
19522
|
+
if (tableMeta.rowActive.rowActiveIndex === undefined) {
|
19523
|
+
console.log('edit toggle active', index);
|
19524
|
+
tableMeta.rowActive.setRowActiveIndex(index);
|
19525
|
+
}
|
19526
|
+
if (!isTemporaryRow((_table$getRowModel$ro = table.getRowModel().rows[index]) === null || _table$getRowModel$ro === void 0 ? void 0 : _table$getRowModel$ro.id)) {
|
19527
|
+
scrollToIndex(index);
|
19528
|
+
}
|
19529
|
+
} else if (!enabled) {
|
19073
19530
|
// reset detailed mode
|
19074
19531
|
toggleDetailedMode(false);
|
19075
19532
|
// reset the last index back to the first focusable element, when editing gets turned off
|
19076
19533
|
setLastFocusedCellIndex(undefined);
|
19077
19534
|
}
|
19078
|
-
const tableMeta = table.options.meta;
|
19079
|
-
const index = (_tableMeta$rowActive$ = tableMeta.rowActive.rowActiveIndex) !== null && _tableMeta$rowActive$ !== void 0 ? _tableMeta$rowActive$ : 0;
|
19080
|
-
if (tableMeta.rowActive.rowActiveIndex === undefined) {
|
19081
|
-
tableMeta.rowActive.setRowActiveIndex(index);
|
19082
|
-
}
|
19083
19535
|
setEditing(enabled);
|
19084
|
-
|
19085
|
-
scrollToIndex(index);
|
19086
|
-
}
|
19536
|
+
pendingChangesFns.saveChanges(table);
|
19087
19537
|
}
|
19088
19538
|
return {
|
19089
19539
|
isEnabled,
|
@@ -19093,6 +19543,7 @@ function useTableEditing(isEnabled = false, handleSave, handleChange, rowIdentit
|
|
19093
19543
|
toggleEditing: isEnabled ? toggleEditing : () => undefined,
|
19094
19544
|
lastFocusedCellIndex,
|
19095
19545
|
setLastFocusedCellIndex,
|
19546
|
+
createRow,
|
19096
19547
|
createRowButtonRef,
|
19097
19548
|
...pendingChangesFns
|
19098
19549
|
};
|
@@ -19349,24 +19800,30 @@ function EditingControlCell(props) {
|
|
19349
19800
|
var _cellRef$current;
|
19350
19801
|
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"]'));
|
19351
19802
|
}, [cellRef.current]);
|
19352
|
-
const handleChange = nextValue => {
|
19803
|
+
const handleChange = React__default.useCallback(nextValue => {
|
19353
19804
|
if (nextValue !== value) {
|
19354
|
-
tableMeta.editing.setCellValue(cell, nextValue);
|
19805
|
+
tableMeta.editing.setCellValue(cell, rowIndex, nextValue);
|
19355
19806
|
if (hasNonTextControl) {
|
19356
|
-
tableMeta.editing.onCellChanged(cell, rowIndex);
|
19807
|
+
requestAnimationFrame(() => tableMeta.editing.onCellChanged(cell, rowIndex, nextValue));
|
19357
19808
|
}
|
19358
19809
|
}
|
19359
|
-
};
|
19360
|
-
const
|
19810
|
+
}, [hasNonTextControl, cell.row.id, cell.column.id, cell.row.original, rowIndex, value]);
|
19811
|
+
const blur = React__default.useCallback(function blur() {
|
19361
19812
|
tableMeta.editing.toggleDetailedMode(false);
|
19362
|
-
tableMeta.editing.onCellChanged(cell, rowIndex, !hasNonTextControl);
|
19363
|
-
};
|
19813
|
+
tableMeta.editing.onCellChanged(cell, rowIndex, undefined, !hasNonTextControl);
|
19814
|
+
}, [hasNonTextControl, cell.row.id, cell.column.id, cell.row.original, rowIndex]);
|
19815
|
+
const handleBlur = React__default.useCallback(event => {
|
19816
|
+
if (isElementInsideOrTriggeredFromContainer(event.relatedTarget, event.currentTarget)) {
|
19817
|
+
return;
|
19818
|
+
}
|
19819
|
+
blur();
|
19820
|
+
}, [blur]);
|
19364
19821
|
// ensure that blur runs when the cell gets unmounted (when vertically arrow key navigating)
|
19365
19822
|
React__default.useEffect(() => {
|
19366
19823
|
const ref = cellRef.current;
|
19367
19824
|
return () => {
|
19368
19825
|
if (document.activeElement === ref || isElementInsideOrTriggeredFromContainer(document.activeElement, ref)) {
|
19369
|
-
|
19826
|
+
blur();
|
19370
19827
|
}
|
19371
19828
|
};
|
19372
19829
|
}, []);
|
@@ -19514,11 +19971,21 @@ const MemoedEditingCell = /*#__PURE__*/React__default.memo(function MemoedEditin
|
|
19514
19971
|
props.onChange(newDate);
|
19515
19972
|
}
|
19516
19973
|
};
|
19974
|
+
const handleDatepickerInputKeyDown = event => {
|
19975
|
+
// When in detailed mode, we want to handle the change, when 'Enter' is pressed.
|
19976
|
+
// To make it possible, we just need to prevent handleInputKeyDown from being executed, and give the full control to Datepicker,
|
19977
|
+
// by doing this, Datepicker will exit "detailed mode" by itself when a valid date change event is triggered.
|
19978
|
+
// In any other cases we'll just execute the "handleInputKeyDown" handler.
|
19979
|
+
if (isDetailedMode && event.key === 'Enter' && event.target.value !== '') {
|
19980
|
+
return;
|
19981
|
+
}
|
19982
|
+
handleInputKeyDown(event);
|
19983
|
+
};
|
19517
19984
|
return /*#__PURE__*/React__default.createElement(Datepicker, Object.assign({}, commonProps, {
|
19518
19985
|
invalid: invalid,
|
19519
19986
|
onChange: handleChange,
|
19520
19987
|
onFocus: handleFocus,
|
19521
|
-
onKeyDown:
|
19988
|
+
onKeyDown: handleDatepickerInputKeyDown,
|
19522
19989
|
ref: controlRef,
|
19523
19990
|
value: valueAsDate
|
19524
19991
|
}));
|
@@ -19610,14 +20077,13 @@ function DiscardChangesConfirmationDialog(props) {
|
|
19610
20077
|
}, /*#__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, {
|
19611
20078
|
tabIndex: 0
|
19612
20079
|
}, texts.table3.editing.clearChangesConfirmationDialog.cancel)), /*#__PURE__*/React__default.createElement(Dialog.Close, null, /*#__PURE__*/React__default.createElement(Button$1, {
|
19613
|
-
autoFocus: true,
|
19614
20080
|
tabIndex: 0,
|
19615
20081
|
appearance: "primary",
|
19616
20082
|
onClick: handleDiscard
|
19617
20083
|
}, texts.table3.editing.clearChangesConfirmationDialog.confirm))))));
|
19618
20084
|
}
|
19619
20085
|
|
19620
|
-
function
|
20086
|
+
function EditingActionsMenu(props) {
|
19621
20087
|
const {
|
19622
20088
|
hasChanges,
|
19623
20089
|
hasErrors,
|
@@ -19646,7 +20112,8 @@ function EditingActionMenu(props) {
|
|
19646
20112
|
icon: "more",
|
19647
20113
|
onKeyDown: handleKeyDown,
|
19648
20114
|
menu: menuProps => (/*#__PURE__*/React__default.createElement(Menu$1, Object.assign({}, menuProps), /*#__PURE__*/React__default.createElement(Menu$1.Content, {
|
19649
|
-
onKeyDown: handleMenuContentKeyDown
|
20115
|
+
onKeyDown: handleMenuContentKeyDown,
|
20116
|
+
onFocusOutside: event => event.preventDefault()
|
19650
20117
|
}, /*#__PURE__*/React__default.createElement(Menu$1.Item, {
|
19651
20118
|
icon: "tick",
|
19652
20119
|
disabled: !hasChanges || hasErrors,
|
@@ -19769,7 +20236,7 @@ const RENDERERS$1 = {
|
|
19769
20236
|
cell: Cell$5
|
19770
20237
|
};
|
19771
20238
|
function useTable3(props, ref) {
|
19772
|
-
const editing = useTableEditing(props.enableEditing, props.onEditingSave, props.onEditingChange, props.rowIdentityAccessor, props.validator);
|
20239
|
+
const editing = useTableEditing(props.enableEditing, props.onEditingSave, props.onEditingChange, props.onEditingCreate, props.onEditingDiscard, props.rowIdentityAccessor, props.validator);
|
19773
20240
|
const creationEnabled = editing.isEnabled && !!props.onEditingCreate;
|
19774
20241
|
// this gives me the performance heeby jeebies, but can't think of a better way to internalise the state
|
19775
20242
|
const data = React__default.useMemo(() => {
|
@@ -19784,12 +20251,20 @@ function useTable3(props, ref) {
|
|
19784
20251
|
data,
|
19785
20252
|
enableRowActions: editing.isEditing ? true : props.enableRowActions,
|
19786
20253
|
// Display EditingActionMenu instead of row actions while editing
|
19787
|
-
rowActions: editing.isEditing ? [(_, rowId, table) => {
|
20254
|
+
rowActions: editing.isEditing ? [(_, rowId, __, table) => {
|
19788
20255
|
const tableMeta = table.options.meta;
|
19789
|
-
return /*#__PURE__*/React__default.createElement(
|
20256
|
+
return /*#__PURE__*/React__default.createElement(EditingActionsMenu, {
|
19790
20257
|
hasChanges: editing.hasChanges(rowId),
|
19791
20258
|
hasErrors: editing.hasRowErrors(rowId),
|
19792
|
-
onDiscard: () =>
|
20259
|
+
onDiscard: () => {
|
20260
|
+
editing.discardChanges(rowId, table);
|
20261
|
+
if (editing.temporaryRows.length) {
|
20262
|
+
requestAnimationFrame(() => {
|
20263
|
+
var _editing$createRowBut;
|
20264
|
+
return (_editing$createRowBut = editing.createRowButtonRef.current) === null || _editing$createRowBut === void 0 ? void 0 : _editing$createRowBut.focus();
|
20265
|
+
});
|
20266
|
+
}
|
20267
|
+
},
|
19793
20268
|
onEditingSave: function () {
|
19794
20269
|
try {
|
19795
20270
|
return Promise.resolve(editing.saveChanges(table, rowId)).then(function () {});
|
@@ -19813,6 +20288,9 @@ function useTable3(props, ref) {
|
|
19813
20288
|
React__default.useEffect(() => {
|
19814
20289
|
if (table.ref.current) {
|
19815
20290
|
table.ref.current.instance.toggleEditing = enabled => table.meta.editing.toggleEditing(enabled !== null && enabled !== void 0 ? enabled : editing => !editing, table.instance, table.renderer.scrollToIndex);
|
20291
|
+
if (props.onEditingCreate) {
|
20292
|
+
table.ref.current.instance.createRow = row => table.meta.editing.createRow(table.instance, row);
|
20293
|
+
}
|
19816
20294
|
}
|
19817
20295
|
}, [table.ref.current]);
|
19818
20296
|
return table;
|
@@ -19851,22 +20329,26 @@ function Alert$1(props) {
|
|
19851
20329
|
// generate links to each invalid row, to go into the error message
|
19852
20330
|
const links = [];
|
19853
20331
|
const visibleColumns = table.getVisibleFlatColumns().map(c => c.id);
|
19854
|
-
const rowIdentityColumn = tableMeta.rowIdentityAccessor && visibleColumns.includes(String(tableMeta.rowIdentityAccessor)) ?
|
20332
|
+
const rowIdentityColumn = tableMeta.rowIdentityAccessor && visibleColumns.includes(String(tableMeta.rowIdentityAccessor)) ?
|
20333
|
+
// table.getColumn(columName) throw error in strict dev mode. Related thread: https://github.com/TanStack/table/discussions/5505
|
20334
|
+
table.getAllColumns().find(x => x.id === String(tableMeta.rowIdentityAccessor)) : undefined;
|
19855
20335
|
pendingChangesWithErrors.forEach((pendingChangeWithError, index) => {
|
20336
|
+
var _row;
|
19856
20337
|
// if appropriate, concatenate the item with the text "and"
|
19857
20338
|
if (pendingChangesWithErrors.length > 1 && index === pendingChangesWithErrors.length - 1) {
|
19858
20339
|
// Add space before and after `messageAnd` text
|
19859
20340
|
links.push(` ${validationTexts.alert.messageAnd} `);
|
19860
20341
|
}
|
19861
|
-
|
20342
|
+
// note: if this row click functionality is removed, indexes can be removed from useEditingState
|
19862
20343
|
const handleClick = () => {
|
19863
20344
|
// if row is visible
|
19864
|
-
if (
|
19865
|
-
scrollToRow(
|
20345
|
+
if (pendingChangeWithError.index > -1) {
|
20346
|
+
scrollToRow(pendingChangeWithError.index);
|
20347
|
+
tableMeta.rowActive.setRowActiveIndex(pendingChangeWithError.index);
|
19866
20348
|
}
|
19867
20349
|
// if row is filtered out
|
19868
20350
|
else {
|
19869
|
-
setShowFilterResetDialog(pendingChangeWithError.
|
20351
|
+
setShowFilterResetDialog(pendingChangeWithError.index);
|
19870
20352
|
}
|
19871
20353
|
};
|
19872
20354
|
let tooltip;
|
@@ -19878,7 +20360,12 @@ function Alert$1(props) {
|
|
19878
20360
|
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;
|
19879
20361
|
tooltip = `${columnName}: ${pendingChangeWithError.errors.cells[firstCellErrorColumnId]}`;
|
19880
20362
|
}
|
19881
|
-
|
20363
|
+
let row = undefined;
|
20364
|
+
try {
|
20365
|
+
row = table.getRow(pendingChangeWithError.rowId).original;
|
20366
|
+
} catch {
|
20367
|
+
// because of server loading, some rows may not be accessible
|
20368
|
+
}
|
19882
20369
|
links.push(/*#__PURE__*/React__default.createElement(Tooltip, {
|
19883
20370
|
key: pendingChangeWithError.rowId,
|
19884
20371
|
title: tooltip
|
@@ -19886,7 +20373,7 @@ function Alert$1(props) {
|
|
19886
20373
|
className: "text-blue",
|
19887
20374
|
onClick: handleClick,
|
19888
20375
|
role: "button"
|
19889
|
-
}, rowIdentityColumn ? row[rowIdentityColumn.id] :
|
20376
|
+
}, rowIdentityColumn ? (_row = row) === null || _row === void 0 ? void 0 : _row[rowIdentityColumn.id] : pendingChangeWithError.index + 1)));
|
19890
20377
|
// if appropriate, concatenate the item with the text ","
|
19891
20378
|
if (pendingChangesWithErrors.length > 2 && index < pendingChangesWithErrors.length - 2) {
|
19892
20379
|
links.push(', ');
|
@@ -19907,9 +20394,8 @@ function Alert$1(props) {
|
|
19907
20394
|
table.resetGlobalFilter();
|
19908
20395
|
table.resetColumnFilters();
|
19909
20396
|
requestAnimationFrame(() => {
|
19910
|
-
|
19911
|
-
|
19912
|
-
scrollToRow(rowIndex);
|
20397
|
+
if (showFilterResetDialog && showFilterResetDialog > -1) {
|
20398
|
+
scrollToRow(showFilterResetDialog);
|
19913
20399
|
}
|
19914
20400
|
setShowFilterResetDialog(false);
|
19915
20401
|
});
|
@@ -19973,11 +20459,9 @@ function CreateNewRow(props) {
|
|
19973
20459
|
var _temporaryRows$0$tabl, _temporaryRows$, _table$getState$colum;
|
19974
20460
|
const {
|
19975
20461
|
buttonRef,
|
19976
|
-
|
19977
|
-
scrollToIndex,
|
20462
|
+
isScrolled,
|
19978
20463
|
table,
|
19979
|
-
tableMeta
|
19980
|
-
tableRef
|
20464
|
+
tableMeta
|
19981
20465
|
} = props;
|
19982
20466
|
const {
|
19983
20467
|
texts
|
@@ -19986,46 +20470,19 @@ function CreateNewRow(props) {
|
|
19986
20470
|
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 : '';
|
19987
20471
|
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);
|
19988
20472
|
const isSaving = !!temporaryRowId && tableMeta.editing.getRowStatus(temporaryRowId) === 'saving';
|
19989
|
-
const
|
20473
|
+
const handleCreate = function () {
|
19990
20474
|
try {
|
19991
|
-
if (
|
20475
|
+
if (isDisabled) {
|
19992
20476
|
return Promise.resolve();
|
19993
20477
|
}
|
19994
|
-
return Promise.resolve(tableMeta.editing.
|
19995
|
-
if (!saved) {
|
19996
|
-
return;
|
19997
|
-
}
|
19998
|
-
const changeset = row !== null && row !== void 0 ? row : handleEditingCreate();
|
19999
|
-
try {
|
20000
|
-
if (changeset) {
|
20001
|
-
const rowId = tableMeta.editing.createRow(changeset);
|
20002
|
-
table.getRow(rowId).pin('bottom');
|
20003
|
-
// set the active row to the new row before toggling editing on
|
20004
|
-
const nextRowIndex = temporaryRows.length ? tableMeta.length + 1 : tableMeta.length;
|
20005
|
-
tableMeta.rowActive.setRowActiveIndex(nextRowIndex);
|
20006
|
-
tableMeta.editing.toggleEditing(true, table, scrollToIndex);
|
20007
|
-
tableMeta.editing.setLastFocusedCellIndex(0);
|
20008
|
-
}
|
20009
|
-
} catch (error) {
|
20010
|
-
console.error(error);
|
20011
|
-
}
|
20012
|
-
});
|
20478
|
+
return Promise.resolve(tableMeta.editing.createRow(table)).then(function () {});
|
20013
20479
|
} catch (e) {
|
20014
20480
|
return Promise.reject(e);
|
20015
20481
|
}
|
20016
20482
|
};
|
20017
|
-
// allow programmatic access to creating rows from outside the table
|
20018
|
-
React__default.useEffect(() => {
|
20019
|
-
if (tableRef.current) {
|
20020
|
-
tableRef.current.instance.createRow = createRow;
|
20021
|
-
}
|
20022
|
-
}, [tableRef.current, createRow]);
|
20023
|
-
const handleCreate = function () {
|
20024
|
-
return createRow();
|
20025
|
-
};
|
20026
20483
|
const shortcut = {
|
20027
20484
|
key: 'Enter',
|
20028
|
-
|
20485
|
+
meta: true
|
20029
20486
|
};
|
20030
20487
|
let tooltip;
|
20031
20488
|
if (isSaving) {
|
@@ -20037,11 +20494,9 @@ function CreateNewRow(props) {
|
|
20037
20494
|
keys: shortcut
|
20038
20495
|
});
|
20039
20496
|
}
|
20040
|
-
const isScrolled = tableRef.current ? tableRef.current.scrollHeight > tableRef.current.clientHeight : false;
|
20041
20497
|
const className = cn('group/row border-grey-300 !sticky z-[21]', {
|
20042
20498
|
'bottom-10': tableMeta.footer.isEnabled,
|
20043
20499
|
'bottom-0': !tableMeta.footer.isEnabled,
|
20044
|
-
'border-t-2': isScrolled,
|
20045
20500
|
'border-b': !isScrolled
|
20046
20501
|
});
|
20047
20502
|
return /*#__PURE__*/React__default.createElement("tr", {
|
@@ -20066,6 +20521,7 @@ function CreateNewRow(props) {
|
|
20066
20521
|
function TemporaryRow(props) {
|
20067
20522
|
const {
|
20068
20523
|
createRowButtonRef,
|
20524
|
+
isScrolled,
|
20069
20525
|
table,
|
20070
20526
|
tableMeta,
|
20071
20527
|
tableRef
|
@@ -20128,10 +20584,9 @@ function TemporaryRow(props) {
|
|
20128
20584
|
}
|
20129
20585
|
}
|
20130
20586
|
};
|
20131
|
-
const
|
20132
|
-
|
20133
|
-
'bottom-[calc(5rem_+
|
20134
|
-
'bottom-[calc(2.5rem_+_3px)] data-[row-editing-move]:bottom-[calc(2.5rem_+_2px)]': !tableMeta.footer.isEnabled,
|
20587
|
+
const className = cn('group/row border-grey-300 !sticky z-[22] print:hidden', {
|
20588
|
+
'bottom-[calc(5rem_+_2px)] data-[row-editing-move]:bottom-[calc(5rem_+_2px)]': tableMeta.footer.isEnabled,
|
20589
|
+
'bottom-[calc(2.5rem_+_2px)] data-[row-editing-move]:bottom-[calc(2.5rem_+_2px)]': !tableMeta.footer.isEnabled,
|
20135
20590
|
'border-t-2 shadow-[0px_-5px_20px_0px_rgba(0,0,0,0.1)] [&>td]:!border-b-0': isScrolled
|
20136
20591
|
});
|
20137
20592
|
return /*#__PURE__*/React__default.createElement(React__default.Fragment, null, table.getBottomRows().map(row => (/*#__PURE__*/React__default.createElement(Row, {
|
@@ -20145,14 +20600,13 @@ function TemporaryRow(props) {
|
|
20145
20600
|
className: className,
|
20146
20601
|
onKeyDown: handleKeyDown,
|
20147
20602
|
onKeyDownCapture: handleKeyDownCapture,
|
20148
|
-
|
20149
|
-
hideRowActions: !tableMeta.editing.isEditing
|
20603
|
+
hideInternalColumns: true,
|
20604
|
+
hideRowActions: !tableMeta.editing.isEditing,
|
20605
|
+
skipPageLoading: true
|
20150
20606
|
}))));
|
20151
20607
|
}
|
20152
20608
|
|
20153
|
-
|
20154
|
-
return null;
|
20155
|
-
}
|
20609
|
+
const Column$3 = () => null;
|
20156
20610
|
Column$3.displayName = 'Table3Column';
|
20157
20611
|
function Group$5(_) {
|
20158
20612
|
return null;
|
@@ -20165,8 +20619,25 @@ const BaseTable3 = /*#__PURE__*/fixedForwardRef(function BaseTable3(props, ref)
|
|
20165
20619
|
'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,
|
20166
20620
|
enableHorizontalArrowKeyNavigation: table3.meta.editing.isEditing
|
20167
20621
|
};
|
20168
|
-
const
|
20622
|
+
const rowsById = table3.instance.getCoreRowModel().rowsById;
|
20623
|
+
const hasAlertErrors = table3.meta.editing.getErrorsShownInAlert().filter(row => {
|
20624
|
+
if (table3.meta.server._experimentalDataLoader2) {
|
20625
|
+
// consumers of dataloader2 need to run a cleanup function, as this would otherwise return false when pages are unloaded.
|
20626
|
+
return true;
|
20627
|
+
}
|
20628
|
+
return rowsById[row.rowId];
|
20629
|
+
}).length;
|
20169
20630
|
const hasCreateWorkflow = table3.meta.editing.isEnabled && props.onEditingCreate;
|
20631
|
+
const isScrolled = isTableScrolled(table3.ref);
|
20632
|
+
let createWorkflow;
|
20633
|
+
if (hasCreateWorkflow) {
|
20634
|
+
createWorkflow = /*#__PURE__*/React__default.createElement(CreateNewRow, {
|
20635
|
+
buttonRef: table3.meta.editing.createRowButtonRef,
|
20636
|
+
isScrolled: isScrolled,
|
20637
|
+
table: table3.instance,
|
20638
|
+
tableMeta: table3.meta
|
20639
|
+
});
|
20640
|
+
}
|
20170
20641
|
return /*#__PURE__*/React__default.createElement(Table, null, /*#__PURE__*/React__default.createElement(Table.Toolbar, {
|
20171
20642
|
table: table3
|
20172
20643
|
}, table3.meta.editing.isEnabled ? (/*#__PURE__*/React__default.createElement(Editing, {
|
@@ -20179,20 +20650,15 @@ const BaseTable3 = /*#__PURE__*/fixedForwardRef(function BaseTable3(props, ref)
|
|
20179
20650
|
tableRef: table3.ref
|
20180
20651
|
})) : null, /*#__PURE__*/React__default.createElement(Table.Grid, Object.assign({}, gridAttributes, {
|
20181
20652
|
"data-taco": "table3",
|
20653
|
+
footerRows: hasCreateWorkflow && isScrolled ? createWorkflow : undefined,
|
20182
20654
|
table: table3
|
20183
20655
|
}), hasCreateWorkflow ? (/*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement(TemporaryRow, {
|
20184
20656
|
createRowButtonRef: table3.meta.editing.createRowButtonRef,
|
20657
|
+
isScrolled: isScrolled,
|
20185
20658
|
table: table3.instance,
|
20186
20659
|
tableMeta: table3.meta,
|
20187
20660
|
tableRef: table3.ref
|
20188
|
-
}),
|
20189
|
-
buttonRef: table3.meta.editing.createRowButtonRef,
|
20190
|
-
onEditingCreate: props.onEditingCreate,
|
20191
|
-
scrollToIndex: table3.renderer.scrollToIndex,
|
20192
|
-
table: table3.instance,
|
20193
|
-
tableMeta: table3.meta,
|
20194
|
-
tableRef: table3.ref
|
20195
|
-
}))) : null));
|
20661
|
+
}), !isScrolled ? createWorkflow : null)) : null));
|
20196
20662
|
});
|
20197
20663
|
const Table3 = /*#__PURE__*/fixedForwardRef(function Table3(props, ref) {
|
20198
20664
|
const stringifiedChildren = String(props.children);
|
@@ -20428,6 +20894,796 @@ const Tour = props => {
|
|
20428
20894
|
};
|
20429
20895
|
Tour.Step = TourStep;
|
20430
20896
|
|
20897
|
+
// NOTE: this file is intentianally a js file so that it can be consumed by tailwind.config.js
|
20898
|
+
|
20899
|
+
const THEME_COLORS = {
|
20900
|
+
transparent: 'transparent',
|
20901
|
+
current: 'currentColor',
|
20902
|
+
white: '#fff',
|
20903
|
+
black: '#1c1c1c',
|
20904
|
+
brand: {
|
20905
|
+
vismaRed: '#E70641',
|
20906
|
+
paleOrange: '#FFF5E5',
|
20907
|
+
sunsetOrange: '#E89C2E',
|
20908
|
+
midnightBlue: '#29283E',
|
20909
|
+
coolBlue: '#F5F7F9'
|
20910
|
+
},
|
20911
|
+
grey: {
|
20912
|
+
lightest: '#fafafa',
|
20913
|
+
light: '#F6F6F6',
|
20914
|
+
DEFAULT: '#EBEBEB',
|
20915
|
+
dark: '#DDDDDD',
|
20916
|
+
darker: '#ACACAC',
|
20917
|
+
darkest: '#595959',
|
20918
|
+
darkNew: '#a5a6a9',
|
20919
|
+
50: '#fafafa',
|
20920
|
+
100: '#F6F6F6',
|
20921
|
+
200: '#EBEBEB',
|
20922
|
+
300: '#DDDDDD',
|
20923
|
+
500: '#ACACAC',
|
20924
|
+
700: '#595959',
|
20925
|
+
900: '#303030'
|
20926
|
+
},
|
20927
|
+
purple: {
|
20928
|
+
lightest: '#585c74',
|
20929
|
+
light: '#4b4f64',
|
20930
|
+
DEFAULT: '#3d4153',
|
20931
|
+
dark: '#353a48',
|
20932
|
+
darker: '#29283e',
|
20933
|
+
darkest: '#212032',
|
20934
|
+
darkNew_1: '#373647',
|
20935
|
+
darkNew_2: '#414050',
|
20936
|
+
100: '#EEE5FF',
|
20937
|
+
200: '#ddd1ff',
|
20938
|
+
300: '#CBBCFE',
|
20939
|
+
500: '#9270FA',
|
20940
|
+
700: '#6542D1',
|
20941
|
+
900: '#412970'
|
20942
|
+
},
|
20943
|
+
blue: {
|
20944
|
+
lightest: '#DEEBFF',
|
20945
|
+
light: '#75A0F5',
|
20946
|
+
DEFAULT: '#4573D2',
|
20947
|
+
dark: '#2B57B4',
|
20948
|
+
100: '#DEEBFF',
|
20949
|
+
200: '#AACCFF',
|
20950
|
+
300: '#75A0F5',
|
20951
|
+
500: '#4573D2',
|
20952
|
+
700: '#2B57B4',
|
20953
|
+
900: '#29283E'
|
20954
|
+
},
|
20955
|
+
red: {
|
20956
|
+
lightest: '#FFDAD2',
|
20957
|
+
light: '#E66568',
|
20958
|
+
DEFAULT: '#CE3F42',
|
20959
|
+
dark: '#950027',
|
20960
|
+
100: '#FFDAD2',
|
20961
|
+
200: '#f3a09d',
|
20962
|
+
300: '#E66568',
|
20963
|
+
500: '#CE3F42',
|
20964
|
+
700: '#950027',
|
20965
|
+
900: '#64001B'
|
20966
|
+
},
|
20967
|
+
green: {
|
20968
|
+
lightest: '#cdf0e7',
|
20969
|
+
light: '#52C7AB',
|
20970
|
+
DEFAULT: '#08AE87',
|
20971
|
+
dark: '#028465',
|
20972
|
+
100: '#cdf0e7',
|
20973
|
+
200: '#9be1ce',
|
20974
|
+
300: '#52C7AB',
|
20975
|
+
500: '#08AE87',
|
20976
|
+
700: '#028465',
|
20977
|
+
900: '#14493A'
|
20978
|
+
},
|
20979
|
+
yellow: {
|
20980
|
+
lightest: '#FFF1C3',
|
20981
|
+
light: '#FFD665',
|
20982
|
+
DEFAULT: '#FFBD3B',
|
20983
|
+
dark: '#e89c2e',
|
20984
|
+
100: '#FFF1C3',
|
20985
|
+
200: '#ffe494',
|
20986
|
+
300: '#FFD665',
|
20987
|
+
500: '#FFBD3B',
|
20988
|
+
700: '#e89c2e',
|
20989
|
+
900: '#733700'
|
20990
|
+
},
|
20991
|
+
pink: {
|
20992
|
+
100: '#FFE3F7',
|
20993
|
+
200: '#fcb9e9',
|
20994
|
+
300: '#F98EDB',
|
20995
|
+
500: '#E165BF',
|
20996
|
+
700: '#CF49AA',
|
20997
|
+
900: '#870062'
|
20998
|
+
},
|
20999
|
+
brown: {
|
21000
|
+
100: '#EEE0DA',
|
21001
|
+
200: '#DFCCC2',
|
21002
|
+
300: '#C4AB9E',
|
21003
|
+
500: '#93715D',
|
21004
|
+
700: '#73503B',
|
21005
|
+
900: '#45291F'
|
21006
|
+
},
|
21007
|
+
orange: {
|
21008
|
+
100: '#FFE3BB',
|
21009
|
+
200: '#FCCB80',
|
21010
|
+
300: '#FAB64D',
|
21011
|
+
500: '#F99702',
|
21012
|
+
700: '#EF7D00',
|
21013
|
+
900: '#4A2811'
|
21014
|
+
}
|
21015
|
+
};
|
21016
|
+
|
21017
|
+
const mapColor = (palette, prefix = '') => {
|
21018
|
+
return Object.keys(palette).reduce((accum, color) => {
|
21019
|
+
if (color === 'current') {
|
21020
|
+
return accum;
|
21021
|
+
} else if (typeof palette[color] === 'string') {
|
21022
|
+
return {
|
21023
|
+
...accum,
|
21024
|
+
[prefix ? color === 'DEFAULT' ? prefix : `${prefix}-${color}` : color]: palette[color]
|
21025
|
+
};
|
21026
|
+
} else {
|
21027
|
+
return {
|
21028
|
+
...accum,
|
21029
|
+
...mapColor(palette[color], color)
|
21030
|
+
};
|
21031
|
+
}
|
21032
|
+
}, {});
|
21033
|
+
};
|
21034
|
+
const colors = /*#__PURE__*/mapColor(THEME_COLORS);
|
21035
|
+
const getThemeColor = color => colors[color];
|
21036
|
+
|
21037
|
+
function Legend(props) {
|
21038
|
+
const {
|
21039
|
+
activeIndex,
|
21040
|
+
onMouseEnter,
|
21041
|
+
onMouseLeave,
|
21042
|
+
onClick,
|
21043
|
+
payload,
|
21044
|
+
layout,
|
21045
|
+
activeItems
|
21046
|
+
} = props;
|
21047
|
+
const [hoverIndex, setHoverIndex] = React.useState(null);
|
21048
|
+
const handleMouseEnter = (entry, index) => {
|
21049
|
+
setHoverIndex(index);
|
21050
|
+
if (activeItems[entry.dataKey]) onMouseEnter(entry, index);
|
21051
|
+
};
|
21052
|
+
const handleMouseLeave = () => {
|
21053
|
+
onMouseLeave();
|
21054
|
+
setHoverIndex(null);
|
21055
|
+
};
|
21056
|
+
const moreButton = moreButtonText => (/*#__PURE__*/React__default.createElement(Button$1, {
|
21057
|
+
appearance: "transparent",
|
21058
|
+
className: "text-grey-700"
|
21059
|
+
}, moreButtonText));
|
21060
|
+
return /*#__PURE__*/React__default.createElement("div", {
|
21061
|
+
className: "mx-auto w-auto max-w-full overflow-hidden"
|
21062
|
+
}, /*#__PURE__*/React__default.createElement("div", {
|
21063
|
+
className: cn('mb-0 ml-0 flex justify-center', {
|
21064
|
+
'flex-col': layout === 'vertical'
|
21065
|
+
})
|
21066
|
+
}, /*#__PURE__*/React__default.createElement(OverflowGroup, {
|
21067
|
+
className: "w-full items-center py-1",
|
21068
|
+
moreButton: moreButton
|
21069
|
+
}, payload.map((entry, index) => (/*#__PURE__*/React__default.createElement("span", {
|
21070
|
+
key: `${entry.dataKey}-${index}`,
|
21071
|
+
className: cn(' hover:bg-grey-100 cursor-pointer px-[8px] py-[2px] hover:rounded-[4px]', {
|
21072
|
+
'bg-grey-100 rounded': activeIndex === index
|
21073
|
+
}),
|
21074
|
+
onMouseEnter: () => handleMouseEnter(entry, index),
|
21075
|
+
onMouseLeave: handleMouseLeave,
|
21076
|
+
onClick: onClick ? () => onClick(entry) : undefined
|
21077
|
+
}, /*#__PURE__*/React__default.createElement("span", {
|
21078
|
+
className: "text-grey-700 flex items-center gap-[4px]"
|
21079
|
+
}, /*#__PURE__*/React__default.createElement("span", {
|
21080
|
+
className: cn('-mt-px ml-1 flex h-3 w-3 rounded-sm', {
|
21081
|
+
'border-grey-300 border !bg-white': !activeItems[entry.dataKey]
|
21082
|
+
}),
|
21083
|
+
style: {
|
21084
|
+
backgroundColor: entry.color
|
21085
|
+
}
|
21086
|
+
}, hoverIndex === index && activeItems[entry.dataKey] && (/*#__PURE__*/React__default.createElement(Icon, {
|
21087
|
+
name: "tick-bold",
|
21088
|
+
className: "!h-full !w-full text-white"
|
21089
|
+
}))), entry.value)))))));
|
21090
|
+
}
|
21091
|
+
|
21092
|
+
const Tooltip$2 = ({
|
21093
|
+
active,
|
21094
|
+
formatter,
|
21095
|
+
payload,
|
21096
|
+
style,
|
21097
|
+
singlePieDonutChart
|
21098
|
+
}) => {
|
21099
|
+
const getColor = entry => {
|
21100
|
+
var _ref, _entry$color;
|
21101
|
+
if (singlePieDonutChart) {
|
21102
|
+
// We use entry.payload.label because the payload structure differs between a Donut chart with a single pie
|
21103
|
+
// and one with multiple pies.
|
21104
|
+
return getThemeColor(entry.payload.color);
|
21105
|
+
}
|
21106
|
+
return (_ref = (_entry$color = entry.color) !== null && _entry$color !== void 0 ? _entry$color : entry.payload.fill) !== null && _ref !== void 0 ? _ref : 'blue-500';
|
21107
|
+
};
|
21108
|
+
if (active && payload && payload.length) {
|
21109
|
+
return /*#__PURE__*/React__default.createElement("dl", {
|
21110
|
+
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)]",
|
21111
|
+
style: style
|
21112
|
+
}, payload.map((entry, index) => (/*#__PURE__*/React__default.createElement(React__default.Fragment, {
|
21113
|
+
key: `${entry.name}-${index}`
|
21114
|
+
}, /*#__PURE__*/React__default.createElement("dt", {
|
21115
|
+
className: "text-grey-700 mb-0 flex items-center gap-1 font-normal"
|
21116
|
+
}, /*#__PURE__*/React__default.createElement("span", {
|
21117
|
+
className: "-mt-px h-2.5 w-2.5 rounded-sm",
|
21118
|
+
style: {
|
21119
|
+
background: getColor(entry)
|
21120
|
+
}
|
21121
|
+
}),
|
21122
|
+
// We use entry.payload.label because the payload structure differs between a Donut chart with a single pie
|
21123
|
+
// and one with multiple pies.
|
21124
|
+
singlePieDonutChart ? entry.payload.label : entry.name), /*#__PURE__*/React__default.createElement("dd", {
|
21125
|
+
className: "mb-0 text-right font-bold text-black "
|
21126
|
+
}, formatter ? formatter(entry.value) : entry.value)))));
|
21127
|
+
}
|
21128
|
+
return null;
|
21129
|
+
};
|
21130
|
+
|
21131
|
+
const getCartesianGridProps = () => ({
|
21132
|
+
vertical: false
|
21133
|
+
});
|
21134
|
+
const getXAxisProps = props => ({
|
21135
|
+
axisLine: false,
|
21136
|
+
dataKey: props.accessor,
|
21137
|
+
fontSize: 12,
|
21138
|
+
scale: props.xAxisScale,
|
21139
|
+
tickLine: false,
|
21140
|
+
tickFormatter: props.xAxisTickFormat
|
21141
|
+
});
|
21142
|
+
const getYAxisProps = props => ({
|
21143
|
+
axisLine: false,
|
21144
|
+
fontSize: 12,
|
21145
|
+
scale: props.yAxisScale,
|
21146
|
+
tickLine: false,
|
21147
|
+
tickFormatter: props.yAxisTickFormat
|
21148
|
+
});
|
21149
|
+
const getLegendProps = props => ({
|
21150
|
+
content: /*#__PURE__*/React__default.createElement(Legend, Object.assign({}, props))
|
21151
|
+
});
|
21152
|
+
const getTooltipProps = (props = undefined) => ({
|
21153
|
+
content: /*#__PURE__*/React__default.createElement(Tooltip$2, Object.assign({}, props)),
|
21154
|
+
wrapperStyle: {
|
21155
|
+
outline: 'none'
|
21156
|
+
}
|
21157
|
+
});
|
21158
|
+
|
21159
|
+
// A hacky fix for EC-50037 to make sure that Chart doesn't resize when it is inside a Card.
|
21160
|
+
const ResponsiveContainer = props => (/*#__PURE__*/React__default.createElement(Recharts.ResponsiveContainer, Object.assign({
|
21161
|
+
className: "!h-[calc(100%-1px)] !w-[calc(100%-1px)]"
|
21162
|
+
}, props)));
|
21163
|
+
|
21164
|
+
const Area = _ => null;
|
21165
|
+
const AreaChart = function AreaChart(externalProps) {
|
21166
|
+
const {
|
21167
|
+
children,
|
21168
|
+
data,
|
21169
|
+
formatter,
|
21170
|
+
...props
|
21171
|
+
} = externalProps;
|
21172
|
+
const [hoveredArea, setHoveredArea] = React.useState(null);
|
21173
|
+
const [activeAreas, setActiveAreas] = React.useState(() => {
|
21174
|
+
const areas = {};
|
21175
|
+
React__default.Children.forEach(children, child => {
|
21176
|
+
areas[child.props.accessor] = true;
|
21177
|
+
});
|
21178
|
+
return areas;
|
21179
|
+
});
|
21180
|
+
const handleLegendClick = entry => {
|
21181
|
+
setHoveredArea(null);
|
21182
|
+
setActiveAreas({
|
21183
|
+
...activeAreas,
|
21184
|
+
[entry.dataKey]: !activeAreas[entry.dataKey]
|
21185
|
+
});
|
21186
|
+
};
|
21187
|
+
return /*#__PURE__*/React__default.createElement(ResponsiveContainer, null, /*#__PURE__*/React__default.createElement(Recharts.AreaChart, {
|
21188
|
+
data: data,
|
21189
|
+
margin: {
|
21190
|
+
top: 10,
|
21191
|
+
right: 0,
|
21192
|
+
left: -25,
|
21193
|
+
bottom: 0
|
21194
|
+
}
|
21195
|
+
}, /*#__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({
|
21196
|
+
onClick: handleLegendClick,
|
21197
|
+
onMouseEnter: entry => setHoveredArea(entry.dataKey),
|
21198
|
+
onMouseLeave: () => setHoveredArea(null),
|
21199
|
+
activeItems: activeAreas
|
21200
|
+
}))), /*#__PURE__*/React__default.createElement(Recharts.Tooltip, Object.assign({}, getTooltipProps(), {
|
21201
|
+
formatter: formatter
|
21202
|
+
})), React__default.Children.map(children, child => {
|
21203
|
+
var _child$props$color, _child$props$color2, _child$props$color3;
|
21204
|
+
return /*#__PURE__*/React__default.createElement(Recharts.Area, {
|
21205
|
+
activeDot: {
|
21206
|
+
fill: getThemeColor((_child$props$color = child.props.color) !== null && _child$props$color !== void 0 ? _child$props$color : 'blue-300')
|
21207
|
+
},
|
21208
|
+
isAnimationActive: false,
|
21209
|
+
dataKey: child.props.accessor,
|
21210
|
+
dot: false,
|
21211
|
+
fill: getThemeColor((_child$props$color2 = child.props.color) !== null && _child$props$color2 !== void 0 ? _child$props$color2 : 'grey-100'),
|
21212
|
+
name: child.props.label,
|
21213
|
+
strokeWidth: 2,
|
21214
|
+
stroke: getThemeColor((_child$props$color3 = child.props.color) !== null && _child$props$color3 !== void 0 ? _child$props$color3 : 'grey-300'),
|
21215
|
+
stackId: child.props.stackId,
|
21216
|
+
hide: !activeAreas[child.props.accessor],
|
21217
|
+
opacity: hoveredArea && child.props.accessor !== hoveredArea ? 0.3 : 1
|
21218
|
+
});
|
21219
|
+
})));
|
21220
|
+
};
|
21221
|
+
AreaChart.Area = Area;
|
21222
|
+
|
21223
|
+
const Bar$1 = _ => null;
|
21224
|
+
const getXAxisVerticalProps = props => ({
|
21225
|
+
...getXAxisProps(props),
|
21226
|
+
...{
|
21227
|
+
type: 'number',
|
21228
|
+
dataKey: undefined
|
21229
|
+
}
|
21230
|
+
});
|
21231
|
+
const getYAxisVerticalProps = props => ({
|
21232
|
+
...getYAxisProps(props),
|
21233
|
+
...{
|
21234
|
+
dataKey: props.accessor,
|
21235
|
+
type: 'category'
|
21236
|
+
}
|
21237
|
+
});
|
21238
|
+
const BarChart = function BarChart(externalProps) {
|
21239
|
+
const {
|
21240
|
+
children,
|
21241
|
+
data,
|
21242
|
+
formatter,
|
21243
|
+
layout = 'horizontal',
|
21244
|
+
...props
|
21245
|
+
} = externalProps;
|
21246
|
+
const [activeIndex, setActiveIndex] = React__default.useState(undefined);
|
21247
|
+
const [hoveredBar, setHoveredBar] = React__default.useState(null);
|
21248
|
+
const [activeBars, setActiveBars] = React__default.useState(() => {
|
21249
|
+
const keys = {};
|
21250
|
+
React__default.Children.forEach(children, child => {
|
21251
|
+
keys[child.props.accessor] = true;
|
21252
|
+
});
|
21253
|
+
return keys;
|
21254
|
+
});
|
21255
|
+
// Recharts doesn't provide a way for us to know if a stacked bar is at the top or the bottom,
|
21256
|
+
// so we can't set proper radiuses without some "magic"
|
21257
|
+
const stacks = {};
|
21258
|
+
React__default.Children.forEach(children, child => {
|
21259
|
+
if (child.props.stackId) {
|
21260
|
+
if (!stacks[child.props.stackId]) {
|
21261
|
+
stacks[child.props.stackId] = [child.props.accessor];
|
21262
|
+
} else {
|
21263
|
+
stacks[child.props.stackId].push(child.props.accessor);
|
21264
|
+
}
|
21265
|
+
}
|
21266
|
+
});
|
21267
|
+
const handleLegendClick = entry => {
|
21268
|
+
setHoveredBar(null);
|
21269
|
+
setActiveBars({
|
21270
|
+
...activeBars,
|
21271
|
+
[entry.dataKey]: !activeBars[entry.dataKey]
|
21272
|
+
});
|
21273
|
+
};
|
21274
|
+
const handleLegendHover = (entry, index) => {
|
21275
|
+
setHoveredBar(entry.dataKey);
|
21276
|
+
setActiveIndex(index);
|
21277
|
+
};
|
21278
|
+
return /*#__PURE__*/React__default.createElement(ResponsiveContainer, null, /*#__PURE__*/React__default.createElement(Recharts.BarChart, {
|
21279
|
+
layout: layout,
|
21280
|
+
data: data,
|
21281
|
+
margin: {
|
21282
|
+
top: 10,
|
21283
|
+
right: 0,
|
21284
|
+
left: layout === 'vertical' ? 0 : -25,
|
21285
|
+
bottom: 0
|
21286
|
+
},
|
21287
|
+
onMouseMove: chartState => setActiveIndex(chartState.activeTooltipIndex),
|
21288
|
+
onMouseLeave: () => setActiveIndex(undefined)
|
21289
|
+
}, /*#__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({
|
21290
|
+
onClick: handleLegendClick,
|
21291
|
+
onMouseEnter: handleLegendHover,
|
21292
|
+
onMouseLeave: () => setHoveredBar(null),
|
21293
|
+
activeItems: activeBars
|
21294
|
+
}))), /*#__PURE__*/React__default.createElement(Recharts.Tooltip, Object.assign({}, getTooltipProps(), {
|
21295
|
+
formatter: formatter
|
21296
|
+
})), React__default.Children.map(children, child => (/*#__PURE__*/React__default.createElement(Recharts.Bar, {
|
21297
|
+
isAnimationActive: false,
|
21298
|
+
barSize: 16,
|
21299
|
+
dataKey: child.props.accessor,
|
21300
|
+
name: child.props.label,
|
21301
|
+
onMouseEnter: (_, index) => setActiveIndex(index),
|
21302
|
+
onMouseLeave: () => setActiveIndex(undefined),
|
21303
|
+
fill: getThemeColor(child.props.color ? `${child.props.color}` : `blue-300`),
|
21304
|
+
radius: getBarRadius(stacks, child.props.accessor, child.props.stackId, activeBars),
|
21305
|
+
stackId: child.props.stackId,
|
21306
|
+
style: child.props.stackId ? {
|
21307
|
+
stroke: '#fff',
|
21308
|
+
strokeWidth: '2px'
|
21309
|
+
} : undefined,
|
21310
|
+
hide: !activeBars[child.props.accessor]
|
21311
|
+
}, data.map((_, index) => (/*#__PURE__*/React__default.createElement(Recharts.Cell, {
|
21312
|
+
key: `cell-${index}`,
|
21313
|
+
opacity: hoveredBar && child.props.accessor !== hoveredBar || activeIndex !== undefined && activeIndex !== index ? 0.3 : 1
|
21314
|
+
}))))))));
|
21315
|
+
};
|
21316
|
+
BarChart.Bar = Bar$1;
|
21317
|
+
const getBarRadius = (stacks, accessor, stackId, activeBars) => {
|
21318
|
+
if (stackId && Array.isArray(stacks[stackId])) {
|
21319
|
+
const length = stacks[stackId].length - 1;
|
21320
|
+
const index = stacks[stackId].indexOf(accessor);
|
21321
|
+
if (Object.entries(activeBars).filter(item => item[0] !== accessor).every(item => !item[1])) {
|
21322
|
+
return [3, 3, 0, 0];
|
21323
|
+
}
|
21324
|
+
if (activeBars[stacks[stackId][index + 1]] === false) {
|
21325
|
+
return [index === 0 ? 0 : 3, index === 0 ? 0 : 3, index === length - 1 ? 0 : 3, index === length - 1 ? 0 : 3];
|
21326
|
+
}
|
21327
|
+
if (index !== 0 && index !== length) {
|
21328
|
+
return 0;
|
21329
|
+
}
|
21330
|
+
return [index === 0 ? 0 : 3, index === 0 ? 0 : 3, index === length ? 0 : 3, index === length ? 0 : 3];
|
21331
|
+
}
|
21332
|
+
return 3;
|
21333
|
+
};
|
21334
|
+
|
21335
|
+
const Legend$1 = ({
|
21336
|
+
legendPosition,
|
21337
|
+
hoveredItem,
|
21338
|
+
selectedItem,
|
21339
|
+
data,
|
21340
|
+
onClick,
|
21341
|
+
setHoveredItem,
|
21342
|
+
formatter,
|
21343
|
+
total,
|
21344
|
+
visibleItems,
|
21345
|
+
label
|
21346
|
+
}) => {
|
21347
|
+
const isTotalLegendSelected = selectedItem.length === data.length;
|
21348
|
+
const isTotalLegendHovered = hoveredItem.length === data.length;
|
21349
|
+
const handleMouseLeave = () => setHoveredItem([]);
|
21350
|
+
const renderLegendItem = (entry, index) => {
|
21351
|
+
const isTotal = entry === null;
|
21352
|
+
// We can't use `isTotal` here because TypeScript is unable to infer the type when `entry` is not null.
|
21353
|
+
const itemData = entry === null ? {
|
21354
|
+
id: 'total',
|
21355
|
+
label,
|
21356
|
+
value: total,
|
21357
|
+
color: 'grey-300'
|
21358
|
+
} : entry;
|
21359
|
+
const isSelected = isTotal ? isTotalLegendSelected : selectedItem.includes(itemData.id);
|
21360
|
+
const isHovered = isTotal ? isTotalLegendHovered : hoveredItem.includes(itemData.id);
|
21361
|
+
return /*#__PURE__*/React__default.createElement("li", {
|
21362
|
+
key: isTotal ? 'total' : `${itemData.label}-${index}`,
|
21363
|
+
className: cn('mr-2 flex cursor-pointer gap-2 rounded pl-0 pr-1', {
|
21364
|
+
'bg-grey-100': isHovered && (!isTotal || legendPosition === 'right'),
|
21365
|
+
'bg-grey-200': isSelected && (!isTotal || legendPosition === 'right')
|
21366
|
+
}),
|
21367
|
+
onClick: () => onClick(isTotal ? data : itemData),
|
21368
|
+
onMouseEnter: () => setHoveredItem(isTotal ? data.map(item => item.id) : [itemData.id]),
|
21369
|
+
onMouseLeave: handleMouseLeave
|
21370
|
+
}, legendPosition === 'bottom' ? (/*#__PURE__*/React__default.createElement("div", {
|
21371
|
+
className: "flex items-center gap-1"
|
21372
|
+
}, /*#__PURE__*/React__default.createElement("span", {
|
21373
|
+
className: cn('ml-1 h-3 w-3 rounded-sm', {
|
21374
|
+
'border-grey-300 border !bg-white': !visibleItems[itemData.id]
|
21375
|
+
}),
|
21376
|
+
style: {
|
21377
|
+
backgroundColor: getThemeColor(itemData.color)
|
21378
|
+
}
|
21379
|
+
}, visibleItems[itemData.id] && isHovered && (/*#__PURE__*/React__default.createElement(Icon, {
|
21380
|
+
name: "tick-bold",
|
21381
|
+
className: "mb-2.5 !h-full !w-full text-white"
|
21382
|
+
}))), /*#__PURE__*/React__default.createElement("div", null, itemData.label))) : (/*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement("span", {
|
21383
|
+
className: "ml-1 mt-1 h-9 w-2 rounded-[1px]",
|
21384
|
+
style: {
|
21385
|
+
backgroundColor: getThemeColor(itemData.color)
|
21386
|
+
}
|
21387
|
+
}), /*#__PURE__*/React__default.createElement("div", null, itemData.label, /*#__PURE__*/React__default.createElement("span", {
|
21388
|
+
className: "-mt-1 flex w-full text-lg font-bold"
|
21389
|
+
}, formatter ? formatter(itemData.value) : itemData.value)))));
|
21390
|
+
};
|
21391
|
+
const moreButton = moreButtonText => (/*#__PURE__*/React__default.createElement(Button$1, {
|
21392
|
+
appearance: "transparent",
|
21393
|
+
className: "text-grey-700"
|
21394
|
+
}, moreButtonText));
|
21395
|
+
const className = cn('flex-grow pl-4', {
|
21396
|
+
'w-full': legendPosition === 'bottom'
|
21397
|
+
});
|
21398
|
+
return /*#__PURE__*/React__default.createElement("div", {
|
21399
|
+
className: className
|
21400
|
+
}, /*#__PURE__*/React__default.createElement("ul", {
|
21401
|
+
className: cn('mb-0 ml-0 mt-4 flex justify-center space-y-1', legendPosition === 'right' ? 'flex-col gap-1' : 'flex-row')
|
21402
|
+
}, legendPosition === 'right' ? (/*#__PURE__*/React__default.createElement(React__default.Fragment, null, renderLegendItem(null), data.map(renderLegendItem))) : (/*#__PURE__*/React__default.createElement(OverflowGroup, {
|
21403
|
+
className: "w-full items-center py-1",
|
21404
|
+
moreButton: moreButton
|
21405
|
+
}, data.map(renderLegendItem)))));
|
21406
|
+
};
|
21407
|
+
|
21408
|
+
const DONUT_WIDTH = 16;
|
21409
|
+
const HOVER_DONUT_WIDTH = 10;
|
21410
|
+
|
21411
|
+
const CenteredLabel = ({
|
21412
|
+
radius,
|
21413
|
+
legendPosition,
|
21414
|
+
label,
|
21415
|
+
total,
|
21416
|
+
formatter,
|
21417
|
+
showLegend
|
21418
|
+
}) => {
|
21419
|
+
const totalInset = HOVER_DONUT_WIDTH + DONUT_WIDTH + DONUT_WIDTH;
|
21420
|
+
const diameter = radius * 2;
|
21421
|
+
return /*#__PURE__*/React__default.createElement("div", {
|
21422
|
+
className: "absolute mt-1 flex h-12 flex-col text-center",
|
21423
|
+
style: {
|
21424
|
+
top: `calc(${radius}px - (3rem / 2))`,
|
21425
|
+
left: legendPosition === 'right' ? `${totalInset}px` : `calc(50%-${diameter - 2 * totalInset})`,
|
21426
|
+
width: showLegend ? `${diameter - 2 * totalInset}px` : `${diameter}px`
|
21427
|
+
}
|
21428
|
+
}, /*#__PURE__*/React__default.createElement("span", {
|
21429
|
+
className: "w-full truncate text-lg font-bold"
|
21430
|
+
}, formatter ? formatter(total) : total), label);
|
21431
|
+
};
|
21432
|
+
|
21433
|
+
const ActiveShape = props => {
|
21434
|
+
var _getThemeColor;
|
21435
|
+
const {
|
21436
|
+
cx,
|
21437
|
+
cy,
|
21438
|
+
id,
|
21439
|
+
innerRadius,
|
21440
|
+
onClick,
|
21441
|
+
outerRadius = 0,
|
21442
|
+
pieColors,
|
21443
|
+
startAngle,
|
21444
|
+
endAngle,
|
21445
|
+
fill
|
21446
|
+
} = props;
|
21447
|
+
return /*#__PURE__*/React__default.createElement("g", {
|
21448
|
+
onClick: () => onClick(id),
|
21449
|
+
className: cn({
|
21450
|
+
'cursor-pointer': !!onClick
|
21451
|
+
})
|
21452
|
+
}, /*#__PURE__*/React__default.createElement(Recharts.Sector, {
|
21453
|
+
cx: cx,
|
21454
|
+
cy: cy,
|
21455
|
+
innerRadius: innerRadius,
|
21456
|
+
outerRadius: outerRadius,
|
21457
|
+
startAngle: startAngle,
|
21458
|
+
endAngle: endAngle,
|
21459
|
+
fill: fill
|
21460
|
+
}), /*#__PURE__*/React__default.createElement(Recharts.Sector, {
|
21461
|
+
cx: cx,
|
21462
|
+
cy: cy,
|
21463
|
+
startAngle: startAngle,
|
21464
|
+
endAngle: endAngle,
|
21465
|
+
innerRadius: outerRadius + 2,
|
21466
|
+
outerRadius: outerRadius + HOVER_DONUT_WIDTH,
|
21467
|
+
fill: id !== undefined ? (_getThemeColor = getThemeColor(pieColors[id])) !== null && _getThemeColor !== void 0 ? _getThemeColor : getThemeColor('blue-500') : getThemeColor('blue-500'),
|
21468
|
+
opacity: 0.3
|
21469
|
+
}));
|
21470
|
+
};
|
21471
|
+
|
21472
|
+
const Segment = _ => null;
|
21473
|
+
const DonutChart = function DonutChart({
|
21474
|
+
children,
|
21475
|
+
formatter,
|
21476
|
+
onClick,
|
21477
|
+
showLegend = false,
|
21478
|
+
legendPosition = 'bottom',
|
21479
|
+
label
|
21480
|
+
}) {
|
21481
|
+
const ref = React__default.useRef(null);
|
21482
|
+
const [radius, setRadius] = React__default.useState(0);
|
21483
|
+
const [hoveredItem, setHoveredItem] = React__default.useState([]);
|
21484
|
+
// used for right legends
|
21485
|
+
const [selectedItem, setSelectedItem] = React__default.useState([]);
|
21486
|
+
// used for bottom legends
|
21487
|
+
const [visibleItems, setVisibleItems] = React__default.useState(() => {
|
21488
|
+
const keys = {};
|
21489
|
+
React__default.Children.forEach(children, child => {
|
21490
|
+
keys[child.props.id] = true;
|
21491
|
+
});
|
21492
|
+
return keys;
|
21493
|
+
});
|
21494
|
+
React__default.useEffect(() => {
|
21495
|
+
if (ref.current) {
|
21496
|
+
var _ref$current$parentEl;
|
21497
|
+
const rect = (_ref$current$parentEl = ref.current.parentElement) === null || _ref$current$parentEl === void 0 ? void 0 : _ref$current$parentEl.getBoundingClientRect();
|
21498
|
+
if (rect) {
|
21499
|
+
const width = showLegend ? rect.width / 2 : rect.width;
|
21500
|
+
const max = rect.height < width ? rect.height : width;
|
21501
|
+
setRadius(max / 2);
|
21502
|
+
}
|
21503
|
+
}
|
21504
|
+
}, [showLegend]);
|
21505
|
+
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
|
21506
|
+
const data = React__default.Children.map(children, child => ({
|
21507
|
+
id: child.props.id,
|
21508
|
+
color: child.props.color,
|
21509
|
+
label: child.props.label,
|
21510
|
+
value: child.props.value
|
21511
|
+
}));
|
21512
|
+
const displayedData = data.filter(child => visibleItems[child.id]);
|
21513
|
+
const total = displayedData.reduce((accum, entry) => accum + entry.value, 0);
|
21514
|
+
const showTooltip = (!showLegend || legendPosition === 'bottom') && displayedData.length > 0;
|
21515
|
+
const handleLegendClick = entry => {
|
21516
|
+
if (legendPosition === 'bottom' && !Array.isArray(entry)) {
|
21517
|
+
setVisibleItems({
|
21518
|
+
...visibleItems,
|
21519
|
+
[entry.id]: !visibleItems[entry.id]
|
21520
|
+
});
|
21521
|
+
} else {
|
21522
|
+
const nextSelectedItem = Array.isArray(entry) ? entry.map(entryItem => entryItem.id) : [entry.id];
|
21523
|
+
// Using slice to avoid mutation of the react state 'selectedItem'
|
21524
|
+
const isCurrentSegmentActive = selectedItem.slice().sort().join(',') === nextSelectedItem.sort().join(',');
|
21525
|
+
if (onClick && !isCurrentSegmentActive) {
|
21526
|
+
onClick(entry);
|
21527
|
+
}
|
21528
|
+
setSelectedItem(isCurrentSegmentActive ? [] : nextSelectedItem);
|
21529
|
+
}
|
21530
|
+
};
|
21531
|
+
const handlePieClick = React__default.useCallback(pieId => {
|
21532
|
+
if (onClick && pieId !== undefined) {
|
21533
|
+
const pieProps = displayedData.find(item => item.id === pieId);
|
21534
|
+
onClick(pieProps);
|
21535
|
+
}
|
21536
|
+
}, [onClick, displayedData]);
|
21537
|
+
const singlePieDonutChart = displayedData.length === 1;
|
21538
|
+
const activeShapeColor = React__default.useMemo(() => {
|
21539
|
+
const getSegmentColor = item => item.reduce((colors, itemId) => {
|
21540
|
+
const visibleHoveredItem = displayedData.find(dataItem => dataItem.id === itemId);
|
21541
|
+
if (visibleHoveredItem) {
|
21542
|
+
colors[visibleHoveredItem.id] = visibleHoveredItem.color;
|
21543
|
+
}
|
21544
|
+
return colors;
|
21545
|
+
}, {});
|
21546
|
+
const hoveredSegmentColor = getSegmentColor(hoveredItem);
|
21547
|
+
const selectedSegmentColor = getSegmentColor(selectedItem);
|
21548
|
+
return legendPosition === 'bottom' || hoveredItem.length !== 0 ? hoveredSegmentColor : selectedSegmentColor;
|
21549
|
+
}, [hoveredItem, selectedItem, legendPosition]);
|
21550
|
+
if (ref.current && !radius) {
|
21551
|
+
return null;
|
21552
|
+
}
|
21553
|
+
const getActiveIndex = () => {
|
21554
|
+
if (hoveredItem.length > 0) {
|
21555
|
+
return hoveredItem.map(itemId => displayedData.findIndex(element => element.id === itemId));
|
21556
|
+
}
|
21557
|
+
return selectedItem.map(selectedItemId => displayedData.findIndex(element => element.id === selectedItemId));
|
21558
|
+
};
|
21559
|
+
const content = () => {
|
21560
|
+
const elements = React__default.Children.toArray(children).filter(child => /*#__PURE__*/React__default.isValidElement(child) && visibleItems[child.props.id]);
|
21561
|
+
return elements.length > 0 ? elements.map((child, index) => {
|
21562
|
+
var _getThemeColor;
|
21563
|
+
return /*#__PURE__*/React__default.createElement(Recharts.Cell, {
|
21564
|
+
key: `cell-${index}`,
|
21565
|
+
name: child.props.label,
|
21566
|
+
fill: (_getThemeColor = getThemeColor(child.props.color)) !== null && _getThemeColor !== void 0 ? _getThemeColor : getThemeColor('blue-300')
|
21567
|
+
});
|
21568
|
+
}) : (/*#__PURE__*/React__default.createElement(Recharts.Cell, {
|
21569
|
+
key: "empty-chart",
|
21570
|
+
name: '',
|
21571
|
+
fill: getThemeColor('grey-200')
|
21572
|
+
}));
|
21573
|
+
};
|
21574
|
+
return /*#__PURE__*/React__default.createElement("div", {
|
21575
|
+
className: cn('relative h-full w-full', {
|
21576
|
+
[`flex `]: showLegend,
|
21577
|
+
'flex-col items-center': legendPosition === 'bottom'
|
21578
|
+
}),
|
21579
|
+
ref: ref
|
21580
|
+
}, /*#__PURE__*/React__default.createElement(CenteredLabel, {
|
21581
|
+
radius: radius,
|
21582
|
+
legendPosition: legendPosition,
|
21583
|
+
label: label,
|
21584
|
+
total: total,
|
21585
|
+
formatter: formatter,
|
21586
|
+
showLegend: showLegend
|
21587
|
+
}), /*#__PURE__*/React__default.createElement(Recharts.PieChart, {
|
21588
|
+
data: data,
|
21589
|
+
height: diameter,
|
21590
|
+
width: diameter,
|
21591
|
+
style: {
|
21592
|
+
transform: 'rotate(90deg) scale(-1,1)'
|
21593
|
+
}
|
21594
|
+
}, showTooltip ? (/*#__PURE__*/React__default.createElement(Recharts.Tooltip, Object.assign({}, getTooltipProps({
|
21595
|
+
style: {
|
21596
|
+
transform: 'rotate(90deg) scale(-1,1)'
|
21597
|
+
},
|
21598
|
+
singlePieDonutChart
|
21599
|
+
})))) : null, /*#__PURE__*/React__default.createElement(Recharts.Pie, {
|
21600
|
+
isAnimationActive: false,
|
21601
|
+
activeIndex: getActiveIndex(),
|
21602
|
+
activeShape: /*#__PURE__*/React__default.createElement(ActiveShape, {
|
21603
|
+
pieColors: activeShapeColor,
|
21604
|
+
onClick: handlePieClick
|
21605
|
+
}),
|
21606
|
+
data: displayedData.length > 0 ? displayedData : [],
|
21607
|
+
dataKey: "value",
|
21608
|
+
innerRadius: radius - HOVER_DONUT_WIDTH - DONUT_WIDTH,
|
21609
|
+
onMouseEnter: segment => displayedData.length > 0 && setHoveredItem([segment.id]),
|
21610
|
+
onMouseLeave: () => setHoveredItem([]),
|
21611
|
+
outerRadius: radius - HOVER_DONUT_WIDTH,
|
21612
|
+
paddingAngle: 2,
|
21613
|
+
// Prevents the pie group element from being focusable
|
21614
|
+
rootTabIndex: -1
|
21615
|
+
}, content())), showLegend && (/*#__PURE__*/React__default.createElement(Legend$1, {
|
21616
|
+
data: data,
|
21617
|
+
visibleItems: visibleItems,
|
21618
|
+
onClick: handleLegendClick,
|
21619
|
+
total: total,
|
21620
|
+
setHoveredItem: setHoveredItem,
|
21621
|
+
label: label,
|
21622
|
+
legendPosition: legendPosition,
|
21623
|
+
hoveredItem: hoveredItem,
|
21624
|
+
selectedItem: selectedItem,
|
21625
|
+
formatter: formatter
|
21626
|
+
})));
|
21627
|
+
};
|
21628
|
+
DonutChart.Segment = Segment;
|
21629
|
+
|
21630
|
+
const Line$1 = _ => null;
|
21631
|
+
const LineChart = function LineChart(externalProps) {
|
21632
|
+
const {
|
21633
|
+
children,
|
21634
|
+
data,
|
21635
|
+
formatter,
|
21636
|
+
...props
|
21637
|
+
} = externalProps;
|
21638
|
+
const [hoveredLine, setHoveredLine] = React.useState(null);
|
21639
|
+
const [activeLines, setActiveLines] = React.useState(() => {
|
21640
|
+
const keys = {};
|
21641
|
+
React__default.Children.forEach(children, child => {
|
21642
|
+
keys[child.props.accessor] = true;
|
21643
|
+
});
|
21644
|
+
return keys;
|
21645
|
+
});
|
21646
|
+
const handleLegendClick = entry => {
|
21647
|
+
setHoveredLine(null);
|
21648
|
+
setActiveLines({
|
21649
|
+
...activeLines,
|
21650
|
+
[entry.dataKey]: !activeLines[entry.dataKey]
|
21651
|
+
});
|
21652
|
+
};
|
21653
|
+
return /*#__PURE__*/React__default.createElement(ResponsiveContainer, null, /*#__PURE__*/React__default.createElement(Recharts.LineChart, {
|
21654
|
+
data: data,
|
21655
|
+
margin: {
|
21656
|
+
top: 10,
|
21657
|
+
right: 0,
|
21658
|
+
left: -25,
|
21659
|
+
bottom: 0
|
21660
|
+
}
|
21661
|
+
}, /*#__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({
|
21662
|
+
onClick: handleLegendClick,
|
21663
|
+
onMouseEnter: entry => setHoveredLine(entry.dataKey),
|
21664
|
+
onMouseLeave: () => setHoveredLine(null),
|
21665
|
+
activeItems: activeLines
|
21666
|
+
}))), /*#__PURE__*/React__default.createElement(Recharts.Tooltip, Object.assign({}, getTooltipProps(), {
|
21667
|
+
formatter: formatter
|
21668
|
+
})), React__default.Children.map(children, child => {
|
21669
|
+
var _child$props$color, _child$props$color2;
|
21670
|
+
return /*#__PURE__*/React__default.createElement(Recharts.Line, {
|
21671
|
+
activeDot: {
|
21672
|
+
fill: getThemeColor((_child$props$color = child.props.color) !== null && _child$props$color !== void 0 ? _child$props$color : 'blue-300')
|
21673
|
+
},
|
21674
|
+
dataKey: child.props.accessor,
|
21675
|
+
isAnimationActive: false,
|
21676
|
+
dot: false,
|
21677
|
+
name: child.props.label,
|
21678
|
+
stroke: getThemeColor((_child$props$color2 = child.props.color) !== null && _child$props$color2 !== void 0 ? _child$props$color2 : 'blue-300'),
|
21679
|
+
strokeWidth: 2,
|
21680
|
+
hide: !activeLines[child.props.accessor],
|
21681
|
+
opacity: hoveredLine && child.props.accessor !== hoveredLine ? 0.3 : 1
|
21682
|
+
});
|
21683
|
+
})));
|
21684
|
+
};
|
21685
|
+
LineChart.Line = Line$1;
|
21686
|
+
|
20431
21687
|
const Button$4 = /*#__PURE__*/React__default.forwardRef(function Button(props, ref) {
|
20432
21688
|
const {
|
20433
21689
|
...attributes
|
@@ -20700,15 +21956,13 @@ const AgreementDisplay = props => {
|
|
20700
21956
|
}));
|
20701
21957
|
};
|
20702
21958
|
|
20703
|
-
const Container$1 =
|
20704
|
-
children
|
20705
|
-
}) => {
|
21959
|
+
const Container$1 = props => {
|
20706
21960
|
return /*#__PURE__*/React__default.createElement("div", {
|
20707
21961
|
className: "-ml-2 flex flex-shrink-0 flex-grow-0 items-center gap-2 pr-2 xl:ml-auto xl:w-64",
|
20708
21962
|
"data-taco": "header-agreements"
|
20709
21963
|
}, /*#__PURE__*/React__default.createElement("span", {
|
20710
21964
|
className: "hidden h-8 w-px flex-shrink-0 flex-grow-0 bg-white/[0.3] xl:flex"
|
20711
|
-
}), children);
|
21965
|
+
}), props.children);
|
20712
21966
|
};
|
20713
21967
|
function AgreementSelector(props) {
|
20714
21968
|
const {
|
@@ -21141,6 +22395,223 @@ Navigation2.Link = Link$3;
|
|
21141
22395
|
Navigation2.Section = Section;
|
21142
22396
|
Navigation2.Content = Content$a;
|
21143
22397
|
|
22398
|
+
const DATASET_SIZE_MULTIPLIER = 15;
|
22399
|
+
function useTableDataLoader2(fetchPage, fetchAll, options = {
|
22400
|
+
pageSize: DEFAULT_PAGE_SIZE
|
22401
|
+
}) {
|
22402
|
+
const loadPage = function (pageIndex, sorting, filters, hiddenColumns, search, reset = false) {
|
22403
|
+
try {
|
22404
|
+
// if a request is already pending for this page (and it's not a reset), skip it
|
22405
|
+
if (_pendingPageRequests.current[pageIndex] && !reset) {
|
22406
|
+
return Promise.resolve();
|
22407
|
+
}
|
22408
|
+
const hasChangedData = JSON.stringify(sorting) !== JSON.stringify(_lastUsedSorting.current) || JSON.stringify(filters) !== JSON.stringify(_lastUsedFilters.current) || search !== _lastUsedSearch.current;
|
22409
|
+
// if the page is already loaded and has actual rows, abort
|
22410
|
+
if (data.cache[pageIndex] && data.cache[pageIndex][0] && !hasChangedData && !reset) {
|
22411
|
+
return Promise.resolve();
|
22412
|
+
}
|
22413
|
+
// create an id to track the update
|
22414
|
+
const requestId = uuid.v4();
|
22415
|
+
// set the page as loading, so that subsequent requests don't retrigger it
|
22416
|
+
_pendingPageRequests.current[pageIndex] = true;
|
22417
|
+
const _temp2 = _catch(function () {
|
22418
|
+
_lastRequestId.current = requestId;
|
22419
|
+
return Promise.resolve(fetchPage(pageIndex, pageSize, sorting, filters, hiddenColumns, search)).then(function (response) {
|
22420
|
+
length.current = response.length;
|
22421
|
+
// update state, here we do some "magic" to support "load in place"
|
22422
|
+
setData(currentData => {
|
22423
|
+
// if this request wasn't the last one, just return the current state to prevent weird updates
|
22424
|
+
if (_lastRequestId.current !== requestId) {
|
22425
|
+
return currentData;
|
22426
|
+
}
|
22427
|
+
const direction = getDirection(pageIndex, currentData.pages);
|
22428
|
+
const nextPages = getPages(pageIndex, currentData.lastFetchedPage, reset ? [] : currentData.pages, direction);
|
22429
|
+
// set values so we can track if they changed between loads
|
22430
|
+
_lastUsedSorting.current = sorting;
|
22431
|
+
_lastUsedFilters.current = filters;
|
22432
|
+
_lastUsedSearch.current = search;
|
22433
|
+
_lastUsedHiddenColumns.current = hiddenColumns;
|
22434
|
+
// cache data as an object to prevent any duplicates for pages
|
22435
|
+
let nextCache;
|
22436
|
+
if (reset || hasChangedData || !direction) {
|
22437
|
+
nextCache = nextPages.reduce((acc, p) => ({
|
22438
|
+
...acc,
|
22439
|
+
[p]: Array(pageSize).fill(undefined)
|
22440
|
+
}), {});
|
22441
|
+
} else {
|
22442
|
+
nextCache = {
|
22443
|
+
...currentData.cache
|
22444
|
+
};
|
22445
|
+
}
|
22446
|
+
nextCache[pageIndex] = response.data;
|
22447
|
+
// cleanup "unloaded" pages
|
22448
|
+
if (direction === 'forward' && currentData.rows.length >= DATASET_SIZE) {
|
22449
|
+
delete nextCache[currentData.pages[0]];
|
22450
|
+
} else if (direction === 'backward' && currentData.rows.length >= DATASET_SIZE) {
|
22451
|
+
delete nextCache[currentData.pages[currentData.pages.length - 1]];
|
22452
|
+
}
|
22453
|
+
// remap rows from the cached data - do it here and not in render to save some performance
|
22454
|
+
const rows = Object.values(nextCache).reduce((acc, p) => acc.concat(p), []);
|
22455
|
+
return {
|
22456
|
+
cache: nextCache,
|
22457
|
+
pages: nextPages,
|
22458
|
+
rows: rows,
|
22459
|
+
lastFetchedPage: pageIndex
|
22460
|
+
};
|
22461
|
+
});
|
22462
|
+
// reset pending requests
|
22463
|
+
delete _pendingPageRequests.current[pageIndex];
|
22464
|
+
});
|
22465
|
+
}, function () {});
|
22466
|
+
return Promise.resolve(_temp2 && _temp2.then ? _temp2.then(function () {}) : void 0);
|
22467
|
+
} catch (e) {
|
22468
|
+
return Promise.reject(e);
|
22469
|
+
}
|
22470
|
+
};
|
22471
|
+
const {
|
22472
|
+
pageSize
|
22473
|
+
} = options;
|
22474
|
+
const DATASET_SIZE = DATASET_SIZE_MULTIPLIER * pageSize;
|
22475
|
+
// track the data length, we don't know it until the first request
|
22476
|
+
const length = React__default.useRef(0);
|
22477
|
+
// data will be filled after the first request
|
22478
|
+
const [data, setData] = React__default.useState({
|
22479
|
+
rows: [],
|
22480
|
+
pages: [],
|
22481
|
+
cache: {},
|
22482
|
+
lastFetchedPage: undefined
|
22483
|
+
});
|
22484
|
+
// track which pages have been loaded to dedupe requests
|
22485
|
+
const _pendingPageRequests = React__default.useRef({});
|
22486
|
+
// it's possible to spam updates, e.g. sort, so we don't set state if the last request wasn't the current oen
|
22487
|
+
const _lastRequestId = React__default.useRef();
|
22488
|
+
// store last used properties
|
22489
|
+
const _lastUsedSorting = React__default.useRef([]);
|
22490
|
+
const _lastUsedFilters = React__default.useRef([]);
|
22491
|
+
const _lastUsedSearch = React__default.useRef();
|
22492
|
+
const _lastUsedHiddenColumns = React__default.useRef([]);
|
22493
|
+
const loadAll = function (sorting, filters, hiddenColumns, search) {
|
22494
|
+
try {
|
22495
|
+
// set values so we can track if they changed between loads
|
22496
|
+
_lastUsedSorting.current = sorting;
|
22497
|
+
_lastUsedFilters.current = filters;
|
22498
|
+
_lastUsedSearch.current = search;
|
22499
|
+
_lastUsedHiddenColumns.current = hiddenColumns;
|
22500
|
+
const _temp = _finallyRethrows(function () {
|
22501
|
+
return _catch(function () {
|
22502
|
+
return Promise.resolve(fetchAll(sorting, filters, hiddenColumns, search)).then(function (response) {
|
22503
|
+
length.current = response.length;
|
22504
|
+
const pages = [];
|
22505
|
+
const cache = {};
|
22506
|
+
const pageCount = Math.ceil(response.length / pageSize);
|
22507
|
+
Array.from(Array(pageCount).keys()).forEach(index => {
|
22508
|
+
pages.push(index);
|
22509
|
+
const startIndex = index * pageSize;
|
22510
|
+
cache[index] = response.data.slice(startIndex, startIndex + pageSize);
|
22511
|
+
});
|
22512
|
+
setData({
|
22513
|
+
cache,
|
22514
|
+
pages,
|
22515
|
+
rows: response.data,
|
22516
|
+
lastFetchedPage: undefined
|
22517
|
+
});
|
22518
|
+
});
|
22519
|
+
}, function () {});
|
22520
|
+
}, function (_wasThrown, _result) {
|
22521
|
+
// reset pending requests
|
22522
|
+
_pendingPageRequests.current = {};
|
22523
|
+
if (_wasThrown) throw _result;
|
22524
|
+
return _result;
|
22525
|
+
});
|
22526
|
+
return Promise.resolve(_temp && _temp.then ? _temp.then(function () {}) : void 0);
|
22527
|
+
} catch (e) {
|
22528
|
+
return Promise.reject(e);
|
22529
|
+
}
|
22530
|
+
};
|
22531
|
+
const invalidate = function () {
|
22532
|
+
try {
|
22533
|
+
// reset stuff
|
22534
|
+
_pendingPageRequests.current = {};
|
22535
|
+
// load the current page again
|
22536
|
+
return loadPage(getCurrentPage(data.pages), _lastUsedSorting.current, _lastUsedFilters.current, _lastUsedHiddenColumns.current, _lastUsedSearch.current, true);
|
22537
|
+
} catch (e) {
|
22538
|
+
return Promise.reject(e);
|
22539
|
+
}
|
22540
|
+
};
|
22541
|
+
const handleSort = function (sorting) {
|
22542
|
+
try {
|
22543
|
+
// reset before loading the current page
|
22544
|
+
_pendingPageRequests.current = {};
|
22545
|
+
return loadPage(getCurrentPage(data.pages), sorting, _lastUsedFilters.current, _lastUsedHiddenColumns.current, _lastUsedSearch.current, true);
|
22546
|
+
} catch (e) {
|
22547
|
+
return Promise.reject(e);
|
22548
|
+
}
|
22549
|
+
};
|
22550
|
+
const handleFilter = function (filters, hiddenColumns) {
|
22551
|
+
try {
|
22552
|
+
// reset before loading the current page
|
22553
|
+
_pendingPageRequests.current = {};
|
22554
|
+
return loadPage(0, _lastUsedSorting.current, filters, hiddenColumns, _lastUsedSearch.current, true);
|
22555
|
+
} catch (e) {
|
22556
|
+
return Promise.reject(e);
|
22557
|
+
}
|
22558
|
+
};
|
22559
|
+
const handleSearch = function (search, hiddenColumns) {
|
22560
|
+
try {
|
22561
|
+
// reset before loading the current page
|
22562
|
+
_pendingPageRequests.current = {};
|
22563
|
+
return loadPage(0, _lastUsedSorting.current, _lastUsedFilters.current, hiddenColumns, search, true);
|
22564
|
+
} catch (e) {
|
22565
|
+
return Promise.reject(e);
|
22566
|
+
}
|
22567
|
+
};
|
22568
|
+
return [{
|
22569
|
+
data: data.rows,
|
22570
|
+
pages: data.pages,
|
22571
|
+
length: length.current,
|
22572
|
+
loadAll,
|
22573
|
+
loadPage,
|
22574
|
+
onChangeFilter: handleFilter,
|
22575
|
+
onChangeSearch: handleSearch,
|
22576
|
+
onChangeSort: handleSort,
|
22577
|
+
pageSize,
|
22578
|
+
_experimentalDataLoader2: true
|
22579
|
+
}, invalidate];
|
22580
|
+
}
|
22581
|
+
function getCurrentPage(currentPages) {
|
22582
|
+
if (currentPages.length <= 2) {
|
22583
|
+
return currentPages[0];
|
22584
|
+
}
|
22585
|
+
// for even page lengths we can't know which is the current visible page - it could even be both
|
22586
|
+
// so we load one of them and rely on the "load next/previous page" functionality in row
|
22587
|
+
const middle = Math.floor(currentPages.length / 2);
|
22588
|
+
return currentPages[middle];
|
22589
|
+
}
|
22590
|
+
function getDirection(pageIndex, currentPages) {
|
22591
|
+
if (currentPages.length) {
|
22592
|
+
if (pageIndex === currentPages[currentPages.length - 1] + 1) {
|
22593
|
+
return 'forward';
|
22594
|
+
} else if (pageIndex === currentPages[0] - 1 || currentPages.length === 2 && currentPages[0] !== 0 && pageIndex === currentPages[0]) {
|
22595
|
+
return 'backward';
|
22596
|
+
}
|
22597
|
+
}
|
22598
|
+
return undefined;
|
22599
|
+
}
|
22600
|
+
function getPages(pageIndex, lastUsedPageIndex, currentPages, direction) {
|
22601
|
+
if (currentPages.length && (pageIndex === lastUsedPageIndex || currentPages.includes(pageIndex))) {
|
22602
|
+
return currentPages;
|
22603
|
+
}
|
22604
|
+
if (direction === 'forward') {
|
22605
|
+
const nextPages = currentPages.length === DATASET_SIZE_MULTIPLIER ? currentPages.slice(1) : currentPages;
|
22606
|
+
return nextPages.concat(pageIndex);
|
22607
|
+
}
|
22608
|
+
if (direction === 'backward') {
|
22609
|
+
const nextPages = currentPages.length === DATASET_SIZE_MULTIPLIER ? currentPages.slice(0, -1) : currentPages;
|
22610
|
+
return [pageIndex].concat(nextPages);
|
22611
|
+
}
|
22612
|
+
return [pageIndex];
|
22613
|
+
}
|
22614
|
+
|
21144
22615
|
const useBoundaryOverflowDetection = (ref, dependencies = []) => {
|
21145
22616
|
const [boundaryIndex, setBoundaryIndex] = React__default.useState();
|
21146
22617
|
const dimensions = useBoundingClientRectListener(ref, dependencies);
|
@@ -21174,10 +22645,12 @@ const useOnClickOutside = (ref, callback) => {
|
|
21174
22645
|
exports.Accordion = Accordion;
|
21175
22646
|
exports.Alert = Alert;
|
21176
22647
|
exports.AlertDialog = AlertDialog;
|
22648
|
+
exports.AreaChart = AreaChart;
|
21177
22649
|
exports.Backdrop = Backdrop;
|
21178
22650
|
exports.Badge = Badge;
|
21179
22651
|
exports.BadgeIcon = BadgeIcon;
|
21180
22652
|
exports.Banner = Banner;
|
22653
|
+
exports.BarChart = BarChart;
|
21181
22654
|
exports.Base = Base;
|
21182
22655
|
exports.Button = Button$1;
|
21183
22656
|
exports.Calendar = Calendar$1;
|
@@ -21188,6 +22661,7 @@ exports.Combobox = Combobox;
|
|
21188
22661
|
exports.DEFAULT_PAGE_SIZE = DEFAULT_PAGE_SIZE;
|
21189
22662
|
exports.Datepicker = Datepicker;
|
21190
22663
|
exports.Dialog = Dialog;
|
22664
|
+
exports.DonutChart = DonutChart;
|
21191
22665
|
exports.Drawer = Drawer;
|
21192
22666
|
exports.Field = Field;
|
21193
22667
|
exports.Form = Form;
|
@@ -21199,6 +22673,7 @@ exports.Icon = Icon;
|
|
21199
22673
|
exports.IconButton = IconButton;
|
21200
22674
|
exports.Input = Input;
|
21201
22675
|
exports.Layout = Layout$1;
|
22676
|
+
exports.LineChart = LineChart;
|
21202
22677
|
exports.List = List$1;
|
21203
22678
|
exports.Listbox = Listbox;
|
21204
22679
|
exports.LocalizationContext = LocalizationContext;
|
@@ -21276,6 +22751,7 @@ exports.useOnClickOutside = useOnClickOutside;
|
|
21276
22751
|
exports.usePagination = usePagination;
|
21277
22752
|
exports.useRadioGroup = useRadioGroup;
|
21278
22753
|
exports.useTableDataLoader = useTableDataLoader;
|
22754
|
+
exports.useTableDataLoader2 = useTableDataLoader2;
|
21279
22755
|
exports.useTableRowCreation = useTableRowCreation;
|
21280
22756
|
exports.useToast = useToast;
|
21281
22757
|
//# sourceMappingURL=taco.cjs.development.js.map
|