@m4l/components 0.0.4 → 0.0.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/commonjs.js +5 -1
- package/dist/components/DataGrid/components/Actions/components/Density/index.d.ts +2 -0
- package/dist/components/DataGrid/components/Actions/components/Density/styles.d.ts +3 -0
- package/dist/components/DataGrid/components/Actions/components/Filter/index.d.ts +2 -0
- package/dist/components/DataGrid/components/Actions/components/Filter/styles.d.ts +2 -0
- package/dist/components/DataGrid/components/Actions/components/RowsCount/index.d.ts +2 -0
- package/dist/components/DataGrid/components/Actions/components/RowsCount/styles.d.ts +4 -0
- package/dist/components/DataGrid/components/Actions/components/Settings/ColumnsConfig/components/FormatterColumn/index.d.ts +4 -0
- package/dist/components/DataGrid/components/Actions/components/Settings/ColumnsConfig/index.d.ts +3 -0
- package/dist/components/DataGrid/components/Actions/components/Settings/ColumnsConfig/styles.d.ts +8 -0
- package/dist/components/DataGrid/components/Actions/components/Settings/ColumnsConfig/types.d.ts +25 -0
- package/dist/components/DataGrid/components/Actions/components/Settings/index.d.ts +2 -0
- package/dist/components/DataGrid/components/Actions/components/Settings/styles.d.ts +2 -0
- package/dist/components/DataGrid/components/Actions/components/Settings/types.d.ts +2 -0
- package/dist/components/DataGrid/components/Actions/index.d.ts +3 -0
- package/dist/components/DataGrid/components/Actions/styles.d.ts +2 -0
- package/dist/components/DataGrid/components/Actions/types.d.ts +11 -0
- package/dist/components/DataGrid/components/Table/components/ActionsColumn.d.ts +4 -0
- package/dist/components/DataGrid/components/Table/components/CheckboxFormatter.d.ts +3 -0
- package/dist/components/DataGrid/components/Table/components/CustomIcons.d.ts +15 -0
- package/dist/components/DataGrid/components/Table/components/DraggableHeaderRenderer.d.ts +6 -0
- package/dist/components/DataGrid/components/Table/components/SelectColumn.d.ts +4 -0
- package/dist/components/DataGrid/components/Table/components/SkeletonFormatter/index.d.ts +2 -0
- package/dist/components/DataGrid/components/Table/components/SkeletonFormatter/styles.d.ts +2 -0
- package/dist/components/DataGrid/components/Table/hooks/getDragHeaderRenderer.d.ts +3 -0
- package/dist/components/DataGrid/components/Table/hooks/useFocusRef.d.ts +5 -0
- package/dist/components/DataGrid/components/Table/hooks/useSortColumnsRows.d.ts +8 -0
- package/dist/components/DataGrid/components/Table/index.d.ts +3 -0
- package/dist/components/DataGrid/components/Table/styles.d.ts +3 -0
- package/dist/components/DataGrid/contexts/BaseContext/index.d.ts +5 -0
- package/dist/components/DataGrid/contexts/BaseContext/types.d.ts +51 -0
- package/dist/components/DataGrid/contexts/FilterContext/index.d.ts +9 -0
- package/dist/components/DataGrid/contexts/FilterContext/types.d.ts +11 -0
- package/dist/components/DataGrid/formatters/DateFormatter/index.d.ts +3 -0
- package/dist/components/DataGrid/formatters/DateFormatter/types.d.ts +6 -0
- package/dist/components/DataGrid/hooks/useBase.d.ts +1 -0
- package/dist/components/DataGrid/hooks/useFilters.d.ts +1 -0
- package/dist/components/DataGrid/index.d.ts +3 -0
- package/dist/components/DataGrid/index.js +1623 -0
- package/dist/components/DataGrid/styles.d.ts +3 -0
- package/dist/components/DataGrid/types.d.ts +56 -0
- package/dist/components/ModalDialog/index.js +2 -1
- package/dist/components/ObjectLogs/components/DetailDialog/index.d.ts +3 -0
- package/dist/components/ObjectLogs/components/DetailDialog/styles.d.ts +3 -0
- package/dist/components/ObjectLogs/components/DetailDialog/types.d.ts +3 -0
- package/dist/components/ObjectLogs/components/DetailFormatter/index.d.ts +3 -0
- package/dist/components/ObjectLogs/components/DetailFormatter/types.d.ts +3 -0
- package/dist/components/ObjectLogs/index.d.ts +3 -0
- package/dist/components/ObjectLogs/index.js +283 -0
- package/dist/components/ObjectLogs/styles.d.ts +4 -0
- package/dist/components/ObjectLogs/types.d.ts +18 -0
- package/dist/components/index.d.ts +2 -0
- package/dist/components/mui_extended/IconButton/index.d.ts +5 -0
- package/dist/components/mui_extended/IconButton/index.js +37 -0
- package/dist/components/mui_extended/IconButton/types.d.ts +5 -0
- package/dist/components/mui_extended/MenuActions/index.d.ts +2 -1
- package/dist/components/mui_extended/MenuActions/styles.d.ts +2 -2
- package/dist/components/mui_extended/Pager/components/PagerActions/index.d.ts +3 -0
- package/dist/components/mui_extended/Pager/components/PagerActions/styles.d.ts +2 -0
- package/dist/components/mui_extended/Pager/components/PagerActions/types.d.ts +7 -0
- package/dist/components/mui_extended/Pager/dicctionary.d.ts +3 -0
- package/dist/components/mui_extended/Pager/index.d.ts +4 -0
- package/dist/components/mui_extended/Pager/index.js +201 -0
- package/dist/components/mui_extended/Pager/styles.d.ts +6 -0
- package/dist/components/mui_extended/Pager/types.d.ts +13 -0
- package/dist/components/mui_extended/index.d.ts +4 -0
- package/dist/hooks/usePaginate.d.ts +15 -0
- package/dist/index.js +16 -4
- package/dist/react-data-grid.js +2652 -0
- package/dist/react-draggable.js +2 -2
- package/dist/react-json-view.js +2764 -0
- package/dist/vendor.js +78 -4
- package/package.json +15 -3
- package/dist/prop-types.js +0 -1
- package/dist/react.js +0 -2
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
import { useMemo } from "react";
|
|
2
|
+
import { Skeleton, TablePagination } from "@mui/material";
|
|
3
|
+
import { styled } from "@mui/material/styles";
|
|
4
|
+
import { I as IconButton } from "../IconButton/index.js";
|
|
5
|
+
import { useEnvironment } from "@m4l/core";
|
|
6
|
+
import { jsxs, jsx } from "react/jsx-runtime";
|
|
7
|
+
const WrapperPagerActions = styled("div")(({ theme }) => ({
|
|
8
|
+
width: "100%",
|
|
9
|
+
justifyContent: "center",
|
|
10
|
+
display: "flex",
|
|
11
|
+
marginLeft: 0,
|
|
12
|
+
[theme.breakpoints.up("sm")]: {
|
|
13
|
+
display: "flex",
|
|
14
|
+
alignItems: "center",
|
|
15
|
+
marginLeft: theme.spacing(3)
|
|
16
|
+
}
|
|
17
|
+
}));
|
|
18
|
+
function PagerActions(props) {
|
|
19
|
+
const {
|
|
20
|
+
count,
|
|
21
|
+
page,
|
|
22
|
+
rowsPerPage,
|
|
23
|
+
onPageChange
|
|
24
|
+
} = props;
|
|
25
|
+
const {
|
|
26
|
+
host_static_assets,
|
|
27
|
+
environment
|
|
28
|
+
} = useEnvironment();
|
|
29
|
+
const handleFirstPageButtonClick = (event) => {
|
|
30
|
+
onPageChange(event, 0);
|
|
31
|
+
};
|
|
32
|
+
const handleBackButtonClick = (event) => {
|
|
33
|
+
onPageChange(event, page - 1);
|
|
34
|
+
};
|
|
35
|
+
const handleNextButtonClick = (event) => {
|
|
36
|
+
onPageChange(event, page + 1);
|
|
37
|
+
};
|
|
38
|
+
const handleLastPageButtonClick = (event) => {
|
|
39
|
+
onPageChange(event, Math.max(0, Math.ceil(count / rowsPerPage) - 1));
|
|
40
|
+
};
|
|
41
|
+
return /* @__PURE__ */ jsxs(WrapperPagerActions, {
|
|
42
|
+
id: "WrapperPagerActions",
|
|
43
|
+
children: [/* @__PURE__ */ jsx(IconButton, {
|
|
44
|
+
dictionaryTooltip: "pager.first",
|
|
45
|
+
onClick: handleFirstPageButtonClick,
|
|
46
|
+
disabled: page === 0,
|
|
47
|
+
"aria-label": "first page",
|
|
48
|
+
src: `${host_static_assets}/${environment}/frontend/components/pager/assets/icons/first.svg`
|
|
49
|
+
}), /* @__PURE__ */ jsx(IconButton, {
|
|
50
|
+
dictionaryTooltip: "pager.previous",
|
|
51
|
+
onClick: handleBackButtonClick,
|
|
52
|
+
disabled: page === 0,
|
|
53
|
+
"aria-label": "first page",
|
|
54
|
+
src: `${host_static_assets}/${environment}/frontend/components/pager/assets/icons/previous.svg`
|
|
55
|
+
}), /* @__PURE__ */ jsx(IconButton, {
|
|
56
|
+
dictionaryTooltip: "pager.next",
|
|
57
|
+
onClick: handleNextButtonClick,
|
|
58
|
+
disabled: page >= Math.ceil(count / rowsPerPage) - 1,
|
|
59
|
+
"aria-label": "next page",
|
|
60
|
+
src: `${host_static_assets}/${environment}/frontend/components/pager/assets/icons/next.svg`
|
|
61
|
+
}), /* @__PURE__ */ jsx(IconButton, {
|
|
62
|
+
dictionaryTooltip: "pager.last",
|
|
63
|
+
onClick: handleLastPageButtonClick,
|
|
64
|
+
disabled: page >= Math.ceil(count / rowsPerPage) - 1,
|
|
65
|
+
"aria-label": "last page",
|
|
66
|
+
src: `${host_static_assets}/${environment}/frontend/components/pager/assets/icons/last.svg`
|
|
67
|
+
})]
|
|
68
|
+
});
|
|
69
|
+
}
|
|
70
|
+
styled("div")(() => ({
|
|
71
|
+
display: "flex",
|
|
72
|
+
flexDirection: "column",
|
|
73
|
+
height: "100%",
|
|
74
|
+
overflow: "hidden"
|
|
75
|
+
}));
|
|
76
|
+
const SKTWrapperPagerActions = styled("div")(({ theme }) => ({
|
|
77
|
+
width: "100%",
|
|
78
|
+
display: "flex",
|
|
79
|
+
justifyContent: "center",
|
|
80
|
+
alignItems: "center",
|
|
81
|
+
marginLeft: theme.spacing(3)
|
|
82
|
+
}));
|
|
83
|
+
const SKTSvgIconButtonContainer = styled("div")(({ theme }) => ({
|
|
84
|
+
display: "flex",
|
|
85
|
+
marginLeft: theme.spacing(3)
|
|
86
|
+
}));
|
|
87
|
+
const SKTSvgIconButton = styled("div")(({ theme }) => ({
|
|
88
|
+
display: "flex",
|
|
89
|
+
justifyContent: "center",
|
|
90
|
+
alignItems: "center",
|
|
91
|
+
width: theme.spacing(3.75),
|
|
92
|
+
height: theme.spacing(3.75)
|
|
93
|
+
}));
|
|
94
|
+
const SKTWrapperRowsPerPage = styled("div")(({ theme }) => ({
|
|
95
|
+
display: "grid",
|
|
96
|
+
gridTemplateColumns: "auto auto",
|
|
97
|
+
gridGap: theme.spacing(1),
|
|
98
|
+
marginRight: theme.spacing(3)
|
|
99
|
+
}));
|
|
100
|
+
function Pager(props) {
|
|
101
|
+
const {
|
|
102
|
+
totalRecords,
|
|
103
|
+
rowsPerPageOptions = [5, 10, 2],
|
|
104
|
+
rowsPerPage = 25,
|
|
105
|
+
page,
|
|
106
|
+
onPageChange,
|
|
107
|
+
onRowsPerPageChange,
|
|
108
|
+
labelRows = "Rows per page",
|
|
109
|
+
labelOf = "Of",
|
|
110
|
+
isSkeleton = "false",
|
|
111
|
+
isDesktop
|
|
112
|
+
} = props;
|
|
113
|
+
const currentPage = useMemo(() => {
|
|
114
|
+
if (rowsPerPage * page > totalRecords) {
|
|
115
|
+
return Math.floor(totalRecords / rowsPerPage);
|
|
116
|
+
}
|
|
117
|
+
return page;
|
|
118
|
+
}, [page, rowsPerPage, totalRecords]);
|
|
119
|
+
const handleChangeRowsPerPage = (event) => {
|
|
120
|
+
onRowsPerPageChange(parseInt(event.target.value, 10));
|
|
121
|
+
onPageChange(0);
|
|
122
|
+
};
|
|
123
|
+
const handleChangePage = (_event, newPage) => {
|
|
124
|
+
onPageChange(newPage);
|
|
125
|
+
};
|
|
126
|
+
if (isSkeleton) {
|
|
127
|
+
return /* @__PURE__ */ jsxs(SKTWrapperPagerActions, {
|
|
128
|
+
children: [/* @__PURE__ */ jsxs(SKTWrapperRowsPerPage, {
|
|
129
|
+
children: [/* @__PURE__ */ jsx(Skeleton, {
|
|
130
|
+
variant: "text",
|
|
131
|
+
width: "40px",
|
|
132
|
+
height: "16px"
|
|
133
|
+
}), /* @__PURE__ */ jsx(Skeleton, {
|
|
134
|
+
variant: "text",
|
|
135
|
+
width: "20px",
|
|
136
|
+
height: "16px"
|
|
137
|
+
})]
|
|
138
|
+
}), /* @__PURE__ */ jsx(Skeleton, {
|
|
139
|
+
variant: "text",
|
|
140
|
+
width: "50px",
|
|
141
|
+
height: "16px"
|
|
142
|
+
}), /* @__PURE__ */ jsxs(SKTSvgIconButtonContainer, {
|
|
143
|
+
children: [/* @__PURE__ */ jsx(SKTSvgIconButton, {
|
|
144
|
+
children: /* @__PURE__ */ jsx(Skeleton, {
|
|
145
|
+
variant: "circular",
|
|
146
|
+
width: 20,
|
|
147
|
+
height: 20
|
|
148
|
+
})
|
|
149
|
+
}), /* @__PURE__ */ jsx(SKTSvgIconButton, {
|
|
150
|
+
children: /* @__PURE__ */ jsx(Skeleton, {
|
|
151
|
+
variant: "circular",
|
|
152
|
+
width: 20,
|
|
153
|
+
height: 20
|
|
154
|
+
})
|
|
155
|
+
}), /* @__PURE__ */ jsx(SKTSvgIconButton, {
|
|
156
|
+
children: /* @__PURE__ */ jsx(Skeleton, {
|
|
157
|
+
variant: "circular",
|
|
158
|
+
width: 20,
|
|
159
|
+
height: 20
|
|
160
|
+
})
|
|
161
|
+
}), /* @__PURE__ */ jsx(SKTSvgIconButton, {
|
|
162
|
+
children: /* @__PURE__ */ jsx(Skeleton, {
|
|
163
|
+
variant: "circular",
|
|
164
|
+
width: 20,
|
|
165
|
+
height: 20
|
|
166
|
+
})
|
|
167
|
+
})]
|
|
168
|
+
})]
|
|
169
|
+
});
|
|
170
|
+
}
|
|
171
|
+
return /* @__PURE__ */ jsx(TablePagination, {
|
|
172
|
+
id: "TablePagination",
|
|
173
|
+
rowsPerPageOptions,
|
|
174
|
+
component: "div",
|
|
175
|
+
count: totalRecords,
|
|
176
|
+
rowsPerPage,
|
|
177
|
+
page: currentPage,
|
|
178
|
+
onPageChange: handleChangePage,
|
|
179
|
+
onRowsPerPageChange: handleChangeRowsPerPage,
|
|
180
|
+
labelDisplayedRows: isDesktop ? ({
|
|
181
|
+
from,
|
|
182
|
+
to,
|
|
183
|
+
count
|
|
184
|
+
}) => `${from}-${to} ${labelOf} ${count}` : () => ``,
|
|
185
|
+
labelRowsPerPage: isDesktop ? labelRows : "",
|
|
186
|
+
ActionsComponent: PagerActions
|
|
187
|
+
});
|
|
188
|
+
}
|
|
189
|
+
function getPagerComponentsDictionary() {
|
|
190
|
+
return ["pager"];
|
|
191
|
+
}
|
|
192
|
+
const defaultPagerDictionary = {
|
|
193
|
+
pager: {
|
|
194
|
+
first: "First",
|
|
195
|
+
previous: "Previous",
|
|
196
|
+
before: "Before",
|
|
197
|
+
last: "Last",
|
|
198
|
+
of: "of"
|
|
199
|
+
}
|
|
200
|
+
};
|
|
201
|
+
export { Pager as P, defaultPagerDictionary as d, getPagerComponentsDictionary as g };
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
export declare const Pager: import("@emotion/styled").StyledComponent<import("@mui/system").MUIStyledCommonProps<import("@mui/material/styles").Theme>, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
|
|
3
|
+
export declare const SKTWrapperPagerActions: import("@emotion/styled").StyledComponent<import("@mui/system").MUIStyledCommonProps<import("@mui/material/styles").Theme>, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
|
|
4
|
+
export declare const SKTSvgIconButtonContainer: import("@emotion/styled").StyledComponent<import("@mui/system").MUIStyledCommonProps<import("@mui/material/styles").Theme>, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
|
|
5
|
+
export declare const SKTSvgIconButton: import("@emotion/styled").StyledComponent<import("@mui/system").MUIStyledCommonProps<import("@mui/material/styles").Theme>, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
|
|
6
|
+
export declare const SKTWrapperRowsPerPage: import("@emotion/styled").StyledComponent<import("@mui/system").MUIStyledCommonProps<import("@mui/material/styles").Theme>, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export interface PagerProps {
|
|
2
|
+
records: number;
|
|
3
|
+
totalRecords: number;
|
|
4
|
+
rowsPerPageOptions?: number[];
|
|
5
|
+
rowsPerPage?: number;
|
|
6
|
+
page: number;
|
|
7
|
+
onPageChange: (newPage: number) => void;
|
|
8
|
+
onRowsPerPageChange: (newRowsPerPage: number) => void;
|
|
9
|
+
labelRows?: string;
|
|
10
|
+
labelOf?: string;
|
|
11
|
+
isSkeleton?: boolean;
|
|
12
|
+
isDesktop?: boolean;
|
|
13
|
+
}
|
|
@@ -1,9 +1,13 @@
|
|
|
1
1
|
export { BoxIcon } from './BoxIcon';
|
|
2
2
|
export { default as MenuPopover } from './MenuPopover';
|
|
3
|
+
export { default as IconButton } from './IconButton';
|
|
3
4
|
export { default as Breadcrumbs } from './Breadcrumbs';
|
|
4
5
|
export type { TLink } from './Breadcrumbs/types';
|
|
5
6
|
export { default as MenuActions } from './MenuActions';
|
|
6
7
|
export type { MenuAction, ComponentActionProps } from './MenuActions/types';
|
|
8
|
+
export { default as Pager } from './Pager';
|
|
9
|
+
export { getPagerComponentsDictionary, defaultPagerDictionary } from './Pager/dicctionary';
|
|
10
|
+
export type { PagerProps } from './Pager/types';
|
|
7
11
|
declare module '@mui/material/styles/createPalette' {
|
|
8
12
|
interface TypeBackground {
|
|
9
13
|
neutral: string;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { PagerState } from '../components/DataGrid/types';
|
|
2
|
+
export interface propsUsePaginate {
|
|
3
|
+
endPoint: string;
|
|
4
|
+
timeout?: number;
|
|
5
|
+
fireOnEnter?: boolean;
|
|
6
|
+
queryParams?: Record<string, unknown>;
|
|
7
|
+
}
|
|
8
|
+
export declare const usePaginate: <TRow>(props: propsUsePaginate) => {
|
|
9
|
+
onPageChange: (newPage: number) => void;
|
|
10
|
+
onRowsPerPageChange: (newRowsPerPage: number) => void;
|
|
11
|
+
pagerState: PagerState;
|
|
12
|
+
rows: TRow[];
|
|
13
|
+
clearRows: () => void;
|
|
14
|
+
Refresh: () => void;
|
|
15
|
+
};
|
package/dist/index.js
CHANGED
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
export { B as BoxIcon } from "./components/mui_extended/BoxIcon/index.js";
|
|
2
2
|
export { M as MenuPopover } from "./components/mui_extended/MenuPopover/index.js";
|
|
3
|
+
export { I as IconButton } from "./components/mui_extended/IconButton/index.js";
|
|
3
4
|
export { B as Breadcrumbs } from "./components/mui_extended/Breadcrumbs/index.js";
|
|
4
5
|
export { M as MenuActions } from "./components/mui_extended/MenuActions/index.js";
|
|
6
|
+
export { P as Pager, d as defaultPagerDictionary, g as getPagerComponentsDictionary } from "./components/mui_extended/Pager/index.js";
|
|
7
|
+
export { a as DataGrid } from "./components/DataGrid/index.js";
|
|
8
|
+
export { O as ObjectLogs } from "./components/ObjectLogs/index.js";
|
|
5
9
|
export { F as FormActions } from "./components/FormActions/index.js";
|
|
6
10
|
export { M as ModalDialog, d as defaultModalDialogDictionary, g as getModalDialogComponentsDictionary } from "./components/ModalDialog/index.js";
|
|
7
11
|
export { R as Resizeable } from "./components/Resizeable/index.js";
|
|
@@ -15,13 +19,21 @@ import "@mui/material";
|
|
|
15
19
|
import "react";
|
|
16
20
|
import "@m4l/core";
|
|
17
21
|
import "react-router-dom";
|
|
18
|
-
import "./react-
|
|
19
|
-
import "prop-types";
|
|
20
|
-
import "react-dom";
|
|
22
|
+
import "./react-data-grid.js";
|
|
21
23
|
import "clsx";
|
|
24
|
+
import "react-dnd";
|
|
25
|
+
import "react-dnd-html5-backend";
|
|
26
|
+
import "@mui_extended";
|
|
22
27
|
import "./vendor.js";
|
|
23
28
|
import "@mui/material/useMediaQuery";
|
|
24
|
-
import "
|
|
29
|
+
import "@mui/x-date-pickers";
|
|
30
|
+
import "@mui/lab/AdapterDateFns";
|
|
31
|
+
import "date-fns";
|
|
32
|
+
import "./react-json-view.js";
|
|
25
33
|
import "./commonjs.js";
|
|
34
|
+
import "prop-types";
|
|
35
|
+
import "react-dom";
|
|
36
|
+
import "./react-draggable.js";
|
|
37
|
+
import "./react-splitter-layout.js";
|
|
26
38
|
import "./react-resizable.js";
|
|
27
39
|
import "@mui/material/Typography";
|