@ai-matrx/records-ui 0.116.113 → 0.116.115
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 +8 -0
- package/dist/{SaveToTable-GRDFTAC4.js → SaveToTable-FVDYG5QS.js} +3 -3
- package/dist/{chunk-FZVW6XVB.js → chunk-ESOQXQAE.js} +2 -2
- package/dist/{chunk-LGQLATW5.js → chunk-KUEASKVB.js} +4 -4
- package/dist/{chunk-Z3EUU2NM.js → chunk-OY553AFP.js} +2 -2
- package/dist/{chunk-N76I4VXM.js → chunk-PYLGLSKU.js} +2 -2
- package/dist/{chunk-JTEIYLII.js → chunk-RKI2YQHW.js} +2 -2
- package/dist/chunk-RKI2YQHW.js.map +1 -0
- package/dist/entity-doors.cjs +3 -4
- package/dist/entity-doors.cjs.map +1 -1
- package/dist/entity-doors.js +3 -4
- package/dist/entity-doors.js.map +1 -1
- package/dist/entity-ref.cjs +4 -5
- package/dist/entity-ref.cjs.map +1 -1
- package/dist/entity-ref.js +4 -5
- package/dist/entity-ref.js.map +1 -1
- package/dist/helpers.cjs +2 -3
- package/dist/helpers.cjs.map +1 -1
- package/dist/helpers.js +2 -2
- package/dist/helpers.js.map +1 -1
- package/dist/index.cjs +394 -394
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +5 -5
- package/dist/pickers.cjs +158 -158
- package/dist/pickers.cjs.map +1 -1
- package/dist/pickers.js +3 -3
- package/dist/skeleton.js +3 -3
- package/package.json +2 -2
- package/dist/chunk-JTEIYLII.js.map +0 -1
- /package/dist/{SaveToTable-GRDFTAC4.js.map → SaveToTable-FVDYG5QS.js.map} +0 -0
- /package/dist/{chunk-FZVW6XVB.js.map → chunk-ESOQXQAE.js.map} +0 -0
- /package/dist/{chunk-LGQLATW5.js.map → chunk-KUEASKVB.js.map} +0 -0
- /package/dist/{chunk-Z3EUU2NM.js.map → chunk-OY553AFP.js.map} +0 -0
- /package/dist/{chunk-N76I4VXM.js.map → chunk-PYLGLSKU.js.map} +0 -0
package/dist/pickers.cjs
CHANGED
|
@@ -689,12 +689,12 @@ function personWallNow(at = /* @__PURE__ */ new Date()) {
|
|
|
689
689
|
const n = (t) => Number(parts.find((p) => p.type === t)?.value ?? 0);
|
|
690
690
|
return new Date(n("year"), n("month") - 1, n("day"), n("hour"), n("minute"), n("second"));
|
|
691
691
|
}
|
|
692
|
-
var import_table_style2,
|
|
692
|
+
var import_table_style2, import_views, import_global_slot, state;
|
|
693
693
|
var init_personZone = __esm({
|
|
694
694
|
"src/personZone.ts"() {
|
|
695
695
|
"use strict";
|
|
696
696
|
import_table_style2 = require("@ai-matrx/design-system/data-table/table-style");
|
|
697
|
-
|
|
697
|
+
import_views = require("@ai-matrx/records/views");
|
|
698
698
|
import_global_slot = require("@ai-matrx/kit/global-slot");
|
|
699
699
|
state = (0, import_global_slot.globalSlot)("ai-matrx.records-ui.person-time-zone", () => ({
|
|
700
700
|
zone: null,
|
|
@@ -1415,7 +1415,7 @@ function usePickerTables() {
|
|
|
1415
1415
|
};
|
|
1416
1416
|
}, [client, nonce]);
|
|
1417
1417
|
const data = (0, import_react14.useMemo)(
|
|
1418
|
-
() => (0,
|
|
1418
|
+
() => (0, import_records4.withTablePlacement)(tables.data ?? [], facts === "reading" ? null : facts),
|
|
1419
1419
|
[tables.data, facts]
|
|
1420
1420
|
);
|
|
1421
1421
|
return { loading: tables.loading || facts === "reading", data, reload };
|
|
@@ -1434,13 +1434,13 @@ function ShowListsToggle({
|
|
|
1434
1434
|
")"
|
|
1435
1435
|
] });
|
|
1436
1436
|
}
|
|
1437
|
-
var import_react14,
|
|
1437
|
+
var import_react14, import_records4, import_react15, import_design_system12, import_jsx_runtime13;
|
|
1438
1438
|
var init_tablePicking = __esm({
|
|
1439
1439
|
"src/tablePicking.tsx"() {
|
|
1440
1440
|
"use strict";
|
|
1441
1441
|
"use client";
|
|
1442
1442
|
import_react14 = require("react");
|
|
1443
|
-
|
|
1443
|
+
import_records4 = require("@ai-matrx/records");
|
|
1444
1444
|
import_react15 = require("@ai-matrx/records/react");
|
|
1445
1445
|
import_design_system12 = require("@ai-matrx/design-system");
|
|
1446
1446
|
init_tablePickerEntries();
|
|
@@ -1905,7 +1905,7 @@ function PersonPicker({ field, value, onChange, disabled, id, className, autoOpe
|
|
|
1905
1905
|
cancelled = true;
|
|
1906
1906
|
};
|
|
1907
1907
|
}, [client, personTable, picked.length, people.length]);
|
|
1908
|
-
const listed = (0,
|
|
1908
|
+
const listed = (0, import_records11.rankTypedMatches)(members ?? [], search, memberName);
|
|
1909
1909
|
if (!membersPort || !client) {
|
|
1910
1910
|
return /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("p", { className: (0, import_design_system27.cn)("text-xs text-muted-foreground", className), children: NO_MEMBERS_REASON });
|
|
1911
1911
|
}
|
|
@@ -2006,13 +2006,13 @@ function PersonPicker({ field, value, onChange, disabled, id, className, autoOpe
|
|
|
2006
2006
|
)
|
|
2007
2007
|
] });
|
|
2008
2008
|
}
|
|
2009
|
-
var import_react40,
|
|
2009
|
+
var import_react40, import_records11, import_react41, import_design_system27, import_jsx_runtime31;
|
|
2010
2010
|
var init_PersonPicker = __esm({
|
|
2011
2011
|
"src/PersonPicker.tsx"() {
|
|
2012
2012
|
"use strict";
|
|
2013
2013
|
"use client";
|
|
2014
2014
|
import_react40 = require("react");
|
|
2015
|
-
|
|
2015
|
+
import_records11 = require("@ai-matrx/records");
|
|
2016
2016
|
import_react41 = require("@ai-matrx/records/react");
|
|
2017
2017
|
import_design_system27 = require("@ai-matrx/design-system");
|
|
2018
2018
|
init_PickOrAdd();
|
|
@@ -2588,7 +2588,7 @@ function choiceOptionsOf(options) {
|
|
|
2588
2588
|
const labels = [];
|
|
2589
2589
|
for (const option of options) {
|
|
2590
2590
|
const id = option.id;
|
|
2591
|
-
const key = (0,
|
|
2591
|
+
const key = (0, import_records12.optionKey)(option);
|
|
2592
2592
|
const label = recordName(option.data, null, "");
|
|
2593
2593
|
if (label) {
|
|
2594
2594
|
labels.push(label);
|
|
@@ -2600,18 +2600,18 @@ function choiceOptionsOf(options) {
|
|
|
2600
2600
|
return { byWord, labels };
|
|
2601
2601
|
}
|
|
2602
2602
|
function valueFromPastedText(field, raw, options, relationNames) {
|
|
2603
|
-
return (0,
|
|
2603
|
+
return (0, import_records12.coerceTypedAnswer)(field, raw, {
|
|
2604
2604
|
label: fieldName(field),
|
|
2605
2605
|
...options ? { options } : {},
|
|
2606
2606
|
...relationNames ? { relationNames } : {}
|
|
2607
2607
|
});
|
|
2608
2608
|
}
|
|
2609
|
-
var import_core4,
|
|
2609
|
+
var import_core4, import_records12;
|
|
2610
2610
|
var init_pasteValues = __esm({
|
|
2611
2611
|
"src/pasteValues.ts"() {
|
|
2612
2612
|
"use strict";
|
|
2613
2613
|
import_core4 = require("@ai-matrx/records/core");
|
|
2614
|
-
|
|
2614
|
+
import_records12 = require("@ai-matrx/records");
|
|
2615
2615
|
init_names();
|
|
2616
2616
|
init_names();
|
|
2617
2617
|
}
|
|
@@ -2732,7 +2732,7 @@ function datesOfColumn(rows, header, opts = {}) {
|
|
|
2732
2732
|
const raw = String(r[header] ?? "").trim();
|
|
2733
2733
|
if (raw === "") return;
|
|
2734
2734
|
filled += 1;
|
|
2735
|
-
const got = (0,
|
|
2735
|
+
const got = (0, import_records13.readTypedDate)(raw, { ...opts.withTime ? { withTime: true } : {}, ...opts.locale ? { locale: opts.locale } : {} });
|
|
2736
2736
|
if (got.ok) read.set(i, opts.withTime && got.instant ? got.instant : got.day);
|
|
2737
2737
|
else unreadable.push({ row: i, raw });
|
|
2738
2738
|
});
|
|
@@ -2765,11 +2765,11 @@ function looksLike(rows, header) {
|
|
|
2765
2765
|
if (share(isPhone) >= 0.6) return "phone";
|
|
2766
2766
|
return null;
|
|
2767
2767
|
}
|
|
2768
|
-
var
|
|
2768
|
+
var import_records13, IMPORT_KINDS, EMAIL2, PHONE2, URLISH;
|
|
2769
2769
|
var init_importKinds = __esm({
|
|
2770
2770
|
"src/importKinds.ts"() {
|
|
2771
2771
|
"use strict";
|
|
2772
|
-
|
|
2772
|
+
import_records13 = require("@ai-matrx/records");
|
|
2773
2773
|
IMPORT_KINDS = [
|
|
2774
2774
|
{ kind: "text", label: "Text" },
|
|
2775
2775
|
{ kind: "date", label: "Date" },
|
|
@@ -2791,7 +2791,7 @@ function titleRepeats(rows, header) {
|
|
|
2791
2791
|
const seen = /* @__PURE__ */ new Set();
|
|
2792
2792
|
let filled = 0;
|
|
2793
2793
|
for (const r of rows) {
|
|
2794
|
-
const key = (0,
|
|
2794
|
+
const key = (0, import_records14.relationNameKey)(String(r[header] ?? ""));
|
|
2795
2795
|
if (key === "") continue;
|
|
2796
2796
|
filled += 1;
|
|
2797
2797
|
seen.add(key);
|
|
@@ -2801,7 +2801,7 @@ function titleRepeats(rows, header) {
|
|
|
2801
2801
|
function sameRecordLikely(rows, header, notIdentity) {
|
|
2802
2802
|
const groups = /* @__PURE__ */ new Map();
|
|
2803
2803
|
for (const r of rows) {
|
|
2804
|
-
const key = (0,
|
|
2804
|
+
const key = (0, import_records14.relationNameKey)(String(r[header] ?? ""));
|
|
2805
2805
|
if (key === "") continue;
|
|
2806
2806
|
const held = groups.get(key);
|
|
2807
2807
|
if (held) held.push(r);
|
|
@@ -2834,7 +2834,7 @@ function combineRows(rows, header) {
|
|
|
2834
2834
|
const out = [];
|
|
2835
2835
|
const outLines = [];
|
|
2836
2836
|
rows.forEach((r, i) => {
|
|
2837
|
-
const key = (0,
|
|
2837
|
+
const key = (0, import_records14.relationNameKey)(String(r[header] ?? ""));
|
|
2838
2838
|
if (key === "") {
|
|
2839
2839
|
out.push({ ...r });
|
|
2840
2840
|
outLines.push([i + 1]);
|
|
@@ -2874,11 +2874,11 @@ function combineRows(rows, header) {
|
|
|
2874
2874
|
index.sort((a, b) => a.lines[0] - b.lines[0]);
|
|
2875
2875
|
return { rows: index.map((e) => e.row), lines: index.map((e) => e.lines), multiValued };
|
|
2876
2876
|
}
|
|
2877
|
-
var
|
|
2877
|
+
var import_records14, LIST_JOIN;
|
|
2878
2878
|
var init_importCombine = __esm({
|
|
2879
2879
|
"src/importCombine.ts"() {
|
|
2880
2880
|
"use strict";
|
|
2881
|
-
|
|
2881
|
+
import_records14 = require("@ai-matrx/records");
|
|
2882
2882
|
LIST_JOIN = "; ";
|
|
2883
2883
|
}
|
|
2884
2884
|
});
|
|
@@ -3347,13 +3347,13 @@ function ImportWizard({ tableId, source, onDone, onWrote, autoRun, className })
|
|
|
3347
3347
|
async (wanted) => {
|
|
3348
3348
|
const next = /* @__PURE__ */ new Map();
|
|
3349
3349
|
for (const { header, field } of wanted) {
|
|
3350
|
-
const names2 = effectiveRows.flatMap((r) => (0,
|
|
3350
|
+
const names2 = effectiveRows.flatMap((r) => (0, import_records15.relationNamesIn)(field, String(r[header] ?? "")));
|
|
3351
3351
|
const got = await client.relationNamesMatch({ table_id: field.relation_target, names: names2 });
|
|
3352
3352
|
if (!got.ok) {
|
|
3353
3353
|
setRelationProblem(got.error);
|
|
3354
3354
|
return null;
|
|
3355
3355
|
}
|
|
3356
|
-
next.set(field.key, (0,
|
|
3356
|
+
next.set(field.key, (0, import_records15.relationNameIndexOf)(got.data));
|
|
3357
3357
|
}
|
|
3358
3358
|
setRelationProblem(null);
|
|
3359
3359
|
setRelationIndex(next);
|
|
@@ -3377,12 +3377,12 @@ function ImportWizard({ tableId, source, onDone, onWrote, autoRun, className })
|
|
|
3377
3377
|
let linked = 0;
|
|
3378
3378
|
let named = 0;
|
|
3379
3379
|
effectiveRows.forEach((row, i) => {
|
|
3380
|
-
const names2 = (0,
|
|
3380
|
+
const names2 = (0, import_records15.relationNamesIn)(field, String(row[header] ?? ""));
|
|
3381
3381
|
if (String(row[header] ?? "").trim() === "") return;
|
|
3382
3382
|
named += 1;
|
|
3383
3383
|
let ok = true;
|
|
3384
3384
|
for (const name of names2) {
|
|
3385
|
-
const hits = index.byName.get((0,
|
|
3385
|
+
const hits = index.byName.get((0, import_records15.relationNameKey)(name)) ?? [];
|
|
3386
3386
|
if (hits.length === 1) continue;
|
|
3387
3387
|
ok = false;
|
|
3388
3388
|
if (hits.length === 0) unmatched.set(name, [...unmatched.get(name) ?? [], i + 1]);
|
|
@@ -3448,11 +3448,11 @@ function ImportWizard({ tableId, source, onDone, onWrote, autoRun, className })
|
|
|
3448
3448
|
const named = index.get(field.key);
|
|
3449
3449
|
const text = String(row[header] ?? "").trim();
|
|
3450
3450
|
if (!named || text === "") continue;
|
|
3451
|
-
const parts = field.multi ? (0,
|
|
3451
|
+
const parts = field.multi ? (0, import_records15.splitListCell)(text) : [text];
|
|
3452
3452
|
const ids = [];
|
|
3453
3453
|
let skip = false;
|
|
3454
3454
|
for (const part of parts) {
|
|
3455
|
-
const hits = (0,
|
|
3455
|
+
const hits = (0, import_records15.relationNamesIn)(field, part).length === 0 ? null : named.byName.get((0, import_records15.relationNameKey)(part)) ?? [];
|
|
3456
3456
|
if (hits === null) ids.push(part);
|
|
3457
3457
|
else if (hits.length === 1) ids.push(hits[0].id);
|
|
3458
3458
|
else if ((hits.length === 0 ? choiceFor(field.key).unmatched : choiceFor(field.key).ambiguous) !== "empty") skip = true;
|
|
@@ -3492,7 +3492,7 @@ function ImportWizard({ tableId, source, onDone, onWrote, autoRun, className })
|
|
|
3492
3492
|
setPhase("linking");
|
|
3493
3493
|
for (const ask of toMerge) {
|
|
3494
3494
|
for (const [name] of ask.ambiguous) {
|
|
3495
|
-
const hits = ask.index.byName.get((0,
|
|
3495
|
+
const hits = ask.index.byName.get((0, import_records15.relationNameKey)(name)) ?? [];
|
|
3496
3496
|
const winner = hits[0];
|
|
3497
3497
|
if (!winner) continue;
|
|
3498
3498
|
for (const loser of hits.slice(1)) {
|
|
@@ -4432,7 +4432,7 @@ function ImportWizard({ tableId, source, onDone, onWrote, autoRun, className })
|
|
|
4432
4432
|
table.error ? /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(RefusalNotice, { error: table.error, onRetry: table.reload }) : null
|
|
4433
4433
|
] });
|
|
4434
4434
|
}
|
|
4435
|
-
var import_react46, import_react47, import_core6, import_design_system28,
|
|
4435
|
+
var import_react46, import_react47, import_core6, import_design_system28, import_records15, import_text_case5, import_jsx_runtime32, BATCH, SAMPLES, COLUMNS_PER_CALL, ABSENT, LEAVE, TITLE_COPY, TYPED_VALUES;
|
|
4436
4436
|
var init_ImportWizard = __esm({
|
|
4437
4437
|
"src/ImportWizard.tsx"() {
|
|
4438
4438
|
"use strict";
|
|
@@ -4441,7 +4441,7 @@ var init_ImportWizard = __esm({
|
|
|
4441
4441
|
import_react47 = require("@ai-matrx/records/react");
|
|
4442
4442
|
import_core6 = require("@ai-matrx/records/core");
|
|
4443
4443
|
import_design_system28 = require("@ai-matrx/design-system");
|
|
4444
|
-
|
|
4444
|
+
import_records15 = require("@ai-matrx/records");
|
|
4445
4445
|
init_Refusal();
|
|
4446
4446
|
init_refusals();
|
|
4447
4447
|
init_importRuleCheck();
|
|
@@ -4498,7 +4498,7 @@ var init_tableLanes = __esm({
|
|
|
4498
4498
|
});
|
|
4499
4499
|
|
|
4500
4500
|
// src/TablesHome.tsx
|
|
4501
|
-
var import_react48, import_react49, import_core7,
|
|
4501
|
+
var import_react48, import_react49, import_core7, import_records16, import_design_system29, import_jsx_runtime33;
|
|
4502
4502
|
var init_TablesHome = __esm({
|
|
4503
4503
|
"src/TablesHome.tsx"() {
|
|
4504
4504
|
"use strict";
|
|
@@ -4506,7 +4506,7 @@ var init_TablesHome = __esm({
|
|
|
4506
4506
|
import_react48 = require("react");
|
|
4507
4507
|
import_react49 = require("@ai-matrx/records/react");
|
|
4508
4508
|
import_core7 = require("@ai-matrx/records/core");
|
|
4509
|
-
|
|
4509
|
+
import_records16 = require("@ai-matrx/records");
|
|
4510
4510
|
import_design_system29 = require("@ai-matrx/design-system");
|
|
4511
4511
|
init_tableLanes();
|
|
4512
4512
|
import_jsx_runtime33 = require("react/jsx-runtime");
|
|
@@ -5367,7 +5367,7 @@ function AddChoicesInline({ field, onAdded, disabled = false }) {
|
|
|
5367
5367
|
|
|
5368
5368
|
// src/editors.tsx
|
|
5369
5369
|
var import_react78 = require("react");
|
|
5370
|
-
var
|
|
5370
|
+
var import_records29 = require("@ai-matrx/records");
|
|
5371
5371
|
var import_react79 = require("@ai-matrx/records/react");
|
|
5372
5372
|
var import_design_system48 = require("@ai-matrx/design-system");
|
|
5373
5373
|
init_dates();
|
|
@@ -5375,22 +5375,22 @@ init_dates();
|
|
|
5375
5375
|
// src/newerKindValues.tsx
|
|
5376
5376
|
var import_react8 = require("react");
|
|
5377
5377
|
var import_source = require("@ai-matrx/content-ir/source");
|
|
5378
|
-
var
|
|
5378
|
+
var import_records2 = require("@ai-matrx/records");
|
|
5379
5379
|
var import_design_system6 = require("@ai-matrx/design-system");
|
|
5380
5380
|
var import_outbound_react = require("@ai-matrx/kit/outbound-react");
|
|
5381
5381
|
var import_jsx_runtime6 = require("react/jsx-runtime");
|
|
5382
5382
|
var own = (event) => event.stopPropagation();
|
|
5383
5383
|
function newerKindValue(field, value, opts = {}) {
|
|
5384
|
-
switch ((0,
|
|
5384
|
+
switch ((0, import_records2.newerKindOf)(field)) {
|
|
5385
5385
|
case "duration": {
|
|
5386
|
-
const words = (0,
|
|
5386
|
+
const words = (0, import_records2.durationText)(value);
|
|
5387
5387
|
return words === null ? void 0 : /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { className: "tabular-nums", "data-records-duration": "", children: words });
|
|
5388
5388
|
}
|
|
5389
5389
|
case "created_by":
|
|
5390
5390
|
case "modified_by":
|
|
5391
|
-
return (0,
|
|
5391
|
+
return (0, import_records2.isPersonStamp)(value) ? /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(PersonStampChip, { stamp: value }) : void 0;
|
|
5392
5392
|
case "address":
|
|
5393
|
-
return (0,
|
|
5393
|
+
return (0, import_records2.isAddressValue)(value) || typeof value === "string" ? /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(AddressLink, { value }) : void 0;
|
|
5394
5394
|
case "barcode":
|
|
5395
5395
|
return typeof value === "string" ? /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("span", { className: "inline-flex min-w-0 items-center gap-1 font-mono text-xs", "data-records-barcode": "", title: value, children: [
|
|
5396
5396
|
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { "aria-hidden": "true", className: "text-muted-foreground", children: "\u25AE\u25AF\u25AE" }),
|
|
@@ -5405,7 +5405,7 @@ function newerKindValue(field, value, opts = {}) {
|
|
|
5405
5405
|
}
|
|
5406
5406
|
}
|
|
5407
5407
|
function PersonStampChip({ stamp }) {
|
|
5408
|
-
const words = (0,
|
|
5408
|
+
const words = (0, import_records2.personStampText)(stamp) ?? import_records2.NOT_A_MEMBER_WORDS;
|
|
5409
5409
|
const tier = stamp.actor ?? "user";
|
|
5410
5410
|
const name = tier === "user" ? stamp.name : null;
|
|
5411
5411
|
const initial = tier === "system" ? "\u2699" : tier === "agent" ? "\u2726" : name && name.trim() !== "" ? name.trim()[0].toUpperCase() : "?";
|
|
@@ -5422,8 +5422,8 @@ function PersonStampChip({ stamp }) {
|
|
|
5422
5422
|
] });
|
|
5423
5423
|
}
|
|
5424
5424
|
function AddressLink({ value }) {
|
|
5425
|
-
const words = (0,
|
|
5426
|
-
const href = (0,
|
|
5425
|
+
const words = (0, import_records2.addressValueText)(value);
|
|
5426
|
+
const href = (0, import_records2.addressMapUrl)(value);
|
|
5427
5427
|
if (!words || !href) return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { className: "text-muted-foreground", children: "\u2014" });
|
|
5428
5428
|
return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(
|
|
5429
5429
|
import_outbound_react.OutboundLink,
|
|
@@ -5442,11 +5442,11 @@ function AddressLink({ value }) {
|
|
|
5442
5442
|
}
|
|
5443
5443
|
var STATUS_GROUP_MARK = { todo: "\u25CB", in_progress: "\u25D0", done: "\u25CF" };
|
|
5444
5444
|
function statusMarkOf(field, value, document2) {
|
|
5445
|
-
if ((0,
|
|
5445
|
+
if ((0, import_records2.newerKindOf)(field) !== "status" || typeof value !== "string") return null;
|
|
5446
5446
|
const chosen = document2?.["_choices"]?.[field.key];
|
|
5447
5447
|
const key = chosen && typeof chosen === "object" && typeof chosen.key === "string" ? chosen.key : value;
|
|
5448
|
-
const group = (0,
|
|
5449
|
-
return { mark: STATUS_GROUP_MARK[group], group, words:
|
|
5448
|
+
const group = (0, import_records2.statusGroupOf)(field, key);
|
|
5449
|
+
return { mark: STATUS_GROUP_MARK[group], group, words: import_records2.STATUS_GROUP_WORDS[group] };
|
|
5450
5450
|
}
|
|
5451
5451
|
function inline(text, key) {
|
|
5452
5452
|
const out = [];
|
|
@@ -5474,7 +5474,7 @@ function marks(text, key) {
|
|
|
5474
5474
|
if (tok.startsWith("**") || tok.startsWith("__")) out.push(/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("strong", { children: tok.slice(2, -2) }, k));
|
|
5475
5475
|
else if (tok.startsWith("[")) {
|
|
5476
5476
|
const link = /^\[([^\]]+)\]\(([^)\s]+)\)$/.exec(tok);
|
|
5477
|
-
const href = (0,
|
|
5477
|
+
const href = (0, import_records2.safeLinkHref)(link?.[2] ?? "");
|
|
5478
5478
|
out.push(
|
|
5479
5479
|
href ? /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_outbound_react.OutboundLink, { href, className: "text-primary underline-offset-2 hover:underline", onClick: own, children: link?.[1] }, k) : link?.[1] ?? tok
|
|
5480
5480
|
);
|
|
@@ -5539,7 +5539,7 @@ function SafeMarkdown({ text, clipped }) {
|
|
|
5539
5539
|
);
|
|
5540
5540
|
}
|
|
5541
5541
|
function newerKindControl(props) {
|
|
5542
|
-
switch ((0,
|
|
5542
|
+
switch ((0, import_records2.newerKindOf)(props.field)) {
|
|
5543
5543
|
case "duration":
|
|
5544
5544
|
return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(DurationControl, { ...props });
|
|
5545
5545
|
case "address":
|
|
@@ -5555,10 +5555,10 @@ function newerKindControl(props) {
|
|
|
5555
5555
|
}
|
|
5556
5556
|
}
|
|
5557
5557
|
function DurationControl({ value, onChange, disabled, id }) {
|
|
5558
|
-
const [text, setText] = (0, import_react8.useState)(() => (0,
|
|
5558
|
+
const [text, setText] = (0, import_react8.useState)(() => (0, import_records2.durationText)(value) ?? "");
|
|
5559
5559
|
const [wrong, setWrong] = (0, import_react8.useState)(false);
|
|
5560
5560
|
(0, import_react8.useEffect)(() => {
|
|
5561
|
-
setText((0,
|
|
5561
|
+
setText((0, import_records2.durationText)(value) ?? "");
|
|
5562
5562
|
}, [value]);
|
|
5563
5563
|
return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("span", { className: "flex flex-col gap-1", children: [
|
|
5564
5564
|
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
@@ -5578,12 +5578,12 @@ function DurationControl({ value, onChange, disabled, id }) {
|
|
|
5578
5578
|
onChange(null);
|
|
5579
5579
|
return;
|
|
5580
5580
|
}
|
|
5581
|
-
const seconds = (0,
|
|
5581
|
+
const seconds = (0, import_records2.readTypedDuration)(e.target.value);
|
|
5582
5582
|
setWrong(seconds === null);
|
|
5583
5583
|
if (seconds !== null) onChange(seconds);
|
|
5584
5584
|
},
|
|
5585
5585
|
onBlur: () => {
|
|
5586
|
-
if (!wrong) setText((0,
|
|
5586
|
+
if (!wrong) setText((0, import_records2.durationText)(value) ?? "");
|
|
5587
5587
|
}
|
|
5588
5588
|
}
|
|
5589
5589
|
),
|
|
@@ -5605,13 +5605,13 @@ var ADDRESS_EXAMPLES = {
|
|
|
5605
5605
|
country: "US"
|
|
5606
5606
|
};
|
|
5607
5607
|
function AddressControl({ value, onChange, disabled, id }) {
|
|
5608
|
-
const held = (0,
|
|
5608
|
+
const held = (0, import_records2.isAddressValue)(value) ? value : typeof value === "string" && value.trim() !== "" ? { street: value } : {};
|
|
5609
5609
|
const set = (part, words) => {
|
|
5610
5610
|
const next = { ...held, [part]: words };
|
|
5611
5611
|
const kept2 = Object.fromEntries(Object.entries(next).filter(([, v]) => typeof v === "string" && v.trim() !== ""));
|
|
5612
5612
|
onChange(Object.keys(kept2).length === 0 ? null : kept2);
|
|
5613
5613
|
};
|
|
5614
|
-
return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { id, className: "grid grid-cols-2 gap-1.5", "data-records-address-control": "", children:
|
|
5614
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { id, className: "grid grid-cols-2 gap-1.5", "data-records-address-control": "", children: import_records2.ADDRESS_PARTS.map((part) => /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
5615
5615
|
import_design_system6.BasicInput,
|
|
5616
5616
|
{
|
|
5617
5617
|
"aria-label": ADDRESS_LABELS[part],
|
|
@@ -5692,7 +5692,7 @@ init_names();
|
|
|
5692
5692
|
|
|
5693
5693
|
// src/RelationPicker.tsx
|
|
5694
5694
|
var import_react10 = require("react");
|
|
5695
|
-
var
|
|
5695
|
+
var import_records3 = require("@ai-matrx/records");
|
|
5696
5696
|
var import_react11 = require("@ai-matrx/records/react");
|
|
5697
5697
|
var import_design_system9 = require("@ai-matrx/design-system");
|
|
5698
5698
|
init_PickOrAdd();
|
|
@@ -5963,7 +5963,7 @@ function RelationPicker({ field, value, onChange, disabled, id, className, allow
|
|
|
5963
5963
|
toggle(createdId);
|
|
5964
5964
|
};
|
|
5965
5965
|
const apart = tellApart(rows ?? [], titleOf);
|
|
5966
|
-
const visible = (0,
|
|
5966
|
+
const visible = (0, import_records3.rankTypedMatches)(rows ?? [], search, (row) => [titleOf(row.id), apart.get(row.id) ?? ""]);
|
|
5967
5967
|
const anchored = autoOpen === true;
|
|
5968
5968
|
const cellChips = picked.map((recordId) => /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
5969
5969
|
RecordChip,
|
|
@@ -6097,7 +6097,7 @@ function readableLink(raw) {
|
|
|
6097
6097
|
var import_react73 = require("react");
|
|
6098
6098
|
var import_design_system45 = require("@ai-matrx/design-system");
|
|
6099
6099
|
var import_data_table6 = require("@ai-matrx/design-system/data-table");
|
|
6100
|
-
var
|
|
6100
|
+
var import_records27 = require("@ai-matrx/records");
|
|
6101
6101
|
var import_react74 = require("@ai-matrx/records/react");
|
|
6102
6102
|
init_host();
|
|
6103
6103
|
|
|
@@ -6536,7 +6536,7 @@ function ReferenceBuilder({
|
|
|
6536
6536
|
// src/FormulaTextEditor.tsx
|
|
6537
6537
|
var import_react18 = require("react");
|
|
6538
6538
|
var import_react19 = require("@ai-matrx/records/react");
|
|
6539
|
-
var
|
|
6539
|
+
var import_records5 = require("@ai-matrx/records");
|
|
6540
6540
|
var import_design_system14 = require("@ai-matrx/design-system");
|
|
6541
6541
|
init_host();
|
|
6542
6542
|
init_Refusal();
|
|
@@ -6560,7 +6560,7 @@ var NOT_TYPED_BY_NAME = /* @__PURE__ */ new Set([
|
|
|
6560
6560
|
function formulaFunctionNames(kinds) {
|
|
6561
6561
|
return [...new Set(kinds.map((row) => row.node))].filter((node) => node.startsWith("fx.") && !NOT_TYPED_BY_NAME.has(node)).map((node) => node.slice(3).toUpperCase()).sort();
|
|
6562
6562
|
}
|
|
6563
|
-
var STORE_FORMULA_FUNCTION_NAMES = formulaFunctionNames(
|
|
6563
|
+
var STORE_FORMULA_FUNCTION_NAMES = formulaFunctionNames(import_records5.RULE_NODE_KINDS);
|
|
6564
6564
|
var RESULT_WORD = {
|
|
6565
6565
|
number: "a number",
|
|
6566
6566
|
text: "text",
|
|
@@ -6927,8 +6927,8 @@ var EMBEDDED_TABLE_CLASS = [
|
|
|
6927
6927
|
// src/labels.tsx
|
|
6928
6928
|
var import_react28 = require("react");
|
|
6929
6929
|
var import_react29 = require("@ai-matrx/records/react");
|
|
6930
|
+
var import_records6 = require("@ai-matrx/records");
|
|
6930
6931
|
var import_records7 = require("@ai-matrx/records");
|
|
6931
|
-
var import_records8 = require("@ai-matrx/records");
|
|
6932
6932
|
init_names();
|
|
6933
6933
|
var import_uuid2 = require("@ai-matrx/kit/uuid");
|
|
6934
6934
|
|
|
@@ -8159,7 +8159,7 @@ function RecordLabelProvider({ children }) {
|
|
|
8159
8159
|
for (const option of result.data ?? []) {
|
|
8160
8160
|
const words = recordName(option.data, null, "Unnamed choice");
|
|
8161
8161
|
next[option.id] = words;
|
|
8162
|
-
const key = (0,
|
|
8162
|
+
const key = (0, import_records7.optionKey)(option);
|
|
8163
8163
|
if (key) next[choiceKeyName(field.id, key)] = words;
|
|
8164
8164
|
}
|
|
8165
8165
|
return next;
|
|
@@ -8277,7 +8277,7 @@ init_enumLabels();
|
|
|
8277
8277
|
|
|
8278
8278
|
// src/EntityReferenceControl.tsx
|
|
8279
8279
|
var import_react31 = require("react");
|
|
8280
|
-
var
|
|
8280
|
+
var import_records8 = require("@ai-matrx/records");
|
|
8281
8281
|
var import_react32 = require("@ai-matrx/records/react");
|
|
8282
8282
|
var import_design_system20 = require("@ai-matrx/design-system");
|
|
8283
8283
|
init_PickOrAdd();
|
|
@@ -8287,7 +8287,7 @@ var import_jsx_runtime24 = require("react/jsx-runtime");
|
|
|
8287
8287
|
var WITHHELD_ENTITY_LABEL = "Something you have not been given access to";
|
|
8288
8288
|
var ENTITY_REFERENCE_EMPTY = "Nothing is pointed at yet.";
|
|
8289
8289
|
function entityReferenceText(value) {
|
|
8290
|
-
const refs = (0,
|
|
8290
|
+
const refs = (0, import_records8.entityRefsOf)(value);
|
|
8291
8291
|
if (refs.length === 0) return "\u2014";
|
|
8292
8292
|
return refs.map((r) => r.label ?? WITHHELD_ENTITY_LABEL).join(", ");
|
|
8293
8293
|
}
|
|
@@ -8301,7 +8301,7 @@ function EntityReferenceControl(props) {
|
|
|
8301
8301
|
return client ? /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(WithWords, { ...props }) : /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(Chips, { ...props, words: null, picker: null });
|
|
8302
8302
|
}
|
|
8303
8303
|
function WithWords(props) {
|
|
8304
|
-
const refs = (0, import_react31.useMemo)(() => (0,
|
|
8304
|
+
const refs = (0, import_react31.useMemo)(() => (0, import_records8.entityRefsOf)(props.value), [props.value]);
|
|
8305
8305
|
const [known, setKnown] = (0, import_react31.useState)([]);
|
|
8306
8306
|
const withKnown = refs.map((r) => r.label === null ? known.find((k) => k.token === r.token && k.id === r.id) ?? r : r);
|
|
8307
8307
|
const unlabelled = (0, import_react31.useMemo)(
|
|
@@ -8321,14 +8321,14 @@ function WithWords(props) {
|
|
|
8321
8321
|
initialSearch: props.initialSearch,
|
|
8322
8322
|
onTakeOff: (ref) => {
|
|
8323
8323
|
const rest = withKnown.filter((x) => !(x.token === ref.token && x.id === ref.id));
|
|
8324
|
-
props.onChange((0,
|
|
8324
|
+
props.onChange((0, import_records8.entityRefsToWrite)(rest, Boolean(props.field.multi)));
|
|
8325
8325
|
},
|
|
8326
8326
|
labelOf: (r) => r.label ?? words?.data?.find((w) => w.token === r.token && w.id === r.id)?.label ?? WITHHELD_ENTITY_LABEL,
|
|
8327
8327
|
onPick: (picked) => {
|
|
8328
8328
|
setKnown((k) => [...k.filter((x) => !(x.token === picked.token && x.id === picked.id)), picked]);
|
|
8329
8329
|
const multi = Boolean(props.field.multi);
|
|
8330
8330
|
const next = multi ? [...withKnown.filter((x) => !(x.token === picked.token && x.id === picked.id)), picked] : [picked];
|
|
8331
|
-
props.onChange((0,
|
|
8331
|
+
props.onChange((0, import_records8.entityRefsToWrite)(next, multi));
|
|
8332
8332
|
}
|
|
8333
8333
|
}
|
|
8334
8334
|
);
|
|
@@ -8439,7 +8439,7 @@ function Chips({
|
|
|
8439
8439
|
words,
|
|
8440
8440
|
picker
|
|
8441
8441
|
}) {
|
|
8442
|
-
const refs = (0, import_react31.useMemo)(() => (0,
|
|
8442
|
+
const refs = (0, import_react31.useMemo)(() => (0, import_records8.entityRefsOf)(value), [value]);
|
|
8443
8443
|
const labelOf = (token, refId, own3) => {
|
|
8444
8444
|
if (own3) return own3;
|
|
8445
8445
|
const read = words?.data?.find((w) => w.token === token && w.id === refId)?.label;
|
|
@@ -8463,7 +8463,7 @@ function Chips({
|
|
|
8463
8463
|
"aria-label": `Take ${label} off`,
|
|
8464
8464
|
onClick: () => {
|
|
8465
8465
|
const rest = refs.filter((x) => !(x.token === r.token && x.id === r.id));
|
|
8466
|
-
onChange((0,
|
|
8466
|
+
onChange((0, import_records8.entityRefsToWrite)(rest, multi));
|
|
8467
8467
|
},
|
|
8468
8468
|
children: "\xD7"
|
|
8469
8469
|
}
|
|
@@ -9075,7 +9075,7 @@ function AttachmentControl({
|
|
|
9075
9075
|
}
|
|
9076
9076
|
|
|
9077
9077
|
// src/ReferenceChips.tsx
|
|
9078
|
-
var
|
|
9078
|
+
var import_records9 = require("@ai-matrx/records");
|
|
9079
9079
|
var import_design_system26 = require("@ai-matrx/design-system");
|
|
9080
9080
|
init_host();
|
|
9081
9081
|
init_kindValues();
|
|
@@ -9096,7 +9096,7 @@ function iconOf(pair) {
|
|
|
9096
9096
|
}
|
|
9097
9097
|
function referenceChipsOf(field, value, kind, labels) {
|
|
9098
9098
|
if (kind === "entity_reference") {
|
|
9099
|
-
return (0,
|
|
9099
|
+
return (0, import_records9.entityRefsOf)(value).map((r) => ({ token: r.token, id: r.id, label: r.label }));
|
|
9100
9100
|
}
|
|
9101
9101
|
const ids = (Array.isArray(value) ? value : [value]).filter(isId).map(String);
|
|
9102
9102
|
const tableId = typeof field.relation_target === "string" ? field.relation_target : void 0;
|
|
@@ -9185,7 +9185,7 @@ function KindValueCell({
|
|
|
9185
9185
|
init_kindValues();
|
|
9186
9186
|
|
|
9187
9187
|
// src/formulaNames.ts
|
|
9188
|
-
var
|
|
9188
|
+
var import_records10 = require("@ai-matrx/records");
|
|
9189
9189
|
init_names();
|
|
9190
9190
|
function fieldRefsOf(expr) {
|
|
9191
9191
|
const out = [];
|
|
@@ -9236,14 +9236,14 @@ function formulaSourceArchived(field, document2) {
|
|
|
9236
9236
|
const keys = (field.config ?? {})[FORMULA_INPUT_KEYS];
|
|
9237
9237
|
if (!Array.isArray(keys) || !document2) return null;
|
|
9238
9238
|
for (const key of keys) {
|
|
9239
|
-
const state2 = (0,
|
|
9239
|
+
const state2 = (0, import_records10.sourceArchivedOf)(document2[String(key)]);
|
|
9240
9240
|
if (state2) return state2;
|
|
9241
9241
|
}
|
|
9242
9242
|
return null;
|
|
9243
9243
|
}
|
|
9244
9244
|
|
|
9245
9245
|
// src/values.tsx
|
|
9246
|
-
var
|
|
9246
|
+
var import_records17 = require("@ai-matrx/records");
|
|
9247
9247
|
var import_uuid4 = require("@ai-matrx/kit/uuid");
|
|
9248
9248
|
init_userIds();
|
|
9249
9249
|
|
|
@@ -9685,7 +9685,7 @@ function structuredNode(field, structured, room) {
|
|
|
9685
9685
|
return room === "cell" ? /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(StructuredCell, { structured, label }) : /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(StructuredValueView, { structured, label });
|
|
9686
9686
|
}
|
|
9687
9687
|
function renderValue(field, value, document2, labels, stillWaitingFor, look, room = "cell") {
|
|
9688
|
-
const archivedSource = (0,
|
|
9688
|
+
const archivedSource = (0, import_records17.sourceArchivedOf)(value);
|
|
9689
9689
|
if (archivedSource) return /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(SourceArchivedValue, { state: archivedSource });
|
|
9690
9690
|
const envelope = envelopeFor(document2, field.key);
|
|
9691
9691
|
if (envelope?.absent) {
|
|
@@ -9708,7 +9708,7 @@ function renderValue(field, value, document2, labels, stillWaitingFor, look, roo
|
|
|
9708
9708
|
return /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("span", { className: "text-muted-foreground", children: "\u2014" });
|
|
9709
9709
|
}
|
|
9710
9710
|
if (isSignatureField(field)) return /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(SignatureValue, { value, fieldKey: field.key, document: document2 });
|
|
9711
|
-
if ((0,
|
|
9711
|
+
if ((0, import_records17.isButtonField)(field)) return /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(ButtonValue, { field });
|
|
9712
9712
|
const newer = newerKindValue(field, value);
|
|
9713
9713
|
if (newer !== void 0) return newer;
|
|
9714
9714
|
const whole = typeof value === "string" ? (0, import_core8.wholeValueOf)(document2, field.key) : null;
|
|
@@ -9846,10 +9846,10 @@ function personWordsOf(kind, value) {
|
|
|
9846
9846
|
}
|
|
9847
9847
|
function scalarText(field, value, labels, stillWaitingFor) {
|
|
9848
9848
|
if (value === null || value === void 0) return "\u2014";
|
|
9849
|
-
if ((0,
|
|
9849
|
+
if ((0, import_records17.sourceArchivedOf)(value)) return SOURCE_ARCHIVED_WORDS;
|
|
9850
9850
|
if (isSignatureField(field)) return signatureWords(value) ?? "\u2014";
|
|
9851
|
-
if ((0,
|
|
9852
|
-
const newerWords = (0,
|
|
9851
|
+
if ((0, import_records17.autonumberPrefixOf)(field)) return (0, import_records17.autonumberWords)(field, value) ?? String(value);
|
|
9852
|
+
const newerWords = (0, import_records17.newerKindWords)(field, value);
|
|
9853
9853
|
if (newerWords !== null) return newerWords;
|
|
9854
9854
|
const kind = editorKindFor(field);
|
|
9855
9855
|
if (kind === "entity_reference") return entityReferenceText(value);
|
|
@@ -9942,7 +9942,7 @@ function SourceArchivedNotice({ fieldId, tableId }) {
|
|
|
9942
9942
|
// src/Condition.tsx
|
|
9943
9943
|
var import_react57 = require("react");
|
|
9944
9944
|
var import_design_system34 = require("@ai-matrx/design-system");
|
|
9945
|
-
var
|
|
9945
|
+
var import_records18 = require("@ai-matrx/records");
|
|
9946
9946
|
init_PickOrAdd();
|
|
9947
9947
|
init_choiceLooks();
|
|
9948
9948
|
var import_react58 = require("@ai-matrx/records/react");
|
|
@@ -10068,7 +10068,7 @@ function ChoiceValues({ field, value, onChange }) {
|
|
|
10068
10068
|
let cancelled = false;
|
|
10069
10069
|
void (0, askOnce_exports.fieldOptionsOnce)(client, field.id).then((got) => {
|
|
10070
10070
|
if (cancelled) return;
|
|
10071
|
-
setChoices(got.ok ? (got.data ?? []).map((o) => ({ key: (0,
|
|
10071
|
+
setChoices(got.ok ? (got.data ?? []).map((o) => ({ key: (0, import_records18.optionKey)(o), label: (0, import_records18.optionLabel)(o) ?? "" })).filter((c) => c.label !== "") : []);
|
|
10072
10072
|
});
|
|
10073
10073
|
return () => {
|
|
10074
10074
|
cancelled = true;
|
|
@@ -10124,7 +10124,7 @@ function ChoiceValue({ field, value, onChange }) {
|
|
|
10124
10124
|
void (0, askOnce_exports.fieldOptionsOnce)(client, field.id).then((got) => {
|
|
10125
10125
|
if (cancelled) return;
|
|
10126
10126
|
setChoices(
|
|
10127
|
-
got.ok ? (got.data ?? []).map((o) => ({ key: (0,
|
|
10127
|
+
got.ok ? (got.data ?? []).map((o) => ({ key: (0, import_records18.optionKey)(o), label: (0, import_records18.optionLabel)(o) ?? "" })).filter((c) => c.label !== "") : []
|
|
10128
10128
|
);
|
|
10129
10129
|
});
|
|
10130
10130
|
return () => {
|
|
@@ -10142,7 +10142,7 @@ function ChoiceValue({ field, value, onChange }) {
|
|
|
10142
10142
|
}
|
|
10143
10143
|
);
|
|
10144
10144
|
}
|
|
10145
|
-
const shown2 = (0,
|
|
10145
|
+
const shown2 = (0, import_records18.rankTypedMatches)(choices, search.trim(), (c) => c.label);
|
|
10146
10146
|
return /* @__PURE__ */ (0, import_jsx_runtime38.jsx)("span", { className: "inline-flex min-w-0", "data-records-condition-choice": "", "data-pick-value": value, children: /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
|
|
10147
10147
|
PickOrAdd,
|
|
10148
10148
|
{
|
|
@@ -10654,7 +10654,7 @@ function ConditionGroup({
|
|
|
10654
10654
|
|
|
10655
10655
|
// src/FieldRetype.tsx
|
|
10656
10656
|
var import_react59 = require("react");
|
|
10657
|
-
var
|
|
10657
|
+
var import_records19 = require("@ai-matrx/records");
|
|
10658
10658
|
var import_react60 = require("@ai-matrx/records/react");
|
|
10659
10659
|
var import_design_system35 = require("@ai-matrx/design-system");
|
|
10660
10660
|
init_parity();
|
|
@@ -10870,7 +10870,7 @@ function FieldRetype({ field, tableId, onRetyped }) {
|
|
|
10870
10870
|
return;
|
|
10871
10871
|
}
|
|
10872
10872
|
const groups = rows.map((r) => ({ value: r.ids.map((id) => people.get(id)?.name ?? "").join(", "), count: 1 }));
|
|
10873
|
-
setPreview((0,
|
|
10873
|
+
setPreview((0, import_records19.previewRetype)({ type: to.behaviour, kind: to.kind }, groups, false));
|
|
10874
10874
|
}).catch((e) => {
|
|
10875
10875
|
if (cancelled) return;
|
|
10876
10876
|
setAsking(false);
|
|
@@ -11017,7 +11017,7 @@ function FieldRetype({ field, tableId, onRetyped }) {
|
|
|
11017
11017
|
|
|
11018
11018
|
// src/FieldRulePreview.tsx
|
|
11019
11019
|
var import_react61 = require("react");
|
|
11020
|
-
var
|
|
11020
|
+
var import_records20 = require("@ai-matrx/records");
|
|
11021
11021
|
var import_react62 = require("@ai-matrx/records/react");
|
|
11022
11022
|
init_Refusal();
|
|
11023
11023
|
init_names();
|
|
@@ -11067,7 +11067,7 @@ function FieldRulePreview({ field, tableId, rules }) {
|
|
|
11067
11067
|
}
|
|
11068
11068
|
const numbers = holdsNumbers(field);
|
|
11069
11069
|
const groups = answer.data.map((row) => ({ value: groupValue(row.groups[field.key] ?? null, numbers), count: row.row_count }));
|
|
11070
|
-
setPreview((0,
|
|
11070
|
+
setPreview((0, import_records20.previewRuleChange)(latest.current, groups, answer.data.length >= PREVIEW_GROUPS));
|
|
11071
11071
|
}).catch((thrown) => {
|
|
11072
11072
|
if (cancelled) return;
|
|
11073
11073
|
setRefusal((0, refusals_exports.refusalFromThrown)(thrown, `${name}'s values could not be counted.`, "The check still applies when you save."));
|
|
@@ -11252,7 +11252,7 @@ function PickListLink({
|
|
|
11252
11252
|
}
|
|
11253
11253
|
|
|
11254
11254
|
// src/NewerKindQuestions.tsx
|
|
11255
|
-
var
|
|
11255
|
+
var import_records21 = require("@ai-matrx/records");
|
|
11256
11256
|
var import_design_system37 = require("@ai-matrx/design-system");
|
|
11257
11257
|
var import_jsx_runtime42 = require("react/jsx-runtime");
|
|
11258
11258
|
var STATUS_STARTING_CHOICES = [
|
|
@@ -11273,7 +11273,7 @@ function statusGroupRows(field, rows, keyOfId, changed) {
|
|
|
11273
11273
|
if (words === "") continue;
|
|
11274
11274
|
const ref = r.id ?? words;
|
|
11275
11275
|
const key = r.id ? keyOfId[r.id] : void 0;
|
|
11276
|
-
const held = field && key ? (0,
|
|
11276
|
+
const held = field && key ? (0, import_records21.statusGroupOf)(field, key) : void 0;
|
|
11277
11277
|
out.push({ ref, words, group: changed[ref] ?? held ?? guessStatusGroup(words) });
|
|
11278
11278
|
}
|
|
11279
11279
|
return out;
|
|
@@ -11289,10 +11289,10 @@ function StatusGroupsQuestion({
|
|
|
11289
11289
|
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)("span", { className: "min-w-0 flex-1 truncate text-sm", children: r.words }),
|
|
11290
11290
|
/* @__PURE__ */ (0, import_jsx_runtime42.jsxs)(import_design_system37.Select, { value: r.group, onValueChange: (next) => onGroup(r.ref, next), children: [
|
|
11291
11291
|
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)(import_design_system37.SelectTrigger, { size: "sm", className: "w-36", "aria-label": `Group for ${r.words}`, children: /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(import_design_system37.SelectValue, {}) }),
|
|
11292
|
-
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)(import_design_system37.SelectContent, { children:
|
|
11292
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)(import_design_system37.SelectContent, { children: import_records21.STATUS_GROUPS.map((g) => /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)(import_design_system37.SelectItem, { value: g, children: [
|
|
11293
11293
|
STATUS_GROUP_MARK[g],
|
|
11294
11294
|
" ",
|
|
11295
|
-
|
|
11295
|
+
import_records21.STATUS_GROUP_WORDS[g]
|
|
11296
11296
|
] }, g)) })
|
|
11297
11297
|
] })
|
|
11298
11298
|
] }, r.ref))
|
|
@@ -11330,7 +11330,7 @@ function BarcodeSymbologyQuestion({ value, onChange }) {
|
|
|
11330
11330
|
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)(import_design_system37.SelectTrigger, { size: "sm", "aria-label": "Code type", children: /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(import_design_system37.SelectValue, {}) }),
|
|
11331
11331
|
/* @__PURE__ */ (0, import_jsx_runtime42.jsxs)(import_design_system37.SelectContent, { children: [
|
|
11332
11332
|
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)(import_design_system37.SelectItem, { value: "any", children: "Any code" }),
|
|
11333
|
-
|
|
11333
|
+
import_records21.BARCODE_SYMBOLOGIES.map((s) => /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(import_design_system37.SelectItem, { value: s, children: SYMBOLOGY_WORDS[s] }, s))
|
|
11334
11334
|
] })
|
|
11335
11335
|
] })
|
|
11336
11336
|
] });
|
|
@@ -11693,21 +11693,21 @@ function nextFieldSort(fields) {
|
|
|
11693
11693
|
|
|
11694
11694
|
// src/FieldEditor.tsx
|
|
11695
11695
|
init_enumLabels();
|
|
11696
|
-
var
|
|
11696
|
+
var import_records25 = require("@ai-matrx/records");
|
|
11697
11697
|
|
|
11698
11698
|
// src/ButtonSettings.tsx
|
|
11699
11699
|
var import_react67 = require("react");
|
|
11700
11700
|
var import_design_system42 = require("@ai-matrx/design-system");
|
|
11701
11701
|
var import_data_table5 = require("@ai-matrx/design-system/data-table");
|
|
11702
|
-
var
|
|
11702
|
+
var import_records23 = require("@ai-matrx/records");
|
|
11703
11703
|
var import_react68 = require("@ai-matrx/records/react");
|
|
11704
11704
|
|
|
11705
11705
|
// src/AccentSwatches.tsx
|
|
11706
|
-
var
|
|
11706
|
+
var import_records22 = require("@ai-matrx/records");
|
|
11707
11707
|
var import_design_system40 = require("@ai-matrx/design-system");
|
|
11708
11708
|
var import_data_table4 = require("@ai-matrx/design-system/data-table");
|
|
11709
11709
|
var import_jsx_runtime45 = require("react/jsx-runtime");
|
|
11710
|
-
function AccentSwatches({ value, onChange, options =
|
|
11710
|
+
function AccentSwatches({ value, onChange, options = import_records22.PORTAL_ACCENTS, noneLabel = "App color" }) {
|
|
11711
11711
|
return /* @__PURE__ */ (0, import_jsx_runtime45.jsxs)("div", { className: "flex flex-wrap gap-1.5", role: "radiogroup", "aria-label": "Color", children: [
|
|
11712
11712
|
/* @__PURE__ */ (0, import_jsx_runtime45.jsx)(
|
|
11713
11713
|
"button",
|
|
@@ -11831,7 +11831,7 @@ var DOES_WORDS = {
|
|
|
11831
11831
|
};
|
|
11832
11832
|
function buttonUrlInWords(url, fields) {
|
|
11833
11833
|
let out = url;
|
|
11834
|
-
for (const id of (0,
|
|
11834
|
+
for (const id of (0, import_records23.buttonUrlPlaceholders)(url)) {
|
|
11835
11835
|
const f = fields.find((x) => x.id === id || x.key === id);
|
|
11836
11836
|
if (f) out = out.split(`{{${id}}}`).join(`{${fieldName(f)}}`);
|
|
11837
11837
|
}
|
|
@@ -11926,7 +11926,7 @@ function ButtonSettingsEditor({
|
|
|
11926
11926
|
}
|
|
11927
11927
|
) : null
|
|
11928
11928
|
] }),
|
|
11929
|
-
value.url && (0,
|
|
11929
|
+
value.url && (0, import_records23.buttonUrlPlaceholders)(value.url).length > 0 ? /* @__PURE__ */ (0, import_jsx_runtime47.jsx)("p", { className: "truncate text-[11px] text-muted-foreground", "data-records-button-url-words": "", children: buttonUrlInWords(value.url, fields) }) : null
|
|
11930
11930
|
] }) : null,
|
|
11931
11931
|
value.do === "add_row" ? /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(AddRowSettings, { value, onChange, tableId, fields }) : null,
|
|
11932
11932
|
value.do === "run_action" ? !tableId ? /* @__PURE__ */ (0, import_jsx_runtime47.jsx)("p", { className: "text-xs text-muted-foreground", children: "Row actions belong to a table" }) : actionsRefused ? /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(RefusalLine, { error: actionsRefused }) : /* @__PURE__ */ (0, import_jsx_runtime47.jsxs)("div", { className: "flex flex-col gap-2", "data-records-button-action": "", children: [
|
|
@@ -12033,11 +12033,11 @@ function NewRowAction({
|
|
|
12033
12033
|
}
|
|
12034
12034
|
|
|
12035
12035
|
// src/FieldEditor.tsx
|
|
12036
|
-
var
|
|
12036
|
+
var import_records26 = require("@ai-matrx/records");
|
|
12037
12037
|
|
|
12038
12038
|
// src/RecordTypes.tsx
|
|
12039
12039
|
var import_react69 = require("react");
|
|
12040
|
-
var
|
|
12040
|
+
var import_records24 = require("@ai-matrx/records");
|
|
12041
12041
|
var import_react70 = require("@ai-matrx/records/react");
|
|
12042
12042
|
var import_design_system43 = require("@ai-matrx/design-system");
|
|
12043
12043
|
|
|
@@ -12072,7 +12072,7 @@ function useTypeChoices(typeField) {
|
|
|
12072
12072
|
}
|
|
12073
12073
|
let live = true;
|
|
12074
12074
|
void client.fieldOptions({ field_id: id }).then((got) => {
|
|
12075
|
-
if (live && got.ok) setChoices((got.data ?? []).map((o) => ({ key: (0,
|
|
12075
|
+
if (live && got.ok) setChoices((got.data ?? []).map((o) => ({ key: (0, import_records24.optionKey)(o), label: (0, import_records24.optionLabel)(o) })));
|
|
12076
12076
|
});
|
|
12077
12077
|
return () => {
|
|
12078
12078
|
live = false;
|
|
@@ -12087,7 +12087,7 @@ function AppliesToTypes({
|
|
|
12087
12087
|
}) {
|
|
12088
12088
|
const choices = useTypeChoices(typeField);
|
|
12089
12089
|
if (!typeField || choices.length === 0) return null;
|
|
12090
|
-
const has = (key, label) => value.some((v) => (0,
|
|
12090
|
+
const has = (key, label) => value.some((v) => (0, import_records24.fieldAppliesToType)({ applies_to_types: [v] }, key) || (0, import_records24.fieldAppliesToType)({ applies_to_types: [v] }, label));
|
|
12091
12091
|
return /* @__PURE__ */ (0, import_jsx_runtime48.jsxs)("div", { className: "flex flex-col gap-1", "data-records-field-applies-to": "", children: [
|
|
12092
12092
|
/* @__PURE__ */ (0, import_jsx_runtime48.jsx)("span", { className: "text-muted-foreground", children: "Applies to" }),
|
|
12093
12093
|
/* @__PURE__ */ (0, import_jsx_runtime48.jsx)("div", { className: "flex flex-wrap items-center gap-x-4 gap-y-1", children: choices.map((choice) => /* @__PURE__ */ (0, import_jsx_runtime48.jsxs)("label", { className: "flex items-center gap-1.5", children: [
|
|
@@ -12098,7 +12098,7 @@ function AppliesToTypes({
|
|
|
12098
12098
|
"aria-label": `Applies to ${choice.label}`,
|
|
12099
12099
|
"data-records-field-applies-to-type": choice.key,
|
|
12100
12100
|
onCheckedChange: (on) => {
|
|
12101
|
-
const rest = value.filter((v) => !((0,
|
|
12101
|
+
const rest = value.filter((v) => !((0, import_records24.fieldAppliesToType)({ applies_to_types: [v] }, choice.key) || (0, import_records24.fieldAppliesToType)({ applies_to_types: [v] }, choice.label)));
|
|
12102
12102
|
onValue(on === true ? [...rest, choice.key] : rest);
|
|
12103
12103
|
}
|
|
12104
12104
|
}
|
|
@@ -12111,8 +12111,8 @@ function AppliesToTypes({
|
|
|
12111
12111
|
// src/FieldEditor.tsx
|
|
12112
12112
|
var import_jsx_runtime49 = require("react/jsx-runtime");
|
|
12113
12113
|
var RULE_KINDS = FIELD_RULE_KIND_VALUES.map((kind) => ({ kind, label: FIELD_RULE_KIND_LABEL[kind] }));
|
|
12114
|
-
var SENSITIVITIES =
|
|
12115
|
-
var AGENT_VISIBILITY =
|
|
12114
|
+
var SENSITIVITIES = import_records26.FIELD_SENSITIVITIES.map((value) => ({ value, label: FIELD_SENSITIVITY_LABEL[value] }));
|
|
12115
|
+
var AGENT_VISIBILITY = import_records26.CONTEXT_POLICIES.map((value) => ({ value, label: CONTEXT_POLICY_LABEL[value] }));
|
|
12116
12116
|
var ROLLUP_OPERATIONS = ROLLUP_AGG_VALUES.map((value) => ({
|
|
12117
12117
|
value,
|
|
12118
12118
|
label: ROLLUP_AGG_LABEL[value]
|
|
@@ -12195,7 +12195,7 @@ function FieldEditor(props) {
|
|
|
12195
12195
|
const onEntity = entityToken !== null;
|
|
12196
12196
|
const tableId = props.tableId ?? "";
|
|
12197
12197
|
const table = (0, import_react72.useTable)(onEntity ? null : tableId);
|
|
12198
|
-
const tableFields = (0, import_react72.useFields)(onEntity ? null : tableId,
|
|
12198
|
+
const tableFields = (0, import_react72.useFields)(onEntity ? null : tableId, import_records26.EVERY_RECORD_TYPE);
|
|
12199
12199
|
const entityFields = (0, import_react72.useEntityFields)(entityToken);
|
|
12200
12200
|
const fields = onEntity ? entityFields : tableFields;
|
|
12201
12201
|
const tableRights2 = useTableRights(onEntity ? null : table.data);
|
|
@@ -12216,27 +12216,27 @@ function FieldEditor(props) {
|
|
|
12216
12216
|
const [label, setLabel] = (0, import_react71.useState)(field?.label ?? (copyOf ? `${copyOf.label} (1)` : startAs?.label ?? ""));
|
|
12217
12217
|
const [type, setType] = (0, import_react71.useState)(() => startAs ? startAs.type : startingType(start));
|
|
12218
12218
|
const [required, setRequired] = (0, import_react71.useState)(start?.required ?? false);
|
|
12219
|
-
const [appliesTo, setAppliesTo] = (0, import_react71.useState)(() => (0,
|
|
12219
|
+
const [appliesTo, setAppliesTo] = (0, import_react71.useState)(() => (0, import_records26.typesOfField)(start ?? { applies_to_types: [] }));
|
|
12220
12220
|
const [multi, setMulti] = (0, import_react71.useState)(start?.multi ?? false);
|
|
12221
12221
|
const [dated, setDated] = (0, import_react71.useState)(start?.dated ?? false);
|
|
12222
12222
|
const [sensitivity, setSensitivity] = (0, import_react71.useState)(String(start?.sensitivity ?? "internal"));
|
|
12223
12223
|
const [contextPolicy, setContextPolicy] = (0, import_react71.useState)(String(start?.context_policy ?? "include"));
|
|
12224
12224
|
const [rules, setRules] = (0, import_react71.useState)(start?.rules ?? []);
|
|
12225
12225
|
const [startsWith, setStartsWith] = (0, import_react71.useState)(start?.default ?? null);
|
|
12226
|
-
const [ratingMax, setRatingMax] = (0, import_react71.useState)(() => start ? (0,
|
|
12226
|
+
const [ratingMax, setRatingMax] = (0, import_react71.useState)(() => start ? (0, import_records26.ratingMaxOf)(start) : 5);
|
|
12227
12227
|
const savedRules = (0, import_react71.useMemo)(
|
|
12228
|
-
() => field ? type === "rating" ? (0,
|
|
12228
|
+
() => field ? type === "rating" ? (0, import_records26.rulesWithTopStar)(field.rules ?? [], (0, import_records26.ratingMaxOf)(field)) : field.rules ?? [] : [],
|
|
12229
12229
|
[field, type]
|
|
12230
12230
|
);
|
|
12231
|
-
const editedRules = (0, import_react71.useMemo)(() => type === "rating" ? (0,
|
|
12231
|
+
const editedRules = (0, import_react71.useMemo)(() => type === "rating" ? (0, import_records26.rulesWithTopStar)(rules, ratingMax) : rules, [type, rules, ratingMax]);
|
|
12232
12232
|
const [statusGroups, setStatusGroups] = (0, import_react71.useState)({});
|
|
12233
12233
|
const [statusKeys, setStatusKeys] = (0, import_react71.useState)({});
|
|
12234
12234
|
const [symbology, setSymbology] = (0, import_react71.useState)(String(start?.config?.["symbology"] ?? ""));
|
|
12235
12235
|
const descriptionStart = String(start?.config?.["description"] ?? "");
|
|
12236
12236
|
const [description, setDescription] = (0, import_react71.useState)(descriptionStart);
|
|
12237
|
-
const buttonStart = (0, import_react71.useMemo)(() => (0,
|
|
12237
|
+
const buttonStart = (0, import_react71.useMemo)(() => (0, import_records25.buttonOf)(start) ?? { label: "" }, [start]);
|
|
12238
12238
|
const [buttonSettings, setButtonSettings] = (0, import_react71.useState)(buttonStart);
|
|
12239
|
-
const prefixStart = (0,
|
|
12239
|
+
const prefixStart = (0, import_records25.autonumberPrefixOf)(start);
|
|
12240
12240
|
const [numberPrefix, setNumberPrefix] = (0, import_react71.useState)(prefixStart);
|
|
12241
12241
|
const dependencyStart = start?.config?.["dependency"] === true;
|
|
12242
12242
|
const watchStart = (0, import_react71.useMemo)(() => watchedFieldsOf(start), [start]);
|
|
@@ -12295,7 +12295,7 @@ function FieldEditor(props) {
|
|
|
12295
12295
|
if (!field || type !== "status") return;
|
|
12296
12296
|
let live = true;
|
|
12297
12297
|
void client.fieldOptions({ field_id: field.id }).then((got) => {
|
|
12298
|
-
if (live && got.ok) setStatusKeys(Object.fromEntries((got.data ?? []).map((o) => [String(o.id), (0,
|
|
12298
|
+
if (live && got.ok) setStatusKeys(Object.fromEntries((got.data ?? []).map((o) => [String(o.id), (0, import_records26.optionKey)(o)])));
|
|
12299
12299
|
});
|
|
12300
12300
|
return () => {
|
|
12301
12301
|
live = false;
|
|
@@ -12407,7 +12407,7 @@ function FieldEditor(props) {
|
|
|
12407
12407
|
const typeKey = onEntity ? null : table.data?.type_field ?? null;
|
|
12408
12408
|
const typeField = typeKey ? (fields.data ?? []).find((f) => f.key === typeKey) ?? null : null;
|
|
12409
12409
|
const offersAppliesTo = Boolean(typeField) && !isTitle && field?.key !== typeKey;
|
|
12410
|
-
const appliesToChanged = JSON.stringify(appliesTo) !== JSON.stringify((0,
|
|
12410
|
+
const appliesToChanged = JSON.stringify(appliesTo) !== JSON.stringify((0, import_records26.typesOfField)(field ?? { applies_to_types: [] }));
|
|
12411
12411
|
const offersMany = multiApplies(type) && !isTitle;
|
|
12412
12412
|
if (!mayShape) {
|
|
12413
12413
|
if (onEntity && entityRights.loading) return null;
|
|
@@ -12423,7 +12423,7 @@ function FieldEditor(props) {
|
|
|
12423
12423
|
const nameTaken = columnNameTakenBy(label, others.map(fieldName));
|
|
12424
12424
|
const nameLine = nameTaken ? columnNameTakenLine(nameTaken, noun) : columnNameProblemLine(label, noun);
|
|
12425
12425
|
const listsChoices = type === "select" || type === "multi_select" || type === "status";
|
|
12426
|
-
const buttonMissing = type === "button" && buttonSettings.do ? (0,
|
|
12426
|
+
const buttonMissing = type === "button" && buttonSettings.do ? (0, import_records25.buttonNeeds)(buttonSettings) : null;
|
|
12427
12427
|
const missing = buttonMissing ?? (editing ? formulaMissing ?? (listsChoices ? whatTheChoiceListIsMissing(choiceList) : null) : formulaMissing ?? (listsChoices ? whatTheChoiceListIsMissing(newChoices) : null) ?? (type === "formula" && formulaWritten ? null : whatIsMissing(
|
|
12428
12428
|
type === "count" ? { type: "rollup", label, options, via, pick, agg: "count", of, relations: totalSources, formulaFields, relationTarget, allowedTypes, noun } : { type, label, options, via, pick, agg, of, relations: sourcesFor(type), formulaFields, relationTarget, allowedTypes, noun }
|
|
12429
12429
|
)));
|
|
@@ -12466,7 +12466,7 @@ function FieldEditor(props) {
|
|
|
12466
12466
|
...statusGroupsChanged ? { status_groups: statusGroupsSent } : {},
|
|
12467
12467
|
// V11 #4/#10: a rating's top star goes as `max`, the word custom.field_update now takes the way
|
|
12468
12468
|
// custom.field_declare does; the store writes the max Rule and sets aside any score above it.
|
|
12469
|
-
...type === "rating" && ratingMax !== (0,
|
|
12469
|
+
...type === "rating" && ratingMax !== (0, import_records26.ratingMaxOf)(field) ? { max: ratingMax } : {},
|
|
12470
12470
|
...type === "barcode" && symbology !== String(field.config?.["symbology"] ?? "") ? { symbology: symbology === "" ? null : symbology } : {},
|
|
12471
12471
|
...type === "button" && JSON.stringify(buttonSettings) !== JSON.stringify(buttonStart) ? { button: buttonSettings } : {},
|
|
12472
12472
|
...field.type === "relation" && dependency !== dependencyStart ? { dependency } : {},
|
|
@@ -13642,7 +13642,7 @@ function waitingRunsOf(pressed) {
|
|
|
13642
13642
|
var stop2 = (event) => event.stopPropagation();
|
|
13643
13643
|
function ButtonValue({ field, recordId, inCell, beforeSave }) {
|
|
13644
13644
|
const client = (0, import_react74.useOptionalRecordsClient)();
|
|
13645
|
-
const b = (0,
|
|
13645
|
+
const b = (0, import_records27.buttonOf)(field);
|
|
13646
13646
|
const [busy, setBusy] = (0, import_react73.useState)(false);
|
|
13647
13647
|
const [said2, setSaid] = (0, import_react73.useState)(null);
|
|
13648
13648
|
const [settingUp, setSettingUp] = (0, import_react73.useState)(false);
|
|
@@ -13660,7 +13660,7 @@ function ButtonValue({ field, recordId, inCell, beforeSave }) {
|
|
|
13660
13660
|
/* @__PURE__ */ (0, import_jsx_runtime50.jsx)("span", { id: `${field.key}-before-save`, className: "whitespace-nowrap text-xs text-muted-foreground", children: "Save the record first" })
|
|
13661
13661
|
] });
|
|
13662
13662
|
}
|
|
13663
|
-
const needs = (0,
|
|
13663
|
+
const needs = (0, import_records27.buttonNeeds)(b);
|
|
13664
13664
|
const tableId = field.entity_definition_id;
|
|
13665
13665
|
const press = async () => {
|
|
13666
13666
|
if (!client || !recordId) return setSaid({ kind: "public" });
|
|
@@ -14008,7 +14008,7 @@ function formatControl(args) {
|
|
|
14008
14008
|
// src/typedDateHelper.tsx
|
|
14009
14009
|
var import_react77 = require("react");
|
|
14010
14010
|
var import_design_system47 = require("@ai-matrx/design-system");
|
|
14011
|
-
var
|
|
14011
|
+
var import_records28 = require("@ai-matrx/records");
|
|
14012
14012
|
var import_jsx_runtime53 = require("react/jsx-runtime");
|
|
14013
14013
|
var WEEK = ["Su", "Mo", "Tu", "We", "Th", "Fr", "Sa"];
|
|
14014
14014
|
var MONTHS = ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"];
|
|
@@ -14017,24 +14017,24 @@ function pad(n) {
|
|
|
14017
14017
|
}
|
|
14018
14018
|
function readBox(text, kind) {
|
|
14019
14019
|
if (kind === "time") {
|
|
14020
|
-
const t = (0,
|
|
14020
|
+
const t = (0, import_records28.readTypedTime)(text);
|
|
14021
14021
|
if (!t.ok) return { day: null, time: null };
|
|
14022
14022
|
const [h, m] = t.value.split(":").map(Number);
|
|
14023
14023
|
return { day: null, time: { h, m } };
|
|
14024
14024
|
}
|
|
14025
|
-
const read = (0,
|
|
14025
|
+
const read = (0, import_records28.readTypedDate)(text, { withTime: kind === "datetime" });
|
|
14026
14026
|
if (!read.ok) return { day: null, time: null };
|
|
14027
14027
|
if (kind === "datetime" && read.instant) {
|
|
14028
|
-
const wall = (0,
|
|
14028
|
+
const wall = (0, import_records28.wallPartsInZone)(new Date(read.instant));
|
|
14029
14029
|
return { day: read.day, time: { h: wall.hour, m: wall.minute } };
|
|
14030
14030
|
}
|
|
14031
14031
|
return { day: read.day, time: null };
|
|
14032
14032
|
}
|
|
14033
14033
|
function wordsFor2(kind, day, time) {
|
|
14034
|
-
if (kind === "time") return time ? (0,
|
|
14034
|
+
if (kind === "time") return time ? (0, import_records28.typedTimeText)(time.h, time.m) : "";
|
|
14035
14035
|
if (!day) return "";
|
|
14036
|
-
const dayText = (0,
|
|
14037
|
-
return kind === "datetime" && time ? `${dayText} ${(0,
|
|
14036
|
+
const dayText = (0, import_records28.typedDateText)(day);
|
|
14037
|
+
return kind === "datetime" && time ? `${dayText} ${(0, import_records28.typedTimeText)(time.h, time.m)}` : dayText;
|
|
14038
14038
|
}
|
|
14039
14039
|
var keepFocus = { onMouseDown: (e) => e.preventDefault(), tabIndex: -1 };
|
|
14040
14040
|
function CalendarGlyph() {
|
|
@@ -14156,7 +14156,7 @@ function TypedDateHelper({
|
|
|
14156
14156
|
held.time && held.time.h === t.h && held.time.m === t.m ? "bg-primary text-primary-foreground" : ""
|
|
14157
14157
|
),
|
|
14158
14158
|
onClick: () => pickTime(t),
|
|
14159
|
-
children: (0,
|
|
14159
|
+
children: (0, import_records28.typedTimeText)(t.h, t.m)
|
|
14160
14160
|
},
|
|
14161
14161
|
`${t.h}:${t.m}`
|
|
14162
14162
|
)) })
|
|
@@ -14227,21 +14227,21 @@ function judgeTyped(field, text, choices, nudge) {
|
|
|
14227
14227
|
const format = formatForField(field);
|
|
14228
14228
|
if (trimmed === "") return { value: null };
|
|
14229
14229
|
if (format && format.id === "time") {
|
|
14230
|
-
const read2 = (0,
|
|
14230
|
+
const read2 = (0, import_records29.readTypedTime)(trimmed);
|
|
14231
14231
|
return read2.ok ? { value: read2.value } : { refusal: SHORT_REFUSAL.time, why: `${fieldName(field)} holds a time of day, and ${read2.why}` };
|
|
14232
14232
|
}
|
|
14233
14233
|
if (kind === "select" || kind === "multi_select") {
|
|
14234
14234
|
if (!choices || nudge === null) return null;
|
|
14235
14235
|
const several = field.multi || kind === "multi_select";
|
|
14236
14236
|
const words = several ? trimmed.split(/\s*[,;\n]\s*/).filter(Boolean) : [trimmed];
|
|
14237
|
-
const allowOther = (0,
|
|
14237
|
+
const allowOther = (0, import_records29.allowsOtherValues)(field);
|
|
14238
14238
|
const parts = [];
|
|
14239
14239
|
const add = [];
|
|
14240
14240
|
const ask = [];
|
|
14241
14241
|
const notChoices = [];
|
|
14242
14242
|
let keepOffered = allowOther;
|
|
14243
14243
|
for (const word of words) {
|
|
14244
|
-
const decided = (0,
|
|
14244
|
+
const decided = (0, import_records29.decideTypedChoice)({ words: word, options: choices, allowOther, nudge });
|
|
14245
14245
|
if (decided.decision === "empty") continue;
|
|
14246
14246
|
if (decided.decision === "chosen") parts.push(decided.key);
|
|
14247
14247
|
else {
|
|
@@ -14274,7 +14274,7 @@ function judgeTyped(field, text, choices, nudge) {
|
|
|
14274
14274
|
return usual && digits.length >= 7 && digits.length <= 20 ? { value: trimmed } : { refusal: SHORT_REFUSAL.phone };
|
|
14275
14275
|
}
|
|
14276
14276
|
const showsAsPercent = Boolean(format && (format.id === "percent" || format.id === "progress"));
|
|
14277
|
-
const read = (0,
|
|
14277
|
+
const read = (0, import_records29.coerceTypedAnswer)(field, text, { label: fieldName(field), showsAsPercent });
|
|
14278
14278
|
if ("refusal" in read) {
|
|
14279
14279
|
if (kind === "email" || kind === "url") return { refusal: SHORT_REFUSAL[kind] };
|
|
14280
14280
|
const short = kind === "datetime" ? SHORT_REFUSAL.date : kind === "number" || kind === "currency" || kind === "percent" || showsAsPercent ? SHORT_REFUSAL.number : read.refusal.length <= 32 ? read.refusal : SHORT_REFUSAL.value;
|
|
@@ -14295,12 +14295,12 @@ function openingText(field, value) {
|
|
|
14295
14295
|
if (value === null || value === void 0 || value === "") return "";
|
|
14296
14296
|
const helper = dateHelperKind(field, value);
|
|
14297
14297
|
if (helper === "time") {
|
|
14298
|
-
const read = (0,
|
|
14298
|
+
const read = (0, import_records29.readTypedTime)(String(value));
|
|
14299
14299
|
if (!read.ok) return String(value);
|
|
14300
14300
|
const [h, m] = read.value.split(":").map(Number);
|
|
14301
|
-
return (0,
|
|
14301
|
+
return (0, import_records29.typedTimeText)(h, m);
|
|
14302
14302
|
}
|
|
14303
|
-
if (helper) return (0,
|
|
14303
|
+
if (helper) return (0, import_records29.typedDateText)(value, { withTime: helper === "datetime" });
|
|
14304
14304
|
const format = formatForField(field);
|
|
14305
14305
|
return format ? typedText(format, value) : String(value);
|
|
14306
14306
|
}
|
|
@@ -14389,7 +14389,7 @@ function TypedTextControl({ field, value, onChange, disabled, id, onCommit, onCa
|
|
|
14389
14389
|
" ",
|
|
14390
14390
|
needsChoices ? String(
|
|
14391
14391
|
(Array.isArray(withoutAddition(judged.value).value) ? withoutAddition(judged.value).value : [withoutAddition(judged.value).value]).map((k) => {
|
|
14392
|
-
const option = choices?.find((o) => (0,
|
|
14392
|
+
const option = choices?.find((o) => (0, import_records29.optionKey)(o) === k);
|
|
14393
14393
|
return option ? recordName(option.data, null, String(k)) : String(k);
|
|
14394
14394
|
}).join(", ")
|
|
14395
14395
|
) : (() => {
|
|
@@ -14410,7 +14410,7 @@ function FieldControl({ field, value, onChange, disabled, id, autoOpen, onClose,
|
|
|
14410
14410
|
const ownDetails = (0, import_react79.useOptionalRecordsClient)() === null;
|
|
14411
14411
|
if (isTypedDraft(value)) return /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(TypedTextControl, { field, value, onChange, disabled, id: inputId, onCommit, onCancel });
|
|
14412
14412
|
if (isSignatureField(field)) return /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(SignaturePad, { id: inputId, value, onChange, disabled });
|
|
14413
|
-
if ((0,
|
|
14413
|
+
if ((0, import_records29.isButtonField)(field)) return /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(ButtonValue, { field, recordId: recordId ?? null, beforeSave: !recordId });
|
|
14414
14414
|
const newerControl = newerKindControl({ field, value, onChange, disabled, id: inputId });
|
|
14415
14415
|
if (newerControl !== void 0) return newerControl;
|
|
14416
14416
|
const format = formatForField(field);
|
|
@@ -14580,7 +14580,7 @@ function TypedWordsControl({ field, value, onChange, disabled, id }) {
|
|
|
14580
14580
|
function typedDatePlaceholder(helper) {
|
|
14581
14581
|
const time = "h:mm AM";
|
|
14582
14582
|
if (helper === "time") return time;
|
|
14583
|
-
const pattern = (0,
|
|
14583
|
+
const pattern = (0, import_records29.typedDateText)("2026-11-22").replace("2026", "YYYY").replace("11", "MM").replace("22", "DD");
|
|
14584
14584
|
return helper === "datetime" ? `${pattern} ${time}` : pattern;
|
|
14585
14585
|
}
|
|
14586
14586
|
function CheckboxControl({ field, value, onChange, disabled, id }) {
|
|
@@ -14750,15 +14750,15 @@ function OptionControl({ field, value, onChange, disabled, id, autoOpen, onClose
|
|
|
14750
14750
|
ChoiceAnswer,
|
|
14751
14751
|
{
|
|
14752
14752
|
field,
|
|
14753
|
-
choices: options.map((option) => ({ key: (0,
|
|
14753
|
+
choices: options.map((option) => ({ key: (0, import_records29.optionKey)(option), label: titled(option) })),
|
|
14754
14754
|
value,
|
|
14755
14755
|
onChange,
|
|
14756
14756
|
disabled,
|
|
14757
14757
|
id,
|
|
14758
14758
|
onChosen,
|
|
14759
14759
|
isChosen: (choice, v) => {
|
|
14760
|
-
const option = options.find((o) => (0,
|
|
14761
|
-
return option ? (0,
|
|
14760
|
+
const option = options.find((o) => (0, import_records29.optionKey)(o) === choice.key);
|
|
14761
|
+
return option ? (0, import_records29.isTheChosen)(option, v) : false;
|
|
14762
14762
|
}
|
|
14763
14763
|
}
|
|
14764
14764
|
);
|
|
@@ -14791,7 +14791,7 @@ function OptionControl({ field, value, onChange, disabled, id, autoOpen, onClose
|
|
|
14791
14791
|
onCancel,
|
|
14792
14792
|
initialSearch,
|
|
14793
14793
|
addsChoices,
|
|
14794
|
-
allowOther: (0,
|
|
14794
|
+
allowOther: (0, import_records29.allowsOtherValues)(field),
|
|
14795
14795
|
onChoicesChanged: () => {
|
|
14796
14796
|
if (client) (0, askOnce_exports.forgetAsked)(client, `field_options:${field.id}`);
|
|
14797
14797
|
setReread((n) => n + 1);
|
|
@@ -14805,19 +14805,19 @@ function OptionControl({ field, value, onChange, disabled, id, autoOpen, onClose
|
|
|
14805
14805
|
}
|
|
14806
14806
|
const titleOf = (option) => recordName(option.data, null, "Unnamed choice");
|
|
14807
14807
|
if (field.multi) {
|
|
14808
|
-
const chosen = options.filter((option) => (0,
|
|
14809
|
-
const picked = new Set(chosen.map((option) => (0,
|
|
14808
|
+
const chosen = options.filter((option) => (0, import_records29.choiceValuesOf)(value).some((v) => (0, import_records29.isTheChosen)(option, v)));
|
|
14809
|
+
const picked = new Set(chosen.map((option) => (0, import_records29.optionKey)(option)));
|
|
14810
14810
|
const toggles = /* @__PURE__ */ (0, import_jsx_runtime54.jsx)("div", { id: autoOpen ? void 0 : id, className: "flex flex-wrap gap-1", children: options.map((option) => /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(
|
|
14811
14811
|
import_design_system48.Button,
|
|
14812
14812
|
{
|
|
14813
14813
|
type: "button",
|
|
14814
14814
|
size: "sm",
|
|
14815
|
-
variant: picked.has((0,
|
|
14815
|
+
variant: picked.has((0, import_records29.optionKey)(option)) ? "default" : "outline",
|
|
14816
14816
|
disabled,
|
|
14817
14817
|
onClick: () => {
|
|
14818
14818
|
const next = new Set(picked);
|
|
14819
|
-
if (next.has((0,
|
|
14820
|
-
else next.add((0,
|
|
14819
|
+
if (next.has((0, import_records29.optionKey)(option))) next.delete((0, import_records29.optionKey)(option));
|
|
14820
|
+
else next.add((0, import_records29.optionKey)(option));
|
|
14821
14821
|
onChange(next.size === 0 ? null : [...next]);
|
|
14822
14822
|
},
|
|
14823
14823
|
children: titleOf(option)
|
|
@@ -14839,11 +14839,11 @@ function OptionControl({ field, value, onChange, disabled, id, autoOpen, onClose
|
|
|
14839
14839
|
}
|
|
14840
14840
|
);
|
|
14841
14841
|
}
|
|
14842
|
-
const current = options.find((option) => (0,
|
|
14842
|
+
const current = options.find((option) => (0, import_records29.isTheChosen)(option, value));
|
|
14843
14843
|
return /* @__PURE__ */ (0, import_jsx_runtime54.jsxs)(
|
|
14844
14844
|
import_design_system48.Select,
|
|
14845
14845
|
{
|
|
14846
|
-
value: current ? (0,
|
|
14846
|
+
value: current ? (0, import_records29.optionKey)(current) : "",
|
|
14847
14847
|
disabled: disabled ?? false,
|
|
14848
14848
|
onValueChange: (next) => onChange(next === "" ? null : next),
|
|
14849
14849
|
...autoOpen ? {
|
|
@@ -14855,7 +14855,7 @@ function OptionControl({ field, value, onChange, disabled, id, autoOpen, onClose
|
|
|
14855
14855
|
} : {},
|
|
14856
14856
|
children: [
|
|
14857
14857
|
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)(import_design_system48.SelectTrigger, { id, size: "sm", children: /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(import_design_system48.SelectValue, { placeholder: "Choose" }) }),
|
|
14858
|
-
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)(import_design_system48.SelectContent, { children: options.map((option) => /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(import_design_system48.SelectItem, { value: (0,
|
|
14858
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)(import_design_system48.SelectContent, { children: options.map((option) => /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(import_design_system48.SelectItem, { value: (0, import_records29.optionKey)(option), children: titleOf(option) }, option.id)) })
|
|
14859
14859
|
]
|
|
14860
14860
|
}
|
|
14861
14861
|
);
|
|
@@ -14889,23 +14889,23 @@ function OpenChoicePicker({
|
|
|
14889
14889
|
const [addRefused, setAddRefused] = (0, import_react78.useState)(null);
|
|
14890
14890
|
const titleOf = (option) => recordName(option.data, null, "Unnamed choice");
|
|
14891
14891
|
const held = withoutAddition(value);
|
|
14892
|
-
const current = (0,
|
|
14892
|
+
const current = (0, import_records29.choiceValuesOf)(held.value);
|
|
14893
14893
|
const pickedWords = current.map((v) => {
|
|
14894
|
-
const option = options.find((o) => (0,
|
|
14894
|
+
const option = options.find((o) => (0, import_records29.isTheChosen)(o, v));
|
|
14895
14895
|
return option ? titleOf(option) : String(v);
|
|
14896
14896
|
});
|
|
14897
|
-
const chipOf = (option, word) => option ? choiceChipLookOf(field, (0,
|
|
14897
|
+
const chipOf = (option, word) => option ? choiceChipLookOf(field, (0, import_records29.optionKey)(option), titleOf(option)) : choiceChipLookOf(field, word);
|
|
14898
14898
|
const q = search.trim();
|
|
14899
|
-
const visible = (0,
|
|
14900
|
-
const decided = (0,
|
|
14899
|
+
const visible = (0, import_records29.rankTypedMatches)(options, q, titleOf);
|
|
14900
|
+
const decided = (0, import_records29.decideTypedChoice)({ words: q, options, allowOther, nudge: nudge ?? "ask" });
|
|
14901
14901
|
const choose = (word, addingIt = false) => {
|
|
14902
14902
|
const pending = held.add.filter((w) => w.toLowerCase() !== word.toLowerCase());
|
|
14903
14903
|
let next;
|
|
14904
14904
|
let add2 = [...pending];
|
|
14905
14905
|
if (field.multi) {
|
|
14906
14906
|
const existing = current.map((v) => {
|
|
14907
|
-
const option = options.find((o) => (0,
|
|
14908
|
-
return option ? (0,
|
|
14907
|
+
const option = options.find((o) => (0, import_records29.isTheChosen)(o, v));
|
|
14908
|
+
return option ? (0, import_records29.optionKey)(option) : String(v);
|
|
14909
14909
|
});
|
|
14910
14910
|
const has = existing.some((v) => v.toLowerCase() === word.toLowerCase());
|
|
14911
14911
|
const list = has ? existing.filter((v) => v.toLowerCase() !== word.toLowerCase()) : [...existing, word];
|
|
@@ -14941,7 +14941,7 @@ function OpenChoicePicker({
|
|
|
14941
14941
|
const foot = null;
|
|
14942
14942
|
const add = offList && (decided.decision === "ask" || decided.decision === "add") ? { label: `Create \u201C${q}\u201D`, onAdd: addTyped, disabled: adding } : offList && decided.decision === "keep_as_typed" ? { label: `Use \u201C${q}\u201D`, onAdd: () => choose(q) } : null;
|
|
14943
14943
|
const listed = visible;
|
|
14944
|
-
const pickedOptions = current.map((v) => options.find((o) => (0,
|
|
14944
|
+
const pickedOptions = current.map((v) => options.find((o) => (0, import_records29.isTheChosen)(o, v)));
|
|
14945
14945
|
const cellChips = pickedWords.map((word, i) => {
|
|
14946
14946
|
const chip = chipOf(pickedOptions[i], word);
|
|
14947
14947
|
return /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(import_design_system48.Badge, { variant: "outline", className: (0, import_design_system48.cn)("text-[11px]", chip.className), "data-records-choice-chip": "", children: word }, word);
|
|
@@ -14953,7 +14953,7 @@ function OpenChoicePicker({
|
|
|
14953
14953
|
label: word,
|
|
14954
14954
|
chip: chipOf(option, word).className,
|
|
14955
14955
|
onRemove: () => {
|
|
14956
|
-
if (field.multi) choose(option ? (0,
|
|
14956
|
+
if (field.multi) choose(option ? (0, import_records29.optionKey)(option) : String(current[i]));
|
|
14957
14957
|
else onChange(null);
|
|
14958
14958
|
}
|
|
14959
14959
|
};
|
|
@@ -14984,11 +14984,11 @@ function OpenChoicePicker({
|
|
|
14984
14984
|
id: option.id,
|
|
14985
14985
|
label: titleOf(option),
|
|
14986
14986
|
chip: chipOf(option, titleOf(option)).className,
|
|
14987
|
-
picked: current.some((v) => (0,
|
|
14987
|
+
picked: current.some((v) => (0, import_records29.isTheChosen)(option, v))
|
|
14988
14988
|
})),
|
|
14989
14989
|
onPick: (optionId) => {
|
|
14990
14990
|
const option = options.find((o) => o.id === optionId);
|
|
14991
|
-
if (option) choose((0,
|
|
14991
|
+
if (option) choose((0, import_records29.optionKey)(option));
|
|
14992
14992
|
},
|
|
14993
14993
|
empty: q === "" ? /* @__PURE__ */ (0, import_jsx_runtime54.jsx)("p", { className: "p-2 text-xs text-muted-foreground", children: "No choices yet \u2014 type one to add it." }) : null,
|
|
14994
14994
|
add,
|
|
@@ -15044,7 +15044,7 @@ function ChoiceAnswer({
|
|
|
15044
15044
|
onChosen
|
|
15045
15045
|
}) {
|
|
15046
15046
|
const [search, setSearch] = (0, import_react78.useState)("");
|
|
15047
|
-
const held = field.multi ? (0,
|
|
15047
|
+
const held = field.multi ? (0, import_records29.choiceValuesOf)(value) : value === null || value === void 0 || value === "" ? [] : [value];
|
|
15048
15048
|
const on = (choice) => held.some((v) => isChosen ? isChosen(choice, v) : String(v) === choice.key || String(v) === choice.label);
|
|
15049
15049
|
const press = (choice) => {
|
|
15050
15050
|
if (!field.multi) {
|
|
@@ -15397,7 +15397,7 @@ function RecordPicker({ tableId, value, onChange, disabled }) {
|
|
|
15397
15397
|
|
|
15398
15398
|
// src/DataBindingPicker.tsx
|
|
15399
15399
|
var import_react84 = require("react");
|
|
15400
|
-
var
|
|
15400
|
+
var import_records30 = require("@ai-matrx/records");
|
|
15401
15401
|
var import_react85 = require("@ai-matrx/records/react");
|
|
15402
15402
|
var import_design_system50 = require("@ai-matrx/design-system");
|
|
15403
15403
|
init_names();
|
|
@@ -15432,7 +15432,7 @@ function isCompleteDataBinding(binding) {
|
|
|
15432
15432
|
}
|
|
15433
15433
|
function bindingPlaceholdersFor(field) {
|
|
15434
15434
|
const label = fieldName(field);
|
|
15435
|
-
if ((0,
|
|
15435
|
+
if ((0, import_records30.isEntityReferenceConfig)(field.config)) {
|
|
15436
15436
|
return [
|
|
15437
15437
|
{ token: `{${field.key}.name}`, label: `${label} \xB7 name` },
|
|
15438
15438
|
{ token: `{${field.key}.id}`, label: `${label} \xB7 id` }
|