@m4l/components 9.2.48 → 9.2.50-beta.1

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 (171) hide show
  1. package/@types/types.d.ts +8 -1
  2. package/components/Chip/ChipStyles.js +1 -1
  3. package/components/Chip/types.d.ts +2 -1
  4. package/components/DataGrid/contexts/DataGridContext/index.js +1 -1
  5. package/components/DataGrid/contexts/FilterContext/index.js +1 -1
  6. package/components/DataGrid/dictionary.js +0 -3
  7. package/components/DataGrid/formatters/ColumnChipStatusFormatter/formatter.js +4 -3
  8. package/components/DataGrid/formatters/ColumnChipStatusFormatter/types.d.ts +4 -3
  9. package/components/DataGrid/formatters/ColumnChipStatusFormatter/useColumnChipStatus.js +4 -4
  10. package/components/DataGrid/formatters/ColumnNestedValueFormatter/formatter.js +2 -1
  11. package/components/DataGrid/formatters/ColumnNestedValueFormatter/useColumnNestedValue.d.ts +1 -1
  12. package/components/DataGrid/formatters/ColumnNestedValueFormatter/useColumnNestedValue.js +4 -3
  13. package/components/DataGrid/slots/DataGridEnum.js +2 -2
  14. package/components/DataGrid/slots/DataGridSlot.js +1 -1
  15. package/components/DataGrid/subcomponents/Table/hooks/useSortColumnsRows.js +2 -0
  16. package/components/DataGrid/subcomponents/Table/subcomponents/CheckboxFormatter.js +1 -1
  17. package/components/DataGrid/subcomponents/Table/subcomponents/CustomIcons.js +2 -2
  18. package/components/DragResizeWindowRND/DragResizeWindowRND.js +0 -1
  19. package/components/DynamicFilter/DynamicFilter.styles.js +0 -1
  20. package/components/DynamicFilter/constants.d.ts +5 -2
  21. package/components/DynamicFilter/constants.js +9 -3
  22. package/components/DynamicFilter/dictionary.d.ts +40 -38
  23. package/components/DynamicFilter/dictionary.js +33 -39
  24. package/components/DynamicFilter/helpers/formatToInitialFilters.d.ts +3 -1
  25. package/components/DynamicFilter/helpers/formatToInitialFilters.js +30 -20
  26. package/components/DynamicFilter/helpers/formatToRowFilter.js +15 -6
  27. package/components/DynamicFilter/helpers/getPurgedInitialFiltersApplied.js +1 -1
  28. package/components/DynamicFilter/store/DynamicFilterContext.js +1 -1
  29. package/components/DynamicFilter/subcomponents/AppliedFilterChip/AppliedFilterChip.d.ts +1 -1
  30. package/components/DynamicFilter/subcomponents/AppliedFilterChip/AppliedFilterChip.js +4 -3
  31. package/components/DynamicFilter/subcomponents/AppliedFilters/useAppliedFilters.js +10 -3
  32. package/components/DynamicFilter/subcomponents/DynamicFilterBase/DynamicFilterBase.js +1 -1
  33. package/components/DynamicFilter/subcomponents/FieldTypes/BooleanFilter/helpers.js +7 -7
  34. package/components/DynamicFilter/subcomponents/FieldTypes/BooleanFilter/index.js +11 -8
  35. package/components/DynamicFilter/subcomponents/FieldTypes/DateTimeFilter/helpers.js +7 -7
  36. package/components/DynamicFilter/subcomponents/FieldTypes/DateTimeFilter/index.js +10 -7
  37. package/components/DynamicFilter/subcomponents/FieldTypes/NumberFilter/helpers.js +17 -9
  38. package/components/DynamicFilter/subcomponents/FieldTypes/NumberFilter/index.js +13 -9
  39. package/components/DynamicFilter/subcomponents/FieldTypes/SelectAsyncFilter/helpers.d.ts +7 -7
  40. package/components/DynamicFilter/subcomponents/FieldTypes/SelectAsyncFilter/helpers.js +121 -46
  41. package/components/DynamicFilter/subcomponents/FieldTypes/SelectAsyncFilter/index.js +13 -11
  42. package/components/DynamicFilter/subcomponents/FieldTypes/SelectFilter/helpers.d.ts +8 -7
  43. package/components/DynamicFilter/subcomponents/FieldTypes/SelectFilter/helpers.js +127 -46
  44. package/components/DynamicFilter/subcomponents/FieldTypes/SelectFilter/index.js +11 -9
  45. package/components/DynamicFilter/subcomponents/FieldTypes/StringFilter/helpers.js +11 -7
  46. package/components/DynamicFilter/subcomponents/FieldTypes/StringFilter/index.js +10 -7
  47. package/components/DynamicFilter/subcomponents/FieldTypes/fieldFactory.d.ts +1 -1
  48. package/components/DynamicFilter/subcomponents/FilterActions/FilterActions.js +2 -1
  49. package/components/DynamicFilter/subcomponents/FilterActions/useFilterActions.d.ts +1 -1
  50. package/components/DynamicFilter/subcomponents/FilterActions/useFilterActions.js +2 -4
  51. package/components/DynamicFilter/subcomponents/InputFilter/useInputFilter.js +2 -2
  52. package/components/DynamicFilter/subcomponents/PopoverFilter/usePopoverFilter.d.ts +3 -3
  53. package/components/DynamicFilter/subcomponents/PopoverMenuFields/PopoverMenuFields.js +28 -14
  54. package/components/DynamicFilter/types.d.ts +60 -18
  55. package/components/DynamicSort/dictionary.d.ts +1 -0
  56. package/components/DynamicSort/dictionary.js +1 -5
  57. package/components/DynamicSort/slots/DynamicSortSlots.js +1 -1
  58. package/components/DynamicSort/store/DynamicSortContext.js +1 -1
  59. package/components/DynamicSort/subcomponents/DynamicSortBase/DynamicSortBase.js +1 -1
  60. package/components/DynamicSort/subcomponents/PopoverMenuFields/PopoverMenuFields.js +28 -14
  61. package/components/DynamicSort/subcomponents/PopoverSort/usePopoverSort.d.ts +3 -3
  62. package/components/GridLayout/GridLayout.js +1 -1
  63. package/components/GridLayout/styles.js +1 -1
  64. package/components/GridLayout/subcomponents/GridItem/index.js +1 -1
  65. package/components/GridLayout/subcomponents/Responsive/helper.js +1 -1
  66. package/components/GridLayout/subcomponents/Responsive/index.js +1 -1
  67. package/components/GridLayout/subcomponents/Responsive/responsiveUtils.js +3 -3
  68. package/components/GridLayout/subcomponents/withSizeProvider/index.js +1 -1
  69. package/components/Icon/Icon.js +1 -1
  70. package/components/Icon/constants.js +2 -2
  71. package/components/Icon/slots/IconSlots.js +1 -1
  72. package/components/Image/Image.js +1 -1
  73. package/components/Image/constant.js +2 -2
  74. package/components/Image/slots/ImageSlots.js +1 -1
  75. package/components/Image/subcomponents/IntersectComponent/index.js +1 -1
  76. package/components/LanguagePopover/LanguagePopover.js +1 -1
  77. package/components/LoadingError/LoadingError.js +1 -1
  78. package/components/LoadingError/slots/LoadingErrorSlots.js +1 -1
  79. package/components/MFIsolationApp/MFIsolationApp.js +2 -2
  80. package/components/MFIsolationApp/subcomponents/MFAuthApp/MFAuthApp.js +1 -1
  81. package/components/NoItemSelected/NoItemSelected.js +1 -1
  82. package/components/NumberInput/hooks/useNumberInput/NumberInputReducer.js +1 -1
  83. package/components/NumberInput/hooks/useNumberInput/useNumberInput.js +5 -3
  84. package/components/ObjectLogs/dictionary.js +1 -1
  85. package/components/Pager/Pager.styles.js +0 -8
  86. package/components/Pager/dicctionary.js +0 -5
  87. package/components/PrintingSystem/subcomponents/ChartNode/index.js +1 -1
  88. package/components/PropertyValue/PropertyValue.js +3 -3
  89. package/components/PropertyValue/PropertyValue.styles.js +4 -2
  90. package/components/PropertyValue/index.d.ts +1 -0
  91. package/components/PropertyValue/types.d.ts +0 -2
  92. package/components/ScrollBar/ScrollBar.js +1 -1
  93. package/components/SideBar/slots/SideBarEnum.js +4 -4
  94. package/components/SideBar/slots/SideBarSlots.js +1 -1
  95. package/components/SideBar/subcomponents/ContentGroups/subcomponents/ContainerMenuItemsMain/styles.js +1 -1
  96. package/components/ToastContainer/ToastContainer.js +1 -1
  97. package/components/WindowBase/slots/WindowBaseSlots.js +1 -1
  98. package/components/animate/variants/bounce.js +1 -1
  99. package/components/animate/variants/fade.js +1 -1
  100. package/components/animate/variants/transition.js +2 -2
  101. package/components/areas/components/AreasAdmin/AreasAdmin.js +1 -1
  102. package/components/areas/components/AreasViewer/AreasViewer.js +1 -1
  103. package/components/areas/components/AreasViewer/subcomponents/Area/subcomponents/AreaGridLayout/AreaGridLayout.js +1 -1
  104. package/components/areas/contexts/AreasContext/helpers/helper.js +14 -14
  105. package/components/areas/contexts/AreasContext/store.js +5 -5
  106. package/components/areas/icons.js +0 -8
  107. package/components/commercial/HamburgerMenu/classes/index.js +1 -1
  108. package/components/extended/React-Splitter-Layout/slots/SplitLayoutSlots.d.ts +9 -3
  109. package/components/extended/React-resizable-panels/SplitLayout.js +25 -5
  110. package/components/extended/React-resizable-panels/SplitLayout.styles.js +20 -6
  111. package/components/extended/React-resizable-panels/slots/SplitLayoutSlots.d.ts +12 -4
  112. package/components/extended/React-resizable-panels/types.d.ts +7 -0
  113. package/components/formatters/BooleanFormatter/BooleanFormatter.js +1 -1
  114. package/components/formatters/BooleanFormatter/slots/BooleanFormatterSlots.js +3 -3
  115. package/components/formatters/ChipStatusFormatter/types.d.ts +3 -2
  116. package/components/formatters/PeriodFormatter/PeriodFormatter.js +1 -1
  117. package/components/formatters/PeriodFormatter/slots/PeriodFormatterSlots.js +2 -2
  118. package/components/hook-form/RHFCheckbox/slots/RHFCheckBoxSlots.js +1 -1
  119. package/components/hook-form/RHFNumberInput/index.d.ts +1 -0
  120. package/components/hook-form/RHFNumberInput/index.js +1 -0
  121. package/components/hook-form/RHFPeriod/RHFPeriod.js +1 -1
  122. package/components/hook-form/RHFTextField/RHFTextField.styles.js +1 -3
  123. package/components/hook-form/RHFTextFieldPassword/slots/RHFTextFieldPasswordSlots.js +1 -1
  124. package/components/hook-form/RHFUpload/RHFUploadSingleFile/RHFUploadSingleFile.js +1 -1
  125. package/components/hook-form/RHFormContext/classes/index.js +1 -1
  126. package/components/hook-form/RHFormContext/index.js +1 -1
  127. package/components/hook-form/index.d.ts +1 -1
  128. package/components/index.d.ts +1 -1
  129. package/components/mui_extended/Accordion/Accordion.js +1 -1
  130. package/components/mui_extended/Accordion/slots/AccordionSlots.js +2 -2
  131. package/components/mui_extended/Accordion/styles.js +1 -0
  132. package/components/mui_extended/Autocomplete/Autocomplete.js +25 -12
  133. package/components/mui_extended/Autocomplete/Autocomplete.styles.js +1 -1
  134. package/components/mui_extended/Autocomplete/slots/AutocompleteSlots.js +3 -3
  135. package/components/mui_extended/CheckBox/CheckBox.js +1 -1
  136. package/components/mui_extended/CheckBox/slots/CheckBoxSlots.js +2 -2
  137. package/components/mui_extended/DateTimePicker/slots/DateTimePickerSlots.js +1 -1
  138. package/components/mui_extended/IconButton/slots/IconButtonSlots.js +1 -1
  139. package/components/mui_extended/ImageButton/utils/Clases/index.js +1 -1
  140. package/components/mui_extended/MenuItem/slots/MenuItemSlots.js +1 -1
  141. package/components/mui_extended/NavLink/NavLink.js +1 -1
  142. package/components/mui_extended/NavLink/constants.js +2 -2
  143. package/components/mui_extended/NavLink/slots/NavLinkSlots.js +1 -1
  144. package/components/mui_extended/Popover/Popover.js +1 -1
  145. package/components/mui_extended/Popover/Popover.styles.js +1 -5
  146. package/components/mui_extended/Popover/constants.js +2 -2
  147. package/components/mui_extended/Select/Select.js +1 -1
  148. package/components/mui_extended/Select/Select.styles.js +1 -1
  149. package/components/mui_extended/Select/constants.js +1 -1
  150. package/components/mui_extended/Select/slots/SelectSlots.js +1 -1
  151. package/components/mui_extended/Tab/Tab.js +1 -1
  152. package/components/mui_extended/TabContent/TabContent.styles.js +2 -1
  153. package/components/mui_extended/TextField/constants.js +1 -1
  154. package/components/mui_extended/Tooltip/Tooltip.js +2 -2
  155. package/components/mui_extended/Tooltip/slots/TooltipSlots.js +2 -2
  156. package/components/mui_extended/Typography/Typography.js +1 -1
  157. package/components/mui_extended/Typography/constants.js +3 -3
  158. package/components/mui_extended/Typography/slots/typographySlots.js +1 -1
  159. package/components/popups/components/PopupsViewer/icons.js +0 -1
  160. package/hooks/useDataGridPersistence/constants.js +2 -2
  161. package/hooks/useDataGridPersistence/useDataGridPersistence.js +1 -1
  162. package/hooks/useDynamicFilterAndSort/styles.js +2 -0
  163. package/hooks/useDynamicFilterAndSort/types.d.ts +1 -0
  164. package/hooks/useDynamicFilterAndSort/useDynamicFilterAndSort.js +56 -12
  165. package/hooks/useSvgColor/constants.js +2 -2
  166. package/hooks/useSvgColor/helpers.js +1 -1
  167. package/hooks/useSvgColor/useSvgColor.js +1 -1
  168. package/index.js +109 -109
  169. package/mockServiceWorker.js +1 -1
  170. package/package.json +1 -6
  171. package/components/PropertyValue/styles.d.ts +0 -1
