muffin-admin 3.4.2 → 3.5.0
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/MuffinResourceEdit.js +2 -2
- package/dist/MuffinResourceList.js +2 -1
- package/dist/MuffinResourceShow.js +2 -2
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/types.d.ts +2 -4
- package/package.json +1 -1
- package/src/MuffinResourceEdit.tsx +2 -2
- package/src/MuffinResourceList.tsx +3 -1
- package/src/MuffinResourceShow.tsx +2 -2
- package/src/types.ts +7 -9
package/dist/types.d.ts
CHANGED
|
@@ -2,7 +2,7 @@ export type TProps = {
|
|
|
2
2
|
[key: string]: any;
|
|
3
3
|
};
|
|
4
4
|
export type AdminAction = {
|
|
5
|
-
view: string;
|
|
5
|
+
view: string[];
|
|
6
6
|
id: string;
|
|
7
7
|
label: string;
|
|
8
8
|
title: string;
|
|
@@ -24,7 +24,6 @@ export type AdminShowLink = {
|
|
|
24
24
|
field?: string;
|
|
25
25
|
};
|
|
26
26
|
export type AdminShowProps = {
|
|
27
|
-
actions: AdminAction[];
|
|
28
27
|
fields: AdminField[];
|
|
29
28
|
links: [string, AdminShowLink][];
|
|
30
29
|
edit?: boolean;
|
|
@@ -33,16 +32,15 @@ export type AdminResourceProps = {
|
|
|
33
32
|
name: string;
|
|
34
33
|
icon?: string;
|
|
35
34
|
label: string;
|
|
35
|
+
actions: AdminAction[];
|
|
36
36
|
create: AdminInput[] | false;
|
|
37
37
|
edit: {
|
|
38
|
-
actions: AdminAction[];
|
|
39
38
|
inputs: AdminInput[];
|
|
40
39
|
remove?: boolean;
|
|
41
40
|
} | false;
|
|
42
41
|
list: {
|
|
43
42
|
limit: number;
|
|
44
43
|
limitMax: number;
|
|
45
|
-
actions: AdminAction[];
|
|
46
44
|
create: boolean;
|
|
47
45
|
filters: AdminInput[];
|
|
48
46
|
fields: AdminField[];
|
package/package.json
CHANGED
|
@@ -63,9 +63,9 @@ export function MuffinEditToolbar() {
|
|
|
63
63
|
setupAdmin(["edit-toolbar"], MuffinEditToolbar)
|
|
64
64
|
|
|
65
65
|
export function MuffinEditActions() {
|
|
66
|
-
const { edit } = useMuffinResourceOpts()
|
|
66
|
+
const { edit, actions: baseActions = [] } = useMuffinResourceOpts()
|
|
67
67
|
if (!edit) return null
|
|
68
|
-
const
|
|
68
|
+
const actions = baseActions.filter((a => a.view.includes("edit")))
|
|
69
69
|
return (
|
|
70
70
|
<>
|
|
71
71
|
{actions.map((props, idx) => (
|
|
@@ -87,8 +87,10 @@ setupAdmin(["list-toolbar"], MuffinListToolbar)
|
|
|
87
87
|
|
|
88
88
|
function MuffinListBulkActions() {
|
|
89
89
|
const {
|
|
90
|
-
|
|
90
|
+
actions: baseActions = [],
|
|
91
|
+
list: { remove },
|
|
91
92
|
} = useMuffinResourceOpts()
|
|
93
|
+
const actions = baseActions.filter((a) => a.view.includes("list"))
|
|
92
94
|
return (
|
|
93
95
|
<>
|
|
94
96
|
{actions.map((props) => (
|
|
@@ -39,8 +39,8 @@ export function MuffinShowToolbar() {
|
|
|
39
39
|
setupAdmin(["show-toolbar"], MuffinShowToolbar)
|
|
40
40
|
|
|
41
41
|
export function MuffinShowActions() {
|
|
42
|
-
const {
|
|
43
|
-
const
|
|
42
|
+
const { actions: baseActions = [] } = useMuffinResourceOpts()
|
|
43
|
+
const actions = baseActions.filter((a) => a.view.includes("show"))
|
|
44
44
|
return actions.map((props) => <ActionButton key={props.id} {...props} />)
|
|
45
45
|
}
|
|
46
46
|
|
package/src/types.ts
CHANGED
|
@@ -3,7 +3,7 @@ export type TProps = {
|
|
|
3
3
|
}
|
|
4
4
|
|
|
5
5
|
export type AdminAction = {
|
|
6
|
-
view: string
|
|
6
|
+
view: string[]
|
|
7
7
|
id: string
|
|
8
8
|
label: string
|
|
9
9
|
title: string
|
|
@@ -22,7 +22,6 @@ export type AdminShowLink = {
|
|
|
22
22
|
field?: string
|
|
23
23
|
}
|
|
24
24
|
export type AdminShowProps = {
|
|
25
|
-
actions: AdminAction[]
|
|
26
25
|
fields: AdminField[]
|
|
27
26
|
links: [string, AdminShowLink][]
|
|
28
27
|
edit?: boolean
|
|
@@ -32,18 +31,17 @@ export type AdminResourceProps = {
|
|
|
32
31
|
name: string
|
|
33
32
|
icon?: string
|
|
34
33
|
label: string
|
|
34
|
+
actions: AdminAction[]
|
|
35
35
|
create: AdminInput[] | false
|
|
36
36
|
edit:
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
| false
|
|
37
|
+
| {
|
|
38
|
+
inputs: AdminInput[]
|
|
39
|
+
remove?: boolean
|
|
40
|
+
}
|
|
41
|
+
| false
|
|
43
42
|
list: {
|
|
44
43
|
limit: number
|
|
45
44
|
limitMax: number
|
|
46
|
-
actions: AdminAction[]
|
|
47
45
|
create: boolean
|
|
48
46
|
filters: AdminInput[]
|
|
49
47
|
fields: AdminField[]
|