savor-ui 0.17.0 → 0.18.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 +9 -0
- 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 +14 -2
- package/dist/es/components/src/menu/types.d.ts +10 -0
- 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/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 +26 -0
- package/dist/json/vetur-tags.json +8 -1
- package/dist/json/web-types.json +67 -2
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,15 @@
|
|
|
2
2
|
|
|
3
3
|
|
|
4
4
|
|
|
5
|
+
# [0.18.0](https://gitee.com/mach552/savor-ui/compare/v0.17.0...v0.18.0) (2026-08-08)
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
### Features
|
|
9
|
+
|
|
10
|
+
* **menu:** 新增样式颜色属性 ([a2dd967](https://gitee.com/mach552/savor-ui/commits/a2dd9678707ac3c9eb3631ecf0ac92c42f5d8a3f))
|
|
11
|
+
* **modal:** 新增类型和图标 ([7973598](https://gitee.com/mach552/savor-ui/commits/797359852caed0d019a3f86ed24379104030ccd3))
|
|
12
|
+
* **tree:** 新增节点图标和额外内容插槽 ([b3f7953](https://gitee.com/mach552/savor-ui/commits/b3f79533fbeb4c589c74dbc4e240b1bb336489cb))
|
|
13
|
+
|
|
5
14
|
# [0.17.0](https://gitee.com/mach552/savor-ui/compare/v0.16.0...v0.17.0) (2026-08-07)
|
|
6
15
|
|
|
7
16
|
|
|
@@ -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: "transparent" },
|
|
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,7 +31,14 @@ 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(() => ({
|
|
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
|
+
width: _.collapsed ? e(_.collapsedWidth) : e(_.width)
|
|
41
|
+
})), D = b(c, "activeKey"), O = b(c, "openKeys"), k = (e, t) => {
|
|
30
42
|
D.value = e, w("itemClick", e, t);
|
|
31
43
|
}, A = (e) => {
|
|
32
44
|
if (_.accordion) {
|
|
@@ -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
|
/** 默认 */
|
|
@@ -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;
|
package/dist/es/components/src/modal/modal.vue_vue_type_script_setup_true_vapor_true_lang.mjs
CHANGED
|
@@ -6,21 +6,25 @@ import { useResizeObserver as r } from "../../../hooks/src/use-resize-observer.m
|
|
|
6
6
|
import { useScrollHidden as ee } from "../../../hooks/src/use-scroll-hidden.mjs";
|
|
7
7
|
import { useZIndex as te } from "../../../hooks/src/use-zIndex.mjs";
|
|
8
8
|
import "../../../hooks/index.mjs";
|
|
9
|
-
import ne from "../../../icons/src/
|
|
10
|
-
import re from "../../../icons/src/
|
|
11
|
-
import ie from "../../../icons/src/
|
|
9
|
+
import ne from "../../../icons/src/check-circle-fill.vue.mjs";
|
|
10
|
+
import re from "../../../icons/src/close-circle-fill.vue.mjs";
|
|
11
|
+
import ie from "../../../icons/src/close.vue.mjs";
|
|
12
|
+
import ae from "../../../icons/src/fullscreen-exit.vue.mjs";
|
|
13
|
+
import oe from "../../../icons/src/fullscreen.vue.mjs";
|
|
14
|
+
import i from "../../../icons/src/info-circle-fill.vue.mjs";
|
|
15
|
+
import se from "../../../icons/src/warning-circle-fill.vue.mjs";
|
|
12
16
|
import "../../../icons/index.mjs";
|
|
13
|
-
import { SScrollbar as
|
|
14
|
-
import { SButton as
|
|
15
|
-
import { STransition as
|
|
16
|
-
import { VaporTeleport as
|
|
17
|
+
import { SScrollbar as ce } from "../scrollbar/index.mjs";
|
|
18
|
+
import { SButton as a } from "../button/index.mjs";
|
|
19
|
+
import { STransition as o } from "../transition/index.mjs";
|
|
20
|
+
import { VaporTeleport as le, applyVShow as s, child as c, computed as l, createComponent as u, createIf as d, createInvoker as ue, createSlot as f, createTemplateRefSetter as de, defineVaporComponent as p, delegateEvents as m, mergeModels as h, next as fe, nextTick as g, onUnmounted as pe, ref as _, renderEffect as v, setClass as y, setInsertionState as b, setStyle as x, setText as S, template as C, toDisplayString as w, unref as T, useModel as me, useTemplateRef as E, watch as D, watchEffect as he } from "vue";
|
|
17
21
|
//#region ../components/src/modal/modal.vue?vue&type=script&setup=true&vapor=true&lang.ts
|
|
18
|
-
var
|
|
19
|
-
|
|
20
|
-
var
|
|
22
|
+
var O = C("<div>"), k = C(" "), ge = C("<div><div></div><div></div>"), A = C("<div style=\"flex: 1; overflow: hidden; display: flex; flex-direction: column\">"), _e = C("<div><div>");
|
|
23
|
+
m("click");
|
|
24
|
+
var j = /*@__PURE__*/ p({
|
|
21
25
|
name: "SModal",
|
|
22
26
|
__name: "modal",
|
|
23
|
-
props: /*@__PURE__*/
|
|
27
|
+
props: /*@__PURE__*/ h({
|
|
24
28
|
modalValue: { type: Boolean },
|
|
25
29
|
width: { default: "0px" },
|
|
26
30
|
height: {},
|
|
@@ -60,6 +64,7 @@ var M = /*@__PURE__*/ f({
|
|
|
60
64
|
},
|
|
61
65
|
to: { default: "body" },
|
|
62
66
|
draggable: { type: Boolean },
|
|
67
|
+
type: { default: "default" },
|
|
63
68
|
className: {},
|
|
64
69
|
modalStyle: {},
|
|
65
70
|
maskStyle: {},
|
|
@@ -92,45 +97,45 @@ var M = /*@__PURE__*/ f({
|
|
|
92
97
|
},
|
|
93
98
|
modelModifiers: {}
|
|
94
99
|
}),
|
|
95
|
-
emits: /*@__PURE__*/
|
|
100
|
+
emits: /*@__PURE__*/ h([
|
|
96
101
|
"close",
|
|
97
102
|
"closed",
|
|
98
103
|
"opened",
|
|
99
104
|
"confirm"
|
|
100
105
|
], ["update:modelValue"]),
|
|
101
|
-
setup(
|
|
102
|
-
let C =
|
|
106
|
+
setup(p, { expose: m, emit: h }) {
|
|
107
|
+
let C = p, j = h, M = n("modal"), { lockScroll: ve, unlockScroll: N } = ee(), { nextZIndex: P } = te(), F = _(0), I = E("modalRef"), L = E("headerRef"), R = me(p, "modelValue"), z = _(!1), B = _(!1), V = _(!1), H = _(!1), U = _(0), W = _(0), G = _(!1), K = _(0), q = _(0), J = l(() => typeof C.to == "string" ? document.querySelector(C.to) || document.body : C.to);
|
|
103
108
|
r(J, () => {
|
|
104
109
|
let e = J.value;
|
|
105
110
|
K.value = e.clientHeight, q.value = e.clientWidth, Q();
|
|
106
111
|
}), r(I, () => {
|
|
107
112
|
z.value && Q();
|
|
108
113
|
});
|
|
109
|
-
let
|
|
114
|
+
let ye = l(() => ({
|
|
110
115
|
zIndex: F.value,
|
|
111
116
|
position: C.to === "body" ? "fixed" : "absolute"
|
|
112
|
-
})),
|
|
117
|
+
})), be = l(() => V.value ? {} : {
|
|
113
118
|
width: e(C.width),
|
|
114
119
|
height: e(C.height),
|
|
115
120
|
top: `${U.value}px`,
|
|
116
121
|
left: `${W.value}px`,
|
|
117
122
|
...C.modalStyle
|
|
118
|
-
}),
|
|
119
|
-
|
|
120
|
-
},
|
|
121
|
-
B.value = !1, H.value = !1, G.value = !1,
|
|
122
|
-
},
|
|
123
|
+
}), xe = () => {
|
|
124
|
+
j("opened");
|
|
125
|
+
}, Se = () => {
|
|
126
|
+
B.value = !1, H.value = !1, G.value = !1, j("closed"), g(N);
|
|
127
|
+
}, Ce = () => {
|
|
123
128
|
C.closeOnOverlayClick && X();
|
|
124
|
-
},
|
|
129
|
+
}, we = (e) => {
|
|
125
130
|
e ? R.value = !1 : H.value = !1;
|
|
126
131
|
}, Y = () => {
|
|
127
|
-
H.value = !0,
|
|
132
|
+
H.value = !0, j("confirm", we);
|
|
128
133
|
}, X = () => {
|
|
129
|
-
R.value = !1,
|
|
130
|
-
},
|
|
134
|
+
R.value = !1, j("close");
|
|
135
|
+
}, Te = () => {
|
|
131
136
|
V.value = !V.value;
|
|
132
137
|
};
|
|
133
|
-
|
|
138
|
+
D(() => C.fullscreen, (e) => V.value = e, { immediate: !0 });
|
|
134
139
|
let Z = (e) => {
|
|
135
140
|
e.key === "Escape" && C.closeOnEsc && z.value && X();
|
|
136
141
|
}, Q = async () => {
|
|
@@ -138,111 +143,112 @@ var M = /*@__PURE__*/ f({
|
|
|
138
143
|
let e = I.value;
|
|
139
144
|
C.center ? U.value = Math.max(0, (K.value - e.offsetHeight) / 2) : U.value = C.offset, W.value = Math.max(0, (q.value - e.offsetWidth) / 2);
|
|
140
145
|
};
|
|
141
|
-
|
|
142
|
-
e ? (F.value =
|
|
143
|
-
}, { immediate: !0 }),
|
|
146
|
+
D(() => R.value, async (e) => {
|
|
147
|
+
e ? (F.value = P(), ve(), B.value = !0, await g(), z.value = !0, Q()) : z.value = !1;
|
|
148
|
+
}, { immediate: !0 }), he((e) => {
|
|
144
149
|
z.value && (document.addEventListener("keydown", Z), e(() => document.removeEventListener("keydown", Z)));
|
|
145
150
|
}), t({
|
|
146
151
|
container: I,
|
|
147
152
|
target: L,
|
|
148
153
|
parent: J,
|
|
149
|
-
enable:
|
|
154
|
+
enable: l(() => C.draggable && !V.value),
|
|
150
155
|
divLeft: W,
|
|
151
156
|
divTop: U,
|
|
152
157
|
hasDragged: G
|
|
153
|
-
}),
|
|
154
|
-
|
|
155
|
-
}),
|
|
156
|
-
let $ =
|
|
157
|
-
return
|
|
158
|
-
to: () =>
|
|
158
|
+
}), pe(() => {
|
|
159
|
+
N();
|
|
160
|
+
}), m({ handleClose: X });
|
|
161
|
+
let $ = de();
|
|
162
|
+
return u(le, {
|
|
163
|
+
to: () => p.to,
|
|
159
164
|
defer: ""
|
|
160
165
|
}, () => {
|
|
161
|
-
let e =
|
|
166
|
+
let e = _e(), t = c(e, 1);
|
|
162
167
|
return v(() => {
|
|
163
|
-
y(e, [T(
|
|
164
|
-
}), b(e, 0, 0),
|
|
165
|
-
let e =
|
|
166
|
-
return
|
|
167
|
-
x(e,
|
|
168
|
+
y(e, [T(M).e("container")]), x(e, ye.value);
|
|
169
|
+
}), b(e, 0, 0), u(T(o), { type: "opacity" }, () => d(() => p.mask, () => {
|
|
170
|
+
let e = O();
|
|
171
|
+
return s(e, () => z.value), e.$evtclick = ue(Ce), v(() => {
|
|
172
|
+
x(e, p.maskStyle), y(e, [T(M).e("mask")]);
|
|
168
173
|
}), e;
|
|
169
|
-
}, null, 129)), v(() => y(t, [T(
|
|
174
|
+
}, null, 129)), v(() => y(t, [T(M).e("wrapper")])), b(t, null, 0), u(T(o), {
|
|
170
175
|
type: "scale",
|
|
171
|
-
onAfterLeave: () =>
|
|
172
|
-
onAfterEnter: () =>
|
|
176
|
+
onAfterLeave: () => Se,
|
|
177
|
+
onAfterEnter: () => xe
|
|
173
178
|
}, () => {
|
|
174
|
-
let e =
|
|
179
|
+
let e = O();
|
|
175
180
|
return v(() => {
|
|
176
|
-
let t = T(
|
|
181
|
+
let t = T(M);
|
|
177
182
|
y(e, [
|
|
178
183
|
t.b(),
|
|
179
|
-
t.is("drag",
|
|
184
|
+
t.is("drag", p.draggable),
|
|
180
185
|
t.is("fullscreen", V.value),
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
186
|
+
t.m(p.type),
|
|
187
|
+
p.className
|
|
188
|
+
]), x(e, be.value);
|
|
189
|
+
}), b(e, null, 0), d(() => p.header, () => {
|
|
190
|
+
let e = ge(), t = c(e, 1), n = fe(t, 2);
|
|
191
|
+
return v(() => y(e, [T(M).e("header")])), b(e, 0, 0), d(() => p.type !== "default", () => {
|
|
192
|
+
let e = O();
|
|
193
|
+
return v(() => y(e, [T(M).e("icon")])), b(e, null, 0), d(() => p.type === "warning", () => u(T(se)), () => d(() => p.type === "primary", () => u(T(i)), () => d(() => p.type === "info", () => u(T(i)), () => d(() => p.type === "success", () => u(T(ne)), () => d(() => p.type === "danger", () => u(T(re))), 1285), 1029), 773), 517), e;
|
|
194
|
+
}), v(() => y(t, [T(M).e("title")])), b(t, null, 0), f("header", null, () => {
|
|
195
|
+
let e = k();
|
|
196
|
+
return v(() => S(e, w(p.title))), e;
|
|
197
|
+
}), v(() => y(n, [T(M).e("header-icon")])), b(n, null, 0), d(() => p.fullable, () => u(T(a), {
|
|
192
198
|
text: "",
|
|
193
199
|
size: "small",
|
|
194
|
-
onClick: () =>
|
|
195
|
-
}, { icon: () =>
|
|
200
|
+
onClick: () => Te
|
|
201
|
+
}, { icon: () => d(() => V.value, () => u(T(ae)), () => u(T(oe)), 2181) })), b(n, null, 1), d(() => p.closable, () => u(T(a), {
|
|
196
202
|
text: "",
|
|
197
203
|
size: "small",
|
|
198
204
|
circle: "",
|
|
199
205
|
onClick: () => X
|
|
200
|
-
}, { icon: () =>
|
|
201
|
-
}), b(e, null, 1),
|
|
202
|
-
let e =
|
|
206
|
+
}, { icon: () => u(T(ie)) })), $(e, L, null, "headerRef"), e;
|
|
207
|
+
}), b(e, null, 1), d(() => !p.scrollContent, () => {
|
|
208
|
+
let e = O();
|
|
203
209
|
return v(() => {
|
|
204
|
-
y(e, [T(
|
|
210
|
+
y(e, [T(M).e("body")]), x(e, {
|
|
205
211
|
padding: "16px",
|
|
206
|
-
...
|
|
212
|
+
...p.bodyStyle
|
|
207
213
|
});
|
|
208
|
-
}), b(e, null, 0),
|
|
209
|
-
let e =
|
|
210
|
-
return v(() => S(e, w(
|
|
214
|
+
}), b(e, null, 0), f("default", null, () => {
|
|
215
|
+
let e = k();
|
|
216
|
+
return v(() => S(e, w(p.content))), e;
|
|
211
217
|
}), e;
|
|
212
218
|
}, () => {
|
|
213
|
-
let e =
|
|
214
|
-
return b(e, null, 0),
|
|
219
|
+
let e = A();
|
|
220
|
+
return b(e, null, 0), u(T(ce), { $: [() => ({
|
|
215
221
|
padding: "16px",
|
|
216
|
-
...
|
|
217
|
-
})] }, () =>
|
|
218
|
-
let e =
|
|
219
|
-
return v(() => S(e, w(
|
|
222
|
+
...p.scrollbarProps
|
|
223
|
+
})] }, () => f("default", null, () => {
|
|
224
|
+
let e = k();
|
|
225
|
+
return v(() => S(e, w(p.content))), e;
|
|
220
226
|
}, 4)), e;
|
|
221
|
-
},
|
|
222
|
-
let e =
|
|
223
|
-
return v(() => y(e, [T(
|
|
227
|
+
}, 3077), b(e, null, 2), d(() => p.footer, () => {
|
|
228
|
+
let e = O();
|
|
229
|
+
return v(() => y(e, [T(M).e("footer")])), b(e, null, 0), f("footer", null, () => d(() => p.btnReverse, () => [d(() => p.confirmBtn, () => u(T(a), { $: [() => ({
|
|
224
230
|
label: "确定",
|
|
225
231
|
loading: H.value,
|
|
226
232
|
type: "primary",
|
|
227
|
-
...
|
|
228
|
-
}), { onClick: () => Y }] }), null, 129),
|
|
233
|
+
...p.confirmProps
|
|
234
|
+
}), { onClick: () => Y }] }), null, 129), d(() => p.cancelBtn, () => u(T(a), { $: [() => ({
|
|
229
235
|
label: "取消",
|
|
230
236
|
secondary: !0,
|
|
231
|
-
...
|
|
232
|
-
}), { onClick: () => X }] }), null, 129)], () => [
|
|
237
|
+
...p.cancelProps
|
|
238
|
+
}), { onClick: () => X }] }), null, 129)], () => [d(() => p.cancelBtn, () => u(T(a), { $: [() => ({
|
|
233
239
|
label: "取消",
|
|
234
240
|
secondary: !0,
|
|
235
|
-
...
|
|
236
|
-
}), { onClick: () => X }] }), null, 129),
|
|
241
|
+
...p.cancelProps
|
|
242
|
+
}), { onClick: () => X }] }), null, 129), d(() => p.confirmBtn, () => u(T(a), { $: [() => ({
|
|
237
243
|
label: "确定",
|
|
238
244
|
loading: H.value,
|
|
239
245
|
type: "primary",
|
|
240
|
-
...
|
|
241
|
-
}), { onClick: () => Y }] }), null, 129)],
|
|
242
|
-
}),
|
|
243
|
-
}),
|
|
246
|
+
...p.confirmProps
|
|
247
|
+
}), { onClick: () => Y }] }), null, 129)], 3978)), e;
|
|
248
|
+
}), s(e, () => z.value), $(e, I, null, "modalRef"), e;
|
|
249
|
+
}), s(e, () => B.value), e;
|
|
244
250
|
}, !0);
|
|
245
251
|
}
|
|
246
252
|
});
|
|
247
253
|
//#endregion
|
|
248
|
-
export {
|
|
254
|
+
export { j as default };
|
|
@@ -38,6 +38,10 @@ export interface ModalProps {
|
|
|
38
38
|
to?: string | HTMLElement;
|
|
39
39
|
/** 是否开启拖动弹窗 */
|
|
40
40
|
draggable?: boolean;
|
|
41
|
+
/** 弹窗图标类型(default不显示)
|
|
42
|
+
* @default default
|
|
43
|
+
*/
|
|
44
|
+
type?: "default" | "warning" | "primary" | "info" | "success" | "danger";
|
|
41
45
|
/** 弹窗自定义类名 */
|
|
42
46
|
className?: string;
|
|
43
47
|
/** 弹窗自定义样式 */
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { TreeNode } from './types';
|
|
1
|
+
import { TreeSlots, TreeNode } from './types';
|
|
2
2
|
import { PublicProps, VNode, Plugin } from 'vue';
|
|
3
3
|
export declare const STree: ((__VLS_props: NonNullable<Awaited<typeof __VLS_setup>>["props"], __VLS_ctx?: {
|
|
4
4
|
attrs: any;
|
|
5
|
-
slots:
|
|
5
|
+
slots: TreeSlots;
|
|
6
6
|
emit: (((evt: "nodeSelect", node: TreeNode) => void) & ((evt: "nodeClick", node: TreeNode) => void) & ((evt: "nodeCheck", node: TreeNode, checked: boolean) => void) & ((evt: "nodeExpand", node: TreeNode, expanded: boolean) => void)) & (((event: "update:expandedKeys", value: (string | number)[]) => void) & ((event: "update:checkedKeys", value: (string | number)[]) => void) & ((event: "update:selectKeys", value: (string | number)[]) => void) & ((event: "update:indeterminateKeys", value: (string | number)[]) => void));
|
|
7
7
|
}, __VLS_exposed?: NonNullable<Awaited<typeof __VLS_setup>>["expose"], __VLS_setup?: Promise<{
|
|
8
8
|
props: PublicProps & {
|
|
@@ -12,6 +12,7 @@ export declare const STree: ((__VLS_props: NonNullable<Awaited<typeof __VLS_setu
|
|
|
12
12
|
key?: string;
|
|
13
13
|
children?: string;
|
|
14
14
|
} | undefined;
|
|
15
|
+
size?: "mini" | "small" | "medium" | "large" | undefined;
|
|
15
16
|
selectable?: boolean | undefined;
|
|
16
17
|
selectKeys?: (string | number)[] | undefined;
|
|
17
18
|
checkable?: boolean | undefined;
|
|
@@ -36,7 +37,7 @@ export declare const STree: ((__VLS_props: NonNullable<Awaited<typeof __VLS_setu
|
|
|
36
37
|
} ? P : {});
|
|
37
38
|
expose: (exposed: {}) => void;
|
|
38
39
|
attrs: any;
|
|
39
|
-
slots:
|
|
40
|
+
slots: TreeSlots;
|
|
40
41
|
emit: (((evt: "nodeSelect", node: TreeNode) => void) & ((evt: "nodeClick", node: TreeNode) => void) & ((evt: "nodeCheck", node: TreeNode, checked: boolean) => void) & ((evt: "nodeExpand", node: TreeNode, expanded: boolean) => void)) & (((event: "update:expandedKeys", value: (string | number)[]) => void) & ((event: "update:checkedKeys", value: (string | number)[]) => void) & ((event: "update:selectKeys", value: (string | number)[]) => void) & ((event: "update:indeterminateKeys", value: (string | number)[]) => void));
|
|
41
42
|
}>) => VNode & {
|
|
42
43
|
__ctx?: Awaited<typeof __VLS_setup>;
|
|
@@ -19,7 +19,15 @@ declare const __VLS_export: (__VLS_props: NonNullable<Awaited<typeof __VLS_setup
|
|
|
19
19
|
} ? P : {});
|
|
20
20
|
expose: (exposed: {}) => void;
|
|
21
21
|
attrs: any;
|
|
22
|
-
slots: {
|
|
22
|
+
slots: {
|
|
23
|
+
icon?: (props: {
|
|
24
|
+
node: TreeNode;
|
|
25
|
+
}) => any;
|
|
26
|
+
} & {
|
|
27
|
+
extra?: (props: {
|
|
28
|
+
node: TreeNode;
|
|
29
|
+
}) => any;
|
|
30
|
+
};
|
|
23
31
|
emit: ((evt: "select", node: TreeNode) => void) & ((evt: "click", node: TreeNode) => void) & ((evt: "toggle", node: TreeNode) => void) & ((evt: "check", checked: boolean, node: TreeNode) => void);
|
|
24
32
|
}>) => VNode & {
|
|
25
33
|
__ctx?: Awaited<typeof __VLS_setup>;
|
|
@@ -5,11 +5,12 @@ import n from "../../../icons/src/right.vue.mjs";
|
|
|
5
5
|
import "../../../icons/index.mjs";
|
|
6
6
|
import { SCheckbox as r } from "../checkbox/index.mjs";
|
|
7
7
|
import { SIcon as i } from "../icon/index.mjs";
|
|
8
|
-
import {
|
|
8
|
+
import { treeContextKey as a } from "./types.mjs";
|
|
9
|
+
import { child as o, createComponent as s, createIf as c, createInvoker as l, createSlot as u, defineVaporComponent as d, delegateEvents as f, inject as p, next as m, on as h, renderEffect as g, setAttr as _, setClass as v, setInsertionState as y, setStyle as b, setText as x, template as S, toDisplayString as C, txt as w, unref as T, withModifiers as E } from "vue";
|
|
9
10
|
//#region ../components/src/tree/node.vue?vue&type=script&setup=true&vapor=true&lang.ts
|
|
10
|
-
var
|
|
11
|
-
|
|
12
|
-
var
|
|
11
|
+
var D = S("<div>"), O = S("<div><div><div><span></span><!><span> </span>", 1);
|
|
12
|
+
f("click");
|
|
13
|
+
var k = /*@__PURE__*/ d({
|
|
13
14
|
__name: "node",
|
|
14
15
|
props: {
|
|
15
16
|
node: {},
|
|
@@ -26,34 +27,46 @@ var T = /*@__PURE__*/ l({
|
|
|
26
27
|
"click",
|
|
27
28
|
"check"
|
|
28
29
|
],
|
|
29
|
-
setup(
|
|
30
|
-
let
|
|
31
|
-
e.disabled ||
|
|
32
|
-
},
|
|
33
|
-
e.disabled || (
|
|
34
|
-
},
|
|
35
|
-
|
|
36
|
-
},
|
|
37
|
-
|
|
38
|
-
let e =
|
|
39
|
-
|
|
40
|
-
e.e("
|
|
41
|
-
e.is("selected",
|
|
42
|
-
e.is("disabled", t.disabled)
|
|
43
|
-
|
|
30
|
+
setup(d, { emit: f, slots: S }) {
|
|
31
|
+
let k = d, A = e("tree"), j = f, M = p(a, void 0), N = (e) => {
|
|
32
|
+
e.disabled || j("toggle", e);
|
|
33
|
+
}, P = (e) => {
|
|
34
|
+
e.disabled || (j("select", e), j("click", e));
|
|
35
|
+
}, F = (e) => {
|
|
36
|
+
j("check", e, k.node);
|
|
37
|
+
}, I = O(), L = o(I), R = o(L), z = o(R), B = m(z, 1), V = m(B, 3);
|
|
38
|
+
g(() => {
|
|
39
|
+
let e = T(A), t = d.node, n = T(M).size;
|
|
40
|
+
v(I, [e.e("node")]), _(I, "data-key", t.key), v(L, [
|
|
41
|
+
e.e("wrapper"),
|
|
42
|
+
e.is("selected", d.selected),
|
|
43
|
+
e.is("disabled", t.disabled),
|
|
44
|
+
e.is(n?.value, n?.value !== void 0)
|
|
45
|
+
]), v(R, [e.e("content")]), b(R, { paddingLeft: `${t.level * 16}px` }), v(z, [
|
|
44
46
|
e.e("expand-icon"),
|
|
45
|
-
e.is("expanded",
|
|
47
|
+
e.is("expanded", d.expanded && !t.isLeaf),
|
|
46
48
|
e.is("leaf", t.isLeaf)
|
|
47
49
|
]);
|
|
48
|
-
}),
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
50
|
+
}), y(z, null, 0), s(T(i), null, () => c(() => d.loading, () => s(T(t)), () => s(T(n)), 389)), h(z, "click", E(() => N(d.node), ["stop"])), y(R, B, 1), c(() => d.checkable, () => {
|
|
51
|
+
let e = D();
|
|
52
|
+
return g(() => v(e, [T(A).e("checkbox")])), y(e, null, 0), s(T(r), {
|
|
53
|
+
disabled: () => d.node.disabled,
|
|
54
|
+
indeterminate: () => d.indeterminate,
|
|
55
|
+
"model-value": () => d.checked,
|
|
56
|
+
onChange: () => F
|
|
57
|
+
}), e;
|
|
58
|
+
}), y(R, B, 2), c(() => S.icon, () => {
|
|
59
|
+
let e = D();
|
|
60
|
+
return g(() => v(e, [T(A).e("node-icon")])), y(e, null, 0), u("icon", { node: () => d.node }), e;
|
|
61
|
+
});
|
|
62
|
+
let H = w(V);
|
|
63
|
+
return g(() => {
|
|
64
|
+
v(V, [T(A).e("label")]), x(H, C(d.node.label));
|
|
65
|
+
}), y(R, null, 4), c(() => S.extra, () => {
|
|
66
|
+
let e = D();
|
|
67
|
+
return g(() => v(e, [T(A).e("extra")])), y(e, null, 0), u("extra", { node: () => d.node }), e;
|
|
68
|
+
}), I.$evtclick = l(() => P(d.node)), I;
|
|
56
69
|
}
|
|
57
70
|
});
|
|
58
71
|
//#endregion
|
|
59
|
-
export {
|
|
72
|
+
export { k as default };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { TreeNode, TreeProps } from './types';
|
|
1
|
+
import { TreeSlots, TreeNode, TreeProps } from './types';
|
|
2
2
|
import { PublicProps, VNode } from 'vue';
|
|
3
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
4
|
props: PublicProps & __VLS_PrettifyLocal<(TreeProps & {
|
|
@@ -20,7 +20,7 @@ declare const __VLS_export: (__VLS_props: NonNullable<Awaited<typeof __VLS_setup
|
|
|
20
20
|
} ? P : {});
|
|
21
21
|
expose: (exposed: {}) => void;
|
|
22
22
|
attrs: any;
|
|
23
|
-
slots:
|
|
23
|
+
slots: TreeSlots;
|
|
24
24
|
emit: (((evt: "nodeSelect", node: TreeNode) => void) & ((evt: "nodeClick", node: TreeNode) => void) & ((evt: "nodeCheck", node: TreeNode, checked: boolean) => void) & ((evt: "nodeExpand", node: TreeNode, expanded: boolean) => void)) & (((event: "update:expandedKeys", value: (string | number)[]) => void) & ((event: "update:checkedKeys", value: (string | number)[]) => void) & ((event: "update:selectKeys", value: (string | number)[]) => void) & ((event: "update:indeterminateKeys", value: (string | number)[]) => void));
|
|
25
25
|
}>) => VNode & {
|
|
26
26
|
__ctx?: Awaited<typeof __VLS_setup>;
|
|
@@ -1,19 +1,20 @@
|
|
|
1
1
|
import { useNamespace as e } from "../../../hooks/src/use-namespace.mjs";
|
|
2
2
|
import "../../../hooks/index.mjs";
|
|
3
|
-
import t from "./
|
|
4
|
-
import
|
|
5
|
-
import { VaporTransitionGroup as r, computed as i, createComponent as a, createFor as o,
|
|
3
|
+
import { treeContextKey as t } from "./types.mjs";
|
|
4
|
+
import n from "./node.vue.mjs";
|
|
5
|
+
import { VaporTransitionGroup as r, computed as i, createComponent as a, createFor as o, createSlot as s, defineVaporComponent as c, mergeModels as l, onBeforeUnmount as u, onMounted as d, provide as f, ref as p, renderEffect as m, setClass as h, setInsertionState as g, setStaticTemplateRef as _, setStyle as v, template as y, toRefs as ee, unref as b, useModel as x, watch as S } from "vue";
|
|
6
6
|
//#region ../components/src/tree/tree.vue?vue&type=script&setup=true&vapor=true&lang.ts
|
|
7
|
-
var C =
|
|
7
|
+
var C = y("<div>", 1), w = /*@__PURE__*/ c({
|
|
8
8
|
name: "STree",
|
|
9
9
|
__name: "tree",
|
|
10
|
-
props: /*@__PURE__*/
|
|
10
|
+
props: /*@__PURE__*/ l({
|
|
11
11
|
data: { default: () => [] },
|
|
12
12
|
fieldNames: { default: () => ({
|
|
13
13
|
label: "label",
|
|
14
14
|
key: "key",
|
|
15
15
|
children: "children"
|
|
16
16
|
}) },
|
|
17
|
+
size: { default: "medium" },
|
|
17
18
|
selectable: {
|
|
18
19
|
type: Boolean,
|
|
19
20
|
default: !1
|
|
@@ -43,7 +44,7 @@ var C = v("<div>", 1), w = /*@__PURE__*/ s({
|
|
|
43
44
|
expandedKeys: { default: () => [] },
|
|
44
45
|
expandedKeysModifiers: {}
|
|
45
46
|
}),
|
|
46
|
-
emits: /*@__PURE__*/
|
|
47
|
+
emits: /*@__PURE__*/ l([
|
|
47
48
|
"nodeSelect",
|
|
48
49
|
"nodeClick",
|
|
49
50
|
"nodeCheck",
|
|
@@ -54,27 +55,27 @@ var C = v("<div>", 1), w = /*@__PURE__*/ s({
|
|
|
54
55
|
"update:indeterminateKeys",
|
|
55
56
|
"update:expandedKeys"
|
|
56
57
|
]),
|
|
57
|
-
setup(
|
|
58
|
-
let
|
|
59
|
-
let e =
|
|
60
|
-
e && (
|
|
58
|
+
setup(c, { emit: l, slots: y }) {
|
|
59
|
+
let w = c, T = l, E = e("tree"), D = x(c, "selectKeys"), O = x(c, "checkedKeys"), k = x(c, "indeterminateKeys"), A = x(c, "expandedKeys"), j = p(), M = p(0), N = null, P = () => {
|
|
60
|
+
let e = j.value?.firstElementChild;
|
|
61
|
+
e && (M.value = e.offsetHeight);
|
|
61
62
|
};
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
let e =
|
|
65
|
-
e && (
|
|
66
|
-
}),
|
|
67
|
-
|
|
63
|
+
d(() => {
|
|
64
|
+
P();
|
|
65
|
+
let e = j.value?.firstElementChild;
|
|
66
|
+
e && (N = new ResizeObserver(P), N.observe(e));
|
|
67
|
+
}), u(() => {
|
|
68
|
+
N?.disconnect(), N = null;
|
|
68
69
|
});
|
|
69
|
-
let
|
|
70
|
-
let { label: n, key: r, children: i } =
|
|
70
|
+
let F = p([]), I = (e, t) => {
|
|
71
|
+
let { label: n, key: r, children: i } = w.fieldNames, a = (e, t) => e?.length ? e.map((e) => {
|
|
71
72
|
let o = e[i] || [], s = {
|
|
72
73
|
label: e[n],
|
|
73
74
|
key: e[r],
|
|
74
75
|
children: [],
|
|
75
76
|
rawNode: { ...e },
|
|
76
77
|
level: t ? t.level + 1 : 0,
|
|
77
|
-
isLeaf: e.isLeaf ? e.isLeaf :
|
|
78
|
+
isLeaf: e.isLeaf ? e.isLeaf : w.loadMore ? !1 : !o?.length,
|
|
78
79
|
disabled: !!e.disabled,
|
|
79
80
|
parentKey: t?.key
|
|
80
81
|
};
|
|
@@ -82,88 +83,94 @@ var C = v("<div>", 1), w = /*@__PURE__*/ s({
|
|
|
82
83
|
}) : [];
|
|
83
84
|
return Array.isArray(e) ? a(e, t) : [];
|
|
84
85
|
};
|
|
85
|
-
S(() =>
|
|
86
|
-
|
|
86
|
+
S(() => w.data, (e) => {
|
|
87
|
+
F.value = I(e);
|
|
87
88
|
}, { immediate: !0 });
|
|
88
|
-
let
|
|
89
|
-
let e =
|
|
89
|
+
let L = i(() => {
|
|
90
|
+
let e = F.value || [];
|
|
90
91
|
if (e.length === 0) return [];
|
|
91
92
|
let t = [], n = [...e].reverse();
|
|
92
93
|
for (; n.length;) {
|
|
93
94
|
let e = n.pop();
|
|
94
|
-
t.push(e),
|
|
95
|
+
t.push(e), A.value.includes(e.key) && e?.children?.length && n.push(...[...e.children].reverse());
|
|
95
96
|
}
|
|
96
97
|
return t;
|
|
97
|
-
}),
|
|
98
|
-
|
|
99
|
-
},
|
|
100
|
-
if (!e.children.length && !e.isLeaf && !
|
|
101
|
-
|
|
102
|
-
let t = await
|
|
103
|
-
t?.length && (e.rawNode.children = t, e.children =
|
|
98
|
+
}), R = (e) => A.value.includes(e.key), z = (e) => {
|
|
99
|
+
A.value = A.value.filter((t) => t !== e.key);
|
|
100
|
+
}, B = p(/* @__PURE__ */ new Set()), V = async (e) => {
|
|
101
|
+
if (!e.children.length && !e.isLeaf && !B.value.has(e.key)) {
|
|
102
|
+
B.value.add(e.key);
|
|
103
|
+
let t = await w.loadMore?.(e);
|
|
104
|
+
t?.length && (e.rawNode.children = t, e.children = I(t, e)), B.value.delete(e.key);
|
|
104
105
|
}
|
|
105
|
-
}, V = async (e) => {
|
|
106
|
-
k.value = [...k.value, e.key], await B(e);
|
|
107
106
|
}, H = async (e) => {
|
|
108
|
-
|
|
109
|
-
}, U = (e) => {
|
|
110
|
-
|
|
111
|
-
}, W = (e
|
|
112
|
-
|
|
113
|
-
|
|
107
|
+
A.value = [...A.value, e.key], await V(e);
|
|
108
|
+
}, U = async (e) => {
|
|
109
|
+
A.value.includes(e.key) ? (z(e), T("nodeExpand", e, !0)) : (await H(e), T("nodeExpand", e, !1));
|
|
110
|
+
}, W = (e) => {
|
|
111
|
+
!w.selectable || e.disabled || (w.multiple ? D.value.includes(e.key) ? D.value = D.value.filter((t) => t !== e.key) : D.value = [...D.value, e.key] : D.value = [e.key], T("nodeSelect", e));
|
|
112
|
+
}, G = (e, t) => {
|
|
113
|
+
t.disabled || (e ? (O.value.includes(t.key) || (O.value = [...O.value, t.key]), k.value = k.value.filter((e) => e !== t.key)) : O.value = O.value.filter((e) => e !== t.key), !w.checkStrictly && t.children?.length && t.children.forEach((t) => {
|
|
114
|
+
t.disabled || G(e, t);
|
|
114
115
|
}));
|
|
115
|
-
},
|
|
116
|
+
}, K = (e) => L.value.find((t) => t.key === e), q = (e) => {
|
|
116
117
|
if (!e.disabled && e.parentKey) {
|
|
117
|
-
let t =
|
|
118
|
+
let t = K(e.parentKey);
|
|
118
119
|
if (t) {
|
|
119
120
|
let e = !0, n = !1;
|
|
120
|
-
for (let r of t.children)
|
|
121
|
-
e ? (
|
|
121
|
+
for (let r of t.children) O.value.includes(r.key) ? n = !0 : k.value.includes(r.key) ? (e = !1, n = !0) : e = !1;
|
|
122
|
+
e ? (O.value = [...O.value, t.key], k.value = k.value.filter((e) => e !== t.key)) : n ? (O.value = O.value.filter((e) => e !== t.key), k.value = [...k.value, t.key]) : (O.value = O.value.filter((e) => e !== t.key), k.value = k.value.filter((e) => e !== t.key)), q(t);
|
|
122
123
|
}
|
|
123
124
|
}
|
|
124
|
-
},
|
|
125
|
-
if (
|
|
126
|
-
|
|
125
|
+
}, J = !1, Y = () => {
|
|
126
|
+
if (w.checkStrictly) {
|
|
127
|
+
k.value.length > 0 && (J = !0, k.value = [], J = !1);
|
|
127
128
|
return;
|
|
128
129
|
}
|
|
129
|
-
let e = new Set(
|
|
130
|
+
let e = new Set(O.value), t = [], n = (r) => {
|
|
130
131
|
if (!r.children?.length) return e.has(r.key) ? "checked" : "unchecked";
|
|
131
132
|
let i = r.children.map((e) => n(e)), a = i.every((e) => e === "checked"), o = i.some((e) => e === "checked" || e === "indeterminate"), s = e.has(r.key);
|
|
132
133
|
return a ? (s || e.add(r.key), "checked") : o ? (s && e.delete(r.key), t.push(r.key), "indeterminate") : (s && e.delete(r.key), "unchecked");
|
|
133
134
|
};
|
|
134
|
-
|
|
135
|
+
F.value.forEach(n), J = !0;
|
|
135
136
|
let r = Array.from(e);
|
|
136
|
-
(r.length !==
|
|
137
|
+
(r.length !== O.value.length || r.some((e) => !O.value.includes(e))) && (O.value = r), k.value = t, J = !1;
|
|
137
138
|
};
|
|
138
|
-
S(() =>
|
|
139
|
-
|
|
139
|
+
S(() => O.value, () => {
|
|
140
|
+
J || Y();
|
|
140
141
|
}, { flush: "sync" });
|
|
141
|
-
let
|
|
142
|
-
|
|
143
|
-
},
|
|
144
|
-
|
|
145
|
-
};
|
|
146
|
-
|
|
147
|
-
let
|
|
148
|
-
return
|
|
149
|
-
|
|
150
|
-
}),
|
|
142
|
+
let X = (e, t) => {
|
|
143
|
+
J = !0, G(e, t), w.checkStrictly || q(t), J = !1, T("nodeCheck", t, e);
|
|
144
|
+
}, Z = (e) => {
|
|
145
|
+
T("nodeClick", e);
|
|
146
|
+
}, { size: Q } = ee(w);
|
|
147
|
+
f(t, { size: Q });
|
|
148
|
+
let $ = C();
|
|
149
|
+
return m(() => {
|
|
150
|
+
h($, [b(E).b()]), v($, { height: M.value + "px" });
|
|
151
|
+
}), g($, null, 0), a(r, {
|
|
151
152
|
name: "tree-list",
|
|
152
153
|
tag: "div",
|
|
153
|
-
onAfterLeave: () =>
|
|
154
|
-
}, () => o(() =>
|
|
154
|
+
onAfterLeave: () => P
|
|
155
|
+
}, () => o(() => L.value, (e) => a(n, {
|
|
155
156
|
node: () => e.value,
|
|
156
|
-
expanded: () =>
|
|
157
|
-
onToggle: () =>
|
|
158
|
-
loading: () =>
|
|
159
|
-
onSelect: () =>
|
|
160
|
-
selected: () =>
|
|
161
|
-
checkable: () => !!
|
|
162
|
-
checked: () =>
|
|
163
|
-
indeterminate: () =>
|
|
164
|
-
onCheck: () =>
|
|
165
|
-
onClick: () =>
|
|
166
|
-
}
|
|
157
|
+
expanded: () => R(e.value),
|
|
158
|
+
onToggle: () => U,
|
|
159
|
+
loading: () => B.value.has(e.value.key),
|
|
160
|
+
onSelect: () => W,
|
|
161
|
+
selected: () => D.value.includes(e.value.key),
|
|
162
|
+
checkable: () => !!c.checkable,
|
|
163
|
+
checked: () => O.value.includes(e.value.key),
|
|
164
|
+
indeterminate: () => k.value.includes(e.value.key),
|
|
165
|
+
onCheck: () => X,
|
|
166
|
+
onClick: () => Z
|
|
167
|
+
}, { $: [() => y.icon ? {
|
|
168
|
+
name: "icon",
|
|
169
|
+
fn: (e) => s("icon", { node: () => e.node }, null, 4)
|
|
170
|
+
} : void 0, () => y.extra ? {
|
|
171
|
+
name: "extra",
|
|
172
|
+
fn: (e) => s("extra", { node: () => e.node }, null, 4)
|
|
173
|
+
} : void 0] }), (e) => e.key, 34)), _($, j, null, "containerRef"), $;
|
|
167
174
|
}
|
|
168
175
|
});
|
|
169
176
|
//#endregion
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { InjectionKey,
|
|
1
|
+
import { InjectionKey, Ref } from 'vue';
|
|
2
2
|
export interface TreeProps {
|
|
3
3
|
/** 树节点数据 */
|
|
4
4
|
data: any[];
|
|
@@ -8,6 +8,8 @@ export interface TreeProps {
|
|
|
8
8
|
key?: string;
|
|
9
9
|
children?: string;
|
|
10
10
|
};
|
|
11
|
+
/** 树节点大小 */
|
|
12
|
+
size?: "mini" | "small" | "medium" | "large";
|
|
11
13
|
/** 是否可选择节点 */
|
|
12
14
|
selectable?: boolean;
|
|
13
15
|
/** 选中的节点键值数组 (v-model:selectKeys)*/
|
|
@@ -31,6 +33,16 @@ export interface TreeProps {
|
|
|
31
33
|
/** 加载更多节点的回调函数 */
|
|
32
34
|
loadMore?: (node: TreeNode) => Promise<TreeNode[]>;
|
|
33
35
|
}
|
|
36
|
+
export interface TreeSlots {
|
|
37
|
+
/** 自定义节点图标槽位 */
|
|
38
|
+
icon: (props: {
|
|
39
|
+
node: TreeNode;
|
|
40
|
+
}) => any;
|
|
41
|
+
/** 自定义节点额外槽位 */
|
|
42
|
+
extra: (props: {
|
|
43
|
+
node: TreeNode;
|
|
44
|
+
}) => any;
|
|
45
|
+
}
|
|
34
46
|
export interface TreeEmits {
|
|
35
47
|
/** 选择节点变化事件 */
|
|
36
48
|
nodeSelect: [node: TreeNode];
|
|
@@ -62,6 +74,6 @@ export interface TreeNode {
|
|
|
62
74
|
[key: string]: any;
|
|
63
75
|
}
|
|
64
76
|
export interface TreeContext {
|
|
65
|
-
|
|
77
|
+
size?: Ref<TreeProps["size"]>;
|
|
66
78
|
}
|
|
67
79
|
export declare const treeContextKey: InjectionKey<TreeContext>;
|
|
@@ -5,6 +5,8 @@
|
|
|
5
5
|
height: 100%;
|
|
6
6
|
overflow: hidden;
|
|
7
7
|
font-size: getCssVar("font-size", "medium");
|
|
8
|
+
color: var(--s-menu-text-color);
|
|
9
|
+
background-color: var(--s-menu-bg-color);
|
|
8
10
|
transition:
|
|
9
11
|
background-color 0.3s getCssVar("bezier", "1"),
|
|
10
12
|
opacity 0.3s getCssVar("bezier", "1"),
|
|
@@ -29,8 +31,8 @@
|
|
|
29
31
|
padding: 0;
|
|
30
32
|
@include when(active) {
|
|
31
33
|
border-radius: getCssVar("radius", "medium");
|
|
32
|
-
background-color:
|
|
33
|
-
color:
|
|
34
|
+
background-color: var(--s-menu-active-bg-color);
|
|
35
|
+
color: var(--s-menu-active-text-color);
|
|
34
36
|
}
|
|
35
37
|
}
|
|
36
38
|
@include be(menu, item-title) {
|
|
@@ -56,11 +58,11 @@
|
|
|
56
58
|
color 0.3s getCssVar("bezier", "1"),
|
|
57
59
|
border-radius 0.3s getCssVar("bezier", "1");
|
|
58
60
|
&:hover {
|
|
59
|
-
background-color:
|
|
61
|
+
background-color: var(--s-menu-hover-bg-color);
|
|
60
62
|
border-radius: getCssVar("radius", "medium");
|
|
61
63
|
}
|
|
62
64
|
@include when(active) {
|
|
63
|
-
color:
|
|
65
|
+
color: var(--s-menu-active-text-color);
|
|
64
66
|
}
|
|
65
67
|
}
|
|
66
68
|
@include e(sub-icon) {
|
|
@@ -119,12 +121,12 @@
|
|
|
119
121
|
color 0.3s getCssVar("bezier", "1"),
|
|
120
122
|
border-radius 0.3s getCssVar("bezier", "1");
|
|
121
123
|
&:hover {
|
|
122
|
-
background-color:
|
|
124
|
+
background-color: var(--s-menu-hover-bg-color);
|
|
123
125
|
border-radius: getCssVar("radius", "medium");
|
|
124
126
|
}
|
|
125
127
|
@include when(active) {
|
|
126
|
-
color:
|
|
127
|
-
background-color:
|
|
128
|
+
color: var(--s-menu-active-text-color);
|
|
129
|
+
background-color: var(--s-menu-active-bg-color);
|
|
128
130
|
border-radius: getCssVar("radius", "medium");
|
|
129
131
|
}
|
|
130
132
|
}
|
|
@@ -142,7 +144,8 @@
|
|
|
142
144
|
}
|
|
143
145
|
@include e(pop-content) {
|
|
144
146
|
border-radius: getCssVar("radius", "medium");
|
|
145
|
-
background-color:
|
|
147
|
+
background-color: var(--s-menu-bg-color);
|
|
148
|
+
color: var(--s-menu-text-color);
|
|
146
149
|
box-shadow: getCssVar("shadow", "1");
|
|
147
150
|
border: 1px solid getCssVar("color", "fill-3");
|
|
148
151
|
display: flex;
|
|
@@ -171,8 +174,8 @@
|
|
|
171
174
|
padding: 0 20px !important;
|
|
172
175
|
|
|
173
176
|
@include when(active) {
|
|
174
|
-
background-color:
|
|
175
|
-
color:
|
|
177
|
+
background-color: var(--s-menu-active-bg-color);
|
|
178
|
+
color: var(--s-menu-active-text-color);
|
|
176
179
|
&::before {
|
|
177
180
|
content: "";
|
|
178
181
|
display: none;
|
|
@@ -195,7 +198,7 @@
|
|
|
195
198
|
align-items: center;
|
|
196
199
|
gap: 8px;
|
|
197
200
|
font-size: getCssVar("font-size", "medium");
|
|
198
|
-
color:
|
|
201
|
+
color: var(--s-menu-text-color);
|
|
199
202
|
padding-left: calc(var(--s-menu-level) * 20px);
|
|
200
203
|
padding-right: 20px;
|
|
201
204
|
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
@use "../mixins/function.scss" as *;
|
|
2
2
|
@use "../mixins/mixins.scss" as *;
|
|
3
|
+
@use "../common/var.scss" as *;
|
|
3
4
|
|
|
4
5
|
@include b(modal) {
|
|
5
6
|
position: absolute;
|
|
@@ -53,9 +54,15 @@
|
|
|
53
54
|
@include e(header) {
|
|
54
55
|
display: flex;
|
|
55
56
|
align-items: center;
|
|
56
|
-
gap:
|
|
57
|
+
gap: 4px;
|
|
57
58
|
padding: 16px 16px 0 16px;
|
|
58
59
|
}
|
|
60
|
+
@include e(icon) {
|
|
61
|
+
display: flex;
|
|
62
|
+
align-items: center;
|
|
63
|
+
justify-content: center;
|
|
64
|
+
font-size: 24px;
|
|
65
|
+
}
|
|
59
66
|
@include e(header-icon) {
|
|
60
67
|
display: flex;
|
|
61
68
|
align-items: center;
|
|
@@ -142,4 +149,14 @@
|
|
|
142
149
|
height: calc(100% - 16px);
|
|
143
150
|
cursor: ew-resize;
|
|
144
151
|
}
|
|
152
|
+
@include m(default) {
|
|
153
|
+
color: getCssVar("color", "text-1");
|
|
154
|
+
}
|
|
155
|
+
@each $type in $type-list {
|
|
156
|
+
@include m(#{$type}) {
|
|
157
|
+
@include be(modal, icon) {
|
|
158
|
+
color: getCssVar("color", #{$type}-6);
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
}
|
|
145
162
|
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
@use "../mixins/function.scss" as *;
|
|
2
2
|
@use "../mixins/mixins.scss" as *;
|
|
3
|
+
@use "../common/var.scss" as *;
|
|
3
4
|
|
|
4
5
|
@include b(tree) {
|
|
5
6
|
box-sizing: border-box;
|
|
@@ -7,19 +8,25 @@
|
|
|
7
8
|
overflow: hidden;
|
|
8
9
|
|
|
9
10
|
@include e(node) {
|
|
11
|
+
padding: 2px 0;
|
|
12
|
+
display: flex;
|
|
13
|
+
align-items: center;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
@include e(wrapper) {
|
|
17
|
+
width: 100%;
|
|
18
|
+
height: 100%;
|
|
10
19
|
border-radius: getCssVar("radius", "medium");
|
|
11
|
-
padding: 4px;
|
|
12
|
-
margin-bottom: 4px;
|
|
20
|
+
padding: 0 4px;
|
|
13
21
|
color: getCssVar("color", "text-1");
|
|
14
22
|
cursor: pointer;
|
|
15
23
|
overflow: hidden;
|
|
24
|
+
display: flex;
|
|
25
|
+
align-items: center;
|
|
16
26
|
|
|
17
27
|
&:hover {
|
|
18
28
|
background-color: getCssVar("color", "fill-2");
|
|
19
29
|
}
|
|
20
|
-
&:last-child {
|
|
21
|
-
margin-bottom: 0;
|
|
22
|
-
}
|
|
23
30
|
@include when(selected) {
|
|
24
31
|
background-color: getCssVar("color", "fill-2");
|
|
25
32
|
color: getCssVar("color", "primary-6");
|
|
@@ -35,19 +42,30 @@
|
|
|
35
42
|
}
|
|
36
43
|
}
|
|
37
44
|
}
|
|
45
|
+
|
|
46
|
+
@each $size in $size-list {
|
|
47
|
+
@include when(#{$size}) {
|
|
48
|
+
height: getCssVar("size", $size);
|
|
49
|
+
@include be(tree, extra) {
|
|
50
|
+
height: getCssVar("size", $size);
|
|
51
|
+
width: getCssVar("size", $size);
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
}
|
|
38
55
|
}
|
|
39
56
|
|
|
40
57
|
@include e(content) {
|
|
41
58
|
display: flex;
|
|
42
59
|
align-items: center;
|
|
43
60
|
font-size: 14px;
|
|
44
|
-
gap:
|
|
61
|
+
gap: 4px;
|
|
62
|
+
width: 100%;
|
|
63
|
+
height: 100%;
|
|
45
64
|
}
|
|
46
65
|
|
|
47
66
|
@include e(expand-icon) {
|
|
48
67
|
height: 18px;
|
|
49
68
|
width: 18px;
|
|
50
|
-
font-size: 14px;
|
|
51
69
|
border-radius: getCssVar("radius", "circle");
|
|
52
70
|
display: flex;
|
|
53
71
|
align-items: center;
|
|
@@ -65,6 +83,34 @@
|
|
|
65
83
|
}
|
|
66
84
|
}
|
|
67
85
|
|
|
86
|
+
@include e(checkbox) {
|
|
87
|
+
padding: 0 4px;
|
|
88
|
+
display: flex;
|
|
89
|
+
align-items: center;
|
|
90
|
+
justify-content: center;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
@include e(node-icon) {
|
|
94
|
+
display: flex;
|
|
95
|
+
align-items: center;
|
|
96
|
+
justify-content: center;
|
|
97
|
+
height: 24px;
|
|
98
|
+
width: 24px;
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
@include e(label) {
|
|
102
|
+
height: 100%;
|
|
103
|
+
flex: 1;
|
|
104
|
+
display: flex;
|
|
105
|
+
align-items: center;
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
@include e(extra) {
|
|
109
|
+
display: flex;
|
|
110
|
+
align-items: center;
|
|
111
|
+
justify-content: center;
|
|
112
|
+
}
|
|
113
|
+
|
|
68
114
|
.tree-list-move,
|
|
69
115
|
.tree-list-enter-active,
|
|
70
116
|
.tree-list-leave-active {
|
|
@@ -1362,6 +1362,26 @@
|
|
|
1362
1362
|
"s-menu/scrollbarProps": {
|
|
1363
1363
|
"description": "滚动条属性"
|
|
1364
1364
|
},
|
|
1365
|
+
"s-menu/bgColor": {
|
|
1366
|
+
"description": "背景颜色",
|
|
1367
|
+
"type": "string"
|
|
1368
|
+
},
|
|
1369
|
+
"s-menu/textColor": {
|
|
1370
|
+
"description": "文本颜色",
|
|
1371
|
+
"type": "string"
|
|
1372
|
+
},
|
|
1373
|
+
"s-menu/activeTextColor": {
|
|
1374
|
+
"description": "选中文本颜色",
|
|
1375
|
+
"type": "string"
|
|
1376
|
+
},
|
|
1377
|
+
"s-menu/activeBgColor": {
|
|
1378
|
+
"description": "选中背景颜色",
|
|
1379
|
+
"type": "string"
|
|
1380
|
+
},
|
|
1381
|
+
"s-menu/hoverBgColor": {
|
|
1382
|
+
"description": "鼠标悬停背景颜色",
|
|
1383
|
+
"type": "string"
|
|
1384
|
+
},
|
|
1365
1385
|
"s-menu-item/name": {
|
|
1366
1386
|
"description": "菜单键值",
|
|
1367
1387
|
"type": "string | number"
|
|
@@ -1564,6 +1584,9 @@
|
|
|
1564
1584
|
"description": "是否开启拖动弹窗",
|
|
1565
1585
|
"type": "boolean"
|
|
1566
1586
|
},
|
|
1587
|
+
"s-modal/type": {
|
|
1588
|
+
"description": "弹窗图标类型(default不显示)"
|
|
1589
|
+
},
|
|
1567
1590
|
"s-modal/className": {
|
|
1568
1591
|
"description": "弹窗自定义类名",
|
|
1569
1592
|
"type": "string"
|
|
@@ -2615,6 +2638,9 @@
|
|
|
2615
2638
|
"description": "—",
|
|
2616
2639
|
"type": "string"
|
|
2617
2640
|
},
|
|
2641
|
+
"s-tree/size": {
|
|
2642
|
+
"description": "树节点大小"
|
|
2643
|
+
},
|
|
2618
2644
|
"s-tree/selectable": {
|
|
2619
2645
|
"description": "是否可选择节点",
|
|
2620
2646
|
"type": "boolean"
|
|
@@ -587,7 +587,12 @@
|
|
|
587
587
|
"openKeys",
|
|
588
588
|
"selectedKey",
|
|
589
589
|
"accordion",
|
|
590
|
-
"scrollbarProps"
|
|
590
|
+
"scrollbarProps",
|
|
591
|
+
"bgColor",
|
|
592
|
+
"textColor",
|
|
593
|
+
"activeTextColor",
|
|
594
|
+
"activeBgColor",
|
|
595
|
+
"hoverBgColor"
|
|
591
596
|
]
|
|
592
597
|
},
|
|
593
598
|
"s-menu-item": {
|
|
@@ -669,6 +674,7 @@
|
|
|
669
674
|
"mask",
|
|
670
675
|
"to",
|
|
671
676
|
"draggable",
|
|
677
|
+
"type",
|
|
672
678
|
"className",
|
|
673
679
|
"modalStyle",
|
|
674
680
|
"maskStyle",
|
|
@@ -1088,6 +1094,7 @@
|
|
|
1088
1094
|
"label",
|
|
1089
1095
|
"key",
|
|
1090
1096
|
"children",
|
|
1097
|
+
"size",
|
|
1091
1098
|
"selectable",
|
|
1092
1099
|
"selectKeys",
|
|
1093
1100
|
"checkable",
|
package/dist/json/web-types.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"$schema": "https://raw.githubusercontent.com/JetBrains/web-types/master/schema/web-types.json",
|
|
3
3
|
"framework": "vue",
|
|
4
4
|
"name": "savor-ui",
|
|
5
|
-
"version": "0.
|
|
5
|
+
"version": "0.17.0",
|
|
6
6
|
"contributions": {
|
|
7
7
|
"html": {
|
|
8
8
|
"types-syntax": "typescript",
|
|
@@ -3571,6 +3571,46 @@
|
|
|
3571
3571
|
"type": "ScrollbarProps",
|
|
3572
3572
|
"kind": "expression"
|
|
3573
3573
|
}
|
|
3574
|
+
},
|
|
3575
|
+
{
|
|
3576
|
+
"name": "bgColor",
|
|
3577
|
+
"description": "背景颜色",
|
|
3578
|
+
"value": {
|
|
3579
|
+
"type": "string",
|
|
3580
|
+
"kind": "expression"
|
|
3581
|
+
}
|
|
3582
|
+
},
|
|
3583
|
+
{
|
|
3584
|
+
"name": "textColor",
|
|
3585
|
+
"description": "文本颜色",
|
|
3586
|
+
"value": {
|
|
3587
|
+
"type": "string",
|
|
3588
|
+
"kind": "expression"
|
|
3589
|
+
}
|
|
3590
|
+
},
|
|
3591
|
+
{
|
|
3592
|
+
"name": "activeTextColor",
|
|
3593
|
+
"description": "选中文本颜色",
|
|
3594
|
+
"value": {
|
|
3595
|
+
"type": "string",
|
|
3596
|
+
"kind": "expression"
|
|
3597
|
+
}
|
|
3598
|
+
},
|
|
3599
|
+
{
|
|
3600
|
+
"name": "activeBgColor",
|
|
3601
|
+
"description": "选中背景颜色",
|
|
3602
|
+
"value": {
|
|
3603
|
+
"type": "string",
|
|
3604
|
+
"kind": "expression"
|
|
3605
|
+
}
|
|
3606
|
+
},
|
|
3607
|
+
{
|
|
3608
|
+
"name": "hoverBgColor",
|
|
3609
|
+
"description": "鼠标悬停背景颜色",
|
|
3610
|
+
"value": {
|
|
3611
|
+
"type": "string",
|
|
3612
|
+
"kind": "expression"
|
|
3613
|
+
}
|
|
3574
3614
|
}
|
|
3575
3615
|
],
|
|
3576
3616
|
"events": [
|
|
@@ -4095,6 +4135,14 @@
|
|
|
4095
4135
|
"kind": "expression"
|
|
4096
4136
|
}
|
|
4097
4137
|
},
|
|
4138
|
+
{
|
|
4139
|
+
"name": "type",
|
|
4140
|
+
"description": "弹窗图标类型(default不显示)",
|
|
4141
|
+
"value": {
|
|
4142
|
+
"type": "default | warning | primary | info | success | danger",
|
|
4143
|
+
"kind": "expression"
|
|
4144
|
+
}
|
|
4145
|
+
},
|
|
4098
4146
|
{
|
|
4099
4147
|
"name": "className",
|
|
4100
4148
|
"description": "弹窗自定义类名",
|
|
@@ -6686,6 +6734,14 @@
|
|
|
6686
6734
|
"kind": "expression"
|
|
6687
6735
|
}
|
|
6688
6736
|
},
|
|
6737
|
+
{
|
|
6738
|
+
"name": "size",
|
|
6739
|
+
"description": "树节点大小",
|
|
6740
|
+
"value": {
|
|
6741
|
+
"type": "mini | small | medium | large",
|
|
6742
|
+
"kind": "expression"
|
|
6743
|
+
}
|
|
6744
|
+
},
|
|
6689
6745
|
{
|
|
6690
6746
|
"name": "selectable",
|
|
6691
6747
|
"description": "是否可选择节点",
|
|
@@ -6785,7 +6841,16 @@
|
|
|
6785
6841
|
"description": "节点展开变化事件"
|
|
6786
6842
|
}
|
|
6787
6843
|
],
|
|
6788
|
-
"slots": [
|
|
6844
|
+
"slots": [
|
|
6845
|
+
{
|
|
6846
|
+
"name": "icon",
|
|
6847
|
+
"description": "自定义节点图标槽位"
|
|
6848
|
+
},
|
|
6849
|
+
{
|
|
6850
|
+
"name": "extra",
|
|
6851
|
+
"description": "自定义节点额外槽位"
|
|
6852
|
+
}
|
|
6853
|
+
]
|
|
6789
6854
|
},
|
|
6790
6855
|
{
|
|
6791
6856
|
"name": "s-tree-select",
|