@neo4j-ndl/react 4.16.5 → 4.16.6
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/date-utils.js +55 -0
- package/lib/cjs/_generated/style-rules/date-utils.js.map +1 -1
- package/lib/cjs/_generated/style-rules/index.js +3 -1
- package/lib/cjs/_generated/style-rules/index.js.map +1 -1
- package/lib/cjs/_generated/style-rules/literal-schemas.js +19 -1
- package/lib/cjs/_generated/style-rules/literal-schemas.js.map +1 -1
- package/lib/cjs/data-grid/stories/datagrid-rule-based-styling-datetime.story.js +9 -9
- package/lib/cjs/data-grid/stories/datagrid-rule-based-styling-datetime.story.js.map +1 -1
- package/lib/cjs/data-grid/style-rules/evaluate.js +3 -0
- package/lib/cjs/data-grid/style-rules/evaluate.js.map +1 -1
- package/lib/cjs/data-grid/style-rules/types.js +16 -2
- package/lib/cjs/data-grid/style-rules/types.js.map +1 -1
- package/lib/esm/_generated/style-rules/date-utils.js +54 -0
- package/lib/esm/_generated/style-rules/date-utils.js.map +1 -1
- package/lib/esm/_generated/style-rules/index.js +2 -2
- package/lib/esm/_generated/style-rules/index.js.map +1 -1
- package/lib/esm/_generated/style-rules/literal-schemas.js +19 -1
- package/lib/esm/_generated/style-rules/literal-schemas.js.map +1 -1
- package/lib/esm/data-grid/stories/datagrid-rule-based-styling-datetime.story.js +9 -9
- package/lib/esm/data-grid/stories/datagrid-rule-based-styling-datetime.story.js.map +1 -1
- package/lib/esm/data-grid/style-rules/evaluate.js +4 -1
- package/lib/esm/data-grid/style-rules/evaluate.js.map +1 -1
- package/lib/esm/data-grid/style-rules/types.js +16 -2
- package/lib/esm/data-grid/style-rules/types.js.map +1 -1
- package/lib/types/_generated/style-rules/date-utils.d.ts +20 -0
- package/lib/types/_generated/style-rules/date-utils.d.ts.map +1 -1
- package/lib/types/_generated/style-rules/index.d.ts +3 -3
- package/lib/types/_generated/style-rules/index.d.ts.map +1 -1
- package/lib/types/_generated/style-rules/literal-schemas.d.ts +17 -0
- package/lib/types/_generated/style-rules/literal-schemas.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/types.d.ts +20 -2
- package/lib/types/data-grid/style-rules/types.d.ts.map +1 -1
- package/package.json +1 -1
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
20
20
|
*/
|
|
21
21
|
import { z } from 'zod';
|
|
22
|
-
import { DatetimeLiteralSchema, TimeLiteralSchema, } from '../../_generated/style-rules';
|
|
22
|
+
import { DatetimeLiteralSchema, LocalDatetimeLiteralSchema, TimeLiteralSchema, } from '../../_generated/style-rules';
|
|
23
23
|
/*
|
|
24
24
|
* Style types defined in Zod, so that we can use the schemas to generate JSON Schema.
|
|
25
25
|
* This is useful for generating documentation, importing and for future integration into editors.
|
|
@@ -46,6 +46,19 @@ export const DataGridColumnRefSchema = z.object({ column: z.string() });
|
|
|
46
46
|
* Unzoned datetimes without `Z` or an offset are treated as UTC wall-clock time.
|
|
47
47
|
*/
|
|
48
48
|
export const DataGridDatetimeLiteralSchema = DatetimeLiteralSchema;
|
|
49
|
+
/**
|
|
50
|
+
* A plain (unzoned) ISO 8601 date or datetime literal that resolves to a Unix
|
|
51
|
+
* millisecond timestamp in the browser's local timezone at evaluation time.
|
|
52
|
+
* Wraps the shared `LocalDatetimeLiteralSchema` with a DataGrid-specific name.
|
|
53
|
+
*
|
|
54
|
+
* Only plain date/datetime strings without timezone qualifiers are accepted:
|
|
55
|
+
* - Plain datetime: `"2024-01-01T14:30:00"`
|
|
56
|
+
* - Date-only (treated as local midnight): `"2024-01-01"`
|
|
57
|
+
*
|
|
58
|
+
* Strings with `Z`, a UTC offset, or an IANA bracket are rejected — use
|
|
59
|
+
* `{ datetime }` for timezone-aware instants.
|
|
60
|
+
*/
|
|
61
|
+
export const DataGridLocalDatetimeLiteralSchema = LocalDatetimeLiteralSchema;
|
|
49
62
|
/**
|
|
50
63
|
* An ISO 8601 time literal that resolves to milliseconds since UTC midnight at
|
|
51
64
|
* evaluation time. Wraps the shared `TimeLiteralSchema` with a DataGrid-specific
|
|
@@ -54,10 +67,11 @@ export const DataGridDatetimeLiteralSchema = DatetimeLiteralSchema;
|
|
|
54
67
|
* - Offset time (UTC-normalised): `"14:30:00+02:00"`
|
|
55
68
|
*/
|
|
56
69
|
export const DataGridTimeLiteralSchema = TimeLiteralSchema;
|
|
57
|
-
/** An operand in a style-rule where clause -- either a literal value, a datetime literal, a time literal, or a column reference. */
|
|
70
|
+
/** An operand in a style-rule where clause -- either a literal value, a datetime literal, a localdatetime literal, a time literal, or a column reference. */
|
|
58
71
|
export const DataGridStyleRuleOperandSchema = z.union([
|
|
59
72
|
DataGridColumnRefSchema,
|
|
60
73
|
DataGridDatetimeLiteralSchema,
|
|
74
|
+
DataGridLocalDatetimeLiteralSchema,
|
|
61
75
|
DataGridTimeLiteralSchema,
|
|
62
76
|
DataGridStyleRuleLiteralSchema,
|
|
63
77
|
]);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../src/data-grid/style-rules/types.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EACL,qBAAqB,EACrB,iBAAiB,GAClB,MAAM,8BAA8B,CAAC;AAEtC;;;GAGG;AAEH,mFAAmF;AACnF,MAAM,CAAC,MAAM,8BAA8B,GAAG,CAAC,CAAC,KAAK,CAAC;IACpD,CAAC,CAAC,MAAM,EAAE;IACV,CAAC,CAAC,MAAM,EAAE;IACV,CAAC,CAAC,OAAO,EAAE;IACX,CAAC,CAAC,IAAI,EAAE;CACT,CAAC,CAAC;AAKH,+EAA+E;AAC/E,MAAM,CAAC,MAAM,uBAAuB,GAAG,CAAC,CAAC,MAAM,CAAC,EAAE,M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CAAC,MAAM,mBAAmB,GAAG,CACjC,KAAc,EACc,EAAE,CAC9B,uBAAuB,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC,OAAO,CAAC","sourcesContent":["/**\n *\n * Copyright (c) \"Neo4j\"\n * Neo4j Sweden AB [http://neo4j.com]\n *\n * This file is part of Neo4j.\n *\n * Neo4j is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with this program. If not, see <http://www.gnu.org/licenses/>.\n */\n\nimport { z } from 'zod';\n\nimport {\n 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\n/**\n * Runtime type guard for {@link DataGridStyleRule}, backed by the internal Zod\n * schema. Narrows an `unknown` value to `DataGridStyleRule` when it is a valid\n * style rule.\n *\n * This lets consumers validate values without taking a dependency on Zod or on\n * our schema export. For example, it can be passed to another validation\n * library's custom check:\n *\n * @example\n * ```ts\n * import { z } from 'zod';\n * import { isDataGridStyleRule, type DataGridStyleRule } from '@neo4j-ndl/react';\n *\n * const formSchema = z.object({\n * rule: z.custom<DataGridStyleRule>(isDataGridStyleRule),\n * notes: z.string(),\n * });\n * ```\n */\nexport const isDataGridStyleRule = (\n value: unknown,\n): value is DataGridStyleRule =>\n DataGridStyleRuleSchema.safeParse(value).success;\n"]}
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../src/data-grid/style-rules/types.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EACL,qBAAqB,EACrB,0BAA0B,EAC1B,iBAAiB,GAClB,MAAM,8BAA8B,CAAC;AAEtC;;;GAGG;AAEH,mFAAmF;AACnF,MAAM,CAAC,MAAM,8BAA8B,GAAG,CAAC,CAAC,KAAK,CAAC;IACpD,CAAC,CAAC,MAAM,EAAE;IACV,CAAC,CAAC,MAAM,EAAE;IACV,CAAC,CAAC,OAAO,EAAE;IACX,CAAC,CAAC,IAAI,EAAE;CACT,CAAC,CAAC;AAKH,+EAA+E;AAC/E,MAAM,CAAC,MAAM,uBAAuB,GAAG,CAAC,CAAC,MAAM,CAAC,EAAE,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC;AAGxE;;;;;;;;;;;GAWG;AACH,MAAM,CAAC,MAAM,6BAA6B,GAAG,qBAAqB,CAAC;AAKnE;;;;;;;;;;;GAWG;AACH,MAAM,CAAC,MAAM,kCAAkC,GAAG,0BAA0B,CAAC;AAK7E;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,yBAAyB,GAAG,iBAAiB,CAAC;AAG3D,6JAA6J;AAC7J,MAAM,CAAC,MAAM,8BAA8B,GAAG,CAAC,CAAC,KAAK,CAAC;IACpD,uBAAuB;IACvB,6BAA6B;IAC7B,kCAAkC;IAClC,yBAAyB;IACzB,8BAA8B;CAC/B,CAAC,CAAC;AA6BH,MAAM,CAAC,MAAM,4BAA4B,GACvC,CAAC,CAAC,IAAI,CAAC,GAAG,EAAE,CACV,CAAC,CAAC,KAAK,CAAC;IACN,CAAC,CAAC,MAAM,CAAC,EAAE,GAAG,EAAE,4BAA4B,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AQ,EAAE;CACpD,CAAC,CAAC;AAGH;;;GAGG;AACH,MAAM,cAAc,GAAG,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC,OAAO,EAAE,CAAC,CAAC;AAsCzD,qFAAqF;AACrF,MAAM,CAAC,MAAM,uBAAuB,GAAG,CAAC,CAAC,MAAM,CAAC;IAC9C,uDAAuD;IACvD,KAAK,EAAE,uBAAuB;IAC9B,qGAAqG;IACrG,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IAC7B,6CAA6C;IAC7C,UAAU,EAAE,CAAC,CAAC,OAAO,EAAE,CAAC,QAAQ,EAAE;IAClC,0CAA0C;IAC1C,QAAQ,EAAE,cAAc,CAAC,QAAQ,EAAE;IACnC,oPAAoP;IACpP,QAAQ,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,WAAW,EAAE,CAAC,QAAQ,EAAE;IAC7C,mFAAmF;IACnF,KAAK,EAAE,4BAA4B,CAAC,QAAQ,EAAE;CAC/C,CAAC,CAAC;AAGH;;;;;;;;;;;;;;;;;;;GAmBG;AACH,MAAM,CAAC,MAAM,mBAAmB,GAAG,CACjC,KAAc,EACc,EAAE,CAC9B,uBAAuB,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC,OAAO,CAAC","sourcesContent":["/**\n *\n * Copyright (c) \"Neo4j\"\n * Neo4j Sweden AB [http://neo4j.com]\n *\n * This file is part of Neo4j.\n *\n * Neo4j is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with this program. If not, see <http://www.gnu.org/licenses/>.\n */\n\nimport { z } from 'zod';\n\nimport {\n DatetimeLiteralSchema,\n LocalDatetimeLiteralSchema,\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 * A plain (unzoned) ISO 8601 date or datetime literal that resolves to a Unix\n * millisecond timestamp in the browser's local timezone at evaluation time.\n * Wraps the shared `LocalDatetimeLiteralSchema` with a DataGrid-specific name.\n *\n * Only plain date/datetime strings without timezone qualifiers are accepted:\n * - Plain datetime: `\"2024-01-01T14:30:00\"`\n * - Date-only (treated as local midnight): `\"2024-01-01\"`\n *\n * Strings with `Z`, a UTC offset, or an IANA bracket are rejected — use\n * `{ datetime }` for timezone-aware instants.\n */\nexport const DataGridLocalDatetimeLiteralSchema = LocalDatetimeLiteralSchema;\nexport type DataGridLocalDatetimeLiteral = z.infer<\n typeof DataGridLocalDatetimeLiteralSchema\n>;\n\n/**\n * An ISO 8601 time literal that resolves to milliseconds since UTC midnight at\n * evaluation time. Wraps the shared `TimeLiteralSchema` with a DataGrid-specific\n * name. Supported formats:\n * - Local time (treated as UTC): `\"14:30:00\"`, `\"14:30:00.500\"`\n * - Offset time (UTC-normalised): `\"14:30:00+02:00\"`\n */\nexport const DataGridTimeLiteralSchema = TimeLiteralSchema;\nexport type DataGridTimeLiteral = z.infer<typeof DataGridTimeLiteralSchema>;\n\n/** An operand in a style-rule where clause -- either a literal value, a datetime literal, a localdatetime literal, a time literal, or a column reference. */\nexport const DataGridStyleRuleOperandSchema = z.union([\n DataGridColumnRefSchema,\n DataGridDatetimeLiteralSchema,\n DataGridLocalDatetimeLiteralSchema,\n DataGridTimeLiteralSchema,\n DataGridStyleRuleLiteralSchema,\n]);\nexport type DataGridStyleRuleOperand =\n | DataGridColumnRef\n | DataGridDatetimeLiteral\n | DataGridLocalDatetimeLiteral\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\n/**\n * Runtime type guard for {@link DataGridStyleRule}, backed by the internal Zod\n * schema. Narrows an `unknown` value to `DataGridStyleRule` when it is a valid\n * style rule.\n *\n * This lets consumers validate values without taking a dependency on Zod or on\n * our schema export. For example, it can be passed to another validation\n * library's custom check:\n *\n * @example\n * ```ts\n * import { z } from 'zod';\n * import { isDataGridStyleRule, type DataGridStyleRule } from '@neo4j-ndl/react';\n *\n * const formSchema = z.object({\n * rule: z.custom<DataGridStyleRule>(isDataGridStyleRule),\n * notes: z.string(),\n * });\n * ```\n */\nexport const isDataGridStyleRule = (\n value: unknown,\n): value is DataGridStyleRule =>\n DataGridStyleRuleSchema.safeParse(value).success;\n"]}
|
|
@@ -51,4 +51,24 @@ export declare function parseTimeString(s: string): number | null;
|
|
|
51
51
|
* parsed as UTC wall-clock time (same semantics as Neo4j `LocalDateTime`).
|
|
52
52
|
*/
|
|
53
53
|
export declare function parseDateString(s: string): number | null;
|
|
54
|
+
/**
|
|
55
|
+
* Parses a plain (unzoned) ISO 8601 date or datetime string to a Unix
|
|
56
|
+
* millisecond timestamp, interpreting the wall-clock time in the given
|
|
57
|
+
* `timeZone` (defaults to the browser's local timezone via
|
|
58
|
+
* `Temporal.Now.timeZoneId()`). Returns `null` if the string cannot be
|
|
59
|
+
* parsed or contains any timezone qualifier.
|
|
60
|
+
*
|
|
61
|
+
* Only plain date/datetime strings are accepted — strings with `Z`, a
|
|
62
|
+
* fixed UTC offset (`+02:00`), or an IANA bracket (`[Europe/Stockholm]`)
|
|
63
|
+
* are **rejected** and return `null`. This mirrors the semantics of
|
|
64
|
+
* Neo4j `LocalDateTime`, which has no associated timezone.
|
|
65
|
+
*
|
|
66
|
+
* Accepted formats:
|
|
67
|
+
* - Plain datetime: `"2024-01-01T14:30:00"`, `"2024-01-01T14:30:00.500"`
|
|
68
|
+
* - Date-only (treated as local midnight): `"2024-01-01"`
|
|
69
|
+
*
|
|
70
|
+
* The optional `timeZone` parameter overrides the browser's local timezone,
|
|
71
|
+
* which is useful for deterministic testing.
|
|
72
|
+
*/
|
|
73
|
+
export declare function parseLocalDateString(s: string, timeZone?: string): number | null;
|
|
54
74
|
//# sourceMappingURL=date-utils.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"date-utils.d.ts","sourceRoot":"","sources":["../../../../src/_generated/style-rules/date-utils.ts"],"names":[],"mappings":"AAoDA;;;;;;;;;;;;GAYG;AACH,wBAAgB,eAAe,CAAC,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAyCxD;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,eAAe,CAAC,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CA0BxD"}
|
|
1
|
+
{"version":3,"file":"date-utils.d.ts","sourceRoot":"","sources":["../../../../src/_generated/style-rules/date-utils.ts"],"names":[],"mappings":"AAoDA;;;;;;;;;;;;GAYG;AACH,wBAAgB,eAAe,CAAC,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAyCxD;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,eAAe,CAAC,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CA0BxD;AAED;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,oBAAoB,CAClC,CAAC,EAAE,MAAM,EACT,QAAQ,CAAC,EAAE,MAAM,GAChB,MAAM,GAAG,IAAI,CAkCf"}
|
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
20
20
|
*/
|
|
21
21
|
export { getWeight, lerpColor } from './color-utils';
|
|
22
|
-
export { parseDateString, parseTimeString } from './date-utils';
|
|
23
|
-
export { DatetimeLiteralSchema, TimeLiteralSchema } from './literal-schemas';
|
|
24
|
-
export type { DatetimeLiteral, TimeLiteral } from './literal-schemas';
|
|
22
|
+
export { parseDateString, parseLocalDateString, parseTimeString, } from './date-utils';
|
|
23
|
+
export { DatetimeLiteralSchema, LocalDatetimeLiteralSchema, TimeLiteralSchema, } from './literal-schemas';
|
|
24
|
+
export type { DatetimeLiteral, LocalDatetimeLiteral, TimeLiteral, } from './literal-schemas';
|
|
25
25
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/_generated/style-rules/index.ts"],"names":[],"mappings":"AAMA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AACrD,OAAO,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/_generated/style-rules/index.ts"],"names":[],"mappings":"AAMA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AACrD,OAAO,EACL,eAAe,EACf,oBAAoB,EACpB,eAAe,GAChB,MAAM,cAAc,CAAC;AACtB,OAAO,EACL,qBAAqB,EACrB,0BAA0B,EAC1B,iBAAiB,GAClB,MAAM,mBAAmB,CAAC;AAC3B,YAAY,EACV,eAAe,EACf,oBAAoB,EACpB,WAAW,GACZ,MAAM,mBAAmB,CAAC"}
|
|
@@ -33,6 +33,23 @@ export declare const DatetimeLiteralSchema: z.ZodObject<{
|
|
|
33
33
|
datetime: z.ZodString;
|
|
34
34
|
}, z.core.$strip>;
|
|
35
35
|
export type DatetimeLiteral = z.infer<typeof DatetimeLiteralSchema>;
|
|
36
|
+
/**
|
|
37
|
+
* A plain (unzoned) ISO 8601 date or datetime literal that resolves to a Unix
|
|
38
|
+
* millisecond timestamp at evaluation time, interpreting the wall-clock time
|
|
39
|
+
* in the browser's local timezone.
|
|
40
|
+
*
|
|
41
|
+
* Only plain date/datetime strings without timezone qualifiers are accepted:
|
|
42
|
+
* - Plain datetime: `"2024-01-01T14:30:00"`, `"2024-01-01T14:30:00.500"`
|
|
43
|
+
* - Date-only (treated as local midnight): `"2024-01-01"`
|
|
44
|
+
*
|
|
45
|
+
* Strings with `Z`, a UTC offset (`+02:00`), or an IANA bracket
|
|
46
|
+
* (`[Europe/Stockholm]`) are **rejected** — use `{ datetime }` for
|
|
47
|
+
* timezone-aware instants. This matches the semantics of Neo4j `LocalDateTime`.
|
|
48
|
+
*/
|
|
49
|
+
export declare const LocalDatetimeLiteralSchema: z.ZodObject<{
|
|
50
|
+
localdatetime: z.ZodString;
|
|
51
|
+
}, z.core.$strip>;
|
|
52
|
+
export type LocalDatetimeLiteral = z.infer<typeof LocalDatetimeLiteralSchema>;
|
|
36
53
|
/**
|
|
37
54
|
* An ISO 8601 time literal that resolves to milliseconds since UTC midnight
|
|
38
55
|
* at evaluation time. Supported formats:
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"literal-schemas.d.ts","sourceRoot":"","sources":["../../../../src/_generated/style-rules/literal-schemas.ts"],"names":[],"mappings":"AAMA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;
|
|
1
|
+
{"version":3,"file":"literal-schemas.d.ts","sourceRoot":"","sources":["../../../../src/_generated/style-rules/literal-schemas.ts"],"names":[],"mappings":"AAMA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAQxB;;;;;;;;;GASG;AACH,eAAO,MAAM,qBAAqB;;iBAKhC,CAAC;AACH,MAAM,MAAM,eAAe,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,qBAAqB,CAAC,CAAC;AAEpE;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,0BAA0B;;iBAKrC,CAAC;AACH,MAAM,MAAM,oBAAoB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,0BAA0B,CAAC,CAAC;AAE9E;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,iBAAiB;;iBAK5B,CAAC;AACH,MAAM,MAAM,WAAW,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,iBAAiB,CAAC,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;AAWH,OAAO,EAKL,KAAK,iBAAiB,EAGtB,KAAK,gCAAgC,EAGtC,MAAM,SAAS,CAAC;AA0VjB,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"}
|
|
@@ -43,6 +43,22 @@ export declare const DataGridDatetimeLiteralSchema: z.ZodObject<{
|
|
|
43
43
|
datetime: z.ZodString;
|
|
44
44
|
}, z.core.$strip>;
|
|
45
45
|
export type DataGridDatetimeLiteral = z.infer<typeof DataGridDatetimeLiteralSchema>;
|
|
46
|
+
/**
|
|
47
|
+
* A plain (unzoned) ISO 8601 date or datetime literal that resolves to a Unix
|
|
48
|
+
* millisecond timestamp in the browser's local timezone at evaluation time.
|
|
49
|
+
* Wraps the shared `LocalDatetimeLiteralSchema` with a DataGrid-specific name.
|
|
50
|
+
*
|
|
51
|
+
* Only plain date/datetime strings without timezone qualifiers are accepted:
|
|
52
|
+
* - Plain datetime: `"2024-01-01T14:30:00"`
|
|
53
|
+
* - Date-only (treated as local midnight): `"2024-01-01"`
|
|
54
|
+
*
|
|
55
|
+
* Strings with `Z`, a UTC offset, or an IANA bracket are rejected — use
|
|
56
|
+
* `{ datetime }` for timezone-aware instants.
|
|
57
|
+
*/
|
|
58
|
+
export declare const DataGridLocalDatetimeLiteralSchema: z.ZodObject<{
|
|
59
|
+
localdatetime: z.ZodString;
|
|
60
|
+
}, z.core.$strip>;
|
|
61
|
+
export type DataGridLocalDatetimeLiteral = z.infer<typeof DataGridLocalDatetimeLiteralSchema>;
|
|
46
62
|
/**
|
|
47
63
|
* An ISO 8601 time literal that resolves to milliseconds since UTC midnight at
|
|
48
64
|
* evaluation time. Wraps the shared `TimeLiteralSchema` with a DataGrid-specific
|
|
@@ -54,15 +70,17 @@ export declare const DataGridTimeLiteralSchema: z.ZodObject<{
|
|
|
54
70
|
time: z.ZodString;
|
|
55
71
|
}, z.core.$strip>;
|
|
56
72
|
export type DataGridTimeLiteral = z.infer<typeof DataGridTimeLiteralSchema>;
|
|
57
|
-
/** An operand in a style-rule where clause -- either a literal value, a datetime literal, a time literal, or a column reference. */
|
|
73
|
+
/** An operand in a style-rule where clause -- either a literal value, a datetime literal, a localdatetime literal, a time literal, or a column reference. */
|
|
58
74
|
export declare const DataGridStyleRuleOperandSchema: z.ZodUnion<readonly [z.ZodObject<{
|
|
59
75
|
column: z.ZodString;
|
|
60
76
|
}, z.core.$strip>, z.ZodObject<{
|
|
61
77
|
datetime: z.ZodString;
|
|
78
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
79
|
+
localdatetime: z.ZodString;
|
|
62
80
|
}, z.core.$strip>, z.ZodObject<{
|
|
63
81
|
time: z.ZodString;
|
|
64
82
|
}, z.core.$strip>, z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodNull]>]>;
|
|
65
|
-
export type DataGridStyleRuleOperand = DataGridColumnRef | DataGridDatetimeLiteral | DataGridTimeLiteral | DataGridStyleRuleLiteral;
|
|
83
|
+
export type DataGridStyleRuleOperand = DataGridColumnRef | DataGridDatetimeLiteral | DataGridLocalDatetimeLiteral | DataGridTimeLiteral | DataGridStyleRuleLiteral;
|
|
66
84
|
/**
|
|
67
85
|
* Recursive WHERE clause for conditional expressions.
|
|
68
86
|
* Inspired by the graph visualization style rule system but adapted for tabular data.
|
|
@@ -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;AAaxB,mFAAmF;AACnF,eAAO,MAAM,8BAA8B,0EAKzC,CAAC;AACH,MAAM,MAAM,wBAAwB,GAAG,CAAC,CAAC,KAAK,CAC5C,OAAO,8BAA8B,CACtC,CAAC;AAEF,+EAA+E;AAC/E,eAAO,MAAM,uBAAuB;;iBAAmC,CAAC;AACxE,MAAM,MAAM,iBAAiB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,uBAAuB,CAAC,CAAC;AAExE;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,6BAA6B;;iBAAwB,CAAC;AACnE,MAAM,MAAM,uBAAuB,GAAG,CAAC,CAAC,KAAK,CAC3C,OAAO,6BAA6B,CACrC,CAAC;AAEF;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,kCAAkC;;iBAA6B,CAAC;AAC7E,MAAM,MAAM,4BAA4B,GAAG,CAAC,CAAC,KAAK,CAChD,OAAO,kCAAkC,CAC1C,CAAC;AAEF;;;;;;GAMG;AACH,eAAO,MAAM,yBAAyB;;iBAAoB,CAAC;AAC3D,MAAM,MAAM,mBAAmB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,yBAAyB,CAAC,CAAC;AAE5E,6JAA6J;AAC7J,eAAO,MAAM,8BAA8B;;;;;;;;6FAMzC,CAAC;AACH,MAAM,MAAM,wBAAwB,GAChC,iBAAiB,GAC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