@m4l/components 9.1.79 → 9.1.81

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 (74) hide show
  1. package/components/DataGrid/dictionary.d.ts +1 -1
  2. package/components/DataGrid/dictionary.js +1 -1
  3. package/components/DataGrid/styles.js +1 -0
  4. package/components/DataGrid/subcomponents/Actions/index.d.ts +4 -0
  5. package/components/DataGrid/subcomponents/Actions/index.js +2 -5
  6. package/components/DataGrid/subcomponents/Actions/types.d.ts +1 -1
  7. package/components/Pager/Pager.d.ts +55 -0
  8. package/components/Pager/Pager.js +60 -0
  9. package/components/Pager/Pager.styles.d.ts +2 -0
  10. package/components/Pager/Pager.styles.js +129 -0
  11. package/components/Pager/constants.d.ts +1 -0
  12. package/components/Pager/constants.js +4 -0
  13. package/components/Pager/dicctionary.d.ts +12 -0
  14. package/components/Pager/dicctionary.js +18 -0
  15. package/components/Pager/slots/PagerEnum.d.ts +10 -0
  16. package/components/Pager/slots/PagerEnum.js +14 -0
  17. package/components/Pager/slots/PagerSlots.d.ts +7 -0
  18. package/components/Pager/slots/PagerSlots.js +42 -0
  19. package/components/Pager/slots/index.d.ts +2 -0
  20. package/components/Pager/slots/index.js +1 -0
  21. package/components/Pager/subcomponents/CustomTablePagination/CustomTablePagination.d.ts +9 -0
  22. package/components/Pager/subcomponents/CustomTablePagination/CustomTablePagination.js +92 -0
  23. package/components/{mui_extended/Pager → Pager}/subcomponents/CustomTablePagination/types.d.ts +4 -5
  24. package/components/{mui_extended/Pager/subcomponents/PagerActions/index.d.ts → Pager/subcomponents/PagerActions/PagerActions.d.ts} +4 -0
  25. package/components/{mui_extended/Pager/subcomponents/PagerActions/index.js → Pager/subcomponents/PagerActions/PagerActions.js} +15 -7
  26. package/components/{mui_extended/Pager → Pager}/subcomponents/PagerActions/types.d.ts +2 -2
  27. package/components/Pager/tests/Pager.test.d.ts +1 -0
  28. package/components/Pager/types.d.ts +25 -0
  29. package/components/extended/React-Splitter/SplitLayout/SplitLayout.d.ts +14 -0
  30. package/components/extended/React-Splitter/SplitLayout/SplitLayout.js +53 -0
  31. package/components/extended/React-Splitter/SplitLayout/SplitLayout.styles.d.ts +2 -0
  32. package/components/extended/React-Splitter/SplitLayout/SplitLayout.styles.js +157 -0
  33. package/components/extended/React-Splitter/SplitLayout/constants.d.ts +9 -0
  34. package/components/extended/React-Splitter/SplitLayout/constants.js +6 -0
  35. package/components/extended/React-Splitter/SplitLayout/slots/SplitLayoutEnum.d.ts +5 -0
  36. package/components/extended/React-Splitter/SplitLayout/slots/SplitLayoutEnum.js +9 -0
  37. package/components/extended/React-Splitter/SplitLayout/slots/SplitLayoutSlots.d.ts +3 -0
  38. package/components/extended/React-Splitter/SplitLayout/slots/SplitLayoutSlots.js +21 -0
  39. package/components/extended/React-Splitter/SplitLayout/tests/SplitLayout.test.d.ts +1 -0
  40. package/components/{SplitLayout → extended/React-Splitter/SplitLayout}/types.d.ts +11 -5
  41. package/components/hook-form/RHFSelect/slots/RHFSlots.js +1 -1
  42. package/components/index.d.ts +2 -2
  43. package/components/mui_extended/Select/Select.styles.js +17 -10
  44. package/components/mui_extended/index.d.ts +3 -3
  45. package/index.js +3 -3
  46. package/package.json +1 -1
  47. package/components/SplitLayout/SplitLayout.d.ts +0 -16
  48. package/components/SplitLayout/SplitLayout.js +0 -57
  49. package/components/SplitLayout/classes/constants.d.ts +0 -1
  50. package/components/SplitLayout/classes/constants.js +0 -4
  51. package/components/SplitLayout/classes/index.d.ts +0 -17
  52. package/components/SplitLayout/classes/index.js +0 -33
  53. package/components/SplitLayout/classes/types.d.ts +0 -10
  54. package/components/SplitLayout/index.d.ts +0 -2
  55. package/components/SplitLayout/styles.d.ts +0 -3
  56. package/components/SplitLayout/styles.js +0 -29
  57. package/components/SplitLayout/tests/constants.d.ts +0 -1
  58. package/components/SplitLayout/tests/constants.js +0 -4
  59. package/components/SplitLayout/tests/utils.d.ts +0 -2
  60. package/components/SplitLayout/tests/utils.js +0 -7
  61. package/components/mui_extended/Pager/classes/constants.d.ts +0 -1
  62. package/components/mui_extended/Pager/classes/constants.js +0 -4
  63. package/components/mui_extended/Pager/classes/index.d.ts +0 -25
  64. package/components/mui_extended/Pager/classes/index.js +0 -55
  65. package/components/mui_extended/Pager/classes/types.d.ts +0 -18
  66. package/components/mui_extended/Pager/dicctionary.d.ts +0 -3
  67. package/components/mui_extended/Pager/dicctionary.js +0 -6
  68. package/components/mui_extended/Pager/index.d.ts +0 -6
  69. package/components/mui_extended/Pager/index.js +0 -49
  70. package/components/mui_extended/Pager/styles.d.ts +0 -1
  71. package/components/mui_extended/Pager/styles.js +0 -7
  72. package/components/mui_extended/Pager/subcomponents/CustomTablePagination/index.d.ts +0 -5
  73. package/components/mui_extended/Pager/subcomponents/CustomTablePagination/index.js +0 -96
  74. package/components/mui_extended/Pager/types.d.ts +0 -13
