@ai-matrx/records-ui 0.110.8 → 0.110.9

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,14 @@
1
1
  # Changelog — @ai-matrx/records-ui
2
2
 
3
+ ## 0.110.9
4
+ ### Unreleased
5
+ ### lane spaces-fixes-r39
6
+
7
+ - "Archive record" in the grid's row menu now follows the `remove` rung (`editor`), not `write` (`edit_content`): a content editor, who may change rows but whose archive the store refuses, meets it disabled with the reason.
8
+ - `hideRefusedRowActions` on `Grid` / `ViewSwitcher`: a row action the person's level refuses is left out of the row menu instead of drawn disabled (Spaces sets it).
9
+
10
+ **Consumer action:** none required. A host that wants Notion's "offer only what works" passes `hideRefusedRowActions`.
11
+
3
12
  ## 0.110.8
4
13
 
5
14
  Automatic changed-only republish (docs/metadata drift since the last tag — see
package/dist/index.cjs CHANGED
@@ -2853,15 +2853,18 @@ function rowSection(rowId, ctx, rowText) {
2853
2853
  items.push({ id: "row-history", label: "Row history", icon: "history", onSelect: () => a.openRecord?.(rowId) });
2854
2854
  }
2855
2855
  items.push(...ctx.extras?.row?.(rowId) ?? []);
2856
- items.push({
2857
- id: "row-archive",
2858
- label: "Archive record",
2859
- icon: "trash",
2860
- destructive: true,
2861
- separatorBefore: true,
2862
- disabledReason: mayWrite ? void 0 : ctx.whyNotWrite(rowId),
2863
- onSelect: () => a.archiveRow(rowId)
2864
- });
2856
+ const mayRemove = mayWrite && (ctx.mayRemoveRow ? ctx.mayRemoveRow(rowId) : true);
2857
+ if (mayRemove || !ctx.hideRefusedRowActions) {
2858
+ items.push({
2859
+ id: "row-archive",
2860
+ label: "Archive record",
2861
+ icon: "trash",
2862
+ destructive: true,
2863
+ separatorBefore: true,
2864
+ disabledReason: mayRemove ? void 0 : !mayWrite ? ctx.whyNotWrite(rowId) : ctx.whyNotRemove?.(rowId) ?? ctx.whyNotWrite(rowId),
2865
+ onSelect: () => a.archiveRow(rowId)
2866
+ });
2867
+ }
2865
2868
  return { id: "row", title: ctx.extras?.rowTitle?.(rowId) || "Row", items };
2866
2869
  }
2867
2870
  function columnSection(columnId2, columnLabel2, ctx) {
@@ -16425,6 +16428,9 @@ function useMergedGridControls(args) {
16425
16428
  canWrite,
16426
16429
  mayWriteRow,
16427
16430
  whyNotRow,
16431
+ mayRemoveRow,
16432
+ whyNotRemoveRow,
16433
+ hideRefusedRowActions,
16428
16434
  rights,
16429
16435
  editable,
16430
16436
  presentation,
@@ -16682,6 +16688,9 @@ function useMergedGridControls(args) {
16682
16688
  titleField: table?.title_field ?? null,
16683
16689
  mayWriteRow: (rowId) => canWrite && mayWriteRow(rowId),
16684
16690
  whyNotWrite: (rowId) => !editable ? "Editing is off here." : rowId ? whyNotRow(rowId) : rights.why("write"),
16691
+ mayRemoveRow: (rowId) => canWrite && mayRemoveRow(rowId),
16692
+ whyNotRemove: (rowId) => rowId ? whyNotRemoveRow(rowId) : rights.why("remove"),
16693
+ hideRefusedRowActions,
16685
16694
  mayAddRecord: editable && rights.write,
16686
16695
  whyNotAdd: editable ? rights.why("write") : "Editing is off here.",
16687
16696
  mayStructure,
@@ -23929,7 +23938,8 @@ function GridBody({
23929
23938
  sortOverride,
23930
23939
  searchOverride,
23931
23940
  onSearchChange,
23932
- searchBox = true
23941
+ searchBox = true,
23942
+ hideRefusedRowActions = false
23933
23943
  }) {
23934
23944
  const toolbarSlot = useTableToolbarSlot();
23935
23945
  const tableCard = (0, import_data_table13.useMatrxTableCard)();
@@ -24168,6 +24178,14 @@ function GridBody({
24168
24178
  (rowId) => askPerRow ? rowRights(rowId)?.write ?? false : rights.write,
24169
24179
  [askPerRow, rowRights, rights.write]
24170
24180
  );
24181
+ const mayRemoveRow = (0, import_react123.useCallback)(
24182
+ (rowId) => askPerRow ? rowRights(rowId)?.remove ?? false : rights.remove,
24183
+ [askPerRow, rowRights, rights.remove]
24184
+ );
24185
+ const whyNotRemoveRow = (0, import_react123.useCallback)(
24186
+ (rowId) => askPerRow ? rowRights(rowId)?.why("remove") ?? rights.why("remove") : rights.why("remove"),
24187
+ [askPerRow, rowRights, rights]
24188
+ );
24171
24189
  const whyNotRow = (0, import_react123.useCallback)(
24172
24190
  (rowId) => askPerRow ? rowRights(rowId)?.why("write") ?? rights.why("write") : rights.why("write"),
24173
24191
  [askPerRow, rowRights, rights]
@@ -24838,6 +24856,9 @@ function GridBody({
24838
24856
  canWrite,
24839
24857
  mayWriteRow,
24840
24858
  whyNotRow,
24859
+ mayRemoveRow,
24860
+ whyNotRemoveRow,
24861
+ hideRefusedRowActions,
24841
24862
  rights,
24842
24863
  editable: Boolean(editable),
24843
24864
  readOnly,
@@ -34360,6 +34381,7 @@ function ViewSwitcher({
34360
34381
  searchOverride,
34361
34382
  onSearchChange,
34362
34383
  searchBox,
34384
+ hideRefusedRowActions,
34363
34385
  newRowLabel,
34364
34386
  className
34365
34387
  }) {
@@ -34405,6 +34427,7 @@ function ViewSwitcher({
34405
34427
  ...searchOverride !== void 0 ? { searchOverride } : {},
34406
34428
  ...onSearchChange ? { onSearchChange } : {},
34407
34429
  ...searchBox === false ? { searchBox } : {},
34430
+ ...hideRefusedRowActions ? { hideRefusedRowActions } : {},
34408
34431
  ...newRowLabel ? { newRowLabel } : {},
34409
34432
  ...filter ? { filter } : {},
34410
34433
  ...onClearFilter ? { onClearFilter } : {},