@neo4j-ndl/react 4.20.0 → 4.21.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/cjs/_common/export-stories-utils.js +1 -1
- package/lib/cjs/_common/export-stories-utils.js.map +1 -1
- package/lib/cjs/_common/utils.js +3 -3
- package/lib/cjs/_common/utils.js.map +1 -1
- package/lib/cjs/_generated/style-rules/color-utils.js +3 -0
- package/lib/cjs/_generated/style-rules/color-utils.js.map +1 -1
- package/lib/cjs/_generated/style-rules/date-utils.js +14 -13
- package/lib/cjs/_generated/style-rules/date-utils.js.map +1 -1
- package/lib/cjs/_generated/style-rules/literal-schemas.js +5 -3
- package/lib/cjs/_generated/style-rules/literal-schemas.js.map +1 -1
- package/lib/cjs/ai/code-preview/CodePreview.js +1 -1
- package/lib/cjs/ai/code-preview/CodePreview.js.map +1 -1
- package/lib/cjs/ai/file-tag/FileTag.js.map +1 -1
- package/lib/cjs/ai/image-tag/ImageTag.js.map +1 -1
- package/lib/cjs/ai/prompt/Prompt.js +10 -10
- package/lib/cjs/ai/prompt/Prompt.js.map +1 -1
- package/lib/cjs/ai/prompt/stories/prompt-advanced.story.js +1 -1
- package/lib/cjs/ai/prompt/stories/prompt-advanced.story.js.map +1 -1
- package/lib/cjs/ai/prompt/stories/prompt-context.story.js +1 -1
- package/lib/cjs/ai/prompt/stories/prompt-context.story.js.map +1 -1
- package/lib/cjs/ai/prompt/stories/prompt-default.story.js +1 -1
- package/lib/cjs/ai/prompt/stories/prompt-default.story.js.map +1 -1
- package/lib/cjs/ai/prompt/stories/prompt-header.story.js +1 -1
- package/lib/cjs/ai/prompt/stories/prompt-header.story.js.map +1 -1
- package/lib/cjs/ai/response/Response.js +4 -4
- package/lib/cjs/ai/response/Response.js.map +1 -1
- package/lib/cjs/ai/response/stories/response-full-example.story.js +1 -1
- package/lib/cjs/ai/response/stories/response-full-example.story.js.map +1 -1
- package/lib/cjs/ai/suggestion/Suggestion.js.map +1 -1
- package/lib/cjs/ai/thinking/thinking-duration-formatter.js +5 -5
- package/lib/cjs/ai/thinking/thinking-duration-formatter.js.map +1 -1
- package/lib/cjs/banner/Banner.js +2 -2
- package/lib/cjs/banner/Banner.js.map +1 -1
- package/lib/cjs/button/ButtonBase.js +4 -4
- package/lib/cjs/button/ButtonBase.js.map +1 -1
- package/lib/cjs/code/Code.js +3 -3
- package/lib/cjs/code/Code.js.map +1 -1
- package/lib/cjs/code-block/CodeBlock.js +2 -2
- package/lib/cjs/code-block/CodeBlock.js.map +1 -1
- package/lib/cjs/color-picker/ColorPicker.js +22 -22
- package/lib/cjs/color-picker/ColorPicker.js.map +1 -1
- package/lib/cjs/color-picker/stories/color-picker-custom-swatches.story.js +20 -20
- package/lib/cjs/color-picker/stories/color-picker-custom-swatches.story.js.map +1 -1
- package/lib/cjs/color-picker/stories/color-picker-default.story.js +4 -4
- package/lib/cjs/color-picker/stories/color-picker-default.story.js.map +1 -1
- package/lib/cjs/color-picker/stories/color-picker-dialog.story.js +4 -4
- package/lib/cjs/color-picker/stories/color-picker-dialog.story.js.map +1 -1
- package/lib/cjs/color-picker/stories/color-picker-without-eyedropper.story.js +4 -4
- package/lib/cjs/color-picker/stories/color-picker-without-eyedropper.story.js.map +1 -1
- package/lib/cjs/combobox/stories/combobox-large-data-set.story.js +1 -1
- package/lib/cjs/combobox/stories/combobox-large-data-set.story.js.map +1 -1
- package/lib/cjs/data-grid/Components.js +20 -20
- package/lib/cjs/data-grid/Components.js.map +1 -1
- package/lib/cjs/data-grid/DataGrid.js +3 -3
- package/lib/cjs/data-grid/DataGrid.js.map +1 -1
- package/lib/cjs/data-grid/data-grid-nav/data-grid-nav.js +55 -54
- package/lib/cjs/data-grid/data-grid-nav/data-grid-nav.js.map +1 -1
- package/lib/cjs/data-grid/data-grid-nav/helpers.js +1 -1
- package/lib/cjs/data-grid/data-grid-nav/helpers.js.map +1 -1
- package/lib/cjs/data-grid/data-grid-nav/index.js +2 -2
- package/lib/cjs/data-grid/data-grid-nav/index.js.map +1 -1
- package/lib/cjs/data-grid/helpers/index.js +42 -40
- package/lib/cjs/data-grid/helpers/index.js.map +1 -1
- package/lib/cjs/data-grid/stories/datagrid-in-dialog.story.js +10 -7
- package/lib/cjs/data-grid/stories/datagrid-in-dialog.story.js.map +1 -1
- package/lib/cjs/data-grid/stories/datagrid-keyboard-navigation.story.js +10 -7
- package/lib/cjs/data-grid/stories/datagrid-keyboard-navigation.story.js.map +1 -1
- package/lib/cjs/data-grid/stories/datagrid-rule-based-styling-datetime.story.js +5 -5
- package/lib/cjs/data-grid/stories/datagrid-rule-based-styling-datetime.story.js.map +1 -1
- package/lib/cjs/data-grid/stories/datagrid-search-and-filters.stories.js +1 -1
- package/lib/cjs/data-grid/stories/datagrid-search-and-filters.stories.js.map +1 -1
- package/lib/cjs/data-grid/stories/datagrid-virtualization.story.js +5 -5
- package/lib/cjs/data-grid/stories/datagrid-virtualization.story.js.map +1 -1
- package/lib/cjs/data-grid/style-rules/evaluate.js +23 -23
- package/lib/cjs/data-grid/style-rules/evaluate.js.map +1 -1
- package/lib/cjs/data-grid/style-rules/types.js +1 -1
- package/lib/cjs/data-grid/style-rules/types.js.map +1 -1
- package/lib/cjs/dialog/Dialog.js +5 -5
- package/lib/cjs/dialog/Dialog.js.map +1 -1
- package/lib/cjs/dialog/dialog-types.js.map +1 -1
- package/lib/cjs/drawer/Drawer.js +5 -5
- package/lib/cjs/drawer/Drawer.js.map +1 -1
- package/lib/cjs/dropdown-button/DropdownButton.js +4 -4
- package/lib/cjs/dropdown-button/DropdownButton.js.map +1 -1
- package/lib/cjs/dropzone/stories/dropzone-full.story.js +1 -1
- package/lib/cjs/dropzone/stories/dropzone-full.story.js.map +1 -1
- package/lib/cjs/flex/stories/flex-default.story.js +1 -1
- package/lib/cjs/flex/stories/flex-default.story.js.map +1 -1
- package/lib/cjs/hooks/index.js +3 -3
- package/lib/cjs/hooks/index.js.map +1 -1
- package/lib/cjs/icon-button-base/IconButtonBase.js +4 -4
- package/lib/cjs/icon-button-base/IconButtonBase.js.map +1 -1
- package/lib/cjs/icons/generated/custom/ScatterPlot.js +30 -0
- package/lib/cjs/icons/generated/custom/ScatterPlot.js.map +1 -0
- package/lib/cjs/icons/generated/custom/index.js +4 -2
- package/lib/cjs/icons/generated/custom/index.js.map +1 -1
- package/lib/cjs/inline-edit/InlineEdit.js +8 -8
- package/lib/cjs/inline-edit/InlineEdit.js.map +1 -1
- package/lib/cjs/kbd/kbd-utils.js +2 -2
- package/lib/cjs/kbd/kbd-utils.js.map +1 -1
- package/lib/cjs/modal/Modal.js +6 -6
- package/lib/cjs/modal/Modal.js.map +1 -1
- package/lib/cjs/next/tree-view/TreeView.js +23 -23
- package/lib/cjs/next/tree-view/TreeView.js.map +1 -1
- package/lib/cjs/next/tree-view/stories/tree-view-lazy.story.js +1 -1
- package/lib/cjs/next/tree-view/stories/tree-view-lazy.story.js.map +1 -1
- package/lib/cjs/next/tree-view/stories/tree-view-multi.story.js +6 -6
- package/lib/cjs/next/tree-view/stories/tree-view-multi.story.js.map +1 -1
- package/lib/cjs/popover/Popover.js.map +1 -1
- package/lib/cjs/popover/stories/popover-custom-offset.story.js +3 -3
- package/lib/cjs/popover/stories/popover-custom-offset.story.js.map +1 -1
- package/lib/cjs/popover/use-popover.js +2 -0
- package/lib/cjs/popover/use-popover.js.map +1 -1
- package/lib/cjs/segmented-control/SegmentedControl.js.map +1 -1
- package/lib/cjs/select/Overrides.js +30 -30
- package/lib/cjs/select/Overrides.js.map +1 -1
- package/lib/cjs/select-icon-button/SelectIconButton.js +4 -4
- package/lib/cjs/select-icon-button/SelectIconButton.js.map +1 -1
- package/lib/cjs/selectable-tag/stories/selectable-tag-sizes.story.js +1 -1
- package/lib/cjs/selectable-tag/stories/selectable-tag-sizes.story.js.map +1 -1
- package/lib/cjs/side-navigation/SideNavigation.js +9 -9
- package/lib/cjs/side-navigation/SideNavigation.js.map +1 -1
- package/lib/cjs/slider/Slider.js +1 -1
- package/lib/cjs/slider/Slider.js.map +1 -1
- package/lib/cjs/slider/stories/slider-single-controlled.story.js +2 -2
- package/lib/cjs/slider/stories/slider-single-controlled.story.js.map +1 -1
- package/lib/cjs/spotlight/Spotlight.js +6 -6
- package/lib/cjs/spotlight/Spotlight.js.map +1 -1
- package/lib/cjs/spotlight/SpotlightProvider.js +6 -6
- package/lib/cjs/spotlight/SpotlightProvider.js.map +1 -1
- package/lib/cjs/spotlight/SpotlightTarget.js +18 -16
- package/lib/cjs/spotlight/SpotlightTarget.js.map +1 -1
- package/lib/cjs/status-indicator/StatusIndicator.js +4 -2
- package/lib/cjs/status-indicator/StatusIndicator.js.map +1 -1
- package/lib/cjs/tabs/Tabs.js +3 -3
- package/lib/cjs/tabs/Tabs.js.map +1 -1
- package/lib/cjs/tabs/use-tabs-scroll-overflow.js +2 -2
- package/lib/cjs/tabs/use-tabs-scroll-overflow.js.map +1 -1
- package/lib/cjs/text-input/stories/text-input-full.story.js +1 -1
- package/lib/cjs/text-input/stories/text-input-full.story.js.map +1 -1
- package/lib/cjs/text-input/stories/text-input-with-icons.story.js +1 -1
- package/lib/cjs/text-input/stories/text-input-with-icons.story.js.map +1 -1
- package/lib/cjs/theme/agnostic.js +4 -4
- package/lib/cjs/theme/agnostic.js.map +1 -1
- package/lib/cjs/time-picker/TimePicker.js +24 -24
- package/lib/cjs/time-picker/TimePicker.js.map +1 -1
- package/lib/cjs/time-picker/generate-time-options.js +3 -3
- package/lib/cjs/time-picker/generate-time-options.js.map +1 -1
- package/lib/cjs/timezone-picker/TimeZonePicker.js +44 -44
- package/lib/cjs/timezone-picker/TimeZonePicker.js.map +1 -1
- package/lib/cjs/timezone-picker/generate-timezone-options.js +5 -5
- package/lib/cjs/timezone-picker/generate-timezone-options.js.map +1 -1
- package/lib/cjs/toast/ToastControlled.js +1 -1
- package/lib/cjs/toast/ToastControlled.js.map +1 -1
- package/lib/cjs/tooltip/use-tooltip.js +8 -1
- package/lib/cjs/tooltip/use-tooltip.js.map +1 -1
- package/lib/cjs/tree-view/TreeItemWrapper.js +8 -8
- package/lib/cjs/tree-view/TreeItemWrapper.js.map +1 -1
- package/lib/cjs/tree-view/TreeView.js +6 -2
- package/lib/cjs/tree-view/TreeView.js.map +1 -1
- package/lib/cjs/tree-view/TreeViewTextItem.js +17 -17
- package/lib/cjs/tree-view/TreeViewTextItem.js.map +1 -1
- package/lib/cjs/tree-view/tree-view-keyboard-coordinates.js +2 -0
- package/lib/cjs/tree-view/tree-view-keyboard-coordinates.js.map +1 -1
- package/lib/cjs/tree-view/tree-view-utils.js +12 -12
- package/lib/cjs/tree-view/tree-view-utils.js.map +1 -1
- package/lib/esm/_common/export-stories-utils.js +1 -1
- package/lib/esm/_common/export-stories-utils.js.map +1 -1
- package/lib/esm/_common/utils.js +3 -3
- package/lib/esm/_common/utils.js.map +1 -1
- package/lib/esm/_generated/style-rules/color-utils.js +3 -0
- package/lib/esm/_generated/style-rules/color-utils.js.map +1 -1
- package/lib/esm/_generated/style-rules/date-utils.js +14 -13
- package/lib/esm/_generated/style-rules/date-utils.js.map +1 -1
- package/lib/esm/_generated/style-rules/literal-schemas.js +5 -3
- package/lib/esm/_generated/style-rules/literal-schemas.js.map +1 -1
- package/lib/esm/ai/code-preview/CodePreview.js +1 -1
- package/lib/esm/ai/code-preview/CodePreview.js.map +1 -1
- package/lib/esm/ai/file-tag/FileTag.js.map +1 -1
- package/lib/esm/ai/image-tag/ImageTag.js.map +1 -1
- package/lib/esm/ai/prompt/Prompt.js +10 -10
- package/lib/esm/ai/prompt/Prompt.js.map +1 -1
- package/lib/esm/ai/prompt/stories/prompt-advanced.story.js +1 -1
- package/lib/esm/ai/prompt/stories/prompt-advanced.story.js.map +1 -1
- package/lib/esm/ai/prompt/stories/prompt-context.story.js +1 -1
- package/lib/esm/ai/prompt/stories/prompt-context.story.js.map +1 -1
- package/lib/esm/ai/prompt/stories/prompt-default.story.js +1 -1
- package/lib/esm/ai/prompt/stories/prompt-default.story.js.map +1 -1
- package/lib/esm/ai/prompt/stories/prompt-header.story.js +1 -1
- package/lib/esm/ai/prompt/stories/prompt-header.story.js.map +1 -1
- package/lib/esm/ai/response/Response.js +4 -4
- package/lib/esm/ai/response/Response.js.map +1 -1
- package/lib/esm/ai/response/stories/response-full-example.story.js +1 -1
- package/lib/esm/ai/response/stories/response-full-example.story.js.map +1 -1
- package/lib/esm/ai/suggestion/Suggestion.js.map +1 -1
- package/lib/esm/ai/thinking/thinking-duration-formatter.js +5 -5
- package/lib/esm/ai/thinking/thinking-duration-formatter.js.map +1 -1
- package/lib/esm/banner/Banner.js +2 -2
- package/lib/esm/banner/Banner.js.map +1 -1
- package/lib/esm/button/ButtonBase.js +4 -4
- package/lib/esm/button/ButtonBase.js.map +1 -1
- package/lib/esm/code/Code.js +3 -3
- package/lib/esm/code/Code.js.map +1 -1
- package/lib/esm/code-block/CodeBlock.js +2 -2
- package/lib/esm/code-block/CodeBlock.js.map +1 -1
- package/lib/esm/color-picker/ColorPicker.js +22 -22
- package/lib/esm/color-picker/ColorPicker.js.map +1 -1
- package/lib/esm/color-picker/stories/color-picker-custom-swatches.story.js +20 -20
- package/lib/esm/color-picker/stories/color-picker-custom-swatches.story.js.map +1 -1
- package/lib/esm/color-picker/stories/color-picker-default.story.js +4 -4
- package/lib/esm/color-picker/stories/color-picker-default.story.js.map +1 -1
- package/lib/esm/color-picker/stories/color-picker-dialog.story.js +4 -4
- package/lib/esm/color-picker/stories/color-picker-dialog.story.js.map +1 -1
- package/lib/esm/color-picker/stories/color-picker-without-eyedropper.story.js +4 -4
- package/lib/esm/color-picker/stories/color-picker-without-eyedropper.story.js.map +1 -1
- package/lib/esm/combobox/stories/combobox-large-data-set.story.js +1 -1
- package/lib/esm/combobox/stories/combobox-large-data-set.story.js.map +1 -1
- package/lib/esm/data-grid/Components.js +20 -20
- package/lib/esm/data-grid/Components.js.map +1 -1
- package/lib/esm/data-grid/DataGrid.js +3 -3
- package/lib/esm/data-grid/DataGrid.js.map +1 -1
- package/lib/esm/data-grid/data-grid-nav/data-grid-nav.js +55 -54
- package/lib/esm/data-grid/data-grid-nav/data-grid-nav.js.map +1 -1
- package/lib/esm/data-grid/data-grid-nav/helpers.js +1 -1
- package/lib/esm/data-grid/data-grid-nav/helpers.js.map +1 -1
- package/lib/esm/data-grid/data-grid-nav/index.js +2 -2
- package/lib/esm/data-grid/data-grid-nav/index.js.map +1 -1
- package/lib/esm/data-grid/helpers/index.js +42 -40
- package/lib/esm/data-grid/helpers/index.js.map +1 -1
- package/lib/esm/data-grid/stories/datagrid-in-dialog.story.js +10 -7
- package/lib/esm/data-grid/stories/datagrid-in-dialog.story.js.map +1 -1
- package/lib/esm/data-grid/stories/datagrid-keyboard-navigation.story.js +10 -7
- package/lib/esm/data-grid/stories/datagrid-keyboard-navigation.story.js.map +1 -1
- package/lib/esm/data-grid/stories/datagrid-rule-based-styling-datetime.story.js +5 -5
- package/lib/esm/data-grid/stories/datagrid-rule-based-styling-datetime.story.js.map +1 -1
- package/lib/esm/data-grid/stories/datagrid-search-and-filters.stories.js +1 -1
- package/lib/esm/data-grid/stories/datagrid-search-and-filters.stories.js.map +1 -1
- package/lib/esm/data-grid/stories/datagrid-virtualization.story.js +5 -5
- package/lib/esm/data-grid/stories/datagrid-virtualization.story.js.map +1 -1
- package/lib/esm/data-grid/style-rules/evaluate.js +23 -23
- package/lib/esm/data-grid/style-rules/evaluate.js.map +1 -1
- package/lib/esm/data-grid/style-rules/types.js +1 -1
- package/lib/esm/data-grid/style-rules/types.js.map +1 -1
- package/lib/esm/dialog/Dialog.js +5 -5
- package/lib/esm/dialog/Dialog.js.map +1 -1
- package/lib/esm/dialog/dialog-types.js.map +1 -1
- package/lib/esm/drawer/Drawer.js +5 -5
- package/lib/esm/drawer/Drawer.js.map +1 -1
- package/lib/esm/dropdown-button/DropdownButton.js +4 -4
- package/lib/esm/dropdown-button/DropdownButton.js.map +1 -1
- package/lib/esm/dropzone/stories/dropzone-full.story.js +1 -1
- package/lib/esm/dropzone/stories/dropzone-full.story.js.map +1 -1
- package/lib/esm/flex/stories/flex-default.story.js +1 -1
- package/lib/esm/flex/stories/flex-default.story.js.map +1 -1
- package/lib/esm/hooks/index.js +3 -3
- package/lib/esm/hooks/index.js.map +1 -1
- package/lib/esm/icon-button-base/IconButtonBase.js +4 -4
- package/lib/esm/icon-button-base/IconButtonBase.js.map +1 -1
- package/lib/esm/icons/generated/custom/ScatterPlot.js +28 -0
- package/lib/esm/icons/generated/custom/ScatterPlot.js.map +1 -0
- package/lib/esm/icons/generated/custom/index.js +1 -0
- package/lib/esm/icons/generated/custom/index.js.map +1 -1
- package/lib/esm/inline-edit/InlineEdit.js +8 -8
- package/lib/esm/inline-edit/InlineEdit.js.map +1 -1
- package/lib/esm/kbd/kbd-utils.js +2 -2
- package/lib/esm/kbd/kbd-utils.js.map +1 -1
- package/lib/esm/modal/Modal.js +6 -6
- package/lib/esm/modal/Modal.js.map +1 -1
- package/lib/esm/next/tree-view/TreeView.js +23 -23
- package/lib/esm/next/tree-view/TreeView.js.map +1 -1
- package/lib/esm/next/tree-view/stories/tree-view-lazy.story.js +1 -1
- package/lib/esm/next/tree-view/stories/tree-view-lazy.story.js.map +1 -1
- package/lib/esm/next/tree-view/stories/tree-view-multi.story.js +6 -6
- package/lib/esm/next/tree-view/stories/tree-view-multi.story.js.map +1 -1
- package/lib/esm/popover/Popover.js.map +1 -1
- package/lib/esm/popover/stories/popover-custom-offset.story.js +3 -3
- package/lib/esm/popover/stories/popover-custom-offset.story.js.map +1 -1
- package/lib/esm/popover/use-popover.js +2 -0
- package/lib/esm/popover/use-popover.js.map +1 -1
- package/lib/esm/segmented-control/SegmentedControl.js.map +1 -1
- package/lib/esm/select/Overrides.js +30 -30
- package/lib/esm/select/Overrides.js.map +1 -1
- package/lib/esm/select-icon-button/SelectIconButton.js +4 -4
- package/lib/esm/select-icon-button/SelectIconButton.js.map +1 -1
- package/lib/esm/selectable-tag/stories/selectable-tag-sizes.story.js +1 -1
- package/lib/esm/selectable-tag/stories/selectable-tag-sizes.story.js.map +1 -1
- package/lib/esm/side-navigation/SideNavigation.js +9 -9
- package/lib/esm/side-navigation/SideNavigation.js.map +1 -1
- package/lib/esm/slider/Slider.js +1 -1
- package/lib/esm/slider/Slider.js.map +1 -1
- package/lib/esm/slider/stories/slider-single-controlled.story.js +2 -2
- package/lib/esm/slider/stories/slider-single-controlled.story.js.map +1 -1
- package/lib/esm/spotlight/Spotlight.js +6 -6
- package/lib/esm/spotlight/Spotlight.js.map +1 -1
- package/lib/esm/spotlight/SpotlightProvider.js +6 -6
- package/lib/esm/spotlight/SpotlightProvider.js.map +1 -1
- package/lib/esm/spotlight/SpotlightTarget.js +18 -16
- package/lib/esm/spotlight/SpotlightTarget.js.map +1 -1
- package/lib/esm/status-indicator/StatusIndicator.js +4 -2
- package/lib/esm/status-indicator/StatusIndicator.js.map +1 -1
- package/lib/esm/tabs/Tabs.js +3 -3
- package/lib/esm/tabs/Tabs.js.map +1 -1
- package/lib/esm/tabs/use-tabs-scroll-overflow.js +2 -2
- package/lib/esm/tabs/use-tabs-scroll-overflow.js.map +1 -1
- package/lib/esm/text-input/stories/text-input-full.story.js +1 -1
- package/lib/esm/text-input/stories/text-input-full.story.js.map +1 -1
- package/lib/esm/text-input/stories/text-input-with-icons.story.js +1 -1
- package/lib/esm/text-input/stories/text-input-with-icons.story.js.map +1 -1
- package/lib/esm/theme/agnostic.js +3 -3
- package/lib/esm/theme/agnostic.js.map +1 -1
- package/lib/esm/time-picker/TimePicker.js +24 -24
- package/lib/esm/time-picker/TimePicker.js.map +1 -1
- package/lib/esm/time-picker/generate-time-options.js +3 -3
- package/lib/esm/time-picker/generate-time-options.js.map +1 -1
- package/lib/esm/timezone-picker/TimeZonePicker.js +44 -44
- package/lib/esm/timezone-picker/TimeZonePicker.js.map +1 -1
- package/lib/esm/timezone-picker/generate-timezone-options.js +5 -5
- package/lib/esm/timezone-picker/generate-timezone-options.js.map +1 -1
- package/lib/esm/toast/ToastControlled.js +1 -1
- package/lib/esm/toast/ToastControlled.js.map +1 -1
- package/lib/esm/tooltip/use-tooltip.js +8 -1
- package/lib/esm/tooltip/use-tooltip.js.map +1 -1
- package/lib/esm/tree-view/TreeItemWrapper.js +8 -8
- package/lib/esm/tree-view/TreeItemWrapper.js.map +1 -1
- package/lib/esm/tree-view/TreeView.js +6 -2
- package/lib/esm/tree-view/TreeView.js.map +1 -1
- package/lib/esm/tree-view/TreeViewTextItem.js +17 -17
- package/lib/esm/tree-view/TreeViewTextItem.js.map +1 -1
- package/lib/esm/tree-view/tree-view-keyboard-coordinates.js +2 -0
- package/lib/esm/tree-view/tree-view-keyboard-coordinates.js.map +1 -1
- package/lib/esm/tree-view/tree-view-utils.js +12 -12
- package/lib/esm/tree-view/tree-view-utils.js.map +1 -1
- package/lib/types/_common/export-stories-utils.d.ts +1 -1
- package/lib/types/_common/utils.d.ts +3 -3
- package/lib/types/_generated/style-rules/color-utils.d.ts.map +1 -1
- package/lib/types/_generated/style-rules/date-utils.d.ts +3 -3
- package/lib/types/_generated/style-rules/date-utils.d.ts.map +1 -1
- package/lib/types/_generated/style-rules/literal-schemas.d.ts.map +1 -1
- package/lib/types/ai/code-preview/CodePreview.d.ts +1 -1
- package/lib/types/ai/file-tag/FileTag.d.ts +1 -1
- package/lib/types/ai/file-tag/FileTag.d.ts.map +1 -1
- package/lib/types/ai/image-tag/ImageTag.d.ts +1 -1
- package/lib/types/ai/image-tag/ImageTag.d.ts.map +1 -1
- package/lib/types/ai/prompt/Prompt.d.ts +3 -3
- package/lib/types/ai/prompt/Prompt.d.ts.map +1 -1
- package/lib/types/ai/suggestion/Suggestion.d.ts +1 -1
- package/lib/types/ai/suggestion/Suggestion.d.ts.map +1 -1
- package/lib/types/ai/thinking/thinking-duration-formatter.d.ts +5 -5
- package/lib/types/banner/Banner.d.ts +1 -1
- package/lib/types/banner/Banner.d.ts.map +1 -1
- package/lib/types/button/ButtonBase.d.ts +2 -2
- package/lib/types/button/ButtonBase.d.ts.map +1 -1
- package/lib/types/code/Code.d.ts +1 -1
- package/lib/types/code/Code.d.ts.map +1 -1
- package/lib/types/data-grid/Components.d.ts +2 -2
- package/lib/types/data-grid/Components.d.ts.map +1 -1
- package/lib/types/data-grid/DataGrid.d.ts +2 -2
- package/lib/types/data-grid/data-grid-nav/data-grid-nav.d.ts +4 -4
- package/lib/types/data-grid/data-grid-nav/data-grid-nav.d.ts.map +1 -1
- package/lib/types/data-grid/data-grid-nav/helpers.d.ts +1 -1
- package/lib/types/data-grid/data-grid-nav/index.d.ts +1 -1
- package/lib/types/data-grid/data-grid-nav/index.d.ts.map +1 -1
- package/lib/types/data-grid/helpers/index.d.ts +5 -5
- package/lib/types/data-grid/helpers/index.d.ts.map +1 -1
- package/lib/types/data-grid/stories/datagrid-in-dialog.story.d.ts.map +1 -1
- package/lib/types/data-grid/stories/datagrid-keyboard-navigation.story.d.ts.map +1 -1
- package/lib/types/data-grid/stories/datagrid-pinned-columns.stories.d.ts +2 -2
- package/lib/types/data-grid/stories/datagrid-search-and-filters.stories.d.ts +2 -2
- package/lib/types/data-grid/stories/datagrid-virtualization.story.d.ts.map +1 -1
- package/lib/types/data-grid/style-rules/evaluate.d.ts +1 -1
- package/lib/types/dialog/Dialog.d.ts.map +1 -1
- package/lib/types/dialog/dialog-types.d.ts +1 -1
- package/lib/types/dialog/dialog-types.d.ts.map +1 -1
- package/lib/types/drawer/Drawer.d.ts +1 -1
- package/lib/types/drawer/Drawer.d.ts.map +1 -1
- package/lib/types/dropdown-button/DropdownButton.d.ts +1 -1
- package/lib/types/dropdown-button/DropdownButton.d.ts.map +1 -1
- package/lib/types/hooks/index.d.ts +3 -3
- package/lib/types/icon-button-base/IconButtonBase.d.ts +1 -1
- package/lib/types/icon-button-base/IconButtonBase.d.ts.map +1 -1
- package/lib/types/icons/generated/custom/ScatterPlot.d.ts +29 -0
- package/lib/types/icons/generated/custom/ScatterPlot.d.ts.map +1 -0
- package/lib/types/icons/generated/custom/index.d.ts +1 -0
- package/lib/types/icons/generated/custom/index.d.ts.map +1 -1
- package/lib/types/modal/Modal.d.ts +1 -1
- package/lib/types/modal/Modal.d.ts.map +1 -1
- package/lib/types/popover/Popover.d.ts.map +1 -1
- package/lib/types/popover/use-popover.d.ts.map +1 -1
- package/lib/types/segmented-control/SegmentedControl.d.ts +1 -1
- package/lib/types/segmented-control/SegmentedControl.d.ts.map +1 -1
- package/lib/types/select/Overrides.d.ts.map +1 -1
- package/lib/types/select-icon-button/SelectIconButton.d.ts +1 -1
- package/lib/types/select-icon-button/SelectIconButton.d.ts.map +1 -1
- package/lib/types/selectable-tag/stories/selectable-tag-sizes.story.d.ts.map +1 -1
- package/lib/types/spotlight/SpotlightProvider.d.ts.map +1 -1
- package/lib/types/spotlight/SpotlightTarget.d.ts +4 -3
- package/lib/types/spotlight/SpotlightTarget.d.ts.map +1 -1
- package/lib/types/status-indicator/StatusIndicator.d.ts.map +1 -1
- package/lib/types/tabs/Tabs.d.ts +1 -1
- package/lib/types/tabs/Tabs.d.ts.map +1 -1
- package/lib/types/theme/agnostic.d.ts +2 -2
- package/lib/types/theme/agnostic.d.ts.map +1 -1
- package/lib/types/tooltip/use-tooltip.d.ts.map +1 -1
- package/lib/types/tree-view/TreeView.d.ts.map +1 -1
- package/lib/types/tree-view/TreeViewTextItem.d.ts.map +1 -1
- package/lib/types/tree-view/tree-view-keyboard-coordinates.d.ts.map +1 -1
- package/lib/types/tree-view/tree-view-utils.d.ts +12 -12
- package/lib/types/tree-view/tree-view-utils.d.ts.map +1 -1
- package/package.json +5 -3
- package/skills/ndl-react/SKILL.md +54 -3
- package/skills/ndl-react/components/ai/file-tag.md +1 -1
- package/skills/ndl-react/components/ai/image-tag.md +1 -1
- package/skills/ndl-react/components/ai/prompt.md +10 -10
- package/skills/ndl-react/components/ai/response.md +1 -1
- package/skills/ndl-react/components/ai/suggestion.md +1 -1
- package/skills/ndl-react/components/banner.md +1 -1
- package/skills/ndl-react/components/clean-icon-button.md +1 -1
- package/skills/ndl-react/components/code.md +1 -1
- package/skills/ndl-react/components/combobox.md +1 -1
- package/skills/ndl-react/components/data-grid.md +35 -28
- package/skills/ndl-react/components/dialog.md +1 -1
- package/skills/ndl-react/components/drawer.md +1 -1
- package/skills/ndl-react/components/dropdown-button.md +1 -1
- package/skills/ndl-react/components/dropzone.md +1 -1
- package/skills/ndl-react/components/filled-button.md +2 -2
- package/skills/ndl-react/components/flex.md +2 -2
- package/skills/ndl-react/components/icon-button.md +1 -1
- package/skills/ndl-react/components/modal.md +1 -1
- package/skills/ndl-react/components/next/tree-view.md +8 -8
- package/skills/ndl-react/components/outlined-button.md +2 -2
- package/skills/ndl-react/components/popover.md +3 -3
- package/skills/ndl-react/components/segmented-control.md +1 -1
- package/skills/ndl-react/components/select-icon-button.md +1 -1
- package/skills/ndl-react/components/selectable-tag.md +10 -4
- package/skills/ndl-react/components/slider.md +2 -2
- package/skills/ndl-react/components/tabs.md +1 -1
- package/skills/ndl-react/components/text-button.md +2 -2
- package/skills/ndl-react/components/text-input.md +2 -2
- package/skills/ndl-react/references/styling.md +290 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"datagrid-search-and-filters.stories.js","sourceRoot":"","sources":["../../../../src/data-grid/stories/datagrid-search-and-filters.stories.tsx"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,OAAO,yCAAyC,CAAC;AAEjD,OAAO,EACL,QAAQ,EACR,eAAe,EACf,QAAQ,EACR,OAAO,EACP,UAAU,EACV,OAAO,EACP,UAAU,EACV,SAAS,EACT,UAAU,GACX,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EACL,iBAAiB,EACjB,0BAA0B,EAC1B,gBAAgB,GACjB,MAAM,wBAAwB,CAAC;AAChC,OAAO,EAGL,kBAAkB,EAElB,eAAe,EACf,mBAAmB,EACnB,qBAAqB,EACrB,iBAAiB,EACjB,aAAa,GACd,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAE,MAAM,EAAE,QAAQ,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AC;aACZ;SACF;KACF,CAAC,CAAC;IAEH,OAAO,CACL,cAAK,SAAS,EAAC,yDAAyD,YACtE,KAAC,QAAQ,IACP,mBAAmB,EAAE,IAAI,EACzB,WAAW,EAAE,IAAI,EACjB,aAAa,EAAE,KAAK,GACpB,GACE,CACP,CAAC;AACJ,CAAC,CAAC","sourcesContent":["/**\n *\n * Copyright (c) \"Neo4j\"\n * Neo4j Sweden AB [http://neo4j.com]\n *\n * This file is part of Neo4j.\n *\n * Neo4j is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with this program. If not, see <http://www.gnu.org/licenses/>.\n */\n\nimport '@neo4j-ndl/base/lib/neo4j-ds-styles.css';\n\nimport {\n Checkbox,\n CleanIconButton,\n DataGrid,\n Divider,\n IconButton,\n Popover,\n TextButton,\n TextInput,\n Typography,\n} from '@neo4j-ndl/react';\nimport {\n FunnelIconOutline,\n MagnifyingGlassIconOutline,\n XMarkIconOutline,\n} from '@neo4j-ndl/react/icons';\nimport {\n type ColumnFiltersState,\n type ColumnMeta,\n createColumnHelper,\n type FilterFn,\n getCoreRowModel,\n getFilteredRowModel,\n getPaginationRowModel,\n getSortedRowModel,\n useReactTable,\n} from '@tanstack/react-table';\nimport { useRef, useState } from 'react';\n\nimport { TABLE_DEMO_DATA } from './staticData';\n\ntype TestDataFormat = {\n name: string;\n age: number;\n cypherCommand: string;\n};\n\nexport default {\n component: DataGrid,\n id: 'components-data-grid-search-and-filters',\n parameters: {\n chromatic: { delay: 1000 },\n controls: { disable: true },\n },\n title: 'Components/DataGrid/Search And Filters',\n};\n\ninterface AgeFilterOptions {\n min?: number;\n max?: number;\n}\n\n/**\n * Custom global function as there is a bug in current version:\n * https://github.com/TanStack/table/issues/4280#issuecomment-1244878232\n */\nconst globalFilterFn: FilterFn<TestDataFormat> = (\n row,\n columnId,\n filterValue: string,\n) => {\n const search = filterValue.toLowerCase();\n\n let value = row.getValue(columnId) as string;\n if (typeof value === 'number') {\n value = String(value);\n }\n\n return value?.toLowerCase().includes(search);\n};\n\nconst OpenFilterMenuIconButton = ({\n onClick,\n isOpen,\n description,\n ref,\n}: {\n isOpen: boolean;\n} & Omit<React.ComponentProps<typeof IconButton>, 'children'>) => (\n <IconButton\n ref={ref}\n onClick={onClick}\n aria-controls={isOpen ? 'default-menu' : undefined}\n aria-haspopup=\"true\"\n aria-expanded={isOpen}\n description={description}\n size=\"medium\"\n >\n <FunnelIconOutline />\n </IconButton>\n);\n\nexport const Searchable = () => {\n const [anchorEl, setAnchorEl] = useState<HTMLElement | null>(null);\n const isOpen = Boolean(anchorEl);\n const ref = useRef<HTMLDivElement>(null);\n const [globalFilter, setGlobalFilter] = useState('');\n const [columnFilters, setColumnFilters] = useState<ColumnFiltersState>([]);\n\n const handleClick = (\n event: React.MouseEvent<HTMLElement> | React.KeyboardEvent<HTMLElement>,\n ) => {\n setAnchorEl(event.currentTarget);\n };\n\n const handleClose = () => {\n setAnchorEl(null);\n };\n\n const columnHelper = createColumnHelper<TestDataFormat>();\n\n const columns = [\n columnHelper.accessor('name', {\n cell: (info) => info.getValue(),\n footer: (info) => info.column.id,\n header: () => 'Name',\n maxSize: 300,\n minSize: 180,\n size: 220,\n }),\n columnHelper.accessor('age', {\n cell: (info) => info.renderValue(),\n footer: (info) => info.column.id,\n header: () => 'Age',\n minSize: 80,\n }),\n columnHelper.accessor('cypherCommand', {\n cell: (info) => info.getValue(),\n footer: (info) => info.column.id,\n header: () => 'Cypher Command',\n minSize: 400,\n size: 400,\n }),\n ];\n\n const table = useReactTable({\n columnResizeMode: 'onChange',\n columns,\n data: TABLE_DEMO_DATA,\n debugColumns: true,\n debugHeaders: true,\n debugTable: true,\n defaultColumn: {\n maxSize: 800,\n minSize: 80,\n },\n enableSorting: false,\n filterFns: {},\n getCoreRowModel: getCoreRowModel(),\n getFilteredRowModel: getFilteredRowModel(),\n getPaginationRowModel: getPaginationRowModel(),\n globalFilterFn: globalFilterFn,\n initialState: {\n pagination: {\n pageSize: 5,\n },\n },\n onColumnFiltersChange: setColumnFilters,\n onGlobalFilterChange: setGlobalFilter,\n state: {\n columnFilters,\n globalFilter,\n },\n });\n\n const toggleAgeFilter = ({ min, max }: AgeFilterOptions) => {\n const ageColumn = table.getColumn('age');\n\n if (!ageColumn) {\n return;\n }\n\n const currentFilter = ageColumn.getFilterValue() as\n | [number?, number?]\n | undefined;\n\n // Helper function to determine the new filter value for a specific bound\n const determineNewBound = (currentBound?: number, newBound?: number) => {\n if (newBound !== undefined && currentBound === newBound) {\n return undefined;\n }\n return newBound !== undefined ? newBound : currentBound;\n };\n\n const newFilter: [number?, number?] = [\n determineNewBound(currentFilter?.[0], min),\n determineNewBound(currentFilter?.[1], max),\n ];\n\n // Update the filter value in the table state\n ageColumn.setFilterValue(\n newFilter[0] === undefined && newFilter[1] === undefined\n ? undefined\n : newFilter,\n );\n };\n\n const isAgeFilterApplied = (type: 'min' | 'max', value: number) => {\n const ageFilter = columnFilters.find((filter) => filter.id === 'age');\n if (ageFilter) {\n const [min, max] = ageFilter.value as [number, number];\n if (type === 'min') {\n return min === value;\n }\n if (type === 'max') {\n return max === value;\n }\n }\n return false;\n };\n\n return (\n <div className=\"n-flex n-flex-col\" ref={ref}>\n <div className=\"n-flex n-flex-col n-gap-token-16 n-pb-token-16\">\n <div className=\"n-flex n-gap-token-8\">\n <TextInput\n aria-label=\"Table search\"\n value={globalFilter}\n placeholder=\"Search\"\n leadingElement={<MagnifyingGlassIconOutline />}\n isClearable={true}\n onChange={(e) => setGlobalFilter(e.target.value)}\n />\n <OpenFilterMenuIconButton\n isOpen={isOpen}\n onClick={handleClick}\n description=\"Filter Menu\"\n />\n </div>\n </div>\n <Divider />\n <DataGrid isResizable={true} tableInstance={table} />\n <Popover\n isOpen={isOpen}\n anchorElement={anchorEl}\n onOpenChange={(isOpen) => {\n if (!isOpen) {\n handleClose();\n }\n }}\n offset={({ rects }) => ({\n crossAxis: -rects.floating.width,\n })}\n >\n <Popover.Content>\n <div className=\"n-grid n-gap-token-16 n-p-token-24 n-w-[300px]\">\n <div className=\"n-w-full n-flex n-justify-between n-items-center\">\n <Typography variant=\"title-4\">Filter</Typography>\n <CleanIconButton\n onClick={handleClose}\n description=\"Close filter menu\"\n size=\"medium\"\n htmlAttributes={{\n title: 'Close filter menu',\n }}\n >\n <XMarkIconOutline />\n </CleanIconButton>\n </div>\n <div className=\"n-flex n-flex-col n-gap-2\">\n <Typography\n variant=\"body-medium\"\n className=\"n-text-neutral-text-weaker n-pb-token-4\"\n >\n Age\n </Typography>\n <Checkbox\n isChecked={isAgeFilterApplied('min', 18)}\n label=\"Age >= 18\"\n onClick={() => toggleAgeFilter({ min: 18 })}\n />\n <Checkbox\n isChecked={isAgeFilterApplied('max', 63)}\n label=\"Age <= 63\"\n onClick={() => toggleAgeFilter({ max: 63 })}\n />\n </div>\n <TextButton\n className=\"n-mt-token-32 n-justify-self-end\"\n variant=\"danger\"\n aria-label=\"Clear filters\"\n onClick={() => {\n table.resetColumnFilters();\n }}\n >\n <Typography\n variant=\"body-medium\"\n className=\"n-text-danger-text n-font-bold\"\n >\n Clear all\n </Typography>\n </TextButton>\n </div>\n </Popover.Content>\n </Popover>\n </div>\n );\n};\n\nexport const ColumnFiltering = () => {\n const [tableData, setTableData] = useState(TABLE_DEMO_DATA);\n const [isAgeFilterApplied, setIsAgeFilterApplied] = useState(false);\n const columnHelper = createColumnHelper<TestDataFormat>();\n\n const ColumnActions: ColumnMeta<TestDataFormat, unknown> = {\n columnActions: {\n actions: [\n {\n onClick: () => {\n // Filter the input table data value, TABLE_DEMO_DATA\n if (isAgeFilterApplied) {\n setTableData(TABLE_DEMO_DATA);\n setIsAgeFilterApplied(false);\n return;\n } else {\n const filteredData = TABLE_DEMO_DATA.filter(\n (data) => data.age >= 18,\n );\n setTableData(filteredData);\n setIsAgeFilterApplied(true);\n }\n },\n title: 'Age >= 18',\n },\n ],\n },\n };\n\n const columns = [\n columnHelper.accessor('name', {\n cell: (info) => info.getValue(),\n maxSize: 300,\n minSize: 180,\n size: 220,\n }),\n columnHelper.accessor('age', {\n cell: (info) => info.getValue(),\n header: () => <div>Age</div>,\n meta: {\n ...ColumnActions,\n },\n minSize: 80,\n }),\n columnHelper.accessor('cypherCommand', {\n cell: (info) => info.getValue(),\n minSize: 400,\n size: 400,\n }),\n ];\n\n const table = useReactTable({\n columnResizeMode: 'onChange',\n columns,\n data: tableData,\n debugColumns: true,\n debugHeaders: true,\n debugTable: true,\n defaultColumn: {\n maxSize: 800,\n minSize: 80,\n },\n enableSorting: true,\n getCoreRowModel: getCoreRowModel(),\n getPaginationRowModel: getPaginationRowModel(),\n getSortedRowModel: getSortedRowModel(),\n initialState: {\n pagination: {\n pageSize: 5,\n },\n },\n });\n\n return (\n <div className=\"n-h-[1000px] n-w-full n-bg-primary-bg-weak n-p-token-32\">\n <DataGrid\n isKeyboardNavigable={true}\n isResizable={true}\n tableInstance={table}\n />\n </div>\n );\n};\n"]}
|
|
1
|
+
{"version":3,"file":"datagrid-search-and-filters.stories.js","sourceRoot":"","sources":["../../../../src/data-grid/stories/datagrid-search-and-filters.stories.tsx"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,OAAO,yCAAyC,CAAC;AAEjD,OAAO,EACL,QAAQ,EACR,eAAe,EACf,QAAQ,EACR,OAAO,EACP,UAAU,EACV,OAAO,EACP,UAAU,EACV,SAAS,EACT,UAAU,GACX,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EACL,iBAAiB,EACjB,0BAA0B,EAC1B,gBAAgB,GACjB,MAAM,wBAAwB,CAAC;AAChC,OAAO,EAGL,kBAAkB,EAElB,eAAe,EACf,mBAAmB,EACnB,qBAA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QAC9C,iBAAiB,EAAE,iBAAiB,EAAE;QACtC,YAAY,EAAE;YACZ,UAAU,EAAE;gBACV,QAAQ,EAAE,CAAC;aACZ;SACF;KACF,CAAC,CAAC;IAEH,OAAO,CACL,cAAK,SAAS,EAAC,yDAAyD,YACtE,KAAC,QAAQ,IACP,mBAAmB,EAAE,IAAI,EACzB,WAAW,EAAE,IAAI,EACjB,aAAa,EAAE,KAAK,GACpB,GACE,CACP,CAAC;AACJ,CAAC,CAAC","sourcesContent":["/**\n *\n * Copyright (c) \"Neo4j\"\n * Neo4j Sweden AB [http://neo4j.com]\n *\n * This file is part of Neo4j.\n *\n * Neo4j is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with this program. If not, see <http://www.gnu.org/licenses/>.\n */\n\nimport '@neo4j-ndl/base/lib/neo4j-ds-styles.css';\n\nimport {\n Checkbox,\n CleanIconButton,\n DataGrid,\n Divider,\n IconButton,\n Popover,\n TextButton,\n TextInput,\n Typography,\n} from '@neo4j-ndl/react';\nimport {\n FunnelIconOutline,\n MagnifyingGlassIconOutline,\n XMarkIconOutline,\n} from '@neo4j-ndl/react/icons';\nimport {\n type ColumnFiltersState,\n type ColumnMeta,\n createColumnHelper,\n type FilterFn,\n getCoreRowModel,\n getFilteredRowModel,\n getPaginationRowModel,\n getSortedRowModel,\n useReactTable,\n} from '@tanstack/react-table';\nimport { useRef, useState } from 'react';\n\nimport { TABLE_DEMO_DATA } from './staticData';\n\ntype TestDataFormat = {\n name: string;\n age: number;\n cypherCommand: string;\n};\n\nexport default {\n component: DataGrid,\n id: 'components-data-grid-search-and-filters',\n parameters: {\n chromatic: { delay: 1000 },\n controls: { disable: true },\n },\n title: 'Components/DataGrid/Search And Filters',\n};\n\ninterface AgeFilterOptions {\n min?: number;\n max?: number;\n}\n\n/**\n * Custom global function as there is a bug in current version:\n * https://github.com/TanStack/table/issues/4280#issuecomment-1244878232\n */\nconst globalFilterFn: FilterFn<TestDataFormat> = (\n row,\n columnId,\n filterValue: string,\n) => {\n const search = filterValue.toLowerCase();\n\n let value = row.getValue(columnId) as string;\n if (typeof value === 'number') {\n value = String(value);\n }\n\n return value?.toLowerCase().includes(search);\n};\n\nconst OpenFilterMenuIconButton = ({\n onClick,\n isOpen,\n description,\n ref,\n}: {\n isOpen: boolean;\n} & Omit<React.ComponentProps<typeof IconButton>, 'children'>) => (\n <IconButton\n ref={ref}\n onClick={onClick}\n aria-controls={isOpen ? 'default-menu' : undefined}\n aria-haspopup=\"true\"\n aria-expanded={isOpen}\n description={description}\n size=\"medium\"\n >\n <FunnelIconOutline />\n </IconButton>\n);\n\nexport const Searchable = () => {\n const [anchorEl, setAnchorEl] = useState<HTMLElement | null>(null);\n const isOpen = Boolean(anchorEl);\n const ref = useRef<HTMLDivElement>(null);\n const [globalFilter, setGlobalFilter] = useState('');\n const [columnFilters, setColumnFilters] = useState<ColumnFiltersState>([]);\n\n const handleClick = (\n event: React.MouseEvent<HTMLElement> | React.KeyboardEvent<HTMLElement>,\n ) => {\n setAnchorEl(event.currentTarget);\n };\n\n const handleClose = () => {\n setAnchorEl(null);\n };\n\n const columnHelper = createColumnHelper<TestDataFormat>();\n\n const columns = [\n columnHelper.accessor('name', {\n cell: (info) => info.getValue(),\n footer: (info) => info.column.id,\n header: () => 'Name',\n maxSize: 300,\n minSize: 180,\n size: 220,\n }),\n columnHelper.accessor('age', {\n cell: (info) => info.renderValue(),\n footer: (info) => info.column.id,\n header: () => 'Age',\n minSize: 80,\n }),\n columnHelper.accessor('cypherCommand', {\n cell: (info) => info.getValue(),\n footer: (info) => info.column.id,\n header: () => 'Cypher Command',\n minSize: 400,\n size: 400,\n }),\n ];\n\n const table = useReactTable({\n columnResizeMode: 'onChange',\n columns,\n data: TABLE_DEMO_DATA,\n debugColumns: true,\n debugHeaders: true,\n debugTable: true,\n defaultColumn: {\n maxSize: 800,\n minSize: 80,\n },\n enableSorting: false,\n filterFns: {},\n getCoreRowModel: getCoreRowModel(),\n getFilteredRowModel: getFilteredRowModel(),\n getPaginationRowModel: getPaginationRowModel(),\n globalFilterFn: globalFilterFn,\n initialState: {\n pagination: {\n pageSize: 5,\n },\n },\n onColumnFiltersChange: setColumnFilters,\n onGlobalFilterChange: setGlobalFilter,\n state: {\n columnFilters,\n globalFilter,\n },\n });\n\n const toggleAgeFilter = ({ min, max }: AgeFilterOptions) => {\n const ageColumn = table.getColumn('age');\n\n if (!ageColumn) {\n return;\n }\n\n const currentFilter = ageColumn.getFilterValue() as\n | [number?, number?]\n | undefined;\n\n // Helper function to determine the new filter value for a specific bound\n const determineNewBound = (currentBound?: number, newBound?: number) => {\n if (newBound !== undefined && currentBound === newBound) {\n return undefined;\n }\n return newBound !== undefined ? newBound : currentBound;\n };\n\n const newFilter: [number?, number?] = [\n determineNewBound(currentFilter?.[0], min),\n determineNewBound(currentFilter?.[1], max),\n ];\n\n // Update the filter value in the table state\n ageColumn.setFilterValue(\n newFilter[0] === undefined && newFilter[1] === undefined\n ? undefined\n : newFilter,\n );\n };\n\n const isAgeFilterApplied = (type: 'min' | 'max', value: number) => {\n const ageFilter = columnFilters.find((filter) => filter.id === 'age');\n if (ageFilter) {\n const [min, max] = ageFilter.value as [number, number];\n if (type === 'min') {\n return min === value;\n }\n if (type === 'max') {\n return max === value;\n }\n }\n return false;\n };\n\n return (\n <div className=\"n-flex n-flex-col\" ref={ref}>\n <div className=\"n-flex n-flex-col n-gap-token-16 n-pb-token-16\">\n <div className=\"n-flex n-gap-token-8\">\n <TextInput\n aria-label=\"Table search\"\n value={globalFilter}\n placeholder=\"Search\"\n leadingElement={<MagnifyingGlassIconOutline />}\n isClearable={true}\n onChange={(event) => setGlobalFilter(event.target.value)}\n />\n <OpenFilterMenuIconButton\n isOpen={isOpen}\n onClick={handleClick}\n description=\"Filter Menu\"\n />\n </div>\n </div>\n <Divider />\n <DataGrid isResizable={true} tableInstance={table} />\n <Popover\n isOpen={isOpen}\n anchorElement={anchorEl}\n onOpenChange={(isOpen) => {\n if (!isOpen) {\n handleClose();\n }\n }}\n offset={({ rects }) => ({\n crossAxis: -rects.floating.width,\n })}\n >\n <Popover.Content>\n <div className=\"n-grid n-gap-token-16 n-p-token-24 n-w-[300px]\">\n <div className=\"n-w-full n-flex n-justify-between n-items-center\">\n <Typography variant=\"title-4\">Filter</Typography>\n <CleanIconButton\n onClick={handleClose}\n description=\"Close filter menu\"\n size=\"medium\"\n htmlAttributes={{\n title: 'Close filter menu',\n }}\n >\n <XMarkIconOutline />\n </CleanIconButton>\n </div>\n <div className=\"n-flex n-flex-col n-gap-2\">\n <Typography\n variant=\"body-medium\"\n className=\"n-text-neutral-text-weaker n-pb-token-4\"\n >\n Age\n </Typography>\n <Checkbox\n isChecked={isAgeFilterApplied('min', 18)}\n label=\"Age >= 18\"\n onClick={() => toggleAgeFilter({ min: 18 })}\n />\n <Checkbox\n isChecked={isAgeFilterApplied('max', 63)}\n label=\"Age <= 63\"\n onClick={() => toggleAgeFilter({ max: 63 })}\n />\n </div>\n <TextButton\n className=\"n-mt-token-32 n-justify-self-end\"\n variant=\"danger\"\n aria-label=\"Clear filters\"\n onClick={() => {\n table.resetColumnFilters();\n }}\n >\n <Typography\n variant=\"body-medium\"\n className=\"n-text-danger-text n-font-bold\"\n >\n Clear all\n </Typography>\n </TextButton>\n </div>\n </Popover.Content>\n </Popover>\n </div>\n );\n};\n\nexport const ColumnFiltering = () => {\n const [tableData, setTableData] = useState(TABLE_DEMO_DATA);\n const [isAgeFilterApplied, setIsAgeFilterApplied] = useState(false);\n const columnHelper = createColumnHelper<TestDataFormat>();\n\n const ColumnActions: ColumnMeta<TestDataFormat, unknown> = {\n columnActions: {\n actions: [\n {\n onClick: () => {\n // Filter the input table data value, TABLE_DEMO_DATA\n if (isAgeFilterApplied) {\n setTableData(TABLE_DEMO_DATA);\n setIsAgeFilterApplied(false);\n return;\n } else {\n const filteredData = TABLE_DEMO_DATA.filter(\n (data) => data.age >= 18,\n );\n setTableData(filteredData);\n setIsAgeFilterApplied(true);\n }\n },\n title: 'Age >= 18',\n },\n ],\n },\n };\n\n const columns = [\n columnHelper.accessor('name', {\n cell: (info) => info.getValue(),\n maxSize: 300,\n minSize: 180,\n size: 220,\n }),\n columnHelper.accessor('age', {\n cell: (info) => info.getValue(),\n header: () => <div>Age</div>,\n meta: {\n ...ColumnActions,\n },\n minSize: 80,\n }),\n columnHelper.accessor('cypherCommand', {\n cell: (info) => info.getValue(),\n minSize: 400,\n size: 400,\n }),\n ];\n\n const table = useReactTable({\n columnResizeMode: 'onChange',\n columns,\n data: tableData,\n debugColumns: true,\n debugHeaders: true,\n debugTable: true,\n defaultColumn: {\n maxSize: 800,\n minSize: 80,\n },\n enableSorting: true,\n getCoreRowModel: getCoreRowModel(),\n getPaginationRowModel: getPaginationRowModel(),\n getSortedRowModel: getSortedRowModel(),\n initialState: {\n pagination: {\n pageSize: 5,\n },\n },\n });\n\n return (\n <div className=\"n-h-[1000px] n-w-full n-bg-primary-bg-weak n-p-token-32\">\n <DataGrid\n isKeyboardNavigable={true}\n isResizable={true}\n tableInstance={table}\n />\n </div>\n );\n};\n"]}
|
|
@@ -35,10 +35,10 @@ import { DataGrid } from '@neo4j-ndl/react';
|
|
|
35
35
|
import { createColumnHelper, getCoreRowModel, getPaginationRowModel, getSortedRowModel, useReactTable, } from '@tanstack/react-table';
|
|
36
36
|
import { useVirtualizer } from '@tanstack/react-virtual';
|
|
37
37
|
import { useMemo, useRef } from 'react';
|
|
38
|
-
const TABLE_DEMO_DATA = Array.from({ length: 1000 }, (
|
|
38
|
+
const TABLE_DEMO_DATA = Array.from({ length: 1000 }, (_unused, index) => ({
|
|
39
39
|
age: Math.floor(Math.random() * 100),
|
|
40
|
-
cypherCommand: `MATCH (n) RETURN n LIMIT ${
|
|
41
|
-
name: `Person ${
|
|
40
|
+
cypherCommand: `MATCH (n) RETURN n LIMIT ${index + 1}`,
|
|
41
|
+
name: `Person ${index + 1}`,
|
|
42
42
|
}));
|
|
43
43
|
const BodyCurryingFunction = (rowVirtualizer, ref, table) =>
|
|
44
44
|
// eslint-disable-next-line react/display-name
|
|
@@ -62,8 +62,8 @@ const BodyCurryingFunction = (rowVirtualizer, ref, table) =>
|
|
|
62
62
|
} }, `table-row-${row.index}`));
|
|
63
63
|
}) })) }));
|
|
64
64
|
};
|
|
65
|
-
/** Repeats array `
|
|
66
|
-
const repeat = (arr,
|
|
65
|
+
/** Repeats array `repeatCount` times */
|
|
66
|
+
const repeat = (arr, repeatCount) => Array(repeatCount).fill(arr).flat();
|
|
67
67
|
const columnHelper = createColumnHelper();
|
|
68
68
|
const columns = [
|
|
69
69
|
columnHelper.accessor('name', {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"datagrid-virtualization.story.js","sourceRoot":"","sources":["../../../../src/data-grid/stories/datagrid-virtualization.story.tsx"],"names":[],"mappings":";;;;;;;;;;;;AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,OAAO,yCAAyC,CAAC;AAEjD,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAC5C,OAAO,EACL,kBAAkB,EAClB,eAAe,EACf,qBAAqB,EACrB,iBAAiB,EAEjB,aAAa,GACd,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAE,cAAc,EAAoB,MAAM,yBAAyB,CAAC;AAC3E,OAAO,EAAkB,OAAO,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AAUxD,MAAM,eAAe,GAAqB,KAAK,CAAC,IAAI,CAClD,EAAE,MAAM,EAAE,IAAI,EAAE,EAChB,CAAC,
|
|
1
|
+
{"version":3,"file":"datagrid-virtualization.story.js","sourceRoot":"","sources":["../../../../src/data-grid/stories/datagrid-virtualization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,EAAE;QACtB,gBAAgB,EAAE,GAAG,EAAE,CAAC,kBAAkB,CAAC,OAAO;QAClD,+DAA+D;QAC/D,QAAQ,EAAE,EAAE;KACb,CAAC,CAAC;IAEH,MAAM,KAAK,GAAG,aAAa,iCACtB,aAAa,KAChB,aAAa,EAAE,IAAI,EACnB,iBAAiB,EAAE,iBAAiB,EAAE,EACtC,YAAY,EAAE;YACZ,UAAU,EAAE;gBACV,QAAQ,EAAE,aAAa,CAAC,IAAI,CAAC,MAAM;aACpC;SACF,IACD,CAAC;IAEH,MAAM,UAAU,GAAG,OAAO,CAAC,GAAG,EAAE;QAC9B,OAAO,oBAAoB,CAAC,cAAc,EAAE,kBAAkB,EAAE,KAAK,CAAC,CAAC;IACzE,CAAC,EAAE,CAAC,cAAc,EAAE,kBAAkB,EAAE,KAAK,CAAC,CAAC,CAAC;IAEhD,OAAO,CACL,cACE,SAAS,EAAC,0CAA0C,EACpD,KAAK,EAAE,EAAE,MAAM,EAAE,OAAO,EAAE,YAE1B,KAAC,QAAQ,IACP,UAAU,EAAE;gBACV,IAAI,EAAE,UAAU;gBAChB,uBAAuB,EAAE,IAAI;gBAC7B,WAAW,EAAE,IAAI;aAClB,EACD,WAAW,EAAE,KAAK,EAClB,aAAa,EAAE,KAAK,EACpB,SAAS,EAAE;gBACT,SAAS,EAAE,UAAU;aACtB,GACD,GACE,CACP,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,SAAS,CAAC","sourcesContent":["/**\n *\n * Copyright (c) \"Neo4j\"\n * Neo4j Sweden AB [http://neo4j.com]\n *\n * This file is part of Neo4j.\n *\n * Neo4j is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with this program. If not, see <http://www.gnu.org/licenses/>.\n */\n\nimport '@neo4j-ndl/base/lib/neo4j-ds-styles.css';\n\nimport { DataGrid } from '@neo4j-ndl/react';\nimport {\n createColumnHelper,\n getCoreRowModel,\n getPaginationRowModel,\n getSortedRowModel,\n type Table as DataGridType,\n useReactTable,\n} from '@tanstack/react-table';\nimport { useVirtualizer, type Virtualizer } from '@tanstack/react-virtual';\nimport { type RefObject, useMemo, useRef } from 'react';\n\nimport { type CommonProps } from '../../_common/types';\n\ntype TestDataFormat = {\n name: string;\n age: number;\n cypherCommand: string;\n};\n\nconst TABLE_DEMO_DATA: TestDataFormat[] = Array.from(\n { length: 1000 },\n (_unused, index) => ({\n age: Math.floor(Math.random() * 100),\n cypherCommand: `MATCH (n) RETURN n LIMIT ${index + 1}`,\n name: `Person ${index + 1}`,\n }),\n);\n\nconst BodyCurryingFunction =\n (\n rowVirtualizer: Virtualizer<HTMLDivElement, Element>,\n ref: RefObject<HTMLDivElement | null>,\n table: DataGridType<TestDataFormat>,\n ) =>\n // eslint-disable-next-line react/display-name\n ({\n style,\n className,\n ...props\n }: CommonProps<'div', { children?: React.ReactNode }>) => {\n const { rows } = table.getSortedRowModel();\n rowVirtualizer.setOptions({\n ...rowVirtualizer.options,\n count: rows.length,\n });\n const items = rowVirtualizer.getVirtualItems();\n\n return (\n <div ref={ref} className=\"n-overflow-auto n-h-[290px]\">\n <DataGrid.Body\n {...props}\n className={className}\n style={{\n ...style,\n height: `${rowVirtualizer.getTotalSize()}px`,\n position: 'relative',\n }}\n >\n {items.map((row: { index: number; size: number; start: number }) => {\n const foundRow = rows[row.index];\n if (foundRow === undefined) {\n return null;\n }\n\n return (\n <DataGrid.BodyRow\n key={`table-row-${row.index}`}\n row={foundRow}\n style={{\n height: `${row.size}px`,\n left: 0,\n position: 'absolute',\n top: 0,\n transform: `translateY(${row.start}px)`,\n width: '100%',\n }}\n />\n );\n })}\n </DataGrid.Body>\n </div>\n );\n };\n\n/** Repeats array `repeatCount` times */\nconst repeat = (arr: unknown[], repeatCount: number) =>\n Array(repeatCount).fill(arr).flat();\n\nconst columnHelper = createColumnHelper<TestDataFormat>();\n\nconst columns = [\n columnHelper.accessor('name', {\n cell: (info) => info.getValue(),\n footer: (info) => info.column.id,\n header: () => 'Name',\n maxSize: 300,\n minSize: 180,\n size: 220,\n }),\n columnHelper.accessor('age', {\n cell: (info) => info.renderValue(),\n footer: (info) => info.column.id,\n header: () => 'Age',\n minSize: 80,\n }),\n columnHelper.accessor('cypherCommand', {\n cell: (info) => info.getValue(),\n footer: (info) => info.column.id,\n header: () => 'Cypher Command',\n minSize: 400,\n size: 400,\n }),\n];\n\nconst ExtendedProps = {\n columnResizeMode: 'onChange' as const,\n columns,\n data: [...repeat(TABLE_DEMO_DATA, 500)],\n debugColumns: true,\n debugHeaders: true,\n debugTable: true,\n defaultColumn: {\n maxSize: 800,\n minSize: 80,\n },\n enableSorting: false,\n getCoreRowModel: getCoreRowModel(),\n getPaginationRowModel: getPaginationRowModel(),\n};\n\nconst Component = () => {\n const scrollingParentRef = useRef<HTMLDivElement | null>(null);\n\n const rowVirtualizer = useVirtualizer({\n count: ExtendedProps.data.length,\n estimateSize: () => 40,\n getScrollElement: () => scrollingParentRef.current,\n // 40 is the size for a basic data type row so fallback to that\n overscan: 15,\n });\n\n const table = useReactTable({\n ...ExtendedProps,\n enableSorting: true,\n getSortedRowModel: getSortedRowModel(),\n initialState: {\n pagination: {\n pageSize: ExtendedProps.data.length,\n },\n },\n });\n\n const CustomBody = useMemo(() => {\n return BodyCurryingFunction(rowVirtualizer, scrollingParentRef, table);\n }, [rowVirtualizer, scrollingParentRef, table]);\n\n return (\n <div\n className=\"n-w-full n-bg-light-neutral-text-weakest\"\n style={{ height: '400px' }}\n >\n <DataGrid\n components={{\n Body: CustomBody,\n PaginationNumericButton: null,\n RowsPerPage: null,\n }}\n isResizable={false}\n tableInstance={table}\n rootProps={{\n className: 'n-h-full',\n }}\n />\n </div>\n );\n};\n\nexport default Component;\n"]}
|
|
@@ -72,28 +72,28 @@ function getInterpolatedColor(colorRange, rowData, converters) {
|
|
|
72
72
|
}
|
|
73
73
|
let rgb;
|
|
74
74
|
if (midRgb !== undefined && resolvedMidValue !== undefined) {
|
|
75
|
-
const
|
|
76
|
-
if (
|
|
75
|
+
const weight = getNumericWeight(resolvedMinValue, resolvedMidValue, clampedValue);
|
|
76
|
+
if (weight === null) {
|
|
77
77
|
return null;
|
|
78
78
|
}
|
|
79
|
-
const isBetweenMinAndMid =
|
|
79
|
+
const isBetweenMinAndMid = weight <= 1;
|
|
80
80
|
if (isBetweenMinAndMid) {
|
|
81
|
-
rgb = lerpColor(minRgb, midRgb,
|
|
81
|
+
rgb = lerpColor(minRgb, midRgb, weight);
|
|
82
82
|
}
|
|
83
83
|
else {
|
|
84
|
-
const
|
|
85
|
-
if (
|
|
84
|
+
const midToMaxWeight = getNumericWeight(resolvedMidValue, resolvedMaxValue, clampedValue);
|
|
85
|
+
if (midToMaxWeight === null) {
|
|
86
86
|
return null;
|
|
87
87
|
}
|
|
88
|
-
rgb = lerpColor(midRgb, maxRgb,
|
|
88
|
+
rgb = lerpColor(midRgb, maxRgb, midToMaxWeight);
|
|
89
89
|
}
|
|
90
90
|
}
|
|
91
91
|
else {
|
|
92
|
-
const
|
|
93
|
-
if (
|
|
92
|
+
const weight = getNumericWeight(resolvedMinValue, resolvedMaxValue, clampedValue);
|
|
93
|
+
if (weight === null) {
|
|
94
94
|
return null;
|
|
95
95
|
}
|
|
96
|
-
rgb = lerpColor(minRgb, maxRgb,
|
|
96
|
+
rgb = lerpColor(minRgb, maxRgb, weight);
|
|
97
97
|
}
|
|
98
98
|
return rgbToHex(rgb);
|
|
99
99
|
}
|
|
@@ -194,25 +194,25 @@ function evaluateWhere(rowData, where, converters) {
|
|
|
194
194
|
return isMatch === null ? null : !isMatch;
|
|
195
195
|
}
|
|
196
196
|
if ('lessThan' in where) {
|
|
197
|
-
return safeCompare(where.lessThan[0], where.lessThan[1], rowData, (
|
|
197
|
+
return safeCompare(where.lessThan[0], where.lessThan[1], rowData, (leftVal, rightVal) => leftVal < rightVal, converters);
|
|
198
198
|
}
|
|
199
199
|
if ('lessThanOrEqual' in where) {
|
|
200
|
-
return safeCompare(where.lessThanOrEqual[0], where.lessThanOrEqual[1], rowData, (
|
|
200
|
+
return safeCompare(where.lessThanOrEqual[0], where.lessThanOrEqual[1], rowData, (leftVal, rightVal) => leftVal <= rightVal, converters);
|
|
201
201
|
}
|
|
202
202
|
if ('greaterThan' in where) {
|
|
203
|
-
return safeCompare(where.greaterThan[0], where.greaterThan[1], rowData, (
|
|
203
|
+
return safeCompare(where.greaterThan[0], where.greaterThan[1], rowData, (leftVal, rightVal) => leftVal > rightVal, converters);
|
|
204
204
|
}
|
|
205
205
|
if ('greaterThanOrEqual' in where) {
|
|
206
|
-
return safeCompare(where.greaterThanOrEqual[0], where.greaterThanOrEqual[1], rowData, (
|
|
206
|
+
return safeCompare(where.greaterThanOrEqual[0], where.greaterThanOrEqual[1], rowData, (leftVal, rightVal) => leftVal >= rightVal, converters);
|
|
207
207
|
}
|
|
208
208
|
if ('contains' in where) {
|
|
209
|
-
return safeStringCompare(where.contains[0], where.contains[1], rowData, (
|
|
209
|
+
return safeStringCompare(where.contains[0], where.contains[1], rowData, (leftVal, rightVal) => leftVal.includes(rightVal), converters);
|
|
210
210
|
}
|
|
211
211
|
if ('startsWith' in where) {
|
|
212
|
-
return safeStringCompare(where.startsWith[0], where.startsWith[1], rowData, (
|
|
212
|
+
return safeStringCompare(where.startsWith[0], where.startsWith[1], rowData, (leftVal, rightVal) => leftVal.startsWith(rightVal), converters);
|
|
213
213
|
}
|
|
214
214
|
if ('endsWith' in where) {
|
|
215
|
-
return safeStringCompare(where.endsWith[0], where.endsWith[1], rowData, (
|
|
215
|
+
return safeStringCompare(where.endsWith[0], where.endsWith[1], rowData, (leftVal, rightVal) => leftVal.endsWith(rightVal), converters);
|
|
216
216
|
}
|
|
217
217
|
if ('isNull' in where) {
|
|
218
218
|
const value = resolveValue(where.isNull, rowData, converters);
|
|
@@ -281,7 +281,7 @@ function resolveAppliedStyle(apply, rowData, converters) {
|
|
|
281
281
|
* Used internally by hooks, but exported for context-free usage.
|
|
282
282
|
*/
|
|
283
283
|
export function computeDataGridRowStyles(rules, rowData, converters) {
|
|
284
|
-
const enabledRules = rules.filter((
|
|
284
|
+
const enabledRules = rules.filter((rule) => !rule.isDisabled);
|
|
285
285
|
const totalRules = enabledRules.length;
|
|
286
286
|
const sortedRules = enabledRules
|
|
287
287
|
.map((rule, index) => {
|
|
@@ -291,11 +291,11 @@ export function computeDataGridRowStyles(rules, rowData, converters) {
|
|
|
291
291
|
}
|
|
292
292
|
return Object.assign(Object.assign({}, rule), { _order: index, _priority: (_a = rule.priority) !== null && _a !== void 0 ? _a : index - totalRules });
|
|
293
293
|
})
|
|
294
|
-
.sort((
|
|
295
|
-
if (
|
|
296
|
-
return
|
|
294
|
+
.sort((leftRule, rightRule) => {
|
|
295
|
+
if (leftRule._priority !== rightRule._priority) {
|
|
296
|
+
return leftRule._priority - rightRule._priority;
|
|
297
297
|
}
|
|
298
|
-
return
|
|
298
|
+
return leftRule._order - rightRule._order;
|
|
299
299
|
});
|
|
300
300
|
const cellPriorityMap = {};
|
|
301
301
|
for (const rule of sortedRules) {
|
|
@@ -359,7 +359,7 @@ export function computeDataGridRowStyles(rules, rowData, converters) {
|
|
|
359
359
|
* Pure function -- no React context needed.
|
|
360
360
|
*
|
|
361
361
|
* @param rules - Array of style rules to evaluate
|
|
362
|
-
* @param rowData - The row's data as a record (column id
|
|
362
|
+
* @param rowData - The row's data as a record (column id to value)
|
|
363
363
|
* @param columnId - Returns the computed style for this specific cell.
|
|
364
364
|
* @param converters - Optional per-column value converters for complex cell types.
|
|
365
365
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"evaluate.js","sourceRoot":"","sources":["../../../../src/data-grid/style-rules/evaluate.ts"],"names":[],"mappings":"AAA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;QACxE,yEAAyE;QACzE,IACE,KAAK,CAAC,eAAe;YACrB,CAAC,KAAK,CAAC,KAAK;YACZ,QAAQ,CAAC,KAAK,CAAC,eAAe,CAAC,EAC/B,CAAC;YACD,KAAK,CAAC,KAAK,GAAG,SAAS;iBACpB,YAAY,CACX,KAAK,CAAC,eAAe,EACrB;gBACE,MAAM,CAAC,KAAK,CAAC,KAAK,CAAC,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,OAAO;gBAC7C,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,OAAO;aAC7C;YACD,mFAAmF;YACnF,wEAAwE;YACxE,EAAE,qBAAqB,EAAE,IAAI,EAAE,CAChC;iBACA,QAAQ,EAAE,CAAC;YACd,OAAO,GAAG,IAAI,CAAC;QACjB,CAAC;QAED,UAAU,CAAC,GAAG,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,SAAS,CAAC;IAChD,CAAC;IAED,OAAO,EAAE,UAAU,EAAE,CAAC;AACxB,CAAC;AAED;;;;;;;;GAQG;AACH,MAAM,UAAU,0BAA0B,CACxC,KAA0B,EAC1B,OAAgC,EAChC,QAAgB,EAChB,UAA6C;IAE7C,MAAM,EAAE,UAAU,EAAE,GAAG,wBAAwB,CAAC,KAAK,EAAE,OAAO,EAAE,UAAU,CAAC,CAAC;IAC5E,OAAO,UAAU,CAAC,QAAQ,CAAC,CAAC;AAC9B,CAAC","sourcesContent":["/**\n *\n * Copyright (c) \"Neo4j\"\n * Neo4j Sweden AB [http://neo4j.com]\n *\n * This file is part of Neo4j.\n *\n * Neo4j is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with this program. If not, see <http://www.gnu.org/licenses/>.\n */\n\nimport { tokens } from '@neo4j-ndl/base';\nimport { color, type RgbColor, rgbToHex, validHex } from '@uiw/react-color';\nimport tinycolor from 'tinycolor2';\n\nimport {\n clampNumericValue,\n compareNumericValues,\n getNumericWeight,\n isBigintLiteral,\n isDatetimeLiteral,\n isLocalDatetimeLiteral,\n isTimeLiteral,\n lerpColor,\n type NumericValue,\n numericValuesEqual,\n parseDateString,\n parseLocalDateString,\n parseTimeString,\n resolveNumericLiteral,\n resolveRangeLiteral,\n} from '../../_generated/style-rules';\nimport {\n type DataGridCellStyle,\n type DataGridColorRange,\n type DataGridStyleRule,\n type DataGridStyleRuleOperand,\n type DataGridStyleRuleValueConverter,\n type DataGridStyleRuleValueConverters,\n type DataGridStyleRuleWhere,\n} from './types';\n\nfunction getInterpolatedColor(\n colorRange: DataGridColorRange,\n rowData: Record<string, unknown>,\n converters?: DataGridStyleRuleValueConverters,\n): string | null {\n const {\n onColumn,\n minValue,\n minColor,\n maxValue,\n maxColor,\n midValue,\n midColor,\n } = colorRange;\n\n if (!validHex(minColor) || !validHex(maxColor)) {\n return null;\n }\n\n const minRgb = color(minColor).rgb;\n const maxRgb = color(maxColor).rgb;\n const resolvedMinValue = resolveRangeLiteral(minValue);\n const resolvedMaxValue = resolveRangeLiteral(maxValue);\n if (resolvedMinValue === null || resolvedMaxValue === null) {\n return null;\n }\n const boundsOrder = compareNumericValues(resolvedMinValue, resolvedMaxValue);\n if (boundsOrder === null) {\n return null;\n }\n const actualMinValue = boundsOrder <= 0 ? resolvedMinValue : resolvedMaxValue;\n const actualMaxValue = boundsOrder <= 0 ? resolvedMaxValue : resolvedMinValue;\n\n let midRgb: RgbColor | undefined = undefined;\n const resolvedMidValue =\n midValue === undefined ? undefined : resolveRangeLiteral(midValue);\n if (resolvedMidValue === null) {\n return null;\n }\n if (midValue !== undefined && midColor !== undefined) {\n const minToMid = compareNumericValues(actualMinValue, resolvedMidValue!);\n const midToMax = compareNumericValues(resolvedMidValue!, actualMaxValue);\n const isMidInRange =\n minToMid !== null && midToMax !== null && minToMid <= 0 && midToMax <= 0;\n if (!isMidInRange || !validHex(midColor)) {\n return null;\n }\n midRgb = color(midColor).rgb;\n }\n\n const rawValue = rowData[onColumn];\n const resolved = resolveCellValue(rawValue, converters?.[onColumn]);\n let numericValue: NumericValue | null = null;\n if (typeof resolved === 'bigint') {\n numericValue = resolved;\n } else if (typeof resolved === 'number' && Number.isFinite(resolved)) {\n numericValue = resolved;\n }\n if (numericValue === null) {\n return null;\n }\n\n const clampedValue = clampNumericValue(\n numericValue,\n actualMinValue,\n actualMaxValue,\n );\n if (clampedValue === null) {\n return null;\n }\n\n let rgb: RgbColor;\n\n if (midRgb !== undefined && resolvedMidValue !== undefined) {\n const t = getNumericWeight(\n resolvedMinValue,\n resolvedMidValue,\n clampedValue,\n );\n if (t === null) {\n return null;\n }\n const isBetweenMinAndMid = t <= 1;\n if (isBetweenMinAndMid) {\n rgb = lerpColor(minRgb, midRgb, t);\n } else {\n const t2 = getNumericWeight(\n resolvedMidValue,\n resolvedMaxValue,\n clampedValue,\n );\n if (t2 === null) {\n return null;\n }\n rgb = lerpColor(midRgb, maxRgb, t2);\n }\n } else {\n const t = getNumericWeight(\n resolvedMinValue,\n resolvedMaxValue,\n clampedValue,\n );\n if (t === null) {\n return null;\n }\n rgb = lerpColor(minRgb, maxRgb, t);\n }\n\n return rgbToHex(rgb);\n}\n\n// --- Where clause evaluation ---\n\ntype Ternary = boolean | null;\ntype ResolvedStyleRuleValue = string | number | bigint | boolean | null;\n\nconst UNRESOLVED = Symbol('unresolved');\n\nfunction resolveNativeValue(\n value: unknown,\n): ResolvedStyleRuleValue | typeof UNRESOLVED {\n if (value === null) {\n return null;\n }\n if (\n typeof value === 'string' ||\n typeof value === 'boolean' ||\n typeof value === 'bigint' ||\n typeof value === 'number'\n ) {\n return value;\n }\n if (value instanceof Date) {\n const ts = value.getTime();\n return isNaN(ts) ? null : ts;\n }\n if (isDatetimeLiteral(value)) {\n return parseDateString(value.datetime);\n }\n if (isLocalDatetimeLiteral(value)) {\n return parseLocalDateString(value.localdatetime);\n }\n if (isTimeLiteral(value)) {\n return parseTimeString(value.time);\n }\n if (isBigintLiteral(value)) {\n return resolveNumericLiteral(value);\n }\n return UNRESOLVED;\n}\n\nfunction resolveCellValue(\n cellVal: unknown,\n converter?: DataGridStyleRuleValueConverter,\n): ResolvedStyleRuleValue {\n if (cellVal === undefined) {\n return null;\n }\n const native = resolveNativeValue(cellVal);\n if (native !== UNRESOLVED) {\n return native;\n }\n if (converter !== undefined) {\n const converted = converter(cellVal);\n if (converted === undefined) {\n return null;\n }\n const fromConverted = resolveNativeValue(converted);\n if (fromConverted !== UNRESOLVED) {\n return fromConverted;\n }\n }\n return null;\n}\n\nfunction resolveValue(\n value: DataGridStyleRuleOperand,\n rowData: Record<string, unknown>,\n converters?: DataGridStyleRuleValueConverters,\n): ResolvedStyleRuleValue {\n if (typeof value === 'object' && value !== null && 'column' in value) {\n return resolveCellValue(rowData[value.column], converters?.[value.column]);\n }\n const resolved = resolveNativeValue(value);\n return resolved === UNRESOLVED ? null : resolved;\n}\n\nfunction safeCompare(\n left: DataGridStyleRuleOperand,\n right: DataGridStyleRuleOperand,\n rowData: Record<string, unknown>,\n compareFn: (\n a: NonNullable<ResolvedStyleRuleValue>,\n b: NonNullable<ResolvedStyleRuleValue>,\n ) => boolean,\n converters?: DataGridStyleRuleValueConverters,\n): Ternary {\n const leftVal = resolveValue(left, rowData, converters);\n const rightVal = resolveValue(right, rowData, converters);\n if (leftVal === null || rightVal === null) {\n return null;\n }\n return compareFn(leftVal, rightVal);\n}\n\nfunction safeStringCompare(\n left: DataGridStyleRuleOperand,\n right: DataGridStyleRuleOperand,\n rowData: Record<string, unknown>,\n compareFn: (a: string, b: string) => boolean,\n converters?: DataGridStyleRuleValueConverters,\n): Ternary {\n const leftVal = resolveValue(left, rowData, converters);\n const rightVal = resolveValue(right, rowData, converters);\n if (\n leftVal === null ||\n rightVal === null ||\n typeof leftVal !== 'string' ||\n typeof rightVal !== 'string'\n ) {\n return null;\n }\n return compareFn(leftVal, rightVal);\n}\n\nfunction evaluateWhere(\n rowData: Record<string, unknown>,\n where?: DataGridStyleRuleWhere,\n converters?: DataGridStyleRuleValueConverters,\n): Ternary {\n if (!where) {\n return true;\n }\n\n if ('equal' in where) {\n const [left, right] = where.equal;\n const leftVal = resolveValue(left, rowData, converters);\n const rightVal = resolveValue(right, rowData, converters);\n if (leftVal === null || rightVal === null) {\n return null;\n }\n if (\n (typeof leftVal === 'number' || typeof leftVal === 'bigint') &&\n (typeof rightVal === 'number' || typeof rightVal === 'bigint')\n ) {\n return numericValuesEqual(leftVal, rightVal);\n }\n return leftVal === rightVal;\n }\n\n if ('not' in where) {\n const isMatch = evaluateWhere(rowData, where.not, converters);\n return isMatch === null ? null : !isMatch;\n }\n\n if ('lessThan' in where) {\n return safeCompare(\n where.lessThan[0],\n where.lessThan[1],\n rowData,\n (a, b) => a < b,\n converters,\n );\n }\n\n if ('lessThanOrEqual' in where) {\n return safeCompare(\n where.lessThanOrEqual[0],\n where.lessThanOrEqual[1],\n rowData,\n (a, b) => a <= b,\n converters,\n );\n }\n\n if ('greaterThan' in where) {\n return safeCompare(\n where.greaterThan[0],\n where.greaterThan[1],\n rowData,\n (a, b) => a > b,\n converters,\n );\n }\n\n if ('greaterThanOrEqual' in where) {\n return safeCompare(\n where.greaterThanOrEqual[0],\n where.greaterThanOrEqual[1],\n rowData,\n (a, b) => a >= b,\n converters,\n );\n }\n\n if ('contains' in where) {\n return safeStringCompare(\n where.contains[0],\n where.contains[1],\n rowData,\n (a, b) => a.includes(b),\n converters,\n );\n }\n\n if ('startsWith' in where) {\n return safeStringCompare(\n where.startsWith[0],\n where.startsWith[1],\n rowData,\n (a, b) => a.startsWith(b),\n converters,\n );\n }\n\n if ('endsWith' in where) {\n return safeStringCompare(\n where.endsWith[0],\n where.endsWith[1],\n rowData,\n (a, b) => a.endsWith(b),\n converters,\n );\n }\n\n if ('isNull' in where) {\n const value = resolveValue(where.isNull, rowData, converters);\n return value === null;\n }\n\n if ('and' in where) {\n let hasNull = false;\n for (const clause of where.and) {\n const isMatch = evaluateWhere(rowData, clause, converters);\n if (isMatch === false) {\n return false;\n }\n if (isMatch === null) {\n hasNull = true;\n }\n }\n return hasNull ? null : true;\n }\n\n if ('or' in where) {\n let hasNull = false;\n for (const clause of where.or) {\n const isMatch = evaluateWhere(rowData, clause, converters);\n if (isMatch === true) {\n return true;\n }\n if (isMatch === null) {\n hasNull = true;\n }\n }\n return hasNull ? null : false;\n }\n\n return false;\n}\n\n// --- Style resolution ---\n\nfunction resolveAppliedStyle(\n apply: DataGridCellStyle,\n rowData: Record<string, unknown>,\n converters?: DataGridStyleRuleValueConverters,\n): React.CSSProperties | undefined {\n const result: React.CSSProperties = {};\n let hasStyle = false;\n\n if (apply.color && !apply.color.isDisabled) {\n result.backgroundColor = apply.color.value;\n hasStyle = true;\n }\n\n if (apply.textColor && !apply.textColor.isDisabled) {\n result.color = apply.textColor.value;\n hasStyle = true;\n }\n\n if (apply.colorRange && !apply.colorRange.isDisabled) {\n const interpolated = getInterpolatedColor(\n apply.colorRange,\n rowData,\n converters,\n );\n if (interpolated !== null) {\n result.backgroundColor = interpolated;\n hasStyle = true;\n }\n }\n\n if (apply.textColorRange && !apply.textColorRange.isDisabled) {\n const interpolated = getInterpolatedColor(\n apply.textColorRange,\n rowData,\n converters,\n );\n if (interpolated !== null) {\n result.color = interpolated;\n hasStyle = true;\n }\n }\n\n return hasStyle ? result : undefined;\n}\n\nexport type ComputedDataGridStyles = {\n cellStyles: Record<string, React.CSSProperties | undefined>;\n};\n\ntype PriorityEntry = { value: string; priority: number };\ntype PropPriorityMap = Record<string, PriorityEntry>;\n\n/**\n * Computes styles for all cells in a row based on the given style rules.\n * When a rule's `column` is `null`, its style is applied to every cell.\n *\n * Used internally by hooks, but exported for context-free usage.\n */\nexport function computeDataGridRowStyles(\n rules: DataGridStyleRule[],\n rowData: Record<string, unknown>,\n converters?: DataGridStyleRuleValueConverters,\n): ComputedDataGridStyles {\n const enabledRules = rules.filter((r) => !r.isDisabled);\n const totalRules = enabledRules.length;\n\n const sortedRules = enabledRules\n .map((rule, index) => {\n if (rule.priority !== undefined && rule.priority < 0) {\n throw new Error(\n `DataGridStyleRule priority must be >= 0, got ${rule.priority}. Negative values are reserved for internal use.`,\n );\n }\n\n return {\n ...rule,\n _order: index,\n _priority: rule.priority ?? index - totalRules,\n };\n })\n .sort((a, b) => {\n if (a._priority !== b._priority) {\n return a._priority - b._priority;\n }\n return a._order - b._order;\n });\n\n const cellPriorityMap: Record<string, PropPriorityMap> = {};\n\n for (const rule of sortedRules) {\n const isMatching = evaluateWhere(rowData, rule.where, converters) === true;\n if (!isMatching) {\n continue;\n }\n\n const style = resolveAppliedStyle(rule.apply, rowData, converters);\n if (!style) {\n continue;\n }\n\n const effectivePriority = rule._priority;\n const affectedColumns =\n rule.column === null ? Object.keys(rowData) : [rule.column];\n\n for (const col of affectedColumns) {\n if (!cellPriorityMap[col]) {\n cellPriorityMap[col] = {};\n }\n for (const [prop, value] of Object.entries(style)) {\n const existing = cellPriorityMap[col][prop];\n if (!existing || effectivePriority >= existing.priority) {\n cellPriorityMap[col][prop] = {\n priority: effectivePriority,\n value: value as string,\n };\n }\n }\n }\n }\n\n const cellStyles: Record<string, React.CSSProperties | undefined> = {};\n for (const [col, propMap] of Object.entries(cellPriorityMap)) {\n const style: React.CSSProperties = {};\n let hasProp = false;\n for (const [prop, entry] of Object.entries(propMap)) {\n (style as Record<string, string>)[prop] = entry.value;\n hasProp = true;\n }\n\n // If no rule set an explicit text color for this cell, but a rule did set a\n // background: pick an accessible default so the user isn't left with\n // low-contrast text. An explicit `textColor`/`textColorRange` (even one\n // set to a color close to the background) always wins over this default.\n if (\n style.backgroundColor &&\n !style.color &&\n validHex(style.backgroundColor)\n ) {\n style.color = tinycolor\n .mostReadable(\n style.backgroundColor,\n [\n tokens.theme.light.color.neutral.text.default,\n tokens.theme.dark.color.neutral.text.default,\n ],\n // If none of the custom colors provided meet the required readability the function\n // falls back to pure black or pure white, whichever has better contrast\n { includeFallbackColors: true },\n )\n .toString();\n hasProp = true;\n }\n\n cellStyles[col] = hasProp ? style : undefined;\n }\n\n return { cellStyles };\n}\n\n/**\n * Evaluate style rules for a single cell.\n * Pure function -- no React context needed.\n *\n * @param rules - Array of style rules to evaluate\n * @param rowData - The row's data as a record (column id -> value)\n * @param columnId - Returns the computed style for this specific cell.\n * @param converters - Optional per-column value converters for complex cell types.\n */\nexport function evaluateDataGridStyleRules(\n rules: DataGridStyleRule[],\n rowData: Record<string, unknown>,\n columnId: string,\n converters?: DataGridStyleRuleValueConverters,\n): React.CSSProperties | undefined {\n const { cellStyles } = computeDataGridRowStyles(rules, rowData, converters);\n return cellStyles[columnId];\n}\n"]}
|
|
1
|
+
{"version":3,"file":"evaluate.js","sourceRoot":"","sources":["../../../../src/data-grid/style-rules/evaluate.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,OAAO,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AACzC,OAAO,EAAE,KAAK,EAAiB,QAAQ,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAC5E,OAAO,SAAS,MAAM,YAAY,CAAC;AAEnC,OAAO,EACL,iBAAiB,EACjB,oBAAoB,EACpB,gBAAgB,EAChB,eAAe,EACf,iBAAiB,EACjB,sBAAsB,EACtB,aAAa,EACb,SAAS,EAET,kBAAkB,EAClB,eAAe,EACf,oBAAoB,EACpB,eAAe,EACf,qBAAqB,EACrB,mBAAmB,GACpB,MAAM,8BAA8B,CAAC;AAWtC,SAAS,oBAAoB,CAC3B,UAA8B,EAC9B,OAAgC,EAChC,UAA6C;IAE7C,MAAM,EACJ,QAAQ,EACR,QAAQ,EACR,QAAQ,EACR,QAAQ,EACR,QAAQ,EACR,QA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ED,UAAU,CAAC,GAAG,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,SAAS,CAAC;IAChD,CAAC;IAED,OAAO,EAAE,UAAU,EAAE,CAAC;AACxB,CAAC;AAED;;;;;;;;GAQG;AACH,MAAM,UAAU,0BAA0B,CACxC,KAA0B,EAC1B,OAAgC,EAChC,QAAgB,EAChB,UAA6C;IAE7C,MAAM,EAAE,UAAU,EAAE,GAAG,wBAAwB,CAAC,KAAK,EAAE,OAAO,EAAE,UAAU,CAAC,CAAC;IAC5E,OAAO,UAAU,CAAC,QAAQ,CAAC,CAAC;AAC9B,CAAC","sourcesContent":["/**\n *\n * Copyright (c) \"Neo4j\"\n * Neo4j Sweden AB [http://neo4j.com]\n *\n * This file is part of Neo4j.\n *\n * Neo4j is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with this program. If not, see <http://www.gnu.org/licenses/>.\n */\n\nimport { tokens } from '@neo4j-ndl/base';\nimport { color, type RgbColor, rgbToHex, validHex } from '@uiw/react-color';\nimport tinycolor from 'tinycolor2';\n\nimport {\n clampNumericValue,\n compareNumericValues,\n getNumericWeight,\n isBigintLiteral,\n isDatetimeLiteral,\n isLocalDatetimeLiteral,\n isTimeLiteral,\n lerpColor,\n type NumericValue,\n numericValuesEqual,\n parseDateString,\n parseLocalDateString,\n parseTimeString,\n resolveNumericLiteral,\n resolveRangeLiteral,\n} from '../../_generated/style-rules';\nimport {\n type DataGridCellStyle,\n type DataGridColorRange,\n type DataGridStyleRule,\n type DataGridStyleRuleOperand,\n type DataGridStyleRuleValueConverter,\n type DataGridStyleRuleValueConverters,\n type DataGridStyleRuleWhere,\n} from './types';\n\nfunction getInterpolatedColor(\n colorRange: DataGridColorRange,\n rowData: Record<string, unknown>,\n converters?: DataGridStyleRuleValueConverters,\n): string | null {\n const {\n onColumn,\n minValue,\n minColor,\n maxValue,\n maxColor,\n midValue,\n midColor,\n } = colorRange;\n\n if (!validHex(minColor) || !validHex(maxColor)) {\n return null;\n }\n\n const minRgb = color(minColor).rgb;\n const maxRgb = color(maxColor).rgb;\n const resolvedMinValue = resolveRangeLiteral(minValue);\n const resolvedMaxValue = resolveRangeLiteral(maxValue);\n if (resolvedMinValue === null || resolvedMaxValue === null) {\n return null;\n }\n const boundsOrder = compareNumericValues(resolvedMinValue, resolvedMaxValue);\n if (boundsOrder === null) {\n return null;\n }\n const actualMinValue = boundsOrder <= 0 ? resolvedMinValue : resolvedMaxValue;\n const actualMaxValue = boundsOrder <= 0 ? resolvedMaxValue : resolvedMinValue;\n\n let midRgb: RgbColor | undefined = undefined;\n const resolvedMidValue =\n midValue === undefined ? undefined : resolveRangeLiteral(midValue);\n if (resolvedMidValue === null) {\n return null;\n }\n if (midValue !== undefined && midColor !== undefined) {\n const minToMid = compareNumericValues(actualMinValue, resolvedMidValue!);\n const midToMax = compareNumericValues(resolvedMidValue!, actualMaxValue);\n const isMidInRange =\n minToMid !== null && midToMax !== null && minToMid <= 0 && midToMax <= 0;\n if (!isMidInRange || !validHex(midColor)) {\n return null;\n }\n midRgb = color(midColor).rgb;\n }\n\n const rawValue = rowData[onColumn];\n const resolved = resolveCellValue(rawValue, converters?.[onColumn]);\n let numericValue: NumericValue | null = null;\n if (typeof resolved === 'bigint') {\n numericValue = resolved;\n } else if (typeof resolved === 'number' && Number.isFinite(resolved)) {\n numericValue = resolved;\n }\n if (numericValue === null) {\n return null;\n }\n\n const clampedValue = clampNumericValue(\n numericValue,\n actualMinValue,\n actualMaxValue,\n );\n if (clampedValue === null) {\n return null;\n }\n\n let rgb: RgbColor;\n\n if (midRgb !== undefined && resolvedMidValue !== undefined) {\n const weight = getNumericWeight(\n resolvedMinValue,\n resolvedMidValue,\n clampedValue,\n );\n if (weight === null) {\n return null;\n }\n const isBetweenMinAndMid = weight <= 1;\n if (isBetweenMinAndMid) {\n rgb = lerpColor(minRgb, midRgb, weight);\n } else {\n const midToMaxWeight = getNumericWeight(\n resolvedMidValue,\n resolvedMaxValue,\n clampedValue,\n );\n if (midToMaxWeight === null) {\n return null;\n }\n rgb = lerpColor(midRgb, maxRgb, midToMaxWeight);\n }\n } else {\n const weight = getNumericWeight(\n resolvedMinValue,\n resolvedMaxValue,\n clampedValue,\n );\n if (weight === null) {\n return null;\n }\n rgb = lerpColor(minRgb, maxRgb, weight);\n }\n\n return rgbToHex(rgb);\n}\n\n// --- Where clause evaluation ---\n\ntype Ternary = boolean | null;\ntype ResolvedStyleRuleValue = string | number | bigint | boolean | null;\n\nconst UNRESOLVED = Symbol('unresolved');\n\nfunction resolveNativeValue(\n value: unknown,\n): ResolvedStyleRuleValue | typeof UNRESOLVED {\n if (value === null) {\n return null;\n }\n if (\n typeof value === 'string' ||\n typeof value === 'boolean' ||\n typeof value === 'bigint' ||\n typeof value === 'number'\n ) {\n return value;\n }\n if (value instanceof Date) {\n const ts = value.getTime();\n return isNaN(ts) ? null : ts;\n }\n if (isDatetimeLiteral(value)) {\n return parseDateString(value.datetime);\n }\n if (isLocalDatetimeLiteral(value)) {\n return parseLocalDateString(value.localdatetime);\n }\n if (isTimeLiteral(value)) {\n return parseTimeString(value.time);\n }\n if (isBigintLiteral(value)) {\n return resolveNumericLiteral(value);\n }\n return UNRESOLVED;\n}\n\nfunction resolveCellValue(\n cellVal: unknown,\n converter?: DataGridStyleRuleValueConverter,\n): ResolvedStyleRuleValue {\n if (cellVal === undefined) {\n return null;\n }\n const native = resolveNativeValue(cellVal);\n if (native !== UNRESOLVED) {\n return native;\n }\n if (converter !== undefined) {\n const converted = converter(cellVal);\n if (converted === undefined) {\n return null;\n }\n const fromConverted = resolveNativeValue(converted);\n if (fromConverted !== UNRESOLVED) {\n return fromConverted;\n }\n }\n return null;\n}\n\nfunction resolveValue(\n value: DataGridStyleRuleOperand,\n rowData: Record<string, unknown>,\n converters?: DataGridStyleRuleValueConverters,\n): ResolvedStyleRuleValue {\n if (typeof value === 'object' && value !== null && 'column' in value) {\n return resolveCellValue(rowData[value.column], converters?.[value.column]);\n }\n const resolved = resolveNativeValue(value);\n return resolved === UNRESOLVED ? null : resolved;\n}\n\nfunction safeCompare(\n left: DataGridStyleRuleOperand,\n right: DataGridStyleRuleOperand,\n rowData: Record<string, unknown>,\n compareFn: (\n leftVal: NonNullable<ResolvedStyleRuleValue>,\n rightVal: NonNullable<ResolvedStyleRuleValue>,\n ) => boolean,\n converters?: DataGridStyleRuleValueConverters,\n): Ternary {\n const leftVal = resolveValue(left, rowData, converters);\n const rightVal = resolveValue(right, rowData, converters);\n if (leftVal === null || rightVal === null) {\n return null;\n }\n return compareFn(leftVal, rightVal);\n}\n\nfunction safeStringCompare(\n left: DataGridStyleRuleOperand,\n right: DataGridStyleRuleOperand,\n rowData: Record<string, unknown>,\n compareFn: (leftVal: string, rightVal: string) => boolean,\n converters?: DataGridStyleRuleValueConverters,\n): Ternary {\n const leftVal = resolveValue(left, rowData, converters);\n const rightVal = resolveValue(right, rowData, converters);\n if (\n leftVal === null ||\n rightVal === null ||\n typeof leftVal !== 'string' ||\n typeof rightVal !== 'string'\n ) {\n return null;\n }\n return compareFn(leftVal, rightVal);\n}\n\nfunction evaluateWhere(\n rowData: Record<string, unknown>,\n where?: DataGridStyleRuleWhere,\n converters?: DataGridStyleRuleValueConverters,\n): Ternary {\n if (!where) {\n return true;\n }\n\n if ('equal' in where) {\n const [left, right] = where.equal;\n const leftVal = resolveValue(left, rowData, converters);\n const rightVal = resolveValue(right, rowData, converters);\n if (leftVal === null || rightVal === null) {\n return null;\n }\n if (\n (typeof leftVal === 'number' || typeof leftVal === 'bigint') &&\n (typeof rightVal === 'number' || typeof rightVal === 'bigint')\n ) {\n return numericValuesEqual(leftVal, rightVal);\n }\n return leftVal === rightVal;\n }\n\n if ('not' in where) {\n const isMatch = evaluateWhere(rowData, where.not, converters);\n return isMatch === null ? null : !isMatch;\n }\n\n if ('lessThan' in where) {\n return safeCompare(\n where.lessThan[0],\n where.lessThan[1],\n rowData,\n (leftVal, rightVal) => leftVal < rightVal,\n converters,\n );\n }\n\n if ('lessThanOrEqual' in where) {\n return safeCompare(\n where.lessThanOrEqual[0],\n where.lessThanOrEqual[1],\n rowData,\n (leftVal, rightVal) => leftVal <= rightVal,\n converters,\n );\n }\n\n if ('greaterThan' in where) {\n return safeCompare(\n where.greaterThan[0],\n where.greaterThan[1],\n rowData,\n (leftVal, rightVal) => leftVal > rightVal,\n converters,\n );\n }\n\n if ('greaterThanOrEqual' in where) {\n return safeCompare(\n where.greaterThanOrEqual[0],\n where.greaterThanOrEqual[1],\n rowData,\n (leftVal, rightVal) => leftVal >= rightVal,\n converters,\n );\n }\n\n if ('contains' in where) {\n return safeStringCompare(\n where.contains[0],\n where.contains[1],\n rowData,\n (leftVal, rightVal) => leftVal.includes(rightVal),\n converters,\n );\n }\n\n if ('startsWith' in where) {\n return safeStringCompare(\n where.startsWith[0],\n where.startsWith[1],\n rowData,\n (leftVal, rightVal) => leftVal.startsWith(rightVal),\n converters,\n );\n }\n\n if ('endsWith' in where) {\n return safeStringCompare(\n where.endsWith[0],\n where.endsWith[1],\n rowData,\n (leftVal, rightVal) => leftVal.endsWith(rightVal),\n converters,\n );\n }\n\n if ('isNull' in where) {\n const value = resolveValue(where.isNull, rowData, converters);\n return value === null;\n }\n\n if ('and' in where) {\n let hasNull = false;\n for (const clause of where.and) {\n const isMatch = evaluateWhere(rowData, clause, converters);\n if (isMatch === false) {\n return false;\n }\n if (isMatch === null) {\n hasNull = true;\n }\n }\n return hasNull ? null : true;\n }\n\n if ('or' in where) {\n let hasNull = false;\n for (const clause of where.or) {\n const isMatch = evaluateWhere(rowData, clause, converters);\n if (isMatch === true) {\n return true;\n }\n if (isMatch === null) {\n hasNull = true;\n }\n }\n return hasNull ? null : false;\n }\n\n return false;\n}\n\n// --- Style resolution ---\n\nfunction resolveAppliedStyle(\n apply: DataGridCellStyle,\n rowData: Record<string, unknown>,\n converters?: DataGridStyleRuleValueConverters,\n): React.CSSProperties | undefined {\n const result: React.CSSProperties = {};\n let hasStyle = false;\n\n if (apply.color && !apply.color.isDisabled) {\n result.backgroundColor = apply.color.value;\n hasStyle = true;\n }\n\n if (apply.textColor && !apply.textColor.isDisabled) {\n result.color = apply.textColor.value;\n hasStyle = true;\n }\n\n if (apply.colorRange && !apply.colorRange.isDisabled) {\n const interpolated = getInterpolatedColor(\n apply.colorRange,\n rowData,\n converters,\n );\n if (interpolated !== null) {\n result.backgroundColor = interpolated;\n hasStyle = true;\n }\n }\n\n if (apply.textColorRange && !apply.textColorRange.isDisabled) {\n const interpolated = getInterpolatedColor(\n apply.textColorRange,\n rowData,\n converters,\n );\n if (interpolated !== null) {\n result.color = interpolated;\n hasStyle = true;\n }\n }\n\n return hasStyle ? result : undefined;\n}\n\nexport type ComputedDataGridStyles = {\n cellStyles: Record<string, React.CSSProperties | undefined>;\n};\n\ntype PriorityEntry = { value: string; priority: number };\ntype PropPriorityMap = Record<string, PriorityEntry>;\n\n/**\n * Computes styles for all cells in a row based on the given style rules.\n * When a rule's `column` is `null`, its style is applied to every cell.\n *\n * Used internally by hooks, but exported for context-free usage.\n */\nexport function computeDataGridRowStyles(\n rules: DataGridStyleRule[],\n rowData: Record<string, unknown>,\n converters?: DataGridStyleRuleValueConverters,\n): ComputedDataGridStyles {\n const enabledRules = rules.filter((rule) => !rule.isDisabled);\n const totalRules = enabledRules.length;\n\n const sortedRules = enabledRules\n .map((rule, index) => {\n if (rule.priority !== undefined && rule.priority < 0) {\n throw new Error(\n `DataGridStyleRule priority must be >= 0, got ${rule.priority}. Negative values are reserved for internal use.`,\n );\n }\n\n return {\n ...rule,\n _order: index,\n _priority: rule.priority ?? index - totalRules,\n };\n })\n .sort((leftRule, rightRule) => {\n if (leftRule._priority !== rightRule._priority) {\n return leftRule._priority - rightRule._priority;\n }\n return leftRule._order - rightRule._order;\n });\n\n const cellPriorityMap: Record<string, PropPriorityMap> = {};\n\n for (const rule of sortedRules) {\n const isMatching = evaluateWhere(rowData, rule.where, converters) === true;\n if (!isMatching) {\n continue;\n }\n\n const style = resolveAppliedStyle(rule.apply, rowData, converters);\n if (!style) {\n continue;\n }\n\n const effectivePriority = rule._priority;\n const affectedColumns =\n rule.column === null ? Object.keys(rowData) : [rule.column];\n\n for (const col of affectedColumns) {\n if (!cellPriorityMap[col]) {\n cellPriorityMap[col] = {};\n }\n for (const [prop, value] of Object.entries(style)) {\n const existing = cellPriorityMap[col][prop];\n if (!existing || effectivePriority >= existing.priority) {\n cellPriorityMap[col][prop] = {\n priority: effectivePriority,\n value: value as string,\n };\n }\n }\n }\n }\n\n const cellStyles: Record<string, React.CSSProperties | undefined> = {};\n for (const [col, propMap] of Object.entries(cellPriorityMap)) {\n const style: React.CSSProperties = {};\n let hasProp = false;\n for (const [prop, entry] of Object.entries(propMap)) {\n (style as Record<string, string>)[prop] = entry.value;\n hasProp = true;\n }\n\n // If no rule set an explicit text color for this cell, but a rule did set a\n // background: pick an accessible default so the user isn't left with\n // low-contrast text. An explicit `textColor`/`textColorRange` (even one\n // set to a color close to the background) always wins over this default.\n if (\n style.backgroundColor &&\n !style.color &&\n validHex(style.backgroundColor)\n ) {\n style.color = tinycolor\n .mostReadable(\n style.backgroundColor,\n [\n tokens.theme.light.color.neutral.text.default,\n tokens.theme.dark.color.neutral.text.default,\n ],\n // If none of the custom colors provided meet the required readability the function\n // falls back to pure black or pure white, whichever has better contrast\n { includeFallbackColors: true },\n )\n .toString();\n hasProp = true;\n }\n\n cellStyles[col] = hasProp ? style : undefined;\n }\n\n return { cellStyles };\n}\n\n/**\n * Evaluate style rules for a single cell.\n * Pure function -- no React context needed.\n *\n * @param rules - Array of style rules to evaluate\n * @param rowData - The row's data as a record (column id to value)\n * @param columnId - Returns the computed style for this specific cell.\n * @param converters - Optional per-column value converters for complex cell types.\n */\nexport function evaluateDataGridStyleRules(\n rules: DataGridStyleRule[],\n rowData: Record<string, unknown>,\n columnId: string,\n converters?: DataGridStyleRuleValueConverters,\n): React.CSSProperties | undefined {\n const { cellStyles } = computeDataGridRowStyles(rules, rowData, converters);\n return cellStyles[columnId];\n}\n"]}
|
|
@@ -195,7 +195,7 @@ export const DataGridStyleRuleSchema = z.object({
|
|
|
195
195
|
isDisabled: z.boolean().optional(),
|
|
196
196
|
/** Additional metadata about the rule. */
|
|
197
197
|
metaData: metaDataSchema.optional(),
|
|
198
|
-
/** Higher priority rules are applied later (override lower). Must be
|
|
198
|
+
/** Higher priority rules are applied later (override lower). Must be `>= 0`; negative values are reserved for internal use. Rules without explicit priority preserve their array order but are always applied before rules with explicit priority. */
|
|
199
199
|
priority: z.number().nonnegative().optional(),
|
|
200
200
|
/** Condition to evaluate. If omitted, rule always applies to matched column(s). */
|
|
201
201
|
where: DataGridStyleRuleWhereSchema.optional(),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../src/data-grid/style-rules/types.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EACL,mBAAmB,EACnB,qBAAqB,EACrB,0BAA0B,EAC1B,oBAAoB,EACpB,kBAAkB,EAClB,iBAAiB,GAClB,MAAM,8BAA8B,CAAC;AAEtC;;;GAGG;AAEH;;;GAGG;AACH,MAAM,CAAC,MAAM,8BAA8B,GAAG,CAAC,CAAC,KAAK,CAAC;IACpD,CAAC,CAAC,MAAM,EAAE;IACV,oBAAoB;IACpB,CAAC,CAAC,OAAO,EAAE;IACX,CAAC,CAAC,IAAI,EAAE;IACR,qBAAqB;IACrB,0BAA0B;IAC1B,iBAAiB;CAClB,CAAC,CAAC;AAKH,yEAAyE;AACzE,MAAM,CAAC,MAAM,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EAAE,cAAc,CAAC,QAAQ,EAAE;IACnC,oPAAoP;IACpP,QAAQ,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,WAAW,EAAE,CAAC,QAAQ,EAAE;IAC7C,mFAAmF;IACnF,KAAK,EAAE,4BAA4B,CAAC,QAAQ,EAAE;CAC/C,CAAC,CAAC;AAGH;;;;;;;;;;;;;;;;;;;GAmBG;AACH,MAAM,CAAC,MAAM,mBAAmB,GAAG,CACjC,KAAc,EACc,EAAE,CAC9B,uBAAuB,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC,OAAO,CAAC","sourcesContent":["/**\n *\n * Copyright (c) \"Neo4j\"\n * Neo4j Sweden AB [http://neo4j.com]\n *\n * This file is part of Neo4j.\n *\n * Neo4j is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with this program. If not, see <http://www.gnu.org/licenses/>.\n */\n\nimport { z } from 'zod';\n\nimport {\n BigintLiteralSchema,\n DatetimeLiteralSchema,\n LocalDatetimeLiteralSchema,\n NumericLiteralSchema,\n RangeLiteralSchema,\n TimeLiteralSchema,\n} from '../../_generated/style-rules';\n\n/*\n * Style types defined in Zod, so that we can use the schemas to generate JSON Schema.\n * This is useful for generating documentation, importing and for future integration into editors.\n */\n\n/**\n * A literal value used in style-rule where clauses, converter return values,\n * and cell data. Temporal wrappers resolve to numbers at evaluation time.\n */\nexport const DataGridStyleRuleLiteralSchema = z.union([\n z.string(),\n NumericLiteralSchema,\n z.boolean(),\n z.null(),\n DatetimeLiteralSchema,\n LocalDatetimeLiteralSchema,\n TimeLiteralSchema,\n]);\nexport type DataGridStyleRuleLiteral = z.infer<\n typeof DataGridStyleRuleLiteralSchema\n>;\n\n/** A JSON-safe bigint literal represented by a signed decimal string. */\nexport const DataGridBigintLiteralSchema = BigintLiteralSchema;\nexport type DataGridBigintLiteral = z.infer<typeof DataGridBigintLiteralSchema>;\n\n/** A number, native bigint, or JSON-safe bigint literal. */\nexport const DataGridNumericLiteralSchema = NumericLiteralSchema;\nexport type DataGridNumericLiteral = z.infer<\n typeof DataGridNumericLiteralSchema\n>;\n\n/** A numeric, datetime, localdatetime, or time literal used as a range boundary. */\nexport const DataGridRangeLiteralSchema = RangeLiteralSchema;\nexport type DataGridRangeLiteral = z.infer<typeof DataGridRangeLiteralSchema>;\n\n/** A reference to a column whose cell value is resolved at evaluation time. */\nexport const DataGridColumnRefSchema = z.object({ column: z.string() });\nexport type DataGridColumnRef = z.infer<typeof DataGridColumnRefSchema>;\n\n/**\n * An ISO 8601 or RFC 9557 datetime literal that resolves to a Unix millisecond\n * timestamp at evaluation time. Wraps the shared `DatetimeLiteralSchema` with a\n * DataGrid-specific name. Supported formats:\n * - RFC 9557 with IANA timezone: `\"2024-06-15T14:00:00[Europe/Stockholm]\"` (offset\n * inferred) or `\"2024-06-15T14:00:00+02:00[Europe/Stockholm]\"` (offset explicit)\n * - UTC or offset datetime: `\"2024-01-01T00:00:00Z\"`, `\"2024-01-01T00:00:00+02:00\"`\n * - Plain datetime (treated as UTC): `\"2024-01-01T14:30:00\"`\n * - Date-only (treated as UTC midnight): `\"2024-01-01\"`\n *\n * Unzoned datetimes without `Z` or an offset are treated as UTC wall-clock time.\n */\nexport const DataGridDatetimeLiteralSchema = DatetimeLiteralSchema;\nexport type DataGridDatetimeLiteral = z.infer<\n typeof DataGridDatetimeLiteralSchema\n>;\n\n/**\n * A plain (unzoned) ISO 8601 date or datetime literal that resolves to a Unix\n * millisecond timestamp in the browser's local timezone at evaluation time.\n * Wraps the shared `LocalDatetimeLiteralSchema` with a DataGrid-specific name.\n *\n * Only plain date/datetime strings without timezone qualifiers are accepted:\n * - Plain datetime: `\"2024-01-01T14:30:00\"`\n * - Date-only (treated as local midnight): `\"2024-01-01\"`\n *\n * Strings with `Z`, a UTC offset, or an IANA bracket are rejected — use\n * `{ datetime }` for timezone-aware instants.\n */\nexport const DataGridLocalDatetimeLiteralSchema = LocalDatetimeLiteralSchema;\nexport type DataGridLocalDatetimeLiteral = z.infer<\n typeof DataGridLocalDatetimeLiteralSchema\n>;\n\n/**\n * An ISO 8601 time literal that resolves to milliseconds since UTC midnight at\n * evaluation time. Wraps the shared `TimeLiteralSchema` with a DataGrid-specific\n * name. Supported formats:\n * - Local time (treated as UTC): `\"14:30:00\"`, `\"14:30:00.500\"`\n * - Offset time (UTC-normalised): `\"14:30:00+02:00\"`\n */\nexport const DataGridTimeLiteralSchema = TimeLiteralSchema;\nexport type DataGridTimeLiteral = z.infer<typeof DataGridTimeLiteralSchema>;\n\n/** An operand in a style-rule where clause -- either a literal value or a column reference. */\nexport const DataGridStyleRuleOperandSchema = z.union([\n DataGridColumnRefSchema,\n DataGridStyleRuleLiteralSchema,\n]);\nexport type DataGridStyleRuleOperand = z.infer<\n typeof DataGridStyleRuleOperandSchema\n>;\n\n/**\n * Recursive WHERE clause for conditional expressions.\n * Inspired by the graph visualization style rule system but adapted for tabular data.\n *\n * The type is manually defined for the export, since zod doesn't support\n * exporting inferred recursive types.\n */\nexport type DataGridStyleRuleWhere =\n | { not: DataGridStyleRuleWhere }\n | { and: DataGridStyleRuleWhere[] }\n | { or: DataGridStyleRuleWhere[] }\n | { equal: [DataGridStyleRuleOperand, DataGridStyleRuleOperand] }\n | { lessThan: [DataGridStyleRuleOperand, DataGridStyleRuleOperand] }\n | { lessThanOrEqual: [DataGridStyleRuleOperand, DataGridStyleRuleOperand] }\n | { greaterThan: [DataGridStyleRuleOperand, DataGridStyleRuleOperand] }\n | { greaterThanOrEqual: [DataGridStyleRuleOperand, DataGridStyleRuleOperand] }\n | { contains: [DataGridStyleRuleOperand, DataGridStyleRuleOperand] }\n | { startsWith: [DataGridStyleRuleOperand, DataGridStyleRuleOperand] }\n | { endsWith: [DataGridStyleRuleOperand, DataGridStyleRuleOperand] }\n | { isNull: DataGridStyleRuleOperand };\n\nexport const DataGridStyleRuleWhereSchema: z.ZodType<DataGridStyleRuleWhere> =\n z.lazy(() =>\n z.union([\n z.object({ not: DataGridStyleRuleWhereSchema }),\n z.object({ and: z.array(DataGridStyleRuleWhereSchema) }),\n z.object({ or: z.array(DataGridStyleRuleWhereSchema) }),\n z.object({\n equal: z.tuple([\n DataGridStyleRuleOperandSchema,\n DataGridStyleRuleOperandSchema,\n ]),\n }),\n z.object({\n lessThan: z.tuple([\n DataGridStyleRuleOperandSchema,\n DataGridStyleRuleOperandSchema,\n ]),\n }),\n z.object({\n lessThanOrEqual: z.tuple([\n DataGridStyleRuleOperandSchema,\n DataGridStyleRuleOperandSchema,\n ]),\n }),\n z.object({\n greaterThan: z.tuple([\n DataGridStyleRuleOperandSchema,\n DataGridStyleRuleOperandSchema,\n ]),\n }),\n z.object({\n greaterThanOrEqual: z.tuple([\n DataGridStyleRuleOperandSchema,\n DataGridStyleRuleOperandSchema,\n ]),\n }),\n z.object({\n contains: z.tuple([\n DataGridStyleRuleOperandSchema,\n DataGridStyleRuleOperandSchema,\n ]),\n }),\n z.object({\n startsWith: z.tuple([\n DataGridStyleRuleOperandSchema,\n DataGridStyleRuleOperandSchema,\n ]),\n }),\n z.object({\n endsWith: z.tuple([\n DataGridStyleRuleOperandSchema,\n DataGridStyleRuleOperandSchema,\n ]),\n }),\n z.object({ isNull: DataGridStyleRuleOperandSchema }),\n ]),\n );\n\n/**\n * Gradient coloring based on a continuous orderable column value.\n * Colors should be hex strings (#rrggbb).\n * Temporal range boundaries resolve to numbers before interpolation.\n * If the column value is missing or non-orderable, the colorRange is ignored.\n */\nexport const DataGridColorRangeSchema = z.object({\n /** Disable this color range without removing it. */\n isDisabled: z.boolean().optional(),\n /** Hex color (#rrggbb) at the maximum value. */\n maxColor: z.string(),\n /** The high end of the range. Values above this clamp to maxColor. */\n maxValue: DataGridRangeLiteralSchema,\n /** Hex color (#rrggbb) at the optional mid-point for a 3-stop gradient. */\n midColor: z.string().optional(),\n /** Optional inflection point between minValue and maxValue for a 3-stop gradient. */\n midValue: DataGridRangeLiteralSchema.optional(),\n /** Hex color (#rrggbb) at the minimum value. */\n minColor: z.string(),\n /** The low end of the range. Values below this clamp to minColor. */\n minValue: DataGridRangeLiteralSchema,\n /** The column whose orderable value drives the interpolation. */\n onColumn: z.string(),\n});\nexport type DataGridColorRange = z.infer<typeof DataGridColorRangeSchema>;\n\n/** A disable-able static color value. */\nexport const DataGridDisableableColorSchema = z.object({\n /** Disable this style without removing it. */\n isDisabled: z.boolean().optional(),\n /** The CSS color value (e.g. '#fee2e2'). */\n value: z.string(),\n});\nexport type DataGridDisableableColor = z.infer<\n typeof DataGridDisableableColorSchema\n>;\n\n/** Visual properties that a style rule can apply to a cell or row. */\nexport const DataGridCellStyleSchema = z.object({\n /** CSS background color / cell fill (e.g. '#fee2e2'). Matches the graph `Style.color`. */\n color: DataGridDisableableColorSchema.optional(),\n /** Gradient color interpolation applied to the cell fill. Matches the graph `Style.colorRange`. */\n colorRange: DataGridColorRangeSchema.optional(),\n /** CSS text color (e.g. '#991b1b'). Grid-only; no graph equivalent. */\n textColor: DataGridDisableableColorSchema.optional(),\n /** Gradient color interpolation applied to the text color. Grid-only; no graph equivalent. */\n textColorRange: DataGridColorRangeSchema.optional(),\n});\nexport type DataGridCellStyle = z.infer<typeof DataGridCellStyleSchema>;\n\n/**\n * metaData is an free-form object that can be used to store additional information about a style rule.\n * The data is not taken into account when evaluating the rule.\n */\nconst metaDataSchema = z.record(z.string(), z.unknown());\n\n/**\n * A function that converts a complex or non-scalar cell value into a\n * `DataGridStyleRuleLiteral` so it can participate in where-clause evaluation\n * and color-range interpolation.\n *\n * The function receives the raw cell value (`unknown`) and must return a scalar\n * (`string | number | bigint | { bigint: string } | boolean | null`) or a\n * temporal wrapper (`{ datetime: string }`, `{ localdatetime: string }`,\n * `{ time: string }`). The engine parses temporal wrappers to milliseconds.\n * Return `null` or `undefined` to signal that the value is missing or cannot\n * be represented.\n *\n * Note: converter functions are TypeScript-only — they cannot be serialized as\n * JSON, so no Zod schema is provided.\n */\nexport type DataGridStyleRuleValueConverter = (\n value: unknown,\n) => DataGridStyleRuleLiteral | undefined;\n\n/**\n * A map of column id → converter function.\n * Pass this as the `styleRuleValueConverters` prop on `DataGrid` to teach the\n * style-rule engine how to interpret complex cell values for specific columns.\n *\n * @example\n * ```ts\n * const converters: DataGridStyleRuleValueConverters = {\n * priority: (v) => {\n * const s = v as { min: number; max: number };\n * return s.max - s.min;\n * },\n * };\n * ```\n */\nexport type DataGridStyleRuleValueConverters = Record<\n string,\n DataGridStyleRuleValueConverter\n>;\n\n/** A single declarative rule that conditionally applies styles to DataGrid cells. */\nexport const DataGridStyleRuleSchema = z.object({\n /** Style properties to apply when the rule matches. */\n apply: DataGridCellStyleSchema,\n /** Which column this rule targets. Set to null to apply styles to all columns (row-level effect). */\n column: z.string().nullable(),\n /** Disable this rule without removing it. */\n isDisabled: z.boolean().optional(),\n /** Additional metadata about the rule. */\n metaData: metaDataSchema.optional(),\n /** Higher priority rules are applied later (override lower). Must be >= 0; negative values are reserved for internal use. Rules without explicit priority preserve their array order but are always applied before rules with explicit priority. */\n priority: z.number().nonnegative().optional(),\n /** Condition to evaluate. If omitted, rule always applies to matched column(s). */\n where: DataGridStyleRuleWhereSchema.optional(),\n});\nexport type DataGridStyleRule = z.infer<typeof DataGridStyleRuleSchema>;\n\n/**\n * Runtime type guard for {@link DataGridStyleRule}, backed by the internal Zod\n * schema. Narrows an `unknown` value to `DataGridStyleRule` when it is a valid\n * style rule.\n *\n * This lets consumers validate values without taking a dependency on Zod or on\n * our schema export. For example, it can be passed to another validation\n * library's custom check:\n *\n * @example\n * ```ts\n * import { z } from 'zod';\n * import { isDataGridStyleRule, type DataGridStyleRule } from '@neo4j-ndl/react';\n *\n * const formSchema = z.object({\n * rule: z.custom<DataGridStyleRule>(isDataGridStyleRule),\n * notes: z.string(),\n * });\n * ```\n */\nexport const isDataGridStyleRule = (\n value: unknown,\n): value is DataGridStyleRule =>\n DataGridStyleRuleSchema.safeParse(value).success;\n"]}
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../src/data-grid/style-rules/types.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EACL,mBAAmB,EACnB,qBAAqB,EACrB,0BAA0B,EAC1B,oBAAoB,EACpB,kBAAkB,EAClB,iBAAiB,GAClB,MAAM,8BAA8B,CAAC;AAEtC;;;GAGG;AAEH;;;GAGG;AACH,MAAM,CAAC,MAAM,8BAA8B,GAAG,CAAC,CAAC,KAAK,CAAC;IACpD,CAAC,CAAC,MAAM,EAAE;IACV,oBAAoB;IACpB,CAAC,CAAC,OAAO,EAAE;IACX,CAAC,CAAC,IAAI,EAAE;IACR,qBAAqB;IACrB,0BAA0B;IAC1B,iBAAiB;CAClB,CAAC,CAAC;AAKH,yEAAyE;AACzE,MAAM,CAAC,MAAM,2BAA2B,GAAG,mBAAmB,CAAC;AAG/D,4DAA4D;AAC5D,MAAM,CAAC,MAAM,4BAA4B,GAAG,oBAAoB,CAAC;AAKjE,oFAAoF;AACpF,MAAM,CAAC,MAAM,0BAA0B,GAAG,kBAAkB,CAAC;AAG7D,+EAA+E;AAC/E,MAAM,CAAC,MAAM,uBAAuB,GAAG,CAAC,CAAC,MAAM,CAAC,EAAE,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC;AAGxE;;;;;;;;;;;GAWG;AACH,MAAM,CAAC,MAAM,6BAA6B,GAAG,qBAAqB,CAAC;AAKnE;;;;;;;;;;;GAWG;AACH,MAAM,CAAC,MAAM,kCAAkC,GAAG,0BAA0B,CAAC;AAK7E;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,yBAAyB,GAAG,iB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AC,MAAM,CAAC;IAC9C,0FAA0F;IAC1F,KAAK,EAAE,8BAA8B,CAAC,QAAQ,EAAE;IAChD,mGAAmG;IACnG,UAAU,EAAE,wBAAwB,CAAC,QAAQ,EAAE;IAC/C,uEAAuE;IACvE,SAAS,EAAE,8BAA8B,CAAC,QAAQ,EAAE;IACpD,8FAA8F;IAC9F,cAAc,EAAE,wBAAwB,CAAC,QAAQ,EAAE;CACpD,CAAC,CAAC;AAGH;;;GAGG;AACH,MAAM,cAAc,GAAG,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC,OAAO,EAAE,CAAC,CAAC;AAyCzD,qFAAqF;AACrF,MAAM,CAAC,MAAM,uBAAuB,GAAG,CAAC,CAAC,MAAM,CAAC;IAC9C,uDAAuD;IACvD,KAAK,EAAE,uBAAuB;IAC9B,qGAAqG;IACrG,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IAC7B,6CAA6C;IAC7C,UAAU,EAAE,CAAC,CAAC,OAAO,EAAE,CAAC,QAAQ,EAAE;IAClC,0CAA0C;IAC1C,QAAQ,EAAE,cAAc,CAAC,QAAQ,EAAE;IACnC,sPAAsP;IACtP,QAAQ,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,WAAW,EAAE,CAAC,QAAQ,EAAE;IAC7C,mFAAmF;IACnF,KAAK,EAAE,4BAA4B,CAAC,QAAQ,EAAE;CAC/C,CAAC,CAAC;AAGH;;;;;;;;;;;;;;;;;;;GAmBG;AACH,MAAM,CAAC,MAAM,mBAAmB,GAAG,CACjC,KAAc,EACc,EAAE,CAC9B,uBAAuB,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC,OAAO,CAAC","sourcesContent":["/**\n *\n * Copyright (c) \"Neo4j\"\n * Neo4j Sweden AB [http://neo4j.com]\n *\n * This file is part of Neo4j.\n *\n * Neo4j is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with this program. If not, see <http://www.gnu.org/licenses/>.\n */\n\nimport { z } from 'zod';\n\nimport {\n BigintLiteralSchema,\n DatetimeLiteralSchema,\n LocalDatetimeLiteralSchema,\n NumericLiteralSchema,\n RangeLiteralSchema,\n TimeLiteralSchema,\n} from '../../_generated/style-rules';\n\n/*\n * Style types defined in Zod, so that we can use the schemas to generate JSON Schema.\n * This is useful for generating documentation, importing and for future integration into editors.\n */\n\n/**\n * A literal value used in style-rule where clauses, converter return values,\n * and cell data. Temporal wrappers resolve to numbers at evaluation time.\n */\nexport const DataGridStyleRuleLiteralSchema = z.union([\n z.string(),\n NumericLiteralSchema,\n z.boolean(),\n z.null(),\n DatetimeLiteralSchema,\n LocalDatetimeLiteralSchema,\n TimeLiteralSchema,\n]);\nexport type DataGridStyleRuleLiteral = z.infer<\n typeof DataGridStyleRuleLiteralSchema\n>;\n\n/** A JSON-safe bigint literal represented by a signed decimal string. */\nexport const DataGridBigintLiteralSchema = BigintLiteralSchema;\nexport type DataGridBigintLiteral = z.infer<typeof DataGridBigintLiteralSchema>;\n\n/** A number, native bigint, or JSON-safe bigint literal. */\nexport const DataGridNumericLiteralSchema = NumericLiteralSchema;\nexport type DataGridNumericLiteral = z.infer<\n typeof DataGridNumericLiteralSchema\n>;\n\n/** A numeric, datetime, localdatetime, or time literal used as a range boundary. */\nexport const DataGridRangeLiteralSchema = RangeLiteralSchema;\nexport type DataGridRangeLiteral = z.infer<typeof DataGridRangeLiteralSchema>;\n\n/** A reference to a column whose cell value is resolved at evaluation time. */\nexport const DataGridColumnRefSchema = z.object({ column: z.string() });\nexport type DataGridColumnRef = z.infer<typeof DataGridColumnRefSchema>;\n\n/**\n * An ISO 8601 or RFC 9557 datetime literal that resolves to a Unix millisecond\n * timestamp at evaluation time. Wraps the shared `DatetimeLiteralSchema` with a\n * DataGrid-specific name. Supported formats:\n * - RFC 9557 with IANA timezone: `\"2024-06-15T14:00:00[Europe/Stockholm]\"` (offset\n * inferred) or `\"2024-06-15T14:00:00+02:00[Europe/Stockholm]\"` (offset explicit)\n * - UTC or offset datetime: `\"2024-01-01T00:00:00Z\"`, `\"2024-01-01T00:00:00+02:00\"`\n * - Plain datetime (treated as UTC): `\"2024-01-01T14:30:00\"`\n * - Date-only (treated as UTC midnight): `\"2024-01-01\"`\n *\n * Unzoned datetimes without `Z` or an offset are treated as UTC wall-clock time.\n */\nexport const DataGridDatetimeLiteralSchema = DatetimeLiteralSchema;\nexport type DataGridDatetimeLiteral = z.infer<\n typeof DataGridDatetimeLiteralSchema\n>;\n\n/**\n * A plain (unzoned) ISO 8601 date or datetime literal that resolves to a Unix\n * millisecond timestamp in the browser's local timezone at evaluation time.\n * Wraps the shared `LocalDatetimeLiteralSchema` with a DataGrid-specific name.\n *\n * Only plain date/datetime strings without timezone qualifiers are accepted:\n * - Plain datetime: `\"2024-01-01T14:30:00\"`\n * - Date-only (treated as local midnight): `\"2024-01-01\"`\n *\n * Strings with `Z`, a UTC offset, or an IANA bracket are rejected — use\n * `{ datetime }` for timezone-aware instants.\n */\nexport const DataGridLocalDatetimeLiteralSchema = LocalDatetimeLiteralSchema;\nexport type DataGridLocalDatetimeLiteral = z.infer<\n typeof DataGridLocalDatetimeLiteralSchema\n>;\n\n/**\n * An ISO 8601 time literal that resolves to milliseconds since UTC midnight at\n * evaluation time. Wraps the shared `TimeLiteralSchema` with a DataGrid-specific\n * name. Supported formats:\n * - Local time (treated as UTC): `\"14:30:00\"`, `\"14:30:00.500\"`\n * - Offset time (UTC-normalised): `\"14:30:00+02:00\"`\n */\nexport const DataGridTimeLiteralSchema = TimeLiteralSchema;\nexport type DataGridTimeLiteral = z.infer<typeof DataGridTimeLiteralSchema>;\n\n/** An operand in a style-rule where clause -- either a literal value or a column reference. */\nexport const DataGridStyleRuleOperandSchema = z.union([\n DataGridColumnRefSchema,\n DataGridStyleRuleLiteralSchema,\n]);\nexport type DataGridStyleRuleOperand = z.infer<\n typeof DataGridStyleRuleOperandSchema\n>;\n\n/**\n * Recursive WHERE clause for conditional expressions.\n * Inspired by the graph visualization style rule system but adapted for tabular data.\n *\n * The type is manually defined for the export, since zod doesn't support\n * exporting inferred recursive types.\n */\nexport type DataGridStyleRuleWhere =\n | { not: DataGridStyleRuleWhere }\n | { and: DataGridStyleRuleWhere[] }\n | { or: DataGridStyleRuleWhere[] }\n | { equal: [DataGridStyleRuleOperand, DataGridStyleRuleOperand] }\n | { lessThan: [DataGridStyleRuleOperand, DataGridStyleRuleOperand] }\n | { lessThanOrEqual: [DataGridStyleRuleOperand, DataGridStyleRuleOperand] }\n | { greaterThan: [DataGridStyleRuleOperand, DataGridStyleRuleOperand] }\n | { greaterThanOrEqual: [DataGridStyleRuleOperand, DataGridStyleRuleOperand] }\n | { contains: [DataGridStyleRuleOperand, DataGridStyleRuleOperand] }\n | { startsWith: [DataGridStyleRuleOperand, DataGridStyleRuleOperand] }\n | { endsWith: [DataGridStyleRuleOperand, DataGridStyleRuleOperand] }\n | { isNull: DataGridStyleRuleOperand };\n\nexport const DataGridStyleRuleWhereSchema: z.ZodType<DataGridStyleRuleWhere> =\n z.lazy(() =>\n z.union([\n z.object({ not: DataGridStyleRuleWhereSchema }),\n z.object({ and: z.array(DataGridStyleRuleWhereSchema) }),\n z.object({ or: z.array(DataGridStyleRuleWhereSchema) }),\n z.object({\n equal: z.tuple([\n DataGridStyleRuleOperandSchema,\n DataGridStyleRuleOperandSchema,\n ]),\n }),\n z.object({\n lessThan: z.tuple([\n DataGridStyleRuleOperandSchema,\n DataGridStyleRuleOperandSchema,\n ]),\n }),\n z.object({\n lessThanOrEqual: z.tuple([\n DataGridStyleRuleOperandSchema,\n DataGridStyleRuleOperandSchema,\n ]),\n }),\n z.object({\n greaterThan: z.tuple([\n DataGridStyleRuleOperandSchema,\n DataGridStyleRuleOperandSchema,\n ]),\n }),\n z.object({\n greaterThanOrEqual: z.tuple([\n DataGridStyleRuleOperandSchema,\n DataGridStyleRuleOperandSchema,\n ]),\n }),\n z.object({\n contains: z.tuple([\n DataGridStyleRuleOperandSchema,\n DataGridStyleRuleOperandSchema,\n ]),\n }),\n z.object({\n startsWith: z.tuple([\n DataGridStyleRuleOperandSchema,\n DataGridStyleRuleOperandSchema,\n ]),\n }),\n z.object({\n endsWith: z.tuple([\n DataGridStyleRuleOperandSchema,\n DataGridStyleRuleOperandSchema,\n ]),\n }),\n z.object({ isNull: DataGridStyleRuleOperandSchema }),\n ]),\n );\n\n/**\n * Gradient coloring based on a continuous orderable column value.\n * Colors should be hex strings (#rrggbb).\n * Temporal range boundaries resolve to numbers before interpolation.\n * If the column value is missing or non-orderable, the colorRange is ignored.\n */\nexport const DataGridColorRangeSchema = z.object({\n /** Disable this color range without removing it. */\n isDisabled: z.boolean().optional(),\n /** Hex color (#rrggbb) at the maximum value. */\n maxColor: z.string(),\n /** The high end of the range. Values above this clamp to maxColor. */\n maxValue: DataGridRangeLiteralSchema,\n /** Hex color (#rrggbb) at the optional mid-point for a 3-stop gradient. */\n midColor: z.string().optional(),\n /** Optional inflection point between minValue and maxValue for a 3-stop gradient. */\n midValue: DataGridRangeLiteralSchema.optional(),\n /** Hex color (#rrggbb) at the minimum value. */\n minColor: z.string(),\n /** The low end of the range. Values below this clamp to minColor. */\n minValue: DataGridRangeLiteralSchema,\n /** The column whose orderable value drives the interpolation. */\n onColumn: z.string(),\n});\nexport type DataGridColorRange = z.infer<typeof DataGridColorRangeSchema>;\n\n/** A disable-able static color value. */\nexport const DataGridDisableableColorSchema = z.object({\n /** Disable this style without removing it. */\n isDisabled: z.boolean().optional(),\n /** The CSS color value (e.g. '#fee2e2'). */\n value: z.string(),\n});\nexport type DataGridDisableableColor = z.infer<\n typeof DataGridDisableableColorSchema\n>;\n\n/** Visual properties that a style rule can apply to a cell or row. */\nexport const DataGridCellStyleSchema = z.object({\n /** CSS background color / cell fill (e.g. '#fee2e2'). Matches the graph `Style.color`. */\n color: DataGridDisableableColorSchema.optional(),\n /** Gradient color interpolation applied to the cell fill. Matches the graph `Style.colorRange`. */\n colorRange: DataGridColorRangeSchema.optional(),\n /** CSS text color (e.g. '#991b1b'). Grid-only; no graph equivalent. */\n textColor: DataGridDisableableColorSchema.optional(),\n /** Gradient color interpolation applied to the text color. Grid-only; no graph equivalent. */\n textColorRange: DataGridColorRangeSchema.optional(),\n});\nexport type DataGridCellStyle = z.infer<typeof DataGridCellStyleSchema>;\n\n/**\n * metaData is an free-form object that can be used to store additional information about a style rule.\n * The data is not taken into account when evaluating the rule.\n */\nconst metaDataSchema = z.record(z.string(), z.unknown());\n\n/**\n * A function that converts a complex or non-scalar cell value into a\n * `DataGridStyleRuleLiteral` so it can participate in where-clause evaluation\n * and color-range interpolation.\n *\n * The function receives the raw cell value (`unknown`) and must return a scalar\n * (`string | number | bigint | { bigint: string } | boolean | null`) or a\n * temporal wrapper (`{ datetime: string }`, `{ localdatetime: string }`,\n * `{ time: string }`). The engine parses temporal wrappers to milliseconds.\n * Return `null` or `undefined` to signal that the value is missing or cannot\n * be represented.\n *\n * Note: converter functions are TypeScript-only — they cannot be serialized as\n * JSON, so no Zod schema is provided.\n */\nexport type DataGridStyleRuleValueConverter = (\n value: unknown,\n) => DataGridStyleRuleLiteral | undefined;\n\n/**\n * A map of column id → converter function.\n * Pass this as the `styleRuleValueConverters` prop on `DataGrid` to teach the\n * style-rule engine how to interpret complex cell values for specific columns.\n *\n * @example\n * ```ts\n * const converters: DataGridStyleRuleValueConverters = {\n * priority: (v) => {\n * const s = v as { min: number; max: number };\n * return s.max - s.min;\n * },\n * };\n * ```\n */\nexport type DataGridStyleRuleValueConverters = Record<\n string,\n DataGridStyleRuleValueConverter\n>;\n\n/** A single declarative rule that conditionally applies styles to DataGrid cells. */\nexport const DataGridStyleRuleSchema = z.object({\n /** Style properties to apply when the rule matches. */\n apply: DataGridCellStyleSchema,\n /** Which column this rule targets. Set to null to apply styles to all columns (row-level effect). */\n column: z.string().nullable(),\n /** Disable this rule without removing it. */\n isDisabled: z.boolean().optional(),\n /** Additional metadata about the rule. */\n metaData: metaDataSchema.optional(),\n /** Higher priority rules are applied later (override lower). Must be `>= 0`; negative values are reserved for internal use. Rules without explicit priority preserve their array order but are always applied before rules with explicit priority. */\n priority: z.number().nonnegative().optional(),\n /** Condition to evaluate. If omitted, rule always applies to matched column(s). */\n where: DataGridStyleRuleWhereSchema.optional(),\n});\nexport type DataGridStyleRule = z.infer<typeof DataGridStyleRuleSchema>;\n\n/**\n * Runtime type guard for {@link DataGridStyleRule}, backed by the internal Zod\n * schema. Narrows an `unknown` value to `DataGridStyleRule` when it is a valid\n * style rule.\n *\n * This lets consumers validate values without taking a dependency on Zod or on\n * our schema export. For example, it can be passed to another validation\n * library's custom check:\n *\n * @example\n * ```ts\n * import { z } from 'zod';\n * import { isDataGridStyleRule, type DataGridStyleRule } from '@neo4j-ndl/react';\n *\n * const formSchema = z.object({\n * rule: z.custom<DataGridStyleRule>(isDataGridStyleRule),\n * notes: z.string(),\n * });\n * ```\n */\nexport const isDataGridStyleRule = (\n value: unknown,\n): value is DataGridStyleRule =>\n DataGridStyleRuleSchema.safeParse(value).success;\n"]}
|
package/lib/esm/dialog/Dialog.js
CHANGED
|
@@ -76,16 +76,16 @@ const DialogComponent = (_a) => {
|
|
|
76
76
|
const generatedHeaderId = useId();
|
|
77
77
|
const [descriptionId, setDescriptionId] = useState(generatedDescriptionId);
|
|
78
78
|
const [headerId, setHeaderId] = useState(generatedHeaderId);
|
|
79
|
-
const handleCloseClick = (
|
|
80
|
-
|
|
81
|
-
onClose === null || onClose === void 0 ? void 0 : onClose(
|
|
79
|
+
const handleCloseClick = (event) => {
|
|
80
|
+
event.preventDefault();
|
|
81
|
+
onClose === null || onClose === void 0 ? void 0 : onClose(event, DialogCloseReason.CLOSE_BUTTON_CLICK);
|
|
82
82
|
};
|
|
83
|
-
const handleClose = (
|
|
83
|
+
const handleClose = (event, reason) => {
|
|
84
84
|
// Dialog should not be closed when backdrop is clicked
|
|
85
85
|
if (reason === ModalCloseReason.BACKDROP_CLICK) {
|
|
86
86
|
return;
|
|
87
87
|
}
|
|
88
|
-
onClose === null || onClose === void 0 ? void 0 : onClose(
|
|
88
|
+
onClose === null || onClose === void 0 ? void 0 : onClose(event, reason !== undefined ? convertCloseReason(reason) : undefined);
|
|
89
89
|
};
|
|
90
90
|
const hasHeaderChild = React.useMemo(() => {
|
|
91
91
|
const childrenArray = React.Children.toArray(children);
|