savor-ui 0.25.0 → 0.26.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 CHANGED
@@ -2,6 +2,19 @@
2
2
 
3
3
 
4
4
 
5
+ # [0.26.0](https://gitee.com/mach552/savor-ui/compare/v0.25.0...v0.26.0) (2026-08-27)
6
+
7
+
8
+ ### Bug Fixes
9
+
10
+ * **grid:** 修复最后一个元素没有间距的问题 ([6b3ea38](https://gitee.com/mach552/savor-ui/commits/6b3ea380c395233cc16f24e9c48b36cb46308fc6))
11
+
12
+
13
+ ### Features
14
+
15
+ * **segmented:** 新增组件级禁用属性 ([ff42c0e](https://gitee.com/mach552/savor-ui/commits/ff42c0eecdf1b8600ba384ce6075457a9672c263))
16
+ * **tree:** 新增`raw`属性引用原始数据 ([9198851](https://gitee.com/mach552/savor-ui/commits/9198851f3db4219ab8e4cc0f336b50c601ef58b1))
17
+
5
18
  # [0.25.0](https://gitee.com/mach552/savor-ui/compare/v0.24.1...v0.25.0) (2026-08-26)
6
19
 
7
20
 
@@ -37,12 +37,12 @@ var m = f("<div>", 1), h = /*@__PURE__*/ a({
37
37
  for (let i = 0; i < r.length; i++) {
38
38
  let { uid: a, span: o = 1, offset: s = 0 } = r[i], c = e + s, l = c + o;
39
39
  l > n + 1 && (e = 1, c = e + s, l = c + o);
40
- let u = c - s === 1, d = r[i + 1], f = !d || l + (d.offset || 0) + (d.span || 1) > n + 1;
40
+ let u = c - s === 1, d = l >= n + 1;
41
41
  t[a] = {
42
42
  start: c,
43
43
  end: l,
44
44
  isFirst: u,
45
- isLast: f
45
+ isLast: d
46
46
  }, e = l;
47
47
  }
48
48
  return t;
@@ -91,6 +91,7 @@ export declare const SSubMenu: ((__VLS_props: NonNullable<Awaited<typeof __VLS_s
91
91
  disabled?: boolean | undefined;
92
92
  ignoreLevel?: boolean | undefined;
93
93
  icon?: string | undefined;
94
+ activeCenter?: boolean | undefined;
94
95
  } & (typeof globalThis extends {
95
96
  __VLS_PROPS_FALLBACK: infer P;
96
97
  } ? P : {});
@@ -17,7 +17,8 @@ var I = /*@__PURE__*/ h({
17
17
  title: {},
18
18
  disabled: { type: Boolean },
19
19
  ignoreLevel: { type: Boolean },
20
- icon: {}
20
+ icon: {},
21
+ activeCenter: { type: Boolean }
21
22
  },
22
23
  setup(h, { slots: g }) {
23
24
  let E = h, I = e("menu"), L = k("subMenuRef"), R = _(ee, void 0), z = _(c, void 0), B = _(s, void 0), V = u(() => E.ignoreLevel ? 1 : B ? B.level.value + 1 : 1), H = x(!1), ae = () => {
@@ -94,7 +95,11 @@ var I = /*@__PURE__*/ h({
94
95
  let e = j();
95
96
  return S(() => {
96
97
  let t = O(I);
97
- C(e, [t.e("sub-title"), t.is("active", U.value)]);
98
+ C(e, [
99
+ t.e("sub-title"),
100
+ t.is("active", U.value),
101
+ t.is("active-center", h.activeCenter)
102
+ ]);
98
103
  }), w(e, null, 0), f(() => g.icon || h.icon, () => {
99
104
  let e = j();
100
105
  return S(() => C(e, [O(I).e("sub-icon")])), w(e, null, 0), m("icon", null, () => d(O(a), { name: () => h.icon })), e;
@@ -103,7 +108,11 @@ var I = /*@__PURE__*/ h({
103
108
  let e = ie(), t = l(e, 1), r = v(t, 2);
104
109
  return S(() => {
105
110
  let t = O(I);
106
- C(e, [t.e("sub-title"), t.is("active", U.value)]);
111
+ C(e, [
112
+ t.e("sub-title"),
113
+ t.is("active", U.value),
114
+ t.is("active-center", h.activeCenter)
115
+ ]);
107
116
  }), w(e, 0, 0), f(() => g.icon || h.icon, () => {
108
117
  let e = j();
109
118
  return S(() => C(e, [O(I).e("sub-icon")])), w(e, null, 0), m("icon", null, () => d(O(a), { name: () => h.icon })), e;
@@ -118,7 +127,11 @@ var I = /*@__PURE__*/ h({
118
127
  let e = N(), n = l(e, 1), i = v(n, 2);
119
128
  return S(() => {
120
129
  let t = O(I);
121
- C(e, [t.e("sub-title"), t.is("active", U.value)]);
130
+ C(e, [
131
+ t.e("sub-title"),
132
+ t.is("active", U.value),
133
+ t.is("active-center", h.activeCenter)
134
+ ]);
122
135
  }), w(e, 0, 0), f(() => g.icon || h.icon, () => {
123
136
  let e = j();
124
137
  return S(() => C(e, [O(I).e("sub-icon")])), w(e, null, 0), m("icon", null, () => d(O(a), { name: () => h.icon })), e;
@@ -75,6 +75,8 @@ export interface SubMenuProps {
75
75
  ignoreLevel?: boolean;
76
76
  /** 图标名称 */
77
77
  icon?: string;
78
+ /** 匹配menu-item的激活圆角 */
79
+ activeCenter?: boolean;
78
80
  }
79
81
  export interface SubMenuSlots {
80
82
  /** 默认 */
@@ -11,6 +11,7 @@ export declare const SSegmented: ((__VLS_props: NonNullable<Awaited<typeof __VLS
11
11
  defaultValue?: string | number | boolean | undefined;
12
12
  size?: "mini" | "small" | "medium" | "large" | "larger" | undefined;
13
13
  block?: boolean | undefined;
14
+ disabled?: boolean | undefined;
14
15
  modelValue?: string | number | boolean | undefined;
15
16
  onChange?: ((value: string, evt: Event) => any) | undefined;
16
17
  "onUpdate:modelValue"?: ((value: string | number | boolean | undefined) => any) | undefined;
@@ -25,7 +25,8 @@ var A = /*@__PURE__*/ l({
25
25
  default: void 0
26
26
  },
27
27
  size: { default: "medium" },
28
- block: { type: Boolean }
28
+ block: { type: Boolean },
29
+ disabled: { type: Boolean }
29
30
  }, {
30
31
  modelValue: { type: [
31
32
  String,
@@ -70,6 +71,7 @@ var A = /*@__PURE__*/ l({
70
71
  h(G, [
71
72
  e.b(),
72
73
  e.m(w(N)),
74
+ e.is("disabled", l.disabled),
73
75
  { [e.m("block")]: l.block }
74
76
  ]), h(K, [e.m("selected")]), v(K, {
75
77
  width: L.value + "px",
@@ -82,14 +84,14 @@ var A = /*@__PURE__*/ l({
82
84
  h(n, [
83
85
  r.e("item"),
84
86
  r.is("selected", t.value === I.value),
85
- r.is("disabled", e.value[l.fieldNames.disabled])
87
+ r.is("disabled", e.value[l.fieldNames.disabled] || l.disabled)
86
88
  ]);
87
89
  }), g(n, null, 0), s("label", { option: () => e.value }), g(n, null, 1), a(() => !d.label, () => {
88
90
  let t = D(), n = C(t);
89
91
  return m(() => {
90
92
  h(t, [w(j).e("label")]), y(n, x(e.value[l.fieldNames.label]));
91
93
  }), t;
92
- }), n.$evtclick = o((t) => H(e.value[l.fieldNames.value], t, e.value[l.fieldNames.disabled])), m(() => W(n, (e) => B(e, t.value), !0)), n;
94
+ }), n.$evtclick = o((t) => H(e.value[l.fieldNames.value], t, e.value[l.fieldNames.disabled] || l.disabled)), m(() => W(n, (e) => B(e, t.value), !0)), n;
93
95
  }, (e, t) => e[l.fieldNames.value], 8), _(G, z, null, "containerRef"), G;
94
96
  }
95
97
  });
@@ -17,6 +17,8 @@ export interface SegmentedProps {
17
17
  size?: "mini" | "small" | "medium" | "large" | "larger";
18
18
  /** 是否撑满宽度 */
19
19
  block?: boolean;
20
+ /** 是否禁用 */
21
+ disabled?: boolean;
20
22
  }
21
23
  export interface SegmentedSlots {
22
24
  /** 选项标签 */
@@ -65,6 +65,7 @@ var ee = y("<div>", 1), w = /*@__PURE__*/ c({
65
65
  label: e[n],
66
66
  key: e[r],
67
67
  children: [],
68
+ raw: e,
68
69
  rawNode: { ...e },
69
70
  level: t ? t.level + 1 : 0,
70
71
  isLeaf: e.isLeaf ? e.isLeaf : w.loadMore ? !1 : !o?.length,
@@ -62,7 +62,9 @@ export interface TreeNode {
62
62
  key: string;
63
63
  /** 子节点数组 */
64
64
  children: TreeNode[];
65
- /** 原始节点数据 */
65
+ /** 原始节点数据(引用,对应 data 中的原始对象) */
66
+ raw: any;
67
+ /** 原始节点数据(浅拷贝) */
66
68
  rawNode: any;
67
69
  /** 节点层级 */
68
70
  level: number;
@@ -57,6 +57,9 @@
57
57
  color 0.3s getCssVar("bezier", "1");
58
58
  &:hover {
59
59
  background-color: var(--s-menu-hover-bg-color);
60
+ @include this-is(active-center) {
61
+ border-radius: getCssVar("radius", "medium");
62
+ }
60
63
  }
61
64
  @include when(active) {
62
65
  color: var(--s-menu-active-text-color);
@@ -83,6 +86,7 @@
83
86
  display: flex;
84
87
  flex-direction: column;
85
88
  gap: 2px;
89
+ padding-top: 4px;
86
90
  }
87
91
  @include e(item) {
88
92
  display: flex;
@@ -123,6 +127,9 @@
123
127
  color 0.3s getCssVar("bezier", "1");
124
128
  &:hover {
125
129
  background-color: var(--s-menu-hover-bg-color);
130
+ @include this-is(active-center) {
131
+ border-radius: getCssVar("radius", "medium");
132
+ }
126
133
  }
127
134
  @include when(active) {
128
135
  color: var(--s-menu-active-text-color);
@@ -175,6 +182,11 @@
175
182
  display: flex;
176
183
  flex-direction: column;
177
184
  gap: 2px;
185
+ padding: 4px 0;
186
+
187
+ @include be(menu, sub-menu) {
188
+ padding: 0 4px;
189
+ }
178
190
 
179
191
  @include be(menu, sub-title) {
180
192
  justify-content: flex-start !important;
@@ -185,6 +197,10 @@
185
197
  }
186
198
  }
187
199
 
200
+ @include be(menu, item) {
201
+ padding: 0 4px;
202
+ }
203
+
188
204
  @include be(menu, item-title) {
189
205
  justify-content: flex-start !important;
190
206
  padding: 0 20px !important;
@@ -12,6 +12,17 @@
12
12
  display: flex;
13
13
  width: 100%;
14
14
  }
15
+ @include when(disabled) {
16
+ cursor: not-allowed;
17
+ @include be(segmented, item) {
18
+ cursor: not-allowed;
19
+ color: getCssVar("color", "text-3");
20
+ user-select: none;
21
+ @include this-is(selected) {
22
+ background-color: getCssVar("color", "primary-4");
23
+ }
24
+ }
25
+ }
15
26
  @include e(item) {
16
27
  height: 100%;
17
28
  flex: 1;
@@ -28,6 +28,7 @@
28
28
  display: flex;
29
29
  align-items: center;
30
30
  position: relative;
31
+ border-radius: getCssVar("radius", "medium");
31
32
 
32
33
  &:hover {
33
34
  background-color: getCssVar("color", "fill-2");
@@ -1515,6 +1515,10 @@
1515
1515
  "description": "图标名称",
1516
1516
  "type": "string"
1517
1517
  },
1518
+ "s-sub-menu/activeCenter": {
1519
+ "description": "匹配menu-item的激活圆角",
1520
+ "type": "boolean"
1521
+ },
1518
1522
  "s-menu-group/name": {
1519
1523
  "description": "菜单键值",
1520
1524
  "type": "string | number"
@@ -2027,6 +2031,10 @@
2027
2031
  "description": "是否撑满宽度",
2028
2032
  "type": "boolean"
2029
2033
  },
2034
+ "s-segmented/disabled": {
2035
+ "description": "是否禁用",
2036
+ "type": "boolean"
2037
+ },
2030
2038
  "s-select/change": {
2031
2039
  "description": "选择器值改变时触发"
2032
2040
  },
@@ -643,7 +643,8 @@
643
643
  "title",
644
644
  "disabled",
645
645
  "ignoreLevel",
646
- "icon"
646
+ "icon",
647
+ "activeCenter"
647
648
  ]
648
649
  },
649
650
  "s-menu-group": {
@@ -846,7 +847,8 @@
846
847
  "fieldNames",
847
848
  "defaultValue",
848
849
  "size",
849
- "block"
850
+ "block",
851
+ "disabled"
850
852
  ]
851
853
  },
852
854
  "s-select": {
@@ -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.24.1",
5
+ "version": "0.25.0",
6
6
  "contributions": {
7
7
  "html": {
8
8
  "types-syntax": "typescript",
@@ -3943,6 +3943,14 @@
3943
3943
  "type": "string",
3944
3944
  "kind": "expression"
3945
3945
  }
3946
+ },
3947
+ {
3948
+ "name": "activeCenter",
3949
+ "description": "匹配menu-item的激活圆角",
3950
+ "value": {
3951
+ "type": "boolean",
3952
+ "kind": "expression"
3953
+ }
3946
3954
  }
3947
3955
  ],
3948
3956
  "events": [],
@@ -5253,6 +5261,14 @@
5253
5261
  "type": "boolean",
5254
5262
  "kind": "expression"
5255
5263
  }
5264
+ },
5265
+ {
5266
+ "name": "disabled",
5267
+ "description": "是否禁用",
5268
+ "value": {
5269
+ "type": "boolean",
5270
+ "kind": "expression"
5271
+ }
5256
5272
  }
5257
5273
  ],
5258
5274
  "events": [
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "savor-ui",
3
- "version": "0.25.0",
3
+ "version": "0.26.0",
4
4
  "description": "A Vue3 Components Library",
5
5
  "keywords": [
6
6
  "component library",