@ai-matrx/records-ui 0.114.0 → 0.114.1

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,5 +1,11 @@
1
1
  # Changelog — @ai-matrx/records-ui
2
2
 
3
+ ## 0.114.1
4
+
5
+ Automatic changed-only republish (docs/metadata drift since the last tag — see
6
+ `git diff npm/records-ui/v0.114.0..npm/records-ui/v0.114.1 -- apps/shared/records-ui`).
7
+ No source changes intended and no consumer action required.
8
+
3
9
  ## 0.114.0 — a view exports as Markdown (lane FORMULA-2)
4
10
 
5
11
  - **The table page's action list** gains "Download Markdown" (a `.md` file named after the table) and "Copy as Markdown": the rows
package/dist/index.cjs CHANGED
@@ -659,9 +659,7 @@ var NEEDS = {
659
659
  // custom.share_grant — passing your access on is an administrator's right
660
660
  share: "admin",
661
661
  // custom.field_declare / field_update / field_retire / table settings
662
- structure: "admin",
663
- // custom.field_declare / field_update / field_retire — the same rung; a lock takes it away, nothing else does
664
- schema: "admin"
662
+ structure: "admin"
665
663
  };
666
664
  function levelNeededFor(what) {
667
665
  return NEEDS[what];
@@ -679,8 +677,7 @@ function sentenceFor(what, level) {
679
677
  organise: "organise this",
680
678
  remove: "delete this",
681
679
  share: "pass this on to somebody else",
682
- structure: "change the columns of this table",
683
- schema: "change the columns of this table"
680
+ structure: "change the columns of this table"
684
681
  };
685
682
  return `You are ${have} here, and it takes ${need} to ${doing[what]}. Ask somebody who is Admin on it to move you up.`;
686
683
  }
@@ -696,7 +693,6 @@ function whatYouMayDo(level, known = true) {
696
693
  remove: may("remove"),
697
694
  share: may("share"),
698
695
  structure: may("structure"),
699
- schema: may("schema"),
700
696
  why: (what) => known ? sentenceFor(what, level) : NOT_YET
701
697
  };
702
698
  }
@@ -708,16 +704,15 @@ function whatYouMayDoWithTable(table, level, known) {
708
704
  return {
709
705
  ...base2,
710
706
  structure: false,
711
- schema: false,
712
- why: (what) => what === "structure" || what === "schema" ? KERNEL_REASON : base2.why(what)
707
+ why: (what) => what === "structure" ? KERNEL_REASON : base2.why(what)
713
708
  };
714
709
  }
715
710
  function tableIsLocked(table) {
716
711
  return table?.metadata?.["locked"] === true;
717
712
  }
718
- var DATABASE_LOCKED_REASON = "This database is locked, so its columns cannot be added, renamed, changed or deleted. Unlock it to change them.";
713
+ var DATABASE_LOCKED_REASON = "This database is locked, so its columns and settings are read-only. Unlock it to change them.";
719
714
  function lockedStructure(base2) {
720
- return { ...base2, schema: false, why: (what) => what === "schema" ? DATABASE_LOCKED_REASON : base2.why(what) };
715
+ return { ...base2, structure: false, why: (what) => what === "structure" ? DATABASE_LOCKED_REASON : base2.why(what) };
721
716
  }
722
717
 
723
718
  // src/host.tsx
@@ -3491,7 +3486,6 @@ function TableDetails({
3491
3486
  (0, import_react15.tableShapeChanged)(tableId);
3492
3487
  onSaved?.();
3493
3488
  };
3494
- const locked = table.metadata?.["locked"] === true;
3495
3489
  return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "flex flex-col gap-2", "data-table-details": "", children: [
3496
3490
  /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { className: "font-medium", children: "About this table" }),
3497
3491
  /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "flex flex-col gap-1", children: [
@@ -3545,9 +3539,9 @@ function TableDetails({
3545
3539
  size: "sm",
3546
3540
  variant: "outline",
3547
3541
  disabled: busy,
3548
- onClick: () => void write(lockPatch(table, !locked), { metadata: table.metadata ?? {} }),
3542
+ onClick: () => void write(lockPatch(table, true), { metadata: table.metadata ?? {} }),
3549
3543
  "data-table-lock-on": "",
3550
- children: locked ? "Unlock" : "Lock"
3544
+ children: "Lock"
3551
3545
  }
3552
3546
  )
3553
3547
  ] }),