@@ -2,7 +2,7 @@
2
2
  * TODO: Documentar
3
3
  * @author cesar - automatic
4
4
  * @createdAt 2024-11-24 17:06:31 - automatic
5
- * @updatedAt 2024-11-24 17:07:48 - automatic
5
+ * @updatedAt 2025-01-21 14:06:55 - automatic
6
6
  * @updatedUser cesar - automatic
7
7
  */
8
8
  export declare function getDataGridComponentsDictionary(): string[];
@@ -1,5 +1,5 @@
1
1
  import { g as getModalDialogComponentsDictionary } from "../mui_extended/Dialog/dictionary.js";
2
- import { g as getPagerComponentsDictionary } from "../mui_extended/Pager/dicctionary.js";
2
+ import { g as getPagerComponentsDictionary } from "../Pager/dicctionary.js";
3
3
  function getDataGridComponentsDictionary() {
4
4
  return ["data_grid"].concat(getPagerComponentsDictionary()).concat(getModalDialogComponentsDictionary());
5
5
  }
@@ -6,6 +6,7 @@ const DataGridRoot = styled("div")(({ theme }) => ({
6
6
  padding: "0px",
7
7
  inset: "0px",
8
8
  overflow: "hidden",
9
+ container: "container / inline-size",
9
10
  ...theme.components?.M4LDataGrid?.styleOverrides || {}
10
11
  }));
