savor-ui 0.10.0 → 0.11.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 +23 -0
- package/dist/es/components/src/menu/index.d.ts +6 -3
- package/dist/es/components/src/menu/menu-group.d.ts +3 -3
- package/dist/es/components/src/menu/menu-group.vue_vue_type_script_setup_true_vapor_true_lang.mjs +23 -22
- package/dist/es/components/src/menu/menu-item.vue_vue_type_script_setup_true_vapor_true_lang.mjs +2 -1
- package/dist/es/components/src/menu/sub-menu.vue_vue_type_script_setup_true_vapor_true_lang.mjs +4 -3
- package/dist/es/components/src/menu/types.d.ts +23 -1
- package/dist/es/components/src/modal/modal.vue_vue_type_script_setup_true_vapor_true_lang.mjs +1 -0
- package/dist/es/components/src/segmented/index.d.ts +1 -0
- package/dist/es/components/src/segmented/segmented.vue_vue_type_script_setup_true_vapor_true_lang.mjs +24 -19
- package/dist/es/components/src/segmented/types.d.ts +2 -0
- package/dist/es/components/src/switch/index.d.ts +1 -0
- package/dist/es/components/src/switch/switch.vue_vue_type_script_setup_true_vapor_true_lang.mjs +32 -25
- package/dist/es/components/src/switch/types.d.ts +2 -0
- package/dist/es/theme/components/table.scss +56 -40
- package/dist/json/vetur-attributes.json +32 -0
- package/dist/json/vetur-tags.json +14 -2
- package/dist/json/web-types.json +85 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,29 @@
|
|
|
2
2
|
|
|
3
3
|
|
|
4
4
|
|
|
5
|
+
# [0.11.0](https://gitee.com/mach552/savor-ui/compare/v0.10.1...v0.11.0) (2026-07-14)
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
### Bug Fixes
|
|
9
|
+
|
|
10
|
+
* **segmented:** 修复默认激活块宽度不足的问题 ([1d36714](https://gitee.com/mach552/savor-ui/commits/1d36714cf67b9c234c453ed77dc7a6beee80dba7))
|
|
11
|
+
* **switch:** 修复默认值错误的问题 ([729312b](https://gitee.com/mach552/savor-ui/commits/729312bfd5244932fac28774af3ddde61e646b6a))
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
### Features
|
|
15
|
+
|
|
16
|
+
* **menu:** 新增`ignoreLevel`属性 ([d183006](https://gitee.com/mach552/savor-ui/commits/d183006dbcf32ba78ed76af043e54b2469c86254))
|
|
17
|
+
|
|
18
|
+
## [0.10.1](https://gitee.com/mach552/savor-ui/compare/v0.10.0...v0.10.1) (2026-07-14)
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
### Bug Fixes
|
|
22
|
+
|
|
23
|
+
* **segmented:** 修复默认值回写逻辑问题 ([780d4f2](https://gitee.com/mach552/savor-ui/commits/780d4f2c5bff2a74e8fb494dcdf813154a8c73be))
|
|
24
|
+
* **segmented:** 修复默认状态下激活条宽度不足的问题 ([80856e0](https://gitee.com/mach552/savor-ui/commits/80856e06ad03781dab6369624d936cc633fe0918))
|
|
25
|
+
* **switch:** 修复默认值回写逻辑问题 ([0b0ed8b](https://gitee.com/mach552/savor-ui/commits/0b0ed8bb585669602d450633b71c804bb4598a6e))
|
|
26
|
+
* **table:** 修复fiexd列内容位移问题 ([729b620](https://gitee.com/mach552/savor-ui/commits/729b6208260c329012a28dad825195d7da031a95))
|
|
27
|
+
|
|
5
28
|
# [0.10.0](https://gitee.com/mach552/savor-ui/compare/v0.9.0...v0.10.0) (2026-07-09)
|
|
6
29
|
|
|
7
30
|
|
|
@@ -1,20 +1,21 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { MenuGroupSlots, MenuItemSlots, MenuSlots, SubMenuSlots } from './types';
|
|
2
2
|
import { PublicProps, VNode, Plugin } from 'vue';
|
|
3
3
|
export declare const SMenuGroup: ((__VLS_props: NonNullable<Awaited<typeof __VLS_setup>>["props"], __VLS_ctx?: {
|
|
4
4
|
attrs: any;
|
|
5
|
-
slots:
|
|
5
|
+
slots: MenuGroupSlots;
|
|
6
6
|
emit: {};
|
|
7
7
|
}, __VLS_exposed?: NonNullable<Awaited<typeof __VLS_setup>>["expose"], __VLS_setup?: Promise<{
|
|
8
8
|
props: PublicProps & {
|
|
9
9
|
name: string | number;
|
|
10
10
|
title?: string | undefined;
|
|
11
11
|
disabled?: boolean | undefined;
|
|
12
|
+
ignoreLevel?: boolean | undefined;
|
|
12
13
|
} & (typeof globalThis extends {
|
|
13
14
|
__VLS_PROPS_FALLBACK: infer P;
|
|
14
15
|
} ? P : {});
|
|
15
16
|
expose: (exposed: {}) => void;
|
|
16
17
|
attrs: any;
|
|
17
|
-
slots:
|
|
18
|
+
slots: MenuGroupSlots;
|
|
18
19
|
emit: {};
|
|
19
20
|
}>) => VNode & {
|
|
20
21
|
__ctx?: Awaited<typeof __VLS_setup>;
|
|
@@ -29,6 +30,7 @@ export declare const SMenuItem: ((__VLS_props: NonNullable<Awaited<typeof __VLS_
|
|
|
29
30
|
title?: string | undefined;
|
|
30
31
|
disabled?: boolean | undefined;
|
|
31
32
|
item?: any;
|
|
33
|
+
ignoreLevel?: boolean | undefined;
|
|
32
34
|
} & (typeof globalThis extends {
|
|
33
35
|
__VLS_PROPS_FALLBACK: infer P;
|
|
34
36
|
} ? P : {});
|
|
@@ -75,6 +77,7 @@ export declare const SSubMenu: ((__VLS_props: NonNullable<Awaited<typeof __VLS_s
|
|
|
75
77
|
name: string | number;
|
|
76
78
|
title?: string | undefined;
|
|
77
79
|
disabled?: boolean | undefined;
|
|
80
|
+
ignoreLevel?: boolean | undefined;
|
|
78
81
|
} & (typeof globalThis extends {
|
|
79
82
|
__VLS_PROPS_FALLBACK: infer P;
|
|
80
83
|
} ? P : {});
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { MenuGroupProps, MenuGroupSlots } 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
|
-
props: PublicProps & __VLS_PrettifyLocal<
|
|
4
|
+
props: PublicProps & __VLS_PrettifyLocal<MenuGroupProps> & (typeof globalThis extends {
|
|
5
5
|
__VLS_PROPS_FALLBACK: infer P;
|
|
6
6
|
} ? P : {});
|
|
7
7
|
expose: (exposed: {}) => void;
|
|
8
8
|
attrs: any;
|
|
9
|
-
slots:
|
|
9
|
+
slots: MenuGroupSlots;
|
|
10
10
|
emit: {};
|
|
11
11
|
}>) => VNode & {
|
|
12
12
|
__ctx?: Awaited<typeof __VLS_setup>;
|
package/dist/es/components/src/menu/menu-group.vue_vue_type_script_setup_true_vapor_true_lang.mjs
CHANGED
|
@@ -1,37 +1,38 @@
|
|
|
1
1
|
import { useNamespace as e } from "../../../hooks/src/use-namespace.mjs";
|
|
2
2
|
import "../../../hooks/index.mjs";
|
|
3
3
|
import { menuContextKey as t, menuLevelContextKey as n } from "./types.mjs";
|
|
4
|
-
import { child as r,
|
|
4
|
+
import { child as r, computed as i, createIf as a, createSlot as o, defineVaporComponent as s, inject as c, next as l, onMounted as u, provide as d, renderEffect as f, setClass as p, setInsertionState as m, setStaticTemplateRef as h, setText as g, template as _, toDisplayString as v, unref as y, useTemplateRef as b } from "vue";
|
|
5
5
|
//#region ../components/src/menu/menu-group.vue?vue&type=script&setup=true&vapor=true&lang.ts
|
|
6
|
-
var
|
|
6
|
+
var x = _("<div>"), S = _(" "), C = _("<div><div><div></div></div><div>", 1), w = /*@__PURE__*/ s({
|
|
7
7
|
name: "SMenuGroup",
|
|
8
8
|
__name: "menu-group",
|
|
9
9
|
props: {
|
|
10
10
|
name: {},
|
|
11
11
|
title: {},
|
|
12
|
-
disabled: { type: Boolean }
|
|
12
|
+
disabled: { type: Boolean },
|
|
13
|
+
ignoreLevel: { type: Boolean }
|
|
13
14
|
},
|
|
14
|
-
setup(
|
|
15
|
-
let
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
}),
|
|
19
|
-
let
|
|
20
|
-
return
|
|
21
|
-
let e =
|
|
22
|
-
|
|
15
|
+
setup(s, { slots: _ }) {
|
|
16
|
+
let w = s, T = e("menu"), E = b("groupRef"), D = c(t, void 0), O = c(n, void 0), k = i(() => w.ignoreLevel ? 1 : O ? O.level.value + 1 : 1);
|
|
17
|
+
u(() => {
|
|
18
|
+
E.value?.style.setProperty("--s-menu-level", `${k.value}`);
|
|
19
|
+
}), d(n, { level: k });
|
|
20
|
+
let A = C(), j = r(A), M = r(j, 1), N = l(j, 1);
|
|
21
|
+
return f(() => {
|
|
22
|
+
let e = y(T);
|
|
23
|
+
p(A, [
|
|
23
24
|
e.e("group"),
|
|
24
|
-
e.is("disabled",
|
|
25
|
-
e.is("collapse",
|
|
26
|
-
]),
|
|
27
|
-
}),
|
|
28
|
-
let e = b();
|
|
29
|
-
return d(() => f(e, [v(C).e("group-icon")])), p(e, null, 0), a("icon"), e;
|
|
30
|
-
}), d(() => f(A, [v(C).e("group-label")])), p(A, null, 0), a("title", null, () => {
|
|
25
|
+
e.is("disabled", s.disabled),
|
|
26
|
+
e.is("collapse", y(D)?.isCollapsed.value)
|
|
27
|
+
]), p(j, [e.e("group-title")]);
|
|
28
|
+
}), m(j, 0, 0), a(() => _.icon, () => {
|
|
31
29
|
let e = x();
|
|
32
|
-
return
|
|
33
|
-
}),
|
|
30
|
+
return f(() => p(e, [y(T).e("group-icon")])), m(e, null, 0), o("icon"), e;
|
|
31
|
+
}), f(() => p(M, [y(T).e("group-label")])), m(M, null, 0), o("title", null, () => {
|
|
32
|
+
let e = S();
|
|
33
|
+
return f(() => g(e, v(s.title))), e;
|
|
34
|
+
}), f(() => p(N, [y(T).e("group-content")])), m(N, null, 0), o(), h(A, E, null, "groupRef"), A;
|
|
34
35
|
}
|
|
35
36
|
});
|
|
36
37
|
//#endregion
|
|
37
|
-
export {
|
|
38
|
+
export { w as default };
|
package/dist/es/components/src/menu/menu-item.vue_vue_type_script_setup_true_vapor_true_lang.mjs
CHANGED
|
@@ -13,7 +13,8 @@ var O = /*@__PURE__*/ u({
|
|
|
13
13
|
name: {},
|
|
14
14
|
title: {},
|
|
15
15
|
disabled: { type: Boolean },
|
|
16
|
-
item: {}
|
|
16
|
+
item: {},
|
|
17
|
+
ignoreLevel: { type: Boolean }
|
|
17
18
|
},
|
|
18
19
|
setup(u, { slots: d }) {
|
|
19
20
|
let y = u, O = e("menu"), k = S("itemRef"), A = f(n, void 0), j = f(i, void 0), M = f(r, void 0), N = () => {
|
package/dist/es/components/src/menu/sub-menu.vue_vue_type_script_setup_true_vapor_true_lang.mjs
CHANGED
|
@@ -17,10 +17,11 @@ var P = /*@__PURE__*/ m({
|
|
|
17
17
|
props: {
|
|
18
18
|
name: {},
|
|
19
19
|
title: {},
|
|
20
|
-
disabled: { type: Boolean }
|
|
20
|
+
disabled: { type: Boolean },
|
|
21
|
+
ignoreLevel: { type: Boolean }
|
|
21
22
|
},
|
|
22
23
|
setup(m, { slots: h }) {
|
|
23
|
-
let E = m, P = e("menu"), F = k("subMenuRef"), I = g(a, void 0), L = g(s, void 0), R = g(o, void 0), z = R ? R.level + 1 : 1, B = x(!1), V = x(/* @__PURE__ */ new Set()), oe = () => {
|
|
24
|
+
let E = m, P = e("menu"), F = k("subMenuRef"), I = g(a, void 0), L = g(s, void 0), R = g(o, void 0), z = l(() => E.ignoreLevel ? 1 : R ? R.level.value + 1 : 1), B = x(!1), V = x(/* @__PURE__ */ new Set()), oe = () => {
|
|
24
25
|
I?.collapsed.value || (B.value = !B.value, B.value ? I?.setOpenKey(E.name) : I?.removeOpenKey(E.name));
|
|
25
26
|
}, H = l(() => {
|
|
26
27
|
let e = I?.activeKey.value;
|
|
@@ -89,7 +90,7 @@ var P = /*@__PURE__*/ m({
|
|
|
89
90
|
let e = M();
|
|
90
91
|
return S(() => C(e, [O(P).e("pop-content")])), w(e, null, 0), p(), v(e, "mouseenter", Z), v(e, "mouseleave", fe), e;
|
|
91
92
|
},
|
|
92
|
-
default: () => d(() =>
|
|
93
|
+
default: () => d(() => z.value === 1, () => {
|
|
93
94
|
let e = j(), t = c(e);
|
|
94
95
|
return S(() => {
|
|
95
96
|
let n = O(P);
|
|
@@ -32,6 +32,8 @@ export interface MenuItemProps {
|
|
|
32
32
|
disabled?: boolean;
|
|
33
33
|
/** 菜单项数据 */
|
|
34
34
|
item?: any;
|
|
35
|
+
/** 是否忽略层级 */
|
|
36
|
+
ignoreLevel?: boolean;
|
|
35
37
|
}
|
|
36
38
|
export interface MenuItemSlots {
|
|
37
39
|
/** 默认 */
|
|
@@ -48,6 +50,8 @@ export interface SubMenuProps {
|
|
|
48
50
|
title?: string;
|
|
49
51
|
/** 是否禁用 */
|
|
50
52
|
disabled?: boolean;
|
|
53
|
+
/** 是否忽略层级 */
|
|
54
|
+
ignoreLevel?: boolean;
|
|
51
55
|
}
|
|
52
56
|
export interface SubMenuSlots {
|
|
53
57
|
/** 默认 */
|
|
@@ -57,6 +61,24 @@ export interface SubMenuSlots {
|
|
|
57
61
|
/** 自定义子菜单标题 */
|
|
58
62
|
title?: () => any;
|
|
59
63
|
}
|
|
64
|
+
export interface MenuGroupProps {
|
|
65
|
+
/** 菜单键值 */
|
|
66
|
+
name: string | number;
|
|
67
|
+
/** 菜单标题 */
|
|
68
|
+
title?: string;
|
|
69
|
+
/** 是否禁用 */
|
|
70
|
+
disabled?: boolean;
|
|
71
|
+
/** 是否忽略层级 */
|
|
72
|
+
ignoreLevel?: boolean;
|
|
73
|
+
}
|
|
74
|
+
export interface MenuGroupSlots {
|
|
75
|
+
/** 默认 */
|
|
76
|
+
default?: () => any;
|
|
77
|
+
/** 自定义子菜单图标 */
|
|
78
|
+
icon?: () => any;
|
|
79
|
+
/** 自定义子菜单标题 */
|
|
80
|
+
title?: () => any;
|
|
81
|
+
}
|
|
60
82
|
export interface MenuContext {
|
|
61
83
|
collapsed: Ref<boolean>;
|
|
62
84
|
collapsedWidth: Ref<number>;
|
|
@@ -80,6 +102,6 @@ export interface SubMenuContext {
|
|
|
80
102
|
}
|
|
81
103
|
export declare const subMenuContextKey: InjectionKey<SubMenuContext>;
|
|
82
104
|
export interface MenuLevelContext {
|
|
83
|
-
level: number
|
|
105
|
+
level: Ref<number>;
|
|
84
106
|
}
|
|
85
107
|
export declare const menuLevelContextKey: InjectionKey<MenuLevelContext>;
|
package/dist/es/components/src/modal/modal.vue_vue_type_script_setup_true_vapor_true_lang.mjs
CHANGED
|
@@ -183,6 +183,7 @@ var M = /*@__PURE__*/ m({
|
|
|
183
183
|
}, { icon: () => f(() => V.value, () => d(E(ne)), () => d(E(re)), 645) })), x(n, null, 1), f(() => m.closable, () => d(E(a), {
|
|
184
184
|
text: "",
|
|
185
185
|
size: "mini",
|
|
186
|
+
circle: "",
|
|
186
187
|
onClick: () => X
|
|
187
188
|
}, { icon: () => d(E(te)) })), $(e, L, null, "headerRef"), e;
|
|
188
189
|
}), x(e, null, 1), f(() => !m.scrollContent, () => {
|
|
@@ -8,6 +8,7 @@ export declare const SSegmented: ((__VLS_props: NonNullable<Awaited<typeof __VLS
|
|
|
8
8
|
props: PublicProps & {
|
|
9
9
|
options: any[];
|
|
10
10
|
fieldNames?: SegmentedFieldNamesProps | undefined;
|
|
11
|
+
defaultValue?: string | number | boolean | undefined;
|
|
11
12
|
size?: "small" | "medium" | "large" | undefined;
|
|
12
13
|
block?: boolean | undefined;
|
|
13
14
|
modelValue?: string | number | boolean | undefined;
|
|
@@ -15,6 +15,11 @@ var O = /*@__PURE__*/ c({
|
|
|
15
15
|
value: "value",
|
|
16
16
|
disabled: "disabled"
|
|
17
17
|
}) },
|
|
18
|
+
defaultValue: { type: [
|
|
19
|
+
String,
|
|
20
|
+
Number,
|
|
21
|
+
Boolean
|
|
22
|
+
] },
|
|
18
23
|
size: {},
|
|
19
24
|
block: { type: Boolean }
|
|
20
25
|
}, {
|
|
@@ -27,46 +32,46 @@ var O = /*@__PURE__*/ c({
|
|
|
27
32
|
}),
|
|
28
33
|
emits: /*@__PURE__*/ u(["change"], ["update:modelValue"]),
|
|
29
34
|
setup(c, { emit: l, slots: u }) {
|
|
30
|
-
let y = c, O = l, k = e("segmented"), A = C(c, "modelValue"), j = f([]), M = f(0), N = f(0), P = f(0), F = f(null)
|
|
35
|
+
let y = c, O = l, k = e("segmented"), A = C(c, "modelValue"), j = f([]), M = f(0), N = f(0), P = f(0), F = f(null);
|
|
36
|
+
A.value === void 0 && y.defaultValue !== void 0 && (A.value = y.defaultValue);
|
|
37
|
+
let I = (e, t) => {
|
|
31
38
|
e instanceof HTMLElement && (j.value[t] = e);
|
|
32
39
|
}, L = () => {
|
|
33
40
|
let e = j.value[M.value], t = F.value;
|
|
34
|
-
|
|
35
|
-
let n = t.getBoundingClientRect(), r = e.getBoundingClientRect();
|
|
36
|
-
P.value = r.left - n.left, N.value = r.width;
|
|
37
|
-
}
|
|
41
|
+
e && t && (P.value = e.offsetLeft, N.value = e.offsetWidth);
|
|
38
42
|
}, R = (e, t, n) => {
|
|
39
43
|
n || (A.value = e, O("change", e, t));
|
|
44
|
+
}, z = () => {
|
|
45
|
+
if (y.options.length === 0) return 0;
|
|
46
|
+
let e = y.options.map((e) => e[y.fieldNames.value]), t = A.value === void 0 ? 0 : e.indexOf(A.value);
|
|
47
|
+
return t >= 0 ? t : 0;
|
|
40
48
|
};
|
|
41
49
|
w(() => {
|
|
42
|
-
|
|
43
|
-
let e = y.options.map((e) => e[y.fieldNames.value]), t = A.value ? e.indexOf(A.value) : 0;
|
|
44
|
-
M.value = t >= 0 ? t : 0, requestAnimationFrame(L);
|
|
45
|
-
}
|
|
50
|
+
y.options.length > 0 && (M.value = z(), L());
|
|
46
51
|
}), t(F, () => {
|
|
47
|
-
|
|
52
|
+
L();
|
|
48
53
|
}), w((e) => {
|
|
49
54
|
let t = j.value[M.value];
|
|
50
55
|
if (!t) return;
|
|
51
56
|
let n = new ResizeObserver(() => {
|
|
52
|
-
|
|
57
|
+
L();
|
|
53
58
|
});
|
|
54
|
-
n.observe(t), e(() => n.disconnect());
|
|
59
|
+
n.observe(t), L(), e(() => n.disconnect());
|
|
55
60
|
}), d(() => {
|
|
56
|
-
|
|
61
|
+
M.value = z(), L();
|
|
57
62
|
});
|
|
58
|
-
let
|
|
63
|
+
let B = s(), V = D(), H = n(V);
|
|
59
64
|
return p(() => {
|
|
60
65
|
let e = S(k);
|
|
61
|
-
m(
|
|
66
|
+
m(V, [
|
|
62
67
|
e.b(),
|
|
63
68
|
e.m(c.size),
|
|
64
69
|
{ [e.m("block")]: c.block }
|
|
65
|
-
]), m(
|
|
70
|
+
]), m(H, [e.m("selected")]), _(H, {
|
|
66
71
|
width: N.value + "px",
|
|
67
72
|
left: P.value + "px"
|
|
68
73
|
});
|
|
69
|
-
}), h(
|
|
74
|
+
}), h(V, null, 1), r(() => c.options, (e, t) => {
|
|
70
75
|
let n = E();
|
|
71
76
|
return p(() => {
|
|
72
77
|
let r = S(k);
|
|
@@ -80,8 +85,8 @@ var O = /*@__PURE__*/ c({
|
|
|
80
85
|
return p(() => {
|
|
81
86
|
m(t, [S(k).e("label")]), v(n, b(e.value[c.fieldNames.label]));
|
|
82
87
|
}), t;
|
|
83
|
-
}), n.$evtclick = a((t) => R(e.value[c.fieldNames.value], t, e.value[c.fieldNames.disabled])), p(() =>
|
|
84
|
-
}, (e, t) => e[c.fieldNames.value], 8), g(
|
|
88
|
+
}), n.$evtclick = a((t) => R(e.value[c.fieldNames.value], t, e.value[c.fieldNames.disabled])), p(() => B(n, (e) => I(e, t.value), !0)), n;
|
|
89
|
+
}, (e, t) => e[c.fieldNames.value], 8), g(V, F, null, "containerRef"), V;
|
|
85
90
|
}
|
|
86
91
|
});
|
|
87
92
|
//#endregion
|
|
@@ -7,6 +7,7 @@ export declare const SSwitch: ((__VLS_props: NonNullable<Awaited<typeof __VLS_se
|
|
|
7
7
|
}, __VLS_exposed?: NonNullable<Awaited<typeof __VLS_setup>>["expose"], __VLS_setup?: Promise<{
|
|
8
8
|
props: PublicProps & {
|
|
9
9
|
modelValue?: boolean | string | number | undefined;
|
|
10
|
+
defaultValue?: boolean | string | number | undefined;
|
|
10
11
|
disabled?: boolean | undefined;
|
|
11
12
|
activeValue?: boolean | string | number | undefined;
|
|
12
13
|
activeColor?: string | undefined;
|
package/dist/es/components/src/switch/switch.vue_vue_type_script_setup_true_vapor_true_lang.mjs
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { useNamespace as e } from "../../../hooks/src/use-namespace.mjs";
|
|
2
2
|
import "../../../hooks/index.mjs";
|
|
3
3
|
import { useFormItem as t } from "../form/use-form-item.mjs";
|
|
4
|
-
import { child as n, computed as r, createIf as i, createInvoker as a, createSlot as o, createTemplateRefSetter as s, defineVaporComponent as c, delegateEvents as l, mergeModels as u, next as d, on as f, onMounted as p,
|
|
4
|
+
import { child as n, computed as r, createIf as i, createInvoker as a, createSlot as o, createTemplateRefSetter as s, defineVaporComponent as c, delegateEvents as l, mergeModels as u, next as d, on as f, onMounted as p, renderEffect as m, setClass as h, setInsertionState as g, setProp as _, setStyle as v, setText as y, template as b, toDisplayString as x, toRefs as S, txt as C, unref as w, useModel as T, useTemplateRef as E, watch as D, withKeys as O } from "vue";
|
|
5
5
|
//#region ../components/src/switch/switch.vue?vue&type=script&setup=true&vapor=true&lang.ts
|
|
6
|
-
var
|
|
6
|
+
var k = b("<span> "), A = b("<div><input role=switch type=checkbox><div><div></div><div>", 1);
|
|
7
7
|
l("click");
|
|
8
|
-
var
|
|
8
|
+
var j = /*@__PURE__*/ c({
|
|
9
9
|
name: "SSwitch",
|
|
10
10
|
__name: "switch",
|
|
11
11
|
props: /*@__PURE__*/ u({
|
|
@@ -14,6 +14,11 @@ var M = /*@__PURE__*/ c({
|
|
|
14
14
|
String,
|
|
15
15
|
Number
|
|
16
16
|
] },
|
|
17
|
+
defaultValue: { type: [
|
|
18
|
+
Boolean,
|
|
19
|
+
String,
|
|
20
|
+
Number
|
|
21
|
+
] },
|
|
17
22
|
disabled: { type: Boolean },
|
|
18
23
|
activeValue: {
|
|
19
24
|
type: [
|
|
@@ -52,43 +57,45 @@ var M = /*@__PURE__*/ c({
|
|
|
52
57
|
}),
|
|
53
58
|
emits: /*@__PURE__*/ u(["change"], ["update:modelValue"]),
|
|
54
59
|
setup(c, { emit: l }) {
|
|
55
|
-
let u = c,
|
|
56
|
-
size:
|
|
57
|
-
error:
|
|
58
|
-
}),
|
|
60
|
+
let u = c, b = l, j = e("switch"), { size: M, error: N } = S(u), { mergedSize: P, mergedError: F } = t({
|
|
61
|
+
size: M,
|
|
62
|
+
error: N
|
|
63
|
+
}), I = T(c, "modelValue"), L = E("inputRef");
|
|
64
|
+
I.value === void 0 && u.defaultValue !== void 0 && (I.value = u.defaultValue);
|
|
65
|
+
let R = r(() => I.value === u.activeValue), z = async () => {
|
|
59
66
|
if (u.disabled) return;
|
|
60
|
-
let e =
|
|
67
|
+
let e = R.value ? u.inactiveValue : u.activeValue;
|
|
61
68
|
if (u.beforeChange) try {
|
|
62
69
|
await u.beforeChange(e);
|
|
63
70
|
} catch {
|
|
64
71
|
return;
|
|
65
72
|
}
|
|
66
|
-
|
|
73
|
+
I.value = e, b("change", e);
|
|
67
74
|
};
|
|
68
75
|
p(() => {
|
|
69
|
-
L.value
|
|
70
|
-
}),
|
|
71
|
-
|
|
76
|
+
L.value.checked = R.value;
|
|
77
|
+
}), D(R, (e) => {
|
|
78
|
+
L.value.checked = e;
|
|
72
79
|
});
|
|
73
|
-
let
|
|
74
|
-
return f(
|
|
75
|
-
let e =
|
|
76
|
-
|
|
80
|
+
let B = s(), V = A(), H = n(V), U = d(H, 1), W = n(U), G = d(W, 1);
|
|
81
|
+
return f(H, "keypress", O(z, ["enter"])), B(H, L, null, "inputRef"), m(() => {
|
|
82
|
+
let e = w(j), t = R.value, n = c.disabled, r = c.activeColor, i = c.inactiveColor;
|
|
83
|
+
h(V, [
|
|
77
84
|
e.b(),
|
|
78
|
-
e.m(
|
|
85
|
+
e.m(w(P)),
|
|
79
86
|
e.is("checked", t),
|
|
80
87
|
e.is("disabled", n),
|
|
81
88
|
e.is("circle", c.circle),
|
|
82
|
-
e.is("error",
|
|
83
|
-
]),
|
|
89
|
+
e.is("error", w(F))
|
|
90
|
+
]), h(H, [e.e("inner")]), _(H, "disabled", n), h(U, [e.e("core")]), v(U, {
|
|
84
91
|
backgroundColor: t ? r : i,
|
|
85
92
|
borderColor: t ? r : i
|
|
86
|
-
}),
|
|
87
|
-
}),
|
|
88
|
-
let e =
|
|
89
|
-
return
|
|
90
|
-
}),
|
|
93
|
+
}), h(W, [e.e("core-label")]);
|
|
94
|
+
}), g(W, null, 0), i(() => c.activeText || c.inactiveText, () => {
|
|
95
|
+
let e = k(), t = C(e);
|
|
96
|
+
return m(() => y(t, x(R.value ? c.activeText : c.inactiveText))), e;
|
|
97
|
+
}), m(() => h(G, [w(j).e("core-action")])), g(G, null, 0), i(() => R.value, () => o("active-icon"), () => o("inactive-icon"), 517), V.$evtclick = a(z), V;
|
|
91
98
|
}
|
|
92
99
|
});
|
|
93
100
|
//#endregion
|
|
94
|
-
export {
|
|
101
|
+
export { j as default };
|
|
@@ -50,19 +50,23 @@
|
|
|
50
50
|
@include m(fixed_left) {
|
|
51
51
|
position: sticky;
|
|
52
52
|
left: 0;
|
|
53
|
+
&::after {
|
|
54
|
+
content: "";
|
|
55
|
+
position: absolute;
|
|
56
|
+
top: 0;
|
|
57
|
+
right: 0;
|
|
58
|
+
bottom: 0;
|
|
59
|
+
width: 30px;
|
|
60
|
+
transform: translateX(100%);
|
|
61
|
+
pointer-events: none;
|
|
62
|
+
box-shadow: inset 12px 0 8px -12px rgba(0, 0, 0, 0.18);
|
|
63
|
+
z-index: 12;
|
|
64
|
+
opacity: 0;
|
|
65
|
+
}
|
|
53
66
|
@include when(shadow) {
|
|
54
67
|
background-color: getCssVar("color", "fill-1");
|
|
55
68
|
&::after {
|
|
56
|
-
|
|
57
|
-
position: absolute;
|
|
58
|
-
top: 0;
|
|
59
|
-
right: 0;
|
|
60
|
-
bottom: 0;
|
|
61
|
-
width: 30px;
|
|
62
|
-
transform: translateX(100%);
|
|
63
|
-
pointer-events: none;
|
|
64
|
-
box-shadow: inset 12px 0 8px -12px rgba(0, 0, 0, 0.18);
|
|
65
|
-
z-index: 12;
|
|
69
|
+
opacity: 1;
|
|
66
70
|
}
|
|
67
71
|
}
|
|
68
72
|
}
|
|
@@ -70,19 +74,23 @@
|
|
|
70
74
|
@include m(fixed_right) {
|
|
71
75
|
position: sticky;
|
|
72
76
|
right: 0;
|
|
77
|
+
&::after {
|
|
78
|
+
content: "";
|
|
79
|
+
position: absolute;
|
|
80
|
+
top: 0;
|
|
81
|
+
left: 0;
|
|
82
|
+
bottom: 0;
|
|
83
|
+
width: 30px;
|
|
84
|
+
transform: translateX(-100%);
|
|
85
|
+
pointer-events: none;
|
|
86
|
+
box-shadow: inset -12px 0 8px -12px rgba(0, 0, 0, 0.18);
|
|
87
|
+
z-index: 12;
|
|
88
|
+
opacity: 0;
|
|
89
|
+
}
|
|
73
90
|
@include when(shadow) {
|
|
74
91
|
background-color: getCssVar("color", "fill-1");
|
|
75
92
|
&::after {
|
|
76
|
-
|
|
77
|
-
position: absolute;
|
|
78
|
-
top: 0;
|
|
79
|
-
left: 0;
|
|
80
|
-
bottom: 0;
|
|
81
|
-
width: 30px;
|
|
82
|
-
transform: translateX(-100%);
|
|
83
|
-
pointer-events: none;
|
|
84
|
-
box-shadow: inset -12px 0 8px -12px rgba(0, 0, 0, 0.18);
|
|
85
|
-
z-index: 12;
|
|
93
|
+
opacity: 1;
|
|
86
94
|
}
|
|
87
95
|
}
|
|
88
96
|
}
|
|
@@ -169,18 +177,22 @@
|
|
|
169
177
|
@include m(fixed_left) {
|
|
170
178
|
position: sticky;
|
|
171
179
|
left: 0;
|
|
180
|
+
&::after {
|
|
181
|
+
content: "";
|
|
182
|
+
position: absolute;
|
|
183
|
+
top: 0;
|
|
184
|
+
right: 0;
|
|
185
|
+
bottom: 0;
|
|
186
|
+
width: 30px;
|
|
187
|
+
transform: translateX(100%);
|
|
188
|
+
pointer-events: none;
|
|
189
|
+
box-shadow: inset 12px 0 8px -12px rgba(0, 0, 0, 0.18);
|
|
190
|
+
z-index: 12;
|
|
191
|
+
opacity: 0;
|
|
192
|
+
}
|
|
172
193
|
@include when(shadow) {
|
|
173
194
|
&::after {
|
|
174
|
-
|
|
175
|
-
position: absolute;
|
|
176
|
-
top: 0;
|
|
177
|
-
right: 0;
|
|
178
|
-
bottom: 0;
|
|
179
|
-
width: 30px;
|
|
180
|
-
transform: translateX(100%);
|
|
181
|
-
pointer-events: none;
|
|
182
|
-
box-shadow: inset 12px 0 8px -12px rgba(0, 0, 0, 0.18);
|
|
183
|
-
z-index: 12;
|
|
195
|
+
opacity: 1;
|
|
184
196
|
}
|
|
185
197
|
}
|
|
186
198
|
}
|
|
@@ -188,18 +200,22 @@
|
|
|
188
200
|
@include m(fixed_right) {
|
|
189
201
|
position: sticky;
|
|
190
202
|
right: 0;
|
|
203
|
+
&::after {
|
|
204
|
+
content: "";
|
|
205
|
+
position: absolute;
|
|
206
|
+
top: 0;
|
|
207
|
+
left: 0;
|
|
208
|
+
bottom: 0;
|
|
209
|
+
width: 30px;
|
|
210
|
+
transform: translateX(-100%);
|
|
211
|
+
pointer-events: none;
|
|
212
|
+
box-shadow: inset -12px 0 8px -12px rgba(0, 0, 0, 0.18);
|
|
213
|
+
z-index: 12;
|
|
214
|
+
opacity: 0;
|
|
215
|
+
}
|
|
191
216
|
@include when(shadow) {
|
|
192
217
|
&::after {
|
|
193
|
-
|
|
194
|
-
position: absolute;
|
|
195
|
-
top: 0;
|
|
196
|
-
left: 0;
|
|
197
|
-
bottom: 0;
|
|
198
|
-
width: 30px;
|
|
199
|
-
transform: translateX(-100%);
|
|
200
|
-
pointer-events: none;
|
|
201
|
-
box-shadow: inset -12px 0 8px -12px rgba(0, 0, 0, 0.18);
|
|
202
|
-
z-index: 12;
|
|
218
|
+
opacity: 1;
|
|
203
219
|
}
|
|
204
220
|
}
|
|
205
221
|
}
|
|
@@ -1356,6 +1356,10 @@
|
|
|
1356
1356
|
"s-menu-item/item": {
|
|
1357
1357
|
"description": "菜单项数据"
|
|
1358
1358
|
},
|
|
1359
|
+
"s-menu-item/ignoreLevel": {
|
|
1360
|
+
"description": "是否忽略层级",
|
|
1361
|
+
"type": "boolean"
|
|
1362
|
+
},
|
|
1359
1363
|
"s-sub-menu/name": {
|
|
1360
1364
|
"description": "菜单键值",
|
|
1361
1365
|
"type": "string | number"
|
|
@@ -1368,6 +1372,26 @@
|
|
|
1368
1372
|
"description": "是否禁用",
|
|
1369
1373
|
"type": "boolean"
|
|
1370
1374
|
},
|
|
1375
|
+
"s-sub-menu/ignoreLevel": {
|
|
1376
|
+
"description": "是否忽略层级",
|
|
1377
|
+
"type": "boolean"
|
|
1378
|
+
},
|
|
1379
|
+
"s-menu-group/name": {
|
|
1380
|
+
"description": "菜单键值",
|
|
1381
|
+
"type": "string | number"
|
|
1382
|
+
},
|
|
1383
|
+
"s-menu-group/title": {
|
|
1384
|
+
"description": "菜单标题",
|
|
1385
|
+
"type": "string"
|
|
1386
|
+
},
|
|
1387
|
+
"s-menu-group/disabled": {
|
|
1388
|
+
"description": "是否禁用",
|
|
1389
|
+
"type": "boolean"
|
|
1390
|
+
},
|
|
1391
|
+
"s-menu-group/ignoreLevel": {
|
|
1392
|
+
"description": "是否忽略层级",
|
|
1393
|
+
"type": "boolean"
|
|
1394
|
+
},
|
|
1371
1395
|
"s-message/type": {
|
|
1372
1396
|
"description": "消息类型"
|
|
1373
1397
|
},
|
|
@@ -1790,6 +1814,10 @@
|
|
|
1790
1814
|
"s-segmented/fieldNames": {
|
|
1791
1815
|
"description": "字段名"
|
|
1792
1816
|
},
|
|
1817
|
+
"s-segmented/defaultValue": {
|
|
1818
|
+
"description": "默认值",
|
|
1819
|
+
"type": "string | number | boolean"
|
|
1820
|
+
},
|
|
1793
1821
|
"s-segmented/size": {
|
|
1794
1822
|
"description": "尺寸"
|
|
1795
1823
|
},
|
|
@@ -2065,6 +2093,10 @@
|
|
|
2065
2093
|
"description": "开关状态(v-model)",
|
|
2066
2094
|
"type": "boolean | string | number"
|
|
2067
2095
|
},
|
|
2096
|
+
"s-switch/defaultValue": {
|
|
2097
|
+
"description": "默认值",
|
|
2098
|
+
"type": "boolean | string | number"
|
|
2099
|
+
},
|
|
2068
2100
|
"s-switch/disabled": {
|
|
2069
2101
|
"description": "是否禁用",
|
|
2070
2102
|
"type": "boolean"
|
|
@@ -586,14 +586,24 @@
|
|
|
586
586
|
"name",
|
|
587
587
|
"title",
|
|
588
588
|
"disabled",
|
|
589
|
-
"item"
|
|
589
|
+
"item",
|
|
590
|
+
"ignoreLevel"
|
|
590
591
|
]
|
|
591
592
|
},
|
|
592
593
|
"s-sub-menu": {
|
|
593
594
|
"attributes": [
|
|
594
595
|
"name",
|
|
595
596
|
"title",
|
|
596
|
-
"disabled"
|
|
597
|
+
"disabled",
|
|
598
|
+
"ignoreLevel"
|
|
599
|
+
]
|
|
600
|
+
},
|
|
601
|
+
"s-menu-group": {
|
|
602
|
+
"attributes": [
|
|
603
|
+
"name",
|
|
604
|
+
"title",
|
|
605
|
+
"disabled",
|
|
606
|
+
"ignoreLevel"
|
|
597
607
|
]
|
|
598
608
|
},
|
|
599
609
|
"s-message": {
|
|
@@ -761,6 +771,7 @@
|
|
|
761
771
|
"change",
|
|
762
772
|
"options",
|
|
763
773
|
"fieldNames",
|
|
774
|
+
"defaultValue",
|
|
764
775
|
"size",
|
|
765
776
|
"block"
|
|
766
777
|
]
|
|
@@ -876,6 +887,7 @@
|
|
|
876
887
|
"attributes": [
|
|
877
888
|
"change",
|
|
878
889
|
"modelValue",
|
|
890
|
+
"defaultValue",
|
|
879
891
|
"disabled",
|
|
880
892
|
"activeValue",
|
|
881
893
|
"activeColor",
|
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.10.1",
|
|
6
6
|
"contributions": {
|
|
7
7
|
"html": {
|
|
8
8
|
"types-syntax": "typescript",
|
|
@@ -3561,6 +3561,14 @@
|
|
|
3561
3561
|
"type": "any",
|
|
3562
3562
|
"kind": "expression"
|
|
3563
3563
|
}
|
|
3564
|
+
},
|
|
3565
|
+
{
|
|
3566
|
+
"name": "ignoreLevel",
|
|
3567
|
+
"description": "是否忽略层级",
|
|
3568
|
+
"value": {
|
|
3569
|
+
"type": "boolean",
|
|
3570
|
+
"kind": "expression"
|
|
3571
|
+
}
|
|
3564
3572
|
}
|
|
3565
3573
|
],
|
|
3566
3574
|
"events": [],
|
|
@@ -3605,6 +3613,66 @@
|
|
|
3605
3613
|
"type": "boolean",
|
|
3606
3614
|
"kind": "expression"
|
|
3607
3615
|
}
|
|
3616
|
+
},
|
|
3617
|
+
{
|
|
3618
|
+
"name": "ignoreLevel",
|
|
3619
|
+
"description": "是否忽略层级",
|
|
3620
|
+
"value": {
|
|
3621
|
+
"type": "boolean",
|
|
3622
|
+
"kind": "expression"
|
|
3623
|
+
}
|
|
3624
|
+
}
|
|
3625
|
+
],
|
|
3626
|
+
"events": [],
|
|
3627
|
+
"slots": [
|
|
3628
|
+
{
|
|
3629
|
+
"name": "default",
|
|
3630
|
+
"description": "默认"
|
|
3631
|
+
},
|
|
3632
|
+
{
|
|
3633
|
+
"name": "icon",
|
|
3634
|
+
"description": "自定义子菜单图标"
|
|
3635
|
+
},
|
|
3636
|
+
{
|
|
3637
|
+
"name": "title",
|
|
3638
|
+
"description": "自定义子菜单标题"
|
|
3639
|
+
}
|
|
3640
|
+
]
|
|
3641
|
+
},
|
|
3642
|
+
{
|
|
3643
|
+
"name": "s-menu-group",
|
|
3644
|
+
"attributes": [
|
|
3645
|
+
{
|
|
3646
|
+
"name": "name",
|
|
3647
|
+
"description": "菜单键值",
|
|
3648
|
+
"value": {
|
|
3649
|
+
"type": "string | number",
|
|
3650
|
+
"kind": "expression"
|
|
3651
|
+
}
|
|
3652
|
+
},
|
|
3653
|
+
{
|
|
3654
|
+
"name": "title",
|
|
3655
|
+
"description": "菜单标题",
|
|
3656
|
+
"value": {
|
|
3657
|
+
"type": "string",
|
|
3658
|
+
"kind": "expression"
|
|
3659
|
+
}
|
|
3660
|
+
},
|
|
3661
|
+
{
|
|
3662
|
+
"name": "disabled",
|
|
3663
|
+
"description": "是否禁用",
|
|
3664
|
+
"value": {
|
|
3665
|
+
"type": "boolean",
|
|
3666
|
+
"kind": "expression"
|
|
3667
|
+
}
|
|
3668
|
+
},
|
|
3669
|
+
{
|
|
3670
|
+
"name": "ignoreLevel",
|
|
3671
|
+
"description": "是否忽略层级",
|
|
3672
|
+
"value": {
|
|
3673
|
+
"type": "boolean",
|
|
3674
|
+
"kind": "expression"
|
|
3675
|
+
}
|
|
3608
3676
|
}
|
|
3609
3677
|
],
|
|
3610
3678
|
"events": [],
|
|
@@ -4673,6 +4741,14 @@
|
|
|
4673
4741
|
"kind": "expression"
|
|
4674
4742
|
}
|
|
4675
4743
|
},
|
|
4744
|
+
{
|
|
4745
|
+
"name": "defaultValue",
|
|
4746
|
+
"description": "默认值",
|
|
4747
|
+
"value": {
|
|
4748
|
+
"type": "string | number | boolean",
|
|
4749
|
+
"kind": "expression"
|
|
4750
|
+
}
|
|
4751
|
+
},
|
|
4676
4752
|
{
|
|
4677
4753
|
"name": "size",
|
|
4678
4754
|
"description": "尺寸",
|
|
@@ -5377,6 +5453,14 @@
|
|
|
5377
5453
|
"kind": "expression"
|
|
5378
5454
|
}
|
|
5379
5455
|
},
|
|
5456
|
+
{
|
|
5457
|
+
"name": "defaultValue",
|
|
5458
|
+
"description": "默认值",
|
|
5459
|
+
"value": {
|
|
5460
|
+
"type": "boolean | string | number",
|
|
5461
|
+
"kind": "expression"
|
|
5462
|
+
}
|
|
5463
|
+
},
|
|
5380
5464
|
{
|
|
5381
5465
|
"name": "disabled",
|
|
5382
5466
|
"description": "是否禁用",
|