@m4l/components 9.1.142 → 9.1.144

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 (194) hide show
  1. package/.storybook/utils/getStylesColorsByMode.d.ts +48 -48
  2. package/@types/types.d.ts +17 -0
  3. package/components/AccountPopover/slots/AccountPopoverSlots.d.ts +7 -7
  4. package/components/AppBar/slots/AppBarSlots.d.ts +6 -6
  5. package/components/AppBar/slots/AppBarSlots.js +1 -1
  6. package/components/Chip/slots/ChipSlots.d.ts +2 -2
  7. package/components/Color/slots/ColorSlots.d.ts +2 -2
  8. package/components/Color/slots/ColorSlots.js +1 -1
  9. package/components/CommonActions/components/ActionCancel/slots/ActionsCancelSlots.d.ts +1 -1
  10. package/components/CommonActions/components/ActionFormCancel/slots/ActionFormCancelSlots.d.ts +1 -1
  11. package/components/CommonActions/components/ActionIntro/slots/ActionsIntroSlots.d.ts +1 -1
  12. package/components/CommonActions/components/ActionsContainer/slots/ActionsContainerSlots.d.ts +1 -1
  13. package/components/DataGrid/DataGrid.d.ts +9 -0
  14. package/components/DataGrid/DataGrid.js +95 -0
  15. package/components/DataGrid/contexts/DataGridContext/index.js +2 -2
  16. package/components/DataGrid/contexts/FilterContext/index.js +2 -2
  17. package/components/DataGrid/formatters/ColumnDateFormatter/useColumnDate.js +6 -2
  18. package/components/DataGrid/hooks/useDataGrid.js +1 -1
  19. package/components/DataGrid/hooks/useFilters.js +1 -1
  20. package/components/DataGrid/index.d.ts +8 -9
  21. package/components/DataGrid/index.js +1 -89
  22. package/components/DataGrid/slots/DataGridEnum.d.ts +2 -1
  23. package/components/DataGrid/slots/DataGridEnum.js +1 -0
  24. package/components/DataGrid/slots/DataGridSlot.d.ts +19 -18
  25. package/components/DataGrid/slots/DataGridSlot.js +13 -8
  26. package/components/DataGrid/styles.js +10 -8
  27. package/components/DataGrid/subcomponents/Actions/index.js +15 -12
  28. package/components/DataGrid/subcomponents/Actions/subcomponents/Settings/subcomponents/ColumnsConfig/index.js +1 -1
  29. package/components/DataGrid/subcomponents/Actions/subcomponents/hooks/useModalSettings/index.js +1 -1
  30. package/components/DataGrid/subcomponents/Actions/types.d.ts +2 -0
  31. package/components/DataGrid/subcomponents/Table/index.js +1 -1
  32. package/components/DataGrid/subcomponents/Table/subcomponents/DraggableHeaderRenderer.js +1 -1
  33. package/components/DataGrid/types.d.ts +8 -12
  34. package/components/DragResizeWindow/slots/DragResizeWindowSlots.d.ts +2 -2
  35. package/components/DynamicFilter/__tests__/fronEndHelpers.test.d.ts +1 -0
  36. package/components/DynamicFilter/helpers/frontEndHelpers.d.ts +12 -0
  37. package/components/DynamicFilter/helpers/frontEndHelpers.js +213 -0
  38. package/components/DynamicFilter/index.d.ts +1 -0
  39. package/components/DynamicFilter/slots/dynamicFilterSlots.d.ts +15 -15
  40. package/components/DynamicFilter/slots/dynamicFilterSlots.js +1 -1
  41. package/components/DynamicFilter/store/DynamicFilterContext.d.ts +1 -1
  42. package/components/DynamicFilter/store/DynamicFilterStore.d.ts +1 -1
  43. package/components/DynamicFilter/store/DynamicFilterStore.js +5 -2
  44. package/components/DynamicFilter/store/{DynamicFilterStoreTypes.d.ts → types.d.ts} +4 -5
  45. package/components/DynamicFilter/store/useDynamicFilterStore.d.ts +1 -1
  46. package/components/DynamicFilter/subcomponents/AppliedFilterChip/useAppliedFilterChip.d.ts +1 -1
  47. package/components/DynamicFilter/subcomponents/AppliedFilterChip/useAppliedFilterChip.js +2 -4
  48. package/components/DynamicFilter/subcomponents/DynamicFilterBase/DynamicFilterBase.js +4 -0
  49. package/components/DynamicFilter/subcomponents/PopoverFilter/usePopoverFilter.js +2 -1
  50. package/components/DynamicFilter/subcomponents/PopoverMenuFields/usePopoverMenuFields.d.ts +0 -1
  51. package/components/DynamicFilter/subcomponents/PopoverMenuFields/usePopoverMenuFields.js +1 -3
  52. package/components/DynamicFilter/types.d.ts +2 -2
  53. package/components/DynamicSort/DynamicSort.styles.js +3 -0
  54. package/components/DynamicSort/constants.d.ts +3 -3
  55. package/components/DynamicSort/constants.js +5 -3
  56. package/components/DynamicSort/dictionary.js +3 -2
  57. package/components/DynamicSort/helpers/formatToRowSort.js +3 -2
  58. package/components/DynamicSort/helpers/frontEndHelpers.d.ts +7 -0
  59. package/components/DynamicSort/helpers/frontEndHelpers.js +38 -0
  60. package/components/DynamicSort/helpers/getPurgedInitialSortApplyed.js +2 -2
  61. package/components/DynamicSort/index.d.ts +2 -1
  62. package/components/DynamicSort/slots/DynamicSortSlots.d.ts +29 -29
  63. package/components/DynamicSort/store/DynamicSortContext.d.ts +3 -3
  64. package/components/DynamicSort/store/DynamicSortContext.js +5 -14
  65. package/components/DynamicSort/store/DynamicSortStore.d.ts +2 -2
  66. package/components/DynamicSort/store/DynamicSortStore.js +30 -21
  67. package/components/DynamicSort/store/{type.d.ts → types.d.ts} +19 -22
  68. package/components/DynamicSort/store/useDynamicSortStore.d.ts +1 -1
  69. package/components/DynamicSort/store/useDynamicSortStore.js +1 -1
  70. package/components/DynamicSort/subcomponents/AppliedSortChip/useAppliedSortChip.d.ts +1 -1
  71. package/components/DynamicSort/subcomponents/AppliedSortChip/useAppliedSortChip.js +3 -4
  72. package/components/DynamicSort/subcomponents/AppliedSorts/AppliedSorts.js +1 -1
  73. package/components/DynamicSort/subcomponents/AppliedSorts/useAppliedSorts.d.ts +1 -1
  74. package/components/DynamicSort/subcomponents/AppliedSorts/useAppliedSorts.js +2 -1
  75. package/components/DynamicSort/subcomponents/DynamicSortBase/DynamicSortBase.js +4 -0
  76. package/components/DynamicSort/subcomponents/FieldTypes/DataTypeComponent.js +2 -2
  77. package/components/DynamicSort/subcomponents/FieldTypes/FieldTypeInterface.d.ts +4 -4
  78. package/components/DynamicSort/subcomponents/FieldTypes/StringSort/helpers.d.ts +4 -4
  79. package/components/DynamicSort/subcomponents/FieldTypes/StringSort/helpers.js +4 -4
  80. package/components/DynamicSort/subcomponents/FieldTypes/StringSort/index.js +1 -1
  81. package/components/DynamicSort/subcomponents/FieldTypes/fieldFactory.d.ts +2 -3
  82. package/components/DynamicSort/subcomponents/FieldTypes/fieldFactory.js +4 -4
  83. package/components/DynamicSort/subcomponents/InputSort/InputSort.js +11 -2
  84. package/components/DynamicSort/subcomponents/InputSort/useInputSort.d.ts +13 -1
  85. package/components/DynamicSort/subcomponents/InputSort/useInputSort.js +26 -16
  86. package/components/DynamicSort/subcomponents/PopoverMenuFields/PopoverMenuFields.js +5 -4
  87. package/components/DynamicSort/subcomponents/PopoverMenuFields/usePopoverMenuFields.d.ts +2 -1
  88. package/components/DynamicSort/subcomponents/PopoverMenuFields/usePopoverMenuFields.js +6 -5
  89. package/components/DynamicSort/subcomponents/PopoverSort/usePopoverSort.d.ts +3 -2
  90. package/components/DynamicSort/subcomponents/PopoverSort/usePopoverSort.js +8 -6
  91. package/components/DynamicSort/subcomponents/SortActions/SortActions.js +1 -1
  92. package/components/DynamicSort/subcomponents/SortActions/useSortActions.js +4 -4
  93. package/components/DynamicSort/tests/fronEndHelpers.test.d.ts +1 -0
  94. package/components/DynamicSort/types.d.ts +36 -46
  95. package/components/Icon/slots/IconSlots.d.ts +2 -2
  96. package/components/Label/slots/LabelSlots.d.ts +1 -1
  97. package/components/LanguagePopover/slots/LanguagePopoverSlots.d.ts +1 -1
  98. package/components/LoadingError/slots/LoadingErrorSlots.d.ts +8 -8
  99. package/components/MenuActions/MenuActions.js +1 -1
  100. package/components/MenuActions/slots/MenuActionsSlots.d.ts +6 -6
  101. package/components/MenuActions/types.d.ts +4 -7
  102. package/components/ModalDialog/slots/ModalDialogSlots.d.ts +2 -2
  103. package/components/NoItemSelected/slots/NoItemSelectedSlots.d.ts +3 -3
  104. package/components/NumberInput/slots/NumberInputSlots.d.ts +5 -5
  105. package/components/ObjectLogs/index.js +1 -1
  106. package/components/PDFViewer/slots/PDFViewerSlots.d.ts +1 -1
  107. package/components/Pager/Pager.js +4 -1
  108. package/components/Pager/slots/PagerSlots.d.ts +4 -4
  109. package/components/PaperForm/slots/PaperFormSlots.d.ts +3 -3
  110. package/components/PropertyValue/slots/PropertyValueSlots.d.ts +3 -3
  111. package/components/ScrollBar/slots/ScrollBarSlots.d.ts +1 -1
  112. package/components/SideBar/slots/SideBarSlots.d.ts +15 -15
  113. package/components/ToastContainer/slots/toastContainerSlots.d.ts +7 -7
  114. package/components/WindowBase/slots/WindowBaseSlots.d.ts +8 -8
  115. package/components/WindowBase/subcomponents/Header/types.d.ts +2 -4
  116. package/components/WindowConfirm/slots/WindowConfirmSlots.d.ts +8 -8
  117. package/components/areas/components/AreasAdmin/slots/AreasAdminSlots.d.ts +17 -17
  118. package/components/areas/components/AreasAdmin/subcomponents/AreaChip/AreaChip.js +1 -1
  119. package/components/areas/components/AreasViewer/slots/AreasViewerSlots.d.ts +5 -5
  120. package/components/areas/components/AreasViewer/subcomponents/Area/subcomponents/Window/subcomponents/Component/index.js +2 -2
  121. package/components/areas/components/AreasViewer/subcomponents/Area/subcomponents/Window/subcomponents/Component/types.d.ts +1 -0
  122. package/components/areas/contexts/WindowToolsMFContext/types.d.ts +1 -1
  123. package/components/areas/types.d.ts +2 -4
  124. package/components/extended/React-Spinners/PropagateLoaderSpinner/slots/PropagateLoaderSpinnerSlots.d.ts +1 -1
  125. package/components/extended/React-Splitter-Layout/slots/SplitLayoutSlots.d.ts +3 -3
  126. package/components/extended/React-Window/FixedSizeList/slots/FixedSizeListSlots.js +1 -1
  127. package/components/extended/React-Window/VariableSizeList/VariableSizeList.js +1 -1
  128. package/components/hook-form/RHFAutocomplete/slots/RHFAutocompleteSlots.d.ts +1 -1
  129. package/components/hook-form/RHFCheckbox/slots/RHFCheckBoxSlots.d.ts +3 -3
  130. package/components/hook-form/RHFColorPicker/slots/RHFColorPickerSlots.d.ts +1 -1
  131. package/components/hook-form/RHFDateTime/slots/RHFDateTimeSlots.d.ts +1 -1
  132. package/components/hook-form/RHFNumberInput/slots/RHFNumberInputSlots.d.ts +1 -1
  133. package/components/hook-form/RHFPeriod/slots/RHFPeriodSlots.d.ts +4 -4
  134. package/components/hook-form/RHFSelect/slots/RHFSlots.d.ts +2 -2
  135. package/components/hook-form/RHFTextField/slots/RHFTextFieldSlots.d.ts +2 -2
  136. package/components/hook-form/RHFTextFieldPassword/slots/RHFTextFieldPasswordSlots.d.ts +3 -3
  137. package/components/hook-form/RHFTimePicker/slots/RHFTimePickerSlots.d.ts +1 -1
  138. package/components/index.d.ts +27 -33
  139. package/components/mui_extended/Accordion/slots/AccordionSlots.d.ts +2 -2
  140. package/components/mui_extended/Autocomplete/slots/AutocompleteSlots.d.ts +5 -5
  141. package/components/mui_extended/Autocomplete/slots/AutocompleteSlots.js +1 -1
  142. package/components/mui_extended/Avatar/slots/AvatarSlots.d.ts +1 -1
  143. package/components/mui_extended/Badge/slots/BadgeSlots.d.ts +1 -1
  144. package/components/mui_extended/Button/slots/ButtonSlots.d.ts +1 -1
  145. package/components/mui_extended/CheckBox/slots/CheckBoxSlots.d.ts +2 -2
  146. package/components/mui_extended/DateTimePicker/slots/DateTimePickerSlots.d.ts +4 -4
  147. package/components/mui_extended/Dialog/slots/DialogSlots.d.ts +2 -2
  148. package/components/mui_extended/Divider/slots/DividerSlots.d.ts +2 -2
  149. package/components/mui_extended/IconButton/IconButton.js +2 -2
  150. package/components/mui_extended/IconButton/slots/IconButtonSlots.d.ts +2 -2
  151. package/components/mui_extended/LoadingButton/slots/LoadingButtonSlots.d.ts +1 -1
  152. package/components/mui_extended/MenuDivider/slots/MenuDividerSlots.d.ts +2 -2
  153. package/components/mui_extended/MenuItem/slots/MenuItemSlots.d.ts +2 -2
  154. package/components/mui_extended/MenuItem/slots/MenuItemSlots.js +1 -1
  155. package/components/mui_extended/NavLink/slots/NavLinkSlots.d.ts +1 -1
  156. package/components/mui_extended/Popper/slots/PopperStlots.d.ts +1 -1
  157. package/components/mui_extended/Select/slots/SelectSlots.d.ts +3 -3
  158. package/components/mui_extended/Skeleton/Slots/skeletonSlots.d.ts +1 -1
  159. package/components/mui_extended/Stack/slots/StackSlot.d.ts +1 -1
  160. package/components/mui_extended/Tab/Slots/TabSlots.d.ts +1 -1
  161. package/components/mui_extended/Tabs/slots/TabsSlots.d.ts +1 -1
  162. package/components/mui_extended/TextField/slots/TextFieldSlots.d.ts +1 -1
  163. package/components/mui_extended/TimePicker/slots/TimePickerSlots.d.ts +3 -3
  164. package/components/mui_extended/ToggleButton/slots/ToggleButtonSlots.d.ts +1 -1
  165. package/components/mui_extended/ToggleIconButton/slots/ToggleIconButtonSlots.d.ts +1 -1
  166. package/components/mui_extended/Tooltip/slots/TooltipSlots.d.ts +1 -1
  167. package/components/mui_extended/Typography/slots/typographySlots.d.ts +1 -1
  168. package/components/popups/components/PopupsProvider/contexts/PopupsContext/store.js +2 -2
  169. package/components/popups/components/PopupsProvider/contexts/PopupsContext/types.d.ts +6 -13
  170. package/components/popups/components/PopupsProvider/hooks/usePopops/usePopups.js +1 -1
  171. package/components/popups/components/PopupsViewer/slots/popupsViewerSlots.d.ts +5 -5
  172. package/hooks/index.d.ts +1 -0
  173. package/hooks/useDynamicFilterAndSort/constants.d.ts +1 -0
  174. package/hooks/useDynamicFilterAndSort/constants.js +4 -0
  175. package/hooks/useDynamicFilterAndSort/icons.d.ts +6 -0
  176. package/hooks/useDynamicFilterAndSort/icons.js +11 -0
  177. package/hooks/useDynamicFilterAndSort/index.d.ts +2 -0
  178. package/hooks/useDynamicFilterAndSort/index.js +1 -0
  179. package/hooks/useDynamicFilterAndSort/slots/DynamicFilterAndSortEnum.d.ts +5 -0
  180. package/hooks/useDynamicFilterAndSort/slots/DynamicFilterAndSortEnum.js +9 -0
  181. package/hooks/useDynamicFilterAndSort/slots/DynamicFilterAndSortSlots.d.ts +9 -0
  182. package/hooks/useDynamicFilterAndSort/slots/DynamicFilterAndSortSlots.js +22 -0
  183. package/hooks/useDynamicFilterAndSort/styles.d.ts +2 -0
  184. package/hooks/useDynamicFilterAndSort/styles.js +43 -0
  185. package/hooks/useDynamicFilterAndSort/types.d.ts +34 -0
  186. package/hooks/useDynamicFilterAndSort/useDynamicFilterAndSort.d.ts +10 -0
  187. package/hooks/useDynamicFilterAndSort/useDynamicFilterAndSort.js +90 -0
  188. package/index.js +304 -295
  189. package/package.json +1 -1
  190. package/utils/getValidDate.d.ts +4 -0
  191. package/utils/getValidDate.js +17 -0
  192. package/utils/index.d.ts +1 -0
  193. package/vendor.js +2 -2
  194. package/not_recognized/index.js +0 -23261
