@ai-matrx/records-ui 0.115.105 → 0.115.107
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 +26 -0
- 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 +15 -15
- package/dist/helpers.cjs.map +1 -1
- package/dist/helpers.d.cts +8 -8
- package/dist/helpers.d.ts +8 -8
- package/dist/helpers.js +2 -2
- package/dist/helpers.js.map +1 -1
- package/dist/index.cjs +162 -153
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +12 -11
- package/dist/index.d.ts +12 -11
- package/dist/index.js +53 -44
- 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 -2
- package/dist/object-actions.d.ts +2 -2
- package/dist/object-actions.js +2 -2
- package/dist/object-actions.js.map +1 -1
- package/dist/{objectActions-CfzhrXHK.d.cts → objectActions-5ffQXgZn.d.cts} +3 -3
- package/dist/{objectActions-CfzhrXHK.d.ts → objectActions-5ffQXgZn.d.ts} +3 -3
- package/dist/pickers.cjs +64 -60
- package/dist/pickers.cjs.map +1 -1
- package/dist/pickers.js +21 -17
- 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_field_kinds.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_field_kinds, 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_field_kinds = require("@ai-matrx/records/field-kinds");
|
|
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_field_kinds2.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_field_kinds2, 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_field_kinds2 = require("@ai-matrx/records/field-kinds");
|
|
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_field_kinds3.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_field_kinds3.PARITY_FIELD_TYPES.some((row) => row.parity_type === id);
|
|
653
653
|
}
|
|
654
654
|
function parityTypesWithNoExplanation() {
|
|
655
|
-
return
|
|
655
|
+
return import_field_kinds3.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_field_kinds3.DECLARABLE_FIELD_KINDS.map((row) => row.kind).filter((kind2) => !BY_ID.has(kind2));
|
|
659
659
|
}
|
|
660
|
-
var
|
|
660
|
+
var import_field_kinds3, 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_field_kinds3 = require("@ai-matrx/records/field-kinds");
|
|
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_field_kinds3.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_field_kinds3.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_field_kinds4.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_field_kinds4.isButtonField)(field2)) return "button";
|
|
738
|
+
const newer = (0, import_field_kinds4.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,16 @@ function fieldTypeLabel(field2) {
|
|
|
759
759
|
};
|
|
760
760
|
return plain2[kind2] ?? (0, import_text_case2.humanizeIdentifier)(kind2);
|
|
761
761
|
}
|
|
762
|
-
var
|
|
762
|
+
var import_field_kinds4, 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
|
-
import_core5 = require("@ai-matrx/records/core");
|
|
767
|
+
import_field_kinds4 = require("@ai-matrx/records/field-kinds");
|
|
769
768
|
import_text_case2 = require("@ai-matrx/kit/text-case");
|
|
770
769
|
init_docs();
|
|
771
770
|
init_fieldTypes();
|
|
772
|
-
kernelId = (name) =>
|
|
771
|
+
kernelId = (name) => import_field_kinds4.KERNEL_TABLES.find((t) => t.name === name)?.id ?? "";
|
|
773
772
|
KERNEL_FILE_TABLE = kernelId("File");
|
|
774
773
|
KERNEL_PERSON_TABLE = kernelId("Person");
|
|
775
774
|
PARITY_LABEL = {
|
|
@@ -789,7 +788,7 @@ var init_parity = __esm({
|
|
|
789
788
|
url: "Link"
|
|
790
789
|
};
|
|
791
790
|
PARITY_MADE_OF = Object.fromEntries(
|
|
792
|
-
|
|
791
|
+
import_field_kinds4.PARITY_FIELD_TYPES.map((p) => [p.parity_type, p.made_of])
|
|
793
792
|
);
|
|
794
793
|
KERNEL = { file: KERNEL_FILE_TABLE, person: KERNEL_PERSON_TABLE };
|
|
795
794
|
}
|
|
@@ -894,7 +893,7 @@ function RefusalNotice({
|
|
|
894
893
|
onKeepEditing,
|
|
895
894
|
onDiscard
|
|
896
895
|
}) {
|
|
897
|
-
const archivedOrg = (0,
|
|
896
|
+
const archivedOrg = (0, import_core2.archivedOrganizationId)(error);
|
|
898
897
|
if (archivedOrg) {
|
|
899
898
|
return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(ArchivedOrganizationNotice, { organizationId: archivedOrg, error, className });
|
|
900
899
|
}
|
|
@@ -950,19 +949,19 @@ function RefusalLine({ error, className }) {
|
|
|
950
949
|
{
|
|
951
950
|
"data-refusal-line": "",
|
|
952
951
|
className: (0, import_design_system3.cn)("whitespace-normal break-words text-xs text-destructive [overflow-wrap:anywhere]", className),
|
|
953
|
-
message: (0,
|
|
952
|
+
message: (0, import_core2.archivedOrganizationId)(error) ? "This organization is archived. An owner can restore it." : refusalLineForAPerson(error),
|
|
954
953
|
error,
|
|
955
954
|
origin: "records-ui/RefusalLine",
|
|
956
955
|
...plain2.forEngineers ? { "data-for-engineers": plain2.forEngineers } : {}
|
|
957
956
|
}
|
|
958
957
|
);
|
|
959
958
|
}
|
|
960
|
-
var
|
|
959
|
+
var import_core2, import_design_system3, import_jsx_runtime5;
|
|
961
960
|
var init_Refusal = __esm({
|
|
962
961
|
"src/Refusal.tsx"() {
|
|
963
962
|
"use strict";
|
|
964
963
|
"use client";
|
|
965
|
-
|
|
964
|
+
import_core2 = require("@ai-matrx/records/core");
|
|
966
965
|
import_design_system3 = require("@ai-matrx/design-system");
|
|
967
966
|
init_ArchivedOrganizationNotice();
|
|
968
967
|
init_plainWords();
|
|
@@ -1392,11 +1391,11 @@ var init_writeOnTheWinningVersion = __esm({
|
|
|
1392
1391
|
});
|
|
1393
1392
|
|
|
1394
1393
|
// src/createTable.ts
|
|
1395
|
-
var
|
|
1394
|
+
var import_field_kinds5;
|
|
1396
1395
|
var init_createTable = __esm({
|
|
1397
1396
|
"src/createTable.ts"() {
|
|
1398
1397
|
"use strict";
|
|
1399
|
-
|
|
1398
|
+
import_field_kinds5 = require("@ai-matrx/records/field-kinds");
|
|
1400
1399
|
}
|
|
1401
1400
|
});
|
|
1402
1401
|
|
|
@@ -2572,7 +2571,7 @@ function planPastedBlock(args) {
|
|
|
2572
2571
|
});
|
|
2573
2572
|
accepted[key] = judged.value;
|
|
2574
2573
|
}
|
|
2575
|
-
const predicted = (0,
|
|
2574
|
+
const predicted = (0, import_core5.predictValueRefusals)(args.fields, accepted);
|
|
2576
2575
|
for (const refusal3 of predicted) {
|
|
2577
2576
|
const key = refusal3.field_key;
|
|
2578
2577
|
if (key === void 0) continue;
|
|
@@ -2712,11 +2711,11 @@ function gridRefusalForPastedCell(field2, value) {
|
|
|
2712
2711
|
const judged = valueFromPastedText(field2, value === null ? "" : String(value));
|
|
2713
2712
|
return "refusal" in judged ? judged.refusal : void 0;
|
|
2714
2713
|
}
|
|
2715
|
-
var
|
|
2714
|
+
var import_core5, import_records15, sameWords;
|
|
2716
2715
|
var init_pasteValues = __esm({
|
|
2717
2716
|
"src/pasteValues.ts"() {
|
|
2718
2717
|
"use strict";
|
|
2719
|
-
|
|
2718
|
+
import_core5 = require("@ai-matrx/records/core");
|
|
2720
2719
|
import_records15 = require("@ai-matrx/records");
|
|
2721
2720
|
init_dates();
|
|
2722
2721
|
init_parity();
|
|
@@ -2751,7 +2750,7 @@ function refusedCellsOf(fields, rows, mapping, choiceOptions, relationNames) {
|
|
|
2751
2750
|
if ("unmatchedNames" in meant) return;
|
|
2752
2751
|
if ("refusal" in meant) why = meant.refusal;
|
|
2753
2752
|
else {
|
|
2754
|
-
const predicted = (0,
|
|
2753
|
+
const predicted = (0, import_core6.predictValueRefusals)([field2], { [key]: meant.value }).filter(
|
|
2755
2754
|
(p) => p.field_key === void 0 || p.field_key === key
|
|
2756
2755
|
);
|
|
2757
2756
|
if (predicted.length > 0) why = predicted[0].message;
|
|
@@ -2771,11 +2770,11 @@ function checkImportRules(fields, rows, mapping, choiceOptions, relationNames) {
|
|
|
2771
2770
|
}
|
|
2772
2771
|
return [...verdicts.values()];
|
|
2773
2772
|
}
|
|
2774
|
-
var
|
|
2773
|
+
var import_core6;
|
|
2775
2774
|
var init_importRuleCheck = __esm({
|
|
2776
2775
|
"src/importRuleCheck.ts"() {
|
|
2777
2776
|
"use strict";
|
|
2778
|
-
|
|
2777
|
+
import_core6 = require("@ai-matrx/records/core");
|
|
2779
2778
|
init_pasteValues();
|
|
2780
2779
|
init_parity();
|
|
2781
2780
|
}
|
|
@@ -3338,7 +3337,7 @@ function ImportWizard({ tableId, source, onDone, onWrote, autoRun, className })
|
|
|
3338
3337
|
try {
|
|
3339
3338
|
const xlsx = file.name.toLowerCase().endsWith(".xlsx");
|
|
3340
3339
|
const bytes = await file.arrayBuffer();
|
|
3341
|
-
const result = xlsx ? await (0,
|
|
3340
|
+
const result = xlsx ? await (0, import_core7.importXlsx)(bytes) : (0, import_core7.importCsv)(new TextDecoder().decode(bytes));
|
|
3342
3341
|
await planFrom(result, { name: file.name, bytes: file.size, hash: await sha256(bytes), format: xlsx ? "xlsx" : "csv" });
|
|
3343
3342
|
} catch (thrown) {
|
|
3344
3343
|
setProblem(
|
|
@@ -4534,14 +4533,14 @@ function ImportWizard({ tableId, source, onDone, onWrote, autoRun, className })
|
|
|
4534
4533
|
table.error ? /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(RefusalNotice, { error: table.error }) : null
|
|
4535
4534
|
] });
|
|
4536
4535
|
}
|
|
4537
|
-
var import_react50, import_react51,
|
|
4536
|
+
var import_react50, import_react51, import_core7, import_design_system27, import_records18, import_text_case5, import_jsx_runtime31, BATCH, SAMPLES, COLUMNS_PER_CALL, ABSENT, LEAVE, TITLE_COPY, TYPED_VALUES;
|
|
4538
4537
|
var init_ImportWizard = __esm({
|
|
4539
4538
|
"src/ImportWizard.tsx"() {
|
|
4540
4539
|
"use strict";
|
|
4541
4540
|
"use client";
|
|
4542
4541
|
import_react50 = require("react");
|
|
4543
4542
|
import_react51 = require("@ai-matrx/records/react");
|
|
4544
|
-
|
|
4543
|
+
import_core7 = require("@ai-matrx/records/core");
|
|
4545
4544
|
import_design_system27 = require("@ai-matrx/design-system");
|
|
4546
4545
|
import_records18 = require("@ai-matrx/records");
|
|
4547
4546
|
init_Refusal();
|
|
@@ -4685,7 +4684,7 @@ function columnsFrom(text) {
|
|
|
4685
4684
|
function fieldsForNewColumns(columns) {
|
|
4686
4685
|
const keys = /* @__PURE__ */ new Set();
|
|
4687
4686
|
return columns.map((column, i) => {
|
|
4688
|
-
let key = (0,
|
|
4687
|
+
let key = (0, import_field_kinds5.tokenFor)(column.label) || `column_${i + 1}`;
|
|
4689
4688
|
while (keys.has(key)) key = `${key}_${i + 1}`;
|
|
4690
4689
|
keys.add(key);
|
|
4691
4690
|
const base2 = { key, label: column.label, sort: (i + 1) * 10, required: false };
|
|
@@ -4936,9 +4935,9 @@ function NewTableStart({
|
|
|
4936
4935
|
if (!trimmed || busy) return;
|
|
4937
4936
|
setBusy(true);
|
|
4938
4937
|
setError(null);
|
|
4939
|
-
const result = await (0,
|
|
4938
|
+
const result = await (0, import_field_kinds5.declareTable)(client, {
|
|
4940
4939
|
name: trimmed,
|
|
4941
|
-
slug: (0,
|
|
4940
|
+
slug: (0, import_field_kinds5.tokenFor)(trimmed),
|
|
4942
4941
|
...columns.length > 0 ? { fields: fieldsForNewColumns(columns) } : {}
|
|
4943
4942
|
});
|
|
4944
4943
|
setBusy(false);
|
|
@@ -4960,7 +4959,7 @@ function NewTableStart({
|
|
|
4960
4959
|
const trimmed = importName.trim();
|
|
4961
4960
|
setBusy(true);
|
|
4962
4961
|
setError(null);
|
|
4963
|
-
const result = await (0,
|
|
4962
|
+
const result = await (0, import_field_kinds5.declareTable)(client, { name: trimmed, slug: (0, import_field_kinds5.tokenFor)(trimmed) });
|
|
4964
4963
|
setBusy(false);
|
|
4965
4964
|
if (!result.ok) {
|
|
4966
4965
|
setError(result.error);
|
|
@@ -6889,7 +6888,7 @@ function TablesHome({ onOpenTable, organizationName, makingOnly = false, askedBy
|
|
|
6889
6888
|
};
|
|
6890
6889
|
}, [client]);
|
|
6891
6890
|
const listed = facts.phase === "read" ? (0, import_records23.withTablePlacement)(
|
|
6892
|
-
(0,
|
|
6891
|
+
(0, import_core8.withTableFacts)(tables.data ?? [], facts.rows, me),
|
|
6893
6892
|
facts.rows
|
|
6894
6893
|
) : tables.data ?? [];
|
|
6895
6894
|
const [showEverything, setShowEverything] = (0, import_react63.useState)(false);
|
|
@@ -7033,14 +7032,14 @@ function TablesHome({ onOpenTable, organizationName, makingOnly = false, askedBy
|
|
|
7033
7032
|
}) : null
|
|
7034
7033
|
] });
|
|
7035
7034
|
}
|
|
7036
|
-
var import_react63, import_react64,
|
|
7035
|
+
var import_react63, import_react64, import_core8, 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
7036
|
var init_TablesHome = __esm({
|
|
7038
7037
|
"src/TablesHome.tsx"() {
|
|
7039
7038
|
"use strict";
|
|
7040
7039
|
"use client";
|
|
7041
7040
|
import_react63 = require("react");
|
|
7042
7041
|
import_react64 = require("@ai-matrx/records/react");
|
|
7043
|
-
|
|
7042
|
+
import_core8 = require("@ai-matrx/records/core");
|
|
7044
7043
|
import_records23 = require("@ai-matrx/records");
|
|
7045
7044
|
import_design_system37 = require("@ai-matrx/design-system");
|
|
7046
7045
|
init_NewTableStart();
|
|
@@ -7110,7 +7109,7 @@ function draftsFor(headers, rows) {
|
|
|
7110
7109
|
function keysFor(labels) {
|
|
7111
7110
|
const used = /* @__PURE__ */ new Set();
|
|
7112
7111
|
return labels.map((label, i) => {
|
|
7113
|
-
const base2 = (0,
|
|
7112
|
+
const base2 = (0, import_field_kinds5.tokenFor)(label) === "table" && !/table/i.test(label) ? `column_${i + 1}` : (0, import_field_kinds5.tokenFor)(label);
|
|
7114
7113
|
let key = base2;
|
|
7115
7114
|
let n = 2;
|
|
7116
7115
|
while (used.has(key)) key = `${base2}_${n++}`;
|
|
@@ -7220,7 +7219,7 @@ function SaveToTable({ source, shapeIndex = 0, onOpenTable, onSaved, onClose, ma
|
|
|
7220
7219
|
tableName2 = (name ?? proposedName).trim();
|
|
7221
7220
|
newId = earlier.tableId;
|
|
7222
7221
|
const lacking = fields.filter((f) => !earlier.haveKeys.has(f.key));
|
|
7223
|
-
const added = await (0,
|
|
7222
|
+
const added = await (0, import_field_kinds5.addFields)(client, newId, lacking);
|
|
7224
7223
|
if (!added.ok) {
|
|
7225
7224
|
setProblem(added.error);
|
|
7226
7225
|
setPhase("ready");
|
|
@@ -7228,7 +7227,7 @@ function SaveToTable({ source, shapeIndex = 0, onOpenTable, onSaved, onClose, ma
|
|
|
7228
7227
|
}
|
|
7229
7228
|
} else {
|
|
7230
7229
|
tableName2 = freeName(name ?? proposedName, (tables.data ?? []).map((t) => t.name));
|
|
7231
|
-
const born = await (0,
|
|
7230
|
+
const born = await (0, import_field_kinds5.declareTable)(client, { name: tableName2, fields });
|
|
7232
7231
|
if (!born.ok) {
|
|
7233
7232
|
setProblem(born.error);
|
|
7234
7233
|
setPhase("ready");
|
|
@@ -7639,7 +7638,7 @@ __export(src_exports, {
|
|
|
7639
7638
|
DATA_BINDING_MISSING: () => DATA_BINDING_MISSING,
|
|
7640
7639
|
DATA_BINDING_SHAPES: () => DATA_BINDING_SHAPES,
|
|
7641
7640
|
DEFAULT_ACTION_ORIGIN: () => DEFAULT_ACTION_ORIGIN,
|
|
7642
|
-
DEFAULT_FIELDS: () =>
|
|
7641
|
+
DEFAULT_FIELDS: () => import_field_kinds5.DEFAULT_FIELDS,
|
|
7643
7642
|
DEFAULT_FOOTER: () => DEFAULT_FOOTER,
|
|
7644
7643
|
DEFAULT_VIEW_NAME: () => DEFAULT_VIEW_NAME,
|
|
7645
7644
|
DUE_STATE_LABEL: () => DUE_STATE_LABEL,
|
|
@@ -7879,7 +7878,7 @@ __export(src_exports, {
|
|
|
7879
7878
|
actorBadge: () => actorBadge,
|
|
7880
7879
|
actorWords: () => actorWords,
|
|
7881
7880
|
addDays: () => addDays,
|
|
7882
|
-
addFields: () =>
|
|
7881
|
+
addFields: () => import_field_kinds5.addFields,
|
|
7883
7882
|
announceTableArchived: () => announceTableArchived,
|
|
7884
7883
|
applyLook: () => import_views3.applyLook,
|
|
7885
7884
|
archiveConfirmSentence: () => archiveConfirmSentence,
|
|
@@ -7934,7 +7933,7 @@ __export(src_exports, {
|
|
|
7934
7933
|
dayAt: () => dayAt,
|
|
7935
7934
|
dayKeyOf: () => dayKeyOf,
|
|
7936
7935
|
daysBetween: () => daysBetween,
|
|
7937
|
-
declareTable: () =>
|
|
7936
|
+
declareTable: () => import_field_kinds5.declareTable,
|
|
7938
7937
|
declareView: () => declareView,
|
|
7939
7938
|
defaultBindingTemplate: () => defaultBindingTemplate,
|
|
7940
7939
|
defaultViewOf: () => import_views2.defaultViewOf,
|
|
@@ -7965,7 +7964,7 @@ __export(src_exports, {
|
|
|
7965
7964
|
entityTitleColumn: () => entityTitleColumn,
|
|
7966
7965
|
entityValueText: () => entityValueText,
|
|
7967
7966
|
envelopeFor: () => envelopeFor,
|
|
7968
|
-
fieldDeclarationFor: () =>
|
|
7967
|
+
fieldDeclarationFor: () => import_field_kinds5.fieldDeclarationFor,
|
|
7969
7968
|
fieldIsEditable: () => fieldIsEditable,
|
|
7970
7969
|
fieldName: () => fieldName,
|
|
7971
7970
|
fieldToken: () => fieldToken,
|
|
@@ -8149,7 +8148,7 @@ __export(src_exports, {
|
|
|
8149
8148
|
titleRepeats: () => titleRepeats,
|
|
8150
8149
|
toDropdownEntries: () => toDropdownEntries,
|
|
8151
8150
|
toStripAndRows: () => toStripAndRows,
|
|
8152
|
-
tokenFor: () =>
|
|
8151
|
+
tokenFor: () => import_field_kinds5.tokenFor,
|
|
8153
8152
|
unknownRailLine: () => unknownRailLine,
|
|
8154
8153
|
unknownViewLine: () => import_views2.unknownViewLine,
|
|
8155
8154
|
unreadableKeys: () => question_exports.unreadableKeys,
|
|
@@ -9138,7 +9137,7 @@ function useLabelWait(field2) {
|
|
|
9138
9137
|
init_parity();
|
|
9139
9138
|
|
|
9140
9139
|
// src/tableJson.ts
|
|
9141
|
-
var
|
|
9140
|
+
var import_core = require("@ai-matrx/records/core");
|
|
9142
9141
|
var import_delimited = require("@ai-matrx/kit/delimited");
|
|
9143
9142
|
init_parity();
|
|
9144
9143
|
init_names();
|
|
@@ -9151,7 +9150,7 @@ function storedExportRows(fields, rows) {
|
|
|
9151
9150
|
}
|
|
9152
9151
|
function exportCsvWithRowIds(fields, rows, ids) {
|
|
9153
9152
|
const head = [ROW_ID_NAME, ...uniqueNames(fields)];
|
|
9154
|
-
const body = rows.map((row, at) => [ids[at] ?? "", ...fields.map((f) => (0,
|
|
9153
|
+
const body = rows.map((row, at) => [ids[at] ?? "", ...fields.map((f) => (0, import_core.exportCellText)(f, row[f.key]))]);
|
|
9155
9154
|
return (0, import_delimited.toDelimited)([head, ...body]);
|
|
9156
9155
|
}
|
|
9157
9156
|
function jsonCell(value) {
|
|
@@ -10527,7 +10526,7 @@ init_names();
|
|
|
10527
10526
|
// src/ReferenceBuilder.tsx
|
|
10528
10527
|
var import_react22 = require("react");
|
|
10529
10528
|
var import_react23 = require("@ai-matrx/records/react");
|
|
10530
|
-
var
|
|
10529
|
+
var import_core3 = require("@ai-matrx/records/core");
|
|
10531
10530
|
init_createTable();
|
|
10532
10531
|
init_Refusal();
|
|
10533
10532
|
init_tablePicking();
|
|
@@ -10616,7 +10615,7 @@ function ReferenceBuilder({
|
|
|
10616
10615
|
if (!name || making) return;
|
|
10617
10616
|
setMaking(true);
|
|
10618
10617
|
setRefused(null);
|
|
10619
|
-
const slug = (0,
|
|
10618
|
+
const slug = (0, import_field_kinds5.tokenFor)(name);
|
|
10620
10619
|
const found = await client.tableFind({ slug });
|
|
10621
10620
|
if (!found.ok) {
|
|
10622
10621
|
setMaking(false);
|
|
@@ -10630,7 +10629,7 @@ function ReferenceBuilder({
|
|
|
10630
10629
|
id = existing.id;
|
|
10631
10630
|
bornName = tableName(existing);
|
|
10632
10631
|
} else {
|
|
10633
|
-
const made = await (0,
|
|
10632
|
+
const made = await (0, import_core3.ensureTable)(client, {
|
|
10634
10633
|
name,
|
|
10635
10634
|
slug,
|
|
10636
10635
|
titleField: "name",
|
|
@@ -10649,7 +10648,7 @@ function ReferenceBuilder({
|
|
|
10649
10648
|
tables.reload();
|
|
10650
10649
|
onChange({ targetTableId: id, display: null });
|
|
10651
10650
|
};
|
|
10652
|
-
const mayMakeTable = (0,
|
|
10651
|
+
const mayMakeTable = (0, import_core3.doorReady)(client.config, import_core3.DOORS.tableFind) && (0, import_core3.doorReady)(client.config, import_core3.DOORS.tableEnsure);
|
|
10653
10652
|
const newTableButton = !mayMakeTable ? null : /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
10654
10653
|
import_design_system11.Button,
|
|
10655
10654
|
{
|
|
@@ -10863,14 +10862,14 @@ function ReferenceBuilder({
|
|
|
10863
10862
|
// src/gridEditing.tsx
|
|
10864
10863
|
var import_react90 = require("react");
|
|
10865
10864
|
var import_records35 = require("@ai-matrx/records");
|
|
10866
|
-
var
|
|
10865
|
+
var import_core11 = require("@ai-matrx/records/core");
|
|
10867
10866
|
var import_react91 = require("@ai-matrx/records/react");
|
|
10868
10867
|
var import_design_system52 = require("@ai-matrx/design-system");
|
|
10869
10868
|
|
|
10870
10869
|
// src/presentation.ts
|
|
10871
10870
|
var import_table_style3 = require("@ai-matrx/design-system/data-table/table-style");
|
|
10872
10871
|
var import_field_formats2 = require("@ai-matrx/design-system/field-formats");
|
|
10873
|
-
var
|
|
10872
|
+
var import_field_kinds6 = require("@ai-matrx/records/field-kinds");
|
|
10874
10873
|
init_parity();
|
|
10875
10874
|
init_dates();
|
|
10876
10875
|
function parseGanttLook(raw) {
|
|
@@ -11105,8 +11104,8 @@ function ungroupedForYears(field2, format) {
|
|
|
11105
11104
|
}
|
|
11106
11105
|
function formatForField(field2) {
|
|
11107
11106
|
const shownAs = shownAsOf(field2);
|
|
11108
|
-
if ((0,
|
|
11109
|
-
return { id: "rating", options: { ...shownAs?.options ?? {}, ratingMax: (0,
|
|
11107
|
+
if ((0, import_field_kinds6.newerKindOf)(field2) === "rating" && (!shownAs || shownAs.id === "rating")) {
|
|
11108
|
+
return { id: "rating", options: { ...shownAs?.options ?? {}, ratingMax: (0, import_field_kinds6.ratingMaxOf)(field2) } };
|
|
11110
11109
|
}
|
|
11111
11110
|
if (shownAs) return ungroupedForYears(field2, shownAs);
|
|
11112
11111
|
const stamp = dateFormatFor(field2);
|
|
@@ -12221,7 +12220,7 @@ function columnNameProblemLine(name, noun = "column") {
|
|
|
12221
12220
|
// src/FieldEditor.tsx
|
|
12222
12221
|
var import_react77 = require("react");
|
|
12223
12222
|
var import_react78 = require("@ai-matrx/records/react");
|
|
12224
|
-
var
|
|
12223
|
+
var import_core10 = require("@ai-matrx/records/core");
|
|
12225
12224
|
var import_design_system47 = require("@ai-matrx/design-system");
|
|
12226
12225
|
init_parity();
|
|
12227
12226
|
init_fieldTypes();
|
|
@@ -12789,11 +12788,11 @@ function Chips({
|
|
|
12789
12788
|
}
|
|
12790
12789
|
|
|
12791
12790
|
// src/values.tsx
|
|
12792
|
-
var
|
|
12791
|
+
var import_core9 = require("@ai-matrx/records/core");
|
|
12793
12792
|
|
|
12794
12793
|
// src/WholeValue.tsx
|
|
12795
12794
|
var import_react38 = require("react");
|
|
12796
|
-
var
|
|
12795
|
+
var import_core4 = require("@ai-matrx/records/core");
|
|
12797
12796
|
var import_design_system19 = require("@ai-matrx/design-system");
|
|
12798
12797
|
init_host();
|
|
12799
12798
|
init_names();
|
|
@@ -12801,7 +12800,7 @@ var import_outbound_react2 = require("@ai-matrx/kit/outbound-react");
|
|
|
12801
12800
|
var import_jsx_runtime22 = require("react/jsx-runtime");
|
|
12802
12801
|
var WHOLE_VALUE_UNBOUND = "The whole text is kept as a file, and this screen has no way to open files yet.";
|
|
12803
12802
|
function wholeValueLine(pointer) {
|
|
12804
|
-
return `Open the whole text (${(0,
|
|
12803
|
+
return `Open the whole text (${(0, import_core4.wholeValueSize)(pointer)})`;
|
|
12805
12804
|
}
|
|
12806
12805
|
function WholeValueCell({ words: words2, pointer }) {
|
|
12807
12806
|
const host = useRecordsUi();
|
|
@@ -12812,12 +12811,12 @@ function WholeValueCell({ words: words2, pointer }) {
|
|
|
12812
12811
|
words2,
|
|
12813
12812
|
"\u2026"
|
|
12814
12813
|
] }),
|
|
12815
|
-
href ? host.Link ? host.Link({ href, children: line, className: "shrink-0 text-xs text-primary underline-offset-2 hover:underline" }) : /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_outbound_react2.OutboundLink, { className: "shrink-0 text-xs text-primary underline-offset-2 hover:underline", href, children: line }) : /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("span", { className: "shrink-0 text-xs italic text-muted-foreground", title: WHOLE_VALUE_UNBOUND, children: `${(0,
|
|
12814
|
+
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_core4.wholeValueSize)(pointer)} in a file` })
|
|
12816
12815
|
] });
|
|
12817
12816
|
}
|
|
12818
12817
|
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.";
|
|
12819
12818
|
function wholeValueOpening(pointer) {
|
|
12820
|
-
return `Opening the whole text (${(0,
|
|
12819
|
+
return `Opening the whole text (${(0, import_core4.wholeValueSize)(pointer)})\u2026`;
|
|
12821
12820
|
}
|
|
12822
12821
|
function useWholeText(pointer) {
|
|
12823
12822
|
const host = useRecordsUi();
|
|
@@ -14158,14 +14157,19 @@ function Thumb({ src, size }) {
|
|
|
14158
14157
|
}
|
|
14159
14158
|
) });
|
|
14160
14159
|
}
|
|
14161
|
-
function LinkChip({ href }) {
|
|
14160
|
+
function LinkChip({ href, dense }) {
|
|
14162
14161
|
return /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)(
|
|
14163
14162
|
import_outbound_react5.OutboundLink,
|
|
14164
14163
|
{
|
|
14165
14164
|
href,
|
|
14166
14165
|
title: href,
|
|
14167
14166
|
onClick: stop,
|
|
14168
|
-
className:
|
|
14167
|
+
className: (0, import_design_system39.cn)(
|
|
14168
|
+
"inline-flex min-w-0 max-w-full items-center gap-1 rounded-md border border-border bg-muted/60 px-1.5 py-0.5 text-[11px] text-foreground hover:bg-accent",
|
|
14169
|
+
// A percentage max-width means nothing inside an auto-layout table cell, so a link column would hold
|
|
14170
|
+
// its full address; in a table the chip gets a real ceiling and shortens with an ellipsis.
|
|
14171
|
+
dense && "max-w-[7rem]"
|
|
14172
|
+
),
|
|
14169
14173
|
"data-records-link-chip": "",
|
|
14170
14174
|
children: [
|
|
14171
14175
|
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)("span", { "aria-hidden": "true", className: "text-muted-foreground", children: "\u2197" }),
|
|
@@ -14182,7 +14186,7 @@ function Scalar({ value, keyName, dense }) {
|
|
|
14182
14186
|
if (typeof value !== "string") return /* @__PURE__ */ (0, import_jsx_runtime43.jsx)("span", { children: String(value) });
|
|
14183
14187
|
const text = value.trim();
|
|
14184
14188
|
if (isImageUrl(text, keyName)) return /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(Thumb, { src: text, size: dense ? "sm" : "md" });
|
|
14185
|
-
if (isUrl(text)) return /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(LinkChip, { href: text });
|
|
14189
|
+
if (isUrl(text)) return /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(LinkChip, { href: text, dense });
|
|
14186
14190
|
if (/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(text)) {
|
|
14187
14191
|
return /* @__PURE__ */ (0, import_jsx_runtime43.jsx)("a", { href: `mailto:${text}`, onClick: stop, className: "text-primary underline-offset-2 hover:underline", children: text });
|
|
14188
14192
|
}
|
|
@@ -14200,8 +14204,8 @@ function RecordsTable({ items }) {
|
|
|
14200
14204
|
const shown5 = all ? items : items.slice(0, TABLE_ROWS);
|
|
14201
14205
|
return /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)("div", { className: "min-w-0", "data-records-structured": "table", children: [
|
|
14202
14206
|
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)("div", { className: "max-w-full overflow-x-auto rounded-md border border-border", "data-records-structured-table-frame": "", children: /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)("table", { className: "w-full border-collapse text-xs", children: [
|
|
14203
|
-
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)("thead", { className: "bg-muted/60 text-left", children: /* @__PURE__ */ (0, import_jsx_runtime43.jsx)("tr", { children: pictureFirst.map((k) => /* @__PURE__ */ (0, import_jsx_runtime43.jsx)("th", { scope: "col", className: "
|
|
14204
|
-
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)("tbody", { children: shown5.map((item, i) => /* @__PURE__ */ (0, import_jsx_runtime43.jsx)("tr", { className: "border-t border-border/60 align-top", children: pictureFirst.map((k) => /* @__PURE__ */ (0, import_jsx_runtime43.jsx)("td", { className: "min-w-[
|
|
14207
|
+
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)("thead", { className: "bg-muted/60 text-left", children: /* @__PURE__ */ (0, import_jsx_runtime43.jsx)("tr", { children: pictureFirst.map((k) => /* @__PURE__ */ (0, import_jsx_runtime43.jsx)("th", { scope: "col", className: "px-2 py-1 font-medium text-muted-foreground [overflow-wrap:anywhere]", children: keyWords(k) }, k)) }) }),
|
|
14208
|
+
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)("tbody", { children: shown5.map((item, i) => /* @__PURE__ */ (0, import_jsx_runtime43.jsx)("tr", { className: "border-t border-border/60 align-top", children: pictureFirst.map((k) => /* @__PURE__ */ (0, import_jsx_runtime43.jsx)("td", { className: "min-w-[2rem] max-w-[18rem] break-words px-2 py-1 [overflow-wrap:anywhere]", children: k in item ? /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(Nested, { value: item[k], keyName: k, dense: true }) : /* @__PURE__ */ (0, import_jsx_runtime43.jsx)("span", { className: "text-muted-foreground", children: "\u2014" }) }, k)) }, i)) })
|
|
14205
14209
|
] }) }),
|
|
14206
14210
|
items.length > TABLE_ROWS ? /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(import_design_system39.Button, { type: "button", variant: "ghost", size: "sm", className: "mt-1 h-6 px-2 text-xs", onClick: (e) => {
|
|
14207
14211
|
stop(e);
|
|
@@ -14439,7 +14443,7 @@ function renderValue(field2, value, document2, labels, stillWaitingFor, look, ro
|
|
|
14439
14443
|
if ((0, import_records24.isButtonField)(field2)) return /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(ButtonValue, { field: field2 });
|
|
14440
14444
|
const newer = newerKindValue(field2, value);
|
|
14441
14445
|
if (newer !== void 0) return newer;
|
|
14442
|
-
const whole = typeof value === "string" ? (0,
|
|
14446
|
+
const whole = typeof value === "string" ? (0, import_core9.wholeValueOf)(document2, field2.key) : null;
|
|
14443
14447
|
if (whole) return /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(WholeValueCell, { words: value, pointer: whole });
|
|
14444
14448
|
const kind2 = editorKindFor(field2);
|
|
14445
14449
|
if (kind2 === "relation" || kind2 === "entity_reference") {
|
|
@@ -14617,7 +14621,7 @@ function scalarText(field2, value, labels, stillWaitingFor) {
|
|
|
14617
14621
|
function ProvenanceBadge({ document: document2, fieldKey }) {
|
|
14618
14622
|
const envelope = envelopeFor(document2, fieldKey);
|
|
14619
14623
|
if (!envelope?.src) return null;
|
|
14620
|
-
if ((0,
|
|
14624
|
+
if ((0, import_core9.wholeValueOf)(document2, fieldKey)) return null;
|
|
14621
14625
|
const sources = document2?._sources;
|
|
14622
14626
|
const source = sources?.[envelope.src];
|
|
14623
14627
|
const label = source ? Object.values(source).map(String).join(" \xB7 ") : envelope.src;
|
|
@@ -14656,11 +14660,11 @@ function RecordValue({
|
|
|
14656
14660
|
if (newer !== void 0) return /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(import_jsx_runtime44.Fragment, { children: newer });
|
|
14657
14661
|
}
|
|
14658
14662
|
const room = inCell && !roomy ? "cell" : "full";
|
|
14659
|
-
if (value !== null && value !== void 0 && !(0,
|
|
14663
|
+
if (value !== null && value !== void 0 && !(0, import_core9.wholeValueOf)(document2, field2.key) && !envelopeFor(document2, field2.key)?.absent) {
|
|
14660
14664
|
const structured = structuredValueOf(field2, value);
|
|
14661
14665
|
if (structured) return /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(import_jsx_runtime44.Fragment, { children: structuredNode(field2, structured, room) });
|
|
14662
14666
|
}
|
|
14663
|
-
if (inCell && ui.grid === "merged" && ui.renderText && typeof value === "string" && value.trim() !== "" && editorKindFor(field2) === "long_text" && !shownAsOf(field2) && !(0,
|
|
14667
|
+
if (inCell && ui.grid === "merged" && ui.renderText && typeof value === "string" && value.trim() !== "" && editorKindFor(field2) === "long_text" && !shownAsOf(field2) && !(0, import_core9.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.
|
|
14664
14668
|
!kindValueOf(value)) {
|
|
14665
14669
|
return /* @__PURE__ */ (0, import_jsx_runtime44.jsx)("span", { className: "block h-[1.5em] min-w-0 overflow-hidden whitespace-normal [[data-matrx-cell-lines]:not([data-matrx-cell-lines=one])_&]:h-auto", "data-records-cell-text": "", children: ui.renderText(withoutLeadingBlank(value), "cell") });
|
|
14666
14670
|
}
|
|
@@ -14682,7 +14686,7 @@ function RecordValue({
|
|
|
14682
14686
|
}
|
|
14683
14687
|
}
|
|
14684
14688
|
}
|
|
14685
|
-
const pictureAt = value !== null && value !== void 0 && !(0,
|
|
14689
|
+
const pictureAt = value !== null && value !== void 0 && !(0, import_core9.wholeValueOf)(document2, field2.key) && !envelopeFor(document2, field2.key)?.absent ? imageAddressOf(field2, value) : null;
|
|
14686
14690
|
if (pictureAt) return /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(ImageUrlValue, { url: pictureAt, alt: field2.label || field2.key, room });
|
|
14687
14691
|
const shown5 = format ?? formatForField(field2);
|
|
14688
14692
|
const shape = shown5 && (shown5.id === "date" || shown5.id === "datetime") && isDateField(field2) ? dateFormatFor(field2, value) : void 0;
|
|
@@ -16498,7 +16502,7 @@ function FieldEditor(props) {
|
|
|
16498
16502
|
return;
|
|
16499
16503
|
}
|
|
16500
16504
|
(0, import_react78.tableShapeChanged)(tableId);
|
|
16501
|
-
for (const c of done.data.undo.cells_back) (0,
|
|
16505
|
+
for (const c of done.data.undo.cells_back) (0, import_core10.announceRecordChanged)(c.record_id);
|
|
16502
16506
|
const n = done.data.rehomed.reduce((sum, r) => sum + r.records, 0);
|
|
16503
16507
|
setRehome({});
|
|
16504
16508
|
setRehomed({ said: `Saved. ${n} ${n === 1 ? "record was" : "records were"} changed with the choices.`, undo: done.data.undo });
|
|
@@ -17012,7 +17016,7 @@ function FieldEditor(props) {
|
|
|
17012
17016
|
return;
|
|
17013
17017
|
}
|
|
17014
17018
|
(0, import_react78.tableShapeChanged)(tableId);
|
|
17015
|
-
for (const c of undo.cells_back) (0,
|
|
17019
|
+
for (const c of undo.cells_back) (0, import_core10.announceRecordChanged)(c.record_id);
|
|
17016
17020
|
setChoiceList(null);
|
|
17017
17021
|
setChoiceListStart(null);
|
|
17018
17022
|
setRehomed({ said: "Undone. The choices and the records that held them are back as they were.", undo: null });
|
|
@@ -17600,7 +17604,7 @@ function ButtonValue({ field: field2, recordId, inCell }) {
|
|
|
17600
17604
|
/* @__PURE__ */ (0, import_jsx_runtime53.jsxs)(import_design_system48.PopoverContent, { className: "w-72 space-y-2 p-3 text-sm", onClick: stop2, onPointerDown: stop2, "data-records-button-said": said2?.kind, children: [
|
|
17601
17605
|
said2?.kind === "refused" ? /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(RefusalLine, { error: said2.error }) : null,
|
|
17602
17606
|
said2?.kind === "waiting" ? /* @__PURE__ */ (0, import_jsx_runtime53.jsx)("p", { className: "matrx-shimmer rounded px-1 py-0.5", role: "status", "aria-live": "polite", children: said2.says }) : null,
|
|
17603
|
-
said2?.kind === "failed" ? /* @__PURE__ */ (0, import_jsx_runtime53.jsx)("p",
|
|
17607
|
+
said2?.kind === "failed" ? /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(import_design_system48.ErrorBox, { as: "p", className: "break-words text-destructive", message: said2.says, origin: "records-ui/buttonCell", children: said2.says }) : null,
|
|
17604
17608
|
said2?.kind === "public" ? /* @__PURE__ */ (0, import_jsx_runtime53.jsx)("p", { children: "Buttons run for signed-in people." }) : null,
|
|
17605
17609
|
said2?.kind === "ran" ? /* @__PURE__ */ (0, import_jsx_runtime53.jsxs)("div", { className: "break-words", children: [
|
|
17606
17610
|
said2.value ? /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(StructuredValueView, { structured: said2.value, label: b.label }) : null,
|
|
@@ -19495,7 +19499,7 @@ function useGridEditing({ tableId, fields, rows, reload, reloadAfterWrite, canWr
|
|
|
19495
19499
|
}
|
|
19496
19500
|
const held = optimistic[cellKey(address.rowId, address.key)];
|
|
19497
19501
|
const document2 = rows.find((r) => r.id === address.rowId)?.document;
|
|
19498
|
-
const pointer = held === void 0 && typeof current === "string" ? (0,
|
|
19502
|
+
const pointer = held === void 0 && typeof current === "string" ? (0, import_core11.wholeValueOf)(document2, address.key) : null;
|
|
19499
19503
|
if (pointer) {
|
|
19500
19504
|
const read = host.readFileText;
|
|
19501
19505
|
if (!read) return;
|
|
@@ -19647,7 +19651,7 @@ function useGridEditing({ tableId, fields, rows, reload, reloadAfterWrite, canWr
|
|
|
19647
19651
|
delete next[id];
|
|
19648
19652
|
return next;
|
|
19649
19653
|
});
|
|
19650
|
-
const conflict = (0,
|
|
19654
|
+
const conflict = (0, import_core11.asWriteConflict)(written.error, rowId);
|
|
19651
19655
|
if (written.error.code === "stale_write") {
|
|
19652
19656
|
if (conflict) rememberVersion(versions.current, rowId, conflict.current_version);
|
|
19653
19657
|
else versions.current.delete(rowId);
|
|
@@ -19735,7 +19739,7 @@ function useGridEditing({ tableId, fields, rows, reload, reloadAfterWrite, canWr
|
|
|
19735
19739
|
}
|
|
19736
19740
|
const starting = shownValue2(next.rowId, next.key);
|
|
19737
19741
|
const nextDocument = rows.find((r) => r.id === next.rowId)?.document;
|
|
19738
|
-
if (typeof starting === "string" && optimistic[cellKey(next.rowId, next.key)] === void 0 && (0,
|
|
19742
|
+
if (typeof starting === "string" && optimistic[cellKey(next.rowId, next.key)] === void 0 && (0, import_core11.wholeValueOf)(nextDocument, next.key)) {
|
|
19739
19743
|
setEditing(null);
|
|
19740
19744
|
setDraft(null);
|
|
19741
19745
|
typed2.current = null;
|
|
@@ -20796,7 +20800,7 @@ var import_react169 = require("@ai-matrx/records/react");
|
|
|
20796
20800
|
var import_records45 = require("@ai-matrx/records");
|
|
20797
20801
|
var import_records46 = require("@ai-matrx/records");
|
|
20798
20802
|
var import_data_table14 = require("@ai-matrx/design-system/data-table");
|
|
20799
|
-
var
|
|
20803
|
+
var import_core18 = require("@ai-matrx/records/core");
|
|
20800
20804
|
|
|
20801
20805
|
// src/tableDecorations.ts
|
|
20802
20806
|
var import_react95 = require("react");
|
|
@@ -20939,7 +20943,7 @@ function useTableCanBeCleaned(tableId) {
|
|
|
20939
20943
|
|
|
20940
20944
|
// src/gridControls.tsx
|
|
20941
20945
|
var import_clipboard3 = require("@ai-matrx/kit/clipboard");
|
|
20942
|
-
var
|
|
20946
|
+
var import_core12 = require("@ai-matrx/records/core");
|
|
20943
20947
|
var import_react127 = require("react");
|
|
20944
20948
|
var import_react128 = require("@ai-matrx/records/react");
|
|
20945
20949
|
var import_design_system69 = require("@ai-matrx/design-system");
|
|
@@ -24389,7 +24393,7 @@ function useMergedGridControls(args) {
|
|
|
24389
24393
|
const fieldsRef = (0, import_react127.useRef)(fields);
|
|
24390
24394
|
fieldsRef.current = fields;
|
|
24391
24395
|
const [choiceCounts, setChoiceCounts] = (0, import_react127.useState)({});
|
|
24392
|
-
(0, import_react127.useEffect)(() => (0,
|
|
24396
|
+
(0, import_react127.useEffect)(() => (0, import_core12.onRecordChanged)(() => (0, askOnce_exports.forgetAsked)(client, `value_counts:${tableId}:`)), [client, tableId]);
|
|
24393
24397
|
(0, import_react127.useEffect)(() => {
|
|
24394
24398
|
if (!enabled || choiceKeys.length === 0) {
|
|
24395
24399
|
setChoiceCounts({});
|
|
@@ -25121,7 +25125,7 @@ var import_design_system73 = require("@ai-matrx/design-system");
|
|
|
25121
25125
|
// src/RecordForm.tsx
|
|
25122
25126
|
var import_react133 = require("react");
|
|
25123
25127
|
var import_react134 = require("@ai-matrx/records/react");
|
|
25124
|
-
var
|
|
25128
|
+
var import_core14 = require("@ai-matrx/records/core");
|
|
25125
25129
|
init_writeOnTheWinningVersion();
|
|
25126
25130
|
var import_design_system72 = require("@ai-matrx/design-system");
|
|
25127
25131
|
init_Refusal();
|
|
@@ -25140,7 +25144,7 @@ var import_react129 = require("react");
|
|
|
25140
25144
|
var import_react130 = require("@ai-matrx/records/react");
|
|
25141
25145
|
var import_design_system70 = require("@ai-matrx/design-system");
|
|
25142
25146
|
init_Refusal();
|
|
25143
|
-
var
|
|
25147
|
+
var import_core13 = require("@ai-matrx/records/core");
|
|
25144
25148
|
init_plainWords();
|
|
25145
25149
|
var import_jsx_runtime79 = require("react/jsx-runtime");
|
|
25146
25150
|
function isEmptyValue(value) {
|
|
@@ -25213,7 +25217,7 @@ async function writeStandardRowValues(client, args) {
|
|
|
25213
25217
|
{ schema: config.schema ?? "custom" }
|
|
25214
25218
|
);
|
|
25215
25219
|
if (!old.error) return { ok: true };
|
|
25216
|
-
const error = (0,
|
|
25220
|
+
const error = (0, import_core13.mapPgError)(old.error, "entityValueWrite");
|
|
25217
25221
|
return { ok: false, error: doorIsAbsent(error) && first && first.error.code !== "door_absent" ? first.error : error };
|
|
25218
25222
|
}
|
|
25219
25223
|
function doorIsAbsent(error) {
|
|
@@ -25795,7 +25799,7 @@ function CustomRecordForm({
|
|
|
25795
25799
|
return out;
|
|
25796
25800
|
}, [draft]);
|
|
25797
25801
|
const predicted = (0, import_react133.useMemo)(
|
|
25798
|
-
() => fields.data ? (0,
|
|
25802
|
+
() => fields.data ? (0, import_core14.predictWriteRefusals)({ fields: fields.data, document: document2, ...recordType ? { recordType } : {} }) : [],
|
|
25799
25803
|
[fields.data, document2, recordType]
|
|
25800
25804
|
);
|
|
25801
25805
|
if (fields.error) return /* @__PURE__ */ (0, import_jsx_runtime81.jsx)(RefusalNotice, { error: fields.error, className });
|
|
@@ -25845,7 +25849,7 @@ function CustomRecordForm({
|
|
|
25845
25849
|
setEdit({
|
|
25846
25850
|
saving: false,
|
|
25847
25851
|
error: answered2.ok ? null : answered2.error,
|
|
25848
|
-
conflict: answered2.ok ? null : (0,
|
|
25852
|
+
conflict: answered2.ok ? null : (0, import_core14.asWriteConflict)(answered2.error, recordId)
|
|
25849
25853
|
});
|
|
25850
25854
|
const moved = answered2.ok ? answered2.data : null;
|
|
25851
25855
|
if (moved !== null) {
|
|
@@ -25956,7 +25960,7 @@ function FieldRow({
|
|
|
25956
25960
|
}) {
|
|
25957
25961
|
const id = `field-${field2.id}`;
|
|
25958
25962
|
const storedWords = document2?.[field2.key];
|
|
25959
|
-
const whole = typeof storedWords === "string" ? (0,
|
|
25963
|
+
const whole = typeof storedWords === "string" ? (0, import_core14.wholeValueOf)(document2, field2.key) : null;
|
|
25960
25964
|
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: [
|
|
25961
25965
|
/* @__PURE__ */ (0, import_jsx_runtime81.jsx)(FieldLabel, { field: field2, htmlFor: id, children: /* @__PURE__ */ (0, import_jsx_runtime81.jsx)(ProvenanceBadge, { document: document2, fieldKey: field2.key }) }),
|
|
25962
25966
|
whole ? (
|
|
@@ -28959,7 +28963,7 @@ function useGroupLabel(fields, groupKey, thenKeys = []) {
|
|
|
28959
28963
|
// src/gridUndo.tsx
|
|
28960
28964
|
var import_react156 = require("react");
|
|
28961
28965
|
var import_react157 = require("@ai-matrx/records/react");
|
|
28962
|
-
var
|
|
28966
|
+
var import_core15 = require("@ai-matrx/records/core");
|
|
28963
28967
|
var import_design_system81 = require("@ai-matrx/design-system");
|
|
28964
28968
|
init_plainWords();
|
|
28965
28969
|
var import_data_table13 = require("@ai-matrx/design-system/data-table");
|
|
@@ -29055,7 +29059,7 @@ function useGridUndo(args) {
|
|
|
29055
29059
|
}
|
|
29056
29060
|
forget(step2.cells.map((c) => ({ rowId: c.rowId, key: c.key })));
|
|
29057
29061
|
for (const id of /* @__PURE__ */ new Set([...step2.cells.map((c) => c.rowId), ...step2.created ?? [], ...step2.archived ?? []])) {
|
|
29058
|
-
(0,
|
|
29062
|
+
(0, import_core15.announceRecordChanged)(id);
|
|
29059
29063
|
}
|
|
29060
29064
|
setHeld(() => {
|
|
29061
29065
|
let stack = taken.stack;
|
|
@@ -29352,7 +29356,7 @@ function useRowFollowsItsMove(args) {
|
|
|
29352
29356
|
// src/gridAssist.tsx
|
|
29353
29357
|
var import_clipboard5 = require("@ai-matrx/kit/clipboard");
|
|
29354
29358
|
var import_react160 = require("react");
|
|
29355
|
-
var
|
|
29359
|
+
var import_core16 = require("@ai-matrx/records/core");
|
|
29356
29360
|
var import_workspace = require("@ai-matrx/alchemy/react/workspace");
|
|
29357
29361
|
|
|
29358
29362
|
// src/gridAgentContext.ts
|
|
@@ -29484,7 +29488,7 @@ function useGridAssist(args) {
|
|
|
29484
29488
|
const copyRecordReference = (0, import_react160.useCallback)(
|
|
29485
29489
|
(rowId) => {
|
|
29486
29490
|
void (async () => {
|
|
29487
|
-
const text = JSON.stringify({ __kind: (0,
|
|
29491
|
+
const text = JSON.stringify({ __kind: (0, import_core16.tableKindSlug)(tableId), _record_id: rowId });
|
|
29488
29492
|
if (!await (0, import_clipboard5.copyText)(text)) {
|
|
29489
29493
|
say2(false, "This browser did not let the page write to the clipboard.");
|
|
29490
29494
|
return;
|
|
@@ -29540,7 +29544,7 @@ function useGridAssist(args) {
|
|
|
29540
29544
|
if (!row) return;
|
|
29541
29545
|
const document2 = row.document ?? {};
|
|
29542
29546
|
const value = editing.valueFor(row, fieldOf2(key));
|
|
29543
|
-
const pointer = typeof document2[key] === "string" ? (0,
|
|
29547
|
+
const pointer = typeof document2[key] === "string" ? (0, import_core16.wholeValueOf)(document2, key) : null;
|
|
29544
29548
|
setWhole({ rowId, key, rowTitle: titleOf(row), value, pointer });
|
|
29545
29549
|
},
|
|
29546
29550
|
[rowOf, fieldOf2, titleOf, editing]
|
|
@@ -29636,7 +29640,7 @@ function useGridAssist(args) {
|
|
|
29636
29640
|
// src/gridBulk.tsx
|
|
29637
29641
|
var import_react161 = require("react");
|
|
29638
29642
|
var import_react162 = require("@ai-matrx/records/react");
|
|
29639
|
-
var
|
|
29643
|
+
var import_core17 = require("@ai-matrx/records/core");
|
|
29640
29644
|
init_recordVersions();
|
|
29641
29645
|
var import_design_system82 = require("@ai-matrx/design-system");
|
|
29642
29646
|
init_names();
|
|
@@ -29705,7 +29709,7 @@ function useGridBulk(args) {
|
|
|
29705
29709
|
return null;
|
|
29706
29710
|
}
|
|
29707
29711
|
for (const result of done.data ?? []) if (result.op === "update") versions.wrote(result.id, result.version);
|
|
29708
|
-
for (const change of changes) if ("record_id" in change && change.record_id) (0,
|
|
29712
|
+
for (const change of changes) if ("record_id" in change && change.record_id) (0, import_core17.announceRecordChanged)(change.record_id);
|
|
29709
29713
|
return done.data;
|
|
29710
29714
|
},
|
|
29711
29715
|
[client, tableId, versions, reload]
|
|
@@ -30216,7 +30220,7 @@ var useViewAddress = () => (0, import_react167.useContext)(ViewAddressContext);
|
|
|
30216
30220
|
|
|
30217
30221
|
// src/Grid.tsx
|
|
30218
30222
|
var import_jsx_runtime99 = require("react/jsx-runtime");
|
|
30219
|
-
if (typeof window !== "undefined") performance.mark("load:heavy:Records grid");
|
|
30223
|
+
if (typeof window !== "undefined" && typeof performance?.mark === "function") performance.mark("load:heavy:Records grid");
|
|
30220
30224
|
var WRAP_COLUMN_CELL_CLASS = "[table_tbody_&&]:max-w-none! [table_tbody_&&]:whitespace-normal! [table_tbody_&&]:overflow-visible! [table_tbody_&&_*]:whitespace-normal! [table_tbody_&&]:break-words [table_tbody_&&_[data-matrx-cell-content]]:max-h-[3lh]! [table_tbody_&&_[data-matrx-cell-content]]:overflow-hidden";
|
|
30221
30225
|
var NO_COLUMNS_YET = "This table has no columns yet";
|
|
30222
30226
|
var embeddedPageAskKey = (tableId, search, sorts, filter, pageDoorViewId) => JSON.stringify([tableId, search, sorts, filter, pageDoorViewId]);
|
|
@@ -30992,7 +30996,7 @@ function GridBody({
|
|
|
30992
30996
|
}))
|
|
30993
30997
|
);
|
|
30994
30998
|
editing.forget(cells);
|
|
30995
|
-
for (const u of updates) (0,
|
|
30999
|
+
for (const u of updates) (0, import_core18.announceRecordChanged)(u.row.recordId);
|
|
30996
31000
|
const lines2 = updates.length + creates.length;
|
|
30997
31001
|
undo.push({ label: `Pasted ${lines2} ${lines2 === 1 ? "row" : "rows"}`, cells, created });
|
|
30998
31002
|
const expected = [
|
|
@@ -31285,7 +31289,7 @@ function GridBody({
|
|
|
31285
31289
|
const values = presetValues ? withNewRowValues(presetValues, given) : given;
|
|
31286
31290
|
setAddRefused(null);
|
|
31287
31291
|
if (formHosted && fields.data) {
|
|
31288
|
-
const wouldRefuse = (0,
|
|
31292
|
+
const wouldRefuse = (0, import_core18.predictWriteRefusals)({ fields: fields.data, document: values ?? {} });
|
|
31289
31293
|
if (wouldRefuse.length > 0) {
|
|
31290
31294
|
setFormAsk((held) => ({ n: (held?.n ?? 0) + 1, initial: { ...values ?? {} } }));
|
|
31291
31295
|
return;
|
|
@@ -32853,7 +32857,7 @@ var import_clipboard6 = require("@ai-matrx/kit/clipboard");
|
|
|
32853
32857
|
var import_download2 = require("@ai-matrx/kit/download");
|
|
32854
32858
|
var import_react174 = require("react");
|
|
32855
32859
|
var import_react175 = require("@ai-matrx/records/react");
|
|
32856
|
-
var
|
|
32860
|
+
var import_core19 = require("@ai-matrx/records/core");
|
|
32857
32861
|
init_host();
|
|
32858
32862
|
|
|
32859
32863
|
// src/viewExport.ts
|
|
@@ -32929,7 +32933,7 @@ function toRows(fields, records, labels) {
|
|
|
32929
32933
|
absent_reason: envelope?.absent ?? null,
|
|
32930
32934
|
// A VALUE KEPT AS A FILE carries its pointer, so the export writes the whole text
|
|
32931
32935
|
// (`withWholeValues`), never the first words passed off as the value.
|
|
32932
|
-
source: (0,
|
|
32936
|
+
source: (0, import_core19.wholeValueOf)(document2, field2.key)
|
|
32933
32937
|
};
|
|
32934
32938
|
}
|
|
32935
32939
|
return row;
|
|
@@ -32960,7 +32964,7 @@ async function rowsForFile(args) {
|
|
|
32960
32964
|
);
|
|
32961
32965
|
const lookup = ((field2, id) => labels(field2, id) ?? learned.get(`${field2.id}:${id}`) ?? null);
|
|
32962
32966
|
const read = host.readFileText;
|
|
32963
|
-
return (0,
|
|
32967
|
+
return (0, import_core19.withWholeValues)(toRows(all, records, lookup), read ? (fileId) => read({ fileId }) : null);
|
|
32964
32968
|
}
|
|
32965
32969
|
function ExportMenu({ tableId, rows, label, className, view }) {
|
|
32966
32970
|
const client = (0, import_react175.useRecordsClient)();
|
|
@@ -33007,7 +33011,7 @@ function ExportMenu({ tableId, rows, label, className, view }) {
|
|
|
33007
33011
|
{
|
|
33008
33012
|
size: "sm",
|
|
33009
33013
|
variant: "outline",
|
|
33010
|
-
onClick: () => void exported().then((rows2) => download(`${name}.csv`, "text/csv;charset=utf-8", (0,
|
|
33014
|
+
onClick: () => void exported().then((rows2) => download(`${name}.csv`, "text/csv;charset=utf-8", (0, import_core19.exportCsv)(columns, rows2))).catch(
|
|
33011
33015
|
(thrown) => setFailure((0, refusals_exports.refusalFromThrown)(thrown, "The CSV could not be written.", "Try again in a moment."))
|
|
33012
33016
|
),
|
|
33013
33017
|
children: "CSV"
|
|
@@ -33028,7 +33032,7 @@ function ExportMenu({ tableId, rows, label, className, view }) {
|
|
|
33028
33032
|
);
|
|
33029
33033
|
setFailure(null);
|
|
33030
33034
|
try {
|
|
33031
|
-
exported().then((rows2) => (0,
|
|
33035
|
+
exported().then((rows2) => (0, import_core19.exportXlsx)(columns, rows2, name)).then(
|
|
33032
33036
|
(bytes) => download(
|
|
33033
33037
|
`${name}.xlsx`,
|
|
33034
33038
|
"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
|
|
@@ -33047,7 +33051,7 @@ function ExportMenu({ tableId, rows, label, className, view }) {
|
|
|
33047
33051
|
{
|
|
33048
33052
|
size: "sm",
|
|
33049
33053
|
variant: "outline",
|
|
33050
|
-
onClick: () => void exported().then((rows2) => download(`${name}.md`, "text/markdown;charset=utf-8", (0,
|
|
33054
|
+
onClick: () => void exported().then((rows2) => download(`${name}.md`, "text/markdown;charset=utf-8", (0, import_core19.exportMarkdown)(columns, rows2))).catch(
|
|
33051
33055
|
(thrown) => setFailure((0, refusals_exports.refusalFromThrown)(thrown, "The Markdown could not be written.", "The CSV beside this button carries the same rows."))
|
|
33052
33056
|
),
|
|
33053
33057
|
children: "Markdown"
|
|
@@ -33059,7 +33063,7 @@ function ExportMenu({ tableId, rows, label, className, view }) {
|
|
|
33059
33063
|
size: "sm",
|
|
33060
33064
|
variant: "outline",
|
|
33061
33065
|
onClick: () => void exported().then(async (rows2) => {
|
|
33062
|
-
if (await (0, import_clipboard6.copyText)((0,
|
|
33066
|
+
if (await (0, import_clipboard6.copyText)((0, import_core19.exportMarkdown)(columns, rows2))) host.notify?.success("Markdown copied");
|
|
33063
33067
|
else host.notify?.error("Couldn\u2019t copy the Markdown");
|
|
33064
33068
|
}).catch(
|
|
33065
33069
|
(thrown) => setFailure((0, refusals_exports.refusalFromThrown)(thrown, "The Markdown could not be written.", "The CSV beside this button carries the same rows."))
|
|
@@ -33093,7 +33097,7 @@ function ExportMenu({ tableId, rows, label, className, view }) {
|
|
|
33093
33097
|
sourceId: `records:${tableId}`,
|
|
33094
33098
|
size: "xs",
|
|
33095
33099
|
json: () => records.map((r) => r.document),
|
|
33096
|
-
human: () => (0,
|
|
33100
|
+
human: () => (0, import_core19.exportCsv)(columns, toRows(columns, records, labels))
|
|
33097
33101
|
}
|
|
33098
33102
|
),
|
|
33099
33103
|
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,
|
|
@@ -39231,7 +39235,7 @@ var import_design_system110 = require("@ai-matrx/design-system");
|
|
|
39231
39235
|
var import_react231 = require("react");
|
|
39232
39236
|
var import_recharts = require("recharts");
|
|
39233
39237
|
var import_records54 = require("@ai-matrx/records");
|
|
39234
|
-
var
|
|
39238
|
+
var import_core20 = require("@ai-matrx/records/core");
|
|
39235
39239
|
var import_design_system109 = require("@ai-matrx/design-system");
|
|
39236
39240
|
var import_format9 = require("@ai-matrx/kit/format");
|
|
39237
39241
|
init_Refusal();
|
|
@@ -39697,7 +39701,7 @@ function pretty(n) {
|
|
|
39697
39701
|
return Number.isInteger(n) ? n.toLocaleString() : n.toLocaleString(void 0, { maximumFractionDigits: 2 });
|
|
39698
39702
|
}
|
|
39699
39703
|
function asRefusal2(block) {
|
|
39700
|
-
return (0,
|
|
39704
|
+
return (0, import_core20.mapPgError)(
|
|
39701
39705
|
{
|
|
39702
39706
|
message: block.refused ?? "",
|
|
39703
39707
|
...block.sqlstate ? { code: block.sqlstate } : {}
|
|
@@ -40732,21 +40736,24 @@ function Board({
|
|
|
40732
40736
|
},
|
|
40733
40737
|
note: records.membership,
|
|
40734
40738
|
style,
|
|
40735
|
-
parentField: subItemsField(all, view.subject)
|
|
40739
|
+
parentField: subItemsField(all, view.subject),
|
|
40740
|
+
below: /* @__PURE__ */ (0, import_jsx_runtime131.jsxs)(import_jsx_runtime131.Fragment, { children: [
|
|
40741
|
+
pager,
|
|
40742
|
+
/* @__PURE__ */ (0, import_jsx_runtime131.jsx)(
|
|
40743
|
+
CardFieldsPicker,
|
|
40744
|
+
{
|
|
40745
|
+
layout: "kanban",
|
|
40746
|
+
fields: all.filter((f) => f.key !== titleField?.key && f.key !== groupField.key),
|
|
40747
|
+
hiddenFields: boardHidden,
|
|
40748
|
+
summary: `Card fields (${boardCardFields.length + dateFields.length})`,
|
|
40749
|
+
onChange: (cardHidden2) => onChange({ presentation: { ...view.presentation, cardHidden: cardHidden2 } }),
|
|
40750
|
+
remembered
|
|
40751
|
+
}
|
|
40752
|
+
)
|
|
40753
|
+
] })
|
|
40736
40754
|
}
|
|
40737
40755
|
),
|
|
40738
|
-
pager
|
|
40739
|
-
isPipeline === true ? null : /* @__PURE__ */ (0, import_jsx_runtime131.jsx)(
|
|
40740
|
-
CardFieldsPicker,
|
|
40741
|
-
{
|
|
40742
|
-
layout: "kanban",
|
|
40743
|
-
fields: all.filter((f) => f.key !== titleField?.key && f.key !== groupField.key),
|
|
40744
|
-
hiddenFields: boardHidden,
|
|
40745
|
-
summary: `Card fields (${boardCardFields.length + dateFields.length})`,
|
|
40746
|
-
onChange: (cardHidden2) => onChange({ presentation: { ...view.presentation, cardHidden: cardHidden2 } }),
|
|
40747
|
-
remembered
|
|
40748
|
-
}
|
|
40749
|
-
)
|
|
40756
|
+
isPipeline === true ? pager : null
|
|
40750
40757
|
] });
|
|
40751
40758
|
}
|
|
40752
40759
|
if (view.layout === "calendar") {
|
|
@@ -41005,7 +41012,8 @@ function Kanban({
|
|
|
41005
41012
|
style,
|
|
41006
41013
|
cardFields,
|
|
41007
41014
|
canAdd = false,
|
|
41008
|
-
parentField
|
|
41015
|
+
parentField,
|
|
41016
|
+
below
|
|
41009
41017
|
}) {
|
|
41010
41018
|
const axisFields = (0, import_react234.useMemo)(() => laneField ? [groupField, laneField] : [groupField], [groupField, laneField]);
|
|
41011
41019
|
const labels = useRecordLabels(axisFields);
|
|
@@ -41218,7 +41226,8 @@ function Kanban({
|
|
|
41218
41226
|
] }, lane.name);
|
|
41219
41227
|
})
|
|
41220
41228
|
] }) })
|
|
41221
|
-
) : /* @__PURE__ */ (0, import_jsx_runtime131.jsx)("div", { className: "flex min-h-0 gap-2 overflow-x-auto pb-2", children: columns.map((name) => cell2(name, null, cardsOf.get(name) ?? [])) })
|
|
41229
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime131.jsx)("div", { className: "flex min-h-0 gap-2 overflow-x-auto pb-2", children: columns.map((name) => cell2(name, null, cardsOf.get(name) ?? [])) }),
|
|
41230
|
+
below
|
|
41222
41231
|
] });
|
|
41223
41232
|
}
|
|
41224
41233
|
var GALLERY_SIZE = {
|
|
@@ -41814,7 +41823,7 @@ var import_react241 = require("react");
|
|
|
41814
41823
|
var import_react242 = require("@ai-matrx/records/react");
|
|
41815
41824
|
var import_design_system114 = require("@ai-matrx/design-system");
|
|
41816
41825
|
var import_controls5 = require("@ai-matrx/design-system/controls");
|
|
41817
|
-
var
|
|
41826
|
+
var import_core21 = require("@dnd-kit/core");
|
|
41818
41827
|
var import_sortable = require("@dnd-kit/sortable");
|
|
41819
41828
|
var import_utilities = require("@dnd-kit/utilities");
|
|
41820
41829
|
init_Refusal();
|
|
@@ -41909,7 +41918,7 @@ function seedIsSatisfied(seed, views) {
|
|
|
41909
41918
|
return seed.isDefault === true && views.some((v) => v.isDefault);
|
|
41910
41919
|
}
|
|
41911
41920
|
function SectionBox({ id, children, ...rest }) {
|
|
41912
|
-
const { setNodeRef, isOver } = (0,
|
|
41921
|
+
const { setNodeRef, isOver } = (0, import_core21.useDroppable)({ id });
|
|
41913
41922
|
return /* @__PURE__ */ (0, import_jsx_runtime134.jsx)("div", { ref: setNodeRef, className: (0, import_design_system114.cn)("rounded-sm", isOver && "bg-accent/40"), ...rest, children });
|
|
41914
41923
|
}
|
|
41915
41924
|
function SortableRow({ id, disabled, children }) {
|
|
@@ -41964,7 +41973,7 @@ function ViewBar({ tableId, activeViewId, onActiveView, seed, settings, onViews,
|
|
|
41964
41973
|
const [renamingSection, setRenamingSection] = (0, import_react241.useState)(null);
|
|
41965
41974
|
const [dragging, setDragging] = (0, import_react241.useState)(false);
|
|
41966
41975
|
const justDragged = (0, import_react241.useRef)(false);
|
|
41967
|
-
const sensors = (0,
|
|
41976
|
+
const sensors = (0, import_core21.useSensors)((0, import_core21.useSensor)(import_core21.PointerSensor, { activationConstraint: { distance: 6 } }));
|
|
41968
41977
|
async function dropped(event) {
|
|
41969
41978
|
setDragging(false);
|
|
41970
41979
|
justDragged.current = true;
|
|
@@ -42219,7 +42228,7 @@ function ViewBar({ tableId, activeViewId, onActiveView, seed, settings, onViews,
|
|
|
42219
42228
|
) }),
|
|
42220
42229
|
/* @__PURE__ */ (0, import_jsx_runtime134.jsxs)(import_design_system114.PopoverContent, { sizing: "content", align: "start", className: "w-64 p-1", "data-view-picker-content": "", children: [
|
|
42221
42230
|
/* @__PURE__ */ (0, import_jsx_runtime134.jsxs)("div", { role: "group", "aria-label": "Saved views", className: "flex max-h-[50dvh] flex-col overflow-y-auto", children: [
|
|
42222
|
-
/* @__PURE__ */ (0, import_jsx_runtime134.jsx)(
|
|
42231
|
+
/* @__PURE__ */ (0, import_jsx_runtime134.jsx)(import_core21.DndContext, { sensors, collisionDetection: import_core21.closestCenter, onDragStart: () => setDragging(true), onDragCancel: () => setDragging(false), onDragEnd: (e) => void dropped(e), children: (() => {
|
|
42223
42232
|
const groups = (0, import_views2.groupViewsBySection)(views);
|
|
42224
42233
|
return groups.some((g) => g.name === null) || !dragging ? groups : [{ name: null, views: [] }, ...groups];
|
|
42225
42234
|
})().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: [
|
|
@@ -47866,7 +47875,7 @@ var import_clipboard10 = require("@ai-matrx/kit/clipboard");
|
|
|
47866
47875
|
var import_design_system134 = require("@ai-matrx/design-system");
|
|
47867
47876
|
var import_controls10 = require("@ai-matrx/design-system/controls");
|
|
47868
47877
|
var import_react277 = require("react");
|
|
47869
|
-
var
|
|
47878
|
+
var import_core22 = require("@dnd-kit/core");
|
|
47870
47879
|
var import_sortable2 = require("@dnd-kit/sortable");
|
|
47871
47880
|
var import_utilities2 = require("@dnd-kit/utilities");
|
|
47872
47881
|
var import_react278 = require("@ai-matrx/records/react");
|
|
@@ -49516,9 +49525,9 @@ function QuestionList({
|
|
|
49516
49525
|
onQuestions,
|
|
49517
49526
|
onQuestion
|
|
49518
49527
|
}) {
|
|
49519
|
-
const sensors = (0,
|
|
49520
|
-
(0,
|
|
49521
|
-
(0,
|
|
49528
|
+
const sensors = (0, import_core22.useSensors)(
|
|
49529
|
+
(0, import_core22.useSensor)(import_core22.PointerSensor, { activationConstraint: { distance: 4 } }),
|
|
49530
|
+
(0, import_core22.useSensor)(import_core22.KeyboardSensor, { coordinateGetter: import_sortable2.sortableKeyboardCoordinates })
|
|
49522
49531
|
);
|
|
49523
49532
|
const askable = askableFields([...fields]);
|
|
49524
49533
|
const unasked = askable.filter((f) => !draft.questions.some((q) => q.field === f.key));
|
|
@@ -49540,7 +49549,7 @@ function QuestionList({
|
|
|
49540
49549
|
/* @__PURE__ */ (0, import_jsx_runtime154.jsx)("span", { className: "font-medium text-foreground", children: "Questions" }),
|
|
49541
49550
|
/* @__PURE__ */ (0, import_jsx_runtime154.jsx)("span", { className: "tabular-nums", children: draft.questions.length })
|
|
49542
49551
|
] }),
|
|
49543
|
-
/* @__PURE__ */ (0, import_jsx_runtime154.jsx)(
|
|
49552
|
+
/* @__PURE__ */ (0, import_jsx_runtime154.jsx)(import_core22.DndContext, { sensors, collisionDetection: import_core22.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)(
|
|
49544
49553
|
QuestionRow,
|
|
49545
49554
|
{
|
|
49546
49555
|
index,
|
|
@@ -50588,7 +50597,7 @@ init_Refusal();
|
|
|
50588
50597
|
init_host();
|
|
50589
50598
|
|
|
50590
50599
|
// src/DashboardGrid.tsx
|
|
50591
|
-
var
|
|
50600
|
+
var import_core23 = require("@dnd-kit/core");
|
|
50592
50601
|
var import_sortable3 = require("@dnd-kit/sortable");
|
|
50593
50602
|
var import_utilities3 = require("@dnd-kit/utilities");
|
|
50594
50603
|
var import_design_system140 = require("@ai-matrx/design-system");
|
|
@@ -50645,7 +50654,7 @@ function withBlockIds(blocks) {
|
|
|
50645
50654
|
// src/DashboardGrid.tsx
|
|
50646
50655
|
var import_jsx_runtime159 = require("react/jsx-runtime");
|
|
50647
50656
|
var dashboardCollision = (args) => {
|
|
50648
|
-
const under = (0,
|
|
50657
|
+
const under = (0, import_core23.pointerWithin)(args);
|
|
50649
50658
|
if (under.length > 0) return under;
|
|
50650
50659
|
const at = args.collisionRect;
|
|
50651
50660
|
return args.droppableContainers.flatMap((container) => {
|
|
@@ -50655,9 +50664,9 @@ var dashboardCollision = (args) => {
|
|
|
50655
50664
|
}).sort((a, b) => a.data.value - b.data.value);
|
|
50656
50665
|
};
|
|
50657
50666
|
function DashboardGrid({ items, arranging, onMove, onSpan }) {
|
|
50658
|
-
const sensors = (0,
|
|
50659
|
-
(0,
|
|
50660
|
-
(0,
|
|
50667
|
+
const sensors = (0, import_core23.useSensors)(
|
|
50668
|
+
(0, import_core23.useSensor)(import_core23.PointerSensor, { activationConstraint: { distance: 4 } }),
|
|
50669
|
+
(0, import_core23.useSensor)(import_core23.KeyboardSensor, { coordinateGetter: import_sortable3.sortableKeyboardCoordinates })
|
|
50661
50670
|
);
|
|
50662
50671
|
const ids = items.map((item) => item.id);
|
|
50663
50672
|
function dragEnd(event) {
|
|
@@ -50667,7 +50676,7 @@ function DashboardGrid({ items, arranging, onMove, onSpan }) {
|
|
|
50667
50676
|
}
|
|
50668
50677
|
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)) });
|
|
50669
50678
|
if (!arranging) return grid;
|
|
50670
|
-
return /* @__PURE__ */ (0, import_jsx_runtime159.jsx)(
|
|
50679
|
+
return /* @__PURE__ */ (0, import_jsx_runtime159.jsx)(import_core23.DndContext, { sensors, collisionDetection: dashboardCollision, onDragEnd: dragEnd, children: /* @__PURE__ */ (0, import_jsx_runtime159.jsx)(import_sortable3.SortableContext, { items: ids, strategy: import_sortable3.rectSortingStrategy, children: grid }) });
|
|
50671
50680
|
}
|
|
50672
50681
|
function GridCell2({
|
|
50673
50682
|
item,
|
|
@@ -52776,7 +52785,7 @@ init_host();
|
|
|
52776
52785
|
// src/PageCanvas.tsx
|
|
52777
52786
|
var import_react296 = require("react");
|
|
52778
52787
|
var import_react297 = require("@ai-matrx/records/react");
|
|
52779
|
-
var
|
|
52788
|
+
var import_core24 = require("@ai-matrx/records/core");
|
|
52780
52789
|
var import_download3 = require("@ai-matrx/kit/download");
|
|
52781
52790
|
var import_format14 = require("@ai-matrx/kit/format");
|
|
52782
52791
|
var import_design_system146 = require("@ai-matrx/design-system");
|
|
@@ -52918,7 +52927,7 @@ function useDoorRows(door, elementId, recordId) {
|
|
|
52918
52927
|
);
|
|
52919
52928
|
}
|
|
52920
52929
|
function downloadCsv(name, fields, rows) {
|
|
52921
|
-
(0, import_download3.downloadFile)(`${fileNameOf(name) || "export"}.csv`, (0,
|
|
52930
|
+
(0, import_download3.downloadFile)(`${fileNameOf(name) || "export"}.csv`, (0, import_core24.exportCsv)(fields, toRows(fields, rows)), "text/csv");
|
|
52922
52931
|
}
|
|
52923
52932
|
function CsvButton({ name, fields, rows }) {
|
|
52924
52933
|
if (rows.length === 0) return null;
|
|
@@ -53056,7 +53065,7 @@ function useMemberRows(block, viewerUserId, extra, mineOn, enabled) {
|
|
|
53056
53065
|
...q.sort.length > 0 ? { sort: q.sort } : {}
|
|
53057
53066
|
});
|
|
53058
53067
|
const reload = page.reload;
|
|
53059
|
-
(0, import_react296.useEffect)(() => (0,
|
|
53068
|
+
(0, import_react296.useEffect)(() => (0, import_core24.onRecordChanged)(() => reload()), [reload]);
|
|
53060
53069
|
return { q, page };
|
|
53061
53070
|
}
|
|
53062
53071
|
function BlockBody(inner2) {
|
|
@@ -53929,7 +53938,7 @@ function onePerKey3(all) {
|
|
|
53929
53938
|
}
|
|
53930
53939
|
|
|
53931
53940
|
// src/printPage.ts
|
|
53932
|
-
var
|
|
53941
|
+
var import_core25 = require("@ai-matrx/print/core");
|
|
53933
53942
|
var PAGE_PRINT_STYLES = `
|
|
53934
53943
|
.page-print-grid { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 12px; }
|
|
53935
53944
|
.page-print-grid > * { grid-column: span 12; break-inside: avoid; }
|
|
@@ -53940,7 +53949,7 @@ function printElement(element, title) {
|
|
|
53940
53949
|
const copy = element.cloneNode(true);
|
|
53941
53950
|
copy.querySelectorAll("button, input, select, textarea, iframe, [data-records-page-settings], [data-records-page-csv]").forEach((n) => n.remove());
|
|
53942
53951
|
copy.classList.add("page-print-grid");
|
|
53943
|
-
return (0,
|
|
53952
|
+
return (0, import_core25.openPrintWindow)((0, import_core25.buildPrintDocument)(`<h1>${escapeText(title)}</h1>${copy.innerHTML}`, title, PAGE_PRINT_STYLES), title);
|
|
53944
53953
|
}
|
|
53945
53954
|
function escapeText(text) {
|
|
53946
53955
|
return text.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">");
|
|
@@ -55782,9 +55791,9 @@ function CalendarSubscribeDialog({
|
|
|
55782
55791
|
|
|
55783
55792
|
// src/viewShare.ts
|
|
55784
55793
|
var import_clipboard15 = require("@ai-matrx/kit/clipboard");
|
|
55785
|
-
var
|
|
55794
|
+
var import_core26 = require("@ai-matrx/print/core");
|
|
55786
55795
|
var import_markdown = require("@ai-matrx/print/markdown");
|
|
55787
|
-
var
|
|
55796
|
+
var import_core27 = require("@ai-matrx/records/core");
|
|
55788
55797
|
init_objectActions();
|
|
55789
55798
|
var NO_VIEW_REASON = "No saved view yet";
|
|
55790
55799
|
function viewLink(tableId, viewId, origin) {
|
|
@@ -55821,7 +55830,7 @@ async function downloadViewCsv(args) {
|
|
|
55821
55830
|
const columns = viewColumns(fields, view.presentation);
|
|
55822
55831
|
const rows = await rowsForFile({ client, host, fields: columns, records: read.rows, labels });
|
|
55823
55832
|
const name = fileNameOf(args.tableName) || "records";
|
|
55824
|
-
download(`${name}.csv`, "text/csv;charset=utf-8", (0,
|
|
55833
|
+
download(`${name}.csv`, "text/csv;charset=utf-8", (0, import_core27.exportCsv)(columns, rows));
|
|
55825
55834
|
host.notify?.success(read.cut ? cutWords(read.rows.length) : "CSV downloaded");
|
|
55826
55835
|
}
|
|
55827
55836
|
function downloadMarkdownAction(args) {
|
|
@@ -55850,7 +55859,7 @@ async function readViewMarkdown(args) {
|
|
|
55850
55859
|
if ("error" in read) return null;
|
|
55851
55860
|
const columns = viewColumns(fields, view.presentation);
|
|
55852
55861
|
const rows = await rowsForFile({ client, host, fields: columns, records: read.rows, labels });
|
|
55853
|
-
return { markdown: (0,
|
|
55862
|
+
return { markdown: (0, import_core27.exportMarkdown)(columns, rows), cut: read.cut, count: read.rows.length };
|
|
55854
55863
|
}
|
|
55855
55864
|
async function downloadViewMarkdown(args) {
|
|
55856
55865
|
const table = await readViewMarkdown(args);
|
|
@@ -55908,7 +55917,7 @@ async function runTablePageAction(kind2, args) {
|
|
|
55908
55917
|
}
|
|
55909
55918
|
const page = (0, import_markdown.renderMarkdownDocument)(markdown, { title, withPrintActions: kind2 === "html-preview" });
|
|
55910
55919
|
if (kind2 === "html-preview") {
|
|
55911
|
-
(0,
|
|
55920
|
+
(0, import_core26.openPrintWindow)(page, title);
|
|
55912
55921
|
if (note) args.host.notify?.success(note);
|
|
55913
55922
|
} else if (kind2 === "copy-html-page") {
|
|
55914
55923
|
if (await (0, import_clipboard15.copyText)(page)) args.host.notify?.success(note ?? "HTML page copied");
|