wok-ui-ext 0.1.0 → 0.1.1
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/menu/index.d.ts +3 -0
- package/dist/menu/index.js +7 -0
- package/dist/menu/style.css +2 -2
- package/dist/menu/types.d.ts +2 -0
- package/package.json +1 -1
package/dist/menu/index.d.ts
CHANGED
package/dist/menu/index.js
CHANGED
|
@@ -7,6 +7,9 @@ import './style.css';
|
|
|
7
7
|
* 垂直菜单,支持多级嵌套、图标、折叠模式。
|
|
8
8
|
* 适用于侧边栏导航。
|
|
9
9
|
*
|
|
10
|
+
* 菜单宽度默认 240px,可通过构造参数 `width` 指定(数字,单位 px),
|
|
11
|
+
* 或直接覆写 CSS 变量 `--wok-ui-ext-menu-width` 调整。
|
|
12
|
+
*
|
|
10
13
|
* @example
|
|
11
14
|
* ```ts
|
|
12
15
|
* const menu = new Menu({
|
|
@@ -31,6 +34,10 @@ export class Menu extends DivModule {
|
|
|
31
34
|
this.nodes = [];
|
|
32
35
|
if (opts.collapsed)
|
|
33
36
|
this.el.classList.add('wok-ui-ext-menu-collapsed');
|
|
37
|
+
// 指定宽度时写入 CSS 变量,供样式使用(默认 240px)
|
|
38
|
+
if (opts.width) {
|
|
39
|
+
this.el.style.setProperty('--wok-ui-ext-menu-width', `${opts.width}px`);
|
|
40
|
+
}
|
|
34
41
|
const ctx = {
|
|
35
42
|
selectedKey: opts.selectedKey,
|
|
36
43
|
collapsed: opts.collapsed ?? false,
|
package/dist/menu/style.css
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
.wok-ui-ext-menu {
|
|
2
2
|
background: var(--bg-card);
|
|
3
|
-
width: 240px;
|
|
3
|
+
width: var(--wok-ui-ext-menu-width, 240px);
|
|
4
4
|
display: flex;
|
|
5
5
|
flex-direction: column;
|
|
6
6
|
transition: width 0.25s ease;
|
|
@@ -86,7 +86,7 @@
|
|
|
86
86
|
padding-left: 48px;
|
|
87
87
|
}
|
|
88
88
|
.wok-ui-ext-menu.wok-ui-ext-menu-collapsed {
|
|
89
|
-
width: 56px;
|
|
89
|
+
width: var(--wok-ui-ext-menu-collapsed-width, 56px);
|
|
90
90
|
}
|
|
91
91
|
.wok-ui-ext-menu.wok-ui-ext-menu-collapsed .wok-ui-ext-menu-item {
|
|
92
92
|
justify-content: center;
|
package/dist/menu/types.d.ts
CHANGED