@m4l/components 0.1.20 → 0.1.22
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.
- package/components/CommonActions/components/ActionCancel/{index.3775989f.js → index.7b862bd3.js} +1 -1
- package/components/CommonActions/components/ActionFormCancel/{index.d69d9e0f.js → index.b59a0011.js} +2 -2
- package/components/CommonActions/components/ActionIntro/{index.ca7b6952.js → index.35c8757f.js} +1 -1
- package/components/CommonActions/components/Actions/{index.a908e4b9.js → index.edceed6b.js} +7 -7
- package/components/DataGrid/{index.5cbf0dd8.js → index.cd4fff69.js} +3 -3
- package/components/DynamicFilter/{index.8a571617.js → index.4d3c60b4.js} +19 -18
- package/components/ModalDialog/{index.16024a4e.js → index.e1f31e50.js} +2 -2
- package/components/ObjectLogs/{index.ac2bfa48.js → index.9c43ba69.js} +3 -3
- package/components/Period/{index.497b8df4.js → index.ba6c0e11.js} +2 -2
- package/components/contexts/RHFormContext/{index.f8241292.js → index.33dba822.js} +12 -12
- package/components/hook-form/RHFAutocomplete/index.ee3d9b3c.js +171 -0
- package/components/hook-form/RHFAutocomplete/types.d.ts +3 -1
- package/components/hook-form/RHFAutocompleteAsync/index.3b3da5f6.js +73 -0
- package/components/hook-form/RHFAutocompleteAsync/types.d.ts +2 -1
- package/components/hook-form/RHFPeriod/{index.e17b1c72.js → index.fc3af81f.js} +1 -1
- package/components/hook-form/RHFUpload/{index.cbf11b68.js → index.56e2e277.js} +19 -19
- package/components/mui_extended/Button/{index.16591787.js → index.6df3e958.js} +4 -4
- package/components/mui_extended/Pager/{index.80c2f8a0.js → index.b072df6b.js} +1 -1
- package/components/mui_extended/Popover/{index.305f2ea5.js → index.d708b699.js} +3 -3
- package/contexts/ModalContext/index.33dc1be9.js +136 -0
- package/contexts/ModalContext/index.d.ts +1 -1
- package/hooks/useModal/index.34cc1e55.js +11 -0
- package/hooks/useModal/index.d.ts +2 -1
- package/index.js +153 -152
- package/package.json +3 -3
- package/components/hook-form/RHFAutocomplete/index.b7f11146.js +0 -146
- package/components/hook-form/RHFAutocompleteAsync/index.97a5a66e.js +0 -51
- package/contexts/ModalContext/index.699767c7.js +0 -150
- package/hooks/useModal/index.8201ccec.js +0 -6
- package/lodash.e09401f0.js +0 -32
package/components/CommonActions/components/ActionCancel/{index.3775989f.js → index.7b862bd3.js}
RENAMED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { useModuleDictionary as n } from "@m4l/core";
|
|
2
|
-
import { B as r } from "../../../mui_extended/Button/index.
|
|
2
|
+
import { B as r } from "../../../mui_extended/Button/index.6df3e958.js";
|
|
3
3
|
import { jsx as i } from "react/jsx-runtime";
|
|
4
4
|
const m = (o) => {
|
|
5
5
|
const {
|
package/components/CommonActions/components/ActionFormCancel/{index.d69d9e0f.js → index.b59a0011.js}
RENAMED
|
@@ -2,9 +2,9 @@ import { useFormContext as f, useFormState as p } from "react-hook-form";
|
|
|
2
2
|
import { useNavigate as C } from "react-router-dom";
|
|
3
3
|
import { useModuleDictionary as g, useModuleSkeleton as d } from "@m4l/core";
|
|
4
4
|
import { Skeleton as k } from "@mui/material";
|
|
5
|
-
import { B as _ } from "../../../mui_extended/Button/index.
|
|
5
|
+
import { B as _ } from "../../../mui_extended/Button/index.6df3e958.js";
|
|
6
6
|
import { useCallback as v } from "react";
|
|
7
|
-
import { u as h } from "../../../../hooks/useModal/index.
|
|
7
|
+
import { u as h } from "../../../../hooks/useModal/index.34cc1e55.js";
|
|
8
8
|
import { jsx as r } from "react/jsx-runtime";
|
|
9
9
|
function A(n) {
|
|
10
10
|
const {
|
package/components/CommonActions/components/ActionIntro/{index.ca7b6952.js → index.35c8757f.js}
RENAMED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { useModuleDictionary as r } from "@m4l/core";
|
|
2
|
-
import { B as n } from "../../../mui_extended/Button/index.
|
|
2
|
+
import { B as n } from "../../../mui_extended/Button/index.6df3e958.js";
|
|
3
3
|
import { jsx as i } from "react/jsx-runtime";
|
|
4
4
|
const e = (o) => {
|
|
5
5
|
const {
|
|
@@ -6,16 +6,16 @@ import "@mui/material/Button";
|
|
|
6
6
|
import "react-hook-form";
|
|
7
7
|
import "react-router-dom";
|
|
8
8
|
import { useState as W, useMemo as w, forwardRef as st, useRef as B, useImperativeHandle as rt, useEffect as at, useCallback as j } from "react";
|
|
9
|
-
import "../../../../contexts/ModalContext/index.
|
|
9
|
+
import "../../../../contexts/ModalContext/index.33dc1be9.js";
|
|
10
10
|
import "@mui/lab";
|
|
11
11
|
import { I as y } from "../../../mui_extended/IconButton/index.4b5ce8b5.js";
|
|
12
|
-
import { u as I, a as lt, O as ct } from "../../../DataGrid/index.
|
|
13
|
-
import { P as dt } from "../../../mui_extended/Pager/index.
|
|
12
|
+
import { u as I, a as lt, O as ct } from "../../../DataGrid/index.cd4fff69.js";
|
|
13
|
+
import { P as dt } from "../../../mui_extended/Pager/index.b072df6b.js";
|
|
14
14
|
import { D as pt } from "../../../../react-data-grid.d46d625e.js";
|
|
15
|
-
import { u as gt } from "../../../../hooks/useModal/index.
|
|
16
|
-
import { A as ft } from "../ActionCancel/index.
|
|
17
|
-
import { A as ut } from "../ActionIntro/index.
|
|
18
|
-
import { P as mt } from "../../../mui_extended/Popover/index.
|
|
15
|
+
import { u as gt } from "../../../../hooks/useModal/index.34cc1e55.js";
|
|
16
|
+
import { A as ft } from "../ActionCancel/index.7b862bd3.js";
|
|
17
|
+
import { A as ut } from "../ActionIntro/index.35c8757f.js";
|
|
18
|
+
import { P as mt } from "../../../mui_extended/Popover/index.d708b699.js";
|
|
19
19
|
import { I as N } from "../../../Icon/index.f569765b.js";
|
|
20
20
|
import { useResponsiveDesktop as ht } from "@m4l/graphics";
|
|
21
21
|
const _t = p("div")(({
|
|
@@ -6,9 +6,9 @@ import { HTML5Backend as ge } from "react-dnd-html5-backend";
|
|
|
6
6
|
import { SvgIcon as B, Checkbox as fe, InputBase as he, Skeleton as pe } from "@mui/material";
|
|
7
7
|
import { jsx as d, jsxs as Q } from "react/jsx-runtime";
|
|
8
8
|
import { voidFunction as I, useModuleDictionary as we, useModuleSkeleton as me } from "@m4l/core";
|
|
9
|
-
import { A as ye, a as Ce } from "../CommonActions/components/Actions/index.
|
|
10
|
-
import { g as be, d as ve } from "../ModalDialog/index.
|
|
11
|
-
import { g as xe, d as Re } from "../mui_extended/Pager/index.
|
|
9
|
+
import { A as ye, a as Ce } from "../CommonActions/components/Actions/index.edceed6b.js";
|
|
10
|
+
import { g as be, d as ve } from "../ModalDialog/index.e1f31e50.js";
|
|
11
|
+
import { g as xe, d as Re } from "../mui_extended/Pager/index.b072df6b.js";
|
|
12
12
|
const Se = A("div")(() => ({
|
|
13
13
|
display: "flex",
|
|
14
14
|
flexDirection: "column",
|
|
@@ -4,7 +4,8 @@ import { useRef as me, useState as S, useMemo as E, useCallback as _, useEffect
|
|
|
4
4
|
import { useModuleDictionary as $, useHostTools as z, useEnvironment as j, voidFunction as V, useFlagsPresent as He } from "@m4l/core";
|
|
5
5
|
import * as C from "yup";
|
|
6
6
|
import { useFormContext as B, useWatch as ge } from "react-hook-form";
|
|
7
|
-
import { R } from "../hook-form/RHFAutocomplete/index.
|
|
7
|
+
import { R } from "../hook-form/RHFAutocomplete/index.ee3d9b3c.js";
|
|
8
|
+
import "lodash/debounce";
|
|
8
9
|
import { jsx as r, jsxs as w, Fragment as A } from "react/jsx-runtime";
|
|
9
10
|
import "../hook-form/RHFCheckbox/index.6a40e25f.js";
|
|
10
11
|
import { alpha as Ke, styled as be, Skeleton as Fe, MenuItem as ze, useTheme as Ye, Popper as Ge } from "@mui/material";
|
|
@@ -12,25 +13,25 @@ import { R as ee } from "../hook-form/RHFDateTime/index.5ed774e3.js";
|
|
|
12
13
|
import "@mui/x-date-pickers";
|
|
13
14
|
import { R as Y } from "../hook-form/RHFTextField/index.bab2a2cf.js";
|
|
14
15
|
import { I as he } from "../Icon/index.f569765b.js";
|
|
15
|
-
import "../hook-form/RHFPeriod/index.
|
|
16
|
+
import "../hook-form/RHFPeriod/index.fc3af81f.js";
|
|
16
17
|
import "../ErrorLabel/index.c8615f16.js";
|
|
17
|
-
import "../Period/index.
|
|
18
|
-
import { L as Ue, b as Je, g as Qe } from "../CommonActions/components/Actions/index.
|
|
18
|
+
import "../Period/index.ba6c0e11.js";
|
|
19
|
+
import { L as Ue, b as Je, g as Qe } from "../CommonActions/components/Actions/index.edceed6b.js";
|
|
19
20
|
import "@mui/material/Button";
|
|
20
21
|
import "react-router-dom";
|
|
21
|
-
import "../../contexts/ModalContext/index.
|
|
22
|
+
import "../../contexts/ModalContext/index.33dc1be9.js";
|
|
22
23
|
import "@mui/lab";
|
|
23
|
-
import "
|
|
24
|
+
import "lodash/isString";
|
|
24
25
|
import "react-dropzone";
|
|
25
26
|
import "../Image/index.c9da2d5a.js";
|
|
26
|
-
import "../hook-form/RHFUpload/index.
|
|
27
|
+
import "../hook-form/RHFUpload/index.56e2e277.js";
|
|
27
28
|
import { I as G } from "../mui_extended/IconButton/index.4b5ce8b5.js";
|
|
28
29
|
import "simplebar/dist/simplebar.min.css";
|
|
29
|
-
import { F as te } from "../mui_extended/Button/index.
|
|
30
|
-
import { P as Xe } from "../mui_extended/Popover/index.
|
|
31
|
-
import { R as Ze } from "../contexts/RHFormContext/index.
|
|
32
|
-
import { A as et } from "../CommonActions/components/ActionCancel/index.
|
|
33
|
-
import { A as tt } from "../CommonActions/components/ActionIntro/index.
|
|
30
|
+
import { F as te } from "../mui_extended/Button/index.6df3e958.js";
|
|
31
|
+
import { P as Xe } from "../mui_extended/Popover/index.d708b699.js";
|
|
32
|
+
import { R as Ze } from "../contexts/RHFormContext/index.33dba822.js";
|
|
33
|
+
import { A as et } from "../CommonActions/components/ActionCancel/index.7b862bd3.js";
|
|
34
|
+
import { A as tt } from "../CommonActions/components/ActionIntro/index.35c8757f.js";
|
|
34
35
|
import { useResponsiveDesktop as rt } from "@m4l/graphics";
|
|
35
36
|
const re = h("div")(({
|
|
36
37
|
theme: e
|
|
@@ -1101,7 +1102,7 @@ const jt = h("div")(({
|
|
|
1101
1102
|
width: "100%",
|
|
1102
1103
|
display: "flex",
|
|
1103
1104
|
justifyContent: "space-between"
|
|
1104
|
-
})),
|
|
1105
|
+
})), Ir = (e) => {
|
|
1105
1106
|
const t = rt();
|
|
1106
1107
|
return He(["dictionary_loaded"]) ? /* @__PURE__ */ r(St, {
|
|
1107
1108
|
...e,
|
|
@@ -1123,10 +1124,10 @@ const jt = h("div")(({
|
|
|
1123
1124
|
})
|
|
1124
1125
|
}) : /* @__PURE__ */ r(A, {});
|
|
1125
1126
|
};
|
|
1126
|
-
function
|
|
1127
|
+
function wr() {
|
|
1127
1128
|
return ["dynamic_filter"].concat(Qe());
|
|
1128
1129
|
}
|
|
1129
|
-
const
|
|
1130
|
+
const Cr = {
|
|
1130
1131
|
dynamic_filter: {
|
|
1131
1132
|
filter_tooltip: "Search",
|
|
1132
1133
|
operator_b: "between",
|
|
@@ -1149,8 +1150,8 @@ const wr = {
|
|
|
1149
1150
|
}
|
|
1150
1151
|
};
|
|
1151
1152
|
export {
|
|
1152
|
-
|
|
1153
|
-
|
|
1154
|
-
|
|
1153
|
+
Ir as D,
|
|
1154
|
+
Cr as d,
|
|
1155
|
+
wr as g,
|
|
1155
1156
|
T as u
|
|
1156
1157
|
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Dialog as b, IconButton as w, Paper as v } from "@mui/material";
|
|
2
2
|
import { c as D } from "../../react-draggable.20e95c61.js";
|
|
3
|
-
import { u as $ } from "../../hooks/useModal/index.
|
|
3
|
+
import { u as $ } from "../../hooks/useModal/index.34cc1e55.js";
|
|
4
4
|
import { styled as s } from "@mui/material/styles";
|
|
5
5
|
import { a as x } from "../../utils/index.214d9542.js";
|
|
6
6
|
import { R as M } from "../Resizeable/index.45995d2b.js";
|
|
@@ -8,7 +8,7 @@ import { useResponsiveDesktop as H } from "@m4l/graphics";
|
|
|
8
8
|
import { useEnvironment as I } from "@m4l/core";
|
|
9
9
|
import { I as C } from "../Icon/index.f569765b.js";
|
|
10
10
|
import { jsxs as h, jsx as n } from "react/jsx-runtime";
|
|
11
|
-
import { b as W, g as _ } from "../CommonActions/components/Actions/index.
|
|
11
|
+
import { b as W, g as _ } from "../CommonActions/components/Actions/index.edceed6b.js";
|
|
12
12
|
const j = s(b)(() => ({})), k = s("div")(({ theme: o }) => ({
|
|
13
13
|
display: "flex",
|
|
14
14
|
flexDirection: "column",
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import { useState as _, useEffect as f, useCallback as d, useMemo as $ } from "react";
|
|
2
2
|
import { useNetwork as k, useModuleDictionary as y, useEnvironment as h, usePaginate as O } from "@m4l/core";
|
|
3
3
|
import { styled as g } from "@mui/material/styles";
|
|
4
|
-
import { D as R, g as I } from "../DataGrid/index.
|
|
4
|
+
import { D as R, g as I } from "../DataGrid/index.cd4fff69.js";
|
|
5
5
|
import { D as L } from "../formatters/DateFormatter/index.08d8823b.js";
|
|
6
6
|
import { Tooltip as G, IconButton as M } from "@mui/material";
|
|
7
7
|
import { R as S } from "../../react-json-view.f56a7f8e.js";
|
|
8
8
|
import { jsx as t, jsxs as A } from "react/jsx-runtime";
|
|
9
|
-
import { u as T } from "../../hooks/useModal/index.
|
|
9
|
+
import { u as T } from "../../hooks/useModal/index.34cc1e55.js";
|
|
10
10
|
import { I as u } from "../Icon/index.f569765b.js";
|
|
11
|
-
import { D as E, g as K } from "../DynamicFilter/index.
|
|
11
|
+
import { D as E, g as K } from "../DynamicFilter/index.4d3c60b4.js";
|
|
12
12
|
const q = g("div")(() => ({
|
|
13
13
|
height: "100%",
|
|
14
14
|
width: "100%",
|
|
@@ -3,11 +3,11 @@ import { styled as a, Skeleton as d, Autocomplete as $, TextField as x } from "@
|
|
|
3
3
|
import { useMemo as D } from "react";
|
|
4
4
|
import { I as v } from "../Icon/index.f569765b.js";
|
|
5
5
|
import { jsxs as u, jsx as n } from "react/jsx-runtime";
|
|
6
|
-
import { g as O } from "../CommonActions/components/Actions/index.
|
|
6
|
+
import { g as O } from "../CommonActions/components/Actions/index.edceed6b.js";
|
|
7
7
|
import "@mui/material/Button";
|
|
8
8
|
import "react-hook-form";
|
|
9
9
|
import "react-router-dom";
|
|
10
|
-
import "../../contexts/ModalContext/index.
|
|
10
|
+
import "../../contexts/ModalContext/index.33dc1be9.js";
|
|
11
11
|
import "@mui/lab";
|
|
12
12
|
const S = a("div")(({
|
|
13
13
|
theme: t,
|
|
@@ -4,31 +4,31 @@ import { o as n } from "../../../node_modules.168cb897.js";
|
|
|
4
4
|
import { styled as c } from "@mui/material/styles";
|
|
5
5
|
import { jsx as l } from "react/jsx-runtime";
|
|
6
6
|
const h = c("form")(({
|
|
7
|
-
theme:
|
|
7
|
+
theme: r
|
|
8
8
|
}) => ({
|
|
9
9
|
display: "flex",
|
|
10
|
-
marginBottom:
|
|
10
|
+
marginBottom: r.spacing(1),
|
|
11
11
|
flexDirection: "column",
|
|
12
12
|
width: "100%",
|
|
13
13
|
overflow: "auto",
|
|
14
|
-
maxWidth:
|
|
15
|
-
padding:
|
|
14
|
+
maxWidth: r.stretch ? "unset" : "900px",
|
|
15
|
+
padding: r.spacing(3)
|
|
16
16
|
}));
|
|
17
|
-
function P(
|
|
17
|
+
function P(r) {
|
|
18
18
|
const {
|
|
19
19
|
children: d,
|
|
20
20
|
onSubmit: i,
|
|
21
21
|
values: s,
|
|
22
22
|
validationSchema: u,
|
|
23
23
|
statusLoad: o = "ready"
|
|
24
|
-
} =
|
|
24
|
+
} = r, e = f({
|
|
25
25
|
resolver: n(u),
|
|
26
26
|
defaultValues: s
|
|
27
27
|
});
|
|
28
28
|
return t(() => {
|
|
29
|
-
if (console.log("useEffect FormProvider reload_values_provider===", o), o === "reload_values_provider") {
|
|
29
|
+
if (console.log("useEffect FormProvider reload_values_provider===", o, s, e), o === "reload_values_provider") {
|
|
30
30
|
Object.keys(s).forEach((a) => {
|
|
31
|
-
|
|
31
|
+
e.setValue(a, s[a], {
|
|
32
32
|
shouldValidate: !1,
|
|
33
33
|
shouldDirty: !1,
|
|
34
34
|
shouldTouch: !1
|
|
@@ -36,17 +36,17 @@ function P(e) {
|
|
|
36
36
|
});
|
|
37
37
|
return;
|
|
38
38
|
}
|
|
39
|
-
}, [
|
|
40
|
-
o === "ready" && (console.log("useEffect FormProvider Ready", o),
|
|
39
|
+
}, [e, o, s]), t(() => {
|
|
40
|
+
o === "ready" && (console.log("useEffect FormProvider Ready", o), e.setValue("statusLoad", "ready", {
|
|
41
41
|
shouldValidate: !1,
|
|
42
42
|
shouldDirty: !1,
|
|
43
43
|
shouldTouch: !1
|
|
44
44
|
}));
|
|
45
45
|
}, [o]), /* @__PURE__ */ l(m, {
|
|
46
|
-
...
|
|
46
|
+
...e,
|
|
47
47
|
children: /* @__PURE__ */ l(h, {
|
|
48
48
|
id: "formProvider",
|
|
49
|
-
onSubmit:
|
|
49
|
+
onSubmit: e.handleSubmit(i),
|
|
50
50
|
children: d
|
|
51
51
|
})
|
|
52
52
|
});
|
|
@@ -0,0 +1,171 @@
|
|
|
1
|
+
import { useModuleDictionary as K, useModuleSkeleton as U } from "@m4l/core";
|
|
2
|
+
import { useFormContext as z, Controller as B } from "react-hook-form";
|
|
3
|
+
import { Skeleton as y, Autocomplete as G, TextField as N, CircularProgress as J } from "@mui/material";
|
|
4
|
+
import { styled as d } from "@mui/material/styles";
|
|
5
|
+
import { I as v } from "../../Image/index.c9da2d5a.js";
|
|
6
|
+
import { useMemo as Q, useState as F, useEffect as X } from "react";
|
|
7
|
+
import { jsxs as O, jsx as n, Fragment as Y } from "react/jsx-runtime";
|
|
8
|
+
const Z = d("div")(() => ({
|
|
9
|
+
display: "flex",
|
|
10
|
+
width: "100%",
|
|
11
|
+
flexDirection: "column"
|
|
12
|
+
})), ee = d("div")(({
|
|
13
|
+
theme: t
|
|
14
|
+
}) => ({
|
|
15
|
+
width: "100%",
|
|
16
|
+
display: "grid",
|
|
17
|
+
gridTemplateColumns: "1fr auto",
|
|
18
|
+
gridGap: t.spacing(2),
|
|
19
|
+
alignItems: "center",
|
|
20
|
+
height: `${t.spacing(4.5)}`,
|
|
21
|
+
border: `1px solid ${t.palette.divider}`,
|
|
22
|
+
borderRadius: `${t.spacing(1)}`,
|
|
23
|
+
padding: `0 ${t.spacing(2)}`,
|
|
24
|
+
[t.breakpoints.down("md")]: {
|
|
25
|
+
width: "100%"
|
|
26
|
+
}
|
|
27
|
+
})), te = d("div")(({
|
|
28
|
+
theme: t
|
|
29
|
+
}) => ({
|
|
30
|
+
display: "flex",
|
|
31
|
+
width: "100%",
|
|
32
|
+
"& .MuiAutocomplete-root": {
|
|
33
|
+
width: "100%"
|
|
34
|
+
},
|
|
35
|
+
"& .m4l_image": {
|
|
36
|
+
marginLeft: t.spacing(1.5)
|
|
37
|
+
}
|
|
38
|
+
})), oe = d("li")(({
|
|
39
|
+
theme: t
|
|
40
|
+
}) => ({
|
|
41
|
+
"& .m4l_image": {
|
|
42
|
+
marginRight: t.spacing(1.5)
|
|
43
|
+
}
|
|
44
|
+
}));
|
|
45
|
+
function ne(t, l, c) {
|
|
46
|
+
return function(s, g) {
|
|
47
|
+
return /* @__PURE__ */ O(oe, {
|
|
48
|
+
...s,
|
|
49
|
+
children: [/* @__PURE__ */ n(v, {
|
|
50
|
+
src: t(g),
|
|
51
|
+
width: l,
|
|
52
|
+
height: c
|
|
53
|
+
}), s.key]
|
|
54
|
+
});
|
|
55
|
+
};
|
|
56
|
+
}
|
|
57
|
+
function de(t) {
|
|
58
|
+
const {
|
|
59
|
+
name: l,
|
|
60
|
+
getOptionLabel: c,
|
|
61
|
+
isOptionEqualToValue: x,
|
|
62
|
+
label: s,
|
|
63
|
+
skeletonWidth: g = 100,
|
|
64
|
+
skeletonHeight: P = "18px",
|
|
65
|
+
options: W,
|
|
66
|
+
disabled: E,
|
|
67
|
+
getOptionUrlImage: p,
|
|
68
|
+
imageWidth: C = "24px",
|
|
69
|
+
imageHeight: I = "24px",
|
|
70
|
+
onOpen: b,
|
|
71
|
+
onClose: T,
|
|
72
|
+
loading: L,
|
|
73
|
+
onChangeOption: w,
|
|
74
|
+
onChangeFilterParmsLocal: a,
|
|
75
|
+
...H
|
|
76
|
+
} = t, {
|
|
77
|
+
getLabel: k
|
|
78
|
+
} = K(), M = U(), {
|
|
79
|
+
control: $
|
|
80
|
+
} = z(), A = Q(() => p !== void 0, [p]), [q, S] = F(!1), V = (e, o) => {
|
|
81
|
+
S(!1), T && T(e, o);
|
|
82
|
+
}, j = (e) => {
|
|
83
|
+
S(!0), b && b(e);
|
|
84
|
+
}, m = (e) => e == null ? "" : c(e), _ = (e) => e == null || p === void 0 ? "" : p(e), D = (e, o) => o == null || e === null ? !1 : x(e, o);
|
|
85
|
+
return M ? /* @__PURE__ */ n(Z, {
|
|
86
|
+
children: /* @__PURE__ */ O(ee, {
|
|
87
|
+
children: [/* @__PURE__ */ n(y, {
|
|
88
|
+
variant: "text",
|
|
89
|
+
width: g,
|
|
90
|
+
height: P
|
|
91
|
+
}, "sk1"), /* @__PURE__ */ n(y, {
|
|
92
|
+
variant: "circular",
|
|
93
|
+
width: 16,
|
|
94
|
+
height: 16
|
|
95
|
+
}, "sk2")]
|
|
96
|
+
})
|
|
97
|
+
}) : /* @__PURE__ */ n(B, {
|
|
98
|
+
name: l,
|
|
99
|
+
control: $,
|
|
100
|
+
render: ({
|
|
101
|
+
field: {
|
|
102
|
+
onChange: e,
|
|
103
|
+
value: o
|
|
104
|
+
},
|
|
105
|
+
fieldState: {
|
|
106
|
+
error: R
|
|
107
|
+
}
|
|
108
|
+
}) => {
|
|
109
|
+
const [u, f] = F(m(o));
|
|
110
|
+
return X(() => {
|
|
111
|
+
!q && o === null && u !== "" && f("");
|
|
112
|
+
}, [o]), console.log("Render AC", l, u, typeof u, o), /* @__PURE__ */ n(te, {
|
|
113
|
+
className: "m4l_rhf_autocomplete",
|
|
114
|
+
children: /* @__PURE__ */ n(G, {
|
|
115
|
+
autoComplete: !0,
|
|
116
|
+
autoSelect: !a,
|
|
117
|
+
options: W,
|
|
118
|
+
getOptionLabel: m,
|
|
119
|
+
inputValue: u,
|
|
120
|
+
clearOnBlur: !1,
|
|
121
|
+
onInputChange: (i, r, h) => {
|
|
122
|
+
console.debug("******onInputChange*", r, h), h === "input" ? (f(r), a && a(r, h)) : e(null);
|
|
123
|
+
},
|
|
124
|
+
isOptionEqualToValue: D,
|
|
125
|
+
disableClearable: !0,
|
|
126
|
+
value: o || null,
|
|
127
|
+
onOpen: j,
|
|
128
|
+
onClose: V,
|
|
129
|
+
onChange: (i, r) => {
|
|
130
|
+
console.log("onChange optiion*", r), w && w(r), f(m(r)), e(r);
|
|
131
|
+
},
|
|
132
|
+
filterOptions: a ? (i) => i : void 0,
|
|
133
|
+
loading: L,
|
|
134
|
+
loadingText: k("rhf_autocomplete.loading_options"),
|
|
135
|
+
disabled: E,
|
|
136
|
+
noOptionsText: k("rhf_autocomplete.no_options"),
|
|
137
|
+
renderOption: A ? ne(_, C, I) : void 0,
|
|
138
|
+
renderInput: (i) => (console.log("renderInput parms", l, i.inputProps.value), /* @__PURE__ */ n(N, {
|
|
139
|
+
...i,
|
|
140
|
+
label: s,
|
|
141
|
+
fullWidth: !0,
|
|
142
|
+
SelectProps: {
|
|
143
|
+
native: !0
|
|
144
|
+
},
|
|
145
|
+
InputProps: {
|
|
146
|
+
...i.InputProps,
|
|
147
|
+
startAdornment: A && o ? /* @__PURE__ */ n(v, {
|
|
148
|
+
src: _(o),
|
|
149
|
+
width: C,
|
|
150
|
+
height: I
|
|
151
|
+
}, "ImageTextField") : null,
|
|
152
|
+
endAdornment: /* @__PURE__ */ O(Y, {
|
|
153
|
+
children: [L ? /* @__PURE__ */ n(J, {
|
|
154
|
+
color: "inherit",
|
|
155
|
+
size: 20
|
|
156
|
+
}) : null, i.InputProps.endAdornment]
|
|
157
|
+
})
|
|
158
|
+
},
|
|
159
|
+
autoComplete: "off",
|
|
160
|
+
error: !!R,
|
|
161
|
+
helperText: R?.message,
|
|
162
|
+
...H
|
|
163
|
+
}))
|
|
164
|
+
})
|
|
165
|
+
});
|
|
166
|
+
}
|
|
167
|
+
});
|
|
168
|
+
}
|
|
169
|
+
export {
|
|
170
|
+
de as R
|
|
171
|
+
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
import { AutocompleteCloseReason, TextFieldProps } from '@mui/material';
|
|
2
|
+
import { AutocompleteCloseReason, AutocompleteInputChangeReason, TextFieldProps } from '@mui/material';
|
|
3
3
|
export declare type GetOptionString<T> = (option: T | null) => string;
|
|
4
4
|
export declare type RHFAutocompleteProps<T> = {
|
|
5
5
|
name: string;
|
|
@@ -15,4 +15,6 @@ export declare type RHFAutocompleteProps<T> = {
|
|
|
15
15
|
loading?: boolean;
|
|
16
16
|
onOpen?: (event: React.SyntheticEvent) => void;
|
|
17
17
|
onClose?: (event: React.SyntheticEvent, reason: AutocompleteCloseReason) => void;
|
|
18
|
+
onChangeFilterParmsLocal?: (newValue: string, reason: AutocompleteInputChangeReason) => void;
|
|
19
|
+
onChangeOption?: (newValue: T) => void;
|
|
18
20
|
} & TextFieldProps;
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import { useState as o, useCallback as H, useEffect as p } from "react";
|
|
2
|
+
import { useNetwork as N, getPropertyByString as k } from "@m4l/core";
|
|
3
|
+
import { useFormContext as w } from "react-hook-form";
|
|
4
|
+
import x from "lodash/debounce";
|
|
5
|
+
import { R as S } from "../RHFAutocomplete/index.ee3d9b3c.js";
|
|
6
|
+
import { jsx as I } from "react/jsx-runtime";
|
|
7
|
+
function J(O) {
|
|
8
|
+
const {
|
|
9
|
+
name: d,
|
|
10
|
+
endPoint: t,
|
|
11
|
+
timeout: g = 5e3,
|
|
12
|
+
parms: s,
|
|
13
|
+
resultField: F = "data",
|
|
14
|
+
isRemote: A = !0,
|
|
15
|
+
onChangeFilterParms: n,
|
|
16
|
+
...C
|
|
17
|
+
} = O;
|
|
18
|
+
w();
|
|
19
|
+
const {
|
|
20
|
+
networkOperation: P
|
|
21
|
+
} = N(), [h, r] = o([]), [a, m] = o(!1), [l, c] = o(!1), [u, i] = o(!0), [f, R] = o({}), y = H(x((e) => {
|
|
22
|
+
console.debug("setCanLoadOptions", !0), i(!0), console.log("New parms:", e), R(e);
|
|
23
|
+
}, 300), []), L = (e) => {
|
|
24
|
+
n && y(n(e));
|
|
25
|
+
};
|
|
26
|
+
return p(() => {
|
|
27
|
+
console.log("useEffect RHFAutocompleteAsync Parms", s, t), r([]), i(!0);
|
|
28
|
+
}, [s, t]), p(() => {
|
|
29
|
+
let e = !0;
|
|
30
|
+
if (console.log("useEffect RHFAutocompleteAsync", a, l, u), !(!a || l)) {
|
|
31
|
+
if (!u) {
|
|
32
|
+
console.log("****NO LOAD OPTIONS***");
|
|
33
|
+
return;
|
|
34
|
+
}
|
|
35
|
+
return c(!0), r([]), i(!1), P({
|
|
36
|
+
method: "GET",
|
|
37
|
+
endPoint: t,
|
|
38
|
+
timeout: g,
|
|
39
|
+
parms: {
|
|
40
|
+
...s,
|
|
41
|
+
...f
|
|
42
|
+
},
|
|
43
|
+
isRemote: A
|
|
44
|
+
}).then((b) => {
|
|
45
|
+
if (e) {
|
|
46
|
+
const E = k(b, F);
|
|
47
|
+
r(E);
|
|
48
|
+
}
|
|
49
|
+
}).catch(() => {
|
|
50
|
+
console.error("OJOOOO ");
|
|
51
|
+
}).finally(() => {
|
|
52
|
+
e && c(!1);
|
|
53
|
+
}), () => {
|
|
54
|
+
e = !1, c(!1);
|
|
55
|
+
};
|
|
56
|
+
}
|
|
57
|
+
}, [a, s, f, t]), /* @__PURE__ */ I(S, {
|
|
58
|
+
name: d,
|
|
59
|
+
loading: l,
|
|
60
|
+
options: h,
|
|
61
|
+
onChangeFilterParmsLocal: n ? L : void 0,
|
|
62
|
+
onOpen: () => {
|
|
63
|
+
m(!0);
|
|
64
|
+
},
|
|
65
|
+
onClose: () => {
|
|
66
|
+
m(!1);
|
|
67
|
+
},
|
|
68
|
+
...C
|
|
69
|
+
});
|
|
70
|
+
}
|
|
71
|
+
export {
|
|
72
|
+
J as R
|
|
73
|
+
};
|
|
@@ -5,4 +5,5 @@ export declare type RHFAutocompleteAsyncProps<T> = {
|
|
|
5
5
|
parms?: Record<string, any>;
|
|
6
6
|
resultField?: string;
|
|
7
7
|
isRemote?: boolean;
|
|
8
|
-
|
|
8
|
+
onChangeFilterParms?: (newValue: string) => Record<string, any>;
|
|
9
|
+
} & Omit<RHFAutocompleteProps<T>, 'options' | 'onChangeSearchInput'>;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { styled as m } from "@mui/material";
|
|
2
2
|
import { useFormContext as a, Controller as l } from "react-hook-form";
|
|
3
3
|
import { E as f } from "../../ErrorLabel/index.c8615f16.js";
|
|
4
|
-
import { P as p } from "../../Period/index.
|
|
4
|
+
import { P as p } from "../../Period/index.ba6c0e11.js";
|
|
5
5
|
import { jsx as t, jsxs as c } from "react/jsx-runtime";
|
|
6
6
|
const d = m("div")(({
|
|
7
7
|
theme: e
|