@m4l/components 0.1.27 → 0.1.28

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 (93) hide show
  1. package/assets/Logo/index.228dcb5a.js +42 -35
  2. package/commonjs.565e6834.js +5 -5
  3. package/components/CommonActions/components/ActionCancel/index.e498eeb2.js +17 -0
  4. package/components/CommonActions/components/ActionFormCancel/index.4ff0ad73.js +64 -0
  5. package/components/CommonActions/components/ActionFormIntro/index.ca4d2674.js +28 -22
  6. package/components/CommonActions/components/ActionIntro/index.60ef7bd7.js +18 -0
  7. package/components/CommonActions/components/Actions/index.0645e30f.js +867 -0
  8. package/components/DataGrid/index.76d8fd25.js +1075 -0
  9. package/components/DynamicFilter/index.342ba5fe.js +1577 -0
  10. package/components/ErrorLabel/index.c8615f16.js +13 -12
  11. package/components/Icon/index.619c31c4.js +65 -53
  12. package/components/Image/index.93d5f37f.js +190 -0
  13. package/components/Loadable/index.f5518558.js +8 -8
  14. package/components/ModalDialog/index.9ea10764.js +184 -0
  15. package/components/NoItemSelected/{index.9609a7f7.js → index.46d2f632.js} +52 -41
  16. package/components/ObjectLogs/index.f941fb79.js +288 -0
  17. package/components/Page/index.4237c241.js +22 -20
  18. package/components/PaperForm/index.ec9cb8c9.js +66 -59
  19. package/components/Period/index.2941fbda.js +249 -0
  20. package/components/PropertyValue/index.dfcfe1ba.js +95 -65
  21. package/components/Resizeable/index.45995d2b.js +19 -19
  22. package/components/ScrollBar/index.39eeb2de.js +26 -21
  23. package/components/ScrollToTop/index.e06f98f6.js +8 -7
  24. package/components/SplitLayout/index.4032673d.js +35 -33
  25. package/components/animate/LoadingScreen/index.1d0c4307.js +33 -33
  26. package/components/animate/MotionContainer/index.8d9f9d80.js +25 -22
  27. package/components/animate/MotionLazyContainer/index.572dd012.js +10 -10
  28. package/components/animate/features.0fbf41e1.js +3 -3
  29. package/components/animate/variants/bounce.784aaaaa.js +16 -13
  30. package/components/animate/variants/container.11f82b76.js +8 -6
  31. package/components/animate/variants/fade.b561c0fc.js +32 -28
  32. package/components/animate/variants/transition.bd46b9ce.js +17 -12
  33. package/components/formatters/BooleanFormatter/index.8da35c9c.js +46 -33
  34. package/components/formatters/DateFormatter/index.1b9baacc.js +49 -37
  35. package/components/formatters/index.689a8086.js +119 -0
  36. package/components/hook-form/RHFAutocomplete/index.59a68f9f.js +224 -0
  37. package/components/hook-form/RHFAutocompleteAsync/index.c3083062.js +87 -0
  38. package/components/hook-form/RHFCheckbox/index.6dcec9e2.js +49 -39
  39. package/components/hook-form/RHFDateTime/index.9231a7c7.js +69 -56
  40. package/components/hook-form/RHFMultiCheckbox/index.2680b3b6.js +23 -23
  41. package/components/hook-form/RHFPeriod/index.64a228d5.js +55 -0
  42. package/components/hook-form/RHFRadioGroup/index.b3335e13.js +29 -29
  43. package/components/hook-form/RHFSelect/index.b6ca8bb2.js +24 -24
  44. package/components/hook-form/RHFTextField/index.f9aaaa90.js +110 -93
  45. package/components/hook-form/RHFUpload/{index.ec4d5326.js → index.d5cc7c13.js} +151 -130
  46. package/components/mui_extended/Accordion/index.a02ac6ae.js +73 -69
  47. package/components/mui_extended/Avatar/index.fe06afd7.js +44 -34
  48. package/components/mui_extended/BoxIcon/index.e638ecc8.js +10 -10
  49. package/components/mui_extended/Breadcrumbs/index.5e37d903.js +49 -44
  50. package/components/mui_extended/Button/index.53b56958.js +178 -0
  51. package/components/mui_extended/CircularProgress/index.ad569afd.js +8 -6
  52. package/components/mui_extended/IconButton/index.a321e5cb.js +82 -67
  53. package/components/mui_extended/LinkWithRoute/index.16436ab8.js +25 -21
  54. package/components/mui_extended/Pager/index.c0865b70.js +141 -0
  55. package/components/mui_extended/Popover/index.705275a4.js +278 -0
  56. package/components/mui_extended/Tab/index.e0653a0a.js +25 -21
  57. package/components/mui_extended/Typography/index.e5494696.js +25 -21
  58. package/contexts/ModalContext/index.b92fa565.js +153 -0
  59. package/contexts/ModalContext/{components → subcomponents}/ContentConfirm/index.d.ts +0 -0
  60. package/contexts/ModalContext/{components → subcomponents}/ContentConfirm/styles.d.ts +0 -0
  61. package/contexts/ModalContext/{components → subcomponents}/ContentConfirm/types.d.ts +0 -0
  62. package/contexts/RHFormContext/index.b142190a.js +63 -0
  63. package/hooks/useFormAddEdit/index.d4845f1a.js +40 -22
  64. package/hooks/useModal/index.5fee01a3.js +11 -0
  65. package/index.js +153 -153
  66. package/package.json +2 -1
  67. package/react-data-grid.d46d625e.js +2206 -1663
  68. package/react-draggable.20e95c61.js +800 -553
  69. package/react-json-view.f56a7f8e.js +2344 -2340
  70. package/react-resizable.5277deaf.js +470 -298
  71. package/react-splitter-layout.7810ac1b.js +130 -128
  72. package/utils/index.214d9542.js +500 -354
  73. package/components/CommonActions/components/ActionCancel/index.431160ba.js +0 -17
  74. package/components/CommonActions/components/ActionFormCancel/index.6a0f34aa.js +0 -49
  75. package/components/CommonActions/components/ActionIntro/index.85557b90.js +0 -18
  76. package/components/CommonActions/components/Actions/index.edeb05c2.js +0 -742
  77. package/components/DataGrid/index.2ce9da7d.js +0 -894
  78. package/components/DynamicFilter/index.e1d4a948.js +0 -1157
  79. package/components/Image/index.c9da2d5a.js +0 -152
  80. package/components/ModalDialog/index.ad61757f.js +0 -168
  81. package/components/ObjectLogs/index.6ebaec71.js +0 -266
  82. package/components/Period/index.81de7941.js +0 -175
  83. package/components/contexts/RHFormContext/index.33dba822.js +0 -56
  84. package/components/formatters/index.c2a9b55d.js +0 -106
  85. package/components/hook-form/RHFAutocomplete/index.5eee9d7c.js +0 -174
  86. package/components/hook-form/RHFAutocompleteAsync/index.757b5080.js +0 -65
  87. package/components/hook-form/RHFPeriod/index.e08fb1ab.js +0 -51
  88. package/components/mui_extended/Button/index.51dae0bb.js +0 -144
  89. package/components/mui_extended/Pager/index.1dc45f5e.js +0 -126
  90. package/components/mui_extended/Popover/index.cb2ccc66.js +0 -252
  91. package/contexts/ModalContext/index.9ebc793c.js +0 -136
  92. package/hooks/useModal/index.34f5978e.js +0 -11
  93. package/node_modules.168cb897.js +0 -55
