@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/index.cjs
CHANGED
|
@@ -57,7 +57,7 @@ function sentenceFor(what, level) {
|
|
|
57
57
|
return `You are ${have} here, and it takes ${need} to ${doing[what]}. Ask somebody who is Admin on it to move you up.`;
|
|
58
58
|
}
|
|
59
59
|
function whatYouMayDo(level, known = true) {
|
|
60
|
-
const may = (what) => known && (0,
|
|
60
|
+
const may = (what) => known && (0, import_core.atLeast)(level, NEEDS[what]);
|
|
61
61
|
return {
|
|
62
62
|
level: known ? level : null,
|
|
63
63
|
known,
|
|
@@ -86,11 +86,11 @@ function tableIsLocked(table) {
|
|
|
86
86
|
function lockedStructure(base2) {
|
|
87
87
|
return { ...base2, structure: false, why: (what) => what === "structure" ? DATABASE_LOCKED_REASON : base2.why(what) };
|
|
88
88
|
}
|
|
89
|
-
var
|
|
89
|
+
var import_core, LEVEL_WORD, NEEDS, NOT_YET, NOTHING_AT_ALL, NOT_ANSWERED_YET, KERNEL_REASON, DATABASE_LOCKED_REASON;
|
|
90
90
|
var init_rights = __esm({
|
|
91
91
|
"src/rights.ts"() {
|
|
92
92
|
"use strict";
|
|
93
|
-
|
|
93
|
+
import_core = require("@ai-matrx/records/core");
|
|
94
94
|
LEVEL_WORD = {
|
|
95
95
|
viewer: "Viewer",
|
|
96
96
|
commenter: "Commenter",
|
|
@@ -550,7 +550,7 @@ function choiceWord(value) {
|
|
|
550
550
|
return String(value ?? "").trim().toLowerCase().replace(/[^a-z0-9]+/g, "_").replace(/^_+|_+$/g, "");
|
|
551
551
|
}
|
|
552
552
|
function statusGroupColor(field2, value) {
|
|
553
|
-
if ((0,
|
|
553
|
+
if ((0, import_core2.newerKindOf)(field2) !== "status" || value === null || value === void 0 || value === "") return void 0;
|
|
554
554
|
const word = choiceWord(value);
|
|
555
555
|
if (word === "") return void 0;
|
|
556
556
|
const groups = (field2.config ?? {})["status_groups"];
|
|
@@ -591,11 +591,11 @@ function choiceChipLookOf(field2, ...words2) {
|
|
|
591
591
|
}
|
|
592
592
|
return { className: import_table_style2.NEUTRAL_CHIP_CLASS, color: null };
|
|
593
593
|
}
|
|
594
|
-
var
|
|
594
|
+
var import_core2, import_table_style2, STATUS_GROUP_COLOR, NEW_CHOICE_PALETTE;
|
|
595
595
|
var init_choiceLooks = __esm({
|
|
596
596
|
"src/choiceLooks.ts"() {
|
|
597
597
|
"use strict";
|
|
598
|
-
|
|
598
|
+
import_core2 = require("@ai-matrx/records/core");
|
|
599
599
|
import_table_style2 = require("@ai-matrx/design-system/data-table/table-style");
|
|
600
600
|
STATUS_GROUP_COLOR = { todo: "gray", in_progress: "blue", done: "green" };
|
|
601
601
|
NEW_CHOICE_PALETTE = ["blue", "green", "amber", "red", "violet", "teal", "slate"];
|
|
@@ -634,7 +634,7 @@ function declaredAsLook(kind2) {
|
|
|
634
634
|
return kind2 in LOOK_KINDS && !storePublishesKind(kind2);
|
|
635
635
|
}
|
|
636
636
|
function storePublishesKind(kind2) {
|
|
637
|
-
return
|
|
637
|
+
return import_core3.DECLARABLE_FIELD_KINDS.some((row) => row.kind === kind2);
|
|
638
638
|
}
|
|
639
639
|
function isSystemFieldKind(id) {
|
|
640
640
|
return SYSTEM_FIELD_KINDS.includes(id);
|
|
@@ -649,24 +649,24 @@ function isRelationFieldType(id) {
|
|
|
649
649
|
return id === "relation";
|
|
650
650
|
}
|
|
651
651
|
function isParityFieldType(id) {
|
|
652
|
-
return
|
|
652
|
+
return import_core3.PARITY_FIELD_TYPES.some((row) => row.parity_type === id);
|
|
653
653
|
}
|
|
654
654
|
function parityTypesWithNoExplanation() {
|
|
655
|
-
return
|
|
655
|
+
return import_core3.PARITY_FIELD_TYPES.map((row) => row.parity_type).filter((type) => !BY_ID.has(type));
|
|
656
656
|
}
|
|
657
657
|
function kindsWithNoChoice() {
|
|
658
|
-
return
|
|
658
|
+
return import_core3.DECLARABLE_FIELD_KINDS.map((row) => row.kind).filter((kind2) => !BY_ID.has(kind2));
|
|
659
659
|
}
|
|
660
|
-
var
|
|
660
|
+
var import_core3, LOOK_KINDS, STORE_PUBLISHES_ENTITY_REFERENCE, SYSTEM_FIELD_KINDS, FIELD_TYPE_CATALOGUE, GATED_KINDS, FIELD_TYPE_CHOICES, FIELD_TYPE_GROUPS, BY_ID, ADD_FIELD_OPEN_LABEL, ADD_FIELD_SAVE_LABEL, EDIT_FIELD_SAVE_LABEL;
|
|
661
661
|
var init_fieldTypes = __esm({
|
|
662
662
|
"src/fieldTypes.ts"() {
|
|
663
663
|
"use strict";
|
|
664
|
-
|
|
664
|
+
import_core3 = require("@ai-matrx/records/core");
|
|
665
665
|
LOOK_KINDS = {
|
|
666
666
|
rating: { plain: "number", look: ({ ratingMax }) => ({ id: "rating", options: { ratingMax } }) },
|
|
667
667
|
time: { plain: "text", look: () => ({ id: "time" }) }
|
|
668
668
|
};
|
|
669
|
-
STORE_PUBLISHES_ENTITY_REFERENCE =
|
|
669
|
+
STORE_PUBLISHES_ENTITY_REFERENCE = import_core3.DECLARABLE_FIELD_KINDS.some(
|
|
670
670
|
(row) => row.kind === "entity_reference"
|
|
671
671
|
);
|
|
672
672
|
SYSTEM_FIELD_KINDS = ["autonumber", "created_time", "modified_time"];
|
|
@@ -711,7 +711,7 @@ var init_fieldTypes = __esm({
|
|
|
711
711
|
{ id: "created_by", group: "Worked out", label: "Created by", explanation: "Who made each record. Nobody types it." },
|
|
712
712
|
{ id: "modified_by", group: "Worked out", label: "Last changed by", explanation: "Who last changed each record. Nobody types it." }
|
|
713
713
|
];
|
|
714
|
-
GATED_KINDS = /* @__PURE__ */ new Set(["entity_reference", ...
|
|
714
|
+
GATED_KINDS = /* @__PURE__ */ new Set(["entity_reference", ...import_core3.NEWER_FIELD_KINDS]);
|
|
715
715
|
FIELD_TYPE_CHOICES = FIELD_TYPE_CATALOGUE.filter(
|
|
716
716
|
(c) => !GATED_KINDS.has(c.id) || storePublishesKind(c.id) || c.id in LOOK_KINDS
|
|
717
717
|
);
|
|
@@ -730,12 +730,12 @@ var init_fieldTypes = __esm({
|
|
|
730
730
|
|
|
731
731
|
// src/parity.ts
|
|
732
732
|
function editorKindFor(field2) {
|
|
733
|
-
return (0,
|
|
733
|
+
return (0, import_core4.fieldKindFor)(field2, KERNEL);
|
|
734
734
|
}
|
|
735
735
|
function pickableTypeOf(field2) {
|
|
736
736
|
if (isSignatureField(field2)) return "signature";
|
|
737
|
-
if ((0,
|
|
738
|
-
const newer = (0,
|
|
737
|
+
if ((0, import_core5.isButtonField)(field2)) return "button";
|
|
738
|
+
const newer = (0, import_core4.newerKindOf)(field2);
|
|
739
739
|
if (newer) return newer;
|
|
740
740
|
const look = displayFormatOf(field2)?.id;
|
|
741
741
|
if (look === "rating" && field2.type === "range") return "rating";
|
|
@@ -759,17 +759,17 @@ function fieldTypeLabel(field2) {
|
|
|
759
759
|
};
|
|
760
760
|
return plain2[kind2] ?? (0, import_text_case2.humanizeIdentifier)(kind2);
|
|
761
761
|
}
|
|
762
|
-
var
|
|
762
|
+
var import_core4, import_core5, import_text_case2, kernelId, KERNEL_FILE_TABLE, KERNEL_PERSON_TABLE, PARITY_LABEL, PARITY_MADE_OF, KERNEL;
|
|
763
763
|
var init_parity = __esm({
|
|
764
764
|
"src/parity.ts"() {
|
|
765
765
|
"use strict";
|
|
766
766
|
init_choiceLooks();
|
|
767
|
-
|
|
768
|
-
|
|
767
|
+
import_core4 = require("@ai-matrx/records/core");
|
|
768
|
+
import_core5 = require("@ai-matrx/records/core");
|
|
769
769
|
import_text_case2 = require("@ai-matrx/kit/text-case");
|
|
770
770
|
init_docs();
|
|
771
771
|
init_fieldTypes();
|
|
772
|
-
kernelId = (name) =>
|
|
772
|
+
kernelId = (name) => import_core4.KERNEL_TABLES.find((t) => t.name === name)?.id ?? "";
|
|
773
773
|
KERNEL_FILE_TABLE = kernelId("File");
|
|
774
774
|
KERNEL_PERSON_TABLE = kernelId("Person");
|
|
775
775
|
PARITY_LABEL = {
|
|
@@ -789,7 +789,7 @@ var init_parity = __esm({
|
|
|
789
789
|
url: "Link"
|
|
790
790
|
};
|
|
791
791
|
PARITY_MADE_OF = Object.fromEntries(
|
|
792
|
-
|
|
792
|
+
import_core4.PARITY_FIELD_TYPES.map((p) => [p.parity_type, p.made_of])
|
|
793
793
|
);
|
|
794
794
|
KERNEL = { file: KERNEL_FILE_TABLE, person: KERNEL_PERSON_TABLE };
|
|
795
795
|
}
|
|
@@ -894,7 +894,7 @@ function RefusalNotice({
|
|
|
894
894
|
onKeepEditing,
|
|
895
895
|
onDiscard
|
|
896
896
|
}) {
|
|
897
|
-
const archivedOrg = (0,
|
|
897
|
+
const archivedOrg = (0, import_core7.archivedOrganizationId)(error);
|
|
898
898
|
if (archivedOrg) {
|
|
899
899
|
return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(ArchivedOrganizationNotice, { organizationId: archivedOrg, error, className });
|
|
900
900
|
}
|
|
@@ -950,19 +950,19 @@ function RefusalLine({ error, className }) {
|
|
|
950
950
|
{
|
|
951
951
|
"data-refusal-line": "",
|
|
952
952
|
className: (0, import_design_system3.cn)("whitespace-normal break-words text-xs text-destructive [overflow-wrap:anywhere]", className),
|
|
953
|
-
message: (0,
|
|
953
|
+
message: (0, import_core7.archivedOrganizationId)(error) ? "This organization is archived. An owner can restore it." : refusalLineForAPerson(error),
|
|
954
954
|
error,
|
|
955
955
|
origin: "records-ui/RefusalLine",
|
|
956
956
|
...plain2.forEngineers ? { "data-for-engineers": plain2.forEngineers } : {}
|
|
957
957
|
}
|
|
958
958
|
);
|
|
959
959
|
}
|
|
960
|
-
var
|
|
960
|
+
var import_core7, import_design_system3, import_jsx_runtime5;
|
|
961
961
|
var init_Refusal = __esm({
|
|
962
962
|
"src/Refusal.tsx"() {
|
|
963
963
|
"use strict";
|
|
964
964
|
"use client";
|
|
965
|
-
|
|
965
|
+
import_core7 = require("@ai-matrx/records/core");
|
|
966
966
|
import_design_system3 = require("@ai-matrx/design-system");
|
|
967
967
|
init_ArchivedOrganizationNotice();
|
|
968
968
|
init_plainWords();
|
|
@@ -1392,11 +1392,11 @@ var init_writeOnTheWinningVersion = __esm({
|
|
|
1392
1392
|
});
|
|
1393
1393
|
|
|
1394
1394
|
// src/createTable.ts
|
|
1395
|
-
var
|
|
1395
|
+
var import_core8;
|
|
1396
1396
|
var init_createTable = __esm({
|
|
1397
1397
|
"src/createTable.ts"() {
|
|
1398
1398
|
"use strict";
|
|
1399
|
-
|
|
1399
|
+
import_core8 = require("@ai-matrx/records/core");
|
|
1400
1400
|
}
|
|
1401
1401
|
});
|
|
1402
1402
|
|
|
@@ -1472,7 +1472,7 @@ function usePickerTables() {
|
|
|
1472
1472
|
};
|
|
1473
1473
|
}, [client, nonce]);
|
|
1474
1474
|
const data = (0, import_react20.useMemo)(
|
|
1475
|
-
() => (0,
|
|
1475
|
+
() => (0, import_records6.withTablePlacement)(tables.data ?? [], facts === "reading" ? null : facts),
|
|
1476
1476
|
[tables.data, facts]
|
|
1477
1477
|
);
|
|
1478
1478
|
return { loading: tables.loading || facts === "reading", data, reload };
|
|
@@ -1491,13 +1491,13 @@ function ShowListsToggle({
|
|
|
1491
1491
|
")"
|
|
1492
1492
|
] });
|
|
1493
1493
|
}
|
|
1494
|
-
var import_react20,
|
|
1494
|
+
var import_react20, import_records6, import_react21, import_design_system10, import_jsx_runtime12;
|
|
1495
1495
|
var init_tablePicking = __esm({
|
|
1496
1496
|
"src/tablePicking.tsx"() {
|
|
1497
1497
|
"use strict";
|
|
1498
1498
|
"use client";
|
|
1499
1499
|
import_react20 = require("react");
|
|
1500
|
-
|
|
1500
|
+
import_records6 = require("@ai-matrx/records");
|
|
1501
1501
|
import_react21 = require("@ai-matrx/records/react");
|
|
1502
1502
|
import_design_system10 = require("@ai-matrx/design-system");
|
|
1503
1503
|
init_tablePickerEntries();
|
|
@@ -2507,7 +2507,7 @@ function choiceOptionsOf(options) {
|
|
|
2507
2507
|
const labels = [];
|
|
2508
2508
|
for (const option of options) {
|
|
2509
2509
|
const id = option.id;
|
|
2510
|
-
const key = (0,
|
|
2510
|
+
const key = (0, import_records15.optionKey)(option);
|
|
2511
2511
|
const label = recordName(option.data, null, "");
|
|
2512
2512
|
if (label) {
|
|
2513
2513
|
labels.push(label);
|
|
@@ -2519,7 +2519,7 @@ function choiceOptionsOf(options) {
|
|
|
2519
2519
|
return { byWord, labels };
|
|
2520
2520
|
}
|
|
2521
2521
|
function valueFromPastedText(field2, raw, options, relationNames) {
|
|
2522
|
-
return (0,
|
|
2522
|
+
return (0, import_records15.coerceTypedAnswer)(field2, raw, {
|
|
2523
2523
|
label: fieldName(field2),
|
|
2524
2524
|
...options ? { options } : {},
|
|
2525
2525
|
...relationNames ? { relationNames } : {}
|
|
@@ -2572,7 +2572,7 @@ function planPastedBlock(args) {
|
|
|
2572
2572
|
});
|
|
2573
2573
|
accepted[key] = judged.value;
|
|
2574
2574
|
}
|
|
2575
|
-
const predicted = (0,
|
|
2575
|
+
const predicted = (0, import_core12.predictValueRefusals)(args.fields, accepted);
|
|
2576
2576
|
for (const refusal3 of predicted) {
|
|
2577
2577
|
const key = refusal3.field_key;
|
|
2578
2578
|
if (key === void 0) continue;
|
|
@@ -2712,12 +2712,12 @@ function gridRefusalForPastedCell(field2, value) {
|
|
|
2712
2712
|
const judged = valueFromPastedText(field2, value === null ? "" : String(value));
|
|
2713
2713
|
return "refusal" in judged ? judged.refusal : void 0;
|
|
2714
2714
|
}
|
|
2715
|
-
var
|
|
2715
|
+
var import_core12, import_records15, sameWords;
|
|
2716
2716
|
var init_pasteValues = __esm({
|
|
2717
2717
|
"src/pasteValues.ts"() {
|
|
2718
2718
|
"use strict";
|
|
2719
|
-
|
|
2720
|
-
|
|
2719
|
+
import_core12 = require("@ai-matrx/records/core");
|
|
2720
|
+
import_records15 = require("@ai-matrx/records");
|
|
2721
2721
|
init_dates();
|
|
2722
2722
|
init_parity();
|
|
2723
2723
|
init_names();
|
|
@@ -2751,7 +2751,7 @@ function refusedCellsOf(fields, rows, mapping, choiceOptions, relationNames) {
|
|
|
2751
2751
|
if ("unmatchedNames" in meant) return;
|
|
2752
2752
|
if ("refusal" in meant) why = meant.refusal;
|
|
2753
2753
|
else {
|
|
2754
|
-
const predicted = (0,
|
|
2754
|
+
const predicted = (0, import_core13.predictValueRefusals)([field2], { [key]: meant.value }).filter(
|
|
2755
2755
|
(p) => p.field_key === void 0 || p.field_key === key
|
|
2756
2756
|
);
|
|
2757
2757
|
if (predicted.length > 0) why = predicted[0].message;
|
|
@@ -2771,11 +2771,11 @@ function checkImportRules(fields, rows, mapping, choiceOptions, relationNames) {
|
|
|
2771
2771
|
}
|
|
2772
2772
|
return [...verdicts.values()];
|
|
2773
2773
|
}
|
|
2774
|
-
var
|
|
2774
|
+
var import_core13;
|
|
2775
2775
|
var init_importRuleCheck = __esm({
|
|
2776
2776
|
"src/importRuleCheck.ts"() {
|
|
2777
2777
|
"use strict";
|
|
2778
|
-
|
|
2778
|
+
import_core13 = require("@ai-matrx/records/core");
|
|
2779
2779
|
init_pasteValues();
|
|
2780
2780
|
init_parity();
|
|
2781
2781
|
}
|
|
@@ -2841,7 +2841,7 @@ function datesOfColumn(rows, header, opts = {}) {
|
|
|
2841
2841
|
const raw = String(r[header] ?? "").trim();
|
|
2842
2842
|
if (raw === "") return;
|
|
2843
2843
|
filled += 1;
|
|
2844
|
-
const got = (0,
|
|
2844
|
+
const got = (0, import_records16.readTypedDate)(raw, { ...opts.withTime ? { withTime: true } : {}, ...opts.locale ? { locale: opts.locale } : {} });
|
|
2845
2845
|
if (got.ok) read.set(i, opts.withTime && got.instant ? got.instant : got.day);
|
|
2846
2846
|
else unreadable.push({ row: i, raw });
|
|
2847
2847
|
});
|
|
@@ -2874,11 +2874,11 @@ function looksLike(rows, header) {
|
|
|
2874
2874
|
if (share(isPhone) >= 0.6) return "phone";
|
|
2875
2875
|
return null;
|
|
2876
2876
|
}
|
|
2877
|
-
var
|
|
2877
|
+
var import_records16, IMPORT_KINDS, EMAIL2, PHONE2, URLISH;
|
|
2878
2878
|
var init_importKinds = __esm({
|
|
2879
2879
|
"src/importKinds.ts"() {
|
|
2880
2880
|
"use strict";
|
|
2881
|
-
|
|
2881
|
+
import_records16 = require("@ai-matrx/records");
|
|
2882
2882
|
IMPORT_KINDS = [
|
|
2883
2883
|
{ kind: "text", label: "Text" },
|
|
2884
2884
|
{ kind: "date", label: "Date" },
|
|
@@ -2900,7 +2900,7 @@ function titleRepeats(rows, header) {
|
|
|
2900
2900
|
const seen = /* @__PURE__ */ new Set();
|
|
2901
2901
|
let filled = 0;
|
|
2902
2902
|
for (const r of rows) {
|
|
2903
|
-
const key = (0,
|
|
2903
|
+
const key = (0, import_records17.relationNameKey)(String(r[header] ?? ""));
|
|
2904
2904
|
if (key === "") continue;
|
|
2905
2905
|
filled += 1;
|
|
2906
2906
|
seen.add(key);
|
|
@@ -2910,7 +2910,7 @@ function titleRepeats(rows, header) {
|
|
|
2910
2910
|
function sameRecordLikely(rows, header, notIdentity) {
|
|
2911
2911
|
const groups = /* @__PURE__ */ new Map();
|
|
2912
2912
|
for (const r of rows) {
|
|
2913
|
-
const key = (0,
|
|
2913
|
+
const key = (0, import_records17.relationNameKey)(String(r[header] ?? ""));
|
|
2914
2914
|
if (key === "") continue;
|
|
2915
2915
|
const held = groups.get(key);
|
|
2916
2916
|
if (held) held.push(r);
|
|
@@ -2943,7 +2943,7 @@ function combineRows(rows, header) {
|
|
|
2943
2943
|
const out = [];
|
|
2944
2944
|
const outLines = [];
|
|
2945
2945
|
rows.forEach((r, i) => {
|
|
2946
|
-
const key = (0,
|
|
2946
|
+
const key = (0, import_records17.relationNameKey)(String(r[header] ?? ""));
|
|
2947
2947
|
if (key === "") {
|
|
2948
2948
|
out.push({ ...r });
|
|
2949
2949
|
outLines.push([i + 1]);
|
|
@@ -2983,11 +2983,11 @@ function combineRows(rows, header) {
|
|
|
2983
2983
|
index.sort((a, b) => a.lines[0] - b.lines[0]);
|
|
2984
2984
|
return { rows: index.map((e) => e.row), lines: index.map((e) => e.lines), multiValued };
|
|
2985
2985
|
}
|
|
2986
|
-
var
|
|
2986
|
+
var import_records17, LIST_JOIN;
|
|
2987
2987
|
var init_importCombine = __esm({
|
|
2988
2988
|
"src/importCombine.ts"() {
|
|
2989
2989
|
"use strict";
|
|
2990
|
-
|
|
2990
|
+
import_records17 = require("@ai-matrx/records");
|
|
2991
2991
|
LIST_JOIN = "; ";
|
|
2992
2992
|
}
|
|
2993
2993
|
});
|
|
@@ -3338,7 +3338,7 @@ function ImportWizard({ tableId, source, onDone, onWrote, autoRun, className })
|
|
|
3338
3338
|
try {
|
|
3339
3339
|
const xlsx = file.name.toLowerCase().endsWith(".xlsx");
|
|
3340
3340
|
const bytes = await file.arrayBuffer();
|
|
3341
|
-
const result = xlsx ? await (0,
|
|
3341
|
+
const result = xlsx ? await (0, import_core14.importXlsx)(bytes) : (0, import_core14.importCsv)(new TextDecoder().decode(bytes));
|
|
3342
3342
|
await planFrom(result, { name: file.name, bytes: file.size, hash: await sha256(bytes), format: xlsx ? "xlsx" : "csv" });
|
|
3343
3343
|
} catch (thrown) {
|
|
3344
3344
|
setProblem(
|
|
@@ -3449,13 +3449,13 @@ function ImportWizard({ tableId, source, onDone, onWrote, autoRun, className })
|
|
|
3449
3449
|
async (wanted) => {
|
|
3450
3450
|
const next = /* @__PURE__ */ new Map();
|
|
3451
3451
|
for (const { header, field: field2 } of wanted) {
|
|
3452
|
-
const names2 = effectiveRows.flatMap((r) => (0,
|
|
3452
|
+
const names2 = effectiveRows.flatMap((r) => (0, import_records18.relationNamesIn)(field2, String(r[header] ?? "")));
|
|
3453
3453
|
const got = await client.relationNamesMatch({ table_id: field2.relation_target, names: names2 });
|
|
3454
3454
|
if (!got.ok) {
|
|
3455
3455
|
setRelationProblem(got.error);
|
|
3456
3456
|
return null;
|
|
3457
3457
|
}
|
|
3458
|
-
next.set(field2.key, (0,
|
|
3458
|
+
next.set(field2.key, (0, import_records18.relationNameIndexOf)(got.data));
|
|
3459
3459
|
}
|
|
3460
3460
|
setRelationProblem(null);
|
|
3461
3461
|
setRelationIndex(next);
|
|
@@ -3479,12 +3479,12 @@ function ImportWizard({ tableId, source, onDone, onWrote, autoRun, className })
|
|
|
3479
3479
|
let linked = 0;
|
|
3480
3480
|
let named = 0;
|
|
3481
3481
|
effectiveRows.forEach((row, i) => {
|
|
3482
|
-
const names2 = (0,
|
|
3482
|
+
const names2 = (0, import_records18.relationNamesIn)(field2, String(row[header] ?? ""));
|
|
3483
3483
|
if (String(row[header] ?? "").trim() === "") return;
|
|
3484
3484
|
named += 1;
|
|
3485
3485
|
let ok = true;
|
|
3486
3486
|
for (const name of names2) {
|
|
3487
|
-
const hits = index.byName.get((0,
|
|
3487
|
+
const hits = index.byName.get((0, import_records18.relationNameKey)(name)) ?? [];
|
|
3488
3488
|
if (hits.length === 1) continue;
|
|
3489
3489
|
ok = false;
|
|
3490
3490
|
if (hits.length === 0) unmatched.set(name, [...unmatched.get(name) ?? [], i + 1]);
|
|
@@ -3550,11 +3550,11 @@ function ImportWizard({ tableId, source, onDone, onWrote, autoRun, className })
|
|
|
3550
3550
|
const named = index.get(field2.key);
|
|
3551
3551
|
const text = String(row[header] ?? "").trim();
|
|
3552
3552
|
if (!named || text === "") continue;
|
|
3553
|
-
const parts = field2.multi ? (0,
|
|
3553
|
+
const parts = field2.multi ? (0, import_records18.splitListCell)(text) : [text];
|
|
3554
3554
|
const ids = [];
|
|
3555
3555
|
let skip = false;
|
|
3556
3556
|
for (const part of parts) {
|
|
3557
|
-
const hits = (0,
|
|
3557
|
+
const hits = (0, import_records18.relationNamesIn)(field2, part).length === 0 ? null : named.byName.get((0, import_records18.relationNameKey)(part)) ?? [];
|
|
3558
3558
|
if (hits === null) ids.push(part);
|
|
3559
3559
|
else if (hits.length === 1) ids.push(hits[0].id);
|
|
3560
3560
|
else if ((hits.length === 0 ? choiceFor(field2.key).unmatched : choiceFor(field2.key).ambiguous) !== "empty") skip = true;
|
|
@@ -3594,7 +3594,7 @@ function ImportWizard({ tableId, source, onDone, onWrote, autoRun, className })
|
|
|
3594
3594
|
setPhase("linking");
|
|
3595
3595
|
for (const ask2 of toMerge) {
|
|
3596
3596
|
for (const [name] of ask2.ambiguous) {
|
|
3597
|
-
const hits = ask2.index.byName.get((0,
|
|
3597
|
+
const hits = ask2.index.byName.get((0, import_records18.relationNameKey)(name)) ?? [];
|
|
3598
3598
|
const winner = hits[0];
|
|
3599
3599
|
if (!winner) continue;
|
|
3600
3600
|
for (const loser of hits.slice(1)) {
|
|
@@ -4534,16 +4534,16 @@ function ImportWizard({ tableId, source, onDone, onWrote, autoRun, className })
|
|
|
4534
4534
|
table.error ? /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(RefusalNotice, { error: table.error }) : null
|
|
4535
4535
|
] });
|
|
4536
4536
|
}
|
|
4537
|
-
var import_react50, import_react51,
|
|
4537
|
+
var import_react50, import_react51, import_core14, import_design_system27, import_records18, import_text_case5, import_jsx_runtime31, BATCH, SAMPLES, COLUMNS_PER_CALL, ABSENT, LEAVE, TITLE_COPY, TYPED_VALUES;
|
|
4538
4538
|
var init_ImportWizard = __esm({
|
|
4539
4539
|
"src/ImportWizard.tsx"() {
|
|
4540
4540
|
"use strict";
|
|
4541
4541
|
"use client";
|
|
4542
4542
|
import_react50 = require("react");
|
|
4543
4543
|
import_react51 = require("@ai-matrx/records/react");
|
|
4544
|
-
|
|
4544
|
+
import_core14 = require("@ai-matrx/records/core");
|
|
4545
4545
|
import_design_system27 = require("@ai-matrx/design-system");
|
|
4546
|
-
|
|
4546
|
+
import_records18 = require("@ai-matrx/records");
|
|
4547
4547
|
init_Refusal();
|
|
4548
4548
|
init_refusals();
|
|
4549
4549
|
init_importRuleCheck();
|
|
@@ -4685,7 +4685,7 @@ function columnsFrom(text) {
|
|
|
4685
4685
|
function fieldsForNewColumns(columns) {
|
|
4686
4686
|
const keys = /* @__PURE__ */ new Set();
|
|
4687
4687
|
return columns.map((column, i) => {
|
|
4688
|
-
let key = (0,
|
|
4688
|
+
let key = (0, import_core8.tokenFor)(column.label) || `column_${i + 1}`;
|
|
4689
4689
|
while (keys.has(key)) key = `${key}_${i + 1}`;
|
|
4690
4690
|
keys.add(key);
|
|
4691
4691
|
const base2 = { key, label: column.label, sort: (i + 1) * 10, required: false };
|
|
@@ -4936,9 +4936,9 @@ function NewTableStart({
|
|
|
4936
4936
|
if (!trimmed || busy) return;
|
|
4937
4937
|
setBusy(true);
|
|
4938
4938
|
setError(null);
|
|
4939
|
-
const result = await (0,
|
|
4939
|
+
const result = await (0, import_core8.declareTable)(client, {
|
|
4940
4940
|
name: trimmed,
|
|
4941
|
-
slug: (0,
|
|
4941
|
+
slug: (0, import_core8.tokenFor)(trimmed),
|
|
4942
4942
|
...columns.length > 0 ? { fields: fieldsForNewColumns(columns) } : {}
|
|
4943
4943
|
});
|
|
4944
4944
|
setBusy(false);
|
|
@@ -4960,7 +4960,7 @@ function NewTableStart({
|
|
|
4960
4960
|
const trimmed = importName.trim();
|
|
4961
4961
|
setBusy(true);
|
|
4962
4962
|
setError(null);
|
|
4963
|
-
const result = await (0,
|
|
4963
|
+
const result = await (0, import_core8.declareTable)(client, { name: trimmed, slug: (0, import_core8.tokenFor)(trimmed) });
|
|
4964
4964
|
setBusy(false);
|
|
4965
4965
|
if (!result.ok) {
|
|
4966
4966
|
setError(result.error);
|
|
@@ -5561,7 +5561,7 @@ function BookingBuilder({ tableId, bookingId, onSaved, onClose, startNew, classN
|
|
|
5561
5561
|
if (!rights.structure) {
|
|
5562
5562
|
return /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("p", { className: (0, import_design_system31.cn)("text-xs text-muted-foreground", className), children: rights.why("structure") ?? "Making a booking page needs the admin level on this table, because it lets people with no account take time in your calendar." });
|
|
5563
5563
|
}
|
|
5564
|
-
const url = formId ? `${publicOrigin}${(0,
|
|
5564
|
+
const url = formId ? `${publicOrigin}${(0, import_records19.bookingPath)(formId)}` : null;
|
|
5565
5565
|
const shown5 = offer ?? null;
|
|
5566
5566
|
return (
|
|
5567
5567
|
// THE RAIL IS 384px WIDE AND THE VIEWPORT IS NOT (walk 1, 2026-09-21):
|
|
@@ -5781,7 +5781,7 @@ function asksWhoTheyAre(askable) {
|
|
|
5781
5781
|
return kind2 === "email" || kind2 === "phone";
|
|
5782
5782
|
});
|
|
5783
5783
|
}
|
|
5784
|
-
var import_clipboard, import_design_system30, import_react55, import_react56, import_format,
|
|
5784
|
+
var import_clipboard, import_design_system30, import_react55, import_react56, import_format, import_records19, import_design_system31, import_controls2, import_jsx_runtime34, STORE_ANSWERS_THESE, DAYS, LENGTHS, WORKING_WEEK;
|
|
5785
5785
|
var init_BookingBuilder = __esm({
|
|
5786
5786
|
"src/BookingBuilder.tsx"() {
|
|
5787
5787
|
"use strict";
|
|
@@ -5791,7 +5791,7 @@ var init_BookingBuilder = __esm({
|
|
|
5791
5791
|
import_react55 = require("react");
|
|
5792
5792
|
import_react56 = require("@ai-matrx/records/react");
|
|
5793
5793
|
import_format = require("@ai-matrx/kit/format");
|
|
5794
|
-
|
|
5794
|
+
import_records19 = require("@ai-matrx/records");
|
|
5795
5795
|
import_design_system31 = require("@ai-matrx/design-system");
|
|
5796
5796
|
import_controls2 = require("@ai-matrx/design-system/controls");
|
|
5797
5797
|
init_publicQuestions();
|
|
@@ -6317,9 +6317,9 @@ function ArchivedBuiltOn({ tableId, onRestored }) {
|
|
|
6317
6317
|
/* @__PURE__ */ (0, import_jsx_runtime38.jsxs)("div", { className: "flex min-w-0 flex-1 flex-col", children: [
|
|
6318
6318
|
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)("span", { className: "truncate text-sm", children: thing.title }),
|
|
6319
6319
|
/* @__PURE__ */ (0, import_jsx_runtime38.jsxs)("span", { className: "truncate text-xs text-muted-foreground", children: [
|
|
6320
|
-
|
|
6320
|
+
import_records20.BUILT_KIND_WORD[thing.kind],
|
|
6321
6321
|
" \xB7 archived ",
|
|
6322
|
-
(0,
|
|
6322
|
+
(0, import_records20.archivedWhen)(thing.archivedAt)
|
|
6323
6323
|
] }),
|
|
6324
6324
|
refusal3 && refusal3.id === thing.id ? /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(RefusalNotice, { error: refusal3.error, className: "mt-2" }) : null
|
|
6325
6325
|
] }),
|
|
@@ -6340,13 +6340,13 @@ function ArchivedBuiltOn({ tableId, onRestored }) {
|
|
|
6340
6340
|
)) })
|
|
6341
6341
|
] });
|
|
6342
6342
|
}
|
|
6343
|
-
var import_react57,
|
|
6343
|
+
var import_react57, import_records20, import_react58, import_design_system34, import_jsx_runtime38, ARCHIVE_NEEDS_ADMIN;
|
|
6344
6344
|
var init_BuiltOnArchive = __esm({
|
|
6345
6345
|
"src/BuiltOnArchive.tsx"() {
|
|
6346
6346
|
"use strict";
|
|
6347
6347
|
"use client";
|
|
6348
6348
|
import_react57 = require("react");
|
|
6349
|
-
|
|
6349
|
+
import_records20 = require("@ai-matrx/records");
|
|
6350
6350
|
import_react58 = require("@ai-matrx/records/react");
|
|
6351
6351
|
import_design_system34 = require("@ai-matrx/design-system");
|
|
6352
6352
|
init_ObjectActionMenuItems();
|
|
@@ -6480,7 +6480,7 @@ function BookingSlots({ tableId, activeBookingId, className }) {
|
|
|
6480
6480
|
" Open the table the appointments should land in to make one."
|
|
6481
6481
|
] }) : null,
|
|
6482
6482
|
/* @__PURE__ */ (0, import_jsx_runtime39.jsx)("ul", { className: "flex flex-col gap-2", children: pages.map((page) => {
|
|
6483
|
-
const url = `${origin}${(0,
|
|
6483
|
+
const url = `${origin}${(0, import_records21.bookingPath)(page.form_id)}`;
|
|
6484
6484
|
const mayOpen = levels.data?.[page.table_id] === "admin";
|
|
6485
6485
|
const open = page.published_at !== null && page.closed_at === null;
|
|
6486
6486
|
return /* @__PURE__ */ (0, import_jsx_runtime39.jsxs)(
|
|
@@ -6597,7 +6597,7 @@ function nextInWords(page) {
|
|
|
6597
6597
|
}
|
|
6598
6598
|
return `Next: ${said2} (${page.timezone}).`;
|
|
6599
6599
|
}
|
|
6600
|
-
var import_clipboard2, import_react59, import_react60,
|
|
6600
|
+
var import_clipboard2, import_react59, import_react60, import_records21, import_design_system35, import_jsx_runtime39, BOOKING_NOT_HERE_LINE, WHAT_A_BOOKING_PAGE_IS, NO_ADMIN, STATE_WORDS;
|
|
6601
6601
|
var init_BookingSlots = __esm({
|
|
6602
6602
|
"src/BookingSlots.tsx"() {
|
|
6603
6603
|
"use strict";
|
|
@@ -6605,7 +6605,7 @@ var init_BookingSlots = __esm({
|
|
|
6605
6605
|
import_clipboard2 = require("@ai-matrx/kit/clipboard");
|
|
6606
6606
|
import_react59 = require("react");
|
|
6607
6607
|
import_react60 = require("@ai-matrx/records/react");
|
|
6608
|
-
|
|
6608
|
+
import_records21 = require("@ai-matrx/records");
|
|
6609
6609
|
import_design_system35 = require("@ai-matrx/design-system");
|
|
6610
6610
|
init_BookingBuilder();
|
|
6611
6611
|
init_BuildOrAsk();
|
|
@@ -6747,7 +6747,7 @@ function WhereItLives({ tableId, knownOrganizationName, onMoved, variant = "head
|
|
|
6747
6747
|
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)(SharedNameAddress, { to: choosing, all: answer.home.destinations }),
|
|
6748
6748
|
"?"
|
|
6749
6749
|
] }),
|
|
6750
|
-
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)("p", { className: "text-muted-foreground", children: (0,
|
|
6750
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)("p", { className: "text-muted-foreground", children: (0, import_records22.moveConsequence)(answer.home, choosing) }),
|
|
6751
6751
|
said2?.tone === "refused" ? /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(
|
|
6752
6752
|
import_design_system36.ErrorBox,
|
|
6753
6753
|
{
|
|
@@ -6825,13 +6825,13 @@ function SharedNameAddress({
|
|
|
6825
6825
|
const address = sharedNameAddress(to, all);
|
|
6826
6826
|
return address ? /* @__PURE__ */ (0, import_jsx_runtime40.jsx)("span", { className: "ml-1.5 font-normal text-muted-foreground", "data-where-it-lives-address": "", children: address }) : null;
|
|
6827
6827
|
}
|
|
6828
|
-
var import_react61,
|
|
6828
|
+
var import_react61, import_records22, import_react62, import_design_system36, import_jsx_runtime40;
|
|
6829
6829
|
var init_WhereItLives = __esm({
|
|
6830
6830
|
"src/WhereItLives.tsx"() {
|
|
6831
6831
|
"use strict";
|
|
6832
6832
|
"use client";
|
|
6833
6833
|
import_react61 = require("react");
|
|
6834
|
-
|
|
6834
|
+
import_records22 = require("@ai-matrx/records");
|
|
6835
6835
|
import_react62 = require("@ai-matrx/records/react");
|
|
6836
6836
|
init_host();
|
|
6837
6837
|
init_Refusal();
|
|
@@ -6888,8 +6888,8 @@ function TablesHome({ onOpenTable, organizationName, makingOnly = false, askedBy
|
|
|
6888
6888
|
alive = false;
|
|
6889
6889
|
};
|
|
6890
6890
|
}, [client]);
|
|
6891
|
-
const listed = facts.phase === "read" ? (0,
|
|
6892
|
-
(0,
|
|
6891
|
+
const listed = facts.phase === "read" ? (0, import_records23.withTablePlacement)(
|
|
6892
|
+
(0, import_core15.withTableFacts)(tables.data ?? [], facts.rows, me),
|
|
6893
6893
|
facts.rows
|
|
6894
6894
|
) : tables.data ?? [];
|
|
6895
6895
|
const [showEverything, setShowEverything] = (0, import_react63.useState)(false);
|
|
@@ -7033,15 +7033,15 @@ function TablesHome({ onOpenTable, organizationName, makingOnly = false, askedBy
|
|
|
7033
7033
|
}) : null
|
|
7034
7034
|
] });
|
|
7035
7035
|
}
|
|
7036
|
-
var import_react63, import_react64,
|
|
7036
|
+
var import_react63, import_react64, import_core15, import_records23, import_design_system37, import_jsx_runtime41, TABLE_LANES, LANE_TITLE, PLATFORM_TABLE_PREFIX2, LANE_EMPTY, SECTIONS_UNKNOWN, VISIBILITY_LANES, VISIBILITY_LANE_TITLE;
|
|
7037
7037
|
var init_TablesHome = __esm({
|
|
7038
7038
|
"src/TablesHome.tsx"() {
|
|
7039
7039
|
"use strict";
|
|
7040
7040
|
"use client";
|
|
7041
7041
|
import_react63 = require("react");
|
|
7042
7042
|
import_react64 = require("@ai-matrx/records/react");
|
|
7043
|
-
|
|
7044
|
-
|
|
7043
|
+
import_core15 = require("@ai-matrx/records/core");
|
|
7044
|
+
import_records23 = require("@ai-matrx/records");
|
|
7045
7045
|
import_design_system37 = require("@ai-matrx/design-system");
|
|
7046
7046
|
init_NewTableStart();
|
|
7047
7047
|
init_Refusal();
|
|
@@ -7110,7 +7110,7 @@ function draftsFor(headers, rows) {
|
|
|
7110
7110
|
function keysFor(labels) {
|
|
7111
7111
|
const used = /* @__PURE__ */ new Set();
|
|
7112
7112
|
return labels.map((label, i) => {
|
|
7113
|
-
const base2 = (0,
|
|
7113
|
+
const base2 = (0, import_core8.tokenFor)(label) === "table" && !/table/i.test(label) ? `column_${i + 1}` : (0, import_core8.tokenFor)(label);
|
|
7114
7114
|
let key = base2;
|
|
7115
7115
|
let n = 2;
|
|
7116
7116
|
while (used.has(key)) key = `${base2}_${n++}`;
|
|
@@ -7220,7 +7220,7 @@ function SaveToTable({ source, shapeIndex = 0, onOpenTable, onSaved, onClose, ma
|
|
|
7220
7220
|
tableName2 = (name ?? proposedName).trim();
|
|
7221
7221
|
newId = earlier.tableId;
|
|
7222
7222
|
const lacking = fields.filter((f) => !earlier.haveKeys.has(f.key));
|
|
7223
|
-
const added = await (0,
|
|
7223
|
+
const added = await (0, import_core8.addFields)(client, newId, lacking);
|
|
7224
7224
|
if (!added.ok) {
|
|
7225
7225
|
setProblem(added.error);
|
|
7226
7226
|
setPhase("ready");
|
|
@@ -7228,7 +7228,7 @@ function SaveToTable({ source, shapeIndex = 0, onOpenTable, onSaved, onClose, ma
|
|
|
7228
7228
|
}
|
|
7229
7229
|
} else {
|
|
7230
7230
|
tableName2 = freeName(name ?? proposedName, (tables.data ?? []).map((t) => t.name));
|
|
7231
|
-
const born = await (0,
|
|
7231
|
+
const born = await (0, import_core8.declareTable)(client, { name: tableName2, fields });
|
|
7232
7232
|
if (!born.ok) {
|
|
7233
7233
|
setProblem(born.error);
|
|
7234
7234
|
setPhase("ready");
|
|
@@ -7639,7 +7639,7 @@ __export(src_exports, {
|
|
|
7639
7639
|
DATA_BINDING_MISSING: () => DATA_BINDING_MISSING,
|
|
7640
7640
|
DATA_BINDING_SHAPES: () => DATA_BINDING_SHAPES,
|
|
7641
7641
|
DEFAULT_ACTION_ORIGIN: () => DEFAULT_ACTION_ORIGIN,
|
|
7642
|
-
DEFAULT_FIELDS: () =>
|
|
7642
|
+
DEFAULT_FIELDS: () => import_core8.DEFAULT_FIELDS,
|
|
7643
7643
|
DEFAULT_FOOTER: () => DEFAULT_FOOTER,
|
|
7644
7644
|
DEFAULT_VIEW_NAME: () => DEFAULT_VIEW_NAME,
|
|
7645
7645
|
DUE_STATE_LABEL: () => DUE_STATE_LABEL,
|
|
@@ -7879,7 +7879,7 @@ __export(src_exports, {
|
|
|
7879
7879
|
actorBadge: () => actorBadge,
|
|
7880
7880
|
actorWords: () => actorWords,
|
|
7881
7881
|
addDays: () => addDays,
|
|
7882
|
-
addFields: () =>
|
|
7882
|
+
addFields: () => import_core8.addFields,
|
|
7883
7883
|
announceTableArchived: () => announceTableArchived,
|
|
7884
7884
|
applyLook: () => import_views3.applyLook,
|
|
7885
7885
|
archiveConfirmSentence: () => archiveConfirmSentence,
|
|
@@ -7934,7 +7934,7 @@ __export(src_exports, {
|
|
|
7934
7934
|
dayAt: () => dayAt,
|
|
7935
7935
|
dayKeyOf: () => dayKeyOf,
|
|
7936
7936
|
daysBetween: () => daysBetween,
|
|
7937
|
-
declareTable: () =>
|
|
7937
|
+
declareTable: () => import_core8.declareTable,
|
|
7938
7938
|
declareView: () => declareView,
|
|
7939
7939
|
defaultBindingTemplate: () => defaultBindingTemplate,
|
|
7940
7940
|
defaultViewOf: () => import_views2.defaultViewOf,
|
|
@@ -7965,7 +7965,7 @@ __export(src_exports, {
|
|
|
7965
7965
|
entityTitleColumn: () => entityTitleColumn,
|
|
7966
7966
|
entityValueText: () => entityValueText,
|
|
7967
7967
|
envelopeFor: () => envelopeFor,
|
|
7968
|
-
fieldDeclarationFor: () =>
|
|
7968
|
+
fieldDeclarationFor: () => import_core8.fieldDeclarationFor,
|
|
7969
7969
|
fieldIsEditable: () => fieldIsEditable,
|
|
7970
7970
|
fieldName: () => fieldName,
|
|
7971
7971
|
fieldToken: () => fieldToken,
|
|
@@ -8149,7 +8149,7 @@ __export(src_exports, {
|
|
|
8149
8149
|
titleRepeats: () => titleRepeats,
|
|
8150
8150
|
toDropdownEntries: () => toDropdownEntries,
|
|
8151
8151
|
toStripAndRows: () => toStripAndRows,
|
|
8152
|
-
tokenFor: () =>
|
|
8152
|
+
tokenFor: () => import_core8.tokenFor,
|
|
8153
8153
|
unknownRailLine: () => unknownRailLine,
|
|
8154
8154
|
unknownViewLine: () => import_views2.unknownViewLine,
|
|
8155
8155
|
unreadableKeys: () => question_exports.unreadableKeys,
|
|
@@ -8406,7 +8406,7 @@ init_names();
|
|
|
8406
8406
|
var REVERSE_COLUMN_PREFIX = "linked:";
|
|
8407
8407
|
|
|
8408
8408
|
// src/gridPage.ts
|
|
8409
|
-
var
|
|
8409
|
+
var import_records = require("@ai-matrx/records");
|
|
8410
8410
|
var import_data_table = require("@ai-matrx/design-system/data-table");
|
|
8411
8411
|
|
|
8412
8412
|
// src/personTime.ts
|
|
@@ -8587,7 +8587,7 @@ function storeQuestion(fields, base2, columnFilters, now = /* @__PURE__ */ new D
|
|
|
8587
8587
|
const refused = [];
|
|
8588
8588
|
const flat = {};
|
|
8589
8589
|
const rules = [];
|
|
8590
|
-
if (base2 && (0,
|
|
8590
|
+
if (base2 && (0, import_records.isRuleFilter)(base2)) rules.push(base2);
|
|
8591
8591
|
else if (base2) Object.assign(flat, base2);
|
|
8592
8592
|
for (const [key, value] of Object.entries(columnFilters)) {
|
|
8593
8593
|
if (!value) continue;
|
|
@@ -8639,8 +8639,8 @@ __reExport(askOnce_exports, require("@ai-matrx/records/versions"));
|
|
|
8639
8639
|
// src/labels.tsx
|
|
8640
8640
|
var import_react7 = require("react");
|
|
8641
8641
|
var import_react8 = require("@ai-matrx/records/react");
|
|
8642
|
-
var
|
|
8643
|
-
var
|
|
8642
|
+
var import_records2 = require("@ai-matrx/records");
|
|
8643
|
+
var import_records3 = require("@ai-matrx/records");
|
|
8644
8644
|
init_names();
|
|
8645
8645
|
var import_uuid2 = require("@ai-matrx/kit/uuid");
|
|
8646
8646
|
init_docs();
|
|
@@ -8944,15 +8944,15 @@ function isId(value) {
|
|
|
8944
8944
|
return typeof value === "string" && (0, import_uuid2.isUuidShape)(value);
|
|
8945
8945
|
}
|
|
8946
8946
|
function copiesAsWords(field2) {
|
|
8947
|
-
return pointsAtRecords(field2) || isSignatureField(field2) || (0,
|
|
8947
|
+
return pointsAtRecords(field2) || isSignatureField(field2) || (0, import_records2.autonumberPrefixOf)(field2) !== "";
|
|
8948
8948
|
}
|
|
8949
8949
|
function pointsAtRecords(field2) {
|
|
8950
8950
|
return field2.type === "list" || field2.type === "relation";
|
|
8951
8951
|
}
|
|
8952
8952
|
function shownValue(field2, value, labels) {
|
|
8953
8953
|
if (isSignatureField(field2)) return signatureWords(value);
|
|
8954
|
-
if ((0,
|
|
8955
|
-
const newerWords = value === null || value === void 0 ? null : (0,
|
|
8954
|
+
if ((0, import_records2.autonumberPrefixOf)(field2)) return (0, import_records2.autonumberWords)(field2, value) ?? value;
|
|
8955
|
+
const newerWords = value === null || value === void 0 ? null : (0, import_records3.newerKindExportWords)(field2, value);
|
|
8956
8956
|
if (newerWords !== null) return newerWords;
|
|
8957
8957
|
if (!labels || !pointsAtRecords(field2)) return value;
|
|
8958
8958
|
const ids = idsOf(value);
|
|
@@ -9017,7 +9017,7 @@ function RecordLabelProvider({ children }) {
|
|
|
9017
9017
|
for (const option of result.data ?? []) {
|
|
9018
9018
|
const words2 = recordName(option.data, null, "Unnamed choice");
|
|
9019
9019
|
next[option.id] = words2;
|
|
9020
|
-
const key = (0,
|
|
9020
|
+
const key = (0, import_records3.optionKey)(option);
|
|
9021
9021
|
if (key) next[choiceKeyName(field2.id, key)] = words2;
|
|
9022
9022
|
}
|
|
9023
9023
|
return next;
|
|
@@ -9138,7 +9138,7 @@ function useLabelWait(field2) {
|
|
|
9138
9138
|
init_parity();
|
|
9139
9139
|
|
|
9140
9140
|
// src/tableJson.ts
|
|
9141
|
-
var
|
|
9141
|
+
var import_core6 = require("@ai-matrx/records/core");
|
|
9142
9142
|
var import_delimited = require("@ai-matrx/kit/delimited");
|
|
9143
9143
|
init_parity();
|
|
9144
9144
|
init_names();
|
|
@@ -9151,7 +9151,7 @@ function storedExportRows(fields, rows) {
|
|
|
9151
9151
|
}
|
|
9152
9152
|
function exportCsvWithRowIds(fields, rows, ids) {
|
|
9153
9153
|
const head = [ROW_ID_NAME, ...uniqueNames(fields)];
|
|
9154
|
-
const body = rows.map((row, at) => [ids[at] ?? "", ...fields.map((f) => (0,
|
|
9154
|
+
const body = rows.map((row, at) => [ids[at] ?? "", ...fields.map((f) => (0, import_core6.exportCellText)(f, row[f.key]))]);
|
|
9155
9155
|
return (0, import_delimited.toDelimited)([head, ...body]);
|
|
9156
9156
|
}
|
|
9157
9157
|
function jsonCell(value) {
|
|
@@ -9394,7 +9394,7 @@ init_parity();
|
|
|
9394
9394
|
|
|
9395
9395
|
// src/FieldRetype.tsx
|
|
9396
9396
|
var import_react15 = require("react");
|
|
9397
|
-
var
|
|
9397
|
+
var import_records5 = require("@ai-matrx/records");
|
|
9398
9398
|
var import_react16 = require("@ai-matrx/records/react");
|
|
9399
9399
|
var import_design_system7 = require("@ai-matrx/design-system");
|
|
9400
9400
|
init_parity();
|
|
@@ -9410,7 +9410,7 @@ init_host();
|
|
|
9410
9410
|
|
|
9411
9411
|
// src/PersonPicker.tsx
|
|
9412
9412
|
var import_react11 = require("react");
|
|
9413
|
-
var
|
|
9413
|
+
var import_records4 = require("@ai-matrx/records");
|
|
9414
9414
|
var import_react12 = require("@ai-matrx/records/react");
|
|
9415
9415
|
var import_design_system6 = require("@ai-matrx/design-system");
|
|
9416
9416
|
init_PickOrAdd();
|
|
@@ -9498,7 +9498,7 @@ function PersonPicker({ field: field2, value, onChange, disabled, id, className,
|
|
|
9498
9498
|
cancelled = true;
|
|
9499
9499
|
};
|
|
9500
9500
|
}, [client, personTable, picked.length, people.length]);
|
|
9501
|
-
const listed = (0,
|
|
9501
|
+
const listed = (0, import_records4.rankTypedMatches)(members ?? [], search, memberName);
|
|
9502
9502
|
if (!membersPort || !client) {
|
|
9503
9503
|
return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("p", { className: (0, import_design_system6.cn)("text-xs text-muted-foreground", className), children: NO_MEMBERS_REASON });
|
|
9504
9504
|
}
|
|
@@ -9857,7 +9857,7 @@ function FieldRetype({ field: field2, tableId, onRetyped }) {
|
|
|
9857
9857
|
return;
|
|
9858
9858
|
}
|
|
9859
9859
|
const groups = rows.map((r) => ({ value: r.ids.map((id) => people.get(id)?.name ?? "").join(", "), count: 1 }));
|
|
9860
|
-
setPreview((0,
|
|
9860
|
+
setPreview((0, import_records5.previewRetype)({ type: to.behaviour, kind: to.kind }, groups, false));
|
|
9861
9861
|
}).catch((e) => {
|
|
9862
9862
|
if (cancelled) return;
|
|
9863
9863
|
setAsking(false);
|
|
@@ -9875,7 +9875,7 @@ function FieldRetype({ field: field2, tableId, onRetyped }) {
|
|
|
9875
9875
|
return;
|
|
9876
9876
|
}
|
|
9877
9877
|
const groups = answer.data.map((row) => ({ value: row.groups[field2.key] ?? null, count: row.row_count }));
|
|
9878
|
-
setPreview((0,
|
|
9878
|
+
setPreview((0, import_records5.previewRetype)({ type: to.behaviour, kind: to.kind }, groups, answer.data.length >= PREVIEW_GROUPS));
|
|
9879
9879
|
});
|
|
9880
9880
|
return () => {
|
|
9881
9881
|
cancelled = true;
|
|
@@ -10527,7 +10527,7 @@ init_names();
|
|
|
10527
10527
|
// src/ReferenceBuilder.tsx
|
|
10528
10528
|
var import_react22 = require("react");
|
|
10529
10529
|
var import_react23 = require("@ai-matrx/records/react");
|
|
10530
|
-
var
|
|
10530
|
+
var import_core9 = require("@ai-matrx/records/core");
|
|
10531
10531
|
init_createTable();
|
|
10532
10532
|
init_Refusal();
|
|
10533
10533
|
init_tablePicking();
|
|
@@ -10616,7 +10616,7 @@ function ReferenceBuilder({
|
|
|
10616
10616
|
if (!name || making) return;
|
|
10617
10617
|
setMaking(true);
|
|
10618
10618
|
setRefused(null);
|
|
10619
|
-
const slug = (0,
|
|
10619
|
+
const slug = (0, import_core8.tokenFor)(name);
|
|
10620
10620
|
const found = await client.tableFind({ slug });
|
|
10621
10621
|
if (!found.ok) {
|
|
10622
10622
|
setMaking(false);
|
|
@@ -10630,7 +10630,7 @@ function ReferenceBuilder({
|
|
|
10630
10630
|
id = existing.id;
|
|
10631
10631
|
bornName = tableName(existing);
|
|
10632
10632
|
} else {
|
|
10633
|
-
const made = await (0,
|
|
10633
|
+
const made = await (0, import_core8.ensureTable)(client, {
|
|
10634
10634
|
name,
|
|
10635
10635
|
slug,
|
|
10636
10636
|
titleField: "name",
|
|
@@ -10649,7 +10649,7 @@ function ReferenceBuilder({
|
|
|
10649
10649
|
tables.reload();
|
|
10650
10650
|
onChange({ targetTableId: id, display: null });
|
|
10651
10651
|
};
|
|
10652
|
-
const mayMakeTable = (0,
|
|
10652
|
+
const mayMakeTable = (0, import_core9.doorReady)(client.config, import_core9.DOORS.tableFind) && (0, import_core9.doorReady)(client.config, import_core9.DOORS.tableEnsure);
|
|
10653
10653
|
const newTableButton = !mayMakeTable ? null : /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
10654
10654
|
import_design_system11.Button,
|
|
10655
10655
|
{
|
|
@@ -10862,15 +10862,15 @@ function ReferenceBuilder({
|
|
|
10862
10862
|
|
|
10863
10863
|
// src/gridEditing.tsx
|
|
10864
10864
|
var import_react90 = require("react");
|
|
10865
|
-
var
|
|
10866
|
-
var
|
|
10865
|
+
var import_records35 = require("@ai-matrx/records");
|
|
10866
|
+
var import_core18 = require("@ai-matrx/records/core");
|
|
10867
10867
|
var import_react91 = require("@ai-matrx/records/react");
|
|
10868
10868
|
var import_design_system52 = require("@ai-matrx/design-system");
|
|
10869
10869
|
|
|
10870
10870
|
// src/presentation.ts
|
|
10871
10871
|
var import_table_style3 = require("@ai-matrx/design-system/data-table/table-style");
|
|
10872
10872
|
var import_field_formats2 = require("@ai-matrx/design-system/field-formats");
|
|
10873
|
-
var
|
|
10873
|
+
var import_core10 = require("@ai-matrx/records/core");
|
|
10874
10874
|
init_parity();
|
|
10875
10875
|
init_dates();
|
|
10876
10876
|
function parseGanttLook(raw) {
|
|
@@ -11105,8 +11105,8 @@ function ungroupedForYears(field2, format) {
|
|
|
11105
11105
|
}
|
|
11106
11106
|
function formatForField(field2) {
|
|
11107
11107
|
const shownAs = shownAsOf(field2);
|
|
11108
|
-
if ((0,
|
|
11109
|
-
return { id: "rating", options: { ...shownAs?.options ?? {}, ratingMax: (0,
|
|
11108
|
+
if ((0, import_core10.newerKindOf)(field2) === "rating" && (!shownAs || shownAs.id === "rating")) {
|
|
11109
|
+
return { id: "rating", options: { ...shownAs?.options ?? {}, ratingMax: (0, import_core10.ratingMaxOf)(field2) } };
|
|
11110
11110
|
}
|
|
11111
11111
|
if (shownAs) return ungroupedForYears(field2, shownAs);
|
|
11112
11112
|
const stamp = dateFormatFor(field2);
|
|
@@ -11233,7 +11233,7 @@ var import_design_system13 = require("@ai-matrx/design-system");
|
|
|
11233
11233
|
|
|
11234
11234
|
// src/ChoiceListEditor.tsx
|
|
11235
11235
|
var import_react24 = require("react");
|
|
11236
|
-
var
|
|
11236
|
+
var import_records7 = require("@ai-matrx/records");
|
|
11237
11237
|
var import_react25 = require("@ai-matrx/records/react");
|
|
11238
11238
|
var import_design_system12 = require("@ai-matrx/design-system");
|
|
11239
11239
|
var import_data_table2 = require("@ai-matrx/design-system/data-table");
|
|
@@ -11244,7 +11244,7 @@ var rowSeed = 0;
|
|
|
11244
11244
|
var nextRow = () => `new-${rowSeed += 1}`;
|
|
11245
11245
|
function choiceRowsFrom(options, field2) {
|
|
11246
11246
|
return inTheStoresOrder([...options]).map((option) => {
|
|
11247
|
-
const words2 = (0,
|
|
11247
|
+
const words2 = (0, import_records7.optionLabel)(option);
|
|
11248
11248
|
const key = option.data?.key;
|
|
11249
11249
|
const color = field2 ? storedChoiceColor(field2, words2) ?? storedChoiceColor(field2, key) : void 0;
|
|
11250
11250
|
return { id: option.id, words: words2, row: option.id, color: color ?? null };
|
|
@@ -11414,11 +11414,11 @@ function ChoiceListEditor({
|
|
|
11414
11414
|
"div",
|
|
11415
11415
|
{
|
|
11416
11416
|
role: "group",
|
|
11417
|
-
"aria-label": (0,
|
|
11417
|
+
"aria-label": (0, import_records7.recordsUseSentence)(heldBy(asking), asking.words.trim()),
|
|
11418
11418
|
"data-records-choice-removal-ask": "",
|
|
11419
11419
|
className: "flex flex-col gap-1 rounded border bg-muted/40 p-2",
|
|
11420
11420
|
children: [
|
|
11421
|
-
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("p", { className: "text-xs", children: (0,
|
|
11421
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("p", { className: "text-xs", children: (0, import_records7.recordsUseSentence)(heldBy(asking), asking.words.trim()) }),
|
|
11422
11422
|
/* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { className: "flex flex-wrap items-center gap-1", children: [
|
|
11423
11423
|
targets.length > 0 ? /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(import_jsx_runtime14.Fragment, { children: [
|
|
11424
11424
|
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_design_system12.Button, { type: "button", size: "sm", className: "h-7 px-2 text-xs", disabled: moveTo === "", onClick: () => answer({ then: "move", to: moveTo }), children: "Move them to" }),
|
|
@@ -11437,7 +11437,7 @@ function ChoiceListEditor({
|
|
|
11437
11437
|
) : null,
|
|
11438
11438
|
Object.entries(rehome).map(
|
|
11439
11439
|
([id, spec]) => removed[id] ? /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { className: "flex items-center justify-between gap-2 text-[11px] text-muted-foreground", "data-records-choice-rehome": "", children: [
|
|
11440
|
-
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("span", { children: (0,
|
|
11440
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("span", { children: (0, import_records7.rehomeSentence)(usage?.[id]?.records ?? 0, removed[id].row.words.trim(), spec, spec.then === "move" ? wordsOf(spec.to) : void 0) }),
|
|
11441
11441
|
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_design_system12.Button, { type: "button", size: "sm", variant: "ghost", className: "h-6 px-1.5 text-[11px]", onClick: () => putBack(id), children: "Put it back" })
|
|
11442
11442
|
] }, id) : null
|
|
11443
11443
|
),
|
|
@@ -11534,7 +11534,7 @@ function AddChoicesInline({ field: field2, onAdded, disabled = false }) {
|
|
|
11534
11534
|
|
|
11535
11535
|
// src/editors.tsx
|
|
11536
11536
|
var import_react84 = require("react");
|
|
11537
|
-
var
|
|
11537
|
+
var import_records34 = require("@ai-matrx/records");
|
|
11538
11538
|
var import_react85 = require("@ai-matrx/records/react");
|
|
11539
11539
|
var import_design_system51 = require("@ai-matrx/design-system");
|
|
11540
11540
|
init_dates();
|
|
@@ -11542,22 +11542,22 @@ init_dates();
|
|
|
11542
11542
|
// src/newerKindValues.tsx
|
|
11543
11543
|
var import_react28 = require("react");
|
|
11544
11544
|
var import_source = require("@ai-matrx/content-ir/source");
|
|
11545
|
-
var
|
|
11545
|
+
var import_records8 = require("@ai-matrx/records");
|
|
11546
11546
|
var import_design_system14 = require("@ai-matrx/design-system");
|
|
11547
11547
|
var import_outbound_react = require("@ai-matrx/kit/outbound-react");
|
|
11548
11548
|
var import_jsx_runtime16 = require("react/jsx-runtime");
|
|
11549
11549
|
var own = (event) => event.stopPropagation();
|
|
11550
11550
|
function newerKindValue(field2, value, opts = {}) {
|
|
11551
|
-
switch ((0,
|
|
11551
|
+
switch ((0, import_records8.newerKindOf)(field2)) {
|
|
11552
11552
|
case "duration": {
|
|
11553
|
-
const words2 = (0,
|
|
11553
|
+
const words2 = (0, import_records8.durationText)(value);
|
|
11554
11554
|
return words2 === null ? void 0 : /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("span", { className: "tabular-nums", "data-records-duration": "", children: words2 });
|
|
11555
11555
|
}
|
|
11556
11556
|
case "created_by":
|
|
11557
11557
|
case "modified_by":
|
|
11558
|
-
return (0,
|
|
11558
|
+
return (0, import_records8.isPersonStamp)(value) ? /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(PersonStampChip, { stamp: value }) : void 0;
|
|
11559
11559
|
case "address":
|
|
11560
|
-
return (0,
|
|
11560
|
+
return (0, import_records8.isAddressValue)(value) || typeof value === "string" ? /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(AddressLink, { value }) : void 0;
|
|
11561
11561
|
case "barcode":
|
|
11562
11562
|
return typeof value === "string" ? /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("span", { className: "inline-flex min-w-0 items-center gap-1 font-mono text-xs", "data-records-barcode": "", title: value, children: [
|
|
11563
11563
|
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)("span", { "aria-hidden": "true", className: "text-muted-foreground", children: "\u25AE\u25AF\u25AE" }),
|
|
@@ -11572,7 +11572,7 @@ function newerKindValue(field2, value, opts = {}) {
|
|
|
11572
11572
|
}
|
|
11573
11573
|
}
|
|
11574
11574
|
function PersonStampChip({ stamp }) {
|
|
11575
|
-
const words2 = (0,
|
|
11575
|
+
const words2 = (0, import_records8.personStampText)(stamp) ?? import_records8.NOT_A_MEMBER_WORDS;
|
|
11576
11576
|
const tier = stamp.actor ?? "user";
|
|
11577
11577
|
const name = tier === "user" ? stamp.name : null;
|
|
11578
11578
|
const initial = tier === "system" ? "\u2699" : tier === "agent" ? "\u2726" : name && name.trim() !== "" ? name.trim()[0].toUpperCase() : "?";
|
|
@@ -11589,8 +11589,8 @@ function PersonStampChip({ stamp }) {
|
|
|
11589
11589
|
] });
|
|
11590
11590
|
}
|
|
11591
11591
|
function AddressLink({ value }) {
|
|
11592
|
-
const words2 = (0,
|
|
11593
|
-
const href = (0,
|
|
11592
|
+
const words2 = (0, import_records8.addressText)(value);
|
|
11593
|
+
const href = (0, import_records8.addressMapUrl)(value);
|
|
11594
11594
|
if (!words2 || !href) return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("span", { className: "text-muted-foreground", children: "\u2014" });
|
|
11595
11595
|
return /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(
|
|
11596
11596
|
import_outbound_react.OutboundLink,
|
|
@@ -11609,11 +11609,11 @@ function AddressLink({ value }) {
|
|
|
11609
11609
|
}
|
|
11610
11610
|
var STATUS_GROUP_MARK = { todo: "\u25CB", in_progress: "\u25D0", done: "\u25CF" };
|
|
11611
11611
|
function statusMarkOf(field2, value, document2) {
|
|
11612
|
-
if ((0,
|
|
11612
|
+
if ((0, import_records8.newerKindOf)(field2) !== "status" || typeof value !== "string") return null;
|
|
11613
11613
|
const chosen = document2?.["_choices"]?.[field2.key];
|
|
11614
11614
|
const key = chosen && typeof chosen === "object" && typeof chosen.key === "string" ? chosen.key : value;
|
|
11615
|
-
const group = (0,
|
|
11616
|
-
return { mark: STATUS_GROUP_MARK[group], group, words:
|
|
11615
|
+
const group = (0, import_records8.statusGroupOf)(field2, key);
|
|
11616
|
+
return { mark: STATUS_GROUP_MARK[group], group, words: import_records8.STATUS_GROUP_WORDS[group] };
|
|
11617
11617
|
}
|
|
11618
11618
|
function inline(text, key) {
|
|
11619
11619
|
const out = [];
|
|
@@ -11641,7 +11641,7 @@ function marks(text, key) {
|
|
|
11641
11641
|
if (tok.startsWith("**") || tok.startsWith("__")) out.push(/* @__PURE__ */ (0, import_jsx_runtime16.jsx)("strong", { children: tok.slice(2, -2) }, k));
|
|
11642
11642
|
else if (tok.startsWith("[")) {
|
|
11643
11643
|
const link = /^\[([^\]]+)\]\(([^)\s]+)\)$/.exec(tok);
|
|
11644
|
-
const href = (0,
|
|
11644
|
+
const href = (0, import_records8.safeLinkHref)(link?.[2] ?? "");
|
|
11645
11645
|
out.push(
|
|
11646
11646
|
href ? /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_outbound_react.OutboundLink, { href, className: "text-primary underline-offset-2 hover:underline", onClick: own, children: link?.[1] }, k) : link?.[1] ?? tok
|
|
11647
11647
|
);
|
|
@@ -11706,7 +11706,7 @@ function SafeMarkdown({ text, clipped }) {
|
|
|
11706
11706
|
);
|
|
11707
11707
|
}
|
|
11708
11708
|
function newerKindControl(props) {
|
|
11709
|
-
switch ((0,
|
|
11709
|
+
switch ((0, import_records8.newerKindOf)(props.field)) {
|
|
11710
11710
|
case "duration":
|
|
11711
11711
|
return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(DurationControl, { ...props });
|
|
11712
11712
|
case "address":
|
|
@@ -11722,10 +11722,10 @@ function newerKindControl(props) {
|
|
|
11722
11722
|
}
|
|
11723
11723
|
}
|
|
11724
11724
|
function DurationControl({ value, onChange, disabled, id }) {
|
|
11725
|
-
const [text, setText] = (0, import_react28.useState)(() => (0,
|
|
11725
|
+
const [text, setText] = (0, import_react28.useState)(() => (0, import_records8.durationText)(value) ?? "");
|
|
11726
11726
|
const [wrong, setWrong] = (0, import_react28.useState)(false);
|
|
11727
11727
|
(0, import_react28.useEffect)(() => {
|
|
11728
|
-
setText((0,
|
|
11728
|
+
setText((0, import_records8.durationText)(value) ?? "");
|
|
11729
11729
|
}, [value]);
|
|
11730
11730
|
return /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("span", { className: "flex flex-col gap-1", children: [
|
|
11731
11731
|
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
@@ -11745,12 +11745,12 @@ function DurationControl({ value, onChange, disabled, id }) {
|
|
|
11745
11745
|
onChange(null);
|
|
11746
11746
|
return;
|
|
11747
11747
|
}
|
|
11748
|
-
const seconds = (0,
|
|
11748
|
+
const seconds = (0, import_records8.readTypedDuration)(e.target.value);
|
|
11749
11749
|
setWrong(seconds === null);
|
|
11750
11750
|
if (seconds !== null) onChange(seconds);
|
|
11751
11751
|
},
|
|
11752
11752
|
onBlur: () => {
|
|
11753
|
-
if (!wrong) setText((0,
|
|
11753
|
+
if (!wrong) setText((0, import_records8.durationText)(value) ?? "");
|
|
11754
11754
|
}
|
|
11755
11755
|
}
|
|
11756
11756
|
),
|
|
@@ -11772,13 +11772,13 @@ var ADDRESS_EXAMPLES = {
|
|
|
11772
11772
|
country: "US"
|
|
11773
11773
|
};
|
|
11774
11774
|
function AddressControl({ value, onChange, disabled, id }) {
|
|
11775
|
-
const held = (0,
|
|
11775
|
+
const held = (0, import_records8.isAddressValue)(value) ? value : typeof value === "string" && value.trim() !== "" ? { street: value } : {};
|
|
11776
11776
|
const set = (part, words2) => {
|
|
11777
11777
|
const next = { ...held, [part]: words2 };
|
|
11778
11778
|
const kept = Object.fromEntries(Object.entries(next).filter(([, v]) => typeof v === "string" && v.trim() !== ""));
|
|
11779
11779
|
onChange(Object.keys(kept).length === 0 ? null : kept);
|
|
11780
11780
|
};
|
|
11781
|
-
return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("span", { id, className: "grid grid-cols-2 gap-1.5", "data-records-address-control": "", children:
|
|
11781
|
+
return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("span", { id, className: "grid grid-cols-2 gap-1.5", "data-records-address-control": "", children: import_records8.ADDRESS_PARTS.map((part) => /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
11782
11782
|
import_design_system14.BasicInput,
|
|
11783
11783
|
{
|
|
11784
11784
|
"aria-label": ADDRESS_LABELS[part],
|
|
@@ -11859,7 +11859,7 @@ init_names();
|
|
|
11859
11859
|
|
|
11860
11860
|
// src/RelationPicker.tsx
|
|
11861
11861
|
var import_react29 = require("react");
|
|
11862
|
-
var
|
|
11862
|
+
var import_records9 = require("@ai-matrx/records");
|
|
11863
11863
|
var import_react30 = require("@ai-matrx/records/react");
|
|
11864
11864
|
var import_design_system15 = require("@ai-matrx/design-system");
|
|
11865
11865
|
init_PickOrAdd();
|
|
@@ -12056,7 +12056,7 @@ function RelationPicker({ field: field2, value, onChange, disabled, id, classNam
|
|
|
12056
12056
|
toggle(createdId);
|
|
12057
12057
|
};
|
|
12058
12058
|
const apart = tellApart(rows ?? [], titleOf);
|
|
12059
|
-
const visible = (0,
|
|
12059
|
+
const visible = (0, import_records9.rankTypedMatches)(rows ?? [], search, (row) => [titleOf(row.id), apart.get(row.id) ?? ""]);
|
|
12060
12060
|
const anchored = autoOpen === true;
|
|
12061
12061
|
const cellChips = picked.map((recordId) => /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
12062
12062
|
RecordChip,
|
|
@@ -12179,7 +12179,7 @@ function RelationPicker({ field: field2, value, onChange, disabled, id, classNam
|
|
|
12179
12179
|
var import_react79 = require("react");
|
|
12180
12180
|
var import_design_system48 = require("@ai-matrx/design-system");
|
|
12181
12181
|
var import_data_table7 = require("@ai-matrx/design-system/data-table");
|
|
12182
|
-
var
|
|
12182
|
+
var import_records32 = require("@ai-matrx/records");
|
|
12183
12183
|
var import_react80 = require("@ai-matrx/records/react");
|
|
12184
12184
|
init_Refusal();
|
|
12185
12185
|
|
|
@@ -12221,7 +12221,7 @@ function columnNameProblemLine(name, noun = "column") {
|
|
|
12221
12221
|
// src/FieldEditor.tsx
|
|
12222
12222
|
var import_react77 = require("react");
|
|
12223
12223
|
var import_react78 = require("@ai-matrx/records/react");
|
|
12224
|
-
var
|
|
12224
|
+
var import_core17 = require("@ai-matrx/records/core");
|
|
12225
12225
|
var import_design_system47 = require("@ai-matrx/design-system");
|
|
12226
12226
|
init_parity();
|
|
12227
12227
|
init_fieldTypes();
|
|
@@ -12229,7 +12229,7 @@ init_fieldTypes();
|
|
|
12229
12229
|
// src/FormulaTextEditor.tsx
|
|
12230
12230
|
var import_react31 = require("react");
|
|
12231
12231
|
var import_react32 = require("@ai-matrx/records/react");
|
|
12232
|
-
var
|
|
12232
|
+
var import_records10 = require("@ai-matrx/records");
|
|
12233
12233
|
var import_design_system16 = require("@ai-matrx/design-system");
|
|
12234
12234
|
init_host();
|
|
12235
12235
|
init_Refusal();
|
|
@@ -12254,7 +12254,7 @@ var NOT_TYPED_BY_NAME = /* @__PURE__ */ new Set([
|
|
|
12254
12254
|
function formulaFunctionNames(kinds) {
|
|
12255
12255
|
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();
|
|
12256
12256
|
}
|
|
12257
|
-
var FORMULA_FUNCTION_NAMES = formulaFunctionNames(
|
|
12257
|
+
var FORMULA_FUNCTION_NAMES = formulaFunctionNames(import_records10.RULE_NODE_KINDS);
|
|
12258
12258
|
var RESULT_WORD = {
|
|
12259
12259
|
number: "a number",
|
|
12260
12260
|
text: "text",
|
|
@@ -12525,6 +12525,11 @@ var import_design_system41 = require("@ai-matrx/design-system");
|
|
|
12525
12525
|
var import_react70 = require("@ai-matrx/records/react");
|
|
12526
12526
|
init_Refusal();
|
|
12527
12527
|
|
|
12528
|
+
// src/leadingBlank.ts
|
|
12529
|
+
function withoutLeadingBlank(text) {
|
|
12530
|
+
return text.replace(/^\s+/, "");
|
|
12531
|
+
}
|
|
12532
|
+
|
|
12528
12533
|
// src/values.tsx
|
|
12529
12534
|
init_personChip();
|
|
12530
12535
|
var import_data_table4 = require("@ai-matrx/design-system/data-table");
|
|
@@ -12617,7 +12622,7 @@ init_enumLabels();
|
|
|
12617
12622
|
|
|
12618
12623
|
// src/EntityReferenceControl.tsx
|
|
12619
12624
|
var import_react36 = require("react");
|
|
12620
|
-
var
|
|
12625
|
+
var import_records11 = require("@ai-matrx/records");
|
|
12621
12626
|
var import_react37 = require("@ai-matrx/records/react");
|
|
12622
12627
|
var import_design_system18 = require("@ai-matrx/design-system");
|
|
12623
12628
|
init_PickOrAdd();
|
|
@@ -12627,7 +12632,7 @@ var import_jsx_runtime21 = require("react/jsx-runtime");
|
|
|
12627
12632
|
var WITHHELD_ENTITY_LABEL = "Something you have not been given access to";
|
|
12628
12633
|
var ENTITY_REFERENCE_EMPTY = "Nothing is pointed at yet.";
|
|
12629
12634
|
function entityReferenceText(value) {
|
|
12630
|
-
const refs = (0,
|
|
12635
|
+
const refs = (0, import_records11.entityRefsOf)(value);
|
|
12631
12636
|
if (refs.length === 0) return "\u2014";
|
|
12632
12637
|
return refs.map((r) => r.label ?? WITHHELD_ENTITY_LABEL).join(", ");
|
|
12633
12638
|
}
|
|
@@ -12641,7 +12646,7 @@ function EntityReferenceControl(props) {
|
|
|
12641
12646
|
return client ? /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(WithWords, { ...props }) : /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(Chips, { ...props, words: null, picker: null });
|
|
12642
12647
|
}
|
|
12643
12648
|
function WithWords(props) {
|
|
12644
|
-
const refs = (0, import_react36.useMemo)(() => (0,
|
|
12649
|
+
const refs = (0, import_react36.useMemo)(() => (0, import_records11.entityRefsOf)(props.value), [props.value]);
|
|
12645
12650
|
const [known, setKnown] = (0, import_react36.useState)([]);
|
|
12646
12651
|
const withKnown = refs.map((r) => r.label === null ? known.find((k) => k.token === r.token && k.id === r.id) ?? r : r);
|
|
12647
12652
|
const unlabelled = (0, import_react36.useMemo)(
|
|
@@ -12659,7 +12664,7 @@ function WithWords(props) {
|
|
|
12659
12664
|
setKnown((k) => [...k.filter((x) => !(x.token === picked.token && x.id === picked.id)), picked]);
|
|
12660
12665
|
const multi = Boolean(props.field.multi);
|
|
12661
12666
|
const next = multi ? [...withKnown.filter((x) => !(x.token === picked.token && x.id === picked.id)), picked] : [picked];
|
|
12662
|
-
props.onChange((0,
|
|
12667
|
+
props.onChange((0, import_records11.entityRefsToWrite)(next, multi));
|
|
12663
12668
|
}
|
|
12664
12669
|
}
|
|
12665
12670
|
);
|
|
@@ -12748,7 +12753,7 @@ function Chips({
|
|
|
12748
12753
|
words: words2,
|
|
12749
12754
|
picker
|
|
12750
12755
|
}) {
|
|
12751
|
-
const refs = (0, import_react36.useMemo)(() => (0,
|
|
12756
|
+
const refs = (0, import_react36.useMemo)(() => (0, import_records11.entityRefsOf)(value), [value]);
|
|
12752
12757
|
const labelOf = (token2, refId, own3) => {
|
|
12753
12758
|
if (own3) return own3;
|
|
12754
12759
|
const read = words2?.data?.find((w) => w.token === token2 && w.id === refId)?.label;
|
|
@@ -12772,7 +12777,7 @@ function Chips({
|
|
|
12772
12777
|
"aria-label": `Take ${label} off`,
|
|
12773
12778
|
onClick: () => {
|
|
12774
12779
|
const rest = refs.filter((x) => !(x.token === r.token && x.id === r.id));
|
|
12775
|
-
onChange((0,
|
|
12780
|
+
onChange((0, import_records11.entityRefsToWrite)(rest, multi));
|
|
12776
12781
|
},
|
|
12777
12782
|
children: "\xD7"
|
|
12778
12783
|
}
|
|
@@ -12784,11 +12789,11 @@ function Chips({
|
|
|
12784
12789
|
}
|
|
12785
12790
|
|
|
12786
12791
|
// src/values.tsx
|
|
12787
|
-
var
|
|
12792
|
+
var import_core16 = require("@ai-matrx/records/core");
|
|
12788
12793
|
|
|
12789
12794
|
// src/WholeValue.tsx
|
|
12790
12795
|
var import_react38 = require("react");
|
|
12791
|
-
var
|
|
12796
|
+
var import_core11 = require("@ai-matrx/records/core");
|
|
12792
12797
|
var import_design_system19 = require("@ai-matrx/design-system");
|
|
12793
12798
|
init_host();
|
|
12794
12799
|
init_names();
|
|
@@ -12796,7 +12801,7 @@ var import_outbound_react2 = require("@ai-matrx/kit/outbound-react");
|
|
|
12796
12801
|
var import_jsx_runtime22 = require("react/jsx-runtime");
|
|
12797
12802
|
var WHOLE_VALUE_UNBOUND = "The whole text is kept as a file, and this screen has no way to open files yet.";
|
|
12798
12803
|
function wholeValueLine(pointer) {
|
|
12799
|
-
return `Open the whole text (${(0,
|
|
12804
|
+
return `Open the whole text (${(0, import_core11.wholeValueSize)(pointer)})`;
|
|
12800
12805
|
}
|
|
12801
12806
|
function WholeValueCell({ words: words2, pointer }) {
|
|
12802
12807
|
const host = useRecordsUi();
|
|
@@ -12807,12 +12812,12 @@ function WholeValueCell({ words: words2, pointer }) {
|
|
|
12807
12812
|
words2,
|
|
12808
12813
|
"\u2026"
|
|
12809
12814
|
] }),
|
|
12810
|
-
href ? host.Link ? host.Link({ href, children: line, className: "shrink-0 text-xs text-primary underline-offset-2 hover:underline" }) : /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_outbound_react2.OutboundLink, { className: "shrink-0 text-xs text-primary underline-offset-2 hover:underline", href, children: line }) : /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("span", { className: "shrink-0 text-xs italic text-muted-foreground", title: WHOLE_VALUE_UNBOUND, children: `${(0,
|
|
12815
|
+
href ? host.Link ? host.Link({ href, children: line, className: "shrink-0 text-xs text-primary underline-offset-2 hover:underline" }) : /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_outbound_react2.OutboundLink, { className: "shrink-0 text-xs text-primary underline-offset-2 hover:underline", href, children: line }) : /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("span", { className: "shrink-0 text-xs italic text-muted-foreground", title: WHOLE_VALUE_UNBOUND, children: `${(0, import_core11.wholeValueSize)(pointer)} in a file` })
|
|
12811
12816
|
] });
|
|
12812
12817
|
}
|
|
12813
12818
|
var WHOLE_VALUE_NOT_EDITABLE_HERE = "The whole text is kept as a file. Open it to read it; this screen cannot load it to edit.";
|
|
12814
12819
|
function wholeValueOpening(pointer) {
|
|
12815
|
-
return `Opening the whole text (${(0,
|
|
12820
|
+
return `Opening the whole text (${(0, import_core11.wholeValueSize)(pointer)})\u2026`;
|
|
12816
12821
|
}
|
|
12817
12822
|
function useWholeText(pointer) {
|
|
12818
12823
|
const host = useRecordsUi();
|
|
@@ -13416,7 +13421,7 @@ function AttachmentControl({
|
|
|
13416
13421
|
}
|
|
13417
13422
|
|
|
13418
13423
|
// src/ReferenceChips.tsx
|
|
13419
|
-
var
|
|
13424
|
+
var import_records12 = require("@ai-matrx/records");
|
|
13420
13425
|
var import_design_system24 = require("@ai-matrx/design-system");
|
|
13421
13426
|
init_host();
|
|
13422
13427
|
init_kindValues();
|
|
@@ -13437,7 +13442,7 @@ function iconOf(pair) {
|
|
|
13437
13442
|
}
|
|
13438
13443
|
function referencesOf(field2, value, kind2, labels) {
|
|
13439
13444
|
if (kind2 === "entity_reference") {
|
|
13440
|
-
return (0,
|
|
13445
|
+
return (0, import_records12.entityRefsOf)(value).map((r) => ({ token: r.token, id: r.id, label: r.label }));
|
|
13441
13446
|
}
|
|
13442
13447
|
const ids = (Array.isArray(value) ? value : [value]).filter(isId).map(String);
|
|
13443
13448
|
const tableId = typeof field2.relation_target === "string" ? field2.relation_target : void 0;
|
|
@@ -13625,7 +13630,7 @@ function ClampedChips({
|
|
|
13625
13630
|
init_kindValues();
|
|
13626
13631
|
|
|
13627
13632
|
// src/formulaNames.ts
|
|
13628
|
-
var
|
|
13633
|
+
var import_records13 = require("@ai-matrx/records");
|
|
13629
13634
|
init_names();
|
|
13630
13635
|
function fieldRefsOf(expr) {
|
|
13631
13636
|
const out = [];
|
|
@@ -13734,7 +13739,7 @@ function formulaSourceArchived(field2, document2) {
|
|
|
13734
13739
|
const keys = (field2.config ?? {})[FORMULA_INPUT_KEYS];
|
|
13735
13740
|
if (!Array.isArray(keys) || !document2) return null;
|
|
13736
13741
|
for (const key of keys) {
|
|
13737
|
-
const state2 = (0,
|
|
13742
|
+
const state2 = (0, import_records13.sourceArchivedOf)(document2[String(key)]);
|
|
13738
13743
|
if (state2) return state2;
|
|
13739
13744
|
}
|
|
13740
13745
|
return null;
|
|
@@ -13755,7 +13760,7 @@ function withFormulaDisplayNow(field2, fields, kindOf, currencyCodeOf) {
|
|
|
13755
13760
|
}
|
|
13756
13761
|
|
|
13757
13762
|
// src/values.tsx
|
|
13758
|
-
var
|
|
13763
|
+
var import_records24 = require("@ai-matrx/records");
|
|
13759
13764
|
var import_uuid7 = require("@ai-matrx/kit/uuid");
|
|
13760
13765
|
|
|
13761
13766
|
// src/personNames.ts
|
|
@@ -13814,7 +13819,7 @@ function usePeopleTick() {
|
|
|
13814
13819
|
}
|
|
13815
13820
|
|
|
13816
13821
|
// src/cellMarks.tsx
|
|
13817
|
-
var
|
|
13822
|
+
var import_records14 = require("@ai-matrx/records");
|
|
13818
13823
|
|
|
13819
13824
|
// src/RetiredValues.tsx
|
|
13820
13825
|
var import_react46 = require("react");
|
|
@@ -13942,7 +13947,7 @@ function bound(value) {
|
|
|
13942
13947
|
function keptAsideReason(field2, entry) {
|
|
13943
13948
|
const rules = field2.rules ?? [];
|
|
13944
13949
|
const numeric = typeof entry.value === "string" && /^-?\d+(\.\d+)?$/.test(entry.value.trim()) ? Number(entry.value) : entry.value;
|
|
13945
|
-
const rule = (0,
|
|
13950
|
+
const rule = (0, import_records14.ruleThatRefuses)(rules, numeric);
|
|
13946
13951
|
let why = null;
|
|
13947
13952
|
if (rule?.kind === "min") why = `Must be at least ${bound(rule.value)}`;
|
|
13948
13953
|
else if (rule?.kind === "max") why = `Must be at most ${bound(rule.value)}`;
|
|
@@ -14194,9 +14199,9 @@ function RecordsTable({ items }) {
|
|
|
14194
14199
|
const pictureFirst = [...keys].sort((a, b) => rank(a, items) - rank(b, items)).slice(0, TABLE_COLUMNS);
|
|
14195
14200
|
const shown5 = all ? items : items.slice(0, TABLE_ROWS);
|
|
14196
14201
|
return /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)("div", { className: "min-w-0", "data-records-structured": "table", children: [
|
|
14197
|
-
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)("div", { className: "max-w-full overflow-x-auto rounded-md border border-border", children: /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)("table", { className: "w-full border-collapse text-xs", children: [
|
|
14202
|
+
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)("div", { className: "max-w-full overflow-x-auto rounded-md border border-border", "data-records-structured-table-frame": "", children: /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)("table", { className: "w-full border-collapse text-xs", children: [
|
|
14198
14203
|
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)("thead", { className: "bg-muted/60 text-left", children: /* @__PURE__ */ (0, import_jsx_runtime43.jsx)("tr", { children: pictureFirst.map((k) => /* @__PURE__ */ (0, import_jsx_runtime43.jsx)("th", { scope: "col", className: "whitespace-nowrap px-2 py-1 font-medium text-muted-foreground", children: keyWords(k) }, k)) }) }),
|
|
14199
|
-
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)("tbody", { children: shown5.map((item, i) => /* @__PURE__ */ (0, import_jsx_runtime43.jsx)("tr", { className: "border-t border-border/60 align-top", children: pictureFirst.map((k) => /* @__PURE__ */ (0, import_jsx_runtime43.jsx)("td", { className: "min-w-[
|
|
14204
|
+
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)("tbody", { children: shown5.map((item, i) => /* @__PURE__ */ (0, import_jsx_runtime43.jsx)("tr", { className: "border-t border-border/60 align-top", children: pictureFirst.map((k) => /* @__PURE__ */ (0, import_jsx_runtime43.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_runtime43.jsx)(Nested, { value: item[k], keyName: k, dense: true }) : /* @__PURE__ */ (0, import_jsx_runtime43.jsx)("span", { className: "text-muted-foreground", children: "\u2014" }) }, k)) }, i)) })
|
|
14200
14205
|
] }) }),
|
|
14201
14206
|
items.length > TABLE_ROWS ? /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(import_design_system39.Button, { type: "button", variant: "ghost", size: "sm", className: "mt-1 h-6 px-2 text-xs", onClick: (e) => {
|
|
14202
14207
|
stop(e);
|
|
@@ -14408,7 +14413,7 @@ function structuredNode(field2, structured, room) {
|
|
|
14408
14413
|
return room === "cell" ? /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(StructuredCell, { structured, label }) : /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(StructuredValueView, { structured, label });
|
|
14409
14414
|
}
|
|
14410
14415
|
function renderValue(field2, value, document2, labels, stillWaitingFor, look, room = "cell") {
|
|
14411
|
-
const archivedSource = (0,
|
|
14416
|
+
const archivedSource = (0, import_records24.sourceArchivedOf)(value);
|
|
14412
14417
|
if (archivedSource) return /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(SourceArchivedValue, { state: archivedSource });
|
|
14413
14418
|
const envelope = envelopeFor(document2, field2.key);
|
|
14414
14419
|
if (envelope?.absent) {
|
|
@@ -14431,10 +14436,10 @@ function renderValue(field2, value, document2, labels, stillWaitingFor, look, ro
|
|
|
14431
14436
|
return /* @__PURE__ */ (0, import_jsx_runtime44.jsx)("span", { className: "text-muted-foreground", children: "\u2014" });
|
|
14432
14437
|
}
|
|
14433
14438
|
if (isSignatureField(field2)) return /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(SignatureValue, { value, fieldKey: field2.key, document: document2 });
|
|
14434
|
-
if ((0,
|
|
14439
|
+
if ((0, import_records24.isButtonField)(field2)) return /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(ButtonValue, { field: field2 });
|
|
14435
14440
|
const newer = newerKindValue(field2, value);
|
|
14436
14441
|
if (newer !== void 0) return newer;
|
|
14437
|
-
const whole = typeof value === "string" ? (0,
|
|
14442
|
+
const whole = typeof value === "string" ? (0, import_core16.wholeValueOf)(document2, field2.key) : null;
|
|
14438
14443
|
if (whole) return /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(WholeValueCell, { words: value, pointer: whole });
|
|
14439
14444
|
const kind2 = editorKindFor(field2);
|
|
14440
14445
|
if (kind2 === "relation" || kind2 === "entity_reference") {
|
|
@@ -14569,10 +14574,10 @@ function personWordsOf(kind2, value) {
|
|
|
14569
14574
|
}
|
|
14570
14575
|
function scalarText(field2, value, labels, stillWaitingFor) {
|
|
14571
14576
|
if (value === null || value === void 0) return "\u2014";
|
|
14572
|
-
if ((0,
|
|
14577
|
+
if ((0, import_records24.sourceArchivedOf)(value)) return SOURCE_ARCHIVED_WORDS;
|
|
14573
14578
|
if (isSignatureField(field2)) return signatureWords(value) ?? "\u2014";
|
|
14574
|
-
if ((0,
|
|
14575
|
-
const newerWords = (0,
|
|
14579
|
+
if ((0, import_records24.autonumberPrefixOf)(field2)) return (0, import_records24.autonumberWords)(field2, value) ?? String(value);
|
|
14580
|
+
const newerWords = (0, import_records24.newerKindWords)(field2, value);
|
|
14576
14581
|
if (newerWords !== null) return newerWords;
|
|
14577
14582
|
const kind2 = editorKindFor(field2);
|
|
14578
14583
|
if (kind2 === "entity_reference") return entityReferenceText(value);
|
|
@@ -14607,12 +14612,12 @@ function scalarText(field2, value, labels, stillWaitingFor) {
|
|
|
14607
14612
|
}
|
|
14608
14613
|
if (Array.isArray(value)) return value.length === 0 ? "" : structuredSummary(value);
|
|
14609
14614
|
if (typeof value === "object") return structuredOf(value) ? structuredSummary(value) : "\u2026";
|
|
14610
|
-
return String(value);
|
|
14615
|
+
return typeof value === "string" ? withoutLeadingBlank(value) : String(value);
|
|
14611
14616
|
}
|
|
14612
14617
|
function ProvenanceBadge({ document: document2, fieldKey }) {
|
|
14613
14618
|
const envelope = envelopeFor(document2, fieldKey);
|
|
14614
14619
|
if (!envelope?.src) return null;
|
|
14615
|
-
if ((0,
|
|
14620
|
+
if ((0, import_core16.wholeValueOf)(document2, fieldKey)) return null;
|
|
14616
14621
|
const sources = document2?._sources;
|
|
14617
14622
|
const source = sources?.[envelope.src];
|
|
14618
14623
|
const label = source ? Object.values(source).map(String).join(" \xB7 ") : envelope.src;
|
|
@@ -14633,7 +14638,7 @@ function RecordValue({
|
|
|
14633
14638
|
const labels = useRecordLabels(ONE_FIELD_ARRAY_CACHE(field2));
|
|
14634
14639
|
const stillWaitingFor = useLabelWait(field2);
|
|
14635
14640
|
const embeddedLook = useEmbeddedLook();
|
|
14636
|
-
if ((0,
|
|
14641
|
+
if ((0, import_records24.isButtonField)(field2)) return /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(ButtonValue, { field: field2, recordId, inCell });
|
|
14637
14642
|
if (withheld && (value === null || value === void 0)) return /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(WithheldValue, { field: field2, notice: withheld });
|
|
14638
14643
|
if (value === null || value === void 0) {
|
|
14639
14644
|
const failed = workedOutErrorFor(document2, field2.key);
|
|
@@ -14643,7 +14648,7 @@ function RecordValue({
|
|
|
14643
14648
|
const kept = keptAsideFor(document2, field2.key);
|
|
14644
14649
|
if (kept) return /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(KeptAsideValue, { field: field2, entry: kept, shown: scalarText(field2, kept.value) });
|
|
14645
14650
|
}
|
|
14646
|
-
const archivedSource = (0,
|
|
14651
|
+
const archivedSource = (0, import_records24.sourceArchivedOf)(value);
|
|
14647
14652
|
if (archivedSource) return /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(SourceArchivedValue, { state: archivedSource });
|
|
14648
14653
|
if (formulaHasNothingToWorkOn(field2, document2)) return embeddedLook?.blankEmpty ? null : /* @__PURE__ */ (0, import_jsx_runtime44.jsx)("span", { className: "text-muted-foreground", children: "\u2014" });
|
|
14649
14654
|
if (value !== null && value !== void 0 && value !== "" && !envelopeFor(document2, field2.key)?.absent) {
|
|
@@ -14651,13 +14656,13 @@ function RecordValue({
|
|
|
14651
14656
|
if (newer !== void 0) return /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(import_jsx_runtime44.Fragment, { children: newer });
|
|
14652
14657
|
}
|
|
14653
14658
|
const room = inCell && !roomy ? "cell" : "full";
|
|
14654
|
-
if (value !== null && value !== void 0 && !(0,
|
|
14659
|
+
if (value !== null && value !== void 0 && !(0, import_core16.wholeValueOf)(document2, field2.key) && !envelopeFor(document2, field2.key)?.absent) {
|
|
14655
14660
|
const structured = structuredValueOf(field2, value);
|
|
14656
14661
|
if (structured) return /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(import_jsx_runtime44.Fragment, { children: structuredNode(field2, structured, room) });
|
|
14657
14662
|
}
|
|
14658
|
-
if (inCell && ui.grid === "merged" && ui.renderText && typeof value === "string" && value.trim() !== "" && editorKindFor(field2) === "long_text" && !shownAsOf(field2) && !(0,
|
|
14663
|
+
if (inCell && ui.grid === "merged" && ui.renderText && typeof value === "string" && value.trim() !== "" && editorKindFor(field2) === "long_text" && !shownAsOf(field2) && !(0, import_core16.wholeValueOf)(document2, field2.key) && !envelopeFor(document2, field2.key)?.absent && // A long-text cell holding a kind is drawn by the kind system below, not as markdown.
|
|
14659
14664
|
!kindValueOf(value)) {
|
|
14660
|
-
return /* @__PURE__ */ (0, import_jsx_runtime44.jsx)("span", { className: "block h-[1.5em] min-w-0 overflow-hidden whitespace-normal [[data-matrx-cell-lines]:not([data-matrx-cell-lines=one])_&]:h-auto", "data-records-cell-text": "", children: ui.renderText(value, "cell") });
|
|
14665
|
+
return /* @__PURE__ */ (0, import_jsx_runtime44.jsx)("span", { className: "block h-[1.5em] min-w-0 overflow-hidden whitespace-normal [[data-matrx-cell-lines]:not([data-matrx-cell-lines=one])_&]:h-auto", "data-records-cell-text": "", children: ui.renderText(withoutLeadingBlank(value), "cell") });
|
|
14661
14666
|
}
|
|
14662
14667
|
if (isSignatureField(field2) && value !== null && value !== void 0 && value !== "") {
|
|
14663
14668
|
return /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(SignatureValue, { value, inCell, recordId, fieldKey: field2.key, document: document2 });
|
|
@@ -14677,7 +14682,7 @@ function RecordValue({
|
|
|
14677
14682
|
}
|
|
14678
14683
|
}
|
|
14679
14684
|
}
|
|
14680
|
-
const pictureAt = value !== null && value !== void 0 && !(0,
|
|
14685
|
+
const pictureAt = value !== null && value !== void 0 && !(0, import_core16.wholeValueOf)(document2, field2.key) && !envelopeFor(document2, field2.key)?.absent ? imageAddressOf(field2, value) : null;
|
|
14681
14686
|
if (pictureAt) return /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(ImageUrlValue, { url: pictureAt, alt: field2.label || field2.key, room });
|
|
14682
14687
|
const shown5 = format ?? formatForField(field2);
|
|
14683
14688
|
const shape = shown5 && (shown5.id === "date" || shown5.id === "datetime") && isDateField(field2) ? dateFormatFor(field2, value) : void 0;
|
|
@@ -14760,7 +14765,7 @@ function SourceArchivedNotice({ fieldId, tableId }) {
|
|
|
14760
14765
|
// src/Condition.tsx
|
|
14761
14766
|
var import_react71 = require("react");
|
|
14762
14767
|
var import_design_system42 = require("@ai-matrx/design-system");
|
|
14763
|
-
var
|
|
14768
|
+
var import_records25 = require("@ai-matrx/records");
|
|
14764
14769
|
init_PickOrAdd();
|
|
14765
14770
|
init_choiceLooks();
|
|
14766
14771
|
var import_react72 = require("@ai-matrx/records/react");
|
|
@@ -14864,7 +14869,7 @@ function ChoiceValue({ field: field2, value, onChange }) {
|
|
|
14864
14869
|
void (0, askOnce_exports.fieldOptionsOnce)(client, field2.id).then((got) => {
|
|
14865
14870
|
if (cancelled) return;
|
|
14866
14871
|
setChoices(
|
|
14867
|
-
got.ok ? (got.data ?? []).map((o) => ({ key: (0,
|
|
14872
|
+
got.ok ? (got.data ?? []).map((o) => ({ key: (0, import_records25.optionKey)(o), label: (0, import_records25.optionLabel)(o) ?? "" })).filter((c) => c.label !== "") : []
|
|
14868
14873
|
);
|
|
14869
14874
|
});
|
|
14870
14875
|
return () => {
|
|
@@ -14882,7 +14887,7 @@ function ChoiceValue({ field: field2, value, onChange }) {
|
|
|
14882
14887
|
}
|
|
14883
14888
|
);
|
|
14884
14889
|
}
|
|
14885
|
-
const shown5 = (0,
|
|
14890
|
+
const shown5 = (0, import_records25.rankTypedMatches)(choices, search.trim(), (c) => c.label);
|
|
14886
14891
|
return /* @__PURE__ */ (0, import_jsx_runtime46.jsx)("span", { className: "inline-flex min-w-0", "data-records-condition-choice": "", "data-pick-value": value, children: /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(
|
|
14887
14892
|
PickOrAdd,
|
|
14888
14893
|
{
|
|
@@ -15316,7 +15321,7 @@ function ConditionGroup({
|
|
|
15316
15321
|
|
|
15317
15322
|
// src/FieldRulePreview.tsx
|
|
15318
15323
|
var import_react73 = require("react");
|
|
15319
|
-
var
|
|
15324
|
+
var import_records26 = require("@ai-matrx/records");
|
|
15320
15325
|
var import_react74 = require("@ai-matrx/records/react");
|
|
15321
15326
|
init_Refusal();
|
|
15322
15327
|
init_names();
|
|
@@ -15357,7 +15362,7 @@ function FieldRulePreview({ field: field2, tableId, rules }) {
|
|
|
15357
15362
|
}
|
|
15358
15363
|
const numbers = holdsNumbers3(field2);
|
|
15359
15364
|
const groups = answer.data.map((row) => ({ value: groupValue(row.groups[field2.key] ?? null, numbers), count: row.row_count }));
|
|
15360
|
-
setPreview((0,
|
|
15365
|
+
setPreview((0, import_records26.previewRuleChange)(latest.current, groups, answer.data.length >= PREVIEW_GROUPS2));
|
|
15361
15366
|
});
|
|
15362
15367
|
}, 300);
|
|
15363
15368
|
return () => {
|
|
@@ -15471,7 +15476,7 @@ function choiceLookForNewList(multi, rows) {
|
|
|
15471
15476
|
}
|
|
15472
15477
|
|
|
15473
15478
|
// src/NewerKindQuestions.tsx
|
|
15474
|
-
var
|
|
15479
|
+
var import_records27 = require("@ai-matrx/records");
|
|
15475
15480
|
var import_design_system43 = require("@ai-matrx/design-system");
|
|
15476
15481
|
var import_jsx_runtime48 = require("react/jsx-runtime");
|
|
15477
15482
|
var STATUS_STARTING_CHOICES = [
|
|
@@ -15492,7 +15497,7 @@ function statusGroupRows(field2, rows, keyOfId, changed2) {
|
|
|
15492
15497
|
if (words2 === "") continue;
|
|
15493
15498
|
const ref = r.id ?? words2;
|
|
15494
15499
|
const key = r.id ? keyOfId[r.id] : void 0;
|
|
15495
|
-
const held = field2 && key ? (0,
|
|
15500
|
+
const held = field2 && key ? (0, import_records27.statusGroupOf)(field2, key) : void 0;
|
|
15496
15501
|
out.push({ ref, words: words2, group: changed2[ref] ?? held ?? guessStatusGroup(words2) });
|
|
15497
15502
|
}
|
|
15498
15503
|
return out;
|
|
@@ -15508,10 +15513,10 @@ function StatusGroupsQuestion({
|
|
|
15508
15513
|
/* @__PURE__ */ (0, import_jsx_runtime48.jsx)("span", { className: "min-w-0 flex-1 truncate text-sm", children: r.words }),
|
|
15509
15514
|
/* @__PURE__ */ (0, import_jsx_runtime48.jsxs)(import_design_system43.Select, { value: r.group, onValueChange: (next) => onGroup(r.ref, next), children: [
|
|
15510
15515
|
/* @__PURE__ */ (0, import_jsx_runtime48.jsx)(import_design_system43.SelectTrigger, { size: "sm", className: "w-36", "aria-label": `Group for ${r.words}`, children: /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(import_design_system43.SelectValue, {}) }),
|
|
15511
|
-
/* @__PURE__ */ (0, import_jsx_runtime48.jsx)(import_design_system43.SelectContent, { children:
|
|
15516
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsx)(import_design_system43.SelectContent, { children: import_records27.STATUS_GROUPS.map((g) => /* @__PURE__ */ (0, import_jsx_runtime48.jsxs)(import_design_system43.SelectItem, { value: g, children: [
|
|
15512
15517
|
STATUS_GROUP_MARK[g],
|
|
15513
15518
|
" ",
|
|
15514
|
-
|
|
15519
|
+
import_records27.STATUS_GROUP_WORDS[g]
|
|
15515
15520
|
] }, g)) })
|
|
15516
15521
|
] })
|
|
15517
15522
|
] }, r.ref))
|
|
@@ -15549,7 +15554,7 @@ function BarcodeSymbologyQuestion({ value, onChange }) {
|
|
|
15549
15554
|
/* @__PURE__ */ (0, import_jsx_runtime48.jsx)(import_design_system43.SelectTrigger, { size: "sm", "aria-label": "Code type", children: /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(import_design_system43.SelectValue, {}) }),
|
|
15550
15555
|
/* @__PURE__ */ (0, import_jsx_runtime48.jsxs)(import_design_system43.SelectContent, { children: [
|
|
15551
15556
|
/* @__PURE__ */ (0, import_jsx_runtime48.jsx)(import_design_system43.SelectItem, { value: "any", children: "Any code" }),
|
|
15552
|
-
|
|
15557
|
+
import_records27.BARCODE_SYMBOLOGIES.map((s) => /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(import_design_system43.SelectItem, { value: s, children: SYMBOLOGY_WORDS[s] }, s))
|
|
15553
15558
|
] })
|
|
15554
15559
|
] })
|
|
15555
15560
|
] });
|
|
@@ -15883,21 +15888,21 @@ function readersSentence(count, tableName2) {
|
|
|
15883
15888
|
|
|
15884
15889
|
// src/FieldEditor.tsx
|
|
15885
15890
|
init_enumLabels();
|
|
15886
|
-
var
|
|
15891
|
+
var import_records30 = require("@ai-matrx/records");
|
|
15887
15892
|
|
|
15888
15893
|
// src/ButtonSettings.tsx
|
|
15889
15894
|
var import_react75 = require("react");
|
|
15890
15895
|
var import_design_system46 = require("@ai-matrx/design-system");
|
|
15891
15896
|
var import_data_table6 = require("@ai-matrx/design-system/data-table");
|
|
15892
|
-
var
|
|
15897
|
+
var import_records29 = require("@ai-matrx/records");
|
|
15893
15898
|
var import_react76 = require("@ai-matrx/records/react");
|
|
15894
15899
|
|
|
15895
15900
|
// src/AccentSwatches.tsx
|
|
15896
|
-
var
|
|
15901
|
+
var import_records28 = require("@ai-matrx/records");
|
|
15897
15902
|
var import_design_system45 = require("@ai-matrx/design-system");
|
|
15898
15903
|
var import_data_table5 = require("@ai-matrx/design-system/data-table");
|
|
15899
15904
|
var import_jsx_runtime50 = require("react/jsx-runtime");
|
|
15900
|
-
function AccentSwatches({ value, onChange, options =
|
|
15905
|
+
function AccentSwatches({ value, onChange, options = import_records28.PORTAL_ACCENTS, noneLabel = "App colour" }) {
|
|
15901
15906
|
return /* @__PURE__ */ (0, import_jsx_runtime50.jsxs)("div", { className: "flex flex-wrap gap-1.5", role: "radiogroup", "aria-label": "Colour", children: [
|
|
15902
15907
|
/* @__PURE__ */ (0, import_jsx_runtime50.jsx)(
|
|
15903
15908
|
"button",
|
|
@@ -15943,7 +15948,7 @@ var DOES_WORDS = {
|
|
|
15943
15948
|
};
|
|
15944
15949
|
function buttonUrlInWords(url, fields) {
|
|
15945
15950
|
let out = url;
|
|
15946
|
-
for (const id of (0,
|
|
15951
|
+
for (const id of (0, import_records29.buttonUrlPlaceholders)(url)) {
|
|
15947
15952
|
const f = fields.find((x) => x.id === id || x.key === id);
|
|
15948
15953
|
if (f) out = out.split(`{{${id}}}`).join(`{${fieldName(f)}}`);
|
|
15949
15954
|
}
|
|
@@ -16038,7 +16043,7 @@ function ButtonSettingsEditor({
|
|
|
16038
16043
|
}
|
|
16039
16044
|
) : null
|
|
16040
16045
|
] }),
|
|
16041
|
-
value.url && (0,
|
|
16046
|
+
value.url && (0, import_records29.buttonUrlPlaceholders)(value.url).length > 0 ? /* @__PURE__ */ (0, import_jsx_runtime51.jsx)("p", { className: "truncate text-[11px] text-muted-foreground", "data-records-button-url-words": "", children: buttonUrlInWords(value.url, fields) }) : null
|
|
16042
16047
|
] }) : null,
|
|
16043
16048
|
value.do === "run_action" ? !tableId ? /* @__PURE__ */ (0, import_jsx_runtime51.jsx)("p", { className: "text-xs text-muted-foreground", children: "Row actions belong to a table" }) : actionsRefused ? /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(RefusalLine, { error: actionsRefused }) : /* @__PURE__ */ (0, import_jsx_runtime51.jsxs)("div", { className: "flex flex-col gap-2", "data-records-button-action": "", children: [
|
|
16044
16049
|
actions === null || actions.length > 0 ? /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(
|
|
@@ -16144,11 +16149,11 @@ function NewRowAction({
|
|
|
16144
16149
|
}
|
|
16145
16150
|
|
|
16146
16151
|
// src/FieldEditor.tsx
|
|
16147
|
-
var
|
|
16152
|
+
var import_records31 = require("@ai-matrx/records");
|
|
16148
16153
|
var import_jsx_runtime52 = require("react/jsx-runtime");
|
|
16149
16154
|
var RULE_KINDS = FIELD_RULE_KIND_VALUES.map((kind2) => ({ kind: kind2, label: FIELD_RULE_KIND_LABEL[kind2] }));
|
|
16150
|
-
var SENSITIVITIES =
|
|
16151
|
-
var AGENT_VISIBILITY =
|
|
16155
|
+
var SENSITIVITIES = import_records31.FIELD_SENSITIVITIES.map((value) => ({ value, label: FIELD_SENSITIVITY_LABEL[value] }));
|
|
16156
|
+
var AGENT_VISIBILITY = import_records31.CONTEXT_POLICIES.map((value) => ({ value, label: CONTEXT_POLICY_LABEL[value] }));
|
|
16152
16157
|
var ROLLUP_OPERATIONS = ROLLUP_AGG_VALUES.map((value) => ({
|
|
16153
16158
|
value,
|
|
16154
16159
|
label: ROLLUP_AGG_LABEL[value]
|
|
@@ -16161,7 +16166,7 @@ var FORMULA_OPERATIONS = FORMULA_OP_VALUES.map((value) => ({
|
|
|
16161
16166
|
label: FORMULA_OP_LABEL[value],
|
|
16162
16167
|
joins: FORMULA_OP_JOINS[value]
|
|
16163
16168
|
}));
|
|
16164
|
-
var STORE_BEHAVIOUR = new Map(
|
|
16169
|
+
var STORE_BEHAVIOUR = new Map(import_records31.DECLARABLE_FIELD_KINDS.map((row) => [row.kind, row.behavior]));
|
|
16165
16170
|
function holdsAValueOnAStandardTable(kind2) {
|
|
16166
16171
|
if (isSystemFieldKind(kind2)) return false;
|
|
16167
16172
|
const behaviour = STORE_BEHAVIOUR.get(kind2);
|
|
@@ -16272,20 +16277,20 @@ function FieldEditor(props) {
|
|
|
16272
16277
|
const [contextPolicy, setContextPolicy] = (0, import_react77.useState)(String(start?.context_policy ?? "include"));
|
|
16273
16278
|
const [rules, setRules] = (0, import_react77.useState)(start?.rules ?? []);
|
|
16274
16279
|
const [startsWith, setStartsWith] = (0, import_react77.useState)(start?.default ?? null);
|
|
16275
|
-
const [ratingMax, setRatingMax] = (0, import_react77.useState)(() => start ? (0,
|
|
16280
|
+
const [ratingMax, setRatingMax] = (0, import_react77.useState)(() => start ? (0, import_records31.ratingMaxOf)(start) : 5);
|
|
16276
16281
|
const savedRules = (0, import_react77.useMemo)(
|
|
16277
|
-
() => field2 ? type === "rating" ? (0,
|
|
16282
|
+
() => field2 ? type === "rating" ? (0, import_records31.rulesWithTopStar)(field2.rules ?? [], (0, import_records31.ratingMaxOf)(field2)) : field2.rules ?? [] : [],
|
|
16278
16283
|
[field2, type]
|
|
16279
16284
|
);
|
|
16280
|
-
const editedRules = (0, import_react77.useMemo)(() => type === "rating" ? (0,
|
|
16285
|
+
const editedRules = (0, import_react77.useMemo)(() => type === "rating" ? (0, import_records31.rulesWithTopStar)(rules, ratingMax) : rules, [type, rules, ratingMax]);
|
|
16281
16286
|
const [statusGroups, setStatusGroups] = (0, import_react77.useState)({});
|
|
16282
16287
|
const [statusKeys, setStatusKeys] = (0, import_react77.useState)({});
|
|
16283
16288
|
const [symbology, setSymbology] = (0, import_react77.useState)(String(start?.config?.["symbology"] ?? ""));
|
|
16284
16289
|
const descriptionStart = String(start?.config?.["description"] ?? "");
|
|
16285
16290
|
const [description, setDescription] = (0, import_react77.useState)(descriptionStart);
|
|
16286
|
-
const buttonStart = (0, import_react77.useMemo)(() => (0,
|
|
16291
|
+
const buttonStart = (0, import_react77.useMemo)(() => (0, import_records30.buttonOf)(start) ?? { label: "" }, [start]);
|
|
16287
16292
|
const [buttonSettings, setButtonSettings] = (0, import_react77.useState)(buttonStart);
|
|
16288
|
-
const prefixStart = (0,
|
|
16293
|
+
const prefixStart = (0, import_records30.autonumberPrefixOf)(start);
|
|
16289
16294
|
const [numberPrefix, setNumberPrefix] = (0, import_react77.useState)(prefixStart);
|
|
16290
16295
|
const dependencyStart = start?.config?.["dependency"] === true;
|
|
16291
16296
|
const [dependency, setDependency] = (0, import_react77.useState)(dependencyStart);
|
|
@@ -16293,7 +16298,7 @@ function FieldEditor(props) {
|
|
|
16293
16298
|
if (!field2 || type !== "status") return;
|
|
16294
16299
|
let live = true;
|
|
16295
16300
|
void client.fieldOptions({ field_id: field2.id }).then((got) => {
|
|
16296
|
-
if (live && got.ok) setStatusKeys(Object.fromEntries((got.data ?? []).map((o) => [String(o.id), (0,
|
|
16301
|
+
if (live && got.ok) setStatusKeys(Object.fromEntries((got.data ?? []).map((o) => [String(o.id), (0, import_records31.optionKey)(o)])));
|
|
16297
16302
|
});
|
|
16298
16303
|
return () => {
|
|
16299
16304
|
live = false;
|
|
@@ -16416,7 +16421,7 @@ function FieldEditor(props) {
|
|
|
16416
16421
|
const nameTaken = columnNameTakenBy(label, others.map(fieldName));
|
|
16417
16422
|
const nameLine = nameTaken ? columnNameTakenLine(nameTaken, noun) : columnNameProblemLine(label, noun);
|
|
16418
16423
|
const listsChoices = type === "select" || type === "multi_select" || type === "status";
|
|
16419
|
-
const buttonMissing = type === "button" && buttonSettings.do ? (0,
|
|
16424
|
+
const buttonMissing = type === "button" && buttonSettings.do ? (0, import_records30.buttonNeeds)(buttonSettings) : null;
|
|
16420
16425
|
const missing = buttonMissing ?? (editing ? formulaMissing ?? (listsChoices ? whatTheChoiceListIsMissing(choiceList) : null) : formulaMissing ?? (listsChoices ? whatTheChoiceListIsMissing(newChoices) : null) ?? (type === "formula" && formulaWritten ? null : whatIsMissing(
|
|
16421
16426
|
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 }
|
|
16422
16427
|
)));
|
|
@@ -16458,7 +16463,7 @@ function FieldEditor(props) {
|
|
|
16458
16463
|
...statusGroupsChanged ? { status_groups: statusGroupsSent } : {},
|
|
16459
16464
|
// V11 #4/#10: a rating's top star goes as `max`, the word custom.field_update now takes the way
|
|
16460
16465
|
// custom.field_declare does; the store writes the max Rule and sets aside any score above it.
|
|
16461
|
-
...type === "rating" && ratingMax !== (0,
|
|
16466
|
+
...type === "rating" && ratingMax !== (0, import_records31.ratingMaxOf)(field2) ? { max: ratingMax } : {},
|
|
16462
16467
|
...type === "barcode" && symbology !== String(field2.config?.["symbology"] ?? "") ? { symbology: symbology === "" ? null : symbology } : {},
|
|
16463
16468
|
...type === "button" && JSON.stringify(buttonSettings) !== JSON.stringify(buttonStart) ? { button: buttonSettings } : {},
|
|
16464
16469
|
...field2.type === "relation" && dependency !== dependencyStart ? { dependency } : {},
|
|
@@ -16493,7 +16498,7 @@ function FieldEditor(props) {
|
|
|
16493
16498
|
return;
|
|
16494
16499
|
}
|
|
16495
16500
|
(0, import_react78.tableShapeChanged)(tableId);
|
|
16496
|
-
for (const c of done.data.undo.cells_back) (0,
|
|
16501
|
+
for (const c of done.data.undo.cells_back) (0, import_core17.announceRecordChanged)(c.record_id);
|
|
16497
16502
|
const n = done.data.rehomed.reduce((sum, r) => sum + r.records, 0);
|
|
16498
16503
|
setRehome({});
|
|
16499
16504
|
setRehomed({ said: `Saved. ${n} ${n === 1 ? "record was" : "records were"} changed with the choices.`, undo: done.data.undo });
|
|
@@ -17007,7 +17012,7 @@ function FieldEditor(props) {
|
|
|
17007
17012
|
return;
|
|
17008
17013
|
}
|
|
17009
17014
|
(0, import_react78.tableShapeChanged)(tableId);
|
|
17010
|
-
for (const c of undo.cells_back) (0,
|
|
17015
|
+
for (const c of undo.cells_back) (0, import_core17.announceRecordChanged)(c.record_id);
|
|
17011
17016
|
setChoiceList(null);
|
|
17012
17017
|
setChoiceListStart(null);
|
|
17013
17018
|
setRehomed({ said: "Undone. The choices and the records that held them are back as they were.", undo: null });
|
|
@@ -17468,17 +17473,44 @@ function buttonPressWords(label, pressed) {
|
|
|
17468
17473
|
}
|
|
17469
17474
|
var POLL_EVERY_MS = 1200;
|
|
17470
17475
|
var POLL_FOR_MS = 12e4;
|
|
17471
|
-
|
|
17476
|
+
var RUN_BOOKKEEPING = /* @__PURE__ */ new Set(["run_id", "conversation_id"]);
|
|
17477
|
+
function answerOf(output) {
|
|
17478
|
+
const raw = (output ?? "").trim();
|
|
17479
|
+
if (raw === "") return { words: "" };
|
|
17480
|
+
let parsed;
|
|
17481
|
+
try {
|
|
17482
|
+
parsed = JSON.parse(raw);
|
|
17483
|
+
} catch {
|
|
17484
|
+
return { words: raw };
|
|
17485
|
+
}
|
|
17486
|
+
if (typeof parsed === "string") return { words: parsed.trim() };
|
|
17487
|
+
if (typeof parsed === "object" && parsed !== null && !Array.isArray(parsed)) {
|
|
17488
|
+
const shown5 = Object.fromEntries(Object.entries(parsed).filter(([k]) => !RUN_BOOKKEEPING.has(k)));
|
|
17489
|
+
const keys = Object.keys(shown5);
|
|
17490
|
+
if (keys.length === 1 && typeof shown5.text === "string") return { words: shown5.text.trim() };
|
|
17491
|
+
const value2 = structuredOf(shown5);
|
|
17492
|
+
return value2 ? { words: "", value: value2 } : { words: raw };
|
|
17493
|
+
}
|
|
17494
|
+
const value = structuredOf(parsed);
|
|
17495
|
+
return value ? { words: "", value } : { words: raw };
|
|
17496
|
+
}
|
|
17497
|
+
function runAnswer(label, run) {
|
|
17472
17498
|
const steps = run.steps ?? [];
|
|
17473
17499
|
const failedStep = [...steps].reverse().find((s) => s.status === "failed");
|
|
17474
|
-
if (run.status === "failed")
|
|
17475
|
-
|
|
17476
|
-
|
|
17500
|
+
if (run.status === "failed") {
|
|
17501
|
+
const failed = answerOf(failedStep?.output_text).words || failedStep?.says;
|
|
17502
|
+
return { words: [failed, run.says].filter((t, i, all) => t && all.indexOf(t) === i).join(" ") || `${label} failed.` };
|
|
17503
|
+
}
|
|
17504
|
+
for (const step2 of [...steps].reverse()) {
|
|
17505
|
+
const answered = answerOf(step2.output_text);
|
|
17506
|
+
if (answered.words !== "" || answered.value) return answered;
|
|
17507
|
+
}
|
|
17508
|
+
return { words: run.says || `${label} ran.` };
|
|
17477
17509
|
}
|
|
17478
17510
|
var stop2 = (event) => event.stopPropagation();
|
|
17479
17511
|
function ButtonValue({ field: field2, recordId, inCell }) {
|
|
17480
17512
|
const client = (0, import_react80.useOptionalRecordsClient)();
|
|
17481
|
-
const b = (0,
|
|
17513
|
+
const b = (0, import_records32.buttonOf)(field2);
|
|
17482
17514
|
const [busy, setBusy] = (0, import_react79.useState)(false);
|
|
17483
17515
|
const [said2, setSaid] = (0, import_react79.useState)(null);
|
|
17484
17516
|
const [settingUp, setSettingUp] = (0, import_react79.useState)(false);
|
|
@@ -17486,7 +17518,7 @@ function ButtonValue({ field: field2, recordId, inCell }) {
|
|
|
17486
17518
|
(0, import_react79.useEffect)(() => () => void (waitingOn.current += 1), []);
|
|
17487
17519
|
if (!b) return null;
|
|
17488
17520
|
const color = (0, import_data_table7.isStyleColor)(b.color) ? import_data_table7.CHOICE_CHIP_CLASS[b.color] : import_data_table7.NEUTRAL_CHIP_CLASS;
|
|
17489
|
-
const needs = (0,
|
|
17521
|
+
const needs = (0, import_records32.buttonNeeds)(b);
|
|
17490
17522
|
const tableId = field2.entity_definition_id;
|
|
17491
17523
|
const press = async () => {
|
|
17492
17524
|
if (!client || !recordId) return setSaid({ kind: "public" });
|
|
@@ -17520,7 +17552,8 @@ function ButtonValue({ field: field2, recordId, inCell }) {
|
|
|
17520
17552
|
const run = runs.data.runs.find((r) => r.run_id === pressed.run_id);
|
|
17521
17553
|
if (run && run.status !== "waiting") {
|
|
17522
17554
|
setBusy(false);
|
|
17523
|
-
|
|
17555
|
+
const answer = runAnswer(b.label, run);
|
|
17556
|
+
return setSaid(run.status === "ran" ? { kind: "ran", says: answer.words, value: answer.value } : { kind: "failed", says: answer.words });
|
|
17524
17557
|
}
|
|
17525
17558
|
if (Date.now() > until) {
|
|
17526
17559
|
setBusy(false);
|
|
@@ -17569,7 +17602,8 @@ function ButtonValue({ field: field2, recordId, inCell }) {
|
|
|
17569
17602
|
said2?.kind === "waiting" ? /* @__PURE__ */ (0, import_jsx_runtime53.jsx)("p", { className: "matrx-shimmer rounded px-1 py-0.5", role: "status", "aria-live": "polite", children: said2.says }) : null,
|
|
17570
17603
|
said2?.kind === "failed" ? /* @__PURE__ */ (0, import_jsx_runtime53.jsx)("p", { className: "break-words text-destructive", role: "alert", children: said2.says }) : null,
|
|
17571
17604
|
said2?.kind === "public" ? /* @__PURE__ */ (0, import_jsx_runtime53.jsx)("p", { children: "Buttons run for signed-in people." }) : null,
|
|
17572
|
-
said2?.kind === "ran" ? /* @__PURE__ */ (0, import_jsx_runtime53.jsxs)("
|
|
17605
|
+
said2?.kind === "ran" ? /* @__PURE__ */ (0, import_jsx_runtime53.jsxs)("div", { className: "break-words", children: [
|
|
17606
|
+
said2.value ? /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(StructuredValueView, { structured: said2.value, label: b.label }) : null,
|
|
17573
17607
|
said2.says,
|
|
17574
17608
|
" ",
|
|
17575
17609
|
said2.link ? /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(import_outbound_react7.OutboundLink, { href: said2.link, className: "text-primary underline", children: said2.link }) : null
|
|
@@ -17778,7 +17812,7 @@ function formatControl(args) {
|
|
|
17778
17812
|
// src/typedDateHelper.tsx
|
|
17779
17813
|
var import_react83 = require("react");
|
|
17780
17814
|
var import_design_system50 = require("@ai-matrx/design-system");
|
|
17781
|
-
var
|
|
17815
|
+
var import_records33 = require("@ai-matrx/records");
|
|
17782
17816
|
var import_jsx_runtime56 = require("react/jsx-runtime");
|
|
17783
17817
|
var WEEK = ["Su", "Mo", "Tu", "We", "Th", "Fr", "Sa"];
|
|
17784
17818
|
var MONTHS = ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"];
|
|
@@ -17787,12 +17821,12 @@ function pad2(n) {
|
|
|
17787
17821
|
}
|
|
17788
17822
|
function readBox(text, kind2) {
|
|
17789
17823
|
if (kind2 === "time") {
|
|
17790
|
-
const t = (0,
|
|
17824
|
+
const t = (0, import_records33.readTypedTime)(text);
|
|
17791
17825
|
if (!t.ok) return { day: null, time: null };
|
|
17792
17826
|
const [h, m] = t.value.split(":").map(Number);
|
|
17793
17827
|
return { day: null, time: { h, m } };
|
|
17794
17828
|
}
|
|
17795
|
-
const read = (0,
|
|
17829
|
+
const read = (0, import_records33.readTypedDate)(text, { withTime: kind2 === "datetime" });
|
|
17796
17830
|
if (!read.ok) return { day: null, time: null };
|
|
17797
17831
|
if (kind2 === "datetime" && read.instant) {
|
|
17798
17832
|
const at = new Date(read.instant);
|
|
@@ -17801,10 +17835,10 @@ function readBox(text, kind2) {
|
|
|
17801
17835
|
return { day: read.day, time: null };
|
|
17802
17836
|
}
|
|
17803
17837
|
function wordsFor2(kind2, day2, time) {
|
|
17804
|
-
if (kind2 === "time") return time ? (0,
|
|
17838
|
+
if (kind2 === "time") return time ? (0, import_records33.typedTimeText)(time.h, time.m) : "";
|
|
17805
17839
|
if (!day2) return "";
|
|
17806
|
-
const dayText = (0,
|
|
17807
|
-
return kind2 === "datetime" && time ? `${dayText} ${(0,
|
|
17840
|
+
const dayText = (0, import_records33.typedDateText)(day2);
|
|
17841
|
+
return kind2 === "datetime" && time ? `${dayText} ${(0, import_records33.typedTimeText)(time.h, time.m)}` : dayText;
|
|
17808
17842
|
}
|
|
17809
17843
|
var keepFocus = { onMouseDown: (e) => e.preventDefault(), tabIndex: -1 };
|
|
17810
17844
|
function CalendarGlyph() {
|
|
@@ -17926,7 +17960,7 @@ function TypedDateHelper({
|
|
|
17926
17960
|
held.time && held.time.h === t.h && held.time.m === t.m ? "bg-primary text-primary-foreground" : ""
|
|
17927
17961
|
),
|
|
17928
17962
|
onClick: () => pickTime(t),
|
|
17929
|
-
children: (0,
|
|
17963
|
+
children: (0, import_records33.typedTimeText)(t.h, t.m)
|
|
17930
17964
|
},
|
|
17931
17965
|
`${t.h}:${t.m}`
|
|
17932
17966
|
)) })
|
|
@@ -17983,7 +18017,7 @@ function FieldLabel({ field: field2, htmlFor, children }) {
|
|
|
17983
18017
|
return /* @__PURE__ */ (0, import_jsx_runtime57.jsxs)("div", { className: "flex items-baseline gap-1.5", children: [
|
|
17984
18018
|
/* @__PURE__ */ (0, import_jsx_runtime57.jsx)(import_design_system51.Label, { htmlFor, className: "text-xs font-medium", children: fieldName(field2) }),
|
|
17985
18019
|
field2.required ? /* @__PURE__ */ (0, import_jsx_runtime57.jsx)("span", { className: "text-xs text-destructive", children: "required" }) : null,
|
|
17986
|
-
field2.unit && (0,
|
|
18020
|
+
field2.unit && (0, import_records34.newerKindOf)(field2) !== "duration" ? /* @__PURE__ */ (0, import_jsx_runtime57.jsx)("span", { className: "text-xs text-muted-foreground", children: field2.unit }) : null,
|
|
17987
18021
|
children
|
|
17988
18022
|
] });
|
|
17989
18023
|
}
|
|
@@ -17993,7 +18027,7 @@ function isTypedDraft(value) {
|
|
|
17993
18027
|
var TYPED_AS_WORDS = /* @__PURE__ */ new Set(["text", "long_text", "phone"]);
|
|
17994
18028
|
var TYPED_AND_READ = /* @__PURE__ */ new Set(["number", "currency", "percent", "datetime", "select", "multi_select", "email", "url"]);
|
|
17995
18029
|
function typingOpens(field2) {
|
|
17996
|
-
if ((0,
|
|
18030
|
+
if ((0, import_records34.isButtonField)(field2)) return "none";
|
|
17997
18031
|
const kind2 = String(editorKindFor(field2));
|
|
17998
18032
|
if (kind2 === "formula" || kind2 === "lookup" || kind2 === "rollup") return "none";
|
|
17999
18033
|
if (kind2 === "select" || kind2 === "multi_select" || kind2 === "member") return "search";
|
|
@@ -18019,21 +18053,21 @@ function judgeTyped(field2, text, choices, nudge) {
|
|
|
18019
18053
|
const format = formatForField(field2);
|
|
18020
18054
|
if (trimmed === "") return { value: null };
|
|
18021
18055
|
if (format && format.id === "time") {
|
|
18022
|
-
const read2 = (0,
|
|
18056
|
+
const read2 = (0, import_records34.readTypedTime)(trimmed);
|
|
18023
18057
|
return read2.ok ? { value: read2.value } : { refusal: SHORT_REFUSAL.time, why: `${fieldName(field2)} holds a time of day, and ${read2.why}` };
|
|
18024
18058
|
}
|
|
18025
18059
|
if (kind2 === "select" || kind2 === "multi_select") {
|
|
18026
18060
|
if (!choices || nudge === null) return null;
|
|
18027
18061
|
const several = field2.multi || kind2 === "multi_select";
|
|
18028
18062
|
const words2 = several ? trimmed.split(/\s*[,;\n]\s*/).filter(Boolean) : [trimmed];
|
|
18029
|
-
const allowOther = (0,
|
|
18063
|
+
const allowOther = (0, import_records34.allowsOtherValues)(field2);
|
|
18030
18064
|
const parts = [];
|
|
18031
18065
|
const add = [];
|
|
18032
18066
|
const ask2 = [];
|
|
18033
18067
|
const notChoices = [];
|
|
18034
18068
|
let keepOffered = allowOther;
|
|
18035
18069
|
for (const word of words2) {
|
|
18036
|
-
const decided = (0,
|
|
18070
|
+
const decided = (0, import_records34.decideTypedChoice)({ words: word, options: choices, allowOther, nudge });
|
|
18037
18071
|
if (decided.decision === "empty") continue;
|
|
18038
18072
|
if (decided.decision === "chosen") parts.push(decided.key);
|
|
18039
18073
|
else {
|
|
@@ -18066,7 +18100,7 @@ function judgeTyped(field2, text, choices, nudge) {
|
|
|
18066
18100
|
return usual && digits.length >= 7 && digits.length <= 20 ? { value: trimmed } : { refusal: SHORT_REFUSAL.phone };
|
|
18067
18101
|
}
|
|
18068
18102
|
const showsAsPercent = Boolean(format && (format.id === "percent" || format.id === "progress"));
|
|
18069
|
-
const read = (0,
|
|
18103
|
+
const read = (0, import_records34.coerceTypedAnswer)(field2, text, { label: fieldName(field2), showsAsPercent });
|
|
18070
18104
|
if ("refusal" in read) {
|
|
18071
18105
|
if (kind2 === "email" || kind2 === "url") return { refusal: SHORT_REFUSAL[kind2] };
|
|
18072
18106
|
const short = kind2 === "datetime" ? SHORT_REFUSAL.date : kind2 === "number" || kind2 === "currency" || kind2 === "percent" || showsAsPercent ? SHORT_REFUSAL.number : read.refusal.length <= 32 ? read.refusal : SHORT_REFUSAL.value;
|
|
@@ -18087,12 +18121,12 @@ function openingText(field2, value) {
|
|
|
18087
18121
|
if (value === null || value === void 0 || value === "") return "";
|
|
18088
18122
|
const helper = dateHelperKind(field2, value);
|
|
18089
18123
|
if (helper === "time") {
|
|
18090
|
-
const read = (0,
|
|
18124
|
+
const read = (0, import_records34.readTypedTime)(String(value));
|
|
18091
18125
|
if (!read.ok) return String(value);
|
|
18092
18126
|
const [h, m] = read.value.split(":").map(Number);
|
|
18093
|
-
return (0,
|
|
18127
|
+
return (0, import_records34.typedTimeText)(h, m);
|
|
18094
18128
|
}
|
|
18095
|
-
if (helper) return (0,
|
|
18129
|
+
if (helper) return (0, import_records34.typedDateText)(value, { withTime: helper === "datetime" });
|
|
18096
18130
|
const format = formatForField(field2);
|
|
18097
18131
|
return format ? typedText(format, value) : String(value);
|
|
18098
18132
|
}
|
|
@@ -18196,7 +18230,7 @@ function TypedTextControl({ field: field2, value, onChange, disabled, id, onComm
|
|
|
18196
18230
|
" ",
|
|
18197
18231
|
needsChoices ? String(
|
|
18198
18232
|
(Array.isArray(withoutAddition(judged.value).value) ? withoutAddition(judged.value).value : [withoutAddition(judged.value).value]).map((k) => {
|
|
18199
|
-
const option = choices?.find((o) => (0,
|
|
18233
|
+
const option = choices?.find((o) => (0, import_records34.optionKey)(o) === k);
|
|
18200
18234
|
return option ? recordName(option.data, null, String(k)) : String(k);
|
|
18201
18235
|
}).join(", ")
|
|
18202
18236
|
) : (() => {
|
|
@@ -18217,7 +18251,7 @@ function FieldControl({ field: field2, value, onChange, disabled, id, autoOpen,
|
|
|
18217
18251
|
const ownDetails = (0, import_react85.useOptionalRecordsClient)() === null;
|
|
18218
18252
|
if (isTypedDraft(value)) return /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(TypedTextControl, { field: field2, value, onChange, disabled, id: inputId, onCommit, onCancel });
|
|
18219
18253
|
if (isSignatureField(field2)) return /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(SignaturePad, { id: inputId, value, onChange, disabled });
|
|
18220
|
-
if ((0,
|
|
18254
|
+
if ((0, import_records34.isButtonField)(field2)) return /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(ButtonValue, { field: field2 });
|
|
18221
18255
|
const newerControl = newerKindControl({ field: field2, value, onChange, disabled, id: inputId });
|
|
18222
18256
|
if (newerControl !== void 0) return newerControl;
|
|
18223
18257
|
const format = formatForField(field2);
|
|
@@ -18387,7 +18421,7 @@ function TypedWordsControl({ field: field2, value, onChange, disabled, id }) {
|
|
|
18387
18421
|
function typedDatePlaceholder(helper) {
|
|
18388
18422
|
const time = "h:mm AM";
|
|
18389
18423
|
if (helper === "time") return time;
|
|
18390
|
-
const pattern = (0,
|
|
18424
|
+
const pattern = (0, import_records34.typedDateText)("2026-11-22").replace("2026", "YYYY").replace("11", "MM").replace("22", "DD");
|
|
18391
18425
|
return helper === "datetime" ? `${pattern} ${time}` : pattern;
|
|
18392
18426
|
}
|
|
18393
18427
|
function CheckboxControl({ field: field2, value, onChange, disabled, id }) {
|
|
@@ -18557,15 +18591,15 @@ function OptionControl({ field: field2, value, onChange, disabled, id, autoOpen,
|
|
|
18557
18591
|
ChoiceAnswer,
|
|
18558
18592
|
{
|
|
18559
18593
|
field: field2,
|
|
18560
|
-
choices: options.map((option) => ({ key: (0,
|
|
18594
|
+
choices: options.map((option) => ({ key: (0, import_records34.optionKey)(option), label: titled(option) })),
|
|
18561
18595
|
value,
|
|
18562
18596
|
onChange,
|
|
18563
18597
|
disabled,
|
|
18564
18598
|
id,
|
|
18565
18599
|
onChosen,
|
|
18566
18600
|
isChosen: (choice, v) => {
|
|
18567
|
-
const option = options.find((o) => (0,
|
|
18568
|
-
return option ? (0,
|
|
18601
|
+
const option = options.find((o) => (0, import_records34.optionKey)(o) === choice.key);
|
|
18602
|
+
return option ? (0, import_records34.isTheChosen)(option, v) : false;
|
|
18569
18603
|
}
|
|
18570
18604
|
}
|
|
18571
18605
|
);
|
|
@@ -18598,7 +18632,7 @@ function OptionControl({ field: field2, value, onChange, disabled, id, autoOpen,
|
|
|
18598
18632
|
onCancel,
|
|
18599
18633
|
initialSearch,
|
|
18600
18634
|
addsChoices,
|
|
18601
|
-
allowOther: (0,
|
|
18635
|
+
allowOther: (0, import_records34.allowsOtherValues)(field2),
|
|
18602
18636
|
onChoicesChanged: () => {
|
|
18603
18637
|
if (client) (0, askOnce_exports.forgetAsked)(client, `field_options:${field2.id}`);
|
|
18604
18638
|
setReread((n) => n + 1);
|
|
@@ -18612,19 +18646,19 @@ function OptionControl({ field: field2, value, onChange, disabled, id, autoOpen,
|
|
|
18612
18646
|
}
|
|
18613
18647
|
const titleOf = (option) => recordName(option.data, null, "Unnamed choice");
|
|
18614
18648
|
if (field2.multi) {
|
|
18615
|
-
const chosen = options.filter((option) => (0,
|
|
18616
|
-
const picked = new Set(chosen.map((option) => (0,
|
|
18649
|
+
const chosen = options.filter((option) => (0, import_records34.choiceValuesOf)(value).some((v) => (0, import_records34.isTheChosen)(option, v)));
|
|
18650
|
+
const picked = new Set(chosen.map((option) => (0, import_records34.optionKey)(option)));
|
|
18617
18651
|
const toggles = /* @__PURE__ */ (0, import_jsx_runtime57.jsx)("div", { id: autoOpen ? void 0 : id, className: "flex flex-wrap gap-1", children: options.map((option) => /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(
|
|
18618
18652
|
import_design_system51.Button,
|
|
18619
18653
|
{
|
|
18620
18654
|
type: "button",
|
|
18621
18655
|
size: "sm",
|
|
18622
|
-
variant: picked.has((0,
|
|
18656
|
+
variant: picked.has((0, import_records34.optionKey)(option)) ? "default" : "outline",
|
|
18623
18657
|
disabled,
|
|
18624
18658
|
onClick: () => {
|
|
18625
18659
|
const next = new Set(picked);
|
|
18626
|
-
if (next.has((0,
|
|
18627
|
-
else next.add((0,
|
|
18660
|
+
if (next.has((0, import_records34.optionKey)(option))) next.delete((0, import_records34.optionKey)(option));
|
|
18661
|
+
else next.add((0, import_records34.optionKey)(option));
|
|
18628
18662
|
onChange(next.size === 0 ? null : [...next]);
|
|
18629
18663
|
},
|
|
18630
18664
|
children: titleOf(option)
|
|
@@ -18646,11 +18680,11 @@ function OptionControl({ field: field2, value, onChange, disabled, id, autoOpen,
|
|
|
18646
18680
|
}
|
|
18647
18681
|
);
|
|
18648
18682
|
}
|
|
18649
|
-
const current = options.find((option) => (0,
|
|
18683
|
+
const current = options.find((option) => (0, import_records34.isTheChosen)(option, value));
|
|
18650
18684
|
return /* @__PURE__ */ (0, import_jsx_runtime57.jsxs)(
|
|
18651
18685
|
import_design_system51.Select,
|
|
18652
18686
|
{
|
|
18653
|
-
value: current ? (0,
|
|
18687
|
+
value: current ? (0, import_records34.optionKey)(current) : "",
|
|
18654
18688
|
disabled: disabled ?? false,
|
|
18655
18689
|
onValueChange: (next) => onChange(next === "" ? null : next),
|
|
18656
18690
|
...autoOpen ? {
|
|
@@ -18662,7 +18696,7 @@ function OptionControl({ field: field2, value, onChange, disabled, id, autoOpen,
|
|
|
18662
18696
|
} : {},
|
|
18663
18697
|
children: [
|
|
18664
18698
|
/* @__PURE__ */ (0, import_jsx_runtime57.jsx)(import_design_system51.SelectTrigger, { id, size: "sm", children: /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(import_design_system51.SelectValue, { placeholder: "Choose" }) }),
|
|
18665
|
-
/* @__PURE__ */ (0, import_jsx_runtime57.jsx)(import_design_system51.SelectContent, { children: options.map((option) => /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(import_design_system51.SelectItem, { value: (0,
|
|
18699
|
+
/* @__PURE__ */ (0, import_jsx_runtime57.jsx)(import_design_system51.SelectContent, { children: options.map((option) => /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(import_design_system51.SelectItem, { value: (0, import_records34.optionKey)(option), children: titleOf(option) }, option.id)) })
|
|
18666
18700
|
]
|
|
18667
18701
|
}
|
|
18668
18702
|
);
|
|
@@ -18696,23 +18730,23 @@ function OpenChoicePicker({
|
|
|
18696
18730
|
const [addRefused, setAddRefused] = (0, import_react84.useState)(null);
|
|
18697
18731
|
const titleOf = (option) => recordName(option.data, null, "Unnamed choice");
|
|
18698
18732
|
const held = withoutAddition(value);
|
|
18699
|
-
const current = (0,
|
|
18733
|
+
const current = (0, import_records34.choiceValuesOf)(held.value);
|
|
18700
18734
|
const pickedWords = current.map((v) => {
|
|
18701
|
-
const option = options.find((o) => (0,
|
|
18735
|
+
const option = options.find((o) => (0, import_records34.isTheChosen)(o, v));
|
|
18702
18736
|
return option ? titleOf(option) : String(v);
|
|
18703
18737
|
});
|
|
18704
|
-
const chipOf = (option, word) => option ? choiceChipLookOf(field2, (0,
|
|
18738
|
+
const chipOf = (option, word) => option ? choiceChipLookOf(field2, (0, import_records34.optionKey)(option), titleOf(option)) : choiceChipLookOf(field2, word);
|
|
18705
18739
|
const q = search.trim();
|
|
18706
|
-
const visible = (0,
|
|
18707
|
-
const decided = (0,
|
|
18740
|
+
const visible = (0, import_records34.rankTypedMatches)(options, q, titleOf);
|
|
18741
|
+
const decided = (0, import_records34.decideTypedChoice)({ words: q, options, allowOther, nudge: nudge ?? "ask" });
|
|
18708
18742
|
const choose = (word, addingIt = false) => {
|
|
18709
18743
|
const pending = held.add.filter((w) => w.toLowerCase() !== word.toLowerCase());
|
|
18710
18744
|
let next;
|
|
18711
18745
|
let add2 = [...pending];
|
|
18712
18746
|
if (field2.multi) {
|
|
18713
18747
|
const existing = current.map((v) => {
|
|
18714
|
-
const option = options.find((o) => (0,
|
|
18715
|
-
return option ? (0,
|
|
18748
|
+
const option = options.find((o) => (0, import_records34.isTheChosen)(o, v));
|
|
18749
|
+
return option ? (0, import_records34.optionKey)(option) : String(v);
|
|
18716
18750
|
});
|
|
18717
18751
|
const has = existing.some((v) => v.toLowerCase() === word.toLowerCase());
|
|
18718
18752
|
const list = has ? existing.filter((v) => v.toLowerCase() !== word.toLowerCase()) : [...existing, word];
|
|
@@ -18748,7 +18782,7 @@ function OpenChoicePicker({
|
|
|
18748
18782
|
const foot = null;
|
|
18749
18783
|
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;
|
|
18750
18784
|
const listed = visible;
|
|
18751
|
-
const pickedOptions = current.map((v) => options.find((o) => (0,
|
|
18785
|
+
const pickedOptions = current.map((v) => options.find((o) => (0, import_records34.isTheChosen)(o, v)));
|
|
18752
18786
|
const cellChips = pickedWords.map((word, i) => {
|
|
18753
18787
|
const chip = chipOf(pickedOptions[i], word);
|
|
18754
18788
|
return /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(import_design_system51.Badge, { variant: "outline", className: (0, import_design_system51.cn)("text-[11px]", chip.className), "data-records-choice-chip": "", children: word }, word);
|
|
@@ -18760,7 +18794,7 @@ function OpenChoicePicker({
|
|
|
18760
18794
|
label: word,
|
|
18761
18795
|
chip: chipOf(option, word).className,
|
|
18762
18796
|
onRemove: () => {
|
|
18763
|
-
if (field2.multi) choose(option ? (0,
|
|
18797
|
+
if (field2.multi) choose(option ? (0, import_records34.optionKey)(option) : String(current[i]));
|
|
18764
18798
|
else onChange(null);
|
|
18765
18799
|
}
|
|
18766
18800
|
};
|
|
@@ -18791,11 +18825,11 @@ function OpenChoicePicker({
|
|
|
18791
18825
|
id: option.id,
|
|
18792
18826
|
label: titleOf(option),
|
|
18793
18827
|
chip: chipOf(option, titleOf(option)).className,
|
|
18794
|
-
picked: current.some((v) => (0,
|
|
18828
|
+
picked: current.some((v) => (0, import_records34.isTheChosen)(option, v))
|
|
18795
18829
|
})),
|
|
18796
18830
|
onPick: (optionId) => {
|
|
18797
18831
|
const option = options.find((o) => o.id === optionId);
|
|
18798
|
-
if (option) choose((0,
|
|
18832
|
+
if (option) choose((0, import_records34.optionKey)(option));
|
|
18799
18833
|
},
|
|
18800
18834
|
empty: q === "" ? /* @__PURE__ */ (0, import_jsx_runtime57.jsx)("p", { className: "p-2 text-xs text-muted-foreground", children: "No choices yet \u2014 type one to add it." }) : null,
|
|
18801
18835
|
add,
|
|
@@ -18851,7 +18885,7 @@ function ChoiceAnswer({
|
|
|
18851
18885
|
onChosen
|
|
18852
18886
|
}) {
|
|
18853
18887
|
const [search, setSearch] = (0, import_react84.useState)("");
|
|
18854
|
-
const held = field2.multi ? (0,
|
|
18888
|
+
const held = field2.multi ? (0, import_records34.choiceValuesOf)(value) : value === null || value === void 0 || value === "" ? [] : [value];
|
|
18855
18889
|
const on = (choice) => held.some((v) => isChosen ? isChosen(choice, v) : String(v) === choice.key || String(v) === choice.label);
|
|
18856
18890
|
const press = (choice) => {
|
|
18857
18891
|
if (!field2.multi) {
|
|
@@ -19324,7 +19358,7 @@ function isTypedCharacter(event) {
|
|
|
19324
19358
|
return !event.metaKey && !event.ctrlKey && !event.altKey && event.key.length === 1 && event.key !== " ";
|
|
19325
19359
|
}
|
|
19326
19360
|
function fieldIsEditable(field2) {
|
|
19327
|
-
if ((0,
|
|
19361
|
+
if ((0, import_records35.isButtonField)(field2)) return false;
|
|
19328
19362
|
const kind2 = editorKindFor(field2);
|
|
19329
19363
|
return kind2 !== "formula" && kind2 !== "lookup" && kind2 !== "rollup";
|
|
19330
19364
|
}
|
|
@@ -19461,7 +19495,7 @@ function useGridEditing({ tableId, fields, rows, reload, reloadAfterWrite, canWr
|
|
|
19461
19495
|
}
|
|
19462
19496
|
const held = optimistic[cellKey(address.rowId, address.key)];
|
|
19463
19497
|
const document2 = rows.find((r) => r.id === address.rowId)?.document;
|
|
19464
|
-
const pointer = held === void 0 && typeof current === "string" ? (0,
|
|
19498
|
+
const pointer = held === void 0 && typeof current === "string" ? (0, import_core18.wholeValueOf)(document2, address.key) : null;
|
|
19465
19499
|
if (pointer) {
|
|
19466
19500
|
const read = host.readFileText;
|
|
19467
19501
|
if (!read) return;
|
|
@@ -19613,7 +19647,7 @@ function useGridEditing({ tableId, fields, rows, reload, reloadAfterWrite, canWr
|
|
|
19613
19647
|
delete next[id];
|
|
19614
19648
|
return next;
|
|
19615
19649
|
});
|
|
19616
|
-
const conflict = (0,
|
|
19650
|
+
const conflict = (0, import_core18.asWriteConflict)(written.error, rowId);
|
|
19617
19651
|
if (written.error.code === "stale_write") {
|
|
19618
19652
|
if (conflict) rememberVersion(versions.current, rowId, conflict.current_version);
|
|
19619
19653
|
else versions.current.delete(rowId);
|
|
@@ -19701,7 +19735,7 @@ function useGridEditing({ tableId, fields, rows, reload, reloadAfterWrite, canWr
|
|
|
19701
19735
|
}
|
|
19702
19736
|
const starting = shownValue2(next.rowId, next.key);
|
|
19703
19737
|
const nextDocument = rows.find((r) => r.id === next.rowId)?.document;
|
|
19704
|
-
if (typeof starting === "string" && optimistic[cellKey(next.rowId, next.key)] === void 0 && (0,
|
|
19738
|
+
if (typeof starting === "string" && optimistic[cellKey(next.rowId, next.key)] === void 0 && (0, import_core18.wholeValueOf)(nextDocument, next.key)) {
|
|
19705
19739
|
setEditing(null);
|
|
19706
19740
|
setDraft(null);
|
|
19707
19741
|
typed2.current = null;
|
|
@@ -20759,10 +20793,10 @@ function useWholeTableCount(args) {
|
|
|
20759
20793
|
// src/Grid.tsx
|
|
20760
20794
|
var import_react168 = require("react");
|
|
20761
20795
|
var import_react169 = require("@ai-matrx/records/react");
|
|
20762
|
-
var
|
|
20763
|
-
var
|
|
20796
|
+
var import_records45 = require("@ai-matrx/records");
|
|
20797
|
+
var import_records46 = require("@ai-matrx/records");
|
|
20764
20798
|
var import_data_table14 = require("@ai-matrx/design-system/data-table");
|
|
20765
|
-
var
|
|
20799
|
+
var import_core25 = require("@ai-matrx/records/core");
|
|
20766
20800
|
|
|
20767
20801
|
// src/tableDecorations.ts
|
|
20768
20802
|
var import_react95 = require("react");
|
|
@@ -20799,7 +20833,7 @@ function useTableDecorations(tableId, revision) {
|
|
|
20799
20833
|
}
|
|
20800
20834
|
|
|
20801
20835
|
// src/emptyState.tsx
|
|
20802
|
-
var
|
|
20836
|
+
var import_records36 = require("@ai-matrx/records");
|
|
20803
20837
|
var import_design_system54 = require("@ai-matrx/design-system");
|
|
20804
20838
|
var import_format4 = require("@ai-matrx/kit/format");
|
|
20805
20839
|
var import_jsx_runtime62 = require("react/jsx-runtime");
|
|
@@ -20809,7 +20843,7 @@ function lockedRowsWords(count) {
|
|
|
20809
20843
|
function questionIsAsked(args) {
|
|
20810
20844
|
if ((args.search ?? "").trim() !== "") return true;
|
|
20811
20845
|
if (Object.values(args.columnFilters ?? {}).some((value) => value !== void 0 && value !== null)) return true;
|
|
20812
|
-
if (args.filter && (0,
|
|
20846
|
+
if (args.filter && (0, import_records36.stableFilterKey)(args.filter) !== "{}") return true;
|
|
20813
20847
|
return Boolean(args.ruled);
|
|
20814
20848
|
}
|
|
20815
20849
|
function emptyCauseOf(args) {
|
|
@@ -20905,7 +20939,7 @@ function useTableCanBeCleaned(tableId) {
|
|
|
20905
20939
|
|
|
20906
20940
|
// src/gridControls.tsx
|
|
20907
20941
|
var import_clipboard3 = require("@ai-matrx/kit/clipboard");
|
|
20908
|
-
var
|
|
20942
|
+
var import_core19 = require("@ai-matrx/records/core");
|
|
20909
20943
|
var import_react127 = require("react");
|
|
20910
20944
|
var import_react128 = require("@ai-matrx/records/react");
|
|
20911
20945
|
var import_design_system69 = require("@ai-matrx/design-system");
|
|
@@ -21769,7 +21803,7 @@ init_fieldTypes();
|
|
|
21769
21803
|
|
|
21770
21804
|
// src/gridColors.tsx
|
|
21771
21805
|
var import_react110 = require("react");
|
|
21772
|
-
var
|
|
21806
|
+
var import_records37 = require("@ai-matrx/records");
|
|
21773
21807
|
var import_react111 = require("@ai-matrx/records/react");
|
|
21774
21808
|
var import_design_system59 = require("@ai-matrx/design-system");
|
|
21775
21809
|
var import_data_table9 = require("@ai-matrx/design-system/data-table");
|
|
@@ -21835,7 +21869,7 @@ function useChoiceOptions(fields, keys) {
|
|
|
21835
21869
|
function lookOf(option) {
|
|
21836
21870
|
const raw = option.data?.["color"];
|
|
21837
21871
|
const color = typeof raw === "string" && import_data_table9.STYLE_COLORS.includes(raw) ? raw : void 0;
|
|
21838
|
-
return { id: String(option.id), key: (0,
|
|
21872
|
+
return { id: String(option.id), key: (0, import_records37.optionKey)(option), label: (0, import_records37.optionLabel)(option), ...color ? { color } : {} };
|
|
21839
21873
|
}
|
|
21840
21874
|
function paintByOption(style, _fields, index, lookup) {
|
|
21841
21875
|
if (index.size === 0) return { style, documentOf: (doc) => doc, choiceColorFor: lookup };
|
|
@@ -22302,7 +22336,7 @@ function ColourRulesDialog({
|
|
|
22302
22336
|
|
|
22303
22337
|
// src/gridRowLabel.tsx
|
|
22304
22338
|
var import_react112 = require("react");
|
|
22305
|
-
var
|
|
22339
|
+
var import_records38 = require("@ai-matrx/records");
|
|
22306
22340
|
var import_react113 = require("@ai-matrx/records/react");
|
|
22307
22341
|
var import_design_system60 = require("@ai-matrx/design-system");
|
|
22308
22342
|
init_names();
|
|
@@ -22360,7 +22394,7 @@ function RowLabelPicker({
|
|
|
22360
22394
|
const columns = labelColumns(fields);
|
|
22361
22395
|
const mayChange = kept?.can_change !== false;
|
|
22362
22396
|
const keptFormula = kept?.formula ?? null;
|
|
22363
|
-
const formulaTooLong = formula.trim().length >
|
|
22397
|
+
const formulaTooLong = formula.trim().length > import_records38.ROW_LABEL_FORMULA_MAX_LENGTH;
|
|
22364
22398
|
const formulaUnchanged = formula.trim() === (keptFormula ?? "").trim() && kept?.valid !== false;
|
|
22365
22399
|
const saveColumn = async () => {
|
|
22366
22400
|
setBusy(true);
|
|
@@ -22457,7 +22491,7 @@ function RowLabelPicker({
|
|
|
22457
22491
|
) : null,
|
|
22458
22492
|
formulaTooLong ? /* @__PURE__ */ (0, import_jsx_runtime69.jsxs)("p", { className: "text-[11px] text-foreground", children: [
|
|
22459
22493
|
"Up to ",
|
|
22460
|
-
|
|
22494
|
+
import_records38.ROW_LABEL_FORMULA_MAX_LENGTH,
|
|
22461
22495
|
" characters"
|
|
22462
22496
|
] }) : null
|
|
22463
22497
|
] }),
|
|
@@ -22481,7 +22515,7 @@ function RowLabelPicker({
|
|
|
22481
22515
|
type: "button",
|
|
22482
22516
|
size: "sm",
|
|
22483
22517
|
"data-records-row-label-save-formula": "",
|
|
22484
|
-
disabled: busy || !mayChange || (0,
|
|
22518
|
+
disabled: busy || !mayChange || (0, import_records38.clearsRowLabel)(formula) || formulaTooLong || formulaOk === false || formulaUnchanged,
|
|
22485
22519
|
onClick: () => void saveFormula(),
|
|
22486
22520
|
children: busy ? "Saving\u2026" : "Use this formula"
|
|
22487
22521
|
}
|
|
@@ -22649,7 +22683,7 @@ init_names();
|
|
|
22649
22683
|
// src/gridActions.tsx
|
|
22650
22684
|
var import_react116 = require("react");
|
|
22651
22685
|
var import_react117 = require("@ai-matrx/records/react");
|
|
22652
|
-
var
|
|
22686
|
+
var import_records39 = require("@ai-matrx/records");
|
|
22653
22687
|
var import_design_system62 = require("@ai-matrx/design-system");
|
|
22654
22688
|
init_Refusal();
|
|
22655
22689
|
init_names();
|
|
@@ -22734,7 +22768,7 @@ function useActionRunner(args) {
|
|
|
22734
22768
|
const answered = await client.actionRun({ action_id: action3.id, record_ids: ids });
|
|
22735
22769
|
setBusy(null);
|
|
22736
22770
|
if (!answered.ok) {
|
|
22737
|
-
const refusals = (0,
|
|
22771
|
+
const refusals = (0, import_records39.actionRefusals)(answered.error);
|
|
22738
22772
|
setOutcome({
|
|
22739
22773
|
kind: "refused",
|
|
22740
22774
|
action: action3,
|
|
@@ -23530,7 +23564,7 @@ init_writeOnTheWinningVersion();
|
|
|
23530
23564
|
// src/gridSummaries.tsx
|
|
23531
23565
|
var import_react120 = require("react");
|
|
23532
23566
|
var import_react121 = require("@ai-matrx/records/react");
|
|
23533
|
-
var
|
|
23567
|
+
var import_records40 = require("@ai-matrx/records");
|
|
23534
23568
|
var import_design_system65 = require("@ai-matrx/design-system");
|
|
23535
23569
|
init_parity();
|
|
23536
23570
|
init_names();
|
|
@@ -23580,8 +23614,8 @@ function useColumnSummaries(args) {
|
|
|
23580
23614
|
const why = {};
|
|
23581
23615
|
for (const [key, op2] of entries) {
|
|
23582
23616
|
const measure = op2 === "count" ? { op: "count" } : { op: op2, key };
|
|
23583
|
-
out[key] = row?.measures?.[(0,
|
|
23584
|
-
const notice = row?.withheld?.[(0,
|
|
23617
|
+
out[key] = row?.measures?.[(0, import_records40.measureKey)(measure)] ?? null;
|
|
23618
|
+
const notice = row?.withheld?.[(0, import_records40.measureKey)(measure)];
|
|
23585
23619
|
if (notice) why[key] = notice;
|
|
23586
23620
|
}
|
|
23587
23621
|
setValues(out);
|
|
@@ -24152,7 +24186,7 @@ function WholeTextDialog({
|
|
|
24152
24186
|
/* @__PURE__ */ (0, import_jsx_runtime77.jsx)(import_design_system68.Button, { size: "sm", variant: reading ? "ghost" : "secondary", role: "tab", "aria-selected": !reading, onClick: () => setReading(false), "data-records-whole-text-mode": "words", children: mayWrite ? "Edit" : "Words" }),
|
|
24153
24187
|
/* @__PURE__ */ (0, import_jsx_runtime77.jsx)(import_design_system68.Button, { size: "sm", variant: reading ? "secondary" : "ghost", role: "tab", "aria-selected": reading, onClick: () => setReading(true), "data-records-whole-text-mode": "preview", children: "Preview" })
|
|
24154
24188
|
] }) : null,
|
|
24155
|
-
ready && reading && renderText ? /* @__PURE__ */ (0, import_jsx_runtime77.jsx)("div", { className: "max-h-[60vh] min-h-[8rem] overflow-auto rounded-md border px-3 py-2 text-sm", "data-records-whole-text-preview": "", children: draft ? renderText(draft, "cell") : /* @__PURE__ */ (0, import_jsx_runtime77.jsx)("span", { className: "text-muted-foreground", children: "\u2014" }) }) : ready && textBox ? (
|
|
24189
|
+
ready && reading && renderText ? /* @__PURE__ */ (0, import_jsx_runtime77.jsx)("div", { className: "max-h-[60vh] min-h-[8rem] overflow-auto rounded-md border px-3 py-2 text-sm", "data-records-whole-text-preview": "", children: draft ? renderText(withoutLeadingBlank(draft), "cell") : /* @__PURE__ */ (0, import_jsx_runtime77.jsx)("span", { className: "text-muted-foreground", children: "\u2014" }) }) : ready && textBox ? (
|
|
24156
24190
|
// THE HOST'S TEXT BOX (`textBox`): the same words, with its "…" menu (Clean up, Help with
|
|
24157
24191
|
// this…, Copy, Save, Share). What its menu puts in the box is unsaved until Save.
|
|
24158
24192
|
/* @__PURE__ */ (0, import_jsx_runtime77.jsx)("div", { "data-records-whole-text-box": "", children: textBox({
|
|
@@ -24355,7 +24389,7 @@ function useMergedGridControls(args) {
|
|
|
24355
24389
|
const fieldsRef = (0, import_react127.useRef)(fields);
|
|
24356
24390
|
fieldsRef.current = fields;
|
|
24357
24391
|
const [choiceCounts, setChoiceCounts] = (0, import_react127.useState)({});
|
|
24358
|
-
(0, import_react127.useEffect)(() => (0,
|
|
24392
|
+
(0, import_react127.useEffect)(() => (0, import_core19.onRecordChanged)(() => (0, askOnce_exports.forgetAsked)(client, `value_counts:${tableId}:`)), [client, tableId]);
|
|
24359
24393
|
(0, import_react127.useEffect)(() => {
|
|
24360
24394
|
if (!enabled || choiceKeys.length === 0) {
|
|
24361
24395
|
setChoiceCounts({});
|
|
@@ -25087,7 +25121,7 @@ var import_design_system73 = require("@ai-matrx/design-system");
|
|
|
25087
25121
|
// src/RecordForm.tsx
|
|
25088
25122
|
var import_react133 = require("react");
|
|
25089
25123
|
var import_react134 = require("@ai-matrx/records/react");
|
|
25090
|
-
var
|
|
25124
|
+
var import_core21 = require("@ai-matrx/records/core");
|
|
25091
25125
|
init_writeOnTheWinningVersion();
|
|
25092
25126
|
var import_design_system72 = require("@ai-matrx/design-system");
|
|
25093
25127
|
init_Refusal();
|
|
@@ -25106,7 +25140,7 @@ var import_react129 = require("react");
|
|
|
25106
25140
|
var import_react130 = require("@ai-matrx/records/react");
|
|
25107
25141
|
var import_design_system70 = require("@ai-matrx/design-system");
|
|
25108
25142
|
init_Refusal();
|
|
25109
|
-
var
|
|
25143
|
+
var import_core20 = require("@ai-matrx/records/core");
|
|
25110
25144
|
init_plainWords();
|
|
25111
25145
|
var import_jsx_runtime79 = require("react/jsx-runtime");
|
|
25112
25146
|
function isEmptyValue(value) {
|
|
@@ -25179,7 +25213,7 @@ async function writeStandardRowValues(client, args) {
|
|
|
25179
25213
|
{ schema: config.schema ?? "custom" }
|
|
25180
25214
|
);
|
|
25181
25215
|
if (!old.error) return { ok: true };
|
|
25182
|
-
const error = (0,
|
|
25216
|
+
const error = (0, import_core20.mapPgError)(old.error, "entityValueWrite");
|
|
25183
25217
|
return { ok: false, error: doorIsAbsent(error) && first && first.error.code !== "door_absent" ? first.error : error };
|
|
25184
25218
|
}
|
|
25185
25219
|
function doorIsAbsent(error) {
|
|
@@ -25761,7 +25795,7 @@ function CustomRecordForm({
|
|
|
25761
25795
|
return out;
|
|
25762
25796
|
}, [draft]);
|
|
25763
25797
|
const predicted = (0, import_react133.useMemo)(
|
|
25764
|
-
() => fields.data ? (0,
|
|
25798
|
+
() => fields.data ? (0, import_core21.predictWriteRefusals)({ fields: fields.data, document: document2, ...recordType ? { recordType } : {} }) : [],
|
|
25765
25799
|
[fields.data, document2, recordType]
|
|
25766
25800
|
);
|
|
25767
25801
|
if (fields.error) return /* @__PURE__ */ (0, import_jsx_runtime81.jsx)(RefusalNotice, { error: fields.error, className });
|
|
@@ -25811,7 +25845,7 @@ function CustomRecordForm({
|
|
|
25811
25845
|
setEdit({
|
|
25812
25846
|
saving: false,
|
|
25813
25847
|
error: answered2.ok ? null : answered2.error,
|
|
25814
|
-
conflict: answered2.ok ? null : (0,
|
|
25848
|
+
conflict: answered2.ok ? null : (0, import_core21.asWriteConflict)(answered2.error, recordId)
|
|
25815
25849
|
});
|
|
25816
25850
|
const moved = answered2.ok ? answered2.data : null;
|
|
25817
25851
|
if (moved !== null) {
|
|
@@ -25922,7 +25956,7 @@ function FieldRow({
|
|
|
25922
25956
|
}) {
|
|
25923
25957
|
const id = `field-${field2.id}`;
|
|
25924
25958
|
const storedWords = document2?.[field2.key];
|
|
25925
|
-
const whole = typeof storedWords === "string" ? (0,
|
|
25959
|
+
const whole = typeof storedWords === "string" ? (0, import_core21.wholeValueOf)(document2, field2.key) : null;
|
|
25926
25960
|
return /* @__PURE__ */ (0, import_jsx_runtime81.jsxs)("div", { className: (0, import_design_system72.cn)("flex min-w-0 flex-col gap-1", whole && "sm:col-span-2"), children: [
|
|
25927
25961
|
/* @__PURE__ */ (0, import_jsx_runtime81.jsx)(FieldLabel, { field: field2, htmlFor: id, children: /* @__PURE__ */ (0, import_jsx_runtime81.jsx)(ProvenanceBadge, { document: document2, fieldKey: field2.key }) }),
|
|
25928
25962
|
whole ? (
|
|
@@ -26155,7 +26189,7 @@ function NewRecordControl({
|
|
|
26155
26189
|
// src/gridDrill.tsx
|
|
26156
26190
|
var import_react139 = require("react");
|
|
26157
26191
|
var import_react140 = require("@ai-matrx/records/react");
|
|
26158
|
-
var
|
|
26192
|
+
var import_records41 = require("@ai-matrx/records");
|
|
26159
26193
|
var import_data_table12 = require("@ai-matrx/design-system/data-table");
|
|
26160
26194
|
init_parity();
|
|
26161
26195
|
init_plainWords();
|
|
@@ -26425,7 +26459,7 @@ function useDrillAnswers(args) {
|
|
|
26425
26459
|
across: question.across ?? null,
|
|
26426
26460
|
show: question.show,
|
|
26427
26461
|
where: args.where,
|
|
26428
|
-
rule: args.rule && (0,
|
|
26462
|
+
rule: args.rule && (0, import_records41.isRuleFilter)(args.rule) ? args.rule : null,
|
|
26429
26463
|
window: question.window ?? null,
|
|
26430
26464
|
compare: question.compare ?? null,
|
|
26431
26465
|
windowKey: args.windowKey ?? null,
|
|
@@ -26690,7 +26724,7 @@ function trailClause(fields, w) {
|
|
|
26690
26724
|
}
|
|
26691
26725
|
function filterWithTrail(fields, base2, trail) {
|
|
26692
26726
|
if (trail.length === 0) return base2;
|
|
26693
|
-
if (!base2 || !(0,
|
|
26727
|
+
if (!base2 || !(0, import_records41.isRuleFilter)(base2)) {
|
|
26694
26728
|
const flat = { ...base2 ?? {} };
|
|
26695
26729
|
for (const w of trail) {
|
|
26696
26730
|
const clause = trailClause(fields, w);
|
|
@@ -26713,7 +26747,7 @@ function filterWithTrail(fields, base2, trail) {
|
|
|
26713
26747
|
return { op: "and", args };
|
|
26714
26748
|
}
|
|
26715
26749
|
function filterWithWindow(fields, base2, key, range) {
|
|
26716
|
-
if (!base2 || !(0,
|
|
26750
|
+
if (!base2 || !(0, import_records41.isRuleFilter)(base2)) return { ...base2 ?? {}, [key]: { from: range.from, to: range.to } };
|
|
26717
26751
|
const field2 = fields.find((f) => f.key === key);
|
|
26718
26752
|
if (!field2) return base2;
|
|
26719
26753
|
const ref = { field: field2.id };
|
|
@@ -26757,8 +26791,8 @@ function useGridDrillConfig(args) {
|
|
|
26757
26791
|
},
|
|
26758
26792
|
[setQuestion, onPresentationChange, presentation]
|
|
26759
26793
|
);
|
|
26760
|
-
const flat = state2.filter && !(0,
|
|
26761
|
-
const rule = state2.filter && (0,
|
|
26794
|
+
const flat = state2.filter && !(0, import_records41.isRuleFilter)(state2.filter) ? state2.filter : void 0;
|
|
26795
|
+
const rule = state2.filter && (0, import_records41.isRuleFilter)(state2.filter) ? filterWithTrailRuleOnly(state2) : void 0;
|
|
26762
26796
|
const { config } = useDrill({
|
|
26763
26797
|
source: state2.source,
|
|
26764
26798
|
question: state2.question,
|
|
@@ -27583,7 +27617,7 @@ function withTypeMark(field2, header) {
|
|
|
27583
27617
|
|
|
27584
27618
|
// src/ReverseColumns.tsx
|
|
27585
27619
|
var import_react143 = require("react");
|
|
27586
|
-
var
|
|
27620
|
+
var import_records42 = require("@ai-matrx/records");
|
|
27587
27621
|
|
|
27588
27622
|
// src/groupReads.ts
|
|
27589
27623
|
var import_first_page6 = require("@ai-matrx/records/first-page");
|
|
@@ -27736,7 +27770,7 @@ function useReverseField(tableId, column) {
|
|
|
27736
27770
|
if (column.read_only || !client) return;
|
|
27737
27771
|
let live = true;
|
|
27738
27772
|
void client.fields({ table_id: tableId, withReverse: true }).then((read) => {
|
|
27739
|
-
if (live && read.ok) setField(read.data.find((f) => f.key === column.key && (0,
|
|
27773
|
+
if (live && read.ok) setField(read.data.find((f) => f.key === column.key && (0, import_records42.isReverseField)(f)) ?? null);
|
|
27740
27774
|
});
|
|
27741
27775
|
return () => {
|
|
27742
27776
|
live = false;
|
|
@@ -28813,7 +28847,7 @@ function useStoreValueFacets(enabled, inputs) {
|
|
|
28813
28847
|
// src/gridGrouping.tsx
|
|
28814
28848
|
var import_react154 = require("react");
|
|
28815
28849
|
var import_react155 = require("@ai-matrx/records/react");
|
|
28816
|
-
var
|
|
28850
|
+
var import_records43 = require("@ai-matrx/records");
|
|
28817
28851
|
init_parity();
|
|
28818
28852
|
var import_jsx_runtime93 = require("react/jsx-runtime");
|
|
28819
28853
|
function groupValueKey(value) {
|
|
@@ -28851,8 +28885,8 @@ function useGroupFacts(args) {
|
|
|
28851
28885
|
const withheld = {};
|
|
28852
28886
|
for (const [fieldKey, op2] of entries) {
|
|
28853
28887
|
const m = op2 === "count" ? { op: "count" } : { op: op2, key: fieldKey };
|
|
28854
|
-
values[fieldKey] = row.measures?.[(0,
|
|
28855
|
-
const notice = row.withheld?.[(0,
|
|
28888
|
+
values[fieldKey] = row.measures?.[(0, import_records43.measureKey)(m)] ?? null;
|
|
28889
|
+
const notice = row.withheld?.[(0, import_records43.measureKey)(m)];
|
|
28856
28890
|
if (notice) withheld[fieldKey] = notice;
|
|
28857
28891
|
}
|
|
28858
28892
|
out.set(key, { count: typeof row.measures?.["count"] === "number" ? row.measures["count"] : row.row_count ?? null, measures: values, withheld });
|
|
@@ -28925,7 +28959,7 @@ function useGroupLabel(fields, groupKey, thenKeys = []) {
|
|
|
28925
28959
|
// src/gridUndo.tsx
|
|
28926
28960
|
var import_react156 = require("react");
|
|
28927
28961
|
var import_react157 = require("@ai-matrx/records/react");
|
|
28928
|
-
var
|
|
28962
|
+
var import_core22 = require("@ai-matrx/records/core");
|
|
28929
28963
|
var import_design_system81 = require("@ai-matrx/design-system");
|
|
28930
28964
|
init_plainWords();
|
|
28931
28965
|
var import_data_table13 = require("@ai-matrx/design-system/data-table");
|
|
@@ -29021,7 +29055,7 @@ function useGridUndo(args) {
|
|
|
29021
29055
|
}
|
|
29022
29056
|
forget(step2.cells.map((c) => ({ rowId: c.rowId, key: c.key })));
|
|
29023
29057
|
for (const id of /* @__PURE__ */ new Set([...step2.cells.map((c) => c.rowId), ...step2.created ?? [], ...step2.archived ?? []])) {
|
|
29024
|
-
(0,
|
|
29058
|
+
(0, import_core22.announceRecordChanged)(id);
|
|
29025
29059
|
}
|
|
29026
29060
|
setHeld(() => {
|
|
29027
29061
|
let stack = taken.stack;
|
|
@@ -29318,7 +29352,7 @@ function useRowFollowsItsMove(args) {
|
|
|
29318
29352
|
// src/gridAssist.tsx
|
|
29319
29353
|
var import_clipboard5 = require("@ai-matrx/kit/clipboard");
|
|
29320
29354
|
var import_react160 = require("react");
|
|
29321
|
-
var
|
|
29355
|
+
var import_core23 = require("@ai-matrx/records/core");
|
|
29322
29356
|
var import_workspace = require("@ai-matrx/alchemy/react/workspace");
|
|
29323
29357
|
|
|
29324
29358
|
// src/gridAgentContext.ts
|
|
@@ -29450,7 +29484,7 @@ function useGridAssist(args) {
|
|
|
29450
29484
|
const copyRecordReference = (0, import_react160.useCallback)(
|
|
29451
29485
|
(rowId) => {
|
|
29452
29486
|
void (async () => {
|
|
29453
|
-
const text = JSON.stringify({ __kind: (0,
|
|
29487
|
+
const text = JSON.stringify({ __kind: (0, import_core23.tableKindSlug)(tableId), _record_id: rowId });
|
|
29454
29488
|
if (!await (0, import_clipboard5.copyText)(text)) {
|
|
29455
29489
|
say2(false, "This browser did not let the page write to the clipboard.");
|
|
29456
29490
|
return;
|
|
@@ -29506,7 +29540,7 @@ function useGridAssist(args) {
|
|
|
29506
29540
|
if (!row) return;
|
|
29507
29541
|
const document2 = row.document ?? {};
|
|
29508
29542
|
const value = editing.valueFor(row, fieldOf2(key));
|
|
29509
|
-
const pointer = typeof document2[key] === "string" ? (0,
|
|
29543
|
+
const pointer = typeof document2[key] === "string" ? (0, import_core23.wholeValueOf)(document2, key) : null;
|
|
29510
29544
|
setWhole({ rowId, key, rowTitle: titleOf(row), value, pointer });
|
|
29511
29545
|
},
|
|
29512
29546
|
[rowOf, fieldOf2, titleOf, editing]
|
|
@@ -29602,7 +29636,7 @@ function useGridAssist(args) {
|
|
|
29602
29636
|
// src/gridBulk.tsx
|
|
29603
29637
|
var import_react161 = require("react");
|
|
29604
29638
|
var import_react162 = require("@ai-matrx/records/react");
|
|
29605
|
-
var
|
|
29639
|
+
var import_core24 = require("@ai-matrx/records/core");
|
|
29606
29640
|
init_recordVersions();
|
|
29607
29641
|
var import_design_system82 = require("@ai-matrx/design-system");
|
|
29608
29642
|
init_names();
|
|
@@ -29671,7 +29705,7 @@ function useGridBulk(args) {
|
|
|
29671
29705
|
return null;
|
|
29672
29706
|
}
|
|
29673
29707
|
for (const result of done.data ?? []) if (result.op === "update") versions.wrote(result.id, result.version);
|
|
29674
|
-
for (const change of changes) if ("record_id" in change && change.record_id) (0,
|
|
29708
|
+
for (const change of changes) if ("record_id" in change && change.record_id) (0, import_core24.announceRecordChanged)(change.record_id);
|
|
29675
29709
|
return done.data;
|
|
29676
29710
|
},
|
|
29677
29711
|
[client, tableId, versions, reload]
|
|
@@ -29837,7 +29871,7 @@ init_recordVersions();
|
|
|
29837
29871
|
// src/handOrder.tsx
|
|
29838
29872
|
var import_react163 = require("react");
|
|
29839
29873
|
var import_react164 = require("@ai-matrx/records/react");
|
|
29840
|
-
var
|
|
29874
|
+
var import_records44 = require("@ai-matrx/records");
|
|
29841
29875
|
var import_design_system83 = require("@ai-matrx/design-system");
|
|
29842
29876
|
init_Refusal();
|
|
29843
29877
|
|
|
@@ -29961,7 +29995,7 @@ function useHandOrderRows(args) {
|
|
|
29961
29995
|
const client = (0, import_react164.useRecordsClient)();
|
|
29962
29996
|
const { viewId, active, page, pageSize } = args;
|
|
29963
29997
|
const filter = args.filter && Object.keys(args.filter).length > 0 ? args.filter : null;
|
|
29964
|
-
const filterKey = filter ? (0,
|
|
29998
|
+
const filterKey = filter ? (0, import_records44.stableFilterKey)(filter) : "";
|
|
29965
29999
|
const filterNow = (0, import_react163.useRef)(filter);
|
|
29966
30000
|
filterNow.current = filter;
|
|
29967
30001
|
const [answer, setAnswer] = (0, import_react163.useState)(null);
|
|
@@ -30415,9 +30449,9 @@ function GridBody({
|
|
|
30415
30449
|
const pageAskedFor = (0, import_react168.useRef)(null);
|
|
30416
30450
|
if (fields.data && !table.loading) pageAskedFor.current = tableId;
|
|
30417
30451
|
const pageAsked = !storePaged || Boolean(fields.data) && pageAskedFor.current === tableId;
|
|
30418
|
-
const numberAsked = (0, import_react168.useMemo)(() => (0,
|
|
30452
|
+
const numberAsked = (0, import_react168.useMemo)(() => (0, import_records45.autonumberSearchOf)(fields.data ?? [], searchTerm), [fields.data, searchTerm]);
|
|
30419
30453
|
const pageSearch = numberAsked ? "" : searchTerm;
|
|
30420
|
-
const pageFilter = numberAsked ? (0,
|
|
30454
|
+
const pageFilter = numberAsked ? (0, import_records45.filterWithAutonumber)(readFilter, numberAsked.field, numberAsked.number) : readFilter;
|
|
30421
30455
|
const serverRead = (0, import_react169.useRecordPage)(storePaged && pageAsked ? tableId : null, {
|
|
30422
30456
|
pageSize: query.pageSize,
|
|
30423
30457
|
page: Math.max(0, query.page - 1),
|
|
@@ -30765,7 +30799,7 @@ function GridBody({
|
|
|
30765
30799
|
const names2 = wanted.get(field2.key) ?? [];
|
|
30766
30800
|
if (names2.length === 0) return;
|
|
30767
30801
|
const got = await client.relationNamesMatch({ table_id: field2.relation_target, names: names2 });
|
|
30768
|
-
if (got.ok) relationNames.current.set(field2.key, (0,
|
|
30802
|
+
if (got.ok) relationNames.current.set(field2.key, (0, import_records46.relationNameIndexOf)(got.data));
|
|
30769
30803
|
})
|
|
30770
30804
|
);
|
|
30771
30805
|
},
|
|
@@ -30844,7 +30878,7 @@ function GridBody({
|
|
|
30844
30878
|
field2.key,
|
|
30845
30879
|
lines2.flatMap((line) => {
|
|
30846
30880
|
const cell2 = line[at];
|
|
30847
|
-
return typeof cell2 === "string" ? (0,
|
|
30881
|
+
return typeof cell2 === "string" ? (0, import_records46.relationNamesIn)(field2, cell2) : [];
|
|
30848
30882
|
})
|
|
30849
30883
|
);
|
|
30850
30884
|
}
|
|
@@ -30957,7 +30991,7 @@ function GridBody({
|
|
|
30957
30991
|
}))
|
|
30958
30992
|
);
|
|
30959
30993
|
editing.forget(cells);
|
|
30960
|
-
for (const u of updates) (0,
|
|
30994
|
+
for (const u of updates) (0, import_core25.announceRecordChanged)(u.row.recordId);
|
|
30961
30995
|
const lines2 = updates.length + creates.length;
|
|
30962
30996
|
undo.push({ label: `Pasted ${lines2} ${lines2 === 1 ? "row" : "rows"}`, cells, created });
|
|
30963
30997
|
const expected = [
|
|
@@ -31131,7 +31165,7 @@ function GridBody({
|
|
|
31131
31165
|
tableName: table.data ? tableName(table.data) : "",
|
|
31132
31166
|
fields: fields.data ?? [],
|
|
31133
31167
|
document: row.document ?? {},
|
|
31134
|
-
level: (0,
|
|
31168
|
+
level: (0, import_records46.asPermissionLevel)(row.level)
|
|
31135
31169
|
}),
|
|
31136
31170
|
[host, tableId, table.data, fields.data]
|
|
31137
31171
|
);
|
|
@@ -31250,7 +31284,7 @@ function GridBody({
|
|
|
31250
31284
|
const values = presetValues ? withNewRowValues(presetValues, given) : given;
|
|
31251
31285
|
setAddRefused(null);
|
|
31252
31286
|
if (formHosted && fields.data) {
|
|
31253
|
-
const wouldRefuse = (0,
|
|
31287
|
+
const wouldRefuse = (0, import_core25.predictWriteRefusals)({ fields: fields.data, document: values ?? {} });
|
|
31254
31288
|
if (wouldRefuse.length > 0) {
|
|
31255
31289
|
setFormAsk((held) => ({ n: (held?.n ?? 0) + 1, initial: { ...values ?? {} } }));
|
|
31256
31290
|
return;
|
|
@@ -32818,7 +32852,7 @@ var import_clipboard6 = require("@ai-matrx/kit/clipboard");
|
|
|
32818
32852
|
var import_download2 = require("@ai-matrx/kit/download");
|
|
32819
32853
|
var import_react174 = require("react");
|
|
32820
32854
|
var import_react175 = require("@ai-matrx/records/react");
|
|
32821
|
-
var
|
|
32855
|
+
var import_core26 = require("@ai-matrx/records/core");
|
|
32822
32856
|
init_host();
|
|
32823
32857
|
|
|
32824
32858
|
// src/viewExport.ts
|
|
@@ -32894,7 +32928,7 @@ function toRows(fields, records, labels) {
|
|
|
32894
32928
|
absent_reason: envelope?.absent ?? null,
|
|
32895
32929
|
// A VALUE KEPT AS A FILE carries its pointer, so the export writes the whole text
|
|
32896
32930
|
// (`withWholeValues`), never the first words passed off as the value.
|
|
32897
|
-
source: (0,
|
|
32931
|
+
source: (0, import_core26.wholeValueOf)(document2, field2.key)
|
|
32898
32932
|
};
|
|
32899
32933
|
}
|
|
32900
32934
|
return row;
|
|
@@ -32925,7 +32959,7 @@ async function rowsForFile(args) {
|
|
|
32925
32959
|
);
|
|
32926
32960
|
const lookup = ((field2, id) => labels(field2, id) ?? learned.get(`${field2.id}:${id}`) ?? null);
|
|
32927
32961
|
const read = host.readFileText;
|
|
32928
|
-
return (0,
|
|
32962
|
+
return (0, import_core26.withWholeValues)(toRows(all, records, lookup), read ? (fileId) => read({ fileId }) : null);
|
|
32929
32963
|
}
|
|
32930
32964
|
function ExportMenu({ tableId, rows, label, className, view }) {
|
|
32931
32965
|
const client = (0, import_react175.useRecordsClient)();
|
|
@@ -32972,7 +33006,7 @@ function ExportMenu({ tableId, rows, label, className, view }) {
|
|
|
32972
33006
|
{
|
|
32973
33007
|
size: "sm",
|
|
32974
33008
|
variant: "outline",
|
|
32975
|
-
onClick: () => void exported().then((rows2) => download(`${name}.csv`, "text/csv;charset=utf-8", (0,
|
|
33009
|
+
onClick: () => void exported().then((rows2) => download(`${name}.csv`, "text/csv;charset=utf-8", (0, import_core26.exportCsv)(columns, rows2))).catch(
|
|
32976
33010
|
(thrown) => setFailure((0, refusals_exports.refusalFromThrown)(thrown, "The CSV could not be written.", "Try again in a moment."))
|
|
32977
33011
|
),
|
|
32978
33012
|
children: "CSV"
|
|
@@ -32993,7 +33027,7 @@ function ExportMenu({ tableId, rows, label, className, view }) {
|
|
|
32993
33027
|
);
|
|
32994
33028
|
setFailure(null);
|
|
32995
33029
|
try {
|
|
32996
|
-
exported().then((rows2) => (0,
|
|
33030
|
+
exported().then((rows2) => (0, import_core26.exportXlsx)(columns, rows2, name)).then(
|
|
32997
33031
|
(bytes) => download(
|
|
32998
33032
|
`${name}.xlsx`,
|
|
32999
33033
|
"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
|
|
@@ -33012,7 +33046,7 @@ function ExportMenu({ tableId, rows, label, className, view }) {
|
|
|
33012
33046
|
{
|
|
33013
33047
|
size: "sm",
|
|
33014
33048
|
variant: "outline",
|
|
33015
|
-
onClick: () => void exported().then((rows2) => download(`${name}.md`, "text/markdown;charset=utf-8", (0,
|
|
33049
|
+
onClick: () => void exported().then((rows2) => download(`${name}.md`, "text/markdown;charset=utf-8", (0, import_core26.exportMarkdown)(columns, rows2))).catch(
|
|
33016
33050
|
(thrown) => setFailure((0, refusals_exports.refusalFromThrown)(thrown, "The Markdown could not be written.", "The CSV beside this button carries the same rows."))
|
|
33017
33051
|
),
|
|
33018
33052
|
children: "Markdown"
|
|
@@ -33024,7 +33058,7 @@ function ExportMenu({ tableId, rows, label, className, view }) {
|
|
|
33024
33058
|
size: "sm",
|
|
33025
33059
|
variant: "outline",
|
|
33026
33060
|
onClick: () => void exported().then(async (rows2) => {
|
|
33027
|
-
if (await (0, import_clipboard6.copyText)((0,
|
|
33061
|
+
if (await (0, import_clipboard6.copyText)((0, import_core26.exportMarkdown)(columns, rows2))) host.notify?.success("Markdown copied");
|
|
33028
33062
|
else host.notify?.error("Couldn\u2019t copy the Markdown");
|
|
33029
33063
|
}).catch(
|
|
33030
33064
|
(thrown) => setFailure((0, refusals_exports.refusalFromThrown)(thrown, "The Markdown could not be written.", "The CSV beside this button carries the same rows."))
|
|
@@ -33058,7 +33092,7 @@ function ExportMenu({ tableId, rows, label, className, view }) {
|
|
|
33058
33092
|
sourceId: `records:${tableId}`,
|
|
33059
33093
|
size: "xs",
|
|
33060
33094
|
json: () => records.map((r) => r.document),
|
|
33061
|
-
human: () => (0,
|
|
33095
|
+
human: () => (0, import_core26.exportCsv)(columns, toRows(columns, records, labels))
|
|
33062
33096
|
}
|
|
33063
33097
|
),
|
|
33064
33098
|
viewHeld && "rows" in viewHeld && viewHeld.cut ? /* @__PURE__ */ (0, import_jsx_runtime102.jsx)("span", { className: "text-xs text-muted-foreground", children: cutWords(viewHeld.rows.length) }) : null,
|
|
@@ -33612,7 +33646,7 @@ function TableRenameDialog({
|
|
|
33612
33646
|
|
|
33613
33647
|
// src/TableSettings.tsx
|
|
33614
33648
|
var import_react193 = require("react");
|
|
33615
|
-
var
|
|
33649
|
+
var import_records48 = require("@ai-matrx/records");
|
|
33616
33650
|
|
|
33617
33651
|
// src/ArchiveDeliberately.tsx
|
|
33618
33652
|
var import_react183 = require("react");
|
|
@@ -33915,7 +33949,7 @@ function TableAccessLevel({ tableId, fields }) {
|
|
|
33915
33949
|
|
|
33916
33950
|
// src/RowControls.tsx
|
|
33917
33951
|
var import_react189 = require("react");
|
|
33918
|
-
var
|
|
33952
|
+
var import_records47 = require("@ai-matrx/records");
|
|
33919
33953
|
var import_react190 = require("@ai-matrx/records/react");
|
|
33920
33954
|
var import_design_system93 = require("@ai-matrx/design-system");
|
|
33921
33955
|
init_Refusal();
|
|
@@ -33945,7 +33979,7 @@ function ShownToSelect({
|
|
|
33945
33979
|
onChange,
|
|
33946
33980
|
testId
|
|
33947
33981
|
}) {
|
|
33948
|
-
return /* @__PURE__ */ (0, import_jsx_runtime109.jsxs)(import_design_system93.Select, { value, onValueChange: (next) => (0,
|
|
33982
|
+
return /* @__PURE__ */ (0, import_jsx_runtime109.jsxs)(import_design_system93.Select, { value, onValueChange: (next) => (0, import_records47.isShownTo)(next) ? onChange(next) : void 0, children: [
|
|
33949
33983
|
/* @__PURE__ */ (0, import_jsx_runtime109.jsxs)(
|
|
33950
33984
|
import_design_system93.SelectTrigger,
|
|
33951
33985
|
{
|
|
@@ -33959,7 +33993,7 @@ function ShownToSelect({
|
|
|
33959
33993
|
]
|
|
33960
33994
|
}
|
|
33961
33995
|
),
|
|
33962
|
-
/* @__PURE__ */ (0, import_jsx_runtime109.jsx)(import_design_system93.SelectContent, { children: allowed.map((word) => /* @__PURE__ */ (0, import_jsx_runtime109.jsx)(import_design_system93.SelectItem, { value: word, children:
|
|
33996
|
+
/* @__PURE__ */ (0, import_jsx_runtime109.jsx)(import_design_system93.SelectContent, { children: allowed.map((word) => /* @__PURE__ */ (0, import_jsx_runtime109.jsx)(import_design_system93.SelectItem, { value: word, children: import_records47.SHOWN_TO_LABEL[word] }, word)) })
|
|
33963
33997
|
] });
|
|
33964
33998
|
}
|
|
33965
33999
|
function NewRowsDefaults({ tableId }) {
|
|
@@ -33997,10 +34031,10 @@ function NewRowsDefaults({ tableId }) {
|
|
|
33997
34031
|
setError(null);
|
|
33998
34032
|
setApplied(appliedLine(answer.data));
|
|
33999
34033
|
};
|
|
34000
|
-
if (!(0,
|
|
34034
|
+
if (!(0, import_records47.levelHasShownTo)(table.data?.level)) return null;
|
|
34001
34035
|
if (!d) return error ? /* @__PURE__ */ (0, import_jsx_runtime109.jsx)(RefusalNotice, { error }) : null;
|
|
34002
34036
|
const shown5 = d.shown_to ?? d.effective.shown_to;
|
|
34003
|
-
const allowed = d.allowed_shown_to.filter(
|
|
34037
|
+
const allowed = d.allowed_shown_to.filter(import_records47.isShownTo);
|
|
34004
34038
|
return /* @__PURE__ */ (0, import_jsx_runtime109.jsxs)("section", { className: "flex flex-col gap-1.5", "data-testid": "new-rows-defaults", children: [
|
|
34005
34039
|
/* @__PURE__ */ (0, import_jsx_runtime109.jsx)("span", { className: "font-medium", children: ROW_CONTROL_WORDS.block }),
|
|
34006
34040
|
/* @__PURE__ */ (0, import_jsx_runtime109.jsxs)("div", { className: "flex items-center gap-2", children: [
|
|
@@ -34014,7 +34048,7 @@ function NewRowsDefaults({ tableId }) {
|
|
|
34014
34048
|
testId: "new-rows-shown-to",
|
|
34015
34049
|
onChange: (next) => void set({ shown_to: next })
|
|
34016
34050
|
}
|
|
34017
|
-
) : /* @__PURE__ */ (0, import_jsx_runtime109.jsx)("span", { "data-testid": "new-rows-shown-to-text", children:
|
|
34051
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime109.jsx)("span", { "data-testid": "new-rows-shown-to-text", children: import_records47.SHOWN_TO_LABEL[shown5] })
|
|
34018
34052
|
] }),
|
|
34019
34053
|
/* @__PURE__ */ (0, import_jsx_runtime109.jsxs)("div", { className: "flex items-center gap-2", "data-testid": "new-rows-published", children: [
|
|
34020
34054
|
/* @__PURE__ */ (0, import_jsx_runtime109.jsx)("span", { className: "min-w-fit flex-1 whitespace-nowrap", children: ROW_CONTROL_WORDS.publishedToWeb }),
|
|
@@ -34065,10 +34099,10 @@ function RowShownTo({ recordId, tableId }) {
|
|
|
34065
34099
|
}, [read]);
|
|
34066
34100
|
if (error && !c) return null;
|
|
34067
34101
|
if (tableId && table.loading && !table.data) return null;
|
|
34068
|
-
if (!(0,
|
|
34069
|
-
if (!c || c.shown_to.is_child || !(0,
|
|
34102
|
+
if (!(0, import_records47.levelHasShownTo)(table.data?.level)) return null;
|
|
34103
|
+
if (!c || c.shown_to.is_child || !(0, import_records47.isShownTo)(c.shown_to.effective)) return null;
|
|
34070
34104
|
const effective = c.shown_to.effective;
|
|
34071
|
-
const allowed = c.shown_to.allowed.filter(
|
|
34105
|
+
const allowed = c.shown_to.allowed.filter(import_records47.isShownTo);
|
|
34072
34106
|
return /* @__PURE__ */ (0, import_jsx_runtime109.jsxs)("span", { className: "inline-flex shrink-0 items-center", "data-testid": "row-shown-to", children: [
|
|
34073
34107
|
c.shown_to.can_change ? /* @__PURE__ */ (0, import_jsx_runtime109.jsx)(
|
|
34074
34108
|
ShownToSelect,
|
|
@@ -34095,7 +34129,7 @@ function RowShownTo({ recordId, tableId }) {
|
|
|
34095
34129
|
title: ROW_CONTROL_WORDS.whoMayChangeRow,
|
|
34096
34130
|
children: [
|
|
34097
34131
|
/* @__PURE__ */ (0, import_jsx_runtime109.jsx)("span", { className: "text-muted-foreground", children: ROW_CONTROL_WORDS.shownTo }),
|
|
34098
|
-
/* @__PURE__ */ (0, import_jsx_runtime109.jsx)("span", { "data-testid": "row-shown-to-text", children:
|
|
34132
|
+
/* @__PURE__ */ (0, import_jsx_runtime109.jsx)("span", { "data-testid": "row-shown-to-text", children: import_records47.SHOWN_TO_LABEL[effective] }),
|
|
34099
34133
|
/* @__PURE__ */ (0, import_jsx_runtime109.jsx)("span", { className: "sr-only", "data-testid": "row-shown-to-who", children: ROW_CONTROL_WORDS.whoMayChangeRow })
|
|
34100
34134
|
]
|
|
34101
34135
|
}
|
|
@@ -34463,7 +34497,7 @@ function TableSettingsPanel({
|
|
|
34463
34497
|
table.data ? /* @__PURE__ */ (0, import_jsx_runtime111.jsx)(TableFoundationSwitch, { tableId, table: table.data }) : null,
|
|
34464
34498
|
table.data ? /* @__PURE__ */ (0, import_jsx_runtime111.jsx)(TableAccessLevel, { tableId, fields: fields.data ?? [] }) : null,
|
|
34465
34499
|
/* @__PURE__ */ (0, import_jsx_runtime111.jsx)(import_design_system95.Separator, {}),
|
|
34466
|
-
(0,
|
|
34500
|
+
(0, import_records48.levelHasShownTo)(table.data?.level) ? /* @__PURE__ */ (0, import_jsx_runtime111.jsxs)(import_jsx_runtime111.Fragment, { children: [
|
|
34467
34501
|
/* @__PURE__ */ (0, import_jsx_runtime111.jsx)(NewRowsDefaults, { tableId }),
|
|
34468
34502
|
/* @__PURE__ */ (0, import_jsx_runtime111.jsx)(import_design_system95.Separator, {})
|
|
34469
34503
|
] }) : null,
|
|
@@ -34547,7 +34581,7 @@ function TableSettingsPanel({
|
|
|
34547
34581
|
|
|
34548
34582
|
// src/Peek.tsx
|
|
34549
34583
|
var import_react204 = require("react");
|
|
34550
|
-
var
|
|
34584
|
+
var import_records51 = require("@ai-matrx/records");
|
|
34551
34585
|
var import_react205 = require("@ai-matrx/records/react");
|
|
34552
34586
|
var import_react206 = require("@ai-matrx/alchemy/react");
|
|
34553
34587
|
|
|
@@ -34783,7 +34817,7 @@ init_Refusal();
|
|
|
34783
34817
|
|
|
34784
34818
|
// src/ValueAlternates.tsx
|
|
34785
34819
|
var import_react199 = require("react");
|
|
34786
|
-
var
|
|
34820
|
+
var import_records49 = require("@ai-matrx/records");
|
|
34787
34821
|
var import_react200 = require("@ai-matrx/records/react");
|
|
34788
34822
|
var import_text_case13 = require("@ai-matrx/kit/text-case");
|
|
34789
34823
|
var import_design_system97 = require("@ai-matrx/design-system");
|
|
@@ -34839,7 +34873,7 @@ function ValueAlternates({
|
|
|
34839
34873
|
async function use(index) {
|
|
34840
34874
|
setBusy(index);
|
|
34841
34875
|
setRefusal(null);
|
|
34842
|
-
const written = await (0,
|
|
34876
|
+
const written = await (0, import_records49.chooseAlternate)(client, { record_id: recordId, field_key: field2.key, alternate_index: index, ...shownList[index]?.rank !== void 0 ? { rank: shownList[index].rank } : {} });
|
|
34843
34877
|
setBusy(null);
|
|
34844
34878
|
if (!written.ok) return setRefusal(written.error);
|
|
34845
34879
|
setOpen(false);
|
|
@@ -34978,7 +35012,7 @@ init_names();
|
|
|
34978
35012
|
// src/RecordBody.tsx
|
|
34979
35013
|
var import_react202 = require("react");
|
|
34980
35014
|
var import_design_system99 = require("@ai-matrx/design-system");
|
|
34981
|
-
var
|
|
35015
|
+
var import_records50 = require("@ai-matrx/records");
|
|
34982
35016
|
var import_react203 = require("@ai-matrx/records/react");
|
|
34983
35017
|
init_host();
|
|
34984
35018
|
init_recordVersions();
|
|
@@ -34987,7 +35021,7 @@ init_writeOnTheWinningVersion();
|
|
|
34987
35021
|
var import_jsx_runtime116 = require("react/jsx-runtime");
|
|
34988
35022
|
var BODY_NAMES = /^(notes?|page|body|content|page content|details|description)$/i;
|
|
34989
35023
|
function bodyFieldOf(fields) {
|
|
34990
|
-
const rich2 = fields.filter((field2) => (0,
|
|
35024
|
+
const rich2 = fields.filter((field2) => (0, import_records50.newerKindOf)(field2) === "rich_text");
|
|
34991
35025
|
return rich2.find((field2) => BODY_NAMES.test((field2.label ?? field2.key).trim()) || BODY_NAMES.test(field2.key.replace(/_/g, " "))) ?? rich2[0];
|
|
34992
35026
|
}
|
|
34993
35027
|
var BODY_COLUMN_NAME = "Notes";
|
|
@@ -35113,7 +35147,7 @@ function Peek({ tableId, recordId, onClose, className, onPage = false }) {
|
|
|
35113
35147
|
if (record.error) return /* @__PURE__ */ (0, import_jsx_runtime117.jsx)(RefusalNotice, { error: record.error, className });
|
|
35114
35148
|
if (fields.error) return /* @__PURE__ */ (0, import_jsx_runtime117.jsx)(RefusalNotice, { error: fields.error, className });
|
|
35115
35149
|
const document2 = record.data?.document;
|
|
35116
|
-
if (document2 && (0,
|
|
35150
|
+
if (document2 && (0, import_records51.isLockedStub)({ document: document2, level: null })) {
|
|
35117
35151
|
const filed = document2["submitted_at"];
|
|
35118
35152
|
const when = typeof filed === "string" && !Number.isNaN(Date.parse(filed)) ? new Date(filed).toLocaleDateString("en-US", { year: "numeric", month: "short", day: "numeric" }) : null;
|
|
35119
35153
|
return /* @__PURE__ */ (0, import_jsx_runtime117.jsxs)("p", { className: (0, import_design_system100.cn)("text-sm text-muted-foreground", className), "data-records-locked-record": "", children: [
|
|
@@ -35458,7 +35492,7 @@ function lookAfterReset(look) {
|
|
|
35458
35492
|
// src/ViewSwitcher.tsx
|
|
35459
35493
|
var import_react234 = require("react");
|
|
35460
35494
|
var import_react235 = require("@ai-matrx/records/react");
|
|
35461
|
-
var
|
|
35495
|
+
var import_records56 = require("@ai-matrx/records");
|
|
35462
35496
|
var import_design_system111 = require("@ai-matrx/design-system");
|
|
35463
35497
|
var import_data_table22 = require("@ai-matrx/design-system/data-table");
|
|
35464
35498
|
var import_format10 = require("@ai-matrx/kit/format");
|
|
@@ -35662,7 +35696,7 @@ function MoveRefusedBadge({ refused }) {
|
|
|
35662
35696
|
// src/Pipeline.tsx
|
|
35663
35697
|
var import_react211 = require("react");
|
|
35664
35698
|
var import_react212 = require("@ai-matrx/records/react");
|
|
35665
|
-
var
|
|
35699
|
+
var import_records52 = require("@ai-matrx/records");
|
|
35666
35700
|
var import_design_system102 = require("@ai-matrx/design-system");
|
|
35667
35701
|
var import_data_table17 = require("@ai-matrx/design-system/data-table");
|
|
35668
35702
|
init_recordVersions();
|
|
@@ -35777,7 +35811,7 @@ function PipelineBoard({
|
|
|
35777
35811
|
alive.current = false;
|
|
35778
35812
|
};
|
|
35779
35813
|
}, []);
|
|
35780
|
-
const filterKey = (0,
|
|
35814
|
+
const filterKey = (0, import_records52.stableFilterKey)(filter);
|
|
35781
35815
|
const reload = (0, import_react211.useCallback)(async () => {
|
|
35782
35816
|
setLoading(true);
|
|
35783
35817
|
const [read, board, held] = await Promise.all([
|
|
@@ -36530,7 +36564,7 @@ function useRowColorBy(all, colorKey, style) {
|
|
|
36530
36564
|
}
|
|
36531
36565
|
|
|
36532
36566
|
// src/workedOutDate.ts
|
|
36533
|
-
var
|
|
36567
|
+
var import_records53 = require("@ai-matrx/records");
|
|
36534
36568
|
var WORKED_OUT_DATE_LOCK = "Worked out \xB7 can't move";
|
|
36535
36569
|
var INLINE_DEPTH = 8;
|
|
36536
36570
|
var configOf = (field2) => field2?.config ?? {};
|
|
@@ -36602,7 +36636,7 @@ function formulaResultKind(node, all) {
|
|
|
36602
36636
|
if (op2 === "fx.min" || op2 === "fx.max") {
|
|
36603
36637
|
return args.length > 0 && args.every((a) => formulaResultKind(a, all) === "date") ? "date" : "number";
|
|
36604
36638
|
}
|
|
36605
|
-
return
|
|
36639
|
+
return import_records53.FORMULA_NODE_RESULTS[op2] ?? "unknown";
|
|
36606
36640
|
}
|
|
36607
36641
|
function isDateFormula(field2, all) {
|
|
36608
36642
|
const expr = ownExpression(field2);
|
|
@@ -39189,14 +39223,14 @@ function ListRow({
|
|
|
39189
39223
|
// src/ChartLayout.tsx
|
|
39190
39224
|
var import_react232 = require("react");
|
|
39191
39225
|
var import_react233 = require("@ai-matrx/records/react");
|
|
39192
|
-
var
|
|
39226
|
+
var import_records55 = require("@ai-matrx/records");
|
|
39193
39227
|
var import_design_system110 = require("@ai-matrx/design-system");
|
|
39194
39228
|
|
|
39195
39229
|
// src/ChartBlock.tsx
|
|
39196
39230
|
var import_react231 = require("react");
|
|
39197
39231
|
var import_recharts = require("recharts");
|
|
39198
|
-
var
|
|
39199
|
-
var
|
|
39232
|
+
var import_records54 = require("@ai-matrx/records");
|
|
39233
|
+
var import_core27 = require("@ai-matrx/records/core");
|
|
39200
39234
|
var import_design_system109 = require("@ai-matrx/design-system");
|
|
39201
39235
|
var import_format9 = require("@ai-matrx/kit/format");
|
|
39202
39236
|
init_Refusal();
|
|
@@ -39662,7 +39696,7 @@ function pretty(n) {
|
|
|
39662
39696
|
return Number.isInteger(n) ? n.toLocaleString() : n.toLocaleString(void 0, { maximumFractionDigits: 2 });
|
|
39663
39697
|
}
|
|
39664
39698
|
function asRefusal2(block) {
|
|
39665
|
-
return (0,
|
|
39699
|
+
return (0, import_core27.mapPgError)(
|
|
39666
39700
|
{
|
|
39667
39701
|
message: block.refused ?? "",
|
|
39668
39702
|
...block.sqlstate ? { code: block.sqlstate } : {}
|
|
@@ -39677,7 +39711,7 @@ function ChartBlock({ block, subject, tableName: tableName2, className, centerVa
|
|
|
39677
39711
|
const kind2 = block.kind;
|
|
39678
39712
|
const tableId = block.table_id ?? subject;
|
|
39679
39713
|
const measures = block.measures && block.measures.length > 0 ? block.measures : [{ op: "count" }];
|
|
39680
|
-
const primary = (0,
|
|
39714
|
+
const primary = (0, import_records54.measureKey)(measures[0]);
|
|
39681
39715
|
const windows = kind2 === "stuck" ? null : block.compare ?? null;
|
|
39682
39716
|
const compared = !!windows;
|
|
39683
39717
|
const grain = block.bucket?.by ?? null;
|
|
@@ -40122,7 +40156,7 @@ var isChartKind = (v) => v === "bar" || v === "line" || v === "donut";
|
|
|
40122
40156
|
var isChartMeasure = (v) => v === "count" || v === "sum" || v === "avg";
|
|
40123
40157
|
function defaultChartGroup(fields) {
|
|
40124
40158
|
return fields.find((f) => {
|
|
40125
|
-
const kind2 = (0,
|
|
40159
|
+
const kind2 = (0, import_records55.fieldKindFor)(f);
|
|
40126
40160
|
return kind2 === "select" || kind2 === "multi_select";
|
|
40127
40161
|
})?.key ?? null;
|
|
40128
40162
|
}
|
|
@@ -40181,7 +40215,7 @@ function ChartLayout({ view, fields, filter, onChange, remembered }) {
|
|
|
40181
40215
|
}, [client, view.subject, view.name, qKey, filterKey]);
|
|
40182
40216
|
const groupable = fields.filter((f) => !["attachment", "file", "formula", "button"].includes(String(f.type)));
|
|
40183
40217
|
const numeric = fields.filter((f) => NUMBER_TYPES.has(String(f.type)));
|
|
40184
|
-
const pickMeasure = (0,
|
|
40218
|
+
const pickMeasure = (0, import_records55.measureKey)(q.measure);
|
|
40185
40219
|
return /* @__PURE__ */ (0, import_jsx_runtime130.jsxs)("div", { className: "flex min-h-0 flex-col gap-2", "data-records-chart-layout": "", "data-records-chart-measure": pickMeasure, children: [
|
|
40186
40220
|
/* @__PURE__ */ (0, import_jsx_runtime130.jsxs)("div", { className: "flex flex-wrap items-center gap-2 text-xs", children: [
|
|
40187
40221
|
/* @__PURE__ */ (0, import_jsx_runtime130.jsx)("span", { className: "text-muted-foreground", children: "Group by" }),
|
|
@@ -40220,7 +40254,7 @@ var NO_FIELDS2 = [];
|
|
|
40220
40254
|
function useViewRecords(view, pageSize = 200, filter, viewId) {
|
|
40221
40255
|
const client = (0, import_react235.useRecordsClient)();
|
|
40222
40256
|
const [limit, setLimit] = (0, import_react234.useState)(pageSize);
|
|
40223
|
-
const questionKey = `${view.subject}|${(0,
|
|
40257
|
+
const questionKey = `${view.subject}|${(0, import_records56.stableFilterKey)(filter ?? null)}|${JSON.stringify(view.sorts ?? [])}`;
|
|
40224
40258
|
(0, import_react234.useEffect)(() => {
|
|
40225
40259
|
setLimit(pageSize);
|
|
40226
40260
|
}, [questionKey, pageSize]);
|
|
@@ -40253,8 +40287,8 @@ function useViewRecords(view, pageSize = 200, filter, viewId) {
|
|
|
40253
40287
|
cancelled = true;
|
|
40254
40288
|
};
|
|
40255
40289
|
}, [client, ruleId, pageSize]);
|
|
40256
|
-
const asked4 = (0,
|
|
40257
|
-
const fromView = asked4 !== "{}" && (asked4 === (0,
|
|
40290
|
+
const asked4 = (0, import_records56.stableFilterKey)(filter ?? null);
|
|
40291
|
+
const fromView = asked4 !== "{}" && (asked4 === (0, import_records56.stableFilterKey)(view.where ?? null) || asked4 === (0, import_records56.stableFilterKey)(view.filters ?? null));
|
|
40258
40292
|
const tableRows = (0, import_react234.useMemo)(() => table.data?.rows ?? [], [table.data]);
|
|
40259
40293
|
const manual = view.order === "manual" && Boolean(viewId) && !ruleId;
|
|
40260
40294
|
const hand = useHandOrderRows({
|
|
@@ -41372,7 +41406,7 @@ function RecordCard({
|
|
|
41372
41406
|
/* @__PURE__ */ (0, import_jsx_runtime131.jsx)("span", { className: "block truncate", children: label }),
|
|
41373
41407
|
parentName ? /* @__PURE__ */ (0, import_jsx_runtime131.jsx)("span", { className: "block truncate text-muted-foreground", "data-records-card-parent": parentId ?? "", children: `Sub-item of ${parentName}` }) : null,
|
|
41374
41408
|
dates && dates.length > 0 ? /* @__PURE__ */ (0, import_jsx_runtime131.jsx)(CardDates, { record, fields: dates }) : null,
|
|
41375
|
-
(fields ?? []).filter((f) => (0,
|
|
41409
|
+
(fields ?? []).filter((f) => (0, import_records56.isButtonField)(f) || !isEmptyOnCard((record.document ?? {})[f.key]) || withheldNoticeOf(record.hidden, f.key)).map((f) => /* @__PURE__ */ (0, import_jsx_runtime131.jsx)("span", { className: "block truncate text-muted-foreground", "data-records-card-value": f.key, children: /* @__PURE__ */ (0, import_jsx_runtime131.jsx)(
|
|
41376
41410
|
RecordValue,
|
|
41377
41411
|
{
|
|
41378
41412
|
field: f,
|
|
@@ -41393,12 +41427,12 @@ function cardHiddenOf(presentation) {
|
|
|
41393
41427
|
}
|
|
41394
41428
|
var STATUS_WORDS = /^(status|stage|state|progress|phase)$/i;
|
|
41395
41429
|
function boardDefaultGroupField(eligible) {
|
|
41396
|
-
return eligible.find((f) => (0,
|
|
41430
|
+
return eligible.find((f) => (0, import_records56.newerKindOf)(f) === "status") ?? eligible.find((f) => STATUS_WORDS.test(fieldName(f).trim()) || STATUS_WORDS.test(f.key)) ?? eligible[0] ?? null;
|
|
41397
41431
|
}
|
|
41398
41432
|
|
|
41399
41433
|
// src/ArchivedView.tsx
|
|
41400
41434
|
var import_react236 = require("react");
|
|
41401
|
-
var
|
|
41435
|
+
var import_records57 = require("@ai-matrx/records");
|
|
41402
41436
|
var import_react237 = require("@ai-matrx/records/react");
|
|
41403
41437
|
var import_design_system112 = require("@ai-matrx/design-system");
|
|
41404
41438
|
init_Refusal();
|
|
@@ -41412,7 +41446,7 @@ function mayNotRestoreLine(why) {
|
|
|
41412
41446
|
return said2 === "" ? "Bringing a record back needs permission to edit this table. Ask somebody who has it." : said2;
|
|
41413
41447
|
}
|
|
41414
41448
|
function archivedRowLine(row, titleKey) {
|
|
41415
|
-
return `${recordName(row.document, titleKey)} \u2014 ${(0,
|
|
41449
|
+
return `${recordName(row.document, titleKey)} \u2014 ${(0, import_records57.archivedByLine)(row)}`;
|
|
41416
41450
|
}
|
|
41417
41451
|
function ArchivedView({
|
|
41418
41452
|
tableId,
|
|
@@ -41426,7 +41460,7 @@ function ArchivedView({
|
|
|
41426
41460
|
const table = (0, import_react237.useTable)(tableId);
|
|
41427
41461
|
const rights = useTableRights(table.data);
|
|
41428
41462
|
const fields = (0, import_react237.useFields)(tableId);
|
|
41429
|
-
const [lane, setLane] = (0, import_react236.useState)(laneFromHost ??
|
|
41463
|
+
const [lane, setLane] = (0, import_react236.useState)(laneFromHost ?? import_records57.DEFAULT_ARCHIVE_LANE);
|
|
41430
41464
|
const [rows, setRows] = (0, import_react236.useState)([]);
|
|
41431
41465
|
const [loading, setLoading] = (0, import_react236.useState)(true);
|
|
41432
41466
|
const [error, setError] = (0, import_react236.useState)(null);
|
|
@@ -41473,15 +41507,15 @@ function ArchivedView({
|
|
|
41473
41507
|
return /* @__PURE__ */ (0, import_jsx_runtime132.jsxs)("div", { className: (0, import_design_system112.cn)("flex min-h-0 flex-col gap-2", className), "data-testid": "archived-view", children: [
|
|
41474
41508
|
/* @__PURE__ */ (0, import_jsx_runtime132.jsxs)("div", { className: "flex flex-wrap items-center gap-2", children: [
|
|
41475
41509
|
/* @__PURE__ */ (0, import_jsx_runtime132.jsx)("span", { className: "text-sm font-medium", children: "Archived" }),
|
|
41476
|
-
/* @__PURE__ */ (0, import_jsx_runtime132.jsx)("div", { className: "ml-auto flex items-center gap-0.5", role: "group", "aria-label": "Archived by", children:
|
|
41510
|
+
/* @__PURE__ */ (0, import_jsx_runtime132.jsx)("div", { className: "ml-auto flex items-center gap-0.5", role: "group", "aria-label": "Archived by", children: import_records57.ARCHIVE_LANES.map((option) => /* @__PURE__ */ (0, import_jsx_runtime132.jsx)(
|
|
41477
41511
|
import_design_system112.Button,
|
|
41478
41512
|
{
|
|
41479
41513
|
size: "sm",
|
|
41480
41514
|
variant: option === lane ? "secondary" : "ghost",
|
|
41481
41515
|
"aria-pressed": option === lane,
|
|
41482
|
-
title:
|
|
41516
|
+
title: import_records57.ARCHIVE_LANE_MEANS[option],
|
|
41483
41517
|
onClick: () => pick(option),
|
|
41484
|
-
children:
|
|
41518
|
+
children: import_records57.ARCHIVE_LANE_LABEL[option]
|
|
41485
41519
|
},
|
|
41486
41520
|
option
|
|
41487
41521
|
)) })
|
|
@@ -41497,7 +41531,7 @@ function ArchivedView({
|
|
|
41497
41531
|
),
|
|
41498
41532
|
error ? /* @__PURE__ */ (0, import_jsx_runtime132.jsx)(RefusalNotice, { error }) : null,
|
|
41499
41533
|
loading && !error ? /* @__PURE__ */ (0, import_jsx_runtime132.jsx)(import_design_system112.Skeleton, { className: "h-24 w-full" }) : null,
|
|
41500
|
-
!loading && !error && rows.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime132.jsx)("p", { "data-testid": "archived-empty", className: "rounded-md border border-dashed px-3 py-6 text-xs text-muted-foreground", children: (0,
|
|
41534
|
+
!loading && !error && rows.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime132.jsx)("p", { "data-testid": "archived-empty", className: "rounded-md border border-dashed px-3 py-6 text-xs text-muted-foreground", children: (0, import_records57.emptyArchiveLine)(lane) }) : null,
|
|
41501
41535
|
!loading && !error && rows.length > 0 ? /* @__PURE__ */ (0, import_jsx_runtime132.jsx)("ul", { className: "flex flex-col gap-1", "data-testid": "archived-rows", children: rows.map((row) => /* @__PURE__ */ (0, import_jsx_runtime132.jsxs)(
|
|
41502
41536
|
"li",
|
|
41503
41537
|
{
|
|
@@ -41507,7 +41541,7 @@ function ArchivedView({
|
|
|
41507
41541
|
children: [
|
|
41508
41542
|
/* @__PURE__ */ (0, import_jsx_runtime132.jsxs)("div", { className: "flex min-w-0 flex-1 flex-col", children: [
|
|
41509
41543
|
/* @__PURE__ */ (0, import_jsx_runtime132.jsx)("span", { className: "truncate text-sm", children: recordName(row.document, titleKey) }),
|
|
41510
|
-
/* @__PURE__ */ (0, import_jsx_runtime132.jsx)("span", { className: "truncate text-xs text-muted-foreground", "data-testid": "archived-who", children: (0,
|
|
41544
|
+
/* @__PURE__ */ (0, import_jsx_runtime132.jsx)("span", { className: "truncate text-xs text-muted-foreground", "data-testid": "archived-who", children: (0, import_records57.archivedByLine)(row) }),
|
|
41511
41545
|
refusal3 && refusal3.recordId === row.id ? /* @__PURE__ */ (0, import_jsx_runtime132.jsx)(RefusalNotice, { error: refusal3.error, className: "mt-2" }) : null
|
|
41512
41546
|
] }),
|
|
41513
41547
|
mayRestore ? /* @__PURE__ */ (0, import_jsx_runtime132.jsx)(
|
|
@@ -41530,7 +41564,7 @@ function ArchivedView({
|
|
|
41530
41564
|
] });
|
|
41531
41565
|
}
|
|
41532
41566
|
function retiredColumnLine(row) {
|
|
41533
|
-
return (0,
|
|
41567
|
+
return (0, import_records57.archivedByLine)(row);
|
|
41534
41568
|
}
|
|
41535
41569
|
function RetiredColumns({ tableId, mayRestore, whyNot }) {
|
|
41536
41570
|
const client = (0, import_react237.useRecordsClient)();
|
|
@@ -41594,7 +41628,7 @@ function RetiredColumns({ tableId, mayRestore, whyNot }) {
|
|
|
41594
41628
|
|
|
41595
41629
|
// src/ArchivedDisclosure.tsx
|
|
41596
41630
|
var import_react238 = require("react");
|
|
41597
|
-
var
|
|
41631
|
+
var import_records58 = require("@ai-matrx/records");
|
|
41598
41632
|
var import_react239 = require("@ai-matrx/records/react");
|
|
41599
41633
|
var import_design_system113 = require("@ai-matrx/design-system");
|
|
41600
41634
|
init_Refusal();
|
|
@@ -41695,10 +41729,10 @@ function ArchivedPortals({
|
|
|
41695
41729
|
error ? /* @__PURE__ */ (0, import_jsx_runtime133.jsx)(RefusalNotice, { error }) : null,
|
|
41696
41730
|
rows === null && !error ? /* @__PURE__ */ (0, import_jsx_runtime133.jsx)(import_design_system113.Skeleton, { className: "h-16 w-full" }) : null,
|
|
41697
41731
|
said2 ? /* @__PURE__ */ (0, import_jsx_runtime133.jsx)("p", { className: "rounded-md border border-border px-3 py-2 text-xs", "data-testid": "archived-portal-said", children: said2 }) : null,
|
|
41698
|
-
rows !== null && !error && rows.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime133.jsx)("p", { "data-testid": "archived-portals-empty", className: "text-xs text-muted-foreground", children: (0,
|
|
41732
|
+
rows !== null && !error && rows.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime133.jsx)("p", { "data-testid": "archived-portals-empty", className: "text-xs text-muted-foreground", children: (0, import_records58.emptyPortalArchiveLine)() }) : null,
|
|
41699
41733
|
rows !== null && rows.length > 0 ? /* @__PURE__ */ (0, import_jsx_runtime133.jsx)("ul", { className: "flex flex-col gap-1.5", "data-testid": "archived-portals", children: rows.map((portal) => {
|
|
41700
41734
|
const asking = confirming === portal.portal_id;
|
|
41701
|
-
const matches2 = (0,
|
|
41735
|
+
const matches2 = (0, import_records58.portalTitleTypedBack)(typed2, portal.title);
|
|
41702
41736
|
return /* @__PURE__ */ (0, import_jsx_runtime133.jsxs)(
|
|
41703
41737
|
"li",
|
|
41704
41738
|
{
|
|
@@ -41737,7 +41771,7 @@ function ArchivedPortals({
|
|
|
41737
41771
|
] }),
|
|
41738
41772
|
asking ? /* @__PURE__ */ (0, import_jsx_runtime133.jsxs)("div", { className: "flex flex-col gap-1.5", children: [
|
|
41739
41773
|
/* @__PURE__ */ (0, import_jsx_runtime133.jsxs)("p", { className: "text-xs text-muted-foreground", children: [
|
|
41740
|
-
(0,
|
|
41774
|
+
(0, import_records58.portalConfirmLine)(portal.title),
|
|
41741
41775
|
" Restoring it puts it back exactly as it was: everyone who was invited can sign in again, and it shows the same Tables."
|
|
41742
41776
|
] }),
|
|
41743
41777
|
/* @__PURE__ */ (0, import_jsx_runtime133.jsxs)("div", { className: "flex flex-wrap items-center gap-1.5", children: [
|
|
@@ -41779,7 +41813,7 @@ var import_react241 = require("react");
|
|
|
41779
41813
|
var import_react242 = require("@ai-matrx/records/react");
|
|
41780
41814
|
var import_design_system114 = require("@ai-matrx/design-system");
|
|
41781
41815
|
var import_controls5 = require("@ai-matrx/design-system/controls");
|
|
41782
|
-
var
|
|
41816
|
+
var import_core28 = require("@dnd-kit/core");
|
|
41783
41817
|
var import_sortable = require("@dnd-kit/sortable");
|
|
41784
41818
|
var import_utilities = require("@dnd-kit/utilities");
|
|
41785
41819
|
init_Refusal();
|
|
@@ -41874,7 +41908,7 @@ function seedIsSatisfied(seed, views) {
|
|
|
41874
41908
|
return seed.isDefault === true && views.some((v) => v.isDefault);
|
|
41875
41909
|
}
|
|
41876
41910
|
function SectionBox({ id, children, ...rest }) {
|
|
41877
|
-
const { setNodeRef, isOver } = (0,
|
|
41911
|
+
const { setNodeRef, isOver } = (0, import_core28.useDroppable)({ id });
|
|
41878
41912
|
return /* @__PURE__ */ (0, import_jsx_runtime134.jsx)("div", { ref: setNodeRef, className: (0, import_design_system114.cn)("rounded-sm", isOver && "bg-accent/40"), ...rest, children });
|
|
41879
41913
|
}
|
|
41880
41914
|
function SortableRow({ id, disabled, children }) {
|
|
@@ -41929,7 +41963,7 @@ function ViewBar({ tableId, activeViewId, onActiveView, seed, settings, onViews,
|
|
|
41929
41963
|
const [renamingSection, setRenamingSection] = (0, import_react241.useState)(null);
|
|
41930
41964
|
const [dragging, setDragging] = (0, import_react241.useState)(false);
|
|
41931
41965
|
const justDragged = (0, import_react241.useRef)(false);
|
|
41932
|
-
const sensors = (0,
|
|
41966
|
+
const sensors = (0, import_core28.useSensors)((0, import_core28.useSensor)(import_core28.PointerSensor, { activationConstraint: { distance: 6 } }));
|
|
41933
41967
|
async function dropped(event) {
|
|
41934
41968
|
setDragging(false);
|
|
41935
41969
|
justDragged.current = true;
|
|
@@ -42184,7 +42218,7 @@ function ViewBar({ tableId, activeViewId, onActiveView, seed, settings, onViews,
|
|
|
42184
42218
|
) }),
|
|
42185
42219
|
/* @__PURE__ */ (0, import_jsx_runtime134.jsxs)(import_design_system114.PopoverContent, { sizing: "content", align: "start", className: "w-64 p-1", "data-view-picker-content": "", children: [
|
|
42186
42220
|
/* @__PURE__ */ (0, import_jsx_runtime134.jsxs)("div", { role: "group", "aria-label": "Saved views", className: "flex max-h-[50dvh] flex-col overflow-y-auto", children: [
|
|
42187
|
-
/* @__PURE__ */ (0, import_jsx_runtime134.jsx)(
|
|
42221
|
+
/* @__PURE__ */ (0, import_jsx_runtime134.jsx)(import_core28.DndContext, { sensors, collisionDetection: import_core28.closestCenter, onDragStart: () => setDragging(true), onDragCancel: () => setDragging(false), onDragEnd: (e) => void dropped(e), children: (() => {
|
|
42188
42222
|
const groups = (0, import_views2.groupViewsBySection)(views);
|
|
42189
42223
|
return groups.some((g) => g.name === null) || !dragging ? groups : [{ name: null, views: [] }, ...groups];
|
|
42190
42224
|
})().map((group) => /* @__PURE__ */ (0, import_jsx_runtime134.jsxs)(SectionBox, { id: (0, import_views2.sectionDropId)(group.name), role: "group", "aria-label": group.name ?? "Views", "data-view-section": group.name ?? "", children: [
|
|
@@ -44203,7 +44237,7 @@ init_Refusal();
|
|
|
44203
44237
|
|
|
44204
44238
|
// src/AsOfReading.tsx
|
|
44205
44239
|
var import_react250 = require("react");
|
|
44206
|
-
var
|
|
44240
|
+
var import_records59 = require("@ai-matrx/records");
|
|
44207
44241
|
var import_react251 = require("@ai-matrx/records/react");
|
|
44208
44242
|
var import_design_system118 = require("@ai-matrx/design-system");
|
|
44209
44243
|
var import_controls7 = require("@ai-matrx/design-system/controls");
|
|
@@ -44228,7 +44262,7 @@ function asOfArgs(record_id, asOf, zone = getPersonTimeZone()) {
|
|
|
44228
44262
|
return asOf.clock === "recorded" ? { record_id, recorded_at: endOfDayIso(asOf.day, zone) } : { record_id, world_on: asOf.day };
|
|
44229
44263
|
}
|
|
44230
44264
|
function AsOfControl({ value, onChange, className }) {
|
|
44231
|
-
const [text, setText] = (0, import_react250.useState)(value ? (0,
|
|
44265
|
+
const [text, setText] = (0, import_react250.useState)(value ? (0, import_records59.typedDateText)(value.day) : "");
|
|
44232
44266
|
const [bad, setBad] = (0, import_react250.useState)(false);
|
|
44233
44267
|
usePersonTimeZone();
|
|
44234
44268
|
const clock = value?.clock ?? "recorded";
|
|
@@ -44238,13 +44272,13 @@ function AsOfControl({ value, onChange, className }) {
|
|
|
44238
44272
|
onChange(null);
|
|
44239
44273
|
return;
|
|
44240
44274
|
}
|
|
44241
|
-
const read = (0,
|
|
44275
|
+
const read = (0, import_records59.readTypedDate)(words2);
|
|
44242
44276
|
if (!read.ok) {
|
|
44243
44277
|
setBad(true);
|
|
44244
44278
|
return;
|
|
44245
44279
|
}
|
|
44246
44280
|
setBad(false);
|
|
44247
|
-
setText((0,
|
|
44281
|
+
setText((0, import_records59.typedDateText)(read.day));
|
|
44248
44282
|
onChange({ day: read.day, clock });
|
|
44249
44283
|
}
|
|
44250
44284
|
return /* @__PURE__ */ (0, import_jsx_runtime138.jsxs)("div", { className: (0, import_design_system118.cn)("flex h-6 items-center gap-1", className), "data-records-as-of": "", children: [
|
|
@@ -44349,7 +44383,7 @@ function AsOfReading({
|
|
|
44349
44383
|
if (answer.doc === null) {
|
|
44350
44384
|
return /* @__PURE__ */ (0, import_jsx_runtime138.jsxs)("p", { className: (0, import_design_system118.cn)(box, "p-2 text-xs text-muted-foreground"), "data-records-as-of-none": "", children: [
|
|
44351
44385
|
"Not there on ",
|
|
44352
|
-
(0,
|
|
44386
|
+
(0, import_records59.typedDateText)(asOf.day)
|
|
44353
44387
|
] });
|
|
44354
44388
|
}
|
|
44355
44389
|
return /* @__PURE__ */ (0, import_jsx_runtime138.jsx)("dl", { className: (0, import_design_system118.cn)(box, "grid grid-cols-[minmax(5rem,9rem)_1fr] content-start gap-x-3 gap-y-0.5 p-2 text-[11px]"), "data-records-as-of-reading": "", children: rows.map(({ field: field2, was, now, differs }) => /* @__PURE__ */ (0, import_jsx_runtime138.jsxs)("div", { className: "contents", "data-as-of-field": field2.key, "data-as-of-differs": differs ? "" : void 0, children: [
|
|
@@ -45903,7 +45937,7 @@ function clientNoun(table) {
|
|
|
45903
45937
|
var import_clipboard8 = require("@ai-matrx/kit/clipboard");
|
|
45904
45938
|
var import_react266 = require("react");
|
|
45905
45939
|
var import_react267 = require("@ai-matrx/records/react");
|
|
45906
|
-
var
|
|
45940
|
+
var import_records60 = require("@ai-matrx/records");
|
|
45907
45941
|
var import_design_system127 = require("@ai-matrx/design-system");
|
|
45908
45942
|
init_BuildOrAsk();
|
|
45909
45943
|
|
|
@@ -46351,7 +46385,7 @@ function PortalsPanel({ tableId, activePortalId, className }) {
|
|
|
46351
46385
|
] }) : null,
|
|
46352
46386
|
activePortalId && !shown5.some((p) => p.portal_id === activePortalId) ? /* @__PURE__ */ (0, import_jsx_runtime147.jsx)("p", { className: "rounded-md border border-amber-600/40 bg-amber-500/5 px-3 py-2 text-xs leading-relaxed text-amber-700 dark:border-amber-400/40 dark:text-amber-300", children: PORTAL_NOT_HERE_LINE }) : null,
|
|
46353
46387
|
/* @__PURE__ */ (0, import_jsx_runtime147.jsx)("ul", { className: "flex flex-col gap-2", children: shown5.map((portal) => {
|
|
46354
|
-
const url = `${origin}${(0,
|
|
46388
|
+
const url = `${origin}${(0, import_records60.portalPath)(portal.slug)}`;
|
|
46355
46389
|
const open = openId === portal.portal_id;
|
|
46356
46390
|
const linked = portal.portal_id === activePortalId;
|
|
46357
46391
|
return /* @__PURE__ */ (0, import_jsx_runtime147.jsxs)(
|
|
@@ -46466,8 +46500,8 @@ function ArchivePortalControl({
|
|
|
46466
46500
|
}
|
|
46467
46501
|
),
|
|
46468
46502
|
asking ? /* @__PURE__ */ (0, import_jsx_runtime147.jsxs)("div", { className: "mt-1.5 flex w-full flex-col gap-1.5 rounded-md border border-dashed border-border p-2.5", children: [
|
|
46469
|
-
/* @__PURE__ */ (0, import_jsx_runtime147.jsx)("p", { className: "text-xs text-muted-foreground", "data-testid": "portal-archive-consequence", children: (0,
|
|
46470
|
-
/* @__PURE__ */ (0, import_jsx_runtime147.jsx)("p", { className: "text-xs text-muted-foreground", children: (0,
|
|
46503
|
+
/* @__PURE__ */ (0, import_jsx_runtime147.jsx)("p", { className: "text-xs text-muted-foreground", "data-testid": "portal-archive-consequence", children: (0, import_records60.portalArchiveConsequence)(portal.title, portal.signed_in, portal.invited) }),
|
|
46504
|
+
/* @__PURE__ */ (0, import_jsx_runtime147.jsx)("p", { className: "text-xs text-muted-foreground", children: (0, import_records60.portalConfirmLine)(portal.title) }),
|
|
46471
46505
|
/* @__PURE__ */ (0, import_jsx_runtime147.jsxs)("div", { className: "flex flex-wrap items-center gap-1.5", children: [
|
|
46472
46506
|
/* @__PURE__ */ (0, import_jsx_runtime147.jsx)(
|
|
46473
46507
|
import_design_system127.BasicInput,
|
|
@@ -46485,7 +46519,7 @@ function ArchivePortalControl({
|
|
|
46485
46519
|
size: "sm",
|
|
46486
46520
|
variant: "destructive",
|
|
46487
46521
|
"data-testid": "portal-archive-do",
|
|
46488
|
-
disabled: busy || !(0,
|
|
46522
|
+
disabled: busy || !(0, import_records60.portalTitleTypedBack)(typed2, portal.title),
|
|
46489
46523
|
onClick: () => void go(),
|
|
46490
46524
|
children: busy ? "Archiving\u2026" : "Archive it"
|
|
46491
46525
|
}
|
|
@@ -47010,7 +47044,7 @@ function FormLookFrame({ look, title, children, contained = false, showOwnerHead
|
|
|
47010
47044
|
// src/DigestScheduler.tsx
|
|
47011
47045
|
var import_react268 = require("react");
|
|
47012
47046
|
var import_react269 = require("@ai-matrx/records/react");
|
|
47013
|
-
var
|
|
47047
|
+
var import_records61 = require("@ai-matrx/records");
|
|
47014
47048
|
var import_design_system129 = require("@ai-matrx/design-system");
|
|
47015
47049
|
var import_controls9 = require("@ai-matrx/design-system/controls");
|
|
47016
47050
|
init_Refusal();
|
|
@@ -47101,7 +47135,7 @@ function DigestScheduler({
|
|
|
47101
47135
|
const [channel, setChannel] = (0, import_react268.useState)(
|
|
47102
47136
|
existing?.channel === "email" || existing?.channel === "sms" ? existing.channel : "in_app"
|
|
47103
47137
|
);
|
|
47104
|
-
const [quiet2, setQuiet] = (0, import_react268.useState)((0,
|
|
47138
|
+
const [quiet2, setQuiet] = (0, import_react268.useState)((0, import_records61.hasQuietHours)(existing?.quiet_hours));
|
|
47105
47139
|
const [quietFrom, setQuietFrom] = (0, import_react268.useState)(existing?.quiet_hours?.start ?? "22:00");
|
|
47106
47140
|
const [quietTo, setQuietTo] = (0, import_react268.useState)(existing?.quiet_hours?.end ?? "07:00");
|
|
47107
47141
|
const [recipients, setRecipients] = (0, import_react268.useState)(
|
|
@@ -47390,7 +47424,7 @@ function DigestScheduler({
|
|
|
47390
47424
|
// src/SubscriptionsPanel.tsx
|
|
47391
47425
|
var import_react272 = require("react");
|
|
47392
47426
|
var import_react273 = require("@ai-matrx/records/react");
|
|
47393
|
-
var
|
|
47427
|
+
var import_records62 = require("@ai-matrx/records");
|
|
47394
47428
|
var import_design_system131 = require("@ai-matrx/design-system");
|
|
47395
47429
|
init_BuildOrAsk();
|
|
47396
47430
|
init_Refusal();
|
|
@@ -47760,7 +47794,7 @@ function SubscriptionsPanel({ tableId, activeRuleId, className }) {
|
|
|
47760
47794
|
"Last told you ",
|
|
47761
47795
|
new Date(subscription.last_sent_at).toLocaleString()
|
|
47762
47796
|
] }) : /* @__PURE__ */ (0, import_jsx_runtime151.jsx)("span", { children: "It has not told you anything yet." }),
|
|
47763
|
-
(0,
|
|
47797
|
+
(0, import_records62.hasQuietHours)(subscription.quiet_hours) ? /* @__PURE__ */ (0, import_jsx_runtime151.jsxs)("span", { children: [
|
|
47764
47798
|
"Not between ",
|
|
47765
47799
|
subscription.quiet_hours.start,
|
|
47766
47800
|
" and ",
|
|
@@ -47831,11 +47865,11 @@ var import_clipboard10 = require("@ai-matrx/kit/clipboard");
|
|
|
47831
47865
|
var import_design_system134 = require("@ai-matrx/design-system");
|
|
47832
47866
|
var import_controls10 = require("@ai-matrx/design-system/controls");
|
|
47833
47867
|
var import_react277 = require("react");
|
|
47834
|
-
var
|
|
47868
|
+
var import_core29 = require("@dnd-kit/core");
|
|
47835
47869
|
var import_sortable2 = require("@dnd-kit/sortable");
|
|
47836
47870
|
var import_utilities2 = require("@dnd-kit/utilities");
|
|
47837
47871
|
var import_react278 = require("@ai-matrx/records/react");
|
|
47838
|
-
var
|
|
47872
|
+
var import_records63 = require("@ai-matrx/records");
|
|
47839
47873
|
var import_design_system135 = require("@ai-matrx/design-system");
|
|
47840
47874
|
|
|
47841
47875
|
// src/FormFlowEditor.tsx
|
|
@@ -49177,7 +49211,7 @@ function FormBuilder({ tableId, seed, activeFormId, onActiveForm, startWithOne,
|
|
|
49177
49211
|
/* @__PURE__ */ (0, import_jsx_runtime154.jsx)(
|
|
49178
49212
|
PublishRow,
|
|
49179
49213
|
{
|
|
49180
|
-
url: `${publicOrigin}${(0,
|
|
49214
|
+
url: `${publicOrigin}${(0, import_records63.publicFormPath)(draft.id)}`,
|
|
49181
49215
|
state: draft.state,
|
|
49182
49216
|
mayPublish: rights.structure,
|
|
49183
49217
|
why: rights.why("structure"),
|
|
@@ -49189,7 +49223,7 @@ function FormBuilder({ tableId, seed, activeFormId, onActiveForm, startWithOne,
|
|
|
49189
49223
|
unsaved: dirty
|
|
49190
49224
|
}
|
|
49191
49225
|
),
|
|
49192
|
-
/* @__PURE__ */ (0, import_jsx_runtime154.jsx)(EmbedSnippets, { url: `${publicOrigin}${(0,
|
|
49226
|
+
/* @__PURE__ */ (0, import_jsx_runtime154.jsx)(EmbedSnippets, { url: `${publicOrigin}${(0, import_records63.publicFormPath)(draft.id)}`, label: draft.name }),
|
|
49193
49227
|
/* @__PURE__ */ (0, import_jsx_runtime154.jsx)(
|
|
49194
49228
|
NotifyOnAnswer,
|
|
49195
49229
|
{
|
|
@@ -49481,9 +49515,9 @@ function QuestionList({
|
|
|
49481
49515
|
onQuestions,
|
|
49482
49516
|
onQuestion
|
|
49483
49517
|
}) {
|
|
49484
|
-
const sensors = (0,
|
|
49485
|
-
(0,
|
|
49486
|
-
(0,
|
|
49518
|
+
const sensors = (0, import_core29.useSensors)(
|
|
49519
|
+
(0, import_core29.useSensor)(import_core29.PointerSensor, { activationConstraint: { distance: 4 } }),
|
|
49520
|
+
(0, import_core29.useSensor)(import_core29.KeyboardSensor, { coordinateGetter: import_sortable2.sortableKeyboardCoordinates })
|
|
49487
49521
|
);
|
|
49488
49522
|
const askable = askableFields([...fields]);
|
|
49489
49523
|
const unasked = askable.filter((f) => !draft.questions.some((q) => q.field === f.key));
|
|
@@ -49505,7 +49539,7 @@ function QuestionList({
|
|
|
49505
49539
|
/* @__PURE__ */ (0, import_jsx_runtime154.jsx)("span", { className: "font-medium text-foreground", children: "Questions" }),
|
|
49506
49540
|
/* @__PURE__ */ (0, import_jsx_runtime154.jsx)("span", { className: "tabular-nums", children: draft.questions.length })
|
|
49507
49541
|
] }),
|
|
49508
|
-
/* @__PURE__ */ (0, import_jsx_runtime154.jsx)(
|
|
49542
|
+
/* @__PURE__ */ (0, import_jsx_runtime154.jsx)(import_core29.DndContext, { sensors, collisionDetection: import_core29.closestCenter, onDragEnd: dragEnd, children: /* @__PURE__ */ (0, import_jsx_runtime154.jsx)(import_sortable2.SortableContext, { items: draft.questions.map((q) => q.field), strategy: import_sortable2.verticalListSortingStrategy, children: draft.questions.map((question, index) => /* @__PURE__ */ (0, import_jsx_runtime154.jsx)(
|
|
49509
49543
|
QuestionRow,
|
|
49510
49544
|
{
|
|
49511
49545
|
index,
|
|
@@ -50258,7 +50292,7 @@ function SignBlock({ tableId, recordId, render, className }) {
|
|
|
50258
50292
|
// src/NotifyRuleEditor.tsx
|
|
50259
50293
|
var import_react286 = require("react");
|
|
50260
50294
|
var import_react287 = require("@ai-matrx/records/react");
|
|
50261
|
-
var
|
|
50295
|
+
var import_records64 = require("@ai-matrx/records");
|
|
50262
50296
|
var import_design_system139 = require("@ai-matrx/design-system");
|
|
50263
50297
|
var import_controls11 = require("@ai-matrx/design-system/controls");
|
|
50264
50298
|
init_Refusal();
|
|
@@ -50416,7 +50450,7 @@ function NotifyRuleEditor({ tableId, seed, chosenRuleId, onChoose, className })
|
|
|
50416
50450
|
"next ",
|
|
50417
50451
|
new Date(held.next_digest_at).toLocaleString()
|
|
50418
50452
|
] }) : null,
|
|
50419
|
-
(0,
|
|
50453
|
+
(0, import_records64.hasQuietHours)(held.quiet_hours) ? /* @__PURE__ */ (0, import_jsx_runtime158.jsxs)("span", { className: "text-muted-foreground", children: [
|
|
50420
50454
|
"quiet ",
|
|
50421
50455
|
held.quiet_hours.start,
|
|
50422
50456
|
"\u2013",
|
|
@@ -50553,7 +50587,7 @@ init_Refusal();
|
|
|
50553
50587
|
init_host();
|
|
50554
50588
|
|
|
50555
50589
|
// src/DashboardGrid.tsx
|
|
50556
|
-
var
|
|
50590
|
+
var import_core30 = require("@dnd-kit/core");
|
|
50557
50591
|
var import_sortable3 = require("@dnd-kit/sortable");
|
|
50558
50592
|
var import_utilities3 = require("@dnd-kit/utilities");
|
|
50559
50593
|
var import_design_system140 = require("@ai-matrx/design-system");
|
|
@@ -50610,7 +50644,7 @@ function withBlockIds(blocks) {
|
|
|
50610
50644
|
// src/DashboardGrid.tsx
|
|
50611
50645
|
var import_jsx_runtime159 = require("react/jsx-runtime");
|
|
50612
50646
|
var dashboardCollision = (args) => {
|
|
50613
|
-
const under = (0,
|
|
50647
|
+
const under = (0, import_core30.pointerWithin)(args);
|
|
50614
50648
|
if (under.length > 0) return under;
|
|
50615
50649
|
const at = args.collisionRect;
|
|
50616
50650
|
return args.droppableContainers.flatMap((container) => {
|
|
@@ -50620,9 +50654,9 @@ var dashboardCollision = (args) => {
|
|
|
50620
50654
|
}).sort((a, b) => a.data.value - b.data.value);
|
|
50621
50655
|
};
|
|
50622
50656
|
function DashboardGrid({ items, arranging, onMove, onSpan }) {
|
|
50623
|
-
const sensors = (0,
|
|
50624
|
-
(0,
|
|
50625
|
-
(0,
|
|
50657
|
+
const sensors = (0, import_core30.useSensors)(
|
|
50658
|
+
(0, import_core30.useSensor)(import_core30.PointerSensor, { activationConstraint: { distance: 4 } }),
|
|
50659
|
+
(0, import_core30.useSensor)(import_core30.KeyboardSensor, { coordinateGetter: import_sortable3.sortableKeyboardCoordinates })
|
|
50626
50660
|
);
|
|
50627
50661
|
const ids = items.map((item) => item.id);
|
|
50628
50662
|
function dragEnd(event) {
|
|
@@ -50632,7 +50666,7 @@ function DashboardGrid({ items, arranging, onMove, onSpan }) {
|
|
|
50632
50666
|
}
|
|
50633
50667
|
const grid = /* @__PURE__ */ (0, import_jsx_runtime159.jsx)("div", { className: "grid grid-cols-1 gap-2 sm:grid-cols-12", children: items.map((item, index) => /* @__PURE__ */ (0, import_jsx_runtime159.jsx)(GridCell2, { item, index, arranging, onSpan }, item.id)) });
|
|
50634
50668
|
if (!arranging) return grid;
|
|
50635
|
-
return /* @__PURE__ */ (0, import_jsx_runtime159.jsx)(
|
|
50669
|
+
return /* @__PURE__ */ (0, import_jsx_runtime159.jsx)(import_core30.DndContext, { sensors, collisionDetection: dashboardCollision, onDragEnd: dragEnd, children: /* @__PURE__ */ (0, import_jsx_runtime159.jsx)(import_sortable3.SortableContext, { items: ids, strategy: import_sortable3.rectSortingStrategy, children: grid }) });
|
|
50636
50670
|
}
|
|
50637
50671
|
function GridCell2({
|
|
50638
50672
|
item,
|
|
@@ -50822,7 +50856,7 @@ function AddChart({ subject, onAdd, onClose }) {
|
|
|
50822
50856
|
var import_controls13 = require("@ai-matrx/design-system/controls");
|
|
50823
50857
|
|
|
50824
50858
|
// src/pages.ts
|
|
50825
|
-
var
|
|
50859
|
+
var import_records65 = require("@ai-matrx/records");
|
|
50826
50860
|
var PAGE_BLOCK_KINDS = [
|
|
50827
50861
|
"list",
|
|
50828
50862
|
"layout",
|
|
@@ -50916,10 +50950,10 @@ function filterTargets(filter, blocks) {
|
|
|
50916
50950
|
}
|
|
50917
50951
|
function combineFilter(base2, extra, fieldIdOf) {
|
|
50918
50952
|
const extraKeys = Object.keys(extra);
|
|
50919
|
-
if (!base2 || !(0,
|
|
50953
|
+
if (!base2 || !(0, import_records65.isRuleFilter)(base2) && Object.keys(base2).length === 0) {
|
|
50920
50954
|
return { filter: extraKeys.length > 0 ? { ...extra } : null, dropped: [] };
|
|
50921
50955
|
}
|
|
50922
|
-
if (!(0,
|
|
50956
|
+
if (!(0, import_records65.isRuleFilter)(base2)) return { filter: { ...base2, ...extra }, dropped: [] };
|
|
50923
50957
|
const dropped = [];
|
|
50924
50958
|
let rule = base2;
|
|
50925
50959
|
for (const key of extraKeys) {
|
|
@@ -52317,7 +52351,7 @@ function QuestionAnswerView({ tableId, spec, answer, fields, related = NO_RELATE
|
|
|
52317
52351
|
var import_react294 = require("react");
|
|
52318
52352
|
var import_format13 = require("@ai-matrx/kit/format");
|
|
52319
52353
|
var import_design_system144 = require("@ai-matrx/design-system");
|
|
52320
|
-
var
|
|
52354
|
+
var import_records66 = require("@ai-matrx/records");
|
|
52321
52355
|
var import_react295 = require("@ai-matrx/records/react");
|
|
52322
52356
|
init_recordVersions();
|
|
52323
52357
|
|
|
@@ -52565,7 +52599,7 @@ function TableAsk({ tableId, onOpenInQuestions, viewId }) {
|
|
|
52565
52599
|
await Promise.all(
|
|
52566
52600
|
all.filter(isChoiceField).map(async (field2) => {
|
|
52567
52601
|
const got = await (0, askOnce_exports.fieldOptionsOnce)(client, field2.id);
|
|
52568
|
-
if (got.ok) choices[field2.key] = (got.data ?? []).map((o) => (0,
|
|
52602
|
+
if (got.ok) choices[field2.key] = (got.data ?? []).map((o) => (0, import_records66.optionLabel)(o)).filter((w) => Boolean(w));
|
|
52569
52603
|
})
|
|
52570
52604
|
);
|
|
52571
52605
|
const read = questionFromWords(words2, all, choices);
|
|
@@ -52741,7 +52775,7 @@ init_host();
|
|
|
52741
52775
|
// src/PageCanvas.tsx
|
|
52742
52776
|
var import_react296 = require("react");
|
|
52743
52777
|
var import_react297 = require("@ai-matrx/records/react");
|
|
52744
|
-
var
|
|
52778
|
+
var import_core31 = require("@ai-matrx/records/core");
|
|
52745
52779
|
var import_download3 = require("@ai-matrx/kit/download");
|
|
52746
52780
|
var import_format14 = require("@ai-matrx/kit/format");
|
|
52747
52781
|
var import_design_system146 = require("@ai-matrx/design-system");
|
|
@@ -52883,7 +52917,7 @@ function useDoorRows(door, elementId, recordId) {
|
|
|
52883
52917
|
);
|
|
52884
52918
|
}
|
|
52885
52919
|
function downloadCsv(name, fields, rows) {
|
|
52886
|
-
(0, import_download3.downloadFile)(`${fileNameOf(name) || "export"}.csv`, (0,
|
|
52920
|
+
(0, import_download3.downloadFile)(`${fileNameOf(name) || "export"}.csv`, (0, import_core31.exportCsv)(fields, toRows(fields, rows)), "text/csv");
|
|
52887
52921
|
}
|
|
52888
52922
|
function CsvButton({ name, fields, rows }) {
|
|
52889
52923
|
if (rows.length === 0) return null;
|
|
@@ -53021,7 +53055,7 @@ function useMemberRows(block, viewerUserId, extra, mineOn, enabled) {
|
|
|
53021
53055
|
...q.sort.length > 0 ? { sort: q.sort } : {}
|
|
53022
53056
|
});
|
|
53023
53057
|
const reload = page.reload;
|
|
53024
|
-
(0, import_react296.useEffect)(() => (0,
|
|
53058
|
+
(0, import_react296.useEffect)(() => (0, import_core31.onRecordChanged)(() => reload()), [reload]);
|
|
53025
53059
|
return { q, page };
|
|
53026
53060
|
}
|
|
53027
53061
|
function BlockBody(inner2) {
|
|
@@ -53894,7 +53928,7 @@ function onePerKey3(all) {
|
|
|
53894
53928
|
}
|
|
53895
53929
|
|
|
53896
53930
|
// src/printPage.ts
|
|
53897
|
-
var
|
|
53931
|
+
var import_core32 = require("@ai-matrx/print/core");
|
|
53898
53932
|
var PAGE_PRINT_STYLES = `
|
|
53899
53933
|
.page-print-grid { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 12px; }
|
|
53900
53934
|
.page-print-grid > * { grid-column: span 12; break-inside: avoid; }
|
|
@@ -53905,7 +53939,7 @@ function printElement(element, title) {
|
|
|
53905
53939
|
const copy = element.cloneNode(true);
|
|
53906
53940
|
copy.querySelectorAll("button, input, select, textarea, iframe, [data-records-page-settings], [data-records-page-csv]").forEach((n) => n.remove());
|
|
53907
53941
|
copy.classList.add("page-print-grid");
|
|
53908
|
-
return (0,
|
|
53942
|
+
return (0, import_core32.openPrintWindow)((0, import_core32.buildPrintDocument)(`<h1>${escapeText(title)}</h1>${copy.innerHTML}`, title, PAGE_PRINT_STYLES), title);
|
|
53909
53943
|
}
|
|
53910
53944
|
function escapeText(text) {
|
|
53911
53945
|
return text.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">");
|
|
@@ -54455,7 +54489,7 @@ function InterfaceScreen({
|
|
|
54455
54489
|
var import_clipboard12 = require("@ai-matrx/kit/clipboard");
|
|
54456
54490
|
var import_react302 = require("react");
|
|
54457
54491
|
var import_react303 = require("@ai-matrx/records/react");
|
|
54458
|
-
var
|
|
54492
|
+
var import_records67 = require("@ai-matrx/records");
|
|
54459
54493
|
var import_design_system149 = require("@ai-matrx/design-system");
|
|
54460
54494
|
init_BuildOrAsk();
|
|
54461
54495
|
init_BuiltOnArchive();
|
|
@@ -54565,7 +54599,7 @@ function FormsPanel({ tableId, activeFormId, className }) {
|
|
|
54565
54599
|
}
|
|
54566
54600
|
) : null,
|
|
54567
54601
|
/* @__PURE__ */ (0, import_jsx_runtime168.jsx)("ul", { className: "flex flex-col gap-2", children: forms.map((form) => {
|
|
54568
|
-
const url = `${origin}${(0,
|
|
54602
|
+
const url = `${origin}${(0, import_records67.publicFormPath)(form.form_id)}`;
|
|
54569
54603
|
return /* @__PURE__ */ (0, import_jsx_runtime168.jsxs)(
|
|
54570
54604
|
"li",
|
|
54571
54605
|
{
|
|
@@ -54656,7 +54690,7 @@ init_plainWords();
|
|
|
54656
54690
|
|
|
54657
54691
|
// src/CaptureRun.tsx
|
|
54658
54692
|
var import_react304 = require("react");
|
|
54659
|
-
var
|
|
54693
|
+
var import_records68 = require("@ai-matrx/records");
|
|
54660
54694
|
var import_react305 = require("@ai-matrx/records/react");
|
|
54661
54695
|
var import_design_system150 = require("@ai-matrx/design-system");
|
|
54662
54696
|
init_host();
|
|
@@ -54714,7 +54748,7 @@ function CaptureRun({ sheetId, face: given, className }) {
|
|
|
54714
54748
|
const [sending, setSending] = (0, import_react304.useState)(false);
|
|
54715
54749
|
const queueRef = (0, import_react304.useRef)(null);
|
|
54716
54750
|
(0, import_react304.useEffect)(() => {
|
|
54717
|
-
const q2 = (0,
|
|
54751
|
+
const q2 = (0, import_records68.openCaptureQueue)({
|
|
54718
54752
|
onChange: (c, all) => {
|
|
54719
54753
|
setCounts(c);
|
|
54720
54754
|
setItems(all);
|
|
@@ -54981,7 +55015,7 @@ function CaptureRun({ sheetId, face: given, className }) {
|
|
|
54981
55015
|
value: String(answers2[q.field] ?? ""),
|
|
54982
55016
|
onChange: (e) => {
|
|
54983
55017
|
const raw = e.target.value;
|
|
54984
|
-
const answered2 = field2 ? (0,
|
|
55018
|
+
const answered2 = field2 ? (0, import_records68.coerceTypedAnswer)(field2, raw, { label: q.ask ?? (0, import_records68.coercionLabel)(field2) }) : { value: raw };
|
|
54985
55019
|
setAnswers((held) => ({
|
|
54986
55020
|
...held,
|
|
54987
55021
|
[q.field]: raw === "" ? "" : "refusal" in answered2 ? raw : answered2.value
|
|
@@ -55633,7 +55667,7 @@ init_WhereItLives();
|
|
|
55633
55667
|
// src/TablePage.tsx
|
|
55634
55668
|
var import_clipboard17 = require("@ai-matrx/kit/clipboard");
|
|
55635
55669
|
var import_react326 = require("react");
|
|
55636
|
-
var
|
|
55670
|
+
var import_records69 = require("@ai-matrx/records");
|
|
55637
55671
|
var import_react327 = require("@ai-matrx/records/react");
|
|
55638
55672
|
var import_design_system163 = require("@ai-matrx/design-system");
|
|
55639
55673
|
init_names();
|
|
@@ -55747,9 +55781,9 @@ function CalendarSubscribeDialog({
|
|
|
55747
55781
|
|
|
55748
55782
|
// src/viewShare.ts
|
|
55749
55783
|
var import_clipboard15 = require("@ai-matrx/kit/clipboard");
|
|
55750
|
-
var
|
|
55784
|
+
var import_core33 = require("@ai-matrx/print/core");
|
|
55751
55785
|
var import_markdown = require("@ai-matrx/print/markdown");
|
|
55752
|
-
var
|
|
55786
|
+
var import_core34 = require("@ai-matrx/records/core");
|
|
55753
55787
|
init_objectActions();
|
|
55754
55788
|
var NO_VIEW_REASON = "No saved view yet";
|
|
55755
55789
|
function viewLink(tableId, viewId, origin) {
|
|
@@ -55786,7 +55820,7 @@ async function downloadViewCsv(args) {
|
|
|
55786
55820
|
const columns = viewColumns(fields, view.presentation);
|
|
55787
55821
|
const rows = await rowsForFile({ client, host, fields: columns, records: read.rows, labels });
|
|
55788
55822
|
const name = fileNameOf(args.tableName) || "records";
|
|
55789
|
-
download(`${name}.csv`, "text/csv;charset=utf-8", (0,
|
|
55823
|
+
download(`${name}.csv`, "text/csv;charset=utf-8", (0, import_core34.exportCsv)(columns, rows));
|
|
55790
55824
|
host.notify?.success(read.cut ? cutWords(read.rows.length) : "CSV downloaded");
|
|
55791
55825
|
}
|
|
55792
55826
|
function downloadMarkdownAction(args) {
|
|
@@ -55815,7 +55849,7 @@ async function readViewMarkdown(args) {
|
|
|
55815
55849
|
if ("error" in read) return null;
|
|
55816
55850
|
const columns = viewColumns(fields, view.presentation);
|
|
55817
55851
|
const rows = await rowsForFile({ client, host, fields: columns, records: read.rows, labels });
|
|
55818
|
-
return { markdown: (0,
|
|
55852
|
+
return { markdown: (0, import_core34.exportMarkdown)(columns, rows), cut: read.cut, count: read.rows.length };
|
|
55819
55853
|
}
|
|
55820
55854
|
async function downloadViewMarkdown(args) {
|
|
55821
55855
|
const table = await readViewMarkdown(args);
|
|
@@ -55873,7 +55907,7 @@ async function runTablePageAction(kind2, args) {
|
|
|
55873
55907
|
}
|
|
55874
55908
|
const page = (0, import_markdown.renderMarkdownDocument)(markdown, { title, withPrintActions: kind2 === "html-preview" });
|
|
55875
55909
|
if (kind2 === "html-preview") {
|
|
55876
|
-
(0,
|
|
55910
|
+
(0, import_core33.openPrintWindow)(page, title);
|
|
55877
55911
|
if (note) args.host.notify?.success(note);
|
|
55878
55912
|
} else if (kind2 === "copy-html-page") {
|
|
55879
55913
|
if (await (0, import_clipboard15.copyText)(page)) args.host.notify?.success(note ?? "HTML page copied");
|
|
@@ -56886,7 +56920,7 @@ function TableNotHere({
|
|
|
56886
56920
|
return /* @__PURE__ */ (0, import_jsx_runtime182.jsxs)("div", { className: (0, import_design_system163.cn)("flex flex-col items-start gap-2 rounded-md border border-dashed p-6", className), children: [
|
|
56887
56921
|
/* @__PURE__ */ (0, import_jsx_runtime182.jsx)("p", { className: "text-sm font-medium", children: "This table is archived" }),
|
|
56888
56922
|
/* @__PURE__ */ (0, import_jsx_runtime182.jsx)("p", { className: "max-w-prose text-xs text-muted-foreground", children: TABLE_IS_ARCHIVED }),
|
|
56889
|
-
/* @__PURE__ */ (0, import_jsx_runtime182.jsx)("p", { className: "text-xs text-muted-foreground", children: (0,
|
|
56923
|
+
/* @__PURE__ */ (0, import_jsx_runtime182.jsx)("p", { className: "text-xs text-muted-foreground", children: (0, import_records69.archivedByLine)(row) }),
|
|
56890
56924
|
refusal3 ? /* @__PURE__ */ (0, import_jsx_runtime182.jsx)(RefusalNotice, { error: refusal3 }) : null,
|
|
56891
56925
|
/* @__PURE__ */ (0, import_jsx_runtime182.jsxs)("div", { className: "flex gap-2", children: [
|
|
56892
56926
|
/* @__PURE__ */ (0, import_jsx_runtime182.jsx)(
|
|
@@ -57977,7 +58011,7 @@ function TablePage({
|
|
|
57977
58011
|
// `min-w-9`: never narrower than the layout toolbar's folded "…" (36 px) — a row too
|
|
57978
58012
|
// narrow for its pinned controls folds them behind that "…" (design-system
|
|
57979
58013
|
// `usePinnedFold`), and the "…" itself is never cut (merged-grid leftovers, 2026-09-28).
|
|
57980
|
-
"flex min-w-9 flex-1 items-center overflow-x-auto [scrollbar-width:none] [&::-webkit-scrollbar]:hidden",
|
|
58014
|
+
"flex min-w-9 flex-1 items-center overflow-x-auto whitespace-nowrap [scrollbar-width:none] [&::-webkit-scrollbar]:hidden",
|
|
57981
58015
|
slotClipped === "end" && "[mask-image:linear-gradient(to_right,black_calc(100%_-_2rem),transparent)]",
|
|
57982
58016
|
slotClipped === "start" && "[mask-image:linear-gradient(to_left,black_calc(100%_-_2rem),transparent)]",
|
|
57983
58017
|
slotClipped === "both" && "[mask-image:linear-gradient(to_right,transparent,black_2rem,black_calc(100%_-_2rem),transparent)]",
|
|
@@ -58570,7 +58604,7 @@ init_objectActionIcons();
|
|
|
58570
58604
|
|
|
58571
58605
|
// src/DataBindingPicker.tsx
|
|
58572
58606
|
var import_react330 = require("react");
|
|
58573
|
-
var
|
|
58607
|
+
var import_records70 = require("@ai-matrx/records");
|
|
58574
58608
|
var import_react331 = require("@ai-matrx/records/react");
|
|
58575
58609
|
var import_design_system166 = require("@ai-matrx/design-system");
|
|
58576
58610
|
init_names();
|
|
@@ -58605,7 +58639,7 @@ function isCompleteDataBinding(binding) {
|
|
|
58605
58639
|
}
|
|
58606
58640
|
function bindingPlaceholdersFor(field2) {
|
|
58607
58641
|
const label = fieldName(field2);
|
|
58608
|
-
if ((0,
|
|
58642
|
+
if ((0, import_records70.isEntityReferenceConfig)(field2.config)) {
|
|
58609
58643
|
return [
|
|
58610
58644
|
{ token: `{${field2.key}.name}`, label: `${label} \xB7 name` },
|
|
58611
58645
|
{ token: `{${field2.key}.id}`, label: `${label} \xB7 id` }
|