@cube-dev/ui-kit 0.156.0 → 0.157.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/CHANGELOG.md +220 -0
- package/dist/_internal/hooks/use-chained-callback.js +1 -1
- package/dist/_internal/hooks/use-debounced-value.js +1 -1
- package/dist/_internal/hooks/use-deprecation-warning.js +1 -1
- package/dist/_internal/hooks/use-event.js +1 -1
- package/dist/_internal/hooks/use-is-first-render.js +1 -1
- package/dist/_internal/hooks/use-sync-ref.js +1 -1
- package/dist/_internal/hooks/use-timer/timer.js +1 -1
- package/dist/_internal/hooks/use-timer/use-timer.js +1 -1
- package/dist/_internal/hooks/use-warn.js +1 -1
- package/dist/components/Block.js +1 -1
- package/dist/components/CollectionItem.js +1 -1
- package/dist/components/GlobalStyles.js +1 -1
- package/dist/components/GridProvider.js +1 -1
- package/dist/components/HiddenInput.js +1 -1
- package/dist/components/Root.js +1 -1
- package/dist/components/actions/Action/Action.js +1 -1
- package/dist/components/actions/Banner/Banner.js +1 -1
- package/dist/components/actions/Button/Button.js +1 -1
- package/dist/components/actions/ButtonGroup/ButtonGroup.js +1 -1
- package/dist/components/actions/ButtonSplit/ButtonSplit.js +1 -1
- package/dist/components/actions/ButtonSplit/context.js +1 -1
- package/dist/components/actions/CommandMenu/CommandMenu.js +1 -1
- package/dist/components/actions/CommandMenu/styled.js +1 -1
- package/dist/components/actions/ItemAction/ItemAction.js +1 -1
- package/dist/components/actions/ItemActionContext.js +1 -1
- package/dist/components/actions/ItemButton/ItemButton.js +1 -1
- package/dist/components/actions/Link/Link.js +1 -1
- package/dist/components/actions/Menu/Menu.js +1 -1
- package/dist/components/actions/Menu/MenuItem.js +1 -1
- package/dist/components/actions/Menu/MenuSection.js +1 -1
- package/dist/components/actions/Menu/MenuTrigger.js +1 -1
- package/dist/components/actions/Menu/SubMenuTrigger.js +1 -1
- package/dist/components/actions/Menu/SubmenuTriggerContext.js +1 -1
- package/dist/components/actions/Menu/context.js +1 -1
- package/dist/components/actions/Menu/styled.js +1 -1
- package/dist/components/actions/index.js +1 -1
- package/dist/components/actions/use-action.js +1 -1
- package/dist/components/actions/use-anchored-menu.js +1 -1
- package/dist/components/actions/use-context-menu.js +42 -44
- package/dist/components/actions/use-context-menu.js.map +1 -1
- package/dist/components/content/ActiveZone/ActiveZone.js +1 -1
- package/dist/components/content/Alert/Alert.js +1 -1
- package/dist/components/content/Alert/use-alert.js +1 -1
- package/dist/components/content/Avatar/Avatar.js +1 -1
- package/dist/components/content/Badge/Badge.js +1 -1
- package/dist/components/content/Card/Card.js +1 -1
- package/dist/components/content/Content.js +1 -1
- package/dist/components/content/CopyPasteBlock/CopyPasteBlock.js +1 -1
- package/dist/components/content/CopySnippet/CopySnippet.js +1 -1
- package/dist/components/content/Disclosure/Disclosure.js +1 -1
- package/dist/components/content/Divider.js +1 -1
- package/dist/components/content/Footer.js +1 -1
- package/dist/components/content/Header.js +1 -1
- package/dist/components/content/HotKeys/HotKeys.js +1 -1
- package/dist/components/content/InfoBadge/InfoBadge.js +1 -1
- package/dist/components/content/InlineInput/InlineInput.js +1 -1
- package/dist/components/content/Item/Item.js +1 -1
- package/dist/components/content/ItemBadge/ItemBadge.js +1 -1
- package/dist/components/content/ItemCard/ItemCard.js +1 -1
- package/dist/components/content/Layout/GridLayout.js +1 -1
- package/dist/components/content/Layout/Layout.js +1 -1
- package/dist/components/content/Layout/LayoutBlock.js +1 -1
- package/dist/components/content/Layout/LayoutCenter.js +1 -1
- package/dist/components/content/Layout/LayoutContainer.js +1 -1
- package/dist/components/content/Layout/LayoutContent.js +1 -1
- package/dist/components/content/Layout/LayoutContext.js +1 -1
- package/dist/components/content/Layout/LayoutFlex.js +1 -1
- package/dist/components/content/Layout/LayoutFooter.js +1 -1
- package/dist/components/content/Layout/LayoutGrid.js +1 -1
- package/dist/components/content/Layout/LayoutHeader.js +1 -1
- package/dist/components/content/Layout/LayoutPane.js +1 -1
- package/dist/components/content/Layout/LayoutPanel.js +1 -1
- package/dist/components/content/Layout/LayoutPanelHeader.js +1 -1
- package/dist/components/content/Layout/LayoutToolbar.js +1 -1
- package/dist/components/content/Layout/hooks/useTinyScrollbar.js +1 -1
- package/dist/components/content/Layout/index.js +1 -1
- package/dist/components/content/Layout/utils.js +1 -1
- package/dist/components/content/Paragraph.js +1 -1
- package/dist/components/content/Placeholder/Placeholder.js +1 -1
- package/dist/components/content/PrismCode/PrismCode.js +1 -1
- package/dist/components/content/PrismCode/prismSetup.js +1 -1
- package/dist/components/content/PrismDiffCode/PrismDiffCode.js +1 -1
- package/dist/components/content/Result/Result.js +1 -1
- package/dist/components/content/Skeleton/Skeleton.js +1 -1
- package/dist/components/content/Tag/Tag.js +2 -2
- package/dist/components/content/Tag/Tag.js.map +1 -1
- package/dist/components/content/Text.d.ts +14 -14
- package/dist/components/content/Text.js +1 -1
- package/dist/components/content/TextItem/TextItem.js +1 -1
- package/dist/components/content/Title.js +1 -1
- package/dist/components/content/Tree/Tree.js +1 -1
- package/dist/components/content/Tree/TreeNode.js +1 -1
- package/dist/components/content/Tree/styled.js +1 -1
- package/dist/components/content/Tree/tree-index.js +1 -1
- package/dist/components/content/Tree/use-checkbox-tree.js +1 -1
- package/dist/components/content/Tree/use-load-data.js +1 -1
- package/dist/components/content/highlightText.js +1 -1
- package/dist/components/content/use-auto-tooltip.js +1 -1
- package/dist/components/data/DataTable/DataTable.d.ts +13 -0
- package/dist/components/data/DataTable/DataTable.js +246 -0
- package/dist/components/data/DataTable/DataTable.js.map +1 -0
- package/dist/components/data/DataTable/index.d.ts +3 -0
- package/dist/components/data/DataTable/types.d.ts +145 -0
- package/dist/components/data/ItemTable/ItemTable.d.ts +19 -0
- package/dist/components/data/ItemTable/ItemTable.js +350 -0
- package/dist/components/data/ItemTable/ItemTable.js.map +1 -0
- package/dist/components/data/ItemTable/ItemTableBulkBar.d.ts +23 -0
- package/dist/components/data/ItemTable/ItemTableBulkBar.js +131 -0
- package/dist/components/data/ItemTable/ItemTableBulkBar.js.map +1 -0
- package/dist/components/data/ItemTable/ItemTableDragPreview.js +46 -0
- package/dist/components/data/ItemTable/ItemTableDragPreview.js.map +1 -0
- package/dist/components/data/ItemTable/ItemTableFooter.js +79 -0
- package/dist/components/data/ItemTable/ItemTableFooter.js.map +1 -0
- package/dist/components/data/ItemTable/ItemTableToolbar.d.ts +34 -0
- package/dist/components/data/ItemTable/ItemTableToolbar.js +91 -0
- package/dist/components/data/ItemTable/ItemTableToolbar.js.map +1 -0
- package/dist/components/data/ItemTable/index.d.ts +4 -0
- package/dist/components/data/ItemTable/types.d.ts +327 -0
- package/dist/components/data/TableBase/ColumnResizer.js +70 -0
- package/dist/components/data/TableBase/ColumnResizer.js.map +1 -0
- package/dist/components/data/TableBase/RowCollection.js +99 -0
- package/dist/components/data/TableBase/RowCollection.js.map +1 -0
- package/dist/components/data/TableBase/TableRow.js +89 -0
- package/dist/components/data/TableBase/TableRow.js.map +1 -0
- package/dist/components/data/TableBase/TableView.d.ts +22 -0
- package/dist/components/data/TableBase/TableView.js +921 -0
- package/dist/components/data/TableBase/TableView.js.map +1 -0
- package/dist/components/data/TableBase/index.d.ts +5 -0
- package/dist/components/data/TableBase/row-menu.js +40 -0
- package/dist/components/data/TableBase/row-menu.js.map +1 -0
- package/dist/components/data/TableBase/styled.d.ts +5 -0
- package/dist/components/data/TableBase/styled.js +532 -0
- package/dist/components/data/TableBase/styled.js.map +1 -0
- package/dist/components/data/TableBase/types.d.ts +160 -0
- package/dist/components/data/TableBase/types.js +31 -0
- package/dist/components/data/TableBase/types.js.map +1 -0
- package/dist/components/data/TableBase/use-cell-selection.d.ts +3 -0
- package/dist/components/data/TableBase/use-cell-selection.js +0 -0
- package/dist/components/data/TableBase/use-cell-selection.js.map +1 -0
- package/dist/components/data/TableBase/use-container-width.js +35 -0
- package/dist/components/data/TableBase/use-container-width.js.map +1 -0
- package/dist/components/data/TableBase/use-row-move-animation.js +90 -0
- package/dist/components/data/TableBase/use-row-move-animation.js.map +1 -0
- package/dist/components/data/TableBase/use-scrollability.js +49 -0
- package/dist/components/data/TableBase/use-scrollability.js.map +1 -0
- package/dist/components/data/TableBase/use-table-columns.d.ts +2 -0
- package/dist/components/data/TableBase/use-table-columns.js +166 -0
- package/dist/components/data/TableBase/use-table-columns.js.map +1 -0
- package/dist/components/data/TableBase/use-table-search.js +64 -0
- package/dist/components/data/TableBase/use-table-search.js.map +1 -0
- package/dist/components/data/TableBase/use-table-selection.d.ts +4 -0
- package/dist/components/data/TableBase/use-table-selection.js +233 -0
- package/dist/components/data/TableBase/use-table-selection.js.map +1 -0
- package/dist/components/data/TableBase/use-table-sort.js +91 -0
- package/dist/components/data/TableBase/use-table-sort.js.map +1 -0
- package/dist/components/data/TableBase/use-table-sorts.js +97 -0
- package/dist/components/data/TableBase/use-table-sorts.js.map +1 -0
- package/dist/components/data/TableBase/use-table-storage.d.ts +8 -0
- package/dist/components/data/TableBase/use-table-storage.js +58 -0
- package/dist/components/data/TableBase/use-table-storage.js.map +1 -0
- package/dist/components/data/index.d.ts +10 -0
- package/dist/components/fields/Checkbox/Checkbox.js +1 -1
- package/dist/components/fields/Checkbox/CheckboxGroup.js +1 -1
- package/dist/components/fields/Checkbox/context.js +1 -1
- package/dist/components/fields/ColorInput/ColorInput.d.ts +67 -0
- package/dist/components/fields/ColorInput/ColorInput.js +230 -0
- package/dist/components/fields/ColorInput/ColorInput.js.map +1 -0
- package/dist/components/fields/ColorInput/index.d.ts +2 -0
- package/dist/components/fields/ColorPicker/ColorPicker.d.ts +34 -37
- package/dist/components/fields/ColorPicker/ColorPicker.js +131 -182
- package/dist/components/fields/ColorPicker/ColorPicker.js.map +1 -1
- package/dist/components/fields/ColorPicker/index.d.ts +1 -3
- package/dist/components/fields/ColorSwatchGroup/ColorSwatchGroup.d.ts +50 -0
- package/dist/components/fields/ColorSwatchGroup/ColorSwatchGroup.js +269 -0
- package/dist/components/fields/ColorSwatchGroup/ColorSwatchGroup.js.map +1 -0
- package/dist/components/fields/ColorSwatchGroup/index.d.ts +2 -0
- package/dist/components/fields/ComboBox/ComboBox.js +1 -1
- package/dist/components/fields/CommandTextArea/CommandTextArea.js +1 -1
- package/dist/components/fields/CommandTextArea/caretPosition.js +1 -1
- package/dist/components/fields/CommandTextArea/useCaretAnchor.js +1 -1
- package/dist/components/fields/DatePicker/DateInput.js +1 -1
- package/dist/components/fields/DatePicker/DateInputBase.js +1 -1
- package/dist/components/fields/DatePicker/DatePicker.js +1 -1
- package/dist/components/fields/DatePicker/DatePickerButton.js +1 -1
- package/dist/components/fields/DatePicker/DatePickerElement.js +1 -1
- package/dist/components/fields/DatePicker/DatePickerInput.js +1 -1
- package/dist/components/fields/DatePicker/DatePickerSegment.js +1 -1
- package/dist/components/fields/DatePicker/DateRangePicker.js +1 -1
- package/dist/components/fields/DatePicker/DateRangeSeparatedPicker.js +1 -1
- package/dist/components/fields/DatePicker/MonthPicker.js +1 -1
- package/dist/components/fields/DatePicker/PeriodPicker.js +1 -1
- package/dist/components/fields/DatePicker/QuarterPicker.js +1 -1
- package/dist/components/fields/DatePicker/TimeInput.js +1 -1
- package/dist/components/fields/DatePicker/WeekPicker.js +1 -1
- package/dist/components/fields/DatePicker/YearPicker.js +1 -1
- package/dist/components/fields/DatePicker/parseDate.js +1 -1
- package/dist/components/fields/DatePicker/period.js +1 -1
- package/dist/components/fields/DatePicker/props.js +1 -1
- package/dist/components/fields/DatePicker/utils.js +1 -1
- package/dist/components/fields/FileInput/FileInput.js +1 -1
- package/dist/components/fields/FilterListBox/FilterListBox.js +2 -1
- package/dist/components/fields/FilterListBox/FilterListBox.js.map +1 -1
- package/dist/components/fields/FilterPicker/FilterPicker.js +6 -1
- package/dist/components/fields/FilterPicker/FilterPicker.js.map +1 -1
- package/dist/components/fields/Input/Input.js +2 -2
- package/dist/components/fields/ListBox/DraggableListBox.js +1 -1
- package/dist/components/fields/ListBox/ListBox.d.ts +7 -0
- package/dist/components/fields/ListBox/ListBox.js +4 -3
- package/dist/components/fields/ListBox/ListBox.js.map +1 -1
- package/dist/components/fields/ListBoxPopover/ListBoxPopover.js +1 -1
- package/dist/components/fields/ListBoxPopover/listNavigation.js +1 -1
- package/dist/components/fields/ListBoxPopover/useCompositeFocus.js +1 -1
- package/dist/components/fields/NumberInput/NumberInput.js +1 -1
- package/dist/components/fields/NumberInput/StepButton.js +1 -1
- package/dist/components/fields/PasswordInput/PasswordInput.d.ts +2 -2
- package/dist/components/fields/PasswordInput/PasswordInput.js +12 -2
- package/dist/components/fields/PasswordInput/PasswordInput.js.map +1 -1
- package/dist/components/fields/Picker/Picker.js +6 -1
- package/dist/components/fields/Picker/Picker.js.map +1 -1
- package/dist/components/fields/RadioGroup/Radio.d.ts +2 -2
- package/dist/components/fields/RadioGroup/Radio.js +4 -4
- package/dist/components/fields/RadioGroup/Radio.js.map +1 -1
- package/dist/components/fields/RadioGroup/RadioGroup.js +1 -1
- package/dist/components/fields/RadioGroup/context.js +1 -1
- package/dist/components/fields/SearchComboBox/SearchComboBox.js +1 -1
- package/dist/components/fields/SearchInput/SearchInput.d.ts +2 -2
- package/dist/components/fields/SearchInput/SearchInput.js +17 -4
- package/dist/components/fields/SearchInput/SearchInput.js.map +1 -1
- package/dist/components/fields/Select/Select.js +1 -1
- package/dist/components/fields/Slider/Gradation.js +1 -1
- package/dist/components/fields/Slider/HueSlider.js +1 -1
- package/dist/components/fields/Slider/RangeSlider.js +1 -1
- package/dist/components/fields/Slider/Slider.js +1 -1
- package/dist/components/fields/Slider/SliderBase.js +1 -1
- package/dist/components/fields/Slider/SliderThumb.js +1 -1
- package/dist/components/fields/Slider/SliderTrack.js +1 -1
- package/dist/components/fields/Slider/elements.js +1 -1
- package/dist/components/fields/Slider/index.js +1 -1
- package/dist/components/fields/Switch/Switch.js +1 -1
- package/dist/components/fields/TextArea/TextArea.d.ts +2 -2
- package/dist/components/fields/TextArea/TextArea.js +12 -5
- package/dist/components/fields/TextArea/TextArea.js.map +1 -1
- package/dist/components/fields/TextInput/TextInput.d.ts +2 -2
- package/dist/components/fields/TextInput/TextInput.js +15 -3
- package/dist/components/fields/TextInput/TextInput.js.map +1 -1
- package/dist/components/fields/TextInput/TextInputBase.d.ts +17 -1
- package/dist/components/fields/TextInput/TextInputBase.js +1 -1
- package/dist/components/fields/TextInput/TextInputBase.js.map +1 -1
- package/dist/components/fields/TextInput/index.d.ts +1 -1
- package/dist/components/fields/TextInputMapper/TextInputMapper.js +1 -1
- package/dist/components/fields/{ColorPicker/ColorPickerPanel.js → color/ColorPanel.js} +14 -11
- package/dist/components/fields/color/ColorPanel.js.map +1 -0
- package/dist/components/fields/color/ColorSwatch.d.ts +22 -0
- package/dist/components/fields/color/ColorSwatch.js +58 -0
- package/dist/components/fields/color/ColorSwatch.js.map +1 -0
- package/dist/components/fields/{ColorPicker → color}/channels.d.ts +1 -1
- package/dist/components/fields/{ColorPicker → color}/channels.js +2 -2
- package/dist/components/fields/color/channels.js.map +1 -0
- package/dist/components/fields/color/color.d.ts +21 -0
- package/dist/components/fields/{ColorPicker → color}/color.js +2 -2
- package/dist/components/fields/color/color.js.map +1 -0
- package/dist/components/fields/color/context.js +20 -0
- package/dist/components/fields/color/context.js.map +1 -0
- package/dist/components/fields/color/index.d.ts +4 -0
- package/dist/components/fields/index.d.ts +10 -4
- package/dist/components/form/FieldWrapper/FieldWrapper.js +1 -1
- package/dist/components/form/Form/Field.js +1 -1
- package/dist/components/form/Form/Form.js +1 -1
- package/dist/components/form/Form/ResetButton/ResetButton.js +1 -1
- package/dist/components/form/Form/SubmitButton/SubmitButton.js +1 -1
- package/dist/components/form/Form/SubmitError.js +1 -1
- package/dist/components/form/Form/index.js +1 -1
- package/dist/components/form/Form/use-field/use-field-props.js +1 -1
- package/dist/components/form/Form/use-field/use-field.js +1 -1
- package/dist/components/form/Form/use-form.js +1 -1
- package/dist/components/form/Form/validation.js +1 -1
- package/dist/components/form/Label.js +1 -1
- package/dist/components/form/validation/ValidationIndicator.js +1 -1
- package/dist/components/form/validation/resolve-validation-props.js +1 -1
- package/dist/components/form/validation/use-validation-props.js +1 -1
- package/dist/components/form/wrapper.js +1 -1
- package/dist/components/helpers/DisplayTransition/DisplayTransition.js +1 -1
- package/dist/components/helpers/IconSwitch/IconSwitch.d.ts +26 -0
- package/dist/components/helpers/IconSwitch/IconSwitch.js +1 -1
- package/dist/components/layout/Board/Board.js +1 -1
- package/dist/components/layout/Board/BoardProvider.js +1 -1
- package/dist/components/layout/Board/BoardResponsive.js +1 -1
- package/dist/components/layout/Board/Widget.js +1 -1
- package/dist/components/layout/Board/WidgetHost.js +1 -1
- package/dist/components/layout/Board/board-context.js +1 -1
- package/dist/components/layout/Board/board-store.js +1 -1
- package/dist/components/layout/Board/grid-core/calculate.js +1 -1
- package/dist/components/layout/Board/grid-core/collision.js +1 -1
- package/dist/components/layout/Board/grid-core/compactors.js +1 -1
- package/dist/components/layout/Board/grid-core/constraints.js +1 -1
- package/dist/components/layout/Board/grid-core/group-move.js +1 -1
- package/dist/components/layout/Board/grid-core/layout.js +1 -1
- package/dist/components/layout/Board/grid-core/sort.js +1 -1
- package/dist/components/layout/Board/index.js +1 -1
- package/dist/components/layout/Board/responsive-utils.js +1 -1
- package/dist/components/layout/Board/use-board-layout.js +1 -1
- package/dist/components/layout/Board/use-board-registry.js +1 -1
- package/dist/components/layout/Board/use-board-select-modifier-key.js +1 -1
- package/dist/components/layout/Board/use-board-selection.js +1 -1
- package/dist/components/layout/Flex.js +1 -1
- package/dist/components/layout/Flow.js +1 -1
- package/dist/components/layout/Grid.js +1 -1
- package/dist/components/layout/Panel.js +1 -1
- package/dist/components/layout/Prefix.js +1 -1
- package/dist/components/layout/ResizablePanel.js +1 -1
- package/dist/components/layout/Space.js +1 -1
- package/dist/components/layout/Suffix.js +1 -1
- package/dist/components/navigation/Pagination/Pagination.d.ts +9 -0
- package/dist/components/navigation/Pagination/Pagination.js +258 -0
- package/dist/components/navigation/Pagination/Pagination.js.map +1 -0
- package/dist/components/navigation/Pagination/index.d.ts +4 -0
- package/dist/components/navigation/Pagination/types.d.ts +81 -0
- package/dist/components/navigation/Pagination/use-pagination.d.ts +52 -0
- package/dist/components/navigation/Pagination/use-pagination.js +83 -0
- package/dist/components/navigation/Pagination/use-pagination.js.map +1 -0
- package/dist/components/navigation/Tabs/DraggableTabList.js +1 -1
- package/dist/components/navigation/Tabs/TabButton.js +1 -1
- package/dist/components/navigation/Tabs/TabDropIndicator.js +1 -1
- package/dist/components/navigation/Tabs/TabPanel.js +1 -1
- package/dist/components/navigation/Tabs/TabPicker.js +1 -1
- package/dist/components/navigation/Tabs/Tabs.js +1 -1
- package/dist/components/navigation/Tabs/TabsAction.js +1 -1
- package/dist/components/navigation/Tabs/TabsContext.js +1 -1
- package/dist/components/navigation/Tabs/popover-placement.js +1 -1
- package/dist/components/navigation/Tabs/styled.js +1 -1
- package/dist/components/navigation/Tabs/types.js +1 -1
- package/dist/components/navigation/Tabs/use-tab-editing.js +1 -1
- package/dist/components/navigation/Tabs/use-tab-indicator.js +1 -1
- package/dist/components/navigation/index.d.ts +5 -1
- package/dist/components/organisms/StatsCard/StatsCard.js +1 -1
- package/dist/components/other/Calendar/Calendar.js +1 -1
- package/dist/components/other/Calendar/CalendarCell.js +1 -1
- package/dist/components/other/Calendar/CalendarGrid.js +1 -1
- package/dist/components/other/Calendar/PeriodCalendar.js +1 -1
- package/dist/components/other/Calendar/RangeCalendar.js +1 -1
- package/dist/components/other/CubeLogo/CubeLogo.js +1 -1
- package/dist/components/overlays/AlertDialog/AlertDialog.js +1 -1
- package/dist/components/overlays/AlertDialog/AlertDialogApiProvider.js +1 -1
- package/dist/components/overlays/AlertDialog/AlertDialogZone.js +1 -1
- package/dist/components/overlays/Dialog/Dialog.js +1 -1
- package/dist/components/overlays/Dialog/DialogContainer.js +1 -1
- package/dist/components/overlays/Dialog/DialogForm.js +1 -1
- package/dist/components/overlays/Dialog/DialogTrigger.js +1 -1
- package/dist/components/overlays/Dialog/context.js +1 -1
- package/dist/components/overlays/Dialog/use-dialog-container.js +1 -1
- package/dist/components/overlays/Modal/Modal.js +1 -1
- package/dist/components/overlays/Modal/OpenTransitionContext.js +1 -1
- package/dist/components/overlays/Modal/Overlay.js +1 -1
- package/dist/components/overlays/Modal/Popover.js +1 -1
- package/dist/components/overlays/Modal/Tray.js +1 -1
- package/dist/components/overlays/Modal/Underlay.js +1 -1
- package/dist/components/overlays/Notifications/Notification.js +1 -1
- package/dist/components/overlays/Notifications/NotificationAction.js +1 -1
- package/dist/components/overlays/Notifications/NotificationCard.js +1 -1
- package/dist/components/overlays/Notifications/NotificationContext.js +1 -1
- package/dist/components/overlays/Notifications/NotificationItem.js +1 -1
- package/dist/components/overlays/Notifications/OverlayContainer.js +1 -1
- package/dist/components/overlays/Notifications/OverlayProvider.js +1 -1
- package/dist/components/overlays/Notifications/PersistentNotificationsList.js +1 -1
- package/dist/components/overlays/Notifications/dismissed-storage.js +1 -1
- package/dist/components/overlays/Notifications/format-relative-time.js +1 -1
- package/dist/components/overlays/Notifications/index.js +1 -1
- package/dist/components/overlays/Notifications/use-notification-state.js +1 -1
- package/dist/components/overlays/Notifications/use-notifications.js +1 -1
- package/dist/components/overlays/Notifications/use-overlay-timers.js +1 -1
- package/dist/components/overlays/Notifications/use-persistent-notifications.js +1 -1
- package/dist/components/overlays/Notifications/use-persistent-state.js +1 -1
- package/dist/components/overlays/Notifications/use-toast-state.js +1 -1
- package/dist/components/overlays/Toast/ToastItem.js +1 -1
- package/dist/components/overlays/Toast/index.js +1 -1
- package/dist/components/overlays/Toast/useProgressToast.js +1 -1
- package/dist/components/overlays/Toast/useToast.js +1 -1
- package/dist/components/overlays/Tooltip/Tooltip.js +1 -1
- package/dist/components/overlays/Tooltip/TooltipProvider.js +1 -1
- package/dist/components/overlays/Tooltip/TooltipTrigger.js +1 -1
- package/dist/components/overlays/Tooltip/context.js +1 -1
- package/dist/components/portal/Portal.js +1 -1
- package/dist/components/portal/PortalProvider.js +1 -1
- package/dist/components/portal/usePortal.js +1 -1
- package/dist/components/shared/DraggableCollection.js +24 -8
- package/dist/components/shared/DraggableCollection.js.map +1 -1
- package/dist/components/shared/InvalidIcon.js +1 -1
- package/dist/components/shared/ValidIcon.js +1 -1
- package/dist/components/status/LoadingAnimation/LoadingAnimation.js +1 -1
- package/dist/components/status/Spin/Cube.js +1 -1
- package/dist/components/status/Spin/InternalSpinner.js +1 -1
- package/dist/components/status/Spin/Spin.js +1 -1
- package/dist/components/status/Spin/SpinsContainer.js +1 -1
- package/dist/data/item-themes.js +1 -1
- package/dist/data/themes.js +1 -1
- package/dist/eslint-plugin/defaults.generated.js +219 -5
- package/dist/eslint-plugin/defaults.generated.js.map +1 -1
- package/dist/eslint-plugin/index.js +1 -1
- package/dist/eslint-plugin/rules/no-redundant-default-prop.js +1 -1
- package/dist/i18n/I18nProvider.js +1 -1
- package/dist/i18n/createFormatter.js +1 -1
- package/dist/i18n/index.js +1 -1
- package/dist/i18n/instance.js +1 -1
- package/dist/i18n/locales/de-DE/uikit.js +36 -1
- package/dist/i18n/locales/en-US/uikit.js +36 -1
- package/dist/i18n/locales/en-US/uikit.json.d.ts +41 -1
- package/dist/i18n/locales/es-ES/uikit.js +36 -1
- package/dist/i18n/locales/es-MX/uikit.js +36 -1
- package/dist/i18n/locales/fr-FR/uikit.js +36 -1
- package/dist/i18n/locales/it-IT/uikit.js +36 -1
- package/dist/i18n/locales/ja-JP/uikit.js +36 -1
- package/dist/i18n/locales/nb-NO/uikit.js +36 -1
- package/dist/i18n/locales/pt-BR/uikit.js +36 -1
- package/dist/i18n/locales/pt-PT/uikit.js +36 -1
- package/dist/i18n/locales/sv-SE/uikit.js +36 -1
- package/dist/i18n/locales/vi-VN/uikit.js +36 -1
- package/dist/i18n/locales.js +1 -1
- package/dist/i18n/useFormatter.js +1 -1
- package/dist/i18n/useI18n.js +1 -1
- package/dist/icons/AdjustmentsHorizontalIcon.js +1 -1
- package/dist/icons/AdjustmentsIcon.js +1 -1
- package/dist/icons/AiIcon.js +1 -1
- package/dist/icons/AreaChartIcon.js +1 -1
- package/dist/icons/BackwardIcon.js +1 -1
- package/dist/icons/BarChartIcon.js +1 -1
- package/dist/icons/BellFilledIcon.js +1 -1
- package/dist/icons/BellIcon.js +1 -1
- package/dist/icons/BooleanIcon.js +1 -1
- package/dist/icons/CalendarEditIcon.js +1 -1
- package/dist/icons/CalendarIcon.js +1 -1
- package/dist/icons/CaretDownIcon.js +1 -1
- package/dist/icons/CaretUpIcon.js +1 -1
- package/dist/icons/ChartAreaStackedIcon.js +1 -1
- package/dist/icons/ChartAreaStackedPercentageIcon.js +1 -1
- package/dist/icons/ChartBarGroupedHorizontalIcon.js +1 -1
- package/dist/icons/ChartBarGroupedIcon.js +1 -1
- package/dist/icons/ChartBarHorizontalIcon.js +1 -1
- package/dist/icons/ChartBarLineIcon.js +1 -1
- package/dist/icons/ChartBarStackedHorizontalIcon.js +1 -1
- package/dist/icons/ChartBarStackedIcon.js +1 -1
- package/dist/icons/ChartBarStackedPercentageHorizontalIcon.js +1 -1
- package/dist/icons/ChartBarStackedPercentageIcon.js +1 -1
- package/dist/icons/ChartBoxPlot2Icon.js +1 -1
- package/dist/icons/ChartBoxPlotIcon.js +1 -1
- package/dist/icons/ChartBubbleIcon.js +1 -1
- package/dist/icons/ChartDonut2Icon.js +1 -1
- package/dist/icons/ChartFunnelIcon.js +1 -1
- package/dist/icons/ChartHeatmapIcon.js +1 -1
- package/dist/icons/ChartKPIIcon.js +1 -1
- package/dist/icons/ChartPie2Icon.js +1 -1
- package/dist/icons/ChartScatterIcon.js +1 -1
- package/dist/icons/CheckCircleFilledIcon.js +1 -1
- package/dist/icons/CheckCircleIcon.js +1 -1
- package/dist/icons/CheckIcon.js +1 -1
- package/dist/icons/CircleFilledIcon.js +1 -1
- package/dist/icons/ClearIcon.js +1 -1
- package/dist/icons/CloseCircleFilledIcon.js +1 -1
- package/dist/icons/CloseCircleIcon.js +1 -1
- package/dist/icons/CloseIcon.js +1 -1
- package/dist/icons/CodeIcon.js +1 -1
- package/dist/icons/ColumnTotalIcon.js +1 -1
- package/dist/icons/CopyIcon.js +1 -1
- package/dist/icons/CountIcon.js +1 -1
- package/dist/icons/CubeIcon.js +1 -1
- package/dist/icons/CubePauseIcon.js +1 -1
- package/dist/icons/CubePlayIcon.js +1 -1
- package/dist/icons/CurrencyDollarIcon.js +1 -1
- package/dist/icons/DangerIcon.js +1 -1
- package/dist/icons/DashboardIcon.js +1 -1
- package/dist/icons/DatabaseIcon.js +1 -1
- package/dist/icons/DecimalDecreaseIcon.js +1 -1
- package/dist/icons/DecimalIncreaseIcon.js +1 -1
- package/dist/icons/DirectionIcon.js +1 -1
- package/dist/icons/DonutIcon.js +1 -1
- package/dist/icons/DownIcon.js +1 -1
- package/dist/icons/EditIcon.js +1 -1
- package/dist/icons/ExclamationCircleFilledIcon.js +1 -1
- package/dist/icons/ExclamationCircleIcon.js +1 -1
- package/dist/icons/ExclamationIcon.js +1 -1
- package/dist/icons/EyeIcon.js +1 -1
- package/dist/icons/EyeInvisibleIcon.js +1 -1
- package/dist/icons/FilterIcon.js +1 -1
- package/dist/icons/FolderFilledIcon.js +1 -1
- package/dist/icons/FolderIcon.js +1 -1
- package/dist/icons/FolderOpenFilledIcon.js +1 -1
- package/dist/icons/FolderOpenIcon.js +1 -1
- package/dist/icons/ForwardIcon.js +1 -1
- package/dist/icons/GripVerticalIcon.js +1 -1
- package/dist/icons/HierarchyIcon.js +1 -1
- package/dist/icons/HierarchyOpenIcon.js +1 -1
- package/dist/icons/Icon.js +1 -1
- package/dist/icons/InfoCircleIcon.js +1 -1
- package/dist/icons/InfoIcon.js +1 -1
- package/dist/icons/KeyIcon.js +1 -1
- package/dist/icons/LeftIcon.js +1 -1
- package/dist/icons/LineChartIcon.js +1 -1
- package/dist/icons/LoadingIcon.js +1 -1
- package/dist/icons/LockFilledIcon.js +1 -1
- package/dist/icons/LockIcon.js +1 -1
- package/dist/icons/MoreIcon.js +1 -1
- package/dist/icons/NotAllowedIcon.js +1 -1
- package/dist/icons/Number123Icon.js +1 -1
- package/dist/icons/NumberIcon.js +1 -1
- package/dist/icons/PauseCircleFilledIcon.js +1 -1
- package/dist/icons/PauseCircleIcon.js +1 -1
- package/dist/icons/PauseIcon.js +1 -1
- package/dist/icons/PercentageIcon.js +1 -1
- package/dist/icons/PieChartIcon.js +1 -1
- package/dist/icons/PipetteIcon.js +1 -1
- package/dist/icons/PlayCircleIcon.js +1 -1
- package/dist/icons/PlayIcon.js +1 -1
- package/dist/icons/PlusIcon.js +1 -1
- package/dist/icons/ProgressBarIcon.js +1 -1
- package/dist/icons/ReloadIcon.js +1 -1
- package/dist/icons/ReportIcon.js +1 -1
- package/dist/icons/ReturnIcon.js +1 -1
- package/dist/icons/RightIcon.js +1 -1
- package/dist/icons/RowTotalsIcon.js +1 -1
- package/dist/icons/SchemeIcon.js +1 -1
- package/dist/icons/SearchIcon.js +1 -1
- package/dist/icons/SemanticQueryIcon.js +1 -1
- package/dist/icons/SettingsIcon.js +1 -1
- package/dist/icons/ShieldFilledIcon.js +1 -1
- package/dist/icons/ShieldIcon.js +1 -1
- package/dist/icons/SlashIcon.js +1 -1
- package/dist/icons/SparklesIcon.js +1 -1
- package/dist/icons/SqlIcon.js +1 -1
- package/dist/icons/StatsIcon.js +1 -1
- package/dist/icons/StopIcon.js +1 -1
- package/dist/icons/StringIcon.js +1 -1
- package/dist/icons/SubtotalsIcon.js +1 -1
- package/dist/icons/SwitchIcon.js +1 -1
- package/dist/icons/TableIcon.js +1 -1
- package/dist/icons/ThumbsDownIcon.js +1 -1
- package/dist/icons/ThumbsUpIcon.js +1 -1
- package/dist/icons/ThunderboltCrossedIcon.js +1 -1
- package/dist/icons/ThunderboltFilledIcon.js +1 -1
- package/dist/icons/ThunderboltIcon.js +1 -1
- package/dist/icons/TimeIcon.js +1 -1
- package/dist/icons/TrashIcon.js +1 -1
- package/dist/icons/UnlockIcon.js +1 -1
- package/dist/icons/UpIcon.js +1 -1
- package/dist/icons/UserGroupIcon.js +1 -1
- package/dist/icons/UserIcon.js +1 -1
- package/dist/icons/UserLockIcon.js +1 -1
- package/dist/icons/ViewIcon.js +1 -1
- package/dist/icons/WarningFilledIcon.js +1 -1
- package/dist/icons/WarningIcon.js +1 -1
- package/dist/icons/wrap-icon.js +1 -1
- package/dist/index.d.ts +28 -14
- package/dist/index.js +15 -7
- package/dist/index.js.map +1 -1
- package/dist/provider.js +1 -1
- package/dist/providers/TrackingProvider.js +1 -1
- package/dist/providers/navigationAdapter.default.js +1 -1
- package/dist/tokens/base.js +1 -1
- package/dist/tokens/colors.js +1 -1
- package/dist/tokens/index.js +1 -1
- package/dist/tokens/layout.js +1 -1
- package/dist/tokens/lazy-styles.js +1 -1
- package/dist/tokens/palette-config.js +1 -1
- package/dist/tokens/palette.js +1 -1
- package/dist/tokens/shadows.js +1 -1
- package/dist/tokens/sizes.js +1 -1
- package/dist/tokens/spacing.js +1 -1
- package/dist/tokens/typography.d.ts +1 -1
- package/dist/tokens/typography.js +11 -2
- package/dist/tokens/typography.js.map +1 -1
- package/dist/utils/ResizeSensor.js +1 -1
- package/dist/utils/index.d.ts +1 -0
- package/dist/utils/is-dev-env.js +1 -1
- package/dist/utils/modules.js +1 -1
- package/dist/utils/promise.js +1 -1
- package/dist/utils/raf.js +1 -1
- package/dist/utils/random.js +1 -1
- package/dist/utils/range.js +1 -1
- package/dist/utils/react/RenderCache.js +1 -1
- package/dist/utils/react/Slots.js +1 -1
- package/dist/utils/react/chain.js +1 -1
- package/dist/utils/react/forwardRefWithGenerics.js +1 -1
- package/dist/utils/react/index.d.ts +1 -0
- package/dist/utils/react/index.js +2 -1
- package/dist/utils/react/interactions.js +1 -1
- package/dist/utils/react/isTextOnly.js +1 -1
- package/dist/utils/react/mapProps.js +1 -1
- package/dist/utils/react/mergeProps.js +1 -1
- package/dist/utils/react/nullableValue.js +1 -1
- package/dist/utils/react/resolveIcon.js +1 -1
- package/dist/utils/react/sharedStore.js +1 -1
- package/dist/utils/react/useBufferedValue.d.ts +56 -0
- package/dist/utils/react/useBufferedValue.js +86 -0
- package/dist/utils/react/useBufferedValue.js.map +1 -0
- package/dist/utils/react/useCombinedRefs.js +1 -1
- package/dist/utils/react/useControlledFocusVisible.js +1 -1
- package/dist/utils/react/useEventBus.js +1 -1
- package/dist/utils/react/useId.js +1 -1
- package/dist/utils/react/useIsDarwin.js +1 -1
- package/dist/utils/react/useKeySymbols.js +1 -1
- package/dist/utils/react/useLayoutEffect.js +1 -1
- package/dist/utils/react/useLocalStorage.js +1 -1
- package/dist/utils/react/useMergeStyles.js +1 -1
- package/dist/utils/react/usePopoverSync.js +1 -1
- package/dist/utils/react/useQaProps.js +1 -1
- package/dist/utils/react/useViewportSize.js +1 -1
- package/dist/utils/react/wrapNodeIfPlain.js +1 -1
- package/dist/utils/selection.js +1 -1
- package/dist/utils/styles.js +1 -1
- package/dist/utils/tree.js +1 -1
- package/dist/utils/warnings.js +1 -1
- package/dist/version.js +2 -2
- package/docs/components/actions/ButtonGroup.md +1 -1
- package/docs/components/data/DataTable.md +298 -0
- package/docs/components/data/ItemTable.md +984 -0
- package/docs/components/fields/ColorInput.md +284 -0
- package/docs/components/fields/ColorPicker.md +85 -144
- package/docs/components/fields/ColorSwatchGroup.md +206 -0
- package/docs/components/fields/FilterPicker.md +1 -1
- package/docs/components/fields/ListBox.md +4 -0
- package/docs/components/fields/PasswordInput.md +1 -0
- package/docs/components/fields/Picker.md +1 -1
- package/docs/components/fields/SearchInput.md +1 -0
- package/docs/components/fields/TextArea.md +1 -0
- package/docs/components/fields/TextInput.md +1 -0
- package/docs/components/navigation/Pagination.md +245 -0
- package/package.json +8 -3
- package/dist/components/fields/ColorPicker/ColorPickerPanel.js.map +0 -1
- package/dist/components/fields/ColorPicker/channels.js.map +0 -1
- package/dist/components/fields/ColorPicker/color.d.ts +0 -15
- package/dist/components/fields/ColorPicker/color.js.map +0 -1
- package/dist/components/organisms/FileTabs/FileTabs.d.ts +0 -54
- package/dist/components/organisms/FileTabs/FileTabs.js +0 -282
- package/dist/components/organisms/FileTabs/FileTabs.js.map +0 -1
- package/docs/components/organisms/FileTabs.md +0 -51
|
@@ -0,0 +1,921 @@
|
|
|
1
|
+
/** @license MIT | @cube-dev/ui-kit v0.157.0 | Cube Dev Team */
|
|
2
|
+
import { useEvent } from "../../../_internal/hooks/use-event.js";
|
|
3
|
+
import { TooltipProvider } from "../../overlays/Tooltip/TooltipProvider.js";
|
|
4
|
+
import { TextItem } from "../../content/TextItem/TextItem.js";
|
|
5
|
+
import { ItemAction } from "../../actions/ItemAction/ItemAction.js";
|
|
6
|
+
import { useI18n } from "../../../i18n/useI18n.js";
|
|
7
|
+
import { UpIcon } from "../../../icons/UpIcon.js";
|
|
8
|
+
import { MoreIcon } from "../../../icons/MoreIcon.js";
|
|
9
|
+
import { _MenuTrigger } from "../../actions/Menu/MenuTrigger.js";
|
|
10
|
+
import { __Menu } from "../../actions/Menu/Menu.js";
|
|
11
|
+
import { Action } from "../../actions/Action/Action.js";
|
|
12
|
+
import { useContextMenu } from "../../actions/use-context-menu.js";
|
|
13
|
+
import { useToast } from "../../overlays/Toast/useToast.js";
|
|
14
|
+
import { __Checkbox } from "../../fields/Checkbox/Checkbox.js";
|
|
15
|
+
import { Placeholder } from "../../content/Placeholder/Placeholder.js";
|
|
16
|
+
import { Skeleton } from "../../content/Skeleton/Skeleton.js";
|
|
17
|
+
import { ColumnResizer } from "./ColumnResizer.js";
|
|
18
|
+
import { ROW_MENU_COLUMN_KEY, isMenuEmpty, normalizeMenuAction } from "./row-menu.js";
|
|
19
|
+
import { TableElement, TableHeaderItem } from "./styled.js";
|
|
20
|
+
import { TableRow, TableRowDropIndicator } from "./TableRow.js";
|
|
21
|
+
import { selectionRowKey } from "./types.js";
|
|
22
|
+
import { toTsv } from "./use-cell-selection.js";
|
|
23
|
+
import { useRowMoveAnimation } from "./use-row-move-animation.js";
|
|
24
|
+
import { useScrollability } from "./use-scrollability.js";
|
|
25
|
+
import { getColumnText, getColumnValue } from "./use-table-columns.js";
|
|
26
|
+
import { ROW_NUMBER_COLUMN_KEY, SELECTION_COLUMN_KEY } from "./use-table-selection.js";
|
|
27
|
+
import { Fragment, useCallback, useEffect, useMemo, useRef, useState } from "react";
|
|
28
|
+
import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
|
|
29
|
+
import { VisuallyHidden } from "react-aria";
|
|
30
|
+
import { useVirtualizer } from "@tanstack/react-virtual";
|
|
31
|
+
|
|
32
|
+
//#region src/components/data/TableBase/TableView.tsx
|
|
33
|
+
/**
|
|
34
|
+
* The same block as an HTML table, so a spreadsheet keeps the cell boundaries.
|
|
35
|
+
*
|
|
36
|
+
* Pasting `text/plain` TSV works, but Excel and Sheets then re-guess the types
|
|
37
|
+
* of every field; the HTML flavour is what makes a value that looks like a date
|
|
38
|
+
* stay the text it was on screen.
|
|
39
|
+
*/
|
|
40
|
+
function toClipboardHtml(matrix) {
|
|
41
|
+
return `<table>${matrix.map((row) => `<tr>${row.map((cell) => `<td>${escapeHtml(cell)}</td>`).join("")}</tr>`).join("")}</table>`;
|
|
42
|
+
}
|
|
43
|
+
function escapeHtml(value) {
|
|
44
|
+
return value.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">");
|
|
45
|
+
}
|
|
46
|
+
const ARIA_SORT = {
|
|
47
|
+
asc: "ascending",
|
|
48
|
+
desc: "descending"
|
|
49
|
+
};
|
|
50
|
+
/**
|
|
51
|
+
* Content height per size step, mirroring `$row-height` in `styled.ts`. Only the
|
|
52
|
+
* initial estimate — every rendered row is measured, so a wrong guess costs a
|
|
53
|
+
* scrollbar adjustment, not a layout bug. The `+ 1` is the row separator.
|
|
54
|
+
*/
|
|
55
|
+
/** Enough to read as "more is coming" without pretending to know how much. */
|
|
56
|
+
/**
|
|
57
|
+
* Ceiling on the load-more placeholder burst.
|
|
58
|
+
*
|
|
59
|
+
* These rows are not virtualized — they sit after the window, at the end of the
|
|
60
|
+
* body — so the count is real DOM. 50 rows is already taller than any viewport,
|
|
61
|
+
* which is all the burst has to be.
|
|
62
|
+
*/
|
|
63
|
+
const MAX_LOAD_MORE_SKELETON_ROWS = 50;
|
|
64
|
+
/**
|
|
65
|
+
* Floor on the prefetch distance, for a table too short to measure usefully —
|
|
66
|
+
* an unbounded one reports a viewport of nearly zero before it has any rows.
|
|
67
|
+
*/
|
|
68
|
+
const MIN_LOAD_MORE_MARGIN = 200;
|
|
69
|
+
const ESTIMATED_ROW_HEIGHT = {
|
|
70
|
+
xsmall: 28,
|
|
71
|
+
small: 32,
|
|
72
|
+
medium: 40,
|
|
73
|
+
large: 48,
|
|
74
|
+
xlarge: 56
|
|
75
|
+
};
|
|
76
|
+
function pinStyle(column) {
|
|
77
|
+
if (column.pinOffset == null) return void 0;
|
|
78
|
+
return { ["--pin-offset"]: `${column.pinOffset}px` };
|
|
79
|
+
}
|
|
80
|
+
/**
|
|
81
|
+
* The one place table DOM exists. Both `ItemTable` and `DataTable` resolve their
|
|
82
|
+
* props into the shape above and hand it here, so the markup, the ARIA
|
|
83
|
+
* bookkeeping and the tasty sub-element contract have a single implementation.
|
|
84
|
+
*/
|
|
85
|
+
function TableView(props) {
|
|
86
|
+
const { qa, rows, getRowKey, layout, onScrollerRef, rootRef, size = "medium", shape = "plain", rowHeight, headerHeight, isHeaderHidden = false, isStriped = false, hasColumnDividers, isRowMoveAnimated = true, isHeaderSticky = true, isVirtualized = "auto", virtualizeThreshold = 50, overscan = 20, isLoading = false, loadingIndicator = "overlay", skeletonRowCount = 6, selection, selectionTooltip, overlay, rowMenu, rowContextMenu = false, onRowMenuAction, rowMenuTriggerProps, rowLink, onRowAction, onLoadMore, hasMore = false, isLoadingMore = false, loadMoreMargin, pinnedTopRows, pinnedBottomRows, cellSelection, rowNumberOffset = 0, rowIndexOffset = 0, totalRowCount, isReorderable = false, dragState, dropState, collectionProps, bodyRef, isResizable = false, onColumnResize, onColumnResizeEnd, emptyLabel, noResultsLabel, error, isFiltered = false, sortMode = "off", sort, sorts, onColumnSort, getRowProps, headerPreset, contentPreset, toolbar, footer, ariaLabel, styles, headerStyles, headerCellStyles, bodyStyles, rowStyles, cellStyles, mods } = props;
|
|
87
|
+
const { columns } = layout;
|
|
88
|
+
const columnCount = columns.length;
|
|
89
|
+
const { t } = useI18n();
|
|
90
|
+
const toast = useToast();
|
|
91
|
+
const [scrollerEl, setScrollerEl] = useState(null);
|
|
92
|
+
const scrollerRef = useRef(null);
|
|
93
|
+
const localBodyRef = useRef(null);
|
|
94
|
+
const handleBodyRef = useCallback((element) => {
|
|
95
|
+
localBodyRef.current = element;
|
|
96
|
+
if (bodyRef) bodyRef.current = element;
|
|
97
|
+
}, [bodyRef]);
|
|
98
|
+
const handleScrollerRef = useCallback((element) => {
|
|
99
|
+
scrollerRef.current = element;
|
|
100
|
+
setScrollerEl(element);
|
|
101
|
+
onScrollerRef(element);
|
|
102
|
+
}, [onScrollerRef]);
|
|
103
|
+
const headerRowCount = isHeaderHidden ? 0 : 1;
|
|
104
|
+
const pinnedTopCount = pinnedTopRows?.length ?? 0;
|
|
105
|
+
const pinnedBottomCount = pinnedBottomRows?.length ?? 0;
|
|
106
|
+
const bodyRowCount = Math.max(totalRowCount ?? rows.length, rowIndexOffset + rows.length);
|
|
107
|
+
/** 1-based `aria-rowindex` for the i-th body row of the current page. */
|
|
108
|
+
const bodyRowIndex = (rowIndex) => headerRowCount + pinnedTopCount + rowIndexOffset + rowIndex + 1;
|
|
109
|
+
/** 1-based `aria-rowindex` for the i-th pinned row at `edge`. */
|
|
110
|
+
const pinnedRowIndex = (index, edge) => edge === "top" ? headerRowCount + index + 1 : headerRowCount + pinnedTopCount + bodyRowCount + index + 1;
|
|
111
|
+
const mergedStyles = useMemo(() => ({
|
|
112
|
+
...styles,
|
|
113
|
+
...contentPreset ? { Table: { preset: contentPreset } } : null,
|
|
114
|
+
...headerStyles ? { HeadRow: headerStyles } : null,
|
|
115
|
+
...headerPreset || headerCellStyles ? { HeaderCell: {
|
|
116
|
+
...headerPreset ? { preset: headerPreset } : null,
|
|
117
|
+
...headerCellStyles
|
|
118
|
+
} } : null,
|
|
119
|
+
...bodyStyles ? { Body: bodyStyles } : null,
|
|
120
|
+
...rowStyles ? { Row: rowStyles } : null,
|
|
121
|
+
...cellStyles ? { Cell: cellStyles } : null,
|
|
122
|
+
...rowHeight != null ? { "$row-height": `${rowHeight}px` } : null,
|
|
123
|
+
...headerHeight != null ? { "$header-height": `${headerHeight}px` } : null
|
|
124
|
+
}), [
|
|
125
|
+
styles,
|
|
126
|
+
headerStyles,
|
|
127
|
+
headerCellStyles,
|
|
128
|
+
headerPreset,
|
|
129
|
+
contentPreset,
|
|
130
|
+
bodyStyles,
|
|
131
|
+
rowStyles,
|
|
132
|
+
cellStyles,
|
|
133
|
+
rowHeight,
|
|
134
|
+
headerHeight
|
|
135
|
+
]);
|
|
136
|
+
/**
|
|
137
|
+
* Whether a cell is inside the current range.
|
|
138
|
+
*
|
|
139
|
+
* Pinned rows take part: they sit in the range's row order at the position
|
|
140
|
+
* they occupy on screen, so a selection down a column of figures reaches its
|
|
141
|
+
* total instead of leaving it to be copied separately. (ag-grid excludes
|
|
142
|
+
* pinned rows outright; this is a deliberate departure.)
|
|
143
|
+
*/
|
|
144
|
+
function isCellSelected(rowKey, columnKey) {
|
|
145
|
+
if (!cellSelection?.isEnabled) return false;
|
|
146
|
+
return cellSelection.isSelected(rowKey, columnKey);
|
|
147
|
+
}
|
|
148
|
+
/**
|
|
149
|
+
* Press and drag for the range.
|
|
150
|
+
*
|
|
151
|
+
* `pointerdown` rather than `click`: the range has to start before the drag
|
|
152
|
+
* does, and a click only lands after the button comes back up — by which time
|
|
153
|
+
* the gesture is over. `pointerenter` grows it while the button is held, which
|
|
154
|
+
* is the same shape ag-grid's `onCellMouseOver` gives the Cloud grids.
|
|
155
|
+
*/
|
|
156
|
+
function cellSelectionProps(rowKey, columnKey, pinnedEdge) {
|
|
157
|
+
if (!cellSelection?.canSelectCell(rowKey, columnKey)) return void 0;
|
|
158
|
+
return {
|
|
159
|
+
onPointerDown: (event) => {
|
|
160
|
+
if (event.button !== 0) return;
|
|
161
|
+
if (event.shiftKey) {
|
|
162
|
+
event.preventDefault();
|
|
163
|
+
cellSelection.extendTo(rowKey, columnKey);
|
|
164
|
+
} else cellSelection.select(rowKey, columnKey);
|
|
165
|
+
scrollerRef.current?.focus({ preventScroll: true });
|
|
166
|
+
cellSelection.isDraggingRef.current = true;
|
|
167
|
+
setIsRangeDragging(true);
|
|
168
|
+
},
|
|
169
|
+
onPointerEnter: () => {
|
|
170
|
+
if (!cellSelection.isDraggingRef.current) return;
|
|
171
|
+
if (pinnedEdge) return;
|
|
172
|
+
cellSelection.extendTo(rowKey, columnKey);
|
|
173
|
+
}
|
|
174
|
+
};
|
|
175
|
+
}
|
|
176
|
+
/**
|
|
177
|
+
* Marks the trailing column.
|
|
178
|
+
*
|
|
179
|
+
* Two things hang off it. Its resize handle tucks fully inside rather than
|
|
180
|
+
* straddling a boundary that is not there — left hanging it puts half its
|
|
181
|
+
* width past the table, and the scroller gains a few pixels of horizontal
|
|
182
|
+
* scroll onto blank space. And it draws no vertical rule: that rule would
|
|
183
|
+
* land flush against the frame and read as a doubled edge.
|
|
184
|
+
*/
|
|
185
|
+
/** The pinned edge a row was rendered at, as the documented section name. */
|
|
186
|
+
function sectionOf(pinnedEdge) {
|
|
187
|
+
if (pinnedEdge === "top") return "pinnedTop";
|
|
188
|
+
if (pinnedEdge === "bottom") return "pinnedBottom";
|
|
189
|
+
return "body";
|
|
190
|
+
}
|
|
191
|
+
function lastColumnFlag(column) {
|
|
192
|
+
return column.index === columns.length - 1 ? "" : void 0;
|
|
193
|
+
}
|
|
194
|
+
/**
|
|
195
|
+
* Which frame corner, if any, this cell sits in.
|
|
196
|
+
*
|
|
197
|
+
* Only the two bottom ones, and only when the card's rounded edge is what the
|
|
198
|
+
* row actually meets — a footer below it means the row ends against a straight
|
|
199
|
+
* line instead. Without this a selected cell in that row has its ring sliced
|
|
200
|
+
* off at 45° by the frame's radius, which reads as a rendering fault rather
|
|
201
|
+
* than as a corner.
|
|
202
|
+
*
|
|
203
|
+
* Decided here rather than in CSS: the renderer already knows about the
|
|
204
|
+
* footer, the shape and the pinned rows, and expressing
|
|
205
|
+
* `card × no-footer × visually-last-row × outer-column` as a state map is how
|
|
206
|
+
* a border map turns into a combinatorial one.
|
|
207
|
+
*/
|
|
208
|
+
function bottomCornerFlag(column, rowIndex, isLastRow, pinnedEdge) {
|
|
209
|
+
if (shape !== "card" || footer != null) return void 0;
|
|
210
|
+
const pinnedBottomCount = pinnedBottomRows?.length ?? 0;
|
|
211
|
+
if (!(pinnedEdge === "bottom" ? rowIndex === pinnedBottomCount - 1 : pinnedEdge == null && isLastRow && pinnedBottomCount === 0)) return void 0;
|
|
212
|
+
if (column.index === 0) return "start";
|
|
213
|
+
if (column.index === columns.length - 1) return "end";
|
|
214
|
+
}
|
|
215
|
+
function renderStateRow(content) {
|
|
216
|
+
return /* @__PURE__ */ jsx("tr", {
|
|
217
|
+
"data-element": "Row",
|
|
218
|
+
role: "row",
|
|
219
|
+
"aria-rowindex": headerRowCount + 1,
|
|
220
|
+
children: /* @__PURE__ */ jsx("td", {
|
|
221
|
+
"data-element": "StateCell",
|
|
222
|
+
"data-state": "",
|
|
223
|
+
role: "gridcell",
|
|
224
|
+
colSpan: Math.max(columnCount, 1),
|
|
225
|
+
"aria-colindex": 1,
|
|
226
|
+
children: /* @__PURE__ */ jsx("div", {
|
|
227
|
+
"data-element": "StateContent",
|
|
228
|
+
children: content
|
|
229
|
+
})
|
|
230
|
+
})
|
|
231
|
+
});
|
|
232
|
+
}
|
|
233
|
+
function renderSkeletonRows(count = skeletonRowCount, keyPrefix = "skeleton") {
|
|
234
|
+
return Array.from({ length: count }, (_, rowIndex) => /* @__PURE__ */ jsx("tr", {
|
|
235
|
+
"data-element": "Row",
|
|
236
|
+
"data-placeholder": "",
|
|
237
|
+
role: "row",
|
|
238
|
+
"aria-rowindex": bodyRowIndex(rowIndex),
|
|
239
|
+
"aria-busy": "true",
|
|
240
|
+
children: columns.map((column) => /* @__PURE__ */ jsx("td", {
|
|
241
|
+
"data-element": "Cell",
|
|
242
|
+
"data-pin": column.pin,
|
|
243
|
+
"data-pin-edge": column.isPinEdge ? "" : void 0,
|
|
244
|
+
"data-align": column.align,
|
|
245
|
+
role: "gridcell",
|
|
246
|
+
"aria-colindex": column.ariaColIndex,
|
|
247
|
+
style: pinStyle(column),
|
|
248
|
+
children: /* @__PURE__ */ jsx(Placeholder, { size: "2x" })
|
|
249
|
+
}, column.key))
|
|
250
|
+
}, `${keyPrefix}-${rowIndex}`));
|
|
251
|
+
}
|
|
252
|
+
function renderSelectionHeaderCell(column) {
|
|
253
|
+
return /* @__PURE__ */ jsx("th", {
|
|
254
|
+
"data-element": "HeaderCell",
|
|
255
|
+
"data-key": column.key,
|
|
256
|
+
"data-kind": "selection",
|
|
257
|
+
"data-pin": column.pin,
|
|
258
|
+
"data-pin-edge": column.isPinEdge ? "" : void 0,
|
|
259
|
+
"data-last-column": lastColumnFlag(column),
|
|
260
|
+
role: "columnheader",
|
|
261
|
+
scope: "col",
|
|
262
|
+
tabIndex: -1,
|
|
263
|
+
"aria-colindex": column.ariaColIndex,
|
|
264
|
+
style: pinStyle(column),
|
|
265
|
+
children: selection && selection.selectionMode === "multiple" ? /* @__PURE__ */ jsx("div", {
|
|
266
|
+
"data-element": "SelectionBox",
|
|
267
|
+
children: /* @__PURE__ */ jsx(__Checkbox, {
|
|
268
|
+
"aria-label": selection.selectAllState === "all" ? t("itemTable.deselectAll", "Deselect all") : t("itemTable.selectAll", "Select all"),
|
|
269
|
+
isSelected: selection.selectAllState === "all",
|
|
270
|
+
isIndeterminate: selection.selectAllState === "some",
|
|
271
|
+
onChange: selection.toggleSelectAll
|
|
272
|
+
})
|
|
273
|
+
}) : null
|
|
274
|
+
}, column.key);
|
|
275
|
+
}
|
|
276
|
+
function renderSelectionCell(column, row, rowIndex, rowKey, isLastRow, pinnedEdge) {
|
|
277
|
+
const canSelect = selection.canSelect(rowKey);
|
|
278
|
+
const tooltip = typeof selectionTooltip === "function" ? selectionTooltip(row) : selectionTooltip;
|
|
279
|
+
const checkbox = /* @__PURE__ */ jsx(__Checkbox, {
|
|
280
|
+
"aria-label": t("itemTable.selectRow", "Select row"),
|
|
281
|
+
isSelected: selection.isSelected(rowKey),
|
|
282
|
+
isDisabled: !canSelect,
|
|
283
|
+
onChange: () => selection.toggleRow(rowKey)
|
|
284
|
+
});
|
|
285
|
+
return /* @__PURE__ */ jsx("td", {
|
|
286
|
+
"data-element": "Cell",
|
|
287
|
+
"data-key": column.key,
|
|
288
|
+
"data-kind": "selection",
|
|
289
|
+
"data-pin": column.pin,
|
|
290
|
+
"data-pin-edge": column.isPinEdge ? "" : void 0,
|
|
291
|
+
"data-last-row": isLastRow ? "" : void 0,
|
|
292
|
+
"data-pinned": pinnedEdge,
|
|
293
|
+
"data-last-column": lastColumnFlag(column),
|
|
294
|
+
"data-corner": bottomCornerFlag(column, rowIndex, isLastRow, pinnedEdge),
|
|
295
|
+
role: "gridcell",
|
|
296
|
+
"aria-colindex": column.ariaColIndex,
|
|
297
|
+
style: pinStyle(column),
|
|
298
|
+
onClickCapture: selection.captureShift,
|
|
299
|
+
onKeyDownCapture: selection.captureShift,
|
|
300
|
+
children: /* @__PURE__ */ jsx("div", {
|
|
301
|
+
"data-element": "SelectionBox",
|
|
302
|
+
children: !canSelect && tooltip ? /* @__PURE__ */ jsx(TooltipProvider, {
|
|
303
|
+
title: tooltip,
|
|
304
|
+
children: checkbox
|
|
305
|
+
}) : checkbox
|
|
306
|
+
})
|
|
307
|
+
}, column.key);
|
|
308
|
+
}
|
|
309
|
+
function renderRowMenuCell(column, row, rowIndex, rowKey, isLastRow, pinnedEdge) {
|
|
310
|
+
const items = resolveRowMenu(row, rowIndex, rowKey);
|
|
311
|
+
return /* @__PURE__ */ jsx("td", {
|
|
312
|
+
"data-element": "Cell",
|
|
313
|
+
"data-key": column.key,
|
|
314
|
+
"data-kind": "actions",
|
|
315
|
+
"data-pin": column.pin,
|
|
316
|
+
"data-pin-edge": column.isPinEdge ? "" : void 0,
|
|
317
|
+
"data-last-row": isLastRow ? "" : void 0,
|
|
318
|
+
"data-pinned": pinnedEdge,
|
|
319
|
+
"data-last-column": lastColumnFlag(column),
|
|
320
|
+
"data-corner": bottomCornerFlag(column, rowIndex, isLastRow, pinnedEdge),
|
|
321
|
+
role: "gridcell",
|
|
322
|
+
"aria-colindex": column.ariaColIndex,
|
|
323
|
+
style: pinStyle(column),
|
|
324
|
+
children: isMenuEmpty(items) ? null : /* @__PURE__ */ jsx("div", {
|
|
325
|
+
"data-element": "RowActions",
|
|
326
|
+
children: /* @__PURE__ */ jsxs(_MenuTrigger, { children: [/* @__PURE__ */ jsx(ItemAction, {
|
|
327
|
+
tabIndex: -1,
|
|
328
|
+
icon: /* @__PURE__ */ jsx(MoreIcon, {}),
|
|
329
|
+
"aria-label": t("itemTable.rowActions", "Row actions"),
|
|
330
|
+
...rowMenuTriggerProps
|
|
331
|
+
}), /* @__PURE__ */ jsx(__Menu, {
|
|
332
|
+
onAction: menuActionHandler(row, rowKey, false),
|
|
333
|
+
children: items
|
|
334
|
+
})] })
|
|
335
|
+
})
|
|
336
|
+
}, column.key);
|
|
337
|
+
}
|
|
338
|
+
function renderHeaderCell(column) {
|
|
339
|
+
if (column.key === SELECTION_COLUMN_KEY) return renderSelectionHeaderCell(column);
|
|
340
|
+
if (column.key === ROW_NUMBER_COLUMN_KEY) return /* @__PURE__ */ jsx("th", {
|
|
341
|
+
"data-element": "HeaderCell",
|
|
342
|
+
"data-key": column.key,
|
|
343
|
+
"data-kind": "row-number",
|
|
344
|
+
"data-last-column": lastColumnFlag(column),
|
|
345
|
+
role: "columnheader",
|
|
346
|
+
scope: "col",
|
|
347
|
+
tabIndex: -1,
|
|
348
|
+
"aria-colindex": column.ariaColIndex,
|
|
349
|
+
style: pinStyle(column)
|
|
350
|
+
}, column.key);
|
|
351
|
+
if (column.key === ROW_MENU_COLUMN_KEY) return /* @__PURE__ */ jsx("th", {
|
|
352
|
+
"data-element": "HeaderCell",
|
|
353
|
+
"data-key": column.key,
|
|
354
|
+
"data-kind": "actions",
|
|
355
|
+
"data-pin": column.pin,
|
|
356
|
+
"data-pin-edge": column.isPinEdge ? "" : void 0,
|
|
357
|
+
"data-last-column": lastColumnFlag(column),
|
|
358
|
+
role: "columnheader",
|
|
359
|
+
scope: "col",
|
|
360
|
+
tabIndex: -1,
|
|
361
|
+
"aria-colindex": column.ariaColIndex,
|
|
362
|
+
style: pinStyle(column)
|
|
363
|
+
}, column.key);
|
|
364
|
+
const header = column.header;
|
|
365
|
+
const activeSorts = sorts ?? (sort ? [sort] : []);
|
|
366
|
+
const sortIndex = activeSorts.findIndex((entry) => entry.columnKey === column.key);
|
|
367
|
+
const activeSort = sortIndex === -1 ? null : activeSorts[sortIndex];
|
|
368
|
+
const isSorted = activeSort != null;
|
|
369
|
+
const sortRank = activeSorts.length > 1 ? sortIndex + 1 : null;
|
|
370
|
+
const isSortable = sortMode !== "off" && !column.isStructural && column.isSortable === true;
|
|
371
|
+
const canResize = !column.isStructural && (column.isResizable ?? isResizable) && onColumnResize != null && onColumnResizeEnd != null;
|
|
372
|
+
const ctx = {
|
|
373
|
+
columnKey: column.key,
|
|
374
|
+
columnIndex: column.index,
|
|
375
|
+
sort: activeSort?.direction ?? null,
|
|
376
|
+
isSortable,
|
|
377
|
+
isResizing: false,
|
|
378
|
+
width: column.width
|
|
379
|
+
};
|
|
380
|
+
const sortIndicator = isSortable ? /* @__PURE__ */ jsx("div", {
|
|
381
|
+
"data-element": "SortIndicator",
|
|
382
|
+
"data-rank": sortRank ?? void 0,
|
|
383
|
+
"data-sorted": isSorted ? "" : void 0,
|
|
384
|
+
"data-dir": activeSort?.direction,
|
|
385
|
+
"aria-hidden": "true",
|
|
386
|
+
children: /* @__PURE__ */ jsx(UpIcon, {})
|
|
387
|
+
}) : null;
|
|
388
|
+
const hasCustomRightIcon = header?.rightIcon != null;
|
|
389
|
+
const rightIcon = hasCustomRightIcon ? header.rightIcon : sortIndicator;
|
|
390
|
+
const suffixContent = hasCustomRightIcon ? sortIndicator : null;
|
|
391
|
+
const suffix = header?.suffix != null || suffixContent ? /* @__PURE__ */ jsxs(Fragment$1, { children: [header?.suffix, suffixContent] }) : void 0;
|
|
392
|
+
const content = header?.render ? header.render(ctx) : column.title == null && !header ? null : /* @__PURE__ */ jsx(TableHeaderItem, {
|
|
393
|
+
icon: header?.icon,
|
|
394
|
+
rightIcon,
|
|
395
|
+
prefix: header?.prefix,
|
|
396
|
+
suffix,
|
|
397
|
+
description: header?.description,
|
|
398
|
+
descriptionPlacement: header?.descriptionPlacement,
|
|
399
|
+
tooltip: header?.tooltip ?? true,
|
|
400
|
+
theme: header?.theme,
|
|
401
|
+
actions: header?.actions,
|
|
402
|
+
autoHideActions: header?.autoHideActions ?? true,
|
|
403
|
+
styles: header?.styles,
|
|
404
|
+
children: column.title
|
|
405
|
+
});
|
|
406
|
+
return /* @__PURE__ */ jsxs("th", {
|
|
407
|
+
"data-element": "HeaderCell",
|
|
408
|
+
"data-key": column.key,
|
|
409
|
+
"data-pin": column.pin,
|
|
410
|
+
"data-pin-edge": column.isPinEdge ? "" : void 0,
|
|
411
|
+
"data-align": header?.align ?? column.align,
|
|
412
|
+
"data-sortable": isSortable ? "" : void 0,
|
|
413
|
+
"data-resizable": canResize ? "" : void 0,
|
|
414
|
+
"data-last-column": lastColumnFlag(column),
|
|
415
|
+
"data-sorted": isSorted ? "" : void 0,
|
|
416
|
+
role: "columnheader",
|
|
417
|
+
scope: "col",
|
|
418
|
+
tabIndex: isSortable ? 0 : -1,
|
|
419
|
+
"aria-colindex": column.ariaColIndex,
|
|
420
|
+
"aria-sort": activeSort ? ARIA_SORT[activeSort.direction] : void 0,
|
|
421
|
+
style: pinStyle(column),
|
|
422
|
+
onClick: isSortable ? () => onColumnSort?.(column.key) : void 0,
|
|
423
|
+
onKeyDown: isSortable ? (event) => {
|
|
424
|
+
if (event.key !== "Enter" && event.key !== " ") return;
|
|
425
|
+
event.preventDefault();
|
|
426
|
+
onColumnSort?.(column.key);
|
|
427
|
+
} : void 0,
|
|
428
|
+
children: [content, canResize ? /* @__PURE__ */ jsx(ColumnResizer, {
|
|
429
|
+
column,
|
|
430
|
+
label: t("itemTable.resizeColumn", "Resize column"),
|
|
431
|
+
onResize: onColumnResize,
|
|
432
|
+
onResizeEnd: onColumnResizeEnd
|
|
433
|
+
}) : null]
|
|
434
|
+
}, column.key);
|
|
435
|
+
}
|
|
436
|
+
function renderCell(column, row, rowIndex, rowKey, isLastRow, pinnedEdge) {
|
|
437
|
+
const rangeKey = selectionRowKey(sectionOf(pinnedEdge), rowKey);
|
|
438
|
+
if (column.key === SELECTION_COLUMN_KEY) return renderSelectionCell(column, row, rowIndex, rowKey, isLastRow, pinnedEdge);
|
|
439
|
+
if (column.key === ROW_NUMBER_COLUMN_KEY) return /* @__PURE__ */ jsx("td", {
|
|
440
|
+
"data-element": "Cell",
|
|
441
|
+
"data-key": column.key,
|
|
442
|
+
"data-kind": "row-number",
|
|
443
|
+
"data-last-row": isLastRow ? "" : void 0,
|
|
444
|
+
"data-pinned": pinnedEdge,
|
|
445
|
+
"data-last-column": lastColumnFlag(column),
|
|
446
|
+
"data-corner": bottomCornerFlag(column, rowIndex, isLastRow, pinnedEdge),
|
|
447
|
+
role: "gridcell",
|
|
448
|
+
"aria-colindex": column.ariaColIndex,
|
|
449
|
+
style: pinStyle(column),
|
|
450
|
+
children: pinnedEdge ? null : rowNumberOffset + rowIndex + 1
|
|
451
|
+
}, column.key);
|
|
452
|
+
if (column.key === ROW_MENU_COLUMN_KEY) return renderRowMenuCell(column, row, rowIndex, rowKey, isLastRow, pinnedEdge);
|
|
453
|
+
const ctx = {
|
|
454
|
+
row,
|
|
455
|
+
rowKey,
|
|
456
|
+
rowIndex,
|
|
457
|
+
columnKey: column.key,
|
|
458
|
+
columnIndex: column.index,
|
|
459
|
+
section: sectionOf(pinnedEdge),
|
|
460
|
+
isSelected: selection?.isSelected(rowKey) ?? false
|
|
461
|
+
};
|
|
462
|
+
const value = column.isStructural ? void 0 : getColumnValue(column, row, rowIndex);
|
|
463
|
+
const rendered = column.render ? column.render(value, row, rowIndex, ctx) : column.isStructural ? null : getColumnText(column, row, rowIndex);
|
|
464
|
+
const isText = typeof rendered === "string" || typeof rendered === "number" || typeof rendered === "bigint";
|
|
465
|
+
const content = isText && !column.autoHeight ? /* @__PURE__ */ jsx(TextItem, { children: String(rendered) }) : isText ? String(rendered) : rendered;
|
|
466
|
+
const resolvedCellStyles = typeof column.cellStyles === "function" ? column.cellStyles(ctx) : column.cellStyles;
|
|
467
|
+
const CellTag = column.isRowHeader ? "th" : "td";
|
|
468
|
+
const link = column.isRowHeader ? rowLink?.(row, rowIndex) : void 0;
|
|
469
|
+
return /* @__PURE__ */ jsxs(CellTag, {
|
|
470
|
+
"data-element": "Cell",
|
|
471
|
+
"data-key": column.key,
|
|
472
|
+
"data-pin": column.pin,
|
|
473
|
+
"data-pin-edge": column.isPinEdge ? "" : void 0,
|
|
474
|
+
"data-align": column.align,
|
|
475
|
+
"data-wrap": column.autoHeight ? "" : void 0,
|
|
476
|
+
"data-link": link !== void 0 ? "" : void 0,
|
|
477
|
+
"data-last-row": isLastRow ? "" : void 0,
|
|
478
|
+
"data-pinned": pinnedEdge,
|
|
479
|
+
"data-last-column": lastColumnFlag(column),
|
|
480
|
+
"data-corner": bottomCornerFlag(column, rowIndex, isLastRow, pinnedEdge),
|
|
481
|
+
"data-cell-selected": isCellSelected(rangeKey, column.key) ? "" : void 0,
|
|
482
|
+
...column.isRowHeader ? { scope: "row" } : { role: "gridcell" },
|
|
483
|
+
...cellSelectionProps(rangeKey, column.key, pinnedEdge),
|
|
484
|
+
"aria-colindex": column.ariaColIndex,
|
|
485
|
+
style: {
|
|
486
|
+
...pinStyle(column),
|
|
487
|
+
...resolvedCellStyles
|
|
488
|
+
},
|
|
489
|
+
...column.cellProps?.(ctx),
|
|
490
|
+
children: [content, link !== void 0 ? /* @__PURE__ */ jsx(Action, {
|
|
491
|
+
"data-element": "RowLink",
|
|
492
|
+
to: link,
|
|
493
|
+
tabIndex: -1,
|
|
494
|
+
"aria-label": getColumnText(column, row, rowIndex) ?? void 0
|
|
495
|
+
}) : null]
|
|
496
|
+
}, column.key);
|
|
497
|
+
}
|
|
498
|
+
/**
|
|
499
|
+
* A pinned row — a total or subtotal.
|
|
500
|
+
*
|
|
501
|
+
* Rendered inside `<tbody>` rather than `<thead>`/`<tfoot>` so it keeps the
|
|
502
|
+
* body's own row and cell styling: the sub-element chains are anchored to
|
|
503
|
+
* `Body`, and a row in the head would match none of them. `data-pinned`
|
|
504
|
+
* carries the stickiness instead.
|
|
505
|
+
*/
|
|
506
|
+
function renderPinnedRow(row, index, edge) {
|
|
507
|
+
const rowKey = getRowKey(row, index);
|
|
508
|
+
return /* @__PURE__ */ jsx("tr", {
|
|
509
|
+
"data-element": "Row",
|
|
510
|
+
"data-pinned": edge,
|
|
511
|
+
role: "row",
|
|
512
|
+
"aria-rowindex": pinnedRowIndex(index, edge),
|
|
513
|
+
children: columns.map((column) => renderCell(column, row, index, rowKey, false, edge))
|
|
514
|
+
}, `pinned-${edge}-${rowKey}`);
|
|
515
|
+
}
|
|
516
|
+
/** The cells of one body row. Shared by both render paths. */
|
|
517
|
+
function renderRowCells(row, rowIndex) {
|
|
518
|
+
const rowKey = getRowKey(row, rowIndex);
|
|
519
|
+
return columns.map((column) => renderCell(column, row, rowIndex, rowKey, rowIndex === rows.length - 1));
|
|
520
|
+
}
|
|
521
|
+
/**
|
|
522
|
+
* The `<tr>` shell. Virtuoso owns the element in the virtualized path (it
|
|
523
|
+
* needs its own `style` and measurement attributes), so this returns the
|
|
524
|
+
* props rather than the element.
|
|
525
|
+
*/
|
|
526
|
+
function getRowElementProps(row, rowIndex) {
|
|
527
|
+
const rowKey = getRowKey(row, rowIndex);
|
|
528
|
+
const isSelected = selection?.isSelected(rowKey) ?? false;
|
|
529
|
+
const extra = getRowProps?.({
|
|
530
|
+
row,
|
|
531
|
+
rowKey,
|
|
532
|
+
rowIndex,
|
|
533
|
+
section: "body",
|
|
534
|
+
isSelected
|
|
535
|
+
});
|
|
536
|
+
return {
|
|
537
|
+
"data-element": "Row",
|
|
538
|
+
"data-key": String(rowKey),
|
|
539
|
+
"data-row-index": rowIndex,
|
|
540
|
+
"data-qa": extra?.qa,
|
|
541
|
+
"data-odd": isStriped && rowIndex % 2 === 1 ? "" : void 0,
|
|
542
|
+
"data-dimmed": extra?.isDimmed ? "" : void 0,
|
|
543
|
+
"data-selected": isSelected ? "" : void 0,
|
|
544
|
+
"data-disabled": selection?.isRowDisabled(rowKey) ? "" : void 0,
|
|
545
|
+
role: "row",
|
|
546
|
+
tabIndex: isReorderable ? rowIndex === focusedRowIndex ? 0 : -1 : void 0,
|
|
547
|
+
"aria-selected": selection?.isEnabled ? isSelected : void 0,
|
|
548
|
+
"aria-rowindex": bodyRowIndex(rowIndex),
|
|
549
|
+
title: extra?.tooltip,
|
|
550
|
+
height: extra?.height,
|
|
551
|
+
"data-clickable": onRowAction != null || rowLink?.(row, rowIndex) !== void 0 ? "" : void 0,
|
|
552
|
+
onClick: onRowAction != null ? (event) => {
|
|
553
|
+
if (event.target.closest("a, button, input, select, textarea, [role=\"button\"], [role=\"menuitem\"]")) return;
|
|
554
|
+
onRowAction(row, rowKey);
|
|
555
|
+
} : void 0,
|
|
556
|
+
onContextMenu: isMenuEnabled ? (event) => openContextMenuFor(row, rowIndex, rowKey, event) : void 0,
|
|
557
|
+
...Object.fromEntries(Object.entries(extra?.mods ?? {}).filter(([, active]) => active).map(([name]) => [`data-${name}`, ""]))
|
|
558
|
+
};
|
|
559
|
+
}
|
|
560
|
+
function renderRow(row, rowIndex, isVirtual = false) {
|
|
561
|
+
const { height, ...rowProps } = getRowElementProps(row, rowIndex);
|
|
562
|
+
return /* @__PURE__ */ jsx(TableRow, {
|
|
563
|
+
rowKey: getRowKey(row, rowIndex),
|
|
564
|
+
rowProps,
|
|
565
|
+
height,
|
|
566
|
+
index: isVirtual ? rowIndex : void 0,
|
|
567
|
+
measureRef: isVirtual ? virtualizer.measureElement : void 0,
|
|
568
|
+
dragState: isReorderable ? dragState : void 0,
|
|
569
|
+
dropState: isReorderable ? dropState : void 0,
|
|
570
|
+
children: renderRowCells(row, rowIndex)
|
|
571
|
+
}, rowProps["data-key"]);
|
|
572
|
+
}
|
|
573
|
+
function renderSpacerRow(height, position) {
|
|
574
|
+
if (height <= 0) return null;
|
|
575
|
+
return /* @__PURE__ */ jsx("tr", {
|
|
576
|
+
"aria-hidden": "true",
|
|
577
|
+
"data-spacer": position,
|
|
578
|
+
children: /* @__PURE__ */ jsx("td", {
|
|
579
|
+
colSpan: Math.max(columnCount, 1),
|
|
580
|
+
style: { height }
|
|
581
|
+
})
|
|
582
|
+
});
|
|
583
|
+
}
|
|
584
|
+
/**
|
|
585
|
+
* A row, preceded by the line showing a drop above it — and followed by one
|
|
586
|
+
* for the very last row, which has nothing after it to carry a "before".
|
|
587
|
+
*
|
|
588
|
+
* The indicators render nothing unless a drag is in flight, so a table that
|
|
589
|
+
* is merely *capable* of dragging keeps its ordinary structure.
|
|
590
|
+
*/
|
|
591
|
+
function withDropIndicators(row, index, isVirtual = false) {
|
|
592
|
+
const rowKey = getRowKey(row, index);
|
|
593
|
+
const rowNode = renderRow(row, index, isVirtual);
|
|
594
|
+
if (!isReorderable || !dropState) return rowNode;
|
|
595
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
596
|
+
/* @__PURE__ */ jsx(TableRowDropIndicator, {
|
|
597
|
+
rowKey,
|
|
598
|
+
dropPosition: "before",
|
|
599
|
+
dropState,
|
|
600
|
+
columnCount
|
|
601
|
+
}),
|
|
602
|
+
rowNode,
|
|
603
|
+
index === rows.length - 1 ? /* @__PURE__ */ jsx(TableRowDropIndicator, {
|
|
604
|
+
rowKey,
|
|
605
|
+
dropPosition: "after",
|
|
606
|
+
dropState,
|
|
607
|
+
columnCount
|
|
608
|
+
}) : null
|
|
609
|
+
] }, `row-${String(rowKey)}`);
|
|
610
|
+
}
|
|
611
|
+
const hasRows = rows.length > 0;
|
|
612
|
+
const isStale = isLoading && hasRows && loadingIndicator === "overlay";
|
|
613
|
+
const showSkeleton = isLoading && loadingIndicator !== "none" && (!hasRows || loadingIndicator === "skeleton");
|
|
614
|
+
const showBlank = isLoading && !hasRows && loadingIndicator === "none";
|
|
615
|
+
const shouldVirtualize = hasRows && error == null && (isVirtualized === true || isVirtualized === "auto" && rows.length > virtualizeThreshold);
|
|
616
|
+
const rowsRef = useRef(rows);
|
|
617
|
+
rowsRef.current = rows;
|
|
618
|
+
const virtualizer = useVirtualizer({
|
|
619
|
+
count: shouldVirtualize ? rows.length : 0,
|
|
620
|
+
getScrollElement: () => scrollerRef.current,
|
|
621
|
+
getItemKey: (index) => String(getRowKey(rowsRef.current[index], index)),
|
|
622
|
+
estimateSize: () => (rowHeight ?? ESTIMATED_ROW_HEIGHT[size ?? "medium"]) + 1,
|
|
623
|
+
measureElement: (element) => element.getBoundingClientRect().height,
|
|
624
|
+
overscan
|
|
625
|
+
});
|
|
626
|
+
const scrollability = useScrollability(scrollerEl);
|
|
627
|
+
/**
|
|
628
|
+
* Roving tabindex over the rows, so a reorderable table can be operated from
|
|
629
|
+
* the keyboard at all.
|
|
630
|
+
*
|
|
631
|
+
* React Aria's `dragProps` already describe "press Enter to start dragging"
|
|
632
|
+
* and implement the whole keyboard drag — but a `<tr>` is not focusable, so
|
|
633
|
+
* without this the description is announced for a row nobody can reach. One
|
|
634
|
+
* tab stop for the grid, arrows to move within it, matching how every other
|
|
635
|
+
* collection in the kit behaves.
|
|
636
|
+
*/
|
|
637
|
+
useRowMoveAnimation({
|
|
638
|
+
isEnabled: isRowMoveAnimated && !dragState?.draggingKeys?.size,
|
|
639
|
+
bodyRef: localBodyRef
|
|
640
|
+
});
|
|
641
|
+
/**
|
|
642
|
+
* How many rows the next batch is likely to bring, measured across the last
|
|
643
|
+
* fetch that actually happened.
|
|
644
|
+
*
|
|
645
|
+
* The placeholder burst is sized to this so the scroll height is right both
|
|
646
|
+
* before and after the load: a short burst under a long batch makes the
|
|
647
|
+
* content jump the moment the rows land, and leaves the user stopped at the
|
|
648
|
+
* bottom of the list in the meantime with nothing left to scroll into.
|
|
649
|
+
*
|
|
650
|
+
* Measured across `isLoadingMore`, not from any growth in `rows`. Plenty of
|
|
651
|
+
* things lengthen the list without being a fetch — clearing a client search
|
|
652
|
+
* over an infinite list restores every filtered-out row at once — and reading
|
|
653
|
+
* that as a batch of ninety sized the next burst at ninety.
|
|
654
|
+
*
|
|
655
|
+
* Measured at all, rather than taken from `pageSize`, because infinite-scroll
|
|
656
|
+
* consumers often do not set it.
|
|
657
|
+
*/
|
|
658
|
+
const lastBatchSizeRef = useRef(0);
|
|
659
|
+
const rowCountBeforeFetchRef = useRef(null);
|
|
660
|
+
useEffect(() => {
|
|
661
|
+
if (isLoadingMore) {
|
|
662
|
+
rowCountBeforeFetchRef.current = rows.length;
|
|
663
|
+
return;
|
|
664
|
+
}
|
|
665
|
+
const before = rowCountBeforeFetchRef.current;
|
|
666
|
+
if (before != null && rows.length > before) lastBatchSizeRef.current = rows.length - before;
|
|
667
|
+
rowCountBeforeFetchRef.current = null;
|
|
668
|
+
}, [isLoadingMore]);
|
|
669
|
+
const loadMoreSkeletonCount = Math.min(Math.max(lastBatchSizeRef.current || rows.length || skeletonRowCount, 1), MAX_LOAD_MORE_SKELETON_ROWS);
|
|
670
|
+
const [focusedRowIndex, setFocusedRowIndex] = useState(0);
|
|
671
|
+
const [isRangeDragging, setIsRangeDragging] = useState(false);
|
|
672
|
+
useEffect(() => {
|
|
673
|
+
if (!isRangeDragging) return;
|
|
674
|
+
const end = () => {
|
|
675
|
+
if (cellSelection) cellSelection.isDraggingRef.current = false;
|
|
676
|
+
setIsRangeDragging(false);
|
|
677
|
+
};
|
|
678
|
+
window.addEventListener("pointerup", end);
|
|
679
|
+
window.addEventListener("pointercancel", end);
|
|
680
|
+
return () => {
|
|
681
|
+
window.removeEventListener("pointerup", end);
|
|
682
|
+
window.removeEventListener("pointercancel", end);
|
|
683
|
+
};
|
|
684
|
+
}, [isRangeDragging, cellSelection]);
|
|
685
|
+
const moveRowFocus = useEvent((from, delta) => {
|
|
686
|
+
const current = from.closest("tr[data-element=\"Row\"]");
|
|
687
|
+
const all = Array.from(scrollerRef.current?.querySelectorAll("tbody tr[data-element=\"Row\"]:not([data-placeholder])") ?? []);
|
|
688
|
+
if (!all.length) return false;
|
|
689
|
+
const index = current ? all.indexOf(current) : -1;
|
|
690
|
+
const next = Math.min(Math.max((index === -1 ? focusedRowIndex : index) + delta, 0), all.length - 1);
|
|
691
|
+
setFocusedRowIndex(next);
|
|
692
|
+
all[next]?.focus();
|
|
693
|
+
return true;
|
|
694
|
+
});
|
|
695
|
+
const sentinelRef = useRef(null);
|
|
696
|
+
const onLoadMoreEvent = useEvent(() => onLoadMore?.());
|
|
697
|
+
useEffect(() => {
|
|
698
|
+
const sentinel = sentinelRef.current;
|
|
699
|
+
if (!onLoadMore || !hasMore || isLoadingMore || !scrollerEl || !sentinel) return;
|
|
700
|
+
const margin = loadMoreMargin ?? Math.max(scrollerEl.clientHeight, MIN_LOAD_MORE_MARGIN);
|
|
701
|
+
const observer = new IntersectionObserver((entries) => {
|
|
702
|
+
if (entries.some((entry) => entry.isIntersecting)) onLoadMoreEvent();
|
|
703
|
+
}, {
|
|
704
|
+
root: scrollerEl,
|
|
705
|
+
rootMargin: `0px 0px ${margin}px 0px`
|
|
706
|
+
});
|
|
707
|
+
observer.observe(sentinel);
|
|
708
|
+
return () => observer.disconnect();
|
|
709
|
+
}, [
|
|
710
|
+
onLoadMore,
|
|
711
|
+
hasMore,
|
|
712
|
+
isLoadingMore,
|
|
713
|
+
scrollerEl,
|
|
714
|
+
loadMoreMargin,
|
|
715
|
+
onLoadMoreEvent,
|
|
716
|
+
rows.length
|
|
717
|
+
]);
|
|
718
|
+
const contextMenu = useContextMenu(__Menu, { placement: "bottom start" });
|
|
719
|
+
const isMenuEnabled = rowMenu != null && rowContextMenu !== false;
|
|
720
|
+
function resolveRowMenu(row, rowIndex, rowKey) {
|
|
721
|
+
if (!rowMenu) return null;
|
|
722
|
+
return rowMenu(row, {
|
|
723
|
+
row,
|
|
724
|
+
rowKey,
|
|
725
|
+
rowIndex,
|
|
726
|
+
section: "body",
|
|
727
|
+
isSelected: selection?.isSelected(rowKey) ?? false,
|
|
728
|
+
isFocused: false,
|
|
729
|
+
isDropTarget: false
|
|
730
|
+
});
|
|
731
|
+
}
|
|
732
|
+
function menuActionHandler(row, rowKey, closeAfter) {
|
|
733
|
+
return (action) => {
|
|
734
|
+
onRowMenuAction?.(normalizeMenuAction(action), row, rowKey);
|
|
735
|
+
if (closeAfter) contextMenu.close();
|
|
736
|
+
};
|
|
737
|
+
}
|
|
738
|
+
const openContextMenuFor = useEvent((row, rowIndex, rowKey, event) => {
|
|
739
|
+
const items = resolveRowMenu(row, rowIndex, rowKey);
|
|
740
|
+
if (isMenuEmpty(items)) return;
|
|
741
|
+
event.preventDefault();
|
|
742
|
+
contextMenu.open({
|
|
743
|
+
children: items,
|
|
744
|
+
onAction: menuActionHandler(row, rowKey, true)
|
|
745
|
+
}, void 0, "clientX" in event.nativeEvent ? event.nativeEvent : void 0);
|
|
746
|
+
});
|
|
747
|
+
/** Resolves the row a pointer or keyboard event landed in. */
|
|
748
|
+
function rowFromEvent(target) {
|
|
749
|
+
const element = target?.closest?.("tr[data-element=\"Row\"][data-key]");
|
|
750
|
+
if (!element) return null;
|
|
751
|
+
const index = Number(element.getAttribute("data-row-index"));
|
|
752
|
+
if (!Number.isInteger(index)) return null;
|
|
753
|
+
const row = rows[index];
|
|
754
|
+
return row === void 0 ? null : {
|
|
755
|
+
row,
|
|
756
|
+
index
|
|
757
|
+
};
|
|
758
|
+
}
|
|
759
|
+
const virtualItems = shouldVirtualize ? virtualizer.getVirtualItems() : [];
|
|
760
|
+
const paddingTop = virtualItems.length ? virtualItems[0].start : 0;
|
|
761
|
+
const paddingBottom = virtualItems.length ? virtualizer.getTotalSize() - virtualItems[virtualItems.length - 1].end : 0;
|
|
762
|
+
const colGroup = /* @__PURE__ */ jsx("colgroup", { children: columns.map((column) => /* @__PURE__ */ jsx("col", { style: column.width != null ? { width: column.width } : void 0 }, column.key)) });
|
|
763
|
+
const headerRow = isHeaderHidden ? null : /* @__PURE__ */ jsx("tr", {
|
|
764
|
+
"data-element": "HeadRow",
|
|
765
|
+
role: "row",
|
|
766
|
+
"aria-rowindex": 1,
|
|
767
|
+
children: columns.map(renderHeaderCell)
|
|
768
|
+
});
|
|
769
|
+
const tableProps = {
|
|
770
|
+
"data-element": "Table",
|
|
771
|
+
role: "grid",
|
|
772
|
+
"aria-label": ariaLabel,
|
|
773
|
+
"aria-busy": isLoading || void 0,
|
|
774
|
+
"aria-rowcount": headerRowCount + pinnedTopCount + bodyRowCount + pinnedBottomCount,
|
|
775
|
+
"aria-colcount": columnCount,
|
|
776
|
+
"aria-multiselectable": selection?.selectionMode === "multiple" ? true : void 0
|
|
777
|
+
};
|
|
778
|
+
let bodyContent;
|
|
779
|
+
if (error != null) bodyContent = renderStateRow(error);
|
|
780
|
+
else if (showSkeleton) bodyContent = renderSkeletonRows();
|
|
781
|
+
else if (showBlank) bodyContent = null;
|
|
782
|
+
else if (!hasRows) bodyContent = renderStateRow(isFiltered ? noResultsLabel : emptyLabel);
|
|
783
|
+
else if (shouldVirtualize) bodyContent = /* @__PURE__ */ jsxs(Fragment$1, { children: [
|
|
784
|
+
renderSpacerRow(paddingTop, "top"),
|
|
785
|
+
virtualItems.map((v) => withDropIndicators(rows[v.index], v.index, true)),
|
|
786
|
+
renderSpacerRow(paddingBottom, "bottom")
|
|
787
|
+
] });
|
|
788
|
+
else bodyContent = rows.map((row, index) => withDropIndicators(row, index));
|
|
789
|
+
if (columnCount === 0 && isLoading) return /* @__PURE__ */ jsxs(TableElement, {
|
|
790
|
+
ref: rootRef,
|
|
791
|
+
qa: qa || "Table",
|
|
792
|
+
styles: mergedStyles,
|
|
793
|
+
mods: {
|
|
794
|
+
size,
|
|
795
|
+
shape,
|
|
796
|
+
...mods
|
|
797
|
+
},
|
|
798
|
+
children: [toolbar, /* @__PURE__ */ jsx("div", {
|
|
799
|
+
"data-element": "Scroller",
|
|
800
|
+
ref: handleScrollerRef,
|
|
801
|
+
children: /* @__PURE__ */ jsx(Skeleton, { layout: "table" })
|
|
802
|
+
})]
|
|
803
|
+
});
|
|
804
|
+
return /* @__PURE__ */ jsxs(TableElement, {
|
|
805
|
+
ref: rootRef,
|
|
806
|
+
qa: qa || "Table",
|
|
807
|
+
styles: mergedStyles,
|
|
808
|
+
mods: {
|
|
809
|
+
size,
|
|
810
|
+
shape,
|
|
811
|
+
"sticky-header": isHeaderSticky,
|
|
812
|
+
"column-dividers": hasColumnDividers,
|
|
813
|
+
"range-dragging": isRangeDragging,
|
|
814
|
+
"has-footer": footer != null,
|
|
815
|
+
"scroll-x": scrollability.x,
|
|
816
|
+
"scroll-y": scrollability.y,
|
|
817
|
+
stale: isStale,
|
|
818
|
+
...mods
|
|
819
|
+
},
|
|
820
|
+
children: [
|
|
821
|
+
toolbar,
|
|
822
|
+
/* @__PURE__ */ jsx("div", {
|
|
823
|
+
"data-element": "Scroller",
|
|
824
|
+
ref: handleScrollerRef,
|
|
825
|
+
tabIndex: cellSelection?.isEnabled ? -1 : void 0,
|
|
826
|
+
onKeyDown: (event) => {
|
|
827
|
+
if (event.key === "F10" && event.shiftKey && isMenuEnabled) {
|
|
828
|
+
const found = rowFromEvent(event.target);
|
|
829
|
+
if (found) {
|
|
830
|
+
event.stopPropagation();
|
|
831
|
+
openContextMenuFor(found.row, found.index, getRowKey(found.row, found.index), event);
|
|
832
|
+
}
|
|
833
|
+
return;
|
|
834
|
+
}
|
|
835
|
+
if (event.key === "Enter" && onRowAction) {
|
|
836
|
+
const found = rowFromEvent(event.target);
|
|
837
|
+
if (found && !event.target.closest("a, button, input, select, textarea, [role=\"button\"]")) onRowAction(found.row, getRowKey(found.row, found.index));
|
|
838
|
+
return;
|
|
839
|
+
}
|
|
840
|
+
if (isReorderable && (event.key === "ArrowDown" || event.key === "ArrowUp")) {
|
|
841
|
+
if (dragState?.draggingKeys?.size) return;
|
|
842
|
+
if (moveRowFocus(event.target, event.key === "ArrowDown" ? 1 : -1)) event.preventDefault();
|
|
843
|
+
return;
|
|
844
|
+
}
|
|
845
|
+
if (event.key === "Escape") {
|
|
846
|
+
if (cellSelection?.range) {
|
|
847
|
+
event.stopPropagation();
|
|
848
|
+
cellSelection.clear();
|
|
849
|
+
return;
|
|
850
|
+
}
|
|
851
|
+
if (selection?.isEnabled && selection.selectedCount > 0) {
|
|
852
|
+
event.stopPropagation();
|
|
853
|
+
selection.clearSelection();
|
|
854
|
+
}
|
|
855
|
+
}
|
|
856
|
+
},
|
|
857
|
+
onCopy: (event) => {
|
|
858
|
+
if (!cellSelection?.range) return;
|
|
859
|
+
const matrix = cellSelection.getSelectionMatrix((column, row, rowIndex) => column.isStructural ? "" : getColumnText(column, row, rowIndex) ?? "");
|
|
860
|
+
if (!matrix.length) return;
|
|
861
|
+
event.preventDefault();
|
|
862
|
+
event.clipboardData.setData("text/plain", toTsv(matrix));
|
|
863
|
+
event.clipboardData.setData("text/html", toClipboardHtml(matrix));
|
|
864
|
+
toast.success({
|
|
865
|
+
title: t("itemTable.copiedToClipboard", "Copied to clipboard"),
|
|
866
|
+
description: t("itemTable.copiedCells", "{{count}} cells copied", { count: cellSelection.cellCount })
|
|
867
|
+
});
|
|
868
|
+
},
|
|
869
|
+
children: /* @__PURE__ */ jsxs("table", {
|
|
870
|
+
...tableProps,
|
|
871
|
+
style: layout.totalWidth != null ? { width: layout.totalWidth } : void 0,
|
|
872
|
+
children: [
|
|
873
|
+
colGroup,
|
|
874
|
+
isHeaderHidden ? null : /* @__PURE__ */ jsx("thead", {
|
|
875
|
+
"data-element": "Head",
|
|
876
|
+
children: headerRow
|
|
877
|
+
}),
|
|
878
|
+
/* @__PURE__ */ jsxs("tbody", {
|
|
879
|
+
"data-element": "Body",
|
|
880
|
+
...collectionProps,
|
|
881
|
+
ref: handleBodyRef,
|
|
882
|
+
children: [
|
|
883
|
+
pinnedTopRows?.map((row, index) => renderPinnedRow(row, index, "top")),
|
|
884
|
+
bodyContent,
|
|
885
|
+
pinnedBottomRows?.map((row, index) => renderPinnedRow(row, index, "bottom")),
|
|
886
|
+
isLoadingMore ? renderSkeletonRows(loadMoreSkeletonCount, "load-more") : null,
|
|
887
|
+
onLoadMore && hasRows ? /* @__PURE__ */ jsx("tr", {
|
|
888
|
+
"data-sentinel": "",
|
|
889
|
+
"aria-hidden": "true",
|
|
890
|
+
children: /* @__PURE__ */ jsx("td", {
|
|
891
|
+
colSpan: Math.max(columnCount, 1),
|
|
892
|
+
style: {
|
|
893
|
+
height: 1,
|
|
894
|
+
padding: 0,
|
|
895
|
+
border: 0
|
|
896
|
+
},
|
|
897
|
+
children: /* @__PURE__ */ jsx("div", {
|
|
898
|
+
ref: sentinelRef,
|
|
899
|
+
style: { height: 1 }
|
|
900
|
+
})
|
|
901
|
+
})
|
|
902
|
+
}) : null
|
|
903
|
+
]
|
|
904
|
+
})
|
|
905
|
+
]
|
|
906
|
+
})
|
|
907
|
+
}),
|
|
908
|
+
/* @__PURE__ */ jsx(VisuallyHidden, { children: /* @__PURE__ */ jsx("span", {
|
|
909
|
+
role: "status",
|
|
910
|
+
children: isStale ? t("itemTable.refreshing", "Refreshing") : ""
|
|
911
|
+
}) }),
|
|
912
|
+
overlay,
|
|
913
|
+
contextMenu.rendered,
|
|
914
|
+
footer
|
|
915
|
+
]
|
|
916
|
+
});
|
|
917
|
+
}
|
|
918
|
+
|
|
919
|
+
//#endregion
|
|
920
|
+
export { TableView };
|
|
921
|
+
//# sourceMappingURL=TableView.js.map
|