@applica-software-guru/react-admin 1.1.93 → 1.1.95

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 (156) hide show
  1. package/dist/components/AuthWrapper.d.ts.map +1 -1
  2. package/dist/components/Layout/Content.d.ts +5 -0
  3. package/dist/components/Layout/Content.d.ts.map +1 -0
  4. package/dist/components/Layout/Drawer/Drawer.d.ts +8 -0
  5. package/dist/components/Layout/Drawer/Drawer.d.ts.map +1 -0
  6. package/dist/components/Layout/Drawer/DrawerHeader.d.ts +8 -0
  7. package/dist/components/Layout/Drawer/DrawerHeader.d.ts.map +1 -0
  8. package/dist/components/Layout/Drawer/DrawerHeaderStyled.d.ts +4 -0
  9. package/dist/components/Layout/Drawer/DrawerHeaderStyled.d.ts.map +1 -0
  10. package/dist/components/Layout/Drawer/index.d.ts +3 -18
  11. package/dist/components/Layout/Drawer/index.d.ts.map +1 -1
  12. package/dist/components/Layout/Footer.d.ts +11 -10
  13. package/dist/components/Layout/Footer.d.ts.map +1 -1
  14. package/dist/components/Layout/Header/DrawerToggle.d.ts +3 -0
  15. package/dist/components/Layout/Header/DrawerToggle.d.ts.map +1 -0
  16. package/dist/components/Layout/Header/Header.d.ts +8 -0
  17. package/dist/components/Layout/Header/Header.d.ts.map +1 -0
  18. package/dist/components/Layout/Header/Notification/Notification.d.ts +3 -0
  19. package/dist/components/Layout/Header/Notification/Notification.d.ts.map +1 -0
  20. package/dist/components/Layout/Header/Notification/NotificationItem.d.ts +19 -0
  21. package/dist/components/Layout/Header/Notification/NotificationItem.d.ts.map +1 -0
  22. package/dist/components/Layout/Header/Notification/index.d.ts +2 -0
  23. package/dist/components/Layout/Header/Notification/index.d.ts.map +1 -0
  24. package/dist/components/Layout/Header/Profile/Profile.d.ts.map +1 -0
  25. package/dist/components/Layout/Header/Profile/buttons/ChangePasswordButton.d.ts.map +1 -0
  26. package/dist/components/Layout/Header/Profile/buttons/LogoutButton.d.ts.map +1 -0
  27. package/dist/components/Layout/Header/Profile/buttons/StopImpersonateButton.d.ts.map +1 -0
  28. package/dist/components/Layout/Header/Profile/buttons/index.d.ts.map +1 -0
  29. package/dist/components/Layout/Header/Profile/index.d.ts +2 -0
  30. package/dist/components/Layout/Header/Profile/index.d.ts.map +1 -0
  31. package/dist/components/Layout/Header/ResponsiveSection.d.ts +5 -0
  32. package/dist/components/Layout/Header/ResponsiveSection.d.ts.map +1 -0
  33. package/dist/components/Layout/Header/Spacer.d.ts +5 -0
  34. package/dist/components/Layout/Header/Spacer.d.ts.map +1 -0
  35. package/dist/components/Layout/Header/index.d.ts +7 -20
  36. package/dist/components/Layout/Header/index.d.ts.map +1 -1
  37. package/dist/components/Layout/HorizontalBar.d.ts +5 -0
  38. package/dist/components/Layout/HorizontalBar.d.ts.map +1 -0
  39. package/dist/components/Layout/Layout.d.ts +19 -0
  40. package/dist/components/Layout/Layout.d.ts.map +1 -0
  41. package/dist/components/Layout/NavMenu.d.ts +5 -0
  42. package/dist/components/Layout/NavMenu.d.ts.map +1 -0
  43. package/dist/components/Layout/Navigation/NavCollapse.d.ts.map +1 -0
  44. package/dist/components/Layout/{Drawer/DrawerContent/Navigation → Navigation}/NavGroup.d.ts +2 -3
  45. package/dist/components/Layout/Navigation/NavGroup.d.ts.map +1 -0
  46. package/dist/components/Layout/Navigation/NavItem.d.ts.map +1 -0
  47. package/dist/components/Layout/Navigation/Navigation.d.ts +7 -0
  48. package/dist/components/Layout/Navigation/Navigation.d.ts.map +1 -0
  49. package/dist/components/Layout/Navigation/index.d.ts +2 -0
  50. package/dist/components/Layout/Navigation/index.d.ts.map +1 -0
  51. package/dist/components/Layout/Provider.d.ts +84 -0
  52. package/dist/components/Layout/Provider.d.ts.map +1 -0
  53. package/dist/components/Layout/Wrapper.d.ts +6 -0
  54. package/dist/components/Layout/Wrapper.d.ts.map +1 -0
  55. package/dist/components/Layout/index.d.ts +10 -22
  56. package/dist/components/Layout/index.d.ts.map +1 -1
  57. package/dist/components/ra-inputs/AutocompleteArrayInput.d.ts +1 -0
  58. package/dist/components/ra-inputs/AutocompleteArrayInput.d.ts.map +1 -1
  59. package/dist/components/ra-inputs/AutocompleteInput.d.ts +1 -0
  60. package/dist/components/ra-inputs/AutocompleteInput.d.ts.map +1 -1
  61. package/dist/components/ra-lists/List.d.ts.map +1 -1
  62. package/dist/hooks/index.d.ts +2 -0
  63. package/dist/hooks/index.d.ts.map +1 -1
  64. package/dist/hooks/mui.d.ts +7 -0
  65. package/dist/hooks/mui.d.ts.map +1 -0
  66. package/dist/hooks/useRefDimensions.d.ts +13 -0
  67. package/dist/hooks/useRefDimensions.d.ts.map +1 -0
  68. package/dist/react-admin.cjs.js +101 -92
  69. package/dist/react-admin.cjs.js.map +1 -1
  70. package/dist/react-admin.es.js +23530 -20993
  71. package/dist/react-admin.es.js.map +1 -1
  72. package/dist/react-admin.umd.js +102 -93
  73. package/dist/react-admin.umd.js.map +1 -1
  74. package/dist/style.css +1 -1
  75. package/package.json +1 -1
  76. package/src/components/AuthWrapper.jsx +1 -1
  77. package/src/components/Layout/Content.tsx +30 -0
  78. package/src/components/Layout/Drawer/Drawer.tsx +61 -0
  79. package/src/components/Layout/Drawer/DrawerHeader.tsx +31 -0
  80. package/src/components/Layout/Drawer/{DrawerHeader/DrawerHeaderStyled.jsx → DrawerHeaderStyled.jsx} +1 -1
  81. package/src/components/Layout/Drawer/index.ts +3 -0
  82. package/src/components/Layout/Footer.tsx +26 -0
  83. package/src/components/Layout/Header/DrawerToggle.tsx +28 -0
  84. package/src/components/Layout/Header/Header.tsx +43 -0
  85. package/src/components/Layout/Header/{HeaderContent/Notification.jsx → Notification/Notification.tsx} +60 -54
  86. package/src/components/Layout/Header/Notification/NotificationItem.tsx +85 -0
  87. package/src/components/Layout/Header/Notification/index.ts +1 -0
  88. package/src/components/Layout/Header/{HeaderContent → Profile}/Profile.jsx +15 -3
  89. package/src/components/Layout/Header/Profile/index.ts +1 -0
  90. package/src/components/Layout/Header/{HeaderContent/MobileSection.jsx → ResponsiveSection.tsx} +31 -38
  91. package/src/components/Layout/Header/Spacer.tsx +9 -0
  92. package/src/components/Layout/Header/index.ts +7 -0
  93. package/src/components/Layout/HorizontalBar.tsx +39 -0
  94. package/src/components/Layout/Layout.tsx +60 -0
  95. package/src/components/Layout/NavMenu.tsx +12 -0
  96. package/src/components/Layout/{Drawer/DrawerContent/Navigation → Navigation}/NavCollapse.jsx +7 -8
  97. package/src/components/Layout/{Drawer/DrawerContent/Navigation → Navigation}/NavGroup.jsx +8 -19
  98. package/src/components/Layout/{Drawer/DrawerContent/Navigation → Navigation}/NavItem.jsx +7 -8
  99. package/src/components/Layout/Navigation/Navigation.tsx +76 -0
  100. package/src/components/Layout/Navigation/index.ts +1 -0
  101. package/src/components/Layout/Provider.tsx +290 -0
  102. package/src/components/Layout/Wrapper.tsx +16 -0
  103. package/src/components/Layout/index.ts +10 -0
  104. package/src/components/ra-inputs/AutocompleteArrayInput.jsx +5 -2
  105. package/src/components/ra-inputs/AutocompleteInput.jsx +6 -2
  106. package/src/components/ra-lists/List.tsx +1 -5
  107. package/src/hooks/index.jsx +2 -0
  108. package/src/hooks/mui.ts +21 -0
  109. package/src/hooks/useRefDimensions.ts +61 -0
  110. package/dist/components/Layout/Drawer/DrawerContent/Navigation/NavCollapse.d.ts.map +0 -1
  111. package/dist/components/Layout/Drawer/DrawerContent/Navigation/NavGroup.d.ts.map +0 -1
  112. package/dist/components/Layout/Drawer/DrawerContent/Navigation/NavItem.d.ts.map +0 -1
  113. package/dist/components/Layout/Drawer/DrawerContent/Navigation/index.d.ts +0 -3
  114. package/dist/components/Layout/Drawer/DrawerContent/Navigation/index.d.ts.map +0 -1
  115. package/dist/components/Layout/Drawer/DrawerContent/index.d.ts +0 -3
  116. package/dist/components/Layout/Drawer/DrawerContent/index.d.ts.map +0 -1
  117. package/dist/components/Layout/Drawer/DrawerHeader/DrawerHeaderStyled.d.ts +0 -5
  118. package/dist/components/Layout/Drawer/DrawerHeader/DrawerHeaderStyled.d.ts.map +0 -1
  119. package/dist/components/Layout/Drawer/DrawerHeader/index.d.ts +0 -15
  120. package/dist/components/Layout/Drawer/DrawerHeader/index.d.ts.map +0 -1
  121. package/dist/components/Layout/Drawer/HorizontalBar.d.ts +0 -3
  122. package/dist/components/Layout/Drawer/HorizontalBar.d.ts.map +0 -1
  123. package/dist/components/Layout/Header/HeaderContent/MobileSection.d.ts +0 -3
  124. package/dist/components/Layout/Header/HeaderContent/MobileSection.d.ts.map +0 -1
  125. package/dist/components/Layout/Header/HeaderContent/Notification.d.ts +0 -16
  126. package/dist/components/Layout/Header/HeaderContent/Notification.d.ts.map +0 -1
  127. package/dist/components/Layout/Header/HeaderContent/NotificationItem.d.ts +0 -31
  128. package/dist/components/Layout/Header/HeaderContent/NotificationItem.d.ts.map +0 -1
  129. package/dist/components/Layout/Header/HeaderContent/Profile.d.ts.map +0 -1
  130. package/dist/components/Layout/Header/HeaderContent/buttons/ChangePasswordButton.d.ts.map +0 -1
  131. package/dist/components/Layout/Header/HeaderContent/buttons/LogoutButton.d.ts.map +0 -1
  132. package/dist/components/Layout/Header/HeaderContent/buttons/StopImpersonateButton.d.ts.map +0 -1
  133. package/dist/components/Layout/Header/HeaderContent/buttons/index.d.ts.map +0 -1
  134. package/dist/components/Layout/Header/HeaderContent/index.d.ts +0 -17
  135. package/dist/components/Layout/Header/HeaderContent/index.d.ts.map +0 -1
  136. package/src/components/Layout/Drawer/DrawerContent/Navigation/index.jsx +0 -73
  137. package/src/components/Layout/Drawer/DrawerContent/index.jsx +0 -19
  138. package/src/components/Layout/Drawer/DrawerHeader/index.jsx +0 -39
  139. package/src/components/Layout/Drawer/HorizontalBar.jsx +0 -55
  140. package/src/components/Layout/Drawer/index.jsx +0 -60
  141. package/src/components/Layout/Footer.jsx +0 -18
  142. package/src/components/Layout/Header/HeaderContent/NotificationItem.jsx +0 -97
  143. package/src/components/Layout/Header/HeaderContent/index.jsx +0 -36
  144. package/src/components/Layout/Header/index.jsx +0 -81
  145. package/src/components/Layout/index.jsx +0 -114
  146. /package/dist/components/Layout/Header/{HeaderContent → Profile}/Profile.d.ts +0 -0
  147. /package/dist/components/Layout/Header/{HeaderContent → Profile}/buttons/ChangePasswordButton.d.ts +0 -0
  148. /package/dist/components/Layout/Header/{HeaderContent → Profile}/buttons/LogoutButton.d.ts +0 -0
  149. /package/dist/components/Layout/Header/{HeaderContent → Profile}/buttons/StopImpersonateButton.d.ts +0 -0
  150. /package/dist/components/Layout/Header/{HeaderContent → Profile}/buttons/index.d.ts +0 -0
  151. /package/dist/components/Layout/{Drawer/DrawerContent/Navigation → Navigation}/NavCollapse.d.ts +0 -0
  152. /package/dist/components/Layout/{Drawer/DrawerContent/Navigation → Navigation}/NavItem.d.ts +0 -0
  153. /package/src/components/Layout/Header/{HeaderContent → Profile}/buttons/ChangePasswordButton.tsx +0 -0
  154. /package/src/components/Layout/Header/{HeaderContent → Profile}/buttons/LogoutButton.tsx +0 -0
  155. /package/src/components/Layout/Header/{HeaderContent → Profile}/buttons/StopImpersonateButton.tsx +0 -0
  156. /package/src/components/Layout/Header/{HeaderContent → Profile}/buttons/index.jsx +0 -0
