@applica-software-guru/react-admin 1.0.35 → 1.0.37

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 (121) hide show
  1. package/.prettierrc +4 -4
  2. package/dist/AdminContext.d.ts.map +1 -1
  3. package/dist/components/MainCard.d.ts.map +1 -1
  4. package/dist/components/index.d.ts +1 -0
  5. package/dist/components/index.d.ts.map +1 -1
  6. package/dist/components/ra-forms/LongForm/{DispositionProps.d.ts → types.d.ts} +10 -4
  7. package/dist/components/ra-forms/LongForm/types.d.ts.map +1 -0
  8. package/dist/components/ra-forms/LongForm/useFormRootPath.d.ts +3 -3
  9. package/dist/components/ra-forms/LongForm/useFormRootPath.d.ts.map +1 -1
  10. package/dist/components/ra-forms/SimpleFormIterator.d.ts +5 -0
  11. package/dist/components/ra-forms/SimpleFormIterator.d.ts.map +1 -0
  12. package/dist/components/ra-forms/index.d.ts +2 -1
  13. package/dist/components/ra-forms/index.d.ts.map +1 -1
  14. package/dist/components/ra-inputs/AttachmentInput.d.ts +4 -1
  15. package/dist/components/ra-inputs/AttachmentInput.d.ts.map +1 -1
  16. package/dist/components/ra-inputs/AutocompleteInput.d.ts +1 -3
  17. package/dist/components/ra-inputs/AutocompleteInput.d.ts.map +1 -1
  18. package/dist/components/ra-inputs/LabeledInput.d.ts +2 -1
  19. package/dist/components/ra-inputs/LabeledInput.d.ts.map +1 -1
  20. package/dist/components/ra-inputs/SmartTextInput.d.ts.map +1 -1
  21. package/dist/contexts/ThemeConfigContext.d.ts.map +1 -1
  22. package/dist/hooks/useAppConfig.d.ts +3 -0
  23. package/dist/hooks/useAppConfig.d.ts.map +1 -1
  24. package/dist/index.d.ts +1 -1
  25. package/dist/react-admin.cjs.js +60 -57
  26. package/dist/react-admin.es.js +12795 -11451
  27. package/dist/react-admin.umd.js +60 -57
  28. package/dist/themes/overrides/Autocomplete.d.ts +4 -1
  29. package/dist/themes/overrides/Autocomplete.d.ts.map +1 -1
  30. package/package.json +1 -1
  31. package/playground/src/.prettierrc +8 -0
  32. package/playground/src/App.js +21 -21
  33. package/playground/src/components/pages/CustomPage.jsx +4 -4
  34. package/playground/src/components/pages/index.jsx +2 -2
  35. package/playground/src/components/ra-forms/DeviceForm.js +7 -14
  36. package/playground/src/components/ra-forms/UserForm.js +10 -24
  37. package/playground/src/components/ra-forms/index.js +4 -5
  38. package/playground/src/components/ra-lists/DeviceList.js +8 -16
  39. package/playground/src/components/ra-lists/UserList.js +17 -40
  40. package/playground/src/components/ra-lists/index.js +4 -4
  41. package/playground/src/contexts/index.js +1 -1
  42. package/playground/src/{resource → entities}/device.js +6 -6
  43. package/playground/src/{resource → entities}/i18n-message.js +1 -2
  44. package/playground/src/entities/index.js +4 -0
  45. package/playground/src/{resource → entities}/notification.js +0 -2
  46. package/playground/src/menu.js +18 -9
  47. package/playground/src/theme.js +10 -2
  48. package/react-admin.code-workspace +9 -0
  49. package/src/AdminContext.jsx +3 -5
  50. package/src/components/ActionsMenu.tsx +91 -0
  51. package/src/components/MainCard.jsx +29 -32
  52. package/src/components/index.jsx +21 -33
  53. package/src/components/ra-buttons/CreateInDialogButton.tsx +261 -0
  54. package/src/components/ra-custom/ListItem.tsx +147 -0
  55. package/src/components/ra-custom/index.tsx +2 -0
  56. package/src/components/ra-fields/AttachmentField.tsx +88 -0
  57. package/src/components/ra-fields/BaseAttachmentField.tsx +82 -0
  58. package/src/components/ra-forms/FormHeader.tsx +63 -0
  59. package/src/components/ra-forms/LongForm/LongForm.tsx +56 -0
  60. package/src/components/ra-forms/LongForm/LongFormSidebar.tsx +44 -0
  61. package/src/components/ra-forms/LongForm/{LongFormTab.jsx → LongFormTab.tsx} +47 -46
  62. package/src/components/ra-forms/LongForm/LongFormTabs.tsx +73 -0
  63. package/src/components/ra-forms/LongForm/LongFormView.tsx +129 -0
  64. package/{dist/components/ra-forms/LongForm/index.d.ts → src/components/ra-forms/LongForm/index.tsx} +1 -2
  65. package/src/components/ra-forms/LongForm/types.ts +15 -0
  66. package/src/components/ra-forms/LongForm/useFormRootPath.ts +26 -0
  67. package/src/components/ra-forms/SimpleFormIterator.jsx +14 -0
  68. package/src/components/ra-forms/index.jsx +2 -1
  69. package/src/components/ra-inputs/AttachmentInput.jsx +42 -25
  70. package/src/components/ra-inputs/AutocompleteInput.jsx +10 -5
  71. package/src/components/ra-inputs/LabeledInput.jsx +27 -32
  72. package/src/components/ra-inputs/SelectInput.jsx +11 -11
  73. package/src/components/ra-inputs/SmartTextInput.jsx +22 -26
  74. package/src/components/ra-inputs/TextInput.jsx +9 -9
  75. package/src/contexts/AppConfigContext.tsx +67 -0
  76. package/src/contexts/ThemeConfigContext.jsx +25 -29
  77. package/src/index.jsx +10 -8
  78. package/src/themes/overrides/Autocomplete.jsx +4 -1
  79. package/src/themes/overrides/index.jsx +1 -1
  80. package/src/utils/index.js +2 -2
  81. package/src/utils/lang.js +7 -7
  82. package/src/utils/time.js +7 -7
  83. package/dist/components/ActionsMenu.d.ts +0 -15
  84. package/dist/components/ActionsMenu.d.ts.map +0 -1
  85. package/dist/components/ra-buttons/CreateInDialogButton.d.ts +0 -37
  86. package/dist/components/ra-buttons/CreateInDialogButton.d.ts.map +0 -1
  87. package/dist/components/ra-fields/AttachmentField.d.ts +0 -28
  88. package/dist/components/ra-fields/AttachmentField.d.ts.map +0 -1
  89. package/dist/components/ra-fields/BaseAttachmentField.d.ts +0 -17
  90. package/dist/components/ra-fields/BaseAttachmentField.d.ts.map +0 -1
  91. package/dist/components/ra-forms/FormHeader.d.ts +0 -17
  92. package/dist/components/ra-forms/FormHeader.d.ts.map +0 -1
  93. package/dist/components/ra-forms/LongForm/DispositionProps.d.ts.map +0 -1
  94. package/dist/components/ra-forms/LongForm/LongForm.d.ts +0 -45
  95. package/dist/components/ra-forms/LongForm/LongForm.d.ts.map +0 -1
  96. package/dist/components/ra-forms/LongForm/LongFormHeader.d.ts +0 -20
  97. package/dist/components/ra-forms/LongForm/LongFormHeader.d.ts.map +0 -1
  98. package/dist/components/ra-forms/LongForm/LongFormTab.d.ts +0 -43
  99. package/dist/components/ra-forms/LongForm/LongFormTab.d.ts.map +0 -1
  100. package/dist/components/ra-forms/LongForm/LongFormTabs.d.ts +0 -21
  101. package/dist/components/ra-forms/LongForm/LongFormTabs.d.ts.map +0 -1
  102. package/dist/components/ra-forms/LongForm/LongFormView.d.ts +0 -29
  103. package/dist/components/ra-forms/LongForm/LongFormView.d.ts.map +0 -1
  104. package/dist/components/ra-forms/LongForm/index.d.ts.map +0 -1
  105. package/dist/contexts/AppConfigContext.d.ts +0 -22
  106. package/dist/contexts/AppConfigContext.d.ts.map +0 -1
  107. package/playground/src/resource/index.js +0 -4
  108. package/src/components/ActionsMenu.jsx +0 -77
  109. package/src/components/ra-buttons/CreateInDialogButton.jsx +0 -203
  110. package/src/components/ra-fields/AttachmentField.jsx +0 -82
  111. package/src/components/ra-fields/BaseAttachmentField.jsx +0 -72
  112. package/src/components/ra-forms/FormHeader.jsx +0 -42
  113. package/src/components/ra-forms/LongForm/DispositionProps.jsx +0 -10
  114. package/src/components/ra-forms/LongForm/LongForm.jsx +0 -38
  115. package/src/components/ra-forms/LongForm/LongFormHeader.jsx +0 -24
  116. package/src/components/ra-forms/LongForm/LongFormTabs.jsx +0 -63
  117. package/src/components/ra-forms/LongForm/LongFormView.jsx +0 -129
  118. package/src/components/ra-forms/LongForm/index.jsx +0 -2
  119. package/src/components/ra-forms/LongForm/useFormRootPath.jsx +0 -22
  120. package/src/contexts/AppConfigContext.jsx +0 -54
  121. /package/playground/src/{resource → entities}/user.js +0 -0
