@neo4j-ndl/react 4.18.1 → 4.18.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/cjs/_generated/style-rules/index.js +10 -1
- package/lib/cjs/_generated/style-rules/index.js.map +1 -1
- package/lib/cjs/_generated/style-rules/literal-schemas.js +16 -1
- package/lib/cjs/_generated/style-rules/literal-schemas.js.map +1 -1
- package/lib/cjs/_generated/style-rules/numeric-utils.js +163 -0
- package/lib/cjs/_generated/style-rules/numeric-utils.js.map +1 -0
- package/lib/cjs/data-grid/stories/datagrid-rule-based-styling.story.js +40 -1
- package/lib/cjs/data-grid/stories/datagrid-rule-based-styling.story.js.map +1 -1
- package/lib/cjs/data-grid/style-rules/evaluate.js +56 -22
- package/lib/cjs/data-grid/style-rules/evaluate.js.map +1 -1
- package/lib/cjs/data-grid/style-rules/index.js +3 -1
- package/lib/cjs/data-grid/style-rules/index.js.map +1 -1
- package/lib/cjs/data-grid/style-rules/types.js +10 -6
- package/lib/cjs/data-grid/style-rules/types.js.map +1 -1
- package/lib/esm/_generated/style-rules/index.js +2 -1
- package/lib/esm/_generated/style-rules/index.js.map +1 -1
- package/lib/esm/_generated/style-rules/literal-schemas.js +15 -0
- package/lib/esm/_generated/style-rules/literal-schemas.js.map +1 -1
- package/lib/esm/_generated/style-rules/numeric-utils.js +155 -0
- package/lib/esm/_generated/style-rules/numeric-utils.js.map +1 -0
- package/lib/esm/data-grid/stories/datagrid-rule-based-styling.story.js +40 -1
- package/lib/esm/data-grid/stories/datagrid-rule-based-styling.story.js.map +1 -1
- package/lib/esm/data-grid/style-rules/evaluate.js +57 -23
- package/lib/esm/data-grid/style-rules/evaluate.js.map +1 -1
- package/lib/esm/data-grid/style-rules/index.js +1 -1
- package/lib/esm/data-grid/style-rules/index.js.map +1 -1
- package/lib/esm/data-grid/style-rules/types.js +10 -6
- package/lib/esm/data-grid/style-rules/types.js.map +1 -1
- package/lib/types/_generated/style-rules/index.d.ts +4 -2
- package/lib/types/_generated/style-rules/index.d.ts.map +1 -1
- package/lib/types/_generated/style-rules/literal-schemas.d.ts +13 -0
- package/lib/types/_generated/style-rules/literal-schemas.d.ts.map +1 -1
- package/lib/types/_generated/style-rules/numeric-utils.d.ts +45 -0
- package/lib/types/_generated/style-rules/numeric-utils.d.ts.map +1 -0
- package/lib/types/data-grid/stories/datagrid-rule-based-styling.story.d.ts.map +1 -1
- package/lib/types/data-grid/style-rules/evaluate.d.ts.map +1 -1
- package/lib/types/data-grid/style-rules/index.d.ts +2 -2
- package/lib/types/data-grid/style-rules/index.d.ts.map +1 -1
- package/lib/types/data-grid/style-rules/types.d.ts +66 -21
- package/lib/types/data-grid/style-rules/types.d.ts.map +1 -1
- package/package.json +1 -1
- package/skills/ndl-react/components/data-grid.md +48 -3
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
/**
|
|
2
|
+
*
|
|
3
|
+
* Copyright (c) "Neo4j"
|
|
4
|
+
* Neo4j Sweden AB [http://neo4j.com]
|
|
5
|
+
*
|
|
6
|
+
* This file is part of Neo4j.
|
|
7
|
+
*
|
|
8
|
+
* Neo4j is free software: you can redistribute it and/or modify
|
|
9
|
+
* it under the terms of the GNU General Public License as published by
|
|
10
|
+
* the Free Software Foundation, either version 3 of the License, or
|
|
11
|
+
* (at your option) any later version.
|
|
12
|
+
*
|
|
13
|
+
* This program is distributed in the hope that it will be useful,
|
|
14
|
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
15
|
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
16
|
+
* GNU General Public License for more details.
|
|
17
|
+
*
|
|
18
|
+
* You should have received a copy of the GNU General Public License
|
|
19
|
+
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
20
|
+
*/
|
|
21
|
+
import type { BigintLiteral, NumericLiteral } from './literal-schemas';
|
|
22
|
+
export type NumericValue = number | bigint;
|
|
23
|
+
/** Resolves a native or JSON-safe numeric literal without reducing bigints. */
|
|
24
|
+
export declare function resolveNumericLiteral(value: NumericLiteral): NumericValue;
|
|
25
|
+
/** Returns whether a value is the JSON-safe bigint literal shape. */
|
|
26
|
+
export declare function isBigintLiteral(value: unknown): value is BigintLiteral;
|
|
27
|
+
/**
|
|
28
|
+
* Compares numeric values without coercing bigint operands to number.
|
|
29
|
+
* Returns null for NaN, otherwise -1, 0, or 1.
|
|
30
|
+
*/
|
|
31
|
+
export declare function compareNumericValues(left: NumericValue, right: NumericValue): -1 | 0 | 1 | null;
|
|
32
|
+
/** Numeric equality that treats equivalent number and bigint values as equal. */
|
|
33
|
+
export declare function numericValuesEqual(left: NumericValue, right: NumericValue): boolean;
|
|
34
|
+
/**
|
|
35
|
+
* Clamps a numeric value between two endpoints. Inverted endpoints are
|
|
36
|
+
* supported, and the original number/bigint representation is retained.
|
|
37
|
+
*/
|
|
38
|
+
export declare function clampNumericValue(value: NumericValue, firstBound: NumericValue, secondBound: NumericValue): NumericValue | null;
|
|
39
|
+
/**
|
|
40
|
+
* Computes `(value - startValue) / (endValue - startValue)` while retaining
|
|
41
|
+
* bigint precision. Only the final dimensionless interpolation weight is
|
|
42
|
+
* converted to number.
|
|
43
|
+
*/
|
|
44
|
+
export declare function getNumericWeight(startValue: NumericValue, endValue: NumericValue, value: NumericValue): number | null;
|
|
45
|
+
//# sourceMappingURL=numeric-utils.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"numeric-utils.d.ts","sourceRoot":"","sources":["../../../../src/_generated/style-rules/numeric-utils.ts"],"names":[],"mappings":"AAMA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,OAAO,KAAK,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAEvE,MAAM,MAAM,YAAY,GAAG,MAAM,GAAG,MAAM,CAAC;AAgB3C,+EAA+E;AAC/E,wBAAgB,qBAAqB,CAAC,KAAK,EAAE,cAAc,GAAG,YAAY,CAEzE;AAED,qEAAqE;AACrE,wBAAgB,eAAe,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,aAAa,CAQtE;AAED;;;GAGG;AACH,wBAAgB,oBAAoB,CAClC,IAAI,EAAE,YAAY,EAClB,KAAK,EAAE,YAAY,GAClB,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,IAAI,CAcnB;AAED,iFAAiF;AACjF,wBAAgB,kBAAkB,CAChC,IAAI,EAAE,YAAY,EAClB,KAAK,EAAE,YAAY,GAClB,OAAO,CAET;AAED;;;GAGG;AACH,wBAAgB,iBAAiB,CAC/B,KAAK,EAAE,YAAY,EACnB,UAAU,EAAE,YAAY,EACxB,WAAW,EAAE,YAAY,GACxB,YAAY,GAAG,IAAI,CAmBrB;AAuDD;;;;GAIG;AACH,wBAAgB,gBAAgB,CAC9B,UAAU,EAAE,YAAY,EACxB,QAAQ,EAAE,YAAY,EACtB,KAAK,EAAE,YAAY,GAClB,MAAM,GAAG,IAAI,CA2Bf"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"datagrid-rule-based-styling.story.d.ts","sourceRoot":"","sources":["../../../../src/data-grid/stories/datagrid-rule-based-styling.story.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,OAAO,yCAAyC,CAAC;
|
|
1
|
+
{"version":3,"file":"datagrid-rule-based-styling.story.d.ts","sourceRoot":"","sources":["../../../../src/data-grid/stories/datagrid-rule-based-styling.story.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,OAAO,yCAAyC,CAAC;AAiHjD,QAAA,MAAM,SAAS,+CA+Dd,CAAC;AAEF,eAAe,SAAS,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"evaluate.d.ts","sourceRoot":"","sources":["../../../../src/data-grid/style-rules/evaluate.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;
|
|
1
|
+
{"version":3,"file":"evaluate.d.ts","sourceRoot":"","sources":["../../../../src/data-grid/style-rules/evaluate.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAiBH,OAAO,EAKL,KAAK,iBAAiB,EAGtB,KAAK,gCAAgC,EAGtC,MAAM,SAAS,CAAC;AAgZjB,MAAM,MAAM,sBAAsB,GAAG;IACnC,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,KAAK,CAAC,aAAa,GAAG,SAAS,CAAC,CAAC;CAC7D,CAAC;AAKF;;;;;GAKG;AACH,wBAAgB,wBAAwB,CACtC,KAAK,EAAE,iBAAiB,EAAE,EAC1B,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAChC,UAAU,CAAC,EAAE,gCAAgC,GAC5C,sBAAsB,CAsExB;AAED;;;;;;;;GAQG;AACH,wBAAgB,0BAA0B,CACxC,KAAK,EAAE,iBAAiB,EAAE,EAC1B,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAChC,QAAQ,EAAE,MAAM,EAChB,UAAU,CAAC,EAAE,gCAAgC,GAC5C,KAAK,CAAC,aAAa,GAAG,SAAS,CAGjC"}
|
|
@@ -21,6 +21,6 @@
|
|
|
21
21
|
export { evaluateDataGridStyleRules } from './evaluate';
|
|
22
22
|
export { useDataGridCellStyle } from './hooks';
|
|
23
23
|
export { isDataGridStyleRule } from './types';
|
|
24
|
-
export { DataGridCellStyleSchema, DataGridColorRangeSchema, DataGridColumnRefSchema, DataGridDatetimeLiteralSchema, DataGridDisableableColorSchema, DataGridStyleRuleLiteralSchema, DataGridStyleRuleOperandSchema, DataGridStyleRuleSchema, DataGridStyleRuleWhereSchema, DataGridTimeLiteralSchema, DataGridLocalDatetimeLiteralSchema, } from './types';
|
|
25
|
-
export type { DataGridCellStyle, DataGridColorRange, DataGridColumnRef, DataGridDatetimeLiteral, DataGridDisableableColor, DataGridStyleRuleLiteral, DataGridStyleRuleOperand, DataGridStyleRule, DataGridStyleRuleWhere, DataGridStyleRuleValueConverter, DataGridStyleRuleValueConverters, DataGridTimeLiteral, DataGridLocalDatetimeLiteral, } from './types';
|
|
24
|
+
export { DataGridBigintLiteralSchema, DataGridCellStyleSchema, DataGridColorRangeSchema, DataGridColumnRefSchema, DataGridDatetimeLiteralSchema, DataGridDisableableColorSchema, DataGridStyleRuleLiteralSchema, DataGridStyleRuleOperandSchema, DataGridStyleRuleSchema, DataGridStyleRuleWhereSchema, DataGridTimeLiteralSchema, DataGridLocalDatetimeLiteralSchema, DataGridNumericLiteralSchema, } from './types';
|
|
25
|
+
export type { DataGridBigintLiteral, DataGridCellStyle, DataGridColorRange, DataGridColumnRef, DataGridDatetimeLiteral, DataGridDisableableColor, DataGridStyleRuleLiteral, DataGridStyleRuleOperand, DataGridStyleRule, DataGridStyleRuleWhere, DataGridStyleRuleValueConverter, DataGridStyleRuleValueConverters, DataGridTimeLiteral, DataGridLocalDatetimeLiteral, DataGridNumericLiteral, } from './types';
|
|
26
26
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/data-grid/style-rules/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,OAAO,EAAE,0BAA0B,EAAE,MAAM,YAAY,CAAC;AACxD,OAAO,EAAE,oBAAoB,EAAE,MAAM,SAAS,CAAC;AAC/C,OAAO,EAAE,mBAAmB,EAAE,MAAM,SAAS,CAAC;AAE9C,OAAO,EACL,uBAAuB,EACvB,wBAAwB,EACxB,uBAAuB,EACvB,6BAA6B,EAC7B,8BAA8B,EAC9B,8BAA8B,EAC9B,8BAA8B,EAC9B,uBAAuB,EACvB,4BAA4B,EAC5B,yBAAyB,EACzB,kCAAkC,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/data-grid/style-rules/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,OAAO,EAAE,0BAA0B,EAAE,MAAM,YAAY,CAAC;AACxD,OAAO,EAAE,oBAAoB,EAAE,MAAM,SAAS,CAAC;AAC/C,OAAO,EAAE,mBAAmB,EAAE,MAAM,SAAS,CAAC;AAE9C,OAAO,EACL,2BAA2B,EAC3B,uBAAuB,EACvB,wBAAwB,EACxB,uBAAuB,EACvB,6BAA6B,EAC7B,8BAA8B,EAC9B,8BAA8B,EAC9B,8BAA8B,EAC9B,uBAAuB,EACvB,4BAA4B,EAC5B,yBAAyB,EACzB,kCAAkC,EAClC,4BAA4B,GAC7B,MAAM,SAAS,CAAC;AACjB,YAAY,EACV,qBAAqB,EACrB,iBAAiB,EACjB,kBAAkB,EAClB,iBAAiB,EACjB,uBAAuB,EACvB,wBAAwB,EACxB,wBAAwB,EACxB,wBAAwB,EACxB,iBAAiB,EACjB,sBAAsB,EACtB,+BAA+B,EAC/B,gCAAgC,EAChC,mBAAmB,EACnB,4BAA4B,EAC5B,sBAAsB,GACvB,MAAM,SAAS,CAAC"}
|
|
@@ -19,9 +19,21 @@
|
|
|
19
19
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
20
20
|
*/
|
|
21
21
|
import { z } from 'zod';
|
|
22
|
-
/** A
|
|
23
|
-
export declare const DataGridStyleRuleLiteralSchema: z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.
|
|
22
|
+
/** A literal that can appear as an operand in a style-rule where clause. */
|
|
23
|
+
export declare const DataGridStyleRuleLiteralSchema: z.ZodUnion<readonly [z.ZodString, z.ZodUnion<readonly [z.ZodNumber, z.ZodBigInt, z.ZodObject<{
|
|
24
|
+
bigint: z.ZodString;
|
|
25
|
+
}, z.core.$strip>]>, z.ZodBoolean, z.ZodNull]>;
|
|
24
26
|
export type DataGridStyleRuleLiteral = z.infer<typeof DataGridStyleRuleLiteralSchema>;
|
|
27
|
+
/** A JSON-safe bigint literal represented by a signed decimal string. */
|
|
28
|
+
export declare const DataGridBigintLiteralSchema: z.ZodObject<{
|
|
29
|
+
bigint: z.ZodString;
|
|
30
|
+
}, z.core.$strip>;
|
|
31
|
+
export type DataGridBigintLiteral = z.infer<typeof DataGridBigintLiteralSchema>;
|
|
32
|
+
/** A number, native bigint, or JSON-safe bigint literal. */
|
|
33
|
+
export declare const DataGridNumericLiteralSchema: z.ZodUnion<readonly [z.ZodNumber, z.ZodBigInt, z.ZodObject<{
|
|
34
|
+
bigint: z.ZodString;
|
|
35
|
+
}, z.core.$strip>]>;
|
|
36
|
+
export type DataGridNumericLiteral = z.infer<typeof DataGridNumericLiteralSchema>;
|
|
25
37
|
/** A reference to a column whose cell value is resolved at evaluation time. */
|
|
26
38
|
export declare const DataGridColumnRefSchema: z.ZodObject<{
|
|
27
39
|
column: z.ZodString;
|
|
@@ -79,7 +91,9 @@ export declare const DataGridStyleRuleOperandSchema: z.ZodUnion<readonly [z.ZodO
|
|
|
79
91
|
localdatetime: z.ZodString;
|
|
80
92
|
}, z.core.$strip>, z.ZodObject<{
|
|
81
93
|
time: z.ZodString;
|
|
82
|
-
}, z.core.$strip>, z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.
|
|
94
|
+
}, z.core.$strip>, z.ZodUnion<readonly [z.ZodString, z.ZodUnion<readonly [z.ZodNumber, z.ZodBigInt, z.ZodObject<{
|
|
95
|
+
bigint: z.ZodString;
|
|
96
|
+
}, z.core.$strip>]>, z.ZodBoolean, z.ZodNull]>]>;
|
|
83
97
|
export type DataGridStyleRuleOperand = DataGridColumnRef | DataGridDatetimeLiteral | DataGridLocalDatetimeLiteral | DataGridTimeLiteral | DataGridStyleRuleLiteral;
|
|
84
98
|
/**
|
|
85
99
|
* Recursive WHERE clause for conditional expressions.
|
|
@@ -122,11 +136,17 @@ export declare const DataGridStyleRuleWhereSchema: z.ZodType<DataGridStyleRuleWh
|
|
|
122
136
|
export declare const DataGridColorRangeSchema: z.ZodObject<{
|
|
123
137
|
isDisabled: z.ZodOptional<z.ZodBoolean>;
|
|
124
138
|
maxColor: z.ZodString;
|
|
125
|
-
maxValue: z.ZodNumber
|
|
139
|
+
maxValue: z.ZodUnion<readonly [z.ZodNumber, z.ZodBigInt, z.ZodObject<{
|
|
140
|
+
bigint: z.ZodString;
|
|
141
|
+
}, z.core.$strip>]>;
|
|
126
142
|
midColor: z.ZodOptional<z.ZodString>;
|
|
127
|
-
midValue: z.ZodOptional<z.ZodNumber
|
|
143
|
+
midValue: z.ZodOptional<z.ZodUnion<readonly [z.ZodNumber, z.ZodBigInt, z.ZodObject<{
|
|
144
|
+
bigint: z.ZodString;
|
|
145
|
+
}, z.core.$strip>]>>;
|
|
128
146
|
minColor: z.ZodString;
|
|
129
|
-
minValue: z.ZodNumber
|
|
147
|
+
minValue: z.ZodUnion<readonly [z.ZodNumber, z.ZodBigInt, z.ZodObject<{
|
|
148
|
+
bigint: z.ZodString;
|
|
149
|
+
}, z.core.$strip>]>;
|
|
130
150
|
onColumn: z.ZodString;
|
|
131
151
|
}, z.core.$strip>;
|
|
132
152
|
export type DataGridColorRange = z.infer<typeof DataGridColorRangeSchema>;
|
|
@@ -145,11 +165,17 @@ export declare const DataGridCellStyleSchema: z.ZodObject<{
|
|
|
145
165
|
colorRange: z.ZodOptional<z.ZodObject<{
|
|
146
166
|
isDisabled: z.ZodOptional<z.ZodBoolean>;
|
|
147
167
|
maxColor: z.ZodString;
|
|
148
|
-
maxValue: z.ZodNumber
|
|
168
|
+
maxValue: z.ZodUnion<readonly [z.ZodNumber, z.ZodBigInt, z.ZodObject<{
|
|
169
|
+
bigint: z.ZodString;
|
|
170
|
+
}, z.core.$strip>]>;
|
|
149
171
|
midColor: z.ZodOptional<z.ZodString>;
|
|
150
|
-
midValue: z.ZodOptional<z.ZodNumber
|
|
172
|
+
midValue: z.ZodOptional<z.ZodUnion<readonly [z.ZodNumber, z.ZodBigInt, z.ZodObject<{
|
|
173
|
+
bigint: z.ZodString;
|
|
174
|
+
}, z.core.$strip>]>>;
|
|
151
175
|
minColor: z.ZodString;
|
|
152
|
-
minValue: z.ZodNumber
|
|
176
|
+
minValue: z.ZodUnion<readonly [z.ZodNumber, z.ZodBigInt, z.ZodObject<{
|
|
177
|
+
bigint: z.ZodString;
|
|
178
|
+
}, z.core.$strip>]>;
|
|
153
179
|
onColumn: z.ZodString;
|
|
154
180
|
}, z.core.$strip>>;
|
|
155
181
|
textColor: z.ZodOptional<z.ZodObject<{
|
|
@@ -159,11 +185,17 @@ export declare const DataGridCellStyleSchema: z.ZodObject<{
|
|
|
159
185
|
textColorRange: z.ZodOptional<z.ZodObject<{
|
|
160
186
|
isDisabled: z.ZodOptional<z.ZodBoolean>;
|
|
161
187
|
maxColor: z.ZodString;
|
|
162
|
-
maxValue: z.ZodNumber
|
|
188
|
+
maxValue: z.ZodUnion<readonly [z.ZodNumber, z.ZodBigInt, z.ZodObject<{
|
|
189
|
+
bigint: z.ZodString;
|
|
190
|
+
}, z.core.$strip>]>;
|
|
163
191
|
midColor: z.ZodOptional<z.ZodString>;
|
|
164
|
-
midValue: z.ZodOptional<z.ZodNumber
|
|
192
|
+
midValue: z.ZodOptional<z.ZodUnion<readonly [z.ZodNumber, z.ZodBigInt, z.ZodObject<{
|
|
193
|
+
bigint: z.ZodString;
|
|
194
|
+
}, z.core.$strip>]>>;
|
|
165
195
|
minColor: z.ZodString;
|
|
166
|
-
minValue: z.ZodNumber
|
|
196
|
+
minValue: z.ZodUnion<readonly [z.ZodNumber, z.ZodBigInt, z.ZodObject<{
|
|
197
|
+
bigint: z.ZodString;
|
|
198
|
+
}, z.core.$strip>]>;
|
|
167
199
|
onColumn: z.ZodString;
|
|
168
200
|
}, z.core.$strip>>;
|
|
169
201
|
}, z.core.$strip>;
|
|
@@ -174,13 +206,14 @@ export type DataGridCellStyle = z.infer<typeof DataGridCellStyleSchema>;
|
|
|
174
206
|
* and color-range interpolation.
|
|
175
207
|
*
|
|
176
208
|
* The function receives the raw cell value (`unknown`) and must return a scalar
|
|
177
|
-
* (`string | number | boolean | null`). Return
|
|
178
|
-
* is missing or cannot be
|
|
209
|
+
* (`string | number | bigint | { bigint: string } | boolean | null`). Return
|
|
210
|
+
* `null` or `undefined` to signal that the value is missing or cannot be
|
|
211
|
+
* represented.
|
|
179
212
|
*
|
|
180
213
|
* Note: converter functions are TypeScript-only — they cannot be serialized as
|
|
181
214
|
* JSON, so no Zod schema is provided.
|
|
182
215
|
*/
|
|
183
|
-
export type DataGridStyleRuleValueConverter = (value: unknown) => DataGridStyleRuleLiteral;
|
|
216
|
+
export type DataGridStyleRuleValueConverter = (value: unknown) => DataGridStyleRuleLiteral | undefined;
|
|
184
217
|
/**
|
|
185
218
|
* A map of column id → converter function.
|
|
186
219
|
* Pass this as the `styleRuleValueConverters` prop on `DataGrid` to teach the
|
|
@@ -207,11 +240,17 @@ export declare const DataGridStyleRuleSchema: z.ZodObject<{
|
|
|
207
240
|
colorRange: z.ZodOptional<z.ZodObject<{
|
|
208
241
|
isDisabled: z.ZodOptional<z.ZodBoolean>;
|
|
209
242
|
maxColor: z.ZodString;
|
|
210
|
-
maxValue: z.ZodNumber
|
|
243
|
+
maxValue: z.ZodUnion<readonly [z.ZodNumber, z.ZodBigInt, z.ZodObject<{
|
|
244
|
+
bigint: z.ZodString;
|
|
245
|
+
}, z.core.$strip>]>;
|
|
211
246
|
midColor: z.ZodOptional<z.ZodString>;
|
|
212
|
-
midValue: z.ZodOptional<z.ZodNumber
|
|
247
|
+
midValue: z.ZodOptional<z.ZodUnion<readonly [z.ZodNumber, z.ZodBigInt, z.ZodObject<{
|
|
248
|
+
bigint: z.ZodString;
|
|
249
|
+
}, z.core.$strip>]>>;
|
|
213
250
|
minColor: z.ZodString;
|
|
214
|
-
minValue: z.ZodNumber
|
|
251
|
+
minValue: z.ZodUnion<readonly [z.ZodNumber, z.ZodBigInt, z.ZodObject<{
|
|
252
|
+
bigint: z.ZodString;
|
|
253
|
+
}, z.core.$strip>]>;
|
|
215
254
|
onColumn: z.ZodString;
|
|
216
255
|
}, z.core.$strip>>;
|
|
217
256
|
textColor: z.ZodOptional<z.ZodObject<{
|
|
@@ -221,11 +260,17 @@ export declare const DataGridStyleRuleSchema: z.ZodObject<{
|
|
|
221
260
|
textColorRange: z.ZodOptional<z.ZodObject<{
|
|
222
261
|
isDisabled: z.ZodOptional<z.ZodBoolean>;
|
|
223
262
|
maxColor: z.ZodString;
|
|
224
|
-
maxValue: z.ZodNumber
|
|
263
|
+
maxValue: z.ZodUnion<readonly [z.ZodNumber, z.ZodBigInt, z.ZodObject<{
|
|
264
|
+
bigint: z.ZodString;
|
|
265
|
+
}, z.core.$strip>]>;
|
|
225
266
|
midColor: z.ZodOptional<z.ZodString>;
|
|
226
|
-
midValue: z.ZodOptional<z.ZodNumber
|
|
267
|
+
midValue: z.ZodOptional<z.ZodUnion<readonly [z.ZodNumber, z.ZodBigInt, z.ZodObject<{
|
|
268
|
+
bigint: z.ZodString;
|
|
269
|
+
}, z.core.$strip>]>>;
|
|
227
270
|
minColor: z.ZodString;
|
|
228
|
-
minValue: z.ZodNumber
|
|
271
|
+
minValue: z.ZodUnion<readonly [z.ZodNumber, z.ZodBigInt, z.ZodObject<{
|
|
272
|
+
bigint: z.ZodString;
|
|
273
|
+
}, z.core.$strip>]>;
|
|
229
274
|
onColumn: z.ZodString;
|
|
230
275
|
}, z.core.$strip>>;
|
|
231
276
|
}, z.core.$strip>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/data-grid/style-rules/types.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/data-grid/style-rules/types.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAexB,4EAA4E;AAC5E,eAA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AM,MAAM,iBAAiB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,uBAAuB,CAAC,CAAC;AAQxE;;;;;;;;;;;;GAYG;AACH,MAAM,MAAM,+BAA+B,GAAG,CAC5C,KAAK,EAAE,OAAO,KACX,wBAAwB,GAAG,SAAS,CAAC;AAE1C;;;;;;;;;;;;;;GAcG;AACH,MAAM,MAAM,gCAAgC,GAAG,MAAM,CACnD,MAAM,EACN,+BAA+B,CAChC,CAAC;AAEF,qFAAqF;AACrF,eAAO,MAAM,uBAAuB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAalC,CAAC;AACH,MAAM,MAAM,iBAAiB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,uBAAuB,CAAC,CAAC;AAExE;;;;;;;;;;;;;;;;;;;GAmBG;AACH,eAAO,MAAM,mBAAmB,GAC9B,OAAO,OAAO,KACb,KAAK,IAAI,iBACsC,CAAC"}
|
package/package.json
CHANGED
|
@@ -18,7 +18,7 @@ Import: `import { DataGrid } from '@neo4j-ndl/react'`
|
|
|
18
18
|
| `ref` | `Ref<HTMLDivElement>` | | | A ref to apply to the root element. |
|
|
19
19
|
| `rootProps` | `HtmlAttributes<"div">` | | | @deprecated Use htmlAttributes, className and style on the root element instead |
|
|
20
20
|
| `skeletonProps` | `(SkeletonProps & { as?: ElementType<any, keyof IntrinsicElements>; } & BaseProps<ElementType<any, keyof IntrinsicElements>>)` | | | |
|
|
21
|
-
| `styleRules` | `{ apply: { color?: { value: string; isDisabled?: boolean; }; colorRange?: { maxColor: string; maxValue: number; minColor: string; minValue: number; onColumn: string; isDisabled?: boolean \| undefined; midColor?: string \| undefined;
|
|
21
|
+
| `styleRules` | `{ apply: { color?: { value: string; isDisabled?: boolean; }; colorRange?: { maxColor: string; maxValue: number \| bigint \| { bigint: string; }; minColor: string; minValue: number \| ... 1 more ... \| { ...; }; onColumn: string; isDisabled?: boolean \| undefined; midColor?: string \| undefined; mid...` | | | Rule-based conditional styling for cells and rows. |
|
|
22
22
|
| `styleRuleValueConverters` | `DataGridStyleRuleValueConverters` | | | Per-column converters that teach the style-rule engine how to interpret complex cell values. |
|
|
23
23
|
| `styling` | `Partial<{ hasZebraStriping: boolean; borderStyle: "all-sides" \| "horizontal" \| "vertical" \| "none"; headerStyle: "filled" \| "clean"; hasHoverEffects: boolean; isCompact: boolean; }>` | | `{}` | |
|
|
24
24
|
| `tableInstance` | `Table<T>` | ✅ | | Table instance created from `useTable` |
|
|
@@ -1708,6 +1708,14 @@ import {
|
|
|
1708
1708
|
import { type DataGridStyleRule } from '../style-rules/types';
|
|
1709
1709
|
import { TABLE_DEMO_DATA, type TestDataFormat } from './staticData';
|
|
1710
1710
|
|
|
1711
|
+
type BigintTestDataFormat = TestDataFormat & { preciseId: bigint };
|
|
1712
|
+
|
|
1713
|
+
const BIGINT_ID_START = BigInt('9007199254740993');
|
|
1714
|
+
const tableData: BigintTestDataFormat[] = TABLE_DEMO_DATA.map((row, index) => ({
|
|
1715
|
+
...row,
|
|
1716
|
+
preciseId: BIGINT_ID_START + BigInt(index),
|
|
1717
|
+
}));
|
|
1718
|
+
|
|
1711
1719
|
const styleRules: DataGridStyleRule[] = [
|
|
1712
1720
|
// Row coloring: all cells styled when name contains "Alicia"
|
|
1713
1721
|
{
|
|
@@ -1766,10 +1774,41 @@ const styleRules: DataGridStyleRule[] = [
|
|
|
1766
1774
|
],
|
|
1767
1775
|
},
|
|
1768
1776
|
},
|
|
1777
|
+
// Bigint range: adjacent values above Number.MAX_SAFE_INTEGER retain their
|
|
1778
|
+
// precision. Wrapped literals are JSON-safe; BigInt(...) is programmatic.
|
|
1779
|
+
{
|
|
1780
|
+
apply: {
|
|
1781
|
+
colorRange: {
|
|
1782
|
+
maxColor: '#7c3aed',
|
|
1783
|
+
maxValue: BIGINT_ID_START + BigInt(tableData.length - 1),
|
|
1784
|
+
minColor: '#ede9fe',
|
|
1785
|
+
minValue: { bigint: BIGINT_ID_START.toString() },
|
|
1786
|
+
onColumn: 'preciseId',
|
|
1787
|
+
},
|
|
1788
|
+
textColor: { value: '#111827' },
|
|
1789
|
+
},
|
|
1790
|
+
column: 'preciseId',
|
|
1791
|
+
priority: 1,
|
|
1792
|
+
},
|
|
1793
|
+
// Exact bigint comparison using the JSON-safe literal form.
|
|
1794
|
+
{
|
|
1795
|
+
apply: {
|
|
1796
|
+
color: { value: '#4c1d95' },
|
|
1797
|
+
textColor: { value: '#ffffff' },
|
|
1798
|
+
},
|
|
1799
|
+
column: 'preciseId',
|
|
1800
|
+
priority: 2,
|
|
1801
|
+
where: {
|
|
1802
|
+
equal: [
|
|
1803
|
+
{ column: 'preciseId' },
|
|
1804
|
+
{ bigint: (BIGINT_ID_START + BigInt(2)).toString() },
|
|
1805
|
+
],
|
|
1806
|
+
},
|
|
1807
|
+
},
|
|
1769
1808
|
];
|
|
1770
1809
|
|
|
1771
1810
|
const Component = () => {
|
|
1772
|
-
const columnHelper = createColumnHelper<
|
|
1811
|
+
const columnHelper = createColumnHelper<BigintTestDataFormat>();
|
|
1773
1812
|
|
|
1774
1813
|
const columns = [
|
|
1775
1814
|
columnHelper.accessor('name', {
|
|
@@ -1783,6 +1822,12 @@ const Component = () => {
|
|
|
1783
1822
|
header: () => 'Age',
|
|
1784
1823
|
minSize: 80,
|
|
1785
1824
|
}),
|
|
1825
|
+
columnHelper.accessor('preciseId', {
|
|
1826
|
+
cell: (info) => info.getValue().toString(),
|
|
1827
|
+
header: () => 'Bigint ID',
|
|
1828
|
+
minSize: 180,
|
|
1829
|
+
size: 180,
|
|
1830
|
+
}),
|
|
1786
1831
|
columnHelper.accessor('cypherCommand', {
|
|
1787
1832
|
cell: (info) => info.getValue(),
|
|
1788
1833
|
header: () => 'Cypher Command',
|
|
@@ -1794,7 +1839,7 @@ const Component = () => {
|
|
|
1794
1839
|
const table = useReactTable({
|
|
1795
1840
|
columnResizeMode: 'onChange',
|
|
1796
1841
|
columns,
|
|
1797
|
-
data:
|
|
1842
|
+
data: tableData,
|
|
1798
1843
|
defaultColumn: {
|
|
1799
1844
|
maxSize: 800,
|
|
1800
1845
|
minSize: 80,
|