@m4l/components 0.1.60 → 0.1.62
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/components/CommonActions/components/ActionFormCancel/{index.c4054a25.js → index.2124a98a.js} +11 -11
- package/components/CommonActions/components/ActionIntro/{index.56a0dcf9.js → index.3f75a205.js} +1 -1
- package/components/CommonActions/components/Actions/{index.06b651ab.js → index.6eb24c0b.js} +9 -9
- package/components/DataGrid/{index.b06e687e.js → index.58f35158.js} +12 -12
- package/components/DynamicFilter/classes/index.d.ts +1 -1
- package/components/DynamicFilter/classes/types.d.ts +7 -2
- package/components/DynamicFilter/constants.d.ts +1 -1
- package/components/DynamicFilter/contexts/DynamicFilterContext/store.d.ts +22 -5
- package/components/DynamicFilter/dictionary.d.ts +0 -2
- package/components/DynamicFilter/{index.ceabc6b6.js → index.10f901c6.js} +137 -126
- package/components/DynamicFilter/subcomponents/ApplyedFilters/index.d.ts +5 -0
- package/components/DynamicFilter/subcomponents/ClearFilters/index.d.ts +1 -1
- package/components/DynamicFilter/types.d.ts +16 -2
- package/components/ModalDialog/{index.99cde79e.js → index.dc7ebe06.js} +2 -2
- package/components/ObjectLogs/{index.db704dfe.js → index.38c2ad18.js} +12 -12
- package/components/Period/dictionary.d.ts +6 -5
- package/components/Period/{index.0ffcbec1.js → index.796b3af4.js} +22 -16
- package/components/ScrollBar/{index.35ebe9a1.js → index.b77feabd.js} +8 -5
- package/components/areas/components/AreasAdmin/{index.1a331d66.js → index.645bd2c7.js} +1 -1
- package/components/areas/components/AreasContainer/{index.ff33521a.js → index.3e74c849.js} +2 -2
- package/components/areas/components/GridLayout/{index.c6c8e0d5.js → index.50810712.js} +4 -4
- package/components/areas/components/Window/{index.735d6080.js → index.8040dbe4.js} +21 -21
- package/components/areas/components/WindowPopUp/{index.037ecadd.js → index.4514046e.js} +22 -22
- package/components/areas/components/{index.37fd13b9.js → index.9f62ca8e.js} +7 -7
- package/components/areas/contexts/AreaContext/{index.b67ffbb9.js → index.368adb8d.js} +4 -2
- package/components/areas/contexts/AreasContext/{index.5e4e0c5d.js → index.f3d6e728.js} +1 -1
- package/components/areas/contexts/{index.065f1714.js → index.3623b460.js} +1 -1
- package/components/areas/hooks/{index.75b5ba77.js → index.18982960.js} +1 -1
- package/components/areas/hooks/useArea/{index.59bd8d21.js → index.dab7ce20.js} +2 -2
- package/components/areas/{index.de327843.js → index.a0456f95.js} +5 -5
- package/components/formatters/PeriodFormatter/dictionary.d.ts +16 -7
- package/components/formatters/{index.12ac825b.js → index.acd3dcea.js} +20 -18
- package/components/hook-form/RHFAutocomplete/{index.89e7963b.js → index.bb6cb5df.js} +1 -1
- package/components/hook-form/RHFAutocompleteAsync/{index.89cba5be.js → index.815949a9.js} +1 -1
- package/components/hook-form/RHFPeriod/{index.60c2cc90.js → index.c4944f9c.js} +1 -1
- package/components/hook-form/RHFTextField/{index.b172f4a8.js → index.d3544fa3.js} +1 -1
- package/components/modal/{WindowBase.d1e40422.js → WindowBase.7828e042.js} +1 -1
- package/components/modal/WindowConfirm/dictionary.d.ts +6 -0
- package/components/modal/{WindowConfirm.897eb532.js → WindowConfirm.42ec4dcd.js} +18 -12
- package/components/modal/{index.342c37d1.js → index.3cc54b93.js} +10 -10
- package/contexts/ModalContext/{index.f215bf0b.js → index.b4114066.js} +1 -1
- package/hooks/useModal/{index.e338782f.js → index.77b3415c.js} +1 -1
- package/index.js +36 -37
- package/package.json +1 -2
- package/{vendor.925c029e.js → vendor.29969396.js} +25 -25
|
@@ -1,37 +1,37 @@
|
|
|
1
1
|
import { shallow } from "zustand/shallow";
|
|
2
|
-
import { S as ScrollBar } from "../ScrollBar/index.
|
|
3
|
-
import { I as IconButton } from "../mui_extended/IconButton/index.afa201a7.js";
|
|
2
|
+
import { S as ScrollBar } from "../ScrollBar/index.b77feabd.js";
|
|
4
3
|
import { useContext, useMemo, useEffect, createContext, useRef, createElement, useState, useCallback } from "react";
|
|
4
|
+
import clsx from "clsx";
|
|
5
5
|
import { useModuleDictionary, useEnvironment, useModuleSkeleton, useFlagsPresent, CommonFlags } from "@m4l/core";
|
|
6
6
|
import { useResponsiveDesktop, useFirstRender, useFormatter } from "@m4l/graphics";
|
|
7
|
-
import
|
|
8
|
-
import { T as TEST_PROP_ID } from "../../vendor.
|
|
7
|
+
import { I as IconButton } from "../mui_extended/IconButton/index.afa201a7.js";
|
|
8
|
+
import { T as TEST_PROP_ID } from "../../vendor.29969396.js";
|
|
9
9
|
import { jsxs, jsx, Fragment } from "react/jsx-runtime";
|
|
10
10
|
import { generateUtilityClasses, alpha, styled as styled$1, Skeleton, MenuItem } from "@mui/material";
|
|
11
11
|
import { L as LabelMemuItem } from "../mui_extended/MenuActions/index.1affe51a.js";
|
|
12
12
|
import { P as Popover } from "../mui_extended/Popover/index.8ed52492.js";
|
|
13
13
|
import { I as Icon } from "../Icon/index.b29ff2d9.js";
|
|
14
14
|
import { R as RHFormProvider } from "../../contexts/RHFormContext/index.3dc6e2f5.js";
|
|
15
|
-
import { g as getCommonActionsDictionary, A as Actions } from "../CommonActions/components/Actions/index.
|
|
15
|
+
import { g as getCommonActionsDictionary, A as Actions } from "../CommonActions/components/Actions/index.6eb24c0b.js";
|
|
16
16
|
import { A as ActionCancel } from "../CommonActions/components/ActionCancel/index.a81752ef.js";
|
|
17
|
-
import { A as ActionIntro } from "../CommonActions/components/ActionIntro/index.
|
|
17
|
+
import { A as ActionIntro } from "../CommonActions/components/ActionIntro/index.3f75a205.js";
|
|
18
18
|
import { useFormContext, useWatch } from "react-hook-form";
|
|
19
19
|
import "@mui/material/Button";
|
|
20
20
|
import "../mui_extended/Button/index.8406ed5b.js";
|
|
21
|
-
import "../../contexts/ModalContext/index.
|
|
21
|
+
import "../../contexts/ModalContext/index.b4114066.js";
|
|
22
22
|
import "../../react-draggable.6471b07e.js";
|
|
23
|
-
import "../ModalDialog/index.
|
|
23
|
+
import "../ModalDialog/index.dc7ebe06.js";
|
|
24
24
|
import "../Resizeable/index.04fa8de5.js";
|
|
25
|
-
import "../modal/WindowConfirm.
|
|
26
|
-
import "../modal/WindowBase.
|
|
27
|
-
import "../areas/components/index.
|
|
28
|
-
import "../areas/components/AreasAdmin/index.
|
|
25
|
+
import "../modal/WindowConfirm.42ec4dcd.js";
|
|
26
|
+
import "../modal/WindowBase.7828e042.js";
|
|
27
|
+
import "../areas/components/index.9f62ca8e.js";
|
|
28
|
+
import "../areas/components/AreasAdmin/index.645bd2c7.js";
|
|
29
29
|
import { useStore, createStore } from "zustand";
|
|
30
|
-
import "../areas/contexts/AreasContext/index.
|
|
31
|
-
import "../areas/components/AreasContainer/index.
|
|
30
|
+
import "../areas/contexts/AreasContext/index.f3d6e728.js";
|
|
31
|
+
import "../areas/components/AreasContainer/index.3e74c849.js";
|
|
32
32
|
import "react-grid-layout/css/styles.css";
|
|
33
33
|
import "../../react-resizable.b620abed.js";
|
|
34
|
-
import "../areas/contexts/index.
|
|
34
|
+
import "../areas/contexts/index.3623b460.js";
|
|
35
35
|
import "../areas/contexts/DynamicMFParmsContext/index.c19cb8cc.js";
|
|
36
36
|
import "@mui/lab";
|
|
37
37
|
import "../mui_extended/Accordion/index.725a10af.js";
|
|
@@ -45,16 +45,16 @@ import { unstable_composeClasses } from "@mui/base";
|
|
|
45
45
|
import { g as getComponentUtilityClass, i as isValidDate } from "../../utils/index.b6ae791a.js";
|
|
46
46
|
import { devtools } from "zustand/middleware";
|
|
47
47
|
import { immer } from "zustand/middleware/immer";
|
|
48
|
-
import { R as RHFAutocomplete } from "../hook-form/RHFAutocomplete/index.
|
|
48
|
+
import { R as RHFAutocomplete } from "../hook-form/RHFAutocomplete/index.bb6cb5df.js";
|
|
49
49
|
import "lodash/debounce";
|
|
50
50
|
import "../hook-form/RHFCheckbox/index.6e80f572.js";
|
|
51
51
|
import { styled, alpha as alpha$1 } from "@mui/material/styles";
|
|
52
52
|
import "../ErrorLabel/index.e140421c.js";
|
|
53
53
|
import "@mui/x-date-pickers";
|
|
54
54
|
import { R as RHFDateTime } from "../hook-form/RHFDateTime/index.6c129ce4.js";
|
|
55
|
-
import { R as RHFTextField } from "../hook-form/RHFTextField/index.
|
|
56
|
-
import "../hook-form/RHFPeriod/index.
|
|
57
|
-
import "../Period/index.
|
|
55
|
+
import { R as RHFTextField } from "../hook-form/RHFTextField/index.d3544fa3.js";
|
|
56
|
+
import "../hook-form/RHFPeriod/index.c4944f9c.js";
|
|
57
|
+
import "../Period/index.796b3af4.js";
|
|
58
58
|
import "lodash/isString";
|
|
59
59
|
import "react-dropzone";
|
|
60
60
|
import "../hook-form/RHFUpload/index.7fdff30f.js";
|
|
@@ -88,39 +88,46 @@ const DATE_TIME_OPERATORS = [
|
|
|
88
88
|
];
|
|
89
89
|
const dynamicFilterClasses = generateUtilityClasses(COMPONENT_CLASS_NAME, [
|
|
90
90
|
"root",
|
|
91
|
+
"filterButton",
|
|
91
92
|
"containerFistRow",
|
|
92
93
|
"containerInputFilter",
|
|
93
|
-
"filterButton",
|
|
94
94
|
"wrapperApplyedFilters",
|
|
95
95
|
"containerApplyedFilters",
|
|
96
96
|
"applyedFilter",
|
|
97
|
-
"
|
|
97
|
+
"clearFiltersButton",
|
|
98
|
+
"popoverMenuFields",
|
|
99
|
+
"popoverMenuFieldsPaper",
|
|
98
100
|
"popoverMenuFieldsItem",
|
|
101
|
+
"popoverFilter",
|
|
99
102
|
"popoverFilterPaper",
|
|
100
103
|
"popoverFilterHeader",
|
|
101
104
|
"containerBooleanFilter",
|
|
102
105
|
"containerDateTimeFilter",
|
|
103
106
|
"containerNumberFilter",
|
|
104
107
|
"containerStringFilter",
|
|
108
|
+
"isSkeleton",
|
|
105
109
|
"isMobile",
|
|
106
110
|
"inEdition",
|
|
107
111
|
"isDirty",
|
|
108
|
-
"
|
|
112
|
+
"isInvalid",
|
|
113
|
+
"noSetted"
|
|
109
114
|
]);
|
|
110
115
|
const useUtilityClasses = (ownerState) => {
|
|
111
116
|
const slots = {
|
|
112
|
-
root: ["root", ownerState.inEdition && "inEdition", ownerState.isDirty && "isDirty", ownerState.isValid && "
|
|
113
|
-
filterButton: ["filterButton"
|
|
117
|
+
root: ["root", ownerState.inEdition && "inEdition", ownerState.isDirty && "isDirty", !ownerState.isValid && "isInvalid", ownerState.isMobile && "isMobile", ownerState.isSkeleton && "isSkeleton"],
|
|
118
|
+
filterButton: ["filterButton"],
|
|
114
119
|
containerFistRow: ["containerFistRow"],
|
|
115
120
|
containerInputFilter: ["containerInputFilter"],
|
|
116
121
|
wrapperApplyedFilters: ["wrapperApplyedFilters"],
|
|
117
122
|
containerApplyedFilters: ["containerApplyedFilters"],
|
|
118
123
|
applyedFilter: ["applyedFilter"],
|
|
119
|
-
|
|
124
|
+
clearFiltersButton: ["clearFiltersButton"],
|
|
125
|
+
popoverMenuFields: ["popoverMenuFields"],
|
|
126
|
+
popoverMenuFieldsPaper: ["popoverMenuFieldsPaper"],
|
|
120
127
|
popoverMenuFieldsItem: ["popoverMenuFieldsItem"],
|
|
128
|
+
popoverFilter: ["popoverFilter"],
|
|
121
129
|
popoverFilterPaper: ["popoverFilterPaper"],
|
|
122
130
|
popoverFilterHeader: ["popoverFilterHeader"],
|
|
123
|
-
clearFilters: ["clearFilters"],
|
|
124
131
|
containerBooleanFilter: ["containerBooleanFilter"],
|
|
125
132
|
containerDateTimeFilter: ["containerDateTimeFilter"],
|
|
126
133
|
containerNumberFilter: ["containerNumberFilter"],
|
|
@@ -157,28 +164,6 @@ const DYNAMICFILTER_DICTIONARY_ID = "dynamic_filter";
|
|
|
157
164
|
function getDynamicFilterComponentsDictionary() {
|
|
158
165
|
return [DYNAMICFILTER_DICTIONARY_ID].concat(getCommonActionsDictionary());
|
|
159
166
|
}
|
|
160
|
-
const defaultDynamicFilterDictionary = {
|
|
161
|
-
dynamic_filter: {
|
|
162
|
-
filter_tooltip: "Search",
|
|
163
|
-
operator_b: "between",
|
|
164
|
-
operator_e: "=",
|
|
165
|
-
operator_ne: "!=",
|
|
166
|
-
operator_gt: ">",
|
|
167
|
-
operator_gte: ">=",
|
|
168
|
-
operator_lt: "<",
|
|
169
|
-
operator_lte: "<=",
|
|
170
|
-
operator_c: "contains",
|
|
171
|
-
operator_nc: "not contains",
|
|
172
|
-
all_fields: "all_fields",
|
|
173
|
-
operand_true: "true",
|
|
174
|
-
operand_false: "false",
|
|
175
|
-
error_operator_required: "Operator required",
|
|
176
|
-
error_operand_required: "Operand required",
|
|
177
|
-
error_invalid_date: "Invalid date",
|
|
178
|
-
error_operand_mustbe_number: "Invalid number",
|
|
179
|
-
error_filters_no_setted: "Filters not yet set"
|
|
180
|
-
}
|
|
181
|
-
};
|
|
182
167
|
const LABEL_FILTER_BUTTON = "filter_tooltip";
|
|
183
168
|
const DICCTIONARY = {
|
|
184
169
|
input_placeholder: "input_placeholder",
|
|
@@ -385,11 +370,13 @@ const getDefaultBooleanFilter = (field, fixed) => {
|
|
|
385
370
|
};
|
|
386
371
|
const getBooleanLabels = (filter, getLabel) => {
|
|
387
372
|
const labelOperands = filter.operand1 ? getLabel(getDynamicFilterDictionary("operand_true")) : getLabel(getDynamicFilterDictionary("operand_false"));
|
|
388
|
-
|
|
389
|
-
labelField: getLabel(filter.field.dictionaryId),
|
|
373
|
+
const ret = {
|
|
374
|
+
labelField: filter.field.label ?? getLabel(filter.field.dictionaryId),
|
|
390
375
|
labelOperator: getLabel(getDynamicFilterDictionary(`operator_${filter.operator}`)),
|
|
391
376
|
labelOperands
|
|
392
377
|
};
|
|
378
|
+
console.log("getBooleanLabels", ret, filter.field.dictionaryId);
|
|
379
|
+
return ret;
|
|
393
380
|
};
|
|
394
381
|
const getBooleanSchema = (getLabel) => Yup.object({
|
|
395
382
|
formValueOperator: Yup.object().nullable().required(getLabel(`error_operator_required`)),
|
|
@@ -440,7 +427,7 @@ const getDefaultStringFilter = (field, fixed) => {
|
|
|
440
427
|
const getStringLabels = (filter, getLabel) => {
|
|
441
428
|
const labelOperands = filter.operand1 !== void 0 ? filter.operand1 + "" : "";
|
|
442
429
|
return {
|
|
443
|
-
labelField: getLabel(filter.field.dictionaryId),
|
|
430
|
+
labelField: filter.field.label ?? getLabel(filter.field.dictionaryId),
|
|
444
431
|
labelOperator: getLabel(getDynamicFilterDictionary(`operator_${filter.operator}`)),
|
|
445
432
|
labelOperands
|
|
446
433
|
};
|
|
@@ -505,7 +492,7 @@ const getDateLabels = (filter, getLabel, formatters) => {
|
|
|
505
492
|
labelOperands = filter.operand1 ? dateFormatter.formatDate(filter.operand1, dateFormatter.datetimeFormat) : "";
|
|
506
493
|
}
|
|
507
494
|
return {
|
|
508
|
-
labelField: getLabel(filter.field.dictionaryId),
|
|
495
|
+
labelField: filter.field.label ?? getLabel(filter.field.dictionaryId),
|
|
509
496
|
labelOperator: getLabel(getDynamicFilterDictionary(`operator_${filter.operator}`)),
|
|
510
497
|
labelOperands
|
|
511
498
|
};
|
|
@@ -584,7 +571,7 @@ const getNumberLabels = (filter, getLabel) => {
|
|
|
584
571
|
labelOperands = filter.operand1 !== void 0 ? filter.operand1 + "" : "";
|
|
585
572
|
}
|
|
586
573
|
return {
|
|
587
|
-
labelField: getLabel(filter.field.dictionaryId),
|
|
574
|
+
labelField: filter.field.label ?? getLabel(filter.field.dictionaryId),
|
|
588
575
|
labelOperator: getLabel(getDynamicFilterDictionary(`operator_${filter.operator}`)),
|
|
589
576
|
labelOperands
|
|
590
577
|
};
|
|
@@ -917,16 +904,14 @@ const updateAutomatic = (state) => {
|
|
|
917
904
|
if (state.ownerState.isValid) {
|
|
918
905
|
if (state.automatic) {
|
|
919
906
|
state.ownerState.isDirty = false;
|
|
920
|
-
state.
|
|
921
|
-
formatToInitialFilters(state.applyedFilters),
|
|
922
|
-
formatToRawFilter(state.applyedFilters)
|
|
923
|
-
);
|
|
907
|
+
state.countOnChangeFiltersApplyed++;
|
|
924
908
|
}
|
|
925
909
|
}
|
|
926
910
|
updateOwnerStateClasses(state);
|
|
927
911
|
};
|
|
928
912
|
const createAreaStore = (initProps) => {
|
|
929
913
|
const startProps = {
|
|
914
|
+
countOnChangeFiltersApplyed: 0,
|
|
930
915
|
applyedFilters: [],
|
|
931
916
|
availableFields: [],
|
|
932
917
|
fnAnchorEl: void 0,
|
|
@@ -947,7 +932,7 @@ const createAreaStore = (initProps) => {
|
|
|
947
932
|
initialFiltersApplyed,
|
|
948
933
|
state.actions.getFieldByName
|
|
949
934
|
);
|
|
950
|
-
|
|
935
|
+
updateAutomatic(state);
|
|
951
936
|
});
|
|
952
937
|
},
|
|
953
938
|
getFieldByName: (name) => {
|
|
@@ -1008,10 +993,7 @@ const createAreaStore = (initProps) => {
|
|
|
1008
993
|
set((state) => {
|
|
1009
994
|
if (state.ownerState.isValid) {
|
|
1010
995
|
state.ownerState.isDirty = false;
|
|
1011
|
-
state.
|
|
1012
|
-
formatToInitialFilters(state.applyedFilters),
|
|
1013
|
-
formatToRawFilter(state.applyedFilters)
|
|
1014
|
-
);
|
|
996
|
+
state.countOnChangeFiltersApplyed++;
|
|
1015
997
|
updateOwnerStateClasses(state);
|
|
1016
998
|
}
|
|
1017
999
|
});
|
|
@@ -1049,9 +1031,9 @@ const createAreaStore = (initProps) => {
|
|
|
1049
1031
|
updateOwnerStateClasses(state);
|
|
1050
1032
|
});
|
|
1051
1033
|
},
|
|
1052
|
-
|
|
1034
|
+
setExternalState: (newExternalState) => {
|
|
1053
1035
|
set((state) => {
|
|
1054
|
-
state.ownerState
|
|
1036
|
+
state.ownerState = { ...state.ownerState, ...newExternalState };
|
|
1055
1037
|
updateOwnerStateClasses(state);
|
|
1056
1038
|
});
|
|
1057
1039
|
},
|
|
@@ -1092,7 +1074,8 @@ function DynamicFilterProvider(props) {
|
|
|
1092
1074
|
environment_assets
|
|
1093
1075
|
} = useEnvironment();
|
|
1094
1076
|
const isDesktop = useResponsiveDesktop();
|
|
1095
|
-
const
|
|
1077
|
+
const isSkeleton = useModuleSkeleton();
|
|
1078
|
+
const isFirstRender = useFirstRender([isDesktop, isSkeleton]);
|
|
1096
1079
|
if (!dynamicFilterStoreRef.current) {
|
|
1097
1080
|
dynamicFilterStoreRef.current = createAreaStore({
|
|
1098
1081
|
allField: {
|
|
@@ -1102,9 +1085,9 @@ function DynamicFilterProvider(props) {
|
|
|
1102
1085
|
withAllField,
|
|
1103
1086
|
fields,
|
|
1104
1087
|
automatic,
|
|
1105
|
-
onChangeFilters,
|
|
1106
1088
|
getLabel,
|
|
1107
1089
|
ownerState: {
|
|
1090
|
+
isSkeleton,
|
|
1108
1091
|
isDirty: !automatic,
|
|
1109
1092
|
inEdition: false,
|
|
1110
1093
|
isValid: true,
|
|
@@ -1113,12 +1096,29 @@ function DynamicFilterProvider(props) {
|
|
|
1113
1096
|
});
|
|
1114
1097
|
dynamicFilterStoreRef.current.getState().actions.init(initialApplyedFilters);
|
|
1115
1098
|
}
|
|
1099
|
+
const countOnChangeFiltersApplyed = useStore(dynamicFilterStoreRef.current, (state) => state.countOnChangeFiltersApplyed, shallow);
|
|
1100
|
+
useEffect(() => {
|
|
1101
|
+
if (countOnChangeFiltersApplyed === 0) {
|
|
1102
|
+
return;
|
|
1103
|
+
}
|
|
1104
|
+
const state = dynamicFilterStoreRef.current?.getState();
|
|
1105
|
+
if (state) {
|
|
1106
|
+
dynamicFilterStoreRef.current?.getState().actions.setExternalState({
|
|
1107
|
+
isMobile: !isDesktop,
|
|
1108
|
+
isSkeleton
|
|
1109
|
+
});
|
|
1110
|
+
onChangeFilters(formatToInitialFilters(state.applyedFilters), formatToRawFilter(state.applyedFilters));
|
|
1111
|
+
}
|
|
1112
|
+
}, [countOnChangeFiltersApplyed]);
|
|
1116
1113
|
useEffect(() => {
|
|
1117
1114
|
if (isFirstRender) {
|
|
1118
1115
|
return;
|
|
1119
1116
|
}
|
|
1120
|
-
dynamicFilterStoreRef.current?.getState().actions.
|
|
1121
|
-
|
|
1117
|
+
dynamicFilterStoreRef.current?.getState().actions.setExternalState({
|
|
1118
|
+
isMobile: !isDesktop,
|
|
1119
|
+
isSkeleton
|
|
1120
|
+
});
|
|
1121
|
+
}, [isDesktop, isSkeleton]);
|
|
1122
1122
|
useEffect(() => {
|
|
1123
1123
|
if (automatic) {
|
|
1124
1124
|
dynamicFilterStoreRef.current?.getState().actions.fireOnChangeFilters();
|
|
@@ -1173,8 +1173,11 @@ const DynamicFilterRoot = styled("div", {})(({
|
|
|
1173
1173
|
}
|
|
1174
1174
|
}
|
|
1175
1175
|
},
|
|
1176
|
-
[`&.${dynamicFilterClasses.
|
|
1177
|
-
border: `1px
|
|
1176
|
+
[`&.${dynamicFilterClasses.isInvalid} .${dynamicFilterClasses.filterButton}`]: {
|
|
1177
|
+
border: `1px dashed ${theme.palette.error.main}`
|
|
1178
|
+
},
|
|
1179
|
+
[`& .${dynamicFilterClasses.applyedFilter}.${dynamicFilterClasses.noSetted}`]: {
|
|
1180
|
+
border: `1px dashed ${theme.palette.error.main}`
|
|
1178
1181
|
},
|
|
1179
1182
|
...theme.components?.M4LDynamicFilter?.styleOverrides
|
|
1180
1183
|
}));
|
|
@@ -1183,24 +1186,6 @@ const ContainerFistRow = styled("div")(() => ({
|
|
|
1183
1186
|
display: "flex",
|
|
1184
1187
|
justifyContent: "space-between"
|
|
1185
1188
|
}));
|
|
1186
|
-
const WrapperApplyedFilters = styled("div")(({
|
|
1187
|
-
theme
|
|
1188
|
-
}) => ({
|
|
1189
|
-
width: "100%",
|
|
1190
|
-
margin: theme.spacing(0, 1),
|
|
1191
|
-
paddingLeft: theme.spacing(1),
|
|
1192
|
-
borderLeft: `1px solid ${theme.palette.divider}`
|
|
1193
|
-
}));
|
|
1194
|
-
const ContainerApplyedFilters = styled("div")(({
|
|
1195
|
-
theme
|
|
1196
|
-
}) => ({
|
|
1197
|
-
width: "100%",
|
|
1198
|
-
display: "flex",
|
|
1199
|
-
justifyContent: "flex-start",
|
|
1200
|
-
alignItems: "center",
|
|
1201
|
-
height: "auto",
|
|
1202
|
-
gap: theme.spacing(1.5)
|
|
1203
|
-
}));
|
|
1204
1189
|
const WrapperApplyedFilter = styled("div")(({
|
|
1205
1190
|
theme
|
|
1206
1191
|
}) => ({
|
|
@@ -1271,7 +1256,7 @@ function ApplyedFilter(props) {
|
|
|
1271
1256
|
} = useDynamicFilter((state) => state.actions);
|
|
1272
1257
|
const labels = useMemo(() => {
|
|
1273
1258
|
return getLabelsFilter(props, getLabel, formatters);
|
|
1274
|
-
}, [props]);
|
|
1259
|
+
}, [props, getLabel]);
|
|
1275
1260
|
const urlIcon = useMemo(() => {
|
|
1276
1261
|
return field.urlIcon;
|
|
1277
1262
|
}, [field]);
|
|
@@ -1285,7 +1270,7 @@ function ApplyedFilter(props) {
|
|
|
1285
1270
|
setTimeout(() => showPopupForEdit(currentTarget, props), 10);
|
|
1286
1271
|
};
|
|
1287
1272
|
return /* @__PURE__ */ jsxs(WrapperApplyedFilter, {
|
|
1288
|
-
className: clsx(classesApplyedFilter, !isSetted ?
|
|
1273
|
+
className: clsx(classesApplyedFilter, !isSetted ? `${COMPONENT_CLASS_NAME}-noSetted` : null),
|
|
1289
1274
|
...process.env.NODE_ENV !== "production" ? {
|
|
1290
1275
|
[TEST_PROP_ID]: getTestIdByClass("applyedFilter", field.name)
|
|
1291
1276
|
} : {},
|
|
@@ -1309,11 +1294,29 @@ function ApplyedFilter(props) {
|
|
|
1309
1294
|
})]
|
|
1310
1295
|
});
|
|
1311
1296
|
}
|
|
1297
|
+
const WrapperApplyedFilters = styled("div")(({
|
|
1298
|
+
theme
|
|
1299
|
+
}) => ({
|
|
1300
|
+
width: "100%",
|
|
1301
|
+
margin: theme.spacing(0, 1),
|
|
1302
|
+
paddingLeft: theme.spacing(1),
|
|
1303
|
+
borderLeft: `1px solid ${theme.palette.divider}`
|
|
1304
|
+
}));
|
|
1305
|
+
const ContainerApplyedFilters = styled("div")(({
|
|
1306
|
+
theme
|
|
1307
|
+
}) => ({
|
|
1308
|
+
width: "100%",
|
|
1309
|
+
display: "flex",
|
|
1310
|
+
justifyContent: "flex-start",
|
|
1311
|
+
alignItems: "center",
|
|
1312
|
+
height: "auto",
|
|
1313
|
+
gap: theme.spacing(1.5)
|
|
1314
|
+
}));
|
|
1312
1315
|
function ApplyedFilters() {
|
|
1313
1316
|
const classesWrapperApplyedFilters = useDynamicFilter((state) => state.classes.wrapperApplyedFilters, shallow);
|
|
1314
1317
|
const classesContainerApplyedFilters = useDynamicFilter((state) => state.classes.containerApplyedFilters, shallow);
|
|
1315
1318
|
const applyedFilters = useDynamicFilter((state) => state.applyedFilters, shallow);
|
|
1316
|
-
const isSkeleton =
|
|
1319
|
+
const isSkeleton = useDynamicFilter((state) => state.ownerState.isSkeleton, shallow);
|
|
1317
1320
|
if (isSkeleton) {
|
|
1318
1321
|
return /* @__PURE__ */ jsx(WrapperApplyedFilters, {
|
|
1319
1322
|
className: classesWrapperApplyedFilters
|
|
@@ -1346,26 +1349,27 @@ const SKTClearFilters = styled$1("div")(({
|
|
|
1346
1349
|
minWidth: theme.spacing(3.75),
|
|
1347
1350
|
height: theme.spacing(3.75)
|
|
1348
1351
|
}));
|
|
1349
|
-
|
|
1352
|
+
styled$1("div")(({
|
|
1350
1353
|
theme
|
|
1351
1354
|
}) => ({
|
|
1352
1355
|
paddingLeft: theme.spacing(0.5),
|
|
1353
1356
|
borderLeft: `1px solid ${theme.palette.divider}`
|
|
1354
1357
|
}));
|
|
1355
|
-
const
|
|
1358
|
+
const ClearFiltersButton = () => {
|
|
1356
1359
|
const {
|
|
1357
1360
|
host_static_assets,
|
|
1358
1361
|
environment_assets
|
|
1359
1362
|
} = useEnvironment();
|
|
1360
|
-
const isSkeleton = useModuleSkeleton();
|
|
1361
1363
|
const {
|
|
1362
1364
|
clearFilters,
|
|
1363
1365
|
hidePopoverFilter: hidePopupEdit
|
|
1364
1366
|
} = useDynamicFilter((state) => state.actions);
|
|
1365
1367
|
const applyedFilters = useDynamicFilter((state) => state.applyedFilters, shallow);
|
|
1366
|
-
const
|
|
1368
|
+
const clearFiltersButtonClasses = useDynamicFilter((state) => state.classes.clearFiltersButton, shallow);
|
|
1369
|
+
const isSkeleton = useDynamicFilter((state) => state.ownerState.isSkeleton);
|
|
1367
1370
|
if (isSkeleton) {
|
|
1368
1371
|
return /* @__PURE__ */ jsx(SKTClearFilters, {
|
|
1372
|
+
className: clearFiltersButtonClasses,
|
|
1369
1373
|
children: /* @__PURE__ */ jsx(Skeleton, {
|
|
1370
1374
|
variant: "circular",
|
|
1371
1375
|
width: "20px",
|
|
@@ -1378,13 +1382,11 @@ const ClearFilters = () => {
|
|
|
1378
1382
|
clearFilters();
|
|
1379
1383
|
};
|
|
1380
1384
|
if (applyedFilters.findIndex((f) => f.fixed == false) > -1) {
|
|
1381
|
-
return /* @__PURE__ */ jsx(
|
|
1382
|
-
className:
|
|
1383
|
-
|
|
1384
|
-
|
|
1385
|
-
|
|
1386
|
-
dictionaryTooltip: "dynamic_filter.tooltip_clear_filters"
|
|
1387
|
-
})
|
|
1385
|
+
return /* @__PURE__ */ jsx(IconButton, {
|
|
1386
|
+
className: clearFiltersButtonClasses,
|
|
1387
|
+
src: `${host_static_assets}/${environment_assets}/frontend/components/dynamic_filter/assets/icons/clear.svg`,
|
|
1388
|
+
onClick: onClickClearFilters,
|
|
1389
|
+
dictionaryTooltip: "dynamic_filter.tooltip_clear_filters"
|
|
1388
1390
|
});
|
|
1389
1391
|
}
|
|
1390
1392
|
return null;
|
|
@@ -1406,17 +1408,18 @@ function FilterButton() {
|
|
|
1406
1408
|
const automatic = useDynamicFilter((state) => state.automatic);
|
|
1407
1409
|
const isValid = useDynamicFilter((state) => state.ownerState.isValid);
|
|
1408
1410
|
const isDirty = useDynamicFilter((state) => state.ownerState.isDirty);
|
|
1411
|
+
const isSkeleton = useDynamicFilter((state) => state.ownerState.isSkeleton);
|
|
1409
1412
|
const {
|
|
1410
1413
|
fireOnChangeFilters
|
|
1411
1414
|
} = useDynamicFilter((state) => state.actions);
|
|
1412
1415
|
const classesFilterButton = useDynamicFilter((state) => state.classes.filterButton);
|
|
1413
|
-
const isSkeleton = useModuleSkeleton();
|
|
1414
1416
|
const {
|
|
1415
1417
|
host_static_assets,
|
|
1416
1418
|
environment_assets
|
|
1417
1419
|
} = useEnvironment();
|
|
1418
1420
|
if (isSkeleton) {
|
|
1419
1421
|
return /* @__PURE__ */ jsx(SKTWrapperFilterButton, {
|
|
1422
|
+
className: classesFilterButton,
|
|
1420
1423
|
children: /* @__PURE__ */ jsx(Skeleton, {
|
|
1421
1424
|
variant: "circular",
|
|
1422
1425
|
width: 20,
|
|
@@ -1439,12 +1442,16 @@ function PopoverMenuFields(props) {
|
|
|
1439
1442
|
fields
|
|
1440
1443
|
} = props;
|
|
1441
1444
|
const fnAnchorEl = useDynamicFilter((state) => state.fnAnchorEl, shallow);
|
|
1442
|
-
const classesPopUpMenuFields = useDynamicFilter((state) => state.classes.
|
|
1445
|
+
const classesPopUpMenuFields = useDynamicFilter((state) => state.classes.popoverMenuFields, shallow);
|
|
1446
|
+
const classesPopUpMenuFieldsPaper = useDynamicFilter((state) => state.classes.popoverMenuFieldsPaper, shallow);
|
|
1443
1447
|
const classespopoverMenuFieldsItem = useDynamicFilter((state) => state.classes.popoverMenuFieldsItem, shallow);
|
|
1444
1448
|
const {
|
|
1445
1449
|
showPopoverFilterForAdd,
|
|
1446
1450
|
closePopoverMenuFields
|
|
1447
1451
|
} = useDynamicFilter((state) => state.actions, shallow);
|
|
1452
|
+
const {
|
|
1453
|
+
getLabel
|
|
1454
|
+
} = useModuleDictionary();
|
|
1448
1455
|
const handleClosePopover = () => {
|
|
1449
1456
|
closePopoverMenuFields(false);
|
|
1450
1457
|
};
|
|
@@ -1454,11 +1461,8 @@ function PopoverMenuFields(props) {
|
|
|
1454
1461
|
}
|
|
1455
1462
|
};
|
|
1456
1463
|
return /* @__PURE__ */ jsx(Popover, {
|
|
1457
|
-
...process.env.NODE_ENV !== "production" ? {
|
|
1458
|
-
[TEST_PROP_ID]: getTestIdByClass("popUpMenuFields")
|
|
1459
|
-
} : {},
|
|
1460
|
-
disableRestoreFocus: true,
|
|
1461
1464
|
className: classesPopUpMenuFields,
|
|
1465
|
+
disableRestoreFocus: true,
|
|
1462
1466
|
open: Boolean(fnAnchorEl),
|
|
1463
1467
|
anchorEl: fnAnchorEl && fnAnchorEl(),
|
|
1464
1468
|
onClose: handleClosePopover,
|
|
@@ -1480,23 +1484,29 @@ function PopoverMenuFields(props) {
|
|
|
1480
1484
|
},
|
|
1481
1485
|
mt: "16px"
|
|
1482
1486
|
},
|
|
1487
|
+
PaperProps: {
|
|
1488
|
+
className: classesPopUpMenuFieldsPaper,
|
|
1489
|
+
...process.env.NODE_ENV !== "production" ? {
|
|
1490
|
+
[TEST_PROP_ID]: getTestIdByClass("popoverMenuFieldsPaper")
|
|
1491
|
+
} : {}
|
|
1492
|
+
},
|
|
1483
1493
|
children: Boolean(fnAnchorEl) && fields.map((field, index) => /* @__PURE__ */ createElement(MenuItem, {
|
|
1484
1494
|
...process.env.NODE_ENV !== "production" ? {
|
|
1485
1495
|
[TEST_PROP_ID]: getTestIdByClass("popoverMenuFieldsItem", field.name)
|
|
1486
1496
|
} : {},
|
|
1487
1497
|
className: classespopoverMenuFieldsItem,
|
|
1488
|
-
key: `menu_action_${
|
|
1498
|
+
key: `menu_action_${field.label ?? getLabel(field.dictionaryId)}`,
|
|
1489
1499
|
dense: true,
|
|
1490
1500
|
onClick: (event) => handleOpenPopUpClickItem(event, field),
|
|
1491
1501
|
selected: index === selectFieldIndex
|
|
1492
1502
|
}, /* @__PURE__ */ jsx(Icon, {
|
|
1493
1503
|
src: field.urlIcon
|
|
1494
1504
|
}), /* @__PURE__ */ jsx(LabelMemuItem, {
|
|
1495
|
-
children: field.dictionaryId
|
|
1505
|
+
children: field.label ?? getLabel(field.dictionaryId)
|
|
1496
1506
|
})))
|
|
1497
1507
|
});
|
|
1498
1508
|
}
|
|
1499
|
-
const
|
|
1509
|
+
const ContainerInputFilter = styled("div")(({
|
|
1500
1510
|
theme
|
|
1501
1511
|
}) => ({
|
|
1502
1512
|
display: "flex",
|
|
@@ -1530,6 +1540,7 @@ function InputFilter() {
|
|
|
1530
1540
|
const inputData = useDynamicFilter((state) => state.inputData);
|
|
1531
1541
|
const availableFields = useDynamicFilter((state) => state.availableFields, shallow);
|
|
1532
1542
|
const classesContainerInputFilter = useDynamicFilter((state) => state.classes.containerInputFilter, shallow);
|
|
1543
|
+
const isSkeleton = useDynamicFilter((state) => state.ownerState.isSkeleton, shallow);
|
|
1533
1544
|
const {
|
|
1534
1545
|
showPopoverFilterForAdd,
|
|
1535
1546
|
addFilter,
|
|
@@ -1541,7 +1552,6 @@ function InputFilter() {
|
|
|
1541
1552
|
setInEdition,
|
|
1542
1553
|
setInputData
|
|
1543
1554
|
} = useDynamicFilter((state) => state.actions, shallow);
|
|
1544
|
-
const isSkeleton = useModuleSkeleton();
|
|
1545
1555
|
const {
|
|
1546
1556
|
getLabel
|
|
1547
1557
|
} = useModuleDictionary();
|
|
@@ -1552,9 +1562,9 @@ function InputFilter() {
|
|
|
1552
1562
|
setFinalFields([]);
|
|
1553
1563
|
return;
|
|
1554
1564
|
}
|
|
1555
|
-
setFinalFields(availableFields.filter((field) => field.dictionaryId.includes(inputData)));
|
|
1565
|
+
setFinalFields(availableFields.filter((field) => (field.label ?? getLabel(field.dictionaryId)).includes(inputData)));
|
|
1556
1566
|
setSelectFieldIndex(-1);
|
|
1557
|
-
}, [anchorEl, inputData, availableFields]);
|
|
1567
|
+
}, [anchorEl, inputData, availableFields, getLabel]);
|
|
1558
1568
|
const handleOpenPopUpClickItem = (field) => {
|
|
1559
1569
|
closePopoverMenuFields();
|
|
1560
1570
|
if (anchorEl)
|
|
@@ -1620,7 +1630,7 @@ function InputFilter() {
|
|
|
1620
1630
|
}
|
|
1621
1631
|
};
|
|
1622
1632
|
if (isSkeleton) {
|
|
1623
|
-
return /* @__PURE__ */ jsx(
|
|
1633
|
+
return /* @__PURE__ */ jsx(ContainerInputFilter, {
|
|
1624
1634
|
children: /* @__PURE__ */ jsx(Skeleton, {
|
|
1625
1635
|
variant: "text",
|
|
1626
1636
|
width: "100%",
|
|
@@ -1631,7 +1641,7 @@ function InputFilter() {
|
|
|
1631
1641
|
if (!withAllField && availableFields.length == 0) {
|
|
1632
1642
|
return null;
|
|
1633
1643
|
}
|
|
1634
|
-
return /* @__PURE__ */ jsxs(
|
|
1644
|
+
return /* @__PURE__ */ jsxs(ContainerInputFilter, {
|
|
1635
1645
|
className: classesContainerInputFilter,
|
|
1636
1646
|
...process.env.NODE_ENV !== "production" ? {
|
|
1637
1647
|
[TEST_PROP_ID]: getTestIdByClass("containerInputFilter")
|
|
@@ -1677,6 +1687,7 @@ const PopoverFilter = () => {
|
|
|
1677
1687
|
let anchorEl;
|
|
1678
1688
|
const popoverFilterData = useDynamicFilter((state) => state.popoverFilterData, shallow);
|
|
1679
1689
|
const refPreviousPopoverFilterData = useRef(popoverFilterData);
|
|
1690
|
+
const classesPopoverFilter = useDynamicFilter((state) => state.classes.popoverFilter, shallow);
|
|
1680
1691
|
const classesPopoverFilterPapper = useDynamicFilter((state) => state.classes.popoverFilterPaper, shallow);
|
|
1681
1692
|
const classesPopoverFilterHeader = useDynamicFilter((state) => state.classes.popoverFilterHeader, shallow);
|
|
1682
1693
|
const {
|
|
@@ -1753,6 +1764,7 @@ const PopoverFilter = () => {
|
|
|
1753
1764
|
hidePopoverFilter(false);
|
|
1754
1765
|
};
|
|
1755
1766
|
return /* @__PURE__ */ jsx(Popover, {
|
|
1767
|
+
className: classesPopoverFilter,
|
|
1756
1768
|
open: true,
|
|
1757
1769
|
anchorEl,
|
|
1758
1770
|
disableRestoreFocus: true,
|
|
@@ -1767,14 +1779,14 @@ const PopoverFilter = () => {
|
|
|
1767
1779
|
horizontal: "left"
|
|
1768
1780
|
},
|
|
1769
1781
|
arrowType: "top-left",
|
|
1770
|
-
...process.env.NODE_ENV !== "production" ? {
|
|
1771
|
-
[TEST_PROP_ID]: getTestIdByClass("popoverFilterPaper")
|
|
1772
|
-
} : {},
|
|
1773
1782
|
PaperProps: {
|
|
1774
1783
|
className: classesPopoverFilterPapper,
|
|
1775
1784
|
sx: {
|
|
1776
1785
|
mt: "12px"
|
|
1777
|
-
}
|
|
1786
|
+
},
|
|
1787
|
+
...process.env.NODE_ENV !== "production" ? {
|
|
1788
|
+
[TEST_PROP_ID]: getTestIdByClass("popoverFilterPaper")
|
|
1789
|
+
} : {}
|
|
1778
1790
|
},
|
|
1779
1791
|
children: /* @__PURE__ */ jsxs(RHFormProvider, {
|
|
1780
1792
|
onSubmit,
|
|
@@ -1786,7 +1798,7 @@ const PopoverFilter = () => {
|
|
|
1786
1798
|
children: [field.urlIcon && /* @__PURE__ */ jsx(Icon, {
|
|
1787
1799
|
src: field.urlIcon
|
|
1788
1800
|
}), /* @__PURE__ */ jsx(TitleContainer, {
|
|
1789
|
-
children: getLabel(field.dictionaryId)
|
|
1801
|
+
children: field.label ?? getLabel(field.dictionaryId)
|
|
1790
1802
|
})]
|
|
1791
1803
|
}), /* @__PURE__ */ jsx(DataTypeComponent, {
|
|
1792
1804
|
formFilter,
|
|
@@ -1805,17 +1817,17 @@ const InnerForHooks = () => {
|
|
|
1805
1817
|
const classesContainerFistRow = useDynamicFilter((state) => state.classes.containerFistRow, shallow);
|
|
1806
1818
|
const fields = useDynamicFilter((state) => state.fields, shallow);
|
|
1807
1819
|
return /* @__PURE__ */ jsx(DynamicFilterRoot, {
|
|
1808
|
-
"data-testid": "DynamicFilter",
|
|
1809
1820
|
className: classesRoot,
|
|
1810
1821
|
...process.env.NODE_ENV !== "production" ? {
|
|
1811
|
-
[TEST_PROP_FIELDS]: fields
|
|
1822
|
+
[TEST_PROP_FIELDS]: fields,
|
|
1823
|
+
"data-testid": "DynamicFilter"
|
|
1812
1824
|
} : {},
|
|
1813
1825
|
children: !isMobile ? /* @__PURE__ */ jsxs(Fragment, {
|
|
1814
|
-
children: [/* @__PURE__ */ jsx(FilterButton, {}), /* @__PURE__ */ jsx(InputFilter, {}), /* @__PURE__ */ jsx(ApplyedFilters, {}), /* @__PURE__ */ jsx(PopoverFilter, {}), /* @__PURE__ */ jsx(
|
|
1826
|
+
children: [/* @__PURE__ */ jsx(FilterButton, {}), /* @__PURE__ */ jsx(InputFilter, {}), /* @__PURE__ */ jsx(ApplyedFilters, {}), /* @__PURE__ */ jsx(PopoverFilter, {}), /* @__PURE__ */ jsx(ClearFiltersButton, {})]
|
|
1815
1827
|
}) : /* @__PURE__ */ jsxs(Fragment, {
|
|
1816
1828
|
children: [/* @__PURE__ */ jsxs(ContainerFistRow, {
|
|
1817
1829
|
className: classesContainerFistRow,
|
|
1818
|
-
children: [/* @__PURE__ */ jsx(FilterButton, {}), /* @__PURE__ */ jsx(InputFilter, {}), /* @__PURE__ */ jsx(
|
|
1830
|
+
children: [/* @__PURE__ */ jsx(FilterButton, {}), /* @__PURE__ */ jsx(InputFilter, {}), /* @__PURE__ */ jsx(ClearFiltersButton, {})]
|
|
1819
1831
|
}), /* @__PURE__ */ jsx(ApplyedFilters, {}), /* @__PURE__ */ jsx(PopoverFilter, {})]
|
|
1820
1832
|
})
|
|
1821
1833
|
});
|
|
@@ -1836,6 +1848,5 @@ export {
|
|
|
1836
1848
|
DYNAMICFILTER_DICTIONARY_ID as a,
|
|
1837
1849
|
DICCTIONARY as b,
|
|
1838
1850
|
getDynamicFilterDictionary as c,
|
|
1839
|
-
defaultDynamicFilterDictionary as d,
|
|
1840
1851
|
getDynamicFilterComponentsDictionary as g
|
|
1841
1852
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const
|
|
1
|
+
export declare const ClearFiltersButton: () => JSX.Element | null;
|