@applica-software-guru/react-admin 1.1.114 → 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 (68) 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/react-admin.cjs.js +63 -63
  25. package/dist/react-admin.cjs.js.map +1 -1
  26. package/dist/react-admin.es.js +8895 -8835
  27. package/dist/react-admin.es.js.map +1 -1
  28. package/dist/react-admin.umd.js +63 -63
  29. package/dist/react-admin.umd.js.map +1 -1
  30. package/dist/themes/overrides/ListItemText.d.ts +12 -0
  31. package/dist/themes/overrides/ListItemText.d.ts.map +1 -0
  32. package/dist/themes/overrides/index.d.ts.map +1 -1
  33. package/dist/types.d.ts +4 -0
  34. package/dist/types.d.ts.map +1 -1
  35. package/package.json +1 -1
  36. package/src/components/ra-forms/LongForm/BaseForm.tsx +54 -0
  37. package/src/components/ra-forms/LongForm/Content.tsx +19 -0
  38. package/src/components/ra-forms/LongForm/Form.tsx +37 -0
  39. package/src/components/ra-forms/LongForm/NavMenu.tsx +128 -0
  40. package/src/components/ra-forms/LongForm/Provider.tsx +196 -0
  41. package/src/components/ra-forms/LongForm/Sidebar.tsx +71 -0
  42. package/src/components/ra-forms/LongForm/Tab.tsx +67 -0
  43. package/src/components/ra-forms/LongForm/hooks.tsx +25 -0
  44. package/src/components/ra-forms/LongForm/index.ts +52 -0
  45. package/src/components/ra-forms/LongForm/types.ts +13 -9
  46. package/src/components/ra-forms/LongForm/utils.ts +22 -0
  47. package/src/themes/overrides/ListItemText.jsx +15 -0
  48. package/src/themes/overrides/index.jsx +2 -0
  49. package/src/types.ts +5 -0
  50. package/dist/components/ra-forms/LongForm/LongForm.d.ts +0 -98
  51. package/dist/components/ra-forms/LongForm/LongForm.d.ts.map +0 -1
  52. package/dist/components/ra-forms/LongForm/LongFormSidebar.d.ts +0 -34
  53. package/dist/components/ra-forms/LongForm/LongFormSidebar.d.ts.map +0 -1
  54. package/dist/components/ra-forms/LongForm/LongFormTab.d.ts +0 -45
  55. package/dist/components/ra-forms/LongForm/LongFormTab.d.ts.map +0 -1
  56. package/dist/components/ra-forms/LongForm/LongFormTabs.d.ts +0 -23
  57. package/dist/components/ra-forms/LongForm/LongFormTabs.d.ts.map +0 -1
  58. package/dist/components/ra-forms/LongForm/LongFormView.d.ts +0 -42
  59. package/dist/components/ra-forms/LongForm/LongFormView.d.ts.map +0 -1
  60. package/dist/components/ra-forms/LongForm/useFormRootPath.d.ts +0 -6
  61. package/dist/components/ra-forms/LongForm/useFormRootPath.d.ts.map +0 -1
  62. package/src/components/ra-forms/LongForm/LongForm.tsx +0 -59
  63. package/src/components/ra-forms/LongForm/LongFormSidebar.tsx +0 -44
  64. package/src/components/ra-forms/LongForm/LongFormTab.tsx +0 -122
  65. package/src/components/ra-forms/LongForm/LongFormTabs.tsx +0 -72
  66. package/src/components/ra-forms/LongForm/LongFormView.tsx +0 -161
  67. package/src/components/ra-forms/LongForm/index.tsx +0 -2
  68. 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 };
