@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/CHANGELOG.md CHANGED
@@ -40,11 +40,38 @@
40
40
  - Tests: `vitest.setup.ts` gives jsdom a no-op `performance.mark` / `measure`.
41
41
  - **New subpath `@ai-matrx/records-ui/data-source`:** `recordsDataSource`, `personActor` and the who-changed words (`whenWords`, `actorWords`, `actorBadge`, `lastChangeSentence`, `SOMEBODY`, `THE_SYSTEM`) alone. `/helpers` also carries the field-type words, the colour resolver and the table builders, which read `@ai-matrx/records/core`; this entry reaches `@ai-matrx/kit` only, and shares the one data-source cache with `/helpers` and the root. Additive. Consumer action: a shell-reachable service that only binds its supabase client or says when imports from `/data-source`.
42
42
 
43
- ## 0.116.62
43
+ ## 0.116.64
44
44
 
45
45
  UNVERIFIED: this release has no Unreleased entry and the source comparison could not be made (the caller supplied no source comparison). Whether source changed is unknown; consumer action is unknown.
46
46
  Check the package's gitHead on npm against this version's gitHead: `git diff <previous gitHead> <this gitHead> -- apps/shared/records-ui/src`.
47
47
 
48
+ ## 0.116.63
49
+
50
+ SOURCE CHANGED WITH NO RELEASE NOTE. This release shipped source changes that nobody described in an Unreleased entry,
51
+ so they may include breaking API changes. Consumer action is UNKNOWN: read the diff before upgrading.
52
+ Diff: `git diff 5245b516bd 996211f8f7 -- apps/shared/records-ui/src`
53
+
54
+ Changed shipped source files (7):
55
+ - `apps/shared/records-ui/src/DigestScheduler.tsx`
56
+ - `apps/shared/records-ui/src/Grid.tsx`
57
+ - `apps/shared/records-ui/src/TablePage.tsx`
58
+ - `apps/shared/records-ui/src/ViewFilter.tsx`
59
+ - `apps/shared/records-ui/src/ViewSwitcher.tsx`
60
+ - `apps/shared/records-ui/src/gridLook.ts`
61
+ - `apps/shared/records-ui/src/gridPage.ts`
62
+
63
+ ## 0.116.62
64
+
65
+ SOURCE CHANGED WITH NO RELEASE NOTE. This release shipped source changes that nobody described in an Unreleased entry,
66
+ so they may include breaking API changes. Consumer action is UNKNOWN: read the diff before upgrading.
67
+ Diff: `git diff 2c86ae638c 5245b516bd -- apps/shared/records-ui/src`
68
+
69
+ Changed shipped source files (4):
70
+ - `apps/shared/records-ui/src/EntityReferenceControl.tsx`
71
+ - `apps/shared/records-ui/src/FieldRulePreview.tsx`
72
+ - `apps/shared/records-ui/src/editors.tsx`
73
+ - `apps/shared/records-ui/src/gridEditing.tsx`
74
+
48
75
  ## 0.116.61
49
76
 
50
77
  SOURCE CHANGED WITH NO RELEASE NOTE. This release shipped source changes that nobody described in an Unreleased entry,
@@ -5562,6 +5562,11 @@ function linkedOf(expr) {
5562
5562
  return { via: rel["field"], inner: a["field"], op: match === "any" ? "eq" : "ne", value: b["const"] };
5563
5563
  }
5564
5564
  var FilterTermsContext = createContext3(false);
