@m4l/components 9.3.34-JT25112025.beta.2 → 9.3.34-JT26112025.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 +40 -111
- package/components/DataGrid/dictionary.d.ts +0 -1
- package/components/DataGrid/dictionary.js +1 -2
- package/components/DataGrid/formatters/ColumnIconFormatter/constants.d.ts +4 -0
- 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/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/hooks/useModalCardDetail.d.ts +1 -1
- package/components/DataGrid/hooks/useModalCardDetail.js +1 -6
- package/components/DataGrid/icons.d.ts +0 -1
- package/components/DataGrid/icons.js +1 -2
- package/components/DataGrid/slots/DataGridEnum.d.ts +1 -4
- package/components/DataGrid/slots/DataGridEnum.js +0 -3
- package/components/DataGrid/slots/DataGridSlot.d.ts +0 -3
- package/components/DataGrid/slots/DataGridSlot.js +33 -48
- package/components/DataGrid/subcomponents/Cards/helpers/scrollToCardElement.js +2 -2
- package/components/DataGrid/subcomponents/Cards/hooks/useCardContent.d.ts +1 -1
- package/components/DataGrid/subcomponents/Cards/hooks/useCardContent.js +5 -47
- package/components/DataGrid/subcomponents/Cards/index.js +19 -9
- package/components/DataGrid/subcomponents/Cards/subcomponents/CardDetails/index.d.ts +1 -1
- package/components/DataGrid/subcomponents/Cards/subcomponents/CardDetails/index.js +15 -59
- package/components/DataGrid/subcomponents/Cards/subcomponents/CardHeader/index.js +1 -1
- package/components/DataGrid/subcomponents/Cards/subcomponents/CardRow/index.d.ts +2 -2
- package/components/DataGrid/subcomponents/Cards/subcomponents/CardRow/index.js +2 -5
- package/components/DataGrid/subcomponents/Cards/types.d.ts +0 -16
- package/components/DataGrid/subcomponents/CheckboxCellAdapter/index.js +1 -1
- package/components/DataGrid/subcomponents/ControlNavigate/ControlNavigate.js +1 -1
- package/components/DataGrid/subcomponents/HeaderActions/index.js +2 -2
- package/components/DataGrid/subcomponents/HeaderActions/subcomponents/RowsCount/index.js +1 -1
- package/components/DataGrid/subcomponents/HeaderActions/subcomponents/Settings/subcomponents/ColumnsConfig/index.js +1 -1
- package/components/DataGrid/subcomponents/HeaderActions/subcomponents/Settings/subcomponents/ColumnsConfigCards/index.js +1 -1
- package/components/DataGrid/subcomponents/HeaderActions/subcomponents/ViewMode/index.js +1 -1
- package/components/DataGrid/subcomponents/Table/index.js +11 -2
- package/components/DataGrid/subcomponents/Table/subcomponents/CheckboxFormatter.js +0 -1
- package/components/DataGrid/subcomponents/Table/subcomponents/CustomIcons.js +14 -39
- package/components/DataGrid/subcomponents/Table/subcomponents/DraggableHeaderRenderer.js +1 -1
- package/components/DataGrid/subcomponents/Table/subcomponents/HeaderRenderClick/HeaderRenderClick.js +1 -1
- package/components/DataGrid/subcomponents/editors/TextEditor/index.js +1 -1
- package/components/DataGrid/tests/helpers/types.d.ts +10 -0
- package/components/DataGrid/types.d.ts +0 -12
- 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/types.d.ts +51 -0
- package/components/formatters/ImageFormatter/types.js +1 -0
- package/components/formatters/index.d.ts +1 -0
- package/index.js +68 -62
- package/package.json +1 -1
- package/components/DataGrid/formatters/ColumnTagsFormatter/tests/ColumnTagsFormatter.test.d.ts +0 -1
- package/components/DataGrid/formatters/ColumnTagsFormatter/tests/useColumnTags.test.d.ts +0 -1
- /package/components/DataGrid/formatters/{ColumnColorFormatter/tests/ColumnColorFormatter.test.d.ts → ColumnImageFormatter/tests/ColumnImageFormatter.test.d.ts} +0 -0
- /package/components/{DataGrid/formatters/ColumnColorFormatter/tests/useColumnColor.test.d.ts → formatters/ImageFormatter/tests/ImageFormatter.test.d.ts} +0 -0
package/@types/export.d.ts
CHANGED
|
@@ -241,5 +241,8 @@ declare module '@mui/material/styles' {
|
|
|
241
241
|
M4LIconsFormatter?: {
|
|
242
242
|
styleOverrides?: ComponentsOverrides<Theme>['M4LIconsFormatter'];
|
|
243
243
|
};
|
|
244
|
+
M4LImageFormatter?: {
|
|
245
|
+
styleOverrides?: ComponentsOverrides<Theme>['M4LImageFormatter'];
|
|
246
|
+
};
|
|
244
247
|
}
|
|
245
248
|
}
|
package/@types/types.d.ts
CHANGED
|
@@ -304,6 +304,10 @@ import {
|
|
|
304
304
|
IconsFormatterOwnerState,
|
|
305
305
|
IconsFormatterSlotsType,
|
|
306
306
|
} from '../components/formatters/IconsFormatter/types';
|
|
307
|
+
import {
|
|
308
|
+
ImageFormatterOwnerState,
|
|
309
|
+
ImageFormatterSlotsType,
|
|
310
|
+
} from '../components/formatters/ImageFormatter';
|
|
307
311
|
|
|
308
312
|
declare module '@mui/material/styles' {
|
|
309
313
|
// Define the slots in the theme
|
|
@@ -397,6 +401,7 @@ declare module '@mui/material/styles' {
|
|
|
397
401
|
M4LMFIsolationApp: MFIsolationAppSlotsType;
|
|
398
402
|
M4LTagsFormatter: TagsFormatterSlotsType;
|
|
399
403
|
M4LIconsFormatter: IconsFormatterSlotsType;
|
|
404
|
+
M4LImageFormatter: ImageFormatterSlotsType;
|
|
400
405
|
}
|
|
401
406
|
interface ComponentsPropsList {
|
|
402
407
|
// Extend ComponentsProps or ComponentsOwnerState(this extend ComponentProps)
|
|
@@ -489,6 +494,7 @@ declare module '@mui/material/styles' {
|
|
|
489
494
|
M4LMFIsolationApp: Partial<MFIsolationAppOwnerState>;
|
|
490
495
|
M4LTagsFormatter: Partial<TagsFormatterOwnerState>;
|
|
491
496
|
M4LIconsFormatter: Partial<IconsFormatterOwnerState>;
|
|
497
|
+
M4LImageFormatter: Partial<ImageFormatterOwnerState>;
|
|
492
498
|
}
|
|
493
499
|
interface Components {
|
|
494
500
|
M4LDynamicFilter?: {
|
|
@@ -946,5 +952,10 @@ declare module '@mui/material/styles' {
|
|
|
946
952
|
styleOverrides?: ComponentsOverrides<Theme>['M4LIconsFormatter'];
|
|
947
953
|
variants?: ComponentsVariants['M4LIconsFormatter'];
|
|
948
954
|
};
|
|
955
|
+
M4LImageFormatter?: {
|
|
956
|
+
defaultProps?: ComponentsPropsList['M4LImageFormatter'];
|
|
957
|
+
styleOverrides?: ComponentsOverrides<Theme>['M4LImageFormatter'];
|
|
958
|
+
variants?: ComponentsVariants['M4LImageFormatter'];
|
|
959
|
+
};
|
|
949
960
|
}
|
|
950
961
|
}
|
|
@@ -24,42 +24,6 @@ const dataGridStyles = {
|
|
|
24
24
|
flex: 1,
|
|
25
25
|
overflow: "hidden",
|
|
26
26
|
"& .rdg .MuiCheckbox-root": {
|
|
27
|
-
overflow: "visible",
|
|
28
|
-
padding: 0,
|
|
29
|
-
...theme.generalSettings.isMobile ? {
|
|
30
|
-
width: theme.vars.size.mobile.small.action,
|
|
31
|
-
height: theme.vars.size.mobile.small.action
|
|
32
|
-
} : {
|
|
33
|
-
width: theme.vars.size.desktop.small.action,
|
|
34
|
-
height: theme.vars.size.desktop.small.action
|
|
35
|
-
},
|
|
36
|
-
display: "inline-flex",
|
|
37
|
-
justifyContent: "center",
|
|
38
|
-
alignItems: "center",
|
|
39
|
-
borderRadius: theme.size.borderRadius.r1,
|
|
40
|
-
"&:hover": {
|
|
41
|
-
backgroundColor: theme.vars.palette.default.hoverOpacity
|
|
42
|
-
},
|
|
43
|
-
"&:active": {
|
|
44
|
-
backgroundColor: theme.vars.palette.default.activeOpacity
|
|
45
|
-
},
|
|
46
|
-
"&.Mui-checked": {
|
|
47
|
-
"&:hover": {
|
|
48
|
-
backgroundColor: theme.vars.palette.primary.hoverOpacity,
|
|
49
|
-
"& .M4LIcon-icon": {
|
|
50
|
-
backgroundColor: theme.vars.palette.primary.hover
|
|
51
|
-
}
|
|
52
|
-
},
|
|
53
|
-
"&:active": {
|
|
54
|
-
backgroundColor: theme.vars.palette.primary.activeOpacity,
|
|
55
|
-
"& .M4LIcon-icon": {
|
|
56
|
-
backgroundColor: theme.vars.palette.primary.active
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
},
|
|
60
|
-
"&.Mui-focusVisible, &:focus-visible": {
|
|
61
|
-
outline: `1px solid ${theme.vars.palette.primary.focusVisible}`
|
|
62
|
-
},
|
|
63
27
|
"& > svg": {
|
|
64
28
|
color: theme.vars.palette.text.secondary
|
|
65
29
|
}
|
|
@@ -306,6 +270,7 @@ const dataGridStyles = {
|
|
|
306
270
|
border: theme.vars.size.borderStroke.container,
|
|
307
271
|
borderColor: theme.vars.palette?.border.secondary,
|
|
308
272
|
"& .rdg ": {
|
|
273
|
+
scrollBehavior: "smooth",
|
|
309
274
|
display: "grid",
|
|
310
275
|
contain: "content",
|
|
311
276
|
boxSizing: "border-box",
|
|
@@ -416,19 +381,33 @@ const dataGridStyles = {
|
|
|
416
381
|
outline: `2px solid var(--rdg-selection-color)`,
|
|
417
382
|
outlineOffset: "-2px"
|
|
418
383
|
},
|
|
419
|
-
"&:has(> .MuiCheckbox-root)": {
|
|
420
|
-
overflow: "visible",
|
|
421
|
-
paddingInline: 0
|
|
422
|
-
},
|
|
423
384
|
"& .checkbox-checked": {
|
|
424
|
-
"&
|
|
425
|
-
|
|
426
|
-
}
|
|
385
|
+
"& path:first-of-type": {
|
|
386
|
+
fill: theme.vars.palette.primary.main
|
|
387
|
+
},
|
|
388
|
+
...getSizeStyles(
|
|
389
|
+
theme,
|
|
390
|
+
ownerState?.size || "medium",
|
|
391
|
+
"base",
|
|
392
|
+
(size) => ({
|
|
393
|
+
minHeight: size,
|
|
394
|
+
height: size
|
|
395
|
+
})
|
|
396
|
+
)
|
|
427
397
|
},
|
|
428
398
|
"& .checkbox-unChecked": {
|
|
429
|
-
"&
|
|
430
|
-
|
|
431
|
-
}
|
|
399
|
+
"& path": {
|
|
400
|
+
fill: theme.vars.palette.text.primary
|
|
401
|
+
},
|
|
402
|
+
...getSizeStyles(
|
|
403
|
+
theme,
|
|
404
|
+
ownerState?.size || "medium",
|
|
405
|
+
"base",
|
|
406
|
+
(size) => ({
|
|
407
|
+
minHeight: size,
|
|
408
|
+
height: size
|
|
409
|
+
})
|
|
410
|
+
)
|
|
432
411
|
},
|
|
433
412
|
"& .rdg-text-editor": {
|
|
434
413
|
textAlign: "inherit",
|
|
@@ -694,54 +673,26 @@ const dataGridStyles = {
|
|
|
694
673
|
* Estilos para el wrapper del CheckboxCellAdapter
|
|
695
674
|
* Aplica los mismos estilos que los checkboxes dentro de celdas rdg
|
|
696
675
|
*/
|
|
697
|
-
checkboxCellWrapper: ({ theme }) => ({
|
|
676
|
+
checkboxCellWrapper: ({ theme, ownerState }) => ({
|
|
698
677
|
"& .checkbox-checked": {
|
|
699
|
-
"&
|
|
700
|
-
|
|
701
|
-
}
|
|
678
|
+
"& path:first-of-type": {
|
|
679
|
+
fill: theme.vars.palette.primary.main
|
|
680
|
+
},
|
|
681
|
+
...getSizeStyles(theme, ownerState?.size || "medium", "base", (size) => ({
|
|
682
|
+
minHeight: size,
|
|
683
|
+
height: size
|
|
684
|
+
}))
|
|
702
685
|
},
|
|
703
686
|
"& .checkbox-unChecked": {
|
|
704
|
-
"&
|
|
705
|
-
|
|
706
|
-
}
|
|
687
|
+
"& path": {
|
|
688
|
+
fill: theme.vars.palette.text.primary
|
|
689
|
+
},
|
|
690
|
+
...getSizeStyles(theme, ownerState?.size || "medium", "base", (size) => ({
|
|
691
|
+
minHeight: size,
|
|
692
|
+
height: size
|
|
693
|
+
}))
|
|
707
694
|
},
|
|
708
695
|
"& .MuiCheckbox-root": {
|
|
709
|
-
overflow: "visible",
|
|
710
|
-
padding: 0,
|
|
711
|
-
...theme.generalSettings.isMobile ? {
|
|
712
|
-
width: theme.vars.size.mobile.small.action,
|
|
713
|
-
height: theme.vars.size.mobile.small.action
|
|
714
|
-
} : {
|
|
715
|
-
width: theme.vars.size.desktop.small.action,
|
|
716
|
-
height: theme.vars.size.desktop.small.action
|
|
717
|
-
},
|
|
718
|
-
display: "inline-flex",
|
|
719
|
-
justifyContent: "center",
|
|
720
|
-
alignItems: "center",
|
|
721
|
-
borderRadius: theme.size.borderRadius.r1,
|
|
722
|
-
"&:hover": {
|
|
723
|
-
backgroundColor: theme.vars.palette.default.hoverOpacity
|
|
724
|
-
},
|
|
725
|
-
"&:active": {
|
|
726
|
-
backgroundColor: theme.vars.palette.default.activeOpacity
|
|
727
|
-
},
|
|
728
|
-
"&.Mui-checked": {
|
|
729
|
-
"&:hover": {
|
|
730
|
-
backgroundColor: theme.vars.palette.primary.hoverOpacity,
|
|
731
|
-
"& .M4LIcon-icon": {
|
|
732
|
-
backgroundColor: theme.vars.palette.primary.hover
|
|
733
|
-
}
|
|
734
|
-
},
|
|
735
|
-
"&:active": {
|
|
736
|
-
backgroundColor: theme.vars.palette.primary.activeOpacity,
|
|
737
|
-
"& .M4LIcon-icon": {
|
|
738
|
-
backgroundColor: theme.vars.palette.primary.active
|
|
739
|
-
}
|
|
740
|
-
}
|
|
741
|
-
},
|
|
742
|
-
"&.Mui-focusVisible, &:focus-visible": {
|
|
743
|
-
outline: `1px solid ${theme.vars.palette.primary.focusVisible}`
|
|
744
|
-
},
|
|
745
696
|
"& > svg": {
|
|
746
697
|
color: theme.vars.palette.text.secondary
|
|
747
698
|
}
|
|
@@ -942,28 +893,6 @@ const dataGridStyles = {
|
|
|
942
893
|
}
|
|
943
894
|
}
|
|
944
895
|
}),
|
|
945
|
-
/**
|
|
946
|
-
* Placeholder editable
|
|
947
|
-
*/
|
|
948
|
-
editablePlaceholder: ({ theme }) => ({
|
|
949
|
-
display: "flex",
|
|
950
|
-
alignItems: "center",
|
|
951
|
-
gap: theme.spacing(1)
|
|
952
|
-
}),
|
|
953
|
-
/**
|
|
954
|
-
* EditLabel
|
|
955
|
-
*/
|
|
956
|
-
editLabel: ({ theme, ownerState }) => ({
|
|
957
|
-
width: "auto",
|
|
958
|
-
opacity: 1,
|
|
959
|
-
transition: "opacity 0.3s ease",
|
|
960
|
-
...getTypographyStyles(
|
|
961
|
-
theme.generalSettings.isMobile,
|
|
962
|
-
ownerState?.size || "medium",
|
|
963
|
-
"body"
|
|
964
|
-
)
|
|
965
|
-
}),
|
|
966
|
-
iconButtonEdit: () => ({}),
|
|
967
896
|
/**
|
|
968
897
|
* Header de la card personalizada (avatar + nombre + email)
|
|
969
898
|
*/
|
|
@@ -37,8 +37,7 @@ const DICTIONARY = {
|
|
|
37
37
|
VIEW_MODE_TABLE: `${DATAGRID_ID_DICTIONARY}.view_mode_table`,
|
|
38
38
|
VIEW_MODE_CARDS: `${DATAGRID_ID_DICTIONARY}.view_mode_cards`,
|
|
39
39
|
TOOLTIP_VIEW_MODE: `${DATAGRID_ID_DICTIONARY}.tooltip_view_mode`,
|
|
40
|
-
DETAILS: `${DATAGRID_ID_DICTIONARY}.details
|
|
41
|
-
EDIT_PLACEHOLDER: `${DATAGRID_ID_DICTIONARY}.edit_placeholder`
|
|
40
|
+
DETAILS: `${DATAGRID_ID_DICTIONARY}.details`
|
|
42
41
|
};
|
|
43
42
|
export {
|
|
44
43
|
DICTIONARY as D,
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { ColumnImageFormatterProps } from './types';
|
|
2
|
+
import { RenderCellProps } from 'react-data-grid';
|
|
3
|
+
/**
|
|
4
|
+
* Componente interno que renderiza la celda y puede usar hooks
|
|
5
|
+
*/
|
|
6
|
+
export declare function ImageFormatterCell<TRow>(props: {
|
|
7
|
+
formatterProps: RenderCellProps<TRow>;
|
|
8
|
+
fieldValue: ColumnImageFormatterProps<TRow>['fieldValue'];
|
|
9
|
+
fieldText: ColumnImageFormatterProps<TRow>['fieldText'];
|
|
10
|
+
width?: ColumnImageFormatterProps<TRow>['width'];
|
|
11
|
+
height?: ColumnImageFormatterProps<TRow>['height'];
|
|
12
|
+
cover?: ColumnImageFormatterProps<TRow>['cover'];
|
|
13
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { jsx, Fragment } from "react/jsx-runtime";
|
|
2
|
+
import { useContext } from "react";
|
|
3
|
+
import { getPropertyByString } from "@m4l/core";
|
|
4
|
+
import { I as IMAGE_SIZES } from "./constants.js";
|
|
5
|
+
import { a as DataGridContext } from "../../contexts/DataGridContext/index.js";
|
|
6
|
+
import { I as ImageFormatter } from "../../../formatters/ImageFormatter/ImageFormatter.js";
|
|
7
|
+
function ImageFormatterCell(props) {
|
|
8
|
+
const { formatterProps, fieldValue, fieldText, width, height, cover } = props;
|
|
9
|
+
const context = useContext(DataGridContext);
|
|
10
|
+
const viewMode = context?.viewMode ?? "cards";
|
|
11
|
+
const hasCustomSize = width !== void 0 && height !== void 0;
|
|
12
|
+
const finalWidth = viewMode === "cards" && hasCustomSize ? width : viewMode === "cards" ? IMAGE_SIZES.cards : void 0;
|
|
13
|
+
const finalHeight = viewMode === "cards" && hasCustomSize ? height : viewMode === "cards" ? IMAGE_SIZES.cards : void 0;
|
|
14
|
+
const src = getPropertyByString(formatterProps.row, fieldValue) ?? void 0;
|
|
15
|
+
const text = fieldText ? getPropertyByString(formatterProps.row, fieldText) ?? void 0 : void 0;
|
|
16
|
+
if (!src) {
|
|
17
|
+
return /* @__PURE__ */ jsx(Fragment, { children: "-" });
|
|
18
|
+
}
|
|
19
|
+
return /* @__PURE__ */ jsx(
|
|
20
|
+
ImageFormatter,
|
|
21
|
+
{
|
|
22
|
+
src,
|
|
23
|
+
alt: text || src,
|
|
24
|
+
width: finalWidth,
|
|
25
|
+
height: finalHeight,
|
|
26
|
+
text,
|
|
27
|
+
cover
|
|
28
|
+
}
|
|
29
|
+
);
|
|
30
|
+
}
|
|
31
|
+
export {
|
|
32
|
+
ImageFormatterCell as I
|
|
33
|
+
};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { RenderCellProps } from 'react-data-grid';
|
|
2
|
+
import { ColumnImageFormatterProps } from './types';
|
|
3
|
+
/**
|
|
4
|
+
* Formatter para mostrar imágenes con o sin texto
|
|
5
|
+
* @param props - Propiedades del formatter
|
|
6
|
+
* @returns Función que recibe RenderCellProps y retorna el ImageFormatter
|
|
7
|
+
*/
|
|
8
|
+
export declare function ColumnImageFormatter<TRow>(props: ColumnImageFormatterProps<TRow>): (formatterProps: RenderCellProps<TRow>) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import { I as ImageFormatterCell } from "./ImageFormatterCell.js";
|
|
3
|
+
function ColumnImageFormatter(props) {
|
|
4
|
+
const { fieldValue, fieldText, cover } = props;
|
|
5
|
+
const width = "width" in props && props.width !== void 0 ? props.width : void 0;
|
|
6
|
+
const height = "height" in props && props.height !== void 0 ? props.height : void 0;
|
|
7
|
+
const formatter = (formatterProps) => {
|
|
8
|
+
return /* @__PURE__ */ jsx(
|
|
9
|
+
ImageFormatterCell,
|
|
10
|
+
{
|
|
11
|
+
formatterProps,
|
|
12
|
+
fieldValue,
|
|
13
|
+
fieldText,
|
|
14
|
+
width,
|
|
15
|
+
height,
|
|
16
|
+
cover
|
|
17
|
+
}
|
|
18
|
+
);
|
|
19
|
+
};
|
|
20
|
+
formatter.__imageFormatterHeight = height ?? 60;
|
|
21
|
+
return formatter;
|
|
22
|
+
}
|
|
23
|
+
export {
|
|
24
|
+
ColumnImageFormatter as C
|
|
25
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { DeepKeyOf } from '../../../../utils/types';
|
|
2
|
+
interface ColumnImageFormatterBaseProps<TRow> {
|
|
3
|
+
/**
|
|
4
|
+
* Campo del row que contiene la URL de la imagen
|
|
5
|
+
*/
|
|
6
|
+
fieldValue: DeepKeyOf<TRow>;
|
|
7
|
+
/**
|
|
8
|
+
* Campo opcional del row que contiene el texto a mostrar junto a la imagen
|
|
9
|
+
*/
|
|
10
|
+
fieldText?: DeepKeyOf<TRow>;
|
|
11
|
+
/**
|
|
12
|
+
* Si es true, la imagen usa object-fit: cover (recorta si es necesario)
|
|
13
|
+
* Si es false o undefined, usa object-fit: contain (muestra completa)
|
|
14
|
+
* @default false
|
|
15
|
+
*/
|
|
16
|
+
cover?: boolean;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Props sin dimensiones personalizadas (usa IMAGE_SIZES.cards por defecto)
|
|
20
|
+
*/
|
|
21
|
+
interface ColumnImageFormatterWithoutSize<TRow> extends ColumnImageFormatterBaseProps<TRow> {
|
|
22
|
+
width?: never;
|
|
23
|
+
height?: never;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Props con dimensiones personalizadas para vista cards
|
|
27
|
+
* IMPORTANTE: width y height deben proporcionarse juntas
|
|
28
|
+
*/
|
|
29
|
+
interface ColumnImageFormatterWithSize<TRow> extends ColumnImageFormatterBaseProps<TRow> {
|
|
30
|
+
/**
|
|
31
|
+
* Ancho personalizado para la imagen en vista cards (en píxeles)
|
|
32
|
+
*/
|
|
33
|
+
width: number;
|
|
34
|
+
/**
|
|
35
|
+
* Alto personalizado para la imagen en vista cards (en píxeles)
|
|
36
|
+
*/
|
|
37
|
+
height: number;
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Props para ColumnImageFormatter
|
|
41
|
+
* Puede tener dimensiones personalizadas (width Y height juntas) o ninguna
|
|
42
|
+
*/
|
|
43
|
+
export type ColumnImageFormatterProps<TRow> = ColumnImageFormatterWithoutSize<TRow> | ColumnImageFormatterWithSize<TRow>;
|
|
44
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { ColumnImageFormatterProps } from './types';
|
|
2
|
+
/**
|
|
3
|
+
* Hook que retorna el formatter para columnas con imágenes en DataGrid
|
|
4
|
+
* @param props - Propiedades del formatter
|
|
5
|
+
* @returns Objeto con el formatter
|
|
6
|
+
*/
|
|
7
|
+
export declare const useColumnImage: <TRow>(props: ColumnImageFormatterProps<TRow>) => {
|
|
8
|
+
formatter: (formatterProps: import('react-data-grid').RenderCellProps<TRow, unknown>) => import("react/jsx-runtime").JSX.Element;
|
|
9
|
+
};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { useState, useRef, useEffect, useMemo } from "react";
|
|
2
|
+
import { deepEqual } from "fast-equals";
|
|
3
|
+
import { C as ColumnImageFormatter } from "./formatter.js";
|
|
4
|
+
const useColumnImage = (props) => {
|
|
5
|
+
const [stateProps, setStateProps] = useState(props);
|
|
6
|
+
const refProps = useRef({ ...props });
|
|
7
|
+
useEffect(() => {
|
|
8
|
+
if (!deepEqual(refProps.current, props)) {
|
|
9
|
+
refProps.current = props;
|
|
10
|
+
setStateProps(props);
|
|
11
|
+
}
|
|
12
|
+
}, [props]);
|
|
13
|
+
return useMemo(
|
|
14
|
+
() => ({
|
|
15
|
+
formatter: ColumnImageFormatter(stateProps)
|
|
16
|
+
}),
|
|
17
|
+
[stateProps]
|
|
18
|
+
);
|
|
19
|
+
};
|
|
20
|
+
export {
|
|
21
|
+
useColumnImage as u
|
|
22
|
+
};
|
|
@@ -3,4 +3,4 @@ import { UseModalDetailProps } from '../types';
|
|
|
3
3
|
* Hook que renderiza el modal de detalle para cualquier vista
|
|
4
4
|
* mostrando TODAS las columnas sin excepción
|
|
5
5
|
*/
|
|
6
|
-
export declare const useModalDetail: <TRow>({ columns, viewMode, onRowsChange,
|
|
6
|
+
export declare const useModalDetail: <TRow>({ columns, viewMode, onRowsChange, }: UseModalDetailProps<TRow>) => (row: TRow) => void;
|
|
@@ -14,8 +14,7 @@ import { A as ActionCancel } from "../../CommonActions/components/ActionCancel/A
|
|
|
14
14
|
const useModalDetail = ({
|
|
15
15
|
columns,
|
|
16
16
|
viewMode,
|
|
17
|
-
onRowsChange
|
|
18
|
-
rows
|
|
17
|
+
onRowsChange
|
|
19
18
|
}) => {
|
|
20
19
|
const { getConfigColumns, size } = useDataGrid();
|
|
21
20
|
const { openModal, closeModal } = useModal();
|
|
@@ -25,7 +24,6 @@ const useModalDetail = ({
|
|
|
25
24
|
const handleOpenDetail = useCallback(
|
|
26
25
|
(row) => {
|
|
27
26
|
const viewColumnsConfig = getConfigColumns(viewMode);
|
|
28
|
-
const rowIndex = rows.findIndex((r) => r === row);
|
|
29
27
|
openModal({
|
|
30
28
|
initialWidth: 500,
|
|
31
29
|
initialHeight: 680,
|
|
@@ -44,8 +42,6 @@ const useModalDetail = ({
|
|
|
44
42
|
CardDetails,
|
|
45
43
|
{
|
|
46
44
|
row,
|
|
47
|
-
rows,
|
|
48
|
-
rowIndex,
|
|
49
45
|
columns,
|
|
50
46
|
viewColumnsConfig,
|
|
51
47
|
onRowsChange,
|
|
@@ -60,7 +56,6 @@ const useModalDetail = ({
|
|
|
60
56
|
},
|
|
61
57
|
[
|
|
62
58
|
columns,
|
|
63
|
-
rows,
|
|
64
59
|
onRowsChange,
|
|
65
60
|
size,
|
|
66
61
|
getConfigColumns,
|
|
@@ -23,8 +23,7 @@ const pathIcons = {
|
|
|
23
23
|
viewTable: "frontend/components/data_grid/assets/icons/table.svg",
|
|
24
24
|
viewCards: "frontend/components/data_grid/assets/icons/card.svg",
|
|
25
25
|
info: "frontend/components/data_grid/assets/icons/info.svg",
|
|
26
|
-
expanded: "frontend/components/data_grid/assets/icons/expanded.svg"
|
|
27
|
-
edit: "frontend/components/EditLabel/assets/icons/pencil.svg"
|
|
26
|
+
expanded: "frontend/components/data_grid/assets/icons/expanded.svg"
|
|
28
27
|
};
|
|
29
28
|
export {
|
|
30
29
|
pathIcons as p
|
|
@@ -50,10 +50,7 @@ export declare enum TableSlots {
|
|
|
50
50
|
customCardFieldContent = "customCardFieldContent",
|
|
51
51
|
customCardIconContainer = "customCardIconContainer",
|
|
52
52
|
checkboxCellWrapper = "checkboxCellWrapper",
|
|
53
|
-
editorCellWrapper = "editorCellWrapper"
|
|
54
|
-
editablePlaceholder = "editablePlaceholder",
|
|
55
|
-
editLabel = "editLabel",
|
|
56
|
-
iconButtonEdit = "iconButtonEdit"
|
|
53
|
+
editorCellWrapper = "editorCellWrapper"
|
|
57
54
|
}
|
|
58
55
|
export declare enum TextEditorSlots {
|
|
59
56
|
inputTexEditor = "inputTexEditor"
|
|
@@ -54,9 +54,6 @@ var TableSlots = /* @__PURE__ */ ((TableSlots2) => {
|
|
|
54
54
|
TableSlots2["customCardIconContainer"] = "customCardIconContainer";
|
|
55
55
|
TableSlots2["checkboxCellWrapper"] = "checkboxCellWrapper";
|
|
56
56
|
TableSlots2["editorCellWrapper"] = "editorCellWrapper";
|
|
57
|
-
TableSlots2["editablePlaceholder"] = "editablePlaceholder";
|
|
58
|
-
TableSlots2["editLabel"] = "editLabel";
|
|
59
|
-
TableSlots2["iconButtonEdit"] = "iconButtonEdit";
|
|
60
57
|
return TableSlots2;
|
|
61
58
|
})(TableSlots || {});
|
|
62
59
|
var TextEditorSlots = /* @__PURE__ */ ((TextEditorSlots2) => {
|
|
@@ -76,9 +76,6 @@ export declare const ButtonHeaderActionsStyled: import('@emotion/styled').Styled
|
|
|
76
76
|
export declare const NameColumnIconStyled: import('@emotion/styled').StyledComponent<any, Pick<import('react').DetailedHTMLProps<import('react').HTMLAttributes<HTMLDivElement>, HTMLDivElement>, keyof import('react').ClassAttributes<HTMLDivElement> | keyof import('react').HTMLAttributes<HTMLDivElement>>, {}>;
|
|
77
77
|
export declare const IconColumnStyled: import('@emotion/styled').StyledComponent<any, Pick<import('react').DetailedHTMLProps<import('react').HTMLAttributes<HTMLDivElement>, HTMLDivElement>, keyof import('react').ClassAttributes<HTMLDivElement> | keyof import('react').HTMLAttributes<HTMLDivElement>>, {}>;
|
|
78
78
|
export declare const NameColumnStyled: import('@emotion/styled').StyledComponent<any, Pick<import('react').DetailedHTMLProps<import('react').HTMLAttributes<HTMLDivElement>, HTMLDivElement>, keyof import('react').ClassAttributes<HTMLDivElement> | keyof import('react').HTMLAttributes<HTMLDivElement>>, {}>;
|
|
79
|
-
export declare const EditablePlaceholderStyled: import('@emotion/styled').StyledComponent<any, Pick<import('react').DetailedHTMLProps<import('react').HTMLAttributes<HTMLDivElement>, HTMLDivElement>, keyof import('react').ClassAttributes<HTMLDivElement> | keyof import('react').HTMLAttributes<HTMLDivElement>>, {}>;
|
|
80
|
-
export declare const EditLabelStyled: import('@emotion/styled').StyledComponent<any, {}, {}>;
|
|
81
|
-
export declare const IconButtonEditStyled: import('@emotion/styled').StyledComponent<any, {}, {}>;
|
|
82
79
|
/**
|
|
83
80
|
* ****************
|
|
84
81
|
* Slots TextEditor
|