@m4l/components 1.0.16 → 1.0.17

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (73) hide show
  1. package/components/AccountPopover/{index.97a78be9.js → index.f2226cb9.js} +1 -1
  2. package/components/AppBar/{index.47dbe6f1.js → index.50d090b7.js} +1 -1
  3. package/components/CommonActions/components/ActionFormCancel/{index.ad1b361f.js → index.03a5915a.js} +1 -1
  4. package/components/DataGrid/formatters/ColumnBooleanFormatter/{index.3e0b387f.js → index.e0dbec18.js} +1 -1
  5. package/components/DataGrid/formatters/ColumnConcatenatedValueFormatter/{index.f33eb24e.js → index.671116f2.js} +1 -1
  6. package/components/DataGrid/formatters/ColumnInteractiveCheckFormatter/{index.381342ab.js → index.f7b20493.js} +1 -1
  7. package/components/DataGrid/{index.804af87c.js → index.447c4e44.js} +2 -2
  8. package/components/DataGrid/subcomponents/Actions/{index.7421063b.js → index.aff74341.js} +6 -6
  9. package/components/DragResizeWindow/{index.c957a1e6.js → index.132406ef.js} +2 -2
  10. package/components/DynamicFilter/{constants.1dddd09c.js → constants.095f1dbb.js} +4 -4
  11. package/components/DynamicFilter/{dictionary.3b52457e.js → dictionary.80fc7baf.js} +1 -1
  12. package/components/DynamicFilter/{index.107ff9cd.js → index.a7cb7710.js} +106 -3
  13. package/components/DynamicFilter/slots/{index.1590336a.js → index.e2218307.js} +4 -4
  14. package/components/DynamicFilter/store/{index.17676a1e.js → index.b9c2fe0b.js} +2 -2
  15. package/components/DynamicFilter/subcomponents/AppliedFilterChip/{index.99e063cc.js → index.f0fe22f7.js} +3 -3
  16. package/components/DynamicFilter/subcomponents/AppliedFilters/{index.883e90f5.js → index.30d89b6c.js} +3 -3
  17. package/components/DynamicFilter/subcomponents/DynamicFilterBase/{index.909c1836.js → index.edd7ed6f.js} +6 -6
  18. package/components/DynamicFilter/subcomponents/FieldTypes/BooleanFilter/index.f926af49.js +126 -0
  19. package/components/DynamicFilter/subcomponents/FieldTypes/DateTimeFilter/index.2382297a.js +169 -0
  20. package/components/DynamicFilter/subcomponents/FieldTypes/NumberFilter/index.7b4dccf7.js +151 -0
  21. package/components/DynamicFilter/subcomponents/FieldTypes/SelectFilter/index.2258fceb.js +145 -0
  22. package/components/DynamicFilter/subcomponents/FieldTypes/StringFilter/index.82ca3e32.js +112 -0
  23. package/components/DynamicFilter/subcomponents/FieldTypes/{index.339d175f.js → index.f4457f31.js} +5 -1
  24. package/components/DynamicFilter/subcomponents/FilterActions/{index.c549da68.js → index.ba70cf6a.js} +3 -3
  25. package/components/DynamicFilter/subcomponents/InputFilter/{index.ce036c20.js → index.c7d72fb4.js} +5 -5
  26. package/components/DynamicFilter/subcomponents/PopoverFilter/{index.3655469c.js → index.c2014303.js} +3 -3
  27. package/components/DynamicFilter/subcomponents/PopoverMenuFields/{index.50fc58b0.js → index.895fbe45.js} +2 -2
  28. package/components/FieldLabel/{index.e951e11f.js → index.9fd6697a.js} +1 -1
  29. package/components/Icon/{index.9615b1f6.js → index.5cf594aa.js} +2 -2
  30. package/components/LoadingError/{index.2cdebf59.js → index.427a569c.js} +1 -1
  31. package/components/MFLoader/{index.fb82993d.js → index.12ccba1a.js} +1 -1
  32. package/components/ObjectLogs/{index.6bd7a872.js → index.a3ed9816.js} +5 -5
  33. package/components/PaperForm/{index.afbd86d1.js → index.9ed65352.js} +1 -1
  34. package/components/Period/{index.a6ea5000.js → index.78867b45.js} +1 -1
  35. package/components/PropertyValue/{index.914a6cad.js → index.4f0da54d.js} +2 -2
  36. package/components/SideBar/{index.a25eaad8.js → index.0298ead4.js} +2 -2
  37. package/components/ToastContainer/{index.d2064c6b.js → index.e6d48658.js} +1 -1
  38. package/components/areas/components/AreasAdmin/{index.15bd47d9.js → index.5af510af.js} +5 -5
  39. package/components/areas/components/AreasViewer/{index.316d5487.js → index.343f0452.js} +7 -7
  40. package/components/areas/contexts/AreasContext/{index.765faaee.js → index.91e1acfc.js} +2 -2
  41. package/components/areas/hooks/useAreas/{index.1b499976.js → index.98ea6788.js} +1 -1
  42. package/components/commercial/TopBar/{index.c55da9c3.js → index.df994f5f.js} +2 -2
  43. package/components/commercial/{index.1248a029.js → index.73cf794c.js} +2 -2
  44. package/components/formatters/BooleanFormatter/{index.117465b4.js → index.699e0aee.js} +2 -2
  45. package/components/formatters/{index.a8f46cab.js → index.8abccc30.js} +1 -1
  46. package/components/hook-form/RHFAutocomplete/{index.709756f6.js → index.1efaddc9.js} +2 -2
  47. package/components/hook-form/RHFAutocompleteAsync/{index.92180d10.js → index.2f123535.js} +1 -1
  48. package/components/hook-form/RHFCheckbox/{index.8c3ed4a0.js → index.a9cf6faf.js} +1 -1
  49. package/components/hook-form/RHFColorPicker/{index.fe1a3466.js → index.963323e4.js} +2 -2
  50. package/components/hook-form/RHFDateTime/{index.07030dcc.js → index.b3d0b2de.js} +2 -2
  51. package/components/hook-form/RHFPeriod/{index.755de1db.js → index.d1f45273.js} +2 -2
  52. package/components/hook-form/RHFTextField/{index.e1c51719.js → index.97ba17ae.js} +2 -2
  53. package/components/maps/components/GpsTools/{index.a8ece5d5.js → index.0c6dff10.js} +11 -11
  54. package/components/maps/components/Map/{index.e4045b3e.js → index.50447504.js} +8 -8
  55. package/components/modal/{WindowBase.2f606ead.js → WindowBase.bf119f28.js} +2 -2
  56. package/components/modal/{WindowConfirm.6eea8ea6.js → WindowConfirm.b70c4b0f.js} +1 -1
  57. package/components/mui_extended/Accordion/{index.c4551873.js → index.427d380a.js} +2 -2
  58. package/components/mui_extended/{CheckBox.09cbd444.js → CheckBox.84c57702.js} +1 -1
  59. package/components/mui_extended/IconButton/{index.47be7d35.js → index.ee45bba2.js} +1 -1
  60. package/components/mui_extended/MenuActions/{index.ab55b9b7.js → index.06aaa091.js} +2 -2
  61. package/components/mui_extended/Pager/{index.a453d8b5.js → index.c77a7694.js} +2 -2
  62. package/components/mui_extended/ToggleIconButton/{index.61269519.js → index.50ce11e4.js} +1 -1
  63. package/components/popups/PopupsProvider/{index.88f09c2a.js → index.7ed83556.js} +1 -1
  64. package/components/popups/PopupsViewer/{index.e80c69c5.js → index.9b734a0a.js} +4 -4
  65. package/hooks/useFormAddEdit/{index.d718efd0.js → index.3468c18c.js} +1 -1
  66. package/index.js +65 -66
  67. package/package.json +1 -1
  68. package/components/DynamicFilter/helpers/index.32ea6e4a.js +0 -562
  69. package/components/DynamicFilter/subcomponents/FieldTypes/BooleanFilter/index.b718be41.js +0 -56
  70. package/components/DynamicFilter/subcomponents/FieldTypes/DateTimeFilter/index.d44591da.js +0 -53
  71. package/components/DynamicFilter/subcomponents/FieldTypes/NumberFilter/index.3e5853fd.js +0 -55
  72. package/components/DynamicFilter/subcomponents/FieldTypes/SelectFilter/index.740042db.js +0 -48
  73. package/components/DynamicFilter/subcomponents/FieldTypes/StringFilter/index.636d6e6e.js +0 -40