5565
+ var WithheldConditionFieldsContext = createContext3([]);
5566
+ function withheldConditionFields(fields, withheldKeys) {
5567
+ const withheld = new Set(withheldKeys ?? []);
5568
+ return fields.filter((f) => withheld.has(f.key)).map((f) => ({ id: f.id, key: f.key, label: f.label || f.key }));
5569
+ }
5565
5570
  var RELATIVE_DAY_TERMS = [
5566
5571
  { kind: "today", label: "is today" },
5567
5572
  { kind: "tomorrow", label: "is tomorrow" },
@@ -5815,6 +5820,7 @@ function conditionValue(typed) {
5815
5820
  function ConditionRow({ lead, expr, fields, onChange, emptyLabel = "always", className }) {
5816
5821
  const node = expr ?? null;
5817
5822
  const filterTerms = useContext2(FilterTermsContext);
5823
+ const withheldFields = useContext2(WithheldConditionFieldsContext);
5818
5824
  const choiceListTerms = useContext2(ChoiceListTermsContext) || filterTerms;
5819
5825
  const relative = relativeDayOf(expr);
5820
5826
  const reader = meOf(expr);
@@ -5880,7 +5886,18 @@ function ConditionRow({ lead, expr, fields, onChange, emptyLabel = "always", cla
5880
5886
  attrs: { "data-condition": "field" }
5881
5887
  }
5882
5888
  ),
5883
- onField && !fields.some((f) => f.id === onField) ? /* @__PURE__ */ jsx29(
5889
+ onField && !fields.some((f) => f.id === onField) && withheldFields.some((f) => f.id === onField) ? /* @__PURE__ */ jsxs25(
5890
+ "span",
5891
+ {
5892
+ className: "rounded bg-muted px-1.5 py-0.5 text-[11px] font-medium text-muted-foreground",
5893
+ title: "This column is withheld from you, so this condition is skipped.",
5894
+ "data-records-condition-withheld": "",
5895
+ children: [
5896
+ withheldFields.find((f) => f.id === onField).label,
5897
+ " (withheld)"
5898
+ ]
5899
+ }
5900
+ ) : onField && !fields.some((f) => f.id === onField) ? /* @__PURE__ */ jsx29(
5884
5901
  "span",
5885
5902
  {
5886
5903
  className: "rounded bg-destructive px-1.5 py-0.5 text-[11px] font-medium text-destructive-foreground",
@@ -7069,17 +7086,39 @@ import { holdsNumbers as holdsNumbers2 } from "@ai-matrx/records/first-page";
7069
7086
  import { holdsNumbers as holdsNumbers3, pageSortFor, sortAsFor } from "@ai-matrx/records/first-page";
7070
7087
  import { containsPattern } from "@ai-matrx/records/data";
7071
7088
  function sortRefusal(f) {
7089
+ if (isWithheld(f)) return `${fieldName(f)} is withheld from you, so rows cannot be sorted by it.`;
7072
7090
  if (!computedOnRead(f)) return null;
7073
7091
  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.`;
7074
7092
  }
7075
7093
  function sortAndFilterRefusal(f) {
7076
7094
  if (sortRefusal(f) === null) return null;
7095
+ if (isWithheld(f)) return `${fieldName(f)} is withheld from you, so it can be neither sorted nor filtered.`;
7077
7096
  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.`;
7078
7097
  }
7079
7098
  function filterRefusal(f) {
7099
+ if (isWithheld(f)) return `${fieldName(f)} is withheld from you, so rows cannot be filtered by it.`;
7080
7100
  if (!computedOnRead(f)) return null;
7081
7101
  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.`;
7082
7102
  }
7103
+ var isWithheld = (f) => f.withheld === true;
7104
+ function withheldKeysOf(rows) {
7105
+ const out = /* @__PURE__ */ new Set();
7106
+ const [first, ...rest] = rows;
7107
+ if (!first?.hidden) return out;
7108
+ for (const key of Object.keys(first.hidden)) {
7109
+ const note = first.hidden[key];
7110
+ if (note && typeof note === "object" && rest.every((row) => row.hidden?.[key] && typeof row.hidden[key] === "object")) out.add(key);
7111
+ }
7112
+ return out;
7113
+ }
7114
+ function markWithheld(fields, keys) {
7115
+ if (keys.size === 0) return fields;
7116
+ return fields.map((f) => keys.has(f.key) ? { ...f, withheld: true } : f);
7117
+ }
7118
+ function skipWhenWithheld(filter) {
7119
+ if (!filter || !isRuleFilter(filter)) return filter;
7120
+ return { op: "and", args: [filter], skip_withheld: true };
7121
+ }
7083
7122
  function computedOnRead(f) {
7084
7123
  const kind = String(editorKindFor(f));
7085
7124
  return (f.type === "formula" || kind === "formula" || kind === "lookup" || kind === "rollup") && String(f.compute_on ?? "read") === "read";
@@ -7322,6 +7361,9 @@ function toRows(fields, records, labels) {
7322
7361
  });
7323
7362
  }
7324
7363
 
7364
+ // src/gridLook.ts
7365
+ import { SHEET_CELL_SUFFIX } from "@ai-matrx/kit/transfer-json";
7366
+
7325
7367
  // src/tableJson.ts
7326
7368
  import { exportCellText } from "@ai-matrx/records/core";
7327
7369
  import { toDelimited } from "@ai-matrx/kit/delimited";
@@ -7542,10 +7584,25 @@ function gridCopyConfig(args) {
7542
7584
  return {
7543
7585
  // THE TOOLBAR'S OWN "Download" (CSV, TSV, Excel, Copy as table) writes the rows through the same
7544
7586
  // words the rail writes (`fileExport.ts`): the value as the grid SHOWS it, a date in her zone.
7545
- sheetColumns: () => fields.map((field2) => ({ id: field2.key, label: fieldName(field2) })),
7546
- sheetRows: () => displayRows(toRows([...fields], viewRows(), labels)).map(
7547
- (row) => Object.fromEntries(fields.map((field2) => [field2.key, row[field2.key]?.value ?? null]))
7548
- ),
7587
+ // 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
7588
+ // the typed cell (`SHEET_CELL_SUFFIX`); every text format reads the visible column, the words the grid shows.
7589
+ sheetColumns: () => [
7590
+ ...fields.map((field2) => ({ id: field2.key, label: fieldName(field2) })),
7591
+ ...fields.map((field2) => ({ id: field2.key + SHEET_CELL_SUFFIX, label: fieldName(field2) }))
7592
+ ],
7593
+ sheetRows: () => {
7594
+ const exported = toRows([...fields], viewRows(), labels);
7595
+ return displayRows(exported).map(
7596
+ (row, at) => Object.fromEntries([
7597
+ ...fields.map((field2) => [field2.key, row[field2.key]?.value ?? null]),
7598
+ ...fields.map((field2) => {
7599
+ const cell = exported[at]?.[field2.key];
7600
+ const typed = cell && !cell.absent_reason ? cell.typed : void 0;
7601
+ return [field2.key + SHEET_CELL_SUFFIX, typed ? { t: typed.t, v: typed.v, ...typed.z ? { z: typed.z } : {} } : null];
7602
+ })
7603
+ ])
7604
+ );
7605
+ },
7549
7606
  items: [
7550
7607
  { 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` }) },
7551
7608
  { 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 }) },
@@ -12252,6 +12309,9 @@ export {
12252
12309
  sortRefusal,
12253
12310
  sortAndFilterRefusal,
12254
12311
  filterRefusal,
12312
+ withheldKeysOf,
12313
+ markWithheld,
12314
+ skipWhenWithheld,
12255
12315
  storeQuestion,
12256
12316
  inColumnWords,
12257
12317
  holdsNumbers3 as holdsNumbers,
@@ -12375,6 +12435,8 @@ export {
12375
12435
  cardWords,
12376
12436
  CONDITION_OPS,
12377
12437
  FilterTermsContext,
12438
+ WithheldConditionFieldsContext,
12439
+ withheldConditionFields,
12378
12440
  conditionIsSimple,
12379
12441
  conditionInWords,
12380
12442
  conditionValue,
@@ -12430,4 +12492,4 @@ export {
12430
12492
  RecordNameText,
12431
12493
  HeldChangeDecision
12432
12494
  };
12433
- //# sourceMappingURL=chunk-NTOTMYVO.js.map
12495
+ //# sourceMappingURL=chunk-QXPUBNYQ.js.map