muffin-admin 2.8.0 → 2.9.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/MuffinResourceList.js +12 -5
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/types.d.ts +1 -0
- package/package.json +1 -1
- package/src/MuffinResourceList.tsx +38 -14
- package/src/types.ts +1 -0
package/dist/types.d.ts
CHANGED
package/package.json
CHANGED
|
@@ -1,32 +1,44 @@
|
|
|
1
1
|
import sortBy from "lodash/sortBy"
|
|
2
2
|
import uniq from "lodash/uniq"
|
|
3
|
-
import {
|
|
3
|
+
import {
|
|
4
|
+
BulkDeleteButton,
|
|
5
|
+
CreateButton,
|
|
6
|
+
DatagridConfigurable,
|
|
7
|
+
EditButton,
|
|
8
|
+
ExportButton,
|
|
9
|
+
FilterButton,
|
|
10
|
+
List,
|
|
11
|
+
Pagination,
|
|
12
|
+
SelectColumnsButton,
|
|
13
|
+
TopToolbar,
|
|
14
|
+
} from "react-admin"
|
|
4
15
|
import { buildRA } from "./buildRA"
|
|
5
16
|
import { BulkActionButton } from "./buttons"
|
|
6
17
|
import { useMuffinResourceOpts } from "./hooks"
|
|
7
|
-
import { AdminAction } from "./types"
|
|
8
18
|
import { buildAdmin, findBuilder, setupAdmin } from "./utils"
|
|
9
19
|
|
|
10
20
|
export function MuffinResourceList() {
|
|
11
21
|
const { name, list } = useMuffinResourceOpts()
|
|
12
|
-
const { fields, edit, show, limit, limitMax, filters,
|
|
22
|
+
const { fields, edit, show, limit, limitMax, filters, sort } = list
|
|
13
23
|
|
|
14
24
|
const Actions = findBuilder(["list-actions", name])
|
|
25
|
+
const BulkActions = findBuilder(["list-bulk-actions", name])
|
|
15
26
|
|
|
16
27
|
return (
|
|
17
28
|
<List
|
|
18
29
|
sort={sort}
|
|
19
30
|
perPage={limit}
|
|
31
|
+
actions={<Actions />}
|
|
20
32
|
filters={buildAdmin(["list-filters", name], filters)}
|
|
21
|
-
bulkActionButtons={<
|
|
33
|
+
bulkActionButtons={<BulkActions />}
|
|
22
34
|
pagination={
|
|
23
35
|
<Pagination rowsPerPageOptions={sortBy(uniq([10, 25, 50, 100, limit, limitMax]))} />
|
|
24
36
|
}
|
|
25
37
|
>
|
|
26
|
-
<
|
|
38
|
+
<DatagridConfigurable rowClick={show ? "show" : edit ? "edit" : false}>
|
|
27
39
|
{buildAdmin(["list-fields", name], fields)}
|
|
28
40
|
{edit && <EditButton />}
|
|
29
|
-
</
|
|
41
|
+
</DatagridConfigurable>
|
|
30
42
|
</List>
|
|
31
43
|
)
|
|
32
44
|
}
|
|
@@ -36,13 +48,25 @@ setupAdmin(["list-fields"], buildRA)
|
|
|
36
48
|
|
|
37
49
|
setupAdmin(["list-filters"], buildRA)
|
|
38
50
|
|
|
39
|
-
function
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
51
|
+
function MuffinListActions() {
|
|
52
|
+
const {
|
|
53
|
+
list: { create },
|
|
54
|
+
} = useMuffinResourceOpts()
|
|
55
|
+
return (
|
|
56
|
+
<TopToolbar>
|
|
57
|
+
<SelectColumnsButton />
|
|
58
|
+
<FilterButton />
|
|
59
|
+
{create && <CreateButton />}
|
|
60
|
+
<ExportButton />
|
|
61
|
+
</TopToolbar>
|
|
62
|
+
)
|
|
63
|
+
}
|
|
64
|
+
setupAdmin(["list-actions"], MuffinListActions)
|
|
65
|
+
|
|
66
|
+
function MuffinListBulkActions() {
|
|
67
|
+
const {
|
|
68
|
+
list: { actions, remove },
|
|
69
|
+
} = useMuffinResourceOpts()
|
|
46
70
|
return (
|
|
47
71
|
<>
|
|
48
72
|
{actions.map((props) => (
|
|
@@ -53,4 +77,4 @@ function MuffinResourceListActions({
|
|
|
53
77
|
)
|
|
54
78
|
}
|
|
55
79
|
|
|
56
|
-
setupAdmin(["list-actions"],
|
|
80
|
+
setupAdmin(["list-bulk-actions"], MuffinListBulkActions)
|