@@ -7,7 +7,7 @@ import { T as TEST_PROP_ID } from "../../test/constants_no_mock.86c553a9.js";
7
7
  import { A as Avatar } from "../mui_extended/Avatar/index.fb9ad158.js";
8
8
  import { C as CircularProgress } from "../mui_extended/CircularProgress/index.967e70b7.js";
9
9
  import { P as Popover } from "../mui_extended/Popover/index.2348fc4f.js";
10
- import { I as Icon } from "../Icon/index.9615b1f6.js";
10
+ import { I as Icon } from "../Icon/index.5cf594aa.js";
11
11
  import clsx from "clsx";
12
12
  const componentName = "M4LAccountPopover";
13
13
  generateUtilityClasses(
@@ -7,7 +7,7 @@ import { generateUtilityClasses, generateUtilityClass } from "@mui/material";
7
7
  import { unstable_composeClasses } from "@mui/base";
8
8
  import { I as Image } from "../Image/index.19aa7ff5.js";
9
9
  import { T as Typography } from "../mui_extended/Typography/index.642798f1.js";
10
- import { I as IconButton } from "../mui_extended/IconButton/index.47be7d35.js";
10
+ import { I as IconButton } from "../mui_extended/IconButton/index.ee45bba2.js";
11
11
  const AppBarRoot = styled("header")(({ theme }) => ({
12
12
  ...theme.components?.M4LAppBar?.styleOverrides
13
13
  }));
@@ -6,7 +6,7 @@ import { useCallback, useEffect } from "react";
6
6
  import { u as useModal } from "../../../../hooks/useModal/index.2003c854.js";
7
7
  import { u as useCommonActionsUtilityClasses } from "../Actions/index.258bf919.js";
8
8
  import { u as useWindowToolsMF } from "../../../areas/hooks/useWindowToolsMF/index.2fbae9dc.js";
9
- import { W as WindowConfirm } from "../../../modal/WindowConfirm.6eea8ea6.js";
9
+ import { W as WindowConfirm } from "../../../modal/WindowConfirm.b70c4b0f.js";
10
10
  function ActionFormCancel() {
11
11
  const { getLabel } = useModuleDictionary();
12
12
  const { openModal } = useModal();
@@ -1,6 +1,6 @@
1
1
  import { jsx } from "react/jsx-runtime";
2
2
  import { getPropertyByString } from "@m4l/core";
3
- import { B as BooleanFormatter } from "../../../formatters/BooleanFormatter/index.117465b4.js";
3
+ import { B as BooleanFormatter } from "../../../formatters/BooleanFormatter/index.699e0aee.js";
4
4
  function ColumnBooleanFormatter(props) {
5
5
  const { fieldValue, presentationType, Component } = props;
6
6
  return (obProps) => {
@@ -1,6 +1,6 @@
1
1
  import { jsx } from "react/jsx-runtime";
2
2
  import { getPropertyByString } from "@m4l/core";
3
- import { C as ConcatenatedFormatter } from "../../../formatters/index.a8f46cab.js";
3
+ import { C as ConcatenatedFormatter } from "../../../formatters/index.8abccc30.js";
4
4
  function ColumnConcatenatedValueFormatter(props) {
5
5
  const { fieldValue, fieldSeparator, Component } = props;
6
6
  return (obProps) => {
@@ -1,6 +1,6 @@
1
1
  import { jsx } from "react/jsx-runtime";
2
2
  import { Checkbox } from "@mui/material";
3
- import { d as dataGridClasses } from "../../index.804af87c.js";
3
+ import { d as dataGridClasses } from "../../index.447c4e44.js";
4
4
  function ColumnInteractiveCheckFormatter(props) {
5
5
  const { row, onRowChange, column } = props;
6
6
  const handleChange = () => {
@@ -1,5 +1,5 @@
1
1
  import { g as getModalDialogComponentsDictionary } from "../ModalDialog/index.0dd5af28.js";
2
- import { g as getPagerComponentsDictionary } from "../mui_extended/Pager/index.a453d8b5.js";
2
+ import { g as getPagerComponentsDictionary } from "../mui_extended/Pager/index.c77a7694.js";
3
3
  import { jsx, jsxs } from "react/jsx-runtime";
4
4
  import { styled } from "@mui/material/styles";
5
5
  import { forwardRef, createContext, useState, useMemo, useEffect, useCallback, useContext, useRef, useLayoutEffect } from "react";
@@ -9,7 +9,7 @@ import { HTML5Backend } from "react-dnd-html5-backend";
9
9
  import { SvgIcon, Checkbox, InputBase, styled as styled$1, Skeleton, generateUtilityClasses, generateUtilityClass } from "@mui/material";
10
10
  import { D as DATAGRID_SELECT_COLUMN_KEY, c as componentName, a as DATAGRID_PREFIX_NAME } from "./constants.e334cd50.js";
11
11
  import { voidFunction, useModuleDictionary, useModuleSkeleton, getPropertyByString } from "@m4l/core";
12
- import { A as ActionsColumn, a as Actions } from "./subcomponents/Actions/index.7421063b.js";
12
+ import { A as ActionsColumn, a as Actions } from "./subcomponents/Actions/index.aff74341.js";
13
13
  import { unstable_composeClasses } from "@mui/base";
14
14
  import { T as TEST_PROP_ID } from "../../test/constants_no_mock.86c553a9.js";
15
15
  import { g as getNameDataTestId } from "../../test/getNameDataTestId.0faeade8.js";
@@ -1,18 +1,18 @@
1
1
  import { jsx, Fragment, jsxs } from "react/jsx-runtime";
2
- import { M as MenuActions } from "../../../mui_extended/MenuActions/index.ab55b9b7.js";
3
- import { u as useDataGrid, a as useFilters, D as DataGridRoot, b as dictionary } from "../../index.804af87c.js";
2
+ import { M as MenuActions } from "../../../mui_extended/MenuActions/index.06aaa091.js";
3
+ import { u as useDataGrid, a as useFilters, D as DataGridRoot, b as dictionary } from "../../index.447c4e44.js";
4
4
  import { useTheme, Skeleton } from "@mui/material";
5
5
  import { b as DATAGRID_ACTIONS_COLUMN_KEY } from "../../constants.e334cd50.js";
6
- import { P as Pager } from "../../../mui_extended/Pager/index.a453d8b5.js";
7
- import { I as IconButton } from "../../../mui_extended/IconButton/index.47be7d35.js";
6
+ import { P as Pager } from "../../../mui_extended/Pager/index.c77a7694.js";
7
+ import { I as IconButton } from "../../../mui_extended/IconButton/index.ee45bba2.js";
8
8
  import { useEnvironment, useModuleDictionary, useModuleSkeleton } from "@m4l/core";
9
9
  import { useIsMobile, useResponsiveContainerStore } from "@m4l/graphics";
10
10
  import { forwardRef, useRef, useState, useImperativeHandle, useMemo, useEffect, useCallback } from "react";
11
11
  import { D as DataGrid$1 } from "../../../../react-data-grid.c5377916.js";
12
12
  import { styled } from "@mui/material/styles";
13
- import { C as ColumnInteractiveCheckFormatter } from "../../formatters/ColumnInteractiveCheckFormatter/index.381342ab.js";
13
+ import { C as ColumnInteractiveCheckFormatter } from "../../formatters/ColumnInteractiveCheckFormatter/index.f7b20493.js";
14
14
  import { u as useModal } from "../../../../hooks/useModal/index.2003c854.js";
15
- import { W as WindowBase } from "../../../modal/WindowBase.2f606ead.js";
15
+ import { W as WindowBase } from "../../../modal/WindowBase.bf119f28.js";
16
16
  import { A as Actions$1 } from "../../../CommonActions/components/Actions/index.258bf919.js";
17
17
  import { A as ActionCancel } from "../../../CommonActions/components/ActionCancel/index.609a78ca.js";
18
18
  import { A as ActionIntro } from "../../../CommonActions/components/ActionIntro/index.ebac0bc1.js";
@@ -3,9 +3,9 @@ import { forwardRef, useState, useRef, useImperativeHandle, useCallback, useEffe
3
3
  import { D as DraggableCore_1 } from "../../react-draggable.1c1ba224.js";
4
4
  import clsx from "clsx";
5
5
  import { styled, generateUtilityClasses } from "@mui/material";
6
- import { M as MAP_ZINDEX_OVER_MAP } from "../maps/components/Map/index.e4045b3e.js";
6
+ import { M as MAP_ZINDEX_OVER_MAP } from "../maps/components/Map/index.50447504.js";
7
7
  import "@mui/base";
8
- import { M as MAP_ZINDEX_OVER_MAP$1 } from "../popups/PopupsViewer/index.e80c69c5.js";
8
+ import { M as MAP_ZINDEX_OVER_MAP$1 } from "../popups/PopupsViewer/index.9b734a0a.js";
9
9
  import { R as Resizable } from "../../react-resizable.a59c14f4.js";
10
10
  const WrapperWindowRoot = styled("div")`
11
11
  position: absolute;
@@ -23,9 +23,9 @@ const DATE_TIME_OPERATORS = [
23
23
  export {
24
24
  ALL_FIELD as A,
25
25
  BOOLEAN_OPERATORS as B,
26
- DATE_TIME_OPERATORS as D,
26
+ DYNAMIC_FILTER_KEY_COMPONENT as D,
27
27
  NUMBER_OPERATORS as N,
28
- STRING_OPERATORS as S,
29
- SELECT_OPERATORS as a,
30
- DYNAMIC_FILTER_KEY_COMPONENT as b
28
+ SELECT_OPERATORS as S,
29
+ DATE_TIME_OPERATORS as a,
30
+ STRING_OPERATORS as b
31
31
  };
@@ -1,5 +1,5 @@
1
1
  import { g as getCommonActionsDictionary } from "../CommonActions/components/Actions/index.258bf919.js";
2
- import { g as getRHFAutocompleteComponentsDictionary } from "../hook-form/RHFAutocomplete/index.709756f6.js";
2
+ import { g as getRHFAutocompleteComponentsDictionary } from "../hook-form/RHFAutocomplete/index.1efaddc9.js";
3
3
  const DYNAMIC_FILTER_DICTIONARY_ID = "dynamic_filter";
4
4
  function getDynamicFilterComponentsDictionary() {
5
5
  return [DYNAMIC_FILTER_DICTIONARY_ID].concat(
@@ -1,9 +1,109 @@
1
+ import { f as fieldFactory } from "./subcomponents/FieldTypes/index.f4457f31.js";
2
+ import { f as filterValidOperandsArraySelect } from "./subcomponents/FieldTypes/SelectFilter/index.2258fceb.js";
1
3
  import { alpha } from "@mui/material";
2
4
  import { c as containerQuery } from "../../utils/index.14912462.js";
3
5
  import { jsx } from "react/jsx-runtime";
4
6
  import { useFlagsPresent, CommonFlags } from "@m4l/core";
5
- import { D as DynamicFilterProvider } from "./store/index.17676a1e.js";
6
- import { D as DynamicFilterBase } from "./subcomponents/DynamicFilterBase/index.909c1836.js";
7
+ import { D as DynamicFilterProvider } from "./store/index.b9c2fe0b.js";
8
+ import { D as DynamicFilterBase } from "./subcomponents/DynamicFilterBase/index.edd7ed6f.js";
9
+ function getPurgedInitialFiltersApplied(fields, initialFilters, getFieldByName) {
10
+ const newFilters = [];
11
+ const fixedFields = [];
12
+ for (let index = 0; index < initialFilters.length; index++) {
13
+ try {
14
+ const initialFilter = initialFilters[index];
15
+ const field = getFieldByName(initialFilter.name);
16
+ const filter = {
17
+ id: 0,
18
+ isSet: true,
19
+ fixed: false,
20
+ field,
21
+ fieldType: field.type,
22
+ operator: initialFilters[index].operator,
23
+ operand1: initialFilters[index].operand1,
24
+ operand2: initialFilters[index].operand2,
25
+ operandsArray: initialFilters[index].operandsArray
26
+ };
27
+ if (!field)
28
+ continue;
29
+ const canAddField = fieldFactory(field.type).verifyFilter(initialFilter, field);
30
+ if (canAddField) {
31
+ if (filter.fieldType === "datetime") {
32
+ filter.operand1 = new Date(filter.operand1 + "");
33
+ filter.operand2 = new Date(filter.operand2 + "");
34
+ }
35
+ if (field.presence === "fixed") {
36
+ if (fixedFields.findIndex((f) => f === field.name) === -1) {
37
+ filter.fixed = true;
38
+ fixedFields.push(field.name);
39
+ } else {
40
+ filter.fixed = false;
41
+ }
42
+ }
43
+ filter.isSet = true;
44
+ filter.id = newFilters.length + 1;
45
+ newFilters.push(filter);
46
+ }
47
+ } catch (error) {
48
+ }
49
+ }
50
+ for (let index = 0; index < fields.length; index++) {
51
+ const field = fields[index];
52
+ if (field.presence === "initialized" || field.presence === "fixed") {
53
+ if (!initialFilters.find((f) => f.name === field.name)) {
54
+ const newFilter = fieldFactory(field.type).getDefaultFilter(
55
+ field,
56
+ field.presence === "fixed"
57
+ );
58
+ newFilter.id = newFilters.length + 1;
59
+ newFilters.push(newFilter);
60
+ }
61
+ }
62
+ }
63
+ return newFilters;
64
+ }
65
+ const formatToRawFilter = (appliedFilters) => {
66
+ return appliedFilters.map((af) => {
67
+ let oa = void 0;
68
+ if (af.field.type === "select" && af.operandsArray) {
69
+ oa = Array.isArray(af.operandsArray) ? af.operandsArray.map(af.field.selectOptions.getOptionId) : [af.field.selectOptions.getOptionId(af.operandsArray)];
70
+ }
71
+ return {
72
+ n: af.field.name,
73
+ o: af.operator,
74
+ o1: af.operand1,
75
+ o2: af.operator === "b" ? af.operand2 : void 0,
76
+ oa
77
+ };
78
+ });
79
+ };
80
+ function formatToInitialFilters(appliedFilters) {
81
+ return appliedFilters.map((appliedFilter) => {
82
+ const ret = {
83
+ name: appliedFilter.field.name,
84
+ operator: appliedFilter.operator,
85
+ operand1: appliedFilter.operand1,
86
+ operand2: appliedFilter.operator === "b" ? appliedFilter.operand2 : void 0
87
+ };
88
+ if (appliedFilter.fieldType === "datetime") {
89
+ ret.operand1 = appliedFilter.operand1.toISOString();
90
+ ret.operand2 = appliedFilter.operator === "b" ? appliedFilter.operand2.toISOString() : void 0;
91
+ }
92
+ if (appliedFilter.fieldType === "select") {
93
+ const validOperandsArray = filterValidOperandsArraySelect(
94
+ appliedFilter.operandsArray,
95
+ appliedFilter.field
96
+ );
97
+ if (validOperandsArray && validOperandsArray?.length > 0) {
98
+ ret.operandsArray = validOperandsArray;
99
+ }
100
+ }
101
+ if (ret.operand2 === void 0) {
102
+ delete ret.operand2;
103
+ }
104
+ return ret;
105
+ });
106
+ }
7
107
  const CONTAINER_QUERY_NAME = "dynamic";
8
108
  const dynamicFilterStyles = {
9
109
  root: {
@@ -327,5 +427,8 @@ function DynamicFilter(props) {
327
427
  }
328
428
  export {
329
429
  DynamicFilter as D,
330
- dynamicFilterStyles as d
430
+ formatToRawFilter as a,
431
+ dynamicFilterStyles as d,
432
+ formatToInitialFilters as f,
433
+ getPurgedInitialFiltersApplied as g
331
434
  };
@@ -1,11 +1,11 @@
1
1
  import { styled } from "@mui/material/styles";
2
- import { b as DYNAMIC_FILTER_KEY_COMPONENT } from "../constants.1dddd09c.js";
2
+ import { D as DYNAMIC_FILTER_KEY_COMPONENT } from "../constants.095f1dbb.js";
3
3
  import { D as DynamicFilterSlots } from "./constants.13968194.js";
4
- import { d as dynamicFilterStyles } from "../index.107ff9cd.js";
4
+ import { d as dynamicFilterStyles } from "../index.a7cb7710.js";
5
5
  import { MenuItem } from "@mui/material";
6
6
  import { A as Actions } from "../../CommonActions/components/Actions/index.258bf919.js";
7
- import { I as Icon } from "../../Icon/index.9615b1f6.js";
8
- import { I as IconButton } from "../../mui_extended/IconButton/index.47be7d35.js";
7
+ import { I as Icon } from "../../Icon/index.5cf594aa.js";
8
+ import { I as IconButton } from "../../mui_extended/IconButton/index.ee45bba2.js";
9
9
  import { P as Popover } from "../../mui_extended/Popover/index.2348fc4f.js";
10
10
  import { T as Typography } from "../../mui_extended/Typography/index.642798f1.js";
11
11
  const RootStyled = styled("div", { name: DYNAMIC_FILTER_KEY_COMPONENT, slot: DynamicFilterSlots.root })(
@@ -4,8 +4,8 @@ import { shallow } from "zustand/shallow";
4
4
  import { jsx } from "react/jsx-runtime";
5
5
  import { useModuleDictionary, useEnvironment, useModuleSkeleton } from "@m4l/core";
6
6
  import { useResponsiveDesktop, useFirstRender } from "@m4l/graphics";
7
- import { A as ALL_FIELD } from "../constants.1dddd09c.js";
8
- import { g as getPurgedInitialFiltersApplied, f as formatToInitialFilters, a as formatToRawFilter } from "../helpers/index.32ea6e4a.js";
7
+ import { A as ALL_FIELD } from "../constants.095f1dbb.js";
8
+ import { g as getPurgedInitialFiltersApplied, f as formatToInitialFilters, a as formatToRawFilter } from "../index.a7cb7710.js";
9
9
  import { devtools } from "zustand/middleware";
10
10
  import { immer } from "zustand/middleware/immer";
11
11
  function useDynamicFilterStore(selector, equalityFn) {
@@ -1,10 +1,10 @@
1
1
  import { jsxs, jsx } from "react/jsx-runtime";
2
- import { A as AppliedFilterChipStyled, a as AppliedFilterChipIconStyled, b as AppliedFilterChipInfoStyled, c as AppliedFilterChipInfoFieldNameStyled, d as AppliedFilterChipInfoOperatorStyled, e as AppliedFilterChipInfoOperandsStyled, f as AppliedFilterChipRemoveButtonStyled } from "../../slots/index.1590336a.js";
2
+ import { A as AppliedFilterChipStyled, a as AppliedFilterChipIconStyled, b as AppliedFilterChipInfoStyled, c as AppliedFilterChipInfoFieldNameStyled, d as AppliedFilterChipInfoOperatorStyled, e as AppliedFilterChipInfoOperandsStyled, f as AppliedFilterChipRemoveButtonStyled } from "../../slots/index.e2218307.js";
3
3
  import { useMemo } from "react";
4
4
  import { useEnvironment, useModuleDictionary } from "@m4l/core";
5
5
  import { useFormatter } from "@m4l/graphics";
6
- import { u as useDynamicFilterStore } from "../../store/index.17676a1e.js";
7
- import { f as fieldFactory } from "../FieldTypes/index.339d175f.js";
6
+ import { u as useDynamicFilterStore } from "../../store/index.b9c2fe0b.js";
7
+ import { f as fieldFactory } from "../FieldTypes/index.f4457f31.js";
8
8
  function useAppliedFilterChip(filter) {
9
9
  const { host_static_assets, environment_assets } = useEnvironment();
10
10
  const { getLabel } = useModuleDictionary();
@@ -1,8 +1,8 @@
1
1
  import { jsx } from "react/jsx-runtime";
2
2
  import { S as ScrollBar } from "../../../ScrollBar/index.21bc5025.js";
3
- import { g as AppliedFiltersStyled, h as AppliedFilterInnerContainerStyled } from "../../slots/index.1590336a.js";
4
- import { u as useDynamicFilterStore } from "../../store/index.17676a1e.js";
5
- import { A as AppliedFilterChip } from "../AppliedFilterChip/index.99e063cc.js";
3
+ import { g as AppliedFiltersStyled, h as AppliedFilterInnerContainerStyled } from "../../slots/index.e2218307.js";
4
+ import { u as useDynamicFilterStore } from "../../store/index.b9c2fe0b.js";
5
+ import { A as AppliedFilterChip } from "../AppliedFilterChip/index.f0fe22f7.js";
6
6
  function useAppliedFilters() {
7
7
  const appliedFilter = useDynamicFilterStore((state) => state.appliedFilters);
8
8
  const isSkeleton = useDynamicFilterStore((state) => state.ownerState.isSkeleton);
@@ -1,12 +1,12 @@
1
1
  import { jsx, jsxs } from "react/jsx-runtime";
2
- import { u as useDynamicFilterStore } from "../../store/index.17676a1e.js";
3
- import { R as RootStyled, I as InnerContainerStyled } from "../../slots/index.1590336a.js";
2
+ import { u as useDynamicFilterStore } from "../../store/index.b9c2fe0b.js";
3
+ import { R as RootStyled, I as InnerContainerStyled } from "../../slots/index.e2218307.js";
4
4
  import { a as getPropDataTestId } from "../../../../test/getNameDataTestId.0faeade8.js";
5
5
  import { D as DynamicFilterSlots } from "../../slots/constants.13968194.js";
6
- import { I as InputFilter } from "../InputFilter/index.ce036c20.js";
7
- import { A as AppliedFilters } from "../AppliedFilters/index.883e90f5.js";
8
- import { F as FilterActions } from "../FilterActions/index.c549da68.js";
9
- import { P as PopoverFilter } from "../PopoverFilter/index.3655469c.js";
6
+ import { I as InputFilter } from "../InputFilter/index.c7d72fb4.js";
7
+ import { A as AppliedFilters } from "../AppliedFilters/index.30d89b6c.js";
8
+ import { F as FilterActions } from "../FilterActions/index.ba70cf6a.js";
9
+ import { P as PopoverFilter } from "../PopoverFilter/index.c2014303.js";
10
10
  function useDynamicFilterBase() {
11
11
  const ownerState = useDynamicFilterStore((state) => state.ownerState);
12
12
  const dataTestId = useDynamicFilterStore((state) => state.dataTestId);
@@ -0,0 +1,126 @@
1
+ import * as Yup from "yup";
2
+ import { g as getDynamicFilterDictionary, D as DICCTIONARY } from "../../../dictionary.80fc7baf.js";
3
+ import { B as BOOLEAN_OPERATORS } from "../../../constants.095f1dbb.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.1efaddc9.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
+ name: "formValueOperator",
35
+ autoComplete: "off",
36
+ options: operators,
37
+ getOptionLabel: (option) => option.label,
38
+ isOptionEqualToValue: (option, value) => option.id === value.id,
39
+ label: getLabel(getDynamicFilterDictionary(DICCTIONARY.label_boolean_operator))
40
+ }
41
+ ),
42
+ /* @__PURE__ */ jsx(
43
+ RHFAutocomplete,
44
+ {
45
+ name: "formValueOperand1",
46
+ autoComplete: "off",
47
+ options: optionsYesNo,
48
+ getOptionLabel: (option) => option.label,
49
+ isOptionEqualToValue: (option, value) => option.value === value.value,
50
+ label: getLabel(getDynamicFilterDictionary(DICCTIONARY.label_boolean_operand1))
51
+ }
52
+ )
53
+ ] });
54
+ }
55
+ class BooleanFilterHelpers {
56
+ getComponent() {
57
+ return BooleanFilter;
58
+ }
59
+ getDefaultFilter(field, fixed) {
60
+ const defaultOperand1 = field.defaultOperand1;
61
+ const defaultFilter = {
62
+ id: 0,
63
+ fieldType: "boolean",
64
+ field,
65
+ fixed,
66
+ isSet: true,
67
+ operator: "e",
68
+ operand1: true
69
+ };
70
+ if (defaultOperand1 !== void 0 && typeof defaultOperand1 === "boolean") {
71
+ defaultFilter.operand1 = defaultOperand1;
72
+ }
73
+ return defaultFilter;
74
+ }
75
+ getFilterFromFormValue(formFilterValue) {
76
+ const operator = formFilterValue.formValueOperator.id;
77
+ const operand1 = formFilterValue.formValueOperand1?.value || false;
78
+ return {
79
+ fieldType: "boolean",
80
+ operator,
81
+ operand1
82
+ };
83
+ }
84
+ getFormValue(field, getLabel, filterValue) {
85
+ const filterValueBoolean = filterValue ? filterValue : void 0;
86
+ const operator = filterValueBoolean ? filterValueBoolean.operator : field.defaultOperator ?? "e";
87
+ const formValueOperand1 = filterValueBoolean ? {
88
+ value: filterValueBoolean.operand1,
89
+ label: getLabel(getDynamicFilterDictionary(`operand_${filterValueBoolean.operand1}`))
90
+ } : null;
91
+ return {
92
+ fieldType: "boolean",
93
+ formValueOperator: {
94
+ id: operator,
95
+ label: getLabel(getDynamicFilterDictionary(`operator_${operator}`))
96
+ },
97
+ formValueOperand1
98
+ };
99
+ }
100
+ getLabels(filter, getLabel, _formatters, _field) {
101
+ const labelOperands = filter.operand1 ? getLabel(getDynamicFilterDictionary("operand_true")) : getLabel(getDynamicFilterDictionary("operand_false"));
102
+ return {
103
+ labelField: filter.field.label ?? getLabel(filter.field.dictionaryId),
104
+ labelOperator: getLabel(getDynamicFilterDictionary(`operator_${filter.operator}`)),
105
+ labelOperands
106
+ };
107
+ }
108
+ getSchema(getLabel) {
109
+ return Yup.object({
110
+ formValueOperator: Yup.object().nullable().required(getLabel(`dynamic_filter.error_operator_required`)),
111
+ formValueOperand1: Yup.object().nullable().required(getLabel(`dynamic_filter.error_operand_required`))
112
+ });
113
+ }
114
+ verifyFilter(filter, _field) {
115
+ if (typeof filter.operator !== "string") {
116
+ return false;
117
+ }
118
+ if (BOOLEAN_OPERATORS.findIndex((f) => f === filter.operator) === -1) {
119
+ return false;
120
+ }
121
+ return typeof filter.operand1 === "boolean";
122
+ }
123
+ }
124
+ export {
125
+ BooleanFilterHelpers as B
126
+ };
@@ -0,0 +1,169 @@
1
+ import * as Yup from "yup";
2
+ import { g as getDynamicFilterDictionary, D as DICCTIONARY } from "../../../dictionary.80fc7baf.js";
3
+ import { a as DATE_TIME_OPERATORS } from "../../../constants.095f1dbb.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.1efaddc9.js";
9
+ import { R as RHFDateTime } from "../../../../hook-form/RHFDateTime/index.b3d0b2de.js";
10
+ import { i as isValidDate } from "../../../../../utils/index.14912462.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
+ 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_date_time))
35
+ }
36
+ ),
37
+ /* @__PURE__ */ jsx(
38
+ RHFDateTime,
39
+ {
40
+ name: "formValueOperand1",
41
+ label: getLabel(getDynamicFilterDictionary(DICCTIONARY.label_operand1_date_time))
42
+ }
43
+ ),
44
+ operator && operator.id === "b" && /* @__PURE__ */ jsx(
45
+ RHFDateTime,
46
+ {
47
+ name: "formValueOperand2",
48
+ label: getLabel(getDynamicFilterDictionary(DICCTIONARY.label_operand2_date_time))
49
+ }
50
+ )
51
+ ] });
52
+ }
53
+ class DateTimeFilterHelpers {
54
+ getComponent() {
55
+ return DateTimeFilter;
56
+ }
57
+ getDefaultFilter(field, fixed) {
58
+ const defaultStartDate = new Date();
59
+ const defaultEndDate = new Date();
60
+ defaultStartDate.setHours(0, 0, 0, 0);
61
+ defaultEndDate.setHours(23, 59, 59, 999);
62
+ const defaultOperand1 = field.defaultOperand1 && field.defaultOperand1 instanceof Date ? field.defaultOperand1 : defaultStartDate;
63
+ const defaultOperand2 = field.defaultOperand2 && field.defaultOperand2 instanceof Date ? field.defaultOperand2 : defaultEndDate;
64
+ return {
65
+ id: 0,
66
+ fieldType: "datetime",
67
+ field,
68
+ fixed,
69
+ isSet: true,
70
+ operator: "b",
71
+ operand1: defaultOperand1,
72
+ operand2: defaultOperand2
73
+ };
74
+ }
75
+ getFormValue(field, getLabel, filterValueDateTime) {
76
+ const filterValue = filterValueDateTime;
77
+ const operator = filterValue ? filterValue.operator : field.defaultOperator ?? "b";
78
+ const defaultStartDate = new Date();
79
+ const defaultEndDate = new Date();
80
+ const defaultOperand1 = field.defaultOperand1 && field.defaultOperand1 instanceof Date ? field.defaultOperand1 : defaultStartDate;
81
+ const defaultOperand2 = field.defaultOperand2 && field.defaultOperand2 instanceof Date ? field.defaultOperand2 : defaultEndDate;
82
+ const formValueOperand1 = filterValue ? filterValue.operand1 : defaultOperand1;
83
+ const formValueOperand2 = filterValue && filterValue.operator === "b" ? filterValue.operand2 : defaultOperand2;
84
+ return {
85
+ fieldType: "datetime",
86
+ formValueOperator: {
87
+ id: operator,
88
+ label: getLabel(getDynamicFilterDictionary(`operator_${operator}`))
89
+ },
90
+ formValueOperand1,
91
+ formValueOperand2
92
+ };
93
+ }
94
+ getFilterFromFormValue(formFilterValue) {
95
+ const operator = formFilterValue.formValueOperator.id;
96
+ const operand1 = formFilterValue.formValueOperand1;
97
+ if (operator === "b") {
98
+ const operand2 = formFilterValue.formValueOperand2;
99
+ return {
100
+ fieldType: "datetime",
101
+ operator,
102
+ operand1,
103
+ operand2
104
+ };
105
+ } else {
106
+ return {
107
+ fieldType: "datetime",
108
+ operator,
109
+ operand1
110
+ };
111
+ }
112
+ }
113
+ getLabels(filter, getLabel, formatters, _field) {
114
+ const { dateFormatter } = formatters;
115
+ let labelOperands;
116
+ if (filter.operator === "b") {
117
+ labelOperands = filter.operand1 && filter.operand2 ? `${dateFormatter.formatDate(
118
+ filter.operand1,
119
+ dateFormatter.datetimeFormat
120
+ )} - ${dateFormatter.formatDate(filter.operand2, dateFormatter.datetimeFormat)}` : "";
121
+ } else {
122
+ labelOperands = filter.operand1 ? dateFormatter.formatDate(filter.operand1, dateFormatter.datetimeFormat) : "";
123
+ }
124
+ return {
125
+ labelField: filter.field.label ?? getLabel(filter.field.dictionaryId),
126
+ labelOperator: getLabel(getDynamicFilterDictionary(`operator_${filter.operator}`)),
127
+ labelOperands
128
+ };
129
+ }
130
+ getSchema(getLabel) {
131
+ return Yup.object({
132
+ formValueOperator: Yup.object().nullable().required(getLabel(getDynamicFilterDictionary(DICCTIONARY.operator_required))),
133
+ formValueOperand1: Yup.date().required(getLabel(getDynamicFilterDictionary(DICCTIONARY.error_invalid_date))).typeError(getLabel(getDynamicFilterDictionary(DICCTIONARY.error_invalid_date))),
134
+ formValueOperand2: Yup.mixed().when(["formValueOperator.id"], {
135
+ is: "b",
136
+ then: Yup.date().typeError(getLabel(getDynamicFilterDictionary(DICCTIONARY.error_invalid_date))).min(
137
+ Yup.ref("formValueOperand1"),
138
+ getLabel(getDynamicFilterDictionary(DICCTIONARY.error_invalid_date))
139
+ )
140
+ })
141
+ });
142
+ }
143
+ verifyFilter(filter, _field) {
144
+ if (typeof filter.operator !== "string") {
145
+ return false;
146
+ }
147
+ if (DATE_TIME_OPERATORS.findIndex((f) => f === filter.operator) === -1) {
148
+ return false;
149
+ }
150
+ if (typeof filter.operand1 !== "string") {
151
+ return false;
152
+ }
153
+ if (!isValidDate(new Date(filter.operand1))) {
154
+ return false;
155
+ }
156
+ if (filter.operator === "b") {
157
+ if (typeof filter.operand2 !== "string") {
158
+ return false;
159
+ }
160
+ if (!isValidDate(new Date(filter.operand1))) {
161
+ return false;
162
+ }
163
+ }
164
+ return true;
165
+ }
166
+ }
167
+ export {
168
+ DateTimeFilterHelpers as D
169
+ };