@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 +9 -0
- package/dist/index.cjs +33 -10
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +9 -1
- package/dist/index.d.ts +9 -1
- package/dist/index.js +33 -10
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/dist/index.d.cts
CHANGED
|
@@ -2287,6 +2287,12 @@ interface GridProps {
|
|
|
2287
2287
|
* row and hands the term through `searchOverride` (Spaces N-19). Default `true`.
|
|
2288
2288
|
*/
|
|
2289
2289
|
searchBox?: boolean | undefined;
|
|
2290
|
+
/**
|
|
2291
|
+
* `true`: a row action the person's level refuses (Archive record for a content editor, who may
|
|
2292
|
+
* change rows but not delete them) is left out of the row menu instead of drawn disabled with its
|
|
2293
|
+
* reason. Default `false` (disabled, saying why). Spaces sets it: Notion offers only what works.
|
|
2294
|
+
*/
|
|
2295
|
+
hideRefusedRowActions?: boolean | undefined;
|
|
2290
2296
|
/** The new-row line's words ("New page"). Default "Add row". */
|
|
2291
2297
|
newRowLabel?: string | undefined;
|
|
2292
2298
|
/**
|
|
@@ -4044,6 +4050,8 @@ interface ViewSwitcherProps {
|
|
|
4044
4050
|
* row and hands the term through `searchOverride` (Spaces N-19). Default `true`.
|
|
4045
4051
|
*/
|
|
4046
4052
|
searchBox?: boolean | undefined;
|
|
4053
|
+
/** `GridProps.hideRefusedRowActions`. */
|
|
4054
|
+
hideRefusedRowActions?: boolean | undefined;
|
|
4047
4055
|
/** The grid's new-row line words (`GridProps.newRowLabel`). */
|
|
4048
4056
|
newRowLabel?: string | undefined;
|
|
4049
4057
|
className?: string | undefined;
|
|
@@ -4075,7 +4083,7 @@ declare function useViewRecords(view: SavedViewSpec, pageSize?: number, filter?:
|
|
|
4075
4083
|
*/
|
|
4076
4084
|
membership: string;
|
|
4077
4085
|
};
|
|
4078
|
-
declare function ViewSwitcher({ view, onLayoutChange, onViewChange, onOpenRecord, openRecordId, onCloseRecord, onMoved, onNewRecordForm, onAskWhoChanged, pageSize: pageSizeAsked, titleField, filter, onClearFilter, chooser, viewId, onOrderPlaced, footer, embedded, sortOverride, searchOverride, onSearchChange, searchBox, newRowLabel, className, }: ViewSwitcherProps): react.JSX.Element;
|
|
4086
|
+
declare function ViewSwitcher({ view, onLayoutChange, onViewChange, onOpenRecord, openRecordId, onCloseRecord, onMoved, onNewRecordForm, onAskWhoChanged, pageSize: pageSizeAsked, titleField, filter, onClearFilter, chooser, viewId, onOrderPlaced, footer, embedded, sortOverride, searchOverride, onSearchChange, searchBox, hideRefusedRowActions, newRowLabel, className, }: ViewSwitcherProps): react.JSX.Element;
|
|
4079
4087
|
|
|
4080
4088
|
/** The host app's saved zone (IANA). `null` / junk clears it: the device zone applies. */
|
|
4081
4089
|
declare function setPersonTimeZone(next: string | null | undefined): void;
|
package/dist/index.d.ts
CHANGED
|
@@ -2287,6 +2287,12 @@ interface GridProps {
|
|
|
2287
2287
|
* row and hands the term through `searchOverride` (Spaces N-19). Default `true`.
|
|
2288
2288
|
*/
|
|
2289
2289
|
searchBox?: boolean | undefined;
|
|
2290
|
+
/**
|
|
2291
|
+
* `true`: a row action the person's level refuses (Archive record for a content editor, who may
|
|
2292
|
+
* change rows but not delete them) is left out of the row menu instead of drawn disabled with its
|
|
2293
|
+
* reason. Default `false` (disabled, saying why). Spaces sets it: Notion offers only what works.
|
|
2294
|
+
*/
|
|
2295
|
+
hideRefusedRowActions?: boolean | undefined;
|
|
2290
2296
|
/** The new-row line's words ("New page"). Default "Add row". */
|
|
2291
2297
|
newRowLabel?: string | undefined;
|
|
2292
2298
|
/**
|
|
@@ -4044,6 +4050,8 @@ interface ViewSwitcherProps {
|
|
|
4044
4050
|
* row and hands the term through `searchOverride` (Spaces N-19). Default `true`.
|
|
4045
4051
|
*/
|
|
4046
4052
|
searchBox?: boolean | undefined;
|
|
4053
|
+
/** `GridProps.hideRefusedRowActions`. */
|
|
4054
|
+
hideRefusedRowActions?: boolean | undefined;
|
|
4047
4055
|
/** The grid's new-row line words (`GridProps.newRowLabel`). */
|
|
4048
4056
|
newRowLabel?: string | undefined;
|
|
4049
4057
|
className?: string | undefined;
|
|
@@ -4075,7 +4083,7 @@ declare function useViewRecords(view: SavedViewSpec, pageSize?: number, filter?:
|
|
|
4075
4083
|
*/
|
|
4076
4084
|
membership: string;
|
|
4077
4085
|
};
|
|
4078
|
-
declare function ViewSwitcher({ view, onLayoutChange, onViewChange, onOpenRecord, openRecordId, onCloseRecord, onMoved, onNewRecordForm, onAskWhoChanged, pageSize: pageSizeAsked, titleField, filter, onClearFilter, chooser, viewId, onOrderPlaced, footer, embedded, sortOverride, searchOverride, onSearchChange, searchBox, newRowLabel, className, }: ViewSwitcherProps): react.JSX.Element;
|
|
4086
|
+
declare function ViewSwitcher({ view, onLayoutChange, onViewChange, onOpenRecord, openRecordId, onCloseRecord, onMoved, onNewRecordForm, onAskWhoChanged, pageSize: pageSizeAsked, titleField, filter, onClearFilter, chooser, viewId, onOrderPlaced, footer, embedded, sortOverride, searchOverride, onSearchChange, searchBox, hideRefusedRowActions, newRowLabel, className, }: ViewSwitcherProps): react.JSX.Element;
|
|
4079
4087
|
|
|
4080
4088
|
/** The host app's saved zone (IANA). `null` / junk clears it: the device zone applies. */
|
|
4081
4089
|
declare function setPersonTimeZone(next: string | null | undefined): void;
|
package/dist/index.js
CHANGED
|
@@ -2244,15 +2244,18 @@ function rowSection(rowId, ctx, rowText) {
|
|
|
2244
2244
|
items.push({ id: "row-history", label: "Row history", icon: "history", onSelect: () => a.openRecord?.(rowId) });
|
|
2245
2245
|
}
|
|
2246
2246
|
items.push(...ctx.extras?.row?.(rowId) ?? []);
|
|
2247
|
-
|
|
2248
|
-
|
|
2249
|
-
|
|
2250
|
-
|
|
2251
|
-
|
|
2252
|
-
|
|
2253
|
-
|
|
2254
|
-
|
|
2255
|
-
|
|
2247
|
+
const mayRemove = mayWrite && (ctx.mayRemoveRow ? ctx.mayRemoveRow(rowId) : true);
|
|
2248
|
+
if (mayRemove || !ctx.hideRefusedRowActions) {
|
|
2249
|
+
items.push({
|
|
2250
|
+
id: "row-archive",
|
|
2251
|
+
label: "Archive record",
|
|
2252
|
+
icon: "trash",
|
|
2253
|
+
destructive: true,
|
|
2254
|
+
separatorBefore: true,
|
|
2255
|
+
disabledReason: mayRemove ? void 0 : !mayWrite ? ctx.whyNotWrite(rowId) : ctx.whyNotRemove?.(rowId) ?? ctx.whyNotWrite(rowId),
|
|
2256
|
+
onSelect: () => a.archiveRow(rowId)
|
|
2257
|
+
});
|
|
2258
|
+
}
|
|
2256
2259
|
return { id: "row", title: ctx.extras?.rowTitle?.(rowId) || "Row", items };
|
|
2257
2260
|
}
|
|
2258
2261
|
function columnSection(columnId2, columnLabel2, ctx) {
|
|
@@ -16017,6 +16020,9 @@ function useMergedGridControls(args) {
|
|
|
16017
16020
|
canWrite,
|
|
16018
16021
|
mayWriteRow,
|
|
16019
16022
|
whyNotRow,
|
|
16023
|
+
mayRemoveRow,
|
|
16024
|
+
whyNotRemoveRow,
|
|
16025
|
+
hideRefusedRowActions,
|
|
16020
16026
|
rights,
|
|
16021
16027
|
editable,
|
|
16022
16028
|
presentation,
|
|
@@ -16274,6 +16280,9 @@ function useMergedGridControls(args) {
|
|
|
16274
16280
|
titleField: table?.title_field ?? null,
|
|
16275
16281
|
mayWriteRow: (rowId) => canWrite && mayWriteRow(rowId),
|
|
16276
16282
|
whyNotWrite: (rowId) => !editable ? "Editing is off here." : rowId ? whyNotRow(rowId) : rights.why("write"),
|
|
16283
|
+
mayRemoveRow: (rowId) => canWrite && mayRemoveRow(rowId),
|
|
16284
|
+
whyNotRemove: (rowId) => rowId ? whyNotRemoveRow(rowId) : rights.why("remove"),
|
|
16285
|
+
hideRefusedRowActions,
|
|
16277
16286
|
mayAddRecord: editable && rights.write,
|
|
16278
16287
|
whyNotAdd: editable ? rights.why("write") : "Editing is off here.",
|
|
16279
16288
|
mayStructure,
|
|
@@ -23602,7 +23611,8 @@ function GridBody({
|
|
|
23602
23611
|
sortOverride,
|
|
23603
23612
|
searchOverride,
|
|
23604
23613
|
onSearchChange,
|
|
23605
|
-
searchBox = true
|
|
23614
|
+
searchBox = true,
|
|
23615
|
+
hideRefusedRowActions = false
|
|
23606
23616
|
}) {
|
|
23607
23617
|
const toolbarSlot = useTableToolbarSlot();
|
|
23608
23618
|
const tableCard = useMatrxTableCard();
|
|
@@ -23841,6 +23851,14 @@ function GridBody({
|
|
|
23841
23851
|
(rowId) => askPerRow ? rowRights(rowId)?.write ?? false : rights.write,
|
|
23842
23852
|
[askPerRow, rowRights, rights.write]
|
|
23843
23853
|
);
|
|
23854
|
+
const mayRemoveRow = useCallback28(
|
|
23855
|
+
(rowId) => askPerRow ? rowRights(rowId)?.remove ?? false : rights.remove,
|
|
23856
|
+
[askPerRow, rowRights, rights.remove]
|
|
23857
|
+
);
|
|
23858
|
+
const whyNotRemoveRow = useCallback28(
|
|
23859
|
+
(rowId) => askPerRow ? rowRights(rowId)?.why("remove") ?? rights.why("remove") : rights.why("remove"),
|
|
23860
|
+
[askPerRow, rowRights, rights]
|
|
23861
|
+
);
|
|
23844
23862
|
const whyNotRow = useCallback28(
|
|
23845
23863
|
(rowId) => askPerRow ? rowRights(rowId)?.why("write") ?? rights.why("write") : rights.why("write"),
|
|
23846
23864
|
[askPerRow, rowRights, rights]
|
|
@@ -24511,6 +24529,9 @@ function GridBody({
|
|
|
24511
24529
|
canWrite,
|
|
24512
24530
|
mayWriteRow,
|
|
24513
24531
|
whyNotRow,
|
|
24532
|
+
mayRemoveRow,
|
|
24533
|
+
whyNotRemoveRow,
|
|
24534
|
+
hideRefusedRowActions,
|
|
24514
24535
|
rights,
|
|
24515
24536
|
editable: Boolean(editable),
|
|
24516
24537
|
readOnly,
|
|
@@ -34132,6 +34153,7 @@ function ViewSwitcher({
|
|
|
34132
34153
|
searchOverride,
|
|
34133
34154
|
onSearchChange,
|
|
34134
34155
|
searchBox,
|
|
34156
|
+
hideRefusedRowActions,
|
|
34135
34157
|
newRowLabel,
|
|
34136
34158
|
className
|
|
34137
34159
|
}) {
|
|
@@ -34177,6 +34199,7 @@ function ViewSwitcher({
|
|
|
34177
34199
|
...searchOverride !== void 0 ? { searchOverride } : {},
|
|
34178
34200
|
...onSearchChange ? { onSearchChange } : {},
|
|
34179
34201
|
...searchBox === false ? { searchBox } : {},
|
|
34202
|
+
...hideRefusedRowActions ? { hideRefusedRowActions } : {},
|
|
34180
34203
|
...newRowLabel ? { newRowLabel } : {},
|
|
34181
34204
|
...filter ? { filter } : {},
|
|
34182
34205
|
...onClearFilter ? { onClearFilter } : {},
|