@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,15 +1,31 @@
1
- import { FileInput as RaFileInput, useRecordContext } from 'react-admin'
1
+ import { FileInput as RaFileInput, useRecordContext } from 'react-admin';
2
2
 
3
- import { AttachmentField } from '../ra-fields'
4
- import LabeledInput from './LabeledInput'
5
- import PropTypes from 'prop-types'
6
- import React from 'react'
7
- import { styled } from '@mui/material/styles'
3
+ import { AttachmentField } from '../ra-fields';
4
+ import LabeledInput from './LabeledInput';
5
+ import PropTypes from 'prop-types';
6
+ import React from 'react';
7
+ import { styled } from '@mui/material/styles';
8
+
9
+ const removeDeleteIfNecessary = (disabled) => {
10
+ if (disabled) {
11
+ return {
12
+ '& .RaFileInput-removeButton > .RaFileInputPreview-removeButton': {
13
+ display: 'none',
14
+ visiblity: 'hidden'
15
+ },
16
+ '& .RaFileInput-dropZone': {
17
+ display: 'none',
18
+ visiblity: 'hidden'
19
+ }
20
+ };
21
+ }
22
+ return {};
23
+ };
8
24
 
9
25
  const StyledFileInput = styled(RaFileInput, {
10
26
  name: 'RaApplicaFileInput',
11
- slot: 'root',
12
- })(({ theme }) => ({
27
+ slot: 'root'
28
+ })(({ disabled, theme }) => ({
13
29
  '& .previews': {},
14
30
  '& .previews>div': {
15
31
  marginTop: theme.spacing(1),
@@ -19,39 +35,40 @@ const StyledFileInput = styled(RaFileInput, {
19
35
  '& button': {
20
36
  float: 'right',
21
37
  placeItems: 'flex-end',
22
- verticalAlign: 'middle',
38
+ verticalAlign: 'middle'
23
39
  },
24
40
  '&:hover': {
25
- backgroundColor: theme.palette.action.hover,
41
+ backgroundColor: theme.palette.action.hover
26
42
  },
27
43
  '& .MuiLink-root': {
28
- fontSize: theme.typography.body1.fontSize,
29
- },
44
+ fontSize: theme.typography.body1.fontSize
45
+ }
30
46
  },
31
- }))
47
+ ...removeDeleteIfNecessary(disabled)
48
+ }));
32
49
 
33
- const AttachmentInput = ({ children, ...props }) => {
34
- const record = useRecordContext(props)
35
- const property = props?.source
36
- const entityId = record?.id
50
+ const AttachmentInput = ({ children, disabled, ...props }) => {
51
+ const record = useRecordContext(props);
52
+ const property = props?.source;
53
+ const entityId = record?.id;
37
54
  return (
38
55
  <LabeledInput {...props}>
39
- <StyledFileInput>
40
- {React.cloneElement(children, { ...children.props, entityId, property })}
41
- </StyledFileInput>
56
+ <StyledFileInput disabled={disabled}>{React.cloneElement(children, { ...children.props, entityId, property })}</StyledFileInput>
42
57
  </LabeledInput>
43
- )
44
- }
58
+ );
59
+ };
45
60
 
46
61
  AttachmentInput.propTypes = {
47
62
  ...RaFileInput.propTypes,
48
63
  children: PropTypes.node,
49
64
  multiple: PropTypes.bool,
50
- }
65
+ disabled: PropTypes.bool
66
+ };
51
67
 
52
68
  AttachmentInput.defaultProps = {
53
69
  children: <AttachmentField title="name" source="path" />,
54
70
  multiple: true,
55
- }
71
+ disabled: false
72
+ };
56
73
 
57
- export default AttachmentInput
74
+ export default AttachmentInput;
@@ -11,11 +11,16 @@ const StyledAutocompleteInput = styled(RaAutocompleteInput, {
11
11
  }
12
12
  }))
13
13
 
