@m4l/components 0.1.20 → 0.1.21

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 (31) hide show
  1. package/components/CommonActions/components/ActionCancel/{index.3775989f.js → index.6649cc3d.js} +1 -1
  2. package/components/CommonActions/components/ActionFormCancel/{index.d69d9e0f.js → index.91f6c07d.js} +2 -2
  3. package/components/CommonActions/components/ActionIntro/{index.ca7b6952.js → index.c794e2a1.js} +1 -1
  4. package/components/CommonActions/components/Actions/{index.a908e4b9.js → index.03412615.js} +7 -7
  5. package/components/DataGrid/{index.5cbf0dd8.js → index.f2f0bf6a.js} +3 -3
  6. package/components/DynamicFilter/{index.8a571617.js → index.f0b93aef.js} +12 -12
  7. package/components/ModalDialog/{index.16024a4e.js → index.180937f5.js} +2 -2
  8. package/components/ObjectLogs/{index.ac2bfa48.js → index.6cd7fcc9.js} +3 -3
  9. package/components/Period/{index.497b8df4.js → index.5493563f.js} +2 -2
  10. package/components/contexts/RHFormContext/{index.f8241292.js → index.33dba822.js} +12 -12
  11. package/components/hook-form/RHFAutocomplete/index.ee3d9b3c.js +171 -0
  12. package/components/hook-form/RHFAutocomplete/types.d.ts +3 -1
  13. package/components/hook-form/RHFAutocompleteAsync/index.64cff02c.js +73 -0
  14. package/components/hook-form/RHFAutocompleteAsync/types.d.ts +2 -1
  15. package/components/hook-form/RHFPeriod/{index.e17b1c72.js → index.6f6cde6d.js} +1 -1
  16. package/components/hook-form/RHFUpload/{index.cbf11b68.js → index.d055f3be.js} +1 -1
  17. package/components/mui_extended/Button/{index.16591787.js → index.fbd38cd1.js} +4 -4
  18. package/components/mui_extended/Pager/{index.80c2f8a0.js → index.fd2bca74.js} +1 -1
  19. package/components/mui_extended/Popover/{index.305f2ea5.js → index.cb3125b4.js} +3 -3
  20. package/contexts/ModalContext/index.8f76fbe4.js +136 -0
  21. package/contexts/ModalContext/index.d.ts +1 -1
  22. package/hooks/useModal/index.44c5993b.js +11 -0
  23. package/hooks/useModal/index.d.ts +2 -1
  24. package/index.js +23 -23
  25. package/lodash.727eb847.js +117 -0
  26. package/package.json +3 -3
  27. package/components/hook-form/RHFAutocomplete/index.b7f11146.js +0 -146
  28. package/components/hook-form/RHFAutocompleteAsync/index.97a5a66e.js +0 -51
  29. package/contexts/ModalContext/index.699767c7.js +0 -150
  30. package/hooks/useModal/index.8201ccec.js +0 -6
  31. package/lodash.e09401f0.js +0 -32
