muffin-admin 2.3.7 → 2.3.12
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 +5 -3
- package/dist/MuffinResourceList.js +3 -3
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/types.d.ts +2 -0
- package/package.json +1 -1
- package/src/MuffinResourceEdit.tsx +12 -2
- package/src/MuffinResourceList.tsx +13 -10
- package/src/types.ts +7 -5
|
@@ -11,7 +11,7 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
11
11
|
};
|
|
12
12
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
13
13
|
import { useContext } from "react";
|
|
14
|
-
import { Edit, ListButton, ShowButton, SimpleForm, TopToolbar, useResourceContext, } from "react-admin";
|
|
14
|
+
import { DeleteButton, Edit, ListButton, SaveButton, ShowButton, SimpleForm, Toolbar, TopToolbar, useResourceContext, } from "react-admin";
|
|
15
15
|
import { buildRA } from "./buildRA";
|
|
16
16
|
import { ActionButton } from "./buttons";
|
|
17
17
|
import { AdminPropsContext, buildAdmin, setupAdmin } from "./utils";
|
|
@@ -20,8 +20,10 @@ export function MuffinResourceEdit(props) {
|
|
|
20
20
|
const { adminProps: { mutationMode }, } = useContext(AdminPropsContext);
|
|
21
21
|
if (!props)
|
|
22
22
|
return null;
|
|
23
|
-
const { actions, inputs } = props, opts = __rest(props, ["actions", "inputs"]);
|
|
24
|
-
return (_jsx(Edit, Object.assign({ actions: buildAdmin(["edit-actions", resourceName], actions), mutationMode: mutationMode || "optimistic" }, opts, { children: _jsx(SimpleForm, {
|
|
23
|
+
const { actions, inputs, remove } = props, opts = __rest(props, ["actions", "inputs", "remove"]);
|
|
24
|
+
return (_jsx(Edit, Object.assign({ actions: buildAdmin(["edit-actions", resourceName], actions), mutationMode: mutationMode || "optimistic" }, opts, { children: _jsx(SimpleForm, { toolbar: _jsxs(Toolbar, { children: [_jsx(SaveButton, {}), remove && _jsx(DeleteButton, { sx: {
|
|
25
|
+
marginLeft: "auto",
|
|
26
|
+
} })] }), children: buildAdmin(["edit-inputs", resourceName], inputs) }) })));
|
|
25
27
|
}
|
|
26
28
|
setupAdmin(["edit"], (props) => _jsx(MuffinResourceEdit, Object.assign({}, props)));
|
|
27
29
|
setupAdmin(["edit-actions"], (actions) => (_jsxs(TopToolbar, { children: [actions.map((props, idx) => (_jsx(ActionButton, Object.assign({}, props), idx))), _jsx(ListButton, {}), _jsx(ShowButton, {})] })));
|
|
@@ -7,10 +7,10 @@ import { BulkActionButton } from "./buttons";
|
|
|
7
7
|
import { buildAdmin, setupAdmin } from "./utils";
|
|
8
8
|
export function MuffinResourceList(props) {
|
|
9
9
|
const resourceName = useResourceContext();
|
|
10
|
-
const { fields, edit, show, limit, limitMax, filters, actions } = props;
|
|
11
|
-
return (_jsx(List, { bulkActionButtons: buildAdmin(["list-actions", resourceName], actions), filters: buildAdmin(["list-filters", resourceName], filters) || undefined, perPage: limit, pagination: _jsx(Pagination, { rowsPerPageOptions: sortBy(uniq([10, 25, 50, 100, limit, limitMax])) }), children: _jsxs(Datagrid, { rowClick: show ? "show" : edit ? "edit" : false, children: [buildAdmin(["list-fields", resourceName], fields), edit && _jsx(EditButton, {})] }) }));
|
|
10
|
+
const { fields, edit, show, limit, limitMax, filters, actions, remove } = props;
|
|
11
|
+
return (_jsx(List, { bulkActionButtons: buildAdmin(["list-actions", resourceName], { actions, remove }), filters: buildAdmin(["list-filters", resourceName], filters) || undefined, perPage: limit, pagination: _jsx(Pagination, { rowsPerPageOptions: sortBy(uniq([10, 25, 50, 100, limit, limitMax])) }), children: _jsxs(Datagrid, { rowClick: show ? "show" : edit ? "edit" : false, children: [buildAdmin(["list-fields", resourceName], fields), edit && _jsx(EditButton, {})] }) }));
|
|
12
12
|
}
|
|
13
13
|
setupAdmin(["list"], (props) => _jsx(MuffinResourceList, Object.assign({}, props)));
|
|
14
14
|
setupAdmin(["list-fields"], buildRA);
|
|
15
15
|
setupAdmin(["list-filters"], buildRA);
|
|
16
|
-
setupAdmin(["list-actions"], (actions) => (_jsxs(_Fragment, { children: [actions.map((props, idx) => (_jsx(BulkActionButton, Object.assign({}, props), idx))), _jsx(BulkDeleteButton, {})] })));
|
|
16
|
+
setupAdmin(["list-actions"], ({ actions, remove }) => (_jsxs(_Fragment, { children: [actions.map((props, idx) => (_jsx(BulkActionButton, Object.assign({}, props), idx))), remove && _jsx(BulkDeleteButton, {})] })));
|