savor-ui 0.11.0 → 0.12.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 +7 -0
- package/dist/es/components/index.d.ts +1 -0
- package/dist/es/components/index.mjs +5 -4
- package/dist/es/components/src/cascader/cascader-column.d.ts +9 -1
- package/dist/es/components/src/cascader/cascader-column.vue_vue_type_script_setup_true_vapor_true_lang.mjs +117 -56
- package/dist/es/components/src/cascader/cascader.d.ts +2 -0
- package/dist/es/components/src/cascader/cascader.vue_vue_type_script_setup_true_vapor_true_lang.mjs +73 -55
- package/dist/es/components/src/cascader/index.d.ts +3 -2
- package/dist/es/components/src/cascader/types.d.ts +10 -11
- package/dist/es/components/src/modal/modal.vue_vue_type_script_setup_true_vapor_true_lang.mjs +2 -4
- package/dist/es/components/src/radio/radio.vue_vue_type_script_setup_true_vapor_true_lang.mjs +9 -9
- package/dist/es/components/src/tree/index.d.ts +1 -0
- package/dist/es/components/src/tree/tree.vue_vue_type_script_setup_true_vapor_true_lang.mjs +62 -40
- package/dist/es/components/src/tree/types.d.ts +4 -8
- package/dist/es/components/src/tree-select/index.d.ts +48 -0
- package/dist/es/components/src/tree-select/index.mjs +7 -0
- package/dist/es/components/src/tree-select/tree-select.d.ts +31 -0
- package/dist/es/components/src/tree-select/tree-select.vue.mjs +5 -0
- package/dist/es/components/src/tree-select/tree-select.vue_vue_type_script_setup_true_vapor_true_lang.mjs +284 -0
- package/dist/es/components/src/tree-select/types.d.ts +82 -0
- package/dist/es/core/components.mjs +65 -63
- package/dist/es/core/global.d.ts +1 -0
- package/dist/es/core/index.mjs +53 -52
- package/dist/es/theme/components/cascader.scss +6 -0
- package/dist/es/theme/components/index.scss +1 -0
- package/dist/es/theme/components/modal.scss +2 -1
- package/dist/es/theme/components/tree-select.scss +112 -0
- package/dist/json/vetur-attributes.json +86 -23
- package/dist/json/vetur-tags.json +29 -10
- package/dist/json/web-types.json +206 -52
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,13 @@
|
|
|
2
2
|
|
|
3
3
|
|
|
4
4
|
|
|
5
|
+
# [0.12.0](https://gitee.com/mach552/savor-ui/compare/v0.11.0...v0.12.0) (2026-07-15)
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
### Features
|
|
9
|
+
|
|
10
|
+
* **tree-select:** 新增树形选择组件 ([a80cde0](https://gitee.com/mach552/savor-ui/commits/a80cde086fe7598a06bed498ba344f5de03d82e3))
|
|
11
|
+
|
|
5
12
|
# [0.11.0](https://gitee.com/mach552/savor-ui/compare/v0.10.1...v0.11.0) (2026-07-14)
|
|
6
13
|
|
|
7
14
|
|
|
@@ -63,6 +63,7 @@ export * from './src/timeline';
|
|
|
63
63
|
export * from './src/tooltip';
|
|
64
64
|
export * from './src/transition';
|
|
65
65
|
export * from './src/tree';
|
|
66
|
+
export * from './src/tree-select';
|
|
66
67
|
export * from './src/upload';
|
|
67
68
|
export * from './src/virtual-list';
|
|
68
69
|
export * from './src/waterfall';
|
|
@@ -18,11 +18,13 @@ import "./src/button/index.mjs";
|
|
|
18
18
|
import "./src/card/index.mjs";
|
|
19
19
|
import "./src/carousel/index.mjs";
|
|
20
20
|
import "./src/empty/index.mjs";
|
|
21
|
+
import "./src/checkbox/types.mjs";
|
|
22
|
+
import "./src/checkbox/index.mjs";
|
|
23
|
+
import "./src/radio/types.mjs";
|
|
24
|
+
import "./src/radio/index.mjs";
|
|
21
25
|
import "./src/cascader/index.mjs";
|
|
22
26
|
import "./src/chat-list/index.mjs";
|
|
23
27
|
import "./src/chat-sender/index.mjs";
|
|
24
|
-
import "./src/checkbox/types.mjs";
|
|
25
|
-
import "./src/checkbox/index.mjs";
|
|
26
28
|
import "./src/transition/index.mjs";
|
|
27
29
|
import "./src/collapse/types.mjs";
|
|
28
30
|
import "./src/collapse/index.mjs";
|
|
@@ -62,8 +64,6 @@ import "./src/modal/index.mjs";
|
|
|
62
64
|
import "./src/pagination/index.mjs";
|
|
63
65
|
import "./src/panel/index.mjs";
|
|
64
66
|
import "./src/progress/index.mjs";
|
|
65
|
-
import "./src/radio/types.mjs";
|
|
66
|
-
import "./src/radio/index.mjs";
|
|
67
67
|
import "./src/segmented/index.mjs";
|
|
68
68
|
import "./src/skeleton/index.mjs";
|
|
69
69
|
import "./src/slider-verify/index.mjs";
|
|
@@ -83,6 +83,7 @@ import "./src/timeline/types.mjs";
|
|
|
83
83
|
import "./src/timeline/index.mjs";
|
|
84
84
|
import "./src/tree/types.mjs";
|
|
85
85
|
import "./src/tree/index.mjs";
|
|
86
|
+
import "./src/tree-select/index.mjs";
|
|
86
87
|
import "./src/upload/index.mjs";
|
|
87
88
|
import "./src/virtual-list/index.mjs";
|
|
88
89
|
import "./src/waterfall/index.mjs";
|
|
@@ -10,8 +10,14 @@ declare const __VLS_export: (__VLS_props: NonNullable<Awaited<typeof __VLS_setup
|
|
|
10
10
|
key?: string;
|
|
11
11
|
children?: string;
|
|
12
12
|
};
|
|
13
|
-
/**
|
|
13
|
+
/** 是否允许选中非叶子节点(使用 radio 单选) */
|
|
14
14
|
checkStrictly?: boolean;
|
|
15
|
+
/** 是否支持多选(使用 checkbox) */
|
|
16
|
+
multiple?: boolean;
|
|
17
|
+
/** 是否返回完整路径字符串 */
|
|
18
|
+
pathMode?: boolean;
|
|
19
|
+
/** 路径分隔符 */
|
|
20
|
+
pathSeparator?: string;
|
|
15
21
|
} & {
|
|
16
22
|
modelValue?: string | number | Array<string | number>;
|
|
17
23
|
expandedKeys?: Array<string | number>;
|
|
@@ -22,6 +28,7 @@ declare const __VLS_export: (__VLS_props: NonNullable<Awaited<typeof __VLS_setup
|
|
|
22
28
|
onClickItem?: ((args_0: {
|
|
23
29
|
item: CascaderOption;
|
|
24
30
|
expandeds: CascaderOption[];
|
|
31
|
+
unchecked?: boolean;
|
|
25
32
|
}) => any) | undefined;
|
|
26
33
|
"onUpdate:expandedKeys"?: ((value: (string | number)[]) => any) | undefined;
|
|
27
34
|
"onUpdate:expanded"?: ((value: CascaderOption[]) => any) | undefined;
|
|
@@ -34,6 +41,7 @@ declare const __VLS_export: (__VLS_props: NonNullable<Awaited<typeof __VLS_setup
|
|
|
34
41
|
emit: (((evt: "expand", expandKeys: (string | number)[]) => void) & ((evt: "clickItem", args_0: {
|
|
35
42
|
item: CascaderOption;
|
|
36
43
|
expandeds: CascaderOption[];
|
|
44
|
+
unchecked?: boolean;
|
|
37
45
|
}) => void)) & (((event: "update:modelValue", value: string | number | (string | number)[]) => void) & ((event: "update:expandedKeys", value: (string | number)[]) => void) & ((event: "update:expanded", value: CascaderOption[]) => void));
|
|
38
46
|
}>) => VNode & {
|
|
39
47
|
__ctx?: Awaited<typeof __VLS_setup>;
|
|
@@ -3,12 +3,14 @@ import "../../../hooks/index.mjs";
|
|
|
3
3
|
import t from "../../../icons/src/right.vue.mjs";
|
|
4
4
|
import "../../../icons/index.mjs";
|
|
5
5
|
import { SScrollbar as n } from "../scrollbar/index.mjs";
|
|
6
|
-
import {
|
|
6
|
+
import { SCheckbox as r } from "../checkbox/index.mjs";
|
|
7
|
+
import { SRadio as i } from "../radio/index.mjs";
|
|
8
|
+
import { child as a, computed as o, createComponent as s, createComponentWithFallback as c, createFor as l, createIf as u, defineVaporComponent as d, mergeModels as f, nextTick as p, on as m, onMounted as h, ref as g, renderEffect as _, resolveComponent as v, setClass as y, setInsertionState as b, setProp as x, setStaticTemplateRef as S, setStyle as C, setText as w, template as T, toDisplayString as E, txt as D, unref as O, useModel as k, useTemplateRef as ee, watch as A, withModifiers as j } from "vue";
|
|
7
9
|
//#region ../components/src/cascader/cascader-column.vue?vue&type=script&setup=true&vapor=true&lang.ts
|
|
8
|
-
var
|
|
10
|
+
var M = T("<div>"), N = T("<div><div> </div>"), P = /*@__PURE__*/ d({
|
|
9
11
|
name: "SCascaderColumn",
|
|
10
12
|
__name: "cascader-column",
|
|
11
|
-
props: /*@__PURE__*/
|
|
13
|
+
props: /*@__PURE__*/ f({
|
|
12
14
|
options: { default: () => [] },
|
|
13
15
|
id: { default: 0 },
|
|
14
16
|
expandTrigger: { default: "click" },
|
|
@@ -20,7 +22,16 @@ var A = S("<div>"), j = S("<div><div> </div>"), M = /*@__PURE__*/ l({
|
|
|
20
22
|
checkStrictly: {
|
|
21
23
|
type: Boolean,
|
|
22
24
|
default: !1
|
|
23
|
-
}
|
|
25
|
+
},
|
|
26
|
+
multiple: {
|
|
27
|
+
type: Boolean,
|
|
28
|
+
default: !1
|
|
29
|
+
},
|
|
30
|
+
pathMode: {
|
|
31
|
+
type: Boolean,
|
|
32
|
+
default: !1
|
|
33
|
+
},
|
|
34
|
+
pathSeparator: { default: "/" }
|
|
24
35
|
}, {
|
|
25
36
|
modelValue: { default: void 0 },
|
|
26
37
|
modelModifiers: {},
|
|
@@ -29,78 +40,128 @@ var A = S("<div>"), j = S("<div><div> </div>"), M = /*@__PURE__*/ l({
|
|
|
29
40
|
expanded: { default: () => [] },
|
|
30
41
|
expandedModifiers: {}
|
|
31
42
|
}),
|
|
32
|
-
emits: /*@__PURE__*/
|
|
43
|
+
emits: /*@__PURE__*/ f(["clickItem", "expand"], [
|
|
33
44
|
"update:modelValue",
|
|
34
45
|
"update:expandedKeys",
|
|
35
46
|
"update:expanded"
|
|
36
47
|
]),
|
|
37
48
|
__multiRoot: !0,
|
|
38
|
-
setup(
|
|
39
|
-
let
|
|
49
|
+
setup(d, { emit: f }) {
|
|
50
|
+
let T = f, P = d, F = f, I = e("cascader"), L = o(() => ({
|
|
40
51
|
label: "label",
|
|
41
52
|
key: "key",
|
|
42
53
|
children: "children",
|
|
43
|
-
...
|
|
44
|
-
})),
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
54
|
+
...P.fieldNames
|
|
55
|
+
})), R = ee("scrollbarRef"), z = k(d, "modelValue"), B = k(d, "expandedKeys"), V = k(d, "expanded"), H = g([]), U = g([]), W = g(!0), G = o(() => {
|
|
56
|
+
let e = z.value;
|
|
57
|
+
if (!Array.isArray(e)) {
|
|
58
|
+
if (P.pathMode && typeof e == "string" && e !== "") {
|
|
59
|
+
let t = e.split(P.pathSeparator);
|
|
60
|
+
return t[t.length - 1];
|
|
61
|
+
}
|
|
62
|
+
return e;
|
|
63
|
+
}
|
|
64
|
+
}), K = (e) => [...V.value.slice(0, P.id), e], q = (e) => {
|
|
65
|
+
if (!Array.isArray(z.value)) return !1;
|
|
66
|
+
if (P.pathMode) {
|
|
67
|
+
let t = K(e).map((e) => e[L.value.key]).join(P.pathSeparator);
|
|
68
|
+
return z.value.includes(t);
|
|
69
|
+
}
|
|
70
|
+
return z.value.includes(e[L.value.key]);
|
|
71
|
+
}, J = (e) => {
|
|
72
|
+
Z(e), e.isFolder ? (U.value = [], U.value = e.children || [], W.value = !0) : !P.checkStrictly && !P.multiple && (U.value = [], F("clickItem", {
|
|
49
73
|
item: e,
|
|
50
|
-
expandeds:
|
|
74
|
+
expandeds: K(e)
|
|
51
75
|
}));
|
|
52
|
-
},
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
76
|
+
}, Y = (e) => {
|
|
77
|
+
F("clickItem", {
|
|
78
|
+
item: e,
|
|
79
|
+
expandeds: K(e)
|
|
80
|
+
});
|
|
81
|
+
}, X = (e, t) => {
|
|
82
|
+
F("clickItem", {
|
|
83
|
+
item: t,
|
|
84
|
+
expandeds: K(t),
|
|
85
|
+
unchecked: !e
|
|
86
|
+
});
|
|
87
|
+
}, Z = (e) => {
|
|
88
|
+
V.value.splice(P.id + 1), V.value[P.id] = e, B.value.splice(P.id + 1), B.value[P.id] = e[L.value.key], F("expand", B.value);
|
|
89
|
+
}, te = (e) => {
|
|
90
|
+
P.expandTrigger === "hover" && (Z(e), e.isFolder && (U.value = [], U.value = e[L.value.children] || [], W.value = !0));
|
|
91
|
+
}, Q = () => {
|
|
92
|
+
U.value = [], H.value.forEach((e) => {
|
|
93
|
+
e[L.value.children] && e[L.value.children].length > 0 && (e.isFolder = !0, B.value?.[P.id] === e[L.value.key] && (U.value = e[L.value.children], W.value = !0));
|
|
59
94
|
});
|
|
60
95
|
};
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
}, { immediate: !0 }),
|
|
64
|
-
|
|
65
|
-
}),
|
|
66
|
-
|
|
96
|
+
A(() => P.options, () => {
|
|
97
|
+
W.value = !1, H.value = P.options, Q();
|
|
98
|
+
}, { immediate: !0 }), A(() => [...B.value], () => {
|
|
99
|
+
Q();
|
|
100
|
+
}), h(() => {
|
|
101
|
+
p(() => {
|
|
67
102
|
requestAnimationFrame(() => {
|
|
68
|
-
|
|
103
|
+
R.value?.scrollToEl(`item-${B.value[P.id]}`, !1);
|
|
69
104
|
});
|
|
70
105
|
});
|
|
71
106
|
});
|
|
72
|
-
let
|
|
73
|
-
return
|
|
74
|
-
let e =
|
|
75
|
-
return
|
|
76
|
-
let n =
|
|
77
|
-
|
|
78
|
-
let t =
|
|
79
|
-
|
|
80
|
-
}),
|
|
81
|
-
let
|
|
82
|
-
return
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
107
|
+
let ne = v("CascaderColumn", !0), $ = M();
|
|
108
|
+
return _(() => y($, [O(I).e("column")])), b($, null, 0), S(s(O(n), { height: "100%" }, () => {
|
|
109
|
+
let e = M();
|
|
110
|
+
return _(() => y(e, [O(I).e("list")])), b(e, null, 0), l(() => H.value, (e) => {
|
|
111
|
+
let n = N(), o = a(n, 1);
|
|
112
|
+
_(() => {
|
|
113
|
+
let t = O(I), r = L.value;
|
|
114
|
+
y(n, [t.e("item"), t.is("checked", e.value[r.key] === B.value[d.id])]);
|
|
115
|
+
}), b(n, 0, 0), u(() => d.checkStrictly || d.multiple, () => {
|
|
116
|
+
let t = M();
|
|
117
|
+
return _(() => y(t, [O(I).e("check")])), b(t, null, 0), u(() => d.checkStrictly && !d.multiple, () => {
|
|
118
|
+
let t = () => Y(e.value), n = () => {};
|
|
119
|
+
return s(O(i), {
|
|
120
|
+
value: () => e.value[L.value.key],
|
|
121
|
+
"model-value": () => G.value,
|
|
122
|
+
onChange: () => t,
|
|
123
|
+
onClick: () => j(n, ["stop"])
|
|
124
|
+
});
|
|
125
|
+
}, () => u(() => d.multiple, () => {
|
|
126
|
+
let t = (t) => X(t, e.value), n = () => {};
|
|
127
|
+
return s(O(r), {
|
|
128
|
+
"model-value": () => q(e.value),
|
|
129
|
+
onChange: () => t,
|
|
130
|
+
onClick: () => j(n, ["stop"])
|
|
131
|
+
});
|
|
132
|
+
}), 261), t;
|
|
133
|
+
});
|
|
134
|
+
let c = D(o);
|
|
135
|
+
return _(() => {
|
|
136
|
+
let t = L.value;
|
|
137
|
+
y(o, [O(I).e("label")]), C(o, { padding: d.checkStrictly || d.multiple ? "0 12px" : "0 16px" }), w(c, E(e.value[t.label]));
|
|
138
|
+
}), b(n, null, 2), u(() => e.value.isFolder, () => {
|
|
139
|
+
let e = M();
|
|
140
|
+
return _(() => y(e, [O(I).e("arrow")])), b(e, null, 0), s(O(t)), e;
|
|
141
|
+
}), m(n, "click", j(() => J(e.value), ["stop"])), m(n, "mouseenter", j(() => te(e.value), ["stop"])), x(n, "id", `item-${e.value[L.value.key]}`), n;
|
|
142
|
+
}, (e) => e[L.value.key], 9), e;
|
|
143
|
+
}), R, null, "scrollbarRef"), [$, u(() => U.value.length > 0 && W.value, () => {
|
|
144
|
+
let e = (e) => T("clickItem", e), t = (e) => T("expand", e);
|
|
145
|
+
return c(ne, {
|
|
146
|
+
options: () => U.value,
|
|
89
147
|
onClickItem: () => e,
|
|
90
148
|
onExpand: () => t,
|
|
91
|
-
modelValue: () =>
|
|
92
|
-
"onUpdate:modelValue": () => (e) =>
|
|
93
|
-
expanded: () =>
|
|
94
|
-
"onUpdate:expanded": () => (e) =>
|
|
95
|
-
expandedKeys: () =>
|
|
96
|
-
"onUpdate:expandedKeys": () => (e) =>
|
|
97
|
-
id: () =>
|
|
98
|
-
fieldNames: () =>
|
|
99
|
-
expandTrigger: () =>
|
|
100
|
-
checkStrictly: () =>
|
|
149
|
+
modelValue: () => z.value,
|
|
150
|
+
"onUpdate:modelValue": () => (e) => z.value = e,
|
|
151
|
+
expanded: () => V.value,
|
|
152
|
+
"onUpdate:expanded": () => (e) => V.value = e,
|
|
153
|
+
expandedKeys: () => B.value,
|
|
154
|
+
"onUpdate:expandedKeys": () => (e) => B.value = e,
|
|
155
|
+
id: () => d.id + 1,
|
|
156
|
+
fieldNames: () => d.fieldNames,
|
|
157
|
+
expandTrigger: () => d.expandTrigger,
|
|
158
|
+
checkStrictly: () => d.checkStrictly,
|
|
159
|
+
multiple: () => d.multiple,
|
|
160
|
+
pathMode: () => d.pathMode,
|
|
161
|
+
pathSeparator: () => d.pathSeparator
|
|
101
162
|
});
|
|
102
163
|
})];
|
|
103
164
|
}
|
|
104
165
|
});
|
|
105
166
|
//#endregion
|
|
106
|
-
export {
|
|
167
|
+
export { P as default };
|
|
@@ -14,6 +14,7 @@ declare const __VLS_export: (__VLS_props: NonNullable<Awaited<typeof __VLS_setup
|
|
|
14
14
|
onSelectItem?: ((args_0: {
|
|
15
15
|
item?: CascaderOption;
|
|
16
16
|
expandeds?: CascaderOption[];
|
|
17
|
+
unchecked?: boolean;
|
|
17
18
|
}) => any) | undefined;
|
|
18
19
|
}> & (typeof globalThis extends {
|
|
19
20
|
__VLS_PROPS_FALLBACK: infer P;
|
|
@@ -24,6 +25,7 @@ declare const __VLS_export: (__VLS_props: NonNullable<Awaited<typeof __VLS_setup
|
|
|
24
25
|
emit: (((evt: "clear") => void) & ((evt: "expand", expandKeys?: (string | number)[] | undefined) => void) & ((evt: "selectItem", args_0: {
|
|
25
26
|
item?: CascaderOption;
|
|
26
27
|
expandeds?: CascaderOption[];
|
|
28
|
+
unchecked?: boolean;
|
|
27
29
|
}) => void)) & (((event: "update:modelValue", value: string | number | (string | number)[]) => void) & ((event: "update:expandedKeys", value: (string | number)[]) => void) & ((event: "update:expanded", value: CascaderOption[]) => void));
|
|
28
30
|
}>) => VNode & {
|
|
29
31
|
__ctx?: Awaited<typeof __VLS_setup>;
|
package/dist/es/components/src/cascader/cascader.vue_vue_type_script_setup_true_vapor_true_lang.mjs
CHANGED
|
@@ -7,11 +7,11 @@ import { SPopover as r } from "../popover/index.mjs";
|
|
|
7
7
|
import { SInput as i } from "../input/index.mjs";
|
|
8
8
|
import { SEmpty as a } from "../empty/index.mjs";
|
|
9
9
|
import o from "./cascader-column.vue.mjs";
|
|
10
|
-
import { computed as s, createComponent as c, createComponentWithFallback as l, createIf as u, createInvoker as d, createTemplateRefSetter as f, defineVaporComponent as p, delegateEvents as m, mergeModels as h, on as g, onMounted as _, ref as v, renderEffect as y, resolveComponent as
|
|
10
|
+
import { computed as s, createComponent as c, createComponentWithFallback as l, createIf as u, createInvoker as d, createTemplateRefSetter as f, defineVaporComponent as p, delegateEvents as m, mergeModels as h, on as g, onMounted as _, ref as v, renderEffect as y, resolveComponent as ee, setClass as b, setInsertionState as x, template as S, toRefs as C, unref as w, useModel as T, useTemplateRef as E, watch as te, withModifiers as ne } from "vue";
|
|
11
11
|
//#region ../components/src/cascader/cascader.vue?vue&type=script&setup=true&vapor=true&lang.ts
|
|
12
|
-
var
|
|
12
|
+
var re = S("<div style=\"padding: 12px\">"), D = S("<div>"), O = S("<div>", 1);
|
|
13
13
|
m("click");
|
|
14
|
-
var
|
|
14
|
+
var k = /*@__PURE__*/ p({
|
|
15
15
|
name: "SCascader",
|
|
16
16
|
__name: "cascader",
|
|
17
17
|
props: /*@__PURE__*/ h({
|
|
@@ -20,7 +20,6 @@ var M = /*@__PURE__*/ p({
|
|
|
20
20
|
placeholder: { default: "请选择" },
|
|
21
21
|
popoverProps: {},
|
|
22
22
|
pathMode: { type: Boolean },
|
|
23
|
-
pathTextMode: { type: Boolean },
|
|
24
23
|
pathSeparator: { default: "/" },
|
|
25
24
|
expandTrigger: { default: "click" },
|
|
26
25
|
fieldNames: { default: () => ({
|
|
@@ -33,7 +32,6 @@ var M = /*@__PURE__*/ p({
|
|
|
33
32
|
disabled: { type: Boolean },
|
|
34
33
|
clearable: { type: Boolean },
|
|
35
34
|
checkStrictly: { type: Boolean },
|
|
36
|
-
leafMode: { type: Boolean },
|
|
37
35
|
multiple: { type: Boolean }
|
|
38
36
|
}, {
|
|
39
37
|
modelValue: { default: void 0 },
|
|
@@ -53,22 +51,30 @@ var M = /*@__PURE__*/ p({
|
|
|
53
51
|
"update:expanded"
|
|
54
52
|
]),
|
|
55
53
|
setup(p, { emit: m }) {
|
|
56
|
-
let h = p,
|
|
57
|
-
size:
|
|
58
|
-
error:
|
|
59
|
-
}),
|
|
54
|
+
let h = p, S = e("cascader"), k = m, A = T(p, "modelValue"), { size: j, error: M } = C(h), { mergedSize: N, mergedError: P } = n({
|
|
55
|
+
size: j,
|
|
56
|
+
error: M
|
|
57
|
+
}), F = T(p, "expandedKeys"), I = T(p, "expanded"), L = s(() => ({
|
|
60
58
|
label: "label",
|
|
61
59
|
key: "key",
|
|
62
60
|
children: "children",
|
|
63
61
|
...h.fieldNames
|
|
64
|
-
})),
|
|
65
|
-
|
|
62
|
+
})), R = v(""), z = v([]), B = (e) => h.pathMode ? e.map((e) => e[L.value.key]).join(h.pathSeparator) : e[e.length - 1][L.value.key], V = (e) => e.map((e) => e[L.value.label]).join(h.pathSeparator), H = ({ item: e, expandeds: t, unchecked: n }) => {
|
|
63
|
+
if (h.multiple) {
|
|
64
|
+
let r = e[L.value.key], i = z.value.findIndex((e) => e[e.length - 1][L.value.key] === r);
|
|
65
|
+
n ? i !== -1 && (z.value = z.value.toSpliced(i, 1)) : i === -1 && (z.value = [...z.value, t]), A.value = z.value.map(B), R.value = z.value.map(V).join(", "), k("selectItem", {
|
|
66
|
+
item: e,
|
|
67
|
+
expandeds: t
|
|
68
|
+
});
|
|
69
|
+
return;
|
|
70
|
+
}
|
|
71
|
+
K(!1), R.value = V(t), A.value = B(t), k("selectItem", {
|
|
66
72
|
item: e,
|
|
67
73
|
expandeds: t
|
|
68
74
|
});
|
|
69
75
|
}, U = () => {
|
|
70
|
-
|
|
71
|
-
}, W =
|
|
76
|
+
k("expand", F.value);
|
|
77
|
+
}, W = E("popoverRef"), G = v(!1), K = (e) => {
|
|
72
78
|
G.value = e, e ? W.value?.show() : W.value?.hide();
|
|
73
79
|
}, q = () => {
|
|
74
80
|
let e = !G.value;
|
|
@@ -78,9 +84,9 @@ var M = /*@__PURE__*/ p({
|
|
|
78
84
|
}, Y = (e, t, n = []) => {
|
|
79
85
|
for (let r of e) {
|
|
80
86
|
let e = [...n, r];
|
|
81
|
-
if (r[
|
|
82
|
-
if (r[
|
|
83
|
-
let n = Y(r[
|
|
87
|
+
if (r[L.value.key] === t) return e;
|
|
88
|
+
if (r[L.value.children]) {
|
|
89
|
+
let n = Y(r[L.value.children], t, e);
|
|
84
90
|
if (n) return n;
|
|
85
91
|
}
|
|
86
92
|
}
|
|
@@ -88,79 +94,91 @@ var M = /*@__PURE__*/ p({
|
|
|
88
94
|
}, X = (e, t) => {
|
|
89
95
|
let n = [], r = e;
|
|
90
96
|
for (let e of t) {
|
|
91
|
-
let t = r.find((t) => t[
|
|
97
|
+
let t = r.find((t) => t[L.value.key] === e);
|
|
92
98
|
if (!t) return null;
|
|
93
|
-
n.push(t), r = t[
|
|
99
|
+
n.push(t), r = t[L.value.children] || [];
|
|
94
100
|
}
|
|
95
101
|
return n;
|
|
96
102
|
}, Z = () => {
|
|
97
|
-
if (
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
103
|
+
if (A.value === void 0 || A.value === "") return;
|
|
104
|
+
if (h.multiple) {
|
|
105
|
+
z.value = (Array.isArray(A.value) ? A.value : []).map((e) => {
|
|
106
|
+
if (h.pathMode && typeof e == "string") {
|
|
107
|
+
let t = e.split(h.pathSeparator);
|
|
108
|
+
return X(h.options, t);
|
|
109
|
+
}
|
|
110
|
+
return Y(h.options, e);
|
|
111
|
+
}).filter((e) => e !== null), R.value = z.value.map(V).join(", ");
|
|
112
|
+
return;
|
|
104
113
|
}
|
|
114
|
+
let e = null;
|
|
115
|
+
if (h.pathMode && typeof A.value == "string") {
|
|
116
|
+
let t = A.value.split(h.pathSeparator);
|
|
117
|
+
e = X(h.options, t);
|
|
118
|
+
} else e = Y(h.options, A.value);
|
|
119
|
+
e && (F.value = e.map((e) => e[L.value.key]), I.value = e, R.value = V(e));
|
|
105
120
|
}, Q = (e) => {
|
|
106
|
-
|
|
107
|
-
|
|
121
|
+
A.value === void 0 ? e.forEach((e) => {
|
|
122
|
+
F.value.includes(e[L.value.key]) && (R.value = R.value ? `${R.value}${h.pathSeparator}${e[L.value.label]}` : e[L.value.label], e[L.value.children] && Q(e[L.value.children]));
|
|
108
123
|
}) : Z();
|
|
109
|
-
},
|
|
110
|
-
|
|
124
|
+
}, ie = () => {
|
|
125
|
+
A.value = h.multiple ? [] : "", F.value = [], I.value = [], z.value = [], R.value = "", k("clear");
|
|
111
126
|
};
|
|
112
|
-
|
|
127
|
+
te(A, () => {
|
|
113
128
|
Z();
|
|
114
129
|
}), _(() => {
|
|
115
130
|
Q(h.options);
|
|
116
131
|
});
|
|
117
|
-
let
|
|
118
|
-
return y(() =>
|
|
132
|
+
let ae = f(), oe = ee("SIcon"), $ = O();
|
|
133
|
+
return y(() => b($, [w(S).b()])), x($, null, 0), ae(c(w(r), { $: [() => ({
|
|
119
134
|
offset: [0, 4],
|
|
120
135
|
placement: "bottom-start",
|
|
121
136
|
manual: !0,
|
|
122
137
|
...p.popoverProps
|
|
123
138
|
}), { onClickOutside: () => J }] }, {
|
|
124
139
|
content: () => {
|
|
125
|
-
let e =
|
|
126
|
-
return y(() =>
|
|
127
|
-
let e =
|
|
128
|
-
return
|
|
140
|
+
let e = D();
|
|
141
|
+
return y(() => b(e, [w(S).e("wrapper")])), x(e, null, 0), u(() => !p.options.length, () => {
|
|
142
|
+
let e = re();
|
|
143
|
+
return x(e, null, 0), c(w(a)), e;
|
|
129
144
|
}, () => {
|
|
130
|
-
let e =
|
|
131
|
-
return y(() =>
|
|
145
|
+
let e = D();
|
|
146
|
+
return y(() => b(e, [w(S).e("panel")])), x(e, null, 0), c(o, {
|
|
132
147
|
expandTrigger: () => p.expandTrigger,
|
|
133
148
|
fieldNames: () => p.fieldNames,
|
|
134
149
|
options: () => p.options,
|
|
135
150
|
checkStrictly: () => p.checkStrictly,
|
|
151
|
+
multiple: () => p.multiple,
|
|
152
|
+
pathMode: () => p.pathMode,
|
|
153
|
+
pathSeparator: () => p.pathSeparator,
|
|
136
154
|
onClickItem: () => H,
|
|
137
155
|
onExpand: () => U,
|
|
138
|
-
modelValue: () =>
|
|
139
|
-
"onUpdate:modelValue": () => (e) =>
|
|
140
|
-
expanded: () =>
|
|
141
|
-
"onUpdate:expanded": () => (e) =>
|
|
142
|
-
expandedKeys: () =>
|
|
143
|
-
"onUpdate:expandedKeys": () => (e) =>
|
|
156
|
+
modelValue: () => A.value,
|
|
157
|
+
"onUpdate:modelValue": () => (e) => A.value = e,
|
|
158
|
+
expanded: () => I.value,
|
|
159
|
+
"onUpdate:expanded": () => (e) => I.value = e,
|
|
160
|
+
expandedKeys: () => F.value,
|
|
161
|
+
"onUpdate:expandedKeys": () => (e) => F.value = e
|
|
144
162
|
}), e;
|
|
145
|
-
}, 261), g(e, "click",
|
|
163
|
+
}, 261), g(e, "click", ne(() => {}, ["stop"])), e;
|
|
146
164
|
},
|
|
147
|
-
default: () => c(
|
|
165
|
+
default: () => c(w(i), {
|
|
148
166
|
placeholder: () => p.placeholder,
|
|
149
167
|
disabled: () => p.disabled,
|
|
150
|
-
error: () =>
|
|
151
|
-
size: () =>
|
|
152
|
-
modelValue: () =>
|
|
153
|
-
"onUpdate:modelValue": () => (e) =>
|
|
168
|
+
error: () => w(P),
|
|
169
|
+
size: () => w(N),
|
|
170
|
+
modelValue: () => R.value,
|
|
171
|
+
"onUpdate:modelValue": () => (e) => R.value = e,
|
|
154
172
|
readonly: "",
|
|
155
173
|
clearable: () => p.clearable,
|
|
156
174
|
style: "width: 100%",
|
|
157
|
-
onClear: () =>
|
|
158
|
-
}, { suffix: () => l(
|
|
159
|
-
class: () => [
|
|
175
|
+
onClear: () => ie
|
|
176
|
+
}, { suffix: () => l(oe, {
|
|
177
|
+
class: () => [w(S).e("suffix-icon")],
|
|
160
178
|
style: () => ({ transform: G.value ? "rotate(180deg)" : "" })
|
|
161
|
-
}, () => c(
|
|
179
|
+
}, () => c(w(t))) })
|
|
162
180
|
}), W, null, "popoverRef"), $.$evtclick = d(q), $;
|
|
163
181
|
}
|
|
164
182
|
});
|
|
165
183
|
//#endregion
|
|
166
|
-
export {
|
|
184
|
+
export { k as default };
|
|
@@ -7,6 +7,7 @@ export declare const SCascader: ((__VLS_props: NonNullable<Awaited<typeof __VLS_
|
|
|
7
7
|
emit: (((evt: "clear") => void) & ((evt: "expand", expandKeys?: (string | number)[] | undefined) => void) & ((evt: "selectItem", args_0: {
|
|
8
8
|
item?: CascaderOption;
|
|
9
9
|
expandeds?: CascaderOption[];
|
|
10
|
+
unchecked?: boolean;
|
|
10
11
|
}) => void)) & (((event: "update:modelValue", value: string | number | (string | number)[]) => void) & ((event: "update:expandedKeys", value: (string | number)[]) => void) & ((event: "update:expanded", value: CascaderOption[]) => void));
|
|
11
12
|
}, __VLS_exposed?: NonNullable<Awaited<typeof __VLS_setup>>["expose"], __VLS_setup?: Promise<{
|
|
12
13
|
props: PublicProps & {
|
|
@@ -15,7 +16,6 @@ export declare const SCascader: ((__VLS_props: NonNullable<Awaited<typeof __VLS_
|
|
|
15
16
|
placeholder?: string | undefined;
|
|
16
17
|
popoverProps?: Partial< PopoverProps> | undefined;
|
|
17
18
|
pathMode?: boolean | undefined;
|
|
18
|
-
pathTextMode?: boolean | undefined;
|
|
19
19
|
pathSeparator?: string | undefined;
|
|
20
20
|
expandTrigger?: "click" | "hover" | undefined;
|
|
21
21
|
fieldNames?: {
|
|
@@ -28,7 +28,6 @@ export declare const SCascader: ((__VLS_props: NonNullable<Awaited<typeof __VLS_
|
|
|
28
28
|
disabled?: boolean | undefined;
|
|
29
29
|
clearable?: boolean | undefined;
|
|
30
30
|
checkStrictly?: boolean | undefined;
|
|
31
|
-
leafMode?: boolean | undefined;
|
|
32
31
|
multiple?: boolean | undefined;
|
|
33
32
|
expandedKeys?: Array<string | number> | undefined;
|
|
34
33
|
expanded?: CascaderOption[] | undefined;
|
|
@@ -40,6 +39,7 @@ export declare const SCascader: ((__VLS_props: NonNullable<Awaited<typeof __VLS_
|
|
|
40
39
|
onSelectItem?: ((args_0: {
|
|
41
40
|
item?: CascaderOption;
|
|
42
41
|
expandeds?: CascaderOption[];
|
|
42
|
+
unchecked?: boolean;
|
|
43
43
|
}) => any) | undefined;
|
|
44
44
|
} & (typeof globalThis extends {
|
|
45
45
|
__VLS_PROPS_FALLBACK: infer P;
|
|
@@ -50,6 +50,7 @@ export declare const SCascader: ((__VLS_props: NonNullable<Awaited<typeof __VLS_
|
|
|
50
50
|
emit: (((evt: "clear") => void) & ((evt: "expand", expandKeys?: (string | number)[] | undefined) => void) & ((evt: "selectItem", args_0: {
|
|
51
51
|
item?: CascaderOption;
|
|
52
52
|
expandeds?: CascaderOption[];
|
|
53
|
+
unchecked?: boolean;
|
|
53
54
|
}) => void)) & (((event: "update:modelValue", value: string | number | (string | number)[]) => void) & ((event: "update:expandedKeys", value: (string | number)[]) => void) & ((event: "update:expanded", value: CascaderOption[]) => void));
|
|
54
55
|
}>) => VNode & {
|
|
55
56
|
__ctx?: Awaited<typeof __VLS_setup>;
|
|
@@ -8,10 +8,10 @@ export interface CascaderProps {
|
|
|
8
8
|
placeholder?: string;
|
|
9
9
|
/** 弹出层属性 [PopoverProps](/components/other/popover#popover-props)*/
|
|
10
10
|
popoverProps?: Partial<PopoverProps>;
|
|
11
|
-
/**
|
|
11
|
+
/** 是否返回完整路径字符串
|
|
12
|
+
* @default false
|
|
13
|
+
*/
|
|
12
14
|
pathMode?: boolean;
|
|
13
|
-
/** 是否返回完整路径字符串 */
|
|
14
|
-
pathTextMode?: boolean;
|
|
15
15
|
/** 路径分隔符
|
|
16
16
|
* @default /
|
|
17
17
|
*/
|
|
@@ -36,10 +36,6 @@ export interface CascaderProps {
|
|
|
36
36
|
clearable?: boolean;
|
|
37
37
|
/** 是否严格选择子项 */
|
|
38
38
|
checkStrictly?: boolean;
|
|
39
|
-
/** 是否只返回叶子节点值
|
|
40
|
-
* @default false
|
|
41
|
-
*/
|
|
42
|
-
leafMode?: boolean;
|
|
43
39
|
/** 是否支持多选 */
|
|
44
40
|
multiple?: boolean;
|
|
45
41
|
}
|
|
@@ -52,10 +48,13 @@ export interface CascaderOption {
|
|
|
52
48
|
}
|
|
53
49
|
export interface CascaderEmits {
|
|
54
50
|
/** 选择项触发 */
|
|
55
|
-
selectItem: [
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
51
|
+
selectItem: [
|
|
52
|
+
{
|
|
53
|
+
item?: CascaderOption;
|
|
54
|
+
expandeds?: CascaderOption[];
|
|
55
|
+
unchecked?: boolean;
|
|
56
|
+
}
|
|
57
|
+
];
|
|
59
58
|
/** 展开下一级触发 */
|
|
60
59
|
expand: [expandKeys?: Array<string | number>];
|
|
61
60
|
/** 清除 */
|