@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,37 +0,0 @@
1
- export default CreateInDialogButton;
2
- declare function CreateInDialogButton({ fullWidth, maxWidth, label, record, redirect, scrollToTop, className, sx, ...props }: {
3
- [x: string]: any;
4
- fullWidth: any;
5
- maxWidth: any;
6
- label: any;
7
- record: any;
8
- redirect: any;
9
- scrollToTop: any;
10
- className: any;
11
- sx: any;
12
- }): import("react/jsx-runtime").JSX.Element;
13
- declare namespace CreateInDialogButton {
14
- namespace defaultProps {
15
- const fullWidth: boolean;
16
- const maxWidth: string;
17
- const label: string;
18
- const scrollToTop: boolean;
19
- }
20
- const propTypes: {
21
- redirect: PropTypes.Requireable<string | boolean>;
22
- fullWidth: PropTypes.Requireable<boolean>;
23
- maxWidth: PropTypes.Requireable<string | boolean>;
24
- label: PropTypes.Requireable<string>;
25
- record: PropTypes.Requireable<object>;
26
- scrollToTop: PropTypes.Requireable<boolean>;
27
- className: PropTypes.Requireable<string>;
28
- sx: PropTypes.Requireable<object>;
29
- alignIcon: PropTypes.Requireable<string>;
30
- children: PropTypes.Requireable<PropTypes.ReactElementLike>;
31
- color: PropTypes.Requireable<string>;
32
- disabled: PropTypes.Requireable<boolean>;
33
- size: PropTypes.Requireable<string>;
34
- };
35
- }
36
- import PropTypes from 'prop-types';
37
- //# sourceMappingURL=CreateInDialogButton.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"CreateInDialogButton.d.ts","sourceRoot":"","sources":["../../../../src/components/ra-buttons/CreateInDialogButton.jsx"],"names":[],"mappings":";AA+HA;;;;;;;;;;4CAsDC;;;;;;;;;;;;;;;;;;;;;;;;sBAtKqB,YAAY"}
@@ -1,28 +0,0 @@
1
- export default AttachmentField;
2
- declare function AttachmentField({ entityId, property, ...props }: {
3
- [x: string]: any;
4
- entityId: any;
5
- property: any;
6
- }): import("react/jsx-runtime").JSX.Element;
7
- declare namespace AttachmentField {
8
- const propTypes: {
9
- source: PropTypes.Requireable<string>;
10
- title: PropTypes.Requireable<string>;
11
- src: PropTypes.Requireable<string>;
12
- target: PropTypes.Requireable<string>;
13
- download: PropTypes.Requireable<NonNullable<string | boolean>>;
14
- ping: PropTypes.Requireable<string>;
15
- rel: PropTypes.Requireable<string>;
16
- sortBy: PropTypes.Requireable<string>;
17
- sortByOrder: PropTypes.Requireable<"ASC" | "DESC">;
18
- label: PropTypes.Requireable<NonNullable<string | boolean | PropTypes.ReactElementLike>>;
19
- sortable: PropTypes.Requireable<boolean>;
20
- className: PropTypes.Requireable<string>;
21
- cellClassName: PropTypes.Requireable<string>;
22
- headerClassName: PropTypes.Requireable<string>;
23
- textAlign: PropTypes.Requireable<"center" | "inherit" | "left" | "right" | "justify">;
24
- emptyText: PropTypes.Requireable<string>;
25
- };
26
- }
27
- import PropTypes from 'prop-types';
28
- //# sourceMappingURL=AttachmentField.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"AttachmentField.d.ts","sourceRoot":"","sources":["../../../../src/components/ra-fields/AttachmentField.jsx"],"names":[],"mappings":";AAeA;;;;4CA0DC;;;;;;;;;;;;;;;;;;;;;sBA9DqB,YAAY"}
@@ -1,17 +0,0 @@
1
- export function BaseAttachmentField(props: any): import("react/jsx-runtime").JSX.Element;
2
- export namespace BaseAttachmentField {
3
- namespace propTypes {
4
- const src: PropTypes.Requireable<string>;
5
- const title: PropTypes.Requireable<NonNullable<string | PropTypes.ReactElementLike | ((...args: any[]) => any) | null | undefined>>;
6
- const target: PropTypes.Requireable<string>;
7
- const download: PropTypes.Requireable<NonNullable<string | boolean | null | undefined>>;
8
- const ping: PropTypes.Requireable<string>;
9
- const rel: PropTypes.Requireable<string>;
10
- const emptyText: PropTypes.Requireable<string>;
11
- const source: PropTypes.Validator<string>;
12
- const className: PropTypes.Requireable<string>;
13
- }
14
- }
15
- export default BaseAttachmentField;
16
- import PropTypes from 'prop-types';
17
- //# sourceMappingURL=BaseAttachmentField.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"BaseAttachmentField.d.ts","sourceRoot":"","sources":["../../../../src/components/ra-fields/BaseAttachmentField.jsx"],"names":[],"mappings":"AASO,yFAmCN;;;;;;;;;;;;;;;sBAxCqB,YAAY"}
@@ -1,17 +0,0 @@
1
- export default FormHeader;
2
- declare function FormHeader({ title, divider }: {
3
- title: any;
4
- divider: any;
5
- }): import("react/jsx-runtime").JSX.Element;
6
- declare namespace FormHeader {
7
- namespace propTypes {
8
- const title: PropTypes.Validator<string>;
9
- const divider: PropTypes.Requireable<boolean>;
10
- }
11
- namespace defaultProps {
12
- const divider_1: boolean;
13
- export { divider_1 as divider };
14
- }
15
- }
16
- import PropTypes from 'prop-types';
17
- //# sourceMappingURL=FormHeader.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"FormHeader.d.ts","sourceRoot":"","sources":["../../../../src/components/ra-forms/FormHeader.jsx"],"names":[],"mappings":";AAsBA;;;4CAQC;;;;;;;;;;;sBA3BqB,YAAY"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"DispositionProps.d.ts","sourceRoot":"","sources":["../../../../../src/components/ra-forms/LongForm/DispositionProps.jsx"],"names":[],"mappings":";AACA;;;;;;IAME;sBAPoB,YAAY"}
@@ -1,45 +0,0 @@
1
- export default LongForm;
2
- declare function LongForm({ spacing: _spacing, ...props }: {
3
- [x: string]: any;
4
- spacing: any;
5
- }): import("react/jsx-runtime").JSX.Element;
6
- declare namespace LongForm {
7
- export namespace propTypes {
8
- export const syncWithLocation: PropTypes.Requireable<boolean>;
9
- export const spacing: PropTypes.Requireable<number>;
10
- export { DispositionProps as tabsDisposition };
11
- export { DispositionProps as contentDisposition };
12
- }
13
- export namespace defaultProps {
14
- const syncWithLocation_1: boolean;
15
- export { syncWithLocation_1 as syncWithLocation };
16
- const spacing_1: number;
17
- export { spacing_1 as spacing };
18
- export namespace tabsDisposition {
19
- const xl: number;
20
- const lg: number;
21
- const md: number;
22
- const sm: number;
23
- const xs: number;
24
- }
25
- export namespace contentDisposition {
26
- const xl_1: number;
27
- export { xl_1 as xl };
28
- const lg_1: number;
29
- export { lg_1 as lg };
30
- const md_1: number;
31
- export { md_1 as md };
32
- const sm_1: number;
33
- export { sm_1 as sm };
34
- const xs_1: number;
35
- export { xs_1 as xs };
36
- }
37
- }
38
- export { LongFormTab as Tab };
39
- export { LongFormTabHeader as Header };
40
- }
41
- import PropTypes from 'prop-types';
42
- import DispositionProps from './DispositionProps';
43
- import LongFormTab from './LongFormTab';
44
- import LongFormTabHeader from './LongFormHeader';
45
- //# sourceMappingURL=LongForm.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"LongForm.d.ts","sourceRoot":"","sources":["../../../../../src/components/ra-forms/LongForm/LongForm.jsx"],"names":[],"mappings":";AASA;;;4CASC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;sBAbqB,YAAY;6BALL,oBAAoB;wBAEzB,eAAe;8BACT,kBAAkB"}
@@ -1,20 +0,0 @@
1
- export default LongFormTabHeader;
2
- declare function LongFormTabHeader({ children, visibility }: {
3
- children: any;
4
- visibility: any;
5
- }): import("react/jsx-runtime").JSX.Element | null;
6
- declare namespace LongFormTabHeader {
7
- namespace propTypes {
8
- const visibility: PropTypes.Requireable<string>;
9
- const position: PropTypes.Validator<string>;
10
- const children: PropTypes.Validator<NonNullable<PropTypes.ReactNodeLike>>;
11
- }
12
- namespace defaultProps {
13
- const position_1: string;
14
- export { position_1 as position };
15
- const visibility_1: string;
16
- export { visibility_1 as visibility };
17
- }
18
- }
19
- import PropTypes from 'prop-types';
20
- //# sourceMappingURL=LongFormHeader.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"LongFormHeader.d.ts","sourceRoot":"","sources":["../../../../../src/components/ra-forms/LongForm/LongFormHeader.jsx"],"names":[],"mappings":";AAOA;;;mDAGC;;;;;;;;;;;;;;sBAVqB,YAAY"}
@@ -1,43 +0,0 @@
1
- export default LongFormTab;
2
- declare function LongFormTab({ intent, hidden, unmountOnExit, label, icon, value, syncWithLocation, selected, onChange, children, badgeColor, badgeContent, ...props }: {
3
- [x: string]: any;
4
- intent: any;
5
- hidden: any;
6
- unmountOnExit: any;
7
- label: any;
8
- icon: any;
9
- value: any;
10
- syncWithLocation: any;
11
- selected: any;
12
- onChange: any;
13
- children: any;
14
- badgeColor: any;
15
- badgeContent: any;
16
- }): import("react/jsx-runtime").JSX.Element | null;
17
- declare namespace LongFormTab {
18
- namespace propTypes {
19
- const intent: PropTypes.Requireable<string>;
20
- const className: PropTypes.Requireable<string>;
21
- const contentClassName: PropTypes.Requireable<string>;
22
- const url: PropTypes.Requireable<string>;
23
- const icon: PropTypes.Requireable<PropTypes.ReactElementLike>;
24
- const label: PropTypes.Validator<NonNullable<NonNullable<string | PropTypes.ReactElementLike | null | undefined>>>;
25
- const value: PropTypes.Requireable<NonNullable<string | number | null | undefined>>;
26
- const syncWithLocation: PropTypes.Requireable<boolean>;
27
- const onChange: PropTypes.Requireable<(...args: any[]) => any>;
28
- const selected: PropTypes.Requireable<boolean>;
29
- const hidden: PropTypes.Requireable<boolean>;
30
- const unmountOnExit: PropTypes.Requireable<boolean>;
31
- const children: PropTypes.Requireable<PropTypes.ReactNodeLike>;
32
- const badgeColor: PropTypes.Requireable<string>;
33
- const badgeContent: PropTypes.Requireable<NonNullable<string | number | null | undefined>>;
34
- }
35
- namespace defaultProps {
36
- const badgeColor_1: string;
37
- export { badgeColor_1 as badgeColor };
38
- const unmountOnExit_1: boolean;
39
- export { unmountOnExit_1 as unmountOnExit };
40
- }
41
- }
42
- import PropTypes from 'prop-types';
43
- //# sourceMappingURL=LongFormTab.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"LongFormTab.d.ts","sourceRoot":"","sources":["../../../../../src/components/ra-forms/LongForm/LongFormTab.jsx"],"names":[],"mappings":";AAiBA;;;;;;;;;;;;;;mDAsEC;;;;;;;;;;;;;;;;;;;;;;;;;;sBA3EqB,YAAY"}
@@ -1,21 +0,0 @@
1
- export function getTabbedFormTabFullPath(tab: any, index: any): any;
2
- export default LongFormTabs;
3
- declare function LongFormTabs({ children, syncWithLocation, value, url, onChange }: {
4
- children: any;
5
- syncWithLocation: any;
6
- value: any;
7
- url: any;
8
- onChange: any;
9
- }): import("react/jsx-runtime").JSX.Element;
10
- declare namespace LongFormTabs {
11
- namespace propTypes {
12
- const children: PropTypes.Requireable<PropTypes.ReactNodeLike>;
13
- const url: PropTypes.Requireable<string>;
14
- const tabsWithErrors: PropTypes.Requireable<(string | null | undefined)[]>;
15
- const syncWithLocation: PropTypes.Requireable<boolean>;
16
- const onChange: PropTypes.Requireable<(...args: any[]) => any>;
17
- const value: PropTypes.Requireable<NonNullable<string | number | null | undefined>>;
18
- }
19
- }
20
- import PropTypes from 'prop-types';
21
- //# sourceMappingURL=LongFormTabs.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"LongFormTabs.d.ts","sourceRoot":"","sources":["../../../../../src/components/ra-forms/LongForm/LongFormTabs.jsx"],"names":[],"mappings":"AAkDO,oEACsE;;AA3B7E;;;;;;4CAwBC;;;;;;;;;;;sBA5CqB,YAAY"}
@@ -1,29 +0,0 @@
1
- export default LongFormView;
2
- declare function LongFormView({ children, formRootPathname, syncWithLocation, spacing, tabs, tabsDisposition, contentDisposition, ...props }: {
3
- [x: string]: any;
4
- children: any;
5
- formRootPathname: any;
6
- syncWithLocation: any;
7
- spacing: any;
8
- tabs: any;
9
- tabsDisposition: any;
10
- contentDisposition: any;
11
- }): import("react/jsx-runtime").JSX.Element;
12
- declare namespace LongFormView {
13
- namespace propTypes {
14
- export const children: PropTypes.Requireable<PropTypes.ReactNodeLike>;
15
- export const spacing: PropTypes.Requireable<number>;
16
- export const syncWithLocation: PropTypes.Requireable<boolean>;
17
- export const tabs: PropTypes.Requireable<PropTypes.ReactElementLike>;
18
- export const formRootPathname: PropTypes.Requireable<string>;
19
- export { DispositionProps as tabsDisposition };
20
- export { DispositionProps as contentDisposition };
21
- }
22
- namespace defaultProps {
23
- const tabs_1: import("react/jsx-runtime").JSX.Element;
24
- export { tabs_1 as tabs };
25
- }
26
- }
27
- import PropTypes from 'prop-types';
28
- import DispositionProps from './DispositionProps';
29
- //# sourceMappingURL=LongFormView.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"LongFormView.d.ts","sourceRoot":"","sources":["../../../../../src/components/ra-forms/LongForm/LongFormView.jsx"],"names":[],"mappings":";AA6BA;;;;;;;;;4CAmFC;;;;;;;;;;;;;;;;sBAvGqB,YAAY;6BALL,oBAAoB"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/components/ra-forms/LongForm/index.jsx"],"names":[],"mappings":";qBAAqB,YAAY"}
@@ -1,22 +0,0 @@
1
- export function AppConfigProvider({ children }: {
2
- children: any;
3
- }): import("react/jsx-runtime").JSX.Element;
4
- export namespace AppConfigProvider {
5
- namespace propTypes {
6
- const children: PropTypes.Requireable<PropTypes.ReactNodeLike>;
7
- }
8
- }
9
- export const AppConfigContext: React.Context<{
10
- /**
11
- * This context is necessary to work with react-admin standard forms when executed
12
- * inside a dialog and deeper in another resource handled inside a primary form.
13
- *
14
- * In this case, when using "EditInDialogButton" or "CreateInDialogButton" components,
15
- * the dialog is opened and the form is rendered inside it. If the form has a subform
16
- * and needs to know the associated resource.
17
- */
18
- openDialogs: never[];
19
- }>;
20
- import PropTypes from 'prop-types';
21
- import React from 'react';
22
- //# sourceMappingURL=AppConfigContext.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"AppConfigContext.d.ts","sourceRoot":"","sources":["../../../src/contexts/AppConfigContext.jsx"],"names":[],"mappings":"AAkBA;;4CA6BC;;;;;;AA/BD;IAXE;;;;;;;OAOG;;GAI+C;sBAd9B,YAAY;kBAFa,OAAO"}
@@ -1,4 +0,0 @@
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,77 +0,0 @@
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
-
30
- const ActionsMenu = ({ children }) => {
31
- const [open, setOpen] = useState(null)
32
- const handleClick = (e) => {
33
- e.stopPropagation()
34
- e.preventDefault()
35
- setOpen(e.currentTarget)
36
- }
37
- const handleClose = () => {
38
- setOpen(null)
39
- }
40
-
41
- if (
42
- !children ||
43
- React.Children.count(children) === 0 ||
44
- (children?.filter && children?.filter((c) => React.isValidElement(c)).length === 0)
45
- ) {
46
- return null
47
- }
48
-
49
- return (
50
- <StyledRoot>
51
- <IconButton
52
- aria-label="more"
53
- aria-haspopup="true"
54
- onClick={handleClick}
55
- color={open ? 'inherit' : 'default'}
56
- >
57
- <MoreVert />
58
- </IconButton>
59
- <StyledMenuPopover open={open} onClose={handleClose} arrow="right-top">
60
- {Children.map(
61
- children,
62
- (action, index) =>
63
- React.isValidElement(action) && (
64
- <MenuItem key={index}>{React.cloneElement(action)}</MenuItem>
65
- ),
66
- )}
67
- </StyledMenuPopover>
68
- </StyledRoot>
69
- )
70
- }
71
-
72
- ActionsMenu.propTypes = {
73
- ...MenuPopover.propTypes,
74
- children: PropTypes.node.isRequired,
75
- }
76
-
77
- export default ActionsMenu
@@ -1,203 +0,0 @@
1
- import {
2
- Button,
3
- CreateButtonClasses,
4
- CreateContextProvider,
5
- SaveButton,
6
- useCreateController,
7
- useNotify,
8
- useRedirect,
9
- useResourceContext,
10
- useTranslate,
11
- } from 'react-admin'
12
- import { Dialog, Fab, useMediaQuery } from '@mui/material'
13
- import React, { useCallback, useState } from 'react'
14
-
15
- import { Add } from '@mui/icons-material'
16
- import PropTypes from 'prop-types'
17
- import { Toolbar } from '../ra-forms'
18
- import clsx from 'clsx'
19
- import { styled } from '@mui/material/styles'
20
- import { useAppConfig } from '../../hooks'
21
- import { useQueryClient } from 'react-query'
22
-
23
- const updateColl = (old, data) => {
24
- const id = data.id
25
- if (!old) return [data]
26
- const index = old.findIndex((record) => record.id === id)
27
- if (index === -1) {
28
- return [...old, data]
29
- }
30
-
31
- return [...old.slice(0, index), { ...old[index], ...data }, ...old.slice(index + 1)]
32
- }
33
- const setManyReferenceQueryData = (res, data) => {
34
- const result = res && res.data ? { data: updateColl(res.data, data), total: res.total + 1 } : res
35
- return result
36
- }
37
- const setManyQueryData = (coll, data) => (coll && coll.length > 0 ? updateColl(coll, data) : coll)
38
- const setListQueryData = (res, data) =>
39
- res && res.data ? { ...res, data: updateColl(res.data, data), total: res.total + 1 } : res
40
-
41
- const CreateInDialogContent = ({ onClose, record, children, redirect: _redirect }) => {
42
- const queryClient = useQueryClient()
43
- const resource = useResourceContext()
44
- const redirect = useRedirect()
45
- const notify = useNotify()
46
- const handleSuccess = useCallback(
47
- (data) => {
48
- const now = Date.now()
49
- const updatedAt = now
50
-
51
- queryClient.setQueryData([resource, 'getOne', { id: data.id }], data)
52
- queryClient.setQueriesData([resource, 'getList'], (res) => setListQueryData(res, data), {
53
- updatedAt,
54
- })
55
- queryClient.setQueriesData([resource, 'getMany'], (coll) => setManyQueryData(coll, data), {
56
- updatedAt,
57
- })
58
- queryClient.setQueriesData(
59
- [resource, 'getManyReference'],
60
- (res) => setManyReferenceQueryData(res, data),
61
- { updatedAt },
62
- )
63
-
64
- onClose()
65
- notify('ra.notification.created')
66
- if (_redirect !== undefined) {
67
- redirect(_redirect, resource, data.id, data)
68
- }
69
- },
70
- [onClose, queryClient, resource, notify, redirect, _redirect],
71
- )
72
- const { save, isLoading } = useCreateController({
73
- mutationOptions: {
74
- onSuccess: handleSuccess,
75
- },
76
- })
77
- return (
78
- <CreateContextProvider
79
- value={{
80
- record: record,
81
- save: save,
82
- saving: isLoading,
83
- redirect: _redirect,
84
- }}
85
- >
86
- {React.cloneElement(children, {
87
- ...children.props,
88
- toolbar: (
89
- <Toolbar>
90
- <Button variant="text" size="medium" label="ra.action.cancel" onClick={onClose} />
91
- <SaveButton />
92
- </Toolbar>
93
- ),
94
- })}
95
- </CreateContextProvider>
96
- )
97
- }
98
-
99
- CreateInDialogContent.propTypes = {
100
- children: PropTypes.node,
101
- onClose: PropTypes.func,
102
- record: PropTypes.object,
103
- redirect: PropTypes.oneOf(['list', 'edit', 'show', false]),
104
- }
105
- CreateInDialogContent.defaultProps = {
106
- redirect: false,
107
- }
108
- const scrollStates = {
109
- true: { _scrollToTop: true },
110
- false: {},
111
- }
112
-
113
- const StyledFab = styled(Fab, {
114
- name: 'RaApplicaCreateInDialogButton',
115
- overridesResolver: (_props, styles) => styles.root,
116
- })(({ theme }) => ({
117
- [`&.${CreateButtonClasses.floating}`]: {
118
- color: theme.palette.getContrastText(theme.palette.primary.main),
119
- margin: 0,
120
- top: 'auto',
121
- right: 20,
122
- bottom: 60,
123
- left: 'auto',
124
- position: 'fixed',
125
- zIndex: 1000,
126
- },
127
- }))
128
- const CreateInDialogButton = ({
129
- fullWidth,
130
- maxWidth,
131
- label,
132
- record,
133
- redirect,
134
- scrollToTop,
135
- className,
136
- sx,
137
- ...props
138
- }) => {
139
- const [open, setOpen] = useState(false)
140
- const translate = useTranslate()
141
- const resource = useResourceContext()
142
- const { openDialog, closeDialog } = useAppConfig()
143
-
144
- const handleOpen = useCallback(
145
- () => openDialog(resource, () => setOpen(true)),
146
- [openDialog, resource],
147
- )
148
- const handleClose = useCallback(
149
- () => closeDialog(resource, () => setOpen(false)),
150
- [closeDialog, resource],
151
- )
152
- const isSmall = useMediaQuery((theme) => theme.breakpoints.down('md'))
153
- return (
154
- <>
155
- {isSmall ? (
156
- <StyledFab
157
- {...props}
158
- state={scrollStates[String(scrollToTop)]}
159
- // @ts-ignore FabProps ships its own runtime palette `FabPropsColorOverrides` provoking an overlap error with `ButtonProps`
160
- color="primary"
161
- className={clsx(CreateButtonClasses.floating, className)}
162
- aria-label={label && translate(label)}
163
- onClick={handleOpen}
164
- >
165
- <Add />
166
- </StyledFab>
167
- ) : (
168
- <Button {...props} sx={sx} label={label} onClick={handleOpen}>
169
- <Add />
170
- </Button>
171
- )}
172
- <Dialog open={open} onClose={handleClose} fullWidth={fullWidth} maxWidth={maxWidth}>
173
- <CreateInDialogContent
174
- {...props}
175
- redirect={redirect}
176
- record={record}
177
- onClose={handleClose}
178
- />
179
- </Dialog>
180
- </>
181
- )
182
- }
183
-
184
- CreateInDialogButton.defaultProps = {
185
- fullWidth: true,
186
- maxWidth: 'md',
187
- label: 'ra.action.create',
188
- scrollToTop: true,
189
- }
190
-
191
- CreateInDialogButton.propTypes = {
192
- ...Button.propTypes,
193
- redirect: PropTypes.oneOf(['list', 'edit', 'show', false]),
194
- fullWidth: PropTypes.bool,
195
- maxWidth: PropTypes.oneOf(['xs', 'sm', 'md', 'lg', 'xl', false]),
196
- label: PropTypes.string,
197
- record: PropTypes.object,
198
- scrollToTop: PropTypes.bool,
199
- className: PropTypes.string,
200
- sx: PropTypes.object,
201
- }
202
-
203
- export default CreateInDialogButton