@cube-dev/ui-kit 0.0.0-canary-7406950 → 0.0.0-canary-b7944fa
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/_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 +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 +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.js +72 -22
- package/dist/components/data/DataTable/DataTable.js.map +1 -1
- package/dist/components/data/DataTable/types.d.ts +43 -0
- package/dist/components/data/ItemTable/ItemTable.js +8 -3
- package/dist/components/data/ItemTable/ItemTable.js.map +1 -1
- package/dist/components/data/ItemTable/ItemTableBulkBar.js +1 -1
- package/dist/components/data/ItemTable/ItemTableDragPreview.js +1 -1
- package/dist/components/data/ItemTable/ItemTableFooter.js +1 -1
- package/dist/components/data/ItemTable/ItemTableToolbar.js +1 -1
- package/dist/components/data/ItemTable/types.d.ts +19 -0
- package/dist/components/data/TableBase/ColumnResizer.js +1 -1
- package/dist/components/data/TableBase/RowCollection.js +5 -3
- package/dist/components/data/TableBase/RowCollection.js.map +1 -1
- package/dist/components/data/TableBase/TableHeaderCell.js +115 -0
- package/dist/components/data/TableBase/TableHeaderCell.js.map +1 -0
- package/dist/components/data/TableBase/TableRow.js +1 -1
- package/dist/components/data/TableBase/TableView.js +180 -29
- package/dist/components/data/TableBase/TableView.js.map +1 -1
- package/dist/components/data/TableBase/column-menu.d.ts +36 -0
- package/dist/components/data/TableBase/column-menu.js +104 -0
- package/dist/components/data/TableBase/column-menu.js.map +1 -0
- package/dist/components/data/TableBase/column-tint.js +168 -0
- package/dist/components/data/TableBase/column-tint.js.map +1 -0
- package/dist/components/data/TableBase/index.d.ts +2 -1
- package/dist/components/data/TableBase/row-menu.js +11 -6
- package/dist/components/data/TableBase/row-menu.js.map +1 -1
- package/dist/components/data/TableBase/styled.js +36 -8
- package/dist/components/data/TableBase/styled.js.map +1 -1
- package/dist/components/data/TableBase/types.d.ts +85 -4
- package/dist/components/data/TableBase/types.js +1 -1
- package/dist/components/data/TableBase/types.js.map +1 -1
- package/dist/components/data/TableBase/use-cell-selection.js +0 -0
- package/dist/components/data/TableBase/use-column-order.js +100 -0
- package/dist/components/data/TableBase/use-column-order.js.map +1 -0
- package/dist/components/data/TableBase/use-container-width.js +1 -1
- package/dist/components/data/TableBase/use-row-move-animation.js +1 -1
- package/dist/components/data/TableBase/use-scrollability.js +1 -1
- package/dist/components/data/TableBase/use-table-columns.js +1 -1
- package/dist/components/data/TableBase/use-table-search.js +1 -1
- package/dist/components/data/TableBase/use-table-selection.js +1 -1
- package/dist/components/data/TableBase/use-table-sort.js +20 -1
- package/dist/components/data/TableBase/use-table-sort.js.map +1 -1
- package/dist/components/data/TableBase/use-table-sorts.js +40 -1
- package/dist/components/data/TableBase/use-table-sorts.js.map +1 -1
- package/dist/components/data/TableBase/use-table-storage.d.ts +1 -1
- package/dist/components/data/TableBase/use-table-storage.js +6 -2
- package/dist/components/data/TableBase/use-table-storage.js.map +1 -1
- package/dist/components/data/index.d.ts +1 -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.js +1 -1
- package/dist/components/fields/ColorPicker/ColorPicker.js +1 -1
- package/dist/components/fields/ColorSwatchGroup/ColorSwatchGroup.js +1 -1
- 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 +1 -1
- package/dist/components/fields/FilterPicker/FilterPicker.js +1 -1
- package/dist/components/fields/Input/Input.js +1 -1
- package/dist/components/fields/ListBox/DraggableListBox.js +1 -1
- package/dist/components/fields/ListBox/ListBox.js +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.js +1 -1
- package/dist/components/fields/Picker/Picker.js +1 -1
- package/dist/components/fields/RadioGroup/Radio.js +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.js +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.js +1 -1
- package/dist/components/fields/TextInput/TextInput.js +1 -1
- package/dist/components/fields/TextInput/TextInputBase.js +1 -1
- package/dist/components/fields/TextInputMapper/TextInputMapper.js +1 -1
- package/dist/components/fields/color/ColorPanel.js +1 -1
- package/dist/components/fields/color/ColorSwatch.js +1 -1
- package/dist/components/fields/color/channels.js +1 -1
- package/dist/components/fields/color/color.js +1 -1
- package/dist/components/fields/color/context.js +1 -1
- 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.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.d.ts +1 -8
- package/dist/components/layout/ResizablePanel.js +1 -1
- package/dist/components/layout/ResizablePanel.js.map +1 -1
- package/dist/components/layout/Space.js +1 -1
- package/dist/components/layout/Suffix.js +1 -1
- package/dist/components/navigation/Pagination/Pagination.js +1 -1
- package/dist/components/navigation/Pagination/use-pagination.js +1 -1
- 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/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 +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 +9 -1
- 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 +5 -1
- package/dist/i18n/locales/en-US/uikit.js +5 -1
- package/dist/i18n/locales/en-US/uikit.json.d.ts +4 -0
- package/dist/i18n/locales/es-ES/uikit.js +5 -1
- package/dist/i18n/locales/es-MX/uikit.js +5 -1
- package/dist/i18n/locales/fr-FR/uikit.js +5 -1
- package/dist/i18n/locales/it-IT/uikit.js +5 -1
- package/dist/i18n/locales/ja-JP/uikit.js +5 -1
- package/dist/i18n/locales/nb-NO/uikit.js +5 -1
- package/dist/i18n/locales/pt-BR/uikit.js +5 -1
- package/dist/i18n/locales/pt-PT/uikit.js +5 -1
- package/dist/i18n/locales/sv-SE/uikit.js +5 -1
- package/dist/i18n/locales/vi-VN/uikit.js +5 -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 +3 -1
- package/dist/index.js +4 -2
- 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/color-theme.d.ts +86 -0
- package/dist/tokens/color-theme.js +156 -0
- package/dist/tokens/color-theme.js.map +1 -0
- package/dist/tokens/colors.js +1 -1
- package/dist/tokens/index.d.ts +1 -0
- package/dist/tokens/index.js +2 -1
- package/dist/tokens/index.js.map +1 -1
- package/dist/tokens/layout.js +1 -1
- package/dist/tokens/lazy-styles.js +1 -1
- package/dist/tokens/palette-config.js +2 -2
- package/dist/tokens/palette.d.ts +1 -1
- package/dist/tokens/palette.js +44 -2
- package/dist/tokens/palette.js.map +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.js +1 -1
- package/dist/utils/ResizeSensor.js +1 -1
- 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.js +1 -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.js +1 -1
- 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/data/DataTable.md +105 -1
- package/package.json +3 -4
- package/tasty.config.ts +0 -390
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/** @license MIT | @cube-dev/ui-kit v0.0.0-canary-
|
|
1
|
+
/** @license MIT | @cube-dev/ui-kit v0.0.0-canary-b7944fa | Cube Dev Team */
|
|
2
2
|
import { Prism as RendererPrism } from "prism-react-renderer";
|
|
3
3
|
|
|
4
4
|
//#region src/components/content/PrismCode/prismSetup.tsx
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/** @license MIT | @cube-dev/ui-kit v0.0.0-canary-
|
|
1
|
+
/** @license MIT | @cube-dev/ui-kit v0.0.0-canary-b7944fa | Cube Dev Team */
|
|
2
2
|
import { _PrismCode } from "../PrismCode/PrismCode.js";
|
|
3
3
|
import { jsx } from "react/jsx-runtime";
|
|
4
4
|
import { diffLines } from "diff";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/** @license MIT | @cube-dev/ui-kit v0.0.0-canary-
|
|
1
|
+
/** @license MIT | @cube-dev/ui-kit v0.0.0-canary-b7944fa | Cube Dev Team */
|
|
2
2
|
import { extractStyles } from "../../../utils/styles.js";
|
|
3
3
|
import { mergeProps } from "../../../utils/react/mergeProps.js";
|
|
4
4
|
import { wrapNodeIfPlain } from "../../../utils/react/wrapNodeIfPlain.js";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/** @license MIT | @cube-dev/ui-kit v0.0.0-canary-
|
|
1
|
+
/** @license MIT | @cube-dev/ui-kit v0.0.0-canary-b7944fa | Cube Dev Team */
|
|
2
2
|
import { Space } from "../../layout/Space.js";
|
|
3
3
|
import { Grid } from "../../layout/Grid.js";
|
|
4
4
|
import { Flow } from "../../layout/Flow.js";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/** @license MIT | @cube-dev/ui-kit v0.0.0-canary-
|
|
1
|
+
/** @license MIT | @cube-dev/ui-kit v0.0.0-canary-b7944fa | Cube Dev Team */
|
|
2
2
|
import { _Item } from "../Item/Item.js";
|
|
3
3
|
import { useI18n } from "../../../i18n/useI18n.js";
|
|
4
4
|
import { CloseIcon } from "../../../icons/CloseIcon.js";
|
|
@@ -140,7 +140,7 @@ declare const MinorText: react.ComponentType<{
|
|
|
140
140
|
accessKey?: string | undefined;
|
|
141
141
|
autoCapitalize?: (string & {}) | "none" | "off" | "on" | "sentences" | "words" | "characters" | undefined;
|
|
142
142
|
autoFocus?: boolean | undefined;
|
|
143
|
-
contentEditable?:
|
|
143
|
+
contentEditable?: (boolean | "true" | "false") | "inherit" | "plaintext-only" | undefined;
|
|
144
144
|
contextMenu?: string | undefined;
|
|
145
145
|
dir?: string | undefined;
|
|
146
146
|
draggable?: (boolean | "true" | "false") | undefined;
|
|
@@ -179,7 +179,7 @@ declare const MinorText: react.ComponentType<{
|
|
|
179
179
|
part?: string | undefined;
|
|
180
180
|
"aria-activedescendant"?: string | undefined;
|
|
181
181
|
"aria-atomic"?: (boolean | "true" | "false") | undefined;
|
|
182
|
-
"aria-autocomplete"?: "list" | "
|
|
182
|
+
"aria-autocomplete"?: "list" | "none" | "inline" | "both" | undefined;
|
|
183
183
|
"aria-braillelabel"?: string | undefined;
|
|
184
184
|
"aria-brailleroledescription"?: string | undefined;
|
|
185
185
|
"aria-busy"?: (boolean | "true" | "false") | undefined;
|
|
@@ -546,7 +546,7 @@ declare const DangerText: react.ComponentType<{
|
|
|
546
546
|
accessKey?: string | undefined;
|
|
547
547
|
autoCapitalize?: (string & {}) | "none" | "off" | "on" | "sentences" | "words" | "characters" | undefined;
|
|
548
548
|
autoFocus?: boolean | undefined;
|
|
549
|
-
contentEditable?:
|
|
549
|
+
contentEditable?: (boolean | "true" | "false") | "inherit" | "plaintext-only" | undefined;
|
|
550
550
|
contextMenu?: string | undefined;
|
|
551
551
|
dir?: string | undefined;
|
|
552
552
|
draggable?: (boolean | "true" | "false") | undefined;
|
|
@@ -585,7 +585,7 @@ declare const DangerText: react.ComponentType<{
|
|
|
585
585
|
part?: string | undefined;
|
|
586
586
|
"aria-activedescendant"?: string | undefined;
|
|
587
587
|
"aria-atomic"?: (boolean | "true" | "false") | undefined;
|
|
588
|
-
"aria-autocomplete"?: "list" | "
|
|
588
|
+
"aria-autocomplete"?: "list" | "none" | "inline" | "both" | undefined;
|
|
589
589
|
"aria-braillelabel"?: string | undefined;
|
|
590
590
|
"aria-brailleroledescription"?: string | undefined;
|
|
591
591
|
"aria-busy"?: (boolean | "true" | "false") | undefined;
|
|
@@ -952,7 +952,7 @@ declare const SuccessText: react.ComponentType<{
|
|
|
952
952
|
accessKey?: string | undefined;
|
|
953
953
|
autoCapitalize?: (string & {}) | "none" | "off" | "on" | "sentences" | "words" | "characters" | undefined;
|
|
954
954
|
autoFocus?: boolean | undefined;
|
|
955
|
-
contentEditable?:
|
|
955
|
+
contentEditable?: (boolean | "true" | "false") | "inherit" | "plaintext-only" | undefined;
|
|
956
956
|
contextMenu?: string | undefined;
|
|
957
957
|
dir?: string | undefined;
|
|
958
958
|
draggable?: (boolean | "true" | "false") | undefined;
|
|
@@ -991,7 +991,7 @@ declare const SuccessText: react.ComponentType<{
|
|
|
991
991
|
part?: string | undefined;
|
|
992
992
|
"aria-activedescendant"?: string | undefined;
|
|
993
993
|
"aria-atomic"?: (boolean | "true" | "false") | undefined;
|
|
994
|
-
"aria-autocomplete"?: "list" | "
|
|
994
|
+
"aria-autocomplete"?: "list" | "none" | "inline" | "both" | undefined;
|
|
995
995
|
"aria-braillelabel"?: string | undefined;
|
|
996
996
|
"aria-brailleroledescription"?: string | undefined;
|
|
997
997
|
"aria-busy"?: (boolean | "true" | "false") | undefined;
|
|
@@ -1358,7 +1358,7 @@ declare const StrongText: react.ComponentType<{
|
|
|
1358
1358
|
accessKey?: string | undefined;
|
|
1359
1359
|
autoCapitalize?: (string & {}) | "none" | "off" | "on" | "sentences" | "words" | "characters" | undefined;
|
|
1360
1360
|
autoFocus?: boolean | undefined;
|
|
1361
|
-
contentEditable?:
|
|
1361
|
+
contentEditable?: (boolean | "true" | "false") | "inherit" | "plaintext-only" | undefined;
|
|
1362
1362
|
contextMenu?: string | undefined;
|
|
1363
1363
|
dir?: string | undefined;
|
|
1364
1364
|
draggable?: (boolean | "true" | "false") | undefined;
|
|
@@ -1397,7 +1397,7 @@ declare const StrongText: react.ComponentType<{
|
|
|
1397
1397
|
part?: string | undefined;
|
|
1398
1398
|
"aria-activedescendant"?: string | undefined;
|
|
1399
1399
|
"aria-atomic"?: (boolean | "true" | "false") | undefined;
|
|
1400
|
-
"aria-autocomplete"?: "list" | "
|
|
1400
|
+
"aria-autocomplete"?: "list" | "none" | "inline" | "both" | undefined;
|
|
1401
1401
|
"aria-braillelabel"?: string | undefined;
|
|
1402
1402
|
"aria-brailleroledescription"?: string | undefined;
|
|
1403
1403
|
"aria-busy"?: (boolean | "true" | "false") | undefined;
|
|
@@ -1764,7 +1764,7 @@ declare const EmphasisText: react.ComponentType<{
|
|
|
1764
1764
|
accessKey?: string | undefined;
|
|
1765
1765
|
autoCapitalize?: (string & {}) | "none" | "off" | "on" | "sentences" | "words" | "characters" | undefined;
|
|
1766
1766
|
autoFocus?: boolean | undefined;
|
|
1767
|
-
contentEditable?:
|
|
1767
|
+
contentEditable?: (boolean | "true" | "false") | "inherit" | "plaintext-only" | undefined;
|
|
1768
1768
|
contextMenu?: string | undefined;
|
|
1769
1769
|
dir?: string | undefined;
|
|
1770
1770
|
draggable?: (boolean | "true" | "false") | undefined;
|
|
@@ -1803,7 +1803,7 @@ declare const EmphasisText: react.ComponentType<{
|
|
|
1803
1803
|
part?: string | undefined;
|
|
1804
1804
|
"aria-activedescendant"?: string | undefined;
|
|
1805
1805
|
"aria-atomic"?: (boolean | "true" | "false") | undefined;
|
|
1806
|
-
"aria-autocomplete"?: "list" | "
|
|
1806
|
+
"aria-autocomplete"?: "list" | "none" | "inline" | "both" | undefined;
|
|
1807
1807
|
"aria-braillelabel"?: string | undefined;
|
|
1808
1808
|
"aria-brailleroledescription"?: string | undefined;
|
|
1809
1809
|
"aria-busy"?: (boolean | "true" | "false") | undefined;
|
|
@@ -2170,7 +2170,7 @@ declare const PlaceholderText: react.ComponentType<{
|
|
|
2170
2170
|
accessKey?: string | undefined;
|
|
2171
2171
|
autoCapitalize?: (string & {}) | "none" | "off" | "on" | "sentences" | "words" | "characters" | undefined;
|
|
2172
2172
|
autoFocus?: boolean | undefined;
|
|
2173
|
-
contentEditable?:
|
|
2173
|
+
contentEditable?: (boolean | "true" | "false") | "inherit" | "plaintext-only" | undefined;
|
|
2174
2174
|
contextMenu?: string | undefined;
|
|
2175
2175
|
dir?: string | undefined;
|
|
2176
2176
|
draggable?: (boolean | "true" | "false") | undefined;
|
|
@@ -2209,7 +2209,7 @@ declare const PlaceholderText: react.ComponentType<{
|
|
|
2209
2209
|
part?: string | undefined;
|
|
2210
2210
|
"aria-activedescendant"?: string | undefined;
|
|
2211
2211
|
"aria-atomic"?: (boolean | "true" | "false") | undefined;
|
|
2212
|
-
"aria-autocomplete"?: "list" | "
|
|
2212
|
+
"aria-autocomplete"?: "list" | "none" | "inline" | "both" | undefined;
|
|
2213
2213
|
"aria-braillelabel"?: string | undefined;
|
|
2214
2214
|
"aria-brailleroledescription"?: string | undefined;
|
|
2215
2215
|
"aria-busy"?: (boolean | "true" | "false") | undefined;
|
|
@@ -2576,7 +2576,7 @@ declare const HighlightText: react.ComponentType<{
|
|
|
2576
2576
|
accessKey?: string | undefined;
|
|
2577
2577
|
autoCapitalize?: (string & {}) | "none" | "off" | "on" | "sentences" | "words" | "characters" | undefined;
|
|
2578
2578
|
autoFocus?: boolean | undefined;
|
|
2579
|
-
contentEditable?:
|
|
2579
|
+
contentEditable?: (boolean | "true" | "false") | "inherit" | "plaintext-only" | undefined;
|
|
2580
2580
|
contextMenu?: string | undefined;
|
|
2581
2581
|
dir?: string | undefined;
|
|
2582
2582
|
draggable?: (boolean | "true" | "false") | undefined;
|
|
@@ -2615,7 +2615,7 @@ declare const HighlightText: react.ComponentType<{
|
|
|
2615
2615
|
part?: string | undefined;
|
|
2616
2616
|
"aria-activedescendant"?: string | undefined;
|
|
2617
2617
|
"aria-atomic"?: (boolean | "true" | "false") | undefined;
|
|
2618
|
-
"aria-autocomplete"?: "list" | "
|
|
2618
|
+
"aria-autocomplete"?: "list" | "none" | "inline" | "both" | undefined;
|
|
2619
2619
|
"aria-braillelabel"?: string | undefined;
|
|
2620
2620
|
"aria-brailleroledescription"?: string | undefined;
|
|
2621
2621
|
"aria-busy"?: (boolean | "true" | "false") | undefined;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/** @license MIT | @cube-dev/ui-kit v0.0.0-canary-
|
|
1
|
+
/** @license MIT | @cube-dev/ui-kit v0.0.0-canary-b7944fa | Cube Dev Team */
|
|
2
2
|
import { extractStyles } from "../../utils/styles.js";
|
|
3
3
|
import { useSlotProps } from "../../utils/react/Slots.js";
|
|
4
4
|
import { BASE_STYLES, COLOR_STYLES, TEXT_STYLES, filterBaseProps, tasty } from "@tenphi/tasty";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/** @license MIT | @cube-dev/ui-kit v0.0.0-canary-
|
|
1
|
+
/** @license MIT | @cube-dev/ui-kit v0.0.0-canary-b7944fa | Cube Dev Team */
|
|
2
2
|
import { extractStyles } from "../../../utils/styles.js";
|
|
3
3
|
import { TEXT_PROP_MAP, _Text } from "../Text.js";
|
|
4
4
|
import { highlightText } from "../highlightText.js";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/** @license MIT | @cube-dev/ui-kit v0.0.0-canary-
|
|
1
|
+
/** @license MIT | @cube-dev/ui-kit v0.0.0-canary-b7944fa | Cube Dev Team */
|
|
2
2
|
import { extractStyles } from "../../utils/styles.js";
|
|
3
3
|
import { useSlotProps } from "../../utils/react/Slots.js";
|
|
4
4
|
import { TEXT_PROP_MAP } from "./Text.js";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/** @license MIT | @cube-dev/ui-kit v0.0.0-canary-
|
|
1
|
+
/** @license MIT | @cube-dev/ui-kit v0.0.0-canary-b7944fa | Cube Dev Team */
|
|
2
2
|
import { extractStyles } from "../../../utils/styles.js";
|
|
3
3
|
import { mergeRefs } from "../../../utils/react/useCombinedRefs.js";
|
|
4
4
|
import { useEvent } from "../../../_internal/hooks/use-event.js";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/** @license MIT | @cube-dev/ui-kit v0.0.0-canary-
|
|
1
|
+
/** @license MIT | @cube-dev/ui-kit v0.0.0-canary-b7944fa | Cube Dev Team */
|
|
2
2
|
import { mergeProps as mergeProps$1 } from "../../../utils/react/mergeProps.js";
|
|
3
3
|
import { mergeRefs } from "../../../utils/react/useCombinedRefs.js";
|
|
4
4
|
import { useEvent } from "../../../_internal/hooks/use-event.js";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/** @license MIT | @cube-dev/ui-kit v0.0.0-canary-
|
|
1
|
+
/** @license MIT | @cube-dev/ui-kit v0.0.0-canary-b7944fa | Cube Dev Team */
|
|
2
2
|
import { _Item } from "../Item/Item.js";
|
|
3
3
|
import { Action } from "../../actions/Action/Action.js";
|
|
4
4
|
import { tasty } from "@tenphi/tasty";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/** @license MIT | @cube-dev/ui-kit v0.0.0-canary-
|
|
1
|
+
/** @license MIT | @cube-dev/ui-kit v0.0.0-canary-b7944fa | Cube Dev Team */
|
|
2
2
|
//#region src/components/content/Tree/tree-index.ts
|
|
3
3
|
function buildTreeIndex(treeData) {
|
|
4
4
|
const byKey = /* @__PURE__ */ new Map();
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/** @license MIT | @cube-dev/ui-kit v0.0.0-canary-
|
|
1
|
+
/** @license MIT | @cube-dev/ui-kit v0.0.0-canary-b7944fa | Cube Dev Team */
|
|
2
2
|
import { TooltipProvider } from "../overlays/Tooltip/TooltipProvider.js";
|
|
3
3
|
import { useCallback, useEffect, useMemo, useRef, useState } from "react";
|
|
4
4
|
import { jsx } from "react/jsx-runtime";
|
|
@@ -1,12 +1,15 @@
|
|
|
1
|
-
/** @license MIT | @cube-dev/ui-kit v0.0.0-canary-
|
|
1
|
+
/** @license MIT | @cube-dev/ui-kit v0.0.0-canary-b7944fa | Cube Dev Team */
|
|
2
2
|
import { extractStyles } from "../../../utils/styles.js";
|
|
3
3
|
import { useCombinedRefs } from "../../../utils/react/useCombinedRefs.js";
|
|
4
4
|
import { useEvent } from "../../../_internal/hooks/use-event.js";
|
|
5
5
|
import { useI18n } from "../../../i18n/useI18n.js";
|
|
6
|
+
import { DraggableCollection } from "../../shared/DraggableCollection.js";
|
|
6
7
|
import { clampPage, getPageInfo } from "../../navigation/Pagination/use-pagination.js";
|
|
7
8
|
import { ItemTableFooter } from "../ItemTable/ItemTableFooter.js";
|
|
9
|
+
import { RowCollection } from "../TableBase/RowCollection.js";
|
|
8
10
|
import { selectionRowKey } from "../TableBase/types.js";
|
|
9
11
|
import { useCellSelection } from "../TableBase/use-cell-selection.js";
|
|
12
|
+
import { getDraggableColumnKeys, isColumnDraggable, useColumnOrder } from "../TableBase/use-column-order.js";
|
|
10
13
|
import { useTableColumns } from "../TableBase/use-table-columns.js";
|
|
11
14
|
import { ROW_NUMBER_COLUMN_KEY } from "../TableBase/use-table-selection.js";
|
|
12
15
|
import { TableView } from "../TableBase/TableView.js";
|
|
@@ -16,7 +19,9 @@ import { useTableStorage } from "../TableBase/use-table-storage.js";
|
|
|
16
19
|
import { CONTAINER_STYLES } from "@tenphi/tasty";
|
|
17
20
|
import { forwardRef, useMemo, useRef, useState } from "react";
|
|
18
21
|
import { jsx } from "react/jsx-runtime";
|
|
22
|
+
import { useMultipleSelectionState } from "react-stately";
|
|
19
23
|
import { useControlledState } from "@react-stately/utils";
|
|
24
|
+
import { SelectionManager } from "@react-stately/selection";
|
|
20
25
|
|
|
21
26
|
//#region src/components/data/DataTable/DataTable.tsx
|
|
22
27
|
/** Wide enough for five digits at the dense default. */
|
|
@@ -42,29 +47,31 @@ function defaultGetRowKey(rowKey) {
|
|
|
42
47
|
* Cloud.
|
|
43
48
|
*/
|
|
44
49
|
function DataTable(props, ref) {
|
|
45
|
-
const { data, columns, rowKey = "id", getRowKey, pinnedTopRows, pinnedBottomRows, isLoading = false, loadingIndicator = "overlay", skeletonRowCount, error, emptyLabel, noResultsLabel, isFiltered, shape = "plain", size = "small", rowHeight, headerHeight, isStriped = true, isHeaderHidden, isHeaderSticky, showRowNumbers = false, sortMode, sorts: sortsProp, defaultSorts, onSortsChange, paginationMode = "client", page: pageProp, defaultPage, onPageChange, pageSize: pageSizeProp, defaultPageSize = 100, onPageSizeChange, pageSizeOptions, total: totalProp, totalPages, hasNextPage, summary = true, autoHidePagination = true, footerStart, footerCenter, footerEnd, cellSelectionMode = "range", isCellSelectable, selectedCellRange, defaultSelectedCellRange, onCellRangeChange, isRowMoveAnimated, isResizable = true, columnWidths: columnWidthsProp, defaultColumnWidths, onColumnResize, isVirtualized, virtualizeThreshold, overscan, getRowProps, storageKey, styles, headerStyles, headerCellStyles, bodyStyles, rowStyles, cellStyles, footerStyles, ariaLabel, qa, mods, ...rest } = props;
|
|
50
|
+
const { data, columns, rowKey = "id", getRowKey, pinnedTopRows, pinnedBottomRows, isLoading = false, loadingIndicator = "overlay", skeletonRowCount, error, emptyLabel, noResultsLabel, isFiltered, shape = "plain", size = "small", rowHeight, headerHeight, isStriped = true, isHeaderHidden, isHeaderSticky, showRowNumbers = false, sortMode, sorts: sortsProp, defaultSorts, onSortsChange, paginationMode = "client", page: pageProp, defaultPage, onPageChange, pageSize: pageSizeProp, defaultPageSize = 100, onPageSizeChange, pageSizeOptions, total: totalProp, totalPages, hasNextPage, summary = true, autoHidePagination = true, footerStart, footerCenter, footerEnd, cellSelectionMode = "range", isCellSelectable, selectedCellRange, defaultSelectedCellRange, onCellRangeChange, isRowMoveAnimated, isResizable = true, columnWidths: columnWidthsProp, defaultColumnWidths, onColumnResize, isColumnReorderable = false, columnOrder, defaultColumnOrder, onColumnOrderChange, columnContextMenu, onColumnMenuAction, columnMenuTriggerProps, columnMenuProps, isVirtualized, virtualizeThreshold, overscan, getRowProps, storageKey, styles, headerStyles, headerCellStyles, bodyStyles, rowStyles, cellStyles, footerStyles, ariaLabel, qa, mods, ...rest } = props;
|
|
46
51
|
const rootRef = useCombinedRefs(ref, useRef(null));
|
|
47
52
|
const [scrollerEl, setScrollerEl] = useState(null);
|
|
48
53
|
const containerWidth = useContainerWidth(scrollerEl);
|
|
49
54
|
const storage = useTableStorage(storageKey);
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
55
|
+
const columnOrderState = useColumnOrder({
|
|
56
|
+
columns: useMemo(() => columns.map((column) => {
|
|
57
|
+
const isNumeric = column.dataType === "number";
|
|
58
|
+
return {
|
|
59
|
+
...column,
|
|
60
|
+
align: column.align ?? (isNumeric ? "end" : "start"),
|
|
61
|
+
cellStyles: isNumeric ? {
|
|
62
|
+
fontVariantNumeric: "tabular-nums",
|
|
63
|
+
...typeof column.cellStyles === "object" ? column.cellStyles : null
|
|
64
|
+
} : column.cellStyles
|
|
65
|
+
};
|
|
66
|
+
}), [columns]),
|
|
67
|
+
columnOrder,
|
|
68
|
+
defaultColumnOrder,
|
|
69
|
+
onColumnOrderChange,
|
|
70
|
+
storage
|
|
71
|
+
});
|
|
72
|
+
const orderedColumns = columnOrderState.columns;
|
|
73
|
+
const { sorts, sortedRows, toggleSort, setColumnSort, mode: resolvedSortMode } = useTableSorts({
|
|
74
|
+
columns: orderedColumns,
|
|
68
75
|
rows: data,
|
|
69
76
|
mode: sortMode,
|
|
70
77
|
sorts: sortsProp,
|
|
@@ -112,7 +119,7 @@ function DataTable(props, ref) {
|
|
|
112
119
|
setDraftColumnWidths(null);
|
|
113
120
|
});
|
|
114
121
|
const layout = useTableColumns({
|
|
115
|
-
columns:
|
|
122
|
+
columns: orderedColumns,
|
|
116
123
|
containerWidth,
|
|
117
124
|
columnWidths,
|
|
118
125
|
leadingColumns: useMemo(() => showRowNumbers ? [{
|
|
@@ -169,7 +176,27 @@ function DataTable(props, ref) {
|
|
|
169
176
|
const smallestPageSize = pageSizeOptions?.length ? Math.min(...pageSizeOptions) : pageSize;
|
|
170
177
|
const showPagination = isPaginated && !(autoHidePagination && !hasNextPage && pageInfo.totalPages <= 1 && total <= smallestPageSize);
|
|
171
178
|
const hasFooter = showPagination || footerStart != null || footerCenter != null || footerEnd != null;
|
|
172
|
-
|
|
179
|
+
const headRowRef = useRef(null);
|
|
180
|
+
const draggableColumnKeys = useMemo(() => getDraggableColumnKeys(layout.columns, isColumnReorderable), [layout.columns, isColumnReorderable]);
|
|
181
|
+
const columnCollection = useMemo(() => new RowCollection(layout.columns.filter((column) => isColumnDraggable(column, isColumnReorderable)), (column) => column.key, /* @__PURE__ */ new Set(), (column) => typeof column.title === "string" ? column.title : column.key), [layout.columns, isColumnReorderable]);
|
|
182
|
+
/**
|
|
183
|
+
* `'single'`, not `'none'`.
|
|
184
|
+
*
|
|
185
|
+
* `useDraggableItem` only deletes its own `onClick` — the one that would
|
|
186
|
+
* hijack a screen-reader click away from the sort — when the selection mode is
|
|
187
|
+
* not `'none'`, and only then does it attach the keyboard drag description.
|
|
188
|
+
* Nothing is ever actually selected here.
|
|
189
|
+
*/
|
|
190
|
+
const columnSelectionState = useMultipleSelectionState({
|
|
191
|
+
selectionMode: "single",
|
|
192
|
+
disabledBehavior: "all"
|
|
193
|
+
});
|
|
194
|
+
const columnSelectionManager = useMemo(() => new SelectionManager(columnCollection, columnSelectionState), [columnCollection, columnSelectionState]);
|
|
195
|
+
const handleColumnFocus = useEvent((columnKey) => {
|
|
196
|
+
columnSelectionManager.setFocusedKey(columnKey);
|
|
197
|
+
});
|
|
198
|
+
const isColumnDragEnabled = isColumnReorderable && draggableColumnKeys.length > 1;
|
|
199
|
+
const renderTable = (columnDragState, columnDropState, headCollectionProps) => /* @__PURE__ */ jsx(TableView, {
|
|
173
200
|
...rest,
|
|
174
201
|
rootRef,
|
|
175
202
|
qa: qa || "DataTable",
|
|
@@ -204,6 +231,11 @@ function DataTable(props, ref) {
|
|
|
204
231
|
sortMode: resolvedSortMode,
|
|
205
232
|
sorts,
|
|
206
233
|
onColumnSort: toggleSort,
|
|
234
|
+
onColumnSortChange: setColumnSort,
|
|
235
|
+
columnContextMenu,
|
|
236
|
+
onColumnMenuAction,
|
|
237
|
+
columnMenuTriggerProps,
|
|
238
|
+
columnMenuProps,
|
|
207
239
|
isVirtualized,
|
|
208
240
|
virtualizeThreshold,
|
|
209
241
|
overscan,
|
|
@@ -219,6 +251,12 @@ function DataTable(props, ref) {
|
|
|
219
251
|
rowStyles,
|
|
220
252
|
cellStyles,
|
|
221
253
|
mods,
|
|
254
|
+
isColumnReorderable: isColumnDragEnabled,
|
|
255
|
+
columnDragState,
|
|
256
|
+
columnDropState,
|
|
257
|
+
headCollectionProps,
|
|
258
|
+
headRowRef,
|
|
259
|
+
onColumnFocus: handleColumnFocus,
|
|
222
260
|
footer: hasFooter ? /* @__PURE__ */ jsx(ItemTableFooter, {
|
|
223
261
|
start: footerStart,
|
|
224
262
|
center: footerCenter,
|
|
@@ -237,6 +275,18 @@ function DataTable(props, ref) {
|
|
|
237
275
|
} : void 0
|
|
238
276
|
}) : null
|
|
239
277
|
});
|
|
278
|
+
return isColumnDragEnabled ? /* @__PURE__ */ jsx(DraggableCollection, {
|
|
279
|
+
state: {
|
|
280
|
+
collection: columnCollection,
|
|
281
|
+
selectionManager: columnSelectionManager,
|
|
282
|
+
disabledKeys: /* @__PURE__ */ new Set()
|
|
283
|
+
},
|
|
284
|
+
listRef: headRowRef,
|
|
285
|
+
orderedKeys: draggableColumnKeys,
|
|
286
|
+
orientation: "horizontal",
|
|
287
|
+
onReorder: columnOrderState.reorder,
|
|
288
|
+
children: (dragState, dropState, collectionProps) => renderTable(dragState, dropState, collectionProps)
|
|
289
|
+
}) : renderTable();
|
|
240
290
|
}
|
|
241
291
|
const _DataTable = forwardRef(DataTable);
|
|
242
292
|
_DataTable.displayName = "DataTable";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DataTable.js","names":[],"sources":["../../../../src/components/data/DataTable/DataTable.tsx"],"sourcesContent":["import { useControlledState } from '@react-stately/utils';\nimport { CONTAINER_STYLES } from '@tenphi/tasty';\nimport { forwardRef, useMemo, useRef, useState } from 'react';\n\nimport { useEvent } from '../../../_internal/hooks';\nimport { useI18n } from '../../../i18n';\nimport { useCombinedRefs } from '../../../utils/react';\nimport { extractStyles } from '../../../utils/styles';\nimport { clampPage, getPageInfo } from '../../navigation/Pagination';\nimport { ItemTableFooter } from '../ItemTable/ItemTableFooter';\nimport { TableView } from '../TableBase/TableView';\nimport { selectionRowKey } from '../TableBase/types';\nimport { useCellSelection } from '../TableBase/use-cell-selection';\nimport { useContainerWidth } from '../TableBase/use-container-width';\nimport { useTableColumns } from '../TableBase/use-table-columns';\nimport { ROW_NUMBER_COLUMN_KEY } from '../TableBase/use-table-selection';\nimport { useTableSorts } from '../TableBase/use-table-sorts';\nimport { useTableStorage } from '../TableBase/use-table-storage';\n\nimport type { Key } from '@react-types/shared';\nimport type { ForwardedRef, ReactElement } from 'react';\nimport type { CubeTableRowSection } from '../TableBase/types';\nimport type { CubeDataTableColumn, CubeDataTableProps } from './types';\n\n/** Wide enough for five digits at the dense default. */\nconst ROW_NUMBER_WIDTH = 56;\n\nconst EMPTY_WIDTHS: Record<string, number> = {};\n\nfunction defaultGetRowKey<T>(rowKey: string) {\n return (row: T, index: number): Key => {\n const value = (row as any)?.[rowKey];\n\n return value == null ? index : (value as Key);\n };\n}\n\n/**\n * A grid for query results.\n *\n * The same engine as `ItemTable` — one `TableView`, one column layout, one\n * value pipeline — with the defaults an analytical grid wants rather than a\n * list's: denser type, banded rows, resizable columns, multi-column sort, and\n * rows pinned for totals.\n *\n * It knows nothing about Cube. Measures, dimensions, pivots and drill-downs\n * reach it as ordinary columns, `render` output and `column.header.menu`\n * content, which is what keeps the ~34 kB of Cloud's column-header menu in\n * Cloud.\n */\nfunction DataTable<T = any>(\n props: CubeDataTableProps<T>,\n ref: ForwardedRef<HTMLDivElement>,\n) {\n const {\n data,\n columns,\n rowKey = 'id',\n getRowKey,\n pinnedTopRows,\n pinnedBottomRows,\n isLoading = false,\n loadingIndicator = 'overlay',\n skeletonRowCount,\n error,\n emptyLabel,\n noResultsLabel,\n isFiltered,\n shape = 'plain',\n // Denser than `ItemTable`'s `medium`: a result grid is read as a block, and\n // more rows on screen is the point of it.\n size = 'small',\n rowHeight,\n headerHeight,\n isStriped = true,\n isHeaderHidden,\n isHeaderSticky,\n showRowNumbers = false,\n sortMode,\n sorts: sortsProp,\n defaultSorts,\n onSortsChange,\n paginationMode = 'client',\n page: pageProp,\n defaultPage,\n onPageChange,\n pageSize: pageSizeProp,\n defaultPageSize = 100,\n onPageSizeChange,\n pageSizeOptions,\n total: totalProp,\n totalPages,\n hasNextPage,\n summary = true,\n autoHidePagination = true,\n footerStart,\n footerCenter,\n footerEnd,\n cellSelectionMode = 'range',\n isCellSelectable,\n selectedCellRange,\n defaultSelectedCellRange,\n onCellRangeChange,\n isRowMoveAnimated,\n isResizable = true,\n columnWidths: columnWidthsProp,\n defaultColumnWidths,\n onColumnResize,\n isVirtualized,\n virtualizeThreshold,\n overscan,\n getRowProps,\n storageKey,\n styles,\n headerStyles,\n headerCellStyles,\n bodyStyles,\n rowStyles,\n cellStyles,\n footerStyles,\n ariaLabel,\n qa,\n mods,\n ...rest\n } = props;\n\n const localRef = useRef<HTMLDivElement>(null);\n const rootRef = useCombinedRefs(ref, localRef);\n const [scrollerEl, setScrollerEl] = useState<HTMLElement | null>(null);\n const containerWidth = useContainerWidth(scrollerEl);\n\n const storage = useTableStorage(storageKey);\n\n /**\n * `dataType` is presentational, so it is folded into the column here rather\n * than reaching the renderer: `number` right-aligns and takes tabular figures\n * so digits line up down the column.\n */\n const resolvedColumns = useMemo(\n () =>\n columns.map((column) => {\n const isNumeric = column.dataType === 'number';\n\n return {\n ...column,\n align: column.align ?? (isNumeric ? 'end' : 'start'),\n cellStyles: isNumeric\n ? {\n fontVariantNumeric: 'tabular-nums',\n ...(typeof column.cellStyles === 'object'\n ? column.cellStyles\n : null),\n }\n : column.cellStyles,\n } as CubeDataTableColumn<T>;\n }),\n [columns],\n );\n\n const {\n sorts,\n sortedRows,\n toggleSort,\n mode: resolvedSortMode,\n } = useTableSorts<T>({\n columns: resolvedColumns,\n rows: data,\n mode: sortMode,\n sorts: sortsProp,\n defaultSorts,\n onSortsChange,\n });\n\n const [pageSize, setPageSizeState] = useControlledState<number>(\n pageSizeProp as number,\n (pageSizeProp === undefined && storage.has('pageSize')\n ? storage.initial.pageSize ?? defaultPageSize\n : defaultPageSize) as number,\n onPageSizeChange as (value: number) => void,\n );\n const [page, setPageState] = useControlledState<number>(\n pageProp as number,\n defaultPage ?? 1,\n onPageChange as (value: number) => void,\n );\n\n const isPaginated = paginationMode !== 'off';\n const isServerPaginated = paginationMode === 'server';\n const total = isServerPaginated ? totalProp ?? 0 : sortedRows.length;\n\n const pageInfo = getPageInfo({\n page,\n pageSize,\n total,\n totalPages: isServerPaginated ? totalPages : undefined,\n });\n\n const setPage = useEvent((next: number) =>\n setPageState(clampPage(next, pageInfo.totalPages)),\n );\n const setPageSize = useEvent((next: number) => {\n setPageSizeState(next);\n setPageState(1);\n\n if (pageSizeProp === undefined) storage.write({ pageSize: next });\n });\n\n const visibleRows =\n paginationMode === 'client'\n ? sortedRows.slice(\n (pageInfo.page - 1) * pageSize,\n pageInfo.page * pageSize,\n )\n : sortedRows;\n\n const [ownColumnWidths, setOwnColumnWidths] = useState<\n Record<string, number>\n >(\n () =>\n (columnWidthsProp === undefined && storage.has('columnWidths')\n ? storage.initial.columnWidths ?? defaultColumnWidths\n : defaultColumnWidths) ?? EMPTY_WIDTHS,\n );\n const [draftColumnWidths, setDraftColumnWidths] = useState<Record<\n string,\n number\n > | null>(null);\n const draftRef = useRef<Record<string, number> | null>(null);\n\n const baseColumnWidths = columnWidthsProp ?? ownColumnWidths;\n const columnWidths = draftColumnWidths ?? baseColumnWidths;\n\n const handleColumnResize = useEvent((key: string, width: number) => {\n draftRef.current = {\n ...(draftRef.current ?? baseColumnWidths),\n [key]: Math.round(width),\n };\n setDraftColumnWidths(draftRef.current);\n });\n\n const handleColumnResizeEnd = useEvent((key: string) => {\n const next = draftRef.current ?? baseColumnWidths;\n\n if (columnWidthsProp === undefined) {\n setOwnColumnWidths(next);\n storage.write({ columnWidths: next });\n }\n\n onColumnResize?.(key, next[key], next);\n draftRef.current = null;\n setDraftColumnWidths(null);\n });\n\n const leadingColumns = useMemo(\n () =>\n showRowNumbers\n ? [{ key: ROW_NUMBER_COLUMN_KEY, width: ROW_NUMBER_WIDTH }]\n : undefined,\n [showRowNumbers],\n );\n\n const layout = useTableColumns<T>({\n columns: resolvedColumns,\n containerWidth,\n columnWidths,\n leadingColumns,\n });\n\n const { t } = useI18n();\n\n const resolvedGetRowKey = useMemo(\n () => getRowKey ?? defaultGetRowKey<T>(rowKey),\n [getRowKey, rowKey],\n );\n\n // Every row a range can reach, in the order they appear on screen. Pinned rows\n // are in it: a total is a figure like any other, and having to copy it\n // separately from the column it sums is the wrong trade.\n //\n // The keys are built here rather than inside the hook so they cannot disagree\n // with the ones the renderer stamps — a pinned row is keyed by its own index\n // within its group, exactly as `renderPinnedRow` keys it.\n const selectionRows = useMemo(\n () => [\n ...(pinnedTopRows ?? []),\n ...visibleRows,\n ...(pinnedBottomRows ?? []),\n ],\n [pinnedTopRows, visibleRows, pinnedBottomRows],\n );\n const selectionRowKeys = useMemo(\n () => [\n // Section-qualified, matching what the renderer stamps: the same record\n // is routinely pinned at both edges, and one flat key space collapsed the\n // two into whichever came first.\n ...(pinnedTopRows ?? []).map((row, index) =>\n selectionRowKey('pinnedTop', resolvedGetRowKey(row, index)),\n ),\n ...visibleRows.map(resolvedGetRowKey),\n ...(pinnedBottomRows ?? []).map((row, index) =>\n selectionRowKey('pinnedBottom', resolvedGetRowKey(row, index)),\n ),\n ],\n [pinnedTopRows, visibleRows, pinnedBottomRows, resolvedGetRowKey],\n );\n\n // The hook works in one flat row order; the section a row belongs to is a\n // property of where it sits in that order, so it is resolved here rather than\n // asking the consumer to track it.\n const resolveCellSelectable = useEvent(\n (row: T, rowKey: Key, columnKey: string) => {\n if (!isCellSelectable) return true;\n\n const index = selectionRowKeys.indexOf(rowKey);\n const topCount = pinnedTopRows?.length ?? 0;\n const section: CubeTableRowSection =\n index < topCount\n ? 'pinnedTop'\n : index < topCount + visibleRows.length\n ? 'body'\n : 'pinnedBottom';\n\n return isCellSelectable({ row, rowKey, columnKey, section });\n },\n );\n\n const cellSelection = useCellSelection<T>({\n mode: cellSelectionMode,\n columns: layout.columns,\n rows: selectionRows,\n rowKeys: selectionRowKeys,\n isCellSelectable: isCellSelectable ? resolveCellSelectable : undefined,\n range: selectedCellRange,\n defaultRange: defaultSelectedCellRange,\n onRangeChange: onCellRangeChange,\n });\n\n // Same as `ItemTable`: style props (`height`, `maxHeight`, `margin`, …) land\n // on the root frame. `height` is the one that matters — there is no\n // page-scroll mode, so bounding the grid is what turns the body into a\n // scroller, pins the header, and lets virtualization engage at all.\n const rootStyles = { ...extractStyles(props, CONTAINER_STYLES), ...styles };\n\n const smallestPageSize = pageSizeOptions?.length\n ? Math.min(...pageSizeOptions)\n : pageSize;\n\n const showPagination =\n isPaginated &&\n !(\n autoHidePagination &&\n !hasNextPage &&\n pageInfo.totalPages <= 1 &&\n total <= smallestPageSize\n );\n\n const hasFooter =\n showPagination ||\n footerStart != null ||\n footerCenter != null ||\n footerEnd != null;\n\n return (\n <TableView<T>\n {...rest}\n rootRef={rootRef}\n qa={qa || 'DataTable'}\n rows={visibleRows}\n pinnedTopRows={pinnedTopRows}\n pinnedBottomRows={pinnedBottomRows}\n // Continuous across pages: row 101 is row 101, not row 1 of page two.\n //\n // Server mode counts too — the page and its size are known there just the\n // same, and `rows` is that page. Only `'off'` starts at 1, because then\n // there is no page to be on.\n rowNumberOffset={\n paginationMode === 'off' ? 0 : (pageInfo.page - 1) * pageSize\n }\n // The same offset drives `aria-rowindex`, which is document-absolute by\n // contract — a screen reader on page 3 should hear \"row 51 of 240\", not\n // \"row 1 of 25\".\n rowIndexOffset={\n paginationMode === 'off' ? 0 : (pageInfo.page - 1) * pageSize\n }\n totalRowCount={total}\n layout={layout}\n // Always on, unlike `ItemTable`. A result grid is read down a column, and\n // once the values are wide and right-aligned the rule is what keeps a\n // figure attached to its column — which is why Cloud's ag-grid theme sets\n // `columnBorder` for `DataTable` and not for the list grids.\n hasColumnDividers\n cellSelection={cellSelection}\n getRowKey={resolvedGetRowKey}\n onScrollerRef={setScrollerEl}\n isLoading={isLoading}\n loadingIndicator={loadingIndicator}\n skeletonRowCount={skeletonRowCount}\n error={error}\n // Same localized fallbacks as `ItemTable`: a grid that has finished\n // loading and shows an unexplained blank rectangle reads as broken.\n emptyLabel={emptyLabel ?? t('itemTable.noItems', 'No items')}\n noResultsLabel={\n noResultsLabel ?? t('itemTable.noResults', 'No results found')\n }\n isFiltered={isFiltered}\n shape={shape}\n size={size}\n rowHeight={rowHeight}\n headerHeight={headerHeight}\n isStriped={isStriped}\n isRowMoveAnimated={isRowMoveAnimated}\n isHeaderHidden={isHeaderHidden}\n isHeaderSticky={isHeaderSticky}\n // The header shows the column name at body size — a result grid has no\n // room for the uppercase caption a list header uses.\n // `t4` throughout: a result grid is read as a block, and one step down\n // from the list preset fits noticeably more on screen without losing\n // legibility. The header takes the medium weight of the same step.\n contentPreset=\"t4\"\n headerPreset=\"t4m\"\n sortMode={resolvedSortMode}\n sorts={sorts}\n onColumnSort={toggleSort}\n isVirtualized={isVirtualized}\n virtualizeThreshold={virtualizeThreshold}\n overscan={overscan}\n isResizable={isResizable}\n onColumnResize={handleColumnResize}\n onColumnResizeEnd={handleColumnResizeEnd}\n getRowProps={getRowProps}\n ariaLabel={ariaLabel}\n styles={rootStyles}\n headerStyles={headerStyles}\n headerCellStyles={headerCellStyles}\n bodyStyles={bodyStyles}\n rowStyles={rowStyles}\n cellStyles={cellStyles}\n mods={mods}\n footer={\n hasFooter ? (\n <ItemTableFooter\n start={footerStart}\n center={footerCenter}\n end={footerEnd}\n styles={footerStyles}\n pagination={\n showPagination\n ? {\n page: pageInfo.page,\n pageSize,\n total,\n totalPages: pageInfo.totalPages,\n pageSizeOptions,\n summary,\n hasNextPage,\n onPageChange: setPage,\n onPageSizeChange: setPageSize,\n }\n : undefined\n }\n />\n ) : null\n }\n />\n );\n}\n\nconst _DataTable = forwardRef(DataTable) as unknown as (<T = any>(\n props: CubeDataTableProps<T> & { ref?: ForwardedRef<HTMLDivElement> },\n) => ReactElement) & { displayName?: string };\n\n_DataTable.displayName = 'DataTable';\n\nexport { _DataTable as DataTable };\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAyBA,MAAM,mBAAmB;AAEzB,MAAM,eAAuC,EAAE;AAE/C,SAAS,iBAAoB,QAAgB;AAC3C,SAAQ,KAAQ,UAAuB;EACrC,MAAM,QAAS,MAAc;AAE7B,SAAO,SAAS,OAAO,QAAS;;;;;;;;;;;;;;;;AAiBpC,SAAS,UACP,OACA,KACA;CACA,MAAM,EACJ,MACA,SACA,SAAS,MACT,WACA,eACA,kBACA,YAAY,OACZ,mBAAmB,WACnB,kBACA,OACA,YACA,gBACA,YACA,QAAQ,SAGR,OAAO,SACP,WACA,cACA,YAAY,MACZ,gBACA,gBACA,iBAAiB,OACjB,UACA,OAAO,WACP,cACA,eACA,iBAAiB,UACjB,MAAM,UACN,aACA,cACA,UAAU,cACV,kBAAkB,KAClB,kBACA,iBACA,OAAO,WACP,YACA,aACA,UAAU,MACV,qBAAqB,MACrB,aACA,cACA,WACA,oBAAoB,SACpB,kBACA,mBACA,0BACA,mBACA,mBACA,cAAc,MACd,cAAc,kBACd,qBACA,gBACA,eACA,qBACA,UACA,aACA,YACA,QACA,cACA,kBACA,YACA,WACA,YACA,cACA,WACA,IACA,MACA,GAAG,SACD;CAGJ,MAAM,UAAU,gBAAgB,KADf,OAAuB,KAAK,CACC;CAC9C,MAAM,CAAC,YAAY,iBAAiB,SAA6B,KAAK;CACtE,MAAM,iBAAiB,kBAAkB,WAAW;CAEpD,MAAM,UAAU,gBAAgB,WAAW;;;;;;CAO3C,MAAM,kBAAkB,cAEpB,QAAQ,KAAK,WAAW;EACtB,MAAM,YAAY,OAAO,aAAa;AAEtC,SAAO;GACL,GAAG;GACH,OAAO,OAAO,UAAU,YAAY,QAAQ;GAC5C,YAAY,YACR;IACE,oBAAoB;IACpB,GAAI,OAAO,OAAO,eAAe,WAC7B,OAAO,aACP;IACL,GACD,OAAO;GACZ;GACD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M,gBAAgB,iBAAoB;EACxC,MAAM;EACN,SAAS,OAAO;EAChB,MAAM;EACN,SAAS;EACT,kBAAkB,mBAAmB,wBAAwB;EAC7D,OAAO;EACP,cAAc;EACd,eAAe;EAChB,CAAC;CAMF,MAAM,aAAa;EAAE,GAAG,cAAc,OAAO,iBAAiB;EAAE,GAAG;EAAQ;CAE3E,MAAM,mBAAmB,iBAAiB,SACtC,KAAK,IAAI,GAAG,gBAAgB,GAC5B;CAEJ,MAAM,iBACJ,eACA,EACE,sBACA,CAAC,eACD,SAAS,cAAc,KACvB,SAAS;CAGb,MAAM,YACJ,kBACA,eAAe,QACf,gBAAgB,QAChB,aAAa;AAEf,QACE,oBAAC;EACC,GAAI;EACK;EACT,IAAI,MAAM;EACV,MAAM;EACS;EACG;EAMlB,iBACE,mBAAmB,QAAQ,KAAK,SAAS,OAAO,KAAK;EAKvD,gBACE,mBAAmB,QAAQ,KAAK,SAAS,OAAO,KAAK;EAEvD,eAAe;EACP;EAKR;EACe;EACf,WAAW;EACX,eAAe;EACJ;EACO;EACA;EACX;EAGP,YAAY,cAAc,EAAE,qBAAqB,WAAW;EAC5D,gBACE,kBAAkB,EAAE,uBAAuB,mBAAmB;EAEpD;EACL;EACD;EACK;EACG;EACH;EACQ;EACH;EACA;EAMhB,eAAc;EACd,cAAa;EACb,UAAU;EACH;EACP,cAAc;EACC;EACM;EACX;EACG;EACb,gBAAgB;EAChB,mBAAmB;EACN;EACF;EACX,QAAQ;EACM;EACI;EACN;EACD;EACC;EACN;EACN,QACE,YACE,oBAAC;GACC,OAAO;GACP,QAAQ;GACR,KAAK;GACL,QAAQ;GACR,YACE,iBACI;IACE,MAAM,SAAS;IACf;IACA;IACA,YAAY,SAAS;IACrB;IACA;IACA;IACA,cAAc;IACd,kBAAkB;IACnB,GACD;IAEN,GACA;GAEN;;AAIN,MAAM,aAAa,WAAW,UAAU;AAIxC,WAAW,cAAc"}
|
|
1
|
+
{"version":3,"file":"DataTable.js","names":[],"sources":["../../../../src/components/data/DataTable/DataTable.tsx"],"sourcesContent":["import { SelectionManager } from '@react-stately/selection';\nimport { useControlledState } from '@react-stately/utils';\nimport { CONTAINER_STYLES } from '@tenphi/tasty';\nimport { forwardRef, useMemo, useRef, useState } from 'react';\nimport { useMultipleSelectionState } from 'react-stately';\n\nimport { useEvent } from '../../../_internal/hooks';\nimport { useI18n } from '../../../i18n';\nimport { useCombinedRefs } from '../../../utils/react';\nimport { extractStyles } from '../../../utils/styles';\nimport { clampPage, getPageInfo } from '../../navigation/Pagination';\nimport { DraggableCollection } from '../../shared/DraggableCollection';\nimport { ItemTableFooter } from '../ItemTable/ItemTableFooter';\nimport { RowCollection } from '../TableBase/RowCollection';\nimport { TableView } from '../TableBase/TableView';\nimport { selectionRowKey } from '../TableBase/types';\nimport { useCellSelection } from '../TableBase/use-cell-selection';\nimport {\n getDraggableColumnKeys,\n isColumnDraggable,\n useColumnOrder,\n} from '../TableBase/use-column-order';\nimport { useContainerWidth } from '../TableBase/use-container-width';\nimport { useTableColumns } from '../TableBase/use-table-columns';\nimport { ROW_NUMBER_COLUMN_KEY } from '../TableBase/use-table-selection';\nimport { useTableSorts } from '../TableBase/use-table-sorts';\nimport { useTableStorage } from '../TableBase/use-table-storage';\n\nimport type { Key } from '@react-types/shared';\nimport type { ForwardedRef, ReactElement } from 'react';\nimport type { CubeTableRowSection } from '../TableBase/types';\nimport type { CubeDataTableColumn, CubeDataTableProps } from './types';\n\n/** Wide enough for five digits at the dense default. */\nconst ROW_NUMBER_WIDTH = 56;\n\nconst EMPTY_WIDTHS: Record<string, number> = {};\n\nfunction defaultGetRowKey<T>(rowKey: string) {\n return (row: T, index: number): Key => {\n const value = (row as any)?.[rowKey];\n\n return value == null ? index : (value as Key);\n };\n}\n\n/**\n * A grid for query results.\n *\n * The same engine as `ItemTable` — one `TableView`, one column layout, one\n * value pipeline — with the defaults an analytical grid wants rather than a\n * list's: denser type, banded rows, resizable columns, multi-column sort, and\n * rows pinned for totals.\n *\n * It knows nothing about Cube. Measures, dimensions, pivots and drill-downs\n * reach it as ordinary columns, `render` output and `column.header.menu`\n * content, which is what keeps the ~34 kB of Cloud's column-header menu in\n * Cloud.\n */\nfunction DataTable<T = any>(\n props: CubeDataTableProps<T>,\n ref: ForwardedRef<HTMLDivElement>,\n) {\n const {\n data,\n columns,\n rowKey = 'id',\n getRowKey,\n pinnedTopRows,\n pinnedBottomRows,\n isLoading = false,\n loadingIndicator = 'overlay',\n skeletonRowCount,\n error,\n emptyLabel,\n noResultsLabel,\n isFiltered,\n shape = 'plain',\n // Denser than `ItemTable`'s `medium`: a result grid is read as a block, and\n // more rows on screen is the point of it.\n size = 'small',\n rowHeight,\n headerHeight,\n isStriped = true,\n isHeaderHidden,\n isHeaderSticky,\n showRowNumbers = false,\n sortMode,\n sorts: sortsProp,\n defaultSorts,\n onSortsChange,\n paginationMode = 'client',\n page: pageProp,\n defaultPage,\n onPageChange,\n pageSize: pageSizeProp,\n defaultPageSize = 100,\n onPageSizeChange,\n pageSizeOptions,\n total: totalProp,\n totalPages,\n hasNextPage,\n summary = true,\n autoHidePagination = true,\n footerStart,\n footerCenter,\n footerEnd,\n cellSelectionMode = 'range',\n isCellSelectable,\n selectedCellRange,\n defaultSelectedCellRange,\n onCellRangeChange,\n isRowMoveAnimated,\n isResizable = true,\n columnWidths: columnWidthsProp,\n defaultColumnWidths,\n onColumnResize,\n isColumnReorderable = false,\n columnOrder,\n defaultColumnOrder,\n onColumnOrderChange,\n columnContextMenu,\n onColumnMenuAction,\n columnMenuTriggerProps,\n columnMenuProps,\n isVirtualized,\n virtualizeThreshold,\n overscan,\n getRowProps,\n storageKey,\n styles,\n headerStyles,\n headerCellStyles,\n bodyStyles,\n rowStyles,\n cellStyles,\n footerStyles,\n ariaLabel,\n qa,\n mods,\n ...rest\n } = props;\n\n const localRef = useRef<HTMLDivElement>(null);\n const rootRef = useCombinedRefs(ref, localRef);\n const [scrollerEl, setScrollerEl] = useState<HTMLElement | null>(null);\n const containerWidth = useContainerWidth(scrollerEl);\n\n const storage = useTableStorage(storageKey);\n\n /**\n * `dataType` is presentational, so it is folded into the column here rather\n * than reaching the renderer: `number` right-aligns and takes tabular figures\n * so digits line up down the column.\n */\n const resolvedColumns = useMemo(\n () =>\n columns.map((column) => {\n const isNumeric = column.dataType === 'number';\n\n return {\n ...column,\n align: column.align ?? (isNumeric ? 'end' : 'start'),\n cellStyles: isNumeric\n ? {\n fontVariantNumeric: 'tabular-nums',\n ...(typeof column.cellStyles === 'object'\n ? column.cellStyles\n : null),\n }\n : column.cellStyles,\n } as CubeDataTableColumn<T>;\n }),\n [columns],\n );\n\n // Applied to the SOURCE columns, before `useTableColumns`, so hidden-column\n // filtering, structural injection and pinned hoisting all still happen\n // downstream and `columnOrder` can never fight `pin`.\n const columnOrderState = useColumnOrder<T>({\n columns: resolvedColumns,\n columnOrder,\n defaultColumnOrder,\n onColumnOrderChange,\n storage,\n });\n const orderedColumns = columnOrderState.columns;\n\n const {\n sorts,\n sortedRows,\n toggleSort,\n setColumnSort,\n mode: resolvedSortMode,\n } = useTableSorts<T>({\n columns: orderedColumns,\n rows: data,\n mode: sortMode,\n sorts: sortsProp,\n defaultSorts,\n onSortsChange,\n });\n\n const [pageSize, setPageSizeState] = useControlledState<number>(\n pageSizeProp as number,\n (pageSizeProp === undefined && storage.has('pageSize')\n ? storage.initial.pageSize ?? defaultPageSize\n : defaultPageSize) as number,\n onPageSizeChange as (value: number) => void,\n );\n const [page, setPageState] = useControlledState<number>(\n pageProp as number,\n defaultPage ?? 1,\n onPageChange as (value: number) => void,\n );\n\n const isPaginated = paginationMode !== 'off';\n const isServerPaginated = paginationMode === 'server';\n const total = isServerPaginated ? totalProp ?? 0 : sortedRows.length;\n\n const pageInfo = getPageInfo({\n page,\n pageSize,\n total,\n totalPages: isServerPaginated ? totalPages : undefined,\n });\n\n const setPage = useEvent((next: number) =>\n setPageState(clampPage(next, pageInfo.totalPages)),\n );\n const setPageSize = useEvent((next: number) => {\n setPageSizeState(next);\n setPageState(1);\n\n if (pageSizeProp === undefined) storage.write({ pageSize: next });\n });\n\n const visibleRows =\n paginationMode === 'client'\n ? sortedRows.slice(\n (pageInfo.page - 1) * pageSize,\n pageInfo.page * pageSize,\n )\n : sortedRows;\n\n const [ownColumnWidths, setOwnColumnWidths] = useState<\n Record<string, number>\n >(\n () =>\n (columnWidthsProp === undefined && storage.has('columnWidths')\n ? storage.initial.columnWidths ?? defaultColumnWidths\n : defaultColumnWidths) ?? EMPTY_WIDTHS,\n );\n const [draftColumnWidths, setDraftColumnWidths] = useState<Record<\n string,\n number\n > | null>(null);\n const draftRef = useRef<Record<string, number> | null>(null);\n\n const baseColumnWidths = columnWidthsProp ?? ownColumnWidths;\n const columnWidths = draftColumnWidths ?? baseColumnWidths;\n\n const handleColumnResize = useEvent((key: string, width: number) => {\n draftRef.current = {\n ...(draftRef.current ?? baseColumnWidths),\n [key]: Math.round(width),\n };\n setDraftColumnWidths(draftRef.current);\n });\n\n const handleColumnResizeEnd = useEvent((key: string) => {\n const next = draftRef.current ?? baseColumnWidths;\n\n if (columnWidthsProp === undefined) {\n setOwnColumnWidths(next);\n storage.write({ columnWidths: next });\n }\n\n onColumnResize?.(key, next[key], next);\n draftRef.current = null;\n setDraftColumnWidths(null);\n });\n\n const leadingColumns = useMemo(\n () =>\n showRowNumbers\n ? [{ key: ROW_NUMBER_COLUMN_KEY, width: ROW_NUMBER_WIDTH }]\n : undefined,\n [showRowNumbers],\n );\n\n const layout = useTableColumns<T>({\n columns: orderedColumns,\n containerWidth,\n columnWidths,\n leadingColumns,\n });\n\n const { t } = useI18n();\n\n const resolvedGetRowKey = useMemo(\n () => getRowKey ?? defaultGetRowKey<T>(rowKey),\n [getRowKey, rowKey],\n );\n\n // Every row a range can reach, in the order they appear on screen. Pinned rows\n // are in it: a total is a figure like any other, and having to copy it\n // separately from the column it sums is the wrong trade.\n //\n // The keys are built here rather than inside the hook so they cannot disagree\n // with the ones the renderer stamps — a pinned row is keyed by its own index\n // within its group, exactly as `renderPinnedRow` keys it.\n const selectionRows = useMemo(\n () => [\n ...(pinnedTopRows ?? []),\n ...visibleRows,\n ...(pinnedBottomRows ?? []),\n ],\n [pinnedTopRows, visibleRows, pinnedBottomRows],\n );\n const selectionRowKeys = useMemo(\n () => [\n // Section-qualified, matching what the renderer stamps: the same record\n // is routinely pinned at both edges, and one flat key space collapsed the\n // two into whichever came first.\n ...(pinnedTopRows ?? []).map((row, index) =>\n selectionRowKey('pinnedTop', resolvedGetRowKey(row, index)),\n ),\n ...visibleRows.map(resolvedGetRowKey),\n ...(pinnedBottomRows ?? []).map((row, index) =>\n selectionRowKey('pinnedBottom', resolvedGetRowKey(row, index)),\n ),\n ],\n [pinnedTopRows, visibleRows, pinnedBottomRows, resolvedGetRowKey],\n );\n\n // The hook works in one flat row order; the section a row belongs to is a\n // property of where it sits in that order, so it is resolved here rather than\n // asking the consumer to track it.\n const resolveCellSelectable = useEvent(\n (row: T, rowKey: Key, columnKey: string) => {\n if (!isCellSelectable) return true;\n\n const index = selectionRowKeys.indexOf(rowKey);\n const topCount = pinnedTopRows?.length ?? 0;\n const section: CubeTableRowSection =\n index < topCount\n ? 'pinnedTop'\n : index < topCount + visibleRows.length\n ? 'body'\n : 'pinnedBottom';\n\n return isCellSelectable({ row, rowKey, columnKey, section });\n },\n );\n\n const cellSelection = useCellSelection<T>({\n mode: cellSelectionMode,\n columns: layout.columns,\n rows: selectionRows,\n rowKeys: selectionRowKeys,\n isCellSelectable: isCellSelectable ? resolveCellSelectable : undefined,\n range: selectedCellRange,\n defaultRange: defaultSelectedCellRange,\n onRangeChange: onCellRangeChange,\n });\n\n // Same as `ItemTable`: style props (`height`, `maxHeight`, `margin`, …) land\n // on the root frame. `height` is the one that matters — there is no\n // page-scroll mode, so bounding the grid is what turns the body into a\n // scroller, pins the header, and lets virtualization engage at all.\n const rootStyles = { ...extractStyles(props, CONTAINER_STYLES), ...styles };\n\n const smallestPageSize = pageSizeOptions?.length\n ? Math.min(...pageSizeOptions)\n : pageSize;\n\n const showPagination =\n isPaginated &&\n !(\n autoHidePagination &&\n !hasNextPage &&\n pageInfo.totalPages <= 1 &&\n total <= smallestPageSize\n );\n\n const hasFooter =\n showPagination ||\n footerStart != null ||\n footerCenter != null ||\n footerEnd != null;\n\n /* ── column reordering ────────────────────────────────────────────────── */\n\n const headRowRef = useRef<HTMLTableRowElement>(null);\n const draggableColumnKeys = useMemo(\n () => getDraggableColumnKeys(layout.columns, isColumnReorderable),\n [layout.columns, isColumnReorderable],\n );\n const columnCollection = useMemo(\n () =>\n new RowCollection(\n layout.columns.filter((column) =>\n isColumnDraggable(column, isColumnReorderable),\n ),\n (column) => column.key,\n new Set(),\n // The drag announcements read this — otherwise a screen reader hears\n // \"Insert between and \".\n (column) =>\n typeof column.title === 'string' ? column.title : column.key,\n ),\n [layout.columns, isColumnReorderable],\n );\n /**\n * `'single'`, not `'none'`.\n *\n * `useDraggableItem` only deletes its own `onClick` — the one that would\n * hijack a screen-reader click away from the sort — when the selection mode is\n * not `'none'`, and only then does it attach the keyboard drag description.\n * Nothing is ever actually selected here.\n */\n const columnSelectionState = useMultipleSelectionState({\n selectionMode: 'single',\n disabledBehavior: 'all',\n });\n const columnSelectionManager = useMemo(\n () => new SelectionManager(columnCollection, columnSelectionState),\n [columnCollection, columnSelectionState],\n );\n const handleColumnFocus = useEvent((columnKey: string | null) => {\n columnSelectionManager.setFocusedKey(columnKey);\n });\n\n // One draggable column cannot be reordered, so the machinery stays unmounted\n // and the header keeps its exact DOM.\n const isColumnDragEnabled =\n isColumnReorderable && draggableColumnKeys.length > 1;\n\n const renderTable = (\n columnDragState?: any,\n columnDropState?: any,\n headCollectionProps?: Record<string, any>,\n ) => (\n <TableView<T>\n {...rest}\n rootRef={rootRef}\n qa={qa || 'DataTable'}\n rows={visibleRows}\n pinnedTopRows={pinnedTopRows}\n pinnedBottomRows={pinnedBottomRows}\n // Continuous across pages: row 101 is row 101, not row 1 of page two.\n //\n // Server mode counts too — the page and its size are known there just the\n // same, and `rows` is that page. Only `'off'` starts at 1, because then\n // there is no page to be on.\n rowNumberOffset={\n paginationMode === 'off' ? 0 : (pageInfo.page - 1) * pageSize\n }\n // The same offset drives `aria-rowindex`, which is document-absolute by\n // contract — a screen reader on page 3 should hear \"row 51 of 240\", not\n // \"row 1 of 25\".\n rowIndexOffset={\n paginationMode === 'off' ? 0 : (pageInfo.page - 1) * pageSize\n }\n totalRowCount={total}\n layout={layout}\n // Always on, unlike `ItemTable`. A result grid is read down a column, and\n // once the values are wide and right-aligned the rule is what keeps a\n // figure attached to its column — which is why Cloud's ag-grid theme sets\n // `columnBorder` for `DataTable` and not for the list grids.\n hasColumnDividers\n cellSelection={cellSelection}\n getRowKey={resolvedGetRowKey}\n onScrollerRef={setScrollerEl}\n isLoading={isLoading}\n loadingIndicator={loadingIndicator}\n skeletonRowCount={skeletonRowCount}\n error={error}\n // Same localized fallbacks as `ItemTable`: a grid that has finished\n // loading and shows an unexplained blank rectangle reads as broken.\n emptyLabel={emptyLabel ?? t('itemTable.noItems', 'No items')}\n noResultsLabel={\n noResultsLabel ?? t('itemTable.noResults', 'No results found')\n }\n isFiltered={isFiltered}\n shape={shape}\n size={size}\n rowHeight={rowHeight}\n headerHeight={headerHeight}\n isStriped={isStriped}\n isRowMoveAnimated={isRowMoveAnimated}\n isHeaderHidden={isHeaderHidden}\n isHeaderSticky={isHeaderSticky}\n // The header shows the column name at body size — a result grid has no\n // room for the uppercase caption a list header uses.\n // `t4` throughout: a result grid is read as a block, and one step down\n // from the list preset fits noticeably more on screen without losing\n // legibility. The header takes the medium weight of the same step.\n contentPreset=\"t4\"\n headerPreset=\"t4m\"\n sortMode={resolvedSortMode}\n sorts={sorts}\n onColumnSort={toggleSort}\n onColumnSortChange={setColumnSort}\n columnContextMenu={columnContextMenu}\n onColumnMenuAction={onColumnMenuAction}\n columnMenuTriggerProps={columnMenuTriggerProps}\n columnMenuProps={columnMenuProps}\n isVirtualized={isVirtualized}\n virtualizeThreshold={virtualizeThreshold}\n overscan={overscan}\n isResizable={isResizable}\n onColumnResize={handleColumnResize}\n onColumnResizeEnd={handleColumnResizeEnd}\n getRowProps={getRowProps}\n ariaLabel={ariaLabel}\n styles={rootStyles}\n headerStyles={headerStyles}\n headerCellStyles={headerCellStyles}\n bodyStyles={bodyStyles}\n rowStyles={rowStyles}\n cellStyles={cellStyles}\n mods={mods}\n isColumnReorderable={isColumnDragEnabled}\n columnDragState={columnDragState}\n columnDropState={columnDropState}\n headCollectionProps={headCollectionProps}\n headRowRef={headRowRef}\n onColumnFocus={handleColumnFocus}\n footer={\n hasFooter ? (\n <ItemTableFooter\n start={footerStart}\n center={footerCenter}\n end={footerEnd}\n styles={footerStyles}\n pagination={\n showPagination\n ? {\n page: pageInfo.page,\n pageSize,\n total,\n totalPages: pageInfo.totalPages,\n pageSizeOptions,\n summary,\n hasNextPage,\n onPageChange: setPage,\n onPageSizeChange: setPageSize,\n }\n : undefined\n }\n />\n ) : null\n }\n />\n );\n\n return isColumnDragEnabled ? (\n <DraggableCollection\n state={{\n collection: columnCollection as any,\n selectionManager: columnSelectionManager as any,\n disabledKeys: new Set(),\n }}\n // The element that DIRECTLY contains the header cells. React Aria's\n // `ListDropTargetDelegate` resolves a drop by measuring `[data-key]`\n // descendants of this element, so pointing it anywhere else leaves every\n // drop unresolvable — the column lifts but never lands.\n listRef={headRowRef}\n orderedKeys={draggableColumnKeys}\n orientation=\"horizontal\"\n onReorder={columnOrderState.reorder}\n >\n {(dragState, dropState, collectionProps) =>\n renderTable(dragState, dropState, collectionProps)\n }\n </DraggableCollection>\n ) : (\n renderTable()\n );\n}\n\nconst _DataTable = forwardRef(DataTable) as unknown as (<T = any>(\n props: CubeDataTableProps<T> & { ref?: ForwardedRef<HTMLDivElement> },\n) => ReactElement) & { displayName?: string };\n\n_DataTable.displayName = 'DataTable';\n\nexport { _DataTable as DataTable };\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AAkCA,MAAM,mBAAmB;AAEz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SAAS,OAAO,KAAK;EAEvD,eAAe;EACP;EAKR;EACe;EACf,WAAW;EACX,eAAe;EACJ;EACO;EACA;EACX;EAGP,YAAY,cAAc,EAAE,qBAAqB,WAAW;EAC5D,gBACE,kBAAkB,EAAE,uBAAuB,mBAAmB;EAEpD;EACL;EACD;EACK;EACG;EACH;EACQ;EACH;EACA;EAMhB,eAAc;EACd,cAAa;EACb,UAAU;EACH;EACP,cAAc;EACd,oBAAoB;EACD;EACC;EACI;EACP;EACF;EACM;EACX;EACG;EACb,gBAAgB;EAChB,mBAAmB;EACN;EACF;EACX,QAAQ;EACM;EACI;EACN;EACD;EACC;EACN;EACN,qBAAqB;EACJ;EACA;EACI;EACT;EACZ,eAAe;EACf,QACE,YACE,oBAAC;GACC,OAAO;GACP,QAAQ;GACR,KAAK;GACL,QAAQ;GACR,YACE,iBACI;IACE,MAAM,SAAS;IACf;IACA;IACA,YAAY,SAAS;IACrB;IACA;IACA;IACA,cAAc;IACd,kBAAkB;IACnB,GACD;IAEN,GACA;GAEN;AAGJ,QAAO,sBACL,oBAAC;EACC,OAAO;GACL,YAAY;GACZ,kBAAkB;GAClB,8BAAc,IAAI,KAAK;GACxB;EAKD,SAAS;EACT,aAAa;EACb,aAAY;EACZ,WAAW,iBAAiB;aAE1B,WAAW,WAAW,oBACtB,YAAY,WAAW,WAAW,gBAAgB;GAEhC,GAEtB,aAAa;;AAIjB,MAAM,aAAa,WAAW,UAAU;AAIxC,WAAW,cAAc"}
|
|
@@ -124,6 +124,49 @@ interface CubeDataTableProps<T = any> extends BaseProps, ContainerStyleProps {
|
|
|
124
124
|
columnWidths?: Record<string, number>;
|
|
125
125
|
defaultColumnWidths?: Record<string, number>;
|
|
126
126
|
onColumnResize?: (columnKey: string, width: number, all: Record<string, number>) => void;
|
|
127
|
+
/**
|
|
128
|
+
* Drag column headers sideways to reorder them.
|
|
129
|
+
*
|
|
130
|
+
* Named for the axis: `ItemTable`'s `isReorderable` already means ROW
|
|
131
|
+
* reordering, and the two are different features.
|
|
132
|
+
*
|
|
133
|
+
* Structural and pinned columns stay put. `pin` is already the ordering
|
|
134
|
+
* authority for a pinned column, and a sticky `<th>` cannot be hit-tested
|
|
135
|
+
* reliably under horizontal scroll.
|
|
136
|
+
*
|
|
137
|
+
* @default false
|
|
138
|
+
*/
|
|
139
|
+
isColumnReorderable?: boolean;
|
|
140
|
+
/**
|
|
141
|
+
* Controlled order, as column keys. Works with or without dragging, so a
|
|
142
|
+
* column manager elsewhere in the page can drive it on its own.
|
|
143
|
+
*
|
|
144
|
+
* Stale keys are ignored, and a column missing from the list lands after the
|
|
145
|
+
* neighbour it had in `columns` rather than at the end.
|
|
146
|
+
*/
|
|
147
|
+
columnOrder?: string[];
|
|
148
|
+
defaultColumnOrder?: string[];
|
|
149
|
+
/** The FULL key list, including hidden and pinned columns. */
|
|
150
|
+
onColumnOrderChange?: (order: string[]) => void;
|
|
151
|
+
/**
|
|
152
|
+
* Where a column's `header.menu` is exposed.
|
|
153
|
+
*
|
|
154
|
+
* - `true` — a `⋮` trigger in the header, plus right-click and Shift+F10.
|
|
155
|
+
* - `'context-only'` — right-click and Shift+F10 only, no trigger.
|
|
156
|
+
* - `false` — suppressed entirely.
|
|
157
|
+
*
|
|
158
|
+
* @default true
|
|
159
|
+
*/
|
|
160
|
+
columnContextMenu?: boolean | 'context-only';
|
|
161
|
+
/**
|
|
162
|
+
* The key of the pressed `Menu.Item`, as written — no `.$` prefix.
|
|
163
|
+
*
|
|
164
|
+
* Fires for the reserved sort keys too (`sort-asc`, `sort-desc`,
|
|
165
|
+
* `clear-sort`), after the table has already applied them.
|
|
166
|
+
*/
|
|
167
|
+
onColumnMenuAction?: (action: string, columnKey: string) => void;
|
|
168
|
+
columnMenuTriggerProps?: Record<string, any>;
|
|
169
|
+
columnMenuProps?: Record<string, any>;
|
|
127
170
|
isVirtualized?: boolean | 'auto';
|
|
128
171
|
virtualizeThreshold?: number;
|
|
129
172
|
overscan?: number;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/** @license MIT | @cube-dev/ui-kit v0.0.0-canary-
|
|
1
|
+
/** @license MIT | @cube-dev/ui-kit v0.0.0-canary-b7944fa | Cube Dev Team */
|
|
2
2
|
import { extractStyles } from "../../../utils/styles.js";
|
|
3
3
|
import { useCombinedRefs } from "../../../utils/react/useCombinedRefs.js";
|
|
4
4
|
import { useEvent } from "../../../_internal/hooks/use-event.js";
|
|
@@ -32,7 +32,7 @@ function defaultGetRowKey(rowKey) {
|
|
|
32
32
|
};
|
|
33
33
|
}
|
|
34
34
|
function ItemTable(props, ref) {
|
|
35
|
-
const { data, columns, rowKey = "id", getRowKey, isLoading = false, loadingIndicator = "overlay", selectionMode, bulkActions, rowLink, onRowAction, rowMenu, rowContextMenu = false, onRowMenuAction, rowMenuTriggerProps, bulkBarPlacement = "floating", bulkBarStyles, selectedKeys: selectedKeysProp, defaultSelectedKeys, onSelectionChange, selectAllMode = "page", isRowSelectable, selectionTooltip, disabledKeys, skeletonRowCount = 6, emptyLabel, noResultsLabel, error, isFiltered, toolbar, isSearchable = false, searchMode = "client", searchPlaceholder, searchValue: searchValueProp, defaultSearchValue, onSearchChange, searchDelay = 500, searchFilter, filters, actions, onRefresh, paginationMode = "client", pageSize: pageSizeProp, defaultPageSize = 50, autoHidePagination = true, onLoadMore, hasMore, isLoadingMore, loadMoreMargin, storageKey, persist, isReorderable = false, onReorder, dropOnRow, getItemDragInfo, isResizable = false, columnWidths: columnWidthsProp, defaultColumnWidths, onColumnResize, onPageSizeChange, pageSizeOptions = [
|
|
35
|
+
const { data, columns, rowKey = "id", getRowKey, isLoading = false, loadingIndicator = "overlay", selectionMode, bulkActions, rowLink, onRowAction, rowMenu, rowContextMenu = false, onRowMenuAction, rowMenuTriggerProps, bulkBarPlacement = "floating", bulkBarStyles, selectedKeys: selectedKeysProp, defaultSelectedKeys, onSelectionChange, selectAllMode = "page", isRowSelectable, selectionTooltip, disabledKeys, skeletonRowCount = 6, emptyLabel, noResultsLabel, error, isFiltered, toolbar, isSearchable = false, searchMode = "client", searchPlaceholder, searchValue: searchValueProp, defaultSearchValue, onSearchChange, searchDelay = 500, searchFilter, filters, actions, onRefresh, paginationMode = "client", pageSize: pageSizeProp, defaultPageSize = 50, autoHidePagination = true, onLoadMore, hasMore, isLoadingMore, loadMoreMargin, storageKey, persist, isReorderable = false, onReorder, dropOnRow, getItemDragInfo, isResizable = false, columnWidths: columnWidthsProp, defaultColumnWidths, onColumnResize, columnContextMenu, onColumnMenuAction, columnMenuTriggerProps, columnMenuProps, onPageSizeChange, pageSizeOptions = [
|
|
36
36
|
10,
|
|
37
37
|
20,
|
|
38
38
|
50,
|
|
@@ -58,7 +58,7 @@ function ItemTable(props, ref) {
|
|
|
58
58
|
filter: searchFilter
|
|
59
59
|
});
|
|
60
60
|
const storage = useTableStorage(storageKey, persist);
|
|
61
|
-
const { sort, sortedRows, toggleSort, mode: resolvedSortMode } = useTableSort({
|
|
61
|
+
const { sort, sortedRows, toggleSort, setColumnSort, mode: resolvedSortMode } = useTableSort({
|
|
62
62
|
columns,
|
|
63
63
|
rows: searchedRows,
|
|
64
64
|
mode: sortMode,
|
|
@@ -273,6 +273,11 @@ function ItemTable(props, ref) {
|
|
|
273
273
|
sortMode: resolvedSortMode,
|
|
274
274
|
sort,
|
|
275
275
|
onColumnSort: toggleSort,
|
|
276
|
+
onColumnSortChange: setColumnSort,
|
|
277
|
+
columnContextMenu,
|
|
278
|
+
onColumnMenuAction,
|
|
279
|
+
columnMenuTriggerProps,
|
|
280
|
+
columnMenuProps,
|
|
276
281
|
getRowProps,
|
|
277
282
|
ariaLabel,
|
|
278
283
|
styles: rootStyles,
|