@object-ui/fields 17.1.0 → 17.2.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/CHANGELOG.md +194 -0
- package/dist/FieldEditWidget.d.ts +2 -2
- package/dist/__tests__/spec-symbol-batch7.test.d.ts +8 -0
- package/dist/__tests__/widget-props-contract.test.d.ts +8 -0
- package/dist/index.cjs +3 -3
- package/dist/index.js +290 -292
- package/dist/widgets/AddressField.d.ts +2 -2
- package/dist/widgets/AutoNumberField.d.ts +2 -2
- package/dist/widgets/AvatarField.d.ts +2 -2
- package/dist/widgets/BooleanField.d.ts +2 -2
- package/dist/widgets/CapabilityMultiSelectField.d.ts +2 -2
- package/dist/widgets/CheckboxesField.d.ts +2 -2
- package/dist/widgets/CodeField.d.ts +2 -2
- package/dist/widgets/ColorField.d.ts +2 -2
- package/dist/widgets/CurrencyField.d.ts +2 -2
- package/dist/widgets/DateField.d.ts +2 -2
- package/dist/widgets/DateTimeField.d.ts +2 -2
- package/dist/widgets/EmailField.d.ts +2 -2
- package/dist/widgets/FileField.d.ts +2 -2
- package/dist/widgets/FilterConditionField.d.ts +2 -2
- package/dist/widgets/FormulaField.d.ts +2 -2
- package/dist/widgets/GeolocationField.d.ts +2 -2
- package/dist/widgets/GridField.d.ts +2 -2
- package/dist/widgets/ImageField.d.ts +2 -2
- package/dist/widgets/LocationField.d.ts +2 -2
- package/dist/widgets/LookupField.d.ts +2 -2
- package/dist/widgets/MasterDetailField.d.ts +2 -2
- package/dist/widgets/MultiSelectField.d.ts +2 -2
- package/dist/widgets/NumberField.d.ts +2 -2
- package/dist/widgets/ObjectField.d.ts +2 -2
- package/dist/widgets/ObjectRefField.d.ts +2 -2
- package/dist/widgets/PasswordField.d.ts +2 -2
- package/dist/widgets/PercentField.d.ts +2 -2
- package/dist/widgets/PhoneField.d.ts +2 -2
- package/dist/widgets/QRCodeField.d.ts +2 -2
- package/dist/widgets/RadioField.d.ts +2 -2
- package/dist/widgets/RatingField.d.ts +2 -2
- package/dist/widgets/RecipientPickerField.d.ts +2 -2
- package/dist/widgets/RichTextField.d.ts +2 -2
- package/dist/widgets/SelectField.d.ts +2 -2
- package/dist/widgets/SignatureField.d.ts +2 -2
- package/dist/widgets/SliderField.d.ts +2 -2
- package/dist/widgets/SummaryField.d.ts +2 -2
- package/dist/widgets/TagsField.d.ts +2 -2
- package/dist/widgets/TextAreaField.d.ts +2 -2
- package/dist/widgets/TextField.d.ts +2 -2
- package/dist/widgets/TimeField.d.ts +2 -2
- package/dist/widgets/UrlField.d.ts +2 -2
- package/dist/widgets/UserField.d.ts +2 -2
- package/dist/widgets/VectorField.d.ts +2 -2
- package/dist/widgets/file-value.d.ts +20 -33
- package/dist/widgets/types.d.ts +119 -3
- package/package.json +8 -8
- package/src/FieldEditWidget.tsx +6 -4
- package/src/__tests__/spec-symbol-batch7.test.ts +112 -0
- package/src/__tests__/widget-props-contract.test.tsx +129 -0
- package/src/complex-widgets.test.tsx +3 -3
- package/src/datetime-widgets.test.tsx +2 -2
- package/src/index.tsx +3 -1
- package/src/widgets/AddressField.tsx +2 -2
- package/src/widgets/AutoNumberField.tsx +2 -2
- package/src/widgets/AvatarField.tsx +2 -2
- package/src/widgets/BooleanField.tsx +2 -2
- package/src/widgets/CapabilityMultiSelectField.tsx +4 -4
- package/src/widgets/CheckboxesField.tsx +4 -4
- package/src/widgets/CodeField.tsx +2 -2
- package/src/widgets/ColorField.tsx +2 -2
- package/src/widgets/CurrencyField.tsx +2 -2
- package/src/widgets/DateField.tsx +2 -2
- package/src/widgets/DateTimeField.tsx +2 -2
- package/src/widgets/EmailField.tsx +2 -2
- package/src/widgets/FileField.tsx +2 -2
- package/src/widgets/FilterConditionField.tsx +3 -3
- package/src/widgets/FormulaField.tsx +2 -2
- package/src/widgets/GeolocationField.tsx +2 -2
- package/src/widgets/GridField.tsx +3 -3
- package/src/widgets/ImageField.tsx +2 -2
- package/src/widgets/LocationField.tsx +2 -2
- package/src/widgets/LookupField.tsx +10 -10
- package/src/widgets/MasterDetailField.tsx +2 -2
- package/src/widgets/MultiSelectField.tsx +4 -4
- package/src/widgets/NumberField.tsx +2 -2
- package/src/widgets/ObjectField.tsx +2 -2
- package/src/widgets/ObjectRefField.tsx +4 -4
- package/src/widgets/PasswordField.tsx +2 -2
- package/src/widgets/PercentField.tsx +2 -2
- package/src/widgets/PhoneField.tsx +2 -2
- package/src/widgets/QRCodeField.tsx +2 -2
- package/src/widgets/RadioField.tsx +4 -4
- package/src/widgets/RatingField.tsx +2 -2
- package/src/widgets/RecipientPickerField.tsx +4 -4
- package/src/widgets/RichTextField.tsx +2 -2
- package/src/widgets/SelectField.tsx +5 -5
- package/src/widgets/SignatureField.tsx +2 -2
- package/src/widgets/SliderField.tsx +2 -2
- package/src/widgets/SummaryField.tsx +2 -2
- package/src/widgets/TagsField.tsx +3 -3
- package/src/widgets/TextAreaField.tsx +2 -2
- package/src/widgets/TextField.tsx +2 -2
- package/src/widgets/TimeField.tsx +2 -2
- package/src/widgets/UrlField.tsx +2 -2
- package/src/widgets/UserField.tsx +2 -2
- package/src/widgets/VectorField.tsx +2 -2
- package/src/widgets/file-value.ts +21 -5
- package/src/widgets/types.ts +129 -6
package/dist/index.js
CHANGED
|
@@ -8,11 +8,12 @@ import { SchemaRendererContext as Xe, useAction as Ze, useHasActionProvider as Q
|
|
|
8
8
|
import { Fragment as tt, jsx as Y, jsxs as X } from "react/jsx-runtime";
|
|
9
9
|
import { isSystemManagedField as nt } from "@object-ui/types";
|
|
10
10
|
import { useUpload as rt } from "@object-ui/providers";
|
|
11
|
-
import it from "
|
|
12
|
-
import at from "
|
|
13
|
-
import ot from "
|
|
11
|
+
import { isFileIdToken as it } from "@objectstack/spec/data";
|
|
12
|
+
import at from "react-markdown";
|
|
13
|
+
import ot from "remark-gfm";
|
|
14
|
+
import st from "rehype-sanitize";
|
|
14
15
|
//#region \0rolldown/runtime.js
|
|
15
|
-
var
|
|
16
|
+
var ct = Object.defineProperty, Z = (e, t, n) => () => {
|
|
16
17
|
if (n) throw n[0];
|
|
17
18
|
try {
|
|
18
19
|
return e && (t = e(e = 0)), t;
|
|
@@ -21,13 +22,13 @@ var st = Object.defineProperty, Z = (e, t, n) => () => {
|
|
|
21
22
|
}
|
|
22
23
|
}, Q = (e, t) => {
|
|
23
24
|
let n = {};
|
|
24
|
-
for (var r in e)
|
|
25
|
+
for (var r in e) ct(n, r, {
|
|
25
26
|
get: e[r],
|
|
26
27
|
enumerable: !0
|
|
27
28
|
});
|
|
28
|
-
return t ||
|
|
29
|
-
},
|
|
30
|
-
function
|
|
29
|
+
return t || ct(n, Symbol.toStringTag, { value: "Module" }), n;
|
|
30
|
+
}, lt = /* @__PURE__ */ Q({ TextField: () => ut });
|
|
31
|
+
function ut({ value: e, onChange: t, field: n, readonly: r, ...i }) {
|
|
31
32
|
let a = n || i.schema;
|
|
32
33
|
if (r) return /* @__PURE__ */ Y("span", {
|
|
33
34
|
className: "text-sm",
|
|
@@ -49,8 +50,8 @@ function lt({ value: e, onChange: t, field: n, readonly: r, ...i }) {
|
|
|
49
50
|
disabled: r || c.disabled
|
|
50
51
|
});
|
|
51
52
|
}
|
|
52
|
-
var
|
|
53
|
-
function
|
|
53
|
+
var dt = Z((() => {})), ft = /* @__PURE__ */ Q({ NumberField: () => pt });
|
|
54
|
+
function pt({ value: e, onChange: t, field: n, readonly: r, ...i }) {
|
|
54
55
|
if (r) return e == null ? /* @__PURE__ */ Y(P, {}) : /* @__PURE__ */ Y("span", {
|
|
55
56
|
className: "text-sm",
|
|
56
57
|
children: e
|
|
@@ -71,8 +72,8 @@ function ft({ value: e, onChange: t, field: n, readonly: r, ...i }) {
|
|
|
71
72
|
step: s
|
|
72
73
|
});
|
|
73
74
|
}
|
|
74
|
-
var
|
|
75
|
-
function
|
|
75
|
+
var mt = Z((() => {})), ht = /* @__PURE__ */ Q({ BooleanField: () => gt });
|
|
76
|
+
function gt({ value: e, onChange: t, field: n, readonly: r, ...i }) {
|
|
76
77
|
let a = n || i.schema, o = a?.widget, c = s(), l = a?.name || c, u = a?.label || "Checkbox";
|
|
77
78
|
if (r) return /* @__PURE__ */ Y("span", {
|
|
78
79
|
className: "text-sm",
|
|
@@ -107,8 +108,8 @@ function ht({ value: e, onChange: t, field: n, readonly: r, ...i }) {
|
|
|
107
108
|
})]
|
|
108
109
|
});
|
|
109
110
|
}
|
|
110
|
-
var
|
|
111
|
-
|
|
111
|
+
var _t = Z((() => {})), vt, yt, bt = Z((() => {
|
|
112
|
+
vt = {
|
|
112
113
|
"common.selectOption": "Select an option",
|
|
113
114
|
"common.select": "Select...",
|
|
114
115
|
"common.search": "Search",
|
|
@@ -174,11 +175,11 @@ var gt = Z((() => {})), _t, vt, yt = Z((() => {
|
|
|
174
175
|
"capability.label.setup_access": "Setup Access",
|
|
175
176
|
"capability.label.setup_write": "Write Settings",
|
|
176
177
|
"capability.label.studio_access": "Studio Access"
|
|
177
|
-
},
|
|
178
|
+
}, yt = _(vt, "common.selectOption");
|
|
178
179
|
}));
|
|
179
180
|
//#endregion
|
|
180
181
|
//#region src/widgets/useCascadingOptions.ts
|
|
181
|
-
function
|
|
182
|
+
function xt(e, t, n) {
|
|
182
183
|
let r = a(Xe), i = c(() => n ?? r?.formValues ?? r?.data ?? {}, [
|
|
183
184
|
n,
|
|
184
185
|
r?.formValues,
|
|
@@ -191,9 +192,9 @@ function bt(e, t, n) {
|
|
|
191
192
|
o
|
|
192
193
|
]);
|
|
193
194
|
}
|
|
194
|
-
var
|
|
195
|
-
function
|
|
196
|
-
let f = n || a, p = f?.options || [], m = Array.isArray(e) ? e : e == null ? [] : [e], h = d.name || f?.name || d.id || "", { options: g, gated: _, dependsOnFields: v } =
|
|
195
|
+
var St = Z((() => {})), Ct = /* @__PURE__ */ Q({ MultiSelectField: () => wt });
|
|
196
|
+
function wt({ value: e, onChange: t, field: n, readonly: r, className: i, schema: a, dependentValues: s, dependsOn: c, emptyHint: l, dataSource: u, ...d }) {
|
|
197
|
+
let f = n || a, p = f?.options || [], m = Array.isArray(e) ? e : e == null ? [] : [e], h = d.name || f?.name || d.id || "", { options: g, gated: _, dependsOnFields: v } = xt(p, f?.dependsOn ?? c, s);
|
|
197
198
|
if (o(() => {
|
|
198
199
|
if (r || m.length === 0) return;
|
|
199
200
|
let e = m.filter((e) => g.some((t) => t.value === e));
|
|
@@ -233,14 +234,14 @@ function Ct({ value: e, onChange: t, field: n, readonly: r, className: i, schema
|
|
|
233
234
|
})
|
|
234
235
|
});
|
|
235
236
|
}
|
|
236
|
-
var
|
|
237
|
-
|
|
238
|
-
})),
|
|
239
|
-
function
|
|
240
|
-
return (e.field || e.schema)?.multiple ? /* @__PURE__ */ Y(
|
|
237
|
+
var Tt = Z((() => {
|
|
238
|
+
St();
|
|
239
|
+
})), Et = /* @__PURE__ */ Q({ SelectField: () => Dt });
|
|
240
|
+
function Dt(e) {
|
|
241
|
+
return (e.field || e.schema)?.multiple ? /* @__PURE__ */ Y(wt, { ...e }) : /* @__PURE__ */ Y(Ot, { ...e });
|
|
241
242
|
}
|
|
242
|
-
function
|
|
243
|
-
let d = n || i, f = d?.options || [], { t: m } =
|
|
243
|
+
function Ot({ value: e, onChange: t, field: n, readonly: r, schema: i, dependentValues: a, dependsOn: s, emptyHint: c, dataSource: l, ...u }) {
|
|
244
|
+
let d = n || i, f = d?.options || [], { t: m } = yt(), h = u.name || d?.name || u.id || "", { options: g, gated: _, dependsOnFields: v } = xt(f, d?.dependsOn ?? s, a);
|
|
244
245
|
if (o(() => {
|
|
245
246
|
r || e == null || e === "" || p(e, g) || t?.(void 0);
|
|
246
247
|
}, [g, _]), r) {
|
|
@@ -278,18 +279,18 @@ function Dt({ value: e, onChange: t, field: n, readonly: r, schema: i, dependent
|
|
|
278
279
|
})]
|
|
279
280
|
});
|
|
280
281
|
}
|
|
281
|
-
var
|
|
282
|
-
|
|
282
|
+
var kt = Z((() => {
|
|
283
|
+
bt(), Tt(), St();
|
|
283
284
|
}));
|
|
284
285
|
//#endregion
|
|
285
286
|
//#region src/widgets/openNativePicker.ts
|
|
286
|
-
function
|
|
287
|
+
function At(e) {
|
|
287
288
|
if (!(e.disabled || e.readOnly)) try {
|
|
288
289
|
e.showPicker?.();
|
|
289
290
|
} catch {}
|
|
290
291
|
}
|
|
291
|
-
var
|
|
292
|
-
function
|
|
292
|
+
var jt = Z((() => {})), Mt = /* @__PURE__ */ Q({ DateField: () => Nt });
|
|
293
|
+
function Nt({ value: e, onChange: t, field: n, readonly: r, ...i }) {
|
|
293
294
|
if (r) return e ? /* @__PURE__ */ Y("span", {
|
|
294
295
|
className: "text-sm",
|
|
295
296
|
children: new Date(e).toLocaleDateString()
|
|
@@ -301,15 +302,15 @@ function Mt({ value: e, onChange: t, field: n, readonly: r, ...i }) {
|
|
|
301
302
|
value: e || "",
|
|
302
303
|
onChange: (e) => t(e.target.value),
|
|
303
304
|
onClick: (e) => {
|
|
304
|
-
|
|
305
|
+
At(e.currentTarget), o.onClick?.(e);
|
|
305
306
|
},
|
|
306
307
|
disabled: r || o.disabled
|
|
307
308
|
});
|
|
308
309
|
}
|
|
309
|
-
var
|
|
310
|
-
|
|
311
|
-
})),
|
|
312
|
-
function
|
|
310
|
+
var Pt = Z((() => {
|
|
311
|
+
jt();
|
|
312
|
+
})), Ft = /* @__PURE__ */ Q({ EmailField: () => It });
|
|
313
|
+
function It({ value: e, onChange: t, field: n, readonly: r, errorMessage: i, ...a }) {
|
|
313
314
|
let o = n || a.schema;
|
|
314
315
|
if (r) return e ? /* @__PURE__ */ Y("a", {
|
|
315
316
|
href: `mailto:${e}`,
|
|
@@ -327,8 +328,8 @@ function Ft({ value: e, onChange: t, field: n, readonly: r, errorMessage: i, ...
|
|
|
327
328
|
"aria-invalid": !!i
|
|
328
329
|
});
|
|
329
330
|
}
|
|
330
|
-
var
|
|
331
|
-
function
|
|
331
|
+
var Lt = Z((() => {})), Rt = /* @__PURE__ */ Q({ PhoneField: () => zt });
|
|
332
|
+
function zt({ value: e, onChange: t, field: n, readonly: r, errorMessage: i, ...a }) {
|
|
332
333
|
let o = n || a.schema;
|
|
333
334
|
if (r) return e ? /* @__PURE__ */ Y("a", {
|
|
334
335
|
href: `tel:${e}`,
|
|
@@ -346,8 +347,8 @@ function Rt({ value: e, onChange: t, field: n, readonly: r, errorMessage: i, ...
|
|
|
346
347
|
"aria-invalid": !!i
|
|
347
348
|
});
|
|
348
349
|
}
|
|
349
|
-
var
|
|
350
|
-
function
|
|
350
|
+
var Bt = Z((() => {})), Vt = /* @__PURE__ */ Q({ UrlField: () => Ht });
|
|
351
|
+
function Ht({ value: e, onChange: t, field: n, readonly: r, errorMessage: i, ...a }) {
|
|
351
352
|
let o = n || a.schema;
|
|
352
353
|
if (r) return e ? e.startsWith("http://") || e.startsWith("https://") ? /* @__PURE__ */ Y("a", {
|
|
353
354
|
href: e,
|
|
@@ -370,8 +371,8 @@ function Vt({ value: e, onChange: t, field: n, readonly: r, errorMessage: i, ...
|
|
|
370
371
|
"aria-invalid": !!i
|
|
371
372
|
});
|
|
372
373
|
}
|
|
373
|
-
var
|
|
374
|
-
function
|
|
374
|
+
var Ut = Z((() => {})), Wt = Z((() => {})), Gt = /* @__PURE__ */ Q({ CurrencyField: () => qt });
|
|
375
|
+
function Kt(e, t, n) {
|
|
375
376
|
if (t) try {
|
|
376
377
|
return new Intl.NumberFormat("en-US", {
|
|
377
378
|
style: "currency",
|
|
@@ -391,11 +392,11 @@ function Gt(e, t, n) {
|
|
|
391
392
|
return e.toFixed(n);
|
|
392
393
|
}
|
|
393
394
|
}
|
|
394
|
-
function
|
|
395
|
+
function qt({ value: e, onChange: t, field: n, readonly: r, errorMessage: i, className: a, ...o }) {
|
|
395
396
|
let s = n || o.schema, { currency: c } = y(), l = v(s, c), u = s?.precision ?? 2;
|
|
396
397
|
if (r) return e == null ? /* @__PURE__ */ Y(P, {}) : /* @__PURE__ */ Y("span", {
|
|
397
398
|
className: "text-sm font-medium tabular-nums",
|
|
398
|
-
children:
|
|
399
|
+
children: Kt(Number(e), l, u)
|
|
399
400
|
});
|
|
400
401
|
let d = (e) => {
|
|
401
402
|
let n = parseFloat(e.target.value);
|
|
@@ -424,10 +425,10 @@ function Kt({ value: e, onChange: t, field: n, readonly: r, errorMessage: i, cla
|
|
|
424
425
|
})]
|
|
425
426
|
});
|
|
426
427
|
}
|
|
427
|
-
var
|
|
428
|
-
|
|
429
|
-
})),
|
|
430
|
-
function
|
|
428
|
+
var Jt = Z((() => {
|
|
429
|
+
Wt();
|
|
430
|
+
})), Yt = /* @__PURE__ */ Q({ TextAreaField: () => Xt });
|
|
431
|
+
function Xt({ value: e, onChange: t, field: n, readonly: r, errorMessage: i, ...a }) {
|
|
431
432
|
let [o, s] = u(!1), [c, l] = u(e ?? "");
|
|
432
433
|
if (r) return /* @__PURE__ */ Y("div", {
|
|
433
434
|
className: "text-sm whitespace-pre-wrap",
|
|
@@ -526,8 +527,8 @@ function Yt({ value: e, onChange: t, field: n, readonly: r, errorMessage: i, ...
|
|
|
526
527
|
]
|
|
527
528
|
});
|
|
528
529
|
}
|
|
529
|
-
var
|
|
530
|
-
function
|
|
530
|
+
var Zt = Z((() => {})), Qt = /* @__PURE__ */ Q({ RichTextField: () => $t });
|
|
531
|
+
function $t({ value: e, onChange: t, field: n, readonly: r, errorMessage: i, ...a }) {
|
|
531
532
|
let { t: o } = $e();
|
|
532
533
|
if (r) return /* @__PURE__ */ Y("div", {
|
|
533
534
|
className: "text-sm prose prose-sm max-w-none",
|
|
@@ -556,10 +557,10 @@ function Qt({ value: e, onChange: t, field: n, readonly: r, errorMessage: i, ...
|
|
|
556
557
|
})]
|
|
557
558
|
});
|
|
558
559
|
}
|
|
559
|
-
var
|
|
560
|
+
var en = Z((() => {}));
|
|
560
561
|
//#endregion
|
|
561
562
|
//#region src/widgets/useRecordQuery.ts
|
|
562
|
-
function
|
|
563
|
+
function tn(e) {
|
|
563
564
|
let { dataSource: t, objectName: n, enabled: r = !0, pageSize: a = 50, paginate: s = !1, filter: d, expand: f, searchFields: p, debounceMs: m = 300 } = e, [h, g] = u([]), [_, v] = u(!1), [y, b] = u(null), [x, S] = u(0), [C, w] = u(1), [T, E] = u(""), [D, O] = u(null), k = l(null), A = c(() => d && Object.keys(d).length ? JSON.stringify(d) : "", [d]), j = c(() => f?.length ? f.join(",") : "", [f]), M = c(() => p?.length ? p.join(",") : "", [p]), N = !!r && !!t && typeof t.find == "function" && !!n, P = i(async (e, r, i) => {
|
|
564
565
|
if (!(!N || !t || !n)) {
|
|
565
566
|
v(!0), b(null);
|
|
@@ -643,16 +644,16 @@ function en(e) {
|
|
|
643
644
|
refetch: ne
|
|
644
645
|
};
|
|
645
646
|
}
|
|
646
|
-
var
|
|
647
|
+
var nn = Z((() => {}));
|
|
647
648
|
//#endregion
|
|
648
649
|
//#region src/widgets/RecordPickerDialog.tsx
|
|
649
|
-
function
|
|
650
|
+
function rn(e) {
|
|
650
651
|
return typeof e == "string" ? { field: e } : e;
|
|
651
652
|
}
|
|
652
|
-
function
|
|
653
|
+
function an(e) {
|
|
653
654
|
return e.replace(/_/g, " ").replace(/([a-z])([A-Z])/g, "$1 $2").replace(/\b\w/g, (e) => e.toUpperCase());
|
|
654
655
|
}
|
|
655
|
-
function
|
|
656
|
+
function on(e) {
|
|
656
657
|
let t = {};
|
|
657
658
|
for (let n of e) switch (n.operator) {
|
|
658
659
|
case "eq":
|
|
@@ -685,7 +686,7 @@ function an(e) {
|
|
|
685
686
|
}
|
|
686
687
|
return t;
|
|
687
688
|
}
|
|
688
|
-
function
|
|
689
|
+
function sn(e, t) {
|
|
689
690
|
let n = {};
|
|
690
691
|
for (let r of t) {
|
|
691
692
|
let t = e[r.field];
|
|
@@ -693,17 +694,17 @@ function on(e, t) {
|
|
|
693
694
|
}
|
|
694
695
|
return n;
|
|
695
696
|
}
|
|
696
|
-
function
|
|
697
|
-
let { t: D } =
|
|
697
|
+
function cn({ open: e, onOpenChange: t, title: n = "Select Record", multiple: r = !1, dataSource: a, objectName: s, columns: d, displayField: f = "name", titleFormat: p, idField: m = "id", pageSize: h = ln, value: g, onSelect: _, onSelectRecords: v, lookupFilters: y, baseFilter: b, cellRenderer: x, filterColumns: S, renderFilterBar: C, renderGrid: w }) {
|
|
698
|
+
let { t: D } = yt(), [A, P] = u(/* @__PURE__ */ new Set()), F = l(/* @__PURE__ */ new Map()), [ee, te] = u(-1), ne = l(null), [re, R] = u(!1), [z, ce] = u({}), [le, ue] = u({}), de = l(null), [fe, me] = u(""), V = c(() => d && d.length > 0 ? d.map(rn) : [{
|
|
698
699
|
field: f,
|
|
699
|
-
label:
|
|
700
|
+
label: an(f)
|
|
700
701
|
}], [d, f]), G = c(() => {
|
|
701
702
|
if (S && S.length > 0) return S;
|
|
702
703
|
if (y && y.length > 0) return y.map((e) => {
|
|
703
704
|
let t = "text";
|
|
704
705
|
return typeof e.value == "boolean" ? t = "boolean" : Array.isArray(e.value) ? t = "select" : typeof e.value == "number" || e.operator === "gt" || e.operator === "lt" || e.operator === "gte" || e.operator === "lte" ? t = "number" : (e.operator === "in" || e.operator === "notIn") && (t = "select"), {
|
|
705
706
|
field: e.field,
|
|
706
|
-
label:
|
|
707
|
+
label: an(e.field),
|
|
707
708
|
type: t,
|
|
708
709
|
...Array.isArray(e.value) ? { options: e.value.map((e) => {
|
|
709
710
|
if (typeof e == "object" && e) {
|
|
@@ -720,14 +721,14 @@ function sn({ open: e, onOpenChange: t, title: n = "Select Record", multiple: r
|
|
|
720
721
|
}) } : {}
|
|
721
722
|
};
|
|
722
723
|
});
|
|
723
|
-
}, [S, y]), q =
|
|
724
|
+
}, [S, y]), q = tn({
|
|
724
725
|
dataSource: a,
|
|
725
726
|
objectName: s,
|
|
726
727
|
enabled: e,
|
|
727
728
|
pageSize: h,
|
|
728
729
|
paginate: !0,
|
|
729
730
|
filter: c(() => {
|
|
730
|
-
let e = y?.length ?
|
|
731
|
+
let e = y?.length ? on(y) : {}, t = G?.length ? sn(z, G) : {}, n = {
|
|
731
732
|
...e,
|
|
732
733
|
...t,
|
|
733
734
|
...b ?? {}
|
|
@@ -841,7 +842,7 @@ function sn({ open: e, onOpenChange: t, title: n = "Select Record", multiple: r
|
|
|
841
842
|
};
|
|
842
843
|
let r = (e) => {
|
|
843
844
|
if (!de.current) return;
|
|
844
|
-
let t = e.clientX - de.current.startX, n = Math.max(
|
|
845
|
+
let t = e.clientX - de.current.startX, n = Math.max(un, de.current.startWidth + t);
|
|
845
846
|
ue((e) => ({
|
|
846
847
|
...e,
|
|
847
848
|
[de.current.field]: n
|
|
@@ -858,7 +859,7 @@ function sn({ open: e, onOpenChange: t, title: n = "Select Record", multiple: r
|
|
|
858
859
|
}, []), Qe = i(() => {
|
|
859
860
|
ce({}), Ne(1);
|
|
860
861
|
}, []), $e = c(() => Object.values(z).filter((e) => e != null && e !== "").length, [z]), et = i((e) => {
|
|
861
|
-
let t = z[e.field], n = e.label ||
|
|
862
|
+
let t = z[e.field], n = e.label || an(e.field);
|
|
862
863
|
switch (e.type) {
|
|
863
864
|
case "select": return /* @__PURE__ */ X("div", {
|
|
864
865
|
className: "space-y-1",
|
|
@@ -1052,7 +1053,7 @@ function sn({ open: e, onOpenChange: t, title: n = "Select Record", multiple: r
|
|
|
1052
1053
|
children: /* @__PURE__ */ X(he, { children: [/* @__PURE__ */ Y(_e, { children: /* @__PURE__ */ X(W, {
|
|
1053
1054
|
className: "bg-muted/40",
|
|
1054
1055
|
children: [r && /* @__PURE__ */ Y(U, { className: "w-10" }), V.map((e) => /* @__PURE__ */ Y(U, { children: /* @__PURE__ */ Y(pe, { className: "h-4 w-20" }) }, e.field))]
|
|
1055
|
-
}) }), /* @__PURE__ */ Y(ge, { children: Array.from({ length:
|
|
1056
|
+
}) }), /* @__PURE__ */ Y(ge, { children: Array.from({ length: dn }, (e, t) => /* @__PURE__ */ X(W, { children: [r && /* @__PURE__ */ Y(H, {
|
|
1056
1057
|
className: "w-10",
|
|
1057
1058
|
children: /* @__PURE__ */ Y(pe, { className: "size-4 rounded" })
|
|
1058
1059
|
}), V.map((e) => /* @__PURE__ */ Y(H, { children: /* @__PURE__ */ Y(pe, { className: "h-4 w-full" }) }, e.field))] }, t)) })] })
|
|
@@ -1093,7 +1094,7 @@ function sn({ open: e, onOpenChange: t, title: n = "Select Record", multiple: r
|
|
|
1093
1094
|
"aria-sort": je === e.field ? Me === "asc" ? "ascending" : "descending" : "none",
|
|
1094
1095
|
children: [/* @__PURE__ */ X("span", {
|
|
1095
1096
|
className: "inline-flex items-center",
|
|
1096
|
-
children: [e.label ||
|
|
1097
|
+
children: [e.label || an(e.field), Je(e.field)]
|
|
1097
1098
|
}), /* @__PURE__ */ Y("span", {
|
|
1098
1099
|
role: "separator",
|
|
1099
1100
|
"aria-orientation": "vertical",
|
|
@@ -1194,18 +1195,18 @@ function sn({ open: e, onOpenChange: t, title: n = "Select Record", multiple: r
|
|
|
1194
1195
|
})
|
|
1195
1196
|
});
|
|
1196
1197
|
}
|
|
1197
|
-
var
|
|
1198
|
-
|
|
1198
|
+
var ln, un, dn, fn = Z((() => {
|
|
1199
|
+
bt(), nn(), ln = 10, un = 60, dn = 5;
|
|
1199
1200
|
}));
|
|
1200
1201
|
//#endregion
|
|
1201
1202
|
//#region src/widgets/personDisplay.ts
|
|
1202
|
-
function
|
|
1203
|
+
function pn(e, t) {
|
|
1203
1204
|
if (!(!e || !t)) return t.includes(".") ? t.split(".").reduce((e, t) => e == null ? e : e[t], e) : e[t];
|
|
1204
1205
|
}
|
|
1205
|
-
function
|
|
1206
|
+
function mn(e, t = "name") {
|
|
1206
1207
|
return e == null ? "" : String(typeof e == "object" ? e[t] ?? e.name ?? e.username ?? e.label ?? "" : e);
|
|
1207
1208
|
}
|
|
1208
|
-
function
|
|
1209
|
+
function hn(e) {
|
|
1209
1210
|
let t = (e || "").trim();
|
|
1210
1211
|
if (!t) return "?";
|
|
1211
1212
|
let n = t.split(/\s+/).filter(Boolean);
|
|
@@ -1213,17 +1214,17 @@ function mn(e) {
|
|
|
1213
1214
|
let r = n[0];
|
|
1214
1215
|
return /[㐀-鿿]/.test(r) ? r.length <= 2 ? r : r.slice(-2) : r.slice(0, 2).toUpperCase();
|
|
1215
1216
|
}
|
|
1216
|
-
function
|
|
1217
|
-
return !e || !t || t.length === 0 ? "" : t.map((t) =>
|
|
1217
|
+
function gn(e, t) {
|
|
1218
|
+
return !e || !t || t.length === 0 ? "" : t.map((t) => pn(e, t)).filter((e) => e != null && e !== "").map((e) => String(e)).join(" · ");
|
|
1218
1219
|
}
|
|
1219
|
-
function
|
|
1220
|
-
let n = e ?
|
|
1220
|
+
function _n(e, t = "image") {
|
|
1221
|
+
let n = e ? pn(e, t) : void 0;
|
|
1221
1222
|
return n ? String(n) : void 0;
|
|
1222
1223
|
}
|
|
1223
|
-
function
|
|
1224
|
+
function vn(e, t = "id") {
|
|
1224
1225
|
return !e || typeof e != "object" ? e : e[t] ?? e.id ?? e._id;
|
|
1225
1226
|
}
|
|
1226
|
-
function
|
|
1227
|
+
function yn(e, t) {
|
|
1227
1228
|
let n = e ?? "", r = (t ?? "").trim().toLowerCase();
|
|
1228
1229
|
if (!r || !n) return [];
|
|
1229
1230
|
let i = n.toLowerCase(), a = [], o = 0;
|
|
@@ -1234,11 +1235,11 @@ function vn(e, t) {
|
|
|
1234
1235
|
}
|
|
1235
1236
|
return a;
|
|
1236
1237
|
}
|
|
1237
|
-
var
|
|
1238
|
+
var bn = Z((() => {}));
|
|
1238
1239
|
//#endregion
|
|
1239
1240
|
//#region src/widgets/PersonRow.tsx
|
|
1240
|
-
function
|
|
1241
|
-
let n = t ?
|
|
1241
|
+
function xn({ text: e, query: t }) {
|
|
1242
|
+
let n = t ? yn(e, t) : [];
|
|
1242
1243
|
if (n.length === 0) return /* @__PURE__ */ Y(tt, { children: e });
|
|
1243
1244
|
let r = [], i = 0;
|
|
1244
1245
|
return n.forEach(([t, n], a) => {
|
|
@@ -1248,8 +1249,8 @@ function bn({ text: e, query: t }) {
|
|
|
1248
1249
|
}, a)), i = n;
|
|
1249
1250
|
}), i < e.length && r.push(e.slice(i)), /* @__PURE__ */ Y(tt, { children: r });
|
|
1250
1251
|
}
|
|
1251
|
-
function
|
|
1252
|
-
let d =
|
|
1252
|
+
function Sn({ record: e, displayField: t = "name", subtitleFields: n, avatarField: r = "image", selected: i = !1, active: a = !1, highlightQuery: s, onSelect: c, className: u }) {
|
|
1253
|
+
let d = mn(e, t), f = gn(e, n), p = _n(e, r), m = hn(d), h = l(null);
|
|
1253
1254
|
return o(() => {
|
|
1254
1255
|
a && h.current?.scrollIntoView?.({ block: "nearest" });
|
|
1255
1256
|
}, [a]), /* @__PURE__ */ X("button", {
|
|
@@ -1276,13 +1277,13 @@ function xn({ record: e, displayField: t = "name", subtitleFields: n, avatarFiel
|
|
|
1276
1277
|
className: "min-w-0 flex-1",
|
|
1277
1278
|
children: [/* @__PURE__ */ Y("div", {
|
|
1278
1279
|
className: "truncate text-sm font-medium",
|
|
1279
|
-
children: d ? /* @__PURE__ */ Y(
|
|
1280
|
+
children: d ? /* @__PURE__ */ Y(xn, {
|
|
1280
1281
|
text: d,
|
|
1281
1282
|
query: s
|
|
1282
1283
|
}) : "—"
|
|
1283
1284
|
}), f && /* @__PURE__ */ Y("div", {
|
|
1284
1285
|
className: "truncate text-xs text-muted-foreground",
|
|
1285
|
-
children: /* @__PURE__ */ Y(
|
|
1286
|
+
children: /* @__PURE__ */ Y(xn, {
|
|
1286
1287
|
text: f,
|
|
1287
1288
|
query: s
|
|
1288
1289
|
})
|
|
@@ -1295,12 +1296,12 @@ function xn({ record: e, displayField: t = "name", subtitleFields: n, avatarFiel
|
|
|
1295
1296
|
]
|
|
1296
1297
|
});
|
|
1297
1298
|
}
|
|
1298
|
-
var
|
|
1299
|
-
|
|
1299
|
+
var Cn = Z((() => {
|
|
1300
|
+
bn();
|
|
1300
1301
|
}));
|
|
1301
1302
|
//#endregion
|
|
1302
1303
|
//#region src/widgets/SelectionTray.tsx
|
|
1303
|
-
function
|
|
1304
|
+
function wn({ records: e, onRemove: t, displayField: n = "name", avatarField: r = "image", idField: i = "id", label: a, onClear: o, clearLabel: s, emptyText: c, className: l }) {
|
|
1304
1305
|
let u = !!a || !!o && e.length > 0;
|
|
1305
1306
|
return /* @__PURE__ */ X("div", {
|
|
1306
1307
|
className: K("flex flex-col gap-1.5", l),
|
|
@@ -1323,7 +1324,7 @@ function Cn({ records: e, onRemove: t, displayField: n = "name", avatarField: r
|
|
|
1323
1324
|
}) : /* @__PURE__ */ Y("div", {
|
|
1324
1325
|
className: "flex flex-wrap gap-1.5",
|
|
1325
1326
|
children: e.map((e) => {
|
|
1326
|
-
let a =
|
|
1327
|
+
let a = vn(e, i), o = mn(e, n), s = _n(e, r), c = hn(o);
|
|
1327
1328
|
return /* @__PURE__ */ X("span", {
|
|
1328
1329
|
"data-testid": "selection-chip",
|
|
1329
1330
|
className: "inline-flex items-center gap-1.5 rounded-full border bg-background py-0.5 pl-0.5 pr-1.5 text-sm",
|
|
@@ -1358,46 +1359,46 @@ function Cn({ records: e, onRemove: t, displayField: n = "name", avatarField: r
|
|
|
1358
1359
|
})]
|
|
1359
1360
|
});
|
|
1360
1361
|
}
|
|
1361
|
-
var
|
|
1362
|
-
|
|
1362
|
+
var Tn = Z((() => {
|
|
1363
|
+
bn();
|
|
1363
1364
|
}));
|
|
1364
1365
|
//#endregion
|
|
1365
1366
|
//#region src/widgets/recentLookups.ts
|
|
1366
|
-
function
|
|
1367
|
+
function En() {
|
|
1367
1368
|
try {
|
|
1368
1369
|
return typeof localStorage < "u" ? localStorage : null;
|
|
1369
1370
|
} catch {
|
|
1370
1371
|
return null;
|
|
1371
1372
|
}
|
|
1372
1373
|
}
|
|
1373
|
-
function
|
|
1374
|
-
let t =
|
|
1374
|
+
function Dn(e) {
|
|
1375
|
+
let t = En();
|
|
1375
1376
|
if (!e || !t) return [];
|
|
1376
1377
|
try {
|
|
1377
|
-
let n = t.getItem(
|
|
1378
|
+
let n = t.getItem(kn + e);
|
|
1378
1379
|
if (!n) return [];
|
|
1379
1380
|
let r = JSON.parse(n);
|
|
1380
|
-
return Array.isArray(r) ? r.slice(0,
|
|
1381
|
+
return Array.isArray(r) ? r.slice(0, An) : [];
|
|
1381
1382
|
} catch {
|
|
1382
1383
|
return [];
|
|
1383
1384
|
}
|
|
1384
1385
|
}
|
|
1385
|
-
function
|
|
1386
|
-
let n =
|
|
1386
|
+
function On(e, t) {
|
|
1387
|
+
let n = En();
|
|
1387
1388
|
if (!(!e || t == null || t === "" || !n)) try {
|
|
1388
|
-
let r = [t, ...
|
|
1389
|
-
n.setItem(
|
|
1389
|
+
let r = [t, ...Dn(e).filter((e) => e !== t)].slice(0, An);
|
|
1390
|
+
n.setItem(kn + e, JSON.stringify(r));
|
|
1390
1391
|
} catch {}
|
|
1391
1392
|
}
|
|
1392
|
-
var
|
|
1393
|
-
|
|
1393
|
+
var kn, An, jn = Z((() => {
|
|
1394
|
+
kn = "objectui:lookup:recent:", An = 5;
|
|
1394
1395
|
}));
|
|
1395
1396
|
//#endregion
|
|
1396
1397
|
//#region src/widgets/PeoplePicker.tsx
|
|
1397
|
-
function
|
|
1398
|
-
let { t: E } =
|
|
1398
|
+
function Mn({ open: e, onOpenChange: t, title: n, multiple: r = !1, dataSource: a, objectName: s, displayField: d = "name", idField: f = "id", subtitleFields: p, avatarField: m = "image", expand: h, searchFields: g, pageSize: _ = Nn, lookupFilters: v, baseFilter: y, value: b, onSelect: x, onSelectRecords: S, inline: C = !1, trigger: w }) {
|
|
1399
|
+
let { t: E } = yt(), D = q(), A = c(() => {
|
|
1399
1400
|
let e = {
|
|
1400
|
-
...v?.length ?
|
|
1401
|
+
...v?.length ? on(v) : {},
|
|
1401
1402
|
...y ?? {}
|
|
1402
1403
|
};
|
|
1403
1404
|
return Object.keys(e).length > 0 ? e : void 0;
|
|
@@ -1407,7 +1408,7 @@ function jn({ open: e, onOpenChange: t, title: n, multiple: r = !1, dataSource:
|
|
|
1407
1408
|
return (p ?? []).forEach((t) => {
|
|
1408
1409
|
t.includes(".") && e.add(t.split(".")[0]);
|
|
1409
1410
|
}), e.size ? Array.from(e) : void 0;
|
|
1410
|
-
}, [h, p]), P =
|
|
1411
|
+
}, [h, p]), P = tn({
|
|
1411
1412
|
dataSource: a,
|
|
1412
1413
|
objectName: s,
|
|
1413
1414
|
enabled: e,
|
|
@@ -1415,7 +1416,7 @@ function jn({ open: e, onOpenChange: t, title: n, multiple: r = !1, dataSource:
|
|
|
1415
1416
|
filter: A,
|
|
1416
1417
|
expand: j,
|
|
1417
1418
|
searchFields: g
|
|
1418
|
-
}), F = c(() => e ?
|
|
1419
|
+
}), F = c(() => e ? Dn(s) : [], [e, s]), L = c(() => r ? Array.isArray(b) ? b : [] : b != null && b !== "" ? [b] : [], [r, b]), re = c(() => Array.from(new Set([...L, ...F].map((e) => e))), [L, F]), R = tn({
|
|
1419
1420
|
dataSource: a,
|
|
1420
1421
|
objectName: s,
|
|
1421
1422
|
enabled: e && re.length > 0,
|
|
@@ -1424,7 +1425,7 @@ function jn({ open: e, onOpenChange: t, title: n, multiple: r = !1, dataSource:
|
|
|
1424
1425
|
expand: j
|
|
1425
1426
|
}), ie = c(() => {
|
|
1426
1427
|
let e = /* @__PURE__ */ new Map();
|
|
1427
|
-
for (let t of R.records) e.set(String(
|
|
1428
|
+
for (let t of R.records) e.set(String(vn(t, f)), t);
|
|
1428
1429
|
return e;
|
|
1429
1430
|
}, [R.records, f]), [B, ae] = u([]), oe = l(!1), se = l(!1);
|
|
1430
1431
|
o(() => {
|
|
@@ -1448,8 +1449,8 @@ function jn({ open: e, onOpenChange: t, title: n, multiple: r = !1, dataSource:
|
|
|
1448
1449
|
R.loading,
|
|
1449
1450
|
ie
|
|
1450
1451
|
]);
|
|
1451
|
-
let me = c(() => new Set(B.map((e) => String(
|
|
1452
|
-
x(r ? e : e[0] ?? null), S?.(n), e.forEach((e) =>
|
|
1452
|
+
let me = c(() => new Set(B.map((e) => String(vn(e, f)))), [B, f]), V = i((e, n) => {
|
|
1453
|
+
x(r ? e : e[0] ?? null), S?.(n), e.forEach((e) => On(s, e)), t(!1);
|
|
1453
1454
|
}, [
|
|
1454
1455
|
r,
|
|
1455
1456
|
s,
|
|
@@ -1457,19 +1458,19 @@ function jn({ open: e, onOpenChange: t, title: n, multiple: r = !1, dataSource:
|
|
|
1457
1458
|
S,
|
|
1458
1459
|
t
|
|
1459
1460
|
]), he = i((e) => {
|
|
1460
|
-
x(e.map((e) =>
|
|
1461
|
+
x(e.map((e) => vn(e, f))), S?.(e);
|
|
1461
1462
|
}, [
|
|
1462
1463
|
x,
|
|
1463
1464
|
S,
|
|
1464
1465
|
f
|
|
1465
1466
|
]), ge = i((e) => {
|
|
1466
|
-
let t =
|
|
1467
|
+
let t = vn(e, f);
|
|
1467
1468
|
if (!r) {
|
|
1468
1469
|
V([t], [e]);
|
|
1469
1470
|
return;
|
|
1470
1471
|
}
|
|
1471
|
-
let n = String(t), i = B.some((e) => String(
|
|
1472
|
-
ae(a), C && (i ||
|
|
1472
|
+
let n = String(t), i = B.some((e) => String(vn(e, f)) === n), a = i ? B.filter((e) => String(vn(e, f)) !== n) : [...B, e];
|
|
1473
|
+
ae(a), C && (i || On(s, t), he(a));
|
|
1473
1474
|
}, [
|
|
1474
1475
|
r,
|
|
1475
1476
|
f,
|
|
@@ -1479,7 +1480,7 @@ function jn({ open: e, onOpenChange: t, title: n, multiple: r = !1, dataSource:
|
|
|
1479
1480
|
s,
|
|
1480
1481
|
he
|
|
1481
1482
|
]), H = i((e) => {
|
|
1482
|
-
let t = String(e), n = B.filter((e) => String(
|
|
1483
|
+
let t = String(e), n = B.filter((e) => String(vn(e, f)) !== t);
|
|
1483
1484
|
ae(n), C && he(n);
|
|
1484
1485
|
}, [
|
|
1485
1486
|
f,
|
|
@@ -1487,7 +1488,7 @@ function jn({ open: e, onOpenChange: t, title: n, multiple: r = !1, dataSource:
|
|
|
1487
1488
|
C,
|
|
1488
1489
|
he
|
|
1489
1490
|
]), U = i(() => {
|
|
1490
|
-
V(B.map((e) =>
|
|
1491
|
+
V(B.map((e) => vn(e, f)), B);
|
|
1491
1492
|
}, [
|
|
1492
1493
|
V,
|
|
1493
1494
|
B,
|
|
@@ -1499,18 +1500,18 @@ function jn({ open: e, onOpenChange: t, title: n, multiple: r = !1, dataSource:
|
|
|
1499
1500
|
]), G = c(() => {
|
|
1500
1501
|
if (_e) return P.records;
|
|
1501
1502
|
let e = new Set(F.map(String));
|
|
1502
|
-
return P.records.filter((t) => !e.has(String(
|
|
1503
|
+
return P.records.filter((t) => !e.has(String(vn(t, f))));
|
|
1503
1504
|
}, [
|
|
1504
1505
|
_e,
|
|
1505
1506
|
P.records,
|
|
1506
1507
|
F,
|
|
1507
1508
|
f
|
|
1508
|
-
]), ye = c(() => [...W, ...G], [W, G]), [be, xe] = u(-1), Se = c(() => P.records.map((e) => String(
|
|
1509
|
+
]), ye = c(() => [...W, ...G], [W, G]), [be, xe] = u(-1), Se = c(() => P.records.map((e) => String(vn(e, f))).join("\0"), [P.records, f]), Ce = `${P.search}\u0000${Se}`, [we, Te] = u(Ce);
|
|
1509
1510
|
we !== Ce && (Te(Ce), xe(-1)), o(() => {
|
|
1510
1511
|
xe((e) => e >= ye.length ? ye.length - 1 : e);
|
|
1511
1512
|
}, [ye.length]);
|
|
1512
1513
|
let J = i((e) => {
|
|
1513
|
-
e.key === "ArrowDown" ? (e.preventDefault(), xe((e) => ye.length ? Math.min(ye.length - 1, e + 1) : -1)) : e.key === "ArrowUp" ? (e.preventDefault(), xe((e) => Math.max(0, e - 1))) : e.key === "Enter" ? be >= 0 && be < ye.length && (e.preventDefault(), ge(ye[be])) : e.key === "Backspace" && P.search.length === 0 && r && B.length > 0 && H(
|
|
1514
|
+
e.key === "ArrowDown" ? (e.preventDefault(), xe((e) => ye.length ? Math.min(ye.length - 1, e + 1) : -1)) : e.key === "ArrowUp" ? (e.preventDefault(), xe((e) => Math.max(0, e - 1))) : e.key === "Enter" ? be >= 0 && be < ye.length && (e.preventDefault(), ge(ye[be])) : e.key === "Backspace" && P.search.length === 0 && r && B.length > 0 && H(vn(B[B.length - 1], f));
|
|
1514
1515
|
}, [
|
|
1515
1516
|
ye,
|
|
1516
1517
|
be,
|
|
@@ -1521,8 +1522,8 @@ function jn({ open: e, onOpenChange: t, title: n, multiple: r = !1, dataSource:
|
|
|
1521
1522
|
H,
|
|
1522
1523
|
f
|
|
1523
1524
|
]), Ee = P.loading && !P.error && P.records.length === 0 && W.length === 0, De = P.loading && !Ee, Oe = !P.loading && !P.error && G.length === 0 && W.length === 0, ke = (e, t) => {
|
|
1524
|
-
let n =
|
|
1525
|
-
return /* @__PURE__ */ Y(
|
|
1525
|
+
let n = vn(e, f);
|
|
1526
|
+
return /* @__PURE__ */ Y(Sn, {
|
|
1526
1527
|
record: e,
|
|
1527
1528
|
displayField: d,
|
|
1528
1529
|
subtitleFields: p,
|
|
@@ -1585,7 +1586,7 @@ function jn({ open: e, onOpenChange: t, title: n, multiple: r = !1, dataSource:
|
|
|
1585
1586
|
children: E("lookup.retry")
|
|
1586
1587
|
})
|
|
1587
1588
|
]
|
|
1588
|
-
}) : Ee ? Array.from({ length:
|
|
1589
|
+
}) : Ee ? Array.from({ length: Pn }).map((e, t) => /* @__PURE__ */ X("div", {
|
|
1589
1590
|
className: "flex items-center gap-3 px-2 py-1.5",
|
|
1590
1591
|
children: [/* @__PURE__ */ Y(pe, { className: "size-9 shrink-0 rounded-full" }), /* @__PURE__ */ X("div", {
|
|
1591
1592
|
className: "flex-1 space-y-1.5",
|
|
@@ -1614,7 +1615,7 @@ function jn({ open: e, onOpenChange: t, title: n, multiple: r = !1, dataSource:
|
|
|
1614
1615
|
] })
|
|
1615
1616
|
})
|
|
1616
1617
|
}),
|
|
1617
|
-
r && !C && /* @__PURE__ */ X(tt, { children: [/* @__PURE__ */ Y(
|
|
1618
|
+
r && !C && /* @__PURE__ */ X(tt, { children: [/* @__PURE__ */ Y(wn, {
|
|
1618
1619
|
records: B,
|
|
1619
1620
|
onRemove: H,
|
|
1620
1621
|
onClear: () => ae([]),
|
|
@@ -1687,17 +1688,17 @@ function jn({ open: e, onOpenChange: t, title: n, multiple: r = !1, dataSource:
|
|
|
1687
1688
|
})
|
|
1688
1689
|
});
|
|
1689
1690
|
}
|
|
1690
|
-
var
|
|
1691
|
-
|
|
1691
|
+
var Nn, Pn, Fn = Z((() => {
|
|
1692
|
+
nn(), fn(), bn(), Cn(), Tn(), jn(), bt(), Nn = 25, Pn = 6;
|
|
1692
1693
|
}));
|
|
1693
1694
|
//#endregion
|
|
1694
1695
|
//#region src/widgets/deriveLookupColumns.ts
|
|
1695
|
-
function
|
|
1696
|
+
function In(e) {
|
|
1696
1697
|
let t = /* @__PURE__ */ new Set(), n = [];
|
|
1697
1698
|
for (let r of e) t.has(r) || (t.add(r), n.push(r));
|
|
1698
1699
|
return n;
|
|
1699
1700
|
}
|
|
1700
|
-
function
|
|
1701
|
+
function Ln(e, { displayField: t, max: n = 4 }) {
|
|
1701
1702
|
let r = e?.fields ?? {}, i = (e) => r[e] ?? {}, a = (e) => {
|
|
1702
1703
|
let t = i(e);
|
|
1703
1704
|
return {
|
|
@@ -1707,15 +1708,15 @@ function In(e, { displayField: t, max: n = 4 }) {
|
|
|
1707
1708
|
};
|
|
1708
1709
|
};
|
|
1709
1710
|
if (Object.keys(r).length === 0) return [];
|
|
1710
|
-
let o = (e) => !Array.isArray(e) || e.length === 0 ? null :
|
|
1711
|
-
return o(e?.highlightFields) || o(e?.displayFields) ||
|
|
1711
|
+
let o = (e) => !Array.isArray(e) || e.length === 0 ? null : In([t, ...e.filter((e) => typeof e == "string" && e.length > 0).filter((e) => e !== t)]).slice(0, n).map(a);
|
|
1712
|
+
return o(e?.highlightFields) || o(e?.displayFields) || In([t, ...Object.keys(r).filter((e) => {
|
|
1712
1713
|
if (e === t) return !1;
|
|
1713
1714
|
let n = i(e);
|
|
1714
|
-
return !(nt(e, n) || n.hidden || n.type &&
|
|
1715
|
+
return !(nt(e, n) || n.hidden || n.type && Rn.has(n.type));
|
|
1715
1716
|
})]).slice(0, n).map(a);
|
|
1716
1717
|
}
|
|
1717
|
-
var
|
|
1718
|
-
|
|
1718
|
+
var Rn, zn = Z((() => {
|
|
1719
|
+
Rn = /* @__PURE__ */ new Set([
|
|
1719
1720
|
"json",
|
|
1720
1721
|
"object",
|
|
1721
1722
|
"grid",
|
|
@@ -1737,17 +1738,17 @@ var Ln, Rn = Z((() => {
|
|
|
1737
1738
|
}));
|
|
1738
1739
|
//#endregion
|
|
1739
1740
|
//#region src/widgets/_cell-renderer-bridge.ts
|
|
1740
|
-
function
|
|
1741
|
-
|
|
1741
|
+
function Bn(e) {
|
|
1742
|
+
Hn = e;
|
|
1742
1743
|
}
|
|
1743
|
-
function
|
|
1744
|
-
return
|
|
1744
|
+
function Vn() {
|
|
1745
|
+
return Hn;
|
|
1745
1746
|
}
|
|
1746
|
-
var
|
|
1747
|
-
function
|
|
1748
|
-
return !!e &&
|
|
1747
|
+
var Hn, Un = Z((() => {})), Wn = /* @__PURE__ */ Q({ LookupField: () => Xn });
|
|
1748
|
+
function Gn(e) {
|
|
1749
|
+
return !!e && !$n.test(e) && !er.has(e);
|
|
1749
1750
|
}
|
|
1750
|
-
function
|
|
1751
|
+
function Kn(e, t) {
|
|
1751
1752
|
if (!e || typeof e != "object" || !t) return null;
|
|
1752
1753
|
let n = "[-\\u2013\\u2014|/·,:]", r = !1, i = t.replace(/\{([^{}]+)\}/g, (t, n) => {
|
|
1753
1754
|
let i = e[n.trim()];
|
|
@@ -1755,8 +1756,8 @@ function Gn(e, t) {
|
|
|
1755
1756
|
});
|
|
1756
1757
|
return r && i.replace(RegExp(`\\s*${n}\\s*`, "g"), "").replace(RegExp(`\\s*${n}\\s*`, "g"), "").replace(/* @__PURE__ */ RegExp("\0", "g"), "").replace(/\s+/g, " ").trim() || null;
|
|
1757
1758
|
}
|
|
1758
|
-
function
|
|
1759
|
-
let o = e[n] ?? e.id ?? e._id ?? e.externalId, s = i ?
|
|
1759
|
+
function qn(e, t, n, r, i, a) {
|
|
1760
|
+
let o = e[n] ?? e.id ?? e._id ?? e.externalId, s = i ? Kn(e, i) : null, c;
|
|
1760
1761
|
if (a) {
|
|
1761
1762
|
let t = f(a, e), n = e?.id ?? e?._id;
|
|
1762
1763
|
t === "Untitled" || n != null && t === `Record #${n}` || (c = t);
|
|
@@ -1769,7 +1770,7 @@ function Kn(e, t, n, r, i, a) {
|
|
|
1769
1770
|
...e
|
|
1770
1771
|
};
|
|
1771
1772
|
}
|
|
1772
|
-
function
|
|
1773
|
+
function Jn(e) {
|
|
1773
1774
|
if (typeof e != "string") return null;
|
|
1774
1775
|
let t = e.trim();
|
|
1775
1776
|
if (!t.startsWith("{") || !t.endsWith("}")) return null;
|
|
@@ -1780,7 +1781,7 @@ function qn(e) {
|
|
|
1780
1781
|
return null;
|
|
1781
1782
|
}
|
|
1782
1783
|
}
|
|
1783
|
-
function
|
|
1784
|
+
function Yn(e) {
|
|
1784
1785
|
return {
|
|
1785
1786
|
text: "text",
|
|
1786
1787
|
number: "number",
|
|
@@ -1793,8 +1794,8 @@ function Jn(e) {
|
|
|
1793
1794
|
boolean: "boolean"
|
|
1794
1795
|
}[e];
|
|
1795
1796
|
}
|
|
1796
|
-
function
|
|
1797
|
-
let [f, p] = u(!1), { t: m } =
|
|
1797
|
+
function Xn({ value: e, onChange: n, field: r, readonly: s, ...d }) {
|
|
1798
|
+
let [f, p] = u(!1), { t: m } = yt(), h = t.useId(), [g, _] = u(null), [v, y] = u([]), [b, E] = u(() => /* @__PURE__ */ new Set()), [D, O] = u(-1), k = l(null), A = r || d.schema, j = A?.field, M = j && typeof j == "object" && ("reference_to" in j || "reference" in j || "type" in j) ? j : A, N = M?.options || [], F = M?.multiple || !1, L = M?.display_field || M?.displayField || M?.reference_field || "name", re = M?.description_field ?? M?.descriptionField, R = M?.id_field || "id", z = M?.reference_to || M?.reference, ie = M?.allow_create ?? M?.allowCreate, B = ie == null ? Gn(z) : !!ie, ae = M?.lookup_columns ?? M?.lookupColumns, oe = M?.lookup_page_size ?? M?.lookupPageSize, se = M?.lookup_filters ?? M?.lookupFilters, ce = M?.picker, le = M?.subtitle, ue = M?.avatar_field ?? M?.avatarField ?? "image", de = c(() => {
|
|
1798
1799
|
let e = M?.depends_on ?? M?.dependsOn;
|
|
1799
1800
|
return e && Array.isArray(e) ? e.map((e) => typeof e == "string" ? {
|
|
1800
1801
|
field: e,
|
|
@@ -1803,7 +1804,7 @@ function Yn({ value: e, onChange: n, field: r, readonly: s, ...d }) {
|
|
|
1803
1804
|
field: e.field,
|
|
1804
1805
|
param: e.param ?? e.field
|
|
1805
1806
|
}) : [];
|
|
1806
|
-
}, [M?.depends_on, M?.dependsOn]), fe = d.dependentValues, pe = a(
|
|
1807
|
+
}, [M?.depends_on, M?.dependsOn]), fe = d.dependentValues, pe = a(Qn), me = pe?.dataSource ?? null, V = d.dataSource ?? A?.dataSource ?? M?.dataSource ?? me, he = c(() => fe || (pe?.formValues ?? pe?.data ?? {}), [
|
|
1807
1808
|
fe,
|
|
1808
1809
|
pe?.formValues,
|
|
1809
1810
|
pe?.data
|
|
@@ -1827,7 +1828,7 @@ function Yn({ value: e, onChange: n, field: r, readonly: s, ...d }) {
|
|
|
1827
1828
|
return typeof e == "string" ? e : e && typeof e == "object" && typeof e.source == "string" ? e.source : null;
|
|
1828
1829
|
}, [U]), G = c(() => {
|
|
1829
1830
|
if (ae && ae.length > 0) return ae;
|
|
1830
|
-
let e =
|
|
1831
|
+
let e = Ln(U, { displayField: L });
|
|
1831
1832
|
return e.length > 0 ? e : void 0;
|
|
1832
1833
|
}, [
|
|
1833
1834
|
ae,
|
|
@@ -1845,7 +1846,7 @@ function Yn({ value: e, onChange: n, field: r, readonly: s, ...d }) {
|
|
|
1845
1846
|
if (!G) return;
|
|
1846
1847
|
let e = [];
|
|
1847
1848
|
for (let t of G) if (typeof t == "object" && t.type) {
|
|
1848
|
-
let n =
|
|
1849
|
+
let n = Yn(t.type);
|
|
1849
1850
|
n && e.push({
|
|
1850
1851
|
field: t.field,
|
|
1851
1852
|
label: t.label,
|
|
@@ -1862,17 +1863,17 @@ function Yn({ value: e, onChange: n, field: r, readonly: s, ...d }) {
|
|
|
1862
1863
|
return Object.keys(e).length > 0 ? e : void 0;
|
|
1863
1864
|
}, [de, he]), we = c(() => {
|
|
1864
1865
|
let e = {
|
|
1865
|
-
...se && se.length > 0 ?
|
|
1866
|
+
...se && se.length > 0 ? on(se) : {},
|
|
1866
1867
|
...Ce ?? {}
|
|
1867
1868
|
};
|
|
1868
1869
|
return Object.keys(e).length > 0 ? e : void 0;
|
|
1869
|
-
}, [Ce, se]), Te =
|
|
1870
|
+
}, [Ce, se]), Te = tn({
|
|
1870
1871
|
dataSource: V,
|
|
1871
1872
|
objectName: z,
|
|
1872
1873
|
enabled: f && H && !ge,
|
|
1873
|
-
pageSize:
|
|
1874
|
+
pageSize: Zn,
|
|
1874
1875
|
filter: we
|
|
1875
|
-
}), J = Te.search, Ee = Te.loading, De = Te.total, Oe = Te.error ?? g, ke = c(() => Te.records.map((e) =>
|
|
1876
|
+
}), J = Te.search, Ee = Te.loading, De = Te.total, Oe = Te.error ?? g, ke = c(() => Te.records.map((e) => qn(e, L, R, q, W, U)), [
|
|
1876
1877
|
Te.records,
|
|
1877
1878
|
L,
|
|
1878
1879
|
R,
|
|
@@ -1896,7 +1897,7 @@ function Yn({ value: e, onChange: n, field: r, readonly: s, ...d }) {
|
|
|
1896
1897
|
let Me = i((e) => Te.setSearch(e), [Te.setSearch]);
|
|
1897
1898
|
o(() => {
|
|
1898
1899
|
if (!H || !V || !z) return;
|
|
1899
|
-
let t = (F ? Array.isArray(e) ? e : [] : e != null && e !== "" ? [e] : []).filter((e) => e != null && e !== "" && typeof e != "object" && !
|
|
1900
|
+
let t = (F ? Array.isArray(e) ? e : [] : e != null && e !== "" ? [e] : []).filter((e) => e != null && e !== "" && typeof e != "object" && !Jn(e));
|
|
1900
1901
|
if (!t.length) return;
|
|
1901
1902
|
let n = t.filter((e) => !Ne(e));
|
|
1902
1903
|
if (!n.length) return;
|
|
@@ -1908,24 +1909,24 @@ function Yn({ value: e, onChange: n, field: r, readonly: s, ...d }) {
|
|
|
1908
1909
|
let t = n[0];
|
|
1909
1910
|
if (typeof V.findOne == "function" && R === "id") {
|
|
1910
1911
|
let n = await V.findOne(z, t);
|
|
1911
|
-
n && e.push(
|
|
1912
|
+
n && e.push(qn(n, L, R, q, W, U));
|
|
1912
1913
|
} else {
|
|
1913
1914
|
let n = await V.find(z, {
|
|
1914
1915
|
$filter: { [R]: t },
|
|
1915
1916
|
$top: 1
|
|
1916
1917
|
}), r = n?.data ?? n ?? [];
|
|
1917
|
-
r[0] && e.push(
|
|
1918
|
+
r[0] && e.push(qn(r[0], L, R, q, W, U));
|
|
1918
1919
|
}
|
|
1919
1920
|
} else {
|
|
1920
1921
|
let t = [];
|
|
1921
|
-
for (let e = 0; e < n.length; e +=
|
|
1922
|
+
for (let e = 0; e < n.length; e += Zn) t.push(n.slice(e, e + Zn));
|
|
1922
1923
|
let r = await Promise.all(t.map((e) => V.find(z, {
|
|
1923
1924
|
$filter: { [R]: { $in: e } },
|
|
1924
1925
|
$top: e.length
|
|
1925
1926
|
})));
|
|
1926
1927
|
for (let t of r) {
|
|
1927
1928
|
let n = t?.data ?? t ?? [];
|
|
1928
|
-
if (Array.isArray(n)) for (let t of n) e.push(
|
|
1929
|
+
if (Array.isArray(n)) for (let t of n) e.push(qn(t, L, R, q, W, U));
|
|
1929
1930
|
}
|
|
1930
1931
|
}
|
|
1931
1932
|
!r && e.length && y((t) => {
|
|
@@ -1964,7 +1965,7 @@ function Yn({ value: e, onChange: n, field: r, readonly: s, ...d }) {
|
|
|
1964
1965
|
ke,
|
|
1965
1966
|
v
|
|
1966
1967
|
]), Fe = i((e) => {
|
|
1967
|
-
let t = typeof e == "object" && e ? e :
|
|
1968
|
+
let t = typeof e == "object" && e ? e : Jn(e);
|
|
1968
1969
|
return t ? t[R] ?? t.id ?? t._id ?? t.externalId : e;
|
|
1969
1970
|
}, [R]), Le = c(() => F ? Array.isArray(e) ? e.map(Fe) : [] : Fe(e), [
|
|
1970
1971
|
F,
|
|
@@ -1972,8 +1973,8 @@ function Yn({ value: e, onChange: n, field: r, readonly: s, ...d }) {
|
|
|
1972
1973
|
Fe
|
|
1973
1974
|
]), Re = i((e) => {
|
|
1974
1975
|
if (e == null || e === "") return;
|
|
1975
|
-
let t = typeof e == "object" ? e :
|
|
1976
|
-
return t ?
|
|
1976
|
+
let t = typeof e == "object" ? e : Jn(e);
|
|
1977
|
+
return t ? qn(t, L, R, q, W, U) : Ne(e) ?? Pe(e);
|
|
1977
1978
|
}, [
|
|
1978
1979
|
Ne,
|
|
1979
1980
|
Pe,
|
|
@@ -1982,7 +1983,7 @@ function Yn({ value: e, onChange: n, field: r, readonly: s, ...d }) {
|
|
|
1982
1983
|
q,
|
|
1983
1984
|
W,
|
|
1984
1985
|
U
|
|
1985
|
-
]), ze = c(() => H ? (F ? Array.isArray(e) ? e : [] : e != null && e !== "" ? [e] : []).some((e) => e != null && e !== "" && typeof e != "object" && !
|
|
1986
|
+
]), ze = c(() => H ? (F ? Array.isArray(e) ? e : [] : e != null && e !== "" ? [e] : []).some((e) => e != null && e !== "" && typeof e != "object" && !Jn(e) && !Ne(e) && !Pe(e) && !b.has(String(e))) : !1, [
|
|
1986
1987
|
H,
|
|
1987
1988
|
F,
|
|
1988
1989
|
e,
|
|
@@ -1995,8 +1996,8 @@ function Yn({ value: e, onChange: n, field: r, readonly: s, ...d }) {
|
|
|
1995
1996
|
return n.set(t.value, t), Array.from(n.values());
|
|
1996
1997
|
}), F) {
|
|
1997
1998
|
let r = (Array.isArray(e) ? e : []).map(Fe);
|
|
1998
|
-
r.includes(t.value) ? n(r.filter((e) => e !== t.value)) : (z &&
|
|
1999
|
-
} else z &&
|
|
1999
|
+
r.includes(t.value) ? n(r.filter((e) => e !== t.value)) : (z && On(z, t.value), n([...r, t.value]));
|
|
2000
|
+
} else z && On(z, t.value), We ? We(t) : n(t.value), p(!1);
|
|
2000
2001
|
}, [
|
|
2001
2002
|
F,
|
|
2002
2003
|
e,
|
|
@@ -2007,8 +2008,8 @@ function Yn({ value: e, onChange: n, field: r, readonly: s, ...d }) {
|
|
|
2007
2008
|
]), qe = (t) => {
|
|
2008
2009
|
n(F ? (Array.isArray(e) ? e : []).map(Fe).filter((e) => e !== t) : null);
|
|
2009
2010
|
}, Je = i((e) => {
|
|
2010
|
-
let t = e.map((e) =>
|
|
2011
|
-
z && t.forEach((e) =>
|
|
2011
|
+
let t = e.map((e) => qn(e, L, R, q, W, U));
|
|
2012
|
+
z && t.forEach((e) => On(z, e.value)), y(t);
|
|
2012
2013
|
}, [
|
|
2013
2014
|
L,
|
|
2014
2015
|
R,
|
|
@@ -2018,7 +2019,7 @@ function Yn({ value: e, onChange: n, field: r, readonly: s, ...d }) {
|
|
|
2018
2019
|
]), [Xe, $e] = u([]);
|
|
2019
2020
|
o(() => {
|
|
2020
2021
|
if (!f || !H || !V || !z || J) return;
|
|
2021
|
-
let e =
|
|
2022
|
+
let e = Dn(z);
|
|
2022
2023
|
if (!e.length) {
|
|
2023
2024
|
$e([]);
|
|
2024
2025
|
return;
|
|
@@ -2035,7 +2036,7 @@ function Yn({ value: e, onChange: n, field: r, readonly: s, ...d }) {
|
|
|
2035
2036
|
}
|
|
2036
2037
|
if (typeof V.findOne == "function") {
|
|
2037
2038
|
let e = await V.findOne(z, t);
|
|
2038
|
-
e && n.push(
|
|
2039
|
+
e && n.push(qn(e, L, R, q, W, U));
|
|
2039
2040
|
}
|
|
2040
2041
|
}
|
|
2041
2042
|
t || $e(n);
|
|
@@ -2064,7 +2065,7 @@ function Yn({ value: e, onChange: n, field: r, readonly: s, ...d }) {
|
|
|
2064
2065
|
o(() => {
|
|
2065
2066
|
O(-1);
|
|
2066
2067
|
}, [nt.length]);
|
|
2067
|
-
let [rt, it] = u(!1), { execute: at } = Ze(), ot = Qe(), st = !!be || B && (ot || H),
|
|
2068
|
+
let [rt, it] = u(!1), { execute: at } = Ze(), ot = Qe(), st = !!be || B && (ot || H), ct = i(async (e) => {
|
|
2068
2069
|
let t = (e || "").trim();
|
|
2069
2070
|
if (be) {
|
|
2070
2071
|
be(t), p(!1);
|
|
@@ -2081,7 +2082,7 @@ function Yn({ value: e, onChange: n, field: r, readonly: s, ...d }) {
|
|
|
2081
2082
|
}
|
|
2082
2083
|
});
|
|
2083
2084
|
if (e?.success && e.data) {
|
|
2084
|
-
let t =
|
|
2085
|
+
let t = qn(e.data, L, R, q, W, U);
|
|
2085
2086
|
y((e) => [t, ...e.filter((e) => e.value !== t.value)]), Ge(t);
|
|
2086
2087
|
return;
|
|
2087
2088
|
}
|
|
@@ -2090,7 +2091,7 @@ function Yn({ value: e, onChange: n, field: r, readonly: s, ...d }) {
|
|
|
2090
2091
|
if (!(!V || !t)) {
|
|
2091
2092
|
it(!0);
|
|
2092
2093
|
try {
|
|
2093
|
-
let e =
|
|
2094
|
+
let e = qn(await V.create(z, { [L]: t }), L, R, q, W, U);
|
|
2094
2095
|
y((t) => [e, ...t.filter((t) => t.value !== e.value)]), Ge(e);
|
|
2095
2096
|
} catch (e) {
|
|
2096
2097
|
_(e instanceof Error ? e.message : String(e));
|
|
@@ -2112,7 +2113,7 @@ function Yn({ value: e, onChange: n, field: r, readonly: s, ...d }) {
|
|
|
2112
2113
|
W,
|
|
2113
2114
|
U,
|
|
2114
2115
|
Ge
|
|
2115
|
-
]),
|
|
2116
|
+
]), Z = i((e) => {
|
|
2116
2117
|
if (!G || G.length === 0) return;
|
|
2117
2118
|
let t = [];
|
|
2118
2119
|
for (let n of G) {
|
|
@@ -2124,7 +2125,7 @@ function Yn({ value: e, onChange: n, field: r, readonly: s, ...d }) {
|
|
|
2124
2125
|
t.push(`${a}: ${o}`);
|
|
2125
2126
|
}
|
|
2126
2127
|
return t.length ? t.join(" · ") : void 0;
|
|
2127
|
-
}, [G, L]),
|
|
2128
|
+
}, [G, L]), Q = i((e) => {
|
|
2128
2129
|
e.key === "ArrowDown" ? (e.preventDefault(), O((e) => e < nt.length - 1 ? e + 1 : e)) : e.key === "ArrowUp" ? (e.preventDefault(), O((e) => e > 0 ? e - 1 : 0)) : e.key === "Enter" && (e.preventDefault(), D >= 0 && D < nt.length && Ge(nt[D]));
|
|
2129
2130
|
}, [
|
|
2130
2131
|
nt,
|
|
@@ -2182,7 +2183,7 @@ function Yn({ value: e, onChange: n, field: r, readonly: s, ...d }) {
|
|
|
2182
2183
|
alt: String(n || "")
|
|
2183
2184
|
}), /* @__PURE__ */ Y(S, {
|
|
2184
2185
|
className: "text-[10px]",
|
|
2185
|
-
children:
|
|
2186
|
+
children: hn(String(n || ""))
|
|
2186
2187
|
})]
|
|
2187
2188
|
}),
|
|
2188
2189
|
/* @__PURE__ */ Y("span", {
|
|
@@ -2212,7 +2213,7 @@ function Yn({ value: e, onChange: n, field: r, readonly: s, ...d }) {
|
|
|
2212
2213
|
}, t);
|
|
2213
2214
|
})
|
|
2214
2215
|
}),
|
|
2215
|
-
ce === "search" && H && V && z ? /* @__PURE__ */ Y(
|
|
2216
|
+
ce === "search" && H && V && z ? /* @__PURE__ */ Y(Mn, {
|
|
2216
2217
|
inline: !0,
|
|
2217
2218
|
trigger: dt,
|
|
2218
2219
|
open: xe,
|
|
@@ -2255,7 +2256,7 @@ function Yn({ value: e, onChange: n, field: r, readonly: s, ...d }) {
|
|
|
2255
2256
|
placeholder: m("common.search") + "...",
|
|
2256
2257
|
value: J,
|
|
2257
2258
|
onChange: (e) => Me(e.target.value),
|
|
2258
|
-
onKeyDown:
|
|
2259
|
+
onKeyDown: Q,
|
|
2259
2260
|
className: "w-full pl-9 h-8 text-sm",
|
|
2260
2261
|
role: "combobox",
|
|
2261
2262
|
"aria-autocomplete": "list",
|
|
@@ -2313,7 +2314,7 @@ function Yn({ value: e, onChange: n, field: r, readonly: s, ...d }) {
|
|
|
2313
2314
|
className: "mt-2 gap-1",
|
|
2314
2315
|
type: "button",
|
|
2315
2316
|
disabled: rt,
|
|
2316
|
-
onClick: () =>
|
|
2317
|
+
onClick: () => ct(J),
|
|
2317
2318
|
children: [rt ? /* @__PURE__ */ Y(Ie, { className: "size-4 animate-spin" }) : /* @__PURE__ */ Y(Be, { className: "size-4" }), J ? m("lookup.createNamed", { name: J }) : m("lookup.createNew")]
|
|
2318
2319
|
})]
|
|
2319
2320
|
}) : /* @__PURE__ */ X(tt, { children: [
|
|
@@ -2333,7 +2334,7 @@ function Yn({ value: e, onChange: n, field: r, readonly: s, ...d }) {
|
|
|
2333
2334
|
"data-lookup-index": r,
|
|
2334
2335
|
role: "option",
|
|
2335
2336
|
"aria-selected": i,
|
|
2336
|
-
title:
|
|
2337
|
+
title: Z(n),
|
|
2337
2338
|
onClick: () => Ge(n),
|
|
2338
2339
|
className: `w-full text-left px-3 py-2 rounded-md text-sm hover:bg-accent flex items-center justify-between ${a ? "bg-accent text-accent-foreground" : i ? "bg-accent/50 text-accent-foreground" : ""}`,
|
|
2339
2340
|
type: "button",
|
|
@@ -2374,7 +2375,7 @@ function Yn({ value: e, onChange: n, field: r, readonly: s, ...d }) {
|
|
|
2374
2375
|
type: "button",
|
|
2375
2376
|
className: "w-full text-left px-3 py-2 rounded-md text-sm hover:bg-accent flex items-center gap-1.5 text-muted-foreground",
|
|
2376
2377
|
disabled: rt,
|
|
2377
|
-
onClick: () =>
|
|
2378
|
+
onClick: () => ct(J),
|
|
2378
2379
|
children: [rt ? /* @__PURE__ */ Y(Ie, { className: "size-3.5 animate-spin" }) : /* @__PURE__ */ Y(Be, { className: "size-3.5" }), J ? m("lookup.createNamed", { name: J }) : m("lookup.createNew")]
|
|
2379
2380
|
})
|
|
2380
2381
|
] })
|
|
@@ -2394,7 +2395,7 @@ function Yn({ value: e, onChange: n, field: r, readonly: s, ...d }) {
|
|
|
2394
2395
|
children: /* @__PURE__ */ Y(Ke, { className: "size-4" })
|
|
2395
2396
|
})]
|
|
2396
2397
|
}),
|
|
2397
|
-
H && V && z && ce !== "search" && /* @__PURE__ */ Y(
|
|
2398
|
+
H && V && z && ce !== "search" && /* @__PURE__ */ Y(cn, {
|
|
2398
2399
|
open: xe,
|
|
2399
2400
|
onOpenChange: Se,
|
|
2400
2401
|
title: A?.label || m("common.select"),
|
|
@@ -2411,17 +2412,17 @@ function Yn({ value: e, onChange: n, field: r, readonly: s, ...d }) {
|
|
|
2411
2412
|
onSelectRecords: Je,
|
|
2412
2413
|
lookupFilters: se,
|
|
2413
2414
|
baseFilter: Ce,
|
|
2414
|
-
cellRenderer:
|
|
2415
|
+
cellRenderer: Vn(),
|
|
2415
2416
|
filterColumns: ye
|
|
2416
2417
|
})
|
|
2417
2418
|
]
|
|
2418
2419
|
});
|
|
2419
2420
|
}
|
|
2420
|
-
var
|
|
2421
|
-
|
|
2421
|
+
var Zn, Qn, $n, er, tr = Z((() => {
|
|
2422
|
+
fn(), Fn(), nn(), zn(), jn(), bn(), Un(), bt(), Zn = 50, Qn = Xe, $n = /^(sys_|cloud_|ai_)/, er = /* @__PURE__ */ new Set(["user", "users"]);
|
|
2422
2423
|
}));
|
|
2423
|
-
|
|
2424
|
-
function
|
|
2424
|
+
dt(), mt(), _t(), kt(), Pt(), Lt(), Bt(), Ut(), Jt(), Zt(), en(), tr(), bt();
|
|
2425
|
+
function nr(e) {
|
|
2425
2426
|
if (Array.isArray(e)) return e.map((e) => String(e)).filter(Boolean);
|
|
2426
2427
|
if (typeof e == "string") {
|
|
2427
2428
|
let t = e.trim();
|
|
@@ -2435,11 +2436,11 @@ function tr(e) {
|
|
|
2435
2436
|
}
|
|
2436
2437
|
return [];
|
|
2437
2438
|
}
|
|
2438
|
-
var
|
|
2439
|
+
var rr = [
|
|
2439
2440
|
"platform",
|
|
2440
2441
|
"org",
|
|
2441
2442
|
"other"
|
|
2442
|
-
],
|
|
2443
|
+
], ir = /* @__PURE__ */ new Set([
|
|
2443
2444
|
"manage_users",
|
|
2444
2445
|
"manage_org_users",
|
|
2445
2446
|
"manage_metadata",
|
|
@@ -2448,8 +2449,8 @@ var nr = [
|
|
|
2448
2449
|
"setup_write",
|
|
2449
2450
|
"studio_access"
|
|
2450
2451
|
]);
|
|
2451
|
-
function
|
|
2452
|
-
let { t: o } =
|
|
2452
|
+
function ar({ value: e, onChange: n, readonly: r, className: i, ...a }) {
|
|
2453
|
+
let { t: o } = yt(), s = t.useContext(Xe), c = a.dataSource ?? s?.dataSource ?? null, l = a.disabled, [u, d] = t.useState(null), f = t.useMemo(() => nr(e), [e]);
|
|
2453
2454
|
t.useEffect(() => {
|
|
2454
2455
|
if (!c || typeof c.find != "function") return;
|
|
2455
2456
|
let e = !1;
|
|
@@ -2478,14 +2479,14 @@ function ir({ value: e, onChange: n, readonly: r, className: i, ...a }) {
|
|
|
2478
2479
|
return e;
|
|
2479
2480
|
}, [u, f]), h = (e) => {
|
|
2480
2481
|
let t = e.replace(/\./g, "_");
|
|
2481
|
-
return
|
|
2482
|
+
return ir.has(t) ? o(`capability.label.${t}`) : m.get(e)?.label || e;
|
|
2482
2483
|
}, g = t.useMemo(() => {
|
|
2483
2484
|
let e = /* @__PURE__ */ new Map();
|
|
2484
2485
|
for (let t of m.values()) {
|
|
2485
|
-
let n =
|
|
2486
|
+
let n = rr.includes(t.scope) ? t.scope : "other", r = e.get(n) ?? [];
|
|
2486
2487
|
r.push(t), e.set(n, r);
|
|
2487
2488
|
}
|
|
2488
|
-
return
|
|
2489
|
+
return rr.filter((t) => e.has(t)).map((t) => ({
|
|
2489
2490
|
scope: t,
|
|
2490
2491
|
label: o(`capability.group.${t}`),
|
|
2491
2492
|
items: (e.get(t) ?? []).sort((e, t) => (e.label || e.name).localeCompare(t.label || t.name))
|
|
@@ -2533,8 +2534,8 @@ function ir({ value: e, onChange: n, readonly: r, className: i, ...a }) {
|
|
|
2533
2534
|
}
|
|
2534
2535
|
//#endregion
|
|
2535
2536
|
//#region src/widgets/DateTimeField.tsx
|
|
2536
|
-
var
|
|
2537
|
-
function
|
|
2537
|
+
var or = /* @__PURE__ */ Q({ DateTimeField: () => sr });
|
|
2538
|
+
function sr({ value: e, onChange: t, field: n, readonly: r, ...i }) {
|
|
2538
2539
|
if (r) {
|
|
2539
2540
|
if (!e) return /* @__PURE__ */ Y(P, {});
|
|
2540
2541
|
let t = new Date(e);
|
|
@@ -2554,15 +2555,15 @@ function or({ value: e, onChange: t, field: n, readonly: r, ...i }) {
|
|
|
2554
2555
|
value: e || "",
|
|
2555
2556
|
onChange: (e) => t(e.target.value),
|
|
2556
2557
|
onClick: (e) => {
|
|
2557
|
-
|
|
2558
|
+
At(e.currentTarget), o.onClick?.(e);
|
|
2558
2559
|
},
|
|
2559
2560
|
disabled: r || o.disabled
|
|
2560
2561
|
});
|
|
2561
2562
|
}
|
|
2562
|
-
var
|
|
2563
|
-
|
|
2564
|
-
})),
|
|
2565
|
-
function
|
|
2563
|
+
var cr = Z((() => {
|
|
2564
|
+
jt();
|
|
2565
|
+
})), lr = /* @__PURE__ */ Q({ TimeField: () => ur });
|
|
2566
|
+
function ur({ value: e, onChange: t, field: n, readonly: r, ...i }) {
|
|
2566
2567
|
if (r) return /* @__PURE__ */ Y("span", {
|
|
2567
2568
|
className: "text-sm",
|
|
2568
2569
|
children: e || /* @__PURE__ */ Y(P, {})
|
|
@@ -2574,15 +2575,15 @@ function lr({ value: e, onChange: t, field: n, readonly: r, ...i }) {
|
|
|
2574
2575
|
value: e || "",
|
|
2575
2576
|
onChange: (e) => t(e.target.value),
|
|
2576
2577
|
onClick: (e) => {
|
|
2577
|
-
|
|
2578
|
+
At(e.currentTarget), o.onClick?.(e);
|
|
2578
2579
|
},
|
|
2579
2580
|
disabled: r || o.disabled
|
|
2580
2581
|
});
|
|
2581
2582
|
}
|
|
2582
|
-
var
|
|
2583
|
-
|
|
2584
|
-
})),
|
|
2585
|
-
function
|
|
2583
|
+
var dr = Z((() => {
|
|
2584
|
+
jt();
|
|
2585
|
+
})), fr = /* @__PURE__ */ Q({ PercentField: () => pr });
|
|
2586
|
+
function pr({ value: e, onChange: t, field: n, readonly: r, errorMessage: i, className: a, ...o }) {
|
|
2586
2587
|
let s = n || o.schema, c = s?.precision ?? 2, l = typeof s?.max == "number" ? s.max : void 0, u = l != null && l > 1, d = (e) => u ? e : e * 100, f = (e) => u ? e : e / 100, p = u ? l : 100;
|
|
2587
2588
|
if (r) return e == null ? /* @__PURE__ */ Y(P, {}) : /* @__PURE__ */ X("span", {
|
|
2588
2589
|
className: "text-sm font-medium tabular-nums",
|
|
@@ -2635,8 +2636,8 @@ function fr({ value: e, onChange: t, field: n, readonly: r, errorMessage: i, cla
|
|
|
2635
2636
|
})]
|
|
2636
2637
|
});
|
|
2637
2638
|
}
|
|
2638
|
-
var
|
|
2639
|
-
function
|
|
2639
|
+
var mr = Z((() => {})), hr = /* @__PURE__ */ Q({ PasswordField: () => gr });
|
|
2640
|
+
function gr({ value: e, onChange: t, field: n, readonly: r, className: i, ...a }) {
|
|
2640
2641
|
let [o, s] = u(!1), c = n || a.schema;
|
|
2641
2642
|
if (r) return /* @__PURE__ */ Y("span", {
|
|
2642
2643
|
className: "text-sm",
|
|
@@ -2664,23 +2665,20 @@ function hr({ value: e, onChange: t, field: n, readonly: r, className: i, ...a }
|
|
|
2664
2665
|
})]
|
|
2665
2666
|
});
|
|
2666
2667
|
}
|
|
2667
|
-
var
|
|
2668
|
+
var _r = Z((() => {}));
|
|
2668
2669
|
//#endregion
|
|
2669
2670
|
//#region src/widgets/useUploadingSignal.ts
|
|
2670
|
-
function
|
|
2671
|
+
function vr(e, t) {
|
|
2671
2672
|
let n = l(t);
|
|
2672
2673
|
n.current = t, o(() => {
|
|
2673
2674
|
n.current?.(e);
|
|
2674
2675
|
}, [e]);
|
|
2675
2676
|
}
|
|
2676
|
-
var
|
|
2677
|
+
var yr = Z((() => {}));
|
|
2677
2678
|
//#endregion
|
|
2678
2679
|
//#region src/widgets/file-value.ts
|
|
2679
|
-
function yr(e) {
|
|
2680
|
-
return typeof e == "string" && /^[A-Za-z0-9_-]{1,64}$/.test(e);
|
|
2681
|
-
}
|
|
2682
2680
|
function br(e) {
|
|
2683
|
-
if (
|
|
2681
|
+
if (it(e)) return e;
|
|
2684
2682
|
if (e && typeof e == "object") {
|
|
2685
2683
|
let t = e, n = t.file_id ?? t.id;
|
|
2686
2684
|
if (typeof n == "string" && n) return n;
|
|
@@ -2698,7 +2696,7 @@ function Cr(e, t = "File") {
|
|
|
2698
2696
|
name: t,
|
|
2699
2697
|
raw: e
|
|
2700
2698
|
};
|
|
2701
|
-
if (typeof e == "string") return
|
|
2699
|
+
if (typeof e == "string") return it(e) ? {
|
|
2702
2700
|
id: e,
|
|
2703
2701
|
name: t,
|
|
2704
2702
|
url: xr(e),
|
|
@@ -2732,7 +2730,7 @@ function Tr(e) {
|
|
|
2732
2730
|
}
|
|
2733
2731
|
function Er(e, t) {
|
|
2734
2732
|
let n = e.meta?.fileId;
|
|
2735
|
-
return
|
|
2733
|
+
return it(n) ? n : {
|
|
2736
2734
|
name: e.name,
|
|
2737
2735
|
original_name: t ?? e.name,
|
|
2738
2736
|
size: e.size,
|
|
@@ -2742,7 +2740,7 @@ function Er(e, t) {
|
|
|
2742
2740
|
}
|
|
2743
2741
|
function Dr(e, t) {
|
|
2744
2742
|
return {
|
|
2745
|
-
id:
|
|
2743
|
+
id: it(e.meta?.fileId) ? e.meta.fileId : void 0,
|
|
2746
2744
|
name: e.name || t || "File",
|
|
2747
2745
|
url: e.url,
|
|
2748
2746
|
size: e.size,
|
|
@@ -2838,7 +2836,7 @@ function Nr({ value: e, onChange: t, field: n, readonly: r, onUploadingChange: a
|
|
|
2838
2836
|
maxSize: h,
|
|
2839
2837
|
onChange: t
|
|
2840
2838
|
}), A = Or(wr(e, s("fields.file.fileFallback", { defaultValue: "File" })), k);
|
|
2841
|
-
|
|
2839
|
+
vr(D, a);
|
|
2842
2840
|
let j = i((e) => {
|
|
2843
2841
|
e.preventDefault(), e.stopPropagation(), S(!0);
|
|
2844
2842
|
}, []), M = i((e) => {
|
|
@@ -3069,7 +3067,7 @@ function Pr({ value: e, onChange: t, disabled: n, multiple: r, accept: i, maxSiz
|
|
|
3069
3067
|
});
|
|
3070
3068
|
}
|
|
3071
3069
|
var Fr = Z((() => {
|
|
3072
|
-
|
|
3070
|
+
yr(), Ar();
|
|
3073
3071
|
}));
|
|
3074
3072
|
//#endregion
|
|
3075
3073
|
//#region src/widgets/ImageLightbox.tsx
|
|
@@ -3270,7 +3268,7 @@ var Lr = Z((() => {})), Rr = /* @__PURE__ */ Q({ ImageCropperDialog: () => zr })
|
|
|
3270
3268
|
})), Vr = /* @__PURE__ */ Q({ ImageField: () => Hr });
|
|
3271
3269
|
function Hr({ value: e, onChange: t, field: r, readonly: a, onUploadingChange: o, ...s }) {
|
|
3272
3270
|
let c = l(null), d = r || s.schema, f = d?.multiple || !1, p = d?.accept ? d.accept.join(",") : "image/*", m = d?.crop !== !1, [h, g] = u(null), [_, v] = u(null), { upload: y } = rt(), { t: x } = b(), [S, C] = u(!1), [w, E] = u({});
|
|
3273
|
-
|
|
3271
|
+
vr(S, o);
|
|
3274
3272
|
let D = e ? Array.isArray(e) ? e : [e] : [], O = Or(wr(e, "Image"), w), k = i((e, t) => {
|
|
3275
3273
|
let n = Dr(e, t);
|
|
3276
3274
|
n.id && E((e) => ({
|
|
@@ -3417,7 +3415,7 @@ function Hr({ value: e, onChange: t, field: r, readonly: a, onUploadingChange: o
|
|
|
3417
3415
|
});
|
|
3418
3416
|
}
|
|
3419
3417
|
var Ur, Wr = Z((() => {
|
|
3420
|
-
Lr(),
|
|
3418
|
+
Lr(), yr(), Ar(), Ur = r(() => Promise.resolve().then(() => (Br(), Rr)).then((e) => ({ default: e.ImageCropperDialog })));
|
|
3421
3419
|
})), Gr = /* @__PURE__ */ Q({ LocationField: () => Kr });
|
|
3422
3420
|
function Kr({ value: e, onChange: t, field: n, readonly: r, ...i }) {
|
|
3423
3421
|
let a = n || i.schema, o = e && typeof e == "object" ? `${e.latitude || 0}, ${e.longitude || 0}` : "";
|
|
@@ -3501,7 +3499,7 @@ function ai(e) {
|
|
|
3501
3499
|
...t,
|
|
3502
3500
|
field: i
|
|
3503
3501
|
} : i;
|
|
3504
|
-
return /* @__PURE__ */ Y(
|
|
3502
|
+
return /* @__PURE__ */ Y(Xn, {
|
|
3505
3503
|
...e,
|
|
3506
3504
|
field: a
|
|
3507
3505
|
});
|
|
@@ -3912,7 +3910,7 @@ function Ci({ value: e, onChange: n, field: r, readonly: a, disabled: o, classNa
|
|
|
3912
3910
|
children: t + 1
|
|
3913
3911
|
}), C.map((t) => /* @__PURE__ */ Y("td", {
|
|
3914
3912
|
className: K("px-3 py-2 text-foreground", wi(t.type) && "text-right tabular-nums"),
|
|
3915
|
-
children: t.type === "lookup" && e[t.field] != null && e[t.field] !== "" ? /* @__PURE__ */ Y(
|
|
3913
|
+
children: t.type === "lookup" && e[t.field] != null && e[t.field] !== "" ? /* @__PURE__ */ Y(Xn, {
|
|
3916
3914
|
value: e[t.field],
|
|
3917
3915
|
onChange: () => {},
|
|
3918
3916
|
readonly: !0,
|
|
@@ -3945,7 +3943,7 @@ function Ci({ value: e, onChange: n, field: r, readonly: a, disabled: o, classNa
|
|
|
3945
3943
|
});
|
|
3946
3944
|
let xe = !y && D && (N == null || h.length < N), Se = xe ? [...h, z()] : h, Ce = (e, t, n, r) => {
|
|
3947
3945
|
let i = r?.[e.field], a = o || v(e, r).readonly;
|
|
3948
|
-
return y ? e.type === "lookup" && i != null && i !== "" ? /* @__PURE__ */ Y(
|
|
3946
|
+
return y ? e.type === "lookup" && i != null && i !== "" ? /* @__PURE__ */ Y(Xn, {
|
|
3949
3947
|
value: i,
|
|
3950
3948
|
onChange: () => {},
|
|
3951
3949
|
readonly: !0,
|
|
@@ -3962,7 +3960,7 @@ function Ci({ value: e, onChange: n, field: r, readonly: a, disabled: o, classNa
|
|
|
3962
3960
|
title: "Computed",
|
|
3963
3961
|
"data-computed": e.field,
|
|
3964
3962
|
children: bi(e, i)
|
|
3965
|
-
}) : e.type === "lookup" ? /* @__PURE__ */ Y(
|
|
3963
|
+
}) : e.type === "lookup" ? /* @__PURE__ */ Y(Xn, {
|
|
3966
3964
|
value: i,
|
|
3967
3965
|
onChange: (t) => de(n, e.field, t),
|
|
3968
3966
|
onSelectRecord: (t) => ue(n, e, t),
|
|
@@ -4180,7 +4178,7 @@ function Ci({ value: e, onChange: n, field: r, readonly: a, disabled: o, classNa
|
|
|
4180
4178
|
});
|
|
4181
4179
|
}
|
|
4182
4180
|
var wi, Ti, Ei, Di, Oi = Z((() => {
|
|
4183
|
-
|
|
4181
|
+
tr(), Fr(), wi = (e) => e === "number" || e === "currency", Ti = {
|
|
4184
4182
|
text: 160,
|
|
4185
4183
|
select: 132,
|
|
4186
4184
|
lookup: 168,
|
|
@@ -4726,7 +4724,7 @@ function ea({ value: e, onChange: n, field: r, readonly: i, ...a }) {
|
|
|
4726
4724
|
});
|
|
4727
4725
|
}
|
|
4728
4726
|
var ta = Z((() => {}));
|
|
4729
|
-
|
|
4727
|
+
cr(), dr(), mr(), _r(), Wr(), qr(), Xr(), $r(), ni(), oi(), li(), fi(), Oi(), ji(), Pi(), Li(), Bi(), Ui(), Ki(), Yi(), Qi(), ta();
|
|
4730
4728
|
function na(e) {
|
|
4731
4729
|
return {
|
|
4732
4730
|
text: "field:text",
|
|
@@ -4788,7 +4786,7 @@ function na(e) {
|
|
|
4788
4786
|
//#region src/widgets/RadioField.tsx
|
|
4789
4787
|
var ra = /* @__PURE__ */ Q({ RadioField: () => ia });
|
|
4790
4788
|
function ia({ value: e, onChange: t, field: n, readonly: r, className: i, schema: a, dependentValues: c, dependsOn: l, emptyHint: u, dataSource: d, ...f }) {
|
|
4791
|
-
let m = n || a, h = m?.options || [], g = s(), _ = f.name || m?.name || f.id || "", { options: v, gated: y, dependsOnFields: b } =
|
|
4789
|
+
let m = n || a, h = m?.options || [], g = s(), _ = f.name || m?.name || f.id || "", { options: v, gated: y, dependsOnFields: b } = xt(h, m?.dependsOn ?? l, c);
|
|
4792
4790
|
if (o(() => {
|
|
4793
4791
|
r || e == null || e === "" || p(e, v) || t?.(void 0);
|
|
4794
4792
|
}, [v, y]), r) return e == null || e === "" ? /* @__PURE__ */ Y(P, {}) : /* @__PURE__ */ Y("span", {
|
|
@@ -4826,10 +4824,10 @@ function ia({ value: e, onChange: t, field: n, readonly: r, className: i, schema
|
|
|
4826
4824
|
});
|
|
4827
4825
|
}
|
|
4828
4826
|
var aa = Z((() => {
|
|
4829
|
-
|
|
4827
|
+
St();
|
|
4830
4828
|
})), oa = /* @__PURE__ */ Q({ CheckboxesField: () => sa });
|
|
4831
4829
|
function sa({ value: e, onChange: t, field: n, readonly: r, className: i, schema: a, dependentValues: c, dependsOn: l, emptyHint: u, dataSource: d, ...f }) {
|
|
4832
|
-
let p = n || a, m = p?.options || [], h = Array.isArray(e) ? e : e == null ? [] : [e], g = s(), _ = f.name || p?.name || f.id || "", { options: v, gated: y, dependsOnFields: b } =
|
|
4830
|
+
let p = n || a, m = p?.options || [], h = Array.isArray(e) ? e : e == null ? [] : [e], g = s(), _ = f.name || p?.name || f.id || "", { options: v, gated: y, dependsOnFields: b } = xt(m, p?.dependsOn ?? l, c);
|
|
4833
4831
|
if (o(() => {
|
|
4834
4832
|
if (r || h.length === 0) return;
|
|
4835
4833
|
let e = h.filter((e) => v.some((t) => t.value === e));
|
|
@@ -4875,7 +4873,7 @@ function sa({ value: e, onChange: t, field: n, readonly: r, className: i, schema
|
|
|
4875
4873
|
});
|
|
4876
4874
|
}
|
|
4877
4875
|
var ca = Z((() => {
|
|
4878
|
-
|
|
4876
|
+
St();
|
|
4879
4877
|
})), la = /* @__PURE__ */ Q({ TagsField: () => ua });
|
|
4880
4878
|
function ua({ value: e, onChange: n, field: r, readonly: i, className: a, ...o }) {
|
|
4881
4879
|
let s = Array.isArray(e) ? e : e == null ? [] : [e], [c, l] = t.useState("");
|
|
@@ -4916,32 +4914,32 @@ function ua({ value: e, onChange: n, field: r, readonly: i, className: a, ...o }
|
|
|
4916
4914
|
});
|
|
4917
4915
|
}
|
|
4918
4916
|
var da = Z((() => {}));
|
|
4919
|
-
|
|
4917
|
+
Tt(), aa(), ca(), da(), tr();
|
|
4920
4918
|
var fa = {
|
|
4921
|
-
text:
|
|
4922
|
-
textarea:
|
|
4923
|
-
number:
|
|
4924
|
-
currency:
|
|
4925
|
-
percent:
|
|
4919
|
+
text: ut,
|
|
4920
|
+
textarea: Xt,
|
|
4921
|
+
number: pt,
|
|
4922
|
+
currency: qt,
|
|
4923
|
+
percent: pr,
|
|
4926
4924
|
slider: Ni,
|
|
4927
4925
|
progress: Ni,
|
|
4928
4926
|
rating: Ii,
|
|
4929
|
-
boolean:
|
|
4930
|
-
toggle:
|
|
4931
|
-
select:
|
|
4932
|
-
status:
|
|
4933
|
-
multiselect:
|
|
4927
|
+
boolean: gt,
|
|
4928
|
+
toggle: gt,
|
|
4929
|
+
select: Dt,
|
|
4930
|
+
status: Dt,
|
|
4931
|
+
multiselect: wt,
|
|
4934
4932
|
radio: ia,
|
|
4935
4933
|
checkboxes: sa,
|
|
4936
4934
|
tags: ua,
|
|
4937
|
-
date:
|
|
4938
|
-
datetime:
|
|
4939
|
-
time:
|
|
4940
|
-
email:
|
|
4941
|
-
phone:
|
|
4942
|
-
url:
|
|
4943
|
-
lookup:
|
|
4944
|
-
master_detail:
|
|
4935
|
+
date: Nt,
|
|
4936
|
+
datetime: sr,
|
|
4937
|
+
time: ur,
|
|
4938
|
+
email: It,
|
|
4939
|
+
phone: zt,
|
|
4940
|
+
url: Ht,
|
|
4941
|
+
lookup: Xn,
|
|
4942
|
+
master_detail: Xn,
|
|
4945
4943
|
user: ai,
|
|
4946
4944
|
owner: ai,
|
|
4947
4945
|
color: Ai,
|
|
@@ -5009,7 +5007,7 @@ var ba = /* @__PURE__ */ Q({
|
|
|
5009
5007
|
default: () => xa
|
|
5010
5008
|
});
|
|
5011
5009
|
function xa({ value: e, onChange: n, readonly: r, className: i, ...a }) {
|
|
5012
|
-
let o = t.useContext(Xe), { t: s } =
|
|
5010
|
+
let o = t.useContext(Xe), { t: s } = yt(), c = a.dataSource ?? o?.dataSource ?? null, l = a.disabled, [u, d] = t.useState(null);
|
|
5013
5011
|
t.useEffect(() => {
|
|
5014
5012
|
if (!c) return;
|
|
5015
5013
|
let e = !1;
|
|
@@ -5060,7 +5058,7 @@ function xa({ value: e, onChange: n, readonly: r, className: i, ...a }) {
|
|
|
5060
5058
|
});
|
|
5061
5059
|
}
|
|
5062
5060
|
var Sa = Z((() => {
|
|
5063
|
-
|
|
5061
|
+
bt();
|
|
5064
5062
|
})), Ca = /* @__PURE__ */ Q({
|
|
5065
5063
|
FilterConditionField: () => Pa,
|
|
5066
5064
|
condToMongo: () => Da,
|
|
@@ -5330,7 +5328,7 @@ function Na(e) {
|
|
|
5330
5328
|
}
|
|
5331
5329
|
}
|
|
5332
5330
|
function Pa({ value: e, onChange: n, readonly: r, className: i, ...a }) {
|
|
5333
|
-
let o = t.useContext(Xe), { t: s } =
|
|
5331
|
+
let o = t.useContext(Xe), { t: s } = yt(), c = a.dataSource ?? o?.dataSource ?? null, l = a.dependentValues ?? {}, u = String(l.object_name ?? ""), [d, f] = t.useState(null);
|
|
5334
5332
|
t.useEffect(() => {
|
|
5335
5333
|
if (f(null), !c || !u || typeof c.getObjectSchema != "function") return;
|
|
5336
5334
|
let e = !1;
|
|
@@ -5413,7 +5411,7 @@ function Pa({ value: e, onChange: n, readonly: r, className: i, ...a }) {
|
|
|
5413
5411
|
});
|
|
5414
5412
|
}
|
|
5415
5413
|
var Fa, Ia, La = Z((() => {
|
|
5416
|
-
|
|
5414
|
+
bt(), Fa = {
|
|
5417
5415
|
id: "root",
|
|
5418
5416
|
logic: "and",
|
|
5419
5417
|
conditions: []
|
|
@@ -5437,7 +5435,7 @@ var Fa, Ia, La = Z((() => {
|
|
|
5437
5435
|
default: () => za
|
|
5438
5436
|
});
|
|
5439
5437
|
function za({ value: e, onChange: n, readonly: r, className: i, ...a }) {
|
|
5440
|
-
let o = t.useContext(Xe), { t: s } =
|
|
5438
|
+
let o = t.useContext(Xe), { t: s } = yt(), c = a.dataSource ?? o?.dataSource ?? null, l = a.disabled, u = a.dependentValues ?? {}, d = String(u.recipient_type ?? ""), f = Ba[d], [p, m] = t.useState(null), h = t.useRef("");
|
|
5441
5439
|
t.useEffect(() => {
|
|
5442
5440
|
h.current && d && h.current !== d && e && n(""), h.current = d;
|
|
5443
5441
|
}, [d]), t.useEffect(() => {
|
|
@@ -5497,7 +5495,7 @@ function za({ value: e, onChange: n, readonly: r, className: i, ...a }) {
|
|
|
5497
5495
|
});
|
|
5498
5496
|
}
|
|
5499
5497
|
var Ba, Va = Z((() => {
|
|
5500
|
-
|
|
5498
|
+
bt(), Ba = {
|
|
5501
5499
|
user: {
|
|
5502
5500
|
object: "sys_user",
|
|
5503
5501
|
storeField: "id",
|
|
@@ -5630,15 +5628,15 @@ var Ua = /* @__PURE__ */ Q({ default: () => Wa });
|
|
|
5630
5628
|
function Wa({ value: e }) {
|
|
5631
5629
|
return /* @__PURE__ */ Y("div", {
|
|
5632
5630
|
className: "prose prose-sm max-w-none dark:prose-invert break-words",
|
|
5633
|
-
children: /* @__PURE__ */ Y(
|
|
5634
|
-
remarkPlugins: [
|
|
5635
|
-
rehypePlugins: [
|
|
5631
|
+
children: /* @__PURE__ */ Y(at, {
|
|
5632
|
+
remarkPlugins: [ot],
|
|
5633
|
+
rehypePlugins: [st],
|
|
5636
5634
|
children: e
|
|
5637
5635
|
})
|
|
5638
5636
|
});
|
|
5639
5637
|
}
|
|
5640
5638
|
var Ga = Z((() => {}));
|
|
5641
|
-
|
|
5639
|
+
dt(), mt(), _t(), kt(), Pt(), Lt(), Bt(), Ut(), Jt(), Zt(), tr(), cr(), dr(), mr(), Fr(), Lr(), Ar(), qr(), oi(), ji(), Pi(), Li(), Bi(), Ki(), Yi(), ta(), Wt(), Un(), Ar(), dt(), mt(), _t(), kt(), Pt(), cr(), dr(), Lt(), Bt(), Ut(), Jt(), mr(), _r(), Zt(), en(), tr(), Sa(), La(), Va(), fn(), Fr(), Wr(), qr(), Xr(), $r(), ni(), oi(), li(), fi(), Oi(), ji(), Pi(), Li(), Bi(), Ui(), Ki(), Yi(), Qi(), ta(), Tt(), aa(), ca(), da();
|
|
5642
5640
|
var Ka = /* @__PURE__ */ new Map();
|
|
5643
5641
|
function qa(e, t) {
|
|
5644
5642
|
if (!e || typeof e != "object") return;
|
|
@@ -6662,7 +6660,7 @@ function es(e) {
|
|
|
6662
6660
|
})
|
|
6663
6661
|
}[e] || po;
|
|
6664
6662
|
}
|
|
6665
|
-
Uo("lookup", zo), Uo("master_detail", zo), Uo("select", No), Uo("status", No), Uo("user", Vo), Uo("owner", Vo),
|
|
6663
|
+
Uo("lookup", zo), Uo("master_detail", zo), Uo("select", No), Uo("status", No), Uo("user", Vo), Uo("owner", Vo), Bn(es);
|
|
6666
6664
|
function ts(e) {
|
|
6667
6665
|
if (e < 0 || !Number.isFinite(e) || e === 0) return "0 B";
|
|
6668
6666
|
let t = [
|
|
@@ -6736,7 +6734,7 @@ function $(e) {
|
|
|
6736
6734
|
readonly: n?.readonly || n?.readOnly,
|
|
6737
6735
|
help: n?.help,
|
|
6738
6736
|
description: n?.description,
|
|
6739
|
-
defaultValue: n?.defaultValue
|
|
6737
|
+
defaultValue: n?.defaultValue ?? n?.value,
|
|
6740
6738
|
...n
|
|
6741
6739
|
}, l = t.useCallback((e) => {
|
|
6742
6740
|
s(e), a.onChange && a.onChange(e);
|
|
@@ -6768,29 +6766,29 @@ function $(e) {
|
|
|
6768
6766
|
return n.displayName = `FieldRenderer(${e.displayName || e.name || "Component"})`, n;
|
|
6769
6767
|
}
|
|
6770
6768
|
var is = {
|
|
6771
|
-
text: () => Promise.resolve().then(() => (
|
|
6772
|
-
textarea: () => Promise.resolve().then(() => (
|
|
6773
|
-
number: () => Promise.resolve().then(() => (
|
|
6774
|
-
boolean: () => Promise.resolve().then(() => (
|
|
6775
|
-
select: () => Promise.resolve().then(() => (
|
|
6776
|
-
date: () => Promise.resolve().then(() => (
|
|
6777
|
-
datetime: () => Promise.resolve().then(() => (
|
|
6778
|
-
time: () => Promise.resolve().then(() => (
|
|
6779
|
-
email: () => Promise.resolve().then(() => (
|
|
6780
|
-
phone: () => Promise.resolve().then(() => (
|
|
6781
|
-
url: () => Promise.resolve().then(() => (
|
|
6782
|
-
multiselect: () => Promise.resolve().then(() => (
|
|
6769
|
+
text: () => Promise.resolve().then(() => (dt(), lt)).then((e) => ({ default: e.TextField })),
|
|
6770
|
+
textarea: () => Promise.resolve().then(() => (Zt(), Yt)).then((e) => ({ default: e.TextAreaField })),
|
|
6771
|
+
number: () => Promise.resolve().then(() => (mt(), ft)).then((e) => ({ default: e.NumberField })),
|
|
6772
|
+
boolean: () => Promise.resolve().then(() => (_t(), ht)).then((e) => ({ default: e.BooleanField })),
|
|
6773
|
+
select: () => Promise.resolve().then(() => (kt(), Et)).then((e) => ({ default: e.SelectField })),
|
|
6774
|
+
date: () => Promise.resolve().then(() => (Pt(), Mt)).then((e) => ({ default: e.DateField })),
|
|
6775
|
+
datetime: () => Promise.resolve().then(() => (cr(), or)).then((e) => ({ default: e.DateTimeField })),
|
|
6776
|
+
time: () => Promise.resolve().then(() => (dr(), lr)).then((e) => ({ default: e.TimeField })),
|
|
6777
|
+
email: () => Promise.resolve().then(() => (Lt(), Ft)).then((e) => ({ default: e.EmailField })),
|
|
6778
|
+
phone: () => Promise.resolve().then(() => (Bt(), Rt)).then((e) => ({ default: e.PhoneField })),
|
|
6779
|
+
url: () => Promise.resolve().then(() => (Ut(), Vt)).then((e) => ({ default: e.UrlField })),
|
|
6780
|
+
multiselect: () => Promise.resolve().then(() => (Tt(), Ct)).then((e) => ({ default: e.MultiSelectField })),
|
|
6783
6781
|
radio: () => Promise.resolve().then(() => (aa(), ra)).then((e) => ({ default: e.RadioField })),
|
|
6784
6782
|
checkboxes: () => Promise.resolve().then(() => (ca(), oa)).then((e) => ({ default: e.CheckboxesField })),
|
|
6785
6783
|
tags: () => Promise.resolve().then(() => (da(), la)).then((e) => ({ default: e.TagsField })),
|
|
6786
|
-
currency: () => Promise.resolve().then(() => (
|
|
6787
|
-
percent: () => Promise.resolve().then(() => (
|
|
6788
|
-
password: () => Promise.resolve().then(() => (
|
|
6789
|
-
markdown: () => Promise.resolve().then(() => (
|
|
6790
|
-
html: () => Promise.resolve().then(() => (
|
|
6791
|
-
richtext: () => Promise.resolve().then(() => (
|
|
6792
|
-
lookup: () => Promise.resolve().then(() => (
|
|
6793
|
-
master_detail: () => Promise.resolve().then(() => (
|
|
6784
|
+
currency: () => Promise.resolve().then(() => (Jt(), Gt)).then((e) => ({ default: e.CurrencyField })),
|
|
6785
|
+
percent: () => Promise.resolve().then(() => (mr(), fr)).then((e) => ({ default: e.PercentField })),
|
|
6786
|
+
password: () => Promise.resolve().then(() => (_r(), hr)).then((e) => ({ default: e.PasswordField })),
|
|
6787
|
+
markdown: () => Promise.resolve().then(() => (en(), Qt)).then((e) => ({ default: e.RichTextField })),
|
|
6788
|
+
html: () => Promise.resolve().then(() => (en(), Qt)).then((e) => ({ default: e.RichTextField })),
|
|
6789
|
+
richtext: () => Promise.resolve().then(() => (en(), Qt)).then((e) => ({ default: e.RichTextField })),
|
|
6790
|
+
lookup: () => Promise.resolve().then(() => (tr(), Wn)).then((e) => ({ default: e.LookupField })),
|
|
6791
|
+
master_detail: () => Promise.resolve().then(() => (tr(), Wn)).then((e) => ({ default: e.LookupField })),
|
|
6794
6792
|
file: () => Promise.resolve().then(() => (Fr(), jr)).then((e) => ({ default: e.FileField })),
|
|
6795
6793
|
image: () => Promise.resolve().then(() => (Wr(), Vr)).then((e) => ({ default: e.ImageField })),
|
|
6796
6794
|
location: () => Promise.resolve().then(() => (qr(), Gr)).then((e) => ({ default: e.LocationField })),
|
|
@@ -6861,34 +6859,34 @@ function ds() {
|
|
|
6861
6859
|
});
|
|
6862
6860
|
}
|
|
6863
6861
|
function fs() {
|
|
6864
|
-
d.register("text", $(
|
|
6862
|
+
d.register("text", $(ut), {
|
|
6865
6863
|
namespace: "field",
|
|
6866
6864
|
skipFallback: !0
|
|
6867
|
-
}), d.register("textarea", $(
|
|
6865
|
+
}), d.register("textarea", $(Xt), {
|
|
6868
6866
|
namespace: "field",
|
|
6869
6867
|
skipFallback: !0
|
|
6870
|
-
}), d.register("number", $(
|
|
6868
|
+
}), d.register("number", $(pt), { namespace: "field" }), d.register("boolean", $(gt), { namespace: "field" }), d.register("select", $(Dt), {
|
|
6871
6869
|
namespace: "field",
|
|
6872
6870
|
skipFallback: !0
|
|
6873
|
-
}), d.register("date", $(
|
|
6871
|
+
}), d.register("date", $(Nt), { namespace: "field" }), d.register("datetime", $(sr), { namespace: "field" }), d.register("time", $(ur), {
|
|
6874
6872
|
namespace: "field",
|
|
6875
6873
|
skipFallback: !0
|
|
6876
|
-
}), d.register("email", $(
|
|
6874
|
+
}), d.register("email", $(It), {
|
|
6877
6875
|
namespace: "field",
|
|
6878
6876
|
skipFallback: !0
|
|
6879
|
-
}), d.register("phone", $(
|
|
6877
|
+
}), d.register("phone", $(zt), { namespace: "field" }), d.register("url", $(Ht), { namespace: "field" }), d.register("currency", $(qt), { namespace: "field" }), d.register("percent", $(pr), { namespace: "field" }), d.register("password", $(gr), {
|
|
6880
6878
|
namespace: "field",
|
|
6881
6879
|
skipFallback: !0
|
|
6882
|
-
}), d.register("markdown", $(
|
|
6880
|
+
}), d.register("markdown", $($t), {
|
|
6883
6881
|
namespace: "field",
|
|
6884
6882
|
skipFallback: !0
|
|
6885
|
-
}), d.register("html", $(
|
|
6883
|
+
}), d.register("html", $($t), {
|
|
6886
6884
|
namespace: "field",
|
|
6887
6885
|
skipFallback: !0
|
|
6888
|
-
}), d.register("lookup", $(
|
|
6886
|
+
}), d.register("lookup", $(Xn), { namespace: "field" }), d.register("capability-multiselect", ar, {
|
|
6889
6887
|
namespace: "field",
|
|
6890
6888
|
skipFallback: !0
|
|
6891
|
-
}), d.register("master_detail", $(
|
|
6889
|
+
}), d.register("master_detail", $(Xn), { namespace: "field" }), d.register("file", $(Nr), { namespace: "field" }), d.register("image", $(Hr), {
|
|
6892
6890
|
namespace: "field",
|
|
6893
6891
|
skipFallback: !0
|
|
6894
6892
|
}), d.register("location", $(Kr), { namespace: "field" }), d.register("formula", $(Yr), { namespace: "field" }), d.register("summary", $(Qr), { namespace: "field" }), d.register("auto_number", $(ti), { namespace: "field" }), d.register("user", $(ai), { namespace: "field" }), d.register("owner", $(ai), { namespace: "field" }), d.register("object", $(ci), { namespace: "field" }), d.register("vector", $(di), { namespace: "field" }), d.register("grid", $(Ci), {
|
|
@@ -6907,4 +6905,4 @@ function fs() {
|
|
|
6907
6905
|
}
|
|
6908
6906
|
ds();
|
|
6909
6907
|
//#endregion
|
|
6910
|
-
export { Gi as AddressField, ti as AutoNumberField, Hi as AvatarField, yo as BooleanCellRenderer,
|
|
6908
|
+
export { Gi as AddressField, ti as AutoNumberField, Hi as AvatarField, yo as BooleanCellRenderer, gt as BooleanField, ar as CapabilityMultiSelectField, sa as CheckboxesField, zi as CodeField, Ai as ColorField, Jo as ColorSwatchCellRenderer, ho as CurrencyCellRenderer, qt as CurrencyField, ma as DISCRETE_EDIT_TYPES, bo as DateCellRenderer, Nt as DateField, xo as DateTimeCellRenderer, sr as DateTimeField, Po as EmailCellRenderer, It as EmailField, kr as FILE_STORAGE_BASE_PATH, as as FORM_FIELD_TYPES, ya as FieldEditWidget, Pr as FileCell, Lo as FileCellRenderer, Nr as FileField, Pa as FilterConditionField, Bo as FormulaCellRenderer, Yr as FormulaField, Ji as GeolocationField, Ci as GridField, Qo as HtmlCellRenderer, pa as INLINE_EXCLUDED_FIELD_TYPES, Ro as ImageCellRenderer, zr as ImageCropperDialog, Hr as ImageField, qo as JsonCellRenderer, Di as LineItemsField, $o as LocationCellRenderer, Kr as LocationField, zo as LookupCellRenderer, Xn as LookupField, Xo as MarkdownCellRenderer, Ha as MasterDetailField, wt as MultiSelectField, mo as NumberCellRenderer, pt as NumberField, ci as ObjectField, xa as ObjectRefField, gr as PasswordField, _o as PercentCellRenderer, pr as PercentField, Io as PhoneCellRenderer, zt as PhoneField, ea as QRCodeField, ia as RadioField, Ii as RatingField, za as RecipientPickerField, cn as RecordPickerDialog, $t as RichTextField, No as SelectCellRenderer, Dt as SelectField, Zi as SignatureField, Ni as SliderField, Qr as SummaryField, ua as TagsField, Xt as TextAreaField, po as TextCellRenderer, ut as TextField, ur as TimeField, Fo as UrlCellRenderer, Ht as UrlField, Vo as UserCellRenderer, ai as UserField, di as VectorField, ns as buildValidationRules, no as coerceToSafeValue, yi as computeRow, Da as condToMongo, _i as evalArith, rs as evaluateCondition, br as fileIdOf, xr as fileUrlFromId, Er as fileValueForSubmit, io as formatCompactCurrency, ro as formatCurrency, uo as formatDate, fo as formatDateTime, ts as formatFileSize, ao as formatNumber, oo as formatPercent, lo as formatRelativeDate, ko as getBadgeColorClasses, es as getCellRenderer, cs as getLazyFieldWidget, Ao as getSemanticColorName, Mo as getSemanticHex, ga as hasFieldEditWidget, so as humanizeLabel, it as isFileIdToken, Tr as isImageValue, _a as isInlineExcludedFieldType, Qa as isLikelyOpaqueId, Ma as isMatchAllCriteria, Aa as kvToCondition, vi as lookupAutofillPatch, on as lookupFiltersToRecord, na as mapFieldTypeToFormType, nr as parseCapabilityNames, qa as pickRecordDisplayName, Cr as readFileValue, wr as readFileValues, ds as registerAllFields, us as registerField, Uo as registerFieldRenderer, fs as registerFields, Ko as resolveCellRendererType, v as resolveFieldCurrency, os as resolveFormWidgetType, Si as sumColumn, Dr as uploadResultView, Or as withRecentUploads };
|