@ai-matrx/records-ui 0.116.61 → 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 +22 -1
- package/dist/{chunk-2YK72GHL.js → chunk-X2WDIQIR.js} +123 -45
- package/dist/chunk-X2WDIQIR.js.map +1 -0
- package/dist/index.cjs +133 -21
- 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 +53 -13
- package/dist/index.js.map +1 -1
- package/dist/pickers.cjs +40 -5
- package/dist/pickers.cjs.map +1 -1
- package/dist/pickers.js +1 -1
- package/package.json +5 -5
- package/dist/chunk-2YK72GHL.js.map +0 -1
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 }) },
|
|
@@ -14776,6 +14816,15 @@ function WithWords(props) {
|
|
|
14776
14816
|
{
|
|
14777
14817
|
field: props.field,
|
|
14778
14818
|
refs: withKnown,
|
|
14819
|
+
autoOpen: props.autoOpen,
|
|
14820
|
+
onClose: props.onClose,
|
|
14821
|
+
onCancel: props.onCancel,
|
|
14822
|
+
initialSearch: props.initialSearch,
|
|
14823
|
+
onTakeOff: (ref) => {
|
|
14824
|
+
const rest = withKnown.filter((x) => !(x.token === ref.token && x.id === ref.id));
|
|
14825
|
+
props.onChange((0, import_records13.entityRefsToWrite)(rest, Boolean(props.field.multi)));
|
|
14826
|
+
},
|
|
14827
|
+
labelOf: (r) => r.label ?? words2?.data?.find((w) => w.token === r.token && w.id === r.id)?.label ?? WITHHELD_ENTITY_LABEL,
|
|
14779
14828
|
onPick: (picked) => {
|
|
14780
14829
|
setKnown((k) => [...k.filter((x) => !(x.token === picked.token && x.id === picked.id)), picked]);
|
|
14781
14830
|
const multi = Boolean(props.field.multi);
|
|
@@ -14784,18 +14833,32 @@ function WithWords(props) {
|
|
|
14784
14833
|
}
|
|
14785
14834
|
}
|
|
14786
14835
|
);
|
|
14836
|
+
if (props.autoOpen && !props.disabled) return /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("div", { id: props.id, className: (0, import_design_system24.cn)("flex min-w-0 max-w-full flex-wrap items-center gap-1", props.className), children: picker });
|
|
14787
14837
|
return /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(Chips, { ...props, value: withKnown, words: words2, picker });
|
|
14788
14838
|
}
|
|
14789
14839
|
function EntityReferencePicker({
|
|
14790
14840
|
field: field2,
|
|
14791
14841
|
refs,
|
|
14792
|
-
onPick
|
|
14842
|
+
onPick,
|
|
14843
|
+
autoOpen,
|
|
14844
|
+
onClose,
|
|
14845
|
+
onCancel,
|
|
14846
|
+
initialSearch,
|
|
14847
|
+
onTakeOff,
|
|
14848
|
+
labelOf
|
|
14793
14849
|
}) {
|
|
14794
14850
|
const allowed = allowedKindsOf(field2);
|
|
14795
14851
|
const kinds = (0, import_react46.useEntityReferenceKinds)();
|
|
14796
14852
|
const labelOfKind = (token2) => kinds.data?.find((k) => k.token === token2)?.label ?? token2.replace(/_/g, " ");
|
|
14797
|
-
const [open,
|
|
14798
|
-
const
|
|
14853
|
+
const [open, setOpenState] = (0, import_react45.useState)(autoOpen === true);
|
|
14854
|
+
const onCloseRef = (0, import_react45.useRef)(onClose);
|
|
14855
|
+
onCloseRef.current = onClose;
|
|
14856
|
+
const setOpen = (0, import_react45.useCallback)((next) => {
|
|
14857
|
+
setOpenState(next);
|
|
14858
|
+
if (!next) onCloseRef.current?.();
|
|
14859
|
+
}, []);
|
|
14860
|
+
const anchored = autoOpen === true;
|
|
14861
|
+
const [search, setSearch] = (0, import_react45.useState)(initialSearch ?? "");
|
|
14799
14862
|
const [only, setOnly] = (0, import_react45.useState)(null);
|
|
14800
14863
|
const tokens = only ? [only] : allowed;
|
|
14801
14864
|
const found = (0, import_react46.useEntityReferenceSearch)(tokens, search, open);
|
|
@@ -14838,6 +14901,10 @@ function EntityReferencePicker({
|
|
|
14838
14901
|
return /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
14839
14902
|
PickOrAdd,
|
|
14840
14903
|
{
|
|
14904
|
+
anchored,
|
|
14905
|
+
...anchored && onCancel ? { onEscape: onCancel } : {},
|
|
14906
|
+
multi,
|
|
14907
|
+
...anchored ? { chips: refs.map((r) => ({ id: `${r.token}:${r.id}`, label: labelOf(r), onRemove: () => onTakeOff(r) })) } : {},
|
|
14841
14908
|
triggerLabel: `Pick for ${field2.label}`,
|
|
14842
14909
|
triggerText: refs.length > 0 && !multi ? "Change" : "Pick",
|
|
14843
14910
|
open,
|
|
@@ -17528,6 +17595,7 @@ var import_records28 = require("@ai-matrx/records");
|
|
|
17528
17595
|
var import_react83 = require("@ai-matrx/records/react");
|
|
17529
17596
|
init_Refusal();
|
|
17530
17597
|
init_names();
|
|
17598
|
+
init_plainWords();
|
|
17531
17599
|
init_refusals();
|
|
17532
17600
|
var import_jsx_runtime56 = require("react/jsx-runtime");
|
|
17533
17601
|
var PREVIEW_GROUPS = 1e3;
|
|
@@ -17561,7 +17629,14 @@ function FieldRulePreview({ field: field2, tableId, rules }) {
|
|
|
17561
17629
|
void client.recordAggregate({ table_id: tableId, groupBy: [field2.key], measures: [{ op: "count" }], limit: PREVIEW_GROUPS }).then((answer) => {
|
|
17562
17630
|
if (cancelled) return;
|
|
17563
17631
|
if (!answer.ok) {
|
|
17564
|
-
setRefusal(
|
|
17632
|
+
setRefusal(
|
|
17633
|
+
answer.error.code === "unreachable" ? (0, refusals_exports.refusal)(
|
|
17634
|
+
"unreachable",
|
|
17635
|
+
`${name}'s values could not be counted.`,
|
|
17636
|
+
"The check still applies when you save.",
|
|
17637
|
+
refusalForAPerson(answer.error).forEngineers
|
|
17638
|
+
) : answer.error
|
|
17639
|
+
);
|
|
17565
17640
|
return;
|
|
17566
17641
|
}
|
|
17567
17642
|
const numbers = holdsNumbers3(field2);
|
|
@@ -20764,7 +20839,7 @@ function FieldControl({ field: field2, value, onChange, disabled, id, autoOpen,
|
|
|
20764
20839
|
case "member":
|
|
20765
20840
|
return /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(PersonPicker, { field: field2, value, onChange, disabled, id: inputId, autoOpen, onClose, onCancel, initialSearch });
|
|
20766
20841
|
case "entity_reference":
|
|
20767
|
-
return /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(EntityReferenceControl, { field: field2, value, onChange, disabled, id: inputId });
|
|
20842
|
+
return /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(EntityReferenceControl, { field: field2, value, onChange, disabled, id: inputId, autoOpen, onClose, onCancel, initialSearch });
|
|
20768
20843
|
case "attachment":
|
|
20769
20844
|
if (hostTakesFiles(host)) {
|
|
20770
20845
|
return /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(AttachmentControl, { field: field2, value, onChange, disabled, id: inputId, autoOpen, onClose });
|
|
@@ -22719,6 +22794,7 @@ function opensAsAList(field2, takesFiles = false) {
|
|
|
22719
22794
|
const kind2 = editorKindFor(field2);
|
|
22720
22795
|
if (kind2 === "member") return true;
|
|
22721
22796
|
if (kind2 === "relation") return true;
|
|
22797
|
+
if (kind2 === "entity_reference") return true;
|
|
22722
22798
|
if (kind2 === "attachment") return takesFiles;
|
|
22723
22799
|
if (kind2 === "select" || kind2 === "multi_select") return CHOICE_EDITOR_ADDS_WHAT_IS_TYPED;
|
|
22724
22800
|
return false;
|
|
@@ -33304,6 +33380,7 @@ function GridBody({
|
|
|
33304
33380
|
openRecordId = null,
|
|
33305
33381
|
onCloseRecord,
|
|
33306
33382
|
onRowsShown,
|
|
33383
|
+
onWithheldColumns,
|
|
33307
33384
|
onAddField,
|
|
33308
33385
|
onNewRecordForm,
|
|
33309
33386
|
toolbarActions,
|
|
@@ -33737,12 +33814,19 @@ function GridBody({
|
|
|
33737
33814
|
const lines = rowLines(look.rowHeight);
|
|
33738
33815
|
const wrapColumnSet = (0, import_react183.useMemo)(() => new Set(presentation.wrapColumns ?? []), [presentation.wrapColumns]);
|
|
33739
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]);
|
|
33740
33824
|
const ordered = (0, import_react183.useMemo)(() => {
|
|
33741
|
-
const all = [...fields.data ?? []].sort(compareFieldOrder);
|
|
33825
|
+
const all = markWithheld([...fields.data ?? []].sort(compareFieldOrder), withheldKeys);
|
|
33742
33826
|
if (frozenKeys.size === 0) return all;
|
|
33743
33827
|
const pinned = frozenList.map((key) => all.find((f) => f.key === key)).filter((f) => f !== void 0);
|
|
33744
33828
|
return [...pinned, ...all.filter((f) => !frozenKeys.has(f.key))];
|
|
33745
|
-
}, [fields.data, frozenKeys, frozenList]);
|
|
33829
|
+
}, [fields.data, frozenKeys, frozenList, withheldKeys]);
|
|
33746
33830
|
const tableActions2 = useTableActions(tableId, canWrite || Boolean(host.runAgentAction));
|
|
33747
33831
|
const ownWord = (table.data?.label_singular ?? "").trim();
|
|
33748
33832
|
const sameAsName = ownWord === "" || (table.data ? ownWord.toLowerCase() === tableName(table.data).toLowerCase() : true);
|
|
@@ -34899,8 +34983,8 @@ function GridBody({
|
|
|
34899
34983
|
);
|
|
34900
34984
|
const toolbarFields = fields.data;
|
|
34901
34985
|
const sortableColumns = (0, import_react183.useMemo)(
|
|
34902
|
-
() => (fields.data ?? []).filter((f) => sortRefusal(f) === null).map((f) => ({ key: f.key, label: columnLabel(fields.data ?? [], f.key) })),
|
|
34903
|
-
[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]
|
|
34904
34988
|
);
|
|
34905
34989
|
const hasSeveralRows = rows.length > 1;
|
|
34906
34990
|
const editingBusy = editing.busy;
|
|
@@ -35246,7 +35330,8 @@ function GridBody({
|
|
|
35246
35330
|
}
|
|
35247
35331
|
) : null,
|
|
35248
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,
|
|
35249
|
-
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,
|
|
35250
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,
|
|
35251
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: [
|
|
35252
35337
|
/* @__PURE__ */ (0, import_jsx_runtime112.jsx)("span", { children: duplicated }),
|
|
@@ -35653,6 +35738,26 @@ function withoutGoneColumns(query, liveKeys, openingSort) {
|
|
|
35653
35738
|
const fallback = openingSort && liveKeys.has(openingSort.id) ? openingSort : null;
|
|
35654
35739
|
return { ...query, sort: sortGone ? fallback : query.sort, columnFilters, page: 1 };
|
|
35655
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
|
+
}
|
|
35656
35761
|
function sortIgnoredOf(answer) {
|
|
35657
35762
|
return Array.isArray(answer?.sortIgnored) ? answer.sortIgnored : [];
|
|
35658
35763
|
}
|
|
@@ -47173,6 +47278,7 @@ function ViewSwitcherBody({
|
|
|
47173
47278
|
openRecordId,
|
|
47174
47279
|
onCloseRecord,
|
|
47175
47280
|
onRowsShown,
|
|
47281
|
+
onWithheldColumns,
|
|
47176
47282
|
onMoved,
|
|
47177
47283
|
onNewRecordForm,
|
|
47178
47284
|
onAskWhoChanged,
|
|
@@ -47251,6 +47357,7 @@ function ViewSwitcherBody({
|
|
|
47251
47357
|
...openRecordId ? { openRecordId } : {},
|
|
47252
47358
|
...onCloseRecord ? { onCloseRecord } : {},
|
|
47253
47359
|
...onRowsShown ? { onRowsShown } : {},
|
|
47360
|
+
...onWithheldColumns ? { onWithheldColumns } : {},
|
|
47254
47361
|
...onNewRecordForm ? { onNewRecordForm } : {},
|
|
47255
47362
|
...onAskWhoChanged ? { onAskWhoChanged } : {},
|
|
47256
47363
|
...viewId ? {
|
|
@@ -51997,7 +52104,9 @@ function DigestScheduler({
|
|
|
51997
52104
|
table_id: tableId,
|
|
51998
52105
|
spec: {
|
|
51999
52106
|
name: subjectName?.trim() ? subjectName.trim() : name.trim() || fallbackName,
|
|
52000
|
-
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 }
|
|
52001
52110
|
}
|
|
52002
52111
|
});
|
|
52003
52112
|
if (!declared2.ok) {
|
|
@@ -60931,7 +61040,7 @@ function conditionCount(expr) {
|
|
|
60931
61040
|
}
|
|
60932
61041
|
return 1;
|
|
60933
61042
|
}
|
|
60934
|
-
function ViewFilter({ tableId, view, onApply, className }) {
|
|
61043
|
+
function ViewFilter({ tableId, view, onApply, withheldKeys, className }) {
|
|
60935
61044
|
const fields = (0, import_react346.useFields)(tableId);
|
|
60936
61045
|
const [open, setOpen] = (0, import_react345.useState)(false);
|
|
60937
61046
|
const saved = view?.where ?? null;
|
|
@@ -60961,7 +61070,8 @@ function ViewFilter({ tableId, view, onApply, className }) {
|
|
|
60961
61070
|
};
|
|
60962
61071
|
}, [open, client, relations]);
|
|
60963
61072
|
const conditionFields = (0, import_react345.useMemo)(() => {
|
|
60964
|
-
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 }));
|
|
60965
61075
|
const reached = relations.flatMap(
|
|
60966
61076
|
(rel) => (linkedFields[rel.id] ?? []).filter((inner2) => inner2.type !== "relation").map((inner2) => ({
|
|
60967
61077
|
id: `${rel.id}>${inner2.id}`,
|
|
@@ -60972,7 +61082,7 @@ function ViewFilter({ tableId, view, onApply, className }) {
|
|
|
60972
61082
|
}))
|
|
60973
61083
|
);
|
|
60974
61084
|
return [...own3, ...reached];
|
|
60975
|
-
}, [fields.data, relations, linkedFields]);
|
|
61085
|
+
}, [fields.data, relations, linkedFields, withheldKeys]);
|
|
60976
61086
|
if (!view) return null;
|
|
60977
61087
|
const count = conditionCount(saved);
|
|
60978
61088
|
const changed2 = JSON.stringify(draft) !== savedKey;
|
|
@@ -61911,7 +62021,7 @@ function TablePage({
|
|
|
61911
62021
|
const shareInMenu = phone || toolbarFold2 >= 4;
|
|
61912
62022
|
const faceUnknown = !opened.layout && (views === void 0 || looks === void 0 || Array.isArray(views) && views.length > 0 && view === null);
|
|
61913
62023
|
const shownLayout = layoutFromLink ?? shown5?.layout ?? "grid";
|
|
61914
|
-
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);
|
|
61915
62025
|
const press = (pressed) => {
|
|
61916
62026
|
const next = chooseSurface(surface, pressed);
|
|
61917
62027
|
setSurface(next);
|
|
@@ -61968,6 +62078,7 @@ function TablePage({
|
|
|
61968
62078
|
setSurface((now) => ({ ...now, rail: "record" }));
|
|
61969
62079
|
}, [activeRecordId]);
|
|
61970
62080
|
const [shownIds, setShownIdsRaw] = (0, import_react349.useState)([]);
|
|
62081
|
+
const [withheldKeys, setWithheldKeys] = (0, import_react349.useState)([]);
|
|
61971
62082
|
const setShownIds = (0, import_react349.useCallback)(
|
|
61972
62083
|
(next) => setShownIdsRaw((prev) => prev.length === next.length && prev.every((id, i) => id === next[i]) ? prev : next),
|
|
61973
62084
|
[]
|
|
@@ -62194,7 +62305,7 @@ function TablePage({
|
|
|
62194
62305
|
}
|
|
62195
62306
|
);
|
|
62196
62307
|
const sheetExtras = controlsInSheet && main === "records" && shownLayout === "grid" ? /* @__PURE__ */ (0, import_jsx_runtime200.jsxs)(import_jsx_runtime200.Fragment, { children: [
|
|
62197
|
-
/* @__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 }) }) }),
|
|
62198
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)(
|
|
62199
62310
|
import_design_system177.Button,
|
|
62200
62311
|
{
|
|
@@ -62655,7 +62766,7 @@ function TablePage({
|
|
|
62655
62766
|
] })
|
|
62656
62767
|
] }) })
|
|
62657
62768
|
) : null,
|
|
62658
|
-
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,
|
|
62659
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: [
|
|
62660
62771
|
/* @__PURE__ */ (0, import_jsx_runtime200.jsx)(
|
|
62661
62772
|
import_design_system177.Button,
|
|
@@ -62899,6 +63010,7 @@ function TablePage({
|
|
|
62899
63010
|
openRecordId: rail === "record" ? openRecord : null,
|
|
62900
63011
|
onCloseRecord: () => setRail("none"),
|
|
62901
63012
|
onRowsShown: setShownIds,
|
|
63013
|
+
onWithheldColumns: setWithheldKeys,
|
|
62902
63014
|
onAskWhoChanged: (fieldKey, recordId) => {
|
|
62903
63015
|
setAsking({ fieldKey, recordId });
|
|
62904
63016
|
setRail("who-changed");
|