@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.
- package/@types/types.d.ts +0 -8
- package/components/DataGrid/DataGrid.js +17 -3
- package/components/DataGrid/Datagrid.styles.js +67 -24
- package/components/DataGrid/constants.d.ts +2 -0
- package/components/DataGrid/constants.js +7 -3
- package/components/DataGrid/contexts/DataGridContext/index.js +77 -30
- package/components/DataGrid/contexts/DataGridContext/types.d.ts +5 -2
- package/components/DataGrid/dictionary.d.ts +8 -0
- package/components/DataGrid/dictionary.js +26 -17
- package/components/DataGrid/icons.d.ts +6 -0
- package/components/DataGrid/icons.js +7 -1
- package/components/DataGrid/slots/DataGridEnum.d.ts +5 -1
- package/components/DataGrid/slots/DataGridEnum.js +4 -0
- package/components/DataGrid/slots/DataGridSlot.d.ts +4 -0
- package/components/DataGrid/slots/DataGridSlot.js +22 -2
- package/components/DataGrid/subcomponents/HeaderActions/subcomponents/Filter/index.js +9 -1
- package/components/DataGrid/subcomponents/Table/hooks/getDragHeaderRenderer.d.ts +3 -1
- package/components/DataGrid/subcomponents/Table/hooks/getDragHeaderRenderer.js +9 -2
- package/components/DataGrid/subcomponents/Table/hooks/useHeaderMenuActions.d.ts +6 -0
- package/components/DataGrid/subcomponents/Table/hooks/useHeaderMenuActions.js +259 -0
- package/components/DataGrid/subcomponents/Table/hooks/useSortColumnsRows.d.ts +6 -4
- package/components/DataGrid/subcomponents/Table/hooks/useSortColumnsRows.js +35 -18
- package/components/DataGrid/subcomponents/Table/index.js +97 -34
- package/components/DataGrid/subcomponents/Table/subcomponents/ActionsColumn.js +1 -1
- package/components/DataGrid/subcomponents/Table/subcomponents/DraggableHeaderRenderer.d.ts +1 -0
- package/components/DataGrid/subcomponents/Table/subcomponents/DraggableHeaderRenderer.js +42 -3
- package/components/DataGrid/subcomponents/Table/subcomponents/HeaderRenderClick/HeaderRenderClick.d.ts +5 -0
- package/components/DataGrid/subcomponents/Table/subcomponents/HeaderRenderClick/HeaderRenderClick.js +136 -0
- package/components/DataGrid/subcomponents/Table/subcomponents/HeaderRenderClick/index.d.ts +1 -0
- package/components/DataGrid/subcomponents/Table/subcomponents/HeaderRenderClick/types.d.ts +131 -0
- package/components/DataGrid/subcomponents/Table/subcomponents/SelectColumn.js +1 -1
- package/components/DataGrid/subcomponents/editors/TextEditor/index.js +1 -1
- package/components/DataGrid/tests/HeaderRenderClick.test.d.ts +1 -0
- package/components/DataGrid/tests/useHeaderMenuActions.test.d.ts +1 -0
- package/components/DataGrid/types.d.ts +53 -0
- package/components/DynamicFilter/DynamicFilter.styles.js +90 -99
- package/components/DynamicFilter/slots/SlotsEnum.d.ts +3 -0
- package/components/DynamicFilter/slots/SlotsEnum.js +3 -0
- package/components/DynamicFilter/slots/dynamicFilterSlots.d.ts +9 -0
- package/components/DynamicFilter/slots/dynamicFilterSlots.js +19 -3
- package/components/DynamicFilter/store/DynamicFilterContext.js +67 -26
- package/components/DynamicFilter/subcomponents/FieldTypes/BooleanFilter/index.js +2 -2
- package/components/DynamicFilter/subcomponents/FieldTypes/DateTimeFilter/index.js +2 -2
- package/components/DynamicFilter/subcomponents/FieldTypes/NumberFilter/index.js +2 -2
- package/components/DynamicFilter/subcomponents/FieldTypes/SelectAsyncFilter/index.js +2 -2
- package/components/DynamicFilter/subcomponents/FieldTypes/SelectFilter/index.js +2 -2
- package/components/DynamicFilter/subcomponents/FieldTypes/StringFilter/index.js +2 -2
- package/components/DynamicFilter/subcomponents/FilterActions/FilterActions.js +1 -1
- package/components/DynamicFilter/subcomponents/FilterActions/useFilterActions.d.ts +0 -1
- package/components/DynamicFilter/subcomponents/FilterActions/useFilterActions.js +1 -2
- package/components/DynamicFilter/subcomponents/InputFilter/InputFilter.js +0 -2
- package/components/DynamicFilter/subcomponents/PopoverFilter/PopoverFilter.js +18 -23
- package/components/DynamicFilter/subcomponents/PopoverMenuFields/PopoverMenuFields.js +1 -4
- package/components/DynamicFilter/types.d.ts +3 -0
- package/components/DynamicSort/DynamicSort.js +10 -6
- package/components/DynamicSort/DynamicSort.styles.js +88 -90
- package/components/DynamicSort/slots/DynamicSortSlots.d.ts +9 -0
- package/components/DynamicSort/slots/DynamicSortSlots.js +21 -5
- package/components/DynamicSort/slots/SlotsEnum.d.ts +4 -1
- package/components/DynamicSort/slots/SlotsEnum.js +4 -1
- package/components/DynamicSort/store/DynamicSortContext.js +96 -67
- package/components/DynamicSort/store/DynamicSortStore.js +53 -4
- package/components/DynamicSort/store/types.d.ts +11 -0
- package/components/DynamicSort/subcomponents/FieldTypes/StringSort/index.js +2 -2
- package/components/DynamicSort/subcomponents/InputSort/InputSort.js +0 -2
- package/components/DynamicSort/subcomponents/PopoverSort/PopoverSort.js +17 -21
- package/components/DynamicSort/subcomponents/SortActions/SortActions.js +2 -2
- package/components/DynamicSort/subcomponents/SortActions/useSortActions.d.ts +0 -2
- package/components/DynamicSort/subcomponents/SortActions/useSortActions.js +1 -2
- package/components/DynamicSort/types.d.ts +4 -0
- package/components/LanguagePopover/LanguagePopover.js +6 -8
- package/components/LanguagePopover/LanguagePopover.styles.js +4 -25
- package/components/LanguagePopover/slots/LanguagePopoverSlots.d.ts +3 -9
- package/components/LanguagePopover/slots/LanguagePopoverSlots.js +3 -1
- package/components/LanguagePopover/types.d.ts +1 -6
- package/components/PaperForm/styles.js +1 -2
- package/components/PropertyValue/PropertyValue.js +1 -2
- package/components/PropertyValue/PropertyValue.styles.js +4 -7
- package/components/PropertyValue/types.d.ts +0 -4
- package/components/SideBar/SideBar.js +2 -4
- package/components/SideBar/constants.d.ts +2 -26
- package/components/SideBar/constants.js +7 -19
- package/components/SideBar/context/sideBarContext/index.js +5 -19
- package/components/SideBar/context/sideBarContext/types.d.ts +1 -22
- package/components/SideBar/helpers/getMenuDataWithState/index.js +8 -25
- package/components/SideBar/slots/SideBarEnum.d.ts +5 -5
- package/components/SideBar/slots/SideBarEnum.js +11 -9
- package/components/SideBar/slots/SideBarSlots.d.ts +3 -9
- package/components/SideBar/slots/SideBarSlots.js +28 -36
- package/components/SideBar/styles.js +4 -2
- package/components/SideBar/subcomponents/ContentComponent/index.js +19 -39
- package/components/SideBar/subcomponents/ContentComponent/style.js +22 -171
- package/components/SideBar/subcomponents/ContentGroups/index.d.ts +5 -0
- package/components/SideBar/subcomponents/{TreeGroupItems → ContentGroups}/index.js +18 -16
- package/components/SideBar/subcomponents/{TreeGroupItems → ContentGroups}/styles.js +7 -5
- package/components/SideBar/subcomponents/{TreeGroupItems/subcomponents/NodeMenuItem → ContentGroups/subcomponents/ContainerMenuItemsMain}/index.d.ts +3 -3
- package/components/SideBar/subcomponents/ContentGroups/subcomponents/ContainerMenuItemsMain/index.js +63 -0
- package/components/SideBar/subcomponents/ContentGroups/subcomponents/ContainerMenuItemsMain/styles.d.ts +2 -0
- package/components/SideBar/subcomponents/ContentGroups/subcomponents/ContainerMenuItemsMain/styles.js +47 -0
- package/components/SideBar/subcomponents/{TreeGroupItems → ContentGroups/subcomponents/ContainerMenuItemsMain}/subcomponents/ArrowIcon/index.js +7 -10
- package/components/SideBar/subcomponents/ContentGroups/subcomponents/ContainerMenuItemsMain/types.d.ts +7 -0
- package/components/SideBar/subcomponents/ContentGroups/types.d.ts +4 -0
- package/components/SideBar/subcomponents/{Promotion → FooterSidebar}/index.d.ts +2 -2
- package/components/SideBar/subcomponents/{Promotion → FooterSidebar}/index.js +15 -8
- package/components/SideBar/subcomponents/{Promotion → FooterSidebar}/styles.js +2 -2
- package/components/SideBar/subcomponents/FooterSidebar/types.d.ts +5 -0
- package/components/SideBar/subcomponents/HeaderSidebar/index.js +25 -0
- package/components/SideBar/subcomponents/SideBarDesktop/index.js +1 -1
- package/components/SideBar/subcomponents/SideBarDesktop/styles.js +14 -10
- package/components/SideBar/subcomponents/SideBarMobile/index.js +1 -1
- package/components/SideBar/types.d.ts +3 -7
- package/components/WindowBase/WindowBase.js +1 -4
- package/components/WindowBase/WindowBase.styles.js +13 -48
- package/components/WindowBase/constants.d.ts +0 -1
- package/components/WindowBase/constants.js +1 -5
- package/components/WindowBase/slots/WindowBaseEnum.d.ts +1 -2
- package/components/WindowBase/slots/WindowBaseEnum.js +0 -1
- package/components/WindowBase/slots/WindowBaseSlots.d.ts +0 -3
- package/components/WindowBase/slots/WindowBaseSlots.js +1 -6
- package/components/WindowBase/subcomponents/Header/HeaderWindowBase.js +4 -8
- package/components/WindowBase/subcomponents/Header/useButtonActions.js +2 -4
- package/components/WindowBase/subcomponents/MemoizedIconButton/MemoizedIconButton.d.ts +1 -1
- package/components/WindowBase/subcomponents/MemoizedIconButton/MemoizedIconButton.js +1 -1
- package/components/WindowBase/subcomponents/MemoizedIconButton/types.d.ts +0 -5
- package/components/WindowBase/types.d.ts +0 -11
- package/components/areas/components/AreasViewer/subcomponents/Area/subcomponents/Window/Window.js +0 -13
- package/components/areas/components/AreasViewer/subcomponents/Area/subcomponents/Window/hooks/useRightActions.js +20 -21
- package/components/extended/React-Resizable/helpers.js +1 -1
- package/components/extended/React-resizable-panels/SplitLayout.js +3 -6
- package/components/extended/React-resizable-panels/SplitLayout.styles.js +36 -78
- package/components/extended/React-resizable-panels/constants.d.ts +0 -6
- package/components/extended/React-resizable-panels/constants.js +1 -5
- package/components/extended/React-resizable-panels/slots/SplitLayoutEnum.d.ts +1 -2
- package/components/extended/React-resizable-panels/slots/SplitLayoutEnum.js +0 -1
- package/components/extended/React-resizable-panels/slots/SplitLayoutSlots.d.ts +0 -3
- package/components/extended/React-resizable-panels/slots/SplitLayoutSlots.js +1 -7
- package/components/hook-form/RHFAutocomplete/RFHAutocompleteStyles.js +1 -1
- package/components/hook-form/RHFTextFieldPassword/RHFTextFieldPassword.styles.js +1 -1
- package/components/mui_extended/Accordion/styles.js +2 -10
- package/components/mui_extended/Tab/Tab.styles.js +1 -2
- package/components/mui_extended/TabContent/TabContent.styles.js +8 -2
- package/components/mui_extended/TextField/TextField.js +1 -1
- package/components/mui_extended/TextField/TextField.styles.js +10 -12
- package/components/mui_extended/index.d.ts +0 -1
- package/hooks/useDynamicFilterAndSort/styles.js +1 -1
- package/hooks/useDynamicFilterAndSort/useDynamicFilterAndSort.d.ts +7 -0
- package/hooks/useDynamicFilterAndSort/useDynamicFilterAndSort.js +300 -88
- package/index.d.ts +0 -1
- package/index.js +20 -23
- package/package.json +5 -6
- package/storybook/components/DataGrid/DataGrid.stories.d.ts +22 -0
- package/storybook/components/DataGrid/MswHandles.d.ts +1 -0
- package/storybook/components/DataGrid/helpers/filterFieldsSeedData.d.ts +5 -0
- package/storybook/components/DataGrid/helpers/getRows.d.ts +4 -0
- package/storybook/components/DataGrid/helpers/getRowsWithBackendSimulation.d.ts +9 -0
- package/storybook/components/DataGrid/helpers/sortsSeedData.d.ts +5 -0
- package/storybook/components/DataGrid/helpers/types.d.ts +1 -0
- package/storybook/components/DataGrid/helpers/useSeed.d.ts +3 -0
- package/storybook/components/DataGrid/subcomponents/DataGridRenderWithExternalFiltersAndSorts.d.ts +16 -0
- package/storybook/components/DynamicFilter/DynamicFilter.stories.d.ts +11 -27
- package/storybook/components/DynamicSort/DynamicSort.stories.d.ts +10 -26
- package/storybook/components/extended/mui/IconButton/IconButton.stories.d.ts +0 -1
- package/storybook/components/extended/mui/TextField/TextFieldText.stories.d.ts +0 -1
- package/utils/index.d.ts +0 -1
- package/components/SideBar/hooks/useCollapse/index.d.ts +0 -1
- package/components/SideBar/hooks/useCollapse/useCollapse.d.ts +0 -11
- package/components/SideBar/hooks/useCollapse/useCollapse.js +0 -23
- package/components/SideBar/subcomponents/Promotion/types.d.ts +0 -5
- package/components/SideBar/subcomponents/TreeGroupItems/index.d.ts +0 -5
- package/components/SideBar/subcomponents/TreeGroupItems/subcomponents/NodeMenuItem/index.js +0 -69
- package/components/SideBar/subcomponents/TreeGroupItems/subcomponents/NodeMenuItem/types.d.ts +0 -9
- package/components/SideBar/subcomponents/TreeGroupItems/subcomponents/NodeMenuItemMain/NodeMenuItemMain.d.ts +0 -5
- package/components/SideBar/subcomponents/TreeGroupItems/subcomponents/NodeMenuItemMain/NodeMenuItemMain.js +0 -56
- package/components/SideBar/subcomponents/TreeGroupItems/subcomponents/NodeMenuItemMain/index.d.ts +0 -1
- package/components/SideBar/subcomponents/TreeGroupItems/types.d.ts +0 -4
- package/components/mui_extended/Divider/index.d.ts +0 -1
- package/components/mui_extended/Divider/index.js +0 -1
- package/storybook/components/SideBar/subcomponents/FooterPromotion/FooterPromotion.d.ts +0 -4
- package/storybook/components/SideBar/subcomponents/FooterPromotion/constants.d.ts +0 -3
- package/storybook/components/SideBar/subcomponents/FooterPromotion/index.d.ts +0 -1
- /package/components/{SideBar/hooks/useCollapse → DataGrid/subcomponents/Table/subcomponents/HeaderRenderClick}/index.js +0 -0
- /package/components/SideBar/subcomponents/{TreeGroupItems → ContentGroups}/styles.d.ts +0 -0
- /package/components/SideBar/subcomponents/{TreeGroupItems → ContentGroups/subcomponents/ContainerMenuItemsMain}/subcomponents/ArrowIcon/index.d.ts +0 -0
- /package/components/SideBar/subcomponents/{TreeGroupItems → ContentGroups/subcomponents/ContainerMenuItemsMain}/subcomponents/ArrowIcon/types.d.ts +0 -0
- /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 {
|
|
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(
|
|
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;
|
package/components/DataGrid/subcomponents/Table/subcomponents/HeaderRenderClick/HeaderRenderClick.js
ADDED
|
@@ -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 {
|
|
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 {
|
|
2
|
+
import { p as InputTextEditorStyled } from "../../../slots/DataGridSlot.js";
|
|
3
3
|
function autoFocusAndSelect(input) {
|
|
4
4
|
input?.focus();
|
|
5
5
|
input?.select();
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -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;
|