@m4l/components 9.4.5 → 9.4.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/components/DataGrid/Datagrid.styles.js +142 -62
- package/components/DataGrid/contexts/DataGridContext/index.js +3 -0
- package/components/DataGrid/dictionary.d.ts +1 -0
- package/components/DataGrid/dictionary.js +2 -1
- package/components/DataGrid/formatters/ColumnColorFormatter/tests/ColumnColorFormatter.test.d.ts +1 -0
- package/components/DataGrid/formatters/ColumnColorFormatter/tests/useColumnColor.test.d.ts +1 -0
- package/components/DataGrid/formatters/ColumnTagsFormatter/tests/ColumnTagsFormatter.test.d.ts +1 -0
- package/components/DataGrid/formatters/ColumnTagsFormatter/tests/useColumnTags.test.d.ts +1 -0
- package/components/DataGrid/hooks/useModalCardDetail.d.ts +1 -1
- package/components/DataGrid/hooks/useModalCardDetail.js +6 -1
- package/components/DataGrid/icons.d.ts +1 -0
- package/components/DataGrid/icons.js +2 -1
- package/components/DataGrid/slots/DataGridEnum.d.ts +4 -1
- package/components/DataGrid/slots/DataGridEnum.js +3 -0
- package/components/DataGrid/slots/DataGridSlot.d.ts +3 -0
- package/components/DataGrid/slots/DataGridSlot.js +48 -33
- package/components/DataGrid/subcomponents/Cards/hooks/useCardContent.d.ts +1 -1
- package/components/DataGrid/subcomponents/Cards/hooks/useCardContent.js +47 -5
- package/components/DataGrid/subcomponents/Cards/index.js +6 -3
- package/components/DataGrid/subcomponents/Cards/subcomponents/CardDetails/index.d.ts +1 -1
- package/components/DataGrid/subcomponents/Cards/subcomponents/CardDetails/index.js +57 -15
- 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 +5 -1
- package/components/DataGrid/subcomponents/Cards/types.d.ts +16 -0
- 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 +1 -1
- package/components/DataGrid/subcomponents/Table/subcomponents/CheckboxFormatter.js +1 -0
- package/components/DataGrid/subcomponents/Table/subcomponents/CustomIcons.js +39 -14
- 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/types.d.ts +12 -0
- package/components/formatters/ImageFormatter/ImageFormatter.styles.js +1 -0
- package/package.json +1 -1
- package/components/DataGrid/formatters/ColumnIconFormatter/constants.d.ts +0 -4
|
@@ -24,6 +24,42 @@ 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
|
+
"& ..": {
|
|
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
|
+
},
|
|
27
63
|
"& > svg": {
|
|
28
64
|
color: theme.vars.palette.text.secondary
|
|
29
65
|
}
|
|
@@ -212,7 +248,7 @@ const dataGridStyles = {
|
|
|
212
248
|
* Estilos el el input editor del DataGrid.
|
|
213
249
|
* *****************************************
|
|
214
250
|
*/
|
|
215
|
-
inputTexEditor: ({ theme }) => ({
|
|
251
|
+
inputTexEditor: ({ theme, ownerState }) => ({
|
|
216
252
|
appearance: "none",
|
|
217
253
|
boxSizing: "border-box",
|
|
218
254
|
inlineSize: "100%",
|
|
@@ -222,13 +258,19 @@ const dataGridStyles = {
|
|
|
222
258
|
textAlign: "right",
|
|
223
259
|
fontFamily: "inherit",
|
|
224
260
|
background: "transparent",
|
|
261
|
+
border: `1px solid ${theme.vars.palette?.border.secondary}`,
|
|
262
|
+
borderRadius: theme.vars.size.borderRadius["r1-5"],
|
|
263
|
+
...getSizeStyles(theme, ownerState?.size || "medium", "case", (size) => ({
|
|
264
|
+
height: size
|
|
265
|
+
})),
|
|
266
|
+
padding: theme.vars.size.baseSpacings.sp1,
|
|
267
|
+
outline: "none",
|
|
225
268
|
"&:focus": {
|
|
226
269
|
outline: "none",
|
|
227
|
-
border:
|
|
270
|
+
border: `1px solid ${theme.vars.palette?.border.secondary}`,
|
|
228
271
|
boxShadow: "none"
|
|
229
272
|
},
|
|
230
273
|
"&:hover": {
|
|
231
|
-
border: "none",
|
|
232
274
|
outline: "none"
|
|
233
275
|
},
|
|
234
276
|
"&::placeholder": {
|
|
@@ -388,39 +430,25 @@ const dataGridStyles = {
|
|
|
388
430
|
// outline: `2px solid var(--rdg-selection-color)`,
|
|
389
431
|
// outlineOffset: '-2px',
|
|
390
432
|
},
|
|
433
|
+
"&:has(> .MuiCheckbox-root)": {
|
|
434
|
+
overflow: "visible",
|
|
435
|
+
paddingInline: 0
|
|
436
|
+
},
|
|
391
437
|
"& .checkbox-checked": {
|
|
392
|
-
"&
|
|
393
|
-
|
|
394
|
-
}
|
|
395
|
-
...getSizeStyles(
|
|
396
|
-
theme,
|
|
397
|
-
ownerState?.size || "medium",
|
|
398
|
-
"base",
|
|
399
|
-
(size) => ({
|
|
400
|
-
minHeight: size,
|
|
401
|
-
height: size
|
|
402
|
-
})
|
|
403
|
-
)
|
|
438
|
+
"& .M4LIcon-icon": {
|
|
439
|
+
backgroundColor: theme.vars.palette.primary.enabled
|
|
440
|
+
}
|
|
404
441
|
},
|
|
405
442
|
"& .checkbox-unChecked": {
|
|
406
|
-
"&
|
|
407
|
-
|
|
408
|
-
}
|
|
409
|
-
...getSizeStyles(
|
|
410
|
-
theme,
|
|
411
|
-
ownerState?.size || "medium",
|
|
412
|
-
"base",
|
|
413
|
-
(size) => ({
|
|
414
|
-
minHeight: size,
|
|
415
|
-
height: size
|
|
416
|
-
})
|
|
417
|
-
)
|
|
443
|
+
"& .M4LIcon-icon": {
|
|
444
|
+
backgroundColor: theme.vars.palette.text.primary
|
|
445
|
+
}
|
|
418
446
|
},
|
|
419
447
|
"& .rdg-text-editor": {
|
|
420
448
|
textAlign: "inherit",
|
|
421
449
|
color: theme.vars.palette.text.secondary,
|
|
422
450
|
padding: `${theme.vars.size.baseSpacings.sp0} ${theme.vars.size.baseSpacings.sp2}`,
|
|
423
|
-
border: theme.vars.size.baseSpacings.sp0,
|
|
451
|
+
// border: theme.vars.size.baseSpacings.sp0,
|
|
424
452
|
borderTop: "0.5px solid",
|
|
425
453
|
//Se deja el valor directamente porque no está tokenizado
|
|
426
454
|
borderBottom: theme.vars.size.borderStroke.container,
|
|
@@ -428,7 +456,7 @@ const dataGridStyles = {
|
|
|
428
456
|
//Se deja el valor directamente porque no está tokenizado
|
|
429
457
|
borderRight: "0.5px solid",
|
|
430
458
|
//Se deja el valor directamente porque no está tokenizado
|
|
431
|
-
borderColor: `${theme.vars.palette?.border.
|
|
459
|
+
borderColor: `${theme.vars.palette?.border.secondary} !important`,
|
|
432
460
|
...theme.colorSchemes.finalTheme.typography.body
|
|
433
461
|
},
|
|
434
462
|
"&:has(> .M4LRadio-root)": {
|
|
@@ -684,26 +712,54 @@ const dataGridStyles = {
|
|
|
684
712
|
* Estilos para el wrapper del CheckboxCellAdapter
|
|
685
713
|
* Aplica los mismos estilos que los checkboxes dentro de celdas rdg
|
|
686
714
|
*/
|
|
687
|
-
checkboxCellWrapper: ({ theme
|
|
715
|
+
checkboxCellWrapper: ({ theme }) => ({
|
|
688
716
|
"& .checkbox-checked": {
|
|
689
|
-
"&
|
|
690
|
-
|
|
691
|
-
}
|
|
692
|
-
...getSizeStyles(theme, ownerState?.size || "medium", "base", (size) => ({
|
|
693
|
-
minHeight: size,
|
|
694
|
-
height: size
|
|
695
|
-
}))
|
|
717
|
+
"& .M4LIcon-icon": {
|
|
718
|
+
backgroundColor: theme.vars.palette.primary.enabled
|
|
719
|
+
}
|
|
696
720
|
},
|
|
697
721
|
"& .checkbox-unChecked": {
|
|
698
|
-
"&
|
|
699
|
-
|
|
700
|
-
}
|
|
701
|
-
...getSizeStyles(theme, ownerState?.size || "medium", "base", (size) => ({
|
|
702
|
-
minHeight: size,
|
|
703
|
-
height: size
|
|
704
|
-
}))
|
|
722
|
+
"& .M4LIcon-icon": {
|
|
723
|
+
backgroundColor: theme.vars.palette.text.primary
|
|
724
|
+
}
|
|
705
725
|
},
|
|
706
726
|
"& .MuiCheckbox-root": {
|
|
727
|
+
overflow: "visible",
|
|
728
|
+
padding: 0,
|
|
729
|
+
...theme.generalSettings.isMobile ? {
|
|
730
|
+
width: theme.vars.size.mobile.small.action,
|
|
731
|
+
height: theme.vars.size.mobile.small.action
|
|
732
|
+
} : {
|
|
733
|
+
width: theme.vars.size.desktop.small.action,
|
|
734
|
+
height: theme.vars.size.desktop.small.action
|
|
735
|
+
},
|
|
736
|
+
display: "inline-flex",
|
|
737
|
+
justifyContent: "center",
|
|
738
|
+
alignItems: "center",
|
|
739
|
+
borderRadius: theme.size.borderRadius.r1,
|
|
740
|
+
"&:hover": {
|
|
741
|
+
backgroundColor: theme.vars.palette.default.hoverOpacity
|
|
742
|
+
},
|
|
743
|
+
"&:active": {
|
|
744
|
+
backgroundColor: theme.vars.palette.default.activeOpacity
|
|
745
|
+
},
|
|
746
|
+
"&.Mui-checked": {
|
|
747
|
+
"&:hover": {
|
|
748
|
+
backgroundColor: theme.vars.palette.primary.hoverOpacity,
|
|
749
|
+
"& .M4LIcon-icon": {
|
|
750
|
+
backgroundColor: theme.vars.palette.primary.hover
|
|
751
|
+
}
|
|
752
|
+
},
|
|
753
|
+
"&:active": {
|
|
754
|
+
backgroundColor: theme.vars.palette.primary.activeOpacity,
|
|
755
|
+
"& .M4LIcon-icon": {
|
|
756
|
+
backgroundColor: theme.vars.palette.primary.active
|
|
757
|
+
}
|
|
758
|
+
}
|
|
759
|
+
},
|
|
760
|
+
"&.Mui-focusVisible, &:focus-visible": {
|
|
761
|
+
outline: `1px solid ${theme.vars.palette.primary.focusVisible}`
|
|
762
|
+
},
|
|
707
763
|
"& > svg": {
|
|
708
764
|
color: theme.vars.palette.text.secondary
|
|
709
765
|
}
|
|
@@ -744,7 +800,10 @@ const dataGridStyles = {
|
|
|
744
800
|
* Contenedor de los cards
|
|
745
801
|
*/
|
|
746
802
|
cardsContainer: () => ({
|
|
747
|
-
|
|
803
|
+
flexGrow: 1,
|
|
804
|
+
flexShrink: 1,
|
|
805
|
+
flexBasis: 0,
|
|
806
|
+
minHeight: 0,
|
|
748
807
|
overflow: "auto",
|
|
749
808
|
"& > .M4LContainerFlow-root": {
|
|
750
809
|
alignItems: "start"
|
|
@@ -882,33 +941,54 @@ const dataGridStyles = {
|
|
|
882
941
|
width: "100%",
|
|
883
942
|
textAlign: "inherit",
|
|
884
943
|
color: theme.vars.palette.text.secondary,
|
|
885
|
-
padding: `${theme.vars.size.baseSpacings.sp0} ${theme.vars.size.baseSpacings.
|
|
886
|
-
border: theme.vars.
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
borderLeft: "0.5px solid",
|
|
890
|
-
borderRight: "0.5px solid",
|
|
891
|
-
borderColor: "transparent",
|
|
944
|
+
padding: `${theme.vars.size.baseSpacings.sp0} ${theme.vars.size.baseSpacings.sp1}`,
|
|
945
|
+
border: `1px solid ${theme.vars.palette.border.secondary}`,
|
|
946
|
+
borderRadius: theme.vars.size.borderRadius["r1-5"],
|
|
947
|
+
outline: "none",
|
|
892
948
|
...theme.colorSchemes.finalTheme.typography.body,
|
|
949
|
+
...getSizeStyles(theme, ownerState?.size || "medium", "case", (size) => ({
|
|
950
|
+
height: size
|
|
951
|
+
})),
|
|
893
952
|
"&:focus": {
|
|
894
|
-
|
|
895
|
-
borderBottom: theme.vars.size.borderStroke.container,
|
|
896
|
-
borderLeft: "0.5px solid",
|
|
897
|
-
borderRight: "0.5px solid",
|
|
898
|
-
borderColor: `${theme.vars.palette.primary.focusVisible} !important`,
|
|
953
|
+
border: `1px solid ${theme.vars.palette.border.secondary}`,
|
|
899
954
|
outline: "none",
|
|
900
955
|
boxShadow: "none"
|
|
901
956
|
},
|
|
902
957
|
"&:hover": {
|
|
903
|
-
|
|
904
|
-
borderBottom: theme.vars.size.borderStroke.container,
|
|
905
|
-
borderLeft: "0.5px solid",
|
|
906
|
-
borderRight: "0.5px solid",
|
|
907
|
-
borderColor: "transparent",
|
|
958
|
+
border: `1px solid ${theme.vars.palette.border.secondary}`,
|
|
908
959
|
outline: "none"
|
|
909
960
|
}
|
|
910
961
|
}
|
|
911
962
|
}),
|
|
963
|
+
/**
|
|
964
|
+
* Placeholder editable
|
|
965
|
+
*/
|
|
966
|
+
editablePlaceholder: ({ theme }) => ({
|
|
967
|
+
display: "flex",
|
|
968
|
+
alignItems: "center",
|
|
969
|
+
gap: theme.vars.size.baseSpacings.sp1
|
|
970
|
+
}),
|
|
971
|
+
/**
|
|
972
|
+
* EditLabel
|
|
973
|
+
*/
|
|
974
|
+
editLabel: ({ theme, ownerState }) => ({
|
|
975
|
+
width: "auto",
|
|
976
|
+
opacity: 1,
|
|
977
|
+
transition: "opacity 0.3s ease",
|
|
978
|
+
...getTypographyStyles(
|
|
979
|
+
theme.generalSettings.isMobile,
|
|
980
|
+
ownerState?.size || "medium",
|
|
981
|
+
"body"
|
|
982
|
+
)
|
|
983
|
+
}),
|
|
984
|
+
/**
|
|
985
|
+
* Botón para mostrar el input en los editores (cards)
|
|
986
|
+
*/
|
|
987
|
+
iconButtonEdit: ({ theme }) => ({
|
|
988
|
+
"& .M4LIcon-icon": {
|
|
989
|
+
backgroundColor: `${theme.vars.palette.text.secondary} !important`
|
|
990
|
+
}
|
|
991
|
+
}),
|
|
912
992
|
/**
|
|
913
993
|
* Header de la card personalizada (avatar + nombre + email)
|
|
914
994
|
*/
|
|
@@ -182,6 +182,9 @@ function DataGridProvider(props) {
|
|
|
182
182
|
setViewModeState(
|
|
183
183
|
getViewMode(id, resolvedDefaultConfig, defaultViewMode) ?? "table"
|
|
184
184
|
);
|
|
185
|
+
setViewModeState(
|
|
186
|
+
getViewMode(id, resolvedDefaultConfig, defaultViewMode) ?? "table"
|
|
187
|
+
);
|
|
185
188
|
updateConfigColumns(
|
|
186
189
|
"table",
|
|
187
190
|
getInitialColumnsConfig(
|
|
@@ -37,7 +37,8 @@ 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
|
|
40
|
+
DETAILS: `${DATAGRID_ID_DICTIONARY}.details`,
|
|
41
|
+
EDIT_PLACEHOLDER: `${DATAGRID_ID_DICTIONARY}.edit_placeholder`
|
|
41
42
|
};
|
|
42
43
|
export {
|
|
43
44
|
DICTIONARY as D,
|
package/components/DataGrid/formatters/ColumnColorFormatter/tests/ColumnColorFormatter.test.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/components/DataGrid/formatters/ColumnTagsFormatter/tests/ColumnTagsFormatter.test.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -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, }: UseModalDetailProps<TRow>) => (row: TRow) => void;
|
|
6
|
+
export declare const useModalDetail: <TRow>({ columns, viewMode, onRowsChange, rows, }: UseModalDetailProps<TRow>) => (row: TRow) => void;
|
|
@@ -14,7 +14,8 @@ import { A as ActionCancel } from "../../CommonActions/components/ActionCancel/A
|
|
|
14
14
|
const useModalDetail = ({
|
|
15
15
|
columns,
|
|
16
16
|
viewMode,
|
|
17
|
-
onRowsChange
|
|
17
|
+
onRowsChange,
|
|
18
|
+
rows
|
|
18
19
|
}) => {
|
|
19
20
|
const { getConfigColumns, size } = useDataGrid();
|
|
20
21
|
const { openModal, closeModal } = useModal();
|
|
@@ -24,6 +25,7 @@ const useModalDetail = ({
|
|
|
24
25
|
const handleOpenDetail = useCallback(
|
|
25
26
|
(row) => {
|
|
26
27
|
const viewColumnsConfig = getConfigColumns(viewMode);
|
|
28
|
+
const rowIndex = rows.findIndex((r) => r === row);
|
|
27
29
|
openModal({
|
|
28
30
|
initialWidth: 500,
|
|
29
31
|
initialHeight: 680,
|
|
@@ -42,6 +44,8 @@ const useModalDetail = ({
|
|
|
42
44
|
CardDetails,
|
|
43
45
|
{
|
|
44
46
|
row,
|
|
47
|
+
rows,
|
|
48
|
+
rowIndex,
|
|
45
49
|
columns,
|
|
46
50
|
viewColumnsConfig,
|
|
47
51
|
onRowsChange,
|
|
@@ -56,6 +60,7 @@ const useModalDetail = ({
|
|
|
56
60
|
},
|
|
57
61
|
[
|
|
58
62
|
columns,
|
|
63
|
+
rows,
|
|
59
64
|
onRowsChange,
|
|
60
65
|
size,
|
|
61
66
|
getConfigColumns,
|
|
@@ -23,7 +23,8 @@ 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"
|
|
26
|
+
expanded: "frontend/components/data_grid/assets/icons/expanded.svg",
|
|
27
|
+
edit: "frontend/components/EditLabel/assets/icons/pencil.svg"
|
|
27
28
|
};
|
|
28
29
|
export {
|
|
29
30
|
pathIcons as p
|
|
@@ -50,7 +50,10 @@ export declare enum TableSlots {
|
|
|
50
50
|
customCardFieldContent = "customCardFieldContent",
|
|
51
51
|
customCardIconContainer = "customCardIconContainer",
|
|
52
52
|
checkboxCellWrapper = "checkboxCellWrapper",
|
|
53
|
-
editorCellWrapper = "editorCellWrapper"
|
|
53
|
+
editorCellWrapper = "editorCellWrapper",
|
|
54
|
+
editablePlaceholder = "editablePlaceholder",
|
|
55
|
+
editLabel = "editLabel",
|
|
56
|
+
iconButtonEdit = "iconButtonEdit"
|
|
54
57
|
}
|
|
55
58
|
export declare enum TextEditorSlots {
|
|
56
59
|
inputTexEditor = "inputTexEditor"
|
|
@@ -54,6 +54,9 @@ 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";
|
|
57
60
|
return TableSlots2;
|
|
58
61
|
})(TableSlots || {});
|
|
59
62
|
var TextEditorSlots = /* @__PURE__ */ ((TextEditorSlots2) => {
|
|
@@ -76,6 +76,9 @@ 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, {}, {}>;
|
|
79
82
|
/**
|
|
80
83
|
* ****************
|
|
81
84
|
* Slots TextEditor
|
|
@@ -6,6 +6,7 @@ import { d as dataGridStyles } from "../Datagrid.styles.js";
|
|
|
6
6
|
import { I as Icon } from "../../Icon/Icon.js";
|
|
7
7
|
import { C as Card } from "../../Card/Card.js";
|
|
8
8
|
import { T as Typography } from "../../mui_extended/Typography/Typography.js";
|
|
9
|
+
import { I as IconButton } from "../../mui_extended/IconButton/IconButton.js";
|
|
9
10
|
const DataGridRootStyled = styled("div", {
|
|
10
11
|
name: DATAGRID_PREFIX_NAME,
|
|
11
12
|
slot: DataGridSlots.datagridRoot
|
|
@@ -206,6 +207,18 @@ const NameColumnStyled = styled("div", {
|
|
|
206
207
|
name: DATAGRID_PREFIX_NAME,
|
|
207
208
|
slot: TableSlots.nameColumn
|
|
208
209
|
})(dataGridStyles.nameColumn);
|
|
210
|
+
const EditablePlaceholderStyled = styled("div", {
|
|
211
|
+
name: DATAGRID_PREFIX_NAME,
|
|
212
|
+
slot: TableSlots.editablePlaceholder
|
|
213
|
+
})(dataGridStyles.editablePlaceholder);
|
|
214
|
+
styled(Typography, {
|
|
215
|
+
name: DATAGRID_PREFIX_NAME,
|
|
216
|
+
slot: TableSlots.editLabel
|
|
217
|
+
})(dataGridStyles.editLabel);
|
|
218
|
+
const IconButtonEditStyled = styled(IconButton, {
|
|
219
|
+
name: DATAGRID_PREFIX_NAME,
|
|
220
|
+
slot: TableSlots.iconButtonEdit
|
|
221
|
+
})(dataGridStyles.iconButtonEdit);
|
|
209
222
|
const InputTextEditorStyled = styled("input", {
|
|
210
223
|
name: DATAGRID_PREFIX_NAME,
|
|
211
224
|
slot: TextEditorSlots.inputTexEditor
|
|
@@ -220,49 +233,51 @@ styled("div", {
|
|
|
220
233
|
})(dataGridStyles.columnIconFormatter);
|
|
221
234
|
export {
|
|
222
235
|
ActionsRootStyled as A,
|
|
223
|
-
|
|
236
|
+
TableContainerStyled as B,
|
|
224
237
|
CustomHeaderStyled as C,
|
|
225
238
|
DataGridRootStyled as D,
|
|
226
239
|
EditorCellWrapperStyled as E,
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
240
|
+
NameColumnStyled as F,
|
|
241
|
+
IconColumnStyled as G,
|
|
242
|
+
DraggableHeaderRootStyled as H,
|
|
243
|
+
IconButtonEditStyled as I,
|
|
244
|
+
ButtonHeaderActionsStyled as J,
|
|
245
|
+
DraggableWrapperInputBaseStyled as K,
|
|
233
246
|
LabelHeaderColumnStyled as L,
|
|
234
|
-
|
|
247
|
+
IconSearchStyled as M,
|
|
235
248
|
NameColumnIconStyled as N,
|
|
236
|
-
|
|
237
|
-
|
|
249
|
+
HeaderInputBaseStyled as O,
|
|
250
|
+
MenuListStyled as P,
|
|
251
|
+
HeaderRenderClickStyled as Q,
|
|
238
252
|
RowsCountRootStyled as R,
|
|
253
|
+
InputTextEditorStyled as S,
|
|
239
254
|
TableWrapperDataGridStyled as T,
|
|
240
255
|
ValueColumnStyled as V,
|
|
241
256
|
WrapperSkeletonStyled as W,
|
|
242
257
|
ContentModalSettingStyled as a,
|
|
243
258
|
ContainerLabelValueColumnStyled as b,
|
|
244
259
|
ContentWrapperColumnStyled as c,
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
260
|
+
EditablePlaceholderStyled as d,
|
|
261
|
+
CardsContainerStyled as e,
|
|
262
|
+
CardDetailContainerStyled as f,
|
|
263
|
+
CardHeaderStyled as g,
|
|
264
|
+
CardHeaderLeftStyled as h,
|
|
265
|
+
CardHeaderRightStyled as i,
|
|
266
|
+
CardContentWrapperStyled as j,
|
|
267
|
+
CardContentStyled as k,
|
|
268
|
+
CardStyled as l,
|
|
269
|
+
CheckboxCellWrapperStyled as m,
|
|
270
|
+
ControlNavigateStyled as n,
|
|
271
|
+
ActionsConfigContainerStyled as o,
|
|
272
|
+
ContainerLeftActionsStyled as p,
|
|
273
|
+
ContainerRightActionsStyled as q,
|
|
274
|
+
RowsCountLabelStyled as r,
|
|
275
|
+
RowsCountValueStyled as s,
|
|
276
|
+
ColumnsConfigWrapperStyled as t,
|
|
277
|
+
ColumnsConfigDataGridStyled as u,
|
|
278
|
+
ColumnsConfigSelColumnsStyled as v,
|
|
279
|
+
ColumnsConfigActiosStyled as w,
|
|
280
|
+
ContainerToggleCardsStyled as x,
|
|
281
|
+
CardToggleButtonStyled as y,
|
|
282
|
+
TextToggleCardButtonStyled as z
|
|
268
283
|
};
|
|
@@ -2,7 +2,7 @@ import { CardContentProps } from '../../../types';
|
|
|
2
2
|
/**
|
|
3
3
|
* Hook que encapsula toda la lógica de renderizado del contenido de una Card
|
|
4
4
|
*/
|
|
5
|
-
export declare function useCardContent<TRow>({ row, columns, onRowsChange, }: CardContentProps<TRow>): {
|
|
5
|
+
export declare function useCardContent<TRow>({ row, rows, rowIndex, columns, onRowsChange, }: CardContentProps<TRow>): {
|
|
6
6
|
cardContent: import("react/jsx-runtime").JSX.Element[];
|
|
7
7
|
columnsCount: number;
|
|
8
8
|
};
|
|
@@ -1,13 +1,22 @@
|
|
|
1
1
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { useState } from "react";
|
|
3
3
|
import { u as useDataGrid } from "../../../hooks/useDataGrid.js";
|
|
4
|
-
import { b as ContainerLabelValueColumnStyled, c as ContentWrapperColumnStyled, L as LabelHeaderColumnStyled, E as EditorCellWrapperStyled, V as ValueColumnStyled } from "../../../slots/DataGridSlot.js";
|
|
4
|
+
import { b as ContainerLabelValueColumnStyled, c as ContentWrapperColumnStyled, L as LabelHeaderColumnStyled, E as EditorCellWrapperStyled, V as ValueColumnStyled, d as EditablePlaceholderStyled, I as IconButtonEditStyled } from "../../../slots/DataGridSlot.js";
|
|
5
|
+
import { D as DICTIONARY } from "../../../dictionary.js";
|
|
6
|
+
import { useModuleDictionary, useEnvironment } from "@m4l/core";
|
|
7
|
+
import { p as pathIcons } from "../../../icons.js";
|
|
8
|
+
import { u as useComponentSize } from "../../../../../hooks/useComponentSize/useComponentSize.js";
|
|
5
9
|
function useCardContent({
|
|
6
10
|
row,
|
|
11
|
+
rows,
|
|
12
|
+
rowIndex,
|
|
7
13
|
columns,
|
|
8
14
|
onRowsChange
|
|
9
15
|
}) {
|
|
10
16
|
const { getConfigColumns, size } = useDataGrid();
|
|
17
|
+
const { getLabel } = useModuleDictionary();
|
|
18
|
+
const { host_static_assets, environment_assets } = useEnvironment();
|
|
19
|
+
const { currentSize } = useComponentSize(size);
|
|
11
20
|
const [editingColumnKey, setEditingColumnKey] = useState(null);
|
|
12
21
|
const columnsConfig = getConfigColumns("cards");
|
|
13
22
|
const cardContent = columns.map((column, index) => {
|
|
@@ -34,8 +43,11 @@ function useCardContent({
|
|
|
34
43
|
*/
|
|
35
44
|
onRowChange: (updatedRow) => {
|
|
36
45
|
if (onRowsChange) {
|
|
37
|
-
|
|
38
|
-
|
|
46
|
+
const updatedRows = rows.map(
|
|
47
|
+
(r, i) => i === rowIndex ? updatedRow : r
|
|
48
|
+
);
|
|
49
|
+
onRowsChange(updatedRows, {
|
|
50
|
+
indexes: [rowIndex],
|
|
39
51
|
column
|
|
40
52
|
});
|
|
41
53
|
}
|
|
@@ -55,8 +67,11 @@ function useCardContent({
|
|
|
55
67
|
*/
|
|
56
68
|
onRowChange: (updatedRow) => {
|
|
57
69
|
if (onRowsChange) {
|
|
58
|
-
|
|
59
|
-
|
|
70
|
+
const updatedRows = rows.map(
|
|
71
|
+
(r, i) => i === rowIndex ? updatedRow : r
|
|
72
|
+
);
|
|
73
|
+
onRowsChange(updatedRows, {
|
|
74
|
+
indexes: [rowIndex],
|
|
60
75
|
column
|
|
61
76
|
});
|
|
62
77
|
}
|
|
@@ -64,6 +79,33 @@ function useCardContent({
|
|
|
64
79
|
});
|
|
65
80
|
return /* @__PURE__ */ jsx(ValueColumnStyled, { variant: "body", color: "text.primary", children: cellContent });
|
|
66
81
|
}
|
|
82
|
+
const rawValue = row[column.key];
|
|
83
|
+
const isEmpty = rawValue === null || rawValue === void 0 || rawValue === "";
|
|
84
|
+
const isEditable = !!column.renderEditCell;
|
|
85
|
+
if (isEditable) {
|
|
86
|
+
return /* @__PURE__ */ jsxs(EditablePlaceholderStyled, { children: [
|
|
87
|
+
/* @__PURE__ */ jsx(
|
|
88
|
+
ValueColumnStyled,
|
|
89
|
+
{
|
|
90
|
+
variant: "body",
|
|
91
|
+
color: isEmpty ? "text.secondary" : "text.primary",
|
|
92
|
+
children: isEmpty ? getLabel(DICTIONARY.EDIT_PLACEHOLDER) : rawValue
|
|
93
|
+
}
|
|
94
|
+
),
|
|
95
|
+
/* @__PURE__ */ jsx(
|
|
96
|
+
IconButtonEditStyled,
|
|
97
|
+
{
|
|
98
|
+
src: `${host_static_assets}/${environment_assets}/${pathIcons.edit}`,
|
|
99
|
+
onClick: () => {
|
|
100
|
+
setEditingColumnKey(column.key);
|
|
101
|
+
},
|
|
102
|
+
size: currentSize,
|
|
103
|
+
role: "button",
|
|
104
|
+
"aria-label": "Editar texto"
|
|
105
|
+
}
|
|
106
|
+
)
|
|
107
|
+
] });
|
|
108
|
+
}
|
|
67
109
|
return /* @__PURE__ */ jsx(ValueColumnStyled, { variant: "body", color: "text.primary", children: row[column.key] ?? "-" });
|
|
68
110
|
})()
|
|
69
111
|
]
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsx } from "react/jsx-runtime";
|
|
2
2
|
import { useRef, useMemo, useEffect } from "react";
|
|
3
|
-
import {
|
|
3
|
+
import { e as CardsContainerStyled } from "../../slots/DataGridSlot.js";
|
|
4
4
|
import { C as CardRow } from "./subcomponents/CardRow/index.js";
|
|
5
5
|
import { u as useProcessedColumns } from "../../hooks/useProcessedColumns.js";
|
|
6
6
|
import { c as calculateCardHeight } from "./helpers/calculateCardHeight.js";
|
|
@@ -29,7 +29,8 @@ function Cards(props) {
|
|
|
29
29
|
const handleOpenDetail = useModalDetail({
|
|
30
30
|
columns: allProcessedColumns,
|
|
31
31
|
viewMode: "cards",
|
|
32
|
-
onRowsChange
|
|
32
|
+
onRowsChange,
|
|
33
|
+
rows
|
|
33
34
|
});
|
|
34
35
|
const cardHeight = useMemo(() => {
|
|
35
36
|
const imageHeight = processedColumns.reduce((totalHeight, col) => {
|
|
@@ -77,7 +78,7 @@ function Cards(props) {
|
|
|
77
78
|
if (processedColumns.length === 0) {
|
|
78
79
|
return null;
|
|
79
80
|
}
|
|
80
|
-
return /* @__PURE__ */ jsx(CardsContainerStyled, { "data-testid": "cards-container", ref: containerRef, children: /* @__PURE__ */ jsx(ContainerFlow, { variant: "grid-layout", minWidth: 280, children: rows.map((row) => {
|
|
81
|
+
return /* @__PURE__ */ jsx(CardsContainerStyled, { "data-testid": "cards-container", ref: containerRef, children: /* @__PURE__ */ jsx(ContainerFlow, { variant: "grid-layout", minWidth: 280, children: rows.map((row, rowIndex) => {
|
|
81
82
|
const rowKey = rowKeyGetter(row);
|
|
82
83
|
const isChecked = checkedRows?.has(rowKey) || false;
|
|
83
84
|
const showCheckbox = checkedRows !== void 0 && onCheckedRowsChange !== void 0;
|
|
@@ -85,6 +86,8 @@ function Cards(props) {
|
|
|
85
86
|
CardRow,
|
|
86
87
|
{
|
|
87
88
|
row,
|
|
89
|
+
rows,
|
|
90
|
+
rowIndex,
|
|
88
91
|
columns: processedColumns,
|
|
89
92
|
originalColumns: allProcessedColumns,
|
|
90
93
|
rowKeyGetter,
|
|
@@ -5,4 +5,4 @@ import { CardDetailsProps } from '../../types';
|
|
|
5
5
|
*
|
|
6
6
|
* A diferencia del componente Cards, este muestra TODAS las columnas
|
|
7
7
|
*/
|
|
8
|
-
export declare function CardDetails<TRow>({ row, columns, viewColumnsConfig, onRowsChange, size, }: CardDetailsProps<TRow>): import("react/jsx-runtime").JSX.Element;
|
|
8
|
+
export declare function CardDetails<TRow>({ row, columns, viewColumnsConfig, onRowsChange, size, rows, rowIndex, }: CardDetailsProps<TRow>): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,15 +1,25 @@
|
|
|
1
1
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { useState, useCallback } from "react";
|
|
3
|
-
import {
|
|
3
|
+
import { f as CardDetailContainerStyled, b as ContainerLabelValueColumnStyled, c as ContentWrapperColumnStyled, L as LabelHeaderColumnStyled, E as EditorCellWrapperStyled, V as ValueColumnStyled, d as EditablePlaceholderStyled, I as IconButtonEditStyled } from "../../../../slots/DataGridSlot.js";
|
|
4
|
+
import { D as DICTIONARY } from "../../../../dictionary.js";
|
|
5
|
+
import { useModuleDictionary, useEnvironment } from "@m4l/core";
|
|
6
|
+
import { p as pathIcons } from "../../../../icons.js";
|
|
7
|
+
import { u as useComponentSize } from "../../../../../../hooks/useComponentSize/useComponentSize.js";
|
|
4
8
|
function CardDetails({
|
|
5
9
|
row,
|
|
6
10
|
columns,
|
|
7
11
|
viewColumnsConfig,
|
|
8
12
|
onRowsChange,
|
|
9
|
-
size = "medium"
|
|
13
|
+
size = "medium",
|
|
14
|
+
rows,
|
|
15
|
+
rowIndex
|
|
10
16
|
}) {
|
|
11
17
|
const [editingColumnKey, setEditingColumnKey] = useState(null);
|
|
12
18
|
const [refreshCounter, setRefreshCounter] = useState(0);
|
|
19
|
+
const { getLabel } = useModuleDictionary();
|
|
20
|
+
const { host_static_assets, environment_assets } = useEnvironment();
|
|
21
|
+
const { currentSize } = useComponentSize(size);
|
|
22
|
+
const currentRow = rows[rowIndex] || row;
|
|
13
23
|
const handleForceRefresh = useCallback(() => {
|
|
14
24
|
setRefreshCounter((prev) => prev + 1);
|
|
15
25
|
}, []);
|
|
@@ -17,10 +27,8 @@ function CardDetails({
|
|
|
17
27
|
if (column.renderCell) {
|
|
18
28
|
return {
|
|
19
29
|
...column,
|
|
20
|
-
// Agregar onAfterChange al objeto de la columna
|
|
21
|
-
|
|
22
|
-
onAfterChange: handleForceRefresh
|
|
23
|
-
}
|
|
30
|
+
// Agregar onAfterChange al objeto de la columna
|
|
31
|
+
onAfterChange: handleForceRefresh
|
|
24
32
|
};
|
|
25
33
|
}
|
|
26
34
|
return column;
|
|
@@ -30,7 +38,8 @@ function CardDetails({
|
|
|
30
38
|
(config) => config.key === modifiedColumn.key
|
|
31
39
|
);
|
|
32
40
|
const originalColumn = columns[index];
|
|
33
|
-
const
|
|
41
|
+
const hasInteractiveFormatter = !!modifiedColumn.onAfterChange;
|
|
42
|
+
const columnKey = hasInteractiveFormatter ? `${originalColumn.key}-${refreshCounter}` : `${originalColumn.key}`;
|
|
34
43
|
const shouldShowTitle = configColumn?.showTitle !== false;
|
|
35
44
|
return /* @__PURE__ */ jsx(ContainerLabelValueColumnStyled, { children: /* @__PURE__ */ jsxs(
|
|
36
45
|
ContentWrapperColumnStyled,
|
|
@@ -48,15 +57,18 @@ function CardDetails({
|
|
|
48
57
|
if (modifiedColumn.renderEditCell && editingColumnKey === modifiedColumn.key) {
|
|
49
58
|
return /* @__PURE__ */ jsx(EditorCellWrapperStyled, { ownerState: { size }, children: modifiedColumn.renderEditCell({
|
|
50
59
|
column: originalColumn,
|
|
51
|
-
row,
|
|
60
|
+
row: currentRow,
|
|
52
61
|
rowIdx: index,
|
|
53
62
|
/**
|
|
54
63
|
* onRowChange es una función que se ejecuta cuando el usuario edita una celda.
|
|
55
64
|
*/
|
|
56
65
|
onRowChange: (updatedRow) => {
|
|
57
66
|
if (onRowsChange) {
|
|
58
|
-
|
|
59
|
-
|
|
67
|
+
const updatedRows = rows.map(
|
|
68
|
+
(r, i) => i === rowIndex ? updatedRow : r
|
|
69
|
+
);
|
|
70
|
+
onRowsChange(updatedRows, {
|
|
71
|
+
indexes: [rowIndex],
|
|
60
72
|
column: originalColumn
|
|
61
73
|
});
|
|
62
74
|
}
|
|
@@ -66,8 +78,8 @@ function CardDetails({
|
|
|
66
78
|
}
|
|
67
79
|
if (modifiedColumn.renderCell) {
|
|
68
80
|
const cellContent = modifiedColumn.renderCell({
|
|
69
|
-
column:
|
|
70
|
-
row,
|
|
81
|
+
column: modifiedColumn,
|
|
82
|
+
row: currentRow,
|
|
71
83
|
rowIdx: index,
|
|
72
84
|
isCellSelected: false,
|
|
73
85
|
tabIndex: -1,
|
|
@@ -76,8 +88,11 @@ function CardDetails({
|
|
|
76
88
|
*/
|
|
77
89
|
onRowChange: (updatedRow) => {
|
|
78
90
|
if (onRowsChange) {
|
|
79
|
-
|
|
80
|
-
|
|
91
|
+
const updatedRows = rows.map(
|
|
92
|
+
(r, i) => i === rowIndex ? updatedRow : r
|
|
93
|
+
);
|
|
94
|
+
onRowsChange(updatedRows, {
|
|
95
|
+
indexes: [rowIndex],
|
|
81
96
|
column: originalColumn
|
|
82
97
|
});
|
|
83
98
|
}
|
|
@@ -85,7 +100,34 @@ function CardDetails({
|
|
|
85
100
|
});
|
|
86
101
|
return /* @__PURE__ */ jsx(ValueColumnStyled, { variant: "body", color: "text.primary", children: cellContent });
|
|
87
102
|
}
|
|
88
|
-
|
|
103
|
+
const rawValue = currentRow[modifiedColumn.key];
|
|
104
|
+
const isEmpty = rawValue === null || rawValue === void 0 || rawValue === "";
|
|
105
|
+
const isEditable = !!modifiedColumn.renderEditCell;
|
|
106
|
+
if (isEditable) {
|
|
107
|
+
return /* @__PURE__ */ jsxs(EditablePlaceholderStyled, { children: [
|
|
108
|
+
/* @__PURE__ */ jsx(
|
|
109
|
+
ValueColumnStyled,
|
|
110
|
+
{
|
|
111
|
+
variant: "body",
|
|
112
|
+
color: isEmpty ? "text.secondary" : "text.primary",
|
|
113
|
+
children: isEmpty ? getLabel(DICTIONARY.EDIT_PLACEHOLDER) : rawValue
|
|
114
|
+
}
|
|
115
|
+
),
|
|
116
|
+
/* @__PURE__ */ jsx(
|
|
117
|
+
IconButtonEditStyled,
|
|
118
|
+
{
|
|
119
|
+
src: `${host_static_assets}/${environment_assets}/${pathIcons.edit}`,
|
|
120
|
+
onClick: () => {
|
|
121
|
+
setEditingColumnKey(modifiedColumn.key);
|
|
122
|
+
},
|
|
123
|
+
size: currentSize,
|
|
124
|
+
role: "button",
|
|
125
|
+
"aria-label": "Editar texto"
|
|
126
|
+
}
|
|
127
|
+
)
|
|
128
|
+
] });
|
|
129
|
+
}
|
|
130
|
+
return /* @__PURE__ */ jsx(ValueColumnStyled, { variant: "body", color: "text.primary", children: rawValue ?? "-" });
|
|
89
131
|
})()
|
|
90
132
|
]
|
|
91
133
|
}
|
|
@@ -2,7 +2,7 @@ import { jsxs, jsx } from "react/jsx-runtime";
|
|
|
2
2
|
import { useMemo, useCallback } from "react";
|
|
3
3
|
import { useEnvironment } from "@m4l/core";
|
|
4
4
|
import { u as useDataGrid } from "../../../../hooks/useDataGrid.js";
|
|
5
|
-
import {
|
|
5
|
+
import { g as CardHeaderStyled, h as CardHeaderLeftStyled, i as CardHeaderRightStyled } from "../../../../slots/DataGridSlot.js";
|
|
6
6
|
import { p as pathIcons } from "../../../../icons.js";
|
|
7
7
|
import { C as CheckboxCellAdapter } from "../../../CheckboxCellAdapter/index.js";
|
|
8
8
|
import { I as IconButton } from "../../../../../mui_extended/IconButton/IconButton.js";
|
|
@@ -3,9 +3,9 @@ import { CardRowProps } from '../../types';
|
|
|
3
3
|
/**
|
|
4
4
|
* Componente que muestra una fila de tarjetas.
|
|
5
5
|
*/
|
|
6
|
-
declare function CardRowComponent<TRow, TKey extends RowKey = RowKey>({ row, columns, originalColumns, rowKeyGetter, selectedRows, onSelectedRowsChange, onRowsChange, customRender, minHeight, isChecked, checkedRows, showCheckbox, onCheckedRowsChange, onOpenDetail, }: CardRowProps<TRow, TKey>): import("react/jsx-runtime").JSX.Element;
|
|
6
|
+
declare function CardRowComponent<TRow, TKey extends RowKey = RowKey>({ row, rows, rowIndex, columns, originalColumns, rowKeyGetter, selectedRows, onSelectedRowsChange, onRowsChange, customRender, minHeight, isChecked, checkedRows, showCheckbox, onCheckedRowsChange, onOpenDetail, }: CardRowProps<TRow, TKey>): import("react/jsx-runtime").JSX.Element;
|
|
7
7
|
/**
|
|
8
|
-
*
|
|
8
|
+
* Componente que muestra CardRow
|
|
9
9
|
*/
|
|
10
10
|
export declare const CardRow: typeof CardRowComponent;
|
|
11
11
|
export {};
|
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
import { jsxs, jsx } from "react/jsx-runtime";
|
|
2
2
|
import React, { useMemo } from "react";
|
|
3
|
-
import {
|
|
3
|
+
import { j as CardContentWrapperStyled, k as CardContentStyled, l as CardStyled } from "../../../../slots/DataGridSlot.js";
|
|
4
4
|
import { L as LazyLoadCard } from "../LazyLoadCard/index.js";
|
|
5
5
|
import { u as useCardContent } from "../../hooks/useCardContent.js";
|
|
6
6
|
import { C as CardHeader } from "../CardHeader/index.js";
|
|
7
7
|
import { deepEqual } from "fast-equals";
|
|
8
8
|
function CardRowComponent({
|
|
9
9
|
row,
|
|
10
|
+
rows,
|
|
11
|
+
rowIndex,
|
|
10
12
|
columns,
|
|
11
13
|
originalColumns,
|
|
12
14
|
rowKeyGetter,
|
|
@@ -24,6 +26,8 @@ function CardRowComponent({
|
|
|
24
26
|
const hasCustomRender = customRender !== void 0;
|
|
25
27
|
const { cardContent } = useCardContent({
|
|
26
28
|
row,
|
|
29
|
+
rows,
|
|
30
|
+
rowIndex,
|
|
27
31
|
columns,
|
|
28
32
|
onRowsChange
|
|
29
33
|
});
|
|
@@ -78,6 +78,14 @@ export interface CardRowProps<TRow, TKey extends RowKey = RowKey> {
|
|
|
78
78
|
* Fila que se mostrará en la tarjeta
|
|
79
79
|
*/
|
|
80
80
|
row: TRow;
|
|
81
|
+
/**
|
|
82
|
+
* Array completo de todas las filas (necesario para reconstruir el array al editar)
|
|
83
|
+
*/
|
|
84
|
+
rows: readonly TRow[];
|
|
85
|
+
/**
|
|
86
|
+
* Índice de la fila actual en el array de filas
|
|
87
|
+
*/
|
|
88
|
+
rowIndex: number;
|
|
81
89
|
/**
|
|
82
90
|
* Columnas que se mostrarán en la tarjeta (procesadas, filtradas por visibilidad)
|
|
83
91
|
*/
|
|
@@ -140,6 +148,14 @@ export interface CardDetailsProps<TRow> {
|
|
|
140
148
|
viewColumnsConfig: IViewConfig<any, any>[];
|
|
141
149
|
onRowsChange?: Maybe<(rows: TRow[], data: RowsChangeData<TRow, any>) => void>;
|
|
142
150
|
size?: Extract<Sizes, 'small' | 'medium'>;
|
|
151
|
+
/**
|
|
152
|
+
* Array completo de todas las filas (necesario para reconstruir el array al editar)
|
|
153
|
+
*/
|
|
154
|
+
rows: readonly TRow[];
|
|
155
|
+
/**
|
|
156
|
+
* Índice de la fila actual en el array de filas
|
|
157
|
+
*/
|
|
158
|
+
rowIndex: number;
|
|
143
159
|
}
|
|
144
160
|
/**
|
|
145
161
|
* Props para el componente CardHeader
|
|
@@ -4,7 +4,7 @@ import { SelectCellFormatter } from "react-data-grid";
|
|
|
4
4
|
import { C as CheckboxFormatter } from "../Table/subcomponents/CheckboxFormatter.js";
|
|
5
5
|
import { R as RadioFormatter } from "../Table/subcomponents/RadioFormatter.js";
|
|
6
6
|
import { a as DataGridContext } from "../../contexts/DataGridContext/index.js";
|
|
7
|
-
import {
|
|
7
|
+
import { m as CheckboxCellWrapperStyled } from "../../slots/DataGridSlot.js";
|
|
8
8
|
const CheckboxCellAdapter = forwardRef(function CheckboxCellAdapter2(props, ref) {
|
|
9
9
|
const {
|
|
10
10
|
value,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsxs, jsx } from "react/jsx-runtime";
|
|
2
2
|
import { useIsMobile } from "@m4l/graphics";
|
|
3
|
-
import {
|
|
3
|
+
import { n as ControlNavigateStyled } from "../../slots/DataGridSlot.js";
|
|
4
4
|
import { R as RowsCount } from "../HeaderActions/subcomponents/RowsCount/index.js";
|
|
5
5
|
import { u as useComponentSize } from "../../../../hooks/useComponentSize/useComponentSize.js";
|
|
6
6
|
import { P as Pager } from "../../../Pager/Pager.js";
|
|
@@ -6,7 +6,7 @@ import { V as ViewMode } from "./subcomponents/ViewMode/index.js";
|
|
|
6
6
|
import { u as useDataGrid } from "../../hooks/useDataGrid.js";
|
|
7
7
|
import { useIsMobile } from "@m4l/graphics";
|
|
8
8
|
import { M as MobileMenuActions } from "./subcomponents/MobileMenuActions/index.js";
|
|
9
|
-
import { A as ActionsRootStyled,
|
|
9
|
+
import { A as ActionsRootStyled, o as ActionsConfigContainerStyled, p as ContainerLeftActionsStyled, q as ContainerRightActionsStyled } from "../../slots/DataGridSlot.js";
|
|
10
10
|
import { u as useComponentSize } from "../../../../hooks/useComponentSize/useComponentSize.js";
|
|
11
11
|
function HeaderActions(props) {
|
|
12
12
|
const {
|
|
@@ -29,7 +29,7 @@ function HeaderActions(props) {
|
|
|
29
29
|
] }) : /* @__PURE__ */ jsxs(ActionsConfigContainerStyled, { ownerState: { withPager }, children: [
|
|
30
30
|
/* @__PURE__ */ jsxs(ContainerLeftActionsStyled, { children: [
|
|
31
31
|
leftActions,
|
|
32
|
-
typeof rowHeights !== "number" && /* @__PURE__ */ jsx(Density, {}),
|
|
32
|
+
typeof rowHeights !== "number" && viewMode !== "cards" && /* @__PURE__ */ jsx(Density, {}),
|
|
33
33
|
withLocalFilters && /* @__PURE__ */ jsx(Filter, {}),
|
|
34
34
|
withSettings && !(viewMode === "cards" && cardsViewConfig?.customRender) && /* @__PURE__ */ jsx(Settings, { ...settingsProps, columns }),
|
|
35
35
|
cardsViewConfig !== void 0 && /* @__PURE__ */ jsx(ViewMode, {})
|
|
@@ -2,7 +2,7 @@ import { jsx, jsxs, Fragment } from "react/jsx-runtime";
|
|
|
2
2
|
import { useModuleDictionary, useModuleSkeleton } from "@m4l/core";
|
|
3
3
|
import { Skeleton } from "@mui/material";
|
|
4
4
|
import { u as useDataGrid } from "../../../../hooks/useDataGrid.js";
|
|
5
|
-
import { R as RowsCountRootStyled,
|
|
5
|
+
import { R as RowsCountRootStyled, r as RowsCountLabelStyled, s as RowsCountValueStyled } from "../../../../slots/DataGridSlot.js";
|
|
6
6
|
function RowsCount() {
|
|
7
7
|
const { rowsCount, size } = useDataGrid();
|
|
8
8
|
const { getLabel } = useModuleDictionary();
|
|
@@ -4,7 +4,7 @@ import { useModuleDictionary, useEnvironment } from "@m4l/core";
|
|
|
4
4
|
import DataGrid from "react-data-grid";
|
|
5
5
|
import { I as IconButton } from "../../../../../../../mui_extended/IconButton/IconButton.js";
|
|
6
6
|
import { p as pathIcons } from "../../../../../../icons.js";
|
|
7
|
-
import {
|
|
7
|
+
import { t as ColumnsConfigWrapperStyled, u as ColumnsConfigDataGridStyled, v as ColumnsConfigSelColumnsStyled, T as TableWrapperDataGridStyled, w as ColumnsConfigActiosStyled } from "../../../../../../slots/DataGridSlot.js";
|
|
8
8
|
import { D as DICTIONARY } from "../../../../../../dictionary.js";
|
|
9
9
|
import { C as ColumnInteractiveCheckFormatter } from "../../../../../../formatters/ColumnInteractiveCheckFormatter/formatter.js";
|
|
10
10
|
function getRowsFromColumnsConfig(columnsConfig, columns) {
|
|
@@ -4,7 +4,7 @@ import { useModuleDictionary, useEnvironment } from "@m4l/core";
|
|
|
4
4
|
import DataGrid from "react-data-grid";
|
|
5
5
|
import { I as IconButton } from "../../../../../../../mui_extended/IconButton/IconButton.js";
|
|
6
6
|
import { p as pathIcons } from "../../../../../../icons.js";
|
|
7
|
-
import {
|
|
7
|
+
import { t as ColumnsConfigWrapperStyled, u as ColumnsConfigDataGridStyled, v as ColumnsConfigSelColumnsStyled, T as TableWrapperDataGridStyled, w as ColumnsConfigActiosStyled } from "../../../../../../slots/DataGridSlot.js";
|
|
8
8
|
import { D as DICTIONARY } from "../../../../../../dictionary.js";
|
|
9
9
|
import { C as ColumnInteractiveCheckFormatter } from "../../../../../../formatters/ColumnInteractiveCheckFormatter/formatter.js";
|
|
10
10
|
function getRowsFromColumnsConfigCards(columnsConfigCards, columns) {
|
|
@@ -6,7 +6,7 @@ import { I as IconButton } from "../../../../../mui_extended/IconButton/IconButt
|
|
|
6
6
|
import { P as Popover } from "../../../../../mui_extended/Popover/Popover.js";
|
|
7
7
|
import { p as pathIcons } from "../../../../icons.js";
|
|
8
8
|
import { D as DICTIONARY } from "../../../../dictionary.js";
|
|
9
|
-
import {
|
|
9
|
+
import { x as ContainerToggleCardsStyled, y as CardToggleButtonStyled, z as TextToggleCardButtonStyled } from "../../../../slots/DataGridSlot.js";
|
|
10
10
|
import { I as Icon } from "../../../../../Icon/Icon.js";
|
|
11
11
|
function ViewMode() {
|
|
12
12
|
const { host_static_assets, environment_assets } = useEnvironment();
|
|
@@ -8,7 +8,7 @@ import { a as filterHeight } from "./subcomponents/SelectColumn.js";
|
|
|
8
8
|
import { u as useSortColumnsRows } from "./hooks/useSortColumnsRows.js";
|
|
9
9
|
import { u as useFilters } from "../../hooks/useFilters.js";
|
|
10
10
|
import { u as useDataGrid } from "../../hooks/useDataGrid.js";
|
|
11
|
-
import {
|
|
11
|
+
import { B as TableContainerStyled, T as TableWrapperDataGridStyled } from "../../slots/DataGridSlot.js";
|
|
12
12
|
import { u as useHeaderMenuActions } from "./hooks/useHeaderMenuActions.js";
|
|
13
13
|
import { H as HeaderRenderClick } from "./subcomponents/HeaderRenderClick/HeaderRenderClick.js";
|
|
14
14
|
function Table(props) {
|
|
@@ -12,6 +12,7 @@ const CheckboxFormatter = forwardRef(function CheckboxFormatter2({ onChange, che
|
|
|
12
12
|
checked,
|
|
13
13
|
size: "small",
|
|
14
14
|
icon: /* @__PURE__ */ jsx(CheckboxIcon, {}),
|
|
15
|
+
disableRipple: true,
|
|
15
16
|
checkedIcon: /* @__PURE__ */ jsx(CheckboxCheckedIcon, {}),
|
|
16
17
|
indeterminateIcon: /* @__PURE__ */ jsx(CheckboxIndeterminateIcon, {}),
|
|
17
18
|
onChange: handleChange,
|
|
@@ -1,22 +1,47 @@
|
|
|
1
|
-
import { jsx
|
|
2
|
-
import {
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import { useEnvironment } from "@m4l/core";
|
|
3
|
+
import "@mui/material";
|
|
4
|
+
import { I as Icon } from "../../../../Icon/Icon.js";
|
|
3
5
|
function CheckboxIcon(props) {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
6
|
+
const { host_static_assets, environment_assets } = useEnvironment();
|
|
7
|
+
const uncheckedIconUrl = `${host_static_assets}/${environment_assets}/frontend/components/check_box/assets/icons/unchecked.svg`;
|
|
8
|
+
return /* @__PURE__ */ jsx(
|
|
9
|
+
Icon,
|
|
10
|
+
{
|
|
11
|
+
src: uncheckedIconUrl,
|
|
12
|
+
size: "small",
|
|
13
|
+
color: "text.primary",
|
|
14
|
+
className: "checkbox-unChecked",
|
|
15
|
+
...props
|
|
16
|
+
}
|
|
17
|
+
);
|
|
8
18
|
}
|
|
9
19
|
function CheckboxCheckedIcon(props) {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
20
|
+
const { host_static_assets, environment_assets } = useEnvironment();
|
|
21
|
+
const checkedIconUrl = `${host_static_assets}/${environment_assets}/frontend/components/check_box/assets/icons/checked.svg`;
|
|
22
|
+
return /* @__PURE__ */ jsx(
|
|
23
|
+
Icon,
|
|
24
|
+
{
|
|
25
|
+
src: checkedIconUrl,
|
|
26
|
+
size: "small",
|
|
27
|
+
color: "primary.enabled",
|
|
28
|
+
className: "checkbox-checked",
|
|
29
|
+
...props
|
|
30
|
+
}
|
|
31
|
+
);
|
|
17
32
|
}
|
|
18
33
|
function CheckboxIndeterminateIcon(props) {
|
|
19
|
-
|
|
34
|
+
const { host_static_assets, environment_assets } = useEnvironment();
|
|
35
|
+
const indeterminateIconUrl = `${host_static_assets}/${environment_assets}/frontend/components/check_box/assets/icons/indeterminate.svg`;
|
|
36
|
+
return /* @__PURE__ */ jsx(
|
|
37
|
+
Icon,
|
|
38
|
+
{
|
|
39
|
+
src: indeterminateIconUrl,
|
|
40
|
+
size: "small",
|
|
41
|
+
color: "primary.enabled",
|
|
42
|
+
...props
|
|
43
|
+
}
|
|
44
|
+
);
|
|
20
45
|
}
|
|
21
46
|
export {
|
|
22
47
|
CheckboxIndeterminateIcon as C,
|
|
@@ -5,7 +5,7 @@ import { useDrag, useDrop } from "react-dnd";
|
|
|
5
5
|
import { renderHeaderCell } from "react-data-grid";
|
|
6
6
|
import { u as useFocusRef } from "../hooks/useFocusRef.js";
|
|
7
7
|
import { u as useFilters } from "../../../hooks/useFilters.js";
|
|
8
|
-
import { N as NameColumnIconStyled,
|
|
8
|
+
import { N as NameColumnIconStyled, F as NameColumnStyled, G as IconColumnStyled, H as DraggableHeaderRootStyled, J as ButtonHeaderActionsStyled, K as DraggableWrapperInputBaseStyled, M as IconSearchStyled, O as HeaderInputBaseStyled } from "../../../slots/DataGridSlot.js";
|
|
9
9
|
import { p as pathIcons } from "../../../icons.js";
|
|
10
10
|
import { u as useDataGrid } from "../../../hooks/useDataGrid.js";
|
|
11
11
|
import { I as Icon } from "../../../../Icon/Icon.js";
|
package/components/DataGrid/subcomponents/Table/subcomponents/HeaderRenderClick/HeaderRenderClick.js
CHANGED
|
@@ -2,7 +2,7 @@ import { jsx } from "react/jsx-runtime";
|
|
|
2
2
|
import { useState, useMemo, useEffect, useCallback } from "react";
|
|
3
3
|
import { useModuleDictionary } from "@m4l/core";
|
|
4
4
|
import { M as MenuItem } from "../../../../../mui_extended/MenuItem/MenuItem.js";
|
|
5
|
-
import {
|
|
5
|
+
import { P as MenuListStyled, Q as HeaderRenderClickStyled } from "../../../../slots/DataGridSlot.js";
|
|
6
6
|
import { M as MenuDivider } from "../../../../../mui_extended/MenuDivider/MenuDivider.js";
|
|
7
7
|
import { P as Popover } from "../../../../../mui_extended/Popover/Popover.js";
|
|
8
8
|
import { D as DICTIONARY } from "../../../../dictionary.js";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsx } from "react/jsx-runtime";
|
|
2
|
-
import {
|
|
2
|
+
import { S as InputTextEditorStyled } from "../../../slots/DataGridSlot.js";
|
|
3
3
|
function autoFocusAndSelect(input) {
|
|
4
4
|
input?.focus();
|
|
5
5
|
input?.select();
|
|
@@ -228,6 +228,10 @@ export interface UseModalDetailProps<TRow> {
|
|
|
228
228
|
columns: readonly Column<TRow, any>[];
|
|
229
229
|
viewMode: ViewMode;
|
|
230
230
|
onRowsChange?: Maybe<(rows: TRow[], data: RowsChangeData<TRow, any>) => void>;
|
|
231
|
+
/**
|
|
232
|
+
* Array completo de todas las filas (necesario para reconstruir el array al editar en el modal)
|
|
233
|
+
*/
|
|
234
|
+
rows: readonly TRow[];
|
|
231
235
|
}
|
|
232
236
|
/**
|
|
233
237
|
* Configuración de una columna específica en vista "cards"
|
|
@@ -287,6 +291,14 @@ export interface CardContentProps<TRow> {
|
|
|
287
291
|
columns: readonly Column<TRow, any>[];
|
|
288
292
|
originalColumns: readonly Column<TRow, any>[];
|
|
289
293
|
onRowsChange?: Maybe<(rows: TRow[], data: RowsChangeData<TRow, any>) => void>;
|
|
294
|
+
/**
|
|
295
|
+
* Array completo de todas las filas (necesario para reconstruir el array al editar)
|
|
296
|
+
*/
|
|
297
|
+
rows: readonly TRow[];
|
|
298
|
+
/**
|
|
299
|
+
* Índice de la fila actual en el array de filas
|
|
300
|
+
*/
|
|
301
|
+
rowIndex: number;
|
|
290
302
|
}
|
|
291
303
|
/**
|
|
292
304
|
* Configuración de densidad para el DataGrid.
|
package/package.json
CHANGED