@m4l/components 9.3.19-BE101025-beta.2 → 9.3.19-BE241025-beta.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (210) hide show
  1. package/@types/types.d.ts +1 -1
  2. package/components/AccountPopover/AccountPopover.js +12 -13
  3. package/components/AccountPopover/subcomponents/MenuPopover/MenuPopover.d.ts +1 -1
  4. package/components/AccountPopover/subcomponents/MenuPopover/MenuPopover.js +7 -4
  5. package/components/AccountPopover/subcomponents/MenuPopover/types.d.ts +1 -1
  6. package/components/Chip/Chip.js +9 -7
  7. package/components/Chip/ChipStyles.js +4 -31
  8. package/components/Chip/helpers.d.ts +10 -0
  9. package/components/Chip/helpers.js +34 -0
  10. package/components/Chip/types.d.ts +6 -0
  11. package/components/DataGrid/DataGrid.js +9 -4
  12. package/components/DataGrid/Datagrid.styles.js +270 -0
  13. package/components/DataGrid/constants.js +2 -2
  14. package/components/DataGrid/contexts/DataGridContext/index.js +322 -112
  15. package/components/DataGrid/contexts/DataGridContext/types.d.ts +63 -4
  16. package/components/DataGrid/dictionary.d.ts +5 -0
  17. package/components/DataGrid/dictionary.js +6 -1
  18. package/components/DataGrid/formatters/ColumnSetCheckFormatter/formatter.js +2 -2
  19. package/components/DataGrid/hooks/useModalCardDetail.d.ts +6 -0
  20. package/components/DataGrid/hooks/useModalCardDetail.js +74 -0
  21. package/components/DataGrid/hooks/useProcessedColumns.d.ts +50 -0
  22. package/components/DataGrid/hooks/useProcessedColumns.js +44 -0
  23. package/components/DataGrid/icons.d.ts +7 -0
  24. package/components/DataGrid/icons.js +5 -1
  25. package/components/DataGrid/index.d.ts +1 -1
  26. package/components/DataGrid/slots/DataGridEnum.d.ts +22 -1
  27. package/components/DataGrid/slots/DataGridEnum.js +21 -0
  28. package/components/DataGrid/slots/DataGridSlot.d.ts +24 -0
  29. package/components/DataGrid/slots/DataGridSlot.js +123 -21
  30. package/components/DataGrid/subcomponents/Cards/hooks/useCardContent.d.ts +9 -0
  31. package/components/DataGrid/subcomponents/Cards/hooks/useCardContent.js +91 -0
  32. package/components/DataGrid/subcomponents/Cards/index.d.ts +5 -0
  33. package/components/DataGrid/subcomponents/Cards/index.js +40 -0
  34. package/components/DataGrid/subcomponents/Cards/subcomponents/CardDetails/index.d.ts +8 -0
  35. package/components/DataGrid/subcomponents/Cards/subcomponents/CardDetails/index.js +79 -0
  36. package/components/DataGrid/subcomponents/Cards/subcomponents/CardHeader/index.d.ts +7 -0
  37. package/components/DataGrid/subcomponents/Cards/subcomponents/CardHeader/index.js +98 -0
  38. package/components/DataGrid/subcomponents/Cards/subcomponents/CardRow/index.d.ts +6 -0
  39. package/components/DataGrid/subcomponents/Cards/subcomponents/CardRow/index.js +71 -0
  40. package/components/DataGrid/subcomponents/Cards/subcomponents/IntersectCard/index.d.ts +20 -0
  41. package/components/DataGrid/subcomponents/Cards/subcomponents/IntersectCard/index.js +46 -0
  42. package/components/DataGrid/subcomponents/Cards/subcomponents/LazyLoadCard/index.d.ts +17 -0
  43. package/components/DataGrid/subcomponents/Cards/subcomponents/LazyLoadCard/index.js +34 -0
  44. package/components/DataGrid/subcomponents/Cards/types.d.ts +118 -0
  45. package/components/DataGrid/subcomponents/CheckboxCellAdapter/index.d.ts +7 -0
  46. package/components/DataGrid/subcomponents/CheckboxCellAdapter/index.js +43 -0
  47. package/components/DataGrid/subcomponents/CheckboxCellAdapter/types.d.ts +7 -0
  48. package/components/DataGrid/subcomponents/ControlNavigate/ControlNavigate.js +1 -1
  49. package/components/DataGrid/subcomponents/HeaderActions/index.js +5 -3
  50. package/components/DataGrid/subcomponents/HeaderActions/subcomponents/RowsCount/index.js +1 -1
  51. package/components/DataGrid/subcomponents/HeaderActions/subcomponents/Settings/index.js +11 -2
  52. package/components/DataGrid/subcomponents/HeaderActions/subcomponents/Settings/subcomponents/ColumnsConfig/index.js +1 -1
  53. package/components/DataGrid/subcomponents/HeaderActions/subcomponents/Settings/subcomponents/ColumnsConfigCards/index.d.ts +2 -0
  54. package/components/DataGrid/subcomponents/HeaderActions/subcomponents/Settings/subcomponents/ColumnsConfigCards/index.js +304 -0
  55. package/components/DataGrid/subcomponents/HeaderActions/subcomponents/Settings/subcomponents/ColumnsConfigCards/types.d.ts +31 -0
  56. package/components/DataGrid/subcomponents/HeaderActions/subcomponents/ViewMode/index.d.ts +4 -0
  57. package/components/DataGrid/subcomponents/HeaderActions/subcomponents/ViewMode/index.js +125 -0
  58. package/components/DataGrid/subcomponents/HeaderActions/subcomponents/hooks/useModalSettings/index.js +3 -3
  59. package/components/DataGrid/subcomponents/HeaderActions/subcomponents/hooks/useModalSettingsCards/index.d.ts +7 -0
  60. package/components/DataGrid/subcomponents/HeaderActions/subcomponents/hooks/useModalSettingsCards/index.js +74 -0
  61. package/components/DataGrid/subcomponents/HeaderActions/subcomponents/hooks/useModalSettingsCards/types.d.ts +4 -0
  62. package/components/DataGrid/subcomponents/RenderContent/index.d.ts +5 -0
  63. package/components/DataGrid/subcomponents/RenderContent/index.js +11 -0
  64. package/components/DataGrid/subcomponents/Table/hooks/useHeaderMenuActions.js +2 -2
  65. package/components/DataGrid/subcomponents/Table/hooks/useSortColumnsRows.js +1 -1
  66. package/components/DataGrid/subcomponents/Table/index.js +1 -1
  67. package/components/DataGrid/subcomponents/Table/subcomponents/ActionsColumn.js +1 -1
  68. package/components/DataGrid/subcomponents/Table/subcomponents/DraggableHeaderRenderer.js +1 -1
  69. package/components/DataGrid/subcomponents/Table/subcomponents/HeaderRenderClick/HeaderRenderClick.js +1 -1
  70. package/components/DataGrid/subcomponents/editors/TextEditor/index.js +1 -1
  71. package/components/DataGrid/tests/components/CardDetails.test.d.ts +1 -0
  72. package/components/DataGrid/tests/components/CardHeader.test.d.ts +1 -0
  73. package/components/DataGrid/tests/components/CardRow.test.d.ts +1 -0
  74. package/components/DataGrid/tests/components/Cards.test.d.ts +1 -0
  75. package/components/DataGrid/tests/components/CheckboxCellAdapter.test.d.ts +1 -0
  76. package/components/DataGrid/tests/components/ColumnsConfigCards.test.d.ts +1 -0
  77. package/components/DataGrid/tests/components/IntersectCard.test.d.ts +1 -0
  78. package/components/DataGrid/tests/components/ViewMode.test.d.ts +1 -0
  79. package/components/DataGrid/tests/helpers/types.d.ts +1 -0
  80. package/components/DataGrid/tests/helpers/useCardsViewConfig.d.ts +24 -0
  81. package/components/DataGrid/tests/helpers/useCustomCardExample.d.ts +7 -0
  82. package/components/DataGrid/tests/hooks/useCardContent.test.d.ts +1 -0
  83. package/components/DataGrid/tests/hooks/useModalDetail.test.d.ts +1 -0
  84. package/components/DataGrid/tests/hooks/useModalSettingsCards.test.d.ts +1 -0
  85. package/components/DataGrid/tests/hooks/useProcessedColumns.test.d.ts +1 -0
  86. package/components/DataGrid/types.d.ts +87 -5
  87. package/components/DragResizeWindowRND/DragResizeWindowRND.js +14 -10
  88. package/components/DragResizeWindowRND/helpers/expandingParentContainer.d.ts +1 -1
  89. package/components/DragResizeWindowRND/helpers/expandingParentContainer.js +24 -19
  90. package/components/DragResizeWindowRND/helpers/getInitialSize.d.ts +3 -3
  91. package/components/DragResizeWindowRND/helpers/getInitialSize.js +18 -15
  92. package/components/DragResizeWindowRND/helpers/shrinkingParentContainer.d.ts +1 -1
  93. package/components/DragResizeWindowRND/helpers/shrinkingParentContainer.js +17 -9
  94. package/components/DragResizeWindowRND/hooks/useRNDDimensionEffects.js +4 -1
  95. package/components/DragResizeWindowRND/index.d.ts +1 -0
  96. package/components/DragResizeWindowRND/types.d.ts +12 -2
  97. package/components/DynamicFilter/DynamicFilter.js +2 -1
  98. package/components/DynamicFilter/helpers/formatToInitialFilters.js +3 -3
  99. package/components/DynamicFilter/helpers/frontEndHelpers.d.ts +2 -2
  100. package/components/DynamicFilter/helpers/frontEndHelpers.js +31 -9
  101. package/components/DynamicFilter/subcomponents/DynamicFilterBase/DynamicFilterBase.d.ts +2 -1
  102. package/components/DynamicFilter/subcomponents/DynamicFilterBase/DynamicFilterBase.js +4 -2
  103. package/components/DynamicFilter/subcomponents/DynamicFilterBase/types.d.ts +3 -0
  104. package/components/DynamicFilter/subcomponents/FieldTypes/BooleanFilter/helpers.js +11 -3
  105. package/components/DynamicFilter/subcomponents/FieldTypes/DateTimeFilter/helpers.js +16 -4
  106. package/components/DynamicFilter/subcomponents/FieldTypes/NumberFilter/helpers.js +11 -8
  107. package/components/DynamicFilter/subcomponents/FieldTypes/SelectAsyncFilter/helpers.js +21 -8
  108. package/components/DynamicFilter/subcomponents/FieldTypes/SelectFilter/helpers.js +18 -8
  109. package/components/DynamicFilter/subcomponents/FieldTypes/StringFilter/helpers.js +5 -3
  110. package/components/DynamicFilter/subcomponents/PopoverFilter/PopoverFilter.js +1 -1
  111. package/components/DynamicFilter/types.d.ts +4 -0
  112. package/components/DynamicSort/DynamicSort.js +2 -1
  113. package/components/DynamicSort/subcomponents/DynamicSortBase/DynamicSortBase.d.ts +2 -1
  114. package/components/DynamicSort/subcomponents/DynamicSortBase/DynamicSortBase.js +4 -2
  115. package/components/DynamicSort/subcomponents/DynamicSortBase/types.d.ts +3 -0
  116. package/components/DynamicSort/subcomponents/PopoverSort/PopoverSort.js +1 -1
  117. package/components/DynamicSort/types.d.ts +4 -0
  118. package/components/EditLabel/hooks/useEditLabel.d.ts +1 -0
  119. package/components/GridLayout/subcomponents/GridItem/index.js +2 -2
  120. package/components/Image/Image.js +4 -1
  121. package/components/LanguagePopover/LanguagePopover.js +2 -0
  122. package/components/MFIsolationApp/MFIsolationApp.js +1 -4
  123. package/components/MFIsolationApp/subcomponents/AppBarSettings/AppBarSettings.js +1 -1
  124. package/components/MFIsolationAppStorybook/MFIsolationAppStorybook.js +4 -20
  125. package/components/MFIsolationAppStorybook/types.d.ts +0 -4
  126. package/components/MFLoader/MFLoader.js +8 -3
  127. package/components/MFLoader/styles.js +1 -1
  128. package/components/MFLoader/types.d.ts +10 -0
  129. package/components/MenuActions/MenuActions.js +105 -55
  130. package/components/ObjectLogs/hooks/useDetailFormatter.js +1 -1
  131. package/components/WindowBase/WindowBase.js +3 -3
  132. package/components/WindowBase/WindowBase.styles.js +36 -31
  133. package/components/WindowBase/constants.d.ts +1 -1
  134. package/components/WindowBase/constants.js +2 -2
  135. package/components/WindowBase/index.d.ts +1 -0
  136. package/components/WindowBase/subcomponents/Component/index.js +2 -2
  137. package/components/WindowBase/subcomponents/Component/types.d.ts +2 -0
  138. package/components/WindowBase/subcomponents/Header/HeaderWindowBase.js +7 -7
  139. package/components/WindowBase/subcomponents/Header/types.d.ts +1 -1
  140. package/components/WindowBase/subcomponents/MicroFrontend/types.d.ts +4 -0
  141. package/components/WindowBase/types.d.ts +3 -3
  142. package/components/WindowConfirm/WindowConfirm.js +1 -1
  143. package/components/areas/components/AreasViewer/AreasViewer.styles.js +1 -1
  144. package/components/areas/components/AreasViewer/subcomponents/Area/subcomponents/Window/Window.js +6 -2
  145. package/components/areas/components/AreasViewer/subcomponents/Area/subcomponents/Window/hooks/useWindow.d.ts +1 -0
  146. package/components/areas/components/AreasViewer/subcomponents/Area/subcomponents/Window/hooks/useWindow.js +21 -3
  147. package/components/areas/index.d.ts +1 -1
  148. package/components/areas/types.d.ts +1 -1
  149. package/components/formatters/DistanceToNowFormatter/DistanceToNowFormatter.js +3 -34
  150. package/components/formatters/DistanceToNowFormatter/dictionary.d.ts +8 -0
  151. package/components/formatters/DistanceToNowFormatter/hooks/useDistanceToNowFormatter.d.ts +13 -0
  152. package/components/formatters/DistanceToNowFormatter/hooks/useDistanceToNowFormatter.js +65 -0
  153. package/components/formatters/DistanceToNowFormatter/index.d.ts +1 -0
  154. package/components/formatters/DistanceToNowFormatter/types.d.ts +4 -1
  155. package/components/hook-form/RHFAutocomplete/RHFAutocomplete.d.ts +1 -1
  156. package/components/hook-form/RHFAutocomplete/RHFAutocomplete.js +8 -4
  157. package/components/hook-form/RHFAutocomplete/constants.d.ts +1 -0
  158. package/components/hook-form/RHFAutocomplete/constants.js +5 -1
  159. package/components/hook-form/RHFAutocomplete/types.d.ts +2 -2
  160. package/components/hook-form/RHFAutocompleteAsync/RHFAutocompleteAsync.js +6 -4
  161. package/components/hook-form/RHFAutocompleteAsync/slots/RHFAutocompleteSlotsAsync.d.ts +1 -1
  162. package/components/hook-form/RHFAutocompleteAsync/types.d.ts +4 -0
  163. package/components/mui_extended/Autocomplete/Autocomplete.d.ts +4 -8
  164. package/components/mui_extended/Autocomplete/Autocomplete.js +11 -11
  165. package/components/mui_extended/Autocomplete/Autocomplete.styles.js +7 -3
  166. package/components/mui_extended/Autocomplete/RenderAdornment/RenderAdornment.d.ts +6 -0
  167. package/components/mui_extended/Autocomplete/RenderAdornment/RenderAdornment.js +45 -0
  168. package/components/mui_extended/Autocomplete/hooks/useEndAdornments.js +2 -1
  169. package/components/mui_extended/Autocomplete/hooks/useStartAdornments.d.ts +4 -12
  170. package/components/mui_extended/Autocomplete/hooks/useStartAdornments.js +72 -23
  171. package/components/mui_extended/Autocomplete/hooks/useValuesAndHandlers.d.ts +0 -2
  172. package/components/mui_extended/Autocomplete/hooks/useValuesAndHandlers.js +0 -13
  173. package/components/mui_extended/Autocomplete/renderOptions/index.d.ts +4 -17
  174. package/components/mui_extended/Autocomplete/renderOptions/index.js +42 -5
  175. package/components/mui_extended/Autocomplete/renderOptions/types.d.ts +7 -0
  176. package/components/mui_extended/Autocomplete/types.d.ts +10 -3
  177. package/components/mui_extended/Button/ButtonStyles.js +15 -5
  178. package/components/mui_extended/ToggleIconButton/ToggleIconButton.js +6 -2
  179. package/components/mui_extended/ToggleIconButton/ToggleIconButton.styles.js +9 -0
  180. package/components/mui_extended/ToggleIconButton/types.d.ts +1 -0
  181. package/components/mui_extended/index.d.ts +1 -1
  182. package/components/popups/components/PopupsProvider/hooks/usePopups.d.ts +2 -2
  183. package/components/popups/components/PopupsProvider/hooks/usePopups.js +0 -1
  184. package/components/popups/components/PopupsViewer/PopupsViewer.js +4 -3
  185. package/components/popups/components/PopupsViewer/subcomponents/Popup/Popup.js +5 -2
  186. package/components/popups/components/PopupsViewer/subcomponents/Popup/types.d.ts +5 -0
  187. package/components/popups/components/PopupsViewer/types.d.ts +3 -0
  188. package/contexts/AppearanceComponentContext/AppearanceComponentContext.js +4 -1
  189. package/hooks/index.d.ts +1 -0
  190. package/hooks/useDataGridPersistence/helpers.d.ts +2 -2
  191. package/hooks/useDataGridPersistence/useDataGridPersistence.d.ts +2 -2
  192. package/hooks/useDataGridPersistence/useDataGridPersistence.js +5 -0
  193. package/hooks/useSizeContainer/index.d.ts +2 -1
  194. package/hooks/useSizeContainer/index.js +22 -13
  195. package/hooks/useSizeContainer/types.d.ts +6 -0
  196. package/hooks/useStateRef/index.d.ts +1 -1
  197. package/hooks/useStateRef/index.js +6 -6
  198. package/index.js +53 -46
  199. package/package.json +3 -4
  200. package/utils/deepShallow.d.ts +17 -0
  201. package/utils/deepShallow.js +76 -0
  202. package/utils/formatDistanceToNow/formatDistanteToNow.d.ts +2 -2
  203. package/utils/formatDistanceToNow/formatDistanteToNow.js +18 -2
  204. package/utils/formatDistanceToNow/types.d.ts +13 -0
  205. package/utils/index.d.ts +1 -0
  206. package/components/MFIsolationAppStorybook/icons.js +0 -6
  207. package/components/MFIsolationAppStorybook/subcomponents/AppBarSettings/AppBarSettings.d.ts +0 -4
  208. package/components/MFIsolationAppStorybook/subcomponents/AppBarSettings/AppBarSettings.js +0 -21
  209. package/components/MFIsolationAppStorybook/subcomponents/AppBarSettings/index.d.ts +0 -1
  210. package/components/MFIsolationAppStorybook/subcomponents/AppBarSettings/index.js +0 -1
