@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/dist/index.d.cts CHANGED
@@ -2274,6 +2274,8 @@ interface GridProps {
2274
2274
  onCloseRecord?: (() => void) | undefined;
2275
2275
  /** The ids the grid is showing, in the order it shows them (AT-RECORD: previous / next in the expanded record). */
2276
2276
  onRowsShown?: ((ids: Uuid$1[]) => void) | undefined;
2277
+ /** The columns the store withheld on every row shown (WITHHELD-HONEST): the page offers no sort or filter on them. */
2278
+ onWithheldColumns?: ((keys: readonly string[]) => void) | undefined;
2277
2279
  /** SCR-2. Called when an admin clicks the "+" at the end of the headers. */
2278
2280
  onAddField?: (() => void) | undefined;
2279
2281
  /**
@@ -4154,6 +4156,8 @@ interface ViewSwitcherProps {
4154
4156
  onCloseRecord?: (() => void) | undefined;
4155
4157
  /** The ids the grid shows, in its order (`Grid.onRowsShown`). */
4156
4158
  onRowsShown?: ((ids: Uuid$1[]) => void) | undefined;
4159
+ /** The columns the grid found withheld on every row it shows (`Grid.onWithheldColumns`). */
4160
+ onWithheldColumns?: ((keys: readonly string[]) => void) | undefined;
4157
4161
  /**
4158
4162
  * Called after a card moves between columns, so the host re-reads the rows it owns. A
4159
4163
  * board that moved a card and left the row list alone would show the card in two places
package/dist/index.d.ts CHANGED
@@ -2274,6 +2274,8 @@ interface GridProps {
2274
2274
  onCloseRecord?: (() => void) | undefined;
2275
2275
  /** The ids the grid is showing, in the order it shows them (AT-RECORD: previous / next in the expanded record). */
2276
2276
  onRowsShown?: ((ids: Uuid$1[]) => void) | undefined;
2277
+ /** The columns the store withheld on every row shown (WITHHELD-HONEST): the page offers no sort or filter on them. */
2278
+ onWithheldColumns?: ((keys: readonly string[]) => void) | undefined;
2277
2279
  /** SCR-2. Called when an admin clicks the "+" at the end of the headers. */
2278
2280
  onAddField?: (() => void) | undefined;
2279
2281
  /**
@@ -4154,6 +4156,8 @@ interface ViewSwitcherProps {
4154
4156
  onCloseRecord?: (() => void) | undefined;
4155
4157
  /** The ids the grid shows, in its order (`Grid.onRowsShown`). */
4156
4158
  onRowsShown?: ((ids: Uuid$1[]) => void) | undefined;
4159
+ /** The columns the grid found withheld on every row it shows (`Grid.onWithheldColumns`). */
4160
+ onWithheldColumns?: ((keys: readonly string[]) => void) | undefined;
4157
4161
  /**
4158
4162
  * Called after a card moves between columns, so the host re-reads the rows it owns. A
4159
4163
  * board that moved a card and left the row list alone would show the card in two places
package/dist/index.js CHANGED
@@ -125,6 +125,7 @@ import {
125
125
  knownPerson,
126
126
  lookChecks,
127
127
  lookColumnKeys,
128
+ markWithheld,
128
129
  measuresFor,
129
130
  memberName,
130
131
  mergeTokenSets,
@@ -152,6 +153,7 @@ import {
152
153
  signatureFileIn,
153
154
  signatureFileOf,
154
155
  signatureWords,
156
+ skipWhenWithheld,
155
157
  sortAndFilterRefusal,
156
158
  sortAsFor,
157
159
  sortRefusal,
@@ -177,12 +179,13 @@ import {
177
179
  wholeValueOpening,
178
180
  withFormulaDisplayNow,
179
181
  withOpenRecord,
182
+ withheldKeysOf,
180
183
  withheldNoticeOf,
181
184
  withheldSentence,
182
185
  withoutAddition,
183
186
  withoutLeadingBlank,
184
187
  workedOutErrorFor
185
- } from "./chunk-NTOTMYVO.js";
188
+ } from "./chunk-X2WDIQIR.js";
186
189
  import {
187
190
  CHART_PLOT_PX,
188
191
  EMBEDDED_ROW_PX,
@@ -12459,6 +12462,7 @@ function GridBody({
12459
12462
  openRecordId = null,
12460
12463
  onCloseRecord,
12461
12464
  onRowsShown,
12465
+ onWithheldColumns,
12462
12466
  onAddField,
12463
12467
  onNewRecordForm,
12464
12468
  toolbarActions,
@@ -12892,12 +12896,19 @@ function GridBody({
12892
12896
  const lines = rowLines(look.rowHeight);
12893
12897
  const wrapColumnSet = useMemo26(() => new Set(presentation.wrapColumns ?? []), [presentation.wrapColumns]);
12894
12898
  const frozenKeys = useMemo26(() => new Set(frozenList), [frozenList]);
12899
+ const withheldKey = useMemo26(() => [...withheldKeysOf(rows)].sort().join(""), [rows]);
12900
+ const withheldKeys = useMemo26(() => new Set(withheldKey === "" ? [] : withheldKey.split("")), [withheldKey]);
12901
+ const onWithheldRef = useRef21(onWithheldColumns);
12902
+ onWithheldRef.current = onWithheldColumns;
12903
+ useEffect35(() => {
12904
+ onWithheldRef.current?.(withheldKey === "" ? [] : withheldKey.split(""));
12905
+ }, [withheldKey]);
12895
12906
  const ordered = useMemo26(() => {
12896
- const all = [...fields.data ?? []].sort(compareFieldOrder);
12907
+ const all = markWithheld([...fields.data ?? []].sort(compareFieldOrder), withheldKeys);
12897
12908
  if (frozenKeys.size === 0) return all;
12898
12909
  const pinned = frozenList.map((key) => all.find((f) => f.key === key)).filter((f) => f !== void 0);
12899
12910
  return [...pinned, ...all.filter((f) => !frozenKeys.has(f.key))];
12900
- }, [fields.data, frozenKeys, frozenList]);
12911
+ }, [fields.data, frozenKeys, frozenList, withheldKeys]);
12901
12912
  const tableActions2 = useTableActions(tableId, canWrite || Boolean(host.runAgentAction));
12902
12913
  const ownWord = (table.data?.label_singular ?? "").trim();
12903
12914
  const sameAsName = ownWord === "" || (table.data ? ownWord.toLowerCase() === tableName(table.data).toLowerCase() : true);
@@ -14054,8 +14065,8 @@ function GridBody({
14054
14065
  );
14055
14066
  const toolbarFields = fields.data;
14056
14067
  const sortableColumns = useMemo26(
14057
- () => (fields.data ?? []).filter((f) => sortRefusal(f) === null).map((f) => ({ key: f.key, label: columnLabel(fields.data ?? [], f.key) })),
14058
- [fields.data]
14068
+ () => markWithheld(fields.data ?? [], withheldKeys).filter((f) => sortRefusal(f) === null).map((f) => ({ key: f.key, label: columnLabel(fields.data ?? [], f.key) })),
14069
+ [fields.data, withheldKeys]
14059
14070
  );
14060
14071
  const hasSeveralRows = rows.length > 1;
14061
14072
  const editingBusy = editing.busy;
@@ -14401,7 +14412,8 @@ function GridBody({
14401
14412
  }
14402
14413
  ) : null,
14403
14414
  question.refused.length > 0 ? /* @__PURE__ */ jsx44("p", { role: "status", "data-records-filter-refused": "", className: "text-xs text-muted-foreground", children: question.refused.join(" ") }) : null,
14404
- storePaged && sortIgnoredOf(serverRead.data).length > 0 ? /* @__PURE__ */ jsx44("p", { role: "status", "data-records-sort-ignored": sortIgnoredOf(serverRead.data).join(" "), className: "text-xs text-muted-foreground", children: "Sort skipped: column not available" }) : null,
14415
+ storePaged && sortIgnoredOf(serverRead.data).length > 0 ? /* @__PURE__ */ jsx44("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,
14416
+ storePaged && filterIgnoredOf(serverRead.data).length > 0 ? /* @__PURE__ */ jsx44("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,
14405
14417
  runner.outcome && !(merged && runner.outcome.kind === "ran" && runner.outcome.undo !== null) ? /* @__PURE__ */ jsx44(ActionOutcomeNotice, { outcome: runner.outcome, onUndo: () => void runner.undo(), onDismiss: runner.dismiss }) : null,
14406
14418
  duplicated ? /* @__PURE__ */ jsxs39("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: [
14407
14419
  /* @__PURE__ */ jsx44("span", { children: duplicated }),
@@ -14808,6 +14820,26 @@ function withoutGoneColumns(query, liveKeys, openingSort) {
14808
14820
  const fallback = openingSort && liveKeys.has(openingSort.id) ? openingSort : null;
14809
14821
  return { ...query, sort: sortGone ? fallback : query.sort, columnFilters, page: 1 };
14810
14822
  }
14823
+ function sortSkippedSentence(keys, fields) {
14824
+ const names = keys.map((key) => {
14825
+ const field = fields.find((f) => f.key === key);
14826
+ return field ? fieldName(field) : null;
14827
+ });
14828
+ const named = names.filter((n) => n !== null);
14829
+ if (named.length === 0) return "Sort skipped: that column is no longer there. The default order is shown.";
14830
+ return `Sort skipped: ${named.join(", ")} ${named.length === 1 ? "is" : "are"} withheld from you. The default order is shown.`;
14831
+ }
14832
+ function filterSkippedSentence(keys, fields) {
14833
+ const named = keys.map((key) => {
14834
+ const field = fields.find((f) => f.key === key);
14835
+ return field ? fieldName(field) : null;
14836
+ }).filter((n) => n !== null);
14837
+ if (named.length === 0) return "Filter skipped: that column is no longer there.";
14838
+ return `Filter skipped: ${named.join(", ")} ${named.length === 1 ? "is" : "are"} withheld from you.`;
14839
+ }
14840
+ function filterIgnoredOf(answer) {
14841
+ return Array.isArray(answer?.filterIgnored) ? answer.filterIgnored : [];
14842
+ }
14811
14843
  function sortIgnoredOf(answer) {
14812
14844
  return Array.isArray(answer?.sortIgnored) ? answer.sortIgnored : [];
14813
14845
  }
@@ -26278,6 +26310,7 @@ function ViewSwitcherBody({
26278
26310
  openRecordId,
26279
26311
  onCloseRecord,
26280
26312
  onRowsShown,
26313
+ onWithheldColumns,
26281
26314
  onMoved,
26282
26315
  onNewRecordForm,
26283
26316
  onAskWhoChanged,
@@ -26356,6 +26389,7 @@ function ViewSwitcherBody({
26356
26389
  ...openRecordId ? { openRecordId } : {},
26357
26390
  ...onCloseRecord ? { onCloseRecord } : {},
26358
26391
  ...onRowsShown ? { onRowsShown } : {},
26392
+ ...onWithheldColumns ? { onWithheldColumns } : {},
26359
26393
  ...onNewRecordForm ? { onNewRecordForm } : {},
26360
26394
  ...onAskWhoChanged ? { onAskWhoChanged } : {},
26361
26395
  ...viewId ? {
@@ -31085,7 +31119,9 @@ function DigestScheduler({
31085
31119
  table_id: tableId,
31086
31120
  spec: {
31087
31121
  name: subjectName?.trim() ? subjectName.trim() : name.trim() || fallbackName,
31088
- filters: filters ?? {}
31122
+ filters: filters ?? {},
31123
+ // The summary's own view: it is read by id for what the summary sends, and is in no person's view list.
31124
+ definition: { system: true }
31089
31125
  }
31090
31126
  });
31091
31127
  if (!declared2.ok) {
@@ -40000,7 +40036,7 @@ function conditionCount(expr) {
40000
40036
  }
40001
40037
  return 1;
40002
40038
  }
40003
- function ViewFilter({ tableId, view, onApply, className }) {
40039
+ function ViewFilter({ tableId, view, onApply, withheldKeys, className }) {
40004
40040
  const fields = useFields33(tableId);
40005
40041
  const [open, setOpen] = useState118(false);
40006
40042
  const saved = view?.where ?? null;
@@ -40030,7 +40066,8 @@ function ViewFilter({ tableId, view, onApply, className }) {
40030
40066
  };
40031
40067
  }, [open, client, relations]);
40032
40068
  const conditionFields = useMemo70(() => {
40033
- const own = (fields.data ?? []).map((f) => ({ id: f.id, key: f.key, label: f.label || f.key, field: f }));
40069
+ const withheld = new Set(withheldKeys ?? []);
40070
+ const own = (fields.data ?? []).filter((f) => !withheld.has(f.key)).map((f) => ({ id: f.id, key: f.key, label: f.label || f.key, field: f }));
40034
40071
  const reached = relations.flatMap(
40035
40072
  (rel) => (linkedFields[rel.id] ?? []).filter((inner) => inner.type !== "relation").map((inner) => ({
40036
40073
  id: `${rel.id}>${inner.id}`,
@@ -40041,7 +40078,7 @@ function ViewFilter({ tableId, view, onApply, className }) {
40041
40078
  }))
40042
40079
  );
40043
40080
  return [...own, ...reached];
40044
- }, [fields.data, relations, linkedFields]);
40081
+ }, [fields.data, relations, linkedFields, withheldKeys]);
40045
40082
  if (!view) return null;
40046
40083
  const count = conditionCount(saved);
40047
40084
  const changed2 = JSON.stringify(draft) !== savedKey;
@@ -40968,7 +41005,7 @@ function TablePage({
40968
41005
  const shareInMenu = phone || toolbarFold2 >= 4;
40969
41006
  const faceUnknown = !opened.layout && (views === void 0 || looks === void 0 || Array.isArray(views) && views.length > 0 && view === null);
40970
41007
  const shownLayout = layoutFromLink ?? shown4?.layout ?? "grid";
40971
- const shownFilter = filter ?? (shown4?.where ? shown4.where : null) ?? (shown4?.filters && Object.keys(shown4.filters).length > 0 ? shown4.filters : null);
41008
+ const shownFilter = filter ?? (shown4?.where ? skipWhenWithheld(shown4.where) : null) ?? (shown4?.filters && Object.keys(shown4.filters).length > 0 ? shown4.filters : null);
40972
41009
  const press = (pressed) => {
40973
41010
  const next = chooseSurface(surface, pressed);
40974
41011
  setSurface(next);
@@ -41025,6 +41062,7 @@ function TablePage({
41025
41062
  setSurface((now) => ({ ...now, rail: "record" }));
41026
41063
  }, [activeRecordId]);
41027
41064
  const [shownIds, setShownIdsRaw] = useState121([]);
41065
+ const [withheldKeys, setWithheldKeys] = useState121([]);
41028
41066
  const setShownIds = useCallback61(
41029
41067
  (next) => setShownIdsRaw((prev) => prev.length === next.length && prev.every((id, i) => id === next[i]) ? prev : next),
41030
41068
  []
@@ -41251,7 +41289,7 @@ function TablePage({
41251
41289
  }
41252
41290
  );
41253
41291
  const sheetExtras = controlsInSheet && main === "records" && shownLayout === "grid" ? /* @__PURE__ */ jsxs125(Fragment57, { children: [
41254
- /* @__PURE__ */ jsx132("div", { className: "flex items-center gap-2 text-xs", "data-table-sheet-filter": "", "data-matrx-table-tools-keep-open": "", children: /* @__PURE__ */ jsx132(ViewFilter, { tableId, view: shown4, onApply: (where) => void patchView({ where }) }) }),
41292
+ /* @__PURE__ */ jsx132("div", { className: "flex items-center gap-2 text-xs", "data-table-sheet-filter": "", "data-matrx-table-tools-keep-open": "", children: /* @__PURE__ */ jsx132(ViewFilter, { tableId, view: shown4, withheldKeys, onApply: (where) => void patchView({ where }) }) }),
41255
41293
  /* @__PURE__ */ jsx132("div", { role: "group", "aria-label": "Layout", className: "flex flex-wrap gap-1 pt-1", "data-table-sheet-layout": "", children: VIEW_LAYOUTS.map((option) => /* @__PURE__ */ jsx132(
41256
41294
  Button100,
41257
41295
  {
@@ -41712,7 +41750,7 @@ function TablePage({
41712
41750
  ] })
41713
41751
  ] }) })
41714
41752
  ) : null,
41715
- main === "records" && !(controlsInSheet && shownLayout === "grid") ? /* @__PURE__ */ jsx132(ViewFilter, { tableId, view: shown4, onApply: (where) => void patchView({ where }) }) : null,
41753
+ main === "records" && !(controlsInSheet && shownLayout === "grid") ? /* @__PURE__ */ jsx132(ViewFilter, { tableId, view: shown4, withheldKeys, onApply: (where) => void patchView({ where }) }) : null,
41716
41754
  lookShowing && main === "records" && !namingLook ? /* @__PURE__ */ jsxs125("span", { className: "flex shrink-0 items-center gap-1", "data-view-look": "", "data-view-look-folded": "", "data-toolbar-fit": "look", children: [
41717
41755
  /* @__PURE__ */ jsx132(
41718
41756
  Button100,
@@ -41956,6 +41994,7 @@ function TablePage({
41956
41994
  openRecordId: rail === "record" ? openRecord : null,
41957
41995
  onCloseRecord: () => setRail("none"),
41958
41996
  onRowsShown: setShownIds,
41997
+ onWithheldColumns: setWithheldKeys,
41959
41998
  onAskWhoChanged: (fieldKey, recordId) => {
41960
41999
  setAsking({ fieldKey, recordId });
41961
42000
  setRail("who-changed");