@galaxy-io/dls 1.6.1 → 2.0.1
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/README.md +47 -50
- package/biome/index.json +74 -0
- package/biome/plugins/no-hex-literal.grit +20 -0
- package/biome/plugins/no-inline-style.grit +13 -0
- package/biome/plugins/no-margin.grit +9 -0
- package/biome/plugins/warn/no-hex-literal.grit +23 -0
- package/biome/plugins/warn/no-inline-style.grit +13 -0
- package/biome/plugins/warn/no-margin.grit +9 -0
- package/dist/a11y/FocusScope.d.ts +44 -0
- package/dist/a11y/FocusScope.js +229 -0
- package/dist/a11y/VisuallyHidden.d.ts +21 -0
- package/dist/a11y/VisuallyHidden.js +30 -0
- package/dist/avatar/Avatar.d.ts +56 -14
- package/dist/avatar/Avatar.js +250 -96
- package/dist/avatar/AvatarGroup.d.ts +43 -0
- package/dist/avatar/AvatarGroup.js +153 -0
- package/dist/backgrounds/GridBackground.d.ts +48 -0
- package/dist/backgrounds/GridBackground.js +146 -0
- package/dist/beacons/Beacon.d.ts +86 -22
- package/dist/beacons/Beacon.js +170 -47
- package/dist/brand/GalaxyFilamentWordmark.d.ts +30 -0
- package/dist/brand/GalaxyFilamentWordmark.js +39 -0
- package/dist/brand/GalaxyLogomark.d.ts +26 -0
- package/dist/brand/GalaxyLogomark.js +41 -0
- package/dist/brand/GalaxyLogomarkAnimation.d.ts +36 -0
- package/dist/brand/GalaxyLogomarkAnimation.js +107 -0
- package/dist/brand/GalaxyWordmark.d.ts +30 -0
- package/dist/brand/GalaxyWordmark.js +63 -0
- package/dist/brand/assets/galaxy-logomark-animation.js +136678 -0
- package/dist/brand/brandMark.d.ts +26 -0
- package/dist/brand/brandMark.js +35 -0
- package/dist/buttons/Button.d.ts +148 -59
- package/dist/buttons/Button.js +437 -227
- package/dist/buttons/ButtonGroup.d.ts +38 -0
- package/dist/buttons/ButtonGroup.js +68 -0
- package/dist/buttons/CopyButton.d.ts +77 -0
- package/dist/buttons/CopyButton.js +65 -0
- package/dist/charts/AreaChart.d.ts +49 -0
- package/dist/charts/AreaChart.js +31 -0
- package/dist/charts/BarChart.d.ts +54 -67
- package/dist/charts/BarChart.js +160 -124
- package/dist/charts/ChartAxis.d.ts +35 -40
- package/dist/charts/ChartAxis.js +114 -90
- package/dist/charts/ChartCategoryTargets.d.ts +12 -26
- package/dist/charts/ChartCategoryTargets.js +33 -20
- package/dist/charts/ChartFrame.d.ts +71 -116
- package/dist/charts/ChartFrame.js +306 -97
- package/dist/charts/ChartGroupProvider.d.ts +30 -41
- package/dist/charts/ChartGroupProvider.js +20 -7
- package/dist/charts/ChartLegend.d.ts +37 -48
- package/dist/charts/ChartLegend.js +243 -125
- package/dist/charts/ChartMarkTargets.d.ts +12 -28
- package/dist/charts/ChartMarkTargets.js +34 -20
- package/dist/charts/ChartPrimitives.d.ts +50 -305
- package/dist/charts/ChartPrimitives.js +65 -413
- package/dist/charts/ChartTooltip.d.ts +20 -26
- package/dist/charts/ChartTooltip.js +77 -40
- package/dist/charts/Heatmap.d.ts +35 -0
- package/dist/charts/Heatmap.js +307 -0
- package/dist/charts/LineChart.d.ts +54 -47
- package/dist/charts/LineChart.js +174 -121
- package/dist/charts/PieChart.d.ts +32 -53
- package/dist/charts/PieChart.js +159 -136
- package/dist/charts/Sparkline.d.ts +107 -0
- package/dist/charts/Sparkline.js +244 -0
- package/dist/charts/StatChart.d.ts +37 -13
- package/dist/charts/StatChart.js +82 -35
- package/dist/charts/barChartGeometry.d.ts +138 -86
- package/dist/charts/barChartGeometry.js +122 -101
- package/dist/charts/barChartLegend.d.ts +14 -18
- package/dist/charts/barChartLegend.js +18 -13
- package/dist/charts/chartFormat.d.ts +12 -18
- package/dist/charts/chartFormat.js +20 -52
- package/dist/charts/chartPalette.d.ts +33 -0
- package/dist/charts/chartPalette.js +68 -0
- package/dist/charts/chartScales.d.ts +41 -108
- package/dist/charts/chartScales.js +62 -128
- package/dist/charts/chartSelection.d.ts +15 -0
- package/dist/charts/chartSelection.js +22 -0
- package/dist/charts/constants.d.ts +100 -256
- package/dist/charts/constants.js +109 -275
- package/dist/charts/heatmapGeometry.d.ts +95 -0
- package/dist/charts/heatmapGeometry.js +155 -0
- package/dist/charts/lineChartGeometry.d.ts +108 -58
- package/dist/charts/lineChartGeometry.js +120 -78
- package/dist/charts/pieChartGeometry.d.ts +66 -40
- package/dist/charts/pieChartGeometry.js +68 -38
- package/dist/charts/types.d.ts +206 -466
- package/dist/charts/types.js +55 -144
- package/dist/charts/useCartesianChartLayout.d.ts +28 -59
- package/dist/charts/useCartesianChartLayout.js +47 -32
- package/dist/charts/useChartDimensions.d.ts +19 -40
- package/dist/charts/useChartDimensions.js +40 -56
- package/dist/charts/useChartFormatters.d.ts +6 -15
- package/dist/charts/useChartFormatters.js +4 -9
- package/dist/charts/useChartInteraction.d.ts +69 -116
- package/dist/charts/useChartInteraction.js +148 -78
- package/dist/charts/useChartTooltipPosition.d.ts +29 -39
- package/dist/charts/useChartTooltipPosition.js +14 -5
- package/dist/charts/useSeriesColorResolver.d.ts +11 -33
- package/dist/charts/useSeriesColorResolver.js +19 -12
- package/dist/chips/Chip.d.ts +155 -44
- package/dist/chips/Chip.js +329 -155
- package/dist/chips/ChipGroup.d.ts +53 -0
- package/dist/chips/ChipGroup.js +98 -0
- package/dist/drawer/Drawer.d.ts +83 -17
- package/dist/drawer/Drawer.js +399 -65
- package/dist/dropdown/Dropdown.d.ts +80 -63
- package/dist/dropdown/Dropdown.js +127 -129
- package/dist/editor/CodeEditor.d.ts +119 -40
- package/dist/editor/CodeEditor.js +490 -400
- package/dist/editor/CodeEditorReactWidget.d.ts +20 -17
- package/dist/editor/CodeEditorReactWidget.js +28 -21
- package/dist/feedback/Alert.d.ts +49 -0
- package/dist/feedback/Alert.js +172 -0
- package/dist/feedback/EmptyState.d.ts +39 -0
- package/dist/feedback/EmptyState.js +109 -0
- package/dist/feedback/ProgressBar.d.ts +125 -0
- package/dist/feedback/ProgressBar.js +183 -0
- package/dist/feedback/ProgressCircle.d.ts +99 -0
- package/dist/feedback/ProgressCircle.js +187 -0
- package/dist/feedback/Skeleton.d.ts +69 -0
- package/dist/feedback/Skeleton.js +130 -0
- package/dist/feedback/Spinner.d.ts +63 -0
- package/dist/feedback/Spinner.js +141 -0
- package/dist/fonts.css +70 -0
- package/dist/hooks/internal/useIsClient.d.ts +2 -0
- package/dist/hooks/internal/useIsClient.js +14 -0
- package/dist/hooks/useClipboard.d.ts +19 -0
- package/dist/hooks/useClipboard.js +45 -0
- package/dist/hooks/useControlledOpenState.d.ts +21 -0
- package/dist/hooks/useControlledOpenState.js +19 -0
- package/dist/hooks/useControlledState.d.ts +19 -0
- package/dist/hooks/useControlledState.js +22 -0
- package/dist/hooks/useDebouncedValue.d.ts +14 -0
- package/dist/hooks/useDebouncedValue.js +33 -0
- package/dist/hooks/useDisclosure.d.ts +26 -0
- package/dist/hooks/useDisclosure.js +36 -0
- package/dist/hooks/useDismiss.d.ts +23 -27
- package/dist/hooks/useDismiss.js +39 -27
- package/dist/hooks/useElementClientSize.d.ts +10 -10
- package/dist/hooks/useElementClientSize.js +8 -11
- package/dist/hooks/useElementWidth.d.ts +6 -13
- package/dist/hooks/useElementWidth.js +6 -14
- package/dist/hooks/useField.d.ts +47 -0
- package/dist/hooks/useField.js +40 -0
- package/dist/hooks/useHotkey.d.ts +77 -0
- package/dist/hooks/useHotkey.js +246 -0
- package/dist/hooks/useIsMac.d.ts +12 -0
- package/dist/hooks/useIsMac.js +27 -0
- package/dist/hooks/useIsomorphicLayoutEffect.d.ts +17 -0
- package/dist/hooks/useIsomorphicLayoutEffect.js +20 -0
- package/dist/hooks/useLocalStorage.d.ts +28 -0
- package/dist/hooks/useLocalStorage.js +145 -0
- package/dist/hooks/useMediaQuery.d.ts +11 -0
- package/dist/hooks/useMediaQuery.js +23 -0
- package/dist/hooks/usePrefersReducedMotion.d.ts +12 -0
- package/dist/hooks/usePrefersReducedMotion.js +25 -0
- package/dist/hooks/useResize.d.ts +42 -62
- package/dist/hooks/useResize.js +43 -31
- package/dist/icons/Icon.d.ts +64 -37
- package/dist/icons/Icon.js +96 -37
- package/dist/icons/internal/IconSlot.d.ts +10 -0
- package/dist/icons/internal/IconSlot.js +32 -0
- package/dist/inputs/CheckboxGroup.d.ts +115 -0
- package/dist/inputs/CheckboxGroup.js +183 -0
- package/dist/inputs/CheckboxInput.d.ts +98 -28
- package/dist/inputs/CheckboxInput.js +218 -88
- package/dist/inputs/ColorInput.d.ts +115 -29
- package/dist/inputs/ColorInput.js +748 -326
- package/dist/inputs/CopyInput.d.ts +49 -20
- package/dist/inputs/CopyInput.js +57 -49
- package/dist/inputs/CronInput.d.ts +94 -0
- package/dist/inputs/CronInput.js +618 -0
- package/dist/inputs/DateInput.d.ts +175 -28
- package/dist/inputs/DateInput.js +1109 -451
- package/dist/inputs/DurationInput.d.ts +101 -0
- package/dist/inputs/DurationInput.js +441 -0
- package/dist/inputs/Field.d.ts +75 -0
- package/dist/inputs/Field.js +247 -0
- package/dist/inputs/Fieldset.d.ts +53 -0
- package/dist/inputs/Fieldset.js +149 -0
- package/dist/inputs/FileInput.d.ts +110 -0
- package/dist/inputs/FileInput.js +476 -0
- package/dist/inputs/Input.d.ts +148 -187
- package/dist/inputs/Input.js +339 -259
- package/dist/inputs/KeyValueInput.d.ts +120 -0
- package/dist/inputs/KeyValueInput.js +383 -0
- package/dist/inputs/MultiSelectInput.d.ts +165 -54
- package/dist/inputs/MultiSelectInput.js +175 -559
- package/dist/inputs/NumberInput.d.ts +65 -9
- package/dist/inputs/NumberInput.js +197 -40
- package/dist/inputs/PasswordInput.d.ts +17 -12
- package/dist/inputs/PasswordInput.js +33 -33
- package/dist/inputs/PinInput.d.ts +117 -0
- package/dist/inputs/PinInput.js +364 -0
- package/dist/inputs/RadioGroup.d.ts +115 -0
- package/dist/inputs/RadioGroup.js +179 -0
- package/dist/inputs/RadioInput.d.ts +87 -24
- package/dist/inputs/RadioInput.js +182 -95
- package/dist/inputs/SearchInput.d.ts +66 -0
- package/dist/inputs/SearchInput.js +156 -0
- package/dist/inputs/SelectInput.d.ts +195 -55
- package/dist/inputs/SelectInput.js +1308 -446
- package/dist/inputs/SliderInput.d.ts +150 -30
- package/dist/inputs/SliderInput.js +441 -186
- package/dist/inputs/SwitchInput.d.ts +109 -0
- package/dist/inputs/SwitchInput.js +248 -0
- package/dist/inputs/TagInput.d.ts +117 -0
- package/dist/inputs/TagInput.js +408 -0
- package/dist/inputs/TextAreaInput.d.ts +146 -44
- package/dist/inputs/TextAreaInput.js +298 -198
- package/dist/inputs/TextInput.d.ts +4 -13
- package/dist/inputs/TextInput.js +13 -48
- package/dist/inputs/ToggleInput.d.ts +120 -22
- package/dist/inputs/ToggleInput.js +262 -116
- package/dist/inputs/internal/bareField.d.ts +18 -0
- package/dist/inputs/internal/bareField.js +38 -0
- package/dist/inputs/internal/devWarn.d.ts +7 -0
- package/dist/inputs/internal/devWarn.js +30 -0
- package/dist/inputs/internal/fieldFrame.d.ts +34 -0
- package/dist/inputs/internal/fieldFrame.js +64 -0
- package/dist/inputs/internal/fieldWiring.d.ts +50 -0
- package/dist/inputs/internal/fieldWiring.js +38 -0
- package/dist/inputs/internal/innerButton.d.ts +2 -0
- package/dist/inputs/internal/innerButton.js +24 -0
- package/dist/inputs/internal/ownField.d.ts +45 -0
- package/dist/inputs/internal/ownField.js +58 -0
- package/dist/inputs/internal/predicates.d.ts +9 -0
- package/dist/inputs/internal/predicates.js +11 -0
- package/dist/inputs/internal/useComboboxPopover.d.ts +46 -0
- package/dist/inputs/internal/useComboboxPopover.js +92 -0
- package/dist/json/JsonViewer.d.ts +62 -0
- package/dist/json/JsonViewer.js +483 -0
- package/dist/layout/Box.d.ts +87 -0
- package/dist/layout/Box.js +109 -0
- package/dist/layout/Divider.d.ts +25 -0
- package/dist/layout/Divider.js +70 -0
- package/dist/layout/Flex.d.ts +139 -0
- package/dist/layout/Flex.js +165 -0
- package/dist/layout/FlexItem.d.ts +72 -0
- package/dist/layout/FlexItem.js +84 -0
- package/dist/layout/Grid.d.ts +140 -0
- package/dist/layout/Grid.js +178 -0
- package/dist/layout/Portal.d.ts +29 -0
- package/dist/layout/Portal.js +27 -0
- package/dist/layout/ResizablePanels.d.ts +88 -0
- package/dist/layout/ResizablePanels.js +198 -0
- package/dist/layout/ResizeHandle.d.ts +48 -0
- package/dist/layout/ResizeHandle.js +143 -0
- package/dist/layout/ScrollArea.d.ts +30 -0
- package/dist/layout/ScrollArea.js +138 -0
- package/dist/links/Link.d.ts +101 -1
- package/dist/links/Link.js +166 -4
- package/dist/lists/BulletedList.d.ts +25 -7
- package/dist/lists/BulletedList.js +72 -27
- package/dist/lists/DescriptionList.d.ts +91 -0
- package/dist/lists/DescriptionList.js +147 -0
- package/dist/menu/ContextMenu.d.ts +64 -0
- package/dist/menu/ContextMenu.js +34 -0
- package/dist/menu/Menu.d.ts +280 -0
- package/dist/menu/Menu.js +1003 -0
- package/dist/modal/ConfirmDialog.d.ts +55 -0
- package/dist/modal/ConfirmDialog.js +151 -0
- package/dist/modal/Modal.d.ts +64 -14
- package/dist/modal/Modal.js +189 -48
- package/dist/navigation/Breadcrumbs.d.ts +65 -0
- package/dist/navigation/Breadcrumbs.js +243 -0
- package/dist/navigation/CommandPalette.d.ts +83 -0
- package/dist/navigation/CommandPalette.js +509 -0
- package/dist/navigation/Pagination.d.ts +87 -0
- package/dist/navigation/Pagination.js +300 -0
- package/dist/navigation/SidebarNav.d.ts +107 -0
- package/dist/navigation/SidebarNav.js +341 -0
- package/dist/navigation/Stepper.d.ts +52 -0
- package/dist/navigation/Stepper.js +207 -0
- package/dist/navigation/Tabs.d.ts +113 -0
- package/dist/navigation/Tabs.js +543 -0
- package/dist/navigation/Topbar.d.ts +20 -0
- package/dist/navigation/Topbar.js +62 -0
- package/dist/overlay/OverlayProvider.d.ts +28 -32
- package/dist/overlay/OverlayProvider.js +42 -93
- package/dist/overlay/useOverlay.d.ts +88 -12
- package/dist/overlay/useOverlay.js +220 -43
- package/dist/overlays/Popover.d.ts +114 -0
- package/dist/overlays/Popover.js +389 -0
- package/dist/shapes/Circle.d.ts +84 -8
- package/dist/shapes/Circle.js +122 -20
- package/dist/shapes/Square.d.ts +84 -8
- package/dist/shapes/Square.js +123 -20
- package/dist/styles/mixins.d.ts +35 -0
- package/dist/styles/mixins.js +60 -0
- package/dist/styles.css +1 -202
- package/dist/table/InfiniteSpreadsheet.d.ts +140 -10
- package/dist/table/InfiniteSpreadsheet.js +762 -225
- package/dist/table/InfiniteTable.d.ts +116 -14
- package/dist/table/InfiniteTable.js +287 -429
- package/dist/table/SpreadsheetCellEditor.d.ts +54 -6
- package/dist/table/SpreadsheetCellEditor.js +163 -84
- package/dist/table/TableCore.d.ts +252 -0
- package/dist/table/TableCore.js +1082 -0
- package/dist/table/VirtualizedInfiniteTable.d.ts +104 -14
- package/dist/table/VirtualizedInfiniteTable.js +280 -219
- package/dist/table/types.d.ts +66 -244
- package/dist/table/types.js +0 -51
- package/dist/table/useInfiniteScrollSentinel.d.ts +25 -21
- package/dist/table/useInfiniteScrollSentinel.js +38 -30
- package/dist/table/useSpreadsheetCellNavigation.d.ts +44 -0
- package/dist/table/useSpreadsheetCellNavigation.js +141 -0
- package/dist/table/useTableColumnLayout.d.ts +90 -25
- package/dist/table/useTableColumnLayout.js +255 -50
- package/dist/table/useTableKeyboardNavigation.d.ts +32 -21
- package/dist/table/useTableKeyboardNavigation.js +95 -71
- package/dist/table/useTableRowSelection.d.ts +24 -25
- package/dist/table/useTableRowSelection.js +57 -84
- package/dist/table/useTableVirtualizer.d.ts +20 -0
- package/dist/table/useTableVirtualizer.js +48 -0
- package/dist/text/Bold.d.ts +5 -6
- package/dist/text/Bold.js +16 -15
- package/dist/text/Code.d.ts +5 -6
- package/dist/text/Code.js +16 -25
- package/dist/text/CodeBlock.d.ts +77 -0
- package/dist/text/CodeBlock.js +373 -0
- package/dist/text/EditableText.d.ts +55 -15
- package/dist/text/EditableText.js +153 -135
- package/dist/text/Ellipsis.d.ts +34 -8
- package/dist/text/Ellipsis.js +55 -23
- package/dist/text/Kbd.d.ts +72 -0
- package/dist/text/Kbd.js +284 -0
- package/dist/text/MarkdownText.d.ts +27 -10
- package/dist/text/MarkdownText.js +317 -300
- package/dist/text/RequiredMarker.d.ts +17 -5
- package/dist/text/RequiredMarker.js +34 -36
- package/dist/text/Selectable.d.ts +5 -6
- package/dist/text/Selectable.js +16 -13
- package/dist/text/Span.d.ts +82 -0
- package/dist/text/Span.js +115 -0
- package/dist/text/Text.d.ts +128 -41
- package/dist/text/Text.js +209 -76
- package/dist/theme/GalaxyProvider.d.ts +75 -0
- package/dist/theme/GalaxyProvider.js +223 -0
- package/dist/theme/ThemeSwitcher.d.ts +52 -0
- package/dist/theme/ThemeSwitcher.js +94 -0
- package/dist/theme/enums.d.ts +118 -0
- package/dist/theme/enums.js +144 -0
- package/dist/theme/tokens/dark.d.ts +2 -0
- package/dist/theme/tokens/dark.js +275 -0
- package/dist/theme/tokens/generate.d.ts +15 -0
- package/dist/theme/tokens/generate.js +47 -0
- package/dist/theme/tokens/light.d.ts +2 -0
- package/dist/theme/tokens/light.js +274 -0
- package/dist/theme/tokens/palette.d.ts +14 -0
- package/dist/theme/tokens/palette.js +153 -0
- package/dist/theme/tokens/scales.d.ts +26 -0
- package/dist/theme/tokens/scales.js +154 -0
- package/dist/theme/tokens/t.d.ts +3 -0
- package/dist/theme/tokens/t.js +25 -0
- package/dist/theme/tokens/types.d.ts +189 -0
- package/dist/theme/tokens/types.js +0 -0
- package/dist/theme/useGalaxyTheme.d.ts +46 -0
- package/dist/theme/useGalaxyTheme.js +36 -0
- package/dist/theme/useInverseScope.d.ts +18 -0
- package/dist/theme/useInverseScope.js +33 -0
- package/dist/three/GalaxyLogomark3D.d.ts +46 -0
- package/dist/three/GalaxyLogomark3D.js +134 -0
- package/dist/three/assets/galaxy-logomark.js +4 -0
- package/dist/three/galaxyLogomark3DScene.d.ts +27 -0
- package/dist/three/galaxyLogomark3DScene.js +165 -0
- package/dist/timeline/Timeline.d.ts +120 -0
- package/dist/timeline/Timeline.js +301 -0
- package/dist/toast/Toast.d.ts +43 -19
- package/dist/toast/Toast.js +130 -89
- package/dist/toast/ToastProvider.d.ts +23 -23
- package/dist/toast/ToastProvider.js +298 -101
- package/dist/toast/ToastViewport.d.ts +12 -0
- package/dist/toast/ToastViewport.js +210 -0
- package/dist/toast/useToast.d.ts +139 -5
- package/dist/toast/useToast.js +15 -13
- package/dist/tokens.css +654 -0
- package/dist/tooltip/Tooltip.d.ts +64 -44
- package/dist/tooltip/Tooltip.js +280 -73
- package/dist/tooltip/internal/LazyTooltip.d.ts +7 -0
- package/dist/tooltip/internal/LazyTooltip.js +53 -0
- package/dist/transform/Fade.d.ts +33 -11
- package/dist/transform/Fade.js +71 -19
- package/dist/transform/Flasher.d.ts +25 -0
- package/dist/transform/Flasher.js +39 -0
- package/dist/transform/Rotate.d.ts +24 -12
- package/dist/transform/Rotate.js +36 -22
- package/dist/transform/ScaleFade.d.ts +36 -11
- package/dist/transform/ScaleFade.js +86 -28
- package/dist/transform/internal/CollapseMotion.d.ts +10 -0
- package/dist/transform/internal/CollapseMotion.js +65 -0
- package/dist/tree/Tree.d.ts +85 -0
- package/dist/tree/Tree.js +387 -0
- package/dist/tree/treeRow.d.ts +39 -0
- package/dist/tree/treeRow.js +75 -0
- package/dist/utils/colors.d.ts +46 -13
- package/dist/utils/colors.js +92 -34
- package/dist/utils/css.d.ts +23 -0
- package/dist/utils/css.js +30 -0
- package/dist/utils/format.d.ts +58 -0
- package/dist/utils/format.js +220 -0
- package/dist/vite/index.d.ts +16 -0
- package/dist/vite/index.js +52 -0
- package/dist/widget/Widget.d.ts +164 -48
- package/dist/widget/Widget.js +335 -96
- package/dist/widget/WidgetGroup.d.ts +36 -0
- package/dist/widget/WidgetGroup.js +103 -0
- package/package.json +855 -157
- package/dist/accordion/Accordion.d.ts +0 -54
- package/dist/accordion/Accordion.js +0 -183
- package/dist/assets/components/GalaxyFilamentWordmarkDark.d.ts +0 -3
- package/dist/assets/components/GalaxyFilamentWordmarkDark.js +0 -14
- package/dist/assets/components/GalaxyFilamentWordmarkLight.d.ts +0 -3
- package/dist/assets/components/GalaxyFilamentWordmarkLight.js +0 -14
- package/dist/assets/components/GalaxyLogomarkDark.d.ts +0 -3
- package/dist/assets/components/GalaxyLogomarkDark.js +0 -11
- package/dist/assets/components/GalaxyLogomarkLight.d.ts +0 -3
- package/dist/assets/components/GalaxyLogomarkLight.js +0 -17
- package/dist/assets/components/GalaxyWordmarkDark.d.ts +0 -3
- package/dist/assets/components/GalaxyWordmarkDark.js +0 -15
- package/dist/assets/components/GalaxyWordmarkLight.d.ts +0 -3
- package/dist/assets/components/GalaxyWordmarkLight.js +0 -28
- package/dist/assets/models/galaxy-animation.js +0 -136666
- package/dist/assets/models/galaxy-logomark.js +0 -4
- package/dist/avatar/AvatarShimmer.d.ts +0 -30
- package/dist/avatar/AvatarShimmer.js +0 -22
- package/dist/backgrounds/CellGridBackground.d.ts +0 -24
- package/dist/backgrounds/CellGridBackground.js +0 -44
- package/dist/backgrounds/CrossGridBackground.d.ts +0 -26
- package/dist/backgrounds/CrossGridBackground.js +0 -49
- package/dist/backgrounds/DotGridBackground.d.ts +0 -24
- package/dist/backgrounds/DotGridBackground.js +0 -47
- package/dist/badge/Badge.d.ts +0 -42
- package/dist/badge/Badge.js +0 -99
- package/dist/charts/ChartEmptyState.d.ts +0 -17
- package/dist/charts/ChartEmptyState.js +0 -29
- package/dist/charts/ProgressBar.d.ts +0 -29
- package/dist/charts/ProgressBar.js +0 -65
- package/dist/charts/chartTheme.d.ts +0 -18
- package/dist/charts/chartTheme.js +0 -26
- package/dist/containers/FlexItem.d.ts +0 -50
- package/dist/containers/FlexItem.js +0 -91
- package/dist/containers/FlexWrapper.d.ts +0 -96
- package/dist/containers/FlexWrapper.js +0 -143
- package/dist/containers/GridWrapper.d.ts +0 -79
- package/dist/containers/GridWrapper.js +0 -125
- package/dist/containers/Spacing.d.ts +0 -23
- package/dist/containers/Spacing.js +0 -59
- package/dist/containers/Wrapper.d.ts +0 -26
- package/dist/containers/Wrapper.js +0 -54
- package/dist/dividers/HorizontalDivider.d.ts +0 -7
- package/dist/dividers/HorizontalDivider.js +0 -39
- package/dist/dividers/VerticalDivider.d.ts +0 -6
- package/dist/dividers/VerticalDivider.js +0 -21
- package/dist/icons/GalaxyFilamentWordmark.d.ts +0 -11
- package/dist/icons/GalaxyFilamentWordmark.js +0 -25
- package/dist/icons/GalaxyLogomark.d.ts +0 -13
- package/dist/icons/GalaxyLogomark.js +0 -27
- package/dist/icons/GalaxyLogomark3D.d.ts +0 -56
- package/dist/icons/GalaxyLogomark3D.js +0 -319
- package/dist/icons/GalaxyLogomarkAnimation.d.ts +0 -18
- package/dist/icons/GalaxyLogomarkAnimation.js +0 -48
- package/dist/icons/GalaxyWordmark.d.ts +0 -11
- package/dist/icons/GalaxyWordmark.js +0 -25
- package/dist/inputs/MultiTextInput.d.ts +0 -32
- package/dist/inputs/MultiTextInput.js +0 -180
- package/dist/inputs/SwitcherInput.d.ts +0 -30
- package/dist/inputs/SwitcherInput.js +0 -81
- package/dist/inputs/hooks.d.ts +0 -10
- package/dist/inputs/hooks.js +0 -22
- package/dist/overlay/constants.d.ts +0 -28
- package/dist/overlay/constants.js +0 -37
- package/dist/resizable/HorizontalResizeHandle.d.ts +0 -17
- package/dist/resizable/HorizontalResizeHandle.js +0 -38
- package/dist/resizable/VerticalResizeHandle.d.ts +0 -18
- package/dist/resizable/VerticalResizeHandle.js +0 -39
- package/dist/table/SpreadsheetCell.d.ts +0 -21
- package/dist/table/SpreadsheetCell.js +0 -71
- package/dist/table/SpreadsheetHeaderCell.d.ts +0 -23
- package/dist/table/SpreadsheetHeaderCell.js +0 -91
- package/dist/table/SpreadsheetMenuItem.d.ts +0 -14
- package/dist/table/SpreadsheetMenuItem.js +0 -33
- package/dist/table/SpreadsheetPrimitives.d.ts +0 -172
- package/dist/table/SpreadsheetPrimitives.js +0 -105
- package/dist/table/SpreadsheetRow.d.ts +0 -33
- package/dist/table/SpreadsheetRow.js +0 -73
- package/dist/table/SpreadsheetRowActionCell.d.ts +0 -14
- package/dist/table/SpreadsheetRowActionCell.js +0 -51
- package/dist/table/TableExpandCell.d.ts +0 -11
- package/dist/table/TableExpandCell.js +0 -24
- package/dist/table/TableExpandedRow.d.ts +0 -16
- package/dist/table/TableExpandedRow.js +0 -77
- package/dist/table/TableHeaderCellContent.d.ts +0 -30
- package/dist/table/TableHeaderCellContent.js +0 -48
- package/dist/table/TablePrimitives.d.ts +0 -313
- package/dist/table/TablePrimitives.js +0 -302
- package/dist/table/TableSelectCell.d.ts +0 -18
- package/dist/table/TableSelectCell.js +0 -27
- package/dist/table/TableStatusRow.d.ts +0 -18
- package/dist/table/TableStatusRow.js +0 -50
- package/dist/table/useSpreadsheetEditing.d.ts +0 -13
- package/dist/table/useSpreadsheetEditing.js +0 -41
- package/dist/table/useTableColumnResize.d.ts +0 -38
- package/dist/table/useTableColumnResize.js +0 -155
- package/dist/table/useTableRowExpansion.d.ts +0 -24
- package/dist/table/useTableRowExpansion.js +0 -62
- package/dist/table/utils.d.ts +0 -50
- package/dist/table/utils.js +0 -78
- package/dist/text/HotKeys.d.ts +0 -30
- package/dist/text/HotKeys.js +0 -74
- package/dist/text/Paragraph.d.ts +0 -33
- package/dist/text/Paragraph.js +0 -83
- package/dist/text/TextShimmer.d.ts +0 -14
- package/dist/text/TextShimmer.js +0 -34
- package/dist/theme/GalaxyTheme.d.ts +0 -67
- package/dist/theme/GalaxyTheme.js +0 -119
- package/dist/theme/constants.d.ts +0 -8
- package/dist/theme/constants.js +0 -38
- package/dist/theme/index.d.ts +0 -6
- package/dist/theme/index.js +0 -7
- package/dist/theme/types.d.ts +0 -195
- package/dist/theme/types.js +0 -10
- package/dist/theme/typography.d.ts +0 -2
- package/dist/theme/typography.js +0 -73
- package/dist/theme/variants/dark.d.ts +0 -2
- package/dist/theme/variants/dark.js +0 -125
- package/dist/theme/variants/light.d.ts +0 -2
- package/dist/theme/variants/light.js +0 -125
- package/dist/toast/ToastContainer.d.ts +0 -10
- package/dist/toast/ToastContainer.js +0 -31
- package/dist/toast/ToastWrapper.d.ts +0 -6
- package/dist/toast/ToastWrapper.js +0 -27
- package/dist/transform/Flash.d.ts +0 -7
- package/dist/transform/Flash.js +0 -18
- package/dist/transform/Spin.d.ts +0 -14
- package/dist/transform/Spin.js +0 -25
- package/dist/utils/linaria.d.ts +0 -1
- package/dist/utils/linaria.js +0 -8
|
@@ -1,242 +1,779 @@
|
|
|
1
|
+
import { useIsomorphicLayoutEffect } from "../hooks/useIsomorphicLayoutEffect.js";
|
|
2
|
+
import Skeleton, { SkeletonVariant } from "../feedback/Skeleton.js";
|
|
3
|
+
import { Placement, Side } from "../theme/enums.js";
|
|
1
4
|
import Text, { TextVariant } from "../text/Text.js";
|
|
2
|
-
import
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
5
|
+
import { CONTROL_SIZE, SPACE } from "../theme/tokens/scales.js";
|
|
6
|
+
import { useControlledState } from "../hooks/useControlledState.js";
|
|
7
|
+
import Beacon, { BeaconSize, BeaconVariant } from "../beacons/Beacon.js";
|
|
8
|
+
import Icon, { IconVariant } from "../icons/Icon.js";
|
|
9
|
+
import Button, { ButtonVariant } from "../buttons/Button.js";
|
|
10
|
+
import EmptyState from "../feedback/EmptyState.js";
|
|
11
|
+
import { InputSize } from "../inputs/Input.js";
|
|
12
|
+
import { SelectInputSize } from "../inputs/SelectInput.js";
|
|
13
|
+
import { DateInputSize } from "../inputs/DateInput.js";
|
|
14
|
+
import { SwitchInputSize } from "../inputs/SwitchInput.js";
|
|
15
|
+
import Menu from "../menu/Menu.js";
|
|
16
|
+
import { SpreadsheetCellEditor, SpreadsheetEditorKind } from "./SpreadsheetCellEditor.js";
|
|
17
|
+
import { CELL_TEXT_CSS, COLUMN_ALIGN_TO_CSS_MAP, PIN_TO_CSS_MAP, PIN_TO_EDGE_CSS_MAP, TABLE_LARGE_METRICS, TABLE_MEDIUM_METRICS, TABLE_SMALL_METRICS, TableCell, TableCellText, TableColumnsMenu, TableFrame, TableRow, VIRTUAL_BODY_CSS, VIRTUAL_ROW_CSS } from "./TableCore.js";
|
|
18
|
+
import { useSpreadsheetCellNavigation } from "./useSpreadsheetCellNavigation.js";
|
|
7
19
|
import { useTableColumnLayout } from "./useTableColumnLayout.js";
|
|
8
|
-
import {
|
|
9
|
-
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import TableStatusRow from "./TableStatusRow.js";
|
|
13
|
-
import { ActionColumnHeaderCell, CellLoadingSkeleton } from "./SpreadsheetPrimitives.js";
|
|
14
|
-
import SpreadsheetRow from "./SpreadsheetRow.js";
|
|
15
|
-
import SpreadsheetHeaderCell from "./SpreadsheetHeaderCell.js";
|
|
16
|
-
import { useCallback, useMemo, useRef } from "react";
|
|
20
|
+
import { useTableVirtualizer } from "./useTableVirtualizer.js";
|
|
21
|
+
/* empty css */
|
|
22
|
+
import { styled } from "@linaria/react";
|
|
23
|
+
import { forwardRef, memo, useCallback, useEffect, useMemo, useRef, useState } from "react";
|
|
17
24
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
18
|
-
import {
|
|
19
|
-
import {
|
|
25
|
+
import { cx } from "@linaria/core";
|
|
26
|
+
import { DotsThreeIcon, PlusIcon } from "@phosphor-icons/react";
|
|
20
27
|
//#region src/table/InfiniteSpreadsheet.tsx
|
|
21
28
|
/**
|
|
22
|
-
*
|
|
23
|
-
*
|
|
29
|
+
* InfiniteSpreadsheet is the editable grid: a virtualized table whose cells are values the user
|
|
30
|
+
* edits in place, one cell at a time, with a spreadsheet's keyboard model (arrow keys between
|
|
31
|
+
* cells, Enter / F2 or typing to edit, Tab to commit and move on, Escape to cancel). Each column
|
|
32
|
+
* declares the type of its values (`cellType`), which picks the display and the 2.0 input used as
|
|
33
|
+
* the editor, rendered bare (no frame, fill or focus line; the text stays where the read-only
|
|
34
|
+
* cell drew it); the app receives each changed value through the column's `onCellChange` and stores
|
|
35
|
+
* it. Columns can carry header menus, rows action menus, and cells a status dot for background
|
|
36
|
+
* work on a value.
|
|
24
37
|
*
|
|
25
|
-
*
|
|
26
|
-
*
|
|
38
|
+
* Built on the shared table core (`TableCore`, `useTableColumnLayout`, `useTableVirtualizer`) and
|
|
39
|
+
* its own `SpreadsheetCellEditor` and `useSpreadsheetCellNavigation`; it imports nothing from
|
|
40
|
+
* InfiniteTable or VirtualizedInfiniteTable, and no `@tanstack/react-table`. Read-only data is
|
|
41
|
+
* InfiniteTable or VirtualizedInfiniteTable.
|
|
27
42
|
*/
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
43
|
+
/** Row rung of the grid (canonical subset; the 1.x TableDensity members). Same rows as InfiniteTableSize. */
|
|
44
|
+
var InfiniteSpreadsheetSize = /* @__PURE__ */ function(InfiniteSpreadsheetSize) {
|
|
45
|
+
/** 32px rows, body_sm text, 24px editors. */
|
|
46
|
+
InfiniteSpreadsheetSize["SMALL"] = "SMALL";
|
|
47
|
+
/** 48px rows, body_md text, 32px editors. The default. */
|
|
48
|
+
InfiniteSpreadsheetSize["MEDIUM"] = "MEDIUM";
|
|
49
|
+
/** 52px rows, body_lg text, 36px editors. */
|
|
50
|
+
InfiniteSpreadsheetSize["LARGE"] = "LARGE";
|
|
51
|
+
return InfiniteSpreadsheetSize;
|
|
52
|
+
}({});
|
|
53
|
+
/** Type of a column's values; picks the display format and the editor. */
|
|
54
|
+
var SpreadsheetCellType = /* @__PURE__ */ function(SpreadsheetCellType) {
|
|
55
|
+
/** Free text; edited with TextInput. */
|
|
56
|
+
SpreadsheetCellType["TEXT"] = "TEXT";
|
|
57
|
+
/** A number; mono, right-aligned, edited with NumberInput. */
|
|
58
|
+
SpreadsheetCellType["NUMBER"] = "NUMBER";
|
|
59
|
+
/** Yes / no; edited with SwitchInput, or toggled with Space. */
|
|
60
|
+
SpreadsheetCellType["BOOLEAN"] = "BOOLEAN";
|
|
61
|
+
/** One of `options`; edited with SelectInput. */
|
|
62
|
+
SpreadsheetCellType["ENUM"] = "ENUM";
|
|
63
|
+
/** A date; edited with DateInput. */
|
|
64
|
+
SpreadsheetCellType["DATE"] = "DATE";
|
|
65
|
+
return SpreadsheetCellType;
|
|
66
|
+
}({});
|
|
67
|
+
/** Background work on a cell's value, shown as a dot (`IDLE` shows none). */
|
|
68
|
+
var SpreadsheetCellStatus = /* @__PURE__ */ function(SpreadsheetCellStatus) {
|
|
69
|
+
/** Nothing in progress: no dot. */
|
|
70
|
+
SpreadsheetCellStatus["IDLE"] = "IDLE";
|
|
71
|
+
/** Queued. */
|
|
72
|
+
SpreadsheetCellStatus["PENDING"] = "PENDING";
|
|
73
|
+
/** In progress: the dot pulses. */
|
|
74
|
+
SpreadsheetCellStatus["RUNNING"] = "RUNNING";
|
|
75
|
+
/** Finished. */
|
|
76
|
+
SpreadsheetCellStatus["COMPLETE"] = "COMPLETE";
|
|
77
|
+
/** Failed. */
|
|
78
|
+
SpreadsheetCellStatus["ERROR"] = "ERROR";
|
|
79
|
+
return SpreadsheetCellStatus;
|
|
80
|
+
}({});
|
|
81
|
+
var INFINITE_SPREADSHEET_SIZE_TO_TABLE_METRICS_MAP = {
|
|
82
|
+
["SMALL"]: TABLE_SMALL_METRICS,
|
|
83
|
+
["MEDIUM"]: TABLE_MEDIUM_METRICS,
|
|
84
|
+
["LARGE"]: TABLE_LARGE_METRICS
|
|
85
|
+
};
|
|
86
|
+
var INFINITE_SPREADSHEET_SIZE_TO_INPUT_SIZE_MAP = {
|
|
87
|
+
["SMALL"]: InputSize.SMALL,
|
|
88
|
+
["MEDIUM"]: InputSize.MEDIUM,
|
|
89
|
+
["LARGE"]: InputSize.LARGE
|
|
90
|
+
};
|
|
91
|
+
var INFINITE_SPREADSHEET_SIZE_TO_SELECT_INPUT_SIZE_MAP = {
|
|
92
|
+
["SMALL"]: SelectInputSize.SMALL,
|
|
93
|
+
["MEDIUM"]: SelectInputSize.MEDIUM,
|
|
94
|
+
["LARGE"]: SelectInputSize.LARGE
|
|
95
|
+
};
|
|
96
|
+
var INFINITE_SPREADSHEET_SIZE_TO_DATE_INPUT_SIZE_MAP = {
|
|
97
|
+
["SMALL"]: DateInputSize.SMALL,
|
|
98
|
+
["MEDIUM"]: DateInputSize.MEDIUM,
|
|
99
|
+
["LARGE"]: DateInputSize.LARGE
|
|
100
|
+
};
|
|
101
|
+
var INFINITE_SPREADSHEET_SIZE_TO_SWITCH_INPUT_SIZE_MAP = {
|
|
102
|
+
["SMALL"]: SwitchInputSize.SMALL,
|
|
103
|
+
["MEDIUM"]: SwitchInputSize.MEDIUM,
|
|
104
|
+
["LARGE"]: SwitchInputSize.LARGE
|
|
105
|
+
};
|
|
106
|
+
var INFINITE_SPREADSHEET_SIZE_TO_BEACON_SIZE_MAP = {
|
|
107
|
+
["SMALL"]: BeaconSize.SMALL,
|
|
108
|
+
["MEDIUM"]: BeaconSize.MEDIUM,
|
|
109
|
+
["LARGE"]: BeaconSize.LARGE
|
|
110
|
+
};
|
|
111
|
+
/** Icon px of an ENUM option's icon: the input rung's icon, one step below III-A.4 (Mitch, 2026-10-04). */
|
|
112
|
+
var INFINITE_SPREADSHEET_SIZE_TO_ICON_PX_MAP = {
|
|
113
|
+
["SMALL"]: 12,
|
|
114
|
+
["MEDIUM"]: 14,
|
|
115
|
+
["LARGE"]: 14
|
|
116
|
+
};
|
|
117
|
+
/** The trailing corner's button size in pixels (the metrics' `buttonSize` rung). */
|
|
118
|
+
var INFINITE_SPREADSHEET_SIZE_TO_BUTTON_PX_MAP = {
|
|
119
|
+
["SMALL"]: Number.parseFloat(CONTROL_SIZE.xSmall),
|
|
120
|
+
["MEDIUM"]: Number.parseFloat(CONTROL_SIZE.small),
|
|
121
|
+
["LARGE"]: Number.parseFloat(CONTROL_SIZE.medium)
|
|
122
|
+
};
|
|
123
|
+
/** The status dot's color. Running is `PRIMARY` (neutral, pulsing); there is no `INFO` status. */
|
|
124
|
+
var SPREADSHEET_CELL_STATUS_TO_BEACON_VARIANT_MAP = {
|
|
125
|
+
["IDLE"]: BeaconVariant.TERTIARY,
|
|
126
|
+
["PENDING"]: BeaconVariant.TERTIARY,
|
|
127
|
+
["RUNNING"]: BeaconVariant.PRIMARY,
|
|
128
|
+
["COMPLETE"]: BeaconVariant.SUCCESS,
|
|
129
|
+
["ERROR"]: BeaconVariant.ERROR
|
|
130
|
+
};
|
|
131
|
+
/** The status dot's accessible name. */
|
|
132
|
+
var SPREADSHEET_CELL_STATUS_TO_LABEL_MAP = {
|
|
133
|
+
["IDLE"]: "",
|
|
134
|
+
["PENDING"]: "Pending",
|
|
135
|
+
["RUNNING"]: "Running",
|
|
136
|
+
["COMPLETE"]: "Complete",
|
|
137
|
+
["ERROR"]: "Failed"
|
|
138
|
+
};
|
|
139
|
+
var SPREADSHEET_CELL_TYPE_TO_EDITOR_KIND_MAP = {
|
|
140
|
+
["TEXT"]: SpreadsheetEditorKind.TEXT,
|
|
141
|
+
["NUMBER"]: SpreadsheetEditorKind.NUMBER,
|
|
142
|
+
["BOOLEAN"]: SpreadsheetEditorKind.BOOLEAN,
|
|
143
|
+
["ENUM"]: SpreadsheetEditorKind.ENUM,
|
|
144
|
+
["DATE"]: SpreadsheetEditorKind.DATE
|
|
145
|
+
};
|
|
146
|
+
/** A cell's display: the status dot, then the value. */
|
|
147
|
+
var CellContent = /*#__PURE__*/ styled("div")({
|
|
148
|
+
name: "CellContent",
|
|
149
|
+
class: "gx-InfiniteSpreadsheet-CellContent-c19rlwda",
|
|
150
|
+
propsAsIs: false
|
|
151
|
+
});
|
|
152
|
+
/** An ENUM value: the option's icon and label. */
|
|
153
|
+
var EnumValue = /*#__PURE__*/ styled("span")({
|
|
154
|
+
name: "EnumValue",
|
|
155
|
+
class: "gx-InfiniteSpreadsheet-EnumValue-e1pc8s7a",
|
|
156
|
+
propsAsIs: false
|
|
157
|
+
});
|
|
158
|
+
/** The icon-to-label gap of an ENUM value: SelectInput's gap at the editor's rung. */
|
|
159
|
+
var INFINITE_SPREADSHEET_SIZE_TO_ENUM_GAP_CSS_MAP = {
|
|
160
|
+
["SMALL"]: "gx-InfiniteSpreadsheet-SMALL-ssqy8uo",
|
|
161
|
+
["MEDIUM"]: "gx-InfiniteSpreadsheet-MEDIUM-m1lgem46",
|
|
162
|
+
["LARGE"]: "gx-InfiniteSpreadsheet-LARGE-lyl2afm"
|
|
163
|
+
};
|
|
164
|
+
/** The add-row row: after the last row, its button pinned to the visible left edge. */
|
|
165
|
+
var AddRow = /*#__PURE__*/ styled("tr")({
|
|
166
|
+
name: "AddRow",
|
|
167
|
+
class: "gx-InfiniteSpreadsheet-AddRow-a1ral1dk",
|
|
168
|
+
propsAsIs: false
|
|
169
|
+
});
|
|
170
|
+
var AddRowCell = /*#__PURE__*/ styled("td")({
|
|
171
|
+
name: "AddRowCell",
|
|
172
|
+
class: "gx-InfiniteSpreadsheet-AddRowCell-agvcmj7",
|
|
173
|
+
propsAsIs: false
|
|
174
|
+
});
|
|
175
|
+
var AddRowViewport = /*#__PURE__*/ styled("div")({
|
|
176
|
+
name: "AddRowViewport",
|
|
177
|
+
class: "gx-InfiniteSpreadsheet-AddRowViewport-ackajun",
|
|
178
|
+
propsAsIs: false
|
|
179
|
+
});
|
|
180
|
+
/** The trailing corner's controls side by side. */
|
|
181
|
+
var CornerControls = /*#__PURE__*/ styled("div")({
|
|
182
|
+
name: "CornerControls",
|
|
183
|
+
class: "gx-InfiniteSpreadsheet-CornerControls-c1n4ne6",
|
|
184
|
+
propsAsIs: false
|
|
185
|
+
});
|
|
186
|
+
/** No focus ring of the browser's own on an unselected cell (the selected outline is the indicator). */
|
|
187
|
+
var CELL_FOCUS_CSS = "gx-InfiniteSpreadsheet-CELL_FOCUS_CSS-cddbf9b";
|
|
188
|
+
/** A cell the user can edit: the 1.x per-cell hover. */
|
|
189
|
+
var CELL_EDITABLE_CSS = "gx-InfiniteSpreadsheet-CELL_EDITABLE_CSS-c1ejud51";
|
|
190
|
+
/** The roving cell while the grid holds focus: the current cell is always visible . */
|
|
191
|
+
var CELL_SELECTED_CSS = "gx-InfiniteSpreadsheet-CELL_SELECTED_CSS-cw8kq87";
|
|
192
|
+
/**
|
|
193
|
+
* The cell being edited: the bare editor fills it inside the same padding as the read-only cell
|
|
194
|
+
* (so the text does not move), above pinned neighbours.
|
|
195
|
+
*/
|
|
196
|
+
var CELL_EDITING_CSS = "gx-InfiniteSpreadsheet-CELL_EDITING_CSS-c1dhzhlk";
|
|
197
|
+
/** The trailing corner, as wide as its header controls (header, footer and body cells). */
|
|
198
|
+
var TRAILING_CSS = "gx-InfiniteSpreadsheet-TRAILING_CSS-tfgc5gq";
|
|
199
|
+
/** Spread on the row-actions trigger: the cell is the tab stop, not the button. */
|
|
200
|
+
var UNTABBABLE = { tabIndex: -1 };
|
|
201
|
+
var DATE_FORMAT_OPTIONS = { dateStyle: "medium" };
|
|
202
|
+
/** Two cell values are the same (dates by time; a TEXT `null` edits as `""`). */
|
|
203
|
+
function isSameValue(type, current, next) {
|
|
204
|
+
if (current instanceof Date || next instanceof Date) return current instanceof Date && next instanceof Date && current.getTime() === next.getTime();
|
|
205
|
+
if (type === "TEXT") return Object.is(current ?? "", next ?? "");
|
|
206
|
+
return Object.is(current, next);
|
|
207
|
+
}
|
|
208
|
+
/** The value of a cell as text, by type (custom `cell` replaces it). */
|
|
209
|
+
function CellDisplay({ column, value, metrics, iconPx, enumGapCss }) {
|
|
210
|
+
if (column.cellType === "ENUM" && typeof value === "string" && value !== "") {
|
|
211
|
+
const option = column.options.find((candidate) => candidate.id === value);
|
|
212
|
+
return /* @__PURE__ */ jsxs(EnumValue, {
|
|
213
|
+
className: enumGapCss,
|
|
214
|
+
children: [option?.icon !== void 0 && /* @__PURE__ */ jsx(Icon, {
|
|
215
|
+
component: option.icon,
|
|
216
|
+
size: iconPx,
|
|
217
|
+
variant: IconVariant.SECONDARY
|
|
218
|
+
}), /* @__PURE__ */ jsx(Text, {
|
|
219
|
+
as: "span",
|
|
220
|
+
size: metrics.textSize,
|
|
221
|
+
lineClamp: 1,
|
|
222
|
+
shouldTooltipOnOverflow: true,
|
|
223
|
+
className: CELL_TEXT_CSS,
|
|
224
|
+
...option === void 0 ? { variant: TextVariant.TERTIARY } : {},
|
|
225
|
+
children: option?.label ?? value
|
|
226
|
+
})]
|
|
227
|
+
});
|
|
228
|
+
}
|
|
229
|
+
if (value instanceof Date) return /* @__PURE__ */ jsx(Text, {
|
|
230
|
+
as: "span",
|
|
231
|
+
size: metrics.textSize,
|
|
232
|
+
lineClamp: 1,
|
|
233
|
+
shouldTooltipOnOverflow: true,
|
|
234
|
+
isTabular: true,
|
|
235
|
+
className: CELL_TEXT_CSS,
|
|
236
|
+
children: new Intl.DateTimeFormat(void 0, DATE_FORMAT_OPTIONS).format(value)
|
|
44
237
|
});
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
columnSizing: resize.columnSizing,
|
|
49
|
-
rightOffsetBase: actionColumnWidth
|
|
238
|
+
return /* @__PURE__ */ jsx(TableCellText, {
|
|
239
|
+
value,
|
|
240
|
+
textSize: metrics.textSize
|
|
50
241
|
});
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
242
|
+
}
|
|
243
|
+
/** One grid row: a cell per visible column, then the trailing (row actions) cell. */
|
|
244
|
+
var SpreadsheetRow = memo(function SpreadsheetRow({ row, rowIndex, rowId, columns, metrics, size, callbacks, tabStopColumn, hasGridFocus, editingColumnId, editEntry, draftRef, hasRowActions, hasTrailingColumn, isActionsOpen, isBorderless, ariaRowIndex, style }) {
|
|
245
|
+
const isLoaded = row !== void 0;
|
|
246
|
+
const editorSizes = {
|
|
247
|
+
input: INFINITE_SPREADSHEET_SIZE_TO_INPUT_SIZE_MAP[size],
|
|
248
|
+
select: INFINITE_SPREADSHEET_SIZE_TO_SELECT_INPUT_SIZE_MAP[size],
|
|
249
|
+
date: INFINITE_SPREADSHEET_SIZE_TO_DATE_INPUT_SIZE_MAP[size],
|
|
250
|
+
switchInput: INFINITE_SPREADSHEET_SIZE_TO_SWITCH_INPUT_SIZE_MAP[size]
|
|
251
|
+
};
|
|
252
|
+
const actionsColumn = columns.length;
|
|
253
|
+
const actions = hasRowActions && isLoaded && callbacks.getRowActions ? callbacks.getRowActions(row, rowIndex) : null;
|
|
254
|
+
const cellHandlers = (columnIndex) => ({
|
|
255
|
+
ref: (element) => callbacks.registerCell(rowIndex, columnIndex, element),
|
|
256
|
+
tabIndex: tabStopColumn === columnIndex ? 0 : -1,
|
|
257
|
+
onFocus: (event) => {
|
|
258
|
+
if (event.currentTarget.contains(event.target)) callbacks.onCellFocus(rowIndex, columnIndex);
|
|
259
|
+
},
|
|
260
|
+
onKeyDown: (event) => callbacks.onCellKeyDown(rowIndex, columnIndex, event)
|
|
54
261
|
});
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
262
|
+
return /* @__PURE__ */ jsxs(TableRow, {
|
|
263
|
+
role: "row",
|
|
264
|
+
"aria-rowindex": ariaRowIndex,
|
|
265
|
+
...isLoaded ? {} : { "aria-busy": true },
|
|
266
|
+
className: cx(VIRTUAL_ROW_CSS, isBorderless && "gx-TableCore-ROW_NO_BORDER_CSS-rpsswqs"),
|
|
267
|
+
style,
|
|
268
|
+
children: [columns.map((resolved, columnIndex) => {
|
|
269
|
+
const column = resolved.column;
|
|
270
|
+
const { pin, isPinEdge, cellStyle } = resolved;
|
|
271
|
+
const isEditing = editingColumnId === column.id;
|
|
272
|
+
const isEditable = isLoaded && column.isReadOnly !== true;
|
|
273
|
+
const isSelected = hasGridFocus && tabStopColumn === columnIndex;
|
|
274
|
+
const handlers = cellHandlers(columnIndex);
|
|
275
|
+
let content;
|
|
276
|
+
if (!isLoaded) content = /* @__PURE__ */ jsx(Skeleton, {
|
|
277
|
+
variant: SkeletonVariant.TEXT,
|
|
278
|
+
size: metrics.skeletonSize
|
|
279
|
+
});
|
|
280
|
+
else if (isEditing) content = /* @__PURE__ */ jsx(SpreadsheetCellEditor, {
|
|
281
|
+
kind: SPREADSHEET_CELL_TYPE_TO_EDITOR_KIND_MAP[column.cellType],
|
|
282
|
+
value: column.accessor(row),
|
|
283
|
+
header: column.header,
|
|
284
|
+
options: column.cellType === "ENUM" ? column.options : void 0,
|
|
285
|
+
sizes: editorSizes,
|
|
286
|
+
entry: editEntry,
|
|
287
|
+
draftRef,
|
|
288
|
+
onCommit: callbacks.onCommit,
|
|
289
|
+
onCancel: callbacks.onCancel,
|
|
290
|
+
onTab: callbacks.onTab,
|
|
291
|
+
onPanelOpenChange: callbacks.onPanelOpenChange
|
|
292
|
+
});
|
|
293
|
+
else {
|
|
294
|
+
const value = column.accessor(row);
|
|
295
|
+
const status = column.getCellStatus?.(row, rowIndex) ?? "IDLE";
|
|
296
|
+
content = /* @__PURE__ */ jsxs(CellContent, { children: [status !== "IDLE" && /* @__PURE__ */ jsx(Beacon, {
|
|
297
|
+
size: INFINITE_SPREADSHEET_SIZE_TO_BEACON_SIZE_MAP[size],
|
|
298
|
+
variant: SPREADSHEET_CELL_STATUS_TO_BEACON_VARIANT_MAP[status],
|
|
299
|
+
isPulse: status === "RUNNING",
|
|
300
|
+
ariaLabel: SPREADSHEET_CELL_STATUS_TO_LABEL_MAP[status]
|
|
301
|
+
}), column.cell ? column.cell({
|
|
302
|
+
value,
|
|
303
|
+
row,
|
|
304
|
+
rowIndex,
|
|
305
|
+
rowId
|
|
306
|
+
}) : /* @__PURE__ */ jsx(CellDisplay, {
|
|
307
|
+
column,
|
|
308
|
+
value,
|
|
309
|
+
metrics,
|
|
310
|
+
iconPx: INFINITE_SPREADSHEET_SIZE_TO_ICON_PX_MAP[size],
|
|
311
|
+
enumGapCss: INFINITE_SPREADSHEET_SIZE_TO_ENUM_GAP_CSS_MAP[size]
|
|
312
|
+
})] });
|
|
313
|
+
}
|
|
314
|
+
return /* @__PURE__ */ jsx(TableCell, {
|
|
315
|
+
...handlers,
|
|
316
|
+
ref: (element) => {
|
|
317
|
+
handlers.ref(element);
|
|
318
|
+
if (isEditing) callbacks.registerEditingCell(element);
|
|
319
|
+
},
|
|
320
|
+
role: column.isRowHeader === true ? "rowheader" : "gridcell",
|
|
321
|
+
"aria-colindex": columnIndex + 1,
|
|
322
|
+
...isEditable ? {} : { "aria-readonly": true },
|
|
323
|
+
className: cx(COLUMN_ALIGN_TO_CSS_MAP[column.align ?? "left"], pin !== void 0 && PIN_TO_CSS_MAP[pin], pin !== void 0 && isPinEdge && PIN_TO_EDGE_CSS_MAP[pin], CELL_FOCUS_CSS, isEditable && !isEditing && CELL_EDITABLE_CSS, isSelected && CELL_SELECTED_CSS, isEditing && CELL_EDITING_CSS),
|
|
324
|
+
style: cellStyle,
|
|
325
|
+
onPointerDown: (event) => callbacks.onCellPointerDown(rowIndex, columnIndex, event.currentTarget),
|
|
326
|
+
onClick: () => callbacks.onCellClick(rowIndex, columnIndex),
|
|
327
|
+
onDoubleClick: () => callbacks.onCellDoubleClick(rowIndex, columnIndex),
|
|
328
|
+
children: content
|
|
329
|
+
}, column.id);
|
|
330
|
+
}), hasTrailingColumn && (hasRowActions ? /* @__PURE__ */ jsx(TableCell, {
|
|
331
|
+
...cellHandlers(actionsColumn),
|
|
332
|
+
role: "gridcell",
|
|
333
|
+
"aria-colindex": actionsColumn + 1,
|
|
334
|
+
className: cx("gx-TableCore-SYNTHETIC_CELL_CSS-s1g01kh5", PIN_TO_CSS_MAP[Side.RIGHT], TRAILING_CSS, CELL_FOCUS_CSS, hasGridFocus && tabStopColumn === actionsColumn && CELL_SELECTED_CSS),
|
|
335
|
+
children: actions !== null && actions !== void 0 && /* @__PURE__ */ jsx(Menu, {
|
|
336
|
+
isOpen: isActionsOpen,
|
|
337
|
+
onOpenChange: (isOpen) => callbacks.onActionsOpenChange(rowId, isOpen),
|
|
338
|
+
trigger: /* @__PURE__ */ jsx(Button, {
|
|
339
|
+
icon: DotsThreeIcon,
|
|
340
|
+
variant: ButtonVariant.TERTIARY,
|
|
341
|
+
size: metrics.buttonSize,
|
|
342
|
+
ariaLabel: `Actions for ${callbacks.getRowName(row, rowIndex)}`,
|
|
343
|
+
...UNTABBABLE
|
|
344
|
+
}),
|
|
345
|
+
size: metrics.menuSize,
|
|
346
|
+
placement: Placement.BOTTOM_END,
|
|
347
|
+
children: actions
|
|
348
|
+
})
|
|
349
|
+
}) : /* @__PURE__ */ jsx(TableCell, {
|
|
350
|
+
role: "gridcell",
|
|
351
|
+
"aria-colindex": actionsColumn + 1,
|
|
352
|
+
"aria-readonly": true,
|
|
353
|
+
className: cx("gx-TableCore-SYNTHETIC_CELL_CSS-s1g01kh5", PIN_TO_CSS_MAP[Side.RIGHT], TRAILING_CSS)
|
|
354
|
+
}))]
|
|
61
355
|
});
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
356
|
+
});
|
|
357
|
+
/** `data-*` and `id` to the root, `aria-*` to the `<table>`. */
|
|
358
|
+
function splitPassthrough(rest) {
|
|
359
|
+
const rootProps = {};
|
|
360
|
+
const tableAria = {};
|
|
361
|
+
for (const [key, value] of Object.entries(rest)) if (key.startsWith("data-")) rootProps[key] = value;
|
|
362
|
+
else if (key.startsWith("aria-")) tableAria[key] = value;
|
|
363
|
+
return {
|
|
364
|
+
rootProps,
|
|
365
|
+
tableAria
|
|
366
|
+
};
|
|
367
|
+
}
|
|
368
|
+
/** A printable character that starts editing a TEXT / NUMBER cell. */
|
|
369
|
+
var isPrintableKey = (event) => event.key.length === 1 && !event.ctrlKey && !event.metaKey && !event.altKey;
|
|
370
|
+
var SPACE_4 = Number.parseFloat(SPACE[4]);
|
|
371
|
+
var SPACE_8 = Number.parseFloat(SPACE[8]);
|
|
372
|
+
/** The editable grid. */
|
|
373
|
+
var InfiniteSpreadsheetInner = forwardRef(function InfiniteSpreadsheet(props, ref) {
|
|
374
|
+
const { columns, totalRowCount, getRowData, getRowId, size: sizeProp, isLoading: isLoadingProp, error: errorProp, emptyState, onEndReached, rowActions, onAddRow, onAddColumn, editingCell, onEditingCellChange, columnLayout, defaultColumnLayout, onColumnLayoutChange, canCustomizeColumns: canCustomizeColumnsProp, ariaLabel, id, className, style, ...rest } = props;
|
|
375
|
+
const error = errorProp === "" ? void 0 : errorProp;
|
|
376
|
+
const size = sizeProp ?? "MEDIUM";
|
|
377
|
+
const isLoading = isLoadingProp ?? false;
|
|
378
|
+
const canCustomizeColumns = canCustomizeColumnsProp ?? false;
|
|
379
|
+
const rowCount = Math.max(0, Math.floor(totalRowCount));
|
|
380
|
+
const metrics = INFINITE_SPREADSHEET_SIZE_TO_TABLE_METRICS_MAP[size];
|
|
381
|
+
const scrollRef = useRef(null);
|
|
382
|
+
const { rootProps, tableAria } = splitPassthrough(rest);
|
|
383
|
+
if (id !== void 0) rootProps.id = id;
|
|
384
|
+
const hasRowActions = rowActions !== void 0;
|
|
385
|
+
const hasTrailingColumn = hasRowActions || onAddColumn !== void 0 || canCustomizeColumns;
|
|
386
|
+
const cornerButtons = (canCustomizeColumns ? 1 : 0) + (onAddColumn !== void 0 ? 1 : 0);
|
|
387
|
+
const buttonPx = INFINITE_SPREADSHEET_SIZE_TO_BUTTON_PX_MAP[size];
|
|
388
|
+
const trailingWidthPx = Math.max(metrics.rowHeightPx, cornerButtons * buttonPx + Math.max(0, cornerButtons - 1) * SPACE_4 + 2 * SPACE_8);
|
|
389
|
+
const layout = useTableColumnLayout({
|
|
390
|
+
columns: useMemo(() => columns.map((column) => column.cellType === "NUMBER" && column.align === void 0 ? {
|
|
391
|
+
...column,
|
|
392
|
+
align: "right"
|
|
393
|
+
} : column), [columns]),
|
|
394
|
+
columnLayout,
|
|
395
|
+
defaultColumnLayout: defaultColumnLayout ?? {},
|
|
396
|
+
onColumnLayoutChange,
|
|
397
|
+
canResizeColumns: true,
|
|
398
|
+
canCustomizeColumns,
|
|
399
|
+
leadingCount: 0,
|
|
400
|
+
hasTrailing: hasTrailingColumn,
|
|
401
|
+
syntheticWidthPx: trailingWidthPx
|
|
70
402
|
});
|
|
71
|
-
const
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
403
|
+
const visibleColumns = layout.visibleColumns;
|
|
404
|
+
const hasFooter = visibleColumns.some(({ column }) => column.footer !== void 0 && column.footer !== null);
|
|
405
|
+
const columnCount = visibleColumns.length + (hasRowActions ? 1 : 0);
|
|
406
|
+
const resolveRowId = useCallback((row, index) => getRowId ? getRowId(row, index) : String(index), [getRowId]);
|
|
407
|
+
const [editing, setEditing] = useControlledState({
|
|
408
|
+
value: editingCell,
|
|
409
|
+
defaultValue: null,
|
|
410
|
+
onChange: onEditingCellChange
|
|
76
411
|
});
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
const
|
|
82
|
-
|
|
412
|
+
const [editEntry, setEditEntry] = useState({ kind: "select" });
|
|
413
|
+
const isPanelOpenRef = useRef(false);
|
|
414
|
+
const draftRef = useRef(null);
|
|
415
|
+
const editingElementRef = useRef(null);
|
|
416
|
+
const [openActionsRowId, setOpenActionsRowId] = useState(null);
|
|
417
|
+
const [hasGridFocus, setHasGridFocus] = useState(false);
|
|
418
|
+
const virtualizerRef = useRef(null);
|
|
419
|
+
const navigation = useSpreadsheetCellNavigation({
|
|
420
|
+
rowCount,
|
|
421
|
+
columnCount,
|
|
422
|
+
getPageSize: useCallback(() => {
|
|
423
|
+
const scroll = scrollRef.current;
|
|
424
|
+
if (scroll === null) return 1;
|
|
425
|
+
return Math.max(1, Math.floor((scroll.clientHeight - metrics.headerHeightPx) / metrics.rowHeightPx) - 1);
|
|
426
|
+
}, [metrics.rowHeightPx, metrics.headerHeightPx]),
|
|
427
|
+
scrollToIndex: (index) => virtualizerRef.current?.scrollToIndex(index)
|
|
428
|
+
});
|
|
429
|
+
const editingRowIndex = editing !== null && editing.rowIndex < rowCount ? editing.rowIndex : -1;
|
|
430
|
+
const getItemKey = useCallback((index) => {
|
|
431
|
+
const row = getRowData(index);
|
|
432
|
+
return row === void 0 ? index : resolveRowId(row, index);
|
|
433
|
+
}, [getRowData, resolveRowId]);
|
|
434
|
+
const keepIndexes = rowCount > 0 ? [navigation.active.rowIndex] : [];
|
|
435
|
+
if (editingRowIndex >= 0) keepIndexes.push(editingRowIndex);
|
|
436
|
+
const virtualizer = useTableVirtualizer({
|
|
437
|
+
count: rowCount,
|
|
438
|
+
scrollRef,
|
|
439
|
+
rowHeightPx: metrics.rowHeightPx,
|
|
440
|
+
headerHeightPx: metrics.headerHeightPx,
|
|
441
|
+
footerHeightPx: hasFooter ? metrics.headerHeightPx : 0,
|
|
442
|
+
getItemKey,
|
|
443
|
+
keepIndexes
|
|
444
|
+
});
|
|
445
|
+
virtualizerRef.current = { scrollToIndex: (index) => virtualizer.scrollToIndex(index, { align: "auto" }) };
|
|
446
|
+
const [isMounted, setIsMounted] = useState(false);
|
|
447
|
+
useIsomorphicLayoutEffect(() => setIsMounted(true), []);
|
|
448
|
+
const latest = {
|
|
449
|
+
columns,
|
|
450
|
+
visibleColumns,
|
|
83
451
|
getRowData,
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
452
|
+
resolveRowId,
|
|
453
|
+
rowActions,
|
|
454
|
+
editing,
|
|
455
|
+
setEditing,
|
|
456
|
+
navigation,
|
|
457
|
+
hasRowActions
|
|
458
|
+
};
|
|
459
|
+
const latestRef = useRef(latest);
|
|
460
|
+
latestRef.current = latest;
|
|
461
|
+
const wasSelectedRef = useRef(false);
|
|
462
|
+
const { startEdit, commitValue, finishEdit, callbacks } = useMemo(() => {
|
|
463
|
+
const columnAt = (columnIndex) => latestRef.current.visibleColumns[columnIndex]?.column;
|
|
464
|
+
/** Starts editing a cell (loaded rows, editable columns only). */
|
|
465
|
+
const startEdit = (rowIndex, columnIndex, entry) => {
|
|
466
|
+
const column = columnAt(columnIndex);
|
|
467
|
+
if (column === void 0 || column.isReadOnly === true) return false;
|
|
468
|
+
if (latestRef.current.getRowData(rowIndex) === void 0) return false;
|
|
469
|
+
isPanelOpenRef.current = column.cellType === "ENUM" || column.cellType === "DATE";
|
|
470
|
+
setEditEntry(entry);
|
|
471
|
+
latestRef.current.setEditing({
|
|
472
|
+
rowIndex,
|
|
473
|
+
columnId: column.id
|
|
474
|
+
});
|
|
475
|
+
return true;
|
|
476
|
+
};
|
|
477
|
+
/** Reports `next` for a cell if it changed. */
|
|
478
|
+
const commitValue = (rowIndex, columnId, next) => {
|
|
479
|
+
const column = latestRef.current.columns.find((candidate) => candidate.id === columnId);
|
|
480
|
+
const row = latestRef.current.getRowData(rowIndex);
|
|
481
|
+
if (column === void 0 || row === void 0 || column.isReadOnly === true) return;
|
|
482
|
+
const current = column.accessor(row);
|
|
483
|
+
if (isSameValue(column.cellType, current, next)) return;
|
|
484
|
+
column.onCellChange?.(next, row, rowIndex);
|
|
485
|
+
};
|
|
486
|
+
/** Ends editing (after any commit) and, unless the press went elsewhere, focuses a cell. */
|
|
487
|
+
const finishEdit = (focus) => {
|
|
488
|
+
isPanelOpenRef.current = false;
|
|
489
|
+
editingElementRef.current = null;
|
|
490
|
+
latestRef.current.setEditing(null);
|
|
491
|
+
if (focus !== null) latestRef.current.navigation.focusCell(focus.rowIndex, focus.columnIndex);
|
|
492
|
+
};
|
|
493
|
+
return {
|
|
494
|
+
startEdit,
|
|
495
|
+
commitValue,
|
|
496
|
+
finishEdit,
|
|
497
|
+
callbacks: (() => {
|
|
498
|
+
const editingTarget = () => {
|
|
499
|
+
const current = latestRef.current.editing;
|
|
500
|
+
if (current === null) return null;
|
|
501
|
+
const columnIndex = latestRef.current.visibleColumns.findIndex((entry) => entry.column.id === current.columnId);
|
|
502
|
+
return {
|
|
503
|
+
...current,
|
|
504
|
+
columnIndex: Math.max(0, columnIndex)
|
|
505
|
+
};
|
|
506
|
+
};
|
|
507
|
+
return {
|
|
508
|
+
registerCell: (rowIndex, columnIndex, element) => latestRef.current.navigation.registerCell(rowIndex, columnIndex, element),
|
|
509
|
+
registerEditingCell: (element) => {
|
|
510
|
+
if (element !== null) editingElementRef.current = element;
|
|
511
|
+
},
|
|
512
|
+
onCellFocus: (rowIndex, columnIndex) => latestRef.current.navigation.handleCellFocus(rowIndex, columnIndex),
|
|
513
|
+
onCellKeyDown: (rowIndex, columnIndex, event) => {
|
|
514
|
+
const current = latestRef.current;
|
|
515
|
+
const isActionsCell = current.hasRowActions && columnIndex === current.visibleColumns.length;
|
|
516
|
+
if (event.target !== event.currentTarget && !isActionsCell) return;
|
|
517
|
+
const editingNow = current.editing;
|
|
518
|
+
const column = columnAt(columnIndex);
|
|
519
|
+
if (editingNow !== null && editingNow.rowIndex === rowIndex && column !== void 0 && editingNow.columnId === column.id) return;
|
|
520
|
+
if (current.navigation.handleNavigationKey({
|
|
521
|
+
rowIndex,
|
|
522
|
+
columnIndex
|
|
523
|
+
}, event)) return;
|
|
524
|
+
const row = current.getRowData(rowIndex);
|
|
525
|
+
const isMenuKey = event.key === "F10" && event.shiftKey || event.key === "ContextMenu";
|
|
526
|
+
if (row !== void 0 && current.rowActions !== void 0 && (isMenuKey || isActionsCell && (event.key === "Enter" || event.key === " "))) {
|
|
527
|
+
const actions = current.rowActions(row, rowIndex);
|
|
528
|
+
if (actions === null || actions === void 0) return;
|
|
529
|
+
event.preventDefault();
|
|
530
|
+
setOpenActionsRowId(current.resolveRowId(row, rowIndex));
|
|
531
|
+
return;
|
|
532
|
+
}
|
|
533
|
+
if (column === void 0 || isActionsCell) return;
|
|
534
|
+
if (event.key === " ") event.preventDefault();
|
|
535
|
+
if (row === void 0 || column.isReadOnly === true) return;
|
|
536
|
+
if (event.key === "Enter" || event.key === "F2") {
|
|
537
|
+
event.preventDefault();
|
|
538
|
+
startEdit(rowIndex, columnIndex, { kind: "select" });
|
|
539
|
+
} else if (event.key === " " && column.cellType === "BOOLEAN") commitValue(rowIndex, column.id, column.accessor(row) !== true);
|
|
540
|
+
else if (isPrintableKey(event) && (column.cellType === "TEXT" || column.cellType === "NUMBER")) {
|
|
541
|
+
event.preventDefault();
|
|
542
|
+
startEdit(rowIndex, columnIndex, {
|
|
543
|
+
kind: "char",
|
|
544
|
+
char: event.key
|
|
545
|
+
});
|
|
546
|
+
}
|
|
547
|
+
},
|
|
548
|
+
onCellPointerDown: (rowIndex, columnIndex, element) => {
|
|
549
|
+
const { active } = latestRef.current.navigation;
|
|
550
|
+
wasSelectedRef.current = active.rowIndex === rowIndex && active.columnIndex === columnIndex && element.ownerDocument.activeElement === element;
|
|
551
|
+
},
|
|
552
|
+
onCellClick: (rowIndex, columnIndex) => {
|
|
553
|
+
const editingNow = latestRef.current.editing;
|
|
554
|
+
const column = columnAt(columnIndex);
|
|
555
|
+
if (editingNow !== null && editingNow.rowIndex === rowIndex && editingNow.columnId === column?.id) return;
|
|
556
|
+
if (wasSelectedRef.current) startEdit(rowIndex, columnIndex, { kind: "select" });
|
|
557
|
+
wasSelectedRef.current = false;
|
|
558
|
+
},
|
|
559
|
+
onCellDoubleClick: (rowIndex, columnIndex) => {
|
|
560
|
+
const editingNow = latestRef.current.editing;
|
|
561
|
+
const column = columnAt(columnIndex);
|
|
562
|
+
if (editingNow !== null && editingNow.rowIndex === rowIndex && editingNow.columnId === column?.id) return;
|
|
563
|
+
startEdit(rowIndex, columnIndex, { kind: "select" });
|
|
564
|
+
},
|
|
565
|
+
onCommit: (value) => {
|
|
566
|
+
const target = editingTarget();
|
|
567
|
+
if (target === null) return;
|
|
568
|
+
commitValue(target.rowIndex, target.columnId, value);
|
|
569
|
+
finishEdit({
|
|
570
|
+
rowIndex: target.rowIndex,
|
|
571
|
+
columnIndex: target.columnIndex
|
|
572
|
+
});
|
|
573
|
+
},
|
|
574
|
+
onCancel: () => {
|
|
575
|
+
const target = editingTarget();
|
|
576
|
+
if (target === null) return;
|
|
577
|
+
finishEdit({
|
|
578
|
+
rowIndex: target.rowIndex,
|
|
579
|
+
columnIndex: target.columnIndex
|
|
580
|
+
});
|
|
581
|
+
},
|
|
582
|
+
onTab: (value, isBackward) => {
|
|
583
|
+
const target = editingTarget();
|
|
584
|
+
if (target === null) return;
|
|
585
|
+
commitValue(target.rowIndex, target.columnId, value);
|
|
586
|
+
const last = latestRef.current.visibleColumns.length - 1 + (latestRef.current.hasRowActions ? 1 : 0);
|
|
587
|
+
const next = Math.min(Math.max(target.columnIndex + (isBackward ? -1 : 1), 0), last);
|
|
588
|
+
finishEdit({
|
|
589
|
+
rowIndex: target.rowIndex,
|
|
590
|
+
columnIndex: next
|
|
591
|
+
});
|
|
592
|
+
},
|
|
593
|
+
onPanelOpenChange: (isOpen) => {
|
|
594
|
+
isPanelOpenRef.current = isOpen;
|
|
595
|
+
},
|
|
596
|
+
onActionsOpenChange: (rowId, isOpen) => setOpenActionsRowId((current) => isOpen ? rowId : current === rowId ? null : current),
|
|
597
|
+
getRowActions: (row, rowIndex) => latestRef.current.rowActions?.(row, rowIndex),
|
|
598
|
+
getRowName: (row, rowIndex) => {
|
|
599
|
+
const name = latestRef.current.columns.find((column) => column.isRowHeader === true)?.accessor(row);
|
|
600
|
+
return name === void 0 || name === null || name === "" ? `row ${rowIndex + 1}` : String(name);
|
|
601
|
+
}
|
|
602
|
+
};
|
|
603
|
+
})()
|
|
604
|
+
};
|
|
605
|
+
}, []);
|
|
606
|
+
const isEditing = editing !== null;
|
|
607
|
+
useEffect(() => {
|
|
608
|
+
if (!isEditing) return;
|
|
609
|
+
const handlePointerDown = (event) => {
|
|
610
|
+
if (isPanelOpenRef.current) return;
|
|
611
|
+
const element = editingElementRef.current;
|
|
612
|
+
const target = event.target;
|
|
613
|
+
if (element !== null && target instanceof Node && element.contains(target)) return;
|
|
614
|
+
const current = latestRef.current.editing;
|
|
615
|
+
if (current === null) return;
|
|
616
|
+
const draft = draftRef.current?.();
|
|
617
|
+
if (draft !== void 0) commitValue(current.rowIndex, current.columnId, draft);
|
|
618
|
+
finishEdit(null);
|
|
619
|
+
};
|
|
620
|
+
document.addEventListener("pointerdown", handlePointerDown, true);
|
|
621
|
+
return () => document.removeEventListener("pointerdown", handlePointerDown, true);
|
|
622
|
+
}, [
|
|
623
|
+
isEditing,
|
|
624
|
+
commitValue,
|
|
625
|
+
finishEdit
|
|
626
|
+
]);
|
|
627
|
+
useEffect(() => {
|
|
628
|
+
if (isEditing) return;
|
|
629
|
+
const root = scrollRef.current?.parentElement ?? null;
|
|
630
|
+
if (root === null) return;
|
|
631
|
+
const active = root.ownerDocument.activeElement;
|
|
632
|
+
if (active === null || !root.contains(active)) setHasGridFocus(false);
|
|
633
|
+
}, [isEditing]);
|
|
634
|
+
const pendingAddRef = useRef(null);
|
|
635
|
+
useEffect(() => {
|
|
636
|
+
const before = pendingAddRef.current;
|
|
637
|
+
if (before === null || rowCount <= before) return;
|
|
638
|
+
pendingAddRef.current = null;
|
|
639
|
+
const target = rowCount - 1;
|
|
640
|
+
const columnIndex = visibleColumns.findIndex(({ column }) => column.isReadOnly !== true);
|
|
641
|
+
if (columnIndex < 0) return;
|
|
642
|
+
navigation.focusCell(target, columnIndex);
|
|
643
|
+
startEdit(target, columnIndex, { kind: "select" });
|
|
644
|
+
}, [
|
|
645
|
+
rowCount,
|
|
646
|
+
visibleColumns,
|
|
647
|
+
navigation,
|
|
648
|
+
startEdit
|
|
649
|
+
]);
|
|
650
|
+
const handleAddRow = onAddRow ? () => {
|
|
651
|
+
pendingAddRef.current = rowCount;
|
|
652
|
+
onAddRow();
|
|
653
|
+
} : void 0;
|
|
654
|
+
rootProps.onFocus = () => setHasGridFocus(true);
|
|
655
|
+
rootProps.onBlur = (event) => {
|
|
656
|
+
const next = event.relatedTarget;
|
|
657
|
+
if (next instanceof Node && event.currentTarget.contains(next)) return;
|
|
658
|
+
setHasGridFocus(false);
|
|
659
|
+
};
|
|
660
|
+
const virtualItems = isMounted ? virtualizer.getVirtualItems() : [];
|
|
661
|
+
const totalSize = isMounted ? virtualizer.getTotalSize() : 0;
|
|
662
|
+
const showAddRow = handleAddRow !== void 0 && rowCount > 0 && !isLoading;
|
|
663
|
+
const bodyVariables = { "--gx-table-virtual-height": `${totalSize + (showAddRow ? metrics.rowHeightPx : 0)}px` };
|
|
664
|
+
const rootVariables = { "--gx-spreadsheet-trailing-width": `${trailingWidthPx}px` };
|
|
665
|
+
const hasStatusAfter = isLoading || error !== void 0;
|
|
666
|
+
const scrollMargin = virtualizer.options.scrollMargin;
|
|
667
|
+
const editingColumnIdAt = (rowIndex) => editing !== null && editing.rowIndex === rowIndex ? editing.columnId : null;
|
|
668
|
+
const startStylesRef = useRef(/* @__PURE__ */ new Map());
|
|
669
|
+
const startStyle = (start) => {
|
|
670
|
+
let cached = startStylesRef.current.get(start);
|
|
671
|
+
if (cached === void 0) {
|
|
672
|
+
cached = { "--gx-table-row-start": `${start}px` };
|
|
673
|
+
if (startStylesRef.current.size > 2e3) startStylesRef.current.clear();
|
|
674
|
+
startStylesRef.current.set(start, cached);
|
|
91
675
|
}
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
/** Initial load: normal flow, since the body has no virtual height yet. */
|
|
106
|
-
const renderLoadingRows = () => Array.from({ length: loadingRowCount }).map((_, rowIndex) => /* @__PURE__ */ jsx(TableLoadingRow, {
|
|
107
|
-
$density: density,
|
|
108
|
-
$variant: variant,
|
|
109
|
-
role: "row",
|
|
110
|
-
"aria-hidden": "true",
|
|
111
|
-
children: renderLoadingCells()
|
|
112
|
-
}, `loading-${rowIndex}`));
|
|
113
|
-
/**
|
|
114
|
-
* Paging: the body's children are absolutely positioned once virtualization
|
|
115
|
-
* is active, so these have to be offset past the last row rather than left in
|
|
116
|
-
* normal flow — otherwise they stack on top of the first visible rows.
|
|
117
|
-
*/
|
|
118
|
-
const renderTrailingLoadingRows = (startOffset) => Array.from({ length: loadingRowCount }).map((_, rowIndex) => /* @__PURE__ */ jsx(TableRow, {
|
|
119
|
-
$density: density,
|
|
120
|
-
$variant: variant,
|
|
121
|
-
$translateY: startOffset + rowIndex * rowHeight,
|
|
122
|
-
$rowHeight: rowHeight,
|
|
123
|
-
role: "row",
|
|
124
|
-
"aria-hidden": "true",
|
|
125
|
-
children: renderLoadingCells()
|
|
126
|
-
}, `loading-more-${rowIndex}`));
|
|
127
|
-
const showLoading = isLoading && totalRowCount === 0;
|
|
128
|
-
const showError = isError && totalRowCount === 0;
|
|
129
|
-
const showEmpty = totalRowCount === 0 && !isLoading && !isError && Boolean(contentWhenEmpty);
|
|
130
|
-
const showRows = !showLoading && !showError && !showEmpty;
|
|
131
|
-
const trailingLoadingHeight = isFetchingNextPage ? loadingRowCount * rowHeight : 0;
|
|
132
|
-
const statusAvailableHeight = (height !== void 0 || Boolean(fillHeight)) && viewportHeight !== void 0 ? Math.max(0, viewportHeight - (headerHeight ?? 0)) : void 0;
|
|
133
|
-
const columnCount = columns.length + (showActionColumn ? 1 : 0);
|
|
134
|
-
return /* @__PURE__ */ jsx(TableOuterContainer, {
|
|
135
|
-
$width: width,
|
|
136
|
-
$height: height,
|
|
137
|
-
$fillWidth: fillWidth,
|
|
138
|
-
$fillHeight: fillHeight,
|
|
139
|
-
children: /* @__PURE__ */ jsxs(TableScrollContainer, {
|
|
140
|
-
ref: scrollContainerRef,
|
|
141
|
-
$noLastRowPadding: noLastRowPadding,
|
|
142
|
-
children: [/* @__PURE__ */ jsxs(StyledTable, {
|
|
143
|
-
$rowMinWidth: rowMinWidth + actionColumnWidth,
|
|
144
|
-
role: "grid",
|
|
145
|
-
"aria-label": ariaLabel,
|
|
146
|
-
"aria-labelledby": ariaLabelledBy,
|
|
147
|
-
"aria-rowcount": totalRowCount + (noHeader ? 0 : 1),
|
|
148
|
-
"aria-colcount": columnCount,
|
|
149
|
-
children: [!noHeader && /* @__PURE__ */ jsx(TableHead, {
|
|
150
|
-
ref: headerRef,
|
|
151
|
-
role: "rowgroup",
|
|
152
|
-
children: /* @__PURE__ */ jsxs(TableHeaderRow, {
|
|
153
|
-
role: "row",
|
|
154
|
-
"aria-rowindex": 1,
|
|
155
|
-
children: [columns.map((col, columnIndex) => /* @__PURE__ */ jsx(SpreadsheetHeaderCell, {
|
|
156
|
-
column: col,
|
|
157
|
-
columnIndex,
|
|
158
|
-
width: getColumnWidth(col),
|
|
159
|
-
pinnedOffset: pinnedOffsets.get(col.id),
|
|
160
|
-
density,
|
|
161
|
-
variant,
|
|
162
|
-
rowsContext,
|
|
163
|
-
isResizable: canResizeColumn(col),
|
|
164
|
-
isResizing: resize.resizingColumnId === col.id,
|
|
165
|
-
resizeBounds: getColumnResizeBounds(col.id),
|
|
166
|
-
onResizeStart: startResize,
|
|
167
|
-
onResizeKeyDown: resizeByKeyboard
|
|
168
|
-
}, col.id)), showActionColumn && /* @__PURE__ */ jsx(ActionColumnHeaderCell, {
|
|
169
|
-
$variant: variant,
|
|
170
|
-
role: "columnheader",
|
|
171
|
-
"aria-colindex": columnCount,
|
|
172
|
-
"aria-label": addColumnAriaLabel,
|
|
173
|
-
children: onAddColumn && /* @__PURE__ */ jsx(Button, {
|
|
174
|
-
icon: PlusIcon,
|
|
175
|
-
variant: ButtonVariant.TERTIARY,
|
|
176
|
-
size: ButtonSize.SMALL,
|
|
177
|
-
ariaLabel: addColumnAriaLabel,
|
|
178
|
-
onClick: onAddColumn
|
|
179
|
-
})
|
|
180
|
-
})]
|
|
181
|
-
})
|
|
182
|
-
}), /* @__PURE__ */ jsxs(TableBody, {
|
|
183
|
-
ref: bodyRef,
|
|
184
|
-
role: "rowgroup",
|
|
185
|
-
$virtualHeight: showRows ? virtualTotalSize + trailingLoadingHeight : void 0,
|
|
186
|
-
children: [
|
|
187
|
-
showLoading && renderLoadingRows(),
|
|
188
|
-
showError && /* @__PURE__ */ jsx(TableStatusRow, {
|
|
189
|
-
colSpan: columnCount,
|
|
190
|
-
viewportWidth,
|
|
191
|
-
availableHeight: statusAvailableHeight,
|
|
192
|
-
role: "alert",
|
|
193
|
-
children: typeof contentWhenError === "function" ? contentWhenError(error) : contentWhenError ?? /* @__PURE__ */ jsx(Text, {
|
|
194
|
-
variant: TextVariant.ERROR,
|
|
195
|
-
children: error?.message ?? "Error loading data"
|
|
196
|
-
})
|
|
197
|
-
}),
|
|
198
|
-
showEmpty && /* @__PURE__ */ jsx(TableStatusRow, {
|
|
199
|
-
colSpan: columnCount,
|
|
200
|
-
viewportWidth,
|
|
201
|
-
availableHeight: statusAvailableHeight,
|
|
202
|
-
role: "status",
|
|
203
|
-
children: contentWhenEmpty
|
|
204
|
-
}),
|
|
205
|
-
showRows && virtualRows.map((virtualRow) => {
|
|
206
|
-
const rowData = getRowData(virtualRow.index);
|
|
207
|
-
const rowKey = rowData && getRowId ? getRowId(rowData, virtualRow.index) : String(virtualRow.index);
|
|
208
|
-
return /* @__PURE__ */ jsx(SpreadsheetRow, {
|
|
209
|
-
rowData,
|
|
210
|
-
rowIndex: virtualRow.index,
|
|
211
|
-
translateY: virtualRow.start,
|
|
212
|
-
rowHeight,
|
|
213
|
-
isLastRow: noLastRowBorder && virtualRow.index === totalRowCount - 1,
|
|
214
|
-
density,
|
|
215
|
-
variant,
|
|
216
|
-
columns,
|
|
217
|
-
pinnedOffsets,
|
|
218
|
-
getColumnWidth,
|
|
219
|
-
editingCell,
|
|
220
|
-
onStartEditing: startEditing,
|
|
221
|
-
onCommitEditing: commitEditing,
|
|
222
|
-
onCancelEditing: cancelEditing,
|
|
223
|
-
rowActions,
|
|
224
|
-
rowActionsAriaLabel: getRowActionsAriaLabel?.(virtualRow.index),
|
|
225
|
-
showActionColumn,
|
|
226
|
-
tabIndex: keyboard.getRowTabIndex(virtualRow.index),
|
|
227
|
-
onFocus: enableRowFocus ? () => keyboard.onRowFocus(virtualRow.index) : void 0,
|
|
228
|
-
onKeyDown: enableRowFocus ? (event) => keyboard.onRowKeyDown(virtualRow.index, event) : void 0
|
|
229
|
-
}, rowKey);
|
|
230
|
-
}),
|
|
231
|
-
isFetchingNextPage && showRows && renderTrailingLoadingRows(virtualTotalSize)
|
|
232
|
-
]
|
|
233
|
-
})]
|
|
234
|
-
}), /* @__PURE__ */ jsx(InfiniteScrollSentinel, {
|
|
235
|
-
ref: sentinelRef,
|
|
236
|
-
"aria-hidden": "true"
|
|
237
|
-
})]
|
|
238
|
-
})
|
|
676
|
+
return cached;
|
|
677
|
+
};
|
|
678
|
+
const defaultEmptyState = /* @__PURE__ */ jsx(EmptyState, {
|
|
679
|
+
header: "No rows",
|
|
680
|
+
size: metrics.emptyStateSize,
|
|
681
|
+
role: "status",
|
|
682
|
+
...handleAddRow ? { actions: /* @__PURE__ */ jsx(Button, {
|
|
683
|
+
label: "Add row",
|
|
684
|
+
icon: PlusIcon,
|
|
685
|
+
variant: ButtonVariant.SECONDARY,
|
|
686
|
+
size: metrics.buttonSize,
|
|
687
|
+
onClick: handleAddRow
|
|
688
|
+
}) } : {}
|
|
239
689
|
});
|
|
240
|
-
|
|
690
|
+
return /* @__PURE__ */ jsxs(TableFrame, {
|
|
691
|
+
metrics,
|
|
692
|
+
columnLayout: layout,
|
|
693
|
+
leadingHeaders: [],
|
|
694
|
+
trailingHeader: hasTrailingColumn ? /* @__PURE__ */ jsxs(CornerControls, { children: [canCustomizeColumns && /* @__PURE__ */ jsx(TableColumnsMenu, {
|
|
695
|
+
entries: layout.menuEntries,
|
|
696
|
+
metrics,
|
|
697
|
+
onToggle: (columnId, isVisible) => layout.setColumnHidden(columnId, !isVisible),
|
|
698
|
+
onReset: layout.resetLayout
|
|
699
|
+
}), onAddColumn !== void 0 && /* @__PURE__ */ jsx(Button, {
|
|
700
|
+
icon: PlusIcon,
|
|
701
|
+
variant: ButtonVariant.TERTIARY,
|
|
702
|
+
size: metrics.buttonSize,
|
|
703
|
+
ariaLabel: "Add column",
|
|
704
|
+
onClick: onAddColumn
|
|
705
|
+
})] }) : void 0,
|
|
706
|
+
hasTrailingColumn,
|
|
707
|
+
sort: null,
|
|
708
|
+
onSortPress: noop,
|
|
709
|
+
canCustomizeColumns,
|
|
710
|
+
rowCount,
|
|
711
|
+
isLoading,
|
|
712
|
+
error,
|
|
713
|
+
emptyState: emptyState ?? defaultEmptyState,
|
|
714
|
+
onEndReached,
|
|
715
|
+
role: "grid",
|
|
716
|
+
ariaLabel,
|
|
717
|
+
tableAria,
|
|
718
|
+
isMultiselectable: false,
|
|
719
|
+
ariaRowCount: rowCount + 1 + (showAddRow ? 1 : 0) + (hasFooter ? 1 : 0),
|
|
720
|
+
rootRef: ref,
|
|
721
|
+
scrollRef,
|
|
722
|
+
rootProps,
|
|
723
|
+
className,
|
|
724
|
+
style: {
|
|
725
|
+
...rootVariables,
|
|
726
|
+
...style
|
|
727
|
+
},
|
|
728
|
+
bodyClassName: VIRTUAL_BODY_CSS,
|
|
729
|
+
bodyStyle: bodyVariables,
|
|
730
|
+
trailingClassName: TRAILING_CSS,
|
|
731
|
+
children: [virtualItems.map((item) => {
|
|
732
|
+
const row = getRowData(item.index);
|
|
733
|
+
const rowId = row === void 0 ? `pending-${item.index}` : resolveRowId(row, item.index);
|
|
734
|
+
return /* @__PURE__ */ jsx(SpreadsheetRow, {
|
|
735
|
+
row,
|
|
736
|
+
rowIndex: item.index,
|
|
737
|
+
rowId,
|
|
738
|
+
columns: visibleColumns,
|
|
739
|
+
metrics,
|
|
740
|
+
size,
|
|
741
|
+
callbacks,
|
|
742
|
+
tabStopColumn: navigation.active.rowIndex === item.index ? navigation.active.columnIndex : -1,
|
|
743
|
+
hasGridFocus,
|
|
744
|
+
editingColumnId: editingColumnIdAt(item.index),
|
|
745
|
+
editEntry,
|
|
746
|
+
draftRef,
|
|
747
|
+
hasRowActions,
|
|
748
|
+
hasTrailingColumn,
|
|
749
|
+
isActionsOpen: openActionsRowId === rowId,
|
|
750
|
+
isBorderless: item.index === rowCount - 1 && !hasStatusAfter && !showAddRow,
|
|
751
|
+
ariaRowIndex: item.index + 2,
|
|
752
|
+
style: startStyle(item.start - scrollMargin)
|
|
753
|
+
}, rowId);
|
|
754
|
+
}), showAddRow && isMounted && /* @__PURE__ */ jsx(AddRow, {
|
|
755
|
+
role: "row",
|
|
756
|
+
"aria-rowindex": rowCount + 2,
|
|
757
|
+
className: "gx-TableCore-VIRTUAL_ROW_CSS-vb9km4t",
|
|
758
|
+
style: startStyle(totalSize),
|
|
759
|
+
children: /* @__PURE__ */ jsx(AddRowCell, {
|
|
760
|
+
role: "gridcell",
|
|
761
|
+
"aria-colindex": 1,
|
|
762
|
+
"aria-colspan": columnCount + (hasTrailingColumn && !hasRowActions ? 1 : 0),
|
|
763
|
+
children: /* @__PURE__ */ jsx(AddRowViewport, { children: /* @__PURE__ */ jsx(Button, {
|
|
764
|
+
variant: ButtonVariant.TERTIARY,
|
|
765
|
+
icon: PlusIcon,
|
|
766
|
+
label: "Add row",
|
|
767
|
+
size: metrics.buttonSize,
|
|
768
|
+
onClick: handleAddRow
|
|
769
|
+
}) })
|
|
770
|
+
})
|
|
771
|
+
})]
|
|
772
|
+
});
|
|
773
|
+
});
|
|
774
|
+
InfiniteSpreadsheetInner.displayName = "InfiniteSpreadsheet";
|
|
775
|
+
var noop = () => {};
|
|
776
|
+
/** The editable grid. */
|
|
777
|
+
var InfiniteSpreadsheet = InfiniteSpreadsheetInner;
|
|
241
778
|
//#endregion
|
|
242
|
-
export {
|
|
779
|
+
export { InfiniteSpreadsheetSize, SpreadsheetCellStatus, SpreadsheetCellType, InfiniteSpreadsheet as default };
|