@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/dist/index.d.cts CHANGED
@@ -3,8 +3,8 @@ import { ReactNode, KeyboardEvent, ReactElement, ComponentType, RefObject, SVGAt
3
3
  import * as _ai_matrx_records from '@ai-matrx/records';
4
4
  import { Uuid, RowAction, Field, RowActionStep, RecordScopeContext, EnrichCell, RecordsError, RecordDocument, Table, ReadRow, RecordRead, RowAgentTarget, AggregateFilter, PermissionLevel, RelationDisplay, WriteConflict, TableDecorations, StoreFilter as StoreFilter$1, ImportRun, DeclarableFieldKind, NewerFieldKind, ParityFieldType, NewFieldDeclaration, RuleExpression, ChoiceRehome, FieldOptionEdit, StoredRecord, ChoiceNudge, HiddenFieldNotice, ValueEnvelope, ChecklistRequirementKind, ContextPolicy, WorkDueState, FieldSensitivity, StageRuleOnFail, SubscriptionCadence, WorkApprovalState, WorkInboxKind, FieldKind, ArchiveLane, ArchivedRow, WorkInboxView, WorkInboxItem, PortalCard, PortalPrincipal, PortalPreviewRow, PortalAccent, PublicPicture, PortalStyle, RecordFilter, MySubscription, DashboardBlockKind, AggregateBucket, AggregateMeasure, AggregateCompare, DashboardTarget, DashboardBlock, DashboardSummary, AggregateGroupValue, DocTemplateRow, DocRenderRow, QuietHours, DashboardBlockResult, ChecklistRunStep, BookingSummary, CaptureSheetFace, CaptureField, AnonTokenBinding, RecordsConfig, RecordsActor, RecordsDataSource, TableDuplicated, HistoryActor, FieldHistoryEntry, DrillDefinition, DrillSource, DrillLane, DrillQuestion, TableDuplicateProgress, TableArchiveProgress } from '@ai-matrx/records';
5
5
  import { ReversibleAnnouncement } from '@ai-matrx/kit/reversible';
6
- import { O as ObjectAction, W as WhatYouMayDo, T as TableActionHost, a as ObjectActionIcon } from './objectActions-BjZ_Vq5d.cjs';
7
- export { A as ACTION_CHECKING_ACCESS_REASON, b as ACTION_NOT_HERE_REASON, c as ACTION_NO_ACCESS_REASON, d as ACTION_PLATFORM_TABLE_REASON, B as BuiltOnDestination, C as Capability, D as DEFAULT_ACTION_ORIGIN, K as KERNEL_REASON, L as LEVEL_WORD, N as NOT_ANSWERED_YET, e as OBJECT_ACTION_GROUPS, f as ObjectActionDropdownEntry, g as ObjectActionGroup, h as ObjectActionGroupDef, i as ObjectActionSection, S as STANDARD_VERBS, j as STRIP_FEATURE_ROWS, k as StandardVerbId, l as StripAndRows, m as TableActionSubject, n as TableActionsInput, o as dropdownActionIds, p as dropdownActions, q as groupObjectActions, r as levelNeededFor, s as rightsReason, t as tableActions, u as tableLink, v as toDropdownEntries, w as toStripAndRows, x as whatYouMayDo, y as whatYouMayDoWithTable, z as withExtensions } from './objectActions-BjZ_Vq5d.cjs';
6
+ import { O as ObjectAction, W as WhatYouMayDo, T as TableActionHost, a as ObjectActionIcon } from './objectActions-CV8VEz58.cjs';
7
+ export { A as ACTION_CHECKING_ACCESS_REASON, b as ACTION_NOT_HERE_REASON, c as ACTION_NO_ACCESS_REASON, d as ACTION_PLATFORM_TABLE_REASON, B as BuiltOnDestination, C as Capability, D as DEFAULT_ACTION_ORIGIN, K as KERNEL_REASON, L as LEVEL_WORD, N as NOT_ANSWERED_YET, e as OBJECT_ACTION_GROUPS, f as ObjectActionDropdownEntry, g as ObjectActionGroup, h as ObjectActionGroupDef, i as ObjectActionSection, S as STANDARD_VERBS, j as STRIP_FEATURE_ROWS, k as StandardVerbId, l as StripAndRows, m as TableActionSubject, n as TableActionsInput, o as dropdownActionIds, p as dropdownActions, q as groupObjectActions, r as levelNeededFor, s as rightsReason, t as tableActions, u as tableLink, v as toDropdownEntries, w as toStripAndRows, x as whatYouMayDo, y as whatYouMayDoWithTable, z as withExtensions } from './objectActions-CV8VEz58.cjs';
8
8
  import { Uuid as Uuid$1, Table as Table$1, Field as Field$1, ReadRow as ReadRow$1, StoreFilter, useRecordsClient } from '@ai-matrx/records/react';
9
9
  import * as _ai_matrx_records_core from '@ai-matrx/records/core';
10
10
  import { RecordsClient, ParsedImport, NewFieldSpec } from '@ai-matrx/records/core';
package/dist/index.d.ts CHANGED
@@ -3,8 +3,8 @@ import { ReactNode, KeyboardEvent, ReactElement, ComponentType, RefObject, SVGAt
3
3
  import * as _ai_matrx_records from '@ai-matrx/records';
4
4
  import { Uuid, RowAction, Field, RowActionStep, RecordScopeContext, EnrichCell, RecordsError, RecordDocument, Table, ReadRow, RecordRead, RowAgentTarget, AggregateFilter, PermissionLevel, RelationDisplay, WriteConflict, TableDecorations, StoreFilter as StoreFilter$1, ImportRun, DeclarableFieldKind, NewerFieldKind, ParityFieldType, NewFieldDeclaration, RuleExpression, ChoiceRehome, FieldOptionEdit, StoredRecord, ChoiceNudge, HiddenFieldNotice, ValueEnvelope, ChecklistRequirementKind, ContextPolicy, WorkDueState, FieldSensitivity, StageRuleOnFail, SubscriptionCadence, WorkApprovalState, WorkInboxKind, FieldKind, ArchiveLane, ArchivedRow, WorkInboxView, WorkInboxItem, PortalCard, PortalPrincipal, PortalPreviewRow, PortalAccent, PublicPicture, PortalStyle, RecordFilter, MySubscription, DashboardBlockKind, AggregateBucket, AggregateMeasure, AggregateCompare, DashboardTarget, DashboardBlock, DashboardSummary, AggregateGroupValue, DocTemplateRow, DocRenderRow, QuietHours, DashboardBlockResult, ChecklistRunStep, BookingSummary, CaptureSheetFace, CaptureField, AnonTokenBinding, RecordsConfig, RecordsActor, RecordsDataSource, TableDuplicated, HistoryActor, FieldHistoryEntry, DrillDefinition, DrillSource, DrillLane, DrillQuestion, TableDuplicateProgress, TableArchiveProgress } from '@ai-matrx/records';
5
5
  import { ReversibleAnnouncement } from '@ai-matrx/kit/reversible';
6
- import { O as ObjectAction, W as WhatYouMayDo, T as TableActionHost, a as ObjectActionIcon } from './objectActions-BjZ_Vq5d.js';
7
- export { A as ACTION_CHECKING_ACCESS_REASON, b as ACTION_NOT_HERE_REASON, c as ACTION_NO_ACCESS_REASON, d as ACTION_PLATFORM_TABLE_REASON, B as BuiltOnDestination, C as Capability, D as DEFAULT_ACTION_ORIGIN, K as KERNEL_REASON, L as LEVEL_WORD, N as NOT_ANSWERED_YET, e as OBJECT_ACTION_GROUPS, f as ObjectActionDropdownEntry, g as ObjectActionGroup, h as ObjectActionGroupDef, i as ObjectActionSection, S as STANDARD_VERBS, j as STRIP_FEATURE_ROWS, k as StandardVerbId, l as StripAndRows, m as TableActionSubject, n as TableActionsInput, o as dropdownActionIds, p as dropdownActions, q as groupObjectActions, r as levelNeededFor, s as rightsReason, t as tableActions, u as tableLink, v as toDropdownEntries, w as toStripAndRows, x as whatYouMayDo, y as whatYouMayDoWithTable, z as withExtensions } from './objectActions-BjZ_Vq5d.js';
6
+ import { O as ObjectAction, W as WhatYouMayDo, T as TableActionHost, a as ObjectActionIcon } from './objectActions-CV8VEz58.js';
7
+ export { A as ACTION_CHECKING_ACCESS_REASON, b as ACTION_NOT_HERE_REASON, c as ACTION_NO_ACCESS_REASON, d as ACTION_PLATFORM_TABLE_REASON, B as BuiltOnDestination, C as Capability, D as DEFAULT_ACTION_ORIGIN, K as KERNEL_REASON, L as LEVEL_WORD, N as NOT_ANSWERED_YET, e as OBJECT_ACTION_GROUPS, f as ObjectActionDropdownEntry, g as ObjectActionGroup, h as ObjectActionGroupDef, i as ObjectActionSection, S as STANDARD_VERBS, j as STRIP_FEATURE_ROWS, k as StandardVerbId, l as StripAndRows, m as TableActionSubject, n as TableActionsInput, o as dropdownActionIds, p as dropdownActions, q as groupObjectActions, r as levelNeededFor, s as rightsReason, t as tableActions, u as tableLink, v as toDropdownEntries, w as toStripAndRows, x as whatYouMayDo, y as whatYouMayDoWithTable, z as withExtensions } from './objectActions-CV8VEz58.js';
8
8
  import { Uuid as Uuid$1, Table as Table$1, Field as Field$1, ReadRow as ReadRow$1, StoreFilter, useRecordsClient } from '@ai-matrx/records/react';
9
9
  import * as _ai_matrx_records_core from '@ai-matrx/records/core';
10
10
  import { RecordsClient, ParsedImport, NewFieldSpec } from '@ai-matrx/records/core';
package/dist/index.js CHANGED
@@ -41,9 +41,7 @@ var NEEDS = {
41
41
  // custom.share_grant — passing your access on is an administrator's right
42
42
  share: "admin",
43
43
  // custom.field_declare / field_update / field_retire / table settings
44
- structure: "admin",
45
- // custom.field_declare / field_update / field_retire — the same rung; a lock takes it away, nothing else does
46
- schema: "admin"
44
+ structure: "admin"
47
45
  };
48
46
  function levelNeededFor(what) {
49
47
  return NEEDS[what];
@@ -61,8 +59,7 @@ function sentenceFor(what, level) {
61
59
  organise: "organise this",
62
60
  remove: "delete this",
63
61
  share: "pass this on to somebody else",
64
- structure: "change the columns of this table",
65
- schema: "change the columns of this table"
62
+ structure: "change the columns of this table"
66
63
  };
67
64
  return `You are ${have} here, and it takes ${need} to ${doing[what]}. Ask somebody who is Admin on it to move you up.`;
68
65
  }
@@ -78,7 +75,6 @@ function whatYouMayDo(level, known = true) {
78
75
  remove: may("remove"),
79
76
  share: may("share"),
80
77
  structure: may("structure"),
81
- schema: may("schema"),
82
78
  why: (what) => known ? sentenceFor(what, level) : NOT_YET
83
79
  };
84
80
  }
@@ -90,16 +86,15 @@ function whatYouMayDoWithTable(table, level, known) {
90
86
  return {
91
87
  ...base2,
92
88
  structure: false,
93
- schema: false,
94
- why: (what) => what === "structure" || what === "schema" ? KERNEL_REASON : base2.why(what)
89
+ why: (what) => what === "structure" ? KERNEL_REASON : base2.why(what)
95
90
  };
96
91
  }
97
92
  function tableIsLocked(table) {
98
93
  return table?.metadata?.["locked"] === true;
99
94
  }
100
- var DATABASE_LOCKED_REASON = "This database is locked, so its columns cannot be added, renamed, changed or deleted. Unlock it to change them.";
95
+ var DATABASE_LOCKED_REASON = "This database is locked, so its columns and settings are read-only. Unlock it to change them.";
101
96
  function lockedStructure(base2) {
102
- return { ...base2, schema: false, why: (what) => what === "schema" ? DATABASE_LOCKED_REASON : base2.why(what) };
97
+ return { ...base2, structure: false, why: (what) => what === "structure" ? DATABASE_LOCKED_REASON : base2.why(what) };
103
98
  }
104
99
 
105
100
  // src/host.tsx
@@ -2885,7 +2880,6 @@ function TableDetails({
2885
2880
  tableShapeChanged2(tableId);
2886
2881
  onSaved?.();
2887
2882
  };
2888
- const locked = table.metadata?.["locked"] === true;
2889
2883
  return /* @__PURE__ */ jsxs8("div", { className: "flex flex-col gap-2", "data-table-details": "", children: [
2890
2884
  /* @__PURE__ */ jsx10("span", { className: "font-medium", children: "About this table" }),
2891
2885
  /* @__PURE__ */ jsxs8("div", { className: "flex flex-col gap-1", children: [
@@ -2939,9 +2933,9 @@ function TableDetails({
2939
2933
  size: "sm",
2940
2934
  variant: "outline",
2941
2935
  disabled: busy,
2942
- onClick: () => void write(lockPatch(table, !locked), { metadata: table.metadata ?? {} }),
2936
+ onClick: () => void write(lockPatch(table, true), { metadata: table.metadata ?? {} }),
2943
2937
  "data-table-lock-on": "",
2944
- children: locked ? "Unlock" : "Lock"
2938
+ children: "Lock"
2945
2939
  }
2946
2940
  )
2947
2941
  ] }),
@@ -6834,8 +6828,10 @@ var RELATIVE_DAY_TERMS = [
6834
6828
  { kind: "past_days", label: "is in the past \u2026 days", takesDays: true }
6835
6829
  ];
6836
6830
  function relativeDayNode(fieldId, kind, days) {
6831
+ const zone2 = getPersonTimeZone();
6837
6832
  const window2 = { relative: kind };
6838
6833
  if (RELATIVE_DAY_TERMS.find((t) => t.kind === kind)?.takesDays) window2["n"] = days ?? 7;
6834
+ if (zone2) window2["tz"] = zone2;
6839
6835
  return { op: "within", args: [{ field: fieldId }, { const: window2 }] };
6840
6836
  }
6841
6837
  function relativeDayOf(expr) {
@@ -8505,8 +8501,8 @@ function FieldEditor(props) {
8505
8501
  const entityMutation = useEntityFieldMutation();
8506
8502
  const mutation = onEntity ? { saving: entityMutation.saving, error: entityMutation.error } : { saving: tableMutation.saving, error: tableMutation.error };
8507
8503
  const client = useRecordsClient11();
8508
- const mayShape = onEntity ? entityRights.data?.may_declare === true : tableRights2.schema;
8509
- const whyNot = onEntity ? entityRights.data?.reason ?? null : tableRights2.why("schema");
8504
+ const mayShape = onEntity ? entityRights.data?.may_declare === true : tableRights2.structure;
8505
+ const whyNot = onEntity ? entityRights.data?.reason ?? null : tableRights2.why("structure");
8510
8506
  const storeLabel = onEntity ? entityRights.data?.label ?? null : table.data?.name ?? null;
8511
8507
  const tableLabel = props.tableLabel ?? storeLabel;
8512
8508
  const offered = onEntity ? STANDARD_TABLE_FIELD_CHOICES : FIELD_TYPE_CHOICES;
@@ -15540,7 +15536,7 @@ function useMergedGridControls(args) {
15540
15536
  [notify]
15541
15537
  );
15542
15538
  const ctx = useMemo21(() => {
15543
- const mayStructure = rights.schema && editable;
15539
+ const mayStructure = rights.structure && editable;
15544
15540
  const summaries = args.summaries;
15545
15541
  const firstKey = fieldKeys[0];
15546
15542
  return {
@@ -15569,7 +15565,7 @@ function useMergedGridControls(args) {
15569
15565
  id: "col-duplicate",
15570
15566
  label: "Duplicate property",
15571
15567
  icon: "copy-plus",
15572
- disabledReason: mayStructure ? void 0 : editable ? rights.why("schema") : "Editing is off here.",
15568
+ disabledReason: mayStructure ? void 0 : editable ? rights.why("structure") : "Editing is off here.",
15573
15569
  // DUPLICATE PROPERTY (Notion N5): one door declares the copy right after this column and copies
15574
15570
  // every record's value into it (`custom.field_duplicate`); nothing to fill in, as in Notion.
15575
15571
  onSelect: () => {
@@ -15606,14 +15602,14 @@ function useMergedGridControls(args) {
15606
15602
  id: "table-row-label",
15607
15603
  label: "What names each record\u2026",
15608
15604
  icon: "tag",
15609
- disabledReason: mayStructure ? void 0 : editable ? rights.why("schema") : "Editing is off here.",
15605
+ disabledReason: mayStructure ? void 0 : editable ? rights.why("structure") : "Editing is off here.",
15610
15606
  onSelect: () => setLabelling(true)
15611
15607
  },
15612
15608
  {
15613
15609
  id: "table-row-actions",
15614
15610
  label: ROW_ACTIONS_MENU_LABEL,
15615
15611
  icon: "zap",
15616
- disabledReason: mayStructure ? void 0 : editable ? rights.why("schema") : "Editing is off here.",
15612
+ disabledReason: mayStructure ? void 0 : editable ? rights.why("structure") : "Editing is off here.",
15617
15613
  onSelect: () => setRowActionsOpen(true)
15618
15614
  },
15619
15615
  // CLEAN THE WHOLE TABLE AT ONCE (the Sheet's CellCleanupButton): every text column, one review.
@@ -15643,7 +15639,7 @@ function useMergedGridControls(args) {
15643
15639
  mayAddRecord: editable && rights.write,
15644
15640
  whyNotAdd: editable ? rights.why("write") : "Editing is off here.",
15645
15641
  mayStructure,
15646
- whyNotStructure: editable ? rights.why("schema") : "Editing is off here.",
15642
+ whyNotStructure: editable ? rights.why("structure") : "Editing is off here.",
15647
15643
  cleanable: (field2) => isTextColumn(field2),
15648
15644
  typeable: (columnId2) => {
15649
15645
  const field2 = fields.find((f) => f.key === columnId2);
@@ -15723,7 +15719,7 @@ function useMergedGridControls(args) {
15723
15719
  if (href) copyText16(new URL(href, window.location.origin).toString(), "The link");
15724
15720
  }
15725
15721
  } : {},
15726
- ...editable && rights.schema ? {
15722
+ ...editable && rights.structure ? {
15727
15723
  saveAsTemplate: (rowId) => {
15728
15724
  const row = rows.find((r) => r.id === rowId);
15729
15725
  if (row) setDialog({ kind: "template", row });
@@ -24411,7 +24407,7 @@ function GridBody({
24411
24407
  const offersRowActions = !embedded && (canWrite || Boolean(host.talkToRecord) || Boolean(!readOnly && host.runAgentAction && tableActions2.agent.length > 0));
24412
24408
  const hasTalk = Boolean(host.talkToRecord);
24413
24409
  const hasAgent = Boolean(host.runAgentAction);
24414
- const mayManageActions = !readOnly && rights.schema;
24410
+ const mayManageActions = !readOnly && rights.structure;
24415
24411
  const actionsHeader = useMemo35(
24416
24412
  () => /* @__PURE__ */ jsx77(ActionsHeaderControls, { ...mayManageActions ? { onAddColumn: () => addColumnNow.current() } : {} }),
24417
24413
  [mayManageActions]
@@ -24494,9 +24490,9 @@ function GridBody({
24494
24490
  (key) => holdByContent(headerHeld.current, `filter:${key}`, filterFor(key))
24495
24491
  );
24496
24492
  const pinnedPlus = offersRowActions && mayManageActions;
24497
- return merged && rights.schema && !readOnly && !pinnedPlus ? [...drawn, addColumnDef] : drawn;
24493
+ return merged && rights.structure && !readOnly && !pinnedPlus ? [...drawn, addColumnDef] : drawn;
24498
24494
  },
24499
- [bodyColumns, controls.headerMenuFor, controls.filterFor, merged, rights.schema, readOnly, addColumnDef, offersRowActions, mayManageActions]
24495
+ [bodyColumns, controls.headerMenuFor, controls.filterFor, merged, rights.structure, readOnly, addColumnDef, offersRowActions, mayManageActions]
24500
24496
  );
24501
24497
  const columnsHeld = useRef36(null);
24502
24498
  const columns = columnsHeld.current !== null && sameColumns(columnsHeld.current, drawnColumns) ? columnsHeld.current : drawnColumns;
@@ -24794,7 +24790,7 @@ function GridBody({
24794
24790
  }
24795
24791
  ) : null,
24796
24792
  viewId && viewOrder?.onPlaced && hasSeveralRows ? /* @__PURE__ */ jsx77(Button44, { size: "sm", variant: "ghost", onClick: () => setReordering(true), "data-records-reorder-open": "", children: "Reorder" }) : null,
24797
- !readOnly && rights.schema && onAddField ? /* @__PURE__ */ jsx77(AddFieldButton, { onClick: onAddField }) : null,
24793
+ !readOnly && rights.structure && onAddField ? /* @__PURE__ */ jsx77(AddFieldButton, { onClick: onAddField }) : null,
24798
24794
  embedded ? null : /* @__PURE__ */ jsx77(
24799
24795
  GridLayoutMenu,
24800
24796
  {
@@ -25111,7 +25107,7 @@ function GridBody({
25111
25107
  className: "flex flex-col items-start gap-2 rounded-md border border-dashed p-6",
25112
25108
  children: [
25113
25109
  /* @__PURE__ */ jsx77("p", { className: "text-sm font-medium", children: NO_COLUMNS_YET }),
25114
- rights.schema && onAddField ? /* @__PURE__ */ jsx77(Button44, { size: "sm", onClick: onAddField, children: "Add your first column" }) : /* @__PURE__ */ jsx77("p", { className: "max-w-prose text-xs text-muted-foreground", children: rights.why("schema") })
25110
+ rights.structure && onAddField ? /* @__PURE__ */ jsx77(Button44, { size: "sm", onClick: onAddField, children: "Add your first column" }) : /* @__PURE__ */ jsx77("p", { className: "max-w-prose text-xs text-muted-foreground", children: rights.why("structure") })
25115
25111
  ]
25116
25112
  }
25117
25113
  ) : /* @__PURE__ */ jsxs70(Fragment26, { children: [
@@ -26843,7 +26839,7 @@ var ACTION_NO_ACCESS_REASON = "You don't have access";
26843
26839
  var ACTION_PLATFORM_TABLE_REASON = "Platform tables can't be changed here";
26844
26840
  function rightsReason(rights, what, table) {
26845
26841
  if (!rights.known) return ACTION_CHECKING_ACCESS_REASON;
26846
- if ((what === "structure" || what === "schema") && table?.is_kernel) return ACTION_PLATFORM_TABLE_REASON;
26842
+ if (what === "structure" && table?.is_kernel) return ACTION_PLATFORM_TABLE_REASON;
26847
26843
  if (rights[what]) return null;
26848
26844
  if (rights.level === null) return ACTION_NO_ACCESS_REASON;
26849
26845
  return `Needs ${LEVEL_WORD[levelNeededFor(what)]} access`;
@@ -26939,7 +26935,7 @@ function tableActions(input) {
26939
26935
  action({ id: "share", label: "Share\u2026", icon: "share-2", group: "share", verb: "share" }, "share", input, bind(host.share, table)),
26940
26936
  action({ id: "export", label: "Export\u2026", icon: "download", group: "share", verb: "export" }, "read", input, bind(host.export, table)),
26941
26937
  action({ id: "import", label: "Import\u2026", icon: "upload", group: "share", verb: "import" }, "structure", input, bind(host.import, table)),
26942
- action({ id: "add-column", label: ADD_FIELD_OPEN_LABEL, icon: "columns-3", group: "manage", rank: 1 }, "schema", input, bind(host.addColumn, table)),
26938
+ action({ id: "add-column", label: ADD_FIELD_OPEN_LABEL, icon: "columns-3", group: "manage", rank: 1 }, "structure", input, bind(host.addColumn, table)),
26943
26939
  action({ id: "settings", label: "Settings", icon: "settings", group: "manage", verb: "settings" }, "structure", input, bind(host.settings, table)),
26944
26940
  action({ id: "history", label: "History", icon: "history", group: "manage", verb: "history" }, "read", input, bind(host.history, table)),
26945
26941
  // custom.view_designate asks editor on the table — `canDesignate` in TablePage.
@@ -29642,6 +29638,26 @@ function TableSettingsPanel({
29642
29638
  if (table.error) return /* @__PURE__ */ jsx99(RefusalNotice, { error: table.error, className });
29643
29639
  if (fields.error) return /* @__PURE__ */ jsx99(RefusalNotice, { error: fields.error, className });
29644
29640
  if (!rights.structure) {
29641
+ if (tableIsLocked(table.data)) {
29642
+ return /* @__PURE__ */ jsxs90("div", { className: cn50("flex flex-col items-start gap-2 text-xs text-muted-foreground", className), "data-table-locked": "", children: [
29643
+ /* @__PURE__ */ jsx99("p", { children: DATABASE_LOCKED_REASON }),
29644
+ /* @__PURE__ */ jsx99(
29645
+ Button61,
29646
+ {
29647
+ size: "sm",
29648
+ variant: "outline",
29649
+ onClick: () => {
29650
+ void saveTableLock(client, tableId, false).then((done) => {
29651
+ if (done.ok) table.reload();
29652
+ else ui.notify?.error(done.says);
29653
+ });
29654
+ },
29655
+ "data-table-unlock": "",
29656
+ children: "Unlock database"
29657
+ }
29658
+ )
29659
+ ] });
29660
+ }
29645
29661
  return /* @__PURE__ */ jsx99("p", { className: cn50("text-xs text-muted-foreground", className), children: rights.why("structure") });
29646
29662
  }
29647
29663
  const rows = [...fields.data ?? []].sort((a, b) => (a.sort ?? 0) - (b.sort ?? 0));
@@ -29741,26 +29757,8 @@ function TableSettingsPanel({
29741
29757
  /* @__PURE__ */ jsxs90("div", { className: "flex items-center gap-2", children: [
29742
29758
  /* @__PURE__ */ jsx99("span", { className: "font-medium", children: "Fields" }),
29743
29759
  /* @__PURE__ */ jsx99("span", { className: "text-muted-foreground", children: rows.length }),
29744
- /* @__PURE__ */ jsx99(Button61, { size: "sm", variant: "outline", className: "ml-auto", disabled: !rights.schema, onClick: () => setEditing("new"), children: "Add a field" })
29760
+ /* @__PURE__ */ jsx99(Button61, { size: "sm", variant: "outline", className: "ml-auto", onClick: () => setEditing("new"), children: "Add a field" })
29745
29761
  ] }),
29746
- tableIsLocked(table.data) ? /* @__PURE__ */ jsxs90("div", { className: "flex flex-wrap items-center gap-2 text-muted-foreground", "data-table-locked": "", children: [
29747
- /* @__PURE__ */ jsx99("span", { children: DATABASE_LOCKED_REASON }),
29748
- /* @__PURE__ */ jsx99(
29749
- Button61,
29750
- {
29751
- size: "sm",
29752
- variant: "outline",
29753
- onClick: () => {
29754
- void saveTableLock(client, tableId, false).then((done) => {
29755
- if (done.ok) table.reload();
29756
- else ui.notify?.error(done.says);
29757
- });
29758
- },
29759
- "data-table-unlock": "",
29760
- children: "Unlock database"
29761
- }
29762
- )
29763
- ] }) : null,
29764
29762
  shape.error ? /* @__PURE__ */ jsx99(RefusalNotice, { error: shape.error }) : null,
29765
29763
  askingToRemove ? /* @__PURE__ */ jsxs90("div", { className: "flex flex-wrap items-center gap-2 rounded border border-destructive/40 px-2 py-1.5", children: [
29766
29764
  /* @__PURE__ */ jsxs90("span", { className: "text-destructive", children: [
@@ -29779,7 +29777,7 @@ function TableSettingsPanel({
29779
29777
  ),
29780
29778
  /* @__PURE__ */ jsx99(Button61, { size: "sm", variant: "ghost", onClick: () => setAskingToRemove(null), children: "Keep it" })
29781
29779
  ] }) : null,
29782
- /* @__PURE__ */ jsx99("fieldset", { disabled: !rights.schema, className: "min-w-0 border-0 p-0", "data-columns-locked": rights.schema ? void 0 : "", children: /* @__PURE__ */ jsx99(
29780
+ /* @__PURE__ */ jsx99(
29783
29781
  ColumnsAtOnce,
29784
29782
  {
29785
29783
  rows,
@@ -29792,7 +29790,7 @@ function TableSettingsPanel({
29792
29790
  table.reload();
29793
29791
  }
29794
29792
  }
29795
- ) }),
29793
+ ),
29796
29794
  /* @__PURE__ */ jsx99(Separator8, {}),
29797
29795
  /* @__PURE__ */ jsx99(StageRulesSection, { tableId }),
29798
29796
  /* @__PURE__ */ jsx99(RowActionsSection, { tableId }),