@ai-matrx/records-ui 0.115.108 → 0.116.1
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 +28 -1
- package/dist/SaveToTable-3VDK4U5M.js +20 -0
- package/dist/{chunk-W3EU7H4V.js → chunk-42VA6SWA.js} +93 -512
- package/dist/chunk-42VA6SWA.js.map +1 -0
- package/dist/chunk-B5S5F5NH.js +445 -0
- package/dist/chunk-B5S5F5NH.js.map +1 -0
- package/dist/chunk-IUUZVQZD.js +95 -0
- package/dist/chunk-IUUZVQZD.js.map +1 -0
- package/dist/{chunk-6NSGVKYL.js → chunk-NJYJEAQC.js} +1 -91
- package/dist/chunk-NJYJEAQC.js.map +1 -0
- package/dist/{chunk-VGNQBI2J.js → chunk-QRZ4RW2T.js} +56 -31
- package/dist/chunk-QRZ4RW2T.js.map +1 -0
- package/dist/chunk-SPPATZSR.js +288 -0
- package/dist/chunk-SPPATZSR.js.map +1 -0
- package/dist/{chunk-W5SOKJ5P.js → chunk-TNIC2SGW.js} +5 -3
- package/dist/{chunk-W5SOKJ5P.js.map → chunk-TNIC2SGW.js.map} +1 -1
- package/dist/{chunk-4U2JCICC.js → chunk-VCAOXQ5K.js} +2 -283
- package/dist/chunk-VCAOXQ5K.js.map +1 -0
- package/dist/chunk-Z6WTP467.js +245 -0
- package/dist/chunk-Z6WTP467.js.map +1 -0
- package/dist/first-page.cjs.map +1 -1
- package/dist/first-page.js.map +1 -1
- package/dist/helpers.cjs +813 -8
- package/dist/helpers.cjs.map +1 -1
- package/dist/helpers.d.cts +478 -4
- package/dist/helpers.d.ts +478 -4
- package/dist/helpers.js +755 -10
- package/dist/helpers.js.map +1 -1
- package/dist/index.cjs +4610 -3878
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +357 -175
- package/dist/index.d.ts +357 -175
- package/dist/index.js +5891 -5405
- package/dist/index.js.map +1 -1
- package/dist/object-actions.js +3 -2
- package/dist/pickers.cjs +111 -72
- package/dist/pickers.cjs.map +1 -1
- package/dist/pickers.js +6 -3
- package/dist/skeleton.cjs +261 -0
- package/dist/skeleton.cjs.map +1 -0
- package/dist/skeleton.d.cts +50 -0
- package/dist/skeleton.d.ts +50 -0
- package/dist/skeleton.js +26 -0
- package/dist/skeleton.js.map +1 -0
- package/package.json +16 -5
- package/dist/SaveToTable-V3R7QVKV.js +0 -18
- package/dist/chunk-4U2JCICC.js.map +0 -1
- package/dist/chunk-6NSGVKYL.js.map +0 -1
- package/dist/chunk-VGNQBI2J.js.map +0 -1
- package/dist/chunk-W3EU7H4V.js.map +0 -1
- /package/dist/{SaveToTable-V3R7QVKV.js.map → SaveToTable-3VDK4U5M.js.map} +0 -0
|
@@ -1,4 +1,11 @@
|
|
|
1
1
|
"use client";
|
|
2
|
+
import {
|
|
3
|
+
formatForField,
|
|
4
|
+
isYearField,
|
|
5
|
+
isYearValue,
|
|
6
|
+
shownAsOf,
|
|
7
|
+
useEmbeddedLook
|
|
8
|
+
} from "./chunk-B5S5F5NH.js";
|
|
2
9
|
import {
|
|
3
10
|
ABSENCE_WORD_LABEL,
|
|
4
11
|
CONTEXT_POLICY_LABEL,
|
|
@@ -23,20 +30,8 @@ import {
|
|
|
23
30
|
ShowListsToggle,
|
|
24
31
|
UNREAD_RECORD_LABEL,
|
|
25
32
|
WITHHELD_RECORD_LABEL,
|
|
26
|
-
carriesTimeOfDay,
|
|
27
|
-
choiceChipLookOf,
|
|
28
|
-
choiceLooksOf,
|
|
29
|
-
choiceWord,
|
|
30
|
-
dateFormatFor,
|
|
31
|
-
dateText,
|
|
32
|
-
displayFormatOf,
|
|
33
|
-
editorKindFor,
|
|
34
33
|
fieldName,
|
|
35
|
-
isDateField,
|
|
36
|
-
isSignatureField,
|
|
37
34
|
looksLikeId,
|
|
38
|
-
nextChoiceColor,
|
|
39
|
-
pickableTypeOf,
|
|
40
35
|
recordName,
|
|
41
36
|
recordVersions_exports,
|
|
42
37
|
refusalIsMissingInput,
|
|
@@ -44,8 +39,6 @@ import {
|
|
|
44
39
|
refusals_exports,
|
|
45
40
|
rowName,
|
|
46
41
|
rowNameIn,
|
|
47
|
-
storedChoiceColor,
|
|
48
|
-
systemStampOf,
|
|
49
42
|
tableName,
|
|
50
43
|
tablePickerEntries,
|
|
51
44
|
tokenFor,
|
|
@@ -53,7 +46,7 @@ import {
|
|
|
53
46
|
usePickerTables,
|
|
54
47
|
useRecordsUi,
|
|
55
48
|
useTableRights
|
|
56
|
-
} from "./chunk-
|
|
49
|
+
} from "./chunk-VCAOXQ5K.js";
|
|
57
50
|
import {
|
|
58
51
|
kindItemWords,
|
|
59
52
|
kindLabel,
|
|
@@ -61,6 +54,22 @@ import {
|
|
|
61
54
|
kindValueWords,
|
|
62
55
|
shapeOfValue
|
|
63
56
|
} from "./chunk-TIZHA6VK.js";
|
|
57
|
+
import {
|
|
58
|
+
carriesTimeOfDay,
|
|
59
|
+
choiceChipLookOf,
|
|
60
|
+
choiceLooksOf,
|
|
61
|
+
choiceWord,
|
|
62
|
+
dateFormatFor,
|
|
63
|
+
dateText,
|
|
64
|
+
displayFormatOf,
|
|
65
|
+
editorKindFor,
|
|
66
|
+
isDateField,
|
|
67
|
+
isSignatureField,
|
|
68
|
+
nextChoiceColor,
|
|
69
|
+
pickableTypeOf,
|
|
70
|
+
storedChoiceColor,
|
|
71
|
+
systemStampOf
|
|
72
|
+
} from "./chunk-SPPATZSR.js";
|
|
64
73
|
import {
|
|
65
74
|
ADD_FIELD_SAVE_LABEL,
|
|
66
75
|
EDIT_FIELD_SAVE_LABEL,
|
|
@@ -74,7 +83,7 @@ import {
|
|
|
74
83
|
isPlainFieldType,
|
|
75
84
|
isRelationFieldType,
|
|
76
85
|
isSystemFieldKind
|
|
77
|
-
} from "./chunk-
|
|
86
|
+
} from "./chunk-NJYJEAQC.js";
|
|
78
87
|
import {
|
|
79
88
|
__reExport
|
|
80
89
|
} from "./chunk-HKYEHBQT.js";
|
|
@@ -1164,363 +1173,6 @@ function ReferenceBuilder({
|
|
|
1164
1173
|
] });
|
|
1165
1174
|
}
|
|
1166
1175
|
|
|
1167
|
-
// src/presentation.ts
|
|
1168
|
-
import { COLOR_ROTATION, parseTableStyle, tableStyleIsEmpty } from "@ai-matrx/design-system/data-table/table-style";
|
|
1169
|
-
import { getFieldFormat } from "@ai-matrx/design-system/field-formats";
|
|
1170
|
-
import { newerKindOf, ratingMaxOf } from "@ai-matrx/records/field-kinds";
|
|
1171
|
-
function parseGanttLook(raw) {
|
|
1172
|
-
if (!raw || typeof raw !== "object" || Array.isArray(raw)) return void 0;
|
|
1173
|
-
const v = raw;
|
|
1174
|
-
const out = {};
|
|
1175
|
-
if (v["mode"] === true) out.mode = true;
|
|
1176
|
-
if (v["critical"] === true) out.critical = true;
|
|
1177
|
-
for (const k of ["progress", "milestone", "baselineStart", "baselineEnd", "dependency"]) {
|
|
1178
|
-
const x = v[k];
|
|
1179
|
-
if (typeof x === "string" && x !== "") out[k] = x;
|
|
1180
|
-
}
|
|
1181
|
-
return Object.keys(out).length > 0 ? out : void 0;
|
|
1182
|
-
}
|
|
1183
|
-
var DEFAULT_FOOTER = "sticky";
|
|
1184
|
-
function footerOf(p) {
|
|
1185
|
-
return p?.footer ?? DEFAULT_FOOTER;
|
|
1186
|
-
}
|
|
1187
|
-
var EMPTY_PRESENTATION = {};
|
|
1188
|
-
var FROZEN_COLUMN_WIDTH = 200;
|
|
1189
|
-
var MIN_ROW_HEIGHT = 24;
|
|
1190
|
-
var MAX_ROW_HEIGHT = 240;
|
|
1191
|
-
var AGGREGATE_KINDS = [
|
|
1192
|
-
"count",
|
|
1193
|
-
"sum",
|
|
1194
|
-
"average",
|
|
1195
|
-
"min",
|
|
1196
|
-
"max",
|
|
1197
|
-
"empty",
|
|
1198
|
-
"filled",
|
|
1199
|
-
"unique",
|
|
1200
|
-
"checked",
|
|
1201
|
-
"unchecked",
|
|
1202
|
-
"percentFilled"
|
|
1203
|
-
];
|
|
1204
|
-
var GROUP_ORDERS = [
|
|
1205
|
-
"value-asc",
|
|
1206
|
-
"value-desc",
|
|
1207
|
-
"count-desc",
|
|
1208
|
-
"first-seen"
|
|
1209
|
-
];
|
|
1210
|
-
function isRecord(v) {
|
|
1211
|
-
return typeof v === "object" && v !== null && !Array.isArray(v);
|
|
1212
|
-
}
|
|
1213
|
-
function parseGridPresentation(raw) {
|
|
1214
|
-
let value = raw;
|
|
1215
|
-
if (typeof value === "string") {
|
|
1216
|
-
const trimmed = value.trim();
|
|
1217
|
-
if (trimmed === "") return {};
|
|
1218
|
-
try {
|
|
1219
|
-
value = JSON.parse(trimmed);
|
|
1220
|
-
} catch {
|
|
1221
|
-
return {};
|
|
1222
|
-
}
|
|
1223
|
-
}
|
|
1224
|
-
if (!isRecord(value)) return {};
|
|
1225
|
-
const out = {};
|
|
1226
|
-
const style = parseTableStyle(value["style"]);
|
|
1227
|
-
if (!tableStyleIsEmpty(style)) out.style = style;
|
|
1228
|
-
if (isRecord(value["formats"])) {
|
|
1229
|
-
const formats = {};
|
|
1230
|
-
for (const [key, cfg] of Object.entries(value["formats"])) {
|
|
1231
|
-
if (!isRecord(cfg)) continue;
|
|
1232
|
-
const id = cfg["id"];
|
|
1233
|
-
if (typeof id !== "string") continue;
|
|
1234
|
-
const options = cfg["options"];
|
|
1235
|
-
formats[key] = isRecord(options) ? {
|
|
1236
|
-
id,
|
|
1237
|
-
options
|
|
1238
|
-
} : { id };
|
|
1239
|
-
}
|
|
1240
|
-
if (Object.keys(formats).length > 0) out.formats = formats;
|
|
1241
|
-
}
|
|
1242
|
-
if (Array.isArray(value["frozen"])) {
|
|
1243
|
-
const frozen = value["frozen"].filter((k) => typeof k === "string");
|
|
1244
|
-
if (frozen.length > 0) out.frozen = frozen;
|
|
1245
|
-
}
|
|
1246
|
-
const grouping = parseGrouping(value["grouping"]);
|
|
1247
|
-
if (grouping) out.grouping = grouping;
|
|
1248
|
-
if (isRecord(value["widths"])) {
|
|
1249
|
-
const widths = {};
|
|
1250
|
-
for (const [key, raw2] of Object.entries(value["widths"])) {
|
|
1251
|
-
if (typeof raw2 !== "number" || !Number.isFinite(raw2) || raw2 <= 0) continue;
|
|
1252
|
-
widths[key] = Math.round(raw2);
|
|
1253
|
-
}
|
|
1254
|
-
if (Object.keys(widths).length > 0) out.widths = widths;
|
|
1255
|
-
}
|
|
1256
|
-
const rowHeight = value["rowHeight"];
|
|
1257
|
-
if (typeof rowHeight === "number" && Number.isFinite(rowHeight) && rowHeight >= MIN_ROW_HEIGHT && rowHeight <= MAX_ROW_HEIGHT) {
|
|
1258
|
-
out.rowHeight = Math.round(rowHeight);
|
|
1259
|
-
}
|
|
1260
|
-
if (Array.isArray(value["hiddenFields"])) {
|
|
1261
|
-
const hiddenFields = value["hiddenFields"].filter((k) => typeof k === "string");
|
|
1262
|
-
if (hiddenFields.length > 0) out.hiddenFields = hiddenFields;
|
|
1263
|
-
}
|
|
1264
|
-
if (Array.isArray(value["cardHidden"])) {
|
|
1265
|
-
out.cardHidden = value["cardHidden"].filter((k) => typeof k === "string");
|
|
1266
|
-
}
|
|
1267
|
-
if (Array.isArray(value["columnOrder"])) {
|
|
1268
|
-
const columnOrder = value["columnOrder"].filter((k) => typeof k === "string");
|
|
1269
|
-
if (columnOrder.length > 0) out.columnOrder = columnOrder;
|
|
1270
|
-
}
|
|
1271
|
-
const gallerySize = value["gallerySize"];
|
|
1272
|
-
if (gallerySize === "small" || gallerySize === "medium" || gallerySize === "large") {
|
|
1273
|
-
out.gallerySize = gallerySize;
|
|
1274
|
-
}
|
|
1275
|
-
const boardSize = value["boardSize"];
|
|
1276
|
-
if (boardSize === "small" || boardSize === "medium" || boardSize === "large") out.boardSize = boardSize;
|
|
1277
|
-
if (typeof value["boardPreview"] === "string" && value["boardPreview"] !== "") out.boardPreview = value["boardPreview"];
|
|
1278
|
-
if (typeof value["boardHideEmpty"] === "boolean") out.boardHideEmpty = value["boardHideEmpty"];
|
|
1279
|
-
if (typeof value["boardColorColumns"] === "boolean") out.boardColorColumns = value["boardColorColumns"];
|
|
1280
|
-
if (typeof value["boardCounts"] === "boolean") out.boardCounts = value["boardCounts"];
|
|
1281
|
-
if (value["locked"] === true) out.locked = true;
|
|
1282
|
-
if (Array.isArray(value["boardLanesShut"])) {
|
|
1283
|
-
const shut = value["boardLanesShut"].filter((k) => typeof k === "string");
|
|
1284
|
-
if (shut.length > 0) out.boardLanesShut = shut;
|
|
1285
|
-
}
|
|
1286
|
-
if (typeof value["wrap"] === "boolean") out.wrap = value["wrap"];
|
|
1287
|
-
if (typeof value["headerWrap"] === "boolean") out.headerWrap = value["headerWrap"];
|
|
1288
|
-
if (Array.isArray(value["wrapColumns"])) {
|
|
1289
|
-
const wrapColumns = value["wrapColumns"].filter((k) => typeof k === "string");
|
|
1290
|
-
if (wrapColumns.length > 0) out.wrapColumns = wrapColumns;
|
|
1291
|
-
}
|
|
1292
|
-
const fit = value["fit"];
|
|
1293
|
-
if (fit === "auto" || fit === "fit" || fit === "scroll") out.fit = fit;
|
|
1294
|
-
if (typeof value["freezeFirst"] === "boolean") out.freezeFirst = value["freezeFirst"];
|
|
1295
|
-
const footer = value["footer"];
|
|
1296
|
-
if (footer === "sticky" || footer === "inline") out.footer = footer;
|
|
1297
|
-
{
|
|
1298
|
-
const gantt = parseGanttLook(value["gantt"]);
|
|
1299
|
-
if (gantt) out.gantt = gantt;
|
|
1300
|
-
}
|
|
1301
|
-
if (isRecord(value["summaries"])) {
|
|
1302
|
-
const summaries = {};
|
|
1303
|
-
for (const [key, op2] of Object.entries(value["summaries"])) {
|
|
1304
|
-
if (typeof op2 === "string" && op2.trim() !== "") summaries[key] = op2;
|
|
1305
|
-
}
|
|
1306
|
-
if (Object.keys(summaries).length > 0) out.summaries = summaries;
|
|
1307
|
-
}
|
|
1308
|
-
return out;
|
|
1309
|
-
}
|
|
1310
|
-
function parseGrouping(raw) {
|
|
1311
|
-
if (!isRecord(raw)) return void 0;
|
|
1312
|
-
const field2 = raw["field"];
|
|
1313
|
-
if (typeof field2 !== "string" || field2.trim() === "") return void 0;
|
|
1314
|
-
const out = { field: field2 };
|
|
1315
|
-
if (isRecord(raw["aggregates"])) {
|
|
1316
|
-
const aggregates = {};
|
|
1317
|
-
for (const [key, spec] of Object.entries(raw["aggregates"])) {
|
|
1318
|
-
if (!isRecord(spec)) continue;
|
|
1319
|
-
const kind = spec["kind"];
|
|
1320
|
-
if (typeof kind !== "string") continue;
|
|
1321
|
-
if (!AGGREGATE_KINDS.includes(kind)) continue;
|
|
1322
|
-
const label = spec["label"];
|
|
1323
|
-
aggregates[key] = typeof label === "string" ? { kind, label } : { kind };
|
|
1324
|
-
}
|
|
1325
|
-
if (Object.keys(aggregates).length > 0) out.aggregates = aggregates;
|
|
1326
|
-
}
|
|
1327
|
-
const order = raw["order"];
|
|
1328
|
-
if (typeof order === "string" && GROUP_ORDERS.includes(order)) {
|
|
1329
|
-
out.order = order;
|
|
1330
|
-
}
|
|
1331
|
-
if (Array.isArray(raw["collapsed"])) {
|
|
1332
|
-
const collapsed = raw["collapsed"].filter((k) => typeof k === "string");
|
|
1333
|
-
if (collapsed.length > 0) out.collapsed = collapsed;
|
|
1334
|
-
}
|
|
1335
|
-
if (typeof raw["showColumn"] === "boolean") out.showColumn = raw["showColumn"];
|
|
1336
|
-
if (Array.isArray(raw["then"])) {
|
|
1337
|
-
const then = [];
|
|
1338
|
-
for (const level of raw["then"]) {
|
|
1339
|
-
if (!isRecord(level)) continue;
|
|
1340
|
-
const sub = level["field"];
|
|
1341
|
-
if (typeof sub !== "string" || sub.trim() === "") continue;
|
|
1342
|
-
const subOrder = level["order"];
|
|
1343
|
-
const subGrain = level["grain"];
|
|
1344
|
-
then.push({
|
|
1345
|
-
field: sub,
|
|
1346
|
-
...typeof subOrder === "string" && GROUP_ORDERS.includes(subOrder) ? { order: subOrder } : {},
|
|
1347
|
-
...typeof subGrain === "string" && subGrain !== "" ? { grain: subGrain } : {}
|
|
1348
|
-
});
|
|
1349
|
-
}
|
|
1350
|
-
if (then.length > 0) out.then = then.slice(0, 2);
|
|
1351
|
-
}
|
|
1352
|
-
const grain = raw["grain"];
|
|
1353
|
-
if (typeof grain === "string" && grain !== "") out.grain = grain;
|
|
1354
|
-
const across = raw["across"];
|
|
1355
|
-
if (typeof across === "string" && across.trim() !== "") out.across = across;
|
|
1356
|
-
if (Array.isArray(raw["show"])) {
|
|
1357
|
-
const show = raw["show"].filter((k) => typeof k === "string" && k !== "");
|
|
1358
|
-
if (show.length > 0) out.show = show;
|
|
1359
|
-
}
|
|
1360
|
-
if (Array.isArray(raw["trail"])) {
|
|
1361
|
-
const trail = [];
|
|
1362
|
-
for (const step of raw["trail"]) {
|
|
1363
|
-
if (!isRecord(step) || typeof step["dim"] !== "string" || step["dim"] === "") continue;
|
|
1364
|
-
const value = step["value"];
|
|
1365
|
-
if (value !== null && typeof value !== "string") continue;
|
|
1366
|
-
trail.push({ dim: step["dim"], value });
|
|
1367
|
-
}
|
|
1368
|
-
if (trail.length > 0) out.trail = trail;
|
|
1369
|
-
}
|
|
1370
|
-
return out;
|
|
1371
|
-
}
|
|
1372
|
-
function presentationIsEmpty(p) {
|
|
1373
|
-
return (p.style === void 0 || tableStyleIsEmpty(p.style)) && Object.keys(p.formats ?? {}).length === 0 && (p.frozen?.length ?? 0) === 0 && p.grouping === void 0 && Object.keys(p.widths ?? {}).length === 0 && p.rowHeight === void 0 && (p.hiddenFields?.length ?? 0) === 0 && p.cardHidden === void 0 && (p.columnOrder?.length ?? 0) === 0 && p.gallerySize === void 0 && p.boardSize === void 0 && p.boardPreview === void 0 && p.boardHideEmpty === void 0 && p.boardColorColumns === void 0 && p.boardCounts === void 0 && (p.boardLanesShut?.length ?? 0) === 0 && p.locked === void 0 && p.wrap === void 0 && p.headerWrap === void 0 && p.fit === void 0 && p.freezeFirst === void 0 && p.footer === void 0 && Object.keys(p.summaries ?? {}).length === 0 && p.gantt === void 0;
|
|
1374
|
-
}
|
|
1375
|
-
function presentationDocument(p) {
|
|
1376
|
-
return presentationIsEmpty(p) ? "" : JSON.stringify(p);
|
|
1377
|
-
}
|
|
1378
|
-
var DRAWN_KINDS = /* @__PURE__ */ new Set(["select", "multi_select", "relation", "member", "person", "attachment", "file", "entity_reference", "checkbox", "boolean", "signature", "json"]);
|
|
1379
|
-
function shownAsOf(field2) {
|
|
1380
|
-
if (DRAWN_KINDS.has(String(editorKindFor(field2)))) return void 0;
|
|
1381
|
-
const raw = field2.display_format;
|
|
1382
|
-
if (!raw || typeof raw !== "object") return void 0;
|
|
1383
|
-
const id = raw.id;
|
|
1384
|
-
if (typeof id !== "string" || id === "formula" || !getFieldFormat(id)) return void 0;
|
|
1385
|
-
const options = raw.options;
|
|
1386
|
-
return options && typeof options === "object" && Object.keys(options).length > 0 ? { id, options } : { id };
|
|
1387
|
-
}
|
|
1388
|
-
var YEAR_NAMES = /(^|[\s_-])(year|founded|established|incorporated|vintage)([\s_-]|$)/i;
|
|
1389
|
-
function isYearField(field2) {
|
|
1390
|
-
return YEAR_NAMES.test(String(field2.label ?? "")) || YEAR_NAMES.test(field2.key);
|
|
1391
|
-
}
|
|
1392
|
-
function isYearValue(value) {
|
|
1393
|
-
return typeof value === "number" && Number.isInteger(value) && value >= 1e3 && value <= 2999;
|
|
1394
|
-
}
|
|
1395
|
-
function ungroupedForYears(field2, format) {
|
|
1396
|
-
if (format.id !== "number" || !isYearField(field2)) return format;
|
|
1397
|
-
const options = format.options ?? {};
|
|
1398
|
-
if (options["useGrouping"] !== void 0) return format;
|
|
1399
|
-
return { ...format, options: { ...options, useGrouping: false } };
|
|
1400
|
-
}
|
|
1401
|
-
function formatForField(field2) {
|
|
1402
|
-
const shownAs = shownAsOf(field2);
|
|
1403
|
-
if (newerKindOf(field2) === "rating" && (!shownAs || shownAs.id === "rating")) {
|
|
1404
|
-
return { id: "rating", options: { ...shownAs?.options ?? {}, ratingMax: ratingMaxOf(field2) } };
|
|
1405
|
-
}
|
|
1406
|
-
if (shownAs) return ungroupedForYears(field2, shownAs);
|
|
1407
|
-
const stamp = dateFormatFor(field2);
|
|
1408
|
-
if (stamp && editorKindFor(field2) !== "datetime") return stamp;
|
|
1409
|
-
switch (editorKindFor(field2)) {
|
|
1410
|
-
case "currency":
|
|
1411
|
-
return {
|
|
1412
|
-
id: "currency",
|
|
1413
|
-
options: { currency: currencyCodeFor(field2.unit) }
|
|
1414
|
-
};
|
|
1415
|
-
case "percent":
|
|
1416
|
-
return { id: "percent" };
|
|
1417
|
-
case "datetime":
|
|
1418
|
-
return String(field2.config?.["kind"] ?? "") === "date" ? { id: "date" } : { id: "datetime" };
|
|
1419
|
-
case "email":
|
|
1420
|
-
return { id: "email" };
|
|
1421
|
-
case "url":
|
|
1422
|
-
return { id: "url" };
|
|
1423
|
-
case "phone":
|
|
1424
|
-
return { id: "phone" };
|
|
1425
|
-
case "number":
|
|
1426
|
-
return ungroupedForYears(field2, { id: "number" });
|
|
1427
|
-
default:
|
|
1428
|
-
return void 0;
|
|
1429
|
-
}
|
|
1430
|
-
}
|
|
1431
|
-
function cellFormatFor(field2, viewFormat) {
|
|
1432
|
-
return viewFormat ?? formatForField(field2);
|
|
1433
|
-
}
|
|
1434
|
-
var SYMBOL_TO_CODE = {
|
|
1435
|
-
$: "USD",
|
|
1436
|
-
"\xA3": "GBP",
|
|
1437
|
-
"\u20AC": "EUR",
|
|
1438
|
-
"\xA5": "JPY",
|
|
1439
|
-
"\u20B9": "INR",
|
|
1440
|
-
"\u20BD": "RUB",
|
|
1441
|
-
"\u20A9": "KRW",
|
|
1442
|
-
"R$": "BRL",
|
|
1443
|
-
"C$": "CAD",
|
|
1444
|
-
"A$": "AUD"
|
|
1445
|
-
};
|
|
1446
|
-
function currencyCodeFor(unit) {
|
|
1447
|
-
const raw = (unit ?? "").trim();
|
|
1448
|
-
if (raw === "") return "USD";
|
|
1449
|
-
return SYMBOL_TO_CODE[raw] ?? raw.toUpperCase();
|
|
1450
|
-
}
|
|
1451
|
-
var colorFromTheValue = (_fieldKey, value) => {
|
|
1452
|
-
if (value === true) return "green";
|
|
1453
|
-
if (value === false || value === null || value === void 0) return void 0;
|
|
1454
|
-
const text = String(value).trim().toLowerCase();
|
|
1455
|
-
if (text === "") return void 0;
|
|
1456
|
-
let hash = 0;
|
|
1457
|
-
for (let i = 0; i < text.length; i += 1) {
|
|
1458
|
-
hash = hash * 31 + text.charCodeAt(i) >>> 0;
|
|
1459
|
-
}
|
|
1460
|
-
return COLOR_ROTATION[hash % COLOR_ROTATION.length];
|
|
1461
|
-
};
|
|
1462
|
-
function styleFromDecorations(decorations, fields) {
|
|
1463
|
-
if (!decorations) return { version: 1 };
|
|
1464
|
-
const keyOf = (id) => fields.find((f) => f.id === id)?.key;
|
|
1465
|
-
const style = { version: 1 };
|
|
1466
|
-
if (decorations.color_by?.field) {
|
|
1467
|
-
const field2 = keyOf(decorations.color_by.field);
|
|
1468
|
-
if (field2) style.colorBy = { field: field2, target: decorations.color_by.target };
|
|
1469
|
-
}
|
|
1470
|
-
if (Array.isArray(decorations.rules) && decorations.rules.length > 0) {
|
|
1471
|
-
const rules = [];
|
|
1472
|
-
decorations.rules.forEach((rule, index) => {
|
|
1473
|
-
const field2 = keyOf(rule.field);
|
|
1474
|
-
if (!field2) return;
|
|
1475
|
-
rules.push({
|
|
1476
|
-
id: rule.id ?? `decoration:${index}`,
|
|
1477
|
-
field: field2,
|
|
1478
|
-
op: rule.op,
|
|
1479
|
-
color: rule.color,
|
|
1480
|
-
target: rule.target,
|
|
1481
|
-
...rule.value === void 0 || rule.value === null ? {} : { value: String(rule.value) }
|
|
1482
|
-
});
|
|
1483
|
-
});
|
|
1484
|
-
if (rules.length > 0) style.rules = rules;
|
|
1485
|
-
}
|
|
1486
|
-
if (decorations.rows && Object.keys(decorations.rows).length > 0) {
|
|
1487
|
-
style.rows = { ...decorations.rows };
|
|
1488
|
-
}
|
|
1489
|
-
const columns = {};
|
|
1490
|
-
for (const [id, color] of Object.entries(decorations.columns ?? {})) {
|
|
1491
|
-
const key = keyOf(id);
|
|
1492
|
-
if (key) columns[key] = color;
|
|
1493
|
-
}
|
|
1494
|
-
if (Object.keys(columns).length > 0) style.columns = columns;
|
|
1495
|
-
const cells = {};
|
|
1496
|
-
for (const [rowId, byField] of Object.entries(decorations.cells ?? {})) {
|
|
1497
|
-
for (const [id, color] of Object.entries(byField ?? {})) {
|
|
1498
|
-
const key = keyOf(id);
|
|
1499
|
-
if (!key) continue;
|
|
1500
|
-
(cells[rowId] ??= {})[key] = color;
|
|
1501
|
-
}
|
|
1502
|
-
}
|
|
1503
|
-
if (Object.keys(cells).length > 0) style.cells = cells;
|
|
1504
|
-
return style;
|
|
1505
|
-
}
|
|
1506
|
-
function resolveTableStyle(decorations, fields, viewStyle) {
|
|
1507
|
-
const base2 = styleFromDecorations(decorations, fields);
|
|
1508
|
-
if (!viewStyle) return base2;
|
|
1509
|
-
const colorBy = viewStyle.colorBy ?? base2.colorBy;
|
|
1510
|
-
const rules = viewStyle.rules ?? base2.rules;
|
|
1511
|
-
const rows = viewStyle.rows ?? base2.rows;
|
|
1512
|
-
const columns = viewStyle.columns ?? base2.columns;
|
|
1513
|
-
const cells = viewStyle.cells ?? base2.cells;
|
|
1514
|
-
return {
|
|
1515
|
-
version: 1,
|
|
1516
|
-
...colorBy !== void 0 ? { colorBy } : {},
|
|
1517
|
-
...rules !== void 0 ? { rules } : {},
|
|
1518
|
-
...rows !== void 0 ? { rows } : {},
|
|
1519
|
-
...columns !== void 0 ? { columns } : {},
|
|
1520
|
-
...cells !== void 0 ? { cells } : {}
|
|
1521
|
-
};
|
|
1522
|
-
}
|
|
1523
|
-
|
|
1524
1176
|
// src/ChoiceListEditor.tsx
|
|
1525
1177
|
import { useEffect as useEffect20, useRef as useRef17, useState as useState29 } from "react";
|
|
1526
1178
|
import { optionLabel as optionLabel2, recordsUseSentence, rehomeSentence } from "@ai-matrx/records";
|
|
@@ -1581,7 +1233,7 @@ function AddChoicesInline({ field: field2, onAdded, disabled = false }) {
|
|
|
1581
1233
|
|
|
1582
1234
|
// src/editors.tsx
|
|
1583
1235
|
import { useCallback as useCallback6, useEffect as useEffect19, useLayoutEffect as useLayoutEffect3, useRef as useRef16, useState as useState28 } from "react";
|
|
1584
|
-
import { isButtonField as isButtonField2, allowsOtherValues, choiceValuesOf, coerceTypedAnswer, newerKindOf as
|
|
1236
|
+
import { isButtonField as isButtonField2, allowsOtherValues, choiceValuesOf, coerceTypedAnswer, newerKindOf as newerKindOf2, decideTypedChoice, isTheChosen, optionKey as optionKey4, rankTypedMatches as rankTypedMatches4, readTypedTime as readTypedTime2, typedDateText as typedDateText2, typedTimeText as typedTimeText2 } from "@ai-matrx/records";
|
|
1585
1237
|
import { useOptionalRecordsClient as useOptionalRecordsClient11 } from "@ai-matrx/records/react";
|
|
1586
1238
|
import {
|
|
1587
1239
|
BasicInput as BasicInput9,
|
|
@@ -1613,7 +1265,7 @@ import {
|
|
|
1613
1265
|
durationText,
|
|
1614
1266
|
isAddressValue,
|
|
1615
1267
|
isPersonStamp,
|
|
1616
|
-
newerKindOf
|
|
1268
|
+
newerKindOf,
|
|
1617
1269
|
personStampText,
|
|
1618
1270
|
readTypedDuration,
|
|
1619
1271
|
safeLinkHref,
|
|
@@ -1624,7 +1276,7 @@ import { OutboundLink } from "@ai-matrx/kit/outbound-react";
|
|
|
1624
1276
|
import { Fragment as Fragment3, jsx as jsx6, jsxs as jsxs5 } from "react/jsx-runtime";
|
|
1625
1277
|
var own = (event) => event.stopPropagation();
|
|
1626
1278
|
function newerKindValue(field2, value, opts = {}) {
|
|
1627
|
-
switch (
|
|
1279
|
+
switch (newerKindOf(field2)) {
|
|
1628
1280
|
case "duration": {
|
|
1629
1281
|
const words = durationText(value);
|
|
1630
1282
|
return words === null ? void 0 : /* @__PURE__ */ jsx6("span", { className: "tabular-nums", "data-records-duration": "", children: words });
|
|
@@ -1685,7 +1337,7 @@ function AddressLink({ value }) {
|
|
|
1685
1337
|
}
|
|
1686
1338
|
var STATUS_GROUP_MARK = { todo: "\u25CB", in_progress: "\u25D0", done: "\u25CF" };
|
|
1687
1339
|
function statusMarkOf(field2, value, document2) {
|
|
1688
|
-
if (
|
|
1340
|
+
if (newerKindOf(field2) !== "status" || typeof value !== "string") return null;
|
|
1689
1341
|
const chosen = document2?.["_choices"]?.[field2.key];
|
|
1690
1342
|
const key = chosen && typeof chosen === "object" && typeof chosen.key === "string" ? chosen.key : value;
|
|
1691
1343
|
const group = statusGroupOf(field2, key);
|
|
@@ -1782,7 +1434,7 @@ function SafeMarkdown({ text, clipped }) {
|
|
|
1782
1434
|
);
|
|
1783
1435
|
}
|
|
1784
1436
|
function newerKindControl(props) {
|
|
1785
|
-
switch (
|
|
1437
|
+
switch (newerKindOf(props.field)) {
|
|
1786
1438
|
case "duration":
|
|
1787
1439
|
return /* @__PURE__ */ jsx6(DurationControl, { ...props });
|
|
1788
1440
|
case "address":
|
|
@@ -2327,7 +1979,6 @@ var NOT_TYPED_BY_NAME = /* @__PURE__ */ new Set([
|
|
|
2327
1979
|
"fx.sub",
|
|
2328
1980
|
"fx.mul",
|
|
2329
1981
|
"fx.div",
|
|
2330
|
-
"fx.mod",
|
|
2331
1982
|
"fx.neg",
|
|
2332
1983
|
"fx.eq",
|
|
2333
1984
|
"fx.ne",
|
|
@@ -2653,59 +2304,6 @@ function WithheldValue({ field: field2, notice }) {
|
|
|
2653
2304
|
// src/values.tsx
|
|
2654
2305
|
import { Badge as Badge6, cn as cn14 } from "@ai-matrx/design-system";
|
|
2655
2306
|
|
|
2656
|
-
// src/embeddedLook.tsx
|
|
2657
|
-
import { createContext as createContext2, useContext as useContext2 } from "react";
|
|
2658
|
-
|
|
2659
|
-
// src/firstPage.ts
|
|
2660
|
-
import { bindFirstPageCodec } from "@ai-matrx/records/first-page";
|
|
2661
|
-
|
|
2662
|
-
// src/viewKeys.ts
|
|
2663
|
-
import * as base from "@ai-matrx/records/views";
|
|
2664
|
-
import {
|
|
2665
|
-
STORE_KEEPS_TIMELINE,
|
|
2666
|
-
STORE_KEPT_LAYOUTS,
|
|
2667
|
-
VIEW_KEYS,
|
|
2668
|
-
storeKeepsLayout,
|
|
2669
|
-
viewKeysFor,
|
|
2670
|
-
viewSettingsFor
|
|
2671
|
-
} from "@ai-matrx/records/views";
|
|
2672
|
-
var gridPresentationCodec = {
|
|
2673
|
-
parse: parseGridPresentation,
|
|
2674
|
-
isEmpty: presentationIsEmpty,
|
|
2675
|
-
toDocument: (presentation) => JSON.parse(presentationDocument(presentation))
|
|
2676
|
-
};
|
|
2677
|
-
var boundViews = base.bindViewCodec(gridPresentationCodec);
|
|
2678
|
-
var { viewSettings, viewSettingsPatch } = boundViews;
|
|
2679
|
-
|
|
2680
|
-
// src/firstPage.ts
|
|
2681
|
-
import {
|
|
2682
|
-
EMBEDDED_PAGE_SIZE,
|
|
2683
|
-
TABLE_PAGE_SIZE,
|
|
2684
|
-
firstGridPageArgs,
|
|
2685
|
-
serverRowsOf,
|
|
2686
|
-
viewFilterOf
|
|
2687
|
-
} from "@ai-matrx/records/first-page";
|
|
2688
|
-
var { firstGridPageRequest, askTablePageSeed } = bindFirstPageCodec(gridPresentationCodec);
|
|
2689
|
-
|
|
2690
|
-
// src/embeddedLook.tsx
|
|
2691
|
-
var EMBEDDED_LOOK = { blankEmpty: true, choiceDot: true, plainRelation: true };
|
|
2692
|
-
var EmbeddedLookContext = createContext2(null);
|
|
2693
|
-
var EmbeddedLookProvider = EmbeddedLookContext.Provider;
|
|
2694
|
-
function useEmbeddedLook() {
|
|
2695
|
-
return useContext2(EmbeddedLookContext);
|
|
2696
|
-
}
|
|
2697
|
-
var EMBEDDED_TABLE_CLASS = [
|
|
2698
|
-
"[&_tbody_td]:h-10",
|
|
2699
|
-
"[&_tbody_td]:align-middle!",
|
|
2700
|
-
"[&_tbody_td]:border-r",
|
|
2701
|
-
"[&_tbody_td]:border-border",
|
|
2702
|
-
"[&_tbody_td:last-child]:border-r-0",
|
|
2703
|
-
"[&_thead_th]:border-r",
|
|
2704
|
-
"[&_thead_th]:border-border",
|
|
2705
|
-
"[&_thead_th:last-child]:border-r-0"
|
|
2706
|
-
].join(" ");
|
|
2707
|
-
var EMBEDDED_PLAIN_FOOTER_CLASS = "[&_tfoot]:bg-transparent [&_tfoot]:border-t-0";
|
|
2708
|
-
|
|
2709
2307
|
// src/EntityReferenceControl.tsx
|
|
2710
2308
|
import { useMemo as useMemo7, useState as useState10 } from "react";
|
|
2711
2309
|
import { entityRefsOf, entityRefsToWrite } from "@ai-matrx/records";
|
|
@@ -2973,7 +2571,7 @@ import { formatPhone as formatPhone2 } from "@ai-matrx/design-system/field-forma
|
|
|
2973
2571
|
// src/formattedValue.tsx
|
|
2974
2572
|
import { useRef as useRef7 } from "react";
|
|
2975
2573
|
import { FormattedCell } from "@ai-matrx/design-system/data-table";
|
|
2976
|
-
import { formatFieldValue, formatPhone, getFieldFormat
|
|
2574
|
+
import { formatFieldValue, formatPhone, getFieldFormat } from "@ai-matrx/design-system/field-formats";
|
|
2977
2575
|
import { cn as cn9 } from "@ai-matrx/design-system";
|
|
2978
2576
|
import { OutboundLink as OutboundLink3 } from "@ai-matrx/kit/outbound-react";
|
|
2979
2577
|
import { jsx as jsx13, jsxs as jsxs11 } from "react/jsx-runtime";
|
|
@@ -3102,7 +2700,7 @@ function FormattedValue({
|
|
|
3102
2700
|
onRate,
|
|
3103
2701
|
selectFirst
|
|
3104
2702
|
}) {
|
|
3105
|
-
const def =
|
|
2703
|
+
const def = getFieldFormat(format.id);
|
|
3106
2704
|
const score = numberOf(value);
|
|
3107
2705
|
const max = format.options?.ratingMax ?? 5;
|
|
3108
2706
|
if (def?.id === "rating" && onRate && (value === null || value === void 0 || value === "" || score !== null && score >= 0 && score <= max)) {
|
|
@@ -4166,7 +3764,7 @@ import { AlchemyMenu } from "@ai-matrx/alchemy/react";
|
|
|
4166
3764
|
import { OutboundLink as OutboundLink5 } from "@ai-matrx/kit/outbound-react";
|
|
4167
3765
|
import { humanizeIdentifier } from "@ai-matrx/kit/text-case";
|
|
4168
3766
|
import { jsx as jsx20, jsxs as jsxs17 } from "react/jsx-runtime";
|
|
4169
|
-
var SaveToTable = lazy(() => import("./SaveToTable-
|
|
3767
|
+
var SaveToTable = lazy(() => import("./SaveToTable-3VDK4U5M.js").then((m) => ({ default: m.SaveToTable })));
|
|
4170
3768
|
var LONGEST_READ = 5e5;
|
|
4171
3769
|
var FENCE = /^```(?:json)?[ \t]*\r?\n([\s\S]*?)\r?\n?```$/;
|
|
4172
3770
|
function isPlainObject(v) {
|
|
@@ -4900,7 +4498,7 @@ function SourceArchivedNotice({ fieldId, tableId }) {
|
|
|
4900
4498
|
}
|
|
4901
4499
|
|
|
4902
4500
|
// src/Condition.tsx
|
|
4903
|
-
import { createContext as
|
|
4501
|
+
import { createContext as createContext2, useContext as useContext2, useEffect as useEffect12, useState as useState19 } from "react";
|
|
4904
4502
|
import { BasicInput as BasicInput5, Button as Button11 } from "@ai-matrx/design-system";
|
|
4905
4503
|
import { optionKey as optionKey2, optionLabel, rankTypedMatches as rankTypedMatches3 } from "@ai-matrx/records";
|
|
4906
4504
|
import { useOptionalRecordsClient as useOptionalRecordsClient8 } from "@ai-matrx/records/react";
|
|
@@ -4941,7 +4539,7 @@ function linkedOf(expr) {
|
|
|
4941
4539
|
if (match !== "any" && match !== "none") return null;
|
|
4942
4540
|
return { via: rel["field"], inner: a["field"], op: match === "any" ? "eq" : "ne", value: b["const"] };
|
|
4943
4541
|
}
|
|
4944
|
-
var FilterTermsContext =
|
|
4542
|
+
var FilterTermsContext = createContext2(false);
|
|
4945
4543
|
var RELATIVE_DAY_TERMS = [
|
|
4946
4544
|
{ kind: "today", label: "is today" },
|
|
4947
4545
|
{ kind: "tomorrow", label: "is tomorrow" },
|
|
@@ -5141,7 +4739,7 @@ function conditionValue(typed) {
|
|
|
5141
4739
|
}
|
|
5142
4740
|
function ConditionRow({ lead, expr, fields, onChange, emptyLabel = "always", className }) {
|
|
5143
4741
|
const node = expr ?? null;
|
|
5144
|
-
const filterTerms =
|
|
4742
|
+
const filterTerms = useContext2(FilterTermsContext);
|
|
5145
4743
|
const relative = relativeDayOf(expr);
|
|
5146
4744
|
const reader = meOf(expr);
|
|
5147
4745
|
const linked = linkedOf(expr);
|
|
@@ -5887,9 +5485,9 @@ function choiceDisplayPatch(field2, rows) {
|
|
|
5887
5485
|
}
|
|
5888
5486
|
function lookFollowsRenames(field2, look, renames) {
|
|
5889
5487
|
if (renames.size === 0) return look;
|
|
5890
|
-
const
|
|
5891
|
-
const choices =
|
|
5892
|
-
if (!
|
|
5488
|
+
const base = look ?? displayFormatOf(field2);
|
|
5489
|
+
const choices = base && Array.isArray(base.options["choices"]) ? base.options["choices"] : null;
|
|
5490
|
+
if (!base || !choices) return look;
|
|
5893
5491
|
let moved = false;
|
|
5894
5492
|
const next = choices.map((c) => {
|
|
5895
5493
|
const was = typeof c["value"] === "string" ? c["value"] : null;
|
|
@@ -5899,11 +5497,11 @@ function lookFollowsRenames(field2, look, renames) {
|
|
|
5899
5497
|
return { ...c, value: now };
|
|
5900
5498
|
});
|
|
5901
5499
|
if (!moved) return look;
|
|
5902
|
-
return { id:
|
|
5500
|
+
return { id: base.id, options: { ...base.options, choices: next } };
|
|
5903
5501
|
}
|
|
5904
5502
|
function choiceLookFromList(field2, start, rows) {
|
|
5905
|
-
const
|
|
5906
|
-
const colorRows =
|
|
5503
|
+
const base = startingChoiceColors(field2, start.map((r) => r.words.trim()).filter((w) => w !== ""));
|
|
5504
|
+
const colorRows = base.map((row) => {
|
|
5907
5505
|
const was = start.find((r) => choiceWord(r.words) === choiceWord(row.value));
|
|
5908
5506
|
const now = was?.id ? rows.find((r) => r.id === was.id) : void 0;
|
|
5909
5507
|
return now ? { value: row.value, color: now.color ?? null } : row;
|
|
@@ -6019,7 +5617,7 @@ function BarcodeSymbologyQuestion({ value, onChange }) {
|
|
|
6019
5617
|
import { Label as Label5 } from "@ai-matrx/design-system";
|
|
6020
5618
|
import {
|
|
6021
5619
|
FIELD_FORMAT_LIST,
|
|
6022
|
-
getFieldFormat as
|
|
5620
|
+
getFieldFormat as getFieldFormat2,
|
|
6023
5621
|
groupedFormatsForBase
|
|
6024
5622
|
} from "@ai-matrx/design-system/field-formats";
|
|
6025
5623
|
import { jsx as jsx27, jsxs as jsxs24 } from "react/jsx-runtime";
|
|
@@ -6080,9 +5678,9 @@ function storageOf(field2) {
|
|
|
6080
5678
|
}
|
|
6081
5679
|
}
|
|
6082
5680
|
function formatMenu(field2) {
|
|
6083
|
-
const
|
|
6084
|
-
if (
|
|
6085
|
-
if (
|
|
5681
|
+
const base = storageOf(field2);
|
|
5682
|
+
if (base === null) return { groups: [], otherKinds: [] };
|
|
5683
|
+
if (base === "formula") {
|
|
6086
5684
|
const groups2 = [];
|
|
6087
5685
|
for (const def of FIELD_FORMAT_LIST) {
|
|
6088
5686
|
if (neverALook(def) || KIND_WORD[def.id] || def.id === "boolean") continue;
|
|
@@ -6092,7 +5690,7 @@ function formatMenu(field2) {
|
|
|
6092
5690
|
}
|
|
6093
5691
|
return { groups: groups2, otherKinds: [] };
|
|
6094
5692
|
}
|
|
6095
|
-
const groups = groupedFormatsForBase(
|
|
5693
|
+
const groups = groupedFormatsForBase(base).map((g) => ({ group: g.group, formats: g.formats.filter((d) => !neverALook(d) && !KIND_WORD[d.id]) })).filter((g) => g.formats.length > 0);
|
|
6096
5694
|
const own3 = new Set(groups.flatMap((g) => g.formats.map((d) => d.id)));
|
|
6097
5695
|
const otherKinds = [];
|
|
6098
5696
|
for (const def of FIELD_FORMAT_LIST) {
|
|
@@ -6104,7 +5702,7 @@ function formatMenu(field2) {
|
|
|
6104
5702
|
}
|
|
6105
5703
|
function startingChoice(field2) {
|
|
6106
5704
|
const held = displayFormatOf(field2);
|
|
6107
|
-
if (!held || !
|
|
5705
|
+
if (!held || !getFieldFormat2(held.id) || held.id === "formula") return { format: null, retype: null };
|
|
6108
5706
|
return {
|
|
6109
5707
|
format: Object.keys(held.options).length > 0 ? { id: held.id, options: held.options } : { id: held.id },
|
|
6110
5708
|
retype: null
|
|
@@ -6134,7 +5732,7 @@ function FieldFormatPicker({
|
|
|
6134
5732
|
}) {
|
|
6135
5733
|
const { groups, otherKinds } = formatMenu(field2);
|
|
6136
5734
|
if (groups.length === 0 && otherKinds.length === 0) return null;
|
|
6137
|
-
const active = value.format ?
|
|
5735
|
+
const active = value.format ? getFieldFormat2(value.format.id) : null;
|
|
6138
5736
|
const options = value.format?.options ?? {};
|
|
6139
5737
|
const optionKeys = active?.optionKeys ?? [];
|
|
6140
5738
|
const retypedTo = value.retype ? otherKinds.find((k) => k.def.id === value.format?.id) : void 0;
|
|
@@ -6457,12 +6055,12 @@ function dayWindow(day, holdsDays) {
|
|
|
6457
6055
|
const ymd = (t) => `${t.getUTCFullYear()}-${String(t.getUTCMonth() + 1).padStart(2, "0")}-${String(t.getUTCDate()).padStart(2, "0")}`;
|
|
6458
6056
|
return { from: ymd(new Date(Date.UTC(y, (m ?? 1) - 1, d ?? 1))), to: ymd(new Date(Date.UTC(y, (m ?? 1) - 1, (d ?? 1) + 1))) };
|
|
6459
6057
|
}
|
|
6460
|
-
function storeQuestion(fields,
|
|
6058
|
+
function storeQuestion(fields, base, columnFilters, now = /* @__PURE__ */ new Date()) {
|
|
6461
6059
|
const refused = [];
|
|
6462
6060
|
const flat = {};
|
|
6463
6061
|
const rules = [];
|
|
6464
|
-
if (
|
|
6465
|
-
else if (
|
|
6062
|
+
if (base && isRuleFilter(base)) rules.push(base);
|
|
6063
|
+
else if (base) Object.assign(flat, base);
|
|
6466
6064
|
for (const [key, value] of Object.entries(columnFilters)) {
|
|
6467
6065
|
if (!value) continue;
|
|
6468
6066
|
const f = fields.find((candidate) => candidate.key === key);
|
|
@@ -6562,10 +6160,10 @@ function exportFullSchema(table, fields, rows, ids) {
|
|
|
6562
6160
|
function uniqueNames(fields) {
|
|
6563
6161
|
const seen = /* @__PURE__ */ new Map();
|
|
6564
6162
|
return fields.map((f) => {
|
|
6565
|
-
const
|
|
6566
|
-
const n = (seen.get(
|
|
6567
|
-
seen.set(
|
|
6568
|
-
return n === 1 ?
|
|
6163
|
+
const base = fieldName(f);
|
|
6164
|
+
const n = (seen.get(base) ?? 0) + 1;
|
|
6165
|
+
seen.set(base, n);
|
|
6166
|
+
return n === 1 ? base : `${base} (${n})`;
|
|
6569
6167
|
});
|
|
6570
6168
|
}
|
|
6571
6169
|
function settingsOfTable(table) {
|
|
@@ -7391,7 +6989,25 @@ function NewRowAction({
|
|
|
7391
6989
|
}
|
|
7392
6990
|
|
|
7393
6991
|
// src/FieldEditor.tsx
|
|
7394
|
-
import { FIELD_SENSITIVITIES, CONTEXT_POLICIES,
|
|
6992
|
+
import { FIELD_SENSITIVITIES, CONTEXT_POLICIES, optionKey as optionKey3, ratingMaxOf, rulesWithTopStar } from "@ai-matrx/records";
|
|
6993
|
+
|
|
6994
|
+
// src/standardFieldChoices.ts
|
|
6995
|
+
import { DECLARABLE_FIELD_KINDS } from "@ai-matrx/records";
|
|
6996
|
+
var STORE_BEHAVIOUR = new Map(DECLARABLE_FIELD_KINDS.map((row) => [row.kind, row.behavior]));
|
|
6997
|
+
function holdsAValueOnAStandardTable(kind) {
|
|
6998
|
+
if (isSystemFieldKind(kind)) return false;
|
|
6999
|
+
const behaviour = STORE_BEHAVIOUR.get(kind);
|
|
7000
|
+
return behaviour !== void 0 && behaviour !== "formula";
|
|
7001
|
+
}
|
|
7002
|
+
var STANDARD_TABLE_FIELD_CHOICES = FIELD_TYPE_CHOICES.filter(
|
|
7003
|
+
(c) => holdsAValueOnAStandardTable(c.id)
|
|
7004
|
+
);
|
|
7005
|
+
var ADDABLE_TYPES = STANDARD_TABLE_FIELD_CHOICES.map((choice) => ({
|
|
7006
|
+
value: choice.id,
|
|
7007
|
+
label: choice.label
|
|
7008
|
+
}));
|
|
7009
|
+
|
|
7010
|
+
// src/FieldEditor.tsx
|
|
7395
7011
|
import { Fragment as Fragment10, jsx as jsx30, jsxs as jsxs27 } from "react/jsx-runtime";
|
|
7396
7012
|
var RULE_KINDS = FIELD_RULE_KIND_VALUES.map((kind) => ({ kind, label: FIELD_RULE_KIND_LABEL[kind] }));
|
|
7397
7013
|
var SENSITIVITIES = FIELD_SENSITIVITIES.map((value) => ({ value, label: FIELD_SENSITIVITY_LABEL[value] }));
|
|
@@ -7408,15 +7024,6 @@ var FORMULA_OPERATIONS = FORMULA_OP_VALUES.map((value) => ({
|
|
|
7408
7024
|
label: FORMULA_OP_LABEL[value],
|
|
7409
7025
|
joins: FORMULA_OP_JOINS[value]
|
|
7410
7026
|
}));
|
|
7411
|
-
var STORE_BEHAVIOUR = new Map(DECLARABLE_FIELD_KINDS.map((row) => [row.kind, row.behavior]));
|
|
7412
|
-
function holdsAValueOnAStandardTable(kind) {
|
|
7413
|
-
if (isSystemFieldKind(kind)) return false;
|
|
7414
|
-
const behaviour = STORE_BEHAVIOUR.get(kind);
|
|
7415
|
-
return behaviour !== void 0 && behaviour !== "formula";
|
|
7416
|
-
}
|
|
7417
|
-
var STANDARD_TABLE_FIELD_CHOICES = FIELD_TYPE_CHOICES.filter(
|
|
7418
|
-
(c) => holdsAValueOnAStandardTable(c.id)
|
|
7419
|
-
);
|
|
7420
7027
|
var ADD_STANDARD_FIELD_SAVE_LABEL = "Create field";
|
|
7421
7028
|
var KINDS_WITH_A_DEFAULT = /* @__PURE__ */ new Set([
|
|
7422
7029
|
"text",
|
|
@@ -7519,9 +7126,9 @@ function FieldEditor(props) {
|
|
|
7519
7126
|
const [contextPolicy, setContextPolicy] = useState23(String(start?.context_policy ?? "include"));
|
|
7520
7127
|
const [rules, setRules] = useState23(start?.rules ?? []);
|
|
7521
7128
|
const [startsWith, setStartsWith] = useState23(start?.default ?? null);
|
|
7522
|
-
const [ratingMax, setRatingMax] = useState23(() => start ?
|
|
7129
|
+
const [ratingMax, setRatingMax] = useState23(() => start ? ratingMaxOf(start) : 5);
|
|
7523
7130
|
const savedRules = useMemo10(
|
|
7524
|
-
() => field2 ? type === "rating" ? rulesWithTopStar(field2.rules ?? [],
|
|
7131
|
+
() => field2 ? type === "rating" ? rulesWithTopStar(field2.rules ?? [], ratingMaxOf(field2)) : field2.rules ?? [] : [],
|
|
7525
7132
|
[field2, type]
|
|
7526
7133
|
);
|
|
7527
7134
|
const editedRules = useMemo10(() => type === "rating" ? rulesWithTopStar(rules, ratingMax) : rules, [type, rules, ratingMax]);
|
|
@@ -7705,7 +7312,7 @@ function FieldEditor(props) {
|
|
|
7705
7312
|
...statusGroupsChanged ? { status_groups: statusGroupsSent } : {},
|
|
7706
7313
|
// V11 #4/#10: a rating's top star goes as `max`, the word custom.field_update now takes the way
|
|
7707
7314
|
// custom.field_declare does; the store writes the max Rule and sets aside any score above it.
|
|
7708
|
-
...type === "rating" && ratingMax !==
|
|
7315
|
+
...type === "rating" && ratingMax !== ratingMaxOf(field2) ? { max: ratingMax } : {},
|
|
7709
7316
|
...type === "barcode" && symbology !== String(field2.config?.["symbology"] ?? "") ? { symbology: symbology === "" ? null : symbology } : {},
|
|
7710
7317
|
...type === "button" && JSON.stringify(buttonSettings) !== JSON.stringify(buttonStart) ? { button: buttonSettings } : {},
|
|
7711
7318
|
...field2.type === "relation" && dependency !== dependencyStart ? { dependency } : {},
|
|
@@ -8948,7 +8555,7 @@ function FloatingRefusal({ text, why }) {
|
|
|
8948
8555
|
// src/formatControls.tsx
|
|
8949
8556
|
import { useEffect as useEffect18, useRef as useRef15, useState as useState26 } from "react";
|
|
8950
8557
|
import { BasicInput as BasicInput8, BasicTextarea as BasicTextarea3 } from "@ai-matrx/design-system";
|
|
8951
|
-
import { getFieldFormat as
|
|
8558
|
+
import { getFieldFormat as getFieldFormat3, parseFieldInput } from "@ai-matrx/design-system/field-formats";
|
|
8952
8559
|
import { jsx as jsx33, jsxs as jsxs30 } from "react/jsx-runtime";
|
|
8953
8560
|
var TYPED_NUMBERS = /* @__PURE__ */ new Set(["currency", "percent", "progress", "decimal", "duration", "file_size", "integer"]);
|
|
8954
8561
|
function scaled(format) {
|
|
@@ -8991,7 +8598,7 @@ function NumberInFormat({ format, value, onChange, disabled, id }) {
|
|
|
8991
8598
|
);
|
|
8992
8599
|
}
|
|
8993
8600
|
function formatControl(args) {
|
|
8994
|
-
const def =
|
|
8601
|
+
const def = getFieldFormat3(args.format.id);
|
|
8995
8602
|
if (!def) return null;
|
|
8996
8603
|
const { format, value, onChange, disabled, id, label, ownDetails } = args;
|
|
8997
8604
|
const text = value === null || value === void 0 ? "" : String(value);
|
|
@@ -9247,7 +8854,7 @@ function FieldLabel({ field: field2, htmlFor, children }) {
|
|
|
9247
8854
|
return /* @__PURE__ */ jsxs32("div", { className: "flex items-baseline gap-1.5", children: [
|
|
9248
8855
|
/* @__PURE__ */ jsx35(Label8, { htmlFor, className: "text-xs font-medium", children: fieldName(field2) }),
|
|
9249
8856
|
field2.required ? /* @__PURE__ */ jsx35("span", { className: "text-xs text-destructive", children: "required" }) : null,
|
|
9250
|
-
field2.unit &&
|
|
8857
|
+
field2.unit && newerKindOf2(field2) !== "duration" ? /* @__PURE__ */ jsx35("span", { className: "text-xs text-muted-foreground", children: field2.unit }) : null,
|
|
9251
8858
|
children
|
|
9252
8859
|
] });
|
|
9253
8860
|
}
|
|
@@ -10653,9 +10260,9 @@ function TablePicker({ dataSource, value, onChange, disabled, tables }) {
|
|
|
10653
10260
|
const twin = (sameName.get(`${t.organization_id}|${t.table_name.trim().toLowerCase()}`) ?? 0) > 1;
|
|
10654
10261
|
const row = t;
|
|
10655
10262
|
const secondOf = (r) => [r.created_by_name ? `by ${r.created_by_name}` : null, r.updated_at ? `changed ${new Date(r.updated_at).toLocaleDateString()}` : null].filter(Boolean).join(" \xB7 ");
|
|
10656
|
-
const
|
|
10657
|
-
const alike = options.filter((o) => o.organization_id === t.organization_id && o.table_name.trim().toLowerCase() === t.table_name.trim().toLowerCase() && secondOf(o) ===
|
|
10658
|
-
const second = alike > 1 ? [
|
|
10263
|
+
const base = secondOf(row);
|
|
10264
|
+
const alike = options.filter((o) => o.organization_id === t.organization_id && o.table_name.trim().toLowerCase() === t.table_name.trim().toLowerCase() && secondOf(o) === base).length;
|
|
10265
|
+
const second = alike > 1 ? [base, `#${t.table_id.slice(0, 4)}`].filter(Boolean).join(" \xB7 ") : base;
|
|
10659
10266
|
return {
|
|
10660
10267
|
value: t.table_id,
|
|
10661
10268
|
// The organization hint already tells two same-named tables apart across organizations.
|
|
@@ -10929,7 +10536,7 @@ function BindingDetails({
|
|
|
10929
10536
|
}, [disabled, shape, binding, fields.loading, fieldList, table.data, onChange]);
|
|
10930
10537
|
const selectShape = (next) => {
|
|
10931
10538
|
if (next === shape) return;
|
|
10932
|
-
const
|
|
10539
|
+
const base = {
|
|
10933
10540
|
kind: "merge_field",
|
|
10934
10541
|
source: "record",
|
|
10935
10542
|
semantic_type: next,
|
|
@@ -10937,21 +10544,21 @@ function BindingDetails({
|
|
|
10937
10544
|
missing: binding.missing,
|
|
10938
10545
|
override_policy: "shown_locked"
|
|
10939
10546
|
};
|
|
10940
|
-
if (next !== "collection" && binding.record_id)
|
|
10941
|
-
if (next === "value" && binding.field_key)
|
|
10547
|
+
if (next !== "collection" && binding.record_id) base.record_id = binding.record_id;
|
|
10548
|
+
if (next === "value" && binding.field_key) base.field_key = binding.field_key;
|
|
10942
10549
|
if (next === "collection") {
|
|
10943
10550
|
const limit = binding.limit ?? defaultRowLimit;
|
|
10944
|
-
if (limit)
|
|
10551
|
+
if (limit) base.limit = limit;
|
|
10945
10552
|
}
|
|
10946
10553
|
if (next !== "value" && binding.transform) {
|
|
10947
|
-
|
|
10554
|
+
base.transform = {
|
|
10948
10555
|
name: "list",
|
|
10949
10556
|
template: binding.transform.template,
|
|
10950
10557
|
...binding.transform.join !== void 0 ? { join: binding.transform.join } : {},
|
|
10951
|
-
...next === "collection" &&
|
|
10558
|
+
...next === "collection" && base.limit !== void 0 ? { max: base.limit } : {}
|
|
10952
10559
|
};
|
|
10953
10560
|
}
|
|
10954
|
-
onChange(
|
|
10561
|
+
onChange(base);
|
|
10955
10562
|
};
|
|
10956
10563
|
const fieldOptions = fieldList.map((f) => ({ value: f.key, label: fieldName(f) }));
|
|
10957
10564
|
const template = binding.transform?.template ?? "";
|
|
@@ -11243,21 +10850,6 @@ export {
|
|
|
11243
10850
|
nextFieldSort,
|
|
11244
10851
|
previewWords,
|
|
11245
10852
|
ReferenceBuilder,
|
|
11246
|
-
DEFAULT_FOOTER,
|
|
11247
|
-
footerOf,
|
|
11248
|
-
EMPTY_PRESENTATION,
|
|
11249
|
-
FROZEN_COLUMN_WIDTH,
|
|
11250
|
-
MIN_ROW_HEIGHT,
|
|
11251
|
-
MAX_ROW_HEIGHT,
|
|
11252
|
-
parseGridPresentation,
|
|
11253
|
-
presentationIsEmpty,
|
|
11254
|
-
presentationDocument,
|
|
11255
|
-
formatForField,
|
|
11256
|
-
cellFormatFor,
|
|
11257
|
-
currencyCodeFor,
|
|
11258
|
-
colorFromTheValue,
|
|
11259
|
-
styleFromDecorations,
|
|
11260
|
-
resolveTableStyle,
|
|
11261
10853
|
choiceRowsFrom,
|
|
11262
10854
|
choiceListPatch,
|
|
11263
10855
|
whatTheChoiceListIsMissing,
|
|
@@ -11274,17 +10866,6 @@ export {
|
|
|
11274
10866
|
withheldNoticeOf,
|
|
11275
10867
|
withheldSentence,
|
|
11276
10868
|
WithheldValue,
|
|
11277
|
-
boundViews,
|
|
11278
|
-
viewSettings,
|
|
11279
|
-
viewSettingsPatch,
|
|
11280
|
-
VIEW_KEYS,
|
|
11281
|
-
viewKeysFor,
|
|
11282
|
-
viewSettingsFor,
|
|
11283
|
-
EMBEDDED_PAGE_SIZE,
|
|
11284
|
-
EMBEDDED_LOOK,
|
|
11285
|
-
EmbeddedLookProvider,
|
|
11286
|
-
EMBEDDED_TABLE_CLASS,
|
|
11287
|
-
EMBEDDED_PLAIN_FOOTER_CLASS,
|
|
11288
10869
|
WHOLE_VALUE_NOT_EDITABLE_HERE,
|
|
11289
10870
|
wholeValueOpening,
|
|
11290
10871
|
useWholeText,
|
|
@@ -11321,7 +10902,7 @@ export {
|
|
|
11321
10902
|
tableArchiveSentence,
|
|
11322
10903
|
readersSentence,
|
|
11323
10904
|
AccentSwatches,
|
|
11324
|
-
|
|
10905
|
+
ADDABLE_TYPES,
|
|
11325
10906
|
keyFor,
|
|
11326
10907
|
FieldEditor,
|
|
11327
10908
|
whatIsMissing,
|
|
@@ -11366,4 +10947,4 @@ export {
|
|
|
11366
10947
|
RecordNameText,
|
|
11367
10948
|
HeldChangeDecision
|
|
11368
10949
|
};
|
|
11369
|
-
//# sourceMappingURL=chunk-
|
|
10950
|
+
//# sourceMappingURL=chunk-42VA6SWA.js.map
|