@neo4j-ndl/react 4.15.2 → 4.15.3

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.
Files changed (84) hide show
  1. package/lib/cjs/_generated/style-rules/color-utils.js +50 -0
  2. package/lib/cjs/_generated/style-rules/color-utils.js.map +1 -0
  3. package/lib/cjs/_generated/style-rules/date-utils.js +145 -0
  4. package/lib/cjs/_generated/style-rules/date-utils.js.map +1 -0
  5. package/lib/cjs/_generated/style-rules/index.js +38 -0
  6. package/lib/cjs/_generated/style-rules/index.js.map +1 -0
  7. package/lib/cjs/_generated/style-rules/literal-schemas.js +64 -0
  8. package/lib/cjs/_generated/style-rules/literal-schemas.js.map +1 -0
  9. package/lib/cjs/data-grid/stories/datagrid-rule-based-styling-datetime.story.js +286 -0
  10. package/lib/cjs/data-grid/stories/datagrid-rule-based-styling-datetime.story.js.map +1 -0
  11. package/lib/cjs/data-grid/stories/index.js +5 -1
  12. package/lib/cjs/data-grid/stories/index.js.map +1 -1
  13. package/lib/cjs/data-grid/style-rules/evaluate.js +13 -17
  14. package/lib/cjs/data-grid/style-rules/evaluate.js.map +1 -1
  15. package/lib/cjs/data-grid/style-rules/index.js +3 -1
  16. package/lib/cjs/data-grid/style-rules/index.js.map +1 -1
  17. package/lib/cjs/data-grid/style-rules/types.js +26 -2
  18. package/lib/cjs/data-grid/style-rules/types.js.map +1 -1
  19. package/lib/cjs/time-picker/TimePicker.js +36 -20
  20. package/lib/cjs/time-picker/TimePicker.js.map +1 -1
  21. package/lib/cjs/time-picker/generate-time-options.js +6 -3
  22. package/lib/cjs/time-picker/generate-time-options.js.map +1 -1
  23. package/lib/cjs/time-picker/needle-time.js +23 -9
  24. package/lib/cjs/time-picker/needle-time.js.map +1 -1
  25. package/lib/cjs/time-picker/stories/index.js +5 -1
  26. package/lib/cjs/time-picker/stories/index.js.map +1 -1
  27. package/lib/cjs/time-picker/stories/time-picker-with-seconds.story.js +32 -0
  28. package/lib/cjs/time-picker/stories/time-picker-with-seconds.story.js.map +1 -0
  29. package/lib/esm/_generated/style-rules/color-utils.js +46 -0
  30. package/lib/esm/_generated/style-rules/color-utils.js.map +1 -0
  31. package/lib/esm/_generated/style-rules/date-utils.js +141 -0
  32. package/lib/esm/_generated/style-rules/date-utils.js.map +1 -0
  33. package/lib/esm/_generated/style-rules/index.js +29 -0
  34. package/lib/esm/_generated/style-rules/index.js.map +1 -0
  35. package/lib/esm/_generated/style-rules/literal-schemas.js +61 -0
  36. package/lib/esm/_generated/style-rules/literal-schemas.js.map +1 -0
  37. package/lib/esm/data-grid/stories/datagrid-rule-based-styling-datetime.story.js +284 -0
  38. package/lib/esm/data-grid/stories/datagrid-rule-based-styling-datetime.story.js.map +1 -0
  39. package/lib/esm/data-grid/stories/index.js +3 -0
  40. package/lib/esm/data-grid/stories/index.js.map +1 -1
  41. package/lib/esm/data-grid/style-rules/evaluate.js +7 -11
  42. package/lib/esm/data-grid/style-rules/evaluate.js.map +1 -1
  43. package/lib/esm/data-grid/style-rules/index.js +1 -1
  44. package/lib/esm/data-grid/style-rules/index.js.map +1 -1
  45. package/lib/esm/data-grid/style-rules/types.js +25 -1
  46. package/lib/esm/data-grid/style-rules/types.js.map +1 -1
  47. package/lib/esm/time-picker/TimePicker.js +36 -20
  48. package/lib/esm/time-picker/TimePicker.js.map +1 -1
  49. package/lib/esm/time-picker/generate-time-options.js +6 -3
  50. package/lib/esm/time-picker/generate-time-options.js.map +1 -1
  51. package/lib/esm/time-picker/needle-time.js +23 -9
  52. package/lib/esm/time-picker/needle-time.js.map +1 -1
  53. package/lib/esm/time-picker/stories/index.js +3 -0
  54. package/lib/esm/time-picker/stories/index.js.map +1 -1
  55. package/lib/esm/time-picker/stories/time-picker-with-seconds.story.js +30 -0
  56. package/lib/esm/time-picker/stories/time-picker-with-seconds.story.js.map +1 -0
  57. package/lib/types/_generated/style-rules/color-utils.d.ts +33 -0
  58. package/lib/types/_generated/style-rules/color-utils.d.ts.map +1 -0
  59. package/lib/types/_generated/style-rules/date-utils.d.ts +54 -0
  60. package/lib/types/_generated/style-rules/date-utils.d.ts.map +1 -0
  61. package/lib/types/_generated/style-rules/index.d.ts +25 -0
  62. package/lib/types/_generated/style-rules/index.d.ts.map +1 -0
  63. package/lib/types/_generated/style-rules/literal-schemas.d.ts +53 -0
  64. package/lib/types/_generated/style-rules/literal-schemas.d.ts.map +1 -0
  65. package/lib/types/data-grid/stories/datagrid-rule-based-styling-datetime.story.d.ts +24 -0
  66. package/lib/types/data-grid/stories/datagrid-rule-based-styling-datetime.story.d.ts.map +1 -0
  67. package/lib/types/data-grid/stories/index.d.ts +2 -0
  68. package/lib/types/data-grid/stories/index.d.ts.map +1 -1
  69. package/lib/types/data-grid/style-rules/evaluate.d.ts.map +1 -1
  70. package/lib/types/data-grid/style-rules/index.d.ts +2 -2
  71. package/lib/types/data-grid/style-rules/index.d.ts.map +1 -1
  72. package/lib/types/data-grid/style-rules/types.d.ts +33 -2
  73. package/lib/types/data-grid/style-rules/types.d.ts.map +1 -1
  74. package/lib/types/time-picker/TimePicker.d.ts +1 -1
  75. package/lib/types/time-picker/TimePicker.d.ts.map +1 -1
  76. package/lib/types/time-picker/generate-time-options.d.ts +1 -1
  77. package/lib/types/time-picker/generate-time-options.d.ts.map +1 -1
  78. package/lib/types/time-picker/needle-time.d.ts +4 -2
  79. package/lib/types/time-picker/needle-time.d.ts.map +1 -1
  80. package/lib/types/time-picker/stories/index.d.ts +2 -0
  81. package/lib/types/time-picker/stories/index.d.ts.map +1 -1
  82. package/lib/types/time-picker/stories/time-picker-with-seconds.story.d.ts +24 -0
  83. package/lib/types/time-picker/stories/time-picker-with-seconds.story.d.ts.map +1 -0
  84. package/package.json +6 -4
