@m4l/components 9.3.34 → 9.3.35-JT27112025.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 +11 -0
- package/components/DataGrid/Datagrid.styles.js +1 -0
- package/components/DataGrid/contexts/DataGridContext/index.js +39 -268
- package/components/DataGrid/contexts/DataGridContext/types.d.ts +3 -20
- package/components/DataGrid/formatters/ColumnImageFormatter/ImageFormatterCell.d.ts +13 -0
- package/components/DataGrid/formatters/ColumnImageFormatter/ImageFormatterCell.js +33 -0
- package/components/DataGrid/formatters/ColumnImageFormatter/constants.d.ts +6 -0
- package/components/DataGrid/formatters/ColumnImageFormatter/constants.js +6 -0
- package/components/DataGrid/formatters/ColumnImageFormatter/formatter.d.ts +8 -0
- package/components/DataGrid/formatters/ColumnImageFormatter/formatter.js +25 -0
- package/components/DataGrid/formatters/ColumnImageFormatter/index.d.ts +3 -0
- package/components/DataGrid/formatters/ColumnImageFormatter/index.js +1 -0
- package/components/DataGrid/formatters/ColumnImageFormatter/tests/ColumnImageFormatter.test.d.ts +1 -0
- package/components/DataGrid/formatters/ColumnImageFormatter/types.d.ts +44 -0
- package/components/DataGrid/formatters/ColumnImageFormatter/types.js +1 -0
- package/components/DataGrid/formatters/ColumnImageFormatter/useColumnImage.d.ts +9 -0
- package/components/DataGrid/formatters/ColumnImageFormatter/useColumnImage.js +22 -0
- package/components/DataGrid/formatters/index.d.ts +1 -0
- package/components/DataGrid/helpers/getAllViewModes/getAllViewModes.d.ts +19 -0
- package/components/DataGrid/helpers/getAllViewModes/getAllViewModes.js +6 -0
- package/components/DataGrid/helpers/getAllViewModes/getAllViewModes.test.d.ts +1 -0
- package/components/DataGrid/helpers/getAllViewModes/index.d.ts +1 -0
- package/components/DataGrid/helpers/getAllViewModes/index.js +1 -0
- package/components/DataGrid/helpers/getColumnsWidth/getColumnsWidth.d.ts +47 -0
- package/components/DataGrid/helpers/getColumnsWidth/getColumnsWidth.js +32 -0
- package/components/DataGrid/helpers/getColumnsWidth/getColumnsWidth.test.d.ts +1 -0
- package/components/DataGrid/helpers/getColumnsWidth/index.d.ts +1 -0
- package/components/DataGrid/helpers/getColumnsWidth/index.js +1 -0
- package/components/DataGrid/helpers/getIndexRowHeightVariant/getIndexRowHeightVariant.d.ts +24 -0
- package/components/DataGrid/helpers/getIndexRowHeightVariant/getIndexRowHeightVariant.js +12 -0
- package/components/DataGrid/helpers/getIndexRowHeightVariant/getIndexRowHeightVariant.test.d.ts +1 -0
- package/components/DataGrid/helpers/getIndexRowHeightVariant/index.d.ts +1 -0
- package/components/DataGrid/helpers/getIndexRowHeightVariant/index.js +1 -0
- package/components/DataGrid/helpers/getInitialColumnsConfig/getInitialColumnsConfig.d.ts +48 -0
- package/components/DataGrid/helpers/getInitialColumnsConfig/getInitialColumnsConfig.js +35 -0
- package/components/DataGrid/helpers/getInitialColumnsConfig/getInitialColumnsConfig.test.d.ts +1 -0
- package/components/DataGrid/helpers/getInitialColumnsConfig/index.d.ts +1 -0
- package/components/DataGrid/helpers/getInitialColumnsConfig/index.js +1 -0
- package/components/DataGrid/helpers/getViewSpecificConfig/getViewSpecificConfig.d.ts +28 -0
- package/components/DataGrid/helpers/getViewSpecificConfig/getViewSpecificConfig.js +22 -0
- package/components/DataGrid/helpers/getViewSpecificConfig/getViewSpecificConfig.test.d.ts +1 -0
- package/components/DataGrid/helpers/getViewSpecificConfig/index.d.ts +1 -0
- package/components/DataGrid/helpers/getViewSpecificConfig/index.js +1 -0
- package/components/DataGrid/helpers/getViewSuffix/getViewSuffix.d.ts +24 -0
- package/components/DataGrid/helpers/getViewSuffix/getViewSuffix.js +9 -0
- package/components/DataGrid/helpers/getViewSuffix/getViewSuffix.test.d.ts +1 -0
- package/components/DataGrid/helpers/getViewSuffix/index.d.ts +1 -0
- package/components/DataGrid/helpers/getViewSuffix/index.js +1 -0
- package/components/DataGrid/helpers/index.d.ts +12 -0
- package/components/DataGrid/helpers/index.js +1 -0
- package/components/DataGrid/helpers/loadViewConfig/index.d.ts +1 -0
- package/components/DataGrid/helpers/loadViewConfig/index.js +1 -0
- package/components/DataGrid/helpers/loadViewConfig/loadViewConfig.d.ts +23 -0
- package/components/DataGrid/helpers/loadViewConfig/loadViewConfig.js +12 -0
- package/components/DataGrid/helpers/loadViewConfig/loadViewConfig.test.d.ts +1 -0
- package/components/DataGrid/helpers/saveColumnsWidth/index.d.ts +1 -0
- package/components/DataGrid/helpers/saveColumnsWidth/index.js +1 -0
- package/components/DataGrid/helpers/saveColumnsWidth/saveColumnsWidth.d.ts +52 -0
- package/components/DataGrid/helpers/saveColumnsWidth/saveColumnsWidth.js +18 -0
- package/components/DataGrid/helpers/saveColumnsWidth/saveColumnsWidth.test.d.ts +1 -0
- package/components/DataGrid/helpers/saveViewConfig/index.d.ts +1 -0
- package/components/DataGrid/helpers/saveViewConfig/index.js +1 -0
- package/components/DataGrid/helpers/saveViewConfig/saveViewConfig.d.ts +35 -0
- package/components/DataGrid/helpers/saveViewConfig/saveViewConfig.js +15 -0
- package/components/DataGrid/helpers/saveViewConfig/saveViewConfig.test.d.ts +1 -0
- package/components/DataGrid/helpers/saveViewMode/index.d.ts +1 -0
- package/components/DataGrid/helpers/saveViewMode/index.js +1 -0
- package/components/DataGrid/helpers/saveViewMode/saveViewMode.d.ts +33 -0
- package/components/DataGrid/helpers/saveViewMode/saveViewMode.js +13 -0
- package/components/DataGrid/helpers/saveViewMode/saveViewMode.test.d.ts +1 -0
- package/components/DataGrid/hooks/index.d.ts +6 -0
- package/components/DataGrid/hooks/index.js +1 -0
- package/components/DataGrid/hooks/useChangeColumnsConfig/index.d.ts +1 -0
- package/components/DataGrid/hooks/useChangeColumnsConfig/index.js +1 -0
- package/components/DataGrid/hooks/useChangeColumnsConfig/useChangeColumnsConfig.d.ts +9 -0
- package/components/DataGrid/hooks/useChangeColumnsConfig/useChangeColumnsConfig.js +27 -0
- package/components/DataGrid/hooks/useChangeColumnsConfig/useChangeColumnsConfig.test.d.ts +1 -0
- package/components/DataGrid/hooks/useChangeColumnsOrder/index.d.ts +1 -0
- package/components/DataGrid/hooks/useChangeColumnsOrder/index.js +1 -0
- package/components/DataGrid/hooks/useChangeColumnsOrder/useChangeColumnsOrder.d.ts +10 -0
- package/components/DataGrid/hooks/useChangeColumnsOrder/useChangeColumnsOrder.js +34 -0
- package/components/DataGrid/hooks/useChangeColumnsOrder/useChangeColumnsOrder.test.d.ts +1 -0
- package/components/DataGrid/hooks/useColumnsWidth/index.d.ts +1 -0
- package/components/DataGrid/hooks/useColumnsWidth/index.js +1 -0
- package/components/DataGrid/hooks/useColumnsWidth/useColumnsWidth.d.ts +11 -0
- package/components/DataGrid/hooks/useColumnsWidth/useColumnsWidth.js +29 -0
- package/components/DataGrid/hooks/useColumnsWidth/useColumnsWidth.test.d.ts +1 -0
- package/components/DataGrid/hooks/useRowHeight/index.d.ts +1 -0
- package/components/DataGrid/hooks/useRowHeight/index.js +1 -0
- package/components/DataGrid/hooks/useRowHeight/useRowHeight.d.ts +28 -0
- package/components/DataGrid/hooks/useRowHeight/useRowHeight.js +51 -0
- package/components/DataGrid/hooks/useRowHeight/useRowHeight.test.d.ts +1 -0
- package/components/DataGrid/hooks/useViewConfig/index.d.ts +1 -0
- package/components/DataGrid/hooks/useViewConfig/index.js +1 -0
- package/components/DataGrid/hooks/useViewConfig/useViewConfig.d.ts +9 -0
- package/components/DataGrid/hooks/useViewConfig/useViewConfig.js +30 -0
- package/components/DataGrid/hooks/useViewConfig/useViewConfig.test.d.ts +1 -0
- package/components/DataGrid/hooks/useViewMode/index.d.ts +1 -0
- package/components/DataGrid/hooks/useViewMode/index.js +1 -0
- package/components/DataGrid/hooks/useViewMode/useViewMode.d.ts +44 -0
- package/components/DataGrid/hooks/useViewMode/useViewMode.js +48 -0
- package/components/DataGrid/hooks/useViewMode/useViewMode.test.d.ts +1 -0
- package/components/DataGrid/index.d.ts +5 -4
- package/components/DataGrid/subcomponents/Cards/helpers/scrollToCardElement.js +2 -2
- package/components/DataGrid/subcomponents/Cards/index.js +16 -3
- package/components/DataGrid/subcomponents/Cards/subcomponents/CardRow/index.js +1 -0
- package/components/DataGrid/subcomponents/Table/index.js +10 -1
- package/components/DataGrid/tests/helpers/types.d.ts +10 -0
- package/components/DataGrid/types.helpers.d.ts +55 -0
- package/components/DataGrid/types.helpers.js +1 -0
- package/components/DataGrid/types.hooks.d.ts +79 -0
- package/components/formatters/ImageFormatter/ImageFormatter.d.ts +10 -0
- package/components/formatters/ImageFormatter/ImageFormatter.js +72 -0
- package/components/formatters/ImageFormatter/ImageFormatter.styles.d.ts +2 -0
- package/components/formatters/ImageFormatter/ImageFormatter.styles.js +42 -0
- package/components/formatters/ImageFormatter/constants.d.ts +5 -0
- package/components/formatters/ImageFormatter/constants.js +10 -0
- package/components/formatters/ImageFormatter/index.d.ts +2 -0
- package/components/formatters/ImageFormatter/index.js +1 -0
- package/components/formatters/ImageFormatter/slots/ImageFormatterEnum.d.ts +5 -0
- package/components/formatters/ImageFormatter/slots/ImageFormatterEnum.js +9 -0
- package/components/formatters/ImageFormatter/slots/ImageFormatterSlots.d.ts +9 -0
- package/components/formatters/ImageFormatter/slots/ImageFormatterSlots.js +23 -0
- package/components/formatters/ImageFormatter/tests/ImageFormatter.test.d.ts +1 -0
- package/components/formatters/ImageFormatter/types.d.ts +51 -0
- package/components/formatters/ImageFormatter/types.js +1 -0
- package/components/formatters/index.d.ts +1 -0
- package/hooks/useDataGridPersistence/constants.d.ts +1 -0
- package/hooks/useDataGridPersistence/constants.js +4 -2
- package/hooks/useDataGridPersistence/useDataGridPersistence.js +5 -2
- package/index.js +68 -62
- package/package.json +1 -1
|
@@ -0,0 +1,79 @@
|
|
|
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 cambiar el viewMode */
|
|
20
|
+
handleViewModeChange: (newViewMode: ViewMode) => void;
|
|
21
|
+
}
|
|
22
|
+
export interface UseRowHeightParams {
|
|
23
|
+
/** Alturas de las filas (número fijo o array de 3 elementos) */
|
|
24
|
+
rowHeights: RowHeights;
|
|
25
|
+
/** Alturas de los headers (número fijo o array de 3 elementos) */
|
|
26
|
+
rowHeaderHeights: RowHeights;
|
|
27
|
+
/** Variant inicial de altura */
|
|
28
|
+
initialRowHeightVariant: RowHeightVariants;
|
|
29
|
+
}
|
|
30
|
+
export interface UseRowHeightReturn {
|
|
31
|
+
/** Estado actual de la altura de filas */
|
|
32
|
+
currentRowHeightVariant: RowHeightState;
|
|
33
|
+
/** Función para cambiar el variant de altura */
|
|
34
|
+
setRowHeightVariant: (newVariant: RowHeightVariants) => void;
|
|
35
|
+
}
|
|
36
|
+
export interface UseColumnsWidthParams {
|
|
37
|
+
/** Identificador único del DataGrid */
|
|
38
|
+
id: RowKey;
|
|
39
|
+
/** Callback para guardar cambios en columnas */
|
|
40
|
+
onChangeUserColumns?: OnChangeUserColumns;
|
|
41
|
+
}
|
|
42
|
+
export interface UseColumnsWidthReturn {
|
|
43
|
+
/** Mapa con el ancho de cada columna */
|
|
44
|
+
columnsWidths: Map<string, Maybe<string | number>>;
|
|
45
|
+
/** Función para establecer el mapa de anchos */
|
|
46
|
+
setColumnsWidths: React.Dispatch<React.SetStateAction<Map<string, Maybe<string | number>>>>;
|
|
47
|
+
/** Función para cambiar el ancho de una columna */
|
|
48
|
+
onChangeColumnWidth: (columnKey: string, width: number) => void;
|
|
49
|
+
}
|
|
50
|
+
export interface UseViewConfigReturn {
|
|
51
|
+
/** Estado de configuración por vista */
|
|
52
|
+
viewConfig: Record<ViewMode, IViewConfig<any, any>[]>;
|
|
53
|
+
/** Obtiene la configuración de columnas para una vista */
|
|
54
|
+
getConfigColumns: (viewMode: ViewMode) => IViewConfig<any, any>[];
|
|
55
|
+
/** Actualiza la configuración de columnas para una vista */
|
|
56
|
+
updateConfigColumns: (viewMode: ViewMode, config: IViewConfig<any, any>[]) => void;
|
|
57
|
+
}
|
|
58
|
+
export interface UseChangeColumnsConfigParams {
|
|
59
|
+
/** Identificador único del DataGrid */
|
|
60
|
+
id: RowKey;
|
|
61
|
+
/** Callback para guardar cambios en columnas */
|
|
62
|
+
onChangeUserColumns?: OnChangeUserColumns;
|
|
63
|
+
/** Función para actualizar la configuración de columnas */
|
|
64
|
+
updateConfigColumns: (viewMode: ViewMode, config: IViewConfig<any, any>[]) => void;
|
|
65
|
+
}
|
|
66
|
+
export interface UseChangeColumnsConfigReturn {
|
|
67
|
+
/** Función para cambiar la configuración de columnas de una vista */
|
|
68
|
+
onChangeColumnsConfig: (viewMode: ViewMode, newConfig: IViewConfig<any, any>[]) => void;
|
|
69
|
+
}
|
|
70
|
+
export interface UseChangeColumnsOrderParams {
|
|
71
|
+
/** Función para obtener la configuración de columnas de una vista */
|
|
72
|
+
getConfigColumns: (viewMode: ViewMode) => IViewConfig<any, any>[];
|
|
73
|
+
/** Función para cambiar la configuración de columnas */
|
|
74
|
+
onChangeColumnsConfig: (viewMode: ViewMode, newConfig: IViewConfig<any, any>[]) => void;
|
|
75
|
+
}
|
|
76
|
+
export interface UseChangeColumnsOrderReturn {
|
|
77
|
+
/** Función para cambiar el orden de columnas de una vista */
|
|
78
|
+
onChangeColumnsOrder: (viewMode: ViewMode, sourceKey: string, targetKey: string) => void;
|
|
79
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { ImageFormatterProps } from './types';
|
|
2
|
+
/**
|
|
3
|
+
* ImageFormatter
|
|
4
|
+
* Componente para formatear y mostrar una imagen con texto opcional.
|
|
5
|
+
* Fuerza enableIntersectionObserver a false ya que se usa en contextos donde
|
|
6
|
+
* el lazy loading es manejado por el contenedor padre (ej. DataGrid).
|
|
7
|
+
* @param {ImageFormatterProps} props - Las propiedades del componente.
|
|
8
|
+
* @returns JSX.Element
|
|
9
|
+
*/
|
|
10
|
+
export declare function ImageFormatter(props: ImageFormatterProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import { jsxs, Fragment, jsx } from "react/jsx-runtime";
|
|
2
|
+
import { useMemo } from "react";
|
|
3
|
+
import { I as ImageStyled, T as TextImageStyled, R as RootStyled } from "./slots/ImageFormatterSlots.js";
|
|
4
|
+
import { I as ImageFormatterSlots } from "./slots/ImageFormatterEnum.js";
|
|
5
|
+
import clsx from "clsx";
|
|
6
|
+
import { a as getComponentSlotRoot } from "../../../utils/getComponentSlotRoot.js";
|
|
7
|
+
import { a as getPropDataTestId } from "../../../test/getNameDataTestId.js";
|
|
8
|
+
import { I as IMAGE_FORMATTER_KEY_COMPONENT } from "./constants.js";
|
|
9
|
+
function ImageFormatter(props) {
|
|
10
|
+
const { src, alt, text, width, height, cover, dataTestId, className } = props;
|
|
11
|
+
const ownerState = useMemo(
|
|
12
|
+
() => ({
|
|
13
|
+
width,
|
|
14
|
+
height,
|
|
15
|
+
hasDefinedSize: width !== void 0 && height !== void 0,
|
|
16
|
+
cover
|
|
17
|
+
}),
|
|
18
|
+
[width, height, cover]
|
|
19
|
+
);
|
|
20
|
+
const content = useMemo(() => {
|
|
21
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
22
|
+
/* @__PURE__ */ jsx(
|
|
23
|
+
ImageStyled,
|
|
24
|
+
{
|
|
25
|
+
ownerState,
|
|
26
|
+
...getPropDataTestId(
|
|
27
|
+
IMAGE_FORMATTER_KEY_COMPONENT,
|
|
28
|
+
ImageFormatterSlots.image,
|
|
29
|
+
dataTestId
|
|
30
|
+
),
|
|
31
|
+
src,
|
|
32
|
+
alt,
|
|
33
|
+
width,
|
|
34
|
+
height,
|
|
35
|
+
cover,
|
|
36
|
+
enableIntersectionObserver: false
|
|
37
|
+
}
|
|
38
|
+
),
|
|
39
|
+
text && /* @__PURE__ */ jsx(
|
|
40
|
+
TextImageStyled,
|
|
41
|
+
{
|
|
42
|
+
...getPropDataTestId(
|
|
43
|
+
IMAGE_FORMATTER_KEY_COMPONENT,
|
|
44
|
+
ImageFormatterSlots.textImage,
|
|
45
|
+
dataTestId
|
|
46
|
+
),
|
|
47
|
+
variant: "body",
|
|
48
|
+
children: text
|
|
49
|
+
}
|
|
50
|
+
)
|
|
51
|
+
] });
|
|
52
|
+
}, [src, alt, text, width, height, cover, dataTestId, ownerState]);
|
|
53
|
+
return /* @__PURE__ */ jsx(
|
|
54
|
+
RootStyled,
|
|
55
|
+
{
|
|
56
|
+
ownerState,
|
|
57
|
+
className: clsx(
|
|
58
|
+
getComponentSlotRoot(IMAGE_FORMATTER_KEY_COMPONENT),
|
|
59
|
+
className
|
|
60
|
+
),
|
|
61
|
+
...getPropDataTestId(
|
|
62
|
+
IMAGE_FORMATTER_KEY_COMPONENT,
|
|
63
|
+
ImageFormatterSlots.root,
|
|
64
|
+
dataTestId
|
|
65
|
+
),
|
|
66
|
+
children: content
|
|
67
|
+
}
|
|
68
|
+
);
|
|
69
|
+
}
|
|
70
|
+
export {
|
|
71
|
+
ImageFormatter as I
|
|
72
|
+
};
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
const imageFormatterStyles = {
|
|
2
|
+
/**
|
|
3
|
+
* Estilos del root principal
|
|
4
|
+
*/
|
|
5
|
+
root: ({ theme, ownerState }) => ({
|
|
6
|
+
display: "flex",
|
|
7
|
+
alignItems: "center",
|
|
8
|
+
gap: theme.vars.size.baseSpacings.sp2,
|
|
9
|
+
width: "100%",
|
|
10
|
+
...!ownerState?.hasDefinedSize && {
|
|
11
|
+
height: "100%"
|
|
12
|
+
}
|
|
13
|
+
}),
|
|
14
|
+
/**
|
|
15
|
+
* Estilos de la imagen
|
|
16
|
+
*/
|
|
17
|
+
image: ({ theme, ownerState }) => ({
|
|
18
|
+
flexShrink: 0,
|
|
19
|
+
borderRadius: theme.vars.size.borderRadius.r2,
|
|
20
|
+
border: `1px solid ${theme.vars.palette.border.disabled}`,
|
|
21
|
+
...!ownerState?.hasDefinedSize && {
|
|
22
|
+
height: "90%",
|
|
23
|
+
aspectRatio: "1 / 1"
|
|
24
|
+
},
|
|
25
|
+
objectFit: ownerState?.cover ? "cover" : "contain"
|
|
26
|
+
}),
|
|
27
|
+
/**
|
|
28
|
+
* Estilos del texto de la imagen
|
|
29
|
+
*/
|
|
30
|
+
textImage: ({ theme }) => ({
|
|
31
|
+
overflow: "hidden",
|
|
32
|
+
textOverflow: "ellipsis",
|
|
33
|
+
whiteSpace: "nowrap",
|
|
34
|
+
flex: 1,
|
|
35
|
+
"&.M4LTypography-root": {
|
|
36
|
+
color: theme.vars.palette.primary
|
|
37
|
+
}
|
|
38
|
+
})
|
|
39
|
+
};
|
|
40
|
+
export {
|
|
41
|
+
imageFormatterStyles as i
|
|
42
|
+
};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { g as getComponentClasses } from "../../../utils/getComponentSlotRoot.js";
|
|
2
|
+
import { I as ImageFormatterSlots } from "./slots/ImageFormatterEnum.js";
|
|
3
|
+
const IMAGE_FORMATTER_KEY_COMPONENT = "M4LImageFormatter";
|
|
4
|
+
getComponentClasses(
|
|
5
|
+
IMAGE_FORMATTER_KEY_COMPONENT,
|
|
6
|
+
ImageFormatterSlots
|
|
7
|
+
);
|
|
8
|
+
export {
|
|
9
|
+
IMAGE_FORMATTER_KEY_COMPONENT as I
|
|
10
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
var ImageFormatterSlots = /* @__PURE__ */ ((ImageFormatterSlots2) => {
|
|
2
|
+
ImageFormatterSlots2["root"] = "root";
|
|
3
|
+
ImageFormatterSlots2["image"] = "image";
|
|
4
|
+
ImageFormatterSlots2["textImage"] = "textImage";
|
|
5
|
+
return ImageFormatterSlots2;
|
|
6
|
+
})(ImageFormatterSlots || {});
|
|
7
|
+
export {
|
|
8
|
+
ImageFormatterSlots as I
|
|
9
|
+
};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export declare const RootStyled: import('@emotion/styled').StyledComponent<import('@mui/system').MUIStyledCommonProps<import('@mui/material').Theme> & Record<string, unknown> & {
|
|
2
|
+
ownerState?: (Partial<import('..').ImageFormatterOwnerState> & Record<string, unknown>) | undefined;
|
|
3
|
+
}, Pick<import('react').DetailedHTMLProps<import('react').HTMLAttributes<HTMLDivElement>, HTMLDivElement>, keyof import('react').ClassAttributes<HTMLDivElement> | keyof import('react').HTMLAttributes<HTMLDivElement>>, {}>;
|
|
4
|
+
export declare const ImageStyled: import('@emotion/styled').StyledComponent<Pick<import('../../../Image').ImageProps, keyof import('../../../Image').ImageProps> & import('@mui/system').MUIStyledCommonProps<import('@mui/material').Theme> & Record<string, unknown> & {
|
|
5
|
+
ownerState?: (Partial<import('..').ImageFormatterOwnerState> & Record<string, unknown>) | undefined;
|
|
6
|
+
}, {}, {}>;
|
|
7
|
+
export declare const TextImageStyled: import('@emotion/styled').StyledComponent<Pick<Omit<import('../../../mui_extended/Typography/types').TypographyProps, "ref"> & import('react').RefAttributes<HTMLSpanElement>, "size" | "children" | "title" | "component" | "zIndex" | "id" | "disabled" | "paragraph" | "border" | "fontWeight" | "lineHeight" | "letterSpacing" | "fontSize" | "textTransform" | "fontFamily" | "typography" | "flex" | "hidden" | "color" | "left" | "right" | "bottom" | "top" | "ellipsis" | "content" | "style" | "position" | "padding" | "variant" | "borderRadius" | "width" | "display" | "borderColor" | "height" | "gap" | "minHeight" | "margin" | "overflow" | "boxShadow" | "minWidth" | "justifyContent" | "alignItems" | "paddingLeft" | "borderLeft" | "borderTop" | "maxWidth" | "flexDirection" | "paddingRight" | "borderRight" | "flexGrow" | "marginLeft" | "textOverflow" | "borderBottom" | "gridTemplateColumns" | "marginBottom" | "dataTestid" | "alignContent" | "alignSelf" | "boxSizing" | "columnGap" | "flexBasis" | "flexShrink" | "flexWrap" | "fontStyle" | "gridAutoColumns" | "gridAutoFlow" | "gridAutoRows" | "gridTemplateAreas" | "gridTemplateRows" | "justifyItems" | "justifySelf" | "marginBlockEnd" | "marginBlockStart" | "marginInlineEnd" | "marginInlineStart" | "marginRight" | "marginTop" | "maxHeight" | "order" | "paddingBlockEnd" | "paddingBlockStart" | "paddingBottom" | "paddingInlineEnd" | "paddingInlineStart" | "paddingTop" | "rowGap" | "textAlign" | "translate" | "visibility" | "whiteSpace" | "gridArea" | "gridColumn" | "gridRow" | "marginBlock" | "marginInline" | "paddingBlock" | "paddingInline" | "className" | "classes" | "sx" | "p" | "slot" | "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "accessKey" | "autoCapitalize" | "autoFocus" | "contentEditable" | "contextMenu" | "dir" | "draggable" | "enterKeyHint" | "lang" | "nonce" | "spellCheck" | "tabIndex" | "radioGroup" | "role" | "about" | "datatype" | "inlist" | "prefix" | "property" | "rel" | "resource" | "rev" | "typeof" | "vocab" | "autoCorrect" | "autoSave" | "itemProp" | "itemScope" | "itemType" | "itemID" | "itemRef" | "results" | "security" | "unselectable" | "inputMode" | "is" | "exportparts" | "part" | "aria-activedescendant" | "aria-atomic" | "aria-autocomplete" | "aria-braillelabel" | "aria-brailleroledescription" | "aria-busy" | "aria-checked" | "aria-colcount" | "aria-colindex" | "aria-colindextext" | "aria-colspan" | "aria-controls" | "aria-current" | "aria-describedby" | "aria-description" | "aria-details" | "aria-disabled" | "aria-dropeffect" | "aria-errormessage" | "aria-expanded" | "aria-flowto" | "aria-grabbed" | "aria-haspopup" | "aria-hidden" | "aria-invalid" | "aria-keyshortcuts" | "aria-label" | "aria-labelledby" | "aria-level" | "aria-live" | "aria-modal" | "aria-multiline" | "aria-multiselectable" | "aria-orientation" | "aria-owns" | "aria-placeholder" | "aria-posinset" | "aria-pressed" | "aria-readonly" | "aria-relevant" | "aria-required" | "aria-roledescription" | "aria-rowcount" | "aria-rowindex" | "aria-rowindextext" | "aria-rowspan" | "aria-selected" | "aria-setsize" | "aria-sort" | "aria-valuemax" | "aria-valuemin" | "aria-valuenow" | "aria-valuetext" | "dangerouslySetInnerHTML" | "onCopy" | "onCopyCapture" | "onCut" | "onCutCapture" | "onPaste" | "onPasteCapture" | "onCompositionEnd" | "onCompositionEndCapture" | "onCompositionStart" | "onCompositionStartCapture" | "onCompositionUpdate" | "onCompositionUpdateCapture" | "onFocus" | "onFocusCapture" | "onBlur" | "onBlurCapture" | "onChange" | "onChangeCapture" | "onBeforeInput" | "onBeforeInputCapture" | "onInput" | "onInputCapture" | "onReset" | "onResetCapture" | "onSubmit" | "onSubmitCapture" | "onInvalid" | "onInvalidCapture" | "onLoad" | "onLoadCapture" | "onError" | "onErrorCapture" | "onKeyDown" | "onKeyDownCapture" | "onKeyPress" | "onKeyPressCapture" | "onKeyUp" | "onKeyUpCapture" | "onAbort" | "onAbortCapture" | "onCanPlay" | "onCanPlayCapture" | "onCanPlayThrough" | "onCanPlayThroughCapture" | "onDurationChange" | "onDurationChangeCapture" | "onEmptied" | "onEmptiedCapture" | "onEncrypted" | "onEncryptedCapture" | "onEnded" | "onEndedCapture" | "onLoadedData" | "onLoadedDataCapture" | "onLoadedMetadata" | "onLoadedMetadataCapture" | "onLoadStart" | "onLoadStartCapture" | "onPause" | "onPauseCapture" | "onPlay" | "onPlayCapture" | "onPlaying" | "onPlayingCapture" | "onProgress" | "onProgressCapture" | "onRateChange" | "onRateChangeCapture" | "onSeeked" | "onSeekedCapture" | "onSeeking" | "onSeekingCapture" | "onStalled" | "onStalledCapture" | "onSuspend" | "onSuspendCapture" | "onTimeUpdate" | "onTimeUpdateCapture" | "onVolumeChange" | "onVolumeChangeCapture" | "onWaiting" | "onWaitingCapture" | "onAuxClick" | "onAuxClickCapture" | "onClick" | "onClickCapture" | "onContextMenu" | "onContextMenuCapture" | "onDoubleClick" | "onDoubleClickCapture" | "onDrag" | "onDragCapture" | "onDragEnd" | "onDragEndCapture" | "onDragEnter" | "onDragEnterCapture" | "onDragExit" | "onDragExitCapture" | "onDragLeave" | "onDragLeaveCapture" | "onDragOver" | "onDragOverCapture" | "onDragStart" | "onDragStartCapture" | "onDrop" | "onDropCapture" | "onMouseDown" | "onMouseDownCapture" | "onMouseEnter" | "onMouseLeave" | "onMouseMove" | "onMouseMoveCapture" | "onMouseOut" | "onMouseOutCapture" | "onMouseOver" | "onMouseOverCapture" | "onMouseUp" | "onMouseUpCapture" | "onSelect" | "onSelectCapture" | "onTouchCancel" | "onTouchCancelCapture" | "onTouchEnd" | "onTouchEndCapture" | "onTouchMove" | "onTouchMoveCapture" | "onTouchStart" | "onTouchStartCapture" | "onPointerDown" | "onPointerDownCapture" | "onPointerMove" | "onPointerMoveCapture" | "onPointerUp" | "onPointerUpCapture" | "onPointerCancel" | "onPointerCancelCapture" | "onPointerEnter" | "onPointerLeave" | "onPointerOver" | "onPointerOverCapture" | "onPointerOut" | "onPointerOutCapture" | "onGotPointerCapture" | "onGotPointerCaptureCapture" | "onLostPointerCapture" | "onLostPointerCaptureCapture" | "onScroll" | "onScrollCapture" | "onWheel" | "onWheelCapture" | "onAnimationStart" | "onAnimationStartCapture" | "onAnimationEnd" | "onAnimationEndCapture" | "onAnimationIteration" | "onAnimationIterationCapture" | "onTransitionEnd" | "onTransitionEndCapture" | "bgcolor" | "m" | "mt" | "mr" | "mb" | "ml" | "mx" | "marginX" | "my" | "marginY" | "pt" | "pr" | "pb" | "pl" | "px" | "paddingX" | "py" | "paddingY" | "displayPrint" | "align" | "htmlFor" | "gutterBottom" | "noWrap" | "variantMapping" | "skeletonWidth" | "skeletonRows" | keyof import('react').RefAttributes<HTMLSpanElement>> & import('@mui/system').MUIStyledCommonProps<import('@mui/material').Theme> & Record<string, unknown> & {
|
|
8
|
+
ownerState?: (Partial<import('..').ImageFormatterOwnerState> & Record<string, unknown>) | undefined;
|
|
9
|
+
}, {}, {}>;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { styled } from "@mui/material";
|
|
2
|
+
import { I as IMAGE_FORMATTER_KEY_COMPONENT } from "../constants.js";
|
|
3
|
+
import { I as ImageFormatterSlots } from "./ImageFormatterEnum.js";
|
|
4
|
+
import { i as imageFormatterStyles } from "../ImageFormatter.styles.js";
|
|
5
|
+
import { I as Image } from "../../../Image/Image.js";
|
|
6
|
+
import { T as Typography } from "../../../mui_extended/Typography/Typography.js";
|
|
7
|
+
const RootStyled = styled("div", {
|
|
8
|
+
name: IMAGE_FORMATTER_KEY_COMPONENT,
|
|
9
|
+
slot: ImageFormatterSlots.root
|
|
10
|
+
})(imageFormatterStyles.root);
|
|
11
|
+
const ImageStyled = styled(Image, {
|
|
12
|
+
name: IMAGE_FORMATTER_KEY_COMPONENT,
|
|
13
|
+
slot: ImageFormatterSlots.image
|
|
14
|
+
})(imageFormatterStyles.image);
|
|
15
|
+
const TextImageStyled = styled(Typography, {
|
|
16
|
+
name: IMAGE_FORMATTER_KEY_COMPONENT,
|
|
17
|
+
slot: ImageFormatterSlots.textImage
|
|
18
|
+
})(imageFormatterStyles.textImage);
|
|
19
|
+
export {
|
|
20
|
+
ImageStyled as I,
|
|
21
|
+
RootStyled as R,
|
|
22
|
+
TextImageStyled as T
|
|
23
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { M4LOverridesStyleRules } from '../../../@types/augmentations';
|
|
2
|
+
import { ImageFormatterSlots } from './slots/ImageFormatterEnum';
|
|
3
|
+
import { ImageProps } from '../../Image';
|
|
4
|
+
import { IMAGE_FORMATTER_KEY_COMPONENT } from './constants';
|
|
5
|
+
import { Theme } from '@mui/material';
|
|
6
|
+
/**
|
|
7
|
+
* Props del ImageFormatter
|
|
8
|
+
*/
|
|
9
|
+
export interface ImageFormatterProps extends Pick<ImageProps, 'src' | 'alt' | 'width' | 'height' | 'cover' | 'enableIntersectionObserver'> {
|
|
10
|
+
/**
|
|
11
|
+
* Texto de la imagen
|
|
12
|
+
*/
|
|
13
|
+
text?: string;
|
|
14
|
+
/**
|
|
15
|
+
* ID para testing
|
|
16
|
+
*/
|
|
17
|
+
dataTestId?: string;
|
|
18
|
+
/**
|
|
19
|
+
* Clase CSS personalizada
|
|
20
|
+
*/
|
|
21
|
+
className?: string;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Owner state del ImageFormatter
|
|
25
|
+
*/
|
|
26
|
+
export interface ImageFormatterOwnerState {
|
|
27
|
+
/**
|
|
28
|
+
* Ancho de la imagen
|
|
29
|
+
*/
|
|
30
|
+
width?: number | string;
|
|
31
|
+
/**
|
|
32
|
+
* Alto de la imagen
|
|
33
|
+
*/
|
|
34
|
+
height?: number | string;
|
|
35
|
+
/**
|
|
36
|
+
* Si la imagen tiene tamaño definido o debe usar 100% + aspect ratio
|
|
37
|
+
*/
|
|
38
|
+
hasDefinedSize: boolean;
|
|
39
|
+
/**
|
|
40
|
+
* Si es verdadero, la imagen se ajusta al contenedor y se recorta si es necesario.
|
|
41
|
+
*/
|
|
42
|
+
cover?: boolean;
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Tipos de slots disponibles para el ImageFormatter
|
|
46
|
+
*/
|
|
47
|
+
export type ImageFormatterSlotsType = ImageFormatterSlots;
|
|
48
|
+
/**
|
|
49
|
+
* Estilos aplicables al ImageFormatter
|
|
50
|
+
*/
|
|
51
|
+
export type ImageFormatterStyles = M4LOverridesStyleRules<ImageFormatterSlotsType, typeof IMAGE_FORMATTER_KEY_COMPONENT, Theme>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -10,3 +10,4 @@ export * from './DistanceToNowFormatter';
|
|
|
10
10
|
export type { UncertaintyRange } from './UncertaintyFormatter/types';
|
|
11
11
|
export { TagsFormatter } from './TagsFormatter';
|
|
12
12
|
export { ColorFormatter } from './ColorFormatter';
|
|
13
|
+
export { ImageFormatter } from './ImageFormatter';
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
const COOKIE_COLUMNS_WIDTHS = "columns_widths";
|
|
2
2
|
const COOKIE_COLUMNS_CONFIG = "columns_config";
|
|
3
|
+
const COOKIE_VIEW_MODE = "view_mode";
|
|
3
4
|
export {
|
|
4
|
-
|
|
5
|
-
|
|
5
|
+
COOKIE_VIEW_MODE as C,
|
|
6
|
+
COOKIE_COLUMNS_CONFIG as a,
|
|
7
|
+
COOKIE_COLUMNS_WIDTHS as b
|
|
6
8
|
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { useState, useCallback } from "react";
|
|
2
2
|
import { g as getColumnsConfigCookie } from "./helpers.js";
|
|
3
|
-
import { C as
|
|
3
|
+
import { C as COOKIE_VIEW_MODE, a as COOKIE_COLUMNS_CONFIG, b as COOKIE_COLUMNS_WIDTHS } from "./constants.js";
|
|
4
4
|
import { u as useWindowToolsMF } from "../../components/WindowBase/hooks/useWindowToolsMF/index.js";
|
|
5
5
|
const useDataGridPersistence = (props) => {
|
|
6
6
|
const { prefixCookie } = props;
|
|
@@ -8,7 +8,8 @@ const useDataGridPersistence = (props) => {
|
|
|
8
8
|
const [defaultUserColumns] = useState(() => {
|
|
9
9
|
return {
|
|
10
10
|
columnsWidths: getCookie(prefixCookie ? `${prefixCookie}_${COOKIE_COLUMNS_WIDTHS}` : COOKIE_COLUMNS_WIDTHS) || {},
|
|
11
|
-
columnsConfig: getColumnsConfigCookie(getCookie(prefixCookie ? `${prefixCookie}_${COOKIE_COLUMNS_CONFIG}` : COOKIE_COLUMNS_CONFIG)) || []
|
|
11
|
+
columnsConfig: getColumnsConfigCookie(getCookie(prefixCookie ? `${prefixCookie}_${COOKIE_COLUMNS_CONFIG}` : COOKIE_COLUMNS_CONFIG)) || [],
|
|
12
|
+
viewMode: getCookie(prefixCookie ? `${prefixCookie}_${COOKIE_VIEW_MODE}` : COOKIE_VIEW_MODE) || "table"
|
|
12
13
|
};
|
|
13
14
|
});
|
|
14
15
|
const onChangeUserColumns = useCallback((newProps) => {
|
|
@@ -20,6 +21,8 @@ const useDataGridPersistence = (props) => {
|
|
|
20
21
|
setCookie(prefixCookie ? `${prefixCookie}_${COOKIE_COLUMNS_CONFIG}` : COOKIE_COLUMNS_CONFIG, "window", userConfig);
|
|
21
22
|
} else if (reason === "columnsWidths") {
|
|
22
23
|
setCookie(prefixCookie ? `${prefixCookie}_${COOKIE_COLUMNS_WIDTHS}` : COOKIE_COLUMNS_WIDTHS, "window", userConfig);
|
|
24
|
+
} else if (reason === "viewMode") {
|
|
25
|
+
setCookie(prefixCookie ? `${prefixCookie}_${COOKIE_VIEW_MODE}` : COOKIE_VIEW_MODE, "window", userConfig);
|
|
23
26
|
} else {
|
|
24
27
|
setCookie(prefixCookie ? `${prefixCookie}_${reason}` : reason, "window", userConfig);
|
|
25
28
|
}
|