14
- const AutocompleteInput = ({ ...props }) => (
15
- <LabeledInput {...props}>
16
- <StyledAutocompleteInput />
17
- </LabeledInput>
18
- )
14
+ const AutocompleteInput = (props) => {
15
+ // Sanitize props removing "perPage":
16
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
17
+ const { perPage, ...rest } = props
18
+ return (
19
+ <LabeledInput {...rest}>
20
+ <StyledAutocompleteInput />
21
+ </LabeledInput>
22
+ )
23
+ }
19
24
  AutocompleteInput.propTypes = {
20
25
  ...RaAutocompleteInput.propTypes,
21
26
  ...LabeledInput.propTypes
@@ -1,19 +1,19 @@
1
- import { FieldTitle, useInput } from 'react-admin'
2
- import { FormHelperText, InputLabel, Stack } from '@mui/material'
1
+ import { FieldTitle, useInput } from 'react-admin';
2
+ import { FormHelperText, InputLabel, Stack } from '@mui/material';
3
3
 
4
- import PropTypes from 'prop-types'
5
- import React from 'react'
6
- import { useAppConfig } from '../../hooks'
7
- import { useTheme } from '@emotion/react'
4
+ import PropTypes from 'prop-types';
5
+ import React from 'react';
6
+ import { useAppConfig } from '../../hooks';
7
+ import { useTheme } from '@emotion/react';
8
8
 
9
- const LabeledInput = ({ label, children, display, helperText, sx, ...props }) => {
10
- const theme = useTheme()
11
- const { getCurrentDialog } = useAppConfig()
12
- const { source, resource, isRequired } = props
9
+ const LabeledInput = ({ label, children, display, helperText, sx, addLabel, ...props }) => {
10
+ const theme = useTheme();
11
+ const { getCurrentDialog } = useAppConfig();
12
+ const { source, resource, isRequired } = props;
13
13
  const {
14
- fieldState: { invalid },
15
- } = useInput(props)
16
- const dialogResource = getCurrentDialog()
14
+ fieldState: { invalid }
15
+ } = useInput(props);
16
+ const dialogResource = getCurrentDialog();
17
17
  return (
18
18
  <Stack
19
19
  spacing={1}
@@ -24,33 +24,28 @@ const LabeledInput = ({ label, children, display, helperText, sx, ...props }) =>
24
24
  // remove error message colorization when the field is in error state.
25
25
  color: invalid ? theme.palette.error.main : theme.palette.text.secondary,
26
26
  '& span': {
27
- display: 'none',
28
- },
27
+ display: 'none'
28
+ }
29
29
  },
30
- ...sx,
30
+ ...sx
31
31
  }}
32
32
  >
33
- {display === 'label' && label !== false && (
33
+ {display === 'label' && label !== false && addLabel !== false && (
34
34
  <InputLabel error={invalid === true}>
35
- <FieldTitle
36
- label={label}
37
- source={source}
38
- resource={dialogResource || resource}
39
- isRequired={isRequired}
40
- />
35
+ <FieldTitle label={label} source={source} resource={dialogResource || resource} isRequired={isRequired} />
41
36
  </InputLabel>
42
37
  )}
43
38
  {React.cloneElement(children, {
44
39
  ...children.props,
45
40
  ...props,
46
- label: display === 'legend' ? label : false,
41
+ label: display === 'legend' ? label : false
47
42
  })}
48
43
  {display === 'label' && helperText && (
49
44
  <FormHelperText
50
45
  sx={{
51
46
  pl: 2,
52
47
  pb: 2,
53
- marginTop: '0 !important',
48
+ marginTop: '0 !important'
54
49
  }}
55
50
  error={invalid === true}
56
51
  >
@@ -58,8 +53,8 @@ const LabeledInput = ({ label, children, display, helperText, sx, ...props }) =>
58
53
  </FormHelperText>
59
54
  )}
60
55
  </Stack>
61
- )
62
- }
56
+ );
57
+ };
63
58
 
64
59
  LabeledInput.propTypes = {
65
60
  sx: PropTypes.object,
@@ -70,11 +65,11 @@ LabeledInput.propTypes = {
70
65
  isRequired: PropTypes.bool,
71
66
  source: PropTypes.string,
72
67
  display: PropTypes.oneOf(['legend', 'label']),
73
- helperText: PropTypes.oneOfType([PropTypes.string, PropTypes.bool]),
74
- }
68
+ helperText: PropTypes.oneOfType([PropTypes.string, PropTypes.bool])
69
+ };
75
70
 
76
71
  LabeledInput.defaultProps = {
77
- display: 'label',
78
- }
72
+ display: 'label'
73
+ };
79
74
 
80
- export default LabeledInput
75
+ export default LabeledInput;
@@ -1,24 +1,24 @@
1
- import LabeledInput from './LabeledInput'
2
- import { SelectInput as RaSelectInput } from 'react-admin'
3
- import { styled } from '@mui/material/styles'
1
+ import LabeledInput from './LabeledInput';
2
+ import { SelectInput as RaSelectInput } from 'react-admin';
3
+ import { styled } from '@mui/material/styles';
4
4
 
