@m4l/components 0.0.34 → 0.0.37
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/dist/components/CompanyLogo/index.js +2 -3
- package/dist/components/DataGrid/index.js +21 -21
- package/dist/components/DynamicFilter/components/ApplyedFilters/styles.d.ts +1 -0
- package/dist/components/DynamicFilter/components/FilterButton/styles.d.ts +0 -1
- package/dist/components/DynamicFilter/components/fieldstypes/BooleanFilter/index.d.ts +4 -0
- package/dist/components/DynamicFilter/components/{PopupEditFilter/components → fieldstypes}/BooleanFilter/styles.d.ts +0 -0
- package/dist/components/DynamicFilter/components/fieldstypes/DateTimeFilter/index.d.ts +4 -0
- package/dist/components/DynamicFilter/components/{PopupEditFilter/components → fieldstypes}/DateTimeFilter/styles.d.ts +0 -0
- package/dist/components/DynamicFilter/components/fieldstypes/NumberFilter/index.d.ts +4 -0
- package/dist/components/DynamicFilter/components/{PopupEditFilter/components/StringFilter → fieldstypes/NumberFilter}/styles.d.ts +0 -0
- package/dist/components/DynamicFilter/components/fieldstypes/StringFilter/index.d.ts +4 -0
- package/dist/components/DynamicFilter/components/fieldstypes/StringFilter/styles.d.ts +3 -0
- package/dist/components/DynamicFilter/components/{PopupEditFilter/components → fieldstypes}/factory.d.ts +2 -2
- package/dist/components/DynamicFilter/components/{PopupEditFilter/components → fieldstypes}/validations.d.ts +1 -1
- package/dist/components/DynamicFilter/index.js +369 -159
- package/dist/components/DynamicFilter/types.d.ts +4 -2
- package/dist/components/Icon/index.js +69 -11
- package/dist/components/Icon/styles.d.ts +2 -0
- package/dist/components/Icon/types.d.ts +3 -2
- package/dist/components/ModalDialog/index.js +9 -9
- package/dist/components/NoItemSelected/index.js +2 -3
- package/dist/components/ObjectLogs/index.js +18 -5
- package/dist/components/PaperForm/index.js +4 -7
- package/dist/components/PropertyValue/index.js +32 -5
- package/dist/components/PropertyValue/styles.d.ts +2 -2
- package/dist/components/PropertyValue/types.d.ts +10 -3
- package/dist/components/hook-form/RHFDateTime.js +9 -2
- package/dist/components/hook-form/RHFUpload/RHFUploadImage/components/UploadImage/styles.d.ts +7 -0
- package/dist/components/hook-form/RHFUpload/RHFUploadImage/styles.d.ts +2 -0
- package/dist/components/hook-form/RHFUpload.js +111 -33
- package/dist/components/mui_extended/Accordion/index.js +2 -2
- package/dist/components/mui_extended/IconButton/index.d.ts +1 -1
- package/dist/components/mui_extended/IconButton/index.js +19 -10
- package/dist/components/mui_extended/IconButton/types.d.ts +2 -1
- package/dist/components/mui_extended/MenuActions/index.js +8 -10
- package/dist/components/mui_extended/Pager/index.js +5 -5
- package/dist/contexts/ModalContext/index.js +4 -4
- package/dist/vendor.js +2 -2
- package/package.json +2 -5
- package/dist/components/DynamicFilter/components/PopupEditFilter/components/BooleanFilter/index.d.ts +0 -2
- package/dist/components/DynamicFilter/components/PopupEditFilter/components/DateTimeFilter/index.d.ts +0 -2
- package/dist/components/DynamicFilter/components/PopupEditFilter/components/StringFilter/index.d.ts +0 -2
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { S as ScrollBar } from "../ScrollBar/index.js";
|
|
2
|
-
import { styled } from "@mui/material/styles";
|
|
2
|
+
import { styled, alpha } from "@mui/material/styles";
|
|
3
3
|
import { useRef, useState, useMemo, useCallback, useEffect, createContext, useContext } from "react";
|
|
4
|
-
import { useModuleDictionary, voidFunction, useHostTools,
|
|
4
|
+
import { useModuleDictionary, useEnvironment, voidFunction, useHostTools, useFlagsPresent } from "@m4l/core";
|
|
5
5
|
import * as Yup from "yup";
|
|
6
6
|
import { useFormContext, useWatch } from "react-hook-form";
|
|
7
7
|
import { F as FormProvider } from "../hook-form/FormProvider/index.js";
|
|
@@ -29,6 +29,12 @@ import { M as MenuPopover } from "../mui_extended/MenuPopover/index.js";
|
|
|
29
29
|
import { useResponsiveDesktop } from "@m4l/graphics";
|
|
30
30
|
const WrapperApplyedFilters = styled("div")(({
|
|
31
31
|
theme
|
|
32
|
+
}) => ({
|
|
33
|
+
width: "100%",
|
|
34
|
+
marginLeft: theme.spacing(1.5)
|
|
35
|
+
}));
|
|
36
|
+
const ContainerApplyedFilters = styled("div")(({
|
|
37
|
+
theme
|
|
32
38
|
}) => ({
|
|
33
39
|
width: "100%",
|
|
34
40
|
display: "flex",
|
|
@@ -38,6 +44,7 @@ const WrapperApplyedFilters = styled("div")(({
|
|
|
38
44
|
gap: theme.spacing(1.5)
|
|
39
45
|
}));
|
|
40
46
|
const STRING_OPERATORS = ["c", "nc"];
|
|
47
|
+
const NUMBER_OPERATORS = ["b", "e", "ne", "gt", "gte", "lt", "lte"];
|
|
41
48
|
const BOOLEAN_OPERATORS = ["e", "ne"];
|
|
42
49
|
const DATE_TIME_OPERATORS = [
|
|
43
50
|
"b",
|
|
@@ -50,13 +57,13 @@ const DATE_TIME_OPERATORS = [
|
|
|
50
57
|
];
|
|
51
58
|
const ALL_FIELDS = {
|
|
52
59
|
name: "all",
|
|
53
|
-
label: "
|
|
60
|
+
label: "dynamic_filter.all_fields",
|
|
54
61
|
urlIcon: "https://s3.amazonaws.com/static.made4labs/environments/d1/frontend/components/icon/assets/icons/default.svg",
|
|
55
62
|
type: "string",
|
|
56
63
|
multiple: true,
|
|
57
64
|
fixed: false
|
|
58
65
|
};
|
|
59
|
-
const WrapperStringFilter = styled("div")(({
|
|
66
|
+
const WrapperStringFilter$1 = styled("div")(({
|
|
60
67
|
theme
|
|
61
68
|
}) => ({
|
|
62
69
|
display: "flex",
|
|
@@ -68,9 +75,29 @@ const WrapperStringFilter = styled("div")(({
|
|
|
68
75
|
padding: theme.spacing(3, 0),
|
|
69
76
|
gap: theme.spacing(3)
|
|
70
77
|
}));
|
|
71
|
-
const WrapperAutoComplete$
|
|
78
|
+
const WrapperAutoComplete$3 = styled("div")(() => ({
|
|
72
79
|
width: "100%"
|
|
73
80
|
}));
|
|
81
|
+
const getDefaultStringFilter = (field, fixed, getLabel) => {
|
|
82
|
+
const dfop1 = field.defaultOperand1;
|
|
83
|
+
const defaultFilter = {
|
|
84
|
+
id: 0,
|
|
85
|
+
fieldName: field.name,
|
|
86
|
+
fixed,
|
|
87
|
+
isSetted: false,
|
|
88
|
+
operator: "c",
|
|
89
|
+
labelOperator: "",
|
|
90
|
+
operand1: "",
|
|
91
|
+
operand2: "",
|
|
92
|
+
labelOperands: ""
|
|
93
|
+
};
|
|
94
|
+
if (dfop1 !== void 0 && typeof dfop1 === "string") {
|
|
95
|
+
defaultFilter.operand1 = dfop1;
|
|
96
|
+
}
|
|
97
|
+
defaultFilter.labelOperands = defaultFilter.operand1 + "";
|
|
98
|
+
defaultFilter.labelOperator = getLabel(`dynamic_filter.operator_${defaultFilter.operator}`);
|
|
99
|
+
return defaultFilter;
|
|
100
|
+
};
|
|
74
101
|
function StringFilter() {
|
|
75
102
|
const {
|
|
76
103
|
popupData: {
|
|
@@ -128,9 +155,9 @@ function StringFilter() {
|
|
|
128
155
|
console.debug("InputRef", inputRef);
|
|
129
156
|
inputRef.current?.focus();
|
|
130
157
|
}, [isLoaded]);
|
|
131
|
-
return /* @__PURE__ */ jsx(WrapperStringFilter, {
|
|
158
|
+
return /* @__PURE__ */ jsx(WrapperStringFilter$1, {
|
|
132
159
|
children: isLoaded && /* @__PURE__ */ jsxs(Fragment, {
|
|
133
|
-
children: [/* @__PURE__ */ jsx(WrapperAutoComplete$
|
|
160
|
+
children: [/* @__PURE__ */ jsx(WrapperAutoComplete$3, {
|
|
134
161
|
children: /* @__PURE__ */ jsx(RHFAutocomplete, {
|
|
135
162
|
name: "valueOperator",
|
|
136
163
|
autoComplete: "off",
|
|
@@ -160,9 +187,29 @@ const WrapperAllFieldsFilter$1 = styled("div")(({
|
|
|
160
187
|
padding: theme.spacing(3, 0),
|
|
161
188
|
gap: theme.spacing(3)
|
|
162
189
|
}));
|
|
163
|
-
const WrapperAutoComplete$
|
|
190
|
+
const WrapperAutoComplete$2 = styled("div")(() => ({
|
|
164
191
|
width: "100%"
|
|
165
192
|
}));
|
|
193
|
+
const getDefaultBooleanFilter = (field, fixed, getLabel) => {
|
|
194
|
+
const dfop1 = field.defaultOperand1;
|
|
195
|
+
const defaultFilter = {
|
|
196
|
+
id: 0,
|
|
197
|
+
fieldName: field.name,
|
|
198
|
+
fixed,
|
|
199
|
+
isSetted: true,
|
|
200
|
+
operator: "e",
|
|
201
|
+
labelOperator: "",
|
|
202
|
+
operand1: true,
|
|
203
|
+
operand2: "",
|
|
204
|
+
labelOperands: ""
|
|
205
|
+
};
|
|
206
|
+
defaultFilter.labelOperator = getLabel(`dynamic_filter.operator_${defaultFilter.operator}`);
|
|
207
|
+
if (dfop1 !== void 0 && typeof dfop1 === "boolean") {
|
|
208
|
+
defaultFilter.operand1 = dfop1;
|
|
209
|
+
}
|
|
210
|
+
defaultFilter.labelOperands = getLabel(`dynamic_filter.operand_${defaultFilter.operand1}`);
|
|
211
|
+
return defaultFilter;
|
|
212
|
+
};
|
|
166
213
|
function BooleanFilter() {
|
|
167
214
|
const {
|
|
168
215
|
setPoupEditValidationSchema,
|
|
@@ -188,10 +235,10 @@ function BooleanFilter() {
|
|
|
188
235
|
})), [getLabelOperator]);
|
|
189
236
|
const optionsYesNo = useMemo(() => [{
|
|
190
237
|
value: true,
|
|
191
|
-
label: getLabel("
|
|
238
|
+
label: getLabel("dynamic_filter.operand_true")
|
|
192
239
|
}, {
|
|
193
240
|
value: false,
|
|
194
|
-
label: getLabel("
|
|
241
|
+
label: getLabel("dynamic_filter.operand_false")
|
|
195
242
|
}], [getLabel]);
|
|
196
243
|
const transformFunctionFormValuesToValues = useCallback((data) => {
|
|
197
244
|
if (!filter || !field)
|
|
@@ -219,7 +266,7 @@ function BooleanFilter() {
|
|
|
219
266
|
if (filter && field) {
|
|
220
267
|
setValue("valueOperand1", {
|
|
221
268
|
value: filter.operand1,
|
|
222
|
-
label: getLabel(`
|
|
269
|
+
label: getLabel(`dynamic_filter.operand_${filter.operand1}`)
|
|
223
270
|
}, {
|
|
224
271
|
shouldTouch: false,
|
|
225
272
|
shouldValidate: false
|
|
@@ -230,7 +277,7 @@ function BooleanFilter() {
|
|
|
230
277
|
return /* @__PURE__ */ jsx(WrapperAllFieldsFilter$1, {
|
|
231
278
|
id: "WrapperAllFieldsFilter",
|
|
232
279
|
children: isLoaded && /* @__PURE__ */ jsxs(Fragment, {
|
|
233
|
-
children: [/* @__PURE__ */ jsx(WrapperAutoComplete$
|
|
280
|
+
children: [/* @__PURE__ */ jsx(WrapperAutoComplete$2, {
|
|
234
281
|
children: /* @__PURE__ */ jsx(RHFAutocomplete, {
|
|
235
282
|
name: "valueOperator",
|
|
236
283
|
autoComplete: "off",
|
|
@@ -239,7 +286,7 @@ function BooleanFilter() {
|
|
|
239
286
|
isOptionEqualToValue: (option, value) => option.id === value.id,
|
|
240
287
|
label: ""
|
|
241
288
|
})
|
|
242
|
-
}), /* @__PURE__ */ jsx(WrapperAutoComplete$
|
|
289
|
+
}), /* @__PURE__ */ jsx(WrapperAutoComplete$2, {
|
|
243
290
|
children: /* @__PURE__ */ jsx(RHFAutocomplete, {
|
|
244
291
|
name: "valueOperand1",
|
|
245
292
|
autoComplete: "off",
|
|
@@ -264,9 +311,93 @@ const WrapperAllFieldsFilter = styled("div")(({
|
|
|
264
311
|
padding: theme.spacing(3, 0),
|
|
265
312
|
gap: theme.spacing(3)
|
|
266
313
|
}));
|
|
267
|
-
const WrapperAutoComplete = styled("div")(() => ({
|
|
314
|
+
const WrapperAutoComplete$1 = styled("div")(() => ({
|
|
268
315
|
width: "100%"
|
|
269
316
|
}));
|
|
317
|
+
function isValidDate(d) {
|
|
318
|
+
return d && d instanceof Date;
|
|
319
|
+
}
|
|
320
|
+
const verifyStringFilter = (filter) => {
|
|
321
|
+
if (typeof filter.operator !== "string") {
|
|
322
|
+
return false;
|
|
323
|
+
}
|
|
324
|
+
if (STRING_OPERATORS.findIndex((f) => f === filter.operator) === -1) {
|
|
325
|
+
return false;
|
|
326
|
+
}
|
|
327
|
+
if (typeof filter.operand1 !== "string") {
|
|
328
|
+
return false;
|
|
329
|
+
}
|
|
330
|
+
return true;
|
|
331
|
+
};
|
|
332
|
+
const verifyBooleanFilter = (filter) => {
|
|
333
|
+
if (typeof filter.operator !== "string") {
|
|
334
|
+
return false;
|
|
335
|
+
}
|
|
336
|
+
if (BOOLEAN_OPERATORS.findIndex((f) => f === filter.operator) === -1) {
|
|
337
|
+
return false;
|
|
338
|
+
}
|
|
339
|
+
if (typeof filter.operand1 !== "boolean") {
|
|
340
|
+
return false;
|
|
341
|
+
}
|
|
342
|
+
return true;
|
|
343
|
+
};
|
|
344
|
+
const verifyDateTime = (filter) => {
|
|
345
|
+
if (typeof filter.operator !== "string") {
|
|
346
|
+
return false;
|
|
347
|
+
}
|
|
348
|
+
if (DATE_TIME_OPERATORS.findIndex((f) => f === filter.operator) === -1) {
|
|
349
|
+
return false;
|
|
350
|
+
}
|
|
351
|
+
if (typeof filter.operand1 !== "string") {
|
|
352
|
+
return false;
|
|
353
|
+
}
|
|
354
|
+
if (filter.operator === "b" && typeof filter.operand2 !== "string") {
|
|
355
|
+
return false;
|
|
356
|
+
}
|
|
357
|
+
return true;
|
|
358
|
+
};
|
|
359
|
+
const getDefaultDateTimeFilter = (field, fixed, getLabel) => {
|
|
360
|
+
const defaultStartDate = new Date();
|
|
361
|
+
const defaultEndDate = new Date();
|
|
362
|
+
let dfop1 = field.defaultOperand1;
|
|
363
|
+
let dfop2 = field.defaultOperand2;
|
|
364
|
+
const defaultFilter = {
|
|
365
|
+
id: 0,
|
|
366
|
+
fieldName: field.name,
|
|
367
|
+
fixed,
|
|
368
|
+
isSetted: true,
|
|
369
|
+
operator: "b",
|
|
370
|
+
labelOperator: "",
|
|
371
|
+
operand1: dfop1,
|
|
372
|
+
operand2: dfop2,
|
|
373
|
+
labelOperands: ""
|
|
374
|
+
};
|
|
375
|
+
if (dfop1) {
|
|
376
|
+
if (isValidDate(dfop1)) {
|
|
377
|
+
defaultStartDate.setDate(dfop1.getDate());
|
|
378
|
+
} else {
|
|
379
|
+
dfop1 = void 0;
|
|
380
|
+
}
|
|
381
|
+
}
|
|
382
|
+
if (dfop1 === void 0) {
|
|
383
|
+
defaultStartDate.setHours(0, 0, 0, 0);
|
|
384
|
+
}
|
|
385
|
+
if (dfop2) {
|
|
386
|
+
if (isValidDate(dfop2)) {
|
|
387
|
+
defaultEndDate.setDate(dfop2.getDate());
|
|
388
|
+
} else {
|
|
389
|
+
dfop2 = void 0;
|
|
390
|
+
}
|
|
391
|
+
}
|
|
392
|
+
if (dfop2 === void 0) {
|
|
393
|
+
defaultEndDate.setHours(23, 59, 59, 999);
|
|
394
|
+
}
|
|
395
|
+
defaultFilter.operand1 = defaultStartDate.toISOString();
|
|
396
|
+
defaultFilter.operand2 = defaultEndDate.toISOString();
|
|
397
|
+
defaultFilter.labelOperands = `${format(defaultStartDate, "yyyy-MM-dd HH:mm:ss")} - ${format(defaultEndDate, "yyyy-MM-dd HH:mm:ss")}`;
|
|
398
|
+
defaultFilter.labelOperator = getLabel(`dynamic_filter.operator_${defaultFilter.operator}`);
|
|
399
|
+
return defaultFilter;
|
|
400
|
+
};
|
|
270
401
|
function DateTimeFilter() {
|
|
271
402
|
const {
|
|
272
403
|
setPoupEditValidationSchema,
|
|
@@ -276,6 +407,11 @@ function DateTimeFilter() {
|
|
|
276
407
|
const {
|
|
277
408
|
getLabel
|
|
278
409
|
} = useModuleDictionary();
|
|
410
|
+
const {
|
|
411
|
+
dfnsFormat: {
|
|
412
|
+
datetime_format
|
|
413
|
+
}
|
|
414
|
+
} = useEnvironment();
|
|
279
415
|
const {
|
|
280
416
|
popupData: {
|
|
281
417
|
filter,
|
|
@@ -310,10 +446,10 @@ function DateTimeFilter() {
|
|
|
310
446
|
};
|
|
311
447
|
if (data.valueOperator.id === "b") {
|
|
312
448
|
newFilter.operand2 = data.valueOperand2.toISOString();
|
|
313
|
-
newFilter.labelOperands = `${format(data.valueOperand1,
|
|
449
|
+
newFilter.labelOperands = `${format(data.valueOperand1, datetime_format)} - ${format(data.valueOperand2, datetime_format)}`;
|
|
314
450
|
} else {
|
|
315
451
|
newFilter.operand2 = newFilter.operand2 ? newFilter.operand2 : newFilter.operand1;
|
|
316
|
-
newFilter.labelOperands = format(data.valueOperand1,
|
|
452
|
+
newFilter.labelOperands = format(data.valueOperand1, datetime_format);
|
|
317
453
|
}
|
|
318
454
|
return newFilter;
|
|
319
455
|
}, []);
|
|
@@ -322,12 +458,12 @@ function DateTimeFilter() {
|
|
|
322
458
|
if (!isLoaded) {
|
|
323
459
|
setPoupEditValidationSchema({
|
|
324
460
|
valueOperator: Yup.object().nullable().required(getLabel(`operator_required`)),
|
|
325
|
-
valueOperand1: Yup.date().test("valueOperand1", getLabel(`
|
|
461
|
+
valueOperand1: Yup.date().test("valueOperand1", getLabel(`dynamic_filter.error_invalid_date1`), (value) => {
|
|
326
462
|
return Boolean(value);
|
|
327
463
|
}),
|
|
328
464
|
valueOperand2: Yup.date().when(["valueOperator.id"], {
|
|
329
465
|
is: "b",
|
|
330
|
-
then: Yup.date().test("DOB", getLabel(`
|
|
466
|
+
then: Yup.date().test("DOB", getLabel(`dynamic_filter.error_invalid_date2`), (value) => {
|
|
331
467
|
return Boolean(value);
|
|
332
468
|
})
|
|
333
469
|
})
|
|
@@ -348,7 +484,7 @@ function DateTimeFilter() {
|
|
|
348
484
|
}, [getLabel, filter, field]);
|
|
349
485
|
return /* @__PURE__ */ jsx(WrapperAllFieldsFilter, {
|
|
350
486
|
children: isLoaded && /* @__PURE__ */ jsxs(Fragment, {
|
|
351
|
-
children: [/* @__PURE__ */ jsx(WrapperAutoComplete, {
|
|
487
|
+
children: [/* @__PURE__ */ jsx(WrapperAutoComplete$1, {
|
|
352
488
|
children: /* @__PURE__ */ jsx(RHFAutocomplete, {
|
|
353
489
|
name: "valueOperator",
|
|
354
490
|
autoComplete: "off",
|
|
@@ -360,7 +496,8 @@ function DateTimeFilter() {
|
|
|
360
496
|
}), /* @__PURE__ */ jsx(RHFDateTime, {
|
|
361
497
|
name: "valueOperand1",
|
|
362
498
|
autoComplete: "off",
|
|
363
|
-
label: ""
|
|
499
|
+
label: "",
|
|
500
|
+
focused: true
|
|
364
501
|
}), operator && operator.id === "b" && /* @__PURE__ */ jsx(RHFDateTime, {
|
|
365
502
|
name: "valueOperand2",
|
|
366
503
|
autoComplete: "off",
|
|
@@ -369,108 +506,166 @@ function DateTimeFilter() {
|
|
|
369
506
|
})
|
|
370
507
|
});
|
|
371
508
|
}
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
}
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
};
|
|
387
|
-
const
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
}
|
|
391
|
-
if (BOOLEAN_OPERATORS.findIndex((f) => f === filter.operator) === -1) {
|
|
392
|
-
return false;
|
|
393
|
-
}
|
|
394
|
-
if (typeof filter.operand1 !== "boolean") {
|
|
395
|
-
return false;
|
|
396
|
-
}
|
|
397
|
-
return true;
|
|
398
|
-
};
|
|
399
|
-
const verifyDateTime = (filter) => {
|
|
400
|
-
if (typeof filter.operator !== "string") {
|
|
401
|
-
return false;
|
|
402
|
-
}
|
|
403
|
-
if (DATE_TIME_OPERATORS.findIndex((f) => f === filter.operator) === -1) {
|
|
404
|
-
return false;
|
|
405
|
-
}
|
|
406
|
-
if (typeof filter.operand1 !== "string") {
|
|
407
|
-
return false;
|
|
408
|
-
}
|
|
409
|
-
if (filter.operator === "b" && typeof filter.operand2 !== "string") {
|
|
410
|
-
return false;
|
|
411
|
-
}
|
|
412
|
-
return true;
|
|
413
|
-
};
|
|
414
|
-
const getDefaultFilterValues = (field, fixed, getLabelOperator) => {
|
|
415
|
-
const defaultStartDate = new Date();
|
|
416
|
-
const defaultEndDate = new Date();
|
|
417
|
-
let dfop1 = field.defaultOperand1;
|
|
418
|
-
let dfop2 = field.defaultOperand2;
|
|
509
|
+
const WrapperStringFilter = styled("div")(({
|
|
510
|
+
theme
|
|
511
|
+
}) => ({
|
|
512
|
+
display: "flex",
|
|
513
|
+
flexDirection: "column",
|
|
514
|
+
justifyContent: "center",
|
|
515
|
+
alignItems: "center",
|
|
516
|
+
width: "100%",
|
|
517
|
+
minWidth: theme.spacing(3.75),
|
|
518
|
+
padding: theme.spacing(3, 0),
|
|
519
|
+
gap: theme.spacing(3)
|
|
520
|
+
}));
|
|
521
|
+
const WrapperAutoComplete = styled("div")(() => ({
|
|
522
|
+
width: "100%"
|
|
523
|
+
}));
|
|
524
|
+
const getDefaultNumberFilter = (field, fixed, getLabel) => {
|
|
525
|
+
const dfop1 = field.defaultOperand1;
|
|
526
|
+
const dfop2 = field.defaultOperand2;
|
|
419
527
|
const defaultFilter = {
|
|
420
528
|
id: 0,
|
|
421
529
|
fieldName: field.name,
|
|
422
530
|
fixed,
|
|
423
531
|
isSetted: false,
|
|
424
|
-
operator: "
|
|
532
|
+
operator: "e",
|
|
425
533
|
labelOperator: "",
|
|
426
534
|
operand1: "",
|
|
535
|
+
operand2: "",
|
|
427
536
|
labelOperands: ""
|
|
428
537
|
};
|
|
538
|
+
if (dfop1 !== void 0 && typeof dfop1 === "number") {
|
|
539
|
+
defaultFilter.operand1 = dfop1;
|
|
540
|
+
defaultFilter.labelOperands = defaultFilter.operand1;
|
|
541
|
+
}
|
|
542
|
+
if (dfop2 !== void 0 && typeof dfop2 === "number") {
|
|
543
|
+
defaultFilter.operand2 = dfop2;
|
|
544
|
+
}
|
|
545
|
+
defaultFilter.labelOperator = getLabel(`dynamic_filter.operator_${defaultFilter.operator}`);
|
|
546
|
+
return defaultFilter;
|
|
547
|
+
};
|
|
548
|
+
function NumberFilter() {
|
|
549
|
+
const {
|
|
550
|
+
popupData: {
|
|
551
|
+
filter,
|
|
552
|
+
field
|
|
553
|
+
},
|
|
554
|
+
setPoupEditValidationSchema,
|
|
555
|
+
setFnTransformFormValuesIntoValues: setTransformFunctionFormValuesToValues,
|
|
556
|
+
getLabelOperator
|
|
557
|
+
} = useBase();
|
|
558
|
+
const {
|
|
559
|
+
getLabel
|
|
560
|
+
} = useModuleDictionary();
|
|
561
|
+
const inputRef = useRef(null);
|
|
562
|
+
const {
|
|
563
|
+
control,
|
|
564
|
+
setValue
|
|
565
|
+
} = useFormContext();
|
|
566
|
+
const [isLoaded, setIsLoaded] = useState(false);
|
|
567
|
+
const operator = useWatch({
|
|
568
|
+
control,
|
|
569
|
+
name: "valueOperator"
|
|
570
|
+
});
|
|
571
|
+
const options = useMemo(() => NUMBER_OPERATORS.map((o) => ({
|
|
572
|
+
id: o,
|
|
573
|
+
label: getLabelOperator(o)
|
|
574
|
+
})), [getLabelOperator]);
|
|
575
|
+
const transformFunctionFormValuesToValues = useCallback((data) => {
|
|
576
|
+
if (!filter || !field)
|
|
577
|
+
return void 0;
|
|
578
|
+
const newFilter = {
|
|
579
|
+
id: filter.id,
|
|
580
|
+
fieldName: field.name,
|
|
581
|
+
fixed: filter.fixed,
|
|
582
|
+
isSetted: true,
|
|
583
|
+
operator: data.valueOperator.id,
|
|
584
|
+
operand1: Number(data.valueOperand1),
|
|
585
|
+
operand2: data.valueOperand2,
|
|
586
|
+
labelOperator: data.valueOperator.label,
|
|
587
|
+
labelOperands: data.valueOperand1
|
|
588
|
+
};
|
|
589
|
+
if (data.valueOperator.id === "b") {
|
|
590
|
+
newFilter.labelOperands = `${data.valueOperand1} - ${data.valueOperand2}`;
|
|
591
|
+
newFilter.operand2 = Number(data.valueOperand2);
|
|
592
|
+
} else {
|
|
593
|
+
newFilter.operand2 = void 0;
|
|
594
|
+
}
|
|
595
|
+
return newFilter;
|
|
596
|
+
}, []);
|
|
597
|
+
useEffect(() => {
|
|
598
|
+
if (!isLoaded) {
|
|
599
|
+
setPoupEditValidationSchema({
|
|
600
|
+
valueOperator: Yup.object().nullable().required(getLabel(`dynamic_filter.operator_required`)),
|
|
601
|
+
valueOperand1: Yup.number().typeError(getLabel(`dynamic_filter.operand_mustbe_number`)),
|
|
602
|
+
valueOperand2: Yup.string().when("valueOperator", {
|
|
603
|
+
is: (o) => {
|
|
604
|
+
console.log("valueOperand2", o);
|
|
605
|
+
return o.id === "b";
|
|
606
|
+
},
|
|
607
|
+
then: Yup.string().test("DOB", getLabel(`dynamic_filter.operand_mustbe_number`), (value) => {
|
|
608
|
+
console.log("imprimir", value);
|
|
609
|
+
if (value === "")
|
|
610
|
+
return false;
|
|
611
|
+
return !isNaN(Number(value));
|
|
612
|
+
})
|
|
613
|
+
})
|
|
614
|
+
});
|
|
615
|
+
}
|
|
616
|
+
setTransformFunctionFormValuesToValues(transformFunctionFormValuesToValues);
|
|
617
|
+
if (filter && field) {
|
|
618
|
+
setValue("valueOperand1", filter.operand1, {
|
|
619
|
+
shouldTouch: false,
|
|
620
|
+
shouldValidate: false
|
|
621
|
+
});
|
|
622
|
+
setValue("valueOperand2", filter.operand2, {
|
|
623
|
+
shouldTouch: false,
|
|
624
|
+
shouldValidate: false
|
|
625
|
+
});
|
|
626
|
+
}
|
|
627
|
+
setIsLoaded(true);
|
|
628
|
+
}, [getLabel, filter, field]);
|
|
629
|
+
useEffect(() => {
|
|
630
|
+
console.debug("InputRef", inputRef);
|
|
631
|
+
inputRef.current?.focus();
|
|
632
|
+
}, [isLoaded]);
|
|
633
|
+
return /* @__PURE__ */ jsx(WrapperStringFilter, {
|
|
634
|
+
children: isLoaded && /* @__PURE__ */ jsxs(Fragment, {
|
|
635
|
+
children: [/* @__PURE__ */ jsx(WrapperAutoComplete, {
|
|
636
|
+
children: /* @__PURE__ */ jsx(RHFAutocomplete, {
|
|
637
|
+
name: "valueOperator",
|
|
638
|
+
autoComplete: "off",
|
|
639
|
+
options,
|
|
640
|
+
getOptionLabel: (option) => option.label,
|
|
641
|
+
isOptionEqualToValue: (option, value) => option.id === value.id,
|
|
642
|
+
label: ""
|
|
643
|
+
})
|
|
644
|
+
}), /* @__PURE__ */ jsx(RHFTextField, {
|
|
645
|
+
name: "valueOperand1",
|
|
646
|
+
ref: inputRef,
|
|
647
|
+
focused: true
|
|
648
|
+
}), operator && operator.id === "b" && /* @__PURE__ */ jsx(RHFTextField, {
|
|
649
|
+
name: "valueOperand2",
|
|
650
|
+
ref: inputRef
|
|
651
|
+
})]
|
|
652
|
+
})
|
|
653
|
+
});
|
|
654
|
+
}
|
|
655
|
+
const getDefaultFilterValues = (field, fixed, getLabel) => {
|
|
429
656
|
switch (field.type) {
|
|
430
657
|
case "string":
|
|
431
|
-
|
|
658
|
+
return getDefaultStringFilter(field, fixed, getLabel);
|
|
432
659
|
case "number":
|
|
660
|
+
return getDefaultNumberFilter(field, fixed, getLabel);
|
|
433
661
|
case "boolean":
|
|
434
|
-
|
|
435
|
-
if (dfop1 !== void 0 && typeof dfop1 === "boolean") {
|
|
436
|
-
defaultFilter.operand1 = dfop1;
|
|
437
|
-
} else {
|
|
438
|
-
defaultFilter.operand1 = true;
|
|
439
|
-
}
|
|
440
|
-
break;
|
|
662
|
+
return getDefaultBooleanFilter(field, fixed, getLabel);
|
|
441
663
|
case "time":
|
|
442
664
|
case "date":
|
|
443
665
|
case "datetime":
|
|
444
|
-
|
|
445
|
-
if (isValidDate(dfop1)) {
|
|
446
|
-
defaultStartDate.setDate(dfop1.getDate());
|
|
447
|
-
} else {
|
|
448
|
-
dfop1 = void 0;
|
|
449
|
-
}
|
|
450
|
-
}
|
|
451
|
-
if (dfop1 === void 0) {
|
|
452
|
-
defaultStartDate.setHours(0, 0, 0, 0);
|
|
453
|
-
}
|
|
454
|
-
if (dfop2) {
|
|
455
|
-
if (isValidDate(dfop2)) {
|
|
456
|
-
defaultEndDate.setDate(dfop2.getDate());
|
|
457
|
-
} else {
|
|
458
|
-
dfop2 = void 0;
|
|
459
|
-
}
|
|
460
|
-
}
|
|
461
|
-
if (dfop2 === void 0) {
|
|
462
|
-
defaultEndDate.setHours(23, 59, 59, 999);
|
|
463
|
-
}
|
|
464
|
-
defaultFilter.operator = "b";
|
|
465
|
-
defaultFilter.operand1 = defaultStartDate.toISOString();
|
|
466
|
-
defaultFilter.operand2 = defaultEndDate.toISOString();
|
|
467
|
-
defaultFilter.labelOperands = `${format(defaultStartDate, "yyyy-MM-dd HH:mm:ss")} - ${format(defaultEndDate, "yyyy-MM-dd HH:mm:ss")}`;
|
|
468
|
-
defaultFilter.isSetted = true;
|
|
469
|
-
break;
|
|
666
|
+
return getDefaultDateTimeFilter(field, fixed, getLabel);
|
|
470
667
|
}
|
|
471
|
-
|
|
472
|
-
console.log("operator", defaultFilter);
|
|
473
|
-
return defaultFilter;
|
|
668
|
+
throw new Error("Type no defined");
|
|
474
669
|
};
|
|
475
670
|
const PopupEditFilterComponent = (props) => {
|
|
476
671
|
const {
|
|
@@ -482,6 +677,8 @@ const PopupEditFilterComponent = (props) => {
|
|
|
482
677
|
switch (field.type) {
|
|
483
678
|
case "string":
|
|
484
679
|
return /* @__PURE__ */ jsx(StringFilter, {});
|
|
680
|
+
case "number":
|
|
681
|
+
return /* @__PURE__ */ jsx(NumberFilter, {});
|
|
485
682
|
case "boolean":
|
|
486
683
|
return /* @__PURE__ */ jsx(BooleanFilter, {});
|
|
487
684
|
case "datetime":
|
|
@@ -540,7 +737,7 @@ const getRawFilter = (applyedFilter) => {
|
|
|
540
737
|
o2: af.operand2
|
|
541
738
|
}));
|
|
542
739
|
};
|
|
543
|
-
const getInitialFilters = (fields, filters, getFieldByName,
|
|
740
|
+
const getInitialFilters = (fields, filters, getFieldByName, getLabel) => {
|
|
544
741
|
const newFilters = [];
|
|
545
742
|
const fixedFields = [];
|
|
546
743
|
for (let index = 0; index < filters.length; index++) {
|
|
@@ -585,7 +782,7 @@ const getInitialFilters = (fields, filters, getFieldByName, getLabelOperator) =>
|
|
|
585
782
|
const field = fields[index];
|
|
586
783
|
if (field.fixed) {
|
|
587
784
|
if (!filters.find((f) => f.fieldName === field.name)) {
|
|
588
|
-
const newFilter = getDefaultFilterValues(field, true,
|
|
785
|
+
const newFilter = getDefaultFilterValues(field, true, getLabel);
|
|
589
786
|
newFilter.id = newFilters.length + 1;
|
|
590
787
|
newFilters.push(newFilter);
|
|
591
788
|
}
|
|
@@ -614,12 +811,17 @@ function BaseProvider(props) {
|
|
|
614
811
|
} = useModuleDictionary();
|
|
615
812
|
const [popupValidationSchema, setInternalPopupValidationSchema] = useState(Yup.object().shape({}));
|
|
616
813
|
const [fnTransformFormValuesIntoRawValues, setInternalfnTransormFormValuesIntoRawValues] = useState(() => void 0);
|
|
814
|
+
const {
|
|
815
|
+
host_static_assets,
|
|
816
|
+
environment_assets
|
|
817
|
+
} = useEnvironment();
|
|
617
818
|
const all_fields = useMemo(() => {
|
|
618
819
|
return {
|
|
619
820
|
...ALL_FIELDS,
|
|
620
|
-
label: getLabel("filter.all_fields")
|
|
821
|
+
label: getLabel("filter.all_fields"),
|
|
822
|
+
urlIcon: `${host_static_assets}/${environment_assets}/frontend/components/dynamic_filter/assets/icons/all_fields.svg`
|
|
621
823
|
};
|
|
622
|
-
}, [getLabel]);
|
|
824
|
+
}, [getLabel, host_static_assets, environment_assets]);
|
|
623
825
|
const [inEdition, setInEdition] = useState(false);
|
|
624
826
|
const [isDirty, setIsDirty] = useState(!automatic);
|
|
625
827
|
const [isValid, setIsValid] = useState(false);
|
|
@@ -632,9 +834,9 @@ function BaseProvider(props) {
|
|
|
632
834
|
});
|
|
633
835
|
}, [fields, all_fields]);
|
|
634
836
|
const getLabelOperator = useCallback((operator) => {
|
|
635
|
-
return getLabel(`
|
|
837
|
+
return getLabel(`dynamic_filter.operator_${operator}`);
|
|
636
838
|
}, [getLabel]);
|
|
637
|
-
const [applyedFilters, setApplyedFilters] = useState(getInitialFilters(fields, initialFilters, getFieldByName,
|
|
839
|
+
const [applyedFilters, setApplyedFilters] = useState(getInitialFilters(fields, initialFilters, getFieldByName, getLabel));
|
|
638
840
|
const availableFields = useMemo(() => {
|
|
639
841
|
const newFields = [];
|
|
640
842
|
for (let index = 0; index < fields.length; index++) {
|
|
@@ -659,7 +861,7 @@ function BaseProvider(props) {
|
|
|
659
861
|
setIsDirty(false);
|
|
660
862
|
onChangeFilter(applyedFilters, getRawFilter(applyedFilters));
|
|
661
863
|
} else {
|
|
662
|
-
toast(getLabel("
|
|
864
|
+
toast(getLabel("dynamic_filter.error_filters_no_setted"), {
|
|
663
865
|
type: "error",
|
|
664
866
|
autoClose: 1e4
|
|
665
867
|
});
|
|
@@ -677,7 +879,6 @@ function BaseProvider(props) {
|
|
|
677
879
|
return;
|
|
678
880
|
}
|
|
679
881
|
if (!NoValid) {
|
|
680
|
-
console.log("Ingrese");
|
|
681
882
|
setIsDirty(false);
|
|
682
883
|
onChangeFilter(applyedFilters, getRawFilter(applyedFilters));
|
|
683
884
|
}
|
|
@@ -742,7 +943,7 @@ function BaseProvider(props) {
|
|
|
742
943
|
const showPopupForAddFilter = useCallback((anchorEl, field) => {
|
|
743
944
|
setPopupData({
|
|
744
945
|
popupAnchorEl: anchorEl,
|
|
745
|
-
filter: getDefaultFilterValues(field, false,
|
|
946
|
+
filter: getDefaultFilterValues(field, false, getLabel),
|
|
746
947
|
field
|
|
747
948
|
});
|
|
748
949
|
setInEdition(true);
|
|
@@ -876,7 +1077,7 @@ function ApplyedFilter(props) {
|
|
|
876
1077
|
} = useBase();
|
|
877
1078
|
const {
|
|
878
1079
|
host_static_assets,
|
|
879
|
-
|
|
1080
|
+
environment_assets
|
|
880
1081
|
} = useEnvironment();
|
|
881
1082
|
console.log("fieldName by ApplyedFilter 1", getFieldByName(fieldName));
|
|
882
1083
|
const field = useMemo(() => {
|
|
@@ -905,7 +1106,7 @@ function ApplyedFilter(props) {
|
|
|
905
1106
|
return /* @__PURE__ */ jsxs(WrapperApplyedFilter, {
|
|
906
1107
|
id: "WrapperApplyedFilter",
|
|
907
1108
|
className: !isSetted ? "waf_no_setted" : "",
|
|
908
|
-
children: [/* @__PURE__ */ jsx(Icon, {
|
|
1109
|
+
children: [urlIcon && /* @__PURE__ */ jsx(Icon, {
|
|
909
1110
|
src: urlIcon,
|
|
910
1111
|
onClick
|
|
911
1112
|
}), /* @__PURE__ */ jsxs(AplyedFilterStyled, {
|
|
@@ -918,7 +1119,7 @@ function ApplyedFilter(props) {
|
|
|
918
1119
|
children: labelOperands
|
|
919
1120
|
})]
|
|
920
1121
|
}), !fixed && /* @__PURE__ */ jsx(IconButton, {
|
|
921
|
-
src: `${host_static_assets}/${
|
|
1122
|
+
src: `${host_static_assets}/${environment_assets}/frontend/components/dynamic_filter/assets/icons/close.svg`,
|
|
922
1123
|
onClick: onDelete
|
|
923
1124
|
})]
|
|
924
1125
|
});
|
|
@@ -933,12 +1134,9 @@ function ApplyedFilters() {
|
|
|
933
1134
|
id: "WrapperApplyedFilters"
|
|
934
1135
|
});
|
|
935
1136
|
}
|
|
936
|
-
return /* @__PURE__ */ jsx(
|
|
937
|
-
style: {
|
|
938
|
-
width: "100%"
|
|
939
|
-
},
|
|
1137
|
+
return /* @__PURE__ */ jsx(WrapperApplyedFilters, {
|
|
940
1138
|
children: /* @__PURE__ */ jsx(ScrollBar, {
|
|
941
|
-
children: /* @__PURE__ */ jsx(
|
|
1139
|
+
children: /* @__PURE__ */ jsx(ContainerApplyedFilters, {
|
|
942
1140
|
id: "WrapperApplyedFilters",
|
|
943
1141
|
children: [...applyedFilters].sort((a, b) => a.isSetted === b.isSetted ? 0 : a.isSetted ? -1 : 1).reverse().map((filter) => /* @__PURE__ */ jsx(ApplyedFilter, {
|
|
944
1142
|
...filter
|
|
@@ -968,11 +1166,12 @@ const WrapperClearFilters = styled$1("div")(({
|
|
|
968
1166
|
const ClearFilters = () => {
|
|
969
1167
|
const {
|
|
970
1168
|
host_static_assets,
|
|
971
|
-
|
|
1169
|
+
environment_assets
|
|
972
1170
|
} = useEnvironment();
|
|
973
1171
|
const {
|
|
974
1172
|
clearFilters,
|
|
975
|
-
isSkeleton
|
|
1173
|
+
isSkeleton,
|
|
1174
|
+
applyedFilters
|
|
976
1175
|
} = useBase();
|
|
977
1176
|
if (isSkeleton) {
|
|
978
1177
|
return /* @__PURE__ */ jsx(SKTClearFilters, {
|
|
@@ -983,12 +1182,16 @@ const ClearFilters = () => {
|
|
|
983
1182
|
})
|
|
984
1183
|
});
|
|
985
1184
|
}
|
|
986
|
-
|
|
987
|
-
|
|
988
|
-
|
|
989
|
-
|
|
990
|
-
|
|
991
|
-
|
|
1185
|
+
console.log("Dynamic validation", applyedFilters.findIndex((f) => f.fixed == false) > -1);
|
|
1186
|
+
if (applyedFilters.findIndex((f) => f.fixed == false) > -1) {
|
|
1187
|
+
return /* @__PURE__ */ jsx(WrapperClearFilters, {
|
|
1188
|
+
children: /* @__PURE__ */ jsx(IconButton, {
|
|
1189
|
+
src: `${host_static_assets}/${environment_assets}/frontend/components/dynamic_filter/assets/icons/clear.svg`,
|
|
1190
|
+
onClick: clearFilters
|
|
1191
|
+
})
|
|
1192
|
+
});
|
|
1193
|
+
}
|
|
1194
|
+
return /* @__PURE__ */ jsx(Fragment, {});
|
|
992
1195
|
};
|
|
993
1196
|
const SKTWrapperFilterButton = styled("div")(({
|
|
994
1197
|
theme
|
|
@@ -997,28 +1200,27 @@ const SKTWrapperFilterButton = styled("div")(({
|
|
|
997
1200
|
justifyContent: "center",
|
|
998
1201
|
alignItems: "center",
|
|
999
1202
|
minWidth: theme.spacing(3.75),
|
|
1000
|
-
height: theme.spacing(3.75)
|
|
1001
|
-
|
|
1002
|
-
styled("div")(({
|
|
1003
|
-
theme
|
|
1004
|
-
}) => ({
|
|
1005
|
-
display: "flex",
|
|
1006
|
-
justifyContent: "center",
|
|
1007
|
-
alignItems: "center",
|
|
1008
|
-
minWidth: theme.spacing(3.75),
|
|
1009
|
-
height: theme.spacing(3.75)
|
|
1203
|
+
height: theme.spacing(3.75),
|
|
1204
|
+
background: alpha(theme.palette.primary.main, 0.3)
|
|
1010
1205
|
}));
|
|
1011
1206
|
const WrapperFilterButton = styled("div")(() => ({
|
|
1012
1207
|
"&.isDirty": {
|
|
1208
|
+
animationName: "dirtyEffect",
|
|
1209
|
+
animationDuration: "1s",
|
|
1210
|
+
animationFillMode: "both",
|
|
1211
|
+
animationIterationCount: "infinite",
|
|
1212
|
+
transition: "all .3s",
|
|
1013
1213
|
"@keyframes dirtyEffect": {
|
|
1014
|
-
|
|
1214
|
+
"20%": {
|
|
1015
1215
|
opacity: 1
|
|
1016
1216
|
},
|
|
1017
|
-
|
|
1018
|
-
opacity: 0
|
|
1217
|
+
"50%": {
|
|
1218
|
+
opacity: 0.5
|
|
1219
|
+
},
|
|
1220
|
+
"100%": {
|
|
1221
|
+
opacity: 1
|
|
1019
1222
|
}
|
|
1020
|
-
}
|
|
1021
|
-
animation: "dirtyEffect 2s infinite ease"
|
|
1223
|
+
}
|
|
1022
1224
|
},
|
|
1023
1225
|
"&.isDirtyError": {}
|
|
1024
1226
|
}));
|
|
@@ -1032,7 +1234,7 @@ function FilterButton() {
|
|
|
1032
1234
|
} = useBase();
|
|
1033
1235
|
const {
|
|
1034
1236
|
host_static_assets,
|
|
1035
|
-
|
|
1237
|
+
environment_assets
|
|
1036
1238
|
} = useEnvironment();
|
|
1037
1239
|
console.log("Render isDirty", isDirty, automatic);
|
|
1038
1240
|
if (isSkeleton) {
|
|
@@ -1046,21 +1248,24 @@ function FilterButton() {
|
|
|
1046
1248
|
}
|
|
1047
1249
|
const color = useMemo(() => {
|
|
1048
1250
|
if (automatic) {
|
|
1049
|
-
return "
|
|
1251
|
+
return "active";
|
|
1050
1252
|
}
|
|
1051
1253
|
if (!isValid) {
|
|
1052
1254
|
return "error";
|
|
1053
1255
|
}
|
|
1054
|
-
return "
|
|
1256
|
+
return "selected";
|
|
1055
1257
|
}, [automatic, isValid]);
|
|
1258
|
+
console.log("Dynamic color value", color);
|
|
1259
|
+
console.log("Dynamic automatic value", automatic);
|
|
1056
1260
|
return /* @__PURE__ */ jsx(WrapperFilterButton, {
|
|
1261
|
+
id: "WrapperFilterButton",
|
|
1057
1262
|
className: isDirty && isValid ? "isDirty" : "",
|
|
1058
1263
|
children: /* @__PURE__ */ jsx(IconButton, {
|
|
1059
|
-
color,
|
|
1060
|
-
dictionaryTooltip: "
|
|
1264
|
+
bgColor: color,
|
|
1265
|
+
dictionaryTooltip: "dynamic_filter.filter_tooltip",
|
|
1061
1266
|
onClick: () => fireOnChangeFilters(),
|
|
1062
1267
|
"aria-label": "settings",
|
|
1063
|
-
src: `${host_static_assets}/${
|
|
1268
|
+
src: `${host_static_assets}/${environment_assets}/frontend/components/dynamic_filter/assets/icons/${automatic ? "refresh" : "search"}.svg`
|
|
1064
1269
|
})
|
|
1065
1270
|
});
|
|
1066
1271
|
}
|
|
@@ -1072,7 +1277,7 @@ const WrapperInputFilter = styled("div")(({
|
|
|
1072
1277
|
alignItems: "center",
|
|
1073
1278
|
width: "100%",
|
|
1074
1279
|
height: theme.spacing(3.75),
|
|
1075
|
-
|
|
1280
|
+
marginLeft: theme.spacing(1.5),
|
|
1076
1281
|
padding: theme.spacing(0, 1.5),
|
|
1077
1282
|
borderRight: `1px solid ${theme.palette.divider}`,
|
|
1078
1283
|
borderLeft: `1px solid ${theme.palette.divider}`,
|
|
@@ -1165,6 +1370,10 @@ function InputFilter() {
|
|
|
1165
1370
|
}
|
|
1166
1371
|
};
|
|
1167
1372
|
console.log("Render InputFilter");
|
|
1373
|
+
if (!withAllField && availableFields.length == 0) {
|
|
1374
|
+
return /* @__PURE__ */ jsx(Fragment, {});
|
|
1375
|
+
}
|
|
1376
|
+
console.log("availableFields test", availableFields.length);
|
|
1168
1377
|
return /* @__PURE__ */ jsxs(WrapperInputFilter, {
|
|
1169
1378
|
id: "WrapperInputFilter",
|
|
1170
1379
|
children: [/* @__PURE__ */ jsx(StyledInputFilter, {
|
|
@@ -1174,7 +1383,7 @@ function InputFilter() {
|
|
|
1174
1383
|
onClick: onClickFilter,
|
|
1175
1384
|
onChange: onChangeFilter,
|
|
1176
1385
|
onKeyPress: handleKeyPressMenu
|
|
1177
|
-
}), /* @__PURE__ */ jsx(MenuPopover, {
|
|
1386
|
+
}), availableFields.length > 0 && /* @__PURE__ */ jsx(MenuPopover, {
|
|
1178
1387
|
id: "MenuPopover",
|
|
1179
1388
|
open: Boolean(openAnchorEl),
|
|
1180
1389
|
anchorEl: openAnchorEl,
|
|
@@ -1301,8 +1510,8 @@ const PopupEditFilter = () => {
|
|
|
1301
1510
|
urlCancel: -1,
|
|
1302
1511
|
children: /* @__PURE__ */ jsxs(WrapperPopupEditFilter, {
|
|
1303
1512
|
children: [/* @__PURE__ */ jsxs(HeaderContainer, {
|
|
1304
|
-
children: [/* @__PURE__ */ jsx(Icon, {
|
|
1305
|
-
src: field
|
|
1513
|
+
children: [field?.urlIcon && /* @__PURE__ */ jsx(Icon, {
|
|
1514
|
+
src: field.urlIcon
|
|
1306
1515
|
}), /* @__PURE__ */ jsx(TitleContainer, {
|
|
1307
1516
|
children: field?.label
|
|
1308
1517
|
})]
|
|
@@ -1336,6 +1545,7 @@ const WrapperFilter = styled("div", {
|
|
|
1336
1545
|
alignItems: "center",
|
|
1337
1546
|
justifyContent: "flex-start",
|
|
1338
1547
|
height: "auto",
|
|
1548
|
+
width: "100%",
|
|
1339
1549
|
padding: theme.spacing(1.5),
|
|
1340
1550
|
borderRadius: theme.spacing(1),
|
|
1341
1551
|
border: inEdition ? `1px solid ${theme.palette.primary.main}` : `1px solid ${theme.palette.divider}`
|
|
@@ -1352,16 +1562,16 @@ const WrapperFilterMobile = styled("div", {
|
|
|
1352
1562
|
justifyContent: "space-between",
|
|
1353
1563
|
minWidth: theme.spacing(25),
|
|
1354
1564
|
height: "auto",
|
|
1565
|
+
width: "100%",
|
|
1355
1566
|
padding: theme.spacing(1.5),
|
|
1356
1567
|
borderRadius: theme.spacing(1),
|
|
1357
1568
|
border: inEdition ? `1px solid ${theme.palette.primary.main}` : `1px solid ${theme.palette.divider}`,
|
|
1358
1569
|
gap: theme.spacing(1.5)
|
|
1359
1570
|
}));
|
|
1360
|
-
const ContainerFistRow = styled("div")(({
|
|
1361
|
-
|
|
1362
|
-
}) => ({
|
|
1571
|
+
const ContainerFistRow = styled("div")(() => ({
|
|
1572
|
+
width: "100%",
|
|
1363
1573
|
display: "flex",
|
|
1364
|
-
|
|
1574
|
+
justifyContent: "space-between"
|
|
1365
1575
|
}));
|
|
1366
1576
|
const DynamicFilter = (props) => {
|
|
1367
1577
|
const isDesktop = useResponsiveDesktop();
|