@@ -2,15 +2,16 @@ import { jsx } from "react/jsx-runtime";
2
2
  import { C as Chip } from "../../../Chip/Chip.js";
3
3
  import { u as useDynamicFilterBase } from "../DynamicFilterBase/useDynamicFilterBase.js";
4
4
  import { u as useAppliedFilterChip } from "./useAppliedFilterChip.js";
5
- function AppliedFilterChip(props) {
6
- const { fixed } = props;
5
+ function AppliedFilterChip(filter) {
6
+ const { fixed, isSet } = filter;
7
7
  const { size } = useDynamicFilterBase();
8
- const { onEditFilter, onDelete, iconFieldUrl, labels } = useAppliedFilterChip(props);
8
+ const { onEditFilter, onDelete, iconFieldUrl, labels } = useAppliedFilterChip(filter);
9
9
  return /* @__PURE__ */ jsx(
10
10
  Chip,
11
11
  {
12
12
  size,
13
13
  opacity: true,
14
+ color: isSet ? "default" : "error",
14
15
  variant: "contained",
15
16
  onClick: onEditFilter,
16
17
  startIcon: iconFieldUrl,
@@ -1,10 +1,17 @@
1
1
  import { u as useDynamicFilterStore } from "../../store/useDynamicFilterStore.js";
2
+ import { useMemo } from "react";
2
3
  function useAppliedFilters() {
3
4
  const appliedFilter = useDynamicFilterStore((state) => state.appliedFilters);
4
5
  const isSkeleton = useDynamicFilterStore((state) => state.ownerState.isSkeleton);
5
- const appliedFiltersSorted = [...appliedFilter].sort(
6
- (filterA, filterB) => filterA.isSet !== filterB.isSet ? Number(filterA.isSet) - Number(filterB.isSet) : filterB.id - filterA.id
7
- );
6
+ const appliedFiltersSorted = useMemo(() => {
7
+ const appliedFiltersFixed = [...appliedFilter.filter((f) => f.fixed)].sort(
8
+ (filterA, filterB) => filterA.isSet !== filterB.isSet ? Number(filterA.isSet) - Number(filterB.isSet) : filterB.id - filterA.id
9
+ );
10
+ const appliedFiltersSortedNoFixed = [...appliedFilter.filter((f) => !f.fixed)].sort(
11
+ (filterA, filterB) => filterA.isSet !== filterB.isSet ? Number(filterA.isSet) - Number(filterB.isSet) : filterB.id - filterA.id
12
+ );
13
+ return [...appliedFiltersFixed, ...appliedFiltersSortedNoFixed];
14
+ }, [appliedFilter]);
8
15
  return {
9
16
  appliedFiltersSorted,
10
17
  isSkeleton
@@ -4,11 +4,11 @@ import { a as getComponentSlotRoot } from "../../../../utils/getComponentSlotRoo
4
4
  import { D as DYNAMIC_FILTER_KEY_COMPONENT } from "../../constants.js";
5
5
  import { u as useDynamicFilterBase } from "./useDynamicFilterBase.js";
6
6
  import { R as RootStyled, I as InnerContainerStyled } from "../../slots/dynamicFilterSlots.js";
7
- import { D as DynamicFilterSlots } from "../../slots/SlotsEnum.js";
8
7
  import { I as InputFilter } from "../InputFilter/InputFilter.js";
9
8
  import { A as AppliedFilters } from "../AppliedFilters/AppliedFilters.js";
10
9
  import { F as FilterActions } from "../FilterActions/FilterActions.js";
11
10
  import { P as PopoverFilter } from "../PopoverFilter/PopoverFilter.js";
11
+ import { D as DynamicFilterSlots } from "../../slots/SlotsEnum.js";
12
12
  function DynamicFilterBase() {
13
13
  const { ownerState, dataTestId } = useDynamicFilterBase();
14
14
  const classRoot = getComponentSlotRoot(DYNAMIC_FILTER_KEY_COMPONENT);
@@ -1,7 +1,7 @@
1
1
  import * as Yup from "yup";
2
2
  import { B as BOOLEAN_OPERATORS } from "../../../constants.js";
3
- import { g as getDynamicFilterDictionary } from "../../../dictionary.js";
4
3
  import { B as BooleanFilter } from "./index.js";
4
+ import { D as DYNAMIC_FILTER_DICTIONARY_ID, a as DICCTIONARY } from "../../../dictionary.js";
5
5
  class BooleanFilterHelpers {
6
6
  getComponent() {
7
7
  return BooleanFilter;
@@ -45,13 +45,13 @@ class BooleanFilterHelpers {
45
45
  const operator = filterValueBoolean ? filterValueBoolean.operator : field.defaultOperator ?? "e";
46
46
  const formValueOperand1 = filterValueBoolean ? {
47
47
  value: filterValueBoolean.operand1,
48
- label: getLabel(getDynamicFilterDictionary(`operand_${filterValueBoolean.operand1}`))
48
+ label: getLabel(`${DYNAMIC_FILTER_DICTIONARY_ID}.operand_${filterValueBoolean.operand1}`)
49
49
  } : null;
50
50
  return {
51
51
  fieldType: "boolean",
52
52
  formValueOperator: {
53
53
  id: operator,
54
- label: getLabel(getDynamicFilterDictionary(`operator_${operator}`))
54
+ label: getLabel(`${DYNAMIC_FILTER_DICTIONARY_ID}.operator_${operator}`)
55
55
  },
56
56
  formValueOperand1
57
57
  };
@@ -60,10 +60,10 @@ class BooleanFilterHelpers {
60
60
  * getLabel devuelve las etiquetas para el filtro booleano.
61
61
  */
62
62
  getLabels(filter, getLabel, _formatters, _field) {
63
- const labelOperands = filter.operand1 ? getLabel(getDynamicFilterDictionary("operand_true")) : getLabel(getDynamicFilterDictionary("operand_false"));
63
+ const labelOperands = filter.operand1 ? getLabel(DICCTIONARY.operand_true) : getLabel(DICCTIONARY.operand_false);
64
64
  return {
65
65
  labelField: filter.field.label ?? getLabel(filter.field.dictionaryId),
66
- labelOperator: getLabel(getDynamicFilterDictionary(`operator_${filter.operator}`)),
66
+ labelOperator: getLabel(`${DYNAMIC_FILTER_DICTIONARY_ID}.operator_${filter.operator}`),
67
67
  labelOperands
68
68
  };
69
69
  }
@@ -72,8 +72,8 @@ class BooleanFilterHelpers {
72
72
  */
73
73
  getSchema(getLabel) {
74
74
  return Yup.object({
75
- formValueOperator: Yup.object().nullable().required(getLabel(`dynamic_filter.error_operator_required`)),
76
- formValueOperand1: Yup.object().nullable().required(getLabel(`dynamic_filter.error_operand_required`))
75
+ formValueOperator: Yup.object().nullable().required(getLabel(DICCTIONARY.error_operator_required)),
76
+ formValueOperand1: Yup.object().nullable().required(getLabel(DICCTIONARY.error_operand_required))
77
77
  });
78
78
  }
79
79
  /**
@@ -2,26 +2,29 @@ import { jsxs, jsx } from "react/jsx-runtime";
2
2
  import { useModuleDictionary } from "@m4l/core";
3
3
  import { useMemo } from "react";
4
4
  import { B as BOOLEAN_OPERATORS } from "../../../constants.js";
5
- import { g as getDynamicFilterDictionary, D as DICCTIONARY } from "../../../dictionary.js";
5
+ import { D as DYNAMIC_FILTER_DICTIONARY_ID, a as DICCTIONARY } from "../../../dictionary.js";
6
+ import { u as useDynamicFilterStore } from "../../../store/useDynamicFilterStore.js";
6
7
  import { R as RHFAutocomplete } from "../../../../hook-form/RHFAutocomplete/RHFAutocomplete.js";
7
8
  function BooleanFilter() {
8
9
  const { getLabel } = useModuleDictionary();
10
+ const field = useDynamicFilterStore((state) => state.popoverFilterData?.field);
11
+ const restritcOperatorsTo = field?.restritcOperatorsTo;
9
12
  const operators = useMemo(
10
13
  () => BOOLEAN_OPERATORS.map((o) => ({
11
14
  id: o,
12
- label: getLabel(getDynamicFilterDictionary(`operator_${o}`))
13
- })),
14
- [getLabel]
15
+ label: getLabel(`${DYNAMIC_FILTER_DICTIONARY_ID}.operator_${o}`)
16
+ })).filter((o) => restritcOperatorsTo ? restritcOperatorsTo.includes(o.id) : true),
17
+ [getLabel, restritcOperatorsTo]
15
18
  );
16
19
  const optionsYesNo = useMemo(
17
20
  () => [
18
21
  {
19
22
  value: true,
20
- label: getLabel(getDynamicFilterDictionary(DICCTIONARY.operand_true))
23
+ label: getLabel(DICCTIONARY.operand_true)
21
24
  },
22
25
  {
23
26
  value: false,
24
- label: getLabel(getDynamicFilterDictionary(DICCTIONARY.operand_false))
27
+ label: getLabel(DICCTIONARY.operand_false)
25
28
  }
26
29
  ],
27
30
  [getLabel]
@@ -36,7 +39,7 @@ function BooleanFilter() {
36
39
  options: operators,
37
40
  getOptionLabel: (option) => option.label,
38
41
  isOptionEqualToValue: (option, value) => option.id === value.id,
39
- label: getLabel(getDynamicFilterDictionary(DICCTIONARY.label_boolean_operator))
42
+ label: getLabel(DICCTIONARY.label_boolean_operator)
40
43
  }
41
44
  ),
42
45
  /* @__PURE__ */ jsx(
@@ -48,7 +51,7 @@ function BooleanFilter() {
48
51
  options: optionsYesNo,
49
52
  getOptionLabel: (option) => option.label,
50
53
  isOptionEqualToValue: (option, value) => option.value === value.value,
51
- label: getLabel(getDynamicFilterDictionary(DICCTIONARY.label_boolean_operand1))
54
+ label: getLabel(DICCTIONARY.label_boolean_operand1)
52
55
  }
53
56
  )
54
57
  ] });
@@ -1,6 +1,6 @@
1
1
  import * as Yup from "yup";
2
2
  import { b as DATE_TIME_OPERATORS } from "../../../constants.js";
3
- import { g as getDynamicFilterDictionary, D as DICCTIONARY } from "../../../dictionary.js";
3
+ import { D as DYNAMIC_FILTER_DICTIONARY_ID, a as DICCTIONARY } from "../../../dictionary.js";
4
4
  import { D as DateTimeFilter } from "./index.js";
5
5
  import { i as isValidDate } from "../../../../../utils/isValidDate.js";
6
6
  class DateTimeFilterHelpers {
@@ -44,7 +44,7 @@ class DateTimeFilterHelpers {
44
44
  fieldType: "datetime",
45
45
  formValueOperator: {
46
46
  id: operator,
47
- label: getLabel(getDynamicFilterDictionary(`operator_${operator}`))
47
+ label: getLabel(`${DYNAMIC_FILTER_DICTIONARY_ID}.operator_${operator}`)
48
48
  },
49
49
  formValueOperand1,
50
50
  formValueOperand2
@@ -88,7 +88,7 @@ class DateTimeFilterHelpers {
88
88
  }
89
89
  return {
90
90
  labelField: filter.field.label ?? getLabel(filter.field.dictionaryId),
91
- labelOperator: getLabel(getDynamicFilterDictionary(`operator_${filter.operator}`)),
91
+ labelOperator: getLabel(`${DYNAMIC_FILTER_DICTIONARY_ID}.operator_${filter.operator}`),
92
92
  labelOperands
93
93
  };
94
94
  }
@@ -97,13 +97,13 @@ class DateTimeFilterHelpers {
97
97
  */
98
98
  getSchema(getLabel) {
99
99
  return Yup.object({
100
- formValueOperator: Yup.object().nullable().required(getLabel(getDynamicFilterDictionary(DICCTIONARY.operator_required))),
101
- formValueOperand1: Yup.date().required(getLabel(getDynamicFilterDictionary(DICCTIONARY.error_invalid_date))).typeError(getLabel(getDynamicFilterDictionary(DICCTIONARY.error_invalid_date))),
100
+ formValueOperator: Yup.object().nullable().required(getLabel(DICCTIONARY.error_operator_required)),
101
+ formValueOperand1: Yup.date().required(getLabel(DICCTIONARY.error_invalid_date)).typeError(getLabel(DICCTIONARY.error_invalid_date)),
102
102
  formValueOperand2: Yup.mixed().when(["formValueOperator.id"], {
103
103
  is: "b",
104
- then: Yup.date().typeError(getLabel(getDynamicFilterDictionary(DICCTIONARY.error_invalid_date))).min(
104
+ then: Yup.date().typeError(getLabel(DICCTIONARY.error_invalid_date)).min(
105
105
  Yup.ref("formValueOperand1"),
106
- getLabel(getDynamicFilterDictionary(DICCTIONARY.error_invalid_date))
106
+ getLabel(DICCTIONARY.error_invalid_date)
107
107
  )
108
108
  })
109
109
  });
@@ -3,12 +3,15 @@ import { useModuleDictionary } from "@m4l/core";
3
3
  import { useMemo } from "react";
4
4
  import { useFormContext, useWatch } from "react-hook-form";
5
5
  import { b as DATE_TIME_OPERATORS } from "../../../constants.js";
6
- import { g as getDynamicFilterDictionary, D as DICCTIONARY } from "../../../dictionary.js";
6
+ import { D as DYNAMIC_FILTER_DICTIONARY_ID, a as DICCTIONARY } from "../../../dictionary.js";
7
+ import { u as useDynamicFilterStore } from "../../../store/useDynamicFilterStore.js";
7
8
  import { R as RHFAutocomplete } from "../../../../hook-form/RHFAutocomplete/RHFAutocomplete.js";
8
9
  import { R as RHFDateTime } from "../../../../hook-form/RHFDateTime/RHFDateTime.js";
9
10
  function DateTimeFilter() {
10
11
  const { getLabel } = useModuleDictionary();
11
12
  const { control } = useFormContext();
13
+ const field = useDynamicFilterStore((state) => state.popoverFilterData?.field);
14
+ const restritcOperatorsTo = field?.restritcOperatorsTo;
12
15
  const operator = useWatch({
13
16
  control,
14
17
  name: "formValueOperator"
@@ -16,9 +19,9 @@ function DateTimeFilter() {
16
19
  const operators = useMemo(
17
20
  () => DATE_TIME_OPERATORS.map((o) => ({
18
21
  id: o,
19
- label: getLabel(getDynamicFilterDictionary(`operator_${o}`))
20
- })),
21
- [getLabel]
22
+ label: getLabel(`${DYNAMIC_FILTER_DICTIONARY_ID}.operator_${o}`)
23
+ })).filter((o) => restritcOperatorsTo ? restritcOperatorsTo.includes(o.id) : true),
24
+ [getLabel, restritcOperatorsTo]
22
25
  );
23
26
  return /* @__PURE__ */ jsxs("div", { children: [
24
27
  /* @__PURE__ */ jsx(
@@ -30,21 +33,21 @@ function DateTimeFilter() {
30
33
  options: operators,
31
34
  getOptionLabel: (option) => option.label,
32
35
  isOptionEqualToValue: (option, value) => option.id === value.id,
33
- label: getLabel(getDynamicFilterDictionary(DICCTIONARY.label_operator_date_time))
36
+ label: getLabel(DICCTIONARY.label_operator_date_time)
34
37
  }
35
38
  ),
36
39
  /* @__PURE__ */ jsx(
37
40
  RHFDateTime,
38
41
  {
39
42
  name: "formValueOperand1",
40
- label: getLabel(getDynamicFilterDictionary(DICCTIONARY.label_operand1_date_time))
43
+ label: getLabel(DICCTIONARY.label_operand1_date_time)
41
44
  }
42
45
  ),
43
46
  operator && operator.id === "b" && /* @__PURE__ */ jsx(
44
47
  RHFDateTime,
45
48
  {
46
49
  name: "formValueOperand2",
47
- label: getLabel(getDynamicFilterDictionary(DICCTIONARY.label_operand2_date_time))
50
+ label: getLabel(DICCTIONARY.label_operand2_date_time)
48
51
  }
49
52
  )
50
53
  ] });
@@ -1,7 +1,7 @@
1
1
  import * as Yup from "yup";
2
2
  import { N as NUMBER_OPERATORS } from "../../../constants.js";
3
- import { g as getDynamicFilterDictionary } from "../../../dictionary.js";
4
3
  import { N as NumberFilter } from "./index.js";
4
+ import { D as DYNAMIC_FILTER_DICTIONARY_ID, a as DICCTIONARY } from "../../../dictionary.js";
5
5
  class NumberFilterHelpers {
6
6
  getComponent() {
7
7
  return NumberFilter;
@@ -14,15 +14,23 @@ class NumberFilterHelpers {
14
14
  const dOperator = field.defaultOperator ?? "e";
15
15
  const defaultOperand1 = field.defaultOperand1 ?? null;
16
16
  const defaultOperand2 = field.defaultOperand2 ?? null;
17
+ let isSet = false;
18
+ if (fixed) {
19
+ if (["b"].includes(dOperator)) {
20
+ isSet = defaultOperand1 !== null && defaultOperand2 !== null ? true : false;
21
+ } else {
22
+ isSet = defaultOperand1 !== null ? true : false;
23
+ }
24
+ }
17
25
  return {
18
26
  id: 0,
19
27
  fieldType: "number",
20
28
  field,
21
29
  fixed,
22
- isSet: false,
23
30
  operator: dOperator,
24
31
  operand1: defaultOperand1,
25
- operand2: defaultOperand2
32
+ operand2: defaultOperand2,
33
+ isSet
26
34
  };
27
35
  }
28
36
  /**
@@ -37,7 +45,7 @@ class NumberFilterHelpers {
37
45
  fieldType: "number",
38
46
  formValueOperator: {
39
47
  id: operator,
40
- label: getLabel(getDynamicFilterDictionary(`operator_${operator}`))
48
+ label: getLabel(`${DYNAMIC_FILTER_DICTIONARY_ID}.operator_${operator}`)
41
49
  },
42
50
  formValueOperand1,
43
51
  formValueOperand2
@@ -73,11 +81,11 @@ class NumberFilterHelpers {
73
81
  if (filter.operator === "b") {
74
82
  labelOperands = filter.operand1 && filter.operand2 ? `${filter.operand1} - ${filter.operand2}` : "";
75
83
  } else {
76
- labelOperands = filter.operand1 !== void 0 ? filter.operand1 + "" : "";
84
+ labelOperands = (filter.operand1 ?? "?") + "";
77
85
  }
78
86
  return {
79
87
  labelField: filter.field.label ?? getLabel(filter.field.dictionaryId),
80
- labelOperator: getLabel(getDynamicFilterDictionary(`operator_${filter.operator}`)),
88
+ labelOperator: getLabel(`${DYNAMIC_FILTER_DICTIONARY_ID}.operator_${filter.operator}`),
81
89
  labelOperands
82
90
  };
83
91
  }
@@ -86,13 +94,13 @@ class NumberFilterHelpers {
86
94
  */
87
95
  getSchema(getLabel) {
88
96
  return Yup.object({
89
- formValueOperator: Yup.object().nullable().required(getLabel(`dynamic_filter.error_operator_required`)),
97
+ formValueOperator: Yup.object().nullable().required(getLabel(DICCTIONARY.error_operator_required)),
90
98
  formValueOperand1: Yup.number().typeError(
91
- getLabel(`dynamic_filter.error_operand_mustbe_number`)
99
+ getLabel(DICCTIONARY.error_operand_mustbe_number)
92
100
  ),
93
101
  formValueOperand2: Yup.mixed().when(["formValueOperator.id"], {
94
102
  is: "b",
95
- then: Yup.number().typeError(getLabel(`dynamic_filter.error_operand_mustbe_number`)).min(Yup.ref("formValueOperand1"), getLabel(`dynamic_filter.error_less_than_start`))
103
+ then: Yup.number().typeError(getLabel(DICCTIONARY.error_operand_mustbe_number)).min(Yup.ref("formValueOperand1"), getLabel(DICCTIONARY.error_less_than_start))
96
104
  })
97
105
  });
98
106
  }
@@ -3,12 +3,16 @@ import { useModuleDictionary } from "@m4l/core";
3
3
  import { useMemo } from "react";
4
4
  import { useFormContext, useWatch } from "react-hook-form";
5
5
  import { N as NUMBER_OPERATORS } from "../../../constants.js";
6
- import { g as getDynamicFilterDictionary, D as DICCTIONARY } from "../../../dictionary.js";
6
+ import { D as DYNAMIC_FILTER_DICTIONARY_ID, a as DICCTIONARY } from "../../../dictionary.js";
7
+ import { u as useDynamicFilterStore } from "../../../store/useDynamicFilterStore.js";
7
8
  import { R as RHFAutocomplete } from "../../../../hook-form/RHFAutocomplete/RHFAutocomplete.js";
9
+ import { R as RHFNumberInput } from "../../../../hook-form/RHFNumberInput/RHFNumberInput.js";
8
10
  import { R as RHFTextField } from "../../../../hook-form/RHFTextField/RHFTextField.js";
9
11
  function NumberFilter() {
10
12
  const { getLabel } = useModuleDictionary();
11
13
  const { control } = useFormContext();
14
+ const field = useDynamicFilterStore((state) => state.popoverFilterData?.field);
15
+ const restritcOperatorsTo = field?.restritcOperatorsTo;
12
16
  const operator = useWatch({
13
17
  control,
14
18
  name: "formValueOperator"
@@ -16,9 +20,9 @@ function NumberFilter() {
16
20
  const operators = useMemo(
17
21
  () => NUMBER_OPERATORS.map((o) => ({
18
22
  id: o,
19
- label: getLabel(getDynamicFilterDictionary(`operator_${o}`))
20
- })),
21
- [getLabel]
23
+ label: getLabel(`${DYNAMIC_FILTER_DICTIONARY_ID}.operator_${o}`)
24
+ })).filter((o) => restritcOperatorsTo ? restritcOperatorsTo.includes(o.id) : true),
25
+ [getLabel, restritcOperatorsTo]
22
26
  );
23
27
  return /* @__PURE__ */ jsxs("div", { children: [
24
28
  /* @__PURE__ */ jsx(
@@ -30,15 +34,15 @@ function NumberFilter() {
30
34
  options: operators,
31
35
  getOptionLabel: (option) => option.label,
32
36
  isOptionEqualToValue: (option, value) => option.id === value.id,
33
- label: getLabel(getDynamicFilterDictionary(DICCTIONARY.label_operator_number))
37
+ label: getLabel(DICCTIONARY.label_operator_number)
34
38
  }
35
39
  ),
36
40
  /* @__PURE__ */ jsx(
37
- RHFTextField,
41
+ RHFNumberInput,
38
42
  {
39
43
  name: "formValueOperand1",
40
- type: "number",
41
- label: getLabel(getDynamicFilterDictionary(DICCTIONARY.label_operand1_number))
44
+ withDecimal: false,
45
+ label: getLabel(DICCTIONARY.label_operand1_number)
42
46
  }
43
47
  ),
44
48
  operator && operator.id === "b" && /* @__PURE__ */ jsx(
@@ -46,7 +50,7 @@ function NumberFilter() {
46
50
  {
47
51
  name: "formValueOperand2",
48
52
  type: "number",
49
- label: getLabel(getDynamicFilterDictionary(DICCTIONARY.label_operand2_number))
53
+ label: getLabel(DICCTIONARY.label_operand2_number)
50
54
  }
51
55
  )
52
56
  ] });
@@ -1,6 +1,6 @@
1
1
  import { GetLabelType } from '@m4l/core';
2
2
  import { Formatters } from '@m4l/graphics';
3
- import { DataTypeFilerLabels, FilterField, FilterFieldApplied, FilterValue, FormFilterValueSelectAsync, FormOperandSelectAsync, InitialFilterApplied } from '../../../types';
3
+ import { DataTypeFilerLabels, FilterField, FilterFieldApplied, FilterValue, FilterValueSelectAsync, FormFilterValueSelectAsync, OperandSelectAsync, InitialFilterApplied } from '../../../types';
4
4
  import { IFieldType, YupSchema } from '../FieldTypeInterface';
5
5
  import { SelectAsyncFilter } from './index';
6
6
  /**
@@ -9,7 +9,7 @@ import { SelectAsyncFilter } from './index';
9
9
  * @param field Propiedades del field
10
10
  * @returns FormOperandSelect[] operandArray filtrado con valores validados
11
11
  */
12
- export declare function filterValidOperandsArraySelectAsync(operandsArray: FormOperandSelectAsync[] | FormOperandSelectAsync, field: FilterField): any[];
12
+ export declare function filterValidOperandsArraySelectAsync(operandsArray: OperandSelectAsync[] | OperandSelectAsync, field: FilterField): any[];
13
13
  /**
14
14
  * SelectAsyncFilterHelpers es una clase que implementa la interfaz IFieldType
15
15
  */
@@ -18,19 +18,19 @@ export declare class SelectAsyncFilterHelpers implements IFieldType<FormFilterVa
18
18
  /**
19
19
  * getDefaultFilter devuelve un filtro por defecto para un campo de selección asíncrona.
20
20
  */
21
- getDefaultFilter(field: FilterField, fixed: boolean): FilterFieldApplied;
21
+ getDefaultFilter(fieldSelectAsync: FilterField, fixed: boolean): FilterFieldApplied;
22
22
  /**
23
23
  * getFormValue convierte un valor de filtro en un valor de formulario.
24
24
  */
25
- getFormValue(field: FilterField, getLabel: GetLabelType, filterValueSelect?: FilterValue): FormFilterValueSelectAsync;
25
+ getFormValue(fieldSelectAsync: FilterField, getLabel: GetLabelType, filterValueSelectAsync?: FilterValue): FormFilterValueSelectAsync;
26
26
  /**
27
27
  * getFilterFromFormValue convierte un valor de formulario en un valor de filtro.
28
28
  */
29
- getFilterFromFormValue(formFilterValue: FormFilterValueSelectAsync): FilterValue;
29
+ getFilterFromFormValue(formFilterValue: FormFilterValueSelectAsync): FilterValueSelectAsync;
30
30
  /**
31
31
  * getLabels devuelve las etiquetas para el campo, operador y operandos.
32
32
  */
33
- getLabels(filter: FilterFieldApplied, getLabel: GetLabelType, _formatters: Formatters, field: FilterField): DataTypeFilerLabels;
33
+ getLabels(filter: FilterFieldApplied, getLabel: GetLabelType, _formatters: Formatters, fieldSelectAsync: FilterField): DataTypeFilerLabels;
34
34
  /**
35
35
  * getschema devuelve el esquema de validación de Yup para el filtro.
36
36
  */
@@ -38,5 +38,5 @@ export declare class SelectAsyncFilterHelpers implements IFieldType<FormFilterVa
38
38
  /**
39
39
  * verifyFilter verifica si el filtro es válido.
40
40
  */
41
- verifyFilter(filter: InitialFilterApplied, field?: FilterField): boolean;
41
+ verifyFilter(filter: InitialFilterApplied, fieldSelectAsync?: FilterField): boolean;
42
42
  }