@@ -0,0 +1,136 @@
1
+ import { createContext as x, useState as g } from "react";
2
+ import { useEnvironment as y, voidFunction as w } from "@m4l/core";
3
+ import { Typography as M } from "@mui/material";
4
+ import { styled as l } from "@mui/material/styles";
5
+ import { B as I } from "../../components/mui_extended/BoxIcon/index.e638ecc8.js";
6
+ import { jsx as t, jsxs as p, Fragment as _ } from "react/jsx-runtime";
7
+ import { M as k } from "../../components/ModalDialog/index.180937f5.js";
8
+ import { A as $ } from "../../components/CommonActions/components/ActionIntro/index.c794e2a1.js";
9
+ import { A as b } from "../../components/CommonActions/components/ActionCancel/index.6649cc3d.js";
10
+ import { b as A } from "../../utils/index.214d9542.js";
11
+ const j = l("div")(() => ({
12
+ display: "flex",
13
+ flexDirection: "column",
14
+ height: "100%"
15
+ })), D = l("div")(({
16
+ theme: n
17
+ }) => ({
18
+ display: "flex",
19
+ flexDirection: "column",
20
+ justifyContent: "center",
21
+ alignItems: "center",
22
+ gridGap: n.spacing(5),
23
+ flexGrow: 1,
24
+ [n.breakpoints.up("sm")]: {
25
+ display: "grid",
26
+ flexDirection: "row",
27
+ gridTemplateColumns: "1fr 1fr"
28
+ }
29
+ })), O = l("div")(({
30
+ theme: n,
31
+ variant: o
32
+ }) => ({
33
+ display: "flex",
34
+ justifyContent: "center",
35
+ alignItems: "center",
36
+ "& > span": {
37
+ background: o === "warning" ? n.palette.warning.main : o === "delete" ? n.palette.error.main : o === "info" ? n.palette.info.main : "theme.palette.text.primary"
38
+ }
39
+ })), B = l("div")(() => ({
40
+ display: "flex",
41
+ alignItems: "center"
42
+ })), E = (n) => {
43
+ const {
44
+ variant: o = "info",
45
+ msg: i = "Are you sure you want to perform this action? Once complete, the information will be deleted."
46
+ } = n, {
47
+ host_static_assets: r,
48
+ environment_assets: e
49
+ } = y(), c = `${r}/${e}/frontend/components/dialog/assets/icons/illustration_confirm_warning.svg`, m = `${r}/${e}/frontend/components/dialog/assets/icons/illustration_confirm_danger.svg`, s = `${r}/${e}/frontend/components/dialog/assets/icons/illustration_confirm_info.svg`;
50
+ return /* @__PURE__ */ t(j, {
51
+ children: /* @__PURE__ */ p(D, {
52
+ children: [/* @__PURE__ */ t(O, {
53
+ variant: o,
54
+ children: /* @__PURE__ */ t(I, {
55
+ src: o === "warning" ? c : o === "delete" ? m : s,
56
+ sx: {
57
+ width: "230px",
58
+ height: "194px"
59
+ }
60
+ })
61
+ }), /* @__PURE__ */ t(B, {
62
+ children: /* @__PURE__ */ t(M, {
63
+ variant: "body1",
64
+ children: i
65
+ })
66
+ })]
67
+ })
68
+ });
69
+ }, F = x(null);
70
+ function K({
71
+ children: n
72
+ }) {
73
+ const [o, i] = g({
74
+ open: !1,
75
+ withClose: !0,
76
+ onQueryClose: w,
77
+ title: "",
78
+ iconComponent: void 0,
79
+ contentComponent: void 0,
80
+ variant: void 0
81
+ }), [r, e] = g(!1), c = (a) => {
82
+ i({
83
+ open: !0,
84
+ ...a
85
+ });
86
+ }, m = (a) => {
87
+ const {
88
+ variant: d = "warning",
89
+ title: u,
90
+ msg: h,
91
+ onClickIntro: f,
92
+ onClickCancel: v = s
93
+ } = a;
94
+ i({
95
+ open: !0,
96
+ title: u,
97
+ variant: d,
98
+ contentComponent: /* @__PURE__ */ t(E, {
99
+ variant: d,
100
+ msg: h
101
+ }),
102
+ actions: /* @__PURE__ */ p(_, {
103
+ children: [/* @__PURE__ */ t(b, {
104
+ onClick: v
105
+ }), " ", /* @__PURE__ */ t($, {
106
+ onClick: () => {
107
+ f && f(), s();
108
+ },
109
+ color: A(d)
110
+ })]
111
+ })
112
+ });
113
+ }, s = () => {
114
+ i((a) => ({
115
+ ...a,
116
+ open: !1
117
+ })), e(!1);
118
+ }, C = () => {
119
+ e(!0);
120
+ };
121
+ return /* @__PURE__ */ p(F.Provider, {
122
+ value: {
123
+ ...o,
124
+ openModal: c,
125
+ openModalConfirm: m,
126
+ closeModal: s,
127
+ hasChanges: r,
128
+ setChanges: C
129
+ },
130
+ children: [n, /* @__PURE__ */ t(k, {})]
131
+ });
132
+ }
133
+ export {
134
+ F as M,
135
+ K as a
136
+ };
@@ -1,5 +1,5 @@
1
1
  /// <reference types="react" />