@@ -1,4 +1,4 @@
1
- export default function Autocomplete(): {
1
+ export default function Autocomplete(theme: any): {
2
2
  MuiAutocomplete: {
3
3
  styleOverrides: {
4
4
  root: {
@@ -10,6 +10,9 @@ export default function Autocomplete(): {
10
10
  width: string;
11
11
  height: string;
12
12
  };
13
+ popper: {
14
+ border: string;
15
+ };
13
16
  clearIndicator: {
14
17
  width: string;
15
18
  height: string;
@@ -1 +1 @@
1
- {"version":3,"file":"Autocomplete.d.ts","sourceRoot":"","sources":["../../../../src/themes/overrides/Autocomplete.jsx"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;;;;;;EAoBC"}
1
+ {"version":3,"file":"Autocomplete.d.ts","sourceRoot":"","sources":["../../../../src/themes/overrides/Autocomplete.jsx"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;;;;;;;;;EAuBC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@applica-software-guru/react-admin",
3
- "version": "1.0.35",
3
+ "version": "1.0.37",
4
4
  "private": false,
5
5
  "repository": {
6
6
  "type": "git",
@@ -0,0 +1,8 @@
1
+ {
2
+ "bracketSpacing": true,
3
+ "printWidth": 140,
4
+ "singleQuote": true,
5
+ "trailingComma": "none",
6
+ "tabWidth": 2,
7
+ "useTabs": false
8
+ }
@@ -1,20 +1,20 @@
1
- import '@applica-software-guru/react-admin/style.css'
1
+ import '@applica-software-guru/react-admin/style.css';
2
2
 
3
- import * as resourceConfig from './resource'
3
+ import * as entities from './entities';
4
4
 
5
- import { API_URL, FILE_FIELDS } from './config'
6
- import { ApplicaAdmin, HttpError, Resource } from '@applica-software-guru/react-admin'
7
- import { createAttachmentsParser, createDataProvider } from '@applica-software-guru/crud-client'
5
+ import { API_URL, FILE_FIELDS } from './config';
6
+ import { ApplicaAdmin, HttpError, Resource } from '@applica-software-guru/react-admin';
7
+ import { createAttachmentsParser, createDataProvider } from '@applica-software-guru/crud-client';
8
8
 
9
- import { CustomPage } from 'components/pages'
10
- import { CustomRoutes } from 'ra-core'
11
- import { Route } from 'react-router-dom'
12
- import build from './build.json'
13
- import { createAuthProvider } from '@applica-software-guru/iam-client'
14
- import menu from './menu'
15
- import theme from './theme'
9
+ import { CustomPage } from 'components/pages';
10
+ import { CustomRoutes } from 'ra-core';
11
+ import { Route } from 'react-router-dom';
12
+ import build from './build.json';
13
+ import { createAuthProvider } from '@applica-software-guru/iam-client';
14
+ import menu from './menu';
15
+ import theme from './theme';
16
16
 
17
- const authProvider = createAuthProvider({ apiUrl: API_URL })
17
+ const authProvider = createAuthProvider({ apiUrl: API_URL });
18
18
  const dataProvider = createDataProvider({
19
19
  apiUrl: API_URL,
20
20
  authProvider,
@@ -22,7 +22,7 @@ const dataProvider = createDataProvider({
22
22
  getToken: () => authProvider.getToken(),
23
23
  attachmentsParser: createAttachmentsParser(FILE_FIELDS),
24
24
  HttpErrorClass: HttpError
25
- })
25
+ });
26
26
  const App = () => {
27
27
  return (
28
28
  <ApplicaAdmin
@@ -35,15 +35,15 @@ const App = () => {
35
35
  name="RA"
36
36
  version={build.version}
37
37
  >
38
- <Resource name="entities/notification" {...resourceConfig.notification} />
39
- <Resource name="entities/user" {...resourceConfig.user} />
40
- <Resource name="entities/i18n-message" {...resourceConfig.i18nMessage} />
41
- <Resource name="entities/device" {...resourceConfig.device} />
38
+ <Resource name="entities/notification" {...entities.notification} />
39
+ <Resource name="entities/user" {...entities.user} />
40
+ <Resource name="entities/i18n-message" {...entities.i18nMessage} />
41
+ <Resource name="entities/device" {...entities.device} />
42
42
  <CustomRoutes>
43
43
  <Route path="/custom-page" element={<CustomPage />} />
44
44
  </CustomRoutes>
45
45
  </ApplicaAdmin>
46
- )
47
- }
46
+ );
47
+ };
48
48
 
49
- export default App
49
+ export default App;
@@ -1,7 +1,7 @@
1
- import { Typography } from "@mui/material"
1
+ import { Typography } from '@mui/material';
2
2
 
3
3
  const CustomPage = () => {
4
- return <Typography>Hello, Custom Page!</Typography>
5
- }
4
+ return <Typography>Hello, Custom Page!</Typography>;
5
+ };
6
6
 
7
- export default CustomPage;
7
+ export default CustomPage;
@@ -1,2 +1,2 @@
1
- import CustomPage from "./CustomPage";
2
- export { CustomPage }
1
+ import CustomPage from './CustomPage';
2
+ export { CustomPage };
@@ -1,17 +1,10 @@
1
- import {
2
- ReadonlyField,
3
- SimpleForm,
4
- TextInput,
5
- required,
6
- useRecordContext,
7
- useThemeConfig
8
- } from '@applica-software-guru/react-admin'
1
+ import { ReadonlyField, SimpleForm, TextInput, required, useRecordContext, useThemeConfig } from '@applica-software-guru/react-admin';
9
2
 
10
- import { Grid } from '@mui/material'
3
+ import { Grid } from '@mui/material';
11
4
 
12
5
  const DeviceForm = () => {
13
- const { spacing } = useThemeConfig()
14
- const record = useRecordContext()
6
+ const { spacing } = useThemeConfig();
7
+ const record = useRecordContext();
15
8
  return (
16
9
  <SimpleForm>
17
10
  <Grid container spacing={spacing}>
@@ -30,7 +23,7 @@ const DeviceForm = () => {
30
23
  )}
31
24
  </Grid>
32
25
  </SimpleForm>
33
- )
34
- }
26
+ );
27
+ };
35
28
 
36
- export default DeviceForm
29
+ export default DeviceForm;
@@ -1,17 +1,10 @@
1
- import {
2
- BooleanInput,
3
- ImageInput,
4
- SelectArrayInput,
5
- SimpleForm,
6
- TextInput,
7
- useThemeConfig
8
- } from '@applica-software-guru/react-admin'
1
+ import { BooleanInput, ImageInput, SelectArrayInput, SimpleForm, TextInput, useThemeConfig } from '@applica-software-guru/react-admin';
9
2
 
10
- import { Grid } from '@mui/material'
11
- import PropTypes from 'prop-types'
3
+ import { Grid } from '@mui/material';
4
+ import PropTypes from 'prop-types';
12
5
 
13
6
  const UserForm = ({ configuredRoles }) => {
14
- const { spacing } = useThemeConfig()
7
+ const { spacing } = useThemeConfig();
15
8
  return (
16
9
  <SimpleForm defaultValues={{ active: true }}>
17
10
  <Grid container spacing={spacing}>
@@ -25,12 +18,7 @@ const UserForm = ({ configuredRoles }) => {
25
18
  <TextInput source="name" fullWidth />
26
19
  </Grid>
27
20
  <Grid item lg={12} xs={12}>
28
- <SelectArrayInput
29
- source="roles"
30
- label="ra.user.roles"
31
- choices={configuredRoles}
32
- fullWidth
33
- />
21
+ <SelectArrayInput source="roles" label="ra.user.roles" choices={configuredRoles} fullWidth />
34
22
  </Grid>
35
23
  <Grid item lg={12} xs={12}>
36
24
  <ImageInput source="image" accept="image/*" multiple={false} fullWidth />
@@ -39,13 +27,11 @@ const UserForm = ({ configuredRoles }) => {
39
27
 
40
28
  <BooleanInput source="active" />
41
29
  </SimpleForm>
42
- )
43
- }
30
+ );
31
+ };
44
32
 
45
33
  UserForm.propTypes = {
46
- configuredRoles: PropTypes.arrayOf(
47
- PropTypes.shape({ id: PropTypes.string, name: PropTypes.string })
48
- ).isRequired
49
- }
34
+ configuredRoles: PropTypes.arrayOf(PropTypes.shape({ id: PropTypes.string, name: PropTypes.string })).isRequired
35
+ };
50
36
 
51
- export default UserForm
37
+ export default UserForm;
@@ -1,5 +1,4 @@
1
- import DeviceForm from './DeviceForm'
2
- import I18nMessageForm from './I18nMessageForm'
3
- import UserForm from './UserForm'
4
-
5
- export { DeviceForm, I18nMessageForm, UserForm }
1
+ import DeviceForm from './DeviceForm';
2
+ import I18nMessageForm from './I18nMessageForm';
3
+ import UserForm from './UserForm';
4
+ export { DeviceForm, I18nMessageForm, UserForm };
@@ -1,24 +1,16 @@
1
- import {
2
- Datagrid,
3
- DateField,
4
- List,
5
- SearchInput,
6
- TextField,
7
- useThemeConfig,
8
- useTranslate
9
- } from '@applica-software-guru/react-admin'
1
+ import { Datagrid, DateField, List, SearchInput, TextField, useThemeConfig, useTranslate } from '@applica-software-guru/react-admin';
10
2
 
11
- import { Alert } from '@mui/material'
3
+ import { Alert } from '@mui/material';
12
4
 
13
5
  const AlertBox = () => {
14
- const { spacing } = useThemeConfig()
15
- const translate = useTranslate()
6
+ const { spacing } = useThemeConfig();
7
+ const translate = useTranslate();
16
8
  return (
17
9
  <Alert sx={{ p: spacing, m: spacing }} severity="info">
18
10
  {translate('resources.entities/device.alert')}
19
11
  </Alert>
20
- )
21
- }
12
+ );
13
+ };
22
14
  const DeviceList = () => (
23
15
  <List perPage={25} filters={[<SearchInput source="keyword" alwaysOn />]}>
24
16
  <AlertBox />
@@ -28,6 +20,6 @@ const DeviceList = () => (
28
20
  <DateField source="registrationDate" showTime />
29
21
  </Datagrid>
30
22
  </List>
31
- )
23
+ );
32
24
 
33
- export default DeviceList
25
+ export default DeviceList;
@@ -12,51 +12,35 @@ import {
12
12
  SelectInput,
13
13
  SimpleList,
14
14
  TextField
15
- } from '@applica-software-guru/react-admin'
16
- import { Chip, useMediaQuery } from '@mui/material'
15
+ } from '@applica-software-guru/react-admin';
16
+ import { Chip, useMediaQuery } from '@mui/material';
17
17
 
18
- import PropTypes from 'prop-types'
18
+ import PropTypes from 'prop-types';
19
19
 
20
20
  const sortRoles = (roles, configuredRoles) => {
21
21
  return roles
22
22
  ?.filter((r) => configuredRoles.find((cr) => cr.id === r))
23
23
  .sort((a, b) => {
24
- const aIndex = configuredRoles.findIndex((r) => r.id === a)
25
- const bIndex = configuredRoles.findIndex((r) => r.id === b)
24
+ const aIndex = configuredRoles.findIndex((r) => r.id === a);
25
+ const bIndex = configuredRoles.findIndex((r) => r.id === b);
26
26
 
27
- return aIndex - bIndex
28
- })
29
- }
27
+ return aIndex - bIndex;
28
+ });
29
+ };
30
30
  const UserList = ({ configuredRoles }) => {
31
- const isSmall = useMediaQuery((theme) => theme.breakpoints.down('sm'))
31
+ const isSmall = useMediaQuery((theme) => theme.breakpoints.down('sm'));
32
32
  return (
33
33
  <List
34
34
  perPage={25}
35
35
  filters={[
36
36
  <SearchInput key="keyword" source="keyword" alwaysOn fullWidth />,
37
- <SelectInput
38
- key="role"
39
- source="role"
40
- choices={configuredRoles}
41
- alwaysOn
42
- emptyText="ra.action.view_all"
43
- display="legend"
44
- />,
37
+ <SelectInput key="role" source="role" choices={configuredRoles} alwaysOn emptyText="ra.action.view_all" display="legend" />,
45
38
  <BooleanInput key="active" source="active" display="legend" />
46
39
  ]}
47
40
  >
48
41
  {isSmall ? (
49
42
  <SimpleList
50
- leftAvatar={(record) => (
51
- <CoverField
52
- source="image"
53
- circle
54
- width={50}
55
- height={50}
56
- justify="flex-end"
57
- record={record}
58
- />
59
- )}
43
+ leftAvatar={(record) => <CoverField source="image" circle width={50} height={50} justify="flex-end" record={record} />}
60
44
  primaryText={(record) => record.name}
61
45
  secondaryText={(record) => record.email}
62
46
  />
@@ -71,12 +55,7 @@ const UserList = ({ configuredRoles }) => {
71
55
  label="ra.user.roles"
72
56
  render={(record) =>
73
57
  sortRoles(record?.roles, configuredRoles)?.map((role) => (
74
- <Chip
75
- label={configuredRoles.find((r) => r.id === role)?.name}
76
- key={role}
77
- sx={{ mr: 1, mt: 1 }}
78
- color="secondary"
79
- />
58
+ <Chip label={configuredRoles.find((r) => r.id === role)?.name} key={role} sx={{ mr: 1, mt: 1 }} color="secondary" />
80
59
  ))
81
60
  }
82
61
  />
@@ -84,13 +63,11 @@ const UserList = ({ configuredRoles }) => {
84
63
  </Datagrid>
85
64
  )}
86
65
  </List>
87
- )
88
- }
66
+ );
67
+ };
89
68
 
