@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/CHANGELOG.md CHANGED
@@ -40,11 +40,23 @@
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.63
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.62
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 2c86ae638c 5245b516bd -- apps/shared/records-ui/src`
53
+
54
+ Changed shipped source files (4):
55
+ - `apps/shared/records-ui/src/EntityReferenceControl.tsx`
56
+ - `apps/shared/records-ui/src/FieldRulePreview.tsx`
57
+ - `apps/shared/records-ui/src/editors.tsx`
58
+ - `apps/shared/records-ui/src/gridEditing.tsx`
59
+
48
60
  ## 0.116.61
49
61
 
50
62
  SOURCE CHANGED WITH NO RELEASE NOTE. This release shipped source changes that nobody described in an Unreleased entry,
@@ -7069,17 +7069,39 @@ import { holdsNumbers as holdsNumbers2 } from "@ai-matrx/records/first-page";
7069
7069
  import { holdsNumbers as holdsNumbers3, pageSortFor, sortAsFor } from "@ai-matrx/records/first-page";
7070
7070
  import { containsPattern } from "@ai-matrx/records/data";
7071
7071
  function sortRefusal(f) {
7072
+ if (isWithheld(f)) return `${fieldName(f)} is withheld from you, so rows cannot be sorted by it.`;
7072
7073
  if (!computedOnRead(f)) return null;
7073
7074
  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
7075
  }
7075
7076
  function sortAndFilterRefusal(f) {
7076
7077
  if (sortRefusal(f) === null) return null;
7078
+ if (isWithheld(f)) return `${fieldName(f)} is withheld from you, so it can be neither sorted nor filtered.`;
7077
7079
  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
7080
  }
7079
7081
  function filterRefusal(f) {
7082
+ if (isWithheld(f)) return `${fieldName(f)} is withheld from you, so rows cannot be filtered by it.`;
7080
7083
  if (!computedOnRead(f)) return null;
7081
7084
  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
7085
  }
7086
+ var isWithheld = (f) => f.withheld === true;
7087
+ function withheldKeysOf(rows) {
7088
+ const out = /* @__PURE__ */ new Set();
7089
+ const [first, ...rest] = rows;
7090
+ if (!first?.hidden) return out;
7091
+ for (const key of Object.keys(first.hidden)) {
7092
+ const note = first.hidden[key];
7093
+ if (note && typeof note === "object" && rest.every((row) => row.hidden?.[key] && typeof row.hidden[key] === "object")) out.add(key);
7094
+ }
7095
+ return out;
7096
+ }
7097
+ function markWithheld(fields, keys) {
7098
+ if (keys.size === 0) return fields;
7099
+ return fields.map((f) => keys.has(f.key) ? { ...f, withheld: true } : f);
7100
+ }
7101
+ function skipWhenWithheld(filter) {
7102
+ if (!filter || !isRuleFilter(filter)) return filter;
7103
+ return { op: "and", args: [filter], skip_withheld: true };
7104
+ }
7083
7105
  function computedOnRead(f) {
7084
7106
  const kind = String(editorKindFor(f));
7085
7107
  return (f.type === "formula" || kind === "formula" || kind === "lookup" || kind === "rollup") && String(f.compute_on ?? "read") === "read";
@@ -7322,6 +7344,9 @@ function toRows(fields, records, labels) {
7322
7344
  });
7323
7345
  }
7324
7346
 
7347
+ // src/gridLook.ts
7348
+ import { SHEET_CELL_SUFFIX } from "@ai-matrx/kit/transfer-json";
7349
+
7325
7350
  // src/tableJson.ts
7326
7351
  import { exportCellText } from "@ai-matrx/records/core";
7327
7352
  import { toDelimited } from "@ai-matrx/kit/delimited";
@@ -7542,10 +7567,25 @@ function gridCopyConfig(args) {
7542
7567
  return {
7543
7568
  // THE TOOLBAR'S OWN "Download" (CSV, TSV, Excel, Copy as table) writes the rows through the same
7544
7569
  // 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
- ),
7570
+ // 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
7571
+ // the typed cell (`SHEET_CELL_SUFFIX`); every text format reads the visible column, the words the grid shows.
7572
+ sheetColumns: () => [
7573
+ ...fields.map((field2) => ({ id: field2.key, label: fieldName(field2) })),
7574
+ ...fields.map((field2) => ({ id: field2.key + SHEET_CELL_SUFFIX, label: fieldName(field2) }))
7575
+ ],
7576
+ sheetRows: () => {
7577
+ const exported = toRows([...fields], viewRows(), labels);
7578
+ return displayRows(exported).map(
7579
+ (row, at) => Object.fromEntries([
7580
+ ...fields.map((field2) => [field2.key, row[field2.key]?.value ?? null]),
7581
+ ...fields.map((field2) => {
7582
+ const cell = exported[at]?.[field2.key];
7583
+ const typed = cell && !cell.absent_reason ? cell.typed : void 0;
7584
+ return [field2.key + SHEET_CELL_SUFFIX, typed ? { t: typed.t, v: typed.v, ...typed.z ? { z: typed.z } : {} } : null];
7585
+ })
7586
+ ])
7587
+ );
7588
+ },
7549
7589
  items: [
7550
7590
  { 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
7591
  { 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 +12292,9 @@ export {
12252
12292
  sortRefusal,
12253
12293
  sortAndFilterRefusal,
12254
12294
  filterRefusal,
12295
+ withheldKeysOf,
12296
+ markWithheld,
12297
+ skipWhenWithheld,
12255
12298
  storeQuestion,
12256
12299
  inColumnWords,
12257
12300
  holdsNumbers3 as holdsNumbers,
@@ -12430,4 +12473,4 @@ export {
12430
12473
  RecordNameText,
12431
12474
  HeldChangeDecision
12432
12475
  };
12433
- //# sourceMappingURL=chunk-NTOTMYVO.js.map
12476
+ //# sourceMappingURL=chunk-X2WDIQIR.js.map