savor-ui 0.4.1 → 0.5.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 +14 -0
- package/dist/es/components/index.d.ts +1 -0
- package/dist/es/components/index.mjs +1 -0
- package/dist/es/components/src/expand-card/expand-card.d.ts +23 -0
- package/dist/es/components/src/expand-card/expand-card.vue.mjs +5 -0
- package/dist/es/components/src/expand-card/expand-card.vue_vue_type_script_setup_true_vapor_true_lang.mjs +121 -0
- package/dist/es/components/src/expand-card/index.d.ts +27 -0
- package/dist/es/components/src/expand-card/index.mjs +7 -0
- package/dist/es/components/src/expand-card/types.d.ts +34 -0
- package/dist/es/components/src/icon/icon.vue_vue_type_script_setup_true_vapor_true_lang.mjs +24 -12
- package/dist/es/components/src/icon/index.d.ts +3 -0
- package/dist/es/components/src/icon/types.d.ts +8 -0
- package/dist/es/components/src/menu/index.d.ts +1 -1
- package/dist/es/components/src/menu/menu-item.vue_vue_type_script_setup_true_vapor_true_lang.mjs +5 -3
- package/dist/es/components/src/menu/types.d.ts +1 -1
- package/dist/es/components/src/tree/tree.vue_vue_type_script_setup_true_vapor_true_lang.mjs +57 -53
- package/dist/es/core/components.mjs +46 -44
- package/dist/es/core/index.mjs +45 -44
- package/dist/es/icons/src/loading.vue.mjs +1 -1
- package/dist/es/theme/common/reset.scss +10 -0
- package/dist/es/theme/components/expand-card.scss +26 -0
- package/dist/es/theme/components/icon.scss +125 -0
- package/dist/es/theme/components/index.scss +1 -0
- package/dist/es/theme/components/loading-icon.scss +6 -6
- package/dist/es/theme/components/menu.scss +6 -1
- package/dist/es/utils/index.d.ts +2 -2
- package/dist/es/utils/index.mjs +2 -2
- package/dist/es/utils/src/nodes.d.ts +1 -0
- package/dist/es/utils/src/nodes.mjs +23 -0
- package/dist/es/utils/src/theme/themeMap.mjs +5 -5
- package/dist/json/vetur-attributes.json +33 -0
- package/dist/json/vetur-tags.json +14 -1
- package/dist/json/web-types.json +90 -2
- package/package.json +1 -1
- package/dist/es/utils/src/vnodes.d.ts +0 -7
- package/dist/es/utils/src/vnodes.mjs +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,20 @@
|
|
|
2
2
|
|
|
3
3
|
|
|
4
4
|
|
|
5
|
+
# [0.5.0](https://gitee.com/mach552/savor-ui/compare/v0.4.1...v0.5.0) (2026-06-19)
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
### Bug Fixes
|
|
9
|
+
|
|
10
|
+
* **tree:** 修复容器高度计算错误问题 ([a769600](https://gitee.com/mach552/savor-ui/commits/a769600d9771ccfe5e75ff1cd6ea15559ab733bd))
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
### Features
|
|
14
|
+
|
|
15
|
+
* **expand-card:** 新增展开卡片组件 ([2bf0bda](https://gitee.com/mach552/savor-ui/commits/2bf0bdaa7d21f550089c83c62c549acbc2762d90))
|
|
16
|
+
* **icon:** 新增动画和加载效果 ([6cab674](https://gitee.com/mach552/savor-ui/commits/6cab674844a32cf45d01b6a19a6f463d4bcd89ca))
|
|
17
|
+
* **menu:** 新增`circle`激活样式 ([30ca3ed](https://gitee.com/mach552/savor-ui/commits/30ca3ede06a2d3b93094179643a90d7215c9eef5))
|
|
18
|
+
|
|
5
19
|
## [0.4.1](https://gitee.com/mach552/savor-ui/compare/v0.4.0...v0.4.1) (2026-06-17)
|
|
6
20
|
|
|
7
21
|
|
|
@@ -21,6 +21,7 @@ export * from './src/divider';
|
|
|
21
21
|
export * from './src/drawer';
|
|
22
22
|
export * from './src/dropdown';
|
|
23
23
|
export * from './src/empty';
|
|
24
|
+
export * from './src/expand-card';
|
|
24
25
|
export * from './src/form';
|
|
25
26
|
export * from './src/galleria';
|
|
26
27
|
export * from './src/grid';
|
|
@@ -38,6 +38,7 @@ import "./src/divider/index.mjs";
|
|
|
38
38
|
import "./src/drawer/index.mjs";
|
|
39
39
|
import "./src/dropdown/types.mjs";
|
|
40
40
|
import "./src/dropdown/index.mjs";
|
|
41
|
+
import "./src/expand-card/index.mjs";
|
|
41
42
|
import "./src/galleria/index.mjs";
|
|
42
43
|
import "./src/grid/types.mjs";
|
|
43
44
|
import "./src/grid/index.mjs";
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { ExpandCardExpose, ExpandCardProps, ExpandCardSlots } from './types';
|
|
2
|
+
import { PublicProps, ShallowUnwrapRef, VNode } from 'vue';
|
|
3
|
+
declare const __VLS_export: (__VLS_props: NonNullable<Awaited<typeof __VLS_setup>>["props"], __VLS_ctx?: __VLS_PrettifyLocal<Pick<NonNullable<Awaited<typeof __VLS_setup>>, "attrs" | "emit" | "slots">>, __VLS_exposed?: NonNullable<Awaited<typeof __VLS_setup>>["expose"], __VLS_setup?: Promise<{
|
|
4
|
+
props: PublicProps & __VLS_PrettifyLocal<ExpandCardProps & {
|
|
5
|
+
onOpened?: (() => any) | undefined;
|
|
6
|
+
onClosed?: (() => any) | undefined;
|
|
7
|
+
}> & (typeof globalThis extends {
|
|
8
|
+
__VLS_PROPS_FALLBACK: infer P;
|
|
9
|
+
} ? P : {});
|
|
10
|
+
expose: (exposed: ShallowUnwrapRef<ExpandCardExpose>) => void;
|
|
11
|
+
attrs: any;
|
|
12
|
+
slots: ExpandCardSlots;
|
|
13
|
+
emit: ((evt: "opened") => void) & ((evt: "closed") => void);
|
|
14
|
+
}>) => VNode & {
|
|
15
|
+
__ctx?: Awaited<typeof __VLS_setup>;
|
|
16
|
+
};
|
|
17
|
+
declare const _default: typeof __VLS_export;
|
|
18
|
+
export default _default;
|
|
19
|
+
type __VLS_PrettifyLocal<T> = (T extends any ? {
|
|
20
|
+
[K in keyof T]: T[K];
|
|
21
|
+
} : {
|
|
22
|
+
[K in keyof T as K]: T[K];
|
|
23
|
+
}) & {};
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
import { getElementFromBlock as e } from "../../../utils/src/nodes.mjs";
|
|
2
|
+
import "../../../utils/index.mjs";
|
|
3
|
+
import { useNamespace as t } from "../../../hooks/src/use-namespace.mjs";
|
|
4
|
+
import { useZIndex as n } from "../../../hooks/src/use-zIndex.mjs";
|
|
5
|
+
import "../../../hooks/index.mjs";
|
|
6
|
+
import { VaporTeleport as r, child as i, computed as a, createComponent as o, createDynamicComponent as s, createIf as c, createInvoker as l, createSlot as u, createTemplateRefSetter as d, defineVaporComponent as f, delegateEvents as p, nextTick as m, onBeforeUnmount as h, onMounted as g, ref as _, renderEffect as v, setClass as y, setInsertionState as b, setStyle as x, template as S, unref as C, useId as w, useSlots as T, useTemplateRef as ee } from "vue";
|
|
7
|
+
//#region ../components/src/expand-card/expand-card.vue?vue&type=script&setup=true&vapor=true&lang.ts
|
|
8
|
+
var E = S("<div>"), D = S("<div><div>");
|
|
9
|
+
p("click");
|
|
10
|
+
var O = /*@__PURE__*/ f({
|
|
11
|
+
name: "SExpandCard",
|
|
12
|
+
__name: "expand-card",
|
|
13
|
+
props: {
|
|
14
|
+
item: {},
|
|
15
|
+
duration: { default: 500 },
|
|
16
|
+
showMask: {
|
|
17
|
+
type: Boolean,
|
|
18
|
+
default: !0
|
|
19
|
+
},
|
|
20
|
+
targetHeight: { default: "auto" },
|
|
21
|
+
targetWidth: { default: "50%" },
|
|
22
|
+
placeholderClassName: {}
|
|
23
|
+
},
|
|
24
|
+
emits: ["opened", "closed"],
|
|
25
|
+
__multiRoot: !0,
|
|
26
|
+
setup(f, { expose: p, emit: S }) {
|
|
27
|
+
let O = f, k = S, A = t("expand-card"), j = T(), M = "expand-card-" + w(), { nextZIndex: N } = n(), P = _(0), F = _(!1), I = _(!1), L = _(""), R = _(!1), z = ee("modelRef"), B = A.is("expanded", !0), V = null, H = null, U = null, W = null, G = a(() => {
|
|
28
|
+
let e = O.duration;
|
|
29
|
+
return typeof e == "number" ? [e, e] : e;
|
|
30
|
+
}), K = (e, t) => {
|
|
31
|
+
if (typeof e == "number") return e;
|
|
32
|
+
let n = String(e).trim();
|
|
33
|
+
return n.endsWith("%") ? t * parseFloat(n) / 100 : parseFloat(n) || 0;
|
|
34
|
+
}, q = (e) => `width ${e}ms cubic-bezier(0.22,1,0.36,1), height ${e}ms cubic-bezier(0.22,1,0.36,1), top ${e}ms cubic-bezier(0.22,1,0.36,1), left ${e}ms cubic-bezier(0.22,1,0.36,1), border-radius ${e}ms ease, box-shadow ${e}ms ease`, J = () => {
|
|
35
|
+
H &&= (clearTimeout(H), null);
|
|
36
|
+
}, Y = (e) => {
|
|
37
|
+
e.style.transition = "", e.style.position = "", e.style.width = "", e.style.height = "", e.style.top = "", e.style.left = "", e.style.zIndex = "", e.style.borderRadius = "";
|
|
38
|
+
}, X = (e) => {
|
|
39
|
+
let t = K(O.targetWidth, window.innerWidth), n, r = O.targetHeight;
|
|
40
|
+
if (r === "auto" || r === "" || r == null) {
|
|
41
|
+
let r = e.style.width, i = e.style.height;
|
|
42
|
+
e.style.width = t + "px", e.style.height = "auto", n = e.scrollHeight, e.style.width = r, e.style.height = i, e.offsetHeight;
|
|
43
|
+
} else n = K(r, window.innerHeight);
|
|
44
|
+
return {
|
|
45
|
+
w: t,
|
|
46
|
+
h: n
|
|
47
|
+
};
|
|
48
|
+
}, Z = async () => {
|
|
49
|
+
if (R.value || F.value) return;
|
|
50
|
+
let e = V;
|
|
51
|
+
if (!e) return;
|
|
52
|
+
let t = e.getBoundingClientRect(), [n] = G.value;
|
|
53
|
+
R.value = !0, P.value = N(), e.classList.add(B), await m();
|
|
54
|
+
let r = z.value;
|
|
55
|
+
if (!r) {
|
|
56
|
+
R.value = !1, e.classList.remove(B);
|
|
57
|
+
return;
|
|
58
|
+
}
|
|
59
|
+
r.style.transition = "none", r.style.position = "fixed", r.style.width = t.width + "px", r.style.height = t.height + "px", r.style.top = t.top + "px", r.style.left = t.left + "px", r.style.zIndex = String(N()), r.style.borderRadius = "12px", r.offsetHeight, U = requestAnimationFrame(() => {
|
|
60
|
+
U = null;
|
|
61
|
+
let { w: e, h: t } = X(r), i = (window.innerWidth - e) / 2, a = (window.innerHeight - t) / 2;
|
|
62
|
+
r.offsetHeight, L.value = `opacity ${n}ms ease`, I.value = !0, r.style.transition = q(n), r.style.width = e + "px", r.style.height = t + "px", r.style.top = a + "px", r.style.left = i + "px", r.style.borderRadius = "16px";
|
|
63
|
+
}), J(), H = setTimeout(() => {
|
|
64
|
+
H = null, R.value = !1, F.value = !0, k("opened");
|
|
65
|
+
}, n);
|
|
66
|
+
}, Q = () => {
|
|
67
|
+
if (R.value || !F.value) return;
|
|
68
|
+
let e = V, t = z.value;
|
|
69
|
+
if (!e || !t) return;
|
|
70
|
+
R.value = !0;
|
|
71
|
+
let [, n] = G.value;
|
|
72
|
+
L.value = `opacity ${n}ms ease`, I.value = !1;
|
|
73
|
+
let r = e.getBoundingClientRect();
|
|
74
|
+
t.style.transition = q(n), t.style.width = r.width + "px", t.style.height = r.height + "px", t.style.top = r.top + "px", t.style.left = r.left + "px", t.style.borderRadius = "12px", J(), H = setTimeout(() => {
|
|
75
|
+
H = null, R.value = !1, F.value = !1, e.classList.remove(B), k("closed");
|
|
76
|
+
}, n);
|
|
77
|
+
}, $ = () => {
|
|
78
|
+
W && cancelAnimationFrame(W), W = requestAnimationFrame(() => {
|
|
79
|
+
if (W = null, !F.value || R.value) return;
|
|
80
|
+
let e = z.value;
|
|
81
|
+
if (!e) return;
|
|
82
|
+
let { w: t, h: n } = X(e);
|
|
83
|
+
e.style.transition = "none", e.style.width = t + "px", e.style.height = n + "px", e.style.top = (window.innerHeight - n) / 2 + "px", e.style.left = (window.innerWidth - t) / 2 + "px";
|
|
84
|
+
});
|
|
85
|
+
}, te = a(() => {
|
|
86
|
+
let t = j.default?.();
|
|
87
|
+
if (!t) return null;
|
|
88
|
+
let n = e(t);
|
|
89
|
+
return n ? (V !== n && (V?.removeEventListener("click", Z), n.addEventListener("click", Z), n.id = M, V = n), n) : null;
|
|
90
|
+
});
|
|
91
|
+
g(() => {
|
|
92
|
+
window.addEventListener("resize", $);
|
|
93
|
+
}), h(() => {
|
|
94
|
+
window.removeEventListener("resize", $), U && cancelAnimationFrame(U), W && cancelAnimationFrame(W), J(), V &&= (V.removeEventListener("click", Z), V.classList.remove(B), null);
|
|
95
|
+
let e = z.value;
|
|
96
|
+
e && Y(e);
|
|
97
|
+
}), p({
|
|
98
|
+
open: Z,
|
|
99
|
+
close: Q
|
|
100
|
+
});
|
|
101
|
+
let ne = d();
|
|
102
|
+
return [s(() => te.value), o(r, { to: "body" }, () => c(() => F.value || R.value, () => {
|
|
103
|
+
let e = D(), t = i(e, 1);
|
|
104
|
+
return v(() => y(e, [C(A).e("wrapper")])), b(e, 0, 0), c(() => f.showMask && (F.value || R.value), () => {
|
|
105
|
+
let e = E();
|
|
106
|
+
return e.$evtclick = l(Q), v(() => {
|
|
107
|
+
let t = I.value;
|
|
108
|
+
y(e, [C(A).e("mask")]), x(e, {
|
|
109
|
+
zIndex: P.value,
|
|
110
|
+
opacity: +!!t,
|
|
111
|
+
transition: L.value,
|
|
112
|
+
pointerEvents: t ? "auto" : "none",
|
|
113
|
+
backgroundColor: "rgba(0, 0, 0, 0)"
|
|
114
|
+
});
|
|
115
|
+
}), e;
|
|
116
|
+
}), v(() => y(t, [C(A).e("model")])), b(t, null, 0), u("model", { item: () => f.item }), ne(t, z, null, "modelRef"), e;
|
|
117
|
+
}, null, 129))];
|
|
118
|
+
}
|
|
119
|
+
});
|
|
120
|
+
//#endregion
|
|
121
|
+
export { O as default };
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { ExpandCardSlots, ExpandCardExpose } from './types';
|
|
2
|
+
import { PublicProps, ShallowUnwrapRef, VNode, Plugin } from 'vue';
|
|
3
|
+
export declare const SExpandCard: ((__VLS_props: NonNullable<Awaited<typeof __VLS_setup>>["props"], __VLS_ctx?: {
|
|
4
|
+
attrs: any;
|
|
5
|
+
slots: ExpandCardSlots;
|
|
6
|
+
emit: ((evt: "opened") => void) & ((evt: "closed") => void);
|
|
7
|
+
}, __VLS_exposed?: NonNullable<Awaited<typeof __VLS_setup>>["expose"], __VLS_setup?: Promise<{
|
|
8
|
+
props: PublicProps & {
|
|
9
|
+
item?: any;
|
|
10
|
+
duration?: number | [number, number] | undefined;
|
|
11
|
+
showMask?: boolean | undefined;
|
|
12
|
+
targetHeight?: number | string | undefined;
|
|
13
|
+
targetWidth?: number | string | undefined;
|
|
14
|
+
placeholderClassName?: string | undefined;
|
|
15
|
+
onOpened?: (() => any) | undefined;
|
|
16
|
+
onClosed?: (() => any) | undefined;
|
|
17
|
+
} & (typeof globalThis extends {
|
|
18
|
+
__VLS_PROPS_FALLBACK: infer P;
|
|
19
|
+
} ? P : {});
|
|
20
|
+
expose: (exposed: ShallowUnwrapRef<ExpandCardExpose>) => void;
|
|
21
|
+
attrs: any;
|
|
22
|
+
slots: ExpandCardSlots;
|
|
23
|
+
emit: ((evt: "opened") => void) & ((evt: "closed") => void);
|
|
24
|
+
}>) => VNode & {
|
|
25
|
+
__ctx?: Awaited<typeof __VLS_setup>;
|
|
26
|
+
}) & Plugin;
|
|
27
|
+
export * from './types';
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
export interface ExpandCardProps {
|
|
2
|
+
/** 卡片数据 */
|
|
3
|
+
item?: any;
|
|
4
|
+
/** 动画时长,单位毫秒,number表示展开和收起的时长相同,[number, number]表示展开和收起的时长 */
|
|
5
|
+
duration?: number | [number, number];
|
|
6
|
+
/** 是否显示遮罩 */
|
|
7
|
+
showMask?: boolean;
|
|
8
|
+
/** 展开高度,支持 number | string(如 460 / '460px' / '80%' / 'auto' / '') */
|
|
9
|
+
targetHeight?: number | string;
|
|
10
|
+
/** 展开宽度,支持 number | string(如 600 / '600px' / '80%') */
|
|
11
|
+
targetWidth?: number | string;
|
|
12
|
+
/** 占位元素类名 */
|
|
13
|
+
placeholderClassName?: string;
|
|
14
|
+
}
|
|
15
|
+
export interface ExpandCardSlots {
|
|
16
|
+
/** 默认插槽,只支持传入一个元素 */
|
|
17
|
+
default?: () => any;
|
|
18
|
+
/** 展开的内容 */
|
|
19
|
+
model?: (props: {
|
|
20
|
+
item: any;
|
|
21
|
+
}) => any;
|
|
22
|
+
}
|
|
23
|
+
export interface ExpandCardEmits {
|
|
24
|
+
/** 开始展开 */
|
|
25
|
+
opened: [];
|
|
26
|
+
/** 结束展开 */
|
|
27
|
+
closed: [];
|
|
28
|
+
}
|
|
29
|
+
export interface ExpandCardExpose {
|
|
30
|
+
/** 展开卡片 */
|
|
31
|
+
open: () => void;
|
|
32
|
+
/** 收起卡片 */
|
|
33
|
+
close: () => void;
|
|
34
|
+
}
|
|
@@ -2,24 +2,36 @@ import { getSize as e } from "../../../utils/src/tool.mjs";
|
|
|
2
2
|
import "../../../utils/index.mjs";
|
|
3
3
|
import { useNamespace as t } from "../../../hooks/src/use-namespace.mjs";
|
|
4
4
|
import "../../../hooks/index.mjs";
|
|
5
|
-
import { computed as n,
|
|
5
|
+
import { computed as n, createIf as r, createSlot as i, defineVaporComponent as a, renderEffect as o, setClass as s, setInsertionState as c, setStyle as l, template as u, unref as d } from "vue";
|
|
6
6
|
//#region ../components/src/icon/icon.vue?vue&type=script&setup=true&vapor=true&lang.ts
|
|
7
|
-
var
|
|
7
|
+
var f = u("<div><svg viewBox=\"0 0 24 24\"><circle cx=12 cy=12 r=8>", 1), p = u("<div>", 1), m = /*@__PURE__*/ a({
|
|
8
8
|
name: "SIcon",
|
|
9
9
|
__name: "icon",
|
|
10
10
|
props: {
|
|
11
11
|
size: {},
|
|
12
|
-
color: {}
|
|
12
|
+
color: {},
|
|
13
|
+
anime: { type: Boolean },
|
|
14
|
+
animeType: { default: "shake" },
|
|
15
|
+
loading: { type: Boolean }
|
|
13
16
|
},
|
|
14
|
-
setup(
|
|
15
|
-
let
|
|
16
|
-
fontSize: e(
|
|
17
|
-
color:
|
|
18
|
-
})),
|
|
19
|
-
return
|
|
20
|
-
|
|
21
|
-
|
|
17
|
+
setup(a) {
|
|
18
|
+
let u = a, m = t("icon"), h = n(() => ({
|
|
19
|
+
fontSize: e(u.size),
|
|
20
|
+
color: u.color
|
|
21
|
+
})), g = n(() => u.animeType === "shake" ? m.is("shake", u.anime) : u.animeType === "scale" ? m.is("scale", u.anime) : u.animeType === "moveUp" ? m.is("moveUp", u.anime) : u.animeType === "rotate" ? m.is("rotate", u.anime) : "");
|
|
22
|
+
return r(() => a.loading, () => {
|
|
23
|
+
let e = f();
|
|
24
|
+
return o(() => {
|
|
25
|
+
let t = d(m);
|
|
26
|
+
s(e, [t.b(), t.is("loading", a.loading)]), l(e, h.value);
|
|
27
|
+
}), e;
|
|
28
|
+
}, () => {
|
|
29
|
+
let e = p();
|
|
30
|
+
return o(() => {
|
|
31
|
+
s(e, [d(m).b(), g.value]), l(e, h.value);
|
|
32
|
+
}), c(e, null, 0), i(), e;
|
|
33
|
+
}, 261);
|
|
22
34
|
}
|
|
23
35
|
});
|
|
24
36
|
//#endregion
|
|
25
|
-
export {
|
|
37
|
+
export { m as default };
|
|
@@ -8,6 +8,9 @@ export declare const SIcon: ((__VLS_props: NonNullable<Awaited<typeof __VLS_setu
|
|
|
8
8
|
props: PublicProps & {
|
|
9
9
|
size?: string | number | undefined;
|
|
10
10
|
color?: string | undefined;
|
|
11
|
+
anime?: boolean | undefined;
|
|
12
|
+
animeType?: "shake" | "scale" | "moveUp" | "rotate" | undefined;
|
|
13
|
+
loading?: boolean | undefined;
|
|
11
14
|
} & (typeof globalThis extends {
|
|
12
15
|
__VLS_PROPS_FALLBACK: infer P;
|
|
13
16
|
} ? P : {});
|
|
@@ -3,6 +3,14 @@ export interface IconProps {
|
|
|
3
3
|
size?: string | number;
|
|
4
4
|
/** 图标颜色 */
|
|
5
5
|
color?: string;
|
|
6
|
+
/** 是否开启动画 */
|
|
7
|
+
anime?: boolean;
|
|
8
|
+
/** 动画类型(shake:抖动,scale:缩放,moveUp:上移,rotate:旋转)
|
|
9
|
+
* @default shake
|
|
10
|
+
*/
|
|
11
|
+
animeType?: "shake" | "scale" | "moveUp" | "rotate";
|
|
12
|
+
/** 是否显示加载状态 */
|
|
13
|
+
loading?: boolean;
|
|
6
14
|
}
|
|
7
15
|
export interface IconSlots {
|
|
8
16
|
/** 默认 */
|
|
@@ -28,7 +28,7 @@ export declare const SMenuItem: ((__VLS_props: NonNullable<Awaited<typeof __VLS_
|
|
|
28
28
|
name: string | number;
|
|
29
29
|
title?: string | undefined;
|
|
30
30
|
disabled?: boolean | undefined;
|
|
31
|
-
activePosition?: "left" | "center" | "right" | undefined;
|
|
31
|
+
activePosition?: "left" | "center" | "right" | "circle" | undefined;
|
|
32
32
|
item?: any;
|
|
33
33
|
} & (typeof globalThis extends {
|
|
34
34
|
__VLS_PROPS_FALLBACK: infer P;
|
package/dist/es/components/src/menu/menu-item.vue_vue_type_script_setup_true_vapor_true_lang.mjs
CHANGED
|
@@ -44,7 +44,8 @@ var O = /*@__PURE__*/ u({
|
|
|
44
44
|
t.is("disabled", u.disabled),
|
|
45
45
|
t.is("active", a.value === r && i === "center"),
|
|
46
46
|
t.is("active-left", a.value === r && i === "left"),
|
|
47
|
-
t.is("active-right", a.value === r && i === "right")
|
|
47
|
+
t.is("active-right", a.value === r && i === "right"),
|
|
48
|
+
t.is("active-circle", a.value === r && i === "circle")
|
|
48
49
|
]);
|
|
49
50
|
}), g(e, 0, 0), s(() => d.icon, () => {
|
|
50
51
|
let e = C();
|
|
@@ -61,9 +62,10 @@ var O = /*@__PURE__*/ u({
|
|
|
61
62
|
h(e, [
|
|
62
63
|
t.e("item-title"),
|
|
63
64
|
t.is("disabled", u.disabled),
|
|
64
|
-
t.is("active", a.value === r && i === "center"),
|
|
65
|
+
t.is("active-center", a.value === r && i === "center"),
|
|
65
66
|
t.is("active-left", a.value === r && i === "left"),
|
|
66
|
-
t.is("active-right", a.value === r && i === "right")
|
|
67
|
+
t.is("active-right", a.value === r && i === "right"),
|
|
68
|
+
t.is("active-circle", a.value === r && i === "circle")
|
|
67
69
|
]);
|
|
68
70
|
}), g(e, 0, 0), s(() => d.icon, () => {
|
|
69
71
|
let e = C();
|
|
@@ -2,9 +2,9 @@ import { useNamespace as e } from "../../../hooks/src/use-namespace.mjs";
|
|
|
2
2
|
import "../../../hooks/index.mjs";
|
|
3
3
|
import t from "./node.vue.mjs";
|
|
4
4
|
import { treeContextKey as n } from "./types.mjs";
|
|
5
|
-
import { VaporTransitionGroup as r, computed as i, createComponent as a, createFor as o, defineVaporComponent as s, mergeModels as c,
|
|
5
|
+
import { VaporTransitionGroup as r, computed as i, createComponent as a, createFor as o, defineVaporComponent as s, mergeModels as c, nextTick as l, provide as u, ref as d, renderEffect as f, setClass as p, setInsertionState as m, setStaticTemplateRef as h, setStyle as g, template as _, unref as v, useModel as y, useSlots as b, watch as x } from "vue";
|
|
6
6
|
//#region ../components/src/tree/tree.vue?vue&type=script&setup=true&vapor=true&lang.ts
|
|
7
|
-
var
|
|
7
|
+
var S = _("<div>", 1), C = /*@__PURE__*/ s({
|
|
8
8
|
name: "STree",
|
|
9
9
|
__name: "tree",
|
|
10
10
|
props: /*@__PURE__*/ c({
|
|
@@ -51,15 +51,19 @@ var b = h("<div>", 1), x = /*@__PURE__*/ s({
|
|
|
51
51
|
"update:expandedKeys"
|
|
52
52
|
]),
|
|
53
53
|
setup(s, { emit: c }) {
|
|
54
|
-
let
|
|
55
|
-
|
|
54
|
+
let _ = s, C = c, w = e("tree"), T = y(s, "selectKeys"), E = y(s, "checkedKeys"), D = y(s, "indeterminateKeys"), O = y(s, "expandedKeys"), k = d(), A = d(0), j = async () => {
|
|
55
|
+
await l();
|
|
56
|
+
let e = k.value?.firstElementChild;
|
|
57
|
+
e && (A.value = e.scrollHeight);
|
|
58
|
+
}, M = d([]), N = (e, t) => {
|
|
59
|
+
let { label: n, key: r, children: i } = _.fieldNames, a = (e, t) => e?.length ? e.map((e) => {
|
|
56
60
|
let o = e[i] || [], s = {
|
|
57
61
|
label: e[n],
|
|
58
62
|
key: e[r],
|
|
59
63
|
children: [],
|
|
60
64
|
rawNode: { ...e },
|
|
61
65
|
level: t ? t.level + 1 : 0,
|
|
62
|
-
isLeaf: e.isLeaf ? e.isLeaf :
|
|
66
|
+
isLeaf: e.isLeaf ? e.isLeaf : _.loadMore ? !1 : !o?.length,
|
|
63
67
|
disabled: !!e.disabled,
|
|
64
68
|
parentKey: t?.key
|
|
65
69
|
};
|
|
@@ -67,75 +71,75 @@ var b = h("<div>", 1), x = /*@__PURE__*/ s({
|
|
|
67
71
|
}) : [];
|
|
68
72
|
return Array.isArray(e) ? a(e, t) : [];
|
|
69
73
|
};
|
|
70
|
-
|
|
71
|
-
|
|
74
|
+
x(() => _.data, (e) => {
|
|
75
|
+
M.value = N(e);
|
|
72
76
|
}, { immediate: !0 });
|
|
73
|
-
let
|
|
74
|
-
let e =
|
|
77
|
+
let P = i(() => {
|
|
78
|
+
let e = M.value || [];
|
|
75
79
|
if (e.length === 0) return [];
|
|
76
80
|
let t = [], n = [...e].reverse();
|
|
77
81
|
for (; n.length;) {
|
|
78
82
|
let e = n.pop();
|
|
79
|
-
t.push(e),
|
|
83
|
+
t.push(e), O.value.includes(e.key) && e?.children?.length && n.push(...[...e.children].reverse());
|
|
80
84
|
}
|
|
81
85
|
return t;
|
|
82
86
|
});
|
|
83
|
-
|
|
84
|
-
|
|
87
|
+
x(() => P.value, () => {
|
|
88
|
+
j();
|
|
85
89
|
}, { immediate: !0 });
|
|
86
|
-
let
|
|
87
|
-
|
|
88
|
-
},
|
|
89
|
-
if (!e.children.length && !e.isLeaf && !
|
|
90
|
-
|
|
91
|
-
let t = await
|
|
92
|
-
t?.length && (e.rawNode.children = t, e.children =
|
|
90
|
+
let F = (e) => O.value.includes(e.key), I = (e) => {
|
|
91
|
+
O.value = O.value.filter((t) => t !== e.key);
|
|
92
|
+
}, L = d(/* @__PURE__ */ new Set()), R = async (e) => {
|
|
93
|
+
if (!e.children.length && !e.isLeaf && !L.value.has(e.key)) {
|
|
94
|
+
L.value.add(e.key);
|
|
95
|
+
let t = await _.loadMore?.(e);
|
|
96
|
+
t?.length && (e.rawNode.children = t, e.children = N(t, e)), L.value.delete(e.key);
|
|
93
97
|
}
|
|
94
|
-
},
|
|
95
|
-
|
|
96
|
-
},
|
|
97
|
-
|
|
98
|
-
},
|
|
99
|
-
!
|
|
100
|
-
},
|
|
101
|
-
t.disabled || (e ? (
|
|
102
|
-
t.disabled ||
|
|
98
|
+
}, z = async (e) => {
|
|
99
|
+
O.value = [...O.value, e.key], await R(e);
|
|
100
|
+
}, B = async (e) => {
|
|
101
|
+
O.value.includes(e.key) ? (I(e), C("nodeExpand", e, !0)) : (await z(e), C("nodeExpand", e, !1));
|
|
102
|
+
}, V = (e) => {
|
|
103
|
+
!_.selectable || e.disabled || (_.multiple ? T.value.includes(e.key) ? T.value = T.value.filter((t) => t !== e.key) : T.value = [...T.value, e.key] : T.value = [e.key], C("nodeSelect", e));
|
|
104
|
+
}, H = (e, t) => {
|
|
105
|
+
t.disabled || (e ? (E.value = [...E.value, t.key], D.value = D.value.filter((e) => e !== t.key)) : E.value = E.value.filter((e) => e !== t.key), t.children?.length && t.children.forEach((t) => {
|
|
106
|
+
t.disabled || H(e, t);
|
|
103
107
|
}));
|
|
104
|
-
},
|
|
108
|
+
}, U = (e) => P.value.find((t) => t.key === e), W = (e) => {
|
|
105
109
|
if (!e.disabled && e.parentKey) {
|
|
106
|
-
let t =
|
|
110
|
+
let t = U(e.parentKey);
|
|
107
111
|
if (t) {
|
|
108
112
|
let e = !0, n = !1;
|
|
109
|
-
for (let r of t.children)
|
|
110
|
-
e ? (
|
|
113
|
+
for (let r of t.children) E.value.includes(r.key) ? n = !0 : D.value.includes(r.key) ? (e = !1, n = !0) : e = !1;
|
|
114
|
+
e ? (E.value = [...E.value, t.key], D.value = D.value.filter((e) => e !== t.key)) : n ? (E.value = E.value.filter((e) => e !== t.key), D.value = [...D.value, t.key]) : (E.value = E.value.filter((e) => e !== t.key), D.value = D.value.filter((e) => e !== t.key)), W(t);
|
|
111
115
|
}
|
|
112
116
|
}
|
|
113
|
-
},
|
|
114
|
-
|
|
115
|
-
},
|
|
116
|
-
|
|
117
|
+
}, G = (e, t) => {
|
|
118
|
+
H(e, t), W(t), C("nodeCheck", t, e);
|
|
119
|
+
}, K = (e) => {
|
|
120
|
+
C("nodeClick", e);
|
|
117
121
|
};
|
|
118
|
-
|
|
119
|
-
let
|
|
120
|
-
return
|
|
121
|
-
|
|
122
|
-
}),
|
|
122
|
+
u(n, { slots: b() });
|
|
123
|
+
let q = S();
|
|
124
|
+
return f(() => {
|
|
125
|
+
p(q, [v(w).b()]), g(q, { height: A.value + "px" });
|
|
126
|
+
}), m(q, null, 0), a(r, {
|
|
123
127
|
name: "tree-list",
|
|
124
128
|
tag: "div"
|
|
125
|
-
}, () => o(() =>
|
|
129
|
+
}, () => o(() => P.value, (e) => a(t, {
|
|
126
130
|
node: () => e.value,
|
|
127
|
-
expanded: () =>
|
|
128
|
-
onToggle: () =>
|
|
129
|
-
loading: () =>
|
|
130
|
-
onSelect: () =>
|
|
131
|
-
selected: () =>
|
|
131
|
+
expanded: () => F(e.value),
|
|
132
|
+
onToggle: () => B,
|
|
133
|
+
loading: () => L.value.has(e.value.key),
|
|
134
|
+
onSelect: () => V,
|
|
135
|
+
selected: () => T.value.includes(e.value.key),
|
|
132
136
|
checkable: () => !!s.checkable,
|
|
133
|
-
checked: () =>
|
|
134
|
-
indeterminate: () =>
|
|
135
|
-
onCheck: () =>
|
|
136
|
-
onClick: () =>
|
|
137
|
-
}), (e) => e.key, 34)),
|
|
137
|
+
checked: () => E.value.includes(e.value.key),
|
|
138
|
+
indeterminate: () => D.value.includes(e.value.key),
|
|
139
|
+
onCheck: () => G,
|
|
140
|
+
onClick: () => K
|
|
141
|
+
}), (e) => e.key, 34)), h(q, k, null, "containerRef"), q;
|
|
138
142
|
}
|
|
139
143
|
});
|
|
140
144
|
//#endregion
|
|
141
|
-
export {
|
|
145
|
+
export { C as default };
|