savor-ui 0.9.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.
Files changed (25) hide show
  1. package/CHANGELOG.md +29 -0
  2. package/dist/es/components/src/button/button.vue_vue_type_script_setup_true_vapor_true_lang.mjs +4 -2
  3. package/dist/es/components/src/button/index.d.ts +1 -0
  4. package/dist/es/components/src/button/types.d.ts +2 -0
  5. package/dist/es/components/src/form/form-item.vue_vue_type_script_setup_true_vapor_true_lang.mjs +2 -2
  6. package/dist/es/components/src/modal/modal.vue_vue_type_script_setup_true_vapor_true_lang.mjs +1 -0
  7. package/dist/es/components/src/segmented/index.d.ts +1 -0
  8. package/dist/es/components/src/segmented/segmented.vue_vue_type_script_setup_true_vapor_true_lang.mjs +31 -11
  9. package/dist/es/components/src/segmented/types.d.ts +2 -0
  10. package/dist/es/components/src/switch/index.d.ts +1 -0
  11. package/dist/es/components/src/switch/switch.vue_vue_type_script_setup_true_vapor_true_lang.mjs +14 -9
  12. package/dist/es/components/src/switch/types.d.ts +2 -0
  13. package/dist/es/components/src/table/table-body.vue_vue_type_script_setup_true_vapor_true_lang.mjs +68 -70
  14. package/dist/es/theme/components/button.scss +3 -0
  15. package/dist/es/theme/components/switch.scss +8 -9
  16. package/dist/es/theme/components/table.scss +57 -40
  17. package/dist/es/theme/components/tag.scss +1 -0
  18. package/dist/es/theme/components/tree.scss +1 -0
  19. package/dist/es/utils/src/theme/themeMap.mjs +5 -5
  20. package/dist/es/utils/src/tool.d.ts +7 -0
  21. package/dist/es/utils/src/tool.mjs +11 -2
  22. package/dist/json/vetur-attributes.json +12 -0
  23. package/dist/json/vetur-tags.json +4 -1
  24. package/dist/json/web-types.json +25 -1
  25. package/package.json +1 -1
