@ai-matrx/records-ui 0.110.12 → 0.111.0
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 +6 -0
- package/dist/index.cjs +196 -102
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +140 -46
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/dist/index.cjs
CHANGED
|
@@ -11097,7 +11097,7 @@ function useWholeTableCount(args) {
|
|
|
11097
11097
|
// src/Grid.tsx
|
|
11098
11098
|
var import_react123 = require("react");
|
|
11099
11099
|
var import_react124 = require("@ai-matrx/records/react");
|
|
11100
|
-
var
|
|
11100
|
+
var import_records38 = require("@ai-matrx/records");
|
|
11101
11101
|
var import_data_table13 = require("@ai-matrx/design-system/data-table");
|
|
11102
11102
|
var import_core20 = require("@ai-matrx/records/core");
|
|
11103
11103
|
|
|
@@ -12931,6 +12931,9 @@ function FieldEditor(props) {
|
|
|
12931
12931
|
);
|
|
12932
12932
|
const rollupFilterChanged = JSON.stringify(rollupFilter) !== JSON.stringify(savedRollupFilter);
|
|
12933
12933
|
const [relationTarget, setRelationTarget] = (0, import_react65.useState)(String(start?.relation_target ?? ""));
|
|
12934
|
+
const [showOnOther, setShowOnOther] = (0, import_react65.useState)(true);
|
|
12935
|
+
const [reverseRefused, setReverseRefused] = (0, import_react65.useState)(null);
|
|
12936
|
+
const otherTable = (0, import_react66.useTable)(!field2 && type === "relation" && relationTarget !== "" ? relationTarget : null);
|
|
12934
12937
|
const [display, setDisplay] = (0, import_react65.useState)(start?.display ?? null);
|
|
12935
12938
|
const [formulaOp, setFormulaOp] = (0, import_react65.useState)(() => formulaOpOf(start));
|
|
12936
12939
|
const [formulaFields, setFormulaFields] = (0, import_react65.useState)(() => formulaFieldIdsOf(start));
|
|
@@ -13142,6 +13145,15 @@ function FieldEditor(props) {
|
|
|
13142
13145
|
}
|
|
13143
13146
|
}
|
|
13144
13147
|
setBackfillError(null);
|
|
13148
|
+
if (type === "relation" && showOnOther && otherTable.data && otherTable.data.id !== tableId) {
|
|
13149
|
+
const made = await client.relationReverseField({ field_id: written });
|
|
13150
|
+
if (!made.ok) {
|
|
13151
|
+
setReverseRefused(made.error);
|
|
13152
|
+
return;
|
|
13153
|
+
}
|
|
13154
|
+
(0, import_react66.tableShapeChanged)(relationTarget);
|
|
13155
|
+
}
|
|
13156
|
+
setReverseRefused(null);
|
|
13145
13157
|
onSaved?.();
|
|
13146
13158
|
};
|
|
13147
13159
|
const remove = async () => {
|
|
@@ -13333,6 +13345,19 @@ function FieldEditor(props) {
|
|
|
13333
13345
|
),
|
|
13334
13346
|
"Each value has its own date"
|
|
13335
13347
|
] }),
|
|
13348
|
+
!field2 && type === "relation" && otherTable.data && otherTable.data.id !== tableId ? /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)("label", { className: "flex items-center gap-1.5", children: [
|
|
13349
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
|
|
13350
|
+
import_design_system35.Checkbox,
|
|
13351
|
+
{
|
|
13352
|
+
checked: showOnOther,
|
|
13353
|
+
"aria-label": `Show on ${otherTable.data.name ?? "the other table"}`,
|
|
13354
|
+
onCheckedChange: (v) => setShowOnOther(v === true),
|
|
13355
|
+
"data-records-show-on-other": ""
|
|
13356
|
+
}
|
|
13357
|
+
),
|
|
13358
|
+
"Show on ",
|
|
13359
|
+
otherTable.data.name ?? "the other table"
|
|
13360
|
+
] }) : null,
|
|
13336
13361
|
CHOICE_EDITOR_ADDS_WHAT_IS_TYPED && (type === "select" || type === "multi_select") ? /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)("label", { className: "flex items-center gap-1.5", children: [
|
|
13337
13362
|
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
|
|
13338
13363
|
import_design_system35.Checkbox,
|
|
@@ -13500,6 +13525,10 @@ function FieldEditor(props) {
|
|
|
13500
13525
|
) : null,
|
|
13501
13526
|
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)(import_design_system35.Button, { type: "button", size: "sm", className: "h-6 px-2 text-xs", onClick: () => onSaved?.(), children: "Done" })
|
|
13502
13527
|
] }) : null,
|
|
13528
|
+
reverseRefused ? /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)("div", { "data-records-reverse-field-refused": "", className: "flex flex-col gap-1", children: [
|
|
13529
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)("p", { className: "text-[11px]", children: "The link is made. Its column on the other table was not:" }),
|
|
13530
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)(RefusalNotice, { error: reverseRefused })
|
|
13531
|
+
] }) : null,
|
|
13503
13532
|
backfillError ? /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)("div", { "data-records-autonumber-backfill-refused": "", className: "flex flex-col gap-1", children: [
|
|
13504
13533
|
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)("p", { className: "text-[11px]", children: "The column is made. The records already in the table were not numbered:" }),
|
|
13505
13534
|
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)(RefusalNotice, { error: backfillError })
|
|
@@ -19577,6 +19606,7 @@ function withTypeMark(field2, header) {
|
|
|
19577
19606
|
|
|
19578
19607
|
// src/ReverseColumns.tsx
|
|
19579
19608
|
var import_react102 = require("react");
|
|
19609
|
+
var import_records32 = require("@ai-matrx/records");
|
|
19580
19610
|
var import_react103 = require("@ai-matrx/records/react");
|
|
19581
19611
|
var import_design_system54 = require("@ai-matrx/design-system");
|
|
19582
19612
|
var import_jsx_runtime61 = require("react/jsx-runtime");
|
|
@@ -19701,7 +19731,71 @@ function ReverseCell({ held, column, rowId, tableId }) {
|
|
|
19701
19731
|
const readReading = () => held.reading;
|
|
19702
19732
|
const answer = (0, import_react102.useSyncExternalStore)(subscribe, readAnswer, readAnswer);
|
|
19703
19733
|
const reading = (0, import_react102.useSyncExternalStore)(subscribe, readReading, readReading);
|
|
19704
|
-
|
|
19734
|
+
const chips = /* @__PURE__ */ (0, import_jsx_runtime61.jsx)(ReverseLinkChips, { column, answer, loading: reading, clamp: { tableId, recordId: rowId } });
|
|
19735
|
+
if (column.read_only) return chips;
|
|
19736
|
+
return /* @__PURE__ */ (0, import_jsx_runtime61.jsxs)("span", { className: "flex min-w-0 items-start gap-1", children: [
|
|
19737
|
+
/* @__PURE__ */ (0, import_jsx_runtime61.jsx)("span", { className: "min-w-0 flex-1", children: chips }),
|
|
19738
|
+
/* @__PURE__ */ (0, import_jsx_runtime61.jsx)(ReverseLinksEditPopover, { tableId, recordId: rowId, column })
|
|
19739
|
+
] });
|
|
19740
|
+
}
|
|
19741
|
+
function useReverseField(tableId, column) {
|
|
19742
|
+
const client = (0, import_react103.useOptionalRecordsClient)();
|
|
19743
|
+
const [field2, setField] = (0, import_react102.useState)(null);
|
|
19744
|
+
(0, import_react102.useEffect)(() => {
|
|
19745
|
+
if (column.read_only || !client) return;
|
|
19746
|
+
let live = true;
|
|
19747
|
+
void client.fields({ table_id: tableId, withReverse: true }).then((read) => {
|
|
19748
|
+
if (live && read.ok) setField(read.data.find((f) => f.key === column.key && (0, import_records32.isReverseField)(f)) ?? null);
|
|
19749
|
+
});
|
|
19750
|
+
return () => {
|
|
19751
|
+
live = false;
|
|
19752
|
+
};
|
|
19753
|
+
}, [client, tableId, column.key, column.read_only]);
|
|
19754
|
+
return field2;
|
|
19755
|
+
}
|
|
19756
|
+
function ReverseLinksEditor({ tableId, recordId, column, autoOpen, onClose }) {
|
|
19757
|
+
const client = (0, import_react103.useOptionalRecordsClient)();
|
|
19758
|
+
const field2 = useReverseField(tableId, column);
|
|
19759
|
+
const ids = (0, import_react102.useMemo)(() => [recordId], [recordId]);
|
|
19760
|
+
const one = (0, import_react102.useMemo)(() => [column], [column]);
|
|
19761
|
+
const read = (0, import_react103.useReverseLinks)(tableId, one, ids, REVERSE_LINKS_EDIT_MAX);
|
|
19762
|
+
const answer = read.data?.[column.key]?.[recordId];
|
|
19763
|
+
const [refused, setRefused] = (0, import_react102.useState)(null);
|
|
19764
|
+
if (read.error) return /* @__PURE__ */ (0, import_jsx_runtime61.jsx)(RefusalNotice, { error: read.error });
|
|
19765
|
+
if (!field2 || !answer || !client) return /* @__PURE__ */ (0, import_jsx_runtime61.jsx)(import_design_system54.Skeleton, { className: "h-7 w-40", "data-records-reverse-editor-loading": "" });
|
|
19766
|
+
const current = answer.links.map((l) => l.id);
|
|
19767
|
+
const write = async (next) => {
|
|
19768
|
+
const want = (Array.isArray(next) ? next : next ? [next] : []).map(String);
|
|
19769
|
+
const add = want.filter((id) => !current.includes(id));
|
|
19770
|
+
const remove = current.filter((id) => !want.includes(id));
|
|
19771
|
+
if (add.length === 0 && remove.length === 0) return;
|
|
19772
|
+
const done = await client.relationReverseSet({ record_id: recordId, field_id: field2.id, add, remove });
|
|
19773
|
+
setRefused(done.ok ? null : done.error);
|
|
19774
|
+
if (done.ok) read.reload();
|
|
19775
|
+
};
|
|
19776
|
+
return /* @__PURE__ */ (0, import_jsx_runtime61.jsxs)("span", { className: "flex min-w-0 flex-col gap-1", "data-records-reverse-editor": column.key, children: [
|
|
19777
|
+
/* @__PURE__ */ (0, import_jsx_runtime61.jsx)(RelationPicker, { field: field2, value: current, onChange: (next) => void write(next), autoOpen, onClose }),
|
|
19778
|
+
refused ? /* @__PURE__ */ (0, import_jsx_runtime61.jsx)(RefusalNotice, { error: refused }) : null
|
|
19779
|
+
] });
|
|
19780
|
+
}
|
|
19781
|
+
var REVERSE_LINKS_EDIT_MAX = 50;
|
|
19782
|
+
function ReverseLinksEditPopover({ tableId, recordId, column }) {
|
|
19783
|
+
const [open, setOpen] = (0, import_react102.useState)(false);
|
|
19784
|
+
return /* @__PURE__ */ (0, import_jsx_runtime61.jsxs)(import_design_system54.Popover, { open, onOpenChange: setOpen, children: [
|
|
19785
|
+
/* @__PURE__ */ (0, import_jsx_runtime61.jsx)(import_design_system54.PopoverTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime61.jsx)(
|
|
19786
|
+
import_design_system54.Button,
|
|
19787
|
+
{
|
|
19788
|
+
size: "sm",
|
|
19789
|
+
variant: "ghost",
|
|
19790
|
+
className: "h-5 w-5 shrink-0 p-0 text-muted-foreground",
|
|
19791
|
+
"aria-label": `Link ${column.source_table_name}`,
|
|
19792
|
+
title: `Link ${column.source_table_name}`,
|
|
19793
|
+
"data-records-reverse-edit": column.key,
|
|
19794
|
+
children: "+"
|
|
19795
|
+
}
|
|
19796
|
+
) }),
|
|
19797
|
+
/* @__PURE__ */ (0, import_jsx_runtime61.jsx)(import_design_system54.PopoverContent, { sizing: "content", align: "start", className: "w-80 p-2", children: open ? /* @__PURE__ */ (0, import_jsx_runtime61.jsx)(ReverseLinksEditor, { tableId, recordId, column }) : null })
|
|
19798
|
+
] });
|
|
19705
19799
|
}
|
|
19706
19800
|
var EMPTY_COLUMNS = [];
|
|
19707
19801
|
function ReverseLinksSections({ tableId, recordId }) {
|
|
@@ -19727,7 +19821,7 @@ function ReverseLinksSection({ tableId, recordId, column }) {
|
|
|
19727
19821
|
answer && answer.total > 0 ? /* @__PURE__ */ (0, import_jsx_runtime61.jsx)("span", { className: "text-[11px] text-muted-foreground", children: answer.total }) : null,
|
|
19728
19822
|
/* @__PURE__ */ (0, import_jsx_runtime61.jsx)(AddLinkedButton, { column, onAdd: () => setAdding(true) })
|
|
19729
19823
|
] }),
|
|
19730
|
-
first.error ? /* @__PURE__ */ (0, import_jsx_runtime61.jsx)(RefusalNotice, { error: first.error }) : /* @__PURE__ */ (0, import_jsx_runtime61.jsx)(ReverseLinkChips, { column, answer, loading: first.loading }),
|
|
19824
|
+
first.error ? /* @__PURE__ */ (0, import_jsx_runtime61.jsx)(RefusalNotice, { error: first.error }) : column.read_only ? /* @__PURE__ */ (0, import_jsx_runtime61.jsx)(ReverseLinkChips, { column, answer, loading: first.loading }) : /* @__PURE__ */ (0, import_jsx_runtime61.jsx)(ReverseLinksEditor, { tableId, recordId, column }),
|
|
19731
19825
|
answer && answer.total > answer.links.length && answer.links.length < 50 ? /* @__PURE__ */ (0, import_jsx_runtime61.jsxs)(import_design_system54.Button, { size: "sm", variant: "ghost", className: "self-start px-1 text-[11px]", onClick: () => setShown((n) => n + REVERSE_PANEL_PAGE), children: [
|
|
19732
19826
|
"Show ",
|
|
19733
19827
|
Math.min(REVERSE_PANEL_PAGE, answer.total - answer.links.length),
|
|
@@ -20073,7 +20167,7 @@ var import_react105 = require("react");
|
|
|
20073
20167
|
var import_react106 = require("@ai-matrx/records/react");
|
|
20074
20168
|
var import_core16 = require("@ai-matrx/records/core");
|
|
20075
20169
|
var import_design_system56 = require("@ai-matrx/design-system");
|
|
20076
|
-
var
|
|
20170
|
+
var import_records35 = require("@ai-matrx/records");
|
|
20077
20171
|
|
|
20078
20172
|
// src/importRuleCheck.ts
|
|
20079
20173
|
var import_core15 = require("@ai-matrx/records/core");
|
|
@@ -20124,7 +20218,7 @@ function checkImportRules(fields, rows, mapping, choiceOptions, relationNames) {
|
|
|
20124
20218
|
var import_text_case8 = require("@ai-matrx/kit/text-case");
|
|
20125
20219
|
|
|
20126
20220
|
// src/importKinds.ts
|
|
20127
|
-
var
|
|
20221
|
+
var import_records33 = require("@ai-matrx/records");
|
|
20128
20222
|
var IMPORT_KINDS = [
|
|
20129
20223
|
{ kind: "text", label: "Text" },
|
|
20130
20224
|
{ kind: "date", label: "Date" },
|
|
@@ -20152,7 +20246,7 @@ function datesOfColumn(rows, header, opts = {}) {
|
|
|
20152
20246
|
const raw = String(r[header] ?? "").trim();
|
|
20153
20247
|
if (raw === "") return;
|
|
20154
20248
|
filled += 1;
|
|
20155
|
-
const got = (0,
|
|
20249
|
+
const got = (0, import_records33.readTypedDate)(raw, { ...opts.withTime ? { withTime: true } : {}, ...opts.locale ? { locale: opts.locale } : {} });
|
|
20156
20250
|
if (got.ok) read.set(i, opts.withTime && got.instant ? got.instant : got.day);
|
|
20157
20251
|
else unreadable.push({ row: i, raw });
|
|
20158
20252
|
});
|
|
@@ -20177,12 +20271,12 @@ function exactDuplicateRows(rows, headers) {
|
|
|
20177
20271
|
}
|
|
20178
20272
|
|
|
20179
20273
|
// src/importCombine.ts
|
|
20180
|
-
var
|
|
20274
|
+
var import_records34 = require("@ai-matrx/records");
|
|
20181
20275
|
function titleRepeats(rows, header) {
|
|
20182
20276
|
const seen = /* @__PURE__ */ new Set();
|
|
20183
20277
|
let filled = 0;
|
|
20184
20278
|
for (const r of rows) {
|
|
20185
|
-
const key = (0,
|
|
20279
|
+
const key = (0, import_records34.relationNameKey)(String(r[header] ?? ""));
|
|
20186
20280
|
if (key === "") continue;
|
|
20187
20281
|
filled += 1;
|
|
20188
20282
|
seen.add(key);
|
|
@@ -20192,7 +20286,7 @@ function titleRepeats(rows, header) {
|
|
|
20192
20286
|
function sameRecordLikely(rows, header) {
|
|
20193
20287
|
const groups = /* @__PURE__ */ new Map();
|
|
20194
20288
|
for (const r of rows) {
|
|
20195
|
-
const key = (0,
|
|
20289
|
+
const key = (0, import_records34.relationNameKey)(String(r[header] ?? ""));
|
|
20196
20290
|
if (key === "") continue;
|
|
20197
20291
|
const held = groups.get(key);
|
|
20198
20292
|
if (held) held.push(r);
|
|
@@ -20225,7 +20319,7 @@ function combineRows(rows, header) {
|
|
|
20225
20319
|
const out = [];
|
|
20226
20320
|
const outLines = [];
|
|
20227
20321
|
rows.forEach((r, i) => {
|
|
20228
|
-
const key = (0,
|
|
20322
|
+
const key = (0, import_records34.relationNameKey)(String(r[header] ?? ""));
|
|
20229
20323
|
if (key === "") {
|
|
20230
20324
|
out.push({ ...r });
|
|
20231
20325
|
outLines.push([i + 1]);
|
|
@@ -20717,13 +20811,13 @@ function ImportWizard({ tableId, source, onDone, onWrote, className }) {
|
|
|
20717
20811
|
async (wanted) => {
|
|
20718
20812
|
const next = /* @__PURE__ */ new Map();
|
|
20719
20813
|
for (const { header, field: field2 } of wanted) {
|
|
20720
|
-
const names = effectiveRows.flatMap((r) => (0,
|
|
20814
|
+
const names = effectiveRows.flatMap((r) => (0, import_records35.relationNamesIn)(field2, String(r[header] ?? "")));
|
|
20721
20815
|
const got = await client.relationNamesMatch({ table_id: field2.relation_target, names });
|
|
20722
20816
|
if (!got.ok) {
|
|
20723
20817
|
setRelationProblem(got.error);
|
|
20724
20818
|
return null;
|
|
20725
20819
|
}
|
|
20726
|
-
next.set(field2.key, (0,
|
|
20820
|
+
next.set(field2.key, (0, import_records35.relationNameIndexOf)(got.data));
|
|
20727
20821
|
}
|
|
20728
20822
|
setRelationProblem(null);
|
|
20729
20823
|
setRelationIndex(next);
|
|
@@ -20747,12 +20841,12 @@ function ImportWizard({ tableId, source, onDone, onWrote, className }) {
|
|
|
20747
20841
|
let linked = 0;
|
|
20748
20842
|
let named = 0;
|
|
20749
20843
|
effectiveRows.forEach((row, i) => {
|
|
20750
|
-
const names = (0,
|
|
20844
|
+
const names = (0, import_records35.relationNamesIn)(field2, String(row[header] ?? ""));
|
|
20751
20845
|
if (String(row[header] ?? "").trim() === "") return;
|
|
20752
20846
|
named += 1;
|
|
20753
20847
|
let ok = true;
|
|
20754
20848
|
for (const name of names) {
|
|
20755
|
-
const hits = index.byName.get((0,
|
|
20849
|
+
const hits = index.byName.get((0, import_records35.relationNameKey)(name)) ?? [];
|
|
20756
20850
|
if (hits.length === 1) continue;
|
|
20757
20851
|
ok = false;
|
|
20758
20852
|
if (hits.length === 0) unmatched.set(name, [...unmatched.get(name) ?? [], i + 1]);
|
|
@@ -20810,11 +20904,11 @@ function ImportWizard({ tableId, source, onDone, onWrote, className }) {
|
|
|
20810
20904
|
const named = index.get(field2.key);
|
|
20811
20905
|
const text2 = String(row[header] ?? "").trim();
|
|
20812
20906
|
if (!named || text2 === "") continue;
|
|
20813
|
-
const parts = field2.multi ? (0,
|
|
20907
|
+
const parts = field2.multi ? (0, import_records35.splitListCell)(text2) : [text2];
|
|
20814
20908
|
const ids = [];
|
|
20815
20909
|
let skip = false;
|
|
20816
20910
|
for (const part of parts) {
|
|
20817
|
-
const hits = (0,
|
|
20911
|
+
const hits = (0, import_records35.relationNamesIn)(field2, part).length === 0 ? null : named.byName.get((0, import_records35.relationNameKey)(part)) ?? [];
|
|
20818
20912
|
if (hits === null) ids.push(part);
|
|
20819
20913
|
else if (hits.length === 1) ids.push(hits[0].id);
|
|
20820
20914
|
else if ((hits.length === 0 ? choiceFor(field2.key).unmatched : choiceFor(field2.key).ambiguous) !== "empty") skip = true;
|
|
@@ -20854,7 +20948,7 @@ function ImportWizard({ tableId, source, onDone, onWrote, className }) {
|
|
|
20854
20948
|
setPhase("linking");
|
|
20855
20949
|
for (const ask of toMerge) {
|
|
20856
20950
|
for (const [name] of ask.ambiguous) {
|
|
20857
|
-
const hits = ask.index.byName.get((0,
|
|
20951
|
+
const hits = ask.index.byName.get((0, import_records35.relationNameKey)(name)) ?? [];
|
|
20858
20952
|
const winner = hits[0];
|
|
20859
20953
|
if (!winner) continue;
|
|
20860
20954
|
for (const loser of hits.slice(1)) {
|
|
@@ -22520,7 +22614,7 @@ function useStoreValueFacets(enabled, inputs) {
|
|
|
22520
22614
|
// src/gridGrouping.tsx
|
|
22521
22615
|
var import_react111 = require("react");
|
|
22522
22616
|
var import_react112 = require("@ai-matrx/records/react");
|
|
22523
|
-
var
|
|
22617
|
+
var import_records36 = require("@ai-matrx/records");
|
|
22524
22618
|
var import_jsx_runtime67 = require("react/jsx-runtime");
|
|
22525
22619
|
function groupValueKey(value) {
|
|
22526
22620
|
if (value === null || value === void 0 || value === "") return "";
|
|
@@ -22557,8 +22651,8 @@ function useGroupFacts(args) {
|
|
|
22557
22651
|
const withheld = {};
|
|
22558
22652
|
for (const [fieldKey, op2] of entries) {
|
|
22559
22653
|
const m = op2 === "count" ? { op: "count" } : { op: op2, key: fieldKey };
|
|
22560
|
-
values[fieldKey] = row.measures?.[(0,
|
|
22561
|
-
const notice = row.withheld?.[(0,
|
|
22654
|
+
values[fieldKey] = row.measures?.[(0, import_records36.measureKey)(m)] ?? null;
|
|
22655
|
+
const notice = row.withheld?.[(0, import_records36.measureKey)(m)];
|
|
22562
22656
|
if (notice) withheld[fieldKey] = notice;
|
|
22563
22657
|
}
|
|
22564
22658
|
out.set(key, { count: typeof row.measures?.["count"] === "number" ? row.measures["count"] : row.row_count ?? null, measures: values, withheld });
|
|
@@ -23608,7 +23702,7 @@ function BulkActions({
|
|
|
23608
23702
|
// src/handOrder.tsx
|
|
23609
23703
|
var import_react120 = require("react");
|
|
23610
23704
|
var import_react121 = require("@ai-matrx/records/react");
|
|
23611
|
-
var
|
|
23705
|
+
var import_records37 = require("@ai-matrx/records");
|
|
23612
23706
|
var import_design_system60 = require("@ai-matrx/design-system");
|
|
23613
23707
|
var import_jsx_runtime71 = require("react/jsx-runtime");
|
|
23614
23708
|
function sortArrow(direction) {
|
|
@@ -23725,7 +23819,7 @@ function useHandOrderRows(args) {
|
|
|
23725
23819
|
const client = (0, import_react121.useRecordsClient)();
|
|
23726
23820
|
const { viewId, active, page, pageSize } = args;
|
|
23727
23821
|
const filter = args.filter && Object.keys(args.filter).length > 0 ? args.filter : null;
|
|
23728
|
-
const filterKey = filter ? (0,
|
|
23822
|
+
const filterKey = filter ? (0, import_records37.stableFilterKey)(filter) : "";
|
|
23729
23823
|
const filterNow = (0, import_react120.useRef)(filter);
|
|
23730
23824
|
filterNow.current = filter;
|
|
23731
23825
|
const [answer, setAnswer] = (0, import_react120.useState)(null);
|
|
@@ -24422,7 +24516,7 @@ function GridBody({
|
|
|
24422
24516
|
const names = wanted.get(field2.key) ?? [];
|
|
24423
24517
|
if (names.length === 0) return;
|
|
24424
24518
|
const got = await client.relationNamesMatch({ table_id: field2.relation_target, names });
|
|
24425
|
-
if (got.ok) relationNames.current.set(field2.key, (0,
|
|
24519
|
+
if (got.ok) relationNames.current.set(field2.key, (0, import_records38.relationNameIndexOf)(got.data));
|
|
24426
24520
|
})
|
|
24427
24521
|
);
|
|
24428
24522
|
},
|
|
@@ -24501,7 +24595,7 @@ function GridBody({
|
|
|
24501
24595
|
field2.key,
|
|
24502
24596
|
lines.flatMap((line) => {
|
|
24503
24597
|
const cell2 = line[at];
|
|
24504
|
-
return typeof cell2 === "string" ? (0,
|
|
24598
|
+
return typeof cell2 === "string" ? (0, import_records38.relationNamesIn)(field2, cell2) : [];
|
|
24505
24599
|
})
|
|
24506
24600
|
);
|
|
24507
24601
|
}
|
|
@@ -24788,7 +24882,7 @@ function GridBody({
|
|
|
24788
24882
|
tableName: table.data ? tableName(table.data) : "",
|
|
24789
24883
|
fields: fields.data ?? [],
|
|
24790
24884
|
document: row.document ?? {},
|
|
24791
|
-
level: (0,
|
|
24885
|
+
level: (0, import_records38.asPermissionLevel)(row.level)
|
|
24792
24886
|
}),
|
|
24793
24887
|
[host, tableId, table.data, fields.data]
|
|
24794
24888
|
);
|
|
@@ -26725,7 +26819,7 @@ var import_design_system74 = require("@ai-matrx/design-system");
|
|
|
26725
26819
|
var import_react146 = require("react");
|
|
26726
26820
|
var import_react147 = require("@ai-matrx/records/react");
|
|
26727
26821
|
var import_core22 = require("@ai-matrx/records/core");
|
|
26728
|
-
var
|
|
26822
|
+
var import_records43 = require("@ai-matrx/records");
|
|
26729
26823
|
var import_design_system73 = require("@ai-matrx/design-system");
|
|
26730
26824
|
|
|
26731
26825
|
// src/newTableColumns.ts
|
|
@@ -26909,7 +27003,7 @@ function fieldsForNewColumns(columns) {
|
|
|
26909
27003
|
var import_clipboard4 = require("@ai-matrx/kit/clipboard");
|
|
26910
27004
|
var import_react142 = require("react");
|
|
26911
27005
|
var import_react143 = require("@ai-matrx/records/react");
|
|
26912
|
-
var
|
|
27006
|
+
var import_records41 = require("@ai-matrx/records");
|
|
26913
27007
|
var import_design_system71 = require("@ai-matrx/design-system");
|
|
26914
27008
|
|
|
26915
27009
|
// src/BookingBuilder.tsx
|
|
@@ -26918,7 +27012,7 @@ var import_design_system66 = require("@ai-matrx/design-system");
|
|
|
26918
27012
|
var import_react138 = require("react");
|
|
26919
27013
|
var import_react139 = require("@ai-matrx/records/react");
|
|
26920
27014
|
var import_format6 = require("@ai-matrx/kit/format");
|
|
26921
|
-
var
|
|
27015
|
+
var import_records39 = require("@ai-matrx/records");
|
|
26922
27016
|
var import_design_system67 = require("@ai-matrx/design-system");
|
|
26923
27017
|
|
|
26924
27018
|
// src/publicQuestions.ts
|
|
@@ -27199,7 +27293,7 @@ function BookingBuilder({ tableId, bookingId, onSaved, onClose, startNew, classN
|
|
|
27199
27293
|
if (!rights.structure) {
|
|
27200
27294
|
return /* @__PURE__ */ (0, import_jsx_runtime78.jsx)("p", { className: (0, import_design_system67.cn)("text-xs text-muted-foreground", className), children: rights.why("structure") ?? "Making a booking page needs the admin level on this table, because it lets people with no account take time in your calendar." });
|
|
27201
27295
|
}
|
|
27202
|
-
const url = formId ? `${publicOrigin}${(0,
|
|
27296
|
+
const url = formId ? `${publicOrigin}${(0, import_records39.bookingPath)(formId)}` : null;
|
|
27203
27297
|
const shown4 = offer ?? null;
|
|
27204
27298
|
return (
|
|
27205
27299
|
// THE RAIL IS 384px WIDE AND THE VIEWPORT IS NOT (walk 1, 2026-09-21):
|
|
@@ -27459,7 +27553,7 @@ function BuildOrAsk({
|
|
|
27459
27553
|
|
|
27460
27554
|
// src/BuiltOnArchive.tsx
|
|
27461
27555
|
var import_react140 = require("react");
|
|
27462
|
-
var
|
|
27556
|
+
var import_records40 = require("@ai-matrx/records");
|
|
27463
27557
|
var import_react141 = require("@ai-matrx/records/react");
|
|
27464
27558
|
var import_design_system70 = require("@ai-matrx/design-system");
|
|
27465
27559
|
|
|
@@ -27900,9 +27994,9 @@ function ArchivedBuiltOn({ tableId, onRestored }) {
|
|
|
27900
27994
|
/* @__PURE__ */ (0, import_jsx_runtime82.jsxs)("div", { className: "flex min-w-0 flex-1 flex-col", children: [
|
|
27901
27995
|
/* @__PURE__ */ (0, import_jsx_runtime82.jsx)("span", { className: "truncate text-sm", children: thing.title }),
|
|
27902
27996
|
/* @__PURE__ */ (0, import_jsx_runtime82.jsxs)("span", { className: "truncate text-xs text-muted-foreground", children: [
|
|
27903
|
-
|
|
27997
|
+
import_records40.BUILT_KIND_WORD[thing.kind],
|
|
27904
27998
|
" \xB7 archived ",
|
|
27905
|
-
(0,
|
|
27999
|
+
(0, import_records40.archivedWhen)(thing.archivedAt)
|
|
27906
28000
|
] }),
|
|
27907
28001
|
refusal4 && refusal4.id === thing.id ? /* @__PURE__ */ (0, import_jsx_runtime82.jsx)(RefusalNotice, { error: refusal4.error, className: "mt-2" }) : null
|
|
27908
28002
|
] }),
|
|
@@ -28053,7 +28147,7 @@ function BookingSlots({ tableId, activeBookingId, className }) {
|
|
|
28053
28147
|
" Open the table the appointments should land in to make one."
|
|
28054
28148
|
] }) : null,
|
|
28055
28149
|
/* @__PURE__ */ (0, import_jsx_runtime83.jsx)("ul", { className: "flex flex-col gap-2", children: pages.map((page) => {
|
|
28056
|
-
const url = `${origin}${(0,
|
|
28150
|
+
const url = `${origin}${(0, import_records41.bookingPath)(page.form_id)}`;
|
|
28057
28151
|
const mayOpen = levels.data?.[page.table_id] === "admin";
|
|
28058
28152
|
const open = page.published_at !== null && page.closed_at === null;
|
|
28059
28153
|
return /* @__PURE__ */ (0, import_jsx_runtime83.jsxs)(
|
|
@@ -28173,7 +28267,7 @@ function nextInWords(page) {
|
|
|
28173
28267
|
|
|
28174
28268
|
// src/WhereItLives.tsx
|
|
28175
28269
|
var import_react144 = require("react");
|
|
28176
|
-
var
|
|
28270
|
+
var import_records42 = require("@ai-matrx/records");
|
|
28177
28271
|
var import_react145 = require("@ai-matrx/records/react");
|
|
28178
28272
|
var import_design_system72 = require("@ai-matrx/design-system");
|
|
28179
28273
|
var import_jsx_runtime84 = require("react/jsx-runtime");
|
|
@@ -28302,7 +28396,7 @@ function WhereItLives({ tableId, knownOrganizationName, onMoved, variant = "head
|
|
|
28302
28396
|
/* @__PURE__ */ (0, import_jsx_runtime84.jsx)(SharedNameAddress, { to: choosing, all: answer.home.destinations }),
|
|
28303
28397
|
"?"
|
|
28304
28398
|
] }),
|
|
28305
|
-
/* @__PURE__ */ (0, import_jsx_runtime84.jsx)("p", { className: "text-muted-foreground", children: (0,
|
|
28399
|
+
/* @__PURE__ */ (0, import_jsx_runtime84.jsx)("p", { className: "text-muted-foreground", children: (0, import_records42.moveConsequence)(answer.home, choosing) }),
|
|
28306
28400
|
said2?.tone === "refused" ? /* @__PURE__ */ (0, import_jsx_runtime84.jsx)(
|
|
28307
28401
|
import_design_system72.ErrorBox,
|
|
28308
28402
|
{
|
|
@@ -28459,7 +28553,7 @@ function TablesHome({ onOpenTable, organizationName, makingOnly = false, askedBy
|
|
|
28459
28553
|
alive = false;
|
|
28460
28554
|
};
|
|
28461
28555
|
}, [client]);
|
|
28462
|
-
const listed = facts.phase === "read" ? (0,
|
|
28556
|
+
const listed = facts.phase === "read" ? (0, import_records43.withTablePlacement)(
|
|
28463
28557
|
(0, import_core22.withTableFacts)(tables.data ?? [], facts.rows, me),
|
|
28464
28558
|
facts.rows
|
|
28465
28559
|
) : tables.data ?? [];
|
|
@@ -29746,7 +29840,7 @@ function TableFoundationSwitch({ tableId, table }) {
|
|
|
29746
29840
|
|
|
29747
29841
|
// src/RowControls.tsx
|
|
29748
29842
|
var import_react158 = require("react");
|
|
29749
|
-
var
|
|
29843
|
+
var import_records44 = require("@ai-matrx/records");
|
|
29750
29844
|
var import_react159 = require("@ai-matrx/records/react");
|
|
29751
29845
|
var import_design_system79 = require("@ai-matrx/design-system");
|
|
29752
29846
|
var import_jsx_runtime91 = require("react/jsx-runtime");
|
|
@@ -29774,9 +29868,9 @@ function ShownToSelect({
|
|
|
29774
29868
|
onChange,
|
|
29775
29869
|
testId
|
|
29776
29870
|
}) {
|
|
29777
|
-
return /* @__PURE__ */ (0, import_jsx_runtime91.jsxs)(import_design_system79.Select, { value, onValueChange: (next) => (0,
|
|
29871
|
+
return /* @__PURE__ */ (0, import_jsx_runtime91.jsxs)(import_design_system79.Select, { value, onValueChange: (next) => (0, import_records44.isShownTo)(next) ? onChange(next) : void 0, children: [
|
|
29778
29872
|
/* @__PURE__ */ (0, import_jsx_runtime91.jsx)(import_design_system79.SelectTrigger, { size: "sm", "aria-label": label, className: "h-7 min-w-[8rem] text-xs", "data-testid": testId, children: /* @__PURE__ */ (0, import_jsx_runtime91.jsx)(import_design_system79.SelectValue, {}) }),
|
|
29779
|
-
/* @__PURE__ */ (0, import_jsx_runtime91.jsx)(import_design_system79.SelectContent, { children: allowed.map((word) => /* @__PURE__ */ (0, import_jsx_runtime91.jsx)(import_design_system79.SelectItem, { value: word, children:
|
|
29873
|
+
/* @__PURE__ */ (0, import_jsx_runtime91.jsx)(import_design_system79.SelectContent, { children: allowed.map((word) => /* @__PURE__ */ (0, import_jsx_runtime91.jsx)(import_design_system79.SelectItem, { value: word, children: import_records44.SHOWN_TO_LABEL[word] }, word)) })
|
|
29780
29874
|
] });
|
|
29781
29875
|
}
|
|
29782
29876
|
function NewRowsDefaults({ tableId }) {
|
|
@@ -29815,7 +29909,7 @@ function NewRowsDefaults({ tableId }) {
|
|
|
29815
29909
|
};
|
|
29816
29910
|
if (!d) return error ? /* @__PURE__ */ (0, import_jsx_runtime91.jsx)(RefusalNotice, { error }) : null;
|
|
29817
29911
|
const shown4 = d.shown_to ?? d.effective.shown_to;
|
|
29818
|
-
const allowed = d.allowed_shown_to.filter(
|
|
29912
|
+
const allowed = d.allowed_shown_to.filter(import_records44.isShownTo);
|
|
29819
29913
|
return /* @__PURE__ */ (0, import_jsx_runtime91.jsxs)("section", { className: "flex flex-col gap-1.5", "data-testid": "new-rows-defaults", children: [
|
|
29820
29914
|
/* @__PURE__ */ (0, import_jsx_runtime91.jsx)("span", { className: "font-medium", children: ROW_CONTROL_WORDS.block }),
|
|
29821
29915
|
/* @__PURE__ */ (0, import_jsx_runtime91.jsxs)("div", { className: "flex items-center gap-2", children: [
|
|
@@ -29829,7 +29923,7 @@ function NewRowsDefaults({ tableId }) {
|
|
|
29829
29923
|
testId: "new-rows-shown-to",
|
|
29830
29924
|
onChange: (next) => void set({ shown_to: next })
|
|
29831
29925
|
}
|
|
29832
|
-
) : /* @__PURE__ */ (0, import_jsx_runtime91.jsx)("span", { "data-testid": "new-rows-shown-to-text", children:
|
|
29926
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime91.jsx)("span", { "data-testid": "new-rows-shown-to-text", children: import_records44.SHOWN_TO_LABEL[shown4] })
|
|
29833
29927
|
] }),
|
|
29834
29928
|
/* @__PURE__ */ (0, import_jsx_runtime91.jsxs)("div", { className: "flex items-center gap-2", "data-testid": "new-rows-published", children: [
|
|
29835
29929
|
/* @__PURE__ */ (0, import_jsx_runtime91.jsx)("span", { className: "min-w-fit flex-1 whitespace-nowrap", children: ROW_CONTROL_WORDS.publishedToWeb }),
|
|
@@ -29878,9 +29972,9 @@ function RowShownTo({ recordId }) {
|
|
|
29878
29972
|
void read();
|
|
29879
29973
|
}, [read]);
|
|
29880
29974
|
if (error && !c) return null;
|
|
29881
|
-
if (!c || c.shown_to.is_child || !(0,
|
|
29975
|
+
if (!c || c.shown_to.is_child || !(0, import_records44.isShownTo)(c.shown_to.effective)) return null;
|
|
29882
29976
|
const effective = c.shown_to.effective;
|
|
29883
|
-
const allowed = c.shown_to.allowed.filter(
|
|
29977
|
+
const allowed = c.shown_to.allowed.filter(import_records44.isShownTo);
|
|
29884
29978
|
return /* @__PURE__ */ (0, import_jsx_runtime91.jsxs)("span", { className: "flex items-center gap-1.5", "data-testid": "row-shown-to", children: [
|
|
29885
29979
|
/* @__PURE__ */ (0, import_jsx_runtime91.jsx)("span", { className: "text-muted-foreground", children: ROW_CONTROL_WORDS.shownTo }),
|
|
29886
29980
|
c.shown_to.can_change ? /* @__PURE__ */ (0, import_jsx_runtime91.jsx)(
|
|
@@ -29899,7 +29993,7 @@ function RowShownTo({ recordId }) {
|
|
|
29899
29993
|
}
|
|
29900
29994
|
}
|
|
29901
29995
|
) : /* @__PURE__ */ (0, import_jsx_runtime91.jsxs)(import_jsx_runtime91.Fragment, { children: [
|
|
29902
|
-
/* @__PURE__ */ (0, import_jsx_runtime91.jsx)("span", { "data-testid": "row-shown-to-text", children:
|
|
29996
|
+
/* @__PURE__ */ (0, import_jsx_runtime91.jsx)("span", { "data-testid": "row-shown-to-text", children: import_records44.SHOWN_TO_LABEL[effective] }),
|
|
29903
29997
|
/* @__PURE__ */ (0, import_jsx_runtime91.jsx)("span", { className: "max-w-[18rem] text-[11px] text-muted-foreground", "data-testid": "row-shown-to-who", children: ROW_CONTROL_WORDS.whoMayChangeRow })
|
|
29904
29998
|
] }),
|
|
29905
29999
|
error ? /* @__PURE__ */ (0, import_jsx_runtime91.jsx)(RefusalNotice, { error }) : null
|
|
@@ -30634,12 +30728,12 @@ function ShareForSomebodyElse({
|
|
|
30634
30728
|
// src/RecordBody.tsx
|
|
30635
30729
|
var import_react169 = require("react");
|
|
30636
30730
|
var import_design_system84 = require("@ai-matrx/design-system");
|
|
30637
|
-
var
|
|
30731
|
+
var import_records45 = require("@ai-matrx/records");
|
|
30638
30732
|
var import_react170 = require("@ai-matrx/records/react");
|
|
30639
30733
|
var import_jsx_runtime97 = require("react/jsx-runtime");
|
|
30640
30734
|
var BODY_NAMES = /^(notes?|page|body|content|page content|details|description)$/i;
|
|
30641
30735
|
function bodyFieldOf(fields) {
|
|
30642
|
-
const rich2 = fields.filter((field2) => (0,
|
|
30736
|
+
const rich2 = fields.filter((field2) => (0, import_records45.newerKindOf)(field2) === "rich_text");
|
|
30643
30737
|
return rich2.find((field2) => BODY_NAMES.test((field2.label ?? field2.key).trim()) || BODY_NAMES.test(field2.key.replace(/_/g, " "))) ?? rich2[0];
|
|
30644
30738
|
}
|
|
30645
30739
|
var BODY_COLUMN_NAME = "Notes";
|
|
@@ -31038,7 +31132,7 @@ function useSystemTable(spec) {
|
|
|
31038
31132
|
// src/ViewSwitcher.tsx
|
|
31039
31133
|
var import_react192 = require("react");
|
|
31040
31134
|
var import_react193 = require("@ai-matrx/records/react");
|
|
31041
|
-
var
|
|
31135
|
+
var import_records47 = require("@ai-matrx/records");
|
|
31042
31136
|
var import_design_system93 = require("@ai-matrx/design-system");
|
|
31043
31137
|
var import_data_table21 = require("@ai-matrx/design-system/data-table");
|
|
31044
31138
|
var import_format7 = require("@ai-matrx/kit/format");
|
|
@@ -31193,7 +31287,7 @@ function MoveRefusedBadge({ refused }) {
|
|
|
31193
31287
|
// src/Pipeline.tsx
|
|
31194
31288
|
var import_react180 = require("react");
|
|
31195
31289
|
var import_react181 = require("@ai-matrx/records/react");
|
|
31196
|
-
var
|
|
31290
|
+
var import_records46 = require("@ai-matrx/records");
|
|
31197
31291
|
var import_design_system88 = require("@ai-matrx/design-system");
|
|
31198
31292
|
var import_data_table16 = require("@ai-matrx/design-system/data-table");
|
|
31199
31293
|
|
|
@@ -31526,7 +31620,7 @@ function PipelineBoard({
|
|
|
31526
31620
|
alive.current = false;
|
|
31527
31621
|
};
|
|
31528
31622
|
}, []);
|
|
31529
|
-
const filterKey = (0,
|
|
31623
|
+
const filterKey = (0, import_records46.stableFilterKey)(filter);
|
|
31530
31624
|
const reload = (0, import_react180.useCallback)(async () => {
|
|
31531
31625
|
setLoading(true);
|
|
31532
31626
|
const [read, board, held] = await Promise.all([
|
|
@@ -34256,7 +34350,7 @@ var NO_FIELDS2 = [];
|
|
|
34256
34350
|
function useViewRecords(view, pageSize = 200, filter, viewId) {
|
|
34257
34351
|
const client = (0, import_react193.useRecordsClient)();
|
|
34258
34352
|
const [limit, setLimit] = (0, import_react192.useState)(pageSize);
|
|
34259
|
-
const questionKey = `${view.subject}|${(0,
|
|
34353
|
+
const questionKey = `${view.subject}|${(0, import_records47.stableFilterKey)(filter ?? null)}|${JSON.stringify(view.sorts ?? [])}`;
|
|
34260
34354
|
(0, import_react192.useEffect)(() => {
|
|
34261
34355
|
setLimit(pageSize);
|
|
34262
34356
|
}, [questionKey, pageSize]);
|
|
@@ -34289,8 +34383,8 @@ function useViewRecords(view, pageSize = 200, filter, viewId) {
|
|
|
34289
34383
|
cancelled = true;
|
|
34290
34384
|
};
|
|
34291
34385
|
}, [client, ruleId, pageSize]);
|
|
34292
|
-
const asked3 = (0,
|
|
34293
|
-
const fromView = asked3 !== "{}" && (asked3 === (0,
|
|
34386
|
+
const asked3 = (0, import_records47.stableFilterKey)(filter ?? null);
|
|
34387
|
+
const fromView = asked3 !== "{}" && (asked3 === (0, import_records47.stableFilterKey)(view.where ?? null) || asked3 === (0, import_records47.stableFilterKey)(view.filters ?? null));
|
|
34294
34388
|
const tableRows = (0, import_react192.useMemo)(() => table.data?.rows ?? [], [table.data]);
|
|
34295
34389
|
const manual = view.order === "manual" && Boolean(viewId) && !ruleId;
|
|
34296
34390
|
const hand = useHandOrderRows({
|
|
@@ -35321,12 +35415,12 @@ function cardHiddenOf(presentation) {
|
|
|
35321
35415
|
}
|
|
35322
35416
|
var STATUS_WORDS = /^(status|stage|state|progress|phase)$/i;
|
|
35323
35417
|
function boardDefaultGroupField(eligible) {
|
|
35324
|
-
return eligible.find((f) => (0,
|
|
35418
|
+
return eligible.find((f) => (0, import_records47.newerKindOf)(f) === "status") ?? eligible.find((f) => STATUS_WORDS.test(fieldName(f).trim()) || STATUS_WORDS.test(f.key)) ?? eligible[0] ?? null;
|
|
35325
35419
|
}
|
|
35326
35420
|
|
|
35327
35421
|
// src/ArchivedView.tsx
|
|
35328
35422
|
var import_react194 = require("react");
|
|
35329
|
-
var
|
|
35423
|
+
var import_records48 = require("@ai-matrx/records");
|
|
35330
35424
|
var import_react195 = require("@ai-matrx/records/react");
|
|
35331
35425
|
var import_design_system94 = require("@ai-matrx/design-system");
|
|
35332
35426
|
var import_jsx_runtime110 = require("react/jsx-runtime");
|
|
@@ -35336,7 +35430,7 @@ function mayNotRestoreLine(why) {
|
|
|
35336
35430
|
return said2 === "" ? "Bringing a record back needs permission to edit this table. Ask somebody who has it." : said2;
|
|
35337
35431
|
}
|
|
35338
35432
|
function archivedRowLine(row, titleKey) {
|
|
35339
|
-
return `${recordName(row.document, titleKey)} \u2014 ${(0,
|
|
35433
|
+
return `${recordName(row.document, titleKey)} \u2014 ${(0, import_records48.archivedByLine)(row)}`;
|
|
35340
35434
|
}
|
|
35341
35435
|
function ArchivedView({
|
|
35342
35436
|
tableId,
|
|
@@ -35350,7 +35444,7 @@ function ArchivedView({
|
|
|
35350
35444
|
const table = (0, import_react195.useTable)(tableId);
|
|
35351
35445
|
const rights = useTableRights(table.data);
|
|
35352
35446
|
const fields = (0, import_react195.useFields)(tableId);
|
|
35353
|
-
const [lane, setLane] = (0, import_react194.useState)(laneFromHost ??
|
|
35447
|
+
const [lane, setLane] = (0, import_react194.useState)(laneFromHost ?? import_records48.DEFAULT_ARCHIVE_LANE);
|
|
35354
35448
|
const [rows, setRows] = (0, import_react194.useState)([]);
|
|
35355
35449
|
const [loading, setLoading] = (0, import_react194.useState)(true);
|
|
35356
35450
|
const [error, setError] = (0, import_react194.useState)(null);
|
|
@@ -35397,15 +35491,15 @@ function ArchivedView({
|
|
|
35397
35491
|
return /* @__PURE__ */ (0, import_jsx_runtime110.jsxs)("div", { className: (0, import_design_system94.cn)("flex min-h-0 flex-col gap-2", className), "data-testid": "archived-view", children: [
|
|
35398
35492
|
/* @__PURE__ */ (0, import_jsx_runtime110.jsxs)("div", { className: "flex flex-wrap items-center gap-2", children: [
|
|
35399
35493
|
/* @__PURE__ */ (0, import_jsx_runtime110.jsx)("span", { className: "text-sm font-medium", children: "Archived" }),
|
|
35400
|
-
/* @__PURE__ */ (0, import_jsx_runtime110.jsx)("div", { className: "ml-auto flex items-center gap-0.5", role: "group", "aria-label": "Archived by", children:
|
|
35494
|
+
/* @__PURE__ */ (0, import_jsx_runtime110.jsx)("div", { className: "ml-auto flex items-center gap-0.5", role: "group", "aria-label": "Archived by", children: import_records48.ARCHIVE_LANES.map((option) => /* @__PURE__ */ (0, import_jsx_runtime110.jsx)(
|
|
35401
35495
|
import_design_system94.Button,
|
|
35402
35496
|
{
|
|
35403
35497
|
size: "sm",
|
|
35404
35498
|
variant: option === lane ? "secondary" : "ghost",
|
|
35405
35499
|
"aria-pressed": option === lane,
|
|
35406
|
-
title:
|
|
35500
|
+
title: import_records48.ARCHIVE_LANE_MEANS[option],
|
|
35407
35501
|
onClick: () => pick(option),
|
|
35408
|
-
children:
|
|
35502
|
+
children: import_records48.ARCHIVE_LANE_LABEL[option]
|
|
35409
35503
|
},
|
|
35410
35504
|
option
|
|
35411
35505
|
)) })
|
|
@@ -35421,7 +35515,7 @@ function ArchivedView({
|
|
|
35421
35515
|
),
|
|
35422
35516
|
error ? /* @__PURE__ */ (0, import_jsx_runtime110.jsx)(RefusalNotice, { error }) : null,
|
|
35423
35517
|
loading && !error ? /* @__PURE__ */ (0, import_jsx_runtime110.jsx)(import_design_system94.Skeleton, { className: "h-24 w-full" }) : null,
|
|
35424
|
-
!loading && !error && rows.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime110.jsx)("p", { "data-testid": "archived-empty", className: "rounded-md border border-dashed px-3 py-6 text-xs text-muted-foreground", children: (0,
|
|
35518
|
+
!loading && !error && rows.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime110.jsx)("p", { "data-testid": "archived-empty", className: "rounded-md border border-dashed px-3 py-6 text-xs text-muted-foreground", children: (0, import_records48.emptyArchiveLine)(lane) }) : null,
|
|
35425
35519
|
!loading && !error && rows.length > 0 ? /* @__PURE__ */ (0, import_jsx_runtime110.jsx)("ul", { className: "flex flex-col gap-1", "data-testid": "archived-rows", children: rows.map((row) => /* @__PURE__ */ (0, import_jsx_runtime110.jsxs)(
|
|
35426
35520
|
"li",
|
|
35427
35521
|
{
|
|
@@ -35431,7 +35525,7 @@ function ArchivedView({
|
|
|
35431
35525
|
children: [
|
|
35432
35526
|
/* @__PURE__ */ (0, import_jsx_runtime110.jsxs)("div", { className: "flex min-w-0 flex-1 flex-col", children: [
|
|
35433
35527
|
/* @__PURE__ */ (0, import_jsx_runtime110.jsx)("span", { className: "truncate text-sm", children: recordName(row.document, titleKey) }),
|
|
35434
|
-
/* @__PURE__ */ (0, import_jsx_runtime110.jsx)("span", { className: "truncate text-xs text-muted-foreground", "data-testid": "archived-who", children: (0,
|
|
35528
|
+
/* @__PURE__ */ (0, import_jsx_runtime110.jsx)("span", { className: "truncate text-xs text-muted-foreground", "data-testid": "archived-who", children: (0, import_records48.archivedByLine)(row) }),
|
|
35435
35529
|
refusal4 && refusal4.recordId === row.id ? /* @__PURE__ */ (0, import_jsx_runtime110.jsx)(RefusalNotice, { error: refusal4.error, className: "mt-2" }) : null
|
|
35436
35530
|
] }),
|
|
35437
35531
|
mayRestore ? /* @__PURE__ */ (0, import_jsx_runtime110.jsx)(
|
|
@@ -35454,7 +35548,7 @@ function ArchivedView({
|
|
|
35454
35548
|
] });
|
|
35455
35549
|
}
|
|
35456
35550
|
function retiredColumnLine(row) {
|
|
35457
|
-
return (0,
|
|
35551
|
+
return (0, import_records48.archivedByLine)(row);
|
|
35458
35552
|
}
|
|
35459
35553
|
function RetiredColumns({ tableId, mayRestore, whyNot }) {
|
|
35460
35554
|
const client = (0, import_react195.useRecordsClient)();
|
|
@@ -35518,7 +35612,7 @@ function RetiredColumns({ tableId, mayRestore, whyNot }) {
|
|
|
35518
35612
|
|
|
35519
35613
|
// src/ArchivedDisclosure.tsx
|
|
35520
35614
|
var import_react196 = require("react");
|
|
35521
|
-
var
|
|
35615
|
+
var import_records49 = require("@ai-matrx/records");
|
|
35522
35616
|
var import_react197 = require("@ai-matrx/records/react");
|
|
35523
35617
|
var import_design_system95 = require("@ai-matrx/design-system");
|
|
35524
35618
|
var import_jsx_runtime111 = require("react/jsx-runtime");
|
|
@@ -35618,10 +35712,10 @@ function ArchivedPortals({
|
|
|
35618
35712
|
error ? /* @__PURE__ */ (0, import_jsx_runtime111.jsx)(RefusalNotice, { error }) : null,
|
|
35619
35713
|
rows === null && !error ? /* @__PURE__ */ (0, import_jsx_runtime111.jsx)(import_design_system95.Skeleton, { className: "h-16 w-full" }) : null,
|
|
35620
35714
|
said2 ? /* @__PURE__ */ (0, import_jsx_runtime111.jsx)("p", { className: "rounded-md border border-border px-3 py-2 text-xs", "data-testid": "archived-portal-said", children: said2 }) : null,
|
|
35621
|
-
rows !== null && !error && rows.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime111.jsx)("p", { "data-testid": "archived-portals-empty", className: "text-xs text-muted-foreground", children: (0,
|
|
35715
|
+
rows !== null && !error && rows.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime111.jsx)("p", { "data-testid": "archived-portals-empty", className: "text-xs text-muted-foreground", children: (0, import_records49.emptyPortalArchiveLine)() }) : null,
|
|
35622
35716
|
rows !== null && rows.length > 0 ? /* @__PURE__ */ (0, import_jsx_runtime111.jsx)("ul", { className: "flex flex-col gap-1.5", "data-testid": "archived-portals", children: rows.map((portal) => {
|
|
35623
35717
|
const asking = confirming === portal.portal_id;
|
|
35624
|
-
const matches2 = (0,
|
|
35718
|
+
const matches2 = (0, import_records49.portalTitleTypedBack)(typed2, portal.title);
|
|
35625
35719
|
return /* @__PURE__ */ (0, import_jsx_runtime111.jsxs)(
|
|
35626
35720
|
"li",
|
|
35627
35721
|
{
|
|
@@ -35660,7 +35754,7 @@ function ArchivedPortals({
|
|
|
35660
35754
|
] }),
|
|
35661
35755
|
asking ? /* @__PURE__ */ (0, import_jsx_runtime111.jsxs)("div", { className: "flex flex-col gap-1.5", children: [
|
|
35662
35756
|
/* @__PURE__ */ (0, import_jsx_runtime111.jsxs)("p", { className: "text-xs text-muted-foreground", children: [
|
|
35663
|
-
(0,
|
|
35757
|
+
(0, import_records49.portalConfirmLine)(portal.title),
|
|
35664
35758
|
" Restoring it puts it back exactly as it was: everyone who was invited can sign in again, and it shows the same Tables."
|
|
35665
35759
|
] }),
|
|
35666
35760
|
/* @__PURE__ */ (0, import_jsx_runtime111.jsxs)("div", { className: "flex flex-wrap items-center gap-1.5", children: [
|
|
@@ -38480,7 +38574,7 @@ function FieldHistoryPanel({
|
|
|
38480
38574
|
}
|
|
38481
38575
|
|
|
38482
38576
|
// src/forms.ts
|
|
38483
|
-
var
|
|
38577
|
+
var import_records50 = require("@ai-matrx/records");
|
|
38484
38578
|
var FORM_STATE_WORDS = {
|
|
38485
38579
|
draft: "Not published \u2014 the link does not answer yet.",
|
|
38486
38580
|
open: "Open \u2014 anyone with the link can answer it.",
|
|
@@ -38663,7 +38757,7 @@ function formLookFromDocument(raw) {
|
|
|
38663
38757
|
const doc = raw;
|
|
38664
38758
|
const id = (v) => typeof v === "string" && v.trim() !== "" ? v : null;
|
|
38665
38759
|
const look = {
|
|
38666
|
-
accent: (0,
|
|
38760
|
+
accent: (0, import_records50.isPortalAccent)(doc["accent"]) ? doc["accent"] : null,
|
|
38667
38761
|
logoFileId: id(doc["logo_file_id"]),
|
|
38668
38762
|
coverFileId: id(doc["cover_file_id"])
|
|
38669
38763
|
};
|
|
@@ -38773,7 +38867,7 @@ var import_design_system105 = require("@ai-matrx/design-system");
|
|
|
38773
38867
|
// src/ChartBlock.tsx
|
|
38774
38868
|
var import_react219 = require("react");
|
|
38775
38869
|
var import_recharts = require("recharts");
|
|
38776
|
-
var
|
|
38870
|
+
var import_records51 = require("@ai-matrx/records");
|
|
38777
38871
|
var import_core23 = require("@ai-matrx/records/core");
|
|
38778
38872
|
var import_design_system104 = require("@ai-matrx/design-system");
|
|
38779
38873
|
var import_format10 = require("@ai-matrx/kit/format");
|
|
@@ -39251,7 +39345,7 @@ function ChartBlock({ block, subject, tableName: tableName2, className, centerVa
|
|
|
39251
39345
|
const kind = block.kind;
|
|
39252
39346
|
const tableId = block.table_id ?? subject;
|
|
39253
39347
|
const measures = block.measures && block.measures.length > 0 ? block.measures : [{ op: "count" }];
|
|
39254
|
-
const primary = (0,
|
|
39348
|
+
const primary = (0, import_records51.measureKey)(measures[0]);
|
|
39255
39349
|
const windows = kind === "stuck" ? null : block.compare ?? null;
|
|
39256
39350
|
const compared = !!windows;
|
|
39257
39351
|
const grain = block.bucket?.by ?? null;
|
|
@@ -40203,7 +40297,7 @@ function clientNoun(table) {
|
|
|
40203
40297
|
var import_clipboard7 = require("@ai-matrx/kit/clipboard");
|
|
40204
40298
|
var import_react226 = require("react");
|
|
40205
40299
|
var import_react227 = require("@ai-matrx/records/react");
|
|
40206
|
-
var
|
|
40300
|
+
var import_records53 = require("@ai-matrx/records");
|
|
40207
40301
|
var import_design_system110 = require("@ai-matrx/design-system");
|
|
40208
40302
|
|
|
40209
40303
|
// src/PortalLookEditor.tsx
|
|
@@ -40212,11 +40306,11 @@ var import_react225 = require("@ai-matrx/records/react");
|
|
|
40212
40306
|
var import_design_system109 = require("@ai-matrx/design-system");
|
|
40213
40307
|
|
|
40214
40308
|
// src/AccentSwatches.tsx
|
|
40215
|
-
var
|
|
40309
|
+
var import_records52 = require("@ai-matrx/records");
|
|
40216
40310
|
var import_design_system107 = require("@ai-matrx/design-system");
|
|
40217
40311
|
var import_data_table23 = require("@ai-matrx/design-system/data-table");
|
|
40218
40312
|
var import_jsx_runtime123 = require("react/jsx-runtime");
|
|
40219
|
-
function AccentSwatches({ value, onChange, options =
|
|
40313
|
+
function AccentSwatches({ value, onChange, options = import_records52.PORTAL_ACCENTS, noneLabel = "App colour" }) {
|
|
40220
40314
|
return /* @__PURE__ */ (0, import_jsx_runtime123.jsxs)("div", { className: "flex flex-wrap gap-1.5", role: "radiogroup", "aria-label": "Colour", children: [
|
|
40221
40315
|
/* @__PURE__ */ (0, import_jsx_runtime123.jsx)(
|
|
40222
40316
|
"button",
|
|
@@ -40683,7 +40777,7 @@ function PortalsPanel({ tableId, activePortalId, className }) {
|
|
|
40683
40777
|
] }) : null,
|
|
40684
40778
|
activePortalId && !shown4.some((p) => p.portal_id === activePortalId) ? /* @__PURE__ */ (0, import_jsx_runtime126.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,
|
|
40685
40779
|
/* @__PURE__ */ (0, import_jsx_runtime126.jsx)("ul", { className: "flex flex-col gap-2", children: shown4.map((portal) => {
|
|
40686
|
-
const url = `${origin}${(0,
|
|
40780
|
+
const url = `${origin}${(0, import_records53.portalPath)(portal.slug)}`;
|
|
40687
40781
|
const open = openId === portal.portal_id;
|
|
40688
40782
|
const linked = portal.portal_id === activePortalId;
|
|
40689
40783
|
return /* @__PURE__ */ (0, import_jsx_runtime126.jsxs)(
|
|
@@ -40798,8 +40892,8 @@ function ArchivePortalControl({
|
|
|
40798
40892
|
}
|
|
40799
40893
|
),
|
|
40800
40894
|
asking ? /* @__PURE__ */ (0, import_jsx_runtime126.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: [
|
|
40801
|
-
/* @__PURE__ */ (0, import_jsx_runtime126.jsx)("p", { className: "text-xs text-muted-foreground", "data-testid": "portal-archive-consequence", children: (0,
|
|
40802
|
-
/* @__PURE__ */ (0, import_jsx_runtime126.jsx)("p", { className: "text-xs text-muted-foreground", children: (0,
|
|
40895
|
+
/* @__PURE__ */ (0, import_jsx_runtime126.jsx)("p", { className: "text-xs text-muted-foreground", "data-testid": "portal-archive-consequence", children: (0, import_records53.portalArchiveConsequence)(portal.title, portal.signed_in, portal.invited) }),
|
|
40896
|
+
/* @__PURE__ */ (0, import_jsx_runtime126.jsx)("p", { className: "text-xs text-muted-foreground", children: (0, import_records53.portalConfirmLine)(portal.title) }),
|
|
40803
40897
|
/* @__PURE__ */ (0, import_jsx_runtime126.jsxs)("div", { className: "flex flex-wrap items-center gap-1.5", children: [
|
|
40804
40898
|
/* @__PURE__ */ (0, import_jsx_runtime126.jsx)(
|
|
40805
40899
|
import_design_system110.BasicInput,
|
|
@@ -40817,7 +40911,7 @@ function ArchivePortalControl({
|
|
|
40817
40911
|
size: "sm",
|
|
40818
40912
|
variant: "destructive",
|
|
40819
40913
|
"data-testid": "portal-archive-do",
|
|
40820
|
-
disabled: busy || !(0,
|
|
40914
|
+
disabled: busy || !(0, import_records53.portalTitleTypedBack)(typed2, portal.title),
|
|
40821
40915
|
onClick: () => void go(),
|
|
40822
40916
|
children: busy ? "Archiving\u2026" : "Archive it"
|
|
40823
40917
|
}
|
|
@@ -41342,7 +41436,7 @@ function FormLookFrame({ look, title, children, contained = false, showOwnerHead
|
|
|
41342
41436
|
// src/DigestScheduler.tsx
|
|
41343
41437
|
var import_react228 = require("react");
|
|
41344
41438
|
var import_react229 = require("@ai-matrx/records/react");
|
|
41345
|
-
var
|
|
41439
|
+
var import_records54 = require("@ai-matrx/records");
|
|
41346
41440
|
var import_design_system112 = require("@ai-matrx/design-system");
|
|
41347
41441
|
|
|
41348
41442
|
// src/scheduleWords.ts
|
|
@@ -41428,7 +41522,7 @@ function DigestScheduler({
|
|
|
41428
41522
|
const [channel, setChannel] = (0, import_react228.useState)(
|
|
41429
41523
|
existing?.channel === "email" || existing?.channel === "sms" ? existing.channel : "in_app"
|
|
41430
41524
|
);
|
|
41431
|
-
const [quiet2, setQuiet] = (0, import_react228.useState)((0,
|
|
41525
|
+
const [quiet2, setQuiet] = (0, import_react228.useState)((0, import_records54.hasQuietHours)(existing?.quiet_hours));
|
|
41432
41526
|
const [quietFrom, setQuietFrom] = (0, import_react228.useState)(existing?.quiet_hours?.start ?? "22:00");
|
|
41433
41527
|
const [quietTo, setQuietTo] = (0, import_react228.useState)(existing?.quiet_hours?.end ?? "07:00");
|
|
41434
41528
|
const [recipients, setRecipients] = (0, import_react228.useState)(
|
|
@@ -41714,7 +41808,7 @@ function DigestScheduler({
|
|
|
41714
41808
|
// src/SubscriptionsPanel.tsx
|
|
41715
41809
|
var import_react232 = require("react");
|
|
41716
41810
|
var import_react233 = require("@ai-matrx/records/react");
|
|
41717
|
-
var
|
|
41811
|
+
var import_records55 = require("@ai-matrx/records");
|
|
41718
41812
|
var import_design_system114 = require("@ai-matrx/design-system");
|
|
41719
41813
|
|
|
41720
41814
|
// src/WebhooksPanel.tsx
|
|
@@ -42077,7 +42171,7 @@ function SubscriptionsPanel({ tableId, activeRuleId, className }) {
|
|
|
42077
42171
|
"Last told you ",
|
|
42078
42172
|
new Date(subscription.last_sent_at).toLocaleString()
|
|
42079
42173
|
] }) : /* @__PURE__ */ (0, import_jsx_runtime130.jsx)("span", { children: "It has not told you anything yet." }),
|
|
42080
|
-
(0,
|
|
42174
|
+
(0, import_records55.hasQuietHours)(subscription.quiet_hours) ? /* @__PURE__ */ (0, import_jsx_runtime130.jsxs)("span", { children: [
|
|
42081
42175
|
"Not between ",
|
|
42082
42176
|
subscription.quiet_hours.start,
|
|
42083
42177
|
" and ",
|
|
@@ -42148,7 +42242,7 @@ var import_core24 = require("@dnd-kit/core");
|
|
|
42148
42242
|
var import_sortable = require("@dnd-kit/sortable");
|
|
42149
42243
|
var import_utilities = require("@dnd-kit/utilities");
|
|
42150
42244
|
var import_react238 = require("@ai-matrx/records/react");
|
|
42151
|
-
var
|
|
42245
|
+
var import_records56 = require("@ai-matrx/records");
|
|
42152
42246
|
var import_design_system118 = require("@ai-matrx/design-system");
|
|
42153
42247
|
|
|
42154
42248
|
// src/FormFlowEditor.tsx
|
|
@@ -43471,7 +43565,7 @@ function FormBuilder({ tableId, seed, activeFormId, onActiveForm, startWithOne,
|
|
|
43471
43565
|
/* @__PURE__ */ (0, import_jsx_runtime133.jsx)(
|
|
43472
43566
|
PublishRow,
|
|
43473
43567
|
{
|
|
43474
|
-
url: `${publicOrigin}${(0,
|
|
43568
|
+
url: `${publicOrigin}${(0, import_records56.publicFormPath)(draft.id)}`,
|
|
43475
43569
|
state: draft.state,
|
|
43476
43570
|
mayPublish: rights.structure,
|
|
43477
43571
|
why: rights.why("structure"),
|
|
@@ -43483,7 +43577,7 @@ function FormBuilder({ tableId, seed, activeFormId, onActiveForm, startWithOne,
|
|
|
43483
43577
|
unsaved: dirty
|
|
43484
43578
|
}
|
|
43485
43579
|
),
|
|
43486
|
-
/* @__PURE__ */ (0, import_jsx_runtime133.jsx)(EmbedSnippets, { url: `${publicOrigin}${(0,
|
|
43580
|
+
/* @__PURE__ */ (0, import_jsx_runtime133.jsx)(EmbedSnippets, { url: `${publicOrigin}${(0, import_records56.publicFormPath)(draft.id)}`, label: draft.name }),
|
|
43487
43581
|
/* @__PURE__ */ (0, import_jsx_runtime133.jsx)(
|
|
43488
43582
|
NotifyOnAnswer,
|
|
43489
43583
|
{
|
|
@@ -44536,7 +44630,7 @@ function SignBlock({ tableId, recordId, render, className }) {
|
|
|
44536
44630
|
// src/NotifyRuleEditor.tsx
|
|
44537
44631
|
var import_react246 = require("react");
|
|
44538
44632
|
var import_react247 = require("@ai-matrx/records/react");
|
|
44539
|
-
var
|
|
44633
|
+
var import_records57 = require("@ai-matrx/records");
|
|
44540
44634
|
var import_design_system122 = require("@ai-matrx/design-system");
|
|
44541
44635
|
var import_jsx_runtime137 = require("react/jsx-runtime");
|
|
44542
44636
|
var CADENCE_WORDS2 = SUBSCRIPTION_CADENCE_LABEL;
|
|
@@ -44687,7 +44781,7 @@ function NotifyRuleEditor({ tableId, seed, chosenRuleId, onChoose, className })
|
|
|
44687
44781
|
"next ",
|
|
44688
44782
|
new Date(held.next_digest_at).toLocaleString()
|
|
44689
44783
|
] }) : null,
|
|
44690
|
-
(0,
|
|
44784
|
+
(0, import_records57.hasQuietHours)(held.quiet_hours) ? /* @__PURE__ */ (0, import_jsx_runtime137.jsxs)("span", { className: "text-muted-foreground", children: [
|
|
44691
44785
|
"quiet ",
|
|
44692
44786
|
held.quiet_hours.start,
|
|
44693
44787
|
"\u2013",
|
|
@@ -45373,7 +45467,7 @@ function AddChart({ subject, onAdd, onClose }) {
|
|
|
45373
45467
|
}
|
|
45374
45468
|
|
|
45375
45469
|
// src/pages.ts
|
|
45376
|
-
var
|
|
45470
|
+
var import_records58 = require("@ai-matrx/records");
|
|
45377
45471
|
var PAGE_BLOCK_KINDS = ["list", "record", "button", "form", "filter", "chart", "heading", "text", "applet"];
|
|
45378
45472
|
var PAGE_BLOCK_LABEL = {
|
|
45379
45473
|
list: "List",
|
|
@@ -45423,10 +45517,10 @@ function filterTargets(filter, blocks) {
|
|
|
45423
45517
|
}
|
|
45424
45518
|
function combineFilter(base, extra, fieldIdOf) {
|
|
45425
45519
|
const extraKeys = Object.keys(extra);
|
|
45426
|
-
if (!base || !(0,
|
|
45520
|
+
if (!base || !(0, import_records58.isRuleFilter)(base) && Object.keys(base).length === 0) {
|
|
45427
45521
|
return { filter: extraKeys.length > 0 ? { ...extra } : null, dropped: [] };
|
|
45428
45522
|
}
|
|
45429
|
-
if (!(0,
|
|
45523
|
+
if (!(0, import_records58.isRuleFilter)(base)) return { filter: { ...base, ...extra }, dropped: [] };
|
|
45430
45524
|
const dropped = [];
|
|
45431
45525
|
let rule = base;
|
|
45432
45526
|
for (const key of extraKeys) {
|
|
@@ -46084,7 +46178,7 @@ var import_design_system127 = require("@ai-matrx/design-system");
|
|
|
46084
46178
|
var import_react257 = require("@ai-matrx/records/react");
|
|
46085
46179
|
|
|
46086
46180
|
// src/question.ts
|
|
46087
|
-
var
|
|
46181
|
+
var import_records59 = require("@ai-matrx/records");
|
|
46088
46182
|
var import_core26 = require("@ai-matrx/records/core");
|
|
46089
46183
|
var QUESTION_OPS = ["count", "sum", "avg", "min", "max"];
|
|
46090
46184
|
var QUESTION_LIMIT_DEFAULT = 25;
|
|
@@ -46163,7 +46257,7 @@ async function askQuestion(client, tableId, spec, fields) {
|
|
|
46163
46257
|
for (const m of measures) {
|
|
46164
46258
|
if (m.op !== "count" && !m.key) return refusal3(`Pick the column to ${m.op === "avg" ? "average" : m.op}.`);
|
|
46165
46259
|
}
|
|
46166
|
-
const keys = measures.map((m) => (0,
|
|
46260
|
+
const keys = measures.map((m) => (0, import_records59.measureKey)({ op: m.op, ...m.key ? { key: m.key } : {} }));
|
|
46167
46261
|
const group = spec.group;
|
|
46168
46262
|
if (spec.asOf) return askAsOf(client, tableId, spec, fields, measures, keys);
|
|
46169
46263
|
let filter = spec.where ?? {};
|
|
@@ -47008,7 +47102,7 @@ function QuestionAnswerView({ tableId, spec, answer, fields, related = NO_RELATE
|
|
|
47008
47102
|
// src/TableAsk.tsx
|
|
47009
47103
|
var import_react258 = require("react");
|
|
47010
47104
|
var import_design_system128 = require("@ai-matrx/design-system");
|
|
47011
|
-
var
|
|
47105
|
+
var import_records60 = require("@ai-matrx/records");
|
|
47012
47106
|
var import_react259 = require("@ai-matrx/records/react");
|
|
47013
47107
|
|
|
47014
47108
|
// src/askWords.ts
|
|
@@ -47238,7 +47332,7 @@ function TableAsk({ tableId, onOpenInQuestions }) {
|
|
|
47238
47332
|
await Promise.all(
|
|
47239
47333
|
all.filter(isChoiceField).map(async (field2) => {
|
|
47240
47334
|
const got = await fieldOptionsOnce(client, field2.id);
|
|
47241
|
-
if (got.ok) choices[field2.key] = (got.data ?? []).map((o) => (0,
|
|
47335
|
+
if (got.ok) choices[field2.key] = (got.data ?? []).map((o) => (0, import_records60.optionLabel)(o)).filter((w) => Boolean(w));
|
|
47242
47336
|
})
|
|
47243
47337
|
);
|
|
47244
47338
|
const read = questionFromWords(words2, all, choices);
|
|
@@ -48088,7 +48182,7 @@ function onePerKey3(all) {
|
|
|
48088
48182
|
var import_clipboard11 = require("@ai-matrx/kit/clipboard");
|
|
48089
48183
|
var import_react262 = require("react");
|
|
48090
48184
|
var import_react263 = require("@ai-matrx/records/react");
|
|
48091
|
-
var
|
|
48185
|
+
var import_records61 = require("@ai-matrx/records");
|
|
48092
48186
|
var import_design_system130 = require("@ai-matrx/design-system");
|
|
48093
48187
|
var import_jsx_runtime146 = require("react/jsx-runtime");
|
|
48094
48188
|
var FORM_NOT_HERE_LINE = "The link named a form this table does not have \u2014 it may have been removed, or it belongs to another table. The forms this table does have are listed here.";
|
|
@@ -48193,7 +48287,7 @@ function FormsPanel({ tableId, activeFormId, className }) {
|
|
|
48193
48287
|
}
|
|
48194
48288
|
) : null,
|
|
48195
48289
|
/* @__PURE__ */ (0, import_jsx_runtime146.jsx)("ul", { className: "flex flex-col gap-2", children: forms.map((form) => {
|
|
48196
|
-
const url = `${origin}${(0,
|
|
48290
|
+
const url = `${origin}${(0, import_records61.publicFormPath)(form.form_id)}`;
|
|
48197
48291
|
return /* @__PURE__ */ (0, import_jsx_runtime146.jsxs)(
|
|
48198
48292
|
"li",
|
|
48199
48293
|
{
|
|
@@ -48275,7 +48369,7 @@ var import_design_system132 = require("@ai-matrx/design-system");
|
|
|
48275
48369
|
|
|
48276
48370
|
// src/CaptureRun.tsx
|
|
48277
48371
|
var import_react264 = require("react");
|
|
48278
|
-
var
|
|
48372
|
+
var import_records62 = require("@ai-matrx/records");
|
|
48279
48373
|
var import_react265 = require("@ai-matrx/records/react");
|
|
48280
48374
|
var import_design_system131 = require("@ai-matrx/design-system");
|
|
48281
48375
|
var import_jsx_runtime147 = require("react/jsx-runtime");
|
|
@@ -48330,7 +48424,7 @@ function CaptureRun({ sheetId, face: given, className }) {
|
|
|
48330
48424
|
const [sending, setSending] = (0, import_react264.useState)(false);
|
|
48331
48425
|
const queueRef = (0, import_react264.useRef)(null);
|
|
48332
48426
|
(0, import_react264.useEffect)(() => {
|
|
48333
|
-
const q2 = (0,
|
|
48427
|
+
const q2 = (0, import_records62.openCaptureQueue)({
|
|
48334
48428
|
onChange: (c, all) => {
|
|
48335
48429
|
setCounts(c);
|
|
48336
48430
|
setItems(all);
|
|
@@ -48597,7 +48691,7 @@ function CaptureRun({ sheetId, face: given, className }) {
|
|
|
48597
48691
|
value: String(answers[q.field] ?? ""),
|
|
48598
48692
|
onChange: (e) => {
|
|
48599
48693
|
const raw = e.target.value;
|
|
48600
|
-
const answered2 = field2 ? (0,
|
|
48694
|
+
const answered2 = field2 ? (0, import_records62.coerceTypedAnswer)(field2, raw, { label: q.ask ?? (0, import_records62.coercionLabel)(field2) }) : { value: raw };
|
|
48601
48695
|
setAnswers((held) => ({
|
|
48602
48696
|
...held,
|
|
48603
48697
|
[q.field]: raw === "" ? "" : "refusal" in answered2 ? raw : answered2.value
|
|
@@ -49251,7 +49345,7 @@ function useEmbedHandshake(args) {
|
|
|
49251
49345
|
// src/TablePage.tsx
|
|
49252
49346
|
var import_clipboard14 = require("@ai-matrx/kit/clipboard");
|
|
49253
49347
|
var import_react284 = require("react");
|
|
49254
|
-
var
|
|
49348
|
+
var import_records63 = require("@ai-matrx/records");
|
|
49255
49349
|
var import_react285 = require("@ai-matrx/records/react");
|
|
49256
49350
|
var import_design_system142 = require("@ai-matrx/design-system");
|
|
49257
49351
|
var import_text_case19 = require("@ai-matrx/kit/text-case");
|
|
@@ -50086,7 +50180,7 @@ function TableNotHere({
|
|
|
50086
50180
|
return /* @__PURE__ */ (0, import_jsx_runtime158.jsxs)("div", { className: (0, import_design_system142.cn)("flex flex-col items-start gap-2 rounded-md border border-dashed p-6", className), children: [
|
|
50087
50181
|
/* @__PURE__ */ (0, import_jsx_runtime158.jsx)("p", { className: "text-sm font-medium", children: "This table is archived" }),
|
|
50088
50182
|
/* @__PURE__ */ (0, import_jsx_runtime158.jsx)("p", { className: "max-w-prose text-xs text-muted-foreground", children: TABLE_IS_ARCHIVED }),
|
|
50089
|
-
/* @__PURE__ */ (0, import_jsx_runtime158.jsx)("p", { className: "text-xs text-muted-foreground", children: (0,
|
|
50183
|
+
/* @__PURE__ */ (0, import_jsx_runtime158.jsx)("p", { className: "text-xs text-muted-foreground", children: (0, import_records63.archivedByLine)(row) }),
|
|
50090
50184
|
refusal4 ? /* @__PURE__ */ (0, import_jsx_runtime158.jsx)(RefusalNotice, { error: refusal4 }) : null,
|
|
50091
50185
|
/* @__PURE__ */ (0, import_jsx_runtime158.jsxs)("div", { className: "flex gap-2", children: [
|
|
50092
50186
|
/* @__PURE__ */ (0, import_jsx_runtime158.jsx)(
|
|
@@ -51541,7 +51635,7 @@ function TablePage2(props) {
|
|
|
51541
51635
|
|
|
51542
51636
|
// src/DataBindingPicker.tsx
|
|
51543
51637
|
var import_react288 = require("react");
|
|
51544
|
-
var
|
|
51638
|
+
var import_records64 = require("@ai-matrx/records");
|
|
51545
51639
|
var import_react289 = require("@ai-matrx/records/react");
|
|
51546
51640
|
var import_design_system145 = require("@ai-matrx/design-system");
|
|
51547
51641
|
var import_jsx_runtime161 = require("react/jsx-runtime");
|
|
@@ -51575,7 +51669,7 @@ function isCompleteDataBinding(binding) {
|
|
|
51575
51669
|
}
|
|
51576
51670
|
function bindingPlaceholdersFor(field2) {
|
|
51577
51671
|
const label = fieldName(field2);
|
|
51578
|
-
if ((0,
|
|
51672
|
+
if ((0, import_records64.isEntityReferenceConfig)(field2.config)) {
|
|
51579
51673
|
return [
|
|
51580
51674
|
{ token: `{${field2.key}.name}`, label: `${label} \xB7 name` },
|
|
51581
51675
|
{ token: `{${field2.key}.id}`, label: `${label} \xB7 id` }
|