5
5
  const ApplicaStyledSelectInput = styled(RaSelectInput, {
6
6
  name: 'RaApplicaSelectArrayInput',
7
- slot: 'Root',
7
+ slot: 'Root'
8
8
  })(({ label }) => ({
9
9
  '& legend': {
10
- width: label === false ? 0 : 'auto',
11
- },
12
- }))
10
+ width: label === false ? 0 : 'auto'
11
+ }
12
+ }));
13
13
  const SelectInput = (props) => (
14
14
  <LabeledInput {...props}>
15
15
  <ApplicaStyledSelectInput />
16
16
  </LabeledInput>
17
- )
17
+ );
18
18
 
19
19
  SelectInput.propTypes = {
20
20
  ...RaSelectInput.propTypes,
21
- ...LabeledInput.propTypes,
22
- }
21
+ ...LabeledInput.propTypes
22
+ };
23
23
 
24
- export default SelectInput
24
+ export default SelectInput;
@@ -1,52 +1,48 @@
1
- import { maxLength as maxLengthValidator, useTranslate } from 'react-admin'
1
+ import { maxLength as maxLengthValidator, useTranslate } from 'react-admin';
2
2
 
3
- import PropTypes from 'prop-types'
4
- import React from 'react'
5
- import TextInput from './TextInput'
6
- import { useController } from 'react-hook-form'
3
+ import PropTypes from 'prop-types';
4
+ import TextInput from './TextInput';
5
+ import { useController } from 'react-hook-form';
7
6
 
8
7
  const SmartTextInput = ({ ...props }) => {
9
- const translate = useTranslate()
10
- const validationFn = maxLengthValidator(props?.maxLength, 'app.input.max_length_error')
11
- const value = useController({ name: props?.source })?.field?.value
8
+ const translate = useTranslate();
9
+ const validationFn = maxLengthValidator(props?.maxLength, 'app.input.max_length_error');
10
+ const value = useController({ name: props?.source })?.field?.value;
12
11
 
13
- let helperText = props.helperText
14
- let validate = props.validate
12
+ let helperText = props.helperText;
13
+ let validate = props.validate;
15
14
 
16
15
  if (!validate) {
17
- validate = [validationFn]
16
+ validate = [validationFn];
18
17
  } else if (Array.isArray(validate)) {
19
18
  if (validate.indexOf(validationFn) === -1) {
20
- validate.push(validationFn)
19
+ validate.push(validationFn);
21
20
  }
22
21
  }
23
22
 
24
23
  const usedCharsInfo = translate('app.input.max_length_info', {
25
24
  count: value?.length || 0,
26
- max: props?.maxLength,
27
- })
25
+ max: props?.maxLength
26
+ });
28
27
 
29
28
  if (props?.maxLength) {
30
- helperText =
31
- helperText && helperText.length > 0
32
- ? `${usedCharsInfo} - ${translate(helperText)}`
33
- : usedCharsInfo
29
+ helperText = helperText && helperText.length > 0 ? `${usedCharsInfo} - ${translate(helperText)}` : usedCharsInfo;
34
30
  }
35
31
 
36
- return <TextInput {...props} validate={validate} helperText={helperText} />
37
- }
32
+ return <TextInput {...props} validate={validate} helperText={helperText} />;
33
+ };
38
34
 
39
- SmartTextInput.displayName = 'SmartTextInput'
35
+ SmartTextInput.displayName = 'SmartTextInput';
40
36
 
41
37
  SmartTextInput.defaultProps = {
42
- multiline: false,
43
- }
38
+ multiline: false
39
+ };
44
40
 
45
41
  SmartTextInput.propTypes = {
46
42
  ...TextInput.propTypes,
47
43
  maxLength: PropTypes.number,
48
44
  multiline: PropTypes.bool,
49
- rows: PropTypes.number,
50
- }
45
+ rows: PropTypes.number
46
+ };
51
47
 
52
- export default SmartTextInput
48
+ export default SmartTextInput;
@@ -1,20 +1,20 @@
1
- import LabeledInput from './LabeledInput'
2
- import { TextInput as RaTextInput } from 'react-admin'
3
- import React from 'react'
1
+ import LabeledInput from './LabeledInput';
2
+ import { TextInput as RaTextInput } from 'react-admin';
3
+ import React from 'react';
4
4
 