90
69
  UserList.propTypes = {
91
- configuredRoles: PropTypes.arrayOf(
92
- PropTypes.shape({ id: PropTypes.string, name: PropTypes.string })
93
- ).isRequired
94
- }
70
+ configuredRoles: PropTypes.arrayOf(PropTypes.shape({ id: PropTypes.string, name: PropTypes.string })).isRequired
71
+ };
95
72
 
96
- export default UserList
73
+ export default UserList;
@@ -1,4 +1,4 @@
1
- import DeviceList from './DeviceList'
2
- import I18nMessageList from './I18nMessageList'
3
- import UserList from './UserList'
4
- export { DeviceList, I18nMessageList, UserList }
1
+ import DeviceList from './DeviceList';
2
+ import I18nMessageList from './I18nMessageList';
3
+ import UserList from './UserList';
4
+ export { DeviceList, I18nMessageList, UserList };
@@ -1 +1 @@
1
- export {}
1
+ export {};
@@ -1,15 +1,15 @@
1
- import { Create, Edit } from '@applica-software-guru/react-admin'
2
- import { DeviceForm, DeviceList } from 'components'
1
+ import { Create, Edit } from '@applica-software-guru/react-admin';
2
+ import { DeviceForm, DeviceList } from 'components';
3
3
  const DeviceCreate = () => (
4
4
  <Create>
5
5
  <DeviceForm />
6
6
  </Create>
7
- )
7
+ );
8
8
  const DeviceEdit = () => (
9
9
  <Edit>
10
10
  <DeviceForm />
11
11
  </Edit>
12
- )
12
+ );
13
13
 
