@evenicanpm/portal-table-ui 2.5.0 → 2.5.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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@evenicanpm/portal-table-ui",
|
|
3
|
-
"version": "2.5.
|
|
3
|
+
"version": "2.5.1",
|
|
4
4
|
"description": "",
|
|
5
5
|
"license": "ISC",
|
|
6
6
|
"author": "",
|
|
@@ -39,7 +39,7 @@
|
|
|
39
39
|
"@mui/lab": "^7.0.1-beta.19",
|
|
40
40
|
"date-fns": "^4.1.0",
|
|
41
41
|
"zod": "^4.4.3",
|
|
42
|
-
"@evenicanpm/ui": "2.5.
|
|
42
|
+
"@evenicanpm/ui": "2.5.1"
|
|
43
43
|
},
|
|
44
44
|
"scripts": {
|
|
45
45
|
"test": "echo \"Error: no test specified\" && exit 1",
|
|
@@ -8,7 +8,6 @@ interface BulkActionButtonProps {
|
|
|
8
8
|
selectedIds: (string | number)[];
|
|
9
9
|
clearSelection: () => void;
|
|
10
10
|
selectedRows: Types.Queries.Row[];
|
|
11
|
-
selectionRequired: boolean;
|
|
12
11
|
}
|
|
13
12
|
export function BulkActionButton({
|
|
14
13
|
action,
|
|
@@ -16,15 +15,13 @@ export function BulkActionButton({
|
|
|
16
15
|
selectedIds,
|
|
17
16
|
clearSelection,
|
|
18
17
|
selectedRows,
|
|
19
|
-
selectionRequired,
|
|
20
18
|
}: BulkActionButtonProps) {
|
|
21
19
|
const mutationOptions = action.mutation({
|
|
22
20
|
resourceName,
|
|
23
21
|
selectedIds,
|
|
24
22
|
});
|
|
25
23
|
|
|
26
|
-
const
|
|
27
|
-
const allowed = !selectionRequired || isAllowed;
|
|
24
|
+
const allowed = !action.isAllowed || action.isAllowed(selectedRows);
|
|
28
25
|
const { mutate, isPending } = useMutation(mutationOptions);
|
|
29
26
|
|
|
30
27
|
const handleClick = () => {
|
|
@@ -48,7 +45,7 @@ export function BulkActionButton({
|
|
|
48
45
|
<IconButton
|
|
49
46
|
size="small"
|
|
50
47
|
onClick={handleClick}
|
|
51
|
-
disabled={isPending ||
|
|
48
|
+
disabled={isPending || !allowed}
|
|
52
49
|
sx={{
|
|
53
50
|
border: 1,
|
|
54
51
|
borderRadius: 1,
|
|
@@ -73,7 +70,7 @@ export function BulkActionButton({
|
|
|
73
70
|
onClick={handleClick}
|
|
74
71
|
size="large"
|
|
75
72
|
sx={{ textWrap: "nowrap", minHeight: "fit-content" }}
|
|
76
|
-
disabled={isPending ||
|
|
73
|
+
disabled={isPending || !allowed}
|
|
77
74
|
>
|
|
78
75
|
{isPending ? (
|
|
79
76
|
<CircularProgress size={22} />
|
|
@@ -233,7 +233,6 @@ type BulkActionButtonsProps = {
|
|
|
233
233
|
selectedIds: Set<Id>;
|
|
234
234
|
resourceName: string;
|
|
235
235
|
clearSelection: () => void;
|
|
236
|
-
selectionRequired: boolean;
|
|
237
236
|
};
|
|
238
237
|
|
|
239
238
|
function BulkActionButtons({
|
|
@@ -244,7 +243,6 @@ function BulkActionButtons({
|
|
|
244
243
|
selectedIds,
|
|
245
244
|
resourceName,
|
|
246
245
|
clearSelection,
|
|
247
|
-
selectionRequired,
|
|
248
246
|
}: Readonly<BulkActionButtonsProps>) {
|
|
249
247
|
if (!hasBulkActions) {
|
|
250
248
|
return null;
|
|
@@ -264,7 +262,6 @@ function BulkActionButtons({
|
|
|
264
262
|
key={action.label}
|
|
265
263
|
action={action}
|
|
266
264
|
resourceName={resourceName}
|
|
267
|
-
selectionRequired={selectionRequired}
|
|
268
265
|
selectedIds={Array.from(selectedIds)}
|
|
269
266
|
selectedRows={selectedRows}
|
|
270
267
|
clearSelection={clearSelection}
|
|
@@ -398,7 +395,7 @@ export default function DocumentTable({
|
|
|
398
395
|
enabled: !!viewConfigQuery && !viewConfig,
|
|
399
396
|
});
|
|
400
397
|
|
|
401
|
-
const config = viewConfig ?? fetchedConfig;
|
|
398
|
+
const config: Types.ViewConfig | undefined = viewConfig ?? fetchedConfig;
|
|
402
399
|
|
|
403
400
|
const configPending = viewConfig ? false : fetchedConfigPending;
|
|
404
401
|
|
|
@@ -546,7 +543,6 @@ export default function DocumentTable({
|
|
|
546
543
|
|
|
547
544
|
<BulkActionButtons
|
|
548
545
|
hasBulkActions={hasBulkActions}
|
|
549
|
-
selectionRequired={config?.SelectionRequired ?? true}
|
|
550
546
|
resolvedBulkActions={resolvedBulkActions}
|
|
551
547
|
rows={rows}
|
|
552
548
|
idField={idField}
|