muffin-admin 2.9.0 → 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.
|
@@ -1,14 +1,3 @@
|
|
|
1
|
-
var __rest = (this && this.__rest) || function (s, e) {
|
|
2
|
-
var t = {};
|
|
3
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
4
|
-
t[p] = s[p];
|
|
5
|
-
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
6
|
-
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
7
|
-
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
8
|
-
t[p[i]] = s[p[i]];
|
|
9
|
-
}
|
|
10
|
-
return t;
|
|
11
|
-
};
|
|
12
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
13
2
|
import { DeleteButton, Edit, ListButton, SaveButton, ShowButton, SimpleForm, Toolbar, TopToolbar, } from "react-admin";
|
|
14
3
|
import { buildRA } from "./buildRA";
|
|
@@ -20,14 +9,18 @@ export function MuffinResourceEdit() {
|
|
|
20
9
|
const { edit, name } = useMuffinResourceOpts();
|
|
21
10
|
if (!edit)
|
|
22
11
|
return null;
|
|
23
|
-
const {
|
|
12
|
+
const { inputs, remove } = edit;
|
|
24
13
|
const Actions = findBuilder(["edit-actions", name]);
|
|
25
|
-
return (_jsx(Edit,
|
|
14
|
+
return (_jsx(Edit, { actions: _jsx(Actions, {}), mutationMode: mutationMode, children: _jsx(SimpleForm, { toolbar: _jsxs(Toolbar, { children: [_jsx(SaveButton, {}), remove && (_jsx(DeleteButton, { sx: {
|
|
26
15
|
marginLeft: "auto",
|
|
27
|
-
} }))] }), children: buildAdmin(["edit-inputs", name], inputs) }) }))
|
|
16
|
+
} }))] }), children: buildAdmin(["edit-inputs", name], inputs) }) }));
|
|
28
17
|
}
|
|
29
18
|
setupAdmin(["edit"], MuffinResourceEdit);
|
|
30
|
-
function MuffinResourceEditActions(
|
|
19
|
+
function MuffinResourceEditActions() {
|
|
20
|
+
const { edit } = useMuffinResourceOpts();
|
|
21
|
+
if (!edit)
|
|
22
|
+
return null;
|
|
23
|
+
const { actions = [] } = edit;
|
|
31
24
|
return (_jsxs(TopToolbar, { children: [actions.map((props, idx) => (_jsx(ActionButton, Object.assign({}, props), idx))), _jsx(ListButton, {}), _jsx(ShowButton, {})] }));
|
|
32
25
|
}
|
|
33
26
|
setupAdmin(["edit-actions"], MuffinResourceEditActions);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { EditButton, ListButton, Show, SimpleShowLayout, TopToolbar
|
|
2
|
+
import { EditButton, ListButton, Show, SimpleShowLayout, TopToolbar } from "react-admin";
|
|
3
3
|
import { LinkAction } from "./actions";
|
|
4
4
|
import { buildRA } from "./buildRA";
|
|
5
5
|
import { ActionButton } from "./buttons";
|
|
@@ -8,15 +8,24 @@ import { buildAdmin, findBuilder, setupAdmin } from "./utils";
|
|
|
8
8
|
export function MuffinResourceShow() {
|
|
9
9
|
const { show, name } = useMuffinResourceOpts();
|
|
10
10
|
const ShowActions = findBuilder(["show-actions", name]);
|
|
11
|
-
return (_jsx(Show, { actions: _jsx(ShowActions,
|
|
11
|
+
return (_jsx(Show, { actions: _jsx(ShowActions, {}), children: _jsx(SimpleShowLayout, { children: buildAdmin(["show-fields", name], show) }) }));
|
|
12
12
|
}
|
|
13
|
-
setupAdmin(["record-actions"], (
|
|
14
|
-
|
|
13
|
+
setupAdmin(["record-actions"], () => {
|
|
14
|
+
const { show } = useMuffinResourceOpts();
|
|
15
|
+
const { actions } = show;
|
|
16
|
+
return actions.map((props) => _jsx(ActionButton, Object.assign({}, props), props.id));
|
|
17
|
+
});
|
|
18
|
+
setupAdmin(["record-links"], () => {
|
|
19
|
+
const { show } = useMuffinResourceOpts();
|
|
20
|
+
const { links } = show;
|
|
21
|
+
return (_jsx("div", { style: { marginRight: "auto" }, children: links.map(([key, props]) => (_jsx(LinkAction, Object.assign({ resource: key }, props), key))) }));
|
|
22
|
+
});
|
|
15
23
|
setupAdmin(["show"], (props) => _jsx(MuffinResourceShow, Object.assign({}, props)));
|
|
16
24
|
setupAdmin(["show-fields"], ({ fields }) => buildRA(fields));
|
|
17
|
-
setupAdmin(["show-actions"], (
|
|
18
|
-
const
|
|
19
|
-
const
|
|
20
|
-
const Links = findBuilder(["record-links",
|
|
21
|
-
|
|
25
|
+
setupAdmin(["show-actions"], () => {
|
|
26
|
+
const { show, name } = useMuffinResourceOpts();
|
|
27
|
+
const { edit } = show;
|
|
28
|
+
const Links = findBuilder(["record-links", name]);
|
|
29
|
+
const Actions = findBuilder(["record-actions", name]);
|
|
30
|
+
return (_jsxs(TopToolbar, { children: [_jsx(Links, {}), _jsx(Actions, {}), _jsx(ListButton, {}), edit && _jsx(EditButton, {})] }));
|
|
22
31
|
});
|