@leduchai/vmeta-ui-shell 0.1.3 → 0.1.4
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/index.cjs +6 -2
- package/dist/index.js +6 -2
- package/package.json +2 -2
package/dist/index.cjs
CHANGED
|
@@ -28,6 +28,7 @@ __export(index_exports, {
|
|
|
28
28
|
module.exports = __toCommonJS(index_exports);
|
|
29
29
|
var import_react = require("react");
|
|
30
30
|
var import_jsx_runtime = require("react/jsx-runtime");
|
|
31
|
+
var allowAllPermissions = () => true;
|
|
31
32
|
function isMenuItemActive(item, activePath) {
|
|
32
33
|
if (item.match === "exact") return activePath === item.href;
|
|
33
34
|
if (item.match === "prefix") return activePath === item.href || activePath.startsWith(`${item.href}/`);
|
|
@@ -62,7 +63,7 @@ function VmetaSidebar({
|
|
|
62
63
|
account,
|
|
63
64
|
footer,
|
|
64
65
|
showCollapse = false,
|
|
65
|
-
canAccess =
|
|
66
|
+
canAccess = allowAllPermissions,
|
|
66
67
|
onNavigate,
|
|
67
68
|
onCollapsedChange
|
|
68
69
|
}) {
|
|
@@ -83,7 +84,10 @@ function VmetaSidebar({
|
|
|
83
84
|
setOpenKeys(defaultOpenKeys);
|
|
84
85
|
return;
|
|
85
86
|
}
|
|
86
|
-
|
|
87
|
+
const nextOpenKeys = stored.filter(
|
|
88
|
+
(key) => typeof key === "string" && defaultOpenKeys.includes(key)
|
|
89
|
+
);
|
|
90
|
+
setOpenKeys((current) => current.length === nextOpenKeys.length && current.every((key, index) => key === nextOpenKeys[index]) ? current : nextOpenKeys);
|
|
87
91
|
} catch {
|
|
88
92
|
setOpenKeys(defaultOpenKeys);
|
|
89
93
|
}
|
package/dist/index.js
CHANGED
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
// src/index.tsx
|
|
4
4
|
import { useEffect, useMemo, useState } from "react";
|
|
5
5
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
6
|
+
var allowAllPermissions = () => true;
|
|
6
7
|
function isMenuItemActive(item, activePath) {
|
|
7
8
|
if (item.match === "exact") return activePath === item.href;
|
|
8
9
|
if (item.match === "prefix") return activePath === item.href || activePath.startsWith(`${item.href}/`);
|
|
@@ -37,7 +38,7 @@ function VmetaSidebar({
|
|
|
37
38
|
account,
|
|
38
39
|
footer,
|
|
39
40
|
showCollapse = false,
|
|
40
|
-
canAccess =
|
|
41
|
+
canAccess = allowAllPermissions,
|
|
41
42
|
onNavigate,
|
|
42
43
|
onCollapsedChange
|
|
43
44
|
}) {
|
|
@@ -58,7 +59,10 @@ function VmetaSidebar({
|
|
|
58
59
|
setOpenKeys(defaultOpenKeys);
|
|
59
60
|
return;
|
|
60
61
|
}
|
|
61
|
-
|
|
62
|
+
const nextOpenKeys = stored.filter(
|
|
63
|
+
(key) => typeof key === "string" && defaultOpenKeys.includes(key)
|
|
64
|
+
);
|
|
65
|
+
setOpenKeys((current) => current.length === nextOpenKeys.length && current.every((key, index) => key === nextOpenKeys[index]) ? current : nextOpenKeys);
|
|
62
66
|
} catch {
|
|
63
67
|
setOpenKeys(defaultOpenKeys);
|
|
64
68
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@leduchai/vmeta-ui-shell",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.4",
|
|
4
4
|
"description": "Application shell, sidebar, menu va header dung chung cua VMETA.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
"build": "tsup src/index.tsx --format esm,cjs --dts --clean --external react --external react-dom && node ../../scripts/copy-file.mjs src/styles.css dist/styles.css"
|
|
22
22
|
},
|
|
23
23
|
"dependencies": {
|
|
24
|
-
"@leduchai/vmeta-ui-tokens": "0.1.
|
|
24
|
+
"@leduchai/vmeta-ui-tokens": "0.1.4"
|
|
25
25
|
},
|
|
26
26
|
"peerDependencies": {
|
|
27
27
|
"react": ">=18 <20",
|