@burojs/ui-shadcn 0.7.0 → 0.9.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-CS_JZ4Fd.js → candidates-relation-picker-QvoY2bOQ.js} +3 -3
- package/dist/{candidates-relation-picker-CS_JZ4Fd.js.map → candidates-relation-picker-QvoY2bOQ.js.map} +1 -1
- package/dist/{candidates-relation-picker-y5M6_oe4.cjs → candidates-relation-picker-pEAWKQEY.cjs} +3 -3
- package/dist/{candidates-relation-picker-y5M6_oe4.cjs.map → candidates-relation-picker-pEAWKQEY.cjs.map} +1 -1
- package/dist/{check-confirm-dialog-2j0gOd7x.js → check-confirm-dialog-B-CbJTln.js} +68 -8
- package/dist/{check-confirm-dialog-2j0gOd7x.js.map → check-confirm-dialog-B-CbJTln.js.map} +1 -1
- package/dist/{check-confirm-dialog-C-NHgMST.cjs → check-confirm-dialog-W-8WOmGh.cjs} +72 -6
- package/dist/check-confirm-dialog-W-8WOmGh.cjs.map +1 -0
- package/dist/{filter-builder-DaWHUZuV.js → filter-builder-04nas3eq.js} +127 -61
- package/dist/filter-builder-04nas3eq.js.map +1 -0
- package/dist/{filter-builder-DFu0JP-1.cjs → filter-builder-DQX-TMFh.cjs} +140 -68
- package/dist/filter-builder-DQX-TMFh.cjs.map +1 -0
- package/dist/{flow-runtime-DyqTmK3H.js → flow-runtime-BEIyym7d.js} +7 -4
- package/dist/{flow-runtime-DyqTmK3H.js.map → flow-runtime-BEIyym7d.js.map} +1 -1
- package/dist/{flow-runtime-BpmrIUb6.cjs → flow-runtime-DyNIYfUP.cjs} +7 -4
- package/dist/{flow-runtime-BpmrIUb6.cjs.map → flow-runtime-DyNIYfUP.cjs.map} +1 -1
- package/dist/{flow-screen-DCdli6Ha.js → flow-screen-DY1Z9PbG.js} +56 -15
- package/dist/flow-screen-DY1Z9PbG.js.map +1 -0
- package/dist/{flow-screen-Bcz9NF2V.cjs → flow-screen-FE5Xhb3t.cjs} +54 -13
- package/dist/flow-screen-FE5Xhb3t.cjs.map +1 -0
- package/dist/index.cjs +564 -170
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +235 -95
- package/dist/index.d.ts +235 -95
- package/dist/index.js +562 -169
- package/dist/index.js.map +1 -1
- package/dist/{inline-flow-host-C0rI9B7f.js → inline-flow-host-D6u-RlsV.js} +3 -3
- package/dist/{inline-flow-host-C0rI9B7f.js.map → inline-flow-host-D6u-RlsV.js.map} +1 -1
- package/dist/{inline-flow-host-3vw7LzzD.cjs → inline-flow-host-yVLo6-sM.cjs} +3 -3
- package/dist/{inline-flow-host-3vw7LzzD.cjs.map → inline-flow-host-yVLo6-sM.cjs.map} +1 -1
- package/dist/{lazy-relation-picker-dialog-CAScLPb2.js → lazy-relation-picker-dialog-BaORufxQ.js} +2 -2
- package/dist/{lazy-relation-picker-dialog-CAScLPb2.js.map → lazy-relation-picker-dialog-BaORufxQ.js.map} +1 -1
- package/dist/{lazy-relation-picker-dialog-Bt8lrEIu.cjs → lazy-relation-picker-dialog-C_VlGlDz.cjs} +2 -2
- package/dist/{lazy-relation-picker-dialog-Bt8lrEIu.cjs.map → lazy-relation-picker-dialog-C_VlGlDz.cjs.map} +1 -1
- package/dist/{page-flow-route-BHUEpn0I.js → page-flow-route-CyMzUidK.js} +8 -9
- package/dist/page-flow-route-CyMzUidK.js.map +1 -0
- package/dist/{page-flow-route-DS8IVTVH.cjs → page-flow-route-OFx7h7Ja.cjs} +8 -9
- package/dist/page-flow-route-OFx7h7Ja.cjs.map +1 -0
- package/dist/{place-node-CNb3w-c7.cjs → place-node-BZF5Af6x.cjs} +224 -151
- package/dist/place-node-BZF5Af6x.cjs.map +1 -0
- package/dist/{place-node-CfzQvh4Y.js → place-node-DRjmJGQ_.js} +210 -125
- package/dist/place-node-DRjmJGQ_.js.map +1 -0
- package/dist/{related-list-cards-BIqqY69Y.js → related-list-cards-2hLitVkg.js} +3 -3
- package/dist/{related-list-cards-BIqqY69Y.js.map → related-list-cards-2hLitVkg.js.map} +1 -1
- package/dist/{related-list-cards-CelMxl4q.cjs → related-list-cards-xVvgSlu-.cjs} +3 -3
- package/dist/{related-list-cards-CelMxl4q.cjs.map → related-list-cards-xVvgSlu-.cjs.map} +1 -1
- package/dist/related-list-timeline-CxJqe6eK.js +167 -0
- package/dist/related-list-timeline-CxJqe6eK.js.map +1 -0
- package/dist/related-list-timeline-Dsf5WewG.cjs +167 -0
- package/dist/related-list-timeline-Dsf5WewG.cjs.map +1 -0
- package/dist/{related-rows-MPnLCmPF.cjs → related-rows-DDhp9axl.cjs} +4 -4
- package/dist/{related-rows-MPnLCmPF.cjs.map → related-rows-DDhp9axl.cjs.map} +1 -1
- package/dist/{related-rows--uP2iKQC.js → related-rows-DL6CWsrj.js} +4 -4
- package/dist/{related-rows--uP2iKQC.js.map → related-rows-DL6CWsrj.js.map} +1 -1
- package/dist/{relation-create-C43cdPQt.js → relation-create-6WicROWA.js} +33 -5
- package/dist/relation-create-6WicROWA.js.map +1 -0
- package/dist/{relation-create-DDEYcKfw.cjs → relation-create-_SFuPQGM.cjs} +37 -3
- package/dist/relation-create-_SFuPQGM.cjs.map +1 -0
- package/dist/{relation-many-picker-DzuGJpEl.cjs → relation-many-picker-BBNsmkaX.cjs} +18 -11
- package/dist/relation-many-picker-BBNsmkaX.cjs.map +1 -0
- package/dist/{relation-many-picker-BJhaEqxz.js → relation-many-picker-mGEQDWo2.js} +18 -11
- package/dist/relation-many-picker-mGEQDWo2.js.map +1 -0
- package/dist/{relation-picker-D-tBBZW_.js → relation-picker-BbO41cFV.js} +19 -11
- package/dist/relation-picker-BbO41cFV.js.map +1 -0
- package/dist/{relation-picker-dialog-DoEY8EkH.js → relation-picker-dialog-BgSG_8bU.js} +5 -5
- package/dist/relation-picker-dialog-BgSG_8bU.js.map +1 -0
- package/dist/{relation-picker-dialog-9Vg5vvR1.cjs → relation-picker-dialog-Duqy2r0n.cjs} +5 -5
- package/dist/relation-picker-dialog-Duqy2r0n.cjs.map +1 -0
- package/dist/{relation-picker-DaIMzf2H.cjs → relation-picker-jk9D_uwn.cjs} +19 -11
- package/dist/relation-picker-jk9D_uwn.cjs.map +1 -0
- package/dist/{relation-select-Cr3CfNLy.cjs → relation-select-C3aV18kT.cjs} +2 -2
- package/dist/{relation-select-Cr3CfNLy.cjs.map → relation-select-C3aV18kT.cjs.map} +1 -1
- package/dist/{relation-select-B8Fq4o-t.js → relation-select-CjQT9LpS.js} +2 -2
- package/dist/{relation-select-B8Fq4o-t.js.map → relation-select-CjQT9LpS.js.map} +1 -1
- package/dist/{resource-page-router-Diw6S6TK.js → resource-page-router-CzaNATSp.js} +209 -30
- package/dist/resource-page-router-CzaNATSp.js.map +1 -0
- package/dist/{resource-page-router-C_kGW2o_.cjs → resource-page-router-dmVIeu5s.cjs} +235 -32
- package/dist/resource-page-router-dmVIeu5s.cjs.map +1 -0
- package/dist/{success-notices-Dl3M1fZP.cjs → success-notices-Cl4b6MLQ.cjs} +3 -2
- package/dist/success-notices-Cl4b6MLQ.cjs.map +1 -0
- package/dist/{success-notices-LDEgEkc4.js → success-notices-CrcWOGSo.js} +3 -2
- package/dist/success-notices-CrcWOGSo.js.map +1 -0
- package/dist/{use-dialog-filter-state-B_MqzHaT.js → use-dialog-filter-state-CJoeY-1j.js} +2 -2
- package/dist/{use-dialog-filter-state-B_MqzHaT.js.map → use-dialog-filter-state-CJoeY-1j.js.map} +1 -1
- package/dist/{use-dialog-filter-state-tNvqAAjh.cjs → use-dialog-filter-state-lsTJxrB4.cjs} +2 -2
- package/dist/{use-dialog-filter-state-tNvqAAjh.cjs.map → use-dialog-filter-state-lsTJxrB4.cjs.map} +1 -1
- package/dist/use-record-subtitle-BJ9rnj6F.cjs +67 -0
- package/dist/use-record-subtitle-BJ9rnj6F.cjs.map +1 -0
- package/dist/use-record-subtitle-w3ZhXNlf.js +50 -0
- package/dist/use-record-subtitle-w3ZhXNlf.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-create-C43cdPQt.js.map +0 -1
- package/dist/relation-create-DDEYcKfw.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/relation-picker-dialog-9Vg5vvR1.cjs.map +0 -1
- package/dist/relation-picker-dialog-DoEY8EkH.js.map +0 -1
- package/dist/resource-page-router-C_kGW2o_.cjs.map +0 -1
- package/dist/resource-page-router-Diw6S6TK.js.map +0 -1
- package/dist/success-notices-Dl3M1fZP.cjs.map +0 -1
- package/dist/success-notices-LDEgEkc4.js.map +0 -1
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { l as cn } from "./use-theme-dnE3Od3I.js";
|
|
2
2
|
import { m as PopoverTrigger, p as PopoverContent, u as Popover } from "./toaster-Ct_YHGs6.js";
|
|
3
3
|
import { t as Button } from "./button-MWVeZaqj.js";
|
|
4
|
-
import {
|
|
5
|
-
import { r as useCandidatesGate, t as LazyRelationPickerDialog } from "./lazy-relation-picker-dialog-
|
|
4
|
+
import { D as CommandItem, E as CommandInput, O as CommandList, S as Command, a as namesHiddenField, b as LoadError, i as selectKey, m as useRowTitle, n as useSelectCreate, o as narrowSearchDecl, r as RelationViewButton, t as RelationCreateButton, w as CommandEmpty } from "./relation-create-6WicROWA.js";
|
|
5
|
+
import { r as useCandidatesGate, t as LazyRelationPickerDialog } from "./lazy-relation-picker-dialog-BaORufxQ.js";
|
|
6
|
+
import { r as useRowSubtitle, t as optionSubtitle } from "./use-record-subtitle-w3ZhXNlf.js";
|
|
6
7
|
import { composeListFilter, normalizeFixedFilters, relationOpenOf, resolveResourceLabel, resourceKey } from "@burojs/core";
|
|
7
8
|
import { resolveErrorText, useApp, useI18nCaps, useList, useListAccess, useOptionalT, useRelatedRecord, useTestIds } from "@burojs/react";
|
|
8
9
|
import { IconCheck, IconChevronDown, IconLoader2, IconX } from "@tabler/icons-react";
|
|
@@ -36,7 +37,7 @@ function keysOf(value) {
|
|
|
36
37
|
return out;
|
|
37
38
|
}
|
|
38
39
|
function RelationManyPickerInput(props) {
|
|
39
|
-
const { name, id, value, onChange, testid, field, disabled, required, ariaInvalid, ariaDescribedBy, ariaErrorMessage, relationSeeds, fixedFilters, metaSources, resource, link } = props;
|
|
40
|
+
const { name, id, value, onChange, testid, field, disabled, required, ariaInvalid, ariaDescribedBy, ariaErrorMessage, ariaLabelledBy, relationSeeds, fixedFilters, metaSources, resource, link } = props;
|
|
40
41
|
const meta = field?.meta;
|
|
41
42
|
let to;
|
|
42
43
|
try {
|
|
@@ -84,6 +85,7 @@ function RelationManyPickerInput(props) {
|
|
|
84
85
|
count: keyRead.keys.length
|
|
85
86
|
} : !link.ready ? { kind: "pending" } : void 0;
|
|
86
87
|
const filters = gate.filters.length === 0 ? fixedFilters : [...gate.filters, ...fixedFilters ?? []];
|
|
88
|
+
const subtitle = props.optionSubtitle;
|
|
87
89
|
return jsx(ManyPicker, {
|
|
88
90
|
to,
|
|
89
91
|
keys: keysOf(value),
|
|
@@ -100,6 +102,7 @@ function RelationManyPickerInput(props) {
|
|
|
100
102
|
resource: resource ?? "",
|
|
101
103
|
fieldName: field?.name ?? name,
|
|
102
104
|
open: relationOpenOf(field ?? {}),
|
|
105
|
+
...subtitle === void 0 ? {} : { optionSubtitle: subtitle },
|
|
103
106
|
...linkRights === void 0 ? {} : {
|
|
104
107
|
canAdd: linkRights.attach.allowed,
|
|
105
108
|
canRemove: linkRights.detach.allowed,
|
|
@@ -112,16 +115,18 @@ function RelationManyPickerInput(props) {
|
|
|
112
115
|
required,
|
|
113
116
|
ariaInvalid,
|
|
114
117
|
ariaDescribedBy,
|
|
115
|
-
ariaErrorMessage
|
|
118
|
+
ariaErrorMessage,
|
|
119
|
+
ariaLabelledBy
|
|
116
120
|
});
|
|
117
121
|
}
|
|
118
|
-
function ManyPicker({ to, keys, onChange, by, searchField, fixedFilters, gate, createSeeds, name, id, testid, resource, fieldName, open: openMode, canAdd = true, canRemove = true, hidden = NO_KEYS, notAtomic = false, readOnly = false, keyNotice, scope = "context", disabled, required, ariaInvalid, ariaDescribedBy, ariaErrorMessage }) {
|
|
122
|
+
function ManyPicker({ to, keys, onChange, by, searchField, fixedFilters, gate, createSeeds, name, id, testid, resource, fieldName, open: openMode, optionSubtitle: optionSubtitle$1, canAdd = true, canRemove = true, hidden = NO_KEYS, notAtomic = false, readOnly = false, keyNotice, scope = "context", disabled, required, ariaInvalid, ariaDescribedBy, ariaErrorMessage, ariaLabelledBy }) {
|
|
119
123
|
const app = useApp();
|
|
120
124
|
const caps = useI18nCaps();
|
|
121
125
|
const t = useOptionalT();
|
|
122
126
|
const tid = useTestIds();
|
|
123
127
|
const targetDef = app.registry.get(to);
|
|
124
|
-
const rowTitle = useRowTitle(to, targetDef?.displayField);
|
|
128
|
+
const rowTitle = useRowTitle(to, targetDef?.displayField, { recordTitle: true });
|
|
129
|
+
const rowSubtitle = useRowSubtitle(to, optionSubtitle$1);
|
|
125
130
|
const targetLabel = resolveResourceLabel(caps, to, "single", targetDef).toLowerCase();
|
|
126
131
|
const childPrefix = `relation-picker:${to}`;
|
|
127
132
|
const effectiveSearchField = searchField ?? targetDef?.displayField ?? "name";
|
|
@@ -427,7 +432,8 @@ function ManyPicker({ to, keys, onChange, by, searchField, fixedFilters, gate, c
|
|
|
427
432
|
jsxs(CommandList, {
|
|
428
433
|
"data-testid": `${childPrefix}:list`,
|
|
429
434
|
"aria-multiselectable": "true",
|
|
430
|
-
|
|
435
|
+
label: targetLabel,
|
|
436
|
+
...ariaLabelledBy ? { "aria-labelledby": ariaLabelledBy } : {},
|
|
431
437
|
children: [
|
|
432
438
|
isLoading && jsxs("div", {
|
|
433
439
|
className: "flex items-center justify-center gap-2 py-6 text-sm text-muted-foreground",
|
|
@@ -456,6 +462,7 @@ function ManyPicker({ to, keys, onChange, by, searchField, fixedFilters, gate, c
|
|
|
456
462
|
if (rowValue === null || rowValue === void 0 || rowValue === "") return null;
|
|
457
463
|
const idStr = String(rowValue);
|
|
458
464
|
const label = rowTitle(row);
|
|
465
|
+
const subtitle = optionSubtitle(rowSubtitle(row), label, idStr);
|
|
459
466
|
const chosen = keys.some((key) => String(key) === idStr);
|
|
460
467
|
return jsxs(CommandItem, {
|
|
461
468
|
value: `${label} ${idStr}`,
|
|
@@ -472,9 +479,9 @@ function ManyPicker({ to, keys, onChange, by, searchField, fixedFilters, gate, c
|
|
|
472
479
|
className: "truncate",
|
|
473
480
|
children: label
|
|
474
481
|
}),
|
|
475
|
-
|
|
482
|
+
subtitle === null ? null : jsx("span", {
|
|
476
483
|
className: "ml-auto shrink-0 pl-2 text-xs text-muted-foreground",
|
|
477
|
-
children:
|
|
484
|
+
children: subtitle
|
|
478
485
|
})
|
|
479
486
|
]
|
|
480
487
|
}, idStr);
|
|
@@ -533,7 +540,7 @@ function ManyPicker({ to, keys, onChange, by, searchField, fixedFilters, gate, c
|
|
|
533
540
|
function Chip({ to, keyValue, by, resource, fieldName, testId, open: openMode, disabled, focusTrigger, onRemove }) {
|
|
534
541
|
const t = useOptionalT();
|
|
535
542
|
const targetDef = useApp().registry.get(to);
|
|
536
|
-
const rowTitle = useRowTitle(to, targetDef?.displayField);
|
|
543
|
+
const rowTitle = useRowTitle(to, targetDef?.displayField, { recordTitle: true });
|
|
537
544
|
const { record, isLoading } = useRelatedRecord(to, keyValue, by === void 0 ? void 0 : { by });
|
|
538
545
|
const title = record ? rowTitle(record) : String(keyValue);
|
|
539
546
|
return jsxs("span", {
|
|
@@ -564,4 +571,4 @@ function Chip({ to, keyValue, by, resource, fieldName, testId, open: openMode, d
|
|
|
564
571
|
//#endregion
|
|
565
572
|
export { RelationManyPickerInput };
|
|
566
573
|
|
|
567
|
-
//# sourceMappingURL=relation-many-picker-
|
|
574
|
+
//# sourceMappingURL=relation-many-picker-mGEQDWo2.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"relation-many-picker-mGEQDWo2.js","names":["optionSubtitle","optionSubtitleText"],"sources":["../src/lib/error-title.ts","../src/fields/relation-many-picker.tsx"],"sourcesContent":["import { type ErrorTextCaps, resolveErrorText } from '@burojs/react';\n\n/**\n * The text a user may read for a failure a hook handed to the kit as an `Error`-typed value.\n * The value is a `DataError` at runtime when it came from a data provider (its `message` is a\n * reference, so it is resolved through the bundle) and a plain `Error` when the framework raised\n * it (its `message` is already a sentence). Anything else has nothing to show.\n */\nexport function errorTitle(error: unknown, caps: ErrorTextCaps): string | undefined {\n if (error instanceof Error) return error.message;\n if (error !== null && typeof error === 'object') {\n const { code, message } = error as { readonly code?: unknown; readonly message?: unknown };\n if (typeof code === 'string') {\n return resolveErrorText(\n {\n code,\n ...(message !== null && typeof message === 'object' ? { message } : {}),\n } as Parameters<typeof resolveErrorText>[0],\n caps,\n );\n }\n }\n return undefined;\n}\n","'use client';\n\nimport {\n type ErasedResourceHandle,\n type FilterExpression,\n type FixedFilterInput,\n type RelationCandidate,\n type RelationOpen,\n relationOpenOf,\n type ResourceRefInput,\n type ScopeSource,\n type SearchDecl,\n composeListFilter,\n normalizeFixedFilters,\n resolveResourceLabel,\n resourceKey,\n} from '@burojs/core';\nimport {\n useApp,\n useI18nCaps,\n useList,\n useListAccess,\n useOptionalT,\n useRelatedRecord,\n useTestIds,\n} from '@burojs/react';\nimport { errorTitle } from '../lib/error-title.js';\nimport { LoadError } from '../load-error/load-error-view.js';\nimport { IconCheck, IconChevronDown, IconLoader2, IconX } from '@tabler/icons-react';\nimport * as React from 'react';\nimport { cn } from '../lib/cn.js';\nimport { Button } from '../primitives/button.js';\nimport {\n Command,\n CommandEmpty,\n CommandInput,\n CommandItem,\n CommandList,\n} from '../primitives/command.js';\nimport { Popover, PopoverContent, PopoverTrigger } from '../primitives/popover.js';\nimport {\n optionSubtitle as optionSubtitleText,\n type RecordSubtitleFn,\n useRowSubtitle,\n} from '../resource/use-record-subtitle.js';\nimport { useRowTitle } from '../resource/use-row-title.js';\nimport { useCandidatesGate } from './candidates-gate.js';\nimport { RelationCreateButton, useSelectCreate } from './relation-create.js';\nimport { LazyRelationPickerDialog } from './lazy-relation-picker-dialog.js';\nimport { RelationViewButton, selectKey } from './relation-view-button.js';\nimport type { FieldInputProps } from './registry.js';\nimport { namesHiddenField, narrowSearchDecl } from './search-access.js';\n\ntype ErasedExpression = FilterExpression<ErasedResourceHandle>;\ntype Key = string | number;\n\nconst DEBOUNCE_MS = 250;\nconst NO_KEYS: readonly Key[] = Object.freeze([]);\n\n/** The keys a to-many field holds: strings and finite numbers, the user's order, no repeats. */\nfunction keysOf(value: unknown): readonly Key[] {\n if (!Array.isArray(value)) return [];\n const seen = new Set<string>();\n const out: Key[] = [];\n for (const entry of value) {\n const key = selectKey(entry);\n if (key === null || seen.has(key)) continue;\n seen.add(key);\n out.push(entry as Key);\n }\n return out;\n}\n\n/**\n * Form input of `f.relationMany` (P7 3.5): the chosen rows as chips (titles through the relation\n * aggregator, one batched read), a popover that searches the same option query a single select\n * does (candidates, field access and the create hand-back included), \"Advanced search\" in a\n * multiple-choice dialog, a \"view\" on every chip and \"+ create\" that appends what it created.\n * The value is `row[by ?? id]` for each chosen row. Loaded lazily: it is not on any screen's\n * first paint.\n */\nexport function RelationManyPickerInput(props: FieldInputProps): React.ReactElement {\n const {\n name,\n id,\n value,\n onChange,\n testid,\n field,\n disabled,\n required,\n ariaInvalid,\n ariaDescribedBy,\n ariaErrorMessage,\n ariaLabelledBy,\n relationSeeds,\n fixedFilters,\n metaSources,\n resource,\n link,\n } = props;\n const meta = field?.meta as\n | {\n to?: ResourceRefInput;\n by?: unknown;\n searchField?: string;\n candidates?: unknown;\n scope?: ScopeSource;\n }\n | undefined;\n let to: string | undefined;\n try {\n to = meta?.to === undefined ? undefined : resourceKey(meta.to);\n } catch {\n to = undefined;\n }\n const gate = useCandidatesGate({\n to,\n candidates: Array.isArray(meta?.candidates)\n ? (meta.candidates as readonly RelationCandidate[])\n : undefined,\n sources: metaSources,\n resource: resource ?? '',\n fieldName: field?.name ?? name,\n });\n if (!to) {\n return (\n <Button\n type=\"button\"\n variant=\"outline\"\n disabled\n data-testid={`${testid ?? `relation-many:${name}`}:no-target`}\n className=\"w-full justify-between font-normal\"\n name={name}\n id={id}\n >\n <span className=\"truncate text-muted-foreground\">—</span>\n </Button>\n );\n }\n // An inline link: the form controller's rights decide what the select offers, and the keys the\n // user cannot see ride along in the value. A link denied `not-atomic` is read-only with a notice.\n const linkRights = link?.rights;\n const notAtomic =\n linkRights !== undefined &&\n [linkRights.edit, linkRights.attach, linkRights.detach].some(\n (right) => !right.allowed && right.reason === 'not-atomic',\n );\n const denied =\n linkRights !== undefined &&\n !notAtomic &&\n !linkRights.edit.allowed &&\n ['field-readonly', 'rule-denied', 'operation-absent'].includes(linkRights.edit.reason);\n // The form holds a link's keys only once they are read whole: a failed or capped read, or one\n // still running, leaves the field read-only, and the user is told why.\n const keyRead = link?.keys;\n const keyNotice: KeyNotice | undefined =\n link === undefined\n ? undefined\n : keyRead?.error\n ? { kind: 'error', error: keyRead.error }\n : keyRead !== undefined &&\n !keyRead.isLoading &&\n keyRead.keys !== undefined &&\n !keyRead.complete\n ? { kind: 'incomplete', count: keyRead.keys.length }\n : !link.ready\n ? { kind: 'pending' }\n : undefined;\n const filters =\n gate.filters.length === 0 ? fixedFilters : [...gate.filters, ...(fixedFilters ?? [])];\n const subtitle = props.optionSubtitle;\n return (\n <ManyPicker\n to={to}\n keys={keysOf(value)}\n onChange={(next) => onChange(next)}\n {...(typeof meta?.by === 'string' ? { by: meta.by } : {})}\n searchField={meta?.searchField}\n {...(meta?.scope === undefined ? {} : { scope: meta.scope })}\n fixedFilters={filters}\n {...(gate.gate === undefined ? {} : { gate: gate.gate })}\n createSeeds={relationSeeds}\n name={name}\n id={id}\n testid={testid ?? `relation-many:${to}`}\n resource={resource ?? ''}\n fieldName={field?.name ?? name}\n open={relationOpenOf(field ?? {})}\n {...(subtitle === undefined ? {} : { optionSubtitle: subtitle })}\n {...(linkRights === undefined\n ? {}\n : {\n canAdd: linkRights.attach.allowed,\n canRemove: linkRights.detach.allowed,\n hidden: link?.hidden ?? [],\n notAtomic,\n readOnly: denied,\n ...(keyNotice === undefined ? {} : { keyNotice }),\n })}\n disabled={disabled}\n required={required}\n ariaInvalid={ariaInvalid}\n ariaDescribedBy={ariaDescribedBy}\n ariaErrorMessage={ariaErrorMessage}\n ariaLabelledBy={ariaLabelledBy}\n />\n );\n}\n\n/** Why a link whose keys the form does not hold whole is read-only. */\ntype KeyNotice =\n | { readonly kind: 'error'; readonly error: unknown }\n | { readonly kind: 'incomplete'; readonly count: number }\n | { readonly kind: 'pending' };\n\ninterface ManyPickerProps {\n readonly to: string;\n readonly keys: readonly Key[];\n readonly onChange: (next: readonly Key[]) => void;\n readonly by?: string;\n readonly searchField?: string | undefined;\n readonly fixedFilters: readonly FixedFilterInput[] | undefined;\n readonly gate?: import('./candidates-gate.js').CandidatesGate;\n readonly createSeeds: Readonly<Record<string, unknown>> | undefined;\n readonly name: string;\n readonly id: string | undefined;\n readonly testid: string;\n readonly resource: string;\n readonly fieldName: string;\n readonly open: RelationOpen;\n /** The options' second line (the field's `optionSubtitle`); see `RelationPickerProps`. */\n readonly optionSubtitle?: RecordSubtitleFn;\n /** False: no search box, no \"Advanced search\", no create, and no key can be added. Default true. */\n readonly canAdd?: boolean;\n /** False: no chip remove button, no Backspace removal, no clear-all. Default true. */\n readonly canRemove?: boolean;\n /**\n * Keys of `keys` whose target the user cannot see: one \"N not visible\" chip stands for them, it\n * has no remove button, and neither Backspace nor clear-all drops them.\n */\n readonly hidden?: readonly Key[];\n /** The link is edited with the record but its provider does not write it so: read-only, say so. */\n readonly notAtomic?: boolean;\n /** The user may see the link but not change it: say so. */\n readonly readOnly?: boolean;\n /** The link's keys are not held whole (failed, cut at the read cap, or still loading). */\n readonly keyNotice?: KeyNotice;\n /**\n * The read scope of the option reads (popover, dialog, create hand-back). Default `'context'`:\n * the record around the select narrows them, except by the field the select writes.\n */\n readonly scope?: ScopeSource;\n readonly disabled: boolean | undefined;\n readonly required: boolean | undefined;\n readonly ariaInvalid: boolean | undefined;\n readonly ariaDescribedBy: string | undefined;\n readonly ariaErrorMessage: string | undefined;\n /** Id of the field's label element: the option list is named by it. */\n readonly ariaLabelledBy?: string | undefined;\n}\n\nfunction ManyPicker({\n to,\n keys,\n onChange,\n by,\n searchField,\n fixedFilters,\n gate,\n createSeeds,\n name,\n id,\n testid,\n resource,\n fieldName,\n open: openMode,\n optionSubtitle,\n canAdd = true,\n canRemove = true,\n hidden = NO_KEYS,\n notAtomic = false,\n readOnly = false,\n keyNotice,\n scope = 'context',\n disabled,\n required,\n ariaInvalid,\n ariaDescribedBy,\n ariaErrorMessage,\n ariaLabelledBy,\n}: ManyPickerProps): React.ReactElement {\n const app = useApp();\n const caps = useI18nCaps();\n const t = useOptionalT();\n const tid = useTestIds();\n const targetDef = app.registry.get(to);\n const rowTitle = useRowTitle(to, targetDef?.displayField, { recordTitle: true });\n const rowSubtitle = useRowSubtitle(to, optionSubtitle);\n const targetLabel = resolveResourceLabel(caps, to, 'single', targetDef).toLowerCase();\n const childPrefix = `relation-picker:${to}`;\n const effectiveSearchField = searchField ?? targetDef?.displayField ?? 'name';\n const [open, setOpen] = React.useState(false);\n const [dialogOpen, setDialogOpen] = React.useState(false);\n // Mounted on the first open, and only while no candidates gate holds the read: without the\n // candidate filters the dialog would list rows the field must not offer.\n const gated = gate !== undefined;\n const [dialogMounted, setDialogMounted] = React.useState(false);\n React.useEffect(() => {\n if (gated) setDialogOpen(false);\n }, [gated]);\n React.useEffect(() => {\n if (dialogOpen) setDialogMounted(true);\n }, [dialogOpen]);\n const [search, setSearch] = React.useState('');\n const [debouncedSearch, setDebouncedSearch] = React.useState('');\n const triggerRef = React.useRef<HTMLButtonElement | null>(null);\n const focusTrigger = React.useCallback(() => triggerRef.current?.focus(), []);\n\n React.useEffect(() => {\n const handle = setTimeout(() => setDebouncedSearch(search), DEBOUNCE_MS);\n return () => clearTimeout(handle);\n }, [search]);\n React.useEffect(() => {\n if (!open) {\n setSearch('');\n setDebouncedSearch('');\n }\n }, [open]);\n\n const targetIdField = (targetDef?.data as { readonly idField?: unknown } | undefined)?.idField;\n const idField =\n typeof targetIdField === 'string' && targetIdField.length > 0 ? targetIdField : 'id';\n const valueField = by ?? idField;\n const access = useListAccess(to);\n const accessReady = access.status === 'ready';\n const searchDecl = React.useMemo<SearchDecl | undefined>(\n () =>\n narrowSearchDecl(\n targetDef?.views?.list?.search ?? { fields: [effectiveSearchField] },\n (field) => access.fieldVisible(field),\n ),\n [targetDef, effectiveSearchField, access],\n );\n const filter = React.useMemo<ErasedExpression | undefined>(\n () =>\n composeListFilter({\n fixed: normalizeFixedFilters(fixedFilters),\n search: debouncedSearch,\n searchDecl,\n searchContext: { resource: to, def: targetDef },\n }),\n [fixedFilters, debouncedSearch, searchDecl, to, targetDef],\n );\n const blocked =\n !accessReady ||\n gate !== undefined ||\n namesHiddenField(filter, (field) => access.fieldVisible(field));\n\n const hiddenSet = React.useMemo(() => new Set(hidden.map(String)), [hidden]);\n const visibleKeys = React.useMemo(\n () => keys.filter((key) => !hiddenSet.has(String(key))),\n [keys, hiddenSet],\n );\n const hiddenHeld = keys.length - visibleKeys.length;\n const append = React.useCallback(\n (next: Key) => {\n if (!canAdd || keys.some((key) => String(key) === String(next))) return;\n onChange([...keys, next]);\n },\n [keys, onChange, canAdd],\n );\n const toggle = React.useCallback(\n (next: Key) => {\n const held = keys.some((key) => String(key) === String(next));\n if (held ? !canRemove || hiddenSet.has(String(next)) : !canAdd) return;\n onChange(held ? keys.filter((key) => String(key) !== String(next)) : [...keys, next]);\n },\n [keys, onChange, canAdd, canRemove, hiddenSet],\n );\n const { create, reader: createReader } = useSelectCreate({\n to,\n by,\n valueField,\n idField,\n fixedFilters,\n scope,\n scopeField: fieldName,\n held: gated,\n searchDecl,\n searchContext: { resource: to, def: targetDef },\n // What was created and fits is appended, as a pick would be; the dialog it came from is done.\n onValue: (picked) => {\n append(picked);\n setDialogOpen(false);\n },\n });\n\n const listQuery = useList(to, {\n ...(filter ? { filter } : {}),\n pagination: { kind: 'offset', page: 1, pageSize: 10 },\n scope,\n scopeField: fieldName,\n enabled: open && targetDef != null && !blocked,\n });\n const rows = (listQuery.data?.data ?? []) as Array<Record<string, unknown>>;\n const isLoading = listQuery.isLoading || listQuery.isFetching;\n const error = listQuery.isError ? (listQuery.error as unknown as Error) : null;\n\n if (!targetDef) {\n return (\n <Button\n type=\"button\"\n variant=\"outline\"\n disabled\n data-testid={`${childPrefix}:unregistered`}\n className=\"w-full justify-between font-normal\"\n name={name}\n id={id}\n >\n <span className=\"truncate text-muted-foreground\">{keys.map(String).join(', ') || '—'}</span>\n </Button>\n );\n }\n\n const placeholder = t('relation.select', {\n params: { name: targetLabel },\n defaultValue: `Select ${targetLabel}…`,\n });\n // Nothing held, nothing drawn: an empty row would still take the column's gap above the trigger.\n const chips =\n visibleKeys.length === 0 && hiddenHeld === 0 ? null : (\n <div className=\"flex flex-wrap items-center gap-1\" data-testid={`${testid}:chips`}>\n {visibleKeys.map((key) => (\n <Chip\n key={String(key)}\n to={to}\n keyValue={key}\n by={by}\n resource={resource}\n fieldName={fieldName}\n open={openMode}\n testId={tid.relationManyChip(resource, fieldName, String(key))}\n disabled={disabled === true || !canRemove}\n focusTrigger={focusTrigger}\n onRemove={() => onChange(keys.filter((entry) => String(entry) !== String(key)))}\n />\n ))}\n {hiddenHeld > 0 ? (\n <span\n data-testid={tid.linkHidden(resource, fieldName)}\n className=\"inline-flex items-center rounded-md border bg-secondary px-2 py-0.5 text-sm text-muted-foreground\"\n >\n {t('field.link.hidden', {\n count: hiddenHeld,\n defaultValue: '{{count}} not visible',\n })}\n </span>\n ) : null}\n {canRemove && disabled !== true && visibleKeys.length > 0 ? (\n <button\n type=\"button\"\n onClick={() => {\n // The button leaves with the chips it clears: focus goes where chip removal sends it.\n focusTrigger();\n onChange(keys.filter((key) => hiddenSet.has(String(key))));\n }}\n data-testid={`${testid}:clear-all`}\n className=\"rounded-sm px-1 text-xs text-muted-foreground hover:text-foreground focus:outline-hidden focus-visible:ring-2 focus-visible:ring-ring\"\n >\n {t('relationPicker.clearAll', { defaultValue: 'Clear all' })}\n </button>\n ) : null}\n </div>\n );\n const notice = keyNotice ? (\n <p\n data-testid={`${testid}:keys-${keyNotice.kind}`}\n role={keyNotice.kind === 'error' ? 'status' : undefined}\n className={cn(\n 'text-xs',\n keyNotice.kind === 'error' ? 'text-destructive' : 'text-muted-foreground',\n )}\n >\n {keyNotice.kind === 'error'\n ? `${t('field.link.failed', { defaultValue: 'Links could not be loaded' })}: ${errorTitle(keyNotice.error, caps) ?? ''}`\n : keyNotice.kind === 'incomplete'\n ? t('field.link.incomplete', {\n count: keyNotice.count,\n defaultValue: 'More than {{count}} links',\n })\n : t('table.loading', { defaultValue: 'Loading…' })}\n </p>\n ) : readOnly ? (\n <p data-testid={`${testid}:read-only`} className=\"text-xs text-muted-foreground\">\n {t('field.link.readOnly', { defaultValue: 'You cannot change this link.' })}\n </p>\n ) : notAtomic ? (\n <p data-testid={`${testid}:not-atomic`} className=\"text-xs text-muted-foreground\">\n {t('field.link.notAtomic', {\n defaultValue:\n 'This link cannot be edited here: its data source does not save it with the record.',\n })}\n </p>\n ) : null;\n\n if (gate?.kind === 'pending')\n return (\n <div className=\"flex flex-col gap-1.5\">\n {chips}\n {notice}\n <Button\n type=\"button\"\n variant=\"outline\"\n disabled\n aria-busy=\"true\"\n data-testid={testid}\n data-buro-candidates=\"pending\"\n className=\"w-full justify-between font-normal\"\n >\n <span className=\"truncate text-muted-foreground\">{placeholder}</span>\n <IconLoader2 className=\"h-4 w-4 shrink-0 animate-spin opacity-50\" aria-hidden />\n </Button>\n </div>\n );\n if (gate?.kind === 'forbidden')\n return (\n <div className=\"flex flex-col gap-1.5\">\n {chips}\n {notice}\n <Button\n type=\"button\"\n variant=\"outline\"\n disabled\n data-testid={testid}\n data-buro-candidates=\"forbidden\"\n aria-describedby={gate.testId}\n className=\"w-full justify-between font-normal\"\n >\n <span className=\"truncate text-muted-foreground\">{placeholder}</span>\n <IconChevronDown className=\"h-4 w-4 shrink-0 opacity-50\" aria-hidden />\n </Button>\n <p id={gate.testId} data-testid={gate.testId} className=\"text-xs text-muted-foreground\">\n {gate.message}\n </p>\n </div>\n );\n\n return (\n <Popover open={open} onOpenChange={setOpen}>\n <div className=\"flex flex-col gap-1.5\">\n {chips}\n {notice}\n <PopoverTrigger asChild>\n <Button\n ref={triggerRef}\n type=\"button\"\n variant=\"outline\"\n role=\"combobox\"\n aria-expanded={open}\n aria-haspopup=\"listbox\"\n aria-required={required}\n aria-invalid={ariaInvalid || undefined}\n aria-describedby={ariaDescribedBy}\n {...(ariaErrorMessage ? { 'aria-errormessage': ariaErrorMessage } : {})}\n disabled={disabled}\n data-testid={testid}\n name={name}\n id={id}\n className=\"w-full justify-between font-normal\"\n >\n <span className=\"truncate text-left text-muted-foreground\">{placeholder}</span>\n <IconChevronDown className=\"h-4 w-4 shrink-0 opacity-50\" aria-hidden />\n </Button>\n </PopoverTrigger>\n </div>\n <PopoverContent className=\"w-[var(--radix-popover-trigger-width)] p-0\" align=\"start\">\n {gate?.kind === 'empty' ? (\n <p\n className=\"px-3 py-6 text-center text-sm text-muted-foreground\"\n data-testid={gate.testId}\n >\n {gate.message}\n </p>\n ) : (\n <Command shouldFilter={false}>\n {searchDecl !== undefined && canAdd && (\n <CommandInput\n value={search}\n onValueChange={setSearch}\n placeholder={t('toolbar.search', {\n params: { name: targetLabel },\n defaultValue: `Search ${targetLabel}…`,\n })}\n data-testid={`${childPrefix}:search`}\n aria-label={t('toolbar.search', {\n params: { name: targetLabel },\n defaultValue: `Search ${targetLabel}`,\n })}\n onKeyDown={(event) => {\n // Backspace in an empty search takes the last chip off.\n if (event.key === 'Backspace' && search === '' && canRemove) {\n event.preventDefault();\n const last = visibleKeys.at(-1);\n if (last !== undefined)\n onChange(keys.filter((key) => String(key) !== String(last)));\n }\n // Space toggles the highlighted option while nothing is typed.\n if (event.key === ' ' && search === '') {\n event.preventDefault();\n document\n .querySelector<HTMLElement>(\n `[data-testid=\"${childPrefix}:list\"] [aria-selected=\"true\"]`,\n )\n ?.click();\n }\n }}\n />\n )}\n <CommandList\n data-testid={`${childPrefix}:list`}\n aria-multiselectable=\"true\"\n // cmdk draws `aria-label` from `label` (default \"Suggestions\"), after any `aria-label`\n // prop: the field's label element names the list, the target's name is the fallback.\n label={targetLabel}\n {...(ariaLabelledBy ? { 'aria-labelledby': ariaLabelledBy } : {})}\n >\n {isLoading && (\n <div\n className=\"flex items-center justify-center gap-2 py-6 text-sm text-muted-foreground\"\n data-testid={`${childPrefix}:loading`}\n >\n <IconLoader2 className=\"h-4 w-4 animate-spin\" aria-hidden />\n <span>{t('table.loading', { defaultValue: 'Loading…' })}</span>\n </div>\n )}\n {!isLoading && error && (\n <LoadError\n surface=\"picker\"\n error={error}\n testId={`${childPrefix}:error`}\n className=\"block px-3 py-6 text-center text-sm text-muted-foreground\"\n fallback={{ key: 'relation.failed', default: 'Failed to load options.' }}\n />\n )}\n {!isLoading && !error && rows.length === 0 && (\n <CommandEmpty data-testid={`${childPrefix}:empty`}>\n {t('relation.noResults', { defaultValue: 'No results.' })}\n </CommandEmpty>\n )}\n {!isLoading &&\n !error &&\n rows.map((row) => {\n const rowValue = row[valueField];\n if (rowValue === null || rowValue === undefined || rowValue === '') return null;\n const idStr = String(rowValue);\n const label = rowTitle(row);\n const subtitle = optionSubtitleText(rowSubtitle(row), label, idStr);\n const chosen = keys.some((key) => String(key) === idStr);\n return (\n <CommandItem\n key={idStr}\n value={`${label} ${idStr}`}\n data-testid={`${childPrefix}:option:${idStr}`}\n aria-checked={chosen}\n disabled={chosen ? !canRemove : !canAdd}\n onSelect={() => toggle(rowValue as Key)}\n >\n <IconCheck\n className={cn(\n 'mr-2 h-4 w-4 shrink-0',\n chosen ? 'opacity-100' : 'opacity-0',\n )}\n aria-hidden\n />\n <span className=\"truncate\">{label}</span>\n {/* The declared subtitle, else `#<id>` unless the label already is the id\n (REF-40). */}\n {subtitle === null ? null : (\n <span className=\"ml-auto shrink-0 pl-2 text-xs text-muted-foreground\">\n {subtitle}\n </span>\n )}\n </CommandItem>\n );\n })}\n </CommandList>\n <div className=\"flex items-center justify-between gap-2 border-t px-3 py-2 text-sm\">\n {canAdd ? (\n <button\n type=\"button\"\n onClick={() => {\n setOpen(false);\n setDialogOpen(true);\n }}\n data-testid={`${childPrefix}:advanced`}\n className=\"text-foreground hover:underline focus:outline-hidden focus-visible:underline\"\n >\n {t('relationPicker.advancedSearch', { defaultValue: 'Advanced search' })}\n </button>\n ) : (\n <span />\n )}\n {!disabled && canAdd && (\n <RelationCreateButton\n to={to}\n fieldName={fieldName}\n create={create}\n seeds={createSeeds}\n search={search}\n beforeOpen={() => {\n setOpen(false);\n focusTrigger();\n }}\n className=\"text-foreground hover:underline focus:outline-hidden focus-visible:underline disabled:opacity-50\"\n />\n )}\n </div>\n </Command>\n )}\n </PopoverContent>\n {dialogMounted && !gated && canAdd && (\n <LazyRelationPickerDialog\n to={to}\n open={dialogOpen}\n onOpenChange={setDialogOpen}\n onSelect={() => undefined}\n multiple\n selected={keys}\n onToggle={toggle}\n valueField={valueField}\n searchField={searchField}\n fixedFilters={fixedFilters}\n scope={scope}\n scopeField={fieldName}\n {...(disabled ? {} : { create })}\n createSeeds={createSeeds}\n fieldName={fieldName}\n onBeforeCreate={focusTrigger}\n />\n )}\n {createReader}\n </Popover>\n );\n}\n\n/** One chosen row: its title (the aggregator batches every chip's read), which views it, and remove. */\nfunction Chip({\n to,\n keyValue,\n by,\n resource,\n fieldName,\n testId,\n open: openMode,\n disabled,\n focusTrigger,\n onRemove,\n}: {\n readonly to: string;\n readonly keyValue: Key;\n readonly by: string | undefined;\n readonly resource: string;\n readonly fieldName: string;\n readonly testId: string;\n readonly open: RelationOpen;\n readonly disabled: boolean;\n readonly focusTrigger: () => void;\n readonly onRemove: () => void;\n}): React.ReactElement {\n const t = useOptionalT();\n const app = useApp();\n const targetDef = app.registry.get(to);\n const rowTitle = useRowTitle(to, targetDef?.displayField, { recordTitle: true });\n const { record, isLoading } = useRelatedRecord(\n to,\n keyValue,\n by === undefined ? undefined : { by },\n );\n const title = record ? rowTitle(record as Record<string, unknown>) : String(keyValue);\n return (\n <span\n data-testid={testId}\n data-resource={resource}\n className=\"inline-flex items-center gap-0.5 rounded-md border bg-secondary pl-2 text-sm text-secondary-foreground\"\n >\n <RelationViewButton\n to={to}\n value={keyValue}\n by={by}\n fieldName={`${fieldName}:${String(keyValue)}`}\n beforeOpen={focusTrigger}\n open={openMode}\n title={isLoading ? t('table.loading', { defaultValue: 'Loading…' }) : title}\n />\n {!disabled && (\n <button\n type=\"button\"\n onClick={onRemove}\n data-testid={`${testId}:remove`}\n aria-label={`${t('relationPicker.clear', { defaultValue: 'Clear' })} ${title}`}\n className=\"inline-flex size-6 items-center justify-center rounded-sm text-muted-foreground hover:text-foreground focus:outline-hidden focus-visible:ring-2 focus-visible:ring-ring\"\n >\n <IconX className=\"size-3.5\" aria-hidden />\n </button>\n )}\n </span>\n );\n}\n"],"mappings":";;;;;;;;;;;;AAQA,SAAgB,WAAW,OAAgB,MAAyC;CAClF,IAAI,iBAAiB,OAAO,OAAO,MAAM;CACzC,IAAI,UAAU,QAAQ,OAAO,UAAU,UAAU;EAC/C,MAAM,EAAE,MAAM,YAAY;EAC1B,IAAI,OAAO,SAAS,UAClB,OAAO,iBACL;GACE;GACA,GAAI,YAAY,QAAQ,OAAO,YAAY,WAAW,EAAE,QAAQ,IAAI,CAAC;EACvE,GACA,IACF;CAEJ;AAEF;;;ACiCA,MAAM,cAAc;AACpB,MAAM,UAA0B,OAAO,OAAO,CAAC,CAAC;AAGhD,SAAS,OAAO,OAAgC;CAC9C,IAAI,CAAC,MAAM,QAAQ,KAAK,GAAG,OAAO,CAAC;CACnC,MAAM,OAAO,IAAI,IAAY;CAC7B,MAAM,MAAa,CAAC;CACpB,KAAK,MAAM,SAAS,OAAO;EACzB,MAAM,MAAM,UAAU,KAAK;EAC3B,IAAI,QAAQ,QAAQ,KAAK,IAAI,GAAG,GAAG;EACnC,KAAK,IAAI,GAAG;EACZ,IAAI,KAAK,KAAY;CACvB;CACA,OAAO;AACT;AAUA,SAAgB,wBAAwB,OAA4C;CAClF,MAAM,EACJ,MACA,IACA,OACA,UACA,QACA,OACA,UACA,UACA,aACA,iBACA,kBACA,gBACA,eACA,cACA,aACA,UACA,SACE;CACJ,MAAM,OAAO,OAAO;CASpB,IAAI;CACJ,IAAI;EACF,KAAK,MAAM,OAAO,KAAA,IAAY,KAAA,IAAY,YAAY,KAAK,EAAE;CAC/D,QAAQ;EACN,KAAK,KAAA;CACP;CACA,MAAM,OAAO,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U;IACE;IACC;IACC;IACP;IACP,YAAY;IACZ,GAAK,WAAW,CAAC,IAAI,EAAE,OAAO;IACjB;IACF;IACX,gBAAgB;GACjB,CAAA;GAEF;EACM;;AAEb;AAGA,SAAS,KAAK,EACZ,IACA,UACA,IACA,UACA,WACA,QACA,MAAM,UACN,UACA,cACA,YAYqB;CACrB,MAAM,IAAI,aAAa;CAEvB,MAAM,YADM,OACQ,CAAC,CAAC,SAAS,IAAI,EAAE;CACrC,MAAM,WAAW,YAAY,IAAI,WAAW,cAAc,EAAE,aAAa,KAAK,CAAC;CAC/E,MAAM,EAAE,QAAQ,cAAc,iBAC5B,IACA,UACA,OAAO,KAAA,IAAY,KAAA,IAAY,EAAE,GAAG,CACtC;CACA,MAAM,QAAQ,SAAS,SAAS,MAAiC,IAAI,OAAO,QAAQ;CACpF,OACE,KAAC,QAAD;EACE,eAAa;EACb,iBAAe;EACf,WAAU;EAHZ,UAAA,CAKE,IAAC,oBAAD;GACM;GACJ,OAAO;GACH;GACJ,WAAW,GAAG,UAAU,GAAG,OAAO,QAAQ;GAC1C,YAAY;GACZ,MAAM;GACN,OAAO,YAAY,EAAE,iBAAiB,EAAE,cAAc,WAAW,CAAC,IAAI;EACvE,CAAA,GACA,CAAC,YACA,IAAC,UAAD;GACE,MAAK;GACL,SAAS;GACT,eAAa,GAAG,OAAO;GACvB,cAAY,GAAG,EAAE,wBAAwB,EAAE,cAAc,QAAQ,CAAC,EAAE,GAAG;GACvE,WAAU;GAEV,UAAA,IAAC,OAAD;IAAO,WAAU;IAAW,eAAA;GAAa,CAAA;EACnC,CAAA,CAEN;;AAEV"}
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { l as cn } from "./use-theme-dnE3Od3I.js";
|
|
2
2
|
import { l as useLinkComponent, m as PopoverTrigger, p as PopoverContent, u as Popover } from "./toaster-Ct_YHGs6.js";
|
|
3
3
|
import { t as Button } from "./button-MWVeZaqj.js";
|
|
4
|
-
import {
|
|
4
|
+
import { D as CommandItem, E as CommandInput, O as CommandList, S as Command, a as namesHiddenField, b as LoadError, m as useRowTitle, r as RelationViewButton, t as RelationCreateButton, w as CommandEmpty } from "./relation-create-6WicROWA.js";
|
|
5
5
|
import { t as Skeleton } from "./skeleton-U2noefj5.js";
|
|
6
|
-
import { t as LazyRelationPickerDialog } from "./lazy-relation-picker-dialog-
|
|
7
|
-
import { t as useRelationSelect } from "./relation-select-
|
|
6
|
+
import { t as LazyRelationPickerDialog } from "./lazy-relation-picker-dialog-BaORufxQ.js";
|
|
7
|
+
import { t as useRelationSelect } from "./relation-select-CjQT9LpS.js";
|
|
8
|
+
import { r as useRowSubtitle, t as optionSubtitle } from "./use-record-subtitle-w3ZhXNlf.js";
|
|
8
9
|
import { composeListFilter, normalizeFixedFilters, relationOpenOf, resolveResourceLabel, resourceKey, routeResourceKey } from "@burojs/core";
|
|
9
10
|
import { useApp, useI18nCaps, useList, useOptionalT, useRelatedRecord } from "@burojs/react";
|
|
10
11
|
import { IconCheck, IconChevronDown, IconLoader2 } from "@tabler/icons-react";
|
|
@@ -12,7 +13,7 @@ import * as React from "react";
|
|
|
12
13
|
import { Suspense, lazy } from "react";
|
|
13
14
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
14
15
|
//#region src/fields/lazy-candidates-picker.tsx
|
|
15
|
-
const CandidatesRelationPicker = lazy(() => import("./candidates-relation-picker-
|
|
16
|
+
const CandidatesRelationPicker = lazy(() => import("./candidates-relation-picker-QvoY2bOQ.js").then((module) => ({ default: module.CandidatesRelationPicker })));
|
|
16
17
|
function LazyCandidatesRelationPicker(props) {
|
|
17
18
|
return jsx(Suspense, {
|
|
18
19
|
fallback: jsx(Skeleton, {
|
|
@@ -26,13 +27,14 @@ function LazyCandidatesRelationPicker(props) {
|
|
|
26
27
|
//#endregion
|
|
27
28
|
//#region src/fields/relation-picker.tsx
|
|
28
29
|
const DEBOUNCE_MS = 250;
|
|
29
|
-
function RelationPicker({ to: toInput, value, onChange, by, searchField, pageSize = 10, clearable = true, placeholder, name, id, testid, fixedFilters, createSeeds, candidatesGate, rowFits, fieldName, open: openMode, scope = "context", disabled, required, className, ariaInvalid, ariaDescribedBy, ariaErrorMessage }) {
|
|
30
|
+
function RelationPicker({ to: toInput, value, onChange, by, searchField, pageSize = 10, clearable = true, placeholder, name, id, testid, fixedFilters, createSeeds, candidatesGate, rowFits, fieldName, open: openMode, optionSubtitle: optionSubtitle$1, scope = "context", disabled, required, className, ariaInvalid, ariaDescribedBy, ariaErrorMessage, ariaLabelledBy }) {
|
|
30
31
|
const to = routeResourceKey(toInput);
|
|
31
32
|
const app = useApp();
|
|
32
33
|
const caps = useI18nCaps();
|
|
33
34
|
const t = useOptionalT();
|
|
34
35
|
const targetDef = app.registry.get(to);
|
|
35
|
-
const rowTitle = useRowTitle(to, targetDef?.displayField);
|
|
36
|
+
const rowTitle = useRowTitle(to, targetDef?.displayField, { recordTitle: true });
|
|
37
|
+
const rowSubtitle = useRowSubtitle(to, optionSubtitle$1);
|
|
36
38
|
const targetLabel = resolveResourceLabel(caps, to, "single", targetDef).toLowerCase();
|
|
37
39
|
const RouterLink = useLinkComponent();
|
|
38
40
|
const tid = testid ?? `relation-picker:${to}`;
|
|
@@ -266,6 +268,8 @@ function RelationPicker({ to: toInput, value, onChange, by, searchField, pageSiz
|
|
|
266
268
|
}),
|
|
267
269
|
jsxs(CommandList, {
|
|
268
270
|
"data-testid": `${childPrefix}:list`,
|
|
271
|
+
label: targetLabel,
|
|
272
|
+
...ariaLabelledBy ? { "aria-labelledby": ariaLabelledBy } : {},
|
|
269
273
|
children: [
|
|
270
274
|
isLoading && jsxs("div", {
|
|
271
275
|
className: "flex items-center justify-center gap-2 py-6 text-sm text-muted-foreground",
|
|
@@ -294,6 +298,7 @@ function RelationPicker({ to: toInput, value, onChange, by, searchField, pageSiz
|
|
|
294
298
|
if (rowId === null || rowId === void 0 || rowId === "") return null;
|
|
295
299
|
const idStr = String(rowId);
|
|
296
300
|
const label = rowTitle(row);
|
|
301
|
+
const subtitle = optionSubtitle(rowSubtitle(row), label, idStr);
|
|
297
302
|
const isSelected = value != null && String(value) === idStr;
|
|
298
303
|
return jsxs(CommandItem, {
|
|
299
304
|
value: `${label} ${idStr}`,
|
|
@@ -308,9 +313,9 @@ function RelationPicker({ to: toInput, value, onChange, by, searchField, pageSiz
|
|
|
308
313
|
className: "truncate",
|
|
309
314
|
children: label
|
|
310
315
|
}),
|
|
311
|
-
|
|
316
|
+
subtitle === null ? null : jsx("span", {
|
|
312
317
|
className: "ml-auto shrink-0 pl-2 text-xs text-muted-foreground",
|
|
313
|
-
children:
|
|
318
|
+
children: subtitle
|
|
314
319
|
})
|
|
315
320
|
]
|
|
316
321
|
}, idStr);
|
|
@@ -426,8 +431,9 @@ function RelationPickerInput(props) {
|
|
|
426
431
|
}
|
|
427
432
|
function FieldRelationPicker({ props, to, extra }) {
|
|
428
433
|
const { name, id, value, onChange, testid, field, disabled, required, relationSeeds } = props;
|
|
429
|
-
const { ariaInvalid, ariaDescribedBy, ariaErrorMessage } = props;
|
|
434
|
+
const { ariaInvalid, ariaDescribedBy, ariaErrorMessage, ariaLabelledBy } = props;
|
|
430
435
|
const meta = field?.meta;
|
|
436
|
+
const subtitle = props.optionSubtitle;
|
|
431
437
|
return jsx(RelationPicker, {
|
|
432
438
|
to,
|
|
433
439
|
value,
|
|
@@ -444,14 +450,16 @@ function FieldRelationPicker({ props, to, extra }) {
|
|
|
444
450
|
...relationSeeds === void 0 ? {} : { createSeeds: relationSeeds },
|
|
445
451
|
fieldName: field?.name ?? name,
|
|
446
452
|
open: relationOpenOf(field ?? {}),
|
|
453
|
+
...subtitle === void 0 ? {} : { optionSubtitle: subtitle },
|
|
447
454
|
disabled,
|
|
448
455
|
required,
|
|
449
456
|
ariaInvalid,
|
|
450
457
|
ariaDescribedBy,
|
|
451
|
-
ariaErrorMessage
|
|
458
|
+
ariaErrorMessage,
|
|
459
|
+
...ariaLabelledBy === void 0 ? {} : { ariaLabelledBy }
|
|
452
460
|
});
|
|
453
461
|
}
|
|
454
462
|
//#endregion
|
|
455
463
|
export { RelationPicker as n, RelationPickerInput as r, FieldRelationPicker as t };
|
|
456
464
|
|
|
457
|
-
//# sourceMappingURL=relation-picker-
|
|
465
|
+
//# sourceMappingURL=relation-picker-BbO41cFV.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"relation-picker-BbO41cFV.js","names":["optionSubtitle","optionSubtitleText"],"sources":["../src/fields/lazy-candidates-picker.tsx","../src/fields/relation-picker.tsx"],"sourcesContent":["import { type ReactElement, Suspense, lazy } from 'react';\nimport type { FieldInputProps } from './registry.js';\nimport { Skeleton } from '../primitives/skeleton.js';\n\nconst CandidatesRelationPicker = lazy(() =>\n import('./candidates-relation-picker.js').then((module) => ({\n default: module.CandidatesRelationPicker,\n })),\n);\n\n/**\n * A relation select whose field declares `candidates`: the candidates path is a chunk of its own,\n * so a form without candidates never loads it. Until it arrives a skeleton stands in; no read\n * is sent for the options meanwhile.\n */\nexport function LazyCandidatesRelationPicker(props: FieldInputProps): ReactElement {\n return (\n <Suspense\n fallback={\n <Skeleton\n data-buro-skeleton=\"\"\n data-testid=\"relation-candidates-loading\"\n className=\"h-9 w-full\"\n />\n }\n >\n <CandidatesRelationPicker {...props} />\n </Suspense>\n );\n}\n","'use client';\n\nimport * as React from 'react';\nimport { IconCheck, IconChevronDown, IconLoader2 } from '@tabler/icons-react';\nimport {\n composeListFilter,\n normalizeFixedFilters,\n resolveResourceLabel,\n resourceKey,\n type ErasedResourceHandle,\n type FilterExpression,\n type FixedFilterInput,\n type RelationOpen,\n relationOpenOf,\n type ResourceRefInput,\n type ScopeSource,\n routeResourceKey,\n type ResourceNameOrRef,\n} from '@burojs/core';\nimport { useApp, useI18nCaps, useList, useOptionalT, useRelatedRecord } from '@burojs/react';\nimport { LoadError } from '../load-error/load-error-view.js';\nimport type { CandidatesGate } from './candidates-gate.js';\nimport { namesHiddenField } from './search-access.js';\nimport {\n optionSubtitle as optionSubtitleText,\n type RecordSubtitleFn,\n useRowSubtitle,\n} from '../resource/use-record-subtitle.js';\nimport { useRowTitle } from '../resource/use-row-title.js';\nimport { cn } from '../lib/cn.js';\nimport { useLinkComponent } from '../layout/link-component.js';\nimport { Button } from '../primitives/button.js';\nimport {\n Command,\n CommandEmpty,\n CommandInput,\n CommandItem,\n CommandList,\n} from '../primitives/command.js';\nimport { Popover, PopoverContent, PopoverTrigger } from '../primitives/popover.js';\nimport { LazyCandidatesRelationPicker } from './lazy-candidates-picker.js';\nimport { LazyRelationPickerDialog } from './lazy-relation-picker-dialog.js';\nimport { RelationCreateButton } from './relation-create.js';\nimport { useRelationSelect } from './relation-select.js';\nimport { RelationViewButton } from './relation-view-button.js';\nimport type { FieldInputProps } from './registry.js';\n\n/** The portable erased AST — the only `fixedFilters` shape this module deals in. */\ntype ErasedExpression = FilterExpression<ErasedResourceHandle>;\n\n/**\n * Single-select relation picker (Relations item 2, v1).\n *\n * Renders a dropdown trigger labelled with the currently-selected\n * record's display name. Clicking opens a popover containing:\n * - a debounced search input that filters target rows by `searchField`\n * (defaults to the target's `displayField`) using the data\n * provider's `contains` operator,\n * - up to `pageSize` (default 10) result rows,\n * - a \"Clear\" button when `clearable` is true and a value is set,\n * - a \"View all\" link to the target's standalone list page so\n * operators can fall back to the full list when the inline search\n * can't find what they need.\n *\n * Multi-select / fuller modal / quick-create are deferred to v2 — see\n * docs/superpowers/specs/2026-05-04-relation-picker.md.\n *\n * Failure modes (mirrors RelationDisplay's fail-soft policy):\n * - target not registered → trigger renders the raw value, picker\n * is disabled. Caller still gets onChange(null) only via clear.\n * - useList errors → popover shows muted \"Failed to load\" with the\n * error message in the title; \"View all\" still works.\n * - target row for `value` not found → trigger shows the raw id\n * (so the operator can at least see what was stored).\n */\n\nexport interface RelationPickerProps<N extends string = string> {\n /** Target resource name (matches `f.relation({ to: '...' })`). */\n to: ResourceNameOrRef<N>;\n /** Currently-selected FK value, or null/undefined when empty. */\n value: string | number | null | undefined;\n /** Called with the new selected id (or `by` value), or null when cleared. */\n onChange: (next: string | number | null) => void;\n /**\n * The target field the value holds (`meta.by`, spec 4.2): options write `row[by]` and the\n * selected value is resolved by it. Absent: the target's id field.\n */\n by?: string;\n /**\n * Field whose value is matched against the search text. Defaults to\n * the target's `displayField` (which is what the trigger label\n * already shows, so it's the natural search target).\n */\n searchField?: string;\n /** Initial fetch / max visible rows. Defaults to 10. */\n pageSize?: number;\n /** Show a clear button. Defaults to true. */\n clearable?: boolean;\n /** Trigger placeholder when value is empty. */\n placeholder?: string;\n /** HTML name attribute for the trigger button. */\n name?: string;\n /** HTML id attribute. */\n id?: string;\n /** Test-id override. Defaults to `relation-picker:<to>`. */\n testid?: string;\n /**\n * Extra filters ANDed onto every query (inline popover + advanced modal) —\n * the same `FixedFilterInput` shape `useResourceList` takes: a bare AST\n * expression (`@burojs/core`'s `FilterExpression`, e.g.\n * `{ field: 'is_active', op: 'eq', value: true }`), or `{ filter, lock?,\n * label? }` for finer control. A bare expression defaults to `lock: true`\n * — the field is hidden from the modal's filter builder, with no badge —\n * which is what keeps the picker from ever offering an out-of-scope\n * record. Pass `{ filter, lock: false }` to keep the field open to the\n * user, and add `label` to render it as an undeletable badge instead.\n */\n fixedFilters?: readonly FixedFilterInput[];\n /**\n * The trusted `defaults` of a create opened from this select (P6-31): the registry field's\n * static `eq` literals, handed down by the form controller. Never read from `fixedFilters` or\n * `field.meta`.\n */\n createSeeds?: Readonly<Record<string, unknown>>;\n /**\n * What the field's `candidates` say about reading the target right now (P7 3.4): `pending`\n * draws a disabled trigger, `empty` a popover that says what to choose first, `forbidden` a\n * disabled trigger and why. While set, nothing is read for the options. Absent: read normally.\n */\n candidatesGate?: CandidatesGate;\n /**\n * Whether a loaded row fits the resolved candidate filters (already in `fixedFilters`):\n * `false` makes the field say the chosen row \"does not match the current filter\" (P7 3.4).\n */\n rowFits?: (row: Record<string, unknown>) => boolean | undefined;\n /** The form field holding the key (the \"view\" and \"+ create\" test ids); defaults to `name`. */\n fieldName?: string;\n /** The field's `ui.open` (P7 3.6): what the \"view\" button opens, or no button for `none`. */\n open?: RelationOpen;\n /**\n * The options' second line over the target row (a relation field's `optionSubtitle`): wins over\n * the target's `recordSubtitle`; without either, `#<id>`.\n */\n optionSubtitle?: RecordSubtitleFn;\n /**\n * The read scope of the option reads (the popover, \"Advanced search\" and the create hand-back).\n * Default `'context'`: the record around the picker narrows its options, except by the field\n * the picker itself edits (`fieldName`, else `name`). `'none'` reads every row the provider\n * allows; `'session'` the session's scope selection.\n */\n scope?: ScopeSource;\n disabled?: boolean;\n required?: boolean;\n className?: string;\n /** Forwarded to the trigger button when the field is in an invalid state. */\n ariaInvalid?: boolean;\n /** Forwarded to the trigger button as `aria-describedby` (help text only; error id goes via ariaErrorMessage). */\n ariaDescribedBy?: string;\n /** Forwarded to the trigger button as `aria-errormessage` (WAI-ARIA 1.2). */\n ariaErrorMessage?: string;\n /** Id of the field's label element: the option list is named by it, else by the target's name. */\n ariaLabelledBy?: string;\n}\n\nconst DEBOUNCE_MS = 250;\n\nexport function RelationPicker<const N extends string = string>({\n to: toInput,\n value,\n onChange,\n by,\n searchField,\n pageSize = 10,\n clearable = true,\n placeholder,\n name,\n id,\n testid,\n fixedFilters,\n createSeeds,\n candidatesGate,\n rowFits,\n fieldName,\n open: openMode,\n optionSubtitle,\n scope = 'context',\n disabled,\n required,\n className,\n ariaInvalid,\n ariaDescribedBy,\n ariaErrorMessage,\n ariaLabelledBy,\n}: RelationPickerProps<N>): React.ReactElement {\n const to = routeResourceKey(toInput);\n const app = useApp();\n const caps = useI18nCaps();\n const t = useOptionalT();\n const targetDef = app.registry.get(to);\n const rowTitle = useRowTitle(to, targetDef?.displayField, { recordTitle: true });\n const rowSubtitle = useRowSubtitle(to, optionSubtitle);\n // Lowercased: the label sits mid-sentence in «Select location…».\n const targetLabel = resolveResourceLabel(caps, to, 'single', targetDef).toLowerCase();\n const RouterLink = useLinkComponent();\n // Trigger testid honours the prop override (so callers like\n // the record form get a deterministic per-field id like\n // `form-field-input:<resource>:<view>:<field>`), but child elements\n // (search, options, view-all, clear) keep a stable per-target prefix\n // so e2e tests don't have to know the parent form's testid path.\n const tid = testid ?? `relation-picker:${to}`;\n const childPrefix = `relation-picker:${to}`;\n\n const triggerRef = React.useRef<HTMLButtonElement | null>(null);\n // An overlay opened from this select returns focus to the trigger when it closes: the shell\n // records the focused element as it mounts.\n const focusTrigger = React.useCallback(() => triggerRef.current?.focus(), []);\n const [open, setOpen] = React.useState(false);\n const [dialogOpen, setDialogOpen] = React.useState(false);\n // The dialog is mounted on its first open, and only while no candidates gate holds the read:\n // without the candidate filters it would list rows the field must not offer.\n const gated = candidatesGate !== undefined;\n const [dialogMounted, setDialogMounted] = React.useState(false);\n React.useEffect(() => {\n if (gated) setDialogOpen(false);\n }, [gated]);\n React.useEffect(() => {\n if (dialogOpen) setDialogMounted(true);\n }, [dialogOpen]);\n const [search, setSearch] = React.useState('');\n const [debouncedSearch, setDebouncedSearch] = React.useState('');\n\n // Debounce the search text so each keystroke doesn't fire a request —\n // react-query will dedup but the popover can flicker.\n React.useEffect(() => {\n const handle = setTimeout(() => setDebouncedSearch(search), DEBOUNCE_MS);\n return () => clearTimeout(handle);\n }, [search]);\n\n // Reset search when the popover closes so reopening starts clean.\n React.useEffect(() => {\n if (!open) {\n setSearch('');\n setDebouncedSearch('');\n }\n }, [open]);\n\n // Trigger label: fetch the currently-selected target row to show its\n // display name. Skipped when value is empty (useRelatedRecord handles\n // that). Same hook RelationDisplay uses, so the cache is shared.\n // An input resolves the selected value whatever the field's `resolve` says (spec 4.3).\n const { record: selectedRecord, isLoading: selectedLoading } = useRelatedRecord(\n to,\n value,\n by === undefined ? undefined : { by },\n );\n // The record field this picker writes: a record's own scope field never narrows its options.\n const scopeField = fieldName ?? name;\n // The value field, the search set and the select's one pending create, shared by the popover\n // and the \"Advanced search\" dialog (and by `useRelationPicker`).\n const {\n access,\n valueField,\n searchDecl,\n create,\n reader: createReader,\n } = useRelationSelect({\n to,\n by,\n searchField,\n fixedFilters,\n scope,\n scopeField,\n held: gated,\n // As a pick does: the value is written and the \"Advanced search\" dialog, when the create\n // came from it, is done.\n onValue: (picked) => {\n onChange(picked);\n setDialogOpen(false);\n },\n });\n const accessReady = access.status === 'ready';\n // List the picker options. `useList` returns `{ data: { data, total } }`.\n //\n // Composed through the SAME `composeListFilter` core the dialog\n // (`RelationPickerDialog`/`useDialogFilterState`) and the list page use —\n // this popover is a distinct composition SITE (fixed scope + free-text\n // search only, no builder group), not a second set of rules. Search\n // resolution mirrors the dialog's: the target's declared\n // `views.list.search` always wins; the `searchField` prop, else\n // `displayField`, else `'name'` is the fallback (`useRelationSelect`),\n // wrapped as a single-field declaration so it goes through the exact same\n // `searchToFilter` path a real declaration would. Before this, the popover\n // hand-rolled `{ field: <search field>, op: 'contains', value }`\n // unconditionally, ignoring a declared `views.list.search` entirely — one\n // control (popover vs. \"advanced search\") giving two different answers\n // for the same typed text.\n const filter = React.useMemo<ErasedExpression | undefined>(\n () =>\n composeListFilter({\n fixed: normalizeFixedFilters(fixedFilters),\n search: debouncedSearch,\n searchDecl,\n searchContext: { resource: to, def: targetDef },\n }),\n [fixedFilters, debouncedSearch, searchDecl, to, targetDef],\n );\n // An author predicate or a function search naming a hidden field forbids the read.\n const blocked =\n !accessReady ||\n candidatesGate !== undefined ||\n namesHiddenField(filter, (name) => access.fieldVisible(name));\n\n const listQuery = useList(to, {\n ...(filter ? { filter } : {}),\n pagination: { kind: 'offset', page: 1, pageSize },\n scope,\n ...(scopeField === undefined ? {} : { scopeField }),\n enabled: open && targetDef != null && !blocked,\n });\n\n const rows = (listQuery.data?.data ?? []) as Array<{ id: unknown } & Record<string, unknown>>;\n // ⚠️ The rows the popover already loaded are a better label source than a\n // second round-trip. `selectedRecord` comes from the batched relation\n // aggregator; immediately after picking an option that batch has not\n // resolved the new id yet, so the trigger fell through to its raw-id\n // fallback and showed «4» instead of «Finished goods warehouse». The picker\n // is holding the chosen record in `rows` — use it.\n const triggerLabel = renderTriggerLabel({\n rowTitle,\n optionRows: rows,\n valueField,\n value,\n selectedRecord,\n selectedLoading,\n targetDef,\n targetLabel,\n placeholder,\n t,\n });\n\n // Target not registered — degrade gracefully: render a disabled\n // trigger with the raw value so the operator can still SEE the\n // stored FK, but they can't pick a new one because we have no\n // basePath to drive a \"View all\" link or a useList query.\n if (!targetDef) {\n if (process.env.NODE_ENV !== 'production') {\n // eslint-disable-next-line no-console\n console.warn(`[RelationPicker] target resource '${to}' not registered — picker disabled`);\n }\n return (\n <Button\n type=\"button\"\n variant=\"outline\"\n disabled\n data-testid={`${childPrefix}:unregistered`}\n className={cn('w-full justify-between font-normal', className)}\n name={name}\n id={id}\n aria-required={required}\n >\n <span className=\"truncate text-muted-foreground\">\n {value == null || value === ''\n ? (placeholder ?? t('field.select', { defaultValue: 'Select…' }))\n : String(value)}\n </span>\n <IconChevronDown className=\"h-4 w-4 opacity-50\" aria-hidden />\n </Button>\n );\n }\n\n // The candidates say the target must not be read yet (P7 3.4): a disabled trigger, no popover.\n if (candidatesGate?.kind === 'pending') {\n return (\n <Button\n type=\"button\"\n variant=\"outline\"\n disabled\n data-testid={tid}\n data-buro-candidates=\"pending\"\n className={cn('w-full justify-between font-normal', className)}\n name={name}\n id={id}\n aria-required={required}\n aria-busy=\"true\"\n >\n <span className=\"truncate text-muted-foreground\">{triggerLabel}</span>\n <IconLoader2 className=\"h-4 w-4 shrink-0 animate-spin opacity-50\" aria-hidden />\n </Button>\n );\n }\n if (candidatesGate?.kind === 'forbidden') {\n return (\n <div className=\"flex flex-col gap-1\">\n <Button\n type=\"button\"\n variant=\"outline\"\n disabled\n data-testid={tid}\n data-buro-candidates=\"forbidden\"\n className={cn('w-full justify-between font-normal', className)}\n name={name}\n id={id}\n aria-required={required}\n aria-describedby={candidatesGate.testId}\n >\n <span className={cn('truncate text-left', value == null && 'text-muted-foreground')}>\n {triggerLabel}\n </span>\n <IconChevronDown className=\"h-4 w-4 shrink-0 opacity-50\" aria-hidden />\n </Button>\n <p\n id={candidatesGate.testId}\n data-testid={candidatesGate.testId}\n className=\"text-xs text-muted-foreground\"\n >\n {candidatesGate.message}\n </p>\n </div>\n );\n }\n\n const targetBasePath = targetDef.basePath ?? `/${to}`;\n // The chosen row stays as it is when it falls outside the candidates; the field says so.\n const outside =\n rowFits !== undefined &&\n value != null &&\n value !== '' &&\n selectedRecord != null &&\n rowFits(selectedRecord as Record<string, unknown>) === false;\n const isLoading = listQuery.isLoading || listQuery.isFetching;\n const error = listQuery.isError ? (listQuery.error as unknown as Error) : null;\n\n function handleSelect(rowId: unknown): void {\n // IDs arrive as strings or numbers depending on the data provider.\n // Pass through as-is so callers can compare to their\n // schema (e.g. UUID strings stay strings).\n onChange(rowId as string | number);\n setOpen(false);\n }\n\n function handleClear(): void {\n onChange(null);\n setOpen(false);\n }\n\n return (\n <Popover open={open} onOpenChange={setOpen}>\n <div className=\"flex items-center gap-1\">\n <PopoverTrigger asChild>\n <Button\n ref={triggerRef}\n type=\"button\"\n variant=\"outline\"\n role=\"combobox\"\n aria-expanded={open}\n aria-haspopup=\"listbox\"\n aria-required={required}\n aria-invalid={ariaInvalid || undefined}\n aria-describedby={ariaDescribedBy}\n {...(ariaErrorMessage ? { 'aria-errormessage': ariaErrorMessage } : {})}\n disabled={disabled}\n data-testid={tid}\n name={name}\n id={id}\n className={cn('w-full justify-between font-normal', className)}\n >\n <span className={cn('truncate text-left', value == null && 'text-muted-foreground')}>\n {triggerLabel}\n </span>\n <IconChevronDown className=\"h-4 w-4 shrink-0 opacity-50\" aria-hidden />\n </Button>\n </PopoverTrigger>\n {!disabled && (\n <RelationViewButton\n to={to}\n value={value}\n by={by}\n fieldName={fieldName ?? name ?? to}\n beforeOpen={focusTrigger}\n {...(openMode === undefined ? {} : { open: openMode })}\n />\n )}\n </div>\n {outside && (\n <p\n className=\"mt-1 text-xs text-muted-foreground\"\n data-testid={`${childPrefix}:not-matching`}\n >\n {t('relationPicker.notMatching', { defaultValue: 'Does not match the current filter' })}\n </p>\n )}\n <PopoverContent className=\"w-[var(--radix-popover-trigger-width)] p-0\" align=\"start\">\n {candidatesGate?.kind === 'empty' ? (\n <p\n className=\"px-3 py-6 text-center text-sm text-muted-foreground\"\n data-testid={candidatesGate.testId}\n >\n {candidatesGate.message}\n </p>\n ) : (\n /* shouldFilter={false}: cmdk's built-in client filter is disabled\n because filtering happens server-side via useList's `contains`\n operator. cmdk still drives keyboard navigation, focus,\n highlighted-item state, and Enter-to-select. */\n <Command shouldFilter={false}>\n {searchDecl !== undefined && (\n <CommandInput\n value={search}\n onValueChange={setSearch}\n placeholder={t('toolbar.search', {\n params: { name: targetLabel },\n defaultValue: `Search ${targetLabel}…`,\n })}\n data-testid={`${childPrefix}:search`}\n aria-label={t('toolbar.search', {\n params: { name: targetLabel },\n defaultValue: `Search ${targetLabel}`,\n })}\n />\n )}\n <CommandList\n data-testid={`${childPrefix}:list`}\n // cmdk's `label` is the list's `aria-label` (default \"Suggestions\"): the field's label\n // element names the list, the target's name is the fallback.\n label={targetLabel}\n {...(ariaLabelledBy ? { 'aria-labelledby': ariaLabelledBy } : {})}\n >\n {isLoading && (\n <div\n className=\"flex items-center justify-center gap-2 py-6 text-sm text-muted-foreground\"\n data-testid={`${childPrefix}:loading`}\n >\n <IconLoader2 className=\"h-4 w-4 animate-spin\" aria-hidden />\n <span>{t('table.loading', { defaultValue: 'Loading…' })}</span>\n </div>\n )}\n {!isLoading && error && (\n <LoadError\n surface=\"picker\"\n error={error}\n testId={`${childPrefix}:error`}\n className=\"block px-3 py-6 text-center text-sm text-muted-foreground\"\n fallback={{ key: 'relation.failed', default: 'Failed to load options.' }}\n />\n )}\n {!isLoading && !error && rows.length === 0 && (\n <CommandEmpty data-testid={`${childPrefix}:empty`}>\n {t('relation.noResults', { defaultValue: 'No results.' })}\n </CommandEmpty>\n )}\n {!isLoading &&\n !error &&\n rows.map((row) => {\n const rowId = row[valueField];\n // A row without the value the field stores cannot be chosen (no fallback to id).\n if (rowId === null || rowId === undefined || rowId === '') return null;\n const idStr = String(rowId);\n const label = rowTitle(row);\n const subtitle = optionSubtitleText(rowSubtitle(row), label, idStr);\n const isSelected = value != null && String(value) === idStr;\n return (\n <CommandItem\n key={idStr}\n // cmdk uses `value` for keyboard-search semantics;\n // setting it to `${label} ${idStr}` lets users type\n // either the label OR the id and the highlighted\n // option still tracks correctly across renders.\n value={`${label} ${idStr}`}\n data-testid={`${childPrefix}:option:${idStr}`}\n onSelect={() => handleSelect(rowId)}\n >\n <IconCheck\n className={cn(\n 'mr-2 h-4 w-4 shrink-0',\n isSelected ? 'opacity-100' : 'opacity-0',\n )}\n aria-hidden\n />\n <span className=\"truncate\">{label}</span>\n {/* The declared subtitle, else `#<id>` unless the label already is the id\n (REF-40). */}\n {subtitle === null ? null : (\n <span className=\"ml-auto shrink-0 pl-2 text-xs text-muted-foreground\">\n {subtitle}\n </span>\n )}\n </CommandItem>\n );\n })}\n </CommandList>\n {/* Wraps at narrow widths: four actions do not fit one line of a small popover. */}\n <div className=\"flex flex-wrap items-center justify-between gap-x-2 gap-y-1 border-t px-3 py-2 text-sm\">\n {clearable && value != null && value !== '' ? (\n <button\n type=\"button\"\n onClick={handleClear}\n data-testid={`${childPrefix}:clear`}\n className=\"text-muted-foreground hover:text-foreground focus:outline-hidden focus-visible:underline\"\n >\n {t('relationPicker.clear', { defaultValue: 'Clear' })}\n </button>\n ) : (\n <span aria-hidden />\n )}\n <div className=\"flex flex-wrap items-center gap-x-3 gap-y-1\">\n {/* #11 — escalation to the full-list modal: search + sort +\n paginate + create, for when the inline popover isn't enough. */}\n <button\n type=\"button\"\n onClick={() => {\n setOpen(false);\n setDialogOpen(true);\n }}\n data-testid={`${childPrefix}:advanced`}\n className=\"text-foreground hover:underline focus:outline-hidden focus-visible:underline\"\n >\n {t('relationPicker.advancedSearch', { defaultValue: 'Advanced search' })}\n </button>\n {!disabled && (\n <RelationCreateButton\n to={to}\n fieldName={fieldName ?? name ?? to}\n create={create}\n seeds={createSeeds}\n search={search}\n beforeOpen={() => {\n setOpen(false);\n focusTrigger();\n }}\n className=\"text-foreground hover:underline focus:outline-hidden focus-visible:underline disabled:opacity-50\"\n />\n )}\n <RouterLink\n href={targetBasePath}\n data-testid={`${childPrefix}:view-all`}\n className=\"text-muted-foreground hover:text-foreground hover:underline focus:outline-hidden focus-visible:underline\"\n >\n {t('relationPicker.viewAll', { defaultValue: 'Open list' })} →\n </RouterLink>\n </div>\n </div>\n </Command>\n )}\n </PopoverContent>\n {/*\n The RAW `searchField` prop, not the resolved fallback — the dialog\n (Task 5, SP3) does its OWN target-declaration → prop → displayField\n resolution via `useDialogFilterState`, so handing it an already-\n resolved value here would just have this component's own\n `displayField ?? 'name'` fallback (built for the POPOVER's simpler\n contains-only search) silently stand in for the dialog's, rather\n than letting the target's declared `views.list.search` win when the\n caller passed no override at all.\n */}\n {dialogMounted && !gated && (\n <LazyRelationPickerDialog\n to={to}\n open={dialogOpen}\n onOpenChange={setDialogOpen}\n onSelect={(rowId) => onChange(rowId)}\n valueField={valueField}\n searchField={searchField}\n fixedFilters={fixedFilters}\n scope={scope}\n {...(scopeField === undefined ? {} : { scopeField })}\n {...(disabled ? {} : { create })}\n createSeeds={createSeeds}\n fieldName={fieldName ?? name ?? to}\n onBeforeCreate={focusTrigger}\n />\n )}\n {createReader}\n </Popover>\n );\n}\n\ninterface TriggerLabelArgs {\n value: string | number | null | undefined;\n selectedRecord: ReturnType<typeof useRelatedRecord>['record'];\n selectedLoading: boolean;\n /** Rows already loaded for the popover; used as a same-tick label source. */\n optionRows?: Array<{ id: unknown } & Record<string, unknown>>;\n /** The row field the value holds (`by`, else the id field). */\n valueField: string;\n targetDef: ReturnType<ReturnType<typeof useApp>['registry']['get']>;\n /** The resolved, lowercased target label. */\n targetLabel: string;\n placeholder?: string;\n /** The row title under the viewer's field view (id when the display field is hidden). */\n rowTitle: (row: Record<string, unknown>) => string;\n t: (key: string, options?: { params?: Record<string, unknown>; defaultValue?: string }) => string;\n}\n\nfunction renderTriggerLabel({\n value,\n selectedRecord,\n selectedLoading,\n targetLabel,\n placeholder,\n optionRows,\n valueField,\n t,\n rowTitle,\n}: TriggerLabelArgs): React.ReactNode {\n if (value == null || value === '') {\n return (\n placeholder ??\n t('relation.select', {\n params: { name: targetLabel },\n defaultValue: `Select ${targetLabel}…`,\n })\n );\n }\n if (selectedLoading) {\n return t('table.loading', { defaultValue: 'Loading…' });\n }\n if (selectedRecord) {\n return rowTitle(selectedRecord);\n }\n // Not resolved by the aggregator yet (or at all). If the popover already\n // loaded this record as an option — which it always has right after the\n // user picked it — label from that instead of showing a bare id.\n const fromOptions = optionRows?.find((r) => String(r[valueField]) === String(value));\n if (fromOptions) {\n return rowTitle(fromOptions);\n }\n // Genuinely unknown (404 / not in the loaded page) — show the raw id so the\n // operator can at least see what was stored.\n return String(value);\n}\n\n/**\n * Form-field adapter wrapping `<RelationPicker>` for use as a default\n * Input renderer in the field registry. Reads `field.meta.to` for the\n * target resource name. When `meta.to` is absent we degrade to a plain\n * (disabled) text representation of the value with a console warning —\n * same fail-soft as RelationDisplay.\n */\nexport function RelationPickerInput(props: FieldInputProps): React.ReactElement {\n const { name, id, value, testid, field, required } = props;\n const meta = field?.meta as { to?: ResourceRefInput; candidates?: unknown } | undefined;\n let to: string | undefined;\n try {\n to = meta?.to === undefined ? undefined : resourceKey(meta.to);\n } catch {\n to = undefined;\n }\n\n if (!to) {\n if (process.env.NODE_ENV !== 'production') {\n // eslint-disable-next-line no-console\n console.warn(\n `[RelationPickerInput] no meta.to on field '${field?.name ?? name}' — relation picker disabled`,\n );\n }\n return (\n <Button\n type=\"button\"\n variant=\"outline\"\n disabled\n data-testid={`${testid ?? `relation-picker:${name}`}:no-target`}\n className=\"w-full justify-between font-normal\"\n name={name}\n id={id}\n aria-required={required}\n >\n <span className=\"truncate text-muted-foreground\">\n {value == null || value === '' ? '—' : String(value)}\n </span>\n </Button>\n );\n }\n\n // The candidates path is loaded only for a field that declares candidates.\n if (Array.isArray(meta?.candidates) && meta.candidates.length > 0)\n return <LazyCandidatesRelationPicker {...props} />;\n return <FieldRelationPicker props={props} to={to} />;\n}\n\n/** The form field's props as `RelationPicker` takes them; `extra` carries the candidates' part. */\nexport function FieldRelationPicker({\n props,\n to,\n extra,\n}: {\n props: FieldInputProps;\n to: string;\n extra?: {\n fixedFilters: FieldInputProps['fixedFilters'];\n candidatesGate?: CandidatesGate;\n rowFits?: (row: Record<string, unknown>) => boolean | undefined;\n };\n}): React.ReactElement {\n const { name, id, value, onChange, testid, field, disabled, required, relationSeeds } = props;\n const { ariaInvalid, ariaDescribedBy, ariaErrorMessage, ariaLabelledBy } = props;\n const meta = field?.meta as\n | { by?: unknown; searchField?: string; scope?: ScopeSource }\n | undefined;\n const subtitle = props.optionSubtitle;\n return (\n <RelationPicker\n to={to}\n value={value as string | number | null | undefined}\n onChange={(v) => onChange(v)}\n {...(typeof meta?.by === 'string' ? { by: meta.by } : {})}\n name={name}\n id={id}\n testid={testid ?? `relation-picker:${to}`}\n searchField={meta?.searchField}\n {...(meta?.scope === undefined ? {} : { scope: meta.scope })}\n fixedFilters={extra === undefined ? props.fixedFilters : extra.fixedFilters}\n {...(extra?.candidatesGate === undefined ? {} : { candidatesGate: extra.candidatesGate })}\n {...(extra?.rowFits === undefined ? {} : { rowFits: extra.rowFits })}\n {...(relationSeeds === undefined ? {} : { createSeeds: relationSeeds })}\n fieldName={field?.name ?? name}\n open={relationOpenOf(field ?? {})}\n {...(subtitle === undefined ? {} : { optionSubtitle: subtitle })}\n disabled={disabled}\n required={required}\n ariaInvalid={ariaInvalid}\n ariaDescribedBy={ariaDescribedBy}\n ariaErrorMessage={ariaErrorMessage}\n {...(ariaLabelledBy === undefined ? {} : { ariaLabelledBy })}\n />\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;AAIA,MAAM,2BAA2B,WAC/B,OAAO,2CAAkC,CAAC,MAAM,YAAY,EAC1D,SAAS,OAAO,yBAClB,EAAE,CACJ;AAOA,SAAgB,6BAA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AAA,IAAY,CAAC,IAAI,EAAE,aAAa,cAAc;EACrE,WAAW,OAAO,QAAQ;EAC1B,MAAM,eAAe,SAAS,CAAC,CAAC;EAChC,GAAK,aAAa,KAAA,IAAY,CAAC,IAAI,EAAE,gBAAgB,SAAS;EACpD;EACA;EACG;EACI;EACC;EAClB,GAAK,mBAAmB,KAAA,IAAY,CAAC,IAAI,EAAE,eAAe;CAC3D,CAAA;AAEL"}
|
|
@@ -2,9 +2,9 @@ import { l as cn } from "./use-theme-dnE3Od3I.js";
|
|
|
2
2
|
import { t as Button } from "./button-MWVeZaqj.js";
|
|
3
3
|
import { t as Input } from "./input-CUPStzZO.js";
|
|
4
4
|
import { a as DialogFooter, i as DialogDescription, o as DialogHeader, r as DialogContent, s as DialogTitle, t as Dialog } from "./dialog-C123sVQ8.js";
|
|
5
|
-
import { m as useRowTitle, t as RelationCreateButton } from "./relation-create-
|
|
6
|
-
import { A as
|
|
7
|
-
import { t as useDialogFilterState } from "./use-dialog-filter-state-
|
|
5
|
+
import { m as useRowTitle, t as RelationCreateButton } from "./relation-create-6WicROWA.js";
|
|
6
|
+
import { A as TableHeader, E as TableBody, F as ResolvedFieldDisplay, O as TableCell, T as Table, j as TableRow, k as TableHead, t as FilterBuilder } from "./filter-builder-04nas3eq.js";
|
|
7
|
+
import { t as useDialogFilterState } from "./use-dialog-filter-state-CJoeY-1j.js";
|
|
8
8
|
import { columnName, declaredField, declaredText, enumNamespaceOf, enumValueText, fieldOptionText, resolveFieldLabel, resolveResourceLabel, routeResourceKey } from "@burojs/core";
|
|
9
9
|
import { recordKeyOf, useApp, useChromeT, useI18nCaps, useList, useListAccess, useOptionalT } from "@burojs/react";
|
|
10
10
|
import { IconArrowDown, IconArrowUp, IconCheck, IconChevronRight, IconLoader2, IconSearch, IconSelector } from "@tabler/icons-react";
|
|
@@ -25,7 +25,7 @@ function RelationPickerDialog({ to: toInput, open, onOpenChange, onSelect, onSel
|
|
|
25
25
|
defaultValue: fallback
|
|
26
26
|
}) ?? fallback ?? key;
|
|
27
27
|
const targetDef = app.registry.get(to);
|
|
28
|
-
const rowTitle = useRowTitle(to, targetDef?.displayField);
|
|
28
|
+
const rowTitle = useRowTitle(to, targetDef?.displayField, { recordTitle: true });
|
|
29
29
|
const declaredIdField = (targetDef?.data)?.idField;
|
|
30
30
|
const idField = typeof declaredIdField === "string" && declaredIdField.length > 0 ? declaredIdField : "id";
|
|
31
31
|
const valueField = valueFieldProp ?? idField;
|
|
@@ -398,4 +398,4 @@ function formatCell(value, field, enumOf) {
|
|
|
398
398
|
//#endregion
|
|
399
399
|
export { RelationPickerDialog };
|
|
400
400
|
|
|
401
|
-
//# sourceMappingURL=relation-picker-dialog-
|
|
401
|
+
//# sourceMappingURL=relation-picker-dialog-BgSG_8bU.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"relation-picker-dialog-BgSG_8bU.js","names":[],"sources":["../src/fields/relation-picker-dialog.tsx"],"sourcesContent":["'use client';\nimport * as React from 'react';\nimport {\n IconArrowDown,\n IconArrowUp,\n IconCheck,\n IconChevronRight,\n IconSelector,\n IconLoader2,\n IconSearch,\n} from '@tabler/icons-react';\nimport {\n type FixedFilterInput,\n type ScopeSource,\n declaredField,\n declaredText,\n enumNamespaceOf,\n enumValueText,\n fieldOptionText,\n resolveFieldLabel,\n resolveResourceLabel,\n routeResourceKey,\n type ResourceNameOrRef,\n columnName,\n} from '@burojs/core';\nimport {\n recordKeyOf,\n useApp,\n useChromeT,\n useI18nCaps,\n useList,\n useListAccess,\n useOptionalT,\n} from '@burojs/react';\nimport { useRowTitle } from '../resource/use-row-title.js';\nimport { ResolvedFieldDisplay } from './resolved-field.js';\nimport { cn } from '../lib/cn.js';\nimport { Button } from '../primitives/button.js';\nimport {\n Dialog,\n DialogContent,\n DialogDescription,\n DialogFooter,\n DialogHeader,\n DialogTitle,\n} from '../primitives/dialog.js';\nimport { Input } from '../primitives/input.js';\nimport {\n Table,\n TableBody,\n TableCell,\n TableHead,\n TableHeader,\n TableRow,\n} from '../primitives/table.js';\nimport { FilterBuilder } from '../list-kit/filter-builder/filter-builder.js';\nimport { useDialogFilterState } from './use-dialog-filter-state.js';\nimport { RelationCreateButton, type SelectCreate } from './relation-create.js';\n\nconst noop = (): void => undefined;\n\n/**\n * Advanced-search modal for the relation picker (#11 / #9). The inline popover\n * handles the quick \"type a few letters\" case; this dialog is the escalation:\n * the full target list with SEARCH, per-column FILTERS, SORTING and PAGINATION,\n * plus a \"Create\" shortcut. Resolved generically from the registry so it works\n * for any resource with no per-field wiring.\n *\n * #9 — compact, and the table area is a FIXED height so paging never resizes /\n * jumps the dialog; responsive down to mobile.\n */\nexport interface RelationPickerDialogProps<N extends string = string> {\n to: ResourceNameOrRef<N>;\n open: boolean;\n onOpenChange: (open: boolean) => void;\n onSelect: (value: string | number) => void;\n /** Optional: receives the FULL chosen row (for prefilling sibling fields). */\n onSelectRow?: (row: Record<string, unknown>) => void;\n /**\n * Fallback search field — an OVERRIDE, not a required prop. The search box\n * expands through `useDialogFilterState`, which resolves what to search in\n * this order:\n * 1. the TARGET resource's own `views.list.search` declaration, if any —\n * always wins, regardless of this prop;\n * 2. this `searchField` prop, when the target declares no search;\n * 3. the target's `displayField` (itself falling back to `'name'`), when\n * neither of the above is available.\n *\n * A resolver-shaped `SearchDecl` has no single field that could be named\n * here, and a target with no search declaration at all should still be\n * searchable somehow — hence the two-step fallback instead of requiring\n * this prop outright.\n */\n searchField?: string;\n /**\n * Which field of the chosen row `onSelect` returns. Defaults to the target's id\n * field (`data.idField`, else `id`: a normal FK relation). Set to another column (e.g. `gtin`) for \"relate by a non-id\n * value\" pickers — the core mechanic behind the playground GTIN field.\n */\n valueField?: string;\n /**\n * Optional extra filters ANDed into every query (e.g. scope by product\n * group) — the same `FixedFilterInput` shape `useResourceList` and\n * `RelationPickerProps.fixedFilters` take: a bare AST expression\n * (`@burojs/core`'s `FilterExpression`, defaulting to `lock: true`, no\n * badge), or `{ filter, lock?, label? }` for finer control. `lock: false`\n * leaves the field open in the builder instead of hiding it; `label`\n * renders it as an undeletable badge.\n */\n fixedFilters?: readonly FixedFilterInput[];\n /**\n * The read scope of the dialog's list, as the select's own option reads take it. Default\n * `'context'`: the record around the select narrows the rows.\n */\n scope?: ScopeSource;\n /**\n * The record field the select writes (`useList`'s `scopeField`): the record's value of it never\n * narrows the rows offered for it. Absent: every field of the record narrows.\n */\n scopeField?: string;\n /**\n * The select's one pending create (P6-34), shared with its popover. With it the footer offers\n * \"+ Create\" (the target's `quick.create`, handed back through the select's own query); without\n * it the dialog offers none. The dialog is not a dismiss scope and holds no form: the sheet a\n * create opens stacks above it.\n */\n create?: SelectCreate;\n /** The trusted `defaults` of that create: the registry field's static `eq` literals (P6-31). */\n createSeeds?: Readonly<Record<string, unknown>>;\n /** The form field holding the key (the create button's test id). */\n fieldName?: string;\n /** Runs before a create opens: the select returns focus to its trigger. */\n onBeforeCreate?: () => void;\n pageSize?: number;\n /**\n * A to-many select's choice (P7 3.5): a click toggles the row in `selected` through `onToggle`\n * and the dialog stays open until the user is done. Without it, a click picks one row and closes.\n */\n multiple?: boolean;\n /** The keys already chosen (`multiple` only): their rows are marked. */\n selected?: readonly (string | number)[];\n /** A row toggled in `multiple` mode: its value, and the row itself. */\n onToggle?: (value: string | number, row: Record<string, unknown>) => void;\n /**\n * `multiple` only: the Select button confirms the choice through this instead of closing the\n * dialog with `onOpenChange(false)`, so a confirm and a dismissal can be told apart.\n */\n onDone?: () => void;\n /**\n * Asked once per shown page with the keys of its rows: rows whose key is in the resolved set\n * are drawn checked and disabled (a link panel's already-linked targets). Until it answers the\n * page's rows cannot be picked and the footer says the rows are being checked; when it fails\n * none of them can, and the footer says so with a Retry.\n */\n disabledKeys?: (\n keys: readonly (string | number)[],\n signal: AbortSignal,\n ) => Promise<ReadonlySet<string>>;\n /**\n * With `disabledKeys`: the footer's note for the page's disabled rows, given how many there\n * are (the caller says what they are, \"3 already linked\"). Absent: no note.\n */\n disabledLabel?: (count: number) => React.ReactNode;\n}\n\nconst DEBOUNCE_MS = 250;\n\n/** The disabled rows of a page: the keys asked (and the attempt), and the answer. */\ninterface DisabledState {\n readonly asked: string;\n readonly attempt: number;\n readonly keys: ReadonlySet<string> | 'failed';\n}\n\ntype EnumOption = { value: string; label: string };\n\nexport function RelationPickerDialog<const N extends string = string>({\n to: toInput,\n open,\n onOpenChange,\n onSelect,\n onSelectRow,\n searchField,\n valueField: valueFieldProp,\n fixedFilters,\n scope = 'context',\n scopeField,\n create,\n createSeeds,\n fieldName,\n onBeforeCreate,\n pageSize = 8,\n multiple = false,\n selected,\n onToggle,\n onDone,\n disabledKeys,\n disabledLabel,\n}: RelationPickerDialogProps<N>): React.ReactElement {\n const to = routeResourceKey(toInput);\n const app = useApp();\n const caps = useI18nCaps();\n // The target's own caps: a column header reads `resources.<to>.fields.<f>.label` first.\n const targetCaps = useI18nCaps(to);\n const t = useOptionalT();\n const chromeT = useChromeT();\n const tr = (key: string, params?: Record<string, unknown>, fallback?: string) =>\n t?.(key, { params, defaultValue: fallback }) ?? fallback ?? key;\n const targetDef = app.registry.get(to);\n const rowTitle = useRowTitle(to, targetDef?.displayField, { recordTitle: true });\n const declaredIdField = (targetDef?.data as { readonly idField?: unknown } | undefined)?.idField;\n const idField =\n typeof declaredIdField === 'string' && declaredIdField.length > 0 ? declaredIdField : 'id';\n const valueField = valueFieldProp ?? idField;\n\n const [search, setSearchInput] = React.useState('');\n const [debounced, setDebounced] = React.useState('');\n const [sort, setSort] = React.useState<{ field: string; dir: 'asc' | 'desc' }>({\n field: 'id',\n dir: 'desc',\n });\n\n const displayField = targetDef?.displayField ?? 'name';\n\n // Resolution order (see `RelationPickerDialogProps.searchField`'s doc):\n // the target's own `views.list.search` declaration always wins inside\n // `useDialogFilterState`; this `searchField` prop is only consulted THERE\n // when the target declares no search at all, and `displayField` is what\n // this dialog hands the hook when the caller didn't override either — so\n // a target with no declaration and no override is still searchable.\n //\n // `enabled: open` — `RelationPickerDialog` is always mounted by\n // `<RelationPicker>` (it's a controlled dialog, not conditionally\n // rendered), so without this gate the field-derivation walk inside\n // `useFilterFields` (`categorizeField` over every field of the target)\n // would run on every mount and every `fixedFilters`-identity change of\n // EVERY relation field on a form, whether its dialog ever opens or not.\n // Gating recomputes in full the moment `open` flips true — same render,\n // before the dialog shows anything, so nothing it displays changes.\n const filterState = useDialogFilterState(to, {\n fixedFilters,\n searchField: searchField ?? displayField,\n enabled: open,\n });\n\n React.useEffect(() => {\n const h = setTimeout(() => setDebounced(search), DEBOUNCE_MS);\n return () => clearTimeout(h);\n }, [search]);\n\n // The debounced text is the one thing this dialog composes itself — the\n // rest of the filter (fixed scope, the builder's group, and the actual\n // `fixed → search → group` composition) all live in `useDialogFilterState`\n // now, via the SAME `composeListFilter` core the list page uses.\n React.useEffect(() => {\n filterState.setSearch(debounced);\n // `filterState.setSearch` is stable (useCallback, empty deps) — only\n // `debounced` driving this is real; including the whole `filterState`\n // object would refire on every recompute of its OWN memo (its `filter`\n // depends on this very effect's result), which is not what \"debounced\n // changed\" means.\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [debounced]);\n\n // Reset volatile state each time the dialog opens.\n React.useEffect(() => {\n if (open) {\n setSearchInput('');\n setDebounced('');\n filterState.reset();\n }\n // `filterState.reset` is stable (useCallback, empty deps); `filterState`\n // itself is excluded for the same reason as the effect above.\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [open]);\n\n const listAccess = useListAccess(to);\n const extraColumns = React.useMemo(() => {\n const declared = (targetDef?.views?.list?.columns ?? []).map(columnName);\n // The same predicate as the list table: a pending decision shows no extra column.\n return declared\n .filter((c) => c !== 'id' && c !== displayField)\n .filter((c) => listAccess.status === 'ready' && listAccess.columnVisible(c))\n .slice(0, 2);\n }, [targetDef, displayField, listAccess]);\n const titleSortable = listAccess.status === 'ready' && listAccess.fieldVisible(displayField);\n // A sort on a field the user may not view is an ordering oracle: it is dropped, never sent.\n const effectiveSortField =\n sort.field === 'id' ||\n (sort.field === displayField ? titleSortable : extraColumns.includes(sort.field))\n ? sort.field\n : 'id';\n\n const query = useList(to, {\n ...(filterState.filter ? { filter: filterState.filter } : {}),\n sort: [\n {\n field: effectiveSortField,\n direction: effectiveSortField === sort.field ? sort.dir : 'desc',\n },\n ],\n pagination: { kind: 'offset', page: filterState.page, pageSize },\n scope,\n ...(scopeField === undefined ? {} : { scopeField }),\n enabled: open && targetDef != null && !filterState.blocked,\n });\n\n const rows = (query.data?.data ?? []) as Array<{ id: unknown } & Record<string, unknown>>;\n // Unknown-total contract: a provider that cannot count omits `total` (Hasura\n // `noAggregate` targets such as `users` / `code_code`). Deriving `totalPages`\n // from a `?? 0` fallback pinned it to 1 and disabled Next forever. With an\n // unknown total we page forward while the page is full.\n const total = query.data?.total;\n const knownTotal = typeof total === 'number';\n const totalPages = knownTotal ? Math.max(1, Math.ceil(total / pageSize)) : undefined;\n const pageIsFull = rows.length >= pageSize;\n const hasNextPage = knownTotal ? filterState.page < (totalPages as number) : pageIsFull;\n const isLoading = query.isLoading || query.isFetching;\n\n // The key a row is chosen, selected and disabled by: the target's idField unless a value field\n // names another column.\n const keyOf = (row: Record<string, unknown>): unknown =>\n valueField === idField ? recordKeyOf(targetDef, row) : row[valueField];\n // The page's keys, asked of `disabledKeys` once per distinct set.\n const pageKeys = rows\n .map(keyOf)\n .filter((key): key is string | number => typeof key === 'string' || typeof key === 'number');\n const asked = JSON.stringify(pageKeys);\n const [disabled, setDisabled] = React.useState<DisabledState | undefined>(undefined);\n // A Retry after a failed answer asks the same keys again.\n const [attempt, setAttempt] = React.useState(0);\n // biome-ignore lint/correctness/useExhaustiveDependencies: keyed by the page's keys, not the rows' identity\n React.useEffect(() => {\n if (disabledKeys === undefined || pageKeys.length === 0) return;\n const controller = new AbortController();\n disabledKeys(pageKeys, controller.signal).then(\n (keys) => {\n if (!controller.signal.aborted) setDisabled({ asked, attempt, keys });\n },\n () => {\n // Fails closed: a row that may already be linked is never offered.\n if (!controller.signal.aborted) setDisabled({ asked, attempt, keys: 'failed' });\n },\n );\n return () => controller.abort();\n }, [asked, attempt, disabledKeys]);\n // The answer for the page shown now; undefined while it is being asked.\n const answer =\n disabledKeys === undefined ||\n pageKeys.length === 0 ||\n disabled === undefined ||\n disabled.asked !== asked ||\n disabled.attempt !== attempt\n ? undefined\n : disabled.keys;\n const checking = disabledKeys !== undefined && pageKeys.length > 0 && answer === undefined;\n const checkFailed = answer === 'failed';\n const isDisabled = (row: Record<string, unknown>): boolean => {\n if (disabledKeys === undefined) return false;\n if (answer === undefined || answer === 'failed') return true;\n return answer.has(String(keyOf(row)));\n };\n const disabledCount =\n answer === undefined || answer === 'failed' ? 0 : rows.filter(isDisabled).length;\n\n const toggleSort = (field: string) => {\n setSort((prev) =>\n prev.field === field\n ? { field, dir: prev.dir === 'asc' ? 'desc' : 'asc' }\n : { field, dir: 'asc' },\n );\n };\n\n const targetLabel = resolveResourceLabel(caps, to, 'single', targetDef);\n const colCount = 2 + extraColumns.length;\n\n const pick = (row: { id: unknown } & Record<string, unknown>) => {\n if (isDisabled(row)) return;\n const picked = keyOf(row);\n // A row without the value the field stores is never written as its id instead (spec 4.2).\n if (picked === null || picked === undefined || picked === '') return;\n if (multiple) {\n onToggle?.(picked as string | number, row as Record<string, unknown>);\n return;\n }\n onSelect(picked as string | number);\n onSelectRow?.(row as Record<string, unknown>);\n onOpenChange(false);\n };\n\n return (\n <Dialog open={open} onOpenChange={onOpenChange} modal={create?.pending !== true}>\n <DialogContent\n // While a create of this select is open its sheet stacks above this dialog and stays\n // interactive: the dialog neither traps focus nor closes on a click outside, and Escape\n // closes only the sheet (P6-67).\n {...(create?.pending === true\n ? {\n onInteractOutside: (event: Event) => event.preventDefault(),\n onEscapeKeyDown: (event: KeyboardEvent) => event.preventDefault(),\n }\n : {})}\n className=\"flex max-h-[85vh] w-[calc(100vw-1.5rem)] max-w-3xl flex-col gap-0 overflow-hidden p-0\"\n data-testid={`relation-picker-dialog:${to}`}\n >\n <DialogHeader className=\"border-b px-4 py-3\">\n <DialogTitle className=\"text-base\">\n {tr('relationPicker.title', { name: targetLabel }, `Select: ${targetLabel}`)}\n </DialogTitle>\n <DialogDescription className=\"sr-only\">\n {tr('relationPicker.advancedSearch', undefined, 'Advanced search')}\n </DialogDescription>\n </DialogHeader>\n\n {/* Search + the filter builder (#9 / Task 5 SP3) */}\n <div className=\"flex flex-wrap items-center gap-2 border-b px-4 py-2.5\">\n {filterState.searchEnabled && (\n <div className=\"relative min-w-[12rem] flex-1\">\n <IconSearch className=\"pointer-events-none absolute left-2.5 top-2.5 size-4 text-muted-foreground\" />\n <Input\n autoFocus\n value={search}\n onChange={(e) => setSearchInput(e.target.value)}\n placeholder={tr('toolbar.search', { name: targetLabel }, `Search ${targetLabel}…`)}\n data-testid={`relation-picker-dialog:${to}:search`}\n className=\"h-9 pl-8\"\n />\n </div>\n )}\n {/*\n No `pinnedFields`/`pinnedValue`/`setPinnedValue` — this dialog has\n no pinned slot (`useDialogFilterState`'s doc: a modal has no\n spare real estate for always-visible facets), so `FilterBuilder`\n falls back to its own stable empty-array defaults.\n */}\n <FilterBuilder\n group={filterState.group}\n setGroup={filterState.setGroup}\n available={filterState.available}\n fixed={filterState.fixed}\n setPage={filterState.setPage}\n testIdBase={`relation-picker-dialog:${to}:filter`}\n />\n </div>\n\n {/* Fixed-height table area — constant height so paging never jumps. */}\n <div className=\"h-[46vh] min-h-[16rem] overflow-auto\">\n <Table>\n <TableHeader className=\"sticky top-0 z-10 bg-background shadow-[inset_0_-1px_0_var(--border)]\">\n <TableRow className=\"hover:bg-transparent\">\n <TableHead\n className=\"h-9 w-14 cursor-pointer select-none\"\n onClick={() => toggleSort('id')}\n >\n {tr('relationPicker.idColumn', undefined, 'ID')}{' '}\n <SortIcon field=\"id\" sort={sort} />\n </TableHead>\n <TableHead\n className={cn('h-9 select-none', titleSortable && 'cursor-pointer')}\n {...(titleSortable ? { onClick: () => toggleSort(displayField) } : {})}\n >\n {targetLabel} {titleSortable && <SortIcon field={displayField} sort={sort} />}\n </TableHead>\n {extraColumns.map((c) => (\n <TableHead\n key={c}\n className=\"h-9 cursor-pointer select-none\"\n onClick={() => toggleSort(c)}\n >\n {resolveFieldLabel(\n targetCaps,\n c,\n declaredText('field', targetDef?.fields?.[c], 'label'),\n )}\n <SortIcon field={c} sort={sort} />\n </TableHead>\n ))}\n <TableHead className=\"h-9 w-8\" />\n </TableRow>\n </TableHeader>\n <TableBody>\n {isLoading ? (\n <TableRow className=\"hover:bg-transparent\">\n <TableCell colSpan={colCount + 1} className=\"h-64 text-center\">\n <IconLoader2 className=\"mx-auto size-4 animate-spin text-muted-foreground\" />\n </TableCell>\n </TableRow>\n ) : rows.length === 0 ? (\n <TableRow className=\"hover:bg-transparent\">\n <TableCell\n colSpan={colCount + 1}\n className=\"h-64 text-center text-sm text-muted-foreground\"\n >\n {tr('relation.noResults', undefined, 'No results.')}\n </TableCell>\n </TableRow>\n ) : (\n rows.map((row) => {\n const idStr = String(recordKeyOf(targetDef, row));\n const rowDisabled = isDisabled(row);\n // A disabled row is drawn checked: it is already chosen elsewhere.\n const checked =\n rowDisabled ||\n (selected ?? []).some((key) => String(key) === String(keyOf(row)));\n return (\n <TableRow\n key={idStr}\n className={cn(\n rowDisabled ? 'cursor-not-allowed opacity-60' : 'cursor-pointer',\n )}\n data-testid={`relation-picker-dialog:${to}:row:${idStr}`}\n {...(multiple ? { 'aria-selected': checked } : {})}\n {...(rowDisabled ? { 'aria-disabled': true } : {})}\n onClick={() => pick(row)}\n >\n <TableCell className=\"py-2 tabular-nums text-muted-foreground\">\n {tr('relationPicker.recordNumber', { id: idStr }, `#${idStr}`)}\n </TableCell>\n <TableCell className=\"py-2 font-medium\">{rowTitle(row)}</TableCell>\n {extraColumns.map((c) => (\n <TableCell key={c} className=\"py-2 text-muted-foreground\">\n {/* The list's display renderers: locale numbers and dates, enum labels. */}\n <ResolvedFieldDisplay\n resource={targetDef?.ref ?? { namespace: 'default', id: to }}\n name={c}\n field={\n (targetDef === undefined ? undefined : declaredField(targetDef, c)) ??\n (targetDef?.fields?.[c] as never) ?? { type: 'unknown' }\n }\n value={row[c]}\n record={row}\n fallback={formatCell(row[c], targetDef?.fields?.[c], (ns) =>\n app.registry.enums.get(ns),\n )}\n />\n </TableCell>\n ))}\n <TableCell className=\"py-2 text-right\">\n {multiple ? (\n <IconCheck\n className={cn('ml-auto size-4', checked ? 'opacity-100' : 'opacity-0')}\n aria-hidden\n />\n ) : (\n <IconChevronRight className=\"ml-auto size-4 text-muted-foreground/50\" />\n )}\n </TableCell>\n </TableRow>\n );\n })\n )}\n </TableBody>\n </Table>\n </div>\n\n <DialogFooter className=\"flex-row items-center justify-between gap-2 border-t px-4 py-2.5 sm:justify-between\">\n {/*\n A wrapper that is always there: the footer is `justify-between`, so dropping its first\n child (no create offered) would slide the pager to the left edge.\n */}\n <div className=\"flex items-center gap-3\">\n {checking && (\n <span\n role=\"status\"\n className=\"inline-flex items-center gap-1.5 text-sm text-muted-foreground\"\n data-testid={`relation-picker-dialog:${to}:disabled-checking`}\n >\n <IconLoader2 className=\"size-3.5 animate-spin\" aria-hidden=\"true\" />\n {tr('relationPicker.checking', undefined, 'Checking these rows…')}\n </span>\n )}\n {checkFailed && (\n <span\n role=\"alert\"\n className=\"inline-flex items-center gap-2 text-sm text-destructive\"\n data-testid={`relation-picker-dialog:${to}:disabled-failed`}\n >\n {tr(\n 'relationPicker.checkFailed',\n undefined,\n 'These rows could not be checked, so none can be chosen.',\n )}\n <Button\n type=\"button\"\n size=\"sm\"\n variant=\"outline\"\n className=\"h-7\"\n onClick={() => setAttempt((n) => n + 1)}\n data-testid={`relation-picker-dialog:${to}:disabled-retry`}\n >\n {chromeT('actions.retry', { defaultValue: 'Retry' })}\n </Button>\n </span>\n )}\n {disabledCount > 0 && disabledLabel !== undefined && (\n <span\n className=\"text-sm text-muted-foreground\"\n data-testid={`relation-picker-dialog:${to}:disabled-count`}\n >\n {disabledLabel(disabledCount)}\n </span>\n )}\n {create !== undefined && (\n <RelationCreateButton\n to={to}\n fieldName={fieldName ?? to}\n create={create}\n seeds={createSeeds}\n search={search}\n beforeOpen={onBeforeCreate ?? noop}\n className=\"inline-flex items-center gap-1 whitespace-nowrap text-sm text-foreground hover:underline disabled:opacity-50\"\n />\n )}\n </div>\n <div className=\"flex items-center gap-2 text-sm text-muted-foreground\">\n <span className=\"hidden tabular-nums sm:inline\">\n {knownTotal\n ? tr(\n 'pagination.pageOf',\n { page: filterState.page, total: totalPages },\n `${filterState.page} / ${totalPages}`,\n )\n : tr('pagination.pageOnly', { page: filterState.page }, `${filterState.page}`)}\n </span>\n <Button\n type=\"button\"\n size=\"sm\"\n variant=\"outline\"\n className=\"h-8\"\n disabled={filterState.page <= 1}\n onClick={() => filterState.setPage(Math.max(1, filterState.page - 1))}\n data-testid={`relation-picker-dialog:${to}:prev`}\n >\n {tr('relationPicker.prev', undefined, 'Prev')}\n </Button>\n <Button\n type=\"button\"\n size=\"sm\"\n variant=\"outline\"\n className=\"h-8\"\n disabled={!hasNextPage}\n onClick={() => filterState.setPage(filterState.page + 1)}\n data-testid={`relation-picker-dialog:${to}:next`}\n >\n {tr('relationPicker.next', undefined, 'Next')}\n </Button>\n {multiple && (\n <Button\n type=\"button\"\n size=\"sm\"\n className=\"h-8\"\n onClick={() => (onDone === undefined ? onOpenChange(false) : onDone())}\n data-testid={`relation-picker-dialog:${to}:done`}\n >\n {tr('relationPicker.select', undefined, 'Select')}\n </Button>\n )}\n </div>\n </DialogFooter>\n </DialogContent>\n </Dialog>\n );\n}\n\n/**\n * A column's sort arrow. Declared here, not inside the dialog: a component made in a render is a\n * new type on every render, so React replaced these icons each time the dialog rendered — and a\n * node removed from the dialog while focus was crossing into the filter popover (which is portaled\n * outside it, so focus sits on `body` for that moment) makes the dialog's focus scope take focus\n * back, which closed the popover on any click inside it.\n */\nfunction SortIcon({\n field,\n sort,\n}: {\n readonly field: string;\n readonly sort: { readonly field: string; readonly dir: 'asc' | 'desc' };\n}): React.ReactElement {\n if (sort.field !== field) return <IconSelector className=\"ml-1 inline size-3 opacity-40\" />;\n return sort.dir === 'asc' ? (\n <IconArrowUp className=\"ml-1 inline size-3\" />\n ) : (\n <IconArrowDown className=\"ml-1 inline size-3\" />\n );\n}\n\nfunction formatCell(\n value: unknown,\n field: unknown,\n enumOf: (namespace: string) => Parameters<typeof enumValueText>[0],\n): string {\n if (value == null || value === '') return '—';\n if (typeof value === 'boolean') return value ? '✓' : '—';\n // Map an option value → its human label: the field's `texts.options`, the bound enum's\n // `texts`, else a label the field's `meta.options` carries (adopter data).\n const namespace =\n field !== null && typeof field === 'object'\n ? enumNamespaceOf(field as Parameters<typeof enumNamespaceOf>[0])\n : undefined;\n const declared =\n fieldOptionText(field, String(value)) ??\n (namespace === undefined ? undefined : enumValueText(enumOf(namespace), String(value)));\n if (declared !== undefined) return declared;\n const options = (field as { meta?: { options?: EnumOption[] } } | undefined)?.meta?.options;\n if (Array.isArray(options)) {\n const hit = options.find((o) => o.value === String(value));\n if (hit && typeof hit.label === 'string') return hit.label;\n }\n const s = String(value);\n return s.length > 40 ? `${s.slice(0, 40)}…` : s;\n}\n"],"mappings":";;;;;;;;;;;;;AA2DA,MAAM,aAAmB,KAAA;AA0GzB,MAAM,cAAc;AAWpB,SAAgB,qBAAsD,EACpE,IAAI,SACJ,MACA,cACA,UACA,aACA,aACA,YAAY,gBACZ,cACA,QAAQ,WACR,YACA,QACA,aACA,WACA,gBACA,WAAW,GACX,WAAW,OACX,UACA,UACA,QACA,cACA,iBACmD;CACnD,MAAM,KAAK,iBAAiB,OAAO;CACnC,MAAM,MAAM,OAAO;CACnB,MAAM,OAAO,YAAY;CAEzB,MAAM,aAAa,YAAY,EAAE;CACjC,MAAM,IAAI,aAAa;CACvB,MAAM,UAAU,WAAW;CAC3B,MAAM,MAAM,KAAa,QAAkC,aACzD,IAAI,KAAK;EAAE;EAAQ,cAAc;CAAS,CAAC,KAAK,YAAY;CAC9D,MAAM,YAAY,IAAI,SAAS,IAAI,EAAE;CACr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BxnnE28H.cjs");
|
|
3
3
|
const require_input = require("./input-BI0czGyI.cjs");
|
|
4
4
|
const require_dialog = require("./dialog-vmMdfUWs.cjs");
|
|
5
|
-
const require_relation_create = require("./relation-create-
|
|
6
|
-
const require_filter_builder = require("./filter-builder-
|
|
7
|
-
const require_use_dialog_filter_state = require("./use-dialog-filter-state-
|
|
5
|
+
const require_relation_create = require("./relation-create-_SFuPQGM.cjs");
|
|
6
|
+
const require_filter_builder = require("./filter-builder-DQX-TMFh.cjs");
|
|
7
|
+
const require_use_dialog_filter_state = require("./use-dialog-filter-state-lsTJxrB4.cjs");
|
|
8
8
|
let _burojs_core = require("@burojs/core");
|
|
9
9
|
let _burojs_react = require("@burojs/react");
|
|
10
10
|
let _tabler_icons_react = require("@tabler/icons-react");
|
|
@@ -26,7 +26,7 @@ function RelationPickerDialog({ to: toInput, open, onOpenChange, onSelect, onSel
|
|
|
26
26
|
defaultValue: fallback
|
|
27
27
|
}) ?? fallback ?? key;
|
|
28
28
|
const targetDef = app.registry.get(to);
|
|
29
|
-
const rowTitle = require_relation_create.useRowTitle(to, targetDef?.displayField);
|
|
29
|
+
const rowTitle = require_relation_create.useRowTitle(to, targetDef?.displayField, { recordTitle: true });
|
|
30
30
|
const declaredIdField = (targetDef?.data)?.idField;
|
|
31
31
|
const idField = typeof declaredIdField === "string" && declaredIdField.length > 0 ? declaredIdField : "id";
|
|
32
32
|
const valueField = valueFieldProp ?? idField;
|
|
@@ -399,4 +399,4 @@ function formatCell(value, field, enumOf) {
|
|
|
399
399
|
//#endregion
|
|
400
400
|
exports.RelationPickerDialog = RelationPickerDialog;
|
|
401
401
|
|
|
402
|
-
//# sourceMappingURL=relation-picker-dialog-
|
|
402
|
+
//# sourceMappingURL=relation-picker-dialog-Duqy2r0n.cjs.map
|