@ai-matrx/records-ui 0.116.62 → 0.116.64

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
@@ -68,6 +68,7 @@ import {
68
68
  WHOLE_VALUE_NOT_EDITABLE_HERE,
69
69
  WITHHELD_WORD,
70
70
  WholeValueEditor,
71
+ WithheldConditionFieldsContext,
71
72
  WithheldValue,
72
73
  archiveConfirmSentence,
73
74
  askOnce_exports,
@@ -125,6 +126,7 @@ import {
125
126
  knownPerson,
126
127
  lookChecks,
127
128
  lookColumnKeys,
129
+ markWithheld,
128
130
  measuresFor,
129
131
  memberName,
130
132
  mergeTokenSets,
@@ -152,6 +154,7 @@ import {
152
154
  signatureFileIn,
153
155
  signatureFileOf,
154
156
  signatureWords,
157
+ skipWhenWithheld,
155
158
  sortAndFilterRefusal,
156
159
  sortAsFor,
157
160
  sortRefusal,
@@ -177,12 +180,14 @@ import {
177
180
  wholeValueOpening,
178
181
  withFormulaDisplayNow,
179
182
  withOpenRecord,
183
+ withheldConditionFields,
184
+ withheldKeysOf,
180
185
  withheldNoticeOf,
181
186
  withheldSentence,
182
187
  withoutAddition,
183
188
  withoutLeadingBlank,
184
189
  workedOutErrorFor
185
- } from "./chunk-NTOTMYVO.js";
190
+ } from "./chunk-QXPUBNYQ.js";
186
191
  import {
187
192
  CHART_PLOT_PX,
188
193
  EMBEDDED_ROW_PX,
@@ -12459,6 +12464,7 @@ function GridBody({
12459
12464
  openRecordId = null,
12460
12465
  onCloseRecord,
12461
12466
  onRowsShown,
12467
+ onWithheldColumns,
12462
12468
  onAddField,
12463
12469
  onNewRecordForm,
12464
12470
  toolbarActions,
@@ -12892,12 +12898,19 @@ function GridBody({
12892
12898
  const lines = rowLines(look.rowHeight);
12893
12899
  const wrapColumnSet = useMemo26(() => new Set(presentation.wrapColumns ?? []), [presentation.wrapColumns]);
12894
12900
  const frozenKeys = useMemo26(() => new Set(frozenList), [frozenList]);
12901
+ const withheldKey = useMemo26(() => [...withheldKeysOf(rows)].sort().join(""), [rows]);
12902
+ const withheldKeys = useMemo26(() => new Set(withheldKey === "" ? [] : withheldKey.split("")), [withheldKey]);
12903
+ const onWithheldRef = useRef21(onWithheldColumns);
12904
+ onWithheldRef.current = onWithheldColumns;
12905
+ useEffect35(() => {
12906
+ onWithheldRef.current?.(withheldKey === "" ? [] : withheldKey.split(""));
12907
+ }, [withheldKey]);
12895
12908
  const ordered = useMemo26(() => {
12896
- const all = [...fields.data ?? []].sort(compareFieldOrder);
12909
+ const all = markWithheld([...fields.data ?? []].sort(compareFieldOrder), withheldKeys);
12897
12910
  if (frozenKeys.size === 0) return all;
12898
12911
  const pinned = frozenList.map((key) => all.find((f) => f.key === key)).filter((f) => f !== void 0);
12899
12912
  return [...pinned, ...all.filter((f) => !frozenKeys.has(f.key))];
12900
- }, [fields.data, frozenKeys, frozenList]);
12913
+ }, [fields.data, frozenKeys, frozenList, withheldKeys]);
12901
12914
  const tableActions2 = useTableActions(tableId, canWrite || Boolean(host.runAgentAction));
12902
12915
  const ownWord = (table.data?.label_singular ?? "").trim();
12903
12916
  const sameAsName = ownWord === "" || (table.data ? ownWord.toLowerCase() === tableName(table.data).toLowerCase() : true);
@@ -14054,8 +14067,8 @@ function GridBody({
14054
14067
  );
14055
14068
  const toolbarFields = fields.data;
14056
14069
  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]
14070
+ () => markWithheld(fields.data ?? [], withheldKeys).filter((f) => sortRefusal(f) === null).map((f) => ({ key: f.key, label: columnLabel(fields.data ?? [], f.key) })),
14071
+ [fields.data, withheldKeys]
14059
14072
  );
14060
14073
  const hasSeveralRows = rows.length > 1;
14061
14074
  const editingBusy = editing.busy;
@@ -14401,7 +14414,8 @@ function GridBody({
14401
14414
  }
14402
14415
  ) : null,
14403
14416
  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,
14417
+ 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,
14418
+ 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
14419
  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
14420
  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
14421
  /* @__PURE__ */ jsx44("span", { children: duplicated }),
@@ -14808,6 +14822,26 @@ function withoutGoneColumns(query, liveKeys, openingSort) {
14808
14822
  const fallback = openingSort && liveKeys.has(openingSort.id) ? openingSort : null;
14809
14823
  return { ...query, sort: sortGone ? fallback : query.sort, columnFilters, page: 1 };
14810
14824
  }
14825
+ function sortSkippedSentence(keys, fields) {
14826
+ const names = keys.map((key) => {
14827
+ const field = fields.find((f) => f.key === key);
14828
+ return field ? fieldName(field) : null;
14829
+ });
14830
+ const named = names.filter((n) => n !== null);
14831
+ if (named.length === 0) return "Sort skipped: that column is no longer there. The default order is shown.";
14832
+ return `Sort skipped: ${named.join(", ")} ${named.length === 1 ? "is" : "are"} withheld from you. The default order is shown.`;
14833
+ }
14834
+ function filterSkippedSentence(keys, fields) {
14835
+ const named = keys.map((key) => {
14836
+ const field = fields.find((f) => f.key === key);
14837
+ return field ? fieldName(field) : null;
14838
+ }).filter((n) => n !== null);
14839
+ if (named.length === 0) return "Filter skipped: that column is no longer there.";
14840
+ return `Filter skipped: ${named.join(", ")} ${named.length === 1 ? "is" : "are"} withheld from you.`;
14841
+ }
14842
+ function filterIgnoredOf(answer) {
14843
+ return Array.isArray(answer?.filterIgnored) ? answer.filterIgnored : [];
14844
+ }
14811
14845
  function sortIgnoredOf(answer) {
14812
14846
  return Array.isArray(answer?.sortIgnored) ? answer.sortIgnored : [];
14813
14847
  }
@@ -26278,6 +26312,7 @@ function ViewSwitcherBody({
26278
26312
  openRecordId,
26279
26313
  onCloseRecord,
26280
26314
  onRowsShown,
26315
+ onWithheldColumns,
26281
26316
  onMoved,
26282
26317
  onNewRecordForm,
26283
26318
  onAskWhoChanged,
@@ -26356,6 +26391,7 @@ function ViewSwitcherBody({
26356
26391
  ...openRecordId ? { openRecordId } : {},
26357
26392
  ...onCloseRecord ? { onCloseRecord } : {},
26358
26393
  ...onRowsShown ? { onRowsShown } : {},
26394
+ ...onWithheldColumns ? { onWithheldColumns } : {},
26359
26395
  ...onNewRecordForm ? { onNewRecordForm } : {},
26360
26396
  ...onAskWhoChanged ? { onAskWhoChanged } : {},
26361
26397
  ...viewId ? {
@@ -31085,7 +31121,9 @@ function DigestScheduler({
31085
31121
  table_id: tableId,
31086
31122
  spec: {
31087
31123
  name: subjectName?.trim() ? subjectName.trim() : name.trim() || fallbackName,
31088
- filters: filters ?? {}
31124
+ filters: filters ?? {},
31125
+ // The summary's own view: it is read by id for what the summary sends, and is in no person's view list.
31126
+ definition: { system: true }
31089
31127
  }
31090
31128
  });
31091
31129
  if (!declared2.ok) {
@@ -40000,7 +40038,7 @@ function conditionCount(expr) {
40000
40038
  }
40001
40039
  return 1;
40002
40040
  }
40003
- function ViewFilter({ tableId, view, onApply, className }) {
40041
+ function ViewFilter({ tableId, view, onApply, withheldKeys, className }) {
40004
40042
  const fields = useFields33(tableId);
40005
40043
  const [open, setOpen] = useState118(false);
40006
40044
  const saved = view?.where ?? null;
@@ -40030,7 +40068,8 @@ function ViewFilter({ tableId, view, onApply, className }) {
40030
40068
  };
40031
40069
  }, [open, client, relations]);
40032
40070
  const conditionFields = useMemo70(() => {
40033
- const own = (fields.data ?? []).map((f) => ({ id: f.id, key: f.key, label: f.label || f.key, field: f }));
40071
+ const withheld = new Set(withheldKeys ?? []);
40072
+ 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
40073
  const reached = relations.flatMap(
40035
40074
  (rel) => (linkedFields[rel.id] ?? []).filter((inner) => inner.type !== "relation").map((inner) => ({
40036
40075
  id: `${rel.id}>${inner.id}`,
@@ -40041,7 +40080,8 @@ function ViewFilter({ tableId, view, onApply, className }) {
40041
40080
  }))
40042
40081
  );
40043
40082
  return [...own, ...reached];
40044
- }, [fields.data, relations, linkedFields]);
40083
+ }, [fields.data, relations, linkedFields, withheldKeys]);
40084
+ const withheldFields = useMemo70(() => withheldConditionFields(fields.data ?? [], withheldKeys), [fields.data, withheldKeys]);
40045
40085
  if (!view) return null;
40046
40086
  const count = conditionCount(saved);
40047
40087
  const changed2 = JSON.stringify(draft) !== savedKey;
@@ -40079,7 +40119,7 @@ function ViewFilter({ tableId, view, onApply, className }) {
40079
40119
  "This view asks: ",
40080
40120
  conditionInWords(saved, conditionFields),
40081
40121
  ". It cannot be drawn here; clear it to start a new filter."
40082
- ] }) : /* @__PURE__ */ jsx129(FilterTermsContext.Provider, { value: true, children: /* @__PURE__ */ jsx129(
40122
+ ] }) : /* @__PURE__ */ jsx129(FilterTermsContext.Provider, { value: true, children: /* @__PURE__ */ jsx129(WithheldConditionFieldsContext.Provider, { value: withheldFields, children: /* @__PURE__ */ jsx129(
40083
40123
  ConditionGroup,
40084
40124
  {
40085
40125
  lead: "Show records where",
@@ -40088,7 +40128,7 @@ function ViewFilter({ tableId, view, onApply, className }) {
40088
40128
  fields: conditionFields,
40089
40129
  onChange: setDraft
40090
40130
  }
40091
- ) }),
40131
+ ) }) }),
40092
40132
  view.ruleId ? null : /* @__PURE__ */ jsxs122("div", { className: "flex items-center gap-1", children: [
40093
40133
  changed2 ? /* @__PURE__ */ jsx129(
40094
40134
  Button99,
@@ -40968,7 +41008,7 @@ function TablePage({
40968
41008
  const shareInMenu = phone || toolbarFold2 >= 4;
40969
41009
  const faceUnknown = !opened.layout && (views === void 0 || looks === void 0 || Array.isArray(views) && views.length > 0 && view === null);
40970
41010
  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);
41011
+ const shownFilter = filter ?? (shown4?.where ? skipWhenWithheld(shown4.where) : null) ?? (shown4?.filters && Object.keys(shown4.filters).length > 0 ? shown4.filters : null);
40972
41012
  const press = (pressed) => {
40973
41013
  const next = chooseSurface(surface, pressed);
40974
41014
  setSurface(next);
@@ -41025,6 +41065,7 @@ function TablePage({
41025
41065
  setSurface((now) => ({ ...now, rail: "record" }));
41026
41066
  }, [activeRecordId]);
41027
41067
  const [shownIds, setShownIdsRaw] = useState121([]);
41068
+ const [withheldKeys, setWithheldKeys] = useState121([]);
41028
41069
  const setShownIds = useCallback61(
41029
41070
  (next) => setShownIdsRaw((prev) => prev.length === next.length && prev.every((id, i) => id === next[i]) ? prev : next),
41030
41071
  []
@@ -41251,7 +41292,7 @@ function TablePage({
41251
41292
  }
41252
41293
  );
41253
41294
  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 }) }) }),
41295
+ /* @__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
41296
  /* @__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
41297
  Button100,
41257
41298
  {
@@ -41712,7 +41753,7 @@ function TablePage({
41712
41753
  ] })
41713
41754
  ] }) })
41714
41755
  ) : null,
41715
- main === "records" && !(controlsInSheet && shownLayout === "grid") ? /* @__PURE__ */ jsx132(ViewFilter, { tableId, view: shown4, onApply: (where) => void patchView({ where }) }) : null,
41756
+ main === "records" && !(controlsInSheet && shownLayout === "grid") ? /* @__PURE__ */ jsx132(ViewFilter, { tableId, view: shown4, withheldKeys, onApply: (where) => void patchView({ where }) }) : null,
41716
41757
  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
41758
  /* @__PURE__ */ jsx132(
41718
41759
  Button100,
@@ -41956,6 +41997,7 @@ function TablePage({
41956
41997
  openRecordId: rail === "record" ? openRecord : null,
41957
41998
  onCloseRecord: () => setRail("none"),
41958
41999
  onRowsShown: setShownIds,
42000
+ onWithheldColumns: setWithheldKeys,
41959
42001
  onAskWhoChanged: (fieldKey, recordId) => {
41960
42002
  setAsking({ fieldKey, recordId });
41961
42003
  setRail("who-changed");