muffin-admin 10.0.1 → 11.0.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.
package/dist/types.d.ts CHANGED
@@ -45,7 +45,7 @@ export type AdminPayloadProps = {
45
45
  help?: string;
46
46
  };
47
47
  export type AdminResourceProps = {
48
- pk: string;
48
+ key: string;
49
49
  name: string;
50
50
  group?: string;
51
51
  icon?: string;
package/dist/utils.d.ts CHANGED
@@ -9,7 +9,7 @@ export type APIParams = {
9
9
  limit?: number;
10
10
  offset?: number;
11
11
  sort?: string;
12
- pks?: string[];
12
+ ids?: string[];
13
13
  };
14
14
  data?: any;
15
15
  headers?: any;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "muffin-admin",
3
- "version": "10.0.1",
3
+ "version": "11.0.0",
4
4
  "description": "NPM package for https://github.com/klen/muffin-admin",
5
5
  "files": [
6
6
  "src",
@@ -20,7 +20,7 @@ export function MuffinEdit({ children }: PropsWithChildren) {
20
20
  adminProps: { mutationMode = "optimistic" },
21
21
  } = useMuffinAdminOpts()
22
22
 
23
- const { edit, name, pk } = useMuffinResourceOpts()
23
+ const { edit, name, key } = useMuffinResourceOpts()
24
24
  if (!edit) return null
25
25
 
26
26
  const Actions = findBuilder(["edit-toolbar", name])
@@ -28,7 +28,7 @@ export function MuffinEdit({ children }: PropsWithChildren) {
28
28
  const FormToolbar = findBuilder(["edit-form-toolbar", name])
29
29
 
30
30
  return (
31
- <Edit actions={<Actions />} mutationMode={mutationMode} queryOptions={{ meta: { key: pk } }}>
31
+ <Edit actions={<Actions />} mutationMode={mutationMode} queryOptions={{ meta: { key } }}>
32
32
  {children}
33
33
  <SimpleForm toolbar={<FormToolbar />}>
34
34
  <Inputs />
@@ -23,7 +23,7 @@ import { AdminInput } from "./types"
23
23
  import { buildAdmin, findBuilder, setupAdmin } from "./utils"
24
24
 
25
25
  export function MuffinList({ children }: PropsWithChildren) {
26
- const { name, list, pk } = useMuffinResourceOpts()
26
+ const { name, list, key } = useMuffinResourceOpts()
27
27
  const { limit, limitMax, limitTotal, sort, filters } = list
28
28
 
29
29
  const DataGrid = findBuilder(["list-grid", name])
@@ -36,7 +36,7 @@ export function MuffinList({ children }: PropsWithChildren) {
36
36
  perPage={limit}
37
37
  filters={raFilters}
38
38
  actions={<Toolbar />}
39
- queryOptions={{ meta: { key: pk } }}
39
+ queryOptions={{ meta: { key } }}
40
40
  pagination={
41
41
  <Pagination rowsPerPageOptions={sortBy(uniq([10, 25, 50, 100, limit, limitMax]))} />
42
42
  }
@@ -50,7 +50,7 @@ export function MuffinList({ children }: PropsWithChildren) {
50
50
  perPage={limit}
51
51
  filters={raFilters}
52
52
  actions={<Toolbar />}
53
- queryOptions={{ meta: { key: pk } }}
53
+ queryOptions={{ meta: { key } }}
54
54
  >
55
55
  {children}
56
56
  <DataGrid />
@@ -7,11 +7,11 @@ import { useMuffinResourceOpts } from "./hooks"
7
7
  import { buildAdmin, findBuilder, setupAdmin } from "./utils"
8
8
 
9
9
  export function MuffinShow({ children }: PropsWithChildren) {
10
- const { show, name, pk } = useMuffinResourceOpts()
10
+ const { show, name, key } = useMuffinResourceOpts()
11
11
  const ShowToolbar = findBuilder(["show-toolbar", name])
12
12
 
13
13
  return (
14
- <Show actions={<ShowToolbar />} queryOptions={{ meta: { key: pk } }}>
14
+ <Show actions={<ShowToolbar />} queryOptions={{ meta: { key } }}>
15
15
  <SimpleShowLayout>{buildAdmin(["show-fields", name], show)}</SimpleShowLayout>
16
16
  {children}
17
17
  </Show>
@@ -109,7 +109,7 @@ export function MuffinDataprovider(apiUrl: string) {
109
109
  action = action.replace(/\{([^}]+)\}/, (_, field) => record[field])
110
110
  }
111
111
  const { json } = await makeRequest(`${apiUrl}/${action}`, {
112
- query: { pks: ids },
112
+ query: { ids },
113
113
  method: "POST",
114
114
  data: payload,
115
115
  })
package/src/index.tsx CHANGED
@@ -37,4 +37,4 @@ export async function initAdmin(prefix = "", containerId: string = "root") {
37
37
  )
38
38
  }
39
39
 
40
- export const VERSION = "10.0.1"
40
+ export const VERSION = "11.0.0"
@@ -10,9 +10,9 @@ export function FKInput({ refKey, refSource, fullWidth, reference, source, ...pr
10
10
 
11
11
  refKey = refKey || "id"
12
12
  const renderText = (record) => {
13
- const pk = record[refKey]
14
- if (refKey == refSource) return `#${pk}`
15
- return (pk && `${record[refSource]} (#${pk})`) || ""
13
+ const key = record[refKey]
14
+ if (refKey == refSource) return `#${key}`
15
+ return (key && `${record[refSource]} (#${key})`) || ""
16
16
  }
17
17
 
18
18
  return (
package/src/types.ts CHANGED
@@ -81,7 +81,7 @@ export type AdminPayloadProps = {
81
81
  }
82
82
 
83
83
  export type AdminResourceProps = {
84
- pk: string
84
+ key: string
85
85
  name: string
86
86
  group?: string
87
87
  icon?: string
package/src/utils.tsx CHANGED
@@ -36,7 +36,7 @@ export type APIParams = {
36
36
  limit?: number
37
37
  offset?: number
38
38
  sort?: string
39
- pks?: string[]
39
+ ids?: string[]
40
40
  }
41
41
  data?: any
42
42
  headers?: any