muffin-admin 1.44.4 → 1.45.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/MuffinAdmin.d.ts +2 -0
- package/dist/MuffinAdmin.js +25 -0
- package/dist/MuffinDashboard.d.ts +2 -0
- package/dist/MuffinDashboard.js +16 -0
- package/dist/MuffinResource.d.ts +2 -0
- package/dist/MuffinResource.js +19 -0
- package/dist/MuffinResourceCreate.d.ts +4 -0
- package/dist/MuffinResourceCreate.js +11 -0
- package/dist/MuffinResourceEdit.d.ts +2 -0
- package/dist/MuffinResourceEdit.js +26 -0
- package/dist/MuffinResourceList.d.ts +2 -0
- package/dist/MuffinResourceList.js +16 -0
- package/dist/MuffinResourceShow.d.ts +2 -0
- package/dist/MuffinResourceShow.js +13 -0
- package/dist/actions/LinkAction.d.ts +4 -0
- package/dist/actions/LinkAction.js +10 -0
- package/dist/actions/index.d.ts +1 -0
- package/dist/actions/index.js +1 -0
- package/dist/authprovider.d.ts +9 -0
- package/dist/authprovider.js +80 -0
- package/dist/buildRA.d.ts +2 -0
- package/dist/buildRA.js +63 -0
- package/dist/buttons/ActionButton.d.ts +7 -0
- package/dist/buttons/ActionButton.js +51 -0
- package/dist/buttons/LinkButton.d.ts +6 -0
- package/dist/buttons/LinkButton.js +12 -0
- package/dist/buttons/index.d.ts +2 -0
- package/dist/buttons/index.js +2 -0
- package/dist/dataprovider.d.ts +59 -0
- package/dist/dataprovider.js +106 -0
- package/dist/fields/AvatarField.d.ts +13 -0
- package/dist/fields/AvatarField.js +33 -0
- package/dist/fields/EditableBooleanField.d.ts +3 -0
- package/dist/fields/EditableBooleanField.js +5 -0
- package/dist/fields/FKField.d.ts +14 -0
- package/dist/fields/FKField.js +21 -0
- package/dist/fields/JsonField.d.ts +4 -0
- package/dist/fields/JsonField.js +11 -0
- package/dist/fields/index.d.ts +4 -0
- package/dist/fields/index.js +4 -0
- package/dist/hooks/useAction.d.ts +5 -0
- package/dist/hooks/useAction.js +6 -0
- package/dist/index.d.ts +14 -0
- package/dist/index.js +35 -0
- package/dist/inputs/FKInput.d.ts +8 -0
- package/dist/inputs/FKInput.js +27 -0
- package/dist/inputs/JsonInput.d.ts +19 -0
- package/dist/inputs/JsonInput.js +69 -0
- package/dist/inputs/index.d.ts +2 -0
- package/dist/inputs/index.js +2 -0
- package/dist/tsconfig.tsbuildinfo +1 -0
- package/dist/types.d.ts +76 -0
- package/dist/types.js +1 -0
- package/dist/utils.d.ts +28 -0
- package/dist/utils.js +57 -0
- package/dist/web.d.ts +1 -0
- package/dist/web.js +3 -0
- package/package.json +31 -14
- package/src/MuffinAdmin.tsx +73 -0
- package/src/MuffinDashboard.tsx +52 -0
- package/src/MuffinResource.tsx +27 -0
- package/src/MuffinResourceCreate.tsx +24 -0
- package/src/MuffinResourceEdit.tsx +42 -0
- package/src/MuffinResourceList.tsx +46 -0
- package/src/MuffinResourceShow.tsx +39 -0
- package/src/actions/LinkAction.tsx +10 -0
- package/src/actions/index.ts +1 -0
- package/src/{authprovider.js → authprovider.ts} +27 -22
- package/src/{ui.jsx → buildRA.tsx} +30 -35
- package/src/buttons/{ActionButton.jsx → ActionButton.tsx} +18 -30
- package/src/buttons/{LinkButton.jsx → LinkButton.tsx} +11 -6
- package/src/buttons/index.ts +2 -0
- package/src/{dataprovider.js → dataprovider.ts} +8 -6
- package/src/fields/{AvatarField.jsx → AvatarField.tsx} +3 -7
- package/src/fields/EditableBooleanField.tsx +5 -0
- package/src/fields/{FKField.jsx → FKField.tsx} +2 -10
- package/src/fields/{JsonField.jsx → JsonField.tsx} +2 -3
- package/src/fields/index.ts +4 -0
- package/src/hooks/{useAction.js → useAction.ts} +2 -2
- package/src/index.tsx +25 -0
- package/src/inputs/FKInput.tsx +27 -0
- package/src/inputs/{JsonInput.jsx → JsonInput.tsx} +3 -4
- package/src/inputs/index.ts +2 -0
- package/src/types.ts +73 -0
- package/src/utils.tsx +69 -0
- package/src/web.ts +4 -0
- package/dist/cjs/admin.js +0 -80
- package/dist/cjs/authprovider.js +0 -214
- package/dist/cjs/buttons/ActionButton.js +0 -96
- package/dist/cjs/buttons/LinkButton.js +0 -34
- package/dist/cjs/dashboard.js +0 -63
- package/dist/cjs/dataprovider.js +0 -304
- package/dist/cjs/fields/AvatarField.js +0 -37
- package/dist/cjs/fields/EditableBooleanField.js +0 -25
- package/dist/cjs/fields/FKField.js +0 -35
- package/dist/cjs/fields/JsonField.js +0 -38
- package/dist/cjs/hooks/useAction.js +0 -14
- package/dist/cjs/index.js +0 -76
- package/dist/cjs/inputs/FKInput.js +0 -41
- package/dist/cjs/inputs/JsonInput.js +0 -70
- package/dist/cjs/resources.js +0 -52
- package/dist/cjs/ui.js +0 -76
- package/dist/cjs/utils.js +0 -49
- package/dist/cjs/views/create.js +0 -18
- package/dist/cjs/views/edit.js +0 -31
- package/dist/cjs/views/list.js +0 -67
- package/dist/cjs/views/show.js +0 -37
- package/dist/cjs/web.js +0 -4
- package/dist/esm/admin.js +0 -74
- package/dist/esm/authprovider.js +0 -206
- package/dist/esm/buttons/ActionButton.js +0 -83
- package/dist/esm/buttons/LinkButton.js +0 -23
- package/dist/esm/dashboard.js +0 -60
- package/dist/esm/dataprovider.js +0 -296
- package/dist/esm/fields/AvatarField.js +0 -29
- package/dist/esm/fields/EditableBooleanField.js +0 -17
- package/dist/esm/fields/FKField.js +0 -27
- package/dist/esm/fields/JsonField.js +0 -28
- package/dist/esm/hooks/useAction.js +0 -8
- package/dist/esm/index.js +0 -42
- package/dist/esm/inputs/FKInput.js +0 -33
- package/dist/esm/inputs/JsonInput.js +0 -63
- package/dist/esm/resources.js +0 -47
- package/dist/esm/ui.js +0 -70
- package/dist/esm/utils.js +0 -38
- package/dist/esm/views/create.js +0 -16
- package/dist/esm/views/edit.js +0 -29
- package/dist/esm/views/list.js +0 -64
- package/dist/esm/views/show.js +0 -35
- package/dist/esm/web.js +0 -2
- package/src/admin.jsx +0 -78
- package/src/dashboard.jsx +0 -74
- package/src/fields/EditableBooleanField.jsx +0 -11
- package/src/index.js +0 -16
- package/src/inputs/FKInput.jsx +0 -42
- package/src/resources.jsx +0 -39
- package/src/utils.js +0 -38
- package/src/views/create.jsx +0 -30
- package/src/views/edit.jsx +0 -48
- package/src/views/list.jsx +0 -86
- package/src/views/show.jsx +0 -51
- package/src/web.js +0 -3
package/src/views/create.jsx
DELETED
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
import React from "react"
|
|
2
|
-
|
|
3
|
-
import { Create, SimpleForm, TopToolbar, ListButton } from "react-admin"
|
|
4
|
-
|
|
5
|
-
import initRAItems from "../ui"
|
|
6
|
-
import { checkParams, processAdmin, setupAdmin } from "../utils"
|
|
7
|
-
|
|
8
|
-
// Initialize a create component
|
|
9
|
-
setupAdmin(
|
|
10
|
-
"create",
|
|
11
|
-
checkParams(
|
|
12
|
-
(inputs, res) =>
|
|
13
|
-
function MACreate(props) {
|
|
14
|
-
const Actions = (
|
|
15
|
-
<TopToolbar>
|
|
16
|
-
<ListButton />
|
|
17
|
-
</TopToolbar>
|
|
18
|
-
)
|
|
19
|
-
|
|
20
|
-
return (
|
|
21
|
-
<Create actions={Actions} {...props}>
|
|
22
|
-
<SimpleForm>
|
|
23
|
-
{processAdmin("create-inputs", inputs, res)}
|
|
24
|
-
</SimpleForm>
|
|
25
|
-
</Create>
|
|
26
|
-
)
|
|
27
|
-
}
|
|
28
|
-
)
|
|
29
|
-
)
|
|
30
|
-
setupAdmin("create-inputs", initRAItems)
|
package/src/views/edit.jsx
DELETED
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
import React from "react"
|
|
2
|
-
|
|
3
|
-
import {
|
|
4
|
-
Edit,
|
|
5
|
-
ListButton,
|
|
6
|
-
ShowButton,
|
|
7
|
-
SimpleForm,
|
|
8
|
-
TopToolbar,
|
|
9
|
-
} from "react-admin"
|
|
10
|
-
|
|
11
|
-
import initRAItems from "../ui"
|
|
12
|
-
import { checkParams, processAdmin, setupAdmin } from "../utils"
|
|
13
|
-
import { ActionButton } from "../buttons/ActionButton"
|
|
14
|
-
|
|
15
|
-
// Initialize an edit component
|
|
16
|
-
setupAdmin(
|
|
17
|
-
"edit",
|
|
18
|
-
checkParams((props, name) => {
|
|
19
|
-
let { edit, adminProps } = props
|
|
20
|
-
let { actions, inputs } = edit
|
|
21
|
-
|
|
22
|
-
function MAEdit(props) {
|
|
23
|
-
const Actions = () => (
|
|
24
|
-
<TopToolbar>
|
|
25
|
-
{actions.map((props, idx) => {
|
|
26
|
-
return <ActionButton key={idx} {...props} />
|
|
27
|
-
})}
|
|
28
|
-
<ListButton />
|
|
29
|
-
<ShowButton />
|
|
30
|
-
</TopToolbar>
|
|
31
|
-
)
|
|
32
|
-
|
|
33
|
-
return (
|
|
34
|
-
<Edit
|
|
35
|
-
actions={<Actions />}
|
|
36
|
-
mutationMode={adminProps.mutationMode || "optimistic"}
|
|
37
|
-
{...props}
|
|
38
|
-
>
|
|
39
|
-
<SimpleForm>{processAdmin("edit-inputs", inputs, name)}</SimpleForm>
|
|
40
|
-
</Edit>
|
|
41
|
-
)
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
return MAEdit
|
|
45
|
-
})
|
|
46
|
-
)
|
|
47
|
-
|
|
48
|
-
setupAdmin("edit-inputs", initRAItems)
|
package/src/views/list.jsx
DELETED
|
@@ -1,86 +0,0 @@
|
|
|
1
|
-
import React from "react"
|
|
2
|
-
|
|
3
|
-
import {
|
|
4
|
-
BulkDeleteButton,
|
|
5
|
-
Datagrid,
|
|
6
|
-
EditButton,
|
|
7
|
-
Filter,
|
|
8
|
-
List,
|
|
9
|
-
Pagination,
|
|
10
|
-
} from "react-admin"
|
|
11
|
-
import uniq from "lodash/uniq"
|
|
12
|
-
import sortBy from "lodash/sortBy"
|
|
13
|
-
|
|
14
|
-
import initRAItems from "../ui"
|
|
15
|
-
import { checkParams, processAdmin, setupAdmin } from "../utils"
|
|
16
|
-
import { BulkActionButton } from "../buttons/ActionButton"
|
|
17
|
-
|
|
18
|
-
const defaultPagination = <Pagination rowsPerPageOptions={[10, 25, 50, 100]} />
|
|
19
|
-
|
|
20
|
-
// Initiliaze a list component
|
|
21
|
-
setupAdmin(
|
|
22
|
-
"list",
|
|
23
|
-
checkParams((props, res) => {
|
|
24
|
-
let {
|
|
25
|
-
children,
|
|
26
|
-
filters,
|
|
27
|
-
edit,
|
|
28
|
-
pagination,
|
|
29
|
-
show,
|
|
30
|
-
limit,
|
|
31
|
-
limitMax,
|
|
32
|
-
actions,
|
|
33
|
-
...listProps
|
|
34
|
-
} = props
|
|
35
|
-
|
|
36
|
-
children = processAdmin("list-fields", children, res)
|
|
37
|
-
if (edit) children.push(<EditButton key="edit-button" />)
|
|
38
|
-
|
|
39
|
-
pagination = pagination || (
|
|
40
|
-
<Pagination
|
|
41
|
-
rowsPerPageOptions={sortBy(uniq([10, 25, 50, 100, limit, limitMax]))}
|
|
42
|
-
/>
|
|
43
|
-
)
|
|
44
|
-
|
|
45
|
-
return function MAList(props) {
|
|
46
|
-
let Filters = (props) => (
|
|
47
|
-
<Filter {...props}>{processAdmin("list-filters", filters, res)}</Filter>
|
|
48
|
-
)
|
|
49
|
-
let Actions = processAdmin("list-bulkActions", actions)
|
|
50
|
-
|
|
51
|
-
props = { ...props, ...listProps }
|
|
52
|
-
return (
|
|
53
|
-
<List
|
|
54
|
-
filters={<Filters />}
|
|
55
|
-
bulkActionButtons={<Actions />}
|
|
56
|
-
perPage={limit}
|
|
57
|
-
pagination={pagination || defaultPagination}
|
|
58
|
-
{...props}
|
|
59
|
-
>
|
|
60
|
-
<Datagrid rowClick={show ? "show" : null}>{children}</Datagrid>
|
|
61
|
-
</List>
|
|
62
|
-
)
|
|
63
|
-
}
|
|
64
|
-
})
|
|
65
|
-
)
|
|
66
|
-
|
|
67
|
-
setupAdmin(
|
|
68
|
-
"list-bulkActions",
|
|
69
|
-
(actions) =>
|
|
70
|
-
function MABulkActions(props) {
|
|
71
|
-
let buttons = actions.map((action, idx) => {
|
|
72
|
-
let aProps = { ...action, ...props }
|
|
73
|
-
return <BulkActionButton key={idx} {...aProps} />
|
|
74
|
-
})
|
|
75
|
-
|
|
76
|
-
return (
|
|
77
|
-
<>
|
|
78
|
-
{buttons}
|
|
79
|
-
<BulkDeleteButton {...props} />
|
|
80
|
-
</>
|
|
81
|
-
)
|
|
82
|
-
}
|
|
83
|
-
)
|
|
84
|
-
|
|
85
|
-
setupAdmin("list-filters", initRAItems)
|
|
86
|
-
setupAdmin("list-fields", initRAItems)
|
package/src/views/show.jsx
DELETED
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
import React from "react"
|
|
2
|
-
|
|
3
|
-
import {
|
|
4
|
-
ListButton,
|
|
5
|
-
EditButton,
|
|
6
|
-
Show,
|
|
7
|
-
SimpleShowLayout,
|
|
8
|
-
TopToolbar,
|
|
9
|
-
} from "react-admin"
|
|
10
|
-
|
|
11
|
-
import initRAItems from "../ui"
|
|
12
|
-
import { checkParams, processAdmin, setupAdmin } from "../utils"
|
|
13
|
-
import { ActionButton } from "../buttons/ActionButton"
|
|
14
|
-
|
|
15
|
-
// Initiliaze a show component
|
|
16
|
-
setupAdmin(
|
|
17
|
-
"show",
|
|
18
|
-
checkParams(
|
|
19
|
-
({ actions, fields }, resource) =>
|
|
20
|
-
function MAShow(props) {
|
|
21
|
-
return (
|
|
22
|
-
<Show
|
|
23
|
-
actions={processAdmin(
|
|
24
|
-
"show-actions",
|
|
25
|
-
{ actions, resource },
|
|
26
|
-
resource
|
|
27
|
-
)}
|
|
28
|
-
{...props}
|
|
29
|
-
>
|
|
30
|
-
<SimpleShowLayout>
|
|
31
|
-
{processAdmin("show-fields", fields, resource)}
|
|
32
|
-
</SimpleShowLayout>
|
|
33
|
-
</Show>
|
|
34
|
-
)
|
|
35
|
-
}
|
|
36
|
-
)
|
|
37
|
-
)
|
|
38
|
-
|
|
39
|
-
/* Actions */
|
|
40
|
-
setupAdmin("show-actions", ({ actions, resource }) => (
|
|
41
|
-
<TopToolbar>
|
|
42
|
-
{actions.map((props, idx) => (
|
|
43
|
-
<ActionButton key={idx} resource={resource} {...props} />
|
|
44
|
-
))}
|
|
45
|
-
<ListButton />
|
|
46
|
-
<EditButton />
|
|
47
|
-
</TopToolbar>
|
|
48
|
-
))
|
|
49
|
-
|
|
50
|
-
/* Fields */
|
|
51
|
-
setupAdmin("show-fields", initRAItems)
|
package/src/web.js
DELETED