@m4l/components 9.2.60-19062025.beta.1 → 9.2.60-J18062025.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 (185) hide show
  1. package/@types/types.d.ts +0 -8
  2. package/components/DataGrid/DataGrid.js +17 -3
  3. package/components/DataGrid/Datagrid.styles.js +67 -24
  4. package/components/DataGrid/constants.d.ts +2 -0
  5. package/components/DataGrid/constants.js +7 -3
  6. package/components/DataGrid/contexts/DataGridContext/index.js +77 -30
  7. package/components/DataGrid/contexts/DataGridContext/types.d.ts +5 -2
  8. package/components/DataGrid/dictionary.d.ts +8 -0
  9. package/components/DataGrid/dictionary.js +26 -17
  10. package/components/DataGrid/icons.d.ts +6 -0
  11. package/components/DataGrid/icons.js +7 -1
  12. package/components/DataGrid/slots/DataGridEnum.d.ts +5 -1
  13. package/components/DataGrid/slots/DataGridEnum.js +4 -0
  14. package/components/DataGrid/slots/DataGridSlot.d.ts +4 -0
  15. package/components/DataGrid/slots/DataGridSlot.js +22 -2
  16. package/components/DataGrid/subcomponents/HeaderActions/subcomponents/Filter/index.js +9 -1
  17. package/components/DataGrid/subcomponents/Table/hooks/getDragHeaderRenderer.d.ts +3 -1
  18. package/components/DataGrid/subcomponents/Table/hooks/getDragHeaderRenderer.js +9 -2
  19. package/components/DataGrid/subcomponents/Table/hooks/useHeaderMenuActions.d.ts +6 -0
  20. package/components/DataGrid/subcomponents/Table/hooks/useHeaderMenuActions.js +259 -0
  21. package/components/DataGrid/subcomponents/Table/hooks/useSortColumnsRows.d.ts +6 -4
  22. package/components/DataGrid/subcomponents/Table/hooks/useSortColumnsRows.js +35 -18
  23. package/components/DataGrid/subcomponents/Table/index.js +97 -34
  24. package/components/DataGrid/subcomponents/Table/subcomponents/ActionsColumn.js +1 -1
  25. package/components/DataGrid/subcomponents/Table/subcomponents/DraggableHeaderRenderer.d.ts +1 -0
  26. package/components/DataGrid/subcomponents/Table/subcomponents/DraggableHeaderRenderer.js +42 -3
  27. package/components/DataGrid/subcomponents/Table/subcomponents/HeaderRenderClick/HeaderRenderClick.d.ts +5 -0
  28. package/components/DataGrid/subcomponents/Table/subcomponents/HeaderRenderClick/HeaderRenderClick.js +136 -0
  29. package/components/DataGrid/subcomponents/Table/subcomponents/HeaderRenderClick/index.d.ts +1 -0
  30. package/components/DataGrid/subcomponents/Table/subcomponents/HeaderRenderClick/types.d.ts +131 -0
  31. package/components/DataGrid/subcomponents/Table/subcomponents/SelectColumn.js +1 -1
  32. package/components/DataGrid/subcomponents/editors/TextEditor/index.js +1 -1
  33. package/components/DataGrid/tests/HeaderRenderClick.test.d.ts +1 -0
  34. package/components/DataGrid/tests/useHeaderMenuActions.test.d.ts +1 -0
  35. package/components/DataGrid/types.d.ts +53 -0
  36. package/components/DynamicFilter/DynamicFilter.styles.js +90 -99
  37. package/components/DynamicFilter/slots/SlotsEnum.d.ts +3 -0
  38. package/components/DynamicFilter/slots/SlotsEnum.js +3 -0
  39. package/components/DynamicFilter/slots/dynamicFilterSlots.d.ts +9 -0
  40. package/components/DynamicFilter/slots/dynamicFilterSlots.js +19 -3
  41. package/components/DynamicFilter/store/DynamicFilterContext.js +67 -26
  42. package/components/DynamicFilter/subcomponents/FieldTypes/BooleanFilter/index.js +2 -2
  43. package/components/DynamicFilter/subcomponents/FieldTypes/DateTimeFilter/index.js +2 -2
  44. package/components/DynamicFilter/subcomponents/FieldTypes/NumberFilter/index.js +2 -2
  45. package/components/DynamicFilter/subcomponents/FieldTypes/SelectAsyncFilter/index.js +2 -2
  46. package/components/DynamicFilter/subcomponents/FieldTypes/SelectFilter/index.js +2 -2
  47. package/components/DynamicFilter/subcomponents/FieldTypes/StringFilter/index.js +2 -2
  48. package/components/DynamicFilter/subcomponents/FilterActions/FilterActions.js +1 -1
  49. package/components/DynamicFilter/subcomponents/FilterActions/useFilterActions.d.ts +0 -1
  50. package/components/DynamicFilter/subcomponents/FilterActions/useFilterActions.js +1 -2
  51. package/components/DynamicFilter/subcomponents/InputFilter/InputFilter.js +0 -2
  52. package/components/DynamicFilter/subcomponents/PopoverFilter/PopoverFilter.js +18 -23
  53. package/components/DynamicFilter/subcomponents/PopoverMenuFields/PopoverMenuFields.js +1 -4
  54. package/components/DynamicFilter/types.d.ts +3 -0
  55. package/components/DynamicSort/DynamicSort.js +10 -6
  56. package/components/DynamicSort/DynamicSort.styles.js +88 -90
  57. package/components/DynamicSort/slots/DynamicSortSlots.d.ts +9 -0
  58. package/components/DynamicSort/slots/DynamicSortSlots.js +21 -5
  59. package/components/DynamicSort/slots/SlotsEnum.d.ts +4 -1
  60. package/components/DynamicSort/slots/SlotsEnum.js +4 -1
  61. package/components/DynamicSort/store/DynamicSortContext.js +96 -67
  62. package/components/DynamicSort/store/DynamicSortStore.js +53 -4
  63. package/components/DynamicSort/store/types.d.ts +11 -0
  64. package/components/DynamicSort/subcomponents/FieldTypes/StringSort/index.js +2 -2
  65. package/components/DynamicSort/subcomponents/InputSort/InputSort.js +0 -2
  66. package/components/DynamicSort/subcomponents/PopoverSort/PopoverSort.js +17 -21
  67. package/components/DynamicSort/subcomponents/SortActions/SortActions.js +2 -2
  68. package/components/DynamicSort/subcomponents/SortActions/useSortActions.d.ts +0 -2
  69. package/components/DynamicSort/subcomponents/SortActions/useSortActions.js +1 -2
  70. package/components/DynamicSort/types.d.ts +4 -0
  71. package/components/LanguagePopover/LanguagePopover.js +6 -8
  72. package/components/LanguagePopover/LanguagePopover.styles.js +4 -25
  73. package/components/LanguagePopover/slots/LanguagePopoverSlots.d.ts +3 -9
  74. package/components/LanguagePopover/slots/LanguagePopoverSlots.js +3 -1
  75. package/components/LanguagePopover/types.d.ts +1 -6
  76. package/components/PaperForm/styles.js +1 -2
  77. package/components/PropertyValue/PropertyValue.js +1 -2
  78. package/components/PropertyValue/PropertyValue.styles.js +4 -7
  79. package/components/PropertyValue/types.d.ts +0 -4
  80. package/components/SideBar/SideBar.js +2 -4
  81. package/components/SideBar/constants.d.ts +2 -26
  82. package/components/SideBar/constants.js +7 -19
  83. package/components/SideBar/context/sideBarContext/index.js +5 -19
  84. package/components/SideBar/context/sideBarContext/types.d.ts +1 -22
  85. package/components/SideBar/helpers/getMenuDataWithState/index.js +8 -25
  86. package/components/SideBar/slots/SideBarEnum.d.ts +5 -5
  87. package/components/SideBar/slots/SideBarEnum.js +11 -9
  88. package/components/SideBar/slots/SideBarSlots.d.ts +3 -9
  89. package/components/SideBar/slots/SideBarSlots.js +28 -36
  90. package/components/SideBar/styles.js +4 -2
  91. package/components/SideBar/subcomponents/ContentComponent/index.js +19 -39
  92. package/components/SideBar/subcomponents/ContentComponent/style.js +22 -171
  93. package/components/SideBar/subcomponents/ContentGroups/index.d.ts +5 -0
  94. package/components/SideBar/subcomponents/{TreeGroupItems → ContentGroups}/index.js +18 -16
  95. package/components/SideBar/subcomponents/{TreeGroupItems → ContentGroups}/styles.js +7 -5
  96. package/components/SideBar/subcomponents/{TreeGroupItems/subcomponents/NodeMenuItem → ContentGroups/subcomponents/ContainerMenuItemsMain}/index.d.ts +3 -3
  97. package/components/SideBar/subcomponents/ContentGroups/subcomponents/ContainerMenuItemsMain/index.js +63 -0
  98. package/components/SideBar/subcomponents/ContentGroups/subcomponents/ContainerMenuItemsMain/styles.d.ts +2 -0
  99. package/components/SideBar/subcomponents/ContentGroups/subcomponents/ContainerMenuItemsMain/styles.js +47 -0
  100. package/components/SideBar/subcomponents/{TreeGroupItems → ContentGroups/subcomponents/ContainerMenuItemsMain}/subcomponents/ArrowIcon/index.js +7 -10
  101. package/components/SideBar/subcomponents/ContentGroups/subcomponents/ContainerMenuItemsMain/types.d.ts +7 -0
  102. package/components/SideBar/subcomponents/ContentGroups/types.d.ts +4 -0
  103. package/components/SideBar/subcomponents/{Promotion → FooterSidebar}/index.d.ts +2 -2
  104. package/components/SideBar/subcomponents/{Promotion → FooterSidebar}/index.js +15 -8
  105. package/components/SideBar/subcomponents/{Promotion → FooterSidebar}/styles.js +2 -2
  106. package/components/SideBar/subcomponents/FooterSidebar/types.d.ts +5 -0
  107. package/components/SideBar/subcomponents/HeaderSidebar/index.js +25 -0
  108. package/components/SideBar/subcomponents/SideBarDesktop/index.js +1 -1
  109. package/components/SideBar/subcomponents/SideBarDesktop/styles.js +14 -10
  110. package/components/SideBar/subcomponents/SideBarMobile/index.js +1 -1
  111. package/components/SideBar/types.d.ts +3 -7
  112. package/components/WindowBase/WindowBase.js +1 -4
  113. package/components/WindowBase/WindowBase.styles.js +13 -48
  114. package/components/WindowBase/constants.d.ts +0 -1
  115. package/components/WindowBase/constants.js +1 -5
  116. package/components/WindowBase/slots/WindowBaseEnum.d.ts +1 -2
  117. package/components/WindowBase/slots/WindowBaseEnum.js +0 -1
  118. package/components/WindowBase/slots/WindowBaseSlots.d.ts +0 -3
  119. package/components/WindowBase/slots/WindowBaseSlots.js +1 -6
  120. package/components/WindowBase/subcomponents/Header/HeaderWindowBase.js +4 -8
  121. package/components/WindowBase/subcomponents/Header/useButtonActions.js +2 -4
  122. package/components/WindowBase/subcomponents/MemoizedIconButton/MemoizedIconButton.d.ts +1 -1
  123. package/components/WindowBase/subcomponents/MemoizedIconButton/MemoizedIconButton.js +1 -1
  124. package/components/WindowBase/subcomponents/MemoizedIconButton/types.d.ts +0 -5
  125. package/components/WindowBase/types.d.ts +0 -11
  126. package/components/areas/components/AreasViewer/subcomponents/Area/subcomponents/Window/Window.js +0 -13
  127. package/components/areas/components/AreasViewer/subcomponents/Area/subcomponents/Window/hooks/useRightActions.js +20 -21
  128. package/components/extended/React-Resizable/helpers.js +1 -1
  129. package/components/extended/React-resizable-panels/SplitLayout.js +3 -6
  130. package/components/extended/React-resizable-panels/SplitLayout.styles.js +36 -78
  131. package/components/extended/React-resizable-panels/constants.d.ts +0 -6
  132. package/components/extended/React-resizable-panels/constants.js +1 -5
  133. package/components/extended/React-resizable-panels/slots/SplitLayoutEnum.d.ts +1 -2
  134. package/components/extended/React-resizable-panels/slots/SplitLayoutEnum.js +0 -1
  135. package/components/extended/React-resizable-panels/slots/SplitLayoutSlots.d.ts +0 -3
  136. package/components/extended/React-resizable-panels/slots/SplitLayoutSlots.js +1 -7
  137. package/components/hook-form/RHFAutocomplete/RFHAutocompleteStyles.js +1 -1
  138. package/components/hook-form/RHFTextFieldPassword/RHFTextFieldPassword.styles.js +1 -1
  139. package/components/mui_extended/Accordion/styles.js +2 -10
  140. package/components/mui_extended/Tab/Tab.styles.js +1 -2
  141. package/components/mui_extended/TabContent/TabContent.styles.js +8 -2
  142. package/components/mui_extended/TextField/TextField.js +1 -1
  143. package/components/mui_extended/TextField/TextField.styles.js +10 -12
  144. package/components/mui_extended/index.d.ts +0 -1
  145. package/hooks/useDynamicFilterAndSort/styles.js +1 -1
  146. package/hooks/useDynamicFilterAndSort/useDynamicFilterAndSort.d.ts +7 -0
  147. package/hooks/useDynamicFilterAndSort/useDynamicFilterAndSort.js +300 -88
  148. package/index.d.ts +0 -1
  149. package/index.js +20 -23
  150. package/package.json +5 -6
  151. package/storybook/components/DataGrid/DataGrid.stories.d.ts +22 -0
  152. package/storybook/components/DataGrid/MswHandles.d.ts +1 -0
  153. package/storybook/components/DataGrid/helpers/filterFieldsSeedData.d.ts +5 -0
  154. package/storybook/components/DataGrid/helpers/getRows.d.ts +4 -0
  155. package/storybook/components/DataGrid/helpers/getRowsWithBackendSimulation.d.ts +9 -0
  156. package/storybook/components/DataGrid/helpers/sortsSeedData.d.ts +5 -0
  157. package/storybook/components/DataGrid/helpers/types.d.ts +1 -0
  158. package/storybook/components/DataGrid/helpers/useSeed.d.ts +3 -0
  159. package/storybook/components/DataGrid/subcomponents/DataGridRenderWithExternalFiltersAndSorts.d.ts +16 -0
  160. package/storybook/components/DynamicFilter/DynamicFilter.stories.d.ts +11 -27
  161. package/storybook/components/DynamicSort/DynamicSort.stories.d.ts +10 -26
  162. package/storybook/components/extended/mui/IconButton/IconButton.stories.d.ts +0 -1
  163. package/storybook/components/extended/mui/TextField/TextFieldText.stories.d.ts +0 -1
  164. package/utils/index.d.ts +0 -1
  165. package/components/SideBar/hooks/useCollapse/index.d.ts +0 -1
  166. package/components/SideBar/hooks/useCollapse/useCollapse.d.ts +0 -11
  167. package/components/SideBar/hooks/useCollapse/useCollapse.js +0 -23
  168. package/components/SideBar/subcomponents/Promotion/types.d.ts +0 -5
  169. package/components/SideBar/subcomponents/TreeGroupItems/index.d.ts +0 -5
  170. package/components/SideBar/subcomponents/TreeGroupItems/subcomponents/NodeMenuItem/index.js +0 -69
  171. package/components/SideBar/subcomponents/TreeGroupItems/subcomponents/NodeMenuItem/types.d.ts +0 -9
  172. package/components/SideBar/subcomponents/TreeGroupItems/subcomponents/NodeMenuItemMain/NodeMenuItemMain.d.ts +0 -5
  173. package/components/SideBar/subcomponents/TreeGroupItems/subcomponents/NodeMenuItemMain/NodeMenuItemMain.js +0 -56
  174. package/components/SideBar/subcomponents/TreeGroupItems/subcomponents/NodeMenuItemMain/index.d.ts +0 -1
  175. package/components/SideBar/subcomponents/TreeGroupItems/types.d.ts +0 -4
  176. package/components/mui_extended/Divider/index.d.ts +0 -1
  177. package/components/mui_extended/Divider/index.js +0 -1
  178. package/storybook/components/SideBar/subcomponents/FooterPromotion/FooterPromotion.d.ts +0 -4
  179. package/storybook/components/SideBar/subcomponents/FooterPromotion/constants.d.ts +0 -3
  180. package/storybook/components/SideBar/subcomponents/FooterPromotion/index.d.ts +0 -1
  181. /package/components/{SideBar/hooks/useCollapse → DataGrid/subcomponents/Table/subcomponents/HeaderRenderClick}/index.js +0 -0
  182. /package/components/SideBar/subcomponents/{TreeGroupItems → ContentGroups}/styles.d.ts +0 -0
  183. /package/components/SideBar/subcomponents/{TreeGroupItems → ContentGroups/subcomponents/ContainerMenuItemsMain}/subcomponents/ArrowIcon/index.d.ts +0 -0
  184. /package/components/SideBar/subcomponents/{TreeGroupItems → ContentGroups/subcomponents/ContainerMenuItemsMain}/subcomponents/ArrowIcon/types.d.ts +0 -0
  185. /package/components/SideBar/subcomponents/{Promotion → FooterSidebar}/styles.d.ts +0 -0
