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.
Files changed (32) hide show
  1. package/CHANGELOG.md +22 -0
  2. package/dist/es/components/index.mjs +1 -1
  3. package/dist/es/components/src/card/card.vue_vue_type_script_setup_true_vapor_true_lang.mjs +39 -32
  4. package/dist/es/components/src/card/index.d.ts +3 -0
  5. package/dist/es/components/src/card/types.d.ts +5 -0
  6. package/dist/es/components/src/carousel/carousel.vue_vue_type_script_setup_true_vapor_true_lang.mjs +6 -6
  7. package/dist/es/components/src/carousel/index.d.ts +1 -1
  8. package/dist/es/components/src/carousel/types.d.ts +2 -2
  9. package/dist/es/components/src/menu/index.d.ts +5 -0
  10. package/dist/es/components/src/menu/menu.vue_vue_type_script_setup_true_vapor_true_lang.mjs +42 -27
  11. package/dist/es/components/src/menu/sub-menu.vue_vue_type_script_setup_true_vapor_true_lang.mjs +87 -85
  12. package/dist/es/components/src/menu/types.d.ts +12 -1
  13. package/dist/es/components/src/modal/index.d.ts +1 -0
  14. package/dist/es/components/src/modal/modal.vue_vue_type_script_setup_true_vapor_true_lang.mjs +95 -89
  15. package/dist/es/components/src/modal/types.d.ts +4 -0
  16. package/dist/es/components/src/tree/index.d.ts +4 -3
  17. package/dist/es/components/src/tree/node.d.ts +9 -1
  18. package/dist/es/components/src/tree/node.vue_vue_type_script_setup_true_vapor_true_lang.mjs +42 -29
  19. package/dist/es/components/src/tree/tree.d.ts +2 -2
  20. package/dist/es/components/src/tree/tree.vue_vue_type_script_setup_true_vapor_true_lang.mjs +81 -74
  21. package/dist/es/components/src/tree/types.d.ts +14 -2
  22. package/dist/es/core/components.mjs +70 -70
  23. package/dist/es/core/index.mjs +63 -63
  24. package/dist/es/theme/components/card.scss +3 -1
  25. package/dist/es/theme/components/form.scss +1 -0
  26. package/dist/es/theme/components/menu.scss +14 -11
  27. package/dist/es/theme/components/modal.scss +18 -1
  28. package/dist/es/theme/components/tree.scss +53 -7
  29. package/dist/json/vetur-attributes.json +35 -2
  30. package/dist/json/vetur-tags.json +12 -3
  31. package/dist/json/web-types.json +85 -4
  32. 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/text.vue.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, setText as d, template as f, toDisplayString as p, unref as m } from "vue";
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 h = f("<div>"), g = f(" "), _ = f("<div><div></div>"), v = f("<div><div>", 1), y = /*@__PURE__*/ o({
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
- bodyStyle: {}
14
+ bordered: { type: Boolean },
15
+ bodyStyle: {},
16
+ titleProps: {}
15
17
  },
16
- setup(o, { slots: f }) {
17
- let y = e("card"), b = v(), x = n(b, 1);
18
+ setup(o, { slots: d }) {
19
+ let g = e("card"), _ = h(), v = n(_, 1);
18
20
  return s(() => {
19
- let e = m(y);
20
- c(b, [e.b(), e.m(o.shadow)]);
21
- }), l(b, 0, 0), i(() => f.image, () => {
22
- let e = h();
23
- return s(() => c(e, [m(y).e("image")])), l(e, null, 0), a("image"), e;
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(x, [m(y).e("body")]), u(x, o.bodyStyle);
26
- }), l(x, null, 0), i(() => f.title || o.title || f.expand, () => {
27
- let e = _(), u = n(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 = m(y);
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, { bar: () => o.bar }, () => {
32
- let e = g();
33
- return s(() => d(e, p(o.title))), e;
34
- })), l(e, null, 1), i(() => f.expand, () => {
35
- let e = h();
36
- return s(() => c(e, [m(y).e("expand")])), l(e, null, 0), a("expand"), e;
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(x, null, 1), i(() => f.subtitle, () => {
39
- let e = h();
40
- return s(() => c(e, [m(y).e("subtitle")])), l(e, null, 0), a("subtitle"), e;
41
- }), l(x, null, 2), i(() => f.default, () => {
42
- let e = h();
43
- return s(() => c(e, [m(y).e("content")])), l(e, null, 0), a(), e;
44
- }), l(x, null, 3), i(() => f.footer, () => {
45
- let e = h();
46
- return s(() => c(e, [m(y).e("footer")])), l(e, null, 0), a("footer"), e;
47
- }), b;
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 { y as default };
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
  /** 自定义卡片内容 */
@@ -18,7 +18,7 @@ var D = /*@__PURE__*/ u({
18
18
  items: { default: () => [] },
19
19
  autoplay: { type: Boolean },
20
20
  speed: { default: 2e3 },
21
- card: { type: Boolean },
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.card) D.value--, D.value < 0 && (D.value = 0), console.log(D.value), N();
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.card) D.value++, D.value > d.items.length - 1 && (D.value = d.items.length - 1), console.log(D.value), N();
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.card ? (D.value = e, N()) : O(e);
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.card ? N() : j(), I();
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.card, () => {
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
- card?: boolean | undefined;
13
+ solid?: boolean | undefined;
14
14
  showArrow?: boolean | undefined;
15
15
  indicator?: boolean | undefined;
16
16
  indicatorPosition?: "top" | "bottom" | "left" | "right" | "outside" | undefined;
@@ -13,8 +13,8 @@ export interface CarouselProps {
13
13
  * @default 3000
14
14
  */
15
15
  speed?: number;
16
- /** 是否显示为卡片样式 */
17
- card?: boolean;
16
+ /** 是否显示为3D样式 */
17
+ solid?: boolean;
18
18
  /** 是否显示切换箭头 */
19
19
  showArrow?: boolean;
20
20
  /** 是否显示指示器 */
@@ -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(() => ({ width: _.collapsed ? e(_.collapsedWidth) : e(_.width) })), D = b(c, "activeKey"), O = b(c, "openKeys"), k = (e, t) => {
30
- D.value = e, w("itemClick", e, t);
31
- }, A = (e) => {
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
- O.value = [e];
47
+ k.value = [e];
34
48
  return;
35
49
  }
36
- O.value = [...O.value, e];
37
- }, j = (e) => {
38
- O.value = O.value.toSpliced(O.value.indexOf(e), 1);
39
- }, { collapsed: M, collapsedWidth: N } = v(_), P = d(!1), F = d(void 0), I = (e) => {
40
- F.value = e;
41
- }, L = x("menuRef");
42
- n(L, (e) => {
43
- e[0].contentRect.width === N.value ? P.value = !0 : P.value = !1;
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: M,
46
- collapsedWidth: N,
47
- activeKey: D,
48
- itemClick: k,
49
- openKeys: O,
50
- setOpenKey: A,
51
- removeOpenKey: j,
52
- isCollapsed: P,
53
- activePopoverKey: F,
54
- setActivePopoverKey: I
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 R = C();
71
+ let z = C();
57
72
  return f(() => {
58
- p(R, [y(T).b()]), g(R, E.value);
59
- }), m(R, null, 0), o(y(r), { $: [() => ({
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(R, L, null, "menuRef"), R;
80
+ }), h(z, R, null, "menuRef"), z;
66
81
  }
67
82
  });
68
83
  //#endregion
@@ -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 a, menuLevelContextKey as o, subMenuContextKey as s } from "./types.mjs";
10
- import { child as c, computed as l, createComponent as u, createIf as d, createInvoker as f, createSlot as p, createTemplateRefSetter as te, defineVaporComponent as m, delegateEvents as h, inject as g, next as _, on as v, onMounted as y, provide as b, ref as x, renderEffect as S, setClass as C, setInsertionState as w, setText as T, template as E, toDisplayString as D, unref as O, useTemplateRef as k, watch as A } from "vue";
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 j = E("<div><div></div>"), M = E("<div>"), N = E(" "), ne = E("<div><div></div><div></div>"), re = E("<div><div></div><div>"), ie = E("<div><div>"), ae = E("<div>", 1);
13
- h("click", "mouseover");
14
- var P = /*@__PURE__*/ m({
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(m, { slots: h }) {
24
- let E = m, P = e("menu"), F = k("subMenuRef"), I = g(a, void 0), L = g(s, void 0), R = g(o, void 0), z = l(() => E.ignoreLevel ? 1 : R ? R.level.value + 1 : 1), B = x(!1), V = x(/* @__PURE__ */ new Set()), oe = () => {
25
- I?.collapsed.value || (B.value = !B.value, B.value ? I?.setOpenKey(E.name) : I?.removeOpenKey(E.name));
26
- }, H = l(() => {
27
- let e = I?.activeKey.value;
28
- return e != null && V.value.has(e);
29
- }), U = k("popoverRef"), W = (e) => {
30
- e ? U.value?.show() : (U.value?.hide(), L?.notifyChildPopoverClose(E.name));
31
- }, G = () => {
32
- W(!1);
33
- }, K = null, q = x(!1), J = x(void 0), Y = () => {
34
- K &&= (clearTimeout(K), null);
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
- Y(), K = setTimeout(() => {
37
- W(!1), K = null;
36
+ X(), q = setTimeout(() => {
37
+ G(!1), q = null;
38
38
  }, 150);
39
- }, X = () => {
40
- J.value === void 0 && (q.value || se());
39
+ }, Z = () => {
40
+ Y.value === void 0 && (J.value || se());
41
41
  }, ce = () => {
42
- Y(), L?.cancelParentClose();
42
+ X(), R?.cancelParentClose();
43
43
  }, le = (e) => {
44
- J.value === e && (J.value = void 0, X());
44
+ Y.value === e && (Y.value = void 0, Z());
45
45
  }, ue = () => {
46
- I?.isCollapsed.value && (q.value = !0, Y(), W(!0), L ? (L.setActiveChildPopoverKey(E.name), L.cancelParentClose()) : I?.setActivePopoverKey(E.name));
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
- I?.isCollapsed.value && (q.value = !1, X());
49
- }, Z = () => {
50
- q.value = !0, Y(), L?.cancelParentClose();
48
+ L?.isCollapsed.value && (J.value = !1, Z());
51
49
  }, fe = () => {
52
- q.value = !1, X();
50
+ J.value = !0, X(), R?.cancelParentClose();
51
+ }, pe = () => {
52
+ J.value = !1, Z();
53
53
  };
54
- A(H, (e) => {
55
- e && !B.value && (B.value = !0, I?.setOpenKey(E.name));
56
- }), A(l(() => L ? L.activeChildPopoverKey.value : I?.activePopoverKey.value), (e) => {
57
- I?.isCollapsed.value && e !== void 0 && e !== E.name && W(!1);
58
- }), A(() => I?.openKeys.value || [], (e) => {
59
- e && e.length > 0 && (B.value = e.includes(E.name));
60
- }, { immediate: !0 }), y(() => {
61
- F.value?.style.setProperty("--s-menu-level", `${z.value}`), L?.registerDescendant(E.name);
62
- }), b(o, { level: z }), b(s, {
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
- V.value.add(e), L?.registerDescendant(e);
64
+ H.value.add(e), R?.registerDescendant(e);
65
65
  },
66
- outsideClick: G,
67
- activeChildPopoverKey: J,
66
+ outsideClick: K,
67
+ activeChildPopoverKey: Y,
68
68
  setActiveChildPopoverKey: (e) => {
69
- J.value = e;
69
+ Y.value = e;
70
70
  },
71
71
  notifyChildPopoverClose: le,
72
72
  cancelParentClose: ce
73
73
  });
74
- let Q = te(), $ = ae();
75
- return S(() => {
76
- let e = O(P);
77
- C($, [
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", m.disabled),
80
- e.is("collapse", O(I)?.isCollapsed.value)
79
+ e.is("disabled", p.disabled),
80
+ e.is("collapse", E(L)?.isCollapsed.value)
81
81
  ]);
82
- }), w($, null, 0), d(() => O(I)?.isCollapsed.value, () => {
83
- let e = u(O(i), {
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: () => G
87
+ onClickOutside: () => K
88
88
  }, {
89
89
  content: () => {
90
- let e = M();
91
- return S(() => C(e, [O(P).e("pop-content")])), w(e, null, 0), p(), v(e, "mouseenter", Z), v(e, "mouseleave", fe), e;
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: () => d(() => z.value === 1, () => {
94
- let e = j(), t = c(e);
95
- return S(() => {
96
- let n = O(P);
97
- C(e, [n.e("sub-title"), n.is("active", H.value)]), C(t, [n.e("sub-icon")]);
98
- }), w(t, null, 0), p("icon"), e;
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 = ne(), t = c(e, 1), r = _(t, 2);
101
- return S(() => {
102
- let t = O(P);
103
- C(e, [t.e("sub-title"), t.is("active", H.value)]);
104
- }), w(e, 0, 0), d(() => h.icon, () => {
105
- let e = M();
106
- return S(() => C(e, [O(P).e("sub-icon")])), w(e, null, 0), p("icon"), e;
107
- }), S(() => C(t, [O(P).e("sub-label")])), w(t, null, 0), p("title", null, () => {
108
- let e = N();
109
- return S(() => T(e, D(m.title))), e;
110
- }), S(() => C(r, [O(P).e("sub-arrow")])), w(r, null, 0), u(O(n)), e;
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, U, null, "popoverRef"), e;
115
+ return Q(e, W, null, "popoverRef"), e;
114
116
  }, () => {
115
- let e = re(), n = c(e, 1), i = _(n, 2);
116
- return S(() => {
117
- let t = O(P);
118
- C(e, [t.e("sub-title"), t.is("active", H.value)]);
119
- }), w(e, 0, 0), d(() => h.icon, () => {
120
- let e = M();
121
- return S(() => C(e, [O(P).e("sub-icon")])), w(e, null, 0), p("icon"), e;
122
- }), S(() => C(n, [O(P).e("sub-label")])), w(n, null, 0), p("title", null, () => {
123
- let e = N();
124
- return S(() => T(e, D(m.title))), e;
125
- }), S(() => C(i, [O(P).e("sub-arrow")])), w(i, null, 0), d(() => B.value, () => u(O(r)), () => u(O(t)), 1285), e.$evtclick = f(oe), [e, u(O(ee), { type: "height" }, () => d(() => B.value, () => {
126
- let e = ie(), t = c(e);
127
- return S(() => C(t, [O(P).e("sub-content")])), w(t, null, 0), p(), e;
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 = f(ue), v($, "mouseleave", de), Q($, F, null, "subMenuRef"), $;
131
+ }, 777), $.$evtmouseover = d(ue), _($, "mouseleave", de), Q($, I, null, "subMenuRef"), $;
130
132
  }
131
133
  });
132
134
  //#endregion
133
- export { P as default };
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;