@m4l/components 0.1.11 → 0.1.13

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 (144) hide show
  1. package/assets/Logo/index.228dcb5a.js +86 -0
  2. package/commonjs.565e6834.js +12 -0
  3. package/components/CommonActions/components/ActionCancel/index.cba1b460.js +17 -0
  4. package/components/CommonActions/components/ActionFormCancel/index.be2fe891.js +49 -0
  5. package/components/CommonActions/components/ActionFormIntro/index.ca4d2674.js +31 -0
  6. package/components/CommonActions/components/ActionIntro/index.cc4b1e0e.js +18 -0
  7. package/components/CommonActions/components/Actions/index.e8148d98.js +743 -0
  8. package/components/CompanyLogo/{index.js → index.f81c179c.js} +42 -48
  9. package/components/DataGrid/index.b688877d.js +894 -0
  10. package/components/DataGrid/types.d.ts +1 -1
  11. package/components/DynamicFilter/index.82ce857e.js +1158 -0
  12. package/components/ErrorLabel/index.c8615f16.js +19 -0
  13. package/components/Icon/index.cbca79b0.js +70 -0
  14. package/components/Image/index.e790b50b.js +122 -0
  15. package/components/LanguagePopover/index.3d9611cb.js +87 -0
  16. package/components/Loadable/index.f5518558.js +15 -0
  17. package/components/ModalDialog/index.3850c053.js +168 -0
  18. package/components/NoItemSelected/{index.js → index.12f0ca67.js} +43 -50
  19. package/components/ObjectLogs/index.27ef875d.js +266 -0
  20. package/components/Page/index.6d69977e.js +35 -0
  21. package/components/Page/index.d.ts +1 -1
  22. package/components/PaperForm/index.d7c74064.js +105 -0
  23. package/components/Period/index.5e68286a.js +160 -0
  24. package/components/PropertyValue/index.ab3dd7e9.js +116 -0
  25. package/components/Resizeable/{index.js → index.45995d2b.js} +21 -19
  26. package/components/ScrollBar/index.39eeb2de.js +49 -0
  27. package/components/ScrollToTop/index.e06f98f6.js +11 -0
  28. package/components/SplitLayout/{index.js → index.4032673d.js} +35 -35
  29. package/components/animate/IconButtonAnimate/index.d.ts +1 -1
  30. package/components/animate/LoadingScreen/{index.js → index.f1cec7db.js} +29 -27
  31. package/components/animate/MotionContainer/index.8d9f9d80.js +30 -0
  32. package/components/animate/MotionLazyContainer/index.572dd012.js +15 -0
  33. package/components/animate/features.0fbf41e1.js +5 -0
  34. package/components/animate/variants/{bounce.js → bounce.784aaaaa.js} +15 -16
  35. package/components/animate/variants/container.11f82b76.js +20 -0
  36. package/components/animate/variants/fade.b561c0fc.js +59 -0
  37. package/components/animate/variants/{index.js → index.7a912140.js} +0 -0
  38. package/components/animate/variants/transition.bd46b9ce.js +15 -0
  39. package/components/formatters/BooleanFormatter/index.cca53b7f.js +42 -0
  40. package/components/formatters/DateFormatter/index.ad8d9b8e.js +57 -0
  41. package/components/formatters/index.55856d65.js +106 -0
  42. package/components/hook-form/FormProvider/index.257acd9f.js +55 -0
  43. package/components/hook-form/RHFAutocomplete/index.6ed76d4c.js +122 -0
  44. package/components/hook-form/RHFAutocompleteAsync/index.8f2c97ea.js +153 -0
  45. package/components/hook-form/RHFCheckbox/index.f9ce6c39.js +59 -0
  46. package/components/hook-form/RHFDateTime/index.fc5cbafe.js +68 -0
  47. package/components/hook-form/RHFMultiCheckbox/index.2680b3b6.js +34 -0
  48. package/components/hook-form/RHFPeriod/index.23c254e9.js +45 -0
  49. package/components/hook-form/RHFRadioGroup/index.b3335e13.js +43 -0
  50. package/components/hook-form/RHFSelect/index.b6ca8bb2.js +36 -0
  51. package/components/hook-form/RHFTextField/index.4c455f75.js +77 -0
  52. package/components/hook-form/RHFTextField/index.d.ts +1 -1
  53. package/components/hook-form/RHFUpload/index.ed3d739f.js +244 -0
  54. package/components/mui_extended/Accordion/index.2116e423.js +103 -0
  55. package/components/mui_extended/Avatar/index.0a2a4523.js +32 -0
  56. package/components/mui_extended/Avatar/index.d.ts +1 -1
  57. package/components/mui_extended/BoxIcon/index.e638ecc8.js +22 -0
  58. package/components/mui_extended/Breadcrumbs/index.5e37d903.js +89 -0
  59. package/components/mui_extended/Button/index.84d8898c.js +110 -0
  60. package/components/mui_extended/IconButton/index.88f3aadb.js +98 -0
  61. package/components/mui_extended/LinkWithRoute/index.d4b263de.js +28 -0
  62. package/components/mui_extended/MenuPopover/index.488fc536.js +131 -0
  63. package/components/mui_extended/Pager/index.0576814f.js +126 -0
  64. package/components/mui_extended/Tab/index.e0653a0a.js +28 -0
  65. package/components/mui_extended/Typography/index.0c4604b3.js +22 -0
  66. package/contexts/ModalContext/index.2188b69e.js +150 -0
  67. package/hooks/useFormAddEdit/index.d4845f1a.js +26 -0
  68. package/hooks/useModal/index.6571d2d9.js +6 -0
  69. package/index.js +162 -70
  70. package/lodash.e09401f0.js +32 -0
  71. package/node_modules.168cb897.js +55 -0
  72. package/package.json +1 -1
  73. package/react-data-grid.d46d625e.js +2115 -0
  74. package/react-draggable.20e95c61.js +714 -0
  75. package/react-json-view.f56a7f8e.js +2762 -0
  76. package/react-lazy-load-image-component.45b56650.js +784 -0
  77. package/react-resizable.5277deaf.js +371 -0
  78. package/react-splitter-layout.7810ac1b.js +165 -0
  79. package/utils/index.214d9542.js +435 -0
  80. package/assets/Logo/index.js +0 -91
  81. package/commonjs.js +0 -9
  82. package/components/CommonActions/components/ActionCancel/index.js +0 -15
  83. package/components/CommonActions/components/ActionFormCancel/index.js +0 -62
  84. package/components/CommonActions/components/ActionFormIntro/index.js +0 -35
  85. package/components/CommonActions/components/ActionIntro/index.js +0 -16
  86. package/components/CommonActions/components/Actions/index.js +0 -859
  87. package/components/DataGrid/index.js +0 -1067
  88. package/components/DynamicFilter/index.js +0 -1573
  89. package/components/ErrorLabel/index.js +0 -18
  90. package/components/Icon/index.js +0 -80
  91. package/components/Image/index.js +0 -128
  92. package/components/LanguagePopover/index.js +0 -93
  93. package/components/Loadable/index.js +0 -13
  94. package/components/ModalDialog/index.js +0 -180
  95. package/components/ObjectLogs/index.js +0 -284
  96. package/components/Page/index.js +0 -36
  97. package/components/PaperForm/index.js +0 -110
  98. package/components/Period/index.js +0 -230
  99. package/components/PropertyValue/index.js +0 -142
  100. package/components/ScrollBar/index.js +0 -52
  101. package/components/ScrollToTop/index.js +0 -10
  102. package/components/animate/MotionContainer/index.js +0 -31
  103. package/components/animate/MotionLazyContainer/index.js +0 -13
  104. package/components/animate/features.js +0 -2
  105. package/components/animate/variants/container.js +0 -20
  106. package/components/animate/variants/fade.js +0 -61
  107. package/components/animate/variants/transition.js +0 -16
  108. package/components/formatters/BooleanFormatter/index.js +0 -52
  109. package/components/formatters/DateFormatter/index.js +0 -66
  110. package/components/formatters/index.js +0 -112
  111. package/components/hook-form/FormProvider/index.js +0 -61
  112. package/components/hook-form/RHFAutocomplete/index.js +0 -144
  113. package/components/hook-form/RHFAutocompleteAsync/index.js +0 -191
  114. package/components/hook-form/RHFCheckbox/index.js +0 -65
  115. package/components/hook-form/RHFDateTime/index.js +0 -79
  116. package/components/hook-form/RHFMultiCheckbox/index.js +0 -32
  117. package/components/hook-form/RHFPeriod/index.js +0 -47
  118. package/components/hook-form/RHFRadioGroup/index.js +0 -41
  119. package/components/hook-form/RHFSelect/index.js +0 -34
  120. package/components/hook-form/RHFTextField/index.js +0 -87
  121. package/components/hook-form/RHFUpload/index.js +0 -255
  122. package/components/mui_extended/Accordion/index.js +0 -105
  123. package/components/mui_extended/Avatar/index.js +0 -33
  124. package/components/mui_extended/BoxIcon/index.js +0 -20
  125. package/components/mui_extended/Breadcrumbs/index.js +0 -92
  126. package/components/mui_extended/Button/index.js +0 -131
  127. package/components/mui_extended/IconButton/index.js +0 -108
  128. package/components/mui_extended/LinkWithRoute/index.js +0 -30
  129. package/components/mui_extended/MenuPopover/index.js +0 -135
  130. package/components/mui_extended/Pager/index.js +0 -137
  131. package/components/mui_extended/Tab/index.js +0 -30
  132. package/components/mui_extended/Typography/index.js +0 -21
  133. package/contexts/ModalContext/index.js +0 -165
  134. package/hooks/useFormAddEdit/index.js +0 -42
  135. package/hooks/useModal/index.js +0 -4
  136. package/lodash.js +0 -62
  137. package/node_modules.js +0 -54
  138. package/react-data-grid.js +0 -2652
  139. package/react-draggable.js +0 -960
  140. package/react-json-view.js +0 -2764
  141. package/react-lazy-load-image-component.js +0 -792
  142. package/react-resizable.js +0 -541
  143. package/react-splitter-layout.js +0 -165
  144. package/utils/index.js +0 -572
