@applica-software-guru/react-admin 1.1.113 → 1.2.115

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 (71) hide show
  1. package/bitbucket-pipelines.yml +14 -15
  2. package/dist/components/ra-forms/LongForm/BaseForm.d.ts +8 -0
  3. package/dist/components/ra-forms/LongForm/BaseForm.d.ts.map +1 -0
  4. package/dist/components/ra-forms/LongForm/Content.d.ts +8 -0
  5. package/dist/components/ra-forms/LongForm/Content.d.ts.map +1 -0
  6. package/dist/components/ra-forms/LongForm/Form.d.ts +11 -0
  7. package/dist/components/ra-forms/LongForm/Form.d.ts.map +1 -0
  8. package/dist/components/ra-forms/LongForm/NavMenu.d.ts +19 -0
  9. package/dist/components/ra-forms/LongForm/NavMenu.d.ts.map +1 -0
  10. package/dist/components/ra-forms/LongForm/Provider.d.ts +15 -0
  11. package/dist/components/ra-forms/LongForm/Provider.d.ts.map +1 -0
  12. package/dist/components/ra-forms/LongForm/Sidebar.d.ts +23 -0
  13. package/dist/components/ra-forms/LongForm/Sidebar.d.ts.map +1 -0
  14. package/dist/components/ra-forms/LongForm/Tab.d.ts +11 -0
  15. package/dist/components/ra-forms/LongForm/Tab.d.ts.map +1 -0
  16. package/dist/components/ra-forms/LongForm/hooks.d.ts +5 -0
  17. package/dist/components/ra-forms/LongForm/hooks.d.ts.map +1 -0
  18. package/dist/components/ra-forms/LongForm/index.d.ts +30 -2
  19. package/dist/components/ra-forms/LongForm/index.d.ts.map +1 -1
  20. package/dist/components/ra-forms/LongForm/types.d.ts +12 -9
  21. package/dist/components/ra-forms/LongForm/types.d.ts.map +1 -1
  22. package/dist/components/ra-forms/LongForm/utils.d.ts +8 -0
  23. package/dist/components/ra-forms/LongForm/utils.d.ts.map +1 -0
  24. package/dist/components/ra-forms/TableForm/TableFormIterator.d.ts +2 -0
  25. package/dist/components/ra-forms/TableForm/TableFormIterator.d.ts.map +1 -1
  26. package/dist/react-admin.cjs.js +65 -65
  27. package/dist/react-admin.cjs.js.map +1 -1
  28. package/dist/react-admin.es.js +9206 -9131
  29. package/dist/react-admin.es.js.map +1 -1
  30. package/dist/react-admin.umd.js +65 -65
  31. package/dist/react-admin.umd.js.map +1 -1
  32. package/dist/themes/overrides/ListItemText.d.ts +12 -0
  33. package/dist/themes/overrides/ListItemText.d.ts.map +1 -0
  34. package/dist/themes/overrides/index.d.ts.map +1 -1
  35. package/dist/types.d.ts +4 -0
  36. package/dist/types.d.ts.map +1 -1
  37. package/package.json +1 -1
  38. package/src/components/ra-forms/LongForm/BaseForm.tsx +54 -0
  39. package/src/components/ra-forms/LongForm/Content.tsx +19 -0
  40. package/src/components/ra-forms/LongForm/Form.tsx +37 -0
  41. package/src/components/ra-forms/LongForm/NavMenu.tsx +128 -0
  42. package/src/components/ra-forms/LongForm/Provider.tsx +196 -0
  43. package/src/components/ra-forms/LongForm/Sidebar.tsx +71 -0
  44. package/src/components/ra-forms/LongForm/Tab.tsx +67 -0
  45. package/src/components/ra-forms/LongForm/hooks.tsx +25 -0
  46. package/src/components/ra-forms/LongForm/index.ts +52 -0
  47. package/src/components/ra-forms/LongForm/types.ts +13 -9
  48. package/src/components/ra-forms/LongForm/utils.ts +22 -0
  49. package/src/components/ra-forms/TableForm/TableFormIterator.tsx +32 -11
  50. package/src/themes/overrides/ListItemText.jsx +15 -0
  51. package/src/themes/overrides/index.jsx +2 -0
  52. package/src/types.ts +5 -0
  53. package/dist/components/ra-forms/LongForm/LongForm.d.ts +0 -98
  54. package/dist/components/ra-forms/LongForm/LongForm.d.ts.map +0 -1
  55. package/dist/components/ra-forms/LongForm/LongFormSidebar.d.ts +0 -34
  56. package/dist/components/ra-forms/LongForm/LongFormSidebar.d.ts.map +0 -1
  57. package/dist/components/ra-forms/LongForm/LongFormTab.d.ts +0 -45
  58. package/dist/components/ra-forms/LongForm/LongFormTab.d.ts.map +0 -1
  59. package/dist/components/ra-forms/LongForm/LongFormTabs.d.ts +0 -23
  60. package/dist/components/ra-forms/LongForm/LongFormTabs.d.ts.map +0 -1
  61. package/dist/components/ra-forms/LongForm/LongFormView.d.ts +0 -42
  62. package/dist/components/ra-forms/LongForm/LongFormView.d.ts.map +0 -1
  63. package/dist/components/ra-forms/LongForm/useFormRootPath.d.ts +0 -6
  64. package/dist/components/ra-forms/LongForm/useFormRootPath.d.ts.map +0 -1
  65. package/src/components/ra-forms/LongForm/LongForm.tsx +0 -59
  66. package/src/components/ra-forms/LongForm/LongFormSidebar.tsx +0 -44
  67. package/src/components/ra-forms/LongForm/LongFormTab.tsx +0 -122
  68. package/src/components/ra-forms/LongForm/LongFormTabs.tsx +0 -72
  69. package/src/components/ra-forms/LongForm/LongFormView.tsx +0 -161
  70. package/src/components/ra-forms/LongForm/index.tsx +0 -2
  71. package/src/components/ra-forms/LongForm/useFormRootPath.ts +0 -21
