@neo4j-ndl/react 4.15.1 → 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 (117) 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/DataGrid.js +2 -1
  10. package/lib/cjs/data-grid/DataGrid.js.map +1 -1
  11. package/lib/cjs/data-grid/data-grid-context.js.map +1 -1
  12. package/lib/cjs/data-grid/index.js +2 -14
  13. package/lib/cjs/data-grid/index.js.map +1 -1
  14. package/lib/cjs/data-grid/stories/datagrid-rule-based-styling-datetime.story.js +286 -0
  15. package/lib/cjs/data-grid/stories/datagrid-rule-based-styling-datetime.story.js.map +1 -0
  16. package/lib/cjs/data-grid/stories/index.js +5 -1
  17. package/lib/cjs/data-grid/stories/index.js.map +1 -1
  18. package/lib/cjs/data-grid/style-rules/evaluate.js +78 -49
  19. package/lib/cjs/data-grid/style-rules/evaluate.js.map +1 -1
  20. package/lib/cjs/data-grid/style-rules/hooks.js +3 -3
  21. package/lib/cjs/data-grid/style-rules/hooks.js.map +1 -1
  22. package/lib/cjs/data-grid/style-rules/index.js +4 -1
  23. package/lib/cjs/data-grid/style-rules/index.js.map +1 -1
  24. package/lib/cjs/data-grid/style-rules/types.js +26 -2
  25. package/lib/cjs/data-grid/style-rules/types.js.map +1 -1
  26. package/lib/cjs/time-picker/TimePicker.js +36 -20
  27. package/lib/cjs/time-picker/TimePicker.js.map +1 -1
  28. package/lib/cjs/time-picker/generate-time-options.js +6 -3
  29. package/lib/cjs/time-picker/generate-time-options.js.map +1 -1
  30. package/lib/cjs/time-picker/needle-time.js +23 -9
  31. package/lib/cjs/time-picker/needle-time.js.map +1 -1
  32. package/lib/cjs/time-picker/stories/index.js +5 -1
  33. package/lib/cjs/time-picker/stories/index.js.map +1 -1
  34. package/lib/cjs/time-picker/stories/time-picker-with-seconds.story.js +32 -0
  35. package/lib/cjs/time-picker/stories/time-picker-with-seconds.story.js.map +1 -0
  36. package/lib/cjs/tooltip/Tooltip.js.map +1 -1
  37. package/lib/cjs/tooltip/use-tooltip.js +1 -1
  38. package/lib/cjs/tooltip/use-tooltip.js.map +1 -1
  39. package/lib/esm/_generated/style-rules/color-utils.js +46 -0
  40. package/lib/esm/_generated/style-rules/color-utils.js.map +1 -0
  41. package/lib/esm/_generated/style-rules/date-utils.js +141 -0
  42. package/lib/esm/_generated/style-rules/date-utils.js.map +1 -0
  43. package/lib/esm/_generated/style-rules/index.js +29 -0
  44. package/lib/esm/_generated/style-rules/index.js.map +1 -0
  45. package/lib/esm/_generated/style-rules/literal-schemas.js +61 -0
  46. package/lib/esm/_generated/style-rules/literal-schemas.js.map +1 -0
  47. package/lib/esm/data-grid/DataGrid.js +2 -1
  48. package/lib/esm/data-grid/DataGrid.js.map +1 -1
  49. package/lib/esm/data-grid/data-grid-context.js.map +1 -1
  50. package/lib/esm/data-grid/index.js +1 -3
  51. package/lib/esm/data-grid/index.js.map +1 -1
  52. package/lib/esm/data-grid/stories/datagrid-rule-based-styling-datetime.story.js +284 -0
  53. package/lib/esm/data-grid/stories/datagrid-rule-based-styling-datetime.story.js.map +1 -0
  54. package/lib/esm/data-grid/stories/index.js +3 -0
  55. package/lib/esm/data-grid/stories/index.js.map +1 -1
  56. package/lib/esm/data-grid/style-rules/evaluate.js +72 -43
  57. package/lib/esm/data-grid/style-rules/evaluate.js.map +1 -1
  58. package/lib/esm/data-grid/style-rules/hooks.js +3 -3
  59. package/lib/esm/data-grid/style-rules/hooks.js.map +1 -1
  60. package/lib/esm/data-grid/style-rules/index.js +2 -1
  61. package/lib/esm/data-grid/style-rules/index.js.map +1 -1
  62. package/lib/esm/data-grid/style-rules/types.js +25 -1
  63. package/lib/esm/data-grid/style-rules/types.js.map +1 -1
  64. package/lib/esm/time-picker/TimePicker.js +36 -20
  65. package/lib/esm/time-picker/TimePicker.js.map +1 -1
  66. package/lib/esm/time-picker/generate-time-options.js +6 -3
  67. package/lib/esm/time-picker/generate-time-options.js.map +1 -1
  68. package/lib/esm/time-picker/needle-time.js +23 -9
  69. package/lib/esm/time-picker/needle-time.js.map +1 -1
  70. package/lib/esm/time-picker/stories/index.js +3 -0
  71. package/lib/esm/time-picker/stories/index.js.map +1 -1
  72. package/lib/esm/time-picker/stories/time-picker-with-seconds.story.js +30 -0
  73. package/lib/esm/time-picker/stories/time-picker-with-seconds.story.js.map +1 -0
  74. package/lib/esm/tooltip/Tooltip.js.map +1 -1
  75. package/lib/esm/tooltip/use-tooltip.js +1 -1
  76. package/lib/esm/tooltip/use-tooltip.js.map +1 -1
  77. package/lib/types/_generated/style-rules/color-utils.d.ts +33 -0
  78. package/lib/types/_generated/style-rules/color-utils.d.ts.map +1 -0
  79. package/lib/types/_generated/style-rules/date-utils.d.ts +54 -0
  80. package/lib/types/_generated/style-rules/date-utils.d.ts.map +1 -0
  81. package/lib/types/_generated/style-rules/index.d.ts +25 -0
  82. package/lib/types/_generated/style-rules/index.d.ts.map +1 -0
  83. package/lib/types/_generated/style-rules/literal-schemas.d.ts +53 -0
  84. package/lib/types/_generated/style-rules/literal-schemas.d.ts.map +1 -0
  85. package/lib/types/data-grid/DataGrid.d.ts +4 -2
  86. package/lib/types/data-grid/DataGrid.d.ts.map +1 -1
  87. package/lib/types/data-grid/data-grid-context.d.ts +2 -1
  88. package/lib/types/data-grid/data-grid-context.d.ts.map +1 -1
  89. package/lib/types/data-grid/index.d.ts +1 -4
  90. package/lib/types/data-grid/index.d.ts.map +1 -1
  91. package/lib/types/data-grid/stories/datagrid-pinned-columns.stories.d.ts +1 -1
  92. package/lib/types/data-grid/stories/datagrid-rule-based-styling-datetime.story.d.ts +24 -0
  93. package/lib/types/data-grid/stories/datagrid-rule-based-styling-datetime.story.d.ts.map +1 -0
  94. package/lib/types/data-grid/stories/datagrid-search-and-filters.stories.d.ts +1 -1
  95. package/lib/types/data-grid/stories/index.d.ts +2 -0
  96. package/lib/types/data-grid/stories/index.d.ts.map +1 -1
  97. package/lib/types/data-grid/style-rules/evaluate.d.ts +4 -3
  98. package/lib/types/data-grid/style-rules/evaluate.d.ts.map +1 -1
  99. package/lib/types/data-grid/style-rules/hooks.d.ts.map +1 -1
  100. package/lib/types/data-grid/style-rules/index.d.ts +2 -2
  101. package/lib/types/data-grid/style-rules/index.d.ts.map +1 -1
  102. package/lib/types/data-grid/style-rules/types.d.ts +62 -2
  103. package/lib/types/data-grid/style-rules/types.d.ts.map +1 -1
  104. package/lib/types/time-picker/TimePicker.d.ts +1 -1
  105. package/lib/types/time-picker/TimePicker.d.ts.map +1 -1
  106. package/lib/types/time-picker/generate-time-options.d.ts +1 -1
  107. package/lib/types/time-picker/generate-time-options.d.ts.map +1 -1
  108. package/lib/types/time-picker/needle-time.d.ts +4 -2
  109. package/lib/types/time-picker/needle-time.d.ts.map +1 -1
  110. package/lib/types/time-picker/stories/index.d.ts +2 -0
  111. package/lib/types/time-picker/stories/index.d.ts.map +1 -1
  112. package/lib/types/time-picker/stories/time-picker-with-seconds.story.d.ts +24 -0
  113. package/lib/types/time-picker/stories/time-picker-with-seconds.story.d.ts.map +1 -0
  114. package/lib/types/tooltip/Tooltip.d.ts +4 -1
  115. package/lib/types/tooltip/Tooltip.d.ts.map +1 -1
  116. package/lib/types/tooltip/use-tooltip.d.ts.map +1 -1
  117. package/package.json +6 -4
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/data-grid/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AACH,OAAO,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAC;AACzD,OAAO,KAAK,aAAa,MAAM,WAAW,CAAC;AAE3C,OAAO,EAAE,QAAQ,EAAsC,MAAM,YAAY,CAAC;AAC1E,OAAO,EAAE,aAAa,EAAE,kBAAkB,EAAE,CAAC;AAE7C,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAC9C,cAAc,+BAA+B,CAAC;AAC9C,OAAO,EAAE,0BAA0B,EAAE,MAAM,wBAAwB,CAAC;AACpE,OAAO,EAAE,oBAAoB,EAAE,MAAM,qBAAqB,CAAC;AAC3D,OAAO,EACL,uBAAuB,EACvB,wBAAwB,EACxB,uBAAuB,EACvB,8BAA8B,EAC9B,8BAA8B,EAC9B,8BAA8B,EAC9B,uBAAuB,EACvB,4BAA4B,GAC7B,MAAM,qBAAqB,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 */\nimport { useDataGridContext } from './data-grid-context';\nimport * as dataGridUtils from './helpers';\n\nexport { DataGrid, type HeaderStyle, type BorderStyle } from './DataGrid';\nexport { dataGridUtils, useDataGridContext };\nexport type * from './datagrid-types';\nexport { useTableNav } from './data-grid-nav';\nexport * from './data-grid-nav/data-grid-nav';\nexport { evaluateDataGridStyleRules } from './style-rules/evaluate';\nexport { useDataGridCellStyle } from './style-rules/hooks';\nexport {\n DataGridCellStyleSchema,\n DataGridColorRangeSchema,\n DataGridColumnRefSchema,\n DataGridDisableableColorSchema,\n DataGridStyleRuleLiteralSchema,\n DataGridStyleRuleOperandSchema,\n DataGridStyleRuleSchema,\n DataGridStyleRuleWhereSchema,\n} from './style-rules/types';\nexport type {\n DataGridCellStyle,\n DataGridColorRange,\n DataGridColumnRef,\n DataGridDisableableColor,\n DataGridStyleRuleLiteral,\n DataGridStyleRuleOperand,\n DataGridStyleRule,\n DataGridStyleRuleWhere,\n} from './style-rules/types';\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/data-grid/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AACH,OAAO,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAC;AACzD,OAAO,KAAK,aAAa,MAAM,WAAW,CAAC;AAE3C,OAAO,EAAE,QAAQ,EAAsC,MAAM,YAAY,CAAC;AAC1E,OAAO,EAAE,aAAa,EAAE,kBAAkB,EAAE,CAAC;AAE7C,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAC9C,cAAc,+BAA+B,CAAC;AAC9C,cAAc,eAAe,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 */\nimport { useDataGridContext } from './data-grid-context';\nimport * as dataGridUtils from './helpers';\n\nexport { DataGrid, type HeaderStyle, type BorderStyle } from './DataGrid';\nexport { dataGridUtils, useDataGridContext };\nexport type * from './datagrid-types';\nexport { useTableNav } from './data-grid-nav';\nexport * from './data-grid-nav/data-grid-nav';\nexport * from './style-rules';\n"]}
@@ -0,0 +1,284 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ /**
3
+ *
4
+ * Copyright (c) "Neo4j"
5
+ * Neo4j Sweden AB [http://neo4j.com]
6
+ *
7
+ * This file is part of Neo4j.
8
+ *
9
+ * Neo4j is free software: you can redistribute it and/or modify
10
+ * it under the terms of the GNU General Public License as published by
11
+ * the Free Software Foundation, either version 3 of the License, or
12
+ * (at your option) any later version.
13
+ *
14
+ * This program is distributed in the hope that it will be useful,
15
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
16
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17
+ * GNU General Public License for more details.
18
+ *
19
+ * You should have received a copy of the GNU General Public License
20
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
21
+ */
22
+ import '@neo4j-ndl/base/lib/neo4j-ds-styles.css';
23
+ import { DataGrid } from '@neo4j-ndl/react';
24
+ import { createColumnHelper, getCoreRowModel, getPaginationRowModel, getSortedRowModel, useReactTable, } from '@tanstack/react-table';
25
+ const data = [
26
+ // ── Past events (before start of 2026-06-25 in Stockholm / CEST) ──────────
27
+ {
28
+ event: 'Quarterly review',
29
+ // 09:00 Stockholm CEST = 07:00 UTC
30
+ scheduledDate: new Date('2026-06-10T09:00:00+02:00'),
31
+ scheduledTimeMs: 7 * 3600000,
32
+ localTimeDisplay: '09:00 CEST (+02:00)',
33
+ status: 'confirmed',
34
+ },
35
+ {
36
+ event: 'Security audit',
37
+ // 07:30 London BST (+01:00) = 06:30 UTC — before Stockholm opens
38
+ scheduledDate: new Date('2026-06-18T07:30:00+01:00'),
39
+ scheduledTimeMs: 6 * 3600000 + 30 * 60000,
40
+ localTimeDisplay: '07:30 BST (+01:00)',
41
+ status: 'delayed',
42
+ },
43
+ // ── Today (2026-06-25 in Stockholm / CEST) ─────────────────────────────────
44
+ {
45
+ event: 'Customer demo',
46
+ // 09:00 New York EDT (-04:00) = 13:00 UTC
47
+ scheduledDate: new Date('2026-06-25T09:00:00-04:00'),
48
+ scheduledTimeMs: 13 * 3600000,
49
+ localTimeDisplay: '09:00 EDT (-04:00)',
50
+ status: 'confirmed',
51
+ },
52
+ {
53
+ event: 'Platform migration',
54
+ // 22:00 Stockholm CEST (+02:00) = 20:00 UTC — after Stockholm closes
55
+ scheduledDate: new Date('2026-06-25T22:00:00+02:00'),
56
+ scheduledTimeMs: 20 * 3600000,
57
+ localTimeDisplay: '22:00 CEST (+02:00)',
58
+ status: 'confirmed',
59
+ },
60
+ // ── Near future (up to and including 2026-07-14 in Stockholm) ─────────────
61
+ {
62
+ event: 'Board presentation',
63
+ // 10:00 Singapore SGT (+08:00) = 02:00 UTC — before Stockholm opens
64
+ scheduledDate: new Date('2026-07-02T10:00:00+08:00'),
65
+ scheduledTimeMs: 2 * 3600000,
66
+ localTimeDisplay: '10:00 SGT (+08:00)',
67
+ status: 'confirmed',
68
+ },
69
+ {
70
+ event: 'Partner onboarding',
71
+ // 13:15 Paris CEST (+02:00) = 11:15 UTC
72
+ scheduledDate: new Date('2026-07-08T13:15:00+02:00'),
73
+ scheduledTimeMs: 11 * 3600000 + 15 * 60000,
74
+ localTimeDisplay: '13:15 CEST (+02:00)',
75
+ status: 'cancelled',
76
+ },
77
+ // ── Far future (after 2026-07-15T00:00 Stockholm / CEST = 2026-07-14T22:00Z)
78
+ {
79
+ event: 'Architecture summit',
80
+ // 08:00 Amsterdam CEST (+02:00) = 06:00 UTC.
81
+ // Although the calendar date is "July 15", 08:00 CEST is still within the
82
+ // same UTC day as July 14 22:00Z, so it crosses the far-future boundary.
83
+ scheduledDate: new Date('2026-07-15T08:00:00+02:00'),
84
+ scheduledTimeMs: 6 * 3600000,
85
+ localTimeDisplay: '08:00 CEST (+02:00)',
86
+ status: 'confirmed',
87
+ },
88
+ {
89
+ event: 'Annual conference',
90
+ // 09:00 San Francisco PDT (-07:00) = 16:00 UTC — after Stockholm closes
91
+ scheduledDate: new Date('2026-08-03T09:00:00-07:00'),
92
+ scheduledTimeMs: 16 * 3600000,
93
+ localTimeDisplay: '09:00 PDT (-07:00)',
94
+ status: 'confirmed',
95
+ },
96
+ {
97
+ event: 'Year-end planning',
98
+ // 09:00 Tokyo JST (+09:00) = 00:00 UTC — midnight, well before Stockholm opens
99
+ scheduledDate: new Date('2026-11-20T09:00:00+09:00'),
100
+ scheduledTimeMs: 0,
101
+ localTimeDisplay: '09:00 JST (+09:00)',
102
+ status: 'confirmed',
103
+ },
104
+ ];
105
+ /**
106
+ * All date and time boundaries are anchored to Stockholm in June–July 2026.
107
+ * Date literals use RFC 9557 IANA bracket notation — the UTC offset is inferred
108
+ * from the named zone (CEST = +02:00 in this period); writing `+02:00` explicitly
109
+ * is optional. Time literals use UTC-offset notation.
110
+ *
111
+ * "Today" from a Stockholm perspective:
112
+ * 2026-06-25T00:00:00[Europe/Stockholm] = 2026-06-24T22:00:00Z
113
+ * 2026-06-26T00:00:00[Europe/Stockholm] = 2026-06-25T22:00:00Z
114
+ *
115
+ * "Far future" threshold:
116
+ * 2026-07-15T00:00:00[Europe/Stockholm] = 2026-07-14T22:00:00Z
117
+ *
118
+ * Business hours (Stockholm):
119
+ * { time: '09:00:00+02:00' } resolves to 07:00 UTC (25 200 000 ms)
120
+ * { time: '17:00:00+02:00' } resolves to 15:00 UTC (54 000 000 ms)
121
+ */
122
+ const styleRules = [
123
+ // Past events — entire row in muted red
124
+ {
125
+ apply: {
126
+ color: { value: '#fee2e2' },
127
+ textColor: { value: '#7f1d1d' },
128
+ },
129
+ column: null,
130
+ priority: 1,
131
+ where: {
132
+ lessThan: [
133
+ { column: 'scheduledDate' },
134
+ { datetime: '2026-06-25T00:00:00[Europe/Stockholm]' },
135
+ ],
136
+ },
137
+ },
138
+ // Today (in Stockholm timezone) — entire row in amber
139
+ {
140
+ apply: {
141
+ color: { value: '#fef9c3' },
142
+ textColor: { value: '#713f12' },
143
+ },
144
+ column: null,
145
+ priority: 1,
146
+ where: {
147
+ and: [
148
+ {
149
+ greaterThanOrEqual: [
150
+ { column: 'scheduledDate' },
151
+ { datetime: '2026-06-25T00:00:00[Europe/Stockholm]' },
152
+ ],
153
+ },
154
+ {
155
+ lessThan: [
156
+ { column: 'scheduledDate' },
157
+ { datetime: '2026-06-26T00:00:00[Europe/Stockholm]' },
158
+ ],
159
+ },
160
+ ],
161
+ },
162
+ },
163
+ // Far future (after 2026-07-15 midnight Stockholm time) — entire row in green
164
+ {
165
+ apply: {
166
+ color: { value: '#dcfce7' },
167
+ textColor: { value: '#14532d' },
168
+ },
169
+ column: null,
170
+ priority: 1,
171
+ where: {
172
+ greaterThanOrEqual: [
173
+ { column: 'scheduledDate' },
174
+ { datetime: '2026-07-15T00:00:00[Europe/Stockholm]' },
175
+ ],
176
+ },
177
+ },
178
+ // Outside Stockholm business hours (before 09:00 CEST or from 17:00 CEST) —
179
+ // time cell in orange. The { time: "..." } literals carry an offset so the
180
+ // engine normalises them to UTC before comparing against scheduledTimeMs.
181
+ {
182
+ apply: {
183
+ color: { value: '#ffedd5' },
184
+ textColor: { value: '#7c2d12' },
185
+ },
186
+ column: 'scheduledTimeMs',
187
+ priority: 2,
188
+ where: {
189
+ or: [
190
+ {
191
+ lessThan: [{ column: 'scheduledTimeMs' }, { time: '09:00:00+02:00' }],
192
+ },
193
+ {
194
+ greaterThanOrEqual: [
195
+ { column: 'scheduledTimeMs' },
196
+ { time: '17:00:00+02:00' },
197
+ ],
198
+ },
199
+ ],
200
+ },
201
+ },
202
+ // Cancelled events — all cells grayed out at highest priority
203
+ {
204
+ apply: {
205
+ color: { value: '#f3f4f6' },
206
+ textColor: { value: '#9ca3af' },
207
+ },
208
+ column: null,
209
+ priority: 5,
210
+ where: { equal: [{ column: 'status' }, 'cancelled'] },
211
+ },
212
+ ];
213
+ const Component = () => {
214
+ const columnHelper = createColumnHelper();
215
+ const columns = [
216
+ columnHelper.accessor('event', {
217
+ cell: (info) => info.getValue(),
218
+ header: () => 'Event',
219
+ minSize: 180,
220
+ size: 220,
221
+ }),
222
+ columnHelper.accessor('scheduledDate', {
223
+ cell: (info) => info.getValue().toLocaleDateString('en-GB', {
224
+ day: 'numeric',
225
+ month: 'short',
226
+ timeZone: 'Europe/Stockholm',
227
+ year: 'numeric',
228
+ }),
229
+ header: () => 'Date (Stockholm)',
230
+ minSize: 150,
231
+ size: 170,
232
+ }),
233
+ columnHelper.accessor('localTimeDisplay', {
234
+ cell: (info) => info.getValue(),
235
+ header: () => 'Local time',
236
+ minSize: 160,
237
+ size: 180,
238
+ }),
239
+ columnHelper.accessor('scheduledTimeMs', {
240
+ cell: (info) => {
241
+ const ms = info.getValue();
242
+ const h = Math.floor(ms / 3600000)
243
+ .toString()
244
+ .padStart(2, '0');
245
+ const m = Math.floor((ms % 3600000) / 60000)
246
+ .toString()
247
+ .padStart(2, '0');
248
+ return `${h}:${m} UTC`;
249
+ },
250
+ header: () => 'Time (UTC)',
251
+ minSize: 110,
252
+ size: 130,
253
+ }),
254
+ columnHelper.accessor('status', {
255
+ cell: (info) => info.getValue(),
256
+ header: () => 'Status',
257
+ minSize: 100,
258
+ size: 120,
259
+ }),
260
+ ];
261
+ const table = useReactTable({
262
+ columnResizeMode: 'onChange',
263
+ columns,
264
+ data,
265
+ defaultColumn: {
266
+ maxSize: 800,
267
+ minSize: 80,
268
+ },
269
+ enableSorting: true,
270
+ getCoreRowModel: getCoreRowModel(),
271
+ getPaginationRowModel: getPaginationRowModel(),
272
+ getSortedRowModel: getSortedRowModel(),
273
+ initialState: {
274
+ pagination: { pageSize: 10 },
275
+ },
276
+ });
277
+ return (_jsx("div", { className: "n-w-full n-bg-light-neutral-text-weakest", children: _jsx(DataGrid, { isResizable: false, isKeyboardNavigable: false, tableInstance: table, styleRules: styleRules, styling: {
278
+ borderStyle: 'all-sides',
279
+ hasHoverEffects: true,
280
+ hasZebraStriping: false,
281
+ } }) }));
282
+ };
283
+ export default Component;
284
+ //# sourceMappingURL=datagrid-rule-based-styling-datetime.story.js.map
@@ -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;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,OAAO,yCAAyC,CAAC;AAEjD,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAC5C,OAAO,EACL,kBAAkB,EAClB,eAAe,EACf,qBAAqB,EACrB,iBAAiB,EACjB,aAAa,GACd,MAAM,uBAAuB,CAAC;AAsB/B,MAAM,IAAI,GAAe;IACvB,6EAA6E;IAC7E;QACE,KAAK,EAAE,kBAAkB;QACzB,mCAAmC;QACnC,aAAa,EAAE,IAAI,IAAI,CAAC,2BAA2B,CAAC;QACpD,eAAe,EAAE,CAAC,GAAG,OAAS;QAC9B,gBAAgB,EAAE,qBAAqB;QACvC,MAAM,EAAE,WAAW;KACpB;IACD;QACE,KAAK,EAAE,gBAAgB;QACvB,iEAAiE;QACjE,aAAa,EAAE,IAAI,IAAI,CAAC,2BAA2B,CAAC;QACpD,eAAe,EAAE,CAAC,GAAG,OAAS,GAAG,EAAE,GAAG,KAAM;QAC5C,gBAAgB,EAAE,oBAAoB;QACtC,MAAM,EAAE,SAAS;KAClB;IACD,8EAA8E;IAC9E;QACE,KAAK,EAAE,eAAe;QACtB,0CAA0C;QAC1C,aAAa,EAAE,IAAI,IAAI,CAAC,2BAA2B,CAAC;QACpD,eAAe,EAAE,EAAE,GAAG,OAAS;QAC/B,gBAAgB,EAAE,oBAAoB;QACtC,MAAM,EAAE,WAAW;KACpB;IACD;QACE,KAAK,EAAE,oBAAoB;QAC3B,qEAAqE;QACrE,aAAa,EAAE,IAAI,IAAI,CAAC,2BAA2B,CAAC;QACpD,eAAe,EAAE,EAAE,GAAG,OAAS;QAC/B,gBAAgB,EAAE,qBAAqB;QACvC,MAAM,EAAE,WAAW;KACpB;IACD,6EAA6E;IAC7E;QACE,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,IAAI;QACnB,eAAe,EAAE,eAAe,EAAE;QAClC,qBAAqB,EAAE,qBAAqB,EAAE;QAC9C,iBAAiB,EAAE,iBAAiB,EAAE;QACtC,YAAY,EAAE;YACZ,UAAU,EAAE,EAAE,QAAQ,EAAE,EAAE,EAAE;SAC7B;KACF,CAAC,CAAC;IAEH,OAAO,CACL,cAAK,SAAS,EAAC,0CAA0C,YACvD,KAAC,QAAQ,IACP,WAAW,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,eAAe,SAAS,CAAC","sourcesContent":["/**\n *\n * Copyright (c) \"Neo4j\"\n * Neo4j Sweden AB [http://neo4j.com]\n *\n * This file is part of Neo4j.\n *\n * Neo4j is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with this program. If not, see <http://www.gnu.org/licenses/>.\n */\n\nimport '@neo4j-ndl/base/lib/neo4j-ds-styles.css';\n\nimport { DataGrid } from '@neo4j-ndl/react';\nimport {\n createColumnHelper,\n getCoreRowModel,\n getPaginationRowModel,\n getSortedRowModel,\n 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"]}
@@ -38,6 +38,7 @@ export { default as DataGridSingleSelectable } from './datagrid-single-selectabl
38
38
  export { default as DataGridUsingEditableCells } from './datagrid-using-editable-cells.story';
39
39
  export { default as DataGridRuleBasedStyling } from './datagrid-rule-based-styling.story';
40
40
  export { default as DataGridCustomCellWithStyleRules } from './datagrid-custom-cell-with-style-rules.story';
41
+ export { default as DataGridRuleBasedStylingDateTime } from './datagrid-rule-based-styling-datetime.story';
41
42
  import { removeLicenseHeader } from '../../_common/export-stories-utils';
42
43
  import DataGridColumnFilteringSourceRaw from './datagrid-column-filtering.story?raw';
43
44
  import DataGridCompactModeSourceRaw from './datagrid-compact-mode.story?raw';
@@ -52,6 +53,7 @@ import DataGridPinnedColumnsSourceRaw from './datagrid-pinned-columns.stories?ra
52
53
  import DataGridPlaceholderStatesSourceRaw from './datagrid-placeholder-states.story?raw';
53
54
  import DataGridResizableColumnSourceRaw from './datagrid-resizable-column.story?raw';
54
55
  import DataGridRuleBasedStylingSourceRaw from './datagrid-rule-based-styling.story?raw';
56
+ import DataGridRuleBasedStylingDateTimeSourceRaw from './datagrid-rule-based-styling-datetime.story?raw';
55
57
  import DataGridSearchableSourceRaw from './datagrid-search-and-filters.stories?raw';
56
58
  import DataGridSelectableSourceRaw from './datagrid-selectable.story?raw';
57
59
  import DataGridSimpleSourceRaw from './datagrid-simple.story?raw';
@@ -81,4 +83,5 @@ export const DataGridPinnedColumnsSource = removeLicenseHeader(DataGridPinnedCol
81
83
  export const DataGridNoPaginationTableSource = removeLicenseHeader(DataGridNoPaginationTableRaw);
82
84
  export const DataGridSingleSelectableSource = removeLicenseHeader(DataGridSingleSelectableSourceRaw);
83
85
  export const DataGridUsingEditableCellsSource = removeLicenseHeader(DataGridUsingEditableCellsSourceRaw);
86
+ export const DataGridRuleBasedStylingDateTimeSource = removeLicenseHeader(DataGridRuleBasedStylingDateTimeSourceRaw);
84
87
  //# 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,OAAO,EAAE,OAAO,IAAI,mBAAmB,EAAE,MAAM,+BA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,CAC/D,iCAAiC,CAClC,CAAC;AACF,MAAM,CAAC,MAAM,gCAAgC,GAAG,mBAAmB,CACjE,mCAAmC,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;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,OAAO,EAAE,OAAO,IAAI,mBAAmB,EAAE,MAAM,+BAA+B,CAAC;AAC/E,OAAO,EAAE,OAAO,IAAI,cAAc,EAAE,MAAM,yBAAyB,CAAC;AACpE,OAAO,EAAE,OAAO,IAAI,gBAAgB,EAAE,MAAM,2BAA2B,CAAC;AACxE,OAAO,EAAE,OAAO,IAAI,kBAAkB,EAAE,MAAM,6BAA6B,CAAC;AAC5E,OAAO,EACL,UAAU,IAAI,kBAAkB,EAChC,eAAe,IAAI,uBAAuB,GAC3C,MAAM,uCAAuC,CAAC;AAC/C,OAAO,EAAE,OAAO,IAAI,gBAAgB,EAAE,MAAM,4BAA4B,CAAC;AACzE,OAAO,EAAE,OAAO,IAAI,mBAAmB,EAAE,MAAM,+BAA+B,CAAC;AAC/E,OAAO,EAAE,OAAO,IAAI,sBAAsB,EAAE,MAAM,iCAAiC,CAAC;AACpF,OAAO,EAAE,OAAO,IAAI,uBAAuB,EAAE,MAAM,mCAAmC,CAAC;AACvF,OAAO,EAAE,OAAO,IAAI,yBAAyB,EAAE,MAAM,qCAAqC,CAAC;AAC3F,OAAO,EAAE,OAAO,IAAI,uBAAuB,EAAE,MAAM,mCAAmC,CAAC;AACvF,OAAO,EAAE,OAAO,IAAI,2BAA2B,EAAE,MAAM,uCAAuC,CAAC;AAC/F,OAAO,EAAE,OAAO,IAAI,0BAA0B,EAAE,MAAM,sCAAsC,CAAC;AAC7F,OAAO,EAAE,OAAO,IAAI,8BAA8B,EAAE,MAAM,2CAA2C,CAAC;AACtG,OAAO,EACL,eAAe,IAAI,uBAAuB,EAC1C,cAAc,IAAI,sBAAsB,EACxC,eAAe,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G,mBAAmB,CAClE,oCAAoC,CACrC,CAAC;AACF,MAAM,CAAC,MAAM,gCAAgC,GAAG,mBAAmB,CACjE,mCAAmC,CACpC,CAAC;AACF,MAAM,CAAC,MAAM,oCAAoC,GAAG,mBAAmB,CACrE,uCAAuC,CACxC,CAAC;AACF,MAAM,CAAC,MAAM,2BAA2B,GAAG,mBAAmB,CAC5D,8BAA8B,CAC/B,CAAC;AACF,MAAM,CAAC,MAAM,+BAA+B,GAAG,mBAAmB,CAChE,4BAA4B,CAC7B,CAAC;AACF,MAAM,CAAC,MAAM,8BAA8B,GAAG,mBAAmB,CAC/D,iCAAiC,CAClC,CAAC;AACF,MAAM,CAAC,MAAM,gCAAgC,GAAG,mBAAmB,CACjE,mCAAmC,CACpC,CAAC;AACF,MAAM,CAAC,MAAM,sCAAsC,GAAG,mBAAmB,CACvE,yCAAyC,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"]}
@@ -19,18 +19,8 @@
19
19
  * along with this program. If not, see <http://www.gnu.org/licenses/>.
20
20
  */
21
21
  import { color, rgbToHex, validHex } from '@uiw/react-color';
22
- // --- Color interpolation (duplicated from react-graph to avoid cross-package coupling) ---
23
- function getWeight(startValue, endValue, value) {
24
- return (value - startValue) / (endValue - startValue);
25
- }
26
- function lerpColor(startColor, endColor, weight) {
27
- return {
28
- b: Math.round(startColor.b * (1 - weight) + endColor.b * weight),
29
- g: Math.round(startColor.g * (1 - weight) + endColor.g * weight),
30
- r: Math.round(startColor.r * (1 - weight) + endColor.r * weight),
31
- };
32
- }
33
- function getInterpolatedColor(colorRange, rowData) {
22
+ import { getWeight, lerpColor, parseDateString, parseTimeString, } from '../../_generated/style-rules';
23
+ function getInterpolatedColor(colorRange, rowData, converters) {
34
24
  const { onColumn, minValue, minColor, maxValue, maxColor, midValue, midColor, } = colorRange;
35
25
  if (!validHex(minColor) || !validHex(maxColor)) {
36
26
  return null;
@@ -48,10 +38,31 @@ function getInterpolatedColor(colorRange, rowData) {
48
38
  midRgb = color(midColor).rgb;
49
39
  }
50
40
  const rawValue = rowData[onColumn];
51
- if (typeof rawValue !== 'number') {
41
+ let numericValue = null;
42
+ if (typeof rawValue === 'number') {
43
+ numericValue = Number.isFinite(rawValue) ? rawValue : null;
44
+ }
45
+ else if (typeof rawValue === 'bigint') {
46
+ const n = Number(rawValue);
47
+ numericValue = Number.isFinite(n) ? n : null;
48
+ }
49
+ else if (rawValue instanceof Date) {
50
+ const ts = rawValue.getTime();
51
+ numericValue = Number.isFinite(ts) ? ts : null;
52
+ }
53
+ else {
54
+ const converter = converters === null || converters === void 0 ? void 0 : converters[onColumn];
55
+ if (converter !== undefined) {
56
+ const converted = converter(rawValue);
57
+ if (typeof converted === 'number') {
58
+ numericValue = Number.isFinite(converted) ? converted : null;
59
+ }
60
+ }
61
+ }
62
+ if (numericValue === null) {
52
63
  return null;
53
64
  }
54
- const clampedValue = Math.max(actualMinValue, Math.min(actualMaxValue, rawValue));
65
+ const clampedValue = Math.max(actualMinValue, Math.min(actualMaxValue, numericValue));
55
66
  let rgb;
56
67
  if (midRgb !== undefined && midValue !== undefined) {
57
68
  const t = getWeight(minValue, midValue, clampedValue);
@@ -70,7 +81,7 @@ function getInterpolatedColor(colorRange, rowData) {
70
81
  }
71
82
  return rgbToHex(rgb);
72
83
  }
73
- function resolveValue(value, rowData) {
84
+ function resolveValue(value, rowData, converters) {
74
85
  if (typeof value === 'object' && value !== null && 'column' in value) {
75
86
  const cellVal = rowData[value.column];
76
87
  if (cellVal === undefined) {
@@ -81,21 +92,38 @@ function resolveValue(value, rowData) {
81
92
  typeof cellVal === 'boolean') {
82
93
  return cellVal;
83
94
  }
95
+ if (typeof cellVal === 'bigint') {
96
+ return Number(cellVal);
97
+ }
98
+ if (cellVal instanceof Date) {
99
+ const ts = cellVal.getTime();
100
+ return isNaN(ts) ? null : ts;
101
+ }
102
+ const converter = converters === null || converters === void 0 ? void 0 : converters[value.column];
103
+ if (converter !== undefined) {
104
+ return converter(cellVal);
105
+ }
84
106
  return null;
85
107
  }
108
+ if (typeof value === 'object' && value !== null && 'datetime' in value) {
109
+ return parseDateString(value.datetime);
110
+ }
111
+ if (typeof value === 'object' && value !== null && 'time' in value) {
112
+ return parseTimeString(value.time);
113
+ }
86
114
  return value;
87
115
  }
88
- function safeCompare(left, right, rowData, compareFn) {
89
- const leftVal = resolveValue(left, rowData);
90
- const rightVal = resolveValue(right, rowData);
116
+ function safeCompare(left, right, rowData, compareFn, converters) {
117
+ const leftVal = resolveValue(left, rowData, converters);
118
+ const rightVal = resolveValue(right, rowData, converters);
91
119
  if (leftVal === null || rightVal === null) {
92
120
  return null;
93
121
  }
94
122
  return compareFn(leftVal, rightVal);
95
123
  }
96
- function safeStringCompare(left, right, rowData, compareFn) {
97
- const leftVal = resolveValue(left, rowData);
98
- const rightVal = resolveValue(right, rowData);
124
+ function safeStringCompare(left, right, rowData, compareFn, converters) {
125
+ const leftVal = resolveValue(left, rowData, converters);
126
+ const rightVal = resolveValue(right, rowData, converters);
99
127
  if (leftVal === null ||
100
128
  rightVal === null ||
101
129
  typeof leftVal !== 'string' ||
@@ -104,52 +132,52 @@ function safeStringCompare(left, right, rowData, compareFn) {
104
132
  }
105
133
  return compareFn(leftVal, rightVal);
106
134
  }
107
- function evaluateWhere(rowData, where) {
135
+ function evaluateWhere(rowData, where, converters) {
108
136
  if (!where) {
109
137
  return true;
110
138
  }
111
139
  if ('equal' in where) {
112
140
  const [left, right] = where.equal;
113
- const leftVal = resolveValue(left, rowData);
114
- const rightVal = resolveValue(right, rowData);
141
+ const leftVal = resolveValue(left, rowData, converters);
142
+ const rightVal = resolveValue(right, rowData, converters);
115
143
  if (leftVal === null || rightVal === null) {
116
144
  return null;
117
145
  }
118
146
  return leftVal === rightVal;
119
147
  }
120
148
  if ('not' in where) {
121
- const isMatch = evaluateWhere(rowData, where.not);
149
+ const isMatch = evaluateWhere(rowData, where.not, converters);
122
150
  return isMatch === null ? null : !isMatch;
123
151
  }
124
152
  if ('lessThan' in where) {
125
- return safeCompare(where.lessThan[0], where.lessThan[1], rowData, (a, b) => a < b);
153
+ return safeCompare(where.lessThan[0], where.lessThan[1], rowData, (a, b) => a < b, converters);
126
154
  }
127
155
  if ('lessThanOrEqual' in where) {
128
- return safeCompare(where.lessThanOrEqual[0], where.lessThanOrEqual[1], rowData, (a, b) => a <= b);
156
+ return safeCompare(where.lessThanOrEqual[0], where.lessThanOrEqual[1], rowData, (a, b) => a <= b, converters);
129
157
  }
130
158
  if ('greaterThan' in where) {
131
- return safeCompare(where.greaterThan[0], where.greaterThan[1], rowData, (a, b) => a > b);
159
+ return safeCompare(where.greaterThan[0], where.greaterThan[1], rowData, (a, b) => a > b, converters);
132
160
  }
133
161
  if ('greaterThanOrEqual' in where) {
134
- return safeCompare(where.greaterThanOrEqual[0], where.greaterThanOrEqual[1], rowData, (a, b) => a >= b);
162
+ return safeCompare(where.greaterThanOrEqual[0], where.greaterThanOrEqual[1], rowData, (a, b) => a >= b, converters);
135
163
  }
136
164
  if ('contains' in where) {
137
- return safeStringCompare(where.contains[0], where.contains[1], rowData, (a, b) => a.includes(b));
165
+ return safeStringCompare(where.contains[0], where.contains[1], rowData, (a, b) => a.includes(b), converters);
138
166
  }
139
167
  if ('startsWith' in where) {
140
- return safeStringCompare(where.startsWith[0], where.startsWith[1], rowData, (a, b) => a.startsWith(b));
168
+ return safeStringCompare(where.startsWith[0], where.startsWith[1], rowData, (a, b) => a.startsWith(b), converters);
141
169
  }
142
170
  if ('endsWith' in where) {
143
- return safeStringCompare(where.endsWith[0], where.endsWith[1], rowData, (a, b) => a.endsWith(b));
171
+ return safeStringCompare(where.endsWith[0], where.endsWith[1], rowData, (a, b) => a.endsWith(b), converters);
144
172
  }
145
173
  if ('isNull' in where) {
146
- const value = resolveValue(where.isNull, rowData);
174
+ const value = resolveValue(where.isNull, rowData, converters);
147
175
  return value === null;
148
176
  }
149
177
  if ('and' in where) {
150
178
  let hasNull = false;
151
179
  for (const clause of where.and) {
152
- const isMatch = evaluateWhere(rowData, clause);
180
+ const isMatch = evaluateWhere(rowData, clause, converters);
153
181
  if (isMatch === false) {
154
182
  return false;
155
183
  }
@@ -162,7 +190,7 @@ function evaluateWhere(rowData, where) {
162
190
  if ('or' in where) {
163
191
  let hasNull = false;
164
192
  for (const clause of where.or) {
165
- const isMatch = evaluateWhere(rowData, clause);
193
+ const isMatch = evaluateWhere(rowData, clause, converters);
166
194
  if (isMatch === true) {
167
195
  return true;
168
196
  }
@@ -175,7 +203,7 @@ function evaluateWhere(rowData, where) {
175
203
  return false;
176
204
  }
177
205
  // --- Style resolution ---
178
- function resolveAppliedStyle(apply, rowData) {
206
+ function resolveAppliedStyle(apply, rowData, converters) {
179
207
  const result = {};
180
208
  let hasStyle = false;
181
209
  if (apply.color && !apply.color.isDisabled) {
@@ -187,14 +215,14 @@ function resolveAppliedStyle(apply, rowData) {
187
215
  hasStyle = true;
188
216
  }
189
217
  if (apply.colorRange && !apply.colorRange.isDisabled) {
190
- const interpolated = getInterpolatedColor(apply.colorRange, rowData);
218
+ const interpolated = getInterpolatedColor(apply.colorRange, rowData, converters);
191
219
  if (interpolated !== null) {
192
220
  result.backgroundColor = interpolated;
193
221
  hasStyle = true;
194
222
  }
195
223
  }
196
224
  if (apply.textColorRange && !apply.textColorRange.isDisabled) {
197
- const interpolated = getInterpolatedColor(apply.textColorRange, rowData);
225
+ const interpolated = getInterpolatedColor(apply.textColorRange, rowData, converters);
198
226
  if (interpolated !== null) {
199
227
  result.color = interpolated;
200
228
  hasStyle = true;
@@ -208,7 +236,7 @@ function resolveAppliedStyle(apply, rowData) {
208
236
  *
209
237
  * Used internally by hooks, but exported for context-free usage.
210
238
  */
211
- export function computeDataGridRowStyles(rules, rowData) {
239
+ export function computeDataGridRowStyles(rules, rowData, converters) {
212
240
  const enabledRules = rules.filter((r) => !r.isDisabled);
213
241
  const totalRules = enabledRules.length;
214
242
  const sortedRules = enabledRules
@@ -227,11 +255,11 @@ export function computeDataGridRowStyles(rules, rowData) {
227
255
  });
228
256
  const cellPriorityMap = {};
229
257
  for (const rule of sortedRules) {
230
- const isMatching = evaluateWhere(rowData, rule.where) === true;
258
+ const isMatching = evaluateWhere(rowData, rule.where, converters) === true;
231
259
  if (!isMatching) {
232
260
  continue;
233
261
  }
234
- const style = resolveAppliedStyle(rule.apply, rowData);
262
+ const style = resolveAppliedStyle(rule.apply, rowData, converters);
235
263
  if (!style) {
236
264
  continue;
237
265
  }
@@ -271,9 +299,10 @@ export function computeDataGridRowStyles(rules, rowData) {
271
299
  * @param rules - Array of style rules to evaluate
272
300
  * @param rowData - The row's data as a record (column id -> value)
273
301
  * @param columnId - Returns the computed style for this specific cell.
302
+ * @param converters - Optional per-column value converters for complex cell types.
274
303
  */
275
- export function evaluateDataGridStyleRules(rules, rowData, columnId) {
276
- const { cellStyles } = computeDataGridRowStyles(rules, rowData);
304
+ export function evaluateDataGridStyleRules(rules, rowData, columnId, converters) {
305
+ const { cellStyles } = computeDataGridRowStyles(rules, rowData, converters);
277
306
  return cellStyles[columnId];
278
307
  }
279
308
  //# sourceMappingURL=evaluate.js.map