@m4l/components 3.1.6 → 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/components/mui_extended/IconButton/index.d.ts +1 -1
- package/components/mui_extended/MenuActions/slots/MenuActionsSlots.d.ts +2 -4
- package/index.js +183 -339
- package/node_modules-CQtkw0uG.js +7350 -0
- package/package.json +1 -1
- package/vendor-AfIOyqRr.js +24636 -0
- package/components/AccountPopover/index-BdnzI23R.js +0 -334
- package/components/AppBar/index-Dvrx1jsr.js +0 -93
- package/components/BaseModule/index-BQ2UIUCy.js +0 -30
- package/components/CommonActions/components/ActionCancel/index-DSVEMl41.js +0 -12
- package/components/CommonActions/components/ActionFormCancel/index-DMsGH0wx.js +0 -56
- package/components/CommonActions/components/ActionFormIntro/index-C8zb7R3W.js +0 -33
- package/components/CommonActions/components/ActionIntro/index-BNIG3KAH.js +0 -25
- package/components/CommonActions/components/Actions/index-90JsZTzb.js +0 -70
- package/components/DataGrid/constants-8L7QgBKi.js +0 -10
- package/components/DataGrid/formatters/ColumnBooleanFormatter/index-ZsSxUL_T.js +0 -26
- package/components/DataGrid/formatters/ColumnConcatenatedValueFormatter/index-D-gZpvcm.js +0 -22
- package/components/DataGrid/formatters/ColumnDateFormatter/index-CKg8CJ6A.js +0 -19
- package/components/DataGrid/formatters/ColumnInteractiveCheckFormatter/index-kZGiDU5k.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-iKq2iRoa.js +0 -13
- package/components/DataGrid/index-DGHnRo8z.js +0 -908
- package/components/DataGrid/subcomponents/Actions/index-BhBvobKS.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-D9Z9YGDb.js +0 -51
- package/components/DynamicFilter/index-CRmtRWlr.js +0 -116
- package/components/DynamicFilter/slots/SlotsEnum-cawFeNzx.js +0 -34
- package/components/DynamicFilter/slots/dynamicFilterSlots-CQiB8TmY.js +0 -151
- package/components/DynamicFilter/slots/index-l0sNRNKZ.js +0 -1
- package/components/DynamicFilter/store/index-DoIifWTk.js +0 -254
- package/components/DynamicFilter/subcomponents/AppliedFilterChip/index-DQESCg04.js +0 -60
- package/components/DynamicFilter/subcomponents/AppliedFilters/index-CGmflaoY.js +0 -26
- package/components/DynamicFilter/subcomponents/DynamicFilterBase/index-BfH6YHNi.js +0 -40
- package/components/DynamicFilter/subcomponents/FieldTypes/BooleanFilter/index-Dv3KjuYK.js +0 -129
- package/components/DynamicFilter/subcomponents/FieldTypes/DateTimeFilter/index-BnhNICK4.js +0 -171
- package/components/DynamicFilter/subcomponents/FieldTypes/NumberFilter/index-CNN6DeHY.js +0 -153
- package/components/DynamicFilter/subcomponents/FieldTypes/SelectFilter/index-C2dNPFtM.js +0 -146
- package/components/DynamicFilter/subcomponents/FieldTypes/StringFilter/index-B03ahaU6.js +0 -114
- package/components/DynamicFilter/subcomponents/FieldTypes/index-EF7A6WnZ.js +0 -38
- package/components/DynamicFilter/subcomponents/FilterActions/index-CQtA2ELu.js +0 -88
- package/components/DynamicFilter/subcomponents/InputFilter/index-EXbXDSZA.js +0 -188
- package/components/DynamicFilter/subcomponents/PopoverFilter/index-BX8YCh9v.js +0 -158
- package/components/DynamicFilter/subcomponents/PopoverMenuFields/index-DvAYf5-a.js +0 -63
- package/components/FieldLabel/index-C8od8D0w.js +0 -54
- package/components/GridLayout/index-EPw3AYiQ.js +0 -1044
- package/components/GridLayout/subcomponents/Griditem/index-B8Q7iMhr.js +0 -395
- package/components/GridLayout/subcomponents/Responsive/index-D6BbBdVx.js +0 -348
- package/components/GridLayout/subcomponents/SizeProvider/index-OhbtnEN4.js +0 -71
- package/components/HelperText/index-sLK3dYG0.js +0 -50
- package/components/Icon/index-BJF_0F6d.js +0 -176
- package/components/Image/index-BxphCFC7.js +0 -175
- package/components/LanguagePopover/index-CkKie1Ph.js +0 -179
- package/components/LinearProgressIndeterminate/index-CTvXOPRx.js +0 -55
- package/components/Loadable/index-BMbi9ISF.js +0 -9
- package/components/LoadingError/index-BaaPhmyF.js +0 -89
- package/components/MFIsolationApp/index-BfHLGDcN.js +0 -169
- package/components/MFLoader/index-B8FmSpE7.js +0 -299
- package/components/ModalDialog/index-WSVr5sZr.js +0 -77
- package/components/NavLink/index-CKgi5l5M.js +0 -55
- package/components/NoItemSelected/index-BKsZKc_f.js +0 -54
- package/components/ObjectLogs/index-BJkjYQaa.js +0 -233
- package/components/PDFViewer/index-Cnbioqzo.js +0 -51
- package/components/Page/index-DSSwuNSp.js +0 -117
- package/components/PaperForm/index-C1OKDnuY.js +0 -59
- package/components/Period/index-DYE7Bj45.js +0 -238
- package/components/PrintingSystem/index-BkfHXcTV.js +0 -187
- package/components/PrintingSystem/subcomponents/BodyNode/index-Btg2zXVQ.js +0 -49
- package/components/PrintingSystem/subcomponents/ChartNode/index-GLjhqKd2.js +0 -105
- package/components/PrintingSystem/subcomponents/DividerNode/index-D9T1MWQd.js +0 -20
- package/components/PrintingSystem/subcomponents/FooterNode/index-C3LET1ZY.js +0 -49
- package/components/PrintingSystem/subcomponents/GridNode/index-BPz7lGvC.js +0 -74
- package/components/PrintingSystem/subcomponents/HeaderNode/index-DY4Yci1r.js +0 -49
- package/components/PrintingSystem/subcomponents/PaperNode/index-BYoGJll5.js +0 -30
- package/components/PrintingSystem/subcomponents/PropertyValueNode/index-vFZ5Skyl.js +0 -47
- package/components/PrintingSystem/subcomponents/SectionNode/index-BNqGWpcj.js +0 -49
- package/components/PrintingSystem/subcomponents/TextBoxNode/index-wgdfWbfF.js +0 -24
- package/components/PropertyValue/index-dwO3Qo0Y.js +0 -264
- package/components/Resizeable/index-CHseEYjL.js +0 -20
- package/components/ScrollBar/index-BYMy_qJE.js +0 -35
- package/components/ScrollToTop/index-TxORk5dB.js +0 -12
- package/components/SideBar/index-DqKD_S9_.js +0 -758
- package/components/SplitLayout/index-D4lxi0ig.js +0 -89
- package/components/ToastContainer/index-jnQcIcV1.js +0 -191
- package/components/WrapperComponent/index-BHV-CsDU.js +0 -14
- package/components/animate/LoadingScreen/index-CTGGa4Yt.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-9dC9NmWv.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-BU9AX60_.js +0 -699
- package/components/areas/components/AreasViewer/index-CPlZxIzK.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-DGguLxcX.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-DBXtbtIu.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-faX1fxjn.js +0 -28
- package/components/commercial/SectionCommercial/index-Dspd2Hd7.js +0 -56
- package/components/commercial/TopBar/index-zACdM_C0.js +0 -232
- package/components/commercial/index-9P0yOdH4.js +0 -81
- package/components/formatters/BooleanFormatter/index-PoFZ3r_m.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-CEJ6VCMb.js +0 -109
- package/components/hook-form/HelperError/index-DRvAkpwm.js +0 -19
- package/components/hook-form/RHFAutocomplete/index-DS57m8AX.js +0 -657
- package/components/hook-form/RHFAutocompleteAsync/index-Bu6NYmG_.js +0 -226
- package/components/hook-form/RHFCheckbox/index-BsB42rRc.js +0 -132
- package/components/hook-form/RHFColorPicker/index-Dox0FPrV.js +0 -191
- package/components/hook-form/RHFDateTime/index-ef19Az1N.js +0 -190
- package/components/hook-form/RHFMultiCheckbox/index-BARudV1A.js +0 -34
- package/components/hook-form/RHFPeriod/index-DyRLTD0w.js +0 -98
- package/components/hook-form/RHFRadioGroup/index-pgTLVF9t.js +0 -52
- package/components/hook-form/RHFSelect/index-LdwRuFz-.js +0 -29
- package/components/hook-form/RHFTextField/index-BgsElxUF.js +0 -337
- package/components/hook-form/RHFUpload/index-B6m3ypzh.js +0 -253
- package/components/maps/components/GpsTools/index-CeLi75XZ.js +0 -1948
- package/components/maps/components/Map/index-D4B8Lfgv.js +0 -2545
- package/components/maps/index-Ci-7-FHg.js +0 -7
- package/components/modal/WindowBase-CkftshqR.js +0 -44
- package/components/modal/WindowConfirm-C5YnzF-B.js +0 -73
- package/components/modal/index-CydPIpKZ.js +0 -65
- package/components/mui_extended/Accordion/index-jF2uxSmi.js +0 -124
- package/components/mui_extended/Avatar/index-CHmsrmfc.js +0 -64
- package/components/mui_extended/Badge/index-B_BGIjkQ.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-CgvCim_g.js +0 -222
- package/components/mui_extended/CheckBox-H73kpinr.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-B8lOMybH.js +0 -117
- package/components/mui_extended/IconButton/styledIconButton-fAsbGoFS.js +0 -7
- package/components/mui_extended/IconButton/types-l0sNRNKZ.js +0 -1
- 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-DA_aS7o5.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-BVp0M8fu.js +0 -47
- package/components/mui_extended/Pager/index-Dtk4aUiU.js +0 -257
- package/components/mui_extended/Popover/index-Dl1PwIS2.js +0 -153
- package/components/mui_extended/Stack/index-CRzpVi2a.js +0 -31
- package/components/mui_extended/Tab/index-DmrsMLOq.js +0 -129
- package/components/mui_extended/ToggleButton/index-CAnHC1N-.js +0 -18
- package/components/mui_extended/Tooltip/index-B8QUytCK.js +0 -42
- package/components/mui_extended/Typography/index-DXq1fG8k.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-CMI1SK_O.js +0 -172
- package/components/popups/PopupsViewer/slots/index-B98CiRLa.js +0 -14
- package/components/popups/PopupsViewer/slots/popupsViewerSlots-DOkmuvnx.js +0 -46
- package/components/popups/index-l0sNRNKZ.js +0 -1
- package/contexts/ModalContext/index-Bp_s1qUm.js +0 -39
- package/contexts/RHFormContext/index-BQ0XWrpK.js +0 -78
- package/hocs/withToggle/index-C1_DMZD3.js +0 -14
- package/hooks/useFormAddEdit/index-dLVQB7hC.js +0 -90
- package/hooks/useFormReadyForUpdate/index-B3HygFCM.js +0 -20
- package/hooks/useModal/index-69rbrQ0v.js +0 -10
- package/hooks/useSizeContainer/index-D4hDjM1P.js +0 -37
- package/hooks/useStateRef/index-C3P6ZK3m.js +0 -15
- package/hooks/useTab/index-DYRxOmMI.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-CqpubQQr.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,129 +0,0 @@
|
|
|
1
|
-
import * as Yup from "yup";
|
|
2
|
-
import { g as getDynamicFilterDictionary, D as DICCTIONARY } from "../../../dictionary-D9Z9YGDb.js";
|
|
3
|
-
import { B as BOOLEAN_OPERATORS } from "../../../constants-ByqmFATV.js";
|
|
4
|
-
import { jsxs, jsx } from "react/jsx-runtime";
|
|
5
|
-
import { useMemo } from "react";
|
|
6
|
-
import { useModuleDictionary } from "@m4l/core";
|
|
7
|
-
import { R as RHFAutocomplete } from "../../../../hook-form/RHFAutocomplete/index-DS57m8AX.js";
|
|
8
|
-
function BooleanFilter() {
|
|
9
|
-
const { getLabel } = useModuleDictionary();
|
|
10
|
-
const operators = useMemo(
|
|
11
|
-
() => BOOLEAN_OPERATORS.map((o) => ({
|
|
12
|
-
id: o,
|
|
13
|
-
label: getLabel(getDynamicFilterDictionary(`operator_${o}`))
|
|
14
|
-
})),
|
|
15
|
-
[getLabel]
|
|
16
|
-
);
|
|
17
|
-
const optionsYesNo = useMemo(
|
|
18
|
-
() => [
|
|
19
|
-
{
|
|
20
|
-
value: true,
|
|
21
|
-
label: getLabel(getDynamicFilterDictionary(DICCTIONARY.operand_true))
|
|
22
|
-
},
|
|
23
|
-
{
|
|
24
|
-
value: false,
|
|
25
|
-
label: getLabel(getDynamicFilterDictionary(DICCTIONARY.operand_false))
|
|
26
|
-
}
|
|
27
|
-
],
|
|
28
|
-
[getLabel]
|
|
29
|
-
);
|
|
30
|
-
return /* @__PURE__ */ jsxs("div", { children: [
|
|
31
|
-
/* @__PURE__ */ jsx(
|
|
32
|
-
RHFAutocomplete,
|
|
33
|
-
{
|
|
34
|
-
type: "text",
|
|
35
|
-
name: "formValueOperator",
|
|
36
|
-
autoComplete: "off",
|
|
37
|
-
options: operators,
|
|
38
|
-
getOptionLabel: (option) => option.label,
|
|
39
|
-
isOptionEqualToValue: (option, value) => option.id === value.id,
|
|
40
|
-
label: getLabel(getDynamicFilterDictionary(DICCTIONARY.label_boolean_operator))
|
|
41
|
-
}
|
|
42
|
-
),
|
|
43
|
-
/* @__PURE__ */ jsx(
|
|
44
|
-
RHFAutocomplete,
|
|
45
|
-
{
|
|
46
|
-
type: "text",
|
|
47
|
-
name: "formValueOperand1",
|
|
48
|
-
autoComplete: "off",
|
|
49
|
-
options: optionsYesNo,
|
|
50
|
-
getOptionLabel: (option) => option.label,
|
|
51
|
-
isOptionEqualToValue: (option, value) => option.value === value.value,
|
|
52
|
-
label: getLabel(getDynamicFilterDictionary(DICCTIONARY.label_boolean_operand1))
|
|
53
|
-
}
|
|
54
|
-
)
|
|
55
|
-
] });
|
|
56
|
-
}
|
|
57
|
-
class BooleanFilterHelpers {
|
|
58
|
-
getComponent() {
|
|
59
|
-
return BooleanFilter;
|
|
60
|
-
}
|
|
61
|
-
getDefaultFilter(field, fixed) {
|
|
62
|
-
const defaultOperand1 = field.defaultOperand1;
|
|
63
|
-
const defaultFilter = {
|
|
64
|
-
id: 0,
|
|
65
|
-
fieldType: "boolean",
|
|
66
|
-
field,
|
|
67
|
-
fixed,
|
|
68
|
-
isSet: true,
|
|
69
|
-
operator: "e",
|
|
70
|
-
operand1: true
|
|
71
|
-
};
|
|
72
|
-
if (defaultOperand1 !== void 0 && typeof defaultOperand1 === "boolean") {
|
|
73
|
-
defaultFilter.operand1 = defaultOperand1;
|
|
74
|
-
}
|
|
75
|
-
return defaultFilter;
|
|
76
|
-
}
|
|
77
|
-
getFilterFromFormValue(formFilterValue) {
|
|
78
|
-
const operator = formFilterValue.formValueOperator.id;
|
|
79
|
-
const operand1 = formFilterValue.formValueOperand1?.value || false;
|
|
80
|
-
return {
|
|
81
|
-
fieldType: "boolean",
|
|
82
|
-
operator,
|
|
83
|
-
operand1
|
|
84
|
-
};
|
|
85
|
-
}
|
|
86
|
-
getFormValue(field, getLabel, filterValue) {
|
|
87
|
-
const filterValueBoolean = filterValue ? filterValue : void 0;
|
|
88
|
-
const operator = filterValueBoolean ? filterValueBoolean.operator : field.defaultOperator ?? "e";
|
|
89
|
-
const formValueOperand1 = filterValueBoolean ? {
|
|
90
|
-
value: filterValueBoolean.operand1,
|
|
91
|
-
label: getLabel(getDynamicFilterDictionary(`operand_${filterValueBoolean.operand1}`))
|
|
92
|
-
} : null;
|
|
93
|
-
return {
|
|
94
|
-
fieldType: "boolean",
|
|
95
|
-
formValueOperator: {
|
|
96
|
-
id: operator,
|
|
97
|
-
label: getLabel(getDynamicFilterDictionary(`operator_${operator}`))
|
|
98
|
-
},
|
|
99
|
-
formValueOperand1
|
|
100
|
-
};
|
|
101
|
-
}
|
|
102
|
-
getLabels(filter, getLabel, _formatters, _field) {
|
|
103
|
-
const labelOperands = filter.operand1 ? getLabel(getDynamicFilterDictionary("operand_true")) : getLabel(getDynamicFilterDictionary("operand_false"));
|
|
104
|
-
return {
|
|
105
|
-
labelField: filter.field.label ?? getLabel(filter.field.dictionaryId),
|
|
106
|
-
labelOperator: getLabel(getDynamicFilterDictionary(`operator_${filter.operator}`)),
|
|
107
|
-
labelOperands
|
|
108
|
-
};
|
|
109
|
-
}
|
|
110
|
-
getSchema(getLabel) {
|
|
111
|
-
return Yup.object({
|
|
112
|
-
formValueOperator: Yup.object().nullable().required(getLabel(`dynamic_filter.error_operator_required`)),
|
|
113
|
-
formValueOperand1: Yup.object().nullable().required(getLabel(`dynamic_filter.error_operand_required`))
|
|
114
|
-
});
|
|
115
|
-
}
|
|
116
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
117
|
-
verifyFilter(filter, _field) {
|
|
118
|
-
if (typeof filter.operator !== "string") {
|
|
119
|
-
return false;
|
|
120
|
-
}
|
|
121
|
-
if (BOOLEAN_OPERATORS.findIndex((f) => f === filter.operator) === -1) {
|
|
122
|
-
return false;
|
|
123
|
-
}
|
|
124
|
-
return typeof filter.operand1 === "boolean";
|
|
125
|
-
}
|
|
126
|
-
}
|
|
127
|
-
export {
|
|
128
|
-
BooleanFilterHelpers as B
|
|
129
|
-
};
|
|
@@ -1,171 +0,0 @@
|
|
|
1
|
-
import * as Yup from "yup";
|
|
2
|
-
import { g as getDynamicFilterDictionary, D as DICCTIONARY } from "../../../dictionary-D9Z9YGDb.js";
|
|
3
|
-
import { a as DATE_TIME_OPERATORS } from "../../../constants-ByqmFATV.js";
|
|
4
|
-
import { jsxs, jsx } from "react/jsx-runtime";
|
|
5
|
-
import { useMemo } from "react";
|
|
6
|
-
import { useFormContext, useWatch } from "react-hook-form";
|
|
7
|
-
import { useModuleDictionary } from "@m4l/core";
|
|
8
|
-
import { R as RHFAutocomplete } from "../../../../hook-form/RHFAutocomplete/index-DS57m8AX.js";
|
|
9
|
-
import { R as RHFDateTime } from "../../../../hook-form/RHFDateTime/index-ef19Az1N.js";
|
|
10
|
-
import { i as isValidDate } from "../../../../../utils/index-DiMrtgIu.js";
|
|
11
|
-
function DateTimeFilter() {
|
|
12
|
-
const { getLabel } = useModuleDictionary();
|
|
13
|
-
const { control } = useFormContext();
|
|
14
|
-
const operator = useWatch({
|
|
15
|
-
control,
|
|
16
|
-
name: "formValueOperator"
|
|
17
|
-
});
|
|
18
|
-
const operators = useMemo(
|
|
19
|
-
() => DATE_TIME_OPERATORS.map((o) => ({
|
|
20
|
-
id: o,
|
|
21
|
-
label: getLabel(getDynamicFilterDictionary(`operator_${o}`))
|
|
22
|
-
})),
|
|
23
|
-
[getLabel]
|
|
24
|
-
);
|
|
25
|
-
return /* @__PURE__ */ jsxs("div", { children: [
|
|
26
|
-
/* @__PURE__ */ jsx(
|
|
27
|
-
RHFAutocomplete,
|
|
28
|
-
{
|
|
29
|
-
type: "text",
|
|
30
|
-
name: "formValueOperator",
|
|
31
|
-
autoComplete: "off",
|
|
32
|
-
options: operators,
|
|
33
|
-
getOptionLabel: (option) => option.label,
|
|
34
|
-
isOptionEqualToValue: (option, value) => option.id === value.id,
|
|
35
|
-
label: getLabel(getDynamicFilterDictionary(DICCTIONARY.label_operator_date_time))
|
|
36
|
-
}
|
|
37
|
-
),
|
|
38
|
-
/* @__PURE__ */ jsx(
|
|
39
|
-
RHFDateTime,
|
|
40
|
-
{
|
|
41
|
-
name: "formValueOperand1",
|
|
42
|
-
label: getLabel(getDynamicFilterDictionary(DICCTIONARY.label_operand1_date_time))
|
|
43
|
-
}
|
|
44
|
-
),
|
|
45
|
-
operator && operator.id === "b" && /* @__PURE__ */ jsx(
|
|
46
|
-
RHFDateTime,
|
|
47
|
-
{
|
|
48
|
-
name: "formValueOperand2",
|
|
49
|
-
label: getLabel(getDynamicFilterDictionary(DICCTIONARY.label_operand2_date_time))
|
|
50
|
-
}
|
|
51
|
-
)
|
|
52
|
-
] });
|
|
53
|
-
}
|
|
54
|
-
class DateTimeFilterHelpers {
|
|
55
|
-
getComponent() {
|
|
56
|
-
return DateTimeFilter;
|
|
57
|
-
}
|
|
58
|
-
getDefaultFilter(field, fixed) {
|
|
59
|
-
const defaultStartDate = /* @__PURE__ */ new Date();
|
|
60
|
-
const defaultEndDate = /* @__PURE__ */ new Date();
|
|
61
|
-
defaultStartDate.setHours(0, 0, 0, 0);
|
|
62
|
-
defaultEndDate.setHours(23, 59, 59, 999);
|
|
63
|
-
const defaultOperand1 = field.defaultOperand1 && field.defaultOperand1 instanceof Date ? field.defaultOperand1 : defaultStartDate;
|
|
64
|
-
const defaultOperand2 = field.defaultOperand2 && field.defaultOperand2 instanceof Date ? field.defaultOperand2 : defaultEndDate;
|
|
65
|
-
return {
|
|
66
|
-
id: 0,
|
|
67
|
-
fieldType: "datetime",
|
|
68
|
-
field,
|
|
69
|
-
fixed,
|
|
70
|
-
isSet: true,
|
|
71
|
-
operator: "b",
|
|
72
|
-
operand1: defaultOperand1,
|
|
73
|
-
operand2: defaultOperand2
|
|
74
|
-
};
|
|
75
|
-
}
|
|
76
|
-
getFormValue(field, getLabel, filterValueDateTime) {
|
|
77
|
-
const filterValue = filterValueDateTime;
|
|
78
|
-
const operator = filterValue ? filterValue.operator : field.defaultOperator ?? "b";
|
|
79
|
-
const defaultStartDate = /* @__PURE__ */ new Date();
|
|
80
|
-
const defaultEndDate = /* @__PURE__ */ new Date();
|
|
81
|
-
const defaultOperand1 = field.defaultOperand1 && field.defaultOperand1 instanceof Date ? field.defaultOperand1 : defaultStartDate;
|
|
82
|
-
const defaultOperand2 = field.defaultOperand2 && field.defaultOperand2 instanceof Date ? field.defaultOperand2 : defaultEndDate;
|
|
83
|
-
const formValueOperand1 = filterValue ? filterValue.operand1 : defaultOperand1;
|
|
84
|
-
const formValueOperand2 = filterValue && filterValue.operator === "b" ? filterValue.operand2 : defaultOperand2;
|
|
85
|
-
return {
|
|
86
|
-
fieldType: "datetime",
|
|
87
|
-
formValueOperator: {
|
|
88
|
-
id: operator,
|
|
89
|
-
label: getLabel(getDynamicFilterDictionary(`operator_${operator}`))
|
|
90
|
-
},
|
|
91
|
-
formValueOperand1,
|
|
92
|
-
formValueOperand2
|
|
93
|
-
};
|
|
94
|
-
}
|
|
95
|
-
getFilterFromFormValue(formFilterValue) {
|
|
96
|
-
const operator = formFilterValue.formValueOperator.id;
|
|
97
|
-
const operand1 = formFilterValue.formValueOperand1;
|
|
98
|
-
if (operator === "b") {
|
|
99
|
-
const operand2 = formFilterValue.formValueOperand2;
|
|
100
|
-
return {
|
|
101
|
-
fieldType: "datetime",
|
|
102
|
-
operator,
|
|
103
|
-
operand1,
|
|
104
|
-
operand2
|
|
105
|
-
};
|
|
106
|
-
} else {
|
|
107
|
-
return {
|
|
108
|
-
fieldType: "datetime",
|
|
109
|
-
operator,
|
|
110
|
-
operand1
|
|
111
|
-
};
|
|
112
|
-
}
|
|
113
|
-
}
|
|
114
|
-
getLabels(filter, getLabel, formatters, _field) {
|
|
115
|
-
const { dateFormatter } = formatters;
|
|
116
|
-
let labelOperands;
|
|
117
|
-
if (filter.operator === "b") {
|
|
118
|
-
labelOperands = filter.operand1 && filter.operand2 ? `${dateFormatter.formatDate(
|
|
119
|
-
filter.operand1,
|
|
120
|
-
dateFormatter.datetimeFormat
|
|
121
|
-
)} - ${dateFormatter.formatDate(filter.operand2, dateFormatter.datetimeFormat)}` : "";
|
|
122
|
-
} else {
|
|
123
|
-
labelOperands = filter.operand1 ? dateFormatter.formatDate(filter.operand1, dateFormatter.datetimeFormat) : "";
|
|
124
|
-
}
|
|
125
|
-
return {
|
|
126
|
-
labelField: filter.field.label ?? getLabel(filter.field.dictionaryId),
|
|
127
|
-
labelOperator: getLabel(getDynamicFilterDictionary(`operator_${filter.operator}`)),
|
|
128
|
-
labelOperands
|
|
129
|
-
};
|
|
130
|
-
}
|
|
131
|
-
getSchema(getLabel) {
|
|
132
|
-
return Yup.object({
|
|
133
|
-
formValueOperator: Yup.object().nullable().required(getLabel(getDynamicFilterDictionary(DICCTIONARY.operator_required))),
|
|
134
|
-
formValueOperand1: Yup.date().required(getLabel(getDynamicFilterDictionary(DICCTIONARY.error_invalid_date))).typeError(getLabel(getDynamicFilterDictionary(DICCTIONARY.error_invalid_date))),
|
|
135
|
-
formValueOperand2: Yup.mixed().when(["formValueOperator.id"], {
|
|
136
|
-
is: "b",
|
|
137
|
-
then: Yup.date().typeError(getLabel(getDynamicFilterDictionary(DICCTIONARY.error_invalid_date))).min(
|
|
138
|
-
Yup.ref("formValueOperand1"),
|
|
139
|
-
getLabel(getDynamicFilterDictionary(DICCTIONARY.error_invalid_date))
|
|
140
|
-
)
|
|
141
|
-
})
|
|
142
|
-
});
|
|
143
|
-
}
|
|
144
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
145
|
-
verifyFilter(filter, _field) {
|
|
146
|
-
if (typeof filter.operator !== "string") {
|
|
147
|
-
return false;
|
|
148
|
-
}
|
|
149
|
-
if (DATE_TIME_OPERATORS.findIndex((f) => f === filter.operator) === -1) {
|
|
150
|
-
return false;
|
|
151
|
-
}
|
|
152
|
-
if (typeof filter.operand1 !== "string") {
|
|
153
|
-
return false;
|
|
154
|
-
}
|
|
155
|
-
if (!isValidDate(new Date(filter.operand1))) {
|
|
156
|
-
return false;
|
|
157
|
-
}
|
|
158
|
-
if (filter.operator === "b") {
|
|
159
|
-
if (typeof filter.operand2 !== "string") {
|
|
160
|
-
return false;
|
|
161
|
-
}
|
|
162
|
-
if (!isValidDate(new Date(filter.operand1))) {
|
|
163
|
-
return false;
|
|
164
|
-
}
|
|
165
|
-
}
|
|
166
|
-
return true;
|
|
167
|
-
}
|
|
168
|
-
}
|
|
169
|
-
export {
|
|
170
|
-
DateTimeFilterHelpers as D
|
|
171
|
-
};
|
|
@@ -1,153 +0,0 @@
|
|
|
1
|
-
import * as Yup from "yup";
|
|
2
|
-
import { g as getDynamicFilterDictionary, D as DICCTIONARY } from "../../../dictionary-D9Z9YGDb.js";
|
|
3
|
-
import { jsxs, jsx } from "react/jsx-runtime";
|
|
4
|
-
import { useMemo } from "react";
|
|
5
|
-
import { useFormContext, useWatch } from "react-hook-form";
|
|
6
|
-
import { useModuleDictionary } from "@m4l/core";
|
|
7
|
-
import { N as NUMBER_OPERATORS } from "../../../constants-ByqmFATV.js";
|
|
8
|
-
import { R as RHFAutocomplete } from "../../../../hook-form/RHFAutocomplete/index-DS57m8AX.js";
|
|
9
|
-
import { R as RHFTextField } from "../../../../hook-form/RHFTextField/index-BgsElxUF.js";
|
|
10
|
-
function NumberFilter() {
|
|
11
|
-
const { getLabel } = useModuleDictionary();
|
|
12
|
-
const { control } = useFormContext();
|
|
13
|
-
const operator = useWatch({
|
|
14
|
-
control,
|
|
15
|
-
name: "formValueOperator"
|
|
16
|
-
});
|
|
17
|
-
const operators = useMemo(
|
|
18
|
-
() => NUMBER_OPERATORS.map((o) => ({
|
|
19
|
-
id: o,
|
|
20
|
-
label: getLabel(getDynamicFilterDictionary(`operator_${o}`))
|
|
21
|
-
})),
|
|
22
|
-
[getLabel]
|
|
23
|
-
);
|
|
24
|
-
return /* @__PURE__ */ jsxs("div", { children: [
|
|
25
|
-
/* @__PURE__ */ jsx(
|
|
26
|
-
RHFAutocomplete,
|
|
27
|
-
{
|
|
28
|
-
type: "text",
|
|
29
|
-
name: "formValueOperator",
|
|
30
|
-
autoComplete: "off",
|
|
31
|
-
options: operators,
|
|
32
|
-
getOptionLabel: (option) => option.label,
|
|
33
|
-
isOptionEqualToValue: (option, value) => option.id === value.id,
|
|
34
|
-
label: getLabel(getDynamicFilterDictionary(DICCTIONARY.label_operator_number))
|
|
35
|
-
}
|
|
36
|
-
),
|
|
37
|
-
/* @__PURE__ */ jsx(
|
|
38
|
-
RHFTextField,
|
|
39
|
-
{
|
|
40
|
-
name: "formValueOperand1",
|
|
41
|
-
type: "number",
|
|
42
|
-
label: getLabel(getDynamicFilterDictionary(DICCTIONARY.label_operand1_number))
|
|
43
|
-
}
|
|
44
|
-
),
|
|
45
|
-
operator && operator.id === "b" && /* @__PURE__ */ jsx(
|
|
46
|
-
RHFTextField,
|
|
47
|
-
{
|
|
48
|
-
name: "formValueOperand2",
|
|
49
|
-
type: "number",
|
|
50
|
-
label: getLabel(getDynamicFilterDictionary(DICCTIONARY.label_operand2_number))
|
|
51
|
-
}
|
|
52
|
-
)
|
|
53
|
-
] });
|
|
54
|
-
}
|
|
55
|
-
class NumberFilterHelpers {
|
|
56
|
-
getComponent() {
|
|
57
|
-
return NumberFilter;
|
|
58
|
-
}
|
|
59
|
-
getDefaultFilter(fieldNumber, fixed) {
|
|
60
|
-
const field = fieldNumber;
|
|
61
|
-
const dOperator = field.defaultOperator ?? "e";
|
|
62
|
-
const defaultOperand1 = field.defaultOperand1 ?? null;
|
|
63
|
-
const defaultOperand2 = field.defaultOperand2 ?? null;
|
|
64
|
-
return {
|
|
65
|
-
id: 0,
|
|
66
|
-
fieldType: "number",
|
|
67
|
-
field,
|
|
68
|
-
fixed,
|
|
69
|
-
isSet: false,
|
|
70
|
-
operator: dOperator,
|
|
71
|
-
operand1: defaultOperand1,
|
|
72
|
-
operand2: defaultOperand2
|
|
73
|
-
};
|
|
74
|
-
}
|
|
75
|
-
getFormValue(field, getLabel, filterValue) {
|
|
76
|
-
const filterValueNumber = filterValue;
|
|
77
|
-
const operator = filterValueNumber ? filterValueNumber.operator : field.defaultOperator ?? "e";
|
|
78
|
-
const formValueOperand1 = filterValueNumber ? filterValueNumber.operand1 : null;
|
|
79
|
-
const formValueOperand2 = filterValueNumber && filterValueNumber?.operator === "b" ? filterValueNumber.operand2 : null;
|
|
80
|
-
return {
|
|
81
|
-
fieldType: "number",
|
|
82
|
-
formValueOperator: {
|
|
83
|
-
id: operator,
|
|
84
|
-
label: getLabel(getDynamicFilterDictionary(`operator_${operator}`))
|
|
85
|
-
},
|
|
86
|
-
formValueOperand1,
|
|
87
|
-
formValueOperand2
|
|
88
|
-
};
|
|
89
|
-
}
|
|
90
|
-
getFilterFromFormValue(formFilterValue) {
|
|
91
|
-
const operator = formFilterValue.formValueOperator.id;
|
|
92
|
-
const operand1 = formFilterValue.formValueOperand1 ? formFilterValue.formValueOperand1 : 0;
|
|
93
|
-
if (operator === "b") {
|
|
94
|
-
const operand2 = formFilterValue.formValueOperand2 ? formFilterValue.formValueOperand2 : 0;
|
|
95
|
-
return {
|
|
96
|
-
fieldType: "number",
|
|
97
|
-
operator,
|
|
98
|
-
operand1,
|
|
99
|
-
operand2
|
|
100
|
-
};
|
|
101
|
-
} else {
|
|
102
|
-
return {
|
|
103
|
-
fieldType: "number",
|
|
104
|
-
operator,
|
|
105
|
-
operand1
|
|
106
|
-
};
|
|
107
|
-
}
|
|
108
|
-
}
|
|
109
|
-
getLabels(filter, getLabel, _formatters, _field) {
|
|
110
|
-
let labelOperands;
|
|
111
|
-
if (filter.operator === "b") {
|
|
112
|
-
labelOperands = filter.operand1 && filter.operand2 ? `${filter.operand1} - ${filter.operand2}` : "";
|
|
113
|
-
} else {
|
|
114
|
-
labelOperands = filter.operand1 !== void 0 ? filter.operand1 + "" : "";
|
|
115
|
-
}
|
|
116
|
-
return {
|
|
117
|
-
labelField: filter.field.label ?? getLabel(filter.field.dictionaryId),
|
|
118
|
-
labelOperator: getLabel(getDynamicFilterDictionary(`operator_${filter.operator}`)),
|
|
119
|
-
labelOperands
|
|
120
|
-
};
|
|
121
|
-
}
|
|
122
|
-
getSchema(getLabel) {
|
|
123
|
-
return Yup.object({
|
|
124
|
-
formValueOperator: Yup.object().nullable().required(getLabel(`dynamic_filter.error_operator_required`)),
|
|
125
|
-
formValueOperand1: Yup.number().typeError(
|
|
126
|
-
getLabel(`dynamic_filter.error_operand_mustbe_number`)
|
|
127
|
-
),
|
|
128
|
-
formValueOperand2: Yup.mixed().when(["formValueOperator.id"], {
|
|
129
|
-
is: "b",
|
|
130
|
-
then: Yup.number().typeError(getLabel(`dynamic_filter.error_operand_mustbe_number`)).min(Yup.ref("formValueOperand1"), getLabel(`dynamic_filter.error_less_than_start`))
|
|
131
|
-
})
|
|
132
|
-
});
|
|
133
|
-
}
|
|
134
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
135
|
-
verifyFilter(filter, _field) {
|
|
136
|
-
if (typeof filter.operator !== "number") {
|
|
137
|
-
return false;
|
|
138
|
-
}
|
|
139
|
-
if (NUMBER_OPERATORS.findIndex((f) => f === filter.operator) === -1) {
|
|
140
|
-
return false;
|
|
141
|
-
}
|
|
142
|
-
if (typeof filter.operand1 !== "number") {
|
|
143
|
-
return false;
|
|
144
|
-
}
|
|
145
|
-
if (filter.operator === "b" && typeof filter.operand2 !== "number") {
|
|
146
|
-
return false;
|
|
147
|
-
}
|
|
148
|
-
return true;
|
|
149
|
-
}
|
|
150
|
-
}
|
|
151
|
-
export {
|
|
152
|
-
NumberFilterHelpers as N
|
|
153
|
-
};
|
|
@@ -1,146 +0,0 @@
|
|
|
1
|
-
import * as Yup from "yup";
|
|
2
|
-
import { g as getDynamicFilterDictionary, D as DICCTIONARY } from "../../../dictionary-D9Z9YGDb.js";
|
|
3
|
-
import { jsxs, jsx } from "react/jsx-runtime";
|
|
4
|
-
import { useMemo } from "react";
|
|
5
|
-
import { useModuleDictionary } from "@m4l/core";
|
|
6
|
-
import { S as SELECT_OPERATORS } from "../../../constants-ByqmFATV.js";
|
|
7
|
-
import { u as useDynamicFilterStore } from "../../../store/index-DoIifWTk.js";
|
|
8
|
-
import { R as RHFAutocomplete } from "../../../../hook-form/RHFAutocomplete/index-DS57m8AX.js";
|
|
9
|
-
import { R as RHFAutocompleteAsync } from "../../../../hook-form/RHFAutocompleteAsync/index-Bu6NYmG_.js";
|
|
10
|
-
function SelectFilter() {
|
|
11
|
-
const { getLabel } = useModuleDictionary();
|
|
12
|
-
const field = useDynamicFilterStore((state) => state.popoverFilterData?.field);
|
|
13
|
-
if (!field?.selectOptions?.endPoint) {
|
|
14
|
-
throw new Error("El filtro tipo Select requiere la configuración del Endpoint");
|
|
15
|
-
}
|
|
16
|
-
const autocompleteProps = field?.selectOptions;
|
|
17
|
-
const operators = useMemo(
|
|
18
|
-
() => SELECT_OPERATORS.map((o) => ({
|
|
19
|
-
id: o,
|
|
20
|
-
label: getLabel(getDynamicFilterDictionary(`operator_${o}`))
|
|
21
|
-
})),
|
|
22
|
-
[getLabel]
|
|
23
|
-
);
|
|
24
|
-
return /* @__PURE__ */ jsxs("div", { children: [
|
|
25
|
-
/* @__PURE__ */ jsx(
|
|
26
|
-
RHFAutocomplete,
|
|
27
|
-
{
|
|
28
|
-
type: "text",
|
|
29
|
-
name: "formValueOperator",
|
|
30
|
-
autoComplete: "off",
|
|
31
|
-
options: operators,
|
|
32
|
-
getOptionLabel: (option) => option.label,
|
|
33
|
-
isOptionEqualToValue: (option, value) => option.id === value.id,
|
|
34
|
-
label: getLabel(getDynamicFilterDictionary(DICCTIONARY.label_select_operator))
|
|
35
|
-
}
|
|
36
|
-
),
|
|
37
|
-
/* @__PURE__ */ jsx(
|
|
38
|
-
RHFAutocompleteAsync,
|
|
39
|
-
{
|
|
40
|
-
...autocompleteProps,
|
|
41
|
-
name: "formValueOperandsArray",
|
|
42
|
-
autoComplete: "off",
|
|
43
|
-
label: getLabel(getDynamicFilterDictionary(DICCTIONARY.label_select_operands_array))
|
|
44
|
-
}
|
|
45
|
-
)
|
|
46
|
-
] });
|
|
47
|
-
}
|
|
48
|
-
function filterValidOperandsArraySelect(operandsArray, field) {
|
|
49
|
-
const operandsArrayFormatted = Array.isArray(operandsArray) ? operandsArray : [operandsArray];
|
|
50
|
-
const getOptionId = field?.selectOptions?.getOptionId;
|
|
51
|
-
const getOptionLabel = field?.selectOptions?.getOptionLabel;
|
|
52
|
-
return operandsArrayFormatted?.filter((operand) => {
|
|
53
|
-
return typeof operand === "object" && getOptionId?.(operand) && getOptionLabel?.(operand);
|
|
54
|
-
});
|
|
55
|
-
}
|
|
56
|
-
class SelectFilterHelpers {
|
|
57
|
-
getComponent() {
|
|
58
|
-
return SelectFilter;
|
|
59
|
-
}
|
|
60
|
-
getDefaultFilter(field, fixed) {
|
|
61
|
-
const defaultOperand = field.defaultOperandsArray;
|
|
62
|
-
const defaultFilter = {
|
|
63
|
-
id: 0,
|
|
64
|
-
fieldType: "select",
|
|
65
|
-
field,
|
|
66
|
-
fixed,
|
|
67
|
-
isSet: true,
|
|
68
|
-
operator: "in",
|
|
69
|
-
operandsArray: []
|
|
70
|
-
};
|
|
71
|
-
if (defaultOperand !== void 0 && Array.isArray(defaultOperand)) {
|
|
72
|
-
const validOperandsArray = filterValidOperandsArraySelect(defaultOperand, field);
|
|
73
|
-
defaultFilter.operandsArray = validOperandsArray || [];
|
|
74
|
-
}
|
|
75
|
-
return defaultFilter;
|
|
76
|
-
}
|
|
77
|
-
getFormValue(field, getLabel, filterValueSelect) {
|
|
78
|
-
const filterValue = filterValueSelect ? filterValueSelect : void 0;
|
|
79
|
-
const isMultiple = field?.selectOptions?.multiple ?? false;
|
|
80
|
-
const formValueOperandsArray = isMultiple ? filterValueSelect?.operandsArray : filterValueSelect?.operandsArray?.[0] || filterValueSelect?.operandsArray;
|
|
81
|
-
const operator = filterValue ? filterValue.operator : field.defaultOperator ?? "in";
|
|
82
|
-
return {
|
|
83
|
-
fieldType: "select",
|
|
84
|
-
formValueOperator: {
|
|
85
|
-
id: operator,
|
|
86
|
-
label: getLabel(getDynamicFilterDictionary(`operator_${operator}`))
|
|
87
|
-
},
|
|
88
|
-
formValueOperandsArray
|
|
89
|
-
};
|
|
90
|
-
}
|
|
91
|
-
getFilterFromFormValue(formFilterValue) {
|
|
92
|
-
const operator = formFilterValue.formValueOperator.id;
|
|
93
|
-
const operandsArray = Array.isArray(formFilterValue.formValueOperandsArray) ? formFilterValue.formValueOperandsArray : [formFilterValue.formValueOperandsArray];
|
|
94
|
-
return {
|
|
95
|
-
fieldType: "select",
|
|
96
|
-
operator,
|
|
97
|
-
operandsArray
|
|
98
|
-
};
|
|
99
|
-
}
|
|
100
|
-
getLabels(filter, getLabel, _formatters, field) {
|
|
101
|
-
const operandsArray = filter.operandsArray;
|
|
102
|
-
const labelOperands = operandsArray?.reduce?.((label, operand) => {
|
|
103
|
-
const textLabel = field.selectOptions?.getOptionLabel?.(operand) || "";
|
|
104
|
-
return label ? `${label} | ${textLabel}` : textLabel;
|
|
105
|
-
}, "")?.toString() || "";
|
|
106
|
-
return {
|
|
107
|
-
labelField: filter.field.label ?? getLabel(filter.field.dictionaryId),
|
|
108
|
-
labelOperator: getLabel(getDynamicFilterDictionary(`operator_${filter.operator}`)),
|
|
109
|
-
labelOperands
|
|
110
|
-
};
|
|
111
|
-
}
|
|
112
|
-
getSchema(getLabel) {
|
|
113
|
-
return Yup.object({
|
|
114
|
-
formValueOperator: Yup.object().nullable().required(getLabel(`dynamic_filter.error_operator_required`)),
|
|
115
|
-
formValueOperandsArray: Yup.lazy((value) => {
|
|
116
|
-
return Array.isArray(value) ? Yup.array().min(1, getLabel(`dynamic_filter.error_operand_required`)).of(Yup.object().nullable()).required(getLabel(`dynamic_filter.error_operand_required`)) : Yup.object().nullable().required(getLabel(`dynamic_filter.error_operand_required`));
|
|
117
|
-
})
|
|
118
|
-
});
|
|
119
|
-
}
|
|
120
|
-
verifyFilter(filter, field) {
|
|
121
|
-
if (typeof filter.operator !== "string") {
|
|
122
|
-
return false;
|
|
123
|
-
}
|
|
124
|
-
if (!field) {
|
|
125
|
-
return false;
|
|
126
|
-
}
|
|
127
|
-
if (SELECT_OPERATORS.findIndex((f) => f === filter.operator) === -1) {
|
|
128
|
-
return false;
|
|
129
|
-
}
|
|
130
|
-
if (!filter.operandsArray || typeof filter.operandsArray !== "object") {
|
|
131
|
-
return false;
|
|
132
|
-
}
|
|
133
|
-
const validOperandsArray = filterValidOperandsArraySelect(
|
|
134
|
-
filter.operandsArray,
|
|
135
|
-
field
|
|
136
|
-
);
|
|
137
|
-
if (!validOperandsArray || validOperandsArray?.length === 0) {
|
|
138
|
-
return false;
|
|
139
|
-
}
|
|
140
|
-
return true;
|
|
141
|
-
}
|
|
142
|
-
}
|
|
143
|
-
export {
|
|
144
|
-
SelectFilterHelpers as S,
|
|
145
|
-
filterValidOperandsArraySelect as f
|
|
146
|
-
};
|