5
5
  const TextInput = (props) => (
6
6
  <LabeledInput {...props}>
7
7
  <RaTextInput />
8
8
  </LabeledInput>
9
- )
9
+ );
10
10
 
11
11
  TextInput.defaultProps = {
12
- ...RaTextInput.defaultProps,
13
- }
12
+ ...RaTextInput.defaultProps
13
+ };
14
14
 
15
15
  TextInput.propTypes = {
16
16
  ...RaTextInput.propTypes,
17
- ...LabeledInput.propTypes,
18
- }
17
+ ...LabeledInput.propTypes
18
+ };
19
19
 
20
- export default TextInput
20
+ export default TextInput;
@@ -0,0 +1,67 @@
1
+ import { createContext, useState } from 'react';
2
+
3
+ import PropTypes from 'prop-types';
4
+
5
+ export type InitialStateProps = {
6
+ openDialogs: string[];
7
+ getCurrentDialog: () => string | null;
8
+ openDialog: (id: string, callback: () => void) => void;
9
+ closeDialog: (id: string, callback: () => void) => void;
10
+ };
11
+
12
+ const initialState = {
13
+ /**
14
+ * This context is necessary to work with react-admin standard forms when executed
15
+ * inside a dialog and deeper in another resource handled inside a primary form.
16
+ *
17
+ * In this case, when using "EditInDialogButton" or "CreateInDialogButton" components,
18
+ * the dialog is opened and the form is rendered inside it. If the form has a subform
19
+ * and needs to know the associated resource.
20
+ */
21
+ openDialogs: [],
22
+ getCurrentDialog: () => null,
23
+ openDialog: (id: string, callback: () => void): void => {
24
+ throw new Error(`openDialog not yet ready for: ${id}, ${callback}`);
25
+ },
26
+ closeDialog: (id: string, callback: () => void): void => {
27
+ throw new Error(`closeDialog not yet ready for: ${id}, ${callback}`);
28
+ }
29
+ };
30
+
31
+ const AppConfigContext = createContext(initialState);
32
+
33
+ const AppConfigProvider = ({ children }: { children: React.ReactNode }) => {
34
+ const [config, setConfig] = useState(initialState);
35
+ const openDialog = (id: string, callback: () => void) => {
36
+ setConfig((config: any) => ({ ...config, openDialogs: [...config.openDialogs, id] }));
37
+ if (callback) callback();
38
+ };
39
+ const closeDialog = (id: string, callback: () => void) => {
40
+ setConfig((config) => ({
41
+ ...config,
42
+ openDialogs: config.openDialogs.filter((modalId) => modalId !== id)
43
+ }));
44
+ if (callback) callback();
45
+ };
46
+
47
+ const getCurrentDialog = () => (config.openDialogs.length > 0 ? config.openDialogs[config.openDialogs.length - 1] : null);
48
+
49
+ return (
50
+ <AppConfigContext.Provider
51
+ value={{
52
+ ...config,
53
+ openDialog,
54
+ closeDialog,
55
+ getCurrentDialog
56
+ }}
57
+ >
58
+ {children}
59
+ </AppConfigContext.Provider>
60
+ );
61
+ };
62
+
63
+ AppConfigProvider.propTypes = {
64
+ children: PropTypes.node
65
+ };
66
+
67
+ export { AppConfigProvider, AppConfigContext };
@@ -1,6 +1,6 @@
1
- import PropTypes from 'prop-types'
2
- import { createContext } from 'react'
3
- import { useLocalStorage } from '../hooks'
1
+ import PropTypes from 'prop-types';
2
+ import { createContext } from 'react';
3
+ import { useLocalStorage } from '../hooks';
4
4
 
5
5
  const initialState = {
6
6
  /**
@@ -82,30 +82,26 @@ const initialState = {
82
82
  /**
83
83
  * Default spacing for elements
84
84
  */
85
- spacing: 2,
86
- }
85
+ spacing: 2
86
+ };
87
87
 
88
- const ThemeConfigContext = createContext(initialState)
88
+ const ThemeConfigContext = createContext(initialState);
89
89
 
90
- const isVerticalLayout = (layout) => layout === 'vertical'
91
- const isHorizontalLayout = (layout) => layout === 'horizontal'
90
+ const isVerticalLayout = (layout) => layout === 'vertical';
91
+ const isHorizontalLayout = (layout) => layout === 'horizontal';
92
92
 
