@ai-matrx/records-ui 0.116.101 → 0.116.103

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
@@ -1,6 +1,8 @@
1
1
  # Changelog
2
2
 
3
- ## 0.116.101
3
+ ## 0.116.103
4
+
5
+ - **A field marked hidden stays off every default view (lane HIDDEN-FIELD-DEFAULT, 2026-10-23).** A field whose definition carries `config.hidden === true` (the Notion importer's "Notion ID") is now left out wherever a view has no saved choice: the grid's and merged grid's columns, the gallery tiles, board/list/calendar/timeline card fields and the org-chart/swipe card lines. One shared helper (`systemFields.ts`: `isSystemField`, `hiddenOrSystemDefault`, `hiddenToWrite`). A view's own saved `hiddenFields` / `cardHidden` (even empty) wins, the Fields and column pickers still list the field so a person can turn it on, and emptying the hidden list now writes `hiddenFields: []` (when the table has such a field) so the choice is kept. Guard: `a-field-marked-hidden-stays-off-every-default-view.test.tsx` (red before). Consumer action: none.
4
6
 
5
7
  - **Move under… and Also points at never move the dialog (lane CLOSE-LINK round 2, 2026-10-23).** `MoveUnderDialog` draws its search box before a table is picked (disabled, "Pick a table first"), and `AlsoPointsAt` keeps one fixed-height box for "Reading tables…", "No other tables yet." and the list, so nothing below shifts when the tables arrive. Guards: assertions in `a-record-moves-under-another-and-a-refused-move-says-why.test.tsx` and `every-table-picker-hides-value-sets.test.tsx` (red before). Consumer action: none.
6
8
 
package/dist/index.cjs CHANGED
@@ -29892,6 +29892,29 @@ init_parity();
29892
29892
  init_pasteValues();
29893
29893
  init_host();
29894
29894
  init_plainWords();
29895
+
29896
+ // src/systemFields.ts
29897
+ function isSystemField(field2) {
29898
+ return field2.config?.hidden === true;
29899
+ }
29900
+ function systemFieldKeys(fields) {
29901
+ return (fields ?? []).filter(isSystemField).map((f) => f.key);
29902
+ }
29903
+ function hiddenOrSystemDefault(saved, fields) {
29904
+ if (saved) return [...saved];
29905
+ const system = systemFieldKeys(fields);
29906
+ return system.length > 0 ? system : void 0;
29907
+ }
29908
+ function hiddenFieldsEntry(hidden, fields) {
29909
+ const kept2 = hiddenToWrite(hidden, fields);
29910
+ return kept2 ? { hiddenFields: kept2 } : {};
29911
+ }
29912
+ function hiddenToWrite(hidden, fields) {
29913
+ if (hidden.length > 0) return [...hidden];
29914
+ return systemFieldKeys(fields).length > 0 ? [] : void 0;
29915
+ }
29916
+
29917
+ // src/gridControls.tsx
29895
29918
  init_readRefusals();
29896
29919
  var import_jsx_runtime99 = require("react/jsx-runtime");
29897
29920
  var VALUE_COUNTS_FRESH_MS = 1e4;
@@ -29983,8 +30006,8 @@ function useMergedGridControls(args) {
29983
30006
  }, [held, fieldKeys, keptOrder, frozenKeys]);
29984
30007
  const hidden = (0, import_react158.useMemo)(() => {
29985
30008
  const known = new Set(fieldKeys);
29986
- return (held?.hidden ?? keptHidden ?? []).filter((k) => known.has(k) || k.startsWith(REVERSE_COLUMN_PREFIX));
29987
- }, [held, keptHidden, fieldKeys]);
30009
+ return (held?.hidden ?? hiddenOrSystemDefault(keptHidden, fields) ?? []).filter((k) => known.has(k) || k.startsWith(REVERSE_COLUMN_PREFIX));
30010
+ }, [held, keptHidden, fieldKeys, fields]);
29988
30011
  const naturalOrder = (0, import_react158.useMemo)(
29989
30012
  () => [...fieldKeys.filter((k) => frozenKeys.has(k)), ...fieldKeys.filter((k) => !frozenKeys.has(k))],
29990
30013
  [fieldKeys, frozenKeys]
@@ -29997,10 +30020,10 @@ function useMergedGridControls(args) {
29997
30020
  writeLook({
29998
30021
  ...rest,
29999
30022
  ...moved ? { columnOrder: next.order } : {},
30000
- ...next.hidden.length > 0 ? { hiddenFields: next.hidden } : {}
30023
+ ...hiddenFieldsEntry(next.hidden, fields)
30001
30024
  });
30002
30025
  },
30003
- [presentation, writeLook, naturalOrder]
30026
+ [presentation, writeLook, naturalOrder, fields]
30004
30027
  );
