@etsoo/toolpad 1.0.20 → 1.0.22
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/build/cjs/PageContainer/PageContainer.d.ts +2 -0
- package/build/cjs/PageContainer/PageContainer.js +3 -2
- package/build/mjs/PageContainer/PageContainer.d.ts +2 -0
- package/build/mjs/PageContainer/PageContainer.js +3 -2
- package/package.json +3 -3
- package/src/PageContainer/PageContainer.tsx +34 -27
|
@@ -103,6 +103,7 @@ function PageContainer(props) {
|
|
|
103
103
|
const activePage = (0, useActivePage_1.useActivePage)();
|
|
104
104
|
React.useLayoutEffect(() => {
|
|
105
105
|
if (loaded.current) {
|
|
106
|
+
// Reset the page data state
|
|
106
107
|
dispatch(true);
|
|
107
108
|
}
|
|
108
109
|
else {
|
|
@@ -124,9 +125,9 @@ function PageContainer(props) {
|
|
|
124
125
|
externalSlotProps: props?.slotProps?.toolbar,
|
|
125
126
|
additionalProps: {}
|
|
126
127
|
});
|
|
127
|
-
return ((0, jsx_runtime_1.jsxs)(Stack_1.default, { sx: { mx: 3, my: 2 }, spacing: 2, ...rest, children: [(0, jsx_runtime_1.jsxs)(Stack_1.default, { children: [(0, jsx_runtime_1.jsx)(Breadcrumbs_1.default, { "aria-label": "breadcrumb", children: resolvedBreadcrumbs
|
|
128
|
+
return ((0, jsx_runtime_1.jsxs)(Stack_1.default, { sx: { mx: 3, my: 2 }, spacing: 2, ...rest, children: [state.noPageHeader !== true && ((0, jsx_runtime_1.jsxs)(Stack_1.default, { children: [state.noBreadcrumbs !== true && ((0, jsx_runtime_1.jsx)(Breadcrumbs_1.default, { "aria-label": "breadcrumb", children: resolvedBreadcrumbs
|
|
128
129
|
? resolvedBreadcrumbs.map((item, index) => {
|
|
129
130
|
return index < resolvedBreadcrumbs.length - 1 ? ((0, jsx_runtime_1.jsx)(Link_1.default, { component: Link_2.Link, underline: "hover", color: "inherit", href: item.path, children: (0, navigation_1.getItemTitle)(item) }, item.path)) : ((0, jsx_runtime_1.jsx)(Typography_1.default, { color: "text.primary", children: (0, navigation_1.getItemTitle)(item) }, item.path));
|
|
130
131
|
})
|
|
131
|
-
: null }), (0, jsx_runtime_1.jsxs)(PageContentHeader, { children: [title ? (0, jsx_runtime_1.jsx)(Typography_1.default, { variant: "h4", children: title }) : null, (0, jsx_runtime_1.jsx)(ToolbarComponent, { ...toolbarSlotProps })] })] }), children] }));
|
|
132
|
+
: null })), (0, jsx_runtime_1.jsxs)(PageContentHeader, { children: [title ? (0, jsx_runtime_1.jsx)(Typography_1.default, { variant: "h4", children: title }) : null, (0, jsx_runtime_1.jsx)(ToolbarComponent, { ...toolbarSlotProps })] })] })), children] }));
|
|
132
133
|
}
|
|
@@ -62,6 +62,7 @@ function PageContainer(props) {
|
|
|
62
62
|
const activePage = useActivePage();
|
|
63
63
|
React.useLayoutEffect(() => {
|
|
64
64
|
if (loaded.current) {
|
|
65
|
+
// Reset the page data state
|
|
65
66
|
dispatch(true);
|
|
66
67
|
}
|
|
67
68
|
else {
|
|
@@ -83,10 +84,10 @@ function PageContainer(props) {
|
|
|
83
84
|
externalSlotProps: props?.slotProps?.toolbar,
|
|
84
85
|
additionalProps: {}
|
|
85
86
|
});
|
|
86
|
-
return (_jsxs(Stack, { sx: { mx: 3, my: 2 }, spacing: 2, ...rest, children: [_jsxs(Stack, { children: [_jsx(Breadcrumbs, { "aria-label": "breadcrumb", children: resolvedBreadcrumbs
|
|
87
|
+
return (_jsxs(Stack, { sx: { mx: 3, my: 2 }, spacing: 2, ...rest, children: [state.noPageHeader !== true && (_jsxs(Stack, { children: [state.noBreadcrumbs !== true && (_jsx(Breadcrumbs, { "aria-label": "breadcrumb", children: resolvedBreadcrumbs
|
|
87
88
|
? resolvedBreadcrumbs.map((item, index) => {
|
|
88
89
|
return index < resolvedBreadcrumbs.length - 1 ? (_jsx(Link, { component: ToolpadLink, underline: "hover", color: "inherit", href: item.path, children: getItemTitle(item) }, item.path)) : (_jsx(Typography, { color: "text.primary", children: getItemTitle(item) }, item.path));
|
|
89
90
|
})
|
|
90
|
-
: null }), _jsxs(PageContentHeader, { children: [title ? _jsx(Typography, { variant: "h4", children: title }) : null, _jsx(ToolbarComponent, { ...toolbarSlotProps })] })] }), children] }));
|
|
91
|
+
: null })), _jsxs(PageContentHeader, { children: [title ? _jsx(Typography, { variant: "h4", children: title }) : null, _jsx(ToolbarComponent, { ...toolbarSlotProps })] })] })), children] }));
|
|
91
92
|
}
|
|
92
93
|
export { PageContainer };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@etsoo/toolpad",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.22",
|
|
4
4
|
"author": "ETSOO",
|
|
5
5
|
"description": "Dashboard framework extention based on Toolpad Core",
|
|
6
6
|
"main": "build/cjs/index.js",
|
|
@@ -63,7 +63,7 @@
|
|
|
63
63
|
"@testing-library/jest-dom": "^6.6.3",
|
|
64
64
|
"@testing-library/react": "^16.2.0",
|
|
65
65
|
"@types/invariant": "2.2.37",
|
|
66
|
-
"@types/react": "19.0.
|
|
66
|
+
"@types/react": "19.0.12",
|
|
67
67
|
"@types/react-dom": "19.0.4",
|
|
68
68
|
"@vitejs/plugin-react": "4.3.4",
|
|
69
69
|
"@vitest/browser": "3.0.9",
|
|
@@ -71,7 +71,7 @@
|
|
|
71
71
|
"next": "^15.2.3",
|
|
72
72
|
"next-router-mock": "^0.9.13",
|
|
73
73
|
"playwright": "^1.51.1",
|
|
74
|
-
"react-router-dom": "7.
|
|
74
|
+
"react-router-dom": "7.4.0",
|
|
75
75
|
"vitest": "3.0.9"
|
|
76
76
|
},
|
|
77
77
|
"peerDependenciesMeta": {
|
|
@@ -48,6 +48,8 @@ export type PageData = {
|
|
|
48
48
|
title?: string;
|
|
49
49
|
page?: string;
|
|
50
50
|
breadcrumbs?: Breadcrumb[];
|
|
51
|
+
noBreadcrumbs?: boolean;
|
|
52
|
+
noPageHeader?: boolean;
|
|
51
53
|
};
|
|
52
54
|
|
|
53
55
|
type PageDataAction = PageData | true;
|
|
@@ -129,6 +131,7 @@ function PageContainer(props: PageContainerProps) {
|
|
|
129
131
|
|
|
130
132
|
React.useLayoutEffect(() => {
|
|
131
133
|
if (loaded.current) {
|
|
134
|
+
// Reset the page data state
|
|
132
135
|
dispatch(true);
|
|
133
136
|
} else {
|
|
134
137
|
loaded.current = true;
|
|
@@ -155,33 +158,37 @@ function PageContainer(props: PageContainerProps) {
|
|
|
155
158
|
|
|
156
159
|
return (
|
|
157
160
|
<Stack sx={{ mx: 3, my: 2 }} spacing={2} {...rest}>
|
|
158
|
-
|
|
159
|
-
<
|
|
160
|
-
{
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
161
|
+
{state.noPageHeader !== true && (
|
|
162
|
+
<Stack>
|
|
163
|
+
{state.noBreadcrumbs !== true && (
|
|
164
|
+
<Breadcrumbs aria-label="breadcrumb">
|
|
165
|
+
{resolvedBreadcrumbs
|
|
166
|
+
? resolvedBreadcrumbs.map((item, index) => {
|
|
167
|
+
return index < resolvedBreadcrumbs.length - 1 ? (
|
|
168
|
+
<Link
|
|
169
|
+
key={item.path}
|
|
170
|
+
component={ToolpadLink}
|
|
171
|
+
underline="hover"
|
|
172
|
+
color="inherit"
|
|
173
|
+
href={item.path}
|
|
174
|
+
>
|
|
175
|
+
{getItemTitle(item)}
|
|
176
|
+
</Link>
|
|
177
|
+
) : (
|
|
178
|
+
<Typography key={item.path} color="text.primary">
|
|
179
|
+
{getItemTitle(item)}
|
|
180
|
+
</Typography>
|
|
181
|
+
);
|
|
182
|
+
})
|
|
183
|
+
: null}
|
|
184
|
+
</Breadcrumbs>
|
|
185
|
+
)}
|
|
186
|
+
<PageContentHeader>
|
|
187
|
+
{title ? <Typography variant="h4">{title}</Typography> : null}
|
|
188
|
+
<ToolbarComponent {...toolbarSlotProps} />
|
|
189
|
+
</PageContentHeader>
|
|
190
|
+
</Stack>
|
|
191
|
+
)}
|
|
185
192
|
{children}
|
|
186
193
|
</Stack>
|
|
187
194
|
);
|