@ai-matrx/records-ui 0.116.62 → 0.116.63
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 +13 -1
- package/dist/{chunk-NTOTMYVO.js → chunk-X2WDIQIR.js} +48 -5
- package/dist/{chunk-NTOTMYVO.js.map → chunk-X2WDIQIR.js.map} +1 -1
- package/dist/index.cjs +92 -16
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +4 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.js +52 -13
- package/dist/index.js.map +1 -1
- package/dist/pickers.js +1 -1
- package/package.json +6 -6
package/dist/index.cjs
CHANGED
|
@@ -8978,17 +8978,39 @@ var import_first_page = require("@ai-matrx/records/first-page");
|
|
|
8978
8978
|
var import_first_page2 = require("@ai-matrx/records/first-page");
|
|
8979
8979
|
var import_data = require("@ai-matrx/records/data");
|
|
8980
8980
|
function sortRefusal(f) {
|
|
8981
|
+
if (isWithheld(f)) return `${fieldName(f)} is withheld from you, so rows cannot be sorted by it.`;
|
|
8981
8982
|
if (!computedOnRead(f)) return null;
|
|
8982
8983
|
return `${fieldName(f)} is worked out each time it is read, so the whole table cannot be sorted by it. Sort by a column it is worked out from.`;
|
|
8983
8984
|
}
|
|
8984
8985
|
function sortAndFilterRefusal(f) {
|
|
8985
8986
|
if (sortRefusal(f) === null) return null;
|
|
8987
|
+
if (isWithheld(f)) return `${fieldName(f)} is withheld from you, so it can be neither sorted nor filtered.`;
|
|
8986
8988
|
return `${fieldName(f)} is worked out each time it is read, so it can be neither sorted nor filtered. Use a column it is worked out from.`;
|
|
8987
8989
|
}
|
|
8988
8990
|
function filterRefusal(f) {
|
|
8991
|
+
if (isWithheld(f)) return `${fieldName(f)} is withheld from you, so rows cannot be filtered by it.`;
|
|
8989
8992
|
if (!computedOnRead(f)) return null;
|
|
8990
8993
|
return `${fieldName(f)} is worked out each time it is read, so the whole table cannot be filtered by it. Filter by a column it is worked out from.`;
|
|
8991
8994
|
}
|
|
8995
|
+
var isWithheld = (f) => f.withheld === true;
|
|
8996
|
+
function withheldKeysOf(rows) {
|
|
8997
|
+
const out = /* @__PURE__ */ new Set();
|
|
8998
|
+
const [first, ...rest] = rows;
|
|
8999
|
+
if (!first?.hidden) return out;
|
|
9000
|
+
for (const key of Object.keys(first.hidden)) {
|
|
9001
|
+
const note = first.hidden[key];
|
|
9002
|
+
if (note && typeof note === "object" && rest.every((row) => row.hidden?.[key] && typeof row.hidden[key] === "object")) out.add(key);
|
|
9003
|
+
}
|
|
9004
|
+
return out;
|
|
9005
|
+
}
|
|
9006
|
+
function markWithheld(fields, keys) {
|
|
9007
|
+
if (keys.size === 0) return fields;
|
|
9008
|
+
return fields.map((f) => keys.has(f.key) ? { ...f, withheld: true } : f);
|
|
9009
|
+
}
|
|
9010
|
+
function skipWhenWithheld(filter) {
|
|
9011
|
+
if (!filter || !(0, import_records.isRuleFilter)(filter)) return filter;
|
|
9012
|
+
return { op: "and", args: [filter], skip_withheld: true };
|
|
9013
|
+
}
|
|
8992
9014
|
function computedOnRead(f) {
|
|
8993
9015
|
const kind2 = String(editorKindFor(f));
|
|
8994
9016
|
return (f.type === "formula" || kind2 === "formula" || kind2 === "lookup" || kind2 === "rollup") && String(f.compute_on ?? "read") === "read";
|
|
@@ -11149,6 +11171,9 @@ function toRows(fields, records, labels) {
|
|
|
11149
11171
|
});
|
|
11150
11172
|
}
|
|
11151
11173
|
|
|
11174
|
+
// src/gridLook.ts
|
|
11175
|
+
var import_transfer_json = require("@ai-matrx/kit/transfer-json");
|
|
11176
|
+
|
|
11152
11177
|
// src/tableJson.ts
|
|
11153
11178
|
var import_core2 = require("@ai-matrx/records/core");
|
|
11154
11179
|
var import_delimited = require("@ai-matrx/kit/delimited");
|
|
@@ -11371,10 +11396,25 @@ function gridCopyConfig(args) {
|
|
|
11371
11396
|
return {
|
|
11372
11397
|
// THE TOOLBAR'S OWN "Download" (CSV, TSV, Excel, Copy as table) writes the rows through the same
|
|
11373
11398
|
// words the rail writes (`fileExport.ts`): the value as the grid SHOWS it, a date in her zone.
|
|
11374
|
-
|
|
11375
|
-
|
|
11376
|
-
|
|
11377
|
-
|
|
11399
|
+
// A NUMBER OR A DATE IS A REAL SHEET CELL in the Excel workbook, as in the rail's: the hidden twin of its column carries
|
|
11400
|
+
// the typed cell (`SHEET_CELL_SUFFIX`); every text format reads the visible column, the words the grid shows.
|
|
11401
|
+
sheetColumns: () => [
|
|
11402
|
+
...fields.map((field2) => ({ id: field2.key, label: fieldName(field2) })),
|
|
11403
|
+
...fields.map((field2) => ({ id: field2.key + import_transfer_json.SHEET_CELL_SUFFIX, label: fieldName(field2) }))
|
|
11404
|
+
],
|
|
11405
|
+
sheetRows: () => {
|
|
11406
|
+
const exported = toRows([...fields], viewRows(), labels);
|
|
11407
|
+
return displayRows(exported).map(
|
|
11408
|
+
(row, at) => Object.fromEntries([
|
|
11409
|
+
...fields.map((field2) => [field2.key, row[field2.key]?.value ?? null]),
|
|
11410
|
+
...fields.map((field2) => {
|
|
11411
|
+
const cell2 = exported[at]?.[field2.key];
|
|
11412
|
+
const typed2 = cell2 && !cell2.absent_reason ? cell2.typed : void 0;
|
|
11413
|
+
return [field2.key + import_transfer_json.SHEET_CELL_SUFFIX, typed2 ? { t: typed2.t, v: typed2.v, ...typed2.z ? { z: typed2.z } : {} } : null];
|
|
11414
|
+
})
|
|
11415
|
+
])
|
|
11416
|
+
);
|
|
11417
|
+
},
|
|
11378
11418
|
items: [
|
|
11379
11419
|
{ id: "csv-row-ids", label: "CSV with row IDs", build: () => ({ content: exportCsvWithRowIds(fields, stored(visible), ids(visible)), extension: "csv", mime: "text/csv;charset=utf-8", filename: `${tableName2} with row IDs` }) },
|
|
11380
11420
|
{ id: "table-json", label: "JSON with row IDs", build: () => ({ content: exportJson(fields, stored(visible), ids(visible)), extension: "json", mime: "application/json;charset=utf-8", filename: tableName2 }) },
|
|
@@ -33340,6 +33380,7 @@ function GridBody({
|
|
|
33340
33380
|
openRecordId = null,
|
|
33341
33381
|
onCloseRecord,
|
|
33342
33382
|
onRowsShown,
|
|
33383
|
+
onWithheldColumns,
|
|
33343
33384
|
onAddField,
|
|
33344
33385
|
onNewRecordForm,
|
|
33345
33386
|
toolbarActions,
|
|
@@ -33773,12 +33814,19 @@ function GridBody({
|
|
|
33773
33814
|
const lines = rowLines(look.rowHeight);
|
|
33774
33815
|
const wrapColumnSet = (0, import_react183.useMemo)(() => new Set(presentation.wrapColumns ?? []), [presentation.wrapColumns]);
|
|
33775
33816
|
const frozenKeys = (0, import_react183.useMemo)(() => new Set(frozenList), [frozenList]);
|
|
33817
|
+
const withheldKey = (0, import_react183.useMemo)(() => [...withheldKeysOf(rows)].sort().join(""), [rows]);
|
|
33818
|
+
const withheldKeys = (0, import_react183.useMemo)(() => new Set(withheldKey === "" ? [] : withheldKey.split("")), [withheldKey]);
|
|
33819
|
+
const onWithheldRef = (0, import_react183.useRef)(onWithheldColumns);
|
|
33820
|
+
onWithheldRef.current = onWithheldColumns;
|
|
33821
|
+
(0, import_react183.useEffect)(() => {
|
|
33822
|
+
onWithheldRef.current?.(withheldKey === "" ? [] : withheldKey.split(""));
|
|
33823
|
+
}, [withheldKey]);
|
|
33776
33824
|
const ordered = (0, import_react183.useMemo)(() => {
|
|
33777
|
-
const all = [...fields.data ?? []].sort(compareFieldOrder);
|
|
33825
|
+
const all = markWithheld([...fields.data ?? []].sort(compareFieldOrder), withheldKeys);
|
|
33778
33826
|
if (frozenKeys.size === 0) return all;
|
|
33779
33827
|
const pinned = frozenList.map((key) => all.find((f) => f.key === key)).filter((f) => f !== void 0);
|
|
33780
33828
|
return [...pinned, ...all.filter((f) => !frozenKeys.has(f.key))];
|
|
33781
|
-
}, [fields.data, frozenKeys, frozenList]);
|
|
33829
|
+
}, [fields.data, frozenKeys, frozenList, withheldKeys]);
|
|
33782
33830
|
const tableActions2 = useTableActions(tableId, canWrite || Boolean(host.runAgentAction));
|
|
33783
33831
|
const ownWord = (table.data?.label_singular ?? "").trim();
|
|
33784
33832
|
const sameAsName = ownWord === "" || (table.data ? ownWord.toLowerCase() === tableName(table.data).toLowerCase() : true);
|
|
@@ -34935,8 +34983,8 @@ function GridBody({
|
|
|
34935
34983
|
);
|
|
34936
34984
|
const toolbarFields = fields.data;
|
|
34937
34985
|
const sortableColumns = (0, import_react183.useMemo)(
|
|
34938
|
-
() => (fields.data ?? []).filter((f) => sortRefusal(f) === null).map((f) => ({ key: f.key, label: columnLabel(fields.data ?? [], f.key) })),
|
|
34939
|
-
[fields.data]
|
|
34986
|
+
() => markWithheld(fields.data ?? [], withheldKeys).filter((f) => sortRefusal(f) === null).map((f) => ({ key: f.key, label: columnLabel(fields.data ?? [], f.key) })),
|
|
34987
|
+
[fields.data, withheldKeys]
|
|
34940
34988
|
);
|
|
34941
34989
|
const hasSeveralRows = rows.length > 1;
|
|
34942
34990
|
const editingBusy = editing.busy;
|
|
@@ -35282,7 +35330,8 @@ function GridBody({
|
|
|
35282
35330
|
}
|
|
35283
35331
|
) : null,
|
|
35284
35332
|
question.refused.length > 0 ? /* @__PURE__ */ (0, import_jsx_runtime112.jsx)("p", { role: "status", "data-records-filter-refused": "", className: "text-xs text-muted-foreground", children: question.refused.join(" ") }) : null,
|
|
35285
|
-
storePaged && sortIgnoredOf(serverRead.data).length > 0 ? /* @__PURE__ */ (0, import_jsx_runtime112.jsx)("p", { role: "status", "data-records-sort-ignored": sortIgnoredOf(serverRead.data).join(" "), className: "text-xs text-muted-foreground", children:
|
|
35333
|
+
storePaged && sortIgnoredOf(serverRead.data).length > 0 ? /* @__PURE__ */ (0, import_jsx_runtime112.jsx)("p", { role: "status", "data-records-sort-ignored": sortIgnoredOf(serverRead.data).join(" "), className: "text-xs text-muted-foreground", children: sortSkippedSentence(sortIgnoredOf(serverRead.data), fields.data ?? []) }) : null,
|
|
35334
|
+
storePaged && filterIgnoredOf(serverRead.data).length > 0 ? /* @__PURE__ */ (0, import_jsx_runtime112.jsx)("p", { role: "status", "data-records-filter-ignored": filterIgnoredOf(serverRead.data).join(" "), className: "text-xs text-muted-foreground", children: filterSkippedSentence(filterIgnoredOf(serverRead.data), fields.data ?? []) }) : null,
|
|
35286
35335
|
runner.outcome && !(merged && runner.outcome.kind === "ran" && runner.outcome.undo !== null) ? /* @__PURE__ */ (0, import_jsx_runtime112.jsx)(ActionOutcomeNotice, { outcome: runner.outcome, onUndo: () => void runner.undo(), onDismiss: runner.dismiss }) : null,
|
|
35287
35336
|
duplicated ? /* @__PURE__ */ (0, import_jsx_runtime112.jsxs)("p", { role: "status", "data-records-duplicated": "", className: "flex items-center gap-2 rounded border border-border bg-muted/40 px-2 py-1 text-xs", children: [
|
|
35288
35337
|
/* @__PURE__ */ (0, import_jsx_runtime112.jsx)("span", { children: duplicated }),
|
|
@@ -35689,6 +35738,26 @@ function withoutGoneColumns(query, liveKeys, openingSort) {
|
|
|
35689
35738
|
const fallback = openingSort && liveKeys.has(openingSort.id) ? openingSort : null;
|
|
35690
35739
|
return { ...query, sort: sortGone ? fallback : query.sort, columnFilters, page: 1 };
|
|
35691
35740
|
}
|
|
35741
|
+
function sortSkippedSentence(keys, fields) {
|
|
35742
|
+
const names2 = keys.map((key) => {
|
|
35743
|
+
const field2 = fields.find((f) => f.key === key);
|
|
35744
|
+
return field2 ? fieldName(field2) : null;
|
|
35745
|
+
});
|
|
35746
|
+
const named = names2.filter((n) => n !== null);
|
|
35747
|
+
if (named.length === 0) return "Sort skipped: that column is no longer there. The default order is shown.";
|
|
35748
|
+
return `Sort skipped: ${named.join(", ")} ${named.length === 1 ? "is" : "are"} withheld from you. The default order is shown.`;
|
|
35749
|
+
}
|
|
35750
|
+
function filterSkippedSentence(keys, fields) {
|
|
35751
|
+
const named = keys.map((key) => {
|
|
35752
|
+
const field2 = fields.find((f) => f.key === key);
|
|
35753
|
+
return field2 ? fieldName(field2) : null;
|
|
35754
|
+
}).filter((n) => n !== null);
|
|
35755
|
+
if (named.length === 0) return "Filter skipped: that column is no longer there.";
|
|
35756
|
+
return `Filter skipped: ${named.join(", ")} ${named.length === 1 ? "is" : "are"} withheld from you.`;
|
|
35757
|
+
}
|
|
35758
|
+
function filterIgnoredOf(answer) {
|
|
35759
|
+
return Array.isArray(answer?.filterIgnored) ? answer.filterIgnored : [];
|
|
35760
|
+
}
|
|
35692
35761
|
function sortIgnoredOf(answer) {
|
|
35693
35762
|
return Array.isArray(answer?.sortIgnored) ? answer.sortIgnored : [];
|
|
35694
35763
|
}
|
|
@@ -47209,6 +47278,7 @@ function ViewSwitcherBody({
|
|
|
47209
47278
|
openRecordId,
|
|
47210
47279
|
onCloseRecord,
|
|
47211
47280
|
onRowsShown,
|
|
47281
|
+
onWithheldColumns,
|
|
47212
47282
|
onMoved,
|
|
47213
47283
|
onNewRecordForm,
|
|
47214
47284
|
onAskWhoChanged,
|
|
@@ -47287,6 +47357,7 @@ function ViewSwitcherBody({
|
|
|
47287
47357
|
...openRecordId ? { openRecordId } : {},
|
|
47288
47358
|
...onCloseRecord ? { onCloseRecord } : {},
|
|
47289
47359
|
...onRowsShown ? { onRowsShown } : {},
|
|
47360
|
+
...onWithheldColumns ? { onWithheldColumns } : {},
|
|
47290
47361
|
...onNewRecordForm ? { onNewRecordForm } : {},
|
|
47291
47362
|
...onAskWhoChanged ? { onAskWhoChanged } : {},
|
|
47292
47363
|
...viewId ? {
|
|
@@ -52033,7 +52104,9 @@ function DigestScheduler({
|
|
|
52033
52104
|
table_id: tableId,
|
|
52034
52105
|
spec: {
|
|
52035
52106
|
name: subjectName?.trim() ? subjectName.trim() : name.trim() || fallbackName,
|
|
52036
|
-
filters: filters ?? {}
|
|
52107
|
+
filters: filters ?? {},
|
|
52108
|
+
// The summary's own view: it is read by id for what the summary sends, and is in no person's view list.
|
|
52109
|
+
definition: { system: true }
|
|
52037
52110
|
}
|
|
52038
52111
|
});
|
|
52039
52112
|
if (!declared2.ok) {
|
|
@@ -60967,7 +61040,7 @@ function conditionCount(expr) {
|
|
|
60967
61040
|
}
|
|
60968
61041
|
return 1;
|
|
60969
61042
|
}
|
|
60970
|
-
function ViewFilter({ tableId, view, onApply, className }) {
|
|
61043
|
+
function ViewFilter({ tableId, view, onApply, withheldKeys, className }) {
|
|
60971
61044
|
const fields = (0, import_react346.useFields)(tableId);
|
|
60972
61045
|
const [open, setOpen] = (0, import_react345.useState)(false);
|
|
60973
61046
|
const saved = view?.where ?? null;
|
|
@@ -60997,7 +61070,8 @@ function ViewFilter({ tableId, view, onApply, className }) {
|
|
|
60997
61070
|
};
|
|
60998
61071
|
}, [open, client, relations]);
|
|
60999
61072
|
const conditionFields = (0, import_react345.useMemo)(() => {
|
|
61000
|
-
const
|
|
61073
|
+
const withheld = new Set(withheldKeys ?? []);
|
|
61074
|
+
const own3 = (fields.data ?? []).filter((f) => !withheld.has(f.key)).map((f) => ({ id: f.id, key: f.key, label: f.label || f.key, field: f }));
|
|
61001
61075
|
const reached = relations.flatMap(
|
|
61002
61076
|
(rel) => (linkedFields[rel.id] ?? []).filter((inner2) => inner2.type !== "relation").map((inner2) => ({
|
|
61003
61077
|
id: `${rel.id}>${inner2.id}`,
|
|
@@ -61008,7 +61082,7 @@ function ViewFilter({ tableId, view, onApply, className }) {
|
|
|
61008
61082
|
}))
|
|
61009
61083
|
);
|
|
61010
61084
|
return [...own3, ...reached];
|
|
61011
|
-
}, [fields.data, relations, linkedFields]);
|
|
61085
|
+
}, [fields.data, relations, linkedFields, withheldKeys]);
|
|
61012
61086
|
if (!view) return null;
|
|
61013
61087
|
const count = conditionCount(saved);
|
|
61014
61088
|
const changed2 = JSON.stringify(draft) !== savedKey;
|
|
@@ -61947,7 +62021,7 @@ function TablePage({
|
|
|
61947
62021
|
const shareInMenu = phone || toolbarFold2 >= 4;
|
|
61948
62022
|
const faceUnknown = !opened.layout && (views === void 0 || looks === void 0 || Array.isArray(views) && views.length > 0 && view === null);
|
|
61949
62023
|
const shownLayout = layoutFromLink ?? shown5?.layout ?? "grid";
|
|
61950
|
-
const shownFilter = filter ?? (shown5?.where ? shown5.where : null) ?? (shown5?.filters && Object.keys(shown5.filters).length > 0 ? shown5.filters : null);
|
|
62024
|
+
const shownFilter = filter ?? (shown5?.where ? skipWhenWithheld(shown5.where) : null) ?? (shown5?.filters && Object.keys(shown5.filters).length > 0 ? shown5.filters : null);
|
|
61951
62025
|
const press = (pressed) => {
|
|
61952
62026
|
const next = chooseSurface(surface, pressed);
|
|
61953
62027
|
setSurface(next);
|
|
@@ -62004,6 +62078,7 @@ function TablePage({
|
|
|
62004
62078
|
setSurface((now) => ({ ...now, rail: "record" }));
|
|
62005
62079
|
}, [activeRecordId]);
|
|
62006
62080
|
const [shownIds, setShownIdsRaw] = (0, import_react349.useState)([]);
|
|
62081
|
+
const [withheldKeys, setWithheldKeys] = (0, import_react349.useState)([]);
|
|
62007
62082
|
const setShownIds = (0, import_react349.useCallback)(
|
|
62008
62083
|
(next) => setShownIdsRaw((prev) => prev.length === next.length && prev.every((id, i) => id === next[i]) ? prev : next),
|
|
62009
62084
|
[]
|
|
@@ -62230,7 +62305,7 @@ function TablePage({
|
|
|
62230
62305
|
}
|
|
62231
62306
|
);
|
|
62232
62307
|
const sheetExtras = controlsInSheet && main === "records" && shownLayout === "grid" ? /* @__PURE__ */ (0, import_jsx_runtime200.jsxs)(import_jsx_runtime200.Fragment, { children: [
|
|
62233
|
-
/* @__PURE__ */ (0, import_jsx_runtime200.jsx)("div", { className: "flex items-center gap-2 text-xs", "data-table-sheet-filter": "", "data-matrx-table-tools-keep-open": "", children: /* @__PURE__ */ (0, import_jsx_runtime200.jsx)(ViewFilter, { tableId, view: shown5, onApply: (where) => void patchView({ where }) }) }),
|
|
62308
|
+
/* @__PURE__ */ (0, import_jsx_runtime200.jsx)("div", { className: "flex items-center gap-2 text-xs", "data-table-sheet-filter": "", "data-matrx-table-tools-keep-open": "", children: /* @__PURE__ */ (0, import_jsx_runtime200.jsx)(ViewFilter, { tableId, view: shown5, withheldKeys, onApply: (where) => void patchView({ where }) }) }),
|
|
62234
62309
|
/* @__PURE__ */ (0, import_jsx_runtime200.jsx)("div", { role: "group", "aria-label": "Layout", className: "flex flex-wrap gap-1 pt-1", "data-table-sheet-layout": "", children: import_views2.VIEW_LAYOUTS.map((option) => /* @__PURE__ */ (0, import_jsx_runtime200.jsx)(
|
|
62235
62310
|
import_design_system177.Button,
|
|
62236
62311
|
{
|
|
@@ -62691,7 +62766,7 @@ function TablePage({
|
|
|
62691
62766
|
] })
|
|
62692
62767
|
] }) })
|
|
62693
62768
|
) : null,
|
|
62694
|
-
main === "records" && !(controlsInSheet && shownLayout === "grid") ? /* @__PURE__ */ (0, import_jsx_runtime200.jsx)(ViewFilter, { tableId, view: shown5, onApply: (where) => void patchView({ where }) }) : null,
|
|
62769
|
+
main === "records" && !(controlsInSheet && shownLayout === "grid") ? /* @__PURE__ */ (0, import_jsx_runtime200.jsx)(ViewFilter, { tableId, view: shown5, withheldKeys, onApply: (where) => void patchView({ where }) }) : null,
|
|
62695
62770
|
lookShowing && main === "records" && !namingLook ? /* @__PURE__ */ (0, import_jsx_runtime200.jsxs)("span", { className: "flex shrink-0 items-center gap-1", "data-view-look": "", "data-view-look-folded": "", "data-toolbar-fit": "look", children: [
|
|
62696
62771
|
/* @__PURE__ */ (0, import_jsx_runtime200.jsx)(
|
|
62697
62772
|
import_design_system177.Button,
|
|
@@ -62935,6 +63010,7 @@ function TablePage({
|
|
|
62935
63010
|
openRecordId: rail === "record" ? openRecord : null,
|
|
62936
63011
|
onCloseRecord: () => setRail("none"),
|
|
62937
63012
|
onRowsShown: setShownIds,
|
|
63013
|
+
onWithheldColumns: setWithheldKeys,
|
|
62938
63014
|
onAskWhoChanged: (fieldKey, recordId) => {
|
|
62939
63015
|
setAsking({ fieldKey, recordId });
|
|
62940
63016
|
setRail("who-changed");
|