14
14
  const config = {
15
15
  list: DeviceList,
@@ -18,6 +18,6 @@ const config = {
18
18
  options: {
19
19
  group: 'control-panel'
20
20
  }
21
- }
21
+ };
22
22
 
23
- export default config
23
+ export default config;
@@ -21,8 +21,7 @@ const config = {
21
21
  create: MessageCreate,
22
22
  options: {
23
23
  group: 'control-panel',
24
- icon: FlagOutlined,
25
- roles: ['superuser']
24
+ icon: FlagOutlined
26
25
  }
27
26
  };
28
27
 
@@ -0,0 +1,4 @@
1
+ export { default as user } from './user';
2
+ export { default as notification } from './notification';
3
+ export { default as i18nMessage } from './i18n-message';
4
+ export { default as device } from './device';
@@ -1,6 +1,5 @@
1
1
  import { NotificationList as BaseNotificationList, List } from '@applica-software-guru/react-admin';
2
2
 
3
- import { MessageOutlined } from '@ant-design/icons';
4
3
  import React from 'react';
5
4
 
6
5
  const NotificationList = () => (
@@ -11,7 +10,6 @@ const NotificationList = () => (
11
10
  const config = {
12
11
  list: NotificationList,
13
12
  options: {
14
- icon: MessageOutlined,
15
13
  group: 'dashboard'
16
14
  }
17
15
  };
@@ -1,10 +1,4 @@
1
- import {
2
- DashboardOutlined,
3
- FlagOutlined,
4
- NotificationOutlined,
5
- TableOutlined,
6
- UserOutlined
7
- } from '@ant-design/icons'
1
+ import { DashboardOutlined, FlagOutlined, NotificationOutlined, TableOutlined, UserOutlined } from '@ant-design/icons';
8
2
 
9
3
  const config = [
10
4
  {
@@ -19,6 +13,14 @@ const config = [
19
13
  type: 'item',
20
14
  url: '/entities/notification',
21
15
  icon: NotificationOutlined
16
+ },
17
+ {
18
+ id: 'entities/bom',
19
+ title: 'ra.menu.item.entities/bom',
20
+ type: 'item',
21
+ url: '/entities/bom',
22
+ resource: true,
23
+ icon: TableOutlined
22
24
  }
23
25
  ]
24
26
  },
@@ -64,9 +66,16 @@ const config = [
64
66
  type: 'item',
65
67
  url: '/entities/device',
66
68
  icon: TableOutlined
69
+ },
70
+ {
71
+ id: 'entities/work-cycle',
72
+ title: 'ra.menu.item.entities/work-cycle',
73
+ type: 'item',
74
+ url: '/entities/work-cycle',
75
+ icon: TableOutlined
67
76
  }
68
77
  ]
69
78
  }
