muffin-admin 2.6.0 → 2.6.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
|
@@ -10,12 +10,14 @@ import { LinkAction } from "./actions"
|
|
|
10
10
|
import { buildRA } from "./buildRA"
|
|
11
11
|
import { ActionButton } from "./buttons"
|
|
12
12
|
import { AdminAction, AdminShowProps } from "./types"
|
|
13
|
-
import { buildAdmin, setupAdmin } from "./utils"
|
|
13
|
+
import { buildAdmin, findBuilder, setupAdmin } from "./utils"
|
|
14
14
|
|
|
15
15
|
export function MuffinResourceShow(props: AdminShowProps) {
|
|
16
16
|
const resourceName = useResourceContext()
|
|
17
|
+
const ShowActions = findBuilder(["show-actions", resourceName])
|
|
18
|
+
|
|
17
19
|
return (
|
|
18
|
-
<Show actions={
|
|
20
|
+
<Show actions={<ShowActions {...props} />}>
|
|
19
21
|
<SimpleShowLayout>{buildAdmin(["show-fields", resourceName], props)}</SimpleShowLayout>
|
|
20
22
|
</Show>
|
|
21
23
|
)
|
|
@@ -23,19 +25,22 @@ export function MuffinResourceShow(props: AdminShowProps) {
|
|
|
23
25
|
|
|
24
26
|
setupAdmin(["show"], (props) => <MuffinResourceShow {...props} />)
|
|
25
27
|
setupAdmin(["show-fields"], ({ fields }) => buildRA(fields))
|
|
26
|
-
setupAdmin(["record-actions"], (actions: AdminAction[]) =>
|
|
28
|
+
setupAdmin(["record-actions"], ({ actions }: { actions: AdminAction[] }) =>
|
|
27
29
|
actions.map((props, idx) => <ActionButton key={idx} {...props} />)
|
|
28
30
|
)
|
|
31
|
+
setupAdmin(["record-links"], ({ links }: { links: AdminShowProps["links"] }) =>
|
|
32
|
+
links.map(([key, props]) => <LinkAction key={key} resource={key} {...props} />)
|
|
33
|
+
)
|
|
29
34
|
setupAdmin(["show-actions"], ({ actions, links, edit }: AdminShowProps) => {
|
|
30
35
|
const resourceName = useResourceContext()
|
|
36
|
+
const Actions = findBuilder(["record-actions", resourceName])
|
|
37
|
+
const Links = findBuilder(["record-links", resourceName])
|
|
31
38
|
return (
|
|
32
39
|
<TopToolbar>
|
|
33
40
|
<div style={{ marginRight: "auto" }}>
|
|
34
|
-
{links
|
|
35
|
-
<LinkAction key={key} resource={key} {...props} />
|
|
36
|
-
))}
|
|
41
|
+
<Links links={links} />
|
|
37
42
|
</div>
|
|
38
|
-
{
|
|
43
|
+
<Actions actions={actions} />
|
|
39
44
|
<ListButton />
|
|
40
45
|
{edit && <EditButton />}
|
|
41
46
|
</TopToolbar>
|