muffin-admin 2.9.2 → 3.0.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/dist/MuffinResourceCreate.js +3 -3
- package/dist/MuffinResourceEdit.d.ts +3 -1
- package/dist/MuffinResourceEdit.js +15 -9
- package/dist/MuffinResourceList.d.ts +1 -1
- package/dist/MuffinResourceList.js +6 -6
- package/dist/MuffinResourceShow.d.ts +4 -1
- package/dist/MuffinResourceShow.js +19 -16
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -1
- package/src/MuffinResourceCreate.tsx +4 -5
- package/src/MuffinResourceEdit.tsx +23 -12
- package/src/MuffinResourceList.tsx +6 -7
- package/src/MuffinResourceShow.tsx +32 -27
|
@@ -7,9 +7,9 @@ export function MuffinResourceCreate() {
|
|
|
7
7
|
const { name, create } = useMuffinResourceOpts();
|
|
8
8
|
if (!create)
|
|
9
9
|
return null;
|
|
10
|
-
const
|
|
11
|
-
return (_jsx(Create, { actions: _jsx(
|
|
10
|
+
const ActionsToolbar = findBuilder(["create-toolbar", name]);
|
|
11
|
+
return (_jsx(Create, { actions: _jsx(ActionsToolbar, {}), children: _jsx(SimpleForm, { children: buildAdmin(["create-inputs", name], create) }) }));
|
|
12
12
|
}
|
|
13
13
|
setupAdmin(["create"], MuffinResourceCreate);
|
|
14
|
-
setupAdmin(["create-actions"], () => (_jsx(TopToolbar, { children: _jsx(ListButton, {}) })));
|
|
15
14
|
setupAdmin(["create-inputs"], buildRA);
|
|
15
|
+
setupAdmin(["create-toolbar"], () => (_jsx(TopToolbar, { children: _jsx(ListButton, {}) })));
|
|
@@ -1 +1,3 @@
|
|
|
1
|
-
export declare function
|
|
1
|
+
export declare function MuffinEdit(): import("react/jsx-runtime").JSX.Element;
|
|
2
|
+
export declare function MuffinEditToolbar(): import("react/jsx-runtime").JSX.Element;
|
|
3
|
+
export declare function MuffinEditActions(): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,27 +1,33 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
2
|
import { DeleteButton, Edit, ListButton, SaveButton, ShowButton, SimpleForm, Toolbar, TopToolbar, } from "react-admin";
|
|
3
3
|
import { buildRA } from "./buildRA";
|
|
4
4
|
import { ActionButton } from "./buttons";
|
|
5
5
|
import { useMuffinAdminOpts, useMuffinResourceOpts } from "./hooks";
|
|
6
6
|
import { buildAdmin, findBuilder, setupAdmin } from "./utils";
|
|
7
|
-
export function
|
|
7
|
+
export function MuffinEdit() {
|
|
8
8
|
const { adminProps: { mutationMode = "optimistic" }, } = useMuffinAdminOpts();
|
|
9
9
|
const { edit, name } = useMuffinResourceOpts();
|
|
10
10
|
if (!edit)
|
|
11
11
|
return null;
|
|
12
12
|
const { inputs, remove } = edit;
|
|
13
|
-
const
|
|
14
|
-
return (_jsx(Edit, { actions: _jsx(
|
|
13
|
+
const ActionsToolbar = findBuilder(["edit-toolbar", name]);
|
|
14
|
+
return (_jsx(Edit, { actions: _jsx(ActionsToolbar, {}), mutationMode: mutationMode, children: _jsx(SimpleForm, { toolbar: _jsxs(Toolbar, { children: [_jsx(SaveButton, {}), remove && (_jsx(DeleteButton, { sx: {
|
|
15
15
|
marginLeft: "auto",
|
|
16
16
|
} }))] }), children: buildAdmin(["edit-inputs", name], inputs) }) }));
|
|
17
17
|
}
|
|
18
|
-
setupAdmin(["edit"],
|
|
19
|
-
|
|
18
|
+
setupAdmin(["edit"], MuffinEdit);
|
|
19
|
+
setupAdmin(["edit-inputs"], buildRA);
|
|
20
|
+
export function MuffinEditToolbar() {
|
|
21
|
+
const { name } = useMuffinResourceOpts();
|
|
22
|
+
const Actions = findBuilder(["edit-actions", name]);
|
|
23
|
+
return (_jsxs(TopToolbar, { children: [_jsx(Actions, {}), _jsx(ListButton, {}), _jsx(ShowButton, {})] }));
|
|
24
|
+
}
|
|
25
|
+
setupAdmin(["edit-toolbar"], MuffinEditToolbar);
|
|
26
|
+
export function MuffinEditActions() {
|
|
20
27
|
const { edit } = useMuffinResourceOpts();
|
|
21
28
|
if (!edit)
|
|
22
29
|
return null;
|
|
23
30
|
const { actions = [] } = edit;
|
|
24
|
-
return (
|
|
31
|
+
return (_jsx(_Fragment, { children: actions.map((props, idx) => (_jsx(ActionButton, Object.assign({}, props), idx))) }));
|
|
25
32
|
}
|
|
26
|
-
setupAdmin(["edit-actions"],
|
|
27
|
-
setupAdmin(["edit-inputs"], buildRA);
|
|
33
|
+
setupAdmin(["edit-actions"], MuffinEditActions);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare function
|
|
1
|
+
export declare function MuffinList(): import("react/jsx-runtime").JSX.Element;
|
|
@@ -6,21 +6,21 @@ import { buildRA } from "./buildRA";
|
|
|
6
6
|
import { BulkActionButton } from "./buttons";
|
|
7
7
|
import { useMuffinResourceOpts } from "./hooks";
|
|
8
8
|
import { buildAdmin, findBuilder, setupAdmin } from "./utils";
|
|
9
|
-
export function
|
|
9
|
+
export function MuffinList() {
|
|
10
10
|
const { name, list } = useMuffinResourceOpts();
|
|
11
11
|
const { fields, edit, show, limit, limitMax, filters, sort } = list;
|
|
12
|
-
const
|
|
12
|
+
const Toolbar = findBuilder(["list-toolbar", name]);
|
|
13
13
|
const BulkActions = findBuilder(["list-bulk-actions", name]);
|
|
14
|
-
return (_jsx(List, { sort: sort, perPage: limit, actions: _jsx(
|
|
14
|
+
return (_jsx(List, { sort: sort, perPage: limit, actions: _jsx(Toolbar, {}), filters: buildAdmin(["list-filters", name], filters), bulkActionButtons: _jsx(BulkActions, {}), pagination: _jsx(Pagination, { rowsPerPageOptions: sortBy(uniq([10, 25, 50, 100, limit, limitMax])) }), children: _jsxs(DatagridConfigurable, { rowClick: show ? "show" : edit ? "edit" : false, children: [buildAdmin(["list-fields", name], fields), edit && _jsx(EditButton, {})] }) }));
|
|
15
15
|
}
|
|
16
|
-
setupAdmin(["list"],
|
|
16
|
+
setupAdmin(["list"], MuffinList);
|
|
17
17
|
setupAdmin(["list-fields"], buildRA);
|
|
18
18
|
setupAdmin(["list-filters"], buildRA);
|
|
19
|
-
function
|
|
19
|
+
function MuffinListToolbar() {
|
|
20
20
|
const { list: { create }, } = useMuffinResourceOpts();
|
|
21
21
|
return (_jsxs(TopToolbar, { children: [_jsx(SelectColumnsButton, {}), _jsx(FilterButton, {}), create && _jsx(CreateButton, {}), _jsx(ExportButton, {})] }));
|
|
22
22
|
}
|
|
23
|
-
setupAdmin(["list-
|
|
23
|
+
setupAdmin(["list-toolbar"], MuffinListToolbar);
|
|
24
24
|
function MuffinListBulkActions() {
|
|
25
25
|
const { list: { actions, remove }, } = useMuffinResourceOpts();
|
|
26
26
|
return (_jsxs(_Fragment, { children: [actions.map((props) => (_jsx(BulkActionButton, Object.assign({}, props), props.id))), remove && _jsx(BulkDeleteButton, {})] }));
|
|
@@ -1 +1,4 @@
|
|
|
1
|
-
export declare function
|
|
1
|
+
export declare function MuffinShow(): import("react/jsx-runtime").JSX.Element;
|
|
2
|
+
export declare function MuffinShowToolbar(): import("react/jsx-runtime").JSX.Element;
|
|
3
|
+
export declare function MuffinShowActions(): import("react/jsx-runtime").JSX.Element[];
|
|
4
|
+
export declare function MuffinShowLinks(): import("react/jsx-runtime").JSX.Element;
|
|
@@ -5,27 +5,30 @@ import { buildRA } from "./buildRA";
|
|
|
5
5
|
import { ActionButton } from "./buttons";
|
|
6
6
|
import { useMuffinResourceOpts } from "./hooks";
|
|
7
7
|
import { buildAdmin, findBuilder, setupAdmin } from "./utils";
|
|
8
|
-
export function
|
|
8
|
+
export function MuffinShow() {
|
|
9
9
|
const { show, name } = useMuffinResourceOpts();
|
|
10
|
-
const
|
|
11
|
-
return (_jsx(Show, { actions: _jsx(
|
|
10
|
+
const ActionsToolbar = findBuilder(["show-toolbar", name]);
|
|
11
|
+
return (_jsx(Show, { actions: _jsx(ActionsToolbar, {}), children: _jsx(SimpleShowLayout, { children: buildAdmin(["show-fields", name], show) }) }));
|
|
12
12
|
}
|
|
13
|
-
setupAdmin(["
|
|
13
|
+
setupAdmin(["show"], (props) => _jsx(MuffinShow, Object.assign({}, props)));
|
|
14
|
+
setupAdmin(["show-fields"], ({ fields }) => buildRA(fields));
|
|
15
|
+
export function MuffinShowToolbar() {
|
|
16
|
+
const { show, name } = useMuffinResourceOpts();
|
|
17
|
+
const { edit } = show;
|
|
18
|
+
const Links = findBuilder(["show-links", name]);
|
|
19
|
+
const Actions = findBuilder(["show-actions", name]);
|
|
20
|
+
return (_jsxs(TopToolbar, { children: [_jsx(Links, {}), _jsx(Actions, {}), _jsx(ListButton, {}), edit && _jsx(EditButton, {})] }));
|
|
21
|
+
}
|
|
22
|
+
setupAdmin(["show-toolbar"], MuffinShowToolbar);
|
|
23
|
+
export function MuffinShowActions() {
|
|
14
24
|
const { show } = useMuffinResourceOpts();
|
|
15
25
|
const { actions } = show;
|
|
16
26
|
return actions.map((props) => _jsx(ActionButton, Object.assign({}, props), props.id));
|
|
17
|
-
}
|
|
18
|
-
setupAdmin(["
|
|
27
|
+
}
|
|
28
|
+
setupAdmin(["show-actions"], MuffinShowActions);
|
|
29
|
+
export function MuffinShowLinks() {
|
|
19
30
|
const { show } = useMuffinResourceOpts();
|
|
20
31
|
const { links } = show;
|
|
21
32
|
return (_jsx("div", { style: { marginRight: "auto" }, children: links.map(([key, props]) => (_jsx(LinkAction, Object.assign({ resource: key }, props), key))) }));
|
|
22
|
-
}
|
|
23
|
-
setupAdmin(["show"],
|
|
24
|
-
setupAdmin(["show-fields"], ({ fields }) => buildRA(fields));
|
|
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, {})] }));
|
|
31
|
-
});
|
|
33
|
+
}
|
|
34
|
+
setupAdmin(["show-links"], MuffinShowLinks);
|