2
2
  import { ModalContextProps, TProps } from './types';
3
- declare const ModalContext: import("react").Context<ModalContextProps>;
3
+ declare const ModalContext: import("react").Context<ModalContextProps | null>;
4
4
  declare function ModalProvider({ children }: TProps): JSX.Element;
5
5
  export { ModalProvider, ModalContext };
@@ -0,0 +1,11 @@
1
+ import { useContext as t } from "react";
2
+ import { M as e } from "../../contexts/ModalContext/index.8f76fbe4.js";
3
+ function s() {
4
+ const o = t(e);
5
+ if (!o)
6
+ throw new Error("useModal context must be use inside ModalContext");
7
+ return o;
8
+ }
9
+ export {
10
+ s as u
11
+ };
@@ -1 +1,2 @@
1
- export declare const useModal: () => import("../..").ModalContextProps;
1
+ export declare function useModal(): import("../..").ModalContextProps;
2
+ export default useModal;
package/index.js CHANGED
@@ -5,46 +5,46 @@ import "react/jsx-runtime";
5
5
  import { L as O } from "./components/animate/LoadingScreen/index.f1cec7db.js";
6
6
  import "@m4l/core";
7
7
  import "react-hook-form";
8
- import { R as j } from "./components/hook-form/RHFAutocomplete/index.b7f11146.js";
8
+ import { R as j } from "./components/hook-form/RHFAutocomplete/index.ee3d9b3c.js";
9
9
  import "react";
10
10
  import { I as G } from "./components/Image/index.c9da2d5a.js";
11
+ import "./lodash.727eb847.js";
11
12
  import { R as V } from "./components/hook-form/RHFCheckbox/index.6a40e25f.js";
12
13
  import { R as W } from "./components/hook-form/RHFDateTime/index.5ed774e3.js";
13
14
  import "@mui/x-date-pickers";
14
15
  import { R as J, a as K } from "./components/hook-form/RHFTextField/index.bab2a2cf.js";
15
16
  import { I as X } from "./components/Icon/index.f569765b.js";
16
17
  import "@mui/material/styles";
17
- import { R as Z } from "./components/hook-form/RHFPeriod/index.e17b1c72.js";
18
+ import { R as Z } from "./components/hook-form/RHFPeriod/index.6f6cde6d.js";
18
19
  import { E as $ } from "./components/ErrorLabel/index.c8615f16.js";
19
- import { P as ro, g as to } from "./components/Period/index.497b8df4.js";
20
- import { b as eo, M as mo, d as so, g as io } from "./components/CommonActions/components/Actions/index.a908e4b9.js";
20
+ import { P as ro, g as to } from "./components/Period/index.5493563f.js";
21
+ import { b as eo, M as mo, d as so, g as io } from "./components/CommonActions/components/Actions/index.03412615.js";
21
22
  import "@mui/material/Button";
22
23
  import "react-router-dom";
23
- import { M as no, a as xo } from "./contexts/ModalContext/index.699767c7.js";
24
+ import { M as no, a as xo } from "./contexts/ModalContext/index.8f76fbe4.js";
24
25
  import "@mui/lab";
25
- import "./lodash.e09401f0.js";
26
26
  import "react-dropzone";
27
- import { R as co } from "./components/hook-form/RHFUpload/index.cbf11b68.js";
27
+ import { R as co } from "./components/hook-form/RHFUpload/index.d055f3be.js";
28
28
  import { A as go } from "./components/mui_extended/Accordion/index.49f5df8e.js";
