@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
|
@@ -0,0 +1,1158 @@
|
|
|
1
|
+
import { S as Be } from "../ScrollBar/index.39eeb2de.js";
|
|
2
|
+
import { styled as h } from "@mui/material/styles";
|
|
3
|
+
import qe, { useRef as me, useState as S, useMemo as E, useCallback as _, useEffect as L, createContext as Ne, useContext as He } from "react";
|
|
4
|
+
import { useModuleDictionary as $, useHostTools as z, useEnvironment as j, voidFunction as V, useFlagsPresent as Ke } from "@m4l/core";
|
|
5
|
+
import * as w from "yup";
|
|
6
|
+
import { useFormContext as M, useWatch as ge } from "react-hook-form";
|
|
7
|
+
import { F as ze } from "../hook-form/FormProvider/index.257acd9f.js";
|
|
8
|
+
import { jsx as r, jsxs as C, Fragment as A } from "react/jsx-runtime";
|
|
9
|
+
import { R } from "../hook-form/RHFAutocomplete/index.6ed76d4c.js";
|
|
10
|
+
import { alpha as Ye, styled as be, Skeleton as Fe, MenuItem as Ge, useTheme as Ue, Popper as Je } from "@mui/material";
|
|
11
|
+
import "../hook-form/RHFAutocompleteAsync/index.8f2c97ea.js";
|
|
12
|
+
import "../hook-form/RHFCheckbox/index.f9ce6c39.js";
|
|
13
|
+
import { R as ee } from "../hook-form/RHFDateTime/index.fc5cbafe.js";
|
|
14
|
+
import "@mui/x-date-pickers";
|
|
15
|
+
import { R as Y } from "../hook-form/RHFTextField/index.4c455f75.js";
|
|
16
|
+
import "../hook-form/RHFPeriod/index.23c254e9.js";
|
|
17
|
+
import "../ErrorLabel/index.c8615f16.js";
|
|
18
|
+
import "../Period/index.5e68286a.js";
|
|
19
|
+
import { I as he } from "../Icon/index.cbca79b0.js";
|
|
20
|
+
import { L as Qe, b as Xe, g as Ze } from "../CommonActions/components/Actions/index.e8148d98.js";
|
|
21
|
+
import "@mui/material/Button";
|
|
22
|
+
import { F as te } from "../mui_extended/Button/index.84d8898c.js";
|
|
23
|
+
import "react-router-dom";
|
|
24
|
+
import "../../contexts/ModalContext/index.2188b69e.js";
|
|
25
|
+
import "@mui/lab";
|
|
26
|
+
import "../../lodash.e09401f0.js";
|
|
27
|
+
import "react-dropzone";
|
|
28
|
+
import "../../react-lazy-load-image-component.45b56650.js";
|
|
29
|
+
import "../Image/index.e790b50b.js";
|
|
30
|
+
import "../hook-form/RHFUpload/index.ed3d739f.js";
|
|
31
|
+
import { I as G } from "../mui_extended/IconButton/index.88f3aadb.js";
|
|
32
|
+
import "simplebar/dist/simplebar.min.css";
|
|
33
|
+
import { M as et } from "../mui_extended/MenuPopover/index.488fc536.js";
|
|
34
|
+
import { A as tt } from "../CommonActions/components/ActionCancel/index.cba1b460.js";
|
|
35
|
+
import { A as rt } from "../CommonActions/components/ActionIntro/index.cc4b1e0e.js";
|
|
36
|
+
import { useResponsiveDesktop as nt } from "@m4l/graphics";
|
|
37
|
+
const re = h("div")(({
|
|
38
|
+
theme: e
|
|
39
|
+
}) => ({
|
|
40
|
+
width: "100%",
|
|
41
|
+
margin: e.spacing(0, 1),
|
|
42
|
+
paddingLeft: e.spacing(1),
|
|
43
|
+
borderLeft: `1px solid ${e.palette.divider}`
|
|
44
|
+
})), ot = h("div")(({
|
|
45
|
+
theme: e
|
|
46
|
+
}) => ({
|
|
47
|
+
width: "100%",
|
|
48
|
+
display: "flex",
|
|
49
|
+
justifyContent: "flex-start",
|
|
50
|
+
alignItems: "center",
|
|
51
|
+
height: "auto",
|
|
52
|
+
gap: e.spacing(1.5)
|
|
53
|
+
})), ye = ["c", "nc"], ve = ["b", "e", "ne", "gt", "gte", "lt", "lte"], Oe = ["e", "ne"], _e = [
|
|
54
|
+
"b",
|
|
55
|
+
"e",
|
|
56
|
+
"ne",
|
|
57
|
+
"gt",
|
|
58
|
+
"gte",
|
|
59
|
+
"lt",
|
|
60
|
+
"lte"
|
|
61
|
+
], xe = {
|
|
62
|
+
name: "all",
|
|
63
|
+
label: "dynamic_filter.all_fields",
|
|
64
|
+
urlIcon: "https://s3.amazonaws.com/static.made4labs/environments/d1/frontend/components/icon/assets/icons/default.svg",
|
|
65
|
+
type: "string",
|
|
66
|
+
multiple: !0,
|
|
67
|
+
presence: "optional"
|
|
68
|
+
}, it = h("div")(({
|
|
69
|
+
theme: e
|
|
70
|
+
}) => ({
|
|
71
|
+
display: "flex",
|
|
72
|
+
flexDirection: "column",
|
|
73
|
+
justifyContent: "center",
|
|
74
|
+
alignItems: "center",
|
|
75
|
+
width: "100%",
|
|
76
|
+
minWidth: e.spacing(3.75),
|
|
77
|
+
padding: e.spacing(3, 0),
|
|
78
|
+
gap: e.spacing(3)
|
|
79
|
+
})), at = h("div")(() => ({
|
|
80
|
+
width: "100%"
|
|
81
|
+
})), lt = (e, t, n) => {
|
|
82
|
+
const o = e.defaultOperand1, i = {
|
|
83
|
+
id: 0,
|
|
84
|
+
n: e.name,
|
|
85
|
+
fixed: t,
|
|
86
|
+
isSetted: !1,
|
|
87
|
+
o: "c",
|
|
88
|
+
labelOperator: "",
|
|
89
|
+
o1: "",
|
|
90
|
+
o2: "",
|
|
91
|
+
labelOperands: ""
|
|
92
|
+
};
|
|
93
|
+
return o !== void 0 && typeof o == "string" && (i.o1 = o), i.labelOperands = i.o1 + "", i.labelOperator = n(`dynamic_filter.operator_${i.o}`), i;
|
|
94
|
+
};
|
|
95
|
+
function st() {
|
|
96
|
+
const {
|
|
97
|
+
popupData: {
|
|
98
|
+
filter: e,
|
|
99
|
+
field: t
|
|
100
|
+
},
|
|
101
|
+
setPoupEditValidationSchema: n,
|
|
102
|
+
setFnTransformFormValuesIntoValues: o,
|
|
103
|
+
getLabelOperator: i
|
|
104
|
+
} = T(), {
|
|
105
|
+
getLabel: a
|
|
106
|
+
} = $(), d = me(null), {
|
|
107
|
+
setValue: p
|
|
108
|
+
} = M(), [u, s] = S(!1), g = E(() => ye.map((l) => ({
|
|
109
|
+
id: l,
|
|
110
|
+
label: i(l)
|
|
111
|
+
})), [i]), y = _((l) => !e || !t ? void 0 : {
|
|
112
|
+
id: e.id,
|
|
113
|
+
n: t.name,
|
|
114
|
+
fixed: e.fixed,
|
|
115
|
+
isSetted: !0,
|
|
116
|
+
o: l.valueOperator.id,
|
|
117
|
+
labelOperator: l.valueOperator.label,
|
|
118
|
+
o1: l.valueOperand1,
|
|
119
|
+
labelOperands: l.valueOperand1
|
|
120
|
+
}, []);
|
|
121
|
+
return L(() => {
|
|
122
|
+
u || n({
|
|
123
|
+
valueOperator: w.object().nullable().required(a("operator_required")),
|
|
124
|
+
valueOperand1: w.string().required(a("operand_required"))
|
|
125
|
+
}), o(y), e && t && p("valueOperand1", e.o1, {
|
|
126
|
+
shouldTouch: !1,
|
|
127
|
+
shouldValidate: !1
|
|
128
|
+
}), s(!0);
|
|
129
|
+
}, [a, e, t]), L(() => {
|
|
130
|
+
d.current?.focus();
|
|
131
|
+
}, [u]), /* @__PURE__ */ r(it, {
|
|
132
|
+
children: u && /* @__PURE__ */ C(A, {
|
|
133
|
+
children: [/* @__PURE__ */ r(at, {
|
|
134
|
+
children: /* @__PURE__ */ r(R, {
|
|
135
|
+
name: "valueOperator",
|
|
136
|
+
autoComplete: "off",
|
|
137
|
+
options: g,
|
|
138
|
+
getOptionLabel: (l) => l.label,
|
|
139
|
+
isOptionEqualToValue: (l, b) => l.id === b.id,
|
|
140
|
+
label: ""
|
|
141
|
+
})
|
|
142
|
+
}), /* @__PURE__ */ r(Y, {
|
|
143
|
+
name: "valueOperand1",
|
|
144
|
+
ref: d,
|
|
145
|
+
focused: !0
|
|
146
|
+
})]
|
|
147
|
+
})
|
|
148
|
+
});
|
|
149
|
+
}
|
|
150
|
+
const dt = h("div")(({
|
|
151
|
+
theme: e
|
|
152
|
+
}) => ({
|
|
153
|
+
display: "flex",
|
|
154
|
+
flexDirection: "column",
|
|
155
|
+
justifyContent: "center",
|
|
156
|
+
alignItems: "center",
|
|
157
|
+
width: "100%",
|
|
158
|
+
minWidth: e.spacing(3.75),
|
|
159
|
+
height: "100%",
|
|
160
|
+
padding: e.spacing(3, 0),
|
|
161
|
+
gap: e.spacing(3)
|
|
162
|
+
})), ne = h("div")(() => ({
|
|
163
|
+
width: "100%"
|
|
164
|
+
})), pt = (e, t, n) => {
|
|
165
|
+
const o = e.defaultOperand1, i = {
|
|
166
|
+
id: 0,
|
|
167
|
+
n: e.name,
|
|
168
|
+
fixed: t,
|
|
169
|
+
isSetted: !0,
|
|
170
|
+
o: "e",
|
|
171
|
+
labelOperator: "",
|
|
172
|
+
o1: !0,
|
|
173
|
+
o2: "",
|
|
174
|
+
labelOperands: ""
|
|
175
|
+
};
|
|
176
|
+
return i.labelOperator = n(`dynamic_filter.operator_${i.o}`), o !== void 0 && typeof o == "boolean" && (i.o1 = o), i.labelOperands = n(`dynamic_filter.operand_${i.o1}`), i;
|
|
177
|
+
};
|
|
178
|
+
function ut() {
|
|
179
|
+
const {
|
|
180
|
+
setPoupEditValidationSchema: e,
|
|
181
|
+
setFnTransformFormValuesIntoValues: t,
|
|
182
|
+
getLabelOperator: n
|
|
183
|
+
} = T(), {
|
|
184
|
+
getLabel: o
|
|
185
|
+
} = $(), {
|
|
186
|
+
popupData: {
|
|
187
|
+
filter: i,
|
|
188
|
+
field: a
|
|
189
|
+
}
|
|
190
|
+
} = T(), {
|
|
191
|
+
setValue: d
|
|
192
|
+
} = M(), [p, u] = S(!1), s = E(() => Oe.map((l) => ({
|
|
193
|
+
id: l,
|
|
194
|
+
label: n(l)
|
|
195
|
+
})), [n]), g = E(() => [{
|
|
196
|
+
value: !0,
|
|
197
|
+
label: o("dynamic_filter.operand_true")
|
|
198
|
+
}, {
|
|
199
|
+
value: !1,
|
|
200
|
+
label: o("dynamic_filter.operand_false")
|
|
201
|
+
}], [o]), y = _((l) => !i || !a ? void 0 : {
|
|
202
|
+
id: i.id,
|
|
203
|
+
n: a.name,
|
|
204
|
+
fixed: i.fixed,
|
|
205
|
+
isSetted: !0,
|
|
206
|
+
o: l.valueOperator.id,
|
|
207
|
+
labelOperator: l.valueOperator.label,
|
|
208
|
+
o1: l.valueOperand1.value,
|
|
209
|
+
labelOperands: l.valueOperand1.label
|
|
210
|
+
}, []);
|
|
211
|
+
return L(() => {
|
|
212
|
+
p || e({
|
|
213
|
+
valueOperator: w.object().nullable().required(o("error_operator_required")),
|
|
214
|
+
valueOperand1: w.object().nullable().required(o("error_operand_required"))
|
|
215
|
+
}), t(y), i && a && d("valueOperand1", {
|
|
216
|
+
value: i.o1,
|
|
217
|
+
label: o(`dynamic_filter.operand_${i.o1}`)
|
|
218
|
+
}, {
|
|
219
|
+
shouldTouch: !1,
|
|
220
|
+
shouldValidate: !1
|
|
221
|
+
}), u(!0);
|
|
222
|
+
}, [o]), /* @__PURE__ */ r(dt, {
|
|
223
|
+
id: "WrapperAllFieldsFilter",
|
|
224
|
+
children: p && /* @__PURE__ */ C(A, {
|
|
225
|
+
children: [/* @__PURE__ */ r(ne, {
|
|
226
|
+
children: /* @__PURE__ */ r(R, {
|
|
227
|
+
name: "valueOperator",
|
|
228
|
+
autoComplete: "off",
|
|
229
|
+
options: s,
|
|
230
|
+
getOptionLabel: (l) => l.label,
|
|
231
|
+
isOptionEqualToValue: (l, b) => l.id === b.id,
|
|
232
|
+
label: ""
|
|
233
|
+
})
|
|
234
|
+
}), /* @__PURE__ */ r(ne, {
|
|
235
|
+
children: /* @__PURE__ */ r(R, {
|
|
236
|
+
name: "valueOperand1",
|
|
237
|
+
autoComplete: "off",
|
|
238
|
+
options: g,
|
|
239
|
+
getOptionLabel: (l) => l.label,
|
|
240
|
+
isOptionEqualToValue: (l, b) => l.value === b.value,
|
|
241
|
+
label: ""
|
|
242
|
+
})
|
|
243
|
+
})]
|
|
244
|
+
})
|
|
245
|
+
});
|
|
246
|
+
}
|
|
247
|
+
const ct = h("div")(({
|
|
248
|
+
theme: e
|
|
249
|
+
}) => ({
|
|
250
|
+
display: "flex",
|
|
251
|
+
flexDirection: "column",
|
|
252
|
+
justifyContent: "center",
|
|
253
|
+
alignItems: "center",
|
|
254
|
+
width: "100%",
|
|
255
|
+
minWidth: e.spacing(3.75),
|
|
256
|
+
padding: e.spacing(3, 0),
|
|
257
|
+
gap: e.spacing(3)
|
|
258
|
+
})), ft = h("div")(() => ({
|
|
259
|
+
width: "100%"
|
|
260
|
+
}));
|
|
261
|
+
function oe(e) {
|
|
262
|
+
return e && e instanceof Date;
|
|
263
|
+
}
|
|
264
|
+
const mt = (e) => !(typeof e.o != "string" || ye.findIndex((t) => t === e.o) === -1 || typeof e.o1 != "string"), gt = (e) => !(typeof e.o != "number" || ve.findIndex((t) => t === e.o) === -1 || typeof e.o1 != "number" || e.o === "b" && typeof e.o2 != "number"), bt = (e) => !(typeof e.o != "string" || Oe.findIndex((t) => t === e.o) === -1 || typeof e.o1 != "boolean"), Ft = (e) => !(typeof e.o != "string" || _e.findIndex((t) => t === e.o) === -1 || typeof e.o1 != "string" || e.o === "b" && typeof e.o2 != "string"), ht = (e, t, n, o) => {
|
|
265
|
+
const i = new Date(), a = new Date();
|
|
266
|
+
let d = e.defaultOperand1, p = e.defaultOperand2;
|
|
267
|
+
const u = {
|
|
268
|
+
id: 0,
|
|
269
|
+
n: e.name,
|
|
270
|
+
fixed: t,
|
|
271
|
+
isSetted: !0,
|
|
272
|
+
o: "b",
|
|
273
|
+
labelOperator: "",
|
|
274
|
+
o1: d,
|
|
275
|
+
o2: p,
|
|
276
|
+
labelOperands: ""
|
|
277
|
+
};
|
|
278
|
+
return d && (oe(d) ? i.setDate(d.getDate()) : d = void 0), d === void 0 && i.setHours(0, 0, 0, 0), p && (oe(p) ? a.setDate(p.getDate()) : p = void 0), p === void 0 && a.setHours(23, 59, 59, 999), u.o1 = i.toISOString(), u.o2 = a.toISOString(), u.labelOperands = `${o.formatDate(i, "yyyy-MM-dd HH:mm:ss")} - ${o.formatDate(a, "yyyy-MM-dd HH:mm:ss")}`, u.labelOperator = n(`dynamic_filter.operator_${u.o}`), u;
|
|
279
|
+
};
|
|
280
|
+
function yt() {
|
|
281
|
+
const {
|
|
282
|
+
setPoupEditValidationSchema: e,
|
|
283
|
+
setFnTransformFormValuesIntoValues: t,
|
|
284
|
+
getLabelOperator: n
|
|
285
|
+
} = T(), {
|
|
286
|
+
getLabel: o
|
|
287
|
+
} = $(), {
|
|
288
|
+
formatDate: i
|
|
289
|
+
} = z(), {
|
|
290
|
+
dfnsFormat: {
|
|
291
|
+
datetime_format: a
|
|
292
|
+
}
|
|
293
|
+
} = j(), {
|
|
294
|
+
popupData: {
|
|
295
|
+
filter: d,
|
|
296
|
+
field: p
|
|
297
|
+
}
|
|
298
|
+
} = T(), {
|
|
299
|
+
control: u,
|
|
300
|
+
setValue: s
|
|
301
|
+
} = M(), g = ge({
|
|
302
|
+
control: u,
|
|
303
|
+
name: "valueOperator"
|
|
304
|
+
}), [y, l] = S(!1), b = E(() => _e.map((c) => ({
|
|
305
|
+
id: c,
|
|
306
|
+
label: n(c)
|
|
307
|
+
})), [n]), f = _((c) => {
|
|
308
|
+
if (!d || !p)
|
|
309
|
+
return;
|
|
310
|
+
const x = {
|
|
311
|
+
id: d.id,
|
|
312
|
+
n: p.name,
|
|
313
|
+
fixed: d.fixed,
|
|
314
|
+
isSetted: !0,
|
|
315
|
+
o: c.valueOperator.id,
|
|
316
|
+
o1: c.valueOperand1.toISOString(),
|
|
317
|
+
labelOperator: c.valueOperator.label,
|
|
318
|
+
labelOperands: ""
|
|
319
|
+
};
|
|
320
|
+
return c.valueOperator.id === "b" ? (x.o2 = c.valueOperand2.toISOString(), x.labelOperands = `${i(c.valueOperand1, a)} - ${i(c.valueOperand2, a)}`) : (x.o2 = x.o2 ? x.o2 : x.o1, x.labelOperands = i(c.valueOperand1, a)), x;
|
|
321
|
+
}, []);
|
|
322
|
+
return L(() => {
|
|
323
|
+
y || e({
|
|
324
|
+
valueOperator: w.object().nullable().required(o("operator_required")),
|
|
325
|
+
valueOperand1: w.date().test("valueOperand1", o("dynamic_filter.error_invalid_date"), (c) => Boolean(c)),
|
|
326
|
+
valueOperand2: w.date().when(["valueOperator.id"], {
|
|
327
|
+
is: "b",
|
|
328
|
+
then: w.date().test("DOB", o("dynamic_filter.error_invalid_date"), (c) => Boolean(c))
|
|
329
|
+
})
|
|
330
|
+
}), d && p && (s("valueOperand1", new Date(d.o1), {
|
|
331
|
+
shouldTouch: !1,
|
|
332
|
+
shouldValidate: !1
|
|
333
|
+
}), s("valueOperand2", new Date(d.o2), {
|
|
334
|
+
shouldTouch: !1,
|
|
335
|
+
shouldValidate: !1
|
|
336
|
+
})), t(f), l(!0);
|
|
337
|
+
}, [o, d, p]), /* @__PURE__ */ r(ct, {
|
|
338
|
+
children: y && /* @__PURE__ */ C(A, {
|
|
339
|
+
children: [/* @__PURE__ */ r(ft, {
|
|
340
|
+
children: /* @__PURE__ */ r(R, {
|
|
341
|
+
name: "valueOperator",
|
|
342
|
+
autoComplete: "off",
|
|
343
|
+
options: b,
|
|
344
|
+
getOptionLabel: (c) => c.label,
|
|
345
|
+
isOptionEqualToValue: (c, x) => c.id === x.id,
|
|
346
|
+
label: ""
|
|
347
|
+
})
|
|
348
|
+
}), /* @__PURE__ */ r(ee, {
|
|
349
|
+
name: "valueOperand1",
|
|
350
|
+
autoComplete: "off",
|
|
351
|
+
label: "",
|
|
352
|
+
focused: !0
|
|
353
|
+
}), g && g.id === "b" && /* @__PURE__ */ r(ee, {
|
|
354
|
+
name: "valueOperand2",
|
|
355
|
+
autoComplete: "off",
|
|
356
|
+
label: ""
|
|
357
|
+
})]
|
|
358
|
+
})
|
|
359
|
+
});
|
|
360
|
+
}
|
|
361
|
+
const vt = h("div")(({
|
|
362
|
+
theme: e
|
|
363
|
+
}) => ({
|
|
364
|
+
display: "flex",
|
|
365
|
+
flexDirection: "column",
|
|
366
|
+
justifyContent: "center",
|
|
367
|
+
alignItems: "center",
|
|
368
|
+
width: "100%",
|
|
369
|
+
minWidth: e.spacing(3.75),
|
|
370
|
+
padding: e.spacing(3, 0),
|
|
371
|
+
gap: e.spacing(3)
|
|
372
|
+
})), Ot = h("div")(() => ({
|
|
373
|
+
width: "100%"
|
|
374
|
+
})), _t = (e, t, n) => {
|
|
375
|
+
const o = e.defaultOperand1, i = e.defaultOperand2, a = {
|
|
376
|
+
id: 0,
|
|
377
|
+
n: e.name,
|
|
378
|
+
fixed: t,
|
|
379
|
+
isSetted: !1,
|
|
380
|
+
o: "e",
|
|
381
|
+
labelOperator: "",
|
|
382
|
+
o1: "",
|
|
383
|
+
o2: "",
|
|
384
|
+
labelOperands: ""
|
|
385
|
+
};
|
|
386
|
+
return o !== void 0 && typeof o == "number" && (a.o1 = o, a.labelOperands = a.o1), i !== void 0 && typeof i == "number" && (a.o2 = i), a.labelOperator = n(`dynamic_filter.operator_${a.o}`), a;
|
|
387
|
+
};
|
|
388
|
+
function xt() {
|
|
389
|
+
const {
|
|
390
|
+
popupData: {
|
|
391
|
+
filter: e,
|
|
392
|
+
field: t
|
|
393
|
+
},
|
|
394
|
+
setPoupEditValidationSchema: n,
|
|
395
|
+
setFnTransformFormValuesIntoValues: o,
|
|
396
|
+
getLabelOperator: i
|
|
397
|
+
} = T(), {
|
|
398
|
+
getLabel: a
|
|
399
|
+
} = $(), d = me(null), {
|
|
400
|
+
control: p,
|
|
401
|
+
setValue: u
|
|
402
|
+
} = M(), [s, g] = S(!1), y = ge({
|
|
403
|
+
control: p,
|
|
404
|
+
name: "valueOperator"
|
|
405
|
+
}), l = E(() => ve.map((f) => ({
|
|
406
|
+
id: f,
|
|
407
|
+
label: i(f)
|
|
408
|
+
})), [i]), b = _((f) => {
|
|
409
|
+
if (!e || !t)
|
|
410
|
+
return;
|
|
411
|
+
const c = {
|
|
412
|
+
id: e.id,
|
|
413
|
+
n: t.name,
|
|
414
|
+
fixed: e.fixed,
|
|
415
|
+
isSetted: !0,
|
|
416
|
+
o: f.valueOperator.id,
|
|
417
|
+
o1: Number(f.valueOperand1),
|
|
418
|
+
o2: f.valueOperand2,
|
|
419
|
+
labelOperator: f.valueOperator.label,
|
|
420
|
+
labelOperands: f.valueOperand1
|
|
421
|
+
};
|
|
422
|
+
return f.valueOperator.id === "b" ? (c.labelOperands = `${f.valueOperand1} - ${f.valueOperand2}`, c.o2 = Number(f.valueOperand2)) : c.o2 = void 0, c;
|
|
423
|
+
}, []);
|
|
424
|
+
return L(() => {
|
|
425
|
+
s || n({
|
|
426
|
+
valueOperator: w.object().nullable().required(a("dynamic_filter.error_operator_required")),
|
|
427
|
+
valueOperand1: w.number().typeError(a("dynamic_filter.error_operand_mustbe_number")),
|
|
428
|
+
valueOperand2: w.string().when("valueOperator", {
|
|
429
|
+
is: (f) => f.id === "b",
|
|
430
|
+
then: w.string().test("DOB", a("dynamic_filter.error_operand_mustbe_number"), (f) => f === "" ? !1 : !isNaN(Number(f)))
|
|
431
|
+
})
|
|
432
|
+
}), o(b), e && t && (u("valueOperand1", e.o1, {
|
|
433
|
+
shouldTouch: !1,
|
|
434
|
+
shouldValidate: !1
|
|
435
|
+
}), u("valueOperand2", e.o2, {
|
|
436
|
+
shouldTouch: !1,
|
|
437
|
+
shouldValidate: !1
|
|
438
|
+
})), g(!0);
|
|
439
|
+
}, [a, e, t]), L(() => {
|
|
440
|
+
d.current?.focus();
|
|
441
|
+
}, [s]), /* @__PURE__ */ r(vt, {
|
|
442
|
+
children: s && /* @__PURE__ */ C(A, {
|
|
443
|
+
children: [/* @__PURE__ */ r(Ot, {
|
|
444
|
+
children: /* @__PURE__ */ r(R, {
|
|
445
|
+
name: "valueOperator",
|
|
446
|
+
autoComplete: "off",
|
|
447
|
+
options: l,
|
|
448
|
+
getOptionLabel: (f) => f.label,
|
|
449
|
+
isOptionEqualToValue: (f, c) => f.id === c.id,
|
|
450
|
+
label: ""
|
|
451
|
+
})
|
|
452
|
+
}), /* @__PURE__ */ r(Y, {
|
|
453
|
+
name: "valueOperand1",
|
|
454
|
+
ref: d,
|
|
455
|
+
focused: !0
|
|
456
|
+
}), y && y.id === "b" && /* @__PURE__ */ r(Y, {
|
|
457
|
+
name: "valueOperand2",
|
|
458
|
+
ref: d
|
|
459
|
+
})]
|
|
460
|
+
})
|
|
461
|
+
});
|
|
462
|
+
}
|
|
463
|
+
const ie = {
|
|
464
|
+
string: lt,
|
|
465
|
+
number: _t,
|
|
466
|
+
boolean: pt,
|
|
467
|
+
datetime: ht,
|
|
468
|
+
__default__: () => {
|
|
469
|
+
throw new Error("Type no defined");
|
|
470
|
+
}
|
|
471
|
+
}, Ie = (e, t, n, o) => (ie[e.type] ?? ie.__default__)(e, t, n, o), ae = {
|
|
472
|
+
string: st,
|
|
473
|
+
number: xt,
|
|
474
|
+
boolean: ut,
|
|
475
|
+
datetime: yt,
|
|
476
|
+
__default__: qe.Fragment
|
|
477
|
+
}, It = (e) => {
|
|
478
|
+
const {
|
|
479
|
+
getFieldByName: t
|
|
480
|
+
} = T(), n = t(e.filter.n);
|
|
481
|
+
if (!n)
|
|
482
|
+
return /* @__PURE__ */ r(A, {});
|
|
483
|
+
const o = ae[n.type] ?? ae.__default__;
|
|
484
|
+
return /* @__PURE__ */ r(o, {});
|
|
485
|
+
}, wt = {
|
|
486
|
+
fields: [],
|
|
487
|
+
withAllField: !0,
|
|
488
|
+
isDirty: !1,
|
|
489
|
+
isValid: !0,
|
|
490
|
+
automatic: !1,
|
|
491
|
+
availableFields: [],
|
|
492
|
+
getFieldByName: () => {
|
|
493
|
+
},
|
|
494
|
+
getLabelOperator: () => "",
|
|
495
|
+
applyedFilters: [],
|
|
496
|
+
addFilter: V,
|
|
497
|
+
updateFilter: V,
|
|
498
|
+
removeFilter: V,
|
|
499
|
+
clearFilters: V,
|
|
500
|
+
fireOnChangeFilters: V,
|
|
501
|
+
openAnchorEl: null,
|
|
502
|
+
openMenuFields: V,
|
|
503
|
+
closeMenuFields: V,
|
|
504
|
+
popupData: {
|
|
505
|
+
popupAnchorEl: null,
|
|
506
|
+
filter: null,
|
|
507
|
+
field: null
|
|
508
|
+
},
|
|
509
|
+
popupValidationSchema: {},
|
|
510
|
+
setPoupEditValidationSchema: V,
|
|
511
|
+
showPopupForAddFilter: V,
|
|
512
|
+
showPopupForEditFilter: V,
|
|
513
|
+
hidePopupEdit: V,
|
|
514
|
+
setInEdition: V,
|
|
515
|
+
inEdition: !1,
|
|
516
|
+
setFnTransformFormValuesIntoValues: V,
|
|
517
|
+
fnTransformFormValuesIntoRawValues: () => {
|
|
518
|
+
}
|
|
519
|
+
}, U = Ne(wt), Ct = (e) => e.reduce((t, n) => n.id > t ? n.id : t, 0), Vt = (e, t) => t.findIndex((n) => n.id === e), le = (e) => e.map((t) => ({
|
|
520
|
+
n: t.n,
|
|
521
|
+
o: t.o,
|
|
522
|
+
labelOperands: t.labelOperands,
|
|
523
|
+
o1: t.o1,
|
|
524
|
+
o2: t.o2
|
|
525
|
+
})), se = (e) => e.map((t) => ({
|
|
526
|
+
n: t.n,
|
|
527
|
+
o: t.o,
|
|
528
|
+
o1: t.o1,
|
|
529
|
+
o2: t.o2
|
|
530
|
+
})), St = (e, t, n, o, i) => {
|
|
531
|
+
const a = [], d = [];
|
|
532
|
+
for (let p = 0; p < t.length; p++) {
|
|
533
|
+
let u;
|
|
534
|
+
const s = {
|
|
535
|
+
...t[p],
|
|
536
|
+
id: 0,
|
|
537
|
+
isSetted: !0,
|
|
538
|
+
fixed: !1,
|
|
539
|
+
labelOperator: ""
|
|
540
|
+
}, g = n(s.n);
|
|
541
|
+
if (!!g) {
|
|
542
|
+
switch (g.type) {
|
|
543
|
+
case "string":
|
|
544
|
+
u = mt(s);
|
|
545
|
+
break;
|
|
546
|
+
case "number":
|
|
547
|
+
u = gt(s);
|
|
548
|
+
break;
|
|
549
|
+
case "boolean":
|
|
550
|
+
u = bt(s);
|
|
551
|
+
break;
|
|
552
|
+
case "datetime":
|
|
553
|
+
u = Ft(s);
|
|
554
|
+
break;
|
|
555
|
+
default:
|
|
556
|
+
u = !1;
|
|
557
|
+
}
|
|
558
|
+
u && (g.presence === "fixed" && (d.findIndex((y) => y === g.name) === -1 ? (s.fixed = !0, d.push(g.name)) : s.fixed = !1), s.isSetted = !0, s.id = a.length + 1, s.labelOperator = o(`dynamic_filter.operator_${s.o}`), a.push(s));
|
|
559
|
+
}
|
|
560
|
+
}
|
|
561
|
+
for (let p = 0; p < e.length; p++) {
|
|
562
|
+
const u = e[p];
|
|
563
|
+
if ((u.presence === "initialized" || u.presence === "fixed") && !t.find((s) => s.n === u.name)) {
|
|
564
|
+
const s = Ie(u, u.presence === "fixed", o, i);
|
|
565
|
+
s.id = a.length + 1, a.push(s);
|
|
566
|
+
}
|
|
567
|
+
}
|
|
568
|
+
return a;
|
|
569
|
+
};
|
|
570
|
+
function Tt(e) {
|
|
571
|
+
const {
|
|
572
|
+
isSkeleton: t = !1,
|
|
573
|
+
fields: n,
|
|
574
|
+
initialFilters: o = [],
|
|
575
|
+
withAllField: i = !0,
|
|
576
|
+
onChangeFilter: a,
|
|
577
|
+
automatic: d = !0,
|
|
578
|
+
children: p
|
|
579
|
+
} = e, [u, s] = S(null), [g, y] = S({
|
|
580
|
+
popupAnchorEl: null,
|
|
581
|
+
filter: null,
|
|
582
|
+
field: null
|
|
583
|
+
}), {
|
|
584
|
+
getLabel: l
|
|
585
|
+
} = $(), [b, f] = S(w.object().shape({})), [c, x] = S(() => {
|
|
586
|
+
}), {
|
|
587
|
+
host_static_assets: v,
|
|
588
|
+
environment_assets: W
|
|
589
|
+
} = j(), J = z(), Q = E(() => ({
|
|
590
|
+
...xe,
|
|
591
|
+
label: l("dynamic_filter.all_fields"),
|
|
592
|
+
urlIcon: `${v}/${W}/frontend/components/dynamic_filter/assets/icons/all_fields.svg`
|
|
593
|
+
}), [l, v, W]), [B, P] = S(!1), [we, q] = S(!d), [N, X] = S(!1), {
|
|
594
|
+
toast: Ce
|
|
595
|
+
} = z(), H = _((m) => n.concat(Q).find((F) => F.name === m), [n, Q]), K = _((m) => l(`dynamic_filter.operator_${m}`), [l]), [D, k] = S(St(n, o, H, l, J)), Ve = E(() => {
|
|
596
|
+
const m = [];
|
|
597
|
+
for (let F = 0; F < n.length; F++) {
|
|
598
|
+
let O;
|
|
599
|
+
const I = n[F];
|
|
600
|
+
O = !0, I.multiple !== void 0 && I.multiple === !1 && D.findIndex((Me) => Me.n === I.name) > -1 && (O = !1), O && m.push(I);
|
|
601
|
+
}
|
|
602
|
+
return m;
|
|
603
|
+
}, [n, D]), Se = _(() => {
|
|
604
|
+
N ? (d || q(!1), a(le(D), se(D))) : Ce(l("dynamic_filter.error_filters_no_setted"), {
|
|
605
|
+
type: "error",
|
|
606
|
+
autoClose: 1e4
|
|
607
|
+
});
|
|
608
|
+
}, [N, D, a]);
|
|
609
|
+
L(() => {
|
|
610
|
+
const m = D.findIndex((F) => !F.isSetted) > -1;
|
|
611
|
+
if (X(!m), !d) {
|
|
612
|
+
q(!0);
|
|
613
|
+
return;
|
|
614
|
+
}
|
|
615
|
+
m || (q(!1), a(le(D), se(D)));
|
|
616
|
+
}, [D]);
|
|
617
|
+
const Te = _((m) => {
|
|
618
|
+
k((F) => {
|
|
619
|
+
const O = [...F], I = {
|
|
620
|
+
...m,
|
|
621
|
+
id: Ct(F) + 1,
|
|
622
|
+
labelOperator: K(m.o)
|
|
623
|
+
};
|
|
624
|
+
return O.push(I), O;
|
|
625
|
+
});
|
|
626
|
+
}, []), De = _((m) => {
|
|
627
|
+
k((F) => {
|
|
628
|
+
const O = [...F], I = Vt(m.id, O);
|
|
629
|
+
return I > -1 && O.splice(I, 1, {
|
|
630
|
+
...m,
|
|
631
|
+
labelOperator: K(m.o)
|
|
632
|
+
}), O;
|
|
633
|
+
});
|
|
634
|
+
}, []), Ee = _(() => {
|
|
635
|
+
k((m) => {
|
|
636
|
+
const F = [];
|
|
637
|
+
for (let O = 0; O < m.length; O++) {
|
|
638
|
+
const I = m[O];
|
|
639
|
+
I.fixed && F.push(I);
|
|
640
|
+
}
|
|
641
|
+
return F;
|
|
642
|
+
});
|
|
643
|
+
}, []), Ae = _((m) => {
|
|
644
|
+
s(m), P(!0);
|
|
645
|
+
}, [D]), Le = _(() => {
|
|
646
|
+
s(null), P(!1);
|
|
647
|
+
}, []), Pe = _((m) => {
|
|
648
|
+
g.popupAnchorEl && y({
|
|
649
|
+
popupAnchorEl: null,
|
|
650
|
+
filter: null,
|
|
651
|
+
field: null
|
|
652
|
+
}), !m && B && P(!1);
|
|
653
|
+
}, [g, B]), $e = _((m, F) => {
|
|
654
|
+
y({
|
|
655
|
+
popupAnchorEl: m,
|
|
656
|
+
filter: Ie(F, !1, l, J),
|
|
657
|
+
field: F
|
|
658
|
+
}), P(!0);
|
|
659
|
+
}, []), Re = _((m, F) => {
|
|
660
|
+
y({
|
|
661
|
+
popupAnchorEl: m,
|
|
662
|
+
filter: F,
|
|
663
|
+
field: H(F.n)
|
|
664
|
+
}), P(!0);
|
|
665
|
+
}, []), We = _((m) => {
|
|
666
|
+
k((F) => {
|
|
667
|
+
const O = [...F], I = F.findIndex((Z) => m === Z.id);
|
|
668
|
+
return I > -1 && (O[I].fixed || O.splice(I, 1)), O;
|
|
669
|
+
});
|
|
670
|
+
}, []), ke = _((m) => {
|
|
671
|
+
f(w.object().shape({
|
|
672
|
+
...m
|
|
673
|
+
}));
|
|
674
|
+
}, []), je = _((m) => {
|
|
675
|
+
x(() => m);
|
|
676
|
+
}, []);
|
|
677
|
+
return /* @__PURE__ */ r(U.Provider, {
|
|
678
|
+
value: {
|
|
679
|
+
isSkeleton: t,
|
|
680
|
+
inEdition: B,
|
|
681
|
+
automatic: d,
|
|
682
|
+
isDirty: we,
|
|
683
|
+
isValid: N,
|
|
684
|
+
withAllField: i,
|
|
685
|
+
fields: n,
|
|
686
|
+
availableFields: Ve,
|
|
687
|
+
getFieldByName: H,
|
|
688
|
+
getLabelOperator: K,
|
|
689
|
+
applyedFilters: D,
|
|
690
|
+
addFilter: Te,
|
|
691
|
+
updateFilter: De,
|
|
692
|
+
removeFilter: We,
|
|
693
|
+
clearFilters: Ee,
|
|
694
|
+
fireOnChangeFilters: Se,
|
|
695
|
+
openAnchorEl: u,
|
|
696
|
+
openMenuFields: Ae,
|
|
697
|
+
closeMenuFields: Le,
|
|
698
|
+
popupData: g,
|
|
699
|
+
popupValidationSchema: b,
|
|
700
|
+
showPopupForAddFilter: $e,
|
|
701
|
+
showPopupForEditFilter: Re,
|
|
702
|
+
hidePopupEdit: Pe,
|
|
703
|
+
setInEdition: P,
|
|
704
|
+
setPoupEditValidationSchema: ke,
|
|
705
|
+
fnTransformFormValuesIntoRawValues: c,
|
|
706
|
+
setFnTransformFormValuesIntoValues: je
|
|
707
|
+
},
|
|
708
|
+
children: p
|
|
709
|
+
});
|
|
710
|
+
}
|
|
711
|
+
const T = () => He(U), Dt = h("div")(({
|
|
712
|
+
theme: e
|
|
713
|
+
}) => ({
|
|
714
|
+
width: "auto",
|
|
715
|
+
display: "flex",
|
|
716
|
+
justifyContent: "center",
|
|
717
|
+
alignItems: "center",
|
|
718
|
+
height: "100%",
|
|
719
|
+
minHeight: e.spacing(3),
|
|
720
|
+
paddingLeft: e.spacing(1),
|
|
721
|
+
backgroundColor: e.palette.grid?.sectionHeader,
|
|
722
|
+
border: "1px solid",
|
|
723
|
+
borderColor: Ye(`${e.palette.divider}`, 0.1),
|
|
724
|
+
overflow: "visible",
|
|
725
|
+
borderRadius: e.spacing(1),
|
|
726
|
+
"&.waf_no_setted": {
|
|
727
|
+
border: `1px solid ${e.palette.error.main}`
|
|
728
|
+
}
|
|
729
|
+
})), Et = h("div")(({
|
|
730
|
+
theme: e
|
|
731
|
+
}) => ({
|
|
732
|
+
...e.typography.body2,
|
|
733
|
+
display: "flex",
|
|
734
|
+
justifyContent: "center",
|
|
735
|
+
alignItems: "center",
|
|
736
|
+
width: "auto",
|
|
737
|
+
height: "100%",
|
|
738
|
+
marginRight: e.spacing(1),
|
|
739
|
+
marginLeft: e.spacing(1),
|
|
740
|
+
whiteSpace: "nowrap"
|
|
741
|
+
})), At = h("span")(({
|
|
742
|
+
theme: e
|
|
743
|
+
}) => ({
|
|
744
|
+
...e.typography.subtitle2
|
|
745
|
+
})), Lt = h("span")(({
|
|
746
|
+
theme: e
|
|
747
|
+
}) => ({
|
|
748
|
+
...e.typography.body2,
|
|
749
|
+
marginLeft: e.spacing(1.5),
|
|
750
|
+
fontStyle: "italic"
|
|
751
|
+
})), Pt = h("span")(({
|
|
752
|
+
theme: e
|
|
753
|
+
}) => ({
|
|
754
|
+
...e.typography.body2,
|
|
755
|
+
marginLeft: e.spacing(1.5)
|
|
756
|
+
}));
|
|
757
|
+
function $t(e) {
|
|
758
|
+
const {
|
|
759
|
+
n: t,
|
|
760
|
+
id: n,
|
|
761
|
+
isSetted: o,
|
|
762
|
+
fixed: i,
|
|
763
|
+
labelOperator: a,
|
|
764
|
+
labelOperands: d
|
|
765
|
+
} = e, {
|
|
766
|
+
removeFilter: p,
|
|
767
|
+
showPopupForEditFilter: u,
|
|
768
|
+
hidePopupEdit: s,
|
|
769
|
+
getFieldByName: g
|
|
770
|
+
} = T(), {
|
|
771
|
+
host_static_assets: y,
|
|
772
|
+
environment_assets: l
|
|
773
|
+
} = j(), b = E(() => g(t), [g]), f = E(() => {
|
|
774
|
+
if (!!b)
|
|
775
|
+
return b && b.urlIcon !== "" ? b.urlIcon : "";
|
|
776
|
+
}, [b]), c = () => {
|
|
777
|
+
s(!1), p(n);
|
|
778
|
+
}, x = (v) => {
|
|
779
|
+
u(v.currentTarget, e);
|
|
780
|
+
};
|
|
781
|
+
return b ? /* @__PURE__ */ C(Dt, {
|
|
782
|
+
id: "WrapperApplyedFilter",
|
|
783
|
+
className: o ? "" : "waf_no_setted",
|
|
784
|
+
children: [f && /* @__PURE__ */ r(G, {
|
|
785
|
+
src: f,
|
|
786
|
+
onClick: x
|
|
787
|
+
}), /* @__PURE__ */ C(Et, {
|
|
788
|
+
onClick: x,
|
|
789
|
+
children: [/* @__PURE__ */ r(At, {
|
|
790
|
+
children: b.label
|
|
791
|
+
}), /* @__PURE__ */ r(Lt, {
|
|
792
|
+
children: a
|
|
793
|
+
}), /* @__PURE__ */ r(Pt, {
|
|
794
|
+
children: d
|
|
795
|
+
})]
|
|
796
|
+
}), !i && /* @__PURE__ */ r(G, {
|
|
797
|
+
size: "small",
|
|
798
|
+
src: `${y}/${l}/frontend/components/dynamic_filter/assets/icons/clear.svg`,
|
|
799
|
+
onClick: c,
|
|
800
|
+
dictionaryTooltip: "dynamic_filter.tooltip_clear_filter"
|
|
801
|
+
})]
|
|
802
|
+
}) : /* @__PURE__ */ r(A, {});
|
|
803
|
+
}
|
|
804
|
+
function de() {
|
|
805
|
+
const {
|
|
806
|
+
applyedFilters: e,
|
|
807
|
+
isSkeleton: t
|
|
808
|
+
} = T();
|
|
809
|
+
return t ? /* @__PURE__ */ r(re, {
|
|
810
|
+
id: "WrapperApplyedFilters"
|
|
811
|
+
}) : /* @__PURE__ */ r(re, {
|
|
812
|
+
className: "WrapperApplyedFilters",
|
|
813
|
+
children: /* @__PURE__ */ r(Be, {
|
|
814
|
+
children: /* @__PURE__ */ r(ot, {
|
|
815
|
+
id: "WrapperApplyedFilters",
|
|
816
|
+
children: [...e].sort((n, o) => n.isSetted === o.isSetted ? 0 : n.isSetted ? -1 : 1).reverse().map((n) => /* @__PURE__ */ r($t, {
|
|
817
|
+
...n
|
|
818
|
+
}, n.id))
|
|
819
|
+
})
|
|
820
|
+
})
|
|
821
|
+
});
|
|
822
|
+
}
|
|
823
|
+
const Rt = be("div")(({
|
|
824
|
+
theme: e
|
|
825
|
+
}) => ({
|
|
826
|
+
display: "flex",
|
|
827
|
+
justifyContent: "center",
|
|
828
|
+
alignItems: "center",
|
|
829
|
+
minWidth: e.spacing(3.75),
|
|
830
|
+
height: e.spacing(3.75)
|
|
831
|
+
})), Wt = be("div")(({
|
|
832
|
+
theme: e
|
|
833
|
+
}) => ({
|
|
834
|
+
paddingLeft: e.spacing(0.5),
|
|
835
|
+
borderLeft: `1px solid ${e.palette.divider}`
|
|
836
|
+
})), pe = () => {
|
|
837
|
+
const {
|
|
838
|
+
host_static_assets: e,
|
|
839
|
+
environment_assets: t
|
|
840
|
+
} = j(), {
|
|
841
|
+
clearFilters: n,
|
|
842
|
+
isSkeleton: o,
|
|
843
|
+
applyedFilters: i
|
|
844
|
+
} = T();
|
|
845
|
+
return o ? /* @__PURE__ */ r(Rt, {
|
|
846
|
+
children: /* @__PURE__ */ r(Fe, {
|
|
847
|
+
variant: "circular",
|
|
848
|
+
width: "20px",
|
|
849
|
+
height: "20px"
|
|
850
|
+
})
|
|
851
|
+
}) : i.findIndex((a) => a.fixed == !1) > -1 ? /* @__PURE__ */ r(Wt, {
|
|
852
|
+
children: /* @__PURE__ */ r(G, {
|
|
853
|
+
src: `${e}/${t}/frontend/components/dynamic_filter/assets/icons/clear.svg`,
|
|
854
|
+
onClick: n,
|
|
855
|
+
dictionaryTooltip: "dynamic_filter.tooltip_clear_filters"
|
|
856
|
+
})
|
|
857
|
+
}) : /* @__PURE__ */ r(A, {});
|
|
858
|
+
}, ue = h("div")(({
|
|
859
|
+
theme: e
|
|
860
|
+
}) => ({
|
|
861
|
+
display: "flex",
|
|
862
|
+
justifyContent: "center",
|
|
863
|
+
alignItems: "center",
|
|
864
|
+
width: "100%",
|
|
865
|
+
height: e.spacing(3),
|
|
866
|
+
borderLeft: `1px solid ${e.palette.divider}`,
|
|
867
|
+
paddingLeft: e.spacing(1),
|
|
868
|
+
marginLeft: e.spacing(1),
|
|
869
|
+
[e.breakpoints.up("sm")]: {
|
|
870
|
+
width: e.spacing(25)
|
|
871
|
+
}
|
|
872
|
+
})), kt = h("input")(({
|
|
873
|
+
theme: e
|
|
874
|
+
}) => ({
|
|
875
|
+
background: "transparent",
|
|
876
|
+
display: "flex",
|
|
877
|
+
justifyContent: "center",
|
|
878
|
+
alignItems: "center",
|
|
879
|
+
minWidth: e.spacing(3.75),
|
|
880
|
+
width: "100%",
|
|
881
|
+
"&": {
|
|
882
|
+
outline: "none",
|
|
883
|
+
border: "none"
|
|
884
|
+
},
|
|
885
|
+
[e.breakpoints.up("sm")]: {
|
|
886
|
+
width: "auto"
|
|
887
|
+
}
|
|
888
|
+
}));
|
|
889
|
+
function ce() {
|
|
890
|
+
const {
|
|
891
|
+
isSkeleton: e,
|
|
892
|
+
withAllField: t,
|
|
893
|
+
availableFields: n,
|
|
894
|
+
showPopupForAddFilter: o,
|
|
895
|
+
addFilter: i,
|
|
896
|
+
openAnchorEl: a,
|
|
897
|
+
openMenuFields: d,
|
|
898
|
+
closeMenuFields: p,
|
|
899
|
+
hidePopupEdit: u
|
|
900
|
+
} = T(), [s, g] = S(""), y = E(() => a ? n.filter((v) => v.label.includes(s)) : [], [s, a]);
|
|
901
|
+
if (e)
|
|
902
|
+
return /* @__PURE__ */ r(ue, {
|
|
903
|
+
id: "SKTWrapperInputFilter",
|
|
904
|
+
children: /* @__PURE__ */ r(Fe, {
|
|
905
|
+
variant: "text",
|
|
906
|
+
width: "100%",
|
|
907
|
+
height: 24
|
|
908
|
+
})
|
|
909
|
+
});
|
|
910
|
+
const l = () => {
|
|
911
|
+
p();
|
|
912
|
+
}, b = (v) => {
|
|
913
|
+
p(), o(a, v);
|
|
914
|
+
}, f = (v) => {
|
|
915
|
+
d(v.currentTarget);
|
|
916
|
+
}, c = (v) => {
|
|
917
|
+
g(v.target.value), a || d(v.currentTarget), u(!0);
|
|
918
|
+
}, x = (v) => {
|
|
919
|
+
if (v.key === "Enter") {
|
|
920
|
+
if (s.trim() === "") {
|
|
921
|
+
p();
|
|
922
|
+
return;
|
|
923
|
+
}
|
|
924
|
+
t && (i({
|
|
925
|
+
n: xe.name,
|
|
926
|
+
isSetted: !0,
|
|
927
|
+
fixed: !1,
|
|
928
|
+
o: "c",
|
|
929
|
+
o1: s,
|
|
930
|
+
labelOperands: s
|
|
931
|
+
}), g(""), p());
|
|
932
|
+
}
|
|
933
|
+
};
|
|
934
|
+
return !t && n.length == 0 ? /* @__PURE__ */ r(A, {}) : /* @__PURE__ */ C(ue, {
|
|
935
|
+
id: "WrapperInputFilter",
|
|
936
|
+
children: [/* @__PURE__ */ r(kt, {
|
|
937
|
+
type: "text",
|
|
938
|
+
value: s,
|
|
939
|
+
placeholder: "filter",
|
|
940
|
+
onClick: f,
|
|
941
|
+
onChange: c,
|
|
942
|
+
onKeyPress: x
|
|
943
|
+
}), n.length > 0 && /* @__PURE__ */ r(et, {
|
|
944
|
+
id: "MenuPopover",
|
|
945
|
+
open: Boolean(a),
|
|
946
|
+
anchorEl: a,
|
|
947
|
+
onClose: l,
|
|
948
|
+
disableAutoFocus: !0,
|
|
949
|
+
arrow: "right-top",
|
|
950
|
+
sx: {
|
|
951
|
+
"& .MuiMenuItem-root": {
|
|
952
|
+
px: 1,
|
|
953
|
+
typography: "body2",
|
|
954
|
+
borderRadius: 0.75
|
|
955
|
+
}
|
|
956
|
+
},
|
|
957
|
+
children: Boolean(a) && y.map((v, W) => /* @__PURE__ */ C(Ge, {
|
|
958
|
+
dense: !0,
|
|
959
|
+
onClick: () => b(v),
|
|
960
|
+
children: [/* @__PURE__ */ r(he, {
|
|
961
|
+
src: v.urlIcon
|
|
962
|
+
}), /* @__PURE__ */ r(Qe, {
|
|
963
|
+
children: v.label
|
|
964
|
+
})]
|
|
965
|
+
}, `menu_action_${W}`))
|
|
966
|
+
})]
|
|
967
|
+
});
|
|
968
|
+
}
|
|
969
|
+
const jt = h("div")(({
|
|
970
|
+
theme: e
|
|
971
|
+
}) => ({
|
|
972
|
+
display: "flex",
|
|
973
|
+
flexDirection: "column",
|
|
974
|
+
justifyContent: "center",
|
|
975
|
+
alignItems: "center",
|
|
976
|
+
padding: e.spacing(1.4, 3, 3, 3),
|
|
977
|
+
backgroundColor: e.palette.background.default,
|
|
978
|
+
borderRadius: e.spacing(1)
|
|
979
|
+
}));
|
|
980
|
+
h("div")(({
|
|
981
|
+
theme: e
|
|
982
|
+
}) => ({
|
|
983
|
+
display: "flex",
|
|
984
|
+
justifyContent: "center",
|
|
985
|
+
gap: e.spacing(3),
|
|
986
|
+
paddingTop: e.spacing(3)
|
|
987
|
+
}));
|
|
988
|
+
const Mt = h("div")(({
|
|
989
|
+
theme: e
|
|
990
|
+
}) => ({
|
|
991
|
+
...e.typography.subtitle2,
|
|
992
|
+
width: "100%",
|
|
993
|
+
display: "flex",
|
|
994
|
+
justifyContent: "flex-start",
|
|
995
|
+
alignItems: "center",
|
|
996
|
+
padding: e.spacing(2, 0),
|
|
997
|
+
marginLeft: e.spacing(1.5)
|
|
998
|
+
})), Bt = h("div")(({
|
|
999
|
+
theme: e
|
|
1000
|
+
}) => ({
|
|
1001
|
+
width: "100%",
|
|
1002
|
+
display: "flex",
|
|
1003
|
+
justifyContent: "flex-start",
|
|
1004
|
+
alignItems: "center",
|
|
1005
|
+
borderBottom: `1px solid ${e.palette.divider}`
|
|
1006
|
+
})), fe = () => {
|
|
1007
|
+
const {
|
|
1008
|
+
popupValidationSchema: e,
|
|
1009
|
+
popupData: {
|
|
1010
|
+
popupAnchorEl: t,
|
|
1011
|
+
filter: n,
|
|
1012
|
+
field: o
|
|
1013
|
+
},
|
|
1014
|
+
hidePopupEdit: i,
|
|
1015
|
+
addFilter: a,
|
|
1016
|
+
updateFilter: d,
|
|
1017
|
+
getLabelOperator: p,
|
|
1018
|
+
fnTransformFormValuesIntoRawValues: u
|
|
1019
|
+
} = T(), s = Ue(), {
|
|
1020
|
+
getLabel: g
|
|
1021
|
+
} = $(), y = E(() => !n || !o ? {} : {
|
|
1022
|
+
...n,
|
|
1023
|
+
valueOperator: {
|
|
1024
|
+
id: n.o,
|
|
1025
|
+
label: p(n.o)
|
|
1026
|
+
}
|
|
1027
|
+
}, [n, o, p, g]), l = async (f) => {
|
|
1028
|
+
if (!n || !o)
|
|
1029
|
+
return;
|
|
1030
|
+
const c = u(f);
|
|
1031
|
+
!c || (n.id === 0 ? a(c) : d(c), i(!1));
|
|
1032
|
+
}, b = () => {
|
|
1033
|
+
i(!1);
|
|
1034
|
+
};
|
|
1035
|
+
return /* @__PURE__ */ r(Je, {
|
|
1036
|
+
id: "MenuPopover",
|
|
1037
|
+
open: Boolean(t),
|
|
1038
|
+
anchorEl: t,
|
|
1039
|
+
sx: {
|
|
1040
|
+
boxShadow: s.customShadows.dropdown,
|
|
1041
|
+
borderRadius: 1
|
|
1042
|
+
},
|
|
1043
|
+
children: /* @__PURE__ */ r(A, {
|
|
1044
|
+
children: n && /* @__PURE__ */ r(ze, {
|
|
1045
|
+
onSubmit: l,
|
|
1046
|
+
values: y,
|
|
1047
|
+
validationSchema: e,
|
|
1048
|
+
children: /* @__PURE__ */ C(jt, {
|
|
1049
|
+
children: [/* @__PURE__ */ C(Bt, {
|
|
1050
|
+
children: [o?.urlIcon && /* @__PURE__ */ r(he, {
|
|
1051
|
+
src: o.urlIcon
|
|
1052
|
+
}), /* @__PURE__ */ r(Mt, {
|
|
1053
|
+
children: o?.label
|
|
1054
|
+
})]
|
|
1055
|
+
}), /* @__PURE__ */ r(It, {
|
|
1056
|
+
filter: n
|
|
1057
|
+
}), /* @__PURE__ */ C(Xe, {
|
|
1058
|
+
children: [/* @__PURE__ */ r(tt, {
|
|
1059
|
+
onClick: b
|
|
1060
|
+
}), /* @__PURE__ */ r(rt, {})]
|
|
1061
|
+
})]
|
|
1062
|
+
})
|
|
1063
|
+
})
|
|
1064
|
+
})
|
|
1065
|
+
});
|
|
1066
|
+
}, qt = h("div", {
|
|
1067
|
+
shouldForwardProp: (e) => e !== "inEdition"
|
|
1068
|
+
})(({
|
|
1069
|
+
theme: e,
|
|
1070
|
+
inEdition: t
|
|
1071
|
+
}) => ({
|
|
1072
|
+
display: "flex",
|
|
1073
|
+
alignItems: "center",
|
|
1074
|
+
justifyContent: "flex-start",
|
|
1075
|
+
height: "auto",
|
|
1076
|
+
width: "100%",
|
|
1077
|
+
padding: e.spacing(0.5),
|
|
1078
|
+
borderRadius: e.spacing(1),
|
|
1079
|
+
border: t ? `1px solid ${e.palette.primary.main}` : `1px solid ${e.palette.divider}`
|
|
1080
|
+
})), Nt = h("div", {
|
|
1081
|
+
shouldForwardProp: (e) => e !== "inEdition"
|
|
1082
|
+
})(({
|
|
1083
|
+
theme: e,
|
|
1084
|
+
inEdition: t
|
|
1085
|
+
}) => ({
|
|
1086
|
+
display: "flex",
|
|
1087
|
+
flexDirection: "column",
|
|
1088
|
+
alignItems: "center",
|
|
1089
|
+
justifyContent: "space-between",
|
|
1090
|
+
minWidth: e.spacing(25),
|
|
1091
|
+
height: "auto",
|
|
1092
|
+
width: "100%",
|
|
1093
|
+
padding: e.spacing(0.5),
|
|
1094
|
+
borderRadius: e.spacing(1),
|
|
1095
|
+
border: t ? `1px solid ${e.palette.primary.main}` : `1px solid ${e.palette.divider}`,
|
|
1096
|
+
gap: e.spacing(0.75),
|
|
1097
|
+
"& .WrapperApplyedFilters": {
|
|
1098
|
+
margin: "0px",
|
|
1099
|
+
padding: "0px",
|
|
1100
|
+
border: "0px"
|
|
1101
|
+
}
|
|
1102
|
+
})), Ht = h("div")(() => ({
|
|
1103
|
+
width: "100%",
|
|
1104
|
+
display: "flex",
|
|
1105
|
+
justifyContent: "space-between"
|
|
1106
|
+
})), Cr = (e) => {
|
|
1107
|
+
const t = nt();
|
|
1108
|
+
return Ke(["dictionary_loaded"]) ? /* @__PURE__ */ r(Tt, {
|
|
1109
|
+
...e,
|
|
1110
|
+
children: /* @__PURE__ */ r(U.Consumer, {
|
|
1111
|
+
children: ({
|
|
1112
|
+
inEdition: o
|
|
1113
|
+
}) => t ? /* @__PURE__ */ C(qt, {
|
|
1114
|
+
id: "WrapperFilter",
|
|
1115
|
+
inEdition: o,
|
|
1116
|
+
children: [/* @__PURE__ */ r(te, {}), /* @__PURE__ */ r(ce, {}), /* @__PURE__ */ r(de, {}), /* @__PURE__ */ r(fe, {}), /* @__PURE__ */ r(pe, {})]
|
|
1117
|
+
}) : /* @__PURE__ */ C(Nt, {
|
|
1118
|
+
id: "WrapperFilterMobile",
|
|
1119
|
+
inEdition: o,
|
|
1120
|
+
children: [/* @__PURE__ */ C(Ht, {
|
|
1121
|
+
id: "ContainerFistRow",
|
|
1122
|
+
children: [/* @__PURE__ */ r(te, {}), /* @__PURE__ */ r(ce, {}), /* @__PURE__ */ r(pe, {})]
|
|
1123
|
+
}), /* @__PURE__ */ r(de, {}), /* @__PURE__ */ r(fe, {})]
|
|
1124
|
+
})
|
|
1125
|
+
})
|
|
1126
|
+
}) : /* @__PURE__ */ r(A, {});
|
|
1127
|
+
};
|
|
1128
|
+
function Vr() {
|
|
1129
|
+
return ["dynamic_filter"].concat(Ze());
|
|
1130
|
+
}
|
|
1131
|
+
const Sr = {
|
|
1132
|
+
dynamic_filter: {
|
|
1133
|
+
filter_tooltip: "Search",
|
|
1134
|
+
operator_b: "between",
|
|
1135
|
+
operator_e: "=",
|
|
1136
|
+
operator_ne: "!=",
|
|
1137
|
+
operator_gt: ">",
|
|
1138
|
+
operator_gte: ">=",
|
|
1139
|
+
operator_lt: "<",
|
|
1140
|
+
operator_lte: "<=",
|
|
1141
|
+
operator_c: "contains",
|
|
1142
|
+
operator_nc: "not contains",
|
|
1143
|
+
all_fields: "all_fields",
|
|
1144
|
+
operand_true: "true",
|
|
1145
|
+
operand_false: "false",
|
|
1146
|
+
error_operator_required: "Operator required",
|
|
1147
|
+
error_operand_required: "Operand required",
|
|
1148
|
+
error_invalid_date: "Invalid date",
|
|
1149
|
+
error_operand_mustbe_number: "Invalid number",
|
|
1150
|
+
error_filters_no_setted: "Filters not yet set"
|
|
1151
|
+
}
|
|
1152
|
+
};
|
|
1153
|
+
export {
|
|
1154
|
+
Cr as D,
|
|
1155
|
+
Sr as d,
|
|
1156
|
+
Vr as g,
|
|
1157
|
+
T as u
|
|
1158
|
+
};
|