savor-ui 0.11.0 → 0.12.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (33) hide show
  1. package/CHANGELOG.md +17 -0
  2. package/README.md +45 -11
  3. package/dist/es/components/index.d.ts +1 -0
  4. package/dist/es/components/index.mjs +5 -4
  5. package/dist/es/components/src/cascader/cascader-column.d.ts +9 -1
  6. package/dist/es/components/src/cascader/cascader-column.vue_vue_type_script_setup_true_vapor_true_lang.mjs +117 -56
  7. package/dist/es/components/src/cascader/cascader.d.ts +2 -0
  8. package/dist/es/components/src/cascader/cascader.vue_vue_type_script_setup_true_vapor_true_lang.mjs +73 -55
  9. package/dist/es/components/src/cascader/index.d.ts +3 -2
  10. package/dist/es/components/src/cascader/types.d.ts +10 -11
  11. package/dist/es/components/src/menu/sub-menu.vue_vue_type_script_setup_true_vapor_true_lang.mjs +1 -1
  12. package/dist/es/components/src/modal/modal.vue_vue_type_script_setup_true_vapor_true_lang.mjs +81 -81
  13. package/dist/es/components/src/radio/radio.vue_vue_type_script_setup_true_vapor_true_lang.mjs +9 -9
  14. package/dist/es/components/src/tree/index.d.ts +1 -0
  15. package/dist/es/components/src/tree/tree.vue_vue_type_script_setup_true_vapor_true_lang.mjs +62 -40
  16. package/dist/es/components/src/tree/types.d.ts +4 -8
  17. package/dist/es/components/src/tree-select/index.d.ts +48 -0
  18. package/dist/es/components/src/tree-select/index.mjs +7 -0
  19. package/dist/es/components/src/tree-select/tree-select.d.ts +31 -0
  20. package/dist/es/components/src/tree-select/tree-select.vue.mjs +5 -0
  21. package/dist/es/components/src/tree-select/tree-select.vue_vue_type_script_setup_true_vapor_true_lang.mjs +284 -0
  22. package/dist/es/components/src/tree-select/types.d.ts +82 -0
  23. package/dist/es/core/components.mjs +65 -63
  24. package/dist/es/core/global.d.ts +1 -0
  25. package/dist/es/core/index.mjs +53 -52
  26. package/dist/es/theme/components/cascader.scss +6 -0
  27. package/dist/es/theme/components/index.scss +1 -0
  28. package/dist/es/theme/components/modal.scss +2 -1
  29. package/dist/es/theme/components/tree-select.scss +112 -0
  30. package/dist/json/vetur-attributes.json +86 -23
  31. package/dist/json/vetur-tags.json +29 -10
  32. package/dist/json/web-types.json +206 -52
  33. package/package.json +1 -1
package/CHANGELOG.md CHANGED
@@ -2,6 +2,23 @@
2
2
 
3
3
 
4
4
 
