@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/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-2YK72GHL.js";
188
+ } from "./chunk-X2WDIQIR.js";
186
189
  import {
187
190
  CHART_PLOT_PX,
188
191
  EMBEDDED_ROW_PX,
@@ -2405,6 +2408,7 @@ function opensAsAList(field, takesFiles = false) {
2405
2408
  const kind2 = editorKindFor(field);
2406
2409
  if (kind2 === "member") return true;
2407
2410
  if (kind2 === "relation") return true;
2411
+ if (kind2 === "entity_reference") return true;
2408
2412
  if (kind2 === "attachment") return takesFiles;
2409
2413
  if (kind2 === "select" || kind2 === "multi_select") return CHOICE_EDITOR_ADDS_WHAT_IS_TYPED;
2410
2414
  return false;
@@ -12458,6 +12462,7 @@ function GridBody({
12458
12462
  openRecordId = null,
12459
12463
  onCloseRecord,
12460
12464
  onRowsShown,
12465
+ onWithheldColumns,
12461
12466
  onAddField,
12462
12467
  onNewRecordForm,
12463
12468
  toolbarActions,
@@ -12891,12 +12896,19 @@ function GridBody({
12891
12896
  const lines = rowLines(look.rowHeight);
12892
12897
  const wrapColumnSet = useMemo26(() => new Set(presentation.wrapColumns ?? []), [presentation.wrapColumns]);
12893
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]);
12894
12906
  const ordered = useMemo26(() => {
12895
- const all = [...fields.data ?? []].sort(compareFieldOrder);
12907
+ const all = markWithheld([...fields.data ?? []].sort(compareFieldOrder), withheldKeys);
12896
12908
  if (frozenKeys.size === 0) return all;
12897
12909
  const pinned = frozenList.map((key) => all.find((f) => f.key === key)).filter((f) => f !== void 0);
12898
12910
  return [...pinned, ...all.filter((f) => !frozenKeys.has(f.key))];
12899
- }, [fields.data, frozenKeys, frozenList]);
12911
+ }, [fields.data, frozenKeys, frozenList, withheldKeys]);
12900
12912
  const tableActions2 = useTableActions(tableId, canWrite || Boolean(host.runAgentAction));
12901
12913
  const ownWord = (table.data?.label_singular ?? "").trim();
12902
12914
  const sameAsName = ownWord === "" || (table.data ? ownWord.toLowerCase() === tableName(table.data).toLowerCase() : true);
@@ -14053,8 +14065,8 @@ function GridBody({
14053
14065
  );
14054
14066
  const toolbarFields = fields.data;
14055
14067
  const sortableColumns = useMemo26(
14056
- () => (fields.data ?? []).filter((f) => sortRefusal(f) === null).map((f) => ({ key: f.key, label: columnLabel(fields.data ?? [], f.key) })),
14057
- [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]
14058
14070
  );
14059
14071
  const hasSeveralRows = rows.length > 1;
14060
14072
  const editingBusy = editing.busy;
@@ -14400,7 +14412,8 @@ function GridBody({
14400
14412
  }
14401
14413
  ) : null,
14402
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,
14403
- 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,
14404
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,
14405
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: [
14406
14419
  /* @__PURE__ */ jsx44("span", { children: duplicated }),
@@ -14807,6 +14820,26 @@ function withoutGoneColumns(query, liveKeys, openingSort) {
14807
14820
  const fallback = openingSort && liveKeys.has(openingSort.id) ? openingSort : null;
14808
14821
  return { ...query, sort: sortGone ? fallback : query.sort, columnFilters, page: 1 };
14809
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
+ }
14810
14843
  function sortIgnoredOf(answer) {
14811
14844
  return Array.isArray(answer?.sortIgnored) ? answer.sortIgnored : [];
14812
14845
  }
@@ -26277,6 +26310,7 @@ function ViewSwitcherBody({
26277
26310
  openRecordId,
26278
26311
  onCloseRecord,
26279
26312
  onRowsShown,
26313
+ onWithheldColumns,
26280
26314
  onMoved,
26281
26315
  onNewRecordForm,
26282
26316
  onAskWhoChanged,
@@ -26355,6 +26389,7 @@ function ViewSwitcherBody({
26355
26389
  ...openRecordId ? { openRecordId } : {},
26356
26390
  ...onCloseRecord ? { onCloseRecord } : {},
26357
26391
  ...onRowsShown ? { onRowsShown } : {},
26392
+ ...onWithheldColumns ? { onWithheldColumns } : {},
26358
26393
  ...onNewRecordForm ? { onNewRecordForm } : {},
26359
26394
  ...onAskWhoChanged ? { onAskWhoChanged } : {},
26360
26395
  ...viewId ? {
@@ -31084,7 +31119,9 @@ function DigestScheduler({
31084
31119
  table_id: tableId,
31085
31120
  spec: {
31086
31121
  name: subjectName?.trim() ? subjectName.trim() : name.trim() || fallbackName,
31087
- 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 }
31088
31125
  }
31089
31126
  });
31090
31127
  if (!declared2.ok) {
@@ -39999,7 +40036,7 @@ function conditionCount(expr) {
39999
40036
  }
40000
40037
  return 1;
40001
40038
  }
40002
- function ViewFilter({ tableId, view, onApply, className }) {
40039
+ function ViewFilter({ tableId, view, onApply, withheldKeys, className }) {
40003
40040
  const fields = useFields33(tableId);
40004
40041
  const [open, setOpen] = useState118(false);
40005
40042
  const saved = view?.where ?? null;
@@ -40029,7 +40066,8 @@ function ViewFilter({ tableId, view, onApply, className }) {
40029
40066
  };
40030
40067
  }, [open, client, relations]);
40031
40068
  const conditionFields = useMemo70(() => {
40032
- 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 }));
40033
40071
  const reached = relations.flatMap(
40034
40072
  (rel) => (linkedFields[rel.id] ?? []).filter((inner) => inner.type !== "relation").map((inner) => ({
40035
40073
  id: `${rel.id}>${inner.id}`,
@@ -40040,7 +40078,7 @@ function ViewFilter({ tableId, view, onApply, className }) {
40040
40078
  }))
40041
40079
  );
40042
40080
  return [...own, ...reached];
40043
- }, [fields.data, relations, linkedFields]);
40081
+ }, [fields.data, relations, linkedFields, withheldKeys]);
40044
40082
  if (!view) return null;
40045
40083
  const count = conditionCount(saved);
40046
40084
  const changed2 = JSON.stringify(draft) !== savedKey;
@@ -40967,7 +41005,7 @@ function TablePage({
40967
41005
  const shareInMenu = phone || toolbarFold2 >= 4;
40968
41006
  const faceUnknown = !opened.layout && (views === void 0 || looks === void 0 || Array.isArray(views) && views.length > 0 && view === null);
40969
41007
  const shownLayout = layoutFromLink ?? shown4?.layout ?? "grid";
40970
- 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);
40971
41009
  const press = (pressed) => {
40972
41010
  const next = chooseSurface(surface, pressed);
40973
41011
  setSurface(next);
@@ -41024,6 +41062,7 @@ function TablePage({
41024
41062
  setSurface((now) => ({ ...now, rail: "record" }));
41025
41063
  }, [activeRecordId]);
41026
41064
  const [shownIds, setShownIdsRaw] = useState121([]);
41065
+ const [withheldKeys, setWithheldKeys] = useState121([]);
41027
41066
  const setShownIds = useCallback61(
41028
41067
  (next) => setShownIdsRaw((prev) => prev.length === next.length && prev.every((id, i) => id === next[i]) ? prev : next),
41029
41068
  []
@@ -41250,7 +41289,7 @@ function TablePage({
41250
41289
  }
41251
41290
  );
41252
41291
  const sheetExtras = controlsInSheet && main === "records" && shownLayout === "grid" ? /* @__PURE__ */ jsxs125(Fragment57, { children: [
41253
- /* @__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 }) }) }),
41254
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(
41255
41294
  Button100,
41256
41295
  {
@@ -41711,7 +41750,7 @@ function TablePage({
41711
41750
  ] })
41712
41751
  ] }) })
41713
41752
  ) : null,
41714
- 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,
41715
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: [
41716
41755
  /* @__PURE__ */ jsx132(
41717
41756
  Button100,
@@ -41955,6 +41994,7 @@ function TablePage({
41955
41994
  openRecordId: rail === "record" ? openRecord : null,
41956
41995
  onCloseRecord: () => setRail("none"),
41957
41996
  onRowsShown: setShownIds,
41997
+ onWithheldColumns: setWithheldKeys,
41958
41998
  onAskWhoChanged: (fieldKey, recordId) => {
41959
41999
  setAsking({ fieldKey, recordId });
41960
42000
  setRail("who-changed");