@burojs/ui-shadcn 0.7.0 → 0.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{bulk-summary-CrEij5vq.cjs → bulk-summary-2HLgz7Il.cjs} +31 -5
- package/dist/bulk-summary-2HLgz7Il.cjs.map +1 -0
- package/dist/{bulk-summary-BWSAS7k2.js → bulk-summary-D6A0ua21.js} +32 -6
- package/dist/bulk-summary-D6A0ua21.js.map +1 -0
- package/dist/{candidates-relation-picker-y5M6_oe4.cjs → candidates-relation-picker-C47mF260.cjs} +3 -3
- package/dist/{candidates-relation-picker-y5M6_oe4.cjs.map → candidates-relation-picker-C47mF260.cjs.map} +1 -1
- package/dist/{candidates-relation-picker-CS_JZ4Fd.js → candidates-relation-picker-CGXItMN0.js} +3 -3
- package/dist/{candidates-relation-picker-CS_JZ4Fd.js.map → candidates-relation-picker-CGXItMN0.js.map} +1 -1
- package/dist/{check-confirm-dialog-C-NHgMST.cjs → check-confirm-dialog-BT04Mieo.cjs} +13 -6
- package/dist/check-confirm-dialog-BT04Mieo.cjs.map +1 -0
- package/dist/{check-confirm-dialog-2j0gOd7x.js → check-confirm-dialog-CtiRzOAt.js} +14 -7
- package/dist/{check-confirm-dialog-2j0gOd7x.js.map → check-confirm-dialog-CtiRzOAt.js.map} +1 -1
- package/dist/{filter-builder-DFu0JP-1.cjs → filter-builder-ByGhxLf_.cjs} +127 -63
- package/dist/filter-builder-ByGhxLf_.cjs.map +1 -0
- package/dist/{filter-builder-DaWHUZuV.js → filter-builder-z3Axzf9Y.js} +114 -56
- package/dist/filter-builder-z3Axzf9Y.js.map +1 -0
- package/dist/{flow-runtime-BpmrIUb6.cjs → flow-runtime-BVFjMU5-.cjs} +6 -3
- package/dist/{flow-runtime-BpmrIUb6.cjs.map → flow-runtime-BVFjMU5-.cjs.map} +1 -1
- package/dist/{flow-runtime-DyqTmK3H.js → flow-runtime-DrUWyTS0.js} +6 -3
- package/dist/{flow-runtime-DyqTmK3H.js.map → flow-runtime-DrUWyTS0.js.map} +1 -1
- package/dist/{flow-screen-DCdli6Ha.js → flow-screen-3fk6J33y.js} +6 -4
- package/dist/flow-screen-3fk6J33y.js.map +1 -0
- package/dist/{flow-screen-Bcz9NF2V.cjs → flow-screen-6y5E_HT6.cjs} +5 -3
- package/dist/flow-screen-6y5E_HT6.cjs.map +1 -0
- package/dist/index.cjs +518 -107
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +187 -86
- package/dist/index.d.ts +187 -86
- package/dist/index.js +519 -108
- package/dist/index.js.map +1 -1
- package/dist/{inline-flow-host-3vw7LzzD.cjs → inline-flow-host-C4KmZIYE.cjs} +3 -3
- package/dist/{inline-flow-host-3vw7LzzD.cjs.map → inline-flow-host-C4KmZIYE.cjs.map} +1 -1
- package/dist/{inline-flow-host-C0rI9B7f.js → inline-flow-host-YnnvWjdU.js} +3 -3
- package/dist/{inline-flow-host-C0rI9B7f.js.map → inline-flow-host-YnnvWjdU.js.map} +1 -1
- package/dist/{lazy-relation-picker-dialog-Bt8lrEIu.cjs → lazy-relation-picker-dialog-BAKBRn3V.cjs} +2 -2
- package/dist/{lazy-relation-picker-dialog-Bt8lrEIu.cjs.map → lazy-relation-picker-dialog-BAKBRn3V.cjs.map} +1 -1
- package/dist/{lazy-relation-picker-dialog-CAScLPb2.js → lazy-relation-picker-dialog-DN4bvQfg.js} +2 -2
- package/dist/{lazy-relation-picker-dialog-CAScLPb2.js.map → lazy-relation-picker-dialog-DN4bvQfg.js.map} +1 -1
- package/dist/{page-flow-route-BHUEpn0I.js → page-flow-route-CtEfqAvU.js} +5 -6
- package/dist/page-flow-route-CtEfqAvU.js.map +1 -0
- package/dist/{page-flow-route-DS8IVTVH.cjs → page-flow-route-DEjAxHe3.cjs} +6 -7
- package/dist/page-flow-route-DEjAxHe3.cjs.map +1 -0
- package/dist/{place-node-CfzQvh4Y.js → place-node-BdxT-30h.js} +149 -108
- package/dist/place-node-BdxT-30h.js.map +1 -0
- package/dist/{place-node-CNb3w-c7.cjs → place-node-Bhl8B3fF.cjs} +163 -134
- package/dist/place-node-Bhl8B3fF.cjs.map +1 -0
- package/dist/{related-list-cards-CelMxl4q.cjs → related-list-cards-Bc_vfCE_.cjs} +3 -3
- package/dist/{related-list-cards-CelMxl4q.cjs.map → related-list-cards-Bc_vfCE_.cjs.map} +1 -1
- package/dist/{related-list-cards-BIqqY69Y.js → related-list-cards-BvkD5OcC.js} +3 -3
- package/dist/{related-list-cards-BIqqY69Y.js.map → related-list-cards-BvkD5OcC.js.map} +1 -1
- package/dist/related-list-timeline-DCrwN9oO.js +167 -0
- package/dist/related-list-timeline-DCrwN9oO.js.map +1 -0
- package/dist/related-list-timeline-k0DtnxTs.cjs +167 -0
- package/dist/related-list-timeline-k0DtnxTs.cjs.map +1 -0
- package/dist/{related-rows-MPnLCmPF.cjs → related-rows-BW9Jr07T.cjs} +3 -3
- package/dist/{related-rows-MPnLCmPF.cjs.map → related-rows-BW9Jr07T.cjs.map} +1 -1
- package/dist/{related-rows--uP2iKQC.js → related-rows-CPE-9FFr.js} +3 -3
- package/dist/{related-rows--uP2iKQC.js.map → related-rows-CPE-9FFr.js.map} +1 -1
- package/dist/{relation-many-picker-BJhaEqxz.js → relation-many-picker-BlrGRwMV.js} +10 -5
- package/dist/relation-many-picker-BlrGRwMV.js.map +1 -0
- package/dist/{relation-many-picker-DzuGJpEl.cjs → relation-many-picker-Br-zBHxT.cjs} +10 -5
- package/dist/relation-many-picker-Br-zBHxT.cjs.map +1 -0
- package/dist/{relation-picker-DaIMzf2H.cjs → relation-picker-ADjxI_TI.cjs} +11 -6
- package/dist/relation-picker-ADjxI_TI.cjs.map +1 -0
- package/dist/{relation-picker-dialog-DoEY8EkH.js → relation-picker-dialog-CyKliBkN.js} +2 -2
- package/dist/{relation-picker-dialog-DoEY8EkH.js.map → relation-picker-dialog-CyKliBkN.js.map} +1 -1
- package/dist/{relation-picker-dialog-9Vg5vvR1.cjs → relation-picker-dialog-DimVQF9Y.cjs} +2 -2
- package/dist/{relation-picker-dialog-9Vg5vvR1.cjs.map → relation-picker-dialog-DimVQF9Y.cjs.map} +1 -1
- package/dist/{relation-picker-D-tBBZW_.js → relation-picker-x7P5HKie.js} +11 -6
- package/dist/relation-picker-x7P5HKie.js.map +1 -0
- package/dist/{resource-page-router-Diw6S6TK.js → resource-page-router-BRpUnhay.js} +144 -17
- package/dist/resource-page-router-BRpUnhay.js.map +1 -0
- package/dist/{resource-page-router-C_kGW2o_.cjs → resource-page-router-qEd2xb55.cjs} +158 -19
- package/dist/resource-page-router-qEd2xb55.cjs.map +1 -0
- package/dist/use-record-subtitle-bfwIoUme.cjs +70 -0
- package/dist/use-record-subtitle-bfwIoUme.cjs.map +1 -0
- package/dist/use-record-subtitle-gIaCGgbI.js +53 -0
- package/dist/use-record-subtitle-gIaCGgbI.js.map +1 -0
- package/package.json +9 -9
- package/dist/bulk-summary-BWSAS7k2.js.map +0 -1
- package/dist/bulk-summary-CrEij5vq.cjs.map +0 -1
- package/dist/check-confirm-dialog-C-NHgMST.cjs.map +0 -1
- package/dist/filter-builder-DFu0JP-1.cjs.map +0 -1
- package/dist/filter-builder-DaWHUZuV.js.map +0 -1
- package/dist/flow-screen-Bcz9NF2V.cjs.map +0 -1
- package/dist/flow-screen-DCdli6Ha.js.map +0 -1
- package/dist/page-flow-route-BHUEpn0I.js.map +0 -1
- package/dist/page-flow-route-DS8IVTVH.cjs.map +0 -1
- package/dist/place-node-CNb3w-c7.cjs.map +0 -1
- package/dist/place-node-CfzQvh4Y.js.map +0 -1
- package/dist/related-list-timeline-CRh7xwLD.js +0 -141
- package/dist/related-list-timeline-CRh7xwLD.js.map +0 -1
- package/dist/related-list-timeline-DsLdi8sv.cjs +0 -141
- package/dist/related-list-timeline-DsLdi8sv.cjs.map +0 -1
- package/dist/relation-many-picker-BJhaEqxz.js.map +0 -1
- package/dist/relation-many-picker-DzuGJpEl.cjs.map +0 -1
- package/dist/relation-picker-D-tBBZW_.js.map +0 -1
- package/dist/relation-picker-DaIMzf2H.cjs.map +0 -1
- package/dist/resource-page-router-C_kGW2o_.cjs.map +0 -1
- package/dist/resource-page-router-Diw6S6TK.js.map +0 -1
|
@@ -4,13 +4,14 @@ import { t as Button } from "./button-MWVeZaqj.js";
|
|
|
4
4
|
import { t as Input } from "./input-CUPStzZO.js";
|
|
5
5
|
import { C as CommandEmpty, D as CommandList, E as CommandItem, T as CommandInput, m as useRowTitle, o as narrowSearchDecl, w as CommandGroup, x as Command } from "./relation-create-C43cdPQt.js";
|
|
6
6
|
import { t as Skeleton } from "./skeleton-U2noefj5.js";
|
|
7
|
-
import { EMPTY_FILTER_GROUP, canonicalResourceKey, convertValueForOp, declaredText, enumValueText, formatEntityRef, isCompletePredicate, isFilterGroup, opArity, resolveEnumLabel, resolveSurfaceUi } from "@burojs/core";
|
|
8
|
-
import { DEFAULT_LANGUAGE_STORAGE_KEY, scopeValueOf, useApp, useChromeT, useEnumValues, useFieldDisplayText, useFieldImplementation, useFieldMeta, useFieldMetaSources, useI18nCaps, useImplementationTexts, useList, useListAccess, useLocale, useOptionalLocale, useOptionalT, useRelatedRecord, useResolvedFieldOptions } from "@burojs/react";
|
|
7
|
+
import { EMPTY_FILTER_GROUP, canonicalInstant, canonicalResourceKey, convertValueForOp, declaredText, enumValueText, formatEntityRef, formatTimeValue, instantToWall, isCalendarDate, isCompletePredicate, isFilterGroup, isWallTime, opArity, resolveEnumLabel, resolveSurfaceUi, resolveTimeZone, wallToInstant } from "@burojs/core";
|
|
8
|
+
import { DEFAULT_LANGUAGE_STORAGE_KEY, scopeValueOf, useApp, useChromeT, useEnumValues, useFieldDisplayText, useFieldImplementation, useFieldMeta, useFieldMetaSources, useI18nCaps, useImplementationTexts, useList, useListAccess, useLocale, useOptionalLocale, useOptionalT, useRelatedRecord, useResolvedFieldOptions, useTimeContext, useTimeZone } from "@burojs/react";
|
|
9
9
|
import { IconCheck, IconChevronDown, IconChevronUp, IconCirclePlus, IconFilter, IconFolderPlus, IconLoader2, IconPlus, IconX } from "@tabler/icons-react";
|
|
10
10
|
import * as React from "react";
|
|
11
11
|
import { Fragment, createElement, useCallback, useEffect, useMemo, useRef, useState } from "react";
|
|
12
12
|
import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
|
|
13
13
|
import { cva } from "class-variance-authority";
|
|
14
|
+
import { normaliseFieldZone } from "@burojs/core/internal";
|
|
14
15
|
import * as SelectPrimitive from "@radix-ui/react-select";
|
|
15
16
|
//#region src/layout/language-storage.ts
|
|
16
17
|
function loadLocale(storageKey = DEFAULT_LANGUAGE_STORAGE_KEY) {
|
|
@@ -99,6 +100,7 @@ const SEMANTIC_KEYS = Object.freeze([
|
|
|
99
100
|
"empty",
|
|
100
101
|
"default",
|
|
101
102
|
"constraints",
|
|
103
|
+
"zone",
|
|
102
104
|
"texts",
|
|
103
105
|
"options",
|
|
104
106
|
"items",
|
|
@@ -128,9 +130,11 @@ function projectUiSelection(input) {
|
|
|
128
130
|
const selection = {};
|
|
129
131
|
const inputId = ownSelection(input, "input");
|
|
130
132
|
const displayId = ownSelection(input, "display");
|
|
133
|
+
const layout = ownData(input, "layout").value;
|
|
131
134
|
if (inputId !== void 0) selection.input = inputId;
|
|
132
135
|
if (displayId !== void 0) selection.display = displayId;
|
|
133
|
-
|
|
136
|
+
if (Array.isArray(layout)) selection.layout = layout;
|
|
137
|
+
return Object.keys(selection).length === 0 ? void 0 : Object.freeze(selection);
|
|
134
138
|
}
|
|
135
139
|
function projectFieldDeclaration(input) {
|
|
136
140
|
const type = ownString(input, "type");
|
|
@@ -149,7 +153,16 @@ function projectFieldDeclaration(input) {
|
|
|
149
153
|
}
|
|
150
154
|
if (type === "object") {
|
|
151
155
|
const properties = ownData(input, "properties").value;
|
|
152
|
-
if (
|
|
156
|
+
if (Array.isArray(properties)) {
|
|
157
|
+
const output = {};
|
|
158
|
+
for (let index = 0; index < properties.length; index += 1) {
|
|
159
|
+
const entry = ownData(properties, index).value;
|
|
160
|
+
const name = ownString(entry, "name");
|
|
161
|
+
const child = projectFieldDeclaration(entry);
|
|
162
|
+
if (name !== void 0 && child !== void 0) output[name] = child;
|
|
163
|
+
}
|
|
164
|
+
projected.properties = Object.freeze(output);
|
|
165
|
+
} else if (properties !== null && typeof properties === "object") {
|
|
153
166
|
const output = {};
|
|
154
167
|
for (const key of Object.keys(properties)) {
|
|
155
168
|
const child = projectFieldDeclaration(ownData(properties, key).value);
|
|
@@ -206,6 +219,7 @@ function lowerLegacyField(field) {
|
|
|
206
219
|
const items = type === "array" ? projectFieldDeclaration(ownData(field, "items").value) ?? mapping?.items ?? STRING_ITEM : void 0;
|
|
207
220
|
const meta = ownData(field, "meta");
|
|
208
221
|
const texts = ownData(field, "texts");
|
|
222
|
+
const zone = ownData(field, "zone");
|
|
209
223
|
const options = kind === "enum" ? enumValueOptions(field) : void 0;
|
|
210
224
|
const required = ownData(field, "required");
|
|
211
225
|
const nullable = ownData(field, "nullable");
|
|
@@ -221,6 +235,7 @@ function lowerLegacyField(field) {
|
|
|
221
235
|
...meta.present && meta.value !== void 0 ? { meta: meta.value } : {},
|
|
222
236
|
...options === void 0 ? {} : { options },
|
|
223
237
|
...texts.present && texts.value !== void 0 ? { texts: texts.value } : {},
|
|
238
|
+
...zone.present && zone.value !== void 0 ? { zone: zone.value } : {},
|
|
224
239
|
...requiredValue === true ? { required: true } : {},
|
|
225
240
|
...nullableValue === true ? { nullable: true } : {}
|
|
226
241
|
});
|
|
@@ -372,7 +387,7 @@ function useFieldImplementationDiagnostic(diagnostic) {
|
|
|
372
387
|
console.warn("[buro/ui-shadcn] missing-field-implementation; rendering fallback.", diagnostic);
|
|
373
388
|
}, [diagnostic]);
|
|
374
389
|
}
|
|
375
|
-
function ResolvedFieldDisplay({ resource, name, field: source, value, record, testId, fallback, presentation, metaSources, uiSurface = "display", columnEntry }) {
|
|
390
|
+
function ResolvedFieldDisplay({ resource, name, field: source, value, record, testId, fallback, presentation, metaSources, uiSurface = "display", columnEntry, absentPaths, pathStatus }) {
|
|
376
391
|
const { sourceAtEdge, field, ui } = useLoweredField(source);
|
|
377
392
|
const surfaceField = useMemo(() => sourceAtEdge.ui === void 0 ? field : Object.freeze({
|
|
378
393
|
...field,
|
|
@@ -397,10 +412,19 @@ function ResolvedFieldDisplay({ resource, name, field: source, value, record, te
|
|
|
397
412
|
const text = useFieldDisplayText(textField, value, {
|
|
398
413
|
surface: uiSurface,
|
|
399
414
|
...columnEntry === void 0 ? {} : { entry: columnEntry },
|
|
400
|
-
resource: canonicalResourceKey(resource)
|
|
415
|
+
resource: canonicalResourceKey(resource),
|
|
416
|
+
...record === void 0 ? {} : { record }
|
|
401
417
|
});
|
|
402
418
|
const options = useContextOptions(field, name, metaState.status === "ready" ? metaState.meta : void 0, ui, resource);
|
|
403
419
|
const texts = useContextTexts(field, name, resolved, resource);
|
|
420
|
+
const dateDisplay = resolveSurfaceUi(surfaceField, uiSurface, columnEntry).dateDisplay;
|
|
421
|
+
const contextUi = useMemo(() => dateDisplay === void 0 ? ui : Object.freeze({
|
|
422
|
+
...ui,
|
|
423
|
+
display: Object.freeze({
|
|
424
|
+
...typeof ui.display === "object" && ui.display !== null ? ui.display : {},
|
|
425
|
+
...dateDisplay
|
|
426
|
+
})
|
|
427
|
+
}), [ui, dateDisplay]);
|
|
404
428
|
useFieldMetaDiagnostic(metaState, resource, name, surfaceField, uiSurface, columnEntry);
|
|
405
429
|
useFieldImplementationDiagnostic(resolved.diagnostic);
|
|
406
430
|
if (resolved.Component === void 0) return jsx(Fragment$1, { children: fallback });
|
|
@@ -411,11 +435,13 @@ function ResolvedFieldDisplay({ resource, name, field: source, value, record, te
|
|
|
411
435
|
resource,
|
|
412
436
|
field,
|
|
413
437
|
path: Object.freeze([name]),
|
|
438
|
+
...absentPaths === void 0 || absentPaths.length === 0 ? {} : { absentPaths },
|
|
439
|
+
...pathStatus === void 0 ? {} : { pathStatus },
|
|
414
440
|
surface: "display",
|
|
415
441
|
presentation: presentation ?? "default",
|
|
416
442
|
record,
|
|
417
443
|
meta: metaState.meta,
|
|
418
|
-
ui,
|
|
444
|
+
ui: contextUi,
|
|
419
445
|
options,
|
|
420
446
|
texts,
|
|
421
447
|
...text === void 0 ? {} : { text },
|
|
@@ -438,7 +464,7 @@ function ResolvedFieldDisplay({ resource, name, field: source, value, record, te
|
|
|
438
464
|
value
|
|
439
465
|
});
|
|
440
466
|
}
|
|
441
|
-
function ResolvedFieldInput({ resource, name, field: source, value, record, form, testId, inputId, onChange, onBlur, disabled, required, placeholder, descriptionId, labelId, errorId, errorMessage, pending = false, touched = errorMessage != null, issues: suppliedIssues, relationSeeds, fixedFilters, link, metaSources, fallback }) {
|
|
467
|
+
function ResolvedFieldInput({ resource, name, field: source, value, record, form, testId, inputId, onChange, onBlur, disabled, required, placeholder, descriptionId, labelId, errorId, errorMessage, pending = false, touched = errorMessage != null, issues: suppliedIssues, relationSeeds, fixedFilters, optionSubtitle, link, metaSources, baseline, fallback, absentPaths, pathStatus }) {
|
|
442
468
|
const { sourceAtEdge, field: base } = useLoweredField(source);
|
|
443
469
|
const field = useMemo(() => required === void 0 || required === base.required ? base : Object.freeze({
|
|
444
470
|
...base,
|
|
@@ -480,6 +506,8 @@ function ResolvedFieldInput({ resource, name, field: source, value, record, form
|
|
|
480
506
|
resource,
|
|
481
507
|
field,
|
|
482
508
|
path: Object.freeze([name]),
|
|
509
|
+
...absentPaths === void 0 || absentPaths.length === 0 ? {} : { absentPaths },
|
|
510
|
+
...pathStatus === void 0 ? {} : { pathStatus },
|
|
483
511
|
surface: "input",
|
|
484
512
|
presentation: "default",
|
|
485
513
|
record,
|
|
@@ -510,8 +538,10 @@ function ResolvedFieldInput({ resource, name, field: source, value, record, form
|
|
|
510
538
|
disabled,
|
|
511
539
|
relationSeeds,
|
|
512
540
|
fixedFilters,
|
|
541
|
+
optionSubtitle,
|
|
513
542
|
link,
|
|
514
|
-
metaSources: runtimeContext.metaSources
|
|
543
|
+
metaSources: runtimeContext.metaSources,
|
|
544
|
+
...baseline === void 0 ? {} : { baseline }
|
|
515
545
|
});
|
|
516
546
|
return createElement(Component, {
|
|
517
547
|
...context,
|
|
@@ -522,8 +552,10 @@ function ResolvedFieldInput({ resource, name, field: source, value, record, form
|
|
|
522
552
|
disabled,
|
|
523
553
|
relationSeeds,
|
|
524
554
|
fixedFilters,
|
|
555
|
+
optionSubtitle,
|
|
525
556
|
link,
|
|
526
|
-
metaSources: runtimeContext.metaSources
|
|
557
|
+
metaSources: runtimeContext.metaSources,
|
|
558
|
+
...baseline === void 0 ? {} : { baseline }
|
|
527
559
|
});
|
|
528
560
|
}
|
|
529
561
|
//#endregion
|
|
@@ -677,8 +709,6 @@ SelectSeparator.displayName = SelectPrimitive.Separator.displayName;
|
|
|
677
709
|
function localeTag(locale) {
|
|
678
710
|
return locale || loadLocale() || "en-US";
|
|
679
711
|
}
|
|
680
|
-
const dateCache = new Map();
|
|
681
|
-
const dateTimeCache = new Map();
|
|
682
712
|
const numberCache = new Map();
|
|
683
713
|
function cached(cache, key, make) {
|
|
684
714
|
const hit = cache.get(key);
|
|
@@ -692,24 +722,6 @@ function cached(cache, key, make) {
|
|
|
692
722
|
cache.set(key, made);
|
|
693
723
|
return made;
|
|
694
724
|
}
|
|
695
|
-
function formatDate(d, locale) {
|
|
696
|
-
const tag = localeTag(locale);
|
|
697
|
-
return cached(dateCache, tag, (t) => new Intl.DateTimeFormat(t, {
|
|
698
|
-
year: "numeric",
|
|
699
|
-
month: "short",
|
|
700
|
-
day: "numeric"
|
|
701
|
-
})).format(d);
|
|
702
|
-
}
|
|
703
|
-
function formatDateTime(d, locale) {
|
|
704
|
-
const tag = localeTag(locale);
|
|
705
|
-
return cached(dateTimeCache, tag, (t) => new Intl.DateTimeFormat(t, {
|
|
706
|
-
year: "numeric",
|
|
707
|
-
month: "short",
|
|
708
|
-
day: "numeric",
|
|
709
|
-
hour: "2-digit",
|
|
710
|
-
minute: "2-digit"
|
|
711
|
-
})).format(d);
|
|
712
|
-
}
|
|
713
725
|
function formatNumber(n, locale) {
|
|
714
726
|
const tag = localeTag(locale);
|
|
715
727
|
return cached(numberCache, tag, (t) => new Intl.NumberFormat(t)).format(n);
|
|
@@ -723,7 +735,7 @@ function describeValue(value, chromeT, spec, formatValue) {
|
|
|
723
735
|
const optionLabel = spec?.options?.find((o) => o.value === String(value))?.label;
|
|
724
736
|
if (optionLabel !== void 0) return optionLabel;
|
|
725
737
|
if (spec && formatValue) {
|
|
726
|
-
const formatted = formatValue(spec.kind, value);
|
|
738
|
+
const formatted = formatValue(spec.kind, value, spec.zone);
|
|
727
739
|
if (formatted !== void 0) return formatted;
|
|
728
740
|
}
|
|
729
741
|
return String(value);
|
|
@@ -880,6 +892,8 @@ function FilterBadges(props) {
|
|
|
880
892
|
const { group, setGroup, available, fixed, testIdBase, onOpenAt, onRemoved, pinnedFields = [], pinnedValue = [], setPinnedValue } = props;
|
|
881
893
|
const chromeT = useChromeT();
|
|
882
894
|
const locale = useOptionalLocale();
|
|
895
|
+
const viewer = useTimeZone();
|
|
896
|
+
const timeContext = useTimeContext();
|
|
883
897
|
const tt = (key, params, fallback) => chromeT(key, {
|
|
884
898
|
params,
|
|
885
899
|
...typeof params?.count === "number" ? { count: params.count } : {},
|
|
@@ -887,13 +901,18 @@ function FilterBadges(props) {
|
|
|
887
901
|
});
|
|
888
902
|
const removeLabel = chromeT("filters.removeRow", { defaultValue: "Remove filter" });
|
|
889
903
|
const { enumLabels, relationLabels, onEnumResolved, onRelationResolved } = useFormatValueMaps();
|
|
890
|
-
const formatValue = (kind, value) => {
|
|
904
|
+
const formatValue = (kind, value, fieldZone) => {
|
|
891
905
|
if (kind.kind === "enum") return enumLabels[kind.enumName]?.[String(value)];
|
|
892
906
|
if (kind.kind === "relation") return relationLabels[relationLabelKey(kind.to, kind.by, String(value))];
|
|
893
|
-
if (kind.kind === "date") {
|
|
894
|
-
const
|
|
895
|
-
if (
|
|
896
|
-
return kind.time ?
|
|
907
|
+
if (kind.kind === "date" && viewer.status === "ready") {
|
|
908
|
+
const zone = resolveTimeZone(timeContext.levels, fieldZone, timeContext.sources);
|
|
909
|
+
if (zone.status === "pending") return void 0;
|
|
910
|
+
return formatTimeValue(kind.time ? "dateTime" : "date", String(value), {
|
|
911
|
+
zone: zone.zone,
|
|
912
|
+
viewerZone: viewer.zone,
|
|
913
|
+
locale: localeTag(locale),
|
|
914
|
+
params: {}
|
|
915
|
+
});
|
|
897
916
|
}
|
|
898
917
|
};
|
|
899
918
|
const orphanPinned = useMemo(() => {
|
|
@@ -1480,21 +1499,56 @@ function RelationValueControl(props) {
|
|
|
1480
1499
|
});
|
|
1481
1500
|
}
|
|
1482
1501
|
//#endregion
|
|
1502
|
+
//#region src/fields/field-time-zone.ts
|
|
1503
|
+
function useFieldTimeZone(zone, row) {
|
|
1504
|
+
const { sources: session } = useTimeContext();
|
|
1505
|
+
const sources = useMemo(() => row === void 0 ? session : {
|
|
1506
|
+
...session,
|
|
1507
|
+
record: {
|
|
1508
|
+
status: "ready",
|
|
1509
|
+
value: row,
|
|
1510
|
+
refreshing: false
|
|
1511
|
+
}
|
|
1512
|
+
}, [session, row]);
|
|
1513
|
+
const fieldZone = useMemo(() => normaliseFieldZone(zone), [zone]);
|
|
1514
|
+
return useTimeZone(fieldZone, sources);
|
|
1515
|
+
}
|
|
1516
|
+
const DATE_KEYS = [
|
|
1517
|
+
"dateStyle",
|
|
1518
|
+
"timeStyle",
|
|
1519
|
+
"zoneName"
|
|
1520
|
+
];
|
|
1521
|
+
function dateDisplayParams(ui) {
|
|
1522
|
+
const display = ui?.display;
|
|
1523
|
+
if (display === null || typeof display !== "object") return {};
|
|
1524
|
+
const params = {};
|
|
1525
|
+
for (const key of DATE_KEYS) {
|
|
1526
|
+
const value = display[key];
|
|
1527
|
+
if (value !== void 0) params[key] = value;
|
|
1528
|
+
}
|
|
1529
|
+
return params;
|
|
1530
|
+
}
|
|
1531
|
+
//#endregion
|
|
1483
1532
|
//#region src/fields/local-date-time.ts
|
|
1484
|
-
function toLocalDateTimeText(value) {
|
|
1533
|
+
function toLocalDateTimeText(value, zone) {
|
|
1485
1534
|
if (value === void 0 || value === null || value === "") return "";
|
|
1486
|
-
const
|
|
1487
|
-
if (
|
|
1488
|
-
const
|
|
1489
|
-
return `${
|
|
1535
|
+
const instant = canonicalInstant(value instanceof Date ? value.toISOString() : String(value));
|
|
1536
|
+
if (instant === void 0) return "";
|
|
1537
|
+
const { date, time } = instantToWall(instant, zone);
|
|
1538
|
+
return `${date}T${time.slice(0, 5)}`;
|
|
1490
1539
|
}
|
|
1491
|
-
function fromLocalDateTimeText(text) {
|
|
1492
|
-
|
|
1493
|
-
|
|
1494
|
-
|
|
1540
|
+
function fromLocalDateTimeText(text, zone) {
|
|
1541
|
+
const [date, time, ...rest] = text.split("T");
|
|
1542
|
+
if (date === void 0 || time === void 0 || rest.length > 0) return void 0;
|
|
1543
|
+
if (!isCalendarDate(date) || !isWallTime(time)) return void 0;
|
|
1544
|
+
return wallToInstant(date, time, zone);
|
|
1495
1545
|
}
|
|
1496
1546
|
//#endregion
|
|
1497
1547
|
//#region src/list-kit/filter-builder/values/scalar-value-input.tsx
|
|
1548
|
+
function useFilterZone(fieldZone) {
|
|
1549
|
+
const zone = useFieldTimeZone(fieldZone, void 0);
|
|
1550
|
+
return zone.status === "ready" ? zone.zone : "UTC";
|
|
1551
|
+
}
|
|
1498
1552
|
function isDateTime(kind) {
|
|
1499
1553
|
return kind.kind === "date" && kind.time === true;
|
|
1500
1554
|
}
|
|
@@ -1505,18 +1559,18 @@ function inputTypeFor(kind) {
|
|
|
1505
1559
|
default: return "text";
|
|
1506
1560
|
}
|
|
1507
1561
|
}
|
|
1508
|
-
function toText(kind, value) {
|
|
1509
|
-
if (isDateTime(kind)) return toLocalDateTimeText(value);
|
|
1562
|
+
function toText(kind, value, zone) {
|
|
1563
|
+
if (isDateTime(kind)) return toLocalDateTimeText(value, zone);
|
|
1510
1564
|
if (value === void 0 || value === null || value === "") return "";
|
|
1511
1565
|
return String(value);
|
|
1512
1566
|
}
|
|
1513
|
-
function parseOne(kind, raw) {
|
|
1567
|
+
function parseOne(kind, raw, zone) {
|
|
1514
1568
|
if (raw === "") return void 0;
|
|
1515
1569
|
if (kind.kind === "number") {
|
|
1516
1570
|
const n = Number(raw);
|
|
1517
1571
|
return Number.isFinite(n) ? n : void 0;
|
|
1518
1572
|
}
|
|
1519
|
-
if (isDateTime(kind)) return fromLocalDateTimeText(raw);
|
|
1573
|
+
if (isDateTime(kind)) return fromLocalDateTimeText(raw, zone);
|
|
1520
1574
|
return raw;
|
|
1521
1575
|
}
|
|
1522
1576
|
function ScalarValueInput(props) {
|
|
@@ -1539,7 +1593,8 @@ function ScalarValueInput(props) {
|
|
|
1539
1593
|
}
|
|
1540
1594
|
function ScalarSingleInput(props) {
|
|
1541
1595
|
const { value, onChange, kind, testId, autoFocus, inputType, ariaLabel, debounceMs = 300 } = props;
|
|
1542
|
-
const
|
|
1596
|
+
const zone = useFilterZone(props.zone);
|
|
1597
|
+
const storedText = toText(kind, value, zone);
|
|
1543
1598
|
const [text, setText] = useState(storedText);
|
|
1544
1599
|
const lastPushedRef = useRef(storedText);
|
|
1545
1600
|
const timerRef = useRef(null);
|
|
@@ -1547,8 +1602,8 @@ function ScalarSingleInput(props) {
|
|
|
1547
1602
|
const commitRef = useRef(() => {});
|
|
1548
1603
|
useEffect(() => {
|
|
1549
1604
|
commitRef.current = (raw) => {
|
|
1550
|
-
const parsed = parseOne(kind, raw);
|
|
1551
|
-
lastPushedRef.current = toText(kind, parsed);
|
|
1605
|
+
const parsed = parseOne(kind, raw, zone);
|
|
1606
|
+
lastPushedRef.current = toText(kind, parsed, zone);
|
|
1552
1607
|
pendingRawRef.current = null;
|
|
1553
1608
|
onChange(parsed);
|
|
1554
1609
|
};
|
|
@@ -1597,8 +1652,9 @@ function ScalarMultiInput(props) {
|
|
|
1597
1652
|
const { value, onChange, kind, testId, autoFocus, inputType, ariaLabel } = props;
|
|
1598
1653
|
const chips = Array.isArray(value) ? value.map((v) => String(v)) : [];
|
|
1599
1654
|
const [draft, setDraft] = useState("");
|
|
1655
|
+
const zone = useFilterZone(props.zone);
|
|
1600
1656
|
const addChip = () => {
|
|
1601
|
-
const parsed = parseOne(kind, draft.trim());
|
|
1657
|
+
const parsed = parseOne(kind, draft.trim(), zone);
|
|
1602
1658
|
if (parsed === void 0) return;
|
|
1603
1659
|
const text = String(parsed);
|
|
1604
1660
|
setDraft("");
|
|
@@ -1788,6 +1844,7 @@ function FilterRow(props) {
|
|
|
1788
1844
|
debounceMs,
|
|
1789
1845
|
fieldLabel: spec.label,
|
|
1790
1846
|
options: spec.options,
|
|
1847
|
+
...spec.zone === void 0 ? {} : { zone: spec.zone },
|
|
1791
1848
|
fill: true
|
|
1792
1849
|
})
|
|
1793
1850
|
}),
|
|
@@ -2089,7 +2146,8 @@ function PinnedControl(props) {
|
|
|
2089
2146
|
testId: `${testIdBase}:pinned:${spec.field}`,
|
|
2090
2147
|
fieldLabel: spec.label,
|
|
2091
2148
|
placeholder: spec.label,
|
|
2092
|
-
options: spec.options
|
|
2149
|
+
options: spec.options,
|
|
2150
|
+
...spec.zone === void 0 ? {} : { zone: spec.zone }
|
|
2093
2151
|
});
|
|
2094
2152
|
}
|
|
2095
2153
|
//#endregion
|
|
@@ -2347,6 +2405,6 @@ function FilterBuilder(props) {
|
|
|
2347
2405
|
] });
|
|
2348
2406
|
}
|
|
2349
2407
|
//#endregion
|
|
2350
|
-
export {
|
|
2408
|
+
export { TableHeader as A, DEFAULT_LANGUAGE_STORAGE_KEY as B, SelectTrigger as C, TableCaption as D, TableBody as E, ResolvedFieldDisplay as F, saveLocale as H, ResolvedFieldInput as I, useFieldMetaDiagnostic as L, Badge as M, badgeVariants as N, TableCell as O, MetaPlaceholder as P, fieldDescription as R, SelectSeparator as S, Table as T, loadLocale as V, SelectGroup as _, PinnedFilterControls as a, SelectScrollDownButton as b, fromLocalDateTimeText as c, useFieldTimeZone as d, FilterBadges as f, SelectContent as g, Select as h, FacetedFilterPicker as i, TableRow as j, TableHead as k, toLocalDateTimeText as l, localeTag as m, PresetFilterControls as n, FilterPanel as o, formatNumber as p, DataTableFacetedFilter as r, FilterValueControl as s, FilterBuilder as t, dateDisplayParams as u, SelectItem as v, SelectValue as w, SelectScrollUpButton as x, SelectLabel as y, lowerLegacyField as z };
|
|
2351
2409
|
|
|
2352
|
-
//# sourceMappingURL=filter-builder-
|
|
2410
|
+
//# sourceMappingURL=filter-builder-z3Axzf9Y.js.map
|