93
93
  const ThemeConfigProvider = ({ children }) => {
94
- const [config, setConfig] = useLocalStorage('theme-config', initialState)
95
- const setFontFamily = (fontFamily) => setConfig((config) => ({ ...config, fontFamily }))
96
- const setMenuOrientation = (menuOrientation) =>
97
- setConfig((config) => ({ ...config, menuOrientation }))
98
- const setMiniDrawer = (miniDrawer) => setConfig((config) => ({ ...config, miniDrawer }))
99
- const setContainer = (container) => setConfig((config) => ({ ...config, container }))
100
- const setMode = (mode) => setConfig((config) => ({ ...config, mode }))
101
- const setPresetColor = (presetColor) => setConfig((config) => ({ ...config, presetColor }))
102
- const setThemeDirection = (themeDirection) =>
103
- setConfig((config) => ({ ...config, themeDirection }))
104
- const setAppDefaultPath = (appDefaultPath) =>
105
- setConfig((config) => ({ ...config, appDefaultPath }))
106
- const setDrawerWidth = (drawerWidth) => setConfig((config) => ({ ...config, drawerWidth }))
107
- const setHorizontalMaxItems = (horizontalMaxItems) =>
108
- setConfig((config) => ({ ...config, horizontalMaxItems }))
94
+ const [config, setConfig] = useLocalStorage('theme-config', initialState);
95
+ const setFontFamily = (fontFamily) => setConfig((config) => ({ ...config, fontFamily }));
96
+ const setMenuOrientation = (menuOrientation) => setConfig((config) => ({ ...config, menuOrientation }));
97
+ const setMiniDrawer = (miniDrawer) => setConfig((config) => ({ ...config, miniDrawer }));
98
+ const setContainer = (container) => setConfig((config) => ({ ...config, container }));
99
+ const setMode = (mode) => setConfig((config) => ({ ...config, mode }));
100
+ const setPresetColor = (presetColor) => setConfig((config) => ({ ...config, presetColor }));
101
+ const setThemeDirection = (themeDirection) => setConfig((config) => ({ ...config, themeDirection }));
102
+ const setAppDefaultPath = (appDefaultPath) => setConfig((config) => ({ ...config, appDefaultPath }));
103
+ const setDrawerWidth = (drawerWidth) => setConfig((config) => ({ ...config, drawerWidth }));
104
+ const setHorizontalMaxItems = (horizontalMaxItems) => setConfig((config) => ({ ...config, horizontalMaxItems }));
109
105
  return (
110
106
  <ThemeConfigContext.Provider
111
107
  value={{
@@ -123,16 +119,16 @@ const ThemeConfigProvider = ({ children }) => {
123
119
  setHorizontalMaxItems,
124
120
 
125
121
  isVerticalLayout,
126
- isHorizontalLayout,
122
+ isHorizontalLayout
127
123
  }}
128
124
  >
129
125
  {children}
130
126
  </ThemeConfigContext.Provider>
131
- )
132
- }
127
+ );
128
+ };
133
129
 
134
130
  ThemeConfigProvider.propTypes = {
135
- children: PropTypes.node,
136
- }
131
+ children: PropTypes.node
132
+ };
137
133
 
138
- export { ThemeConfigProvider, ThemeConfigContext }
134
+ export { ThemeConfigProvider, ThemeConfigContext };
package/src/index.jsx CHANGED
@@ -1,10 +1,10 @@
1
- export { default as Admin } from './Admin'
2
- export { default as ApplicaAdmin } from './ApplicaAdmin'
1
+ export { default as Admin } from './Admin';
2
+ export { default as ApplicaAdmin } from './ApplicaAdmin';
3
3
 
4
- export * from './hooks'
5
- export * from './components'
6
- export * from './contexts'
7
- export * from './utils'
4
+ export * from './hooks';
5
+ export * from './components';
6
+ export * from './contexts';
7
+ export * from './utils';
8
8
 
