@m4l/components 0.1.12 → 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.
- package/assets/Logo/index.228dcb5a.js +86 -0
- package/commonjs.565e6834.js +12 -0
- package/components/CommonActions/components/ActionCancel/index.cba1b460.js +17 -0
- package/components/CommonActions/components/ActionFormCancel/index.be2fe891.js +49 -0
- package/components/CommonActions/components/ActionFormIntro/index.ca4d2674.js +31 -0
- package/components/CommonActions/components/ActionIntro/index.cc4b1e0e.js +18 -0
- package/components/CommonActions/components/Actions/index.e8148d98.js +743 -0
- package/components/CompanyLogo/{index.js → index.f81c179c.js} +42 -48
- package/components/DataGrid/index.b688877d.js +894 -0
- package/components/DynamicFilter/index.82ce857e.js +1158 -0
- package/components/ErrorLabel/index.c8615f16.js +19 -0
- package/components/Icon/index.cbca79b0.js +70 -0
- package/components/Image/index.e790b50b.js +122 -0
- package/components/LanguagePopover/index.3d9611cb.js +87 -0
- package/components/Loadable/index.f5518558.js +15 -0
- package/components/ModalDialog/index.3850c053.js +168 -0
- package/components/NoItemSelected/{index.js → index.12f0ca67.js} +43 -50
- package/components/ObjectLogs/index.27ef875d.js +266 -0
- package/components/Page/index.6d69977e.js +35 -0
- package/components/Page/index.d.ts +1 -1
- package/components/PaperForm/index.d7c74064.js +105 -0
- package/components/Period/index.5e68286a.js +160 -0
- package/components/PropertyValue/index.ab3dd7e9.js +116 -0
- package/components/Resizeable/{index.js → index.45995d2b.js} +21 -19
- package/components/ScrollBar/index.39eeb2de.js +49 -0
- package/components/ScrollToTop/index.e06f98f6.js +11 -0
- package/components/SplitLayout/{index.js → index.4032673d.js} +35 -35
- package/components/animate/IconButtonAnimate/index.d.ts +1 -1
- package/components/animate/LoadingScreen/{index.js → index.f1cec7db.js} +29 -27
- package/components/animate/MotionContainer/index.8d9f9d80.js +30 -0
- package/components/animate/MotionLazyContainer/index.572dd012.js +15 -0
- package/components/animate/features.0fbf41e1.js +5 -0
- package/components/animate/variants/{bounce.js → bounce.784aaaaa.js} +15 -16
- package/components/animate/variants/container.11f82b76.js +20 -0
- package/components/animate/variants/fade.b561c0fc.js +59 -0
- package/components/animate/variants/{index.js → index.7a912140.js} +0 -0
- package/components/animate/variants/transition.bd46b9ce.js +15 -0
- package/components/formatters/BooleanFormatter/index.cca53b7f.js +42 -0
- package/components/formatters/DateFormatter/index.ad8d9b8e.js +57 -0
- package/components/formatters/index.55856d65.js +106 -0
- package/components/hook-form/FormProvider/index.257acd9f.js +55 -0
- package/components/hook-form/RHFAutocomplete/index.6ed76d4c.js +122 -0
- package/components/hook-form/RHFAutocompleteAsync/index.8f2c97ea.js +153 -0
- package/components/hook-form/RHFCheckbox/index.f9ce6c39.js +59 -0
- package/components/hook-form/RHFDateTime/index.fc5cbafe.js +68 -0
- package/components/hook-form/RHFMultiCheckbox/index.2680b3b6.js +34 -0
- package/components/hook-form/RHFPeriod/index.23c254e9.js +45 -0
- package/components/hook-form/RHFRadioGroup/index.b3335e13.js +43 -0
- package/components/hook-form/RHFSelect/index.b6ca8bb2.js +36 -0
- package/components/hook-form/RHFTextField/index.4c455f75.js +77 -0
- package/components/hook-form/RHFTextField/index.d.ts +1 -1
- package/components/hook-form/RHFUpload/index.ed3d739f.js +244 -0
- package/components/mui_extended/Accordion/index.2116e423.js +103 -0
- package/components/mui_extended/Avatar/index.0a2a4523.js +32 -0
- package/components/mui_extended/Avatar/index.d.ts +1 -1
- package/components/mui_extended/BoxIcon/index.e638ecc8.js +22 -0
- package/components/mui_extended/Breadcrumbs/index.5e37d903.js +89 -0
- package/components/mui_extended/Button/index.84d8898c.js +110 -0
- package/components/mui_extended/IconButton/index.88f3aadb.js +98 -0
- package/components/mui_extended/LinkWithRoute/index.d4b263de.js +28 -0
- package/components/mui_extended/MenuPopover/index.488fc536.js +131 -0
- package/components/mui_extended/Pager/index.0576814f.js +126 -0
- package/components/mui_extended/Tab/index.e0653a0a.js +28 -0
- package/components/mui_extended/Typography/index.0c4604b3.js +22 -0
- package/contexts/ModalContext/index.2188b69e.js +150 -0
- package/hooks/useFormAddEdit/index.d4845f1a.js +26 -0
- package/hooks/useModal/index.6571d2d9.js +6 -0
- package/index.js +162 -70
- package/lodash.e09401f0.js +32 -0
- package/node_modules.168cb897.js +55 -0
- package/package.json +1 -1
- package/react-data-grid.d46d625e.js +2115 -0
- package/react-draggable.20e95c61.js +714 -0
- package/react-json-view.f56a7f8e.js +2762 -0
- package/react-lazy-load-image-component.45b56650.js +784 -0
- package/react-resizable.5277deaf.js +371 -0
- package/react-splitter-layout.7810ac1b.js +165 -0
- package/utils/index.214d9542.js +435 -0
- package/assets/Logo/index.js +0 -91
- package/commonjs.js +0 -9
- package/components/CommonActions/components/ActionCancel/index.js +0 -15
- package/components/CommonActions/components/ActionFormCancel/index.js +0 -62
- package/components/CommonActions/components/ActionFormIntro/index.js +0 -35
- package/components/CommonActions/components/ActionIntro/index.js +0 -16
- package/components/CommonActions/components/Actions/index.js +0 -859
- package/components/DataGrid/index.js +0 -1067
- package/components/DynamicFilter/index.js +0 -1573
- package/components/ErrorLabel/index.js +0 -18
- package/components/Icon/index.js +0 -80
- package/components/Image/index.js +0 -128
- package/components/LanguagePopover/index.js +0 -93
- package/components/Loadable/index.js +0 -13
- package/components/ModalDialog/index.js +0 -180
- package/components/ObjectLogs/index.js +0 -284
- package/components/Page/index.js +0 -36
- package/components/PaperForm/index.js +0 -110
- package/components/Period/index.js +0 -230
- package/components/PropertyValue/index.js +0 -142
- package/components/ScrollBar/index.js +0 -52
- package/components/ScrollToTop/index.js +0 -10
- package/components/animate/MotionContainer/index.js +0 -31
- package/components/animate/MotionLazyContainer/index.js +0 -13
- package/components/animate/features.js +0 -2
- package/components/animate/variants/container.js +0 -20
- package/components/animate/variants/fade.js +0 -61
- package/components/animate/variants/transition.js +0 -16
- package/components/formatters/BooleanFormatter/index.js +0 -52
- package/components/formatters/DateFormatter/index.js +0 -66
- package/components/formatters/index.js +0 -112
- package/components/hook-form/FormProvider/index.js +0 -61
- package/components/hook-form/RHFAutocomplete/index.js +0 -144
- package/components/hook-form/RHFAutocompleteAsync/index.js +0 -191
- package/components/hook-form/RHFCheckbox/index.js +0 -65
- package/components/hook-form/RHFDateTime/index.js +0 -79
- package/components/hook-form/RHFMultiCheckbox/index.js +0 -32
- package/components/hook-form/RHFPeriod/index.js +0 -47
- package/components/hook-form/RHFRadioGroup/index.js +0 -41
- package/components/hook-form/RHFSelect/index.js +0 -34
- package/components/hook-form/RHFTextField/index.js +0 -87
- package/components/hook-form/RHFUpload/index.js +0 -255
- package/components/mui_extended/Accordion/index.js +0 -105
- package/components/mui_extended/Avatar/index.js +0 -33
- package/components/mui_extended/BoxIcon/index.js +0 -20
- package/components/mui_extended/Breadcrumbs/index.js +0 -92
- package/components/mui_extended/Button/index.js +0 -131
- package/components/mui_extended/IconButton/index.js +0 -108
- package/components/mui_extended/LinkWithRoute/index.js +0 -30
- package/components/mui_extended/MenuPopover/index.js +0 -135
- package/components/mui_extended/Pager/index.js +0 -137
- package/components/mui_extended/Tab/index.js +0 -30
- package/components/mui_extended/Typography/index.js +0 -21
- package/contexts/ModalContext/index.js +0 -165
- package/hooks/useFormAddEdit/index.js +0 -42
- package/hooks/useModal/index.js +0 -4
- package/lodash.js +0 -62
- package/node_modules.js +0 -54
- package/react-data-grid.js +0 -2652
- package/react-draggable.js +0 -960
- package/react-json-view.js +0 -2764
- package/react-lazy-load-image-component.js +0 -792
- package/react-resizable.js +0 -541
- package/react-splitter-layout.js +0 -165
- package/utils/index.js +0 -572
|
@@ -1,165 +0,0 @@
|
|
|
1
|
-
import { createContext, useState } from "react";
|
|
2
|
-
import { useEnvironment, voidFunction } from "@m4l/core";
|
|
3
|
-
import { Typography } from "@mui/material";
|
|
4
|
-
import { styled } from "@mui/material/styles";
|
|
5
|
-
import { B as BoxIcon } from "../../components/mui_extended/BoxIcon/index.js";
|
|
6
|
-
import { jsx, jsxs, Fragment } from "react/jsx-runtime";
|
|
7
|
-
import { M as ModalDialog } from "../../components/ModalDialog/index.js";
|
|
8
|
-
import { A as ActionIntro } from "../../components/CommonActions/components/ActionIntro/index.js";
|
|
9
|
-
import { A as ActionCancel } from "../../components/CommonActions/components/ActionCancel/index.js";
|
|
10
|
-
import { b as getVariantColor } from "../../utils/index.js";
|
|
11
|
-
const WrapperContentConfirm = styled("div")(() => ({
|
|
12
|
-
display: "flex",
|
|
13
|
-
flexDirection: "column",
|
|
14
|
-
height: "100%"
|
|
15
|
-
}));
|
|
16
|
-
const ModalContent = styled("div")(({
|
|
17
|
-
theme
|
|
18
|
-
}) => ({
|
|
19
|
-
display: "flex",
|
|
20
|
-
flexDirection: "column",
|
|
21
|
-
justifyContent: "center",
|
|
22
|
-
alignItems: "center",
|
|
23
|
-
gridGap: theme.spacing(5),
|
|
24
|
-
flexGrow: 1,
|
|
25
|
-
[theme.breakpoints.up("sm")]: {
|
|
26
|
-
display: "grid",
|
|
27
|
-
flexDirection: "row",
|
|
28
|
-
gridTemplateColumns: "1fr 1fr"
|
|
29
|
-
}
|
|
30
|
-
}));
|
|
31
|
-
const IllustrationContainer = styled("div")(({
|
|
32
|
-
theme,
|
|
33
|
-
variant
|
|
34
|
-
}) => ({
|
|
35
|
-
display: "flex",
|
|
36
|
-
justifyContent: "center",
|
|
37
|
-
alignItems: "center",
|
|
38
|
-
"& > span": {
|
|
39
|
-
background: variant === "warning" ? theme.palette.warning.main : variant === "delete" ? theme.palette.error.main : variant === "info" ? theme.palette.info.main : "theme.palette.text.primary"
|
|
40
|
-
}
|
|
41
|
-
}));
|
|
42
|
-
const MessageContainer = styled("div")(() => ({
|
|
43
|
-
display: "flex",
|
|
44
|
-
alignItems: "center"
|
|
45
|
-
}));
|
|
46
|
-
const ContentConfirm = (props) => {
|
|
47
|
-
const {
|
|
48
|
-
variant = "info",
|
|
49
|
-
msg = "Are you sure you want to perform this action? Once complete, the information will be deleted."
|
|
50
|
-
} = props;
|
|
51
|
-
const {
|
|
52
|
-
host_static_assets,
|
|
53
|
-
environment_assets
|
|
54
|
-
} = useEnvironment();
|
|
55
|
-
const illustrationWarning = `${host_static_assets}/${environment_assets}/frontend/components/dialog/assets/icons/illustration_confirm_warning.svg`;
|
|
56
|
-
const illustrationError = `${host_static_assets}/${environment_assets}/frontend/components/dialog/assets/icons/illustration_confirm_danger.svg`;
|
|
57
|
-
const illustrationInfo = `${host_static_assets}/${environment_assets}/frontend/components/dialog/assets/icons/illustration_confirm_info.svg`;
|
|
58
|
-
return /* @__PURE__ */ jsx(WrapperContentConfirm, {
|
|
59
|
-
children: /* @__PURE__ */ jsxs(ModalContent, {
|
|
60
|
-
children: [/* @__PURE__ */ jsx(IllustrationContainer, {
|
|
61
|
-
variant,
|
|
62
|
-
children: /* @__PURE__ */ jsx(BoxIcon, {
|
|
63
|
-
src: variant === "warning" ? illustrationWarning : variant === "delete" ? illustrationError : illustrationInfo,
|
|
64
|
-
sx: {
|
|
65
|
-
width: "230px",
|
|
66
|
-
height: "194px"
|
|
67
|
-
}
|
|
68
|
-
})
|
|
69
|
-
}), /* @__PURE__ */ jsx(MessageContainer, {
|
|
70
|
-
children: /* @__PURE__ */ jsx(Typography, {
|
|
71
|
-
variant: "body1",
|
|
72
|
-
children: msg
|
|
73
|
-
})
|
|
74
|
-
})]
|
|
75
|
-
})
|
|
76
|
-
});
|
|
77
|
-
};
|
|
78
|
-
const initialState = {
|
|
79
|
-
initialWidth: 600,
|
|
80
|
-
initialHeigth: 400,
|
|
81
|
-
open: false,
|
|
82
|
-
withClose: true,
|
|
83
|
-
onQueryClose: voidFunction,
|
|
84
|
-
iconComponent: void 0,
|
|
85
|
-
contentComponent: void 0,
|
|
86
|
-
openModal: voidFunction,
|
|
87
|
-
openModalConfirm: voidFunction,
|
|
88
|
-
closeModal: voidFunction,
|
|
89
|
-
hasChanges: false,
|
|
90
|
-
setChanges: voidFunction,
|
|
91
|
-
title: ""
|
|
92
|
-
};
|
|
93
|
-
const ModalContext = createContext(initialState);
|
|
94
|
-
function ModalProvider({
|
|
95
|
-
children
|
|
96
|
-
}) {
|
|
97
|
-
const [modalOptions, setModalOptions] = useState({
|
|
98
|
-
open: initialState.open,
|
|
99
|
-
withClose: true,
|
|
100
|
-
onQueryClose: voidFunction,
|
|
101
|
-
title: "",
|
|
102
|
-
iconComponent: void 0,
|
|
103
|
-
contentComponent: void 0,
|
|
104
|
-
variant: void 0
|
|
105
|
-
});
|
|
106
|
-
const [hasChanges, setHasChanges] = useState(false);
|
|
107
|
-
const openModal = (modalOpenProps) => {
|
|
108
|
-
setModalOptions({
|
|
109
|
-
open: true,
|
|
110
|
-
...modalOpenProps
|
|
111
|
-
});
|
|
112
|
-
};
|
|
113
|
-
const openModalConfirm = (modalOpenConfirmProps) => {
|
|
114
|
-
const {
|
|
115
|
-
variant = "warning",
|
|
116
|
-
title,
|
|
117
|
-
msg,
|
|
118
|
-
onClickIntro,
|
|
119
|
-
onClickCancel = closeModal
|
|
120
|
-
} = modalOpenConfirmProps;
|
|
121
|
-
const onClickIntroClose = () => {
|
|
122
|
-
onClickIntro && onClickIntro();
|
|
123
|
-
closeModal();
|
|
124
|
-
};
|
|
125
|
-
setModalOptions({
|
|
126
|
-
open: true,
|
|
127
|
-
title,
|
|
128
|
-
variant,
|
|
129
|
-
contentComponent: /* @__PURE__ */ jsx(ContentConfirm, {
|
|
130
|
-
variant,
|
|
131
|
-
msg
|
|
132
|
-
}),
|
|
133
|
-
actions: /* @__PURE__ */ jsxs(Fragment, {
|
|
134
|
-
children: [/* @__PURE__ */ jsx(ActionCancel, {
|
|
135
|
-
onClick: onClickCancel
|
|
136
|
-
}), " ", /* @__PURE__ */ jsx(ActionIntro, {
|
|
137
|
-
onClick: onClickIntroClose,
|
|
138
|
-
color: getVariantColor(variant)
|
|
139
|
-
})]
|
|
140
|
-
})
|
|
141
|
-
});
|
|
142
|
-
};
|
|
143
|
-
const closeModal = () => {
|
|
144
|
-
setModalOptions((last) => ({
|
|
145
|
-
...last,
|
|
146
|
-
open: false
|
|
147
|
-
}));
|
|
148
|
-
setHasChanges(false);
|
|
149
|
-
};
|
|
150
|
-
const setChanges = () => {
|
|
151
|
-
setHasChanges(true);
|
|
152
|
-
};
|
|
153
|
-
return /* @__PURE__ */ jsxs(ModalContext.Provider, {
|
|
154
|
-
value: {
|
|
155
|
-
...modalOptions,
|
|
156
|
-
openModal,
|
|
157
|
-
openModalConfirm,
|
|
158
|
-
closeModal,
|
|
159
|
-
hasChanges,
|
|
160
|
-
setChanges
|
|
161
|
-
},
|
|
162
|
-
children: [children, /* @__PURE__ */ jsx(ModalDialog, {})]
|
|
163
|
-
});
|
|
164
|
-
}
|
|
165
|
-
export { ModalContext as M, ModalProvider as a };
|
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
import { useNetwork, useFlags } from "@m4l/core";
|
|
2
|
-
import { useState, useEffect } from "react";
|
|
3
|
-
const useFormAddEdit = (props) => {
|
|
4
|
-
const { initialValues, objectId, endPoint, formatDataEnpoint } = props;
|
|
5
|
-
const [formValues, setFormValues] = useState(initialValues);
|
|
6
|
-
const [statusLoad, setStatusLoad] = useState(
|
|
7
|
-
objectId === void 0 ? "new" : "edit"
|
|
8
|
-
);
|
|
9
|
-
const { networkOperation } = useNetwork();
|
|
10
|
-
const { addFlag } = useFlags();
|
|
11
|
-
useEffect(() => {
|
|
12
|
-
let mounted = true;
|
|
13
|
-
if (statusLoad === "edit") {
|
|
14
|
-
networkOperation({
|
|
15
|
-
method: "GET",
|
|
16
|
-
endPoint: `${endPoint}/${objectId}`
|
|
17
|
-
}).then(
|
|
18
|
-
(response) => {
|
|
19
|
-
if (mounted) {
|
|
20
|
-
if (formatDataEnpoint) {
|
|
21
|
-
setFormValues(formatDataEnpoint(response));
|
|
22
|
-
} else {
|
|
23
|
-
setFormValues(response);
|
|
24
|
-
}
|
|
25
|
-
setStatusLoad("reload_values_provider");
|
|
26
|
-
}
|
|
27
|
-
},
|
|
28
|
-
() => {
|
|
29
|
-
setStatusLoad("error");
|
|
30
|
-
}
|
|
31
|
-
);
|
|
32
|
-
} else if (statusLoad === "new" || statusLoad === "reload_values_provider") {
|
|
33
|
-
addFlag("form_loaded");
|
|
34
|
-
setStatusLoad("ready");
|
|
35
|
-
}
|
|
36
|
-
return () => {
|
|
37
|
-
mounted = false;
|
|
38
|
-
};
|
|
39
|
-
}, [statusLoad]);
|
|
40
|
-
return { formValues, statusLoad };
|
|
41
|
-
};
|
|
42
|
-
export { useFormAddEdit as u };
|
package/hooks/useModal/index.js
DELETED
package/lodash.js
DELETED
|
@@ -1,62 +0,0 @@
|
|
|
1
|
-
import { c as commonjsGlobal } from "./commonjs.js";
|
|
2
|
-
var freeGlobal$1 = typeof commonjsGlobal == "object" && commonjsGlobal && commonjsGlobal.Object === Object && commonjsGlobal;
|
|
3
|
-
var _freeGlobal = freeGlobal$1;
|
|
4
|
-
var freeGlobal = _freeGlobal;
|
|
5
|
-
var freeSelf = typeof self == "object" && self && self.Object === Object && self;
|
|
6
|
-
var root$1 = freeGlobal || freeSelf || Function("return this")();
|
|
7
|
-
var _root = root$1;
|
|
8
|
-
var root = _root;
|
|
9
|
-
var Symbol$3 = root.Symbol;
|
|
10
|
-
var _Symbol = Symbol$3;
|
|
11
|
-
var Symbol$2 = _Symbol;
|
|
12
|
-
var objectProto$1 = Object.prototype;
|
|
13
|
-
var hasOwnProperty = objectProto$1.hasOwnProperty;
|
|
14
|
-
var nativeObjectToString$1 = objectProto$1.toString;
|
|
15
|
-
var symToStringTag$1 = Symbol$2 ? Symbol$2.toStringTag : void 0;
|
|
16
|
-
function getRawTag$1(value) {
|
|
17
|
-
var isOwn = hasOwnProperty.call(value, symToStringTag$1), tag = value[symToStringTag$1];
|
|
18
|
-
try {
|
|
19
|
-
value[symToStringTag$1] = void 0;
|
|
20
|
-
var unmasked = true;
|
|
21
|
-
} catch (e) {
|
|
22
|
-
}
|
|
23
|
-
var result = nativeObjectToString$1.call(value);
|
|
24
|
-
if (unmasked) {
|
|
25
|
-
if (isOwn) {
|
|
26
|
-
value[symToStringTag$1] = tag;
|
|
27
|
-
} else {
|
|
28
|
-
delete value[symToStringTag$1];
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
return result;
|
|
32
|
-
}
|
|
33
|
-
var _getRawTag = getRawTag$1;
|
|
34
|
-
var objectProto = Object.prototype;
|
|
35
|
-
var nativeObjectToString = objectProto.toString;
|
|
36
|
-
function objectToString$1(value) {
|
|
37
|
-
return nativeObjectToString.call(value);
|
|
38
|
-
}
|
|
39
|
-
var _objectToString = objectToString$1;
|
|
40
|
-
var Symbol$1 = _Symbol, getRawTag = _getRawTag, objectToString = _objectToString;
|
|
41
|
-
var nullTag = "[object Null]", undefinedTag = "[object Undefined]";
|
|
42
|
-
var symToStringTag = Symbol$1 ? Symbol$1.toStringTag : void 0;
|
|
43
|
-
function baseGetTag$1(value) {
|
|
44
|
-
if (value == null) {
|
|
45
|
-
return value === void 0 ? undefinedTag : nullTag;
|
|
46
|
-
}
|
|
47
|
-
return symToStringTag && symToStringTag in Object(value) ? getRawTag(value) : objectToString(value);
|
|
48
|
-
}
|
|
49
|
-
var _baseGetTag = baseGetTag$1;
|
|
50
|
-
var isArray$1 = Array.isArray;
|
|
51
|
-
var isArray_1 = isArray$1;
|
|
52
|
-
function isObjectLike$1(value) {
|
|
53
|
-
return value != null && typeof value == "object";
|
|
54
|
-
}
|
|
55
|
-
var isObjectLike_1 = isObjectLike$1;
|
|
56
|
-
var baseGetTag = _baseGetTag, isArray = isArray_1, isObjectLike = isObjectLike_1;
|
|
57
|
-
var stringTag = "[object String]";
|
|
58
|
-
function isString(value) {
|
|
59
|
-
return typeof value == "string" || !isArray(value) && isObjectLike(value) && baseGetTag(value) == stringTag;
|
|
60
|
-
}
|
|
61
|
-
var isString_1 = isString;
|
|
62
|
-
export { isString_1 as i };
|
package/node_modules.js
DELETED
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
import { get, set, appendErrors } from "react-hook-form";
|
|
2
|
-
var e = function(i, e2, t2) {
|
|
3
|
-
if (i && "reportValidity" in i) {
|
|
4
|
-
var f2 = get(t2, e2);
|
|
5
|
-
i.setCustomValidity(f2 && f2.message || ""), i.reportValidity();
|
|
6
|
-
}
|
|
7
|
-
}, t = function(r, i) {
|
|
8
|
-
var t2 = function(t3) {
|
|
9
|
-
var f3 = i.fields[t3];
|
|
10
|
-
f3 && f3.ref && "reportValidity" in f3.ref ? e(f3.ref, t3, r) : f3.refs && f3.refs.forEach(function(i2) {
|
|
11
|
-
return e(i2, t3, r);
|
|
12
|
-
});
|
|
13
|
-
};
|
|
14
|
-
for (var f2 in i.fields)
|
|
15
|
-
t2(f2);
|
|
16
|
-
}, f = function(e2, f2) {
|
|
17
|
-
f2.shouldUseNativeValidation && t(e2, f2);
|
|
18
|
-
var o2 = {};
|
|
19
|
-
for (var a in e2) {
|
|
20
|
-
var n = get(f2.fields, a);
|
|
21
|
-
set(o2, a, Object.assign(e2[a], { ref: n && n.ref }));
|
|
22
|
-
}
|
|
23
|
-
return o2;
|
|
24
|
-
};
|
|
25
|
-
var o = function(o2, n, a) {
|
|
26
|
-
return void 0 === n && (n = {}), void 0 === a && (a = {}), function(s, i, c) {
|
|
27
|
-
try {
|
|
28
|
-
return Promise.resolve(function(t$1, r) {
|
|
29
|
-
try {
|
|
30
|
-
var u = (n.context && false, Promise.resolve(o2["sync" === a.mode ? "validateSync" : "validate"](s, Object.assign({ abortEarly: false }, n, { context: i }))).then(function(t$12) {
|
|
31
|
-
return c.shouldUseNativeValidation && t({}, c), { values: a.rawValues ? s : t$12, errors: {} };
|
|
32
|
-
}));
|
|
33
|
-
} catch (e2) {
|
|
34
|
-
return r(e2);
|
|
35
|
-
}
|
|
36
|
-
return u && u.then ? u.then(void 0, r) : u;
|
|
37
|
-
}(0, function(e2) {
|
|
38
|
-
if (!e2.inner)
|
|
39
|
-
throw e2;
|
|
40
|
-
return { values: {}, errors: f((o3 = e2, n2 = !c.shouldUseNativeValidation && "all" === c.criteriaMode, (o3.inner || []).reduce(function(e3, t2) {
|
|
41
|
-
if (e3[t2.path] || (e3[t2.path] = { message: t2.message, type: t2.type }), n2) {
|
|
42
|
-
var o4 = e3[t2.path].types, a2 = o4 && o4[t2.type];
|
|
43
|
-
e3[t2.path] = appendErrors(t2.path, n2, e3, t2.type, a2 ? [].concat(a2, t2.message) : t2.message);
|
|
44
|
-
}
|
|
45
|
-
return e3;
|
|
46
|
-
}, {})), c) };
|
|
47
|
-
var o3, n2;
|
|
48
|
-
}));
|
|
49
|
-
} catch (e2) {
|
|
50
|
-
return Promise.reject(e2);
|
|
51
|
-
}
|
|
52
|
-
};
|
|
53
|
-
};
|
|
54
|
-
export { o };
|