@m4l/components 9.2.60-24062025.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/Chip/Chip.js +10 -9
- package/components/Chip/ChipStyles.js +2 -13
- package/components/Chip/constants.d.ts +0 -9
- package/components/Chip/constants.js +2 -6
- package/components/Chip/slots/ChipEnum.d.ts +0 -3
- package/components/Chip/slots/ChipEnum.js +1 -6
- package/components/Chip/slots/ChipSlots.js +1 -1
- package/components/DataGrid/DataGrid.js +17 -3
- package/components/DataGrid/Datagrid.styles.js +67 -27
- 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/RHFTextField/RHFTextField.js +0 -1
- package/components/hook-form/RHFTextFieldPassword/RHFTextFieldPassword.styles.js +1 -1
- package/components/mui_extended/Accordion/styles.js +2 -10
- package/components/mui_extended/Button/Button.js +1 -3
- package/components/mui_extended/Button/ButtonStyles.js +1 -6
- package/components/mui_extended/Button/types.d.ts +1 -1
- package/components/mui_extended/NavLink/NavLink.js +1 -3
- package/components/mui_extended/NavLink/NavLink.styles.js +1 -2
- package/components/mui_extended/NavLink/types.d.ts +1 -3
- 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 +13 -15
- 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
package/@types/types.d.ts
CHANGED
|
@@ -148,7 +148,6 @@ import { ScrollBarOwnerState, ScrollBarSlotsType } from '../components/ScrollBar
|
|
|
148
148
|
|
|
149
149
|
import { SplitLayoutOwnerState } from '../components/extended/React-resizable-panels/types';
|
|
150
150
|
import { ObjectLogsOwnerState, ObjectLogsSlotsType } from '../components/ObjectLogs/types';
|
|
151
|
-
import { LanguagePopoverOwnerState, LanguagePopoverSlotsType } from '../components/LanguagePopover/types';
|
|
152
151
|
declare module '@mui/material/styles' {
|
|
153
152
|
// Define the slots in the theme
|
|
154
153
|
interface ComponentNameToClassKey {
|
|
@@ -227,7 +226,6 @@ declare module '@mui/material/styles' {
|
|
|
227
226
|
M4LScrollbar: ScrollBarSlotsType;
|
|
228
227
|
M4LSplitLayout: SplitLayoutOwnerState;
|
|
229
228
|
M4LObjectLogs: ObjectLogsSlotsType;
|
|
230
|
-
M4LLanguagePopover: LanguagePopoverSlotsType;
|
|
231
229
|
}
|
|
232
230
|
interface ComponentsPropsList {
|
|
233
231
|
// Extend ComponentsProps or ComponentsOwnerState(this extend ComponentProps)
|
|
@@ -306,7 +304,6 @@ declare module '@mui/material/styles' {
|
|
|
306
304
|
M4LScrollBar: Partial<ScrollBarOwnerState>;
|
|
307
305
|
M4LSplitLayout: Partial<SplitLayoutOwnerState>;
|
|
308
306
|
M4LObjectLogs: Partial<ObjectLogsOwnerState>;
|
|
309
|
-
M4LLanguagePopover: Partial<LanguagePopoverOwnerState>;
|
|
310
307
|
}
|
|
311
308
|
interface Components {
|
|
312
309
|
M4LDynamicFilter?: {
|
|
@@ -694,10 +691,5 @@ declare module '@mui/material/styles' {
|
|
|
694
691
|
styleOverrides?: ComponentsOverrides<Theme>['M4LObjectLogs'];
|
|
695
692
|
variants?: ComponentsVariants['M4LObjectLogs'];
|
|
696
693
|
};
|
|
697
|
-
M4LLanguagePopover?: {
|
|
698
|
-
defaultProps?: ComponentsPropsList['M4LLanguagePopover'];
|
|
699
|
-
styleOverrides?: ComponentsOverrides<Theme>['M4LLanguagePopover'];
|
|
700
|
-
variants?: ComponentsVariants['M4LLanguagePopover'];
|
|
701
|
-
};
|
|
702
694
|
}
|
|
703
695
|
}
|
package/components/Chip/Chip.js
CHANGED
|
@@ -28,14 +28,16 @@ const Chip = forwardRef((props, ref) => {
|
|
|
28
28
|
const { currentSize } = useComponentSize(size);
|
|
29
29
|
const isSkeleton = useModuleSkeleton();
|
|
30
30
|
const { host_static_assets, environment_assets } = useEnvironment();
|
|
31
|
+
const adjustedSize = currentSize === "small" || currentSize === "medium" ? currentSize : "medium";
|
|
31
32
|
const ownerState = useMemo(() => ({
|
|
32
33
|
interactive: !!onClick,
|
|
33
|
-
size:
|
|
34
|
+
size: adjustedSize,
|
|
35
|
+
chipSize: adjustedSize,
|
|
34
36
|
variant,
|
|
35
37
|
color,
|
|
36
38
|
opacity,
|
|
37
39
|
externalColor
|
|
38
|
-
}), [
|
|
40
|
+
}), [adjustedSize, variant, color, opacity, externalColor, onClick]);
|
|
39
41
|
const renderIcon = useMemo(() => (icon, instaceDataTestId) => {
|
|
40
42
|
if (!icon) {
|
|
41
43
|
return null;
|
|
@@ -48,12 +50,12 @@ const Chip = forwardRef((props, ref) => {
|
|
|
48
50
|
{
|
|
49
51
|
ownerState: { ...ownerState },
|
|
50
52
|
src: icon,
|
|
51
|
-
size:
|
|
53
|
+
size: adjustedSize,
|
|
52
54
|
instaceDataTestId
|
|
53
55
|
}
|
|
54
56
|
);
|
|
55
57
|
}
|
|
56
|
-
}, [ownerState,
|
|
58
|
+
}, [ownerState, adjustedSize]);
|
|
57
59
|
if (isSkeleton) {
|
|
58
60
|
return /* @__PURE__ */ jsx(
|
|
59
61
|
SkeletonChipStyled,
|
|
@@ -73,7 +75,7 @@ const Chip = forwardRef((props, ref) => {
|
|
|
73
75
|
ChipRootStyled,
|
|
74
76
|
{
|
|
75
77
|
role: "button-chip",
|
|
76
|
-
size:
|
|
78
|
+
size: adjustedSize,
|
|
77
79
|
onClick,
|
|
78
80
|
ownerState: { ...ownerState },
|
|
79
81
|
className: clsx(className, CHIP_CLASSES.root),
|
|
@@ -83,18 +85,17 @@ const Chip = forwardRef((props, ref) => {
|
|
|
83
85
|
...others,
|
|
84
86
|
children: [
|
|
85
87
|
renderIcon(startIcon, "ChipStartIcon"),
|
|
86
|
-
/* @__PURE__ */ jsx(TextChipStyled, { size:
|
|
88
|
+
/* @__PURE__ */ jsx(TextChipStyled, { size: adjustedSize, ownerState: { ...ownerState }, color, children: label }),
|
|
87
89
|
renderIcon(endIcon, "ChipEndIcon"),
|
|
88
90
|
onDeleted && /* @__PURE__ */ jsx(
|
|
89
91
|
IconButtonStyled,
|
|
90
92
|
{
|
|
91
93
|
...iconButtonProps,
|
|
92
94
|
src: iconClose,
|
|
93
|
-
size:
|
|
95
|
+
size: adjustedSize,
|
|
94
96
|
ownerState: { ...ownerState },
|
|
95
97
|
onClick: handleDelete,
|
|
96
|
-
disabled: disabledDeleteButton
|
|
97
|
-
className: CHIP_CLASSES.closeIcon
|
|
98
|
+
disabled: disabledDeleteButton
|
|
98
99
|
}
|
|
99
100
|
)
|
|
100
101
|
]
|
|
@@ -43,8 +43,8 @@ const chipStyles = {
|
|
|
43
43
|
display: "flex",
|
|
44
44
|
alignItems: "center",
|
|
45
45
|
padding: theme.vars.size.baseSpacings.sp1,
|
|
46
|
+
paddingRight: 0,
|
|
46
47
|
borderRadius: theme.vars.size.borderRadius["r0-5"],
|
|
47
|
-
gap: theme.vars.size.baseSpacings["sp0-5"],
|
|
48
48
|
width: "max-content",
|
|
49
49
|
cursor: "pointer",
|
|
50
50
|
color,
|
|
@@ -72,17 +72,6 @@ const chipStyles = {
|
|
|
72
72
|
border: `${theme.vars.size.borderStroke.container}`,
|
|
73
73
|
borderColor: bgColor
|
|
74
74
|
},
|
|
75
|
-
"&&& .M4LChip-closeIcon": {
|
|
76
|
-
...getSizeStyles(
|
|
77
|
-
theme,
|
|
78
|
-
ownerState?.size || "medium",
|
|
79
|
-
"base",
|
|
80
|
-
(size) => ({
|
|
81
|
-
height: size,
|
|
82
|
-
width: size
|
|
83
|
-
})
|
|
84
|
-
)
|
|
85
|
-
},
|
|
86
75
|
variants: []
|
|
87
76
|
};
|
|
88
77
|
},
|
|
@@ -92,7 +81,7 @@ const chipStyles = {
|
|
|
92
81
|
textChip: ({ theme }) => ({
|
|
93
82
|
whiteSpace: "nowrap",
|
|
94
83
|
paddingLeft: theme.vars.size.baseSpacings.sp1,
|
|
95
|
-
paddingRight: theme.vars.size.baseSpacings.
|
|
84
|
+
paddingRight: theme.vars.size.baseSpacings.sp2
|
|
96
85
|
}),
|
|
97
86
|
/**
|
|
98
87
|
* Styles for the chip icon element.
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { ChipSlots, ChipComplementaryClasses } from './slots/ChipEnum';
|
|
2
1
|
/**
|
|
3
2
|
* Clave de identificación del componente Chip dentro del sistema.
|
|
4
3
|
*
|
|
@@ -7,14 +6,6 @@ import { ChipSlots, ChipComplementaryClasses } from './slots/ChipEnum';
|
|
|
7
6
|
* @default 'M4LChip'
|
|
8
7
|
*/
|
|
9
8
|
export declare const CHIP_KEY_COMPONENT = "M4LChip";
|
|
10
|
-
export declare const COMBINED_CHIP_ENUMS: {
|
|
11
|
-
closeIcon: ChipComplementaryClasses.closeIcon;
|
|
12
|
-
root: ChipSlots.root;
|
|
13
|
-
skeletonChip: ChipSlots.skeletonChip;
|
|
14
|
-
chipIcon: ChipSlots.chipIcon;
|
|
15
|
-
textChip: ChipSlots.textChip;
|
|
16
|
-
iconButton: ChipSlots.iconButton;
|
|
17
|
-
};
|
|
18
9
|
/**
|
|
19
10
|
* Inventario de clases CSS para el componente Chip
|
|
20
11
|
*/
|
|
@@ -1,11 +1,7 @@
|
|
|
1
1
|
import { g as getComponentClasses } from "../../utils/getComponentSlotRoot.js";
|
|
2
|
-
import { C as
|
|
2
|
+
import { C as ChipSlots } from "./slots/ChipEnum.js";
|
|
3
3
|
const CHIP_KEY_COMPONENT = "M4LChip";
|
|
4
|
-
const
|
|
5
|
-
...ChipSlots,
|
|
6
|
-
...ChipComplementaryClasses
|
|
7
|
-
};
|
|
8
|
-
const CHIP_CLASSES = getComponentClasses(CHIP_KEY_COMPONENT, COMBINED_CHIP_ENUMS);
|
|
4
|
+
const CHIP_CLASSES = getComponentClasses(CHIP_KEY_COMPONENT, ChipSlots);
|
|
9
5
|
export {
|
|
10
6
|
CHIP_CLASSES as C,
|
|
11
7
|
CHIP_KEY_COMPONENT as a
|
|
@@ -6,11 +6,6 @@ var ChipSlots = /* @__PURE__ */ ((ChipSlots2) => {
|
|
|
6
6
|
ChipSlots2["iconButton"] = "iconButton";
|
|
7
7
|
return ChipSlots2;
|
|
8
8
|
})(ChipSlots || {});
|
|
9
|
-
var ChipComplementaryClasses = /* @__PURE__ */ ((ChipComplementaryClasses2) => {
|
|
10
|
-
ChipComplementaryClasses2["closeIcon"] = "closeIcon";
|
|
11
|
-
return ChipComplementaryClasses2;
|
|
12
|
-
})(ChipComplementaryClasses || {});
|
|
13
9
|
export {
|
|
14
|
-
|
|
15
|
-
ChipSlots as a
|
|
10
|
+
ChipSlots as C
|
|
16
11
|
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { styled } from "@mui/material/styles";
|
|
2
2
|
import { c as chipStyles } from "../ChipStyles.js";
|
|
3
3
|
import { a as CHIP_KEY_COMPONENT } from "../constants.js";
|
|
4
|
-
import {
|
|
4
|
+
import { C as ChipSlots } from "./ChipEnum.js";
|
|
5
5
|
import { S as Skeleton } from "../../mui_extended/Skeleton/Skeleton.js";
|
|
6
6
|
import { T as Typography } from "../../mui_extended/Typography/Typography.js";
|
|
7
7
|
import { I as IconButton } from "../../mui_extended/IconButton/IconButton.js";
|
|
@@ -35,7 +35,9 @@ function DataGrid(props) {
|
|
|
35
35
|
visibleCustomHeader = true,
|
|
36
36
|
defaultUserColumns,
|
|
37
37
|
onChangeUserColumns,
|
|
38
|
-
size
|
|
38
|
+
size,
|
|
39
|
+
externalSortSettings,
|
|
40
|
+
externalFilterSettings
|
|
39
41
|
} = props;
|
|
40
42
|
const {
|
|
41
43
|
withSettings,
|
|
@@ -63,7 +65,11 @@ function DataGrid(props) {
|
|
|
63
65
|
className: classRoot,
|
|
64
66
|
...process.env.NODE_ENV !== "production" ? {
|
|
65
67
|
[TEST_PROP_COLUMNS]: JSON.stringify(columns),
|
|
66
|
-
[TEST_PROP_ID]: getNameDataTestId(
|
|
68
|
+
[TEST_PROP_ID]: getNameDataTestId(
|
|
69
|
+
DATAGRID_PREFIX_NAME,
|
|
70
|
+
"root",
|
|
71
|
+
dataTestId
|
|
72
|
+
),
|
|
67
73
|
[TEST_SKELETON]: isSkeleton ? true : false
|
|
68
74
|
} : {},
|
|
69
75
|
children: /* @__PURE__ */ jsx(
|
|
@@ -83,6 +89,8 @@ function DataGrid(props) {
|
|
|
83
89
|
onChangeUserColumns,
|
|
84
90
|
defaultUserColumns,
|
|
85
91
|
size: currentSize,
|
|
92
|
+
externalSortSettings,
|
|
93
|
+
externalFilterSettings,
|
|
86
94
|
children: /* @__PURE__ */ jsxs(FilterProvider, { initialActiveFilters: false, children: [
|
|
87
95
|
withActions && actionsProps && /* @__PURE__ */ jsx(
|
|
88
96
|
HeaderActions,
|
|
@@ -112,7 +120,13 @@ function DataGrid(props) {
|
|
|
112
120
|
onRowsChange
|
|
113
121
|
}
|
|
114
122
|
),
|
|
115
|
-
withPager && /* @__PURE__ */ jsx(
|
|
123
|
+
withPager && /* @__PURE__ */ jsx(
|
|
124
|
+
ControlNavigate,
|
|
125
|
+
{
|
|
126
|
+
size: currentSize,
|
|
127
|
+
...{ withPager, pagerOptions }
|
|
128
|
+
}
|
|
129
|
+
)
|
|
116
130
|
] })
|
|
117
131
|
}
|
|
118
132
|
)
|
|
@@ -60,17 +60,23 @@ const dataGridStyles = {
|
|
|
60
60
|
/**
|
|
61
61
|
* Estilos del contenedor de las acciones
|
|
62
62
|
*/
|
|
63
|
-
actionsRoot: ({ theme }) => ({
|
|
63
|
+
actionsRoot: ({ theme, ownerState }) => ({
|
|
64
64
|
display: "flex",
|
|
65
65
|
alignItems: "center",
|
|
66
66
|
justifyContent: "space-between",
|
|
67
67
|
background: theme.vars.palette.background.default,
|
|
68
68
|
borderRadius: theme.vars.size.borderRadius.r1,
|
|
69
69
|
gap: theme.vars.size.baseSpacings.sp1,
|
|
70
|
-
|
|
71
|
-
...
|
|
72
|
-
|
|
73
|
-
|
|
70
|
+
// Tamaño del contenedor
|
|
71
|
+
...getSizeStyles(
|
|
72
|
+
theme,
|
|
73
|
+
ownerState?.size || "medium",
|
|
74
|
+
"container",
|
|
75
|
+
(size) => ({
|
|
76
|
+
minHeight: size,
|
|
77
|
+
height: size
|
|
78
|
+
})
|
|
79
|
+
),
|
|
74
80
|
"& .mobile-menu-actions": {
|
|
75
81
|
marginRight: "auto"
|
|
76
82
|
}
|
|
@@ -86,8 +92,7 @@ const dataGridStyles = {
|
|
|
86
92
|
borderRadius: theme.vars.size.borderRadius.r2,
|
|
87
93
|
border: theme.vars.size.borderStroke.container,
|
|
88
94
|
borderColor: theme.vars.palette?.border.disabled,
|
|
89
|
-
padding: theme.vars.size.baseSpacings.sp1
|
|
90
|
-
boxShadow: theme.vars.customShadows?.z1
|
|
95
|
+
padding: theme.vars.size.baseSpacings.sp1
|
|
91
96
|
}),
|
|
92
97
|
/**
|
|
93
98
|
* Estilos para el contenedor de las acciones derecho
|
|
@@ -137,7 +142,11 @@ const dataGridStyles = {
|
|
|
137
142
|
//Se utiliza directamente el valor porque no está tokenizado
|
|
138
143
|
height: "100%",
|
|
139
144
|
lineHeight: theme.vars.size.baseSpacings.sp4,
|
|
140
|
-
fontSize: getTypographyStyles(
|
|
145
|
+
fontSize: getTypographyStyles(
|
|
146
|
+
theme.generalSettings.isMobile,
|
|
147
|
+
ownerState?.size || "medium",
|
|
148
|
+
"body"
|
|
149
|
+
).fontSize
|
|
141
150
|
}),
|
|
142
151
|
/**
|
|
143
152
|
* Estilos para el valor de RowsCount
|
|
@@ -150,7 +159,11 @@ const dataGridStyles = {
|
|
|
150
159
|
paddingRight: "6px",
|
|
151
160
|
//No hay token para este valor
|
|
152
161
|
paddingTop: theme.vars.size.baseSpacings.sp1,
|
|
153
|
-
fontSize: getTypographyStyles(
|
|
162
|
+
fontSize: getTypographyStyles(
|
|
163
|
+
theme.generalSettings.isMobile,
|
|
164
|
+
ownerState?.size || "medium",
|
|
165
|
+
"body"
|
|
166
|
+
).fontSize
|
|
154
167
|
}),
|
|
155
168
|
/**
|
|
156
169
|
* Estilos para el contenedor de las columnas
|
|
@@ -571,15 +584,10 @@ const dataGridStyles = {
|
|
|
571
584
|
padding: theme.vars.size.baseSpacings.sp1,
|
|
572
585
|
gap: theme.vars.size.baseSpacings.sp1,
|
|
573
586
|
borderRadius: theme.vars.size.borderRadius.r1,
|
|
574
|
-
...getSizeStyles(
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
(size) => ({
|
|
579
|
-
minHeight: size,
|
|
580
|
-
height: size
|
|
581
|
-
})
|
|
582
|
-
)
|
|
587
|
+
...getSizeStyles(theme, ownerState?.size || "medium", "action", (size) => ({
|
|
588
|
+
minHeight: size,
|
|
589
|
+
height: size
|
|
590
|
+
}))
|
|
583
591
|
}),
|
|
584
592
|
/**
|
|
585
593
|
* Estilos de los inputs del header para el filtro
|
|
@@ -598,15 +606,10 @@ const dataGridStyles = {
|
|
|
598
606
|
height: "100%",
|
|
599
607
|
alignItems: "center",
|
|
600
608
|
"& .MuiSkeleton-root": {
|
|
601
|
-
...getSizeStyles(
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
(size) => ({
|
|
606
|
-
minHeight: `${size}!important`,
|
|
607
|
-
height: `${size}!important`
|
|
608
|
-
})
|
|
609
|
-
)
|
|
609
|
+
...getSizeStyles(theme, ownerState?.size || "medium", "base", (size) => ({
|
|
610
|
+
minHeight: `${size}!important`,
|
|
611
|
+
height: `${size}!important`
|
|
612
|
+
}))
|
|
610
613
|
}
|
|
611
614
|
}),
|
|
612
615
|
/**
|
|
@@ -618,6 +621,43 @@ const dataGridStyles = {
|
|
|
618
621
|
flexDirection: "column",
|
|
619
622
|
height: "100%"
|
|
620
623
|
}
|
|
624
|
+
}),
|
|
625
|
+
/**
|
|
626
|
+
* Estilos para el contenedor del nombre de la columna y el icono de sort
|
|
627
|
+
*/
|
|
628
|
+
nameColumnIcon: () => ({
|
|
629
|
+
display: "flex",
|
|
630
|
+
alignItems: "center",
|
|
631
|
+
justifyContent: "space-between",
|
|
632
|
+
gap: "5px"
|
|
633
|
+
}),
|
|
634
|
+
/**
|
|
635
|
+
* Estilos para el popover del header actions
|
|
636
|
+
*/
|
|
637
|
+
headerRenderClick: () => ({
|
|
638
|
+
width: "fit-content"
|
|
639
|
+
}),
|
|
640
|
+
/**
|
|
641
|
+
* Estilos para el menuList del header actions
|
|
642
|
+
*/
|
|
643
|
+
menuList: ({ theme }) => ({
|
|
644
|
+
padding: theme.vars.size.baseSpacings.sp3,
|
|
645
|
+
display: "flex",
|
|
646
|
+
flexDirection: "column",
|
|
647
|
+
gap: theme.vars.size.baseSpacings.sp1,
|
|
648
|
+
"& > div": {
|
|
649
|
+
paddingLeft: theme.vars.size.baseSpacings.sp4,
|
|
650
|
+
paddingRight: theme.vars.size.baseSpacings.sp4
|
|
651
|
+
}
|
|
652
|
+
}),
|
|
653
|
+
/**
|
|
654
|
+
* Estilos para el contenedor del boton de acciones del header
|
|
655
|
+
*/
|
|
656
|
+
buttonHeaderActions: () => ({
|
|
657
|
+
display: "flex",
|
|
658
|
+
alignItems: "center",
|
|
659
|
+
justifyContent: "space-between",
|
|
660
|
+
width: "100%"
|
|
621
661
|
})
|
|
622
662
|
};
|
|
623
663
|
export {
|
|
@@ -2,6 +2,8 @@ export declare const DATAGRID_PREFIX_NAME = "M4LDataGrid";
|
|
|
2
2
|
export declare const DATAGRID_SELECT_COLUMN_KEY = "M4LDataGrid-CheckedColumn";
|
|
3
3
|
export declare const DATAGRID_ACTIONS_COLUMN_KEY = "M4LDataGrid-ActionsColumn";
|
|
4
4
|
export declare const TEST_SKELETON = "data-skeleton";
|
|
5
|
+
export declare const DATAGRID_HEADER_RENDER_CLICK_KEY = "M4LDataGrid-HeaderRenderClick";
|
|
6
|
+
export declare const DATAGRID_ID_DICTIONARY = "data_grid";
|
|
5
7
|
export declare enum DATAGRID_SEMANTIC_WIDTHS {
|
|
6
8
|
actions = 40,
|
|
7
9
|
bigChip = 190,
|
|
@@ -2,6 +2,8 @@ const DATAGRID_PREFIX_NAME = "M4LDataGrid";
|
|
|
2
2
|
const DATAGRID_SELECT_COLUMN_KEY = "M4LDataGrid-CheckedColumn";
|
|
3
3
|
const DATAGRID_ACTIONS_COLUMN_KEY = "M4LDataGrid-ActionsColumn";
|
|
4
4
|
const TEST_SKELETON = "data-skeleton";
|
|
5
|
+
const DATAGRID_HEADER_RENDER_CLICK_KEY = "M4LDataGrid-HeaderRenderClick";
|
|
6
|
+
const DATAGRID_ID_DICTIONARY = "data_grid";
|
|
5
7
|
var DATAGRID_SEMANTIC_WIDTHS = /* @__PURE__ */ ((DATAGRID_SEMANTIC_WIDTHS2) => {
|
|
6
8
|
DATAGRID_SEMANTIC_WIDTHS2[DATAGRID_SEMANTIC_WIDTHS2["actions"] = 40] = "actions";
|
|
7
9
|
DATAGRID_SEMANTIC_WIDTHS2[DATAGRID_SEMANTIC_WIDTHS2["bigChip"] = 190] = "bigChip";
|
|
@@ -31,7 +33,9 @@ export {
|
|
|
31
33
|
TEST_SKELETON as T,
|
|
32
34
|
DATAGRID_ROW_HEIGHTS as a,
|
|
33
35
|
DATAGRID_ROW_HEADER_HEIGHTS as b,
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
36
|
+
DATAGRID_ID_DICTIONARY as c,
|
|
37
|
+
DATAGRID_SELECT_COLUMN_KEY as d,
|
|
38
|
+
DATAGRID_SEMANTIC_WIDTHS as e,
|
|
39
|
+
DATAGRID_ACTIONS_COLUMN_KEY as f,
|
|
40
|
+
DATAGRID_HEADER_RENDER_CLICK_KEY as g
|
|
37
41
|
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsx } from "react/jsx-runtime";
|
|
2
|
-
import { useState,
|
|
2
|
+
import { useState, useEffect, useMemo, useCallback, createContext } from "react";
|
|
3
3
|
import { c as castMapColumnsWidthToRecord } from "../../helpers/castMapColumnsWidthToRecord.js";
|
|
4
4
|
import { useFirstRender } from "@m4l/graphics";
|
|
5
5
|
import { g as getComponentClasses } from "../../../../utils/getComponentSlotRoot.js";
|
|
@@ -32,10 +32,7 @@ function getColumnsConfig(id, columns, defaultUserColumns = void 0) {
|
|
|
32
32
|
}
|
|
33
33
|
}
|
|
34
34
|
return columns.map((column, index) => {
|
|
35
|
-
const [columnConfig = { ...column }, columnConfigIndex] = getColumnConfigByKey(
|
|
36
|
-
column.key,
|
|
37
|
-
columnsConfig
|
|
38
|
-
);
|
|
35
|
+
const [columnConfig = { ...column }, columnConfigIndex] = getColumnConfigByKey(column.key, columnsConfig);
|
|
39
36
|
return {
|
|
40
37
|
key: column.key,
|
|
41
38
|
name: typeof column.name === "string" ? column.name : String(column.name),
|
|
@@ -81,10 +78,16 @@ function getColumnsWidth(id, columns, defaultUserColumns) {
|
|
|
81
78
|
function saveColumnsWidth(id, storeColumnsWidth, onChangeUserColumns) {
|
|
82
79
|
if (onChangeUserColumns) {
|
|
83
80
|
const columnsWidthObject = castMapColumnsWidthToRecord(storeColumnsWidth);
|
|
84
|
-
onChangeUserColumns({
|
|
81
|
+
onChangeUserColumns({
|
|
82
|
+
reason: "columnsWidths",
|
|
83
|
+
userConfig: columnsWidthObject
|
|
84
|
+
});
|
|
85
85
|
return;
|
|
86
86
|
}
|
|
87
|
-
localStorage.setItem(
|
|
87
|
+
localStorage.setItem(
|
|
88
|
+
`${id}_columns_width`,
|
|
89
|
+
JSON.stringify([...storeColumnsWidth])
|
|
90
|
+
);
|
|
88
91
|
}
|
|
89
92
|
function saveColumnsConfig(id, columnsConfig, onChangeUserColumns) {
|
|
90
93
|
if (onChangeUserColumns) {
|
|
@@ -118,26 +121,26 @@ function DataGridProvider(props) {
|
|
|
118
121
|
onCheckedRowsChange,
|
|
119
122
|
rowKeyGetter,
|
|
120
123
|
onChangeUserColumns,
|
|
124
|
+
externalSortSettings: sortSettings,
|
|
125
|
+
externalFilterSettings: filterSettings,
|
|
121
126
|
size
|
|
122
127
|
} = props;
|
|
123
128
|
const isFirstRender = useFirstRender([columns, id]);
|
|
124
|
-
const classes = getComponentClasses(
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
const [columnsWidths, setColumnsWidths] = useState(
|
|
137
|
-
/* @__PURE__ */ new Map()
|
|
129
|
+
const classes = getComponentClasses(DATAGRID_PREFIX_NAME, {
|
|
130
|
+
...DataGridSlots,
|
|
131
|
+
...ActionsSlots,
|
|
132
|
+
...RowsCountSlots,
|
|
133
|
+
...TableSlots,
|
|
134
|
+
...TextEditorSlots,
|
|
135
|
+
...ColumnsConfigSlots,
|
|
136
|
+
...ControlNavigateSlots
|
|
137
|
+
});
|
|
138
|
+
const [columnsWidths, setColumnsWidths] = useState(/* @__PURE__ */ new Map());
|
|
139
|
+
const [columnsConfig, setColumnsConfigOptions] = useState(
|
|
140
|
+
() => []
|
|
138
141
|
);
|
|
139
|
-
const [columnsConfig, setColumnsConfigOptions] = useState(() => []);
|
|
140
142
|
const [rowsFilterCount, setRowFilterCount] = useState(rowsCount);
|
|
143
|
+
const [sortColumns, setSortColumns] = useState([]);
|
|
141
144
|
const [currentRowHeightVariant, setCurrentRowHeightVariant] = useState(() => {
|
|
142
145
|
if (typeof rowHeights !== typeof rowHeaderHeights) {
|
|
143
146
|
throw new Error("Must be same type rowheights and rowHeaderTypes");
|
|
@@ -161,19 +164,44 @@ function DataGridProvider(props) {
|
|
|
161
164
|
rowHeaderHeight: typeof rowHeaderHeights !== "number" ? rowHeaderHeights[getIndexRowHeightVariant(initialRowHeightVariant)] : rowHeaderHeights
|
|
162
165
|
};
|
|
163
166
|
});
|
|
167
|
+
useEffect(() => {
|
|
168
|
+
const keys = new Set(columns.map((c) => c.key));
|
|
169
|
+
if (sortSettings?.sortsColumns) {
|
|
170
|
+
for (const sort of sortSettings.sortsColumns) {
|
|
171
|
+
if (!keys.has(sort)) {
|
|
172
|
+
throw new Error(
|
|
173
|
+
`DataGridProvider: Sorts incluye "${sort}", pero no existe ninguna columna con key="${sort}".`
|
|
174
|
+
);
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
if (filterSettings?.filterColumns) {
|
|
179
|
+
for (const filterField of filterSettings.filterColumns) {
|
|
180
|
+
if (!keys.has(filterField.name)) {
|
|
181
|
+
throw new Error(
|
|
182
|
+
`DataGridProvider: Fields incluye "${filterField.name}", pero no existe ninguna columna con key="${filterField.name}".`
|
|
183
|
+
);
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
}, [columns, sortSettings, filterSettings]);
|
|
164
188
|
const finalRowHeights = useMemo(() => rowHeights, [rowHeights]);
|
|
165
189
|
let timerSaveColumns;
|
|
166
190
|
useEffect(() => {
|
|
167
191
|
if (isFirstRender) {
|
|
168
192
|
setColumnsWidths(getColumnsWidth(id, columns, defaultUserColumns));
|
|
169
|
-
setColumnsConfigOptions(
|
|
193
|
+
setColumnsConfigOptions(
|
|
194
|
+
getColumnsConfig(id, columns, defaultUserColumns)
|
|
195
|
+
);
|
|
170
196
|
}
|
|
171
197
|
}, [defaultUserColumns]);
|
|
172
198
|
useEffect(() => {
|
|
173
199
|
if (!isFirstRender) {
|
|
174
200
|
const finalColumnsConfig = [];
|
|
175
201
|
for (let i = 0; i < columnsConfig.length; i++) {
|
|
176
|
-
const columnIndex = columns.findIndex(
|
|
202
|
+
const columnIndex = columns.findIndex(
|
|
203
|
+
(c) => c.key === columnsConfig[i]?.key
|
|
204
|
+
);
|
|
177
205
|
if (columnIndex !== -1) {
|
|
178
206
|
const column = columns[columnIndex];
|
|
179
207
|
finalColumnsConfig.push({
|
|
@@ -185,11 +213,18 @@ function DataGridProvider(props) {
|
|
|
185
213
|
});
|
|
186
214
|
}
|
|
187
215
|
}
|
|
188
|
-
const newColumns = columns.filter(
|
|
216
|
+
const newColumns = columns.filter(
|
|
217
|
+
(column, index) => column.key !== columnsConfig[index]?.key
|
|
218
|
+
);
|
|
189
219
|
if (newColumns.length > 0) {
|
|
190
220
|
const colLength = finalColumnsConfig.length;
|
|
191
|
-
const newColConfig = getColumnsConfig(
|
|
192
|
-
|
|
221
|
+
const newColConfig = getColumnsConfig(
|
|
222
|
+
id,
|
|
223
|
+
newColumns
|
|
224
|
+
).map((columnConfig, index) => {
|
|
225
|
+
const columnIndex = columns.findIndex(
|
|
226
|
+
(c) => c.key === newColumns[index].key
|
|
227
|
+
);
|
|
193
228
|
const column = newColumns[index];
|
|
194
229
|
const indexNewCol = index + colLength;
|
|
195
230
|
return {
|
|
@@ -206,7 +241,11 @@ function DataGridProvider(props) {
|
|
|
206
241
|
if (deepEqual(columnsConfig, finalColumnsConfig)) {
|
|
207
242
|
return;
|
|
208
243
|
}
|
|
209
|
-
console.log(
|
|
244
|
+
console.log(
|
|
245
|
+
"useEffect columnsConfig changed",
|
|
246
|
+
columnsConfig,
|
|
247
|
+
finalColumnsConfig
|
|
248
|
+
);
|
|
210
249
|
setColumnsConfigOptions(finalColumnsConfig);
|
|
211
250
|
}
|
|
212
251
|
}, [columns, id]);
|
|
@@ -223,8 +262,12 @@ function DataGridProvider(props) {
|
|
|
223
262
|
if (sourceKey === targetKey) {
|
|
224
263
|
return;
|
|
225
264
|
}
|
|
226
|
-
const sourceColumnIndex = columnsConfig.findIndex(
|
|
227
|
-
|
|
265
|
+
const sourceColumnIndex = columnsConfig.findIndex(
|
|
266
|
+
(c) => c.key === sourceKey
|
|
267
|
+
);
|
|
268
|
+
const targetColumnIndex = columnsConfig.findIndex(
|
|
269
|
+
(c) => c.key === targetKey
|
|
270
|
+
);
|
|
228
271
|
const reorderedColumnsConfig = [...columnsConfig];
|
|
229
272
|
reorderedColumnsConfig.splice(
|
|
230
273
|
targetColumnIndex,
|
|
@@ -282,6 +325,10 @@ function DataGridProvider(props) {
|
|
|
282
325
|
onCheckedRowsChange,
|
|
283
326
|
rowKeyGetter,
|
|
284
327
|
onChangeUserColumns,
|
|
328
|
+
sortColumns,
|
|
329
|
+
setSortColumns,
|
|
330
|
+
externalSortSettings: sortSettings,
|
|
331
|
+
externalFilterSettings: filterSettings,
|
|
285
332
|
classes,
|
|
286
333
|
size
|
|
287
334
|
},
|
|
@@ -2,6 +2,7 @@ import { ReactNode } from 'react';
|
|
|
2
2
|
import { RowKey, RowHeightVariants, GridProps } from '../../types';
|
|
3
3
|
import { Maybe } from '@m4l/core';
|
|
4
4
|
import { ActionsSlots, ColumnsConfigSlots, ControlNavigateSlots, DataGridSlots, RowsCountSlots, TableSlots, TextEditorSlots } from '../../slots/DataGridEnum';
|
|
5
|
+
import { SortColumn } from 'react-data-grid';
|
|
5
6
|
export interface BaseConfigColumn {
|
|
6
7
|
key: string;
|
|
7
8
|
visible: boolean;
|
|
@@ -22,7 +23,7 @@ export interface IGridConfig {
|
|
|
22
23
|
columnsConfig: BaseConfigColumn[];
|
|
23
24
|
columnsWidths: Record<RowKey, number>;
|
|
24
25
|
}
|
|
25
|
-
export interface DataGridProviderProps<TRow, TSummaryRow, TKey extends RowKey = RowKey> extends Pick<GridProps<TRow, TSummaryRow, TKey>, 'rows' | 'columns' | 'rowActionsGetter' | 'rowHeaderHeights' | 'rowHeights' | 'initialRowHeightVariant' | 'checkedRows' | 'onCheckedRowsChange' | 'rowKeyGetter' | 'onChangeUserColumns' | 'defaultUserColumns'> {
|
|
26
|
+
export interface DataGridProviderProps<TRow, TSummaryRow, TKey extends RowKey = RowKey> extends Pick<GridProps<TRow, TSummaryRow, TKey>, 'rows' | 'columns' | 'rowActionsGetter' | 'rowHeaderHeights' | 'rowHeights' | 'initialRowHeightVariant' | 'checkedRows' | 'onCheckedRowsChange' | 'rowKeyGetter' | 'onChangeUserColumns' | 'defaultUserColumns' | 'externalSortSettings' | 'externalFilterSettings'> {
|
|
26
27
|
id: number | string;
|
|
27
28
|
children: ReactNode;
|
|
28
29
|
rowsCount: number;
|
|
@@ -33,7 +34,7 @@ export type RowHeightState = {
|
|
|
33
34
|
rowHeight: number;
|
|
34
35
|
rowHeaderHeight: number;
|
|
35
36
|
};
|
|
36
|
-
export interface DataGridContextProps<TRow, TSummaryRow, TKey extends RowKey = RowKey> extends Pick<DataGridProviderProps<TRow, TSummaryRow, TKey>, 'rows' | 'checkedRows' | 'onCheckedRowsChange' | 'rowHeights' | 'rowsCount' | 'rowActionsGetter' | 'rowKeyGetter' | 'onChangeUserColumns'> {
|
|
37
|
+
export interface DataGridContextProps<TRow, TSummaryRow, TKey extends RowKey = RowKey> extends Pick<DataGridProviderProps<TRow, TSummaryRow, TKey>, 'rows' | 'checkedRows' | 'onCheckedRowsChange' | 'rowHeights' | 'rowsCount' | 'rowActionsGetter' | 'rowKeyGetter' | 'onChangeUserColumns' | 'externalSortSettings' | 'externalFilterSettings'> {
|
|
37
38
|
columnsConfig: IConfigColumn[];
|
|
38
39
|
columnsWidths: Map<string, Maybe<string | number>>;
|
|
39
40
|
setRowsCount: (newRowsCount: number) => void;
|
|
@@ -46,4 +47,6 @@ export interface DataGridContextProps<TRow, TSummaryRow, TKey extends RowKey = R
|
|
|
46
47
|
onChangeColumnWidth: (columnKey: string, width: number) => void;
|
|
47
48
|
classes?: Record<DataGridSlots | ActionsSlots | RowsCountSlots | TableSlots | TextEditorSlots | ColumnsConfigSlots | ControlNavigateSlots, string>;
|
|
48
49
|
size: GridProps<any, any, any>['size'];
|
|
50
|
+
sortColumns: SortColumn[];
|
|
51
|
+
setSortColumns: React.Dispatch<React.SetStateAction<SortColumn[]>>;
|
|
49
52
|
}
|
|
@@ -25,4 +25,12 @@ export declare const DICTIONARY: {
|
|
|
25
25
|
SETTINGS_VISIBLE_ALL: string;
|
|
26
26
|
SETTINGS_NO_VISIBLE_ALL: string;
|
|
27
27
|
SETTINGS_RESTORE: string;
|
|
28
|
+
NO_ACTIONS_LABEL: string;
|
|
29
|
+
ORDER_ASC_COLUMN: string;
|
|
30
|
+
ORDER_DESC_COLUMN: string;
|
|
31
|
+
REMOVE_ORDER_COLUMN: string;
|
|
32
|
+
FREEZE_COLUMN: string;
|
|
33
|
+
UNFREEZE_COLUMN: string;
|
|
34
|
+
HIDE_COLUMN: string;
|
|
35
|
+
ADD_FILTER_COLUMN: string;
|
|
28
36
|
};
|