9
9
  export {
10
10
  ArrayInput,
@@ -22,6 +22,7 @@ export {
22
22
  DeleteWithConfirmButton,
23
23
  DeleteWithUndoButton,
24
24
  EditButton,
25
+ FieldTitle,
25
26
  email,
26
27
  Form,
27
28
  HttpError,
@@ -40,11 +41,11 @@ export {
40
41
  Resource,
41
42
  ResourceContextProvider,
42
43
  SaveButton,
43
- SimpleFormIterator,
44
44
  SimpleFormIteratorContext,
45
45
  SimpleList,
46
46
  SingleFieldList,
47
47
  TopToolbar,
48
+ UrlField,
48
49
  useArrayInput,
49
50
  useAuthProvider,
50
51
  useDataProvider,
@@ -57,6 +58,7 @@ export {
57
58
  useNotify,
58
59
  usePermissions,
59
60
  useRecordContext,
61
+ useRefresh,
60
62
  useResourceContext,
61
63
  useResourceDefinition,
62
64
  useResourceDefinitions,
@@ -64,4 +66,4 @@ export {
64
66
  useUnselect,
65
67
  useUnselectAll,
66
68
  useUpdateMany
67
- } from 'react-admin'
69
+ } from 'react-admin';
@@ -1,6 +1,6 @@
1
1
  // ==============================|| OVERRIDES - AUTOCOMPLETE ||============================== //
2
2
 
3
- export default function Autocomplete() {
3
+ export default function Autocomplete(theme) {
4
4
  return {
5
5
  MuiAutocomplete: {
6
6
  styleOverrides: {
@@ -13,6 +13,9 @@ export default function Autocomplete() {
13
13
  width: 'auto',
14
14
  height: 'auto',
15
15
  },
16
+ popper: {
17
+ border: `1px solid ${theme.palette.mode === 'dark' ? theme.palette.dark.main : theme.palette.grey[100]}`,
18
+ },
16
19
  clearIndicator: {
17
20
  width: 'auto',
18
21
  height: 'auto',
@@ -55,7 +55,7 @@ export default function ComponentsOverrides(theme) {
55
55
  AccordionSummary(theme),
56
56
  Alert(theme),
57
57
  AlertTitle(),
58
- Autocomplete(),
58
+ Autocomplete(theme),
59
59
  Badge(theme),
60
60
  Button(theme),
61
61
  ButtonBase(),
@@ -1,2 +1,2 @@
1
- export * from './time'
2
- export * from './lang'
1
+ export * from './time';
2
+ export * from './lang';
package/src/utils/lang.js CHANGED
@@ -1,12 +1,12 @@
1
1
  export function uuid() {
2
- var d = new Date().getTime()
2
+ var d = new Date().getTime();
3
3
  if (window.performance && typeof window.performance.now === 'function') {
4
- d += performance.now() //use high-precision timer if available
4
+ d += performance.now(); //use high-precision timer if available
5
5
  }
6
6
  var uuid = 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function (c) {
7
- var r = (d + Math.random() * 16) % 16 | 0
8
- d = Math.floor(d / 16)
9
- return (c == 'x' ? r : (r & 0x3) | 0x8).toString(16)
10
- })
11
- return uuid
7
+ var r = (d + Math.random() * 16) % 16 | 0;
8
+ d = Math.floor(d / 16);
9
+ return (c == 'x' ? r : (r & 0x3) | 0x8).toString(16);
10
+ });
11
+ return uuid;
12
12
  }
package/src/utils/time.js CHANGED
@@ -1,13 +1,13 @@
1
- import dayjs from 'dayjs'
1
+ import dayjs from 'dayjs';
2
2
 
3
3
  const parseTime = (time) => {
4
- const args = time.split(':')
4
+ const args = time.split(':');
5
5
  if (args.length === 1) {
6
- args.push('00')
6
+ args.push('00');
7
7
  }
8
8
 
9
- const d = dayjs().hour(args[0]).minute(args[1])
10
- return d
11
- }
9
+ const d = dayjs().hour(args[0]).minute(args[1]);
10
+ return d;
11
+ };
12
12
 
13
- export { parseTime }
13
+ export { parseTime };
@@ -1,15 +0,0 @@
1
- export default ActionsMenu;
2
- declare function ActionsMenu({ children }: {
3
- children: any;
4
- }): import("react/jsx-runtime").JSX.Element | null;
5
- declare namespace ActionsMenu {
6
- const propTypes: {
7
- children: PropTypes.Validator<NonNullable<PropTypes.ReactNodeLike>>;
8
- sx: PropTypes.Requireable<object>;
9
- open: PropTypes.Requireable<object>;
10
- disabledArrow: PropTypes.Requireable<boolean>;
11
- arrow: PropTypes.Requireable<string>;
12
- };
13
- }
14
- import PropTypes from 'prop-types';
15
- //# sourceMappingURL=ActionsMenu.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"ActionsMenu.d.ts","sourceRoot":"","sources":["../../../src/components/ActionsMenu.jsx"],"names":[],"mappings":";AA6BA;;mDAwCC;;;;;;;;;;sBAhEqB,YAAY"}