@@ -1,28 +1,32 @@
1
- import { useModuleSkeleton as n } from "@m4l/core";
2
- import { Skeleton as a, Tab as s } from "@mui/material";
3
- import { styled as p } from "@mui/material/styles";
4
- import { jsx as e } from "react/jsx-runtime";
5
- const d = p("div")(({
6
- theme: t
1
+ import { useModuleSkeleton } from "@m4l/core";
2
+ import { Skeleton, Tab as Tab$1 } from "@mui/material";
3
+ import { styled } from "@mui/material/styles";
4
+ import { jsx } from "react/jsx-runtime";
5
+ const SKTTabWrapper = styled("div")(({
6
+ theme
7
7
  }) => ({
8
- padding: t.spacing(1.5, 2)
8
+ padding: theme.spacing(1.5, 2)
9
9
  }));
10
- function c(t) {
10
+ function Tab(props) {
11
11
  const {
12
- SKTWidth: o,
13
- SKTHeight: r,
14
- ...i
15
- } = t;
16
- return n() ? /* @__PURE__ */ e(d, {
17
- children: /* @__PURE__ */ e(a, {
18
- variant: "text",
19
- width: o,
20
- height: r
21
- })
22
- }) : /* @__PURE__ */ e(s, {
23
- ...i
12
+ SKTWidth,
13
+ SKTHeight,
14
+ ...other
15
+ } = props;
16
+ const isSkeleton = useModuleSkeleton();
17
+ if (isSkeleton) {
18
+ return /* @__PURE__ */ jsx(SKTTabWrapper, {
19
+ children: /* @__PURE__ */ jsx(Skeleton, {
20
+ variant: "text",
21
+ width: SKTWidth,
22
+ height: SKTHeight
23
+ })
24
+ });
25
+ }
26
+ return /* @__PURE__ */ jsx(Tab$1, {
27
+ ...other
24
28
  });
25
29
  }
26
30
  export {
27
- c as T
31
+ Tab as T
28
32
  };
@@ -1,31 +1,35 @@
1
- import { useModuleSkeleton as s } from "@m4l/core";
2
- import { Skeleton as p, Typography as i } from "@mui/material";
3
- import { jsx as r } from "react/jsx-runtime";
4
- const h = (t) => {
1
+ import { useModuleSkeleton } from "@m4l/core";
2
+ import { Skeleton, Typography as Typography$1 } from "@mui/material";
3
+ import { jsx } from "react/jsx-runtime";
4
+ const SkeletonTypography = (props) => {
5
5
  const {
6
- skeletonWidth: e,
7
- skeletongHeight: o
8
- } = t;
9
- return /* @__PURE__ */ r(p, {
6
+ skeletonWidth,
7
+ skeletongHeight
8
+ } = props;
9
+ return /* @__PURE__ */ jsx(Skeleton, {
10
10
  variant: "text",
11
- width: e,
12
- height: o
11
+ width: skeletonWidth,
12
+ height: skeletongHeight
13
13
  });
14
14
  };
15
- function k(t) {
15
+ function Typography(props) {
16
16
  const {
17
- skeletonWidth: e = "100%",
18
- skeletongHeight: o = "18px",
19
- ...n
20
- } = t;
21
- return s() ? /* @__PURE__ */ r(h, {
22
- skeletonWidth: e,
23
- skeletongHeight: o
24
- }) : /* @__PURE__ */ r(i, {
17
+ skeletonWidth = "100%",
18
+ skeletongHeight = "18px",
19
+ ...other
20
+ } = props;
21
+ const isSkeleton = useModuleSkeleton();
22
+ if (isSkeleton) {
23
+ return /* @__PURE__ */ jsx(SkeletonTypography, {
24
+ skeletonWidth,
25
+ skeletongHeight
26
+ });
27
+ }
28
+ return /* @__PURE__ */ jsx(Typography$1, {
25
29
  className: "m4l_typography",
26
- ...n
30
+ ...other
27
31
  });
28
32
  }
29
33
  export {
30
- k as T
34
+ Typography as T
31
35
  };
@@ -0,0 +1,153 @@
1
+ import { createContext, useState } from "react";
2
+ import { useEnvironment, voidFunction } from "@m4l/core";
3
+ import { Typography } from "@mui/material";
4
+ import { styled } from "@mui/material/styles";
5
+ import { B as BoxIcon } from "../../components/mui_extended/BoxIcon/index.e638ecc8.js";
6
+ import { jsx, jsxs, Fragment } from "react/jsx-runtime";
7
+ import { M as ModalDialog } from "../../components/ModalDialog/index.9ea10764.js";
8
+ import { A as ActionIntro } from "../../components/CommonActions/components/ActionIntro/index.60ef7bd7.js";
9
+ import { A as ActionCancel } from "../../components/CommonActions/components/ActionCancel/index.e498eeb2.js";
10
+ import { b as getVariantColor } from "../../utils/index.214d9542.js";
11
+ const WrapperContentConfirm = styled("div")(() => ({
12
+ display: "flex",
13
+ flexDirection: "column",
14
+ height: "100%"
15
+ }));
16
+ const ModalContent = styled("div")(({
17
+ theme
18
+ }) => ({
19
+ display: "flex",
20
+ flexDirection: "column",
21
+ justifyContent: "center",
22
+ alignItems: "center",
23
+ gridGap: theme.spacing(5),
24
+ flexGrow: 1,
25
+ [theme.breakpoints.up("sm")]: {
26
+ display: "grid",
27
+ flexDirection: "row",
28
+ gridTemplateColumns: "1fr 1fr"
29
+ }
30
+ }));
31
+ const IllustrationContainer = styled("div")(({
32
+ theme,
33
+ variant
34
+ }) => ({
35
+ display: "flex",
36
+ justifyContent: "center",
37
+ alignItems: "center",
38
+ "& > span": {
39
+ background: variant === "warning" ? theme.palette.warning.main : variant === "delete" ? theme.palette.error.main : variant === "info" ? theme.palette.info.main : "theme.palette.text.primary"
40
+ }
41
+ }));
42
+ const MessageContainer = styled("div")(() => ({
43
+ display: "flex",
44
+ alignItems: "center"
45
+ }));
46
+ const ContentConfirm = (props) => {
47
+ const {
48
+ variant = "info",
49
+ msg = "Are you sure you want to perform this action? Once complete, the information will be deleted."
50
+ } = props;
51
+ const {
52
+ host_static_assets,
53
+ environment_assets
54
+ } = useEnvironment();
55
+ const illustrationWarning = `${host_static_assets}/${environment_assets}/frontend/components/dialog/assets/icons/illustration_confirm_warning.svg`;
56
+ const illustrationError = `${host_static_assets}/${environment_assets}/frontend/components/dialog/assets/icons/illustration_confirm_danger.svg`;
57
+ const illustrationInfo = `${host_static_assets}/${environment_assets}/frontend/components/dialog/assets/icons/illustration_confirm_info.svg`;
58
+ return /* @__PURE__ */ jsx(WrapperContentConfirm, {
59
+ children: /* @__PURE__ */ jsxs(ModalContent, {
60
+ children: [/* @__PURE__ */ jsx(IllustrationContainer, {
61
+ variant,
62
+ children: /* @__PURE__ */ jsx(BoxIcon, {
63
+ src: variant === "warning" ? illustrationWarning : variant === "delete" ? illustrationError : illustrationInfo,
64
+ sx: {
65
+ width: "230px",
66
+ height: "194px"
67
+ }
68
+ })
69
+ }), /* @__PURE__ */ jsx(MessageContainer, {
70
+ children: /* @__PURE__ */ jsx(Typography, {
71
+ variant: "body1",
72
+ children: msg
73
+ })
74
+ })]
75
+ })
76
+ });
77
+ };
78
+ const ModalContext = createContext(null);
79
+ function ModalProvider({
80
+ children
81
+ }) {
82
+ const [modalOptions, setModalOptions] = useState({
83
+ open: false,
84
+ withClose: true,
85
+ onQueryClose: voidFunction,
86
+ title: "",
87
+ iconComponent: void 0,
88
+ contentComponent: void 0,
89
+ variant: void 0
90
+ });
91
+ const [hasChanges, setHasChanges] = useState(false);
92
+ const openModal = (modalOpenProps) => {
93
+ setModalOptions({
94
+ open: true,
95
+ ...modalOpenProps
96
+ });
97
+ };
98
+ const openModalConfirm = (modalOpenConfirmProps) => {
99
+ const {
100
+ variant = "warning",
101
+ title,
102
+ msg,
103
+ onClickIntro,
104
+ onClickCancel = closeModal
105
+ } = modalOpenConfirmProps;
106
+ const onClickIntroClose = () => {
107
+ onClickIntro && onClickIntro();
108
+ closeModal();
109
+ };
110
+ setModalOptions({
111
+ open: true,
112
+ title,
113
+ variant,
114
+ contentComponent: /* @__PURE__ */ jsx(ContentConfirm, {
115
+ variant,
116
+ msg
117
+ }),
118
+ actions: /* @__PURE__ */ jsxs(Fragment, {
119
+ children: [/* @__PURE__ */ jsx(ActionCancel, {
120
+ onClick: onClickCancel
121
+ }), " ", /* @__PURE__ */ jsx(ActionIntro, {
122
+ onClick: onClickIntroClose,
123
+ color: getVariantColor(variant)
124
+ })]
125
+ })
126
+ });
127
+ };
128
+ const closeModal = () => {
129
+ setModalOptions((last) => ({
130
+ ...last,
131
+ open: false
132
+ }));
133
+ setHasChanges(false);
134
+ };
135
+ const setChanges = () => {
136
+ setHasChanges(true);
137
+ };
138
+ return /* @__PURE__ */ jsxs(ModalContext.Provider, {
139
+ value: {
140
+ ...modalOptions,
141
+ openModal,
142
+ openModalConfirm,
143
+ closeModal,
144
+ hasChanges,
145
+ setChanges
146
+ },
147
+ children: [children, /* @__PURE__ */ jsx(ModalDialog, {})]
148
+ });
149
+ }
150
+ export {
151
+ ModalContext as M,
152
+ ModalProvider as a
153
+ };
@@ -0,0 +1,63 @@
1
+ import { useEffect } from "react";
2
+ import { useForm, FormProvider } from "react-hook-form";
3
+ import { yupResolver } from "@hookform/resolvers/yup";
4
+ import { styled } from "@mui/material/styles";
5
+ import { jsx } from "react/jsx-runtime";
6
+ const WrapperFormProvider = styled("form")(({
7
+ theme
8
+ }) => ({
9
+ display: "flex",
10
+ marginBottom: theme.spacing(1),
11
+ flexDirection: "column",
12
+ width: "100%",
13
+ overflow: "auto",
14
+ maxWidth: theme.stretch ? "unset" : "900px",
15
+ padding: theme.spacing(3)
16
+ }));
17
+ function RHFormProvider(props) {
18
+ const {
19
+ children,
20
+ onSubmit,
21
+ values,
22
+ validationSchema,
23
+ statusLoad = "ready"
24
+ } = props;
25
+ const methods = useForm({
26
+ resolver: yupResolver(validationSchema),
27
+ defaultValues: values
28
+ });
29
+ useEffect(() => {
30
+ if (statusLoad === "reload_values_provider") {
31
+ const keys = Object.keys(values);
32
+ keys.forEach((key) => {
33
+ methods.setValue(key, values[key], {
34
+ shouldValidate: false,
35
+ shouldDirty: false,
36
+ shouldTouch: false
37
+ });
38
+ });
39
+ return;
40
+ }
41
+ }, [methods, statusLoad, values]);
42
+ useEffect(() => {
43
+ if (statusLoad === "ready") {
44
+ console.log("useEffect FormProvider Ready", statusLoad);
45
+ methods.setValue("statusLoad", "ready", {
46
+ shouldValidate: false,
47
+ shouldDirty: false,
48
+ shouldTouch: false
49
+ });
50
+ }
51
+ }, [statusLoad]);
52
+ return /* @__PURE__ */ jsx(FormProvider, {
53
+ ...methods,
54
+ children: /* @__PURE__ */ jsx(WrapperFormProvider, {
55
+ id: "formProvider",
56
+ onSubmit: methods.handleSubmit(onSubmit),
57
+ children
58
+ })
59
+ });
60
+ }
61
+ export {
62
+ RHFormProvider as R
63
+ };
@@ -1,26 +1,44 @@
1
- import { useNetwork as p, useFlags as v } from "@m4l/core";
2
- import { useState as n, useEffect as _ } from "react";
3
- const F = (i) => {
4
- const { initialValues: u, objectId: o, endPoint: l, formatDataEnpoint: r } = i, [f, a] = n(u), [e, t] = n(
5
- o === void 0 ? "new" : "edit"
6
- ), { networkOperation: m } = p(), { addFlag: c } = v();
7
- return _(() => {
8
- let s = !0;
9
- return e === "edit" ? m({
10
- method: "GET",
11
- endPoint: `${l}/${o}`
12
- }).then(
13
- (d) => {
14
- s && (a(r ? r(d) : d), t("reload_values_provider"));
15
- },
16
- () => {
17
- t("error");
18
- }
19
- ) : (e === "new" || e === "reload_values_provider") && (c("form_loaded"), t("ready")), () => {
20
- s = !1;
1
+ import { useNetwork, useFlags } from "@m4l/core";
2
+ import { useState, useEffect } from "react";
3
+ const useFormAddEdit = (props) => {
4
+ const { initialValues, objectId, endPoint, formatDataEnpoint } = props;
5
+ const [formValues, setFormValues] = useState(initialValues);
6
+ const [statusLoad, setStatusLoad] = useState(
7
+ objectId === void 0 ? "new" : "edit"
8
+ );
9
+ const { networkOperation } = useNetwork();
10
+ const { addFlag } = useFlags();
11
+ useEffect(() => {
12
+ let mounted = true;
13
+ if (statusLoad === "edit") {
14
+ networkOperation({
15
+ method: "GET",
16
+ endPoint: `${endPoint}/${objectId}`
17
+ }).then(
18
+ (response) => {
19
+ if (mounted) {
20
+ if (formatDataEnpoint) {
21
+ setFormValues(formatDataEnpoint(response));
22
+ } else {
23
+ setFormValues(response);
24
+ }
25
+ setStatusLoad("reload_values_provider");
26
+ }
27
+ },
28
+ () => {
29
+ setStatusLoad("error");
30
+ }
31
+ );
32
+ } else if (statusLoad === "new" || statusLoad === "reload_values_provider") {
33
+ addFlag("form_loaded");
34
+ setStatusLoad("ready");
35
+ }
36
+ return () => {
37
+ mounted = false;
21
38
  };
22
- }, [e]), { formValues: f, statusLoad: e };
39
+ }, [statusLoad]);
40
+ return { formValues, statusLoad };
23
41
  };
24
42
  export {
25
- F as u
43
+ useFormAddEdit as u
26
44
  };
@@ -0,0 +1,11 @@
1
+ import { useContext } from "react";
2
+ import { M as ModalContext } from "../../contexts/ModalContext/index.b92fa565.js";
3
+ function useModal() {
4
+ const context = useContext(ModalContext);
5
+ if (!context)
6
+ throw new Error("useModal context must be use inside ModalContext");
7
+ return context;
8
+ }
9
+ export {
10
+ useModal as u
11
+ };