@m4l/components 0.0.47 → 0.0.48

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 (50) hide show
  1. package/dist/components/CommonActions/components/ActionCancel/index.d.ts +3 -0
  2. package/dist/components/CommonActions/components/ActionCancel/index.js +14 -0
  3. package/dist/components/CommonActions/components/ActionFormCancel/index.d.ts +3 -0
  4. package/dist/components/CommonActions/components/ActionFormCancel/index.js +62 -0
  5. package/dist/components/CommonActions/components/ActionFormCancel/types.d.ts +6 -0
  6. package/dist/components/CommonActions/components/ActionFormIntro/index.d.ts +3 -0
  7. package/dist/components/CommonActions/components/ActionFormIntro/index.js +34 -0
  8. package/dist/components/CommonActions/components/ActionIntro/index.d.ts +3 -0
  9. package/dist/components/CommonActions/components/ActionIntro/index.js +16 -0
  10. package/dist/components/CommonActions/components/Actions/index.d.ts +3 -0
  11. package/dist/components/CommonActions/components/Actions/index.js +980 -0
  12. package/dist/components/CommonActions/components/Actions/styles.d.ts +2 -0
  13. package/dist/components/CommonActions/components/Actions/types.d.ts +6 -0
  14. package/dist/components/CommonActions/context/index.d.ts +5 -0
  15. package/dist/components/CommonActions/context/types.d.ts +9 -0
  16. package/dist/components/{FormActions → CommonActions}/dictionary.d.ts +1 -1
  17. package/dist/components/CommonActions/index.d.ts +6 -0
  18. package/dist/components/DataGrid/index.js +8 -648
  19. package/dist/components/DynamicFilter/components/fieldstypes/DateTimeFilter/index.d.ts +2 -1
  20. package/dist/components/DynamicFilter/components/fieldstypes/factory.d.ts +2 -1
  21. package/dist/components/DynamicFilter/index.js +20 -16
  22. package/dist/components/Icon/index.js +14 -12
  23. package/dist/components/ModalDialog/components/Header/types.d.ts +2 -2
  24. package/dist/components/ModalDialog/index.js +20 -20
  25. package/dist/components/ModalDialog/types.d.ts +2 -2
  26. package/dist/components/SplitLayout/index.js +0 -1
  27. package/dist/components/formatters/DateFormatter/index.js +10 -8
  28. package/dist/components/hook-form/FormProvider/index.js +6 -116
  29. package/dist/components/hook-form/RHFTextField/index.d.ts +1 -1
  30. package/dist/components/index.d.ts +2 -2
  31. package/dist/components/mui_extended/Button/index.d.ts +3 -0
  32. package/dist/components/mui_extended/Button/styles.d.ts +12 -0
  33. package/dist/components/mui_extended/Button/types.d.ts +2 -0
  34. package/dist/components/mui_extended/IconButton/index.d.ts +0 -1
  35. package/dist/components/mui_extended/IconButton/index.js +23 -16
  36. package/dist/components/mui_extended/Pager/index.js +1 -66
  37. package/dist/contexts/ModalContext/components/ContentConfirm/types.d.ts +3 -3
  38. package/dist/contexts/ModalContext/index.js +12 -9
  39. package/dist/contexts/ModalContext/types.d.ts +5 -6
  40. package/dist/index.js +6 -3
  41. package/dist/react-lazy-load-image-component.js +197 -173
  42. package/dist/utils/index.d.ts +3 -3
  43. package/dist/utils/types.d.ts +1 -0
  44. package/dist/vendor.js +32 -11
  45. package/package.json +4 -5
  46. package/dist/components/FormActions/index.d.ts +0 -3
  47. package/dist/components/FormActions/index.js +0 -51
  48. package/dist/components/FormActions/styles.d.ts +0 -2
  49. package/dist/components/FormActions/types.d.ts +0 -7
  50. package/dist/components/mui_extended/MenuActions/index.js +0 -111
@@ -2,4 +2,3 @@
2
2
  import { IconButtonProps as MUIIconButtonProps } from '@mui/material';
3
3
  import { IconButtonProps } from './types';
4
4
  export declare function IconButton({ src, tooltip, size, dictionaryTooltip, bgColor, ...other }: IconButtonProps & MUIIconButtonProps): JSX.Element;
5
- export default IconButton;
@@ -1,8 +1,8 @@
1
1
  import { m } from "framer-motion";
2
2
  import { forwardRef, useMemo } from "react";