@@ -0,0 +1 @@
1
+ {"version":3,"file":"datagrid-rule-based-styling-datetime.story.js","sourceRoot":"","sources":["../../../../src/data-grid/stories/datagrid-rule-based-styling-datetime.story.tsx"],"names":[],"mappings":";;;AAAA;;;;;;;;;;;;;;;;;;;G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W,EAAE,KAAK,EAClB,mBAAmB,EAAE,KAAK,EAC1B,aAAa,EAAE,KAAK,EACpB,UAAU,EAAE,UAAU,EACtB,OAAO,EAAE;gBACP,WAAW,EAAE,WAAW;gBACxB,eAAe,EAAE,IAAI;gBACrB,gBAAgB,EAAE,KAAK;aACxB,GACD,GACE,CACP,CAAC;AACJ,CAAC,CAAC;AAEF,kBAAe,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 useReactTable,\n} from '@tanstack/react-table';\n\nimport { type DataGridStyleRule } from '../style-rules/types';\n\ntype EventRow = {\n event: string;\n /**\n * JS Date coerced from the event's local ISO string. Natively converted to\n * Unix ms by the engine and compared against { datetime: \"...\" } literals.\n */\n scheduledDate: Date;\n /**\n * UTC milliseconds since midnight. Compared against { time: \"...\" } literals\n * that are defined in Stockholm / CEST (+02:00) time — the engine normalises\n * both sides to UTC before comparing.\n */\n scheduledTimeMs: number;\n /** Human-readable local time shown in the cell, e.g. \"09:00 CEST (+02:00)\". */\n localTimeDisplay: string;\n status: 'confirmed' | 'delayed' | 'cancelled';\n};\n\nconst data: EventRow[] = [\n // ── Past events (before start of 2026-06-25 in Stockholm / CEST) ──────────\n {\n event: 'Quarterly review',\n // 09:00 Stockholm CEST = 07:00 UTC\n scheduledDate: new Date('2026-06-10T09:00:00+02:00'),\n scheduledTimeMs: 7 * 3_600_000,\n localTimeDisplay: '09:00 CEST (+02:00)',\n status: 'confirmed',\n },\n {\n event: 'Security audit',\n // 07:30 London BST (+01:00) = 06:30 UTC — before Stockholm opens\n scheduledDate: new Date('2026-06-18T07:30:00+01:00'),\n scheduledTimeMs: 6 * 3_600_000 + 30 * 60_000,\n localTimeDisplay: '07:30 BST (+01:00)',\n status: 'delayed',\n },\n // ── Today (2026-06-25 in Stockholm / CEST) ─────────────────────────────────\n {\n event: 'Customer demo',\n // 09:00 New York EDT (-04:00) = 13:00 UTC\n scheduledDate: new Date('2026-06-25T09:00:00-04:00'),\n scheduledTimeMs: 13 * 3_600_000,\n localTimeDisplay: '09:00 EDT (-04:00)',\n status: 'confirmed',\n },\n {\n event: 'Platform migration',\n // 22:00 Stockholm CEST (+02:00) = 20:00 UTC — after Stockholm closes\n scheduledDate: new Date('2026-06-25T22:00:00+02:00'),\n scheduledTimeMs: 20 * 3_600_000,\n localTimeDisplay: '22:00 CEST (+02:00)',\n status: 'confirmed',\n },\n // ── Near future (up to and including 2026-07-14 in Stockholm) ─────────────\n {\n event: 'Board presentation',\n // 10:00 Singapore SGT (+08:00) = 02:00 UTC — before Stockholm opens\n scheduledDate: new Date('2026-07-02T10:00:00+08:00'),\n scheduledTimeMs: 2 * 3_600_000,\n localTimeDisplay: '10:00 SGT (+08:00)',\n status: 'confirmed',\n },\n {\n event: 'Partner onboarding',\n // 13:15 Paris CEST (+02:00) = 11:15 UTC\n scheduledDate: new Date('2026-07-08T13:15:00+02:00'),\n scheduledTimeMs: 11 * 3_600_000 + 15 * 60_000,\n localTimeDisplay: '13:15 CEST (+02:00)',\n status: 'cancelled',\n },\n // ── Far future (after 2026-07-15T00:00 Stockholm / CEST = 2026-07-14T22:00Z)\n {\n event: 'Architecture summit',\n // 08:00 Amsterdam CEST (+02:00) = 06:00 UTC.\n // Although the calendar date is \"July 15\", 08:00 CEST is still within the\n // same UTC day as July 14 22:00Z, so it crosses the far-future boundary.\n scheduledDate: new Date('2026-07-15T08:00:00+02:00'),\n scheduledTimeMs: 6 * 3_600_000,\n localTimeDisplay: '08:00 CEST (+02:00)',\n status: 'confirmed',\n },\n {\n event: 'Annual conference',\n // 09:00 San Francisco PDT (-07:00) = 16:00 UTC — after Stockholm closes\n scheduledDate: new Date('2026-08-03T09:00:00-07:00'),\n scheduledTimeMs: 16 * 3_600_000,\n localTimeDisplay: '09:00 PDT (-07:00)',\n status: 'confirmed',\n },\n {\n event: 'Year-end planning',\n // 09:00 Tokyo JST (+09:00) = 00:00 UTC — midnight, well before Stockholm opens\n scheduledDate: new Date('2026-11-20T09:00:00+09:00'),\n scheduledTimeMs: 0,\n localTimeDisplay: '09:00 JST (+09:00)',\n status: 'confirmed',\n },\n];\n\n/**\n * All date and time boundaries are anchored to Stockholm in June–July 2026.\n * Date literals use RFC 9557 IANA bracket notation — the UTC offset is inferred\n * from the named zone (CEST = +02:00 in this period); writing `+02:00` explicitly\n * is optional. Time literals use UTC-offset notation.\n *\n * \"Today\" from a Stockholm perspective:\n * 2026-06-25T00:00:00[Europe/Stockholm] = 2026-06-24T22:00:00Z\n * 2026-06-26T00:00:00[Europe/Stockholm] = 2026-06-25T22:00:00Z\n *\n * \"Far future\" threshold:\n * 2026-07-15T00:00:00[Europe/Stockholm] = 2026-07-14T22:00:00Z\n *\n * Business hours (Stockholm):\n * { time: '09:00:00+02:00' } resolves to 07:00 UTC (25 200 000 ms)\n * { time: '17:00:00+02:00' } resolves to 15:00 UTC (54 000 000 ms)\n */\nconst styleRules: DataGridStyleRule[] = [\n // Past events — entire row in muted red\n {\n apply: {\n color: { value: '#fee2e2' },\n textColor: { value: '#7f1d1d' },\n },\n column: null,\n priority: 1,\n where: {\n lessThan: [\n { column: 'scheduledDate' },\n { datetime: '2026-06-25T00:00:00[Europe/Stockholm]' },\n ],\n },\n },\n // Today (in Stockholm timezone) — entire row in amber\n {\n apply: {\n color: { value: '#fef9c3' },\n textColor: { value: '#713f12' },\n },\n column: null,\n priority: 1,\n where: {\n and: [\n {\n greaterThanOrEqual: [\n { column: 'scheduledDate' },\n { datetime: '2026-06-25T00:00:00[Europe/Stockholm]' },\n ],\n },\n {\n lessThan: [\n { column: 'scheduledDate' },\n { datetime: '2026-06-26T00:00:00[Europe/Stockholm]' },\n ],\n },\n ],\n },\n },\n // Far future (after 2026-07-15 midnight Stockholm time) — entire row in green\n {\n apply: {\n color: { value: '#dcfce7' },\n textColor: { value: '#14532d' },\n },\n column: null,\n priority: 1,\n where: {\n greaterThanOrEqual: [\n { column: 'scheduledDate' },\n { datetime: '2026-07-15T00:00:00[Europe/Stockholm]' },\n ],\n },\n },\n // Outside Stockholm business hours (before 09:00 CEST or from 17:00 CEST) —\n // time cell in orange. The { time: \"...\" } literals carry an offset so the\n // engine normalises them to UTC before comparing against scheduledTimeMs.\n {\n apply: {\n color: { value: '#ffedd5' },\n textColor: { value: '#7c2d12' },\n },\n column: 'scheduledTimeMs',\n priority: 2,\n where: {\n or: [\n {\n lessThan: [{ column: 'scheduledTimeMs' }, { time: '09:00:00+02:00' }],\n },\n {\n greaterThanOrEqual: [\n { column: 'scheduledTimeMs' },\n { time: '17:00:00+02:00' },\n ],\n },\n ],\n },\n },\n // Cancelled events — all cells grayed out at highest priority\n {\n apply: {\n color: { value: '#f3f4f6' },\n textColor: { value: '#9ca3af' },\n },\n column: null,\n priority: 5,\n where: { equal: [{ column: 'status' }, 'cancelled'] },\n },\n];\n\nconst Component = () => {\n const columnHelper = createColumnHelper<EventRow>();\n\n const columns = [\n columnHelper.accessor('event', {\n cell: (info) => info.getValue(),\n header: () => 'Event',\n minSize: 180,\n size: 220,\n }),\n columnHelper.accessor('scheduledDate', {\n cell: (info) =>\n info.getValue().toLocaleDateString('en-GB', {\n day: 'numeric',\n month: 'short',\n timeZone: 'Europe/Stockholm',\n year: 'numeric',\n }),\n header: () => 'Date (Stockholm)',\n minSize: 150,\n size: 170,\n }),\n columnHelper.accessor('localTimeDisplay', {\n cell: (info) => info.getValue(),\n header: () => 'Local time',\n minSize: 160,\n size: 180,\n }),\n columnHelper.accessor('scheduledTimeMs', {\n cell: (info) => {\n const ms = info.getValue();\n const h = Math.floor(ms / 3_600_000)\n .toString()\n .padStart(2, '0');\n const m = Math.floor((ms % 3_600_000) / 60_000)\n .toString()\n .padStart(2, '0');\n return `${h}:${m} UTC`;\n },\n header: () => 'Time (UTC)',\n minSize: 110,\n size: 130,\n }),\n columnHelper.accessor('status', {\n cell: (info) => info.getValue(),\n header: () => 'Status',\n minSize: 100,\n size: 120,\n }),\n ];\n\n const table = useReactTable({\n columnResizeMode: 'onChange',\n columns,\n data,\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: { pageSize: 10 },\n },\n });\n\n return (\n <div className=\"n-w-full n-bg-light-neutral-text-weakest\">\n <DataGrid\n isResizable={false}\n isKeyboardNavigable={false}\n tableInstance={table}\n styleRules={styleRules}\n styling={{\n borderStyle: 'all-sides',\n hasHoverEffects: true,\n hasZebraStriping: false,\n }}\n />\n </div>\n );\n};\n\nexport default Component;\n"]}
@@ -23,7 +23,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
23
23
  return (mod && mod.__esModule) ? mod : { "default": mod };
24
24
  };
25
25
  Object.defineProperty(exports, "__esModule", { value: true });
