@m4l/components 9.3.28 → 9.3.29-JT19112025.beta.2
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/Color/Color.js +32 -131
- package/components/Color/Color.styles.js +6 -124
- package/components/Color/slots/ColorEnum.d.ts +1 -3
- package/components/Color/slots/ColorEnum.js +1 -3
- package/components/Color/slots/ColorSlots.d.ts +3 -18
- package/components/Color/slots/ColorSlots.js +6 -19
- package/components/Color/types.d.ts +6 -7
- package/components/DataGrid/DataGrid.js +1 -1
- package/components/DataGrid/Datagrid.styles.js +111 -39
- package/components/DataGrid/dictionary.d.ts +1 -0
- package/components/DataGrid/dictionary.js +2 -1
- package/components/DataGrid/formatters/ColumnColorFormatter/formatter.d.ts +6 -0
- package/components/DataGrid/formatters/ColumnColorFormatter/formatter.js +19 -0
- package/components/DataGrid/formatters/ColumnColorFormatter/index.d.ts +3 -0
- package/components/DataGrid/formatters/ColumnColorFormatter/index.js +1 -0
- 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/ColumnColorFormatter/types.d.ts +12 -0
- package/components/DataGrid/formatters/ColumnColorFormatter/types.js +1 -0
- package/components/DataGrid/formatters/ColumnColorFormatter/useColumnColor.d.ts +14 -0
- package/components/DataGrid/formatters/ColumnColorFormatter/useColumnColor.js +22 -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/formatters/index.d.ts +1 -0
- 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 +40 -5
- package/components/DataGrid/subcomponents/Cards/index.js +4 -2
- package/components/DataGrid/subcomponents/Cards/subcomponents/CardDetails/index.js +34 -8
- 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 +8 -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/tests/helpers/generators.d.ts +26 -0
- package/components/DataGrid/tests/helpers/types.d.ts +2 -0
- package/components/DataGrid/types.d.ts +8 -0
- package/components/DynamicFilter/subcomponents/DynamicFilterBase/DynamicFilterBase.js +1 -1
- package/components/DynamicSort/subcomponents/AppliedSorts/AppliedSorts.js +1 -1
- package/components/DynamicSort/subcomponents/DynamicSortBase/DynamicSortBase.js +1 -1
- package/components/Icon/Icon.js +1 -1
- package/components/Image/Image.js +1 -1
- package/components/Image/subcomponents/IntersectComponent/index.js +1 -1
- package/components/ImageText/ImageText.js +1 -1
- package/components/LanguagePopover/LanguagePopover.js +1 -1
- package/components/LinearProgressIndeterminate/LinearProgressIndeterminate.js +1 -1
- package/components/LoadingError/LoadingError.js +1 -1
- package/components/NumberInput/NumberInput.js +1 -1
- package/components/ObjectLogs/subcomponents/ObjectLogsByM4L/ObjectLogsByM4L.js +1 -1
- package/components/ObjectLogs/subcomponents/ObjectLogsByOthers/ObjectLogsByOthers.js +1 -1
- package/components/PDFViewer/PDFViewer.js +1 -1
- package/components/PrintingSystem/PrintingSystem.js +1 -1
- package/components/PropertyValue/PropertyValue.js +1 -1
- package/components/ToastContainer/ToastContainer.js +1 -1
- package/components/WindowBase/WindowBase.js +1 -1
- package/components/WindowConfirm/WindowConfirm.js +1 -1
- package/components/areas/components/AreasAdmin/AreasAdmin.js +1 -1
- package/components/areas/components/AreasViewer/AreasViewer.js +1 -1
- package/components/areas/components/AreasViewer/subcomponents/Area/subcomponents/Window/Window.js +1 -1
- package/components/commercial/TopBar/TopBar.js +1 -1
- package/components/commercial/TopBar/component/ConteinItem/index.js +1 -1
- package/components/commercial/TopBar/component/ConteinItem/subcomponets/NavItem/index.js +1 -1
- package/components/extended/React-Spinners/PropagateLoaderSpinner/PropagateLoaderSpinner.js +1 -1
- package/components/extended/React-resizable-panels/SplitLayout.js +1 -1
- package/components/formatters/BooleanFormatter/BooleanFormatter.js +1 -1
- package/components/formatters/ColorFormatter/ColorFormatter.d.ts +18 -0
- package/components/formatters/ColorFormatter/ColorFormatter.js +35 -0
- package/components/formatters/ColorFormatter/ColorFormatter.styles.d.ts +2 -0
- package/components/formatters/ColorFormatter/ColorFormatter.styles.js +15 -0
- package/components/formatters/ColorFormatter/constants.d.ts +1 -0
- package/components/formatters/ColorFormatter/constants.js +4 -0
- package/components/formatters/ColorFormatter/index.d.ts +3 -0
- package/components/formatters/ColorFormatter/index.js +1 -0
- package/components/formatters/ColorFormatter/slots/ColorFormatterEnum.d.ts +3 -0
- package/components/formatters/ColorFormatter/slots/ColorFormatterEnum.js +7 -0
- package/components/formatters/ColorFormatter/slots/ColorFormatterSlots.d.ts +4 -0
- package/components/formatters/ColorFormatter/slots/ColorFormatterSlots.js +11 -0
- package/components/formatters/ColorFormatter/types.d.ts +24 -0
- package/components/formatters/ColorFormatter/types.js +1 -0
- package/components/formatters/ConcatenatedFormatter/ConcatenatedFormatter.js +1 -1
- package/components/formatters/DateFormatter/DateFormatter.js +1 -1
- package/components/formatters/DistanceToNowFormatter/DistanceToNowFormatter.js +1 -1
- package/components/formatters/PeriodFormatter/PeriodFormatter.js +1 -1
- package/components/formatters/PointsFormatter/PointsFormatter.js +1 -1
- package/components/formatters/PriceFormatter/PriceFormatter.js +1 -1
- package/components/formatters/UncertaintyFormatter/UncertaintyFormatter.js +1 -1
- package/components/formatters/index.d.ts +1 -0
- package/components/hook-form/RHFColorPicker/RFHColorPicker.js +28 -36
- package/components/hook-form/RHFColorPicker/RHFColorPicker.styles.js +156 -0
- package/components/hook-form/RHFColorPicker/hooks/useColorPicker/index.d.ts +2 -0
- package/components/hook-form/RHFColorPicker/hooks/useColorPicker/types.d.ts +9 -0
- package/components/hook-form/RHFColorPicker/hooks/useColorPicker/useColorPicker.d.ts +41 -0
- package/components/hook-form/RHFColorPicker/hooks/useColorPicker/useColorPicker.js +50 -0
- package/components/hook-form/RHFColorPicker/slots/RHFColorPickerEnum.d.ts +4 -1
- package/components/hook-form/RHFColorPicker/slots/RHFColorPickerEnum.js +3 -0
- package/components/hook-form/RHFColorPicker/slots/RHFColorPickerSlots.d.ts +21 -0
- package/components/hook-form/RHFColorPicker/slots/RHFColorPickerSlots.js +19 -1
- package/components/hook-form/RHFColorPicker/slots/index.js +1 -0
- package/components/hook-form/RHFColorPicker/subcomponents/ColorPickerField/ColorPickerField.d.ts +33 -0
- package/components/hook-form/RHFColorPicker/subcomponents/ColorPickerField/ColorPickerField.js +147 -0
- package/components/hook-form/RHFColorPicker/subcomponents/ColorPickerField/index.d.ts +2 -0
- package/components/hook-form/RHFColorPicker/subcomponents/ColorPickerField/index.js +1 -0
- package/components/hook-form/RHFColorPicker/subcomponents/ColorPickerField/types.d.ts +20 -0
- package/components/hook-form/RHFColorPicker/subcomponents/ColorPickerField/types.js +1 -0
- package/components/hook-form/RHFDateTime/RHFDateTime.js +1 -1
- package/components/hook-form/RHFNumberInput/RHFNumberInput.js +1 -1
- package/components/hook-form/RHFPeriod/RHFPeriod.js +1 -1
- package/components/hook-form/RHFSelect/RHFSelect.js +1 -1
- package/components/hook-form/RHFTextField/RHFTextField.js +1 -1
- package/components/hook-form/RHFUpload/RHFUploadImage/subcomponents/UploadImage/UploadImage.js +1 -1
- package/components/hook-form/RHFUpload/RHFUploadSingleFile/RHFUploadSingleFile.js +1 -1
- package/components/mui_extended/Accordion/Accordion.js +1 -1
- package/components/mui_extended/Avatar/Avatar.js +1 -1
- package/components/mui_extended/Avatar/subcomponents/SkeletonAvatar/index.js +1 -1
- package/components/mui_extended/Badge/Badge.js +1 -1
- package/components/mui_extended/CircularProgress/CircularProgress.js +1 -1
- package/components/mui_extended/DateTimePicker/DateTimePicker.js +1 -1
- package/components/mui_extended/Dialog/Dialog.js +1 -1
- package/components/mui_extended/ImageButton/ImageButton.js +1 -1
- package/components/mui_extended/MenuDivider/MenuDivider.js +1 -1
- package/components/mui_extended/NavLink/NavLink.js +1 -1
- package/components/mui_extended/Popover/Popover.js +1 -1
- package/components/mui_extended/Select/Select.js +1 -1
- package/components/mui_extended/Stack/Stack.js +1 -1
- package/components/mui_extended/TextField/TextField.js +1 -1
- package/components/mui_extended/ToggleButton/ToggleButton.js +1 -1
- package/components/mui_extended/ToggleIconButton/ToggleIconButton.js +1 -1
- package/components/mui_extended/Typography/Typography.js +1 -1
- package/components/popups/components/PopupsViewer/subcomponents/Popup/Popup.js +1 -1
- package/hooks/useDynamicFilterAndSort/useDynamicFilterAndSort.js +1 -1
- package/index.js +58 -52
- package/package.json +2 -2
- package/test/getNameDataTestId.js +2 -2
- 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
|
+
"& .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
|
+
},
|
|
27
63
|
"& > svg": {
|
|
28
64
|
color: theme.vars.palette.text.secondary
|
|
29
65
|
}
|
|
@@ -380,33 +416,19 @@ const dataGridStyles = {
|
|
|
380
416
|
outline: `2px solid var(--rdg-selection-color)`,
|
|
381
417
|
outlineOffset: "-2px"
|
|
382
418
|
},
|
|
419
|
+
"&:has(> .MuiCheckbox-root)": {
|
|
420
|
+
overflow: "visible",
|
|
421
|
+
paddingInline: 0
|
|
422
|
+
},
|
|
383
423
|
"& .checkbox-checked": {
|
|
384
|
-
"&
|
|
385
|
-
|
|
386
|
-
}
|
|
387
|
-
...getSizeStyles(
|
|
388
|
-
theme,
|
|
389
|
-
ownerState?.size || "medium",
|
|
390
|
-
"base",
|
|
391
|
-
(size) => ({
|
|
392
|
-
minHeight: size,
|
|
393
|
-
height: size
|
|
394
|
-
})
|
|
395
|
-
)
|
|
424
|
+
"& .M4LIcon-icon": {
|
|
425
|
+
backgroundColor: theme.vars.palette.primary.enabled
|
|
426
|
+
}
|
|
396
427
|
},
|
|
397
428
|
"& .checkbox-unChecked": {
|
|
398
|
-
"&
|
|
399
|
-
|
|
400
|
-
}
|
|
401
|
-
...getSizeStyles(
|
|
402
|
-
theme,
|
|
403
|
-
ownerState?.size || "medium",
|
|
404
|
-
"base",
|
|
405
|
-
(size) => ({
|
|
406
|
-
minHeight: size,
|
|
407
|
-
height: size
|
|
408
|
-
})
|
|
409
|
-
)
|
|
429
|
+
"& .M4LIcon-icon": {
|
|
430
|
+
backgroundColor: theme.vars.palette.text.primary
|
|
431
|
+
}
|
|
410
432
|
},
|
|
411
433
|
"& .rdg-text-editor": {
|
|
412
434
|
textAlign: "inherit",
|
|
@@ -672,26 +694,54 @@ const dataGridStyles = {
|
|
|
672
694
|
* Estilos para el wrapper del CheckboxCellAdapter
|
|
673
695
|
* Aplica los mismos estilos que los checkboxes dentro de celdas rdg
|
|
674
696
|
*/
|
|
675
|
-
checkboxCellWrapper: ({ theme
|
|
697
|
+
checkboxCellWrapper: ({ theme }) => ({
|
|
676
698
|
"& .checkbox-checked": {
|
|
677
|
-
"&
|
|
678
|
-
|
|
679
|
-
}
|
|
680
|
-
...getSizeStyles(theme, ownerState?.size || "medium", "base", (size) => ({
|
|
681
|
-
minHeight: size,
|
|
682
|
-
height: size
|
|
683
|
-
}))
|
|
699
|
+
"& .M4LIcon-icon": {
|
|
700
|
+
backgroundColor: theme.vars.palette.primary.enabled
|
|
701
|
+
}
|
|
684
702
|
},
|
|
685
703
|
"& .checkbox-unChecked": {
|
|
686
|
-
"&
|
|
687
|
-
|
|
688
|
-
}
|
|
689
|
-
...getSizeStyles(theme, ownerState?.size || "medium", "base", (size) => ({
|
|
690
|
-
minHeight: size,
|
|
691
|
-
height: size
|
|
692
|
-
}))
|
|
704
|
+
"& .M4LIcon-icon": {
|
|
705
|
+
backgroundColor: theme.vars.palette.text.primary
|
|
706
|
+
}
|
|
693
707
|
},
|
|
694
708
|
"& .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
|
+
},
|
|
695
745
|
"& > svg": {
|
|
696
746
|
color: theme.vars.palette.text.secondary
|
|
697
747
|
}
|
|
@@ -892,6 +942,28 @@ const dataGridStyles = {
|
|
|
892
942
|
}
|
|
893
943
|
}
|
|
894
944
|
}),
|
|
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: () => ({}),
|
|
895
967
|
/**
|
|
896
968
|
* Header de la card personalizada (avatar + nombre + email)
|
|
897
969
|
*/
|
|
@@ -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,
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { RenderCellProps } from 'react-data-grid';
|
|
2
|
+
import { ColumnColorFormatterProps } from './types';
|
|
3
|
+
/**
|
|
4
|
+
* Función para formatear un color en una columna de un DataGrid
|
|
5
|
+
*/
|
|
6
|
+
export declare function ColumnColorFormatter<TRow>(props: ColumnColorFormatterProps<TRow>): (renderProps: RenderCellProps<TRow>) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import { getPropertyByString } from "@m4l/core";
|
|
3
|
+
import { C as ColorFormatter } from "../../../formatters/ColorFormatter/ColorFormatter.js";
|
|
4
|
+
function ColumnColorFormatter(props) {
|
|
5
|
+
const { fieldValue, size = "medium" } = props;
|
|
6
|
+
return (renderProps) => {
|
|
7
|
+
const colorValue = getPropertyByString(renderProps.row, fieldValue);
|
|
8
|
+
let fixedValue;
|
|
9
|
+
if (typeof colorValue === "string") {
|
|
10
|
+
fixedValue = colorValue;
|
|
11
|
+
} else {
|
|
12
|
+
fixedValue = null;
|
|
13
|
+
}
|
|
14
|
+
return /* @__PURE__ */ jsx(ColorFormatter, { value: fixedValue, size });
|
|
15
|
+
};
|
|
16
|
+
}
|
|
17
|
+
export {
|
|
18
|
+
ColumnColorFormatter as C
|
|
19
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
package/components/DataGrid/formatters/ColumnColorFormatter/tests/ColumnColorFormatter.test.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { DeepKeyOf } from '../../../../utils/types';
|
|
2
|
+
import { ColorFormatterProps } from '../../../formatters/ColorFormatter/types';
|
|
3
|
+
/**
|
|
4
|
+
* Props para el ColumnColorFormatter
|
|
5
|
+
*/
|
|
6
|
+
export interface ColumnColorFormatterProps<TRow> extends Pick<ColorFormatterProps, 'size' | 'className'> {
|
|
7
|
+
/**
|
|
8
|
+
* Campo de la fila que contiene el valor del color.
|
|
9
|
+
* Soporta acceso a propiedades anidadas (ej: 'user.profile.color')
|
|
10
|
+
*/
|
|
11
|
+
fieldValue: DeepKeyOf<TRow>;
|
|
12
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { ColumnColorFormatterProps } from './types';
|
|
2
|
+
/**
|
|
3
|
+
* Hook que retorna el formatter para una columna de color en el DataGrid.
|
|
4
|
+
*
|
|
5
|
+
* Este hook gestiona el estado del formatter y se asegura de que las props
|
|
6
|
+
* se actualicen correctamente cuando cambian, utilizando deepEqual para
|
|
7
|
+
* comparación profunda de objetos.
|
|
8
|
+
* @template TRow - Tipo de la fila del DataGrid
|
|
9
|
+
* @param {ColumnColorFormatterProps<TRow>} props - Propiedades del formatter
|
|
10
|
+
* @returns {object} Objeto con el formatter configurado
|
|
11
|
+
*/
|
|
12
|
+
export declare const useColumnColor: <TRow>(props: ColumnColorFormatterProps<TRow>) => {
|
|
13
|
+
formatter: (renderProps: import('react-data-grid').RenderCellProps<TRow, unknown>) => import("react/jsx-runtime").JSX.Element;
|
|
14
|
+
};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { useState, useRef, useEffect, useMemo } from "react";
|
|
2
|
+
import { deepEqual } from "fast-equals";
|
|
3
|
+
import { C as ColumnColorFormatter } from "./formatter.js";
|
|
4
|
+
const useColumnColor = (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: ColumnColorFormatter(stateProps)
|
|
16
|
+
}),
|
|
17
|
+
[stateProps]
|
|
18
|
+
);
|
|
19
|
+
};
|
|
20
|
+
export {
|
|
21
|
+
useColumnColor as u
|
|
22
|
+
};
|
package/components/DataGrid/formatters/ColumnTagsFormatter/tests/ColumnTagsFormatter.test.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -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,26 @@ 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 (isEmpty && isEditable) {
|
|
86
|
+
return /* @__PURE__ */ jsxs(EditablePlaceholderStyled, { children: [
|
|
87
|
+
/* @__PURE__ */ jsx(ValueColumnStyled, { variant: "body", color: "text.secondary", children: getLabel(DICTIONARY.EDIT_PLACEHOLDER) }),
|
|
88
|
+
/* @__PURE__ */ jsx(
|
|
89
|
+
IconButtonEditStyled,
|
|
90
|
+
{
|
|
91
|
+
src: `${host_static_assets}/${environment_assets}/${pathIcons.edit}`,
|
|
92
|
+
onClick: () => {
|
|
93
|
+
setEditingColumnKey(column.key);
|
|
94
|
+
},
|
|
95
|
+
size: currentSize,
|
|
96
|
+
role: "button",
|
|
97
|
+
"aria-label": "Editar texto"
|
|
98
|
+
}
|
|
99
|
+
)
|
|
100
|
+
] });
|
|
101
|
+
}
|
|
67
102
|
return /* @__PURE__ */ jsx(ValueColumnStyled, { variant: "body", color: "text.primary", children: row[column.key] ?? "-" });
|
|
68
103
|
})()
|
|
69
104
|
]
|
|
@@ -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";
|
|
@@ -64,7 +64,7 @@ function Cards(props) {
|
|
|
64
64
|
if (processedColumns.length === 0) {
|
|
65
65
|
return null;
|
|
66
66
|
}
|
|
67
|
-
return /* @__PURE__ */ jsx(CardsContainerStyled, { "data-testid": "cards-container", ref: containerRef, children: /* @__PURE__ */ jsx(ContainerFlow, { variant: "grid-layout", minWidth: 280, children: rows.map((row) => {
|
|
67
|
+
return /* @__PURE__ */ jsx(CardsContainerStyled, { "data-testid": "cards-container", ref: containerRef, children: /* @__PURE__ */ jsx(ContainerFlow, { variant: "grid-layout", minWidth: 280, children: rows.map((row, rowIndex) => {
|
|
68
68
|
const rowKey = rowKeyGetter(row);
|
|
69
69
|
const isChecked = checkedRows?.has(rowKey) || false;
|
|
70
70
|
const showCheckbox = checkedRows !== void 0 && onCheckedRowsChange !== void 0;
|
|
@@ -72,6 +72,8 @@ function Cards(props) {
|
|
|
72
72
|
CardRow,
|
|
73
73
|
{
|
|
74
74
|
row,
|
|
75
|
+
rows,
|
|
76
|
+
rowIndex,
|
|
75
77
|
columns: processedColumns,
|
|
76
78
|
originalColumns: allProcessedColumns,
|
|
77
79
|
rowKeyGetter,
|