muffin-admin 10.0.1 → 11.1.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.
@@ -6,13 +6,13 @@ import { useMuffinAdminOpts, useMuffinResourceOpts } from "./hooks";
6
6
  import { findBuilder, setupAdmin } from "./utils";
7
7
  export function MuffinEdit({ children }) {
8
8
  const { adminProps: { mutationMode = "optimistic" }, } = useMuffinAdminOpts();
9
- const { edit, name, pk } = useMuffinResourceOpts();
9
+ const { edit, name, key } = useMuffinResourceOpts();
10
10
  if (!edit)
11
11
  return null;
12
12
  const Actions = findBuilder(["edit-toolbar", name]);
13
13
  const Inputs = findBuilder(["edit-inputs", name]);
14
14
  const FormToolbar = findBuilder(["edit-form-toolbar", name]);
15
- return (_jsxs(Edit, { actions: _jsx(Actions, {}), mutationMode: mutationMode, queryOptions: { meta: { key: pk } }, children: [children, _jsx(SimpleForm, { toolbar: _jsx(FormToolbar, {}), children: _jsx(Inputs, {}) })] }));
15
+ return (_jsxs(Edit, { actions: _jsx(Actions, {}), mutationMode: mutationMode, queryOptions: { meta: { key } }, children: [children, _jsx(SimpleForm, { toolbar: _jsx(FormToolbar, {}), children: _jsx(Inputs, {}) })] }));
16
16
  }
17
17
  setupAdmin(["edit"], MuffinEdit);
18
18
  export function MuffinEditFormToolbar() {
@@ -8,12 +8,12 @@ import { HelpLink } from "./common/HelpLink";
8
8
  import { useMuffinResourceOpts } from "./hooks";
9
9
  import { buildAdmin, findBuilder, setupAdmin } from "./utils";
10
10
  export function MuffinList({ children }) {
11
- const { name, list, pk } = useMuffinResourceOpts();
11
+ const { name, list, key } = useMuffinResourceOpts();
12
12
  const { limit, limitMax, limitTotal, sort, filters } = list;
13
13
  const DataGrid = findBuilder(["list-grid", name]);
14
14
  const Toolbar = findBuilder(["list-toolbar", name]);
15
15
  const raFilters = buildAdmin(["list-filters", name], filters);
16
- return limitTotal ? (_jsxs(List, { sort: sort, perPage: limit, filters: raFilters, actions: _jsx(Toolbar, {}), queryOptions: { meta: { key: pk } }, pagination: _jsx(Pagination, { rowsPerPageOptions: sortBy(uniq([10, 25, 50, 100, limit, limitMax])) }), children: [children, _jsx(DataGrid, {})] })) : (_jsxs(InfiniteList, { sort: sort, perPage: limit, filters: raFilters, actions: _jsx(Toolbar, {}), queryOptions: { meta: { key: pk } }, children: [children, _jsx(DataGrid, {})] }));
16
+ return limitTotal ? (_jsxs(List, { sort: sort, perPage: limit, filters: raFilters, actions: _jsx(Toolbar, {}), queryOptions: { meta: { key } }, pagination: _jsx(Pagination, { rowsPerPageOptions: sortBy(uniq([10, 25, 50, 100, limit, limitMax])) }), children: [children, _jsx(DataGrid, {})] })) : (_jsxs(InfiniteList, { sort: sort, perPage: limit, filters: raFilters, actions: _jsx(Toolbar, {}), queryOptions: { meta: { key } }, children: [children, _jsx(DataGrid, {})] }));
17
17
  }
18
18
  setupAdmin(["list"], MuffinList);
19
19
  setupAdmin(["list-fields"], buildRA);
@@ -6,9 +6,9 @@ import { ActionButton } from "./buttons";
6
6
  import { useMuffinResourceOpts } from "./hooks";
7
7
  import { buildAdmin, findBuilder, setupAdmin } from "./utils";
8
8
  export function MuffinShow({ children }) {
9
- const { show, name, pk } = useMuffinResourceOpts();
9
+ const { show, name, key } = useMuffinResourceOpts();
10
10
  const ShowToolbar = findBuilder(["show-toolbar", name]);
11
- return (_jsxs(Show, { actions: _jsx(ShowToolbar, {}), queryOptions: { meta: { key: pk } }, children: [_jsx(SimpleShowLayout, { children: buildAdmin(["show-fields", name], show) }), children] }));
11
+ return (_jsxs(Show, { actions: _jsx(ShowToolbar, {}), queryOptions: { meta: { key } }, children: [_jsx(SimpleShowLayout, { children: buildAdmin(["show-fields", name], show) }), children] }));
12
12
  }
13
13
  setupAdmin(["show"], MuffinShow);
14
14
  setupAdmin(["show-fields"], ({ fields }) => buildRA(fields));
@@ -118,7 +118,7 @@ export function MuffinDataprovider(apiUrl) {
118
118
  action = action.replace(/\{([^}]+)\}/, (_, field) => record[field]);
119
119
  }
120
120
  const { json } = yield makeRequest(`${apiUrl}/${action}`, {
121
- query: { pks: ids },
121
+ query: { ids },
122
122
  method: "POST",
123
123
  data: payload,
124
124
  });
package/dist/index.d.ts CHANGED
@@ -19,4 +19,4 @@ export * from "./fields";
19
19
  export * from "./hooks";
20
20
  export * from "./types";
21
21
  export declare function initAdmin(prefix?: string, containerId?: string): Promise<void>;
22
- export declare const VERSION = "10.0.1";
22
+ export declare const VERSION = "11.1.0";
package/dist/index.js CHANGED
@@ -42,4 +42,4 @@ export function initAdmin() {
42
42
  root.render(_jsx(MuffinAdminContext.Provider, { value: adminOpts, children: _jsx(MuffinAdmin, {}) }));
43
43
  });
44
44
  }
45
- export const VERSION = "10.0.1";
45
+ export const VERSION = "11.1.0";
@@ -21,10 +21,10 @@ export function FKInput(_a) {
21
21
  var { refKey, refSource, fullWidth, reference, source } = _a, props = __rest(_a, ["refKey", "refSource", "fullWidth", "reference", "source"]);
22
22
  refKey = refKey || "id";
23
23
  const renderText = (record) => {
24
- const pk = record[refKey];
24
+ const key = record[refKey];
25
25
  if (refKey == refSource)
26
- return `#${pk}`;
27
- return (pk && `${record[refSource]} (#${pk})`) || "";
26
+ return `#${key}`;
27
+ return (key && `${record[refSource]} (#${key})`) || "";
28
28
  };
29
29
  return (_jsx(ReferenceInput, { reference: reference, source: source, queryOptions: {
30
30
  meta: { key: refKey },