elbe-ui 2.0.1 → 2.0.2
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/ui/app/app.js +42 -39
- package/package.json +1 -1
package/dist/ui/app/app.js
CHANGED
|
@@ -20,52 +20,55 @@ function _initialLocation() {
|
|
|
20
20
|
return (window.location.pathname + window.location.search + window.location.hash);
|
|
21
21
|
}
|
|
22
22
|
function _App(p) {
|
|
23
|
+
var _a;
|
|
24
|
+
const theme = p.themeContext.useTheme();
|
|
25
|
+
const themeSelected = theme.useWith((_a = p.themeSelector) !== null && _a !== void 0 ? _a : (() => ({})), [
|
|
26
|
+
p.config,
|
|
27
|
+
p.themeSelector,
|
|
28
|
+
]);
|
|
23
29
|
const menuItems = useMemo(() => {
|
|
24
30
|
return _extractMenuItems(p.children);
|
|
25
31
|
}, [p.children]);
|
|
26
32
|
const [location, navigate] = Wouter.useLocation();
|
|
27
33
|
const [history, setHistory] = useState([_initialLocation()]);
|
|
28
34
|
const [menuOpen, setMenuOpen] = useState(false);
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
},
|
|
55
|
-
history: history,
|
|
56
|
-
location: location,
|
|
57
|
-
},
|
|
58
|
-
menu: menuItems.length === 0
|
|
59
|
-
? undefined
|
|
60
|
-
: {
|
|
61
|
-
isOpen: menuOpen,
|
|
62
|
-
setOpen: (s) => setMenuOpen(s),
|
|
35
|
+
return (_jsx(p.themeContext.WithTheme, { theme: themeSelected, children: _jsx(AppContext.Provider, { value: {
|
|
36
|
+
appConfig: p.config,
|
|
37
|
+
_appThemeContext: p.themeContext,
|
|
38
|
+
router: {
|
|
39
|
+
goBack: (steps = 1) => {
|
|
40
|
+
if (history.length === 0)
|
|
41
|
+
return;
|
|
42
|
+
const targetIndex = Math.max(0, history.length - 1 - steps);
|
|
43
|
+
const target = history[targetIndex];
|
|
44
|
+
setHistory((h) => h.slice(0, targetIndex + 1));
|
|
45
|
+
navigate(target, { replace: true });
|
|
46
|
+
},
|
|
47
|
+
go: (p, replace) => {
|
|
48
|
+
setHistory((h) => {
|
|
49
|
+
if (replace === "all")
|
|
50
|
+
return [p];
|
|
51
|
+
const repl = Math.max(0, replace !== null && replace !== void 0 ? replace : 0);
|
|
52
|
+
if (repl === 0)
|
|
53
|
+
return [...h, p];
|
|
54
|
+
return [...h.slice(0, -repl), p];
|
|
55
|
+
});
|
|
56
|
+
navigate(p, { replace: (replace !== null && replace !== void 0 ? replace : 0) !== 0 });
|
|
57
|
+
},
|
|
58
|
+
history: history,
|
|
59
|
+
location: location,
|
|
63
60
|
},
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
61
|
+
menu: menuItems.length === 0
|
|
62
|
+
? undefined
|
|
63
|
+
: {
|
|
64
|
+
isOpen: menuOpen,
|
|
65
|
+
setOpen: (s) => setMenuOpen(s),
|
|
66
|
+
},
|
|
67
|
+
}, children: _jsx(ToastProvider, { children: _jsx(DialogsProvider, { children: _jsxs(Box, { typeLabel: "app_base", scheme: "primary", style: {
|
|
68
|
+
display: "flex",
|
|
69
|
+
width: "100%",
|
|
70
|
+
minHeight: "100vh",
|
|
71
|
+
}, children: [menuItems.length > 0 && _jsx(Menu, { items: menuItems }), _jsx("div", { style: { flex: 1, width: "0px" }, children: _jsx(Wouter.Switch, { children: p.children }) })] }) }) }) }) }));
|
|
69
72
|
}
|
|
70
73
|
function _extractMenuItems(children) {
|
|
71
74
|
if (!children)
|