@m4l/components 9.3.25-beta.0 → 9.3.25

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.
Files changed (152) hide show
  1. package/@types/export.d.ts +6 -0
  2. package/@types/types.d.ts +26 -1
  3. package/components/CommonActions/components/ActionFormCancel/ActionFormCancel.js +7 -10
  4. package/components/CommonActions/components/ActionFormCancel/types.d.ts +0 -8
  5. package/components/DataGrid/DataGrid.js +6 -2
  6. package/components/DataGrid/Datagrid.styles.js +67 -18
  7. package/components/DataGrid/constants.d.ts +19 -0
  8. package/components/DataGrid/formatters/ColumnIconFormatter/formatter.d.ts +1 -2
  9. package/components/DataGrid/formatters/ColumnIconFormatter/formatter.js +3 -6
  10. package/components/DataGrid/formatters/ColumnIconFormatter/index.d.ts +0 -1
  11. package/components/DataGrid/formatters/ColumnIconFormatter/types.d.ts +2 -4
  12. package/components/DataGrid/formatters/ColumnSetCheckFormatter/formatter.js +7 -1
  13. package/components/DataGrid/formatters/ColumnSetCheckFormatter/types.d.ts +1 -0
  14. package/components/DataGrid/formatters/ColumnTagsFormatter/formatter.d.ts +8 -0
  15. package/components/DataGrid/formatters/ColumnTagsFormatter/formatter.js +16 -0
  16. package/components/DataGrid/formatters/ColumnTagsFormatter/index.d.ts +3 -0
  17. package/components/DataGrid/formatters/ColumnTagsFormatter/index.js +1 -0
  18. package/components/DataGrid/formatters/ColumnTagsFormatter/types.d.ts +4 -0
  19. package/components/DataGrid/formatters/ColumnTagsFormatter/useColumnTags.d.ts +9 -0
  20. package/components/DataGrid/formatters/ColumnTagsFormatter/useColumnTags.js +60 -0
  21. package/components/DataGrid/formatters/index.d.ts +1 -0
  22. package/components/DataGrid/hooks/useModalCardDetail.d.ts +2 -2
  23. package/components/DataGrid/hooks/useModalCardDetail.js +49 -48
  24. package/components/DataGrid/index.d.ts +1 -1
  25. package/components/DataGrid/slots/DataGridEnum.d.ts +2 -0
  26. package/components/DataGrid/slots/DataGridEnum.js +2 -0
  27. package/components/DataGrid/slots/DataGridSlot.d.ts +3 -1
  28. package/components/DataGrid/slots/DataGridSlot.js +45 -37
  29. package/components/DataGrid/subcomponents/Cards/helpers/calculateCardHeight.d.ts +18 -0
  30. package/components/DataGrid/subcomponents/Cards/helpers/calculateCardHeight.js +10 -0
  31. package/components/DataGrid/subcomponents/Cards/helpers/scrollToCardElement.d.ts +9 -0
  32. package/components/DataGrid/subcomponents/Cards/helpers/scrollToCardElement.js +25 -0
  33. package/components/DataGrid/subcomponents/Cards/hooks/useCardContent.d.ts +1 -2
  34. package/components/DataGrid/subcomponents/Cards/hooks/useCardContent.js +62 -73
  35. package/components/DataGrid/subcomponents/Cards/index.js +71 -16
  36. package/components/DataGrid/subcomponents/Cards/subcomponents/CardDetails/index.js +36 -18
  37. package/components/DataGrid/subcomponents/Cards/subcomponents/CardHeader/index.d.ts +1 -1
  38. package/components/DataGrid/subcomponents/Cards/subcomponents/CardHeader/index.js +13 -20
  39. package/components/DataGrid/subcomponents/Cards/subcomponents/CardRow/index.d.ts +6 -1
  40. package/components/DataGrid/subcomponents/Cards/subcomponents/CardRow/index.js +67 -36
  41. package/components/DataGrid/subcomponents/Cards/subcomponents/IntersectCard/index.js +9 -2
  42. package/components/DataGrid/subcomponents/Cards/subcomponents/LazyLoadCard/index.js +4 -2
  43. package/components/DataGrid/subcomponents/Cards/types.d.ts +50 -1
  44. package/components/DataGrid/subcomponents/CheckboxCellAdapter/index.js +5 -2
  45. package/components/DataGrid/subcomponents/ControlNavigate/ControlNavigate.js +1 -1
  46. package/components/DataGrid/subcomponents/HeaderActions/index.js +1 -1
  47. package/components/DataGrid/subcomponents/HeaderActions/subcomponents/RowsCount/index.js +1 -1
  48. package/components/DataGrid/subcomponents/HeaderActions/subcomponents/Settings/subcomponents/ColumnsConfig/index.js +1 -1
  49. package/components/DataGrid/subcomponents/HeaderActions/subcomponents/Settings/subcomponents/ColumnsConfigCards/index.js +1 -1
  50. package/components/DataGrid/subcomponents/HeaderActions/subcomponents/ViewMode/index.js +1 -1
  51. package/components/DataGrid/subcomponents/HeaderActions/subcomponents/hooks/useModalSettings/index.js +1 -1
  52. package/components/DataGrid/subcomponents/HeaderActions/subcomponents/hooks/useModalSettingsCards/index.js +1 -1
  53. package/components/DataGrid/subcomponents/Table/index.js +60 -41
  54. package/components/DataGrid/subcomponents/Table/subcomponents/CheckboxFormatter.js +16 -18
  55. package/components/DataGrid/subcomponents/Table/subcomponents/DraggableHeaderRenderer.js +3 -3
  56. package/components/DataGrid/subcomponents/Table/subcomponents/HeaderRenderClick/HeaderRenderClick.js +1 -1
  57. package/components/DataGrid/subcomponents/editors/TextEditor/index.js +1 -1
  58. package/components/DataGrid/tests/helpers/types.d.ts +3 -0
  59. package/components/DataGrid/types.d.ts +17 -4
  60. package/components/Label/Label.js +1 -1
  61. package/components/ObjectLogs/slots/ObjectLogsSlots.js +3 -5
  62. package/components/PaperForm/PaperForm.js +1 -1
  63. package/components/PaperForm/components/Header.js +7 -9
  64. package/components/PaperForm/styles.js +4 -9
  65. package/components/PaperForm/types.d.ts +2 -3
  66. package/components/Stepper/Stepper.styles.js +0 -1
  67. package/components/Stepper/dictionary.js +1 -0
  68. package/components/Stepper/subcomponents/StepArea/index.js +115 -7
  69. package/components/Stepper/subcomponents/StepperButtons/StepperCancelButton/index.d.ts +2 -2
  70. package/components/Stepper/subcomponents/StepperButtons/StepperCancelButton/index.js +53 -3
  71. package/components/Stepper/subcomponents/StepperButtons/StepperNextButton/index.js +2 -3
  72. package/components/Stepper/subcomponents/StepperButtons/StepperPrevButton/index.js +2 -3
  73. package/components/Stepper/subcomponents/StepperButtons/StepperSubmitButton/index.js +5 -24
  74. package/components/Stepper/subcomponents/StepperContent/subcomponents/Step/index.js +51 -2
  75. package/components/Stepper/types.d.ts +0 -4
  76. package/components/ToastContainer/ToastContainer.js +0 -1
  77. package/components/ToastContainer/constants.d.ts +1 -1
  78. package/components/ToastContainer/constants.js +1 -1
  79. package/components/WindowBase/contexts/WindowToolsMFContext/WindowToolsMFContext.js +3 -47
  80. package/components/WindowBase/contexts/WindowToolsMFContext/types.d.ts +1 -1
  81. package/components/WindowBase/subcomponents/Component/index.d.ts +1 -12
  82. package/components/WindowBase/subcomponents/Component/index.js +2 -56
  83. package/components/WindowBase/subcomponents/Component/types.d.ts +0 -1
  84. package/components/WindowBase/types.d.ts +1 -1
  85. package/components/areas/components/AreasViewer/subcomponents/Area/subcomponents/Window/Window.js +0 -1
  86. package/components/areas/components/AreasViewer/subcomponents/Area/subcomponents/Window/hooks/useWindow.js +1 -1
  87. package/components/areas/contexts/AreasContext/store.js +3 -7
  88. package/components/areas/contexts/AreasContext/types.d.ts +1 -1
  89. package/components/formatters/IconsFormatter/IconsFormatter.d.ts +6 -0
  90. package/components/formatters/IconsFormatter/IconsFormatter.js +22 -0
  91. package/components/formatters/IconsFormatter/IconsFormatter.styles.d.ts +2 -0
  92. package/components/formatters/IconsFormatter/IconsFormatter.styles.js +29 -0
  93. package/components/formatters/IconsFormatter/constants.d.ts +1 -0
  94. package/components/formatters/IconsFormatter/constants.js +4 -0
  95. package/components/{DataGrid/formatters/ColumnIconFormatter → formatters/IconsFormatter}/helpers/renderIcon.d.ts +2 -2
  96. package/components/formatters/IconsFormatter/helpers/renderIcon.js +24 -0
  97. package/components/formatters/IconsFormatter/helpers/renderMultipleIcons.d.ts +7 -0
  98. package/components/formatters/IconsFormatter/helpers/renderMultipleIcons.js +16 -0
  99. package/components/formatters/IconsFormatter/index.d.ts +3 -0
  100. package/components/formatters/IconsFormatter/index.js +1 -0
  101. package/components/formatters/IconsFormatter/slots/IconsFormatterEnum.d.ts +5 -0
  102. package/components/formatters/IconsFormatter/slots/IconsFormatterEnum.js +9 -0
  103. package/components/formatters/IconsFormatter/slots/IconsFormatterSlots.d.ts +9 -0
  104. package/components/formatters/IconsFormatter/slots/IconsFormatterSlots.js +22 -0
  105. package/components/formatters/IconsFormatter/types.d.ts +57 -0
  106. package/components/formatters/IconsFormatter/types.js +1 -0
  107. package/components/formatters/TagsFormatter/TagsFormatter.d.ts +5 -0
  108. package/components/formatters/TagsFormatter/TagsFormatter.js +28 -0
  109. package/components/formatters/TagsFormatter/TagsFormatter.styles.d.ts +2 -0
  110. package/components/formatters/TagsFormatter/TagsFormatter.styles.js +41 -0
  111. package/components/formatters/TagsFormatter/constants.d.ts +5 -0
  112. package/components/formatters/TagsFormatter/constants.js +11 -0
  113. package/components/formatters/TagsFormatter/helpers/renderMultipleTag.d.ts +8 -0
  114. package/components/formatters/TagsFormatter/helpers/renderMultipleTag.js +19 -0
  115. package/components/formatters/TagsFormatter/helpers/renderTag.d.ts +7 -0
  116. package/components/formatters/TagsFormatter/helpers/renderTag.js +9 -0
  117. package/components/formatters/TagsFormatter/helpers/validateHexColor.d.ts +8 -0
  118. package/components/formatters/TagsFormatter/helpers/validateHexColor.js +9 -0
  119. package/components/formatters/TagsFormatter/index.d.ts +2 -0
  120. package/components/formatters/TagsFormatter/index.js +1 -0
  121. package/components/formatters/TagsFormatter/slots/TagsFormatterEnum.d.ts +5 -0
  122. package/components/formatters/TagsFormatter/slots/TagsFormatterEnum.js +9 -0
  123. package/components/formatters/TagsFormatter/slots/TagsFormatterSlots.d.ts +6 -0
  124. package/components/formatters/TagsFormatter/slots/TagsFormatterSlots.js +16 -0
  125. package/components/formatters/TagsFormatter/subcomponents/Tag/Tag.d.ts +5 -0
  126. package/components/formatters/TagsFormatter/subcomponents/Tag/Tag.js +35 -0
  127. package/components/formatters/TagsFormatter/subcomponents/Tag/index.d.ts +1 -0
  128. package/components/formatters/TagsFormatter/subcomponents/Tag/index.js +1 -0
  129. package/components/formatters/TagsFormatter/types.d.ts +47 -0
  130. package/components/formatters/index.d.ts +6 -5
  131. package/components/hook-form/RHFormContext/index.d.ts +1 -1
  132. package/components/mui_extended/CircularProgress/types.d.ts +1 -1
  133. package/components/popups/components/PopupsProvider/contexts/PopupsContext/store.js +1 -5
  134. package/components/popups/components/PopupsProvider/contexts/PopupsContext/types.d.ts +1 -1
  135. package/components/popups/components/PopupsProvider/hooks/usePopups.d.ts +4 -2
  136. package/components/popups/components/PopupsProvider/hooks/usePopups.js +7 -19
  137. package/components/popups/components/PopupsViewer/PopupsViewer.js +1 -1
  138. package/components/popups/components/PopupsViewer/PopupsViewer.styles.js +1 -1
  139. package/components/popups/components/PopupsViewer/subcomponents/Popup/Popup.js +21 -32
  140. package/contexts/ModalContext/index.js +5 -5
  141. package/index.js +32 -28
  142. package/package.json +1 -1
  143. package/components/DataGrid/formatters/ColumnIconFormatter/constants.js +0 -4
  144. package/components/DataGrid/formatters/ColumnIconFormatter/helpers/renderIcon.js +0 -58
  145. package/components/DataGrid/formatters/ColumnIconFormatter/helpers/renderMultipleIcons.d.ts +0 -7
  146. package/components/DataGrid/formatters/ColumnIconFormatter/helpers/renderMultipleIcons.js +0 -19
  147. package/components/Stepper/subcomponents/StepArea/hooks/useStepArea.d.ts +0 -13
  148. package/components/Stepper/subcomponents/StepArea/hooks/useStepArea.js +0 -111
  149. package/components/Stepper/subcomponents/StepArea/hooks/useVisibileSteps.d.ts +0 -8
  150. package/components/Stepper/subcomponents/StepArea/hooks/useVisibileSteps.js +0 -79
  151. package/components/Stepper/subcomponents/StepperContent/subcomponents/Step/hooks/useIsStepVisible.d.ts +0 -8
  152. package/components/Stepper/subcomponents/StepperContent/subcomponents/Step/hooks/useIsStepVisible.js +0 -93