11
12
  export {
@@ -1,5 +1,9 @@
1
1
  import { InternalActionsProps } from './types';
2
2
  /**
3
3
  * TODO: Documentar
4
+ * @author cesar - automatic
5
+ * @createdAt 2025-01-15 17:01:04 - automatic
6
+ * @updatedAt 2025-01-21 15:33:55 - automatic
7
+ * @updatedUser cesar - automatic
4
8
  */
5
9
  export declare function Actions(props: InternalActionsProps): import("react/jsx-runtime").JSX.Element;
@@ -1,19 +1,18 @@
1
1
  import { jsxs, jsx } from "react/jsx-runtime";
2
- import { P as Pager } from "../../../mui_extended/Pager/index.js";
2
+ import { P as Pager } from "../../../Pager/Pager.js";
3
3
  import { F as Filter } from "./subcomponents/Filter/index.js";
4
4
  import { S as Settings } from "./subcomponents/Settings/index.js";
5
5
  import { R as RowsCount } from "./subcomponents/RowsCount/index.js";
6
6
  import { D as Density } from "./subcomponents/Density/index.js";
7
7
  import { u as useDataGrid } from "../../hooks/useDataGrid.js";
8
8
  import { useResponsiveContainerStore } from "@m4l/graphics";
9
- import { useModuleSkeleton, useModuleDictionary } from "@m4l/core";
9
+ import { useModuleDictionary } from "@m4l/core";
10
10
  import { d as dictionary } from "../../dictionary.js";
11
11
  import { shallow } from "zustand/shallow";
12
12
  import { M as MobileMenuActions } from "./subcomponents/MobileMenuActions/index.js";
13
13
  function Actions(props) {
14
14
  const isXs = useResponsiveContainerStore((state) => state.isXs, shallow);
15
15
  const { rowHeights, classes } = useDataGrid();
16
- const isSkeleton = useModuleSkeleton();
17
16
  const { getLabel } = useModuleDictionary();
18
17
  const {
19
18
  withRowsCount = true,
@@ -30,8 +29,6 @@ function Actions(props) {
30
29
  {
31
30
  ...pagerOptions,
32
31
  totalRecords: pagerOptions.totalRecords,
33
- isSkeleton,
34
- isXs,
35
32
  labelRows: getLabel(dictionary.LABEL_ROWS_PER_PAGE),
36
33
  labelOf: getLabel(dictionary.LABEL_OF)
37
34
  }
@@ -1,4 +1,4 @@
1
- import { PagerProps } from '../../../mui_extended/Pager/types';
1
+ import { PagerProps } from '../../../Pager/types';
2
2
  import { SettingsProps } from './subcomponents/Settings/types';
3
3
  export interface ActionsProps {
4
4
  withSettings?: boolean;
@@ -0,0 +1,55 @@
1
+ import { PagerProps } from './types';
2
+ /**
3
+ * El componente `Pager` es un componente de paginación que permite navegar entre diferentes páginas
4
+ * y controlar la cantidad de filas mostradas por página en una tabla o lista de registros.
5
+ * ### Funcionalidades principales:
6
+ * - Permite cambiar la página actual mediante el evento `onPageChange`.
7
+ * - Ofrece un menú desplegable para seleccionar la cantidad de filas mostradas por página.
8
+ * - Muestra el total de registros y la página actual de forma descriptiva.
9
+ *
10
+ * ### Propiedades:
11
+ * - **`totalRecords`**: Número total de registros disponibles para paginar.
12
+ * - **`rowsPerPageOptions`**: Opciones disponibles para la cantidad de filas por página (e.g., [5, 10, 25]).
13
+ * - **`rowsPerPage`**: Cantidad actual de filas por página.
14
+ * - **`page`**: Página actualmente seleccionada (índice basado en cero).
15
+ * - **`onPageChange`**: Función que se invoca cuando el usuario cambia de página.
16
+ * - **`onRowsPerPageChange`**: Función que se invoca cuando el usuario selecciona una nueva cantidad de filas por página.
17
+ * - **`labelRows`**: Etiqueta para el selector de filas por página.
18
+ * - **`labelOf`**: Etiqueta utilizada entre la página actual y el total de páginas.
19
+ * - **`size`**: Tamaño del componente (`small` o `medium`).
20
+ *
21
+ * ### Dependencias:
22
+ * - **`useComponentSize:`** Hook para determinar el tamaño del componente basado en el entorno o configuración.
23
+ * @param {PagerProps} props - Propiedades del componente.
24
+ * @param {number} props.totalRecords - Número total de registros disponibles.
25
+ * @param {number[]} props.rowsPerPageOptions - Opciones de filas por página disponibles.
26
+ * @param {number} props.rowsPerPage - Cantidad actual de filas por página.
27
+ * @param {number} props.page - Página actualmente seleccionada.
28
+ * @param {Function} props.onPageChange - Función que se invoca cuando el usuario cambia de página.
29
+ * @param {Function} props.onRowsPerPageChange - Función que se invoca cuando el usuario cambia la cantidad de filas por página.
30
+ * @param {string} props.labelRows - Etiqueta para el selector de filas por página.
31
+ * @param {string} props.labelOf - Etiqueta para mostrar entre la página actual y el total de páginas.
32
+ * @param {'small' | 'medium'} props.size - Tamaño del componente.
33
+ * @returns {JSX.Element} Elemento JSX que representa el componente de paginación.
34
+ *
35
+ * ### Ejemplo de uso:
36
+ * ```tsx
37
+ * <Pager
38
+ * totalRecords={100}
39
+ * rowsPerPageOptions={[5, 10, 20]}
40
+ * rowsPerPage={10}
41
+ * page={0}
42
+ * onPageChange={(newPage) => console.log('Nueva página:', newPage)}
43
+ * onRowsPerPageChange={(newRows) => console.log('Filas por página:', newRows)}
44
+ * labelRows="Filas por página"
45
+ * labelOf="de"
46
+ * size="medium"
47
+ * />
48
+ * ```
49
+ * @author cesar - automatic
50
+ * @createdAt 2025-01-15 17:01:04 - automatic
51
+ * @updatedAt 2025-01-21 15:32:35 - automatic
52
+ * @updatedUser cesar - automatic
53
+ */
54
+ export declare function Pager(props: PagerProps): import("react/jsx-runtime").JSX.Element;
55
+ export default Pager;
@@ -0,0 +1,60 @@
1
+ import { jsx } from "react/jsx-runtime";
2
+ import { useMemo } from "react";
3
+ import { C as CustomTablePagination } from "./subcomponents/CustomTablePagination/CustomTablePagination.js";
4
+ import { u as useComponentSize } from "../../hooks/useComponentSize/useComponentSize.js";
5
+ import { useModuleDictionary } from "@m4l/core";
6
+ import { P as PAGER_DICTIONARY } from "./dicctionary.js";
7
+ import { P as PagerRootStyled } from "./slots/PagerSlots.js";
8
+ function Pager(props) {
9
+ const {
10
+ totalRecords = 0,
11
+ rowsPerPageOptions = [5, 10, 25],
12
+ rowsPerPage = 25,
13
+ page = 0,
14
+ onPageChange,
15
+ onRowsPerPageChange,
16
+ labelRows = "Filas por página",
17
+ labelOf = "de",
18
+ size = "medium"
19
+ } = props;
20
+ const totalPages = useMemo(() => Math.max(1, Math.ceil(totalRecords / rowsPerPage)), [totalRecords, rowsPerPage]);
21
+ const { currentSize } = useComponentSize(size);
22
+ const { getLabel } = useModuleDictionary();
23
+ const normalizedSize = currentSize === "large" ? "medium" : currentSize;
24
+ const currentPage = useMemo(() => {
25
+ return Math.max(0, Math.min(page, totalPages - 1));
26
+ }, [page, totalPages]);
27
+ const formattedLabelDisplayedRows = useMemo(() => {
28
+ return totalRecords === 0 ? `${getLabel(PAGER_DICTIONARY.no_records)}` : `${getLabel(PAGER_DICTIONARY.page)} ${currentPage + 1} ${labelOf} ${totalPages}`;
29
+ }, [currentPage, totalPages, labelOf, totalRecords, getLabel]);
30
+ const handleChangeRowsPerPage = (option) => {
31
+ if (onRowsPerPageChange && option.value !== void 0) {
32
+ onRowsPerPageChange(option.value);
33
+ }
34
+ if (onPageChange) {
35
+ onPageChange(0);
36
+ }
37
+ };
38
+ const handleChangePage = (_event, newPage) => {
39
+ if (onPageChange) {
40
+ onPageChange(newPage);
41
+ }
42
+ };
43
+ return /* @__PURE__ */ jsx(PagerRootStyled, { size: normalizedSize, role: "Pager-root", children: /* @__PURE__ */ jsx(
44
+ CustomTablePagination,
45
+ {
46
+ size,
47
+ rowsPerPageOptions,
48
+ count: totalRecords,
49
+ rowsPerPage,
50
+ labelRowsPerPage: labelRows,
51
+ page: currentPage,
52
+ onPageChange: handleChangePage,
53
+ onRowsPerPageChange: handleChangeRowsPerPage,
54
+ labelDisplayedRows: () => formattedLabelDisplayedRows
55
+ }
56
+ ) });
57
+ }
58
+ export {
59
+ Pager as P
60
+ };
@@ -0,0 +1,2 @@
1
+ import { PagerStyles } from './types';
2
+ export declare const pagerStyles: PagerStyles;
@@ -0,0 +1,129 @@
1
+ const CONTAINER_QUERY_NAME = "container";
2
+ const pagerStyles = {
3
+ /**
4
+ * Root Pager Styles
5
+ * @author cesar - automatic
6
+ * @createdAt 2025-01-15 16:56:00 - automatic
7
+ * @updatedAt 2025-01-22 15:38:32 - automatic
8
+ * @updatedUser cesar - automatic
9
+ */
10
+ root: ({ theme }) => ({
11
+ display: "flex",
12
+ flexDirection: "row",
13
+ justifyContent: "space-between",
14
+ alignItems: "baseline",
15
+ whiteSpace: "nowrap",
16
+ overflow: "hidden",
17
+ flexShrink: 0,
18
+ gap: theme.vars.size.baseSpacings.sp2,
19
+ [`@container ${CONTAINER_QUERY_NAME} (max-width: 400px)`]: {
20
+ overflowX: "auto",
21
+ whiteSpace: "nowrap",
22
+ flexWrap: "nowrap",
23
+ WebkitOverflowScrolling: "touch"
24
+ },
25
+ "& .M4LSelect-skeletonSelect": {
26
+ width: theme.vars.size.baseSpacings.sp14
27
+ },
28
+ "& .M4LTypography-skeleton": {
29
+ height: theme.vars.size.baseSpacings.sp8
30
+ }
31
+ }),
32
+ /**
33
+ * Rows Per Page Container Styles
34
+ * @author cesar - automatic
35
+ * @createdAt 2025-01-16 15:54:48 - automatic
36
+ * @updatedAt 2025-01-22 15:38:32 - automatic
37
+ * @updatedUser cesar - automatic
38
+ */
39
+ rowsPerPageContainer: () => ({
40
+ display: "flex",
41
+ flexDirection: "row",
42
+ alignItems: "center"
43
+ }),
44
+ /**
45
+ * Label Select Container Styles
46
+ * @author cesar - automatic
47
+ * @createdAt 2025-01-16 16:41:03 - automatic
48
+ * @updatedAt 2025-01-22 15:38:32 - automatic
49
+ * @updatedUser cesar - automatic
50
+ */
51
+ labelSelectContainer: ({ theme }) => ({
52
+ display: "flex",
53
+ flexDirection: "row",
54
+ alignItems: "center",
55
+ gap: theme.vars.size.baseSpacings.sp2
56
+ }),
57
+ /**
58
+ * Actions Container Styles
59
+ * @author cesar - automatic
60
+ * @createdAt 2025-01-16 16:22:21 - automatic
61
+ * @updatedAt 2025-01-22 15:38:32 - automatic
62
+ * @updatedUser cesar - automatic
63
+ */
64
+ actionsContainer: ({ theme }) => ({
65
+ display: "flex",
66
+ flexDirection: "row",
67
+ alignItems: "center",
68
+ gap: theme.vars.size.baseSpacings.sp2
69
+ }),
70
+ /**
71
+ * Pager Icons Container Styles
72
+ * @author cesar - automatic
73
+ * @createdAt 2025-01-16 16:41:03 - automatic
74
+ * @updatedAt 2025-01-22 15:38:32 - automatic
75
+ * @updatedUser cesar - automatic
76
+ */
77
+ pagerIcons: ({ theme }) => ({
78
+ display: "flex",
79
+ flexDirection: "row",
80
+ alignItems: "center",
81
+ gap: theme.vars.size.baseSpacings["sp0-5"]
82
+ }),
83
+ /**
84
+ * Total Filas elipsis Styles
85
+ * @author cesar - automatic
86
+ * @createdAt 2025-01-20 08:53:24 - automatic
87
+ * @updatedAt 2025-01-22 15:38:32 - automatic
88
+ * @updatedUser cesar - automatic
89
+ */
90
+ totalRow: () => ({
91
+ textOverflow: "ellipsis",
92
+ whiteSpace: "nowrap",
93
+ overflow: "hidden",
94
+ [`@container ${CONTAINER_QUERY_NAME} (max-width: 400px)`]: {
95
+ display: "none"
96
+ }
97
+ }),
98
+ /**
99
+ * Rows Per Page Styles
100
+ * @author cesar - automatic
101
+ * @createdAt 2025-01-22 12:52:40 - automatic
102
+ * @updatedAt 2025-01-22 15:38:32 - automatic
103
+ * @updatedUser cesar - automatic
104
+ */
105
+ rowsPerPage: () => ({
106
+ [`@container ${CONTAINER_QUERY_NAME} (max-width: 400px)`]: {
107
+ display: "none"
108
+ }
109
+ }),
110
+ /**
111
+ * Page Counter Styles
112
+ * @author cesar - automatic
113
+ * @createdAt 2025-01-22 12:52:40 - automatic
114
+ * @updatedAt 2025-01-22 15:38:32 - automatic
115
+ * @updatedUser cesar - automatic
116
+ */
117
+ pageCounter: () => ({
118
+ [`& @container ${CONTAINER_QUERY_NAME} (max-width: 200px)`]: {
119
+ overflow: "hidden",
120
+ whiteSpace: "nowrap",
121
+ textOverflow: "ellipsis",
122
+ maxWidth: "100%",
123
+ display: "inline-block"
124
+ }
125
+ })
126
+ };
127
+ export {
128
+ pagerStyles as p
129
+ };
@@ -0,0 +1 @@
1
+ export declare const PAGER_KEY_COMPONENT = "M4LPager";
@@ -0,0 +1,4 @@
1
+ const PAGER_KEY_COMPONENT = "M4LPager";
2
+ export {
3
+ PAGER_KEY_COMPONENT as P
4
+ };
@@ -0,0 +1,12 @@
1
+ export declare const PAGER_DICTIONARY: {
2
+ readonly rows_per_page: "pager.rows_per_page";
3
+ readonly first: "pager.first";
4
+ readonly previous: "pager.previous";
5
+ readonly before: "pager.before";
6
+ readonly last: "pager.last";
7
+ readonly of: "pager.of";
8
+ readonly page: "pager.page";
9
+ readonly no_records: "pager.no_records";
10
+ readonly total_rows: "pager.total_rows";
11
+ };
12
+ export declare function getPagerComponentsDictionary(): string[];
@@ -0,0 +1,18 @@
1
+ const PAGER_DICTIONARY = {
2
+ rows_per_page: "pager.rows_per_page",
3
+ first: "pager.first",
4
+ previous: "pager.previous",
5
+ before: "pager.before",
6
+ last: "pager.last",
7
+ of: "pager.of",
8
+ page: "pager.page",
9
+ no_records: "pager.no_records",
10
+ total_rows: "pager.total_rows"
11
+ };
12
+ function getPagerComponentsDictionary() {
13
+ return ["pager"];
14
+ }
15
+ export {
16
+ PAGER_DICTIONARY as P,
17
+ getPagerComponentsDictionary as g
18
+ };
@@ -0,0 +1,10 @@
1
+ export declare enum PagerSlots {
2
+ root = "root",
3
+ rowsPerPageContainer = "rowsPerPageContainer",
4
+ actionsContainer = "actionsContainer",
5
+ labelSelectContainer = "labelSelectContainer",
6
+ pagerIcons = "pagerIcons",
7
+ totalRow = "totalRow",
8
+ rowsPerPage = "rowsPerPage",
9
+ pageCounter = "pageCounter"
10
+ }
@@ -0,0 +1,14 @@
1
+ var PagerSlots = /* @__PURE__ */ ((PagerSlots2) => {
2
+ PagerSlots2["root"] = "root";
3
+ PagerSlots2["rowsPerPageContainer"] = "rowsPerPageContainer";
4
+ PagerSlots2["actionsContainer"] = "actionsContainer";
5
+ PagerSlots2["labelSelectContainer"] = "labelSelectContainer";
6
+ PagerSlots2["pagerIcons"] = "pagerIcons";
7
+ PagerSlots2["totalRow"] = "totalRow";
8
+ PagerSlots2["rowsPerPage"] = "rowsPerPage";
9
+ PagerSlots2["pageCounter"] = "pageCounter";
10
+ return PagerSlots2;
11
+ })(PagerSlots || {});
12
+ export {
13
+ PagerSlots as P
14
+ };
@@ -0,0 +1,7 @@
1
+ export declare const PagerRootStyled: import('@emotion/styled').StyledComponent<import('@mui/system').MUIStyledCommonProps<import('@mui/material/styles').Theme> & Record<string, unknown>, Pick<import('react').DetailedHTMLProps<import('react').HTMLAttributes<HTMLDivElement>, HTMLDivElement>, keyof import('react').HTMLAttributes<HTMLDivElement> | keyof import('react').ClassAttributes<HTMLDivElement>>, {}>;
2
+ export declare const ActionsContainerStyled: import('@emotion/styled').StyledComponent<import('@mui/system').MUIStyledCommonProps<import('@mui/material/styles').Theme> & Record<string, unknown>, Pick<import('react').DetailedHTMLProps<import('react').HTMLAttributes<HTMLDivElement>, HTMLDivElement>, keyof import('react').HTMLAttributes<HTMLDivElement> | keyof import('react').ClassAttributes<HTMLDivElement>>, {}>;
3
+ export declare const LabelSelectContainerStyled: import('@emotion/styled').StyledComponent<import('@mui/system').MUIStyledCommonProps<import('@mui/material/styles').Theme> & Record<string, unknown>, Pick<import('react').DetailedHTMLProps<import('react').HTMLAttributes<HTMLDivElement>, HTMLDivElement>, keyof import('react').HTMLAttributes<HTMLDivElement> | keyof import('react').ClassAttributes<HTMLDivElement>>, {}>;
4
+ export declare const PagerIconsStyled: import('@emotion/styled').StyledComponent<import('@mui/system').MUIStyledCommonProps<import('@mui/material/styles').Theme> & Record<string, unknown>, Pick<import('react').DetailedHTMLProps<import('react').HTMLAttributes<HTMLDivElement>, HTMLDivElement>, keyof import('react').HTMLAttributes<HTMLDivElement> | keyof import('react').ClassAttributes<HTMLDivElement>>, {}>;
5
+ export declare const TotalRowStyled: import('@emotion/styled').StyledComponent<Pick<import('../../mui_extended/Typography/types').TypographyProps, keyof import('../../mui_extended/Typography/types').TypographyProps> & import('@mui/system').MUIStyledCommonProps<import('@mui/material/styles').Theme> & Record<string, unknown>, {}, {}>;
6
+ export declare const RowsPerPageStyled: import('@emotion/styled').StyledComponent<Pick<import('../../mui_extended/Typography/types').TypographyProps, keyof import('../../mui_extended/Typography/types').TypographyProps> & import('@mui/system').MUIStyledCommonProps<import('@mui/material/styles').Theme> & Record<string, unknown>, {}, {}>;
7
+ export declare const PageCounterStyled: import('@emotion/styled').StyledComponent<Pick<import('../../mui_extended/Typography/types').TypographyProps, keyof import('../../mui_extended/Typography/types').TypographyProps> & import('@mui/system').MUIStyledCommonProps<import('@mui/material/styles').Theme> & Record<string, unknown>, {}, {}>;
@@ -0,0 +1,42 @@
1
+ import { styled } from "@mui/material/styles";
2
+ import { P as PAGER_KEY_COMPONENT } from "../constants.js";
3
+ import { p as pagerStyles } from "../Pager.styles.js";
4
+ import { P as PagerSlots } from "./PagerEnum.js";
5
+ import { T as Typography } from "../../mui_extended/Typography/Typography.js";
6
+ const PagerRootStyled = styled("div", {
7
+ name: PAGER_KEY_COMPONENT,
8
+ slot: PagerSlots.root
9
+ })(pagerStyles?.root);
10
+ const ActionsContainerStyled = styled("div", {
11
+ name: PAGER_KEY_COMPONENT,
12
+ slot: PagerSlots.actionsContainer
13
+ })(pagerStyles?.actionsContainer);
14
+ const LabelSelectContainerStyled = styled("div", {
15
+ name: PAGER_KEY_COMPONENT,
16
+ slot: PagerSlots.labelSelectContainer
17
+ })(pagerStyles?.labelSelectContainer);
18
+ const PagerIconsStyled = styled("div", {
19
+ name: PAGER_KEY_COMPONENT,
20
+ slot: PagerSlots.pagerIcons
21
+ })(pagerStyles?.pagerIcons);
22
+ const TotalRowStyled = styled(Typography, {
23
+ name: PAGER_KEY_COMPONENT,
24
+ slot: PagerSlots.totalRow
25
+ })(pagerStyles?.totalRow);
26
+ const RowsPerPageStyled = styled(Typography, {
27
+ name: PAGER_KEY_COMPONENT,
28
+ slot: PagerSlots.rowsPerPage
29
+ })(pagerStyles?.rowsPerPage);
30
+ const PageCounterStyled = styled(Typography, {
31
+ name: PAGER_KEY_COMPONENT,
32
+ slot: PagerSlots.pageCounter
33
+ })(pagerStyles?.pageCounter);
34
+ export {
35
+ ActionsContainerStyled as A,
36
+ LabelSelectContainerStyled as L,
37
+ PagerRootStyled as P,
38
+ RowsPerPageStyled as R,
39
+ TotalRowStyled as T,
40
+ PageCounterStyled as a,
41
+ PagerIconsStyled as b
42
+ };
@@ -0,0 +1,2 @@
1
+ export * from './PagerEnum';
2
+ export * from './PagerSlots';
@@ -0,0 +1 @@
1
+
@@ -0,0 +1,9 @@
1
+ import { CustomTablePaginationProps } from './types';
2
+ /**
3
+ * CustomTablePagination component
4
+ * @author cesar - automatic
5
+ * @createdAt 2025-01-15 17:13:29 - automatic
6
+ * @updatedAt 2025-01-22 12:52:40 - automatic
7
+ * @updatedUser cesar - automatic
8
+ */
9
+ export declare const CustomTablePagination: (props: CustomTablePaginationProps) => import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,92 @@
1
+ import { jsxs, Fragment, jsx } from "react/jsx-runtime";
2
+ import { P as PagerActions } from "../PagerActions/PagerActions.js";
3
+ import { useState, useMemo, useEffect } from "react";
4
+ import { useModuleDictionary } from "@m4l/core";
5
+ import { P as PAGER_DICTIONARY } from "../../dicctionary.js";
6
+ import { T as TotalRowStyled, L as LabelSelectContainerStyled, R as RowsPerPageStyled, A as ActionsContainerStyled, a as PageCounterStyled } from "../../slots/PagerSlots.js";
7
+ import { S as Select } from "../../../mui_extended/Select/Select.js";
8
+ const CustomTablePagination = (props) => {
9
+ const {
10
+ count: countTotal,
11
+ page,
12
+ rowsPerPage = 25,
13
+ rowsPerPageOptions = [10, 25, 50, 100],
14
+ onRowsPerPageChange,
15
+ onPageChange,
16
+ size
17
+ } = props;
18
+ const [localRowsPerPage, setLocalRowsPerPage] = useState(rowsPerPage);
19
+ const [localPage, setLocalPage] = useState(Math.max(0, page));
20
+ const { getLabel } = useModuleDictionary();
21
+ const totalPages = useMemo(() => {
22
+ return Math.max(1, Math.ceil(countTotal / localRowsPerPage));
23
+ }, [countTotal, localRowsPerPage]);
24
+ useEffect(() => {
25
+ setLocalPage(Math.max(0, Math.min(page, totalPages - 1)));
26
+ }, [page, totalPages]);
27
+ useEffect(() => {
28
+ if (rowsPerPageOptions.includes(rowsPerPage)) {
29
+ setLocalRowsPerPage(rowsPerPage);
30
+ }
31
+ }, [rowsPerPage, rowsPerPageOptions]);
32
+ const currentPage = useMemo(() => {
33
+ return Math.max(0, Math.min(localPage, totalPages - 1));
34
+ }, [localPage, totalPages]);
35
+ const formattedLabelDisplayedRows = useMemo(() => {
36
+ if (countTotal === 0) {
37
+ return `${getLabel(PAGER_DICTIONARY.no_records)}`;
38
+ }
39
+ const displayedPage = currentPage === 1 ? 1 : currentPage + 1;
40
+ return `${getLabel(PAGER_DICTIONARY.page)} ${displayedPage} ${getLabel(PAGER_DICTIONARY.of)} ${totalPages}`;
41
+ }, [currentPage, totalPages, countTotal, getLabel]);
42
+ const handleChangeRowsPerPage = (option) => {
43
+ const selectedValue = Number(option.id);
44
+ const newTotalPages = Math.ceil(countTotal / selectedValue);
45
+ const newPage = Math.min(currentPage, newTotalPages - 1);
46
+ setLocalRowsPerPage(selectedValue);
47
+ setLocalPage(newPage);
48
+ if (onRowsPerPageChange) {
49
+ onRowsPerPageChange({ id: selectedValue, value: selectedValue, label: `${selectedValue} filas` });
50
+ }
51
+ if (onPageChange) {
52
+ onPageChange(null, newPage);
53
+ }
54
+ };
55
+ return /* @__PURE__ */ jsxs(Fragment, { children: [
56
+ rowsPerPageOptions?.length > 1 ? /* @__PURE__ */ jsxs(Fragment, { children: [
57
+ /* @__PURE__ */ jsx(TotalRowStyled, { skeletonWidth: 50, size, variant: "body", children: `${getLabel(PAGER_DICTIONARY.total_rows)}: ${countTotal}` }),
58
+ /* @__PURE__ */ jsxs(LabelSelectContainerStyled, { children: [
59
+ /* @__PURE__ */ jsx(RowsPerPageStyled, { skeletonWidth: 50, size, variant: "body", children: `${getLabel(PAGER_DICTIONARY.rows_per_page)}:` }),
60
+ /* @__PURE__ */ jsx(
61
+ Select,
62
+ {
63
+ size,
64
+ value: rowsPerPageOptions.includes(localRowsPerPage) ? localRowsPerPage.toString() : rowsPerPageOptions[0].toString(),
65
+ onChange: (option) => handleChangeRowsPerPage(option),
66
+ options: rowsPerPageOptions.map((item) => ({
67
+ id: item.toString(),
68
+ value: item.toString(),
69
+ label: item.toString()
70
+ }))
71
+ }
72
+ )
73
+ ] })
74
+ ] }) : null,
75
+ /* @__PURE__ */ jsxs(ActionsContainerStyled, { children: [
76
+ /* @__PURE__ */ jsx(PageCounterStyled, { skeletonWidth: 50, size, variant: "body", children: formattedLabelDisplayedRows }),
77
+ /* @__PURE__ */ jsx(
78
+ PagerActions,
79
+ {
80
+ size,
81
+ count: countTotal,
82
+ page: currentPage,
83
+ rowsPerPage: localRowsPerPage,
84
+ onPageChange: (_, newPage) => setLocalPage(newPage)
85
+ }
86
+ )
87
+ ] })
88
+ ] });
89
+ };
90
+ export {
91
+ CustomTablePagination as C
92
+ };
@@ -1,10 +1,9 @@
1
- import { LabelDisplayedRowsArgs, SelectChangeEvent, TablePaginationProps } from '@mui/material';
2
- import { Classes } from '../../classes/types';
1
+ import { LabelDisplayedRowsArgs, TablePaginationProps } from '@mui/material';
2
+ import { selectOption } from '../../types';
3
3
  export type CustomTablePaginationProps = {
4
4
  rowsPerPageOptions: number[];
5
5
  onPageChange: (_event: unknown, newPage: number) => void;
6
6
  labelRowsPerPage: string;
7
- classes: Classes;
8
- onRowsPerPageChange: (event: SelectChangeEvent<unknown>) => void;
7
+ onRowsPerPageChange: (option: selectOption<number>) => void;
9
8
  labelDisplayedRows?: (paginationInfo: LabelDisplayedRowsArgs) => string;
10
- } & Omit<TablePaginationProps, 'onPageChange' | 'onRowsPerPageChange' | 'classes' | 'ActionsComponent' | 'labelDisplayedRows'>;
9
+ } & Omit<TablePaginationProps, 'onPageChange' | 'onRowsPerPageChange' | 'ActionsComponent' | 'labelDisplayedRows'>;
@@ -1,5 +1,9 @@
1
1
  import { PagerActionsProps } from './types';
2
2
  /**
3
3
  * TODO: Documentar
4
+ * @author cesar - automatic
5
+ * @createdAt 2025-01-15 17:13:29 - automatic
6
+ * @updatedAt 2025-01-21 14:06:55 - automatic
7
+ * @updatedUser cesar - automatic
4
8
  */
5
9
  export declare function PagerActions(props: PagerActionsProps): import("react/jsx-runtime").JSX.Element;
@@ -1,8 +1,16 @@
1
1
  import { jsxs, jsx } from "react/jsx-runtime";
2
- import { I as IconButton } from "../../../IconButton/IconButton.js";
2
+ import { I as IconButton } from "../../../mui_extended/IconButton/IconButton.js";
3
3
  import { useEnvironment } from "@m4l/core";
4
+ import { b as PagerIconsStyled } from "../../slots/PagerSlots.js";
4
5
  function PagerActions(props) {
5
- const { count, page, rowsPerPage, onPageChange, classes } = props;
6
+ const {
7
+ size,
8
+ count,
9
+ page,
10
+ rowsPerPage,
11
+ onPageChange
12
+ //classes
13
+ } = props;
6
14
  const { host_static_assets, environment_assets } = useEnvironment();
7
15
  const handleFirstPageButtonClick = (event) => {
8
16
  onPageChange(event, 0);
@@ -16,48 +24,48 @@ function PagerActions(props) {
16
24
  const handleLastPageButtonClick = (event) => {
17
25
  onPageChange(event, Math.max(0, Math.ceil(count / rowsPerPage) - 1));
18
26
  };
19
- return /* @__PURE__ */ jsxs("div", { className: classes.pagerActions, children: [
27
+ return /* @__PURE__ */ jsxs(PagerIconsStyled, { children: [
20
28
  /* @__PURE__ */ jsx(
21
29
  IconButton,
22
30
  {
31
+ size,
23
32
  dictionaryTooltipId: "pager.first",
24
33
  onClick: handleFirstPageButtonClick,
25
34
  disabled: page === 0,
26
35
  "aria-label": "first page",
27
- className: classes.actionIconFirstPage,
28
36
  src: `${host_static_assets}/${environment_assets}/frontend/components/pager/assets/icons/first.svg`
29
37
  }
30
38
  ),
31
39
  /* @__PURE__ */ jsx(
32
40
  IconButton,
33
41
  {
42
+ size,
34
43
  dictionaryTooltipId: "pager.previous",
35
44
  onClick: handleBackButtonClick,
36
45
  disabled: page === 0,
37
46
  "aria-label": "first page",
38
- className: classes.actionIconPrevious,
39
47
  src: `${host_static_assets}/${environment_assets}/frontend/components/pager/assets/icons/previous.svg`
40
48
  }
41
49
  ),
42
50
  /* @__PURE__ */ jsx(
43
51
  IconButton,
44
52
  {
53
+ size,
45
54
  dictionaryTooltipId: "pager.next",
46
55
  onClick: handleNextButtonClick,
47
56
  disabled: page >= Math.ceil(count / rowsPerPage) - 1,
48
57
  "aria-label": "next page",
49
- className: classes.actionIconNextPage,
50
58
  src: `${host_static_assets}/${environment_assets}/frontend/components/pager/assets/icons/next.svg`
51
59
  }
52
60
  ),
53
61
  /* @__PURE__ */ jsx(
54
62
  IconButton,
55
63
  {
64
+ size,
56
65
  dictionaryTooltipId: "pager.last",
57
66
  onClick: handleLastPageButtonClick,
58
67
  disabled: page >= Math.ceil(count / rowsPerPage) - 1,
59
68
  "aria-label": "last page",
60
- className: classes.actionIconLastPage,
61
69
  src: `${host_static_assets}/${environment_assets}/frontend/components/pager/assets/icons/last.svg`
62
70
  }
63
71
  )