70
- ]
79
+ ];
71
80
 
72
- export default config
81
+ export default config;
@@ -1,3 +1,11 @@
1
- const theme = () => ({});
1
+ const theme = (theme) => ({
2
+ components: {
3
+ MuiPaper: {
4
+ styleOverrides: {
5
+ backgroundColor: 'yellow'
6
+ }
7
+ }
8
+ }
9
+ })
2
10
 
3
- export default theme;
11
+ export default theme
@@ -0,0 +1,9 @@
1
+ {
2
+ "folders": [
3
+ {
4
+ "path": ".",
5
+ "name": "React Admin"
6
+ }
7
+ ],
8
+ "settings": {}
9
+ }
@@ -1,5 +1,3 @@
1
- import * as React from 'react'
2
-
3
1
  import { CoreAdminContext } from 'react-admin'
4
2
  import PropTypes from 'prop-types'
5
3
  import { ScrollTop } from './components'
@@ -13,14 +11,14 @@ const AdminContext = ({ children, theme, ...props }) => (
13
11
  </CoreAdminContext>
14
12
  )
15
13
 
16
- AdminContext.displayName = 'AdminContext'
14
+ AdminContext.displayName = 'ApplicaAdminContext'
17
15
  AdminContext.defaultProps = {
18
- ...CoreAdminContext.defaultProps,
16
+ ...CoreAdminContext.defaultProps
19
17
  }
