muffin-admin 3.18.8 → 3.19.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/MuffinResourceCreate.d.ts +3 -1
- package/dist/MuffinResourceCreate.js +7 -4
- package/dist/MuffinResourceEdit.d.ts +4 -3
- package/dist/MuffinResourceEdit.js +8 -8
- package/dist/MuffinResourceList.d.ts +2 -1
- package/dist/MuffinResourceList.js +2 -2
- package/dist/MuffinResourceShow.d.ts +5 -4
- package/dist/MuffinResourceShow.js +9 -9
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -1
- package/src/MuffinResourceCreate.tsx +13 -6
- package/src/MuffinResourceEdit.tsx +7 -3
- package/src/MuffinResourceList.tsx +3 -1
- package/src/MuffinResourceShow.tsx +16 -5
package/package.json
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
|
+
import { PropsWithChildren } from "react"
|
|
1
2
|
import { Create, ListButton, SimpleForm, TopToolbar } from "react-admin"
|
|
2
3
|
import { buildRA } from "./buildRA"
|
|
3
4
|
import { useMuffinResourceOpts } from "./hooks"
|
|
4
5
|
import { buildAdmin, findBuilder, setupAdmin } from "./utils"
|
|
5
6
|
|
|
6
|
-
export function MuffinResourceCreate() {
|
|
7
|
+
export function MuffinResourceCreate({ children }: PropsWithChildren) {
|
|
7
8
|
const { name, create } = useMuffinResourceOpts()
|
|
8
9
|
if (!create) return null
|
|
9
10
|
|
|
@@ -11,6 +12,7 @@ export function MuffinResourceCreate() {
|
|
|
11
12
|
|
|
12
13
|
return (
|
|
13
14
|
<Create actions={<ActionsToolbar />}>
|
|
15
|
+
{children}
|
|
14
16
|
<SimpleForm>{buildAdmin(["create-inputs", name], create)}</SimpleForm>
|
|
15
17
|
</Create>
|
|
16
18
|
)
|
|
@@ -19,8 +21,13 @@ export function MuffinResourceCreate() {
|
|
|
19
21
|
setupAdmin(["create"], MuffinResourceCreate)
|
|
20
22
|
setupAdmin(["create-inputs"], buildRA)
|
|
21
23
|
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
<
|
|
25
|
-
|
|
26
|
-
|
|
24
|
+
export function MuffinCreateToolbar({ children }: PropsWithChildren) {
|
|
25
|
+
return (
|
|
26
|
+
<TopToolbar>
|
|
27
|
+
{children}
|
|
28
|
+
<ListButton />
|
|
29
|
+
</TopToolbar>
|
|
30
|
+
)
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
setupAdmin(["create-toolbar"], MuffinCreateToolbar)
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { PropsWithChildren } from "react"
|
|
1
2
|
import {
|
|
2
3
|
DeleteButton,
|
|
3
4
|
Edit,
|
|
@@ -14,7 +15,7 @@ import { ActionButton } from "./buttons"
|
|
|
14
15
|
import { useMuffinAdminOpts, useMuffinResourceOpts } from "./hooks"
|
|
15
16
|
import { buildAdmin, findBuilder, setupAdmin } from "./utils"
|
|
16
17
|
|
|
17
|
-
export function MuffinEdit() {
|
|
18
|
+
export function MuffinEdit({ children }: PropsWithChildren) {
|
|
18
19
|
const {
|
|
19
20
|
adminProps: { mutationMode = "optimistic" },
|
|
20
21
|
} = useMuffinAdminOpts()
|
|
@@ -26,6 +27,7 @@ export function MuffinEdit() {
|
|
|
26
27
|
|
|
27
28
|
return (
|
|
28
29
|
<Edit actions={<ActionsToolbar />} mutationMode={mutationMode}>
|
|
30
|
+
{children}
|
|
29
31
|
<SimpleForm
|
|
30
32
|
toolbar={
|
|
31
33
|
<Toolbar>
|
|
@@ -49,12 +51,13 @@ export function MuffinEdit() {
|
|
|
49
51
|
setupAdmin(["edit"], MuffinEdit)
|
|
50
52
|
setupAdmin(["edit-inputs"], buildRA)
|
|
51
53
|
|
|
52
|
-
export function MuffinEditToolbar() {
|
|
54
|
+
export function MuffinEditToolbar({ children }: PropsWithChildren) {
|
|
53
55
|
const resource = useResourceContext()
|
|
54
56
|
const Actions = findBuilder(["edit-actions", resource])
|
|
55
57
|
return (
|
|
56
58
|
<TopToolbar>
|
|
57
59
|
<Actions />
|
|
60
|
+
{children}
|
|
58
61
|
<ListButton />
|
|
59
62
|
<ShowButton />
|
|
60
63
|
</TopToolbar>
|
|
@@ -63,12 +66,13 @@ export function MuffinEditToolbar() {
|
|
|
63
66
|
|
|
64
67
|
setupAdmin(["edit-toolbar"], MuffinEditToolbar)
|
|
65
68
|
|
|
66
|
-
export function MuffinEditActions() {
|
|
69
|
+
export function MuffinEditActions({ children }: PropsWithChildren) {
|
|
67
70
|
const { edit, actions: baseActions = [] } = useMuffinResourceOpts()
|
|
68
71
|
if (!edit) return null
|
|
69
72
|
const actions = baseActions.filter((a) => a.view?.includes("edit"))
|
|
70
73
|
return (
|
|
71
74
|
<>
|
|
75
|
+
{children}
|
|
72
76
|
{actions.map((props, idx) => (
|
|
73
77
|
<ActionButton key={idx} {...props} />
|
|
74
78
|
))}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import sortBy from "lodash/sortBy"
|
|
2
2
|
import uniq from "lodash/uniq"
|
|
3
|
+
import { PropsWithChildren } from "react"
|
|
3
4
|
import {
|
|
4
5
|
BulkDeleteButton,
|
|
5
6
|
BulkExportButton,
|
|
@@ -19,7 +20,7 @@ import { HelpLink } from "./common/HelpLink"
|
|
|
19
20
|
import { useMuffinResourceOpts } from "./hooks"
|
|
20
21
|
import { buildAdmin, findBuilder, setupAdmin } from "./utils"
|
|
21
22
|
|
|
22
|
-
export function MuffinList() {
|
|
23
|
+
export function MuffinList({ children }: PropsWithChildren) {
|
|
23
24
|
const { name, list } = useMuffinResourceOpts()
|
|
24
25
|
const { limit, limitMax, filters, sort } = list
|
|
25
26
|
|
|
@@ -36,6 +37,7 @@ export function MuffinList() {
|
|
|
36
37
|
<Pagination rowsPerPageOptions={sortBy(uniq([10, 25, 50, 100, limit, limitMax]))} />
|
|
37
38
|
}
|
|
38
39
|
>
|
|
40
|
+
{children}
|
|
39
41
|
<DataGrid />
|
|
40
42
|
</List>
|
|
41
43
|
)
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { PropsWithChildren } from "react"
|
|
1
2
|
import { EditButton, ListButton, Show, SimpleShowLayout, TopToolbar } from "react-admin"
|
|
2
3
|
import { LinkAction } from "./actions"
|
|
3
4
|
import { buildRA } from "./buildRA"
|
|
@@ -5,12 +6,13 @@ import { ActionButton } from "./buttons"
|
|
|
5
6
|
import { useMuffinResourceOpts } from "./hooks"
|
|
6
7
|
import { buildAdmin, findBuilder, setupAdmin } from "./utils"
|
|
7
8
|
|
|
8
|
-
export function MuffinShow() {
|
|
9
|
+
export function MuffinShow({ children }: PropsWithChildren) {
|
|
9
10
|
const { show, name } = useMuffinResourceOpts()
|
|
10
11
|
const ActionsToolbar = findBuilder(["show-toolbar", name])
|
|
11
12
|
|
|
12
13
|
return (
|
|
13
14
|
<Show actions={<ActionsToolbar />}>
|
|
15
|
+
{children}
|
|
14
16
|
<SimpleShowLayout>{buildAdmin(["show-fields", name], show)}</SimpleShowLayout>
|
|
15
17
|
</Show>
|
|
16
18
|
)
|
|
@@ -19,7 +21,7 @@ export function MuffinShow() {
|
|
|
19
21
|
setupAdmin(["show"], (props) => <MuffinShow {...props} />)
|
|
20
22
|
setupAdmin(["show-fields"], ({ fields }) => buildRA(fields))
|
|
21
23
|
|
|
22
|
-
export function MuffinShowToolbar() {
|
|
24
|
+
export function MuffinShowToolbar({ children }: PropsWithChildren) {
|
|
23
25
|
const { show, name } = useMuffinResourceOpts()
|
|
24
26
|
const { edit } = show
|
|
25
27
|
|
|
@@ -30,6 +32,7 @@ export function MuffinShowToolbar() {
|
|
|
30
32
|
<TopToolbar>
|
|
31
33
|
<Links />
|
|
32
34
|
<Actions />
|
|
35
|
+
{children}
|
|
33
36
|
<ListButton />
|
|
34
37
|
{edit && <EditButton />}
|
|
35
38
|
</TopToolbar>
|
|
@@ -38,15 +41,22 @@ export function MuffinShowToolbar() {
|
|
|
38
41
|
|
|
39
42
|
setupAdmin(["show-toolbar"], MuffinShowToolbar)
|
|
40
43
|
|
|
41
|
-
export function MuffinShowActions() {
|
|
44
|
+
export function MuffinShowActions({ children }: PropsWithChildren) {
|
|
42
45
|
const { actions: baseActions = [] } = useMuffinResourceOpts()
|
|
43
46
|
const actions = baseActions.filter((a) => a.view?.includes("show"))
|
|
44
|
-
return
|
|
47
|
+
return (
|
|
48
|
+
<>
|
|
49
|
+
{children}
|
|
50
|
+
{actions.map((props) => (
|
|
51
|
+
<ActionButton key={props.id} {...props} />
|
|
52
|
+
))}
|
|
53
|
+
</>
|
|
54
|
+
)
|
|
45
55
|
}
|
|
46
56
|
|
|
47
57
|
setupAdmin(["show-actions"], MuffinShowActions)
|
|
48
58
|
|
|
49
|
-
export function MuffinShowLinks() {
|
|
59
|
+
export function MuffinShowLinks({ children }: PropsWithChildren) {
|
|
50
60
|
const { show } = useMuffinResourceOpts()
|
|
51
61
|
const { links } = show
|
|
52
62
|
return (
|
|
@@ -54,6 +64,7 @@ export function MuffinShowLinks() {
|
|
|
54
64
|
{links.map(([key, props]) => (
|
|
55
65
|
<LinkAction key={key} resource={key} {...props} />
|
|
56
66
|
))}
|
|
67
|
+
{children}
|
|
57
68
|
</div>
|
|
58
69
|
)
|
|
59
70
|
}
|