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.
- package/dist/MuffinResourceEdit.js +2 -2
- package/dist/MuffinResourceList.js +2 -2
- package/dist/MuffinResourceShow.js +2 -2
- package/dist/dataprovider.js +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/inputs/FKInput.js +3 -3
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/types.d.ts +1 -1
- package/dist/utils.d.ts +1 -1
- package/package.json +1 -1
- package/src/MuffinResourceEdit.tsx +2 -2
- package/src/MuffinResourceList.tsx +3 -3
- package/src/MuffinResourceShow.tsx +2 -2
- package/src/dataprovider.ts +1 -1
- package/src/index.tsx +1 -1
- package/src/inputs/FKInput.tsx +3 -3
- package/src/types.ts +1 -1
- package/src/utils.tsx +1 -1
package/dist/types.d.ts
CHANGED
package/dist/utils.d.ts
CHANGED
package/package.json
CHANGED
|
@@ -20,7 +20,7 @@ export function MuffinEdit({ children }: PropsWithChildren) {
|
|
|
20
20
|
adminProps: { mutationMode = "optimistic" },
|
|
21
21
|
} = useMuffinAdminOpts()
|
|
22
22
|
|
|
23
|
-
const { edit, name,
|
|
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
|
|
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,
|
|
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
|
|
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
|
|
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,
|
|
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
|
|
14
|
+
<Show actions={<ShowToolbar />} queryOptions={{ meta: { key } }}>
|
|
15
15
|
<SimpleShowLayout>{buildAdmin(["show-fields", name], show)}</SimpleShowLayout>
|
|
16
16
|
{children}
|
|
17
17
|
</Show>
|
package/src/dataprovider.ts
CHANGED
|
@@ -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: {
|
|
112
|
+
query: { ids },
|
|
113
113
|
method: "POST",
|
|
114
114
|
data: payload,
|
|
115
115
|
})
|
package/src/index.tsx
CHANGED
package/src/inputs/FKInput.tsx
CHANGED
|
@@ -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
|
|
14
|
-
if (refKey == refSource) return `#${
|
|
15
|
-
return (
|
|
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