29
29
  import { A as uo } from "./components/mui_extended/Avatar/index.dadb0528.js";
30
- import { B as Ro, L as yo } from "./components/mui_extended/Button/index.16591787.js";
31
- import { L as Ao, P as Co } from "./components/mui_extended/Popover/index.305f2ea5.js";
32
- import { P as vo, g as Ho } from "./components/mui_extended/Pager/index.80c2f8a0.js";
30
+ import { B as Ro, L as yo } from "./components/mui_extended/Button/index.fbd38cd1.js";
31
+ import { L as Ao, P as Co } from "./components/mui_extended/Popover/index.cb3125b4.js";
32
+ import { P as vo, g as Ho } from "./components/mui_extended/Pager/index.fd2bca74.js";
33
33
  import { T as bo } from "./components/mui_extended/Tab/index.e0653a0a.js";
34
- import { D as Io, N as To, T as So, g as Eo } from "./components/DataGrid/index.5cbf0dd8.js";
34
+ import { D as Io, N as To, T as So, g as Eo } from "./components/DataGrid/index.f2f0bf6a.js";
35
35
  import "react-dnd";
36
36
  import "react-dnd-html5-backend";
37
37
  import "@m4l/graphics";
38
38
  import { S as ho } from "./components/ScrollBar/index.39eeb2de.js";
39
- import { D as Uo, d as jo, g as ko } from "./components/DynamicFilter/index.8a571617.js";
39
+ import { D as Uo, d as jo, g as ko } from "./components/DynamicFilter/index.f0b93aef.js";
40
40
  import "simplebar/dist/simplebar.min.css";
41
- import { R as zo } from "./components/contexts/RHFormContext/index.f8241292.js";
41
+ import { R as zo } from "./components/contexts/RHFormContext/index.33dba822.js";
42
42
  import "yup";
43
43
  import "./react-draggable.20e95c61.js";
44
- import { M as wo, d as Wo, g as qo } from "./components/ModalDialog/index.16024a4e.js";
44
+ import { M as wo, d as Wo, g as qo } from "./components/ModalDialog/index.180937f5.js";
45
45
  import { R as Ko } from "./components/Resizeable/index.45995d2b.js";
46
46
  import { N as Xo, d as Yo, g as Zo } from "./components/NoItemSelected/index.9609a7f7.js";
47
- import { O as $o, d as or, g as rr } from "./components/ObjectLogs/index.ac2bfa48.js";
47
+ import { O as $o, d as or, g as rr } from "./components/ObjectLogs/index.6cd7fcc9.js";
48
48
  import "./react-json-view.f56a7f8e.js";
49
49
  import { P as ar } from "./components/PaperForm/index.3f8c7ef2.js";
50
50
  import { H as mr } from "./components/Page/index.fc660ee5.js";
@@ -57,7 +57,7 @@ import { v as gr } from "./components/animate/variants/container.11f82b76.js";
57
57
  import { v as ur, a as Dr, b as Rr } from "./components/animate/variants/transition.bd46b9ce.js";
58
58
  import { M as Pr } from "./components/animate/MotionContainer/index.8d9f9d80.js";
59
59
  import { M as Cr } from "./components/animate/MotionLazyContainer/index.572dd012.js";
60
- import { R as vr } from "./components/hook-form/RHFAutocompleteAsync/index.97a5a66e.js";
60
+ import { R as vr } from "./components/hook-form/RHFAutocompleteAsync/index.64cff02c.js";
61
61
  import { R as Mr } from "./components/hook-form/RHFMultiCheckbox/index.2680b3b6.js";
62
62
  import { R as Br } from "./components/hook-form/RHFSelect/index.b6ca8bb2.js";
63
63
  import { R as Tr } from "./components/hook-form/RHFRadioGroup/index.b3335e13.js";
