muffin-admin 1.44.3 → 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.
Files changed (142) hide show
  1. package/dist/MuffinAdmin.d.ts +2 -0
  2. package/dist/MuffinAdmin.js +25 -0
  3. package/dist/MuffinDashboard.d.ts +2 -0
  4. package/dist/MuffinDashboard.js +16 -0
  5. package/dist/MuffinResource.d.ts +2 -0
  6. package/dist/MuffinResource.js +19 -0
  7. package/dist/MuffinResourceCreate.d.ts +4 -0
  8. package/dist/MuffinResourceCreate.js +11 -0
  9. package/dist/MuffinResourceEdit.d.ts +2 -0
  10. package/dist/MuffinResourceEdit.js +26 -0
  11. package/dist/MuffinResourceList.d.ts +2 -0
  12. package/dist/MuffinResourceList.js +16 -0
  13. package/dist/MuffinResourceShow.d.ts +2 -0
  14. package/dist/MuffinResourceShow.js +13 -0
  15. package/dist/actions/LinkAction.d.ts +4 -0
  16. package/dist/actions/LinkAction.js +10 -0
  17. package/dist/actions/index.d.ts +1 -0
  18. package/dist/actions/index.js +1 -0
  19. package/dist/authprovider.d.ts +9 -0
  20. package/dist/authprovider.js +80 -0
  21. package/dist/buildRA.d.ts +2 -0
  22. package/dist/buildRA.js +63 -0
  23. package/dist/buttons/ActionButton.d.ts +7 -0
  24. package/dist/buttons/ActionButton.js +51 -0
  25. package/dist/buttons/LinkButton.d.ts +6 -0
  26. package/dist/buttons/LinkButton.js +12 -0
  27. package/dist/buttons/index.d.ts +2 -0
  28. package/dist/buttons/index.js +2 -0
  29. package/dist/dataprovider.d.ts +59 -0
  30. package/dist/dataprovider.js +106 -0
  31. package/dist/fields/AvatarField.d.ts +13 -0
  32. package/dist/fields/AvatarField.js +33 -0
  33. package/dist/fields/EditableBooleanField.d.ts +3 -0
  34. package/dist/fields/EditableBooleanField.js +5 -0
  35. package/dist/fields/FKField.d.ts +14 -0
  36. package/dist/fields/FKField.js +21 -0
  37. package/dist/fields/JsonField.d.ts +4 -0
  38. package/dist/fields/JsonField.js +11 -0
  39. package/dist/fields/index.d.ts +4 -0
  40. package/dist/fields/index.js +4 -0
  41. package/dist/hooks/useAction.d.ts +5 -0
  42. package/dist/hooks/useAction.js +6 -0
  43. package/dist/index.d.ts +14 -0
  44. package/dist/index.js +35 -0
  45. package/dist/inputs/FKInput.d.ts +8 -0
  46. package/dist/inputs/FKInput.js +27 -0
  47. package/dist/inputs/JsonInput.d.ts +19 -0
  48. package/dist/inputs/JsonInput.js +69 -0
  49. package/dist/inputs/index.d.ts +2 -0
  50. package/dist/inputs/index.js +2 -0
  51. package/dist/tsconfig.tsbuildinfo +1 -0
  52. package/dist/types.d.ts +76 -0
  53. package/dist/types.js +1 -0
  54. package/dist/utils.d.ts +28 -0
  55. package/dist/utils.js +57 -0
  56. package/dist/web.d.ts +1 -0
  57. package/dist/web.js +3 -0
  58. package/package.json +31 -14
  59. package/src/MuffinAdmin.tsx +73 -0
  60. package/src/MuffinDashboard.tsx +52 -0
  61. package/src/MuffinResource.tsx +27 -0
  62. package/src/MuffinResourceCreate.tsx +24 -0
  63. package/src/MuffinResourceEdit.tsx +42 -0
  64. package/src/MuffinResourceList.tsx +46 -0
  65. package/src/MuffinResourceShow.tsx +39 -0
  66. package/src/actions/LinkAction.tsx +10 -0
  67. package/src/actions/index.ts +1 -0
  68. package/src/{authprovider.js → authprovider.ts} +27 -22
  69. package/src/{ui.jsx → buildRA.tsx} +30 -35
  70. package/src/buttons/{ActionButton.jsx → ActionButton.tsx} +18 -30
  71. package/src/buttons/{LinkButton.jsx → LinkButton.tsx} +11 -6
  72. package/src/buttons/index.ts +2 -0
  73. package/src/{dataprovider.js → dataprovider.ts} +8 -6
  74. package/src/fields/{AvatarField.jsx → AvatarField.tsx} +3 -7
  75. package/src/fields/EditableBooleanField.tsx +5 -0
  76. package/src/fields/{FKField.jsx → FKField.tsx} +2 -10
  77. package/src/fields/{JsonField.jsx → JsonField.tsx} +2 -3
  78. package/src/fields/index.ts +4 -0
  79. package/src/hooks/{useAction.js → useAction.ts} +2 -2
  80. package/src/index.tsx +25 -0
  81. package/src/inputs/FKInput.tsx +27 -0
  82. package/src/inputs/{JsonInput.jsx → JsonInput.tsx} +3 -4
  83. package/src/inputs/index.ts +2 -0
  84. package/src/types.ts +73 -0
  85. package/src/utils.tsx +69 -0
  86. package/src/web.ts +4 -0
  87. package/dist/cjs/admin.js +0 -80
  88. package/dist/cjs/authprovider.js +0 -214
  89. package/dist/cjs/buttons/ActionButton.js +0 -96
  90. package/dist/cjs/buttons/LinkButton.js +0 -34
  91. package/dist/cjs/dashboard.js +0 -63
  92. package/dist/cjs/dataprovider.js +0 -304
  93. package/dist/cjs/fields/AvatarField.js +0 -37
  94. package/dist/cjs/fields/EditableBooleanField.js +0 -25
  95. package/dist/cjs/fields/FKField.js +0 -35
  96. package/dist/cjs/fields/JsonField.js +0 -38
  97. package/dist/cjs/hooks/useAction.js +0 -14
  98. package/dist/cjs/index.js +0 -76
  99. package/dist/cjs/inputs/FKInput.js +0 -41
  100. package/dist/cjs/inputs/JsonInput.js +0 -70
  101. package/dist/cjs/resources.js +0 -52
  102. package/dist/cjs/ui.js +0 -76
  103. package/dist/cjs/utils.js +0 -49
  104. package/dist/cjs/views/create.js +0 -18
  105. package/dist/cjs/views/edit.js +0 -31
  106. package/dist/cjs/views/list.js +0 -67
  107. package/dist/cjs/views/show.js +0 -37
  108. package/dist/cjs/web.js +0 -4
  109. package/dist/esm/admin.js +0 -74
  110. package/dist/esm/authprovider.js +0 -206
  111. package/dist/esm/buttons/ActionButton.js +0 -83
  112. package/dist/esm/buttons/LinkButton.js +0 -23
  113. package/dist/esm/dashboard.js +0 -60
  114. package/dist/esm/dataprovider.js +0 -296
  115. package/dist/esm/fields/AvatarField.js +0 -29
  116. package/dist/esm/fields/EditableBooleanField.js +0 -17
  117. package/dist/esm/fields/FKField.js +0 -27
  118. package/dist/esm/fields/JsonField.js +0 -28
  119. package/dist/esm/hooks/useAction.js +0 -8
  120. package/dist/esm/index.js +0 -42
  121. package/dist/esm/inputs/FKInput.js +0 -33
  122. package/dist/esm/inputs/JsonInput.js +0 -63
  123. package/dist/esm/resources.js +0 -47
  124. package/dist/esm/ui.js +0 -70
  125. package/dist/esm/utils.js +0 -38
  126. package/dist/esm/views/create.js +0 -16
  127. package/dist/esm/views/edit.js +0 -29
  128. package/dist/esm/views/list.js +0 -64
  129. package/dist/esm/views/show.js +0 -35
  130. package/dist/esm/web.js +0 -2
  131. package/src/admin.jsx +0 -78
  132. package/src/dashboard.jsx +0 -74
  133. package/src/fields/EditableBooleanField.jsx +0 -11
  134. package/src/index.js +0 -16
  135. package/src/inputs/FKInput.jsx +0 -42
  136. package/src/resources.jsx +0 -39
  137. package/src/utils.js +0 -38
  138. package/src/views/create.jsx +0 -30
  139. package/src/views/edit.jsx +0 -48
  140. package/src/views/list.jsx +0 -86
  141. package/src/views/show.jsx +0 -51
  142. package/src/web.js +0 -3
@@ -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)
@@ -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)
@@ -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)
@@ -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
@@ -1,3 +0,0 @@
1
- import { initAdmin } from "."
2
-
3
- global.initAdmin = initAdmin