@@ -1,142 +0,0 @@
1
- import { styled } from "@mui/material/styles";
2
- import { Skeleton } from "@mui/material";
3
- import { jsx, jsxs } from "react/jsx-runtime";
4
- import { useResponsiveDesktop } from "@m4l/graphics";
5
- import { useModuleSkeleton } from "@m4l/core";
6
- const WrapperPropertyValue = styled("div", {
7
- shouldForwardProp: (prop) => prop !== "propertyWidth" && prop !== "propertyHeight" && prop !== "isForm"
8
- })(({
9
- propertyWidth,
10
- isForm,
11
- theme
12
- }) => ({
13
- display: "grid",
14
- gridTemplateColumns: "1fr",
15
- alignItems: "flex-start",
16
- width: "100%",
17
- padding: `${theme.spacing(1)} ${theme.spacing(2)}`,
18
- ":hover": {
19
- backgroundColor: isForm ? "unset" : theme.palette.grid?.rowHover
20
- },
21
- borderBottom: isForm ? "none" : `1px solid ${theme.palette.divider}`,
22
- flexDirection: "column",
23
- [theme.breakpoints.up("sm")]: {
24
- gridTemplateColumns: propertyWidth ? `${propertyWidth}px 1fr` : "150px 1fr",
25
- gap: theme.spacing(2),
26
- alignItems: "center"
27
- }
28
- }));
29
- const Property = styled("div", {
30
- shouldForwardProp: (prop) => prop !== "propertyWidth" && prop !== "propertyHeight" && prop !== "isForm"
31
- })(({
32
- propertyWidth,
33
- isForm,
34
- theme
35
- }) => ({
36
- width: "100%",
37
- minWidth: "100%",
38
- ...theme.typography.subtitle2,
39
- color: theme.palette.text.primary,
40
- height: "100%",
41
- display: "flex",
42
- alignItems: "center",
43
- justifyContent: "flex-start",
44
- position: "relative",
45
- [theme.breakpoints.up("sm")]: {
46
- borderRight: isForm ? "none" : `1px solid ${theme.palette.divider}`,
47
- paddingRight: theme.spacing(2),
48
- textAlign: "right",
49
- width: propertyWidth || "150px",
50
- minWidth: propertyWidth || "150px",
51
- justifyContent: "flex-end"
52
- },
53
- overflow: "hidden",
54
- overflowWrap: "break-word"
55
- }));
56
- const Value = styled("div", {
57
- shouldForwardProp: (prop) => prop !== "valueWidth" && prop !== "valueHeight" && prop !== "withGrid"
58
- })(({
59
- valueWidth,
60
- valueHeight,
61
- theme
62
- }) => ({
63
- flexGrow: "1",
64
- ...theme.typography.body2,
65
- color: theme.palette.text.secondary,
66
- position: "relative",
67
- padding: "1px",
68
- maxWidth: `${valueWidth}%`,
69
- width: `${valueWidth}%`,
70
- height: valueHeight,
71
- marginTop: theme.spacing(1),
72
- [theme.breakpoints.up("sm")]: {
73
- marginTop: "0px"
74
- },
75
- overflow: "hidden",
76
- overflowWrap: "break-word"
77
- }));
78
- const SKTWrapperProperty = styled("div")(() => ({
79
- display: "flex",
80
- justifyContent: "flex-end"
81
- }));
82
- function SKTProperty() {
83
- return /* @__PURE__ */ jsx(SKTWrapperProperty, {
84
- children: /* @__PURE__ */ jsx(Skeleton, {
85
- variant: "text",
86
- width: 68,
87
- height: 14
88
- })
89
- });
90
- }
91
- function PropertyValue(props) {
92
- const {
93
- property,
94
- value,
95
- propertyWidth = 200,
96
- valueHeight = "auto",
97
- valueWidth = "100",
98
- isForm
99
- } = props;
100
- const isDesktop = useResponsiveDesktop();
101
- const isSkeleton = useModuleSkeleton();
102
- const getValueW = () => {
103
- if (valueWidth === "75" && isDesktop) {
104
- return "75";
105
- } else if (valueWidth === "75" && !isDesktop) {
106
- return "100";
107
- }
108
- if (valueWidth === "50" && isDesktop) {
109
- return "50";
110
- } else if (valueWidth === "50" && !isDesktop) {
111
- return "100";
112
- }
113
- if (valueWidth === "25" && isDesktop || valueWidth === "12.5" && isDesktop) {
114
- return `${valueWidth}`;
115
- }
116
- if (valueWidth === "25" && !isDesktop) {
117
- return "50";
118
- }
119
- if (valueWidth === "12.5" && !isDesktop) {
120
- return "25";
121
- }
122
- return "100";
123
- };
124
- const valueW = getValueW();
125
- return /* @__PURE__ */ jsxs(WrapperPropertyValue, {
126
- id: "WrapperPropertyValue",
127
- isForm,
128
- propertyWidth,
129
- children: [/* @__PURE__ */ jsx(Property, {
130
- id: "Property",
131
- isForm,
132
- propertyWidth,
133
- children: isSkeleton ? /* @__PURE__ */ jsx(SKTProperty, {}) : property
134
- }), /* @__PURE__ */ jsx(Value, {
135
- id: "Value",
136
- valueWidth: valueW,
137
- valueHeight,
138
- children: value
139
- })]
140
- });
141
- }
142
- export { PropertyValue as P };
@@ -1,52 +0,0 @@
1
- import SimpleBarReact from "simplebar-react";
2
- import { styled, alpha } from "@mui/material/styles";
3
- import { Box } from "@mui/material";
4
- import { jsx } from "react/jsx-runtime";
5
- const RootStyle = styled("div")(() => ({
6
- flexGrow: 1,
7
- height: "100%",
8
- overflow: "hidden"
9
- }));
10
- const SimpleBarStyle = styled(SimpleBarReact)(({
11
- theme
12
- }) => ({
13
- maxHeight: "100%",
14
- "& .simplebar-scrollbar": {
15
- "&:before": {
16
- backgroundColor: alpha(theme.palette.grey[600], 0.48)
17
- },
18
- "&.simplebar-visible:before": {
19
- opacity: 1
20
- }
21
- },
22
- "& .simplebar-track.simplebar-vertical": {
23
- width: 10
24
- },
25
- "& .simplebar-track.simplebar-horizontal .simplebar-scrollbar": {
26
- height: 6
27
- },
28
- "& .simplebar-mask": {
29
- zIndex: "inherit"
30
- }
31
- }));
32
- function ScrollBar({
33
- children
34
- }) {
35
- const userAgent = typeof navigator === "undefined" ? "SSR" : navigator.userAgent;
36
- const isMobile = /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(userAgent);
37
- if (isMobile) {
38
- return /* @__PURE__ */ jsx(Box, {
39
- sx: {
40
- overflowX: "auto"
41
- },
42
- children
43
- });
44
- }
45
- return /* @__PURE__ */ jsx(RootStyle, {
46
- children: /* @__PURE__ */ jsx(SimpleBarStyle, {
47
- autoHide: false,
48
- children
49
- })
50
- });
51
- }
52
- export { ScrollBar as S };
@@ -1,10 +0,0 @@
1
- import { useEffect } from "react";
2
- import { useLocation } from "react-router-dom";
3
- function ScrollToTop() {
4
- const { pathname } = useLocation();
5
- useEffect(() => {
6
- window.scrollTo(0, 0);
7
- }, [pathname]);
8
- return null;
9
- }
10
- export { ScrollToTop as S };
@@ -1,31 +0,0 @@
1
- import { m } from "framer-motion";
2
- import { Box } from "@mui/material";
3
- import { v as varContainer } from "../variants/container.js";
4
- import { jsx } from "react/jsx-runtime";
5
- function MotionContainer({
6
- animate,
7
- action = false,
8
- children,
9
- ...other
10
- }) {
11
- if (action) {
12
- return /* @__PURE__ */ jsx(Box, {
13
- component: m.div,
14
- initial: false,
15
- animate: animate ? "animate" : "exit",
16
- variants: varContainer(),
17
- ...other,
18
- children
19
- });
20
- }
21
- return /* @__PURE__ */ jsx(Box, {
22
- component: m.div,
23
- initial: "initial",
24
- animate: "animate",
25
- exit: "exit",
26
- variants: varContainer(),
27
- ...other,
28
- children
29
- });
30
- }
31
- export { MotionContainer as M };
@@ -1,13 +0,0 @@
1
- import { LazyMotion } from "framer-motion";
2
- import { jsx } from "react/jsx-runtime";
3
- const loadFeatures = () => import("../features.js").then((res) => res.default);
4
- function MotionLazyContainer({
5
- children
6
- }) {
7
- return /* @__PURE__ */ jsx(LazyMotion, {
8
- strict: true,
9
- features: loadFeatures,
10
- children
11
- });
12
- }
13
- export { MotionLazyContainer as M };
@@ -1,2 +0,0 @@
1
- import { domMax } from "framer-motion";
2
- export { domMax as default } from "framer-motion";
@@ -1,20 +0,0 @@
1
- const varContainer = (props) => {
2
- const staggerIn = props?.staggerIn || 0.05;
3
- const delayIn = props?.staggerIn || 0.05;
4
- const staggerOut = props?.staggerIn || 0.05;
5
- return {
6
- animate: {
7
- transition: {
8
- staggerChildren: staggerIn,
9
- delayChildren: delayIn
10
- }
11
- },
12
- exit: {
13
- transition: {
14
- staggerChildren: staggerOut,
15
- staggerDirection: -1
16
- }
17
- }
18
- };
19
- };
20
- export { varContainer as v };
@@ -1,61 +0,0 @@
1
- import { v as varTranEnter, a as varTranExit } from "./transition.js";
2
- const varFade = (props) => {
3
- const distance = props?.distance || 120;
4
- const durationIn = props?.durationIn;
5
- const durationOut = props?.durationOut;
6
- const easeIn = props?.easeIn;
7
- const easeOut = props?.easeOut;
8
- return {
9
- in: {
10
- initial: { opacity: 0 },
11
- animate: { opacity: 1, transition: varTranEnter },
12
- exit: { opacity: 0, transition: varTranExit }
13
- },
14
- inUp: {
15
- initial: { y: distance, opacity: 0 },
16
- animate: { y: 0, opacity: 1, transition: varTranEnter({ durationIn, easeIn }) },
17
- exit: { y: distance, opacity: 0, transition: varTranExit({ durationOut, easeOut }) }
18
- },
19
- inDown: {
20
- initial: { y: -distance, opacity: 0 },
21
- animate: { y: 0, opacity: 1, transition: varTranEnter({ durationIn, easeIn }) },
22
- exit: { y: -distance, opacity: 0, transition: varTranExit({ durationOut, easeOut }) }
23
- },
24
- inLeft: {
25
- initial: { x: -distance, opacity: 0 },
26
- animate: { x: 0, opacity: 1, transition: varTranEnter({ durationIn, easeIn }) },
27
- exit: { x: -distance, opacity: 0, transition: varTranExit({ durationOut, easeOut }) }
28
- },
29
- inRight: {
30
- initial: { x: distance, opacity: 0 },
31
- animate: { x: 0, opacity: 1, transition: varTranEnter({ durationIn, easeIn }) },
32
- exit: { x: distance, opacity: 0, transition: varTranExit({ durationOut, easeOut }) }
33
- },
34
- out: {
35
- initial: { opacity: 1 },
36
- animate: { opacity: 0, transition: varTranEnter({ durationIn, easeIn }) },
37
- exit: { opacity: 1, transition: varTranExit({ durationOut, easeOut }) }
38
- },
39
- outUp: {
40
- initial: { y: 0, opacity: 1 },
41
- animate: { y: -distance, opacity: 0, transition: varTranEnter({ durationIn, easeIn }) },
42
- exit: { y: 0, opacity: 1, transition: varTranExit({ durationOut, easeOut }) }
43
- },
44
- outDown: {
45
- initial: { y: 0, opacity: 1 },
46
- animate: { y: distance, opacity: 0, transition: varTranEnter({ durationIn, easeIn }) },
47
- exit: { y: 0, opacity: 1, transition: varTranExit({ durationOut, easeOut }) }
48
- },
49
- outLeft: {
50
- initial: { x: 0, opacity: 1 },
51
- animate: { x: -distance, opacity: 0, transition: varTranEnter({ durationIn, easeIn }) },
52
- exit: { x: 0, opacity: 1, transition: varTranExit({ durationOut, easeOut }) }
53
- },
54
- outRight: {
55
- initial: { x: 0, opacity: 1 },
56
- animate: { x: distance, opacity: 0, transition: varTranEnter({ durationIn, easeIn }) },
57
- exit: { x: 0, opacity: 1, transition: varTranExit({ durationOut, easeOut }) }
58
- }
59
- };
60
- };
61
- export { varFade as v };
@@ -1,16 +0,0 @@
1
- const varTranHover = (props) => {
2
- const duration = props?.duration || 0.32;
3
- const ease = props?.ease || [0.43, 0.13, 0.23, 0.96];
4
- return { duration, ease };
5
- };
6
- const varTranEnter = (props) => {
7
- const duration = props?.durationIn || 0.64;
8
- const ease = props?.easeIn || [0.43, 0.13, 0.23, 0.96];
9
- return { duration, ease };
10
- };
11
- const varTranExit = (props) => {
12
- const duration = props?.durationOut || 0.48;
13
- const ease = props?.easeOut || [0.43, 0.13, 0.23, 0.96];
14
- return { duration, ease };
15
- };
16
- export { varTranExit as a, varTranHover as b, varTranEnter as v };
@@ -1,52 +0,0 @@
1
- import { useModuleDictionary, useEnvironment, getPropertyByString } from "@m4l/core";
2
- import React from "react";
3
- import { I as Icon } from "../../Icon/index.js";
4
- import { jsx } from "react/jsx-runtime";
5
- function BooleanFormatter(props) {
6
- const {
7
- presentationType,
8
- value,
9
- Component = React.Fragment
10
- } = props;
11
- const {
12
- getLabel
13
- } = useModuleDictionary();
14
- const {
15
- host_static_assets,
16
- environment_assets
17
- } = useEnvironment();
18
- const final_value = value ?? false;
19
- const srcCheckTrue = `${host_static_assets}/${environment_assets}/frontend/components/data_grid/components/boolean_formatter/assets/icons/check_true.svg`;
20
- const srcCheckFalse = `${host_static_assets}/${environment_assets}/frontend/components/data_grid/components/boolean_formatter/assets/icons/check_false.svg`;
21
- if (presentationType === "string_yes_no") {
22
- return /* @__PURE__ */ jsx(Component, {
23
- children: final_value ? getLabel("formatters.boolean_yes") : getLabel("formatters.boolean_no")
24
- });
25
- }
26
- if (presentationType === "string_true_false") {
27
- return /* @__PURE__ */ jsx(Component, {
28
- children: final_value ? getLabel("formatters.boolean_true") : getLabel("formatters.boolean_false")
29
- });
30
- }
31
- return /* @__PURE__ */ jsx(Component, {
32
- children: /* @__PURE__ */ jsx(Icon, {
33
- src: final_value ? srcCheckTrue : srcCheckFalse,
34
- bgColor: "action.disabled"
35
- })
36
- });
37
- }
38
- function columnBooleanFormatter(props) {
39
- const {
40
- fieldValue,
41
- presentationType,
42
- Component = React.Fragment
43
- } = props;
44
- return (obProps) => {
45
- return /* @__PURE__ */ jsx(BooleanFormatter, {
46
- presentationType,
47
- value: getPropertyByString(obProps, fieldValue),
48
- Component
49
- });
50
- };
51
- }
52
- export { BooleanFormatter as B, columnBooleanFormatter as c };
@@ -1,66 +0,0 @@
1
- import React from "react";
2
- import { useEnvironment, useHostTools, getPropertyByString } from "@m4l/core";
3
- import "../../Icon/index.js";
4
- import "@mui/material/styles";
5
- import { jsx, Fragment } from "react/jsx-runtime";
6
- function DateFormatter(props) {
7
- const {
8
- presentationType,
9
- value,
10
- format,
11
- Component = React.Fragment
12
- } = props;
13
- const {
14
- dfnsFormat
15
- } = useEnvironment();
16
- const {
17
- formatDate
18
- } = useHostTools();
19
- let finalFormat = format || dfnsFormat.datetime_format;
20
- let result;
21
- let resultDate;
22
- if (value === void 0 || value === null) {
23
- return /* @__PURE__ */ jsx(Fragment, {
24
- children: "-"
25
- });
26
- }
27
- switch (presentationType) {
28
- case "datetime":
29
- finalFormat = format || dfnsFormat.datetime_format;
30
- break;
31
- case "date":
32
- finalFormat = format || dfnsFormat.date_format;
33
- break;
34
- case "time":
35
- finalFormat = format || dfnsFormat.time_format;
36
- break;
37
- }
38
- try {
39
- if (typeof value === "number" || typeof value === "string") {
40
- resultDate = new Date(value);
41
- } else {
42
- resultDate = value;
43
- }
44
- result = formatDate(resultDate, finalFormat);
45
- } catch (e) {
46
- result = "err_typing";
47
- }
48
- return /* @__PURE__ */ jsx(Component, {
49
- children: result
50
- });
51
- }
52
- function columnDateFormatter(props) {
53
- const {
54
- fieldValue,
55
- presentationType,
56
- Component = React.Fragment
57
- } = props;
58
- return (obProps) => {
59
- return /* @__PURE__ */ jsx(DateFormatter, {
60
- presentationType,
61
- value: getPropertyByString(obProps, fieldValue),
62
- Component
63
- });
64
- };
65
- }
66
- export { DateFormatter as D, columnDateFormatter as c };
@@ -1,112 +0,0 @@
1
- import React from "react";
2
- import { jsx, Fragment } from "react/jsx-runtime";
3
- import { getPropertyByString } from "@m4l/core";
4
- import "../Icon/index.js";
5
- import "@mui/material/styles";
6
- function UncertaintyFormatter(props) {
7
- const {
8
- value,
9
- unit,
10
- symbol,
11
- Component = React.Fragment
12
- } = props;
13
- if (value === void 0 || value === null || !Array.isArray(value)) {
14
- return /* @__PURE__ */ jsx(Fragment, {
15
- children: ""
16
- });
17
- }
18
- let result = "";
19
- value.map((obj, idx) => {
20
- const cmc_min_closed = obj.cmc_min_closed != true ? "<" : "\u2264";
21
- const cmc_max_closed = obj.cmc_max_closed != true ? "<" : "\u2264";
22
- result = result.concat(`${idx > 0 ? " " : ""}`, obj.cmc_min !== obj.cmc_max ? `[${obj.cmc_min}${unit} ${cmc_min_closed} ${symbol} ${cmc_max_closed} ${obj.cmc_max}${unit} \xB1 ${obj.cmc_uncertainty}]` : `[${obj.cmc_min}${unit} \xB1 ${obj.cmc_uncertainty}]`);
23
- });
24
- return /* @__PURE__ */ jsx(Component, {
25
- children: result
26
- });
27
- }
28
- function PointsFormatter(props) {
29
- const {
30
- value,
31
- unit,
32
- Component = React.Fragment
33
- } = props;
34
- console.log("points", value);
35
- if (value === void 0 || value === null || !Array.isArray(value)) {
36
- return /* @__PURE__ */ jsx(Fragment, {
37
- children: "[]"
38
- });
39
- }
40
- let result = "";
41
- value.map((point) => {
42
- if (point) {
43
- console.log("point", point);
44
- result = result.concat(`[${point}${unit}]`);
45
- }
46
- });
47
- return /* @__PURE__ */ jsx(Component, {
48
- children: result
49
- });
50
- }
51
- function PriceFormatter(props) {
52
- const {
53
- value,
54
- Component = React.Fragment
55
- } = props;
56
- return /* @__PURE__ */ jsx(Component, {
57
- children: `${value}$Cop`
58
- });
59
- }
60
- function getFormattersComponentsDictionary() {
61
- return ["formatters"];
62
- }
63
- const defaultFormattersDictionary = {
64
- pager: {
65
- boolean_yes: "Yes",
66
- boolean_no: "No",
67
- boolean_true: "True",
68
- boolean_false: "False"
69
- }
70
- };
71
- function columnUncertaintyFormatter(props) {
72
- const {
73
- fieldUnit,
74
- fieldValue,
75
- fieldSymbol,
76
- Component
77
- } = props;
78
- return (obProps) => {
79
- return /* @__PURE__ */ jsx(UncertaintyFormatter, {
80
- Component,
81
- value: getPropertyByString(obProps, fieldValue),
82
- unit: getPropertyByString(obProps, fieldUnit),
83
- symbol: getPropertyByString(obProps, fieldSymbol)
84
- });
85
- };
86
- }
87
- function columnPointsFormatter(props) {
88
- const {
89
- fieldUnit,
90
- fieldValue,
91
- Component
92
- } = props;
93
- return (obProps) => {
94
- return /* @__PURE__ */ jsx(PointsFormatter, {
95
- Component,
96
- value: getPropertyByString(obProps, fieldValue),
97
- unit: getPropertyByString(obProps, fieldUnit)
98
- });
99
- };
100
- }
101
- function columnNestedValueFormatter(props) {
102
- const {
103
- fieldValue,
104
- Component = React.Fragment
105
- } = props;
106
- return (obProps) => {
107
- return /* @__PURE__ */ jsx(Component, {
108
- children: getPropertyByString(obProps, fieldValue) + ""
109
- });
110
- };
111
- }
112
- export { PointsFormatter as P, UncertaintyFormatter as U, PriceFormatter as a, columnPointsFormatter as b, columnUncertaintyFormatter as c, defaultFormattersDictionary as d, columnNestedValueFormatter as e, getFormattersComponentsDictionary as g };
@@ -1,61 +0,0 @@
1
- import { useEffect } from "react";
2
- import { useForm, FormProvider as FormProvider$1 } from "react-hook-form";
3
- import { o } from "../../../node_modules.js";
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
- paddingTop: theme.spacing(1),
11
- marginBottom: theme.spacing(1),
12
- flexDirection: "column",
13
- width: "100%",
14
- overflow: "scroll"
15
- }));
16
- function FormProvider(props) {
17
- const {
18
- children,
19
- onSubmit,
20
- values,
21
- validationSchema,
22
- statusLoad = "ready"
23
- } = props;
24
- const methods = useForm({
25
- resolver: o(validationSchema),
26
- defaultValues: values
27
- });
28
- useEffect(() => {
29
- console.log("useEffect FormProvider reload_values_provider===", statusLoad);
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$1, {
53
- ...methods,
54
- children: /* @__PURE__ */ jsx(WrapperFormProvider, {
55
- id: "formProvider",
56
- onSubmit: methods.handleSubmit(onSubmit),
57
- children
58
- })
59
- });
60
- }
61
- export { FormProvider as F };