@@ -3,7 +3,7 @@ import { useModuleDictionary, useEnvironment } from "@m4l/core";
3
3
  import { useIsMobile } from "@m4l/graphics";
4
4
  import { useCallback } from "react";
5
5
  import { u as useModal } from "../../../hooks/useModal/index.js";
6
- import { b as ContentModalSettingStyled, D as DataGridRootStyled } from "../slots/DataGridSlot.js";
6
+ import { a as ContentModalSettingStyled, D as DataGridRootStyled } from "../slots/DataGridSlot.js";
7
7
  import { p as pathIcons } from "../icons.js";
8
8
  import { C as CardDetails } from "../subcomponents/Cards/subcomponents/CardDetails/index.js";
9
9
  import { D as DICTIONARY } from "../dictionary.js";
@@ -12,7 +12,6 @@ import { A as ActionsContainer } from "../../CommonActions/components/ActionsCon
12
12
  import { W as WindowBase } from "../../WindowBase/WindowBase.js";
13
13
  import { A as ActionCancel } from "../../CommonActions/components/ActionCancel/ActionCancel.js";
14
14
  const useModalDetail = ({
15
- row,
16
15
  columns,
17
16
  viewMode,
18
17
  onRowsChange
@@ -22,52 +21,54 @@ const useModalDetail = ({
22
21
  const { getLabel } = useModuleDictionary();
23
22
  const { host_static_assets, environment_assets } = useEnvironment();
24
23
  const isMobile = useIsMobile();
25
- const onOpenDetail = useCallback(() => {
26
- const viewColumnsConfig = getConfigColumns(viewMode);
27
- openModal({
28
- initialWidth: 500,
29
- initialHeight: 680,
30
- fullScreen: isMobile,
31
- window: /* @__PURE__ */ jsx(
32
- WindowBase,
33
- {
34
- title: getLabel(DICTIONARY.DETAILS),
35
- iconUrl: `${host_static_assets}/${environment_assets}/${pathIcons.info}`,
36
- onClose: closeModal,
37
- className: "detail-modal",
38
- variant: "outlined",
39
- emergeType: "modal",
40
- children: /* @__PURE__ */ jsxs(ContentModalSettingStyled, { children: [
41
- /* @__PURE__ */ jsx(DataGridRootStyled, { children: /* @__PURE__ */ jsx(
42
- CardDetails,
43
- {
44
- row,
45
- columns,
46
- viewColumnsConfig,
47
- onRowsChange,
48
- size: size || "medium"
49
- }
50
- ) }),
51
- /* @__PURE__ */ jsx(ActionsContainer, { children: /* @__PURE__ */ jsx(ActionCancel, { onClick: closeModal }) })
52
- ] })
53
- }
54
- )
55
- });
56
- }, [
57
- row,
58
- columns,
59
- viewMode,
60
- onRowsChange,
61
- size,
62
- getConfigColumns,
63
- openModal,
64
- closeModal,
65
- getLabel,
66
- host_static_assets,
67
- environment_assets,
68
- isMobile
69
- ]);
70
- return onOpenDetail;
24
+ const handleOpenDetail = useCallback(
25
+ (row) => {
26
+ const viewColumnsConfig = getConfigColumns(viewMode);
27
+ openModal({
28
+ initialWidth: 500,
29
+ initialHeight: 680,
30
+ fullScreen: isMobile,
31
+ window: /* @__PURE__ */ jsx(
32
+ WindowBase,
33
+ {
34
+ title: getLabel(DICTIONARY.DETAILS),
35
+ iconUrl: `${host_static_assets}/${environment_assets}/${pathIcons.info}`,
36
+ onClose: closeModal,
37
+ className: "detail-modal",
38
+ variant: "outlined",
39
+ emergeType: "modal",
40
+ children: /* @__PURE__ */ jsxs(ContentModalSettingStyled, { children: [
41
+ /* @__PURE__ */ jsx(DataGridRootStyled, { children: /* @__PURE__ */ jsx(
42
+ CardDetails,
43
+ {
44
+ row,
45
+ columns,
46
+ viewColumnsConfig,
47
+ onRowsChange,
48
+ size: size || "medium"
49
+ }
50
+ ) }),
51
+ /* @__PURE__ */ jsx(ActionsContainer, { children: /* @__PURE__ */ jsx(ActionCancel, { onClick: closeModal }) })
52
+ ] })
53
+ }
54
+ )
55
+ });
56
+ },
57
+ [
58
+ columns,
59
+ onRowsChange,
60
+ size,
61
+ getConfigColumns,
62
+ openModal,
63
+ closeModal,
64
+ getLabel,
65
+ host_static_assets,
66
+ environment_assets,
67
+ isMobile,
68
+ viewMode
69
+ ]
70
+ );
71
+ return handleOpenDetail;
71
72
  };
72
73
  export {
73
74
  useModalDetail as u
@@ -1,7 +1,7 @@
1
1
  export { DataGrid } from './DataGrid';
2
2
  export * from './formatters';
3
3
  export type { Column, RenderEditCellProps, RenderCellProps } from 'react-data-grid';
4
- export type { RowKey, ChangeUserColumn, RowActionsGetter, RowKeyGetter } from './types';
4
+ export type { RowKey, ChangeUserColumn } from './types';
5
5
  export { getDataGridComponentsDictionary } from './dictionary';
6
6
  export { TextEditor, NumberEditor } from './subcomponents/editors/TextEditor';
7
7
  export { getDataGridRowsFromSet } from './utils/getDataGridRowsFromSet';
@@ -33,9 +33,11 @@ export declare enum TableSlots {
33
33
  textToggleCardButton = "textToggleCardButton",
34
34
  card = "card",
35
35
  cardsContainer = "cardsContainer",
36
+ cardContentWrapper = "cardContentWrapper",
36
37
  cardHeader = "cardHeader",
37
38
  cardHeaderLeft = "cardHeaderLeft",
38
39
  cardHeaderRight = "cardHeaderRight",
40
+ cardContent = "cardContent",
39
41
  containerLabelValueColumn = "containerLabelValueColumn",
40
42
  contentWrapperColumn = "contentWrapperColumn",
41
43
  cardDetailContainer = "cardDetailContainer",
@@ -36,9 +36,11 @@ var TableSlots = /* @__PURE__ */ ((TableSlots2) => {
36
36
  TableSlots2["textToggleCardButton"] = "textToggleCardButton";
37
37
  TableSlots2["card"] = "card";
38
38
  TableSlots2["cardsContainer"] = "cardsContainer";
39
+ TableSlots2["cardContentWrapper"] = "cardContentWrapper";
39
40
  TableSlots2["cardHeader"] = "cardHeader";
40
41
  TableSlots2["cardHeaderLeft"] = "cardHeaderLeft";
41
42
  TableSlots2["cardHeaderRight"] = "cardHeaderRight";
43
+ TableSlots2["cardContent"] = "cardContent";
42
44
  TableSlots2["containerLabelValueColumn"] = "containerLabelValueColumn";
43
45
  TableSlots2["contentWrapperColumn"] = "contentWrapperColumn";
44
46
  TableSlots2["cardDetailContainer"] = "cardDetailContainer";
@@ -44,7 +44,9 @@ export declare const CardStyled: import('@emotion/styled').StyledComponent<any,
44
44
  export declare const CardHeaderStyled: import('@emotion/styled').StyledComponent<any, Pick<import('react').DetailedHTMLProps<import('react').HTMLAttributes<HTMLDivElement>, HTMLDivElement>, keyof import('react').ClassAttributes<HTMLDivElement> | keyof import('react').HTMLAttributes<HTMLDivElement>>, {}>;
45
45
  export declare const CardHeaderLeftStyled: import('@emotion/styled').StyledComponent<any, Pick<import('react').DetailedHTMLProps<import('react').HTMLAttributes<HTMLDivElement>, HTMLDivElement>, keyof import('react').ClassAttributes<HTMLDivElement> | keyof import('react').HTMLAttributes<HTMLDivElement>>, {}>;
46
46
  export declare const CardHeaderRightStyled: import('@emotion/styled').StyledComponent<any, Pick<import('react').DetailedHTMLProps<import('react').HTMLAttributes<HTMLDivElement>, HTMLDivElement>, keyof import('react').ClassAttributes<HTMLDivElement> | keyof import('react').HTMLAttributes<HTMLDivElement>>, {}>;
47
- export declare const CardsContainerStyled: import('@emotion/styled').StyledComponent<any, {}, {}>;
47
+ export declare const CardContentWrapperStyled: import('@emotion/styled').StyledComponent<any, Pick<import('react').DetailedHTMLProps<import('react').HTMLAttributes<HTMLDivElement>, HTMLDivElement>, keyof import('react').ClassAttributes<HTMLDivElement> | keyof import('react').HTMLAttributes<HTMLDivElement>>, {}>;
48
+ export declare const CardContentStyled: import('@emotion/styled').StyledComponent<any, Pick<import('react').DetailedHTMLProps<import('react').HTMLAttributes<HTMLDivElement>, HTMLDivElement>, keyof import('react').ClassAttributes<HTMLDivElement> | keyof import('react').HTMLAttributes<HTMLDivElement>>, {}>;
49
+ export declare const CardsContainerStyled: import('@emotion/styled').StyledComponent<any, Pick<import('react').DetailedHTMLProps<import('react').HTMLAttributes<HTMLDivElement>, HTMLDivElement>, keyof import('react').ClassAttributes<HTMLDivElement> | keyof import('react').HTMLAttributes<HTMLDivElement>>, {}>;
48
50
  export declare const ContainerLabelValueColumnStyled: import('@emotion/styled').StyledComponent<any, Pick<import('react').DetailedHTMLProps<import('react').HTMLAttributes<HTMLDivElement>, HTMLDivElement>, keyof import('react').ClassAttributes<HTMLDivElement> | keyof import('react').HTMLAttributes<HTMLDivElement>>, {}>;
49
51
  export declare const ContentWrapperColumnStyled: import('@emotion/styled').StyledComponent<any, Pick<import('react').DetailedHTMLProps<import('react').HTMLAttributes<HTMLDivElement>, HTMLDivElement>, keyof import('react').ClassAttributes<HTMLDivElement> | keyof import('react').HTMLAttributes<HTMLDivElement>>, {}>;
50
52
  export declare const CardDetailContainerStyled: import('@emotion/styled').StyledComponent<any, Pick<import('react').DetailedHTMLProps<import('react').HTMLAttributes<HTMLDivElement>, HTMLDivElement>, keyof import('react').ClassAttributes<HTMLDivElement> | keyof import('react').HTMLAttributes<HTMLDivElement>>, {}>;
@@ -1,11 +1,10 @@
1
1
  import { styled } from "@mui/material/styles";
2
2
  import { MenuList, InputBase } from "@mui/material";
3
3
  import { D as DATAGRID_PREFIX_NAME } from "../constants.js";
4
- import { D as DataGridSlots, T as TextEditorSlots, A as ActionsSlots, C as ControlNavigateSlots, c as ColumnIconFormatterSlots, b as TableSlots, R as RowsCountSlots, a as ColumnsConfigSlots } from "./DataGridEnum.js";
4
+ import { D as DataGridSlots, T as TextEditorSlots, A as ActionsSlots, C as ControlNavigateSlots, b as TableSlots, R as RowsCountSlots, a as ColumnsConfigSlots, c as ColumnIconFormatterSlots } from "./DataGridEnum.js";
5
5
  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
- import { C as ContainerFlow } from "../../ContainerFlow/ContainerFlow.js";
9
8
  import { T as Typography } from "../../mui_extended/Typography/Typography.js";
10
9
  const DataGridRootStyled = styled("div", {
11
10
  name: DATAGRID_PREFIX_NAME,
@@ -91,7 +90,15 @@ const CardHeaderRightStyled = styled("div", {
91
90
  name: DATAGRID_PREFIX_NAME,
92
91
  slot: TableSlots.cardHeaderRight
93
92
  })(dataGridStyles.cardHeaderRight);
94
- const CardsContainerStyled = styled(ContainerFlow, {
93
+ const CardContentWrapperStyled = styled("div", {
94
+ name: DATAGRID_PREFIX_NAME,
95
+ slot: TableSlots.cardContentWrapper
96
+ })(dataGridStyles.cardContentWrapper);
97
+ const CardContentStyled = styled("div", {
98
+ name: DATAGRID_PREFIX_NAME,
99
+ slot: TableSlots.cardContent
100
+ })(dataGridStyles.cardContent);
101
+ const CardsContainerStyled = styled("div", {
95
102
  name: DATAGRID_PREFIX_NAME,
96
103
  slot: TableSlots.cardsContainer
97
104
  })(dataGridStyles.cardsContainer);
@@ -207,54 +214,55 @@ const ControlNavigateStyled = styled("div", {
207
214
  name: DATAGRID_PREFIX_NAME,
208
215
  slot: ControlNavigateSlots.controlNavigate
209
216
  })(dataGridStyles.controlNavigate);
210
- const ColumnIconFormatterStyled = styled("div", {
217
+ styled("div", {
211
218
  name: DATAGRID_PREFIX_NAME,
212
219
  slot: ColumnIconFormatterSlots.columnIconFormatter
213
220
  })(dataGridStyles.columnIconFormatter);
214
221
  export {
215
222
  ActionsRootStyled as A,
216
- DraggableHeaderRootStyled as B,
223
+ NameColumnStyled as B,
217
224
  CustomHeaderStyled as C,
218
225
  DataGridRootStyled as D,
219
226
  EditorCellWrapperStyled as E,
220
- ButtonHeaderActionsStyled as F,
221
- DraggableWrapperInputBaseStyled as G,
222
- IconSearchStyled as H,
227
+ DraggableHeaderRootStyled as F,
228
+ ButtonHeaderActionsStyled as G,
229
+ DraggableWrapperInputBaseStyled as H,
223
230
  IconColumnStyled as I,
224
- HeaderInputBaseStyled as J,
225
- HeaderRenderClickStyled as K,
231
+ IconSearchStyled as J,
232
+ HeaderInputBaseStyled as K,
226
233
  LabelHeaderColumnStyled as L,
227
234
  MenuListStyled as M,
228
235
  NameColumnIconStyled as N,
229
- InputTextEditorStyled as O,
236
+ HeaderRenderClickStyled as O,
237
+ InputTextEditorStyled as P,
230
238
  RowsCountRootStyled as R,
231
239
  TableWrapperDataGridStyled as T,
232
240
  ValueColumnStyled as V,
233
241
  WrapperSkeletonStyled as W,
234
- ColumnIconFormatterStyled as a,
235
- ContentModalSettingStyled as b,
236
- ContainerLabelValueColumnStyled as c,
237
- ContentWrapperColumnStyled as d,
238
- CardsContainerStyled as e,
239
- CardDetailContainerStyled as f,
240
- CardHeaderStyled as g,
241
- CardHeaderLeftStyled as h,
242
- CardHeaderRightStyled as i,
243
- CardStyled as j,
244
- CheckboxCellWrapperStyled as k,
245
- ControlNavigateStyled as l,
246
- ActionsConfigContainerStyled as m,
247
- ContainerLeftActionsStyled as n,
248
- ContainerRightActionsStyled as o,
249
- RowsCountLabelStyled as p,
250
- RowsCountValueStyled as q,
251
- ColumnsConfigWrapperStyled as r,
252
- ColumnsConfigDataGridStyled as s,
253
- ColumnsConfigSelColumnsStyled as t,
254
- ColumnsConfigActiosStyled as u,
255
- ContainerToggleCardsStyled as v,
256
- CardToggleButtonStyled as w,
257
- TextToggleCardButtonStyled as x,
258
- TableContainerStyled as y,
259
- NameColumnStyled as z
242
+ ContentModalSettingStyled as a,
243
+ ContainerLabelValueColumnStyled as b,
244
+ ContentWrapperColumnStyled as c,
245
+ CardsContainerStyled as d,
246
+ CardDetailContainerStyled as e,
247
+ CardHeaderStyled as f,
248
+ CardHeaderLeftStyled as g,
249
+ CardHeaderRightStyled as h,
250
+ CardContentWrapperStyled as i,
251
+ CardContentStyled as j,
252
+ CardStyled as k,
253
+ CheckboxCellWrapperStyled as l,
254
+ ControlNavigateStyled as m,
255
+ ActionsConfigContainerStyled as n,
256
+ ContainerLeftActionsStyled as o,
257
+ ContainerRightActionsStyled as p,
258
+ RowsCountLabelStyled as q,
259
+ RowsCountValueStyled as r,
260
+ ColumnsConfigWrapperStyled as s,
261
+ ColumnsConfigDataGridStyled as t,
262
+ ColumnsConfigSelColumnsStyled as u,
263
+ ColumnsConfigActiosStyled as v,
264
+ ContainerToggleCardsStyled as w,
265
+ CardToggleButtonStyled as x,
266
+ TextToggleCardButtonStyled as y,
267
+ TableContainerStyled as z
260
268
  };
@@ -0,0 +1,18 @@
1
+ import { CalculateCardHeightProps } from '../types';
2
+ /**
3
+ * Calcula la altura estimada de una card basándose en el número de columnas visibles.
4
+ * @param visibleColumnsCount - Número de columnas visibles en la card
5
+ * @param customMinHeight - Altura mínima personalizada (opcional, para customRender)
6
+ * @returns Altura calculada en píxeles
7
+ *
8
+ * Fórmula:
9
+ * - 32px por cada columna visible (altura de label + value)
10
+ * - 40px de padding, márgenes y header
11
+ * - Mínimo de 120px para garantizar una altura base
12
+ *
13
+ * Ejemplos:
14
+ * - 3 columnas: Math.max(120, 3 * 32 + 40) = 136px
15
+ * - 5 columnas: Math.max(120, 5 * 32 + 40) = 200px
16
+ * - 10 columnas: Math.max(120, 10 * 32 + 40) = 360px
17
+ */
18
+ export declare function calculateCardHeight(props: CalculateCardHeightProps): number;
@@ -0,0 +1,10 @@
1
+ function calculateCardHeight(props) {
2
+ const { visibleColumnsCount, customMinHeight } = props;
3
+ if (customMinHeight !== void 0) {
4
+ return customMinHeight;
5
+ }
6
+ return Math.max(120, visibleColumnsCount * 32 + 40);
7
+ }
8
+ export {
9
+ calculateCardHeight as c
10
+ };
@@ -0,0 +1,9 @@
1
+ /**
2
+ * Helper para hacer scroll a una card por su key.
3
+ * Busca el elemento en el DOM usando querySelector y hace scrollIntoView.
4
+ * @param containerElement - Elemento contenedor que tiene scroll
5
+ * @param rowKey - Key de la fila/card a la que hacer scroll
6
+ * @param selectorType - Tipo de selector: 'class' o 'data-attribute'
7
+ * @param selectorName - Nombre de la clase o atributo base
8
+ */
9
+ export declare function scrollToCardElement(containerElement: HTMLElement | null, rowKey: string | number, selectorType?: 'class' | 'data-attribute', selectorName?: string): void;
@@ -0,0 +1,25 @@
1
+ function scrollToCardElement(containerElement, rowKey, selectorType = "data-attribute", selectorName = "data-row-key") {
2
+ if (!containerElement) {
3
+ console.warn("scrollToCardElement: containerElement is null");
4
+ return;
5
+ }
6
+ try {
7
+ const selector = selectorType === "class" ? `.${selectorName}-${rowKey}` : `[${selectorName}="${rowKey}"]`;
8
+ const foundElement = containerElement.querySelector(selector);
9
+ if (!foundElement) {
10
+ console.warn(
11
+ `scrollToCardElement: No se encontró card con selector "${selector}"`
12
+ );
13
+ return;
14
+ }
15
+ foundElement.scrollIntoView({
16
+ behavior: "auto",
17
+ block: "center"
18
+ });
19
+ } catch (error) {
20
+ console.error("scrollToCardElement: Error al hacer scroll", error);
21
+ }
22
+ }
23
+ export {
24
+ scrollToCardElement as s
25
+ };
@@ -2,8 +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, originalColumns, onRowsChange, }: CardContentProps<TRow>): {
5
+ export declare function useCardContent<TRow>({ row, columns, onRowsChange, }: CardContentProps<TRow>): {
6
6
  cardContent: import("react/jsx-runtime").JSX.Element[];
7
7
  columnsCount: number;
8
- onOpenDetail: () => void;
9
8
  };
@@ -1,89 +1,78 @@
1
1
  import { jsx, jsxs } from "react/jsx-runtime";
2
- import { useState, useMemo } from "react";
3
- import { u as useModalDetail } from "../../../hooks/useModalCardDetail.js";
2
+ import { useState } from "react";
4
3
  import { u as useDataGrid } from "../../../hooks/useDataGrid.js";
5
- import { c as ContainerLabelValueColumnStyled, d 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 } from "../../../slots/DataGridSlot.js";
6
5
  function useCardContent({
7
6
  row,
8
7
  columns,
9
- originalColumns,
10
8
  onRowsChange
11
9
  }) {
12
10
  const { getConfigColumns, size } = useDataGrid();
13
11
  const [editingColumnKey, setEditingColumnKey] = useState(null);
14
12
  const columnsConfig = getConfigColumns("cards");
15
- const onOpenDetail = useModalDetail({
16
- row,
17
- columns: originalColumns,
18
- viewMode: "cards",
19
- onRowsChange
20
- });
21
- const cardContent = useMemo(() => {
22
- return columns.map((column, index) => {
23
- const configColumn = columnsConfig.find(
24
- (config) => config.key === column.key
25
- );
26
- const shouldShowTitle = configColumn?.showTitle !== false;
27
- return /* @__PURE__ */ jsx(ContainerLabelValueColumnStyled, { children: /* @__PURE__ */ jsxs(
28
- ContentWrapperColumnStyled,
29
- {
30
- onDoubleClick: column.renderEditCell && editingColumnKey !== column.key ? () => {
31
- setEditingColumnKey(column.key);
32
- } : void 0,
33
- children: [
34
- shouldShowTitle && /* @__PURE__ */ jsx(LabelHeaderColumnStyled, { variant: "body", color: "text.secondary", children: column.name }),
35
- (() => {
36
- if (column.renderEditCell && editingColumnKey === column.key) {
37
- return /* @__PURE__ */ jsx(EditorCellWrapperStyled, { ownerState: { size }, children: column.renderEditCell({
38
- column,
39
- row,
40
- rowIdx: index,
41
- /**
42
- * onRowChange es una función que se ejecuta cuando el usuario edita una celda.
43
- */
44
- onRowChange: (updatedRow) => {
45
- if (onRowsChange) {
46
- onRowsChange([updatedRow], {
47
- indexes: [index],
48
- column
49
- });
50
- }
51
- },
52
- onClose: () => setEditingColumnKey(null)
53
- }) });
54
- }
55
- if (column.renderCell) {
56
- const cellContent = column.renderCell({
57
- column,
58
- row,
59
- rowIdx: index,
60
- isCellSelected: false,
61
- tabIndex: -1,
62
- /**
63
- * onRowChange es una función que se ejecuta cuando el usuario edita una celda.
64
- */
65
- onRowChange: (updatedRow) => {
66
- if (onRowsChange) {
67
- onRowsChange([updatedRow], {
68
- indexes: [index],
69
- column
70
- });
71
- }
13
+ const cardContent = columns.map((column, index) => {
14
+ const configColumn = columnsConfig.find(
15
+ (config) => config.key === column.key
16
+ );
17
+ const shouldShowTitle = configColumn?.showTitle !== false;
18
+ return /* @__PURE__ */ jsx(ContainerLabelValueColumnStyled, { children: /* @__PURE__ */ jsxs(
19
+ ContentWrapperColumnStyled,
20
+ {
21
+ onDoubleClick: column.renderEditCell && editingColumnKey !== column.key ? () => {
22
+ setEditingColumnKey(column.key);
23
+ } : void 0,
24
+ children: [
25
+ shouldShowTitle && /* @__PURE__ */ jsx(LabelHeaderColumnStyled, { variant: "body", color: "text.secondary", children: column.name }),
26
+ (() => {
27
+ if (column.renderEditCell && editingColumnKey === column.key) {
28
+ return /* @__PURE__ */ jsx(EditorCellWrapperStyled, { ownerState: { size }, children: column.renderEditCell({
29
+ column,
30
+ row,
31
+ rowIdx: index,
32
+ /**
33
+ * onRowChange es una función que se ejecuta cuando el usuario edita una celda.
34
+ */
35
+ onRowChange: (updatedRow) => {
36
+ if (onRowsChange) {
37
+ onRowsChange([updatedRow], {
38
+ indexes: [index],
39
+ column
40
+ });
41
+ }
42
+ },
43
+ onClose: () => setEditingColumnKey(null)
44
+ }) });
45
+ }
46
+ if (column.renderCell) {
47
+ const cellContent = column.renderCell({
48
+ column,
49
+ row,
50
+ rowIdx: index,
51
+ isCellSelected: false,
52
+ tabIndex: -1,
53
+ /**
54
+ * onRowChange es una función que se ejecuta cuando el usuario edita una celda.
55
+ */
56
+ onRowChange: (updatedRow) => {
57
+ if (onRowsChange) {
58
+ onRowsChange([updatedRow], {
59
+ indexes: [index],
60
+ column
61
+ });
72
62
  }
73
- });
74
- return /* @__PURE__ */ jsx(ValueColumnStyled, { variant: "body", color: "text.primary", children: cellContent });
75
- }
76
- return /* @__PURE__ */ jsx(ValueColumnStyled, { variant: "body", color: "text.primary", children: row[column.key] ?? "-" });
77
- })()
78
- ]
79
- }
80
- ) }, column.key);
81
- });
82
- }, [columns, columnsConfig, row, onRowsChange, editingColumnKey, size]);
63
+ }
64
+ });
65
+ return /* @__PURE__ */ jsx(ValueColumnStyled, { variant: "body", color: "text.primary", children: cellContent });
66
+ }
67
+ return /* @__PURE__ */ jsx(ValueColumnStyled, { variant: "body", color: "text.primary", children: row[column.key] ?? "-" });
68
+ })()
69
+ ]
70
+ }
71
+ ) }, column.key);
72
+ });
83
73
  return {
84
74
  cardContent,
85
- columnsCount: columns.length,
86
- onOpenDetail
75
+ columnsCount: columns.length
87
76
  };
88
77
  }
89
78
  export {
@@ -1,7 +1,11 @@
1
1
  import { jsx } from "react/jsx-runtime";
2
- import { e as CardsContainerStyled } from "../../slots/DataGridSlot.js";
2
+ import { useRef, useMemo, useEffect } from "react";
3
+ import { d as CardsContainerStyled } from "../../slots/DataGridSlot.js";
3
4
  import { C as CardRow } from "./subcomponents/CardRow/index.js";
4
5
  import { u as useProcessedColumns } from "../../hooks/useProcessedColumns.js";
6
+ import { c as calculateCardHeight } from "./helpers/calculateCardHeight.js";
7
+ import { u as useModalDetail } from "../../hooks/useModalCardDetail.js";
8
+ import { s as scrollToCardElement } from "./helpers/scrollToCardElement.js";
5
9
  import { C as ContainerFlow } from "../../../ContainerFlow/ContainerFlow.js";
6
10
  function Cards(props) {
7
11
  const {
@@ -11,29 +15,80 @@ function Cards(props) {
11
15
  selectedRows,
12
16
  onSelectedRowsChange,
13
17
  onRowsChange,
14
- cardsViewConfig
18
+ cardsViewConfig,
19
+ focusOnRowKey,
20
+ checkedRows,
21
+ onCheckedRowsChange
15
22
  } = props;
23
+ const containerRef = useRef(null);
16
24
  const processedColumns = useProcessedColumns(columns);
17
25
  const allProcessedColumns = useProcessedColumns(columns, {
18
26
  applyVisibilityFilter: false
19
27
  });
28
+ const handleOpenDetail = useModalDetail({
29
+ columns: allProcessedColumns,
30
+ viewMode: "cards",
31
+ onRowsChange
32
+ });
33
+ const cardHeight = useMemo(() => {
34
+ return calculateCardHeight({
35
+ visibleColumnsCount: processedColumns.length,
36
+ customMinHeight: cardsViewConfig?.customRender?.minHeight
37
+ });
38
+ }, [processedColumns.length, cardsViewConfig]);
39
+ useEffect(() => {
40
+ if (!focusOnRowKey) {
41
+ return;
42
+ }
43
+ const rowIndex = rows.findIndex(
44
+ (row) => rowKeyGetter(row) === focusOnRowKey
45
+ );
46
+ if (rowIndex === -1) {
47
+ return;
48
+ }
49
+ const timer = setTimeout(() => {
50
+ const container = containerRef.current;
51
+ if (!container) {
52
+ console.warn("container es null, abortando scroll");
53
+ return;
54
+ }
55
+ scrollToCardElement(
56
+ container,
57
+ focusOnRowKey,
58
+ "data-attribute",
59
+ "data-row-key"
60
+ );
61
+ }, 300);
62
+ return () => clearTimeout(timer);
63
+ }, [focusOnRowKey, rows, rowKeyGetter, cardHeight]);
20
64
  if (processedColumns.length === 0) {
21
65
  return null;
22
66
  }
23
- return /* @__PURE__ */ jsx(CardsContainerStyled, { "data-testid": "cards-container", children: /* @__PURE__ */ jsx(ContainerFlow, { variant: "grid-layout", minWidth: 280, children: rows.map((row) => /* @__PURE__ */ jsx(
24
- CardRow,
25
- {
26
- row,
27
- columns: processedColumns,
28
- originalColumns: allProcessedColumns,
29
- rowKeyGetter,
30
- selectedRows,
31
- onSelectedRowsChange,
32
- onRowsChange,
33
- customRender: cardsViewConfig?.customRender
34
- },
35
- rowKeyGetter(row)
36
- )) }) });
67
+ return /* @__PURE__ */ jsx(CardsContainerStyled, { "data-testid": "cards-container", ref: containerRef, children: /* @__PURE__ */ jsx(ContainerFlow, { variant: "grid-layout", minWidth: 280, children: rows.map((row) => {
68
+ const rowKey = rowKeyGetter(row);
69
+ const isChecked = checkedRows?.has(rowKey) || false;
70
+ const showCheckbox = checkedRows !== void 0 && onCheckedRowsChange !== void 0;
71
+ return /* @__PURE__ */ jsx(
72
+ CardRow,
73
+ {
74
+ row,
75
+ columns: processedColumns,
76
+ originalColumns: allProcessedColumns,
77
+ rowKeyGetter,
78
+ selectedRows,
79
+ onSelectedRowsChange,
80
+ onRowsChange,
81
+ customRender: cardsViewConfig?.customRender,
82
+ minHeight: cardHeight,
83
+ isChecked,
84
+ showCheckbox,
85
+ checkedRows,
86
+ onCheckedRowsChange,
87
+ onOpenDetail: handleOpenDetail
88
+ },
89
+ rowKeyGetter(row)
90
+ );
91
+ }) }) });
37
92
  }
38
93
  export {
39
94
  Cards as C