@m4l/components 9.3.37-JT20251128-beta.2 → 9.3.38
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 +16 -0
- package/components/CommonActions/components/ActionCancel/slots/ActionsCancelSlots.d.ts +1 -1
- package/components/CommonActions/components/ActionFormCancel/slots/ActionFormCancelSlots.d.ts +1 -1
- package/components/CommonActions/components/ActionIntro/slots/ActionsIntroSlots.d.ts +1 -1
- package/components/DataGrid/contexts/DataGridContext/index.js +268 -41
- package/components/DataGrid/contexts/DataGridContext/types.d.ts +20 -3
- package/components/DataGrid/index.d.ts +4 -5
- package/components/EditLabel/slots/EditLabelSlots.d.ts +1 -1
- package/components/LoadingError/LoadingError.js +1 -1
- package/components/ModalDialog/slots/ModalDialogSlots.d.ts +1 -1
- package/components/PropertyValue/PropertyValue.js +1 -1
- package/components/SettingsLayout/slots/SettingsLayoutSlots.d.ts +1 -1
- package/components/Stepper/subcomponents/StepperButtons/StepperSubmitButton/index.js +1 -1
- package/components/areas/components/AreasAdmin/slots/AreasAdminSlots.d.ts +1 -1
- package/components/formatters/ImageFormatter/slots/ImageFormatterSlots.js +1 -1
- package/components/hook-form/RHFCheckbox/slots/RHFCheckBoxSlots.d.ts +1 -1
- package/components/hook-form/RHFColorPicker/slots/RHFColorPickerSlots.js +1 -1
- package/components/hook-form/RHFDatePicker/RHFDatePicker.d.ts +7 -0
- package/components/hook-form/RHFDatePicker/RHFDatePicker.js +85 -0
- package/components/hook-form/RHFDatePicker/RHFDatePicker.styles.d.ts +5 -0
- package/components/hook-form/RHFDatePicker/RHFDatePicker.styles.js +200 -0
- package/components/hook-form/RHFDatePicker/constants.d.ts +4 -0
- package/components/hook-form/RHFDatePicker/constants.js +4 -0
- package/components/hook-form/RHFDatePicker/icons.d.ts +6 -0
- package/components/hook-form/RHFDatePicker/index.d.ts +1 -0
- package/components/hook-form/RHFDatePicker/slots/RHFDatePickerEnum.d.ts +11 -0
- package/components/hook-form/RHFDatePicker/slots/RHFDatePickerEnum.js +15 -0
- package/components/hook-form/RHFDatePicker/slots/RHFDatePickerSlots.d.ts +50 -0
- package/components/hook-form/RHFDatePicker/slots/RHFDatePickerSlots.js +44 -0
- package/components/hook-form/RHFDatePicker/slots/index.d.ts +2 -0
- package/components/hook-form/RHFDatePicker/types.d.ts +61 -0
- package/components/hook-form/RHFDateTime/RHFDateTime.d.ts +24 -1
- package/components/hook-form/RHFDateTimePicker/RHFDateTimePicker.d.ts +11 -0
- package/components/hook-form/RHFDateTimePicker/RHFDateTimePicker.js +8 -0
- package/components/hook-form/RHFDateTimePicker/index.d.ts +1 -0
- package/components/hook-form/RHFPeriod/slots/RHFPeriodSlots.d.ts +1 -1
- package/components/hook-form/RHFSelect/slots/RHFSlots.d.ts +1 -1
- package/components/hook-form/RHFTextField/slots/RHFTextFieldSlots.d.ts +1 -1
- package/components/hook-form/RHFTextFieldPassword/slots/RHFTextFieldPasswordSlots.d.ts +1 -1
- package/components/hook-form/RHFUpload/RHFUploadImage/slots/RHFUploadImageSlots.d.ts +1 -1
- package/components/hook-form/RHFUpload/RHFUploadSingleFile/slots/RHFUploadSingleFileSlots.d.ts +1 -1
- package/components/hook-form/index.d.ts +2 -0
- package/components/mui_extended/Autocomplete/slots/AutocompleteSlots.d.ts +1 -1
- package/components/mui_extended/Autocomplete/slots/AutocompleteSlots.js +1 -1
- package/components/mui_extended/Button/slots/ButtonSlots.d.ts +1 -1
- package/components/mui_extended/DatePicker/DatePicker.d.ts +7 -0
- package/components/mui_extended/DatePicker/DatePicker.js +39 -0
- package/components/mui_extended/DatePicker/DatePicker.styles.d.ts +5 -0
- package/components/mui_extended/DatePicker/DatePicker.styles.js +193 -0
- package/components/mui_extended/DatePicker/constants.d.ts +2 -0
- package/components/mui_extended/DatePicker/constants.js +8 -0
- package/components/mui_extended/DatePicker/hooks/useDatePicker/types.d.ts +11 -0
- package/components/mui_extended/DatePicker/hooks/useDatePicker/useDatePicker.d.ts +9 -0
- package/components/mui_extended/DatePicker/hooks/useDatePicker/useDatePicker.js +200 -0
- package/components/mui_extended/DatePicker/icons.d.ts +4 -0
- package/components/mui_extended/DatePicker/icons.js +10 -0
- package/components/mui_extended/DatePicker/index.d.ts +2 -0
- package/components/mui_extended/DatePicker/slots/DatePickerEnum.d.ts +10 -0
- package/components/mui_extended/DatePicker/slots/DatePickerEnum.js +14 -0
- package/components/mui_extended/DatePicker/slots/DatePickerSlots.d.ts +44 -0
- package/components/mui_extended/DatePicker/slots/DatePickerSlots.js +46 -0
- package/components/mui_extended/DatePicker/types.d.ts +32 -0
- package/components/mui_extended/LoadingButton/slots/LoadingButtonSlots.d.ts +1 -1
- package/components/mui_extended/NavLink/constants.d.ts +1 -1
- package/components/mui_extended/Select/slots/SelectSlots.d.ts +1 -1
- package/components/mui_extended/Select/slots/SelectSlots.js +1 -1
- package/components/mui_extended/TextField/TextField.js +2 -2
- package/components/mui_extended/TextField/TextField.styles.js +1 -1
- package/components/mui_extended/TextField/slots/TextFieldSlots.d.ts +1 -1
- package/components/mui_extended/ToggleButton/slots/ToggleButtonSlots.d.ts +1 -1
- package/components/mui_extended/index.d.ts +1 -0
- package/hooks/useDataGridPersistence/constants.d.ts +0 -1
- package/hooks/useDataGridPersistence/constants.js +2 -4
- package/hooks/useDataGridPersistence/useDataGridPersistence.js +2 -5
- package/index.js +46 -40
- package/package.json +1 -1
- package/components/DataGrid/helpers/getAllViewModes/getAllViewModes.d.ts +0 -19
- package/components/DataGrid/helpers/getAllViewModes/getAllViewModes.js +0 -6
- package/components/DataGrid/helpers/getAllViewModes/index.d.ts +0 -1
- package/components/DataGrid/helpers/getColumnsWidth/getColumnsWidth.d.ts +0 -47
- package/components/DataGrid/helpers/getColumnsWidth/getColumnsWidth.js +0 -32
- package/components/DataGrid/helpers/getColumnsWidth/index.d.ts +0 -1
- package/components/DataGrid/helpers/getIndexRowHeightVariant/getIndexRowHeightVariant.d.ts +0 -24
- package/components/DataGrid/helpers/getIndexRowHeightVariant/getIndexRowHeightVariant.js +0 -12
- package/components/DataGrid/helpers/getIndexRowHeightVariant/getIndexRowHeightVariant.test.d.ts +0 -1
- package/components/DataGrid/helpers/getIndexRowHeightVariant/index.d.ts +0 -1
- package/components/DataGrid/helpers/getInitialColumnsConfig/getInitialColumnsConfig.d.ts +0 -48
- package/components/DataGrid/helpers/getInitialColumnsConfig/getInitialColumnsConfig.js +0 -35
- package/components/DataGrid/helpers/getInitialColumnsConfig/getInitialColumnsConfig.test.d.ts +0 -1
- package/components/DataGrid/helpers/getInitialColumnsConfig/index.d.ts +0 -1
- package/components/DataGrid/helpers/getViewMode/getViewMode.d.ts +0 -41
- package/components/DataGrid/helpers/getViewMode/getViewMode.js +0 -19
- package/components/DataGrid/helpers/getViewMode/getViewMode.test.d.ts +0 -1
- package/components/DataGrid/helpers/getViewMode/index.d.ts +0 -1
- package/components/DataGrid/helpers/getViewSpecificConfig/getViewSpecificConfig.d.ts +0 -28
- package/components/DataGrid/helpers/getViewSpecificConfig/getViewSpecificConfig.js +0 -22
- package/components/DataGrid/helpers/getViewSpecificConfig/getViewSpecificConfig.test.d.ts +0 -1
- package/components/DataGrid/helpers/getViewSpecificConfig/index.d.ts +0 -1
- package/components/DataGrid/helpers/getViewSpecificConfig/index.js +0 -1
- package/components/DataGrid/helpers/getViewSuffix/getViewSuffix.d.ts +0 -24
- package/components/DataGrid/helpers/getViewSuffix/getViewSuffix.js +0 -9
- package/components/DataGrid/helpers/getViewSuffix/getViewSuffix.test.d.ts +0 -1
- package/components/DataGrid/helpers/getViewSuffix/index.d.ts +0 -1
- package/components/DataGrid/helpers/getViewSuffix/index.js +0 -1
- package/components/DataGrid/helpers/index.d.ts +0 -13
- package/components/DataGrid/helpers/index.js +0 -1
- package/components/DataGrid/helpers/loadViewConfig/index.d.ts +0 -1
- package/components/DataGrid/helpers/loadViewConfig/index.js +0 -1
- package/components/DataGrid/helpers/loadViewConfig/loadViewConfig.d.ts +0 -23
- package/components/DataGrid/helpers/loadViewConfig/loadViewConfig.js +0 -12
- package/components/DataGrid/helpers/loadViewConfig/loadViewConfig.test.d.ts +0 -1
- package/components/DataGrid/helpers/saveColumnsWidth/index.d.ts +0 -1
- package/components/DataGrid/helpers/saveColumnsWidth/index.js +0 -1
- package/components/DataGrid/helpers/saveColumnsWidth/saveColumnsWidth.d.ts +0 -52
- package/components/DataGrid/helpers/saveColumnsWidth/saveColumnsWidth.js +0 -18
- package/components/DataGrid/helpers/saveColumnsWidth/saveColumnsWidth.test.d.ts +0 -1
- package/components/DataGrid/helpers/saveViewConfig/index.d.ts +0 -1
- package/components/DataGrid/helpers/saveViewConfig/index.js +0 -1
- package/components/DataGrid/helpers/saveViewConfig/saveViewConfig.d.ts +0 -35
- package/components/DataGrid/helpers/saveViewConfig/saveViewConfig.js +0 -15
- package/components/DataGrid/helpers/saveViewConfig/saveViewConfig.test.d.ts +0 -1
- package/components/DataGrid/helpers/saveViewMode/index.d.ts +0 -1
- package/components/DataGrid/helpers/saveViewMode/index.js +0 -1
- package/components/DataGrid/helpers/saveViewMode/saveViewMode.d.ts +0 -33
- package/components/DataGrid/helpers/saveViewMode/saveViewMode.js +0 -13
- package/components/DataGrid/helpers/saveViewMode/saveViewMode.test.d.ts +0 -1
- package/components/DataGrid/hooks/index.d.ts +0 -6
- package/components/DataGrid/hooks/index.js +0 -1
- package/components/DataGrid/hooks/useChangeColumnsConfig/index.d.ts +0 -1
- package/components/DataGrid/hooks/useChangeColumnsConfig/index.js +0 -1
- package/components/DataGrid/hooks/useChangeColumnsConfig/useChangeColumnsConfig.d.ts +0 -9
- package/components/DataGrid/hooks/useChangeColumnsConfig/useChangeColumnsConfig.js +0 -27
- package/components/DataGrid/hooks/useChangeColumnsConfig/useChangeColumnsConfig.test.d.ts +0 -1
- package/components/DataGrid/hooks/useChangeColumnsOrder/index.d.ts +0 -1
- package/components/DataGrid/hooks/useChangeColumnsOrder/index.js +0 -1
- package/components/DataGrid/hooks/useChangeColumnsOrder/useChangeColumnsOrder.d.ts +0 -10
- package/components/DataGrid/hooks/useChangeColumnsOrder/useChangeColumnsOrder.js +0 -34
- package/components/DataGrid/hooks/useChangeColumnsOrder/useChangeColumnsOrder.test.d.ts +0 -1
- package/components/DataGrid/hooks/useColumnsWidth/index.d.ts +0 -1
- package/components/DataGrid/hooks/useColumnsWidth/index.js +0 -1
- package/components/DataGrid/hooks/useColumnsWidth/useColumnsWidth.d.ts +0 -11
- package/components/DataGrid/hooks/useColumnsWidth/useColumnsWidth.js +0 -29
- package/components/DataGrid/hooks/useColumnsWidth/useColumnsWidth.test.d.ts +0 -1
- package/components/DataGrid/hooks/useRowHeight/index.d.ts +0 -1
- package/components/DataGrid/hooks/useRowHeight/index.js +0 -1
- package/components/DataGrid/hooks/useRowHeight/useRowHeight.d.ts +0 -28
- package/components/DataGrid/hooks/useRowHeight/useRowHeight.js +0 -51
- package/components/DataGrid/hooks/useRowHeight/useRowHeight.test.d.ts +0 -1
- package/components/DataGrid/hooks/useViewConfig/index.d.ts +0 -1
- package/components/DataGrid/hooks/useViewConfig/index.js +0 -1
- package/components/DataGrid/hooks/useViewConfig/useViewConfig.d.ts +0 -9
- package/components/DataGrid/hooks/useViewConfig/useViewConfig.js +0 -30
- package/components/DataGrid/hooks/useViewConfig/useViewConfig.test.d.ts +0 -1
- package/components/DataGrid/hooks/useViewMode/index.d.ts +0 -1
- package/components/DataGrid/hooks/useViewMode/index.js +0 -1
- package/components/DataGrid/hooks/useViewMode/useViewMode.d.ts +0 -31
- package/components/DataGrid/hooks/useViewMode/useViewMode.js +0 -44
- package/components/DataGrid/hooks/useViewMode/useViewMode.test.d.ts +0 -1
- package/components/DataGrid/types.helpers.d.ts +0 -55
- package/components/DataGrid/types.helpers.js +0 -1
- package/components/DataGrid/types.hooks.d.ts +0 -81
- /package/components/{DataGrid/helpers/getAllViewModes/getAllViewModes.test.d.ts → hook-form/RHFDatePicker/__tests__/RHFDatePicker.test.d.ts} +0 -0
- /package/components/{DataGrid/helpers/getAllViewModes → hook-form/RHFDatePicker}/index.js +0 -0
- /package/components/{DataGrid/helpers/getColumnsWidth → hook-form/RHFDatePicker/slots}/index.js +0 -0
- /package/components/{DataGrid/helpers/getIndexRowHeightVariant → hook-form/RHFDateTimePicker}/index.js +0 -0
- /package/components/{DataGrid/helpers/getColumnsWidth/getColumnsWidth.test.d.ts → mui_extended/DatePicker/__tests__/DatePicker.test.d.ts} +0 -0
- /package/components/{DataGrid/helpers/getInitialColumnsConfig → mui_extended/DatePicker}/index.js +0 -0
- /package/components/{DataGrid/helpers/getViewMode → mui_extended/LoadingButton}/index.js +0 -0
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
import { useCallback } from "react";
|
|
2
|
-
const useChangeColumnsOrder = ({
|
|
3
|
-
getConfigColumns,
|
|
4
|
-
onChangeColumnsConfig
|
|
5
|
-
}) => {
|
|
6
|
-
const onChangeColumnsOrder = useCallback(
|
|
7
|
-
(viewModeParam, sourceKey, targetKey) => {
|
|
8
|
-
if (sourceKey === targetKey) {
|
|
9
|
-
return;
|
|
10
|
-
}
|
|
11
|
-
const currentConfig = getConfigColumns(viewModeParam);
|
|
12
|
-
const sourceColumnIndex = currentConfig.findIndex(
|
|
13
|
-
(c) => c.key === sourceKey
|
|
14
|
-
);
|
|
15
|
-
const targetColumnIndex = currentConfig.findIndex(
|
|
16
|
-
(c) => c.key === targetKey
|
|
17
|
-
);
|
|
18
|
-
const reorderedConfig = [...currentConfig];
|
|
19
|
-
reorderedConfig.splice(
|
|
20
|
-
targetColumnIndex,
|
|
21
|
-
0,
|
|
22
|
-
reorderedConfig.splice(sourceColumnIndex, 1)[0]
|
|
23
|
-
);
|
|
24
|
-
onChangeColumnsConfig(viewModeParam, reorderedConfig);
|
|
25
|
-
},
|
|
26
|
-
[getConfigColumns, onChangeColumnsConfig]
|
|
27
|
-
);
|
|
28
|
-
return {
|
|
29
|
-
onChangeColumnsOrder
|
|
30
|
-
};
|
|
31
|
-
};
|
|
32
|
-
export {
|
|
33
|
-
useChangeColumnsOrder as u
|
|
34
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { useColumnsWidth } from './useColumnsWidth';
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { UseColumnsWidthParams, UseColumnsWidthReturn } from '../../types.hooks';
|
|
2
|
-
/**
|
|
3
|
-
* Hook para manejar el estado del ancho de las columnas del DataGrid.
|
|
4
|
-
*
|
|
5
|
-
* Maneja:
|
|
6
|
-
* - Estado del ancho de cada columna
|
|
7
|
-
* - Guardado con debounce de 500ms al cambiar el ancho
|
|
8
|
-
* @param params - Parámetros del hook
|
|
9
|
-
* @returns Estado y función para cambiar el ancho de columnas
|
|
10
|
-
*/
|
|
11
|
-
export declare const useColumnsWidth: ({ id, onChangeUserColumns, }: UseColumnsWidthParams) => UseColumnsWidthReturn;
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import { useState, useRef, useCallback } from "react";
|
|
2
|
-
import { s as saveColumnsWidth } from "../../helpers/saveColumnsWidth/saveColumnsWidth.js";
|
|
3
|
-
const useColumnsWidth = ({
|
|
4
|
-
id,
|
|
5
|
-
onChangeUserColumns
|
|
6
|
-
}) => {
|
|
7
|
-
const [columnsWidths, setColumnsWidths] = useState(/* @__PURE__ */ new Map());
|
|
8
|
-
const timerRef = useRef(null);
|
|
9
|
-
const onChangeColumnWidth = useCallback(
|
|
10
|
-
(columnKey, width) => {
|
|
11
|
-
columnsWidths.set(columnKey, Math.round(width));
|
|
12
|
-
if (timerRef.current) {
|
|
13
|
-
clearTimeout(timerRef.current);
|
|
14
|
-
}
|
|
15
|
-
timerRef.current = setTimeout(() => {
|
|
16
|
-
saveColumnsWidth(id, columnsWidths, onChangeUserColumns);
|
|
17
|
-
}, 500);
|
|
18
|
-
},
|
|
19
|
-
[id, columnsWidths, onChangeUserColumns]
|
|
20
|
-
);
|
|
21
|
-
return {
|
|
22
|
-
columnsWidths,
|
|
23
|
-
setColumnsWidths,
|
|
24
|
-
onChangeColumnWidth
|
|
25
|
-
};
|
|
26
|
-
};
|
|
27
|
-
export {
|
|
28
|
-
useColumnsWidth as u
|
|
29
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { useRowHeight } from './useRowHeight';
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import { UseRowHeightParams, UseRowHeightReturn } from '../../types.hooks';
|
|
2
|
-
/**
|
|
3
|
-
* Hook para manejar el estado de la altura de las filas del DataGrid.
|
|
4
|
-
*
|
|
5
|
-
* Soporta dos modos:
|
|
6
|
-
* - **Modo fijo**: rowHeights y rowHeaderHeights son números fijos
|
|
7
|
-
* - **Modo variable**: rowHeights y rowHeaderHeights son arrays de 3 elementos [compact, standard, confortable]
|
|
8
|
-
* @param params - Parámetros del hook
|
|
9
|
-
* @returns Estado actual y función para cambiar el variant
|
|
10
|
-
* @throws Error si rowHeights y rowHeaderHeights no son del mismo tipo
|
|
11
|
-
* @throws Error si los arrays no tienen exactamente 3 elementos
|
|
12
|
-
* @throws Error si se intenta cambiar el variant en modo fijo
|
|
13
|
-
* @example
|
|
14
|
-
* // Modo variable (permite cambiar variant)
|
|
15
|
-
* const { currentRowHeightVariant, setRowHeightVariant } = useRowHeight({
|
|
16
|
-
* rowHeights: [32, 40, 48],
|
|
17
|
-
* rowHeaderHeights: [36, 44, 52],
|
|
18
|
-
* initialRowHeightVariant: 'standard',
|
|
19
|
-
* });
|
|
20
|
-
*
|
|
21
|
-
* // Modo fijo (altura constante)
|
|
22
|
-
* const { currentRowHeightVariant } = useRowHeight({
|
|
23
|
-
* rowHeights: 40,
|
|
24
|
-
* rowHeaderHeights: 44,
|
|
25
|
-
* initialRowHeightVariant: 'standard',
|
|
26
|
-
* });
|
|
27
|
-
*/
|
|
28
|
-
export declare const useRowHeight: ({ rowHeights, rowHeaderHeights, initialRowHeightVariant, }: UseRowHeightParams) => UseRowHeightReturn;
|
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
import { useState, useCallback } from "react";
|
|
2
|
-
import { g as getIndexRowHeightVariant } from "../../helpers/getIndexRowHeightVariant/getIndexRowHeightVariant.js";
|
|
3
|
-
const useRowHeight = ({
|
|
4
|
-
rowHeights,
|
|
5
|
-
rowHeaderHeights,
|
|
6
|
-
initialRowHeightVariant
|
|
7
|
-
}) => {
|
|
8
|
-
const [currentRowHeightVariant, setCurrentRowHeightVariant] = useState(() => {
|
|
9
|
-
if (typeof rowHeights !== typeof rowHeaderHeights) {
|
|
10
|
-
throw new Error("Must be same type rowheights and rowHeaderTypes");
|
|
11
|
-
}
|
|
12
|
-
if (typeof rowHeights === "number" && typeof rowHeaderHeights === "number") {
|
|
13
|
-
return {
|
|
14
|
-
rowHVariant: "compact",
|
|
15
|
-
rowHeight: rowHeights,
|
|
16
|
-
rowHeaderHeight: rowHeaderHeights
|
|
17
|
-
};
|
|
18
|
-
}
|
|
19
|
-
if (typeof rowHeights !== "number" && rowHeights.length !== 3) {
|
|
20
|
-
throw new Error("Must be 3 heights");
|
|
21
|
-
}
|
|
22
|
-
if (typeof rowHeaderHeights !== "number" && rowHeaderHeights.length !== 3) {
|
|
23
|
-
throw new Error("Must be 3 HeaderHeights");
|
|
24
|
-
}
|
|
25
|
-
return {
|
|
26
|
-
rowHVariant: initialRowHeightVariant,
|
|
27
|
-
rowHeight: typeof rowHeights !== "number" ? rowHeights[getIndexRowHeightVariant(initialRowHeightVariant)] : rowHeights,
|
|
28
|
-
rowHeaderHeight: typeof rowHeaderHeights !== "number" ? rowHeaderHeights[getIndexRowHeightVariant(initialRowHeightVariant)] : rowHeaderHeights
|
|
29
|
-
};
|
|
30
|
-
});
|
|
31
|
-
const setRowHeightVariant = useCallback(
|
|
32
|
-
(newVariant) => {
|
|
33
|
-
if (typeof rowHeights === "number" || typeof rowHeaderHeights === "number") {
|
|
34
|
-
throw new Error("Only use setCurrentRowHeight with vector rowHeights");
|
|
35
|
-
}
|
|
36
|
-
setCurrentRowHeightVariant({
|
|
37
|
-
rowHVariant: newVariant,
|
|
38
|
-
rowHeight: rowHeights[getIndexRowHeightVariant(newVariant)],
|
|
39
|
-
rowHeaderHeight: rowHeaderHeights[getIndexRowHeightVariant(newVariant)]
|
|
40
|
-
});
|
|
41
|
-
},
|
|
42
|
-
[rowHeights, rowHeaderHeights]
|
|
43
|
-
);
|
|
44
|
-
return {
|
|
45
|
-
currentRowHeightVariant,
|
|
46
|
-
setRowHeightVariant
|
|
47
|
-
};
|
|
48
|
-
};
|
|
49
|
-
export {
|
|
50
|
-
useRowHeight as u
|
|
51
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { useViewConfig } from './useViewConfig';
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { UseViewConfigReturn } from '../../types.hooks';
|
|
2
|
-
/**
|
|
3
|
-
* Hook para manejar el estado de la configuración de columnas por vista.
|
|
4
|
-
*
|
|
5
|
-
* Maneja un estado genérico unificado para las configuraciones de TODAS las vistas
|
|
6
|
-
* (table, cards, etc).
|
|
7
|
-
* @returns Estado y funciones para manejar la configuración de vistas
|
|
8
|
-
*/
|
|
9
|
-
export declare const useViewConfig: () => UseViewConfigReturn;
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
import { useState, useCallback } from "react";
|
|
2
|
-
const useViewConfig = () => {
|
|
3
|
-
const [viewConfig, setViewConfig] = useState(() => ({
|
|
4
|
-
table: [],
|
|
5
|
-
cards: []
|
|
6
|
-
}));
|
|
7
|
-
const getConfigColumns = useCallback(
|
|
8
|
-
(viewModeParam) => {
|
|
9
|
-
return viewConfig[viewModeParam];
|
|
10
|
-
},
|
|
11
|
-
[viewConfig]
|
|
12
|
-
);
|
|
13
|
-
const updateConfigColumns = useCallback(
|
|
14
|
-
(viewModeParam, config) => {
|
|
15
|
-
setViewConfig((prev) => ({
|
|
16
|
-
...prev,
|
|
17
|
-
[viewModeParam]: config
|
|
18
|
-
}));
|
|
19
|
-
},
|
|
20
|
-
[]
|
|
21
|
-
);
|
|
22
|
-
return {
|
|
23
|
-
viewConfig,
|
|
24
|
-
getConfigColumns,
|
|
25
|
-
updateConfigColumns
|
|
26
|
-
};
|
|
27
|
-
};
|
|
28
|
-
export {
|
|
29
|
-
useViewConfig as u
|
|
30
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { useViewMode } from './useViewMode';
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
import { UseViewModeParams, UseViewModeReturn } from '../../types.hooks';
|
|
2
|
-
/**
|
|
3
|
-
* Hook para manejar el estado del modo de visualización (table/cards).
|
|
4
|
-
*
|
|
5
|
-
* ## Inicialización del viewMode
|
|
6
|
-
*
|
|
7
|
-
* El viewMode se inicializa siguiendo esta jerarquía de precedencia:
|
|
8
|
-
* 1. viewMode prop (modo controlado)
|
|
9
|
-
* 2. localStorage (configuración guardada localmente)
|
|
10
|
-
* 3. defaultViewMode (valor por defecto del desarrollador)
|
|
11
|
-
* 4. Fallback según dispositivo (mobile: 'cards', desktop: 'table')
|
|
12
|
-
*
|
|
13
|
-
* ## Persistencia del viewMode
|
|
14
|
-
*
|
|
15
|
-
* - Si `onChangeUserColumns` está definido → Guarda en backend (cookies de red)
|
|
16
|
-
* - Si no está definido → Fallback a localStorage
|
|
17
|
-
*
|
|
18
|
-
* ## Modo controlado vs no controlado
|
|
19
|
-
*
|
|
20
|
-
* - **Controlado**: Cuando se pasa `viewMode` prop, el padre controla el estado
|
|
21
|
-
* - **No controlado**: El hook maneja internamente el estado y persiste
|
|
22
|
-
* @param id - Identificador único del DataGrid
|
|
23
|
-
* @param viewMode - ViewMode controlado por el padre (opcional)
|
|
24
|
-
* @param defaultViewMode - ViewMode por defecto cuando no hay valor guardado
|
|
25
|
-
* @param onViewModeChange - Callback cuando cambia el viewMode (opcional)
|
|
26
|
-
* @param onChangeUserColumns - Callback para guardar en backend (opcional)
|
|
27
|
-
* @returns viewModeState - Estado actual del viewMode
|
|
28
|
-
* @returns setViewModeState - Función para establecer el viewMode
|
|
29
|
-
* @returns handleViewModeChange - Función para cambiar el viewMode y persistirlo
|
|
30
|
-
*/
|
|
31
|
-
export declare const useViewMode: ({ id, viewMode, defaultViewMode, onViewModeChange, onChangeUserColumns, }: UseViewModeParams) => UseViewModeReturn;
|
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
import { useState, useCallback, useEffect } from "react";
|
|
2
|
-
import { useIsMobile } from "@m4l/graphics";
|
|
3
|
-
import { g as getViewMode } from "../../helpers/getViewMode/getViewMode.js";
|
|
4
|
-
import { s as saveViewMode } from "../../helpers/saveViewMode/saveViewMode.js";
|
|
5
|
-
const useViewMode = ({
|
|
6
|
-
id,
|
|
7
|
-
viewMode,
|
|
8
|
-
defaultViewMode,
|
|
9
|
-
onViewModeChange,
|
|
10
|
-
onChangeUserColumns
|
|
11
|
-
}) => {
|
|
12
|
-
const isMobile = useIsMobile();
|
|
13
|
-
const [viewModeState, setViewModeState] = useState(() => {
|
|
14
|
-
if (viewMode) {
|
|
15
|
-
return viewMode;
|
|
16
|
-
}
|
|
17
|
-
const savedViewMode = getViewMode(id, null, defaultViewMode);
|
|
18
|
-
if (savedViewMode) {
|
|
19
|
-
return savedViewMode;
|
|
20
|
-
}
|
|
21
|
-
return isMobile ? "cards" : "table";
|
|
22
|
-
});
|
|
23
|
-
const handleViewModeChange = useCallback(
|
|
24
|
-
(newViewMode) => {
|
|
25
|
-
setViewModeState(newViewMode);
|
|
26
|
-
saveViewMode(id, newViewMode, onChangeUserColumns);
|
|
27
|
-
onViewModeChange?.(newViewMode);
|
|
28
|
-
},
|
|
29
|
-
[id, onViewModeChange, onChangeUserColumns]
|
|
30
|
-
);
|
|
31
|
-
useEffect(() => {
|
|
32
|
-
if (viewMode !== void 0) {
|
|
33
|
-
setViewModeState(viewMode);
|
|
34
|
-
}
|
|
35
|
-
}, [viewMode]);
|
|
36
|
-
return {
|
|
37
|
-
viewModeState,
|
|
38
|
-
setViewModeState,
|
|
39
|
-
handleViewModeChange
|
|
40
|
-
};
|
|
41
|
-
};
|
|
42
|
-
export {
|
|
43
|
-
useViewMode as u
|
|
44
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
import { RowKey } from './types';
|
|
2
|
-
import { BaseConfigColumn } from './contexts/DataGridContext/types';
|
|
3
|
-
/**
|
|
4
|
-
* Configuración base genérica que puede extenderse con propiedades específicas de cualquier vista.
|
|
5
|
-
*
|
|
6
|
-
* USO INTERNO: El sistema usa esto para manejar genéricamente las configuraciones
|
|
7
|
-
* de columnas sin importar el tipo de vista (table, cards, etc).
|
|
8
|
-
* @example
|
|
9
|
-
* // Para vista table
|
|
10
|
-
* BaseViewConfig<{ frozen: boolean }>
|
|
11
|
-
*
|
|
12
|
-
* // Para vista cards
|
|
13
|
-
* BaseViewConfig<{ showTitle: boolean }>
|
|
14
|
-
*/
|
|
15
|
-
export type BaseViewConfig<TViewSpecific = object> = TViewSpecific & {
|
|
16
|
-
key: string;
|
|
17
|
-
visible: boolean;
|
|
18
|
-
index: number;
|
|
19
|
-
name?: string;
|
|
20
|
-
};
|
|
21
|
-
/**
|
|
22
|
-
*
|
|
23
|
-
*Este tipo define la estructura de configuración que el usuario puede
|
|
24
|
-
*pasar al DataGrid para personalizar columnas y sus anchos.
|
|
25
|
-
*
|
|
26
|
-
*- `columnsConfig`: Configuración de visibilidad y orden de columnas para vista table
|
|
27
|
-
*- `columnsWidths`: Anchos personalizados de columnas
|
|
28
|
-
* @example
|
|
29
|
-
* ```typescript
|
|
30
|
-
* const userConfig: IGridConfig = {
|
|
31
|
-
* columnsConfig: [
|
|
32
|
-
* { key: 'name', visible: true, index: 0, frozen: false },
|
|
33
|
-
* { key: 'email', visible: true, index: 1, frozen: false },
|
|
34
|
-
* ],
|
|
35
|
-
* columnsWidths: { name: 200, email: 300 }
|
|
36
|
-
* };
|
|
37
|
-
* ```
|
|
38
|
-
*/
|
|
39
|
-
export interface IGridConfig {
|
|
40
|
-
/** Configuración de columnas para vista table (visibilidad, orden, frozen) */
|
|
41
|
-
columnsConfig: BaseConfigColumn[];
|
|
42
|
-
/** Anchos de columnas en píxeles */
|
|
43
|
-
columnsWidths: Record<RowKey, number>;
|
|
44
|
-
}
|
|
45
|
-
/**
|
|
46
|
-
* Configuración específica retornada por getViewSpecificConfig
|
|
47
|
-
*/
|
|
48
|
-
export interface ViewSpecificConfig {
|
|
49
|
-
/** Valores por defecto para propiedades específicas de la vista */
|
|
50
|
-
defaults: Record<string, unknown>;
|
|
51
|
-
/** Valores originales por defecto para tracking de cambios */
|
|
52
|
-
originalDefaults: Record<string, unknown>;
|
|
53
|
-
/** Función para obtener propiedades originales dinámicas de un item */
|
|
54
|
-
dynamicOriginalProperty: (item: unknown) => Record<string, unknown>;
|
|
55
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
|
|
@@ -1,81 +0,0 @@
|
|
|
1
|
-
import { RowKey, RowHeightVariants, RowHeights, OnChangeUserColumns } from './types';
|
|
2
|
-
import { Maybe } from '@m4l/core';
|
|
3
|
-
import { IViewConfig, RowHeightState, ViewMode } from './contexts/DataGridContext/types';
|
|
4
|
-
export interface UseViewModeParams {
|
|
5
|
-
/** Identificador único del DataGrid */
|
|
6
|
-
id: RowKey;
|
|
7
|
-
/** ViewMode controlado por el padre */
|
|
8
|
-
viewMode?: ViewMode;
|
|
9
|
-
/** ViewMode por defecto cuando no hay valor guardado */
|
|
10
|
-
defaultViewMode?: ViewMode;
|
|
11
|
-
/** Callback cuando cambia el viewMode */
|
|
12
|
-
onViewModeChange?: (viewMode: ViewMode) => void;
|
|
13
|
-
/** Callback para guardar cambios en backend (cookies de red) */
|
|
14
|
-
onChangeUserColumns?: OnChangeUserColumns;
|
|
15
|
-
}
|
|
16
|
-
export interface UseViewModeReturn {
|
|
17
|
-
/** Estado actual del viewMode */
|
|
18
|
-
viewModeState: ViewMode;
|
|
19
|
-
/** Función para establecer el viewMode */
|
|
20
|
-
setViewModeState: React.Dispatch<React.SetStateAction<ViewMode>>;
|
|
21
|
-
/** Función para cambiar el viewMode y persistirlo */
|
|
22
|
-
handleViewModeChange: (newViewMode: ViewMode) => void;
|
|
23
|
-
}
|
|
24
|
-
export interface UseRowHeightParams {
|
|
25
|
-
/** Alturas de las filas (número fijo o array de 3 elementos) */
|
|
26
|
-
rowHeights: RowHeights;
|
|
27
|
-
/** Alturas de los headers (número fijo o array de 3 elementos) */
|
|
28
|
-
rowHeaderHeights: RowHeights;
|
|
29
|
-
/** Variant inicial de altura */
|
|
30
|
-
initialRowHeightVariant: RowHeightVariants;
|
|
31
|
-
}
|
|
32
|
-
export interface UseRowHeightReturn {
|
|
33
|
-
/** Estado actual de la altura de filas */
|
|
34
|
-
currentRowHeightVariant: RowHeightState;
|
|
35
|
-
/** Función para cambiar el variant de altura */
|
|
36
|
-
setRowHeightVariant: (newVariant: RowHeightVariants) => void;
|
|
37
|
-
}
|
|
38
|
-
export interface UseColumnsWidthParams {
|
|
39
|
-
/** Identificador único del DataGrid */
|
|
40
|
-
id: RowKey;
|
|
41
|
-
/** Callback para guardar cambios en columnas */
|
|
42
|
-
onChangeUserColumns?: OnChangeUserColumns;
|
|
43
|
-
}
|
|
44
|
-
export interface UseColumnsWidthReturn {
|
|
45
|
-
/** Mapa con el ancho de cada columna */
|
|
46
|
-
columnsWidths: Map<string, Maybe<string | number>>;
|
|
47
|
-
/** Función para establecer el mapa de anchos */
|
|
48
|
-
setColumnsWidths: React.Dispatch<React.SetStateAction<Map<string, Maybe<string | number>>>>;
|
|
49
|
-
/** Función para cambiar el ancho de una columna */
|
|
50
|
-
onChangeColumnWidth: (columnKey: string, width: number) => void;
|
|
51
|
-
}
|
|
52
|
-
export interface UseViewConfigReturn {
|
|
53
|
-
/** Estado de configuración por vista */
|
|
54
|
-
viewConfig: Record<ViewMode, IViewConfig<any, any>[]>;
|
|
55
|
-
/** Obtiene la configuración de columnas para una vista */
|
|
56
|
-
getConfigColumns: (viewMode: ViewMode) => IViewConfig<any, any>[];
|
|
57
|
-
/** Actualiza la configuración de columnas para una vista */
|
|
58
|
-
updateConfigColumns: (viewMode: ViewMode, config: IViewConfig<any, any>[]) => void;
|
|
59
|
-
}
|
|
60
|
-
export interface UseChangeColumnsConfigParams {
|
|
61
|
-
/** Identificador único del DataGrid */
|
|
62
|
-
id: RowKey;
|
|
63
|
-
/** Callback para guardar cambios en columnas */
|
|
64
|
-
onChangeUserColumns?: OnChangeUserColumns;
|
|
65
|
-
/** Función para actualizar la configuración de columnas */
|
|
66
|
-
updateConfigColumns: (viewMode: ViewMode, config: IViewConfig<any, any>[]) => void;
|
|
67
|
-
}
|
|
68
|
-
export interface UseChangeColumnsConfigReturn {
|
|
69
|
-
/** Función para cambiar la configuración de columnas de una vista */
|
|
70
|
-
onChangeColumnsConfig: (viewMode: ViewMode, newConfig: IViewConfig<any, any>[]) => void;
|
|
71
|
-
}
|
|
72
|
-
export interface UseChangeColumnsOrderParams {
|
|
73
|
-
/** Función para obtener la configuración de columnas de una vista */
|
|
74
|
-
getConfigColumns: (viewMode: ViewMode) => IViewConfig<any, any>[];
|
|
75
|
-
/** Función para cambiar la configuración de columnas */
|
|
76
|
-
onChangeColumnsConfig: (viewMode: ViewMode, newConfig: IViewConfig<any, any>[]) => void;
|
|
77
|
-
}
|
|
78
|
-
export interface UseChangeColumnsOrderReturn {
|
|
79
|
-
/** Función para cambiar el orden de columnas de una vista */
|
|
80
|
-
onChangeColumnsOrder: (viewMode: ViewMode, sourceKey: string, targetKey: string) => void;
|
|
81
|
-
}
|
|
File without changes
|
|
File without changes
|
/package/components/{DataGrid/helpers/getColumnsWidth → hook-form/RHFDatePicker/slots}/index.js
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
/package/components/{DataGrid/helpers/getInitialColumnsConfig → mui_extended/DatePicker}/index.js
RENAMED
|
File without changes
|
|
File without changes
|