@@ -68,21 +68,21 @@ import { T as kr } from "./components/mui_extended/Typography/index.e5494696.js"
68
68
  import { B as zr, c as Vr } from "./components/formatters/BooleanFormatter/index.3ec56305.js";
69
69
  import { D as Wr, c as qr } from "./components/formatters/DateFormatter/index.08d8823b.js";
70
70
  import { P as Kr, a as Qr, U as Xr, e as Yr, b as Zr, c as _r, d as $r, g as ot } from "./components/formatters/index.6959c2de.js";
71
- import { A as tt } from "./components/CommonActions/components/ActionCancel/index.3775989f.js";
72
- import { A as et } from "./components/CommonActions/components/ActionIntro/index.ca7b6952.js";
73
- import { A as st } from "./components/CommonActions/components/ActionFormCancel/index.d69d9e0f.js";
71
+ import { A as tt } from "./components/CommonActions/components/ActionCancel/index.6649cc3d.js";
72
+ import { A as et } from "./components/CommonActions/components/ActionIntro/index.c794e2a1.js";
73
+ import { A as st } from "./components/CommonActions/components/ActionFormCancel/index.91f6c07d.js";
74
74
  import { A as pt } from "./components/CommonActions/components/ActionFormIntro/index.ca4d2674.js";
75
75
  import { L as xt } from "./components/Loadable/index.f5518558.js";
76
76
  import { S as ct } from "./components/ScrollToTop/index.e06f98f6.js";
77
77
  import { u as dt } from "./hooks/useFormAddEdit/index.d4845f1a.js";
78
- import { u as Ft } from "./hooks/useModal/index.8201ccec.js";
78
+ import { u as Ft } from "./hooks/useModal/index.44c5993b.js";
79
79
  import { L as Dt } from "./assets/Logo/index.228dcb5a.js";
80
- import "./utils/index.214d9542.js";
81
- import "./react-data-grid.d46d625e.js";
82
- import "clsx";
83
80
  import "./commonjs.565e6834.js";
84
81
  import "prop-types";
85
82
  import "react-dom";
83
+ import "clsx";
84
+ import "./utils/index.214d9542.js";
85
+ import "./react-data-grid.d46d625e.js";
86
86
  import "simplebar-react";
87
87
  import "./node_modules.168cb897.js";
88
88
  import "./react-resizable.5277deaf.js";
