@m4l/components 0.1.24 → 0.1.26

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 (44) hide show
  1. package/components/CommonActions/components/ActionCancel/{index.465be070.js → index.6736b782.js} +1 -1
  2. package/components/CommonActions/components/ActionFormCancel/{index.0deaba48.js → index.281ee166.js} +2 -2
  3. package/components/CommonActions/components/ActionIntro/{index.235ecbe2.js → index.4665a611.js} +1 -1
  4. package/components/CommonActions/components/Actions/{index.798c6aee.js → index.cd7b2671.js} +7 -7
  5. package/components/DataGrid/{index.cb62609c.js → index.2caf6231.js} +3 -3
  6. package/components/DynamicFilter/{index.549adc46.js → index.f2377369.js} +13 -13
  7. package/components/LanguagePopover/styles.d.ts +2 -0
  8. package/components/ModalDialog/{index.0340fb86.js → index.bee344a5.js} +2 -2
  9. package/components/ObjectLogs/{index.b1dcc4db.js → index.6b6f95e6.js} +3 -3
  10. package/components/Page/index.4237c241.js +25 -0
  11. package/components/Period/index.a112ce37.js +175 -0
  12. package/components/Period/styles.d.ts +2 -2
  13. package/components/Period/types.d.ts +4 -1
  14. package/components/hook-form/RHFCheckbox/index.6dcec9e2.js +58 -0
  15. package/components/hook-form/RHFDateTime/index.9231a7c7.js +81 -0
  16. package/components/hook-form/RHFDateTime/subcomponents/Skeleton/index.d.ts +3 -0
  17. package/components/hook-form/RHFDateTime/{styles.d.ts → subcomponents/Skeleton/styles.d.ts} +0 -0
  18. package/components/hook-form/RHFDateTime/subcomponents/Skeleton/types.d.ts +2 -0
  19. package/components/hook-form/RHFPeriod/index.979d0898.js +51 -0
  20. package/components/hook-form/RHFPeriod/types.d.ts +3 -3
  21. package/components/hook-form/RHFTextField/index.ba2a8f67.js +129 -0
  22. package/components/hook-form/RHFTextField/index.d.ts +1 -1
  23. package/components/hook-form/RHFTextField/subcomponents/Skeleton/styles.d.ts +1 -1
  24. package/components/hook-form/RHFTextField/subcomponents/Skeleton/types.d.ts +2 -4
  25. package/components/hook-form/RHFTextField/types.d.ts +1 -0
  26. package/components/hook-form/RHFUpload/RHFUploadImage/components/UploadImage/styles.d.ts +1 -1
  27. package/components/hook-form/RHFUpload/RHFUploadImage/components/UploadImage/subcomponents/Skeleton/index.d.ts +2 -0
  28. package/components/hook-form/RHFUpload/RHFUploadImage/components/UploadImage/subcomponents/Skeleton/styles.d.ts +2 -0
  29. package/components/hook-form/RHFUpload/index.6347159a.js +258 -0
  30. package/components/mui_extended/Button/{index.ae47764f.js → index.52d18aea.js} +1 -1
  31. package/components/mui_extended/Pager/{index.298730a1.js → index.951b6975.js} +1 -1
  32. package/components/mui_extended/Popover/index.4da8587a.js +252 -0
  33. package/contexts/ModalContext/{index.73ab6934.js → index.5388dfd5.js} +3 -3
  34. package/hooks/useModal/{index.f2492b34.js → index.3b1ff084.js} +1 -1
  35. package/index.js +20 -20
  36. package/package.json +1 -1
  37. package/components/Page/index.fc660ee5.js +0 -27
  38. package/components/Period/index.05c1c5e0.js +0 -159
  39. package/components/hook-form/RHFCheckbox/index.6a40e25f.js +0 -55
  40. package/components/hook-form/RHFDateTime/index.5ed774e3.js +0 -66
  41. package/components/hook-form/RHFPeriod/index.6c6733eb.js +0 -45
  42. package/components/hook-form/RHFTextField/index.bab2a2cf.js +0 -113
  43. package/components/hook-form/RHFUpload/index.56e2e277.js +0 -239
  44. package/components/mui_extended/Popover/index.b6e4392a.js +0 -218
