@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/pickers.cjs
CHANGED
|
@@ -62,7 +62,7 @@ function choiceWord(value) {
|
|
|
62
62
|
return String(value ?? "").trim().toLowerCase().replace(/[^a-z0-9]+/g, "_").replace(/^_+|_+$/g, "");
|
|
63
63
|
}
|
|
64
64
|
function statusGroupColor(field, value) {
|
|
65
|
-
if ((0,
|
|
65
|
+
if ((0, import_field_kinds.newerKindOf)(field) !== "status" || value === null || value === void 0 || value === "") return void 0;
|
|
66
66
|
const word = choiceWord(value);
|
|
67
67
|
if (word === "") return void 0;
|
|
68
68
|
const groups = (field.config ?? {})["status_groups"];
|
|
@@ -96,11 +96,11 @@ function choiceChipLookOf(field, ...words) {
|
|
|
96
96
|
}
|
|
97
97
|
return { className: import_table_style.NEUTRAL_CHIP_CLASS, color: null };
|
|
98
98
|
}
|
|
99
|
-
var
|
|
99
|
+
var import_field_kinds, import_table_style, STATUS_GROUP_COLOR, NEW_CHOICE_PALETTE;
|
|
100
100
|
var init_choiceLooks = __esm({
|
|
101
101
|
"src/choiceLooks.ts"() {
|
|
102
102
|
"use strict";
|
|
103
|
-
|
|
103
|
+
import_field_kinds = require("@ai-matrx/records/field-kinds");
|
|
104
104
|
import_table_style = require("@ai-matrx/design-system/data-table/table-style");
|
|
105
105
|
STATUS_GROUP_COLOR = { todo: "gray", in_progress: "blue", done: "green" };
|
|
106
106
|
NEW_CHOICE_PALETTE = ["blue", "green", "amber", "red", "violet", "teal", "slate"];
|
|
@@ -314,7 +314,7 @@ function sentenceFor(what, level) {
|
|
|
314
314
|
return `You are ${have} here, and it takes ${need} to ${doing[what]}. Ask somebody who is Admin on it to move you up.`;
|
|
315
315
|
}
|
|
316
316
|
function whatYouMayDo(level, known = true) {
|
|
317
|
-
const may = (what) => known && (0,
|
|
317
|
+
const may = (what) => known && (0, import_field_kinds2.atLeast)(level, NEEDS[what]);
|
|
318
318
|
return {
|
|
319
319
|
level: known ? level : null,
|
|
320
320
|
known,
|
|
@@ -343,11 +343,11 @@ function tableIsLocked(table) {
|
|
|
343
343
|
function lockedStructure(base) {
|
|
344
344
|
return { ...base, structure: false, why: (what) => what === "structure" ? DATABASE_LOCKED_REASON : base.why(what) };
|
|
345
345
|
}
|
|
346
|
-
var
|
|
346
|
+
var import_field_kinds2, LEVEL_WORD, NEEDS, NOT_YET, NOTHING_AT_ALL, NOT_ANSWERED_YET, KERNEL_REASON, DATABASE_LOCKED_REASON;
|
|
347
347
|
var init_rights = __esm({
|
|
348
348
|
"src/rights.ts"() {
|
|
349
349
|
"use strict";
|
|
350
|
-
|
|
350
|
+
import_field_kinds2 = require("@ai-matrx/records/field-kinds");
|
|
351
351
|
LEVEL_WORD = {
|
|
352
352
|
viewer: "Viewer",
|
|
353
353
|
commenter: "Commenter",
|
|
@@ -529,7 +529,7 @@ function RefusalNotice({
|
|
|
529
529
|
onKeepEditing,
|
|
530
530
|
onDiscard
|
|
531
531
|
}) {
|
|
532
|
-
const archivedOrg = (0,
|
|
532
|
+
const archivedOrg = (0, import_core.archivedOrganizationId)(error);
|
|
533
533
|
if (archivedOrg) {
|
|
534
534
|
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(ArchivedOrganizationNotice, { organizationId: archivedOrg, error, className });
|
|
535
535
|
}
|
|
@@ -585,19 +585,19 @@ function RefusalLine({ error, className }) {
|
|
|
585
585
|
{
|
|
586
586
|
"data-refusal-line": "",
|
|
587
587
|
className: (0, import_design_system3.cn)("whitespace-normal break-words text-xs text-destructive [overflow-wrap:anywhere]", className),
|
|
588
|
-
message: (0,
|
|
588
|
+
message: (0, import_core.archivedOrganizationId)(error) ? "This organization is archived. An owner can restore it." : refusalLineForAPerson(error),
|
|
589
589
|
error,
|
|
590
590
|
origin: "records-ui/RefusalLine",
|
|
591
591
|
...plain.forEngineers ? { "data-for-engineers": plain.forEngineers } : {}
|
|
592
592
|
}
|
|
593
593
|
);
|
|
594
594
|
}
|
|
595
|
-
var
|
|
595
|
+
var import_core, import_design_system3, import_jsx_runtime4;
|
|
596
596
|
var init_Refusal = __esm({
|
|
597
597
|
"src/Refusal.tsx"() {
|
|
598
598
|
"use strict";
|
|
599
599
|
"use client";
|
|
600
|
-
|
|
600
|
+
import_core = require("@ai-matrx/records/core");
|
|
601
601
|
import_design_system3 = require("@ai-matrx/design-system");
|
|
602
602
|
init_ArchivedOrganizationNotice();
|
|
603
603
|
init_plainWords();
|
|
@@ -668,7 +668,7 @@ function declaredAsLook(kind) {
|
|
|
668
668
|
return kind in LOOK_KINDS && !storePublishesKind(kind);
|
|
669
669
|
}
|
|
670
670
|
function storePublishesKind(kind) {
|
|
671
|
-
return
|
|
671
|
+
return import_field_kinds3.DECLARABLE_FIELD_KINDS.some((row) => row.kind === kind);
|
|
672
672
|
}
|
|
673
673
|
function isSystemFieldKind(id) {
|
|
674
674
|
return SYSTEM_FIELD_KINDS.includes(id);
|
|
@@ -683,18 +683,18 @@ function isRelationFieldType(id) {
|
|
|
683
683
|
return id === "relation";
|
|
684
684
|
}
|
|
685
685
|
function isParityFieldType(id) {
|
|
686
|
-
return
|
|
686
|
+
return import_field_kinds3.PARITY_FIELD_TYPES.some((row) => row.parity_type === id);
|
|
687
687
|
}
|
|
688
|
-
var
|
|
688
|
+
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_SAVE_LABEL, EDIT_FIELD_SAVE_LABEL;
|
|
689
689
|
var init_fieldTypes = __esm({
|
|
690
690
|
"src/fieldTypes.ts"() {
|
|
691
691
|
"use strict";
|
|
692
|
-
|
|
692
|
+
import_field_kinds3 = require("@ai-matrx/records/field-kinds");
|
|
693
693
|
LOOK_KINDS = {
|
|
694
694
|
rating: { plain: "number", look: ({ ratingMax }) => ({ id: "rating", options: { ratingMax } }) },
|
|
695
695
|
time: { plain: "text", look: () => ({ id: "time" }) }
|
|
696
696
|
};
|
|
697
|
-
STORE_PUBLISHES_ENTITY_REFERENCE =
|
|
697
|
+
STORE_PUBLISHES_ENTITY_REFERENCE = import_field_kinds3.DECLARABLE_FIELD_KINDS.some(
|
|
698
698
|
(row) => row.kind === "entity_reference"
|
|
699
699
|
);
|
|
700
700
|
SYSTEM_FIELD_KINDS = ["autonumber", "created_time", "modified_time"];
|
|
@@ -739,7 +739,7 @@ var init_fieldTypes = __esm({
|
|
|
739
739
|
{ id: "created_by", group: "Worked out", label: "Created by", explanation: "Who made each record. Nobody types it." },
|
|
740
740
|
{ id: "modified_by", group: "Worked out", label: "Last changed by", explanation: "Who last changed each record. Nobody types it." }
|
|
741
741
|
];
|
|
742
|
-
GATED_KINDS = /* @__PURE__ */ new Set(["entity_reference", ...
|
|
742
|
+
GATED_KINDS = /* @__PURE__ */ new Set(["entity_reference", ...import_field_kinds3.NEWER_FIELD_KINDS]);
|
|
743
743
|
FIELD_TYPE_CHOICES = FIELD_TYPE_CATALOGUE.filter(
|
|
744
744
|
(c) => !GATED_KINDS.has(c.id) || storePublishesKind(c.id) || c.id in LOOK_KINDS
|
|
745
745
|
);
|
|
@@ -757,12 +757,12 @@ var init_fieldTypes = __esm({
|
|
|
757
757
|
|
|
758
758
|
// src/parity.ts
|
|
759
759
|
function editorKindFor(field) {
|
|
760
|
-
return (0,
|
|
760
|
+
return (0, import_field_kinds4.fieldKindFor)(field, KERNEL);
|
|
761
761
|
}
|
|
762
762
|
function pickableTypeOf(field) {
|
|
763
763
|
if (isSignatureField(field)) return "signature";
|
|
764
|
-
if ((0,
|
|
765
|
-
const newer = (0,
|
|
764
|
+
if ((0, import_field_kinds4.isButtonField)(field)) return "button";
|
|
765
|
+
const newer = (0, import_field_kinds4.newerKindOf)(field);
|
|
766
766
|
if (newer) return newer;
|
|
767
767
|
const look = displayFormatOf(field)?.id;
|
|
768
768
|
if (look === "rating" && field.type === "range") return "rating";
|
|
@@ -786,21 +786,20 @@ function fieldTypeLabel(field) {
|
|
|
786
786
|
};
|
|
787
787
|
return plain[kind] ?? (0, import_text_case.humanizeIdentifier)(kind);
|
|
788
788
|
}
|
|
789
|
-
var
|
|
789
|
+
var import_field_kinds4, import_text_case, kernelId, KERNEL_FILE_TABLE, KERNEL_PERSON_TABLE, PARITY_MADE_OF, KERNEL;
|
|
790
790
|
var init_parity = __esm({
|
|
791
791
|
"src/parity.ts"() {
|
|
792
792
|
"use strict";
|
|
793
793
|
init_choiceLooks();
|
|
794
|
-
|
|
795
|
-
import_core6 = require("@ai-matrx/records/core");
|
|
794
|
+
import_field_kinds4 = require("@ai-matrx/records/field-kinds");
|
|
796
795
|
import_text_case = require("@ai-matrx/kit/text-case");
|
|
797
796
|
init_docs();
|
|
798
797
|
init_fieldTypes();
|
|
799
|
-
kernelId = (name) =>
|
|
798
|
+
kernelId = (name) => import_field_kinds4.KERNEL_TABLES.find((t) => t.name === name)?.id ?? "";
|
|
800
799
|
KERNEL_FILE_TABLE = kernelId("File");
|
|
801
800
|
KERNEL_PERSON_TABLE = kernelId("Person");
|
|
802
801
|
PARITY_MADE_OF = Object.fromEntries(
|
|
803
|
-
|
|
802
|
+
import_field_kinds4.PARITY_FIELD_TYPES.map((p) => [p.parity_type, p.made_of])
|
|
804
803
|
);
|
|
805
804
|
KERNEL = { file: KERNEL_FILE_TABLE, person: KERNEL_PERSON_TABLE };
|
|
806
805
|
}
|
|
@@ -1171,11 +1170,11 @@ var init_refusals = __esm({
|
|
|
1171
1170
|
});
|
|
1172
1171
|
|
|
1173
1172
|
// src/createTable.ts
|
|
1174
|
-
var
|
|
1173
|
+
var import_field_kinds5;
|
|
1175
1174
|
var init_createTable = __esm({
|
|
1176
1175
|
"src/createTable.ts"() {
|
|
1177
1176
|
"use strict";
|
|
1178
|
-
|
|
1177
|
+
import_field_kinds5 = require("@ai-matrx/records/field-kinds");
|
|
1179
1178
|
}
|
|
1180
1179
|
});
|
|
1181
1180
|
|
|
@@ -2166,11 +2165,11 @@ function valueFromPastedText(field, raw, options, relationNames) {
|
|
|
2166
2165
|
...relationNames ? { relationNames } : {}
|
|
2167
2166
|
});
|
|
2168
2167
|
}
|
|
2169
|
-
var
|
|
2168
|
+
var import_core4, import_records12;
|
|
2170
2169
|
var init_pasteValues = __esm({
|
|
2171
2170
|
"src/pasteValues.ts"() {
|
|
2172
2171
|
"use strict";
|
|
2173
|
-
|
|
2172
|
+
import_core4 = require("@ai-matrx/records/core");
|
|
2174
2173
|
import_records12 = require("@ai-matrx/records");
|
|
2175
2174
|
init_names();
|
|
2176
2175
|
init_names();
|
|
@@ -2202,7 +2201,7 @@ function refusedCellsOf(fields, rows, mapping, choiceOptions, relationNames) {
|
|
|
2202
2201
|
if ("unmatchedNames" in meant) return;
|
|
2203
2202
|
if ("refusal" in meant) why = meant.refusal;
|
|
2204
2203
|
else {
|
|
2205
|
-
const predicted = (0,
|
|
2204
|
+
const predicted = (0, import_core5.predictValueRefusals)([field], { [key]: meant.value }).filter(
|
|
2206
2205
|
(p) => p.field_key === void 0 || p.field_key === key
|
|
2207
2206
|
);
|
|
2208
2207
|
if (predicted.length > 0) why = predicted[0].message;
|
|
@@ -2222,11 +2221,11 @@ function checkImportRules(fields, rows, mapping, choiceOptions, relationNames) {
|
|
|
2222
2221
|
}
|
|
2223
2222
|
return [...verdicts.values()];
|
|
2224
2223
|
}
|
|
2225
|
-
var
|
|
2224
|
+
var import_core5;
|
|
2226
2225
|
var init_importRuleCheck = __esm({
|
|
2227
2226
|
"src/importRuleCheck.ts"() {
|
|
2228
2227
|
"use strict";
|
|
2229
|
-
|
|
2228
|
+
import_core5 = require("@ai-matrx/records/core");
|
|
2230
2229
|
init_pasteValues();
|
|
2231
2230
|
init_parity();
|
|
2232
2231
|
}
|
|
@@ -2789,7 +2788,7 @@ function ImportWizard({ tableId, source, onDone, onWrote, autoRun, className })
|
|
|
2789
2788
|
try {
|
|
2790
2789
|
const xlsx = file.name.toLowerCase().endsWith(".xlsx");
|
|
2791
2790
|
const bytes = await file.arrayBuffer();
|
|
2792
|
-
const result = xlsx ? await (0,
|
|
2791
|
+
const result = xlsx ? await (0, import_core6.importXlsx)(bytes) : (0, import_core6.importCsv)(new TextDecoder().decode(bytes));
|
|
2793
2792
|
await planFrom(result, { name: file.name, bytes: file.size, hash: await sha256(bytes), format: xlsx ? "xlsx" : "csv" });
|
|
2794
2793
|
} catch (thrown) {
|
|
2795
2794
|
setProblem(
|
|
@@ -3985,14 +3984,14 @@ function ImportWizard({ tableId, source, onDone, onWrote, autoRun, className })
|
|
|
3985
3984
|
table.error ? /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(RefusalNotice, { error: table.error }) : null
|
|
3986
3985
|
] });
|
|
3987
3986
|
}
|
|
3988
|
-
var import_react41, import_react42,
|
|
3987
|
+
var import_react41, import_react42, import_core6, import_design_system23, import_records15, import_text_case5, import_jsx_runtime25, BATCH, SAMPLES, COLUMNS_PER_CALL, ABSENT, LEAVE, TITLE_COPY, TYPED_VALUES;
|
|
3989
3988
|
var init_ImportWizard = __esm({
|
|
3990
3989
|
"src/ImportWizard.tsx"() {
|
|
3991
3990
|
"use strict";
|
|
3992
3991
|
"use client";
|
|
3993
3992
|
import_react41 = require("react");
|
|
3994
3993
|
import_react42 = require("@ai-matrx/records/react");
|
|
3995
|
-
|
|
3994
|
+
import_core6 = require("@ai-matrx/records/core");
|
|
3996
3995
|
import_design_system23 = require("@ai-matrx/design-system");
|
|
3997
3996
|
import_records15 = require("@ai-matrx/records");
|
|
3998
3997
|
init_Refusal();
|
|
@@ -4042,14 +4041,14 @@ function shownToOnlyMe(table) {
|
|
|
4042
4041
|
if (table.shown_to !== void 0) return table.shown_to === "only_me";
|
|
4043
4042
|
return table.visibility === "personal";
|
|
4044
4043
|
}
|
|
4045
|
-
var import_react43, import_react44,
|
|
4044
|
+
var import_react43, import_react44, import_core7, import_records16, import_design_system24, import_jsx_runtime26, PLATFORM_TABLE_PREFIX2;
|
|
4046
4045
|
var init_TablesHome = __esm({
|
|
4047
4046
|
"src/TablesHome.tsx"() {
|
|
4048
4047
|
"use strict";
|
|
4049
4048
|
"use client";
|
|
4050
4049
|
import_react43 = require("react");
|
|
4051
4050
|
import_react44 = require("@ai-matrx/records/react");
|
|
4052
|
-
|
|
4051
|
+
import_core7 = require("@ai-matrx/records/core");
|
|
4053
4052
|
import_records16 = require("@ai-matrx/records");
|
|
4054
4053
|
import_design_system24 = require("@ai-matrx/design-system");
|
|
4055
4054
|
import_jsx_runtime26 = require("react/jsx-runtime");
|
|
@@ -4093,7 +4092,7 @@ function draftsFor(headers, rows) {
|
|
|
4093
4092
|
function keysFor(labels) {
|
|
4094
4093
|
const used = /* @__PURE__ */ new Set();
|
|
4095
4094
|
return labels.map((label, i) => {
|
|
4096
|
-
const base = (0,
|
|
4095
|
+
const base = (0, import_field_kinds5.tokenFor)(label) === "table" && !/table/i.test(label) ? `column_${i + 1}` : (0, import_field_kinds5.tokenFor)(label);
|
|
4097
4096
|
let key = base;
|
|
4098
4097
|
let n = 2;
|
|
4099
4098
|
while (used.has(key)) key = `${base}_${n++}`;
|
|
@@ -4203,7 +4202,7 @@ function SaveToTable({ source, shapeIndex = 0, onOpenTable, onSaved, onClose, ma
|
|
|
4203
4202
|
tableName2 = (name ?? proposedName).trim();
|
|
4204
4203
|
newId = earlier.tableId;
|
|
4205
4204
|
const lacking = fields.filter((f) => !earlier.haveKeys.has(f.key));
|
|
4206
|
-
const added = await (0,
|
|
4205
|
+
const added = await (0, import_field_kinds5.addFields)(client, newId, lacking);
|
|
4207
4206
|
if (!added.ok) {
|
|
4208
4207
|
setProblem(added.error);
|
|
4209
4208
|
setPhase("ready");
|
|
@@ -4211,7 +4210,7 @@ function SaveToTable({ source, shapeIndex = 0, onOpenTable, onSaved, onClose, ma
|
|
|
4211
4210
|
}
|
|
4212
4211
|
} else {
|
|
4213
4212
|
tableName2 = freeName(name ?? proposedName, (tables.data ?? []).map((t) => t.name));
|
|
4214
|
-
const born = await (0,
|
|
4213
|
+
const born = await (0, import_field_kinds5.declareTable)(client, { name: tableName2, fields });
|
|
4215
4214
|
if (!born.ok) {
|
|
4216
4215
|
setProblem(born.error);
|
|
4217
4216
|
setPhase("ready");
|
|
@@ -5587,7 +5586,7 @@ function columnNameProblemLine(name, noun = "column") {
|
|
|
5587
5586
|
// src/FieldEditor.tsx
|
|
5588
5587
|
var import_react60 = require("react");
|
|
5589
5588
|
var import_react61 = require("@ai-matrx/records/react");
|
|
5590
|
-
var
|
|
5589
|
+
var import_core9 = require("@ai-matrx/records/core");
|
|
5591
5590
|
var import_design_system35 = require("@ai-matrx/design-system");
|
|
5592
5591
|
init_parity();
|
|
5593
5592
|
init_fieldTypes();
|
|
@@ -5595,7 +5594,7 @@ init_fieldTypes();
|
|
|
5595
5594
|
// src/ReferenceBuilder.tsx
|
|
5596
5595
|
var import_react14 = require("react");
|
|
5597
5596
|
var import_react15 = require("@ai-matrx/records/react");
|
|
5598
|
-
var
|
|
5597
|
+
var import_core2 = require("@ai-matrx/records/core");
|
|
5599
5598
|
init_createTable();
|
|
5600
5599
|
init_Refusal();
|
|
5601
5600
|
init_tablePicking();
|
|
@@ -5684,7 +5683,7 @@ function ReferenceBuilder({
|
|
|
5684
5683
|
if (!name || making) return;
|
|
5685
5684
|
setMaking(true);
|
|
5686
5685
|
setRefused(null);
|
|
5687
|
-
const slug = (0,
|
|
5686
|
+
const slug = (0, import_field_kinds5.tokenFor)(name);
|
|
5688
5687
|
const found = await client.tableFind({ slug });
|
|
5689
5688
|
if (!found.ok) {
|
|
5690
5689
|
setMaking(false);
|
|
@@ -5698,7 +5697,7 @@ function ReferenceBuilder({
|
|
|
5698
5697
|
id = existing.id;
|
|
5699
5698
|
bornName = tableName(existing);
|
|
5700
5699
|
} else {
|
|
5701
|
-
const made = await (0,
|
|
5700
|
+
const made = await (0, import_core2.ensureTable)(client, {
|
|
5702
5701
|
name,
|
|
5703
5702
|
slug,
|
|
5704
5703
|
titleField: "name",
|
|
@@ -5717,7 +5716,7 @@ function ReferenceBuilder({
|
|
|
5717
5716
|
tables.reload();
|
|
5718
5717
|
onChange({ targetTableId: id, display: null });
|
|
5719
5718
|
};
|
|
5720
|
-
const mayMakeTable = (0,
|
|
5719
|
+
const mayMakeTable = (0, import_core2.doorReady)(client.config, import_core2.DOORS.tableFind) && (0, import_core2.doorReady)(client.config, import_core2.DOORS.tableEnsure);
|
|
5721
5720
|
const newTableButton = !mayMakeTable ? null : /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
5722
5721
|
import_design_system10.Button,
|
|
5723
5722
|
{
|
|
@@ -6229,7 +6228,7 @@ var import_react20 = require("react");
|
|
|
6229
6228
|
// src/presentation.ts
|
|
6230
6229
|
var import_table_style2 = require("@ai-matrx/design-system/data-table/table-style");
|
|
6231
6230
|
var import_field_formats2 = require("@ai-matrx/design-system/field-formats");
|
|
6232
|
-
var
|
|
6231
|
+
var import_field_kinds6 = require("@ai-matrx/records/field-kinds");
|
|
6233
6232
|
init_parity();
|
|
6234
6233
|
init_dates();
|
|
6235
6234
|
var DRAWN_KINDS = /* @__PURE__ */ new Set(["select", "multi_select", "relation", "member", "person", "attachment", "file", "entity_reference", "checkbox", "boolean", "signature", "json"]);
|
|
@@ -6257,8 +6256,8 @@ function ungroupedForYears(field, format) {
|
|
|
6257
6256
|
}
|
|
6258
6257
|
function formatForField(field) {
|
|
6259
6258
|
const shownAs = shownAsOf(field);
|
|
6260
|
-
if ((0,
|
|
6261
|
-
return { id: "rating", options: { ...shownAs?.options ?? {}, ratingMax: (0,
|
|
6259
|
+
if ((0, import_field_kinds6.newerKindOf)(field) === "rating" && (!shownAs || shownAs.id === "rating")) {
|
|
6260
|
+
return { id: "rating", options: { ...shownAs?.options ?? {}, ratingMax: (0, import_field_kinds6.ratingMaxOf)(field) } };
|
|
6262
6261
|
}
|
|
6263
6262
|
if (shownAs) return ungroupedForYears(field, shownAs);
|
|
6264
6263
|
const stamp = dateFormatFor(field);
|
|
@@ -6971,18 +6970,18 @@ function Chips({
|
|
|
6971
6970
|
}
|
|
6972
6971
|
|
|
6973
6972
|
// src/values.tsx
|
|
6974
|
-
var
|
|
6973
|
+
var import_core8 = require("@ai-matrx/records/core");
|
|
6975
6974
|
|
|
6976
6975
|
// src/WholeValue.tsx
|
|
6977
6976
|
var import_react28 = require("react");
|
|
6978
|
-
var
|
|
6977
|
+
var import_core3 = require("@ai-matrx/records/core");
|
|
6979
6978
|
var import_design_system16 = require("@ai-matrx/design-system");
|
|
6980
6979
|
init_host();
|
|
6981
6980
|
var import_outbound_react2 = require("@ai-matrx/kit/outbound-react");
|
|
6982
6981
|
var import_jsx_runtime18 = require("react/jsx-runtime");
|
|
6983
6982
|
var WHOLE_VALUE_UNBOUND = "The whole text is kept as a file, and this screen has no way to open files yet.";
|
|
6984
6983
|
function wholeValueLine(pointer) {
|
|
6985
|
-
return `Open the whole text (${(0,
|
|
6984
|
+
return `Open the whole text (${(0, import_core3.wholeValueSize)(pointer)})`;
|
|
6986
6985
|
}
|
|
6987
6986
|
function WholeValueCell({ words, pointer }) {
|
|
6988
6987
|
const host = useRecordsUi();
|
|
@@ -6993,7 +6992,7 @@ function WholeValueCell({ words, pointer }) {
|
|
|
6993
6992
|
words,
|
|
6994
6993
|
"\u2026"
|
|
6995
6994
|
] }),
|
|
6996
|
-
href ? host.Link ? host.Link({ href, children: line, className: "shrink-0 text-xs text-primary underline-offset-2 hover:underline" }) : /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_outbound_react2.OutboundLink, { className: "shrink-0 text-xs text-primary underline-offset-2 hover:underline", href, children: line }) : /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("span", { className: "shrink-0 text-xs italic text-muted-foreground", title: WHOLE_VALUE_UNBOUND, children: `${(0,
|
|
6995
|
+
href ? host.Link ? host.Link({ href, children: line, className: "shrink-0 text-xs text-primary underline-offset-2 hover:underline" }) : /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_outbound_react2.OutboundLink, { className: "shrink-0 text-xs text-primary underline-offset-2 hover:underline", href, children: line }) : /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("span", { className: "shrink-0 text-xs italic text-muted-foreground", title: WHOLE_VALUE_UNBOUND, children: `${(0, import_core3.wholeValueSize)(pointer)} in a file` })
|
|
6997
6996
|
] });
|
|
6998
6997
|
}
|
|
6999
6998
|
|
|
@@ -8122,14 +8121,19 @@ function Thumb({ src, size }) {
|
|
|
8122
8121
|
}
|
|
8123
8122
|
) });
|
|
8124
8123
|
}
|
|
8125
|
-
function LinkChip({ href }) {
|
|
8124
|
+
function LinkChip({ href, dense }) {
|
|
8126
8125
|
return /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(
|
|
8127
8126
|
import_outbound_react5.OutboundLink,
|
|
8128
8127
|
{
|
|
8129
8128
|
href,
|
|
8130
8129
|
title: href,
|
|
8131
8130
|
onClick: stop,
|
|
8132
|
-
className:
|
|
8131
|
+
className: (0, import_design_system26.cn)(
|
|
8132
|
+
"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",
|
|
8133
|
+
// A percentage max-width means nothing inside an auto-layout table cell, so a link column would hold
|
|
8134
|
+
// its full address; in a table the chip gets a real ceiling and shortens with an ellipsis.
|
|
8135
|
+
dense && "max-w-[7rem]"
|
|
8136
|
+
),
|
|
8133
8137
|
"data-records-link-chip": "",
|
|
8134
8138
|
children: [
|
|
8135
8139
|
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)("span", { "aria-hidden": "true", className: "text-muted-foreground", children: "\u2197" }),
|
|
@@ -8146,7 +8150,7 @@ function Scalar({ value, keyName, dense }) {
|
|
|
8146
8150
|
if (typeof value !== "string") return /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("span", { children: String(value) });
|
|
8147
8151
|
const text = value.trim();
|
|
8148
8152
|
if (isImageUrl(text, keyName)) return /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(Thumb, { src: text, size: dense ? "sm" : "md" });
|
|
8149
|
-
if (isUrl(text)) return /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(LinkChip, { href: text });
|
|
8153
|
+
if (isUrl(text)) return /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(LinkChip, { href: text, dense });
|
|
8150
8154
|
if (/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(text)) {
|
|
8151
8155
|
return /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("a", { href: `mailto:${text}`, onClick: stop, className: "text-primary underline-offset-2 hover:underline", children: text });
|
|
8152
8156
|
}
|
|
@@ -8164,8 +8168,8 @@ function RecordsTable({ items }) {
|
|
|
8164
8168
|
const shown2 = all ? items : items.slice(0, TABLE_ROWS);
|
|
8165
8169
|
return /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("div", { className: "min-w-0", "data-records-structured": "table", children: [
|
|
8166
8170
|
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)("div", { className: "max-w-full overflow-x-auto rounded-md border border-border", "data-records-structured-table-frame": "", children: /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("table", { className: "w-full border-collapse text-xs", children: [
|
|
8167
|
-
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)("thead", { className: "bg-muted/60 text-left", children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("tr", { children: pictureFirst.map((k) => /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("th", { scope: "col", className: "
|
|
8168
|
-
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)("tbody", { children: shown2.map((item, i) => /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("tr", { className: "border-t border-border/60 align-top", children: pictureFirst.map((k) => /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("td", { className: "min-w-[
|
|
8171
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)("thead", { className: "bg-muted/60 text-left", children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("tr", { children: pictureFirst.map((k) => /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("th", { scope: "col", className: "px-2 py-1 font-medium text-muted-foreground [overflow-wrap:anywhere]", children: keyWords(k) }, k)) }) }),
|
|
8172
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)("tbody", { children: shown2.map((item, i) => /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("tr", { className: "border-t border-border/60 align-top", children: pictureFirst.map((k) => /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("td", { className: "min-w-[2rem] max-w-[18rem] break-words px-2 py-1 [overflow-wrap:anywhere]", children: k in item ? /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(Nested, { value: item[k], keyName: k, dense: true }) : /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("span", { className: "text-muted-foreground", children: "\u2014" }) }, k)) }, i)) })
|
|
8169
8173
|
] }) }),
|
|
8170
8174
|
items.length > TABLE_ROWS ? /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(import_design_system26.Button, { type: "button", variant: "ghost", size: "sm", className: "mt-1 h-6 px-2 text-xs", onClick: (e) => {
|
|
8171
8175
|
stop(e);
|
|
@@ -8403,7 +8407,7 @@ function renderValue(field, value, document2, labels, stillWaitingFor, look, roo
|
|
|
8403
8407
|
if ((0, import_records17.isButtonField)(field)) return /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(ButtonValue, { field });
|
|
8404
8408
|
const newer = newerKindValue(field, value);
|
|
8405
8409
|
if (newer !== void 0) return newer;
|
|
8406
|
-
const whole = typeof value === "string" ? (0,
|
|
8410
|
+
const whole = typeof value === "string" ? (0, import_core8.wholeValueOf)(document2, field.key) : null;
|
|
8407
8411
|
if (whole) return /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(WholeValueCell, { words: value, pointer: whole });
|
|
8408
8412
|
const kind = editorKindFor(field);
|
|
8409
8413
|
if (kind === "relation" || kind === "entity_reference") {
|
|
@@ -10732,7 +10736,7 @@ function FieldEditor(props) {
|
|
|
10732
10736
|
return;
|
|
10733
10737
|
}
|
|
10734
10738
|
(0, import_react61.tableShapeChanged)(tableId);
|
|
10735
|
-
for (const c of done.data.undo.cells_back) (0,
|
|
10739
|
+
for (const c of done.data.undo.cells_back) (0, import_core9.announceRecordChanged)(c.record_id);
|
|
10736
10740
|
const n = done.data.rehomed.reduce((sum, r) => sum + r.records, 0);
|
|
10737
10741
|
setRehome({});
|
|
10738
10742
|
setRehomed({ said: `Saved. ${n} ${n === 1 ? "record was" : "records were"} changed with the choices.`, undo: done.data.undo });
|
|
@@ -11246,7 +11250,7 @@ function FieldEditor(props) {
|
|
|
11246
11250
|
return;
|
|
11247
11251
|
}
|
|
11248
11252
|
(0, import_react61.tableShapeChanged)(tableId);
|
|
11249
|
-
for (const c of undo.cells_back) (0,
|
|
11253
|
+
for (const c of undo.cells_back) (0, import_core9.announceRecordChanged)(c.record_id);
|
|
11250
11254
|
setChoiceList(null);
|
|
11251
11255
|
setChoiceListStart(null);
|
|
11252
11256
|
setRehomed({ said: "Undone. The choices and the records that held them are back as they were.", undo: null });
|
|
@@ -11834,7 +11838,7 @@ function ButtonValue({ field, recordId, inCell }) {
|
|
|
11834
11838
|
/* @__PURE__ */ (0, import_jsx_runtime39.jsxs)(import_design_system36.PopoverContent, { className: "w-72 space-y-2 p-3 text-sm", onClick: stop2, onPointerDown: stop2, "data-records-button-said": said2?.kind, children: [
|
|
11835
11839
|
said2?.kind === "refused" ? /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(RefusalLine, { error: said2.error }) : null,
|
|
11836
11840
|
said2?.kind === "waiting" ? /* @__PURE__ */ (0, import_jsx_runtime39.jsx)("p", { className: "matrx-shimmer rounded px-1 py-0.5", role: "status", "aria-live": "polite", children: said2.says }) : null,
|
|
11837
|
-
said2?.kind === "failed" ? /* @__PURE__ */ (0, import_jsx_runtime39.jsx)("p",
|
|
11841
|
+
said2?.kind === "failed" ? /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(import_design_system36.ErrorBox, { as: "p", className: "break-words text-destructive", message: said2.says, origin: "records-ui/buttonCell", children: said2.says }) : null,
|
|
11838
11842
|
said2?.kind === "public" ? /* @__PURE__ */ (0, import_jsx_runtime39.jsx)("p", { children: "Buttons run for signed-in people." }) : null,
|
|
11839
11843
|
said2?.kind === "ran" ? /* @__PURE__ */ (0, import_jsx_runtime39.jsxs)("div", { className: "break-words", children: [
|
|
11840
11844
|
said2.value ? /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(StructuredValueView, { structured: said2.value, label: b.label }) : null,
|