@ai-matrx/records-ui 0.115.102 → 0.115.104
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 +22 -1
- package/dist/first-page.cjs +1 -1
- package/dist/first-page.cjs.map +1 -1
- package/dist/first-page.js +1 -1
- package/dist/first-page.js.map +1 -1
- package/dist/helpers.cjs +10 -11
- package/dist/helpers.cjs.map +1 -1
- package/dist/helpers.d.cts +9 -8
- package/dist/helpers.d.ts +9 -8
- package/dist/helpers.js +2 -2
- package/dist/helpers.js.map +1 -1
- package/dist/index.cjs +464 -430
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +10 -10
- package/dist/index.d.ts +10 -10
- package/dist/index.js +52 -18
- package/dist/index.js.map +1 -1
- package/dist/object-actions.cjs +6 -6
- package/dist/object-actions.cjs.map +1 -1
- package/dist/object-actions.d.cts +2 -1
- package/dist/object-actions.d.ts +2 -1
- package/dist/object-actions.js +2 -2
- package/dist/object-actions.js.map +1 -1
- package/dist/{objectActions-Ds2NA5Jn.d.cts → objectActions-CfzhrXHK.d.cts} +3 -2
- package/dist/{objectActions-Ds2NA5Jn.d.ts → objectActions-CfzhrXHK.d.ts} +3 -2
- package/dist/pickers.cjs +247 -213
- package/dist/pickers.cjs.map +1 -1
- package/dist/pickers.js +49 -15
- package/dist/pickers.js.map +1 -1
- package/package.json +6 -6
package/dist/pickers.cjs
CHANGED
|
@@ -62,7 +62,7 @@ function choiceWord(value) {
|
|
|
62
62
|
return String(value ?? "").trim().toLowerCase().replace(/[^a-z0-9]+/g, "_").replace(/^_+|_+$/g, "");
|
|
63
63
|
}
|
|
64
64
|
function statusGroupColor(field, value) {
|
|
65
|
-
if ((0,
|
|
65
|
+
if ((0, import_core.newerKindOf)(field) !== "status" || value === null || value === void 0 || value === "") return void 0;
|
|
66
66
|
const word = choiceWord(value);
|
|
67
67
|
if (word === "") return void 0;
|
|
68
68
|
const groups = (field.config ?? {})["status_groups"];
|
|
@@ -96,11 +96,11 @@ function choiceChipLookOf(field, ...words) {
|
|
|
96
96
|
}
|
|
97
97
|
return { className: import_table_style.NEUTRAL_CHIP_CLASS, color: null };
|
|
98
98
|
}
|
|
99
|
-
var
|
|
99
|
+
var import_core, import_table_style, STATUS_GROUP_COLOR, NEW_CHOICE_PALETTE;
|
|
100
100
|
var init_choiceLooks = __esm({
|
|
101
101
|
"src/choiceLooks.ts"() {
|
|
102
102
|
"use strict";
|
|
103
|
-
|
|
103
|
+
import_core = require("@ai-matrx/records/core");
|
|
104
104
|
import_table_style = require("@ai-matrx/design-system/data-table/table-style");
|
|
105
105
|
STATUS_GROUP_COLOR = { todo: "gray", in_progress: "blue", done: "green" };
|
|
106
106
|
NEW_CHOICE_PALETTE = ["blue", "green", "amber", "red", "violet", "teal", "slate"];
|
|
@@ -314,7 +314,7 @@ function sentenceFor(what, level) {
|
|
|
314
314
|
return `You are ${have} here, and it takes ${need} to ${doing[what]}. Ask somebody who is Admin on it to move you up.`;
|
|
315
315
|
}
|
|
316
316
|
function whatYouMayDo(level, known = true) {
|
|
317
|
-
const may = (what) => known && (0,
|
|
317
|
+
const may = (what) => known && (0, import_core2.atLeast)(level, NEEDS[what]);
|
|
318
318
|
return {
|
|
319
319
|
level: known ? level : null,
|
|
320
320
|
known,
|
|
@@ -343,11 +343,11 @@ function tableIsLocked(table) {
|
|
|
343
343
|
function lockedStructure(base) {
|
|
344
344
|
return { ...base, structure: false, why: (what) => what === "structure" ? DATABASE_LOCKED_REASON : base.why(what) };
|
|
345
345
|
}
|
|
346
|
-
var
|
|
346
|
+
var import_core2, LEVEL_WORD, NEEDS, NOT_YET, NOTHING_AT_ALL, NOT_ANSWERED_YET, KERNEL_REASON, DATABASE_LOCKED_REASON;
|
|
347
347
|
var init_rights = __esm({
|
|
348
348
|
"src/rights.ts"() {
|
|
349
349
|
"use strict";
|
|
350
|
-
|
|
350
|
+
import_core2 = require("@ai-matrx/records/core");
|
|
351
351
|
LEVEL_WORD = {
|
|
352
352
|
viewer: "Viewer",
|
|
353
353
|
commenter: "Commenter",
|
|
@@ -529,7 +529,7 @@ function RefusalNotice({
|
|
|
529
529
|
onKeepEditing,
|
|
530
530
|
onDiscard
|
|
531
531
|
}) {
|
|
532
|
-
const archivedOrg = (0,
|
|
532
|
+
const archivedOrg = (0, import_core3.archivedOrganizationId)(error);
|
|
533
533
|
if (archivedOrg) {
|
|
534
534
|
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(ArchivedOrganizationNotice, { organizationId: archivedOrg, error, className });
|
|
535
535
|
}
|
|
@@ -585,19 +585,19 @@ function RefusalLine({ error, className }) {
|
|
|
585
585
|
{
|
|
586
586
|
"data-refusal-line": "",
|
|
587
587
|
className: (0, import_design_system3.cn)("whitespace-normal break-words text-xs text-destructive [overflow-wrap:anywhere]", className),
|
|
588
|
-
message: (0,
|
|
588
|
+
message: (0, import_core3.archivedOrganizationId)(error) ? "This organization is archived. An owner can restore it." : refusalLineForAPerson(error),
|
|
589
589
|
error,
|
|
590
590
|
origin: "records-ui/RefusalLine",
|
|
591
591
|
...plain.forEngineers ? { "data-for-engineers": plain.forEngineers } : {}
|
|
592
592
|
}
|
|
593
593
|
);
|
|
594
594
|
}
|
|
595
|
-
var
|
|
595
|
+
var import_core3, import_design_system3, import_jsx_runtime4;
|
|
596
596
|
var init_Refusal = __esm({
|
|
597
597
|
"src/Refusal.tsx"() {
|
|
598
598
|
"use strict";
|
|
599
599
|
"use client";
|
|
600
|
-
|
|
600
|
+
import_core3 = require("@ai-matrx/records/core");
|
|
601
601
|
import_design_system3 = require("@ai-matrx/design-system");
|
|
602
602
|
init_ArchivedOrganizationNotice();
|
|
603
603
|
init_plainWords();
|
|
@@ -668,7 +668,7 @@ function declaredAsLook(kind) {
|
|
|
668
668
|
return kind in LOOK_KINDS && !storePublishesKind(kind);
|
|
669
669
|
}
|
|
670
670
|
function storePublishesKind(kind) {
|
|
671
|
-
return
|
|
671
|
+
return import_core4.DECLARABLE_FIELD_KINDS.some((row) => row.kind === kind);
|
|
672
672
|
}
|
|
673
673
|
function isSystemFieldKind(id) {
|
|
674
674
|
return SYSTEM_FIELD_KINDS.includes(id);
|
|
@@ -683,18 +683,18 @@ function isRelationFieldType(id) {
|
|
|
683
683
|
return id === "relation";
|
|
684
684
|
}
|
|
685
685
|
function isParityFieldType(id) {
|
|
686
|
-
return
|
|
686
|
+
return import_core4.PARITY_FIELD_TYPES.some((row) => row.parity_type === id);
|
|
687
687
|
}
|
|
688
|
-
var
|
|
688
|
+
var import_core4, LOOK_KINDS, STORE_PUBLISHES_ENTITY_REFERENCE, SYSTEM_FIELD_KINDS, FIELD_TYPE_CATALOGUE, GATED_KINDS, FIELD_TYPE_CHOICES, FIELD_TYPE_GROUPS, BY_ID, ADD_FIELD_SAVE_LABEL, EDIT_FIELD_SAVE_LABEL;
|
|
689
689
|
var init_fieldTypes = __esm({
|
|
690
690
|
"src/fieldTypes.ts"() {
|
|
691
691
|
"use strict";
|
|
692
|
-
|
|
692
|
+
import_core4 = require("@ai-matrx/records/core");
|
|
693
693
|
LOOK_KINDS = {
|
|
694
694
|
rating: { plain: "number", look: ({ ratingMax }) => ({ id: "rating", options: { ratingMax } }) },
|
|
695
695
|
time: { plain: "text", look: () => ({ id: "time" }) }
|
|
696
696
|
};
|
|
697
|
-
STORE_PUBLISHES_ENTITY_REFERENCE =
|
|
697
|
+
STORE_PUBLISHES_ENTITY_REFERENCE = import_core4.DECLARABLE_FIELD_KINDS.some(
|
|
698
698
|
(row) => row.kind === "entity_reference"
|
|
699
699
|
);
|
|
700
700
|
SYSTEM_FIELD_KINDS = ["autonumber", "created_time", "modified_time"];
|
|
@@ -739,7 +739,7 @@ var init_fieldTypes = __esm({
|
|
|
739
739
|
{ id: "created_by", group: "Worked out", label: "Created by", explanation: "Who made each record. Nobody types it." },
|
|
740
740
|
{ id: "modified_by", group: "Worked out", label: "Last changed by", explanation: "Who last changed each record. Nobody types it." }
|
|
741
741
|
];
|
|
742
|
-
GATED_KINDS = /* @__PURE__ */ new Set(["entity_reference", ...
|
|
742
|
+
GATED_KINDS = /* @__PURE__ */ new Set(["entity_reference", ...import_core4.NEWER_FIELD_KINDS]);
|
|
743
743
|
FIELD_TYPE_CHOICES = FIELD_TYPE_CATALOGUE.filter(
|
|
744
744
|
(c) => !GATED_KINDS.has(c.id) || storePublishesKind(c.id) || c.id in LOOK_KINDS
|
|
745
745
|
);
|
|
@@ -757,12 +757,12 @@ var init_fieldTypes = __esm({
|
|
|
757
757
|
|
|
758
758
|
// src/parity.ts
|
|
759
759
|
function editorKindFor(field) {
|
|
760
|
-
return (0,
|
|
760
|
+
return (0, import_core5.fieldKindFor)(field, KERNEL);
|
|
761
761
|
}
|
|
762
762
|
function pickableTypeOf(field) {
|
|
763
763
|
if (isSignatureField(field)) return "signature";
|
|
764
|
-
if ((0,
|
|
765
|
-
const newer = (0,
|
|
764
|
+
if ((0, import_core6.isButtonField)(field)) return "button";
|
|
765
|
+
const newer = (0, import_core5.newerKindOf)(field);
|
|
766
766
|
if (newer) return newer;
|
|
767
767
|
const look = displayFormatOf(field)?.id;
|
|
768
768
|
if (look === "rating" && field.type === "range") return "rating";
|
|
@@ -786,21 +786,21 @@ function fieldTypeLabel(field) {
|
|
|
786
786
|
};
|
|
787
787
|
return plain[kind] ?? (0, import_text_case.humanizeIdentifier)(kind);
|
|
788
788
|
}
|
|
789
|
-
var
|
|
789
|
+
var import_core5, import_core6, import_text_case, kernelId, KERNEL_FILE_TABLE, KERNEL_PERSON_TABLE, PARITY_MADE_OF, KERNEL;
|
|
790
790
|
var init_parity = __esm({
|
|
791
791
|
"src/parity.ts"() {
|
|
792
792
|
"use strict";
|
|
793
793
|
init_choiceLooks();
|
|
794
|
-
|
|
795
|
-
|
|
794
|
+
import_core5 = require("@ai-matrx/records/core");
|
|
795
|
+
import_core6 = require("@ai-matrx/records/core");
|
|
796
796
|
import_text_case = require("@ai-matrx/kit/text-case");
|
|
797
797
|
init_docs();
|
|
798
798
|
init_fieldTypes();
|
|
799
|
-
kernelId = (name) =>
|
|
799
|
+
kernelId = (name) => import_core5.KERNEL_TABLES.find((t) => t.name === name)?.id ?? "";
|
|
800
800
|
KERNEL_FILE_TABLE = kernelId("File");
|
|
801
801
|
KERNEL_PERSON_TABLE = kernelId("Person");
|
|
802
802
|
PARITY_MADE_OF = Object.fromEntries(
|
|
803
|
-
|
|
803
|
+
import_core5.PARITY_FIELD_TYPES.map((p) => [p.parity_type, p.made_of])
|
|
804
804
|
);
|
|
805
805
|
KERNEL = { file: KERNEL_FILE_TABLE, person: KERNEL_PERSON_TABLE };
|
|
806
806
|
}
|
|
@@ -1171,11 +1171,11 @@ var init_refusals = __esm({
|
|
|
1171
1171
|
});
|
|
1172
1172
|
|
|
1173
1173
|
// src/createTable.ts
|
|
1174
|
-
var
|
|
1174
|
+
var import_core7;
|
|
1175
1175
|
var init_createTable = __esm({
|
|
1176
1176
|
"src/createTable.ts"() {
|
|
1177
1177
|
"use strict";
|
|
1178
|
-
|
|
1178
|
+
import_core7 = require("@ai-matrx/records/core");
|
|
1179
1179
|
}
|
|
1180
1180
|
});
|
|
1181
1181
|
|
|
@@ -1251,7 +1251,7 @@ function usePickerTables() {
|
|
|
1251
1251
|
};
|
|
1252
1252
|
}, [client, nonce]);
|
|
1253
1253
|
const data = (0, import_react12.useMemo)(
|
|
1254
|
-
() => (0,
|
|
1254
|
+
() => (0, import_records4.withTablePlacement)(tables.data ?? [], facts === "reading" ? null : facts),
|
|
1255
1255
|
[tables.data, facts]
|
|
1256
1256
|
);
|
|
1257
1257
|
return { loading: tables.loading || facts === "reading", data, reload };
|
|
@@ -1270,13 +1270,13 @@ function ShowListsToggle({
|
|
|
1270
1270
|
")"
|
|
1271
1271
|
] });
|
|
1272
1272
|
}
|
|
1273
|
-
var import_react12,
|
|
1273
|
+
var import_react12, import_records4, import_react13, import_design_system9, import_jsx_runtime10;
|
|
1274
1274
|
var init_tablePicking = __esm({
|
|
1275
1275
|
"src/tablePicking.tsx"() {
|
|
1276
1276
|
"use strict";
|
|
1277
1277
|
"use client";
|
|
1278
1278
|
import_react12 = require("react");
|
|
1279
|
-
|
|
1279
|
+
import_records4 = require("@ai-matrx/records");
|
|
1280
1280
|
import_react13 = require("@ai-matrx/records/react");
|
|
1281
1281
|
import_design_system9 = require("@ai-matrx/design-system");
|
|
1282
1282
|
init_tablePickerEntries();
|
|
@@ -2148,7 +2148,7 @@ function choiceOptionsOf(options) {
|
|
|
2148
2148
|
const labels = [];
|
|
2149
2149
|
for (const option of options) {
|
|
2150
2150
|
const id = option.id;
|
|
2151
|
-
const key = (0,
|
|
2151
|
+
const key = (0, import_records12.optionKey)(option);
|
|
2152
2152
|
const label = recordName(option.data, null, "");
|
|
2153
2153
|
if (label) {
|
|
2154
2154
|
labels.push(label);
|
|
@@ -2160,18 +2160,18 @@ function choiceOptionsOf(options) {
|
|
|
2160
2160
|
return { byWord, labels };
|
|
2161
2161
|
}
|
|
2162
2162
|
function valueFromPastedText(field, raw, options, relationNames) {
|
|
2163
|
-
return (0,
|
|
2163
|
+
return (0, import_records12.coerceTypedAnswer)(field, raw, {
|
|
2164
2164
|
label: fieldName(field),
|
|
2165
2165
|
...options ? { options } : {},
|
|
2166
2166
|
...relationNames ? { relationNames } : {}
|
|
2167
2167
|
});
|
|
2168
2168
|
}
|
|
2169
|
-
var
|
|
2169
|
+
var import_core11, import_records12;
|
|
2170
2170
|
var init_pasteValues = __esm({
|
|
2171
2171
|
"src/pasteValues.ts"() {
|
|
2172
2172
|
"use strict";
|
|
2173
|
-
|
|
2174
|
-
|
|
2173
|
+
import_core11 = require("@ai-matrx/records/core");
|
|
2174
|
+
import_records12 = require("@ai-matrx/records");
|
|
2175
2175
|
init_names();
|
|
2176
2176
|
init_names();
|
|
2177
2177
|
}
|
|
@@ -2202,7 +2202,7 @@ function refusedCellsOf(fields, rows, mapping, choiceOptions, relationNames) {
|
|
|
2202
2202
|
if ("unmatchedNames" in meant) return;
|
|
2203
2203
|
if ("refusal" in meant) why = meant.refusal;
|
|
2204
2204
|
else {
|
|
2205
|
-
const predicted = (0,
|
|
2205
|
+
const predicted = (0, import_core12.predictValueRefusals)([field], { [key]: meant.value }).filter(
|
|
2206
2206
|
(p) => p.field_key === void 0 || p.field_key === key
|
|
2207
2207
|
);
|
|
2208
2208
|
if (predicted.length > 0) why = predicted[0].message;
|
|
@@ -2222,11 +2222,11 @@ function checkImportRules(fields, rows, mapping, choiceOptions, relationNames) {
|
|
|
2222
2222
|
}
|
|
2223
2223
|
return [...verdicts.values()];
|
|
2224
2224
|
}
|
|
2225
|
-
var
|
|
2225
|
+
var import_core12;
|
|
2226
2226
|
var init_importRuleCheck = __esm({
|
|
2227
2227
|
"src/importRuleCheck.ts"() {
|
|
2228
2228
|
"use strict";
|
|
2229
|
-
|
|
2229
|
+
import_core12 = require("@ai-matrx/records/core");
|
|
2230
2230
|
init_pasteValues();
|
|
2231
2231
|
init_parity();
|
|
2232
2232
|
}
|
|
@@ -2292,7 +2292,7 @@ function datesOfColumn(rows, header, opts = {}) {
|
|
|
2292
2292
|
const raw = String(r[header] ?? "").trim();
|
|
2293
2293
|
if (raw === "") return;
|
|
2294
2294
|
filled += 1;
|
|
2295
|
-
const got = (0,
|
|
2295
|
+
const got = (0, import_records13.readTypedDate)(raw, { ...opts.withTime ? { withTime: true } : {}, ...opts.locale ? { locale: opts.locale } : {} });
|
|
2296
2296
|
if (got.ok) read.set(i, opts.withTime && got.instant ? got.instant : got.day);
|
|
2297
2297
|
else unreadable.push({ row: i, raw });
|
|
2298
2298
|
});
|
|
@@ -2325,11 +2325,11 @@ function looksLike(rows, header) {
|
|
|
2325
2325
|
if (share(isPhone) >= 0.6) return "phone";
|
|
2326
2326
|
return null;
|
|
2327
2327
|
}
|
|
2328
|
-
var
|
|
2328
|
+
var import_records13, IMPORT_KINDS, EMAIL2, PHONE2, URLISH;
|
|
2329
2329
|
var init_importKinds = __esm({
|
|
2330
2330
|
"src/importKinds.ts"() {
|
|
2331
2331
|
"use strict";
|
|
2332
|
-
|
|
2332
|
+
import_records13 = require("@ai-matrx/records");
|
|
2333
2333
|
IMPORT_KINDS = [
|
|
2334
2334
|
{ kind: "text", label: "Text" },
|
|
2335
2335
|
{ kind: "date", label: "Date" },
|
|
@@ -2351,7 +2351,7 @@ function titleRepeats(rows, header) {
|
|
|
2351
2351
|
const seen = /* @__PURE__ */ new Set();
|
|
2352
2352
|
let filled = 0;
|
|
2353
2353
|
for (const r of rows) {
|
|
2354
|
-
const key = (0,
|
|
2354
|
+
const key = (0, import_records14.relationNameKey)(String(r[header] ?? ""));
|
|
2355
2355
|
if (key === "") continue;
|
|
2356
2356
|
filled += 1;
|
|
2357
2357
|
seen.add(key);
|
|
@@ -2361,7 +2361,7 @@ function titleRepeats(rows, header) {
|
|
|
2361
2361
|
function sameRecordLikely(rows, header, notIdentity) {
|
|
2362
2362
|
const groups = /* @__PURE__ */ new Map();
|
|
2363
2363
|
for (const r of rows) {
|
|
2364
|
-
const key = (0,
|
|
2364
|
+
const key = (0, import_records14.relationNameKey)(String(r[header] ?? ""));
|
|
2365
2365
|
if (key === "") continue;
|
|
2366
2366
|
const held = groups.get(key);
|
|
2367
2367
|
if (held) held.push(r);
|
|
@@ -2394,7 +2394,7 @@ function combineRows(rows, header) {
|
|
|
2394
2394
|
const out = [];
|
|
2395
2395
|
const outLines = [];
|
|
2396
2396
|
rows.forEach((r, i) => {
|
|
2397
|
-
const key = (0,
|
|
2397
|
+
const key = (0, import_records14.relationNameKey)(String(r[header] ?? ""));
|
|
2398
2398
|
if (key === "") {
|
|
2399
2399
|
out.push({ ...r });
|
|
2400
2400
|
outLines.push([i + 1]);
|
|
@@ -2434,11 +2434,11 @@ function combineRows(rows, header) {
|
|
|
2434
2434
|
index.sort((a, b) => a.lines[0] - b.lines[0]);
|
|
2435
2435
|
return { rows: index.map((e) => e.row), lines: index.map((e) => e.lines), multiValued };
|
|
2436
2436
|
}
|
|
2437
|
-
var
|
|
2437
|
+
var import_records14, LIST_JOIN;
|
|
2438
2438
|
var init_importCombine = __esm({
|
|
2439
2439
|
"src/importCombine.ts"() {
|
|
2440
2440
|
"use strict";
|
|
2441
|
-
|
|
2441
|
+
import_records14 = require("@ai-matrx/records");
|
|
2442
2442
|
LIST_JOIN = "; ";
|
|
2443
2443
|
}
|
|
2444
2444
|
});
|
|
@@ -2789,7 +2789,7 @@ function ImportWizard({ tableId, source, onDone, onWrote, autoRun, className })
|
|
|
2789
2789
|
try {
|
|
2790
2790
|
const xlsx = file.name.toLowerCase().endsWith(".xlsx");
|
|
2791
2791
|
const bytes = await file.arrayBuffer();
|
|
2792
|
-
const result = xlsx ? await (0,
|
|
2792
|
+
const result = xlsx ? await (0, import_core13.importXlsx)(bytes) : (0, import_core13.importCsv)(new TextDecoder().decode(bytes));
|
|
2793
2793
|
await planFrom(result, { name: file.name, bytes: file.size, hash: await sha256(bytes), format: xlsx ? "xlsx" : "csv" });
|
|
2794
2794
|
} catch (thrown) {
|
|
2795
2795
|
setProblem(
|
|
@@ -2900,13 +2900,13 @@ function ImportWizard({ tableId, source, onDone, onWrote, autoRun, className })
|
|
|
2900
2900
|
async (wanted) => {
|
|
2901
2901
|
const next = /* @__PURE__ */ new Map();
|
|
2902
2902
|
for (const { header, field } of wanted) {
|
|
2903
|
-
const names2 = effectiveRows.flatMap((r) => (0,
|
|
2903
|
+
const names2 = effectiveRows.flatMap((r) => (0, import_records15.relationNamesIn)(field, String(r[header] ?? "")));
|
|
2904
2904
|
const got = await client.relationNamesMatch({ table_id: field.relation_target, names: names2 });
|
|
2905
2905
|
if (!got.ok) {
|
|
2906
2906
|
setRelationProblem(got.error);
|
|
2907
2907
|
return null;
|
|
2908
2908
|
}
|
|
2909
|
-
next.set(field.key, (0,
|
|
2909
|
+
next.set(field.key, (0, import_records15.relationNameIndexOf)(got.data));
|
|
2910
2910
|
}
|
|
2911
2911
|
setRelationProblem(null);
|
|
2912
2912
|
setRelationIndex(next);
|
|
@@ -2930,12 +2930,12 @@ function ImportWizard({ tableId, source, onDone, onWrote, autoRun, className })
|
|
|
2930
2930
|
let linked = 0;
|
|
2931
2931
|
let named = 0;
|
|
2932
2932
|
effectiveRows.forEach((row, i) => {
|
|
2933
|
-
const names2 = (0,
|
|
2933
|
+
const names2 = (0, import_records15.relationNamesIn)(field, String(row[header] ?? ""));
|
|
2934
2934
|
if (String(row[header] ?? "").trim() === "") return;
|
|
2935
2935
|
named += 1;
|
|
2936
2936
|
let ok = true;
|
|
2937
2937
|
for (const name of names2) {
|
|
2938
|
-
const hits = index.byName.get((0,
|
|
2938
|
+
const hits = index.byName.get((0, import_records15.relationNameKey)(name)) ?? [];
|
|
2939
2939
|
if (hits.length === 1) continue;
|
|
2940
2940
|
ok = false;
|
|
2941
2941
|
if (hits.length === 0) unmatched.set(name, [...unmatched.get(name) ?? [], i + 1]);
|
|
@@ -3001,11 +3001,11 @@ function ImportWizard({ tableId, source, onDone, onWrote, autoRun, className })
|
|
|
3001
3001
|
const named = index.get(field.key);
|
|
3002
3002
|
const text = String(row[header] ?? "").trim();
|
|
3003
3003
|
if (!named || text === "") continue;
|
|
3004
|
-
const parts = field.multi ? (0,
|
|
3004
|
+
const parts = field.multi ? (0, import_records15.splitListCell)(text) : [text];
|
|
3005
3005
|
const ids = [];
|
|
3006
3006
|
let skip = false;
|
|
3007
3007
|
for (const part of parts) {
|
|
3008
|
-
const hits = (0,
|
|
3008
|
+
const hits = (0, import_records15.relationNamesIn)(field, part).length === 0 ? null : named.byName.get((0, import_records15.relationNameKey)(part)) ?? [];
|
|
3009
3009
|
if (hits === null) ids.push(part);
|
|
3010
3010
|
else if (hits.length === 1) ids.push(hits[0].id);
|
|
3011
3011
|
else if ((hits.length === 0 ? choiceFor(field.key).unmatched : choiceFor(field.key).ambiguous) !== "empty") skip = true;
|
|
@@ -3045,7 +3045,7 @@ function ImportWizard({ tableId, source, onDone, onWrote, autoRun, className })
|
|
|
3045
3045
|
setPhase("linking");
|
|
3046
3046
|
for (const ask of toMerge) {
|
|
3047
3047
|
for (const [name] of ask.ambiguous) {
|
|
3048
|
-
const hits = ask.index.byName.get((0,
|
|
3048
|
+
const hits = ask.index.byName.get((0, import_records15.relationNameKey)(name)) ?? [];
|
|
3049
3049
|
const winner = hits[0];
|
|
3050
3050
|
if (!winner) continue;
|
|
3051
3051
|
for (const loser of hits.slice(1)) {
|
|
@@ -3985,16 +3985,16 @@ function ImportWizard({ tableId, source, onDone, onWrote, autoRun, className })
|
|
|
3985
3985
|
table.error ? /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(RefusalNotice, { error: table.error }) : null
|
|
3986
3986
|
] });
|
|
3987
3987
|
}
|
|
3988
|
-
var import_react41, import_react42,
|
|
3988
|
+
var import_react41, import_react42, import_core13, import_design_system23, import_records15, import_text_case5, import_jsx_runtime25, BATCH, SAMPLES, COLUMNS_PER_CALL, ABSENT, LEAVE, TITLE_COPY, TYPED_VALUES;
|
|
3989
3989
|
var init_ImportWizard = __esm({
|
|
3990
3990
|
"src/ImportWizard.tsx"() {
|
|
3991
3991
|
"use strict";
|
|
3992
3992
|
"use client";
|
|
3993
3993
|
import_react41 = require("react");
|
|
3994
3994
|
import_react42 = require("@ai-matrx/records/react");
|
|
3995
|
-
|
|
3995
|
+
import_core13 = require("@ai-matrx/records/core");
|
|
3996
3996
|
import_design_system23 = require("@ai-matrx/design-system");
|
|
3997
|
-
|
|
3997
|
+
import_records15 = require("@ai-matrx/records");
|
|
3998
3998
|
init_Refusal();
|
|
3999
3999
|
init_refusals();
|
|
4000
4000
|
init_importRuleCheck();
|
|
@@ -4042,15 +4042,15 @@ function shownToOnlyMe(table) {
|
|
|
4042
4042
|
if (table.shown_to !== void 0) return table.shown_to === "only_me";
|
|
4043
4043
|
return table.visibility === "personal";
|
|
4044
4044
|
}
|
|
4045
|
-
var import_react43, import_react44,
|
|
4045
|
+
var import_react43, import_react44, import_core14, import_records16, import_design_system24, import_jsx_runtime26, PLATFORM_TABLE_PREFIX2;
|
|
4046
4046
|
var init_TablesHome = __esm({
|
|
4047
4047
|
"src/TablesHome.tsx"() {
|
|
4048
4048
|
"use strict";
|
|
4049
4049
|
"use client";
|
|
4050
4050
|
import_react43 = require("react");
|
|
4051
4051
|
import_react44 = require("@ai-matrx/records/react");
|
|
4052
|
-
|
|
4053
|
-
|
|
4052
|
+
import_core14 = require("@ai-matrx/records/core");
|
|
4053
|
+
import_records16 = require("@ai-matrx/records");
|
|
4054
4054
|
import_design_system24 = require("@ai-matrx/design-system");
|
|
4055
4055
|
import_jsx_runtime26 = require("react/jsx-runtime");
|
|
4056
4056
|
PLATFORM_TABLE_PREFIX2 = "records_ui_";
|
|
@@ -4093,7 +4093,7 @@ function draftsFor(headers, rows) {
|
|
|
4093
4093
|
function keysFor(labels) {
|
|
4094
4094
|
const used = /* @__PURE__ */ new Set();
|
|
4095
4095
|
return labels.map((label, i) => {
|
|
4096
|
-
const base = (0,
|
|
4096
|
+
const base = (0, import_core7.tokenFor)(label) === "table" && !/table/i.test(label) ? `column_${i + 1}` : (0, import_core7.tokenFor)(label);
|
|
4097
4097
|
let key = base;
|
|
4098
4098
|
let n = 2;
|
|
4099
4099
|
while (used.has(key)) key = `${base}_${n++}`;
|
|
@@ -4203,7 +4203,7 @@ function SaveToTable({ source, shapeIndex = 0, onOpenTable, onSaved, onClose, ma
|
|
|
4203
4203
|
tableName2 = (name ?? proposedName).trim();
|
|
4204
4204
|
newId = earlier.tableId;
|
|
4205
4205
|
const lacking = fields.filter((f) => !earlier.haveKeys.has(f.key));
|
|
4206
|
-
const added = await (0,
|
|
4206
|
+
const added = await (0, import_core7.addFields)(client, newId, lacking);
|
|
4207
4207
|
if (!added.ok) {
|
|
4208
4208
|
setProblem(added.error);
|
|
4209
4209
|
setPhase("ready");
|
|
@@ -4211,7 +4211,7 @@ function SaveToTable({ source, shapeIndex = 0, onOpenTable, onSaved, onClose, ma
|
|
|
4211
4211
|
}
|
|
4212
4212
|
} else {
|
|
4213
4213
|
tableName2 = freeName(name ?? proposedName, (tables.data ?? []).map((t) => t.name));
|
|
4214
|
-
const born = await (0,
|
|
4214
|
+
const born = await (0, import_core7.declareTable)(client, { name: tableName2, fields });
|
|
4215
4215
|
if (!born.ok) {
|
|
4216
4216
|
setProblem(born.error);
|
|
4217
4217
|
setPhase("ready");
|
|
@@ -4599,7 +4599,7 @@ var import_design_system4 = require("@ai-matrx/design-system");
|
|
|
4599
4599
|
|
|
4600
4600
|
// src/ChoiceListEditor.tsx
|
|
4601
4601
|
var import_react = require("react");
|
|
4602
|
-
var
|
|
4602
|
+
var import_records = require("@ai-matrx/records");
|
|
4603
4603
|
var import_react2 = require("@ai-matrx/records/react");
|
|
4604
4604
|
var import_design_system = require("@ai-matrx/design-system");
|
|
4605
4605
|
var import_data_table = require("@ai-matrx/design-system/data-table");
|
|
@@ -4610,7 +4610,7 @@ var rowSeed = 0;
|
|
|
4610
4610
|
var nextRow = () => `new-${rowSeed += 1}`;
|
|
4611
4611
|
function choiceRowsFrom(options, field) {
|
|
4612
4612
|
return inTheStoresOrder([...options]).map((option) => {
|
|
4613
|
-
const words = (0,
|
|
4613
|
+
const words = (0, import_records.optionLabel)(option);
|
|
4614
4614
|
const key = option.data?.key;
|
|
4615
4615
|
const color = field ? storedChoiceColor(field, words) ?? storedChoiceColor(field, key) : void 0;
|
|
4616
4616
|
return { id: option.id, words, row: option.id, color: color ?? null };
|
|
@@ -4780,11 +4780,11 @@ function ChoiceListEditor({
|
|
|
4780
4780
|
"div",
|
|
4781
4781
|
{
|
|
4782
4782
|
role: "group",
|
|
4783
|
-
"aria-label": (0,
|
|
4783
|
+
"aria-label": (0, import_records.recordsUseSentence)(heldBy(asking), asking.words.trim()),
|
|
4784
4784
|
"data-records-choice-removal-ask": "",
|
|
4785
4785
|
className: "flex flex-col gap-1 rounded border bg-muted/40 p-2",
|
|
4786
4786
|
children: [
|
|
4787
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { className: "text-xs", children: (0,
|
|
4787
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { className: "text-xs", children: (0, import_records.recordsUseSentence)(heldBy(asking), asking.words.trim()) }),
|
|
4788
4788
|
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "flex flex-wrap items-center gap-1", children: [
|
|
4789
4789
|
targets.length > 0 ? /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
|
|
4790
4790
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_design_system.Button, { type: "button", size: "sm", className: "h-7 px-2 text-xs", disabled: moveTo === "", onClick: () => answer({ then: "move", to: moveTo }), children: "Move them to" }),
|
|
@@ -4803,7 +4803,7 @@ function ChoiceListEditor({
|
|
|
4803
4803
|
) : null,
|
|
4804
4804
|
Object.entries(rehome).map(
|
|
4805
4805
|
([id, spec]) => removed[id] ? /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "flex items-center justify-between gap-2 text-[11px] text-muted-foreground", "data-records-choice-rehome": "", children: [
|
|
4806
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { children: (0,
|
|
4806
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { children: (0, import_records.rehomeSentence)(usage?.[id]?.records ?? 0, removed[id].row.words.trim(), spec, spec.then === "move" ? wordsOf(spec.to) : void 0) }),
|
|
4807
4807
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_design_system.Button, { type: "button", size: "sm", variant: "ghost", className: "h-6 px-1.5 text-[11px]", onClick: () => putBack(id), children: "Put it back" })
|
|
4808
4808
|
] }, id) : null
|
|
4809
4809
|
),
|
|
@@ -4900,7 +4900,7 @@ function AddChoicesInline({ field, onAdded, disabled = false }) {
|
|
|
4900
4900
|
|
|
4901
4901
|
// src/editors.tsx
|
|
4902
4902
|
var import_react67 = require("react");
|
|
4903
|
-
var
|
|
4903
|
+
var import_records28 = require("@ai-matrx/records");
|
|
4904
4904
|
var import_react68 = require("@ai-matrx/records/react");
|
|
4905
4905
|
var import_design_system39 = require("@ai-matrx/design-system");
|
|
4906
4906
|
init_dates();
|
|
@@ -4908,22 +4908,22 @@ init_dates();
|
|
|
4908
4908
|
// src/newerKindValues.tsx
|
|
4909
4909
|
var import_react8 = require("react");
|
|
4910
4910
|
var import_source = require("@ai-matrx/content-ir/source");
|
|
4911
|
-
var
|
|
4911
|
+
var import_records2 = require("@ai-matrx/records");
|
|
4912
4912
|
var import_design_system5 = require("@ai-matrx/design-system");
|
|
4913
4913
|
var import_outbound_react = require("@ai-matrx/kit/outbound-react");
|
|
4914
4914
|
var import_jsx_runtime6 = require("react/jsx-runtime");
|
|
4915
4915
|
var own = (event) => event.stopPropagation();
|
|
4916
4916
|
function newerKindValue(field, value, opts = {}) {
|
|
4917
|
-
switch ((0,
|
|
4917
|
+
switch ((0, import_records2.newerKindOf)(field)) {
|
|
4918
4918
|
case "duration": {
|
|
4919
|
-
const words = (0,
|
|
4919
|
+
const words = (0, import_records2.durationText)(value);
|
|
4920
4920
|
return words === null ? void 0 : /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { className: "tabular-nums", "data-records-duration": "", children: words });
|
|
4921
4921
|
}
|
|
4922
4922
|
case "created_by":
|
|
4923
4923
|
case "modified_by":
|
|
4924
|
-
return (0,
|
|
4924
|
+
return (0, import_records2.isPersonStamp)(value) ? /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(PersonStampChip, { stamp: value }) : void 0;
|
|
4925
4925
|
case "address":
|
|
4926
|
-
return (0,
|
|
4926
|
+
return (0, import_records2.isAddressValue)(value) || typeof value === "string" ? /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(AddressLink, { value }) : void 0;
|
|
4927
4927
|
case "barcode":
|
|
4928
4928
|
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: [
|
|
4929
4929
|
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { "aria-hidden": "true", className: "text-muted-foreground", children: "\u25AE\u25AF\u25AE" }),
|
|
@@ -4938,7 +4938,7 @@ function newerKindValue(field, value, opts = {}) {
|
|
|
4938
4938
|
}
|
|
4939
4939
|
}
|
|
4940
4940
|
function PersonStampChip({ stamp }) {
|
|
4941
|
-
const words = (0,
|
|
4941
|
+
const words = (0, import_records2.personStampText)(stamp) ?? import_records2.NOT_A_MEMBER_WORDS;
|
|
4942
4942
|
const tier = stamp.actor ?? "user";
|
|
4943
4943
|
const name = tier === "user" ? stamp.name : null;
|
|
4944
4944
|
const initial = tier === "system" ? "\u2699" : tier === "agent" ? "\u2726" : name && name.trim() !== "" ? name.trim()[0].toUpperCase() : "?";
|
|
@@ -4955,8 +4955,8 @@ function PersonStampChip({ stamp }) {
|
|
|
4955
4955
|
] });
|
|
4956
4956
|
}
|
|
4957
4957
|
function AddressLink({ value }) {
|
|
4958
|
-
const words = (0,
|
|
4959
|
-
const href = (0,
|
|
4958
|
+
const words = (0, import_records2.addressText)(value);
|
|
4959
|
+
const href = (0, import_records2.addressMapUrl)(value);
|
|
4960
4960
|
if (!words || !href) return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { className: "text-muted-foreground", children: "\u2014" });
|
|
4961
4961
|
return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(
|
|
4962
4962
|
import_outbound_react.OutboundLink,
|
|
@@ -4975,11 +4975,11 @@ function AddressLink({ value }) {
|
|
|
4975
4975
|
}
|
|
4976
4976
|
var STATUS_GROUP_MARK = { todo: "\u25CB", in_progress: "\u25D0", done: "\u25CF" };
|
|
4977
4977
|
function statusMarkOf(field, value, document2) {
|
|
4978
|
-
if ((0,
|
|
4978
|
+
if ((0, import_records2.newerKindOf)(field) !== "status" || typeof value !== "string") return null;
|
|
4979
4979
|
const chosen = document2?.["_choices"]?.[field.key];
|
|
4980
4980
|
const key = chosen && typeof chosen === "object" && typeof chosen.key === "string" ? chosen.key : value;
|
|
4981
|
-
const group = (0,
|
|
4982
|
-
return { mark: STATUS_GROUP_MARK[group], group, words:
|
|
4981
|
+
const group = (0, import_records2.statusGroupOf)(field, key);
|
|
4982
|
+
return { mark: STATUS_GROUP_MARK[group], group, words: import_records2.STATUS_GROUP_WORDS[group] };
|
|
4983
4983
|
}
|
|
4984
4984
|
function inline(text, key) {
|
|
4985
4985
|
const out = [];
|
|
@@ -5007,7 +5007,7 @@ function marks(text, key) {
|
|
|
5007
5007
|
if (tok.startsWith("**") || tok.startsWith("__")) out.push(/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("strong", { children: tok.slice(2, -2) }, k));
|
|
5008
5008
|
else if (tok.startsWith("[")) {
|
|
5009
5009
|
const link = /^\[([^\]]+)\]\(([^)\s]+)\)$/.exec(tok);
|
|
5010
|
-
const href = (0,
|
|
5010
|
+
const href = (0, import_records2.safeLinkHref)(link?.[2] ?? "");
|
|
5011
5011
|
out.push(
|
|
5012
5012
|
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
|
|
5013
5013
|
);
|
|
@@ -5072,7 +5072,7 @@ function SafeMarkdown({ text, clipped }) {
|
|
|
5072
5072
|
);
|
|
5073
5073
|
}
|
|
5074
5074
|
function newerKindControl(props) {
|
|
5075
|
-
switch ((0,
|
|
5075
|
+
switch ((0, import_records2.newerKindOf)(props.field)) {
|
|
5076
5076
|
case "duration":
|
|
5077
5077
|
return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(DurationControl, { ...props });
|
|
5078
5078
|
case "address":
|
|
@@ -5088,10 +5088,10 @@ function newerKindControl(props) {
|
|
|
5088
5088
|
}
|
|
5089
5089
|
}
|
|
5090
5090
|
function DurationControl({ value, onChange, disabled, id }) {
|
|
5091
|
-
const [text, setText] = (0, import_react8.useState)(() => (0,
|
|
5091
|
+
const [text, setText] = (0, import_react8.useState)(() => (0, import_records2.durationText)(value) ?? "");
|
|
5092
5092
|
const [wrong, setWrong] = (0, import_react8.useState)(false);
|
|
5093
5093
|
(0, import_react8.useEffect)(() => {
|
|
5094
|
-
setText((0,
|
|
5094
|
+
setText((0, import_records2.durationText)(value) ?? "");
|
|
5095
5095
|
}, [value]);
|
|
5096
5096
|
return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("span", { className: "flex flex-col gap-1", children: [
|
|
5097
5097
|
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
@@ -5111,12 +5111,12 @@ function DurationControl({ value, onChange, disabled, id }) {
|
|
|
5111
5111
|
onChange(null);
|
|
5112
5112
|
return;
|
|
5113
5113
|
}
|
|
5114
|
-
const seconds = (0,
|
|
5114
|
+
const seconds = (0, import_records2.readTypedDuration)(e.target.value);
|
|
5115
5115
|
setWrong(seconds === null);
|
|
5116
5116
|
if (seconds !== null) onChange(seconds);
|
|
5117
5117
|
},
|
|
5118
5118
|
onBlur: () => {
|
|
5119
|
-
if (!wrong) setText((0,
|
|
5119
|
+
if (!wrong) setText((0, import_records2.durationText)(value) ?? "");
|
|
5120
5120
|
}
|
|
5121
5121
|
}
|
|
5122
5122
|
),
|
|
@@ -5138,13 +5138,13 @@ var ADDRESS_EXAMPLES = {
|
|
|
5138
5138
|
country: "US"
|
|
5139
5139
|
};
|
|
5140
5140
|
function AddressControl({ value, onChange, disabled, id }) {
|
|
5141
|
-
const held = (0,
|
|
5141
|
+
const held = (0, import_records2.isAddressValue)(value) ? value : typeof value === "string" && value.trim() !== "" ? { street: value } : {};
|
|
5142
5142
|
const set = (part, words) => {
|
|
5143
5143
|
const next = { ...held, [part]: words };
|
|
5144
5144
|
const kept = Object.fromEntries(Object.entries(next).filter(([, v]) => typeof v === "string" && v.trim() !== ""));
|
|
5145
5145
|
onChange(Object.keys(kept).length === 0 ? null : kept);
|
|
5146
5146
|
};
|
|
5147
|
-
return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { id, className: "grid grid-cols-2 gap-1.5", "data-records-address-control": "", children:
|
|
5147
|
+
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)(
|
|
5148
5148
|
import_design_system5.BasicInput,
|
|
5149
5149
|
{
|
|
5150
5150
|
"aria-label": ADDRESS_LABELS[part],
|
|
@@ -5225,7 +5225,7 @@ init_names();
|
|
|
5225
5225
|
|
|
5226
5226
|
// src/RelationPicker.tsx
|
|
5227
5227
|
var import_react10 = require("react");
|
|
5228
|
-
var
|
|
5228
|
+
var import_records3 = require("@ai-matrx/records");
|
|
5229
5229
|
var import_react11 = require("@ai-matrx/records/react");
|
|
5230
5230
|
var import_design_system8 = require("@ai-matrx/design-system");
|
|
5231
5231
|
init_PickOrAdd();
|
|
@@ -5422,7 +5422,7 @@ function RelationPicker({ field, value, onChange, disabled, id, className, allow
|
|
|
5422
5422
|
toggle(createdId);
|
|
5423
5423
|
};
|
|
5424
5424
|
const apart = tellApart(rows ?? [], titleOf);
|
|
5425
|
-
const visible = (0,
|
|
5425
|
+
const visible = (0, import_records3.rankTypedMatches)(rows ?? [], search, (row) => [titleOf(row.id), apart.get(row.id) ?? ""]);
|
|
5426
5426
|
const anchored = autoOpen === true;
|
|
5427
5427
|
const cellChips = picked.map((recordId) => /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
5428
5428
|
RecordChip,
|
|
@@ -5545,7 +5545,7 @@ function RelationPicker({ field, value, onChange, disabled, id, className, allow
|
|
|
5545
5545
|
var import_react62 = require("react");
|
|
5546
5546
|
var import_design_system36 = require("@ai-matrx/design-system");
|
|
5547
5547
|
var import_data_table6 = require("@ai-matrx/design-system/data-table");
|
|
5548
|
-
var
|
|
5548
|
+
var import_records26 = require("@ai-matrx/records");
|
|
5549
5549
|
var import_react63 = require("@ai-matrx/records/react");
|
|
5550
5550
|
init_Refusal();
|
|
5551
5551
|
|
|
@@ -5587,7 +5587,7 @@ function columnNameProblemLine(name, noun = "column") {
|
|
|
5587
5587
|
// src/FieldEditor.tsx
|
|
5588
5588
|
var import_react60 = require("react");
|
|
5589
5589
|
var import_react61 = require("@ai-matrx/records/react");
|
|
5590
|
-
var
|
|
5590
|
+
var import_core16 = require("@ai-matrx/records/core");
|
|
5591
5591
|
var import_design_system35 = require("@ai-matrx/design-system");
|
|
5592
5592
|
init_parity();
|
|
5593
5593
|
init_fieldTypes();
|
|
@@ -5595,7 +5595,7 @@ init_fieldTypes();
|
|
|
5595
5595
|
// src/ReferenceBuilder.tsx
|
|
5596
5596
|
var import_react14 = require("react");
|
|
5597
5597
|
var import_react15 = require("@ai-matrx/records/react");
|
|
5598
|
-
var
|
|
5598
|
+
var import_core8 = require("@ai-matrx/records/core");
|
|
5599
5599
|
init_createTable();
|
|
5600
5600
|
init_Refusal();
|
|
5601
5601
|
init_tablePicking();
|
|
@@ -5684,7 +5684,7 @@ function ReferenceBuilder({
|
|
|
5684
5684
|
if (!name || making) return;
|
|
5685
5685
|
setMaking(true);
|
|
5686
5686
|
setRefused(null);
|
|
5687
|
-
const slug = (0,
|
|
5687
|
+
const slug = (0, import_core7.tokenFor)(name);
|
|
5688
5688
|
const found = await client.tableFind({ slug });
|
|
5689
5689
|
if (!found.ok) {
|
|
5690
5690
|
setMaking(false);
|
|
@@ -5698,7 +5698,7 @@ function ReferenceBuilder({
|
|
|
5698
5698
|
id = existing.id;
|
|
5699
5699
|
bornName = tableName(existing);
|
|
5700
5700
|
} else {
|
|
5701
|
-
const made = await (0,
|
|
5701
|
+
const made = await (0, import_core7.ensureTable)(client, {
|
|
5702
5702
|
name,
|
|
5703
5703
|
slug,
|
|
5704
5704
|
titleField: "name",
|
|
@@ -5717,7 +5717,7 @@ function ReferenceBuilder({
|
|
|
5717
5717
|
tables.reload();
|
|
5718
5718
|
onChange({ targetTableId: id, display: null });
|
|
5719
5719
|
};
|
|
5720
|
-
const mayMakeTable = (0,
|
|
5720
|
+
const mayMakeTable = (0, import_core8.doorReady)(client.config, import_core8.DOORS.tableFind) && (0, import_core8.doorReady)(client.config, import_core8.DOORS.tableEnsure);
|
|
5721
5721
|
const newTableButton = !mayMakeTable ? null : /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
5722
5722
|
import_design_system10.Button,
|
|
5723
5723
|
{
|
|
@@ -5931,7 +5931,7 @@ function ReferenceBuilder({
|
|
|
5931
5931
|
// src/FormulaTextEditor.tsx
|
|
5932
5932
|
var import_react16 = require("react");
|
|
5933
5933
|
var import_react17 = require("@ai-matrx/records/react");
|
|
5934
|
-
var
|
|
5934
|
+
var import_records5 = require("@ai-matrx/records");
|
|
5935
5935
|
var import_design_system11 = require("@ai-matrx/design-system");
|
|
5936
5936
|
init_host();
|
|
5937
5937
|
init_Refusal();
|
|
@@ -5956,7 +5956,7 @@ var NOT_TYPED_BY_NAME = /* @__PURE__ */ new Set([
|
|
|
5956
5956
|
function formulaFunctionNames(kinds) {
|
|
5957
5957
|
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();
|
|
5958
5958
|
}
|
|
5959
|
-
var FORMULA_FUNCTION_NAMES = formulaFunctionNames(
|
|
5959
|
+
var FORMULA_FUNCTION_NAMES = formulaFunctionNames(import_records5.RULE_NODE_KINDS);
|
|
5960
5960
|
var RESULT_WORD = {
|
|
5961
5961
|
number: "a number",
|
|
5962
5962
|
text: "text",
|
|
@@ -6210,6 +6210,11 @@ var import_design_system28 = require("@ai-matrx/design-system");
|
|
|
6210
6210
|
var import_react50 = require("@ai-matrx/records/react");
|
|
6211
6211
|
init_Refusal();
|
|
6212
6212
|
|
|
6213
|
+
// src/leadingBlank.ts
|
|
6214
|
+
function withoutLeadingBlank(text) {
|
|
6215
|
+
return text.replace(/^\s+/, "");
|
|
6216
|
+
}
|
|
6217
|
+
|
|
6213
6218
|
// src/values.tsx
|
|
6214
6219
|
init_personChip();
|
|
6215
6220
|
var import_data_table3 = require("@ai-matrx/design-system/data-table");
|
|
@@ -6224,7 +6229,7 @@ var import_react20 = require("react");
|
|
|
6224
6229
|
// src/presentation.ts
|
|
6225
6230
|
var import_table_style2 = require("@ai-matrx/design-system/data-table/table-style");
|
|
6226
6231
|
var import_field_formats2 = require("@ai-matrx/design-system/field-formats");
|
|
6227
|
-
var
|
|
6232
|
+
var import_core9 = require("@ai-matrx/records/core");
|
|
6228
6233
|
init_parity();
|
|
6229
6234
|
init_dates();
|
|
6230
6235
|
var DRAWN_KINDS = /* @__PURE__ */ new Set(["select", "multi_select", "relation", "member", "person", "attachment", "file", "entity_reference", "checkbox", "boolean", "signature", "json"]);
|
|
@@ -6252,8 +6257,8 @@ function ungroupedForYears(field, format) {
|
|
|
6252
6257
|
}
|
|
6253
6258
|
function formatForField(field) {
|
|
6254
6259
|
const shownAs = shownAsOf(field);
|
|
6255
|
-
if ((0,
|
|
6256
|
-
return { id: "rating", options: { ...shownAs?.options ?? {}, ratingMax: (0,
|
|
6260
|
+
if ((0, import_core9.newerKindOf)(field) === "rating" && (!shownAs || shownAs.id === "rating")) {
|
|
6261
|
+
return { id: "rating", options: { ...shownAs?.options ?? {}, ratingMax: (0, import_core9.ratingMaxOf)(field) } };
|
|
6257
6262
|
}
|
|
6258
6263
|
if (shownAs) return ungroupedForYears(field, shownAs);
|
|
6259
6264
|
const stamp = dateFormatFor(field);
|
|
@@ -6318,8 +6323,8 @@ var EMBEDDED_TABLE_CLASS = [
|
|
|
6318
6323
|
// src/labels.tsx
|
|
6319
6324
|
var import_react23 = require("react");
|
|
6320
6325
|
var import_react24 = require("@ai-matrx/records/react");
|
|
6321
|
-
var
|
|
6322
|
-
var
|
|
6326
|
+
var import_records6 = require("@ai-matrx/records");
|
|
6327
|
+
var import_records7 = require("@ai-matrx/records");
|
|
6323
6328
|
init_names();
|
|
6324
6329
|
var import_uuid2 = require("@ai-matrx/kit/uuid");
|
|
6325
6330
|
|
|
@@ -6681,7 +6686,7 @@ function RecordLabelProvider({ children }) {
|
|
|
6681
6686
|
for (const option of result.data ?? []) {
|
|
6682
6687
|
const words = recordName(option.data, null, "Unnamed choice");
|
|
6683
6688
|
next[option.id] = words;
|
|
6684
|
-
const key = (0,
|
|
6689
|
+
const key = (0, import_records7.optionKey)(option);
|
|
6685
6690
|
if (key) next[choiceKeyName(field.id, key)] = words;
|
|
6686
6691
|
}
|
|
6687
6692
|
return next;
|
|
@@ -6799,7 +6804,7 @@ init_enumLabels();
|
|
|
6799
6804
|
|
|
6800
6805
|
// src/EntityReferenceControl.tsx
|
|
6801
6806
|
var import_react26 = require("react");
|
|
6802
|
-
var
|
|
6807
|
+
var import_records8 = require("@ai-matrx/records");
|
|
6803
6808
|
var import_react27 = require("@ai-matrx/records/react");
|
|
6804
6809
|
var import_design_system15 = require("@ai-matrx/design-system");
|
|
6805
6810
|
init_PickOrAdd();
|
|
@@ -6809,7 +6814,7 @@ var import_jsx_runtime17 = require("react/jsx-runtime");
|
|
|
6809
6814
|
var WITHHELD_ENTITY_LABEL = "Something you have not been given access to";
|
|
6810
6815
|
var ENTITY_REFERENCE_EMPTY = "Nothing is pointed at yet.";
|
|
6811
6816
|
function entityReferenceText(value) {
|
|
6812
|
-
const refs = (0,
|
|
6817
|
+
const refs = (0, import_records8.entityRefsOf)(value);
|
|
6813
6818
|
if (refs.length === 0) return "\u2014";
|
|
6814
6819
|
return refs.map((r) => r.label ?? WITHHELD_ENTITY_LABEL).join(", ");
|
|
6815
6820
|
}
|
|
@@ -6823,7 +6828,7 @@ function EntityReferenceControl(props) {
|
|
|
6823
6828
|
return client ? /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(WithWords, { ...props }) : /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(Chips, { ...props, words: null, picker: null });
|
|
6824
6829
|
}
|
|
6825
6830
|
function WithWords(props) {
|
|
6826
|
-
const refs = (0, import_react26.useMemo)(() => (0,
|
|
6831
|
+
const refs = (0, import_react26.useMemo)(() => (0, import_records8.entityRefsOf)(props.value), [props.value]);
|
|
6827
6832
|
const [known, setKnown] = (0, import_react26.useState)([]);
|
|
6828
6833
|
const withKnown = refs.map((r) => r.label === null ? known.find((k) => k.token === r.token && k.id === r.id) ?? r : r);
|
|
6829
6834
|
const unlabelled = (0, import_react26.useMemo)(
|
|
@@ -6841,7 +6846,7 @@ function WithWords(props) {
|
|
|
6841
6846
|
setKnown((k) => [...k.filter((x) => !(x.token === picked.token && x.id === picked.id)), picked]);
|
|
6842
6847
|
const multi = Boolean(props.field.multi);
|
|
6843
6848
|
const next = multi ? [...withKnown.filter((x) => !(x.token === picked.token && x.id === picked.id)), picked] : [picked];
|
|
6844
|
-
props.onChange((0,
|
|
6849
|
+
props.onChange((0, import_records8.entityRefsToWrite)(next, multi));
|
|
6845
6850
|
}
|
|
6846
6851
|
}
|
|
6847
6852
|
);
|
|
@@ -6930,7 +6935,7 @@ function Chips({
|
|
|
6930
6935
|
words,
|
|
6931
6936
|
picker
|
|
6932
6937
|
}) {
|
|
6933
|
-
const refs = (0, import_react26.useMemo)(() => (0,
|
|
6938
|
+
const refs = (0, import_react26.useMemo)(() => (0, import_records8.entityRefsOf)(value), [value]);
|
|
6934
6939
|
const labelOf = (token, refId, own3) => {
|
|
6935
6940
|
if (own3) return own3;
|
|
6936
6941
|
const read = words?.data?.find((w) => w.token === token && w.id === refId)?.label;
|
|
@@ -6954,7 +6959,7 @@ function Chips({
|
|
|
6954
6959
|
"aria-label": `Take ${label} off`,
|
|
6955
6960
|
onClick: () => {
|
|
6956
6961
|
const rest = refs.filter((x) => !(x.token === r.token && x.id === r.id));
|
|
6957
|
-
onChange((0,
|
|
6962
|
+
onChange((0, import_records8.entityRefsToWrite)(rest, multi));
|
|
6958
6963
|
},
|
|
6959
6964
|
children: "\xD7"
|
|
6960
6965
|
}
|
|
@@ -6966,18 +6971,18 @@ function Chips({
|
|
|
6966
6971
|
}
|
|
6967
6972
|
|
|
6968
6973
|
// src/values.tsx
|
|
6969
|
-
var
|
|
6974
|
+
var import_core15 = require("@ai-matrx/records/core");
|
|
6970
6975
|
|
|
6971
6976
|
// src/WholeValue.tsx
|
|
6972
6977
|
var import_react28 = require("react");
|
|
6973
|
-
var
|
|
6978
|
+
var import_core10 = require("@ai-matrx/records/core");
|
|
6974
6979
|
var import_design_system16 = require("@ai-matrx/design-system");
|
|
6975
6980
|
init_host();
|
|
6976
6981
|
var import_outbound_react2 = require("@ai-matrx/kit/outbound-react");
|
|
6977
6982
|
var import_jsx_runtime18 = require("react/jsx-runtime");
|
|
6978
6983
|
var WHOLE_VALUE_UNBOUND = "The whole text is kept as a file, and this screen has no way to open files yet.";
|
|
6979
6984
|
function wholeValueLine(pointer) {
|
|
6980
|
-
return `Open the whole text (${(0,
|
|
6985
|
+
return `Open the whole text (${(0, import_core10.wholeValueSize)(pointer)})`;
|
|
6981
6986
|
}
|
|
6982
6987
|
function WholeValueCell({ words, pointer }) {
|
|
6983
6988
|
const host = useRecordsUi();
|
|
@@ -6988,7 +6993,7 @@ function WholeValueCell({ words, pointer }) {
|
|
|
6988
6993
|
words,
|
|
6989
6994
|
"\u2026"
|
|
6990
6995
|
] }),
|
|
6991
|
-
href ? host.Link ? host.Link({ href, children: line, className: "shrink-0 text-xs text-primary underline-offset-2 hover:underline" }) : /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_outbound_react2.OutboundLink, { className: "shrink-0 text-xs text-primary underline-offset-2 hover:underline", href, children: line }) : /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("span", { className: "shrink-0 text-xs italic text-muted-foreground", title: WHOLE_VALUE_UNBOUND, children: `${(0,
|
|
6996
|
+
href ? host.Link ? host.Link({ href, children: line, className: "shrink-0 text-xs text-primary underline-offset-2 hover:underline" }) : /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_outbound_react2.OutboundLink, { className: "shrink-0 text-xs text-primary underline-offset-2 hover:underline", href, children: line }) : /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("span", { className: "shrink-0 text-xs italic text-muted-foreground", title: WHOLE_VALUE_UNBOUND, children: `${(0, import_core10.wholeValueSize)(pointer)} in a file` })
|
|
6992
6997
|
] });
|
|
6993
6998
|
}
|
|
6994
6999
|
|
|
@@ -7527,7 +7532,7 @@ function AttachmentControl({
|
|
|
7527
7532
|
}
|
|
7528
7533
|
|
|
7529
7534
|
// src/ReferenceChips.tsx
|
|
7530
|
-
var
|
|
7535
|
+
var import_records9 = require("@ai-matrx/records");
|
|
7531
7536
|
var import_design_system21 = require("@ai-matrx/design-system");
|
|
7532
7537
|
init_host();
|
|
7533
7538
|
init_kindValues();
|
|
@@ -7548,7 +7553,7 @@ function iconOf(pair) {
|
|
|
7548
7553
|
}
|
|
7549
7554
|
function referencesOf(field, value, kind, labels) {
|
|
7550
7555
|
if (kind === "entity_reference") {
|
|
7551
|
-
return (0,
|
|
7556
|
+
return (0, import_records9.entityRefsOf)(value).map((r) => ({ token: r.token, id: r.id, label: r.label }));
|
|
7552
7557
|
}
|
|
7553
7558
|
const ids = (Array.isArray(value) ? value : [value]).filter(isId).map(String);
|
|
7554
7559
|
const tableId = typeof field.relation_target === "string" ? field.relation_target : void 0;
|
|
@@ -7637,7 +7642,7 @@ function KindValueCell({
|
|
|
7637
7642
|
init_kindValues();
|
|
7638
7643
|
|
|
7639
7644
|
// src/formulaNames.ts
|
|
7640
|
-
var
|
|
7645
|
+
var import_records10 = require("@ai-matrx/records");
|
|
7641
7646
|
init_names();
|
|
7642
7647
|
function fieldRefsOf(expr) {
|
|
7643
7648
|
const out = [];
|
|
@@ -7688,14 +7693,14 @@ function formulaSourceArchived(field, document2) {
|
|
|
7688
7693
|
const keys = (field.config ?? {})[FORMULA_INPUT_KEYS];
|
|
7689
7694
|
if (!Array.isArray(keys) || !document2) return null;
|
|
7690
7695
|
for (const key of keys) {
|
|
7691
|
-
const state2 = (0,
|
|
7696
|
+
const state2 = (0, import_records10.sourceArchivedOf)(document2[String(key)]);
|
|
7692
7697
|
if (state2) return state2;
|
|
7693
7698
|
}
|
|
7694
7699
|
return null;
|
|
7695
7700
|
}
|
|
7696
7701
|
|
|
7697
7702
|
// src/values.tsx
|
|
7698
|
-
var
|
|
7703
|
+
var import_records17 = require("@ai-matrx/records");
|
|
7699
7704
|
var import_uuid4 = require("@ai-matrx/kit/uuid");
|
|
7700
7705
|
|
|
7701
7706
|
// src/userIds.ts
|
|
@@ -7745,7 +7750,7 @@ init_host();
|
|
|
7745
7750
|
|
|
7746
7751
|
// src/PersonPicker.tsx
|
|
7747
7752
|
var import_react35 = require("react");
|
|
7748
|
-
var
|
|
7753
|
+
var import_records11 = require("@ai-matrx/records");
|
|
7749
7754
|
var import_react36 = require("@ai-matrx/records/react");
|
|
7750
7755
|
var import_design_system22 = require("@ai-matrx/design-system");
|
|
7751
7756
|
init_PickOrAdd();
|
|
@@ -7833,7 +7838,7 @@ function PersonPicker({ field, value, onChange, disabled, id, className, autoOpe
|
|
|
7833
7838
|
cancelled = true;
|
|
7834
7839
|
};
|
|
7835
7840
|
}, [client, personTable, picked.length, people.length]);
|
|
7836
|
-
const listed = (0,
|
|
7841
|
+
const listed = (0, import_records11.rankTypedMatches)(members ?? [], search, memberName);
|
|
7837
7842
|
if (!membersPort || !client) {
|
|
7838
7843
|
return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("p", { className: (0, import_design_system22.cn)("text-xs text-muted-foreground", className), children: NO_MEMBERS_REASON });
|
|
7839
7844
|
}
|
|
@@ -8158,9 +8163,9 @@ function RecordsTable({ items }) {
|
|
|
8158
8163
|
const pictureFirst = [...keys].sort((a, b) => rank(a, items) - rank(b, items)).slice(0, TABLE_COLUMNS);
|
|
8159
8164
|
const shown2 = all ? items : items.slice(0, TABLE_ROWS);
|
|
8160
8165
|
return /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("div", { className: "min-w-0", "data-records-structured": "table", children: [
|
|
8161
|
-
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)("div", { className: "max-w-full overflow-x-auto rounded-md border border-border", children: /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("table", { className: "w-full border-collapse text-xs", children: [
|
|
8166
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)("div", { className: "max-w-full overflow-x-auto rounded-md border border-border", "data-records-structured-table-frame": "", children: /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("table", { className: "w-full border-collapse text-xs", children: [
|
|
8162
8167
|
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)("thead", { className: "bg-muted/60 text-left", children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("tr", { children: pictureFirst.map((k) => /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("th", { scope: "col", className: "whitespace-nowrap px-2 py-1 font-medium text-muted-foreground", children: keyWords(k) }, k)) }) }),
|
|
8163
|
-
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)("tbody", { children: shown2.map((item, i) => /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("tr", { className: "border-t border-border/60 align-top", children: pictureFirst.map((k) => /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("td", { className: "min-w-[
|
|
8168
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)("tbody", { children: shown2.map((item, i) => /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("tr", { className: "border-t border-border/60 align-top", children: pictureFirst.map((k) => /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("td", { className: "min-w-[4rem] max-w-[18rem] break-words px-2 py-1 [overflow-wrap:anywhere]", children: k in item ? /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(Nested, { value: item[k], keyName: k, dense: true }) : /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("span", { className: "text-muted-foreground", children: "\u2014" }) }, k)) }, i)) })
|
|
8164
8169
|
] }) }),
|
|
8165
8170
|
items.length > TABLE_ROWS ? /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(import_design_system26.Button, { type: "button", variant: "ghost", size: "sm", className: "mt-1 h-6 px-2 text-xs", onClick: (e) => {
|
|
8166
8171
|
stop(e);
|
|
@@ -8372,7 +8377,7 @@ function structuredNode(field, structured, room) {
|
|
|
8372
8377
|
return room === "cell" ? /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(StructuredCell, { structured, label }) : /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(StructuredValueView, { structured, label });
|
|
8373
8378
|
}
|
|
8374
8379
|
function renderValue(field, value, document2, labels, stillWaitingFor, look, room = "cell") {
|
|
8375
|
-
const archivedSource = (0,
|
|
8380
|
+
const archivedSource = (0, import_records17.sourceArchivedOf)(value);
|
|
8376
8381
|
if (archivedSource) return /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(SourceArchivedValue, { state: archivedSource });
|
|
8377
8382
|
const envelope = envelopeFor(document2, field.key);
|
|
8378
8383
|
if (envelope?.absent) {
|
|
@@ -8395,10 +8400,10 @@ function renderValue(field, value, document2, labels, stillWaitingFor, look, roo
|
|
|
8395
8400
|
return /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("span", { className: "text-muted-foreground", children: "\u2014" });
|
|
8396
8401
|
}
|
|
8397
8402
|
if (isSignatureField(field)) return /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(SignatureValue, { value, fieldKey: field.key, document: document2 });
|
|
8398
|
-
if ((0,
|
|
8403
|
+
if ((0, import_records17.isButtonField)(field)) return /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(ButtonValue, { field });
|
|
8399
8404
|
const newer = newerKindValue(field, value);
|
|
8400
8405
|
if (newer !== void 0) return newer;
|
|
8401
|
-
const whole = typeof value === "string" ? (0,
|
|
8406
|
+
const whole = typeof value === "string" ? (0, import_core15.wholeValueOf)(document2, field.key) : null;
|
|
8402
8407
|
if (whole) return /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(WholeValueCell, { words: value, pointer: whole });
|
|
8403
8408
|
const kind = editorKindFor(field);
|
|
8404
8409
|
if (kind === "relation" || kind === "entity_reference") {
|
|
@@ -8533,10 +8538,10 @@ function personWordsOf(kind, value) {
|
|
|
8533
8538
|
}
|
|
8534
8539
|
function scalarText(field, value, labels, stillWaitingFor) {
|
|
8535
8540
|
if (value === null || value === void 0) return "\u2014";
|
|
8536
|
-
if ((0,
|
|
8541
|
+
if ((0, import_records17.sourceArchivedOf)(value)) return SOURCE_ARCHIVED_WORDS;
|
|
8537
8542
|
if (isSignatureField(field)) return signatureWords(value) ?? "\u2014";
|
|
8538
|
-
if ((0,
|
|
8539
|
-
const newerWords = (0,
|
|
8543
|
+
if ((0, import_records17.autonumberPrefixOf)(field)) return (0, import_records17.autonumberWords)(field, value) ?? String(value);
|
|
8544
|
+
const newerWords = (0, import_records17.newerKindWords)(field, value);
|
|
8540
8545
|
if (newerWords !== null) return newerWords;
|
|
8541
8546
|
const kind = editorKindFor(field);
|
|
8542
8547
|
if (kind === "entity_reference") return entityReferenceText(value);
|
|
@@ -8571,7 +8576,7 @@ function scalarText(field, value, labels, stillWaitingFor) {
|
|
|
8571
8576
|
}
|
|
8572
8577
|
if (Array.isArray(value)) return value.length === 0 ? "" : structuredSummary(value);
|
|
8573
8578
|
if (typeof value === "object") return structuredOf(value) ? structuredSummary(value) : "\u2026";
|
|
8574
|
-
return String(value);
|
|
8579
|
+
return typeof value === "string" ? withoutLeadingBlank(value) : String(value);
|
|
8575
8580
|
}
|
|
8576
8581
|
|
|
8577
8582
|
// src/SourceArchivedNotice.tsx
|
|
@@ -8629,7 +8634,7 @@ function SourceArchivedNotice({ fieldId, tableId }) {
|
|
|
8629
8634
|
// src/Condition.tsx
|
|
8630
8635
|
var import_react52 = require("react");
|
|
8631
8636
|
var import_design_system29 = require("@ai-matrx/design-system");
|
|
8632
|
-
var
|
|
8637
|
+
var import_records18 = require("@ai-matrx/records");
|
|
8633
8638
|
init_PickOrAdd();
|
|
8634
8639
|
init_choiceLooks();
|
|
8635
8640
|
var import_react53 = require("@ai-matrx/records/react");
|
|
@@ -8780,7 +8785,7 @@ function ChoiceValue({ field, value, onChange }) {
|
|
|
8780
8785
|
void (0, askOnce_exports.fieldOptionsOnce)(client, field.id).then((got) => {
|
|
8781
8786
|
if (cancelled) return;
|
|
8782
8787
|
setChoices(
|
|
8783
|
-
got.ok ? (got.data ?? []).map((o) => ({ key: (0,
|
|
8788
|
+
got.ok ? (got.data ?? []).map((o) => ({ key: (0, import_records18.optionKey)(o), label: (0, import_records18.optionLabel)(o) ?? "" })).filter((c) => c.label !== "") : []
|
|
8784
8789
|
);
|
|
8785
8790
|
});
|
|
8786
8791
|
return () => {
|
|
@@ -8798,7 +8803,7 @@ function ChoiceValue({ field, value, onChange }) {
|
|
|
8798
8803
|
}
|
|
8799
8804
|
);
|
|
8800
8805
|
}
|
|
8801
|
-
const shown2 = (0,
|
|
8806
|
+
const shown2 = (0, import_records18.rankTypedMatches)(choices, search.trim(), (c) => c.label);
|
|
8802
8807
|
return /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("span", { className: "inline-flex min-w-0", "data-records-condition-choice": "", "data-pick-value": value, children: /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
8803
8808
|
PickOrAdd,
|
|
8804
8809
|
{
|
|
@@ -9232,7 +9237,7 @@ function ConditionGroup({
|
|
|
9232
9237
|
|
|
9233
9238
|
// src/FieldRetype.tsx
|
|
9234
9239
|
var import_react54 = require("react");
|
|
9235
|
-
var
|
|
9240
|
+
var import_records19 = require("@ai-matrx/records");
|
|
9236
9241
|
var import_react55 = require("@ai-matrx/records/react");
|
|
9237
9242
|
var import_design_system30 = require("@ai-matrx/design-system");
|
|
9238
9243
|
init_parity();
|
|
@@ -9434,7 +9439,7 @@ function FieldRetype({ field, tableId, onRetyped }) {
|
|
|
9434
9439
|
return;
|
|
9435
9440
|
}
|
|
9436
9441
|
const groups = rows.map((r) => ({ value: r.ids.map((id) => people.get(id)?.name ?? "").join(", "), count: 1 }));
|
|
9437
|
-
setPreview((0,
|
|
9442
|
+
setPreview((0, import_records19.previewRetype)({ type: to.behaviour, kind: to.kind }, groups, false));
|
|
9438
9443
|
}).catch((e) => {
|
|
9439
9444
|
if (cancelled) return;
|
|
9440
9445
|
setAsking(false);
|
|
@@ -9452,7 +9457,7 @@ function FieldRetype({ field, tableId, onRetyped }) {
|
|
|
9452
9457
|
return;
|
|
9453
9458
|
}
|
|
9454
9459
|
const groups = answer.data.map((row) => ({ value: row.groups[field.key] ?? null, count: row.row_count }));
|
|
9455
|
-
setPreview((0,
|
|
9460
|
+
setPreview((0, import_records19.previewRetype)({ type: to.behaviour, kind: to.kind }, groups, answer.data.length >= PREVIEW_GROUPS));
|
|
9456
9461
|
});
|
|
9457
9462
|
return () => {
|
|
9458
9463
|
cancelled = true;
|
|
@@ -9564,7 +9569,7 @@ function FieldRetype({ field, tableId, onRetyped }) {
|
|
|
9564
9569
|
|
|
9565
9570
|
// src/FieldRulePreview.tsx
|
|
9566
9571
|
var import_react56 = require("react");
|
|
9567
|
-
var
|
|
9572
|
+
var import_records20 = require("@ai-matrx/records");
|
|
9568
9573
|
var import_react57 = require("@ai-matrx/records/react");
|
|
9569
9574
|
init_Refusal();
|
|
9570
9575
|
init_names();
|
|
@@ -9605,7 +9610,7 @@ function FieldRulePreview({ field, tableId, rules }) {
|
|
|
9605
9610
|
}
|
|
9606
9611
|
const numbers = holdsNumbers(field);
|
|
9607
9612
|
const groups = answer.data.map((row) => ({ value: groupValue(row.groups[field.key] ?? null, numbers), count: row.row_count }));
|
|
9608
|
-
setPreview((0,
|
|
9613
|
+
setPreview((0, import_records20.previewRuleChange)(latest.current, groups, answer.data.length >= PREVIEW_GROUPS2));
|
|
9609
9614
|
});
|
|
9610
9615
|
}, 300);
|
|
9611
9616
|
return () => {
|
|
@@ -9719,7 +9724,7 @@ function choiceLookForNewList(multi, rows) {
|
|
|
9719
9724
|
}
|
|
9720
9725
|
|
|
9721
9726
|
// src/NewerKindQuestions.tsx
|
|
9722
|
-
var
|
|
9727
|
+
var import_records21 = require("@ai-matrx/records");
|
|
9723
9728
|
var import_design_system31 = require("@ai-matrx/design-system");
|
|
9724
9729
|
var import_jsx_runtime34 = require("react/jsx-runtime");
|
|
9725
9730
|
var STATUS_STARTING_CHOICES = [
|
|
@@ -9740,7 +9745,7 @@ function statusGroupRows(field, rows, keyOfId, changed) {
|
|
|
9740
9745
|
if (words === "") continue;
|
|
9741
9746
|
const ref = r.id ?? words;
|
|
9742
9747
|
const key = r.id ? keyOfId[r.id] : void 0;
|
|
9743
|
-
const held = field && key ? (0,
|
|
9748
|
+
const held = field && key ? (0, import_records21.statusGroupOf)(field, key) : void 0;
|
|
9744
9749
|
out.push({ ref, words, group: changed[ref] ?? held ?? guessStatusGroup(words) });
|
|
9745
9750
|
}
|
|
9746
9751
|
return out;
|
|
@@ -9756,10 +9761,10 @@ function StatusGroupsQuestion({
|
|
|
9756
9761
|
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)("span", { className: "min-w-0 flex-1 truncate text-sm", children: r.words }),
|
|
9757
9762
|
/* @__PURE__ */ (0, import_jsx_runtime34.jsxs)(import_design_system31.Select, { value: r.group, onValueChange: (next) => onGroup(r.ref, next), children: [
|
|
9758
9763
|
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)(import_design_system31.SelectTrigger, { size: "sm", className: "w-36", "aria-label": `Group for ${r.words}`, children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(import_design_system31.SelectValue, {}) }),
|
|
9759
|
-
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)(import_design_system31.SelectContent, { children:
|
|
9764
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)(import_design_system31.SelectContent, { children: import_records21.STATUS_GROUPS.map((g) => /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)(import_design_system31.SelectItem, { value: g, children: [
|
|
9760
9765
|
STATUS_GROUP_MARK[g],
|
|
9761
9766
|
" ",
|
|
9762
|
-
|
|
9767
|
+
import_records21.STATUS_GROUP_WORDS[g]
|
|
9763
9768
|
] }, g)) })
|
|
9764
9769
|
] })
|
|
9765
9770
|
] }, r.ref))
|
|
@@ -9797,7 +9802,7 @@ function BarcodeSymbologyQuestion({ value, onChange }) {
|
|
|
9797
9802
|
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)(import_design_system31.SelectTrigger, { size: "sm", "aria-label": "Code type", children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(import_design_system31.SelectValue, {}) }),
|
|
9798
9803
|
/* @__PURE__ */ (0, import_jsx_runtime34.jsxs)(import_design_system31.SelectContent, { children: [
|
|
9799
9804
|
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)(import_design_system31.SelectItem, { value: "any", children: "Any code" }),
|
|
9800
|
-
|
|
9805
|
+
import_records21.BARCODE_SYMBOLOGIES.map((s) => /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(import_design_system31.SelectItem, { value: s, children: SYMBOLOGY_WORDS[s] }, s))
|
|
9801
9806
|
] })
|
|
9802
9807
|
] })
|
|
9803
9808
|
] });
|
|
@@ -10122,21 +10127,21 @@ function nextFieldSort(fields) {
|
|
|
10122
10127
|
|
|
10123
10128
|
// src/FieldEditor.tsx
|
|
10124
10129
|
init_enumLabels();
|
|
10125
|
-
var
|
|
10130
|
+
var import_records24 = require("@ai-matrx/records");
|
|
10126
10131
|
|
|
10127
10132
|
// src/ButtonSettings.tsx
|
|
10128
10133
|
var import_react58 = require("react");
|
|
10129
10134
|
var import_design_system34 = require("@ai-matrx/design-system");
|
|
10130
10135
|
var import_data_table5 = require("@ai-matrx/design-system/data-table");
|
|
10131
|
-
var
|
|
10136
|
+
var import_records23 = require("@ai-matrx/records");
|
|
10132
10137
|
var import_react59 = require("@ai-matrx/records/react");
|
|
10133
10138
|
|
|
10134
10139
|
// src/AccentSwatches.tsx
|
|
10135
|
-
var
|
|
10140
|
+
var import_records22 = require("@ai-matrx/records");
|
|
10136
10141
|
var import_design_system33 = require("@ai-matrx/design-system");
|
|
10137
10142
|
var import_data_table4 = require("@ai-matrx/design-system/data-table");
|
|
10138
10143
|
var import_jsx_runtime36 = require("react/jsx-runtime");
|
|
10139
|
-
function AccentSwatches({ value, onChange, options =
|
|
10144
|
+
function AccentSwatches({ value, onChange, options = import_records22.PORTAL_ACCENTS, noneLabel = "App colour" }) {
|
|
10140
10145
|
return /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("div", { className: "flex flex-wrap gap-1.5", role: "radiogroup", "aria-label": "Colour", children: [
|
|
10141
10146
|
/* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
|
|
10142
10147
|
"button",
|
|
@@ -10182,7 +10187,7 @@ var DOES_WORDS = {
|
|
|
10182
10187
|
};
|
|
10183
10188
|
function buttonUrlInWords(url, fields) {
|
|
10184
10189
|
let out = url;
|
|
10185
|
-
for (const id of (0,
|
|
10190
|
+
for (const id of (0, import_records23.buttonUrlPlaceholders)(url)) {
|
|
10186
10191
|
const f = fields.find((x) => x.id === id || x.key === id);
|
|
10187
10192
|
if (f) out = out.split(`{{${id}}}`).join(`{${fieldName(f)}}`);
|
|
10188
10193
|
}
|
|
@@ -10277,7 +10282,7 @@ function ButtonSettingsEditor({
|
|
|
10277
10282
|
}
|
|
10278
10283
|
) : null
|
|
10279
10284
|
] }),
|
|
10280
|
-
value.url && (0,
|
|
10285
|
+
value.url && (0, import_records23.buttonUrlPlaceholders)(value.url).length > 0 ? /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("p", { className: "truncate text-[11px] text-muted-foreground", "data-records-button-url-words": "", children: buttonUrlInWords(value.url, fields) }) : null
|
|
10281
10286
|
] }) : null,
|
|
10282
10287
|
value.do === "run_action" ? !tableId ? /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("p", { className: "text-xs text-muted-foreground", children: "Row actions belong to a table" }) : actionsRefused ? /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(RefusalLine, { error: actionsRefused }) : /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)("div", { className: "flex flex-col gap-2", "data-records-button-action": "", children: [
|
|
10283
10288
|
actions === null || actions.length > 0 ? /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
|
|
@@ -10383,11 +10388,11 @@ function NewRowAction({
|
|
|
10383
10388
|
}
|
|
10384
10389
|
|
|
10385
10390
|
// src/FieldEditor.tsx
|
|
10386
|
-
var
|
|
10391
|
+
var import_records25 = require("@ai-matrx/records");
|
|
10387
10392
|
var import_jsx_runtime38 = require("react/jsx-runtime");
|
|
10388
10393
|
var RULE_KINDS = FIELD_RULE_KIND_VALUES.map((kind) => ({ kind, label: FIELD_RULE_KIND_LABEL[kind] }));
|
|
10389
|
-
var SENSITIVITIES =
|
|
10390
|
-
var AGENT_VISIBILITY =
|
|
10394
|
+
var SENSITIVITIES = import_records25.FIELD_SENSITIVITIES.map((value) => ({ value, label: FIELD_SENSITIVITY_LABEL[value] }));
|
|
10395
|
+
var AGENT_VISIBILITY = import_records25.CONTEXT_POLICIES.map((value) => ({ value, label: CONTEXT_POLICY_LABEL[value] }));
|
|
10391
10396
|
var ROLLUP_OPERATIONS = ROLLUP_AGG_VALUES.map((value) => ({
|
|
10392
10397
|
value,
|
|
10393
10398
|
label: ROLLUP_AGG_LABEL[value]
|
|
@@ -10400,7 +10405,7 @@ var FORMULA_OPERATIONS = FORMULA_OP_VALUES.map((value) => ({
|
|
|
10400
10405
|
label: FORMULA_OP_LABEL[value],
|
|
10401
10406
|
joins: FORMULA_OP_JOINS[value]
|
|
10402
10407
|
}));
|
|
10403
|
-
var STORE_BEHAVIOUR = new Map(
|
|
10408
|
+
var STORE_BEHAVIOUR = new Map(import_records25.DECLARABLE_FIELD_KINDS.map((row) => [row.kind, row.behavior]));
|
|
10404
10409
|
function holdsAValueOnAStandardTable(kind) {
|
|
10405
10410
|
if (isSystemFieldKind(kind)) return false;
|
|
10406
10411
|
const behaviour = STORE_BEHAVIOUR.get(kind);
|
|
@@ -10506,20 +10511,20 @@ function FieldEditor(props) {
|
|
|
10506
10511
|
const [contextPolicy, setContextPolicy] = (0, import_react60.useState)(String(start?.context_policy ?? "include"));
|
|
10507
10512
|
const [rules, setRules] = (0, import_react60.useState)(start?.rules ?? []);
|
|
10508
10513
|
const [startsWith, setStartsWith] = (0, import_react60.useState)(start?.default ?? null);
|
|
10509
|
-
const [ratingMax, setRatingMax] = (0, import_react60.useState)(() => start ? (0,
|
|
10514
|
+
const [ratingMax, setRatingMax] = (0, import_react60.useState)(() => start ? (0, import_records25.ratingMaxOf)(start) : 5);
|
|
10510
10515
|
const savedRules = (0, import_react60.useMemo)(
|
|
10511
|
-
() => field ? type === "rating" ? (0,
|
|
10516
|
+
() => field ? type === "rating" ? (0, import_records25.rulesWithTopStar)(field.rules ?? [], (0, import_records25.ratingMaxOf)(field)) : field.rules ?? [] : [],
|
|
10512
10517
|
[field, type]
|
|
10513
10518
|
);
|
|
10514
|
-
const editedRules = (0, import_react60.useMemo)(() => type === "rating" ? (0,
|
|
10519
|
+
const editedRules = (0, import_react60.useMemo)(() => type === "rating" ? (0, import_records25.rulesWithTopStar)(rules, ratingMax) : rules, [type, rules, ratingMax]);
|
|
10515
10520
|
const [statusGroups, setStatusGroups] = (0, import_react60.useState)({});
|
|
10516
10521
|
const [statusKeys, setStatusKeys] = (0, import_react60.useState)({});
|
|
10517
10522
|
const [symbology, setSymbology] = (0, import_react60.useState)(String(start?.config?.["symbology"] ?? ""));
|
|
10518
10523
|
const descriptionStart = String(start?.config?.["description"] ?? "");
|
|
10519
10524
|
const [description, setDescription] = (0, import_react60.useState)(descriptionStart);
|
|
10520
|
-
const buttonStart = (0, import_react60.useMemo)(() => (0,
|
|
10525
|
+
const buttonStart = (0, import_react60.useMemo)(() => (0, import_records24.buttonOf)(start) ?? { label: "" }, [start]);
|
|
10521
10526
|
const [buttonSettings, setButtonSettings] = (0, import_react60.useState)(buttonStart);
|
|
10522
|
-
const prefixStart = (0,
|
|
10527
|
+
const prefixStart = (0, import_records24.autonumberPrefixOf)(start);
|
|
10523
10528
|
const [numberPrefix, setNumberPrefix] = (0, import_react60.useState)(prefixStart);
|
|
10524
10529
|
const dependencyStart = start?.config?.["dependency"] === true;
|
|
10525
10530
|
const [dependency, setDependency] = (0, import_react60.useState)(dependencyStart);
|
|
@@ -10527,7 +10532,7 @@ function FieldEditor(props) {
|
|
|
10527
10532
|
if (!field || type !== "status") return;
|
|
10528
10533
|
let live = true;
|
|
10529
10534
|
void client.fieldOptions({ field_id: field.id }).then((got) => {
|
|
10530
|
-
if (live && got.ok) setStatusKeys(Object.fromEntries((got.data ?? []).map((o) => [String(o.id), (0,
|
|
10535
|
+
if (live && got.ok) setStatusKeys(Object.fromEntries((got.data ?? []).map((o) => [String(o.id), (0, import_records25.optionKey)(o)])));
|
|
10531
10536
|
});
|
|
10532
10537
|
return () => {
|
|
10533
10538
|
live = false;
|
|
@@ -10650,7 +10655,7 @@ function FieldEditor(props) {
|
|
|
10650
10655
|
const nameTaken = columnNameTakenBy(label, others.map(fieldName));
|
|
10651
10656
|
const nameLine = nameTaken ? columnNameTakenLine(nameTaken, noun) : columnNameProblemLine(label, noun);
|
|
10652
10657
|
const listsChoices = type === "select" || type === "multi_select" || type === "status";
|
|
10653
|
-
const buttonMissing = type === "button" && buttonSettings.do ? (0,
|
|
10658
|
+
const buttonMissing = type === "button" && buttonSettings.do ? (0, import_records24.buttonNeeds)(buttonSettings) : null;
|
|
10654
10659
|
const missing = buttonMissing ?? (editing ? formulaMissing ?? (listsChoices ? whatTheChoiceListIsMissing(choiceList) : null) : formulaMissing ?? (listsChoices ? whatTheChoiceListIsMissing(newChoices) : null) ?? (type === "formula" && formulaWritten ? null : whatIsMissing(
|
|
10655
10660
|
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 }
|
|
10656
10661
|
)));
|
|
@@ -10692,7 +10697,7 @@ function FieldEditor(props) {
|
|
|
10692
10697
|
...statusGroupsChanged ? { status_groups: statusGroupsSent } : {},
|
|
10693
10698
|
// V11 #4/#10: a rating's top star goes as `max`, the word custom.field_update now takes the way
|
|
10694
10699
|
// custom.field_declare does; the store writes the max Rule and sets aside any score above it.
|
|
10695
|
-
...type === "rating" && ratingMax !== (0,
|
|
10700
|
+
...type === "rating" && ratingMax !== (0, import_records25.ratingMaxOf)(field) ? { max: ratingMax } : {},
|
|
10696
10701
|
...type === "barcode" && symbology !== String(field.config?.["symbology"] ?? "") ? { symbology: symbology === "" ? null : symbology } : {},
|
|
10697
10702
|
...type === "button" && JSON.stringify(buttonSettings) !== JSON.stringify(buttonStart) ? { button: buttonSettings } : {},
|
|
10698
10703
|
...field.type === "relation" && dependency !== dependencyStart ? { dependency } : {},
|
|
@@ -10727,7 +10732,7 @@ function FieldEditor(props) {
|
|
|
10727
10732
|
return;
|
|
10728
10733
|
}
|
|
10729
10734
|
(0, import_react61.tableShapeChanged)(tableId);
|
|
10730
|
-
for (const c of done.data.undo.cells_back) (0,
|
|
10735
|
+
for (const c of done.data.undo.cells_back) (0, import_core16.announceRecordChanged)(c.record_id);
|
|
10731
10736
|
const n = done.data.rehomed.reduce((sum, r) => sum + r.records, 0);
|
|
10732
10737
|
setRehome({});
|
|
10733
10738
|
setRehomed({ said: `Saved. ${n} ${n === 1 ? "record was" : "records were"} changed with the choices.`, undo: done.data.undo });
|
|
@@ -11241,7 +11246,7 @@ function FieldEditor(props) {
|
|
|
11241
11246
|
return;
|
|
11242
11247
|
}
|
|
11243
11248
|
(0, import_react61.tableShapeChanged)(tableId);
|
|
11244
|
-
for (const c of undo.cells_back) (0,
|
|
11249
|
+
for (const c of undo.cells_back) (0, import_core16.announceRecordChanged)(c.record_id);
|
|
11245
11250
|
setChoiceList(null);
|
|
11246
11251
|
setChoiceListStart(null);
|
|
11247
11252
|
setRehomed({ said: "Undone. The choices and the records that held them are back as they were.", undo: null });
|
|
@@ -11702,17 +11707,44 @@ function buttonPressWords(label, pressed) {
|
|
|
11702
11707
|
}
|
|
11703
11708
|
var POLL_EVERY_MS = 1200;
|
|
11704
11709
|
var POLL_FOR_MS = 12e4;
|
|
11705
|
-
|
|
11710
|
+
var RUN_BOOKKEEPING = /* @__PURE__ */ new Set(["run_id", "conversation_id"]);
|
|
11711
|
+
function answerOf(output) {
|
|
11712
|
+
const raw = (output ?? "").trim();
|
|
11713
|
+
if (raw === "") return { words: "" };
|
|
11714
|
+
let parsed;
|
|
11715
|
+
try {
|
|
11716
|
+
parsed = JSON.parse(raw);
|
|
11717
|
+
} catch {
|
|
11718
|
+
return { words: raw };
|
|
11719
|
+
}
|
|
11720
|
+
if (typeof parsed === "string") return { words: parsed.trim() };
|
|
11721
|
+
if (typeof parsed === "object" && parsed !== null && !Array.isArray(parsed)) {
|
|
11722
|
+
const shown2 = Object.fromEntries(Object.entries(parsed).filter(([k]) => !RUN_BOOKKEEPING.has(k)));
|
|
11723
|
+
const keys = Object.keys(shown2);
|
|
11724
|
+
if (keys.length === 1 && typeof shown2.text === "string") return { words: shown2.text.trim() };
|
|
11725
|
+
const value2 = structuredOf(shown2);
|
|
11726
|
+
return value2 ? { words: "", value: value2 } : { words: raw };
|
|
11727
|
+
}
|
|
11728
|
+
const value = structuredOf(parsed);
|
|
11729
|
+
return value ? { words: "", value } : { words: raw };
|
|
11730
|
+
}
|
|
11731
|
+
function runAnswer(label, run) {
|
|
11706
11732
|
const steps = run.steps ?? [];
|
|
11707
11733
|
const failedStep = [...steps].reverse().find((s) => s.status === "failed");
|
|
11708
|
-
if (run.status === "failed")
|
|
11709
|
-
|
|
11710
|
-
|
|
11734
|
+
if (run.status === "failed") {
|
|
11735
|
+
const failed = answerOf(failedStep?.output_text).words || failedStep?.says;
|
|
11736
|
+
return { words: [failed, run.says].filter((t, i, all) => t && all.indexOf(t) === i).join(" ") || `${label} failed.` };
|
|
11737
|
+
}
|
|
11738
|
+
for (const step of [...steps].reverse()) {
|
|
11739
|
+
const answered = answerOf(step.output_text);
|
|
11740
|
+
if (answered.words !== "" || answered.value) return answered;
|
|
11741
|
+
}
|
|
11742
|
+
return { words: run.says || `${label} ran.` };
|
|
11711
11743
|
}
|
|
11712
11744
|
var stop2 = (event) => event.stopPropagation();
|
|
11713
11745
|
function ButtonValue({ field, recordId, inCell }) {
|
|
11714
11746
|
const client = (0, import_react63.useOptionalRecordsClient)();
|
|
11715
|
-
const b = (0,
|
|
11747
|
+
const b = (0, import_records26.buttonOf)(field);
|
|
11716
11748
|
const [busy, setBusy] = (0, import_react62.useState)(false);
|
|
11717
11749
|
const [said2, setSaid] = (0, import_react62.useState)(null);
|
|
11718
11750
|
const [settingUp, setSettingUp] = (0, import_react62.useState)(false);
|
|
@@ -11720,7 +11752,7 @@ function ButtonValue({ field, recordId, inCell }) {
|
|
|
11720
11752
|
(0, import_react62.useEffect)(() => () => void (waitingOn.current += 1), []);
|
|
11721
11753
|
if (!b) return null;
|
|
11722
11754
|
const color = (0, import_data_table6.isStyleColor)(b.color) ? import_data_table6.CHOICE_CHIP_CLASS[b.color] : import_data_table6.NEUTRAL_CHIP_CLASS;
|
|
11723
|
-
const needs = (0,
|
|
11755
|
+
const needs = (0, import_records26.buttonNeeds)(b);
|
|
11724
11756
|
const tableId = field.entity_definition_id;
|
|
11725
11757
|
const press = async () => {
|
|
11726
11758
|
if (!client || !recordId) return setSaid({ kind: "public" });
|
|
@@ -11754,7 +11786,8 @@ function ButtonValue({ field, recordId, inCell }) {
|
|
|
11754
11786
|
const run = runs.data.runs.find((r) => r.run_id === pressed.run_id);
|
|
11755
11787
|
if (run && run.status !== "waiting") {
|
|
11756
11788
|
setBusy(false);
|
|
11757
|
-
|
|
11789
|
+
const answer = runAnswer(b.label, run);
|
|
11790
|
+
return setSaid(run.status === "ran" ? { kind: "ran", says: answer.words, value: answer.value } : { kind: "failed", says: answer.words });
|
|
11758
11791
|
}
|
|
11759
11792
|
if (Date.now() > until) {
|
|
11760
11793
|
setBusy(false);
|
|
@@ -11803,7 +11836,8 @@ function ButtonValue({ field, recordId, inCell }) {
|
|
|
11803
11836
|
said2?.kind === "waiting" ? /* @__PURE__ */ (0, import_jsx_runtime39.jsx)("p", { className: "matrx-shimmer rounded px-1 py-0.5", role: "status", "aria-live": "polite", children: said2.says }) : null,
|
|
11804
11837
|
said2?.kind === "failed" ? /* @__PURE__ */ (0, import_jsx_runtime39.jsx)("p", { className: "break-words text-destructive", role: "alert", children: said2.says }) : null,
|
|
11805
11838
|
said2?.kind === "public" ? /* @__PURE__ */ (0, import_jsx_runtime39.jsx)("p", { children: "Buttons run for signed-in people." }) : null,
|
|
11806
|
-
said2?.kind === "ran" ? /* @__PURE__ */ (0, import_jsx_runtime39.jsxs)("
|
|
11839
|
+
said2?.kind === "ran" ? /* @__PURE__ */ (0, import_jsx_runtime39.jsxs)("div", { className: "break-words", children: [
|
|
11840
|
+
said2.value ? /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(StructuredValueView, { structured: said2.value, label: b.label }) : null,
|
|
11807
11841
|
said2.says,
|
|
11808
11842
|
" ",
|
|
11809
11843
|
said2.link ? /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(import_outbound_react7.OutboundLink, { href: said2.link, className: "text-primary underline", children: said2.link }) : null
|
|
@@ -12012,7 +12046,7 @@ function formatControl(args) {
|
|
|
12012
12046
|
// src/typedDateHelper.tsx
|
|
12013
12047
|
var import_react66 = require("react");
|
|
12014
12048
|
var import_design_system38 = require("@ai-matrx/design-system");
|
|
12015
|
-
var
|
|
12049
|
+
var import_records27 = require("@ai-matrx/records");
|
|
12016
12050
|
var import_jsx_runtime42 = require("react/jsx-runtime");
|
|
12017
12051
|
var WEEK = ["Su", "Mo", "Tu", "We", "Th", "Fr", "Sa"];
|
|
12018
12052
|
var MONTHS = ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"];
|
|
@@ -12021,12 +12055,12 @@ function pad(n) {
|
|
|
12021
12055
|
}
|
|
12022
12056
|
function readBox(text, kind) {
|
|
12023
12057
|
if (kind === "time") {
|
|
12024
|
-
const t = (0,
|
|
12058
|
+
const t = (0, import_records27.readTypedTime)(text);
|
|
12025
12059
|
if (!t.ok) return { day: null, time: null };
|
|
12026
12060
|
const [h, m] = t.value.split(":").map(Number);
|
|
12027
12061
|
return { day: null, time: { h, m } };
|
|
12028
12062
|
}
|
|
12029
|
-
const read = (0,
|
|
12063
|
+
const read = (0, import_records27.readTypedDate)(text, { withTime: kind === "datetime" });
|
|
12030
12064
|
if (!read.ok) return { day: null, time: null };
|
|
12031
12065
|
if (kind === "datetime" && read.instant) {
|
|
12032
12066
|
const at = new Date(read.instant);
|
|
@@ -12035,10 +12069,10 @@ function readBox(text, kind) {
|
|
|
12035
12069
|
return { day: read.day, time: null };
|
|
12036
12070
|
}
|
|
12037
12071
|
function wordsFor2(kind, day, time) {
|
|
12038
|
-
if (kind === "time") return time ? (0,
|
|
12072
|
+
if (kind === "time") return time ? (0, import_records27.typedTimeText)(time.h, time.m) : "";
|
|
12039
12073
|
if (!day) return "";
|
|
12040
|
-
const dayText = (0,
|
|
12041
|
-
return kind === "datetime" && time ? `${dayText} ${(0,
|
|
12074
|
+
const dayText = (0, import_records27.typedDateText)(day);
|
|
12075
|
+
return kind === "datetime" && time ? `${dayText} ${(0, import_records27.typedTimeText)(time.h, time.m)}` : dayText;
|
|
12042
12076
|
}
|
|
12043
12077
|
var keepFocus = { onMouseDown: (e) => e.preventDefault(), tabIndex: -1 };
|
|
12044
12078
|
function CalendarGlyph() {
|
|
@@ -12160,7 +12194,7 @@ function TypedDateHelper({
|
|
|
12160
12194
|
held.time && held.time.h === t.h && held.time.m === t.m ? "bg-primary text-primary-foreground" : ""
|
|
12161
12195
|
),
|
|
12162
12196
|
onClick: () => pickTime(t),
|
|
12163
|
-
children: (0,
|
|
12197
|
+
children: (0, import_records27.typedTimeText)(t.h, t.m)
|
|
12164
12198
|
},
|
|
12165
12199
|
`${t.h}:${t.m}`
|
|
12166
12200
|
)) })
|
|
@@ -12231,21 +12265,21 @@ function judgeTyped(field, text, choices, nudge) {
|
|
|
12231
12265
|
const format = formatForField(field);
|
|
12232
12266
|
if (trimmed === "") return { value: null };
|
|
12233
12267
|
if (format && format.id === "time") {
|
|
12234
|
-
const read2 = (0,
|
|
12268
|
+
const read2 = (0, import_records28.readTypedTime)(trimmed);
|
|
12235
12269
|
return read2.ok ? { value: read2.value } : { refusal: SHORT_REFUSAL.time, why: `${fieldName(field)} holds a time of day, and ${read2.why}` };
|
|
12236
12270
|
}
|
|
12237
12271
|
if (kind === "select" || kind === "multi_select") {
|
|
12238
12272
|
if (!choices || nudge === null) return null;
|
|
12239
12273
|
const several = field.multi || kind === "multi_select";
|
|
12240
12274
|
const words = several ? trimmed.split(/\s*[,;\n]\s*/).filter(Boolean) : [trimmed];
|
|
12241
|
-
const allowOther = (0,
|
|
12275
|
+
const allowOther = (0, import_records28.allowsOtherValues)(field);
|
|
12242
12276
|
const parts = [];
|
|
12243
12277
|
const add = [];
|
|
12244
12278
|
const ask = [];
|
|
12245
12279
|
const notChoices = [];
|
|
12246
12280
|
let keepOffered = allowOther;
|
|
12247
12281
|
for (const word of words) {
|
|
12248
|
-
const decided = (0,
|
|
12282
|
+
const decided = (0, import_records28.decideTypedChoice)({ words: word, options: choices, allowOther, nudge });
|
|
12249
12283
|
if (decided.decision === "empty") continue;
|
|
12250
12284
|
if (decided.decision === "chosen") parts.push(decided.key);
|
|
12251
12285
|
else {
|
|
@@ -12278,7 +12312,7 @@ function judgeTyped(field, text, choices, nudge) {
|
|
|
12278
12312
|
return usual && digits.length >= 7 && digits.length <= 20 ? { value: trimmed } : { refusal: SHORT_REFUSAL.phone };
|
|
12279
12313
|
}
|
|
12280
12314
|
const showsAsPercent = Boolean(format && (format.id === "percent" || format.id === "progress"));
|
|
12281
|
-
const read = (0,
|
|
12315
|
+
const read = (0, import_records28.coerceTypedAnswer)(field, text, { label: fieldName(field), showsAsPercent });
|
|
12282
12316
|
if ("refusal" in read) {
|
|
12283
12317
|
if (kind === "email" || kind === "url") return { refusal: SHORT_REFUSAL[kind] };
|
|
12284
12318
|
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;
|
|
@@ -12299,12 +12333,12 @@ function openingText(field, value) {
|
|
|
12299
12333
|
if (value === null || value === void 0 || value === "") return "";
|
|
12300
12334
|
const helper = dateHelperKind(field, value);
|
|
12301
12335
|
if (helper === "time") {
|
|
12302
|
-
const read = (0,
|
|
12336
|
+
const read = (0, import_records28.readTypedTime)(String(value));
|
|
12303
12337
|
if (!read.ok) return String(value);
|
|
12304
12338
|
const [h, m] = read.value.split(":").map(Number);
|
|
12305
|
-
return (0,
|
|
12339
|
+
return (0, import_records28.typedTimeText)(h, m);
|
|
12306
12340
|
}
|
|
12307
|
-
if (helper) return (0,
|
|
12341
|
+
if (helper) return (0, import_records28.typedDateText)(value, { withTime: helper === "datetime" });
|
|
12308
12342
|
const format = formatForField(field);
|
|
12309
12343
|
return format ? typedText(format, value) : String(value);
|
|
12310
12344
|
}
|
|
@@ -12393,7 +12427,7 @@ function TypedTextControl({ field, value, onChange, disabled, id, onCommit, onCa
|
|
|
12393
12427
|
" ",
|
|
12394
12428
|
needsChoices ? String(
|
|
12395
12429
|
(Array.isArray(withoutAddition(judged.value).value) ? withoutAddition(judged.value).value : [withoutAddition(judged.value).value]).map((k) => {
|
|
12396
|
-
const option = choices?.find((o) => (0,
|
|
12430
|
+
const option = choices?.find((o) => (0, import_records28.optionKey)(o) === k);
|
|
12397
12431
|
return option ? recordName(option.data, null, String(k)) : String(k);
|
|
12398
12432
|
}).join(", ")
|
|
12399
12433
|
) : (() => {
|
|
@@ -12414,7 +12448,7 @@ function FieldControl({ field, value, onChange, disabled, id, autoOpen, onClose,
|
|
|
12414
12448
|
const ownDetails = (0, import_react68.useOptionalRecordsClient)() === null;
|
|
12415
12449
|
if (isTypedDraft(value)) return /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(TypedTextControl, { field, value, onChange, disabled, id: inputId, onCommit, onCancel });
|
|
12416
12450
|
if (isSignatureField(field)) return /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(SignaturePad, { id: inputId, value, onChange, disabled });
|
|
12417
|
-
if ((0,
|
|
12451
|
+
if ((0, import_records28.isButtonField)(field)) return /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(ButtonValue, { field });
|
|
12418
12452
|
const newerControl = newerKindControl({ field, value, onChange, disabled, id: inputId });
|
|
12419
12453
|
if (newerControl !== void 0) return newerControl;
|
|
12420
12454
|
const format = formatForField(field);
|
|
@@ -12584,7 +12618,7 @@ function TypedWordsControl({ field, value, onChange, disabled, id }) {
|
|
|
12584
12618
|
function typedDatePlaceholder(helper) {
|
|
12585
12619
|
const time = "h:mm AM";
|
|
12586
12620
|
if (helper === "time") return time;
|
|
12587
|
-
const pattern = (0,
|
|
12621
|
+
const pattern = (0, import_records28.typedDateText)("2026-11-22").replace("2026", "YYYY").replace("11", "MM").replace("22", "DD");
|
|
12588
12622
|
return helper === "datetime" ? `${pattern} ${time}` : pattern;
|
|
12589
12623
|
}
|
|
12590
12624
|
function CheckboxControl({ field, value, onChange, disabled, id }) {
|
|
@@ -12754,15 +12788,15 @@ function OptionControl({ field, value, onChange, disabled, id, autoOpen, onClose
|
|
|
12754
12788
|
ChoiceAnswer,
|
|
12755
12789
|
{
|
|
12756
12790
|
field,
|
|
12757
|
-
choices: options.map((option) => ({ key: (0,
|
|
12791
|
+
choices: options.map((option) => ({ key: (0, import_records28.optionKey)(option), label: titled(option) })),
|
|
12758
12792
|
value,
|
|
12759
12793
|
onChange,
|
|
12760
12794
|
disabled,
|
|
12761
12795
|
id,
|
|
12762
12796
|
onChosen,
|
|
12763
12797
|
isChosen: (choice, v) => {
|
|
12764
|
-
const option = options.find((o) => (0,
|
|
12765
|
-
return option ? (0,
|
|
12798
|
+
const option = options.find((o) => (0, import_records28.optionKey)(o) === choice.key);
|
|
12799
|
+
return option ? (0, import_records28.isTheChosen)(option, v) : false;
|
|
12766
12800
|
}
|
|
12767
12801
|
}
|
|
12768
12802
|
);
|
|
@@ -12795,7 +12829,7 @@ function OptionControl({ field, value, onChange, disabled, id, autoOpen, onClose
|
|
|
12795
12829
|
onCancel,
|
|
12796
12830
|
initialSearch,
|
|
12797
12831
|
addsChoices,
|
|
12798
|
-
allowOther: (0,
|
|
12832
|
+
allowOther: (0, import_records28.allowsOtherValues)(field),
|
|
12799
12833
|
onChoicesChanged: () => {
|
|
12800
12834
|
if (client) (0, askOnce_exports.forgetAsked)(client, `field_options:${field.id}`);
|
|
12801
12835
|
setReread((n) => n + 1);
|
|
@@ -12809,19 +12843,19 @@ function OptionControl({ field, value, onChange, disabled, id, autoOpen, onClose
|
|
|
12809
12843
|
}
|
|
12810
12844
|
const titleOf = (option) => recordName(option.data, null, "Unnamed choice");
|
|
12811
12845
|
if (field.multi) {
|
|
12812
|
-
const chosen = options.filter((option) => (0,
|
|
12813
|
-
const picked = new Set(chosen.map((option) => (0,
|
|
12846
|
+
const chosen = options.filter((option) => (0, import_records28.choiceValuesOf)(value).some((v) => (0, import_records28.isTheChosen)(option, v)));
|
|
12847
|
+
const picked = new Set(chosen.map((option) => (0, import_records28.optionKey)(option)));
|
|
12814
12848
|
const toggles = /* @__PURE__ */ (0, import_jsx_runtime43.jsx)("div", { id: autoOpen ? void 0 : id, className: "flex flex-wrap gap-1", children: options.map((option) => /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(
|
|
12815
12849
|
import_design_system39.Button,
|
|
12816
12850
|
{
|
|
12817
12851
|
type: "button",
|
|
12818
12852
|
size: "sm",
|
|
12819
|
-
variant: picked.has((0,
|
|
12853
|
+
variant: picked.has((0, import_records28.optionKey)(option)) ? "default" : "outline",
|
|
12820
12854
|
disabled,
|
|
12821
12855
|
onClick: () => {
|
|
12822
12856
|
const next = new Set(picked);
|
|
12823
|
-
if (next.has((0,
|
|
12824
|
-
else next.add((0,
|
|
12857
|
+
if (next.has((0, import_records28.optionKey)(option))) next.delete((0, import_records28.optionKey)(option));
|
|
12858
|
+
else next.add((0, import_records28.optionKey)(option));
|
|
12825
12859
|
onChange(next.size === 0 ? null : [...next]);
|
|
12826
12860
|
},
|
|
12827
12861
|
children: titleOf(option)
|
|
@@ -12843,11 +12877,11 @@ function OptionControl({ field, value, onChange, disabled, id, autoOpen, onClose
|
|
|
12843
12877
|
}
|
|
12844
12878
|
);
|
|
12845
12879
|
}
|
|
12846
|
-
const current = options.find((option) => (0,
|
|
12880
|
+
const current = options.find((option) => (0, import_records28.isTheChosen)(option, value));
|
|
12847
12881
|
return /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)(
|
|
12848
12882
|
import_design_system39.Select,
|
|
12849
12883
|
{
|
|
12850
|
-
value: current ? (0,
|
|
12884
|
+
value: current ? (0, import_records28.optionKey)(current) : "",
|
|
12851
12885
|
disabled: disabled ?? false,
|
|
12852
12886
|
onValueChange: (next) => onChange(next === "" ? null : next),
|
|
12853
12887
|
...autoOpen ? {
|
|
@@ -12859,7 +12893,7 @@ function OptionControl({ field, value, onChange, disabled, id, autoOpen, onClose
|
|
|
12859
12893
|
} : {},
|
|
12860
12894
|
children: [
|
|
12861
12895
|
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)(import_design_system39.SelectTrigger, { id, size: "sm", children: /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(import_design_system39.SelectValue, { placeholder: "Choose" }) }),
|
|
12862
|
-
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)(import_design_system39.SelectContent, { children: options.map((option) => /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(import_design_system39.SelectItem, { value: (0,
|
|
12896
|
+
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)(import_design_system39.SelectContent, { children: options.map((option) => /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(import_design_system39.SelectItem, { value: (0, import_records28.optionKey)(option), children: titleOf(option) }, option.id)) })
|
|
12863
12897
|
]
|
|
12864
12898
|
}
|
|
12865
12899
|
);
|
|
@@ -12893,23 +12927,23 @@ function OpenChoicePicker({
|
|
|
12893
12927
|
const [addRefused, setAddRefused] = (0, import_react67.useState)(null);
|
|
12894
12928
|
const titleOf = (option) => recordName(option.data, null, "Unnamed choice");
|
|
12895
12929
|
const held = withoutAddition(value);
|
|
12896
|
-
const current = (0,
|
|
12930
|
+
const current = (0, import_records28.choiceValuesOf)(held.value);
|
|
12897
12931
|
const pickedWords = current.map((v) => {
|
|
12898
|
-
const option = options.find((o) => (0,
|
|
12932
|
+
const option = options.find((o) => (0, import_records28.isTheChosen)(o, v));
|
|
12899
12933
|
return option ? titleOf(option) : String(v);
|
|
12900
12934
|
});
|
|
12901
|
-
const chipOf = (option, word) => option ? choiceChipLookOf(field, (0,
|
|
12935
|
+
const chipOf = (option, word) => option ? choiceChipLookOf(field, (0, import_records28.optionKey)(option), titleOf(option)) : choiceChipLookOf(field, word);
|
|
12902
12936
|
const q = search.trim();
|
|
12903
|
-
const visible = (0,
|
|
12904
|
-
const decided = (0,
|
|
12937
|
+
const visible = (0, import_records28.rankTypedMatches)(options, q, titleOf);
|
|
12938
|
+
const decided = (0, import_records28.decideTypedChoice)({ words: q, options, allowOther, nudge: nudge ?? "ask" });
|
|
12905
12939
|
const choose = (word, addingIt = false) => {
|
|
12906
12940
|
const pending = held.add.filter((w) => w.toLowerCase() !== word.toLowerCase());
|
|
12907
12941
|
let next;
|
|
12908
12942
|
let add2 = [...pending];
|
|
12909
12943
|
if (field.multi) {
|
|
12910
12944
|
const existing = current.map((v) => {
|
|
12911
|
-
const option = options.find((o) => (0,
|
|
12912
|
-
return option ? (0,
|
|
12945
|
+
const option = options.find((o) => (0, import_records28.isTheChosen)(o, v));
|
|
12946
|
+
return option ? (0, import_records28.optionKey)(option) : String(v);
|
|
12913
12947
|
});
|
|
12914
12948
|
const has = existing.some((v) => v.toLowerCase() === word.toLowerCase());
|
|
12915
12949
|
const list = has ? existing.filter((v) => v.toLowerCase() !== word.toLowerCase()) : [...existing, word];
|
|
@@ -12945,7 +12979,7 @@ function OpenChoicePicker({
|
|
|
12945
12979
|
const foot = null;
|
|
12946
12980
|
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;
|
|
12947
12981
|
const listed = visible;
|
|
12948
|
-
const pickedOptions = current.map((v) => options.find((o) => (0,
|
|
12982
|
+
const pickedOptions = current.map((v) => options.find((o) => (0, import_records28.isTheChosen)(o, v)));
|
|
12949
12983
|
const cellChips = pickedWords.map((word, i) => {
|
|
12950
12984
|
const chip = chipOf(pickedOptions[i], word);
|
|
12951
12985
|
return /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(import_design_system39.Badge, { variant: "outline", className: (0, import_design_system39.cn)("text-[11px]", chip.className), "data-records-choice-chip": "", children: word }, word);
|
|
@@ -12957,7 +12991,7 @@ function OpenChoicePicker({
|
|
|
12957
12991
|
label: word,
|
|
12958
12992
|
chip: chipOf(option, word).className,
|
|
12959
12993
|
onRemove: () => {
|
|
12960
|
-
if (field.multi) choose(option ? (0,
|
|
12994
|
+
if (field.multi) choose(option ? (0, import_records28.optionKey)(option) : String(current[i]));
|
|
12961
12995
|
else onChange(null);
|
|
12962
12996
|
}
|
|
12963
12997
|
};
|
|
@@ -12988,11 +13022,11 @@ function OpenChoicePicker({
|
|
|
12988
13022
|
id: option.id,
|
|
12989
13023
|
label: titleOf(option),
|
|
12990
13024
|
chip: chipOf(option, titleOf(option)).className,
|
|
12991
|
-
picked: current.some((v) => (0,
|
|
13025
|
+
picked: current.some((v) => (0, import_records28.isTheChosen)(option, v))
|
|
12992
13026
|
})),
|
|
12993
13027
|
onPick: (optionId) => {
|
|
12994
13028
|
const option = options.find((o) => o.id === optionId);
|
|
12995
|
-
if (option) choose((0,
|
|
13029
|
+
if (option) choose((0, import_records28.optionKey)(option));
|
|
12996
13030
|
},
|
|
12997
13031
|
empty: q === "" ? /* @__PURE__ */ (0, import_jsx_runtime43.jsx)("p", { className: "p-2 text-xs text-muted-foreground", children: "No choices yet \u2014 type one to add it." }) : null,
|
|
12998
13032
|
add,
|
|
@@ -13048,7 +13082,7 @@ function ChoiceAnswer({
|
|
|
13048
13082
|
onChosen
|
|
13049
13083
|
}) {
|
|
13050
13084
|
const [search, setSearch] = (0, import_react67.useState)("");
|
|
13051
|
-
const held = field.multi ? (0,
|
|
13085
|
+
const held = field.multi ? (0, import_records28.choiceValuesOf)(value) : value === null || value === void 0 || value === "" ? [] : [value];
|
|
13052
13086
|
const on = (choice) => held.some((v) => isChosen ? isChosen(choice, v) : String(v) === choice.key || String(v) === choice.label);
|
|
13053
13087
|
const press = (choice) => {
|
|
13054
13088
|
if (!field.multi) {
|
|
@@ -13398,7 +13432,7 @@ function RecordPicker({ tableId, value, onChange, disabled }) {
|
|
|
13398
13432
|
|
|
13399
13433
|
// src/DataBindingPicker.tsx
|
|
13400
13434
|
var import_react73 = require("react");
|
|
13401
|
-
var
|
|
13435
|
+
var import_records29 = require("@ai-matrx/records");
|
|
13402
13436
|
var import_react74 = require("@ai-matrx/records/react");
|
|
13403
13437
|
var import_design_system41 = require("@ai-matrx/design-system");
|
|
13404
13438
|
init_names();
|
|
@@ -13433,7 +13467,7 @@ function isCompleteDataBinding(binding) {
|
|
|
13433
13467
|
}
|
|
13434
13468
|
function bindingPlaceholdersFor(field) {
|
|
13435
13469
|
const label = fieldName(field);
|
|
13436
|
-
if ((0,
|
|
13470
|
+
if ((0, import_records29.isEntityReferenceConfig)(field.config)) {
|
|
13437
13471
|
return [
|
|
13438
13472
|
{ token: `{${field.key}.name}`, label: `${label} \xB7 name` },
|
|
13439
13473
|
{ token: `{${field.key}.id}`, label: `${label} \xB7 id` }
|