@@ -0,0 +1,252 @@
1
+ import { useState as d, useEffect as I } from "react";
2
+ import { Popover as x, styled as h, Stack as O, MenuItem as S } from "@mui/material";
3
+ import { I as P } from "../../Image/index.c9da2d5a.js";
4
+ import { useLocales as v } from "@m4l/graphics";
5
+ import { useEnvironment as L, useNetwork as k } from "@m4l/core";
6
+ import "../../Icon/index.f569765b.js";
7
+ import { styled as C } from "@mui/material/styles";
8
+ import { jsxs as m, jsx as i, Fragment as R } from "react/jsx-runtime";
9
+ import "../Accordion/index.49f5df8e.js";
10
+ import "../Avatar/index.dadb0528.js";
11
+ import "react-router-dom";
12
+ import "@mui/material/Button";
13
+ import { C as E } from "../CircularProgress/index.ad569afd.js";
14
+ import "@mui/lab";
15
+ import { I as N } from "../Button/index.52d18aea.js";
16
+ import "../../CommonActions/components/Actions/index.cd7b2671.js";
17
+ import "../Pager/index.951b6975.js";
18
+ import "../Tab/index.e0653a0a.js";
19
+ const y = C("span")(({
20
+ arrowType: t,
21
+ theme: n
22
+ }) => {
23
+ const o = `solid 1px ${n.palette.grey[50012]}`, a = {
24
+ borderRadius: "0 0 3px 0",
25
+ top: -6,
26
+ borderBottom: o,
27
+ borderRight: o
28
+ }, l = {
29
+ borderRadius: "3px 0 0 0",
30
+ bottom: -6,
31
+ borderTop: o,
32
+ borderLeft: o
33
+ }, s = {
34
+ borderRadius: "0 3px 0 0",
35
+ left: -6,
36
+ borderTop: o,
37
+ borderRight: o
38
+ }, r = {
39
+ borderRadius: "0 0 0 3px",
40
+ right: -6,
41
+ borderBottom: o,
42
+ borderLeft: o
43
+ };
44
+ return {
45
+ display: "none",
46
+ [n.breakpoints.up("sm")]: {
47
+ zIndex: 1,
48
+ width: 12,
49
+ height: 12,
50
+ content: "''",
51
+ position: "absolute",
52
+ display: "block",
53
+ transform: "rotate(-135deg)",
54
+ background: n.palette.background.paper
55
+ },
56
+ ...t === "top-left" && {
57
+ ...a,
58
+ left: 20
59
+ },
60
+ ...t === "top-center" && {
61
+ ...a,
62
+ left: 0,
63
+ right: 0,
64
+ margin: "auto"
65
+ },
66
+ ...t === "top-right" && {
67
+ ...a,
68
+ right: 20
69
+ },
70
+ ...t === "bottom-left" && {
71
+ ...l,
72
+ left: 20
73
+ },
74
+ ...t === "bottom-center" && {
75
+ ...l,
76
+ left: 0,
77
+ right: 0,
78
+ margin: "auto"
79
+ },
80
+ ...t === "bottom-right" && {
81
+ ...l,
82
+ right: 20
83
+ },
84
+ ...t === "left-top" && {
85
+ ...s,
86
+ top: 20
87
+ },
88
+ ...t === "left-center" && {
89
+ ...s,
90
+ top: 0,
91
+ bottom: 0,
92
+ margin: "auto"
93
+ },
94
+ ...t === "left-bottom" && {
95
+ ...s,
96
+ bottom: 20
97
+ },
98
+ ...t === "right-top" && {
99
+ ...r,
100
+ top: 20
101
+ },
102
+ ...t === "right-center" && {
103
+ ...r,
104
+ top: 0,
105
+ bottom: 0,
106
+ margin: "auto"
107
+ },
108
+ ...t === "right-bottom" && {
109
+ ...r,
110
+ bottom: 20
111
+ }
112
+ };
113
+ });
114
+ function _({
115
+ children: t,
116
+ arrowType: n = "top-right",
117
+ sx: p,
118
+ className: c,
119
+ ...o
120
+ }) {
121
+ return /* @__PURE__ */ m(x, {
122
+ className: `m4l_popover ${c || ""}`,
123
+ anchorOrigin: {
124
+ vertical: "bottom",
125
+ horizontal: "right"
126
+ },
127
+ transformOrigin: {
128
+ vertical: "top",
129
+ horizontal: "right"
130
+ },
131
+ PaperProps: {
132
+ sx: {
133
+ p: 1,
134
+ overflow: "inherit",
135
+ ...p
136
+ }
137
+ },
138
+ ...o,
139
+ children: [n !== "no-arrow" && /* @__PURE__ */ i(y, {
140
+ arrowType: n
141
+ }), t]
142
+ });
143
+ }
144
+ const z = h("span")(({
145
+ theme: t
146
+ }) => ({
147
+ marginLeft: t.spacing(1)
148
+ })), B = h("div")(({
149
+ theme: t
150
+ }) => ({
151
+ padding: t.spacing(0.75, 0),
152
+ margin: t.spacing(0, 1.25)
153
+ })), M = h("div")(() => ({
154
+ display: "flex",
155
+ flexDirection: "column"
156
+ }));
157
+ function T() {
158
+ const {
159
+ currentLocale: t,
160
+ onChangeLocale: n
161
+ } = v(), {
162
+ domain_token: p
163
+ } = L(), {
164
+ networkOperation: c
165
+ } = k(), [o, a] = d(null), [l, s] = d(!1), [r, f] = d([]), b = (e) => {
166
+ console.log("handleOpen", r, l), a(e.currentTarget);
167
+ }, u = () => {
168
+ a(null);
169
+ };
170
+ return I(() => {
171
+ let e = !0;
172
+ if (!(o === null || l || r.length > 0))
173
+ return s(!0), c({
174
+ method: "GET",
175
+ endPoint: "na/locales",
176
+ parms: {
177
+ domain_token: p
178
+ }
179
+ }).then((g) => {
180
+ console.log("Response", g.data), e && f(g.data);
181
+ }).finally(() => {
182
+ s(!1);
183
+ }), function() {
184
+ e = !1;
185
+ };
186
+ }, [o]), console.log("Render lang", r, l), /* @__PURE__ */ m(R, {
187
+ children: [/* @__PURE__ */ i(N, {
188
+ className: "m4l_language_popover",
189
+ onClick: b,
190
+ sx: {
191
+ width: 40,
192
+ height: 40,
193
+ ...o && {
194
+ bgcolor: "action.selected"
195
+ }
196
+ },
197
+ src: t?.url_icon || "",
198
+ alt: t?.name,
199
+ width: "24px",
200
+ height: "24px",
201
+ skeletonVariant: "circle",
202
+ tooltip: "dddd"
203
+ }), /* @__PURE__ */ i(_, {
204
+ arrowType: "top-right",
205
+ open: Boolean(o),
206
+ anchorEl: o,
207
+ anchorOrigin: {
208
+ vertical: "bottom",
209
+ horizontal: "right"
210
+ },
211
+ onClose: u,
212
+ sx: {
213
+ mt: 1.5,
214
+ ml: 0.75,
215
+ width: 180,
216
+ rowGap: "100px",
217
+ "& .MuiMenuItem-root": {
218
+ px: 1,
219
+ typography: "body2",
220
+ borderRadius: 0.75
221
+ }
222
+ },
223
+ children: /* @__PURE__ */ m(M, {
224
+ children: [r.length === 0 && /* @__PURE__ */ i(B, {
225
+ children: /* @__PURE__ */ i(E, {
226
+ size: "20px"
227
+ })
228
+ }), r.length > 0 && /* @__PURE__ */ i(O, {
229
+ spacing: 0.75,
230
+ children: r.map((e) => /* @__PURE__ */ m(S, {
231
+ selected: e.lang === t?.lang && e?.script === t?.script && e?.region === t?.region,
232
+ onClick: () => {
233
+ n(e), u();
234
+ },
235
+ children: [/* @__PURE__ */ i(P, {
236
+ alt: e.name,
237
+ src: e.url_icon,
238
+ width: "24px",
239
+ height: "24px"
240
+ }), /* @__PURE__ */ i(z, {
241
+ children: e.name
242
+ })]
243
+ }, e.lang || e.script || e.region))
244
+ })]
245
+ })
246
+ })]
247
+ });
248
+ }
249
+ export {
250
+ T as L,
251
+ _ as P
252
+ };
@@ -4,9 +4,9 @@ import { Typography as M } from "@mui/material";
4
4
  import { styled as l } from "@mui/material/styles";