26
- exports.DataGridUsingEditableCellsSource = exports.DataGridSingleSelectableSource = exports.DataGridNoPaginationTableSource = exports.DataGridPinnedColumnsSource = exports.DataGridPercentageWidthColumnsSource = exports.DataGridKeyboardNavigationSource = exports.DataGridComponentOverridingSource = exports.DataGridColumnFilteringSource = exports.DataGridResizableColumnSource = exports.DataGridPlaceholderStatesSource = exports.DataGridSkeletonLoadingSource = exports.DataGridVirtualizationSource = exports.DataGridKitchenSinkSource = exports.DataGridInDialogSource = exports.DataGridSearchableSource = exports.DataGridSelectableSource = exports.DataGridSortableSource = exports.DataGridCompactModeSource = exports.DataGridSimpleSource = exports.DataGridRuleBasedStylingSource = exports.DataGridCustomCellWithStyleRulesSource = exports.DataGridCustomCellWithStyleRules = exports.DataGridRuleBasedStyling = exports.DataGridUsingEditableCells = exports.DataGridSingleSelectable = exports.DataGridNoPaginationTable = exports.DataGridPinnedRightSide = exports.DataGridPinnedLeftSide = exports.DataGridPinnedBothSides = exports.DataGridPercentageWidthColumns = exports.DataGridKeyboardNavigation = exports.DataGridComponentOverriding = exports.DataGridResizableColumn = exports.DataGridPlaceholderStates = exports.DataGridSkeletonLoading = exports.DataGridVirtualization = exports.DataGridKitchenSink = exports.DataGridInDialog = exports.DataGridColumnFiltering = exports.DataGridSearchable = exports.DataGridSelectable = exports.DataGridSortable = exports.DataGridSimple = exports.DataGridCompactMode = void 0;
26
+ exports.DataGridRuleBasedStylingDateTimeSource = exports.DataGridUsingEditableCellsSource = exports.DataGridSingleSelectableSource = exports.DataGridNoPaginationTableSource = exports.DataGridPinnedColumnsSource = exports.DataGridPercentageWidthColumnsSource = exports.DataGridKeyboardNavigationSource = exports.DataGridComponentOverridingSource = exports.DataGridColumnFilteringSource = exports.DataGridResizableColumnSource = exports.DataGridPlaceholderStatesSource = exports.DataGridSkeletonLoadingSource = exports.DataGridVirtualizationSource = exports.DataGridKitchenSinkSource = exports.DataGridInDialogSource = exports.DataGridSearchableSource = exports.DataGridSelectableSource = exports.DataGridSortableSource = exports.DataGridCompactModeSource = exports.DataGridSimpleSource = exports.DataGridRuleBasedStylingSource = exports.DataGridCustomCellWithStyleRulesSource = exports.DataGridRuleBasedStylingDateTime = exports.DataGridCustomCellWithStyleRules = exports.DataGridRuleBasedStyling = exports.DataGridUsingEditableCells = exports.DataGridSingleSelectable = exports.DataGridNoPaginationTable = exports.DataGridPinnedRightSide = exports.DataGridPinnedLeftSide = exports.DataGridPinnedBothSides = exports.DataGridPercentageWidthColumns = exports.DataGridKeyboardNavigation = exports.DataGridComponentOverriding = exports.DataGridResizableColumn = exports.DataGridPlaceholderStates = exports.DataGridSkeletonLoading = exports.DataGridVirtualization = exports.DataGridKitchenSink = exports.DataGridInDialog = exports.DataGridColumnFiltering = exports.DataGridSearchable = exports.DataGridSelectable = exports.DataGridSortable = exports.DataGridSimple = exports.DataGridCompactMode = void 0;
27
27
  var datagrid_compact_mode_story_1 = require("./datagrid-compact-mode.story");
28
28
  Object.defineProperty(exports, "DataGridCompactMode", { enumerable: true, get: function () { return __importDefault(datagrid_compact_mode_story_1).default; } });
29
29
  var datagrid_simple_story_1 = require("./datagrid-simple.story");
