savor-ui 0.17.0 → 0.19.0
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/CHANGELOG.md +22 -0
- package/dist/es/components/index.mjs +1 -1
- package/dist/es/components/src/card/card.vue_vue_type_script_setup_true_vapor_true_lang.mjs +39 -32
- package/dist/es/components/src/card/index.d.ts +3 -0
- package/dist/es/components/src/card/types.d.ts +5 -0
- package/dist/es/components/src/carousel/carousel.vue_vue_type_script_setup_true_vapor_true_lang.mjs +6 -6
- package/dist/es/components/src/carousel/index.d.ts +1 -1
- package/dist/es/components/src/carousel/types.d.ts +2 -2
- package/dist/es/components/src/menu/index.d.ts +5 -0
- package/dist/es/components/src/menu/menu.vue_vue_type_script_setup_true_vapor_true_lang.mjs +42 -27
- package/dist/es/components/src/menu/sub-menu.vue_vue_type_script_setup_true_vapor_true_lang.mjs +87 -85
- package/dist/es/components/src/menu/types.d.ts +12 -1
- package/dist/es/components/src/modal/index.d.ts +1 -0
- package/dist/es/components/src/modal/modal.vue_vue_type_script_setup_true_vapor_true_lang.mjs +95 -89
- package/dist/es/components/src/modal/types.d.ts +4 -0
- package/dist/es/components/src/tree/index.d.ts +4 -3
- package/dist/es/components/src/tree/node.d.ts +9 -1
- package/dist/es/components/src/tree/node.vue_vue_type_script_setup_true_vapor_true_lang.mjs +42 -29
- package/dist/es/components/src/tree/tree.d.ts +2 -2
- package/dist/es/components/src/tree/tree.vue_vue_type_script_setup_true_vapor_true_lang.mjs +81 -74
- package/dist/es/components/src/tree/types.d.ts +14 -2
- package/dist/es/core/components.mjs +70 -70
- package/dist/es/core/index.mjs +63 -63
- package/dist/es/theme/components/card.scss +3 -1
- package/dist/es/theme/components/form.scss +1 -0
- package/dist/es/theme/components/menu.scss +14 -11
- package/dist/es/theme/components/modal.scss +18 -1
- package/dist/es/theme/components/tree.scss +53 -7
- package/dist/json/vetur-attributes.json +35 -2
- package/dist/json/vetur-tags.json +12 -3
- package/dist/json/web-types.json +85 -4
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,28 @@
|
|
|
2
2
|
|
|
3
3
|
|
|
4
4
|
|
|
5
|
+
# [0.19.0](https://gitee.com/mach552/savor-ui/compare/v0.18.0...v0.19.0) (2026-08-09)
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
### Bug Fixes
|
|
9
|
+
|
|
10
|
+
* **menu:** 修复弹层菜单无样式变量的问题 ([96a315a](https://gitee.com/mach552/savor-ui/commits/96a315a59f06ab072835b14e6addb35ad60dcd1b))
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
### Features
|
|
14
|
+
|
|
15
|
+
* **card:** 新增边框属性 ([7842ba8](https://gitee.com/mach552/savor-ui/commits/7842ba8774566893065f4ae9f3adac02a38cc506))
|
|
16
|
+
* **card:** 新增标题文本属性 ([fa5c634](https://gitee.com/mach552/savor-ui/commits/fa5c6342a7ae74c7801d061c545a381441e22136))
|
|
17
|
+
|
|
18
|
+
# [0.18.0](https://gitee.com/mach552/savor-ui/compare/v0.17.0...v0.18.0) (2026-08-08)
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
### Features
|
|
22
|
+
|
|
23
|
+
* **menu:** 新增样式颜色属性 ([a2dd967](https://gitee.com/mach552/savor-ui/commits/a2dd9678707ac3c9eb3631ecf0ac92c42f5d8a3f))
|
|
24
|
+
* **modal:** 新增类型和图标 ([7973598](https://gitee.com/mach552/savor-ui/commits/797359852caed0d019a3f86ed24379104030ccd3))
|
|
25
|
+
* **tree:** 新增节点图标和额外内容插槽 ([b3f7953](https://gitee.com/mach552/savor-ui/commits/b3f79533fbeb4c589c74dbc4e240b1bb336489cb))
|
|
26
|
+
|
|
5
27
|
# [0.17.0](https://gitee.com/mach552/savor-ui/compare/v0.16.0...v0.17.0) (2026-08-07)
|
|
6
28
|
|
|
7
29
|
|
|
@@ -15,6 +15,7 @@ import "./src/auto-complete/index.mjs";
|
|
|
15
15
|
import "./src/avatar/index.mjs";
|
|
16
16
|
import "./src/badge/index.mjs";
|
|
17
17
|
import "./src/button/index.mjs";
|
|
18
|
+
import "./src/text/index.mjs";
|
|
18
19
|
import "./src/card/index.mjs";
|
|
19
20
|
import "./src/carousel/index.mjs";
|
|
20
21
|
import "./src/empty/index.mjs";
|
|
@@ -78,7 +79,6 @@ import "./src/table/types.mjs";
|
|
|
78
79
|
import "./src/table/index.mjs";
|
|
79
80
|
import "./src/tabs/types.mjs";
|
|
80
81
|
import "./src/tabs/index.mjs";
|
|
81
|
-
import "./src/text/index.mjs";
|
|
82
82
|
import "./src/textarea/index.mjs";
|
|
83
83
|
import "./src/timeline/types.mjs";
|
|
84
84
|
import "./src/timeline/index.mjs";
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { useNamespace as e } from "../../../hooks/src/use-namespace.mjs";
|
|
2
2
|
import "../../../hooks/index.mjs";
|
|
3
|
-
import t from "../text/
|
|
4
|
-
import { child as n, createComponent as r, createIf as i, createSlot as a, defineVaporComponent as o, renderEffect as s, setClass as c, setInsertionState as l, setStyle as u,
|
|
3
|
+
import { SText as t } from "../text/index.mjs";
|
|
4
|
+
import { child as n, createComponent as r, createIf as i, createSlot as a, defineVaporComponent as o, renderEffect as s, setClass as c, setInsertionState as l, setStyle as u, template as d, unref as f } from "vue";
|
|
5
5
|
//#region ../components/src/card/card.vue?vue&type=script&setup=true&vapor=true&lang.ts
|
|
6
|
-
var
|
|
6
|
+
var p = d("<div>"), m = d("<div><div></div>"), h = d("<div><div>", 1), g = /*@__PURE__*/ o({
|
|
7
7
|
name: "SCard",
|
|
8
8
|
__name: "card",
|
|
9
9
|
props: {
|
|
@@ -11,41 +11,48 @@ var h = f("<div>"), g = f(" "), _ = f("<div><div></div>"), v = f("<div><div>", 1
|
|
|
11
11
|
subtitle: {},
|
|
12
12
|
bar: { type: Boolean },
|
|
13
13
|
shadow: { default: "never" },
|
|
14
|
-
|
|
14
|
+
bordered: { type: Boolean },
|
|
15
|
+
bodyStyle: {},
|
|
16
|
+
titleProps: {}
|
|
15
17
|
},
|
|
16
|
-
setup(o, { slots:
|
|
17
|
-
let
|
|
18
|
+
setup(o, { slots: d }) {
|
|
19
|
+
let g = e("card"), _ = h(), v = n(_, 1);
|
|
18
20
|
return s(() => {
|
|
19
|
-
let e =
|
|
20
|
-
c(
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
21
|
+
let e = f(g);
|
|
22
|
+
c(_, [
|
|
23
|
+
e.b(),
|
|
24
|
+
e.m(o.shadow),
|
|
25
|
+
{ [e.m("bordered")]: o.bordered }
|
|
26
|
+
]);
|
|
27
|
+
}), l(_, 0, 0), i(() => d.image, () => {
|
|
28
|
+
let e = p();
|
|
29
|
+
return s(() => c(e, [f(g).e("image")])), l(e, null, 0), a("image"), e;
|
|
24
30
|
}), s(() => {
|
|
25
|
-
c(
|
|
26
|
-
}), l(
|
|
27
|
-
let e =
|
|
31
|
+
c(v, [f(g).e("body")]), u(v, o.bodyStyle);
|
|
32
|
+
}), l(v, null, 0), i(() => d.title || o.title || d.expand, () => {
|
|
33
|
+
let e = m(), u = n(e);
|
|
28
34
|
return s(() => {
|
|
29
|
-
let t =
|
|
35
|
+
let t = f(g);
|
|
30
36
|
c(e, [t.e("header")]), c(u, [t.e("title")]);
|
|
31
|
-
}), l(u, null, 0), a("title", null, () => r(t, {
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
+
}), l(u, null, 0), a("title", null, () => r(f(t), { $: [() => ({
|
|
38
|
+
bar: o.bar,
|
|
39
|
+
label: o.title,
|
|
40
|
+
...o.titleProps
|
|
41
|
+
})] })), l(e, null, 1), i(() => d.expand, () => {
|
|
42
|
+
let e = p();
|
|
43
|
+
return s(() => c(e, [f(g).e("expand")])), l(e, null, 0), a("expand"), e;
|
|
37
44
|
}), e;
|
|
38
|
-
}), l(
|
|
39
|
-
let e =
|
|
40
|
-
return s(() => c(e, [
|
|
41
|
-
}), l(
|
|
42
|
-
let e =
|
|
43
|
-
return s(() => c(e, [
|
|
44
|
-
}), l(
|
|
45
|
-
let e =
|
|
46
|
-
return s(() => c(e, [
|
|
47
|
-
}),
|
|
45
|
+
}), l(v, null, 1), i(() => d.subtitle, () => {
|
|
46
|
+
let e = p();
|
|
47
|
+
return s(() => c(e, [f(g).e("subtitle")])), l(e, null, 0), a("subtitle"), e;
|
|
48
|
+
}), l(v, null, 2), i(() => d.default, () => {
|
|
49
|
+
let e = p();
|
|
50
|
+
return s(() => c(e, [f(g).e("content")])), l(e, null, 0), a(), e;
|
|
51
|
+
}), l(v, null, 3), i(() => d.footer, () => {
|
|
52
|
+
let e = p();
|
|
53
|
+
return s(() => c(e, [f(g).e("footer")])), l(e, null, 0), a("footer"), e;
|
|
54
|
+
}), _;
|
|
48
55
|
}
|
|
49
56
|
});
|
|
50
57
|
//#endregion
|
|
51
|
-
export {
|
|
58
|
+
export { g as default };
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { CardSlots } from './types';
|
|
2
2
|
import { PublicProps, VNode, Plugin } from 'vue';
|
|
3
|
+
import { TextProps } from '../text';
|
|
3
4
|
export declare const SCard: ((__VLS_props: NonNullable<Awaited<typeof __VLS_setup>>["props"], __VLS_ctx?: {
|
|
4
5
|
attrs: any;
|
|
5
6
|
slots: CardSlots;
|
|
@@ -10,7 +11,9 @@ export declare const SCard: ((__VLS_props: NonNullable<Awaited<typeof __VLS_setu
|
|
|
10
11
|
subtitle?: string | undefined;
|
|
11
12
|
bar?: boolean | undefined;
|
|
12
13
|
shadow?: "always" | "hover" | "never" | undefined;
|
|
14
|
+
bordered?: boolean | undefined;
|
|
13
15
|
bodyStyle?: Record<string, string> | undefined;
|
|
16
|
+
titleProps?: TextProps | undefined;
|
|
14
17
|
} & (typeof globalThis extends {
|
|
15
18
|
__VLS_PROPS_FALLBACK: infer P;
|
|
16
19
|
} ? P : {});
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { TextProps } from '../text';
|
|
1
2
|
export interface CardProps {
|
|
2
3
|
/** 卡片标题 */
|
|
3
4
|
title?: string;
|
|
@@ -7,8 +8,12 @@ export interface CardProps {
|
|
|
7
8
|
bar?: boolean;
|
|
8
9
|
/** 卡片阴影 */
|
|
9
10
|
shadow?: "always" | "hover" | "never";
|
|
11
|
+
/** 卡片边框 */
|
|
12
|
+
bordered?: boolean;
|
|
10
13
|
/** 卡片内容区域样式 */
|
|
11
14
|
bodyStyle?: Record<string, string>;
|
|
15
|
+
/** 卡片标题属性 */
|
|
16
|
+
titleProps?: TextProps;
|
|
12
17
|
}
|
|
13
18
|
export interface CardSlots {
|
|
14
19
|
/** 自定义卡片内容 */
|
package/dist/es/components/src/carousel/carousel.vue_vue_type_script_setup_true_vapor_true_lang.mjs
CHANGED
|
@@ -18,7 +18,7 @@ var D = /*@__PURE__*/ u({
|
|
|
18
18
|
items: { default: () => [] },
|
|
19
19
|
autoplay: { type: Boolean },
|
|
20
20
|
speed: { default: 2e3 },
|
|
21
|
-
|
|
21
|
+
solid: { type: Boolean },
|
|
22
22
|
showArrow: { type: Boolean },
|
|
23
23
|
indicator: {
|
|
24
24
|
type: Boolean,
|
|
@@ -34,13 +34,13 @@ var D = /*@__PURE__*/ u({
|
|
|
34
34
|
let d = u, f = t("carousel"), b = C("listRef"), D = S(u, "modelValue"), O = (e) => {
|
|
35
35
|
b.value && (b.value.style.transform = `translateX(-${e * 100}%)`, b.value.style.transition = "transform 0.3s"), D.value = e;
|
|
36
36
|
}, k = () => {
|
|
37
|
-
if (d.
|
|
37
|
+
if (d.solid) D.value--, D.value < 0 && (D.value = 0), console.log(D.value), N();
|
|
38
38
|
else {
|
|
39
39
|
if (!b.value) return;
|
|
40
40
|
D.value === 0 ? (b.value.style.transition = "none", b.value.style.transform = `translateX(-${d.items.length * 100}%)`, b.value.offsetHeight, O(d.items.length - 1)) : O(D.value - 1);
|
|
41
41
|
}
|
|
42
42
|
}, A = () => {
|
|
43
|
-
if (d.
|
|
43
|
+
if (d.solid) D.value++, D.value > d.items.length - 1 && (D.value = d.items.length - 1), console.log(D.value), N();
|
|
44
44
|
else {
|
|
45
45
|
if (!b.value) return;
|
|
46
46
|
D.value === d.items.length - 1 ? (b.value.style.transition = "none", b.value.style.transform = "translateX(100%)", b.value.offsetHeight, O(0)) : O(D.value + 1);
|
|
@@ -62,14 +62,14 @@ var D = /*@__PURE__*/ u({
|
|
|
62
62
|
n.style.zIndex = String(l);
|
|
63
63
|
}
|
|
64
64
|
}, P = (e) => {
|
|
65
|
-
d.
|
|
65
|
+
d.solid ? (D.value = e, N()) : O(e);
|
|
66
66
|
}, F = null, I = () => {
|
|
67
67
|
d.autoplay && (F = setInterval(() => {
|
|
68
68
|
A();
|
|
69
69
|
}, d.speed));
|
|
70
70
|
};
|
|
71
71
|
p(() => {
|
|
72
|
-
d.
|
|
72
|
+
d.solid ? N() : j(), I();
|
|
73
73
|
}), m(() => {
|
|
74
74
|
clearInterval(F);
|
|
75
75
|
});
|
|
@@ -77,7 +77,7 @@ var D = /*@__PURE__*/ u({
|
|
|
77
77
|
return h(() => {
|
|
78
78
|
let t = x(f), n = u.indicatorPosition;
|
|
79
79
|
g(R, [t.b(), { [t.m("indicator-position-" + n)]: n === "outside" }]), y(R, { height: x(e)(u.height) }), g(z, [t.e("wrapper")]);
|
|
80
|
-
}), _(z, null, 0), s(() => u.
|
|
80
|
+
}), _(z, null, 0), s(() => u.solid, () => {
|
|
81
81
|
let e = T();
|
|
82
82
|
return h(() => g(e, [x(f).e("list-3d")])), _(e, null, 0), o(() => u.items, (e, t) => {
|
|
83
83
|
let n = w(), r = i(n);
|
|
@@ -10,7 +10,7 @@ export declare const SCarousel: ((__VLS_props: NonNullable<Awaited<typeof __VLS_
|
|
|
10
10
|
items: string[];
|
|
11
11
|
autoplay?: boolean | undefined;
|
|
12
12
|
speed?: number | undefined;
|
|
13
|
-
|
|
13
|
+
solid?: boolean | undefined;
|
|
14
14
|
showArrow?: boolean | undefined;
|
|
15
15
|
indicator?: boolean | undefined;
|
|
16
16
|
indicatorPosition?: "top" | "bottom" | "left" | "right" | "outside" | undefined;
|
|
@@ -55,6 +55,11 @@ export declare const SMenu: ((__VLS_props: NonNullable<Awaited<typeof __VLS_setu
|
|
|
55
55
|
selectedKey?: string | undefined;
|
|
56
56
|
accordion?: boolean | undefined;
|
|
57
57
|
scrollbarProps?: ScrollbarProps | undefined;
|
|
58
|
+
bgColor?: string | undefined;
|
|
59
|
+
textColor?: string | undefined;
|
|
60
|
+
activeTextColor?: string | undefined;
|
|
61
|
+
activeBgColor?: string | undefined;
|
|
62
|
+
hoverBgColor?: string | undefined;
|
|
58
63
|
activeKey?: string | number | undefined;
|
|
59
64
|
onItemClick?: ((name: string | number, item: any) => any) | undefined;
|
|
60
65
|
onOpenChange?: ((keys: string[]) => any) | undefined;
|
|
@@ -17,7 +17,12 @@ var S = _("<div>"), C = _("<div>", 1), w = /*@__PURE__*/ c({
|
|
|
17
17
|
openKeys: {},
|
|
18
18
|
selectedKey: {},
|
|
19
19
|
accordion: { type: Boolean },
|
|
20
|
-
scrollbarProps: {}
|
|
20
|
+
scrollbarProps: {},
|
|
21
|
+
bgColor: { default: "var(--s-color-bg-1)" },
|
|
22
|
+
textColor: { default: "var(--s-color-text-1)" },
|
|
23
|
+
activeTextColor: { default: "var(--s-color-primary-6)" },
|
|
24
|
+
activeBgColor: { default: "var(--s-color-primary-1)" },
|
|
25
|
+
hoverBgColor: { default: "var(--s-color-fill-2)" }
|
|
21
26
|
}, {
|
|
22
27
|
activeKey: {},
|
|
23
28
|
activeKeyModifiers: {},
|
|
@@ -26,43 +31,53 @@ var S = _("<div>"), C = _("<div>", 1), w = /*@__PURE__*/ c({
|
|
|
26
31
|
}),
|
|
27
32
|
emits: /*@__PURE__*/ l(["itemClick", "openChange"], ["update:activeKey", "update:openKeys"]),
|
|
28
33
|
setup(c, { emit: l }) {
|
|
29
|
-
let _ = c, w = l, T = t("menu"), E = a(() => ({
|
|
30
|
-
|
|
31
|
-
|
|
34
|
+
let _ = c, w = l, T = t("menu"), E = a(() => ({
|
|
35
|
+
"--s-menu-bg-color": _.bgColor,
|
|
36
|
+
"--s-menu-text-color": _.textColor,
|
|
37
|
+
"--s-menu-active-text-color": _.activeTextColor,
|
|
38
|
+
"--s-menu-active-bg-color": _.activeBgColor,
|
|
39
|
+
"--s-menu-hover-bg-color": _.hoverBgColor
|
|
40
|
+
})), D = a(() => ({
|
|
41
|
+
...E.value,
|
|
42
|
+
width: _.collapsed ? e(_.collapsedWidth) : e(_.width)
|
|
43
|
+
})), O = b(c, "activeKey"), k = b(c, "openKeys"), A = (e, t) => {
|
|
44
|
+
O.value = e, w("itemClick", e, t);
|
|
45
|
+
}, j = (e) => {
|
|
32
46
|
if (_.accordion) {
|
|
33
|
-
|
|
47
|
+
k.value = [e];
|
|
34
48
|
return;
|
|
35
49
|
}
|
|
36
|
-
|
|
37
|
-
},
|
|
38
|
-
|
|
39
|
-
}, { collapsed:
|
|
40
|
-
|
|
41
|
-
},
|
|
42
|
-
n(
|
|
43
|
-
e[0].contentRect.width ===
|
|
50
|
+
k.value = [...k.value, e];
|
|
51
|
+
}, M = (e) => {
|
|
52
|
+
k.value = k.value.toSpliced(k.value.indexOf(e), 1);
|
|
53
|
+
}, { collapsed: N, collapsedWidth: P } = v(_), F = d(!1), I = d(void 0), L = (e) => {
|
|
54
|
+
I.value = e;
|
|
55
|
+
}, R = x("menuRef");
|
|
56
|
+
n(R, (e) => {
|
|
57
|
+
e[0].contentRect.width === P.value ? F.value = !0 : F.value = !1;
|
|
44
58
|
}), u(i, {
|
|
45
|
-
collapsed:
|
|
46
|
-
collapsedWidth:
|
|
47
|
-
activeKey:
|
|
48
|
-
itemClick:
|
|
49
|
-
openKeys:
|
|
50
|
-
setOpenKey:
|
|
51
|
-
removeOpenKey:
|
|
52
|
-
isCollapsed:
|
|
53
|
-
activePopoverKey:
|
|
54
|
-
setActivePopoverKey:
|
|
59
|
+
collapsed: N,
|
|
60
|
+
collapsedWidth: P,
|
|
61
|
+
activeKey: O,
|
|
62
|
+
itemClick: A,
|
|
63
|
+
openKeys: k,
|
|
64
|
+
setOpenKey: j,
|
|
65
|
+
removeOpenKey: M,
|
|
66
|
+
isCollapsed: F,
|
|
67
|
+
activePopoverKey: I,
|
|
68
|
+
setActivePopoverKey: L,
|
|
69
|
+
menuColorStyle: E
|
|
55
70
|
});
|
|
56
|
-
let
|
|
71
|
+
let z = C();
|
|
57
72
|
return f(() => {
|
|
58
|
-
p(
|
|
59
|
-
}), m(
|
|
73
|
+
p(z, [y(T).b()]), g(z, D.value);
|
|
74
|
+
}), m(z, null, 0), o(y(r), { $: [() => ({
|
|
60
75
|
padding: "4px",
|
|
61
76
|
...c.scrollbarProps
|
|
62
77
|
})] }, () => {
|
|
63
78
|
let e = S();
|
|
64
79
|
return f(() => p(e, [y(T).e("content")])), m(e, null, 0), s(), e;
|
|
65
|
-
}), h(
|
|
80
|
+
}), h(z, R, null, "menuRef"), z;
|
|
66
81
|
}
|
|
67
82
|
});
|
|
68
83
|
//#endregion
|
package/dist/es/components/src/menu/sub-menu.vue_vue_type_script_setup_true_vapor_true_lang.mjs
CHANGED
|
@@ -6,12 +6,12 @@ import r from "../../../icons/src/up.vue.mjs";
|
|
|
6
6
|
import "../../../icons/index.mjs";
|
|
7
7
|
import { SPopover as i } from "../popover/index.mjs";
|
|
8
8
|
import { STransition as ee } from "../transition/index.mjs";
|
|
9
|
-
import { menuContextKey as
|
|
10
|
-
import { child as
|
|
9
|
+
import { menuContextKey as te, menuLevelContextKey as a, subMenuContextKey as o } from "./types.mjs";
|
|
10
|
+
import { child as s, computed as c, createComponent as l, createIf as u, createInvoker as d, createSlot as f, createTemplateRefSetter as ne, defineVaporComponent as p, delegateEvents as m, inject as h, next as g, on as _, onMounted as re, provide as v, ref as y, renderEffect as b, setClass as x, setInsertionState as S, setStyle as ie, setText as C, template as w, toDisplayString as T, unref as E, useTemplateRef as D, watch as O } from "vue";
|
|
11
11
|
//#region ../components/src/menu/sub-menu.vue?vue&type=script&setup=true&vapor=true&lang.ts
|
|
12
|
-
var
|
|
13
|
-
|
|
14
|
-
var
|
|
12
|
+
var ae = w("<div><div></div>"), k = w("<div>"), A = w(" "), j = w("<div><div></div><div></div>"), M = w("<div><div></div><div>"), N = w("<div><div>"), P = w("<div>", 1);
|
|
13
|
+
m("click", "mouseover");
|
|
14
|
+
var F = /*@__PURE__*/ p({
|
|
15
15
|
name: "SSubMenu",
|
|
16
16
|
__name: "sub-menu",
|
|
17
17
|
props: {
|
|
@@ -20,114 +20,116 @@ var P = /*@__PURE__*/ m({
|
|
|
20
20
|
disabled: { type: Boolean },
|
|
21
21
|
ignoreLevel: { type: Boolean }
|
|
22
22
|
},
|
|
23
|
-
setup(
|
|
24
|
-
let
|
|
25
|
-
|
|
26
|
-
},
|
|
27
|
-
let e =
|
|
28
|
-
return e != null &&
|
|
29
|
-
}),
|
|
30
|
-
e ?
|
|
31
|
-
},
|
|
32
|
-
|
|
33
|
-
},
|
|
34
|
-
|
|
23
|
+
setup(p, { slots: m }) {
|
|
24
|
+
let w = p, F = e("menu"), I = D("subMenuRef"), L = h(te, void 0), R = h(o, void 0), z = h(a, void 0), B = c(() => w.ignoreLevel ? 1 : z ? z.level.value + 1 : 1), V = y(!1), H = y(/* @__PURE__ */ new Set()), oe = () => {
|
|
25
|
+
L?.collapsed.value || (V.value = !V.value, V.value ? L?.setOpenKey(w.name) : L?.removeOpenKey(w.name));
|
|
26
|
+
}, U = c(() => {
|
|
27
|
+
let e = L?.activeKey.value;
|
|
28
|
+
return e != null && H.value.has(e);
|
|
29
|
+
}), W = D("popoverRef"), G = (e) => {
|
|
30
|
+
e ? W.value?.show() : (W.value?.hide(), R?.notifyChildPopoverClose(w.name));
|
|
31
|
+
}, K = () => {
|
|
32
|
+
G(!1);
|
|
33
|
+
}, q = null, J = y(!1), Y = y(void 0), X = () => {
|
|
34
|
+
q &&= (clearTimeout(q), null);
|
|
35
35
|
}, se = () => {
|
|
36
|
-
|
|
37
|
-
|
|
36
|
+
X(), q = setTimeout(() => {
|
|
37
|
+
G(!1), q = null;
|
|
38
38
|
}, 150);
|
|
39
|
-
},
|
|
40
|
-
|
|
39
|
+
}, Z = () => {
|
|
40
|
+
Y.value === void 0 && (J.value || se());
|
|
41
41
|
}, ce = () => {
|
|
42
|
-
|
|
42
|
+
X(), R?.cancelParentClose();
|
|
43
43
|
}, le = (e) => {
|
|
44
|
-
|
|
44
|
+
Y.value === e && (Y.value = void 0, Z());
|
|
45
45
|
}, ue = () => {
|
|
46
|
-
|
|
46
|
+
L?.isCollapsed.value && (J.value = !0, X(), G(!0), R ? (R.setActiveChildPopoverKey(w.name), R.cancelParentClose()) : L?.setActivePopoverKey(w.name));
|
|
47
47
|
}, de = () => {
|
|
48
|
-
|
|
49
|
-
}, Z = () => {
|
|
50
|
-
q.value = !0, Y(), L?.cancelParentClose();
|
|
48
|
+
L?.isCollapsed.value && (J.value = !1, Z());
|
|
51
49
|
}, fe = () => {
|
|
52
|
-
|
|
50
|
+
J.value = !0, X(), R?.cancelParentClose();
|
|
51
|
+
}, pe = () => {
|
|
52
|
+
J.value = !1, Z();
|
|
53
53
|
};
|
|
54
|
-
|
|
55
|
-
e && !
|
|
56
|
-
}),
|
|
57
|
-
|
|
58
|
-
}),
|
|
59
|
-
e && e.length > 0 && (
|
|
60
|
-
}, { immediate: !0 }),
|
|
61
|
-
|
|
62
|
-
}),
|
|
54
|
+
O(U, (e) => {
|
|
55
|
+
e && !V.value && (V.value = !0, L?.setOpenKey(w.name));
|
|
56
|
+
}), O(c(() => R ? R.activeChildPopoverKey.value : L?.activePopoverKey.value), (e) => {
|
|
57
|
+
L?.isCollapsed.value && e !== void 0 && e !== w.name && G(!1);
|
|
58
|
+
}), O(() => L?.openKeys.value || [], (e) => {
|
|
59
|
+
e && e.length > 0 && (V.value = e.includes(w.name));
|
|
60
|
+
}, { immediate: !0 }), re(() => {
|
|
61
|
+
I.value?.style.setProperty("--s-menu-level", `${B.value}`), R?.registerDescendant(w.name);
|
|
62
|
+
}), v(a, { level: B }), v(o, {
|
|
63
63
|
registerDescendant: (e) => {
|
|
64
|
-
|
|
64
|
+
H.value.add(e), R?.registerDescendant(e);
|
|
65
65
|
},
|
|
66
|
-
outsideClick:
|
|
67
|
-
activeChildPopoverKey:
|
|
66
|
+
outsideClick: K,
|
|
67
|
+
activeChildPopoverKey: Y,
|
|
68
68
|
setActiveChildPopoverKey: (e) => {
|
|
69
|
-
|
|
69
|
+
Y.value = e;
|
|
70
70
|
},
|
|
71
71
|
notifyChildPopoverClose: le,
|
|
72
72
|
cancelParentClose: ce
|
|
73
73
|
});
|
|
74
|
-
let Q =
|
|
75
|
-
return
|
|
76
|
-
let e =
|
|
77
|
-
|
|
74
|
+
let Q = ne(), $ = P();
|
|
75
|
+
return b(() => {
|
|
76
|
+
let e = E(F);
|
|
77
|
+
x($, [
|
|
78
78
|
e.e("sub-menu"),
|
|
79
|
-
e.is("disabled",
|
|
80
|
-
e.is("collapse",
|
|
79
|
+
e.is("disabled", p.disabled),
|
|
80
|
+
e.is("collapse", E(L)?.isCollapsed.value)
|
|
81
81
|
]);
|
|
82
|
-
}),
|
|
83
|
-
let e =
|
|
82
|
+
}), S($, null, 0), u(() => E(L)?.isCollapsed.value, () => {
|
|
83
|
+
let e = l(E(i), {
|
|
84
84
|
manual: "",
|
|
85
85
|
placement: "right-start",
|
|
86
86
|
offset: [0, 8],
|
|
87
|
-
onClickOutside: () =>
|
|
87
|
+
onClickOutside: () => K
|
|
88
88
|
}, {
|
|
89
89
|
content: () => {
|
|
90
|
-
let e =
|
|
91
|
-
return
|
|
90
|
+
let e = k();
|
|
91
|
+
return b(() => {
|
|
92
|
+
x(e, [E(F).e("pop-content")]), ie(e, E(L)?.menuColorStyle.value);
|
|
93
|
+
}), S(e, null, 0), f(), _(e, "mouseenter", fe), _(e, "mouseleave", pe), e;
|
|
92
94
|
},
|
|
93
|
-
default: () =>
|
|
94
|
-
let e =
|
|
95
|
-
return
|
|
96
|
-
let n =
|
|
97
|
-
|
|
98
|
-
}),
|
|
95
|
+
default: () => u(() => B.value === 1, () => {
|
|
96
|
+
let e = ae(), t = s(e);
|
|
97
|
+
return b(() => {
|
|
98
|
+
let n = E(F);
|
|
99
|
+
x(e, [n.e("sub-title"), n.is("active", U.value)]), x(t, [n.e("sub-icon")]);
|
|
100
|
+
}), S(t, null, 0), f("icon"), e;
|
|
99
101
|
}, () => {
|
|
100
|
-
let e =
|
|
101
|
-
return
|
|
102
|
-
let t =
|
|
103
|
-
|
|
104
|
-
}),
|
|
105
|
-
let e =
|
|
106
|
-
return
|
|
107
|
-
}),
|
|
108
|
-
let e =
|
|
109
|
-
return
|
|
110
|
-
}),
|
|
102
|
+
let e = j(), t = s(e, 1), r = g(t, 2);
|
|
103
|
+
return b(() => {
|
|
104
|
+
let t = E(F);
|
|
105
|
+
x(e, [t.e("sub-title"), t.is("active", U.value)]);
|
|
106
|
+
}), S(e, 0, 0), u(() => m.icon, () => {
|
|
107
|
+
let e = k();
|
|
108
|
+
return b(() => x(e, [E(F).e("sub-icon")])), S(e, null, 0), f("icon"), e;
|
|
109
|
+
}), b(() => x(t, [E(F).e("sub-label")])), S(t, null, 0), f("title", null, () => {
|
|
110
|
+
let e = A();
|
|
111
|
+
return b(() => C(e, T(p.title))), e;
|
|
112
|
+
}), b(() => x(r, [E(F).e("sub-arrow")])), S(r, null, 0), l(E(n)), e;
|
|
111
113
|
}, 389)
|
|
112
114
|
});
|
|
113
|
-
return Q(e,
|
|
115
|
+
return Q(e, W, null, "popoverRef"), e;
|
|
114
116
|
}, () => {
|
|
115
|
-
let e =
|
|
116
|
-
return
|
|
117
|
-
let t =
|
|
118
|
-
|
|
119
|
-
}),
|
|
120
|
-
let e =
|
|
121
|
-
return
|
|
122
|
-
}),
|
|
123
|
-
let e =
|
|
124
|
-
return
|
|
125
|
-
}),
|
|
126
|
-
let e =
|
|
127
|
-
return
|
|
117
|
+
let e = M(), n = s(e, 1), i = g(n, 2);
|
|
118
|
+
return b(() => {
|
|
119
|
+
let t = E(F);
|
|
120
|
+
x(e, [t.e("sub-title"), t.is("active", U.value)]);
|
|
121
|
+
}), S(e, 0, 0), u(() => m.icon, () => {
|
|
122
|
+
let e = k();
|
|
123
|
+
return b(() => x(e, [E(F).e("sub-icon")])), S(e, null, 0), f("icon"), e;
|
|
124
|
+
}), b(() => x(n, [E(F).e("sub-label")])), S(n, null, 0), f("title", null, () => {
|
|
125
|
+
let e = A();
|
|
126
|
+
return b(() => C(e, T(p.title))), e;
|
|
127
|
+
}), b(() => x(i, [E(F).e("sub-arrow")])), S(i, null, 0), u(() => V.value, () => l(E(r)), () => l(E(t)), 1285), e.$evtclick = d(oe), [e, l(E(ee), { type: "height" }, () => u(() => V.value, () => {
|
|
128
|
+
let e = N(), t = s(e);
|
|
129
|
+
return b(() => x(t, [E(F).e("sub-content")])), S(t, null, 0), f(), e;
|
|
128
130
|
}, null, 129))];
|
|
129
|
-
}, 777), $.$evtmouseover =
|
|
131
|
+
}, 777), $.$evtmouseover = d(ue), _($, "mouseleave", de), Q($, I, null, "subMenuRef"), $;
|
|
130
132
|
}
|
|
131
133
|
});
|
|
132
134
|
//#endregion
|
|
133
|
-
export {
|
|
135
|
+
export { F as default };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { InjectionKey, Ref } from 'vue';
|
|
1
|
+
import { ComputedRef, InjectionKey, Ref } from 'vue';
|
|
2
2
|
import { ScrollbarProps } from '../scrollbar';
|
|
3
3
|
export interface MenuProps {
|
|
4
4
|
/** 是否折叠 */
|
|
@@ -15,6 +15,16 @@ export interface MenuProps {
|
|
|
15
15
|
accordion?: boolean;
|
|
16
16
|
/** 滚动条属性 */
|
|
17
17
|
scrollbarProps?: ScrollbarProps;
|
|
18
|
+
/** 背景颜色 */
|
|
19
|
+
bgColor?: string;
|
|
20
|
+
/** 文本颜色 */
|
|
21
|
+
textColor?: string;
|
|
22
|
+
/** 选中文本颜色 */
|
|
23
|
+
activeTextColor?: string;
|
|
24
|
+
/** 选中背景颜色 */
|
|
25
|
+
activeBgColor?: string;
|
|
26
|
+
/** 鼠标悬停背景颜色 */
|
|
27
|
+
hoverBgColor?: string;
|
|
18
28
|
}
|
|
19
29
|
export interface MenuSlots {
|
|
20
30
|
/** 默认 */
|
|
@@ -93,6 +103,7 @@ export interface MenuContext {
|
|
|
93
103
|
isCollapsed: Ref<boolean>;
|
|
94
104
|
activePopoverKey: Ref<string | number | undefined>;
|
|
95
105
|
setActivePopoverKey: (name: string | number) => void;
|
|
106
|
+
menuColorStyle: ComputedRef<Record<string, string>>;
|
|
96
107
|
}
|
|
97
108
|
export declare const menuContextKey: InjectionKey<MenuContext>;
|
|
98
109
|
export interface SubMenuContext {
|
|
@@ -27,6 +27,7 @@ export declare const SModal: ((__VLS_props: NonNullable<Awaited<typeof __VLS_set
|
|
|
27
27
|
mask?: boolean | undefined;
|
|
28
28
|
to?: (string | HTMLElement) | undefined;
|
|
29
29
|
draggable?: boolean | undefined;
|
|
30
|
+
type?: "default" | "warning" | "primary" | "info" | "success" | "danger" | undefined;
|
|
30
31
|
className?: string | undefined;
|
|
31
32
|
modalStyle?: Record<string, string> | undefined;
|
|
32
33
|
maskStyle?: Record<string, string> | undefined;
|