@@ -1,5 +1,5 @@
1
1
  import { jsx } from "react/jsx-runtime";
2
- import { SelectCellFormatter } from "react-data-grid";
2
+ import { C as CheckboxCellAdapter } from "../../subcomponents/CheckboxCellAdapter/index.js";
3
3
  function ColumnSetCheckFormatter(parameters) {
4
4
  const { field, disabledGetter, rowKeyGetter, useHook } = parameters;
5
5
  const formatter = (props) => {
@@ -19,7 +19,7 @@ function ColumnSetCheckFormatter(parameters) {
19
19
  disabled = disabledGetter(row);
20
20
  }
21
21
  return /* @__PURE__ */ jsx(
22
- SelectCellFormatter,
22
+ CheckboxCellAdapter,
23
23
  {
24
24
  value: checkedRows.has(rowKeyGetter(row)) || false,
25
25
  disabled,
@@ -0,0 +1,6 @@
1
+ import { UseModalDetailProps } from '../types';
2
+ /**
3
+ * Hook genérico que renderiza el modal de detalle para cualquier vista
4
+ * mostrando TODAS las columnas sin excepción
5
+ */
6
+ export declare const useModalDetail: <TRow>({ row, columns, viewMode, onRowsChange, }: UseModalDetailProps<TRow>) => () => void;
@@ -0,0 +1,74 @@
1
+ import { jsx, jsxs } from "react/jsx-runtime";
2
+ import { useModuleDictionary, useEnvironment } from "@m4l/core";
3
+ import { useIsMobile } from "@m4l/graphics";
4
+ import { useCallback } from "react";
5
+ import { u as useModal } from "../../../hooks/useModal/index.js";
6
+ import { b as ContentModalSettingStyled, D as DataGridRootStyled } from "../slots/DataGridSlot.js";
7
+ import { p as pathIcons } from "../icons.js";
8
+ import { C as CardDetails } from "../subcomponents/Cards/subcomponents/CardDetails/index.js";
9
+ import { D as DICTIONARY } from "../dictionary.js";
10
+ import { u as useDataGrid } from "./useDataGrid.js";
11
+ import { A as ActionsContainer } from "../../CommonActions/components/ActionsContainer/ActionsContainer.js";
12
+ import { W as WindowBase } from "../../WindowBase/WindowBase.js";
13
+ import { A as ActionCancel } from "../../CommonActions/components/ActionCancel/ActionCancel.js";
14
+ const useModalDetail = ({
15
+ row,
16
+ columns,
17
+ viewMode,
18
+ onRowsChange
19
+ }) => {
20
+ const { getConfigColumns, size } = useDataGrid();
21
+ const { openModal, closeModal } = useModal();
22
+ const { getLabel } = useModuleDictionary();
23
+ const { host_static_assets, environment_assets } = useEnvironment();
24
+ 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;
71
+ };
72
+ export {
73
+ useModalDetail as u
74
+ };
@@ -0,0 +1,50 @@
1
+ import { Column } from 'react-data-grid';
2
+ import { ProcessedColumnsOptions } from '../types';
3
+ /**
4
+ * Hook que procesa columnas para cualquier vista que no sea Table.
5
+ * - Aplica configuración de visibilidad y orden (opcional)
6
+ * - Convierte formatters a renderCell
7
+ * - Filtra columnas especiales (SelectColumn, ActionsColumn)
8
+ * - Filtra cualquier columna con renderCell problemático
9
+ * @param columns - Columnas originales del DataGrid
10
+ * @param options - Opciones de procesamiento
11
+ * @returns Columnas procesadas y filtradas listas para usar en cualquier vista
12
+ */
13
+ export declare function useProcessedColumns<TRow, TSummaryRow>(columns: readonly Column<TRow, TSummaryRow>[], options?: ProcessedColumnsOptions): {
14
+ name: string | import('react').ReactElement;
15
+ key: string;
16
+ width?: string | number | null | undefined;
17
+ minWidth?: number | null | undefined;
18
+ maxWidth?: number | null | undefined;
19
+ cellClass?: string | ((row: TRow) => string | null | undefined) | null | undefined;
20
+ headerCellClass?: string | null | undefined;
21
+ summaryCellClass?: string | ((row: TSummaryRow) => string | null | undefined) | null | undefined;
22
+ renderHeaderCell?: ((props: import('react-data-grid').RenderHeaderCellProps<TRow, TSummaryRow>) => import('react').ReactNode) | null | undefined;
23
+ renderCell?: ((props: import('react-data-grid').RenderCellProps<TRow, TSummaryRow>) => import('react').ReactNode) | null | undefined;
24
+ renderSummaryCell?: ((props: import('react-data-grid').RenderSummaryCellProps<TSummaryRow, TRow>) => import('react').ReactNode) | null | undefined;
25
+ renderGroupCell?: ((props: import('react-data-grid').RenderGroupCellProps<TRow, TSummaryRow>) => import('react').ReactNode) | null | undefined;
26
+ renderEditCell?: ((props: import('react-data-grid').RenderEditCellProps<TRow, TSummaryRow>) => import('react').ReactNode) | null | undefined;
27
+ editable?: boolean | ((row: TRow) => boolean) | null | undefined;
28
+ colSpan?: ((args: import('react-data-grid').ColSpanArgs<TRow, TSummaryRow>) => number | null | undefined) | null | undefined;
29
+ frozen?: boolean | null | undefined;
30
+ resizable?: boolean | null | undefined;
31
+ sortable?: boolean | null | undefined;
32
+ draggable?: boolean | null | undefined;
33
+ sortDescendingFirst?: boolean | null | undefined;
34
+ editorOptions?: {
35
+ readonly displayCellContent?: boolean | null | undefined;
36
+ readonly commitOnOutsideClick?: boolean | null | undefined;
37
+ } | null | undefined;
38
+ visible?: boolean;
39
+ hidden?: boolean;
40
+ fixed?: boolean;
41
+ type: import('../types').ColumnType;
42
+ align?: import('../types').ColumnAlign;
43
+ isDraggable?: boolean;
44
+ withFilter?: boolean;
45
+ withinHeaderRenderer?: import('react').FunctionComponent<import('react-data-grid').RenderHeaderCellProps<TRow, TSummaryRow>> | undefined;
46
+ customFilter?: ((row: TRow, value: string) => boolean) | undefined;
47
+ customSort?: ((a: TRow, b: TRow) => number) | undefined;
48
+ formatter?: ((props: any) => JSX.Element) | undefined;
49
+ editor?: import('@m4l/core').Maybe<(props: import('react-data-grid').RenderEditCellProps<TRow, TSummaryRow>) => import('react').ReactNode>;
50
+ }[];
@@ -0,0 +1,44 @@
1
+ import { useMemo } from "react";
2
+ import { u as useDataGrid } from "./useDataGrid.js";
3
+ import { d as DATAGRID_SELECT_COLUMN_KEY, e as DATAGRID_ACTIONS_COLUMN_KEY } from "../constants.js";
4
+ function useProcessedColumns(columns, options = {}) {
5
+ const { applyVisibilityFilter = true } = options;
6
+ const { getConfigColumns, viewMode } = useDataGrid();
7
+ const columnsConfig = useMemo(
8
+ () => getConfigColumns(viewMode || "cards"),
9
+ [getConfigColumns, viewMode]
10
+ );
11
+ return useMemo(() => {
12
+ const processedColumns = columns.filter((column) => {
13
+ if (column.key === DATAGRID_SELECT_COLUMN_KEY || column.key === DATAGRID_ACTIONS_COLUMN_KEY) {
14
+ return false;
15
+ }
16
+ if (!applyVisibilityFilter) {
17
+ return !column.hidden;
18
+ }
19
+ const columnConfig = columnsConfig.find((c) => c.key === column.key);
20
+ const visible = columnConfig ? columnConfig.visible : true;
21
+ return !column.hidden && visible;
22
+ }).map((column) => {
23
+ const newColumn = { ...column };
24
+ if (newColumn.formatter && !newColumn.renderCell) {
25
+ newColumn.renderCell = newColumn.formatter;
26
+ }
27
+ if (newColumn.editor && !newColumn.renderEditCell) {
28
+ newColumn.renderEditCell = newColumn.editor;
29
+ }
30
+ return newColumn;
31
+ });
32
+ processedColumns.sort((a, b) => {
33
+ const indexA = columnsConfig.findIndex((c) => c.key === a.key);
34
+ const indexB = columnsConfig.findIndex((c) => c.key === b.key);
35
+ const orderA = indexA === -1 ? columnsConfig.length : indexA;
36
+ const orderB = indexB === -1 ? columnsConfig.length : indexB;
37
+ return orderA - orderB;
38
+ });
39
+ return processedColumns;
40
+ }, [columns, columnsConfig, applyVisibilityFilter]);
41
+ }
42
+ export {
43
+ useProcessedColumns as u
44
+ };
@@ -20,4 +20,11 @@ export declare const pathIcons: {
20
20
  freezeColumn: string;
21
21
  unfreezeColumn: string;
22
22
  hideColumn: string;
23
+ viewTable: string;
24
+ viewCards: string;
25
+ info: string;
26
+ expanded: string;
27
+ mail: string;
28
+ smartphone: string;
29
+ internet: string;
23
30
  };
@@ -19,7 +19,11 @@ const pathIcons = {
19
19
  removeSort: "frontend/components/data_grid/assets/icons/eraser.svg",
20
20
  freezeColumn: "frontend/components/data_grid/assets/icons/pin.svg",
21
21
  unfreezeColumn: "frontend/components/data_grid/assets/icons/pin-off.svg",
22
- hideColumn: "frontend/components/data_grid/assets/icons/eye-off.svg"
22
+ hideColumn: "frontend/components/data_grid/assets/icons/eye-off.svg",
23
+ viewTable: "frontend/components/data_grid/assets/icons/table.svg",
24
+ viewCards: "frontend/components/data_grid/assets/icons/card.svg",
25
+ info: "frontend/components/data_grid/assets/icons/info.svg",
26
+ expanded: "frontend/components/data_grid/assets/icons/expanded.svg"
23
27
  };
24
28
  export {
25
29
  pathIcons as p
@@ -5,5 +5,5 @@ 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';
8
- export type { IGridConfig, BaseConfigColumn } from './contexts/DataGridContext/types';
8
+ export type { IGridConfig, IGridConfigExtended, BaseConfigColumn } from './contexts/DataGridContext/types';
9
9
  export { DATAGRID_SEMANTIC_WIDTHS, DATAGRID_ROW_HEADER_HEIGHTS, DATAGRID_ROW_HEIGHTS } from './constants';
@@ -27,7 +27,28 @@ export declare enum TableSlots {
27
27
  buttonHeaderActions = "buttonHeaderActions",
28
28
  nameColumnIcon = "nameColumnIcon",
29
29
  iconColumn = "iconColumn",
30
- nameColumn = "nameColumn"
30
+ nameColumn = "nameColumn",
31
+ containerToggleCards = "containerToggleCards",
32
+ cardToggleCardButton = "cardToggleCardButton",
33
+ textToggleCardButton = "textToggleCardButton",
34
+ card = "card",
35
+ cardsContainer = "cardsContainer",
36
+ cardHeader = "cardHeader",
37
+ cardHeaderLeft = "cardHeaderLeft",
38
+ cardHeaderRight = "cardHeaderRight",
39
+ containerLabelValueColumn = "containerLabelValueColumn",
40
+ contentWrapperColumn = "contentWrapperColumn",
41
+ cardDetailContainer = "cardDetailContainer",
42
+ labelHeaderColumn = "labelHeaderColumn",
43
+ valueColumn = "valueColumn",
44
+ customCardHeader = "customCardHeader",
45
+ customCardAvatar = "customCardAvatar",
46
+ customCardNameEmail = "customCardNameEmail",
47
+ customCardFieldWithIcon = "customCardFieldWithIcon",
48
+ customCardFieldContent = "customCardFieldContent",
49
+ customCardIconContainer = "customCardIconContainer",
50
+ checkboxCellWrapper = "checkboxCellWrapper",
51
+ editorCellWrapper = "editorCellWrapper"
31
52
  }
32
53
  export declare enum TextEditorSlots {
33
54
  inputTexEditor = "inputTexEditor"
@@ -31,6 +31,27 @@ var TableSlots = /* @__PURE__ */ ((TableSlots2) => {
31
31
  TableSlots2["nameColumnIcon"] = "nameColumnIcon";
32
32
  TableSlots2["iconColumn"] = "iconColumn";
33
33
  TableSlots2["nameColumn"] = "nameColumn";
34
+ TableSlots2["containerToggleCards"] = "containerToggleCards";
35
+ TableSlots2["cardToggleCardButton"] = "cardToggleCardButton";
36
+ TableSlots2["textToggleCardButton"] = "textToggleCardButton";
37
+ TableSlots2["card"] = "card";
38
+ TableSlots2["cardsContainer"] = "cardsContainer";
39
+ TableSlots2["cardHeader"] = "cardHeader";
40
+ TableSlots2["cardHeaderLeft"] = "cardHeaderLeft";
41
+ TableSlots2["cardHeaderRight"] = "cardHeaderRight";
42
+ TableSlots2["containerLabelValueColumn"] = "containerLabelValueColumn";
43
+ TableSlots2["contentWrapperColumn"] = "contentWrapperColumn";
44
+ TableSlots2["cardDetailContainer"] = "cardDetailContainer";
45
+ TableSlots2["labelHeaderColumn"] = "labelHeaderColumn";
46
+ TableSlots2["valueColumn"] = "valueColumn";
47
+ TableSlots2["customCardHeader"] = "customCardHeader";
48
+ TableSlots2["customCardAvatar"] = "customCardAvatar";
49
+ TableSlots2["customCardNameEmail"] = "customCardNameEmail";
50
+ TableSlots2["customCardFieldWithIcon"] = "customCardFieldWithIcon";
51
+ TableSlots2["customCardFieldContent"] = "customCardFieldContent";
52
+ TableSlots2["customCardIconContainer"] = "customCardIconContainer";
53
+ TableSlots2["checkboxCellWrapper"] = "checkboxCellWrapper";
54
+ TableSlots2["editorCellWrapper"] = "editorCellWrapper";
34
55
  return TableSlots2;
35
56
  })(TableSlots || {});
36
57
  var TextEditorSlots = /* @__PURE__ */ ((TextEditorSlots2) => {
@@ -37,6 +37,30 @@ export declare const ColumnsConfigActiosStyled: import('@emotion/styled').Styled
37
37
  * ****************
38
38
  */
39
39
  export declare const TableContainerStyled: import('@emotion/styled').StyledComponent<any, Pick<import('react').DetailedHTMLProps<import('react').HTMLAttributes<HTMLDivElement>, HTMLDivElement>, keyof import('react').ClassAttributes<HTMLDivElement> | keyof import('react').HTMLAttributes<HTMLDivElement>>, {}>;
40
+ export declare const ContainerToggleCardsStyled: import('@emotion/styled').StyledComponent<any, Pick<import('react').DetailedHTMLProps<import('react').HTMLAttributes<HTMLDivElement>, HTMLDivElement>, keyof import('react').ClassAttributes<HTMLDivElement> | keyof import('react').HTMLAttributes<HTMLDivElement>>, {}>;
41
+ export declare const CardToggleButtonStyled: import('@emotion/styled').StyledComponent<any, {}, {}>;
42
+ export declare const TextToggleCardButtonStyled: import('@emotion/styled').StyledComponent<any, {}, {}>;
43
+ export declare const CardStyled: import('@emotion/styled').StyledComponent<any, {}, {}>;
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
+ 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
+ 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, {}, {}>;
48
+ 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
+ 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
+ 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>>, {}>;
51
+ export declare const LabelHeaderColumnStyled: import('@emotion/styled').StyledComponent<any, {}, {}>;
52
+ export declare const ValueColumnStyled: import('@emotion/styled').StyledComponent<any, {}, {}>;
53
+ export declare const CheckboxCellWrapperStyled: import('@emotion/styled').StyledComponent<any, Pick<import('react').DetailedHTMLProps<import('react').HTMLAttributes<HTMLDivElement>, HTMLDivElement>, keyof import('react').ClassAttributes<HTMLDivElement> | keyof import('react').HTMLAttributes<HTMLDivElement>>, {}>;
54
+ export declare const EditorCellWrapperStyled: import('@emotion/styled').StyledComponent<any, Pick<import('react').DetailedHTMLProps<import('react').HTMLAttributes<HTMLDivElement>, HTMLDivElement>, keyof import('react').ClassAttributes<HTMLDivElement> | keyof import('react').HTMLAttributes<HTMLDivElement>>, {}>;
55
+ /**
56
+ * Slots para cards personalizadas
57
+ */
58
+ export declare const CustomCardHeaderStyled: import('@emotion/styled').StyledComponent<any, Pick<import('react').DetailedHTMLProps<import('react').HTMLAttributes<HTMLDivElement>, HTMLDivElement>, keyof import('react').ClassAttributes<HTMLDivElement> | keyof import('react').HTMLAttributes<HTMLDivElement>>, {}>;
59
+ export declare const CustomCardAvatarStyled: import('@emotion/styled').StyledComponent<any, Pick<import('react').DetailedHTMLProps<import('react').HTMLAttributes<HTMLDivElement>, HTMLDivElement>, keyof import('react').ClassAttributes<HTMLDivElement> | keyof import('react').HTMLAttributes<HTMLDivElement>>, {}>;
60
+ export declare const CustomCardNameEmailStyled: import('@emotion/styled').StyledComponent<any, Pick<import('react').DetailedHTMLProps<import('react').HTMLAttributes<HTMLDivElement>, HTMLDivElement>, keyof import('react').ClassAttributes<HTMLDivElement> | keyof import('react').HTMLAttributes<HTMLDivElement>>, {}>;
61
+ export declare const CustomCardFieldWithIconStyled: import('@emotion/styled').StyledComponent<any, Pick<import('react').DetailedHTMLProps<import('react').HTMLAttributes<HTMLDivElement>, HTMLDivElement>, keyof import('react').ClassAttributes<HTMLDivElement> | keyof import('react').HTMLAttributes<HTMLDivElement>>, {}>;
62
+ export declare const CustomCardFieldContentStyled: import('@emotion/styled').StyledComponent<any, Pick<import('react').DetailedHTMLProps<import('react').HTMLAttributes<HTMLDivElement>, HTMLDivElement>, keyof import('react').ClassAttributes<HTMLDivElement> | keyof import('react').HTMLAttributes<HTMLDivElement>>, {}>;
63
+ export declare const CustomCardIconContainerStyled: import('@emotion/styled').StyledComponent<any, Pick<import('react').DetailedHTMLProps<import('react').HTMLAttributes<HTMLDivElement>, HTMLDivElement>, keyof import('react').ClassAttributes<HTMLDivElement> | keyof import('react').HTMLAttributes<HTMLDivElement>>, {}>;
40
64
  export declare const TableWrapperDataGridStyled: import('@emotion/styled').StyledComponent<any, Pick<import('react').DetailedHTMLProps<import('react').HTMLAttributes<HTMLDivElement>, HTMLDivElement>, keyof import('react').ClassAttributes<HTMLDivElement> | keyof import('react').HTMLAttributes<HTMLDivElement>>, {}>;
41
65
  export declare const DraggableHeaderRootStyled: import('@emotion/styled').StyledComponent<any, Pick<import('react').DetailedHTMLProps<import('react').HTMLAttributes<HTMLDivElement>, HTMLDivElement>, keyof import('react').ClassAttributes<HTMLDivElement> | keyof import('react').HTMLAttributes<HTMLDivElement>>, {}>;
42
66
  export declare const IconSearchStyled: import('@emotion/styled').StyledComponent<any, {}, {}>;
@@ -1,9 +1,12 @@
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, b as TableSlots, C as ControlNavigateSlots, c as ColumnIconFormatterSlots, R as RowsCountSlots, a as ColumnsConfigSlots } from "./DataGridEnum.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";
5
5
  import { d as dataGridStyles } from "../Datagrid.styles.js";
6
6
  import { I as Icon } from "../../Icon/Icon.js";
7
+ import { C as Card } from "../../Card/Card.js";
8
+ import { C as ContainerFlow } from "../../ContainerFlow/ContainerFlow.js";
9
+ import { T as Typography } from "../../mui_extended/Typography/Typography.js";
7
10
  const DataGridRootStyled = styled("div", {
8
11
  name: DATAGRID_PREFIX_NAME,
9
12
  slot: DataGridSlots.datagridRoot
@@ -60,6 +63,90 @@ const TableContainerStyled = styled("div", {
60
63
  name: DATAGRID_PREFIX_NAME,
61
64
  slot: TableSlots.tableContaniner
62
65
  })(dataGridStyles.tableContaniner);
66
+ const ContainerToggleCardsStyled = styled("div", {
67
+ name: DATAGRID_PREFIX_NAME,
68
+ slot: TableSlots.containerToggleCards
69
+ })(dataGridStyles.containerToggleCards);
70
+ const CardToggleButtonStyled = styled(Card, {
71
+ name: DATAGRID_PREFIX_NAME,
72
+ slot: TableSlots.cardToggleCardButton
73
+ })(dataGridStyles.cardToggleCardButton);
74
+ const TextToggleCardButtonStyled = styled(Typography, {
75
+ name: DATAGRID_PREFIX_NAME,
76
+ slot: TableSlots.textToggleCardButton
77
+ })(dataGridStyles.textToggleCardButton);
78
+ const CardStyled = styled(Card, {
79
+ name: DATAGRID_PREFIX_NAME,
80
+ slot: TableSlots.card
81
+ })(dataGridStyles.card);
82
+ const CardHeaderStyled = styled("div", {
83
+ name: DATAGRID_PREFIX_NAME,
84
+ slot: TableSlots.cardHeader
85
+ })(dataGridStyles.cardHeader);
86
+ const CardHeaderLeftStyled = styled("div", {
87
+ name: DATAGRID_PREFIX_NAME,
88
+ slot: TableSlots.cardHeaderLeft
89
+ })(dataGridStyles.cardHeaderLeft);
90
+ const CardHeaderRightStyled = styled("div", {
91
+ name: DATAGRID_PREFIX_NAME,
92
+ slot: TableSlots.cardHeaderRight
93
+ })(dataGridStyles.cardHeaderRight);
94
+ const CardsContainerStyled = styled(ContainerFlow, {
95
+ name: DATAGRID_PREFIX_NAME,
96
+ slot: TableSlots.cardsContainer
97
+ })(dataGridStyles.cardsContainer);
98
+ const ContainerLabelValueColumnStyled = styled("div", {
99
+ name: DATAGRID_PREFIX_NAME,
100
+ slot: TableSlots.containerLabelValueColumn
101
+ })(dataGridStyles.containerLabelValueColumn);
102
+ const ContentWrapperColumnStyled = styled("div", {
103
+ name: DATAGRID_PREFIX_NAME,
104
+ slot: TableSlots.contentWrapperColumn
105
+ })(dataGridStyles.contentWrapperColumn);
106
+ const CardDetailContainerStyled = styled("div", {
107
+ name: DATAGRID_PREFIX_NAME,
108
+ slot: TableSlots.cardDetailContainer
109
+ })(dataGridStyles.cardDetailContainer);
110
+ const LabelHeaderColumnStyled = styled(Typography, {
111
+ name: DATAGRID_PREFIX_NAME,
112
+ slot: TableSlots.labelHeaderColumn
113
+ })(dataGridStyles.labelHeaderColumn);
114
+ const ValueColumnStyled = styled(Typography, {
115
+ name: DATAGRID_PREFIX_NAME,
116
+ slot: TableSlots.valueColumn
117
+ })(dataGridStyles.valueColumn);
118
+ const CheckboxCellWrapperStyled = styled("div", {
119
+ name: DATAGRID_PREFIX_NAME,
120
+ slot: TableSlots.checkboxCellWrapper
121
+ })(dataGridStyles.checkboxCellWrapper);
122
+ const EditorCellWrapperStyled = styled("div", {
123
+ name: DATAGRID_PREFIX_NAME,
124
+ slot: TableSlots.editorCellWrapper
125
+ })(dataGridStyles.editorCellWrapper);
126
+ styled("div", {
127
+ name: DATAGRID_PREFIX_NAME,
128
+ slot: TableSlots.customCardHeader
129
+ })(dataGridStyles.customCardHeader);
130
+ styled("div", {
131
+ name: DATAGRID_PREFIX_NAME,
132
+ slot: TableSlots.customCardAvatar
133
+ })(dataGridStyles.customCardAvatar);
134
+ styled("div", {
135
+ name: DATAGRID_PREFIX_NAME,
136
+ slot: TableSlots.customCardNameEmail
137
+ })(dataGridStyles.customCardNameEmail);
138
+ styled("div", {
139
+ name: DATAGRID_PREFIX_NAME,
140
+ slot: TableSlots.customCardFieldWithIcon
141
+ })(dataGridStyles.customCardFieldWithIcon);
142
+ styled("div", {
143
+ name: DATAGRID_PREFIX_NAME,
144
+ slot: TableSlots.customCardFieldContent
145
+ })(dataGridStyles.customCardFieldContent);
146
+ styled("div", {
147
+ name: DATAGRID_PREFIX_NAME,
148
+ slot: TableSlots.customCardIconContainer
149
+ })(dataGridStyles.customCardIconContainer);
63
150
  const TableWrapperDataGridStyled = styled("div", {
64
151
  name: DATAGRID_PREFIX_NAME,
65
152
  slot: TableSlots.tableWrapperDataGrid
@@ -126,33 +213,48 @@ const ColumnIconFormatterStyled = styled("div", {
126
213
  })(dataGridStyles.columnIconFormatter);
127
214
  export {
128
215
  ActionsRootStyled as A,
129
- ButtonHeaderActionsStyled as B,
216
+ DraggableHeaderRootStyled as B,
130
217
  CustomHeaderStyled as C,
131
218
  DataGridRootStyled as D,
132
- HeaderInputBaseStyled as H,
219
+ EditorCellWrapperStyled as E,
220
+ ButtonHeaderActionsStyled as F,
221
+ DraggableWrapperInputBaseStyled as G,
222
+ IconSearchStyled as H,
133
223
  IconColumnStyled as I,
224
+ HeaderInputBaseStyled as J,
225
+ HeaderRenderClickStyled as K,
226
+ LabelHeaderColumnStyled as L,
134
227
  MenuListStyled as M,
135
228
  NameColumnIconStyled as N,
229
+ InputTextEditorStyled as O,
136
230
  RowsCountRootStyled as R,
137
231
  TableWrapperDataGridStyled as T,
232
+ ValueColumnStyled as V,
138
233
  WrapperSkeletonStyled as W,
139
234
  ColumnIconFormatterStyled as a,
140
- ControlNavigateStyled as b,
141
- ActionsConfigContainerStyled as c,
142
- ContainerLeftActionsStyled as d,
143
- ContainerRightActionsStyled as e,
144
- RowsCountLabelStyled as f,
145
- RowsCountValueStyled as g,
146
- ColumnsConfigWrapperStyled as h,
147
- ColumnsConfigDataGridStyled as i,
148
- ColumnsConfigSelColumnsStyled as j,
149
- ColumnsConfigActiosStyled as k,
150
- ContentModalSettingStyled as l,
151
- TableContainerStyled as m,
152
- NameColumnStyled as n,
153
- DraggableHeaderRootStyled as o,
154
- DraggableWrapperInputBaseStyled as p,
155
- IconSearchStyled as q,
156
- HeaderRenderClickStyled as r,
157
- InputTextEditorStyled as s
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
158
260
  };
@@ -0,0 +1,9 @@
1
+ import { CardContentProps } from '../../../types';
2
+ /**
3
+ * Hook que encapsula toda la lógica de renderizado del contenido de una Card
4
+ */
5
+ export declare function useCardContent<TRow>({ row, columns, originalColumns, onRowsChange, }: CardContentProps<TRow>): {
6
+ cardContent: import("react/jsx-runtime").JSX.Element[];
7
+ columnsCount: number;
8
+ onOpenDetail: () => void;
9
+ };
@@ -0,0 +1,91 @@
1
+ import { jsx, jsxs } from "react/jsx-runtime";
2
+ import { useState, useMemo } from "react";
3
+ import { u as useModalDetail } from "../../../hooks/useModalCardDetail.js";
4
+ 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";
6
+ function useCardContent({
7
+ row,
8
+ columns,
9
+ originalColumns,
10
+ onRowsChange
11
+ }) {
12
+ const { getConfigColumns, size } = useDataGrid();
13
+ const [editingColumnKey, setEditingColumnKey] = useState(null);
14
+ 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
+ }
72
+ }
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]);
83
+ return {
84
+ cardContent,
85
+ columnsCount: columns.length,
86
+ onOpenDetail
87
+ };
88
+ }
89
+ export {
90
+ useCardContent as u
91
+ };
@@ -0,0 +1,5 @@
1
+ import { GridProps, RowKey } from '../../types';
2
+ /**
3
+ * Componente que muestra las filas del DataGrid en formato de tarjetas.
4
+ */
5
+ export declare function Cards<TRow, TSummaryRow, TKey extends RowKey = RowKey>(props: GridProps<TRow, TSummaryRow, TKey>): import("react/jsx-runtime").JSX.Element | null;
@@ -0,0 +1,40 @@
1
+ import { jsx } from "react/jsx-runtime";
2
+ import { e as CardsContainerStyled } from "../../slots/DataGridSlot.js";
3
+ import { C as CardRow } from "./subcomponents/CardRow/index.js";
4
+ import { u as useProcessedColumns } from "../../hooks/useProcessedColumns.js";
5
+ import { C as ContainerFlow } from "../../../ContainerFlow/ContainerFlow.js";
6
+ function Cards(props) {
7
+ const {
8
+ rows,
9
+ columns,
10
+ rowKeyGetter,
11
+ selectedRows,
12
+ onSelectedRowsChange,
13
+ onRowsChange,
14
+ cardsViewConfig
15
+ } = props;
16
+ const processedColumns = useProcessedColumns(columns);
17
+ const allProcessedColumns = useProcessedColumns(columns, {
18
+ applyVisibilityFilter: false
19
+ });
20
+ if (processedColumns.length === 0) {
21
+ return null;
22
+ }
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
+ )) }) });
37
+ }
38
+ export {
39
+ Cards as C
40
+ };