@m4l/components 0.1.52 → 0.1.53

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (101) hide show
  1. package/components/CommonActions/components/ActionFormCancel/{index.bd0d16d6.js → index.8dedf1d5.js} +15 -15
  2. package/components/CommonActions/components/ActionIntro/{index.d567aebb.js → index.5d5294f2.js} +5 -0
  3. package/components/CommonActions/components/ActionIntro/test/contants.d.ts +1 -0
  4. package/components/CommonActions/components/Actions/{index.f0a3167b.js → index.93c9823a.js} +14 -14
  5. package/components/DataGrid/{index.85390177.js → index.1a6508e2.js} +20 -20
  6. package/components/DynamicFilter/DynamicFilter.d.ts +9 -0
  7. package/components/DynamicFilter/classes/index.d.ts +5 -0
  8. package/components/DynamicFilter/classes/types.d.ts +22 -0
  9. package/components/DynamicFilter/constants.d.ts +14 -0
  10. package/components/DynamicFilter/contexts/DynamicFilterContext/helpers.d.ts +24 -0
  11. package/components/DynamicFilter/contexts/DynamicFilterContext/index.d.ts +18 -0
  12. package/components/DynamicFilter/contexts/DynamicFilterContext/store.d.ts +213 -0
  13. package/components/DynamicFilter/contexts/DynamicFilterContext/types.d.ts +5 -0
  14. package/components/DynamicFilter/dictionary.d.ts +21 -0
  15. package/components/DynamicFilter/hooks/useDynamicFilter.d.ts +2 -0
  16. package/components/DynamicFilter/index.2189989e.js +1808 -0
  17. package/components/DynamicFilter/index.d.ts +4 -6
  18. package/components/DynamicFilter/subcomponents/ApplyedFilters/subcomponents/ApplyedFilter/index.d.ts +3 -0
  19. package/components/DynamicFilter/subcomponents/ClearFilters/index.d.ts +1 -1
  20. package/components/DynamicFilter/subcomponents/FilterButton/index.d.ts +10 -0
  21. package/components/DynamicFilter/subcomponents/InnerForHooks/index.d.ts +6 -0
  22. package/components/DynamicFilter/subcomponents/InputFilter/index.d.ts +7 -1
  23. package/components/DynamicFilter/subcomponents/PopoverFilter/index.d.ts +15 -0
  24. package/components/DynamicFilter/subcomponents/PopoverMenuFields/index.d.ts +12 -0
  25. package/components/DynamicFilter/subcomponents/PopoverMenuFields/types.d.ts +6 -0
  26. package/components/DynamicFilter/subcomponents/fieldstypes/BooleanFilter/helpers.d.ts +39 -0
  27. package/components/DynamicFilter/subcomponents/fieldstypes/BooleanFilter/index.d.ts +4 -2
  28. package/components/DynamicFilter/subcomponents/fieldstypes/DateTimeFilter/helpers.d.ts +42 -0
  29. package/components/DynamicFilter/subcomponents/fieldstypes/DateTimeFilter/index.d.ts +4 -3
  30. package/components/DynamicFilter/subcomponents/fieldstypes/NumberFilter/helpers.d.ts +36 -0
  31. package/components/DynamicFilter/subcomponents/fieldstypes/NumberFilter/index.d.ts +4 -2
  32. package/components/DynamicFilter/subcomponents/fieldstypes/StringFilter/helpers.d.ts +39 -0
  33. package/components/DynamicFilter/subcomponents/fieldstypes/StringFilter/index.d.ts +4 -2
  34. package/components/DynamicFilter/subcomponents/fieldstypes/factory.d.ts +72 -4
  35. package/components/DynamicFilter/subcomponents/fieldstypes/validations.d.ts +25 -6
  36. package/components/DynamicFilter/tests/contants.d.ts +6 -0
  37. package/components/DynamicFilter/tests/types.d.ts +2 -0
  38. package/components/DynamicFilter/tests/utils.d.ts +2 -0
  39. package/components/DynamicFilter/types.d.ts +173 -42
  40. package/components/ErrorLabel/{index.78553a1e.js → index.12994bff.js} +5 -5
  41. package/components/Icon/{index.f6e8d810.js → index.b29ff2d9.js} +1 -1
  42. package/components/LanguagePopover/{index.5047b444.js → index.628fe97f.js} +5 -5
  43. package/components/ModalDialog/{index.5a307e29.js → index.49c40899.js} +5 -5
  44. package/components/ObjectLogs/{index.1315af37.js → index.d7c0092a.js} +23 -23
  45. package/components/PaperForm/{index.0114aa9b.js → index.c04000a9.js} +1 -1
  46. package/components/Period/{index.85fe764a.js → index.4f6e419d.js} +15 -15
  47. package/components/Resizeable/{index.8a442a8b.js → index.04fa8de5.js} +1 -1
  48. package/components/ScrollBar/{index.39eeb2de.js → index.35ebe9a1.js} +8 -3
  49. package/components/areas/components/AreasAdmin/{index.dbab59f1.js → index.25e50e70.js} +6 -6
  50. package/components/areas/components/AreasContainer/{index.f3f921b9.js → index.432b9d4c.js} +3 -3
  51. package/components/areas/components/GridLayout/{index.9953146d.js → index.359e777e.js} +5 -5
  52. package/components/areas/components/Window/{index.e34225ae.js → index.2b9f12fe.js} +35 -36
  53. package/components/areas/components/WindowPopUp/{index.90eb0348.js → index.d5fa0d74.js} +36 -37
  54. package/components/areas/components/{index.6d863764.js → index.912056a0.js} +10 -10
  55. package/components/areas/contexts/AreaContext/{index.f25f7180.js → index.b1439daf.js} +1 -1
  56. package/components/areas/contexts/AreasContext/{index.7406c20f.js → index.fb21af84.js} +1 -1
  57. package/components/areas/contexts/{index.e80d8f0f.js → index.1e46147e.js} +1 -1
  58. package/components/areas/hooks/{index.0fd57f88.js → index.5feefc73.js} +1 -1
  59. package/components/areas/hooks/useArea/{index.7bdbbb79.js → index.6f45f930.js} +2 -2
  60. package/components/areas/index.3df8c6d4.js +21 -0
  61. package/components/formatters/BooleanFormatter/{index.b3fb8a75.js → index.a50933fb.js} +1 -1
  62. package/components/formatters/{index.90a19f9f.js → index.7d2ad9ca.js} +2 -1
  63. package/components/hook-form/RHFAutocomplete/{index.74add0d0.js → index.0ffa2185.js} +69 -59
  64. package/components/hook-form/RHFAutocomplete/test/contants.d.ts +1 -0
  65. package/components/hook-form/RHFAutocompleteAsync/{index.0aa3c224.js → index.2dfbe7aa.js} +1 -1
  66. package/components/hook-form/RHFCheckbox/{index.ca94a050.js → index.1fcf42c8.js} +1 -1
  67. package/components/hook-form/RHFDateTime/{index.7f1cbd85.js → index.6c129ce4.js} +14 -25
  68. package/components/hook-form/RHFPeriod/{index.5d2a2071.js → index.1f6aa4c6.js} +2 -2
  69. package/components/hook-form/RHFTextField/classes/index.d.ts +0 -1
  70. package/components/hook-form/RHFTextField/{index.bef7eced.js → index.a021a2b3.js} +21 -11
  71. package/components/hook-form/RHFTextField/tests/contants.d.ts +2 -0
  72. package/components/index.d.ts +1 -3
  73. package/components/modal/{WindowBase.b5e29758.js → WindowBase.66ef3c9a.js} +3 -3
  74. package/components/modal/{WindowConfirm.cbc7720c.js → WindowConfirm.b31ed329.js} +16 -16
  75. package/components/modal/index.6d5b19ef.js +29 -0
  76. package/components/mui_extended/Accordion/{index.1d513477.js → index.002bad72.js} +2 -2
  77. package/components/mui_extended/IconButton/{index.1318a283.js → index.460c0476.js} +1 -1
  78. package/components/mui_extended/MenuActions/{index.1261168c.js → index.aaafafc3.js} +1 -1
  79. package/components/mui_extended/Pager/{index.984aac44.js → index.458f9f0d.js} +1 -1
  80. package/components/mui_extended/{index.cb9d48d2.js → index.915e84dc.js} +5 -5
  81. package/contexts/ModalContext/{index.3d92d9f9.js → index.d1aaddbc.js} +1 -1
  82. package/contexts/RHFormContext/{index.828b60ad.js → index.3dc6e2f5.js} +1 -0
  83. package/hooks/useModal/{index.4454145e.js → index.f77ab08b.js} +1 -1
  84. package/index.js +196 -225
  85. package/package.json +2 -2
  86. package/{react-draggable.0eef011c.js → react-draggable.6471b07e.js} +1 -1
  87. package/{react-resizable.bb58c8fc.js → react-resizable.b620abed.js} +2 -2
  88. package/test/constants_no_mock.d.ts +1 -0
  89. package/utils/{index.e882b264.js → index.b6ae791a.js} +12 -3
  90. package/utils/index.d.ts +2 -0
  91. package/vendor.d5904857.js +145 -0
  92. package/components/DynamicFilter/contexts/BaseContext/index.d.ts +0 -5
  93. package/components/DynamicFilter/contexts/BaseContext/types.d.ts +0 -45
  94. package/components/DynamicFilter/hooks/useFilter.d.ts +0 -1
  95. package/components/DynamicFilter/index.cddd7472.js +0 -1756
  96. package/components/DynamicFilter/subcomponents/ApplyedFilters/components/ApplyedFilter/index.d.ts +0 -3
  97. package/components/DynamicFilter/subcomponents/PopupEditFilter/index.d.ts +0 -2
  98. package/components/DynamicFilter/utils/Clases/index.d.ts +0 -20
  99. package/components/DynamicFilter/utils/Clases/types.d.ts +0 -17
  100. package/components/areas/index.6f09d168.js +0 -21
  101. package/components/modal/index.f6de895f.js +0 -29
