@ai-matrx/records-ui 0.115.102 → 0.115.103
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 +3 -3
- 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 +418 -418
- 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 +6 -6
- 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 +204 -204
- package/dist/pickers.cjs.map +1 -1
- package/dist/pickers.js +6 -6
- package/dist/pickers.js.map +1 -1
- package/package.json +2 -2
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",
|
|
@@ -12617,7 +12617,7 @@ init_enumLabels();
|
|
|
12617
12617
|
|
|
12618
12618
|
// src/EntityReferenceControl.tsx
|
|
12619
12619
|
var import_react36 = require("react");
|
|
12620
|
-
var
|
|
12620
|
+
var import_records11 = require("@ai-matrx/records");
|
|
12621
12621
|
var import_react37 = require("@ai-matrx/records/react");
|
|
12622
12622
|
var import_design_system18 = require("@ai-matrx/design-system");
|
|
12623
12623
|
init_PickOrAdd();
|
|
@@ -12627,7 +12627,7 @@ var import_jsx_runtime21 = require("react/jsx-runtime");
|
|
|
12627
12627
|
var WITHHELD_ENTITY_LABEL = "Something you have not been given access to";
|
|
12628
12628
|
var ENTITY_REFERENCE_EMPTY = "Nothing is pointed at yet.";
|
|
12629
12629
|
function entityReferenceText(value) {
|
|
12630
|
-
const refs = (0,
|
|
12630
|
+
const refs = (0, import_records11.entityRefsOf)(value);
|
|
12631
12631
|
if (refs.length === 0) return "\u2014";
|
|
12632
12632
|
return refs.map((r) => r.label ?? WITHHELD_ENTITY_LABEL).join(", ");
|
|
12633
12633
|
}
|
|
@@ -12641,7 +12641,7 @@ function EntityReferenceControl(props) {
|
|
|
12641
12641
|
return client ? /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(WithWords, { ...props }) : /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(Chips, { ...props, words: null, picker: null });
|
|
12642
12642
|
}
|
|
12643
12643
|
function WithWords(props) {
|
|
12644
|
-
const refs = (0, import_react36.useMemo)(() => (0,
|
|
12644
|
+
const refs = (0, import_react36.useMemo)(() => (0, import_records11.entityRefsOf)(props.value), [props.value]);
|
|
12645
12645
|
const [known, setKnown] = (0, import_react36.useState)([]);
|
|
12646
12646
|
const withKnown = refs.map((r) => r.label === null ? known.find((k) => k.token === r.token && k.id === r.id) ?? r : r);
|
|
12647
12647
|
const unlabelled = (0, import_react36.useMemo)(
|
|
@@ -12659,7 +12659,7 @@ function WithWords(props) {
|
|
|
12659
12659
|
setKnown((k) => [...k.filter((x) => !(x.token === picked.token && x.id === picked.id)), picked]);
|
|
12660
12660
|
const multi = Boolean(props.field.multi);
|
|
12661
12661
|
const next = multi ? [...withKnown.filter((x) => !(x.token === picked.token && x.id === picked.id)), picked] : [picked];
|
|
12662
|
-
props.onChange((0,
|
|
12662
|
+
props.onChange((0, import_records11.entityRefsToWrite)(next, multi));
|
|
12663
12663
|
}
|
|
12664
12664
|
}
|
|
12665
12665
|
);
|
|
@@ -12748,7 +12748,7 @@ function Chips({
|
|
|
12748
12748
|
words: words2,
|
|
12749
12749
|
picker
|
|
12750
12750
|
}) {
|
|
12751
|
-
const refs = (0, import_react36.useMemo)(() => (0,
|
|
12751
|
+
const refs = (0, import_react36.useMemo)(() => (0, import_records11.entityRefsOf)(value), [value]);
|
|
12752
12752
|
const labelOf = (token2, refId, own3) => {
|
|
12753
12753
|
if (own3) return own3;
|
|
12754
12754
|
const read = words2?.data?.find((w) => w.token === token2 && w.id === refId)?.label;
|
|
@@ -12772,7 +12772,7 @@ function Chips({
|
|
|
12772
12772
|
"aria-label": `Take ${label} off`,
|
|
12773
12773
|
onClick: () => {
|
|
12774
12774
|
const rest = refs.filter((x) => !(x.token === r.token && x.id === r.id));
|
|
12775
|
-
onChange((0,
|
|
12775
|
+
onChange((0, import_records11.entityRefsToWrite)(rest, multi));
|
|
12776
12776
|
},
|
|
12777
12777
|
children: "\xD7"
|
|
12778
12778
|
}
|
|
@@ -12784,11 +12784,11 @@ function Chips({
|
|
|
12784
12784
|
}
|
|
12785
12785
|
|
|
12786
12786
|
// src/values.tsx
|
|
12787
|
-
var
|
|
12787
|
+
var import_core16 = require("@ai-matrx/records/core");
|
|
12788
12788
|
|
|
12789
12789
|
// src/WholeValue.tsx
|
|
12790
12790
|
var import_react38 = require("react");
|
|
12791
|
-
var
|
|
12791
|
+
var import_core11 = require("@ai-matrx/records/core");
|
|
12792
12792
|
var import_design_system19 = require("@ai-matrx/design-system");
|
|
12793
12793
|
init_host();
|
|
12794
12794
|
init_names();
|
|
@@ -12796,7 +12796,7 @@ var import_outbound_react2 = require("@ai-matrx/kit/outbound-react");
|
|
|
12796
12796
|
var import_jsx_runtime22 = require("react/jsx-runtime");
|
|
12797
12797
|
var WHOLE_VALUE_UNBOUND = "The whole text is kept as a file, and this screen has no way to open files yet.";
|
|
12798
12798
|
function wholeValueLine(pointer) {
|
|
12799
|
-
return `Open the whole text (${(0,
|
|
12799
|
+
return `Open the whole text (${(0, import_core11.wholeValueSize)(pointer)})`;
|
|
12800
12800
|
}
|
|
12801
12801
|
function WholeValueCell({ words: words2, pointer }) {
|
|
12802
12802
|
const host = useRecordsUi();
|
|
@@ -12807,12 +12807,12 @@ function WholeValueCell({ words: words2, pointer }) {
|
|
|
12807
12807
|
words2,
|
|
12808
12808
|
"\u2026"
|
|
12809
12809
|
] }),
|
|
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,
|
|
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, import_core11.wholeValueSize)(pointer)} in a file` })
|
|
12811
12811
|
] });
|
|
12812
12812
|
}
|
|
12813
12813
|
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
12814
|
function wholeValueOpening(pointer) {
|
|
12815
|
-
return `Opening the whole text (${(0,
|
|
12815
|
+
return `Opening the whole text (${(0, import_core11.wholeValueSize)(pointer)})\u2026`;
|
|
12816
12816
|
}
|
|
12817
12817
|
function useWholeText(pointer) {
|
|
12818
12818
|
const host = useRecordsUi();
|
|
@@ -13416,7 +13416,7 @@ function AttachmentControl({
|
|
|
13416
13416
|
}
|
|
13417
13417
|
|
|
13418
13418
|
// src/ReferenceChips.tsx
|
|
13419
|
-
var
|
|
13419
|
+
var import_records12 = require("@ai-matrx/records");
|
|
13420
13420
|
var import_design_system24 = require("@ai-matrx/design-system");
|
|
13421
13421
|
init_host();
|
|
13422
13422
|
init_kindValues();
|
|
@@ -13437,7 +13437,7 @@ function iconOf(pair) {
|
|
|
13437
13437
|
}
|
|
13438
13438
|
function referencesOf(field2, value, kind2, labels) {
|
|
13439
13439
|
if (kind2 === "entity_reference") {
|
|
13440
|
-
return (0,
|
|
13440
|
+
return (0, import_records12.entityRefsOf)(value).map((r) => ({ token: r.token, id: r.id, label: r.label }));
|
|
13441
13441
|
}
|
|
13442
13442
|
const ids = (Array.isArray(value) ? value : [value]).filter(isId).map(String);
|
|
13443
13443
|
const tableId = typeof field2.relation_target === "string" ? field2.relation_target : void 0;
|
|
@@ -13625,7 +13625,7 @@ function ClampedChips({
|
|
|
13625
13625
|
init_kindValues();
|
|
13626
13626
|
|
|
13627
13627
|
// src/formulaNames.ts
|
|
13628
|
-
var
|
|
13628
|
+
var import_records13 = require("@ai-matrx/records");
|
|
13629
13629
|
init_names();
|
|
13630
13630
|
function fieldRefsOf(expr) {
|
|
13631
13631
|
const out = [];
|
|
@@ -13734,7 +13734,7 @@ function formulaSourceArchived(field2, document2) {
|
|
|
13734
13734
|
const keys = (field2.config ?? {})[FORMULA_INPUT_KEYS];
|
|
13735
13735
|
if (!Array.isArray(keys) || !document2) return null;
|
|
13736
13736
|
for (const key of keys) {
|
|
13737
|
-
const state2 = (0,
|
|
13737
|
+
const state2 = (0, import_records13.sourceArchivedOf)(document2[String(key)]);
|
|
13738
13738
|
if (state2) return state2;
|
|
13739
13739
|
}
|
|
13740
13740
|
return null;
|
|
@@ -13755,7 +13755,7 @@ function withFormulaDisplayNow(field2, fields, kindOf, currencyCodeOf) {
|
|
|
13755
13755
|
}
|
|
13756
13756
|
|
|
13757
13757
|
// src/values.tsx
|
|
13758
|
-
var
|
|
13758
|
+
var import_records24 = require("@ai-matrx/records");
|
|
13759
13759
|
var import_uuid7 = require("@ai-matrx/kit/uuid");
|
|
13760
13760
|
|
|
13761
13761
|
// src/personNames.ts
|
|
@@ -13814,7 +13814,7 @@ function usePeopleTick() {
|
|
|
13814
13814
|
}
|
|
13815
13815
|
|
|
13816
13816
|
// src/cellMarks.tsx
|
|
13817
|
-
var
|
|
13817
|
+
var import_records14 = require("@ai-matrx/records");
|
|
13818
13818
|
|
|
13819
13819
|
// src/RetiredValues.tsx
|
|
13820
13820
|
var import_react46 = require("react");
|
|
@@ -13942,7 +13942,7 @@ function bound(value) {
|
|
|
13942
13942
|
function keptAsideReason(field2, entry) {
|
|
13943
13943
|
const rules = field2.rules ?? [];
|
|
13944
13944
|
const numeric = typeof entry.value === "string" && /^-?\d+(\.\d+)?$/.test(entry.value.trim()) ? Number(entry.value) : entry.value;
|
|
13945
|
-
const rule = (0,
|
|
13945
|
+
const rule = (0, import_records14.ruleThatRefuses)(rules, numeric);
|
|
13946
13946
|
let why = null;
|
|
13947
13947
|
if (rule?.kind === "min") why = `Must be at least ${bound(rule.value)}`;
|
|
13948
13948
|
else if (rule?.kind === "max") why = `Must be at most ${bound(rule.value)}`;
|
|
@@ -14408,7 +14408,7 @@ function structuredNode(field2, structured, room) {
|
|
|
14408
14408
|
return room === "cell" ? /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(StructuredCell, { structured, label }) : /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(StructuredValueView, { structured, label });
|
|
14409
14409
|
}
|
|
14410
14410
|
function renderValue(field2, value, document2, labels, stillWaitingFor, look, room = "cell") {
|
|
14411
|
-
const archivedSource = (0,
|
|
14411
|
+
const archivedSource = (0, import_records24.sourceArchivedOf)(value);
|
|
14412
14412
|
if (archivedSource) return /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(SourceArchivedValue, { state: archivedSource });
|
|
14413
14413
|
const envelope = envelopeFor(document2, field2.key);
|
|
14414
14414
|
if (envelope?.absent) {
|
|
@@ -14431,10 +14431,10 @@ function renderValue(field2, value, document2, labels, stillWaitingFor, look, ro
|
|
|
14431
14431
|
return /* @__PURE__ */ (0, import_jsx_runtime44.jsx)("span", { className: "text-muted-foreground", children: "\u2014" });
|
|
14432
14432
|
}
|
|
14433
14433
|
if (isSignatureField(field2)) return /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(SignatureValue, { value, fieldKey: field2.key, document: document2 });
|
|
14434
|
-
if ((0,
|
|
14434
|
+
if ((0, import_records24.isButtonField)(field2)) return /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(ButtonValue, { field: field2 });
|
|
14435
14435
|
const newer = newerKindValue(field2, value);
|
|
14436
14436
|
if (newer !== void 0) return newer;
|
|
14437
|
-
const whole = typeof value === "string" ? (0,
|
|
14437
|
+
const whole = typeof value === "string" ? (0, import_core16.wholeValueOf)(document2, field2.key) : null;
|
|
14438
14438
|
if (whole) return /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(WholeValueCell, { words: value, pointer: whole });
|
|
14439
14439
|
const kind2 = editorKindFor(field2);
|
|
14440
14440
|
if (kind2 === "relation" || kind2 === "entity_reference") {
|
|
@@ -14569,10 +14569,10 @@ function personWordsOf(kind2, value) {
|
|
|
14569
14569
|
}
|
|
14570
14570
|
function scalarText(field2, value, labels, stillWaitingFor) {
|
|
14571
14571
|
if (value === null || value === void 0) return "\u2014";
|
|
14572
|
-
if ((0,
|
|
14572
|
+
if ((0, import_records24.sourceArchivedOf)(value)) return SOURCE_ARCHIVED_WORDS;
|
|
14573
14573
|
if (isSignatureField(field2)) return signatureWords(value) ?? "\u2014";
|
|
14574
|
-
if ((0,
|
|
14575
|
-
const newerWords = (0,
|
|
14574
|
+
if ((0, import_records24.autonumberPrefixOf)(field2)) return (0, import_records24.autonumberWords)(field2, value) ?? String(value);
|
|
14575
|
+
const newerWords = (0, import_records24.newerKindWords)(field2, value);
|
|
14576
14576
|
if (newerWords !== null) return newerWords;
|
|
14577
14577
|
const kind2 = editorKindFor(field2);
|
|
14578
14578
|
if (kind2 === "entity_reference") return entityReferenceText(value);
|
|
@@ -14612,7 +14612,7 @@ function scalarText(field2, value, labels, stillWaitingFor) {
|
|
|
14612
14612
|
function ProvenanceBadge({ document: document2, fieldKey }) {
|
|
14613
14613
|
const envelope = envelopeFor(document2, fieldKey);
|
|
14614
14614
|
if (!envelope?.src) return null;
|
|
14615
|
-
if ((0,
|
|
14615
|
+
if ((0, import_core16.wholeValueOf)(document2, fieldKey)) return null;
|
|
14616
14616
|
const sources = document2?._sources;
|
|
14617
14617
|
const source = sources?.[envelope.src];
|
|
14618
14618
|
const label = source ? Object.values(source).map(String).join(" \xB7 ") : envelope.src;
|
|
@@ -14633,7 +14633,7 @@ function RecordValue({
|
|
|
14633
14633
|
const labels = useRecordLabels(ONE_FIELD_ARRAY_CACHE(field2));
|
|
14634
14634
|
const stillWaitingFor = useLabelWait(field2);
|
|
14635
14635
|
const embeddedLook = useEmbeddedLook();
|
|
14636
|
-
if ((0,
|
|
14636
|
+
if ((0, import_records24.isButtonField)(field2)) return /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(ButtonValue, { field: field2, recordId, inCell });
|
|
14637
14637
|
if (withheld && (value === null || value === void 0)) return /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(WithheldValue, { field: field2, notice: withheld });
|
|
14638
14638
|
if (value === null || value === void 0) {
|
|
14639
14639
|
const failed = workedOutErrorFor(document2, field2.key);
|
|
@@ -14643,7 +14643,7 @@ function RecordValue({
|
|
|
14643
14643
|
const kept = keptAsideFor(document2, field2.key);
|
|
14644
14644
|
if (kept) return /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(KeptAsideValue, { field: field2, entry: kept, shown: scalarText(field2, kept.value) });
|
|
14645
14645
|
}
|
|
14646
|
-
const archivedSource = (0,
|
|
14646
|
+
const archivedSource = (0, import_records24.sourceArchivedOf)(value);
|
|
14647
14647
|
if (archivedSource) return /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(SourceArchivedValue, { state: archivedSource });
|
|
14648
14648
|
if (formulaHasNothingToWorkOn(field2, document2)) return embeddedLook?.blankEmpty ? null : /* @__PURE__ */ (0, import_jsx_runtime44.jsx)("span", { className: "text-muted-foreground", children: "\u2014" });
|
|
14649
14649
|
if (value !== null && value !== void 0 && value !== "" && !envelopeFor(document2, field2.key)?.absent) {
|
|
@@ -14651,11 +14651,11 @@ function RecordValue({
|
|
|
14651
14651
|
if (newer !== void 0) return /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(import_jsx_runtime44.Fragment, { children: newer });
|
|
14652
14652
|
}
|
|
14653
14653
|
const room = inCell && !roomy ? "cell" : "full";
|
|
14654
|
-
if (value !== null && value !== void 0 && !(0,
|
|
14654
|
+
if (value !== null && value !== void 0 && !(0, import_core16.wholeValueOf)(document2, field2.key) && !envelopeFor(document2, field2.key)?.absent) {
|
|
14655
14655
|
const structured = structuredValueOf(field2, value);
|
|
14656
14656
|
if (structured) return /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(import_jsx_runtime44.Fragment, { children: structuredNode(field2, structured, room) });
|
|
14657
14657
|
}
|
|
14658
|
-
if (inCell && ui.grid === "merged" && ui.renderText && typeof value === "string" && value.trim() !== "" && editorKindFor(field2) === "long_text" && !shownAsOf(field2) && !(0,
|
|
14658
|
+
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
14659
|
!kindValueOf(value)) {
|
|
14660
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") });
|
|
14661
14661
|
}
|
|
@@ -14677,7 +14677,7 @@ function RecordValue({
|
|
|
14677
14677
|
}
|
|
14678
14678
|
}
|
|
14679
14679
|
}
|
|
14680
|
-
const pictureAt = value !== null && value !== void 0 && !(0,
|
|
14680
|
+
const pictureAt = value !== null && value !== void 0 && !(0, import_core16.wholeValueOf)(document2, field2.key) && !envelopeFor(document2, field2.key)?.absent ? imageAddressOf(field2, value) : null;
|
|
14681
14681
|
if (pictureAt) return /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(ImageUrlValue, { url: pictureAt, alt: field2.label || field2.key, room });
|
|
14682
14682
|
const shown5 = format ?? formatForField(field2);
|
|
14683
14683
|
const shape = shown5 && (shown5.id === "date" || shown5.id === "datetime") && isDateField(field2) ? dateFormatFor(field2, value) : void 0;
|
|
@@ -14760,7 +14760,7 @@ function SourceArchivedNotice({ fieldId, tableId }) {
|
|
|
14760
14760
|
// src/Condition.tsx
|
|
14761
14761
|
var import_react71 = require("react");
|
|
14762
14762
|
var import_design_system42 = require("@ai-matrx/design-system");
|
|
14763
|
-
var
|
|
14763
|
+
var import_records25 = require("@ai-matrx/records");
|
|
14764
14764
|
init_PickOrAdd();
|
|
14765
14765
|
init_choiceLooks();
|
|
14766
14766
|
var import_react72 = require("@ai-matrx/records/react");
|
|
@@ -14864,7 +14864,7 @@ function ChoiceValue({ field: field2, value, onChange }) {
|
|
|
14864
14864
|
void (0, askOnce_exports.fieldOptionsOnce)(client, field2.id).then((got) => {
|
|
14865
14865
|
if (cancelled) return;
|
|
14866
14866
|
setChoices(
|
|
14867
|
-
got.ok ? (got.data ?? []).map((o) => ({ key: (0,
|
|
14867
|
+
got.ok ? (got.data ?? []).map((o) => ({ key: (0, import_records25.optionKey)(o), label: (0, import_records25.optionLabel)(o) ?? "" })).filter((c) => c.label !== "") : []
|
|
14868
14868
|
);
|
|
14869
14869
|
});
|
|
14870
14870
|
return () => {
|
|
@@ -14882,7 +14882,7 @@ function ChoiceValue({ field: field2, value, onChange }) {
|
|
|
14882
14882
|
}
|
|
14883
14883
|
);
|
|
14884
14884
|
}
|
|
14885
|
-
const shown5 = (0,
|
|
14885
|
+
const shown5 = (0, import_records25.rankTypedMatches)(choices, search.trim(), (c) => c.label);
|
|
14886
14886
|
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
14887
|
PickOrAdd,
|
|
14888
14888
|
{
|
|
@@ -15316,7 +15316,7 @@ function ConditionGroup({
|
|
|
15316
15316
|
|
|
15317
15317
|
// src/FieldRulePreview.tsx
|
|
15318
15318
|
var import_react73 = require("react");
|
|
15319
|
-
var
|
|
15319
|
+
var import_records26 = require("@ai-matrx/records");
|
|
15320
15320
|
var import_react74 = require("@ai-matrx/records/react");
|
|
15321
15321
|
init_Refusal();
|
|
15322
15322
|
init_names();
|
|
@@ -15357,7 +15357,7 @@ function FieldRulePreview({ field: field2, tableId, rules }) {
|
|
|
15357
15357
|
}
|
|
15358
15358
|
const numbers = holdsNumbers3(field2);
|
|
15359
15359
|
const groups = answer.data.map((row) => ({ value: groupValue(row.groups[field2.key] ?? null, numbers), count: row.row_count }));
|
|
15360
|
-
setPreview((0,
|
|
15360
|
+
setPreview((0, import_records26.previewRuleChange)(latest.current, groups, answer.data.length >= PREVIEW_GROUPS2));
|
|
15361
15361
|
});
|
|
15362
15362
|
}, 300);
|
|
15363
15363
|
return () => {
|
|
@@ -15471,7 +15471,7 @@ function choiceLookForNewList(multi, rows) {
|
|
|
15471
15471
|
}
|
|
15472
15472
|
|
|
15473
15473
|
// src/NewerKindQuestions.tsx
|
|
15474
|
-
var
|
|
15474
|
+
var import_records27 = require("@ai-matrx/records");
|
|
15475
15475
|
var import_design_system43 = require("@ai-matrx/design-system");
|
|
15476
15476
|
var import_jsx_runtime48 = require("react/jsx-runtime");
|
|
15477
15477
|
var STATUS_STARTING_CHOICES = [
|
|
@@ -15492,7 +15492,7 @@ function statusGroupRows(field2, rows, keyOfId, changed2) {
|
|
|
15492
15492
|
if (words2 === "") continue;
|
|
15493
15493
|
const ref = r.id ?? words2;
|
|
15494
15494
|
const key = r.id ? keyOfId[r.id] : void 0;
|
|
15495
|
-
const held = field2 && key ? (0,
|
|
15495
|
+
const held = field2 && key ? (0, import_records27.statusGroupOf)(field2, key) : void 0;
|
|
15496
15496
|
out.push({ ref, words: words2, group: changed2[ref] ?? held ?? guessStatusGroup(words2) });
|
|
15497
15497
|
}
|
|
15498
15498
|
return out;
|
|
@@ -15508,10 +15508,10 @@ function StatusGroupsQuestion({
|
|
|
15508
15508
|
/* @__PURE__ */ (0, import_jsx_runtime48.jsx)("span", { className: "min-w-0 flex-1 truncate text-sm", children: r.words }),
|
|
15509
15509
|
/* @__PURE__ */ (0, import_jsx_runtime48.jsxs)(import_design_system43.Select, { value: r.group, onValueChange: (next) => onGroup(r.ref, next), children: [
|
|
15510
15510
|
/* @__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:
|
|
15511
|
+
/* @__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
15512
|
STATUS_GROUP_MARK[g],
|
|
15513
15513
|
" ",
|
|
15514
|
-
|
|
15514
|
+
import_records27.STATUS_GROUP_WORDS[g]
|
|
15515
15515
|
] }, g)) })
|
|
15516
15516
|
] })
|
|
15517
15517
|
] }, r.ref))
|
|
@@ -15549,7 +15549,7 @@ function BarcodeSymbologyQuestion({ value, onChange }) {
|
|
|
15549
15549
|
/* @__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
15550
|
/* @__PURE__ */ (0, import_jsx_runtime48.jsxs)(import_design_system43.SelectContent, { children: [
|
|
15551
15551
|
/* @__PURE__ */ (0, import_jsx_runtime48.jsx)(import_design_system43.SelectItem, { value: "any", children: "Any code" }),
|
|
15552
|
-
|
|
15552
|
+
import_records27.BARCODE_SYMBOLOGIES.map((s) => /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(import_design_system43.SelectItem, { value: s, children: SYMBOLOGY_WORDS[s] }, s))
|
|
15553
15553
|
] })
|
|
15554
15554
|
] })
|
|
15555
15555
|
] });
|
|
@@ -15883,21 +15883,21 @@ function readersSentence(count, tableName2) {
|
|
|
15883
15883
|
|
|
15884
15884
|
// src/FieldEditor.tsx
|
|
15885
15885
|
init_enumLabels();
|
|
15886
|
-
var
|
|
15886
|
+
var import_records30 = require("@ai-matrx/records");
|
|
15887
15887
|
|
|
15888
15888
|
// src/ButtonSettings.tsx
|
|
15889
15889
|
var import_react75 = require("react");
|
|
15890
15890
|
var import_design_system46 = require("@ai-matrx/design-system");
|
|
15891
15891
|
var import_data_table6 = require("@ai-matrx/design-system/data-table");
|
|
15892
|
-
var
|
|
15892
|
+
var import_records29 = require("@ai-matrx/records");
|
|
15893
15893
|
var import_react76 = require("@ai-matrx/records/react");
|
|
15894
15894
|
|
|
15895
15895
|
// src/AccentSwatches.tsx
|
|
15896
|
-
var
|
|
15896
|
+
var import_records28 = require("@ai-matrx/records");
|
|
15897
15897
|
var import_design_system45 = require("@ai-matrx/design-system");
|
|
15898
15898
|
var import_data_table5 = require("@ai-matrx/design-system/data-table");
|
|
15899
15899
|
var import_jsx_runtime50 = require("react/jsx-runtime");
|
|
15900
|
-
function AccentSwatches({ value, onChange, options =
|
|
15900
|
+
function AccentSwatches({ value, onChange, options = import_records28.PORTAL_ACCENTS, noneLabel = "App colour" }) {
|
|
15901
15901
|
return /* @__PURE__ */ (0, import_jsx_runtime50.jsxs)("div", { className: "flex flex-wrap gap-1.5", role: "radiogroup", "aria-label": "Colour", children: [
|
|
15902
15902
|
/* @__PURE__ */ (0, import_jsx_runtime50.jsx)(
|
|
15903
15903
|
"button",
|
|
@@ -15943,7 +15943,7 @@ var DOES_WORDS = {
|
|
|
15943
15943
|
};
|
|
15944
15944
|
function buttonUrlInWords(url, fields) {
|
|
15945
15945
|
let out = url;
|
|
15946
|
-
for (const id of (0,
|
|
15946
|
+
for (const id of (0, import_records29.buttonUrlPlaceholders)(url)) {
|
|
15947
15947
|
const f = fields.find((x) => x.id === id || x.key === id);
|
|
15948
15948
|
if (f) out = out.split(`{{${id}}}`).join(`{${fieldName(f)}}`);
|
|
15949
15949
|
}
|
|
@@ -16038,7 +16038,7 @@ function ButtonSettingsEditor({
|
|
|
16038
16038
|
}
|
|
16039
16039
|
) : null
|
|
16040
16040
|
] }),
|
|
16041
|
-
value.url && (0,
|
|
16041
|
+
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
16042
|
] }) : null,
|
|
16043
16043
|
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
16044
|
actions === null || actions.length > 0 ? /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(
|
|
@@ -16144,11 +16144,11 @@ function NewRowAction({
|
|
|
16144
16144
|
}
|
|
16145
16145
|
|
|
16146
16146
|
// src/FieldEditor.tsx
|
|
16147
|
-
var
|
|
16147
|
+
var import_records31 = require("@ai-matrx/records");
|
|
16148
16148
|
var import_jsx_runtime52 = require("react/jsx-runtime");
|
|
16149
16149
|
var RULE_KINDS = FIELD_RULE_KIND_VALUES.map((kind2) => ({ kind: kind2, label: FIELD_RULE_KIND_LABEL[kind2] }));
|
|
16150
|
-
var SENSITIVITIES =
|
|
16151
|
-
var AGENT_VISIBILITY =
|
|
16150
|
+
var SENSITIVITIES = import_records31.FIELD_SENSITIVITIES.map((value) => ({ value, label: FIELD_SENSITIVITY_LABEL[value] }));
|
|
16151
|
+
var AGENT_VISIBILITY = import_records31.CONTEXT_POLICIES.map((value) => ({ value, label: CONTEXT_POLICY_LABEL[value] }));
|
|
16152
16152
|
var ROLLUP_OPERATIONS = ROLLUP_AGG_VALUES.map((value) => ({
|
|
16153
16153
|
value,
|
|
16154
16154
|
label: ROLLUP_AGG_LABEL[value]
|
|
@@ -16161,7 +16161,7 @@ var FORMULA_OPERATIONS = FORMULA_OP_VALUES.map((value) => ({
|
|
|
16161
16161
|
label: FORMULA_OP_LABEL[value],
|
|
16162
16162
|
joins: FORMULA_OP_JOINS[value]
|
|
16163
16163
|
}));
|
|
16164
|
-
var STORE_BEHAVIOUR = new Map(
|
|
16164
|
+
var STORE_BEHAVIOUR = new Map(import_records31.DECLARABLE_FIELD_KINDS.map((row) => [row.kind, row.behavior]));
|
|
16165
16165
|
function holdsAValueOnAStandardTable(kind2) {
|
|
16166
16166
|
if (isSystemFieldKind(kind2)) return false;
|
|
16167
16167
|
const behaviour = STORE_BEHAVIOUR.get(kind2);
|
|
@@ -16272,20 +16272,20 @@ function FieldEditor(props) {
|
|
|
16272
16272
|
const [contextPolicy, setContextPolicy] = (0, import_react77.useState)(String(start?.context_policy ?? "include"));
|
|
16273
16273
|
const [rules, setRules] = (0, import_react77.useState)(start?.rules ?? []);
|
|
16274
16274
|
const [startsWith, setStartsWith] = (0, import_react77.useState)(start?.default ?? null);
|
|
16275
|
-
const [ratingMax, setRatingMax] = (0, import_react77.useState)(() => start ? (0,
|
|
16275
|
+
const [ratingMax, setRatingMax] = (0, import_react77.useState)(() => start ? (0, import_records31.ratingMaxOf)(start) : 5);
|
|
16276
16276
|
const savedRules = (0, import_react77.useMemo)(
|
|
16277
|
-
() => field2 ? type === "rating" ? (0,
|
|
16277
|
+
() => field2 ? type === "rating" ? (0, import_records31.rulesWithTopStar)(field2.rules ?? [], (0, import_records31.ratingMaxOf)(field2)) : field2.rules ?? [] : [],
|
|
16278
16278
|
[field2, type]
|
|
16279
16279
|
);
|
|
16280
|
-
const editedRules = (0, import_react77.useMemo)(() => type === "rating" ? (0,
|
|
16280
|
+
const editedRules = (0, import_react77.useMemo)(() => type === "rating" ? (0, import_records31.rulesWithTopStar)(rules, ratingMax) : rules, [type, rules, ratingMax]);
|
|
16281
16281
|
const [statusGroups, setStatusGroups] = (0, import_react77.useState)({});
|
|
16282
16282
|
const [statusKeys, setStatusKeys] = (0, import_react77.useState)({});
|
|
16283
16283
|
const [symbology, setSymbology] = (0, import_react77.useState)(String(start?.config?.["symbology"] ?? ""));
|
|
16284
16284
|
const descriptionStart = String(start?.config?.["description"] ?? "");
|
|
16285
16285
|
const [description, setDescription] = (0, import_react77.useState)(descriptionStart);
|
|
16286
|
-
const buttonStart = (0, import_react77.useMemo)(() => (0,
|
|
16286
|
+
const buttonStart = (0, import_react77.useMemo)(() => (0, import_records30.buttonOf)(start) ?? { label: "" }, [start]);
|
|
16287
16287
|
const [buttonSettings, setButtonSettings] = (0, import_react77.useState)(buttonStart);
|
|
16288
|
-
const prefixStart = (0,
|
|
16288
|
+
const prefixStart = (0, import_records30.autonumberPrefixOf)(start);
|
|
16289
16289
|
const [numberPrefix, setNumberPrefix] = (0, import_react77.useState)(prefixStart);
|
|
16290
16290
|
const dependencyStart = start?.config?.["dependency"] === true;
|
|
16291
16291
|
const [dependency, setDependency] = (0, import_react77.useState)(dependencyStart);
|
|
@@ -16293,7 +16293,7 @@ function FieldEditor(props) {
|
|
|
16293
16293
|
if (!field2 || type !== "status") return;
|
|
16294
16294
|
let live = true;
|
|
16295
16295
|
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,
|
|
16296
|
+
if (live && got.ok) setStatusKeys(Object.fromEntries((got.data ?? []).map((o) => [String(o.id), (0, import_records31.optionKey)(o)])));
|
|
16297
16297
|
});
|
|
16298
16298
|
return () => {
|
|
16299
16299
|
live = false;
|
|
@@ -16416,7 +16416,7 @@ function FieldEditor(props) {
|
|
|
16416
16416
|
const nameTaken = columnNameTakenBy(label, others.map(fieldName));
|
|
16417
16417
|
const nameLine = nameTaken ? columnNameTakenLine(nameTaken, noun) : columnNameProblemLine(label, noun);
|
|
16418
16418
|
const listsChoices = type === "select" || type === "multi_select" || type === "status";
|
|
16419
|
-
const buttonMissing = type === "button" && buttonSettings.do ? (0,
|
|
16419
|
+
const buttonMissing = type === "button" && buttonSettings.do ? (0, import_records30.buttonNeeds)(buttonSettings) : null;
|
|
16420
16420
|
const missing = buttonMissing ?? (editing ? formulaMissing ?? (listsChoices ? whatTheChoiceListIsMissing(choiceList) : null) : formulaMissing ?? (listsChoices ? whatTheChoiceListIsMissing(newChoices) : null) ?? (type === "formula" && formulaWritten ? null : whatIsMissing(
|
|
16421
16421
|
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
16422
|
)));
|
|
@@ -16458,7 +16458,7 @@ function FieldEditor(props) {
|
|
|
16458
16458
|
...statusGroupsChanged ? { status_groups: statusGroupsSent } : {},
|
|
16459
16459
|
// V11 #4/#10: a rating's top star goes as `max`, the word custom.field_update now takes the way
|
|
16460
16460
|
// custom.field_declare does; the store writes the max Rule and sets aside any score above it.
|
|
16461
|
-
...type === "rating" && ratingMax !== (0,
|
|
16461
|
+
...type === "rating" && ratingMax !== (0, import_records31.ratingMaxOf)(field2) ? { max: ratingMax } : {},
|
|
16462
16462
|
...type === "barcode" && symbology !== String(field2.config?.["symbology"] ?? "") ? { symbology: symbology === "" ? null : symbology } : {},
|
|
16463
16463
|
...type === "button" && JSON.stringify(buttonSettings) !== JSON.stringify(buttonStart) ? { button: buttonSettings } : {},
|
|
16464
16464
|
...field2.type === "relation" && dependency !== dependencyStart ? { dependency } : {},
|
|
@@ -16493,7 +16493,7 @@ function FieldEditor(props) {
|
|
|
16493
16493
|
return;
|
|
16494
16494
|
}
|
|
16495
16495
|
(0, import_react78.tableShapeChanged)(tableId);
|
|
16496
|
-
for (const c of done.data.undo.cells_back) (0,
|
|
16496
|
+
for (const c of done.data.undo.cells_back) (0, import_core17.announceRecordChanged)(c.record_id);
|
|
16497
16497
|
const n = done.data.rehomed.reduce((sum, r) => sum + r.records, 0);
|
|
16498
16498
|
setRehome({});
|
|
16499
16499
|
setRehomed({ said: `Saved. ${n} ${n === 1 ? "record was" : "records were"} changed with the choices.`, undo: done.data.undo });
|
|
@@ -17007,7 +17007,7 @@ function FieldEditor(props) {
|
|
|
17007
17007
|
return;
|
|
17008
17008
|
}
|
|
17009
17009
|
(0, import_react78.tableShapeChanged)(tableId);
|
|
17010
|
-
for (const c of undo.cells_back) (0,
|
|
17010
|
+
for (const c of undo.cells_back) (0, import_core17.announceRecordChanged)(c.record_id);
|
|
17011
17011
|
setChoiceList(null);
|
|
17012
17012
|
setChoiceListStart(null);
|
|
17013
17013
|
setRehomed({ said: "Undone. The choices and the records that held them are back as they were.", undo: null });
|
|
@@ -17478,7 +17478,7 @@ function runAnswerWords(label, run) {
|
|
|
17478
17478
|
var stop2 = (event) => event.stopPropagation();
|
|
17479
17479
|
function ButtonValue({ field: field2, recordId, inCell }) {
|
|
17480
17480
|
const client = (0, import_react80.useOptionalRecordsClient)();
|
|
17481
|
-
const b = (0,
|
|
17481
|
+
const b = (0, import_records32.buttonOf)(field2);
|
|
17482
17482
|
const [busy, setBusy] = (0, import_react79.useState)(false);
|
|
17483
17483
|
const [said2, setSaid] = (0, import_react79.useState)(null);
|
|
17484
17484
|
const [settingUp, setSettingUp] = (0, import_react79.useState)(false);
|
|
@@ -17486,7 +17486,7 @@ function ButtonValue({ field: field2, recordId, inCell }) {
|
|
|
17486
17486
|
(0, import_react79.useEffect)(() => () => void (waitingOn.current += 1), []);
|
|
17487
17487
|
if (!b) return null;
|
|
17488
17488
|
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,
|
|
17489
|
+
const needs = (0, import_records32.buttonNeeds)(b);
|
|
17490
17490
|
const tableId = field2.entity_definition_id;
|
|
17491
17491
|
const press = async () => {
|
|
17492
17492
|
if (!client || !recordId) return setSaid({ kind: "public" });
|
|
@@ -17778,7 +17778,7 @@ function formatControl(args) {
|
|
|
17778
17778
|
// src/typedDateHelper.tsx
|
|
17779
17779
|
var import_react83 = require("react");
|
|
17780
17780
|
var import_design_system50 = require("@ai-matrx/design-system");
|
|
17781
|
-
var
|
|
17781
|
+
var import_records33 = require("@ai-matrx/records");
|
|
17782
17782
|
var import_jsx_runtime56 = require("react/jsx-runtime");
|
|
17783
17783
|
var WEEK = ["Su", "Mo", "Tu", "We", "Th", "Fr", "Sa"];
|
|
17784
17784
|
var MONTHS = ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"];
|
|
@@ -17787,12 +17787,12 @@ function pad2(n) {
|
|
|
17787
17787
|
}
|
|
17788
17788
|
function readBox(text, kind2) {
|
|
17789
17789
|
if (kind2 === "time") {
|
|
17790
|
-
const t = (0,
|
|
17790
|
+
const t = (0, import_records33.readTypedTime)(text);
|
|
17791
17791
|
if (!t.ok) return { day: null, time: null };
|
|
17792
17792
|
const [h, m] = t.value.split(":").map(Number);
|
|
17793
17793
|
return { day: null, time: { h, m } };
|
|
17794
17794
|
}
|
|
17795
|
-
const read = (0,
|
|
17795
|
+
const read = (0, import_records33.readTypedDate)(text, { withTime: kind2 === "datetime" });
|
|
17796
17796
|
if (!read.ok) return { day: null, time: null };
|
|
17797
17797
|
if (kind2 === "datetime" && read.instant) {
|
|
17798
17798
|
const at = new Date(read.instant);
|
|
@@ -17801,10 +17801,10 @@ function readBox(text, kind2) {
|
|
|
17801
17801
|
return { day: read.day, time: null };
|
|
17802
17802
|
}
|
|
17803
17803
|
function wordsFor2(kind2, day2, time) {
|
|
17804
|
-
if (kind2 === "time") return time ? (0,
|
|
17804
|
+
if (kind2 === "time") return time ? (0, import_records33.typedTimeText)(time.h, time.m) : "";
|
|
17805
17805
|
if (!day2) return "";
|
|
17806
|
-
const dayText = (0,
|
|
17807
|
-
return kind2 === "datetime" && time ? `${dayText} ${(0,
|
|
17806
|
+
const dayText = (0, import_records33.typedDateText)(day2);
|
|
17807
|
+
return kind2 === "datetime" && time ? `${dayText} ${(0, import_records33.typedTimeText)(time.h, time.m)}` : dayText;
|
|
17808
17808
|
}
|
|
17809
17809
|
var keepFocus = { onMouseDown: (e) => e.preventDefault(), tabIndex: -1 };
|
|
17810
17810
|
function CalendarGlyph() {
|
|
@@ -17926,7 +17926,7 @@ function TypedDateHelper({
|
|
|
17926
17926
|
held.time && held.time.h === t.h && held.time.m === t.m ? "bg-primary text-primary-foreground" : ""
|
|
17927
17927
|
),
|
|
17928
17928
|
onClick: () => pickTime(t),
|
|
17929
|
-
children: (0,
|
|
17929
|
+
children: (0, import_records33.typedTimeText)(t.h, t.m)
|
|
17930
17930
|
},
|
|
17931
17931
|
`${t.h}:${t.m}`
|
|
17932
17932
|
)) })
|
|
@@ -17983,7 +17983,7 @@ function FieldLabel({ field: field2, htmlFor, children }) {
|
|
|
17983
17983
|
return /* @__PURE__ */ (0, import_jsx_runtime57.jsxs)("div", { className: "flex items-baseline gap-1.5", children: [
|
|
17984
17984
|
/* @__PURE__ */ (0, import_jsx_runtime57.jsx)(import_design_system51.Label, { htmlFor, className: "text-xs font-medium", children: fieldName(field2) }),
|
|
17985
17985
|
field2.required ? /* @__PURE__ */ (0, import_jsx_runtime57.jsx)("span", { className: "text-xs text-destructive", children: "required" }) : null,
|
|
17986
|
-
field2.unit && (0,
|
|
17986
|
+
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
17987
|
children
|
|
17988
17988
|
] });
|
|
17989
17989
|
}
|
|
@@ -17993,7 +17993,7 @@ function isTypedDraft(value) {
|
|
|
17993
17993
|
var TYPED_AS_WORDS = /* @__PURE__ */ new Set(["text", "long_text", "phone"]);
|
|
17994
17994
|
var TYPED_AND_READ = /* @__PURE__ */ new Set(["number", "currency", "percent", "datetime", "select", "multi_select", "email", "url"]);
|
|
17995
17995
|
function typingOpens(field2) {
|
|
17996
|
-
if ((0,
|
|
17996
|
+
if ((0, import_records34.isButtonField)(field2)) return "none";
|
|
17997
17997
|
const kind2 = String(editorKindFor(field2));
|
|
17998
17998
|
if (kind2 === "formula" || kind2 === "lookup" || kind2 === "rollup") return "none";
|
|
17999
17999
|
if (kind2 === "select" || kind2 === "multi_select" || kind2 === "member") return "search";
|
|
@@ -18019,21 +18019,21 @@ function judgeTyped(field2, text, choices, nudge) {
|
|
|
18019
18019
|
const format = formatForField(field2);
|
|
18020
18020
|
if (trimmed === "") return { value: null };
|
|
18021
18021
|
if (format && format.id === "time") {
|
|
18022
|
-
const read2 = (0,
|
|
18022
|
+
const read2 = (0, import_records34.readTypedTime)(trimmed);
|
|
18023
18023
|
return read2.ok ? { value: read2.value } : { refusal: SHORT_REFUSAL.time, why: `${fieldName(field2)} holds a time of day, and ${read2.why}` };
|
|
18024
18024
|
}
|
|
18025
18025
|
if (kind2 === "select" || kind2 === "multi_select") {
|
|
18026
18026
|
if (!choices || nudge === null) return null;
|
|
18027
18027
|
const several = field2.multi || kind2 === "multi_select";
|
|
18028
18028
|
const words2 = several ? trimmed.split(/\s*[,;\n]\s*/).filter(Boolean) : [trimmed];
|
|
18029
|
-
const allowOther = (0,
|
|
18029
|
+
const allowOther = (0, import_records34.allowsOtherValues)(field2);
|
|
18030
18030
|
const parts = [];
|
|
18031
18031
|
const add = [];
|
|
18032
18032
|
const ask2 = [];
|
|
18033
18033
|
const notChoices = [];
|
|
18034
18034
|
let keepOffered = allowOther;
|
|
18035
18035
|
for (const word of words2) {
|
|
18036
|
-
const decided = (0,
|
|
18036
|
+
const decided = (0, import_records34.decideTypedChoice)({ words: word, options: choices, allowOther, nudge });
|
|
18037
18037
|
if (decided.decision === "empty") continue;
|
|
18038
18038
|
if (decided.decision === "chosen") parts.push(decided.key);
|
|
18039
18039
|
else {
|
|
@@ -18066,7 +18066,7 @@ function judgeTyped(field2, text, choices, nudge) {
|
|
|
18066
18066
|
return usual && digits.length >= 7 && digits.length <= 20 ? { value: trimmed } : { refusal: SHORT_REFUSAL.phone };
|
|
18067
18067
|
}
|
|
18068
18068
|
const showsAsPercent = Boolean(format && (format.id === "percent" || format.id === "progress"));
|
|
18069
|
-
const read = (0,
|
|
18069
|
+
const read = (0, import_records34.coerceTypedAnswer)(field2, text, { label: fieldName(field2), showsAsPercent });
|
|
18070
18070
|
if ("refusal" in read) {
|
|
18071
18071
|
if (kind2 === "email" || kind2 === "url") return { refusal: SHORT_REFUSAL[kind2] };
|
|
18072
18072
|
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 +18087,12 @@ function openingText(field2, value) {
|
|
|
18087
18087
|
if (value === null || value === void 0 || value === "") return "";
|
|
18088
18088
|
const helper = dateHelperKind(field2, value);
|
|
18089
18089
|
if (helper === "time") {
|
|
18090
|
-
const read = (0,
|
|
18090
|
+
const read = (0, import_records34.readTypedTime)(String(value));
|
|
18091
18091
|
if (!read.ok) return String(value);
|
|
18092
18092
|
const [h, m] = read.value.split(":").map(Number);
|
|
18093
|
-
return (0,
|
|
18093
|
+
return (0, import_records34.typedTimeText)(h, m);
|
|
18094
18094
|
}
|
|
18095
|
-
if (helper) return (0,
|
|
18095
|
+
if (helper) return (0, import_records34.typedDateText)(value, { withTime: helper === "datetime" });
|
|
18096
18096
|
const format = formatForField(field2);
|
|
18097
18097
|
return format ? typedText(format, value) : String(value);
|
|
18098
18098
|
}
|
|
@@ -18196,7 +18196,7 @@ function TypedTextControl({ field: field2, value, onChange, disabled, id, onComm
|
|
|
18196
18196
|
" ",
|
|
18197
18197
|
needsChoices ? String(
|
|
18198
18198
|
(Array.isArray(withoutAddition(judged.value).value) ? withoutAddition(judged.value).value : [withoutAddition(judged.value).value]).map((k) => {
|
|
18199
|
-
const option = choices?.find((o) => (0,
|
|
18199
|
+
const option = choices?.find((o) => (0, import_records34.optionKey)(o) === k);
|
|
18200
18200
|
return option ? recordName(option.data, null, String(k)) : String(k);
|
|
18201
18201
|
}).join(", ")
|
|
18202
18202
|
) : (() => {
|
|
@@ -18217,7 +18217,7 @@ function FieldControl({ field: field2, value, onChange, disabled, id, autoOpen,
|
|
|
18217
18217
|
const ownDetails = (0, import_react85.useOptionalRecordsClient)() === null;
|
|
18218
18218
|
if (isTypedDraft(value)) return /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(TypedTextControl, { field: field2, value, onChange, disabled, id: inputId, onCommit, onCancel });
|
|
18219
18219
|
if (isSignatureField(field2)) return /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(SignaturePad, { id: inputId, value, onChange, disabled });
|
|
18220
|
-
if ((0,
|
|
18220
|
+
if ((0, import_records34.isButtonField)(field2)) return /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(ButtonValue, { field: field2 });
|
|
18221
18221
|
const newerControl = newerKindControl({ field: field2, value, onChange, disabled, id: inputId });
|
|
18222
18222
|
if (newerControl !== void 0) return newerControl;
|
|
18223
18223
|
const format = formatForField(field2);
|
|
@@ -18387,7 +18387,7 @@ function TypedWordsControl({ field: field2, value, onChange, disabled, id }) {
|
|
|
18387
18387
|
function typedDatePlaceholder(helper) {
|
|
18388
18388
|
const time = "h:mm AM";
|
|
18389
18389
|
if (helper === "time") return time;
|
|
18390
|
-
const pattern = (0,
|
|
18390
|
+
const pattern = (0, import_records34.typedDateText)("2026-11-22").replace("2026", "YYYY").replace("11", "MM").replace("22", "DD");
|
|
18391
18391
|
return helper === "datetime" ? `${pattern} ${time}` : pattern;
|
|
18392
18392
|
}
|
|
18393
18393
|
function CheckboxControl({ field: field2, value, onChange, disabled, id }) {
|
|
@@ -18557,15 +18557,15 @@ function OptionControl({ field: field2, value, onChange, disabled, id, autoOpen,
|
|
|
18557
18557
|
ChoiceAnswer,
|
|
18558
18558
|
{
|
|
18559
18559
|
field: field2,
|
|
18560
|
-
choices: options.map((option) => ({ key: (0,
|
|
18560
|
+
choices: options.map((option) => ({ key: (0, import_records34.optionKey)(option), label: titled(option) })),
|
|
18561
18561
|
value,
|
|
18562
18562
|
onChange,
|
|
18563
18563
|
disabled,
|
|
18564
18564
|
id,
|
|
18565
18565
|
onChosen,
|
|
18566
18566
|
isChosen: (choice, v) => {
|
|
18567
|
-
const option = options.find((o) => (0,
|
|
18568
|
-
return option ? (0,
|
|
18567
|
+
const option = options.find((o) => (0, import_records34.optionKey)(o) === choice.key);
|
|
18568
|
+
return option ? (0, import_records34.isTheChosen)(option, v) : false;
|
|
18569
18569
|
}
|
|
18570
18570
|
}
|
|
18571
18571
|
);
|
|
@@ -18598,7 +18598,7 @@ function OptionControl({ field: field2, value, onChange, disabled, id, autoOpen,
|
|
|
18598
18598
|
onCancel,
|
|
18599
18599
|
initialSearch,
|
|
18600
18600
|
addsChoices,
|
|
18601
|
-
allowOther: (0,
|
|
18601
|
+
allowOther: (0, import_records34.allowsOtherValues)(field2),
|
|
18602
18602
|
onChoicesChanged: () => {
|
|
18603
18603
|
if (client) (0, askOnce_exports.forgetAsked)(client, `field_options:${field2.id}`);
|
|
18604
18604
|
setReread((n) => n + 1);
|
|
@@ -18612,19 +18612,19 @@ function OptionControl({ field: field2, value, onChange, disabled, id, autoOpen,
|
|
|
18612
18612
|
}
|
|
18613
18613
|
const titleOf = (option) => recordName(option.data, null, "Unnamed choice");
|
|
18614
18614
|
if (field2.multi) {
|
|
18615
|
-
const chosen = options.filter((option) => (0,
|
|
18616
|
-
const picked = new Set(chosen.map((option) => (0,
|
|
18615
|
+
const chosen = options.filter((option) => (0, import_records34.choiceValuesOf)(value).some((v) => (0, import_records34.isTheChosen)(option, v)));
|
|
18616
|
+
const picked = new Set(chosen.map((option) => (0, import_records34.optionKey)(option)));
|
|
18617
18617
|
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
18618
|
import_design_system51.Button,
|
|
18619
18619
|
{
|
|
18620
18620
|
type: "button",
|
|
18621
18621
|
size: "sm",
|
|
18622
|
-
variant: picked.has((0,
|
|
18622
|
+
variant: picked.has((0, import_records34.optionKey)(option)) ? "default" : "outline",
|
|
18623
18623
|
disabled,
|
|
18624
18624
|
onClick: () => {
|
|
18625
18625
|
const next = new Set(picked);
|
|
18626
|
-
if (next.has((0,
|
|
18627
|
-
else next.add((0,
|
|
18626
|
+
if (next.has((0, import_records34.optionKey)(option))) next.delete((0, import_records34.optionKey)(option));
|
|
18627
|
+
else next.add((0, import_records34.optionKey)(option));
|
|
18628
18628
|
onChange(next.size === 0 ? null : [...next]);
|
|
18629
18629
|
},
|
|
18630
18630
|
children: titleOf(option)
|
|
@@ -18646,11 +18646,11 @@ function OptionControl({ field: field2, value, onChange, disabled, id, autoOpen,
|
|
|
18646
18646
|
}
|
|
18647
18647
|
);
|
|
18648
18648
|
}
|
|
18649
|
-
const current = options.find((option) => (0,
|
|
18649
|
+
const current = options.find((option) => (0, import_records34.isTheChosen)(option, value));
|
|
18650
18650
|
return /* @__PURE__ */ (0, import_jsx_runtime57.jsxs)(
|
|
18651
18651
|
import_design_system51.Select,
|
|
18652
18652
|
{
|
|
18653
|
-
value: current ? (0,
|
|
18653
|
+
value: current ? (0, import_records34.optionKey)(current) : "",
|
|
18654
18654
|
disabled: disabled ?? false,
|
|
18655
18655
|
onValueChange: (next) => onChange(next === "" ? null : next),
|
|
18656
18656
|
...autoOpen ? {
|
|
@@ -18662,7 +18662,7 @@ function OptionControl({ field: field2, value, onChange, disabled, id, autoOpen,
|
|
|
18662
18662
|
} : {},
|
|
18663
18663
|
children: [
|
|
18664
18664
|
/* @__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,
|
|
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, import_records34.optionKey)(option), children: titleOf(option) }, option.id)) })
|
|
18666
18666
|
]
|
|
18667
18667
|
}
|
|
18668
18668
|
);
|
|
@@ -18696,23 +18696,23 @@ function OpenChoicePicker({
|
|
|
18696
18696
|
const [addRefused, setAddRefused] = (0, import_react84.useState)(null);
|
|
18697
18697
|
const titleOf = (option) => recordName(option.data, null, "Unnamed choice");
|
|
18698
18698
|
const held = withoutAddition(value);
|
|
18699
|
-
const current = (0,
|
|
18699
|
+
const current = (0, import_records34.choiceValuesOf)(held.value);
|
|
18700
18700
|
const pickedWords = current.map((v) => {
|
|
18701
|
-
const option = options.find((o) => (0,
|
|
18701
|
+
const option = options.find((o) => (0, import_records34.isTheChosen)(o, v));
|
|
18702
18702
|
return option ? titleOf(option) : String(v);
|
|
18703
18703
|
});
|
|
18704
|
-
const chipOf = (option, word) => option ? choiceChipLookOf(field2, (0,
|
|
18704
|
+
const chipOf = (option, word) => option ? choiceChipLookOf(field2, (0, import_records34.optionKey)(option), titleOf(option)) : choiceChipLookOf(field2, word);
|
|
18705
18705
|
const q = search.trim();
|
|
18706
|
-
const visible = (0,
|
|
18707
|
-
const decided = (0,
|
|
18706
|
+
const visible = (0, import_records34.rankTypedMatches)(options, q, titleOf);
|
|
18707
|
+
const decided = (0, import_records34.decideTypedChoice)({ words: q, options, allowOther, nudge: nudge ?? "ask" });
|
|
18708
18708
|
const choose = (word, addingIt = false) => {
|
|
18709
18709
|
const pending = held.add.filter((w) => w.toLowerCase() !== word.toLowerCase());
|
|
18710
18710
|
let next;
|
|
18711
18711
|
let add2 = [...pending];
|
|
18712
18712
|
if (field2.multi) {
|
|
18713
18713
|
const existing = current.map((v) => {
|
|
18714
|
-
const option = options.find((o) => (0,
|
|
18715
|
-
return option ? (0,
|
|
18714
|
+
const option = options.find((o) => (0, import_records34.isTheChosen)(o, v));
|
|
18715
|
+
return option ? (0, import_records34.optionKey)(option) : String(v);
|
|
18716
18716
|
});
|
|
18717
18717
|
const has = existing.some((v) => v.toLowerCase() === word.toLowerCase());
|
|
18718
18718
|
const list = has ? existing.filter((v) => v.toLowerCase() !== word.toLowerCase()) : [...existing, word];
|
|
@@ -18748,7 +18748,7 @@ function OpenChoicePicker({
|
|
|
18748
18748
|
const foot = null;
|
|
18749
18749
|
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
18750
|
const listed = visible;
|
|
18751
|
-
const pickedOptions = current.map((v) => options.find((o) => (0,
|
|
18751
|
+
const pickedOptions = current.map((v) => options.find((o) => (0, import_records34.isTheChosen)(o, v)));
|
|
18752
18752
|
const cellChips = pickedWords.map((word, i) => {
|
|
18753
18753
|
const chip = chipOf(pickedOptions[i], word);
|
|
18754
18754
|
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 +18760,7 @@ function OpenChoicePicker({
|
|
|
18760
18760
|
label: word,
|
|
18761
18761
|
chip: chipOf(option, word).className,
|
|
18762
18762
|
onRemove: () => {
|
|
18763
|
-
if (field2.multi) choose(option ? (0,
|
|
18763
|
+
if (field2.multi) choose(option ? (0, import_records34.optionKey)(option) : String(current[i]));
|
|
18764
18764
|
else onChange(null);
|
|
18765
18765
|
}
|
|
18766
18766
|
};
|
|
@@ -18791,11 +18791,11 @@ function OpenChoicePicker({
|
|
|
18791
18791
|
id: option.id,
|
|
18792
18792
|
label: titleOf(option),
|
|
18793
18793
|
chip: chipOf(option, titleOf(option)).className,
|
|
18794
|
-
picked: current.some((v) => (0,
|
|
18794
|
+
picked: current.some((v) => (0, import_records34.isTheChosen)(option, v))
|
|
18795
18795
|
})),
|
|
18796
18796
|
onPick: (optionId) => {
|
|
18797
18797
|
const option = options.find((o) => o.id === optionId);
|
|
18798
|
-
if (option) choose((0,
|
|
18798
|
+
if (option) choose((0, import_records34.optionKey)(option));
|
|
18799
18799
|
},
|
|
18800
18800
|
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
18801
|
add,
|
|
@@ -18851,7 +18851,7 @@ function ChoiceAnswer({
|
|
|
18851
18851
|
onChosen
|
|
18852
18852
|
}) {
|
|
18853
18853
|
const [search, setSearch] = (0, import_react84.useState)("");
|
|
18854
|
-
const held = field2.multi ? (0,
|
|
18854
|
+
const held = field2.multi ? (0, import_records34.choiceValuesOf)(value) : value === null || value === void 0 || value === "" ? [] : [value];
|
|
18855
18855
|
const on = (choice) => held.some((v) => isChosen ? isChosen(choice, v) : String(v) === choice.key || String(v) === choice.label);
|
|
18856
18856
|
const press = (choice) => {
|
|
18857
18857
|
if (!field2.multi) {
|
|
@@ -19324,7 +19324,7 @@ function isTypedCharacter(event) {
|
|
|
19324
19324
|
return !event.metaKey && !event.ctrlKey && !event.altKey && event.key.length === 1 && event.key !== " ";
|
|
19325
19325
|
}
|
|
19326
19326
|
function fieldIsEditable(field2) {
|
|
19327
|
-
if ((0,
|
|
19327
|
+
if ((0, import_records35.isButtonField)(field2)) return false;
|
|
19328
19328
|
const kind2 = editorKindFor(field2);
|
|
19329
19329
|
return kind2 !== "formula" && kind2 !== "lookup" && kind2 !== "rollup";
|
|
19330
19330
|
}
|
|
@@ -19461,7 +19461,7 @@ function useGridEditing({ tableId, fields, rows, reload, reloadAfterWrite, canWr
|
|
|
19461
19461
|
}
|
|
19462
19462
|
const held = optimistic[cellKey(address.rowId, address.key)];
|
|
19463
19463
|
const document2 = rows.find((r) => r.id === address.rowId)?.document;
|
|
19464
|
-
const pointer = held === void 0 && typeof current === "string" ? (0,
|
|
19464
|
+
const pointer = held === void 0 && typeof current === "string" ? (0, import_core18.wholeValueOf)(document2, address.key) : null;
|
|
19465
19465
|
if (pointer) {
|
|
19466
19466
|
const read = host.readFileText;
|
|
19467
19467
|
if (!read) return;
|
|
@@ -19613,7 +19613,7 @@ function useGridEditing({ tableId, fields, rows, reload, reloadAfterWrite, canWr
|
|
|
19613
19613
|
delete next[id];
|
|
19614
19614
|
return next;
|
|
19615
19615
|
});
|
|
19616
|
-
const conflict = (0,
|
|
19616
|
+
const conflict = (0, import_core18.asWriteConflict)(written.error, rowId);
|
|
19617
19617
|
if (written.error.code === "stale_write") {
|
|
19618
19618
|
if (conflict) rememberVersion(versions.current, rowId, conflict.current_version);
|
|
19619
19619
|
else versions.current.delete(rowId);
|
|
@@ -19701,7 +19701,7 @@ function useGridEditing({ tableId, fields, rows, reload, reloadAfterWrite, canWr
|
|
|
19701
19701
|
}
|
|
19702
19702
|
const starting = shownValue2(next.rowId, next.key);
|
|
19703
19703
|
const nextDocument = rows.find((r) => r.id === next.rowId)?.document;
|
|
19704
|
-
if (typeof starting === "string" && optimistic[cellKey(next.rowId, next.key)] === void 0 && (0,
|
|
19704
|
+
if (typeof starting === "string" && optimistic[cellKey(next.rowId, next.key)] === void 0 && (0, import_core18.wholeValueOf)(nextDocument, next.key)) {
|
|
19705
19705
|
setEditing(null);
|
|
19706
19706
|
setDraft(null);
|
|
19707
19707
|
typed2.current = null;
|
|
@@ -20759,10 +20759,10 @@ function useWholeTableCount(args) {
|
|
|
20759
20759
|
// src/Grid.tsx
|
|
20760
20760
|
var import_react168 = require("react");
|
|
20761
20761
|
var import_react169 = require("@ai-matrx/records/react");
|
|
20762
|
-
var
|
|
20763
|
-
var
|
|
20762
|
+
var import_records45 = require("@ai-matrx/records");
|
|
20763
|
+
var import_records46 = require("@ai-matrx/records");
|
|
20764
20764
|
var import_data_table14 = require("@ai-matrx/design-system/data-table");
|
|
20765
|
-
var
|
|
20765
|
+
var import_core25 = require("@ai-matrx/records/core");
|
|
20766
20766
|
|
|
20767
20767
|
// src/tableDecorations.ts
|
|
20768
20768
|
var import_react95 = require("react");
|
|
@@ -20799,7 +20799,7 @@ function useTableDecorations(tableId, revision) {
|
|
|
20799
20799
|
}
|
|
20800
20800
|
|
|
20801
20801
|
// src/emptyState.tsx
|
|
20802
|
-
var
|
|
20802
|
+
var import_records36 = require("@ai-matrx/records");
|
|
20803
20803
|
var import_design_system54 = require("@ai-matrx/design-system");
|
|
20804
20804
|
var import_format4 = require("@ai-matrx/kit/format");
|
|
20805
20805
|
var import_jsx_runtime62 = require("react/jsx-runtime");
|
|
@@ -20809,7 +20809,7 @@ function lockedRowsWords(count) {
|
|
|
20809
20809
|
function questionIsAsked(args) {
|
|
20810
20810
|
if ((args.search ?? "").trim() !== "") return true;
|
|
20811
20811
|
if (Object.values(args.columnFilters ?? {}).some((value) => value !== void 0 && value !== null)) return true;
|
|
20812
|
-
if (args.filter && (0,
|
|
20812
|
+
if (args.filter && (0, import_records36.stableFilterKey)(args.filter) !== "{}") return true;
|
|
20813
20813
|
return Boolean(args.ruled);
|
|
20814
20814
|
}
|
|
20815
20815
|
function emptyCauseOf(args) {
|
|
@@ -20905,7 +20905,7 @@ function useTableCanBeCleaned(tableId) {
|
|
|
20905
20905
|
|
|
20906
20906
|
// src/gridControls.tsx
|
|
20907
20907
|
var import_clipboard3 = require("@ai-matrx/kit/clipboard");
|
|
20908
|
-
var
|
|
20908
|
+
var import_core19 = require("@ai-matrx/records/core");
|
|
20909
20909
|
var import_react127 = require("react");
|
|
20910
20910
|
var import_react128 = require("@ai-matrx/records/react");
|
|
20911
20911
|
var import_design_system69 = require("@ai-matrx/design-system");
|
|
@@ -21769,7 +21769,7 @@ init_fieldTypes();
|
|
|
21769
21769
|
|
|
21770
21770
|
// src/gridColors.tsx
|
|
21771
21771
|
var import_react110 = require("react");
|
|
21772
|
-
var
|
|
21772
|
+
var import_records37 = require("@ai-matrx/records");
|
|
21773
21773
|
var import_react111 = require("@ai-matrx/records/react");
|
|
21774
21774
|
var import_design_system59 = require("@ai-matrx/design-system");
|
|
21775
21775
|
var import_data_table9 = require("@ai-matrx/design-system/data-table");
|
|
@@ -21835,7 +21835,7 @@ function useChoiceOptions(fields, keys) {
|
|
|
21835
21835
|
function lookOf(option) {
|
|
21836
21836
|
const raw = option.data?.["color"];
|
|
21837
21837
|
const color = typeof raw === "string" && import_data_table9.STYLE_COLORS.includes(raw) ? raw : void 0;
|
|
21838
|
-
return { id: String(option.id), key: (0,
|
|
21838
|
+
return { id: String(option.id), key: (0, import_records37.optionKey)(option), label: (0, import_records37.optionLabel)(option), ...color ? { color } : {} };
|
|
21839
21839
|
}
|
|
21840
21840
|
function paintByOption(style, _fields, index, lookup) {
|
|
21841
21841
|
if (index.size === 0) return { style, documentOf: (doc) => doc, choiceColorFor: lookup };
|
|
@@ -22302,7 +22302,7 @@ function ColourRulesDialog({
|
|
|
22302
22302
|
|
|
22303
22303
|
// src/gridRowLabel.tsx
|
|
22304
22304
|
var import_react112 = require("react");
|
|
22305
|
-
var
|
|
22305
|
+
var import_records38 = require("@ai-matrx/records");
|
|
22306
22306
|
var import_react113 = require("@ai-matrx/records/react");
|
|
22307
22307
|
var import_design_system60 = require("@ai-matrx/design-system");
|
|
22308
22308
|
init_names();
|
|
@@ -22360,7 +22360,7 @@ function RowLabelPicker({
|
|
|
22360
22360
|
const columns = labelColumns(fields);
|
|
22361
22361
|
const mayChange = kept?.can_change !== false;
|
|
22362
22362
|
const keptFormula = kept?.formula ?? null;
|
|
22363
|
-
const formulaTooLong = formula.trim().length >
|
|
22363
|
+
const formulaTooLong = formula.trim().length > import_records38.ROW_LABEL_FORMULA_MAX_LENGTH;
|
|
22364
22364
|
const formulaUnchanged = formula.trim() === (keptFormula ?? "").trim() && kept?.valid !== false;
|
|
22365
22365
|
const saveColumn = async () => {
|
|
22366
22366
|
setBusy(true);
|
|
@@ -22457,7 +22457,7 @@ function RowLabelPicker({
|
|
|
22457
22457
|
) : null,
|
|
22458
22458
|
formulaTooLong ? /* @__PURE__ */ (0, import_jsx_runtime69.jsxs)("p", { className: "text-[11px] text-foreground", children: [
|
|
22459
22459
|
"Up to ",
|
|
22460
|
-
|
|
22460
|
+
import_records38.ROW_LABEL_FORMULA_MAX_LENGTH,
|
|
22461
22461
|
" characters"
|
|
22462
22462
|
] }) : null
|
|
22463
22463
|
] }),
|
|
@@ -22481,7 +22481,7 @@ function RowLabelPicker({
|
|
|
22481
22481
|
type: "button",
|
|
22482
22482
|
size: "sm",
|
|
22483
22483
|
"data-records-row-label-save-formula": "",
|
|
22484
|
-
disabled: busy || !mayChange || (0,
|
|
22484
|
+
disabled: busy || !mayChange || (0, import_records38.clearsRowLabel)(formula) || formulaTooLong || formulaOk === false || formulaUnchanged,
|
|
22485
22485
|
onClick: () => void saveFormula(),
|
|
22486
22486
|
children: busy ? "Saving\u2026" : "Use this formula"
|
|
22487
22487
|
}
|
|
@@ -22649,7 +22649,7 @@ init_names();
|
|
|
22649
22649
|
// src/gridActions.tsx
|
|
22650
22650
|
var import_react116 = require("react");
|
|
22651
22651
|
var import_react117 = require("@ai-matrx/records/react");
|
|
22652
|
-
var
|
|
22652
|
+
var import_records39 = require("@ai-matrx/records");
|
|
22653
22653
|
var import_design_system62 = require("@ai-matrx/design-system");
|
|
22654
22654
|
init_Refusal();
|
|
22655
22655
|
init_names();
|
|
@@ -22734,7 +22734,7 @@ function useActionRunner(args) {
|
|
|
22734
22734
|
const answered = await client.actionRun({ action_id: action3.id, record_ids: ids });
|
|
22735
22735
|
setBusy(null);
|
|
22736
22736
|
if (!answered.ok) {
|
|
22737
|
-
const refusals = (0,
|
|
22737
|
+
const refusals = (0, import_records39.actionRefusals)(answered.error);
|
|
22738
22738
|
setOutcome({
|
|
22739
22739
|
kind: "refused",
|
|
22740
22740
|
action: action3,
|
|
@@ -23530,7 +23530,7 @@ init_writeOnTheWinningVersion();
|
|
|
23530
23530
|
// src/gridSummaries.tsx
|
|
23531
23531
|
var import_react120 = require("react");
|
|
23532
23532
|
var import_react121 = require("@ai-matrx/records/react");
|
|
23533
|
-
var
|
|
23533
|
+
var import_records40 = require("@ai-matrx/records");
|
|
23534
23534
|
var import_design_system65 = require("@ai-matrx/design-system");
|
|
23535
23535
|
init_parity();
|
|
23536
23536
|
init_names();
|
|
@@ -23580,8 +23580,8 @@ function useColumnSummaries(args) {
|
|
|
23580
23580
|
const why = {};
|
|
23581
23581
|
for (const [key, op2] of entries) {
|
|
23582
23582
|
const measure = op2 === "count" ? { op: "count" } : { op: op2, key };
|
|
23583
|
-
out[key] = row?.measures?.[(0,
|
|
23584
|
-
const notice = row?.withheld?.[(0,
|
|
23583
|
+
out[key] = row?.measures?.[(0, import_records40.measureKey)(measure)] ?? null;
|
|
23584
|
+
const notice = row?.withheld?.[(0, import_records40.measureKey)(measure)];
|
|
23585
23585
|
if (notice) why[key] = notice;
|
|
23586
23586
|
}
|
|
23587
23587
|
setValues(out);
|
|
@@ -24355,7 +24355,7 @@ function useMergedGridControls(args) {
|
|
|
24355
24355
|
const fieldsRef = (0, import_react127.useRef)(fields);
|
|
24356
24356
|
fieldsRef.current = fields;
|
|
24357
24357
|
const [choiceCounts, setChoiceCounts] = (0, import_react127.useState)({});
|
|
24358
|
-
(0, import_react127.useEffect)(() => (0,
|
|
24358
|
+
(0, import_react127.useEffect)(() => (0, import_core19.onRecordChanged)(() => (0, askOnce_exports.forgetAsked)(client, `value_counts:${tableId}:`)), [client, tableId]);
|
|
24359
24359
|
(0, import_react127.useEffect)(() => {
|
|
24360
24360
|
if (!enabled || choiceKeys.length === 0) {
|
|
24361
24361
|
setChoiceCounts({});
|
|
@@ -25087,7 +25087,7 @@ var import_design_system73 = require("@ai-matrx/design-system");
|
|
|
25087
25087
|
// src/RecordForm.tsx
|
|
25088
25088
|
var import_react133 = require("react");
|
|
25089
25089
|
var import_react134 = require("@ai-matrx/records/react");
|
|
25090
|
-
var
|
|
25090
|
+
var import_core21 = require("@ai-matrx/records/core");
|
|
25091
25091
|
init_writeOnTheWinningVersion();
|
|
25092
25092
|
var import_design_system72 = require("@ai-matrx/design-system");
|
|
25093
25093
|
init_Refusal();
|
|
@@ -25106,7 +25106,7 @@ var import_react129 = require("react");
|
|
|
25106
25106
|
var import_react130 = require("@ai-matrx/records/react");
|
|
25107
25107
|
var import_design_system70 = require("@ai-matrx/design-system");
|
|
25108
25108
|
init_Refusal();
|
|
25109
|
-
var
|
|
25109
|
+
var import_core20 = require("@ai-matrx/records/core");
|
|
25110
25110
|
init_plainWords();
|
|
25111
25111
|
var import_jsx_runtime79 = require("react/jsx-runtime");
|
|
25112
25112
|
function isEmptyValue(value) {
|
|
@@ -25179,7 +25179,7 @@ async function writeStandardRowValues(client, args) {
|
|
|
25179
25179
|
{ schema: config.schema ?? "custom" }
|
|
25180
25180
|
);
|
|
25181
25181
|
if (!old.error) return { ok: true };
|
|
25182
|
-
const error = (0,
|
|
25182
|
+
const error = (0, import_core20.mapPgError)(old.error, "entityValueWrite");
|
|
25183
25183
|
return { ok: false, error: doorIsAbsent(error) && first && first.error.code !== "door_absent" ? first.error : error };
|
|
25184
25184
|
}
|
|
25185
25185
|
function doorIsAbsent(error) {
|
|
@@ -25761,7 +25761,7 @@ function CustomRecordForm({
|
|
|
25761
25761
|
return out;
|
|
25762
25762
|
}, [draft]);
|
|
25763
25763
|
const predicted = (0, import_react133.useMemo)(
|
|
25764
|
-
() => fields.data ? (0,
|
|
25764
|
+
() => fields.data ? (0, import_core21.predictWriteRefusals)({ fields: fields.data, document: document2, ...recordType ? { recordType } : {} }) : [],
|
|
25765
25765
|
[fields.data, document2, recordType]
|
|
25766
25766
|
);
|
|
25767
25767
|
if (fields.error) return /* @__PURE__ */ (0, import_jsx_runtime81.jsx)(RefusalNotice, { error: fields.error, className });
|
|
@@ -25811,7 +25811,7 @@ function CustomRecordForm({
|
|
|
25811
25811
|
setEdit({
|
|
25812
25812
|
saving: false,
|
|
25813
25813
|
error: answered2.ok ? null : answered2.error,
|
|
25814
|
-
conflict: answered2.ok ? null : (0,
|
|
25814
|
+
conflict: answered2.ok ? null : (0, import_core21.asWriteConflict)(answered2.error, recordId)
|
|
25815
25815
|
});
|
|
25816
25816
|
const moved = answered2.ok ? answered2.data : null;
|
|
25817
25817
|
if (moved !== null) {
|
|
@@ -25922,7 +25922,7 @@ function FieldRow({
|
|
|
25922
25922
|
}) {
|
|
25923
25923
|
const id = `field-${field2.id}`;
|
|
25924
25924
|
const storedWords = document2?.[field2.key];
|
|
25925
|
-
const whole = typeof storedWords === "string" ? (0,
|
|
25925
|
+
const whole = typeof storedWords === "string" ? (0, import_core21.wholeValueOf)(document2, field2.key) : null;
|
|
25926
25926
|
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
25927
|
/* @__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
25928
|
whole ? (
|
|
@@ -26155,7 +26155,7 @@ function NewRecordControl({
|
|
|
26155
26155
|
// src/gridDrill.tsx
|
|
26156
26156
|
var import_react139 = require("react");
|
|
26157
26157
|
var import_react140 = require("@ai-matrx/records/react");
|
|
26158
|
-
var
|
|
26158
|
+
var import_records41 = require("@ai-matrx/records");
|
|
26159
26159
|
var import_data_table12 = require("@ai-matrx/design-system/data-table");
|
|
26160
26160
|
init_parity();
|
|
26161
26161
|
init_plainWords();
|
|
@@ -26425,7 +26425,7 @@ function useDrillAnswers(args) {
|
|
|
26425
26425
|
across: question.across ?? null,
|
|
26426
26426
|
show: question.show,
|
|
26427
26427
|
where: args.where,
|
|
26428
|
-
rule: args.rule && (0,
|
|
26428
|
+
rule: args.rule && (0, import_records41.isRuleFilter)(args.rule) ? args.rule : null,
|
|
26429
26429
|
window: question.window ?? null,
|
|
26430
26430
|
compare: question.compare ?? null,
|
|
26431
26431
|
windowKey: args.windowKey ?? null,
|
|
@@ -26690,7 +26690,7 @@ function trailClause(fields, w) {
|
|
|
26690
26690
|
}
|
|
26691
26691
|
function filterWithTrail(fields, base2, trail) {
|
|
26692
26692
|
if (trail.length === 0) return base2;
|
|
26693
|
-
if (!base2 || !(0,
|
|
26693
|
+
if (!base2 || !(0, import_records41.isRuleFilter)(base2)) {
|
|
26694
26694
|
const flat = { ...base2 ?? {} };
|
|
26695
26695
|
for (const w of trail) {
|
|
26696
26696
|
const clause = trailClause(fields, w);
|
|
@@ -26713,7 +26713,7 @@ function filterWithTrail(fields, base2, trail) {
|
|
|
26713
26713
|
return { op: "and", args };
|
|
26714
26714
|
}
|
|
26715
26715
|
function filterWithWindow(fields, base2, key, range) {
|
|
26716
|
-
if (!base2 || !(0,
|
|
26716
|
+
if (!base2 || !(0, import_records41.isRuleFilter)(base2)) return { ...base2 ?? {}, [key]: { from: range.from, to: range.to } };
|
|
26717
26717
|
const field2 = fields.find((f) => f.key === key);
|
|
26718
26718
|
if (!field2) return base2;
|
|
26719
26719
|
const ref = { field: field2.id };
|
|
@@ -26757,8 +26757,8 @@ function useGridDrillConfig(args) {
|
|
|
26757
26757
|
},
|
|
26758
26758
|
[setQuestion, onPresentationChange, presentation]
|
|
26759
26759
|
);
|
|
26760
|
-
const flat = state2.filter && !(0,
|
|
26761
|
-
const rule = state2.filter && (0,
|
|
26760
|
+
const flat = state2.filter && !(0, import_records41.isRuleFilter)(state2.filter) ? state2.filter : void 0;
|
|
26761
|
+
const rule = state2.filter && (0, import_records41.isRuleFilter)(state2.filter) ? filterWithTrailRuleOnly(state2) : void 0;
|
|
26762
26762
|
const { config } = useDrill({
|
|
26763
26763
|
source: state2.source,
|
|
26764
26764
|
question: state2.question,
|
|
@@ -27583,7 +27583,7 @@ function withTypeMark(field2, header) {
|
|
|
27583
27583
|
|
|
27584
27584
|
// src/ReverseColumns.tsx
|
|
27585
27585
|
var import_react143 = require("react");
|
|
27586
|
-
var
|
|
27586
|
+
var import_records42 = require("@ai-matrx/records");
|
|
27587
27587
|
|
|
27588
27588
|
// src/groupReads.ts
|
|
27589
27589
|
var import_first_page6 = require("@ai-matrx/records/first-page");
|
|
@@ -27736,7 +27736,7 @@ function useReverseField(tableId, column) {
|
|
|
27736
27736
|
if (column.read_only || !client) return;
|
|
27737
27737
|
let live = true;
|
|
27738
27738
|
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,
|
|
27739
|
+
if (live && read.ok) setField(read.data.find((f) => f.key === column.key && (0, import_records42.isReverseField)(f)) ?? null);
|
|
27740
27740
|
});
|
|
27741
27741
|
return () => {
|
|
27742
27742
|
live = false;
|
|
@@ -28813,7 +28813,7 @@ function useStoreValueFacets(enabled, inputs) {
|
|
|
28813
28813
|
// src/gridGrouping.tsx
|
|
28814
28814
|
var import_react154 = require("react");
|
|
28815
28815
|
var import_react155 = require("@ai-matrx/records/react");
|
|
28816
|
-
var
|
|
28816
|
+
var import_records43 = require("@ai-matrx/records");
|
|
28817
28817
|
init_parity();
|
|
28818
28818
|
var import_jsx_runtime93 = require("react/jsx-runtime");
|
|
28819
28819
|
function groupValueKey(value) {
|
|
@@ -28851,8 +28851,8 @@ function useGroupFacts(args) {
|
|
|
28851
28851
|
const withheld = {};
|
|
28852
28852
|
for (const [fieldKey, op2] of entries) {
|
|
28853
28853
|
const m = op2 === "count" ? { op: "count" } : { op: op2, key: fieldKey };
|
|
28854
|
-
values[fieldKey] = row.measures?.[(0,
|
|
28855
|
-
const notice = row.withheld?.[(0,
|
|
28854
|
+
values[fieldKey] = row.measures?.[(0, import_records43.measureKey)(m)] ?? null;
|
|
28855
|
+
const notice = row.withheld?.[(0, import_records43.measureKey)(m)];
|
|
28856
28856
|
if (notice) withheld[fieldKey] = notice;
|
|
28857
28857
|
}
|
|
28858
28858
|
out.set(key, { count: typeof row.measures?.["count"] === "number" ? row.measures["count"] : row.row_count ?? null, measures: values, withheld });
|
|
@@ -28925,7 +28925,7 @@ function useGroupLabel(fields, groupKey, thenKeys = []) {
|
|
|
28925
28925
|
// src/gridUndo.tsx
|
|
28926
28926
|
var import_react156 = require("react");
|
|
28927
28927
|
var import_react157 = require("@ai-matrx/records/react");
|
|
28928
|
-
var
|
|
28928
|
+
var import_core22 = require("@ai-matrx/records/core");
|
|
28929
28929
|
var import_design_system81 = require("@ai-matrx/design-system");
|
|
28930
28930
|
init_plainWords();
|
|
28931
28931
|
var import_data_table13 = require("@ai-matrx/design-system/data-table");
|
|
@@ -29021,7 +29021,7 @@ function useGridUndo(args) {
|
|
|
29021
29021
|
}
|
|
29022
29022
|
forget(step2.cells.map((c) => ({ rowId: c.rowId, key: c.key })));
|
|
29023
29023
|
for (const id of /* @__PURE__ */ new Set([...step2.cells.map((c) => c.rowId), ...step2.created ?? [], ...step2.archived ?? []])) {
|
|
29024
|
-
(0,
|
|
29024
|
+
(0, import_core22.announceRecordChanged)(id);
|
|
29025
29025
|
}
|
|
29026
29026
|
setHeld(() => {
|
|
29027
29027
|
let stack = taken.stack;
|
|
@@ -29318,7 +29318,7 @@ function useRowFollowsItsMove(args) {
|
|
|
29318
29318
|
// src/gridAssist.tsx
|
|
29319
29319
|
var import_clipboard5 = require("@ai-matrx/kit/clipboard");
|
|
29320
29320
|
var import_react160 = require("react");
|
|
29321
|
-
var
|
|
29321
|
+
var import_core23 = require("@ai-matrx/records/core");
|
|
29322
29322
|
var import_workspace = require("@ai-matrx/alchemy/react/workspace");
|
|
29323
29323
|
|
|
29324
29324
|
// src/gridAgentContext.ts
|
|
@@ -29450,7 +29450,7 @@ function useGridAssist(args) {
|
|
|
29450
29450
|
const copyRecordReference = (0, import_react160.useCallback)(
|
|
29451
29451
|
(rowId) => {
|
|
29452
29452
|
void (async () => {
|
|
29453
|
-
const text = JSON.stringify({ __kind: (0,
|
|
29453
|
+
const text = JSON.stringify({ __kind: (0, import_core23.tableKindSlug)(tableId), _record_id: rowId });
|
|
29454
29454
|
if (!await (0, import_clipboard5.copyText)(text)) {
|
|
29455
29455
|
say2(false, "This browser did not let the page write to the clipboard.");
|
|
29456
29456
|
return;
|
|
@@ -29506,7 +29506,7 @@ function useGridAssist(args) {
|
|
|
29506
29506
|
if (!row) return;
|
|
29507
29507
|
const document2 = row.document ?? {};
|
|
29508
29508
|
const value = editing.valueFor(row, fieldOf2(key));
|
|
29509
|
-
const pointer = typeof document2[key] === "string" ? (0,
|
|
29509
|
+
const pointer = typeof document2[key] === "string" ? (0, import_core23.wholeValueOf)(document2, key) : null;
|
|
29510
29510
|
setWhole({ rowId, key, rowTitle: titleOf(row), value, pointer });
|
|
29511
29511
|
},
|
|
29512
29512
|
[rowOf, fieldOf2, titleOf, editing]
|
|
@@ -29602,7 +29602,7 @@ function useGridAssist(args) {
|
|
|
29602
29602
|
// src/gridBulk.tsx
|
|
29603
29603
|
var import_react161 = require("react");
|
|
29604
29604
|
var import_react162 = require("@ai-matrx/records/react");
|
|
29605
|
-
var
|
|
29605
|
+
var import_core24 = require("@ai-matrx/records/core");
|
|
29606
29606
|
init_recordVersions();
|
|
29607
29607
|
var import_design_system82 = require("@ai-matrx/design-system");
|
|
29608
29608
|
init_names();
|
|
@@ -29671,7 +29671,7 @@ function useGridBulk(args) {
|
|
|
29671
29671
|
return null;
|
|
29672
29672
|
}
|
|
29673
29673
|
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,
|
|
29674
|
+
for (const change of changes) if ("record_id" in change && change.record_id) (0, import_core24.announceRecordChanged)(change.record_id);
|
|
29675
29675
|
return done.data;
|
|
29676
29676
|
},
|
|
29677
29677
|
[client, tableId, versions, reload]
|
|
@@ -29837,7 +29837,7 @@ init_recordVersions();
|
|
|
29837
29837
|
// src/handOrder.tsx
|
|
29838
29838
|
var import_react163 = require("react");
|
|
29839
29839
|
var import_react164 = require("@ai-matrx/records/react");
|
|
29840
|
-
var
|
|
29840
|
+
var import_records44 = require("@ai-matrx/records");
|
|
29841
29841
|
var import_design_system83 = require("@ai-matrx/design-system");
|
|
29842
29842
|
init_Refusal();
|
|
29843
29843
|
|
|
@@ -29961,7 +29961,7 @@ function useHandOrderRows(args) {
|
|
|
29961
29961
|
const client = (0, import_react164.useRecordsClient)();
|
|
29962
29962
|
const { viewId, active, page, pageSize } = args;
|
|
29963
29963
|
const filter = args.filter && Object.keys(args.filter).length > 0 ? args.filter : null;
|
|
29964
|
-
const filterKey = filter ? (0,
|
|
29964
|
+
const filterKey = filter ? (0, import_records44.stableFilterKey)(filter) : "";
|
|
29965
29965
|
const filterNow = (0, import_react163.useRef)(filter);
|
|
29966
29966
|
filterNow.current = filter;
|
|
29967
29967
|
const [answer, setAnswer] = (0, import_react163.useState)(null);
|
|
@@ -30415,9 +30415,9 @@ function GridBody({
|
|
|
30415
30415
|
const pageAskedFor = (0, import_react168.useRef)(null);
|
|
30416
30416
|
if (fields.data && !table.loading) pageAskedFor.current = tableId;
|
|
30417
30417
|
const pageAsked = !storePaged || Boolean(fields.data) && pageAskedFor.current === tableId;
|
|
30418
|
-
const numberAsked = (0, import_react168.useMemo)(() => (0,
|
|
30418
|
+
const numberAsked = (0, import_react168.useMemo)(() => (0, import_records45.autonumberSearchOf)(fields.data ?? [], searchTerm), [fields.data, searchTerm]);
|
|
30419
30419
|
const pageSearch = numberAsked ? "" : searchTerm;
|
|
30420
|
-
const pageFilter = numberAsked ? (0,
|
|
30420
|
+
const pageFilter = numberAsked ? (0, import_records45.filterWithAutonumber)(readFilter, numberAsked.field, numberAsked.number) : readFilter;
|
|
30421
30421
|
const serverRead = (0, import_react169.useRecordPage)(storePaged && pageAsked ? tableId : null, {
|
|
30422
30422
|
pageSize: query.pageSize,
|
|
30423
30423
|
page: Math.max(0, query.page - 1),
|
|
@@ -30765,7 +30765,7 @@ function GridBody({
|
|
|
30765
30765
|
const names2 = wanted.get(field2.key) ?? [];
|
|
30766
30766
|
if (names2.length === 0) return;
|
|
30767
30767
|
const got = await client.relationNamesMatch({ table_id: field2.relation_target, names: names2 });
|
|
30768
|
-
if (got.ok) relationNames.current.set(field2.key, (0,
|
|
30768
|
+
if (got.ok) relationNames.current.set(field2.key, (0, import_records46.relationNameIndexOf)(got.data));
|
|
30769
30769
|
})
|
|
30770
30770
|
);
|
|
30771
30771
|
},
|
|
@@ -30844,7 +30844,7 @@ function GridBody({
|
|
|
30844
30844
|
field2.key,
|
|
30845
30845
|
lines2.flatMap((line) => {
|
|
30846
30846
|
const cell2 = line[at];
|
|
30847
|
-
return typeof cell2 === "string" ? (0,
|
|
30847
|
+
return typeof cell2 === "string" ? (0, import_records46.relationNamesIn)(field2, cell2) : [];
|
|
30848
30848
|
})
|
|
30849
30849
|
);
|
|
30850
30850
|
}
|
|
@@ -30957,7 +30957,7 @@ function GridBody({
|
|
|
30957
30957
|
}))
|
|
30958
30958
|
);
|
|
30959
30959
|
editing.forget(cells);
|
|
30960
|
-
for (const u of updates) (0,
|
|
30960
|
+
for (const u of updates) (0, import_core25.announceRecordChanged)(u.row.recordId);
|
|
30961
30961
|
const lines2 = updates.length + creates.length;
|
|
30962
30962
|
undo.push({ label: `Pasted ${lines2} ${lines2 === 1 ? "row" : "rows"}`, cells, created });
|
|
30963
30963
|
const expected = [
|
|
@@ -31131,7 +31131,7 @@ function GridBody({
|
|
|
31131
31131
|
tableName: table.data ? tableName(table.data) : "",
|
|
31132
31132
|
fields: fields.data ?? [],
|
|
31133
31133
|
document: row.document ?? {},
|
|
31134
|
-
level: (0,
|
|
31134
|
+
level: (0, import_records46.asPermissionLevel)(row.level)
|
|
31135
31135
|
}),
|
|
31136
31136
|
[host, tableId, table.data, fields.data]
|
|
31137
31137
|
);
|
|
@@ -31250,7 +31250,7 @@ function GridBody({
|
|
|
31250
31250
|
const values = presetValues ? withNewRowValues(presetValues, given) : given;
|
|
31251
31251
|
setAddRefused(null);
|
|
31252
31252
|
if (formHosted && fields.data) {
|
|
31253
|
-
const wouldRefuse = (0,
|
|
31253
|
+
const wouldRefuse = (0, import_core25.predictWriteRefusals)({ fields: fields.data, document: values ?? {} });
|
|
31254
31254
|
if (wouldRefuse.length > 0) {
|
|
31255
31255
|
setFormAsk((held) => ({ n: (held?.n ?? 0) + 1, initial: { ...values ?? {} } }));
|
|
31256
31256
|
return;
|
|
@@ -32818,7 +32818,7 @@ var import_clipboard6 = require("@ai-matrx/kit/clipboard");
|
|
|
32818
32818
|
var import_download2 = require("@ai-matrx/kit/download");
|
|
32819
32819
|
var import_react174 = require("react");
|
|
32820
32820
|
var import_react175 = require("@ai-matrx/records/react");
|
|
32821
|
-
var
|
|
32821
|
+
var import_core26 = require("@ai-matrx/records/core");
|
|
32822
32822
|
init_host();
|
|
32823
32823
|
|
|
32824
32824
|
// src/viewExport.ts
|
|
@@ -32894,7 +32894,7 @@ function toRows(fields, records, labels) {
|
|
|
32894
32894
|
absent_reason: envelope?.absent ?? null,
|
|
32895
32895
|
// A VALUE KEPT AS A FILE carries its pointer, so the export writes the whole text
|
|
32896
32896
|
// (`withWholeValues`), never the first words passed off as the value.
|
|
32897
|
-
source: (0,
|
|
32897
|
+
source: (0, import_core26.wholeValueOf)(document2, field2.key)
|
|
32898
32898
|
};
|
|
32899
32899
|
}
|
|
32900
32900
|
return row;
|
|
@@ -32925,7 +32925,7 @@ async function rowsForFile(args) {
|
|
|
32925
32925
|
);
|
|
32926
32926
|
const lookup = ((field2, id) => labels(field2, id) ?? learned.get(`${field2.id}:${id}`) ?? null);
|
|
32927
32927
|
const read = host.readFileText;
|
|
32928
|
-
return (0,
|
|
32928
|
+
return (0, import_core26.withWholeValues)(toRows(all, records, lookup), read ? (fileId) => read({ fileId }) : null);
|
|
32929
32929
|
}
|
|
32930
32930
|
function ExportMenu({ tableId, rows, label, className, view }) {
|
|
32931
32931
|
const client = (0, import_react175.useRecordsClient)();
|
|
@@ -32972,7 +32972,7 @@ function ExportMenu({ tableId, rows, label, className, view }) {
|
|
|
32972
32972
|
{
|
|
32973
32973
|
size: "sm",
|
|
32974
32974
|
variant: "outline",
|
|
32975
|
-
onClick: () => void exported().then((rows2) => download(`${name}.csv`, "text/csv;charset=utf-8", (0,
|
|
32975
|
+
onClick: () => void exported().then((rows2) => download(`${name}.csv`, "text/csv;charset=utf-8", (0, import_core26.exportCsv)(columns, rows2))).catch(
|
|
32976
32976
|
(thrown) => setFailure((0, refusals_exports.refusalFromThrown)(thrown, "The CSV could not be written.", "Try again in a moment."))
|
|
32977
32977
|
),
|
|
32978
32978
|
children: "CSV"
|
|
@@ -32993,7 +32993,7 @@ function ExportMenu({ tableId, rows, label, className, view }) {
|
|
|
32993
32993
|
);
|
|
32994
32994
|
setFailure(null);
|
|
32995
32995
|
try {
|
|
32996
|
-
exported().then((rows2) => (0,
|
|
32996
|
+
exported().then((rows2) => (0, import_core26.exportXlsx)(columns, rows2, name)).then(
|
|
32997
32997
|
(bytes) => download(
|
|
32998
32998
|
`${name}.xlsx`,
|
|
32999
32999
|
"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
|
|
@@ -33012,7 +33012,7 @@ function ExportMenu({ tableId, rows, label, className, view }) {
|
|
|
33012
33012
|
{
|
|
33013
33013
|
size: "sm",
|
|
33014
33014
|
variant: "outline",
|
|
33015
|
-
onClick: () => void exported().then((rows2) => download(`${name}.md`, "text/markdown;charset=utf-8", (0,
|
|
33015
|
+
onClick: () => void exported().then((rows2) => download(`${name}.md`, "text/markdown;charset=utf-8", (0, import_core26.exportMarkdown)(columns, rows2))).catch(
|
|
33016
33016
|
(thrown) => setFailure((0, refusals_exports.refusalFromThrown)(thrown, "The Markdown could not be written.", "The CSV beside this button carries the same rows."))
|
|
33017
33017
|
),
|
|
33018
33018
|
children: "Markdown"
|
|
@@ -33024,7 +33024,7 @@ function ExportMenu({ tableId, rows, label, className, view }) {
|
|
|
33024
33024
|
size: "sm",
|
|
33025
33025
|
variant: "outline",
|
|
33026
33026
|
onClick: () => void exported().then(async (rows2) => {
|
|
33027
|
-
if (await (0, import_clipboard6.copyText)((0,
|
|
33027
|
+
if (await (0, import_clipboard6.copyText)((0, import_core26.exportMarkdown)(columns, rows2))) host.notify?.success("Markdown copied");
|
|
33028
33028
|
else host.notify?.error("Couldn\u2019t copy the Markdown");
|
|
33029
33029
|
}).catch(
|
|
33030
33030
|
(thrown) => setFailure((0, refusals_exports.refusalFromThrown)(thrown, "The Markdown could not be written.", "The CSV beside this button carries the same rows."))
|
|
@@ -33058,7 +33058,7 @@ function ExportMenu({ tableId, rows, label, className, view }) {
|
|
|
33058
33058
|
sourceId: `records:${tableId}`,
|
|
33059
33059
|
size: "xs",
|
|
33060
33060
|
json: () => records.map((r) => r.document),
|
|
33061
|
-
human: () => (0,
|
|
33061
|
+
human: () => (0, import_core26.exportCsv)(columns, toRows(columns, records, labels))
|
|
33062
33062
|
}
|
|
33063
33063
|
),
|
|
33064
33064
|
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 +33612,7 @@ function TableRenameDialog({
|
|
|
33612
33612
|
|
|
33613
33613
|
// src/TableSettings.tsx
|
|
33614
33614
|
var import_react193 = require("react");
|
|
33615
|
-
var
|
|
33615
|
+
var import_records48 = require("@ai-matrx/records");
|
|
33616
33616
|
|
|
33617
33617
|
// src/ArchiveDeliberately.tsx
|
|
33618
33618
|
var import_react183 = require("react");
|
|
@@ -33915,7 +33915,7 @@ function TableAccessLevel({ tableId, fields }) {
|
|
|
33915
33915
|
|
|
33916
33916
|
// src/RowControls.tsx
|
|
33917
33917
|
var import_react189 = require("react");
|
|
33918
|
-
var
|
|
33918
|
+
var import_records47 = require("@ai-matrx/records");
|
|
33919
33919
|
var import_react190 = require("@ai-matrx/records/react");
|
|
33920
33920
|
var import_design_system93 = require("@ai-matrx/design-system");
|
|
33921
33921
|
init_Refusal();
|
|
@@ -33945,7 +33945,7 @@ function ShownToSelect({
|
|
|
33945
33945
|
onChange,
|
|
33946
33946
|
testId
|
|
33947
33947
|
}) {
|
|
33948
|
-
return /* @__PURE__ */ (0, import_jsx_runtime109.jsxs)(import_design_system93.Select, { value, onValueChange: (next) => (0,
|
|
33948
|
+
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
33949
|
/* @__PURE__ */ (0, import_jsx_runtime109.jsxs)(
|
|
33950
33950
|
import_design_system93.SelectTrigger,
|
|
33951
33951
|
{
|
|
@@ -33959,7 +33959,7 @@ function ShownToSelect({
|
|
|
33959
33959
|
]
|
|
33960
33960
|
}
|
|
33961
33961
|
),
|
|
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:
|
|
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: import_records47.SHOWN_TO_LABEL[word] }, word)) })
|
|
33963
33963
|
] });
|
|
33964
33964
|
}
|
|
33965
33965
|
function NewRowsDefaults({ tableId }) {
|
|
@@ -33997,10 +33997,10 @@ function NewRowsDefaults({ tableId }) {
|
|
|
33997
33997
|
setError(null);
|
|
33998
33998
|
setApplied(appliedLine(answer.data));
|
|
33999
33999
|
};
|
|
34000
|
-
if (!(0,
|
|
34000
|
+
if (!(0, import_records47.levelHasShownTo)(table.data?.level)) return null;
|
|
34001
34001
|
if (!d) return error ? /* @__PURE__ */ (0, import_jsx_runtime109.jsx)(RefusalNotice, { error }) : null;
|
|
34002
34002
|
const shown5 = d.shown_to ?? d.effective.shown_to;
|
|
34003
|
-
const allowed = d.allowed_shown_to.filter(
|
|
34003
|
+
const allowed = d.allowed_shown_to.filter(import_records47.isShownTo);
|
|
34004
34004
|
return /* @__PURE__ */ (0, import_jsx_runtime109.jsxs)("section", { className: "flex flex-col gap-1.5", "data-testid": "new-rows-defaults", children: [
|
|
34005
34005
|
/* @__PURE__ */ (0, import_jsx_runtime109.jsx)("span", { className: "font-medium", children: ROW_CONTROL_WORDS.block }),
|
|
34006
34006
|
/* @__PURE__ */ (0, import_jsx_runtime109.jsxs)("div", { className: "flex items-center gap-2", children: [
|
|
@@ -34014,7 +34014,7 @@ function NewRowsDefaults({ tableId }) {
|
|
|
34014
34014
|
testId: "new-rows-shown-to",
|
|
34015
34015
|
onChange: (next) => void set({ shown_to: next })
|
|
34016
34016
|
}
|
|
34017
|
-
) : /* @__PURE__ */ (0, import_jsx_runtime109.jsx)("span", { "data-testid": "new-rows-shown-to-text", children:
|
|
34017
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime109.jsx)("span", { "data-testid": "new-rows-shown-to-text", children: import_records47.SHOWN_TO_LABEL[shown5] })
|
|
34018
34018
|
] }),
|
|
34019
34019
|
/* @__PURE__ */ (0, import_jsx_runtime109.jsxs)("div", { className: "flex items-center gap-2", "data-testid": "new-rows-published", children: [
|
|
34020
34020
|
/* @__PURE__ */ (0, import_jsx_runtime109.jsx)("span", { className: "min-w-fit flex-1 whitespace-nowrap", children: ROW_CONTROL_WORDS.publishedToWeb }),
|
|
@@ -34065,10 +34065,10 @@ function RowShownTo({ recordId, tableId }) {
|
|
|
34065
34065
|
}, [read]);
|
|
34066
34066
|
if (error && !c) return null;
|
|
34067
34067
|
if (tableId && table.loading && !table.data) return null;
|
|
34068
|
-
if (!(0,
|
|
34069
|
-
if (!c || c.shown_to.is_child || !(0,
|
|
34068
|
+
if (!(0, import_records47.levelHasShownTo)(table.data?.level)) return null;
|
|
34069
|
+
if (!c || c.shown_to.is_child || !(0, import_records47.isShownTo)(c.shown_to.effective)) return null;
|
|
34070
34070
|
const effective = c.shown_to.effective;
|
|
34071
|
-
const allowed = c.shown_to.allowed.filter(
|
|
34071
|
+
const allowed = c.shown_to.allowed.filter(import_records47.isShownTo);
|
|
34072
34072
|
return /* @__PURE__ */ (0, import_jsx_runtime109.jsxs)("span", { className: "inline-flex shrink-0 items-center", "data-testid": "row-shown-to", children: [
|
|
34073
34073
|
c.shown_to.can_change ? /* @__PURE__ */ (0, import_jsx_runtime109.jsx)(
|
|
34074
34074
|
ShownToSelect,
|
|
@@ -34095,7 +34095,7 @@ function RowShownTo({ recordId, tableId }) {
|
|
|
34095
34095
|
title: ROW_CONTROL_WORDS.whoMayChangeRow,
|
|
34096
34096
|
children: [
|
|
34097
34097
|
/* @__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:
|
|
34098
|
+
/* @__PURE__ */ (0, import_jsx_runtime109.jsx)("span", { "data-testid": "row-shown-to-text", children: import_records47.SHOWN_TO_LABEL[effective] }),
|
|
34099
34099
|
/* @__PURE__ */ (0, import_jsx_runtime109.jsx)("span", { className: "sr-only", "data-testid": "row-shown-to-who", children: ROW_CONTROL_WORDS.whoMayChangeRow })
|
|
34100
34100
|
]
|
|
34101
34101
|
}
|
|
@@ -34463,7 +34463,7 @@ function TableSettingsPanel({
|
|
|
34463
34463
|
table.data ? /* @__PURE__ */ (0, import_jsx_runtime111.jsx)(TableFoundationSwitch, { tableId, table: table.data }) : null,
|
|
34464
34464
|
table.data ? /* @__PURE__ */ (0, import_jsx_runtime111.jsx)(TableAccessLevel, { tableId, fields: fields.data ?? [] }) : null,
|
|
34465
34465
|
/* @__PURE__ */ (0, import_jsx_runtime111.jsx)(import_design_system95.Separator, {}),
|
|
34466
|
-
(0,
|
|
34466
|
+
(0, import_records48.levelHasShownTo)(table.data?.level) ? /* @__PURE__ */ (0, import_jsx_runtime111.jsxs)(import_jsx_runtime111.Fragment, { children: [
|
|
34467
34467
|
/* @__PURE__ */ (0, import_jsx_runtime111.jsx)(NewRowsDefaults, { tableId }),
|
|
34468
34468
|
/* @__PURE__ */ (0, import_jsx_runtime111.jsx)(import_design_system95.Separator, {})
|
|
34469
34469
|
] }) : null,
|
|
@@ -34547,7 +34547,7 @@ function TableSettingsPanel({
|
|
|
34547
34547
|
|
|
34548
34548
|
// src/Peek.tsx
|
|
34549
34549
|
var import_react204 = require("react");
|
|
34550
|
-
var
|
|
34550
|
+
var import_records51 = require("@ai-matrx/records");
|
|
34551
34551
|
var import_react205 = require("@ai-matrx/records/react");
|
|
34552
34552
|
var import_react206 = require("@ai-matrx/alchemy/react");
|
|
34553
34553
|
|
|
@@ -34783,7 +34783,7 @@ init_Refusal();
|
|
|
34783
34783
|
|
|
34784
34784
|
// src/ValueAlternates.tsx
|
|
34785
34785
|
var import_react199 = require("react");
|
|
34786
|
-
var
|
|
34786
|
+
var import_records49 = require("@ai-matrx/records");
|
|
34787
34787
|
var import_react200 = require("@ai-matrx/records/react");
|
|
34788
34788
|
var import_text_case13 = require("@ai-matrx/kit/text-case");
|
|
34789
34789
|
var import_design_system97 = require("@ai-matrx/design-system");
|
|
@@ -34839,7 +34839,7 @@ function ValueAlternates({
|
|
|
34839
34839
|
async function use(index) {
|
|
34840
34840
|
setBusy(index);
|
|
34841
34841
|
setRefusal(null);
|
|
34842
|
-
const written = await (0,
|
|
34842
|
+
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
34843
|
setBusy(null);
|
|
34844
34844
|
if (!written.ok) return setRefusal(written.error);
|
|
34845
34845
|
setOpen(false);
|
|
@@ -34978,7 +34978,7 @@ init_names();
|
|
|
34978
34978
|
// src/RecordBody.tsx
|
|
34979
34979
|
var import_react202 = require("react");
|
|
34980
34980
|
var import_design_system99 = require("@ai-matrx/design-system");
|
|
34981
|
-
var
|
|
34981
|
+
var import_records50 = require("@ai-matrx/records");
|
|
34982
34982
|
var import_react203 = require("@ai-matrx/records/react");
|
|
34983
34983
|
init_host();
|
|
34984
34984
|
init_recordVersions();
|
|
@@ -34987,7 +34987,7 @@ init_writeOnTheWinningVersion();
|
|
|
34987
34987
|
var import_jsx_runtime116 = require("react/jsx-runtime");
|
|
34988
34988
|
var BODY_NAMES = /^(notes?|page|body|content|page content|details|description)$/i;
|
|
34989
34989
|
function bodyFieldOf(fields) {
|
|
34990
|
-
const rich2 = fields.filter((field2) => (0,
|
|
34990
|
+
const rich2 = fields.filter((field2) => (0, import_records50.newerKindOf)(field2) === "rich_text");
|
|
34991
34991
|
return rich2.find((field2) => BODY_NAMES.test((field2.label ?? field2.key).trim()) || BODY_NAMES.test(field2.key.replace(/_/g, " "))) ?? rich2[0];
|
|
34992
34992
|
}
|
|
34993
34993
|
var BODY_COLUMN_NAME = "Notes";
|
|
@@ -35113,7 +35113,7 @@ function Peek({ tableId, recordId, onClose, className, onPage = false }) {
|
|
|
35113
35113
|
if (record.error) return /* @__PURE__ */ (0, import_jsx_runtime117.jsx)(RefusalNotice, { error: record.error, className });
|
|
35114
35114
|
if (fields.error) return /* @__PURE__ */ (0, import_jsx_runtime117.jsx)(RefusalNotice, { error: fields.error, className });
|
|
35115
35115
|
const document2 = record.data?.document;
|
|
35116
|
-
if (document2 && (0,
|
|
35116
|
+
if (document2 && (0, import_records51.isLockedStub)({ document: document2, level: null })) {
|
|
35117
35117
|
const filed = document2["submitted_at"];
|
|
35118
35118
|
const when = typeof filed === "string" && !Number.isNaN(Date.parse(filed)) ? new Date(filed).toLocaleDateString("en-US", { year: "numeric", month: "short", day: "numeric" }) : null;
|
|
35119
35119
|
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 +35458,7 @@ function lookAfterReset(look) {
|
|
|
35458
35458
|
// src/ViewSwitcher.tsx
|
|
35459
35459
|
var import_react234 = require("react");
|
|
35460
35460
|
var import_react235 = require("@ai-matrx/records/react");
|
|
35461
|
-
var
|
|
35461
|
+
var import_records56 = require("@ai-matrx/records");
|
|
35462
35462
|
var import_design_system111 = require("@ai-matrx/design-system");
|
|
35463
35463
|
var import_data_table22 = require("@ai-matrx/design-system/data-table");
|
|
35464
35464
|
var import_format10 = require("@ai-matrx/kit/format");
|
|
@@ -35662,7 +35662,7 @@ function MoveRefusedBadge({ refused }) {
|
|
|
35662
35662
|
// src/Pipeline.tsx
|
|
35663
35663
|
var import_react211 = require("react");
|
|
35664
35664
|
var import_react212 = require("@ai-matrx/records/react");
|
|
35665
|
-
var
|
|
35665
|
+
var import_records52 = require("@ai-matrx/records");
|
|
35666
35666
|
var import_design_system102 = require("@ai-matrx/design-system");
|
|
35667
35667
|
var import_data_table17 = require("@ai-matrx/design-system/data-table");
|
|
35668
35668
|
init_recordVersions();
|
|
@@ -35777,7 +35777,7 @@ function PipelineBoard({
|
|
|
35777
35777
|
alive.current = false;
|
|
35778
35778
|
};
|
|
35779
35779
|
}, []);
|
|
35780
|
-
const filterKey = (0,
|
|
35780
|
+
const filterKey = (0, import_records52.stableFilterKey)(filter);
|
|
35781
35781
|
const reload = (0, import_react211.useCallback)(async () => {
|
|
35782
35782
|
setLoading(true);
|
|
35783
35783
|
const [read, board, held] = await Promise.all([
|
|
@@ -36530,7 +36530,7 @@ function useRowColorBy(all, colorKey, style) {
|
|
|
36530
36530
|
}
|
|
36531
36531
|
|
|
36532
36532
|
// src/workedOutDate.ts
|
|
36533
|
-
var
|
|
36533
|
+
var import_records53 = require("@ai-matrx/records");
|
|
36534
36534
|
var WORKED_OUT_DATE_LOCK = "Worked out \xB7 can't move";
|
|
36535
36535
|
var INLINE_DEPTH = 8;
|
|
36536
36536
|
var configOf = (field2) => field2?.config ?? {};
|
|
@@ -36602,7 +36602,7 @@ function formulaResultKind(node, all) {
|
|
|
36602
36602
|
if (op2 === "fx.min" || op2 === "fx.max") {
|
|
36603
36603
|
return args.length > 0 && args.every((a) => formulaResultKind(a, all) === "date") ? "date" : "number";
|
|
36604
36604
|
}
|
|
36605
|
-
return
|
|
36605
|
+
return import_records53.FORMULA_NODE_RESULTS[op2] ?? "unknown";
|
|
36606
36606
|
}
|
|
36607
36607
|
function isDateFormula(field2, all) {
|
|
36608
36608
|
const expr = ownExpression(field2);
|
|
@@ -39189,14 +39189,14 @@ function ListRow({
|
|
|
39189
39189
|
// src/ChartLayout.tsx
|
|
39190
39190
|
var import_react232 = require("react");
|
|
39191
39191
|
var import_react233 = require("@ai-matrx/records/react");
|
|
39192
|
-
var
|
|
39192
|
+
var import_records55 = require("@ai-matrx/records");
|
|
39193
39193
|
var import_design_system110 = require("@ai-matrx/design-system");
|
|
39194
39194
|
|
|
39195
39195
|
// src/ChartBlock.tsx
|
|
39196
39196
|
var import_react231 = require("react");
|
|
39197
39197
|
var import_recharts = require("recharts");
|
|
39198
|
-
var
|
|
39199
|
-
var
|
|
39198
|
+
var import_records54 = require("@ai-matrx/records");
|
|
39199
|
+
var import_core27 = require("@ai-matrx/records/core");
|
|
39200
39200
|
var import_design_system109 = require("@ai-matrx/design-system");
|
|
39201
39201
|
var import_format9 = require("@ai-matrx/kit/format");
|
|
39202
39202
|
init_Refusal();
|
|
@@ -39662,7 +39662,7 @@ function pretty(n) {
|
|
|
39662
39662
|
return Number.isInteger(n) ? n.toLocaleString() : n.toLocaleString(void 0, { maximumFractionDigits: 2 });
|
|
39663
39663
|
}
|
|
39664
39664
|
function asRefusal2(block) {
|
|
39665
|
-
return (0,
|
|
39665
|
+
return (0, import_core27.mapPgError)(
|
|
39666
39666
|
{
|
|
39667
39667
|
message: block.refused ?? "",
|
|
39668
39668
|
...block.sqlstate ? { code: block.sqlstate } : {}
|
|
@@ -39677,7 +39677,7 @@ function ChartBlock({ block, subject, tableName: tableName2, className, centerVa
|
|
|
39677
39677
|
const kind2 = block.kind;
|
|
39678
39678
|
const tableId = block.table_id ?? subject;
|
|
39679
39679
|
const measures = block.measures && block.measures.length > 0 ? block.measures : [{ op: "count" }];
|
|
39680
|
-
const primary = (0,
|
|
39680
|
+
const primary = (0, import_records54.measureKey)(measures[0]);
|
|
39681
39681
|
const windows = kind2 === "stuck" ? null : block.compare ?? null;
|
|
39682
39682
|
const compared = !!windows;
|
|
39683
39683
|
const grain = block.bucket?.by ?? null;
|
|
@@ -40122,7 +40122,7 @@ var isChartKind = (v) => v === "bar" || v === "line" || v === "donut";
|
|
|
40122
40122
|
var isChartMeasure = (v) => v === "count" || v === "sum" || v === "avg";
|
|
40123
40123
|
function defaultChartGroup(fields) {
|
|
40124
40124
|
return fields.find((f) => {
|
|
40125
|
-
const kind2 = (0,
|
|
40125
|
+
const kind2 = (0, import_records55.fieldKindFor)(f);
|
|
40126
40126
|
return kind2 === "select" || kind2 === "multi_select";
|
|
40127
40127
|
})?.key ?? null;
|
|
40128
40128
|
}
|
|
@@ -40181,7 +40181,7 @@ function ChartLayout({ view, fields, filter, onChange, remembered }) {
|
|
|
40181
40181
|
}, [client, view.subject, view.name, qKey, filterKey]);
|
|
40182
40182
|
const groupable = fields.filter((f) => !["attachment", "file", "formula", "button"].includes(String(f.type)));
|
|
40183
40183
|
const numeric = fields.filter((f) => NUMBER_TYPES.has(String(f.type)));
|
|
40184
|
-
const pickMeasure = (0,
|
|
40184
|
+
const pickMeasure = (0, import_records55.measureKey)(q.measure);
|
|
40185
40185
|
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
40186
|
/* @__PURE__ */ (0, import_jsx_runtime130.jsxs)("div", { className: "flex flex-wrap items-center gap-2 text-xs", children: [
|
|
40187
40187
|
/* @__PURE__ */ (0, import_jsx_runtime130.jsx)("span", { className: "text-muted-foreground", children: "Group by" }),
|
|
@@ -40220,7 +40220,7 @@ var NO_FIELDS2 = [];
|
|
|
40220
40220
|
function useViewRecords(view, pageSize = 200, filter, viewId) {
|
|
40221
40221
|
const client = (0, import_react235.useRecordsClient)();
|
|
40222
40222
|
const [limit, setLimit] = (0, import_react234.useState)(pageSize);
|
|
40223
|
-
const questionKey = `${view.subject}|${(0,
|
|
40223
|
+
const questionKey = `${view.subject}|${(0, import_records56.stableFilterKey)(filter ?? null)}|${JSON.stringify(view.sorts ?? [])}`;
|
|
40224
40224
|
(0, import_react234.useEffect)(() => {
|
|
40225
40225
|
setLimit(pageSize);
|
|
40226
40226
|
}, [questionKey, pageSize]);
|
|
@@ -40253,8 +40253,8 @@ function useViewRecords(view, pageSize = 200, filter, viewId) {
|
|
|
40253
40253
|
cancelled = true;
|
|
40254
40254
|
};
|
|
40255
40255
|
}, [client, ruleId, pageSize]);
|
|
40256
|
-
const asked4 = (0,
|
|
40257
|
-
const fromView = asked4 !== "{}" && (asked4 === (0,
|
|
40256
|
+
const asked4 = (0, import_records56.stableFilterKey)(filter ?? null);
|
|
40257
|
+
const fromView = asked4 !== "{}" && (asked4 === (0, import_records56.stableFilterKey)(view.where ?? null) || asked4 === (0, import_records56.stableFilterKey)(view.filters ?? null));
|
|
40258
40258
|
const tableRows = (0, import_react234.useMemo)(() => table.data?.rows ?? [], [table.data]);
|
|
40259
40259
|
const manual = view.order === "manual" && Boolean(viewId) && !ruleId;
|
|
40260
40260
|
const hand = useHandOrderRows({
|
|
@@ -41372,7 +41372,7 @@ function RecordCard({
|
|
|
41372
41372
|
/* @__PURE__ */ (0, import_jsx_runtime131.jsx)("span", { className: "block truncate", children: label }),
|
|
41373
41373
|
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
41374
|
dates && dates.length > 0 ? /* @__PURE__ */ (0, import_jsx_runtime131.jsx)(CardDates, { record, fields: dates }) : null,
|
|
41375
|
-
(fields ?? []).filter((f) => (0,
|
|
41375
|
+
(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
41376
|
RecordValue,
|
|
41377
41377
|
{
|
|
41378
41378
|
field: f,
|
|
@@ -41393,12 +41393,12 @@ function cardHiddenOf(presentation) {
|
|
|
41393
41393
|
}
|
|
41394
41394
|
var STATUS_WORDS = /^(status|stage|state|progress|phase)$/i;
|
|
41395
41395
|
function boardDefaultGroupField(eligible) {
|
|
41396
|
-
return eligible.find((f) => (0,
|
|
41396
|
+
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
41397
|
}
|
|
41398
41398
|
|
|
41399
41399
|
// src/ArchivedView.tsx
|
|
41400
41400
|
var import_react236 = require("react");
|
|
41401
|
-
var
|
|
41401
|
+
var import_records57 = require("@ai-matrx/records");
|
|
41402
41402
|
var import_react237 = require("@ai-matrx/records/react");
|
|
41403
41403
|
var import_design_system112 = require("@ai-matrx/design-system");
|
|
41404
41404
|
init_Refusal();
|
|
@@ -41412,7 +41412,7 @@ function mayNotRestoreLine(why) {
|
|
|
41412
41412
|
return said2 === "" ? "Bringing a record back needs permission to edit this table. Ask somebody who has it." : said2;
|
|
41413
41413
|
}
|
|
41414
41414
|
function archivedRowLine(row, titleKey) {
|
|
41415
|
-
return `${recordName(row.document, titleKey)} \u2014 ${(0,
|
|
41415
|
+
return `${recordName(row.document, titleKey)} \u2014 ${(0, import_records57.archivedByLine)(row)}`;
|
|
41416
41416
|
}
|
|
41417
41417
|
function ArchivedView({
|
|
41418
41418
|
tableId,
|
|
@@ -41426,7 +41426,7 @@ function ArchivedView({
|
|
|
41426
41426
|
const table = (0, import_react237.useTable)(tableId);
|
|
41427
41427
|
const rights = useTableRights(table.data);
|
|
41428
41428
|
const fields = (0, import_react237.useFields)(tableId);
|
|
41429
|
-
const [lane, setLane] = (0, import_react236.useState)(laneFromHost ??
|
|
41429
|
+
const [lane, setLane] = (0, import_react236.useState)(laneFromHost ?? import_records57.DEFAULT_ARCHIVE_LANE);
|
|
41430
41430
|
const [rows, setRows] = (0, import_react236.useState)([]);
|
|
41431
41431
|
const [loading, setLoading] = (0, import_react236.useState)(true);
|
|
41432
41432
|
const [error, setError] = (0, import_react236.useState)(null);
|
|
@@ -41473,15 +41473,15 @@ function ArchivedView({
|
|
|
41473
41473
|
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
41474
|
/* @__PURE__ */ (0, import_jsx_runtime132.jsxs)("div", { className: "flex flex-wrap items-center gap-2", children: [
|
|
41475
41475
|
/* @__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:
|
|
41476
|
+
/* @__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
41477
|
import_design_system112.Button,
|
|
41478
41478
|
{
|
|
41479
41479
|
size: "sm",
|
|
41480
41480
|
variant: option === lane ? "secondary" : "ghost",
|
|
41481
41481
|
"aria-pressed": option === lane,
|
|
41482
|
-
title:
|
|
41482
|
+
title: import_records57.ARCHIVE_LANE_MEANS[option],
|
|
41483
41483
|
onClick: () => pick(option),
|
|
41484
|
-
children:
|
|
41484
|
+
children: import_records57.ARCHIVE_LANE_LABEL[option]
|
|
41485
41485
|
},
|
|
41486
41486
|
option
|
|
41487
41487
|
)) })
|
|
@@ -41497,7 +41497,7 @@ function ArchivedView({
|
|
|
41497
41497
|
),
|
|
41498
41498
|
error ? /* @__PURE__ */ (0, import_jsx_runtime132.jsx)(RefusalNotice, { error }) : null,
|
|
41499
41499
|
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,
|
|
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, import_records57.emptyArchiveLine)(lane) }) : null,
|
|
41501
41501
|
!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
41502
|
"li",
|
|
41503
41503
|
{
|
|
@@ -41507,7 +41507,7 @@ function ArchivedView({
|
|
|
41507
41507
|
children: [
|
|
41508
41508
|
/* @__PURE__ */ (0, import_jsx_runtime132.jsxs)("div", { className: "flex min-w-0 flex-1 flex-col", children: [
|
|
41509
41509
|
/* @__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,
|
|
41510
|
+
/* @__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
41511
|
refusal3 && refusal3.recordId === row.id ? /* @__PURE__ */ (0, import_jsx_runtime132.jsx)(RefusalNotice, { error: refusal3.error, className: "mt-2" }) : null
|
|
41512
41512
|
] }),
|
|
41513
41513
|
mayRestore ? /* @__PURE__ */ (0, import_jsx_runtime132.jsx)(
|
|
@@ -41530,7 +41530,7 @@ function ArchivedView({
|
|
|
41530
41530
|
] });
|
|
41531
41531
|
}
|
|
41532
41532
|
function retiredColumnLine(row) {
|
|
41533
|
-
return (0,
|
|
41533
|
+
return (0, import_records57.archivedByLine)(row);
|
|
41534
41534
|
}
|
|
41535
41535
|
function RetiredColumns({ tableId, mayRestore, whyNot }) {
|
|
41536
41536
|
const client = (0, import_react237.useRecordsClient)();
|
|
@@ -41594,7 +41594,7 @@ function RetiredColumns({ tableId, mayRestore, whyNot }) {
|
|
|
41594
41594
|
|
|
41595
41595
|
// src/ArchivedDisclosure.tsx
|
|
41596
41596
|
var import_react238 = require("react");
|
|
41597
|
-
var
|
|
41597
|
+
var import_records58 = require("@ai-matrx/records");
|
|
41598
41598
|
var import_react239 = require("@ai-matrx/records/react");
|
|
41599
41599
|
var import_design_system113 = require("@ai-matrx/design-system");
|
|
41600
41600
|
init_Refusal();
|
|
@@ -41695,10 +41695,10 @@ function ArchivedPortals({
|
|
|
41695
41695
|
error ? /* @__PURE__ */ (0, import_jsx_runtime133.jsx)(RefusalNotice, { error }) : null,
|
|
41696
41696
|
rows === null && !error ? /* @__PURE__ */ (0, import_jsx_runtime133.jsx)(import_design_system113.Skeleton, { className: "h-16 w-full" }) : null,
|
|
41697
41697
|
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,
|
|
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, import_records58.emptyPortalArchiveLine)() }) : null,
|
|
41699
41699
|
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
41700
|
const asking = confirming === portal.portal_id;
|
|
41701
|
-
const matches2 = (0,
|
|
41701
|
+
const matches2 = (0, import_records58.portalTitleTypedBack)(typed2, portal.title);
|
|
41702
41702
|
return /* @__PURE__ */ (0, import_jsx_runtime133.jsxs)(
|
|
41703
41703
|
"li",
|
|
41704
41704
|
{
|
|
@@ -41737,7 +41737,7 @@ function ArchivedPortals({
|
|
|
41737
41737
|
] }),
|
|
41738
41738
|
asking ? /* @__PURE__ */ (0, import_jsx_runtime133.jsxs)("div", { className: "flex flex-col gap-1.5", children: [
|
|
41739
41739
|
/* @__PURE__ */ (0, import_jsx_runtime133.jsxs)("p", { className: "text-xs text-muted-foreground", children: [
|
|
41740
|
-
(0,
|
|
41740
|
+
(0, import_records58.portalConfirmLine)(portal.title),
|
|
41741
41741
|
" Restoring it puts it back exactly as it was: everyone who was invited can sign in again, and it shows the same Tables."
|
|
41742
41742
|
] }),
|
|
41743
41743
|
/* @__PURE__ */ (0, import_jsx_runtime133.jsxs)("div", { className: "flex flex-wrap items-center gap-1.5", children: [
|
|
@@ -41779,7 +41779,7 @@ var import_react241 = require("react");
|
|
|
41779
41779
|
var import_react242 = require("@ai-matrx/records/react");
|
|
41780
41780
|
var import_design_system114 = require("@ai-matrx/design-system");
|
|
41781
41781
|
var import_controls5 = require("@ai-matrx/design-system/controls");
|
|
41782
|
-
var
|
|
41782
|
+
var import_core28 = require("@dnd-kit/core");
|
|
41783
41783
|
var import_sortable = require("@dnd-kit/sortable");
|
|
41784
41784
|
var import_utilities = require("@dnd-kit/utilities");
|
|
41785
41785
|
init_Refusal();
|
|
@@ -41874,7 +41874,7 @@ function seedIsSatisfied(seed, views) {
|
|
|
41874
41874
|
return seed.isDefault === true && views.some((v) => v.isDefault);
|
|
41875
41875
|
}
|
|
41876
41876
|
function SectionBox({ id, children, ...rest }) {
|
|
41877
|
-
const { setNodeRef, isOver } = (0,
|
|
41877
|
+
const { setNodeRef, isOver } = (0, import_core28.useDroppable)({ id });
|
|
41878
41878
|
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
41879
|
}
|
|
41880
41880
|
function SortableRow({ id, disabled, children }) {
|
|
@@ -41929,7 +41929,7 @@ function ViewBar({ tableId, activeViewId, onActiveView, seed, settings, onViews,
|
|
|
41929
41929
|
const [renamingSection, setRenamingSection] = (0, import_react241.useState)(null);
|
|
41930
41930
|
const [dragging, setDragging] = (0, import_react241.useState)(false);
|
|
41931
41931
|
const justDragged = (0, import_react241.useRef)(false);
|
|
41932
|
-
const sensors = (0,
|
|
41932
|
+
const sensors = (0, import_core28.useSensors)((0, import_core28.useSensor)(import_core28.PointerSensor, { activationConstraint: { distance: 6 } }));
|
|
41933
41933
|
async function dropped(event) {
|
|
41934
41934
|
setDragging(false);
|
|
41935
41935
|
justDragged.current = true;
|
|
@@ -42184,7 +42184,7 @@ function ViewBar({ tableId, activeViewId, onActiveView, seed, settings, onViews,
|
|
|
42184
42184
|
) }),
|
|
42185
42185
|
/* @__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
42186
|
/* @__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)(
|
|
42187
|
+
/* @__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
42188
|
const groups = (0, import_views2.groupViewsBySection)(views);
|
|
42189
42189
|
return groups.some((g) => g.name === null) || !dragging ? groups : [{ name: null, views: [] }, ...groups];
|
|
42190
42190
|
})().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 +44203,7 @@ init_Refusal();
|
|
|
44203
44203
|
|
|
44204
44204
|
// src/AsOfReading.tsx
|
|
44205
44205
|
var import_react250 = require("react");
|
|
44206
|
-
var
|
|
44206
|
+
var import_records59 = require("@ai-matrx/records");
|
|
44207
44207
|
var import_react251 = require("@ai-matrx/records/react");
|
|
44208
44208
|
var import_design_system118 = require("@ai-matrx/design-system");
|
|
44209
44209
|
var import_controls7 = require("@ai-matrx/design-system/controls");
|
|
@@ -44228,7 +44228,7 @@ function asOfArgs(record_id, asOf, zone = getPersonTimeZone()) {
|
|
|
44228
44228
|
return asOf.clock === "recorded" ? { record_id, recorded_at: endOfDayIso(asOf.day, zone) } : { record_id, world_on: asOf.day };
|
|
44229
44229
|
}
|
|
44230
44230
|
function AsOfControl({ value, onChange, className }) {
|
|
44231
|
-
const [text, setText] = (0, import_react250.useState)(value ? (0,
|
|
44231
|
+
const [text, setText] = (0, import_react250.useState)(value ? (0, import_records59.typedDateText)(value.day) : "");
|
|
44232
44232
|
const [bad, setBad] = (0, import_react250.useState)(false);
|
|
44233
44233
|
usePersonTimeZone();
|
|
44234
44234
|
const clock = value?.clock ?? "recorded";
|
|
@@ -44238,13 +44238,13 @@ function AsOfControl({ value, onChange, className }) {
|
|
|
44238
44238
|
onChange(null);
|
|
44239
44239
|
return;
|
|
44240
44240
|
}
|
|
44241
|
-
const read = (0,
|
|
44241
|
+
const read = (0, import_records59.readTypedDate)(words2);
|
|
44242
44242
|
if (!read.ok) {
|
|
44243
44243
|
setBad(true);
|
|
44244
44244
|
return;
|
|
44245
44245
|
}
|
|
44246
44246
|
setBad(false);
|
|
44247
|
-
setText((0,
|
|
44247
|
+
setText((0, import_records59.typedDateText)(read.day));
|
|
44248
44248
|
onChange({ day: read.day, clock });
|
|
44249
44249
|
}
|
|
44250
44250
|
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 +44349,7 @@ function AsOfReading({
|
|
|
44349
44349
|
if (answer.doc === null) {
|
|
44350
44350
|
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
44351
|
"Not there on ",
|
|
44352
|
-
(0,
|
|
44352
|
+
(0, import_records59.typedDateText)(asOf.day)
|
|
44353
44353
|
] });
|
|
44354
44354
|
}
|
|
44355
44355
|
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 +45903,7 @@ function clientNoun(table) {
|
|
|
45903
45903
|
var import_clipboard8 = require("@ai-matrx/kit/clipboard");
|
|
45904
45904
|
var import_react266 = require("react");
|
|
45905
45905
|
var import_react267 = require("@ai-matrx/records/react");
|
|
45906
|
-
var
|
|
45906
|
+
var import_records60 = require("@ai-matrx/records");
|
|
45907
45907
|
var import_design_system127 = require("@ai-matrx/design-system");
|
|
45908
45908
|
init_BuildOrAsk();
|
|
45909
45909
|
|
|
@@ -46351,7 +46351,7 @@ function PortalsPanel({ tableId, activePortalId, className }) {
|
|
|
46351
46351
|
] }) : null,
|
|
46352
46352
|
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
46353
|
/* @__PURE__ */ (0, import_jsx_runtime147.jsx)("ul", { className: "flex flex-col gap-2", children: shown5.map((portal) => {
|
|
46354
|
-
const url = `${origin}${(0,
|
|
46354
|
+
const url = `${origin}${(0, import_records60.portalPath)(portal.slug)}`;
|
|
46355
46355
|
const open = openId === portal.portal_id;
|
|
46356
46356
|
const linked = portal.portal_id === activePortalId;
|
|
46357
46357
|
return /* @__PURE__ */ (0, import_jsx_runtime147.jsxs)(
|
|
@@ -46466,8 +46466,8 @@ function ArchivePortalControl({
|
|
|
46466
46466
|
}
|
|
46467
46467
|
),
|
|
46468
46468
|
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,
|
|
46469
|
+
/* @__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) }),
|
|
46470
|
+
/* @__PURE__ */ (0, import_jsx_runtime147.jsx)("p", { className: "text-xs text-muted-foreground", children: (0, import_records60.portalConfirmLine)(portal.title) }),
|
|
46471
46471
|
/* @__PURE__ */ (0, import_jsx_runtime147.jsxs)("div", { className: "flex flex-wrap items-center gap-1.5", children: [
|
|
46472
46472
|
/* @__PURE__ */ (0, import_jsx_runtime147.jsx)(
|
|
46473
46473
|
import_design_system127.BasicInput,
|
|
@@ -46485,7 +46485,7 @@ function ArchivePortalControl({
|
|
|
46485
46485
|
size: "sm",
|
|
46486
46486
|
variant: "destructive",
|
|
46487
46487
|
"data-testid": "portal-archive-do",
|
|
46488
|
-
disabled: busy || !(0,
|
|
46488
|
+
disabled: busy || !(0, import_records60.portalTitleTypedBack)(typed2, portal.title),
|
|
46489
46489
|
onClick: () => void go(),
|
|
46490
46490
|
children: busy ? "Archiving\u2026" : "Archive it"
|
|
46491
46491
|
}
|
|
@@ -47010,7 +47010,7 @@ function FormLookFrame({ look, title, children, contained = false, showOwnerHead
|
|
|
47010
47010
|
// src/DigestScheduler.tsx
|
|
47011
47011
|
var import_react268 = require("react");
|
|
47012
47012
|
var import_react269 = require("@ai-matrx/records/react");
|
|
47013
|
-
var
|
|
47013
|
+
var import_records61 = require("@ai-matrx/records");
|
|
47014
47014
|
var import_design_system129 = require("@ai-matrx/design-system");
|
|
47015
47015
|
var import_controls9 = require("@ai-matrx/design-system/controls");
|
|
47016
47016
|
init_Refusal();
|
|
@@ -47101,7 +47101,7 @@ function DigestScheduler({
|
|
|
47101
47101
|
const [channel, setChannel] = (0, import_react268.useState)(
|
|
47102
47102
|
existing?.channel === "email" || existing?.channel === "sms" ? existing.channel : "in_app"
|
|
47103
47103
|
);
|
|
47104
|
-
const [quiet2, setQuiet] = (0, import_react268.useState)((0,
|
|
47104
|
+
const [quiet2, setQuiet] = (0, import_react268.useState)((0, import_records61.hasQuietHours)(existing?.quiet_hours));
|
|
47105
47105
|
const [quietFrom, setQuietFrom] = (0, import_react268.useState)(existing?.quiet_hours?.start ?? "22:00");
|
|
47106
47106
|
const [quietTo, setQuietTo] = (0, import_react268.useState)(existing?.quiet_hours?.end ?? "07:00");
|
|
47107
47107
|
const [recipients, setRecipients] = (0, import_react268.useState)(
|
|
@@ -47390,7 +47390,7 @@ function DigestScheduler({
|
|
|
47390
47390
|
// src/SubscriptionsPanel.tsx
|
|
47391
47391
|
var import_react272 = require("react");
|
|
47392
47392
|
var import_react273 = require("@ai-matrx/records/react");
|
|
47393
|
-
var
|
|
47393
|
+
var import_records62 = require("@ai-matrx/records");
|
|
47394
47394
|
var import_design_system131 = require("@ai-matrx/design-system");
|
|
47395
47395
|
init_BuildOrAsk();
|
|
47396
47396
|
init_Refusal();
|
|
@@ -47760,7 +47760,7 @@ function SubscriptionsPanel({ tableId, activeRuleId, className }) {
|
|
|
47760
47760
|
"Last told you ",
|
|
47761
47761
|
new Date(subscription.last_sent_at).toLocaleString()
|
|
47762
47762
|
] }) : /* @__PURE__ */ (0, import_jsx_runtime151.jsx)("span", { children: "It has not told you anything yet." }),
|
|
47763
|
-
(0,
|
|
47763
|
+
(0, import_records62.hasQuietHours)(subscription.quiet_hours) ? /* @__PURE__ */ (0, import_jsx_runtime151.jsxs)("span", { children: [
|
|
47764
47764
|
"Not between ",
|
|
47765
47765
|
subscription.quiet_hours.start,
|
|
47766
47766
|
" and ",
|
|
@@ -47831,11 +47831,11 @@ var import_clipboard10 = require("@ai-matrx/kit/clipboard");
|
|
|
47831
47831
|
var import_design_system134 = require("@ai-matrx/design-system");
|
|
47832
47832
|
var import_controls10 = require("@ai-matrx/design-system/controls");
|
|
47833
47833
|
var import_react277 = require("react");
|
|
47834
|
-
var
|
|
47834
|
+
var import_core29 = require("@dnd-kit/core");
|
|
47835
47835
|
var import_sortable2 = require("@dnd-kit/sortable");
|
|
47836
47836
|
var import_utilities2 = require("@dnd-kit/utilities");
|
|
47837
47837
|
var import_react278 = require("@ai-matrx/records/react");
|
|
47838
|
-
var
|
|
47838
|
+
var import_records63 = require("@ai-matrx/records");
|
|
47839
47839
|
var import_design_system135 = require("@ai-matrx/design-system");
|
|
47840
47840
|
|
|
47841
47841
|
// src/FormFlowEditor.tsx
|
|
@@ -49177,7 +49177,7 @@ function FormBuilder({ tableId, seed, activeFormId, onActiveForm, startWithOne,
|
|
|
49177
49177
|
/* @__PURE__ */ (0, import_jsx_runtime154.jsx)(
|
|
49178
49178
|
PublishRow,
|
|
49179
49179
|
{
|
|
49180
|
-
url: `${publicOrigin}${(0,
|
|
49180
|
+
url: `${publicOrigin}${(0, import_records63.publicFormPath)(draft.id)}`,
|
|
49181
49181
|
state: draft.state,
|
|
49182
49182
|
mayPublish: rights.structure,
|
|
49183
49183
|
why: rights.why("structure"),
|
|
@@ -49189,7 +49189,7 @@ function FormBuilder({ tableId, seed, activeFormId, onActiveForm, startWithOne,
|
|
|
49189
49189
|
unsaved: dirty
|
|
49190
49190
|
}
|
|
49191
49191
|
),
|
|
49192
|
-
/* @__PURE__ */ (0, import_jsx_runtime154.jsx)(EmbedSnippets, { url: `${publicOrigin}${(0,
|
|
49192
|
+
/* @__PURE__ */ (0, import_jsx_runtime154.jsx)(EmbedSnippets, { url: `${publicOrigin}${(0, import_records63.publicFormPath)(draft.id)}`, label: draft.name }),
|
|
49193
49193
|
/* @__PURE__ */ (0, import_jsx_runtime154.jsx)(
|
|
49194
49194
|
NotifyOnAnswer,
|
|
49195
49195
|
{
|
|
@@ -49481,9 +49481,9 @@ function QuestionList({
|
|
|
49481
49481
|
onQuestions,
|
|
49482
49482
|
onQuestion
|
|
49483
49483
|
}) {
|
|
49484
|
-
const sensors = (0,
|
|
49485
|
-
(0,
|
|
49486
|
-
(0,
|
|
49484
|
+
const sensors = (0, import_core29.useSensors)(
|
|
49485
|
+
(0, import_core29.useSensor)(import_core29.PointerSensor, { activationConstraint: { distance: 4 } }),
|
|
49486
|
+
(0, import_core29.useSensor)(import_core29.KeyboardSensor, { coordinateGetter: import_sortable2.sortableKeyboardCoordinates })
|
|
49487
49487
|
);
|
|
49488
49488
|
const askable = askableFields([...fields]);
|
|
49489
49489
|
const unasked = askable.filter((f) => !draft.questions.some((q) => q.field === f.key));
|
|
@@ -49505,7 +49505,7 @@ function QuestionList({
|
|
|
49505
49505
|
/* @__PURE__ */ (0, import_jsx_runtime154.jsx)("span", { className: "font-medium text-foreground", children: "Questions" }),
|
|
49506
49506
|
/* @__PURE__ */ (0, import_jsx_runtime154.jsx)("span", { className: "tabular-nums", children: draft.questions.length })
|
|
49507
49507
|
] }),
|
|
49508
|
-
/* @__PURE__ */ (0, import_jsx_runtime154.jsx)(
|
|
49508
|
+
/* @__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
49509
|
QuestionRow,
|
|
49510
49510
|
{
|
|
49511
49511
|
index,
|
|
@@ -50258,7 +50258,7 @@ function SignBlock({ tableId, recordId, render, className }) {
|
|
|
50258
50258
|
// src/NotifyRuleEditor.tsx
|
|
50259
50259
|
var import_react286 = require("react");
|
|
50260
50260
|
var import_react287 = require("@ai-matrx/records/react");
|
|
50261
|
-
var
|
|
50261
|
+
var import_records64 = require("@ai-matrx/records");
|
|
50262
50262
|
var import_design_system139 = require("@ai-matrx/design-system");
|
|
50263
50263
|
var import_controls11 = require("@ai-matrx/design-system/controls");
|
|
50264
50264
|
init_Refusal();
|
|
@@ -50416,7 +50416,7 @@ function NotifyRuleEditor({ tableId, seed, chosenRuleId, onChoose, className })
|
|
|
50416
50416
|
"next ",
|
|
50417
50417
|
new Date(held.next_digest_at).toLocaleString()
|
|
50418
50418
|
] }) : null,
|
|
50419
|
-
(0,
|
|
50419
|
+
(0, import_records64.hasQuietHours)(held.quiet_hours) ? /* @__PURE__ */ (0, import_jsx_runtime158.jsxs)("span", { className: "text-muted-foreground", children: [
|
|
50420
50420
|
"quiet ",
|
|
50421
50421
|
held.quiet_hours.start,
|
|
50422
50422
|
"\u2013",
|
|
@@ -50553,7 +50553,7 @@ init_Refusal();
|
|
|
50553
50553
|
init_host();
|
|
50554
50554
|
|
|
50555
50555
|
// src/DashboardGrid.tsx
|
|
50556
|
-
var
|
|
50556
|
+
var import_core30 = require("@dnd-kit/core");
|
|
50557
50557
|
var import_sortable3 = require("@dnd-kit/sortable");
|
|
50558
50558
|
var import_utilities3 = require("@dnd-kit/utilities");
|
|
50559
50559
|
var import_design_system140 = require("@ai-matrx/design-system");
|
|
@@ -50610,7 +50610,7 @@ function withBlockIds(blocks) {
|
|
|
50610
50610
|
// src/DashboardGrid.tsx
|
|
50611
50611
|
var import_jsx_runtime159 = require("react/jsx-runtime");
|
|
50612
50612
|
var dashboardCollision = (args) => {
|
|
50613
|
-
const under = (0,
|
|
50613
|
+
const under = (0, import_core30.pointerWithin)(args);
|
|
50614
50614
|
if (under.length > 0) return under;
|
|
50615
50615
|
const at = args.collisionRect;
|
|
50616
50616
|
return args.droppableContainers.flatMap((container) => {
|
|
@@ -50620,9 +50620,9 @@ var dashboardCollision = (args) => {
|
|
|
50620
50620
|
}).sort((a, b) => a.data.value - b.data.value);
|
|
50621
50621
|
};
|
|
50622
50622
|
function DashboardGrid({ items, arranging, onMove, onSpan }) {
|
|
50623
|
-
const sensors = (0,
|
|
50624
|
-
(0,
|
|
50625
|
-
(0,
|
|
50623
|
+
const sensors = (0, import_core30.useSensors)(
|
|
50624
|
+
(0, import_core30.useSensor)(import_core30.PointerSensor, { activationConstraint: { distance: 4 } }),
|
|
50625
|
+
(0, import_core30.useSensor)(import_core30.KeyboardSensor, { coordinateGetter: import_sortable3.sortableKeyboardCoordinates })
|
|
50626
50626
|
);
|
|
50627
50627
|
const ids = items.map((item) => item.id);
|
|
50628
50628
|
function dragEnd(event) {
|
|
@@ -50632,7 +50632,7 @@ function DashboardGrid({ items, arranging, onMove, onSpan }) {
|
|
|
50632
50632
|
}
|
|
50633
50633
|
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
50634
|
if (!arranging) return grid;
|
|
50635
|
-
return /* @__PURE__ */ (0, import_jsx_runtime159.jsx)(
|
|
50635
|
+
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
50636
|
}
|
|
50637
50637
|
function GridCell2({
|
|
50638
50638
|
item,
|
|
@@ -50822,7 +50822,7 @@ function AddChart({ subject, onAdd, onClose }) {
|
|
|
50822
50822
|
var import_controls13 = require("@ai-matrx/design-system/controls");
|
|
50823
50823
|
|
|
50824
50824
|
// src/pages.ts
|
|
50825
|
-
var
|
|
50825
|
+
var import_records65 = require("@ai-matrx/records");
|
|
50826
50826
|
var PAGE_BLOCK_KINDS = [
|
|
50827
50827
|
"list",
|
|
50828
50828
|
"layout",
|
|
@@ -50916,10 +50916,10 @@ function filterTargets(filter, blocks) {
|
|
|
50916
50916
|
}
|
|
50917
50917
|
function combineFilter(base2, extra, fieldIdOf) {
|
|
50918
50918
|
const extraKeys = Object.keys(extra);
|
|
50919
|
-
if (!base2 || !(0,
|
|
50919
|
+
if (!base2 || !(0, import_records65.isRuleFilter)(base2) && Object.keys(base2).length === 0) {
|
|
50920
50920
|
return { filter: extraKeys.length > 0 ? { ...extra } : null, dropped: [] };
|
|
50921
50921
|
}
|
|
50922
|
-
if (!(0,
|
|
50922
|
+
if (!(0, import_records65.isRuleFilter)(base2)) return { filter: { ...base2, ...extra }, dropped: [] };
|
|
50923
50923
|
const dropped = [];
|
|
50924
50924
|
let rule = base2;
|
|
50925
50925
|
for (const key of extraKeys) {
|
|
@@ -52317,7 +52317,7 @@ function QuestionAnswerView({ tableId, spec, answer, fields, related = NO_RELATE
|
|
|
52317
52317
|
var import_react294 = require("react");
|
|
52318
52318
|
var import_format13 = require("@ai-matrx/kit/format");
|
|
52319
52319
|
var import_design_system144 = require("@ai-matrx/design-system");
|
|
52320
|
-
var
|
|
52320
|
+
var import_records66 = require("@ai-matrx/records");
|
|
52321
52321
|
var import_react295 = require("@ai-matrx/records/react");
|
|
52322
52322
|
init_recordVersions();
|
|
52323
52323
|
|
|
@@ -52565,7 +52565,7 @@ function TableAsk({ tableId, onOpenInQuestions, viewId }) {
|
|
|
52565
52565
|
await Promise.all(
|
|
52566
52566
|
all.filter(isChoiceField).map(async (field2) => {
|
|
52567
52567
|
const got = await (0, askOnce_exports.fieldOptionsOnce)(client, field2.id);
|
|
52568
|
-
if (got.ok) choices[field2.key] = (got.data ?? []).map((o) => (0,
|
|
52568
|
+
if (got.ok) choices[field2.key] = (got.data ?? []).map((o) => (0, import_records66.optionLabel)(o)).filter((w) => Boolean(w));
|
|
52569
52569
|
})
|
|
52570
52570
|
);
|
|
52571
52571
|
const read = questionFromWords(words2, all, choices);
|
|
@@ -52741,7 +52741,7 @@ init_host();
|
|
|
52741
52741
|
// src/PageCanvas.tsx
|
|
52742
52742
|
var import_react296 = require("react");
|
|
52743
52743
|
var import_react297 = require("@ai-matrx/records/react");
|
|
52744
|
-
var
|
|
52744
|
+
var import_core31 = require("@ai-matrx/records/core");
|
|
52745
52745
|
var import_download3 = require("@ai-matrx/kit/download");
|
|
52746
52746
|
var import_format14 = require("@ai-matrx/kit/format");
|
|
52747
52747
|
var import_design_system146 = require("@ai-matrx/design-system");
|
|
@@ -52883,7 +52883,7 @@ function useDoorRows(door, elementId, recordId) {
|
|
|
52883
52883
|
);
|
|
52884
52884
|
}
|
|
52885
52885
|
function downloadCsv(name, fields, rows) {
|
|
52886
|
-
(0, import_download3.downloadFile)(`${fileNameOf(name) || "export"}.csv`, (0,
|
|
52886
|
+
(0, import_download3.downloadFile)(`${fileNameOf(name) || "export"}.csv`, (0, import_core31.exportCsv)(fields, toRows(fields, rows)), "text/csv");
|
|
52887
52887
|
}
|
|
52888
52888
|
function CsvButton({ name, fields, rows }) {
|
|
52889
52889
|
if (rows.length === 0) return null;
|
|
@@ -53021,7 +53021,7 @@ function useMemberRows(block, viewerUserId, extra, mineOn, enabled) {
|
|
|
53021
53021
|
...q.sort.length > 0 ? { sort: q.sort } : {}
|
|
53022
53022
|
});
|
|
53023
53023
|
const reload = page.reload;
|
|
53024
|
-
(0, import_react296.useEffect)(() => (0,
|
|
53024
|
+
(0, import_react296.useEffect)(() => (0, import_core31.onRecordChanged)(() => reload()), [reload]);
|
|
53025
53025
|
return { q, page };
|
|
53026
53026
|
}
|
|
53027
53027
|
function BlockBody(inner2) {
|
|
@@ -53894,7 +53894,7 @@ function onePerKey3(all) {
|
|
|
53894
53894
|
}
|
|
53895
53895
|
|
|
53896
53896
|
// src/printPage.ts
|
|
53897
|
-
var
|
|
53897
|
+
var import_core32 = require("@ai-matrx/print/core");
|
|
53898
53898
|
var PAGE_PRINT_STYLES = `
|
|
53899
53899
|
.page-print-grid { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 12px; }
|
|
53900
53900
|
.page-print-grid > * { grid-column: span 12; break-inside: avoid; }
|
|
@@ -53905,7 +53905,7 @@ function printElement(element, title) {
|
|
|
53905
53905
|
const copy = element.cloneNode(true);
|
|
53906
53906
|
copy.querySelectorAll("button, input, select, textarea, iframe, [data-records-page-settings], [data-records-page-csv]").forEach((n) => n.remove());
|
|
53907
53907
|
copy.classList.add("page-print-grid");
|
|
53908
|
-
return (0,
|
|
53908
|
+
return (0, import_core32.openPrintWindow)((0, import_core32.buildPrintDocument)(`<h1>${escapeText(title)}</h1>${copy.innerHTML}`, title, PAGE_PRINT_STYLES), title);
|
|
53909
53909
|
}
|
|
53910
53910
|
function escapeText(text) {
|
|
53911
53911
|
return text.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">");
|
|
@@ -54455,7 +54455,7 @@ function InterfaceScreen({
|
|
|
54455
54455
|
var import_clipboard12 = require("@ai-matrx/kit/clipboard");
|
|
54456
54456
|
var import_react302 = require("react");
|
|
54457
54457
|
var import_react303 = require("@ai-matrx/records/react");
|
|
54458
|
-
var
|
|
54458
|
+
var import_records67 = require("@ai-matrx/records");
|
|
54459
54459
|
var import_design_system149 = require("@ai-matrx/design-system");
|
|
54460
54460
|
init_BuildOrAsk();
|
|
54461
54461
|
init_BuiltOnArchive();
|
|
@@ -54565,7 +54565,7 @@ function FormsPanel({ tableId, activeFormId, className }) {
|
|
|
54565
54565
|
}
|
|
54566
54566
|
) : null,
|
|
54567
54567
|
/* @__PURE__ */ (0, import_jsx_runtime168.jsx)("ul", { className: "flex flex-col gap-2", children: forms.map((form) => {
|
|
54568
|
-
const url = `${origin}${(0,
|
|
54568
|
+
const url = `${origin}${(0, import_records67.publicFormPath)(form.form_id)}`;
|
|
54569
54569
|
return /* @__PURE__ */ (0, import_jsx_runtime168.jsxs)(
|
|
54570
54570
|
"li",
|
|
54571
54571
|
{
|
|
@@ -54656,7 +54656,7 @@ init_plainWords();
|
|
|
54656
54656
|
|
|
54657
54657
|
// src/CaptureRun.tsx
|
|
54658
54658
|
var import_react304 = require("react");
|
|
54659
|
-
var
|
|
54659
|
+
var import_records68 = require("@ai-matrx/records");
|
|
54660
54660
|
var import_react305 = require("@ai-matrx/records/react");
|
|
54661
54661
|
var import_design_system150 = require("@ai-matrx/design-system");
|
|
54662
54662
|
init_host();
|
|
@@ -54714,7 +54714,7 @@ function CaptureRun({ sheetId, face: given, className }) {
|
|
|
54714
54714
|
const [sending, setSending] = (0, import_react304.useState)(false);
|
|
54715
54715
|
const queueRef = (0, import_react304.useRef)(null);
|
|
54716
54716
|
(0, import_react304.useEffect)(() => {
|
|
54717
|
-
const q2 = (0,
|
|
54717
|
+
const q2 = (0, import_records68.openCaptureQueue)({
|
|
54718
54718
|
onChange: (c, all) => {
|
|
54719
54719
|
setCounts(c);
|
|
54720
54720
|
setItems(all);
|
|
@@ -54981,7 +54981,7 @@ function CaptureRun({ sheetId, face: given, className }) {
|
|
|
54981
54981
|
value: String(answers2[q.field] ?? ""),
|
|
54982
54982
|
onChange: (e) => {
|
|
54983
54983
|
const raw = e.target.value;
|
|
54984
|
-
const answered2 = field2 ? (0,
|
|
54984
|
+
const answered2 = field2 ? (0, import_records68.coerceTypedAnswer)(field2, raw, { label: q.ask ?? (0, import_records68.coercionLabel)(field2) }) : { value: raw };
|
|
54985
54985
|
setAnswers((held) => ({
|
|
54986
54986
|
...held,
|
|
54987
54987
|
[q.field]: raw === "" ? "" : "refusal" in answered2 ? raw : answered2.value
|
|
@@ -55633,7 +55633,7 @@ init_WhereItLives();
|
|
|
55633
55633
|
// src/TablePage.tsx
|
|
55634
55634
|
var import_clipboard17 = require("@ai-matrx/kit/clipboard");
|
|
55635
55635
|
var import_react326 = require("react");
|
|
55636
|
-
var
|
|
55636
|
+
var import_records69 = require("@ai-matrx/records");
|
|
55637
55637
|
var import_react327 = require("@ai-matrx/records/react");
|
|
55638
55638
|
var import_design_system163 = require("@ai-matrx/design-system");
|
|
55639
55639
|
init_names();
|
|
@@ -55747,9 +55747,9 @@ function CalendarSubscribeDialog({
|
|
|
55747
55747
|
|
|
55748
55748
|
// src/viewShare.ts
|
|
55749
55749
|
var import_clipboard15 = require("@ai-matrx/kit/clipboard");
|
|
55750
|
-
var
|
|
55750
|
+
var import_core33 = require("@ai-matrx/print/core");
|
|
55751
55751
|
var import_markdown = require("@ai-matrx/print/markdown");
|
|
55752
|
-
var
|
|
55752
|
+
var import_core34 = require("@ai-matrx/records/core");
|
|
55753
55753
|
init_objectActions();
|
|
55754
55754
|
var NO_VIEW_REASON = "No saved view yet";
|
|
55755
55755
|
function viewLink(tableId, viewId, origin) {
|
|
@@ -55786,7 +55786,7 @@ async function downloadViewCsv(args) {
|
|
|
55786
55786
|
const columns = viewColumns(fields, view.presentation);
|
|
55787
55787
|
const rows = await rowsForFile({ client, host, fields: columns, records: read.rows, labels });
|
|
55788
55788
|
const name = fileNameOf(args.tableName) || "records";
|
|
55789
|
-
download(`${name}.csv`, "text/csv;charset=utf-8", (0,
|
|
55789
|
+
download(`${name}.csv`, "text/csv;charset=utf-8", (0, import_core34.exportCsv)(columns, rows));
|
|
55790
55790
|
host.notify?.success(read.cut ? cutWords(read.rows.length) : "CSV downloaded");
|
|
55791
55791
|
}
|
|
55792
55792
|
function downloadMarkdownAction(args) {
|
|
@@ -55815,7 +55815,7 @@ async function readViewMarkdown(args) {
|
|
|
55815
55815
|
if ("error" in read) return null;
|
|
55816
55816
|
const columns = viewColumns(fields, view.presentation);
|
|
55817
55817
|
const rows = await rowsForFile({ client, host, fields: columns, records: read.rows, labels });
|
|
55818
|
-
return { markdown: (0,
|
|
55818
|
+
return { markdown: (0, import_core34.exportMarkdown)(columns, rows), cut: read.cut, count: read.rows.length };
|
|
55819
55819
|
}
|
|
55820
55820
|
async function downloadViewMarkdown(args) {
|
|
55821
55821
|
const table = await readViewMarkdown(args);
|
|
@@ -55873,7 +55873,7 @@ async function runTablePageAction(kind2, args) {
|
|
|
55873
55873
|
}
|
|
55874
55874
|
const page = (0, import_markdown.renderMarkdownDocument)(markdown, { title, withPrintActions: kind2 === "html-preview" });
|
|
55875
55875
|
if (kind2 === "html-preview") {
|
|
55876
|
-
(0,
|
|
55876
|
+
(0, import_core33.openPrintWindow)(page, title);
|
|
55877
55877
|
if (note) args.host.notify?.success(note);
|
|
55878
55878
|
} else if (kind2 === "copy-html-page") {
|
|
55879
55879
|
if (await (0, import_clipboard15.copyText)(page)) args.host.notify?.success(note ?? "HTML page copied");
|
|
@@ -56886,7 +56886,7 @@ function TableNotHere({
|
|
|
56886
56886
|
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
56887
|
/* @__PURE__ */ (0, import_jsx_runtime182.jsx)("p", { className: "text-sm font-medium", children: "This table is archived" }),
|
|
56888
56888
|
/* @__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,
|
|
56889
|
+
/* @__PURE__ */ (0, import_jsx_runtime182.jsx)("p", { className: "text-xs text-muted-foreground", children: (0, import_records69.archivedByLine)(row) }),
|
|
56890
56890
|
refusal3 ? /* @__PURE__ */ (0, import_jsx_runtime182.jsx)(RefusalNotice, { error: refusal3 }) : null,
|
|
56891
56891
|
/* @__PURE__ */ (0, import_jsx_runtime182.jsxs)("div", { className: "flex gap-2", children: [
|
|
56892
56892
|
/* @__PURE__ */ (0, import_jsx_runtime182.jsx)(
|
|
@@ -58570,7 +58570,7 @@ init_objectActionIcons();
|
|
|
58570
58570
|
|
|
58571
58571
|
// src/DataBindingPicker.tsx
|
|
58572
58572
|
var import_react330 = require("react");
|
|
58573
|
-
var
|
|
58573
|
+
var import_records70 = require("@ai-matrx/records");
|
|
58574
58574
|
var import_react331 = require("@ai-matrx/records/react");
|
|
58575
58575
|
var import_design_system166 = require("@ai-matrx/design-system");
|
|
58576
58576
|
init_names();
|
|
@@ -58605,7 +58605,7 @@ function isCompleteDataBinding(binding) {
|
|
|
58605
58605
|
}
|
|
58606
58606
|
function bindingPlaceholdersFor(field2) {
|
|
58607
58607
|
const label = fieldName(field2);
|
|
58608
|
-
if ((0,
|
|
58608
|
+
if ((0, import_records70.isEntityReferenceConfig)(field2.config)) {
|
|
58609
58609
|
return [
|
|
58610
58610
|
{ token: `{${field2.key}.name}`, label: `${label} \xB7 name` },
|
|
58611
58611
|
{ token: `{${field2.key}.id}`, label: `${label} \xB7 id` }
|