@@ -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;
@@ -1,122 +0,0 @@
1
- import { Avatar, ListItemButton, ListItemIcon, ListItemSecondaryAction, ListItemText, Stack } from '@mui/material';
2
- import { FormGroupContextProvider, useTranslate } from 'react-admin';
3
- import React, { useCallback } from 'react';
4
-
5
- import { Link } from 'react-router-dom';
6
- import PropTypes from 'prop-types';
7
- import { useLocation } from 'react-router';
8
-
9
- const hiddenStyle = { display: 'none' };
10
-
11
- export type LongFormTabProps = {
12
- intent: 'header' | 'content' | 'sidebar';
13
- className?: string;
14
- contentClassName?: string;
15
- url?: string;
16
- icon?: React.ReactNode;
17
- label: string | React.ReactNode;
18
- value: string | number;
19
- syncWithLocation?: boolean;
20
- onChange: (value: string | number) => void;
21
- selected?: boolean;
22
- hidden?: boolean;
23
- unmountOnExit?: boolean;
24
- children?: React.ReactNode;
25
- badgeColor?: 'default' | 'error' | 'info' | 'primary' | 'secondary' | 'success' | 'warning';
26
- badgeContent?: string | number;
27
- };
28
-
29
- const LongFormTab = ({
30
- intent,
31
- hidden,
32
- unmountOnExit,
33
- label,
34
- icon,
35
- value,
36
- syncWithLocation,
37
- selected,
38
- onChange,
39
- children,
40
- badgeColor,
41
- badgeContent,
42
- ...props
43
- }: LongFormTabProps) => {
44
- const translate = useTranslate();
45
- const location = useLocation();
46
- const propsForLink = {
47
- component: Link,
48
- to: { ...location, pathname: value }
49
- };
50
-
51
- const tabLabel = React.isValidElement(label) ? label : translate(label as string, { _: label });
52
- const handleChange = useCallback(() => onChange(value), [onChange, value]);
53
-
54
- const renderTab = () => (
55
- <ListItemButton selected={selected} {...(syncWithLocation ? propsForLink : {})} onClick={handleChange}>
56
- {icon && <ListItemIcon>{icon}</ListItemIcon>}
57
- <ListItemText primary={tabLabel} />
58
- {badgeContent && (
59
- <ListItemSecondaryAction>
60
- <Avatar
61
- sx={{
62
- width: 24,
63
- height: 24,
64
- fontSize: 12,
65
- // @ts-ignore
66
- backgroundColor: (theme) => theme.palette[badgeColor]?.main,
67
- // @ts-ignore
68
- color: (theme) => theme.palette[badgeColor]?.contrastText
69
- }}
70
- >
71
- {badgeContent}
72
- </Avatar>
73
- </ListItemSecondaryAction>
74
- )}
75
- </ListItemButton>
76
- );
77
-
78
- const renderContent = () =>
79
- unmountOnExit && hidden ? null : (
80
- <FormGroupContextProvider name={value.toString()}>
81
- <Stack
82
- alignContent={'stretch'}
83
- style={hidden ? hiddenStyle : {}}
84
- id={`tabpanel-${value}`}
85
- aria-labelledby={`tabheader-${value}`}
86
- // Set undefined instead of false because WAI-ARIA Authoring Practices 1.1
87
- // notes that aria-hidden="false" currently behaves inconsistently across browsers.
88
- aria-hidden={hidden || undefined}
89
- {...props}
90
- >
91
- {children}
92
- </Stack>
93
- </FormGroupContextProvider>
94
- );
95
-
96
- return intent === 'header' ? renderTab() : renderContent();
97
- };
98
-
99
- LongFormTab.propTypes = {
100
- intent: PropTypes.oneOf(['header', 'content', 'sidebar']),
101
- className: PropTypes.string,
102
- contentClassName: PropTypes.string,
103
- url: PropTypes.string,
104
- icon: PropTypes.element,
105
- label: PropTypes.oneOfType([PropTypes.string, PropTypes.element]).isRequired,
106
- value: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
107
- syncWithLocation: PropTypes.bool,
108
- onChange: PropTypes.func,
109
- selected: PropTypes.bool,
110
- hidden: PropTypes.bool,
111
- unmountOnExit: PropTypes.bool,
112
- children: PropTypes.node,
113
- badgeColor: PropTypes.oneOf(['default', 'error', 'info', 'primary', 'secondary', 'success', 'warning']),
114
- badgeContent: PropTypes.oneOfType([PropTypes.string, PropTypes.number])
115
- };
116
-
117
- LongFormTab.defaultProps = {
118
- badgeColor: 'default',
119
- unmountOnExit: false
120
- };
121
-
122
- export default LongFormTab;