@cube-dev/ui-kit 0.0.0-canary-e76eb3e → 0.0.0-canary-01fea9d
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 +44 -42
- package/dist/components/actions/use-context-menu.js.map +1 -1
- package/dist/components/content/ActiveZone/ActiveZone.js +1 -1
- package/dist/components/content/Alert/Alert.js +1 -1
- package/dist/components/content/Alert/use-alert.js +1 -1
- package/dist/components/content/Avatar/Avatar.js +1 -1
- package/dist/components/content/Badge/Badge.js +1 -1
- package/dist/components/content/Card/Card.js +1 -1
- package/dist/components/content/Content.js +1 -1
- package/dist/components/content/CopyPasteBlock/CopyPasteBlock.js +1 -1
- package/dist/components/content/CopySnippet/CopySnippet.js +1 -1
- package/dist/components/content/Disclosure/Disclosure.js +1 -1
- package/dist/components/content/Divider.js +1 -1
- package/dist/components/content/Footer.js +1 -1
- package/dist/components/content/Header.js +1 -1
- package/dist/components/content/HotKeys/HotKeys.js +1 -1
- package/dist/components/content/InfoBadge/InfoBadge.js +1 -1
- package/dist/components/content/InlineInput/InlineInput.js +1 -1
- package/dist/components/content/Item/Item.js +1 -1
- package/dist/components/content/ItemBadge/ItemBadge.js +1 -1
- package/dist/components/content/ItemCard/ItemCard.js +1 -1
- package/dist/components/content/Layout/GridLayout.js +1 -1
- package/dist/components/content/Layout/Layout.js +1 -1
- package/dist/components/content/Layout/LayoutBlock.js +1 -1
- package/dist/components/content/Layout/LayoutCenter.js +1 -1
- package/dist/components/content/Layout/LayoutContainer.js +1 -1
- package/dist/components/content/Layout/LayoutContent.js +1 -1
- package/dist/components/content/Layout/LayoutContext.js +1 -1
- package/dist/components/content/Layout/LayoutFlex.js +1 -1
- package/dist/components/content/Layout/LayoutFooter.js +1 -1
- package/dist/components/content/Layout/LayoutGrid.js +1 -1
- package/dist/components/content/Layout/LayoutHeader.js +1 -1
- package/dist/components/content/Layout/LayoutPane.js +1 -1
- package/dist/components/content/Layout/LayoutPanel.js +1 -1
- package/dist/components/content/Layout/LayoutPanelHeader.js +1 -1
- package/dist/components/content/Layout/LayoutToolbar.js +1 -1
- package/dist/components/content/Layout/hooks/useTinyScrollbar.js +1 -1
- package/dist/components/content/Layout/index.js +1 -1
- package/dist/components/content/Layout/utils.js +1 -1
- package/dist/components/content/Paragraph.js +1 -1
- package/dist/components/content/Placeholder/Placeholder.js +1 -1
- package/dist/components/content/PrismCode/PrismCode.js +1 -1
- package/dist/components/content/PrismCode/prismSetup.js +1 -1
- package/dist/components/content/PrismDiffCode/PrismDiffCode.js +1 -1
- package/dist/components/content/Result/Result.js +1 -1
- package/dist/components/content/Skeleton/Skeleton.js +1 -1
- package/dist/components/content/Tag/Tag.js +2 -2
- package/dist/components/content/Tag/Tag.js.map +1 -1
- package/dist/components/content/Text.d.ts +14 -14
- package/dist/components/content/Text.js +1 -1
- package/dist/components/content/TextItem/TextItem.js +1 -1
- package/dist/components/content/Title.js +1 -1
- package/dist/components/content/Tree/Tree.js +1 -1
- package/dist/components/content/Tree/TreeNode.js +1 -1
- package/dist/components/content/Tree/styled.js +1 -1
- package/dist/components/content/Tree/tree-index.js +1 -1
- package/dist/components/content/Tree/use-checkbox-tree.js +1 -1
- package/dist/components/content/Tree/use-load-data.js +1 -1
- package/dist/components/content/highlightText.js +1 -1
- package/dist/components/content/use-auto-tooltip.js +1 -1
- package/dist/components/fields/Checkbox/Checkbox.js +1 -1
- package/dist/components/fields/Checkbox/CheckboxGroup.js +1 -1
- package/dist/components/fields/Checkbox/context.js +1 -1
- package/dist/components/fields/ColorInput/ColorInput.d.ts +67 -0
- package/dist/components/fields/ColorInput/ColorInput.js +228 -0
- package/dist/components/fields/ColorInput/ColorInput.js.map +1 -0
- package/dist/components/fields/ColorInput/index.d.ts +2 -0
- package/dist/components/fields/ColorPicker/ColorPicker.d.ts +34 -37
- package/dist/components/fields/ColorPicker/ColorPicker.js +112 -184
- package/dist/components/fields/ColorPicker/ColorPicker.js.map +1 -1
- package/dist/components/fields/ColorPicker/index.d.ts +1 -3
- package/dist/components/fields/ColorSwatchGroup/ColorSwatchGroup.d.ts +50 -0
- package/dist/components/fields/ColorSwatchGroup/ColorSwatchGroup.js +251 -0
- package/dist/components/fields/ColorSwatchGroup/ColorSwatchGroup.js.map +1 -0
- package/dist/components/fields/ColorSwatchGroup/index.d.ts +2 -0
- package/dist/components/fields/ComboBox/ComboBox.js +1 -1
- package/dist/components/fields/CommandTextArea/CommandTextArea.js +1 -1
- package/dist/components/fields/CommandTextArea/caretPosition.js +1 -1
- package/dist/components/fields/CommandTextArea/useCaretAnchor.js +1 -1
- package/dist/components/fields/DatePicker/DateInput.js +1 -1
- package/dist/components/fields/DatePicker/DateInputBase.js +1 -1
- package/dist/components/fields/DatePicker/DatePicker.js +1 -1
- package/dist/components/fields/DatePicker/DatePickerButton.js +1 -1
- package/dist/components/fields/DatePicker/DatePickerElement.js +1 -1
- package/dist/components/fields/DatePicker/DatePickerInput.js +1 -1
- package/dist/components/fields/DatePicker/DatePickerSegment.js +1 -1
- package/dist/components/fields/DatePicker/DateRangePicker.js +1 -1
- package/dist/components/fields/DatePicker/DateRangeSeparatedPicker.js +1 -1
- package/dist/components/fields/DatePicker/MonthPicker.js +1 -1
- package/dist/components/fields/DatePicker/PeriodPicker.js +1 -1
- package/dist/components/fields/DatePicker/QuarterPicker.js +1 -1
- package/dist/components/fields/DatePicker/TimeInput.js +1 -1
- package/dist/components/fields/DatePicker/WeekPicker.js +1 -1
- package/dist/components/fields/DatePicker/YearPicker.js +1 -1
- package/dist/components/fields/DatePicker/parseDate.js +1 -1
- package/dist/components/fields/DatePicker/period.js +1 -1
- package/dist/components/fields/DatePicker/props.js +1 -1
- package/dist/components/fields/DatePicker/utils.js +1 -1
- package/dist/components/fields/FileInput/FileInput.js +1 -1
- package/dist/components/fields/FilterListBox/FilterListBox.js +1 -1
- package/dist/components/fields/FilterPicker/FilterPicker.js +1 -1
- package/dist/components/fields/Input/Input.js +2 -2
- package/dist/components/fields/ListBox/DraggableListBox.js +1 -1
- package/dist/components/fields/ListBox/ListBox.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.d.ts +2 -2
- package/dist/components/fields/RadioGroup/Radio.js +4 -4
- package/dist/components/fields/RadioGroup/Radio.js.map +1 -1
- package/dist/components/fields/RadioGroup/RadioGroup.js +1 -1
- package/dist/components/fields/RadioGroup/context.js +1 -1
- package/dist/components/fields/SearchComboBox/SearchComboBox.js +1 -1
- package/dist/components/fields/SearchInput/SearchInput.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/{ColorPicker/ColorPickerPanel.js → color/ColorPanel.js} +13 -11
- package/dist/components/fields/color/ColorPanel.js.map +1 -0
- package/dist/components/fields/color/ColorSwatch.d.ts +22 -0
- package/dist/components/fields/color/ColorSwatch.js +58 -0
- package/dist/components/fields/color/ColorSwatch.js.map +1 -0
- package/dist/components/fields/{ColorPicker → color}/channels.d.ts +1 -1
- package/dist/components/fields/{ColorPicker → color}/channels.js +2 -2
- package/dist/components/fields/color/channels.js.map +1 -0
- package/dist/components/fields/color/color.d.ts +21 -0
- package/dist/components/fields/{ColorPicker → color}/color.js +2 -2
- package/dist/components/fields/color/color.js.map +1 -0
- package/dist/components/fields/color/context.js +20 -0
- package/dist/components/fields/color/context.js.map +1 -0
- package/dist/components/fields/color/index.d.ts +4 -0
- package/dist/components/fields/index.d.ts +9 -3
- 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.js +1 -1
- package/dist/components/layout/Space.js +1 -1
- package/dist/components/layout/Suffix.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/navigation/index.d.ts +1 -5
- 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 +8 -24
- package/dist/components/shared/DraggableCollection.js.map +1 -1
- package/dist/components/shared/InvalidIcon.js +1 -1
- package/dist/components/shared/ValidIcon.js +1 -1
- package/dist/components/status/LoadingAnimation/LoadingAnimation.js +1 -1
- package/dist/components/status/Spin/Cube.js +1 -1
- package/dist/components/status/Spin/InternalSpinner.js +1 -1
- package/dist/components/status/Spin/Spin.js +1 -1
- package/dist/components/status/Spin/SpinsContainer.js +1 -1
- package/dist/data/item-themes.js +1 -1
- package/dist/data/themes.js +1 -1
- package/dist/eslint-plugin/defaults.generated.js +1 -199
- 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 +1 -35
- package/dist/i18n/locales/en-US/uikit.js +1 -35
- package/dist/i18n/locales/en-US/uikit.json.d.ts +1 -40
- package/dist/i18n/locales/es-ES/uikit.js +1 -35
- package/dist/i18n/locales/es-MX/uikit.js +1 -35
- package/dist/i18n/locales/fr-FR/uikit.js +1 -35
- package/dist/i18n/locales/it-IT/uikit.js +1 -35
- package/dist/i18n/locales/ja-JP/uikit.js +1 -35
- package/dist/i18n/locales/nb-NO/uikit.js +1 -35
- package/dist/i18n/locales/pt-BR/uikit.js +1 -35
- package/dist/i18n/locales/pt-PT/uikit.js +1 -35
- package/dist/i18n/locales/sv-SE/uikit.js +1 -35
- package/dist/i18n/locales/vi-VN/uikit.js +1 -35
- 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 +15 -22
- package/dist/index.js +9 -10
- package/dist/index.js.map +1 -1
- package/dist/provider.js +1 -1
- package/dist/providers/TrackingProvider.js +1 -1
- package/dist/providers/navigationAdapter.default.js +1 -1
- package/dist/tokens/base.js +1 -1
- package/dist/tokens/colors.js +1 -1
- package/dist/tokens/index.js +1 -1
- package/dist/tokens/layout.js +1 -1
- package/dist/tokens/lazy-styles.js +1 -1
- package/dist/tokens/palette-config.js +1 -1
- package/dist/tokens/palette.js +1 -1
- package/dist/tokens/shadows.js +1 -1
- package/dist/tokens/sizes.js +1 -1
- package/dist/tokens/spacing.js +1 -1
- package/dist/tokens/typography.d.ts +1 -1
- package/dist/tokens/typography.js +2 -11
- package/dist/tokens/typography.js.map +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/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/fields/ColorInput.md +272 -0
- package/docs/components/fields/ColorPicker.md +80 -146
- package/docs/components/fields/ColorSwatchGroup.md +206 -0
- package/package.json +3 -8
- package/dist/components/data/DataTable/DataTable.d.ts +0 -13
- package/dist/components/data/DataTable/DataTable.js +0 -242
- package/dist/components/data/DataTable/DataTable.js.map +0 -1
- package/dist/components/data/DataTable/index.d.ts +0 -3
- package/dist/components/data/DataTable/types.d.ts +0 -140
- package/dist/components/data/ItemTable/ItemTable.d.ts +0 -19
- package/dist/components/data/ItemTable/ItemTable.js +0 -347
- package/dist/components/data/ItemTable/ItemTable.js.map +0 -1
- package/dist/components/data/ItemTable/ItemTableBulkBar.d.ts +0 -23
- package/dist/components/data/ItemTable/ItemTableBulkBar.js +0 -131
- package/dist/components/data/ItemTable/ItemTableBulkBar.js.map +0 -1
- package/dist/components/data/ItemTable/ItemTableDragPreview.js +0 -46
- package/dist/components/data/ItemTable/ItemTableDragPreview.js.map +0 -1
- package/dist/components/data/ItemTable/ItemTableFooter.js +0 -79
- package/dist/components/data/ItemTable/ItemTableFooter.js.map +0 -1
- package/dist/components/data/ItemTable/ItemTableToolbar.d.ts +0 -34
- package/dist/components/data/ItemTable/ItemTableToolbar.js +0 -91
- package/dist/components/data/ItemTable/ItemTableToolbar.js.map +0 -1
- package/dist/components/data/ItemTable/index.d.ts +0 -4
- package/dist/components/data/ItemTable/types.d.ts +0 -322
- package/dist/components/data/TableBase/ColumnResizer.js +0 -70
- package/dist/components/data/TableBase/ColumnResizer.js.map +0 -1
- package/dist/components/data/TableBase/RowCollection.js +0 -99
- package/dist/components/data/TableBase/RowCollection.js.map +0 -1
- package/dist/components/data/TableBase/TableRow.js +0 -89
- package/dist/components/data/TableBase/TableRow.js.map +0 -1
- package/dist/components/data/TableBase/TableView.d.ts +0 -22
- package/dist/components/data/TableBase/TableView.js +0 -857
- package/dist/components/data/TableBase/TableView.js.map +0 -1
- package/dist/components/data/TableBase/index.d.ts +0 -5
- package/dist/components/data/TableBase/row-menu.js +0 -40
- package/dist/components/data/TableBase/row-menu.js.map +0 -1
- package/dist/components/data/TableBase/styled.d.ts +0 -5
- package/dist/components/data/TableBase/styled.js +0 -504
- package/dist/components/data/TableBase/styled.js.map +0 -1
- package/dist/components/data/TableBase/types.d.ts +0 -161
- package/dist/components/data/TableBase/use-cell-selection.d.ts +0 -3
- package/dist/components/data/TableBase/use-cell-selection.js +0 -0
- package/dist/components/data/TableBase/use-cell-selection.js.map +0 -1
- package/dist/components/data/TableBase/use-container-width.js +0 -35
- package/dist/components/data/TableBase/use-container-width.js.map +0 -1
- package/dist/components/data/TableBase/use-scrollability.js +0 -49
- package/dist/components/data/TableBase/use-scrollability.js.map +0 -1
- package/dist/components/data/TableBase/use-table-columns.d.ts +0 -2
- package/dist/components/data/TableBase/use-table-columns.js +0 -166
- package/dist/components/data/TableBase/use-table-columns.js.map +0 -1
- package/dist/components/data/TableBase/use-table-search.js +0 -50
- package/dist/components/data/TableBase/use-table-search.js.map +0 -1
- package/dist/components/data/TableBase/use-table-selection.d.ts +0 -4
- package/dist/components/data/TableBase/use-table-selection.js +0 -233
- package/dist/components/data/TableBase/use-table-selection.js.map +0 -1
- package/dist/components/data/TableBase/use-table-sort.js +0 -91
- package/dist/components/data/TableBase/use-table-sort.js.map +0 -1
- package/dist/components/data/TableBase/use-table-sorts.js +0 -97
- package/dist/components/data/TableBase/use-table-sorts.js.map +0 -1
- package/dist/components/data/TableBase/use-table-storage.d.ts +0 -8
- package/dist/components/data/TableBase/use-table-storage.js +0 -58
- package/dist/components/data/TableBase/use-table-storage.js.map +0 -1
- package/dist/components/data/index.d.ts +0 -10
- package/dist/components/fields/ColorPicker/ColorPickerPanel.js.map +0 -1
- package/dist/components/fields/ColorPicker/channels.js.map +0 -1
- package/dist/components/fields/ColorPicker/color.d.ts +0 -15
- package/dist/components/fields/ColorPicker/color.js.map +0 -1
- package/dist/components/navigation/Pagination/Pagination.d.ts +0 -9
- package/dist/components/navigation/Pagination/Pagination.js +0 -258
- package/dist/components/navigation/Pagination/Pagination.js.map +0 -1
- package/dist/components/navigation/Pagination/index.d.ts +0 -4
- package/dist/components/navigation/Pagination/types.d.ts +0 -81
- package/dist/components/navigation/Pagination/use-pagination.d.ts +0 -52
- package/dist/components/navigation/Pagination/use-pagination.js +0 -83
- package/dist/components/navigation/Pagination/use-pagination.js.map +0 -1
- package/docs/components/data/DataTable.md +0 -286
- package/docs/components/data/ItemTable.md +0 -970
- package/docs/components/navigation/Pagination.md +0 -245
|
@@ -1,857 +0,0 @@
|
|
|
1
|
-
/** @license MIT | @cube-dev/ui-kit v0.0.0-canary-e76eb3e | Cube Dev Team */
|
|
2
|
-
import { useEvent } from "../../../_internal/hooks/use-event.js";
|
|
3
|
-
import { TooltipProvider } from "../../overlays/Tooltip/TooltipProvider.js";
|
|
4
|
-
import { TextItem } from "../../content/TextItem/TextItem.js";
|
|
5
|
-
import { ItemAction } from "../../actions/ItemAction/ItemAction.js";
|
|
6
|
-
import { useI18n } from "../../../i18n/useI18n.js";
|
|
7
|
-
import { UpIcon } from "../../../icons/UpIcon.js";
|
|
8
|
-
import { MoreIcon } from "../../../icons/MoreIcon.js";
|
|
9
|
-
import { _MenuTrigger } from "../../actions/Menu/MenuTrigger.js";
|
|
10
|
-
import { __Menu } from "../../actions/Menu/Menu.js";
|
|
11
|
-
import { Action } from "../../actions/Action/Action.js";
|
|
12
|
-
import { useContextMenu } from "../../actions/use-context-menu.js";
|
|
13
|
-
import { useToast } from "../../overlays/Toast/useToast.js";
|
|
14
|
-
import { __Checkbox } from "../../fields/Checkbox/Checkbox.js";
|
|
15
|
-
import { LoadingAnimation } from "../../status/LoadingAnimation/LoadingAnimation.js";
|
|
16
|
-
import { Placeholder } from "../../content/Placeholder/Placeholder.js";
|
|
17
|
-
import { Skeleton } from "../../content/Skeleton/Skeleton.js";
|
|
18
|
-
import { ColumnResizer } from "./ColumnResizer.js";
|
|
19
|
-
import { ROW_MENU_COLUMN_KEY, isMenuEmpty, normalizeMenuAction } from "./row-menu.js";
|
|
20
|
-
import { TableElement, TableHeaderItem } from "./styled.js";
|
|
21
|
-
import { TableRow, TableRowDropIndicator } from "./TableRow.js";
|
|
22
|
-
import { useScrollability } from "./use-scrollability.js";
|
|
23
|
-
import { getColumnText, getColumnValue } from "./use-table-columns.js";
|
|
24
|
-
import { ROW_NUMBER_COLUMN_KEY, SELECTION_COLUMN_KEY } from "./use-table-selection.js";
|
|
25
|
-
import { Fragment, useCallback, useEffect, useMemo, useRef, useState } from "react";
|
|
26
|
-
import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
|
|
27
|
-
import { useVirtualizer } from "@tanstack/react-virtual";
|
|
28
|
-
|
|
29
|
-
//#region src/components/data/TableBase/TableView.tsx
|
|
30
|
-
/**
|
|
31
|
-
* The same block as an HTML table, so a spreadsheet keeps the cell boundaries.
|
|
32
|
-
*
|
|
33
|
-
* Pasting `text/plain` TSV works, but Excel and Sheets then re-guess the types
|
|
34
|
-
* of every field; the HTML flavour is what makes a value that looks like a date
|
|
35
|
-
* stay the text it was on screen.
|
|
36
|
-
*/
|
|
37
|
-
function toClipboardHtml(tsv) {
|
|
38
|
-
return `<table>${tsv.split("\n").map((line) => `<tr>${line.split(" ").map((cell) => `<td>${escapeHtml(cell)}</td>`).join("")}</tr>`).join("")}</table>`;
|
|
39
|
-
}
|
|
40
|
-
function escapeHtml(value) {
|
|
41
|
-
return value.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">");
|
|
42
|
-
}
|
|
43
|
-
const ARIA_SORT = {
|
|
44
|
-
asc: "ascending",
|
|
45
|
-
desc: "descending"
|
|
46
|
-
};
|
|
47
|
-
/**
|
|
48
|
-
* Content height per size step, mirroring `$row-height` in `styled.ts`. Only the
|
|
49
|
-
* initial estimate — every rendered row is measured, so a wrong guess costs a
|
|
50
|
-
* scrollbar adjustment, not a layout bug. The `+ 1` is the row separator.
|
|
51
|
-
*/
|
|
52
|
-
/** Enough to read as "more is coming" without pretending to know how much. */
|
|
53
|
-
const LOAD_MORE_SKELETON_ROWS = 3;
|
|
54
|
-
const ESTIMATED_ROW_HEIGHT = {
|
|
55
|
-
xsmall: 28,
|
|
56
|
-
small: 32,
|
|
57
|
-
medium: 40,
|
|
58
|
-
large: 48,
|
|
59
|
-
xlarge: 56
|
|
60
|
-
};
|
|
61
|
-
function pinStyle(column) {
|
|
62
|
-
if (column.pinOffset == null) return void 0;
|
|
63
|
-
return { ["--pin-offset"]: `${column.pinOffset}px` };
|
|
64
|
-
}
|
|
65
|
-
/**
|
|
66
|
-
* The one place table DOM exists. Both `ItemTable` and `DataTable` resolve their
|
|
67
|
-
* props into the shape above and hand it here, so the markup, the ARIA
|
|
68
|
-
* bookkeeping and the tasty sub-element contract have a single implementation.
|
|
69
|
-
*/
|
|
70
|
-
function TableView(props) {
|
|
71
|
-
const { qa, rows, getRowKey, layout, onScrollerRef, rootRef, size = "medium", shape = "plain", rowHeight, headerHeight, isHeaderHidden = false, isStriped = false, hasColumnDividers, isHeaderSticky = true, isVirtualized = "auto", virtualizeThreshold = 50, overscan = 20, isLoading = false, loadingIndicator = "overlay", skeletonRowCount = 6, selection, selectionTooltip, overlay, rowMenu, rowContextMenu = false, onRowMenuAction, rowMenuTriggerProps, rowLink, onRowAction, onLoadMore, hasMore = false, isLoadingMore = false, loadMoreMargin = 200, pinnedTopRows, pinnedBottomRows, cellSelection, rowNumberOffset = 0, isReorderable = false, dragState, dropState, collectionProps, bodyRef, isResizable = false, onColumnResize, onColumnResizeEnd, emptyLabel, noResultsLabel, error, isFiltered = false, sortMode = "off", sort, sorts, onColumnSort, getRowProps, headerPreset, contentPreset, toolbar, footer, ariaLabel, styles, headerStyles, headerCellStyles, bodyStyles, rowStyles, cellStyles, mods } = props;
|
|
72
|
-
const { columns } = layout;
|
|
73
|
-
const columnCount = columns.length;
|
|
74
|
-
const { t } = useI18n();
|
|
75
|
-
const toast = useToast();
|
|
76
|
-
const [scrollerEl, setScrollerEl] = useState(null);
|
|
77
|
-
const scrollerRef = useRef(null);
|
|
78
|
-
const handleScrollerRef = useCallback((element) => {
|
|
79
|
-
scrollerRef.current = element;
|
|
80
|
-
setScrollerEl(element);
|
|
81
|
-
onScrollerRef(element);
|
|
82
|
-
}, [onScrollerRef]);
|
|
83
|
-
const headerRowCount = isHeaderHidden ? 0 : 1;
|
|
84
|
-
const mergedStyles = useMemo(() => ({
|
|
85
|
-
...styles,
|
|
86
|
-
...contentPreset ? { Table: { preset: contentPreset } } : null,
|
|
87
|
-
...headerStyles ? { HeadRow: headerStyles } : null,
|
|
88
|
-
...headerPreset || headerCellStyles ? { HeaderCell: {
|
|
89
|
-
...headerPreset ? { preset: headerPreset } : null,
|
|
90
|
-
...headerCellStyles
|
|
91
|
-
} } : null,
|
|
92
|
-
...bodyStyles ? { Body: bodyStyles } : null,
|
|
93
|
-
...rowStyles ? { Row: rowStyles } : null,
|
|
94
|
-
...cellStyles ? { Cell: cellStyles } : null,
|
|
95
|
-
...rowHeight != null ? { "$row-height": `${rowHeight}px` } : null,
|
|
96
|
-
...headerHeight != null ? { "$header-height": `${headerHeight}px` } : null
|
|
97
|
-
}), [
|
|
98
|
-
styles,
|
|
99
|
-
headerStyles,
|
|
100
|
-
headerCellStyles,
|
|
101
|
-
headerPreset,
|
|
102
|
-
contentPreset,
|
|
103
|
-
bodyStyles,
|
|
104
|
-
rowStyles,
|
|
105
|
-
cellStyles,
|
|
106
|
-
rowHeight,
|
|
107
|
-
headerHeight
|
|
108
|
-
]);
|
|
109
|
-
if (columnCount === 0 && isLoading) return /* @__PURE__ */ jsxs(TableElement, {
|
|
110
|
-
ref: rootRef,
|
|
111
|
-
qa: qa || "Table",
|
|
112
|
-
styles: mergedStyles,
|
|
113
|
-
mods: {
|
|
114
|
-
size,
|
|
115
|
-
shape,
|
|
116
|
-
...mods
|
|
117
|
-
},
|
|
118
|
-
children: [toolbar, /* @__PURE__ */ jsx("div", {
|
|
119
|
-
"data-element": "Scroller",
|
|
120
|
-
ref: handleScrollerRef,
|
|
121
|
-
children: /* @__PURE__ */ jsx(Skeleton, { layout: "table" })
|
|
122
|
-
})]
|
|
123
|
-
});
|
|
124
|
-
/**
|
|
125
|
-
* Whether a cell is inside the current range.
|
|
126
|
-
*
|
|
127
|
-
* Pinned rows take part: they sit in the range's row order at the position
|
|
128
|
-
* they occupy on screen, so a selection down a column of figures reaches its
|
|
129
|
-
* total instead of leaving it to be copied separately. (ag-grid excludes
|
|
130
|
-
* pinned rows outright; this is a deliberate departure.)
|
|
131
|
-
*/
|
|
132
|
-
function isCellSelected(rowKey, columnKey) {
|
|
133
|
-
if (!cellSelection?.isEnabled) return false;
|
|
134
|
-
return cellSelection.isSelected(rowKey, columnKey);
|
|
135
|
-
}
|
|
136
|
-
/**
|
|
137
|
-
* Press and drag for the range.
|
|
138
|
-
*
|
|
139
|
-
* `pointerdown` rather than `click`: the range has to start before the drag
|
|
140
|
-
* does, and a click only lands after the button comes back up — by which time
|
|
141
|
-
* the gesture is over. `pointerenter` grows it while the button is held, which
|
|
142
|
-
* is the same shape ag-grid's `onCellMouseOver` gives the Cloud grids.
|
|
143
|
-
*/
|
|
144
|
-
function cellSelectionProps(rowKey, columnKey, pinnedEdge) {
|
|
145
|
-
if (!cellSelection?.canSelectCell(rowKey, columnKey)) return void 0;
|
|
146
|
-
return {
|
|
147
|
-
onPointerDown: (event) => {
|
|
148
|
-
if (event.button !== 0) return;
|
|
149
|
-
if (event.shiftKey) {
|
|
150
|
-
event.preventDefault();
|
|
151
|
-
cellSelection.extendTo(rowKey, columnKey);
|
|
152
|
-
} else cellSelection.select(rowKey, columnKey);
|
|
153
|
-
scrollerRef.current?.focus({ preventScroll: true });
|
|
154
|
-
cellSelection.isDraggingRef.current = true;
|
|
155
|
-
setIsRangeDragging(true);
|
|
156
|
-
},
|
|
157
|
-
onPointerEnter: () => {
|
|
158
|
-
if (!cellSelection.isDraggingRef.current) return;
|
|
159
|
-
if (pinnedEdge) return;
|
|
160
|
-
cellSelection.extendTo(rowKey, columnKey);
|
|
161
|
-
}
|
|
162
|
-
};
|
|
163
|
-
}
|
|
164
|
-
/**
|
|
165
|
-
* Marks the trailing column.
|
|
166
|
-
*
|
|
167
|
-
* Two things hang off it. Its resize handle tucks fully inside rather than
|
|
168
|
-
* straddling a boundary that is not there — left hanging it puts half its
|
|
169
|
-
* width past the table, and the scroller gains a few pixels of horizontal
|
|
170
|
-
* scroll onto blank space. And it draws no vertical rule: that rule would
|
|
171
|
-
* land flush against the frame and read as a doubled edge.
|
|
172
|
-
*/
|
|
173
|
-
function lastColumnFlag(column) {
|
|
174
|
-
return column.index === columns.length - 1 ? "" : void 0;
|
|
175
|
-
}
|
|
176
|
-
/**
|
|
177
|
-
* Which frame corner, if any, this cell sits in.
|
|
178
|
-
*
|
|
179
|
-
* Only the two bottom ones, and only when the card's rounded edge is what the
|
|
180
|
-
* row actually meets — a footer below it means the row ends against a straight
|
|
181
|
-
* line instead. Without this a selected cell in that row has its ring sliced
|
|
182
|
-
* off at 45° by the frame's radius, which reads as a rendering fault rather
|
|
183
|
-
* than as a corner.
|
|
184
|
-
*
|
|
185
|
-
* Decided here rather than in CSS: the renderer already knows about the
|
|
186
|
-
* footer, the shape and the pinned rows, and expressing
|
|
187
|
-
* `card × no-footer × visually-last-row × outer-column` as a state map is how
|
|
188
|
-
* a border map turns into a combinatorial one.
|
|
189
|
-
*/
|
|
190
|
-
function bottomCornerFlag(column, rowIndex, isLastRow, pinnedEdge) {
|
|
191
|
-
if (shape !== "card" || footer != null) return void 0;
|
|
192
|
-
const pinnedBottomCount = pinnedBottomRows?.length ?? 0;
|
|
193
|
-
if (!(pinnedEdge === "bottom" ? rowIndex === pinnedBottomCount - 1 : pinnedEdge == null && isLastRow && pinnedBottomCount === 0)) return void 0;
|
|
194
|
-
if (column.index === 0) return "start";
|
|
195
|
-
if (column.index === columns.length - 1) return "end";
|
|
196
|
-
}
|
|
197
|
-
function renderStateRow(content) {
|
|
198
|
-
return /* @__PURE__ */ jsx("tr", {
|
|
199
|
-
"data-element": "Row",
|
|
200
|
-
role: "row",
|
|
201
|
-
"aria-rowindex": headerRowCount + 1,
|
|
202
|
-
children: /* @__PURE__ */ jsx("td", {
|
|
203
|
-
"data-element": "StateCell",
|
|
204
|
-
"data-state": "",
|
|
205
|
-
role: "gridcell",
|
|
206
|
-
colSpan: Math.max(columnCount, 1),
|
|
207
|
-
"aria-colindex": 1,
|
|
208
|
-
children: /* @__PURE__ */ jsx("div", {
|
|
209
|
-
"data-element": "StateContent",
|
|
210
|
-
children: content
|
|
211
|
-
})
|
|
212
|
-
})
|
|
213
|
-
});
|
|
214
|
-
}
|
|
215
|
-
function renderSkeletonRows(count = skeletonRowCount, keyPrefix = "skeleton") {
|
|
216
|
-
return Array.from({ length: count }, (_, rowIndex) => /* @__PURE__ */ jsx("tr", {
|
|
217
|
-
"data-element": "Row",
|
|
218
|
-
"data-placeholder": "",
|
|
219
|
-
role: "row",
|
|
220
|
-
"aria-rowindex": headerRowCount + rowIndex + 1,
|
|
221
|
-
"aria-busy": "true",
|
|
222
|
-
children: columns.map((column) => /* @__PURE__ */ jsx("td", {
|
|
223
|
-
"data-element": "Cell",
|
|
224
|
-
"data-pin": column.pin,
|
|
225
|
-
"data-pin-edge": column.isPinEdge ? "" : void 0,
|
|
226
|
-
"data-align": column.align,
|
|
227
|
-
role: "gridcell",
|
|
228
|
-
"aria-colindex": column.ariaColIndex,
|
|
229
|
-
style: pinStyle(column),
|
|
230
|
-
children: /* @__PURE__ */ jsx(Placeholder, { size: "2x" })
|
|
231
|
-
}, column.key))
|
|
232
|
-
}, `${keyPrefix}-${rowIndex}`));
|
|
233
|
-
}
|
|
234
|
-
function renderSelectionHeaderCell(column) {
|
|
235
|
-
return /* @__PURE__ */ jsx("th", {
|
|
236
|
-
"data-element": "HeaderCell",
|
|
237
|
-
"data-key": column.key,
|
|
238
|
-
"data-kind": "selection",
|
|
239
|
-
"data-pin": column.pin,
|
|
240
|
-
"data-pin-edge": column.isPinEdge ? "" : void 0,
|
|
241
|
-
"data-last-column": lastColumnFlag(column),
|
|
242
|
-
role: "columnheader",
|
|
243
|
-
scope: "col",
|
|
244
|
-
tabIndex: -1,
|
|
245
|
-
"aria-colindex": column.ariaColIndex,
|
|
246
|
-
style: pinStyle(column),
|
|
247
|
-
children: selection && selection.selectionMode === "multiple" ? /* @__PURE__ */ jsx("div", {
|
|
248
|
-
"data-element": "SelectionBox",
|
|
249
|
-
children: /* @__PURE__ */ jsx(__Checkbox, {
|
|
250
|
-
"aria-label": selection.selectAllState === "all" ? t("itemTable.deselectAll", "Deselect all") : t("itemTable.selectAll", "Select all"),
|
|
251
|
-
isSelected: selection.selectAllState === "all",
|
|
252
|
-
isIndeterminate: selection.selectAllState === "some",
|
|
253
|
-
onChange: selection.toggleSelectAll
|
|
254
|
-
})
|
|
255
|
-
}) : null
|
|
256
|
-
}, column.key);
|
|
257
|
-
}
|
|
258
|
-
function renderSelectionCell(column, row, rowIndex, rowKey, isLastRow, pinnedEdge) {
|
|
259
|
-
const canSelect = selection.canSelect(rowKey);
|
|
260
|
-
const tooltip = typeof selectionTooltip === "function" ? selectionTooltip(row) : selectionTooltip;
|
|
261
|
-
const checkbox = /* @__PURE__ */ jsx(__Checkbox, {
|
|
262
|
-
"aria-label": t("itemTable.selectRow", "Select row"),
|
|
263
|
-
isSelected: selection.isSelected(rowKey),
|
|
264
|
-
isDisabled: !canSelect,
|
|
265
|
-
onChange: () => selection.toggleRow(rowKey)
|
|
266
|
-
});
|
|
267
|
-
return /* @__PURE__ */ jsx("td", {
|
|
268
|
-
"data-element": "Cell",
|
|
269
|
-
"data-key": column.key,
|
|
270
|
-
"data-kind": "selection",
|
|
271
|
-
"data-pin": column.pin,
|
|
272
|
-
"data-pin-edge": column.isPinEdge ? "" : void 0,
|
|
273
|
-
"data-last-row": isLastRow ? "" : void 0,
|
|
274
|
-
"data-pinned": pinnedEdge,
|
|
275
|
-
"data-last-column": lastColumnFlag(column),
|
|
276
|
-
"data-corner": bottomCornerFlag(column, rowIndex, isLastRow, pinnedEdge),
|
|
277
|
-
role: "gridcell",
|
|
278
|
-
"aria-colindex": column.ariaColIndex,
|
|
279
|
-
style: pinStyle(column),
|
|
280
|
-
onClickCapture: selection.captureShift,
|
|
281
|
-
onKeyDownCapture: selection.captureShift,
|
|
282
|
-
children: /* @__PURE__ */ jsx("div", {
|
|
283
|
-
"data-element": "SelectionBox",
|
|
284
|
-
children: !canSelect && tooltip ? /* @__PURE__ */ jsx(TooltipProvider, {
|
|
285
|
-
title: tooltip,
|
|
286
|
-
children: checkbox
|
|
287
|
-
}) : checkbox
|
|
288
|
-
})
|
|
289
|
-
}, column.key);
|
|
290
|
-
}
|
|
291
|
-
function renderRowMenuCell(column, row, rowIndex, rowKey, isLastRow, pinnedEdge) {
|
|
292
|
-
const items = resolveRowMenu(row, rowIndex, rowKey);
|
|
293
|
-
return /* @__PURE__ */ jsx("td", {
|
|
294
|
-
"data-element": "Cell",
|
|
295
|
-
"data-key": column.key,
|
|
296
|
-
"data-kind": "actions",
|
|
297
|
-
"data-pin": column.pin,
|
|
298
|
-
"data-pin-edge": column.isPinEdge ? "" : void 0,
|
|
299
|
-
"data-last-row": isLastRow ? "" : void 0,
|
|
300
|
-
"data-pinned": pinnedEdge,
|
|
301
|
-
"data-last-column": lastColumnFlag(column),
|
|
302
|
-
"data-corner": bottomCornerFlag(column, rowIndex, isLastRow, pinnedEdge),
|
|
303
|
-
role: "gridcell",
|
|
304
|
-
"aria-colindex": column.ariaColIndex,
|
|
305
|
-
style: pinStyle(column),
|
|
306
|
-
children: isMenuEmpty(items) ? null : /* @__PURE__ */ jsx("div", {
|
|
307
|
-
"data-element": "RowActions",
|
|
308
|
-
children: /* @__PURE__ */ jsxs(_MenuTrigger, { children: [/* @__PURE__ */ jsx(ItemAction, {
|
|
309
|
-
tabIndex: -1,
|
|
310
|
-
icon: /* @__PURE__ */ jsx(MoreIcon, {}),
|
|
311
|
-
"aria-label": t("itemTable.rowActions", "Row actions"),
|
|
312
|
-
...rowMenuTriggerProps
|
|
313
|
-
}), /* @__PURE__ */ jsx(__Menu, {
|
|
314
|
-
onAction: menuActionHandler(row, rowKey, false),
|
|
315
|
-
children: items
|
|
316
|
-
})] })
|
|
317
|
-
})
|
|
318
|
-
}, column.key);
|
|
319
|
-
}
|
|
320
|
-
function renderHeaderCell(column) {
|
|
321
|
-
if (column.key === SELECTION_COLUMN_KEY) return renderSelectionHeaderCell(column);
|
|
322
|
-
if (column.key === ROW_NUMBER_COLUMN_KEY) return /* @__PURE__ */ jsx("th", {
|
|
323
|
-
"data-element": "HeaderCell",
|
|
324
|
-
"data-key": column.key,
|
|
325
|
-
"data-kind": "row-number",
|
|
326
|
-
"data-last-column": lastColumnFlag(column),
|
|
327
|
-
role: "columnheader",
|
|
328
|
-
scope: "col",
|
|
329
|
-
tabIndex: -1,
|
|
330
|
-
"aria-colindex": column.ariaColIndex,
|
|
331
|
-
style: pinStyle(column)
|
|
332
|
-
}, column.key);
|
|
333
|
-
if (column.key === ROW_MENU_COLUMN_KEY) return /* @__PURE__ */ jsx("th", {
|
|
334
|
-
"data-element": "HeaderCell",
|
|
335
|
-
"data-key": column.key,
|
|
336
|
-
"data-kind": "actions",
|
|
337
|
-
"data-pin": column.pin,
|
|
338
|
-
"data-pin-edge": column.isPinEdge ? "" : void 0,
|
|
339
|
-
"data-last-column": lastColumnFlag(column),
|
|
340
|
-
role: "columnheader",
|
|
341
|
-
scope: "col",
|
|
342
|
-
tabIndex: -1,
|
|
343
|
-
"aria-colindex": column.ariaColIndex,
|
|
344
|
-
style: pinStyle(column)
|
|
345
|
-
}, column.key);
|
|
346
|
-
const header = column.header;
|
|
347
|
-
const activeSorts = sorts ?? (sort ? [sort] : []);
|
|
348
|
-
const sortIndex = activeSorts.findIndex((entry) => entry.columnKey === column.key);
|
|
349
|
-
const activeSort = sortIndex === -1 ? null : activeSorts[sortIndex];
|
|
350
|
-
const isSorted = activeSort != null;
|
|
351
|
-
const sortRank = activeSorts.length > 1 ? sortIndex + 1 : null;
|
|
352
|
-
const isSortable = sortMode !== "off" && !column.isStructural && column.isSortable === true;
|
|
353
|
-
const canResize = !column.isStructural && (column.isResizable ?? isResizable) && onColumnResize != null && onColumnResizeEnd != null;
|
|
354
|
-
const ctx = {
|
|
355
|
-
columnKey: column.key,
|
|
356
|
-
columnIndex: column.index,
|
|
357
|
-
sort: activeSort?.direction ?? null,
|
|
358
|
-
isSortable,
|
|
359
|
-
isResizing: false,
|
|
360
|
-
width: column.width
|
|
361
|
-
};
|
|
362
|
-
const sortIndicator = isSortable ? /* @__PURE__ */ jsx("div", {
|
|
363
|
-
"data-element": "SortIndicator",
|
|
364
|
-
"data-rank": sortRank ?? void 0,
|
|
365
|
-
"data-sorted": isSorted ? "" : void 0,
|
|
366
|
-
"data-dir": activeSort?.direction,
|
|
367
|
-
"aria-hidden": "true",
|
|
368
|
-
children: /* @__PURE__ */ jsx(UpIcon, {})
|
|
369
|
-
}) : null;
|
|
370
|
-
const hasCustomRightIcon = header?.rightIcon != null;
|
|
371
|
-
const rightIcon = hasCustomRightIcon ? header.rightIcon : sortIndicator;
|
|
372
|
-
const suffixContent = hasCustomRightIcon ? sortIndicator : null;
|
|
373
|
-
const suffix = header?.suffix != null || suffixContent ? /* @__PURE__ */ jsxs(Fragment$1, { children: [header?.suffix, suffixContent] }) : void 0;
|
|
374
|
-
const content = header?.render ? header.render(ctx) : column.title == null && !header ? null : /* @__PURE__ */ jsx(TableHeaderItem, {
|
|
375
|
-
icon: header?.icon,
|
|
376
|
-
rightIcon,
|
|
377
|
-
prefix: header?.prefix,
|
|
378
|
-
suffix,
|
|
379
|
-
description: header?.description,
|
|
380
|
-
descriptionPlacement: header?.descriptionPlacement,
|
|
381
|
-
tooltip: header?.tooltip ?? true,
|
|
382
|
-
theme: header?.theme,
|
|
383
|
-
actions: header?.actions,
|
|
384
|
-
autoHideActions: header?.autoHideActions ?? true,
|
|
385
|
-
styles: header?.styles,
|
|
386
|
-
children: column.title
|
|
387
|
-
});
|
|
388
|
-
return /* @__PURE__ */ jsxs("th", {
|
|
389
|
-
"data-element": "HeaderCell",
|
|
390
|
-
"data-key": column.key,
|
|
391
|
-
"data-pin": column.pin,
|
|
392
|
-
"data-pin-edge": column.isPinEdge ? "" : void 0,
|
|
393
|
-
"data-align": header?.align ?? column.align,
|
|
394
|
-
"data-sortable": isSortable ? "" : void 0,
|
|
395
|
-
"data-resizable": canResize ? "" : void 0,
|
|
396
|
-
"data-last-column": lastColumnFlag(column),
|
|
397
|
-
"data-sorted": isSorted ? "" : void 0,
|
|
398
|
-
role: "columnheader",
|
|
399
|
-
scope: "col",
|
|
400
|
-
tabIndex: isSortable ? 0 : -1,
|
|
401
|
-
"aria-colindex": column.ariaColIndex,
|
|
402
|
-
"aria-sort": activeSort ? ARIA_SORT[activeSort.direction] : void 0,
|
|
403
|
-
style: pinStyle(column),
|
|
404
|
-
onClick: isSortable ? () => onColumnSort?.(column.key) : void 0,
|
|
405
|
-
onKeyDown: isSortable ? (event) => {
|
|
406
|
-
if (event.key !== "Enter" && event.key !== " ") return;
|
|
407
|
-
event.preventDefault();
|
|
408
|
-
onColumnSort?.(column.key);
|
|
409
|
-
} : void 0,
|
|
410
|
-
children: [content, canResize ? /* @__PURE__ */ jsx(ColumnResizer, {
|
|
411
|
-
column,
|
|
412
|
-
label: t("itemTable.resizeColumn", "Resize column"),
|
|
413
|
-
onResize: onColumnResize,
|
|
414
|
-
onResizeEnd: onColumnResizeEnd
|
|
415
|
-
}) : null]
|
|
416
|
-
}, column.key);
|
|
417
|
-
}
|
|
418
|
-
function renderCell(column, row, rowIndex, rowKey, isLastRow, pinnedEdge) {
|
|
419
|
-
if (column.key === SELECTION_COLUMN_KEY) return renderSelectionCell(column, row, rowIndex, rowKey, isLastRow, pinnedEdge);
|
|
420
|
-
if (column.key === ROW_NUMBER_COLUMN_KEY) return /* @__PURE__ */ jsx("td", {
|
|
421
|
-
"data-element": "Cell",
|
|
422
|
-
"data-key": column.key,
|
|
423
|
-
"data-kind": "row-number",
|
|
424
|
-
"data-last-row": isLastRow ? "" : void 0,
|
|
425
|
-
"data-pinned": pinnedEdge,
|
|
426
|
-
"data-last-column": lastColumnFlag(column),
|
|
427
|
-
"data-corner": bottomCornerFlag(column, rowIndex, isLastRow, pinnedEdge),
|
|
428
|
-
role: "gridcell",
|
|
429
|
-
"aria-colindex": column.ariaColIndex,
|
|
430
|
-
style: pinStyle(column),
|
|
431
|
-
children: pinnedEdge ? null : rowNumberOffset + rowIndex + 1
|
|
432
|
-
}, column.key);
|
|
433
|
-
if (column.key === ROW_MENU_COLUMN_KEY) return renderRowMenuCell(column, row, rowIndex, rowKey, isLastRow, pinnedEdge);
|
|
434
|
-
const ctx = {
|
|
435
|
-
row,
|
|
436
|
-
rowKey,
|
|
437
|
-
rowIndex,
|
|
438
|
-
columnKey: column.key,
|
|
439
|
-
columnIndex: column.index,
|
|
440
|
-
section: "body",
|
|
441
|
-
isSelected: false,
|
|
442
|
-
isRowFocused: false,
|
|
443
|
-
isDropTarget: false
|
|
444
|
-
};
|
|
445
|
-
const value = column.isStructural ? void 0 : getColumnValue(column, row, rowIndex);
|
|
446
|
-
const rendered = column.render ? column.render(value, row, rowIndex, ctx) : column.isStructural ? null : getColumnText(column, row, rowIndex);
|
|
447
|
-
const isText = typeof rendered === "string" || typeof rendered === "number" || typeof rendered === "bigint";
|
|
448
|
-
const content = isText && !column.autoHeight ? /* @__PURE__ */ jsx(TextItem, { children: String(rendered) }) : isText ? String(rendered) : rendered;
|
|
449
|
-
const resolvedCellStyles = typeof column.cellStyles === "function" ? column.cellStyles(ctx) : column.cellStyles;
|
|
450
|
-
const CellTag = column.isRowHeader ? "th" : "td";
|
|
451
|
-
const link = column.isRowHeader ? rowLink?.(row, rowIndex) : void 0;
|
|
452
|
-
return /* @__PURE__ */ jsxs(CellTag, {
|
|
453
|
-
"data-element": "Cell",
|
|
454
|
-
"data-key": column.key,
|
|
455
|
-
"data-pin": column.pin,
|
|
456
|
-
"data-pin-edge": column.isPinEdge ? "" : void 0,
|
|
457
|
-
"data-align": column.align,
|
|
458
|
-
"data-wrap": column.autoHeight ? "" : void 0,
|
|
459
|
-
"data-link": link !== void 0 ? "" : void 0,
|
|
460
|
-
"data-last-row": isLastRow ? "" : void 0,
|
|
461
|
-
"data-pinned": pinnedEdge,
|
|
462
|
-
"data-last-column": lastColumnFlag(column),
|
|
463
|
-
"data-corner": bottomCornerFlag(column, rowIndex, isLastRow, pinnedEdge),
|
|
464
|
-
"data-cell-selected": isCellSelected(rowKey, column.key) ? "" : void 0,
|
|
465
|
-
...column.isRowHeader ? { scope: "row" } : { role: "gridcell" },
|
|
466
|
-
...cellSelectionProps(rowKey, column.key, pinnedEdge),
|
|
467
|
-
"aria-colindex": column.ariaColIndex,
|
|
468
|
-
style: {
|
|
469
|
-
...pinStyle(column),
|
|
470
|
-
...resolvedCellStyles
|
|
471
|
-
},
|
|
472
|
-
...column.cellProps?.(ctx),
|
|
473
|
-
children: [content, link !== void 0 ? /* @__PURE__ */ jsx(Action, {
|
|
474
|
-
"data-element": "RowLink",
|
|
475
|
-
to: link,
|
|
476
|
-
tabIndex: -1,
|
|
477
|
-
"aria-label": getColumnText(column, row, rowIndex) ?? void 0
|
|
478
|
-
}) : null]
|
|
479
|
-
}, column.key);
|
|
480
|
-
}
|
|
481
|
-
/**
|
|
482
|
-
* A pinned row — a total or subtotal.
|
|
483
|
-
*
|
|
484
|
-
* Rendered inside `<tbody>` rather than `<thead>`/`<tfoot>` so it keeps the
|
|
485
|
-
* body's own row and cell styling: the sub-element chains are anchored to
|
|
486
|
-
* `Body`, and a row in the head would match none of them. `data-pinned`
|
|
487
|
-
* carries the stickiness instead.
|
|
488
|
-
*/
|
|
489
|
-
function renderPinnedRow(row, index, edge) {
|
|
490
|
-
const rowKey = getRowKey(row, index);
|
|
491
|
-
return /* @__PURE__ */ jsx("tr", {
|
|
492
|
-
"data-element": "Row",
|
|
493
|
-
"data-pinned": edge,
|
|
494
|
-
role: "row",
|
|
495
|
-
children: columns.map((column) => renderCell(column, row, index, rowKey, false, edge))
|
|
496
|
-
}, `pinned-${edge}-${rowKey}`);
|
|
497
|
-
}
|
|
498
|
-
/** The cells of one body row. Shared by both render paths. */
|
|
499
|
-
function renderRowCells(row, rowIndex) {
|
|
500
|
-
const rowKey = getRowKey(row, rowIndex);
|
|
501
|
-
return columns.map((column) => renderCell(column, row, rowIndex, rowKey, rowIndex === rows.length - 1));
|
|
502
|
-
}
|
|
503
|
-
/**
|
|
504
|
-
* The `<tr>` shell. Virtuoso owns the element in the virtualized path (it
|
|
505
|
-
* needs its own `style` and measurement attributes), so this returns the
|
|
506
|
-
* props rather than the element.
|
|
507
|
-
*/
|
|
508
|
-
function getRowElementProps(row, rowIndex) {
|
|
509
|
-
const rowKey = getRowKey(row, rowIndex);
|
|
510
|
-
const isSelected = selection?.isSelected(rowKey) ?? false;
|
|
511
|
-
const extra = getRowProps?.({
|
|
512
|
-
row,
|
|
513
|
-
rowKey,
|
|
514
|
-
rowIndex,
|
|
515
|
-
section: "body",
|
|
516
|
-
isSelected,
|
|
517
|
-
isFocused: false,
|
|
518
|
-
isDropTarget: false
|
|
519
|
-
});
|
|
520
|
-
return {
|
|
521
|
-
"data-element": "Row",
|
|
522
|
-
"data-key": String(rowKey),
|
|
523
|
-
"data-row-index": rowIndex,
|
|
524
|
-
"data-qa": extra?.qa,
|
|
525
|
-
"data-odd": isStriped && rowIndex % 2 === 1 ? "" : void 0,
|
|
526
|
-
"data-dimmed": extra?.isDimmed ? "" : void 0,
|
|
527
|
-
"data-selected": isSelected ? "" : void 0,
|
|
528
|
-
"data-disabled": selection?.isRowDisabled(rowKey) ? "" : void 0,
|
|
529
|
-
role: "row",
|
|
530
|
-
tabIndex: isReorderable ? rowIndex === focusedRowIndex ? 0 : -1 : void 0,
|
|
531
|
-
"aria-selected": selection?.isEnabled ? isSelected : void 0,
|
|
532
|
-
"aria-rowindex": headerRowCount + rowIndex + 1,
|
|
533
|
-
title: extra?.tooltip,
|
|
534
|
-
height: extra?.height,
|
|
535
|
-
"data-clickable": onRowAction != null || rowLink?.(row, rowIndex) !== void 0 ? "" : void 0,
|
|
536
|
-
onClick: onRowAction != null ? (event) => {
|
|
537
|
-
if (event.target.closest("a, button, input, select, textarea, [role=\"button\"], [role=\"menuitem\"]")) return;
|
|
538
|
-
onRowAction(row, rowKey);
|
|
539
|
-
} : void 0,
|
|
540
|
-
onContextMenu: isMenuEnabled ? (event) => openContextMenuFor(row, rowIndex, rowKey, event) : void 0,
|
|
541
|
-
...Object.fromEntries(Object.entries(extra?.mods ?? {}).filter(([, active]) => active).map(([name]) => [`data-${name}`, ""]))
|
|
542
|
-
};
|
|
543
|
-
}
|
|
544
|
-
function renderRow(row, rowIndex, isVirtual = false) {
|
|
545
|
-
const { height, ...rowProps } = getRowElementProps(row, rowIndex);
|
|
546
|
-
return /* @__PURE__ */ jsx(TableRow, {
|
|
547
|
-
rowKey: getRowKey(row, rowIndex),
|
|
548
|
-
rowProps,
|
|
549
|
-
height,
|
|
550
|
-
index: isVirtual ? rowIndex : void 0,
|
|
551
|
-
measureRef: isVirtual ? virtualizer.measureElement : void 0,
|
|
552
|
-
dragState: isReorderable ? dragState : void 0,
|
|
553
|
-
dropState: isReorderable ? dropState : void 0,
|
|
554
|
-
children: renderRowCells(row, rowIndex)
|
|
555
|
-
}, rowProps["data-key"]);
|
|
556
|
-
}
|
|
557
|
-
function renderSpacerRow(height, position) {
|
|
558
|
-
if (height <= 0) return null;
|
|
559
|
-
return /* @__PURE__ */ jsx("tr", {
|
|
560
|
-
"aria-hidden": "true",
|
|
561
|
-
"data-spacer": position,
|
|
562
|
-
children: /* @__PURE__ */ jsx("td", {
|
|
563
|
-
colSpan: Math.max(columnCount, 1),
|
|
564
|
-
style: { height }
|
|
565
|
-
})
|
|
566
|
-
});
|
|
567
|
-
}
|
|
568
|
-
/**
|
|
569
|
-
* A row, preceded by the line showing a drop above it — and followed by one
|
|
570
|
-
* for the very last row, which has nothing after it to carry a "before".
|
|
571
|
-
*
|
|
572
|
-
* The indicators render nothing unless a drag is in flight, so a table that
|
|
573
|
-
* is merely *capable* of dragging keeps its ordinary structure.
|
|
574
|
-
*/
|
|
575
|
-
function withDropIndicators(row, index, isVirtual = false) {
|
|
576
|
-
const rowKey = getRowKey(row, index);
|
|
577
|
-
const rowNode = renderRow(row, index, isVirtual);
|
|
578
|
-
if (!isReorderable || !dropState) return rowNode;
|
|
579
|
-
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
580
|
-
/* @__PURE__ */ jsx(TableRowDropIndicator, {
|
|
581
|
-
rowKey,
|
|
582
|
-
dropPosition: "before",
|
|
583
|
-
dropState,
|
|
584
|
-
columnCount
|
|
585
|
-
}),
|
|
586
|
-
rowNode,
|
|
587
|
-
index === rows.length - 1 ? /* @__PURE__ */ jsx(TableRowDropIndicator, {
|
|
588
|
-
rowKey,
|
|
589
|
-
dropPosition: "after",
|
|
590
|
-
dropState,
|
|
591
|
-
columnCount
|
|
592
|
-
}) : null
|
|
593
|
-
] }, `row-${String(rowKey)}`);
|
|
594
|
-
}
|
|
595
|
-
const hasRows = rows.length > 0;
|
|
596
|
-
const isStale = isLoading && hasRows && loadingIndicator === "overlay";
|
|
597
|
-
const showSkeleton = isLoading && loadingIndicator !== "none" && (!hasRows || loadingIndicator === "skeleton");
|
|
598
|
-
const showBlank = isLoading && !hasRows && loadingIndicator === "none";
|
|
599
|
-
const shouldVirtualize = hasRows && error == null && (isVirtualized === true || isVirtualized === "auto" && rows.length > virtualizeThreshold);
|
|
600
|
-
const rowsRef = useRef(rows);
|
|
601
|
-
rowsRef.current = rows;
|
|
602
|
-
const virtualizer = useVirtualizer({
|
|
603
|
-
count: shouldVirtualize ? rows.length : 0,
|
|
604
|
-
getScrollElement: () => scrollerRef.current,
|
|
605
|
-
getItemKey: (index) => String(getRowKey(rowsRef.current[index], index)),
|
|
606
|
-
estimateSize: () => (rowHeight ?? ESTIMATED_ROW_HEIGHT[size ?? "medium"]) + 1,
|
|
607
|
-
measureElement: (element) => element.getBoundingClientRect().height,
|
|
608
|
-
overscan
|
|
609
|
-
});
|
|
610
|
-
const scrollability = useScrollability(scrollerEl);
|
|
611
|
-
/**
|
|
612
|
-
* Roving tabindex over the rows, so a reorderable table can be operated from
|
|
613
|
-
* the keyboard at all.
|
|
614
|
-
*
|
|
615
|
-
* React Aria's `dragProps` already describe "press Enter to start dragging"
|
|
616
|
-
* and implement the whole keyboard drag — but a `<tr>` is not focusable, so
|
|
617
|
-
* without this the description is announced for a row nobody can reach. One
|
|
618
|
-
* tab stop for the grid, arrows to move within it, matching how every other
|
|
619
|
-
* collection in the kit behaves.
|
|
620
|
-
*/
|
|
621
|
-
const [focusedRowIndex, setFocusedRowIndex] = useState(0);
|
|
622
|
-
const [isRangeDragging, setIsRangeDragging] = useState(false);
|
|
623
|
-
useEffect(() => {
|
|
624
|
-
if (!isRangeDragging) return;
|
|
625
|
-
const end = () => {
|
|
626
|
-
if (cellSelection) cellSelection.isDraggingRef.current = false;
|
|
627
|
-
setIsRangeDragging(false);
|
|
628
|
-
};
|
|
629
|
-
window.addEventListener("pointerup", end);
|
|
630
|
-
window.addEventListener("pointercancel", end);
|
|
631
|
-
return () => {
|
|
632
|
-
window.removeEventListener("pointerup", end);
|
|
633
|
-
window.removeEventListener("pointercancel", end);
|
|
634
|
-
};
|
|
635
|
-
}, [isRangeDragging, cellSelection]);
|
|
636
|
-
const moveRowFocus = useEvent((from, delta) => {
|
|
637
|
-
const current = from.closest("tr[data-element=\"Row\"]");
|
|
638
|
-
const all = Array.from(scrollerRef.current?.querySelectorAll("tbody tr[data-element=\"Row\"]:not([data-placeholder])") ?? []);
|
|
639
|
-
if (!all.length) return false;
|
|
640
|
-
const index = current ? all.indexOf(current) : -1;
|
|
641
|
-
const next = Math.min(Math.max((index === -1 ? focusedRowIndex : index) + delta, 0), all.length - 1);
|
|
642
|
-
setFocusedRowIndex(next);
|
|
643
|
-
all[next]?.focus();
|
|
644
|
-
return true;
|
|
645
|
-
});
|
|
646
|
-
const sentinelRef = useRef(null);
|
|
647
|
-
const onLoadMoreEvent = useEvent(() => onLoadMore?.());
|
|
648
|
-
useEffect(() => {
|
|
649
|
-
const sentinel = sentinelRef.current;
|
|
650
|
-
if (!onLoadMore || !hasMore || isLoadingMore || !scrollerEl || !sentinel) return;
|
|
651
|
-
const observer = new IntersectionObserver((entries) => {
|
|
652
|
-
if (entries.some((entry) => entry.isIntersecting)) onLoadMoreEvent();
|
|
653
|
-
}, {
|
|
654
|
-
root: scrollerEl,
|
|
655
|
-
rootMargin: `0px 0px ${loadMoreMargin}px 0px`
|
|
656
|
-
});
|
|
657
|
-
observer.observe(sentinel);
|
|
658
|
-
return () => observer.disconnect();
|
|
659
|
-
}, [
|
|
660
|
-
onLoadMore,
|
|
661
|
-
hasMore,
|
|
662
|
-
isLoadingMore,
|
|
663
|
-
scrollerEl,
|
|
664
|
-
loadMoreMargin,
|
|
665
|
-
onLoadMoreEvent,
|
|
666
|
-
rows.length
|
|
667
|
-
]);
|
|
668
|
-
const contextMenu = useContextMenu(__Menu, { placement: "bottom start" });
|
|
669
|
-
const isMenuEnabled = rowMenu != null && rowContextMenu !== false;
|
|
670
|
-
function resolveRowMenu(row, rowIndex, rowKey) {
|
|
671
|
-
if (!rowMenu) return null;
|
|
672
|
-
return rowMenu(row, {
|
|
673
|
-
row,
|
|
674
|
-
rowKey,
|
|
675
|
-
rowIndex,
|
|
676
|
-
section: "body",
|
|
677
|
-
isSelected: selection?.isSelected(rowKey) ?? false,
|
|
678
|
-
isFocused: false,
|
|
679
|
-
isDropTarget: false
|
|
680
|
-
});
|
|
681
|
-
}
|
|
682
|
-
function menuActionHandler(row, rowKey, closeAfter) {
|
|
683
|
-
return (action) => {
|
|
684
|
-
onRowMenuAction?.(normalizeMenuAction(action), row, rowKey);
|
|
685
|
-
if (closeAfter) contextMenu.close();
|
|
686
|
-
};
|
|
687
|
-
}
|
|
688
|
-
const openContextMenuFor = useEvent((row, rowIndex, rowKey, event) => {
|
|
689
|
-
const items = resolveRowMenu(row, rowIndex, rowKey);
|
|
690
|
-
if (isMenuEmpty(items)) return;
|
|
691
|
-
event.preventDefault();
|
|
692
|
-
contextMenu.open({
|
|
693
|
-
children: items,
|
|
694
|
-
onAction: menuActionHandler(row, rowKey, true)
|
|
695
|
-
}, void 0, "clientX" in event.nativeEvent ? event.nativeEvent : void 0);
|
|
696
|
-
});
|
|
697
|
-
/** Resolves the row a pointer or keyboard event landed in. */
|
|
698
|
-
function rowFromEvent(target) {
|
|
699
|
-
const element = target?.closest?.("tr[data-element=\"Row\"][data-key]");
|
|
700
|
-
if (!element) return null;
|
|
701
|
-
const index = Number(element.getAttribute("data-row-index"));
|
|
702
|
-
if (!Number.isInteger(index)) return null;
|
|
703
|
-
const row = rows[index];
|
|
704
|
-
return row === void 0 ? null : {
|
|
705
|
-
row,
|
|
706
|
-
index
|
|
707
|
-
};
|
|
708
|
-
}
|
|
709
|
-
const virtualItems = shouldVirtualize ? virtualizer.getVirtualItems() : [];
|
|
710
|
-
const paddingTop = virtualItems.length ? virtualItems[0].start : 0;
|
|
711
|
-
const paddingBottom = virtualItems.length ? virtualizer.getTotalSize() - virtualItems[virtualItems.length - 1].end : 0;
|
|
712
|
-
const colGroup = /* @__PURE__ */ jsx("colgroup", { children: columns.map((column) => /* @__PURE__ */ jsx("col", { style: column.width != null ? { width: column.width } : void 0 }, column.key)) });
|
|
713
|
-
const headerRow = isHeaderHidden ? null : /* @__PURE__ */ jsx("tr", {
|
|
714
|
-
"data-element": "HeadRow",
|
|
715
|
-
role: "row",
|
|
716
|
-
"aria-rowindex": 1,
|
|
717
|
-
children: columns.map(renderHeaderCell)
|
|
718
|
-
});
|
|
719
|
-
const tableProps = {
|
|
720
|
-
"data-element": "Table",
|
|
721
|
-
role: "grid",
|
|
722
|
-
"aria-label": ariaLabel,
|
|
723
|
-
"aria-busy": isLoading || void 0,
|
|
724
|
-
"aria-rowcount": headerRowCount + rows.length + (pinnedTopRows?.length ?? 0) + (pinnedBottomRows?.length ?? 0),
|
|
725
|
-
"aria-colcount": columnCount,
|
|
726
|
-
"aria-multiselectable": selection?.selectionMode === "multiple" ? true : void 0
|
|
727
|
-
};
|
|
728
|
-
let bodyContent;
|
|
729
|
-
if (error != null) bodyContent = renderStateRow(error);
|
|
730
|
-
else if (showSkeleton) bodyContent = renderSkeletonRows();
|
|
731
|
-
else if (showBlank) bodyContent = null;
|
|
732
|
-
else if (!hasRows) bodyContent = renderStateRow(isFiltered ? noResultsLabel : emptyLabel);
|
|
733
|
-
else if (shouldVirtualize) bodyContent = /* @__PURE__ */ jsxs(Fragment$1, { children: [
|
|
734
|
-
renderSpacerRow(paddingTop, "top"),
|
|
735
|
-
virtualItems.map((v) => withDropIndicators(rows[v.index], v.index, true)),
|
|
736
|
-
renderSpacerRow(paddingBottom, "bottom")
|
|
737
|
-
] });
|
|
738
|
-
else bodyContent = rows.map((row, index) => withDropIndicators(row, index));
|
|
739
|
-
return /* @__PURE__ */ jsxs(TableElement, {
|
|
740
|
-
ref: rootRef,
|
|
741
|
-
qa: qa || "Table",
|
|
742
|
-
styles: mergedStyles,
|
|
743
|
-
mods: {
|
|
744
|
-
size,
|
|
745
|
-
shape,
|
|
746
|
-
"sticky-header": isHeaderSticky,
|
|
747
|
-
"column-dividers": hasColumnDividers,
|
|
748
|
-
"range-dragging": isRangeDragging,
|
|
749
|
-
"has-footer": footer != null,
|
|
750
|
-
"scroll-x": scrollability.x,
|
|
751
|
-
"scroll-y": scrollability.y,
|
|
752
|
-
stale: isStale,
|
|
753
|
-
...mods
|
|
754
|
-
},
|
|
755
|
-
children: [
|
|
756
|
-
toolbar,
|
|
757
|
-
/* @__PURE__ */ jsx("div", {
|
|
758
|
-
"data-element": "Scroller",
|
|
759
|
-
ref: handleScrollerRef,
|
|
760
|
-
tabIndex: cellSelection?.isEnabled ? -1 : void 0,
|
|
761
|
-
onKeyDown: (event) => {
|
|
762
|
-
if (event.key === "F10" && event.shiftKey && isMenuEnabled) {
|
|
763
|
-
const found = rowFromEvent(event.target);
|
|
764
|
-
if (found) {
|
|
765
|
-
event.stopPropagation();
|
|
766
|
-
openContextMenuFor(found.row, found.index, getRowKey(found.row, found.index), event);
|
|
767
|
-
}
|
|
768
|
-
return;
|
|
769
|
-
}
|
|
770
|
-
if (event.key === "Enter" && onRowAction) {
|
|
771
|
-
const found = rowFromEvent(event.target);
|
|
772
|
-
if (found && !event.target.closest("a, button, input, select, textarea, [role=\"button\"]")) onRowAction(found.row, getRowKey(found.row, found.index));
|
|
773
|
-
return;
|
|
774
|
-
}
|
|
775
|
-
if (isReorderable && (event.key === "ArrowDown" || event.key === "ArrowUp")) {
|
|
776
|
-
if (dragState?.draggingKeys?.size) return;
|
|
777
|
-
if (moveRowFocus(event.target, event.key === "ArrowDown" ? 1 : -1)) event.preventDefault();
|
|
778
|
-
return;
|
|
779
|
-
}
|
|
780
|
-
if (event.key === "Escape") {
|
|
781
|
-
if (cellSelection?.range) {
|
|
782
|
-
event.stopPropagation();
|
|
783
|
-
cellSelection.clear();
|
|
784
|
-
return;
|
|
785
|
-
}
|
|
786
|
-
if (selection?.isEnabled && selection.selectedCount > 0) {
|
|
787
|
-
event.stopPropagation();
|
|
788
|
-
selection.clearSelection();
|
|
789
|
-
}
|
|
790
|
-
}
|
|
791
|
-
},
|
|
792
|
-
onCopy: (event) => {
|
|
793
|
-
if (!cellSelection?.range) return;
|
|
794
|
-
const text = cellSelection.getSelectionText((column, row, rowIndex) => column.isStructural ? "" : getColumnText(column, row, rowIndex) ?? "");
|
|
795
|
-
if (!text) return;
|
|
796
|
-
event.preventDefault();
|
|
797
|
-
event.clipboardData.setData("text/plain", text);
|
|
798
|
-
event.clipboardData.setData("text/html", toClipboardHtml(text));
|
|
799
|
-
toast.success({
|
|
800
|
-
title: t("itemTable.copiedToClipboard", "Copied to clipboard"),
|
|
801
|
-
description: t("itemTable.copiedCells", "{{count}} cells copied", { count: cellSelection.cellCount })
|
|
802
|
-
});
|
|
803
|
-
},
|
|
804
|
-
children: /* @__PURE__ */ jsxs("table", {
|
|
805
|
-
...tableProps,
|
|
806
|
-
style: layout.totalWidth != null ? { width: layout.totalWidth } : void 0,
|
|
807
|
-
children: [
|
|
808
|
-
colGroup,
|
|
809
|
-
isHeaderHidden ? null : /* @__PURE__ */ jsx("thead", {
|
|
810
|
-
"data-element": "Head",
|
|
811
|
-
children: headerRow
|
|
812
|
-
}),
|
|
813
|
-
/* @__PURE__ */ jsxs("tbody", {
|
|
814
|
-
"data-element": "Body",
|
|
815
|
-
...collectionProps,
|
|
816
|
-
ref: bodyRef,
|
|
817
|
-
children: [
|
|
818
|
-
pinnedTopRows?.map((row, index) => renderPinnedRow(row, index, "top")),
|
|
819
|
-
bodyContent,
|
|
820
|
-
pinnedBottomRows?.map((row, index) => renderPinnedRow(row, index, "bottom")),
|
|
821
|
-
isLoadingMore ? renderSkeletonRows(Math.min(skeletonRowCount, LOAD_MORE_SKELETON_ROWS), "load-more") : null,
|
|
822
|
-
onLoadMore && hasRows ? /* @__PURE__ */ jsx("tr", {
|
|
823
|
-
"data-sentinel": "",
|
|
824
|
-
"aria-hidden": "true",
|
|
825
|
-
children: /* @__PURE__ */ jsx("td", {
|
|
826
|
-
colSpan: Math.max(columnCount, 1),
|
|
827
|
-
style: {
|
|
828
|
-
height: 1,
|
|
829
|
-
padding: 0,
|
|
830
|
-
border: 0
|
|
831
|
-
},
|
|
832
|
-
children: /* @__PURE__ */ jsx("div", {
|
|
833
|
-
ref: sentinelRef,
|
|
834
|
-
style: { height: 1 }
|
|
835
|
-
})
|
|
836
|
-
})
|
|
837
|
-
}) : null
|
|
838
|
-
]
|
|
839
|
-
})
|
|
840
|
-
]
|
|
841
|
-
})
|
|
842
|
-
}),
|
|
843
|
-
isStale ? /* @__PURE__ */ jsx("div", {
|
|
844
|
-
"data-element": "Overlay",
|
|
845
|
-
role: "status",
|
|
846
|
-
children: /* @__PURE__ */ jsx(LoadingAnimation, { size: "small" })
|
|
847
|
-
}) : null,
|
|
848
|
-
overlay,
|
|
849
|
-
contextMenu.rendered,
|
|
850
|
-
footer
|
|
851
|
-
]
|
|
852
|
-
});
|
|
853
|
-
}
|
|
854
|
-
|
|
855
|
-
//#endregion
|
|
856
|
-
export { TableView };
|
|
857
|
-
//# sourceMappingURL=TableView.js.map
|