@@ -67,6 +67,8 @@ var datagrid_rule_based_styling_story_1 = require("./datagrid-rule-based-styling
67
67
  Object.defineProperty(exports, "DataGridRuleBasedStyling", { enumerable: true, get: function () { return __importDefault(datagrid_rule_based_styling_story_1).default; } });
68
68
  var datagrid_custom_cell_with_style_rules_story_1 = require("./datagrid-custom-cell-with-style-rules.story");
69
69
  Object.defineProperty(exports, "DataGridCustomCellWithStyleRules", { enumerable: true, get: function () { return __importDefault(datagrid_custom_cell_with_style_rules_story_1).default; } });
70
+ var datagrid_rule_based_styling_datetime_story_1 = require("./datagrid-rule-based-styling-datetime.story");
71
+ Object.defineProperty(exports, "DataGridRuleBasedStylingDateTime", { enumerable: true, get: function () { return __importDefault(datagrid_rule_based_styling_datetime_story_1).default; } });
70
72
  const export_stories_utils_1 = require("../../_common/export-stories-utils");
71
73
  const datagrid_column_filtering_story_raw_1 = __importDefault(require("./datagrid-column-filtering.story?raw"));
72
74
  const datagrid_compact_mode_story_raw_1 = __importDefault(require("./datagrid-compact-mode.story?raw"));
@@ -81,6 +83,7 @@ const datagrid_pinned_columns_stories_raw_1 = __importDefault(require("./datagri
81
83
  const datagrid_placeholder_states_story_raw_1 = __importDefault(require("./datagrid-placeholder-states.story?raw"));
82
84
  const datagrid_resizable_column_story_raw_1 = __importDefault(require("./datagrid-resizable-column.story?raw"));
83
85
  const datagrid_rule_based_styling_story_raw_1 = __importDefault(require("./datagrid-rule-based-styling.story?raw"));
86
+ const datagrid_rule_based_styling_datetime_story_raw_1 = __importDefault(require("./datagrid-rule-based-styling-datetime.story?raw"));
84
87
  const datagrid_search_and_filters_stories_raw_1 = __importDefault(require("./datagrid-search-and-filters.stories?raw"));
85
88
  const datagrid_selectable_story_raw_1 = __importDefault(require("./datagrid-selectable.story?raw"));
86
89
  const datagrid_simple_story_raw_1 = __importDefault(require("./datagrid-simple.story?raw"));
@@ -110,4 +113,5 @@ exports.DataGridPinnedColumnsSource = (0, export_stories_utils_1.removeLicenseHe
110
113
  exports.DataGridNoPaginationTableSource = (0, export_stories_utils_1.removeLicenseHeader)(datagrid_no_pagination_table_story_raw_1.default);
111
114
  exports.DataGridSingleSelectableSource = (0, export_stories_utils_1.removeLicenseHeader)(datagrid_single_selectable_story_raw_1.default);
112
115
  exports.DataGridUsingEditableCellsSource = (0, export_stories_utils_1.removeLicenseHeader)(datagrid_using_editable_cells_story_raw_1.default);
116
+ exports.DataGridRuleBasedStylingDateTimeSource = (0, export_stories_utils_1.removeLicenseHeader)(datagrid_rule_based_styling_datetime_story_raw_1.default);
113
117
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/data-grid/stories/index.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;GAmBG;;;;;;AAEH,6EAA+E;AAAtE,mJAAA,OAAO,OAAuB;AACvC,iEAAoE;AAA3D,wIAAA,OAAO,OAAkB;AAClC,qEAAwE;AAA/D,4IAAA,OAAO,OAAoB;AACpC,yEAA4E;AAAnE,gJAAA,OAAO,OAAsB;AACtC,6FAG+C;AAF7C,yIAAA,UAAU,OAAsB;AAChC,8IAAA,eAAe,OAA2B;AAE5C,uEAAyE;AAAhE,6IAAA,OAAO,OAAoB;AACpC,6EAA+E;AAAtE,mJAAA,OAAO,OAAu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GAAG,IAAA,0CAAmB,EACvD,qCAAyB,CAC1B,CAAC;AACW,QAAA,wBAAwB,GAAG,IAAA,0CAAmB,EACzD,uCAA2B,CAC5B,CAAC;AACW,QAAA,wBAAwB,GAAG,IAAA,0CAAmB,EACzD,iDAA2B,CAC5B,CAAC;AACW,QAAA,sBAAsB,GAAG,IAAA,0CAAmB,EACvD,sCAAyB,CAC1B,CAAC;AACW,QAAA,yBAAyB,GAAG,IAAA,0CAAmB,EAC1D,yCAA4B,CAC7B,CAAC;AACW,QAAA,4BAA4B,GAAG,IAAA,0CAAmB,EAC7D,2CAA+B,CAChC,CAAC;AACW,QAAA,6BAA6B,GAAG,IAAA,0CAAmB,EAC9D,6CAAgC,CACjC,CAAC;AACW,QAAA,+BAA+B,GAAG,IAAA,0CAAmB,EAChE,+CAAkC,CACnC,CAAC;AACW,QAAA,6BAA6B,GAAG,IAAA,0CAAmB,EAC9D,6CAAgC,CACjC,CAAC;AACW,QAAA,6BAA6B,GAAG,IAAA,0CAAmB,EAC9D,6CAAgC,CACjC,CAAC;AACW,QAAA,iCAAiC,GAAG,IAAA,0CAAmB,EAClE,iDAAoC,CACrC,CAAC;AACW,QAAA,gCAAgC,GAAG,IAAA,0CAAmB,EACjE,gDAAmC,CACpC,CAAC;AACW,QAAA,oCAAoC,GAAG,IAAA,0CAAmB,EACrE,qDAAuC,CACxC,CAAC;AACW,QAAA,2BAA2B,GAAG,IAAA,0CAAmB,EAC5D,6CAA8B,CAC/B,CAAC;AACW,QAAA,+BAA+B,GAAG,IAAA,0CAAmB,EAChE,gDAA4B,CAC7B,CAAC;AACW,QAAA,8BAA8B,GAAG,IAAA,0CAAmB,EAC/D,8CAAiC,CAClC,CAAC;AACW,QAAA,gCAAgC,GAAG,IAAA,0CAAmB,EACjE,iDAAmC,CACpC,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\nexport { default as DataGridCompactMode } from './datagrid-compact-mode.story';\nexport { default as DataGridSimple } from './datagrid-simple.story';\nexport { default as DataGridSortable } from './datagrid-sortable.story';\nexport { default as DataGridSelectable } from './datagrid-selectable.story';\nexport {\n Searchable as DataGridSearchable,\n ColumnFiltering as DataGridColumnFiltering,\n} from './datagrid-search-and-filters.stories';\nexport { default as DataGridInDialog } from './datagrid-in-dialog.story';\nexport { default as DataGridKitchenSink } from './datagrid-kitchen-sink.story';\nexport { default as DataGridVirtualization } from './datagrid-virtualization.story';\nexport { default as DataGridSkeletonLoading } from './datagrid-skeleton-loading.story';\nexport { default as DataGridPlaceholderStates } from './datagrid-placeholder-states.story';\nexport { default as DataGridResizableColumn } from './datagrid-resizable-column.story';\nexport { default as DataGridComponentOverriding } from './datagrid-component-overriding.story';\nexport { default as DataGridKeyboardNavigation } from './datagrid-keyboard-navigation.story';\nexport { default as DataGridPercentageWidthColumns } from './datagrid-percentage-width-columns.story';\nexport {\n PinnedBothSides as DataGridPinnedBothSides,\n PinnedLeftSide as DataGridPinnedLeftSide,\n PinnedRightSide as DataGridPinnedRightSide,\n} from './datagrid-pinned-columns.stories';\nexport { default as DataGridNoPaginationTable } from './datagrid-no-pagination-table.story';\nexport { default as DataGridSingleSelectable } from './datagrid-single-selectable.story';\nexport { default as DataGridUsingEditableCells } from './datagrid-using-editable-cells.story';\nexport { default as DataGridRuleBasedStyling } from './datagrid-rule-based-styling.story';\nexport { default as DataGridCustomCellWithStyleRules } from './datagrid-custom-cell-with-style-rules.story';\n\nimport { removeLicenseHeader } from '../../_common/export-stories-utils';\nimport DataGridColumnFilteringSourceRaw from './datagrid-column-filtering.story?raw';\nimport DataGridCompactModeSourceRaw from './datagrid-compact-mode.story?raw';\nimport DataGridComponentOverridingSourceRaw from './datagrid-component-overriding.story?raw';\nimport DataGridCustomCellWithStyleRulesSourceRaw from './datagrid-custom-cell-with-style-rules.story?raw';\nimport DataGridInDialogSourceRaw from './datagrid-in-dialog.story?raw';\nimport DataGridKeyboardNavigationSourceRaw from './datagrid-keyboard-navigation.story?raw';\nimport DataGridKitchenSinkSourceRaw from './datagrid-kitchen-sink.story?raw';\nimport DataGridNoPaginationTableRaw from './datagrid-no-pagination-table.story?raw';\nimport DataGridPercentageWidthColumnsSourceRaw from './datagrid-percentage-width-columns.story?raw';\nimport DataGridPinnedColumnsSourceRaw from './datagrid-pinned-columns.stories?raw';\nimport DataGridPlaceholderStatesSourceRaw from './datagrid-placeholder-states.story?raw';\nimport DataGridResizableColumnSourceRaw from './datagrid-resizable-column.story?raw';\nimport DataGridRuleBasedStylingSourceRaw from './datagrid-rule-based-styling.story?raw';\nimport DataGridSearchableSourceRaw from './datagrid-search-and-filters.stories?raw';\nimport DataGridSelectableSourceRaw from './datagrid-selectable.story?raw';\nimport DataGridSimpleSourceRaw from './datagrid-simple.story?raw';\nimport DataGridSingleSelectableSourceRaw from './datagrid-single-selectable.story?raw';\nimport DataGridSkeletonLoadingSourceRaw from './datagrid-skeleton-loading.story?raw';\nimport DataGridSortableSourceRaw from './datagrid-sortable.story?raw';\nimport DataGridUsingEditableCellsSourceRaw from './datagrid-using-editable-cells.story?raw';\nimport DataGridVirtualizationSourceRaw from './datagrid-virtualization.story?raw';\n\nexport const DataGridCustomCellWithStyleRulesSource = removeLicenseHeader(\n DataGridCustomCellWithStyleRulesSourceRaw,\n);\nexport const DataGridRuleBasedStylingSource = removeLicenseHeader(\n DataGridRuleBasedStylingSourceRaw,\n);\nexport const DataGridSimpleSource = removeLicenseHeader(\n DataGridSimpleSourceRaw,\n);\nexport const DataGridCompactModeSource = removeLicenseHeader(\n DataGridCompactModeSourceRaw,\n);\nexport const DataGridSortableSource = removeLicenseHeader(\n DataGridSortableSourceRaw,\n);\nexport const DataGridSelectableSource = removeLicenseHeader(\n DataGridSelectableSourceRaw,\n);\nexport const DataGridSearchableSource = removeLicenseHeader(\n DataGridSearchableSourceRaw,\n);\nexport const DataGridInDialogSource = removeLicenseHeader(\n DataGridInDialogSourceRaw,\n);\nexport const DataGridKitchenSinkSource = removeLicenseHeader(\n DataGridKitchenSinkSourceRaw,\n);\nexport const DataGridVirtualizationSource = removeLicenseHeader(\n DataGridVirtualizationSourceRaw,\n);\nexport const DataGridSkeletonLoadingSource = removeLicenseHeader(\n DataGridSkeletonLoadingSourceRaw,\n);\nexport const DataGridPlaceholderStatesSource = removeLicenseHeader(\n DataGridPlaceholderStatesSourceRaw,\n);\nexport const DataGridResizableColumnSource = removeLicenseHeader(\n DataGridResizableColumnSourceRaw,\n);\nexport const DataGridColumnFilteringSource = removeLicenseHeader(\n DataGridColumnFilteringSourceRaw,\n);\nexport const DataGridComponentOverridingSource = removeLicenseHeader(\n DataGridComponentOverridingSourceRaw,\n);\nexport const DataGridKeyboardNavigationSource = removeLicenseHeader(\n DataGridKeyboardNavigationSourceRaw,\n);\nexport const DataGridPercentageWidthColumnsSource = removeLicenseHeader(\n DataGridPercentageWidthColumnsSourceRaw,\n);\nexport const DataGridPinnedColumnsSource = removeLicenseHeader(\n DataGridPinnedColumnsSourceRaw,\n);\nexport const DataGridNoPaginationTableSource = removeLicenseHeader(\n DataGridNoPaginationTableRaw,\n);\nexport const DataGridSingleSelectableSource = removeLicenseHeader(\n DataGridSingleSelectableSourceRaw,\n);\nexport const DataGridUsingEditableCellsSource = removeLicenseHeader(\n DataGridUsingEditableCellsSourceRaw,\n);\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/data-grid/stories/index.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;GAmB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CAAC;AACW,QAAA,2BAA2B,GAAG,IAAA,0CAAmB,EAC5D,6CAA8B,CAC/B,CAAC;AACW,QAAA,+BAA+B,GAAG,IAAA,0CAAmB,EAChE,gDAA4B,CAC7B,CAAC;AACW,QAAA,8BAA8B,GAAG,IAAA,0CAAmB,EAC/D,8CAAiC,CAClC,CAAC;AACW,QAAA,gCAAgC,GAAG,IAAA,0CAAmB,EACjE,iDAAmC,CACpC,CAAC;AACW,QAAA,sCAAsC,GAAG,IAAA,0CAAmB,EACvE,wDAAyC,CAC1C,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\nexport { default as DataGridCompactMode } from './datagrid-compact-mode.story';\nexport { default as DataGridSimple } from './datagrid-simple.story';\nexport { default as DataGridSortable } from './datagrid-sortable.story';\nexport { default as DataGridSelectable } from './datagrid-selectable.story';\nexport {\n Searchable as DataGridSearchable,\n ColumnFiltering as DataGridColumnFiltering,\n} from './datagrid-search-and-filters.stories';\nexport { default as DataGridInDialog } from './datagrid-in-dialog.story';\nexport { default as DataGridKitchenSink } from './datagrid-kitchen-sink.story';\nexport { default as DataGridVirtualization } from './datagrid-virtualization.story';\nexport { default as DataGridSkeletonLoading } from './datagrid-skeleton-loading.story';\nexport { default as DataGridPlaceholderStates } from './datagrid-placeholder-states.story';\nexport { default as DataGridResizableColumn } from './datagrid-resizable-column.story';\nexport { default as DataGridComponentOverriding } from './datagrid-component-overriding.story';\nexport { default as DataGridKeyboardNavigation } from './datagrid-keyboard-navigation.story';\nexport { default as DataGridPercentageWidthColumns } from './datagrid-percentage-width-columns.story';\nexport {\n PinnedBothSides as DataGridPinnedBothSides,\n PinnedLeftSide as DataGridPinnedLeftSide,\n PinnedRightSide as DataGridPinnedRightSide,\n} from './datagrid-pinned-columns.stories';\nexport { default as DataGridNoPaginationTable } from './datagrid-no-pagination-table.story';\nexport { default as DataGridSingleSelectable } from './datagrid-single-selectable.story';\nexport { default as DataGridUsingEditableCells } from './datagrid-using-editable-cells.story';\nexport { default as DataGridRuleBasedStyling } from './datagrid-rule-based-styling.story';\nexport { default as DataGridCustomCellWithStyleRules } from './datagrid-custom-cell-with-style-rules.story';\nexport { default as DataGridRuleBasedStylingDateTime } from './datagrid-rule-based-styling-datetime.story';\n\nimport { removeLicenseHeader } from '../../_common/export-stories-utils';\nimport DataGridColumnFilteringSourceRaw from './datagrid-column-filtering.story?raw';\nimport DataGridCompactModeSourceRaw from './datagrid-compact-mode.story?raw';\nimport DataGridComponentOverridingSourceRaw from './datagrid-component-overriding.story?raw';\nimport DataGridCustomCellWithStyleRulesSourceRaw from './datagrid-custom-cell-with-style-rules.story?raw';\nimport DataGridInDialogSourceRaw from './datagrid-in-dialog.story?raw';\nimport DataGridKeyboardNavigationSourceRaw from './datagrid-keyboard-navigation.story?raw';\nimport DataGridKitchenSinkSourceRaw from './datagrid-kitchen-sink.story?raw';\nimport DataGridNoPaginationTableRaw from './datagrid-no-pagination-table.story?raw';\nimport DataGridPercentageWidthColumnsSourceRaw from './datagrid-percentage-width-columns.story?raw';\nimport DataGridPinnedColumnsSourceRaw from './datagrid-pinned-columns.stories?raw';\nimport DataGridPlaceholderStatesSourceRaw from './datagrid-placeholder-states.story?raw';\nimport DataGridResizableColumnSourceRaw from './datagrid-resizable-column.story?raw';\nimport DataGridRuleBasedStylingSourceRaw from './datagrid-rule-based-styling.story?raw';\nimport DataGridRuleBasedStylingDateTimeSourceRaw from './datagrid-rule-based-styling-datetime.story?raw';\nimport DataGridSearchableSourceRaw from './datagrid-search-and-filters.stories?raw';\nimport DataGridSelectableSourceRaw from './datagrid-selectable.story?raw';\nimport DataGridSimpleSourceRaw from './datagrid-simple.story?raw';\nimport DataGridSingleSelectableSourceRaw from './datagrid-single-selectable.story?raw';\nimport DataGridSkeletonLoadingSourceRaw from './datagrid-skeleton-loading.story?raw';\nimport DataGridSortableSourceRaw from './datagrid-sortable.story?raw';\nimport DataGridUsingEditableCellsSourceRaw from './datagrid-using-editable-cells.story?raw';\nimport DataGridVirtualizationSourceRaw from './datagrid-virtualization.story?raw';\n\nexport const DataGridCustomCellWithStyleRulesSource = removeLicenseHeader(\n DataGridCustomCellWithStyleRulesSourceRaw,\n);\nexport const DataGridRuleBasedStylingSource = removeLicenseHeader(\n DataGridRuleBasedStylingSourceRaw,\n);\nexport const DataGridSimpleSource = removeLicenseHeader(\n DataGridSimpleSourceRaw,\n);\nexport const DataGridCompactModeSource = removeLicenseHeader(\n DataGridCompactModeSourceRaw,\n);\nexport const DataGridSortableSource = removeLicenseHeader(\n DataGridSortableSourceRaw,\n);\nexport const DataGridSelectableSource = removeLicenseHeader(\n DataGridSelectableSourceRaw,\n);\nexport const DataGridSearchableSource = removeLicenseHeader(\n DataGridSearchableSourceRaw,\n);\nexport const DataGridInDialogSource = removeLicenseHeader(\n DataGridInDialogSourceRaw,\n);\nexport const DataGridKitchenSinkSource = removeLicenseHeader(\n DataGridKitchenSinkSourceRaw,\n);\nexport const DataGridVirtualizationSource = removeLicenseHeader(\n DataGridVirtualizationSourceRaw,\n);\nexport const DataGridSkeletonLoadingSource = removeLicenseHeader(\n DataGridSkeletonLoadingSourceRaw,\n);\nexport const DataGridPlaceholderStatesSource = removeLicenseHeader(\n DataGridPlaceholderStatesSourceRaw,\n);\nexport const DataGridResizableColumnSource = removeLicenseHeader(\n DataGridResizableColumnSourceRaw,\n);\nexport const DataGridColumnFilteringSource = removeLicenseHeader(\n DataGridColumnFilteringSourceRaw,\n);\nexport const DataGridComponentOverridingSource = removeLicenseHeader(\n DataGridComponentOverridingSourceRaw,\n);\nexport const DataGridKeyboardNavigationSource = removeLicenseHeader(\n DataGridKeyboardNavigationSourceRaw,\n);\nexport const DataGridPercentageWidthColumnsSource = removeLicenseHeader(\n DataGridPercentageWidthColumnsSourceRaw,\n);\nexport const DataGridPinnedColumnsSource = removeLicenseHeader(\n DataGridPinnedColumnsSourceRaw,\n);\nexport const DataGridNoPaginationTableSource = removeLicenseHeader(\n DataGridNoPaginationTableRaw,\n);\nexport const DataGridSingleSelectableSource = removeLicenseHeader(\n DataGridSingleSelectableSourceRaw,\n);\nexport const DataGridUsingEditableCellsSource = removeLicenseHeader(\n DataGridUsingEditableCellsSourceRaw,\n);\nexport const DataGridRuleBasedStylingDateTimeSource = removeLicenseHeader(\n DataGridRuleBasedStylingDateTimeSourceRaw,\n);\n"]}
@@ -23,17 +23,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
23
23
  exports.computeDataGridRowStyles = computeDataGridRowStyles;
24
24
  exports.evaluateDataGridStyleRules = evaluateDataGridStyleRules;
25
25
  const react_color_1 = require("@uiw/react-color");
26
- // --- Color interpolation (duplicated from react-graph to avoid cross-package coupling) ---
27
- function getWeight(startValue, endValue, value) {
28
- return (value - startValue) / (endValue - startValue);
29
- }
30
- function lerpColor(startColor, endColor, weight) {
31
- return {
32
- b: Math.round(startColor.b * (1 - weight) + endColor.b * weight),
33
- g: Math.round(startColor.g * (1 - weight) + endColor.g * weight),
34
- r: Math.round(startColor.r * (1 - weight) + endColor.r * weight),
35
- };
36
- }
26
+ const style_rules_1 = require("../../_generated/style-rules");
37
27
  function getInterpolatedColor(colorRange, rowData, converters) {
38
28
  const { onColumn, minValue, minColor, maxValue, maxColor, midValue, midColor, } = colorRange;
39
29
  if (!(0, react_color_1.validHex)(minColor) || !(0, react_color_1.validHex)(maxColor)) {
@@ -79,19 +69,19 @@ function getInterpolatedColor(colorRange, rowData, converters) {
79
69
  const clampedValue = Math.max(actualMinValue, Math.min(actualMaxValue, numericValue));
80
70
  let rgb;
81
71
  if (midRgb !== undefined && midValue !== undefined) {
82
- const t = getWeight(minValue, midValue, clampedValue);
72
+ const t = (0, style_rules_1.getWeight)(minValue, midValue, clampedValue);
83
73
  const isBetweenMinAndMid = t <= 1;
84
74
  if (isBetweenMinAndMid) {
85
- rgb = lerpColor(minRgb, midRgb, t);
75
+ rgb = (0, style_rules_1.lerpColor)(minRgb, midRgb, t);
86
76
  }
87
77
  else {
88
- const t2 = getWeight(midValue, maxValue, clampedValue);
89
- rgb = lerpColor(midRgb, maxRgb, t2);
78
+ const t2 = (0, style_rules_1.getWeight)(midValue, maxValue, clampedValue);
79
+ rgb = (0, style_rules_1.lerpColor)(midRgb, maxRgb, t2);
90
80
  }
91
81
  }
92
82
  else {
93
- const t = getWeight(minValue, maxValue, clampedValue);
94
- rgb = lerpColor(minRgb, maxRgb, t);
83
+ const t = (0, style_rules_1.getWeight)(minValue, maxValue, clampedValue);
84
+ rgb = (0, style_rules_1.lerpColor)(minRgb, maxRgb, t);
95
85
  }
96
86
  return (0, react_color_1.rgbToHex)(rgb);
97
87
  }
@@ -119,6 +109,12 @@ function resolveValue(value, rowData, converters) {
119
109
  }
120
110
  return null;
121
111
  }
112
+ if (typeof value === 'object' && value !== null && 'datetime' in value) {
113
+ return (0, style_rules_1.parseDateString)(value.datetime);
114
+ }
115
+ if (typeof value === 'object' && value !== null && 'time' in value) {
116
+ return (0, style_rules_1.parseTimeString)(value.time);
117
+ }
122
118
  return value;
123
119
  }
124
120
  function safeCompare(left, right, rowData, compareFn, converters) {
@@ -1 +1 @@
1
- {"version":3,"file":"evaluate.js","sourceRoot":"","sources":["../../../../src/data-grid/style-rules/evaluate.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;GAmBG;;AA8XH,4DA0EC;AAWD,gEAQC;AAzdD,kDAA4E;AAY5E,4FAA4F;AAE5F,SAAS,SAAS,CAChB,UAAkB,EAClB,QAAgB,EAChB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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 { color, type RgbColor, rgbToHex, validHex } from '@uiw/react-color';\n\nimport {\n type DataGridCellStyle,\n type DataGridColorRange,\n type DataGridStyleRule,\n type DataGridStyleRuleLiteral,\n type DataGridStyleRuleOperand,\n type DataGridStyleRuleValueConverters,\n type DataGridStyleRuleWhere,\n} from './types';\n\n// --- Color interpolation (duplicated from react-graph to avoid cross-package coupling) ---\n\nfunction getWeight(\n startValue: number,\n endValue: number,\n value: number,\n): number {\n return (value - startValue) / (endValue - startValue);\n}\n\nfunction lerpColor(\n startColor: RgbColor,\n endColor: RgbColor,\n weight: number,\n): RgbColor {\n return {\n b: Math.round(startColor.b * (1 - weight) + endColor.b * weight),\n g: Math.round(startColor.g * (1 - weight) + endColor.g * weight),\n r: Math.round(startColor.r * (1 - weight) + endColor.r * weight),\n };\n}\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 actualMinValue = Math.min(minValue, maxValue);\n const actualMaxValue = Math.max(minValue, maxValue);\n\n let midRgb: RgbColor | undefined = undefined;\n if (midValue !== undefined && midColor !== undefined) {\n const isMidInRange =\n actualMinValue <= midValue && midValue <= actualMaxValue;\n if (!isMidInRange || !validHex(midColor)) {\n return null;\n }\n midRgb = color(midColor).rgb;\n }\n\n const rawValue = rowData[onColumn];\n let numericValue: number | null = null;\n if (typeof rawValue === 'number') {\n numericValue = Number.isFinite(rawValue) ? rawValue : null;\n } else if (typeof rawValue === 'bigint') {\n const n = Number(rawValue);\n numericValue = Number.isFinite(n) ? n : null;\n } else if (rawValue instanceof Date) {\n const ts = rawValue.getTime();\n numericValue = Number.isFinite(ts) ? ts : null;\n } else {\n const converter = converters?.[onColumn];\n if (converter !== undefined) {\n const converted = converter(rawValue);\n if (typeof converted === 'number') {\n numericValue = Number.isFinite(converted) ? converted : null;\n }\n }\n }\n if (numericValue === null) {\n return null;\n }\n\n const clampedValue = Math.max(\n actualMinValue,\n Math.min(actualMaxValue, numericValue),\n );\n\n let rgb: RgbColor;\n\n if (midRgb !== undefined && midValue !== undefined) {\n const t = getWeight(minValue, midValue, clampedValue);\n const isBetweenMinAndMid = t <= 1;\n if (isBetweenMinAndMid) {\n rgb = lerpColor(minRgb, midRgb, t);\n } else {\n const t2 = getWeight(midValue, maxValue, clampedValue);\n rgb = lerpColor(midRgb, maxRgb, t2);\n }\n } else {\n const t = getWeight(minValue, maxValue, clampedValue);\n rgb = lerpColor(minRgb, maxRgb, t);\n }\n\n return rgbToHex(rgb);\n}\n\n// --- Where clause evaluation ---\n\ntype Ternary = boolean | null;\n\nfunction resolveValue(\n value: DataGridStyleRuleOperand,\n rowData: Record<string, unknown>,\n converters?: DataGridStyleRuleValueConverters,\n): DataGridStyleRuleLiteral {\n if (typeof value === 'object' && value !== null && 'column' in value) {\n const cellVal = rowData[value.column];\n if (cellVal === undefined) {\n return null;\n }\n if (\n typeof cellVal === 'string' ||\n typeof cellVal === 'number' ||\n typeof cellVal === 'boolean'\n ) {\n return cellVal;\n }\n if (typeof cellVal === 'bigint') {\n return Number(cellVal);\n }\n if (cellVal instanceof Date) {\n const ts = cellVal.getTime();\n return isNaN(ts) ? null : ts;\n }\n const converter = converters?.[value.column];\n if (converter !== undefined) {\n return converter(cellVal);\n }\n return null;\n }\n return value;\n}\n\nfunction safeCompare(\n left: DataGridStyleRuleOperand,\n right: DataGridStyleRuleOperand,\n rowData: Record<string, unknown>,\n compareFn: (\n a: NonNullable<DataGridStyleRuleLiteral>,\n b: NonNullable<DataGridStyleRuleLiteral>,\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 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 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;;AAsXH,4DA0EC;AAWD,gEAQC;AAjdD,kDAA4E;AAE5E,8DAKsC;AAatC,SAAS,oBAAoB,CAC3B,UAA8B,EAC9B,OAAgC,EAChC,UAA6C;IAE7C,MAAM,EACJ,QAAQ,EACR,QAAQ,EACR,QAAQ,EACR,QAAQ,EACR,QAAQ,EACR,QAAQ,EACR,QAAQ,GACT,GAAG,UAAU,CAAC;IAEf,IAAI,CAAC,IAAA,sBAAQ,EAAC,QAAQ,CAAC,IAAI,CAAC,IAAA,sBAAQ,EAAC,QAAQ,CAAC,EAAE,CAAC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IACvE,KAAK,MAAM,CAAC,GAAG,EAAE,OAAO,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,eAAe,CAAC,EAAE,CAAC;QAC7D,MAAM,KAAK,GAAwB,EAAE,CAAC;QACtC,IAAI,OAAO,GAAG,KAAK,CAAC;QACpB,KAAK,MAAM,CAAC,IAAI,EAAE,KAAK,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,OAAO,CAAC,EAAE,CAAC;YACnD,KAAgC,CAAC,IAAI,CAAC,GAAG,KAAK,CAAC,KAAK,CAAC;YACtD,OAAO,GAAG,IAAI,CAAC;QACjB,CAAC;QACD,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,SAAgB,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 { color, type RgbColor, rgbToHex, validHex } from '@uiw/react-color';\n\nimport {\n getWeight,\n lerpColor,\n parseDateString,\n parseTimeString,\n} from '../../_generated/style-rules';\nimport {\n type DataGridCellStyle,\n type DataGridColorRange,\n type DataGridDatetimeLiteral,\n type DataGridStyleRule,\n type DataGridStyleRuleLiteral,\n type DataGridStyleRuleOperand,\n type DataGridStyleRuleValueConverters,\n type DataGridStyleRuleWhere,\n type DataGridTimeLiteral,\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 actualMinValue = Math.min(minValue, maxValue);\n const actualMaxValue = Math.max(minValue, maxValue);\n\n let midRgb: RgbColor | undefined = undefined;\n if (midValue !== undefined && midColor !== undefined) {\n const isMidInRange =\n actualMinValue <= midValue && midValue <= actualMaxValue;\n if (!isMidInRange || !validHex(midColor)) {\n return null;\n }\n midRgb = color(midColor).rgb;\n }\n\n const rawValue = rowData[onColumn];\n let numericValue: number | null = null;\n if (typeof rawValue === 'number') {\n numericValue = Number.isFinite(rawValue) ? rawValue : null;\n } else if (typeof rawValue === 'bigint') {\n const n = Number(rawValue);\n numericValue = Number.isFinite(n) ? n : null;\n } else if (rawValue instanceof Date) {\n const ts = rawValue.getTime();\n numericValue = Number.isFinite(ts) ? ts : null;\n } else {\n const converter = converters?.[onColumn];\n if (converter !== undefined) {\n const converted = converter(rawValue);\n if (typeof converted === 'number') {\n numericValue = Number.isFinite(converted) ? converted : null;\n }\n }\n }\n if (numericValue === null) {\n return null;\n }\n\n const clampedValue = Math.max(\n actualMinValue,\n Math.min(actualMaxValue, numericValue),\n );\n\n let rgb: RgbColor;\n\n if (midRgb !== undefined && midValue !== undefined) {\n const t = getWeight(minValue, midValue, clampedValue);\n const isBetweenMinAndMid = t <= 1;\n if (isBetweenMinAndMid) {\n rgb = lerpColor(minRgb, midRgb, t);\n } else {\n const t2 = getWeight(midValue, maxValue, clampedValue);\n rgb = lerpColor(midRgb, maxRgb, t2);\n }\n } else {\n const t = getWeight(minValue, maxValue, clampedValue);\n rgb = lerpColor(minRgb, maxRgb, t);\n }\n\n return rgbToHex(rgb);\n}\n\n// --- Where clause evaluation ---\n\ntype Ternary = boolean | null;\n\nfunction resolveValue(\n value: DataGridStyleRuleOperand,\n rowData: Record<string, unknown>,\n converters?: DataGridStyleRuleValueConverters,\n): DataGridStyleRuleLiteral {\n if (typeof value === 'object' && value !== null && 'column' in value) {\n const cellVal = rowData[value.column];\n if (cellVal === undefined) {\n return null;\n }\n if (\n typeof cellVal === 'string' ||\n typeof cellVal === 'number' ||\n typeof cellVal === 'boolean'\n ) {\n return cellVal;\n }\n if (typeof cellVal === 'bigint') {\n return Number(cellVal);\n }\n if (cellVal instanceof Date) {\n const ts = cellVal.getTime();\n return isNaN(ts) ? null : ts;\n }\n const converter = converters?.[value.column];\n if (converter !== undefined) {\n return converter(cellVal);\n }\n return null;\n }\n if (typeof value === 'object' && value !== null && 'datetime' in value) {\n return parseDateString((value as DataGridDatetimeLiteral).datetime);\n }\n if (typeof value === 'object' && value !== null && 'time' in value) {\n return parseTimeString((value as DataGridTimeLiteral).time);\n }\n return value as DataGridStyleRuleLiteral;\n}\n\nfunction safeCompare(\n left: DataGridStyleRuleOperand,\n right: DataGridStyleRuleOperand,\n rowData: Record<string, unknown>,\n compareFn: (\n a: NonNullable<DataGridStyleRuleLiteral>,\n b: NonNullable<DataGridStyleRuleLiteral>,\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 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 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"]}
@@ -20,7 +20,7 @@
20
20
  * along with this program. If not, see <http://www.gnu.org/licenses/>.
21
21
  */
22
22
  Object.defineProperty(exports, "__esModule", { value: true });
23
- exports.DataGridStyleRuleWhereSchema = exports.DataGridStyleRuleSchema = exports.DataGridStyleRuleOperandSchema = exports.DataGridStyleRuleLiteralSchema = exports.DataGridDisableableColorSchema = exports.DataGridColumnRefSchema = exports.DataGridColorRangeSchema = exports.DataGridCellStyleSchema = exports.useDataGridCellStyle = exports.evaluateDataGridStyleRules = void 0;
23
+ exports.DataGridTimeLiteralSchema = exports.DataGridStyleRuleWhereSchema = exports.DataGridStyleRuleSchema = exports.DataGridStyleRuleOperandSchema = exports.DataGridStyleRuleLiteralSchema = exports.DataGridDisableableColorSchema = exports.DataGridDatetimeLiteralSchema = exports.DataGridColumnRefSchema = exports.DataGridColorRangeSchema = exports.DataGridCellStyleSchema = exports.useDataGridCellStyle = exports.evaluateDataGridStyleRules = void 0;
24
24
  var evaluate_1 = require("./evaluate");
25
25
  Object.defineProperty(exports, "evaluateDataGridStyleRules", { enumerable: true, get: function () { return evaluate_1.evaluateDataGridStyleRules; } });
26
26
  var hooks_1 = require("./hooks");
@@ -30,9 +30,11 @@ var types_1 = require("./types");
30
30
  Object.defineProperty(exports, "DataGridCellStyleSchema", { enumerable: true, get: function () { return types_1.DataGridCellStyleSchema; } });
31
31
  Object.defineProperty(exports, "DataGridColorRangeSchema", { enumerable: true, get: function () { return types_1.DataGridColorRangeSchema; } });
32
32
  Object.defineProperty(exports, "DataGridColumnRefSchema", { enumerable: true, get: function () { return types_1.DataGridColumnRefSchema; } });
33
+ Object.defineProperty(exports, "DataGridDatetimeLiteralSchema", { enumerable: true, get: function () { return types_1.DataGridDatetimeLiteralSchema; } });
33
34
  Object.defineProperty(exports, "DataGridDisableableColorSchema", { enumerable: true, get: function () { return types_1.DataGridDisableableColorSchema; } });
34
35
  Object.defineProperty(exports, "DataGridStyleRuleLiteralSchema", { enumerable: true, get: function () { return types_1.DataGridStyleRuleLiteralSchema; } });
35
36
  Object.defineProperty(exports, "DataGridStyleRuleOperandSchema", { enumerable: true, get: function () { return types_1.DataGridStyleRuleOperandSchema; } });
36
37
  Object.defineProperty(exports, "DataGridStyleRuleSchema", { enumerable: true, get: function () { return types_1.DataGridStyleRuleSchema; } });
37
38
  Object.defineProperty(exports, "DataGridStyleRuleWhereSchema", { enumerable: true, get: function () { return types_1.DataGridStyleRuleWhereSchema; } });
39
+ Object.defineProperty(exports, "DataGridTimeLiteralSchema", { enumerable: true, get: function () { return types_1.DataGridTimeLiteralSchema; } });
38
40
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/data-grid/style-rules/index.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;GAmBG;;;AAEH,uCAAwD;AAA/C,sHAAA,0BAA0B,OAAA;AACnC,iCAA+C;AAAtC,6GAAA,oBAAoB,OAAA;AAC7B,iCAAiC;AACjC,iCASiB;AARf,gHAAA,uBAAuB,OAAA;AACvB,iHAAA,wBAAwB,OAAA;AACxB,gHAAA,uBAAuB,OAAA;AACvB,uHAAA,8BAA8B,OAAA;AAC9B,uHAAA,8BAA8B,OAAA;AAC9B,uHAAA,8BAA8B,OAAA;AAC9B,gHAAA,uBAAuB,OAAA;AACvB,qHAAA,4BAA4B,OAAA","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\nexport { evaluateDataGridStyleRules } from './evaluate';\nexport { useDataGridCellStyle } from './hooks';\n// TODO v5: remove schema exports\nexport {\n DataGridCellStyleSchema,\n DataGridColorRangeSchema,\n DataGridColumnRefSchema,\n DataGridDisableableColorSchema,\n DataGridStyleRuleLiteralSchema,\n DataGridStyleRuleOperandSchema,\n DataGridStyleRuleSchema,\n DataGridStyleRuleWhereSchema,\n} from './types';\nexport type {\n DataGridCellStyle,\n DataGridColorRange,\n DataGridColumnRef,\n DataGridDisableableColor,\n DataGridStyleRuleLiteral,\n DataGridStyleRuleOperand,\n DataGridStyleRule,\n DataGridStyleRuleWhere,\n DataGridStyleRuleValueConverter,\n DataGridStyleRuleValueConverters,\n} from './types';\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/data-grid/style-rules/index.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;GAmBG;;;AAEH,uCAAwD;AAA/C,sHAAA,0BAA0B,OAAA;AACnC,iCAA+C;AAAtC,6GAAA,oBAAoB,OAAA;AAC7B,iCAAiC;AACjC,iCAWiB;AAVf,gHAAA,uBAAuB,OAAA;AACvB,iHAAA,wBAAwB,OAAA;AACxB,gHAAA,uBAAuB,OAAA;AACvB,sHAAA,6BAA6B,OAAA;AAC7B,uHAAA,8BAA8B,OAAA;AAC9B,uHAAA,8BAA8B,OAAA;AAC9B,uHAAA,8BAA8B,OAAA;AAC9B,gHAAA,uBAAuB,OAAA;AACvB,qHAAA,4BAA4B,OAAA;AAC5B,kHAAA,yBAAyB,OAAA","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\nexport { evaluateDataGridStyleRules } from './evaluate';\nexport { useDataGridCellStyle } from './hooks';\n// TODO v5: remove schema exports\nexport {\n DataGridCellStyleSchema,\n DataGridColorRangeSchema,\n DataGridColumnRefSchema,\n DataGridDatetimeLiteralSchema,\n DataGridDisableableColorSchema,\n DataGridStyleRuleLiteralSchema,\n DataGridStyleRuleOperandSchema,\n DataGridStyleRuleSchema,\n DataGridStyleRuleWhereSchema,\n DataGridTimeLiteralSchema,\n} from './types';\nexport type {\n DataGridCellStyle,\n DataGridColorRange,\n DataGridColumnRef,\n DataGridDatetimeLiteral,\n DataGridDisableableColor,\n DataGridStyleRuleLiteral,\n DataGridStyleRuleOperand,\n DataGridStyleRule,\n DataGridStyleRuleWhere,\n DataGridStyleRuleValueConverter,\n DataGridStyleRuleValueConverters,\n DataGridTimeLiteral,\n} from './types';\n"]}
@@ -20,8 +20,9 @@
20
20
  * along with this program. If not, see <http://www.gnu.org/licenses/>.
21
21
  */
22
22
  Object.defineProperty(exports, "__esModule", { value: true });
23
- exports.DataGridStyleRuleSchema = exports.DataGridCellStyleSchema = exports.DataGridDisableableColorSchema = exports.DataGridColorRangeSchema = exports.DataGridStyleRuleWhereSchema = exports.DataGridStyleRuleOperandSchema = exports.DataGridColumnRefSchema = exports.DataGridStyleRuleLiteralSchema = void 0;
23
+ exports.DataGridStyleRuleSchema = exports.DataGridCellStyleSchema = exports.DataGridDisableableColorSchema = exports.DataGridColorRangeSchema = exports.DataGridStyleRuleWhereSchema = exports.DataGridStyleRuleOperandSchema = exports.DataGridTimeLiteralSchema = exports.DataGridDatetimeLiteralSchema = exports.DataGridColumnRefSchema = exports.DataGridStyleRuleLiteralSchema = void 0;
24
24
  const zod_1 = require("zod");
25
+ const style_rules_1 = require("../../_generated/style-rules");
25
26
  /*
26
27
  * Style types defined in Zod, so that we can use the schemas to generate JSON Schema.
27
28
  * This is useful for generating documentation, importing and for future integration into editors.
@@ -35,9 +36,32 @@ exports.DataGridStyleRuleLiteralSchema = zod_1.z.union([
35
36
  ]);
36
37
  /** A reference to a column whose cell value is resolved at evaluation time. */
37
38
  exports.DataGridColumnRefSchema = zod_1.z.object({ column: zod_1.z.string() });
38
- /** An operand in a style-rule where clause -- either a literal value or a column reference. */
39
+ /**
40
+ * An ISO 8601 or RFC 9557 datetime literal that resolves to a Unix millisecond
41
+ * timestamp at evaluation time. Wraps the shared `DatetimeLiteralSchema` with a
42
+ * DataGrid-specific name. Supported formats:
43
+ * - RFC 9557 with IANA timezone: `"2024-06-15T14:00:00[Europe/Stockholm]"` (offset
44
+ * inferred) or `"2024-06-15T14:00:00+02:00[Europe/Stockholm]"` (offset explicit)
45
+ * - UTC or offset datetime: `"2024-01-01T00:00:00Z"`, `"2024-01-01T00:00:00+02:00"`
46
+ * - Plain datetime (treated as UTC): `"2024-01-01T14:30:00"`
47
+ * - Date-only (treated as UTC midnight): `"2024-01-01"`
48
+ *
49
+ * Unzoned datetimes without `Z` or an offset are treated as UTC wall-clock time.
50
+ */
51
+ exports.DataGridDatetimeLiteralSchema = style_rules_1.DatetimeLiteralSchema;
52
+ /**
53
+ * An ISO 8601 time literal that resolves to milliseconds since UTC midnight at
54
+ * evaluation time. Wraps the shared `TimeLiteralSchema` with a DataGrid-specific
55
+ * name. Supported formats:
56
+ * - Local time (treated as UTC): `"14:30:00"`, `"14:30:00.500"`
57
+ * - Offset time (UTC-normalised): `"14:30:00+02:00"`
58
+ */
59
+ exports.DataGridTimeLiteralSchema = style_rules_1.TimeLiteralSchema;
60
+ /** An operand in a style-rule where clause -- either a literal value, a datetime literal, a time literal, or a column reference. */
39
61
  exports.DataGridStyleRuleOperandSchema = zod_1.z.union([
40
62
  exports.DataGridColumnRefSchema,
63
+ exports.DataGridDatetimeLiteralSchema,
64
+ exports.DataGridTimeLiteralSchema,
41
65
  exports.DataGridStyleRuleLiteralSchema,
42
66
  ]);
43
67
  exports.DataGridStyleRuleWhereSchema = zod_1.z.lazy(() => zod_1.z.union([
@@ -1 +1 @@
1
- {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../src/data-grid/style-rules/types.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;GAmBG;;;AAEH,6BAAwB;AAExB;;;GAGG;AAEH,mFAAmF;AACtE,QAAA,8BAA8B,GAAG,OAAC,CAAC,KAAK,CAAC;IACpD,OAAC,CAAC,MAAM,EAAE;IACV,OAAC,CAAC,MAAM,EAAE;IACV,OAAC,CAAC,OAAO,EAAE;IACX,OAAC,CAAC,IAAI,EAAE;CACT,CAAC,CAAC;AAKH,+EAA+E;AAClE,QAAA,uBAAuB,GAAG,OAAC,CAAC,MAAM,CAAC,EAAE,MAAM,EAAE,OAAC,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC;AAGxE,+FAA+F;AAClF,QAAA,8BAA8B,GAAG,OAAC,CAAC,KAAK,CAAC;IACpD,+BAAuB;IACvB,sCAA8B;CAC/B,CAAC,CAAC;AA0BU,QAAA,4BAA4B,GACvC,OAAC,CAAC,IAAI,CAAC,GAAG,EAAE,CACV,OAAC,CAAC,KAAK,CAAC;IACN,OAAC,CAAC,MAAM,CAAC,EAAE,GAAG,EAAE,oCAA4B,EAAE,CAAC;IAC/C,OAAC,CAAC,MAAM,CAAC,EAAE,GAAG,EAAE,OAAC,CAAC,KAAK,CAAC,oCAA4B,CAAC,EAAE,CAAC;IACxD,OAAC,CAAC,MAAM,CAAC,EAAE,EAAE,EAAE,OAAC,CAAC,KAAK,CAAC,oCAA4B,CAAC,EAAE,CAA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D,KAAK,EAAE,+BAAuB;IAC9B,qGAAqG;IACrG,MAAM,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IAC7B,6CAA6C;IAC7C,UAAU,EAAE,OAAC,CAAC,OAAO,EAAE,CAAC,QAAQ,EAAE;IAClC,0CAA0C;IAC1C,QAAQ,EAAE,cAAc,CAAC,QAAQ,EAAE;IACnC,oPAAoP;IACpP,QAAQ,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,WAAW,EAAE,CAAC,QAAQ,EAAE;IAC7C,mFAAmF;IACnF,KAAK,EAAE,oCAA4B,CAAC,QAAQ,EAAE;CAC/C,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 { z } from 'zod';\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/** A scalar literal that can appear as an operand in a style-rule where clause. */\nexport const DataGridStyleRuleLiteralSchema = z.union([\n z.string(),\n z.number(),\n z.boolean(),\n z.null(),\n]);\nexport type DataGridStyleRuleLiteral = z.infer<\n typeof DataGridStyleRuleLiteralSchema\n>;\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/** 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 numeric column value.\n * Colors should be hex strings (#rrggbb).\n * If the column value is missing or non-numeric, 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 numeric range. Values above this clamp to maxColor. */\n maxValue: z.number(),\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: z.number().optional(),\n /** Hex color (#rrggbb) at the minimum value. */\n minColor: z.string(),\n /** The low end of the numeric range. Values below this clamp to minColor. */\n minValue: z.number(),\n /** The column whose numeric 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 | boolean | null`). Return `null` to signal that the value\n * is missing or cannot 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;\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"]}
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../src/data-grid/style-rules/types.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;GAmBG;;;AAEH,6BAAwB;AAExB,8DAGsC;AAEtC;;;GAGG;AAEH,mFAAmF;AACtE,QAAA,8BAA8B,GAAG,OAAC,CAAC,KAAK,CAAC;IACpD,OAAC,CAAC,MAAM,EAAE;IACV,OAAC,CAAC,MAAM,EAAE;IACV,OAAC,CAAC,OAAO,EAAE;IACX,OAAC,CAAC,IAAI,EAAE;CACT,CAAC,CAAC;AAKH,+EAA+E;AAClE,QAAA,uBAAuB,GAAG,OAAC,CAAC,MAAM,CAAC,EAAE,MAAM,EAAE,OAAC,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC;AAGxE;;;;;;;;;;;GAWG;AACU,QAAA,6BAA6B,GAAG,mCAAqB,CAAC;AAKnE;;;;;;GAMG;AACU,QAAA,yBAAyB,GAAG,+BAAiB,CAAC;AAG3D,oIAAoI;AACvH,QAAA,8BAA8B,GAAG,OAAC,CAAC,KAAK,CAAC;IACpD,+BAAuB;IACvB,qCAA6B;IAC7B,iCAAyB;IACzB,sCAA8B;CAC/B,CAAC,CAAC;AA4BU,QAAA,4BAA4B,GACvC,OAAC,CAAC,IAAI,CAAC,GAAG,EAAE,CACV,OAAC,CAAC,KAAK,CAAC;IACN,OAAC,CAAC,MAAM,CAAC,EAAE,GAAG,EAAE,oCAA4B,EAAE,CAAC;IAC/C,OAAC,CAAC,MAAM,CAAC,EAAE,GAAG,EAAE,OAAC,CAAC,KAAK,CAAC,oCAA4B,CAAC,EAAE,CAAC;IACxD,OAAC,CAAC,M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FAAqF;AACxE,QAAA,uBAAuB,GAAG,OAAC,CAAC,MAAM,CAAC;IAC9C,uDAAuD;IACvD,KAAK,EAAE,+BAAuB;IAC9B,qGAAqG;IACrG,MAAM,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IAC7B,6CAA6C;IAC7C,UAAU,EAAE,OAAC,CAAC,OAAO,EAAE,CAAC,QAAQ,EAAE;IAClC,0CAA0C;IAC1C,QAAQ,EAAE,cAAc,CAAC,QAAQ,EAAE;IACnC,oPAAoP;IACpP,QAAQ,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,WAAW,EAAE,CAAC,QAAQ,EAAE;IAC7C,mFAAmF;IACnF,KAAK,EAAE,oCAA4B,CAAC,QAAQ,EAAE;CAC/C,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 { z } from 'zod';\n\nimport {\n DatetimeLiteralSchema,\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/** A scalar literal that can appear as an operand in a style-rule where clause. */\nexport const DataGridStyleRuleLiteralSchema = z.union([\n z.string(),\n z.number(),\n z.boolean(),\n z.null(),\n]);\nexport type DataGridStyleRuleLiteral = z.infer<\n typeof DataGridStyleRuleLiteralSchema\n>;\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 * 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, a datetime literal, a time literal, or a column reference. */\nexport const DataGridStyleRuleOperandSchema = z.union([\n DataGridColumnRefSchema,\n DataGridDatetimeLiteralSchema,\n DataGridTimeLiteralSchema,\n DataGridStyleRuleLiteralSchema,\n]);\nexport type DataGridStyleRuleOperand =\n | DataGridColumnRef\n | DataGridDatetimeLiteral\n | DataGridTimeLiteral\n | DataGridStyleRuleLiteral;\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 numeric column value.\n * Colors should be hex strings (#rrggbb).\n * If the column value is missing or non-numeric, 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 numeric range. Values above this clamp to maxColor. */\n maxValue: z.number(),\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: z.number().optional(),\n /** Hex color (#rrggbb) at the minimum value. */\n minColor: z.string(),\n /** The low end of the numeric range. Values below this clamp to minColor. */\n minValue: z.number(),\n /** The column whose numeric 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 | boolean | null`). Return `null` to signal that the value\n * is missing or cannot 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;\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"]}