muffin-admin 2.9.1 → 2.9.2
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,16 +1,8 @@
|
|
|
1
|
-
import {
|
|
2
|
-
EditButton,
|
|
3
|
-
ListButton,
|
|
4
|
-
Show,
|
|
5
|
-
SimpleShowLayout,
|
|
6
|
-
TopToolbar,
|
|
7
|
-
useResourceContext,
|
|
8
|
-
} from "react-admin"
|
|
1
|
+
import { EditButton, ListButton, Show, SimpleShowLayout, TopToolbar } from "react-admin"
|
|
9
2
|
import { LinkAction } from "./actions"
|
|
10
3
|
import { buildRA } from "./buildRA"
|
|
11
4
|
import { ActionButton } from "./buttons"
|
|
12
5
|
import { useMuffinResourceOpts } from "./hooks"
|
|
13
|
-
import { AdminAction, AdminShowProps } from "./types"
|
|
14
6
|
import { buildAdmin, findBuilder, setupAdmin } from "./utils"
|
|
15
7
|
|
|
16
8
|
export function MuffinResourceShow() {
|
|
@@ -18,34 +10,45 @@ export function MuffinResourceShow() {
|
|
|
18
10
|
const ShowActions = findBuilder(["show-actions", name])
|
|
19
11
|
|
|
20
12
|
return (
|
|
21
|
-
<Show actions={<ShowActions
|
|
13
|
+
<Show actions={<ShowActions />}>
|
|
22
14
|
<SimpleShowLayout>{buildAdmin(["show-fields", name], show)}</SimpleShowLayout>
|
|
23
15
|
</Show>
|
|
24
16
|
)
|
|
25
17
|
}
|
|
26
18
|
|
|
27
|
-
setupAdmin(["record-actions"], (
|
|
28
|
-
|
|
29
|
-
|
|
19
|
+
setupAdmin(["record-actions"], () => {
|
|
20
|
+
const { show } = useMuffinResourceOpts()
|
|
21
|
+
const { actions } = show
|
|
22
|
+
return actions.map((props) => <ActionButton key={props.id} {...props} />)
|
|
23
|
+
})
|
|
30
24
|
|
|
31
|
-
setupAdmin(["record-links"], (
|
|
32
|
-
|
|
33
|
-
|
|
25
|
+
setupAdmin(["record-links"], () => {
|
|
26
|
+
const { show } = useMuffinResourceOpts()
|
|
27
|
+
const { links } = show
|
|
28
|
+
return (
|
|
29
|
+
<div style={{ marginRight: "auto" }}>
|
|
30
|
+
{links.map(([key, props]) => (
|
|
31
|
+
<LinkAction key={key} resource={key} {...props} />
|
|
32
|
+
))}
|
|
33
|
+
</div>
|
|
34
|
+
)
|
|
35
|
+
})
|
|
34
36
|
|
|
35
37
|
setupAdmin(["show"], (props) => <MuffinResourceShow {...props} />)
|
|
36
38
|
|
|
37
39
|
setupAdmin(["show-fields"], ({ fields }) => buildRA(fields))
|
|
38
40
|
|
|
39
|
-
setupAdmin(["show-actions"], (
|
|
40
|
-
const
|
|
41
|
-
const
|
|
42
|
-
|
|
41
|
+
setupAdmin(["show-actions"], () => {
|
|
42
|
+
const { show, name } = useMuffinResourceOpts()
|
|
43
|
+
const { edit } = show
|
|
44
|
+
|
|
45
|
+
const Links = findBuilder(["record-links", name])
|
|
46
|
+
const Actions = findBuilder(["record-actions", name])
|
|
47
|
+
|
|
43
48
|
return (
|
|
44
49
|
<TopToolbar>
|
|
45
|
-
<
|
|
46
|
-
|
|
47
|
-
</div>
|
|
48
|
-
<Actions actions={actions} />
|
|
50
|
+
<Links />
|
|
51
|
+
<Actions />
|
|
49
52
|
<ListButton />
|
|
50
53
|
{edit && <EditButton />}
|
|
51
54
|
</TopToolbar>
|