@@ -0,0 +1,290 @@
1
+ import { Dialog, useTheme, useMediaQuery } from '@mui/material';
2
+ import _ from 'lodash';
3
+ import { forwardRef, createContext, useContext, useReducer, useMemo, useEffect, useCallback, useState } from 'react';
4
+ import { useMenuConfig, useThemeConfig } from '../../hooks';
5
+ import { UseGetIdentityResult, useGetIdentity } from 'ra-core';
6
+ import { ChangePasswordForm } from '../ra-forms';
7
+
8
+ enum LayoutActionType {
9
+ UPDATE_MEDIA = 'updateMedia',
10
+ UPDATE_DRAWER = 'updateDrawer',
11
+ UPDATE_LOGO = 'updateLogo',
12
+ UPDATE_NOTIFICATIONS = 'updateNotifications',
13
+ UPDATE_THEME = 'updateTheme'
14
+ }
15
+
16
+ type ILayoutProviderProps = React.PropsWithChildren<{
17
+ logoMain?: React.ReactElement;
18
+ logoIcon?: React.ReactElement;
19
+ enableNotification: boolean;
20
+ notification?: string;
21
+ }>;
22
+ type ILayoutMediaState = {
23
+ downMd: boolean;
24
+ downLg: boolean;
25
+ downXl: boolean;
26
+ horizontal: boolean;
27
+ };
28
+ type ILayoutDrawerState = {
29
+ open: boolean;
30
+ width: number;
31
+ handleDrawerToggle: () => void;
32
+ };
33
+ type ILayoutLogoState = {
34
+ icon?: React.ReactElement;
35
+ main?: React.ReactElement;
36
+ };
37
+ type ILayoutNotificationState = {
38
+ enable: boolean;
39
+ resource: string;
40
+ };
41
+ type ILayoutThemeState = {
42
+ iconColorOpen: string;
43
+ iconColor: string;
44
+ };
45
+ type ILayoutState = {
46
+ drawer: ILayoutDrawerState;
47
+ media: ILayoutMediaState;
48
+ logo: ILayoutLogoState;
49
+ notifications: ILayoutNotificationState;
50
+ theme: ILayoutThemeState;
51
+ };
52
+ type ILayoutAction =
53
+ | {
54
+ type: LayoutActionType.UPDATE_MEDIA;
55
+ payload: Partial<ILayoutMediaState>;
56
+ }
57
+ | {
58
+ type: LayoutActionType.UPDATE_DRAWER;
59
+ payload: Partial<ILayoutDrawerState>;
60
+ }
61
+ | {
62
+ type: LayoutActionType.UPDATE_LOGO;
63
+ payload: Partial<ILayoutLogoState>;
64
+ }
65
+ | {
66
+ type: LayoutActionType.UPDATE_NOTIFICATIONS;
67
+ payload: Partial<ILayoutNotificationState>;
68
+ }
69
+ | {
70
+ type: LayoutActionType.UPDATE_THEME;
71
+ payload: Partial<ILayoutThemeState>;
72
+ };
73
+ type ILayoutContext = {
74
+ state: ILayoutState;
75
+ dispatch: React.Dispatch<ILayoutAction>;
76
+ };
77
+
78
+ function reducer(state: ILayoutState, action: ILayoutAction) {
79
+ const newState = _.clone(state),
80
+ { type, payload } = action;
81
+ switch (type) {
82
+ case LayoutActionType.UPDATE_MEDIA: {
83
+ const media = _.chain(newState.media).clone().extend(payload).value();
84
+ return _.extend(newState, { media: media });
85
+ }
86
+ case LayoutActionType.UPDATE_DRAWER: {
87
+ const drawer = _.chain(newState.drawer).clone().extend(payload).value();
88
+ return _.extend(newState, { drawer: drawer });
89
+ }
90
+ case LayoutActionType.UPDATE_LOGO: {
91
+ const logo = _.chain(newState.logo).clone().extend(payload).value();
92
+ return _.extend(newState, { logo: logo });
93
+ }
94
+ case LayoutActionType.UPDATE_NOTIFICATIONS: {
95
+ const notifications = _.chain(newState.notifications).clone().extend(payload).value();
96
+ return _.extend(newState, { notifications: notifications });
97
+ }
98
+ case LayoutActionType.UPDATE_THEME: {
99
+ const theme = _.chain(newState.theme).clone().extend(payload).value();
100
+ return _.extend(newState, { theme: theme });
101
+ }
102
+ default:
103
+ return newState;
104
+ }
105
+ }
106
+
107
+ const DefaultState: ILayoutState = {
108
+ drawer: {
109
+ open: true,
110
+ width: 260,
111
+ handleDrawerToggle: () => {}
112
+ },
113
+ media: {
114
+ downMd: false,
115
+ downLg: false,
116
+ downXl: false,
117
+ horizontal: false
118
+ },
119
+ logo: {},
120
+ notifications: {
121
+ enable: true,
122
+ resource: 'entities/notification'
123
+ },
124
+ theme: {
125
+ iconColor: 'grey.300',
126
+ iconColorOpen: 'grey.100'
127
+ }
128
+ },
129
+ LayoutContext = createContext<ILayoutContext | undefined>(undefined);
130
+
131
+ function LayoutProvider(props: ILayoutProviderProps) {
132
+ const identity = useGetIdentity() as UseGetIdentityResult & { needToChangePassword: boolean },
133
+ theme = useTheme(),
134
+ downMd = useMediaQuery(theme.breakpoints.down('md')),
135
+ downLg = useMediaQuery(theme.breakpoints.down('lg')),
136
+ downXl = useMediaQuery(theme.breakpoints.down('xl')),
137
+ //@ts-ignore
138
+ { miniDrawer, isHorizontalLayout, menuOrientation, drawerWidth } = useThemeConfig(),
139
+ isHorizontal = isHorizontalLayout(menuOrientation) && !downLg,
140
+ //@ts-ignore
141
+ { drawerOpen, openDrawer } = useMenuConfig(),
142
+ handleDrawerToggle = useCallback(() => {
143
+ openDrawer(!drawerOpen);
144
+ }, [drawerOpen, openDrawer]),
145
+ [needToChangePassword, setNeedToChangePassword] = useState(false),
146
+ [state, dispatch] = useReducer(
147
+ reducer,
148
+ _.chain(DefaultState)
149
+ .clone()
150
+ .merge({ drawer: { open: !miniDrawer || drawerOpen } })
151
+ .value()
152
+ ),
153
+ handlePasswordChange = useCallback(() => setNeedToChangePassword(false), []),
154
+ value = useMemo(() => ({ state, dispatch }), [state, dispatch]),
155
+ { logoIcon, logoMain, enableNotification, notification } = props;
156
+
157
+ useEffect(() => {
158
+ dispatch({
159
+ type: LayoutActionType.UPDATE_MEDIA,
160
+ payload: {
161
+ downMd: downMd,
162
+ downLg: downLg,
163
+ downXl: downXl,
164
+ horizontal: isHorizontal
165
+ }
166
+ });
167
+ }, [menuOrientation, downMd, downLg, downXl]);
168
+
169
+ useEffect(() => {
170
+ dispatch({
171
+ type: LayoutActionType.UPDATE_DRAWER,
172
+ payload: {
173
+ open: drawerOpen,
174
+ width: drawerWidth,
175
+ handleDrawerToggle: handleDrawerToggle
176
+ }
177
+ });
178
+ }, [drawerOpen, drawerWidth, handleDrawerToggle]);
179
+
180
+ useEffect(() => {
181
+ if (!miniDrawer) {
182
+ openDrawer(!downXl);
183
+ }
184
+ }, [downXl, miniDrawer]);
185
+
186
+ useEffect(() => {
187
+ dispatch({
188
+ type: LayoutActionType.UPDATE_LOGO,
189
+ payload: {
190
+ main: logoMain,
191
+ icon: logoIcon
192
+ }
193
+ });
194
+ }, [logoIcon, logoMain]);
195
+
196
+ useEffect(() => {
197
+ dispatch({
198
+ type: LayoutActionType.UPDATE_NOTIFICATIONS,
199
+ payload: {
200
+ enable: enableNotification,
201
+ resource: notification ?? 'entities/notification'
202
+ }
203
+ });
204
+ }, [enableNotification, notification]);
205
+
206
+ useEffect(() => {
207
+ dispatch({
208
+ type: LayoutActionType.UPDATE_THEME,
209
+ payload: {
210
+ iconColorOpen: theme.palette.mode === 'dark' ? 'grey.200' : 'grey.300',
211
+ iconColor: theme.palette.mode === 'dark' ? 'background.default' : 'grey.100'
212
+ }
213
+ });
214
+ }, [theme.palette.mode]);
215
+
216
+ useEffect(() => {
217
+ setNeedToChangePassword(identity?.needToChangePassword === true);
218
+ }, [identity]);
219
+
220
+ return (
221
+ <LayoutContext.Provider value={value}>
222
+ <Dialog open={needToChangePassword} maxWidth="xs" fullWidth>
223
+ <ChangePasswordForm onSuccess={handlePasswordChange} firstAccess />
224
+ </Dialog>
225
+ {props.children}
226
+ </LayoutContext.Provider>
227
+ );
228
+ }
229
+
230
+ function withLayoutProvider<P, T>(Component: React.ComponentType<P>) {
231
+ return forwardRef((props: P & ILayoutProviderProps, ref: React.ForwardedRef<T>) => {
232
+ const { logoIcon, logoMain, enableNotification } = props;
233
+ return (
234
+ <LayoutProvider logoIcon={logoIcon} logoMain={logoMain} enableNotification={enableNotification}>
235
+ <Component ref={ref} {...props} />
236
+ </LayoutProvider>
237
+ );
238
+ });
239
+ }
240
+
241
+ function useLayoutContext(): ILayoutContext {
242
+ const context = useContext(LayoutContext);
243
+ if (context === undefined) {
244
+ throw new Error('[Layout] useLayoutContext: context undefined. Please provide a valid LayoutContext using LayoutProvider');
245
+ }
246
+ return context;
247
+ }
248
+
249
+ function useLayoutDispatch(): React.Dispatch<ILayoutAction> {
250
+ return useLayoutContext().dispatch;
251
+ }
252
+
253
+ function useLayoutState(): ILayoutState {
254
+ return useLayoutContext().state;
255
+ }
256
+
257
+ function useLayoutMediaState(): ILayoutMediaState {
258
+ return useLayoutState().media;
259
+ }
260
+
261
+ function useLayoutDrawerState(): ILayoutDrawerState {
262
+ return useLayoutState().drawer;
263
+ }
264
+
265
+ function useLayoutLogoState(): ILayoutLogoState {
266
+ return useLayoutState().logo;
267
+ }
268
+
269
+ function useLayoutNotificationsState(): ILayoutNotificationState {
270
+ return useLayoutState().notifications;
271
+ }
272
+
273
+ function useLayoutThemeState(): ILayoutThemeState {
274
+ return useLayoutState().theme;
275
+ }
276
+
277
+ export type { ILayoutProviderProps };
278
+
279
+ export {
280
+ LayoutProvider,
281
+ withLayoutProvider,
282
+ useLayoutContext,
283
+ useLayoutDispatch,
284
+ useLayoutDrawerState,
285
+ useLayoutLogoState,
286
+ useLayoutMediaState,
287
+ useLayoutNotificationsState,
288
+ useLayoutState,
289
+ useLayoutThemeState
290
+ };
@@ -0,0 +1,16 @@
1
+ import { Box, BoxProps } from '@mui/material';
2
+ import { ForwardedRef, forwardRef } from 'react';
3
+ import { useSx } from '../../hooks';
4
+
5
+ type ILayoutWrapperProps = BoxProps;
6
+ const LayoutWrapper = forwardRef((props: ILayoutWrapperProps, ref: ForwardedRef<HTMLElement>) => {
7
+ const sx = useSx(props, { display: 'flex', width: '100%' });
8
+
9
+ return (
10
+ <Box ref={ref} {...props} sx={sx}>
11
+ {props.children}
12
+ </Box>
13
+ );
14
+ });
15
+
16
+ export { LayoutWrapper };
@@ -0,0 +1,10 @@
1
+ export { Layout as default, type ILayoutProps } from './Layout';
2
+ export * from './Content';
3
+ export * from './Footer';
4
+ export * from './Drawer';
5
+ export * from './Header';
6
+ export * from './HorizontalBar';
7
+ export * from './Navigation';
8
+ export * from './NavMenu';
9
+ export * from './Provider';
10
+ export * from './Wrapper';
@@ -13,8 +13,7 @@ const StyledAutocompleteArrayInput = styled(RaAutocompleteArrayInput, {
13
13
  padding: `0px 9px`
14
14
  },
15
15
  '& label.MuiFormLabel-root[data-shrink="false"]': {
16
- minHeight: '18px',
17
- marginTop: '-4px'
16
+ minHeight: '18px'
18
17
  }
19
18
  }));