@@ -1,16 +1,13 @@
1
1
  import { GetLabelType } from '@m4l/core';
2
2
  import { Sizes } from '@m4l/styles';
3
3
  import { SortField, SortFieldApplied, SortToEditApply, InitialSortApplied, OwnerState } from '../types';
4
+ import { MutableRefObject } from 'react';
4
5
  export type OpenFor = 'add' | 'edit';
5
6
  export interface PopoverSortDataBase {
6
7
  /**
7
8
  * "openFor" motivo de apertura del popup
8
9
  */
9
10
  openFor: OpenFor;
10
- /**
11
- * "fnAnchorEl" Anchor para ubicar el popup y se pone como función debido a que Immer no soporta un draft de Element
12
- */
13
- fnAnchorEl: () => Element;
14
11
  }
15
12
  export interface PopoverSortDataAdd extends PopoverSortDataBase {
16
13
  openFor: 'add';
@@ -31,14 +28,14 @@ export interface PopoverSortDataEdit extends PopoverSortDataBase {
31
28
  * Tipo usado para cuado se va agregar o modificar un sort
32
29
  */
33
30
  export type PopoverSortData = PopoverSortDataAdd | PopoverSortDataEdit;
34
- /**
35
- * Estados que se actulizan por fuera del store, a través de hooks
36
- */
37
- export type ExternalOwnerState = Pick<OwnerState, 'isMobile' | 'isSkeleton'>;
38
31
  /**
39
32
  * Interface que define el estado del componente
40
33
  */
41
34
  export interface DynamicSortState {
35
+ /**
36
+ * "storeId" identificador del store
37
+ */
38
+ storeId?: string;
42
39
  /**
43
40
  * "fields" Campos por los que se puede filtrar
44
41
  */
@@ -52,11 +49,9 @@ export interface DynamicSortState {
52
49
  */
53
50
  automatic: boolean;
54
51
  /**
55
- * Funcion que retorna el elemento (InputSort) desde donde se desprende el listado de campos
56
- * Si no está definida, el menú de campos no se muestra
57
- * @returns
52
+ * "isOpenPopoverMenuFields" determina si se debe abrir el menú de campos
58
53
  */
59
- fnAnchorEl?: () => Element;
54
+ isOpenPopoverMenuFields?: boolean;
60
55
  /**
61
56
  * "inputData" texto en el InputSort
62
57
  */
@@ -94,6 +89,14 @@ export interface DynamicSortStateWithActions extends DynamicSortState {
94
89
  * @param initialSortApplyed sorts iniciales
95
90
  */
96
91
  init: (initialSortApplyed: Array<InitialSortApplied>) => void;
92
+ /**
93
+ * "setElementRef" establece la referencia al elemento (inputFilter) desde donde se desprende el listado de campos
94
+ */
95
+ setElementRef: (ref: MutableRefObject<HTMLElement | null>) => void;
96
+ /**
97
+ * "getElementRef" obtiene la referencia al elemento (inputFilter) desde donde se desprende el listado de campos
98
+ */
99
+ getElementRef: () => MutableRefObject<HTMLElement | null> | null;
97
100
  /**
98
101
  * Objetiene el Campo dado el nombre
99
102
  * @param name
@@ -111,14 +114,14 @@ export interface DynamicSortStateWithActions extends DynamicSortState {
111
114
  * @param field Campo por el cual se va filtrar
112
115
  * @returns
113
116
  */
114
- showPopoverSortForAdd: (anchorEl: Element, field: SortField) => void;
117
+ showPopoverSortForAdd: (field: SortField) => void;
115
118
  /**
116
119
  * Muestra la ventan de edición de un sort aplicado
117
120
  * @param anchorEl Anchor de elemento desde donde debe emerger
118
121
  * @param sortToEdit sort a editar
119
122
  * @returns
120
123
  */
121
- showPopoverSortForEdit: (anchorEl: Element, sortToEdit: SortFieldApplied) => void;
124
+ showPopoverSortForEdit: (sortToEdit: SortFieldApplied) => void;
122
125
  /**
123
126
  * Oculta la ventana de edición
124
127
  * @param stayInEditon determina si continua en edicióin
@@ -161,18 +164,12 @@ export interface DynamicSortStateWithActions extends DynamicSortState {
161
164
  * @returns
162
165
  */
163
166
  setInEdition: (newInEdition: boolean) => void;
164
- /**
165
- * Modifica los estados que se actualizan externamente al Store
166
- * @param newIsMobile
167
- * @returns
168
- */
169
- setExternalState: (newExternalState: ExternalOwnerState) => void;
170
167
  /**
171
168
  * Establece la función de apertura del menuu de campos
172
169
  * @param anchorEl
173
170
  * @returns
174
171
  */
175
- openPopoverMenuFields: (anchorEl: Element) => void;
172
+ openPopoverMenuFields: () => void;
176
173
  /**
177
174
  * Limpia la función de apertura del menu de campos (por el valor anchorEl = undefined)
178
175
  */
@@ -183,4 +180,4 @@ export interface DynamicSortStateWithActions extends DynamicSortState {
183
180
  setSize: (size: Extract<Sizes, 'small' | 'medium'>) => void;
184
181
  };
185
182
  }
186
- export type InitialStoreProps = Pick<DynamicSortState, 'automatic' | 'fields' | 'getLabel' | 'ownerState' | 'dataTestId' | 'size'>;
183
+ export type InitialStoreProps = Pick<DynamicSortState, 'automatic' | 'fields' | 'getLabel' | 'ownerState' | 'dataTestId' | 'size' | 'storeId'>;
@@ -1,4 +1,4 @@
1
- import { DynamicSortStateWithActions } from './type';
1
+ import { DynamicSortStateWithActions } from './types';
2
2
  /**
3
3
  * Hook que permite acceder al store de DynamicSort
4
4
  */
@@ -7,7 +7,7 @@ function useDynamicSortStore(selector, equalityFn) {
7
7
  if (!store) {
8
8
  throw new Error("useDynamicSortStore context must be use inside DynamicSortContext");
9
9
  }
10
- return useStore(store, selector, shallow);
10
+ return useStore(store, selector, equalityFn ?? shallow);
11
11
  }
12
12
  export {
13
13
  useDynamicSortStore as u
@@ -5,7 +5,7 @@ import { SortFieldApplied } from '../../types';
5
5
  */
6
6
  declare function useAppliedSortChip(sort: SortFieldApplied): {
7
7
  onDelete: () => void;
8
- onEditSort: (event: MouseEvent<HTMLButtonElement>) => void;
8
+ onEditSort: (_event: MouseEvent<HTMLButtonElement>) => void;
9
9
  iconFieldUrl: string;
10
10
  labels: import('../../types').DataTypeFilerLabels;
11
11
  iconSort: string;
@@ -13,16 +13,15 @@ function useAppliedSortChip(sort) {
13
13
  );
14
14
  const iconSort = sort.operator === "asc" ? `${host_static_assets}/${environment_assets}/${ascending}` : `${host_static_assets}/${environment_assets}/${descending}`;
15
15
  const labels = useMemo(() => {
16
- return fieldFactory(sort.field.type).getLabels(sort, getLabel, formatters, sort.field);
16
+ return fieldFactory().getLabels(sort, getLabel, formatters, sort.field);
17
17
  }, [sort, getLabel]);
18
18
  function onDelete() {
19
19
  hidePopoverSort(false);
20
20
  removeSort(sort.id);
21
21
  }
22
- function onEditSort(event) {
22
+ function onEditSort(_event) {
23
23
  hidePopoverSort(false);
24
- const currentTarget = event.currentTarget;
25
- setTimeout(() => showPopoverSortForEdit(currentTarget, sort), 10);
24
+ setTimeout(() => showPopoverSortForEdit(sort), 10);
26
25
  }
27
26
  return {
28
27
  onDelete,
@@ -18,7 +18,7 @@ function AppliedSorts() {
18
18
  {
19
19
  ...getPropDataTestId(DYNAMIC_SORT_KEY_COMPONENT, DynamicSortSlots.appliedSorts, dataTestId),
20
20
  ownerState: { ...ownerState },
21
- children: /* @__PURE__ */ jsx(ScrollBar, { autoHide: true, children: /* @__PURE__ */ jsx(AppliedSortInnerContainerStyled, { ownerState: {}, children: appliedSortsSorted?.map((sort) => /* @__PURE__ */ jsx(AppliedSortChip, { ...sort }, sort.id)) }) })
21
+ children: /* @__PURE__ */ jsx(ScrollBar, { autoHide: true, children: /* @__PURE__ */ jsx(AppliedSortInnerContainerStyled, { ownerState: {}, children: appliedSortsSorted?.reverse()?.map((sort) => /* @__PURE__ */ jsx(AppliedSortChip, { ...sort }, sort.id)) }) })
22
22
  }
23
23
  );
24
24
  }
@@ -2,7 +2,7 @@
2
2
  * Hook que permite obtener los datos necesarios para mostrar los sorts aplicados
3
3
  */
4
4
  declare function useAppliedSorts(): {
5
- appliedSortsSorted: import('../..').SortFieldApply[];
5
+ appliedSortsSorted: import('../..').SortFieldApplied[];
6
6
  isSkeleton: boolean;
7
7
  };
8
8
  export default useAppliedSorts;
@@ -1,7 +1,8 @@
1
+ import { useModuleSkeleton } from "@m4l/core";
1
2
  import { u as useDynamicSortStore } from "../../store/useDynamicSortStore.js";
2
3
  function useAppliedSorts() {
3
4
  const appliedSort = useDynamicSortStore((state) => state.appliedSorts);
4
- const isSkeleton = useDynamicSortStore((state) => state.ownerState.isSkeleton);
5
+ const isSkeleton = useModuleSkeleton();
5
6
  const appliedSortsSorted = [...appliedSort].sort(
6
7
  (sortA, sortB) => sortA.isSet !== sortB.isSet ? Number(sortA.isSet) - Number(sortB.isSet) : sortB.id - sortA.id
7
8
  );
@@ -2,6 +2,8 @@ import { jsx, jsxs } from "react/jsx-runtime";
2
2
  import { g as getPropDataTestId } from "../../../../test/getNameDataTestId.js";
3
3
  import { D as DYNAMIC_SORT_KEY_COMPONENT } from "../../constants.js";
4
4
  import { u as useDynamicSortBase } from "./useDynamicSortBase.js";
5
+ import { D as DYNAMICSORT_DICTIONARY_ID } from "../../dictionary.js";
6
+ import { a as getComponentSlotRoot } from "../../../../utils/getComponentSlotRoot.js";
5
7
  import { R as RootStyled, I as InnerContainerStyled } from "../../slots/DynamicSortSlots.js";
6
8
  import { D as DynamicSortSlots } from "../../slots/SlotsEnum.js";
7
9
  import { I as InputSort } from "../InputSort/InputSort.js";
@@ -10,9 +12,11 @@ import { S as SortActions } from "../SortActions/SortActions.js";
10
12
  import { P as PopoverSort } from "../PopoverSort/PopoverSort.js";
11
13
  function DynamicSortBase() {
12
14
  const { ownerState, dataTestId } = useDynamicSortBase();
15
+ const classRoot = getComponentSlotRoot(DYNAMICSORT_DICTIONARY_ID);
13
16
  return /* @__PURE__ */ jsx(
14
17
  RootStyled,
15
18
  {
19
+ className: classRoot,
16
20
  ownerState: { ...ownerState },
17
21
  ...getPropDataTestId(DYNAMIC_SORT_KEY_COMPONENT, DynamicSortSlots.root, dataTestId),
18
22
  children: /* @__PURE__ */ jsxs(
@@ -3,9 +3,9 @@ import { useEffect } from "react";
3
3
  import { useFormContext } from "react-hook-form";
4
4
  import { f as fieldFactory } from "./fieldFactory.js";
5
5
  function DataTypeComponent(props) {
6
- const { formSort, statusLoad } = props;
6
+ const { statusLoad } = props;
7
7
  const { setFocus } = useFormContext();
8
- const Component = fieldFactory(formSort.field.type).getComponent();
8
+ const Component = fieldFactory().getComponent();
9
9
  useEffect(() => {
10
10
  setTimeout(() => setFocus("formValueOperator"), 100);
11
11
  }, [statusLoad]);
@@ -1,20 +1,20 @@
1
1
  import { FC } from 'react';
2
2
  import { GetLabelType } from '@m4l/core';
3
3
  import { Formatters } from '@m4l/graphics';
4
- import { SortField, SortFieldApplied, DataTypeFilerLabels, SortValue, InitialSortApplied } from '../../types';
4
+ import { SortField, SortFieldApplied, DataTypeFilerLabels, SortValue, InitialSortApplied, FormSortValueBase } from '../../types';
5
5
  import * as Yup from 'yup';
6
6
  export type YupSchema = Yup.SchemaOf<any>;
7
7
  /**
8
8
  * Interface para crear los helpers de cada tipo de campo
9
9
  */
10
- export interface IFieldType<T> {
10
+ export interface IFieldType {
11
11
  getComponent(): FC<{
12
12
  [key: string]: any;
13
13
  }>;
14
14
  getDefaultSort(field: SortField, fixed: boolean): SortFieldApplied;
15
15
  getLabels(Sort: SortFieldApplied, getLabel: GetLabelType, formatters: Formatters, field: SortField): DataTypeFilerLabels;
16
16
  getSchema(getLabel: GetLabelType): YupSchema;
17
- getFormValue(field: SortField, getLabel: GetLabelType, sortValue?: SortValue): T;
18
- getSortFromFormValue(formSortValue: T): SortValue;
17
+ getFormValue(field: SortField, getLabel: GetLabelType, sortValue?: SortValue): FormSortValueBase;
18
+ getSortFromFormValue(formSortValue: FormSortValueBase): SortValue;
19
19
  verifySort(Sort: InitialSortApplied, field?: SortField): boolean;
20
20
  }
@@ -1,12 +1,12 @@
1
1
  import { GetLabelType } from '@m4l/core';
2
2
  import { Formatters } from '@m4l/graphics';
3
3
  import { IFieldType, YupSchema } from '../FieldTypeInterface';
4
- import { DataTypeFilerLabels, SortField, SortFieldApplied, SortValue, FormSortValueString, InitialSortApplied } from '../../../types';
4
+ import { DataTypeFilerLabels, SortField, SortFieldApplied, SortValue, FormSortValueBase, InitialSortApplied } from '../../../types';
5
5
  import { StringSort } from './index';
6
6
  /**
7
7
  * Clase que implementa los métodos necesarios para el tipo de campo string
8
8
  */
9
- export declare class StringSortHelpers implements IFieldType<FormSortValueString> {
9
+ export declare class SortHelpers implements IFieldType {
10
10
  getComponent(): typeof StringSort;
11
11
  /**
12
12
  * getDefaulSort obtiene el valor por defecto de un campo de tipo string
@@ -15,11 +15,11 @@ export declare class StringSortHelpers implements IFieldType<FormSortValueString
15
15
  /**
16
16
  * getSortFromFormValue obtiene el valor de un campo de tipo string
17
17
  */
18
- getSortFromFormValue(formSortValue: FormSortValueString): SortValue;
18
+ getSortFromFormValue(formSortValue: FormSortValueBase): SortValue;
19
19
  /**
20
20
  * getFormValue obtiene el valor de un campo de tipo string
21
21
  */
22
- getFormValue(field: SortField, _getLabel: GetLabelType, sortValue?: SortValue): FormSortValueString;
22
+ getFormValue(field: SortField, _getLabel: GetLabelType, sortValue?: SortValue): FormSortValueBase;
23
23
  /**
24
24
  * getLabels obtiene las etiquetas de un campo de tipo string
25
25
  */
@@ -1,8 +1,8 @@
1
1
  import * as Yup from "yup";
2
2
  import { g as getDynamicSortDictionary } from "../../../dictionary.js";
3
- import { S as SORT_OPERATORS } from "../../../constants.js";
3
+ import { O as OPERATORS } from "../../../constants.js";
4
4
  import { S as StringSort } from "./index.js";
5
- class StringSortHelpers {
5
+ class SortHelpers {
6
6
  getComponent() {
7
7
  return StringSort;
8
8
  }
@@ -70,12 +70,12 @@ class StringSortHelpers {
70
70
  if (typeof Sort.operator !== "string") {
71
71
  return false;
72
72
  }
73
- if (SORT_OPERATORS.findIndex((f) => f === Sort.operator) === -1) {
73
+ if (OPERATORS.findIndex((f) => f === Sort.operator) === -1) {
74
74
  return false;
75
75
  }
76
76
  return typeof Sort.operator === "string";
77
77
  }
78
78
  }
79
79
  export {
80
- StringSortHelpers as S
80
+ SortHelpers as S
81
81
  };
@@ -2,7 +2,7 @@ import { jsx } from "react/jsx-runtime";
2
2
  import { useMemo } from "react";
3
3
  import { useModuleDictionary, useEnvironment } from "@m4l/core";
4
4
  import { a as ascending, d as descending } from "../../../icons.js";
5
- import { g as getDynamicSortDictionary, D as DICCTIONARY } from "../../../dictionary.js";
5
+ import { g as getDynamicSortDictionary, a as DICCTIONARY } from "../../../dictionary.js";
6
6
  import { u as useDynamicSortBase } from "../../DynamicSortBase/useDynamicSortBase.js";
7
7
  import { R as RHFSelect } from "../../../../hook-form/RHFSelect/RHFSelect.js";
8
8
  import { I as Icon } from "../../../../Icon/Icon.js";
@@ -1,6 +1,5 @@
1
- import { FieldType } from '../../types';
2
- import { StringSortHelpers } from './StringSort/helpers';
1
+ import { SortHelpers } from './StringSort/helpers';
3
2
  /**
4
3
  * Factory que retorna el helper correspondiente al tipo de campo
5
4
  */
6
- export declare function fieldFactory(type: FieldType): StringSortHelpers;
5
+ export declare function fieldFactory(): SortHelpers;
@@ -1,12 +1,12 @@
1
- import { S as StringSortHelpers } from "./StringSort/helpers.js";
1
+ import { S as SortHelpers } from "./StringSort/helpers.js";
2
2
  const helpersStrategies = {
3
- string: new StringSortHelpers(),
3
+ string: new SortHelpers(),
4
4
  __default__: () => {
5
5
  throw new Error("Type no defined");
6
6
  }
7
7
  };
8
- function fieldFactory(type) {
9
- const selectedHelper = helpersStrategies?.[type];
8
+ function fieldFactory() {
9
+ const selectedHelper = helpersStrategies?.["string"];
10
10
  if (!selectedHelper) {
11
11
  return helpersStrategies.__default__();
12
12
  }
@@ -1,6 +1,7 @@
1
1
  import { jsxs, jsx } from "react/jsx-runtime";
2
2
  import { u as useInputSort } from "./useInputSort.js";
3
3
  import { u as useDynamicSortBase } from "../DynamicSortBase/useDynamicSortBase.js";
4
+ import { useRef, useEffect } from "react";
4
5
  import { c as InputSortStyled, d as InputSortIconStyled, e as InputSortInputSkeletonStyled, f as InputSortInputStyled } from "../../slots/DynamicSortSlots.js";
5
6
  import { P as PopoverMenuFields } from "../PopoverMenuFields/PopoverMenuFields.js";
6
7
  const InputSort = () => {
@@ -11,14 +12,22 @@ const InputSort = () => {
11
12
  inputData,
12
13
  inputHandlersProps,
13
14
  sortFields,
14
- selectedFieldIndex
15
+ selectedFieldIndex,
16
+ setElementRef,
17
+ isOpenPopoverMenuFields,
18
+ isOpenPopoverSort
15
19
  } = useInputSort();
20
+ const elementRef = useRef(null);
21
+ useEffect(() => {
22
+ setElementRef(elementRef);
23
+ }, [setElementRef]);
16
24
  const { ownerState, size } = useDynamicSortBase();
17
- return /* @__PURE__ */ jsxs(InputSortStyled, { ownerState: { ...ownerState }, children: [
25
+ return /* @__PURE__ */ jsxs(InputSortStyled, { ownerState: { ...ownerState }, "aria-expanded": isOpenPopoverMenuFields || isOpenPopoverSort, children: [
18
26
  /* @__PURE__ */ jsx(InputSortIconStyled, { src: iconUrl, size, ownerState: { ...ownerState } }),
19
27
  isSkeleton ? /* @__PURE__ */ jsx(InputSortInputSkeletonStyled, { ownerState: { ...ownerState }, variant: "rounded" }) : /* @__PURE__ */ jsx(
20
28
  InputSortInputStyled,
21
29
  {
30
+ ref: elementRef,
22
31
  type: "text",
23
32
  value: inputData,
24
33
  placeholder: inputPlaceHolder,
@@ -27,7 +27,7 @@ declare function useInputSort(): {
27
27
  /**
28
28
  * Evento de foco del inputSort
29
29
  */
30
- onFocus: (event: FocusEvent<HTMLInputElement>) => void;
30
+ onFocus: (_event: FocusEvent<HTMLInputElement>) => void;
31
31
  /**
32
32
  * Evento de cambio del inputSort
33
33
  */
@@ -45,5 +45,17 @@ declare function useInputSort(): {
45
45
  * Indice del campo seleccionado
46
46
  */
47
47
  selectedFieldIndex: number;
48
+ /**
49
+ * Actualiza la referencia del elemento (inputSort)
50
+ */
51
+ setElementRef: (ref: import('react').MutableRefObject<HTMLElement | null>) => void;
52
+ /**
53
+ * Indica si el menú de campos está abierto
54
+ */
55
+ isOpenPopoverMenuFields: boolean | undefined;
56
+ /**
57
+ * Indica si el popoverSort está abierto
58
+ */
59
+ isOpenPopoverSort: boolean;
48
60
  };
49
61
  export default useInputSort;
@@ -1,27 +1,28 @@
1
1
  import { useState, useEffect } from "react";
2
2
  import { useEnvironment, useModuleDictionary, useModuleSkeleton } from "@m4l/core";
3
- import { g as getDynamicSortDictionary, D as DICCTIONARY } from "../../dictionary.js";
3
+ import { g as getDynamicSortDictionary, a as DICCTIONARY } from "../../dictionary.js";
4
4
  import { u as useDynamicSortStore } from "../../store/useDynamicSortStore.js";
5
- import { A as ASSETS_URL, a as ASSETS } from "../../constants.js";
5
+ import { A as ASSETS_URL, b as ASSETS } from "../../constants.js";
6
6
  function useInputSort() {
7
7
  const [selectedFieldIndex, setSelectedFieldIndex] = useState(-1);
8
8
  const [sortFields, setSortedFields] = useState([]);
9
9
  const { host_static_assets, environment_assets } = useEnvironment();
10
10
  const { getLabel } = useModuleDictionary();
11
11
  const isSkeleton = useModuleSkeleton();
12
- const anchorEl = useDynamicSortStore((state) => state.fnAnchorEl);
12
+ const isOpenPopoverMenuFields = useDynamicSortStore((state) => state.isOpenPopoverMenuFields);
13
13
  const availableFields = useDynamicSortStore((state) => state.availableFields);
14
14
  const inputData = useDynamicSortStore((state) => state.inputData);
15
+ const isOpenPopoverSort = useDynamicSortStore((state) => !!state.popoverSortData);
15
16
  const {
16
17
  closePopoverMenuFields,
17
18
  hidePopoverSort,
18
19
  openPopoverMenuFields,
19
- setInEdition,
20
20
  setInputData,
21
- showPopoverSortForAdd
21
+ showPopoverSortForAdd,
22
+ setElementRef
22
23
  } = useDynamicSortStore((state) => state.actions);
23
24
  useEffect(() => {
24
- if (!anchorEl) {
25
+ if (!isOpenPopoverMenuFields) {
25
26
  setSortedFields([]);
26
27
  } else {
27
28
  setSortedFields(
@@ -31,28 +32,25 @@ function useInputSort() {
31
32
  );
32
33
  setSelectedFieldIndex(-1);
33
34
  }
34
- }, [anchorEl, inputData, availableFields, getLabel]);
35
+ }, [isOpenPopoverMenuFields, inputData, availableFields, getLabel]);
35
36
  function handleOpenPopUpClickItem(field) {
36
37
  closePopoverMenuFields();
37
- if (anchorEl) {
38
- showPopoverSortForAdd(anchorEl(), field);
39
- }
38
+ showPopoverSortForAdd(field);
40
39
  }
41
40
  const inputHandlersProps = {
42
41
  /**
43
42
  * Evento de foco del inputSort
44
43
  */
45
- onFocus: (event) => {
46
- openPopoverMenuFields(event.currentTarget);
47
- setInEdition(true);
44
+ onFocus: (_event) => {
45
+ openPopoverMenuFields();
48
46
  },
49
47
  /**
50
48
  * Evento de cambio del inputSort
51
49
  */
52
50
  onChange: (event) => {
53
51
  setInputData(event.target.value);
54
- if (!anchorEl) {
55
- openPopoverMenuFields(event.currentTarget);
52
+ if (!isOpenPopoverMenuFields) {
53
+ openPopoverMenuFields();
56
54
  }
57
55
  hidePopoverSort(true);
58
56
  },
@@ -124,7 +122,19 @@ function useInputSort() {
124
122
  /**
125
123
  * Indice del campo seleccionado
126
124
  */
127
- selectedFieldIndex
125
+ selectedFieldIndex,
126
+ /**
127
+ * Actualiza la referencia del elemento (inputSort)
128
+ */
129
+ setElementRef,
130
+ /**
131
+ * Indica si el menú de campos está abierto
132
+ */
133
+ isOpenPopoverMenuFields,
134
+ /**
135
+ * Indica si el popoverSort está abierto
136
+ */
137
+ isOpenPopoverSort
128
138
  };
129
139
  }
130
140
  export {
@@ -4,8 +4,9 @@ import { u as useDynamicSortBase } from "../DynamicSortBase/useDynamicSortBase.j
4
4
  import { P as PopoverMenuStyled, g as PopoverMenuItemStyled, h as PopoverMenuItemIconStyled } from "../../slots/DynamicSortSlots.js";
5
5
  function PopoverMenuFields(props) {
6
6
  const { fields, selectFieldIndex } = props;
7
- const { fnAnchorEl, handleOpenPopUpClickItem, handleClosePopover, getItemLabel } = usePopoverMenuFields();
7
+ const { elementRef, handleOpenPopUpClickItem, handleClosePopover, getItemLabel, isOpenPopoverMenuFields } = usePopoverMenuFields();
8
8
  const { size } = useDynamicSortBase();
9
+ const anchorEl = elementRef?.current;
9
10
  return /* @__PURE__ */ jsx(
10
11
  PopoverMenuStyled,
11
12
  {
@@ -14,11 +15,11 @@ function PopoverMenuFields(props) {
14
15
  arrowType: "top-left",
15
16
  anchorOrigin: { vertical: "bottom", horizontal: "left" },
16
17
  transformOrigin: { vertical: "top", horizontal: "left" },
17
- open: Boolean(fnAnchorEl),
18
+ open: !!isOpenPopoverMenuFields,
18
19
  onClose: handleClosePopover,
19
- anchorEl: fnAnchorEl?.(),
20
+ anchorEl,
20
21
  ownerState: {},
21
- children: Boolean(fnAnchorEl) && fields.map((field, index) => /* @__PURE__ */ jsx(
22
+ children: isOpenPopoverMenuFields && fields.map((field, index) => /* @__PURE__ */ jsx(
22
23
  PopoverMenuItemStyled,
23
24
  {
24
25
  startIcon: /* @__PURE__ */ jsx(PopoverMenuItemIconStyled, { size, src: field.urlIcon, ownerState: {} }),
@@ -4,7 +4,8 @@ import { SortField } from '../../types';
4
4
  * TODO: Documentar
5
5
  */
6
6
  declare function usePopoverMenuFields(): {
7
- fnAnchorEl: (() => Element) | undefined;
7
+ elementRef: import('react').MutableRefObject<HTMLElement | null> | null;
8
+ isOpenPopoverMenuFields: boolean | undefined;
8
9
  getItemLabel: (field: SortField) => string;
9
10
  handleClosePopover: () => void;
10
11
  handleOpenPopUpClickItem: (_event: MouseEvent<HTMLLIElement>, field: SortField) => void;
@@ -1,15 +1,15 @@
1
1
  import { useModuleDictionary } from "@m4l/core";
2
2
  import { u as useDynamicSortStore } from "../../store/useDynamicSortStore.js";
3
+ import { shallow } from "zustand/shallow";
3
4
  function usePopoverMenuFields() {
4
5
  const { getLabel } = useModuleDictionary();
5
- const fnAnchorEl = useDynamicSortStore((state) => state.fnAnchorEl);
6
+ const isOpenPopoverMenuFields = useDynamicSortStore((state) => state.isOpenPopoverMenuFields);
7
+ const elementRef = useDynamicSortStore((state) => state.actions.getElementRef(), shallow);
6
8
  const { showPopoverSortForAdd, closePopoverMenuFields } = useDynamicSortStore(
7
9
  (state) => state.actions
8
10
  );
9
11
  function handleOpenPopUpClickItem(_event, field) {
10
- if (fnAnchorEl) {
11
- showPopoverSortForAdd(fnAnchorEl(), field);
12
- }
12
+ showPopoverSortForAdd(field);
13
13
  }
14
14
  function handleClosePopover() {
15
15
  closePopoverMenuFields(false);
@@ -18,7 +18,8 @@ function usePopoverMenuFields() {
18
18
  return field.label ?? getLabel(field.dictionaryId);
19
19
  }
20
20
  return {
21
- fnAnchorEl,
21
+ elementRef,
22
+ isOpenPopoverMenuFields,
22
23
  getItemLabel,
23
24
  handleClosePopover,
24
25
  handleOpenPopUpClickItem
@@ -1,5 +1,6 @@
1
1
  import { KeyboardEvent } from 'react';
2
2
  import { FieldValues } from 'react-hook-form';
3
+ import { Maybe } from '@m4l/core';
3
4
  import { FormSortFieldApplied, SortField } from '../../types';
4
5
  /**
5
6
  * TODO: Documentar
@@ -8,12 +9,12 @@ declare function usePopoverSort(): {
8
9
  field: SortField;
9
10
  labelField: string;
10
11
  canRender: boolean;
11
- anchorEl: Element;
12
+ anchorEl: Maybe<HTMLElement>;
12
13
  handleKeyDownPopper: (event: KeyboardEvent<HTMLDivElement>) => void;
13
14
  handleClosePopover: () => void;
14
15
  onSubmit: (dataFieldValues: FieldValues) => Promise<void>;
15
16
  onClose: () => void;
16
- sortFormValue: import('../../types').FormSortValueString;
17
+ sortFormValue: import('../../types').FormSortValueBase;
17
18
  formSort: FormSortFieldApplied;
18
19
  popupValidationSchema: import('yup').ArraySchema<import('yup').BaseSchema<unknown, import('yup/lib/object').AnyObject, unknown> | import('yup/lib/Lazy').default<import('yup').BaseSchema<unknown, import('yup/lib/object').AnyObject, unknown>, import('yup/lib/object').AnyObject>, import('yup/lib/types').AnyObject, unknown[] | undefined, unknown[] | undefined> | import('yup').BaseSchema<any, import('yup/lib/object').AnyObject, any> | import('yup').ObjectSchema<{
19
20
  [x: string]: import('yup').ObjectSchema</*elided*/ any, import('yup/lib/object').AnyObject, import('yup/lib/object').TypeOfShape</*elided*/ any>, import('yup/lib/object').AssertsShape</*elided*/ any>> | import('yup').BaseSchema<any, import('yup/lib/object').AnyObject, any> | import('yup').ArraySchema<import('yup').BaseSchema<unknown, import('yup/lib/object').AnyObject, unknown> | import('yup/lib/Lazy').default<import('yup').BaseSchema<unknown, import('yup/lib/object').AnyObject, unknown>, import('yup/lib/object').AnyObject>, import('yup/lib/types').AnyObject, unknown[] | undefined, unknown[] | undefined> | import('yup/lib/Lazy').default<import('yup').ObjectSchema</*elided*/ any, import('yup/lib/object').AnyObject, import('yup/lib/object').TypeOfShape</*elided*/ any>, import('yup/lib/object').AssertsShape</*elided*/ any>>, any>;
@@ -2,6 +2,7 @@ import { useRef, useMemo, useCallback } from "react";
2
2
  import { useModuleDictionary } from "@m4l/core";
3
3
  import { u as useDynamicSortStore } from "../../store/useDynamicSortStore.js";
4
4
  import { f as fieldFactory } from "../FieldTypes/fieldFactory.js";
5
+ import { shallow } from "zustand/shallow";
5
6
  function usePopoverSort() {
6
7
  let anchorEl;
7
8
  let field;
@@ -9,10 +10,11 @@ function usePopoverSort() {
9
10
  let sortFormValue;
10
11
  let popupValidationSchema;
11
12
  const { getLabel } = useModuleDictionary();
12
- const popoverSortData = useDynamicSortStore((state) => state.popoverSortData);
13
+ const popoverSortData = useDynamicSortStore((state) => state.popoverSortData, shallow);
13
14
  const { hidePopoverSort, addSort, updateSort, getNewId } = useDynamicSortStore(
14
15
  (state) => state.actions
15
16
  );
17
+ const elementRef = useDynamicSortStore((state) => state.actions.getElementRef());
16
18
  const refPreviousPopoverSortData = useRef(popoverSortData);
17
19
  const statusLoad = useMemo(() => {
18
20
  let returnStatus;
@@ -27,9 +29,9 @@ function usePopoverSort() {
27
29
  return returnStatus;
28
30
  }, [popoverSortData]);
29
31
  if (popoverSortData?.openFor === "add") {
30
- anchorEl = popoverSortData?.fnAnchorEl();
32
+ anchorEl = elementRef?.current;
31
33
  field = popoverSortData.field;
32
- const helperField = fieldFactory(field.type);
34
+ const helperField = fieldFactory();
33
35
  popupValidationSchema = helperField.getSchema(getLabel);
34
36
  sortFormValue = helperField.getFormValue(field, getLabel);
35
37
  formSort = {
@@ -40,9 +42,9 @@ function usePopoverSort() {
40
42
  ...sortFormValue
41
43
  };
42
44
  } else if (popoverSortData) {
43
- anchorEl = popoverSortData?.fnAnchorEl();
45
+ anchorEl = elementRef?.current;
44
46
  field = popoverSortData?.sort.field;
45
- const helperField = fieldFactory(field.type);
47
+ const helperField = fieldFactory();
46
48
  popupValidationSchema = helperField.getSchema(getLabel);
47
49
  sortFormValue = helperField.getFormValue(field, getLabel, popoverSortData.sort);
48
50
  formSort = { ...popoverSortData?.sort, ...sortFormValue };
@@ -68,7 +70,7 @@ function usePopoverSort() {
68
70
  const newSort = {
69
71
  ...formSort,
70
72
  // todo: mejorar el tipado que se le envía a getSortFromFormValue
71
- ...fieldFactory(sortField.fieldType).getSortFromFormValue(sortField),
73
+ ...fieldFactory().getSortFromFormValue(sortField),
72
74
  isSet: true
73
75
  };
74
76
  if (popoverSortData?.openFor === "add") {