@@ -0,0 +1,117 @@
1
+ import { c as v } from "./commonjs.565e6834.js";
2
+ function F(r) {
3
+ var e = typeof r;
4
+ return r != null && (e == "object" || e == "function");
5
+ }
6
+ var G = F, U = typeof v == "object" && v && v.Object === Object && v, D = U, H = D, X = typeof self == "object" && self && self.Object === Object && self, q = H || X || Function("return this")(), L = q, z = L, J = function() {
7
+ return z.Date.now();
8
+ }, K = J, Q = /\s/;
9
+ function V(r) {
10
+ for (var e = r.length; e-- && Q.test(r.charAt(e)); )
11
+ ;
12
+ return e;
13
+ }
14
+ var Y = V, Z = Y, rr = /^\s+/;
15
+ function er(r) {
16
+ return r && r.slice(0, Z(r) + 1).replace(rr, "");
17
+ }
18
+ var tr = er, nr = L, ir = nr.Symbol, N = ir, h = N, w = Object.prototype, ar = w.hasOwnProperty, or = w.toString, g = h ? h.toStringTag : void 0;
19
+ function cr(r) {
20
+ var e = ar.call(r, g), i = r[g];
21
+ try {
22
+ r[g] = void 0;
23
+ var a = !0;
24
+ } catch {
25
+ }
26
+ var c = or.call(r);
27
+ return a && (e ? r[g] = i : delete r[g]), c;
28
+ }
29
+ var fr = cr, sr = Object.prototype, ur = sr.toString;
30
+ function br(r) {
31
+ return ur.call(r);
32
+ }
33
+ var dr = br, x = N, mr = fr, gr = dr, lr = "[object Null]", vr = "[object Undefined]", I = x ? x.toStringTag : void 0;
34
+ function yr(r) {
35
+ return r == null ? r === void 0 ? vr : lr : I && I in Object(r) ? mr(r) : gr(r);
36
+ }
37
+ var R = yr;
38
+ function Tr(r) {
39
+ return r != null && typeof r == "object";
40
+ }
41
+ var W = Tr, jr = R, Sr = W, $r = "[object Symbol]";
42
+ function Or(r) {
43
+ return typeof r == "symbol" || Sr(r) && jr(r) == $r;
44
+ }
45
+ var pr = Or, _r = tr, k = G, hr = pr, E = 0 / 0, xr = /^[-+]0x[0-9a-f]+$/i, Ir = /^0b[01]+$/i, kr = /^0o[0-7]+$/i, Er = parseInt;
46
+ function Ar(r) {
47
+ if (typeof r == "number")
48
+ return r;
49
+ if (hr(r))
50
+ return E;
51
+ if (k(r)) {
52
+ var e = typeof r.valueOf == "function" ? r.valueOf() : r;
53
+ r = k(e) ? e + "" : e;
54
+ }
55
+ if (typeof r != "string")
56
+ return r === 0 ? r : +r;
57
+ r = _r(r);
58
+ var i = Ir.test(r);
59
+ return i || kr.test(r) ? Er(r.slice(2), i ? 2 : 8) : xr.test(r) ? E : +r;
60
+ }
61
+ var Gr = Ar, Lr = G, S = K, A = Gr, Nr = "Expected a function", wr = Math.max, Rr = Math.min;
62
+ function Wr(r, e, i) {
63
+ var a, c, u, s, n, f, b = 0, $ = !1, d = !1, y = !0;
64
+ if (typeof r != "function")
65
+ throw new TypeError(Nr);
66
+ e = A(e) || 0, Lr(i) && ($ = !!i.leading, d = "maxWait" in i, u = d ? wr(A(i.maxWait) || 0, e) : u, y = "trailing" in i ? !!i.trailing : y);
67
+ function T(t) {
68
+ var o = a, m = c;
69
+ return a = c = void 0, b = t, s = r.apply(m, o), s;
70
+ }
71
+ function P(t) {
72
+ return b = t, n = setTimeout(l, e), $ ? T(t) : s;
73
+ }
74
+ function C(t) {
75
+ var o = t - f, m = t - b, _ = e - o;
76
+ return d ? Rr(_, u - m) : _;
77
+ }
78
+ function O(t) {
79
+ var o = t - f, m = t - b;
80
+ return f === void 0 || o >= e || o < 0 || d && m >= u;
81
+ }
82
+ function l() {
83
+ var t = S();
84
+ if (O(t))
85
+ return p(t);
86
+ n = setTimeout(l, C(t));
87
+ }
88
+ function p(t) {
89
+ return n = void 0, y && a ? T(t) : (a = c = void 0, s);
90
+ }
91
+ function M() {
92
+ n !== void 0 && clearTimeout(n), b = 0, a = f = c = n = void 0;
93
+ }
94
+ function B() {
95
+ return n === void 0 ? s : p(S());
96
+ }
97
+ function j() {
98
+ var t = S(), o = O(t);
99
+ if (a = arguments, c = this, f = t, o) {
100
+ if (n === void 0)
101
+ return P(f);
102
+ if (d)
103
+ return clearTimeout(n), n = setTimeout(l, e), T(f);
104
+ }
105
+ return n === void 0 && (n = setTimeout(l, e)), s;
106
+ }
107
+ return j.cancel = M, j.flush = B, j;
108
+ }
109
+ var Xr = Wr, Pr = Array.isArray, Cr = Pr, Mr = R, Br = Cr, Fr = W, Ur = "[object String]";
110
+ function Dr(r) {
111
+ return typeof r == "string" || !Br(r) && Fr(r) && Mr(r) == Ur;
112
+ }
113
+ var qr = Dr;
114
+ export {
115
+ Xr as d,
116
+ qr as i
117
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@m4l/components",
3
- "version": "0.1.20",
3
+ "version": "0.1.21",
4
4
  "license": "UNLICENSED",
5
5
  "dependencies": {
6
6
  "@m4l/core": "*",
@@ -9,7 +9,7 @@
9
9
  "lodash.throttle": "^4.1.1",
10
10
  "react-helmet-async": "^1.3.0",
11
11
  "react-hook-form": "^7.33.1",
12
- "react-router-dom": "^6.3.0",
12
+ "react-router-dom": "6.3.0",
13
13
  "simplebar-react": "2.4.1",
14
14
  "yup": "^0.32.11"
15
15
  },
@@ -24,7 +24,7 @@
24
24
  "react-helmet-async": "^1.3.0",
25
25
  "react-hook-form": "^7.33.1",
26
26
  "react-intersection-observer": "^9.4.0",
27
- "react-router-dom": "^6.3.0",
27
+ "react-router-dom": "6.3.0",
28
28
  "yup": "^0.32.11"
29
29
  },