20
19
 
@@ -28,5 +27,9 @@ AutocompleteArrayInput.propTypes = {
28
27
  ...RaAutocompleteArrayInput.propTypes,
29
28
  ...LabeledInput.propTypes
30
29
  };
30
+ AutocompleteArrayInput.defaultProps = {
31
+ ...RaAutocompleteArrayInput.defaultProps,
32
+ size: 'small'
33
+ };
31
34
 
32
35
  export default AutocompleteArrayInput;
@@ -10,8 +10,7 @@ const StyledAutocompleteInput = styled(RaAutocompleteInput, {
10
10
  width: label === false ? 0 : 'auto'
11
11
  },
12
12
  '& label.MuiFormLabel-root[data-shrink="false"]': {
13
- minHeight: '18px',
14
- marginTop: '-4px'
13
+ minHeight: '18px'
15
14
  },
16
15
  '& .MuiAutocomplete-inputRoot': {
17
16
  // Serve ad allineare l'altezza di un input di tipo Autocomplete a quella degli altri campi utilizzati.
@@ -37,4 +36,9 @@ AutocompleteInput.propTypes = {
37
36
  ...LabeledInput.propTypes
38
37
  };
39
38
 
39
+ AutocompleteInput.defaultProps = {
40
+ ...RaAutocompleteInput.defaultProps,
41
+ size: 'small'
42
+ };
43
+
40
44
  export default AutocompleteInput;
@@ -51,11 +51,7 @@ const ApplicaStyledList = styled(RaList, {
51
51
  alignSelf: 'center',
52
52
  marginTop: 0
53
53
  },
54
- [theme.breakpoints.down('sm')]: {
55
- // Quando lo schermo è piccolo, il filtro viene visualizzato in una colonna.
56
- // Diamo un margine maggiore in basso per evitare che siano troppo vicini.
57
- marginBottom: theme.spacing(1.5)
58
- }
54
+ marginTop: theme.spacing(1.5)
59
55
  },
60
56
  '& .RaFilterFormInput-hideButton': {
61
57
  marginTop: theme.spacing(1),
@@ -6,3 +6,5 @@ import useMenuConfig from './useMenuConfig';
6
6
  import useResourceTitle from './useResourceTitle';
7
7
  import useThemeConfig from './useThemeConfig';
8
8
  export { useAppConfig, useMenu, useBreadcrumbs, useLocalStorage, useThemeConfig, useResourceTitle, useMenuConfig };
9
+ export { useSx } from './mui';
10
+ export { useRefDimensions } from './useRefDimensions';
@@ -0,0 +1,21 @@
1
+ import _ from 'lodash';
2
+ import { SxProps } from '@mui/material';
3
+ import { ComponentProps, useState, useEffect } from 'react';
4
+
5
+ function useSx(props: ComponentProps<{ sx?: SxProps } & any>, sx: SxProps): SxProps {
6
+ const _sx = _.merge(
7
+ _.cloneDeepWith(props?.sx ?? {}, (v) => (_.isFunction(v) ? v : undefined)),
8
+ sx
9
+ ),
10
+ [value, setValue] = useState(_sx);
11
+
12
+ useEffect(() => {
13
+ if (!_.isEqual(value, _sx)) {
14
+ setValue(_sx);
15
+ }
16
+ }, [value, _sx]);
17
+
18
+ return value;
19
+ }
20
+
21
+ export { useSx };
@@ -0,0 +1,61 @@
1
+ import _ from 'lodash';
2
+ import { useEffect, RefObject, useState } from 'react';
3
+
4
+ enum DimensionType {
5
+ CLIENT = 'client',
6
+ OFFSET = 'offset',
7
+ SCROLL = 'scroll',
8
+ BOUNDING = 'bounding'
9
+ }
10
+
11
+ function useRefDimensions(ref: RefObject<HTMLElement | undefined>, type?: DimensionType) {
12
+ const [dimensions, setDimensions] = useState({ width: 1, height: 1 }),
13
+ current = ref.current;
14
+
15
+ useEffect(() => {
16
+ function updateDimensions() {
17
+ let width = 0,
18
+ height = 0;
19
+ switch (type) {
20
+ case DimensionType.CLIENT:
21
+ width = current?.clientWidth ?? 0;
22
+ height = current?.clientHeight ?? 0;
23
+ break;
24
+ case DimensionType.OFFSET:
25
+ width = current?.offsetWidth ?? 0;
26
+ height = current?.offsetHeight ?? 0;
27
+ break;
28
+ case DimensionType.SCROLL:
29
+ width = current?.scrollWidth ?? 0;
30
+ height = current?.scrollHeight ?? 0;
31
+ break;
32
+ case DimensionType.BOUNDING:
33
+ default: {
34
+ const boundingRect = ref.current?.getBoundingClientRect() ?? { width: 0, height: 0 };
35
+ width = boundingRect.width;
36
+ height = boundingRect.height;
37
+ break;
38
+ }
39
+ }
40
+
41
+ setDimensions({
42
+ width: width,
43
+ height: height
44
+ });
45
+ }
46
+ const resizeObserver = new ResizeObserver(updateDimensions);
47
+
48
+ if (!_.isEmpty(ref?.current)) {
49
+ resizeObserver.observe(ref?.current);
50
+ updateDimensions();
51
+ }
52
+
53
+ return () => {
54
+ resizeObserver.disconnect();
55
+ };
56
+ }, [current, type]);
57
+
58
+ return dimensions;
59
+ }
60
+
61
+ export { useRefDimensions };
@@ -1 +0,0 @@
1
- {"version":3,"file":"NavCollapse.d.ts","sourceRoot":"","sources":["../../../../../../../src/components/Layout/Drawer/DrawerContent/Navigation/NavCollapse.jsx"],"names":[],"mappings":";AA2CA;;;;;;;;4CA6WC;;;;;;;;;;;;sBAnYqB,YAAY"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"NavGroup.d.ts","sourceRoot":"","sources":["../../../../../../../src/components/Layout/Drawer/DrawerContent/Navigation/NavGroup.jsx"],"names":[],"mappings":";AA2CA;;;;;;;;;4CAyRC;;;;;;;;;;;;;sBAjTqB,YAAY"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"NavItem.d.ts","sourceRoot":"","sources":["../../../../../../../src/components/Layout/Drawer/DrawerContent/Navigation/NavItem.jsx"],"names":[],"mappings":";AASA;;;4CAkOC;;;;;;;sBArOqB,YAAY"}
@@ -1,3 +0,0 @@
1
- export default Navigation;
2
- declare function Navigation(): import("react/jsx-runtime").JSX.Element;
3
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../../src/components/Layout/Drawer/DrawerContent/Navigation/index.jsx"],"names":[],"mappings":";AAOA,uEA+DC"}
@@ -1,3 +0,0 @@
1
- export default DrawerContent;
2
- declare function DrawerContent(): import("react/jsx-runtime").JSX.Element;
3
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/components/Layout/Drawer/DrawerContent/index.jsx"],"names":[],"mappings":";AAGA,0EAaC"}
@@ -1,5 +0,0 @@
1
- export default DrawerHeaderStyled;
2
- declare const DrawerHeaderStyled: import("@emotion/styled").StyledComponent<import("@mui/system").BoxOwnProps<import("@mui/material").Theme> & Omit<Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & {
3
- ref?: ((instance: HTMLDivElement | null) => void) | import("react").RefObject<HTMLDivElement> | null | undefined;
4
- }, keyof import("@mui/system").BoxOwnProps<import("@mui/material").Theme>> & import("@mui/system").MUIStyledCommonProps<import("@mui/material").Theme>, {}, {}>;
5
- //# sourceMappingURL=DrawerHeaderStyled.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"DrawerHeaderStyled.d.ts","sourceRoot":"","sources":["../../../../../../src/components/Layout/Drawer/DrawerHeader/DrawerHeaderStyled.jsx"],"names":[],"mappings":";AAIA;;gKAMI"}
@@ -1,15 +0,0 @@
1
- export default DrawerHeader;
2
- declare function DrawerHeader({ open, logoMain, logoIcon }: {
3
- open: any;
4
- logoMain: any;
5
- logoIcon: any;
6
- }): import("react/jsx-runtime").JSX.Element;
7
- declare namespace DrawerHeader {
8
- namespace propTypes {
9
- const open: PropTypes.Requireable<boolean>;
10
- const logoMain: PropTypes.Requireable<PropTypes.ReactNodeLike>;
11
- const logoIcon: PropTypes.Requireable<PropTypes.ReactNodeLike>;
12
- }
13
- }
14
- import PropTypes from 'prop-types';
15
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/components/Layout/Drawer/DrawerHeader/index.jsx"],"names":[],"mappings":";AAOA;;;;4CAuBC;;;;;;;;sBA5BqB,YAAY"}
@@ -1,3 +0,0 @@
1
- export default CustomAppBar;
2
- declare function CustomAppBar(): import("react/jsx-runtime").JSX.Element;
3
- //# sourceMappingURL=HorizontalBar.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"HorizontalBar.d.ts","sourceRoot":"","sources":["../../../../../src/components/Layout/Drawer/HorizontalBar.jsx"],"names":[],"mappings":";AAyBA,yEA2BC"}
@@ -1,3 +0,0 @@
1
- export default MobileSection;
2
- declare function MobileSection(): import("react/jsx-runtime").JSX.Element;
3
- //# sourceMappingURL=MobileSection.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"MobileSection.d.ts","sourceRoot":"","sources":["../../../../../../src/components/Layout/Header/HeaderContent/MobileSection.jsx"],"names":[],"mappings":";AAQA,0EAgFC"}
@@ -1,16 +0,0 @@
1
- export default Notification;
2
- declare function Notification({ resource }: {
3
- resource: any;
4
- }): import("react/jsx-runtime").JSX.Element;
5
- declare namespace Notification {
6
- const displayName: string;
7
- namespace defaultProps {
8
- const resource: string;
9
- }
10
- namespace propTypes {
11
- const resource_1: PropTypes.Validator<string>;
12
- export { resource_1 as resource };
13
- }
14
- }
15
- import PropTypes from 'prop-types';
16
- //# sourceMappingURL=Notification.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"Notification.d.ts","sourceRoot":"","sources":["../../../../../../src/components/Layout/Header/HeaderContent/Notification.jsx"],"names":[],"mappings":";AA2BA;;4CAwHC;;;;;;;;;;;sBA5IqB,YAAY"}
@@ -1,31 +0,0 @@
1
- export default NotificationItem;
2
- declare function NotificationItem({ resource, selected, notification, onClick }: {
3
- resource: any;
4
- selected: any;
5
- notification: any;
6
- onClick: any;
7
- }): import("react/jsx-runtime").JSX.Element;
8
- declare namespace NotificationItem {
9
- const displayName: string;
10
- namespace defaultProps {
11
- const resource: string;
12
- const selected: boolean;
13
- }
14
- namespace propTypes {
15
- const resource_1: PropTypes.Validator<string>;
16
- export { resource_1 as resource };
17
- const selected_1: PropTypes.Validator<boolean>;
18
- export { selected_1 as selected };
19
- export const notification: PropTypes.Validator<NonNullable<PropTypes.InferProps<{
20
- id: PropTypes.Requireable<NonNullable<string | number | null | undefined>>;
21
- title: PropTypes.Validator<string>;
22
- content: PropTypes.Validator<string>;
23
- resource: PropTypes.Requireable<string>;
24
- readed: PropTypes.Requireable<NonNullable<string | number | Date | null | undefined>>;
25
- created: PropTypes.Validator<NonNullable<NonNullable<string | number | Date | null | undefined>>>;
26
- }>>>;
27
- export const onClick: PropTypes.Validator<(...args: any[]) => any>;
28
- }
29
- }
30
- import PropTypes from 'prop-types';
31
- //# sourceMappingURL=NotificationItem.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"NotificationItem.d.ts","sourceRoot":"","sources":["../../../../../../src/components/Layout/Header/HeaderContent/NotificationItem.jsx"],"names":[],"mappings":";AAQA;;;;;4CAkEC;;;;;;;;;;;;;;;;;;;;;;;sBArEqB,YAAY"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"Profile.d.ts","sourceRoot":"","sources":["../../../../../../src/components/Layout/Header/HeaderContent/Profile.jsx"],"names":[],"mappings":";AAyBA,oEAwIC"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"ChangePasswordButton.d.ts","sourceRoot":"","sources":["../../../../../../../src/components/Layout/Header/HeaderContent/buttons/ChangePasswordButton.tsx"],"names":[],"mappings":"AAOA,QAAA,MAAM,oBAAoB,+CAkBzB,CAAC;AAEF,eAAe,oBAAoB,CAAC"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"LogoutButton.d.ts","sourceRoot":"","sources":["../../../../../../../src/components/Layout/Header/HeaderContent/buttons/LogoutButton.tsx"],"names":[],"mappings":"AAMA,QAAA,MAAM,YAAY,+CAcjB,CAAC;AAEF,eAAe,YAAY,CAAC"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"StopImpersonateButton.d.ts","sourceRoot":"","sources":["../../../../../../../src/components/Layout/Header/HeaderContent/buttons/StopImpersonateButton.tsx"],"names":[],"mappings":"AAMA,QAAA,MAAM,qBAAqB,sDA8B1B,CAAC;AAEF,eAAe,qBAAqB,CAAC"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../../src/components/Layout/Header/HeaderContent/buttons/index.jsx"],"names":[],"mappings":"iCAAiC,wBAAwB;yBAChC,gBAAgB;kCACP,yBAAyB"}
@@ -1,17 +0,0 @@
1
- export default HeaderContent;
2
- declare function HeaderContent({ logoMain, logoIcon, notification, enableNotification }: {
3
- logoMain: any;
4
- logoIcon: any;
5
- notification: any;
6
- enableNotification: any;
7
- }): import("react/jsx-runtime").JSX.Element;
8
- declare namespace HeaderContent {
9
- namespace propTypes {
10
- const logoMain: PropTypes.Requireable<PropTypes.ReactNodeLike>;
11
- const logoIcon: PropTypes.Requireable<PropTypes.ReactNodeLike>;
12
- const notification: PropTypes.Requireable<string>;
13
- const enableNotification: PropTypes.Requireable<boolean>;
14
- }
15
- }
16
- import PropTypes from 'prop-types';
17
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/components/Layout/Header/HeaderContent/index.jsx"],"names":[],"mappings":";AAUA;;;;;4CAgBC;;;;;;;;;sBAlBqB,YAAY"}