@etsoo/toolpad 1.0.21 → 1.0.23
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.
|
@@ -64,7 +64,9 @@ function reducer(state, action) {
|
|
|
64
64
|
// Reset the state
|
|
65
65
|
if (state.breadcrumbs == null &&
|
|
66
66
|
state.title == null &&
|
|
67
|
-
state.page == null
|
|
67
|
+
state.page == null &&
|
|
68
|
+
state.noBreadcrumbs == null &&
|
|
69
|
+
state.noPageHeader == null) {
|
|
68
70
|
return state;
|
|
69
71
|
}
|
|
70
72
|
else {
|
|
@@ -75,12 +77,14 @@ function reducer(state, action) {
|
|
|
75
77
|
}
|
|
76
78
|
function PageDataContextProvider(props) {
|
|
77
79
|
// Destruct
|
|
78
|
-
const { title, page, breadcrumbs, ...rest } = props;
|
|
80
|
+
const { title, page, breadcrumbs, noBreadcrumbs, noPageHeader, ...rest } = props;
|
|
79
81
|
// useReducer hook to manage state with our reducer function and initial state
|
|
80
82
|
const [state, dispatch] = React.useReducer(reducer, {
|
|
81
83
|
title,
|
|
82
84
|
page,
|
|
83
|
-
breadcrumbs
|
|
85
|
+
breadcrumbs,
|
|
86
|
+
noBreadcrumbs,
|
|
87
|
+
noPageHeader
|
|
84
88
|
});
|
|
85
89
|
// Provide the state and dispatch function to the context value
|
|
86
90
|
return (0, jsx_runtime_1.jsx)(exports.PageDataContext.Provider, { value: { state, dispatch }, ...rest });
|
|
@@ -125,7 +129,7 @@ function PageContainer(props) {
|
|
|
125
129
|
externalSlotProps: props?.slotProps?.toolbar,
|
|
126
130
|
additionalProps: {}
|
|
127
131
|
});
|
|
128
|
-
return ((0, jsx_runtime_1.jsxs)(Stack_1.default, { sx: { mx: 3, my: 2 }, spacing: 2, ...rest, children: [state.noPageHeader !==
|
|
132
|
+
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
|
|
129
133
|
? resolvedBreadcrumbs.map((item, index) => {
|
|
130
134
|
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));
|
|
131
135
|
})
|
|
@@ -23,7 +23,9 @@ function reducer(state, action) {
|
|
|
23
23
|
// Reset the state
|
|
24
24
|
if (state.breadcrumbs == null &&
|
|
25
25
|
state.title == null &&
|
|
26
|
-
state.page == null
|
|
26
|
+
state.page == null &&
|
|
27
|
+
state.noBreadcrumbs == null &&
|
|
28
|
+
state.noPageHeader == null) {
|
|
27
29
|
return state;
|
|
28
30
|
}
|
|
29
31
|
else {
|
|
@@ -34,12 +36,14 @@ function reducer(state, action) {
|
|
|
34
36
|
}
|
|
35
37
|
export function PageDataContextProvider(props) {
|
|
36
38
|
// Destruct
|
|
37
|
-
const { title, page, breadcrumbs, ...rest } = props;
|
|
39
|
+
const { title, page, breadcrumbs, noBreadcrumbs, noPageHeader, ...rest } = props;
|
|
38
40
|
// useReducer hook to manage state with our reducer function and initial state
|
|
39
41
|
const [state, dispatch] = React.useReducer(reducer, {
|
|
40
42
|
title,
|
|
41
43
|
page,
|
|
42
|
-
breadcrumbs
|
|
44
|
+
breadcrumbs,
|
|
45
|
+
noBreadcrumbs,
|
|
46
|
+
noPageHeader
|
|
43
47
|
});
|
|
44
48
|
// Provide the state and dispatch function to the context value
|
|
45
49
|
return _jsx(PageDataContext.Provider, { value: { state, dispatch }, ...rest });
|
|
@@ -84,7 +88,7 @@ function PageContainer(props) {
|
|
|
84
88
|
externalSlotProps: props?.slotProps?.toolbar,
|
|
85
89
|
additionalProps: {}
|
|
86
90
|
});
|
|
87
|
-
return (_jsxs(Stack, { sx: { mx: 3, my: 2 }, spacing: 2, ...rest, children: [state.noPageHeader !==
|
|
91
|
+
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
|
|
88
92
|
? resolvedBreadcrumbs.map((item, index) => {
|
|
89
93
|
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));
|
|
90
94
|
})
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@etsoo/toolpad",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.23",
|
|
4
4
|
"author": "ETSOO",
|
|
5
5
|
"description": "Dashboard framework extention based on Toolpad Core",
|
|
6
6
|
"main": "build/cjs/index.js",
|
|
@@ -47,19 +47,19 @@
|
|
|
47
47
|
"dependencies": {
|
|
48
48
|
"@emotion/react": "^11.14.0",
|
|
49
49
|
"@emotion/styled": "^11.14.0",
|
|
50
|
-
"@mui/icons-material": "
|
|
51
|
-
"@mui/material": "
|
|
52
|
-
"@mui/utils": "
|
|
50
|
+
"@mui/icons-material": "7.0.0",
|
|
51
|
+
"@mui/material": "7.0.0",
|
|
52
|
+
"@mui/utils": "7.0.0",
|
|
53
53
|
"invariant": "2.2.4",
|
|
54
54
|
"path-to-regexp": "6.3.0",
|
|
55
55
|
"react": "^19.0.0"
|
|
56
56
|
},
|
|
57
57
|
"devDependencies": {
|
|
58
|
-
"@babel/cli": "^7.
|
|
58
|
+
"@babel/cli": "^7.27.0",
|
|
59
59
|
"@babel/core": "^7.26.10",
|
|
60
60
|
"@babel/plugin-transform-runtime": "^7.26.10",
|
|
61
61
|
"@babel/preset-env": "^7.26.9",
|
|
62
|
-
"@babel/runtime-corejs3": "^7.
|
|
62
|
+
"@babel/runtime-corejs3": "^7.27.0",
|
|
63
63
|
"@testing-library/jest-dom": "^6.6.3",
|
|
64
64
|
"@testing-library/react": "^16.2.0",
|
|
65
65
|
"@types/invariant": "2.2.37",
|
|
@@ -68,7 +68,7 @@
|
|
|
68
68
|
"@vitejs/plugin-react": "4.3.4",
|
|
69
69
|
"@vitest/browser": "3.0.9",
|
|
70
70
|
"jsdom": "^26.0.0",
|
|
71
|
-
"next": "^15.2.
|
|
71
|
+
"next": "^15.2.4",
|
|
72
72
|
"next-router-mock": "^0.9.13",
|
|
73
73
|
"playwright": "^1.51.1",
|
|
74
74
|
"react-router-dom": "7.4.0",
|
|
@@ -65,7 +65,9 @@ function reducer(state: PageData, action: PageDataAction) {
|
|
|
65
65
|
if (
|
|
66
66
|
state.breadcrumbs == null &&
|
|
67
67
|
state.title == null &&
|
|
68
|
-
state.page == null
|
|
68
|
+
state.page == null &&
|
|
69
|
+
state.noBreadcrumbs == null &&
|
|
70
|
+
state.noPageHeader == null
|
|
69
71
|
) {
|
|
70
72
|
return state;
|
|
71
73
|
} else {
|
|
@@ -80,13 +82,16 @@ export function PageDataContextProvider(
|
|
|
80
82
|
props: React.PropsWithChildren<PageData>
|
|
81
83
|
) {
|
|
82
84
|
// Destruct
|
|
83
|
-
const { title, page, breadcrumbs, ...rest } =
|
|
85
|
+
const { title, page, breadcrumbs, noBreadcrumbs, noPageHeader, ...rest } =
|
|
86
|
+
props;
|
|
84
87
|
|
|
85
88
|
// useReducer hook to manage state with our reducer function and initial state
|
|
86
89
|
const [state, dispatch] = React.useReducer(reducer, {
|
|
87
90
|
title,
|
|
88
91
|
page,
|
|
89
|
-
breadcrumbs
|
|
92
|
+
breadcrumbs,
|
|
93
|
+
noBreadcrumbs,
|
|
94
|
+
noPageHeader
|
|
90
95
|
});
|
|
91
96
|
|
|
92
97
|
// Provide the state and dispatch function to the context value
|
|
@@ -158,9 +163,9 @@ function PageContainer(props: PageContainerProps) {
|
|
|
158
163
|
|
|
159
164
|
return (
|
|
160
165
|
<Stack sx={{ mx: 3, my: 2 }} spacing={2} {...rest}>
|
|
161
|
-
{state.noPageHeader !==
|
|
166
|
+
{state.noPageHeader !== true && (
|
|
162
167
|
<Stack>
|
|
163
|
-
{state.noBreadcrumbs !==
|
|
168
|
+
{state.noBreadcrumbs !== true && (
|
|
164
169
|
<Breadcrumbs aria-label="breadcrumb">
|
|
165
170
|
{resolvedBreadcrumbs
|
|
166
171
|
? resolvedBreadcrumbs.map((item, index) => {
|