5
5
  import { B as I } from "../../components/mui_extended/BoxIcon/index.e638ecc8.js";
6
6
  import { jsx as t, jsxs as p, Fragment as _ } from "react/jsx-runtime";
7
- import { M as k } from "../../components/ModalDialog/index.0340fb86.js";
8
- import { A as $ } from "../../components/CommonActions/components/ActionIntro/index.235ecbe2.js";
9
- import { A as b } from "../../components/CommonActions/components/ActionCancel/index.465be070.js";
7
+ import { M as k } from "../../components/ModalDialog/index.bee344a5.js";
8
+ import { A as $ } from "../../components/CommonActions/components/ActionIntro/index.4665a611.js";
9
+ import { A as b } from "../../components/CommonActions/components/ActionCancel/index.6736b782.js";
10
10
  import { b as A } from "../../utils/index.214d9542.js";
11
11
  const j = l("div")(() => ({
12
12
  display: "flex",
@@ -1,5 +1,5 @@
1
1
  import { useContext as t } from "react";
2
- import { M as e } from "../../contexts/ModalContext/index.73ab6934.js";
2
+ import { M as e } from "../../contexts/ModalContext/index.5388dfd5.js";
3
3
  function s() {
4
4
  const o = t(e);
5
5
  if (!o)
package/index.js CHANGED
@@ -11,44 +11,44 @@ import { R as k, g as G } from "./components/hook-form/RHFAutocomplete/index.5ee
11
11
  import "react";
12
12
  import { I as V } from "./components/Image/index.c9da2d5a.js";
13
13
  import "lodash/debounce";
14
- import { R as W } from "./components/hook-form/RHFCheckbox/index.6a40e25f.js";
15
- import { R as J } from "./components/hook-form/RHFDateTime/index.5ed774e3.js";
14
+ import { R as W } from "./components/hook-form/RHFCheckbox/index.6dcec9e2.js";
16
15
  import "@mui/x-date-pickers";
17
- import { R as Q, a as X } from "./components/hook-form/RHFTextField/index.bab2a2cf.js";
16
+ import { R as J } from "./components/hook-form/RHFDateTime/index.9231a7c7.js";
17
+ import { R as Q, a as X } from "./components/hook-form/RHFTextField/index.ba2a8f67.js";
18
18
  import { I as Z } from "./components/Icon/index.f569765b.js";
19
- import { R as $ } from "./components/hook-form/RHFPeriod/index.6c6733eb.js";
19
+ import { R as $ } from "./components/hook-form/RHFPeriod/index.979d0898.js";
20
20
  import { E as ro } from "./components/ErrorLabel/index.c8615f16.js";
21
- import { P as ao, g as eo } from "./components/Period/index.05c1c5e0.js";
22
- import { b as so, M as io, d as po, g as no } from "./components/CommonActions/components/Actions/index.798c6aee.js";
21
+ import { P as ao, g as eo } from "./components/Period/index.a112ce37.js";
22
+ import { b as so, M as io, d as po, g as no } from "./components/CommonActions/components/Actions/index.cd7b2671.js";
23
23
  import "@mui/material/Button";
24
- import { M as xo, a as fo } from "./contexts/ModalContext/index.73ab6934.js";
24
+ import { M as xo, a as fo } from "./contexts/ModalContext/index.5388dfd5.js";
25
25
  import "@mui/lab";
26
26
  import "lodash/isString";
27
27
  import "react-dropzone";
28
- import { R as go } from "./components/hook-form/RHFUpload/index.56e2e277.js";
28
+ import { R as go } from "./components/hook-form/RHFUpload/index.6347159a.js";
29
29
  import { A as uo } from "./components/mui_extended/Accordion/index.49f5df8e.js";
30
30
  import { A as yo } from "./components/mui_extended/Avatar/index.dadb0528.js";
31
- import { B as Ao, L as Po } from "./components/mui_extended/Button/index.ae47764f.js";
32
- import { L as Lo, P as Ho } from "./components/mui_extended/Popover/index.b6e4392a.js";
33
- import { P as Mo, g as bo } from "./components/mui_extended/Pager/index.298730a1.js";
31
+ import { B as Ao, L as Po } from "./components/mui_extended/Button/index.52d18aea.js";
32
+ import { L as Lo, P as Ho } from "./components/mui_extended/Popover/index.4da8587a.js";
33
+ import { P as Mo, g as bo } from "./components/mui_extended/Pager/index.951b6975.js";
34
34
  import { T as Io } from "./components/mui_extended/Tab/index.e0653a0a.js";
35
- import { D as So, N as Eo, T as No, g as ho } from "./components/DataGrid/index.cb62609c.js";
35
+ import { D as So, N as Eo, T as No, g as ho } from "./components/DataGrid/index.2caf6231.js";
36
36
  import "react-dnd";
37
37
  import "react-dnd-html5-backend";
38
38
  import "@m4l/graphics";
39
39
  import { S as Uo } from "./components/ScrollBar/index.39eeb2de.js";
40
- import { D as ko, d as Go, g as zo } from "./components/DynamicFilter/index.549adc46.js";
40
+ import { D as ko, d as Go, g as zo } from "./components/DynamicFilter/index.f2377369.js";
41
41
  import "simplebar/dist/simplebar.min.css";
42
42
  import { R as wo } from "./components/contexts/RHFormContext/index.33dba822.js";
43
43
  import "yup";
44
44
  import "./react-draggable.20e95c61.js";
45
- import { M as qo, d as Jo, g as Ko } from "./components/ModalDialog/index.0340fb86.js";
45
+ import { M as qo, d as Jo, g as Ko } from "./components/ModalDialog/index.bee344a5.js";
46
46
  import { R as Xo } from "./components/Resizeable/index.45995d2b.js";
47
47
  import { N as Zo, d as _o, g as $o } from "./components/NoItemSelected/index.9609a7f7.js";
48
- import { O as rr, d as tr, g as ar } from "./components/ObjectLogs/index.b1dcc4db.js";
48
+ import { O as rr, d as tr, g as ar } from "./components/ObjectLogs/index.6b6f95e6.js";
49
49
  import "./react-json-view.f56a7f8e.js";
50
50
  import { P as mr } from "./components/PaperForm/index.3f8c7ef2.js";
51
- import { H as ir } from "./components/Page/index.fc660ee5.js";
51
+ import { H as ir } from "./components/Page/index.4237c241.js";
52
52
  import { P as nr } from "./components/PropertyValue/index.ab3dd7e9.js";
53
53
  import "./react-splitter-layout.7810ac1b.js";
54
54
  import { S as xr } from "./components/SplitLayout/index.4032673d.js";
@@ -70,14 +70,14 @@ import { T as Wr } from "./components/mui_extended/Typography/index.e5494696.js"
70
70
  import { B as Jr, c as Kr } from "./components/formatters/BooleanFormatter/index.3ec56305.js";
71
71
  import { D as Xr, c as Yr } from "./components/formatters/DateFormatter/index.08d8823b.js";
72
72
  import { P as _r, a as $r, U as ot, e as rt, b as tt, c as at, d as et, g as mt } from "./components/formatters/index.6959c2de.js";
73
- import { A as it } from "./components/CommonActions/components/ActionCancel/index.465be070.js";
74
- import { A as nt } from "./components/CommonActions/components/ActionIntro/index.235ecbe2.js";
75
- import { A as xt } from "./components/CommonActions/components/ActionFormCancel/index.0deaba48.js";
73
+ import { A as it } from "./components/CommonActions/components/ActionCancel/index.6736b782.js";
74
+ import { A as nt } from "./components/CommonActions/components/ActionIntro/index.4665a611.js";
75
+ import { A as xt } from "./components/CommonActions/components/ActionFormCancel/index.281ee166.js";
76
76
  import { A as lt } from "./components/CommonActions/components/ActionFormIntro/index.ca4d2674.js";
77
77
  import { L as gt } from "./components/Loadable/index.f5518558.js";
78
78
  import { S as ut } from "./components/ScrollToTop/index.e06f98f6.js";
79
79
  import { u as yt } from "./hooks/useFormAddEdit/index.d4845f1a.js";
80
- import { u as At } from "./hooks/useModal/index.f2492b34.js";
80
+ import { u as At } from "./hooks/useModal/index.3b1ff084.js";
81
81
  import { L as Ct } from "./assets/Logo/index.228dcb5a.js";
82
82
  import "./utils/index.214d9542.js";
83
83
  import "./react-data-grid.d46d625e.js";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@m4l/components",
3
- "version": "0.1.24",
3
+ "version": "0.1.26",
4
4
  "license": "UNLICENSED",
5
5
  "dependencies": {
6
6
  "@m4l/core": "*",
@@ -1,27 +0,0 @@
1
- import { Helmet as a } from "react-helmet-async";
2
- import { useLocales as c } from "@m4l/graphics";
3
- import { useModuleSkeleton as u } from "@m4l/core";
4
- import { jsxs as t, Fragment as d, jsx as r } from "react/jsx-runtime";
5
- const p = (l) => {
6
- const {
7
- children: o,
8
- title: n,
9
- meta: m,
10
- subtitle: e
11
- } = l, {
12
- currentLang: s
13
- } = c(), i = u();
14
- return /* @__PURE__ */ t(d, {
15
- children: [!i && /* @__PURE__ */ t(a, {
16
- children: [/* @__PURE__ */ r("title", {
17
- children: `${n}${e ? ` | ${e}` : ""} `
18
- }), /* @__PURE__ */ r("html", {
19
- lang: s.value
20
- }), m]
21
- }), o]
22
- });
23
- };
24
- p.displayName = "Page";
25
- export {
26
- p as H
27
- };
@@ -1,159 +0,0 @@
1
- import { useModuleDictionary as Y, useModuleSkeleton as R, useEnvironment as T } from "@m4l/core";
2
- import { styled as a, Skeleton as d, Autocomplete as $, TextField as x } from "@mui/material";
3
- import { useMemo as D } from "react";
4
- import { I as v } from "../Icon/index.f569765b.js";
5
- import { jsxs as u, jsx as n } from "react/jsx-runtime";
6
- import { g as O } from "../CommonActions/components/Actions/index.798c6aee.js";
7
- import "@mui/material/Button";
8
- import "react-hook-form";
9
- import "react-router-dom";
10
- import "../../contexts/ModalContext/index.73ab6934.js";
11
- import "@mui/lab";
12
- const S = a("div")(({
13
- theme: t,
14
- error: s
15
- }) => ({
16
- display: "flex",
17
- width: "100%",
18
- height: "auto",
19
- alignItems: "center",
20
- gap: t.spacing(1),
21
- border: s ? `1px solid ${t.palette.error.main}` : `1px solid ${t.palette.divider}`,
22
- padding: t.spacing(0.5, 1),
23
- borderRadius: "4px",
24
- "& .MuiAutocomplete-root, & .MuiTextField-root": {
25
- width: "100%"
26
- },
27
- "& .MuiAutocomplete-root .MuiTextField-root": {
28
- width: "100%"
29
- },
30
- "& .MuiTextField-root .MuiInput-input": {
31
- padding: "5px!important"
32
- }
33
- })), p = a("div")(({
34
- theme: t
35
- }) => ({
36
- width: "1px",
37
- height: "20px",
38
- backgroundColor: t.palette.divider
39
- })), P = a("div")(({
40
- theme: t
41
- }) => ({
42
- display: "flex",
43
- width: "auto",
44
- height: "37.5px",
45
- alignItems: "center",
46
- gap: t.spacing(1),
47
- border: `1px solid ${t.palette.divider}`,
48
- padding: t.spacing(0.5, 1),
49
- borderRadius: "4px"
50
- })), k = a("div")(({
51
- theme: t
52
- }) => ({
53
- ...t.typography.body2,
54
- width: "100%",
55
- display: "flex",
56
- textOverflow: "elipsis",
57
- overflow: "hidden",
58
- padding: "5px",
59
- textAlign: "left"
60
- })), w = a("div")(({
61
- theme: t
62
- }) => ({
63
- ...t.typography.body2,
64
- width: "70px",
65
- display: "flex",
66
- textOverflow: "elipsis",
67
- overflow: "hidden",
68
- padding: "5px",
69
- textAlign: "left"
70
- }));
71
- var i = /* @__PURE__ */ ((t) => (t[t.YEARS = 0] = "YEARS", t[t.MONTHS = 1] = "MONTHS", t[t.DAYS = 2] = "DAYS", t))(i || {});
72
- const F = (t) => t ? t.selPeriodTime ? t.selPeriodTime : t.years && t.years > 0 ? i.YEARS : t.months && t.months > 0 ? i.MONTHS : t.days && t.days > 0 ? i.DAYS : i.YEARS : i.YEARS, _ = (t) => t ? t.singleValue !== void 0 ? t.singleValue : t.years && t.years > 0 ? t.years : t.months && t.months > 0 ? t.months : t.days && t.days > 0 ? t.days : "" : "", z = (t) => {
73
- const {
74
- value: s,
75
- onChange: b,
76
- error: A = !1,
77
- readOnly: M = !1
78
- } = t, {
79
- getLabel: l
80
- } = Y(), C = R(), c = F(s), g = _(s), f = (e, r) => {
81
- const o = {
82
- selPeriodTime: e,
83
- singleValue: r
84
- };
85
- r !== "" && r > 0 && (o.years = 0, o.months = 0, o.days = 0, e === i.YEARS && (o.years = r), e === i.MONTHS && (o.months = r), e === i.DAYS && (o.days = r)), b(o);
86
- }, I = (e) => {
87
- e && f(e.id, g);
88
- }, {
89
- host_static_assets: h,
90
- environment_assets: m
91
- } = T(), y = D(() => [{
92
- id: 0,
93
- label: l("period.years")
94
- }, {
95
- id: 1,
96
- label: l("period.months")
97
- }, {
98
- id: 2,
99
- label: l("period.days")
100
- }], [l]);
101
- return C ? /* @__PURE__ */ u(P, {
102
- children: [/* @__PURE__ */ n(d, {
103
- variant: "rounded",
104
- width: "100%"
105
- }), /* @__PURE__ */ n(p, {}), /* @__PURE__ */ n(d, {
106
- variant: "rounded",
107
- width: "100%"
108
- }), /* @__PURE__ */ n(d, {
109
- variant: "circular",
110
- width: 20,
111
- sx: {
112
- minWidth: "20px",
113
- minHeight: "20px"
114
- }
115
- })]
116
- }) : (M && (s.selPeriodTime, s.singleValue, v, `${h}${m}`), /* @__PURE__ */ u(S, {
117
- error: A,
118
- children: [/* @__PURE__ */ n($, {
119
- options: y,
120
- value: y[c],
121
- disableClearable: !0,
122
- onChange: (e, r) => {
123
- I(r);
124
- },
125
- renderInput: (e) => /* @__PURE__ */ n(x, {
126
- ...e,
127
- fullWidth: !0,
128
- variant: "standard",
129
- SelectProps: {
130
- native: !0
131
- },
132
- InputProps: {
133
- disableUnderline: !0,
134
- ...e.InputProps
135
- },
136
- autoComplete: "off"
137
- }, `tx_async_${e.id}`)
138
- }), /* @__PURE__ */ n(p, {}), /* @__PURE__ */ n(x, {
139
- type: "number",
140
- variant: "standard",
141
- value: g,
142
- InputProps: {
143
- disableUnderline: !0
144
- },
145
- onChange: (e) => {
146
- f(c, e.target.value === "" ? "" : parseInt(e.target.value));
147
- }
148
- }), /* @__PURE__ */ n(v, {
149
- src: `${h}/${m}/frontend/components/period/assets/icons/clock.svg`
150
- })]
151
- }));
152
- };
153
- function B() {
154
- return ["period"].concat(O());
155
- }
156
- export {
157
- z as P,
158
- B as g
159
- };
@@ -1,55 +0,0 @@
1
- import { useFormContext as i, Controller as c } from "react-hook-form";
2
- import { styled as m } from "@mui/material/styles";
3
- import { styled as p, Skeleton as d, FormControlLabel as u, Checkbox as f } from "@mui/material";
4
- import { useModuleSkeleton as g } from "@m4l/core";
5
- import { jsx as e, jsxs as k, Fragment as x } from "react/jsx-runtime";
6
- const h = p("div")(() => ({
7
- display: "flex",
8
- justifyContent: "center",
9
- alignItems: "center",
10
- padding: "8px"
11
- })), C = () => /* @__PURE__ */ e(h, {
12
- children: /* @__PURE__ */ e(d, {
13
- variant: "rectangular"
14
- })
15
- }), y = m("p")(({
16
- theme: r
17
- }) => ({
18
- ...r.typography.caption,
19
- color: r.palette.error.main,
20
- marginRight: 14,
21
- marginLeft: 14
22
- }));
23
- function L({
24
- name: r,
25
- sizeCheck: n = "small",
26
- ...l
27
- }) {
28
- const {
29
- control: s
30
- } = i(), a = g();
31
- return /* @__PURE__ */ e(u, {
32
- control: /* @__PURE__ */ e(c, {
33
- name: r,
34
- control: s,
35
- render: ({
36
- field: t,
37
- fieldState: {
38
- error: o
39
- }
40
- }) => a ? /* @__PURE__ */ e(C, {}) : /* @__PURE__ */ k(x, {
41
- children: [/* @__PURE__ */ e(f, {
42
- size: n,
43
- ...t,
44
- checked: t.value
45
- }), o?.message && /* @__PURE__ */ e(y, {
46
- children: o?.message + ""
47
- })]
48
- })
49
- }),
50
- ...l
51
- });
52
- }
53
- export {
54
- L as R
55
- };
@@ -1,66 +0,0 @@
1
- import { useFormContext as u, Controller as c } from "react-hook-form";
2
- import { Skeleton as h, TextField as x } from "@mui/material";
3
- import { styled as g } from "@mui/material/styles";
4
- import { DateTimePicker as k } from "@mui/x-date-pickers";
5
- import { useModuleSkeleton as F, useEnvironment as v } from "@m4l/core";
6
- import { jsx as e } from "react/jsx-runtime";
7
- const C = g("div")(({
8
- theme: t
9
- }) => ({
10
- display: "flex",
11
- width: "100%",
12
- alignItems: "center",
13
- border: `1px solid ${t.palette.divider}`,
14
- padding: "12px 14px",
15
- borderRadius: t.spacing(1)
16
- }));
17
- function w(t) {
18
- const {
19
- name: i,
20
- autoComplete: a = "off",
21
- skeletonWidth: m = "100%",
22
- skeletonHeight: s = 14
23
- } = t, l = F(), {
24
- control: d
25
- } = u(), {
26
- dfnsFormat: {
27
- datetime_format: p,
28
- datetime_mask: f
29
- }
30
- } = v();
31
- return l ? /* @__PURE__ */ e(C, {
32
- children: /* @__PURE__ */ e(h, {
33
- variant: "text",
34
- width: m,
35
- height: s
36
- })
37
- }) : /* @__PURE__ */ e(c, {
38
- name: i,
39
- control: d,
40
- render: ({
41
- field: r,
42
- fieldState: {
43
- error: n
44
- }
45
- }) => /* @__PURE__ */ e(k, {
46
- ampm: !1,
47
- inputFormat: p,
48
- mask: f,
49
- label: "",
50
- value: r.value,
51
- onChange: (o) => {
52
- isNaN(o) ? r.onChange(void 0) : r.onChange(o);
53
- },
54
- renderInput: (o) => /* @__PURE__ */ e(x, {
55
- autoComplete: a,
56
- fullWidth: !0,
57
- error: !!n,
58
- helperText: n?.message,
59
- ...o
60
- })
61
- })
62
- });
63
- }
64
- export {
65
- w as R
66
- };