@ai-matrx/records-ui 0.113.3 → 0.113.4
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 +11 -0
- package/dist/index.cjs +280 -259
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +38 -17
- package/dist/index.js.map +1 -1
- package/dist/pickers.cjs +89 -74
- package/dist/pickers.cjs.map +1 -1
- package/dist/pickers.js +20 -5
- package/dist/pickers.js.map +1 -1
- package/package.json +2 -2
package/dist/index.cjs
CHANGED
|
@@ -1240,7 +1240,7 @@ var import_design_system7 = require("@ai-matrx/design-system");
|
|
|
1240
1240
|
var REVERSE_COLUMN_PREFIX = "linked:";
|
|
1241
1241
|
|
|
1242
1242
|
// src/gridPage.ts
|
|
1243
|
-
var
|
|
1243
|
+
var import_records5 = require("@ai-matrx/records");
|
|
1244
1244
|
var import_data_table2 = require("@ai-matrx/design-system/data-table");
|
|
1245
1245
|
|
|
1246
1246
|
// src/personTime.ts
|
|
@@ -1292,6 +1292,7 @@ function personWallNow(at = /* @__PURE__ */ new Date()) {
|
|
|
1292
1292
|
}
|
|
1293
1293
|
|
|
1294
1294
|
// src/choiceLooks.ts
|
|
1295
|
+
var import_records2 = require("@ai-matrx/records");
|
|
1295
1296
|
var import_data_table = require("@ai-matrx/design-system/data-table");
|
|
1296
1297
|
function displayFormatOf(field2) {
|
|
1297
1298
|
const raw = field2.display_format;
|
|
@@ -1326,6 +1327,20 @@ function choiceLooksOf(field2) {
|
|
|
1326
1327
|
function choiceWord(value) {
|
|
1327
1328
|
return String(value ?? "").trim().toLowerCase().replace(/[^a-z0-9]+/g, "_").replace(/^_+|_+$/g, "");
|
|
1328
1329
|
}
|
|
1330
|
+
var STATUS_GROUP_COLOR = { todo: "gray", in_progress: "blue", done: "green" };
|
|
1331
|
+
function statusGroupColor(field2, value) {
|
|
1332
|
+
if ((0, import_records2.newerKindOf)(field2) !== "status" || value === null || value === void 0 || value === "") return void 0;
|
|
1333
|
+
const word = choiceWord(value);
|
|
1334
|
+
if (word === "") return void 0;
|
|
1335
|
+
const groups = (field2.config ?? {})["status_groups"];
|
|
1336
|
+
if (groups && typeof groups === "object") {
|
|
1337
|
+
for (const [key, group] of Object.entries(groups)) {
|
|
1338
|
+
if (choiceWord(key) !== word) continue;
|
|
1339
|
+
return group === "in_progress" ? STATUS_GROUP_COLOR.in_progress : group === "done" ? STATUS_GROUP_COLOR.done : STATUS_GROUP_COLOR.todo;
|
|
1340
|
+
}
|
|
1341
|
+
}
|
|
1342
|
+
return STATUS_GROUP_COLOR.todo;
|
|
1343
|
+
}
|
|
1329
1344
|
function storedChoiceColor(field2, value) {
|
|
1330
1345
|
if (value === null || value === void 0 || value === "") return void 0;
|
|
1331
1346
|
const word = choiceWord(value);
|
|
@@ -1334,7 +1349,7 @@ function storedChoiceColor(field2, value) {
|
|
|
1334
1349
|
if (!look.color) continue;
|
|
1335
1350
|
if (choiceWord(look.value) === word || look.label && choiceWord(look.label) === word) return look.color;
|
|
1336
1351
|
}
|
|
1337
|
-
return
|
|
1352
|
+
return statusGroupColor(field2, value);
|
|
1338
1353
|
}
|
|
1339
1354
|
function storedChoiceColorLookup(fields, fallback) {
|
|
1340
1355
|
const byKey = new Map(fields.map((f) => [f.key, f]));
|
|
@@ -1358,7 +1373,7 @@ function choiceChipLookOf(field2, ...words2) {
|
|
|
1358
1373
|
}
|
|
1359
1374
|
|
|
1360
1375
|
// src/parity.ts
|
|
1361
|
-
var
|
|
1376
|
+
var import_records4 = require("@ai-matrx/records");
|
|
1362
1377
|
var import_text_case2 = require("@ai-matrx/kit/text-case");
|
|
1363
1378
|
|
|
1364
1379
|
// src/docs.ts
|
|
@@ -1384,7 +1399,7 @@ function isSignatureField(field2) {
|
|
|
1384
1399
|
}
|
|
1385
1400
|
|
|
1386
1401
|
// src/fieldTypes.ts
|
|
1387
|
-
var
|
|
1402
|
+
var import_records3 = require("@ai-matrx/records");
|
|
1388
1403
|
var LOOK_KINDS = {
|
|
1389
1404
|
rating: { plain: "number", look: ({ ratingMax }) => ({ id: "rating", options: { ratingMax } }) },
|
|
1390
1405
|
time: { plain: "text", look: () => ({ id: "time" }) }
|
|
@@ -1393,9 +1408,9 @@ function declaredAsLook(kind) {
|
|
|
1393
1408
|
return kind in LOOK_KINDS && !storePublishesKind(kind);
|
|
1394
1409
|
}
|
|
1395
1410
|
function storePublishesKind(kind) {
|
|
1396
|
-
return
|
|
1411
|
+
return import_records3.DECLARABLE_FIELD_KINDS.some((row) => row.kind === kind);
|
|
1397
1412
|
}
|
|
1398
|
-
var STORE_PUBLISHES_ENTITY_REFERENCE =
|
|
1413
|
+
var STORE_PUBLISHES_ENTITY_REFERENCE = import_records3.DECLARABLE_FIELD_KINDS.some(
|
|
1399
1414
|
(row) => row.kind === "entity_reference"
|
|
1400
1415
|
);
|
|
1401
1416
|
var SYSTEM_FIELD_KINDS = ["autonumber", "created_time", "modified_time"];
|
|
@@ -1442,7 +1457,7 @@ var FIELD_TYPE_CATALOGUE = [
|
|
|
1442
1457
|
{ id: "created_by", group: "Worked out", label: "Created by", explanation: "Who made each record. Nobody types it." },
|
|
1443
1458
|
{ id: "modified_by", group: "Worked out", label: "Last changed by", explanation: "Who last changed each record. Nobody types it." }
|
|
1444
1459
|
];
|
|
1445
|
-
var GATED_KINDS = /* @__PURE__ */ new Set(["entity_reference", ...
|
|
1460
|
+
var GATED_KINDS = /* @__PURE__ */ new Set(["entity_reference", ...import_records3.NEWER_FIELD_KINDS]);
|
|
1446
1461
|
var FIELD_TYPE_CHOICES = FIELD_TYPE_CATALOGUE.filter(
|
|
1447
1462
|
(c) => !GATED_KINDS.has(c.id) || storePublishesKind(c.id) || c.id in LOOK_KINDS
|
|
1448
1463
|
);
|
|
@@ -1463,20 +1478,20 @@ function isRelationFieldType(id) {
|
|
|
1463
1478
|
return id === "relation";
|
|
1464
1479
|
}
|
|
1465
1480
|
function isParityFieldType(id) {
|
|
1466
|
-
return
|
|
1481
|
+
return import_records3.PARITY_FIELD_TYPES.some((row) => row.parity_type === id);
|
|
1467
1482
|
}
|
|
1468
1483
|
function parityTypesWithNoExplanation() {
|
|
1469
|
-
return
|
|
1484
|
+
return import_records3.PARITY_FIELD_TYPES.map((row) => row.parity_type).filter((type) => !BY_ID.has(type));
|
|
1470
1485
|
}
|
|
1471
1486
|
function kindsWithNoChoice() {
|
|
1472
|
-
return
|
|
1487
|
+
return import_records3.DECLARABLE_FIELD_KINDS.map((row) => row.kind).filter((kind) => !BY_ID.has(kind));
|
|
1473
1488
|
}
|
|
1474
1489
|
var ADD_FIELD_OPEN_LABEL = "Add column";
|
|
1475
1490
|
var ADD_FIELD_SAVE_LABEL = "Create column";
|
|
1476
1491
|
var EDIT_FIELD_SAVE_LABEL = "Save column";
|
|
1477
1492
|
|
|
1478
1493
|
// src/parity.ts
|
|
1479
|
-
var kernelId = (name) =>
|
|
1494
|
+
var kernelId = (name) => import_records4.KERNEL_TABLES.find((t) => t.name === name)?.id ?? "";
|
|
1480
1495
|
var KERNEL_FILE_TABLE = kernelId("File");
|
|
1481
1496
|
var KERNEL_PERSON_TABLE = kernelId("Person");
|
|
1482
1497
|
var PARITY_LABEL = {
|
|
@@ -1496,15 +1511,15 @@ var PARITY_LABEL = {
|
|
|
1496
1511
|
url: "Link"
|
|
1497
1512
|
};
|
|
1498
1513
|
var PARITY_MADE_OF = Object.fromEntries(
|
|
1499
|
-
|
|
1514
|
+
import_records4.PARITY_FIELD_TYPES.map((p) => [p.parity_type, p.made_of])
|
|
1500
1515
|
);
|
|
1501
1516
|
var KERNEL = { file: KERNEL_FILE_TABLE, person: KERNEL_PERSON_TABLE };
|
|
1502
1517
|
function editorKindFor(field2) {
|
|
1503
|
-
return (0,
|
|
1518
|
+
return (0, import_records4.fieldKindFor)(field2, KERNEL);
|
|
1504
1519
|
}
|
|
1505
1520
|
function pickableTypeOf(field2) {
|
|
1506
1521
|
if (isSignatureField(field2)) return "signature";
|
|
1507
|
-
const newer = (0,
|
|
1522
|
+
const newer = (0, import_records4.newerKindOf)(field2);
|
|
1508
1523
|
if (newer) return newer;
|
|
1509
1524
|
const look = displayFormatOf(field2)?.id;
|
|
1510
1525
|
if (look === "rating" && field2.type === "range") return "rating";
|
|
@@ -1661,7 +1676,7 @@ function storeQuestion(fields, base, columnFilters, now = /* @__PURE__ */ new Da
|
|
|
1661
1676
|
const refused = [];
|
|
1662
1677
|
const flat = {};
|
|
1663
1678
|
const rules = [];
|
|
1664
|
-
if (base && (0,
|
|
1679
|
+
if (base && (0, import_records5.isRuleFilter)(base)) rules.push(base);
|
|
1665
1680
|
else if (base) Object.assign(flat, base);
|
|
1666
1681
|
for (const [key, value] of Object.entries(columnFilters)) {
|
|
1667
1682
|
if (!value) continue;
|
|
@@ -1766,7 +1781,7 @@ var ENRICH_CELLS_FRESH_MS = 5e3;
|
|
|
1766
1781
|
// src/labels.tsx
|
|
1767
1782
|
var import_react7 = require("react");
|
|
1768
1783
|
var import_react8 = require("@ai-matrx/records/react");
|
|
1769
|
-
var
|
|
1784
|
+
var import_records6 = require("@ai-matrx/records");
|
|
1770
1785
|
var import_uuid2 = require("@ai-matrx/kit/uuid");
|
|
1771
1786
|
|
|
1772
1787
|
// src/signature.tsx
|
|
@@ -2073,7 +2088,7 @@ function pointsAtRecords(field2) {
|
|
|
2073
2088
|
}
|
|
2074
2089
|
function shownValue(field2, value, labels) {
|
|
2075
2090
|
if (isSignatureField(field2)) return signatureWords(value);
|
|
2076
|
-
const newerWords = value === null || value === void 0 ? null : (0,
|
|
2091
|
+
const newerWords = value === null || value === void 0 ? null : (0, import_records6.newerKindExportWords)(field2, value);
|
|
2077
2092
|
if (newerWords !== null) return newerWords;
|
|
2078
2093
|
if (!labels || !pointsAtRecords(field2)) return value;
|
|
2079
2094
|
const ids = idsOf(value);
|
|
@@ -2138,7 +2153,7 @@ function RecordLabelProvider({ children }) {
|
|
|
2138
2153
|
for (const option of result.data ?? []) {
|
|
2139
2154
|
const words2 = recordName(option.data, null, "Unnamed choice");
|
|
2140
2155
|
next[option.id] = words2;
|
|
2141
|
-
const key = (0,
|
|
2156
|
+
const key = (0, import_records6.optionKey)(option);
|
|
2142
2157
|
if (key) next[choiceKeyName(field2.id, key)] = words2;
|
|
2143
2158
|
}
|
|
2144
2159
|
return next;
|
|
@@ -2434,7 +2449,7 @@ function gridCopyConfig(args) {
|
|
|
2434
2449
|
|
|
2435
2450
|
// src/FieldRetype.tsx
|
|
2436
2451
|
var import_react9 = require("react");
|
|
2437
|
-
var
|
|
2452
|
+
var import_records7 = require("@ai-matrx/records");
|
|
2438
2453
|
var import_react10 = require("@ai-matrx/records/react");
|
|
2439
2454
|
var import_design_system3 = require("@ai-matrx/design-system");
|
|
2440
2455
|
|
|
@@ -2577,7 +2592,7 @@ function FieldRetype({ field: field2, tableId, onRetyped }) {
|
|
|
2577
2592
|
return;
|
|
2578
2593
|
}
|
|
2579
2594
|
const groups = answer.data.map((row) => ({ value: row.groups[field2.key] ?? null, count: row.row_count }));
|
|
2580
|
-
setPreview((0,
|
|
2595
|
+
setPreview((0, import_records7.previewRetype)({ type: to.behaviour, kind: to.kind }, groups, answer.data.length >= PREVIEW_GROUPS));
|
|
2581
2596
|
});
|
|
2582
2597
|
return () => {
|
|
2583
2598
|
cancelled = true;
|
|
@@ -3768,7 +3783,7 @@ var import_core3 = require("@ai-matrx/records/core");
|
|
|
3768
3783
|
|
|
3769
3784
|
// src/tablePicking.tsx
|
|
3770
3785
|
var import_react16 = require("react");
|
|
3771
|
-
var
|
|
3786
|
+
var import_records8 = require("@ai-matrx/records");
|
|
3772
3787
|
var import_react17 = require("@ai-matrx/records/react");
|
|
3773
3788
|
var import_design_system8 = require("@ai-matrx/design-system");
|
|
3774
3789
|
var import_jsx_runtime10 = require("react/jsx-runtime");
|
|
@@ -3832,7 +3847,7 @@ function usePickerTables() {
|
|
|
3832
3847
|
};
|
|
3833
3848
|
}, [client, nonce]);
|
|
3834
3849
|
const data = (0, import_react16.useMemo)(
|
|
3835
|
-
() => (0,
|
|
3850
|
+
() => (0, import_records8.withTablePlacement)(tables.data ?? [], facts === "reading" ? null : facts),
|
|
3836
3851
|
[tables.data, facts]
|
|
3837
3852
|
);
|
|
3838
3853
|
return { loading: tables.loading || facts === "reading", data, reload };
|
|
@@ -4183,7 +4198,7 @@ function ReferenceBuilder({
|
|
|
4183
4198
|
|
|
4184
4199
|
// src/PersonPicker.tsx
|
|
4185
4200
|
var import_react20 = require("react");
|
|
4186
|
-
var
|
|
4201
|
+
var import_records9 = require("@ai-matrx/records");
|
|
4187
4202
|
var import_react21 = require("@ai-matrx/records/react");
|
|
4188
4203
|
var import_design_system10 = require("@ai-matrx/design-system");
|
|
4189
4204
|
var import_jsx_runtime12 = require("react/jsx-runtime");
|
|
@@ -4265,7 +4280,7 @@ function PersonPicker({ field: field2, value, onChange, disabled, id, className,
|
|
|
4265
4280
|
cancelled = true;
|
|
4266
4281
|
};
|
|
4267
4282
|
}, [client, personTable, picked.length, people.length]);
|
|
4268
|
-
const listed = (0,
|
|
4283
|
+
const listed = (0, import_records9.rankTypedMatches)(members ?? [], search, memberName);
|
|
4269
4284
|
if (!membersPort || !client) {
|
|
4270
4285
|
return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("p", { className: (0, import_design_system10.cn)("text-xs text-muted-foreground", className), children: NO_MEMBERS_REASON });
|
|
4271
4286
|
}
|
|
@@ -4377,7 +4392,7 @@ var import_design_system25 = require("@ai-matrx/design-system");
|
|
|
4377
4392
|
var import_table_style = require("@ai-matrx/design-system/data-table/table-style");
|
|
4378
4393
|
var import_data_table3 = require("@ai-matrx/design-system/data-table");
|
|
4379
4394
|
var import_field_formats2 = require("@ai-matrx/design-system/field-formats");
|
|
4380
|
-
var
|
|
4395
|
+
var import_records10 = require("@ai-matrx/records");
|
|
4381
4396
|
|
|
4382
4397
|
// src/dates.ts
|
|
4383
4398
|
var import_field_formats = require("@ai-matrx/design-system/field-formats");
|
|
@@ -4655,8 +4670,8 @@ function shownAsOf(field2) {
|
|
|
4655
4670
|
}
|
|
4656
4671
|
function formatForField(field2) {
|
|
4657
4672
|
const shownAs = shownAsOf(field2);
|
|
4658
|
-
if ((0,
|
|
4659
|
-
return { id: "rating", options: { ...shownAs?.options ?? {}, ratingMax: (0,
|
|
4673
|
+
if ((0, import_records10.newerKindOf)(field2) === "rating" && (!shownAs || shownAs.id === "rating")) {
|
|
4674
|
+
return { id: "rating", options: { ...shownAs?.options ?? {}, ratingMax: (0, import_records10.ratingMaxOf)(field2) } };
|
|
4660
4675
|
}
|
|
4661
4676
|
if (shownAs) return shownAs;
|
|
4662
4677
|
const stamp = dateFormatFor(field2);
|
|
@@ -4778,28 +4793,28 @@ function resolveTableStyle(decorations, fields, viewStyle) {
|
|
|
4778
4793
|
|
|
4779
4794
|
// src/editors.tsx
|
|
4780
4795
|
var import_react36 = require("react");
|
|
4781
|
-
var
|
|
4796
|
+
var import_records15 = require("@ai-matrx/records");
|
|
4782
4797
|
var import_react37 = require("@ai-matrx/records/react");
|
|
4783
4798
|
var import_design_system19 = require("@ai-matrx/design-system");
|
|
4784
4799
|
|
|
4785
4800
|
// src/newerKindValues.tsx
|
|
4786
4801
|
var import_react22 = require("react");
|
|
4787
4802
|
var import_source = require("@ai-matrx/content-ir/source");
|
|
4788
|
-
var
|
|
4803
|
+
var import_records11 = require("@ai-matrx/records");
|
|
4789
4804
|
var import_design_system11 = require("@ai-matrx/design-system");
|
|
4790
4805
|
var import_jsx_runtime13 = require("react/jsx-runtime");
|
|
4791
4806
|
var own = (event) => event.stopPropagation();
|
|
4792
4807
|
function newerKindValue(field2, value, opts = {}) {
|
|
4793
|
-
switch ((0,
|
|
4808
|
+
switch ((0, import_records11.newerKindOf)(field2)) {
|
|
4794
4809
|
case "duration": {
|
|
4795
|
-
const words2 = (0,
|
|
4810
|
+
const words2 = (0, import_records11.durationText)(value);
|
|
4796
4811
|
return words2 === null ? void 0 : /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("span", { className: "tabular-nums", "data-records-duration": "", children: words2 });
|
|
4797
4812
|
}
|
|
4798
4813
|
case "created_by":
|
|
4799
4814
|
case "modified_by":
|
|
4800
|
-
return (0,
|
|
4815
|
+
return (0, import_records11.isPersonStamp)(value) ? /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(PersonStampChip, { stamp: value }) : void 0;
|
|
4801
4816
|
case "address":
|
|
4802
|
-
return (0,
|
|
4817
|
+
return (0, import_records11.isAddressValue)(value) || typeof value === "string" ? /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(AddressLink, { value }) : void 0;
|
|
4803
4818
|
case "barcode":
|
|
4804
4819
|
return typeof value === "string" ? /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("span", { className: "inline-flex min-w-0 items-center gap-1 font-mono text-xs", "data-records-barcode": "", title: value, children: [
|
|
4805
4820
|
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)("span", { "aria-hidden": "true", className: "text-muted-foreground", children: "\u25AE\u25AF\u25AE" }),
|
|
@@ -4814,7 +4829,7 @@ function newerKindValue(field2, value, opts = {}) {
|
|
|
4814
4829
|
}
|
|
4815
4830
|
}
|
|
4816
4831
|
function PersonStampChip({ stamp }) {
|
|
4817
|
-
const words2 = (0,
|
|
4832
|
+
const words2 = (0, import_records11.personStampText)(stamp) ?? import_records11.NOT_A_MEMBER_WORDS;
|
|
4818
4833
|
const tier = stamp.actor ?? "user";
|
|
4819
4834
|
const name = tier === "user" ? stamp.name : null;
|
|
4820
4835
|
const initial = tier === "system" ? "\u2699" : tier === "agent" ? "\u2726" : name && name.trim() !== "" ? name.trim()[0].toUpperCase() : "?";
|
|
@@ -4831,8 +4846,8 @@ function PersonStampChip({ stamp }) {
|
|
|
4831
4846
|
] });
|
|
4832
4847
|
}
|
|
4833
4848
|
function AddressLink({ value }) {
|
|
4834
|
-
const words2 = (0,
|
|
4835
|
-
const href = (0,
|
|
4849
|
+
const words2 = (0, import_records11.addressText)(value);
|
|
4850
|
+
const href = (0, import_records11.addressMapUrl)(value);
|
|
4836
4851
|
if (!words2 || !href) return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("span", { className: "text-muted-foreground", children: "\u2014" });
|
|
4837
4852
|
return /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(
|
|
4838
4853
|
"a",
|
|
@@ -4853,11 +4868,11 @@ function AddressLink({ value }) {
|
|
|
4853
4868
|
}
|
|
4854
4869
|
var STATUS_GROUP_MARK = { todo: "\u25CB", in_progress: "\u25D0", done: "\u25CF" };
|
|
4855
4870
|
function statusMarkOf(field2, value, document2) {
|
|
4856
|
-
if ((0,
|
|
4871
|
+
if ((0, import_records11.newerKindOf)(field2) !== "status" || typeof value !== "string") return null;
|
|
4857
4872
|
const chosen = document2?.["_choices"]?.[field2.key];
|
|
4858
4873
|
const key = chosen && typeof chosen === "object" && typeof chosen.key === "string" ? chosen.key : value;
|
|
4859
|
-
const group = (0,
|
|
4860
|
-
return { mark: STATUS_GROUP_MARK[group], group, words:
|
|
4874
|
+
const group = (0, import_records11.statusGroupOf)(field2, key);
|
|
4875
|
+
return { mark: STATUS_GROUP_MARK[group], group, words: import_records11.STATUS_GROUP_WORDS[group] };
|
|
4861
4876
|
}
|
|
4862
4877
|
function inline(text2, key) {
|
|
4863
4878
|
const out = [];
|
|
@@ -4885,7 +4900,7 @@ function marks(text2, key) {
|
|
|
4885
4900
|
if (tok.startsWith("**") || tok.startsWith("__")) out.push(/* @__PURE__ */ (0, import_jsx_runtime13.jsx)("strong", { children: tok.slice(2, -2) }, k));
|
|
4886
4901
|
else if (tok.startsWith("[")) {
|
|
4887
4902
|
const link = /^\[([^\]]+)\]\(([^)\s]+)\)$/.exec(tok);
|
|
4888
|
-
const href = (0,
|
|
4903
|
+
const href = (0, import_records11.safeLinkHref)(link?.[2] ?? "");
|
|
4889
4904
|
out.push(
|
|
4890
4905
|
href ? /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("a", { href, target: "_blank", rel: "noopener noreferrer", className: "text-primary underline-offset-2 hover:underline", onClick: own, children: link?.[1] }, k) : link?.[1] ?? tok
|
|
4891
4906
|
);
|
|
@@ -4950,7 +4965,7 @@ function SafeMarkdown({ text: text2, clipped }) {
|
|
|
4950
4965
|
);
|
|
4951
4966
|
}
|
|
4952
4967
|
function newerKindControl(props) {
|
|
4953
|
-
switch ((0,
|
|
4968
|
+
switch ((0, import_records11.newerKindOf)(props.field)) {
|
|
4954
4969
|
case "duration":
|
|
4955
4970
|
return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(DurationControl, { ...props });
|
|
4956
4971
|
case "address":
|
|
@@ -4966,10 +4981,10 @@ function newerKindControl(props) {
|
|
|
4966
4981
|
}
|
|
4967
4982
|
}
|
|
4968
4983
|
function DurationControl({ value, onChange, disabled, id }) {
|
|
4969
|
-
const [text2, setText] = (0, import_react22.useState)(() => (0,
|
|
4984
|
+
const [text2, setText] = (0, import_react22.useState)(() => (0, import_records11.durationText)(value) ?? "");
|
|
4970
4985
|
const [wrong, setWrong] = (0, import_react22.useState)(false);
|
|
4971
4986
|
(0, import_react22.useEffect)(() => {
|
|
4972
|
-
setText((0,
|
|
4987
|
+
setText((0, import_records11.durationText)(value) ?? "");
|
|
4973
4988
|
}, [value]);
|
|
4974
4989
|
return /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("span", { className: "flex flex-col gap-1", children: [
|
|
4975
4990
|
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
@@ -4989,12 +5004,12 @@ function DurationControl({ value, onChange, disabled, id }) {
|
|
|
4989
5004
|
onChange(null);
|
|
4990
5005
|
return;
|
|
4991
5006
|
}
|
|
4992
|
-
const seconds = (0,
|
|
5007
|
+
const seconds = (0, import_records11.readTypedDuration)(e.target.value);
|
|
4993
5008
|
setWrong(seconds === null);
|
|
4994
5009
|
if (seconds !== null) onChange(seconds);
|
|
4995
5010
|
},
|
|
4996
5011
|
onBlur: () => {
|
|
4997
|
-
if (!wrong) setText((0,
|
|
5012
|
+
if (!wrong) setText((0, import_records11.durationText)(value) ?? "");
|
|
4998
5013
|
}
|
|
4999
5014
|
}
|
|
5000
5015
|
),
|
|
@@ -5016,13 +5031,13 @@ var ADDRESS_EXAMPLES = {
|
|
|
5016
5031
|
country: "US"
|
|
5017
5032
|
};
|
|
5018
5033
|
function AddressControl({ value, onChange, disabled, id }) {
|
|
5019
|
-
const held = (0,
|
|
5034
|
+
const held = (0, import_records11.isAddressValue)(value) ? value : typeof value === "string" && value.trim() !== "" ? { street: value } : {};
|
|
5020
5035
|
const set = (part, words2) => {
|
|
5021
5036
|
const next = { ...held, [part]: words2 };
|
|
5022
5037
|
const kept = Object.fromEntries(Object.entries(next).filter(([, v]) => typeof v === "string" && v.trim() !== ""));
|
|
5023
5038
|
onChange(Object.keys(kept).length === 0 ? null : kept);
|
|
5024
5039
|
};
|
|
5025
|
-
return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("span", { id, className: "grid grid-cols-2 gap-1.5", "data-records-address-control": "", children:
|
|
5040
|
+
return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("span", { id, className: "grid grid-cols-2 gap-1.5", "data-records-address-control": "", children: import_records11.ADDRESS_PARTS.map((part) => /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
5026
5041
|
import_design_system11.BasicInput,
|
|
5027
5042
|
{
|
|
5028
5043
|
"aria-label": ADDRESS_LABELS[part],
|
|
@@ -5099,7 +5114,7 @@ function BarcodeControl({ value, onChange, disabled, id }) {
|
|
|
5099
5114
|
|
|
5100
5115
|
// src/RelationPicker.tsx
|
|
5101
5116
|
var import_react23 = require("react");
|
|
5102
|
-
var
|
|
5117
|
+
var import_records12 = require("@ai-matrx/records");
|
|
5103
5118
|
var import_react24 = require("@ai-matrx/records/react");
|
|
5104
5119
|
var import_design_system12 = require("@ai-matrx/design-system");
|
|
5105
5120
|
|
|
@@ -5289,7 +5304,7 @@ function RelationPicker({ field: field2, value, onChange, disabled, id, classNam
|
|
|
5289
5304
|
toggle(createdId);
|
|
5290
5305
|
};
|
|
5291
5306
|
const apart = tellApart(rows ?? [], titleOf);
|
|
5292
|
-
const visible = (0,
|
|
5307
|
+
const visible = (0, import_records12.rankTypedMatches)(rows ?? [], search, (row) => [titleOf(row.id), apart.get(row.id) ?? ""]);
|
|
5293
5308
|
const anchored = autoOpen === true;
|
|
5294
5309
|
const cellChips = picked.map((recordId) => /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
5295
5310
|
RecordChip,
|
|
@@ -5677,14 +5692,14 @@ function AttachmentControl({
|
|
|
5677
5692
|
|
|
5678
5693
|
// src/EntityReferenceControl.tsx
|
|
5679
5694
|
var import_react28 = require("react");
|
|
5680
|
-
var
|
|
5695
|
+
var import_records13 = require("@ai-matrx/records");
|
|
5681
5696
|
var import_react29 = require("@ai-matrx/records/react");
|
|
5682
5697
|
var import_design_system15 = require("@ai-matrx/design-system");
|
|
5683
5698
|
var import_jsx_runtime17 = require("react/jsx-runtime");
|
|
5684
5699
|
var WITHHELD_ENTITY_LABEL = "Something you have not been given access to";
|
|
5685
5700
|
var ENTITY_REFERENCE_EMPTY = "Nothing is pointed at yet.";
|
|
5686
5701
|
function entityReferenceText(value) {
|
|
5687
|
-
const refs = (0,
|
|
5702
|
+
const refs = (0, import_records13.entityRefsOf)(value);
|
|
5688
5703
|
if (refs.length === 0) return "\u2014";
|
|
5689
5704
|
return refs.map((r) => r.label ?? WITHHELD_ENTITY_LABEL).join(", ");
|
|
5690
5705
|
}
|
|
@@ -5698,7 +5713,7 @@ function EntityReferenceControl(props) {
|
|
|
5698
5713
|
return client ? /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(WithWords, { ...props }) : /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(Chips, { ...props, words: null, picker: null });
|
|
5699
5714
|
}
|
|
5700
5715
|
function WithWords(props) {
|
|
5701
|
-
const refs = (0, import_react28.useMemo)(() => (0,
|
|
5716
|
+
const refs = (0, import_react28.useMemo)(() => (0, import_records13.entityRefsOf)(props.value), [props.value]);
|
|
5702
5717
|
const [known, setKnown] = (0, import_react28.useState)([]);
|
|
5703
5718
|
const withKnown = refs.map((r) => r.label === null ? known.find((k) => k.token === r.token && k.id === r.id) ?? r : r);
|
|
5704
5719
|
const unlabelled = (0, import_react28.useMemo)(
|
|
@@ -5716,7 +5731,7 @@ function WithWords(props) {
|
|
|
5716
5731
|
setKnown((k) => [...k.filter((x) => !(x.token === picked.token && x.id === picked.id)), picked]);
|
|
5717
5732
|
const multi = Boolean(props.field.multi);
|
|
5718
5733
|
const next = multi ? [...withKnown.filter((x) => !(x.token === picked.token && x.id === picked.id)), picked] : [picked];
|
|
5719
|
-
props.onChange((0,
|
|
5734
|
+
props.onChange((0, import_records13.entityRefsToWrite)(next, multi));
|
|
5720
5735
|
}
|
|
5721
5736
|
}
|
|
5722
5737
|
);
|
|
@@ -5805,7 +5820,7 @@ function Chips({
|
|
|
5805
5820
|
words: words2,
|
|
5806
5821
|
picker
|
|
5807
5822
|
}) {
|
|
5808
|
-
const refs = (0, import_react28.useMemo)(() => (0,
|
|
5823
|
+
const refs = (0, import_react28.useMemo)(() => (0, import_records13.entityRefsOf)(value), [value]);
|
|
5809
5824
|
const labelOf = (token2, refId, own3) => {
|
|
5810
5825
|
if (own3) return own3;
|
|
5811
5826
|
const read = words2?.data?.find((w) => w.token === token2 && w.id === refId)?.label;
|
|
@@ -5829,7 +5844,7 @@ function Chips({
|
|
|
5829
5844
|
"aria-label": `Take ${label} off`,
|
|
5830
5845
|
onClick: () => {
|
|
5831
5846
|
const rest = refs.filter((x) => !(x.token === r.token && x.id === r.id));
|
|
5832
|
-
onChange((0,
|
|
5847
|
+
onChange((0, import_records13.entityRefsToWrite)(rest, multi));
|
|
5833
5848
|
},
|
|
5834
5849
|
children: "\xD7"
|
|
5835
5850
|
}
|
|
@@ -6159,7 +6174,7 @@ function formatControl(args) {
|
|
|
6159
6174
|
// src/typedDateHelper.tsx
|
|
6160
6175
|
var import_react33 = require("react");
|
|
6161
6176
|
var import_design_system18 = require("@ai-matrx/design-system");
|
|
6162
|
-
var
|
|
6177
|
+
var import_records14 = require("@ai-matrx/records");
|
|
6163
6178
|
var import_jsx_runtime21 = require("react/jsx-runtime");
|
|
6164
6179
|
var WEEK = ["Su", "Mo", "Tu", "We", "Th", "Fr", "Sa"];
|
|
6165
6180
|
var MONTHS = ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"];
|
|
@@ -6168,12 +6183,12 @@ function pad2(n) {
|
|
|
6168
6183
|
}
|
|
6169
6184
|
function readBox(text2, kind) {
|
|
6170
6185
|
if (kind === "time") {
|
|
6171
|
-
const t = (0,
|
|
6186
|
+
const t = (0, import_records14.readTypedTime)(text2);
|
|
6172
6187
|
if (!t.ok) return { day: null, time: null };
|
|
6173
6188
|
const [h, m] = t.value.split(":").map(Number);
|
|
6174
6189
|
return { day: null, time: { h, m } };
|
|
6175
6190
|
}
|
|
6176
|
-
const read = (0,
|
|
6191
|
+
const read = (0, import_records14.readTypedDate)(text2, { withTime: kind === "datetime" });
|
|
6177
6192
|
if (!read.ok) return { day: null, time: null };
|
|
6178
6193
|
if (kind === "datetime" && read.instant) {
|
|
6179
6194
|
const at = new Date(read.instant);
|
|
@@ -6182,10 +6197,10 @@ function readBox(text2, kind) {
|
|
|
6182
6197
|
return { day: read.day, time: null };
|
|
6183
6198
|
}
|
|
6184
6199
|
function wordsFor(kind, day, time) {
|
|
6185
|
-
if (kind === "time") return time ? (0,
|
|
6200
|
+
if (kind === "time") return time ? (0, import_records14.typedTimeText)(time.h, time.m) : "";
|
|
6186
6201
|
if (!day) return "";
|
|
6187
|
-
const dayText = (0,
|
|
6188
|
-
return kind === "datetime" && time ? `${dayText} ${(0,
|
|
6202
|
+
const dayText = (0, import_records14.typedDateText)(day);
|
|
6203
|
+
return kind === "datetime" && time ? `${dayText} ${(0, import_records14.typedTimeText)(time.h, time.m)}` : dayText;
|
|
6189
6204
|
}
|
|
6190
6205
|
var keepFocus = { onMouseDown: (e) => e.preventDefault(), tabIndex: -1 };
|
|
6191
6206
|
function CalendarGlyph() {
|
|
@@ -6307,7 +6322,7 @@ function TypedDateHelper({
|
|
|
6307
6322
|
held.time && held.time.h === t.h && held.time.m === t.m ? "bg-primary text-primary-foreground" : ""
|
|
6308
6323
|
),
|
|
6309
6324
|
onClick: () => pickTime(t),
|
|
6310
|
-
children: (0,
|
|
6325
|
+
children: (0, import_records14.typedTimeText)(t.h, t.m)
|
|
6311
6326
|
},
|
|
6312
6327
|
`${t.h}:${t.m}`
|
|
6313
6328
|
)) })
|
|
@@ -6394,7 +6409,7 @@ function FieldLabel({ field: field2, htmlFor, children }) {
|
|
|
6394
6409
|
return /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("div", { className: "flex items-baseline gap-1.5", children: [
|
|
6395
6410
|
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_design_system19.Label, { htmlFor, className: "text-xs font-medium", children: fieldName(field2) }),
|
|
6396
6411
|
field2.required ? /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("span", { className: "text-xs text-destructive", children: "required" }) : null,
|
|
6397
|
-
field2.unit && (0,
|
|
6412
|
+
field2.unit && (0, import_records15.newerKindOf)(field2) !== "duration" ? /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("span", { className: "text-xs text-muted-foreground", children: field2.unit }) : null,
|
|
6398
6413
|
children
|
|
6399
6414
|
] });
|
|
6400
6415
|
}
|
|
@@ -6429,21 +6444,21 @@ function judgeTyped(field2, text2, choices, nudge) {
|
|
|
6429
6444
|
const format = formatForField(field2);
|
|
6430
6445
|
if (trimmed === "") return { value: null };
|
|
6431
6446
|
if (format && format.id === "time") {
|
|
6432
|
-
const read2 = (0,
|
|
6447
|
+
const read2 = (0, import_records15.readTypedTime)(trimmed);
|
|
6433
6448
|
return read2.ok ? { value: read2.value } : { refusal: SHORT_REFUSAL.time, why: `${fieldName(field2)} holds a time of day, and ${read2.why}` };
|
|
6434
6449
|
}
|
|
6435
6450
|
if (kind === "select" || kind === "multi_select") {
|
|
6436
6451
|
if (!choices || nudge === null) return null;
|
|
6437
6452
|
const several = field2.multi || kind === "multi_select";
|
|
6438
6453
|
const words2 = several ? trimmed.split(/\s*[,;\n]\s*/).filter(Boolean) : [trimmed];
|
|
6439
|
-
const allowOther = (0,
|
|
6454
|
+
const allowOther = (0, import_records15.allowsOtherValues)(field2);
|
|
6440
6455
|
const parts = [];
|
|
6441
6456
|
const add = [];
|
|
6442
6457
|
const ask = [];
|
|
6443
6458
|
const notChoices = [];
|
|
6444
6459
|
let keepOffered = allowOther;
|
|
6445
6460
|
for (const word of words2) {
|
|
6446
|
-
const decided = (0,
|
|
6461
|
+
const decided = (0, import_records15.decideTypedChoice)({ words: word, options: choices, allowOther, nudge });
|
|
6447
6462
|
if (decided.decision === "empty") continue;
|
|
6448
6463
|
if (decided.decision === "chosen") parts.push(decided.key);
|
|
6449
6464
|
else {
|
|
@@ -6476,7 +6491,7 @@ function judgeTyped(field2, text2, choices, nudge) {
|
|
|
6476
6491
|
return usual && digits.length >= 7 && digits.length <= 20 ? { value: trimmed } : { refusal: SHORT_REFUSAL.phone };
|
|
6477
6492
|
}
|
|
6478
6493
|
const showsAsPercent = Boolean(format && (format.id === "percent" || format.id === "progress"));
|
|
6479
|
-
const read = (0,
|
|
6494
|
+
const read = (0, import_records15.coerceTypedAnswer)(field2, text2, { label: fieldName(field2), showsAsPercent });
|
|
6480
6495
|
if ("refusal" in read) {
|
|
6481
6496
|
if (kind === "email" || kind === "url") return { refusal: SHORT_REFUSAL[kind] };
|
|
6482
6497
|
const short = kind === "datetime" ? SHORT_REFUSAL.date : kind === "number" || kind === "currency" || kind === "percent" || showsAsPercent ? SHORT_REFUSAL.number : read.refusal.length <= 32 ? read.refusal : SHORT_REFUSAL.value;
|
|
@@ -6497,12 +6512,12 @@ function openingText(field2, value) {
|
|
|
6497
6512
|
if (value === null || value === void 0 || value === "") return "";
|
|
6498
6513
|
const helper = dateHelperKind(field2, value);
|
|
6499
6514
|
if (helper === "time") {
|
|
6500
|
-
const read = (0,
|
|
6515
|
+
const read = (0, import_records15.readTypedTime)(String(value));
|
|
6501
6516
|
if (!read.ok) return String(value);
|
|
6502
6517
|
const [h, m] = read.value.split(":").map(Number);
|
|
6503
|
-
return (0,
|
|
6518
|
+
return (0, import_records15.typedTimeText)(h, m);
|
|
6504
6519
|
}
|
|
6505
|
-
if (helper) return (0,
|
|
6520
|
+
if (helper) return (0, import_records15.typedDateText)(value, { withTime: helper === "datetime" });
|
|
6506
6521
|
const format = formatForField(field2);
|
|
6507
6522
|
return format ? typedText(format, value) : String(value);
|
|
6508
6523
|
}
|
|
@@ -6606,7 +6621,7 @@ function TypedTextControl({ field: field2, value, onChange, disabled, id, onComm
|
|
|
6606
6621
|
" ",
|
|
6607
6622
|
needsChoices ? String(
|
|
6608
6623
|
(Array.isArray(withoutAddition(judged.value).value) ? withoutAddition(judged.value).value : [withoutAddition(judged.value).value]).map((k) => {
|
|
6609
|
-
const option = choices?.find((o) => (0,
|
|
6624
|
+
const option = choices?.find((o) => (0, import_records15.optionKey)(o) === k);
|
|
6610
6625
|
return option ? recordName(option.data, null, String(k)) : String(k);
|
|
6611
6626
|
}).join(", ")
|
|
6612
6627
|
) : (() => {
|
|
@@ -6782,7 +6797,7 @@ function TypedWordsControl({ field: field2, value, onChange, disabled, id }) {
|
|
|
6782
6797
|
function typedDatePlaceholder(helper) {
|
|
6783
6798
|
const time = "h:mm AM";
|
|
6784
6799
|
if (helper === "time") return time;
|
|
6785
|
-
const pattern = (0,
|
|
6800
|
+
const pattern = (0, import_records15.typedDateText)("2026-11-22").replace("2026", "YYYY").replace("11", "MM").replace("22", "DD");
|
|
6786
6801
|
return helper === "datetime" ? `${pattern} ${time}` : pattern;
|
|
6787
6802
|
}
|
|
6788
6803
|
function CheckboxControl({ field: field2, value, onChange, disabled, id }) {
|
|
@@ -6921,15 +6936,15 @@ function OptionControl({ field: field2, value, onChange, disabled, id, autoOpen,
|
|
|
6921
6936
|
ChoiceAnswer,
|
|
6922
6937
|
{
|
|
6923
6938
|
field: field2,
|
|
6924
|
-
choices: options.map((option) => ({ key: (0,
|
|
6939
|
+
choices: options.map((option) => ({ key: (0, import_records15.optionKey)(option), label: titled(option) })),
|
|
6925
6940
|
value,
|
|
6926
6941
|
onChange,
|
|
6927
6942
|
disabled,
|
|
6928
6943
|
id,
|
|
6929
6944
|
onChosen,
|
|
6930
6945
|
isChosen: (choice, v) => {
|
|
6931
|
-
const option = options.find((o) => (0,
|
|
6932
|
-
return option ? (0,
|
|
6946
|
+
const option = options.find((o) => (0, import_records15.optionKey)(o) === choice.key);
|
|
6947
|
+
return option ? (0, import_records15.isTheChosen)(option, v) : false;
|
|
6933
6948
|
}
|
|
6934
6949
|
}
|
|
6935
6950
|
);
|
|
@@ -6949,7 +6964,7 @@ function OptionControl({ field: field2, value, onChange, disabled, id, autoOpen,
|
|
|
6949
6964
|
onCancel,
|
|
6950
6965
|
initialSearch,
|
|
6951
6966
|
addsChoices,
|
|
6952
|
-
allowOther: (0,
|
|
6967
|
+
allowOther: (0, import_records15.allowsOtherValues)(field2),
|
|
6953
6968
|
onChoicesChanged: () => {
|
|
6954
6969
|
if (client) forgetAsked(client, `field_options:${field2.id}`);
|
|
6955
6970
|
setReread((n) => n + 1);
|
|
@@ -6962,19 +6977,19 @@ function OptionControl({ field: field2, value, onChange, disabled, id, autoOpen,
|
|
|
6962
6977
|
}
|
|
6963
6978
|
const titleOf = (option) => recordName(option.data, null, "Unnamed choice");
|
|
6964
6979
|
if (field2.multi) {
|
|
6965
|
-
const chosen = options.filter((option) => (0,
|
|
6966
|
-
const picked = new Set(chosen.map((option) => (0,
|
|
6980
|
+
const chosen = options.filter((option) => (0, import_records15.choiceValuesOf)(value).some((v) => (0, import_records15.isTheChosen)(option, v)));
|
|
6981
|
+
const picked = new Set(chosen.map((option) => (0, import_records15.optionKey)(option)));
|
|
6967
6982
|
const toggles = /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("div", { id: autoOpen ? void 0 : id, className: "flex flex-wrap gap-1", children: options.map((option) => /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
6968
6983
|
import_design_system19.Button,
|
|
6969
6984
|
{
|
|
6970
6985
|
type: "button",
|
|
6971
6986
|
size: "sm",
|
|
6972
|
-
variant: picked.has((0,
|
|
6987
|
+
variant: picked.has((0, import_records15.optionKey)(option)) ? "default" : "outline",
|
|
6973
6988
|
disabled,
|
|
6974
6989
|
onClick: () => {
|
|
6975
6990
|
const next = new Set(picked);
|
|
6976
|
-
if (next.has((0,
|
|
6977
|
-
else next.add((0,
|
|
6991
|
+
if (next.has((0, import_records15.optionKey)(option))) next.delete((0, import_records15.optionKey)(option));
|
|
6992
|
+
else next.add((0, import_records15.optionKey)(option));
|
|
6978
6993
|
onChange(next.size === 0 ? null : [...next]);
|
|
6979
6994
|
},
|
|
6980
6995
|
children: titleOf(option)
|
|
@@ -6996,11 +7011,11 @@ function OptionControl({ field: field2, value, onChange, disabled, id, autoOpen,
|
|
|
6996
7011
|
}
|
|
6997
7012
|
);
|
|
6998
7013
|
}
|
|
6999
|
-
const current = options.find((option) => (0,
|
|
7014
|
+
const current = options.find((option) => (0, import_records15.isTheChosen)(option, value));
|
|
7000
7015
|
return /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(
|
|
7001
7016
|
import_design_system19.Select,
|
|
7002
7017
|
{
|
|
7003
|
-
value: current ? (0,
|
|
7018
|
+
value: current ? (0, import_records15.optionKey)(current) : "",
|
|
7004
7019
|
disabled: disabled ?? false,
|
|
7005
7020
|
onValueChange: (next) => onChange(next === "" ? null : next),
|
|
7006
7021
|
...autoOpen ? {
|
|
@@ -7012,7 +7027,7 @@ function OptionControl({ field: field2, value, onChange, disabled, id, autoOpen,
|
|
|
7012
7027
|
} : {},
|
|
7013
7028
|
children: [
|
|
7014
7029
|
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_design_system19.SelectTrigger, { id, size: "sm", children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_design_system19.SelectValue, { placeholder: "Choose" }) }),
|
|
7015
|
-
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_design_system19.SelectContent, { children: options.map((option) => /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_design_system19.SelectItem, { value: (0,
|
|
7030
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_design_system19.SelectContent, { children: options.map((option) => /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_design_system19.SelectItem, { value: (0, import_records15.optionKey)(option), children: titleOf(option) }, option.id)) })
|
|
7016
7031
|
]
|
|
7017
7032
|
}
|
|
7018
7033
|
);
|
|
@@ -7046,23 +7061,23 @@ function OpenChoicePicker({
|
|
|
7046
7061
|
const [addRefused, setAddRefused] = (0, import_react36.useState)(null);
|
|
7047
7062
|
const titleOf = (option) => recordName(option.data, null, "Unnamed choice");
|
|
7048
7063
|
const held = withoutAddition(value);
|
|
7049
|
-
const current = (0,
|
|
7064
|
+
const current = (0, import_records15.choiceValuesOf)(held.value);
|
|
7050
7065
|
const pickedWords = current.map((v) => {
|
|
7051
|
-
const option = options.find((o) => (0,
|
|
7066
|
+
const option = options.find((o) => (0, import_records15.isTheChosen)(o, v));
|
|
7052
7067
|
return option ? titleOf(option) : String(v);
|
|
7053
7068
|
});
|
|
7054
|
-
const chipOf = (option, word) => option ? choiceChipLookOf(field2, (0,
|
|
7069
|
+
const chipOf = (option, word) => option ? choiceChipLookOf(field2, (0, import_records15.optionKey)(option), titleOf(option)) : choiceChipLookOf(field2, word);
|
|
7055
7070
|
const q = search.trim();
|
|
7056
|
-
const visible = (0,
|
|
7057
|
-
const decided = (0,
|
|
7071
|
+
const visible = (0, import_records15.rankTypedMatches)(options, q, titleOf);
|
|
7072
|
+
const decided = (0, import_records15.decideTypedChoice)({ words: q, options, allowOther, nudge: nudge ?? "ask" });
|
|
7058
7073
|
const choose = (word, addingIt = false) => {
|
|
7059
7074
|
const pending = held.add.filter((w) => w.toLowerCase() !== word.toLowerCase());
|
|
7060
7075
|
let next;
|
|
7061
7076
|
let add2 = [...pending];
|
|
7062
7077
|
if (field2.multi) {
|
|
7063
7078
|
const existing = current.map((v) => {
|
|
7064
|
-
const option = options.find((o) => (0,
|
|
7065
|
-
return option ? (0,
|
|
7079
|
+
const option = options.find((o) => (0, import_records15.isTheChosen)(o, v));
|
|
7080
|
+
return option ? (0, import_records15.optionKey)(option) : String(v);
|
|
7066
7081
|
});
|
|
7067
7082
|
const has = existing.some((v) => v.toLowerCase() === word.toLowerCase());
|
|
7068
7083
|
const list = has ? existing.filter((v) => v.toLowerCase() !== word.toLowerCase()) : [...existing, word];
|
|
@@ -7098,7 +7113,7 @@ function OpenChoicePicker({
|
|
|
7098
7113
|
const foot = null;
|
|
7099
7114
|
const add = offList && (decided.decision === "ask" || decided.decision === "add") ? { label: `Create \u201C${q}\u201D`, onAdd: addTyped, disabled: adding } : offList && decided.decision === "keep_as_typed" ? { label: `Use \u201C${q}\u201D`, onAdd: () => choose(q) } : null;
|
|
7100
7115
|
const listed = visible;
|
|
7101
|
-
const pickedOptions = current.map((v) => options.find((o) => (0,
|
|
7116
|
+
const pickedOptions = current.map((v) => options.find((o) => (0, import_records15.isTheChosen)(o, v)));
|
|
7102
7117
|
const cellChips = pickedWords.map((word, i) => {
|
|
7103
7118
|
const chip = chipOf(pickedOptions[i], word);
|
|
7104
7119
|
return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_design_system19.Badge, { variant: "outline", className: (0, import_design_system19.cn)("text-[11px]", chip.className), "data-records-choice-chip": "", children: word }, word);
|
|
@@ -7110,7 +7125,7 @@ function OpenChoicePicker({
|
|
|
7110
7125
|
label: word,
|
|
7111
7126
|
chip: chipOf(option, word).className,
|
|
7112
7127
|
onRemove: () => {
|
|
7113
|
-
if (field2.multi) choose(option ? (0,
|
|
7128
|
+
if (field2.multi) choose(option ? (0, import_records15.optionKey)(option) : String(current[i]));
|
|
7114
7129
|
else onChange(null);
|
|
7115
7130
|
}
|
|
7116
7131
|
};
|
|
@@ -7141,11 +7156,11 @@ function OpenChoicePicker({
|
|
|
7141
7156
|
id: option.id,
|
|
7142
7157
|
label: titleOf(option),
|
|
7143
7158
|
chip: chipOf(option, titleOf(option)).className,
|
|
7144
|
-
picked: current.some((v) => (0,
|
|
7159
|
+
picked: current.some((v) => (0, import_records15.isTheChosen)(option, v))
|
|
7145
7160
|
})),
|
|
7146
7161
|
onPick: (optionId) => {
|
|
7147
7162
|
const option = options.find((o) => o.id === optionId);
|
|
7148
|
-
if (option) choose((0,
|
|
7163
|
+
if (option) choose((0, import_records15.optionKey)(option));
|
|
7149
7164
|
},
|
|
7150
7165
|
empty: q === "" ? /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("p", { className: "p-2 text-xs text-muted-foreground", children: "No choices yet \u2014 type one to add it." }) : null,
|
|
7151
7166
|
add,
|
|
@@ -7201,7 +7216,7 @@ function ChoiceAnswer({
|
|
|
7201
7216
|
onChosen
|
|
7202
7217
|
}) {
|
|
7203
7218
|
const [search, setSearch] = (0, import_react36.useState)("");
|
|
7204
|
-
const held = field2.multi ? (0,
|
|
7219
|
+
const held = field2.multi ? (0, import_records15.choiceValuesOf)(value) : value === null || value === void 0 || value === "" ? [] : [value];
|
|
7205
7220
|
const on = (choice) => held.some((v) => isChosen ? isChosen(choice, v) : String(v) === choice.key || String(v) === choice.label);
|
|
7206
7221
|
const press = (choice) => {
|
|
7207
7222
|
if (!field2.multi) {
|
|
@@ -8224,7 +8239,7 @@ function WholeValueEditor({
|
|
|
8224
8239
|
var import_field_formats6 = require("@ai-matrx/design-system/field-formats");
|
|
8225
8240
|
|
|
8226
8241
|
// src/ReferenceChips.tsx
|
|
8227
|
-
var
|
|
8242
|
+
var import_records16 = require("@ai-matrx/records");
|
|
8228
8243
|
var import_design_system21 = require("@ai-matrx/design-system");
|
|
8229
8244
|
|
|
8230
8245
|
// src/kindValues.ts
|
|
@@ -8296,7 +8311,7 @@ function iconOf(pair) {
|
|
|
8296
8311
|
}
|
|
8297
8312
|
function referencesOf(field2, value, kind, labels) {
|
|
8298
8313
|
if (kind === "entity_reference") {
|
|
8299
|
-
return (0,
|
|
8314
|
+
return (0, import_records16.entityRefsOf)(value).map((r) => ({ token: r.token, id: r.id, label: r.label }));
|
|
8300
8315
|
}
|
|
8301
8316
|
const ids = (Array.isArray(value) ? value : [value]).filter(isId).map(String);
|
|
8302
8317
|
const tableId = typeof field2.relation_target === "string" ? field2.relation_target : void 0;
|
|
@@ -8475,7 +8490,7 @@ function ClampedChips({
|
|
|
8475
8490
|
}
|
|
8476
8491
|
|
|
8477
8492
|
// src/formulaNames.ts
|
|
8478
|
-
var
|
|
8493
|
+
var import_records17 = require("@ai-matrx/records");
|
|
8479
8494
|
function fieldRefsOf(expr) {
|
|
8480
8495
|
const out = [];
|
|
8481
8496
|
const walk = (node) => {
|
|
@@ -8583,7 +8598,7 @@ function formulaSourceArchived(field2, document2) {
|
|
|
8583
8598
|
const keys = (field2.config ?? {})[FORMULA_INPUT_KEYS];
|
|
8584
8599
|
if (!Array.isArray(keys) || !document2) return null;
|
|
8585
8600
|
for (const key of keys) {
|
|
8586
|
-
const state = (0,
|
|
8601
|
+
const state = (0, import_records17.sourceArchivedOf)(document2[String(key)]);
|
|
8587
8602
|
if (state) return state;
|
|
8588
8603
|
}
|
|
8589
8604
|
return null;
|
|
@@ -8604,10 +8619,10 @@ function withFormulaDisplayNow(field2, fields, kindOf, currencyCodeOf) {
|
|
|
8604
8619
|
}
|
|
8605
8620
|
|
|
8606
8621
|
// src/values.tsx
|
|
8607
|
-
var
|
|
8622
|
+
var import_records19 = require("@ai-matrx/records");
|
|
8608
8623
|
|
|
8609
8624
|
// src/cellMarks.tsx
|
|
8610
|
-
var
|
|
8625
|
+
var import_records18 = require("@ai-matrx/records");
|
|
8611
8626
|
|
|
8612
8627
|
// src/RetiredValues.tsx
|
|
8613
8628
|
var import_react43 = require("react");
|
|
@@ -8713,7 +8728,7 @@ function bound(value) {
|
|
|
8713
8728
|
function keptAsideReason(field2, entry) {
|
|
8714
8729
|
const rules = field2.rules ?? [];
|
|
8715
8730
|
const numeric = typeof entry.value === "string" && /^-?\d+(\.\d+)?$/.test(entry.value.trim()) ? Number(entry.value) : entry.value;
|
|
8716
|
-
const rule = (0,
|
|
8731
|
+
const rule = (0, import_records18.ruleThatRefuses)(rules, numeric);
|
|
8717
8732
|
let why = null;
|
|
8718
8733
|
if (rule?.kind === "min") why = `Must be at least ${bound(rule.value)}`;
|
|
8719
8734
|
else if (rule?.kind === "max") why = `Must be at most ${bound(rule.value)}`;
|
|
@@ -8822,7 +8837,7 @@ function SourceArchivedValue({ state }) {
|
|
|
8822
8837
|
}
|
|
8823
8838
|
var ABSENCE_WORDS = ABSENCE_WORD_LABEL;
|
|
8824
8839
|
function renderValue(field2, value, document2, labels, stillWaitingFor, look) {
|
|
8825
|
-
const archivedSource = (0,
|
|
8840
|
+
const archivedSource = (0, import_records19.sourceArchivedOf)(value);
|
|
8826
8841
|
if (archivedSource) return /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(SourceArchivedValue, { state: archivedSource });
|
|
8827
8842
|
const envelope = envelopeFor(document2, field2.key);
|
|
8828
8843
|
if (envelope?.absent) {
|
|
@@ -8931,9 +8946,9 @@ function renderValue(field2, value, document2, labels, stillWaitingFor, look) {
|
|
|
8931
8946
|
}
|
|
8932
8947
|
function scalarText(field2, value, labels, stillWaitingFor) {
|
|
8933
8948
|
if (value === null || value === void 0) return "\u2014";
|
|
8934
|
-
if ((0,
|
|
8949
|
+
if ((0, import_records19.sourceArchivedOf)(value)) return SOURCE_ARCHIVED_WORDS;
|
|
8935
8950
|
if (isSignatureField(field2)) return signatureWords(value) ?? "\u2014";
|
|
8936
|
-
const newerWords = (0,
|
|
8951
|
+
const newerWords = (0, import_records19.newerKindWords)(field2, value);
|
|
8937
8952
|
if (newerWords !== null) return newerWords;
|
|
8938
8953
|
const kind = editorKindFor(field2);
|
|
8939
8954
|
if (kind === "entity_reference") return entityReferenceText(value);
|
|
@@ -8998,7 +9013,7 @@ function RecordValue({
|
|
|
8998
9013
|
const kept = keptAsideFor(document2, field2.key);
|
|
8999
9014
|
if (kept) return /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(KeptAsideValue, { field: field2, entry: kept, shown: scalarText(field2, kept.value) });
|
|
9000
9015
|
}
|
|
9001
|
-
const archivedSource = (0,
|
|
9016
|
+
const archivedSource = (0, import_records19.sourceArchivedOf)(value);
|
|
9002
9017
|
if (archivedSource) return /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(SourceArchivedValue, { state: archivedSource });
|
|
9003
9018
|
if (formulaHasNothingToWorkOn(field2, document2)) return embeddedLook?.blankEmpty ? null : /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("span", { className: "text-muted-foreground", children: "\u2014" });
|
|
9004
9019
|
if (value !== null && value !== void 0 && value !== "" && !envelopeFor(document2, field2.key)?.absent) {
|
|
@@ -10445,7 +10460,7 @@ function useWholeTableCount(args) {
|
|
|
10445
10460
|
// src/Grid.tsx
|
|
10446
10461
|
var import_react123 = require("react");
|
|
10447
10462
|
var import_react124 = require("@ai-matrx/records/react");
|
|
10448
|
-
var
|
|
10463
|
+
var import_records37 = require("@ai-matrx/records");
|
|
10449
10464
|
var import_data_table13 = require("@ai-matrx/design-system/data-table");
|
|
10450
10465
|
var import_core18 = require("@ai-matrx/records/core");
|
|
10451
10466
|
|
|
@@ -10512,7 +10527,7 @@ function useTableDecorations(tableId, revision) {
|
|
|
10512
10527
|
}
|
|
10513
10528
|
|
|
10514
10529
|
// src/emptyState.tsx
|
|
10515
|
-
var
|
|
10530
|
+
var import_records20 = require("@ai-matrx/records");
|
|
10516
10531
|
var import_design_system27 = require("@ai-matrx/design-system");
|
|
10517
10532
|
var import_format3 = require("@ai-matrx/kit/format");
|
|
10518
10533
|
var import_jsx_runtime33 = require("react/jsx-runtime");
|
|
@@ -10522,7 +10537,7 @@ function lockedRowsWords(count) {
|
|
|
10522
10537
|
function questionIsAsked(args) {
|
|
10523
10538
|
if ((args.search ?? "").trim() !== "") return true;
|
|
10524
10539
|
if (Object.values(args.columnFilters ?? {}).some((value) => value !== void 0 && value !== null)) return true;
|
|
10525
|
-
if (args.filter && (0,
|
|
10540
|
+
if (args.filter && (0, import_records20.stableFilterKey)(args.filter) !== "{}") return true;
|
|
10526
10541
|
return Boolean(args.ruled);
|
|
10527
10542
|
}
|
|
10528
10543
|
function emptyCauseOf(args) {
|
|
@@ -10924,7 +10939,7 @@ function SourceArchivedNotice({ fieldId, tableId }) {
|
|
|
10924
10939
|
// src/Condition.tsx
|
|
10925
10940
|
var import_react59 = require("react");
|
|
10926
10941
|
var import_design_system31 = require("@ai-matrx/design-system");
|
|
10927
|
-
var
|
|
10942
|
+
var import_records21 = require("@ai-matrx/records");
|
|
10928
10943
|
var import_react60 = require("@ai-matrx/records/react");
|
|
10929
10944
|
var import_jsx_runtime37 = require("react/jsx-runtime");
|
|
10930
10945
|
var CONDITION_OPS = [
|
|
@@ -10955,7 +10970,7 @@ function ChoiceValue({ field: field2, value, onChange }) {
|
|
|
10955
10970
|
void fieldOptionsOnce(client, field2.id).then((got) => {
|
|
10956
10971
|
if (cancelled) return;
|
|
10957
10972
|
setChoices(
|
|
10958
|
-
got.ok ? (got.data ?? []).map((o) => ({ key: (0,
|
|
10973
|
+
got.ok ? (got.data ?? []).map((o) => ({ key: (0, import_records21.optionKey)(o), label: (0, import_records21.optionLabel)(o) ?? "" })).filter((c) => c.label !== "") : []
|
|
10959
10974
|
);
|
|
10960
10975
|
});
|
|
10961
10976
|
return () => {
|
|
@@ -10973,7 +10988,7 @@ function ChoiceValue({ field: field2, value, onChange }) {
|
|
|
10973
10988
|
}
|
|
10974
10989
|
);
|
|
10975
10990
|
}
|
|
10976
|
-
const shown4 = (0,
|
|
10991
|
+
const shown4 = (0, import_records21.rankTypedMatches)(choices, search.trim(), (c) => c.label);
|
|
10977
10992
|
return /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("span", { className: "inline-flex min-w-0", "data-records-condition-choice": "", "data-pick-value": value, children: /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
|
|
10978
10993
|
PickOrAdd,
|
|
10979
10994
|
{
|
|
@@ -11344,7 +11359,7 @@ function ConditionGroup({
|
|
|
11344
11359
|
|
|
11345
11360
|
// src/FieldRulePreview.tsx
|
|
11346
11361
|
var import_react61 = require("react");
|
|
11347
|
-
var
|
|
11362
|
+
var import_records22 = require("@ai-matrx/records");
|
|
11348
11363
|
var import_react62 = require("@ai-matrx/records/react");
|
|
11349
11364
|
var import_jsx_runtime38 = require("react/jsx-runtime");
|
|
11350
11365
|
var PREVIEW_GROUPS2 = 1e3;
|
|
@@ -11383,7 +11398,7 @@ function FieldRulePreview({ field: field2, tableId, rules }) {
|
|
|
11383
11398
|
}
|
|
11384
11399
|
const numbers = holdsNumbers2(field2);
|
|
11385
11400
|
const groups = answer.data.map((row) => ({ value: groupValue(row.groups[field2.key] ?? null, numbers), count: row.row_count }));
|
|
11386
|
-
setPreview((0,
|
|
11401
|
+
setPreview((0, import_records22.previewRuleChange)(latest.current, groups, answer.data.length >= PREVIEW_GROUPS2));
|
|
11387
11402
|
});
|
|
11388
11403
|
}, 300);
|
|
11389
11404
|
return () => {
|
|
@@ -11492,7 +11507,7 @@ function choiceLookForNewList(multi, rows) {
|
|
|
11492
11507
|
|
|
11493
11508
|
// src/ChoiceListEditor.tsx
|
|
11494
11509
|
var import_react63 = require("react");
|
|
11495
|
-
var
|
|
11510
|
+
var import_records23 = require("@ai-matrx/records");
|
|
11496
11511
|
var import_react64 = require("@ai-matrx/records/react");
|
|
11497
11512
|
var import_design_system32 = require("@ai-matrx/design-system");
|
|
11498
11513
|
var import_data_table7 = require("@ai-matrx/design-system/data-table");
|
|
@@ -11501,7 +11516,7 @@ var rowSeed = 0;
|
|
|
11501
11516
|
var nextRow = () => `new-${rowSeed += 1}`;
|
|
11502
11517
|
function choiceRowsFrom(options, field2) {
|
|
11503
11518
|
return inTheStoresOrder([...options]).map((option) => {
|
|
11504
|
-
const words2 = (0,
|
|
11519
|
+
const words2 = (0, import_records23.optionLabel)(option);
|
|
11505
11520
|
const key = option.data?.key;
|
|
11506
11521
|
const color = field2 ? storedChoiceColor(field2, words2) ?? storedChoiceColor(field2, key) : void 0;
|
|
11507
11522
|
return { id: option.id, words: words2, row: option.id, color: color ?? null };
|
|
@@ -11671,11 +11686,11 @@ function ChoiceListEditor({
|
|
|
11671
11686
|
"div",
|
|
11672
11687
|
{
|
|
11673
11688
|
role: "group",
|
|
11674
|
-
"aria-label": (0,
|
|
11689
|
+
"aria-label": (0, import_records23.recordsUseSentence)(heldBy(asking), asking.words.trim()),
|
|
11675
11690
|
"data-records-choice-removal-ask": "",
|
|
11676
11691
|
className: "flex flex-col gap-1 rounded border bg-muted/40 p-2",
|
|
11677
11692
|
children: [
|
|
11678
|
-
/* @__PURE__ */ (0, import_jsx_runtime39.jsx)("p", { className: "text-xs", children: (0,
|
|
11693
|
+
/* @__PURE__ */ (0, import_jsx_runtime39.jsx)("p", { className: "text-xs", children: (0, import_records23.recordsUseSentence)(heldBy(asking), asking.words.trim()) }),
|
|
11679
11694
|
/* @__PURE__ */ (0, import_jsx_runtime39.jsxs)("div", { className: "flex flex-wrap items-center gap-1", children: [
|
|
11680
11695
|
targets.length > 0 ? /* @__PURE__ */ (0, import_jsx_runtime39.jsxs)(import_jsx_runtime39.Fragment, { children: [
|
|
11681
11696
|
/* @__PURE__ */ (0, import_jsx_runtime39.jsx)(import_design_system32.Button, { type: "button", size: "sm", className: "h-7 px-2 text-xs", disabled: moveTo === "", onClick: () => answer({ then: "move", to: moveTo }), children: "Move them to" }),
|
|
@@ -11694,7 +11709,7 @@ function ChoiceListEditor({
|
|
|
11694
11709
|
) : null,
|
|
11695
11710
|
Object.entries(rehome).map(
|
|
11696
11711
|
([id, spec]) => removed[id] ? /* @__PURE__ */ (0, import_jsx_runtime39.jsxs)("div", { className: "flex items-center justify-between gap-2 text-[11px] text-muted-foreground", "data-records-choice-rehome": "", children: [
|
|
11697
|
-
/* @__PURE__ */ (0, import_jsx_runtime39.jsx)("span", { children: (0,
|
|
11712
|
+
/* @__PURE__ */ (0, import_jsx_runtime39.jsx)("span", { children: (0, import_records23.rehomeSentence)(usage?.[id]?.records ?? 0, removed[id].row.words.trim(), spec, spec.then === "move" ? wordsOf(spec.to) : void 0) }),
|
|
11698
11713
|
/* @__PURE__ */ (0, import_jsx_runtime39.jsx)(import_design_system32.Button, { type: "button", size: "sm", variant: "ghost", className: "h-6 px-1.5 text-[11px]", onClick: () => putBack(id), children: "Put it back" })
|
|
11699
11714
|
] }, id) : null
|
|
11700
11715
|
),
|
|
@@ -11754,7 +11769,7 @@ function ChoiceSwatch({ words: words2, color, onColor }) {
|
|
|
11754
11769
|
}
|
|
11755
11770
|
|
|
11756
11771
|
// src/NewerKindQuestions.tsx
|
|
11757
|
-
var
|
|
11772
|
+
var import_records24 = require("@ai-matrx/records");
|
|
11758
11773
|
var import_design_system33 = require("@ai-matrx/design-system");
|
|
11759
11774
|
var import_jsx_runtime40 = require("react/jsx-runtime");
|
|
11760
11775
|
var STATUS_STARTING_CHOICES = [
|
|
@@ -11775,7 +11790,7 @@ function statusGroupRows(field2, rows, keyOfId, changed) {
|
|
|
11775
11790
|
if (words2 === "") continue;
|
|
11776
11791
|
const ref = r.id ?? words2;
|
|
11777
11792
|
const key = r.id ? keyOfId[r.id] : void 0;
|
|
11778
|
-
const held = field2 && key ? (0,
|
|
11793
|
+
const held = field2 && key ? (0, import_records24.statusGroupOf)(field2, key) : void 0;
|
|
11779
11794
|
out.push({ ref, words: words2, group: changed[ref] ?? held ?? guessStatusGroup(words2) });
|
|
11780
11795
|
}
|
|
11781
11796
|
return out;
|
|
@@ -11791,10 +11806,10 @@ function StatusGroupsQuestion({
|
|
|
11791
11806
|
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)("span", { className: "min-w-0 flex-1 truncate text-sm", children: r.words }),
|
|
11792
11807
|
/* @__PURE__ */ (0, import_jsx_runtime40.jsxs)(import_design_system33.Select, { value: r.group, onValueChange: (next) => onGroup(r.ref, next), children: [
|
|
11793
11808
|
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)(import_design_system33.SelectTrigger, { size: "sm", className: "w-36", "aria-label": `Group for ${r.words}`, children: /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(import_design_system33.SelectValue, {}) }),
|
|
11794
|
-
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)(import_design_system33.SelectContent, { children:
|
|
11809
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)(import_design_system33.SelectContent, { children: import_records24.STATUS_GROUPS.map((g) => /* @__PURE__ */ (0, import_jsx_runtime40.jsxs)(import_design_system33.SelectItem, { value: g, children: [
|
|
11795
11810
|
STATUS_GROUP_MARK[g],
|
|
11796
11811
|
" ",
|
|
11797
|
-
|
|
11812
|
+
import_records24.STATUS_GROUP_WORDS[g]
|
|
11798
11813
|
] }, g)) })
|
|
11799
11814
|
] })
|
|
11800
11815
|
] }, r.ref))
|
|
@@ -11832,7 +11847,7 @@ function BarcodeSymbologyQuestion({ value, onChange }) {
|
|
|
11832
11847
|
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)(import_design_system33.SelectTrigger, { size: "sm", "aria-label": "Code type", children: /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(import_design_system33.SelectValue, {}) }),
|
|
11833
11848
|
/* @__PURE__ */ (0, import_jsx_runtime40.jsxs)(import_design_system33.SelectContent, { children: [
|
|
11834
11849
|
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)(import_design_system33.SelectItem, { value: "any", children: "Any code" }),
|
|
11835
|
-
|
|
11850
|
+
import_records24.BARCODE_SYMBOLOGIES.map((s) => /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(import_design_system33.SelectItem, { value: s, children: SYMBOLOGY_WORDS[s] }, s))
|
|
11836
11851
|
] })
|
|
11837
11852
|
] })
|
|
11838
11853
|
] });
|
|
@@ -12131,11 +12146,11 @@ function FieldFormatPicker({
|
|
|
12131
12146
|
|
|
12132
12147
|
// src/FieldEditor.tsx
|
|
12133
12148
|
var import_text_case5 = require("@ai-matrx/kit/text-case");
|
|
12134
|
-
var
|
|
12149
|
+
var import_records25 = require("@ai-matrx/records");
|
|
12135
12150
|
var import_jsx_runtime42 = require("react/jsx-runtime");
|
|
12136
12151
|
var RULE_KINDS = FIELD_RULE_KIND_VALUES.map((kind) => ({ kind, label: FIELD_RULE_KIND_LABEL[kind] }));
|
|
12137
|
-
var SENSITIVITIES =
|
|
12138
|
-
var AGENT_VISIBILITY =
|
|
12152
|
+
var SENSITIVITIES = import_records25.FIELD_SENSITIVITIES.map((value) => ({ value, label: FIELD_SENSITIVITY_LABEL[value] }));
|
|
12153
|
+
var AGENT_VISIBILITY = import_records25.CONTEXT_POLICIES.map((value) => ({ value, label: CONTEXT_POLICY_LABEL[value] }));
|
|
12139
12154
|
var ROLLUP_OPERATIONS = ROLLUP_AGG_VALUES.map((value) => ({
|
|
12140
12155
|
value,
|
|
12141
12156
|
label: ROLLUP_AGG_LABEL[value]
|
|
@@ -12148,7 +12163,7 @@ var FORMULA_OPERATIONS = FORMULA_OP_VALUES.map((value) => ({
|
|
|
12148
12163
|
label: FORMULA_OP_LABEL[value],
|
|
12149
12164
|
joins: FORMULA_OP_JOINS[value]
|
|
12150
12165
|
}));
|
|
12151
|
-
var STORE_BEHAVIOUR = new Map(
|
|
12166
|
+
var STORE_BEHAVIOUR = new Map(import_records25.DECLARABLE_FIELD_KINDS.map((row) => [row.kind, row.behavior]));
|
|
12152
12167
|
function holdsAValueOnAStandardTable(kind) {
|
|
12153
12168
|
if (isSystemFieldKind(kind)) return false;
|
|
12154
12169
|
const behaviour = STORE_BEHAVIOUR.get(kind);
|
|
@@ -12253,12 +12268,12 @@ function FieldEditor(props) {
|
|
|
12253
12268
|
const [contextPolicy, setContextPolicy] = (0, import_react65.useState)(String(start?.context_policy ?? "include"));
|
|
12254
12269
|
const [rules, setRules] = (0, import_react65.useState)(start?.rules ?? []);
|
|
12255
12270
|
const [startsWith, setStartsWith] = (0, import_react65.useState)(start?.default ?? null);
|
|
12256
|
-
const [ratingMax, setRatingMax] = (0, import_react65.useState)(() => start ? (0,
|
|
12271
|
+
const [ratingMax, setRatingMax] = (0, import_react65.useState)(() => start ? (0, import_records25.ratingMaxOf)(start) : 5);
|
|
12257
12272
|
const savedRules = (0, import_react65.useMemo)(
|
|
12258
|
-
() => field2 ? type === "rating" ? (0,
|
|
12273
|
+
() => field2 ? type === "rating" ? (0, import_records25.rulesWithTopStar)(field2.rules ?? [], (0, import_records25.ratingMaxOf)(field2)) : field2.rules ?? [] : [],
|
|
12259
12274
|
[field2, type]
|
|
12260
12275
|
);
|
|
12261
|
-
const editedRules = (0, import_react65.useMemo)(() => type === "rating" ? (0,
|
|
12276
|
+
const editedRules = (0, import_react65.useMemo)(() => type === "rating" ? (0, import_records25.rulesWithTopStar)(rules, ratingMax) : rules, [type, rules, ratingMax]);
|
|
12262
12277
|
const [statusGroups, setStatusGroups] = (0, import_react65.useState)({});
|
|
12263
12278
|
const [statusKeys, setStatusKeys] = (0, import_react65.useState)({});
|
|
12264
12279
|
const [symbology, setSymbology] = (0, import_react65.useState)(String(start?.config?.["symbology"] ?? ""));
|
|
@@ -12266,7 +12281,7 @@ function FieldEditor(props) {
|
|
|
12266
12281
|
if (!field2 || type !== "status") return;
|
|
12267
12282
|
let live = true;
|
|
12268
12283
|
void client.fieldOptions({ field_id: field2.id }).then((got) => {
|
|
12269
|
-
if (live && got.ok) setStatusKeys(Object.fromEntries((got.data ?? []).map((o) => [String(o.id), (0,
|
|
12284
|
+
if (live && got.ok) setStatusKeys(Object.fromEntries((got.data ?? []).map((o) => [String(o.id), (0, import_records25.optionKey)(o)])));
|
|
12270
12285
|
});
|
|
12271
12286
|
return () => {
|
|
12272
12287
|
live = false;
|
|
@@ -12420,7 +12435,7 @@ function FieldEditor(props) {
|
|
|
12420
12435
|
...statusGroupsChanged ? { status_groups: statusGroupsSent } : {},
|
|
12421
12436
|
// V11 #4/#10: a rating's top star goes as `max`, the word custom.field_update now takes the way
|
|
12422
12437
|
// custom.field_declare does; the store writes the max Rule and sets aside any score above it.
|
|
12423
|
-
...type === "rating" && ratingMax !== (0,
|
|
12438
|
+
...type === "rating" && ratingMax !== (0, import_records25.ratingMaxOf)(field2) ? { max: ratingMax } : {},
|
|
12424
12439
|
...type === "barcode" && symbology !== String(field2.config?.["symbology"] ?? "") ? { symbology: symbology === "" ? null : symbology } : {},
|
|
12425
12440
|
// THE CHOICES, ONE ROW EACH, IN ORDER (CHOICE-COLUMN-EDIT): `{id, words}` re-words a
|
|
12426
12441
|
// choice in place, plain words add one, a choice left out is retired. Sent only when the
|
|
@@ -13422,7 +13437,7 @@ function MergeRecordDialog({ tableId, record, open, onOpenChange, onMerged }) {
|
|
|
13422
13437
|
|
|
13423
13438
|
// src/gridColors.tsx
|
|
13424
13439
|
var import_react69 = require("react");
|
|
13425
|
-
var
|
|
13440
|
+
var import_records26 = require("@ai-matrx/records");
|
|
13426
13441
|
var import_react70 = require("@ai-matrx/records/react");
|
|
13427
13442
|
var import_design_system37 = require("@ai-matrx/design-system");
|
|
13428
13443
|
var import_data_table8 = require("@ai-matrx/design-system/data-table");
|
|
@@ -13483,7 +13498,7 @@ function useChoiceOptions(fields, keys) {
|
|
|
13483
13498
|
function lookOf(option) {
|
|
13484
13499
|
const raw = option.data?.["color"];
|
|
13485
13500
|
const color = typeof raw === "string" && import_data_table8.STYLE_COLORS.includes(raw) ? raw : void 0;
|
|
13486
|
-
return { id: String(option.id), key: (0,
|
|
13501
|
+
return { id: String(option.id), key: (0, import_records26.optionKey)(option), label: (0, import_records26.optionLabel)(option), ...color ? { color } : {} };
|
|
13487
13502
|
}
|
|
13488
13503
|
function paintByOption(style, _fields, index, lookup) {
|
|
13489
13504
|
if (index.size === 0) return { style, documentOf: (doc) => doc, choiceColorFor: lookup };
|
|
@@ -14141,7 +14156,7 @@ function ActionRowPreview({
|
|
|
14141
14156
|
// src/gridActions.tsx
|
|
14142
14157
|
var import_react75 = require("react");
|
|
14143
14158
|
var import_react76 = require("@ai-matrx/records/react");
|
|
14144
|
-
var
|
|
14159
|
+
var import_records27 = require("@ai-matrx/records");
|
|
14145
14160
|
var import_design_system40 = require("@ai-matrx/design-system");
|
|
14146
14161
|
var import_jsx_runtime47 = require("react/jsx-runtime");
|
|
14147
14162
|
var EMPTY_ACTIONS = [];
|
|
@@ -14222,7 +14237,7 @@ function useActionRunner(args) {
|
|
|
14222
14237
|
const answered = await client.actionRun({ action_id: action3.id, record_ids: ids });
|
|
14223
14238
|
setBusy(null);
|
|
14224
14239
|
if (!answered.ok) {
|
|
14225
|
-
const refusals = (0,
|
|
14240
|
+
const refusals = (0, import_records27.actionRefusals)(answered.error);
|
|
14226
14241
|
setOutcome({
|
|
14227
14242
|
kind: "refused",
|
|
14228
14243
|
action: action3,
|
|
@@ -15000,7 +15015,7 @@ function RowActionsDialog({
|
|
|
15000
15015
|
// src/gridSummaries.tsx
|
|
15001
15016
|
var import_react79 = require("react");
|
|
15002
15017
|
var import_react80 = require("@ai-matrx/records/react");
|
|
15003
|
-
var
|
|
15018
|
+
var import_records28 = require("@ai-matrx/records");
|
|
15004
15019
|
var import_design_system43 = require("@ai-matrx/design-system");
|
|
15005
15020
|
var import_jsx_runtime50 = require("react/jsx-runtime");
|
|
15006
15021
|
var SUMMARY_ROW_ID = "__records_ui_summary__";
|
|
@@ -15047,8 +15062,8 @@ function useColumnSummaries(args) {
|
|
|
15047
15062
|
const why = {};
|
|
15048
15063
|
for (const [key, op2] of entries) {
|
|
15049
15064
|
const measure = op2 === "count" ? { op: "count" } : { op: op2, key };
|
|
15050
|
-
out[key] = row?.measures?.[(0,
|
|
15051
|
-
const notice = row?.withheld?.[(0,
|
|
15065
|
+
out[key] = row?.measures?.[(0, import_records28.measureKey)(measure)] ?? null;
|
|
15066
|
+
const notice = row?.withheld?.[(0, import_records28.measureKey)(measure)];
|
|
15052
15067
|
if (notice) why[key] = notice;
|
|
15053
15068
|
}
|
|
15054
15069
|
setValues(out);
|
|
@@ -15608,7 +15623,7 @@ function WholeTextDialog({
|
|
|
15608
15623
|
|
|
15609
15624
|
// src/pasteValues.ts
|
|
15610
15625
|
var import_core10 = require("@ai-matrx/records/core");
|
|
15611
|
-
var
|
|
15626
|
+
var import_records29 = require("@ai-matrx/records");
|
|
15612
15627
|
function wordForStoredChoice(options, value) {
|
|
15613
15628
|
if (options === void 0 || typeof value !== "string" || value === "") return null;
|
|
15614
15629
|
for (const label of options.labels) {
|
|
@@ -15621,7 +15636,7 @@ function choiceOptionsOf(options) {
|
|
|
15621
15636
|
const labels = [];
|
|
15622
15637
|
for (const option of options) {
|
|
15623
15638
|
const id = option.id;
|
|
15624
|
-
const key = (0,
|
|
15639
|
+
const key = (0, import_records29.optionKey)(option);
|
|
15625
15640
|
const label = recordName(option.data, null, "");
|
|
15626
15641
|
if (label) {
|
|
15627
15642
|
labels.push(label);
|
|
@@ -15633,7 +15648,7 @@ function choiceOptionsOf(options) {
|
|
|
15633
15648
|
return { byWord, labels };
|
|
15634
15649
|
}
|
|
15635
15650
|
function valueFromPastedText(field2, raw, options, relationNames) {
|
|
15636
|
-
return (0,
|
|
15651
|
+
return (0, import_records29.coerceTypedAnswer)(field2, raw, {
|
|
15637
15652
|
label: fieldName(field2),
|
|
15638
15653
|
...options ? { options } : {},
|
|
15639
15654
|
...relationNames ? { relationNames } : {}
|
|
@@ -17667,7 +17682,7 @@ function NewRecordControl({
|
|
|
17667
17682
|
// src/gridDrill.tsx
|
|
17668
17683
|
var import_react98 = require("react");
|
|
17669
17684
|
var import_react99 = require("@ai-matrx/records/react");
|
|
17670
|
-
var
|
|
17685
|
+
var import_records30 = require("@ai-matrx/records");
|
|
17671
17686
|
var import_data_table11 = require("@ai-matrx/design-system/data-table");
|
|
17672
17687
|
|
|
17673
17688
|
// src/drillLevel.ts
|
|
@@ -17934,7 +17949,7 @@ function useDrillAnswers(args) {
|
|
|
17934
17949
|
across: question.across ?? null,
|
|
17935
17950
|
show: question.show,
|
|
17936
17951
|
where: args.where,
|
|
17937
|
-
rule: args.rule && (0,
|
|
17952
|
+
rule: args.rule && (0, import_records30.isRuleFilter)(args.rule) ? args.rule : null,
|
|
17938
17953
|
window: question.window ?? null,
|
|
17939
17954
|
compare: question.compare ?? null,
|
|
17940
17955
|
windowKey: args.windowKey ?? null,
|
|
@@ -18199,7 +18214,7 @@ function trailClause(fields, w) {
|
|
|
18199
18214
|
}
|
|
18200
18215
|
function filterWithTrail(fields, base, trail) {
|
|
18201
18216
|
if (trail.length === 0) return base;
|
|
18202
|
-
if (!base || !(0,
|
|
18217
|
+
if (!base || !(0, import_records30.isRuleFilter)(base)) {
|
|
18203
18218
|
const flat = { ...base ?? {} };
|
|
18204
18219
|
for (const w of trail) {
|
|
18205
18220
|
const clause = trailClause(fields, w);
|
|
@@ -18222,7 +18237,7 @@ function filterWithTrail(fields, base, trail) {
|
|
|
18222
18237
|
return { op: "and", args };
|
|
18223
18238
|
}
|
|
18224
18239
|
function filterWithWindow(fields, base, key, range) {
|
|
18225
|
-
if (!base || !(0,
|
|
18240
|
+
if (!base || !(0, import_records30.isRuleFilter)(base)) return { ...base ?? {}, [key]: { from: range.from, to: range.to } };
|
|
18226
18241
|
const field2 = fields.find((f) => f.key === key);
|
|
18227
18242
|
if (!field2) return base;
|
|
18228
18243
|
const ref = { field: field2.id };
|
|
@@ -18265,8 +18280,8 @@ function useGridDrillConfig(args) {
|
|
|
18265
18280
|
},
|
|
18266
18281
|
[setQuestion, onPresentationChange, presentation]
|
|
18267
18282
|
);
|
|
18268
|
-
const flat = state.filter && !(0,
|
|
18269
|
-
const rule = state.filter && (0,
|
|
18283
|
+
const flat = state.filter && !(0, import_records30.isRuleFilter)(state.filter) ? state.filter : void 0;
|
|
18284
|
+
const rule = state.filter && (0, import_records30.isRuleFilter)(state.filter) ? filterWithTrailRuleOnly(state) : void 0;
|
|
18270
18285
|
const { config } = useDrill({
|
|
18271
18286
|
source: state.source,
|
|
18272
18287
|
question: state.question,
|
|
@@ -18974,9 +18989,15 @@ var TYPE_ICON = {
|
|
|
18974
18989
|
rollup: FORMULA,
|
|
18975
18990
|
json: [["path", { d: "M8 3H7a2 2 0 0 0-2 2v5a2 2 0 0 1-2 2 2 2 0 0 1 2 2v5c0 1.1.9 2 2 2h1" }], ["path", { d: "M16 21h1a2 2 0 0 0 2-2v-5c0-1.1.9-2 2-2a2 2 0 0 1-2-2V5a2 2 0 0 0-2-2h-1" }]]
|
|
18976
18991
|
};
|
|
18992
|
+
var CLOCK = [["circle", { cx: 12, cy: 12, r: 10 }], ["path", { d: "M12 6v6l4 2" }]];
|
|
18993
|
+
var PERSON_PLUS = [["path", { d: "M2 21a8 8 0 0 1 13.292-6" }], ["circle", { cx: 10, cy: 8, r: 5 }], ["path", { d: "M19 16v6" }], ["path", { d: "M22 19h-6" }]];
|
|
18994
|
+
var PERSON_PEN = [["path", { d: "M11.5 15H7a4 4 0 0 0-4 4v2" }], ["path", { d: "M21.378 16.626a1 1 0 0 0-3.004-3.004l-4.01 4.012a2 2 0 0 0-.506.854l-.837 2.87a.5.5 0 0 0 .62.62l2.87-.837a2 2 0 0 0 .854-.506z" }], ["circle", { cx: 10, cy: 7, r: 4 }]];
|
|
18995
|
+
var STAMP_ICON = { created_time: CLOCK, modified_time: CLOCK, created_by: PERSON_PLUS, modified_by: PERSON_PEN };
|
|
18977
18996
|
function withTypeMark(field2, header) {
|
|
18978
|
-
const
|
|
18979
|
-
const
|
|
18997
|
+
const picked = pickableTypeOf(field2);
|
|
18998
|
+
const stamp = picked !== void 0 && picked in STAMP_ICON ? picked : void 0;
|
|
18999
|
+
const kind = stamp ?? editorKindFor(field2);
|
|
19000
|
+
const parts = (stamp ? STAMP_ICON[stamp] : TYPE_ICON[editorKindFor(field2)]) ?? TYPE_ICON.text;
|
|
18980
19001
|
return /* @__PURE__ */ (0, import_jsx_runtime60.jsxs)("span", { className: "inline-flex min-w-0 items-center gap-1.5", "data-records-type-mark": kind, children: [
|
|
18981
19002
|
/* @__PURE__ */ (0, import_jsx_runtime60.jsx)(
|
|
18982
19003
|
"svg",
|
|
@@ -19005,7 +19026,7 @@ function withTypeMark(field2, header) {
|
|
|
19005
19026
|
|
|
19006
19027
|
// src/ReverseColumns.tsx
|
|
19007
19028
|
var import_react102 = require("react");
|
|
19008
|
-
var
|
|
19029
|
+
var import_records31 = require("@ai-matrx/records");
|
|
19009
19030
|
var import_react103 = require("@ai-matrx/records/react");
|
|
19010
19031
|
var import_design_system54 = require("@ai-matrx/design-system");
|
|
19011
19032
|
var import_jsx_runtime61 = require("react/jsx-runtime");
|
|
@@ -19144,7 +19165,7 @@ function useReverseField(tableId, column) {
|
|
|
19144
19165
|
if (column.read_only || !client) return;
|
|
19145
19166
|
let live = true;
|
|
19146
19167
|
void client.fields({ table_id: tableId, withReverse: true }).then((read) => {
|
|
19147
|
-
if (live && read.ok) setField(read.data.find((f) => f.key === column.key && (0,
|
|
19168
|
+
if (live && read.ok) setField(read.data.find((f) => f.key === column.key && (0, import_records31.isReverseField)(f)) ?? null);
|
|
19148
19169
|
});
|
|
19149
19170
|
return () => {
|
|
19150
19171
|
live = false;
|
|
@@ -19669,7 +19690,7 @@ var import_react105 = require("react");
|
|
|
19669
19690
|
var import_react106 = require("@ai-matrx/records/react");
|
|
19670
19691
|
var import_core14 = require("@ai-matrx/records/core");
|
|
19671
19692
|
var import_design_system56 = require("@ai-matrx/design-system");
|
|
19672
|
-
var
|
|
19693
|
+
var import_records34 = require("@ai-matrx/records");
|
|
19673
19694
|
|
|
19674
19695
|
// src/importRuleCheck.ts
|
|
19675
19696
|
var import_core13 = require("@ai-matrx/records/core");
|
|
@@ -19720,7 +19741,7 @@ function checkImportRules(fields, rows, mapping, choiceOptions, relationNames) {
|
|
|
19720
19741
|
var import_text_case8 = require("@ai-matrx/kit/text-case");
|
|
19721
19742
|
|
|
19722
19743
|
// src/importKinds.ts
|
|
19723
|
-
var
|
|
19744
|
+
var import_records32 = require("@ai-matrx/records");
|
|
19724
19745
|
var IMPORT_KINDS = [
|
|
19725
19746
|
{ kind: "text", label: "Text" },
|
|
19726
19747
|
{ kind: "date", label: "Date" },
|
|
@@ -19748,7 +19769,7 @@ function datesOfColumn(rows, header, opts = {}) {
|
|
|
19748
19769
|
const raw = String(r[header] ?? "").trim();
|
|
19749
19770
|
if (raw === "") return;
|
|
19750
19771
|
filled += 1;
|
|
19751
|
-
const got = (0,
|
|
19772
|
+
const got = (0, import_records32.readTypedDate)(raw, { ...opts.withTime ? { withTime: true } : {}, ...opts.locale ? { locale: opts.locale } : {} });
|
|
19752
19773
|
if (got.ok) read.set(i, opts.withTime && got.instant ? got.instant : got.day);
|
|
19753
19774
|
else unreadable.push({ row: i, raw });
|
|
19754
19775
|
});
|
|
@@ -19773,12 +19794,12 @@ function exactDuplicateRows(rows, headers) {
|
|
|
19773
19794
|
}
|
|
19774
19795
|
|
|
19775
19796
|
// src/importCombine.ts
|
|
19776
|
-
var
|
|
19797
|
+
var import_records33 = require("@ai-matrx/records");
|
|
19777
19798
|
function titleRepeats(rows, header) {
|
|
19778
19799
|
const seen = /* @__PURE__ */ new Set();
|
|
19779
19800
|
let filled = 0;
|
|
19780
19801
|
for (const r of rows) {
|
|
19781
|
-
const key = (0,
|
|
19802
|
+
const key = (0, import_records33.relationNameKey)(String(r[header] ?? ""));
|
|
19782
19803
|
if (key === "") continue;
|
|
19783
19804
|
filled += 1;
|
|
19784
19805
|
seen.add(key);
|
|
@@ -19788,7 +19809,7 @@ function titleRepeats(rows, header) {
|
|
|
19788
19809
|
function sameRecordLikely(rows, header) {
|
|
19789
19810
|
const groups = /* @__PURE__ */ new Map();
|
|
19790
19811
|
for (const r of rows) {
|
|
19791
|
-
const key = (0,
|
|
19812
|
+
const key = (0, import_records33.relationNameKey)(String(r[header] ?? ""));
|
|
19792
19813
|
if (key === "") continue;
|
|
19793
19814
|
const held = groups.get(key);
|
|
19794
19815
|
if (held) held.push(r);
|
|
@@ -19821,7 +19842,7 @@ function combineRows(rows, header) {
|
|
|
19821
19842
|
const out = [];
|
|
19822
19843
|
const outLines = [];
|
|
19823
19844
|
rows.forEach((r, i) => {
|
|
19824
|
-
const key = (0,
|
|
19845
|
+
const key = (0, import_records33.relationNameKey)(String(r[header] ?? ""));
|
|
19825
19846
|
if (key === "") {
|
|
19826
19847
|
out.push({ ...r });
|
|
19827
19848
|
outLines.push([i + 1]);
|
|
@@ -20313,13 +20334,13 @@ function ImportWizard({ tableId, source, onDone, onWrote, className }) {
|
|
|
20313
20334
|
async (wanted) => {
|
|
20314
20335
|
const next = /* @__PURE__ */ new Map();
|
|
20315
20336
|
for (const { header, field: field2 } of wanted) {
|
|
20316
|
-
const names = effectiveRows.flatMap((r) => (0,
|
|
20337
|
+
const names = effectiveRows.flatMap((r) => (0, import_records34.relationNamesIn)(field2, String(r[header] ?? "")));
|
|
20317
20338
|
const got = await client.relationNamesMatch({ table_id: field2.relation_target, names });
|
|
20318
20339
|
if (!got.ok) {
|
|
20319
20340
|
setRelationProblem(got.error);
|
|
20320
20341
|
return null;
|
|
20321
20342
|
}
|
|
20322
|
-
next.set(field2.key, (0,
|
|
20343
|
+
next.set(field2.key, (0, import_records34.relationNameIndexOf)(got.data));
|
|
20323
20344
|
}
|
|
20324
20345
|
setRelationProblem(null);
|
|
20325
20346
|
setRelationIndex(next);
|
|
@@ -20343,12 +20364,12 @@ function ImportWizard({ tableId, source, onDone, onWrote, className }) {
|
|
|
20343
20364
|
let linked = 0;
|
|
20344
20365
|
let named = 0;
|
|
20345
20366
|
effectiveRows.forEach((row, i) => {
|
|
20346
|
-
const names = (0,
|
|
20367
|
+
const names = (0, import_records34.relationNamesIn)(field2, String(row[header] ?? ""));
|
|
20347
20368
|
if (String(row[header] ?? "").trim() === "") return;
|
|
20348
20369
|
named += 1;
|
|
20349
20370
|
let ok = true;
|
|
20350
20371
|
for (const name of names) {
|
|
20351
|
-
const hits = index.byName.get((0,
|
|
20372
|
+
const hits = index.byName.get((0, import_records34.relationNameKey)(name)) ?? [];
|
|
20352
20373
|
if (hits.length === 1) continue;
|
|
20353
20374
|
ok = false;
|
|
20354
20375
|
if (hits.length === 0) unmatched.set(name, [...unmatched.get(name) ?? [], i + 1]);
|
|
@@ -20406,11 +20427,11 @@ function ImportWizard({ tableId, source, onDone, onWrote, className }) {
|
|
|
20406
20427
|
const named = index.get(field2.key);
|
|
20407
20428
|
const text2 = String(row[header] ?? "").trim();
|
|
20408
20429
|
if (!named || text2 === "") continue;
|
|
20409
|
-
const parts = field2.multi ? (0,
|
|
20430
|
+
const parts = field2.multi ? (0, import_records34.splitListCell)(text2) : [text2];
|
|
20410
20431
|
const ids = [];
|
|
20411
20432
|
let skip = false;
|
|
20412
20433
|
for (const part of parts) {
|
|
20413
|
-
const hits = (0,
|
|
20434
|
+
const hits = (0, import_records34.relationNamesIn)(field2, part).length === 0 ? null : named.byName.get((0, import_records34.relationNameKey)(part)) ?? [];
|
|
20414
20435
|
if (hits === null) ids.push(part);
|
|
20415
20436
|
else if (hits.length === 1) ids.push(hits[0].id);
|
|
20416
20437
|
else if ((hits.length === 0 ? choiceFor(field2.key).unmatched : choiceFor(field2.key).ambiguous) !== "empty") skip = true;
|
|
@@ -20450,7 +20471,7 @@ function ImportWizard({ tableId, source, onDone, onWrote, className }) {
|
|
|
20450
20471
|
setPhase("linking");
|
|
20451
20472
|
for (const ask of toMerge) {
|
|
20452
20473
|
for (const [name] of ask.ambiguous) {
|
|
20453
|
-
const hits = ask.index.byName.get((0,
|
|
20474
|
+
const hits = ask.index.byName.get((0, import_records34.relationNameKey)(name)) ?? [];
|
|
20454
20475
|
const winner = hits[0];
|
|
20455
20476
|
if (!winner) continue;
|
|
20456
20477
|
for (const loser of hits.slice(1)) {
|
|
@@ -22116,7 +22137,7 @@ function useStoreValueFacets(enabled, inputs) {
|
|
|
22116
22137
|
// src/gridGrouping.tsx
|
|
22117
22138
|
var import_react111 = require("react");
|
|
22118
22139
|
var import_react112 = require("@ai-matrx/records/react");
|
|
22119
|
-
var
|
|
22140
|
+
var import_records35 = require("@ai-matrx/records");
|
|
22120
22141
|
var import_jsx_runtime68 = require("react/jsx-runtime");
|
|
22121
22142
|
function groupValueKey(value) {
|
|
22122
22143
|
if (value === null || value === void 0 || value === "") return "";
|
|
@@ -22153,8 +22174,8 @@ function useGroupFacts(args) {
|
|
|
22153
22174
|
const withheld = {};
|
|
22154
22175
|
for (const [fieldKey, op2] of entries) {
|
|
22155
22176
|
const m = op2 === "count" ? { op: "count" } : { op: op2, key: fieldKey };
|
|
22156
|
-
values[fieldKey] = row.measures?.[(0,
|
|
22157
|
-
const notice = row.withheld?.[(0,
|
|
22177
|
+
values[fieldKey] = row.measures?.[(0, import_records35.measureKey)(m)] ?? null;
|
|
22178
|
+
const notice = row.withheld?.[(0, import_records35.measureKey)(m)];
|
|
22158
22179
|
if (notice) withheld[fieldKey] = notice;
|
|
22159
22180
|
}
|
|
22160
22181
|
out.set(key, { count: typeof row.measures?.["count"] === "number" ? row.measures["count"] : row.row_count ?? null, measures: values, withheld });
|
|
@@ -23204,7 +23225,7 @@ function BulkActions({
|
|
|
23204
23225
|
// src/handOrder.tsx
|
|
23205
23226
|
var import_react120 = require("react");
|
|
23206
23227
|
var import_react121 = require("@ai-matrx/records/react");
|
|
23207
|
-
var
|
|
23228
|
+
var import_records36 = require("@ai-matrx/records");
|
|
23208
23229
|
var import_design_system60 = require("@ai-matrx/design-system");
|
|
23209
23230
|
var import_jsx_runtime72 = require("react/jsx-runtime");
|
|
23210
23231
|
function sortArrow(direction) {
|
|
@@ -23321,7 +23342,7 @@ function useHandOrderRows(args) {
|
|
|
23321
23342
|
const client = (0, import_react121.useRecordsClient)();
|
|
23322
23343
|
const { viewId, active, page, pageSize } = args;
|
|
23323
23344
|
const filter = args.filter && Object.keys(args.filter).length > 0 ? args.filter : null;
|
|
23324
|
-
const filterKey = filter ? (0,
|
|
23345
|
+
const filterKey = filter ? (0, import_records36.stableFilterKey)(filter) : "";
|
|
23325
23346
|
const filterNow = (0, import_react120.useRef)(filter);
|
|
23326
23347
|
filterNow.current = filter;
|
|
23327
23348
|
const [answer, setAnswer] = (0, import_react120.useState)(null);
|
|
@@ -24034,7 +24055,7 @@ function GridBody({
|
|
|
24034
24055
|
const names = wanted.get(field2.key) ?? [];
|
|
24035
24056
|
if (names.length === 0) return;
|
|
24036
24057
|
const got = await client.relationNamesMatch({ table_id: field2.relation_target, names });
|
|
24037
|
-
if (got.ok) relationNames.current.set(field2.key, (0,
|
|
24058
|
+
if (got.ok) relationNames.current.set(field2.key, (0, import_records37.relationNameIndexOf)(got.data));
|
|
24038
24059
|
})
|
|
24039
24060
|
);
|
|
24040
24061
|
},
|
|
@@ -24113,7 +24134,7 @@ function GridBody({
|
|
|
24113
24134
|
field2.key,
|
|
24114
24135
|
lines.flatMap((line) => {
|
|
24115
24136
|
const cell2 = line[at];
|
|
24116
|
-
return typeof cell2 === "string" ? (0,
|
|
24137
|
+
return typeof cell2 === "string" ? (0, import_records37.relationNamesIn)(field2, cell2) : [];
|
|
24117
24138
|
})
|
|
24118
24139
|
);
|
|
24119
24140
|
}
|
|
@@ -24400,7 +24421,7 @@ function GridBody({
|
|
|
24400
24421
|
tableName: table.data ? tableName(table.data) : "",
|
|
24401
24422
|
fields: fields.data ?? [],
|
|
24402
24423
|
document: row.document ?? {},
|
|
24403
|
-
level: (0,
|
|
24424
|
+
level: (0, import_records37.asPermissionLevel)(row.level)
|
|
24404
24425
|
}),
|
|
24405
24426
|
[host, tableId, table.data, fields.data]
|
|
24406
24427
|
);
|
|
@@ -26306,7 +26327,7 @@ var import_design_system74 = require("@ai-matrx/design-system");
|
|
|
26306
26327
|
var import_react143 = require("react");
|
|
26307
26328
|
var import_react144 = require("@ai-matrx/records/react");
|
|
26308
26329
|
var import_core20 = require("@ai-matrx/records/core");
|
|
26309
|
-
var
|
|
26330
|
+
var import_records42 = require("@ai-matrx/records");
|
|
26310
26331
|
var import_design_system73 = require("@ai-matrx/design-system");
|
|
26311
26332
|
|
|
26312
26333
|
// src/newTableColumns.ts
|
|
@@ -26490,7 +26511,7 @@ function fieldsForNewColumns(columns) {
|
|
|
26490
26511
|
var import_clipboard4 = require("@ai-matrx/kit/clipboard");
|
|
26491
26512
|
var import_react139 = require("react");
|
|
26492
26513
|
var import_react140 = require("@ai-matrx/records/react");
|
|
26493
|
-
var
|
|
26514
|
+
var import_records40 = require("@ai-matrx/records");
|
|
26494
26515
|
var import_design_system71 = require("@ai-matrx/design-system");
|
|
26495
26516
|
|
|
26496
26517
|
// src/BookingBuilder.tsx
|
|
@@ -26499,7 +26520,7 @@ var import_design_system66 = require("@ai-matrx/design-system");
|
|
|
26499
26520
|
var import_react135 = require("react");
|
|
26500
26521
|
var import_react136 = require("@ai-matrx/records/react");
|
|
26501
26522
|
var import_format7 = require("@ai-matrx/kit/format");
|
|
26502
|
-
var
|
|
26523
|
+
var import_records38 = require("@ai-matrx/records");
|
|
26503
26524
|
var import_design_system67 = require("@ai-matrx/design-system");
|
|
26504
26525
|
|
|
26505
26526
|
// src/publicQuestions.ts
|
|
@@ -26780,7 +26801,7 @@ function BookingBuilder({ tableId, bookingId, onSaved, onClose, startNew, classN
|
|
|
26780
26801
|
if (!rights.structure) {
|
|
26781
26802
|
return /* @__PURE__ */ (0, import_jsx_runtime79.jsx)("p", { className: (0, import_design_system67.cn)("text-xs text-muted-foreground", className), children: rights.why("structure") ?? "Making a booking page needs the admin level on this table, because it lets people with no account take time in your calendar." });
|
|
26782
26803
|
}
|
|
26783
|
-
const url = formId ? `${publicOrigin}${(0,
|
|
26804
|
+
const url = formId ? `${publicOrigin}${(0, import_records38.bookingPath)(formId)}` : null;
|
|
26784
26805
|
const shown4 = offer ?? null;
|
|
26785
26806
|
return (
|
|
26786
26807
|
// THE RAIL IS 384px WIDE AND THE VIEWPORT IS NOT (walk 1, 2026-09-21):
|
|
@@ -27040,7 +27061,7 @@ function BuildOrAsk({
|
|
|
27040
27061
|
|
|
27041
27062
|
// src/BuiltOnArchive.tsx
|
|
27042
27063
|
var import_react137 = require("react");
|
|
27043
|
-
var
|
|
27064
|
+
var import_records39 = require("@ai-matrx/records");
|
|
27044
27065
|
var import_react138 = require("@ai-matrx/records/react");
|
|
27045
27066
|
var import_design_system70 = require("@ai-matrx/design-system");
|
|
27046
27067
|
|
|
@@ -27481,9 +27502,9 @@ function ArchivedBuiltOn({ tableId, onRestored }) {
|
|
|
27481
27502
|
/* @__PURE__ */ (0, import_jsx_runtime83.jsxs)("div", { className: "flex min-w-0 flex-1 flex-col", children: [
|
|
27482
27503
|
/* @__PURE__ */ (0, import_jsx_runtime83.jsx)("span", { className: "truncate text-sm", children: thing.title }),
|
|
27483
27504
|
/* @__PURE__ */ (0, import_jsx_runtime83.jsxs)("span", { className: "truncate text-xs text-muted-foreground", children: [
|
|
27484
|
-
|
|
27505
|
+
import_records39.BUILT_KIND_WORD[thing.kind],
|
|
27485
27506
|
" \xB7 archived ",
|
|
27486
|
-
(0,
|
|
27507
|
+
(0, import_records39.archivedWhen)(thing.archivedAt)
|
|
27487
27508
|
] }),
|
|
27488
27509
|
refusal3 && refusal3.id === thing.id ? /* @__PURE__ */ (0, import_jsx_runtime83.jsx)(RefusalNotice, { error: refusal3.error, className: "mt-2" }) : null
|
|
27489
27510
|
] }),
|
|
@@ -27634,7 +27655,7 @@ function BookingSlots({ tableId, activeBookingId, className }) {
|
|
|
27634
27655
|
" Open the table the appointments should land in to make one."
|
|
27635
27656
|
] }) : null,
|
|
27636
27657
|
/* @__PURE__ */ (0, import_jsx_runtime84.jsx)("ul", { className: "flex flex-col gap-2", children: pages.map((page) => {
|
|
27637
|
-
const url = `${origin}${(0,
|
|
27658
|
+
const url = `${origin}${(0, import_records40.bookingPath)(page.form_id)}`;
|
|
27638
27659
|
const mayOpen = levels.data?.[page.table_id] === "admin";
|
|
27639
27660
|
const open = page.published_at !== null && page.closed_at === null;
|
|
27640
27661
|
return /* @__PURE__ */ (0, import_jsx_runtime84.jsxs)(
|
|
@@ -27754,7 +27775,7 @@ function nextInWords(page) {
|
|
|
27754
27775
|
|
|
27755
27776
|
// src/WhereItLives.tsx
|
|
27756
27777
|
var import_react141 = require("react");
|
|
27757
|
-
var
|
|
27778
|
+
var import_records41 = require("@ai-matrx/records");
|
|
27758
27779
|
var import_react142 = require("@ai-matrx/records/react");
|
|
27759
27780
|
var import_design_system72 = require("@ai-matrx/design-system");
|
|
27760
27781
|
var import_jsx_runtime85 = require("react/jsx-runtime");
|
|
@@ -27883,7 +27904,7 @@ function WhereItLives({ tableId, knownOrganizationName, onMoved, variant = "head
|
|
|
27883
27904
|
/* @__PURE__ */ (0, import_jsx_runtime85.jsx)(SharedNameAddress, { to: choosing, all: answer.home.destinations }),
|
|
27884
27905
|
"?"
|
|
27885
27906
|
] }),
|
|
27886
|
-
/* @__PURE__ */ (0, import_jsx_runtime85.jsx)("p", { className: "text-muted-foreground", children: (0,
|
|
27907
|
+
/* @__PURE__ */ (0, import_jsx_runtime85.jsx)("p", { className: "text-muted-foreground", children: (0, import_records41.moveConsequence)(answer.home, choosing) }),
|
|
27887
27908
|
said2?.tone === "refused" ? /* @__PURE__ */ (0, import_jsx_runtime85.jsx)(
|
|
27888
27909
|
import_design_system72.ErrorBox,
|
|
27889
27910
|
{
|
|
@@ -28040,7 +28061,7 @@ function TablesHome({ onOpenTable, organizationName, makingOnly = false, askedBy
|
|
|
28040
28061
|
alive = false;
|
|
28041
28062
|
};
|
|
28042
28063
|
}, [client]);
|
|
28043
|
-
const listed = facts.phase === "read" ? (0,
|
|
28064
|
+
const listed = facts.phase === "read" ? (0, import_records42.withTablePlacement)(
|
|
28044
28065
|
(0, import_core20.withTableFacts)(tables.data ?? [], facts.rows, me),
|
|
28045
28066
|
facts.rows
|
|
28046
28067
|
) : tables.data ?? [];
|
|
@@ -29158,7 +29179,7 @@ function TableRenameDialog({
|
|
|
29158
29179
|
|
|
29159
29180
|
// src/TableSettings.tsx
|
|
29160
29181
|
var import_react161 = require("react");
|
|
29161
|
-
var
|
|
29182
|
+
var import_records44 = require("@ai-matrx/records");
|
|
29162
29183
|
|
|
29163
29184
|
// src/ArchiveDeliberately.tsx
|
|
29164
29185
|
var import_react151 = require("react");
|
|
@@ -29449,7 +29470,7 @@ function TableAccessLevel({ tableId, fields }) {
|
|
|
29449
29470
|
|
|
29450
29471
|
// src/RowControls.tsx
|
|
29451
29472
|
var import_react157 = require("react");
|
|
29452
|
-
var
|
|
29473
|
+
var import_records43 = require("@ai-matrx/records");
|
|
29453
29474
|
var import_react158 = require("@ai-matrx/records/react");
|
|
29454
29475
|
var import_design_system80 = require("@ai-matrx/design-system");
|
|
29455
29476
|
var import_jsx_runtime93 = require("react/jsx-runtime");
|
|
@@ -29477,9 +29498,9 @@ function ShownToSelect({
|
|
|
29477
29498
|
onChange,
|
|
29478
29499
|
testId
|
|
29479
29500
|
}) {
|
|
29480
|
-
return /* @__PURE__ */ (0, import_jsx_runtime93.jsxs)(import_design_system80.Select, { value, onValueChange: (next) => (0,
|
|
29501
|
+
return /* @__PURE__ */ (0, import_jsx_runtime93.jsxs)(import_design_system80.Select, { value, onValueChange: (next) => (0, import_records43.isShownTo)(next) ? onChange(next) : void 0, children: [
|
|
29481
29502
|
/* @__PURE__ */ (0, import_jsx_runtime93.jsx)(import_design_system80.SelectTrigger, { size: "sm", "aria-label": label, className: "h-7 min-w-[8rem] text-xs", "data-testid": testId, children: /* @__PURE__ */ (0, import_jsx_runtime93.jsx)(import_design_system80.SelectValue, {}) }),
|
|
29482
|
-
/* @__PURE__ */ (0, import_jsx_runtime93.jsx)(import_design_system80.SelectContent, { children: allowed.map((word) => /* @__PURE__ */ (0, import_jsx_runtime93.jsx)(import_design_system80.SelectItem, { value: word, children:
|
|
29503
|
+
/* @__PURE__ */ (0, import_jsx_runtime93.jsx)(import_design_system80.SelectContent, { children: allowed.map((word) => /* @__PURE__ */ (0, import_jsx_runtime93.jsx)(import_design_system80.SelectItem, { value: word, children: import_records43.SHOWN_TO_LABEL[word] }, word)) })
|
|
29483
29504
|
] });
|
|
29484
29505
|
}
|
|
29485
29506
|
function NewRowsDefaults({ tableId }) {
|
|
@@ -29517,10 +29538,10 @@ function NewRowsDefaults({ tableId }) {
|
|
|
29517
29538
|
setError(null);
|
|
29518
29539
|
setApplied(appliedLine(answer.data));
|
|
29519
29540
|
};
|
|
29520
|
-
if (!(0,
|
|
29541
|
+
if (!(0, import_records43.levelHasShownTo)(table.data?.level)) return null;
|
|
29521
29542
|
if (!d) return error ? /* @__PURE__ */ (0, import_jsx_runtime93.jsx)(RefusalNotice, { error }) : null;
|
|
29522
29543
|
const shown4 = d.shown_to ?? d.effective.shown_to;
|
|
29523
|
-
const allowed = d.allowed_shown_to.filter(
|
|
29544
|
+
const allowed = d.allowed_shown_to.filter(import_records43.isShownTo);
|
|
29524
29545
|
return /* @__PURE__ */ (0, import_jsx_runtime93.jsxs)("section", { className: "flex flex-col gap-1.5", "data-testid": "new-rows-defaults", children: [
|
|
29525
29546
|
/* @__PURE__ */ (0, import_jsx_runtime93.jsx)("span", { className: "font-medium", children: ROW_CONTROL_WORDS.block }),
|
|
29526
29547
|
/* @__PURE__ */ (0, import_jsx_runtime93.jsxs)("div", { className: "flex items-center gap-2", children: [
|
|
@@ -29534,7 +29555,7 @@ function NewRowsDefaults({ tableId }) {
|
|
|
29534
29555
|
testId: "new-rows-shown-to",
|
|
29535
29556
|
onChange: (next) => void set({ shown_to: next })
|
|
29536
29557
|
}
|
|
29537
|
-
) : /* @__PURE__ */ (0, import_jsx_runtime93.jsx)("span", { "data-testid": "new-rows-shown-to-text", children:
|
|
29558
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime93.jsx)("span", { "data-testid": "new-rows-shown-to-text", children: import_records43.SHOWN_TO_LABEL[shown4] })
|
|
29538
29559
|
] }),
|
|
29539
29560
|
/* @__PURE__ */ (0, import_jsx_runtime93.jsxs)("div", { className: "flex items-center gap-2", "data-testid": "new-rows-published", children: [
|
|
29540
29561
|
/* @__PURE__ */ (0, import_jsx_runtime93.jsx)("span", { className: "min-w-fit flex-1 whitespace-nowrap", children: ROW_CONTROL_WORDS.publishedToWeb }),
|
|
@@ -29585,10 +29606,10 @@ function RowShownTo({ recordId, tableId }) {
|
|
|
29585
29606
|
}, [read]);
|
|
29586
29607
|
if (error && !c) return null;
|
|
29587
29608
|
if (tableId && table.loading && !table.data) return null;
|
|
29588
|
-
if (!(0,
|
|
29589
|
-
if (!c || c.shown_to.is_child || !(0,
|
|
29609
|
+
if (!(0, import_records43.levelHasShownTo)(table.data?.level)) return null;
|
|
29610
|
+
if (!c || c.shown_to.is_child || !(0, import_records43.isShownTo)(c.shown_to.effective)) return null;
|
|
29590
29611
|
const effective = c.shown_to.effective;
|
|
29591
|
-
const allowed = c.shown_to.allowed.filter(
|
|
29612
|
+
const allowed = c.shown_to.allowed.filter(import_records43.isShownTo);
|
|
29592
29613
|
return /* @__PURE__ */ (0, import_jsx_runtime93.jsxs)("span", { className: "flex items-center gap-1.5", "data-testid": "row-shown-to", children: [
|
|
29593
29614
|
/* @__PURE__ */ (0, import_jsx_runtime93.jsx)("span", { className: "text-muted-foreground", children: ROW_CONTROL_WORDS.shownTo }),
|
|
29594
29615
|
c.shown_to.can_change ? /* @__PURE__ */ (0, import_jsx_runtime93.jsx)(
|
|
@@ -29607,7 +29628,7 @@ function RowShownTo({ recordId, tableId }) {
|
|
|
29607
29628
|
}
|
|
29608
29629
|
}
|
|
29609
29630
|
) : /* @__PURE__ */ (0, import_jsx_runtime93.jsxs)(import_jsx_runtime93.Fragment, { children: [
|
|
29610
|
-
/* @__PURE__ */ (0, import_jsx_runtime93.jsx)("span", { "data-testid": "row-shown-to-text", children:
|
|
29631
|
+
/* @__PURE__ */ (0, import_jsx_runtime93.jsx)("span", { "data-testid": "row-shown-to-text", children: import_records43.SHOWN_TO_LABEL[effective] }),
|
|
29611
29632
|
/* @__PURE__ */ (0, import_jsx_runtime93.jsx)("span", { className: "max-w-[18rem] text-[11px] text-muted-foreground", "data-testid": "row-shown-to-who", children: ROW_CONTROL_WORDS.whoMayChangeRow })
|
|
29612
29633
|
] }),
|
|
29613
29634
|
error ? /* @__PURE__ */ (0, import_jsx_runtime93.jsx)(RefusalNotice, { error }) : null
|
|
@@ -29944,7 +29965,7 @@ function TableSettingsPanel({
|
|
|
29944
29965
|
table.data ? /* @__PURE__ */ (0, import_jsx_runtime95.jsx)(TableFoundationSwitch, { tableId, table: table.data }) : null,
|
|
29945
29966
|
table.data ? /* @__PURE__ */ (0, import_jsx_runtime95.jsx)(TableAccessLevel, { tableId, fields: fields.data ?? [] }) : null,
|
|
29946
29967
|
/* @__PURE__ */ (0, import_jsx_runtime95.jsx)(import_design_system82.Separator, {}),
|
|
29947
|
-
(0,
|
|
29968
|
+
(0, import_records44.levelHasShownTo)(table.data?.level) ? /* @__PURE__ */ (0, import_jsx_runtime95.jsxs)(import_jsx_runtime95.Fragment, { children: [
|
|
29948
29969
|
/* @__PURE__ */ (0, import_jsx_runtime95.jsx)(NewRowsDefaults, { tableId }),
|
|
29949
29970
|
/* @__PURE__ */ (0, import_jsx_runtime95.jsx)(import_design_system82.Separator, {})
|
|
29950
29971
|
] }) : null,
|
|
@@ -30028,7 +30049,7 @@ function TableSettingsPanel({
|
|
|
30028
30049
|
|
|
30029
30050
|
// src/Peek.tsx
|
|
30030
30051
|
var import_react170 = require("react");
|
|
30031
|
-
var
|
|
30052
|
+
var import_records46 = require("@ai-matrx/records");
|
|
30032
30053
|
var import_react171 = require("@ai-matrx/records/react");
|
|
30033
30054
|
var import_react172 = require("@ai-matrx/alchemy/react");
|
|
30034
30055
|
|
|
@@ -30346,12 +30367,12 @@ function ShareForSomebodyElse({
|
|
|
30346
30367
|
// src/RecordBody.tsx
|
|
30347
30368
|
var import_react168 = require("react");
|
|
30348
30369
|
var import_design_system85 = require("@ai-matrx/design-system");
|
|
30349
|
-
var
|
|
30370
|
+
var import_records45 = require("@ai-matrx/records");
|
|
30350
30371
|
var import_react169 = require("@ai-matrx/records/react");
|
|
30351
30372
|
var import_jsx_runtime99 = require("react/jsx-runtime");
|
|
30352
30373
|
var BODY_NAMES = /^(notes?|page|body|content|page content|details|description)$/i;
|
|
30353
30374
|
function bodyFieldOf(fields) {
|
|
30354
|
-
const rich2 = fields.filter((field2) => (0,
|
|
30375
|
+
const rich2 = fields.filter((field2) => (0, import_records45.newerKindOf)(field2) === "rich_text");
|
|
30355
30376
|
return rich2.find((field2) => BODY_NAMES.test((field2.label ?? field2.key).trim()) || BODY_NAMES.test(field2.key.replace(/_/g, " "))) ?? rich2[0];
|
|
30356
30377
|
}
|
|
30357
30378
|
var BODY_COLUMN_NAME = "Notes";
|
|
@@ -30475,7 +30496,7 @@ function Peek({ tableId, recordId, onClose, className, onPage = false }) {
|
|
|
30475
30496
|
if (record.error) return /* @__PURE__ */ (0, import_jsx_runtime100.jsx)(RefusalNotice, { error: record.error, className });
|
|
30476
30497
|
if (fields.error) return /* @__PURE__ */ (0, import_jsx_runtime100.jsx)(RefusalNotice, { error: fields.error, className });
|
|
30477
30498
|
const document2 = record.data?.document;
|
|
30478
|
-
if (document2 && (0,
|
|
30499
|
+
if (document2 && (0, import_records46.isLockedStub)({ document: document2, level: null })) {
|
|
30479
30500
|
const filed = document2["submitted_at"];
|
|
30480
30501
|
const when = typeof filed === "string" && !Number.isNaN(Date.parse(filed)) ? new Date(filed).toLocaleDateString("en-US", { year: "numeric", month: "short", day: "numeric" }) : null;
|
|
30481
30502
|
return /* @__PURE__ */ (0, import_jsx_runtime100.jsxs)("p", { className: (0, import_design_system86.cn)("text-sm text-muted-foreground", className), "data-records-locked-record": "", children: [
|
|
@@ -30758,7 +30779,7 @@ function usePlatformTable(spec) {
|
|
|
30758
30779
|
// src/ViewSwitcher.tsx
|
|
30759
30780
|
var import_react191 = require("react");
|
|
30760
30781
|
var import_react192 = require("@ai-matrx/records/react");
|
|
30761
|
-
var
|
|
30782
|
+
var import_records48 = require("@ai-matrx/records");
|
|
30762
30783
|
var import_design_system94 = require("@ai-matrx/design-system");
|
|
30763
30784
|
var import_data_table21 = require("@ai-matrx/design-system/data-table");
|
|
30764
30785
|
var import_format8 = require("@ai-matrx/kit/format");
|
|
@@ -30913,7 +30934,7 @@ function MoveRefusedBadge({ refused }) {
|
|
|
30913
30934
|
// src/Pipeline.tsx
|
|
30914
30935
|
var import_react179 = require("react");
|
|
30915
30936
|
var import_react180 = require("@ai-matrx/records/react");
|
|
30916
|
-
var
|
|
30937
|
+
var import_records47 = require("@ai-matrx/records");
|
|
30917
30938
|
var import_design_system89 = require("@ai-matrx/design-system");
|
|
30918
30939
|
var import_data_table16 = require("@ai-matrx/design-system/data-table");
|
|
30919
30940
|
|
|
@@ -31246,7 +31267,7 @@ function PipelineBoard({
|
|
|
31246
31267
|
alive.current = false;
|
|
31247
31268
|
};
|
|
31248
31269
|
}, []);
|
|
31249
|
-
const filterKey = (0,
|
|
31270
|
+
const filterKey = (0, import_records47.stableFilterKey)(filter);
|
|
31250
31271
|
const reload = (0, import_react179.useCallback)(async () => {
|
|
31251
31272
|
setLoading(true);
|
|
31252
31273
|
const [read, board, held] = await Promise.all([
|
|
@@ -33976,7 +33997,7 @@ var NO_FIELDS2 = [];
|
|
|
33976
33997
|
function useViewRecords(view, pageSize = 200, filter, viewId) {
|
|
33977
33998
|
const client = (0, import_react192.useRecordsClient)();
|
|
33978
33999
|
const [limit, setLimit] = (0, import_react191.useState)(pageSize);
|
|
33979
|
-
const questionKey = `${view.subject}|${(0,
|
|
34000
|
+
const questionKey = `${view.subject}|${(0, import_records48.stableFilterKey)(filter ?? null)}|${JSON.stringify(view.sorts ?? [])}`;
|
|
33980
34001
|
(0, import_react191.useEffect)(() => {
|
|
33981
34002
|
setLimit(pageSize);
|
|
33982
34003
|
}, [questionKey, pageSize]);
|
|
@@ -34009,8 +34030,8 @@ function useViewRecords(view, pageSize = 200, filter, viewId) {
|
|
|
34009
34030
|
cancelled = true;
|
|
34010
34031
|
};
|
|
34011
34032
|
}, [client, ruleId, pageSize]);
|
|
34012
|
-
const asked3 = (0,
|
|
34013
|
-
const fromView = asked3 !== "{}" && (asked3 === (0,
|
|
34033
|
+
const asked3 = (0, import_records48.stableFilterKey)(filter ?? null);
|
|
34034
|
+
const fromView = asked3 !== "{}" && (asked3 === (0, import_records48.stableFilterKey)(view.where ?? null) || asked3 === (0, import_records48.stableFilterKey)(view.filters ?? null));
|
|
34014
34035
|
const tableRows = (0, import_react191.useMemo)(() => table.data?.rows ?? [], [table.data]);
|
|
34015
34036
|
const manual = view.order === "manual" && Boolean(viewId) && !ruleId;
|
|
34016
34037
|
const hand = useHandOrderRows({
|
|
@@ -35046,12 +35067,12 @@ function cardHiddenOf(presentation) {
|
|
|
35046
35067
|
}
|
|
35047
35068
|
var STATUS_WORDS = /^(status|stage|state|progress|phase)$/i;
|
|
35048
35069
|
function boardDefaultGroupField(eligible) {
|
|
35049
|
-
return eligible.find((f) => (0,
|
|
35070
|
+
return eligible.find((f) => (0, import_records48.newerKindOf)(f) === "status") ?? eligible.find((f) => STATUS_WORDS.test(fieldName(f).trim()) || STATUS_WORDS.test(f.key)) ?? eligible[0] ?? null;
|
|
35050
35071
|
}
|
|
35051
35072
|
|
|
35052
35073
|
// src/ArchivedView.tsx
|
|
35053
35074
|
var import_react193 = require("react");
|
|
35054
|
-
var
|
|
35075
|
+
var import_records49 = require("@ai-matrx/records");
|
|
35055
35076
|
var import_react194 = require("@ai-matrx/records/react");
|
|
35056
35077
|
var import_design_system95 = require("@ai-matrx/design-system");
|
|
35057
35078
|
var import_jsx_runtime112 = require("react/jsx-runtime");
|
|
@@ -35061,7 +35082,7 @@ function mayNotRestoreLine(why) {
|
|
|
35061
35082
|
return said2 === "" ? "Bringing a record back needs permission to edit this table. Ask somebody who has it." : said2;
|
|
35062
35083
|
}
|
|
35063
35084
|
function archivedRowLine(row, titleKey) {
|
|
35064
|
-
return `${recordName(row.document, titleKey)} \u2014 ${(0,
|
|
35085
|
+
return `${recordName(row.document, titleKey)} \u2014 ${(0, import_records49.archivedByLine)(row)}`;
|
|
35065
35086
|
}
|
|
35066
35087
|
function ArchivedView({
|
|
35067
35088
|
tableId,
|
|
@@ -35075,7 +35096,7 @@ function ArchivedView({
|
|
|
35075
35096
|
const table = (0, import_react194.useTable)(tableId);
|
|
35076
35097
|
const rights = useTableRights(table.data);
|
|
35077
35098
|
const fields = (0, import_react194.useFields)(tableId);
|
|
35078
|
-
const [lane, setLane] = (0, import_react193.useState)(laneFromHost ??
|
|
35099
|
+
const [lane, setLane] = (0, import_react193.useState)(laneFromHost ?? import_records49.DEFAULT_ARCHIVE_LANE);
|
|
35079
35100
|
const [rows, setRows] = (0, import_react193.useState)([]);
|
|
35080
35101
|
const [loading, setLoading] = (0, import_react193.useState)(true);
|
|
35081
35102
|
const [error, setError] = (0, import_react193.useState)(null);
|
|
@@ -35122,15 +35143,15 @@ function ArchivedView({
|
|
|
35122
35143
|
return /* @__PURE__ */ (0, import_jsx_runtime112.jsxs)("div", { className: (0, import_design_system95.cn)("flex min-h-0 flex-col gap-2", className), "data-testid": "archived-view", children: [
|
|
35123
35144
|
/* @__PURE__ */ (0, import_jsx_runtime112.jsxs)("div", { className: "flex flex-wrap items-center gap-2", children: [
|
|
35124
35145
|
/* @__PURE__ */ (0, import_jsx_runtime112.jsx)("span", { className: "text-sm font-medium", children: "Archived" }),
|
|
35125
|
-
/* @__PURE__ */ (0, import_jsx_runtime112.jsx)("div", { className: "ml-auto flex items-center gap-0.5", role: "group", "aria-label": "Archived by", children:
|
|
35146
|
+
/* @__PURE__ */ (0, import_jsx_runtime112.jsx)("div", { className: "ml-auto flex items-center gap-0.5", role: "group", "aria-label": "Archived by", children: import_records49.ARCHIVE_LANES.map((option) => /* @__PURE__ */ (0, import_jsx_runtime112.jsx)(
|
|
35126
35147
|
import_design_system95.Button,
|
|
35127
35148
|
{
|
|
35128
35149
|
size: "sm",
|
|
35129
35150
|
variant: option === lane ? "secondary" : "ghost",
|
|
35130
35151
|
"aria-pressed": option === lane,
|
|
35131
|
-
title:
|
|
35152
|
+
title: import_records49.ARCHIVE_LANE_MEANS[option],
|
|
35132
35153
|
onClick: () => pick(option),
|
|
35133
|
-
children:
|
|
35154
|
+
children: import_records49.ARCHIVE_LANE_LABEL[option]
|
|
35134
35155
|
},
|
|
35135
35156
|
option
|
|
35136
35157
|
)) })
|
|
@@ -35146,7 +35167,7 @@ function ArchivedView({
|
|
|
35146
35167
|
),
|
|
35147
35168
|
error ? /* @__PURE__ */ (0, import_jsx_runtime112.jsx)(RefusalNotice, { error }) : null,
|
|
35148
35169
|
loading && !error ? /* @__PURE__ */ (0, import_jsx_runtime112.jsx)(import_design_system95.Skeleton, { className: "h-24 w-full" }) : null,
|
|
35149
|
-
!loading && !error && rows.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime112.jsx)("p", { "data-testid": "archived-empty", className: "rounded-md border border-dashed px-3 py-6 text-xs text-muted-foreground", children: (0,
|
|
35170
|
+
!loading && !error && rows.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime112.jsx)("p", { "data-testid": "archived-empty", className: "rounded-md border border-dashed px-3 py-6 text-xs text-muted-foreground", children: (0, import_records49.emptyArchiveLine)(lane) }) : null,
|
|
35150
35171
|
!loading && !error && rows.length > 0 ? /* @__PURE__ */ (0, import_jsx_runtime112.jsx)("ul", { className: "flex flex-col gap-1", "data-testid": "archived-rows", children: rows.map((row) => /* @__PURE__ */ (0, import_jsx_runtime112.jsxs)(
|
|
35151
35172
|
"li",
|
|
35152
35173
|
{
|
|
@@ -35156,7 +35177,7 @@ function ArchivedView({
|
|
|
35156
35177
|
children: [
|
|
35157
35178
|
/* @__PURE__ */ (0, import_jsx_runtime112.jsxs)("div", { className: "flex min-w-0 flex-1 flex-col", children: [
|
|
35158
35179
|
/* @__PURE__ */ (0, import_jsx_runtime112.jsx)("span", { className: "truncate text-sm", children: recordName(row.document, titleKey) }),
|
|
35159
|
-
/* @__PURE__ */ (0, import_jsx_runtime112.jsx)("span", { className: "truncate text-xs text-muted-foreground", "data-testid": "archived-who", children: (0,
|
|
35180
|
+
/* @__PURE__ */ (0, import_jsx_runtime112.jsx)("span", { className: "truncate text-xs text-muted-foreground", "data-testid": "archived-who", children: (0, import_records49.archivedByLine)(row) }),
|
|
35160
35181
|
refusal3 && refusal3.recordId === row.id ? /* @__PURE__ */ (0, import_jsx_runtime112.jsx)(RefusalNotice, { error: refusal3.error, className: "mt-2" }) : null
|
|
35161
35182
|
] }),
|
|
35162
35183
|
mayRestore ? /* @__PURE__ */ (0, import_jsx_runtime112.jsx)(
|
|
@@ -35179,7 +35200,7 @@ function ArchivedView({
|
|
|
35179
35200
|
] });
|
|
35180
35201
|
}
|
|
35181
35202
|
function retiredColumnLine(row) {
|
|
35182
|
-
return (0,
|
|
35203
|
+
return (0, import_records49.archivedByLine)(row);
|
|
35183
35204
|
}
|
|
35184
35205
|
function RetiredColumns({ tableId, mayRestore, whyNot }) {
|
|
35185
35206
|
const client = (0, import_react194.useRecordsClient)();
|
|
@@ -35243,7 +35264,7 @@ function RetiredColumns({ tableId, mayRestore, whyNot }) {
|
|
|
35243
35264
|
|
|
35244
35265
|
// src/ArchivedDisclosure.tsx
|
|
35245
35266
|
var import_react195 = require("react");
|
|
35246
|
-
var
|
|
35267
|
+
var import_records50 = require("@ai-matrx/records");
|
|
35247
35268
|
var import_react196 = require("@ai-matrx/records/react");
|
|
35248
35269
|
var import_design_system96 = require("@ai-matrx/design-system");
|
|
35249
35270
|
var import_jsx_runtime113 = require("react/jsx-runtime");
|
|
@@ -35343,10 +35364,10 @@ function ArchivedPortals({
|
|
|
35343
35364
|
error ? /* @__PURE__ */ (0, import_jsx_runtime113.jsx)(RefusalNotice, { error }) : null,
|
|
35344
35365
|
rows === null && !error ? /* @__PURE__ */ (0, import_jsx_runtime113.jsx)(import_design_system96.Skeleton, { className: "h-16 w-full" }) : null,
|
|
35345
35366
|
said2 ? /* @__PURE__ */ (0, import_jsx_runtime113.jsx)("p", { className: "rounded-md border border-border px-3 py-2 text-xs", "data-testid": "archived-portal-said", children: said2 }) : null,
|
|
35346
|
-
rows !== null && !error && rows.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime113.jsx)("p", { "data-testid": "archived-portals-empty", className: "text-xs text-muted-foreground", children: (0,
|
|
35367
|
+
rows !== null && !error && rows.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime113.jsx)("p", { "data-testid": "archived-portals-empty", className: "text-xs text-muted-foreground", children: (0, import_records50.emptyPortalArchiveLine)() }) : null,
|
|
35347
35368
|
rows !== null && rows.length > 0 ? /* @__PURE__ */ (0, import_jsx_runtime113.jsx)("ul", { className: "flex flex-col gap-1.5", "data-testid": "archived-portals", children: rows.map((portal) => {
|
|
35348
35369
|
const asking = confirming === portal.portal_id;
|
|
35349
|
-
const matches2 = (0,
|
|
35370
|
+
const matches2 = (0, import_records50.portalTitleTypedBack)(typed2, portal.title);
|
|
35350
35371
|
return /* @__PURE__ */ (0, import_jsx_runtime113.jsxs)(
|
|
35351
35372
|
"li",
|
|
35352
35373
|
{
|
|
@@ -35385,7 +35406,7 @@ function ArchivedPortals({
|
|
|
35385
35406
|
] }),
|
|
35386
35407
|
asking ? /* @__PURE__ */ (0, import_jsx_runtime113.jsxs)("div", { className: "flex flex-col gap-1.5", children: [
|
|
35387
35408
|
/* @__PURE__ */ (0, import_jsx_runtime113.jsxs)("p", { className: "text-xs text-muted-foreground", children: [
|
|
35388
|
-
(0,
|
|
35409
|
+
(0, import_records50.portalConfirmLine)(portal.title),
|
|
35389
35410
|
" Restoring it puts it back exactly as it was: everyone who was invited can sign in again, and it shows the same Tables."
|
|
35390
35411
|
] }),
|
|
35391
35412
|
/* @__PURE__ */ (0, import_jsx_runtime113.jsxs)("div", { className: "flex flex-wrap items-center gap-1.5", children: [
|
|
@@ -38205,7 +38226,7 @@ function FieldHistoryPanel({
|
|
|
38205
38226
|
}
|
|
38206
38227
|
|
|
38207
38228
|
// src/forms.ts
|
|
38208
|
-
var
|
|
38229
|
+
var import_records51 = require("@ai-matrx/records");
|
|
38209
38230
|
var FORM_STATE_WORDS = {
|
|
38210
38231
|
draft: "Not published \u2014 the link does not answer yet.",
|
|
38211
38232
|
open: "Open \u2014 anyone with the link can answer it.",
|
|
@@ -38388,7 +38409,7 @@ function formLookFromDocument(raw) {
|
|
|
38388
38409
|
const doc = raw;
|
|
38389
38410
|
const id = (v) => typeof v === "string" && v.trim() !== "" ? v : null;
|
|
38390
38411
|
const look = {
|
|
38391
|
-
accent: (0,
|
|
38412
|
+
accent: (0, import_records51.isPortalAccent)(doc["accent"]) ? doc["accent"] : null,
|
|
38392
38413
|
logoFileId: id(doc["logo_file_id"]),
|
|
38393
38414
|
coverFileId: id(doc["cover_file_id"])
|
|
38394
38415
|
};
|
|
@@ -38498,7 +38519,7 @@ var import_design_system106 = require("@ai-matrx/design-system");
|
|
|
38498
38519
|
// src/ChartBlock.tsx
|
|
38499
38520
|
var import_react218 = require("react");
|
|
38500
38521
|
var import_recharts = require("recharts");
|
|
38501
|
-
var
|
|
38522
|
+
var import_records52 = require("@ai-matrx/records");
|
|
38502
38523
|
var import_core21 = require("@ai-matrx/records/core");
|
|
38503
38524
|
var import_design_system105 = require("@ai-matrx/design-system");
|
|
38504
38525
|
var import_format11 = require("@ai-matrx/kit/format");
|
|
@@ -38976,7 +38997,7 @@ function ChartBlock({ block, subject, tableName: tableName2, className, centerVa
|
|
|
38976
38997
|
const kind = block.kind;
|
|
38977
38998
|
const tableId = block.table_id ?? subject;
|
|
38978
38999
|
const measures = block.measures && block.measures.length > 0 ? block.measures : [{ op: "count" }];
|
|
38979
|
-
const primary = (0,
|
|
39000
|
+
const primary = (0, import_records52.measureKey)(measures[0]);
|
|
38980
39001
|
const windows = kind === "stuck" ? null : block.compare ?? null;
|
|
38981
39002
|
const compared = !!windows;
|
|
38982
39003
|
const grain = block.bucket?.by ?? null;
|
|
@@ -39928,7 +39949,7 @@ function clientNoun(table) {
|
|
|
39928
39949
|
var import_clipboard7 = require("@ai-matrx/kit/clipboard");
|
|
39929
39950
|
var import_react225 = require("react");
|
|
39930
39951
|
var import_react226 = require("@ai-matrx/records/react");
|
|
39931
|
-
var
|
|
39952
|
+
var import_records54 = require("@ai-matrx/records");
|
|
39932
39953
|
var import_design_system111 = require("@ai-matrx/design-system");
|
|
39933
39954
|
|
|
39934
39955
|
// src/PortalLookEditor.tsx
|
|
@@ -39937,11 +39958,11 @@ var import_react224 = require("@ai-matrx/records/react");
|
|
|
39937
39958
|
var import_design_system110 = require("@ai-matrx/design-system");
|
|
39938
39959
|
|
|
39939
39960
|
// src/AccentSwatches.tsx
|
|
39940
|
-
var
|
|
39961
|
+
var import_records53 = require("@ai-matrx/records");
|
|
39941
39962
|
var import_design_system108 = require("@ai-matrx/design-system");
|
|
39942
39963
|
var import_data_table23 = require("@ai-matrx/design-system/data-table");
|
|
39943
39964
|
var import_jsx_runtime125 = require("react/jsx-runtime");
|
|
39944
|
-
function AccentSwatches({ value, onChange, options =
|
|
39965
|
+
function AccentSwatches({ value, onChange, options = import_records53.PORTAL_ACCENTS, noneLabel = "App colour" }) {
|
|
39945
39966
|
return /* @__PURE__ */ (0, import_jsx_runtime125.jsxs)("div", { className: "flex flex-wrap gap-1.5", role: "radiogroup", "aria-label": "Colour", children: [
|
|
39946
39967
|
/* @__PURE__ */ (0, import_jsx_runtime125.jsx)(
|
|
39947
39968
|
"button",
|
|
@@ -40408,7 +40429,7 @@ function PortalsPanel({ tableId, activePortalId, className }) {
|
|
|
40408
40429
|
] }) : null,
|
|
40409
40430
|
activePortalId && !shown4.some((p) => p.portal_id === activePortalId) ? /* @__PURE__ */ (0, import_jsx_runtime128.jsx)("p", { className: "rounded-md border border-amber-600/40 bg-amber-500/5 px-3 py-2 text-xs leading-relaxed text-amber-700 dark:border-amber-400/40 dark:text-amber-300", children: PORTAL_NOT_HERE_LINE }) : null,
|
|
40410
40431
|
/* @__PURE__ */ (0, import_jsx_runtime128.jsx)("ul", { className: "flex flex-col gap-2", children: shown4.map((portal) => {
|
|
40411
|
-
const url = `${origin}${(0,
|
|
40432
|
+
const url = `${origin}${(0, import_records54.portalPath)(portal.slug)}`;
|
|
40412
40433
|
const open = openId === portal.portal_id;
|
|
40413
40434
|
const linked = portal.portal_id === activePortalId;
|
|
40414
40435
|
return /* @__PURE__ */ (0, import_jsx_runtime128.jsxs)(
|
|
@@ -40523,8 +40544,8 @@ function ArchivePortalControl({
|
|
|
40523
40544
|
}
|
|
40524
40545
|
),
|
|
40525
40546
|
asking ? /* @__PURE__ */ (0, import_jsx_runtime128.jsxs)("div", { className: "mt-1.5 flex w-full flex-col gap-1.5 rounded-md border border-dashed border-border p-2.5", children: [
|
|
40526
|
-
/* @__PURE__ */ (0, import_jsx_runtime128.jsx)("p", { className: "text-xs text-muted-foreground", "data-testid": "portal-archive-consequence", children: (0,
|
|
40527
|
-
/* @__PURE__ */ (0, import_jsx_runtime128.jsx)("p", { className: "text-xs text-muted-foreground", children: (0,
|
|
40547
|
+
/* @__PURE__ */ (0, import_jsx_runtime128.jsx)("p", { className: "text-xs text-muted-foreground", "data-testid": "portal-archive-consequence", children: (0, import_records54.portalArchiveConsequence)(portal.title, portal.signed_in, portal.invited) }),
|
|
40548
|
+
/* @__PURE__ */ (0, import_jsx_runtime128.jsx)("p", { className: "text-xs text-muted-foreground", children: (0, import_records54.portalConfirmLine)(portal.title) }),
|
|
40528
40549
|
/* @__PURE__ */ (0, import_jsx_runtime128.jsxs)("div", { className: "flex flex-wrap items-center gap-1.5", children: [
|
|
40529
40550
|
/* @__PURE__ */ (0, import_jsx_runtime128.jsx)(
|
|
40530
40551
|
import_design_system111.BasicInput,
|
|
@@ -40542,7 +40563,7 @@ function ArchivePortalControl({
|
|
|
40542
40563
|
size: "sm",
|
|
40543
40564
|
variant: "destructive",
|
|
40544
40565
|
"data-testid": "portal-archive-do",
|
|
40545
|
-
disabled: busy || !(0,
|
|
40566
|
+
disabled: busy || !(0, import_records54.portalTitleTypedBack)(typed2, portal.title),
|
|
40546
40567
|
onClick: () => void go(),
|
|
40547
40568
|
children: busy ? "Archiving\u2026" : "Archive it"
|
|
40548
40569
|
}
|
|
@@ -41067,7 +41088,7 @@ function FormLookFrame({ look, title, children, contained = false, showOwnerHead
|
|
|
41067
41088
|
// src/DigestScheduler.tsx
|
|
41068
41089
|
var import_react227 = require("react");
|
|
41069
41090
|
var import_react228 = require("@ai-matrx/records/react");
|
|
41070
|
-
var
|
|
41091
|
+
var import_records55 = require("@ai-matrx/records");
|
|
41071
41092
|
var import_design_system113 = require("@ai-matrx/design-system");
|
|
41072
41093
|
|
|
41073
41094
|
// src/scheduleWords.ts
|
|
@@ -41153,7 +41174,7 @@ function DigestScheduler({
|
|
|
41153
41174
|
const [channel, setChannel] = (0, import_react227.useState)(
|
|
41154
41175
|
existing?.channel === "email" || existing?.channel === "sms" ? existing.channel : "in_app"
|
|
41155
41176
|
);
|
|
41156
|
-
const [quiet2, setQuiet] = (0, import_react227.useState)((0,
|
|
41177
|
+
const [quiet2, setQuiet] = (0, import_react227.useState)((0, import_records55.hasQuietHours)(existing?.quiet_hours));
|
|
41157
41178
|
const [quietFrom, setQuietFrom] = (0, import_react227.useState)(existing?.quiet_hours?.start ?? "22:00");
|
|
41158
41179
|
const [quietTo, setQuietTo] = (0, import_react227.useState)(existing?.quiet_hours?.end ?? "07:00");
|
|
41159
41180
|
const [recipients, setRecipients] = (0, import_react227.useState)(
|
|
@@ -41439,7 +41460,7 @@ function DigestScheduler({
|
|
|
41439
41460
|
// src/SubscriptionsPanel.tsx
|
|
41440
41461
|
var import_react231 = require("react");
|
|
41441
41462
|
var import_react232 = require("@ai-matrx/records/react");
|
|
41442
|
-
var
|
|
41463
|
+
var import_records56 = require("@ai-matrx/records");
|
|
41443
41464
|
var import_design_system115 = require("@ai-matrx/design-system");
|
|
41444
41465
|
|
|
41445
41466
|
// src/WebhooksPanel.tsx
|
|
@@ -41802,7 +41823,7 @@ function SubscriptionsPanel({ tableId, activeRuleId, className }) {
|
|
|
41802
41823
|
"Last told you ",
|
|
41803
41824
|
new Date(subscription.last_sent_at).toLocaleString()
|
|
41804
41825
|
] }) : /* @__PURE__ */ (0, import_jsx_runtime132.jsx)("span", { children: "It has not told you anything yet." }),
|
|
41805
|
-
(0,
|
|
41826
|
+
(0, import_records56.hasQuietHours)(subscription.quiet_hours) ? /* @__PURE__ */ (0, import_jsx_runtime132.jsxs)("span", { children: [
|
|
41806
41827
|
"Not between ",
|
|
41807
41828
|
subscription.quiet_hours.start,
|
|
41808
41829
|
" and ",
|
|
@@ -41873,7 +41894,7 @@ var import_core22 = require("@dnd-kit/core");
|
|
|
41873
41894
|
var import_sortable = require("@dnd-kit/sortable");
|
|
41874
41895
|
var import_utilities = require("@dnd-kit/utilities");
|
|
41875
41896
|
var import_react237 = require("@ai-matrx/records/react");
|
|
41876
|
-
var
|
|
41897
|
+
var import_records57 = require("@ai-matrx/records");
|
|
41877
41898
|
var import_design_system119 = require("@ai-matrx/design-system");
|
|
41878
41899
|
|
|
41879
41900
|
// src/FormFlowEditor.tsx
|
|
@@ -43196,7 +43217,7 @@ function FormBuilder({ tableId, seed, activeFormId, onActiveForm, startWithOne,
|
|
|
43196
43217
|
/* @__PURE__ */ (0, import_jsx_runtime135.jsx)(
|
|
43197
43218
|
PublishRow,
|
|
43198
43219
|
{
|
|
43199
|
-
url: `${publicOrigin}${(0,
|
|
43220
|
+
url: `${publicOrigin}${(0, import_records57.publicFormPath)(draft.id)}`,
|
|
43200
43221
|
state: draft.state,
|
|
43201
43222
|
mayPublish: rights.structure,
|
|
43202
43223
|
why: rights.why("structure"),
|
|
@@ -43208,7 +43229,7 @@ function FormBuilder({ tableId, seed, activeFormId, onActiveForm, startWithOne,
|
|
|
43208
43229
|
unsaved: dirty
|
|
43209
43230
|
}
|
|
43210
43231
|
),
|
|
43211
|
-
/* @__PURE__ */ (0, import_jsx_runtime135.jsx)(EmbedSnippets, { url: `${publicOrigin}${(0,
|
|
43232
|
+
/* @__PURE__ */ (0, import_jsx_runtime135.jsx)(EmbedSnippets, { url: `${publicOrigin}${(0, import_records57.publicFormPath)(draft.id)}`, label: draft.name }),
|
|
43212
43233
|
/* @__PURE__ */ (0, import_jsx_runtime135.jsx)(
|
|
43213
43234
|
NotifyOnAnswer,
|
|
43214
43235
|
{
|
|
@@ -44261,7 +44282,7 @@ function SignBlock({ tableId, recordId, render, className }) {
|
|
|
44261
44282
|
// src/NotifyRuleEditor.tsx
|
|
44262
44283
|
var import_react245 = require("react");
|
|
44263
44284
|
var import_react246 = require("@ai-matrx/records/react");
|
|
44264
|
-
var
|
|
44285
|
+
var import_records58 = require("@ai-matrx/records");
|
|
44265
44286
|
var import_design_system123 = require("@ai-matrx/design-system");
|
|
44266
44287
|
var import_jsx_runtime139 = require("react/jsx-runtime");
|
|
44267
44288
|
var CADENCE_WORDS2 = SUBSCRIPTION_CADENCE_LABEL;
|
|
@@ -44412,7 +44433,7 @@ function NotifyRuleEditor({ tableId, seed, chosenRuleId, onChoose, className })
|
|
|
44412
44433
|
"next ",
|
|
44413
44434
|
new Date(held.next_digest_at).toLocaleString()
|
|
44414
44435
|
] }) : null,
|
|
44415
|
-
(0,
|
|
44436
|
+
(0, import_records58.hasQuietHours)(held.quiet_hours) ? /* @__PURE__ */ (0, import_jsx_runtime139.jsxs)("span", { className: "text-muted-foreground", children: [
|
|
44416
44437
|
"quiet ",
|
|
44417
44438
|
held.quiet_hours.start,
|
|
44418
44439
|
"\u2013",
|
|
@@ -45098,7 +45119,7 @@ function AddChart({ subject, onAdd, onClose }) {
|
|
|
45098
45119
|
}
|
|
45099
45120
|
|
|
45100
45121
|
// src/pages.ts
|
|
45101
|
-
var
|
|
45122
|
+
var import_records59 = require("@ai-matrx/records");
|
|
45102
45123
|
var PAGE_BLOCK_KINDS = ["list", "record", "button", "form", "filter", "chart", "heading", "text", "applet"];
|
|
45103
45124
|
var PAGE_BLOCK_LABEL = {
|
|
45104
45125
|
list: "List",
|
|
@@ -45148,10 +45169,10 @@ function filterTargets(filter, blocks) {
|
|
|
45148
45169
|
}
|
|
45149
45170
|
function combineFilter(base, extra, fieldIdOf) {
|
|
45150
45171
|
const extraKeys = Object.keys(extra);
|
|
45151
|
-
if (!base || !(0,
|
|
45172
|
+
if (!base || !(0, import_records59.isRuleFilter)(base) && Object.keys(base).length === 0) {
|
|
45152
45173
|
return { filter: extraKeys.length > 0 ? { ...extra } : null, dropped: [] };
|
|
45153
45174
|
}
|
|
45154
|
-
if (!(0,
|
|
45175
|
+
if (!(0, import_records59.isRuleFilter)(base)) return { filter: { ...base, ...extra }, dropped: [] };
|
|
45155
45176
|
const dropped = [];
|
|
45156
45177
|
let rule = base;
|
|
45157
45178
|
for (const key of extraKeys) {
|
|
@@ -45809,7 +45830,7 @@ var import_design_system128 = require("@ai-matrx/design-system");
|
|
|
45809
45830
|
var import_react256 = require("@ai-matrx/records/react");
|
|
45810
45831
|
|
|
45811
45832
|
// src/question.ts
|
|
45812
|
-
var
|
|
45833
|
+
var import_records60 = require("@ai-matrx/records");
|
|
45813
45834
|
var import_core24 = require("@ai-matrx/records/core");
|
|
45814
45835
|
var QUESTION_OPS = ["count", "sum", "avg", "min", "max"];
|
|
45815
45836
|
var QUESTION_LIMIT_DEFAULT = 25;
|
|
@@ -45888,7 +45909,7 @@ async function askQuestion(client, tableId, spec, fields) {
|
|
|
45888
45909
|
for (const m of measures) {
|
|
45889
45910
|
if (m.op !== "count" && !m.key) return refusal2(`Pick the column to ${m.op === "avg" ? "average" : m.op}.`);
|
|
45890
45911
|
}
|
|
45891
|
-
const keys = measures.map((m) => (0,
|
|
45912
|
+
const keys = measures.map((m) => (0, import_records60.measureKey)({ op: m.op, ...m.key ? { key: m.key } : {} }));
|
|
45892
45913
|
const group = spec.group;
|
|
45893
45914
|
if (spec.asOf) return askAsOf(client, tableId, spec, fields, measures, keys);
|
|
45894
45915
|
let filter = spec.where ?? {};
|
|
@@ -46733,7 +46754,7 @@ function QuestionAnswerView({ tableId, spec, answer, fields, related = NO_RELATE
|
|
|
46733
46754
|
// src/TableAsk.tsx
|
|
46734
46755
|
var import_react257 = require("react");
|
|
46735
46756
|
var import_design_system129 = require("@ai-matrx/design-system");
|
|
46736
|
-
var
|
|
46757
|
+
var import_records61 = require("@ai-matrx/records");
|
|
46737
46758
|
var import_react258 = require("@ai-matrx/records/react");
|
|
46738
46759
|
|
|
46739
46760
|
// src/askWords.ts
|
|
@@ -46963,7 +46984,7 @@ function TableAsk({ tableId, onOpenInQuestions }) {
|
|
|
46963
46984
|
await Promise.all(
|
|
46964
46985
|
all.filter(isChoiceField).map(async (field2) => {
|
|
46965
46986
|
const got = await fieldOptionsOnce(client, field2.id);
|
|
46966
|
-
if (got.ok) choices[field2.key] = (got.data ?? []).map((o) => (0,
|
|
46987
|
+
if (got.ok) choices[field2.key] = (got.data ?? []).map((o) => (0, import_records61.optionLabel)(o)).filter((w) => Boolean(w));
|
|
46967
46988
|
})
|
|
46968
46989
|
);
|
|
46969
46990
|
const read = questionFromWords(words2, all, choices);
|
|
@@ -47813,7 +47834,7 @@ function onePerKey3(all) {
|
|
|
47813
47834
|
var import_clipboard11 = require("@ai-matrx/kit/clipboard");
|
|
47814
47835
|
var import_react261 = require("react");
|
|
47815
47836
|
var import_react262 = require("@ai-matrx/records/react");
|
|
47816
|
-
var
|
|
47837
|
+
var import_records62 = require("@ai-matrx/records");
|
|
47817
47838
|
var import_design_system131 = require("@ai-matrx/design-system");
|
|
47818
47839
|
var import_jsx_runtime148 = require("react/jsx-runtime");
|
|
47819
47840
|
var FORM_NOT_HERE_LINE = "The link named a form this table does not have \u2014 it may have been removed, or it belongs to another table. The forms this table does have are listed here.";
|
|
@@ -47918,7 +47939,7 @@ function FormsPanel({ tableId, activeFormId, className }) {
|
|
|
47918
47939
|
}
|
|
47919
47940
|
) : null,
|
|
47920
47941
|
/* @__PURE__ */ (0, import_jsx_runtime148.jsx)("ul", { className: "flex flex-col gap-2", children: forms.map((form) => {
|
|
47921
|
-
const url = `${origin}${(0,
|
|
47942
|
+
const url = `${origin}${(0, import_records62.publicFormPath)(form.form_id)}`;
|
|
47922
47943
|
return /* @__PURE__ */ (0, import_jsx_runtime148.jsxs)(
|
|
47923
47944
|
"li",
|
|
47924
47945
|
{
|
|
@@ -48000,7 +48021,7 @@ var import_design_system133 = require("@ai-matrx/design-system");
|
|
|
48000
48021
|
|
|
48001
48022
|
// src/CaptureRun.tsx
|
|
48002
48023
|
var import_react263 = require("react");
|
|
48003
|
-
var
|
|
48024
|
+
var import_records63 = require("@ai-matrx/records");
|
|
48004
48025
|
var import_react264 = require("@ai-matrx/records/react");
|
|
48005
48026
|
var import_design_system132 = require("@ai-matrx/design-system");
|
|
48006
48027
|
var import_jsx_runtime149 = require("react/jsx-runtime");
|
|
@@ -48055,7 +48076,7 @@ function CaptureRun({ sheetId, face: given, className }) {
|
|
|
48055
48076
|
const [sending, setSending] = (0, import_react263.useState)(false);
|
|
48056
48077
|
const queueRef = (0, import_react263.useRef)(null);
|
|
48057
48078
|
(0, import_react263.useEffect)(() => {
|
|
48058
|
-
const q2 = (0,
|
|
48079
|
+
const q2 = (0, import_records63.openCaptureQueue)({
|
|
48059
48080
|
onChange: (c, all) => {
|
|
48060
48081
|
setCounts(c);
|
|
48061
48082
|
setItems(all);
|
|
@@ -48322,7 +48343,7 @@ function CaptureRun({ sheetId, face: given, className }) {
|
|
|
48322
48343
|
value: String(answers[q.field] ?? ""),
|
|
48323
48344
|
onChange: (e) => {
|
|
48324
48345
|
const raw = e.target.value;
|
|
48325
|
-
const answered2 = field2 ? (0,
|
|
48346
|
+
const answered2 = field2 ? (0, import_records63.coerceTypedAnswer)(field2, raw, { label: q.ask ?? (0, import_records63.coercionLabel)(field2) }) : { value: raw };
|
|
48326
48347
|
setAnswers((held) => ({
|
|
48327
48348
|
...held,
|
|
48328
48349
|
[q.field]: raw === "" ? "" : "refusal" in answered2 ? raw : answered2.value
|
|
@@ -48976,7 +48997,7 @@ function useEmbedHandshake(args) {
|
|
|
48976
48997
|
// src/TablePage.tsx
|
|
48977
48998
|
var import_clipboard14 = require("@ai-matrx/kit/clipboard");
|
|
48978
48999
|
var import_react283 = require("react");
|
|
48979
|
-
var
|
|
49000
|
+
var import_records64 = require("@ai-matrx/records");
|
|
48980
49001
|
var import_react284 = require("@ai-matrx/records/react");
|
|
48981
49002
|
var import_design_system143 = require("@ai-matrx/design-system");
|
|
48982
49003
|
var import_text_case19 = require("@ai-matrx/kit/text-case");
|
|
@@ -49811,7 +49832,7 @@ function TableNotHere({
|
|
|
49811
49832
|
return /* @__PURE__ */ (0, import_jsx_runtime160.jsxs)("div", { className: (0, import_design_system143.cn)("flex flex-col items-start gap-2 rounded-md border border-dashed p-6", className), children: [
|
|
49812
49833
|
/* @__PURE__ */ (0, import_jsx_runtime160.jsx)("p", { className: "text-sm font-medium", children: "This table is archived" }),
|
|
49813
49834
|
/* @__PURE__ */ (0, import_jsx_runtime160.jsx)("p", { className: "max-w-prose text-xs text-muted-foreground", children: TABLE_IS_ARCHIVED }),
|
|
49814
|
-
/* @__PURE__ */ (0, import_jsx_runtime160.jsx)("p", { className: "text-xs text-muted-foreground", children: (0,
|
|
49835
|
+
/* @__PURE__ */ (0, import_jsx_runtime160.jsx)("p", { className: "text-xs text-muted-foreground", children: (0, import_records64.archivedByLine)(row) }),
|
|
49815
49836
|
refusal3 ? /* @__PURE__ */ (0, import_jsx_runtime160.jsx)(RefusalNotice, { error: refusal3 }) : null,
|
|
49816
49837
|
/* @__PURE__ */ (0, import_jsx_runtime160.jsxs)("div", { className: "flex gap-2", children: [
|
|
49817
49838
|
/* @__PURE__ */ (0, import_jsx_runtime160.jsx)(
|
|
@@ -51266,7 +51287,7 @@ function TablePage2(props) {
|
|
|
51266
51287
|
|
|
51267
51288
|
// src/DataBindingPicker.tsx
|
|
51268
51289
|
var import_react287 = require("react");
|
|
51269
|
-
var
|
|
51290
|
+
var import_records65 = require("@ai-matrx/records");
|
|
51270
51291
|
var import_react288 = require("@ai-matrx/records/react");
|
|
51271
51292
|
var import_design_system146 = require("@ai-matrx/design-system");
|
|
51272
51293
|
var import_jsx_runtime163 = require("react/jsx-runtime");
|
|
@@ -51300,7 +51321,7 @@ function isCompleteDataBinding(binding) {
|
|
|
51300
51321
|
}
|
|
51301
51322
|
function bindingPlaceholdersFor(field2) {
|
|
51302
51323
|
const label = fieldName(field2);
|
|
51303
|
-
if ((0,
|
|
51324
|
+
if ((0, import_records65.isEntityReferenceConfig)(field2.config)) {
|
|
51304
51325
|
return [
|
|
51305
51326
|
{ token: `{${field2.key}.name}`, label: `${label} \xB7 name` },
|
|
51306
51327
|
{ token: `{${field2.key}.id}`, label: `${label} \xB7 id` }
|