savor-ui 0.10.0 → 0.10.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.
package/CHANGELOG.md CHANGED
@@ -2,6 +2,16 @@
2
2
 
3
3
 
4
4
 
5
+ ## [0.10.1](https://gitee.com/mach552/savor-ui/compare/v0.10.0...v0.10.1) (2026-07-14)
6
+
7
+
8
+ ### Bug Fixes
9
+
10
+ * **segmented:** 修复默认值回写逻辑问题 ([780d4f2](https://gitee.com/mach552/savor-ui/commits/780d4f2c5bff2a74e8fb494dcdf813154a8c73be))
11
+ * **segmented:** 修复默认状态下激活条宽度不足的问题 ([80856e0](https://gitee.com/mach552/savor-ui/commits/80856e06ad03781dab6369624d936cc633fe0918))
12
+ * **switch:** 修复默认值回写逻辑问题 ([0b0ed8b](https://gitee.com/mach552/savor-ui/commits/0b0ed8bb585669602d450633b71c804bb4598a6e))
13
+ * **table:** 修复fiexd列内容位移问题 ([729b620](https://gitee.com/mach552/savor-ui/commits/729b6208260c329012a28dad825195d7da031a95))
14
+
5
15
  # [0.10.0](https://gitee.com/mach552/savor-ui/compare/v0.9.0...v0.10.0) (2026-07-09)
6
16
 
7
17
 
@@ -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
  }, {
@@ -37,12 +42,13 @@ var O = /*@__PURE__*/ c({
37
42
  }
38
43
  }, R = (e, t, n) => {
39
44
  n || (A.value = e, O("change", e, t));
45
+ }, z = () => {
46
+ if (y.options.length === 0) return 0;
47
+ let e = y.options.map((e) => e[y.fieldNames.value]), t = A.value ? e.indexOf(A.value) : 0;
48
+ return t >= 0 ? t : 0;
40
49
  };
41
50
  w(() => {
42
- if (y.options.length > 0) {
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
- }
51
+ y.options.length > 0 && (M.value = z(), requestAnimationFrame(L));
46
52
  }), t(F, () => {
47
53
  requestAnimationFrame(L);
48
54
  }), w((e) => {
@@ -53,20 +59,27 @@ var O = /*@__PURE__*/ c({
53
59
  });
54
60
  n.observe(t), e(() => n.disconnect());
55
61
  }), d(() => {
56
- A.value === void 0 && y.options.length > 0 && (A.value = y.options[0][y.fieldNames.value]), requestAnimationFrame(L);
62
+ A.value === void 0 && y.defaultValue !== void 0 && (A.value = y.defaultValue), M.value = z(), L(), requestAnimationFrame(L);
63
+ }), w((e) => {
64
+ let t = F.value;
65
+ if (!t) return;
66
+ let n = new IntersectionObserver((e) => {
67
+ e.some((e) => e.isIntersecting) && requestAnimationFrame(L);
68
+ });
69
+ n.observe(t), e(() => n.disconnect());
57
70
  });
58
- let z = s(), B = D(), V = n(B);
71
+ let B = s(), V = D(), H = n(V);
59
72
  return p(() => {
60
73
  let e = S(k);
61
- m(B, [
74
+ m(V, [
62
75
  e.b(),
63
76
  e.m(c.size),
64
77
  { [e.m("block")]: c.block }
65
- ]), m(V, [e.m("selected")]), _(V, {
78
+ ]), m(H, [e.m("selected")]), _(H, {
66
79
  width: N.value + "px",
67
80
  left: P.value + "px"
68
81
  });
69
- }), h(B, null, 1), r(() => c.options, (e, t) => {
82
+ }), h(V, null, 1), r(() => c.options, (e, t) => {
70
83
  let n = E();
71
84
  return p(() => {
72
85
  let r = S(k);
@@ -80,8 +93,8 @@ var O = /*@__PURE__*/ c({
80
93
  return p(() => {
81
94
  m(t, [S(k).e("label")]), v(n, b(e.value[c.fieldNames.label]));
82
95
  }), t;
83
- }), n.$evtclick = a((t) => R(e.value[c.fieldNames.value], t, e.value[c.fieldNames.disabled])), p(() => z(n, (e) => I(e, t.value), !0)), n;
84
- }, (e, t) => e[c.fieldNames.value], 8), g(B, F, null, "containerRef"), B;
96
+ }), 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;
97
+ }, (e, t) => e[c.fieldNames.value], 8), g(V, F, null, "containerRef"), V;
85
98
  }
86
99
  });
87
100
  //#endregion
@@ -11,6 +11,8 @@ export interface SegmentedProps {
11
11
  options: any[];
12
12
  /** 字段名 */
13
13
  fieldNames?: SegmentedFieldNamesProps;
14
+ /** 默认值 */
15
+ defaultValue?: string | number | boolean;
14
16
  /** 尺寸 */
15
17
  size?: "small" | "medium" | "large";
16
18
  /** 是否撑满宽度 */
@@ -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;
@@ -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: [
@@ -66,7 +71,7 @@ var M = /*@__PURE__*/ c({
66
71
  z.value = !z.value, L.value = e, x("change", e);
67
72
  };
68
73
  p(() => {
69
- L.value === void 0 && (L.value = u.inactiveValue), R.value.checked = B.value, z.value = B.value;
74
+ L.value === void 0 && u.defaultValue !== void 0 && (L.value = u.defaultValue), R.value.checked = B.value, z.value = B.value;
70
75
  }), O(B, (e) => {
71
76
  R.value.checked = e;
72
77
  });
@@ -1,6 +1,8 @@
1
1
  export interface SwitchProps {
2
2
  /** 开关状态(v-model) */
3
3
  modelValue?: boolean | string | number;
4
+ /** 默认值 */
5
+ defaultValue?: boolean | string | number;
4
6
  /** 是否禁用 */
5
7
  disabled?: boolean;
6
8
  /** 激活时的值 */
@@ -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
- content: "";
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
- content: "";
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
- content: "";
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
- content: "";
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
  }
@@ -1790,6 +1790,10 @@
1790
1790
  "s-segmented/fieldNames": {
1791
1791
  "description": "字段名"
1792
1792
  },
1793
+ "s-segmented/defaultValue": {
1794
+ "description": "默认值",
1795
+ "type": "string | number | boolean"
1796
+ },
1793
1797
  "s-segmented/size": {
1794
1798
  "description": "尺寸"
1795
1799
  },
@@ -2065,6 +2069,10 @@
2065
2069
  "description": "开关状态(v-model)",
2066
2070
  "type": "boolean | string | number"
2067
2071
  },
2072
+ "s-switch/defaultValue": {
2073
+ "description": "默认值",
2074
+ "type": "boolean | string | number"
2075
+ },
2068
2076
  "s-switch/disabled": {
2069
2077
  "description": "是否禁用",
2070
2078
  "type": "boolean"
@@ -761,6 +761,7 @@
761
761
  "change",
762
762
  "options",
763
763
  "fieldNames",
764
+ "defaultValue",
764
765
  "size",
765
766
  "block"
766
767
  ]
@@ -876,6 +877,7 @@
876
877
  "attributes": [
877
878
  "change",
878
879
  "modelValue",
880
+ "defaultValue",
879
881
  "disabled",
880
882
  "activeValue",
881
883
  "activeColor",
@@ -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.9.0",
5
+ "version": "0.10.0",
6
6
  "contributions": {
7
7
  "html": {
8
8
  "types-syntax": "typescript",
@@ -4673,6 +4673,14 @@
4673
4673
  "kind": "expression"
4674
4674
  }
4675
4675
  },
4676
+ {
4677
+ "name": "defaultValue",
4678
+ "description": "默认值",
4679
+ "value": {
4680
+ "type": "string | number | boolean",
4681
+ "kind": "expression"
4682
+ }
4683
+ },
4676
4684
  {
4677
4685
  "name": "size",
4678
4686
  "description": "尺寸",
@@ -5377,6 +5385,14 @@
5377
5385
  "kind": "expression"
5378
5386
  }
5379
5387
  },
5388
+ {
5389
+ "name": "defaultValue",
5390
+ "description": "默认值",
5391
+ "value": {
5392
+ "type": "boolean | string | number",
5393
+ "kind": "expression"
5394
+ }
5395
+ },
5380
5396
  {
5381
5397
  "name": "disabled",
5382
5398
  "description": "是否禁用",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "savor-ui",
3
- "version": "0.10.0",
3
+ "version": "0.10.1",
4
4
  "description": "A Vue3 Components Library",
5
5
  "keywords": [
6
6
  "component library",