@@ -7351,8 +7345,10 @@ var RELATIVE_DAY_TERMS = [
7351
7345
  { kind: "past_days", label: "is in the past \u2026 days", takesDays: true }
7352
7346
  ];
7353
7347
  function relativeDayNode(fieldId, kind, days) {
7348
+ const zone2 = getPersonTimeZone();
7354
7349
  const window2 = { relative: kind };
7355
7350
  if (RELATIVE_DAY_TERMS.find((t) => t.kind === kind)?.takesDays) window2["n"] = days ?? 7;
7351
+ if (zone2) window2["tz"] = zone2;
7356
7352
  return { op: "within", args: [{ field: fieldId }, { const: window2 }] };
7357
7353
  }
7358
7354
  function relativeDayOf(expr) {
@@ -9000,8 +8996,8 @@ function FieldEditor(props) {
9000
8996
  const entityMutation = (0, import_react51.useEntityFieldMutation)();
9001
8997
  const mutation = onEntity ? { saving: entityMutation.saving, error: entityMutation.error } : { saving: tableMutation.saving, error: tableMutation.error };
9002
8998
  const client = (0, import_react51.useRecordsClient)();
9003
- const mayShape = onEntity ? entityRights.data?.may_declare === true : tableRights2.schema;
9004
- const whyNot = onEntity ? entityRights.data?.reason ?? null : tableRights2.why("schema");
8999
+ const mayShape = onEntity ? entityRights.data?.may_declare === true : tableRights2.structure;
9000
+ const whyNot = onEntity ? entityRights.data?.reason ?? null : tableRights2.why("structure");
9005
9001
  const storeLabel = onEntity ? entityRights.data?.label ?? null : table.data?.name ?? null;
9006
9002
  const tableLabel = props.tableLabel ?? storeLabel;
9007
9003
  const offered = onEntity ? STANDARD_TABLE_FIELD_CHOICES : FIELD_TYPE_CHOICES;
@@ -15933,7 +15929,7 @@ function useMergedGridControls(args) {
15933
15929
  [notify]
15934
15930
  );
15935
15931
  const ctx = (0, import_react90.useMemo)(() => {
15936
- const mayStructure = rights.schema && editable;
15932
+ const mayStructure = rights.structure && editable;
15937
15933
  const summaries = args.summaries;
15938
15934
  const firstKey = fieldKeys[0];
15939
15935
  return {
@@ -15962,7 +15958,7 @@ function useMergedGridControls(args) {
15962
15958
  id: "col-duplicate",
15963
15959
  label: "Duplicate property",
15964
15960
  icon: "copy-plus",
15965
- disabledReason: mayStructure ? void 0 : editable ? rights.why("schema") : "Editing is off here.",
15961
+ disabledReason: mayStructure ? void 0 : editable ? rights.why("structure") : "Editing is off here.",
15966
15962
  // DUPLICATE PROPERTY (Notion N5): one door declares the copy right after this column and copies
15967
15963
  // every record's value into it (`custom.field_duplicate`); nothing to fill in, as in Notion.
15968
15964
  onSelect: () => {
@@ -15999,14 +15995,14 @@ function useMergedGridControls(args) {
15999
15995
  id: "table-row-label",
16000
15996
  label: "What names each record\u2026",
16001
15997
  icon: "tag",
16002
- disabledReason: mayStructure ? void 0 : editable ? rights.why("schema") : "Editing is off here.",
15998
+ disabledReason: mayStructure ? void 0 : editable ? rights.why("structure") : "Editing is off here.",
16003
15999
  onSelect: () => setLabelling(true)
16004
16000
  },
16005
16001
  {
16006
16002
  id: "table-row-actions",
16007
16003
  label: ROW_ACTIONS_MENU_LABEL,
16008
16004
  icon: "zap",
16009
- disabledReason: mayStructure ? void 0 : editable ? rights.why("schema") : "Editing is off here.",
16005
+ disabledReason: mayStructure ? void 0 : editable ? rights.why("structure") : "Editing is off here.",
16010
16006
  onSelect: () => setRowActionsOpen(true)
16011
16007
  },
16012
16008
  // CLEAN THE WHOLE TABLE AT ONCE (the Sheet's CellCleanupButton): every text column, one review.
@@ -16036,7 +16032,7 @@ function useMergedGridControls(args) {
16036
16032
  mayAddRecord: editable && rights.write,
16037
16033
  whyNotAdd: editable ? rights.why("write") : "Editing is off here.",
16038
16034
  mayStructure,
16039
- whyNotStructure: editable ? rights.why("schema") : "Editing is off here.",
16035
+ whyNotStructure: editable ? rights.why("structure") : "Editing is off here.",
16040
16036
  cleanable: (field2) => isTextColumn(field2),
16041
16037
  typeable: (columnId2) => {
16042
16038
  const field2 = fields.find((f) => f.key === columnId2);
@@ -16116,7 +16112,7 @@ function useMergedGridControls(args) {
16116
16112
  if (href) copyText16(new URL(href, window.location.origin).toString(), "The link");
16117
16113
  }
16118
16114
  } : {},
16119
- ...editable && rights.schema ? {
16115
+ ...editable && rights.structure ? {
16120
16116
  saveAsTemplate: (rowId) => {
16121
16117
  const row = rows.find((r) => r.id === rowId);
16122
16118
  if (row) setDialog({ kind: "template", row });
@@ -24697,7 +24693,7 @@ function GridBody({
24697
24693
  const offersRowActions = !embedded && (canWrite || Boolean(host.talkToRecord) || Boolean(!readOnly && host.runAgentAction && tableActions2.agent.length > 0));
24698
24694
  const hasTalk = Boolean(host.talkToRecord);
24699
24695
  const hasAgent = Boolean(host.runAgentAction);
24700
- const mayManageActions = !readOnly && rights.schema;
24696
+ const mayManageActions = !readOnly && rights.structure;
24701
24697
  const actionsHeader = (0, import_react127.useMemo)(
24702
24698
  () => /* @__PURE__ */ (0, import_jsx_runtime77.jsx)(ActionsHeaderControls, { ...mayManageActions ? { onAddColumn: () => addColumnNow.current() } : {} }),
24703
24699
  [mayManageActions]
@@ -24780,9 +24776,9 @@ function GridBody({
24780
24776
  (key) => holdByContent(headerHeld.current, `filter:${key}`, filterFor(key))
24781
24777
  );
24782
24778
  const pinnedPlus = offersRowActions && mayManageActions;
24783
- return merged && rights.schema && !readOnly && !pinnedPlus ? [...drawn, addColumnDef] : drawn;
24779
+ return merged && rights.structure && !readOnly && !pinnedPlus ? [...drawn, addColumnDef] : drawn;
24784
24780
  },
24785
- [bodyColumns, controls.headerMenuFor, controls.filterFor, merged, rights.schema, readOnly, addColumnDef, offersRowActions, mayManageActions]
24781
+ [bodyColumns, controls.headerMenuFor, controls.filterFor, merged, rights.structure, readOnly, addColumnDef, offersRowActions, mayManageActions]
24786
24782
  );
24787
24783
  const columnsHeld = (0, import_react127.useRef)(null);
24788
24784
  const columns = columnsHeld.current !== null && sameColumns(columnsHeld.current, drawnColumns) ? columnsHeld.current : drawnColumns;
@@ -25080,7 +25076,7 @@ function GridBody({
25080
25076
  }
25081
25077
  ) : null,
25082
25078
  viewId && viewOrder?.onPlaced && hasSeveralRows ? /* @__PURE__ */ (0, import_jsx_runtime77.jsx)(import_design_system65.Button, { size: "sm", variant: "ghost", onClick: () => setReordering(true), "data-records-reorder-open": "", children: "Reorder" }) : null,
25083
- !readOnly && rights.schema && onAddField ? /* @__PURE__ */ (0, import_jsx_runtime77.jsx)(AddFieldButton, { onClick: onAddField }) : null,
25079
+ !readOnly && rights.structure && onAddField ? /* @__PURE__ */ (0, import_jsx_runtime77.jsx)(AddFieldButton, { onClick: onAddField }) : null,
25084
25080
  embedded ? null : /* @__PURE__ */ (0, import_jsx_runtime77.jsx)(
25085
25081
  GridLayoutMenu,
25086
25082
  {
@@ -25397,7 +25393,7 @@ function GridBody({
25397
25393
  className: "flex flex-col items-start gap-2 rounded-md border border-dashed p-6",
25398
25394
  children: [
25399
25395
  /* @__PURE__ */ (0, import_jsx_runtime77.jsx)("p", { className: "text-sm font-medium", children: NO_COLUMNS_YET }),
25400
- rights.schema && onAddField ? /* @__PURE__ */ (0, import_jsx_runtime77.jsx)(import_design_system65.Button, { size: "sm", onClick: onAddField, children: "Add your first column" }) : /* @__PURE__ */ (0, import_jsx_runtime77.jsx)("p", { className: "max-w-prose text-xs text-muted-foreground", children: rights.why("schema") })
25396
+ rights.structure && onAddField ? /* @__PURE__ */ (0, import_jsx_runtime77.jsx)(import_design_system65.Button, { size: "sm", onClick: onAddField, children: "Add your first column" }) : /* @__PURE__ */ (0, import_jsx_runtime77.jsx)("p", { className: "max-w-prose text-xs text-muted-foreground", children: rights.why("structure") })
25401
25397
  ]
25402
25398
  }
25403
25399
  ) : /* @__PURE__ */ (0, import_jsx_runtime77.jsxs)(import_jsx_runtime77.Fragment, { children: [
@@ -27094,7 +27090,7 @@ var ACTION_NO_ACCESS_REASON = "You don't have access";
27094
27090
  var ACTION_PLATFORM_TABLE_REASON = "Platform tables can't be changed here";
27095
27091
  function rightsReason(rights, what, table) {
27096
27092
  if (!rights.known) return ACTION_CHECKING_ACCESS_REASON;
27097
- if ((what === "structure" || what === "schema") && table?.is_kernel) return ACTION_PLATFORM_TABLE_REASON;
27093
+ if (what === "structure" && table?.is_kernel) return ACTION_PLATFORM_TABLE_REASON;
27098
27094
  if (rights[what]) return null;
27099
27095
  if (rights.level === null) return ACTION_NO_ACCESS_REASON;
27100
27096
  return `Needs ${LEVEL_WORD[levelNeededFor(what)]} access`;
@@ -27190,7 +27186,7 @@ function tableActions(input) {
27190
27186
  action({ id: "share", label: "Share\u2026", icon: "share-2", group: "share", verb: "share" }, "share", input, bind(host.share, table)),
27191
27187
  action({ id: "export", label: "Export\u2026", icon: "download", group: "share", verb: "export" }, "read", input, bind(host.export, table)),
27192
27188
  action({ id: "import", label: "Import\u2026", icon: "upload", group: "share", verb: "import" }, "structure", input, bind(host.import, table)),
27193
- action({ id: "add-column", label: ADD_FIELD_OPEN_LABEL, icon: "columns-3", group: "manage", rank: 1 }, "schema", input, bind(host.addColumn, table)),
27189
+ action({ id: "add-column", label: ADD_FIELD_OPEN_LABEL, icon: "columns-3", group: "manage", rank: 1 }, "structure", input, bind(host.addColumn, table)),
27194
27190
  action({ id: "settings", label: "Settings", icon: "settings", group: "manage", verb: "settings" }, "structure", input, bind(host.settings, table)),
27195
27191
  action({ id: "history", label: "History", icon: "history", group: "manage", verb: "history" }, "read", input, bind(host.history, table)),
27196
27192
  // custom.view_designate asks editor on the table — `canDesignate` in TablePage.
@@ -29865,6 +29861,26 @@ function TableSettingsPanel({
29865
29861
  if (table.error) return /* @__PURE__ */ (0, import_jsx_runtime99.jsx)(RefusalNotice, { error: table.error, className });
29866
29862
  if (fields.error) return /* @__PURE__ */ (0, import_jsx_runtime99.jsx)(RefusalNotice, { error: fields.error, className });
29867
29863
  if (!rights.structure) {
29864
+ if (tableIsLocked(table.data)) {
29865
+ return /* @__PURE__ */ (0, import_jsx_runtime99.jsxs)("div", { className: (0, import_design_system86.cn)("flex flex-col items-start gap-2 text-xs text-muted-foreground", className), "data-table-locked": "", children: [
29866
+ /* @__PURE__ */ (0, import_jsx_runtime99.jsx)("p", { children: DATABASE_LOCKED_REASON }),
29867
+ /* @__PURE__ */ (0, import_jsx_runtime99.jsx)(
29868
+ import_design_system86.Button,
29869
+ {
29870
+ size: "sm",
29871
+ variant: "outline",
29872
+ onClick: () => {
29873
+ void saveTableLock(client, tableId, false).then((done) => {
29874
+ if (done.ok) table.reload();
29875
+ else ui.notify?.error(done.says);
29876
+ });
29877
+ },
29878
+ "data-table-unlock": "",
29879
+ children: "Unlock database"
29880
+ }
29881
+ )
29882
+ ] });
29883
+ }
29868
29884
  return /* @__PURE__ */ (0, import_jsx_runtime99.jsx)("p", { className: (0, import_design_system86.cn)("text-xs text-muted-foreground", className), children: rights.why("structure") });
29869
29885
  }
29870
29886
  const rows = [...fields.data ?? []].sort((a, b) => (a.sort ?? 0) - (b.sort ?? 0));
@@ -29964,26 +29980,8 @@ function TableSettingsPanel({
29964
29980
  /* @__PURE__ */ (0, import_jsx_runtime99.jsxs)("div", { className: "flex items-center gap-2", children: [
29965
29981
  /* @__PURE__ */ (0, import_jsx_runtime99.jsx)("span", { className: "font-medium", children: "Fields" }),
29966
29982
  /* @__PURE__ */ (0, import_jsx_runtime99.jsx)("span", { className: "text-muted-foreground", children: rows.length }),
29967
- /* @__PURE__ */ (0, import_jsx_runtime99.jsx)(import_design_system86.Button, { size: "sm", variant: "outline", className: "ml-auto", disabled: !rights.schema, onClick: () => setEditing("new"), children: "Add a field" })
29983
+ /* @__PURE__ */ (0, import_jsx_runtime99.jsx)(import_design_system86.Button, { size: "sm", variant: "outline", className: "ml-auto", onClick: () => setEditing("new"), children: "Add a field" })
29968
29984
  ] }),
29969
- tableIsLocked(table.data) ? /* @__PURE__ */ (0, import_jsx_runtime99.jsxs)("div", { className: "flex flex-wrap items-center gap-2 text-muted-foreground", "data-table-locked": "", children: [
29970
- /* @__PURE__ */ (0, import_jsx_runtime99.jsx)("span", { children: DATABASE_LOCKED_REASON }),
29971
- /* @__PURE__ */ (0, import_jsx_runtime99.jsx)(
29972
- import_design_system86.Button,
29973
- {
29974
- size: "sm",
29975
- variant: "outline",
29976
- onClick: () => {
29977
- void saveTableLock(client, tableId, false).then((done) => {
29978
- if (done.ok) table.reload();
29979
- else ui.notify?.error(done.says);
29980
- });
29981
- },
29982
- "data-table-unlock": "",
29983
- children: "Unlock database"
29984
- }
29985
- )
29986
- ] }) : null,
29987
29985
  shape.error ? /* @__PURE__ */ (0, import_jsx_runtime99.jsx)(RefusalNotice, { error: shape.error }) : null,
29988
29986
  askingToRemove ? /* @__PURE__ */ (0, import_jsx_runtime99.jsxs)("div", { className: "flex flex-wrap items-center gap-2 rounded border border-destructive/40 px-2 py-1.5", children: [
29989
29987
  /* @__PURE__ */ (0, import_jsx_runtime99.jsxs)("span", { className: "text-destructive", children: [
@@ -30002,7 +30000,7 @@ function TableSettingsPanel({
30002
30000
  ),
30003
30001
  /* @__PURE__ */ (0, import_jsx_runtime99.jsx)(import_design_system86.Button, { size: "sm", variant: "ghost", onClick: () => setAskingToRemove(null), children: "Keep it" })
30004
30002
  ] }) : null,
30005
- /* @__PURE__ */ (0, import_jsx_runtime99.jsx)("fieldset", { disabled: !rights.schema, className: "min-w-0 border-0 p-0", "data-columns-locked": rights.schema ? void 0 : "", children: /* @__PURE__ */ (0, import_jsx_runtime99.jsx)(
30003
+ /* @__PURE__ */ (0, import_jsx_runtime99.jsx)(
30006
30004
  ColumnsAtOnce,
30007
30005
  {
30008
30006
  rows,
@@ -30015,7 +30013,7 @@ function TableSettingsPanel({
30015
30013
  table.reload();
30016
30014
  }
30017
30015
  }
30018
- ) }),
30016
+ ),
30019
30017
  /* @__PURE__ */ (0, import_jsx_runtime99.jsx)(import_design_system86.Separator, {}),
30020
30018
  /* @__PURE__ */ (0, import_jsx_runtime99.jsx)(StageRulesSection, { tableId }),
30021
30019
  /* @__PURE__ */ (0, import_jsx_runtime99.jsx)(RowActionsSection, { tableId }),