30005
30028
  const pendingInsert = (0, import_react158.useRef)(null);
30006
30029
  (0, import_react158.useEffect)(() => {
@@ -32424,6 +32447,25 @@ var import_design_system90 = require("@ai-matrx/design-system");
32424
32447
  init_Refusal();
32425
32448
  init_refusals();
32426
32449
  var import_jsx_runtime104 = require("react/jsx-runtime");
32450
+ function keptWhileAway(outcome, readBackUnsent, readBackRefusal) {
32451
+ if (!readBackUnsent || outcome.written === 0) return outcome;
32452
+ const values = outcome.readBack + outcome.missing;
32453
+ return {
32454
+ ...outcome,
32455
+ readBack: 0,
32456
+ missing: 0,
32457
+ waiting: values,
32458
+ refusals: readBackRefusal === void 0 ? outcome.refusals : outcome.refusals.filter((why) => why !== readBackRefusal)
32459
+ };
32460
+ }
32461
+ function outcomeSentence(outcome) {
32462
+ const waiting = outcome.waiting ?? 0;
32463
+ if (waiting > 0) {
32464
+ return `${waiting} ${waiting === 1 ? "value is" : "values are"} saved on this computer and will be sent to the table when you are back online.`;
32465
+ }
32466
+ const whole = outcome.missing === 0 && outcome.refusals.length === 0;
32467
+ return whole ? `All ${outcome.readBack} ${outcome.readBack === 1 ? "value is" : "values are"} in the table \u2014 read back out of it, not just accepted.` : `${outcome.readBack} of ${outcome.readBack + outcome.missing} values are in the table. The rest are not, and nothing was lost from what you copied \u2014 it is still on your clipboard.`;
32468
+ }
32427
32469
  function PastePreview({
32428
32470
  plan,
32429
32471
  noun,
@@ -32566,8 +32608,9 @@ function PastePreview({
32566
32608
  }
32567
32609
  function Outcome({ outcome, onClose }) {
32568
32610
  const whole = outcome.missing === 0 && outcome.refusals.length === 0;
32611
+ const look = (outcome.waiting ?? 0) > 0 ? "waiting" : whole ? "whole" : "partial";
32569
32612
  return /* @__PURE__ */ (0, import_jsx_runtime104.jsxs)(import_jsx_runtime104.Fragment, { children: [
32570
- /* @__PURE__ */ (0, import_jsx_runtime104.jsx)("p", { className: "text-sm", "data-matrx-paste-outcome": whole ? "whole" : "partial", children: whole ? `All ${outcome.readBack} ${outcome.readBack === 1 ? "value is" : "values are"} in the table \u2014 read back out of it, not just accepted.` : `${outcome.readBack} of ${outcome.readBack + outcome.missing} values are in the table. The rest are not, and nothing was lost from what you copied \u2014 it is still on your clipboard.` }),
32613
+ /* @__PURE__ */ (0, import_jsx_runtime104.jsx)("p", { className: "text-sm", "data-matrx-paste-outcome": look, children: outcomeSentence(outcome) }),
32571
32614
  outcome.refusals.length > 0 ? /* @__PURE__ */ (0, import_jsx_runtime104.jsx)("ul", { className: "flex flex-col gap-1", children: outcome.refusals.slice(0, 8).map((why, index) => /* @__PURE__ */ (0, import_jsx_runtime104.jsx)("li", { className: "text-xs text-muted-foreground", children: why }, index)) }) : null,
32572
32615
  /* @__PURE__ */ (0, import_jsx_runtime104.jsx)("div", { className: "flex justify-end pt-1", children: /* @__PURE__ */ (0, import_jsx_runtime104.jsx)(import_design_system90.Button, { size: "sm", onClick: onClose, autoFocus: true, children: "Close" }) })
32573
32616
  ] });
@@ -35867,7 +35910,8 @@ function GridBody({
35867
35910
  let missing = 0;
35868
35911
  const fieldOf2 = new Map((fields.data ?? []).map((f) => [f.key, f]));
35869
35912
  const refusals = [];
35870
- if (!reread.ok) refusals.push(`The rows were written and this could not read them back to check: ${refusalSentence(reread.error)}`);
35913
+ const readBackRefusal = reread.ok ? void 0 : `The rows were written and this could not read them back to check: ${refusalSentence(reread.error)}`;
35914
+ if (readBackRefusal !== void 0) refusals.push(readBackRefusal);
35871
35915
  const seen = new Map((reread.ok ? reread.data : []).map((r) => [r.id, r.document ?? {}]));
35872
35916
  for (const entry of expected) {
35873
35917
  const stored = seen.get(entry.recordId);
@@ -35877,7 +35921,7 @@ function GridBody({
35877
35921
  }
35878
35922
  }
35879
35923
  records.reload();
35880
- return { written: lines2, readBack, missing, refusals };
35924
+ return keptWhileAway({ written: lines2, readBack, missing, refusals }, !reread.ok && isUnsentWrite(reread.error), readBackRefusal);
35881
35925
  },
35882
35926
  [rows, client, tableId, editing, undo, records, versions, fields.data]
35883
35927
  );
@@ -35909,7 +35953,7 @@ function GridBody({
35909
35953
  if (!held) return { written: 0, readBack: 0, missing: 0, refusals: [] };
35910
35954
  if (merged) {
35911
35955
  const outcome = await applyPasteAsOne(held.plan);
35912
- if (outcome.missing === 0 && outcome.refusals.length === 0) {
35956
+ if (outcome.missing === 0 && outcome.refusals.length === 0 && (outcome.waiting ?? 0) === 0) {
35913
35957
  setPastePlan(null);
35914
35958
  sheetController.current?.focusGrid();
35915
35959
  }
@@ -35957,12 +36001,14 @@ function GridBody({
35957
36001
  const fieldOf2 = new Map((fields.data ?? []).map((f) => [f.key, f]));
35958
36002
  const seen = /* @__PURE__ */ new Map();
35959
36003
  const READ_BACK_PAGE = 500;
36004
+ let readBackRefusal;
36005
+ let readBackUnsent = false;
35960
36006
  for (let offset = 0; ; offset += READ_BACK_PAGE) {
35961
36007
  const reread = await client.list({ table_id: tableId, limit: READ_BACK_PAGE, offset });
35962
36008
  if (!reread.ok) {
35963
- refusals.push(
35964
- `The rows were written and this could not read them back to check: ${refusalSentence(reread.error)}`
35965
- );
36009
+ readBackRefusal = `The rows were written and this could not read them back to check: ${refusalSentence(reread.error)}`;
36010
+ readBackUnsent = isUnsentWrite(reread.error);
36011
+ refusals.push(readBackRefusal);
35966
36012
  break;
35967
36013
  }
35968
36014
  for (const row of reread.data.rows) {
@@ -35982,7 +36028,7 @@ function GridBody({
35982
36028
  }
35983
36029
  }
35984
36030
  records.reload();
35985
- return { written, readBack, missing, refusals };
36031
+ return keptWhileAway({ written, readBack, missing, refusals }, readBackUnsent, readBackRefusal);
35986
36032
  }, [pastePlan, client, tableId, records, merged, applyPasteAsOne, versions, fields.data]);
35987
36033
  const columnIds = (0, import_react197.useMemo)(() => ordered.map((field2) => field2.key), [ordered]);
35988
36034
  const lookWrites = (0, import_react197.useRef)(null);
@@ -36033,7 +36079,7 @@ function GridBody({
36033
36079
  }),
36034
36080
  [host, tableId, table.data, fields.data]
36035
36081
  );
36036
- const hiddenKeys = presentation.hiddenFields;
36082
+ const hiddenKeys = hiddenOrSystemDefault(presentation.hiddenFields, fields.data);
36037
36083
  const shownKeys = (0, import_react197.useMemo)(
36038
36084
  () => hiddenKeys && hiddenKeys.length > 0 ? columnIds.filter((k) => !hiddenKeys.includes(k)) : columnIds,
36039
36085
  [columnIds, hiddenKeys]
@@ -36515,7 +36561,7 @@ function GridBody({
36515
36561
  // THE CLASSIC GRID OBEYS THE VIEW TOO (CHAIR-GRID-LINKS 07): with no merged controls the kept
36516
36562
  // `presentation.hiddenFields` / `columnOrder` still decide what is drawn.
36517
36563
  order: controls.columns?.order ?? localColumns?.order ?? (presentation.columnOrder?.length ? columnsInKeptOrder(columnIds, presentation.columnOrder) : columnIds),
36518
- hidden: controls.columns?.hidden ?? localColumns?.hidden ?? presentation.hiddenFields ?? [],
36564
+ hidden: controls.columns?.hidden ?? localColumns?.hidden ?? hiddenOrSystemDefault(presentation.hiddenFields, fields.data) ?? [],
36519
36565
  onChange: (drawn) => {
36520
36566
  const next = { order: fieldColumnIds(drawn.order, fields.data ?? []), hidden: fieldColumnIds(drawn.hidden, fields.data ?? []) };
36521
36567
  if (controls.columns) controls.columns.onChange(next);
@@ -43967,7 +44013,7 @@ function isEmptyOnCard(value) {
43967
44013
  return value === null || value === void 0 || value === "" || Array.isArray(value) && value.length === 0;
43968
44014
  }
43969
44015
  function cardFieldsShown(fields, hiddenFields, exclude) {
43970
- const hidden = new Set(hiddenFields ?? []);
44016
+ const hidden = new Set(hiddenOrSystemDefault(hiddenFields, fields) ?? []);
43971
44017
  const out = new Set(exclude.filter((k) => Boolean(k)));
43972
44018
  return fields.filter((field2) => !hidden.has(field2.key) && !out.has(field2.key));
43973
44019
  }
@@ -43979,7 +44025,7 @@ function CardFieldsPicker({
43979
44025
  remembered,
43980
44026
  layout
43981
44027
  }) {
43982
- const hidden = new Set(hiddenFields ?? []);
44028
+ const hidden = new Set(hiddenOrSystemDefault(hiddenFields, fields) ?? []);
43983
44029
  return /* @__PURE__ */ (0, import_jsx_runtime156.jsxs)("details", { className: "text-xs text-muted-foreground", "data-records-card-fields": layout, children: [
43984
44030
  /* @__PURE__ */ (0, import_jsx_runtime156.jsx)("summary", { className: "cursor-pointer select-none", children: summary }),
43985
44031
  /* @__PURE__ */ (0, import_jsx_runtime156.jsx)("div", { className: "mt-1 flex flex-wrap gap-2", children: fields.map((field2) => /* @__PURE__ */ (0, import_jsx_runtime156.jsxs)("label", { className: "flex items-center gap-1", children: [
@@ -48743,7 +48789,8 @@ function selfLinkFields(fields, tableId) {
48743
48789
  function orgCardFields(fields, hidden, exclude) {
48744
48790
  const skip = new Set(exclude.filter((k) => Boolean(k)));
48745
48791
  const usable = fields.filter((f) => !skip.has(f.key) && !["attachment", "button", "formula"].includes(String(f.type)));
48746
- const shown5 = hidden === void 0 ? usable : usable.filter((f) => !hidden.includes(f.key));
48792
+ const kept2 = hiddenOrSystemDefault(hidden, fields);
48793
+ const shown5 = kept2 === void 0 ? usable : usable.filter((f) => !kept2.includes(f.key));
48747
48794
  return shown5.slice(0, 2);
48748
48795
  }
48749
48796
  function orgNotes(forest, total) {
@@ -50512,7 +50559,7 @@ function Gallery({
50512
50559
  onNew,
50513
50560
  newLabel
50514
50561
  }) {
50515
- const hidden = (0, import_react299.useMemo)(() => new Set(hiddenFields ?? []), [hiddenFields]);
50562
+ const hidden = (0, import_react299.useMemo)(() => new Set(hiddenOrSystemDefault(hiddenFields, fields) ?? []), [hiddenFields, fields]);
50516
50563
  const imageField = imageKey ? fields.find((field2) => field2.key === imageKey) : void 0;
50517
50564
  const shown5 = fields.filter((field2) => !hidden.has(field2.key) && field2.key !== imageKey && field2.key !== titleKey);
50518
50565
  const chose = hiddenFields !== void 0;
@@ -64755,6 +64802,7 @@ function TablePage({
64755
64802
  });
64756
64803
  }, [view, looks]);
64757
64804
  const hiddenNow = shown5?.presentation?.hiddenFields ?? [];
64805
+ const hiddenInList = hiddenOrSystemDefault(shown5?.presentation?.hiddenFields, allFields.data) ?? [];
64758
64806
  const hiddenSaved = view?.presentation?.hiddenFields ?? [];
64759
64807
  const hiddenDiffers = JSON.stringify(hiddenNow) !== JSON.stringify(hiddenSaved);
64760
64808
  const addressNow = {
@@ -65614,12 +65662,12 @@ function TablePage({
65614
65662
  tableId,
65615
65663
  archiveAsked,
65616
65664
  columns: view ? {
65617
- hidden: hiddenNow,
65665
+ hidden: hiddenInList,
65618
65666
  order: shown5?.presentation?.columnOrder ?? null,
65619
65667
  onChange: ({ hidden, order }) => {
65620
65668
  const { hiddenFields: _h, columnOrder: _o, ...rest } = shown5?.presentation ?? {};
65621
65669
  return patchView({
65622
- presentation: { ...rest, ...hidden.length > 0 ? { hiddenFields: hidden } : {}, ...order ? { columnOrder: order } : {} }
65670
+ presentation: { ...rest, ...hiddenFieldsEntry(hidden, allFields.data), ...order ? { columnOrder: order } : {} }
65623
65671
  });
65624
65672
  }
65625
65673
  } : void 0