@@ -1,1756 +0,0 @@
1
- import { S as ScrollBar } from "../ScrollBar/index.39eeb2de.js";
2
- import { styled, alpha as alpha$1 } from "@mui/material/styles";
3
- import { useRef, useState, useMemo, useCallback, useEffect, createContext, useContext } from "react";
4
- import { useModuleDictionary, voidFunction, useEnvironment, useHostTools, useFlagsPresent } from "@m4l/core";
5
- import * as Yup from "yup";
6
- import { useFormContext, useWatch } from "react-hook-form";
7
- import { R as RHFAutocomplete } from "../hook-form/RHFAutocomplete/index.74add0d0.js";
8
- import "lodash/debounce";
9
- import { jsx, jsxs, Fragment } from "react/jsx-runtime";
10
- import { generateUtilityClasses, generateUtilityClass, alpha, unstable_composeClasses as unstable_composeClasses$1, styled as styled$1, Skeleton, MenuItem, Popover as Popover$1, Popper, ClickAwayListener } from "@mui/material";
11
- import "../hook-form/RHFCheckbox/index.ca94a050.js";
12
- import { I as Icon } from "../Icon/index.f6e8d810.js";
13
- import { I as IconButton } from "../mui_extended/IconButton/index.1318a283.js";
14
- import "../mui_extended/Accordion/index.1d513477.js";
15
- import "../mui_extended/Avatar/index.fe06afd7.js";
16
- import "react-router-dom";
17
- import "@mui/material/Button";
18
- import "../mui_extended/Button/index.8406ed5b.js";
19
- import "../Image/index.aa24e982.js";
20
- import "@mui/lab";
21
- import { P as Popover } from "../mui_extended/Popover/index.58c49cc0.js";
22
- import { L as LabelMemuItem } from "../mui_extended/MenuActions/index.1261168c.js";
23
- import "../mui_extended/Pager/index.984aac44.js";
24
- import "../mui_extended/Tab/index.e0653a0a.js";
25
- import "../mui_extended/Typography/index.be3a279a.js";
26
- import "../ErrorLabel/index.78553a1e.js";
27
- import "@mui/x-date-pickers";
28
- import { R as RHFDateTime } from "../hook-form/RHFDateTime/index.7f1cbd85.js";
29
- import { useFormatter, useResponsiveDesktop } from "@m4l/graphics";
30
- import { R as RHFTextField } from "../hook-form/RHFTextField/index.bef7eced.js";
31
- import "../hook-form/RHFPeriod/index.5d2a2071.js";
32
- import "../Period/index.85fe764a.js";
33
- import { A as Actions, g as getCommonActionsDictionary } from "../CommonActions/components/Actions/index.f0a3167b.js";
34
- import "../../contexts/ModalContext/index.3d92d9f9.js";
35
- import "../../react-draggable.0eef011c.js";
36
- import "../ModalDialog/index.5a307e29.js";
37
- import "../Resizeable/index.8a442a8b.js";
38
- import "../modal/WindowConfirm.cbc7720c.js";
39
- import "../modal/WindowBase.b5e29758.js";
40
- import "../areas/components/index.6d863764.js";
41
- import "../areas/components/AreasAdmin/index.dbab59f1.js";
42
- import "zustand";
43
- import "../areas/contexts/AreasContext/index.7406c20f.js";
44
- import "zustand/shallow";
45
- import "../areas/components/AreasContainer/index.f3f921b9.js";
46
- import "react-grid-layout/css/styles.css";
47
- import "../../react-resizable.bb58c8fc.js";
48
- import "../areas/contexts/index.e80d8f0f.js";
49
- import "../areas/contexts/DynamicMFParmsContext/index.c19cb8cc.js";
50
- import "lodash/isString";
51
- import "react-dropzone";
52
- import "../hook-form/RHFUpload/index.7fdff30f.js";
53
- import { unstable_composeClasses } from "@mui/base";
54
- import clsx from "clsx";
55
- import "simplebar/dist/simplebar.min.css";
56
- import { R as RHFormProvider } from "../../contexts/RHFormContext/index.828b60ad.js";
57
- import { A as ActionCancel } from "../CommonActions/components/ActionCancel/index.a81752ef.js";
58
- import { A as ActionIntro } from "../CommonActions/components/ActionIntro/index.d567aebb.js";
59
- const WrapperApplyedFilters = styled("div")(({
60
- theme
61
- }) => ({
62
- width: "100%",
63
- margin: theme.spacing(0, 1),
64
- paddingLeft: theme.spacing(1),
65
- borderLeft: `1px solid ${theme.palette.divider}`
66
- }));
67
- const ContainerApplyedFilters = styled("div")(({
68
- theme
69
- }) => ({
70
- width: "100%",
71
- display: "flex",
72
- justifyContent: "flex-start",
73
- alignItems: "center",
74
- height: "auto",
75
- gap: theme.spacing(1.5)
76
- }));
77
- const STRING_OPERATORS = ["c", "nc"];
78
- const NUMBER_OPERATORS = ["b", "e", "ne", "gt", "gte", "lt", "lte"];
79
- const BOOLEAN_OPERATORS = ["e", "ne"];
80
- const DATE_TIME_OPERATORS = [
81
- "b",
82
- "e",
83
- "ne",
84
- "gt",
85
- "gte",
86
- "lt",
87
- "lte"
88
- ];
89
- const ALL_FIELDS = {
90
- name: "all",
91
- label: "dynamic_filter.all_fields",
92
- urlIcon: "",
93
- type: "string",
94
- multiple: true,
95
- presence: "optional"
96
- };
97
- const WrapperStringFilter$1 = styled("div")(({
98
- theme
99
- }) => ({
100
- display: "flex",
101
- flexDirection: "column",
102
- justifyContent: "center",
103
- alignItems: "center",
104
- width: "100%",
105
- minWidth: theme.spacing(3.75),
106
- padding: theme.spacing(3, 0),
107
- gap: theme.spacing(3)
108
- }));
109
- const WrapperAutoComplete$3 = styled("div")(() => ({
110
- width: "100%"
111
- }));
112
- const getDefaultStringFilter = (field, fixed, getLabel) => {
113
- const dfop1 = field.defaultOperand1;
114
- const defaultFilter = {
115
- id: 0,
116
- n: field.name,
117
- fixed,
118
- isSetted: false,
119
- o: "c",
120
- labelOperator: "",
121
- o1: "",
122
- o2: "",
123
- labelOperands: ""
124
- };
125
- if (dfop1 !== void 0 && typeof dfop1 === "string") {
126
- defaultFilter.o1 = dfop1;
127
- }
128
- defaultFilter.labelOperands = defaultFilter.o1 + "";
129
- defaultFilter.labelOperator = getLabel(`dynamic_filter.operator_${defaultFilter.o}`);
130
- return defaultFilter;
131
- };
132
- function StringFilter() {
133
- const {
134
- popupData: {
135
- filter,
136
- field
137
- },
138
- setPoupEditValidationSchema,
139
- setFnTransformFormValuesIntoValues: setTransformFunctionFormValuesToValues,
140
- getLabelOperator,
141
- classes
142
- } = useBase();
143
- const {
144
- getLabel
145
- } = useModuleDictionary();
146
- const inputRef = useRef(null);
147
- const {
148
- setValue
149
- } = useFormContext();
150
- const [isLoaded, setIsLoaded] = useState(false);
151
- const options = useMemo(() => STRING_OPERATORS.map((o) => ({
152
- id: o,
153
- label: getLabelOperator(o)
154
- })), [getLabelOperator]);
155
- const transformFunctionFormValuesToValues = useCallback((data) => {
156
- if (!filter || !field)
157
- return void 0;
158
- const newFilter = {
159
- id: filter.id,
160
- n: field.name,
161
- fixed: filter.fixed,
162
- isSetted: true,
163
- o: data.valueOperator.id,
164
- labelOperator: data.valueOperator.label,
165
- o1: data.valueOperand1,
166
- labelOperands: data.valueOperand1
167
- };
168
- return newFilter;
169
- }, []);
170
- useEffect(() => {
171
- if (!isLoaded) {
172
- setPoupEditValidationSchema({
173
- valueOperator: Yup.object().nullable().required(getLabel(`operator_required`)),
174
- valueOperand1: Yup.string().required(getLabel(`operand_required`))
175
- });
176
- }
177
- setTransformFunctionFormValuesToValues(transformFunctionFormValuesToValues);
178
- if (filter && field) {
179
- setValue("valueOperand1", filter.o1, {
180
- shouldTouch: false,
181
- shouldValidate: false
182
- });
183
- }
184
- setIsLoaded(true);
185
- }, [getLabel, filter, field]);
186
- useEffect(() => {
187
- inputRef.current?.focus();
188
- }, [isLoaded]);
189
- return /* @__PURE__ */ jsx(WrapperStringFilter$1, {
190
- className: classes.stringFilter,
191
- children: isLoaded && /* @__PURE__ */ jsxs(Fragment, {
192
- children: [/* @__PURE__ */ jsx(WrapperAutoComplete$3, {
193
- children: /* @__PURE__ */ jsx(RHFAutocomplete, {
194
- name: "valueOperator",
195
- autoComplete: "off",
196
- options,
197
- getOptionLabel: (option) => option.label,
198
- isOptionEqualToValue: (option, value) => option.id === value.id,
199
- label: ""
200
- })
201
- }), /* @__PURE__ */ jsx(RHFTextField, {
202
- name: "valueOperand1",
203
- ref: inputRef,
204
- focused: true
205
- })]
206
- })
207
- });
208
- }
209
- const WrapperAllFieldsFilter$1 = styled("div")(({
210
- theme
211
- }) => ({
212
- display: "flex",
213
- flexDirection: "column",
214
- justifyContent: "center",
215
- alignItems: "center",
216
- width: "100%",
217
- minWidth: theme.spacing(3.75),
218
- height: "100%",
219
- padding: theme.spacing(3, 0),
220
- gap: theme.spacing(3)
221
- }));
222
- const WrapperAutoComplete$2 = styled("div")(() => ({
223
- width: "100%"
224
- }));
225
- const getDefaultBooleanFilter = (field, fixed, getLabel) => {
226
- const dfop1 = field.defaultOperand1;
227
- const defaultFilter = {
228
- id: 0,
229
- n: field.name,
230
- fixed,
231
- isSetted: true,
232
- o: "e",
233
- labelOperator: "",
234
- o1: true,
235
- o2: "",
236
- labelOperands: ""
237
- };
238
- defaultFilter.labelOperator = getLabel(`dynamic_filter.operator_${defaultFilter.o}`);
239
- if (dfop1 !== void 0 && typeof dfop1 === "boolean") {
240
- defaultFilter.o1 = dfop1;
241
- }
242
- defaultFilter.labelOperands = getLabel(`dynamic_filter.operand_${defaultFilter.o1}`);
243
- return defaultFilter;
244
- };
245
- function BooleanFilter() {
246
- const {
247
- setPoupEditValidationSchema,
248
- setFnTransformFormValuesIntoValues: setTransformFunctionFormValuesToValues,
249
- getLabelOperator,
250
- classes
251
- } = useBase();
252
- const {
253
- getLabel
254
- } = useModuleDictionary();
255
- const {
256
- popupData: {
257
- filter,
258
- field
259
- }
260
- } = useBase();
261
- const {
262
- setValue
263
- } = useFormContext();
264
- const [isLoaded, setIsLoaded] = useState(false);
265
- const operators = useMemo(() => BOOLEAN_OPERATORS.map((o) => ({
266
- id: o,
267
- label: getLabelOperator(o)
268
- })), [getLabelOperator]);
269
- const optionsYesNo = useMemo(() => [{
270
- value: true,
271
- label: getLabel("dynamic_filter.operand_true")
272
- }, {
273
- value: false,
274
- label: getLabel("dynamic_filter.operand_false")
275
- }], [getLabel]);
276
- const transformFunctionFormValuesToValues = useCallback((data) => {
277
- if (!filter || !field)
278
- return void 0;
279
- const newFilter = {
280
- id: filter.id,
281
- n: field.name,
282
- fixed: filter.fixed,
283
- isSetted: true,
284
- o: data.valueOperator.id,
285
- labelOperator: data.valueOperator.label,
286
- o1: data.valueOperand1.value,
287
- labelOperands: data.valueOperand1.label
288
- };
289
- return newFilter;
290
- }, []);
291
- useEffect(() => {
292
- if (!isLoaded) {
293
- setPoupEditValidationSchema({
294
- valueOperator: Yup.object().nullable().required(getLabel(`error_operator_required`)),
295
- valueOperand1: Yup.object().nullable().required(getLabel(`error_operand_required`))
296
- });
297
- }
298
- setTransformFunctionFormValuesToValues(transformFunctionFormValuesToValues);
299
- if (filter && field) {
300
- setValue("valueOperand1", {
301
- value: filter.o1,
302
- label: getLabel(`dynamic_filter.operand_${filter.o1}`)
303
- }, {
304
- shouldTouch: false,
305
- shouldValidate: false
306
- });
307
- }
308
- setIsLoaded(true);
309
- }, [getLabel]);
310
- return /* @__PURE__ */ jsx(WrapperAllFieldsFilter$1, {
311
- className: classes.booleanFilter,
312
- children: isLoaded && /* @__PURE__ */ jsxs(Fragment, {
313
- children: [/* @__PURE__ */ jsx(WrapperAutoComplete$2, {
314
- children: /* @__PURE__ */ jsx(RHFAutocomplete, {
315
- name: "valueOperator",
316
- autoComplete: "off",
317
- options: operators,
318
- getOptionLabel: (option) => option.label,
319
- isOptionEqualToValue: (option, value) => option.id === value.id,
320
- label: ""
321
- })
322
- }), /* @__PURE__ */ jsx(WrapperAutoComplete$2, {
323
- children: /* @__PURE__ */ jsx(RHFAutocomplete, {
324
- name: "valueOperand1",
325
- autoComplete: "off",
326
- options: optionsYesNo,
327
- getOptionLabel: (option) => option.label,
328
- isOptionEqualToValue: (option, value) => option.value === value.value,
329
- label: ""
330
- })
331
- })]
332
- })
333
- });
334
- }
335
- const WrapperAllFieldsFilter = styled("div")(({
336
- theme
337
- }) => ({
338
- display: "flex",
339
- flexDirection: "column",
340
- justifyContent: "center",
341
- alignItems: "center",
342
- width: "100%",
343
- minWidth: theme.spacing(3.75),
344
- padding: theme.spacing(3, 0),
345
- gap: theme.spacing(3)
346
- }));
347
- const WrapperAutoComplete$1 = styled("div")(() => ({
348
- width: "100%"
349
- }));
350
- function isValidDate(d) {
351
- return d && d instanceof Date;
352
- }
353
- const verifyStringFilter = (filter) => {
354
- if (typeof filter.o !== "string") {
355
- return false;
356
- }
357
- if (STRING_OPERATORS.findIndex((f) => f === filter.o) === -1) {
358
- return false;
359
- }
360
- if (typeof filter.o1 !== "string") {
361
- return false;
362
- }
363
- return true;
364
- };
365
- const verifyNumberFilter = (filter) => {
366
- if (typeof filter.o !== "number") {
367
- return false;
368
- }
369
- if (NUMBER_OPERATORS.findIndex((f) => f === filter.o) === -1) {
370
- return false;
371
- }
372
- if (typeof filter.o1 !== "number") {
373
- return false;
374
- }
375
- if (filter.o === "b" && typeof filter.o2 !== "number") {
376
- return false;
377
- }
378
- return true;
379
- };
380
- const verifyBooleanFilter = (filter) => {
381
- if (typeof filter.o !== "string") {
382
- return false;
383
- }
384
- if (BOOLEAN_OPERATORS.findIndex((f) => f === filter.o) === -1) {
385
- return false;
386
- }
387
- if (typeof filter.o1 !== "boolean") {
388
- return false;
389
- }
390
- return true;
391
- };
392
- const verifyDateTime = (filter) => {
393
- if (typeof filter.o !== "string") {
394
- return false;
395
- }
396
- if (DATE_TIME_OPERATORS.findIndex((f) => f === filter.o) === -1) {
397
- return false;
398
- }
399
- if (typeof filter.o1 !== "string") {
400
- return false;
401
- }
402
- if (filter.o === "b" && typeof filter.o2 !== "string") {
403
- return false;
404
- }
405
- return true;
406
- };
407
- const getDefaultDateTimeFilter = (field, fixed, getLabel, formatters) => {
408
- const defaultStartDate = new Date();
409
- const defaultEndDate = new Date();
410
- const {
411
- dateFormatter
412
- } = formatters;
413
- let dfop1 = field.defaultOperand1;
414
- let dfop2 = field.defaultOperand2;
415
- const defaultFilter = {
416
- id: 0,
417
- n: field.name,
418
- fixed,
419
- isSetted: true,
420
- o: "b",
421
- labelOperator: "",
422
- o1: dfop1,
423
- o2: dfop2,
424
- labelOperands: ""
425
- };
426
- if (dfop1) {
427
- if (isValidDate(dfop1)) {
428
- defaultStartDate.setDate(dfop1.getDate());
429
- } else {
430
- dfop1 = void 0;
431
- }
432
- }
433
- if (dfop1 === void 0) {
434
- defaultStartDate.setHours(0, 0, 0, 0);
435
- }
436
- if (dfop2) {
437
- if (isValidDate(dfop2)) {
438
- defaultEndDate.setDate(dfop2.getDate());
439
- } else {
440
- dfop2 = void 0;
441
- }
442
- }
443
- if (dfop2 === void 0) {
444
- defaultEndDate.setHours(23, 59, 59, 999);
445
- }
446
- defaultFilter.o1 = defaultStartDate.toISOString();
447
- defaultFilter.o2 = defaultEndDate.toISOString();
448
- defaultFilter.labelOperands = `${dateFormatter.formatDate(defaultStartDate, formatters.dateFormatter.datetimeFormat)} - ${dateFormatter.formatDate(defaultEndDate, dateFormatter.datetimeFormat)}`;
449
- defaultFilter.labelOperator = getLabel(`dynamic_filter.operator_${defaultFilter.o}`);
450
- return defaultFilter;
451
- };
452
- function DateTimeFilter() {
453
- const {
454
- setPoupEditValidationSchema,
455
- setFnTransformFormValuesIntoValues: setTransformFunctionFormValuesToValues,
456
- getLabelOperator
457
- } = useBase();
458
- const {
459
- getLabel
460
- } = useModuleDictionary();
461
- const {
462
- dateFormatter
463
- } = useFormatter();
464
- const {
465
- popupData: {
466
- filter,
467
- field
468
- },
469
- classes
470
- } = useBase();
471
- const {
472
- control,
473
- setValue
474
- } = useFormContext();
475
- const operator = useWatch({
476
- control,
477
- name: "valueOperator"
478
- });
479
- const [isLoaded, setIsLoaded] = useState(false);
480
- const options = useMemo(() => DATE_TIME_OPERATORS.map((o) => ({
481
- id: o,
482
- label: getLabelOperator(o)
483
- })), [getLabelOperator]);
484
- const transformFunctionFormValuesToValues = useCallback((data) => {
485
- if (!filter || !field)
486
- return void 0;
487
- const newFilter = {
488
- id: filter.id,
489
- n: field.name,
490
- fixed: filter.fixed,
491
- isSetted: true,
492
- o: data.valueOperator.id,
493
- o1: data.valueOperand1.toISOString(),
494
- labelOperator: data.valueOperator.label,
495
- labelOperands: ""
496
- };
497
- if (data.valueOperator.id === "b") {
498
- newFilter.o2 = data.valueOperand2.toISOString();
499
- newFilter.labelOperands = `${dateFormatter.formatDate(data.valueOperand1, dateFormatter.datetimeFormat)} - ${dateFormatter.formatDate(data.valueOperand2, dateFormatter.datetimeFormat)}`;
500
- } else {
501
- newFilter.o2 = newFilter.o2 ? newFilter.o2 : newFilter.o1;
502
- newFilter.labelOperands = dateFormatter.formatDate(data.valueOperand1, dateFormatter.datetimeFormat);
503
- }
504
- return newFilter;
505
- }, []);
506
- useEffect(() => {
507
- if (!isLoaded) {
508
- setPoupEditValidationSchema({
509
- valueOperator: Yup.object().nullable().required(getLabel(`operator_required`)),
510
- valueOperand1: Yup.date().required(getLabel(`dynamic_filter.error_invalid_date`)).typeError(getLabel(`dynamic_filter.error_invalid_date`)),
511
- valueOperand2: Yup.mixed().when(["valueOperator.id"], {
512
- is: "b",
513
- then: Yup.date().typeError(getLabel(`dynamic_filter.error_invalid_date`)).min(Yup.ref("valueOperand1"), getLabel(`dynamic_filter.error_less_than_start`))
514
- })
515
- });
516
- }
517
- if (filter && field) {
518
- setValue("valueOperand1", new Date(filter.o1), {
519
- shouldTouch: false,
520
- shouldValidate: false
521
- });
522
- setValue("valueOperand2", new Date(filter.o2), {
523
- shouldTouch: false,
524
- shouldValidate: false
525
- });
526
- }
527
- setTransformFunctionFormValuesToValues(transformFunctionFormValuesToValues);
528
- setIsLoaded(true);
529
- }, [getLabel, filter, field]);
530
- return /* @__PURE__ */ jsx(WrapperAllFieldsFilter, {
531
- className: classes.dateTimeFilter,
532
- children: isLoaded && /* @__PURE__ */ jsxs(Fragment, {
533
- children: [/* @__PURE__ */ jsx(WrapperAutoComplete$1, {
534
- children: /* @__PURE__ */ jsx(RHFAutocomplete, {
535
- name: "valueOperator",
536
- autoComplete: "off",
537
- options,
538
- getOptionLabel: (option) => option.label,
539
- isOptionEqualToValue: (option, value) => option.id === value.id,
540
- label: ""
541
- })
542
- }), /* @__PURE__ */ jsx(RHFDateTime, {
543
- name: "valueOperand1",
544
- autoComplete: "off",
545
- label: "",
546
- focused: true
547
- }), operator && operator.id === "b" && /* @__PURE__ */ jsx(RHFDateTime, {
548
- name: "valueOperand2",
549
- autoComplete: "off",
550
- label: ""
551
- })]
552
- })
553
- });
554
- }
555
- const WrapperStringFilter = styled("div")(({
556
- theme
557
- }) => ({
558
- display: "flex",
559
- flexDirection: "column",
560
- justifyContent: "center",
561
- alignItems: "center",
562
- width: "100%",
563
- minWidth: theme.spacing(3.75),
564
- padding: theme.spacing(3, 0),
565
- gap: theme.spacing(3)
566
- }));
567
- const WrapperAutoComplete = styled("div")(() => ({
568
- width: "100%"
569
- }));
570
- const getDefaultNumberFilter = (field, fixed, getLabel) => {
571
- const dfop1 = field.defaultOperand1;
572
- const dfop2 = field.defaultOperand2;
573
- const defaultFilter = {
574
- id: 0,
575
- n: field.name,
576
- fixed,
577
- isSetted: false,
578
- o: "e",
579
- labelOperator: "",
580
- o1: "",
581
- o2: "",
582
- labelOperands: ""
583
- };
584
- if (dfop1 !== void 0 && typeof dfop1 === "number") {
585
- defaultFilter.o1 = dfop1;
586
- defaultFilter.labelOperands = defaultFilter.o1;
587
- }
588
- if (dfop2 !== void 0 && typeof dfop2 === "number") {
589
- defaultFilter.o2 = dfop2;
590
- }
591
- defaultFilter.labelOperator = getLabel(`dynamic_filter.operator_${defaultFilter.o}`);
592
- return defaultFilter;
593
- };
594
- function NumberFilter() {
595
- const {
596
- popupData: {
597
- filter,
598
- field
599
- },
600
- setPoupEditValidationSchema,
601
- setFnTransformFormValuesIntoValues: setTransformFunctionFormValuesToValues,
602
- getLabelOperator,
603
- classes
604
- } = useBase();
605
- const {
606
- getLabel
607
- } = useModuleDictionary();
608
- const inputRef = useRef(null);
609
- const {
610
- control,
611
- setValue
612
- } = useFormContext();
613
- const [isLoaded, setIsLoaded] = useState(false);
614
- const operator = useWatch({
615
- control,
616
- name: "valueOperator"
617
- });
618
- const options = useMemo(() => NUMBER_OPERATORS.map((o) => ({
619
- id: o,
620
- label: getLabelOperator(o)
621
- })), [getLabelOperator]);
622
- const transformFunctionFormValuesToValues = useCallback((data) => {
623
- if (!filter || !field)
624
- return void 0;
625
- const newFilter = {
626
- id: filter.id,
627
- n: field.name,
628
- fixed: filter.fixed,
629
- isSetted: true,
630
- o: data.valueOperator.id,
631
- o1: Number(data.valueOperand1),
632
- o2: data.valueOperand2,
633
- labelOperator: data.valueOperator.label,
634
- labelOperands: data.valueOperand1
635
- };
636
- if (data.valueOperator.id === "b") {
637
- newFilter.labelOperands = `${data.valueOperand1} - ${data.valueOperand2}`;
638
- newFilter.o2 = Number(data.valueOperand2);
639
- } else {
640
- newFilter.o2 = void 0;
641
- }
642
- return newFilter;
643
- }, []);
644
- useEffect(() => {
645
- if (!isLoaded) {
646
- setPoupEditValidationSchema({
647
- valueOperator: Yup.object().nullable().required(getLabel(`dynamic_filter.error_operator_required`)),
648
- valueOperand1: Yup.number().typeError(getLabel(`dynamic_filter.error_operand_mustbe_number`)),
649
- valueOperand2: Yup.string().when("valueOperator", {
650
- is: (o) => {
651
- return o.id === "b";
652
- },
653
- then: Yup.string().test("DOB", getLabel(`dynamic_filter.error_operand_mustbe_number`), (value) => {
654
- if (value === "")
655
- return false;
656
- return !isNaN(Number(value));
657
- })
658
- })
659
- });
660
- }
661
- setTransformFunctionFormValuesToValues(transformFunctionFormValuesToValues);
662
- if (filter && field) {
663
- setValue("valueOperand1", filter.o1, {
664
- shouldTouch: false,
665
- shouldValidate: false
666
- });
667
- setValue("valueOperand2", filter.o2, {
668
- shouldTouch: false,
669
- shouldValidate: false
670
- });
671
- }
672
- setIsLoaded(true);
673
- }, [getLabel, filter, field]);
674
- useEffect(() => {
675
- inputRef.current?.focus();
676
- }, [isLoaded]);
677
- return /* @__PURE__ */ jsx(WrapperStringFilter, {
678
- className: classes.numberFilter,
679
- children: isLoaded && /* @__PURE__ */ jsxs(Fragment, {
680
- children: [/* @__PURE__ */ jsx(WrapperAutoComplete, {
681
- children: /* @__PURE__ */ jsx(RHFAutocomplete, {
682
- name: "valueOperator",
683
- autoComplete: "off",
684
- options,
685
- getOptionLabel: (option) => option.label,
686
- isOptionEqualToValue: (option, value) => option.id === value.id,
687
- label: ""
688
- })
689
- }), /* @__PURE__ */ jsx(RHFTextField, {
690
- name: "valueOperand1",
691
- ref: inputRef,
692
- type: "number",
693
- focused: true
694
- }), operator && operator.id === "b" && /* @__PURE__ */ jsx(RHFTextField, {
695
- name: "valueOperand2",
696
- ref: inputRef,
697
- type: "number"
698
- })]
699
- })
700
- });
701
- }
702
- const strategiesDefaultFilterValues = {
703
- string: getDefaultStringFilter,
704
- number: getDefaultNumberFilter,
705
- boolean: getDefaultBooleanFilter,
706
- datetime: getDefaultDateTimeFilter,
707
- __default__: () => {
708
- throw new Error("Type no defined");
709
- }
710
- };
711
- const getDefaultFilterValues = (field, fixed, getLabel, formatters) => {
712
- const transformer = strategiesDefaultFilterValues[field.type] ?? strategiesDefaultFilterValues.__default__;
713
- return transformer(field, fixed, getLabel, formatters);
714
- };
715
- const strategiesEditFilterComponent = {
716
- string: StringFilter,
717
- number: NumberFilter,
718
- boolean: BooleanFilter,
719
- datetime: DateTimeFilter,
720
- __default__: /* @__PURE__ */ jsx(Fragment, {})
721
- };
722
- const PopupEditFilterComponent = (props) => {
723
- const {
724
- getFieldByName
725
- } = useBase();
726
- const field = getFieldByName(props.filter.n);
727
- if (!field)
728
- return /* @__PURE__ */ jsx(Fragment, {});
729
- const Component = strategiesEditFilterComponent[field.type] ?? strategiesEditFilterComponent.__default__;
730
- return /* @__PURE__ */ jsx(Component, {});
731
- };
732
- const DynamicFilterClassess = generateUtilityClasses("M4LDynamicFilter", [
733
- "root",
734
- "containerDesktop",
735
- "containerMobile",
736
- "containerFistRow",
737
- "containerFilterButton",
738
- "inputFilter",
739
- "applyedFilters",
740
- "applyedFilter",
741
- "PopupEditFilter",
742
- "booleanFilter",
743
- "dateTimeFilter",
744
- "numberFilter",
745
- "inEdition",
746
- "filterIsDirty",
747
- "noSetted"
748
- ]);
749
- function getDynamicFiltertUtilityClass(slot) {
750
- return generateUtilityClass("M4LDynamicFilter", slot);
751
- }
752
- const useUtilityClasses = (ownerState) => {
753
- const slots = {
754
- root: ["root"],
755
- containerDesktop: ["containerDesktop", ownerState.inEdition && "inEdition"],
756
- containerMobile: ["containerMobile", ownerState.inEdition && "inEdition"],
757
- containerFistRow: ["containerFistRow"],
758
- containerFilterButton: ["containerFilterButton", ownerState.isDirty && ownerState.isValid ? "filterIsDirty" : ""],
759
- inputFilter: ["inputFilter"],
760
- applyedFilters: ["applyedFilters"],
761
- applyedFilter: ["applyedFilter"],
762
- popupEditFilter: ["popupEditFilter"],
763
- clearFilters: ["clearFilters"],
764
- booleanFilter: ["booleanFilter"],
765
- dateTimeFilter: ["dateTimeFilter"],
766
- numberFilter: ["numberFilter"],
767
- stringFilter: ["stringFilter"]
768
- };
769
- const composedClasses = unstable_composeClasses(slots, getDynamicFiltertUtilityClass, {});
770
- return {
771
- ...composedClasses
772
- };
773
- };
774
- const initialState = {
775
- fields: [],
776
- withAllField: true,
777
- isDirty: false,
778
- isValid: true,
779
- automatic: false,
780
- availableFields: [],
781
- getFieldByName: () => void 0,
782
- getLabelOperator: () => "",
783
- applyedFilters: [],
784
- addFilter: voidFunction,
785
- updateFilter: voidFunction,
786
- removeFilter: voidFunction,
787
- clearFilters: voidFunction,
788
- fireOnChangeFilters: voidFunction,
789
- openAnchorEl: null,
790
- openMenuFields: voidFunction,
791
- closeMenuFields: voidFunction,
792
- popupData: {
793
- popupAnchorEl: null,
794
- filter: null,
795
- field: null
796
- },
797
- popupValidationSchema: {},
798
- setPoupEditValidationSchema: voidFunction,
799
- showPopupForAddFilter: voidFunction,
800
- showPopupForEditFilter: voidFunction,
801
- hidePopupEdit: voidFunction,
802
- setInEdition: voidFunction,
803
- inEdition: false,
804
- setFnTransformFormValuesIntoValues: voidFunction,
805
- fnTransformFormValuesIntoRawValues: () => void 0,
806
- ownerState: {},
807
- classes: {}
808
- };
809
- const BaseContext = createContext(initialState);
810
- const getMaxId = (applyedFilters) => {
811
- return applyedFilters.reduce((prev, n) => {
812
- return n.id > prev ? n.id : prev;
813
- }, 0);
814
- };
815
- const getFilterById = (id, applyedFilters) => {
816
- return applyedFilters.findIndex((f) => f.id === id);
817
- };
818
- const formatToInitialFilters = (applyedFilter) => {
819
- return applyedFilter.map((af) => ({
820
- n: af.n,
821
- o: af.o,
822
- labelOperands: af.labelOperands,
823
- o1: af.o1,
824
- o2: af.o2
825
- }));
826
- };
827
- const formatToRawFilter = (applyedFilter) => {
828
- return applyedFilter.map((af) => ({
829
- n: af.n,
830
- o: af.o,
831
- o1: af.o1,
832
- o2: af.o2
833
- }));
834
- };
835
- const getInitialFilters = (fields, filters, getFieldByName, getLabel, formatters) => {
836
- const newFilters = [];
837
- const fixedFields = [];
838
- for (let index = 0; index < filters.length; index++) {
839
- let add;
840
- const filter = {
841
- ...filters[index],
842
- id: 0,
843
- isSetted: true,
844
- fixed: false,
845
- labelOperator: ""
846
- };
847
- const field = getFieldByName(filter.n);
848
- if (!field)
849
- continue;
850
- switch (field.type) {
851
- case "string":
852
- add = verifyStringFilter(filter);
853
- break;
854
- case "number":
855
- add = verifyNumberFilter(filter);
856
- break;
857
- case "boolean":
858
- add = verifyBooleanFilter(filter);
859
- break;
860
- case "datetime":
861
- add = verifyDateTime(filter);
862
- break;
863
- default:
864
- add = false;
865
- }
866
- if (add) {
867
- if (field.presence === "fixed") {
868
- if (fixedFields.findIndex((f) => f === field.name) === -1) {
869
- filter.fixed = true;
870
- fixedFields.push(field.name);
871
- } else {
872
- filter.fixed = false;
873
- }
874
- }
875
- filter.isSetted = true;
876
- filter.id = newFilters.length + 1;
877
- filter.labelOperator = getLabel(`dynamic_filter.operator_${filter.o}`);
878
- newFilters.push(filter);
879
- }
880
- }
881
- for (let index = 0; index < fields.length; index++) {
882
- const field = fields[index];
883
- if (field.presence === "initialized" || field.presence === "fixed") {
884
- if (!filters.find((f) => f.n === field.name)) {
885
- const newFilter = getDefaultFilterValues(field, field.presence === "fixed", getLabel, formatters);
886
- newFilter.id = newFilters.length + 1;
887
- newFilters.push(newFilter);
888
- }
889
- }
890
- }
891
- return newFilters;
892
- };
893
- function BaseProvider(props) {
894
- const {
895
- isSkeleton = false,
896
- fields,
897
- initialFilters = [],
898
- withAllField = true,
899
- onChangeFilter,
900
- automatic = true,
901
- children
902
- } = props;
903
- const [openAnchorEl, setOpenAnchorEl] = useState(null);
904
- const [popupData, setPopupData] = useState({
905
- popupAnchorEl: null,
906
- filter: null,
907
- field: null
908
- });
909
- const {
910
- getLabel
911
- } = useModuleDictionary();
912
- const [popupValidationSchema, setInternalPopupValidationSchema] = useState(Yup.object().shape({}));
913
- const [fnTransformFormValuesIntoRawValues, setInternalfnTransormFormValuesIntoRawValues] = useState(() => void 0);
914
- const {
915
- host_static_assets,
916
- environment_assets
917
- } = useEnvironment();
918
- const formatter = useFormatter();
919
- const all_fields = useMemo(() => {
920
- return {
921
- ...ALL_FIELDS,
922
- label: getLabel("dynamic_filter.all_fields"),
923
- urlIcon: `${host_static_assets}/${environment_assets}/frontend/components/dynamic_filter/assets/icons/all_fields.svg`
924
- };
925
- }, [getLabel, host_static_assets, environment_assets]);
926
- const [inEdition, setInEdition] = useState(false);
927
- const [isDirty, setIsDirty] = useState(!automatic);
928
- const [isValid, setIsValid] = useState(false);
929
- const {
930
- toast
931
- } = useHostTools();
932
- const getFieldByName = useCallback((name) => {
933
- return fields.concat(all_fields).find((f) => {
934
- return f.name === name;
935
- });
936
- }, [fields, all_fields]);
937
- const getLabelOperator = useCallback((operator) => {
938
- return getLabel(`dynamic_filter.operator_${operator}`);
939
- }, [getLabel]);
940
- const [applyedFilters, setApplyedFilters] = useState(getInitialFilters(fields, initialFilters, getFieldByName, getLabel, formatter));
941
- const availableFields = useMemo(() => {
942
- const newFields = [];
943
- for (let index = 0; index < fields.length; index++) {
944
- let add;
945
- const field = fields[index];
946
- add = true;
947
- if (field.multiple !== void 0 && field.multiple === false) {
948
- const fIndx = applyedFilters.findIndex((f) => f.n === field.name);
949
- if (fIndx > -1) {
950
- add = false;
951
- }
952
- }
953
- if (add) {
954
- newFields.push(field);
955
- }
956
- }
957
- return newFields;
958
- }, [fields, applyedFilters]);
959
- const fireOnChangeFilters = useCallback(() => {
960
- if (isValid) {
961
- if (!automatic)
962
- setIsDirty(false);
963
- onChangeFilter(formatToInitialFilters(applyedFilters), formatToRawFilter(applyedFilters));
964
- } else {
965
- toast(getLabel("dynamic_filter.error_filters_no_setted"), {
966
- type: "error",
967
- autoClose: 1e4
968
- });
969
- }
970
- }, [isValid, applyedFilters, onChangeFilter]);
971
- useEffect(() => {
972
- const NoValid = applyedFilters.findIndex((f) => !f.isSetted) > -1;
973
- if (NoValid) {
974
- setIsValid(false);
975
- } else {
976
- setIsValid(true);
977
- }
978
- if (!automatic) {
979
- setIsDirty(true);
980
- return;
981
- }
982
- if (!NoValid) {
983
- setIsDirty(false);
984
- onChangeFilter(formatToInitialFilters(applyedFilters), formatToRawFilter(applyedFilters));
985
- }
986
- }, [applyedFilters]);
987
- const addFilter = useCallback((newFilter) => {
988
- setApplyedFilters((lastApplyedFilters) => {
989
- const newArray = [...lastApplyedFilters];
990
- const newFilterFull = {
991
- ...newFilter,
992
- id: getMaxId(lastApplyedFilters) + 1,
993
- labelOperator: getLabelOperator(newFilter.o)
994
- };
995
- newArray.push(newFilterFull);
996
- return newArray;
997
- });
998
- }, []);
999
- const updateFilter = useCallback((newFilter) => {
1000
- setApplyedFilters((lastApplyedFilters) => {
1001
- const newArray = [...lastApplyedFilters];
1002
- const findedFilter = getFilterById(newFilter.id, newArray);
1003
- if (findedFilter > -1) {
1004
- newArray.splice(findedFilter, 1, {
1005
- ...newFilter,
1006
- labelOperator: getLabelOperator(newFilter.o)
1007
- });
1008
- }
1009
- return newArray;
1010
- });
1011
- }, []);
1012
- const clearFilters = useCallback(() => {
1013
- setApplyedFilters((lastFilters) => {
1014
- const newFilters = [];
1015
- for (let index = 0; index < lastFilters.length; index++) {
1016
- const filter = lastFilters[index];
1017
- if (filter.fixed) {
1018
- newFilters.push(filter);
1019
- }
1020
- }
1021
- return newFilters;
1022
- });
1023
- }, []);
1024
- const openMenuFields = useCallback((anchorEl) => {
1025
- setOpenAnchorEl(anchorEl);
1026
- setInEdition(true);
1027
- }, [applyedFilters]);
1028
- const closeMenuFields = useCallback(() => {
1029
- setOpenAnchorEl(null);
1030
- setInEdition(false);
1031
- }, []);
1032
- const hidePopupEdit = useCallback((stayInEditon) => {
1033
- if (popupData.popupAnchorEl) {
1034
- setPopupData({
1035
- popupAnchorEl: null,
1036
- filter: null,
1037
- field: null
1038
- });
1039
- }
1040
- if (!stayInEditon && inEdition) {
1041
- setInEdition(false);
1042
- }
1043
- }, [popupData, inEdition]);
1044
- const showPopupForAddFilter = useCallback((anchorEl, field) => {
1045
- setPopupData({
1046
- popupAnchorEl: anchorEl,
1047
- filter: getDefaultFilterValues(field, false, getLabel, formatter),
1048
- field
1049
- });
1050
- setInEdition(true);
1051
- }, []);
1052
- const showPopupForEditFilter = useCallback((anchorEl, filterToEdit) => {
1053
- setPopupData({
1054
- popupAnchorEl: anchorEl,
1055
- filter: filterToEdit,
1056
- field: getFieldByName(filterToEdit.n)
1057
- });
1058
- setInEdition(true);
1059
- }, []);
1060
- const removeFilter = useCallback((id) => {
1061
- setApplyedFilters((lastApplyedFilters) => {
1062
- const newArray = [...lastApplyedFilters];
1063
- const index_to_remove = lastApplyedFilters.findIndex((filter) => id === filter.id);
1064
- if (index_to_remove > -1) {
1065
- if (!newArray[index_to_remove].fixed) {
1066
- newArray.splice(index_to_remove, 1);
1067
- }
1068
- }
1069
- return newArray;
1070
- });
1071
- }, []);
1072
- const setPoupEditValidationSchema = useCallback((validationSchema) => {
1073
- setInternalPopupValidationSchema(Yup.object().shape({
1074
- ...validationSchema
1075
- }));
1076
- }, []);
1077
- const setFnTransformFormValuesIntoValues = useCallback((fn) => {
1078
- setInternalfnTransormFormValuesIntoRawValues(() => fn);
1079
- }, []);
1080
- const ownerState = {
1081
- inEdition,
1082
- isDirty,
1083
- isValid
1084
- };
1085
- const classes = useUtilityClasses(ownerState);
1086
- return /* @__PURE__ */ jsx(BaseContext.Provider, {
1087
- value: {
1088
- isSkeleton,
1089
- inEdition,
1090
- automatic,
1091
- isDirty,
1092
- isValid,
1093
- withAllField,
1094
- fields,
1095
- availableFields,
1096
- getFieldByName,
1097
- getLabelOperator,
1098
- applyedFilters,
1099
- addFilter,
1100
- updateFilter,
1101
- removeFilter,
1102
- clearFilters,
1103
- fireOnChangeFilters,
1104
- openAnchorEl,
1105
- openMenuFields,
1106
- closeMenuFields,
1107
- popupData,
1108
- popupValidationSchema,
1109
- showPopupForAddFilter,
1110
- showPopupForEditFilter,
1111
- hidePopupEdit,
1112
- setInEdition,
1113
- setPoupEditValidationSchema,
1114
- fnTransformFormValuesIntoRawValues,
1115
- setFnTransformFormValuesIntoValues,
1116
- ownerState,
1117
- classes: classes || ""
1118
- },
1119
- children
1120
- });
1121
- }
1122
- const useBase = () => useContext(BaseContext);
1123
- const WrapperApplyedFilter = styled("div")(({
1124
- theme
1125
- }) => ({
1126
- width: "auto",
1127
- display: "flex",
1128
- justifyContent: "center",
1129
- alignItems: "center",
1130
- height: "100%",
1131
- minHeight: theme.spacing(3),
1132
- paddingLeft: theme.spacing(1),
1133
- backgroundColor: theme.palette.grid?.sectionHeader,
1134
- border: "1px solid",
1135
- borderColor: alpha(`${theme.palette.divider}`, 0.1),
1136
- overflow: "visible",
1137
- borderRadius: theme.spacing(1)
1138
- }));
1139
- const AplyedFilterStyled = styled("div")(({
1140
- theme
1141
- }) => ({
1142
- ...theme.typography.body2,
1143
- display: "flex",
1144
- justifyContent: "center",
1145
- alignItems: "center",
1146
- width: "auto",
1147
- height: "100%",
1148
- marginRight: theme.spacing(1),
1149
- marginLeft: theme.spacing(1),
1150
- whiteSpace: "nowrap"
1151
- }));
1152
- const ContainerField = styled("span")(({
1153
- theme
1154
- }) => ({
1155
- ...theme.typography.subtitle2
1156
- }));
1157
- const ContainerOperator = styled("span")(({
1158
- theme
1159
- }) => ({
1160
- ...theme.typography.body2,
1161
- marginLeft: theme.spacing(1.5),
1162
- fontStyle: "italic"
1163
- }));
1164
- const ContainerOperands = styled("span")(({
1165
- theme
1166
- }) => ({
1167
- ...theme.typography.body2,
1168
- marginLeft: theme.spacing(1.5)
1169
- }));
1170
- function ApplyedFilter(props) {
1171
- const {
1172
- n: fieldName,
1173
- id,
1174
- isSetted,
1175
- fixed,
1176
- labelOperator,
1177
- labelOperands
1178
- } = props;
1179
- const {
1180
- removeFilter,
1181
- showPopupForEditFilter,
1182
- hidePopupEdit,
1183
- getFieldByName,
1184
- classes
1185
- } = useBase();
1186
- const {
1187
- host_static_assets,
1188
- environment_assets
1189
- } = useEnvironment();
1190
- const field = useMemo(() => {
1191
- return getFieldByName(fieldName);
1192
- }, [getFieldByName]);
1193
- const urlIcon = useMemo(() => {
1194
- if (!field)
1195
- return;
1196
- if (field && field.urlIcon !== "") {
1197
- return field.urlIcon;
1198
- }
1199
- return "";
1200
- }, [field]);
1201
- const onDelete = () => {
1202
- hidePopupEdit(false);
1203
- removeFilter(id);
1204
- };
1205
- const onClick = (event) => {
1206
- showPopupForEditFilter(event.currentTarget, props);
1207
- };
1208
- if (!field) {
1209
- return /* @__PURE__ */ jsx(Fragment, {});
1210
- }
1211
- return /* @__PURE__ */ jsxs(WrapperApplyedFilter, {
1212
- className: clsx(classes.applyedFilter, !isSetted && unstable_composeClasses$1({
1213
- noSetted: ["noSetted"]
1214
- }, getDynamicFiltertUtilityClass, {})),
1215
- children: [urlIcon && /* @__PURE__ */ jsx(IconButton, {
1216
- src: urlIcon,
1217
- onClick
1218
- }), /* @__PURE__ */ jsxs(AplyedFilterStyled, {
1219
- onClick,
1220
- children: [/* @__PURE__ */ jsx(ContainerField, {
1221
- children: field.label
1222
- }), /* @__PURE__ */ jsx(ContainerOperator, {
1223
- children: labelOperator
1224
- }), /* @__PURE__ */ jsx(ContainerOperands, {
1225
- children: labelOperands
1226
- })]
1227
- }), !fixed && /* @__PURE__ */ jsx(IconButton, {
1228
- size: "small",
1229
- src: `${host_static_assets}/${environment_assets}/frontend/components/dynamic_filter/assets/icons/clear.svg`,
1230
- onClick: onDelete,
1231
- dictionaryTooltip: "dynamic_filter.tooltip_clear_filter"
1232
- })]
1233
- });
1234
- }
1235
- function ApplyedFilters() {
1236
- const {
1237
- applyedFilters,
1238
- isSkeleton,
1239
- classes
1240
- } = useBase();
1241
- if (isSkeleton) {
1242
- return /* @__PURE__ */ jsx(WrapperApplyedFilters, {
1243
- className: classes.applyedFilters
1244
- });
1245
- }
1246
- return /* @__PURE__ */ jsx(WrapperApplyedFilters, {
1247
- className: classes.applyedFilters,
1248
- children: /* @__PURE__ */ jsx(ScrollBar, {
1249
- children: /* @__PURE__ */ jsx(ContainerApplyedFilters, {
1250
- id: "WrapperApplyedFilters",
1251
- children: [...applyedFilters].sort((a, b) => a.isSetted === b.isSetted ? 0 : a.isSetted ? -1 : 1).reverse().map((filter) => /* @__PURE__ */ jsx(ApplyedFilter, {
1252
- ...filter
1253
- }, filter.id))
1254
- })
1255
- })
1256
- });
1257
- }
1258
- const SKTClearFilters = styled$1("div")(({
1259
- theme
1260
- }) => ({
1261
- display: "flex",
1262
- justifyContent: "center",
1263
- alignItems: "center",
1264
- minWidth: theme.spacing(3.75),
1265
- height: theme.spacing(3.75)
1266
- }));
1267
- const WrapperClearFilters = styled$1("div")(({
1268
- theme
1269
- }) => ({
1270
- paddingLeft: theme.spacing(0.5),
1271
- borderLeft: `1px solid ${theme.palette.divider}`
1272
- }));
1273
- const ClearFilters = () => {
1274
- const {
1275
- host_static_assets,
1276
- environment_assets
1277
- } = useEnvironment();
1278
- const {
1279
- clearFilters,
1280
- isSkeleton,
1281
- applyedFilters,
1282
- classes
1283
- } = useBase();
1284
- if (isSkeleton) {
1285
- return /* @__PURE__ */ jsx(SKTClearFilters, {
1286
- children: /* @__PURE__ */ jsx(Skeleton, {
1287
- variant: "circular",
1288
- width: "20px",
1289
- height: "20px"
1290
- })
1291
- });
1292
- }
1293
- if (applyedFilters.findIndex((f) => f.fixed == false) > -1) {
1294
- return /* @__PURE__ */ jsx(WrapperClearFilters, {
1295
- className: classes.clearFilters,
1296
- children: /* @__PURE__ */ jsx(IconButton, {
1297
- src: `${host_static_assets}/${environment_assets}/frontend/components/dynamic_filter/assets/icons/clear.svg`,
1298
- onClick: clearFilters,
1299
- dictionaryTooltip: "dynamic_filter.tooltip_clear_filters"
1300
- })
1301
- });
1302
- }
1303
- return /* @__PURE__ */ jsx(Fragment, {});
1304
- };
1305
- const SKTWrapperFilterButton = styled("div")(({
1306
- theme
1307
- }) => ({
1308
- display: "flex",
1309
- justifyContent: "center",
1310
- alignItems: "center",
1311
- minWidth: theme.spacing(3.75),
1312
- height: theme.spacing(3.75),
1313
- background: alpha$1(theme.palette.primary.main, 0.3)
1314
- }));
1315
- const WrapperFilterButton = styled("div")(() => ({
1316
- display: "block"
1317
- }));
1318
- function FilterButton() {
1319
- const {
1320
- isSkeleton,
1321
- fireOnChangeFilters,
1322
- automatic,
1323
- isDirty,
1324
- isValid,
1325
- classes
1326
- } = useBase();
1327
- const {
1328
- host_static_assets,
1329
- environment_assets
1330
- } = useEnvironment();
1331
- if (isSkeleton) {
1332
- return /* @__PURE__ */ jsx(SKTWrapperFilterButton, {
1333
- children: /* @__PURE__ */ jsx(Skeleton, {
1334
- variant: "circular",
1335
- width: 20,
1336
- height: 20
1337
- })
1338
- });
1339
- }
1340
- const color = useMemo(() => {
1341
- if (automatic || !isDirty) {
1342
- return "action.active";
1343
- }
1344
- if (!isValid) {
1345
- return "error.main";
1346
- }
1347
- return "primary.main";
1348
- }, [automatic, isValid, isDirty]);
1349
- return /* @__PURE__ */ jsx(WrapperFilterButton, {
1350
- id: "WrapperFilterButton",
1351
- className: classes.containerFilterButton,
1352
- children: /* @__PURE__ */ jsx(IconButton, {
1353
- bgColor: color,
1354
- dictionaryTooltip: "dynamic_filter.filter_tooltip",
1355
- onClick: () => fireOnChangeFilters(),
1356
- "aria-label": "settings",
1357
- src: `${host_static_assets}/${environment_assets}/frontend/components/dynamic_filter/assets/icons/${automatic ? "refresh" : "search"}.svg`
1358
- })
1359
- });
1360
- }
1361
- const WrapperInputFilter = styled("div")(({
1362
- theme
1363
- }) => ({
1364
- display: "flex",
1365
- justifyContent: "center",
1366
- alignItems: "center",
1367
- width: "100%",
1368
- height: theme.spacing(3),
1369
- borderLeft: `1px solid ${theme.palette.divider}`,
1370
- paddingLeft: theme.spacing(1),
1371
- marginLeft: theme.spacing(1),
1372
- [theme.breakpoints.up("sm")]: {
1373
- width: theme.spacing(25)
1374
- }
1375
- }));
1376
- const StyledInputFilter = styled("input")(({
1377
- theme
1378
- }) => ({
1379
- background: "transparent",
1380
- display: "flex",
1381
- justifyContent: "center",
1382
- alignItems: "center",
1383
- minWidth: theme.spacing(3.75),
1384
- width: "100%",
1385
- outline: "none",
1386
- border: "none",
1387
- [theme.breakpoints.up("sm")]: {
1388
- width: "auto"
1389
- }
1390
- }));
1391
- function InputFilter() {
1392
- const {
1393
- isSkeleton,
1394
- withAllField,
1395
- availableFields,
1396
- showPopupForAddFilter,
1397
- addFilter,
1398
- openAnchorEl,
1399
- openMenuFields,
1400
- closeMenuFields,
1401
- hidePopupEdit,
1402
- classes
1403
- } = useBase();
1404
- const [valueFilter, setValueFilter] = useState("");
1405
- const finalFields = useMemo(() => {
1406
- if (!openAnchorEl) {
1407
- return [];
1408
- }
1409
- return availableFields.filter((field) => field.label.includes(valueFilter));
1410
- }, [valueFilter, openAnchorEl]);
1411
- if (isSkeleton) {
1412
- return /* @__PURE__ */ jsx(WrapperInputFilter, {
1413
- id: "SKTWrapperInputFilter",
1414
- children: /* @__PURE__ */ jsx(Skeleton, {
1415
- variant: "text",
1416
- width: "100%",
1417
- height: 24
1418
- })
1419
- });
1420
- }
1421
- const handleClose = () => {
1422
- closeMenuFields();
1423
- };
1424
- const handleClickItem = (field) => {
1425
- closeMenuFields();
1426
- showPopupForAddFilter(openAnchorEl, field);
1427
- };
1428
- const onClickFilter = (event) => {
1429
- openMenuFields(event.currentTarget);
1430
- };
1431
- const onChangeFilter = (event) => {
1432
- setValueFilter(event.target.value);
1433
- if (!openAnchorEl) {
1434
- openMenuFields(event.currentTarget);
1435
- }
1436
- hidePopupEdit(true);
1437
- };
1438
- const handleKeyPressMenu = (event) => {
1439
- if (event.key !== "Enter")
1440
- return;
1441
- if (valueFilter.trim() === "") {
1442
- closeMenuFields();
1443
- return;
1444
- }
1445
- if (withAllField) {
1446
- addFilter({
1447
- n: ALL_FIELDS.name,
1448
- isSetted: true,
1449
- fixed: false,
1450
- o: "c",
1451
- o1: valueFilter,
1452
- labelOperands: valueFilter
1453
- });
1454
- setValueFilter("");
1455
- closeMenuFields();
1456
- }
1457
- };
1458
- if (!withAllField && availableFields.length == 0) {
1459
- return /* @__PURE__ */ jsx(Fragment, {});
1460
- }
1461
- return /* @__PURE__ */ jsxs(WrapperInputFilter, {
1462
- className: classes.inputFilter,
1463
- children: [/* @__PURE__ */ jsx(StyledInputFilter, {
1464
- type: "text",
1465
- value: valueFilter,
1466
- placeholder: "filter",
1467
- onClick: onClickFilter,
1468
- onChange: onChangeFilter,
1469
- onKeyPress: handleKeyPressMenu
1470
- }), availableFields.length > 0 && /* @__PURE__ */ jsx(Popover, {
1471
- id: "Popover",
1472
- open: Boolean(openAnchorEl),
1473
- anchorEl: openAnchorEl,
1474
- onClose: handleClose,
1475
- disableAutoFocus: true,
1476
- arrowType: "right-top",
1477
- sx: {
1478
- "& .MuiMenuItem-root": {
1479
- px: 1,
1480
- typography: "body2",
1481
- borderRadius: 0.75
1482
- }
1483
- },
1484
- children: Boolean(openAnchorEl) && finalFields.map((field, index) => /* @__PURE__ */ jsxs(MenuItem, {
1485
- dense: true,
1486
- onClick: () => handleClickItem(field),
1487
- children: [/* @__PURE__ */ jsx(Icon, {
1488
- src: field.urlIcon
1489
- }), /* @__PURE__ */ jsx(LabelMemuItem, {
1490
- children: field.label
1491
- })]
1492
- }, `menu_action_${index}`))
1493
- })]
1494
- });
1495
- }
1496
- styled(Popover$1)(({
1497
- theme
1498
- }) => ({
1499
- boxShadow: theme.customShadows.dropdown,
1500
- borderRadius: 1
1501
- }));
1502
- const WrapperPopupEditFilter = styled("div")(({
1503
- theme
1504
- }) => ({
1505
- display: "flex",
1506
- flexDirection: "column",
1507
- justifyContent: "center",
1508
- alignItems: "center",
1509
- padding: theme.spacing(1.4, 3, 3, 3),
1510
- backgroundColor: theme.palette.background.default,
1511
- borderRadius: theme.spacing(1)
1512
- }));
1513
- styled("div")(({
1514
- theme
1515
- }) => ({
1516
- display: "flex",
1517
- justifyContent: "center",
1518
- gap: theme.spacing(3),
1519
- paddingTop: theme.spacing(3)
1520
- }));
1521
- const TitleContainer = styled("div")(({
1522
- theme
1523
- }) => ({
1524
- ...theme.typography.subtitle2,
1525
- width: "100%",
1526
- display: "flex",
1527
- justifyContent: "flex-start",
1528
- alignItems: "center",
1529
- padding: theme.spacing(2, 0),
1530
- marginLeft: theme.spacing(1.5)
1531
- }));
1532
- const HeaderContainer = styled("div")(({
1533
- theme
1534
- }) => ({
1535
- width: "100%",
1536
- display: "flex",
1537
- justifyContent: "flex-start",
1538
- alignItems: "center",
1539
- borderBottom: `1px solid ${theme.palette.divider}`
1540
- }));
1541
- const WrapperEditFilter = styled("div")(() => ({
1542
- "& .m4l_FormProvider": {
1543
- padding: "0px",
1544
- margin: "0px"
1545
- }
1546
- }));
1547
- const PopupEditFilter = () => {
1548
- const {
1549
- popupValidationSchema,
1550
- popupData: {
1551
- popupAnchorEl,
1552
- filter,
1553
- field
1554
- },
1555
- hidePopupEdit,
1556
- addFilter,
1557
- updateFilter,
1558
- getLabelOperator,
1559
- fnTransformFormValuesIntoRawValues,
1560
- classes
1561
- } = useBase();
1562
- const {
1563
- getLabel
1564
- } = useModuleDictionary();
1565
- const values = useMemo(() => {
1566
- if (!filter || !field)
1567
- return {};
1568
- const valuesFilter = {
1569
- ...filter,
1570
- valueOperator: {
1571
- id: filter.o,
1572
- label: getLabelOperator(filter.o)
1573
- }
1574
- };
1575
- return valuesFilter;
1576
- }, [filter, field, getLabelOperator, getLabel]);
1577
- const onSubmit = async (data) => {
1578
- if (!filter || !field)
1579
- return;
1580
- const newFilter = fnTransformFormValuesIntoRawValues(data);
1581
- if (!newFilter)
1582
- return;
1583
- if (filter.id === 0) {
1584
- addFilter(newFilter);
1585
- } else {
1586
- updateFilter(newFilter);
1587
- }
1588
- hidePopupEdit(false);
1589
- };
1590
- const onClose = () => {
1591
- hidePopupEdit(false);
1592
- };
1593
- return /* @__PURE__ */ jsx(Popper, {
1594
- open: Boolean(popupAnchorEl),
1595
- anchorEl: popupAnchorEl,
1596
- children: /* @__PURE__ */ jsx(ClickAwayListener, {
1597
- onClickAway: onClose,
1598
- children: /* @__PURE__ */ jsx(WrapperEditFilter, {
1599
- className: classes.popupEditFilter,
1600
- children: filter && /* @__PURE__ */ jsx(RHFormProvider, {
1601
- onSubmit,
1602
- values,
1603
- validationSchema: popupValidationSchema,
1604
- children: /* @__PURE__ */ jsxs(WrapperPopupEditFilter, {
1605
- children: [/* @__PURE__ */ jsxs(HeaderContainer, {
1606
- children: [field?.urlIcon && /* @__PURE__ */ jsx(Icon, {
1607
- src: field.urlIcon
1608
- }), /* @__PURE__ */ jsx(TitleContainer, {
1609
- children: field?.label
1610
- })]
1611
- }), /* @__PURE__ */ jsx(PopupEditFilterComponent, {
1612
- filter
1613
- }), /* @__PURE__ */ jsxs(Actions, {
1614
- children: [/* @__PURE__ */ jsx(ActionCancel, {
1615
- onClick: onClose
1616
- }), /* @__PURE__ */ jsx(ActionIntro, {})]
1617
- })]
1618
- })
1619
- })
1620
- })
1621
- })
1622
- });
1623
- };
1624
- const WrapperDynamicFilter = styled("div", {})(({
1625
- theme,
1626
- ownerState
1627
- }) => ({
1628
- [`&.${DynamicFilterClassess.root}`]: {
1629
- display: "flex",
1630
- width: "100%",
1631
- heigth: "100%"
1632
- },
1633
- [`&.${DynamicFilterClassess.root} .${DynamicFilterClassess.containerDesktop},
1634
- &.${DynamicFilterClassess.root} .${DynamicFilterClassess.containerMobile}`]: {
1635
- border: ownerState.inEdition ? `1px solid ${theme.palette.primary.main}` : `1px solid ${theme.palette.divider}`
1636
- },
1637
- [`&.${DynamicFilterClassess.containerMobile} .${DynamicFilterClassess.applyedFilters}`]: {
1638
- margin: "0px",
1639
- padding: "0px",
1640
- border: "0px"
1641
- },
1642
- [`&.${DynamicFilterClassess.containerFilterButton}.${DynamicFilterClassess.filterIsDirty}`]: {
1643
- animationName: "dirtyEffect",
1644
- animationDuration: "1s",
1645
- animationFillMode: "both",
1646
- animationIterationCount: "infinite",
1647
- transition: "all .3s",
1648
- "@keyframes dirtyEffect": {
1649
- "20%": {
1650
- opacity: 1
1651
- },
1652
- "50%": {
1653
- opacity: 0.5
1654
- },
1655
- "100%": {
1656
- opacity: 1
1657
- }
1658
- }
1659
- },
1660
- [`&.${DynamicFilterClassess.containerFilterButton} .${DynamicFilterClassess.applyedFilter}.${DynamicFilterClassess.noSetted}`]: {
1661
- border: `1px solid ${theme.palette.error.main}`
1662
- },
1663
- ...theme.components?.M4LDynamicFilter?.styleOverrides
1664
- }));
1665
- const ContainerFilterDesktop = styled("div", {})(({
1666
- theme
1667
- }) => ({
1668
- display: "flex",
1669
- alignItems: "center",
1670
- justifyContent: "flex-start",
1671
- height: "auto",
1672
- width: "100%",
1673
- padding: theme.spacing(0.5),
1674
- borderRadius: theme.spacing(1)
1675
- }));
1676
- const ContainerFilterMobile = styled("div")(({
1677
- theme
1678
- }) => ({
1679
- display: "flex",
1680
- flexDirection: "column",
1681
- alignItems: "center",
1682
- justifyContent: "space-between",
1683
- minWidth: theme.spacing(25),
1684
- height: "auto",
1685
- width: "100%",
1686
- padding: theme.spacing(0.5),
1687
- borderRadius: theme.spacing(1),
1688
- gap: theme.spacing(0.75)
1689
- }));
1690
- const ContainerFistRow = styled("div")(() => ({
1691
- width: "100%",
1692
- display: "flex",
1693
- justifyContent: "space-between"
1694
- }));
1695
- const DynamicFilter = (inProps) => {
1696
- const isDesktop = useResponsiveDesktop();
1697
- const render = useFlagsPresent(["dictionary_loaded"]);
1698
- if (!render) {
1699
- return /* @__PURE__ */ jsx(Fragment, {});
1700
- }
1701
- return /* @__PURE__ */ jsx(BaseProvider, {
1702
- ...inProps,
1703
- children: /* @__PURE__ */ jsx(BaseContext.Consumer, {
1704
- children: ({
1705
- ownerState,
1706
- classes
1707
- }) => {
1708
- return /* @__PURE__ */ jsx(WrapperDynamicFilter, {
1709
- ownerState,
1710
- className: classes.root,
1711
- children: isDesktop ? /* @__PURE__ */ jsxs(ContainerFilterDesktop, {
1712
- className: classes.containerDesktop,
1713
- children: [/* @__PURE__ */ jsx(FilterButton, {}), /* @__PURE__ */ jsx(InputFilter, {}), /* @__PURE__ */ jsx(ApplyedFilters, {}), /* @__PURE__ */ jsx(PopupEditFilter, {}), /* @__PURE__ */ jsx(ClearFilters, {})]
1714
- }) : /* @__PURE__ */ jsxs(ContainerFilterMobile, {
1715
- className: classes.containerMobile,
1716
- children: [/* @__PURE__ */ jsxs(ContainerFistRow, {
1717
- className: classes.ContainerFistRow,
1718
- children: [/* @__PURE__ */ jsx(FilterButton, {}), /* @__PURE__ */ jsx(InputFilter, {}), /* @__PURE__ */ jsx(ClearFilters, {})]
1719
- }), /* @__PURE__ */ jsx(ApplyedFilters, {}), /* @__PURE__ */ jsx(PopupEditFilter, {})]
1720
- })
1721
- });
1722
- }
1723
- })
1724
- });
1725
- };
1726
- function getDynamicFilterComponentsDictionary() {
1727
- return ["dynamic_filter"].concat(getCommonActionsDictionary());
1728
- }
1729
- const defaultDynamicFilterDictionary = {
1730
- dynamic_filter: {
1731
- filter_tooltip: "Search",
1732
- operator_b: "between",
1733
- operator_e: "=",
1734
- operator_ne: "!=",
1735
- operator_gt: ">",
1736
- operator_gte: ">=",
1737
- operator_lt: "<",
1738
- operator_lte: "<=",
1739
- operator_c: "contains",
1740
- operator_nc: "not contains",
1741
- all_fields: "all_fields",
1742
- operand_true: "true",
1743
- operand_false: "false",
1744
- error_operator_required: "Operator required",
1745
- error_operand_required: "Operand required",
1746
- error_invalid_date: "Invalid date",
1747
- error_operand_mustbe_number: "Invalid number",
1748
- error_filters_no_setted: "Filters not yet set"
1749
- }
1750
- };
1751
- export {
1752
- DynamicFilter as D,
1753
- DynamicFilterClassess as a,
1754
- defaultDynamicFilterDictionary as d,
1755
- getDynamicFilterComponentsDictionary as g
1756
- };