@@ -5,17 +5,29 @@ import { useDrag, useDrop } from "react-dnd";
5
5
  import { HeaderRenderer } from "react-data-grid";
6
6
  import { u as useFocusRef } from "../hooks/useFocusRef.js";
7
7
  import { u as useFilters } from "../../../hooks/useFilters.js";
8
- import { m as DraggableHeaderRootStyled, n as DraggableWrapperInputBaseStyled, I as IconSearchStyled, H as HeaderInputBaseStyled } from "../../../slots/DataGridSlot.js";
8
+ import { N as NameColumnIconStyled, m as DraggableHeaderRootStyled, B as ButtonHeaderActionsStyled, n as DraggableWrapperInputBaseStyled, I as IconSearchStyled, H as HeaderInputBaseStyled } from "../../../slots/DataGridSlot.js";
9
9
  import { p as pathIcons } from "../../../icons.js";
10
10
  import { u as useDataGrid } from "../../../hooks/useDataGrid.js";
11
+ import { I as Icon } from "../../../../Icon/Icon.js";
11
12
  function DraggableHeaderRenderer(props) {
12
- const { onColumnsReorder, column, isCellSelected, ...others } = props;
13
+ const {
14
+ onColumnsReorder,
15
+ column,
16
+ isCellSelected,
17
+ openPopover,
18
+ onSort,
19
+ ...others
20
+ } = props;
13
21
  const { ref, tabIndex } = useFocusRef(isCellSelected);
14
22
  const { getLabel } = useModuleDictionary();
15
23
  const { size, classes } = useDataGrid();
16
24
  const { host_static_assets, environment_assets } = useEnvironment();
17
25
  const { activeFilters, filters, onChangeFilter } = useFilters();
26
+ const { externalSortSettings } = useDataGrid();
18
27
  const [filter, setFilter] = useState(filters?.get(column.key) || "");
28
+ const currentExternalSort = externalSortSettings?.sortsApplied?.find(
29
+ (s) => s.columnKey === column.key
30
+ );
19
31
  const [{ isDragging }, drag] = useDrag({
20
32
  type: "COLUMN_DRAG",
21
33
  item: { key: column.key },
@@ -44,6 +56,7 @@ function DraggableHeaderRenderer(props) {
44
56
  }
45
57
  setFilter(e.target.value);
46
58
  };
59
+ const getSortIcon = (direction) => direction === "asc" ? `${host_static_assets}/${environment_assets}/${pathIcons.sortAsc}` : `${host_static_assets}/${environment_assets}/${pathIcons.sortDesc}`;
47
60
  useEffect(() => {
48
61
  if (!activeFilters) {
49
62
  setFilter("");
@@ -53,6 +66,13 @@ function DraggableHeaderRenderer(props) {
53
66
  if (newColumn.withinHeaderRenderer) {
54
67
  newColumn.name = newColumn.withinHeaderRenderer(props);
55
68
  }
69
+ if (currentExternalSort && !newColumn.withinHeaderRenderer) {
70
+ const sortIconPath = getSortIcon(currentExternalSort.direction);
71
+ newColumn.name = /* @__PURE__ */ jsxs(NameColumnIconStyled, { children: [
72
+ newColumn.name,
73
+ /* @__PURE__ */ jsx(Icon, { src: sortIconPath, size })
74
+ ] });
75
+ }
56
76
  return /* @__PURE__ */ jsxs(
57
77
  DraggableHeaderRootStyled,
58
78
  {
@@ -66,7 +86,26 @@ function DraggableHeaderRenderer(props) {
66
86
  backgroundColor: isOver ? "#ececec" : void 0
67
87
  },
68
88
  children: [
69
- /* @__PURE__ */ jsx(HeaderRenderer, { column: newColumn, isCellSelected, ...others }),
89
+ /* @__PURE__ */ jsx(
90
+ ButtonHeaderActionsStyled,
91
+ {
92
+ role: "button",
93
+ "aria-label": `header-column-button-${column.key}`,
94
+ onClick: (e) => {
95
+ openPopover?.(e.currentTarget, column.key);
96
+ },
97
+ children: /* @__PURE__ */ jsx(
98
+ HeaderRenderer,
99
+ {
100
+ column: newColumn,
101
+ isCellSelected,
102
+ onSort: () => {
103
+ },
104
+ ...others
105
+ }
106
+ )
107
+ }
108
+ ),
70
109
  activeFilters && (column?.withFilter === void 0 || column.withFilter === true) && /* @__PURE__ */ jsxs(DraggableWrapperInputBaseStyled, { children: [
71
110
  /* @__PURE__ */ jsx(
72
111
  IconSearchStyled,
@@ -0,0 +1,5 @@
1
+ import { HeaderRenderClickProps } from './types';
2
+ /**
3
+ * Componente que renderiza un menú de acciones para un encabezado de columna en un DataGrid.
4
+ */
5
+ export declare function HeaderRenderClick(props: HeaderRenderClickProps): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,136 @@
1
+ import { jsx } from "react/jsx-runtime";
2
+ import { useState, useMemo, useEffect, useCallback } from "react";
3
+ import { useModuleDictionary } from "@m4l/core";
4
+ import { M as MenuItem } from "../../../../../mui_extended/MenuItem/MenuItem.js";
5
+ import { M as MenuListStyled, o as HeaderRenderClickStyled } from "../../../../slots/DataGridSlot.js";
6
+ import { M as MenuDivider } from "../../../../../mui_extended/MenuDivider/MenuDivider.js";
7
+ import { P as Popover } from "../../../../../mui_extended/Popover/Popover.js";
8
+ import { D as DICTIONARY } from "../../../../dictionary.js";
9
+ import { g as DATAGRID_HEADER_RENDER_CLICK_KEY } from "../../../../constants.js";
10
+ function HeaderRenderClick(props) {
11
+ const {
12
+ menuActions,
13
+ size = "medium",
14
+ externalOpen,
15
+ onOpen,
16
+ objItem = {},
17
+ actionKey,
18
+ className,
19
+ arrowType = "right-top",
20
+ paperProps = {},
21
+ slots = {},
22
+ ...other
23
+ } = props;
24
+ const { getLabel } = useModuleDictionary();
25
+ const [anchorEl, setAnchorEl] = useState(null);
26
+ const resolvedAnchorEl = externalOpen ?? anchorEl;
27
+ const open = typeof externalOpen !== "undefined" ? Boolean(externalOpen) : Boolean(anchorEl);
28
+ const ownerState = useMemo(
29
+ () => ({
30
+ selected: open
31
+ }),
32
+ [open]
33
+ );
34
+ useEffect(() => {
35
+ if (!open) {
36
+ setAnchorEl(null);
37
+ }
38
+ }, [open]);
39
+ useEffect(() => {
40
+ if (onOpen) {
41
+ onOpen(open);
42
+ }
43
+ }, [open, onOpen]);
44
+ const handleOpenClose = useCallback(() => {
45
+ setAnchorEl(null);
46
+ if (onOpen) {
47
+ onOpen(false);
48
+ }
49
+ }, [onOpen]);
50
+ const handleClick = useCallback(
51
+ (e, menuAction) => {
52
+ e.stopPropagation();
53
+ setAnchorEl(null);
54
+ if (onOpen) {
55
+ onOpen(false);
56
+ }
57
+ menuAction.onClick && menuAction.onClick(e);
58
+ },
59
+ [onOpen]
60
+ );
61
+ const renderMenuContent = useCallback(() => {
62
+ let processedActions = [];
63
+ let finalActions = [];
64
+ if (menuActions) {
65
+ if (typeof menuActions === "function") {
66
+ processedActions = menuActions(objItem);
67
+ } else {
68
+ processedActions = menuActions;
69
+ }
70
+ }
71
+ if (Array.isArray(processedActions)) {
72
+ finalActions = processedActions;
73
+ }
74
+ if (finalActions.length === 0) {
75
+ return /* @__PURE__ */ jsx(
76
+ MenuItem,
77
+ {
78
+ disabled: true,
79
+ role: "menu-no-actions",
80
+ label: getLabel(DICTIONARY.NO_ACTIONS_LABEL)
81
+ }
82
+ );
83
+ }
84
+ return /* @__PURE__ */ jsx(MenuListStyled, { ownerState: {}, children: finalActions.map((menuAction, index) => {
85
+ const key = actionKey ?? index;
86
+ switch (menuAction.type ?? "menuItem") {
87
+ case "divider":
88
+ return /* @__PURE__ */ jsx(
89
+ MenuDivider,
90
+ {
91
+ variant: "solid",
92
+ size
93
+ },
94
+ `divider-${key}`
95
+ );
96
+ case "customNode":
97
+ return menuAction.customNode;
98
+ case "menuItem":
99
+ return /* @__PURE__ */ jsx(
100
+ MenuItem,
101
+ {
102
+ size,
103
+ ...menuAction,
104
+ label: menuAction.label ?? getLabel(DICTIONARY.NO_ACTIONS_LABEL),
105
+ onClick: menuAction.onClick ? (e) => handleClick(e, menuAction) : void 0,
106
+ "aria-label": menuAction.type === "menuItem" && menuAction.dataTestId ? menuAction.dataTestId : "header-render-click-menu-item"
107
+ },
108
+ `${DATAGRID_HEADER_RENDER_CLICK_KEY}${menuAction.label ?? key}`
109
+ );
110
+ default:
111
+ return null;
112
+ }
113
+ }) });
114
+ }, [menuActions, size, objItem, getLabel, actionKey, handleClick]);
115
+ return /* @__PURE__ */ jsx(HeaderRenderClickStyled, { className, ownerState: { ownerState }, children: open && /* @__PURE__ */ jsx(
116
+ Popover,
117
+ {
118
+ id: "Popover",
119
+ open,
120
+ anchorEl: resolvedAnchorEl,
121
+ onClose: handleOpenClose,
122
+ arrowType,
123
+ ...other,
124
+ slots: { ...slots },
125
+ slotProps: { paper: { ...paperProps } },
126
+ disableAutoFocus: true,
127
+ disableEnforceFocus: true,
128
+ anchorOrigin: { vertical: "bottom", horizontal: "left" },
129
+ transformOrigin: { vertical: "top", horizontal: "left" },
130
+ children: renderMenuContent()
131
+ }
132
+ ) });
133
+ }
134
+ export {
135
+ HeaderRenderClick as H
136
+ };
@@ -0,0 +1 @@
1
+ export * from './HeaderRenderClick';
@@ -0,0 +1,131 @@
1
+ import { ReactElement, ReactNode } from 'react';
2
+ import { Sizes, ComponentPalletColor } from '@m4l/styles';
3
+ import { PopoverProps } from '../../../../../mui_extended/Popover/types';
4
+ import { MenuItemProps } from '../../../../../mui_extended/MenuItem/types';
5
+ import { ComponentNameToClassKey, PaperProps, SxProps } from '@mui/material';
6
+ import { Theme } from '@mui/material/styles';
7
+ import { OverridesStyleRules } from '@mui/material/styles/overrides';
8
+ export type MenuTypes = 'menuItem' | 'divider' | 'loader' | 'customNode';
9
+ interface BaseMenuAction {
10
+ type?: MenuTypes;
11
+ }
12
+ export interface MenuItemAction extends BaseMenuAction, Pick<MenuItemProps, 'startIcon' | 'endIcon' | 'label' | 'selected' | 'color' | 'disabled' | 'checkable' | 'checked'> {
13
+ type?: 'menuItem';
14
+ onClick?: (arg?: any) => void;
15
+ customNode?: never;
16
+ error?: boolean;
17
+ dataTestId?: string;
18
+ }
19
+ interface DividerAction extends BaseMenuAction {
20
+ type: 'divider';
21
+ label?: never;
22
+ onClick?: never;
23
+ customNode?: never;
24
+ error?: never;
25
+ }
26
+ interface CustomNodeAction extends BaseMenuAction {
27
+ type: 'customNode';
28
+ customNode: ReactNode;
29
+ label?: never;
30
+ onClick?: never;
31
+ error?: never;
32
+ }
33
+ /**
34
+ * Define una acción del menú, con propiedades heredadas de `MenuItemProps`.
35
+ * [onClick] - Función opcional a ejecutar al hacer clic en la acción del menú.
36
+ * [error] - Indicador de error en la acción del menú.
37
+ */
38
+ export type MenuAction = MenuItemAction | DividerAction | CustomNodeAction;
39
+ export interface HeaderRenderClickProps extends Omit<PopoverProps, 'open' | 'anchorEl'> {
40
+ /**
41
+ * Tamaño opcional del menú (pequeño o mediano).
42
+ */
43
+ size?: Extract<Sizes, 'small' | 'medium'>;
44
+ /**
45
+ * Objeto personalizado a pasar al componente.
46
+ */
47
+ objItem?: any;
48
+ /**
49
+ * Acciones del menú, puede ser un array o una función que genere acciones.
50
+ */
51
+ menuActions: MenuAction[] | ((row: any) => MenuAction[]);
52
+ /**
53
+ * Texto del tooltip opcional.
54
+ */
55
+ toolTip?: string;
56
+ /**
57
+ * Elemento opcional que se renderiza al final de la lista del menú.
58
+ */
59
+ endListElement?: ReactElement;
60
+ /**
61
+ * Estilos personalizados para las acciones del menú.
62
+ */
63
+ menuActionSx?: SxProps<Theme> | Partial<OverridesStyleRules<string, ComponentNameToClassKey, Theme>>;
64
+ /**
65
+ * Contenido del `Badge` si está presente.
66
+ */
67
+ badgeContent?: string;
68
+ /**
69
+ * Elemento externo para abrir el menú.
70
+ */
71
+ externalOpen?: HTMLDivElement | null;
72
+ /**
73
+ * Función externa para cerrar el menú.
74
+ */
75
+ externalClose?: (element: null | HTMLDivElement) => void;
76
+ /**
77
+ * Tipo de flecha del menú.
78
+ */
79
+ disabled?: boolean;
80
+ /**
81
+ * The components used for each slot inside.
82
+ * @default {}
83
+ */
84
+ slots?: {
85
+ root?: React.ElementType;
86
+ paper?: React.ElementType;
87
+ };
88
+ /**
89
+ * Propiedad objeto que se usa para poder editar las propiedades del paper o agregar estilos desde su sx
90
+ */
91
+ paperProps?: PaperProps;
92
+ /**
93
+ * Propiedad checked
94
+ */
95
+ checked?: boolean;
96
+ /**
97
+ * Propiedad checkable para el menú
98
+ */
99
+ checkable?: boolean;
100
+ /**
101
+ * Propiedad para agregar un node al menú
102
+ */
103
+ customNode?: ReactNode;
104
+ /**
105
+ * Define el color del componente.
106
+ */
107
+ color?: Extract<ComponentPalletColor, 'primary'>;
108
+ /**
109
+ * Define la clave de la acción.
110
+ */
111
+ actionKey?: string;
112
+ /**
113
+ * agrega un header al menú
114
+ */
115
+ header?: ReactNode;
116
+ /**
117
+ * agrega un footer al menú
118
+ */
119
+ footer?: ReactNode;
120
+ /**
121
+ * Define el tipo de flecha del menú.
122
+ */
123
+ onOpen?: (param: boolean) => void;
124
+ }
125
+ /**
126
+ * Estado del propietario para `HeaderRenderClick`.
127
+ */
128
+ export interface HeaderRenderClickOwnerState {
129
+ selected: boolean;
130
+ }
131
+ export {};
@@ -1,7 +1,7 @@
1
1
  import { jsx } from "react/jsx-runtime";
2
2
  import { useRowSelection, SelectCellFormatter } from "react-data-grid";
3
3
  import { u as useDataGrid } from "../../../hooks/useDataGrid.js";
4
- import { c as DATAGRID_SELECT_COLUMN_KEY } from "../../../constants.js";
4
+ import { d as DATAGRID_SELECT_COLUMN_KEY } from "../../../constants.js";
5
5
  const filterColumnClassName = "filter-cell";
6
6
  const filterHeight = 35;
7
7
  function SelectGroupFormatter(props) {
@@ -1,5 +1,5 @@
1
1
  import { jsx } from "react/jsx-runtime";
2
- import { o as InputTextEditorStyled } from "../../../slots/DataGridSlot.js";
2
+ import { p as InputTextEditorStyled } from "../../../slots/DataGridSlot.js";
3
3
  function autoFocusAndSelect(input) {
4
4
  input?.focus();
5
5
  input?.select();
@@ -13,6 +13,7 @@ export type GridFormatterPropss<T, SR> = FormatterProps<T, SR>;
13
13
  export type { ColumnUncertaintyFormatter, ColumnPointsFormatter, ColumnNestedValueFormatter, } from './formatters';
14
14
  export declare type ColumnType = 'string' | 'date' | 'number' | 'boolean' | 'custom';
15
15
  export declare type ColumnAlign = 'left' | 'center' | 'right';
16
+ export declare type FieldPresence = 'initialized' | 'fixed' | 'optional';
16
17
  export declare interface GridRow {
17
18
  id: number;
18
19
  }
@@ -61,10 +62,62 @@ export interface ChangeUserColumn<T extends KeyUserColumns = KeyUserColumns> {
61
62
  userConfig: IGridConfig[T];
62
63
  }
63
64
  export type OnChangeUserColumns = (props: ChangeUserColumn) => void;
65
+ export type SortApplied = {
66
+ columnKey: string;
67
+ removable: boolean;
68
+ direction: Lowercase<SortDirection>;
69
+ };
70
+ export type SortAction = 'add' | 'remove';
71
+ export type SortChangeAdd = {
72
+ action: 'add';
73
+ columnKey: string;
74
+ direction: Lowercase<SortDirection>;
75
+ };
76
+ export type SortChangeRemove = {
77
+ action: 'remove';
78
+ columnKey: string;
79
+ };
80
+ export type SortChangeEvent = SortChangeAdd | SortChangeRemove;
81
+ export interface SortSettings {
82
+ sortsColumns: string[];
83
+ sortsApplied: SortApplied[];
84
+ onChange: (event: SortChangeEvent) => void;
85
+ }
86
+ /**---------------------------------------------------------------- */
87
+ export type FilterChangeAdd = {
88
+ action: 'add';
89
+ columnKey: string;
90
+ };
91
+ export type FilterChangeOpenPopover = {
92
+ action: 'openPopoverMenuFields';
93
+ };
94
+ export type FilterChangeEvent = FilterChangeAdd | FilterChangeOpenPopover;
95
+ interface FilterColumn {
96
+ name: string;
97
+ multiple: boolean;
98
+ }
99
+ export type FilterApplied = {
100
+ columnKey: string;
101
+ isValid: boolean;
102
+ };
103
+ export interface FilterSettings {
104
+ filterColumns: FilterColumn[];
105
+ filtersApplied: FilterApplied[];
106
+ onChange: (event: FilterChangeEvent) => void;
107
+ }
108
+ /**--------------------Termina tipado de filtros-------------------------------------------- */
64
109
  export interface GridProps<TRow, TSummaryRow, TKey extends RowKey = RowKey> {
65
110
  id: string;
66
111
  withActions?: boolean;
67
112
  columns: readonly Column<TRow, TSummaryRow>[];
113
+ /**
114
+ * Propiedad que define la configuración de los sorts aplicados.
115
+ */
116
+ externalSortSettings?: SortSettings;
117
+ /**
118
+ * Propiedad que define la configuración de los filtros aplicados.
119
+ */
120
+ externalFilterSettings?: FilterSettings;
68
121
  rows: TRow[];
69
122
  initialRowHeightVariant?: RowHeightVariants;
70
123
  rowHeaderHeights?: RowHeights;