muffin-admin 3.0.0 → 3.0.3

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.
@@ -7,8 +7,8 @@ export function MuffinResourceCreate() {
7
7
  const { name, create } = useMuffinResourceOpts();
8
8
  if (!create)
9
9
  return null;
10
- const Toolbar = findBuilder(["create-toolbar", name]);
11
- return (_jsx(Create, { actions: _jsx(Toolbar, {}), children: _jsx(SimpleForm, { children: buildAdmin(["create-inputs", name], create) }) }));
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
14
  setupAdmin(["create-inputs"], buildRA);
@@ -1,5 +1,5 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
2
- import { DeleteButton, Edit, ListButton, SaveButton, ShowButton, SimpleForm, TopToolbar, } from "react-admin";
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";
@@ -10,8 +10,8 @@ export function MuffinEdit() {
10
10
  if (!edit)
11
11
  return null;
12
12
  const { inputs, remove } = edit;
13
- const Toolbar = findBuilder(["edit-toolbar", name]);
14
- return (_jsx(Edit, { actions: _jsx(Toolbar, {}), mutationMode: mutationMode, children: _jsx(SimpleForm, { toolbar: _jsxs(Toolbar, { children: [_jsx(SaveButton, {}), remove && (_jsx(DeleteButton, { sx: {
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
  }
@@ -7,8 +7,8 @@ import { useMuffinResourceOpts } from "./hooks";
7
7
  import { buildAdmin, findBuilder, setupAdmin } from "./utils";
8
8
  export function MuffinShow() {
9
9
  const { show, name } = useMuffinResourceOpts();
10
- const Toolbar = findBuilder(["show-toolbar", name]);
11
- return (_jsx(Show, { actions: _jsx(Toolbar, {}), children: _jsx(SimpleShowLayout, { children: buildAdmin(["show-fields", name], show) }) }));
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
13
  setupAdmin(["show"], (props) => _jsx(MuffinShow, Object.assign({}, props)));
14
14
  setupAdmin(["show-fields"], ({ fields }) => buildRA(fields));
@@ -24,10 +24,7 @@ export declare function MuffinDataprovider(apiUrl: string): {
24
24
  id: any;
25
25
  data: any;
26
26
  }) => Promise<{
27
- status: number;
28
- headers: Headers;
29
- body: string;
30
- json: any;
27
+ data: any;
31
28
  }>;
32
29
  updateMany: (resource: any, { ids, data }: {
33
30
  ids: any;
@@ -60,7 +60,7 @@ export function MuffinDataprovider(apiUrl) {
60
60
  return yield makeRequest(`${apiUrl}/${resource}/${id}`, {
61
61
  data,
62
62
  method: "PUT",
63
- });
63
+ }).then(({ json }) => ({ data: json }));
64
64
  }),
65
65
  updateMany: (resource_4, _d) => __awaiter(this, [resource_4, _d], void 0, function* (resource, { ids, data }) {
66
66
  yield Promise.all(ids.map((id) => methods.update(resource, { id, data })));