20
18
  AdminContext.propTypes = {
21
19
  ...CoreAdminContext.propTypes,
22
20
  children: PropTypes.node.isRequired,
23
- theme: PropTypes.oneOfType([PropTypes.object, PropTypes.func]),
21
+ theme: PropTypes.oneOfType([PropTypes.object, PropTypes.func])
24
22
  }
25
23
 
26
24
  export default AdminContext
@@ -0,0 +1,91 @@
1
+ import { IconButton, MenuItem, styled } from '@mui/material';
2
+ import React, { Children, useState } from 'react';
3
+
4
+ import MenuPopover from './MenuPopover/MenuPopover';
5
+ import { MoreVert } from '@mui/icons-material';
6
+ import PropTypes from 'prop-types';
7
+
8
+ const StyledRoot = styled('div', {
9
+ shouldForwardProp: (prop) => prop !== 'color' && prop !== 'variant' && prop !== 'sx',
10
+ slot: 'root',
11
+ overridesResolver: (props, styles) => [styles.root]
12
+ })(() => ({
13
+ textAlign: 'right'
14
+ }));
15
+
16
+ const StyledMenuPopover = styled(MenuPopover, {
17
+ name: 'ApplicaActionsMenuPopover',
18
+ slot: 'root'
19
+ })(({ theme }) => ({
20
+ '& .MuiMenuItem-root': {
21
+ padding: 0,
22
+ margin: 0,
23
+ backgroundColor: theme.palette.background.paper,
24
+ '& .MuiButton-startIcon': {
25
+ marginRight: theme.spacing(0)
26
+ }
27
+ }
28
+ }));
29
+ export type ActionsMenuProps = {
30
+ children: React.ReactNode;
31
+ };
32
+
33
+ /**
34
+ * Consente di disegnare un menu di azioni raggruppate all'interno di un popover.
35
+ * All'interno del menu è possibile inserire uno o più componenti che, è suggeribile, siano bottoni.
36
+ *
37
+ * @example
38
+ * <ActionsMenu>
39
+ * <DeleteButton />
40
+ * <EditButton />
41
+ * </ActionsMenu>
42
+ *
43
+ * @param {ActionsMenuProps}
44
+ * @returns {React.ReactElement}
45
+ */
46
+ const ActionsMenu = ({ children }: ActionsMenuProps): React.ReactElement | null => {
47
+ const [open, setOpen] = useState(null);
48
+ const handleClick = (e: any) => {
49
+ e.stopPropagation();
50
+ e.preventDefault();
51
+ setOpen(e.currentTarget);
52
+ };
53
+ const handleClose = () => {
54
+ setOpen(null);
55
+ };
56
+
57
+ if (
58
+ !children ||
59
+ React.Children.count(children) === 0 ||
60
+ // @ts-ignore
61
+ (children?.filter && children?.filter((c) => React.isValidElement(c)).length === 0)
62
+ ) {
63
+ return null;
64
+ }
65
+
66
+ return (
67
+ <StyledRoot>
68
+ <IconButton aria-label="more" aria-haspopup="true" onClick={handleClick} color={open ? 'inherit' : 'default'}>
69
+ <MoreVert />
70
+ </IconButton>
71
+ <StyledMenuPopover open={open} onClose={handleClose} arrow="right-top">
72
+ {Children.map(
73
+ children,
74
+ (action, index) =>
75
+ React.isValidElement(action) && (
76
+ <MenuItem key={index} onClick={handleClose}>
77
+ {React.cloneElement(action)}
78
+ </MenuItem>
79
+ )
80
+ )}
81
+ </StyledMenuPopover>
82
+ </StyledRoot>
83
+ );
84
+ };
85
+
86
+ ActionsMenu.propTypes = {
87
+ ...MenuPopover.propTypes,
88
+ children: PropTypes.node.isRequired
89
+ };
90
+
91
+ export default ActionsMenu;