@m4l/components 9.3.19-BE171025-beta.1 → 9.3.19-BE241025-beta.2
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/components/DataGrid/DataGrid.js +9 -4
- package/components/DataGrid/Datagrid.styles.js +270 -0
- package/components/DataGrid/constants.js +2 -2
- package/components/DataGrid/contexts/DataGridContext/index.js +322 -112
- package/components/DataGrid/contexts/DataGridContext/types.d.ts +63 -4
- package/components/DataGrid/dictionary.d.ts +5 -0
- package/components/DataGrid/dictionary.js +6 -1
- package/components/DataGrid/formatters/ColumnSetCheckFormatter/formatter.js +2 -2
- package/components/DataGrid/hooks/useModalCardDetail.d.ts +6 -0
- package/components/DataGrid/hooks/useModalCardDetail.js +74 -0
- package/components/DataGrid/hooks/useProcessedColumns.d.ts +50 -0
- package/components/DataGrid/hooks/useProcessedColumns.js +44 -0
- package/components/DataGrid/icons.d.ts +7 -0
- package/components/DataGrid/icons.js +5 -1
- package/components/DataGrid/index.d.ts +1 -1
- package/components/DataGrid/slots/DataGridEnum.d.ts +22 -1
- package/components/DataGrid/slots/DataGridEnum.js +21 -0
- package/components/DataGrid/slots/DataGridSlot.d.ts +24 -0
- package/components/DataGrid/slots/DataGridSlot.js +123 -21
- package/components/DataGrid/subcomponents/Cards/hooks/useCardContent.d.ts +9 -0
- package/components/DataGrid/subcomponents/Cards/hooks/useCardContent.js +91 -0
- package/components/DataGrid/subcomponents/Cards/index.d.ts +5 -0
- package/components/DataGrid/subcomponents/Cards/index.js +40 -0
- package/components/DataGrid/subcomponents/Cards/subcomponents/CardDetails/index.d.ts +8 -0
- package/components/DataGrid/subcomponents/Cards/subcomponents/CardDetails/index.js +79 -0
- package/components/DataGrid/subcomponents/Cards/subcomponents/CardHeader/index.d.ts +7 -0
- package/components/DataGrid/subcomponents/Cards/subcomponents/CardHeader/index.js +98 -0
- package/components/DataGrid/subcomponents/Cards/subcomponents/CardRow/index.d.ts +6 -0
- package/components/DataGrid/subcomponents/Cards/subcomponents/CardRow/index.js +71 -0
- package/components/DataGrid/subcomponents/Cards/subcomponents/IntersectCard/index.d.ts +20 -0
- package/components/DataGrid/subcomponents/Cards/subcomponents/IntersectCard/index.js +46 -0
- package/components/DataGrid/subcomponents/Cards/subcomponents/LazyLoadCard/index.d.ts +17 -0
- package/components/DataGrid/subcomponents/Cards/subcomponents/LazyLoadCard/index.js +34 -0
- package/components/DataGrid/subcomponents/Cards/types.d.ts +118 -0
- package/components/DataGrid/subcomponents/CheckboxCellAdapter/index.d.ts +7 -0
- package/components/DataGrid/subcomponents/CheckboxCellAdapter/index.js +43 -0
- package/components/DataGrid/subcomponents/CheckboxCellAdapter/types.d.ts +7 -0
- package/components/DataGrid/subcomponents/ControlNavigate/ControlNavigate.js +1 -1
- package/components/DataGrid/subcomponents/HeaderActions/index.js +5 -3
- package/components/DataGrid/subcomponents/HeaderActions/subcomponents/RowsCount/index.js +1 -1
- package/components/DataGrid/subcomponents/HeaderActions/subcomponents/Settings/index.js +11 -2
- package/components/DataGrid/subcomponents/HeaderActions/subcomponents/Settings/subcomponents/ColumnsConfig/index.js +1 -1
- package/components/DataGrid/subcomponents/HeaderActions/subcomponents/Settings/subcomponents/ColumnsConfigCards/index.d.ts +2 -0
- package/components/DataGrid/subcomponents/HeaderActions/subcomponents/Settings/subcomponents/ColumnsConfigCards/index.js +304 -0
- package/components/DataGrid/subcomponents/HeaderActions/subcomponents/Settings/subcomponents/ColumnsConfigCards/types.d.ts +31 -0
- package/components/DataGrid/subcomponents/HeaderActions/subcomponents/ViewMode/index.d.ts +4 -0
- package/components/DataGrid/subcomponents/HeaderActions/subcomponents/ViewMode/index.js +125 -0
- package/components/DataGrid/subcomponents/HeaderActions/subcomponents/hooks/useModalSettings/index.js +2 -2
- package/components/DataGrid/subcomponents/HeaderActions/subcomponents/hooks/useModalSettingsCards/index.d.ts +7 -0
- package/components/DataGrid/subcomponents/HeaderActions/subcomponents/hooks/useModalSettingsCards/index.js +74 -0
- package/components/DataGrid/subcomponents/HeaderActions/subcomponents/hooks/useModalSettingsCards/types.d.ts +4 -0
- package/components/DataGrid/subcomponents/RenderContent/index.d.ts +5 -0
- package/components/DataGrid/subcomponents/RenderContent/index.js +11 -0
- package/components/DataGrid/subcomponents/Table/hooks/useHeaderMenuActions.js +2 -2
- package/components/DataGrid/subcomponents/Table/hooks/useSortColumnsRows.js +1 -1
- package/components/DataGrid/subcomponents/Table/index.js +1 -1
- package/components/DataGrid/subcomponents/Table/subcomponents/ActionsColumn.js +1 -1
- package/components/DataGrid/subcomponents/Table/subcomponents/DraggableHeaderRenderer.js +1 -1
- package/components/DataGrid/subcomponents/Table/subcomponents/HeaderRenderClick/HeaderRenderClick.js +1 -1
- package/components/DataGrid/subcomponents/editors/TextEditor/index.js +1 -1
- package/components/DataGrid/tests/components/CardDetails.test.d.ts +1 -0
- package/components/DataGrid/tests/components/CardHeader.test.d.ts +1 -0
- package/components/DataGrid/tests/components/CardRow.test.d.ts +1 -0
- package/components/DataGrid/tests/components/Cards.test.d.ts +1 -0
- package/components/DataGrid/tests/components/CheckboxCellAdapter.test.d.ts +1 -0
- package/components/DataGrid/tests/components/ColumnsConfigCards.test.d.ts +1 -0
- package/components/DataGrid/tests/components/IntersectCard.test.d.ts +1 -0
- package/components/DataGrid/tests/components/ViewMode.test.d.ts +1 -0
- package/components/DataGrid/tests/helpers/types.d.ts +1 -0
- package/components/DataGrid/tests/helpers/useCardsViewConfig.d.ts +24 -0
- package/components/DataGrid/tests/helpers/useCustomCardExample.d.ts +7 -0
- package/components/DataGrid/tests/hooks/useCardContent.test.d.ts +1 -0
- package/components/DataGrid/tests/hooks/useModalDetail.test.d.ts +1 -0
- package/components/DataGrid/tests/hooks/useModalSettingsCards.test.d.ts +1 -0
- package/components/DataGrid/tests/hooks/useProcessedColumns.test.d.ts +1 -0
- package/components/DataGrid/types.d.ts +87 -5
- package/components/DynamicFilter/helpers/formatToInitialFilters.js +3 -3
- package/components/DynamicFilter/subcomponents/FieldTypes/BooleanFilter/helpers.js +11 -3
- package/components/DynamicFilter/subcomponents/FieldTypes/DateTimeFilter/helpers.js +16 -4
- package/components/DynamicFilter/subcomponents/FieldTypes/NumberFilter/helpers.js +11 -8
- package/components/DynamicFilter/subcomponents/FieldTypes/SelectAsyncFilter/helpers.js +21 -8
- package/components/DynamicFilter/subcomponents/FieldTypes/SelectFilter/helpers.js +18 -8
- package/components/DynamicFilter/subcomponents/FieldTypes/StringFilter/helpers.js +5 -3
- package/components/EditLabel/hooks/useEditLabel.d.ts +1 -0
- package/components/LanguagePopover/LanguagePopover.js +2 -0
- package/components/MFIsolationApp/MFIsolationApp.js +3 -6
- package/components/MFIsolationApp/subcomponents/AppBarSettings/AppBarSettings.js +1 -1
- package/components/MFIsolationAppStorybook/MFIsolationAppStorybook.js +4 -20
- package/components/MFIsolationAppStorybook/types.d.ts +0 -4
- package/components/MenuActions/MenuActions.js +105 -55
- package/components/hook-form/RHFAutocomplete/RHFAutocomplete.d.ts +1 -1
- package/components/hook-form/RHFAutocomplete/RHFAutocomplete.js +4 -4
- package/components/hook-form/RHFAutocomplete/types.d.ts +2 -2
- package/components/hook-form/RHFAutocompleteAsync/RHFAutocompleteAsync.js +4 -4
- package/components/hook-form/RHFAutocompleteAsync/slots/RHFAutocompleteSlotsAsync.d.ts +1 -1
- package/components/mui_extended/Autocomplete/Autocomplete.d.ts +4 -8
- package/components/mui_extended/Autocomplete/Autocomplete.js +92 -67
- package/components/mui_extended/Autocomplete/Autocomplete.styles.js +11 -5
- package/components/mui_extended/Autocomplete/RenderAdornment/RenderAdornment.d.ts +6 -0
- package/components/mui_extended/Autocomplete/RenderAdornment/RenderAdornment.js +45 -0
- package/components/mui_extended/Autocomplete/hooks/useEndAdornments.js +2 -1
- package/components/mui_extended/Autocomplete/hooks/useStartAdornments.d.ts +4 -12
- package/components/mui_extended/Autocomplete/hooks/useStartAdornments.js +72 -23
- package/components/mui_extended/Autocomplete/hooks/useValuesAndHandlers.d.ts +0 -2
- package/components/mui_extended/Autocomplete/hooks/useValuesAndHandlers.js +0 -13
- package/components/mui_extended/Autocomplete/renderOptions/index.d.ts +4 -17
- package/components/mui_extended/Autocomplete/renderOptions/index.js +42 -5
- package/components/mui_extended/Autocomplete/renderOptions/types.d.ts +7 -0
- package/components/mui_extended/Autocomplete/slots/AutocompleteSlots.js +2 -2
- package/components/mui_extended/Autocomplete/types.d.ts +10 -3
- package/components/mui_extended/MenuItem/MenuItem.styles.js +4 -1
- package/contexts/AppearanceComponentContext/AppearanceComponentContext.js +4 -1
- package/hooks/useDataGridPersistence/helpers.d.ts +2 -2
- package/hooks/useDataGridPersistence/useDataGridPersistence.d.ts +2 -2
- package/hooks/useDataGridPersistence/useDataGridPersistence.js +5 -0
- package/index.js +8 -8
- package/package.json +1 -1
- package/components/MFIsolationAppStorybook/icons.js +0 -6
- package/components/MFIsolationAppStorybook/subcomponents/AppBarSettings/AppBarSettings.d.ts +0 -4
- package/components/MFIsolationAppStorybook/subcomponents/AppBarSettings/AppBarSettings.js +0 -21
- package/components/MFIsolationAppStorybook/subcomponents/AppBarSettings/index.d.ts +0 -1
- package/components/MFIsolationAppStorybook/subcomponents/AppBarSettings/index.js +0 -1
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { jsx, jsxs, Fragment } from "react/jsx-runtime";
|
|
2
2
|
import React, { useMemo } from "react";
|
|
3
|
+
import { r as renderAdornment } from "../RenderAdornment/RenderAdornment.js";
|
|
3
4
|
import { b as ContainerMultipleValuesStyled, c as ContainerWrapperStyled, d as ChipStyled, W as WrapperStartAdornmentStyled } from "../slots/AutocompleteSlots.js";
|
|
4
5
|
function useStartAdornments(props) {
|
|
5
6
|
const {
|
|
@@ -11,30 +12,68 @@ function useStartAdornments(props) {
|
|
|
11
12
|
handleDelete,
|
|
12
13
|
disabled,
|
|
13
14
|
startAdornment,
|
|
14
|
-
|
|
15
|
-
|
|
15
|
+
getOptionStartAdornment,
|
|
16
|
+
getOptionEndAdornment
|
|
16
17
|
} = props;
|
|
17
|
-
const startAdornmentClone =
|
|
18
|
-
|
|
19
|
-
|
|
18
|
+
const startAdornmentClone = useMemo(() => {
|
|
19
|
+
if (!startAdornment) {
|
|
20
|
+
return null;
|
|
21
|
+
}
|
|
22
|
+
try {
|
|
23
|
+
return React.cloneElement(startAdornment, {
|
|
24
|
+
size: adjustedSize
|
|
25
|
+
});
|
|
26
|
+
} catch (error) {
|
|
27
|
+
console.warn("Error cloning startAdornment:", error);
|
|
28
|
+
return null;
|
|
29
|
+
}
|
|
30
|
+
}, [startAdornment, adjustedSize]);
|
|
31
|
+
const memoizedIcons = useMemo(() => {
|
|
32
|
+
if (!Array.isArray(selectedValue) || !multiple || selectedValue.length === 0) {
|
|
33
|
+
return null;
|
|
34
|
+
}
|
|
35
|
+
const iconMap = /* @__PURE__ */ new Map();
|
|
36
|
+
selectedValue.forEach((option) => {
|
|
37
|
+
const optionKey = getOptionLabelLocal(option);
|
|
38
|
+
const startAdornmentResource = getOptionStartAdornment?.(option);
|
|
39
|
+
const endAdornmentResource = getOptionEndAdornment?.(option);
|
|
40
|
+
if (startAdornmentResource) {
|
|
41
|
+
iconMap.set(`${optionKey}-start`, renderAdornment(startAdornmentResource, adjustedSize));
|
|
42
|
+
}
|
|
43
|
+
if (endAdornmentResource) {
|
|
44
|
+
iconMap.set(`${optionKey}-end`, renderAdornment(endAdornmentResource, adjustedSize));
|
|
45
|
+
}
|
|
46
|
+
});
|
|
47
|
+
return iconMap;
|
|
48
|
+
}, [
|
|
49
|
+
selectedValue,
|
|
50
|
+
multiple,
|
|
51
|
+
getOptionLabelLocal,
|
|
52
|
+
getOptionStartAdornment,
|
|
53
|
+
getOptionEndAdornment,
|
|
54
|
+
adjustedSize
|
|
55
|
+
]);
|
|
20
56
|
const internalAdornments = useMemo(() => {
|
|
21
57
|
if (!(Array.isArray(selectedValue) && multiple)) {
|
|
22
58
|
return null;
|
|
23
59
|
}
|
|
24
|
-
return /* @__PURE__ */ jsx(ContainerMultipleValuesStyled, { children: /* @__PURE__ */ jsx(ContainerWrapperStyled, { children: selectedValue.map((option, index) =>
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
60
|
+
return /* @__PURE__ */ jsx(ContainerMultipleValuesStyled, { role: "list", "aria-label": "Selected options", children: /* @__PURE__ */ jsx(ContainerWrapperStyled, { children: selectedValue.map((option, index) => {
|
|
61
|
+
const optionKey = getOptionLabelLocal(option);
|
|
62
|
+
return /* @__PURE__ */ jsx(
|
|
63
|
+
ChipStyled,
|
|
64
|
+
{
|
|
65
|
+
size: adjustedSize,
|
|
66
|
+
label: optionKey,
|
|
67
|
+
opacity: true,
|
|
68
|
+
onDeleted: () => handleDelete(option),
|
|
69
|
+
disabledDeleteButton: disabled,
|
|
70
|
+
ownerState: { ...ownerState },
|
|
71
|
+
startIcon: memoizedIcons?.get(`${optionKey}-start`),
|
|
72
|
+
endIcon: memoizedIcons?.get(`${optionKey}-end`)
|
|
73
|
+
},
|
|
74
|
+
`${optionKey}-${index}`
|
|
75
|
+
);
|
|
76
|
+
}) }) });
|
|
38
77
|
}, [
|
|
39
78
|
selectedValue,
|
|
40
79
|
multiple,
|
|
@@ -43,16 +82,26 @@ function useStartAdornments(props) {
|
|
|
43
82
|
handleDelete,
|
|
44
83
|
disabled,
|
|
45
84
|
ownerState,
|
|
46
|
-
|
|
47
|
-
getOptionalEndAdornment
|
|
85
|
+
memoizedIcons
|
|
48
86
|
]);
|
|
49
87
|
if (startAdornmentClone && internalAdornments) {
|
|
50
88
|
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
51
|
-
/* @__PURE__ */ jsx(WrapperStartAdornmentStyled, { children: startAdornmentClone }),
|
|
89
|
+
/* @__PURE__ */ jsx(WrapperStartAdornmentStyled, { role: "img", "aria-hidden": "true", children: startAdornmentClone }),
|
|
52
90
|
internalAdornments
|
|
53
91
|
] });
|
|
54
92
|
}
|
|
55
|
-
|
|
93
|
+
if (startAdornmentClone) {
|
|
94
|
+
return /* @__PURE__ */ jsx(WrapperStartAdornmentStyled, { role: "img", "aria-hidden": "true", children: startAdornmentClone });
|
|
95
|
+
}
|
|
96
|
+
if (!getOptionLabelLocal) {
|
|
97
|
+
console.error("useStartAdornments: getOptionLabelLocal is required");
|
|
98
|
+
return null;
|
|
99
|
+
}
|
|
100
|
+
if (!handleDelete) {
|
|
101
|
+
console.error("useStartAdornments: handleDelete is required");
|
|
102
|
+
return null;
|
|
103
|
+
}
|
|
104
|
+
return internalAdornments;
|
|
56
105
|
}
|
|
57
106
|
export {
|
|
58
107
|
useStartAdornments as u
|
|
@@ -8,7 +8,6 @@ export declare function useValuesAndHandlers<T, Multiple extends boolean | undef
|
|
|
8
8
|
open: boolean;
|
|
9
9
|
inputValue: string;
|
|
10
10
|
selectedValue: T | T[] | null;
|
|
11
|
-
selectedOption: T | undefined;
|
|
12
11
|
isOptionEqualToValueLocal: (option: unknown, val: unknown) => boolean;
|
|
13
12
|
handleDelete: (optionToDelete: T) => void;
|
|
14
13
|
handleRefresh: () => void;
|
|
@@ -17,7 +16,6 @@ export declare function useValuesAndHandlers<T, Multiple extends boolean | undef
|
|
|
17
16
|
onCloseLocal: (event: React.SyntheticEvent, reason: AutocompleteCloseReason) => void;
|
|
18
17
|
onOpenLocal: (event: React.SyntheticEvent) => void;
|
|
19
18
|
getOptionLabelLocal: (option: unknown) => string;
|
|
20
|
-
getOptionUrlImageLocal: (option: T | null) => string;
|
|
21
19
|
checkKeyDown: (e: KeyboardEvent<HTMLDivElement>) => void;
|
|
22
20
|
scrollPositionOptionsRef: import('react').MutableRefObject<number>;
|
|
23
21
|
};
|
|
@@ -9,8 +9,6 @@ function useValuesAndHandlers(props) {
|
|
|
9
9
|
onClose,
|
|
10
10
|
onChangeFilterParmsLocal,
|
|
11
11
|
multiple,
|
|
12
|
-
getOptionUrlImage,
|
|
13
|
-
// Diferencia
|
|
14
12
|
refresh,
|
|
15
13
|
onChange,
|
|
16
14
|
value,
|
|
@@ -115,12 +113,6 @@ function useValuesAndHandlers(props) {
|
|
|
115
113
|
},
|
|
116
114
|
[getOptionLabel]
|
|
117
115
|
);
|
|
118
|
-
const getOptionUrlImageLocal = useCallback((option) => {
|
|
119
|
-
if (option === void 0 || option === null || getOptionUrlImage === void 0) {
|
|
120
|
-
return "";
|
|
121
|
-
}
|
|
122
|
-
return getOptionUrlImage(option);
|
|
123
|
-
}, [getOptionUrlImage]);
|
|
124
116
|
const [inputValue, setInputValue] = useState("");
|
|
125
117
|
useEffect(() => {
|
|
126
118
|
if (readOnly && value !== null && value !== void 0 && !multiple) {
|
|
@@ -161,14 +153,10 @@ function useValuesAndHandlers(props) {
|
|
|
161
153
|
}
|
|
162
154
|
}
|
|
163
155
|
};
|
|
164
|
-
const selectedOption = options.find((option) => {
|
|
165
|
-
return isOptionEqualToValueLocal(option, selectedValue);
|
|
166
|
-
});
|
|
167
156
|
return {
|
|
168
157
|
open,
|
|
169
158
|
inputValue,
|
|
170
159
|
selectedValue,
|
|
171
|
-
selectedOption,
|
|
172
160
|
isOptionEqualToValueLocal,
|
|
173
161
|
handleDelete,
|
|
174
162
|
handleRefresh,
|
|
@@ -177,7 +165,6 @@ function useValuesAndHandlers(props) {
|
|
|
177
165
|
onCloseLocal,
|
|
178
166
|
onOpenLocal,
|
|
179
167
|
getOptionLabelLocal,
|
|
180
|
-
getOptionUrlImageLocal,
|
|
181
168
|
checkKeyDown,
|
|
182
169
|
scrollPositionOptionsRef
|
|
183
170
|
};
|
|
@@ -1,22 +1,9 @@
|
|
|
1
|
-
import { HTMLAttributes
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
* Higher-order function to generate a render option function for Autocomplete.
|
|
5
|
-
* It supports rendering options with `startAd` and `endIcon`.
|
|
6
|
-
* @param color - The color for the MenuItem.
|
|
7
|
-
*/
|
|
8
|
-
type OptionType<T> = T & {
|
|
9
|
-
label: string;
|
|
10
|
-
selected?: boolean;
|
|
11
|
-
disabled?: boolean;
|
|
12
|
-
startAdornment?: ReactNode;
|
|
13
|
-
endAdornment?: ReactNode;
|
|
14
|
-
size: Extract<Sizes, 'small' | 'medium'>;
|
|
15
|
-
};
|
|
1
|
+
import { HTMLAttributes } from 'react';
|
|
2
|
+
import { ResourceType } from '../types';
|
|
3
|
+
import { RenderOptionType } from './types';
|
|
16
4
|
/**
|
|
17
5
|
* Render option for Autocomplete.
|
|
18
6
|
*/
|
|
19
7
|
export declare const renderOption: <T>(optionProps: HTMLAttributes<HTMLLIElement> & {
|
|
20
8
|
key: string;
|
|
21
|
-
}, option:
|
|
22
|
-
export {};
|
|
9
|
+
}, option: RenderOptionType<T>, getOptionStartAdornment?: (option: T) => ResourceType | undefined, getOptionEndAdornment?: (option: T) => ResourceType | undefined) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,9 +1,35 @@
|
|
|
1
1
|
import { jsx } from "react/jsx-runtime";
|
|
2
|
-
import { memo } from "react";
|
|
2
|
+
import { memo, useMemo } from "react";
|
|
3
|
+
import { r as renderAdornment } from "../RenderAdornment/RenderAdornment.js";
|
|
3
4
|
import { M as MenuItem } from "../../MenuItem/MenuItem.js";
|
|
4
5
|
const MemoizedMenuItem = memo(MenuItem);
|
|
5
|
-
const
|
|
6
|
+
const RenderOptionComponent = ({
|
|
7
|
+
optionProps,
|
|
8
|
+
option,
|
|
9
|
+
getOptionStartAdornment,
|
|
10
|
+
getOptionEndAdornment
|
|
11
|
+
}) => {
|
|
6
12
|
const { className, key, ...otherOptionProps } = optionProps;
|
|
13
|
+
const processedStartAdornment = useMemo(() => {
|
|
14
|
+
if (!getOptionStartAdornment) {
|
|
15
|
+
return null;
|
|
16
|
+
}
|
|
17
|
+
const startAdornment = getOptionStartAdornment(option);
|
|
18
|
+
if (!startAdornment) {
|
|
19
|
+
return null;
|
|
20
|
+
}
|
|
21
|
+
return renderAdornment(startAdornment, option.size);
|
|
22
|
+
}, [getOptionStartAdornment, option]);
|
|
23
|
+
const processedEndAdornment = useMemo(() => {
|
|
24
|
+
if (!getOptionEndAdornment) {
|
|
25
|
+
return null;
|
|
26
|
+
}
|
|
27
|
+
const endAdornment = getOptionEndAdornment(option);
|
|
28
|
+
if (!endAdornment) {
|
|
29
|
+
return null;
|
|
30
|
+
}
|
|
31
|
+
return renderAdornment(endAdornment, option.size);
|
|
32
|
+
}, [getOptionEndAdornment, option]);
|
|
7
33
|
return /* @__PURE__ */ jsx(
|
|
8
34
|
MemoizedMenuItem,
|
|
9
35
|
{
|
|
@@ -12,13 +38,24 @@ const renderOption = (optionProps, option) => {
|
|
|
12
38
|
color: "default",
|
|
13
39
|
label: option.label,
|
|
14
40
|
disabled: option.disabled,
|
|
15
|
-
startIcon:
|
|
16
|
-
endIcon:
|
|
17
|
-
size: option.size
|
|
41
|
+
startIcon: processedStartAdornment,
|
|
42
|
+
endIcon: processedEndAdornment
|
|
18
43
|
},
|
|
19
44
|
option.label
|
|
20
45
|
);
|
|
21
46
|
};
|
|
47
|
+
const MemoizedRenderOptionComponent = memo(RenderOptionComponent);
|
|
48
|
+
const renderOption = (optionProps, option, getOptionStartAdornment, getOptionEndAdornment) => {
|
|
49
|
+
return /* @__PURE__ */ jsx(
|
|
50
|
+
MemoizedRenderOptionComponent,
|
|
51
|
+
{
|
|
52
|
+
optionProps,
|
|
53
|
+
option,
|
|
54
|
+
getOptionStartAdornment,
|
|
55
|
+
getOptionEndAdornment
|
|
56
|
+
}
|
|
57
|
+
);
|
|
58
|
+
};
|
|
22
59
|
export {
|
|
23
60
|
renderOption as r
|
|
24
61
|
};
|
|
@@ -5,9 +5,9 @@ import { I as Image } from "../../../Image/Image.js";
|
|
|
5
5
|
import { a as autocompleteSyles } from "../Autocomplete.styles.js";
|
|
6
6
|
import { A as AUTOCOMPLETE_KEY_COMPONENT } from "../constants.js";
|
|
7
7
|
import { A as AutocompleteSlots } from "./AutocompleteEnum.js";
|
|
8
|
-
import { S as Skeleton } from "../../Skeleton/Skeleton.js";
|
|
9
|
-
import { T as TextField } from "../../TextField/TextField.js";
|
|
10
8
|
import { P as Popper } from "../../Popper/Popper.js";
|
|
9
|
+
import { T as TextField } from "../../TextField/TextField.js";
|
|
10
|
+
import { S as Skeleton } from "../../Skeleton/Skeleton.js";
|
|
11
11
|
import { I as IconButton } from "../../IconButton/IconButton.js";
|
|
12
12
|
import { T as Typography } from "../../Typography/Typography.js";
|
|
13
13
|
import { C as CircularProgress } from "../../CircularProgress/CircularProgress.js";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { AutocompleteChangeReason, AutocompleteFreeSoloValueMapping, AutocompleteInputChangeReason, AutocompleteProps as MUIAutocompleteProps, Theme } from '@mui/material';
|
|
2
2
|
import { Sizes } from '@m4l/styles';
|
|
3
|
-
import { ChangeEvent, ReactElement } from 'react';
|
|
3
|
+
import { ChangeEvent, ReactElement, ReactNode } from 'react';
|
|
4
4
|
import { TextFieldProps } from '../TextField/types';
|
|
5
5
|
import { AUTOCOMPLETE_KEY_COMPONENT } from './constants';
|
|
6
6
|
import { AutocompleteSlots } from './slots';
|
|
@@ -21,6 +21,7 @@ export interface BaseAutocompleteProps {
|
|
|
21
21
|
*/
|
|
22
22
|
dataTestid?: string;
|
|
23
23
|
}
|
|
24
|
+
export type AdornmentType = ReactElement | string;
|
|
24
25
|
/**
|
|
25
26
|
* Props for the unified Autocomplete component.
|
|
26
27
|
* Supports both single and multiple selection, and two types: `text` and `image`.
|
|
@@ -47,17 +48,18 @@ export interface AutocompleteProps<T, Multiple extends boolean | undefined> exte
|
|
|
47
48
|
*/
|
|
48
49
|
value: T | T[] | null | undefined;
|
|
49
50
|
/**
|
|
51
|
+
*
|
|
50
52
|
* Function to get the label for a given option.
|
|
51
53
|
*/
|
|
52
54
|
getOptionLabel: (option: T | AutocompleteFreeSoloValueMapping<false>) => string;
|
|
53
55
|
/**
|
|
54
56
|
* Function to get the start adornment for a given option.
|
|
55
57
|
*/
|
|
56
|
-
|
|
58
|
+
getOptionStartAdornment?: (option: T) => ResourceType;
|
|
57
59
|
/**
|
|
58
60
|
* Function to get the end adornment for a given option.
|
|
59
61
|
*/
|
|
60
|
-
|
|
62
|
+
getOptionEndAdornment?: (option: T) => ResourceType;
|
|
61
63
|
/**
|
|
62
64
|
* Function to compare if an option matches the selected value.
|
|
63
65
|
*/
|
|
@@ -72,6 +74,7 @@ export interface AutocompleteProps<T, Multiple extends boolean | undefined> exte
|
|
|
72
74
|
onChangeFilterParmsLocal?: (newValue: string, reason: AutocompleteInputChangeReason) => void;
|
|
73
75
|
/**
|
|
74
76
|
* Function to get the image URL for a given option (only for `type: 'image'`).
|
|
77
|
+
* @deprecated Use getOptionStartAdornment or getOptionEndAdornment instead.
|
|
75
78
|
*/
|
|
76
79
|
getOptionUrlImage?: (option: T) => string;
|
|
77
80
|
/**
|
|
@@ -88,6 +91,10 @@ export interface AutocompleteProps<T, Multiple extends boolean | undefined> exte
|
|
|
88
91
|
*/
|
|
89
92
|
startAdornment?: ReactElement;
|
|
90
93
|
}
|
|
94
|
+
export type ResourceType = {
|
|
95
|
+
resource: ReactNode;
|
|
96
|
+
type?: 'icon' | 'image';
|
|
97
|
+
};
|
|
91
98
|
/**
|
|
92
99
|
* Represents the owner state of the Autocomplete component for styling purposes.
|
|
93
100
|
*/
|
|
@@ -17,6 +17,8 @@ const menuItemStyles = {
|
|
|
17
17
|
paddingLeft: theme.vars.size.baseSpacings.sp4,
|
|
18
18
|
paddingRight: theme.vars.size.baseSpacings.sp4,
|
|
19
19
|
borderRadius: theme.vars.size.borderRadius.r0,
|
|
20
|
+
borderLeft: theme.vars.size.borderStroke.container,
|
|
21
|
+
borderLeftColor: "transparent",
|
|
20
22
|
// Estilos base para el texto y el ícono
|
|
21
23
|
"&&& .M4LTypography-root": {
|
|
22
24
|
paddingLeft: theme.vars.size.baseSpacings.sp1,
|
|
@@ -46,10 +48,11 @@ const menuItemStyles = {
|
|
|
46
48
|
// outlineOffset: theme.vars.size.baseSpacings['sp0-5'],
|
|
47
49
|
// },
|
|
48
50
|
...ownerState?.selected && {
|
|
49
|
-
borderLeft: theme.vars.size.borderStroke.container,
|
|
50
51
|
borderLeftColor: paletteColor.enabled
|
|
51
52
|
},
|
|
52
53
|
"& .M4LImage-root": {
|
|
54
|
+
marginRight: 6,
|
|
55
|
+
marginLeft: 6,
|
|
53
56
|
...getHeightSizeStyles(
|
|
54
57
|
theme.generalSettings.isMobile,
|
|
55
58
|
ownerState?.size || "medium",
|
|
@@ -14,7 +14,10 @@ function AppearanceComponentProvider(props) {
|
|
|
14
14
|
}
|
|
15
15
|
useEffect(() => {
|
|
16
16
|
if (appearanceComponentStoreRef.current && defaultSize) {
|
|
17
|
-
appearanceComponentStoreRef.current.getState().
|
|
17
|
+
const currentStoreSize = appearanceComponentStoreRef.current.getState().defaultSize;
|
|
18
|
+
if (currentStoreSize !== defaultSize) {
|
|
19
|
+
appearanceComponentStoreRef.current.getState().actions.setDefaultSize(defaultSize);
|
|
20
|
+
}
|
|
18
21
|
}
|
|
19
22
|
}, [defaultSize]);
|
|
20
23
|
return /* @__PURE__ */ jsx(AppearanceComponentContext.Provider, { value: appearanceComponentStoreRef.current, children });
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { IGridConfigExtended } from '../../components/DataGrid';
|
|
2
2
|
/**
|
|
3
3
|
* Obtiene el sort de la cookie
|
|
4
4
|
*/
|
|
5
|
-
export declare const getColumnsConfigCookie: (cookie: Record<string, any> | undefined | Array<any>) =>
|
|
5
|
+
export declare const getColumnsConfigCookie: (cookie: Record<string, any> | undefined | Array<any>) => IGridConfigExtended["columnsConfig"];
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { UseDataGridPersistenceProps } from './types';
|
|
2
|
-
import { ChangeUserColumn,
|
|
2
|
+
import { ChangeUserColumn, IGridConfigExtended } from '../../components/DataGrid';
|
|
3
3
|
/**
|
|
4
4
|
* Hook para manejar los filtros y ordenamientos dinamicos
|
|
5
5
|
*/
|
|
6
6
|
export declare const useDataGridPersistence: (props: UseDataGridPersistenceProps) => {
|
|
7
7
|
onChangeUserColumns: (newProps: ChangeUserColumn) => void;
|
|
8
|
-
defaultUserColumns:
|
|
8
|
+
defaultUserColumns: IGridConfigExtended;
|
|
9
9
|
};
|
|
@@ -13,10 +13,15 @@ const useDataGridPersistence = (props) => {
|
|
|
13
13
|
});
|
|
14
14
|
const onChangeUserColumns = useCallback((newProps) => {
|
|
15
15
|
const { reason, userConfig } = newProps;
|
|
16
|
+
if (userConfig === void 0) {
|
|
17
|
+
return;
|
|
18
|
+
}
|
|
16
19
|
if (reason === "columnsConfig") {
|
|
17
20
|
setCookie(prefixCookie ? `${prefixCookie}_${COOKIE_COLUMNS_CONFIG}` : COOKIE_COLUMNS_CONFIG, "window", userConfig);
|
|
18
21
|
} else if (reason === "columnsWidths") {
|
|
19
22
|
setCookie(prefixCookie ? `${prefixCookie}_${COOKIE_COLUMNS_WIDTHS}` : COOKIE_COLUMNS_WIDTHS, "window", userConfig);
|
|
23
|
+
} else {
|
|
24
|
+
setCookie(prefixCookie ? `${prefixCookie}_${reason}` : reason, "window", userConfig);
|
|
20
25
|
}
|
|
21
26
|
}, [setCookie, prefixCookie]);
|
|
22
27
|
return {
|
package/index.js
CHANGED
|
@@ -35,7 +35,7 @@ import { D as D2 } from "./components/DataGrid/DataGrid.js";
|
|
|
35
35
|
import { g as g5 } from "./components/DataGrid/dictionary.js";
|
|
36
36
|
import { N, T as T2 } from "./components/DataGrid/subcomponents/editors/TextEditor/index.js";
|
|
37
37
|
import { g as g6 } from "./components/DataGrid/utils/getDataGridRowsFromSet.js";
|
|
38
|
-
import { b as b3, a as a4,
|
|
38
|
+
import { b as b3, a as a4, f } from "./components/DataGrid/constants.js";
|
|
39
39
|
import { C as C4 } from "./components/DataGrid/formatters/ColumnBooleanFormatter/formatter.js";
|
|
40
40
|
import { u as u2 } from "./components/DataGrid/formatters/ColumnBooleanFormatter/useColumnBoolean.js";
|
|
41
41
|
import { C as C5 } from "./components/DataGrid/formatters/ColumnConcatenatedValuesFormatter/formatter.js";
|
|
@@ -127,7 +127,7 @@ import { g as g18 } from "./components/formatters/dictionary.js";
|
|
|
127
127
|
import { F as F2 } from "./components/FormContainer/FormContainer.js";
|
|
128
128
|
import { G } from "./components/GridLayout/GridLayout.js";
|
|
129
129
|
import { R as R4 } from "./components/GridLayout/subcomponents/Responsive/index.js";
|
|
130
|
-
import { c as c2, e
|
|
130
|
+
import { c as c2, e, d as d3 } from "./components/GridLayout/subcomponents/Responsive/responsiveUtils.js";
|
|
131
131
|
import { i, k } from "./components/GridLayout/utils.js";
|
|
132
132
|
import { w } from "./components/GridLayout/subcomponents/withSizeProvider/index.js";
|
|
133
133
|
import { H as H2 } from "./components/HelmetPage/index.js";
|
|
@@ -208,7 +208,7 @@ import { S as S17 } from "./components/Stepper/subcomponents/StepperButtons/Step
|
|
|
208
208
|
import { S as S18 } from "./components/Stepper/subcomponents/StepperButtons/StepperPrevButton/index.js";
|
|
209
209
|
import { S as S19 } from "./components/Stepper/subcomponents/StepperButtons/StepperCancelButton/index.js";
|
|
210
210
|
import { S as S20 } from "./components/Stepper/subcomponents/StepperButtons/StepperSubmitButton/index.js";
|
|
211
|
-
import { e as
|
|
211
|
+
import { e as e2 } from "./components/Stepper/helpers/evaluateVisibilityStepCondition/index.js";
|
|
212
212
|
import { g as g29 } from "./components/Stepper/dictionary.js";
|
|
213
213
|
import { F as F3, R as R23, u as u18 } from "./components/hook-form/RHFormContext/index.js";
|
|
214
214
|
import { g as g30 } from "./components/hook-form/RHFormContext/dictionary.js";
|
|
@@ -240,7 +240,7 @@ import { g as g35 } from "./utils/getIconColor.js";
|
|
|
240
240
|
import { a as a16, g as g36 } from "./utils/getSizeStyles/getSizeStyles.js";
|
|
241
241
|
import { O as O2 } from "./utils/ObjectQueue.js";
|
|
242
242
|
import { g as g37, a as a17 } from "./utils/getComponentSlotRoot.js";
|
|
243
|
-
import { f } from "./utils/formatDistanceToNow/formatDistanteToNow.js";
|
|
243
|
+
import { f as f2 } from "./utils/formatDistanceToNow/formatDistanteToNow.js";
|
|
244
244
|
import { g as g38 } from "./utils/getValidDate.js";
|
|
245
245
|
import { g as g39 } from "./utils/getNullGuard.js";
|
|
246
246
|
import { c as c5, d as d4 } from "./utils/deepShallow.js";
|
|
@@ -290,7 +290,7 @@ export {
|
|
|
290
290
|
C3 as ContainerFlow,
|
|
291
291
|
b3 as DATAGRID_ROW_HEADER_HEIGHTS,
|
|
292
292
|
a4 as DATAGRID_ROW_HEIGHTS,
|
|
293
|
-
|
|
293
|
+
f as DATAGRID_SEMANTIC_WIDTHS,
|
|
294
294
|
D as DICTIONARY,
|
|
295
295
|
D2 as DataGrid,
|
|
296
296
|
D8 as DateFormatter,
|
|
@@ -430,7 +430,7 @@ export {
|
|
|
430
430
|
W3 as WindowToolsMFContext,
|
|
431
431
|
a12 as WindowToolsMFProvider,
|
|
432
432
|
c2 as addLayoutItemToBreakPointIfNoExists,
|
|
433
|
-
|
|
433
|
+
e as addLayoutItemToBreakPoints,
|
|
434
434
|
c4 as capitalizeFirstLetter,
|
|
435
435
|
d3 as cloneLayouts,
|
|
436
436
|
c5 as createCustomDeepShallow,
|
|
@@ -439,8 +439,8 @@ export {
|
|
|
439
439
|
d4 as deepShallow,
|
|
440
440
|
d as defaultCommonActionsDictionary,
|
|
441
441
|
d2 as dragResizeWindowRNDClasses,
|
|
442
|
-
|
|
443
|
-
|
|
442
|
+
e2 as evaluateVisibilityStepCondition,
|
|
443
|
+
f2 as formatDistanceToNow,
|
|
444
444
|
g as getAccountPopoverDictionary,
|
|
445
445
|
g2 as getAppBarDictionary,
|
|
446
446
|
b2 as getAreasComponentsDictionary,
|
package/package.json
CHANGED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import { jsxs, jsx } from "react/jsx-runtime";
|
|
2
|
-
import { useThemeSettingsStore } from "@m4l/graphics";
|
|
3
|
-
import { P as PATH_ICONS } from "../../icons.js";
|
|
4
|
-
import { useEnvironment } from "@m4l/core";
|
|
5
|
-
import { S as Stack } from "../../../mui_extended/Stack/Stack.js";
|
|
6
|
-
import { I as IconButton } from "../../../mui_extended/IconButton/IconButton.js";
|
|
7
|
-
import { L as LanguagePopover } from "../../../LanguagePopover/LanguagePopover.js";
|
|
8
|
-
function AppBarSettings() {
|
|
9
|
-
const handleOpen = useThemeSettingsStore((state) => state.settingsActions.handleOpen);
|
|
10
|
-
const { host_static_assets, environment_assets } = useEnvironment();
|
|
11
|
-
return /* @__PURE__ */ jsxs(Stack, { width: "100%", height: "40px", justifyContent: "space-between", flexDirection: "row", overflow: "hidden", position: "relative", padding: [0, 2], children: [
|
|
12
|
-
/* @__PURE__ */ jsx(Stack, { width: "100%", height: "100%" }),
|
|
13
|
-
/* @__PURE__ */ jsxs(Stack, { flexDirection: "row", gap: 2, height: "100%", width: "auto", alignItems: "center", children: [
|
|
14
|
-
/* @__PURE__ */ jsx(LanguagePopover, {}),
|
|
15
|
-
/* @__PURE__ */ jsx(IconButton, { src: `${host_static_assets}/${environment_assets}/${PATH_ICONS.SETTINGS}`, onClick: handleOpen })
|
|
16
|
-
] })
|
|
17
|
-
] });
|
|
18
|
-
}
|
|
19
|
-
export {
|
|
20
|
-
AppBarSettings as A
|
|
21
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { AppBarSettings } from './AppBarSettings';
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
|