package/CHANGELOG.md CHANGED
@@ -2,6 +2,35 @@
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
+
15
+ # [0.10.0](https://gitee.com/mach552/savor-ui/compare/v0.9.0...v0.10.0) (2026-07-09)
16
+
17
+
18
+ ### Bug Fixes
19
+
20
+ * **form:** 修复某些情况下无法重置的问题 ([c66f3ea](https://gitee.com/mach552/savor-ui/commits/c66f3ea835e89e68ce85875403561ba844215d6c))
21
+ * **segmented:** 修复默认激活条偶发宽度不足问题 ([0b3dab9](https://gitee.com/mach552/savor-ui/commits/0b3dab94b93b3a79a94066367bb8822e1cfa9613))
22
+ * **segmented:** 修复无默认值问题 ([33bd3c6](https://gitee.com/mach552/savor-ui/commits/33bd3c6d8c6f5a7c8e3c66a4660f2b00aa803127))
23
+ * **switch:** 修复大小与其他组件不一致问题 ([a805e12](https://gitee.com/mach552/savor-ui/commits/a805e122f1fb2b20c38af0d50575aba1694c290d))
24
+ * **switch:** 修复默认值是undefined问题 ([81b963c](https://gitee.com/mach552/savor-ui/commits/81b963c5f17224d4fcc99da9d37f30e69b3dc0a4))
25
+ * **table:** 修复列字段无法读取嵌套对象值的问题 ([2a8842c](https://gitee.com/mach552/savor-ui/commits/2a8842c0b2a17aa8c6683368bb094e61d19f642b))
26
+ * **table:** 修复某些场景下表头比弹层层级高的问题 ([81c836a](https://gitee.com/mach552/savor-ui/commits/81c836a97146017e469f4b79f1857a2c9dc67a06))
27
+ * **tag:** 修复文字换行问题 ([a1c0d94](https://gitee.com/mach552/savor-ui/commits/a1c0d94984fe7d92f5e93534b2071f89b25065aa))
28
+
29
+
30
+ ### Features
31
+
32
+ * **button:** 新增圆角按钮 ([75d5c6e](https://gitee.com/mach552/savor-ui/commits/75d5c6e96a0b7bef6b30a30edd8be02b608947cb))
33
+
5
34
  # [0.9.0](https://gitee.com/mach552/savor-ui/compare/v0.8.0...v0.9.0) (2026-07-07)
6
35
 
7
36
 
@@ -21,7 +21,8 @@ var y = g("<div>"), b = g(" "), x = g("<button>", 1), S = /*@__PURE__*/ c({
21
21
  text: { type: Boolean },
22
22
  link: { type: Boolean },
23
23
  secondary: { type: Boolean },
24
- outline: { type: Boolean }
24
+ outline: { type: Boolean },
25
+ round: { type: Boolean }
25
26
  },
26
27
  setup(c, { slots: g }) {
27
28
  let S = c, C = e("button"), w = l(n, void 0), T = r(() => w?.size?.value || S.size), E = x();
@@ -39,7 +40,8 @@ var y = g("<div>"), b = g(" "), x = g("<button>", 1), S = /*@__PURE__*/ c({
39
40
  e.is("disabled", t),
40
41
  e.is("loading", n),
41
42
  e.is("only-icon", !g.default && !c.label),
42
- e.is("outline", c.outline)
43
+ e.is("outline", c.outline),
44
+ e.is("round", c.round)
43
45
  ]), m(E, "disabled", t || n), d(E, "html-type", c.htmlType);
44
46
  }), p(E, null, 0), o(() => (g.icon || c.icon) && !c.loading, () => {
45
47
  let e = y();
@@ -19,6 +19,7 @@ export declare const SButton: ((__VLS_props: NonNullable<Awaited<typeof __VLS_se
19
19
  link?: boolean | undefined;
20
20
  secondary?: boolean | undefined;
21
21
  outline?: boolean | undefined;
22
+ round?: boolean | undefined;
22
23
  } & (typeof globalThis extends {
23
24
  __VLS_PROPS_FALLBACK: infer P;
24
25
  } ? P : {});
@@ -32,6 +32,8 @@ export interface ButtonProps {
32
32
  secondary?: boolean;
33
33
  /** 是否为轮廓按钮 */
34
34
  outline?: boolean;
35
+ /** 是否为圆角按钮 */
36
+ round?: boolean;
35
37
  }
36
38
  export interface ButtonSlots {
37
39
  /** 默认 */
@@ -58,7 +58,7 @@ var k = w("<span>"), A = w(" "), j = w("<div><label>"), M = w("<div> "), N = w("
58
58
  }, q = () => {
59
59
  K();
60
60
  let e = I?.model?.value;
61
- e && P.field && e[P.field] !== void 0 && (e[P.field] = z);
61
+ e && P.field && (e[P.field] = z);
62
62
  }, J = l(() => H.value.state === "error"), Y = {
63
63
  validate: G,
64
64
  field: P.field,
@@ -69,7 +69,7 @@ var k = w("<span>"), A = w(" "), j = w("<div><label>"), M = w("<div> "), N = w("
69
69
  size: I?.size,
70
70
  error: J
71
71
  }), h(() => {
72
- P.field && (I?.addField(Y), z = B.value);
72
+ P.field && (I?.addField(Y), z = I?.model?.value?.[P.field]);
73
73
  }), g(() => {
74
74
  P.field && I?.removeField(Y);
75
75
  }), w({
@@ -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,29 +42,44 @@ 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);
54
+ }), w((e) => {
55
+ let t = j.value[M.value];
56
+ if (!t) return;
57
+ let n = new ResizeObserver(() => {
58
+ requestAnimationFrame(L);
59
+ });
60
+ n.observe(t), e(() => n.disconnect());
48
61
  }), d(() => {
49
- 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());
50
70
  });
51
- let z = s(), B = D(), V = n(B);
71
+ let B = s(), V = D(), H = n(V);
52
72
  return p(() => {
53
73
  let e = S(k);
54
- m(B, [
74
+ m(V, [
55
75
  e.b(),
56
76
  e.m(c.size),
57
77
  { [e.m("block")]: c.block }
58
- ]), m(V, [e.m("selected")]), _(V, {
78
+ ]), m(H, [e.m("selected")]), _(H, {
59
79
  width: N.value + "px",
60
80
  left: P.value + "px"
61
81
  });
62
- }), h(B, null, 1), r(() => c.options, (e, t) => {
82
+ }), h(V, null, 1), r(() => c.options, (e, t) => {
63
83
  let n = E();
64
84
  return p(() => {
65
85
  let r = S(k);
@@ -73,8 +93,8 @@ var O = /*@__PURE__*/ c({
73
93
  return p(() => {
74
94
  m(t, [S(k).e("label")]), v(n, b(e.value[c.fieldNames.label]));
75
95
  }), t;
76
- }), 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;
77
- }, (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;
78
98
  }
79
99
  });
80
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: [
@@ -52,10 +57,10 @@ var M = /*@__PURE__*/ c({
52
57
  }),
53
58
  emits: /*@__PURE__*/ u(["change"], ["update:modelValue"]),
54
59
  setup(c, { emit: l }) {
55
- let u = c, x = l, { size: M, error: N } = C(u), { mergedSize: P, mergedError: F } = t({
56
- size: M,
57
- error: N
58
- }), I = e("switch"), L = E(c, "modelValue"), R = D("inputRef"), z = m(!1), B = r(() => L.value === u.activeValue), V = async () => {
60
+ let u = c, x = l, M = e("switch"), { size: N, error: P } = C(u), { mergedSize: F, mergedError: I } = t({
61
+ size: N,
62
+ error: P
63
+ }), L = E(c, "modelValue"), R = D("inputRef"), z = m(!1), B = r(() => L.value === u.activeValue), V = async () => {
59
64
  if (u.disabled) return;
60
65
  let e = B.value ? u.inactiveValue : u.activeValue;
61
66
  if (u.beforeChange) try {
@@ -66,20 +71,20 @@ var M = /*@__PURE__*/ c({
66
71
  z.value = !z.value, L.value = e, x("change", e);
67
72
  };
68
73
  p(() => {
69
- 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
  });
73
78
  let H = s(), U = j(), W = n(U), G = d(W, 1), K = n(G), q = d(K, 1);
74
79
  return f(W, "keypress", k(V, ["enter"])), H(W, R, null, "inputRef"), h(() => {
75
- let e = T(I), t = B.value, n = c.disabled, r = c.activeColor, i = c.inactiveColor;
80
+ let e = T(M), t = B.value, n = c.disabled, r = c.activeColor, i = c.inactiveColor;
76
81
  g(U, [
77
82
  e.b(),
78
- e.m(T(P)),
83
+ e.m(T(F)),
79
84
  e.is("checked", t),
80
85
  e.is("disabled", n),
81
86
  e.is("circle", c.circle),
82
- e.is("error", T(F))
87
+ e.is("error", T(I))
83
88
  ]), g(W, [e.e("inner")]), v(W, "disabled", n), g(G, [e.e("core")]), y(G, {
84
89
  backgroundColor: t ? r : i,
85
90
  borderColor: t ? r : i
@@ -87,7 +92,7 @@ var M = /*@__PURE__*/ c({
87
92
  }), _(K, null, 0), i(() => c.activeText || c.inactiveText, () => {
88
93
  let e = A(), t = w(e);
89
94
  return h(() => b(t, S(B.value ? c.activeText : c.inactiveText))), e;
90
- }), h(() => g(q, [T(I).e("core-action")])), _(q, null, 0), i(() => B.value, () => o("active-icon"), () => o("inactive-icon"), 517), U.$evtclick = a(V), U;
95
+ }), h(() => g(q, [T(M).e("core-action")])), _(q, null, 0), i(() => B.value, () => o("active-icon"), () => o("inactive-icon"), 517), U.$evtclick = a(V), U;
91
96
  }
92
97
  });
93
98
  //#endregion
@@ -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
  /** 激活时的值 */
@@ -1,14 +1,14 @@
1
- import { checkEllipsisVisible as e } from "../../../utils/src/tool.mjs";
1
+ import { checkEllipsisVisible as e, getValueByPath as t } from "../../../utils/src/tool.mjs";
2
2
  import "../../../utils/index.mjs";
3
- import { useNamespace as t } from "../../../hooks/src/use-namespace.mjs";
3
+ import { useNamespace as n } from "../../../hooks/src/use-namespace.mjs";
4
4
  import "../../../hooks/index.mjs";
5
- import n from "../../../icons/src/right.vue.mjs";
5
+ import r from "../../../icons/src/right.vue.mjs";
6
6
  import "../../../icons/index.mjs";
7
- import { STooltip as r } from "../tooltip/index.mjs";
8
- import { tableContextKey as i } from "./types.mjs";
9
- import { child as a, computed as o, createComponent as s, createComponentWithFallback as c, createFor as l, createIf as u, createInvoker as d, createSlot as f, createTemplateRefSetter as p, defineVaporComponent as m, delegateEvents as h, inject as g, nextTick as _, ref as v, renderEffect as y, resolveComponent as b, setClass as x, setInsertionState as S, setProp as C, setStyle as w, setText as T, template as E, toDisplayString as D, txt as O, unref as k, watch as A } from "vue";
7
+ import { STooltip as i } from "../tooltip/index.mjs";
8
+ import { tableContextKey as a } from "./types.mjs";
9
+ import { child as o, computed as s, createComponent as c, createComponentWithFallback as l, createFor as u, createIf as d, createInvoker as f, createSlot as ee, createTemplateRefSetter as p, defineVaporComponent as m, delegateEvents as h, inject as g, nextTick as _, ref as v, renderEffect as y, resolveComponent as b, setClass as x, setInsertionState as S, setProp as C, setStyle as w, setText as T, template as E, toDisplayString as D, txt as O, unref as k, watch as A } from "vue";
10
10
  //#region ../components/src/table/table-body.vue?vue&type=script&setup=true&vapor=true&lang.ts
11
- var j = E("<td><div>"), M = E("<span>"), N = E("<div><div> </div>"), P = E("<div><div> "), F = E("<td>"), ee = E("<tr>"), I = E("<tbody>", 1);
11
+ var j = E("<td><div>"), M = E("<span>"), N = E("<div><div> </div>"), P = E("<div><div> "), F = E("<td>"), I = E("<tr>"), te = E("<tbody>", 1);
12
12
  h("click");
13
13
  var L = /*@__PURE__*/ m({
14
14
  __name: "table-body",
@@ -19,7 +19,7 @@ var L = /*@__PURE__*/ m({
19
19
  "expandedRow"
20
20
  ],
21
21
  setup(m, { emit: h }) {
22
- let E = m, L = h, R = t("table"), z = g(i, void 0), B = v({}), V = v({}), H = (e, t) => {
22
+ let E = m, L = h, R = n("table"), z = g(a, void 0), B = v({}), V = v({}), H = (e, t) => {
23
23
  e instanceof HTMLElement && (V.value[t] = e);
24
24
  }, U = async () => {
25
25
  await _(), requestAnimationFrame(() => {
@@ -38,13 +38,13 @@ var L = /*@__PURE__*/ m({
38
38
  });
39
39
  let W = (e, t) => {
40
40
  L("expandedRow", e, t);
41
- }, G = o(() => z?.flatColumns.value || []), K = o(() => z?.props.stripe ?? !1), q = o(() => z?.isScrollAtLeft.value ?? !0), J = o(() => z?.isScrollAtRight.value ?? !1), Y = (e) => {
41
+ }, G = (e, n) => t(e, n), K = s(() => z?.flatColumns.value || []), q = s(() => z?.props.stripe ?? !1), J = s(() => z?.isScrollAtLeft.value ?? !0), Y = s(() => z?.isScrollAtRight.value ?? !1), X = (e) => {
42
42
  let t = {};
43
43
  return e.width === "auto" && (t.whiteSpace = "nowrap"), e.fixed && e.fixedOffset !== void 0 && (t.position = "sticky", t[e.fixed] = `${e.fixedOffset}px`, t.zIndex = 1), t;
44
- }, X = o(() => {
44
+ }, Z = s(() => {
45
45
  let e = z?.checked.value ?? [];
46
46
  return new Set(e.map((e) => e._id));
47
- }), Z = (e) => X.value.has(e._id), Q = (e, t, n) => {
47
+ }), Q = (e) => Z.value.has(e._id), ne = (e, t, n) => {
48
48
  let r = z?.checked.value ?? [], i;
49
49
  if (z?.props?.multiple) {
50
50
  let n = r.findIndex((e) => e._id === t._id);
@@ -55,97 +55,95 @@ var L = /*@__PURE__*/ m({
55
55
  else i = n === -1 ? [...r] : r.toSpliced(n, 1);
56
56
  } else i = e ? [E.data.find((e) => e._id === t._id)] : [];
57
57
  L("checkRow", t, n, i);
58
- }, te = (e) => {
58
+ }, re = (e) => {
59
59
  let t = z?.selected.value;
60
60
  return t && t._id === e._id;
61
- }, ne = (e) => {
61
+ }, ie = (e) => {
62
62
  if (!z?.props?.rowSelection) return;
63
63
  let t = z?.selected.value;
64
64
  L("selectRow", t && t._id === e._id ? {} : e, E.data.indexOf(e));
65
- }, re = p(), ie = b("s-checkbox"), $ = I();
66
- return S($, null, 0), l(() => E.data, (e, t) => {
67
- let i = ee();
65
+ }, ae = p(), oe = b("s-checkbox"), $ = te();
66
+ return S($, null, 0), u(() => E.data, (e, t) => {
67
+ let n = I();
68
68
  return y(() => {
69
- let n = k(R), r = e.value;
70
- x(i, [
71
- n.e("body-row"),
72
- n.is("stripe", K.value && t.value % 2 == 1),
73
- n.is("selected", te(r) || Z(r)),
74
- n.is("selection", k(z)?.props?.rowSelection)
69
+ let r = k(R), i = e.value;
70
+ x(n, [
71
+ r.e("body-row"),
72
+ r.is("stripe", q.value && t.value % 2 == 1),
73
+ r.is("selected", re(i) || Q(i)),
74
+ r.is("selection", k(z)?.props?.rowSelection)
75
75
  ]);
76
- }), S(i, null, 0), l(() => G.value, (i, o) => u(() => i.value.type === "select", () => {
77
- let n = j(), r = a(n);
76
+ }), S(n, null, 0), u(() => K.value, (n, a) => d(() => n.value.type === "select", () => {
77
+ let r = j(), i = o(r);
78
78
  y(() => {
79
- let e = k(R), t = i.value, a = t.fixed;
80
- x(n, [
79
+ let e = k(R), t = n.value, a = t.fixed;
80
+ x(r, [
81
81
  e.e("body-cell"),
82
82
  a ? e.m("body-cell", "fixed") : "",
83
83
  a ? e.m("body-cell", "fixed", t.fixed) : "",
84
- e.is("shadow", a === "left" && !q.value),
85
- e.is("shadow", a === "right" && !J.value),
84
+ e.is("shadow", a === "left" && !J.value),
85
+ e.is("shadow", a === "right" && !Y.value),
86
86
  { [e.m("body-cell", "align", t.align)]: t.align }
87
- ]), w(n, Y(t)), x(r, [e.e("body-cell-content")]);
88
- }), S(r, null, 0);
89
- let o = (n) => Q(n, e.value, t.value);
90
- return c(ie, {
91
- "model-value": () => Z(e.value),
92
- onChange: () => o
93
- }), n;
87
+ ]), w(r, X(t)), x(i, [e.e("body-cell-content")]);
88
+ }), S(i, null, 0);
89
+ let a = (n) => ne(n, e.value, t.value);
90
+ return l(oe, {
91
+ "model-value": () => Q(e.value),
92
+ onChange: () => a
93
+ }), r;
94
94
  }, () => {
95
- let c = F();
95
+ let s = F();
96
96
  return y(() => {
97
- let e = k(R), t = i.value, n = t.fixed;
98
- x(c, [
97
+ let e = k(R), t = n.value, r = t.fixed;
98
+ x(s, [
99
99
  e.e("body-cell"),
100
100
  e.is("ellipsis", t.ellipsis || t.ellipsisTooltip),
101
- n ? e.m("body-cell", "fixed") : "",
102
- n ? e.m("body-cell", "fixed", t.fixed) : "",
103
- e.is("shadow", n === "left" && !q.value),
104
- e.is("shadow", n === "right" && !J.value),
101
+ r ? e.m("body-cell", "fixed") : "",
102
+ r ? e.m("body-cell", "fixed", t.fixed) : "",
103
+ e.is("shadow", r === "left" && !J.value),
104
+ e.is("shadow", r === "right" && !Y.value),
105
105
  { [e.m("body-cell", "align", t.align)]: t.align }
106
- ]), w(c, Y(t));
107
- }), S(c, null, 0), u(() => i.value.slot, () => f(() => i.value.slot, {
108
- column: () => i.value,
106
+ ]), w(s, X(t));
107
+ }), S(s, null, 0), d(() => n.value.slot, () => ee(() => n.value.slot, {
108
+ column: () => n.value,
109
109
  index: () => t.value,
110
110
  row: () => e.value
111
- }), () => u(() => i.value.ellipsisTooltip, () => s(k(r), {
112
- content: () => e.value[i.value.field],
111
+ }), () => d(() => n.value.ellipsisTooltip, () => c(k(i), {
112
+ content: () => G(e.value, n.value.field),
113
113
  mini: "",
114
- disabled: () => B.value[t.value + "_" + o.value] !== !0
114
+ disabled: () => B.value[t.value + "_" + a.value] !== !0
115
115
  }, () => {
116
- let r = N(), c = a(r, 1);
116
+ let i = N(), s = o(i, 1);
117
117
  y(() => {
118
- x(r, [k(R).e("body-cell-content")]), w(r, { paddingLeft: i.value.treeNode ? (e.value._level || 0) * 24 + "px" : "0px" });
119
- }), S(r, 0, 0), u(() => e.value._hasChildren && i.value.treeNode, () => {
120
- let r = M();
118
+ x(i, [k(R).e("body-cell-content")]), w(i, { paddingLeft: n.value.treeNode ? (e.value._level || 0) * 24 + "px" : "0px" });
119
+ }), S(i, 0, 0), d(() => e.value._hasChildren && n.value.treeNode, () => {
120
+ let n = M();
121
121
  return y(() => {
122
122
  let t = k(R);
123
- x(r, [t.e("tree-node-arrow"), t.is("expanded", e.value._expanded)]);
124
- }), S(r, null, 0), s(k(n)), r.$evtclick = d(() => W(e.value, t.value)), r;
123
+ x(n, [t.e("tree-node-arrow"), t.is("expanded", e.value._expanded)]);
124
+ }), S(n, null, 0), c(k(r)), n.$evtclick = f(() => W(e.value, t.value)), n;
125
125
  });
126
- let l = O(c);
126
+ let l = O(s);
127
127
  return y(() => {
128
- let n = i.value;
129
- x(c, k(R).e("body-cell-text")), T(l, D(e.value[n.field])), re(c, (e) => H(e, t.value + "_" + o.value), !0);
130
- }), r;
128
+ x(s, k(R).e("body-cell-text")), T(l, D(G(e.value, n.value.field))), ae(s, (e) => H(e, t.value + "_" + a.value), !0);
129
+ }), i;
131
130
  }), () => {
132
- let r = P(), o = a(r, 1);
131
+ let i = P(), a = o(i, 1);
133
132
  y(() => {
134
- x(r, [k(R).e("body-cell-content")]), w(r, { paddingLeft: i.value.treeNode ? (e.value._level || 0) * 24 + "px" : "0px" });
135
- }), S(r, 0, 0), u(() => e.value._hasChildren && i.value.treeNode, () => {
136
- let r = M();
133
+ x(i, [k(R).e("body-cell-content")]), w(i, { paddingLeft: n.value.treeNode ? (e.value._level || 0) * 24 + "px" : "0px" });
134
+ }), S(i, 0, 0), d(() => e.value._hasChildren && n.value.treeNode, () => {
135
+ let n = M();
137
136
  return y(() => {
138
137
  let t = k(R);
139
- x(r, [t.e("tree-node-arrow"), t.is("expanded", e.value._expanded)]);
140
- }), S(r, null, 0), s(k(n)), r.$evtclick = d(() => W(e.value, t.value)), r;
138
+ x(n, [t.e("tree-node-arrow"), t.is("expanded", e.value._expanded)]);
139
+ }), S(n, null, 0), c(k(r)), n.$evtclick = f(() => W(e.value, t.value)), n;
141
140
  });
142
- let c = O(o);
141
+ let s = O(a);
143
142
  return y(() => {
144
- let t = i.value;
145
- x(o, k(R).e("body-cell-text")), T(c, D(e.value[t.field]));
146
- }), r;
147
- }, 1029), 517), c;
148
- }, 266), (e, t) => t, 17), i.$evtclick = d(() => ne(e.value)), i;
143
+ x(a, k(R).e("body-cell-text")), T(s, D(G(e.value, n.value.field)));
144
+ }), i;
145
+ }, 1029), 517), s;
146
+ }, 266), (e, t) => t, 17), n.$evtclick = f(() => ie(e.value)), n;
149
147
  }, (e, t) => t, 9), C($, "tabindex", -1), $;
150
148
  }
151
149
  });
@@ -30,6 +30,9 @@
30
30
  @include when(block) {
31
31
  width: 100% !important;
32
32
  }
33
+ @include when(round) {
34
+ border-radius: getCssVar("radius", "round");
35
+ }
33
36
  @include when(secondary) {
34
37
  color: getCssVar("color", "text-1");
35
38
  background-color: getCssVar("color", "fill-2");
@@ -6,7 +6,6 @@
6
6
  display: inline-flex;
7
7
  align-items: center;
8
8
  font-size: getCssVar("font-size", "medium");
9
- line-height: 1.5715;
10
9
 
11
10
  @include when(disabled) {
12
11
  @include be(switch, core) {
@@ -26,10 +25,10 @@
26
25
  @each $size in $size-list {
27
26
  @include this-bm(switch, #{$size}) {
28
27
  @include be(switch, core-action) {
29
- left: calc(100% - (getCssVar("size", $size) - 12px + 3px));
28
+ left: calc(100% - (getCssVar("size", $size) - 8px + 3px));
30
29
  }
31
30
  @include be(switch, core-label) {
32
- padding: 0 calc(getCssVar("size", $size) - 12px + 8px) 0 8px;
31
+ padding: 0 getCssVar("size", $size) 0 8px;
33
32
  }
34
33
  }
35
34
  }
@@ -92,21 +91,21 @@
92
91
 
93
92
  @each $size in $size-list {
94
93
  @include m(#{$size}) {
95
- height: calc(getCssVar("size", $size) - 4px);
96
- min-width: calc((getCssVar("size", $size) - 4px) * 2);
94
+ height: getCssVar("size", $size);
95
+ min-width: calc(getCssVar("size", $size) * 2);
97
96
  @include be(switch, core-action) {
98
- height: calc(getCssVar("size", $size) - 12px);
99
- width: calc(getCssVar("size", $size) - 12px);
97
+ height: calc(getCssVar("size", $size) - 8px);
98
+ width: calc(getCssVar("size", $size) - 8px);
100
99
  }
101
100
  @include be(switch, core-label) {
102
- padding: 0 8px 0 calc(getCssVar("size", $size) - 12px + 8px);
101
+ padding: 0 8px 0 getCssVar("size", $size);
103
102
  }
104
103
  }
105
104
  }
106
105
 
107
106
  @include when(circle) {
108
107
  @include be(switch, core) {
109
- border-radius: 999px;
108
+ border-radius: getCssVar("radius", "round");
110
109
  }
111
110
 
112
111
  @include be(switch, core-action) {
@@ -3,6 +3,7 @@
3
3
 
4
4
  @include b(table) {
5
5
  position: relative;
6
+ isolation: isolate;
6
7
  font-size: 14px;
7
8
  background-color: getCssVar("color", "bg-2");
8
9
  box-sizing: border-box;
@@ -49,19 +50,23 @@
49
50
  @include m(fixed_left) {
50
51
  position: sticky;
51
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
+ }
52
66
  @include when(shadow) {
53
67
  background-color: getCssVar("color", "fill-1");
54
68
  &::after {
55
- content: "";
56
- position: absolute;
57
- top: 0;
58
- right: 0;
59
- bottom: 0;
60
- width: 30px;
61
- transform: translateX(100%);
62
- pointer-events: none;
63
- box-shadow: inset 12px 0 8px -12px rgba(0, 0, 0, 0.18);
64
- z-index: 12;
69
+ opacity: 1;
65
70
  }
66
71
  }
67
72
  }
@@ -69,19 +74,23 @@
69
74
  @include m(fixed_right) {
70
75
  position: sticky;
71
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
+ }
72
90
  @include when(shadow) {
73
91
  background-color: getCssVar("color", "fill-1");
74
92
  &::after {
75
- content: "";
76
- position: absolute;
77
- top: 0;
78
- left: 0;
79
- bottom: 0;
80
- width: 30px;
81
- transform: translateX(-100%);
82
- pointer-events: none;
83
- box-shadow: inset -12px 0 8px -12px rgba(0, 0, 0, 0.18);
84
- z-index: 12;
93
+ opacity: 1;
85
94
  }
86
95
  }
87
96
  }
@@ -168,18 +177,22 @@
168
177
  @include m(fixed_left) {
169
178
  position: sticky;
170
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
+ }
171
193
  @include when(shadow) {
172
194
  &::after {
173
- content: "";
174
- position: absolute;
175
- top: 0;
176
- right: 0;
177
- bottom: 0;
178
- width: 30px;
179
- transform: translateX(100%);
180
- pointer-events: none;
181
- box-shadow: inset 12px 0 8px -12px rgba(0, 0, 0, 0.18);
182
- z-index: 12;
195
+ opacity: 1;
183
196
  }
184
197
  }
185
198
  }
@@ -187,18 +200,22 @@
187
200
  @include m(fixed_right) {
188
201
  position: sticky;
189
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
+ }
190
216
  @include when(shadow) {
191
217
  &::after {
192
- content: "";
193
- position: absolute;
194
- top: 0;
195
- left: 0;
196
- bottom: 0;
197
- width: 30px;
198
- transform: translateX(-100%);
199
- pointer-events: none;
200
- box-shadow: inset -12px 0 8px -12px rgba(0, 0, 0, 0.18);
201
- z-index: 12;
218
+ opacity: 1;
202
219
  }
203
220
  }
204
221
  }
@@ -10,6 +10,7 @@
10
10
  justify-content: center;
11
11
  gap: 4px;
12
12
  color: getCssVar("color", "text-1");
13
+ white-space: nowrap;
13
14
 
14
15
  @include m(default) {
15
16
  background-color: getCssVar("color", "fill-2");
@@ -22,6 +22,7 @@
22
22
  }
23
23
  @include when(selected) {
24
24
  background-color: getCssVar("color", "fill-2");
25
+ color: getCssVar("color", "primary-6");
25
26
  }
26
27
  @include when(disabled) {
27
28
  cursor: not-allowed;
@@ -52,11 +52,11 @@ var t = "s", n = [
52
52
  lineHeightLarge: "24px",
53
53
  lineHeightLarger: "28px",
54
54
  radiusMini: "2px",
55
- radiusSmall: "2px",
56
- radiusMedium: "2px",
57
- radiusLarge: "2px",
58
- radiusLarger: "4px",
59
- radiusRound: "999px",
55
+ radiusSmall: "4px",
56
+ radiusMedium: "6px",
57
+ radiusLarge: "8px",
58
+ radiusLarger: "12px",
59
+ radiusRound: "9999px",
60
60
  radiusCircle: "100%",
61
61
  bezier1: "cubic-bezier(0.4, 0, 0.2, 1)",
62
62
  bezierIn: "cubic-bezier(0.4, 0, 1, 1)",
@@ -27,3 +27,10 @@ export declare const addGroupSeparator: (numStr: string) => string;
27
27
  * 判断元素文字是否溢出并展示省略号
28
28
  */
29
29
  export declare const checkEllipsisVisible: (el: HTMLElement) => boolean;
30
+ /**
31
+ * 根据路径获取对象嵌套属性值,支持点号分隔(如 "dept.title")
32
+ * @param obj 目标对象
33
+ * @param path 属性路径
34
+ * @returns 属性值,路径无效时返回 undefined
35
+ */
36
+ export declare const getValueByPath: (obj: any, path: string) => any;
@@ -22,6 +22,15 @@ var e = (e, t) => {
22
22
  }, r = (e) => e === void 0 || e === "auto" ? 0 : typeof e == "number" ? e : parseFloat(e) || 0, i = (e) => {
23
23
  let t = e.split(".");
24
24
  return t[0] = t[0].replace(/\B(?=(\d{3})+(?!\d))/g, ","), t.join(".");
25
- }, a = (e) => !e.isConnected || e.getBoundingClientRect().width <= 1 ? !1 : e.scrollWidth > e.clientWidth;
25
+ }, a = (e) => !e.isConnected || e.getBoundingClientRect().width <= 1 ? !1 : e.scrollWidth > e.clientWidth, o = (e, t) => {
26
+ if (e == null || !t) return;
27
+ if (!t.includes(".")) return e[t];
28
+ let n = t.split("."), r = e;
29
+ for (let e of n) {
30
+ if (r == null) return;
31
+ r = r[e];
32
+ }
33
+ return r;
34
+ };
26
35
  //#endregion
27
- export { i as addGroupSeparator, a as checkEllipsisVisible, e as debounce, n as getSize, r as getSizeNum, t as randomId };
36
+ export { i as addGroupSeparator, a as checkEllipsisVisible, e as debounce, n as getSize, r as getSizeNum, o as getValueByPath, t as randomId };
@@ -191,6 +191,10 @@
191
191
  "description": "是否为轮廓按钮",
192
192
  "type": "boolean"
193
193
  },
194
+ "s-button/round": {
195
+ "description": "是否为圆角按钮",
196
+ "type": "boolean"
197
+ },
194
198
  "s-button-group/size": {
195
199
  "description": "按钮组大小"
196
200
  },
@@ -1786,6 +1790,10 @@
1786
1790
  "s-segmented/fieldNames": {
1787
1791
  "description": "字段名"
1788
1792
  },
1793
+ "s-segmented/defaultValue": {
1794
+ "description": "默认值",
1795
+ "type": "string | number | boolean"
1796
+ },
1789
1797
  "s-segmented/size": {
1790
1798
  "description": "尺寸"
1791
1799
  },
@@ -2061,6 +2069,10 @@
2061
2069
  "description": "开关状态(v-model)",
2062
2070
  "type": "boolean | string | number"
2063
2071
  },
2072
+ "s-switch/defaultValue": {
2073
+ "description": "默认值",
2074
+ "type": "boolean | string | number"
2075
+ },
2064
2076
  "s-switch/disabled": {
2065
2077
  "description": "是否禁用",
2066
2078
  "type": "boolean"
@@ -80,7 +80,8 @@
80
80
  "text",
81
81
  "link",
82
82
  "secondary",
83
- "outline"
83
+ "outline",
84
+ "round"
84
85
  ]
85
86
  },
86
87
  "s-button-group": {
@@ -760,6 +761,7 @@
760
761
  "change",
761
762
  "options",
762
763
  "fieldNames",
764
+ "defaultValue",
763
765
  "size",
764
766
  "block"
765
767
  ]
@@ -875,6 +877,7 @@
875
877
  "attributes": [
876
878
  "change",
877
879
  "modelValue",
880
+ "defaultValue",
878
881
  "disabled",
879
882
  "activeValue",
880
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.8.0",
5
+ "version": "0.10.0",
6
6
  "contributions": {
7
7
  "html": {
8
8
  "types-syntax": "typescript",
@@ -495,6 +495,14 @@
495
495
  "type": "boolean",
496
496
  "kind": "expression"
497
497
  }
498
+ },
499
+ {
500
+ "name": "round",
501
+ "description": "是否为圆角按钮",
502
+ "value": {
503
+ "type": "boolean",
504
+ "kind": "expression"
505
+ }
498
506
  }
499
507
  ],
500
508
  "events": [],
@@ -4665,6 +4673,14 @@
4665
4673
  "kind": "expression"
4666
4674
  }
4667
4675
  },
4676
+ {
4677
+ "name": "defaultValue",
4678
+ "description": "默认值",
4679
+ "value": {
4680
+ "type": "string | number | boolean",
4681
+ "kind": "expression"
4682
+ }
4683
+ },
4668
4684
  {
4669
4685
  "name": "size",
4670
4686
  "description": "尺寸",
@@ -5369,6 +5385,14 @@
5369
5385
  "kind": "expression"
5370
5386
  }
5371
5387
  },
5388
+ {
5389
+ "name": "defaultValue",
5390
+ "description": "默认值",
5391
+ "value": {
5392
+ "type": "boolean | string | number",
5393
+ "kind": "expression"
5394
+ }
5395
+ },
5372
5396
  {
5373
5397
  "name": "disabled",
5374
5398
  "description": "是否禁用",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "savor-ui",
3
- "version": "0.9.0",
3
+ "version": "0.10.1",
4
4
  "description": "A Vue3 Components Library",
5
5
  "keywords": [
6
6
  "component library",