@ai-matrx/records-ui 0.116.0 → 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 +26 -1
- package/dist/SaveToTable-3VDK4U5M.js +20 -0
- package/dist/{chunk-7IZJT3DV.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-4ZYGWYQP.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-3OKHOGSO.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 +441 -3
- package/dist/helpers.d.ts +441 -3
- package/dist/helpers.js +755 -10
- package/dist/helpers.js.map +1 -1
- package/dist/index.cjs +265 -213
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +156 -168
- package/dist/index.d.ts +156 -168
- package/dist/index.js +4285 -4476
- 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 +13 -2
- package/dist/SaveToTable-AG7ZY4IG.js +0 -18
- package/dist/chunk-3OKHOGSO.js.map +0 -1
- package/dist/chunk-4ZYGWYQP.js.map +0 -1
- package/dist/chunk-6NSGVKYL.js.map +0 -1
- package/dist/chunk-7IZJT3DV.js.map +0 -1
- /package/dist/{SaveToTable-AG7ZY4IG.js.map → SaveToTable-3VDK4U5M.js.map} +0 -0
package/dist/index.cjs
CHANGED
|
@@ -2484,6 +2484,16 @@ async function findUnfinishedTable(client, wantedName, wantedKeys, wantedRows, n
|
|
|
2484
2484
|
}
|
|
2485
2485
|
return null;
|
|
2486
2486
|
}
|
|
2487
|
+
function choiceWordsOwed(existing, wanted) {
|
|
2488
|
+
const idOf = new Map(existing.map((f) => [f.key, f.id]));
|
|
2489
|
+
const owed = [];
|
|
2490
|
+
for (const f of wanted) {
|
|
2491
|
+
const fieldId = idOf.get(f.key);
|
|
2492
|
+
const words2 = [...new Set((f.options ?? []).map((w) => w.trim()).filter(Boolean))];
|
|
2493
|
+
if (f.type === "select" && fieldId && words2.length > 0) owed.push({ fieldId, words: words2 });
|
|
2494
|
+
}
|
|
2495
|
+
return owed;
|
|
2496
|
+
}
|
|
2487
2497
|
var UNFINISHED_WINDOW_MS, FILLED_WINDOW_MS;
|
|
2488
2498
|
var init_unfinishedTable = __esm({
|
|
2489
2499
|
"src/unfinishedTable.ts"() {
|
|
@@ -6840,15 +6850,11 @@ var init_WhereItLives = __esm({
|
|
|
6840
6850
|
}
|
|
6841
6851
|
});
|
|
6842
6852
|
|
|
6843
|
-
// src/
|
|
6853
|
+
// src/tableLanes.ts
|
|
6844
6854
|
function platformOwned(table) {
|
|
6845
6855
|
const t = table;
|
|
6846
6856
|
return t.platform_owned === true || t.kept_by_the_app === true;
|
|
6847
6857
|
}
|
|
6848
|
-
function keeperSays(table) {
|
|
6849
|
-
const said2 = table.keeper_says;
|
|
6850
|
-
return typeof said2 === "string" && said2.trim() ? said2 : null;
|
|
6851
|
-
}
|
|
6852
6858
|
function laneFor(table) {
|
|
6853
6859
|
if (table.is_kernel) return "system";
|
|
6854
6860
|
if ((table.slug ?? "").startsWith(PLATFORM_TABLE_PREFIX2) || platformOwned(table)) return "app";
|
|
@@ -6864,6 +6870,19 @@ function shownToOnlyMe(table) {
|
|
|
6864
6870
|
if (table.shown_to !== void 0) return table.shown_to === "only_me";
|
|
6865
6871
|
return table.visibility === "personal";
|
|
6866
6872
|
}
|
|
6873
|
+
var PLATFORM_TABLE_PREFIX2;
|
|
6874
|
+
var init_tableLanes = __esm({
|
|
6875
|
+
"src/tableLanes.ts"() {
|
|
6876
|
+
"use strict";
|
|
6877
|
+
PLATFORM_TABLE_PREFIX2 = "records_ui_";
|
|
6878
|
+
}
|
|
6879
|
+
});
|
|
6880
|
+
|
|
6881
|
+
// src/TablesHome.tsx
|
|
6882
|
+
function keeperSays(table) {
|
|
6883
|
+
const said2 = table.keeper_says;
|
|
6884
|
+
return typeof said2 === "string" && said2.trim() ? said2 : null;
|
|
6885
|
+
}
|
|
6867
6886
|
function visibilityLaneFor(table) {
|
|
6868
6887
|
if (table.is_kernel) return null;
|
|
6869
6888
|
if ((table.slug ?? "").startsWith(PLATFORM_TABLE_PREFIX2) || platformOwned(table)) return null;
|
|
@@ -7032,7 +7051,7 @@ function TablesHome({ onOpenTable, organizationName, makingOnly = false, askedBy
|
|
|
7032
7051
|
}) : null
|
|
7033
7052
|
] });
|
|
7034
7053
|
}
|
|
7035
|
-
var import_react63, import_react64, import_core8, import_records23, import_design_system37, import_jsx_runtime41, TABLE_LANES, LANE_TITLE,
|
|
7054
|
+
var import_react63, import_react64, import_core8, import_records23, import_design_system37, import_jsx_runtime41, TABLE_LANES, LANE_TITLE, LANE_EMPTY, SECTIONS_UNKNOWN, VISIBILITY_LANES, VISIBILITY_LANE_TITLE;
|
|
7036
7055
|
var init_TablesHome = __esm({
|
|
7037
7056
|
"src/TablesHome.tsx"() {
|
|
7038
7057
|
"use strict";
|
|
@@ -7047,6 +7066,8 @@ var init_TablesHome = __esm({
|
|
|
7047
7066
|
init_BookingSlots();
|
|
7048
7067
|
init_names();
|
|
7049
7068
|
init_WhereItLives();
|
|
7069
|
+
init_tableLanes();
|
|
7070
|
+
init_tableLanes();
|
|
7050
7071
|
import_jsx_runtime41 = require("react/jsx-runtime");
|
|
7051
7072
|
TABLE_LANES = ["mine", "organization", "system", "community", "app"];
|
|
7052
7073
|
LANE_TITLE = {
|
|
@@ -7056,7 +7077,6 @@ var init_TablesHome = __esm({
|
|
|
7056
7077
|
community: "Published to the web",
|
|
7057
7078
|
app: "Platform tables"
|
|
7058
7079
|
};
|
|
7059
|
-
PLATFORM_TABLE_PREFIX2 = "records_ui_";
|
|
7060
7080
|
LANE_EMPTY = {
|
|
7061
7081
|
// 🚨 BOTH SENTENCES USED TO DESCRIBE A PRODUCT THAT DOES NOT EXIST
|
|
7062
7082
|
// (VERIFIER-15 M2, VERIFIER-16 M6). "New table makes one that only you can
|
|
@@ -7225,6 +7245,17 @@ function SaveToTable({ source, shapeIndex = 0, onOpenTable, onSaved, onClose, ma
|
|
|
7225
7245
|
setPhase("ready");
|
|
7226
7246
|
return;
|
|
7227
7247
|
}
|
|
7248
|
+
const present = await client.fields({ table_id: newId });
|
|
7249
|
+
if (present.ok) {
|
|
7250
|
+
for (const owed of choiceWordsOwed(present.data, fields)) {
|
|
7251
|
+
const topped = await client.fieldUpdate({ field_id: owed.fieldId, patch: { options_add: owed.words } });
|
|
7252
|
+
if (!topped.ok) {
|
|
7253
|
+
setProblem(topped.error);
|
|
7254
|
+
setPhase("ready");
|
|
7255
|
+
return;
|
|
7256
|
+
}
|
|
7257
|
+
}
|
|
7258
|
+
}
|
|
7228
7259
|
} else {
|
|
7229
7260
|
tableName2 = freeName(name ?? proposedName, (tables.data ?? []).map((t) => t.name));
|
|
7230
7261
|
const born = await (0, import_field_kinds5.declareTable)(client, { name: tableName2, fields });
|
|
@@ -10879,7 +10910,7 @@ function ReferenceBuilder({
|
|
|
10879
10910
|
|
|
10880
10911
|
// src/gridEditing.tsx
|
|
10881
10912
|
var import_react90 = require("react");
|
|
10882
|
-
var
|
|
10913
|
+
var import_records36 = require("@ai-matrx/records");
|
|
10883
10914
|
var import_core11 = require("@ai-matrx/records/core");
|
|
10884
10915
|
var import_react91 = require("@ai-matrx/records/react");
|
|
10885
10916
|
var import_design_system52 = require("@ai-matrx/design-system");
|
|
@@ -11551,7 +11582,7 @@ function AddChoicesInline({ field: field2, onAdded, disabled = false }) {
|
|
|
11551
11582
|
|
|
11552
11583
|
// src/editors.tsx
|
|
11553
11584
|
var import_react84 = require("react");
|
|
11554
|
-
var
|
|
11585
|
+
var import_records35 = require("@ai-matrx/records");
|
|
11555
11586
|
var import_react85 = require("@ai-matrx/records/react");
|
|
11556
11587
|
var import_design_system51 = require("@ai-matrx/design-system");
|
|
11557
11588
|
init_dates();
|
|
@@ -12196,7 +12227,7 @@ function RelationPicker({ field: field2, value, onChange, disabled, id, classNam
|
|
|
12196
12227
|
var import_react79 = require("react");
|
|
12197
12228
|
var import_design_system48 = require("@ai-matrx/design-system");
|
|
12198
12229
|
var import_data_table7 = require("@ai-matrx/design-system/data-table");
|
|
12199
|
-
var
|
|
12230
|
+
var import_records33 = require("@ai-matrx/records");
|
|
12200
12231
|
var import_react80 = require("@ai-matrx/records/react");
|
|
12201
12232
|
init_Refusal();
|
|
12202
12233
|
|
|
@@ -12258,7 +12289,6 @@ var NOT_TYPED_BY_NAME = /* @__PURE__ */ new Set([
|
|
|
12258
12289
|
"fx.sub",
|
|
12259
12290
|
"fx.mul",
|
|
12260
12291
|
"fx.div",
|
|
12261
|
-
"fx.mod",
|
|
12262
12292
|
"fx.neg",
|
|
12263
12293
|
"fx.eq",
|
|
12264
12294
|
"fx.ne",
|
|
@@ -15910,7 +15940,7 @@ function readersSentence(count, tableName2) {
|
|
|
15910
15940
|
|
|
15911
15941
|
// src/FieldEditor.tsx
|
|
15912
15942
|
init_enumLabels();
|
|
15913
|
-
var
|
|
15943
|
+
var import_records31 = require("@ai-matrx/records");
|
|
15914
15944
|
|
|
15915
15945
|
// src/ButtonSettings.tsx
|
|
15916
15946
|
var import_react75 = require("react");
|
|
@@ -16171,11 +16201,30 @@ function NewRowAction({
|
|
|
16171
16201
|
}
|
|
16172
16202
|
|
|
16173
16203
|
// src/FieldEditor.tsx
|
|
16174
|
-
var
|
|
16204
|
+
var import_records32 = require("@ai-matrx/records");
|
|
16205
|
+
|
|
16206
|
+
// src/standardFieldChoices.ts
|
|
16207
|
+
var import_records30 = require("@ai-matrx/records");
|
|
16208
|
+
init_fieldTypes();
|
|
16209
|
+
var STORE_BEHAVIOUR = new Map(import_records30.DECLARABLE_FIELD_KINDS.map((row) => [row.kind, row.behavior]));
|
|
16210
|
+
function holdsAValueOnAStandardTable(kind2) {
|
|
16211
|
+
if (isSystemFieldKind(kind2)) return false;
|
|
16212
|
+
const behaviour = STORE_BEHAVIOUR.get(kind2);
|
|
16213
|
+
return behaviour !== void 0 && behaviour !== "formula";
|
|
16214
|
+
}
|
|
16215
|
+
var STANDARD_TABLE_FIELD_CHOICES = FIELD_TYPE_CHOICES.filter(
|
|
16216
|
+
(c) => holdsAValueOnAStandardTable(c.id)
|
|
16217
|
+
);
|
|
16218
|
+
var ADDABLE_TYPES = STANDARD_TABLE_FIELD_CHOICES.map((choice) => ({
|
|
16219
|
+
value: choice.id,
|
|
16220
|
+
label: choice.label
|
|
16221
|
+
}));
|
|
16222
|
+
|
|
16223
|
+
// src/FieldEditor.tsx
|
|
16175
16224
|
var import_jsx_runtime52 = require("react/jsx-runtime");
|
|
16176
16225
|
var RULE_KINDS = FIELD_RULE_KIND_VALUES.map((kind2) => ({ kind: kind2, label: FIELD_RULE_KIND_LABEL[kind2] }));
|
|
16177
|
-
var SENSITIVITIES =
|
|
16178
|
-
var AGENT_VISIBILITY =
|
|
16226
|
+
var SENSITIVITIES = import_records32.FIELD_SENSITIVITIES.map((value) => ({ value, label: FIELD_SENSITIVITY_LABEL[value] }));
|
|
16227
|
+
var AGENT_VISIBILITY = import_records32.CONTEXT_POLICIES.map((value) => ({ value, label: CONTEXT_POLICY_LABEL[value] }));
|
|
16179
16228
|
var ROLLUP_OPERATIONS = ROLLUP_AGG_VALUES.map((value) => ({
|
|
16180
16229
|
value,
|
|
16181
16230
|
label: ROLLUP_AGG_LABEL[value]
|
|
@@ -16188,15 +16237,6 @@ var FORMULA_OPERATIONS = FORMULA_OP_VALUES.map((value) => ({
|
|
|
16188
16237
|
label: FORMULA_OP_LABEL[value],
|
|
16189
16238
|
joins: FORMULA_OP_JOINS[value]
|
|
16190
16239
|
}));
|
|
16191
|
-
var STORE_BEHAVIOUR = new Map(import_records31.DECLARABLE_FIELD_KINDS.map((row) => [row.kind, row.behavior]));
|
|
16192
|
-
function holdsAValueOnAStandardTable(kind2) {
|
|
16193
|
-
if (isSystemFieldKind(kind2)) return false;
|
|
16194
|
-
const behaviour = STORE_BEHAVIOUR.get(kind2);
|
|
16195
|
-
return behaviour !== void 0 && behaviour !== "formula";
|
|
16196
|
-
}
|
|
16197
|
-
var STANDARD_TABLE_FIELD_CHOICES = FIELD_TYPE_CHOICES.filter(
|
|
16198
|
-
(c) => holdsAValueOnAStandardTable(c.id)
|
|
16199
|
-
);
|
|
16200
16240
|
var ADD_STANDARD_FIELD_SAVE_LABEL = "Create field";
|
|
16201
16241
|
var KINDS_WITH_A_DEFAULT = /* @__PURE__ */ new Set([
|
|
16202
16242
|
"text",
|
|
@@ -16299,20 +16339,20 @@ function FieldEditor(props) {
|
|
|
16299
16339
|
const [contextPolicy, setContextPolicy] = (0, import_react77.useState)(String(start?.context_policy ?? "include"));
|
|
16300
16340
|
const [rules, setRules] = (0, import_react77.useState)(start?.rules ?? []);
|
|
16301
16341
|
const [startsWith, setStartsWith] = (0, import_react77.useState)(start?.default ?? null);
|
|
16302
|
-
const [ratingMax, setRatingMax] = (0, import_react77.useState)(() => start ? (0,
|
|
16342
|
+
const [ratingMax, setRatingMax] = (0, import_react77.useState)(() => start ? (0, import_records32.ratingMaxOf)(start) : 5);
|
|
16303
16343
|
const savedRules = (0, import_react77.useMemo)(
|
|
16304
|
-
() => field2 ? type === "rating" ? (0,
|
|
16344
|
+
() => field2 ? type === "rating" ? (0, import_records32.rulesWithTopStar)(field2.rules ?? [], (0, import_records32.ratingMaxOf)(field2)) : field2.rules ?? [] : [],
|
|
16305
16345
|
[field2, type]
|
|
16306
16346
|
);
|
|
16307
|
-
const editedRules = (0, import_react77.useMemo)(() => type === "rating" ? (0,
|
|
16347
|
+
const editedRules = (0, import_react77.useMemo)(() => type === "rating" ? (0, import_records32.rulesWithTopStar)(rules, ratingMax) : rules, [type, rules, ratingMax]);
|
|
16308
16348
|
const [statusGroups, setStatusGroups] = (0, import_react77.useState)({});
|
|
16309
16349
|
const [statusKeys, setStatusKeys] = (0, import_react77.useState)({});
|
|
16310
16350
|
const [symbology, setSymbology] = (0, import_react77.useState)(String(start?.config?.["symbology"] ?? ""));
|
|
16311
16351
|
const descriptionStart = String(start?.config?.["description"] ?? "");
|
|
16312
16352
|
const [description, setDescription] = (0, import_react77.useState)(descriptionStart);
|
|
16313
|
-
const buttonStart = (0, import_react77.useMemo)(() => (0,
|
|
16353
|
+
const buttonStart = (0, import_react77.useMemo)(() => (0, import_records31.buttonOf)(start) ?? { label: "" }, [start]);
|
|
16314
16354
|
const [buttonSettings, setButtonSettings] = (0, import_react77.useState)(buttonStart);
|
|
16315
|
-
const prefixStart = (0,
|
|
16355
|
+
const prefixStart = (0, import_records31.autonumberPrefixOf)(start);
|
|
16316
16356
|
const [numberPrefix, setNumberPrefix] = (0, import_react77.useState)(prefixStart);
|
|
16317
16357
|
const dependencyStart = start?.config?.["dependency"] === true;
|
|
16318
16358
|
const [dependency, setDependency] = (0, import_react77.useState)(dependencyStart);
|
|
@@ -16320,7 +16360,7 @@ function FieldEditor(props) {
|
|
|
16320
16360
|
if (!field2 || type !== "status") return;
|
|
16321
16361
|
let live = true;
|
|
16322
16362
|
void client.fieldOptions({ field_id: field2.id }).then((got) => {
|
|
16323
|
-
if (live && got.ok) setStatusKeys(Object.fromEntries((got.data ?? []).map((o) => [String(o.id), (0,
|
|
16363
|
+
if (live && got.ok) setStatusKeys(Object.fromEntries((got.data ?? []).map((o) => [String(o.id), (0, import_records32.optionKey)(o)])));
|
|
16324
16364
|
});
|
|
16325
16365
|
return () => {
|
|
16326
16366
|
live = false;
|
|
@@ -16443,7 +16483,7 @@ function FieldEditor(props) {
|
|
|
16443
16483
|
const nameTaken = columnNameTakenBy(label, others.map(fieldName));
|
|
16444
16484
|
const nameLine = nameTaken ? columnNameTakenLine(nameTaken, noun) : columnNameProblemLine(label, noun);
|
|
16445
16485
|
const listsChoices = type === "select" || type === "multi_select" || type === "status";
|
|
16446
|
-
const buttonMissing = type === "button" && buttonSettings.do ? (0,
|
|
16486
|
+
const buttonMissing = type === "button" && buttonSettings.do ? (0, import_records31.buttonNeeds)(buttonSettings) : null;
|
|
16447
16487
|
const missing = buttonMissing ?? (editing ? formulaMissing ?? (listsChoices ? whatTheChoiceListIsMissing(choiceList) : null) : formulaMissing ?? (listsChoices ? whatTheChoiceListIsMissing(newChoices) : null) ?? (type === "formula" && formulaWritten ? null : whatIsMissing(
|
|
16448
16488
|
type === "count" ? { type: "rollup", label, options, via, pick, agg: "count", of, relations: totalSources, formulaFields, relationTarget, allowedTypes, noun } : { type, label, options, via, pick, agg, of, relations: sourcesFor(type), formulaFields, relationTarget, allowedTypes, noun }
|
|
16449
16489
|
)));
|
|
@@ -16485,7 +16525,7 @@ function FieldEditor(props) {
|
|
|
16485
16525
|
...statusGroupsChanged ? { status_groups: statusGroupsSent } : {},
|
|
16486
16526
|
// V11 #4/#10: a rating's top star goes as `max`, the word custom.field_update now takes the way
|
|
16487
16527
|
// custom.field_declare does; the store writes the max Rule and sets aside any score above it.
|
|
16488
|
-
...type === "rating" && ratingMax !== (0,
|
|
16528
|
+
...type === "rating" && ratingMax !== (0, import_records32.ratingMaxOf)(field2) ? { max: ratingMax } : {},
|
|
16489
16529
|
...type === "barcode" && symbology !== String(field2.config?.["symbology"] ?? "") ? { symbology: symbology === "" ? null : symbology } : {},
|
|
16490
16530
|
...type === "button" && JSON.stringify(buttonSettings) !== JSON.stringify(buttonStart) ? { button: buttonSettings } : {},
|
|
16491
16531
|
...field2.type === "relation" && dependency !== dependencyStart ? { dependency } : {},
|
|
@@ -17532,7 +17572,7 @@ function runAnswer(label, run) {
|
|
|
17532
17572
|
var stop2 = (event) => event.stopPropagation();
|
|
17533
17573
|
function ButtonValue({ field: field2, recordId, inCell }) {
|
|
17534
17574
|
const client = (0, import_react80.useOptionalRecordsClient)();
|
|
17535
|
-
const b = (0,
|
|
17575
|
+
const b = (0, import_records33.buttonOf)(field2);
|
|
17536
17576
|
const [busy, setBusy] = (0, import_react79.useState)(false);
|
|
17537
17577
|
const [said2, setSaid] = (0, import_react79.useState)(null);
|
|
17538
17578
|
const [settingUp, setSettingUp] = (0, import_react79.useState)(false);
|
|
@@ -17540,7 +17580,7 @@ function ButtonValue({ field: field2, recordId, inCell }) {
|
|
|
17540
17580
|
(0, import_react79.useEffect)(() => () => void (waitingOn.current += 1), []);
|
|
17541
17581
|
if (!b) return null;
|
|
17542
17582
|
const color = (0, import_data_table7.isStyleColor)(b.color) ? import_data_table7.CHOICE_CHIP_CLASS[b.color] : import_data_table7.NEUTRAL_CHIP_CLASS;
|
|
17543
|
-
const needs = (0,
|
|
17583
|
+
const needs = (0, import_records33.buttonNeeds)(b);
|
|
17544
17584
|
const tableId = field2.entity_definition_id;
|
|
17545
17585
|
const press = async () => {
|
|
17546
17586
|
if (!client || !recordId) return setSaid({ kind: "public" });
|
|
@@ -17834,7 +17874,7 @@ function formatControl(args) {
|
|
|
17834
17874
|
// src/typedDateHelper.tsx
|
|
17835
17875
|
var import_react83 = require("react");
|
|
17836
17876
|
var import_design_system50 = require("@ai-matrx/design-system");
|
|
17837
|
-
var
|
|
17877
|
+
var import_records34 = require("@ai-matrx/records");
|
|
17838
17878
|
var import_jsx_runtime56 = require("react/jsx-runtime");
|
|
17839
17879
|
var WEEK = ["Su", "Mo", "Tu", "We", "Th", "Fr", "Sa"];
|
|
17840
17880
|
var MONTHS = ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"];
|
|
@@ -17843,12 +17883,12 @@ function pad2(n) {
|
|
|
17843
17883
|
}
|
|
17844
17884
|
function readBox(text, kind2) {
|
|
17845
17885
|
if (kind2 === "time") {
|
|
17846
|
-
const t = (0,
|
|
17886
|
+
const t = (0, import_records34.readTypedTime)(text);
|
|
17847
17887
|
if (!t.ok) return { day: null, time: null };
|
|
17848
17888
|
const [h, m] = t.value.split(":").map(Number);
|
|
17849
17889
|
return { day: null, time: { h, m } };
|
|
17850
17890
|
}
|
|
17851
|
-
const read = (0,
|
|
17891
|
+
const read = (0, import_records34.readTypedDate)(text, { withTime: kind2 === "datetime" });
|
|
17852
17892
|
if (!read.ok) return { day: null, time: null };
|
|
17853
17893
|
if (kind2 === "datetime" && read.instant) {
|
|
17854
17894
|
const at = new Date(read.instant);
|
|
@@ -17857,10 +17897,10 @@ function readBox(text, kind2) {
|
|
|
17857
17897
|
return { day: read.day, time: null };
|
|
17858
17898
|
}
|
|
17859
17899
|
function wordsFor2(kind2, day2, time) {
|
|
17860
|
-
if (kind2 === "time") return time ? (0,
|
|
17900
|
+
if (kind2 === "time") return time ? (0, import_records34.typedTimeText)(time.h, time.m) : "";
|
|
17861
17901
|
if (!day2) return "";
|
|
17862
|
-
const dayText = (0,
|
|
17863
|
-
return kind2 === "datetime" && time ? `${dayText} ${(0,
|
|
17902
|
+
const dayText = (0, import_records34.typedDateText)(day2);
|
|
17903
|
+
return kind2 === "datetime" && time ? `${dayText} ${(0, import_records34.typedTimeText)(time.h, time.m)}` : dayText;
|
|
17864
17904
|
}
|
|
17865
17905
|
var keepFocus = { onMouseDown: (e) => e.preventDefault(), tabIndex: -1 };
|
|
17866
17906
|
function CalendarGlyph() {
|
|
@@ -17982,7 +18022,7 @@ function TypedDateHelper({
|
|
|
17982
18022
|
held.time && held.time.h === t.h && held.time.m === t.m ? "bg-primary text-primary-foreground" : ""
|
|
17983
18023
|
),
|
|
17984
18024
|
onClick: () => pickTime(t),
|
|
17985
|
-
children: (0,
|
|
18025
|
+
children: (0, import_records34.typedTimeText)(t.h, t.m)
|
|
17986
18026
|
},
|
|
17987
18027
|
`${t.h}:${t.m}`
|
|
17988
18028
|
)) })
|
|
@@ -18039,7 +18079,7 @@ function FieldLabel({ field: field2, htmlFor, children }) {
|
|
|
18039
18079
|
return /* @__PURE__ */ (0, import_jsx_runtime57.jsxs)("div", { className: "flex items-baseline gap-1.5", children: [
|
|
18040
18080
|
/* @__PURE__ */ (0, import_jsx_runtime57.jsx)(import_design_system51.Label, { htmlFor, className: "text-xs font-medium", children: fieldName(field2) }),
|
|
18041
18081
|
field2.required ? /* @__PURE__ */ (0, import_jsx_runtime57.jsx)("span", { className: "text-xs text-destructive", children: "required" }) : null,
|
|
18042
|
-
field2.unit && (0,
|
|
18082
|
+
field2.unit && (0, import_records35.newerKindOf)(field2) !== "duration" ? /* @__PURE__ */ (0, import_jsx_runtime57.jsx)("span", { className: "text-xs text-muted-foreground", children: field2.unit }) : null,
|
|
18043
18083
|
children
|
|
18044
18084
|
] });
|
|
18045
18085
|
}
|
|
@@ -18049,7 +18089,7 @@ function isTypedDraft(value) {
|
|
|
18049
18089
|
var TYPED_AS_WORDS = /* @__PURE__ */ new Set(["text", "long_text", "phone"]);
|
|
18050
18090
|
var TYPED_AND_READ = /* @__PURE__ */ new Set(["number", "currency", "percent", "datetime", "select", "multi_select", "email", "url"]);
|
|
18051
18091
|
function typingOpens(field2) {
|
|
18052
|
-
if ((0,
|
|
18092
|
+
if ((0, import_records35.isButtonField)(field2)) return "none";
|
|
18053
18093
|
const kind2 = String(editorKindFor(field2));
|
|
18054
18094
|
if (kind2 === "formula" || kind2 === "lookup" || kind2 === "rollup") return "none";
|
|
18055
18095
|
if (kind2 === "select" || kind2 === "multi_select" || kind2 === "member") return "search";
|
|
@@ -18075,21 +18115,21 @@ function judgeTyped(field2, text, choices, nudge) {
|
|
|
18075
18115
|
const format = formatForField(field2);
|
|
18076
18116
|
if (trimmed === "") return { value: null };
|
|
18077
18117
|
if (format && format.id === "time") {
|
|
18078
|
-
const read2 = (0,
|
|
18118
|
+
const read2 = (0, import_records35.readTypedTime)(trimmed);
|
|
18079
18119
|
return read2.ok ? { value: read2.value } : { refusal: SHORT_REFUSAL.time, why: `${fieldName(field2)} holds a time of day, and ${read2.why}` };
|
|
18080
18120
|
}
|
|
18081
18121
|
if (kind2 === "select" || kind2 === "multi_select") {
|
|
18082
18122
|
if (!choices || nudge === null) return null;
|
|
18083
18123
|
const several = field2.multi || kind2 === "multi_select";
|
|
18084
18124
|
const words2 = several ? trimmed.split(/\s*[,;\n]\s*/).filter(Boolean) : [trimmed];
|
|
18085
|
-
const allowOther = (0,
|
|
18125
|
+
const allowOther = (0, import_records35.allowsOtherValues)(field2);
|
|
18086
18126
|
const parts = [];
|
|
18087
18127
|
const add = [];
|
|
18088
18128
|
const ask2 = [];
|
|
18089
18129
|
const notChoices = [];
|
|
18090
18130
|
let keepOffered = allowOther;
|
|
18091
18131
|
for (const word of words2) {
|
|
18092
|
-
const decided = (0,
|
|
18132
|
+
const decided = (0, import_records35.decideTypedChoice)({ words: word, options: choices, allowOther, nudge });
|
|
18093
18133
|
if (decided.decision === "empty") continue;
|
|
18094
18134
|
if (decided.decision === "chosen") parts.push(decided.key);
|
|
18095
18135
|
else {
|
|
@@ -18122,7 +18162,7 @@ function judgeTyped(field2, text, choices, nudge) {
|
|
|
18122
18162
|
return usual && digits.length >= 7 && digits.length <= 20 ? { value: trimmed } : { refusal: SHORT_REFUSAL.phone };
|
|
18123
18163
|
}
|
|
18124
18164
|
const showsAsPercent = Boolean(format && (format.id === "percent" || format.id === "progress"));
|
|
18125
|
-
const read = (0,
|
|
18165
|
+
const read = (0, import_records35.coerceTypedAnswer)(field2, text, { label: fieldName(field2), showsAsPercent });
|
|
18126
18166
|
if ("refusal" in read) {
|
|
18127
18167
|
if (kind2 === "email" || kind2 === "url") return { refusal: SHORT_REFUSAL[kind2] };
|
|
18128
18168
|
const short = kind2 === "datetime" ? SHORT_REFUSAL.date : kind2 === "number" || kind2 === "currency" || kind2 === "percent" || showsAsPercent ? SHORT_REFUSAL.number : read.refusal.length <= 32 ? read.refusal : SHORT_REFUSAL.value;
|
|
@@ -18143,12 +18183,12 @@ function openingText(field2, value) {
|
|
|
18143
18183
|
if (value === null || value === void 0 || value === "") return "";
|
|
18144
18184
|
const helper = dateHelperKind(field2, value);
|
|
18145
18185
|
if (helper === "time") {
|
|
18146
|
-
const read = (0,
|
|
18186
|
+
const read = (0, import_records35.readTypedTime)(String(value));
|
|
18147
18187
|
if (!read.ok) return String(value);
|
|
18148
18188
|
const [h, m] = read.value.split(":").map(Number);
|
|
18149
|
-
return (0,
|
|
18189
|
+
return (0, import_records35.typedTimeText)(h, m);
|
|
18150
18190
|
}
|
|
18151
|
-
if (helper) return (0,
|
|
18191
|
+
if (helper) return (0, import_records35.typedDateText)(value, { withTime: helper === "datetime" });
|
|
18152
18192
|
const format = formatForField(field2);
|
|
18153
18193
|
return format ? typedText(format, value) : String(value);
|
|
18154
18194
|
}
|
|
@@ -18252,7 +18292,7 @@ function TypedTextControl({ field: field2, value, onChange, disabled, id, onComm
|
|
|
18252
18292
|
" ",
|
|
18253
18293
|
needsChoices ? String(
|
|
18254
18294
|
(Array.isArray(withoutAddition(judged.value).value) ? withoutAddition(judged.value).value : [withoutAddition(judged.value).value]).map((k) => {
|
|
18255
|
-
const option = choices?.find((o) => (0,
|
|
18295
|
+
const option = choices?.find((o) => (0, import_records35.optionKey)(o) === k);
|
|
18256
18296
|
return option ? recordName(option.data, null, String(k)) : String(k);
|
|
18257
18297
|
}).join(", ")
|
|
18258
18298
|
) : (() => {
|
|
@@ -18273,7 +18313,7 @@ function FieldControl({ field: field2, value, onChange, disabled, id, autoOpen,
|
|
|
18273
18313
|
const ownDetails = (0, import_react85.useOptionalRecordsClient)() === null;
|
|
18274
18314
|
if (isTypedDraft(value)) return /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(TypedTextControl, { field: field2, value, onChange, disabled, id: inputId, onCommit, onCancel });
|
|
18275
18315
|
if (isSignatureField(field2)) return /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(SignaturePad, { id: inputId, value, onChange, disabled });
|
|
18276
|
-
if ((0,
|
|
18316
|
+
if ((0, import_records35.isButtonField)(field2)) return /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(ButtonValue, { field: field2 });
|
|
18277
18317
|
const newerControl = newerKindControl({ field: field2, value, onChange, disabled, id: inputId });
|
|
18278
18318
|
if (newerControl !== void 0) return newerControl;
|
|
18279
18319
|
const format = formatForField(field2);
|
|
@@ -18443,7 +18483,7 @@ function TypedWordsControl({ field: field2, value, onChange, disabled, id }) {
|
|
|
18443
18483
|
function typedDatePlaceholder(helper) {
|
|
18444
18484
|
const time = "h:mm AM";
|
|
18445
18485
|
if (helper === "time") return time;
|
|
18446
|
-
const pattern = (0,
|
|
18486
|
+
const pattern = (0, import_records35.typedDateText)("2026-11-22").replace("2026", "YYYY").replace("11", "MM").replace("22", "DD");
|
|
18447
18487
|
return helper === "datetime" ? `${pattern} ${time}` : pattern;
|
|
18448
18488
|
}
|
|
18449
18489
|
function CheckboxControl({ field: field2, value, onChange, disabled, id }) {
|
|
@@ -18613,15 +18653,15 @@ function OptionControl({ field: field2, value, onChange, disabled, id, autoOpen,
|
|
|
18613
18653
|
ChoiceAnswer,
|
|
18614
18654
|
{
|
|
18615
18655
|
field: field2,
|
|
18616
|
-
choices: options.map((option) => ({ key: (0,
|
|
18656
|
+
choices: options.map((option) => ({ key: (0, import_records35.optionKey)(option), label: titled(option) })),
|
|
18617
18657
|
value,
|
|
18618
18658
|
onChange,
|
|
18619
18659
|
disabled,
|
|
18620
18660
|
id,
|
|
18621
18661
|
onChosen,
|
|
18622
18662
|
isChosen: (choice, v) => {
|
|
18623
|
-
const option = options.find((o) => (0,
|
|
18624
|
-
return option ? (0,
|
|
18663
|
+
const option = options.find((o) => (0, import_records35.optionKey)(o) === choice.key);
|
|
18664
|
+
return option ? (0, import_records35.isTheChosen)(option, v) : false;
|
|
18625
18665
|
}
|
|
18626
18666
|
}
|
|
18627
18667
|
);
|
|
@@ -18654,7 +18694,7 @@ function OptionControl({ field: field2, value, onChange, disabled, id, autoOpen,
|
|
|
18654
18694
|
onCancel,
|
|
18655
18695
|
initialSearch,
|
|
18656
18696
|
addsChoices,
|
|
18657
|
-
allowOther: (0,
|
|
18697
|
+
allowOther: (0, import_records35.allowsOtherValues)(field2),
|
|
18658
18698
|
onChoicesChanged: () => {
|
|
18659
18699
|
if (client) (0, askOnce_exports.forgetAsked)(client, `field_options:${field2.id}`);
|
|
18660
18700
|
setReread((n) => n + 1);
|
|
@@ -18668,19 +18708,19 @@ function OptionControl({ field: field2, value, onChange, disabled, id, autoOpen,
|
|
|
18668
18708
|
}
|
|
18669
18709
|
const titleOf = (option) => recordName(option.data, null, "Unnamed choice");
|
|
18670
18710
|
if (field2.multi) {
|
|
18671
|
-
const chosen = options.filter((option) => (0,
|
|
18672
|
-
const picked = new Set(chosen.map((option) => (0,
|
|
18711
|
+
const chosen = options.filter((option) => (0, import_records35.choiceValuesOf)(value).some((v) => (0, import_records35.isTheChosen)(option, v)));
|
|
18712
|
+
const picked = new Set(chosen.map((option) => (0, import_records35.optionKey)(option)));
|
|
18673
18713
|
const toggles = /* @__PURE__ */ (0, import_jsx_runtime57.jsx)("div", { id: autoOpen ? void 0 : id, className: "flex flex-wrap gap-1", children: options.map((option) => /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(
|
|
18674
18714
|
import_design_system51.Button,
|
|
18675
18715
|
{
|
|
18676
18716
|
type: "button",
|
|
18677
18717
|
size: "sm",
|
|
18678
|
-
variant: picked.has((0,
|
|
18718
|
+
variant: picked.has((0, import_records35.optionKey)(option)) ? "default" : "outline",
|
|
18679
18719
|
disabled,
|
|
18680
18720
|
onClick: () => {
|
|
18681
18721
|
const next = new Set(picked);
|
|
18682
|
-
if (next.has((0,
|
|
18683
|
-
else next.add((0,
|
|
18722
|
+
if (next.has((0, import_records35.optionKey)(option))) next.delete((0, import_records35.optionKey)(option));
|
|
18723
|
+
else next.add((0, import_records35.optionKey)(option));
|
|
18684
18724
|
onChange(next.size === 0 ? null : [...next]);
|
|
18685
18725
|
},
|
|
18686
18726
|
children: titleOf(option)
|
|
@@ -18702,11 +18742,11 @@ function OptionControl({ field: field2, value, onChange, disabled, id, autoOpen,
|
|
|
18702
18742
|
}
|
|
18703
18743
|
);
|
|
18704
18744
|
}
|
|
18705
|
-
const current = options.find((option) => (0,
|
|
18745
|
+
const current = options.find((option) => (0, import_records35.isTheChosen)(option, value));
|
|
18706
18746
|
return /* @__PURE__ */ (0, import_jsx_runtime57.jsxs)(
|
|
18707
18747
|
import_design_system51.Select,
|
|
18708
18748
|
{
|
|
18709
|
-
value: current ? (0,
|
|
18749
|
+
value: current ? (0, import_records35.optionKey)(current) : "",
|
|
18710
18750
|
disabled: disabled ?? false,
|
|
18711
18751
|
onValueChange: (next) => onChange(next === "" ? null : next),
|
|
18712
18752
|
...autoOpen ? {
|
|
@@ -18718,7 +18758,7 @@ function OptionControl({ field: field2, value, onChange, disabled, id, autoOpen,
|
|
|
18718
18758
|
} : {},
|
|
18719
18759
|
children: [
|
|
18720
18760
|
/* @__PURE__ */ (0, import_jsx_runtime57.jsx)(import_design_system51.SelectTrigger, { id, size: "sm", children: /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(import_design_system51.SelectValue, { placeholder: "Choose" }) }),
|
|
18721
|
-
/* @__PURE__ */ (0, import_jsx_runtime57.jsx)(import_design_system51.SelectContent, { children: options.map((option) => /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(import_design_system51.SelectItem, { value: (0,
|
|
18761
|
+
/* @__PURE__ */ (0, import_jsx_runtime57.jsx)(import_design_system51.SelectContent, { children: options.map((option) => /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(import_design_system51.SelectItem, { value: (0, import_records35.optionKey)(option), children: titleOf(option) }, option.id)) })
|
|
18722
18762
|
]
|
|
18723
18763
|
}
|
|
18724
18764
|
);
|
|
@@ -18752,23 +18792,23 @@ function OpenChoicePicker({
|
|
|
18752
18792
|
const [addRefused, setAddRefused] = (0, import_react84.useState)(null);
|
|
18753
18793
|
const titleOf = (option) => recordName(option.data, null, "Unnamed choice");
|
|
18754
18794
|
const held = withoutAddition(value);
|
|
18755
|
-
const current = (0,
|
|
18795
|
+
const current = (0, import_records35.choiceValuesOf)(held.value);
|
|
18756
18796
|
const pickedWords = current.map((v) => {
|
|
18757
|
-
const option = options.find((o) => (0,
|
|
18797
|
+
const option = options.find((o) => (0, import_records35.isTheChosen)(o, v));
|
|
18758
18798
|
return option ? titleOf(option) : String(v);
|
|
18759
18799
|
});
|
|
18760
|
-
const chipOf = (option, word) => option ? choiceChipLookOf(field2, (0,
|
|
18800
|
+
const chipOf = (option, word) => option ? choiceChipLookOf(field2, (0, import_records35.optionKey)(option), titleOf(option)) : choiceChipLookOf(field2, word);
|
|
18761
18801
|
const q = search.trim();
|
|
18762
|
-
const visible = (0,
|
|
18763
|
-
const decided = (0,
|
|
18802
|
+
const visible = (0, import_records35.rankTypedMatches)(options, q, titleOf);
|
|
18803
|
+
const decided = (0, import_records35.decideTypedChoice)({ words: q, options, allowOther, nudge: nudge ?? "ask" });
|
|
18764
18804
|
const choose = (word, addingIt = false) => {
|
|
18765
18805
|
const pending = held.add.filter((w) => w.toLowerCase() !== word.toLowerCase());
|
|
18766
18806
|
let next;
|
|
18767
18807
|
let add2 = [...pending];
|
|
18768
18808
|
if (field2.multi) {
|
|
18769
18809
|
const existing = current.map((v) => {
|
|
18770
|
-
const option = options.find((o) => (0,
|
|
18771
|
-
return option ? (0,
|
|
18810
|
+
const option = options.find((o) => (0, import_records35.isTheChosen)(o, v));
|
|
18811
|
+
return option ? (0, import_records35.optionKey)(option) : String(v);
|
|
18772
18812
|
});
|
|
18773
18813
|
const has = existing.some((v) => v.toLowerCase() === word.toLowerCase());
|
|
18774
18814
|
const list = has ? existing.filter((v) => v.toLowerCase() !== word.toLowerCase()) : [...existing, word];
|
|
@@ -18804,7 +18844,7 @@ function OpenChoicePicker({
|
|
|
18804
18844
|
const foot = null;
|
|
18805
18845
|
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;
|
|
18806
18846
|
const listed = visible;
|
|
18807
|
-
const pickedOptions = current.map((v) => options.find((o) => (0,
|
|
18847
|
+
const pickedOptions = current.map((v) => options.find((o) => (0, import_records35.isTheChosen)(o, v)));
|
|
18808
18848
|
const cellChips = pickedWords.map((word, i) => {
|
|
18809
18849
|
const chip = chipOf(pickedOptions[i], word);
|
|
18810
18850
|
return /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(import_design_system51.Badge, { variant: "outline", className: (0, import_design_system51.cn)("text-[11px]", chip.className), "data-records-choice-chip": "", children: word }, word);
|
|
@@ -18816,7 +18856,7 @@ function OpenChoicePicker({
|
|
|
18816
18856
|
label: word,
|
|
18817
18857
|
chip: chipOf(option, word).className,
|
|
18818
18858
|
onRemove: () => {
|
|
18819
|
-
if (field2.multi) choose(option ? (0,
|
|
18859
|
+
if (field2.multi) choose(option ? (0, import_records35.optionKey)(option) : String(current[i]));
|
|
18820
18860
|
else onChange(null);
|
|
18821
18861
|
}
|
|
18822
18862
|
};
|
|
@@ -18847,11 +18887,11 @@ function OpenChoicePicker({
|
|
|
18847
18887
|
id: option.id,
|
|
18848
18888
|
label: titleOf(option),
|
|
18849
18889
|
chip: chipOf(option, titleOf(option)).className,
|
|
18850
|
-
picked: current.some((v) => (0,
|
|
18890
|
+
picked: current.some((v) => (0, import_records35.isTheChosen)(option, v))
|
|
18851
18891
|
})),
|
|
18852
18892
|
onPick: (optionId) => {
|
|
18853
18893
|
const option = options.find((o) => o.id === optionId);
|
|
18854
|
-
if (option) choose((0,
|
|
18894
|
+
if (option) choose((0, import_records35.optionKey)(option));
|
|
18855
18895
|
},
|
|
18856
18896
|
empty: q === "" ? /* @__PURE__ */ (0, import_jsx_runtime57.jsx)("p", { className: "p-2 text-xs text-muted-foreground", children: "No choices yet \u2014 type one to add it." }) : null,
|
|
18857
18897
|
add,
|
|
@@ -18907,7 +18947,7 @@ function ChoiceAnswer({
|
|
|
18907
18947
|
onChosen
|
|
18908
18948
|
}) {
|
|
18909
18949
|
const [search, setSearch] = (0, import_react84.useState)("");
|
|
18910
|
-
const held = field2.multi ? (0,
|
|
18950
|
+
const held = field2.multi ? (0, import_records35.choiceValuesOf)(value) : value === null || value === void 0 || value === "" ? [] : [value];
|
|
18911
18951
|
const on = (choice) => held.some((v) => isChosen ? isChosen(choice, v) : String(v) === choice.key || String(v) === choice.label);
|
|
18912
18952
|
const press = (choice) => {
|
|
18913
18953
|
if (!field2.multi) {
|
|
@@ -19380,7 +19420,7 @@ function isTypedCharacter(event) {
|
|
|
19380
19420
|
return !event.metaKey && !event.ctrlKey && !event.altKey && event.key.length === 1 && event.key !== " ";
|
|
19381
19421
|
}
|
|
19382
19422
|
function fieldIsEditable(field2) {
|
|
19383
|
-
if ((0,
|
|
19423
|
+
if ((0, import_records36.isButtonField)(field2)) return false;
|
|
19384
19424
|
const kind2 = editorKindFor(field2);
|
|
19385
19425
|
return kind2 !== "formula" && kind2 !== "lookup" && kind2 !== "rollup";
|
|
19386
19426
|
}
|
|
@@ -20615,6 +20655,28 @@ function rememberLayout(tableId, layout) {
|
|
|
20615
20655
|
var import_react92 = require("react");
|
|
20616
20656
|
var import_design_system53 = require("@ai-matrx/design-system");
|
|
20617
20657
|
var import_data_table8 = require("@ai-matrx/design-system/data-table");
|
|
20658
|
+
|
|
20659
|
+
// src/skeletonLayout.ts
|
|
20660
|
+
var RECORDS_SKELETON_LAYOUTS = [
|
|
20661
|
+
"grid",
|
|
20662
|
+
"kanban",
|
|
20663
|
+
"gallery",
|
|
20664
|
+
"list",
|
|
20665
|
+
"calendar",
|
|
20666
|
+
"timeline",
|
|
20667
|
+
"map",
|
|
20668
|
+
"orgchart",
|
|
20669
|
+
"form",
|
|
20670
|
+
"record",
|
|
20671
|
+
"chart",
|
|
20672
|
+
"home"
|
|
20673
|
+
];
|
|
20674
|
+
function skeletonLayoutFor(layout) {
|
|
20675
|
+
if (layout === "board" || layout === "pipeline") return "kanban";
|
|
20676
|
+
return RECORDS_SKELETON_LAYOUTS.includes(layout ?? "") ? layout : "grid";
|
|
20677
|
+
}
|
|
20678
|
+
|
|
20679
|
+
// src/RecordsSkeleton.tsx
|
|
20618
20680
|
var import_jsx_runtime61 = require("react/jsx-runtime");
|
|
20619
20681
|
var NEVER = () => () => {
|
|
20620
20682
|
};
|
|
@@ -20633,27 +20695,9 @@ function useRememberedLayout(tableId) {
|
|
|
20633
20695
|
);
|
|
20634
20696
|
}
|
|
20635
20697
|
var SPATIAL_LAYOUT_BOX = "h-[60vh] min-h-[22rem]";
|
|
20636
|
-
var RECORDS_SKELETON_LAYOUTS = [
|
|
20637
|
-
"grid",
|
|
20638
|
-
"kanban",
|
|
20639
|
-
"gallery",
|
|
20640
|
-
"list",
|
|
20641
|
-
"calendar",
|
|
20642
|
-
"timeline",
|
|
20643
|
-
"map",
|
|
20644
|
-
"orgchart",
|
|
20645
|
-
"form",
|
|
20646
|
-
"record",
|
|
20647
|
-
"chart",
|
|
20648
|
-
"home"
|
|
20649
|
-
];
|
|
20650
20698
|
var TABLE_TOOLBAR_ROW_CLASS = "flex min-h-8 min-w-0 shrink-0 flex-nowrap items-center gap-1.5 overflow-x-auto [scrollbar-width:none] [&::-webkit-scrollbar]:hidden";
|
|
20651
20699
|
var TABLE_PAGE_FRAME_CLASS = "flex h-full min-h-0 gap-4";
|
|
20652
20700
|
var TABLE_PAGE_COLUMN_CLASS = "flex min-h-0 min-w-0 flex-1 flex-col gap-2";
|
|
20653
|
-
function skeletonLayoutFor(layout) {
|
|
20654
|
-
if (layout === "board" || layout === "pipeline") return "kanban";
|
|
20655
|
-
return RECORDS_SKELETON_LAYOUTS.includes(layout ?? "") ? layout : "grid";
|
|
20656
|
-
}
|
|
20657
20701
|
var PLACEHOLDER_COLUMNS = ["a", "b", "c", "d", "e", "f"].map((id) => ({
|
|
20658
20702
|
id,
|
|
20659
20703
|
header: "",
|
|
@@ -20821,8 +20865,8 @@ function useWholeTableCount(args) {
|
|
|
20821
20865
|
// src/Grid.tsx
|
|
20822
20866
|
var import_react168 = require("react");
|
|
20823
20867
|
var import_react169 = require("@ai-matrx/records/react");
|
|
20824
|
-
var import_records45 = require("@ai-matrx/records");
|
|
20825
20868
|
var import_records46 = require("@ai-matrx/records");
|
|
20869
|
+
var import_records47 = require("@ai-matrx/records");
|
|
20826
20870
|
var import_data_table14 = require("@ai-matrx/design-system/data-table");
|
|
20827
20871
|
var import_core18 = require("@ai-matrx/records/core");
|
|
20828
20872
|
|
|
@@ -20861,7 +20905,7 @@ function useTableDecorations(tableId, revision) {
|
|
|
20861
20905
|
}
|
|
20862
20906
|
|
|
20863
20907
|
// src/emptyState.tsx
|
|
20864
|
-
var
|
|
20908
|
+
var import_records37 = require("@ai-matrx/records");
|
|
20865
20909
|
var import_design_system54 = require("@ai-matrx/design-system");
|
|
20866
20910
|
var import_format4 = require("@ai-matrx/kit/format");
|
|
20867
20911
|
var import_jsx_runtime62 = require("react/jsx-runtime");
|
|
@@ -20871,7 +20915,7 @@ function lockedRowsWords(count) {
|
|
|
20871
20915
|
function questionIsAsked(args) {
|
|
20872
20916
|
if ((args.search ?? "").trim() !== "") return true;
|
|
20873
20917
|
if (Object.values(args.columnFilters ?? {}).some((value) => value !== void 0 && value !== null)) return true;
|
|
20874
|
-
if (args.filter && (0,
|
|
20918
|
+
if (args.filter && (0, import_records37.stableFilterKey)(args.filter) !== "{}") return true;
|
|
20875
20919
|
return Boolean(args.ruled);
|
|
20876
20920
|
}
|
|
20877
20921
|
function emptyCauseOf(args) {
|
|
@@ -21831,7 +21875,7 @@ init_fieldTypes();
|
|
|
21831
21875
|
|
|
21832
21876
|
// src/gridColors.tsx
|
|
21833
21877
|
var import_react110 = require("react");
|
|
21834
|
-
var
|
|
21878
|
+
var import_records38 = require("@ai-matrx/records");
|
|
21835
21879
|
var import_react111 = require("@ai-matrx/records/react");
|
|
21836
21880
|
var import_design_system59 = require("@ai-matrx/design-system");
|
|
21837
21881
|
var import_data_table9 = require("@ai-matrx/design-system/data-table");
|
|
@@ -21897,7 +21941,7 @@ function useChoiceOptions(fields, keys) {
|
|
|
21897
21941
|
function lookOf(option) {
|
|
21898
21942
|
const raw = option.data?.["color"];
|
|
21899
21943
|
const color = typeof raw === "string" && import_data_table9.STYLE_COLORS.includes(raw) ? raw : void 0;
|
|
21900
|
-
return { id: String(option.id), key: (0,
|
|
21944
|
+
return { id: String(option.id), key: (0, import_records38.optionKey)(option), label: (0, import_records38.optionLabel)(option), ...color ? { color } : {} };
|
|
21901
21945
|
}
|
|
21902
21946
|
function paintByOption(style, _fields, index, lookup) {
|
|
21903
21947
|
if (index.size === 0) return { style, documentOf: (doc) => doc, choiceColorFor: lookup };
|
|
@@ -22364,7 +22408,7 @@ function ColourRulesDialog({
|
|
|
22364
22408
|
|
|
22365
22409
|
// src/gridRowLabel.tsx
|
|
22366
22410
|
var import_react112 = require("react");
|
|
22367
|
-
var
|
|
22411
|
+
var import_records39 = require("@ai-matrx/records");
|
|
22368
22412
|
var import_react113 = require("@ai-matrx/records/react");
|
|
22369
22413
|
var import_design_system60 = require("@ai-matrx/design-system");
|
|
22370
22414
|
init_names();
|
|
@@ -22422,7 +22466,7 @@ function RowLabelPicker({
|
|
|
22422
22466
|
const columns = labelColumns(fields);
|
|
22423
22467
|
const mayChange = kept?.can_change !== false;
|
|
22424
22468
|
const keptFormula = kept?.formula ?? null;
|
|
22425
|
-
const formulaTooLong = formula.trim().length >
|
|
22469
|
+
const formulaTooLong = formula.trim().length > import_records39.ROW_LABEL_FORMULA_MAX_LENGTH;
|
|
22426
22470
|
const formulaUnchanged = formula.trim() === (keptFormula ?? "").trim() && kept?.valid !== false;
|
|
22427
22471
|
const saveColumn = async () => {
|
|
22428
22472
|
setBusy(true);
|
|
@@ -22519,7 +22563,7 @@ function RowLabelPicker({
|
|
|
22519
22563
|
) : null,
|
|
22520
22564
|
formulaTooLong ? /* @__PURE__ */ (0, import_jsx_runtime69.jsxs)("p", { className: "text-[11px] text-foreground", children: [
|
|
22521
22565
|
"Up to ",
|
|
22522
|
-
|
|
22566
|
+
import_records39.ROW_LABEL_FORMULA_MAX_LENGTH,
|
|
22523
22567
|
" characters"
|
|
22524
22568
|
] }) : null
|
|
22525
22569
|
] }),
|
|
@@ -22543,7 +22587,7 @@ function RowLabelPicker({
|
|
|
22543
22587
|
type: "button",
|
|
22544
22588
|
size: "sm",
|
|
22545
22589
|
"data-records-row-label-save-formula": "",
|
|
22546
|
-
disabled: busy || !mayChange || (0,
|
|
22590
|
+
disabled: busy || !mayChange || (0, import_records39.clearsRowLabel)(formula) || formulaTooLong || formulaOk === false || formulaUnchanged,
|
|
22547
22591
|
onClick: () => void saveFormula(),
|
|
22548
22592
|
children: busy ? "Saving\u2026" : "Use this formula"
|
|
22549
22593
|
}
|
|
@@ -22711,7 +22755,7 @@ init_names();
|
|
|
22711
22755
|
// src/gridActions.tsx
|
|
22712
22756
|
var import_react116 = require("react");
|
|
22713
22757
|
var import_react117 = require("@ai-matrx/records/react");
|
|
22714
|
-
var
|
|
22758
|
+
var import_records40 = require("@ai-matrx/records");
|
|
22715
22759
|
var import_design_system62 = require("@ai-matrx/design-system");
|
|
22716
22760
|
init_Refusal();
|
|
22717
22761
|
init_names();
|
|
@@ -22796,7 +22840,7 @@ function useActionRunner(args) {
|
|
|
22796
22840
|
const answered = await client.actionRun({ action_id: action3.id, record_ids: ids });
|
|
22797
22841
|
setBusy(null);
|
|
22798
22842
|
if (!answered.ok) {
|
|
22799
|
-
const refusals = (0,
|
|
22843
|
+
const refusals = (0, import_records40.actionRefusals)(answered.error);
|
|
22800
22844
|
setOutcome({
|
|
22801
22845
|
kind: "refused",
|
|
22802
22846
|
action: action3,
|
|
@@ -23592,7 +23636,7 @@ init_writeOnTheWinningVersion();
|
|
|
23592
23636
|
// src/gridSummaries.tsx
|
|
23593
23637
|
var import_react120 = require("react");
|
|
23594
23638
|
var import_react121 = require("@ai-matrx/records/react");
|
|
23595
|
-
var
|
|
23639
|
+
var import_records41 = require("@ai-matrx/records");
|
|
23596
23640
|
var import_design_system65 = require("@ai-matrx/design-system");
|
|
23597
23641
|
init_parity();
|
|
23598
23642
|
init_names();
|
|
@@ -23642,8 +23686,8 @@ function useColumnSummaries(args) {
|
|
|
23642
23686
|
const why = {};
|
|
23643
23687
|
for (const [key, op2] of entries) {
|
|
23644
23688
|
const measure = op2 === "count" ? { op: "count" } : { op: op2, key };
|
|
23645
|
-
out[key] = row?.measures?.[(0,
|
|
23646
|
-
const notice = row?.withheld?.[(0,
|
|
23689
|
+
out[key] = row?.measures?.[(0, import_records41.measureKey)(measure)] ?? null;
|
|
23690
|
+
const notice = row?.withheld?.[(0, import_records41.measureKey)(measure)];
|
|
23647
23691
|
if (notice) why[key] = notice;
|
|
23648
23692
|
}
|
|
23649
23693
|
setValues(out);
|
|
@@ -25174,10 +25218,6 @@ var import_jsx_runtime79 = require("react/jsx-runtime");
|
|
|
25174
25218
|
function isEmptyValue(value) {
|
|
25175
25219
|
return value === null || value === void 0 || value === "" || Array.isArray(value) && value.length === 0;
|
|
25176
25220
|
}
|
|
25177
|
-
var ADDABLE_TYPES = STANDARD_TABLE_FIELD_CHOICES.map((choice) => ({
|
|
25178
|
-
value: choice.id,
|
|
25179
|
-
label: choice.label
|
|
25180
|
-
}));
|
|
25181
25221
|
var ADDABLE_TYPE_SET = new Set(ADDABLE_TYPES.map((t) => t.value));
|
|
25182
25222
|
function customFieldRequestProblems(requests, existingLabels) {
|
|
25183
25223
|
const problems = [];
|
|
@@ -26217,7 +26257,7 @@ function NewRecordControl({
|
|
|
26217
26257
|
// src/gridDrill.tsx
|
|
26218
26258
|
var import_react139 = require("react");
|
|
26219
26259
|
var import_react140 = require("@ai-matrx/records/react");
|
|
26220
|
-
var
|
|
26260
|
+
var import_records42 = require("@ai-matrx/records");
|
|
26221
26261
|
var import_data_table12 = require("@ai-matrx/design-system/data-table");
|
|
26222
26262
|
init_parity();
|
|
26223
26263
|
init_plainWords();
|
|
@@ -26487,7 +26527,7 @@ function useDrillAnswers(args) {
|
|
|
26487
26527
|
across: question.across ?? null,
|
|
26488
26528
|
show: question.show,
|
|
26489
26529
|
where: args.where,
|
|
26490
|
-
rule: args.rule && (0,
|
|
26530
|
+
rule: args.rule && (0, import_records42.isRuleFilter)(args.rule) ? args.rule : null,
|
|
26491
26531
|
window: question.window ?? null,
|
|
26492
26532
|
compare: question.compare ?? null,
|
|
26493
26533
|
windowKey: args.windowKey ?? null,
|
|
@@ -26752,7 +26792,7 @@ function trailClause(fields, w) {
|
|
|
26752
26792
|
}
|
|
26753
26793
|
function filterWithTrail(fields, base2, trail) {
|
|
26754
26794
|
if (trail.length === 0) return base2;
|
|
26755
|
-
if (!base2 || !(0,
|
|
26795
|
+
if (!base2 || !(0, import_records42.isRuleFilter)(base2)) {
|
|
26756
26796
|
const flat = { ...base2 ?? {} };
|
|
26757
26797
|
for (const w of trail) {
|
|
26758
26798
|
const clause = trailClause(fields, w);
|
|
@@ -26775,7 +26815,7 @@ function filterWithTrail(fields, base2, trail) {
|
|
|
26775
26815
|
return { op: "and", args };
|
|
26776
26816
|
}
|
|
26777
26817
|
function filterWithWindow(fields, base2, key, range) {
|
|
26778
|
-
if (!base2 || !(0,
|
|
26818
|
+
if (!base2 || !(0, import_records42.isRuleFilter)(base2)) return { ...base2 ?? {}, [key]: { from: range.from, to: range.to } };
|
|
26779
26819
|
const field2 = fields.find((f) => f.key === key);
|
|
26780
26820
|
if (!field2) return base2;
|
|
26781
26821
|
const ref = { field: field2.id };
|
|
@@ -26819,8 +26859,8 @@ function useGridDrillConfig(args) {
|
|
|
26819
26859
|
},
|
|
26820
26860
|
[setQuestion, onPresentationChange, presentation]
|
|
26821
26861
|
);
|
|
26822
|
-
const flat = state2.filter && !(0,
|
|
26823
|
-
const rule = state2.filter && (0,
|
|
26862
|
+
const flat = state2.filter && !(0, import_records42.isRuleFilter)(state2.filter) ? state2.filter : void 0;
|
|
26863
|
+
const rule = state2.filter && (0, import_records42.isRuleFilter)(state2.filter) ? filterWithTrailRuleOnly(state2) : void 0;
|
|
26824
26864
|
const { config } = useDrill({
|
|
26825
26865
|
source: state2.source,
|
|
26826
26866
|
question: state2.question,
|
|
@@ -27645,7 +27685,7 @@ function withTypeMark(field2, header) {
|
|
|
27645
27685
|
|
|
27646
27686
|
// src/ReverseColumns.tsx
|
|
27647
27687
|
var import_react143 = require("react");
|
|
27648
|
-
var
|
|
27688
|
+
var import_records43 = require("@ai-matrx/records");
|
|
27649
27689
|
|
|
27650
27690
|
// src/groupReads.ts
|
|
27651
27691
|
var import_first_page6 = require("@ai-matrx/records/first-page");
|
|
@@ -27798,7 +27838,7 @@ function useReverseField(tableId, column) {
|
|
|
27798
27838
|
if (column.read_only || !client) return;
|
|
27799
27839
|
let live = true;
|
|
27800
27840
|
void client.fields({ table_id: tableId, withReverse: true }).then((read) => {
|
|
27801
|
-
if (live && read.ok) setField(read.data.find((f) => f.key === column.key && (0,
|
|
27841
|
+
if (live && read.ok) setField(read.data.find((f) => f.key === column.key && (0, import_records43.isReverseField)(f)) ?? null);
|
|
27802
27842
|
});
|
|
27803
27843
|
return () => {
|
|
27804
27844
|
live = false;
|
|
@@ -28875,7 +28915,7 @@ function useStoreValueFacets(enabled, inputs) {
|
|
|
28875
28915
|
// src/gridGrouping.tsx
|
|
28876
28916
|
var import_react154 = require("react");
|
|
28877
28917
|
var import_react155 = require("@ai-matrx/records/react");
|
|
28878
|
-
var
|
|
28918
|
+
var import_records44 = require("@ai-matrx/records");
|
|
28879
28919
|
init_parity();
|
|
28880
28920
|
var import_jsx_runtime93 = require("react/jsx-runtime");
|
|
28881
28921
|
function groupValueKey(value) {
|
|
@@ -28913,8 +28953,8 @@ function useGroupFacts(args) {
|
|
|
28913
28953
|
const withheld = {};
|
|
28914
28954
|
for (const [fieldKey, op2] of entries) {
|
|
28915
28955
|
const m = op2 === "count" ? { op: "count" } : { op: op2, key: fieldKey };
|
|
28916
|
-
values[fieldKey] = row.measures?.[(0,
|
|
28917
|
-
const notice = row.withheld?.[(0,
|
|
28956
|
+
values[fieldKey] = row.measures?.[(0, import_records44.measureKey)(m)] ?? null;
|
|
28957
|
+
const notice = row.withheld?.[(0, import_records44.measureKey)(m)];
|
|
28918
28958
|
if (notice) withheld[fieldKey] = notice;
|
|
28919
28959
|
}
|
|
28920
28960
|
out.set(key, { count: typeof row.measures?.["count"] === "number" ? row.measures["count"] : row.row_count ?? null, measures: values, withheld });
|
|
@@ -29899,7 +29939,7 @@ init_recordVersions();
|
|
|
29899
29939
|
// src/handOrder.tsx
|
|
29900
29940
|
var import_react163 = require("react");
|
|
29901
29941
|
var import_react164 = require("@ai-matrx/records/react");
|
|
29902
|
-
var
|
|
29942
|
+
var import_records45 = require("@ai-matrx/records");
|
|
29903
29943
|
var import_design_system83 = require("@ai-matrx/design-system");
|
|
29904
29944
|
init_Refusal();
|
|
29905
29945
|
|
|
@@ -30023,7 +30063,7 @@ function useHandOrderRows(args) {
|
|
|
30023
30063
|
const client = (0, import_react164.useRecordsClient)();
|
|
30024
30064
|
const { viewId, active, page, pageSize } = args;
|
|
30025
30065
|
const filter = args.filter && Object.keys(args.filter).length > 0 ? args.filter : null;
|
|
30026
|
-
const filterKey = filter ? (0,
|
|
30066
|
+
const filterKey = filter ? (0, import_records45.stableFilterKey)(filter) : "";
|
|
30027
30067
|
const filterNow = (0, import_react163.useRef)(filter);
|
|
30028
30068
|
filterNow.current = filter;
|
|
30029
30069
|
const [answer, setAnswer] = (0, import_react163.useState)(null);
|
|
@@ -30186,6 +30226,8 @@ init_PickOne();
|
|
|
30186
30226
|
|
|
30187
30227
|
// src/viewAddress.ts
|
|
30188
30228
|
var import_react167 = require("react");
|
|
30229
|
+
|
|
30230
|
+
// src/viewAddressParams.ts
|
|
30189
30231
|
var VIEW_ADDRESS_KEYS = ["sort", "cf", "q", "hide", "page"];
|
|
30190
30232
|
function isViewAddressEmpty(state2) {
|
|
30191
30233
|
if (!state2) return true;
|
|
@@ -30239,6 +30281,8 @@ function viewAddressFromParams(get) {
|
|
|
30239
30281
|
function sameViewAddress(a, b) {
|
|
30240
30282
|
return JSON.stringify(viewAddressToParams(a)) === JSON.stringify(viewAddressToParams(b));
|
|
30241
30283
|
}
|
|
30284
|
+
|
|
30285
|
+
// src/viewAddress.ts
|
|
30242
30286
|
var ViewAddressContext = (0, import_react167.createContext)(null);
|
|
30243
30287
|
var useViewAddress = () => (0, import_react167.useContext)(ViewAddressContext);
|
|
30244
30288
|
|
|
@@ -30478,9 +30522,9 @@ function GridBody({
|
|
|
30478
30522
|
const pageAskedFor = (0, import_react168.useRef)(null);
|
|
30479
30523
|
if (fields.data && !table.loading) pageAskedFor.current = tableId;
|
|
30480
30524
|
const pageAsked = !storePaged || Boolean(fields.data) && pageAskedFor.current === tableId;
|
|
30481
|
-
const numberAsked = (0, import_react168.useMemo)(() => (0,
|
|
30525
|
+
const numberAsked = (0, import_react168.useMemo)(() => (0, import_records46.autonumberSearchOf)(fields.data ?? [], searchTerm), [fields.data, searchTerm]);
|
|
30482
30526
|
const pageSearch = numberAsked ? "" : searchTerm;
|
|
30483
|
-
const pageFilter = numberAsked ? (0,
|
|
30527
|
+
const pageFilter = numberAsked ? (0, import_records46.filterWithAutonumber)(readFilter, numberAsked.field, numberAsked.number) : readFilter;
|
|
30484
30528
|
const serverRead = (0, import_react169.useRecordPage)(storePaged && pageAsked ? tableId : null, {
|
|
30485
30529
|
pageSize: query.pageSize,
|
|
30486
30530
|
page: Math.max(0, query.page - 1),
|
|
@@ -30828,7 +30872,7 @@ function GridBody({
|
|
|
30828
30872
|
const names2 = wanted.get(field2.key) ?? [];
|
|
30829
30873
|
if (names2.length === 0) return;
|
|
30830
30874
|
const got = await client.relationNamesMatch({ table_id: field2.relation_target, names: names2 });
|
|
30831
|
-
if (got.ok) relationNames.current.set(field2.key, (0,
|
|
30875
|
+
if (got.ok) relationNames.current.set(field2.key, (0, import_records47.relationNameIndexOf)(got.data));
|
|
30832
30876
|
})
|
|
30833
30877
|
);
|
|
30834
30878
|
},
|
|
@@ -30907,7 +30951,7 @@ function GridBody({
|
|
|
30907
30951
|
field2.key,
|
|
30908
30952
|
lines2.flatMap((line) => {
|
|
30909
30953
|
const cell2 = line[at];
|
|
30910
|
-
return typeof cell2 === "string" ? (0,
|
|
30954
|
+
return typeof cell2 === "string" ? (0, import_records47.relationNamesIn)(field2, cell2) : [];
|
|
30911
30955
|
})
|
|
30912
30956
|
);
|
|
30913
30957
|
}
|
|
@@ -31194,7 +31238,7 @@ function GridBody({
|
|
|
31194
31238
|
tableName: table.data ? tableName(table.data) : "",
|
|
31195
31239
|
fields: fields.data ?? [],
|
|
31196
31240
|
document: row.document ?? {},
|
|
31197
|
-
level: (0,
|
|
31241
|
+
level: (0, import_records47.asPermissionLevel)(row.level)
|
|
31198
31242
|
}),
|
|
31199
31243
|
[host, tableId, table.data, fields.data]
|
|
31200
31244
|
);
|
|
@@ -33675,14 +33719,15 @@ function TableRenameDialog({
|
|
|
33675
33719
|
|
|
33676
33720
|
// src/TableSettings.tsx
|
|
33677
33721
|
var import_react193 = require("react");
|
|
33678
|
-
var
|
|
33722
|
+
var import_records49 = require("@ai-matrx/records");
|
|
33679
33723
|
|
|
33680
33724
|
// src/ArchiveDeliberately.tsx
|
|
33681
33725
|
var import_react183 = require("react");
|
|
33682
33726
|
var import_react184 = require("@ai-matrx/records/react");
|
|
33683
33727
|
var import_design_system90 = require("@ai-matrx/design-system");
|
|
33684
33728
|
init_plainWords();
|
|
33685
|
-
|
|
33729
|
+
|
|
33730
|
+
// src/codeDependsRefusal.ts
|
|
33686
33731
|
function codeDependsRefusal(error) {
|
|
33687
33732
|
if (!error) return null;
|
|
33688
33733
|
const d = error.detail;
|
|
@@ -33691,6 +33736,9 @@ function codeDependsRefusal(error) {
|
|
|
33691
33736
|
const declaredIn = Array.isArray(where) ? where.map(String).join(", ") : typeof where === "string" ? where : null;
|
|
33692
33737
|
return { slug: d["slug"], declaredIn };
|
|
33693
33738
|
}
|
|
33739
|
+
|
|
33740
|
+
// src/ArchiveDeliberately.tsx
|
|
33741
|
+
var import_jsx_runtime106 = require("react/jsx-runtime");
|
|
33694
33742
|
var MOST_PASSES = 500;
|
|
33695
33743
|
function ArchiveDeliberatelyDialog({ tableId, name, slug, declaredIn, open, onOpenChange, onArchived }) {
|
|
33696
33744
|
const client = (0, import_react184.useRecordsClient)();
|
|
@@ -33978,7 +34026,7 @@ function TableAccessLevel({ tableId, fields }) {
|
|
|
33978
34026
|
|
|
33979
34027
|
// src/RowControls.tsx
|
|
33980
34028
|
var import_react189 = require("react");
|
|
33981
|
-
var
|
|
34029
|
+
var import_records48 = require("@ai-matrx/records");
|
|
33982
34030
|
var import_react190 = require("@ai-matrx/records/react");
|
|
33983
34031
|
var import_design_system93 = require("@ai-matrx/design-system");
|
|
33984
34032
|
init_Refusal();
|
|
@@ -34008,7 +34056,7 @@ function ShownToSelect({
|
|
|
34008
34056
|
onChange,
|
|
34009
34057
|
testId
|
|
34010
34058
|
}) {
|
|
34011
|
-
return /* @__PURE__ */ (0, import_jsx_runtime109.jsxs)(import_design_system93.Select, { value, onValueChange: (next) => (0,
|
|
34059
|
+
return /* @__PURE__ */ (0, import_jsx_runtime109.jsxs)(import_design_system93.Select, { value, onValueChange: (next) => (0, import_records48.isShownTo)(next) ? onChange(next) : void 0, children: [
|
|
34012
34060
|
/* @__PURE__ */ (0, import_jsx_runtime109.jsxs)(
|
|
34013
34061
|
import_design_system93.SelectTrigger,
|
|
34014
34062
|
{
|
|
@@ -34022,7 +34070,7 @@ function ShownToSelect({
|
|
|
34022
34070
|
]
|
|
34023
34071
|
}
|
|
34024
34072
|
),
|
|
34025
|
-
/* @__PURE__ */ (0, import_jsx_runtime109.jsx)(import_design_system93.SelectContent, { children: allowed.map((word) => /* @__PURE__ */ (0, import_jsx_runtime109.jsx)(import_design_system93.SelectItem, { value: word, children:
|
|
34073
|
+
/* @__PURE__ */ (0, import_jsx_runtime109.jsx)(import_design_system93.SelectContent, { children: allowed.map((word) => /* @__PURE__ */ (0, import_jsx_runtime109.jsx)(import_design_system93.SelectItem, { value: word, children: import_records48.SHOWN_TO_LABEL[word] }, word)) })
|
|
34026
34074
|
] });
|
|
34027
34075
|
}
|
|
34028
34076
|
function NewRowsDefaults({ tableId }) {
|
|
@@ -34060,10 +34108,10 @@ function NewRowsDefaults({ tableId }) {
|
|
|
34060
34108
|
setError(null);
|
|
34061
34109
|
setApplied(appliedLine(answer.data));
|
|
34062
34110
|
};
|
|
34063
|
-
if (!(0,
|
|
34111
|
+
if (!(0, import_records48.levelHasShownTo)(table.data?.level)) return null;
|
|
34064
34112
|
if (!d) return error ? /* @__PURE__ */ (0, import_jsx_runtime109.jsx)(RefusalNotice, { error }) : null;
|
|
34065
34113
|
const shown5 = d.shown_to ?? d.effective.shown_to;
|
|
34066
|
-
const allowed = d.allowed_shown_to.filter(
|
|
34114
|
+
const allowed = d.allowed_shown_to.filter(import_records48.isShownTo);
|
|
34067
34115
|
return /* @__PURE__ */ (0, import_jsx_runtime109.jsxs)("section", { className: "flex flex-col gap-1.5", "data-testid": "new-rows-defaults", children: [
|
|
34068
34116
|
/* @__PURE__ */ (0, import_jsx_runtime109.jsx)("span", { className: "font-medium", children: ROW_CONTROL_WORDS.block }),
|
|
34069
34117
|
/* @__PURE__ */ (0, import_jsx_runtime109.jsxs)("div", { className: "flex items-center gap-2", children: [
|
|
@@ -34077,7 +34125,7 @@ function NewRowsDefaults({ tableId }) {
|
|
|
34077
34125
|
testId: "new-rows-shown-to",
|
|
34078
34126
|
onChange: (next) => void set({ shown_to: next })
|
|
34079
34127
|
}
|
|
34080
|
-
) : /* @__PURE__ */ (0, import_jsx_runtime109.jsx)("span", { "data-testid": "new-rows-shown-to-text", children:
|
|
34128
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime109.jsx)("span", { "data-testid": "new-rows-shown-to-text", children: import_records48.SHOWN_TO_LABEL[shown5] })
|
|
34081
34129
|
] }),
|
|
34082
34130
|
/* @__PURE__ */ (0, import_jsx_runtime109.jsxs)("div", { className: "flex items-center gap-2", "data-testid": "new-rows-published", children: [
|
|
34083
34131
|
/* @__PURE__ */ (0, import_jsx_runtime109.jsx)("span", { className: "min-w-fit flex-1 whitespace-nowrap", children: ROW_CONTROL_WORDS.publishedToWeb }),
|
|
@@ -34128,10 +34176,10 @@ function RowShownTo({ recordId, tableId }) {
|
|
|
34128
34176
|
}, [read]);
|
|
34129
34177
|
if (error && !c) return null;
|
|
34130
34178
|
if (tableId && table.loading && !table.data) return null;
|
|
34131
|
-
if (!(0,
|
|
34132
|
-
if (!c || c.shown_to.is_child || !(0,
|
|
34179
|
+
if (!(0, import_records48.levelHasShownTo)(table.data?.level)) return null;
|
|
34180
|
+
if (!c || c.shown_to.is_child || !(0, import_records48.isShownTo)(c.shown_to.effective)) return null;
|
|
34133
34181
|
const effective = c.shown_to.effective;
|
|
34134
|
-
const allowed = c.shown_to.allowed.filter(
|
|
34182
|
+
const allowed = c.shown_to.allowed.filter(import_records48.isShownTo);
|
|
34135
34183
|
return /* @__PURE__ */ (0, import_jsx_runtime109.jsxs)("span", { className: "inline-flex shrink-0 items-center", "data-testid": "row-shown-to", children: [
|
|
34136
34184
|
c.shown_to.can_change ? /* @__PURE__ */ (0, import_jsx_runtime109.jsx)(
|
|
34137
34185
|
ShownToSelect,
|
|
@@ -34158,7 +34206,7 @@ function RowShownTo({ recordId, tableId }) {
|
|
|
34158
34206
|
title: ROW_CONTROL_WORDS.whoMayChangeRow,
|
|
34159
34207
|
children: [
|
|
34160
34208
|
/* @__PURE__ */ (0, import_jsx_runtime109.jsx)("span", { className: "text-muted-foreground", children: ROW_CONTROL_WORDS.shownTo }),
|
|
34161
|
-
/* @__PURE__ */ (0, import_jsx_runtime109.jsx)("span", { "data-testid": "row-shown-to-text", children:
|
|
34209
|
+
/* @__PURE__ */ (0, import_jsx_runtime109.jsx)("span", { "data-testid": "row-shown-to-text", children: import_records48.SHOWN_TO_LABEL[effective] }),
|
|
34162
34210
|
/* @__PURE__ */ (0, import_jsx_runtime109.jsx)("span", { className: "sr-only", "data-testid": "row-shown-to-who", children: ROW_CONTROL_WORDS.whoMayChangeRow })
|
|
34163
34211
|
]
|
|
34164
34212
|
}
|
|
@@ -34526,7 +34574,7 @@ function TableSettingsPanel({
|
|
|
34526
34574
|
table.data ? /* @__PURE__ */ (0, import_jsx_runtime111.jsx)(TableFoundationSwitch, { tableId, table: table.data }) : null,
|
|
34527
34575
|
table.data ? /* @__PURE__ */ (0, import_jsx_runtime111.jsx)(TableAccessLevel, { tableId, fields: fields.data ?? [] }) : null,
|
|
34528
34576
|
/* @__PURE__ */ (0, import_jsx_runtime111.jsx)(import_design_system95.Separator, {}),
|
|
34529
|
-
(0,
|
|
34577
|
+
(0, import_records49.levelHasShownTo)(table.data?.level) ? /* @__PURE__ */ (0, import_jsx_runtime111.jsxs)(import_jsx_runtime111.Fragment, { children: [
|
|
34530
34578
|
/* @__PURE__ */ (0, import_jsx_runtime111.jsx)(NewRowsDefaults, { tableId }),
|
|
34531
34579
|
/* @__PURE__ */ (0, import_jsx_runtime111.jsx)(import_design_system95.Separator, {})
|
|
34532
34580
|
] }) : null,
|
|
@@ -34610,7 +34658,7 @@ function TableSettingsPanel({
|
|
|
34610
34658
|
|
|
34611
34659
|
// src/Peek.tsx
|
|
34612
34660
|
var import_react204 = require("react");
|
|
34613
|
-
var
|
|
34661
|
+
var import_records52 = require("@ai-matrx/records");
|
|
34614
34662
|
var import_react205 = require("@ai-matrx/records/react");
|
|
34615
34663
|
var import_react206 = require("@ai-matrx/alchemy/react");
|
|
34616
34664
|
|
|
@@ -34846,7 +34894,7 @@ init_Refusal();
|
|
|
34846
34894
|
|
|
34847
34895
|
// src/ValueAlternates.tsx
|
|
34848
34896
|
var import_react199 = require("react");
|
|
34849
|
-
var
|
|
34897
|
+
var import_records50 = require("@ai-matrx/records");
|
|
34850
34898
|
var import_react200 = require("@ai-matrx/records/react");
|
|
34851
34899
|
var import_text_case13 = require("@ai-matrx/kit/text-case");
|
|
34852
34900
|
var import_design_system97 = require("@ai-matrx/design-system");
|
|
@@ -34902,7 +34950,7 @@ function ValueAlternates({
|
|
|
34902
34950
|
async function use(index) {
|
|
34903
34951
|
setBusy(index);
|
|
34904
34952
|
setRefusal(null);
|
|
34905
|
-
const written = await (0,
|
|
34953
|
+
const written = await (0, import_records50.chooseAlternate)(client, { record_id: recordId, field_key: field2.key, alternate_index: index, ...shownList[index]?.rank !== void 0 ? { rank: shownList[index].rank } : {} });
|
|
34906
34954
|
setBusy(null);
|
|
34907
34955
|
if (!written.ok) return setRefusal(written.error);
|
|
34908
34956
|
setOpen(false);
|
|
@@ -35041,18 +35089,22 @@ init_names();
|
|
|
35041
35089
|
// src/RecordBody.tsx
|
|
35042
35090
|
var import_react202 = require("react");
|
|
35043
35091
|
var import_design_system99 = require("@ai-matrx/design-system");
|
|
35044
|
-
var import_records50 = require("@ai-matrx/records");
|
|
35045
35092
|
var import_react203 = require("@ai-matrx/records/react");
|
|
35046
35093
|
init_host();
|
|
35047
35094
|
init_recordVersions();
|
|
35048
35095
|
init_Refusal();
|
|
35049
35096
|
init_writeOnTheWinningVersion();
|
|
35050
|
-
|
|
35097
|
+
|
|
35098
|
+
// src/bodyField.ts
|
|
35099
|
+
var import_records51 = require("@ai-matrx/records");
|
|
35051
35100
|
var BODY_NAMES = /^(notes?|page|body|content|page content|details|description)$/i;
|
|
35052
35101
|
function bodyFieldOf(fields) {
|
|
35053
|
-
const rich2 = fields.filter((field2) => (0,
|
|
35102
|
+
const rich2 = fields.filter((field2) => (0, import_records51.newerKindOf)(field2) === "rich_text");
|
|
35054
35103
|
return rich2.find((field2) => BODY_NAMES.test((field2.label ?? field2.key).trim()) || BODY_NAMES.test(field2.key.replace(/_/g, " "))) ?? rich2[0];
|
|
35055
35104
|
}
|
|
35105
|
+
|
|
35106
|
+
// src/RecordBody.tsx
|
|
35107
|
+
var import_jsx_runtime116 = require("react/jsx-runtime");
|
|
35056
35108
|
var BODY_COLUMN_NAME = "Notes";
|
|
35057
35109
|
var BODY_SAVE_PAUSE_MS = 900;
|
|
35058
35110
|
function RecordBody({ tableId, recordId, className }) {
|
|
@@ -35176,7 +35228,7 @@ function Peek({ tableId, recordId, onClose, className, onPage = false }) {
|
|
|
35176
35228
|
if (record.error) return /* @__PURE__ */ (0, import_jsx_runtime117.jsx)(RefusalNotice, { error: record.error, className });
|
|
35177
35229
|
if (fields.error) return /* @__PURE__ */ (0, import_jsx_runtime117.jsx)(RefusalNotice, { error: fields.error, className });
|
|
35178
35230
|
const document2 = record.data?.document;
|
|
35179
|
-
if (document2 && (0,
|
|
35231
|
+
if (document2 && (0, import_records52.isLockedStub)({ document: document2, level: null })) {
|
|
35180
35232
|
const filed = document2["submitted_at"];
|
|
35181
35233
|
const when = typeof filed === "string" && !Number.isNaN(Date.parse(filed)) ? new Date(filed).toLocaleDateString("en-US", { year: "numeric", month: "short", day: "numeric" }) : null;
|
|
35182
35234
|
return /* @__PURE__ */ (0, import_jsx_runtime117.jsxs)("p", { className: (0, import_design_system100.cn)("text-sm text-muted-foreground", className), "data-records-locked-record": "", children: [
|
|
@@ -35521,7 +35573,7 @@ function lookAfterReset(look) {
|
|
|
35521
35573
|
// src/ViewSwitcher.tsx
|
|
35522
35574
|
var import_react237 = require("react");
|
|
35523
35575
|
var import_react238 = require("@ai-matrx/records/react");
|
|
35524
|
-
var
|
|
35576
|
+
var import_records57 = require("@ai-matrx/records");
|
|
35525
35577
|
var import_design_system113 = require("@ai-matrx/design-system");
|
|
35526
35578
|
var import_data_table22 = require("@ai-matrx/design-system/data-table");
|
|
35527
35579
|
var import_format10 = require("@ai-matrx/kit/format");
|
|
@@ -35725,7 +35777,7 @@ function MoveRefusedBadge({ refused }) {
|
|
|
35725
35777
|
// src/Pipeline.tsx
|
|
35726
35778
|
var import_react211 = require("react");
|
|
35727
35779
|
var import_react212 = require("@ai-matrx/records/react");
|
|
35728
|
-
var
|
|
35780
|
+
var import_records53 = require("@ai-matrx/records");
|
|
35729
35781
|
var import_design_system102 = require("@ai-matrx/design-system");
|
|
35730
35782
|
var import_data_table17 = require("@ai-matrx/design-system/data-table");
|
|
35731
35783
|
init_recordVersions();
|
|
@@ -35840,7 +35892,7 @@ function PipelineBoard({
|
|
|
35840
35892
|
alive.current = false;
|
|
35841
35893
|
};
|
|
35842
35894
|
}, []);
|
|
35843
|
-
const filterKey = (0,
|
|
35895
|
+
const filterKey = (0, import_records53.stableFilterKey)(filter);
|
|
35844
35896
|
const reload = (0, import_react211.useCallback)(async () => {
|
|
35845
35897
|
setLoading(true);
|
|
35846
35898
|
const [read, board, held] = await Promise.all([
|
|
@@ -36593,7 +36645,7 @@ function useRowColorBy(all, colorKey, style) {
|
|
|
36593
36645
|
}
|
|
36594
36646
|
|
|
36595
36647
|
// src/workedOutDate.ts
|
|
36596
|
-
var
|
|
36648
|
+
var import_records54 = require("@ai-matrx/records");
|
|
36597
36649
|
var WORKED_OUT_DATE_LOCK = "Worked out \xB7 can't move";
|
|
36598
36650
|
var INLINE_DEPTH = 8;
|
|
36599
36651
|
var configOf = (field2) => field2?.config ?? {};
|
|
@@ -36665,7 +36717,7 @@ function formulaResultKind(node, all) {
|
|
|
36665
36717
|
if (op2 === "fx.min" || op2 === "fx.max") {
|
|
36666
36718
|
return args.length > 0 && args.every((a) => formulaResultKind(a, all) === "date") ? "date" : "number";
|
|
36667
36719
|
}
|
|
36668
|
-
return
|
|
36720
|
+
return import_records54.FORMULA_NODE_RESULTS[op2] ?? "unknown";
|
|
36669
36721
|
}
|
|
36670
36722
|
function isDateFormula(field2, all) {
|
|
36671
36723
|
const expr = ownExpression(field2);
|
|
@@ -39252,13 +39304,13 @@ function ListRow({
|
|
|
39252
39304
|
// src/ChartLayout.tsx
|
|
39253
39305
|
var import_react232 = require("react");
|
|
39254
39306
|
var import_react233 = require("@ai-matrx/records/react");
|
|
39255
|
-
var
|
|
39307
|
+
var import_records56 = require("@ai-matrx/records");
|
|
39256
39308
|
var import_design_system110 = require("@ai-matrx/design-system");
|
|
39257
39309
|
|
|
39258
39310
|
// src/ChartBlock.tsx
|
|
39259
39311
|
var import_react231 = require("react");
|
|
39260
39312
|
var import_recharts = require("recharts");
|
|
39261
|
-
var
|
|
39313
|
+
var import_records55 = require("@ai-matrx/records");
|
|
39262
39314
|
var import_core20 = require("@ai-matrx/records/core");
|
|
39263
39315
|
var import_design_system109 = require("@ai-matrx/design-system");
|
|
39264
39316
|
var import_format9 = require("@ai-matrx/kit/format");
|
|
@@ -39740,7 +39792,7 @@ function ChartBlock({ block, subject, tableName: tableName2, className, centerVa
|
|
|
39740
39792
|
const kind2 = block.kind;
|
|
39741
39793
|
const tableId = block.table_id ?? subject;
|
|
39742
39794
|
const measures = block.measures && block.measures.length > 0 ? block.measures : [{ op: "count" }];
|
|
39743
|
-
const primary = (0,
|
|
39795
|
+
const primary = (0, import_records55.measureKey)(measures[0]);
|
|
39744
39796
|
const windows = kind2 === "stuck" ? null : block.compare ?? null;
|
|
39745
39797
|
const compared = !!windows;
|
|
39746
39798
|
const grain = block.bucket?.by ?? null;
|
|
@@ -40185,7 +40237,7 @@ var isChartKind = (v) => v === "bar" || v === "line" || v === "donut";
|
|
|
40185
40237
|
var isChartMeasure = (v) => v === "count" || v === "sum" || v === "avg";
|
|
40186
40238
|
function defaultChartGroup(fields) {
|
|
40187
40239
|
return fields.find((f) => {
|
|
40188
|
-
const kind2 = (0,
|
|
40240
|
+
const kind2 = (0, import_records56.fieldKindFor)(f);
|
|
40189
40241
|
return kind2 === "select" || kind2 === "multi_select";
|
|
40190
40242
|
})?.key ?? null;
|
|
40191
40243
|
}
|
|
@@ -40244,7 +40296,7 @@ function ChartLayout({ view, fields, filter, onChange, remembered }) {
|
|
|
40244
40296
|
}, [client, view.subject, view.name, qKey, filterKey]);
|
|
40245
40297
|
const groupable = fields.filter((f) => !["attachment", "file", "formula", "button"].includes(String(f.type)));
|
|
40246
40298
|
const numeric = fields.filter((f) => NUMBER_TYPES.has(String(f.type)));
|
|
40247
|
-
const pickMeasure = (0,
|
|
40299
|
+
const pickMeasure = (0, import_records56.measureKey)(q.measure);
|
|
40248
40300
|
return /* @__PURE__ */ (0, import_jsx_runtime130.jsxs)("div", { className: "flex min-h-0 flex-col gap-2", "data-records-chart-layout": "", "data-records-chart-measure": pickMeasure, children: [
|
|
40249
40301
|
/* @__PURE__ */ (0, import_jsx_runtime130.jsxs)("div", { className: "flex flex-wrap items-center gap-2 text-xs", children: [
|
|
40250
40302
|
/* @__PURE__ */ (0, import_jsx_runtime130.jsx)("span", { className: "text-muted-foreground", children: "Group by" }),
|
|
@@ -40893,7 +40945,7 @@ var NO_FIELDS2 = [];
|
|
|
40893
40945
|
function useViewRecords(view, pageSize = 200, filter, viewId) {
|
|
40894
40946
|
const client = (0, import_react238.useRecordsClient)();
|
|
40895
40947
|
const [limit, setLimit] = (0, import_react237.useState)(pageSize);
|
|
40896
|
-
const questionKey = `${view.subject}|${(0,
|
|
40948
|
+
const questionKey = `${view.subject}|${(0, import_records57.stableFilterKey)(filter ?? null)}|${JSON.stringify(view.sorts ?? [])}`;
|
|
40897
40949
|
(0, import_react237.useEffect)(() => {
|
|
40898
40950
|
setLimit(pageSize);
|
|
40899
40951
|
}, [questionKey, pageSize]);
|
|
@@ -40926,8 +40978,8 @@ function useViewRecords(view, pageSize = 200, filter, viewId) {
|
|
|
40926
40978
|
cancelled = true;
|
|
40927
40979
|
};
|
|
40928
40980
|
}, [client, ruleId, pageSize]);
|
|
40929
|
-
const asked4 = (0,
|
|
40930
|
-
const fromView = asked4 !== "{}" && (asked4 === (0,
|
|
40981
|
+
const asked4 = (0, import_records57.stableFilterKey)(filter ?? null);
|
|
40982
|
+
const fromView = asked4 !== "{}" && (asked4 === (0, import_records57.stableFilterKey)(view.where ?? null) || asked4 === (0, import_records57.stableFilterKey)(view.filters ?? null));
|
|
40931
40983
|
const tableRows = (0, import_react237.useMemo)(() => table.data?.rows ?? [], [table.data]);
|
|
40932
40984
|
const manual = view.order === "manual" && Boolean(viewId) && !ruleId;
|
|
40933
40985
|
const hand = useHandOrderRows({
|
|
@@ -42086,7 +42138,7 @@ function RecordCard({
|
|
|
42086
42138
|
/* @__PURE__ */ (0, import_jsx_runtime133.jsx)("span", { className: "block truncate", children: label }),
|
|
42087
42139
|
parentName ? /* @__PURE__ */ (0, import_jsx_runtime133.jsx)("span", { className: "block truncate text-muted-foreground", "data-records-card-parent": parentId ?? "", children: `Sub-item of ${parentName}` }) : null,
|
|
42088
42140
|
dates && dates.length > 0 ? /* @__PURE__ */ (0, import_jsx_runtime133.jsx)(CardDates, { record, fields: dates }) : null,
|
|
42089
|
-
(fields ?? []).filter((f) => (0,
|
|
42141
|
+
(fields ?? []).filter((f) => (0, import_records57.isButtonField)(f) || !isEmptyOnCard((record.document ?? {})[f.key]) || withheldNoticeOf(record.hidden, f.key)).map((f) => /* @__PURE__ */ (0, import_jsx_runtime133.jsx)("span", { className: "block truncate text-muted-foreground", "data-records-card-value": f.key, children: /* @__PURE__ */ (0, import_jsx_runtime133.jsx)(
|
|
42090
42142
|
RecordValue,
|
|
42091
42143
|
{
|
|
42092
42144
|
field: f,
|
|
@@ -42107,12 +42159,12 @@ function cardHiddenOf(presentation) {
|
|
|
42107
42159
|
}
|
|
42108
42160
|
var STATUS_WORDS = /^(status|stage|state|progress|phase)$/i;
|
|
42109
42161
|
function boardDefaultGroupField(eligible) {
|
|
42110
|
-
return eligible.find((f) => (0,
|
|
42162
|
+
return eligible.find((f) => (0, import_records57.newerKindOf)(f) === "status") ?? eligible.find((f) => STATUS_WORDS.test(fieldName(f).trim()) || STATUS_WORDS.test(f.key)) ?? eligible[0] ?? null;
|
|
42111
42163
|
}
|
|
42112
42164
|
|
|
42113
42165
|
// src/ArchivedView.tsx
|
|
42114
42166
|
var import_react239 = require("react");
|
|
42115
|
-
var
|
|
42167
|
+
var import_records58 = require("@ai-matrx/records");
|
|
42116
42168
|
var import_react240 = require("@ai-matrx/records/react");
|
|
42117
42169
|
var import_design_system114 = require("@ai-matrx/design-system");
|
|
42118
42170
|
init_Refusal();
|
|
@@ -42126,7 +42178,7 @@ function mayNotRestoreLine(why) {
|
|
|
42126
42178
|
return said2 === "" ? "Bringing a record back needs permission to edit this table. Ask somebody who has it." : said2;
|
|
42127
42179
|
}
|
|
42128
42180
|
function archivedRowLine(row, titleKey) {
|
|
42129
|
-
return `${recordName(row.document, titleKey)} \u2014 ${(0,
|
|
42181
|
+
return `${recordName(row.document, titleKey)} \u2014 ${(0, import_records58.archivedByLine)(row)}`;
|
|
42130
42182
|
}
|
|
42131
42183
|
function ArchivedView({
|
|
42132
42184
|
tableId,
|
|
@@ -42140,7 +42192,7 @@ function ArchivedView({
|
|
|
42140
42192
|
const table = (0, import_react240.useTable)(tableId);
|
|
42141
42193
|
const rights = useTableRights(table.data);
|
|
42142
42194
|
const fields = (0, import_react240.useFields)(tableId);
|
|
42143
|
-
const [lane, setLane] = (0, import_react239.useState)(laneFromHost ??
|
|
42195
|
+
const [lane, setLane] = (0, import_react239.useState)(laneFromHost ?? import_records58.DEFAULT_ARCHIVE_LANE);
|
|
42144
42196
|
const [rows, setRows] = (0, import_react239.useState)([]);
|
|
42145
42197
|
const [loading, setLoading] = (0, import_react239.useState)(true);
|
|
42146
42198
|
const [error, setError] = (0, import_react239.useState)(null);
|
|
@@ -42187,15 +42239,15 @@ function ArchivedView({
|
|
|
42187
42239
|
return /* @__PURE__ */ (0, import_jsx_runtime134.jsxs)("div", { className: (0, import_design_system114.cn)("flex min-h-0 flex-col gap-2", className), "data-testid": "archived-view", children: [
|
|
42188
42240
|
/* @__PURE__ */ (0, import_jsx_runtime134.jsxs)("div", { className: "flex flex-wrap items-center gap-2", children: [
|
|
42189
42241
|
/* @__PURE__ */ (0, import_jsx_runtime134.jsx)("span", { className: "text-sm font-medium", children: "Archived" }),
|
|
42190
|
-
/* @__PURE__ */ (0, import_jsx_runtime134.jsx)("div", { className: "ml-auto flex items-center gap-0.5", role: "group", "aria-label": "Archived by", children:
|
|
42242
|
+
/* @__PURE__ */ (0, import_jsx_runtime134.jsx)("div", { className: "ml-auto flex items-center gap-0.5", role: "group", "aria-label": "Archived by", children: import_records58.ARCHIVE_LANES.map((option) => /* @__PURE__ */ (0, import_jsx_runtime134.jsx)(
|
|
42191
42243
|
import_design_system114.Button,
|
|
42192
42244
|
{
|
|
42193
42245
|
size: "sm",
|
|
42194
42246
|
variant: option === lane ? "secondary" : "ghost",
|
|
42195
42247
|
"aria-pressed": option === lane,
|
|
42196
|
-
title:
|
|
42248
|
+
title: import_records58.ARCHIVE_LANE_MEANS[option],
|
|
42197
42249
|
onClick: () => pick(option),
|
|
42198
|
-
children:
|
|
42250
|
+
children: import_records58.ARCHIVE_LANE_LABEL[option]
|
|
42199
42251
|
},
|
|
42200
42252
|
option
|
|
42201
42253
|
)) })
|
|
@@ -42211,7 +42263,7 @@ function ArchivedView({
|
|
|
42211
42263
|
),
|
|
42212
42264
|
error ? /* @__PURE__ */ (0, import_jsx_runtime134.jsx)(RefusalNotice, { error }) : null,
|
|
42213
42265
|
loading && !error ? /* @__PURE__ */ (0, import_jsx_runtime134.jsx)(import_design_system114.Skeleton, { className: "h-24 w-full" }) : null,
|
|
42214
|
-
!loading && !error && rows.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime134.jsx)("p", { "data-testid": "archived-empty", className: "rounded-md border border-dashed px-3 py-6 text-xs text-muted-foreground", children: (0,
|
|
42266
|
+
!loading && !error && rows.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime134.jsx)("p", { "data-testid": "archived-empty", className: "rounded-md border border-dashed px-3 py-6 text-xs text-muted-foreground", children: (0, import_records58.emptyArchiveLine)(lane) }) : null,
|
|
42215
42267
|
!loading && !error && rows.length > 0 ? /* @__PURE__ */ (0, import_jsx_runtime134.jsx)("ul", { className: "flex flex-col gap-1", "data-testid": "archived-rows", children: rows.map((row) => /* @__PURE__ */ (0, import_jsx_runtime134.jsxs)(
|
|
42216
42268
|
"li",
|
|
42217
42269
|
{
|
|
@@ -42221,7 +42273,7 @@ function ArchivedView({
|
|
|
42221
42273
|
children: [
|
|
42222
42274
|
/* @__PURE__ */ (0, import_jsx_runtime134.jsxs)("div", { className: "flex min-w-0 flex-1 flex-col", children: [
|
|
42223
42275
|
/* @__PURE__ */ (0, import_jsx_runtime134.jsx)("span", { className: "truncate text-sm", children: recordName(row.document, titleKey) }),
|
|
42224
|
-
/* @__PURE__ */ (0, import_jsx_runtime134.jsx)("span", { className: "truncate text-xs text-muted-foreground", "data-testid": "archived-who", children: (0,
|
|
42276
|
+
/* @__PURE__ */ (0, import_jsx_runtime134.jsx)("span", { className: "truncate text-xs text-muted-foreground", "data-testid": "archived-who", children: (0, import_records58.archivedByLine)(row) }),
|
|
42225
42277
|
refusal3 && refusal3.recordId === row.id ? /* @__PURE__ */ (0, import_jsx_runtime134.jsx)(RefusalNotice, { error: refusal3.error, className: "mt-2" }) : null
|
|
42226
42278
|
] }),
|
|
42227
42279
|
mayRestore ? /* @__PURE__ */ (0, import_jsx_runtime134.jsx)(
|
|
@@ -42244,7 +42296,7 @@ function ArchivedView({
|
|
|
42244
42296
|
] });
|
|
42245
42297
|
}
|
|
42246
42298
|
function retiredColumnLine(row) {
|
|
42247
|
-
return (0,
|
|
42299
|
+
return (0, import_records58.archivedByLine)(row);
|
|
42248
42300
|
}
|
|
42249
42301
|
function RetiredColumns({ tableId, mayRestore, whyNot }) {
|
|
42250
42302
|
const client = (0, import_react240.useRecordsClient)();
|
|
@@ -42308,7 +42360,7 @@ function RetiredColumns({ tableId, mayRestore, whyNot }) {
|
|
|
42308
42360
|
|
|
42309
42361
|
// src/ArchivedDisclosure.tsx
|
|
42310
42362
|
var import_react241 = require("react");
|
|
42311
|
-
var
|
|
42363
|
+
var import_records59 = require("@ai-matrx/records");
|
|
42312
42364
|
var import_react242 = require("@ai-matrx/records/react");
|
|
42313
42365
|
var import_design_system115 = require("@ai-matrx/design-system");
|
|
42314
42366
|
init_Refusal();
|
|
@@ -42409,10 +42461,10 @@ function ArchivedPortals({
|
|
|
42409
42461
|
error ? /* @__PURE__ */ (0, import_jsx_runtime135.jsx)(RefusalNotice, { error }) : null,
|
|
42410
42462
|
rows === null && !error ? /* @__PURE__ */ (0, import_jsx_runtime135.jsx)(import_design_system115.Skeleton, { className: "h-16 w-full" }) : null,
|
|
42411
42463
|
said2 ? /* @__PURE__ */ (0, import_jsx_runtime135.jsx)("p", { className: "rounded-md border border-border px-3 py-2 text-xs", "data-testid": "archived-portal-said", children: said2 }) : null,
|
|
42412
|
-
rows !== null && !error && rows.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime135.jsx)("p", { "data-testid": "archived-portals-empty", className: "text-xs text-muted-foreground", children: (0,
|
|
42464
|
+
rows !== null && !error && rows.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime135.jsx)("p", { "data-testid": "archived-portals-empty", className: "text-xs text-muted-foreground", children: (0, import_records59.emptyPortalArchiveLine)() }) : null,
|
|
42413
42465
|
rows !== null && rows.length > 0 ? /* @__PURE__ */ (0, import_jsx_runtime135.jsx)("ul", { className: "flex flex-col gap-1.5", "data-testid": "archived-portals", children: rows.map((portal) => {
|
|
42414
42466
|
const asking = confirming === portal.portal_id;
|
|
42415
|
-
const matches2 = (0,
|
|
42467
|
+
const matches2 = (0, import_records59.portalTitleTypedBack)(typed2, portal.title);
|
|
42416
42468
|
return /* @__PURE__ */ (0, import_jsx_runtime135.jsxs)(
|
|
42417
42469
|
"li",
|
|
42418
42470
|
{
|
|
@@ -42451,7 +42503,7 @@ function ArchivedPortals({
|
|
|
42451
42503
|
] }),
|
|
42452
42504
|
asking ? /* @__PURE__ */ (0, import_jsx_runtime135.jsxs)("div", { className: "flex flex-col gap-1.5", children: [
|
|
42453
42505
|
/* @__PURE__ */ (0, import_jsx_runtime135.jsxs)("p", { className: "text-xs text-muted-foreground", children: [
|
|
42454
|
-
(0,
|
|
42506
|
+
(0, import_records59.portalConfirmLine)(portal.title),
|
|
42455
42507
|
" Restoring it puts it back exactly as it was: everyone who was invited can sign in again, and it shows the same Tables."
|
|
42456
42508
|
] }),
|
|
42457
42509
|
/* @__PURE__ */ (0, import_jsx_runtime135.jsxs)("div", { className: "flex flex-wrap items-center gap-1.5", children: [
|
|
@@ -44917,7 +44969,7 @@ init_Refusal();
|
|
|
44917
44969
|
|
|
44918
44970
|
// src/AsOfReading.tsx
|
|
44919
44971
|
var import_react253 = require("react");
|
|
44920
|
-
var
|
|
44972
|
+
var import_records60 = require("@ai-matrx/records");
|
|
44921
44973
|
var import_react254 = require("@ai-matrx/records/react");
|
|
44922
44974
|
var import_design_system120 = require("@ai-matrx/design-system");
|
|
44923
44975
|
var import_controls7 = require("@ai-matrx/design-system/controls");
|
|
@@ -44942,7 +44994,7 @@ function asOfArgs(record_id, asOf, zone = getPersonTimeZone()) {
|
|
|
44942
44994
|
return asOf.clock === "recorded" ? { record_id, recorded_at: endOfDayIso(asOf.day, zone) } : { record_id, world_on: asOf.day };
|
|
44943
44995
|
}
|
|
44944
44996
|
function AsOfControl({ value, onChange, className }) {
|
|
44945
|
-
const [text, setText] = (0, import_react253.useState)(value ? (0,
|
|
44997
|
+
const [text, setText] = (0, import_react253.useState)(value ? (0, import_records60.typedDateText)(value.day) : "");
|
|
44946
44998
|
const [bad, setBad] = (0, import_react253.useState)(false);
|
|
44947
44999
|
usePersonTimeZone();
|
|
44948
45000
|
const clock = value?.clock ?? "recorded";
|
|
@@ -44952,13 +45004,13 @@ function AsOfControl({ value, onChange, className }) {
|
|
|
44952
45004
|
onChange(null);
|
|
44953
45005
|
return;
|
|
44954
45006
|
}
|
|
44955
|
-
const read = (0,
|
|
45007
|
+
const read = (0, import_records60.readTypedDate)(words2);
|
|
44956
45008
|
if (!read.ok) {
|
|
44957
45009
|
setBad(true);
|
|
44958
45010
|
return;
|
|
44959
45011
|
}
|
|
44960
45012
|
setBad(false);
|
|
44961
|
-
setText((0,
|
|
45013
|
+
setText((0, import_records60.typedDateText)(read.day));
|
|
44962
45014
|
onChange({ day: read.day, clock });
|
|
44963
45015
|
}
|
|
44964
45016
|
return /* @__PURE__ */ (0, import_jsx_runtime140.jsxs)("div", { className: (0, import_design_system120.cn)("flex h-6 items-center gap-1", className), "data-records-as-of": "", children: [
|
|
@@ -45063,7 +45115,7 @@ function AsOfReading({
|
|
|
45063
45115
|
if (answer.doc === null) {
|
|
45064
45116
|
return /* @__PURE__ */ (0, import_jsx_runtime140.jsxs)("p", { className: (0, import_design_system120.cn)(box, "p-2 text-xs text-muted-foreground"), "data-records-as-of-none": "", children: [
|
|
45065
45117
|
"Not there on ",
|
|
45066
|
-
(0,
|
|
45118
|
+
(0, import_records60.typedDateText)(asOf.day)
|
|
45067
45119
|
] });
|
|
45068
45120
|
}
|
|
45069
45121
|
return /* @__PURE__ */ (0, import_jsx_runtime140.jsx)("dl", { className: (0, import_design_system120.cn)(box, "grid grid-cols-[minmax(5rem,9rem)_1fr] content-start gap-x-3 gap-y-0.5 p-2 text-[11px]"), "data-records-as-of-reading": "", children: rows.map(({ field: field2, was, now, differs }) => /* @__PURE__ */ (0, import_jsx_runtime140.jsxs)("div", { className: "contents", "data-as-of-field": field2.key, "data-as-of-differs": differs ? "" : void 0, children: [
|
|
@@ -46617,7 +46669,7 @@ function clientNoun(table) {
|
|
|
46617
46669
|
var import_clipboard8 = require("@ai-matrx/kit/clipboard");
|
|
46618
46670
|
var import_react269 = require("react");
|
|
46619
46671
|
var import_react270 = require("@ai-matrx/records/react");
|
|
46620
|
-
var
|
|
46672
|
+
var import_records61 = require("@ai-matrx/records");
|
|
46621
46673
|
var import_design_system129 = require("@ai-matrx/design-system");
|
|
46622
46674
|
init_BuildOrAsk();
|
|
46623
46675
|
|
|
@@ -47065,7 +47117,7 @@ function PortalsPanel({ tableId, activePortalId, className }) {
|
|
|
47065
47117
|
] }) : null,
|
|
47066
47118
|
activePortalId && !shown5.some((p) => p.portal_id === activePortalId) ? /* @__PURE__ */ (0, import_jsx_runtime149.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,
|
|
47067
47119
|
/* @__PURE__ */ (0, import_jsx_runtime149.jsx)("ul", { className: "flex flex-col gap-2", children: shown5.map((portal) => {
|
|
47068
|
-
const url = `${origin}${(0,
|
|
47120
|
+
const url = `${origin}${(0, import_records61.portalPath)(portal.slug)}`;
|
|
47069
47121
|
const open = openId === portal.portal_id;
|
|
47070
47122
|
const linked = portal.portal_id === activePortalId;
|
|
47071
47123
|
return /* @__PURE__ */ (0, import_jsx_runtime149.jsxs)(
|
|
@@ -47180,8 +47232,8 @@ function ArchivePortalControl({
|
|
|
47180
47232
|
}
|
|
47181
47233
|
),
|
|
47182
47234
|
asking ? /* @__PURE__ */ (0, import_jsx_runtime149.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: [
|
|
47183
|
-
/* @__PURE__ */ (0, import_jsx_runtime149.jsx)("p", { className: "text-xs text-muted-foreground", "data-testid": "portal-archive-consequence", children: (0,
|
|
47184
|
-
/* @__PURE__ */ (0, import_jsx_runtime149.jsx)("p", { className: "text-xs text-muted-foreground", children: (0,
|
|
47235
|
+
/* @__PURE__ */ (0, import_jsx_runtime149.jsx)("p", { className: "text-xs text-muted-foreground", "data-testid": "portal-archive-consequence", children: (0, import_records61.portalArchiveConsequence)(portal.title, portal.signed_in, portal.invited) }),
|
|
47236
|
+
/* @__PURE__ */ (0, import_jsx_runtime149.jsx)("p", { className: "text-xs text-muted-foreground", children: (0, import_records61.portalConfirmLine)(portal.title) }),
|
|
47185
47237
|
/* @__PURE__ */ (0, import_jsx_runtime149.jsxs)("div", { className: "flex flex-wrap items-center gap-1.5", children: [
|
|
47186
47238
|
/* @__PURE__ */ (0, import_jsx_runtime149.jsx)(
|
|
47187
47239
|
import_design_system129.BasicInput,
|
|
@@ -47199,7 +47251,7 @@ function ArchivePortalControl({
|
|
|
47199
47251
|
size: "sm",
|
|
47200
47252
|
variant: "destructive",
|
|
47201
47253
|
"data-testid": "portal-archive-do",
|
|
47202
|
-
disabled: busy || !(0,
|
|
47254
|
+
disabled: busy || !(0, import_records61.portalTitleTypedBack)(typed2, portal.title),
|
|
47203
47255
|
onClick: () => void go(),
|
|
47204
47256
|
children: busy ? "Archiving\u2026" : "Archive it"
|
|
47205
47257
|
}
|
|
@@ -47724,7 +47776,7 @@ function FormLookFrame({ look, title, children, contained = false, showOwnerHead
|
|
|
47724
47776
|
// src/DigestScheduler.tsx
|
|
47725
47777
|
var import_react271 = require("react");
|
|
47726
47778
|
var import_react272 = require("@ai-matrx/records/react");
|
|
47727
|
-
var
|
|
47779
|
+
var import_records62 = require("@ai-matrx/records");
|
|
47728
47780
|
var import_design_system131 = require("@ai-matrx/design-system");
|
|
47729
47781
|
var import_controls9 = require("@ai-matrx/design-system/controls");
|
|
47730
47782
|
init_Refusal();
|
|
@@ -47815,7 +47867,7 @@ function DigestScheduler({
|
|
|
47815
47867
|
const [channel, setChannel] = (0, import_react271.useState)(
|
|
47816
47868
|
existing?.channel === "email" || existing?.channel === "sms" ? existing.channel : "in_app"
|
|
47817
47869
|
);
|
|
47818
|
-
const [quiet2, setQuiet] = (0, import_react271.useState)((0,
|
|
47870
|
+
const [quiet2, setQuiet] = (0, import_react271.useState)((0, import_records62.hasQuietHours)(existing?.quiet_hours));
|
|
47819
47871
|
const [quietFrom, setQuietFrom] = (0, import_react271.useState)(existing?.quiet_hours?.start ?? "22:00");
|
|
47820
47872
|
const [quietTo, setQuietTo] = (0, import_react271.useState)(existing?.quiet_hours?.end ?? "07:00");
|
|
47821
47873
|
const [recipients, setRecipients] = (0, import_react271.useState)(
|
|
@@ -48104,7 +48156,7 @@ function DigestScheduler({
|
|
|
48104
48156
|
// src/SubscriptionsPanel.tsx
|
|
48105
48157
|
var import_react275 = require("react");
|
|
48106
48158
|
var import_react276 = require("@ai-matrx/records/react");
|
|
48107
|
-
var
|
|
48159
|
+
var import_records63 = require("@ai-matrx/records");
|
|
48108
48160
|
var import_design_system133 = require("@ai-matrx/design-system");
|
|
48109
48161
|
init_BuildOrAsk();
|
|
48110
48162
|
init_Refusal();
|
|
@@ -48474,7 +48526,7 @@ function SubscriptionsPanel({ tableId, activeRuleId, className }) {
|
|
|
48474
48526
|
"Last told you ",
|
|
48475
48527
|
new Date(subscription.last_sent_at).toLocaleString()
|
|
48476
48528
|
] }) : /* @__PURE__ */ (0, import_jsx_runtime153.jsx)("span", { children: "It has not told you anything yet." }),
|
|
48477
|
-
(0,
|
|
48529
|
+
(0, import_records63.hasQuietHours)(subscription.quiet_hours) ? /* @__PURE__ */ (0, import_jsx_runtime153.jsxs)("span", { children: [
|
|
48478
48530
|
"Not between ",
|
|
48479
48531
|
subscription.quiet_hours.start,
|
|
48480
48532
|
" and ",
|
|
@@ -48549,7 +48601,7 @@ var import_core22 = require("@dnd-kit/core");
|
|
|
48549
48601
|
var import_sortable2 = require("@dnd-kit/sortable");
|
|
48550
48602
|
var import_utilities2 = require("@dnd-kit/utilities");
|
|
48551
48603
|
var import_react281 = require("@ai-matrx/records/react");
|
|
48552
|
-
var
|
|
48604
|
+
var import_records64 = require("@ai-matrx/records");
|
|
48553
48605
|
var import_design_system137 = require("@ai-matrx/design-system");
|
|
48554
48606
|
|
|
48555
48607
|
// src/FormFlowEditor.tsx
|
|
@@ -49891,7 +49943,7 @@ function FormBuilder({ tableId, seed, activeFormId, onActiveForm, startWithOne,
|
|
|
49891
49943
|
/* @__PURE__ */ (0, import_jsx_runtime156.jsx)(
|
|
49892
49944
|
PublishRow,
|
|
49893
49945
|
{
|
|
49894
|
-
url: `${publicOrigin}${(0,
|
|
49946
|
+
url: `${publicOrigin}${(0, import_records64.publicFormPath)(draft.id)}`,
|
|
49895
49947
|
state: draft.state,
|
|
49896
49948
|
mayPublish: rights.structure,
|
|
49897
49949
|
why: rights.why("structure"),
|
|
@@ -49903,7 +49955,7 @@ function FormBuilder({ tableId, seed, activeFormId, onActiveForm, startWithOne,
|
|
|
49903
49955
|
unsaved: dirty
|
|
49904
49956
|
}
|
|
49905
49957
|
),
|
|
49906
|
-
/* @__PURE__ */ (0, import_jsx_runtime156.jsx)(EmbedSnippets, { url: `${publicOrigin}${(0,
|
|
49958
|
+
/* @__PURE__ */ (0, import_jsx_runtime156.jsx)(EmbedSnippets, { url: `${publicOrigin}${(0, import_records64.publicFormPath)(draft.id)}`, label: draft.name }),
|
|
49907
49959
|
/* @__PURE__ */ (0, import_jsx_runtime156.jsx)(
|
|
49908
49960
|
NotifyOnAnswer,
|
|
49909
49961
|
{
|
|
@@ -50972,7 +51024,7 @@ function SignBlock({ tableId, recordId, render, className }) {
|
|
|
50972
51024
|
// src/NotifyRuleEditor.tsx
|
|
50973
51025
|
var import_react289 = require("react");
|
|
50974
51026
|
var import_react290 = require("@ai-matrx/records/react");
|
|
50975
|
-
var
|
|
51027
|
+
var import_records65 = require("@ai-matrx/records");
|
|
50976
51028
|
var import_design_system141 = require("@ai-matrx/design-system");
|
|
50977
51029
|
var import_controls11 = require("@ai-matrx/design-system/controls");
|
|
50978
51030
|
init_Refusal();
|
|
@@ -51130,7 +51182,7 @@ function NotifyRuleEditor({ tableId, seed, chosenRuleId, onChoose, className })
|
|
|
51130
51182
|
"next ",
|
|
51131
51183
|
new Date(held.next_digest_at).toLocaleString()
|
|
51132
51184
|
] }) : null,
|
|
51133
|
-
(0,
|
|
51185
|
+
(0, import_records65.hasQuietHours)(held.quiet_hours) ? /* @__PURE__ */ (0, import_jsx_runtime160.jsxs)("span", { className: "text-muted-foreground", children: [
|
|
51134
51186
|
"quiet ",
|
|
51135
51187
|
held.quiet_hours.start,
|
|
51136
51188
|
"\u2013",
|
|
@@ -51536,7 +51588,7 @@ function AddChart({ subject, onAdd, onClose }) {
|
|
|
51536
51588
|
var import_controls13 = require("@ai-matrx/design-system/controls");
|
|
51537
51589
|
|
|
51538
51590
|
// src/pages.ts
|
|
51539
|
-
var
|
|
51591
|
+
var import_records66 = require("@ai-matrx/records");
|
|
51540
51592
|
var PAGE_BLOCK_KINDS = [
|
|
51541
51593
|
"list",
|
|
51542
51594
|
"layout",
|
|
@@ -51632,10 +51684,10 @@ function filterTargets(filter, blocks) {
|
|
|
51632
51684
|
}
|
|
51633
51685
|
function combineFilter(base2, extra, fieldIdOf) {
|
|
51634
51686
|
const extraKeys = Object.keys(extra);
|
|
51635
|
-
if (!base2 || !(0,
|
|
51687
|
+
if (!base2 || !(0, import_records66.isRuleFilter)(base2) && Object.keys(base2).length === 0) {
|
|
51636
51688
|
return { filter: extraKeys.length > 0 ? { ...extra } : null, dropped: [] };
|
|
51637
51689
|
}
|
|
51638
|
-
if (!(0,
|
|
51690
|
+
if (!(0, import_records66.isRuleFilter)(base2)) return { filter: { ...base2, ...extra }, dropped: [] };
|
|
51639
51691
|
const dropped = [];
|
|
51640
51692
|
let rule = base2;
|
|
51641
51693
|
for (const key of extraKeys) {
|
|
@@ -53033,7 +53085,7 @@ function QuestionAnswerView({ tableId, spec, answer, fields, related = NO_RELATE
|
|
|
53033
53085
|
var import_react297 = require("react");
|
|
53034
53086
|
var import_format13 = require("@ai-matrx/kit/format");
|
|
53035
53087
|
var import_design_system146 = require("@ai-matrx/design-system");
|
|
53036
|
-
var
|
|
53088
|
+
var import_records67 = require("@ai-matrx/records");
|
|
53037
53089
|
var import_react298 = require("@ai-matrx/records/react");
|
|
53038
53090
|
init_recordVersions();
|
|
53039
53091
|
|
|
@@ -53281,7 +53333,7 @@ function TableAsk({ tableId, onOpenInQuestions, viewId }) {
|
|
|
53281
53333
|
await Promise.all(
|
|
53282
53334
|
all.filter(isChoiceField).map(async (field2) => {
|
|
53283
53335
|
const got = await (0, askOnce_exports.fieldOptionsOnce)(client, field2.id);
|
|
53284
|
-
if (got.ok) choices[field2.key] = (got.data ?? []).map((o) => (0,
|
|
53336
|
+
if (got.ok) choices[field2.key] = (got.data ?? []).map((o) => (0, import_records67.optionLabel)(o)).filter((w) => Boolean(w));
|
|
53285
53337
|
})
|
|
53286
53338
|
);
|
|
53287
53339
|
const read = questionFromWords(words2, all, choices);
|
|
@@ -55179,7 +55231,7 @@ function InterfaceScreen({
|
|
|
55179
55231
|
var import_clipboard12 = require("@ai-matrx/kit/clipboard");
|
|
55180
55232
|
var import_react305 = require("react");
|
|
55181
55233
|
var import_react306 = require("@ai-matrx/records/react");
|
|
55182
|
-
var
|
|
55234
|
+
var import_records68 = require("@ai-matrx/records");
|
|
55183
55235
|
var import_design_system151 = require("@ai-matrx/design-system");
|
|
55184
55236
|
init_BuildOrAsk();
|
|
55185
55237
|
init_BuiltOnArchive();
|
|
@@ -55289,7 +55341,7 @@ function FormsPanel({ tableId, activeFormId, className }) {
|
|
|
55289
55341
|
}
|
|
55290
55342
|
) : null,
|
|
55291
55343
|
/* @__PURE__ */ (0, import_jsx_runtime170.jsx)("ul", { className: "flex flex-col gap-2", children: forms.map((form) => {
|
|
55292
|
-
const url = `${origin}${(0,
|
|
55344
|
+
const url = `${origin}${(0, import_records68.publicFormPath)(form.form_id)}`;
|
|
55293
55345
|
return /* @__PURE__ */ (0, import_jsx_runtime170.jsxs)(
|
|
55294
55346
|
"li",
|
|
55295
55347
|
{
|
|
@@ -55380,7 +55432,7 @@ init_plainWords();
|
|
|
55380
55432
|
|
|
55381
55433
|
// src/CaptureRun.tsx
|
|
55382
55434
|
var import_react307 = require("react");
|
|
55383
|
-
var
|
|
55435
|
+
var import_records69 = require("@ai-matrx/records");
|
|
55384
55436
|
var import_react308 = require("@ai-matrx/records/react");
|
|
55385
55437
|
var import_design_system152 = require("@ai-matrx/design-system");
|
|
55386
55438
|
init_host();
|
|
@@ -55438,7 +55490,7 @@ function CaptureRun({ sheetId, face: given, className }) {
|
|
|
55438
55490
|
const [sending, setSending] = (0, import_react307.useState)(false);
|
|
55439
55491
|
const queueRef = (0, import_react307.useRef)(null);
|
|
55440
55492
|
(0, import_react307.useEffect)(() => {
|
|
55441
|
-
const q2 = (0,
|
|
55493
|
+
const q2 = (0, import_records69.openCaptureQueue)({
|
|
55442
55494
|
onChange: (c, all) => {
|
|
55443
55495
|
setCounts(c);
|
|
55444
55496
|
setItems(all);
|
|
@@ -55705,7 +55757,7 @@ function CaptureRun({ sheetId, face: given, className }) {
|
|
|
55705
55757
|
value: String(answers2[q.field] ?? ""),
|
|
55706
55758
|
onChange: (e) => {
|
|
55707
55759
|
const raw = e.target.value;
|
|
55708
|
-
const answered2 = field2 ? (0,
|
|
55760
|
+
const answered2 = field2 ? (0, import_records69.coerceTypedAnswer)(field2, raw, { label: q.ask ?? (0, import_records69.coercionLabel)(field2) }) : { value: raw };
|
|
55709
55761
|
setAnswers((held) => ({
|
|
55710
55762
|
...held,
|
|
55711
55763
|
[q.field]: raw === "" ? "" : "refusal" in answered2 ? raw : answered2.value
|
|
@@ -56357,7 +56409,7 @@ init_WhereItLives();
|
|
|
56357
56409
|
// src/TablePage.tsx
|
|
56358
56410
|
var import_clipboard17 = require("@ai-matrx/kit/clipboard");
|
|
56359
56411
|
var import_react329 = require("react");
|
|
56360
|
-
var
|
|
56412
|
+
var import_records70 = require("@ai-matrx/records");
|
|
56361
56413
|
var import_react330 = require("@ai-matrx/records/react");
|
|
56362
56414
|
var import_design_system165 = require("@ai-matrx/design-system");
|
|
56363
56415
|
init_names();
|
|
@@ -57610,7 +57662,7 @@ function TableNotHere({
|
|
|
57610
57662
|
return /* @__PURE__ */ (0, import_jsx_runtime184.jsxs)("div", { className: (0, import_design_system165.cn)("flex flex-col items-start gap-2 rounded-md border border-dashed p-6", className), children: [
|
|
57611
57663
|
/* @__PURE__ */ (0, import_jsx_runtime184.jsx)("p", { className: "text-sm font-medium", children: "This table is archived" }),
|
|
57612
57664
|
/* @__PURE__ */ (0, import_jsx_runtime184.jsx)("p", { className: "max-w-prose text-xs text-muted-foreground", children: TABLE_IS_ARCHIVED }),
|
|
57613
|
-
/* @__PURE__ */ (0, import_jsx_runtime184.jsx)("p", { className: "text-xs text-muted-foreground", children: (0,
|
|
57665
|
+
/* @__PURE__ */ (0, import_jsx_runtime184.jsx)("p", { className: "text-xs text-muted-foreground", children: (0, import_records70.archivedByLine)(row) }),
|
|
57614
57666
|
refusal3 ? /* @__PURE__ */ (0, import_jsx_runtime184.jsx)(RefusalNotice, { error: refusal3 }) : null,
|
|
57615
57667
|
/* @__PURE__ */ (0, import_jsx_runtime184.jsxs)("div", { className: "flex gap-2", children: [
|
|
57616
57668
|
/* @__PURE__ */ (0, import_jsx_runtime184.jsx)(
|
|
@@ -59294,7 +59346,7 @@ init_objectActionIcons();
|
|
|
59294
59346
|
|
|
59295
59347
|
// src/DataBindingPicker.tsx
|
|
59296
59348
|
var import_react333 = require("react");
|
|
59297
|
-
var
|
|
59349
|
+
var import_records71 = require("@ai-matrx/records");
|
|
59298
59350
|
var import_react334 = require("@ai-matrx/records/react");
|
|
59299
59351
|
var import_design_system168 = require("@ai-matrx/design-system");
|
|
59300
59352
|
init_names();
|
|
@@ -59329,7 +59381,7 @@ function isCompleteDataBinding(binding) {
|
|
|
59329
59381
|
}
|
|
59330
59382
|
function bindingPlaceholdersFor(field2) {
|
|
59331
59383
|
const label = fieldName(field2);
|
|
59332
|
-
if ((0,
|
|
59384
|
+
if ((0, import_records71.isEntityReferenceConfig)(field2.config)) {
|
|
59333
59385
|
return [
|
|
59334
59386
|
{ token: `{${field2.key}.name}`, label: `${label} \xB7 name` },
|
|
59335
59387
|
{ token: `{${field2.key}.id}`, label: `${label} \xB7 id` }
|