3
- import { IconButton as IconButton$1, Box, Tooltip } from "@mui/material";
3
+ import { IconButton as IconButton$1, Box, Skeleton, Tooltip } from "@mui/material";
4
4
  import { jsx } from "react/jsx-runtime";
5
- import { useModuleDictionary } from "@m4l/core";
5
+ import { useModuleDictionary, useModuleSkeleton } from "@m4l/core";
6
6
  import { I as Icon } from "../../Icon/index.js";
7
7
  const varSmall = {
8
8
  hover: {
@@ -70,32 +70,39 @@ function IconButton({
70
70
  const {
71
71
  getLabel
72
72
  } = useModuleDictionary();
73
- const iconMemo = useMemo(() => {
74
- return /* @__PURE__ */ jsx(Icon, {
75
- src,
76
- bgColor: other.disabled ? "disabled" : bgColor
77
- });
78
- }, [src, bgColor, other.disabled]);
73
+ const isSkeleton = useModuleSkeleton();
79
74
  const finalTooltip = useMemo(() => {
80
75
  if (dictionaryTooltip && getLabel) {
81
76
  return getLabel(dictionaryTooltip);
82
77
  }
83
78
  return tooltip;
84
79
  }, [dictionaryTooltip, tooltip, getLabel]);
85
- if (finalTooltip && !other.disabled) {
86
- return /* @__PURE__ */ jsx(Tooltip, {
87
- title: finalTooltip,
80
+ if (isSkeleton) {
81
+ return /* @__PURE__ */ jsx(Skeleton, {
82
+ variant: "circular",
83
+ width: "30px",
84
+ height: "30px"
85
+ });
86
+ }
87
+ return finalTooltip ? /* @__PURE__ */ jsx(Tooltip, {
88
+ title: finalTooltip || "",
89
+ children: /* @__PURE__ */ jsx("div", {
88
90
  children: /* @__PURE__ */ jsx(IconButton$1, {
89
91
  size,
90
92
  ...other,
91
- children: iconMemo
93
+ children: /* @__PURE__ */ jsx(Icon, {
94
+ src,
95
+ bgColor: other.disabled ? "disabled" : bgColor
96
+ })
92
97
  })
93
- });
94
- }
95
- return /* @__PURE__ */ jsx(IconButton$1, {
98
+ })
99
+ }) : /* @__PURE__ */ jsx(IconButton$1, {
96
100
  size,
97
101
  ...other,
98
- children: iconMemo
102
+ children: /* @__PURE__ */ jsx(Icon, {
103
+ src,
104
+ bgColor: other.disabled ? "disabled" : bgColor
105
+ })
99
106
  });
100
107
  }
101
108
  export { IconButton as I, IconButtonAnimate as a };
@@ -1,73 +1,8 @@
1
1
  import { useMemo } from "react";
2
2
  import { Skeleton, TablePagination } from "@mui/material";
3
+ import { P as PagerActions } from "../../CommonActions/components/Actions/index.js";
3
4
  import { styled } from "@mui/material/styles";
4
- import { I as IconButton } from "../IconButton/index.js";
5
- import { useEnvironment } from "@m4l/core";
6
5
  import { jsxs, jsx } from "react/jsx-runtime";
7
- const WrapperPagerActions = styled("div")(({ theme }) => ({
8
- width: "100%",
9
- justifyContent: "center",
10
- display: "flex",
11
- marginLeft: 0,
12
- [theme.breakpoints.up("sm")]: {
13
- display: "flex",
14
- alignItems: "center",
15
- marginLeft: theme.spacing(3)
16
- }
17
- }));
18
- function PagerActions(props) {
19
- const {
20
- count,
21
- page,
22
- rowsPerPage,
23
- onPageChange
24
- } = props;
25
- const {
26
- host_static_assets,
27
- environment_assets
28
- } = useEnvironment();
29
- const handleFirstPageButtonClick = (event) => {
30
- onPageChange(event, 0);
31
- };
32
- const handleBackButtonClick = (event) => {
33
- onPageChange(event, page - 1);
34
- };
35
- const handleNextButtonClick = (event) => {
36
- onPageChange(event, page + 1);
37
- };
38
- const handleLastPageButtonClick = (event) => {
39
- onPageChange(event, Math.max(0, Math.ceil(count / rowsPerPage) - 1));
40
- };
41
- return /* @__PURE__ */ jsxs(WrapperPagerActions, {
42
- id: "WrapperPagerActions",
43
- children: [/* @__PURE__ */ jsx(IconButton, {
44
- id: "test_bruce",
45
- dictionaryTooltip: "pager.first",
46
- onClick: handleFirstPageButtonClick,
47
- disabled: page === 0,
48
- "aria-label": "first page",
49
- src: `${host_static_assets}/${environment_assets}/frontend/components/pager/assets/icons/first.svg`
50
- }), /* @__PURE__ */ jsx(IconButton, {
51
- dictionaryTooltip: "pager.previous",
52
- onClick: handleBackButtonClick,
53
- disabled: page === 0,
54
- "aria-label": "first page",
55
- src: `${host_static_assets}/${environment_assets}/frontend/components/pager/assets/icons/previous.svg`
56
- }), /* @__PURE__ */ jsx(IconButton, {
57
- dictionaryTooltip: "pager.next",
58
- onClick: handleNextButtonClick,
59
- disabled: page >= Math.ceil(count / rowsPerPage) - 1,
60
- "aria-label": "next page",
61
- src: `${host_static_assets}/${environment_assets}/frontend/components/pager/assets/icons/next.svg`
62
- }), /* @__PURE__ */ jsx(IconButton, {
63
- dictionaryTooltip: "pager.last",
64
- onClick: handleLastPageButtonClick,
65
- disabled: page >= Math.ceil(count / rowsPerPage) - 1,
66
- "aria-label": "last page",
67
- src: `${host_static_assets}/${environment_assets}/frontend/components/pager/assets/icons/last.svg`
68
- })]
69
- });
70
- }
71
6
  styled("div")(() => ({
72
7
  display: "flex",
73
8
  flexDirection: "column",
@@ -1,8 +1,8 @@
1
- import { VariantModal } from '../../types';
1
+ import { VariantColor } from '../../../../utils/types';
2
2
  export interface ModalConfirmProps {
3
- variant?: VariantModal;
3
+ variant?: VariantColor;
4
4
  msg?: string;
5
5
  }
6
6
  export interface VariantProps {
7
- variant?: VariantModal;
7
+ variant?: VariantColor;
8
8
  }
@@ -3,8 +3,11 @@ import { useEnvironment, voidFunction } from "@m4l/core";
3
3
  import { Typography } from "@mui/material";
4
4
  import { styled } from "@mui/material/styles";
5
5
  import { B as BoxIcon } from "../../components/mui_extended/BoxIcon/index.js";
6
- import { jsx, jsxs } from "react/jsx-runtime";
6
+ import { jsx, jsxs, Fragment } from "react/jsx-runtime";
7
7
  import { M as ModalDialog } from "../../components/ModalDialog/index.js";
8
+ import { A as ActionIntro } from "../../components/CommonActions/components/ActionIntro/index.js";
9
+ import { A as ActionCancel } from "../../components/CommonActions/components/ActionCancel/index.js";
10
+ import { a as getVariantColor } from "../../vendor.js";
8
11
  const WrapperContentConfirm = styled("div")(() => ({
9
12
  display: "flex",
10
13
  flexDirection: "column",
@@ -80,7 +83,6 @@ const initialState = {
80
83
  onQueryClose: voidFunction,
81
84
  iconComponent: void 0,
82
85
  contentComponent: void 0,
83
- actionComponents: void 0,
84
86
  openModal: voidFunction,
85
87
  openModalConfirm: voidFunction,
86
88
  closeModal: voidFunction,
@@ -99,8 +101,6 @@ function ModalProvider({
99
101
  title: "",
100
102
  iconComponent: void 0,
101
103
  contentComponent: void 0,
102
- actionComponents: void 0,
103
- standardActions: void 0,
104
104
  variant: void 0
105
105
  });
106
106
  const [hasChanges, setHasChanges] = useState(false);
@@ -130,11 +130,14 @@ function ModalProvider({
130
130
  variant,
131
131
  msg
132
132
  }),
133
- standardActions: {
134
- withCancel: true,
135
- onClickIntro: onClickIntroClose,
136
- onClickCancel
137
- }
133
+ actions: /* @__PURE__ */ jsxs(Fragment, {
134
+ children: [/* @__PURE__ */ jsx(ActionCancel, {
135
+ onClick: onClickCancel
136
+ }), " ", /* @__PURE__ */ jsx(ActionIntro, {
137
+ onClick: onClickIntroClose,
138
+ color: getVariantColor(variant)
139
+ })]
140
+ })
138
141
  });
139
142
  };
140
143
  const closeModal = () => {
@@ -1,4 +1,5 @@
1
1
  import { ReactNode } from 'react';
2
+ import { VariantColor } from '../../utils/types';
2
3
  export declare type TProps = {
3
4
  children: ReactNode;
4
5
  };
@@ -7,24 +8,22 @@ export interface StandarActions {
7
8
  onClickIntro?: () => void;
8
9
  onClickCancel?: () => void;
9
10
  }
10
- export declare type VariantModal = 'warning' | 'delete' | 'info' | 'primary';
11
11
  export interface ModalOpenOptions {
12
12
  initialWidth?: number;
13
13
  initialHeigth?: number;
14
14
  maxWidth?: number;
15
15
  maxHeigth?: number;
16
16
  withClose?: boolean;
17
- variant?: VariantModal;
17
+ variant?: VariantColor;
18
18
  onQueryClose?: () => void;
19
19
  title: string;
20
20
  iconComponent?: ReactNode;
21
21
  contentComponent?: ((props?: any) => JSX.Element) | ReactNode;
22
- actionComponents?: ReactNode[];
23
- standardActions?: StandarActions;
22
+ actions?: ReactNode;
24
23
  }
25
24
  export interface OpenModalConfirmProps {
26
25
  title: string;
27
- variant?: VariantModal;
26
+ variant?: VariantColor;
28
27
  titleAccept?: string;
29
28
  msg: string;
30
29
  onClickIntro?: () => void;
@@ -32,7 +31,7 @@ export interface OpenModalConfirmProps {
32
31
  }
33
32
  export interface ModalState extends ModalOpenOptions {
34
33
  open: boolean;
35
- variant?: VariantModal;
34
+ variant?: VariantColor;
36
35
  }
37
36
  export interface ModalContextProps extends ModalState {
38
37
  openModal: (modalProps: ModalOpenOptions) => void;
package/dist/index.js CHANGED
@@ -20,7 +20,7 @@ export { B as BoxIcon } from "./components/mui_extended/BoxIcon/index.js";
20
20
  export { B as Breadcrumbs } from "./components/mui_extended/Breadcrumbs/index.js";
21
21
  export { L as LinkWithRoute } from "./components/mui_extended/LinkWithRoute/index.js";
22
22
  export { L as LoadingButton } from "./components/mui_extended/LoadingButton/index.js";
23
- export { M as MenuActions } from "./components/mui_extended/MenuActions/index.js";
23
+ export { b as Actions, M as MenuActions, d as defaultActionsDictionary, g as getStandardActionsDictionary } from "./components/CommonActions/components/Actions/index.js";
24
24
  export { M as MenuPopover } from "./components/mui_extended/MenuPopover/index.js";
25
25
  export { P as Pager, g as getPagerComponentsDictionary } from "./components/mui_extended/Pager/index.js";
26
26
  export { T as Tab } from "./components/mui_extended/Tab/index.js";
@@ -30,7 +30,10 @@ export { B as BooleanFormatter } from "./components/formatters/BooleanFormatter/
30
30
  export { D as DateFormatter } from "./components/formatters/DateFormatter/index.js";
31
31
  export { D as DataGrid, g as getGridComponentsDictionary } from "./components/DataGrid/index.js";
32
32
  export { D as DynamicFilter } from "./components/DynamicFilter/index.js";
33
- export { F as FormActions, d as defaultActionsDictionary, g as getActionnsComponentsDictionary } from "./components/FormActions/index.js";
33
+ export { A as ActionCancel } from "./components/CommonActions/components/ActionCancel/index.js";
34
+ export { A as ActionIntro } from "./components/CommonActions/components/ActionIntro/index.js";
35
+ export { A as ActionFormCancel } from "./components/CommonActions/components/ActionFormCancel/index.js";
36
+ export { A as ActionFormIntro } from "./components/CommonActions/components/ActionFormIntro/index.js";
34
37
  export { I as Icon } from "./components/Icon/index.js";
35
38
  export { I as Image } from "./components/Image/index.js";
36
39
  export { L as LanguagePopover } from "./components/LanguagePopover/index.js";
@@ -54,6 +57,7 @@ import "react-hook-form";
54
57
  import "./node_modules.js";
55
58
  import "prop-types";
56
59
  import "@mui/material/styles";
60
+ import "@mui/material/Button";
57
61
  import "react-router-dom";
58
62
  import "@mui/lab";
59
63
  import "@mui/x-date-pickers";
@@ -62,7 +66,6 @@ import "./commonjs.js";
62
66
  import "react-dom";
63
67
  import "clsx";
64
68
  import "./react-lazy-load-image-component.js";
65
- import "date-fns";
66
69
  import "@m4l/graphics";
67
70
  import "react-dnd";
68
71
  import "react-dnd-html5-backend";