@m4l/components 3.1.7 → 3.1.8
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/index.js +183 -340
- package/node_modules-CQtkw0uG.js +7350 -0
- package/package.json +1 -1
- package/vendor-AfIOyqRr.js +24636 -0
- package/components/AccountPopover/index-Dm2-k-Mv.js +0 -334
- package/components/AppBar/index-i0rhG3J1.js +0 -93
- package/components/BaseModule/index-CiNNlxzS.js +0 -30
- package/components/CommonActions/components/ActionCancel/index-CIdpDXkr.js +0 -12
- package/components/CommonActions/components/ActionFormCancel/index-CpyASN3q.js +0 -56
- package/components/CommonActions/components/ActionFormIntro/index-7KKtcUra.js +0 -33
- package/components/CommonActions/components/ActionIntro/index-CqqDZZcG.js +0 -25
- package/components/CommonActions/components/Actions/index-CuG1pnXW.js +0 -70
- package/components/DataGrid/constants-8L7QgBKi.js +0 -10
- package/components/DataGrid/formatters/ColumnBooleanFormatter/index-CveSCbq_.js +0 -26
- package/components/DataGrid/formatters/ColumnConcatenatedValueFormatter/index-CHqvieM2.js +0 -22
- package/components/DataGrid/formatters/ColumnDateFormatter/index-CKg8CJ6A.js +0 -19
- package/components/DataGrid/formatters/ColumnInteractiveCheckFormatter/index-DE6bwaKP.js +0 -23
- package/components/DataGrid/formatters/ColumnNestedValueFormatter/index-BslXGK-A.js +0 -14
- package/components/DataGrid/formatters/ColumnPointsFormatter/index-BXGW2CsK.js +0 -10
- package/components/DataGrid/formatters/ColumnPriceFormatter/index-O11tBykn.js +0 -10
- package/components/DataGrid/formatters/ColumnSetCheckFormatter/index-BaCawLr1.js +0 -36
- package/components/DataGrid/formatters/ColumnUncertaintyFormatter/index-Cq7a-jnE.js +0 -10
- package/components/DataGrid/formatters/index-CrZXPa0e.js +0 -13
- package/components/DataGrid/index-BZ-lbmuU.js +0 -908
- package/components/DataGrid/subcomponents/Actions/index-CHvPZ4Ru.js +0 -549
- package/components/DataGrid/subcomponents/editors/TextEditor/index-BIFm8akr.js +0 -80
- package/components/DragResizeWindow/index-D2jLYExo.js +0 -505
- package/components/DynamicFilter/constants-ByqmFATV.js +0 -31
- package/components/DynamicFilter/dictionary-PrbXU3VZ.js +0 -51
- package/components/DynamicFilter/index-DZiJc9h7.js +0 -116
- package/components/DynamicFilter/slots/SlotsEnum-cawFeNzx.js +0 -34
- package/components/DynamicFilter/slots/dynamicFilterSlots-DHxelhXP.js +0 -151
- package/components/DynamicFilter/slots/index-l0sNRNKZ.js +0 -1
- package/components/DynamicFilter/store/index-BT-eWVnJ.js +0 -254
- package/components/DynamicFilter/subcomponents/AppliedFilterChip/index-B32bAzi-.js +0 -60
- package/components/DynamicFilter/subcomponents/AppliedFilters/index-Bha19drV.js +0 -26
- package/components/DynamicFilter/subcomponents/DynamicFilterBase/index-BmvzoHit.js +0 -40
- package/components/DynamicFilter/subcomponents/FieldTypes/BooleanFilter/index-BcO3SlP5.js +0 -129
- package/components/DynamicFilter/subcomponents/FieldTypes/DateTimeFilter/index-BCJhpNS8.js +0 -171
- package/components/DynamicFilter/subcomponents/FieldTypes/NumberFilter/index-DCNhz68u.js +0 -153
- package/components/DynamicFilter/subcomponents/FieldTypes/SelectFilter/index-BdypjM1Y.js +0 -146
- package/components/DynamicFilter/subcomponents/FieldTypes/StringFilter/index-D-NFIVnK.js +0 -114
- package/components/DynamicFilter/subcomponents/FieldTypes/index-BwQHJqk9.js +0 -38
- package/components/DynamicFilter/subcomponents/FilterActions/index-B9UWmk07.js +0 -88
- package/components/DynamicFilter/subcomponents/InputFilter/index-CfGb1TfV.js +0 -188
- package/components/DynamicFilter/subcomponents/PopoverFilter/index-DkfRGrlO.js +0 -158
- package/components/DynamicFilter/subcomponents/PopoverMenuFields/index-DSegwAm2.js +0 -63
- package/components/FieldLabel/index-CI57EizR.js +0 -54
- package/components/GridLayout/index-C4HyxNYX.js +0 -1044
- package/components/GridLayout/subcomponents/Griditem/index-C7jT4s8t.js +0 -395
- package/components/GridLayout/subcomponents/Responsive/index-BKcU2OnF.js +0 -348
- package/components/GridLayout/subcomponents/SizeProvider/index-1aJ-e_54.js +0 -71
- package/components/HelperText/index-Crn_XIPF.js +0 -50
- package/components/Icon/index-C89MAkeH.js +0 -176
- package/components/Image/index-COp8vP0X.js +0 -175
- package/components/LanguagePopover/index-BA2Igs9L.js +0 -179
- package/components/LinearProgressIndeterminate/index-BwI756Mb.js +0 -55
- package/components/Loadable/index-BMbi9ISF.js +0 -9
- package/components/LoadingError/index-Cf0oGUrL.js +0 -89
- package/components/MFIsolationApp/index-V4R55hNU.js +0 -169
- package/components/MFLoader/index-BI8vQZSH.js +0 -299
- package/components/ModalDialog/index-CEVQBQ7W.js +0 -77
- package/components/NavLink/index-D1S_vtFO.js +0 -55
- package/components/NoItemSelected/index-B9oM26AX.js +0 -54
- package/components/ObjectLogs/index-CiXOJpS4.js +0 -233
- package/components/PDFViewer/index-GVN2rfd6.js +0 -51
- package/components/Page/index-DZMkYmr4.js +0 -117
- package/components/PaperForm/index-DwgAfjci.js +0 -59
- package/components/Period/index-2pJG3VmY.js +0 -238
- package/components/PrintingSystem/index-B2qcnfw0.js +0 -187
- package/components/PrintingSystem/subcomponents/BodyNode/index-Cv2aoy8S.js +0 -49
- package/components/PrintingSystem/subcomponents/ChartNode/index-BmJm8v_C.js +0 -105
- package/components/PrintingSystem/subcomponents/DividerNode/index-MpFhE-H0.js +0 -20
- package/components/PrintingSystem/subcomponents/FooterNode/index-ZEcWdMSM.js +0 -49
- package/components/PrintingSystem/subcomponents/GridNode/index-SsKax2xu.js +0 -74
- package/components/PrintingSystem/subcomponents/HeaderNode/index-Cs8TOOBL.js +0 -49
- package/components/PrintingSystem/subcomponents/PaperNode/index-DBb25Ecg.js +0 -30
- package/components/PrintingSystem/subcomponents/PropertyValueNode/index-CTVn7J9Q.js +0 -47
- package/components/PrintingSystem/subcomponents/SectionNode/index-iYPM3EaS.js +0 -49
- package/components/PrintingSystem/subcomponents/TextBoxNode/index-DGjXCFKJ.js +0 -24
- package/components/PropertyValue/index-Bh-Jnrte.js +0 -264
- package/components/Resizeable/index-DdP1xfE9.js +0 -20
- package/components/ScrollBar/index-f2URPPE2.js +0 -35
- package/components/ScrollToTop/index-TxORk5dB.js +0 -12
- package/components/SideBar/index-PUBBe0yH.js +0 -758
- package/components/SplitLayout/index-Bu1hcO6G.js +0 -89
- package/components/ToastContainer/index-DK1d8NNd.js +0 -191
- package/components/WrapperComponent/index-BHV-CsDU.js +0 -14
- package/components/animate/LoadingScreen/index-CkVLOrMz.js +0 -70
- package/components/animate/MotionContainer/index-eartnWyO.js +0 -34
- package/components/animate/MotionLazyContainer/index-Be8osTiG.js +0 -9
- package/components/animate/PropagateLoader/index-Bkq8V2SN.js +0 -23
- package/components/animate/features-BbnE33u3.js +0 -5
- package/components/animate/index-BsWiJfzp.js +0 -89
- package/components/animate/variants/bounce-DanQqHAX.js +0 -101
- package/components/animate/variants/container-Dmpr6tg5.js +0 -22
- package/components/animate/variants/fade-CAOJNn06.js +0 -65
- package/components/animate/variants/index-l0sNRNKZ.js +0 -1
- package/components/animate/variants/transition-B9W5SWTa.js +0 -20
- package/components/areas/components/AreasAdmin/index-OxQU3P8Y.js +0 -699
- package/components/areas/components/AreasViewer/index-DQ0aPioP.js +0 -805
- package/components/areas/components/index-l0sNRNKZ.js +0 -1
- package/components/areas/constants-rqODZNZe.js +0 -6
- package/components/areas/contexts/AreasContext/index-BqRlA7JA.js +0 -1110
- package/components/areas/contexts/DynamicMFParmsContext/index-22c6E7vK.js +0 -36
- package/components/areas/contexts/WindowToolsMFContext/index-DkE30fhm.js +0 -12
- package/components/areas/contexts/index-l0sNRNKZ.js +0 -1
- package/components/areas/dictionary-YUsP9beq.js +0 -36
- package/components/areas/hooks/index-l0sNRNKZ.js +0 -1
- package/components/areas/hooks/useAreas/index-BSbwbJLS.js +0 -11
- package/components/areas/hooks/useDynamicMFParameters/index-DhbcZPs9.js +0 -12
- package/components/areas/hooks/useSetWindowsTitle/useSetWindowsTitle-BzPD-miW.js +0 -31
- package/components/areas/hooks/useWindowToolsMF/index-BECQfhbC.js +0 -10
- package/components/areas/icons-CwFr-alN.js +0 -24
- package/components/areas/index-B_Odny9h.js +0 -22
- package/components/commercial/AppBarCommercial/index-CHq3P3GY.js +0 -28
- package/components/commercial/SectionCommercial/index-BeABGtdr.js +0 -56
- package/components/commercial/TopBar/index-F1repmti.js +0 -232
- package/components/commercial/index-CxDzs6Ax.js +0 -81
- package/components/formatters/BooleanFormatter/index-DktIidqW.js +0 -44
- package/components/formatters/DateFormatter/index-CGcRZ8BA.js +0 -43
- package/components/formatters/PointsFormatter/index-C7sR8iqk.js +0 -25
- package/components/formatters/PriceFormatter/index-CsvRawmc.js +0 -35
- package/components/formatters/UncertaintyFormatter/index-B9ESVEVp.js +0 -29
- package/components/formatters/index-pnJhDYKe.js +0 -109
- package/components/hook-form/HelperError/index-BVnmUazV.js +0 -19
- package/components/hook-form/RHFAutocomplete/index-BtPL16HR.js +0 -657
- package/components/hook-form/RHFAutocompleteAsync/index-BfzjLHG8.js +0 -226
- package/components/hook-form/RHFCheckbox/index-Vyttu8Vx.js +0 -132
- package/components/hook-form/RHFColorPicker/index-Cxxb5Wa_.js +0 -191
- package/components/hook-form/RHFDateTime/index-CW1Slb-f.js +0 -190
- package/components/hook-form/RHFMultiCheckbox/index-BARudV1A.js +0 -34
- package/components/hook-form/RHFPeriod/index-r-HeIOoZ.js +0 -98
- package/components/hook-form/RHFRadioGroup/index-CTD-0zKo.js +0 -52
- package/components/hook-form/RHFSelect/index-LdwRuFz-.js +0 -29
- package/components/hook-form/RHFTextField/index-B6ufruSB.js +0 -337
- package/components/hook-form/RHFUpload/index-CDPbm8NR.js +0 -253
- package/components/maps/components/GpsTools/index-5MXlhIEt.js +0 -1948
- package/components/maps/components/Map/index-2Lx5ARXa.js +0 -2546
- package/components/maps/index-Ci-7-FHg.js +0 -7
- package/components/modal/WindowBase-Gd27v5FU.js +0 -44
- package/components/modal/WindowConfirm-u6vAMFo7.js +0 -73
- package/components/modal/index-CydPIpKZ.js +0 -65
- package/components/mui_extended/Accordion/index-DMLYJL7o.js +0 -124
- package/components/mui_extended/Avatar/index-ClBa-6eF.js +0 -64
- package/components/mui_extended/Badge/index-zI-F_Qkq.js +0 -29
- package/components/mui_extended/BoxIcon/index-BUTJ2tKw.js +0 -22
- package/components/mui_extended/Breadcrumbs/index-DTS7rOZH.js +0 -86
- package/components/mui_extended/Button/index-CGfZbaea.js +0 -222
- package/components/mui_extended/CheckBox-BXUrbonB.js +0 -76
- package/components/mui_extended/CircularProgress/index-Bnnti_G6.js +0 -8
- package/components/mui_extended/IconButton/classes/constants-ChY2jKkp.js +0 -4
- package/components/mui_extended/IconButton/classes/index-BxjJGAqZ.js +0 -45
- package/components/mui_extended/IconButton/index-CusYFjie.js +0 -97
- package/components/mui_extended/IconButton/styledIconButton-fAsbGoFS.js +0 -7
- package/components/mui_extended/LinearProgress/index-CGgW8jq2.js +0 -9
- package/components/mui_extended/LinkWithRoute/index-BC2miUjR.js +0 -15
- package/components/mui_extended/MenuActions/MenuActions-C6CjSU6C.js +0 -149
- package/components/mui_extended/MenuActions/constants-BwsU9chA.js +0 -10
- package/components/mui_extended/MenuActions/dictionary-Dj_07puT.js +0 -11
- package/components/mui_extended/MenuActions/slots/MenuActionsEnum-Bu-L6eWU.js +0 -13
- package/components/mui_extended/MenuActions/slots/MenuActionsSlots-D65KZAKF.js +0 -46
- package/components/mui_extended/Pager/index-DCbxiTZA.js +0 -257
- package/components/mui_extended/Popover/index-DfrJAQkV.js +0 -153
- package/components/mui_extended/Stack/index-DzEeCYfp.js +0 -31
- package/components/mui_extended/Tab/index-Bu3dPidV.js +0 -129
- package/components/mui_extended/ToggleButton/index-C9cBkT1V.js +0 -18
- package/components/mui_extended/ToggleIconButton/index--0b3Td6C.js +0 -26
- package/components/mui_extended/Tooltip/index-B8QUytCK.js +0 -42
- package/components/mui_extended/Typography/index-Cf_4Zw8f.js +0 -54
- package/components/mui_extended/index-l0sNRNKZ.js +0 -1
- package/components/popups/PopupsProvider/index-DhSxmtfJ.js +0 -172
- package/components/popups/PopupsViewer/constants-DuyD7aCn.js +0 -4
- package/components/popups/PopupsViewer/icons-BUujqqbu.js +0 -7
- package/components/popups/PopupsViewer/index-BecevSns.js +0 -172
- package/components/popups/PopupsViewer/slots/index-B98CiRLa.js +0 -14
- package/components/popups/PopupsViewer/slots/popupsViewerSlots-BXH77nCF.js +0 -46
- package/components/popups/index-l0sNRNKZ.js +0 -1
- package/contexts/ModalContext/index-CPfNnfTL.js +0 -39
- package/contexts/RHFormContext/index-D_nK759o.js +0 -78
- package/hocs/withToggle/index-C1_DMZD3.js +0 -14
- package/hooks/useFormAddEdit/index-D9oSjUn1.js +0 -90
- package/hooks/useFormReadyForUpdate/index-B3HygFCM.js +0 -20
- package/hooks/useModal/index-BJSQOX3U.js +0 -10
- package/hooks/useSizeContainer/index-D4hDjM1P.js +0 -37
- package/hooks/useStateRef/index-C3P6ZK3m.js +0 -15
- package/hooks/useTab/index-B_GEQFOP.js +0 -12
- package/react-data-grid-BfYuZ6AK.js +0 -2606
- package/react-draggable-DsCPdgQP.js +0 -811
- package/react-json-view-bhqIAaNg.js +0 -2576
- package/react-resizable-eBbFl2dX.js +0 -618
- package/react-spinners-TpKN9lZg.js +0 -123
- package/react-splitter-layout-C-JTsNGs.js +0 -158
- package/styles/DynamicFilter-CJFsIegc.js +0 -319
- package/styles/MenuActions-lTi-ynPM.js +0 -42
- package/styles/index-DKj6m8SL.js +0 -1691
- package/test/constants_no_mock-CF-669v-.js +0 -4
- package/test/getNameDataTestId-BaBTWhBr.js +0 -10
- package/utils/index-DiMrtgIu.js +0 -502
- /package/components/GridLayout/subcomponents/{Griditem → GridItem}/index.d.ts +0 -0
- /package/components/GridLayout/subcomponents/{Griditem → GridItem}/types.d.ts +0 -0
|
@@ -1,116 +0,0 @@
|
|
|
1
|
-
import { f as fieldFactory } from "./subcomponents/FieldTypes/index-BwQHJqk9.js";
|
|
2
|
-
import { f as filterValidOperandsArraySelect } from "./subcomponents/FieldTypes/SelectFilter/index-BdypjM1Y.js";
|
|
3
|
-
import { jsx } from "react/jsx-runtime";
|
|
4
|
-
import { useFlagsPresent, CommonFlags } from "@m4l/core";
|
|
5
|
-
import { D as DynamicFilterProvider } from "./store/index-BT-eWVnJ.js";
|
|
6
|
-
import { D as DynamicFilterBase } from "./subcomponents/DynamicFilterBase/index-BmvzoHit.js";
|
|
7
|
-
function getPurgedInitialFiltersApplied(fields, initialFilters, getFieldByName) {
|
|
8
|
-
const newFilters = [];
|
|
9
|
-
const fixedFields = [];
|
|
10
|
-
for (let index = 0; index < initialFilters.length; index++) {
|
|
11
|
-
try {
|
|
12
|
-
const initialFilter = initialFilters[index];
|
|
13
|
-
const field = getFieldByName(initialFilter.name);
|
|
14
|
-
const filter = {
|
|
15
|
-
id: 0,
|
|
16
|
-
isSet: true,
|
|
17
|
-
fixed: false,
|
|
18
|
-
field,
|
|
19
|
-
fieldType: field.type,
|
|
20
|
-
operator: initialFilters[index].operator,
|
|
21
|
-
operand1: initialFilters[index].operand1,
|
|
22
|
-
operand2: initialFilters[index].operand2,
|
|
23
|
-
operandsArray: initialFilters[index].operandsArray
|
|
24
|
-
};
|
|
25
|
-
if (!field) continue;
|
|
26
|
-
const canAddField = fieldFactory(field.type).verifyFilter(initialFilter, field);
|
|
27
|
-
if (canAddField) {
|
|
28
|
-
if (filter.fieldType === "datetime") {
|
|
29
|
-
filter.operand1 = /* @__PURE__ */ new Date(filter.operand1 + "");
|
|
30
|
-
filter.operand2 = /* @__PURE__ */ new Date(filter.operand2 + "");
|
|
31
|
-
}
|
|
32
|
-
if (field.presence === "fixed") {
|
|
33
|
-
if (fixedFields.findIndex((f) => f === field.name) === -1) {
|
|
34
|
-
filter.fixed = true;
|
|
35
|
-
fixedFields.push(field.name);
|
|
36
|
-
} else {
|
|
37
|
-
filter.fixed = false;
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
filter.isSet = true;
|
|
41
|
-
filter.id = newFilters.length + 1;
|
|
42
|
-
newFilters.push(filter);
|
|
43
|
-
}
|
|
44
|
-
} catch (error) {
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
for (let index = 0; index < fields.length; index++) {
|
|
48
|
-
const field = fields[index];
|
|
49
|
-
if (field.presence === "initialized" || field.presence === "fixed") {
|
|
50
|
-
if (!initialFilters.find((f) => f.name === field.name)) {
|
|
51
|
-
const newFilter = fieldFactory(field.type).getDefaultFilter(
|
|
52
|
-
field,
|
|
53
|
-
field.presence === "fixed"
|
|
54
|
-
);
|
|
55
|
-
newFilter.id = newFilters.length + 1;
|
|
56
|
-
newFilters.push(newFilter);
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
}
|
|
60
|
-
return newFilters;
|
|
61
|
-
}
|
|
62
|
-
const formatToRawFilter = (appliedFilters) => {
|
|
63
|
-
return appliedFilters.map((af) => {
|
|
64
|
-
let oa = void 0;
|
|
65
|
-
if (af.field.type === "select" && af.operandsArray) {
|
|
66
|
-
oa = Array.isArray(af.operandsArray) ? af.operandsArray.map(af.field.selectOptions.getOptionId) : [af.field.selectOptions.getOptionId(af.operandsArray)];
|
|
67
|
-
}
|
|
68
|
-
return {
|
|
69
|
-
n: af.field.name,
|
|
70
|
-
o: af.operator,
|
|
71
|
-
o1: af.operand1,
|
|
72
|
-
o2: af.operator === "b" ? af.operand2 : void 0,
|
|
73
|
-
oa
|
|
74
|
-
};
|
|
75
|
-
});
|
|
76
|
-
};
|
|
77
|
-
function formatToInitialFilters(appliedFilters) {
|
|
78
|
-
return appliedFilters.map((appliedFilter) => {
|
|
79
|
-
const ret = {
|
|
80
|
-
name: appliedFilter.field.name,
|
|
81
|
-
operator: appliedFilter.operator,
|
|
82
|
-
operand1: appliedFilter.operand1,
|
|
83
|
-
operand2: appliedFilter.operator === "b" ? appliedFilter.operand2 : void 0
|
|
84
|
-
};
|
|
85
|
-
if (appliedFilter.fieldType === "datetime") {
|
|
86
|
-
ret.operand1 = appliedFilter.operand1.toISOString();
|
|
87
|
-
ret.operand2 = appliedFilter.operator === "b" ? appliedFilter.operand2.toISOString() : void 0;
|
|
88
|
-
}
|
|
89
|
-
if (appliedFilter.fieldType === "select") {
|
|
90
|
-
const validOperandsArray = filterValidOperandsArraySelect(
|
|
91
|
-
appliedFilter.operandsArray,
|
|
92
|
-
appliedFilter.field
|
|
93
|
-
);
|
|
94
|
-
if (validOperandsArray && validOperandsArray?.length > 0) {
|
|
95
|
-
ret.operandsArray = validOperandsArray;
|
|
96
|
-
}
|
|
97
|
-
}
|
|
98
|
-
if (ret.operand2 === void 0) {
|
|
99
|
-
delete ret.operand2;
|
|
100
|
-
}
|
|
101
|
-
return ret;
|
|
102
|
-
});
|
|
103
|
-
}
|
|
104
|
-
function DynamicFilter(props) {
|
|
105
|
-
const hasPresentFlags = useFlagsPresent([CommonFlags.FLAG_DICTIONARY_LOADED]);
|
|
106
|
-
if (!hasPresentFlags) {
|
|
107
|
-
return null;
|
|
108
|
-
}
|
|
109
|
-
return /* @__PURE__ */ jsx(DynamicFilterProvider, { ...props, children: /* @__PURE__ */ jsx(DynamicFilterBase, {}) });
|
|
110
|
-
}
|
|
111
|
-
export {
|
|
112
|
-
DynamicFilter as D,
|
|
113
|
-
formatToRawFilter as a,
|
|
114
|
-
formatToInitialFilters as f,
|
|
115
|
-
getPurgedInitialFiltersApplied as g
|
|
116
|
-
};
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
var DynamicFilterSlots = /* @__PURE__ */ ((DynamicFilterSlots2) => {
|
|
2
|
-
DynamicFilterSlots2["root"] = "root";
|
|
3
|
-
DynamicFilterSlots2["innerContainer"] = "innerContainer";
|
|
4
|
-
DynamicFilterSlots2["inputFilter"] = "inputFilter";
|
|
5
|
-
DynamicFilterSlots2["inputFilterInput"] = "inputFilterInput";
|
|
6
|
-
DynamicFilterSlots2["inputFilterIcon"] = "inputFilterIcon";
|
|
7
|
-
DynamicFilterSlots2["appliedFilters"] = "appliedFilters";
|
|
8
|
-
DynamicFilterSlots2["appliedFilterInnerContainer"] = "appliedFilterInnerContainer";
|
|
9
|
-
DynamicFilterSlots2["appliedFilterChip"] = "appliedFilterChip";
|
|
10
|
-
DynamicFilterSlots2["appliedFilterChipIcon"] = "appliedFilterChipIcon";
|
|
11
|
-
DynamicFilterSlots2["appliedFilterChipInfo"] = "appliedFilterChipInfo";
|
|
12
|
-
DynamicFilterSlots2["appliedFilterChipInfoFieldName"] = "appliedFilterChipInfoFieldName";
|
|
13
|
-
DynamicFilterSlots2["appliedFilterChipInfoOperator"] = "appliedFilterChipInfoOperator";
|
|
14
|
-
DynamicFilterSlots2["appliedFilterChipInfoOperands"] = "appliedFilterChipInfoOperands";
|
|
15
|
-
DynamicFilterSlots2["appliedFilterChipRemoveButton"] = "appliedFilterChipRemoveButton";
|
|
16
|
-
DynamicFilterSlots2["actions"] = "actions";
|
|
17
|
-
DynamicFilterSlots2["actionsSkeletonButton"] = "actionsSkeletonButton";
|
|
18
|
-
DynamicFilterSlots2["actionsClearButton"] = "actionsClearButton";
|
|
19
|
-
DynamicFilterSlots2["actionsSubmitButton"] = "actionsSubmitButton";
|
|
20
|
-
DynamicFilterSlots2["popoverMenu"] = "popoverMenu";
|
|
21
|
-
DynamicFilterSlots2["popoverMenuItem"] = "popoverMenuItem";
|
|
22
|
-
DynamicFilterSlots2["popoverMenuItemIcon"] = "popoverMenuItemIcon";
|
|
23
|
-
DynamicFilterSlots2["popoverMenuItemLabel"] = "popoverMenuItemLabel";
|
|
24
|
-
DynamicFilterSlots2["popoverFilter"] = "popoverFilter";
|
|
25
|
-
DynamicFilterSlots2["popoverFilterContainerFields"] = "popoverFilterContainerFields";
|
|
26
|
-
DynamicFilterSlots2["popoverFilterHeader"] = "popoverFilterHeader";
|
|
27
|
-
DynamicFilterSlots2["popoverFilterHeaderIcon"] = "popoverFilterHeaderIcon";
|
|
28
|
-
DynamicFilterSlots2["popoverFilterHeaderTitle"] = "popoverFilterHeaderTitle";
|
|
29
|
-
DynamicFilterSlots2["popoverFilterActions"] = "popoverFilterActions";
|
|
30
|
-
return DynamicFilterSlots2;
|
|
31
|
-
})(DynamicFilterSlots || {});
|
|
32
|
-
export {
|
|
33
|
-
DynamicFilterSlots as D
|
|
34
|
-
};
|
|
@@ -1,151 +0,0 @@
|
|
|
1
|
-
import { styled } from "@mui/material/styles";
|
|
2
|
-
import { D as DYNAMIC_FILTER_KEY_COMPONENT } from "../constants-ByqmFATV.js";
|
|
3
|
-
import { D as DynamicFilterSlots } from "./SlotsEnum-cawFeNzx.js";
|
|
4
|
-
import { d as dynamicFilterStyles } from "../../../styles/DynamicFilter-CJFsIegc.js";
|
|
5
|
-
import { MenuItem } from "@mui/material";
|
|
6
|
-
import { A as Actions } from "../../CommonActions/components/Actions/index-CuG1pnXW.js";
|
|
7
|
-
import { I as Icon } from "../../Icon/index-C89MAkeH.js";
|
|
8
|
-
import { I as IconButton } from "../../mui_extended/IconButton/index-CusYFjie.js";
|
|
9
|
-
import { P as Popover } from "../../mui_extended/Popover/index-DfrJAQkV.js";
|
|
10
|
-
import { T as Typography } from "../../mui_extended/Typography/index-Cf_4Zw8f.js";
|
|
11
|
-
const RootStyled = styled("div", { name: DYNAMIC_FILTER_KEY_COMPONENT, slot: DynamicFilterSlots.root })(
|
|
12
|
-
dynamicFilterStyles?.root
|
|
13
|
-
);
|
|
14
|
-
const InnerContainerStyled = styled("div", {
|
|
15
|
-
name: DYNAMIC_FILTER_KEY_COMPONENT,
|
|
16
|
-
slot: DynamicFilterSlots.innerContainer
|
|
17
|
-
})(dynamicFilterStyles?.innerContainer);
|
|
18
|
-
const InputFilterStyled = styled("div", {
|
|
19
|
-
name: DYNAMIC_FILTER_KEY_COMPONENT,
|
|
20
|
-
slot: DynamicFilterSlots.inputFilter
|
|
21
|
-
})(dynamicFilterStyles?.inputFilter);
|
|
22
|
-
const InputFilterInputStyled = styled("input", {
|
|
23
|
-
name: DYNAMIC_FILTER_KEY_COMPONENT,
|
|
24
|
-
slot: DynamicFilterSlots.inputFilterInput
|
|
25
|
-
})(dynamicFilterStyles?.inputFilterInput);
|
|
26
|
-
const InputFilterIconStyled = styled(Icon, {
|
|
27
|
-
name: DYNAMIC_FILTER_KEY_COMPONENT,
|
|
28
|
-
slot: DynamicFilterSlots.inputFilterIcon
|
|
29
|
-
})(dynamicFilterStyles?.inputFilterIcon);
|
|
30
|
-
const AppliedFiltersStyled = styled("div", {
|
|
31
|
-
name: DYNAMIC_FILTER_KEY_COMPONENT,
|
|
32
|
-
slot: DynamicFilterSlots.appliedFilters
|
|
33
|
-
})(dynamicFilterStyles?.appliedFilters);
|
|
34
|
-
const AppliedFilterInnerContainerStyled = styled("div", {
|
|
35
|
-
name: DYNAMIC_FILTER_KEY_COMPONENT,
|
|
36
|
-
slot: DynamicFilterSlots.appliedFilterInnerContainer
|
|
37
|
-
})(dynamicFilterStyles?.appliedFilterInnerContainer);
|
|
38
|
-
const AppliedFilterChipStyled = styled("div", {
|
|
39
|
-
name: DYNAMIC_FILTER_KEY_COMPONENT,
|
|
40
|
-
slot: DynamicFilterSlots.appliedFilterChip
|
|
41
|
-
})(dynamicFilterStyles?.appliedFilterChip);
|
|
42
|
-
const AppliedFilterChipIconStyled = styled(IconButton, {
|
|
43
|
-
name: DYNAMIC_FILTER_KEY_COMPONENT,
|
|
44
|
-
slot: DynamicFilterSlots.appliedFilterChipIcon
|
|
45
|
-
})(dynamicFilterStyles?.appliedFilterChipIcon);
|
|
46
|
-
const AppliedFilterChipInfoStyled = styled("button", {
|
|
47
|
-
name: DYNAMIC_FILTER_KEY_COMPONENT,
|
|
48
|
-
slot: DynamicFilterSlots.appliedFilterChipInfo
|
|
49
|
-
})(dynamicFilterStyles?.appliedFilterChipInfo);
|
|
50
|
-
const AppliedFilterChipInfoFieldNameStyled = styled("span", {
|
|
51
|
-
name: DYNAMIC_FILTER_KEY_COMPONENT,
|
|
52
|
-
slot: DynamicFilterSlots.appliedFilterChipInfoFieldName
|
|
53
|
-
})(dynamicFilterStyles?.appliedFilterChipInfoFieldName);
|
|
54
|
-
const AppliedFilterChipInfoOperatorStyled = styled("span", {
|
|
55
|
-
name: DYNAMIC_FILTER_KEY_COMPONENT,
|
|
56
|
-
slot: DynamicFilterSlots.appliedFilterChipInfoOperator
|
|
57
|
-
})(dynamicFilterStyles?.appliedFilterChipInfoOperator);
|
|
58
|
-
const AppliedFilterChipInfoOperandsStyled = styled("span", {
|
|
59
|
-
name: DYNAMIC_FILTER_KEY_COMPONENT,
|
|
60
|
-
slot: DynamicFilterSlots.appliedFilterChipInfoOperands
|
|
61
|
-
})(dynamicFilterStyles?.appliedFilterChipInfoOperands);
|
|
62
|
-
const AppliedFilterChipRemoveButtonStyled = styled(IconButton, {
|
|
63
|
-
name: DYNAMIC_FILTER_KEY_COMPONENT,
|
|
64
|
-
slot: DynamicFilterSlots.appliedFilterChipRemoveButton
|
|
65
|
-
})(dynamicFilterStyles?.appliedFilterChipRemoveButton);
|
|
66
|
-
const ActionsStyled = styled("div", {
|
|
67
|
-
name: DYNAMIC_FILTER_KEY_COMPONENT,
|
|
68
|
-
slot: DynamicFilterSlots.actions
|
|
69
|
-
})(dynamicFilterStyles?.actions);
|
|
70
|
-
const ActionsSkeletonButtonStyled = styled("div", {
|
|
71
|
-
name: DYNAMIC_FILTER_KEY_COMPONENT,
|
|
72
|
-
slot: DynamicFilterSlots.actionsSkeletonButton
|
|
73
|
-
})(dynamicFilterStyles?.actionsSkeletonButton);
|
|
74
|
-
const ActionsClearButtonStyled = styled(IconButton, {
|
|
75
|
-
name: DYNAMIC_FILTER_KEY_COMPONENT,
|
|
76
|
-
slot: DynamicFilterSlots.actionsClearButton
|
|
77
|
-
})(dynamicFilterStyles?.actionsClearButton);
|
|
78
|
-
const ActionsSubmitButtonStyled = styled(IconButton, {
|
|
79
|
-
name: DYNAMIC_FILTER_KEY_COMPONENT,
|
|
80
|
-
slot: DynamicFilterSlots.actionsSubmitButton
|
|
81
|
-
})(dynamicFilterStyles?.actionsSubmitButton);
|
|
82
|
-
const PopoverMenuStyled = styled(Popover, {
|
|
83
|
-
name: DYNAMIC_FILTER_KEY_COMPONENT,
|
|
84
|
-
slot: DynamicFilterSlots.popoverMenu
|
|
85
|
-
})(dynamicFilterStyles?.popoverMenu);
|
|
86
|
-
const PopoverMenuItemStyled = styled(MenuItem, {
|
|
87
|
-
name: DYNAMIC_FILTER_KEY_COMPONENT,
|
|
88
|
-
slot: DynamicFilterSlots.popoverMenuItem
|
|
89
|
-
})(dynamicFilterStyles?.popoverMenuItem);
|
|
90
|
-
const PopoverMenuItemIconStyled = styled(Icon, {
|
|
91
|
-
name: DYNAMIC_FILTER_KEY_COMPONENT,
|
|
92
|
-
slot: DynamicFilterSlots.popoverMenuItemIcon
|
|
93
|
-
})(dynamicFilterStyles?.popoverMenuItemIcon);
|
|
94
|
-
const PopoverMenuItemLabelStyled = styled("div", {
|
|
95
|
-
name: DYNAMIC_FILTER_KEY_COMPONENT,
|
|
96
|
-
slot: DynamicFilterSlots.popoverMenuItemLabel
|
|
97
|
-
})(dynamicFilterStyles?.popoverMenuItemLabel);
|
|
98
|
-
const PopoverStyled = styled(Popover, {
|
|
99
|
-
name: DYNAMIC_FILTER_KEY_COMPONENT,
|
|
100
|
-
slot: DynamicFilterSlots.popoverFilter
|
|
101
|
-
})(dynamicFilterStyles?.popoverFilter);
|
|
102
|
-
const PopoverContainerFieldsStyled = styled("div", {
|
|
103
|
-
name: DYNAMIC_FILTER_KEY_COMPONENT,
|
|
104
|
-
slot: DynamicFilterSlots.popoverFilterContainerFields
|
|
105
|
-
})(dynamicFilterStyles?.popoverFilterContainerFields);
|
|
106
|
-
const PopoverHeaderStyled = styled("div", {
|
|
107
|
-
name: DYNAMIC_FILTER_KEY_COMPONENT,
|
|
108
|
-
slot: DynamicFilterSlots.popoverFilterHeader
|
|
109
|
-
})(dynamicFilterStyles?.popoverFilterHeader);
|
|
110
|
-
const PopoverHeaderIconStyled = styled(Icon, {
|
|
111
|
-
name: DYNAMIC_FILTER_KEY_COMPONENT,
|
|
112
|
-
slot: DynamicFilterSlots.popoverFilterHeaderIcon
|
|
113
|
-
})(dynamicFilterStyles?.popoverFilterHeaderIcon);
|
|
114
|
-
const PopoverHeaderTitleStyled = styled(Typography, {
|
|
115
|
-
name: DYNAMIC_FILTER_KEY_COMPONENT,
|
|
116
|
-
slot: DynamicFilterSlots.popoverFilterHeaderTitle
|
|
117
|
-
})(dynamicFilterStyles?.popoverFilterHeaderTitle);
|
|
118
|
-
const PopoverHeaderActionsStyled = styled(Actions, {
|
|
119
|
-
name: DYNAMIC_FILTER_KEY_COMPONENT,
|
|
120
|
-
slot: DynamicFilterSlots.popoverFilterActions
|
|
121
|
-
})(dynamicFilterStyles?.popoverFilterActions);
|
|
122
|
-
export {
|
|
123
|
-
AppliedFilterChipStyled as A,
|
|
124
|
-
InnerContainerStyled as I,
|
|
125
|
-
PopoverStyled as P,
|
|
126
|
-
RootStyled as R,
|
|
127
|
-
AppliedFilterChipIconStyled as a,
|
|
128
|
-
AppliedFilterChipInfoStyled as b,
|
|
129
|
-
AppliedFilterChipInfoFieldNameStyled as c,
|
|
130
|
-
AppliedFilterChipInfoOperatorStyled as d,
|
|
131
|
-
AppliedFilterChipInfoOperandsStyled as e,
|
|
132
|
-
AppliedFilterChipRemoveButtonStyled as f,
|
|
133
|
-
AppliedFiltersStyled as g,
|
|
134
|
-
AppliedFilterInnerContainerStyled as h,
|
|
135
|
-
ActionsSkeletonButtonStyled as i,
|
|
136
|
-
ActionsStyled as j,
|
|
137
|
-
ActionsClearButtonStyled as k,
|
|
138
|
-
ActionsSubmitButtonStyled as l,
|
|
139
|
-
InputFilterStyled as m,
|
|
140
|
-
InputFilterIconStyled as n,
|
|
141
|
-
InputFilterInputStyled as o,
|
|
142
|
-
PopoverHeaderStyled as p,
|
|
143
|
-
PopoverHeaderIconStyled as q,
|
|
144
|
-
PopoverHeaderTitleStyled as r,
|
|
145
|
-
PopoverContainerFieldsStyled as s,
|
|
146
|
-
PopoverHeaderActionsStyled as t,
|
|
147
|
-
PopoverMenuStyled as u,
|
|
148
|
-
PopoverMenuItemStyled as v,
|
|
149
|
-
PopoverMenuItemIconStyled as w,
|
|
150
|
-
PopoverMenuItemLabelStyled as x
|
|
151
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
|
|
@@ -1,254 +0,0 @@
|
|
|
1
|
-
import { useContext, createContext, useRef, useEffect } from "react";
|
|
2
|
-
import { useStore, createStore } from "zustand";
|
|
3
|
-
import { shallow } from "zustand/shallow";
|
|
4
|
-
import { jsx } from "react/jsx-runtime";
|
|
5
|
-
import { useModuleDictionary, useEnvironment, useModuleSkeleton } from "@m4l/core";
|
|
6
|
-
import { useResponsiveDesktop, useFirstRender } from "@m4l/graphics";
|
|
7
|
-
import { A as ALL_FIELD } from "../constants-ByqmFATV.js";
|
|
8
|
-
import { g as getPurgedInitialFiltersApplied, f as formatToInitialFilters, a as formatToRawFilter } from "../index-DZiJc9h7.js";
|
|
9
|
-
import { devtools } from "zustand/middleware";
|
|
10
|
-
import { immer } from "zustand/middleware/immer";
|
|
11
|
-
function useDynamicFilterStore(selector, equalityFn) {
|
|
12
|
-
const store = useContext(DynamicFilterContext);
|
|
13
|
-
if (!store)
|
|
14
|
-
throw new Error("useDynamicFilterStore context must be use inside DynamicFilterContext");
|
|
15
|
-
return useStore(store, selector, shallow);
|
|
16
|
-
}
|
|
17
|
-
function updateAvailableFields(state) {
|
|
18
|
-
state.availableFields = state.fields.filter((field) => {
|
|
19
|
-
if (field.multiple === void 0 || field.multiple) {
|
|
20
|
-
return true;
|
|
21
|
-
}
|
|
22
|
-
const appliedFilterNames = new Set(state.appliedFilters.map((f) => f.field.name));
|
|
23
|
-
return !appliedFilterNames.has(field.name);
|
|
24
|
-
});
|
|
25
|
-
}
|
|
26
|
-
function updateOwnerStateIsValid(state) {
|
|
27
|
-
state.ownerState.isValid = state.appliedFilters.every((filter) => filter.isSet);
|
|
28
|
-
}
|
|
29
|
-
const updateAutomatic = (state) => {
|
|
30
|
-
updateOwnerStateIsValid(state);
|
|
31
|
-
updateAvailableFields(state);
|
|
32
|
-
if (state.ownerState.isValid && state.automatic) {
|
|
33
|
-
state.ownerState.isDirty = false;
|
|
34
|
-
state.countOnChangeFiltersApplied++;
|
|
35
|
-
}
|
|
36
|
-
};
|
|
37
|
-
const createAreaStore = (initProps) => {
|
|
38
|
-
const startProps = {
|
|
39
|
-
countOnChangeFiltersApplied: 0,
|
|
40
|
-
appliedFilters: [],
|
|
41
|
-
availableFields: [],
|
|
42
|
-
fnAnchorEl: void 0,
|
|
43
|
-
popoverFilterData: void 0,
|
|
44
|
-
inputData: "",
|
|
45
|
-
...initProps
|
|
46
|
-
};
|
|
47
|
-
return createStore(
|
|
48
|
-
devtools(
|
|
49
|
-
immer((set, get) => ({
|
|
50
|
-
...startProps,
|
|
51
|
-
actions: {
|
|
52
|
-
init: (initialFiltersApplied) => {
|
|
53
|
-
set((state) => {
|
|
54
|
-
state.appliedFilters = getPurgedInitialFiltersApplied(
|
|
55
|
-
state.fields,
|
|
56
|
-
initialFiltersApplied,
|
|
57
|
-
state.actions.getFieldByName
|
|
58
|
-
);
|
|
59
|
-
state.ownerState.isEmpty = state.appliedFilters.length <= 0;
|
|
60
|
-
updateAutomatic(state);
|
|
61
|
-
});
|
|
62
|
-
},
|
|
63
|
-
getFieldByName: (name) => {
|
|
64
|
-
const field = (get().withAllField ? get().fields.concat(get().allField) : get().fields).find((f) => {
|
|
65
|
-
return f.name === name;
|
|
66
|
-
});
|
|
67
|
-
if (field) {
|
|
68
|
-
return field;
|
|
69
|
-
}
|
|
70
|
-
throw new Error("No exist field");
|
|
71
|
-
},
|
|
72
|
-
removeFilter: (id) => {
|
|
73
|
-
set((state) => {
|
|
74
|
-
const indexToRemoved = state.appliedFilters.findIndex((f) => id === f.id && !f.fixed);
|
|
75
|
-
if (indexToRemoved > -1) {
|
|
76
|
-
state.appliedFilters.splice(indexToRemoved, 1);
|
|
77
|
-
state.ownerState.isEmpty = state.appliedFilters.length === 0;
|
|
78
|
-
updateAutomatic(state);
|
|
79
|
-
}
|
|
80
|
-
});
|
|
81
|
-
},
|
|
82
|
-
showPopoverFilterForAdd: (anchorEl, field) => {
|
|
83
|
-
set((state) => {
|
|
84
|
-
state.fnAnchorEl = void 0;
|
|
85
|
-
state.inputData = "";
|
|
86
|
-
state.popoverFilterData = {
|
|
87
|
-
openFor: "add",
|
|
88
|
-
fnAnchorEl: () => anchorEl,
|
|
89
|
-
field
|
|
90
|
-
};
|
|
91
|
-
});
|
|
92
|
-
get().actions.setInEdition(true);
|
|
93
|
-
},
|
|
94
|
-
showPopoverFilterForEdit: (anchorEl, filterToEdit) => {
|
|
95
|
-
set((state) => {
|
|
96
|
-
state.popoverFilterData = {
|
|
97
|
-
openFor: "edit",
|
|
98
|
-
fnAnchorEl: () => anchorEl,
|
|
99
|
-
filter: filterToEdit,
|
|
100
|
-
field: filterToEdit.field
|
|
101
|
-
};
|
|
102
|
-
});
|
|
103
|
-
get().actions.setInEdition(true);
|
|
104
|
-
},
|
|
105
|
-
hidePopoverFilter: (stayInEdition) => {
|
|
106
|
-
set((state) => {
|
|
107
|
-
state.popoverFilterData = void 0;
|
|
108
|
-
});
|
|
109
|
-
get().actions.setInEdition(stayInEdition);
|
|
110
|
-
},
|
|
111
|
-
clearFilters: () => {
|
|
112
|
-
set((state) => {
|
|
113
|
-
state.appliedFilters = state.appliedFilters.filter((f) => f.fixed);
|
|
114
|
-
state.ownerState.isEmpty = state.appliedFilters.length === 0;
|
|
115
|
-
updateAvailableFields(state);
|
|
116
|
-
});
|
|
117
|
-
},
|
|
118
|
-
fireOnChangeFilters: () => {
|
|
119
|
-
set((state) => {
|
|
120
|
-
if (state.ownerState.isValid) {
|
|
121
|
-
state.ownerState.isDirty = false;
|
|
122
|
-
state.countOnChangeFiltersApplied++;
|
|
123
|
-
}
|
|
124
|
-
});
|
|
125
|
-
},
|
|
126
|
-
getNewId: () => {
|
|
127
|
-
return get().appliedFilters.reduce((prev, filterField) => {
|
|
128
|
-
return filterField.id > prev ? filterField.id : prev;
|
|
129
|
-
}, 0) + 1;
|
|
130
|
-
},
|
|
131
|
-
addFilter: (newFilter) => {
|
|
132
|
-
set((state) => {
|
|
133
|
-
state.appliedFilters.push(newFilter);
|
|
134
|
-
state.ownerState.isEmpty = state.appliedFilters.length === 0;
|
|
135
|
-
updateAutomatic(state);
|
|
136
|
-
});
|
|
137
|
-
},
|
|
138
|
-
updateFilter: (editFilter) => {
|
|
139
|
-
set((state) => {
|
|
140
|
-
const index = state.appliedFilters.findIndex(
|
|
141
|
-
(filterField) => filterField.id === editFilter.id
|
|
142
|
-
);
|
|
143
|
-
if (index > -1) {
|
|
144
|
-
state.appliedFilters[index] = editFilter;
|
|
145
|
-
}
|
|
146
|
-
updateAutomatic(state);
|
|
147
|
-
});
|
|
148
|
-
},
|
|
149
|
-
setInputData: (inputData) => {
|
|
150
|
-
set((state) => {
|
|
151
|
-
state.inputData = inputData;
|
|
152
|
-
});
|
|
153
|
-
},
|
|
154
|
-
setInEdition: (newInEdition) => {
|
|
155
|
-
set((state) => {
|
|
156
|
-
state.ownerState.inEdition = newInEdition;
|
|
157
|
-
});
|
|
158
|
-
},
|
|
159
|
-
setExternalState: (newExternalState) => {
|
|
160
|
-
set((state) => {
|
|
161
|
-
state.ownerState = { ...state.ownerState, ...newExternalState };
|
|
162
|
-
});
|
|
163
|
-
},
|
|
164
|
-
openPopoverMenuFields: (anchorEl) => {
|
|
165
|
-
set((state) => {
|
|
166
|
-
state.fnAnchorEl = () => anchorEl;
|
|
167
|
-
});
|
|
168
|
-
},
|
|
169
|
-
closePopoverMenuFields: (newInEdition) => {
|
|
170
|
-
set((state) => {
|
|
171
|
-
state.fnAnchorEl = void 0;
|
|
172
|
-
state.ownerState.inEdition = newInEdition || false;
|
|
173
|
-
});
|
|
174
|
-
}
|
|
175
|
-
}
|
|
176
|
-
})),
|
|
177
|
-
{ name: `Dynamic filter` }
|
|
178
|
-
)
|
|
179
|
-
);
|
|
180
|
-
};
|
|
181
|
-
const DynamicFilterContext = createContext(null);
|
|
182
|
-
function DynamicFilterProvider(props) {
|
|
183
|
-
const {
|
|
184
|
-
automatic = true,
|
|
185
|
-
withAllField = true,
|
|
186
|
-
fields,
|
|
187
|
-
initialAppliedFilters = [],
|
|
188
|
-
onChangeFilters,
|
|
189
|
-
dataTestId = "",
|
|
190
|
-
children
|
|
191
|
-
} = props;
|
|
192
|
-
const { getLabel } = useModuleDictionary();
|
|
193
|
-
const dynamicFilterStoreRef = useRef();
|
|
194
|
-
const { host_static_assets, environment_assets } = useEnvironment();
|
|
195
|
-
const isDesktop = useResponsiveDesktop();
|
|
196
|
-
const isSkeleton = useModuleSkeleton();
|
|
197
|
-
const isFirstRender = useFirstRender([isDesktop, isSkeleton]);
|
|
198
|
-
if (!dynamicFilterStoreRef.current) {
|
|
199
|
-
dynamicFilterStoreRef.current = createAreaStore({
|
|
200
|
-
allField: {
|
|
201
|
-
...ALL_FIELD,
|
|
202
|
-
urlIcon: `${host_static_assets}/${environment_assets}/frontend/components/dynamic_filter/assets/icons/all_fields.svg`
|
|
203
|
-
},
|
|
204
|
-
withAllField,
|
|
205
|
-
fields,
|
|
206
|
-
automatic,
|
|
207
|
-
getLabel,
|
|
208
|
-
dataTestId,
|
|
209
|
-
ownerState: {
|
|
210
|
-
isSkeleton,
|
|
211
|
-
isDirty: !automatic,
|
|
212
|
-
inEdition: false,
|
|
213
|
-
isValid: true,
|
|
214
|
-
isMobile: !isDesktop,
|
|
215
|
-
isEmpty: true
|
|
216
|
-
}
|
|
217
|
-
});
|
|
218
|
-
dynamicFilterStoreRef.current.getState().actions.init(initialAppliedFilters);
|
|
219
|
-
}
|
|
220
|
-
const countOnChangeFiltersApplied = useStore(
|
|
221
|
-
dynamicFilterStoreRef.current,
|
|
222
|
-
(state) => state.countOnChangeFiltersApplied,
|
|
223
|
-
shallow
|
|
224
|
-
);
|
|
225
|
-
useEffect(() => {
|
|
226
|
-
if (countOnChangeFiltersApplied === 0) {
|
|
227
|
-
return;
|
|
228
|
-
}
|
|
229
|
-
const state = dynamicFilterStoreRef.current?.getState();
|
|
230
|
-
if (state) {
|
|
231
|
-
onChangeFilters?.(
|
|
232
|
-
formatToInitialFilters(state.appliedFilters),
|
|
233
|
-
formatToRawFilter(state.appliedFilters)
|
|
234
|
-
);
|
|
235
|
-
}
|
|
236
|
-
}, [countOnChangeFiltersApplied]);
|
|
237
|
-
useEffect(() => {
|
|
238
|
-
if (isFirstRender) {
|
|
239
|
-
return;
|
|
240
|
-
}
|
|
241
|
-
dynamicFilterStoreRef.current?.getState().actions.setExternalState({ isMobile: !isDesktop, isSkeleton });
|
|
242
|
-
}, [isDesktop, isSkeleton]);
|
|
243
|
-
useEffect(() => {
|
|
244
|
-
if (automatic) {
|
|
245
|
-
dynamicFilterStoreRef.current?.getState().actions.fireOnChangeFilters();
|
|
246
|
-
return;
|
|
247
|
-
}
|
|
248
|
-
}, []);
|
|
249
|
-
return /* @__PURE__ */ jsx(DynamicFilterContext.Provider, { value: dynamicFilterStoreRef.current, children });
|
|
250
|
-
}
|
|
251
|
-
export {
|
|
252
|
-
DynamicFilterProvider as D,
|
|
253
|
-
useDynamicFilterStore as u
|
|
254
|
-
};
|
|
@@ -1,60 +0,0 @@
|
|
|
1
|
-
import { jsxs, jsx } from "react/jsx-runtime";
|
|
2
|
-
import { useMemo } from "react";
|
|
3
|
-
import { useEnvironment, useModuleDictionary } from "@m4l/core";
|
|
4
|
-
import { useFormatter } from "@m4l/graphics";
|
|
5
|
-
import { u as useDynamicFilterStore } from "../../store/index-BT-eWVnJ.js";
|
|
6
|
-
import { f as fieldFactory } from "../FieldTypes/index-BwQHJqk9.js";
|
|
7
|
-
import { A as AppliedFilterChipStyled, a as AppliedFilterChipIconStyled, b as AppliedFilterChipInfoStyled, c as AppliedFilterChipInfoFieldNameStyled, d as AppliedFilterChipInfoOperatorStyled, e as AppliedFilterChipInfoOperandsStyled, f as AppliedFilterChipRemoveButtonStyled } from "../../slots/dynamicFilterSlots-DHxelhXP.js";
|
|
8
|
-
function useAppliedFilterChip(filter) {
|
|
9
|
-
const { host_static_assets, environment_assets } = useEnvironment();
|
|
10
|
-
const { getLabel } = useModuleDictionary();
|
|
11
|
-
const formatters = useFormatter();
|
|
12
|
-
const { hidePopoverFilter, removeFilter, showPopoverFilterForEdit } = useDynamicFilterStore(
|
|
13
|
-
(state) => state.actions
|
|
14
|
-
);
|
|
15
|
-
const removeIconUrl = `${host_static_assets}/${environment_assets}/frontend/components/dynamic_filter/assets/icons/clear.svg`;
|
|
16
|
-
const labels = useMemo(() => {
|
|
17
|
-
return fieldFactory(filter.field.type).getLabels(filter, getLabel, formatters, filter.field);
|
|
18
|
-
}, [filter, getLabel]);
|
|
19
|
-
function onDelete() {
|
|
20
|
-
hidePopoverFilter(false);
|
|
21
|
-
removeFilter(filter.id);
|
|
22
|
-
}
|
|
23
|
-
function onEditFilter(event) {
|
|
24
|
-
hidePopoverFilter(false);
|
|
25
|
-
const currentTarget = event.currentTarget;
|
|
26
|
-
setTimeout(() => showPopoverFilterForEdit(currentTarget, filter), 10);
|
|
27
|
-
}
|
|
28
|
-
return {
|
|
29
|
-
onDelete,
|
|
30
|
-
onEditFilter,
|
|
31
|
-
removeIconUrl,
|
|
32
|
-
iconFieldUrl: filter.field?.urlIcon,
|
|
33
|
-
labels
|
|
34
|
-
};
|
|
35
|
-
}
|
|
36
|
-
function AppliedFilterChip(props) {
|
|
37
|
-
const { fixed } = props;
|
|
38
|
-
const { onEditFilter, onDelete, iconFieldUrl, removeIconUrl, labels } = useAppliedFilterChip(props);
|
|
39
|
-
return /* @__PURE__ */ jsxs(AppliedFilterChipStyled, { ownerState: {}, children: [
|
|
40
|
-
iconFieldUrl && /* @__PURE__ */ jsx(AppliedFilterChipIconStyled, { onClick: onEditFilter, src: iconFieldUrl, ownerState: {} }),
|
|
41
|
-
/* @__PURE__ */ jsxs(AppliedFilterChipInfoStyled, { onClick: onEditFilter, ownerState: {}, children: [
|
|
42
|
-
/* @__PURE__ */ jsx(AppliedFilterChipInfoFieldNameStyled, { ownerState: {}, children: labels.labelField }),
|
|
43
|
-
/* @__PURE__ */ jsx(AppliedFilterChipInfoOperatorStyled, { ownerState: {}, children: labels.labelOperator }),
|
|
44
|
-
/* @__PURE__ */ jsx(AppliedFilterChipInfoOperandsStyled, { ownerState: {}, children: labels.labelOperands })
|
|
45
|
-
] }),
|
|
46
|
-
!fixed && /* @__PURE__ */ jsx(
|
|
47
|
-
AppliedFilterChipRemoveButtonStyled,
|
|
48
|
-
{
|
|
49
|
-
src: removeIconUrl,
|
|
50
|
-
size: "small",
|
|
51
|
-
dictionaryTooltipId: "dynamic_filter.tooltip_clear_filter",
|
|
52
|
-
onClick: onDelete,
|
|
53
|
-
ownerState: {}
|
|
54
|
-
}
|
|
55
|
-
)
|
|
56
|
-
] });
|
|
57
|
-
}
|
|
58
|
-
export {
|
|
59
|
-
AppliedFilterChip as A
|
|
60
|
-
};
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import { jsx } from "react/jsx-runtime";
|
|
2
|
-
import { S as ScrollBar } from "../../../ScrollBar/index-f2URPPE2.js";
|
|
3
|
-
import { u as useDynamicFilterStore } from "../../store/index-BT-eWVnJ.js";
|
|
4
|
-
import { g as AppliedFiltersStyled, h as AppliedFilterInnerContainerStyled } from "../../slots/dynamicFilterSlots-DHxelhXP.js";
|
|
5
|
-
import { A as AppliedFilterChip } from "../AppliedFilterChip/index-B32bAzi-.js";
|
|
6
|
-
function useAppliedFilters() {
|
|
7
|
-
const appliedFilter = useDynamicFilterStore((state) => state.appliedFilters);
|
|
8
|
-
const isSkeleton = useDynamicFilterStore((state) => state.ownerState.isSkeleton);
|
|
9
|
-
const appliedFiltersSorted = [...appliedFilter].sort(
|
|
10
|
-
(filterA, filterB) => filterA.isSet !== filterB.isSet ? Number(filterA.isSet) - Number(filterB.isSet) : filterB.id - filterA.id
|
|
11
|
-
);
|
|
12
|
-
return {
|
|
13
|
-
appliedFiltersSorted,
|
|
14
|
-
isSkeleton
|
|
15
|
-
};
|
|
16
|
-
}
|
|
17
|
-
function AppliedFilters() {
|
|
18
|
-
const { appliedFiltersSorted, isSkeleton } = useAppliedFilters();
|
|
19
|
-
if (isSkeleton) {
|
|
20
|
-
return /* @__PURE__ */ jsx(AppliedFiltersStyled, { ownerState: {} });
|
|
21
|
-
}
|
|
22
|
-
return /* @__PURE__ */ jsx(AppliedFiltersStyled, { ownerState: {}, children: /* @__PURE__ */ jsx(ScrollBar, { children: /* @__PURE__ */ jsx(AppliedFilterInnerContainerStyled, { ownerState: {}, children: appliedFiltersSorted?.map((filter) => /* @__PURE__ */ jsx(AppliedFilterChip, { ...filter }, filter.id)) }) }) });
|
|
23
|
-
}
|
|
24
|
-
export {
|
|
25
|
-
AppliedFilters as A
|
|
26
|
-
};
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { u as useDynamicFilterStore } from "../../store/index-BT-eWVnJ.js";
|
|
3
|
-
import { a as getPropDataTestId } from "../../../../test/getNameDataTestId-BaBTWhBr.js";
|
|
4
|
-
import { R as RootStyled, I as InnerContainerStyled } from "../../slots/dynamicFilterSlots-DHxelhXP.js";
|
|
5
|
-
import { D as DynamicFilterSlots } from "../../slots/SlotsEnum-cawFeNzx.js";
|
|
6
|
-
import { I as InputFilter } from "../InputFilter/index-CfGb1TfV.js";
|
|
7
|
-
import { A as AppliedFilters } from "../AppliedFilters/index-Bha19drV.js";
|
|
8
|
-
import { F as FilterActions } from "../FilterActions/index-B9UWmk07.js";
|
|
9
|
-
import { P as PopoverFilter } from "../PopoverFilter/index-DkfRGrlO.js";
|
|
10
|
-
function useDynamicFilterBase() {
|
|
11
|
-
const ownerState = useDynamicFilterStore((state) => state.ownerState);
|
|
12
|
-
const dataTestId = useDynamicFilterStore((state) => state.dataTestId);
|
|
13
|
-
return { ownerState, dataTestId };
|
|
14
|
-
}
|
|
15
|
-
function DynamicFilterBase() {
|
|
16
|
-
const { ownerState, dataTestId } = useDynamicFilterBase();
|
|
17
|
-
return /* @__PURE__ */ jsx(
|
|
18
|
-
RootStyled,
|
|
19
|
-
{
|
|
20
|
-
ownerState: { ...ownerState },
|
|
21
|
-
...getPropDataTestId(dataTestId, DynamicFilterSlots.root),
|
|
22
|
-
children: /* @__PURE__ */ jsxs(
|
|
23
|
-
InnerContainerStyled,
|
|
24
|
-
{
|
|
25
|
-
ownerState: { ...ownerState },
|
|
26
|
-
...getPropDataTestId(dataTestId, DynamicFilterSlots.innerContainer),
|
|
27
|
-
children: [
|
|
28
|
-
/* @__PURE__ */ jsx(InputFilter, {}),
|
|
29
|
-
/* @__PURE__ */ jsx(AppliedFilters, {}),
|
|
30
|
-
/* @__PURE__ */ jsx(FilterActions, {}),
|
|
31
|
-
/* @__PURE__ */ jsx(PopoverFilter, {})
|
|
32
|
-
]
|
|
33
|
-
}
|
|
34
|
-
)
|
|
35
|
-
}
|
|
36
|
-
);
|
|
37
|
-
}
|
|
38
|
-
export {
|
|
39
|
-
DynamicFilterBase as D
|
|
40
|
-
};
|