@m4l/components 9.3.35-JT27112025.beta.1 → 9.3.36-JT20251128-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/export.d.ts +3 -0
- package/@types/types.d.ts +40 -5
- package/components/AccountPopover/slots/AccountPopoverSlots.d.ts +3 -3
- package/components/ActionsGroup/ActionsGroup.d.ts +5 -0
- package/components/ActionsGroup/ActionsGroup.js +40 -0
- package/components/ActionsGroup/ActionsGroup.styles.d.ts +2 -0
- package/components/ActionsGroup/ActionsGroup.styles.js +95 -0
- package/components/ActionsGroup/constants.d.ts +2 -0
- package/components/ActionsGroup/constants.js +8 -0
- package/components/ActionsGroup/icons.d.ts +3 -0
- package/components/ActionsGroup/icons.js +6 -0
- package/components/ActionsGroup/index.d.ts +1 -0
- package/components/ActionsGroup/slots/ActionsGroupEnum.d.ts +8 -0
- package/components/ActionsGroup/slots/ActionsGroupEnum.js +12 -0
- package/components/ActionsGroup/slots/ActionsGroupSlots.d.ts +15 -0
- package/components/ActionsGroup/slots/ActionsGroupSlots.js +35 -0
- package/components/ActionsGroup/subcomponents/ActionIconButton/ActionIconButton.d.ts +6 -0
- package/components/ActionsGroup/subcomponents/ActionIconButton/ActionIconButton.js +76 -0
- package/components/ActionsGroup/subcomponents/ActionIconButton/types.d.ts +7 -0
- package/components/ActionsGroup/types.d.ts +60 -0
- package/components/Chip/slots/ChipSlots.d.ts +1 -1
- package/components/DataGrid/DataGrid.js +2 -0
- package/components/DataGrid/Datagrid.styles.js +11 -2
- package/components/DataGrid/contexts/DataGridContext/index.js +270 -39
- package/components/DataGrid/contexts/DataGridContext/types.d.ts +22 -5
- package/components/DataGrid/index.d.ts +4 -5
- package/components/DataGrid/subcomponents/Cards/subcomponents/CardHeader/index.js +15 -7
- package/components/DataGrid/subcomponents/CheckboxCellAdapter/index.js +4 -1
- package/components/DataGrid/subcomponents/Table/hooks/useSortColumnsRows.js +6 -2
- package/components/DataGrid/subcomponents/Table/subcomponents/RadioButtonFormatter.d.ts +6 -0
- package/components/DataGrid/subcomponents/Table/subcomponents/RadioButtonFormatter.js +12 -0
- package/components/DataGrid/subcomponents/Table/subcomponents/RadioSelectColumn.d.ts +64 -0
- package/components/DataGrid/subcomponents/Table/subcomponents/RadioSelectColumn.js +46 -0
- package/components/DataGrid/types.d.ts +7 -0
- package/components/EditLabel/slots/EditLabelSlots.d.ts +1 -1
- package/components/HelperError/slots/HelperErrorSlots.d.ts +1 -1
- package/components/ImageText/slots/ImageTextSlots.d.ts +2 -2
- package/components/Label/index.d.ts +1 -1
- package/components/Label/slots/LabelSlots.d.ts +2 -2
- package/components/Label/types.d.ts +6 -0
- package/components/LoadingError/slots/LoadingErrorSlots.d.ts +1 -1
- package/components/Pager/slots/PagerSlots.d.ts +3 -3
- package/components/PaperForm/slots/PaperFormSlots.d.ts +1 -1
- package/components/SettingsLayout/slots/SettingsLayoutSlots.d.ts +1 -1
- package/components/Stepper/slots/StepperSlot.d.ts +4 -4
- package/components/TabsNavigator/slots/TabsNavigatorSlots.d.ts +12 -12
- package/components/ToastContainer/slots/toastContainerSlots.d.ts +2 -2
- package/components/WindowBase/WindowBase.styles.js +8 -0
- package/components/WindowBase/slots/WindowBaseSlots.d.ts +2 -2
- package/components/WindowBase/subcomponents/Header/useButtonActions.js +23 -13
- package/components/areas/components/AreasAdmin/slots/AreasAdminSlots.d.ts +1 -1
- package/components/formatters/BooleanFormatter/slots/BooleanFormatterSlots.d.ts +1 -1
- package/components/formatters/ConcatenatedFormatter/slots/ConcatenatedFormatterSlots.d.ts +1 -1
- package/components/formatters/DateFormatter/slots/DateFormatterSlots.d.ts +1 -1
- package/components/formatters/DistanceToNowFormatter/slots/DistanceToNowFormatterSlots.d.ts +1 -1
- package/components/formatters/ImageFormatter/slots/ImageFormatterSlots.d.ts +1 -1
- package/components/formatters/PeriodFormatter/slots/PeriodFormatterSlots.d.ts +1 -1
- package/components/formatters/PointsFormatter/slots/ointsFormatterSlots.d.ts +1 -1
- package/components/formatters/PriceFormatter/slots/PriceFormatterSlots.d.ts +1 -1
- package/components/formatters/UncertaintyFormatter/slots/UncertaintyFormatterSlots.d.ts +1 -1
- package/components/hook-form/RHFActionsGroup/RHFActionsGroup.d.ts +7 -0
- package/components/hook-form/RHFActionsGroup/RHFActionsGroup.js +87 -0
- package/components/hook-form/RHFActionsGroup/RHFActionsGroupStyles.d.ts +2 -0
- package/components/hook-form/RHFActionsGroup/RHFActionsGroupStyles.js +14 -0
- package/components/hook-form/RHFActionsGroup/constants.d.ts +9 -0
- package/components/hook-form/RHFActionsGroup/constants.js +8 -0
- package/components/hook-form/RHFActionsGroup/index.d.ts +2 -0
- package/components/hook-form/RHFActionsGroup/slots/RHFActionsGroupEnum.d.ts +3 -0
- package/components/hook-form/RHFActionsGroup/slots/RHFActionsGroupEnum.js +7 -0
- package/components/hook-form/RHFActionsGroup/slots/RHFActionsGroupSlots.d.ts +1 -0
- package/components/hook-form/RHFActionsGroup/slots/RHFActionsGroupSlots.js +11 -0
- package/components/hook-form/RHFActionsGroup/slots/index.d.ts +2 -0
- package/components/hook-form/RHFActionsGroup/tests/common.d.ts +28 -0
- package/components/hook-form/RHFActionsGroup/types.d.ts +54 -0
- package/components/hook-form/RHFUpload/RHFUploadImage/slots/RHFUploadImageSlots.d.ts +1 -1
- package/components/hook-form/RHFUpload/RHFUploadSingleFile/slots/RHFUploadSingleFileSlots.d.ts +5 -5
- package/components/hook-form/index.d.ts +1 -0
- package/components/index.d.ts +1 -0
- package/components/mui_extended/Accordion/slots/AccordionSlots.d.ts +1 -1
- package/components/mui_extended/Autocomplete/slots/AutocompleteSlots.d.ts +2 -2
- package/components/mui_extended/Button/slots/ButtonSlots.d.ts +1 -1
- package/components/mui_extended/CheckBox/slots/CheckBoxSlots.d.ts +1 -1
- package/components/mui_extended/MenuItem/slots/MenuItemSlots.d.ts +1 -1
- package/components/mui_extended/NavLink/slots/NavLinkSlots.d.ts +1 -1
- package/components/mui_extended/RadioButton/RadioButton.d.ts +24 -0
- package/components/mui_extended/RadioButton/RadioButton.js +110 -0
- package/components/mui_extended/RadioButton/RadioButton.styles.d.ts +2 -0
- package/components/mui_extended/RadioButton/RadioButton.styles.js +126 -0
- package/components/mui_extended/RadioButton/constants.d.ts +1 -0
- package/components/mui_extended/RadioButton/constants.js +4 -0
- package/components/mui_extended/RadioButton/icons.d.ts +4 -0
- package/components/mui_extended/RadioButton/icons.js +7 -0
- package/components/mui_extended/RadioButton/index.d.ts +1 -0
- package/components/mui_extended/RadioButton/slots/RadioButtonEnum.d.ts +8 -0
- package/components/mui_extended/RadioButton/slots/RadioButtonEnum.js +12 -0
- package/components/mui_extended/RadioButton/slots/RadioButtonSlots.d.ts +20 -0
- package/components/mui_extended/RadioButton/slots/RadioButtonSlots.js +39 -0
- package/components/mui_extended/RadioButton/types.d.ts +50 -0
- package/components/mui_extended/Select/slots/SelectSlots.d.ts +3 -3
- package/components/mui_extended/Tab/Slots/TabSlots.d.ts +1 -1
- package/components/mui_extended/TextField/slots/TextFieldSlots.d.ts +3 -3
- package/components/mui_extended/Tooltip/Tooltip.styles.js +22 -4
- 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 +76 -70
- 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/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/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/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 -12
- 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 -44
- package/components/DataGrid/hooks/useViewMode/useViewMode.js +0 -48
- 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 -79
- /package/components/{DataGrid/helpers/getAllViewModes/getAllViewModes.test.d.ts → ActionsGroup/__tests__/ActionsGroup.test.d.ts} +0 -0
- /package/components/{DataGrid/helpers/getAllViewModes → ActionsGroup}/index.js +0 -0
- /package/components/DataGrid/{helpers/getColumnsWidth/getColumnsWidth.test.d.ts → tests/table/subcomponents/RadioButtonFormatter.test.d.ts} +0 -0
- /package/components/DataGrid/{helpers/getIndexRowHeightVariant/getIndexRowHeightVariant.test.d.ts → tests/table/subcomponents/RadioSelectColumn.test.d.ts} +0 -0
- /package/components/{DataGrid/helpers/getColumnsWidth → hook-form/RHFActionsGroup}/index.js +0 -0
- /package/components/{DataGrid/helpers/getIndexRowHeightVariant → hook-form/RHFActionsGroup/slots}/index.js +0 -0
- /package/components/{DataGrid/helpers/getInitialColumnsConfig/getInitialColumnsConfig.test.d.ts → hook-form/RHFActionsGroup/tests/RHFActionsGroup.test.d.ts} +0 -0
- /package/components/{DataGrid/helpers/getInitialColumnsConfig → mui_extended/RadioButton}/index.js +0 -0
- /package/components/{DataGrid/helpers/getViewSpecificConfig/getViewSpecificConfig.test.d.ts → mui_extended/RadioButton/tests/RadioButton.test.d.ts} +0 -0
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import { RowKey } from '../../types';
|
|
2
|
-
/**
|
|
3
|
-
* Carga configuraciones de vista desde localStorage.
|
|
4
|
-
*
|
|
5
|
-
* ## Propósito
|
|
6
|
-
*
|
|
7
|
-
* Recupera la configuración de columnas guardada previamente para una vista específica.
|
|
8
|
-
* Trabaja en conjunto con `saveViewConfig` y `getViewSuffix` para persistencia.
|
|
9
|
-
*
|
|
10
|
-
* ## Formato de key en localStorage
|
|
11
|
-
*
|
|
12
|
-
* ```
|
|
13
|
-
* table: `${id}_columns_config`
|
|
14
|
-
* cards: `${id}_columns_config_cards`
|
|
15
|
-
* ```
|
|
16
|
-
* @param id - Identificador único del DataGrid
|
|
17
|
-
* @param viewSuffix - Sufijo para identificar la vista ('' para table, '_cards' para cards)
|
|
18
|
-
* @returns Array de configuración o null si no existe/error
|
|
19
|
-
* @example
|
|
20
|
-
* loadViewConfig('my-grid', ''); // Lee 'my-grid_columns_config'
|
|
21
|
-
* loadViewConfig('my-grid', '_cards'); // Lee 'my-grid_columns_config_cards'
|
|
22
|
-
*/
|
|
23
|
-
export declare const loadViewConfig: <T>(id: RowKey, viewSuffix: string) => T[] | null;
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
const loadViewConfig = (id, viewSuffix) => {
|
|
2
|
-
try {
|
|
3
|
-
const storageKey = viewSuffix === "" ? `${id}_columns_config` : `${id}_columns_config${viewSuffix}`;
|
|
4
|
-
const stored = localStorage.getItem(storageKey);
|
|
5
|
-
return stored ? JSON.parse(stored) : null;
|
|
6
|
-
} catch (_e) {
|
|
7
|
-
return null;
|
|
8
|
-
}
|
|
9
|
-
};
|
|
10
|
-
export {
|
|
11
|
-
loadViewConfig as l
|
|
12
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { saveColumnsWidth } from './saveColumnsWidth';
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
|
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
import { Maybe } from '@m4l/core';
|
|
2
|
-
import { RowKey, OnChangeUserColumns } from '../../types';
|
|
3
|
-
/**
|
|
4
|
-
* Persiste la configuración de anchos de las columnas del DataGrid.
|
|
5
|
-
*
|
|
6
|
-
* ## Flujo de persistencia
|
|
7
|
-
*
|
|
8
|
-
* Esta función guarda los anchos de columnas siguiendo esta lógica:
|
|
9
|
-
*
|
|
10
|
-
* 1. **onChangeUserColumns** (Backend/API) - Método principal en producción
|
|
11
|
-
* Si está disponible, envía la configuración al callback para que el consumidor
|
|
12
|
-
* la persista en el backend. En la siguiente carga, estos datos volverán
|
|
13
|
-
* como `defaultUserColumns` en `getColumnsWidth`.
|
|
14
|
-
*
|
|
15
|
-
* 2. **localStorage** - Fallback local
|
|
16
|
-
* Solo se usa cuando NO hay callback configurado.
|
|
17
|
-
* Útil para desarrollo o cuando no hay integración con backend.
|
|
18
|
-
*
|
|
19
|
-
* ## Ciclo completo de persistencia
|
|
20
|
-
*
|
|
21
|
-
* ```
|
|
22
|
-
* Usuario redimensiona columna
|
|
23
|
-
* ↓
|
|
24
|
-
* saveColumnsWidth() envía al backend via onChangeUserColumns
|
|
25
|
-
* ↓
|
|
26
|
-
* Backend persiste en BD/cookies
|
|
27
|
-
* ↓
|
|
28
|
-
* Próxima carga: datos vienen en defaultUserColumns
|
|
29
|
-
* ↓
|
|
30
|
-
* getColumnsWidth() lee de defaultUserColumns
|
|
31
|
-
* ```
|
|
32
|
-
* @param id - Identificador único del DataGrid. Se usa como prefijo en localStorage (fallback)
|
|
33
|
-
* @param storeColumnsWidth - Map con la configuración de anchos donde:
|
|
34
|
-
* - key: identificador de la columna (column.key)
|
|
35
|
-
* - value: ancho en píxeles (number) o string con unidad CSS
|
|
36
|
-
* @param onChangeUserColumns - Callback para enviar la configuración al backend.
|
|
37
|
-
* Recibe un objeto con:
|
|
38
|
-
* - reason: 'columnsWidths' (identificador del tipo de cambio)
|
|
39
|
-
* - userConfig: Record con los anchos de columnas
|
|
40
|
-
* @example
|
|
41
|
-
* // Producción: Guardar mediante callback al backend
|
|
42
|
-
* saveColumnsWidth('my-grid', columnsWidthsMap, ({ reason, userConfig }) => {
|
|
43
|
-
* // El backend persiste en BD o cookies
|
|
44
|
-
* api.saveUserPreferences(userConfig);
|
|
45
|
-
* });
|
|
46
|
-
* @example
|
|
47
|
-
* // Desarrollo: Guardar en localStorage (sin backend)
|
|
48
|
-
* saveColumnsWidth('my-grid', columnsWidthsMap);
|
|
49
|
-
* @see getColumnsWidth - Función complementaria para obtener la configuración
|
|
50
|
-
* @see castMapColumnsWidthToRecord - Helper usado para convertir el Map a Record
|
|
51
|
-
*/
|
|
52
|
-
export declare function saveColumnsWidth(id: RowKey, storeColumnsWidth: Map<string, Maybe<string | number>>, onChangeUserColumns?: OnChangeUserColumns): void;
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import { c as castMapColumnsWidthToRecord } from "../castMapColumnsWidthToRecord.js";
|
|
2
|
-
function saveColumnsWidth(id, storeColumnsWidth, onChangeUserColumns) {
|
|
3
|
-
if (onChangeUserColumns) {
|
|
4
|
-
const columnsWidthObject = castMapColumnsWidthToRecord(storeColumnsWidth);
|
|
5
|
-
onChangeUserColumns({
|
|
6
|
-
reason: "columnsWidths",
|
|
7
|
-
userConfig: columnsWidthObject
|
|
8
|
-
});
|
|
9
|
-
return;
|
|
10
|
-
}
|
|
11
|
-
localStorage.setItem(
|
|
12
|
-
`${id}_columns_width`,
|
|
13
|
-
JSON.stringify([...storeColumnsWidth])
|
|
14
|
-
);
|
|
15
|
-
}
|
|
16
|
-
export {
|
|
17
|
-
saveColumnsWidth as s
|
|
18
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { saveViewConfig } from './saveViewConfig';
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
import { RowKey } from '../../types';
|
|
2
|
-
/**
|
|
3
|
-
* Guarda configuraciones de vista en localStorage o notifica via callback.
|
|
4
|
-
*
|
|
5
|
-
* ## Propósito
|
|
6
|
-
*
|
|
7
|
-
* Persiste la configuración de columnas para una vista específica.
|
|
8
|
-
* Soporta dos modos: localStorage directo o callback externo (API/backend).
|
|
9
|
-
*
|
|
10
|
-
* ## Prioridad de persistencia
|
|
11
|
-
*
|
|
12
|
-
* 1. Si hay `onChangeCallback`, notifica al callback (para guardar en backend)
|
|
13
|
-
* 2. Si no hay callback, guarda directamente en localStorage
|
|
14
|
-
*
|
|
15
|
-
* ## Formato de key en localStorage
|
|
16
|
-
*
|
|
17
|
-
* ```
|
|
18
|
-
* table: `${id}_columns_config`
|
|
19
|
-
* cards: `${id}_columns_config_cards`
|
|
20
|
-
* ```
|
|
21
|
-
* @param id - Identificador único del DataGrid
|
|
22
|
-
* @param viewSuffix - Sufijo para identificar la vista ('' para table, '_cards' para cards)
|
|
23
|
-
* @param config - Array de configuración a guardar
|
|
24
|
-
* @param onChangeCallback - Callback opcional para notificar cambios (prioridad sobre localStorage)
|
|
25
|
-
* @example
|
|
26
|
-
* // Guardar en localStorage
|
|
27
|
-
* saveViewConfig('my-grid', '', config);
|
|
28
|
-
*
|
|
29
|
-
* // Notificar via callback
|
|
30
|
-
* saveViewConfig('my-grid', '_cards', config, handleChange);
|
|
31
|
-
*/
|
|
32
|
-
export declare const saveViewConfig: <T>(id: RowKey, viewSuffix: string, config: T[], onChangeCallback?: (data: {
|
|
33
|
-
reason: string;
|
|
34
|
-
userConfig: T[];
|
|
35
|
-
}) => void) => void;
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
const saveViewConfig = (id, viewSuffix, config, onChangeCallback) => {
|
|
2
|
-
if (onChangeCallback) {
|
|
3
|
-
const reason = viewSuffix === "" ? "columnsConfig" : `columnsConfig${viewSuffix.replace("_", "")}`;
|
|
4
|
-
onChangeCallback({
|
|
5
|
-
reason,
|
|
6
|
-
userConfig: config
|
|
7
|
-
});
|
|
8
|
-
return;
|
|
9
|
-
}
|
|
10
|
-
const storageKey = viewSuffix === "" ? `${id}_columns_config` : `${id}_columns_config${viewSuffix}`;
|
|
11
|
-
localStorage.setItem(storageKey, JSON.stringify(config));
|
|
12
|
-
};
|
|
13
|
-
export {
|
|
14
|
-
saveViewConfig as s
|
|
15
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { saveViewMode } from './saveViewMode';
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
import { ViewMode } from '../../contexts/DataGridContext/types';
|
|
2
|
-
import { OnChangeUserColumns, RowKey } from '../../types';
|
|
3
|
-
/**
|
|
4
|
-
* Guarda el modo de visualización (table o cards).
|
|
5
|
-
*
|
|
6
|
-
* ## Propósito
|
|
7
|
-
*
|
|
8
|
-
* Persiste la preferencia del usuario sobre el modo de vista seleccionado.
|
|
9
|
-
* Permite que al recargar la página se mantenga la última vista utilizada.
|
|
10
|
-
*
|
|
11
|
-
* ## Prioridad de guardado
|
|
12
|
-
*
|
|
13
|
-
* 1. Si existe `onChangeUserColumns` → Guarda en backend (cookies de red)
|
|
14
|
-
* 2. Si no existe → Fallback a localStorage
|
|
15
|
-
*
|
|
16
|
-
* ## Formato de key en localStorage (fallback)
|
|
17
|
-
*
|
|
18
|
-
* ```
|
|
19
|
-
* `${id}_view_mode` -> 'table' | 'cards'
|
|
20
|
-
* ```
|
|
21
|
-
* @param id - Identificador único del DataGrid
|
|
22
|
-
* @param viewMode - Modo de visualización ('table' | 'cards')
|
|
23
|
-
* @param onChangeUserColumns - Callback opcional para guardar en backend
|
|
24
|
-
* @example
|
|
25
|
-
* // Con backend
|
|
26
|
-
* saveViewMode('my-grid', 'cards', onChangeUserColumns);
|
|
27
|
-
* // Llama: onChangeUserColumns({ reason: 'viewMode', userConfig: 'cards' })
|
|
28
|
-
*
|
|
29
|
-
* // Sin backend (fallback)
|
|
30
|
-
* saveViewMode('my-grid', 'cards');
|
|
31
|
-
* // localStorage: 'my-grid_view_mode' = 'cards'
|
|
32
|
-
*/
|
|
33
|
-
export declare const saveViewMode: (id: RowKey, viewMode: ViewMode, onChangeUserColumns?: OnChangeUserColumns) => void;
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
const saveViewMode = (id, viewMode, onChangeUserColumns) => {
|
|
2
|
-
if (onChangeUserColumns) {
|
|
3
|
-
onChangeUserColumns({
|
|
4
|
-
reason: "viewMode",
|
|
5
|
-
userConfig: viewMode
|
|
6
|
-
});
|
|
7
|
-
return;
|
|
8
|
-
}
|
|
9
|
-
localStorage.setItem(`${id}_view_mode`, viewMode);
|
|
10
|
-
};
|
|
11
|
-
export {
|
|
12
|
-
saveViewMode as s
|
|
13
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { useChangeColumnsConfig } from './useChangeColumnsConfig';
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { UseChangeColumnsConfigParams, UseChangeColumnsConfigReturn } from '../../types.hooks';
|
|
2
|
-
/**
|
|
3
|
-
* Hook para manejar el cambio de configuración de columnas.
|
|
4
|
-
*
|
|
5
|
-
* Guarda la configuración en localStorage y actualiza el estado.
|
|
6
|
-
* @param params - Parámetros del hook
|
|
7
|
-
* @returns Función para cambiar la configuración de columnas
|
|
8
|
-
*/
|
|
9
|
-
export declare const useChangeColumnsConfig: ({ id, onChangeUserColumns, updateConfigColumns, }: UseChangeColumnsConfigParams) => UseChangeColumnsConfigReturn;
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import { useCallback } from "react";
|
|
2
|
-
import { s as saveViewConfig } from "../../helpers/saveViewConfig/saveViewConfig.js";
|
|
3
|
-
import { g as getViewSuffix } from "../../helpers/getViewSuffix/getViewSuffix.js";
|
|
4
|
-
const useChangeColumnsConfig = ({
|
|
5
|
-
id,
|
|
6
|
-
onChangeUserColumns,
|
|
7
|
-
updateConfigColumns
|
|
8
|
-
}) => {
|
|
9
|
-
const onChangeColumnsConfig = useCallback(
|
|
10
|
-
(viewModeParam, newConfig) => {
|
|
11
|
-
saveViewConfig(
|
|
12
|
-
id,
|
|
13
|
-
getViewSuffix(viewModeParam),
|
|
14
|
-
newConfig,
|
|
15
|
-
onChangeUserColumns
|
|
16
|
-
);
|
|
17
|
-
updateConfigColumns(viewModeParam, newConfig);
|
|
18
|
-
},
|
|
19
|
-
[id, onChangeUserColumns, updateConfigColumns]
|
|
20
|
-
);
|
|
21
|
-
return {
|
|
22
|
-
onChangeColumnsConfig
|
|
23
|
-
};
|
|
24
|
-
};
|
|
25
|
-
export {
|
|
26
|
-
useChangeColumnsConfig as u
|
|
27
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { useChangeColumnsOrder } from './useChangeColumnsOrder';
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { UseChangeColumnsOrderParams, UseChangeColumnsOrderReturn } from '../../types.hooks';
|
|
2
|
-
/**
|
|
3
|
-
* Hook para manejar el cambio de orden de columnas.
|
|
4
|
-
*
|
|
5
|
-
* Reordena las columnas y llama a onChangeColumnsConfig para persistir.
|
|
6
|
-
* @param getConfigColumns Función para obtener la configuración de columnas
|
|
7
|
-
* @param onChangeColumnsConfig Función para cambiar la configuración de columnas
|
|
8
|
-
* @returns Función para cambiar el orden de columnas
|
|
9
|
-
*/
|
|
10
|
-
export declare const useChangeColumnsOrder: ({ getConfigColumns, onChangeColumnsConfig, }: UseChangeColumnsOrderParams) => UseChangeColumnsOrderReturn;
|
|
@@ -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,44 +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
|
-
* ## Precedencia para determinar el viewMode inicial
|
|
6
|
-
*
|
|
7
|
-
* 1. `viewMode` prop - Modo controlado (el padre controla completamente el estado)
|
|
8
|
-
* 2. localStorage - Preferencia del usuario guardada previamente
|
|
9
|
-
* 3. `defaultViewMode` prop - Valor inicial establecido por el desarrollador
|
|
10
|
-
* 4. `useIsMobile()` - Fallback automático según el dispositivo:
|
|
11
|
-
* - Móvil: 'cards'
|
|
12
|
-
* - Escritorio: 'table'
|
|
13
|
-
*
|
|
14
|
-
* ## Persistencia del viewMode
|
|
15
|
-
*
|
|
16
|
-
* - Si `onChangeUserColumns` está definido → Guarda en backend (cookies de red)
|
|
17
|
-
* - Si no está definido → Fallback a localStorage
|
|
18
|
-
*
|
|
19
|
-
* ## Modo controlado vs no controlado
|
|
20
|
-
*
|
|
21
|
-
* - **Controlado**: Cuando se pasa `viewMode` prop, el padre controla el estado
|
|
22
|
-
* - **No controlado**: El hook maneja internamente el estado y persiste
|
|
23
|
-
* @param id - Identificador único del DataGrid
|
|
24
|
-
* @param viewMode - ViewMode controlado por el padre (opcional)
|
|
25
|
-
* @param defaultViewMode - ViewMode por defecto cuando no hay valor guardado (opcional)
|
|
26
|
-
* @param onViewModeChange - Callback cuando cambia el viewMode (opcional)
|
|
27
|
-
* @param onChangeUserColumns - Callback para guardar en backend (opcional)
|
|
28
|
-
* @returns viewModeState - Estado actual del viewMode
|
|
29
|
-
* @returns handleViewModeChange - Función para cambiar el viewMode
|
|
30
|
-
* @example
|
|
31
|
-
* // Con persistencia en backend
|
|
32
|
-
* const { viewModeState, handleViewModeChange } = useViewMode({
|
|
33
|
-
* id: 'my-grid',
|
|
34
|
-
* defaultViewMode: 'table',
|
|
35
|
-
* onChangeUserColumns, // Guarda en backend
|
|
36
|
-
* });
|
|
37
|
-
*
|
|
38
|
-
* // Sin backend (solo localStorage)
|
|
39
|
-
* const { viewModeState, handleViewModeChange } = useViewMode({
|
|
40
|
-
* id: 'my-grid',
|
|
41
|
-
* defaultViewMode: 'table',
|
|
42
|
-
* });
|
|
43
|
-
*/
|
|
44
|
-
export declare const useViewMode: ({ id, viewMode, defaultViewMode, onViewModeChange, onChangeUserColumns, }: UseViewModeParams) => UseViewModeReturn;
|