muffin-admin 1.28.2 → 1.31.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/views/list.jsx DELETED
@@ -1,56 +0,0 @@
1
- import React from "react";
2
-
3
- import {
4
- BulkDeleteButton,
5
- Datagrid,
6
- EditButton,
7
- Filter,
8
- List,
9
- Pagination,
10
- Show,
11
- } from "react-admin";
12
- import uniq from "lodash/uniq";
13
- import sortBy from "lodash/sortBy";
14
-
15
- import initRAItems from '../ui.jsx'
16
- import { checkParams, processAdmin, setupAdmin } from '../utils'
17
- import { BulkActionButton } from '../buttons/ActionButton.jsx'
18
-
19
-
20
- const defaultPagination = <Pagination rowsPerPageOptions={[10, 25, 50, 100]} />;
21
-
22
- // Initiliaze a list component
23
- setupAdmin('list', checkParams((props, res) => {
24
- let {children, filters, edit, pagination, show, limit, limitMax, actions, ...listProps } = props;
25
-
26
- children = processAdmin('list-fields', children, res);
27
- if (edit) children.push(<EditButton key="edit-button" />);
28
-
29
- pagination = pagination || <Pagination rowsPerPageOptions={sortBy(uniq([10, 25, 50, 100, limit, limitMax]))} />
30
-
31
- return props => {
32
- let Filters = (props) => <Filter { ...props } children={ processAdmin('list-filters', filters, res) } />
33
- let Actions = processAdmin('list-bulkActions', actions);
34
-
35
- props = { ...props, ...listProps };
36
- return (
37
- <List filters={ <Filters /> } bulkActionButtons={ <Actions /> } perPage={ limit } pagination={ pagination || defaultPagination } { ...props }>
38
- <Datagrid rowClick={ show && "show" } children={ children } />
39
- </List>
40
- )
41
- };
42
- }));
43
-
44
- setupAdmin('list-bulkActions', actions => props => {
45
- let buttons = actions.map((action, idx) => {
46
- let aProps = { ...action, ...props };
47
- return <BulkActionButton key={idx} {...aProps} />
48
- })
49
-
50
- return <>
51
- { buttons }
52
- <BulkDeleteButton {...props} />
53
- </>
54
- });
55
- setupAdmin('list-filters', initRAItems);
56
- setupAdmin('list-fields', initRAItems);
package/views/show.jsx DELETED
@@ -1,34 +0,0 @@
1
- import React from "react";
2
-
3
- import { ListButton, EditButton, Show, SimpleShowLayout, TopToolbar } from "react-admin";
4
-
5
- import initRAItems from '../ui.jsx'
6
- import { checkParams, processAdmin, setupAdmin } from '../utils'
7
-
8
- import { ActionButton } from '../buttons/ActionButton.jsx'
9
-
10
-
11
- // Initiliaze a show component
12
- setupAdmin('show', checkParams(({actions, fields}, res) => props => {
13
-
14
- const Actions = ({basePath, data, resource, ...baseProps}) => (
15
- <TopToolbar>
16
- {
17
- actions.map((props, idx) => {
18
- let aProps = {resource, basePath, record: data, ...baseProps, ...props};
19
- return <ActionButton key={ idx } {...aProps} />
20
- })
21
- }
22
- <ListButton basePath={ basePath } />
23
- <EditButton basePath={basePath} record={data} />
24
- </TopToolbar>
25
- )
26
-
27
- return (
28
- <Show actions={ <Actions /> } {...props}>
29
- <SimpleShowLayout children={ processAdmin('show-fields', fields, res) } />
30
- </Show>
31
- )
32
- }));
33
-
34
- setupAdmin('show-fields', initRAItems);