muffin-admin 2.5.4 → 2.6.0

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.
@@ -21,9 +21,9 @@ export function MuffinResourceEdit(props) {
21
21
  if (!props)
22
22
  return null;
23
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: {
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
25
  marginLeft: "auto",
26
- } })] }), children: buildAdmin(["edit-inputs", resourceName], inputs) }) })));
26
+ } }))] }), children: buildAdmin(["edit-inputs", resourceName], inputs) }) })));
27
27
  }
28
28
  setupAdmin(["edit"], (props) => _jsx(MuffinResourceEdit, Object.assign({}, props)));
29
29
  setupAdmin(["edit-actions"], (actions) => (_jsxs(TopToolbar, { children: [actions.map((props, idx) => (_jsx(ActionButton, Object.assign({}, props), idx))), _jsx(ListButton, {}), _jsx(ShowButton, {})] })));
@@ -10,4 +10,8 @@ export function MuffinResourceShow(props) {
10
10
  }
11
11
  setupAdmin(["show"], (props) => _jsx(MuffinResourceShow, Object.assign({}, props)));
12
12
  setupAdmin(["show-fields"], ({ fields }) => buildRA(fields));
13
- setupAdmin(["show-actions"], ({ actions, links, edit }) => (_jsxs(TopToolbar, { children: [_jsx("div", { style: { marginRight: "auto" }, children: links.map(([key, props]) => (_jsx(LinkAction, Object.assign({ resource: key }, props), key))) }), actions.map((props, idx) => (_jsx(ActionButton, Object.assign({}, props), idx))), _jsx(ListButton, {}), edit && _jsx(EditButton, {})] })));
13
+ setupAdmin(["record-actions"], (actions) => actions.map((props, idx) => _jsx(ActionButton, Object.assign({}, props), idx)));
14
+ setupAdmin(["show-actions"], ({ actions, links, edit }) => {
15
+ const resourceName = useResourceContext();
16
+ return (_jsxs(TopToolbar, { children: [_jsx("div", { style: { marginRight: "auto" }, children: links.map(([key, props]) => (_jsx(LinkAction, Object.assign({ resource: key }, props), key))) }), buildAdmin(["record-actions", resourceName], actions), _jsx(ListButton, {}), edit && _jsx(EditButton, {})] }));
17
+ });
@@ -1,12 +1,3 @@
1
- export declare function BulkActionButton({ label, icon, title, action }: {
2
- label: any;
3
- icon: any;
4
- title: any;
5
- action: any;
6
- }): import("react/jsx-runtime").JSX.Element;
7
- export declare function ActionButton({ icon, label, title, action }: {
8
- icon: any;
9
- label: any;
10
- title: any;
11
- action: any;
12
- }): import("react/jsx-runtime").JSX.Element;
1
+ import { AdminAction } from "../types";
2
+ export declare function BulkActionButton({ label, icon, title, action }: AdminAction): import("react/jsx-runtime").JSX.Element;
3
+ export declare function ActionButton({ icon, label, title, action }: AdminAction): import("react/jsx-runtime").JSX.Element;
@@ -7,7 +7,7 @@ export function BulkActionButton({ label, icon, title, action }) {
7
7
  const resource = useResourceContext();
8
8
  const { selectedIds } = useListContext();
9
9
  const [payloadActive, setPayloadActive] = useState(false);
10
- const PayloadBuilder = findBuilder(["action", "payload", action]);
10
+ const PayloadBuilder = findBuilder(["action", "payload", label]);
11
11
  const refresh = useRefresh(), unselectAll = useUnselectAll(resource), notify = useNotify();
12
12
  const { mutate, isLoading } = useAction(action);
13
13
  const process = (payload) => mutate({ ids: selectedIds, payload }, {
@@ -31,7 +31,7 @@ export function ActionButton({ icon, label, title, action }) {
31
31
  const [payloadActive, setPayloadActive] = useState(false);
32
32
  const record = useRecordContext();
33
33
  const { mutate, isLoading } = useAction(action);
34
- const PayloadBuilder = findBuilder(["action", "payload", action]);
34
+ const PayloadBuilder = findBuilder(["action", "payload", label]);
35
35
  const refresh = useRefresh(), notify = useNotify();
36
36
  const process = (payload) => mutate({ record, payload }, {
37
37
  onSuccess: ({ data }) => {