5
+ ## [0.12.1](https://gitee.com/mach552/savor-ui/compare/v0.12.0...v0.12.1) (2026-07-16)
6
+
7
+
8
+ ### Bug Fixes
9
+
10
+ * **cascader:** 修复类型错误 ([84cd4a2](https://gitee.com/mach552/savor-ui/commits/84cd4a23c677746fa75446b00b66b9b76081f1d9))
11
+ * **menu:** 修复菜单的level错误问题 ([e956f57](https://gitee.com/mach552/savor-ui/commits/e956f573138984ce39af1ded97bc3ff9abb7f6a0))
12
+ * **modal:** 修复过渡组件报无子元素警告的问题 ([0e29418](https://gitee.com/mach552/savor-ui/commits/0e29418a85cd27f08b77cfbf9ed9ba9fe078f463))
13
+ * **modal:** 修复内容尺寸变化不居中的问题 ([0cb4e66](https://gitee.com/mach552/savor-ui/commits/0cb4e665a027cb5814b24c734516c450ff6aa3f6))
14
+
15
+ # [0.12.0](https://gitee.com/mach552/savor-ui/compare/v0.11.0...v0.12.0) (2026-07-15)
16
+
17
+
18
+ ### Features
19
+
20
+ * **tree-select:** 新增树形选择组件 ([a80cde0](https://gitee.com/mach552/savor-ui/commits/a80cde086fe7598a06bed498ba344f5de03d82e3))
21
+
5
22
  # [0.11.0](https://gitee.com/mach552/savor-ui/compare/v0.10.1...v0.11.0) (2026-07-14)
6
23
 
7
24
 
package/README.md CHANGED
@@ -1,39 +1,70 @@
1
- <H1 align="center">savor-ui</H1>
1
+ # savor-ui
2
2
 
3
- - 基于 Vue3 的UI组件库,仅支持 Vue Vapor 模式
3
+ 基于 Vue3 Vapor 模式打造的轻量自用 UI 组件库
4
+
5
+ **savor-ui** 是一款轻量级 UI 组件库,专为 **Vue Vapor 编译模式** 设计,针对性适配 Vapor 编译特性,全部采用**组合式 Api**编写,主打轻量化、高性能、高定制化,适配现代前端工程化开发场景。
6
+
7
+ 本组件库为个人自用开源组件库,整合多款主流优秀 Vue UI 组件库的设计思路与交互逻辑,优化适配 Vapor 专属编译规则,保留简洁易用的开发体验,同时支持灵活的主题自定义能力,满足日常后台系统、中后台业务页面开发需求。
8
+
9
+ - **专属适配**:仅支持 Vue3 Vapor 编译模式,不兼容 Runtime 模式,深度适配 Vapor 编译优化特性,打包体积更小、运行性能更高
10
+
11
+ - **轻量高效**:组件轻量化封装,无冗余依赖,按需加载友好,适配现代化工程化项目
12
+
13
+ - **主题定制**:内置完整明暗主题体系,支持全局一键主题切换、主色自定义、样式灵活覆盖
14
+
15
+ - **规范统一**:参考主流企业级组件库设计规范,交互逻辑统一,降低开发上手成本
16
+
17
+ 项目部分组件设计、交互逻辑、主题配置方案参考以下业界优秀开源组件库,特此致谢!
18
+
19
+ - [Element Plus](https://cn.element-plus.org/):Vue3 主流企业级组件库,成熟的组件交互与设计体系
20
+
21
+ - [Arco Design Vue](https://arco.design/vue):字节跳动出品,优秀的按需加载、主题配置与工程化适配方案
22
+
23
+ - [Antdv Next](https://www.antdv-next.cn/index-cn):参考 Ant Design v6 设计规范,灵活的主题算法与现代化 UI 设计
24
+
25
+ - [Naive UI](https://www.naiveui.com/zh-CN):高质量、类型完备的 Vue3 组件库,严谨的组件设计逻辑
26
+
27
+ - [Prime Vue](https://primevue.dev/):功能丰富的跨端 UI 组件库,多样化业务组件交互参考
28
+
29
+ - [Vexip UI](https://www.vexipui.com/):轻量化、高自定义的 Vue3 组件库设计思路
4
30
 
5
31
  ## 快速开始
6
32
 
7
- ### Vue 版本
33
+ [文档地址](http://122.51.220.99:12121/)
34
+
35
+ 适配 Vue3 最新 Vapor 编译模式,最低版本要求:
8
36
 
9
- vue >= 3.6.0-beta.11
37
+ `vue >= 3.6.0-beta.11`
10
38
 
11
- ### 安装
39
+ **注意**:本组件库**仅支持 Vue Vapor 编译模式**,不支持 IE 浏览器及传统 Vue3 Runtime 编译模式。
40
+
41
+ 推荐使用 `pnpm` 安装(极速、节省磁盘空间)
12
42
 
13
43
  ```shell
14
44
  pnpm add savor-ui
15
45
  ```
16
46
 
17
- ### 完整引入
47
+ 在项目入口文件全局引入组件库及样式,完成全局注册:
18
48
 
19
49
  ```ts
20
50
  import { createVaporApp } from "vue";
21
51
  import App from "./App.vue";
22
52
  import SavorUI from "savor-ui";
23
53
 
54
+ // 引入组件库全局主题样式
24
55
  import "savor-ui/theme/index.scss";
25
56
 
26
57
  const app = createVaporApp(App);
58
+ // 全局注册所有 SavorUI 组件
27
59
  app.use(SavorUI);
28
60
  app.mount("#app");
29
61
  ```
30
62
 
31
- ### 调整主题
32
-
33
- 主题可以通过使用 `s-config-provider` 组件调整。
63
+ 组件库内置明暗两套主题,通过 `s-config-provider` 全局配置组件实现**全局主题、主色值自定义**,支持动态切换主题:
34
64
 
35
65
  ```html
36
66
  <template>
67
+ <!-- 全局主题配置包裹根路由,全局生效 -->
37
68
  <s-config-provider :theme="theme">
38
69
  <VaporRouterView />
39
70
  </s-config-provider>
@@ -43,12 +74,15 @@ app.mount("#app");
43
74
  import { reactive } from "vue";
44
75
  import { VaporRouterView } from "vue-router";
45
76
 
77
+ // 自定义明暗主题主色及配置
46
78
  const theme = reactive({
79
+ // 亮色主题配置
47
80
  lightTheme: {
48
- colorPrimary: "#1890ff",
81
+ colorPrimary: "#1890ff", // 全局主色
49
82
  },
83
+ // 暗色主题配置
50
84
  darkTheme: {
51
- colorPrimary: "#1890ff",
85
+ colorPrimary: "#1890ff", // 全局主色
52
86
  },
53
87
  });
54
88
  </script>
@@ -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 { child as r, computed as i, createComponent as a, createComponentWithFallback as o, createFor as s, createIf as c, defineVaporComponent as l, mergeModels as u, nextTick as d, on as f, onMounted as p, ref as m, renderEffect as h, resolveComponent as g, setClass as _, setInsertionState as v, setProp as y, setStaticTemplateRef as b, setText as x, template as S, toDisplayString as C, txt as w, unref as T, useModel as E, useTemplateRef as D, watch as O, withModifiers as k } from "vue";
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 A = S("<div>"), j = S("<div><div> </div>"), M = /*@__PURE__*/ l({
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__*/ u({
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__*/ u(["clickItem", "expand"], [
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(l, { emit: u }) {
39
- let S = u, M = l, N = u, P = e("cascader"), F = i(() => ({
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
- ...M.fieldNames
44
- })), I = D("scrollbarRef"), L = E(l, "modelValue"), R = E(l, "expandedKeys"), z = E(l, "expanded"), B = m([]), V = m([]), H = m(!0), U = (e) => {
45
- W(e), e.isFolder ? (V.value = [], V.value = e.children || [], H.value = !0, M.checkStrictly && (L.value = e[F.value.key], N("clickItem", {
46
- item: e,
47
- expandeds: z.value
48
- }))) : (L.value = e[F.value.key], V.value = [], N("clickItem", {
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: z.value
74
+ expandeds: K(e)
51
75
  }));
52
- }, W = (e) => {
53
- z.value.splice(M.id + 1), z.value[M.id] = e, R.value.splice(M.id + 1), R.value[M.id] = e[F.value.key], N("expand", R.value);
54
- }, G = (e) => {
55
- M.expandTrigger === "hover" && (W(e), e.isFolder && (V.value = [], V.value = e[F.value.children] || [], H.value = !0));
56
- }, K = () => {
57
- V.value = [], B.value.forEach((e) => {
58
- e[F.value.children] && e[F.value.children].length > 0 && (e.isFolder = !0, R.value?.[M.id] === e[F.value.key] && (V.value = e[F.value.children], H.value = !0));
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
- O(() => M.options, () => {
62
- H.value = !1, B.value = M.options, K();
63
- }, { immediate: !0 }), O(() => [...R.value], () => {
64
- K();
65
- }), p(() => {
66
- d(() => {
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
- I.value?.scrollToEl(`item-${R.value[M.id]}`, !1);
103
+ R.value?.scrollToEl(`item-${B.value[P.id]}`, !1);
69
104
  });
70
105
  });
71
106
  });
72
- let q = g("CascaderColumn", !0), J = A();
73
- return h(() => _(J, [T(P).e("column")])), v(J, null, 0), b(a(T(n), { height: "100%" }, () => {
74
- let e = A();
75
- return h(() => _(e, [T(P).e("list")])), v(e, null, 0), s(() => B.value, (e) => {
76
- let n = j(), i = r(n), o = w(i);
77
- return h(() => {
78
- let t = T(P), r = e.value, a = F.value;
79
- _(n, [t.e("item"), t.is("checked", r[a.key] === R.value[l.id])]), _(i, [t.e("label")]), x(o, C(r[a.label]));
80
- }), v(n, null, 1), c(() => e.value.isFolder, () => {
81
- let e = A();
82
- return h(() => _(e, [T(P).e("arrow")])), v(e, null, 0), a(T(t)), e;
83
- }), f(n, "click", k(() => U(e.value), ["stop"])), f(n, "mouseenter", k(() => G(e.value), ["stop"])), y(n, "id", `item-${e.value[F.value.key]}`), n;
84
- }, (e) => e[F.value.key], 9), e;
85
- }), I, null, "scrollbarRef"), [J, c(() => V.value.length > 0 && H.value, () => {
86
- let e = (e) => S("clickItem", e), t = (e) => S("expand", e);
87
- return o(q, {
88
- options: () => V.value,
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: () => L.value,
92
- "onUpdate:modelValue": () => (e) => L.value = e,
93
- expanded: () => z.value,
94
- "onUpdate:expanded": () => (e) => z.value = e,
95
- expandedKeys: () => R.value,
96
- "onUpdate:expandedKeys": () => (e) => R.value = e,
97
- id: () => l.id + 1,
98
- fieldNames: () => l.fieldNames,
99
- expandTrigger: () => l.expandTrigger,
100
- checkStrictly: () => l.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 { M as default };
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>;
@@ -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 b, setClass as x, setInsertionState as S, template as C, toRefs as w, unref as T, useModel as E, useTemplateRef as D, watch as O, withModifiers as k } from "vue";
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 ee = C("<div style=\"padding: 12px\">"), A = C("<div>"), j = C("<div>", 1);
12
+ var re = S("<div style=\"padding: 12px\">"), D = S("<div>"), O = S("<div>", 1);
13
13
  m("click");
14
- var M = /*@__PURE__*/ p({
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, C = e("cascader"), M = m, N = E(p, "modelValue"), { size: P, error: F } = w(h), { mergedSize: I, mergedError: L } = n({
57
- size: P,
58
- error: F
59
- }), R = E(p, "expandedKeys"), z = E(p, "expanded"), B = s(() => ({
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
- })), V = v(""), H = ({ item: e, expandeds: t }) => {
65
- V.value = t.map((e) => e[B.value.label]).join(h.pathSeparator), K(!1), h.leafMode ? N.value = t[t.length - 1][B.value.key] : h.pathTextMode ? N.value = t.map((e) => e[B.value.key]).join(h.pathSeparator) : h.pathMode ? N.value = t.map((e) => e[B.value.key]) : N.value = e[B.value.key], M("selectItem", {
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
- M("expand", R.value);
71
- }, W = D("popoverRef"), G = v(!1), K = (e) => {
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[B.value.key] === t) return e;
82
- if (r[B.value.children]) {
83
- let n = Y(r[B.value.children], t, e);
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[B.value.key] === e);
97
+ let t = r.find((t) => t[L.value.key] === e);
92
98
  if (!t) return null;
93
- n.push(t), r = t[B.value.children] || [];
99
+ n.push(t), r = t[L.value.children] || [];
94
100
  }
95
101
  return n;
96
102
  }, Z = () => {
97
- if (N.value !== void 0) {
98
- let e = null;
99
- if (h.pathTextMode && typeof N.value == "string") {
100
- let t = N.value.split(h.pathSeparator);
101
- e = X(h.options, t);
102
- } else e = Array.isArray(N.value) ? X(h.options, N.value) : Y(h.options, N.value);
103
- e && (R.value = e.map((e) => e[B.value.key]), z.value = e, V.value = e.map((e) => e[B.value.label]).join(h.pathSeparator));
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 Array.isArray(A.value) || (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
- N.value === void 0 ? e.forEach((e) => {
107
- R.value.includes(e[B.value.key]) && (V.value = V.value ? `${V.value}${h.pathSeparator}${e[B.value.label]}` : e[B.value.label], e[B.value.children] && Q(e[B.value.children]));
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
- }, te = () => {
110
- N.value = "", R.value = [], z.value = [], V.value = "", M("clear");
124
+ }, ie = () => {
125
+ A.value = h.multiple ? [] : "", F.value = [], I.value = [], z.value = [], R.value = "", k("clear");
111
126
  };
112
- O(N, () => {
127
+ te(A, () => {
113
128
  Z();
114
129
  }), _(() => {
115
130
  Q(h.options);
116
131
  });
117
- let ne = f(), re = b("SIcon"), $ = j();
118
- return y(() => x($, [T(C).b()])), S($, null, 0), ne(c(T(r), { $: [() => ({
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 = A();
126
- return y(() => x(e, [T(C).e("wrapper")])), S(e, null, 0), u(() => !p.options.length, () => {
127
- let e = ee();
128
- return S(e, null, 0), c(T(a)), e;
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 = A();
131
- return y(() => x(e, [T(C).e("panel")])), S(e, null, 0), c(o, {
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: () => N.value,
139
- "onUpdate:modelValue": () => (e) => N.value = e,
140
- expanded: () => z.value,
141
- "onUpdate:expanded": () => (e) => z.value = e,
142
- expandedKeys: () => R.value,
143
- "onUpdate:expandedKeys": () => (e) => R.value = 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", k(() => {}, ["stop"])), e;
163
+ }, 261), g(e, "click", ne(() => {}, ["stop"])), e;
146
164
  },
147
- default: () => c(T(i), {
165
+ default: () => c(w(i), {
148
166
  placeholder: () => p.placeholder,
149
167
  disabled: () => p.disabled,
150
- error: () => T(L),
151
- size: () => T(I),
152
- modelValue: () => V.value,
153
- "onUpdate:modelValue": () => (e) => V.value = 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: () => te
158
- }, { suffix: () => l(re, {
159
- class: () => [T(C).e("suffix-icon")],
175
+ onClear: () => ie
176
+ }, { suffix: () => l(oe, {
177
+ class: () => [w(S).e("suffix-icon")],
160
178
  style: () => ({ transform: G.value ? "rotate(180deg)" : "" })
161
- }, () => c(T(t))) })
179
+ }, () => c(w(t))) })
162
180
  }), W, null, "popoverRef"), $.$evtclick = d(q), $;
163
181
  }
164
182
  });
165
183
  //#endregion
166
- export { M as default };
184
+ export { k as default };