30
30
  "files": [
@@ -1,146 +0,0 @@
1
- import { useModuleDictionary as F, useModuleSkeleton as H } from "@m4l/core";
2
- import { useFormContext as M, Controller as $ } from "react-hook-form";
3
- import { Skeleton as O, Autocomplete as q, TextField as E } from "@mui/material";
4
- import { styled as l } from "@mui/material/styles";
5
- import { I as w } from "../../Image/index.c9da2d5a.js";
6
- import { useMemo as V } from "react";
7
- import { jsxs as T, jsx as i } from "react/jsx-runtime";
8
- const j = l("div")(() => ({
9
- display: "flex",
10
- width: "100%",
11
- flexDirection: "column"
12
- })), D = l("div")(({
13
- theme: e
14
- }) => ({
15
- width: "100%",
16
- display: "grid",
17
- gridTemplateColumns: "1fr auto",
18
- gridGap: e.spacing(2),
19
- alignItems: "center",
20
- height: `${e.spacing(4.5)}`,
21
- border: `1px solid ${e.palette.divider}`,
22
- borderRadius: `${e.spacing(1)}`,
23
- padding: `0 ${e.spacing(2)}`,
24
- [e.breakpoints.down("md")]: {
25
- width: "100%"
26
- }
27
- })), K = l("div")(({
28
- theme: e
29
- }) => ({
30
- display: "flex",
31
- width: "100%",
32
- "& .MuiAutocomplete-root": {
33
- width: "100%"
34
- },
35
- "& .m4l_image": {
36
- marginLeft: e.spacing(1.5)
37
- }
38
- })), P = l("li")(({
39
- theme: e
40
- }) => ({
41
- "& .m4l_image": {
42
- marginRight: e.spacing(1.5)
43
- }
44
- }));
45
- function U(e, a, d) {
46
- return function(n, s) {
47
- return /* @__PURE__ */ T(P, {
48
- ...n,
49
- children: [/* @__PURE__ */ i(w, {
50
- src: e(s),
51
- width: a,
52
- height: d
53
- }), n.key]
54
- });
55
- };
56
- }
57
- function Y(e) {
58
- const {
59
- name: a,
60
- getOptionLabel: d,
61
- isOptionEqualToValue: u,
62
- label: n,
63
- skeletonWidth: s = 100,
64
- skeletonHeight: b = "18px",
65
- options: I,
66
- disabled: v,
67
- getOptionUrlImage: r,
68
- imageWidth: c = "24px",
69
- imageHeight: m = "24px",
70
- onOpen: k,
71
- onClose: _,
72
- loading: L,
73
- ...C
74
- } = e, {
75
- getLabel: g
76
- } = F(), R = H(), {
77
- control: S
78
- } = M(), h = V(() => r !== void 0, [r]), y = (t) => t == null ? "" : d(t), f = (t) => t == null || r === void 0 ? "" : r(t), A = (t, o) => o == null || t === null ? !1 : u(t, o);
79
- return R ? /* @__PURE__ */ i(j, {
80
- children: /* @__PURE__ */ T(D, {
81
- children: [/* @__PURE__ */ i(O, {
82
- variant: "text",
83
- width: s,
84
- height: b
85
- }, "sk1"), /* @__PURE__ */ i(O, {
86
- variant: "circular",
87
- width: 16,
88
- height: 16
89
- }, "sk2")]
90
- })
91
- }) : /* @__PURE__ */ i($, {
92
- name: a,
93
- control: S,
94
- render: ({
95
- field: {
96
- onChange: t,
97
- value: o
98
- },
99
- fieldState: {
100
- error: x
101
- }
102
- }) => /* @__PURE__ */ i(K, {
103
- className: "m4l_rhf_autocomplete",
104
- children: /* @__PURE__ */ i(q, {
105
- options: I,
106
- getOptionLabel: y,
107
- isOptionEqualToValue: A,
108
- disableClearable: !0,
109
- value: o || null,
110
- onOpen: k,
111
- onClose: _,
112
- onChange: (p, W) => {
113
- t(W);
114
- },
115
- loading: L,
116
- loadingText: g("rhf_autocomplete.loading_options"),
117
- disabled: v,
118
- noOptionsText: g("rhf_autocomplete.no_options"),
119
- renderOption: h ? U(f, c, m) : void 0,
120
- renderInput: (p) => /* @__PURE__ */ i(E, {
121
- ...p,
122
- label: n,
123
- fullWidth: !0,
124
- SelectProps: {
125
- native: !0
126
- },
127
- InputProps: {
128
- ...p.InputProps,
129
- startAdornment: h && o ? /* @__PURE__ */ i(w, {
130
- src: f(o),
131
- width: c,
132
- height: m
133
- }, "ImageTextField") : null
134
- },
135
- autoComplete: "off",
136
- error: !!x,
137
- helperText: x?.message,
138
- ...C
139
- })
140
- })
141
- })
142
- });
143
- }
144
- export {
145
- Y as R
146
- };
@@ -1,51 +0,0 @@
1
- import { useState as o, useEffect as p } from "react";
2
- import { useNetwork as y, getPropertyByString as A } from "@m4l/core";
3
- import { useFormContext as L } from "react-hook-form";
4
- import { R as k } from "../RHFAutocomplete/index.b7f11146.js";
5
- import { jsx as w } from "react/jsx-runtime";
6
- function j(l) {
7
- const {
8
- name: n,
9
- endPoint: e,
10
- timeout: f = 5e3,
11
- parms: s,
12
- resultField: c = "data",
13
- isRemote: d = !0,
14
- ...g
15
- } = l, {
16
- setValue: O
17
- } = L(), {
18
- networkOperation: R
19
- } = y(), [F, r] = o([]), [h, i] = o(!1), [m, u] = o(!1), t = h && !m && !!e;
20
- return p(() => {
21
- m && (u(!1), r([]), O(n, null));
22
- }, [s, e]), p(() => {
23
- let a = !0;
24
- if (!!t)
25
- return R({
26
- method: "GET",
27
- endPoint: e,
28
- timeout: f,
29
- parms: s,
30
- isRemote: d
31
- }).then((x) => {
32
- a && (r(A(x, c)), u(!0));
33
- }), () => {
34
- a = !1;
35
- };
36
- }, [t]), console.log("Loading", t), /* @__PURE__ */ w(k, {
37
- name: n,
38
- loading: t,
39
- options: F,
40
- onOpen: () => {
41
- i(!0);
42
- },
43
- onClose: () => {
44
- i(!1);
45
- },
46
- ...g
47
- });
48
- }
49
- export {
50
- j as R
51
- };