@@ -0,0 +1,52 @@
1
+ import { Form } from './Form';
2
+ import { BaseForm } from './BaseForm';
3
+ import { Content } from './Content';
4
+ import { Provider, useActiveItem, useItems, useSyncWithLocation, useSetActiveItem, useAddItem, useRemoveItem } from './Provider';
5
+ import { Sidebar, SidebarSection, SidebarSectionPosition, useSidebarChildren } from './Sidebar';
6
+ import { NavMenu, NavMenuItem, useNavMenuItem } from './NavMenu';
7
+ import { Tab, Group, useBaseItemChildren } from './Tab';
8
+
9
+ type IForm = typeof Form & {
10
+ BaseForm: typeof BaseForm;
11
+ Content: typeof Content;
12
+ Provider: typeof Provider;
13
+ useItems: typeof useItems;
14
+ useSyncWithLocation: typeof useSyncWithLocation;
15
+ useActiveItem: typeof useActiveItem;
16
+ useSetActiveItem: typeof useSetActiveItem;
17
+ useAddItem: typeof useAddItem;
18
+ useRemoveItem: typeof useRemoveItem;
19
+ Sidebar: typeof Sidebar;
20
+ SidebarSection: typeof SidebarSection;
21
+ SidebarSectionPosition: typeof SidebarSectionPosition;
22
+ useSidebarChildren: typeof useSidebarChildren;
23
+ NavMenu: typeof NavMenu;
24
+ NavMenuItem: typeof NavMenuItem;
25
+ useNavMenuItem: typeof useNavMenuItem;
26
+ Tab: typeof Tab;
27
+ Group: typeof Group;
28
+ useBaseItemChildren: typeof useBaseItemChildren;
29
+ };
30
+
31
+ const DefaultForm = Form as IForm;
32
+ DefaultForm.BaseForm = BaseForm;
33
+ DefaultForm.Content = Content;
34
+ DefaultForm.Provider = Provider;
35
+ DefaultForm.useItems = useItems;
36
+ DefaultForm.useSyncWithLocation = useSyncWithLocation;
37
+ DefaultForm.useActiveItem = useActiveItem;
38
+ DefaultForm.useSetActiveItem = useSetActiveItem;
39
+ DefaultForm.useAddItem = useAddItem;
40
+ DefaultForm.useRemoveItem = useRemoveItem;
41
+ DefaultForm.Sidebar = Sidebar;
42
+ DefaultForm.SidebarSection = SidebarSection;
43
+ DefaultForm.SidebarSectionPosition = SidebarSectionPosition;
44
+ DefaultForm.useSidebarChildren = useSidebarChildren;
45
+ DefaultForm.NavMenu = NavMenu;
46
+ DefaultForm.NavMenuItem = NavMenuItem;
47
+ DefaultForm.useNavMenuItem = useNavMenuItem;
48
+ DefaultForm.Tab = Tab;
49
+ DefaultForm.Group = Group;
50
+ DefaultForm.useBaseItemChildren = useBaseItemChildren;
51
+
52
+ export default DefaultForm;
@@ -1,15 +1,19 @@
1
- import PropTypes from 'prop-types';
2
- export type Disposition = {
1
+ type Disposition = {
3
2
  xl?: number;
4
3
  lg?: number;
5
4
  md?: number;
6
5
  sm?: number;
7
6
  xs?: number;
8
7
  };
9
- export const DispositionProps = PropTypes.shape({
10
- xl: PropTypes.number,
11
- lg: PropTypes.number,
12
- md: PropTypes.number,
13
- sm: PropTypes.number,
14
- xs: PropTypes.number
15
- });
8
+
9
+ type IItem = {
10
+ id: string;
11
+ label: string;
12
+ icon?: React.ReactNode;
13
+ badge?: {
14
+ content: string | number;
15
+ color?: 'default' | 'error' | 'info' | 'primary' | 'secondary' | 'success' | 'warning';
16
+ };
17
+ };
18
+
19
+ export type { Disposition, IItem };
@@ -0,0 +1,22 @@
1
+ import _ from 'lodash';
2
+ import { IItem } from './types';
3
+ import { Optional } from 'src/types';
4
+
5
+ function getId(data: Optional<Pick<IItem, 'id' | 'label'>, 'id'>): string {
6
+ return data.id ?? data.label;
7
+ }
8
+
9
+ function isChild(parentId: string, childId: string): boolean {
10
+ return childId.match(new RegExp(`^${parentId}`)) !== null;
11
+ }
12
+
13
+ function getItemsIds(items: Array<IItem>): Array<string> {
14
+ return _.map(items, 'id');
15
+ }
16
+
17
+ function getLevel(id: string): number {
18
+ const match = id.match(new RegExp('[^.]+', 'g'));
19
+ return match === null ? 0 : match.length;
20
+ }
21
+
22
+ export { getId, isChild, getItemsIds, getLevel };
@@ -31,7 +31,7 @@ import get from 'lodash/get';
31
31
  * <Grid container>
32
32
  * <Grid item xs={12}>
33
33
  * <ArrayInput label={false} source="descriptor.fields">
34
- * <TableFormIterator label="Catalogo proprietà">
34
+ * <TableFormIterator template={{ property: 'FIELD' }} label="Catalogo proprietà"> // template: default value for new row
35
35
  * <TextInput label="Name" source={'name'} validate={required()} />
36
36
  * <TextInput source={'denomination'} helperText={false} />
37
37
  * <SelectInput choices={FieldTypes} source={'type'} helperText={false} />
@@ -44,7 +44,7 @@ import get from 'lodash/get';
44
44
  * @returns
45
45
  */
46
46
  const TableFormIterator = (props: TableFormIteratorProps) => {
47
- const { children, resource, source, label, disableActions = false, disableAdd = false, disableRemove = false, className, empty } = props;
47
+ const { children, resource, source, label, disableActions = false, disableAdd = false, disableRemove = false, className, empty, template = {} } = props;
48
48
  const [confirmIsOpen, setConfirmIsOpen] = useState<boolean>(false);
49
49
  const { fields, remove, replace } = useArrayInput(props);
50
50
  const theme = useTheme();
@@ -90,8 +90,13 @@ const TableFormIterator = (props: TableFormIteratorProps) => {
90
90
  // @ts-ignore
91
91
  <TableFormIteratorContext.Provider value={context}>
92
92
  <div className={className}>
93
- {/** @ts-ignore */}
94
- <AddTableRow label={label} source={source} disableAdd={disableAdd} />
93
+ {React.cloneElement(<AddTableRow />, {
94
+ label,
95
+ source,
96
+ disableAdd,
97
+ template,
98
+ addButton: props?.addButton,
99
+ })}
95
100
 
96
101
  <TableContainer component={Paper} sx={{ mt: 2, border: `1px solid ${tableBorderColor}` }}>
97
102
  <Table>
@@ -172,20 +177,33 @@ const TableFormIterator = (props: TableFormIteratorProps) => {
172
177
  };
173
178
 
174
179
  const AddTableRow = (props: any) => {
175
- const { label, disableAdd } = props;
180
+ const { label, disableAdd, template = {} } = props;
176
181
  const { append } = useArrayInput(props);
177
182
  const theme = useTheme();
178
183
  // @ts-ignore
179
184
  const tableBorderColor = theme.palette.mode === 'dark' ? theme.palette.grey.A400 : theme.palette.grey.A800;
180
185
  const iconColor = theme.palette.mode === 'light' ? '#000000' : '#FFFFFF';
181
186
 
187
+ const handleAddButtonClick = useCallback((
188
+ originalOnClickHandler: React.MouseEventHandler<Element>
189
+ ) => (event: React.MouseEvent<Element, MouseEvent>) => {
190
+ append(template);
191
+ originalOnClickHandler && originalOnClickHandler(event);
192
+ }, [append, template]);
193
+
182
194
  return (
183
195
  <Stack justifyContent={'space-between'} alignItems={'center'} flexDirection={'row'}>
184
196
  <Typography>{label}</Typography>
185
197
  {!disableAdd && (
186
- <IconButton size="small" color="secondary" sx={{ border: `1px solid ${tableBorderColor}` }} onClick={() => append({})}>
187
- <PlusCircleOutlined style={{ color: iconColor }} />
188
- </IconButton>
198
+ React.isValidElement(props?.addButton) ?
199
+ React.cloneElement(props?.addButton, {
200
+ onClick: handleAddButtonClick(
201
+ props?.addButton?.props.onClick
202
+ ),
203
+ }) :
204
+ <IconButton size="small" color="secondary" sx={{ border: `1px solid ${tableBorderColor}` }} onClick={() => append(template)}>
205
+ <PlusCircleOutlined style={{ color: iconColor }} />
206
+ </IconButton>
189
207
  )}
190
208
  </Stack>
191
209
  );
@@ -204,8 +222,9 @@ const StyledTableFormIterator = styled(TableFormIterator, {
204
222
  }));
205
223
 
206
224
  AddTableRow.propTypes = {
207
- label: PropTypes.string.isRequired,
208
- source: PropTypes.string.isRequired
225
+ label: PropTypes.string,
226
+ source: PropTypes.string,
227
+ defaultValue: PropTypes.any
209
228
  };
210
229
 
211
230
  TableFormIterator.propTypes = {
@@ -224,7 +243,8 @@ TableFormIterator.propTypes = {
224
243
  disableAdd: PropTypes.bool,
225
244
  disableRemove: PropTypes.oneOfType([PropTypes.func, PropTypes.bool]),
226
245
  TransitionProps: PropTypes.shape({}),
227
- empty: PropTypes.oneOfType([PropTypes.node, PropTypes.string])
246
+ empty: PropTypes.oneOfType([PropTypes.node, PropTypes.string]),
247
+ template: PropTypes.object
228
248
  };
229
249
 
230
250
  export interface TableFormIteratorProps extends Partial<UseFieldArrayReturn> {
@@ -234,6 +254,7 @@ export interface TableFormIteratorProps extends Partial<UseFieldArrayReturn> {
234
254
  disableAdd?: boolean;
235
255
  disableActions?: boolean;
236
256
  disableRemove?: boolean;
257
+ template?: object;
237
258
  meta?: {
238
259
  // the type defined in FieldArrayRenderProps says error is boolean, which is wrong.
239
260
  error?: any;
@@ -0,0 +1,15 @@
1
+ // ==============================|| OVERRIDES - LIST ITEM TEXT ||============================== //
2
+
3
+ export default function ListItemIcon() {
4
+ return {
5
+ MuiListItemText: {
6
+ styleOverrides: {
7
+ root: {
8
+ '&.MuiListItemText-inset': {
9
+ paddingLeft: 24
10
+ }
11
+ }
12
+ }
13
+ }
14
+ };
15
+ }
@@ -23,6 +23,7 @@ import LinearProgress from './LinearProgress';
23
23
  import Link from './Link';
24
24
  import ListItemButton from './ListItemButton';
25
25
  import ListItemIcon from './ListItemIcon';
26
+ import ListItemText from './ListItemText';
26
27
  import LoadingButton from './LoadingButton';
27
28
  import OutlinedInput from './OutlinedInput';
28
29
  import Pagination from './Pagination';
@@ -74,6 +75,7 @@ export default function ComponentsOverrides(theme) {
74
75
  Link(),
75
76
  ListItemButton(theme),
76
77
  ListItemIcon(theme),
78
+ ListItemText(theme),
77
79
  LoadingButton(),
78
80
  OutlinedInput(theme),
79
81
  Pagination(),
package/src/types.ts CHANGED
@@ -53,3 +53,8 @@ export type MenuItemProps = {
53
53
  * Indica come deve essere configurato il menu dell'applicazione.
54
54
  */
55
55
  export type MenuProps = MenuItemProps[];
56
+
57
+ /**
58
+ * Consente di trasformare dei type rendendone opzionali solo alcune chiavi
59
+ */
60
+ export type Optional<T, K extends keyof T> = Omit<T, K> & Partial<Pick<T, K>>;
@@ -1,98 +0,0 @@
1
- /// <reference types="react" />
2
- import { Disposition } from './types';
3
- import PropTypes from 'prop-types';
4
- export type LongFormProps = {
5
- syncWithLocation?: boolean;
6
- spacing?: number;
7
- tabsDisposition?: Disposition;
8
- contentDisposition?: Disposition;
9
- children: React.ReactNode;
10
- sticky?: boolean;
11
- };
12
- /**
13
- * Consente di disegnare un form di tipo LongForm secondo la documentazione di React-Admin.
14
- *
15
- * @link https://marmelab.com/react-admin/LongForm.html
16
- *
17
- * @param {LongFormProps}
18
- * @returns {JSX.Element}
19
- */
20
- declare const LongForm: {
21
- ({ spacing: _spacing, ...props }: LongFormProps): JSX.Element;
22
- propTypes: {
23
- syncWithLocation: PropTypes.Requireable<boolean>;
24
- spacing: PropTypes.Requireable<number>;
25
- tabsDisposition: PropTypes.Requireable<PropTypes.InferProps<{
26
- xl: PropTypes.Requireable<number>;
27
- lg: PropTypes.Requireable<number>;
28
- md: PropTypes.Requireable<number>;
29
- sm: PropTypes.Requireable<number>;
30
- xs: PropTypes.Requireable<number>;
31
- }>>;
32
- contentDisposition: PropTypes.Requireable<PropTypes.InferProps<{
33
- xl: PropTypes.Requireable<number>;
34
- lg: PropTypes.Requireable<number>;
35
- md: PropTypes.Requireable<number>;
36
- sm: PropTypes.Requireable<number>;
37
- xs: PropTypes.Requireable<number>;
38
- }>>;
39
- sticky: PropTypes.Requireable<boolean>;
40
- };
41
- defaultProps: {
42
- syncWithLocation: boolean;
43
- sticky: boolean;
44
- spacing: number;
45
- tabsDisposition: {
46
- xl: number;
47
- lg: number;
48
- md: number;
49
- sm: number;
50
- xs: number;
51
- };
52
- contentDisposition: {
53
- xl: number;
54
- lg: number;
55
- md: number;
56
- sm: number;
57
- xs: number;
58
- };
59
- };
60
- Tab: {
61
- ({ intent, hidden, unmountOnExit, label, icon, value, syncWithLocation, selected, onChange, children, badgeColor, badgeContent, ...props }: import("./LongFormTab").LongFormTabProps): import("react/jsx-runtime").JSX.Element | null;
62
- propTypes: {
63
- intent: PropTypes.Requireable<string>;
64
- className: PropTypes.Requireable<string>;
65
- contentClassName: PropTypes.Requireable<string>;
66
- url: PropTypes.Requireable<string>;
67
- icon: PropTypes.Requireable<PropTypes.ReactElementLike>;
68
- label: PropTypes.Validator<NonNullable<NonNullable<string | PropTypes.ReactElementLike | null | undefined>>>;
69
- value: PropTypes.Requireable<NonNullable<string | number | null | undefined>>;
70
- syncWithLocation: PropTypes.Requireable<boolean>;
71
- onChange: PropTypes.Requireable<(...args: any[]) => any>;
72
- selected: PropTypes.Requireable<boolean>;
73
- hidden: PropTypes.Requireable<boolean>;
74
- unmountOnExit: PropTypes.Requireable<boolean>;
75
- children: PropTypes.Requireable<PropTypes.ReactNodeLike>;
76
- badgeColor: PropTypes.Requireable<string>;
77
- badgeContent: PropTypes.Requireable<NonNullable<string | number | null | undefined>>;
78
- };
79
- defaultProps: {
80
- badgeColor: string;
81
- unmountOnExit: boolean;
82
- };
83
- };
84
- Sidebar: {
85
- ({ children, visibility }: import("./LongFormSidebar").LongFormSidebarProps): JSX.Element | null;
86
- propTypes: {
87
- visibility: PropTypes.Requireable<string>;
88
- position: PropTypes.Validator<string>;
89
- children: PropTypes.Validator<NonNullable<PropTypes.ReactNodeLike>>;
90
- };
91
- defaultProps: {
92
- position: string;
93
- visibility: string;
94
- };
95
- };
96
- };
97
- export default LongForm;
98
- //# sourceMappingURL=LongForm.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"LongForm.d.ts","sourceRoot":"","sources":["../../../../../src/components/ra-forms/LongForm/LongForm.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,WAAW,EAAoB,MAAM,SAAS,CAAC;AAMxD,OAAO,SAAS,MAAM,YAAY,CAAC;AAInC,MAAM,MAAM,aAAa,GAAG;IAC1B,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,eAAe,CAAC,EAAE,WAAW,CAAC;IAC9B,kBAAkB,CAAC,EAAE,WAAW,CAAC;IACjC,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B,MAAM,CAAC,EAAE,OAAO,CAAC;CAClB,CAAC;AAEF;;;;;;;GAOG;AACH,QAAA,MAAM,QAAQ;sCAAqC,aAAa,GAAG,WAAW;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAU7E,CAAC;AAqBF,eAAe,QAAQ,CAAC"}
@@ -1,34 +0,0 @@
1
- /// <reference types="react" />
2
- import PropTypes from 'prop-types';
3
- export type LongFormSidebarProps = {
4
- visibility?: 'xl' | 'lg' | 'md' | 'sm' | 'xs';
5
- position: 'top' | 'bottom';
6
- children: React.ReactNode;
7
- };
8
- /**
9
- * Consente di specificare, all'interno di un form di tipo LongForm, una sezione da visualizzare prima o dopo i tab di navigazione.
10
- * @example
11
- * <LongForm>
12
- * <LongForm.Sidebar position="top">Contenuto prima della navigazione</LongForm.Sidebar>
13
- * <LongForm.Tab>Tab 1</LongForm.Tab>
14
- * <LongForm.Tab>Tab 2</LongForm.Tab>
15
- * <LongForm.Sidebar position="bottom">Contenuto dopo la navigazione</LongForm.Sidebar>
16
- * </LongForm>
17
- *
18
- * @param {LongFormSidebarProps}
19
- * @returns {JSX.Element | null}
20
- */
21
- declare const LongFormSidebar: {
22
- ({ children, visibility }: LongFormSidebarProps): JSX.Element | null;
23
- propTypes: {
24
- visibility: PropTypes.Requireable<string>;
25
- position: PropTypes.Validator<string>;
26
- children: PropTypes.Validator<NonNullable<PropTypes.ReactNodeLike>>;
27
- };
28
- defaultProps: {
29
- position: string;
30
- visibility: string;
31
- };
32
- };
33
- export default LongFormSidebar;
34
- //# sourceMappingURL=LongFormSidebar.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"LongFormSidebar.d.ts","sourceRoot":"","sources":["../../../../../src/components/ra-forms/LongForm/LongFormSidebar.tsx"],"names":[],"mappings":";AAAA,OAAO,SAAS,MAAM,YAAY,CAAC;AAQnC,MAAM,MAAM,oBAAoB,GAAG;IACjC,UAAU,CAAC,EAAE,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,CAAC;IAC9C,QAAQ,EAAE,KAAK,GAAG,QAAQ,CAAC;IAC3B,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;CAC3B,CAAC;AAEF;;;;;;;;;;;;GAYG;AACH,QAAA,MAAM,eAAe;+BAA8B,oBAAoB,GAAG,WAAW,GAAG,IAAI;;;;;;;;;;CAG3F,CAAC;AAaF,eAAe,eAAe,CAAC"}
@@ -1,45 +0,0 @@
1
- import React from 'react';
2
- import PropTypes from 'prop-types';
3
- export type LongFormTabProps = {
4
- intent: 'header' | 'content' | 'sidebar';
5
- className?: string;
6
- contentClassName?: string;
7
- url?: string;
8
- icon?: React.ReactNode;
9
- label: string | React.ReactNode;
10
- value: string | number;
11
- syncWithLocation?: boolean;
12
- onChange: (value: string | number) => void;
13
- selected?: boolean;
14
- hidden?: boolean;
15
- unmountOnExit?: boolean;
16
- children?: React.ReactNode;
17
- badgeColor?: 'default' | 'error' | 'info' | 'primary' | 'secondary' | 'success' | 'warning';
18
- badgeContent?: string | number;
19
- };
20
- declare const LongFormTab: {
21
- ({ intent, hidden, unmountOnExit, label, icon, value, syncWithLocation, selected, onChange, children, badgeColor, badgeContent, ...props }: LongFormTabProps): import("react/jsx-runtime").JSX.Element | null;
22
- propTypes: {
23
- intent: PropTypes.Requireable<string>;
24
- className: PropTypes.Requireable<string>;
25
- contentClassName: PropTypes.Requireable<string>;
26
- url: PropTypes.Requireable<string>;
27
- icon: PropTypes.Requireable<PropTypes.ReactElementLike>;
28
- label: PropTypes.Validator<NonNullable<NonNullable<string | PropTypes.ReactElementLike | null | undefined>>>;
29
- value: PropTypes.Requireable<NonNullable<string | number | null | undefined>>;
30
- syncWithLocation: PropTypes.Requireable<boolean>;
31
- onChange: PropTypes.Requireable<(...args: any[]) => any>;
32
- selected: PropTypes.Requireable<boolean>;
33
- hidden: PropTypes.Requireable<boolean>;
34
- unmountOnExit: PropTypes.Requireable<boolean>;
35
- children: PropTypes.Requireable<PropTypes.ReactNodeLike>;
36
- badgeColor: PropTypes.Requireable<string>;
37
- badgeContent: PropTypes.Requireable<NonNullable<string | number | null | undefined>>;
38
- };
39
- defaultProps: {
40
- badgeColor: string;
41
- unmountOnExit: boolean;
42
- };
43
- };
44
- export default LongFormTab;
45
- //# sourceMappingURL=LongFormTab.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"LongFormTab.d.ts","sourceRoot":"","sources":["../../../../../src/components/ra-forms/LongForm/LongFormTab.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAsB,MAAM,OAAO,CAAC;AAG3C,OAAO,SAAS,MAAM,YAAY,CAAC;AAKnC,MAAM,MAAM,gBAAgB,GAAG;IAC7B,MAAM,EAAE,QAAQ,GAAG,SAAS,GAAG,SAAS,CAAC;IACzC,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,IAAI,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IACvB,KAAK,EAAE,MAAM,GAAG,KAAK,CAAC,SAAS,CAAC;IAChC,KAAK,EAAE,MAAM,GAAG,MAAM,CAAC;IACvB,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B,QAAQ,EAAE,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,KAAK,IAAI,CAAC;IAC3C,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC3B,UAAU,CAAC,EAAE,SAAS,GAAG,OAAO,GAAG,MAAM,GAAG,SAAS,GAAG,WAAW,GAAG,SAAS,GAAG,SAAS,CAAC;IAC5F,YAAY,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;CAChC,CAAC;AAEF,QAAA,MAAM,WAAW;gJAcd,gBAAgB;;;;;;;;;;;;;;;;;;;;;;CAsDlB,CAAC;AAyBF,eAAe,WAAW,CAAC"}
@@ -1,23 +0,0 @@
1
- import PropTypes from 'prop-types';
2
- import React from 'react';
3
- export type LongFormTabsProps = {
4
- children: React.ReactNode;
5
- syncWithLocation?: boolean;
6
- value: string | number;
7
- url: string;
8
- onChange: (value: string | number) => void;
9
- };
10
- declare const LongFormTabs: {
11
- ({ children, syncWithLocation, value, url, onChange }: LongFormTabsProps): import("react/jsx-runtime").JSX.Element;
12
- propTypes: {
13
- children: PropTypes.Requireable<PropTypes.ReactNodeLike>;
14
- url: PropTypes.Requireable<string>;
15
- tabsWithErrors: PropTypes.Requireable<(string | null | undefined)[]>;
16
- syncWithLocation: PropTypes.Requireable<boolean>;
17
- onChange: PropTypes.Requireable<(...args: any[]) => any>;
18
- value: PropTypes.Requireable<NonNullable<string | number | null | undefined>>;
19
- };
20
- };
21
- export declare const getTabbedFormTabFullPath: (tab: any, index: number) => any;
22
- export default LongFormTabs;
23
- //# sourceMappingURL=LongFormTabs.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"LongFormTabs.d.ts","sourceRoot":"","sources":["../../../../../src/components/ra-forms/LongForm/LongFormTabs.tsx"],"names":[],"mappings":"AAIA,OAAO,SAAS,MAAM,YAAY,CAAC;AACnC,OAAO,KAAK,MAAM,OAAO,CAAC;AAkB1B,MAAM,MAAM,iBAAiB,GAAG;IAC9B,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B,KAAK,EAAE,MAAM,GAAG,MAAM,CAAC;IACvB,GAAG,EAAE,MAAM,CAAC;IACZ,QAAQ,EAAE,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,KAAK,IAAI,CAAC;CAC5C,CAAC;AAEF,QAAA,MAAM,YAAY;2DAA0D,iBAAiB;;;;;;;;;CA0B5F,CAAC;AAEF,eAAO,MAAM,wBAAwB,QAAS,GAAG,SAAS,MAAM,QACa,CAAC;AAW9E,eAAe,YAAY,CAAC"}
@@ -1,42 +0,0 @@
1
- import { Disposition } from './types';
2
- import React from 'react';
3
- import PropTypes from 'prop-types';
4
- export type LongFormViewProps = {
5
- children: React.ReactNode;
6
- formRootPathname: string;
7
- syncWithLocation?: boolean;
8
- spacing: number;
9
- tabs: React.ReactElement;
10
- tabsDisposition: Disposition;
11
- contentDisposition: Disposition;
12
- sticky?: boolean;
13
- };
14
- declare const LongFormView: {
15
- ({ children, formRootPathname, syncWithLocation, spacing, tabs, tabsDisposition, contentDisposition, sticky, ...props }: LongFormViewProps): import("react/jsx-runtime").JSX.Element;
16
- propTypes: {
17
- children: PropTypes.Requireable<PropTypes.ReactNodeLike>;
18
- spacing: PropTypes.Requireable<number>;
19
- syncWithLocation: PropTypes.Requireable<boolean>;
20
- tabs: PropTypes.Requireable<PropTypes.ReactElementLike>;
21
- formRootPathname: PropTypes.Requireable<string>;
22
- tabsDisposition: PropTypes.Requireable<PropTypes.InferProps<{
23
- xl: PropTypes.Requireable<number>;
24
- lg: PropTypes.Requireable<number>;
25
- md: PropTypes.Requireable<number>;
26
- sm: PropTypes.Requireable<number>;
27
- xs: PropTypes.Requireable<number>;
28
- }>>;
29
- contentDisposition: PropTypes.Requireable<PropTypes.InferProps<{
30
- xl: PropTypes.Requireable<number>;
31
- lg: PropTypes.Requireable<number>;
32
- md: PropTypes.Requireable<number>;
33
- sm: PropTypes.Requireable<number>;
34
- xs: PropTypes.Requireable<number>;
35
- }>>;
36
- };
37
- defaultProps: {
38
- tabs: import("react/jsx-runtime").JSX.Element;
39
- };
40
- };
41
- export default LongFormView;
42
- //# sourceMappingURL=LongFormView.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"LongFormView.d.ts","sourceRoot":"","sources":["../../../../../src/components/ra-forms/LongForm/LongFormView.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAoB,MAAM,SAAS,CAAC;AACxD,OAAO,KAAsC,MAAM,OAAO,CAAC;AAQ3D,OAAO,SAAS,MAAM,YAAY,CAAC;AAkCnC,MAAM,MAAM,iBAAiB,GAAG;IAC9B,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B,gBAAgB,EAAE,MAAM,CAAC;IACzB,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,KAAK,CAAC,YAAY,CAAC;IACzB,eAAe,EAAE,WAAW,CAAC;IAC7B,kBAAkB,EAAE,WAAW,CAAC;IAChC,MAAM,CAAC,EAAE,OAAO,CAAC;CAClB,CAAC;AAEF,QAAA,MAAM,YAAY;6HAUf,iBAAiB;;;;;;;;;;;;;;;;;;;;;;;;;CA+EnB,CAAC;AAiBF,eAAe,YAAY,CAAC"}
@@ -1,6 +0,0 @@
1
- /**
2
- * Restituisce il path di base del form in base ad una serie di specifici match di path che è possibile incontrare.
3
- */
4
- declare const useFormRootPath: () => string;
5
- export default useFormRootPath;
6
- //# sourceMappingURL=useFormRootPath.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"useFormRootPath.d.ts","sourceRoot":"","sources":["../../../../../src/components/ra-forms/LongForm/useFormRootPath.ts"],"names":[],"mappings":"AAEA;;GAEG;AACH,QAAA,MAAM,eAAe,QAAO,MAa3B,CAAC;AAEF,eAAe,eAAe,CAAC"}
@@ -1,59 +0,0 @@
1
- import { Disposition, DispositionProps } from './types';
2
-
3
- import { Form } from 'react-admin';
4
- import LongFormSidebar from './LongFormSidebar';
5
- import LongFormTab from './LongFormTab';
6
- import LongFormView from './LongFormView';
7
- import PropTypes from 'prop-types';
8
- import useFormRootPath from './useFormRootPath';
9
- import { useThemeConfig } from '../../../hooks';
10
-
11
- export type LongFormProps = {
12
- syncWithLocation?: boolean;
13
- spacing?: number;
14
- tabsDisposition?: Disposition;
15
- contentDisposition?: Disposition;
16
- children: React.ReactNode;
17
- sticky?: boolean;
18
- };
19
-
20
- /**
21
- * Consente di disegnare un form di tipo LongForm secondo la documentazione di React-Admin.
22
- *
23
- * @link https://marmelab.com/react-admin/LongForm.html
24
- *
25
- * @param {LongFormProps}
26
- * @returns {JSX.Element}
27
- */
28
- const LongForm = ({ spacing: _spacing, ...props }: LongFormProps): JSX.Element => {
29
- const formRootPathname = useFormRootPath();
30
- const { spacing: _themeSpacing } = useThemeConfig();
31
- const spacing = _spacing || _themeSpacing;
32
- return (
33
- <Form formRootPathname={formRootPathname} {...props}>
34
- {/** @ts-ignore */}
35
- <LongFormView formRootPathname={formRootPathname} {...props} spacing={spacing} />
36
- </Form>
37
- );
38
- };
39
-
40
- LongForm.propTypes = {
41
- syncWithLocation: PropTypes.bool,
42
- spacing: PropTypes.number,
43
- tabsDisposition: DispositionProps,
44
- contentDisposition: DispositionProps,
45
- sticky: PropTypes.bool
46
- };
47
-
48
- LongForm.defaultProps = {
49
- syncWithLocation: false,
50
- sticky: true,
51
- spacing: 2,
52
- tabsDisposition: { xl: 3, lg: 3, md: 4, sm: 4, xs: 12 },
53
- contentDisposition: { xl: 9, lg: 9, md: 8, sm: 8, xs: 12 }
54
- };
55
-
56
- LongForm.Tab = LongFormTab;
57
- LongForm.Sidebar = LongFormSidebar;
58
-
59
- export default LongForm;
@@ -1,44 +0,0 @@
1
- import PropTypes from 'prop-types';
2
- import { styled } from '@mui/material/styles';
3
- import { useMediaQuery } from '@mui/material';
4
-
5
- const StyledSidebar = styled('div')(({ theme }) => ({
6
- marginBottom: theme.spacing(2)
7
- }));
8
-
9
- export type LongFormSidebarProps = {
10
- visibility?: 'xl' | 'lg' | 'md' | 'sm' | 'xs';
11
- position: 'top' | 'bottom';
12
- children: React.ReactNode;
13
- };
14
-
15
- /**
16
- * Consente di specificare, all'interno di un form di tipo LongForm, una sezione da visualizzare prima o dopo i tab di navigazione.
17
- * @example
18
- * <LongForm>
19
- * <LongForm.Sidebar position="top">Contenuto prima della navigazione</LongForm.Sidebar>
20
- * <LongForm.Tab>Tab 1</LongForm.Tab>
21
- * <LongForm.Tab>Tab 2</LongForm.Tab>
22
- * <LongForm.Sidebar position="bottom">Contenuto dopo la navigazione</LongForm.Sidebar>
23
- * </LongForm>
24
- *
25
- * @param {LongFormSidebarProps}
26
- * @returns {JSX.Element | null}
27
- */
28
- const LongFormSidebar = ({ children, visibility }: LongFormSidebarProps): JSX.Element | null => {
29
- const isVisible = useMediaQuery((theme: any) => theme.breakpoints.up(visibility));
30
- return isVisible ? <StyledSidebar>{children}</StyledSidebar> : null;
31
- };
32
-
33
- LongFormSidebar.propTypes = {
34
- visibility: PropTypes.oneOf(['xl', 'lg', 'md', 'sm', 'xs']),
35
- position: PropTypes.oneOf(['top', 'bottom']).isRequired,
36
- children: PropTypes.node.isRequired
37
- };
38
-
39
- LongFormSidebar.defaultProps = {
40
- position: 'top',
41
- visibility: 'md'
42
- };
43
-
44
- export default LongFormSidebar;