savor-ui 0.15.7 → 0.17.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.
Files changed (34) hide show
  1. package/CHANGELOG.md +28 -0
  2. package/dist/es/components/src/cascader/cascader.vue_vue_type_script_setup_true_vapor_true_lang.mjs +30 -28
  3. package/dist/es/components/src/descriptions/descriptions-item.vue_vue_type_script_setup_true_vapor_true_lang.mjs +35 -33
  4. package/dist/es/components/src/descriptions/descriptions.vue_vue_type_script_setup_true_vapor_true_lang.mjs +1 -1
  5. package/dist/es/components/src/grid/grid-item.vue_vue_type_script_setup_true_vapor_true_lang.mjs +6 -3
  6. package/dist/es/components/src/grid/grid.vue_vue_type_script_setup_true_vapor_true_lang.mjs +16 -10
  7. package/dist/es/components/src/grid/types.d.ts +2 -0
  8. package/dist/es/components/src/menu/index.d.ts +2 -0
  9. package/dist/es/components/src/menu/menu.vue_vue_type_script_setup_true_vapor_true_lang.mjs +6 -2
  10. package/dist/es/components/src/menu/types.d.ts +3 -0
  11. package/dist/es/components/src/modal/index.d.ts +5 -0
  12. package/dist/es/components/src/modal/modal.vue_vue_type_script_setup_true_vapor_true_lang.mjs +23 -13
  13. package/dist/es/components/src/modal/types.d.ts +9 -0
  14. package/dist/es/components/src/statistic/index.d.ts +1 -0
  15. package/dist/es/components/src/statistic/statistic.vue_vue_type_script_setup_true_vapor_true_lang.mjs +52 -36
  16. package/dist/es/components/src/statistic/types.d.ts +2 -0
  17. package/dist/es/components/src/table/index.d.ts +7 -4
  18. package/dist/es/components/src/table/table-body.vue_vue_type_script_setup_true_vapor_true_lang.mjs +24 -35
  19. package/dist/es/components/src/table/table-header.vue_vue_type_script_setup_true_vapor_true_lang.mjs +51 -46
  20. package/dist/es/components/src/table/table.d.ts +5 -3
  21. package/dist/es/components/src/table/table.vue_vue_type_script_setup_true_vapor_true_lang.mjs +100 -82
  22. package/dist/es/components/src/table/types.d.ts +12 -1
  23. package/dist/es/components/src/tree/index.d.ts +3 -3
  24. package/dist/es/components/src/tree/tree.d.ts +2 -2
  25. package/dist/es/core/index.d.ts +1 -0
  26. package/dist/es/core/index.mjs +3 -2
  27. package/dist/es/theme/components/avatar.scss +2 -0
  28. package/dist/es/theme/components/grid.scss +1 -0
  29. package/dist/es/theme/components/radio.scss +7 -0
  30. package/dist/es/theme/components/statistic.scss +11 -11
  31. package/dist/json/vetur-attributes.json +34 -0
  32. package/dist/json/vetur-tags.json +12 -2
  33. package/dist/json/web-types.json +81 -1
  34. package/package.json +1 -1
package/CHANGELOG.md CHANGED
@@ -2,6 +2,34 @@
2
2
 
3
3
 
4
4
 
5
+ # [0.17.0](https://gitee.com/mach552/savor-ui/compare/v0.16.0...v0.17.0) (2026-08-07)
6
+
7
+
8
+ ### Bug Fixes
9
+
10
+ * **cascader:** 修复选项列表更新时不刷新值的问题 ([a31af18](https://gitee.com/mach552/savor-ui/commits/a31af1880ec72b9445b411751f5e628aa992bd42))
11
+ * **grid:** 修复换行会残留间隔的问题 ([9dace33](https://gitee.com/mach552/savor-ui/commits/9dace337a3c5ff6c25d13d49e5ee0554b5a26fc6))
12
+
13
+
14
+ ### Features
15
+
16
+ * **modal:** 添加按钮相关属性 ([3c46e27](https://gitee.com/mach552/savor-ui/commits/3c46e278714fe20280d139879ead9cedd690df37))
17
+
18
+ # [0.16.0](https://gitee.com/mach552/savor-ui/compare/v0.15.7...v0.16.0) (2026-08-06)
19
+
20
+
21
+ ### Bug Fixes
22
+
23
+ * **descriptions:** 修复竖向布局时label宽度没有撑满的问题 ([d460cd0](https://gitee.com/mach552/savor-ui/commits/d460cd0a3df7c420a67e94a9deae7589a5bc7a1c))
24
+ * **radio:** 修复button的禁用样式无效问题 ([d647d8e](https://gitee.com/mach552/savor-ui/commits/d647d8e8e60b6cf41430b4ca0c6f44600cbef1d9))
25
+ * **statistic:** 修复动画无效的问题 ([3db3653](https://gitee.com/mach552/savor-ui/commits/3db3653c7ac933bcf4d554c5b39ab75ebbd10ea2))
26
+
27
+
28
+ ### Features
29
+
30
+ * **menu:** 新增滚动条属性 ([b6b3485](https://gitee.com/mach552/savor-ui/commits/b6b34857afb6aab2a0c7e4d897b55266ce8ec5d8))
31
+ * **table:** 新增隐藏头部属性 ([d1954d9](https://gitee.com/mach552/savor-ui/commits/d1954d978921f876a1230c43ff92d719645c1dcd))
32
+
5
33
  ## [0.15.7](https://gitee.com/mach552/savor-ui/compare/v0.15.6...v0.15.7) (2026-08-05)
6
34
 
7
35
 
@@ -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 ee from "./cascader-column.vue.mjs";
10
- import { computed as o, createComponent as s, createComponentWithFallback as c, createIf as te, createInvoker as l, createTemplateRefSetter as u, defineVaporComponent as d, delegateEvents as f, mergeModels as p, on as m, onMounted as h, ref as g, renderEffect as _, resolveComponent as ne, setClass as v, setInsertionState as y, template as b, toRefs as x, unref as S, useModel as C, useTemplateRef as w, watch as T, withModifiers as E, withVaporModifiers as D } from "vue";
10
+ import { computed as o, createComponent as s, createComponentWithFallback as c, createIf as l, createInvoker as u, createTemplateRefSetter as te, defineVaporComponent as d, delegateEvents as f, mergeModels as p, on as m, onMounted as h, ref as g, renderEffect as _, resolveComponent as ne, setClass as v, setInsertionState as y, template as b, toRefs as x, unref as S, useModel as C, useTemplateRef as w, watch as T, withModifiers as E, withVaporModifiers as D } from "vue";
11
11
  //#region ../components/src/cascader/cascader.vue?vue&type=script&setup=true&vapor=true&lang.ts
12
- var re = b("<div style=\"padding: 12px\">"), ie = b("<div>"), ae = b("<div data-skip-blur-validation>"), oe = b("<div>", 1);
12
+ var O = b("<div style=\"padding: 12px\">"), re = b("<div>"), ie = b("<div data-skip-blur-validation>"), ae = b("<div>", 1);
13
13
  f("mousedown", "focusin", "click");
14
- var O = /*@__PURE__*/ d({
14
+ var k = /*@__PURE__*/ d({
15
15
  name: "SCascader",
16
16
  __name: "cascader",
17
17
  props: /*@__PURE__*/ p({
@@ -52,8 +52,8 @@ var O = /*@__PURE__*/ d({
52
52
  "update:expanded"
53
53
  ]),
54
54
  setup(d, { emit: f }) {
55
- let p = d, b = e("cascader"), O = f, k = w("inputRef"), A = C(d, "modelValue"), { size: j, error: M } = x(p), { mergedSize: N, mergedError: P } = n({
56
- size: j,
55
+ let p = d, b = e("cascader"), k = f, A = w("inputRef"), j = C(d, "modelValue"), { size: oe, error: M } = x(p), { mergedSize: N, mergedError: P } = n({
56
+ size: oe,
57
57
  error: M
58
58
  }), F = C(d, "expandedKeys"), I = C(d, "expanded"), L = o(() => ({
59
59
  label: "label",
@@ -63,18 +63,18 @@ var O = /*@__PURE__*/ d({
63
63
  })), R = g(""), z = g([]), B = (e) => p.pathMode ? e.map((e) => e[L.value.key]).join(p.pathSeparator) : e[e.length - 1][L.value.key], V = (e) => e.map((e) => e[L.value.label]).join(p.pathSeparator), H = ({ item: e, expandeds: t, unchecked: n }) => {
64
64
  if (p.multiple) {
65
65
  let r = e[L.value.key], i = z.value.findIndex((e) => e[e.length - 1][L.value.key] === r);
66
- 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(", "), O("selectItem", {
66
+ n ? i !== -1 && (z.value = z.value.toSpliced(i, 1)) : i === -1 && (z.value = [...z.value, t]), j.value = z.value.map(B), R.value = z.value.map(V).join(", "), k("selectItem", {
67
67
  item: e,
68
68
  expandeds: t
69
69
  });
70
70
  return;
71
71
  }
72
- R.value = V(t), A.value = B(t), O("selectItem", {
72
+ R.value = V(t), j.value = B(t), k("selectItem", {
73
73
  item: e,
74
74
  expandeds: t
75
75
  }), K(!1);
76
76
  }, U = () => {
77
- O("expand", F.value);
77
+ k("expand", F.value);
78
78
  }, W = w("popoverRef"), G = g(!1), K = (e) => {
79
79
  G.value = e, e ? W.value?.show() : W.value?.hide();
80
80
  }, se = () => {
@@ -83,7 +83,7 @@ var O = /*@__PURE__*/ d({
83
83
  }, ce = () => {
84
84
  K(!1);
85
85
  }, le = (e) => {
86
- e.target && k.value?.focus();
86
+ e.target && A.value?.focus();
87
87
  }, q = (e, t, n = []) => {
88
88
  for (let r of e) {
89
89
  let e = [...n, r];
@@ -103,12 +103,12 @@ var O = /*@__PURE__*/ d({
103
103
  }
104
104
  return n;
105
105
  }, Y = () => {
106
- if (A.value === void 0 || A.value === "") {
106
+ if (j.value === void 0 || j.value === "") {
107
107
  R.value = "", F.value = [], I.value = [], z.value = [];
108
108
  return;
109
109
  }
110
110
  if (p.multiple) {
111
- z.value = (Array.isArray(A.value) ? A.value : []).map((e) => {
111
+ z.value = (Array.isArray(j.value) ? j.value : []).map((e) => {
112
112
  if (p.pathMode && typeof e == "string") {
113
113
  let t = e.split(p.pathSeparator);
114
114
  return J(p.options, t);
@@ -118,24 +118,26 @@ var O = /*@__PURE__*/ d({
118
118
  return;
119
119
  }
120
120
  let e = null;
121
- if (p.pathMode && typeof A.value == "string") {
122
- let t = A.value.split(p.pathSeparator);
121
+ if (p.pathMode && typeof j.value == "string") {
122
+ let t = j.value.split(p.pathSeparator);
123
123
  e = J(p.options, t);
124
- } else Array.isArray(A.value) || (e = q(p.options, A.value));
124
+ } else Array.isArray(j.value) || (e = q(p.options, j.value));
125
125
  e && (F.value = e.map((e) => e[L.value.key]), I.value = e, R.value = V(e));
126
126
  }, X = (e) => {
127
- A.value === void 0 ? e.forEach((e) => {
127
+ j.value === void 0 ? e.forEach((e) => {
128
128
  F.value.includes(e[L.value.key]) && (R.value = R.value ? `${R.value}${p.pathSeparator}${e[L.value.label]}` : e[L.value.label], e[L.value.children] && X(e[L.value.children]));
129
129
  }) : Y();
130
130
  }, ue = () => {
131
- A.value = p.multiple ? [] : "", F.value = [], I.value = [], z.value = [], R.value = "", O("clear");
131
+ j.value = p.multiple ? [] : "", F.value = [], I.value = [], z.value = [], R.value = "", k("clear");
132
132
  };
133
- T(A, () => {
133
+ T(j, () => {
134
134
  Y();
135
+ }), T(() => p.options, () => {
136
+ j.value !== void 0 && j.value !== "" && Y();
135
137
  }), h(() => {
136
138
  X(p.options);
137
139
  });
138
- let Z = u(), Q = ne("SIcon"), $ = oe();
140
+ let Z = te(), Q = ne("SIcon"), $ = ae();
139
141
  return _(() => v($, [S(b).b()])), y($, null, 0), Z(s(S(r), { $: [() => ({
140
142
  offset: [0, 4],
141
143
  placement: "bottom-start",
@@ -143,12 +145,12 @@ var O = /*@__PURE__*/ d({
143
145
  ...d.popoverProps
144
146
  }), { onClickOutside: () => ce }] }, {
145
147
  content: () => {
146
- let e = ae();
147
- return _(() => v(e, [S(b).e("wrapper")])), y(e, null, 0), te(() => !d.options.length, () => {
148
- let e = re();
148
+ let e = ie();
149
+ return _(() => v(e, [S(b).e("wrapper")])), y(e, null, 0), l(() => !d.options.length, () => {
150
+ let e = O();
149
151
  return y(e, null, 0), s(S(a)), e;
150
152
  }, () => {
151
- let e = ie();
153
+ let e = re();
152
154
  return _(() => v(e, [S(b).e("panel")])), y(e, null, 0), s(ee, {
153
155
  expandTrigger: () => d.expandTrigger,
154
156
  fieldNames: () => d.fieldNames,
@@ -159,14 +161,14 @@ var O = /*@__PURE__*/ d({
159
161
  pathSeparator: () => d.pathSeparator,
160
162
  onClickItem: () => H,
161
163
  onExpand: () => U,
162
- modelValue: () => A.value,
163
- "onUpdate:modelValue": () => (e) => A.value = e,
164
+ modelValue: () => j.value,
165
+ "onUpdate:modelValue": () => (e) => j.value = e,
164
166
  expanded: () => I.value,
165
167
  "onUpdate:expanded": () => (e) => I.value = e,
166
168
  expandedKeys: () => F.value,
167
169
  "onUpdate:expandedKeys": () => (e) => F.value = e
168
170
  }), e;
169
- }, 261), m(e, "click", E(() => {}, ["stop"])), e.$evtmousedown = D(() => {}, ["prevent"]), e.$evtfocusin = l(le), e;
171
+ }, 261), m(e, "click", E(() => {}, ["stop"])), e.$evtmousedown = D(() => {}, ["prevent"]), e.$evtfocusin = u(le), e;
170
172
  },
171
173
  default: () => {
172
174
  let e = s(S(i), {
@@ -185,10 +187,10 @@ var O = /*@__PURE__*/ d({
185
187
  class: () => [S(b).e("suffix-icon")],
186
188
  style: () => ({ transform: G.value ? "rotate(180deg)" : "" })
187
189
  }, () => s(S(t))) });
188
- return Z(e, k, null, "inputRef"), e;
190
+ return Z(e, A, null, "inputRef"), e;
189
191
  }
190
- }), W, null, "popoverRef"), $.$evtclick = l(se), $;
192
+ }), W, null, "popoverRef"), $.$evtclick = u(se), $;
191
193
  }
192
194
  });
193
195
  //#endregion
194
- export { O as default };
196
+ export { k as default };
@@ -1,9 +1,11 @@
1
- import { useNamespace as e } from "../../../hooks/src/use-namespace.mjs";
1
+ import { getSize as e } from "../../../utils/src/tool.mjs";
2
+ import "../../../utils/index.mjs";
3
+ import { useNamespace as t } from "../../../hooks/src/use-namespace.mjs";
2
4
  import "../../../hooks/index.mjs";
3
- import { descriptionsContextKey as t } from "./types.mjs";
4
- import { child as n, computed as r, createSlot as i, defineVaporComponent as a, inject as o, next as s, onMounted as c, onUnmounted as l, renderEffect as u, setClass as d, setInsertionState as f, setStyle as p, setText as m, template as h, toDisplayString as g, unref as _, useId as v } from "vue";
5
+ import { descriptionsContextKey as n } from "./types.mjs";
6
+ import { child as r, computed as i, createSlot as a, defineVaporComponent as o, inject as s, next as c, onMounted as l, onUnmounted as u, renderEffect as d, setClass as f, setInsertionState as p, setStyle as m, setText as h, template as g, toDisplayString as _, unref as v, useId as y } from "vue";
5
7
  //#region ../components/src/descriptions/descriptions-item.vue?vue&type=script&setup=true&vapor=true&lang.ts
6
- var y = h(" "), b = h("<div><div></div><div>", 1), x = /*@__PURE__*/ a({
8
+ var b = g(" "), x = g("<div><div></div><div>", 1), S = /*@__PURE__*/ o({
7
9
  name: "SDescriptionsItem",
8
10
  __name: "descriptions-item",
9
11
  props: {
@@ -12,51 +14,51 @@ var y = h(" "), b = h("<div><div></div><div>", 1), x = /*@__PURE__*/ a({
12
14
  labelWidth: {},
13
15
  labelAlign: {}
14
16
  },
15
- setup(a) {
16
- let h = a, x = e("descriptions"), S = o(t, void 0), C = "desc-item-" + v();
17
- c(() => {
18
- S?.addItem?.({
19
- uid: C,
20
- label: h.label,
21
- span: h.span,
22
- labelWidth: h.labelWidth,
23
- labelAlign: h.labelAlign
17
+ setup(o) {
18
+ let g = o, S = t("descriptions"), C = s(n, void 0), w = "desc-item-" + y();
19
+ l(() => {
20
+ C?.addItem?.({
21
+ uid: w,
22
+ label: g.label,
23
+ span: g.span,
24
+ labelWidth: g.labelWidth,
25
+ labelAlign: g.labelAlign
24
26
  });
25
- }), l(() => {
26
- S?.removeItem?.(C);
27
+ }), u(() => {
28
+ C?.removeItem?.(w);
27
29
  });
28
- let w = r(() => {
29
- if (!S?.positionList) return {
30
- gridColumn: `span ${h.span}`,
30
+ let T = i(() => {
31
+ if (!C?.positionList) return {
32
+ gridColumn: `span ${g.span}`,
31
33
  display: "flex",
32
34
  alignItems: "stretch"
33
35
  };
34
- let e = S.positionList.value[C];
36
+ let e = C.positionList.value[w];
35
37
  return e ? {
36
38
  gridColumn: `${e.start} / ${e.end}`,
37
39
  display: "flex",
38
40
  alignItems: "stretch"
39
41
  } : {
40
- gridColumn: `span ${h.span}`,
42
+ gridColumn: `span ${g.span}`,
41
43
  display: "flex",
42
44
  alignItems: "stretch"
43
45
  };
44
- }), T = r(() => {
45
- let e = S?.labelAlign || h.labelAlign, t = h.labelWidth || S?.labelWidth, n = {
46
- textAlign: e ?? "left",
46
+ }), E = i(() => {
47
+ let t = C?.labelAlign || g.labelAlign, n = C?.direction === "vertical" ? "100%" : g.labelWidth || C?.labelWidth, r = {
48
+ textAlign: t ?? "left",
47
49
  whiteSpace: "nowrap",
48
50
  flexShrink: "0"
49
51
  };
50
- return t != null && (n.width = typeof t == "number" ? `${t}px` : t), n;
51
- }), E = b(), D = n(E), O = s(D, 1);
52
- return u(() => {
53
- let e = _(x);
54
- d(E, [e.e("item")]), p(E, w.value), d(D, e.e("label")), p(D, T.value);
55
- }), f(D, null, 0), i("label", null, () => {
56
- let e = y();
57
- return u(() => m(e, g(a.label))), e;
58
- }), u(() => d(O, _(x).e("content"))), f(O, null, 0), i(), E;
52
+ return n != null && (r.width = e(n)), r;
53
+ }), D = x(), O = r(D), k = c(O, 1);
54
+ return d(() => {
55
+ let e = v(S);
56
+ f(D, [e.e("item")]), m(D, T.value), f(O, e.e("label")), m(O, E.value);
57
+ }), p(O, null, 0), a("label", null, () => {
58
+ let e = b();
59
+ return d(() => h(e, _(o.label))), e;
60
+ }), d(() => f(k, v(S).e("content"))), p(k, null, 0), a(), D;
59
61
  }
60
62
  });
61
63
  //#endregion
62
- export { x as default };
64
+ export { S as default };
@@ -16,7 +16,7 @@ var _ = m(" "), v = m("<div>"), y = m("<div><div>", 1), b = /*@__PURE__*/ o({
16
16
  labelAlign: { default: "left" },
17
17
  title: {},
18
18
  size: { default: "default" },
19
- labelWidth: { default: 120 },
19
+ labelWidth: { default: 100 },
20
20
  tableLayout: {}
21
21
  },
22
22
  setup(o, { slots: m }) {
@@ -12,9 +12,12 @@ var v = p("<div>", 1), y = /*@__PURE__*/ i({
12
12
  },
13
13
  setup(i) {
14
14
  let p = i, y = g("gridItemRef"), b = e("grid"), x = "grid-item-" + h(), S = a(t, {}), C = n(() => {
15
- if (!S?.positionList) return {};
16
- let e = S?.positionList.value[x];
17
- return e ? { gridColumn: `${e.start} / ${e.end}` } : {};
15
+ let e = S?.positionList?.value[x];
16
+ return {
17
+ ...e ? { gridColumn: `${e.start} / ${e.end}` } : {},
18
+ paddingLeft: e?.isFirst ? "0px" : "var(--s-grid-gutter-x, 0px)",
19
+ paddingRight: e?.isLast ? "0px" : "var(--s-grid-gutter-x, 0px)"
20
+ };
18
21
  }), w = () => {
19
22
  S?.addGridItem?.({
20
23
  ...p,
@@ -13,10 +13,12 @@ var m = f("<div>", 1), h = /*@__PURE__*/ a({
13
13
  },
14
14
  setup(a) {
15
15
  let f = a, h = t("grid"), { current: g } = e(), _ = s([]), v = (e, t) => e ? e?.[t] ?? 24 : 24, y = r(() => v(f.cols, g.value)), b = r(() => `repeat(${v(f.cols, g.value)}, 1fr)`), x = r(() => {
16
- let e;
17
- return e = Array.isArray(f.gutter) ? `${f.gutter[1]}px ${f.gutter[0]}px` : `${f.gutter}px`, {
18
- gap: e,
19
- gridTemplateColumns: b.value
16
+ let e = 0, t = 0;
17
+ return Array.isArray(f.gutter) ? (e = f.gutter[0], t = f.gutter[1]) : (e = f.gutter, t = f.gutter), {
18
+ "--s-grid-gutter-x": `${e / 2}px`,
19
+ gridTemplateColumns: b.value,
20
+ rowGap: `${t}px`,
21
+ columnGap: "0px"
20
22
  };
21
23
  });
22
24
  o(n, {
@@ -32,12 +34,16 @@ var m = f("<div>", 1), h = /*@__PURE__*/ a({
32
34
  },
33
35
  positionList: r(() => {
34
36
  let e = 1, t = {}, n = y.value, r = [..._.value].sort((e, t) => e.el && t.el ? e.el.compareDocumentPosition(t.el) & Node.DOCUMENT_POSITION_FOLLOWING ? -1 : 1 : 0);
35
- for (let i of r) {
36
- let { uid: r, span: a = 1, offset: o = 0 } = i, s = e + o, c = s + a;
37
- t[r] = {
38
- start: s,
39
- end: c
40
- }, e = c, e > n && (e = 1);
37
+ for (let i = 0; i < r.length; i++) {
38
+ let { uid: a, span: o = 1, offset: s = 0 } = r[i], c = e + s, l = c + o;
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;
41
+ t[a] = {
42
+ start: c,
43
+ end: l,
44
+ isFirst: u,
45
+ isLast: f
46
+ }, e = l;
41
47
  }
42
48
  return t;
43
49
  })
@@ -43,6 +43,8 @@ export interface GridContext {
43
43
  positionList?: ComputedRef<Record<string, {
44
44
  start: number;
45
45
  end: number;
46
+ isFirst: boolean;
47
+ isLast: boolean;
46
48
  }>>;
47
49
  }
48
50
  export declare const gridContextKey: InjectionKey<GridContext>;
@@ -1,5 +1,6 @@
1
1
  import { MenuGroupSlots, MenuItemSlots, MenuSlots, SubMenuSlots } from './types';
2
2
  import { PublicProps, VNode, Plugin } from 'vue';
3
+ import { ScrollbarProps } from '../scrollbar';
3
4
  export declare const SMenuGroup: ((__VLS_props: NonNullable<Awaited<typeof __VLS_setup>>["props"], __VLS_ctx?: {
4
5
  attrs: any;
5
6
  slots: MenuGroupSlots;
@@ -53,6 +54,7 @@ export declare const SMenu: ((__VLS_props: NonNullable<Awaited<typeof __VLS_setu
53
54
  openKeys?: (string[] & (string | number)[]) | undefined;
54
55
  selectedKey?: string | undefined;
55
56
  accordion?: boolean | undefined;
57
+ scrollbarProps?: ScrollbarProps | undefined;
56
58
  activeKey?: string | number | undefined;
57
59
  onItemClick?: ((name: string | number, item: any) => any) | undefined;
58
60
  onOpenChange?: ((keys: string[]) => any) | undefined;
@@ -16,7 +16,8 @@ var S = _("<div>"), C = _("<div>", 1), w = /*@__PURE__*/ c({
16
16
  collapsedWidth: { default: 48 },
17
17
  openKeys: {},
18
18
  selectedKey: {},
19
- accordion: { type: Boolean }
19
+ accordion: { type: Boolean },
20
+ scrollbarProps: {}
20
21
  }, {
21
22
  activeKey: {},
22
23
  activeKeyModifiers: {},
@@ -55,7 +56,10 @@ var S = _("<div>"), C = _("<div>", 1), w = /*@__PURE__*/ c({
55
56
  let R = C();
56
57
  return f(() => {
57
58
  p(R, [y(T).b()]), g(R, E.value);
58
- }), m(R, null, 0), o(y(r), { padding: "4px" }, () => {
59
+ }), m(R, null, 0), o(y(r), { $: [() => ({
60
+ padding: "4px",
61
+ ...c.scrollbarProps
62
+ })] }, () => {
59
63
  let e = S();
60
64
  return f(() => p(e, [y(T).e("content")])), m(e, null, 0), s(), e;
61
65
  }), h(R, L, null, "menuRef"), R;
@@ -1,4 +1,5 @@
1
1
  import { InjectionKey, Ref } from 'vue';
2
+ import { ScrollbarProps } from '../scrollbar';
2
3
  export interface MenuProps {
3
4
  /** 是否折叠 */
4
5
  collapsed?: boolean;
@@ -12,6 +13,8 @@ export interface MenuProps {
12
13
  selectedKey?: string;
13
14
  /** 是否开启手风琴模式 */
14
15
  accordion?: boolean;
16
+ /** 滚动条属性 */
17
+ scrollbarProps?: ScrollbarProps;
15
18
  }
16
19
  export interface MenuSlots {
17
20
  /** 默认 */
@@ -2,6 +2,7 @@ import { useModal } from './method';
2
2
  import { ModalSlots } from './types';
3
3
  import { PublicProps, VNode, ShallowUnwrapRef, Plugin } from 'vue';
4
4
  import { ScrollbarProps } from '../scrollbar';
5
+ import { ButtonProps } from '../button';
5
6
  export declare const SModal: ((__VLS_props: NonNullable<Awaited<typeof __VLS_setup>>["props"], __VLS_ctx?: {
6
7
  attrs: any;
7
8
  slots: ModalSlots;
@@ -34,6 +35,10 @@ export declare const SModal: ((__VLS_props: NonNullable<Awaited<typeof __VLS_set
34
35
  offset?: number | undefined;
35
36
  scrollContent?: boolean | undefined;
36
37
  scrollbarProps?: ScrollbarProps | undefined;
38
+ confirmBtn?: boolean | undefined;
39
+ confirmProps?: ButtonProps | undefined;
40
+ cancelBtn?: boolean | undefined;
41
+ cancelProps?: ButtonProps | undefined;
37
42
  confirm?: ((done: (status: boolean) => void) => void) | undefined;
38
43
  close?: (() => void) | undefined;
39
44
  closed?: (() => void) | undefined;
@@ -71,6 +71,16 @@ var M = /*@__PURE__*/ f({
71
71
  offset: { default: 120 },
72
72
  scrollContent: { type: Boolean },
73
73
  scrollbarProps: {},
74
+ confirmBtn: {
75
+ type: Boolean,
76
+ default: !0
77
+ },
78
+ confirmProps: {},
79
+ cancelBtn: {
80
+ type: Boolean,
81
+ default: !0
82
+ },
83
+ cancelProps: {},
74
84
  confirm: {},
75
85
  close: {},
76
86
  closed: {},
@@ -210,25 +220,25 @@ var M = /*@__PURE__*/ f({
210
220
  }, 4)), e;
211
221
  }, 1541), b(e, null, 2), u(() => f.footer, () => {
212
222
  let e = k();
213
- return v(() => y(e, [T(N).e("footer")])), b(e, null, 0), d("footer", null, () => u(() => f.btnReverse, () => [l(T(i), {
223
+ return v(() => y(e, [T(N).e("footer")])), b(e, null, 0), d("footer", null, () => u(() => f.btnReverse, () => [u(() => f.confirmBtn, () => l(T(i), { $: [() => ({
214
224
  label: "确定",
215
- loading: () => H.value,
225
+ loading: H.value,
216
226
  type: "primary",
217
- onClick: () => Y
218
- }), l(T(i), {
227
+ ...f.confirmProps
228
+ }), { onClick: () => Y }] }), null, 129), u(() => f.cancelBtn, () => l(T(i), { $: [() => ({
219
229
  label: "取消",
220
- secondary: "",
221
- onClick: () => X
222
- })], () => [l(T(i), {
230
+ secondary: !0,
231
+ ...f.cancelProps
232
+ }), { onClick: () => X }] }), null, 129)], () => [u(() => f.cancelBtn, () => l(T(i), { $: [() => ({
223
233
  label: "取消",
224
- secondary: "",
225
- onClick: () => X
226
- }), l(T(i), {
234
+ secondary: !0,
235
+ ...f.cancelProps
236
+ }), { onClick: () => X }] }), null, 129), u(() => f.confirmBtn, () => l(T(i), { $: [() => ({
227
237
  label: "确定",
228
- loading: () => H.value,
238
+ loading: H.value,
229
239
  type: "primary",
230
- onClick: () => Y
231
- })], 1930)), e;
240
+ ...f.confirmProps
241
+ }), { onClick: () => Y }] }), null, 129)], 2442)), e;
232
242
  }), o(e, () => z.value), $(e, I, null, "modalRef"), e;
233
243
  }), o(e, () => B.value), e;
234
244
  }, !0);
@@ -1,4 +1,5 @@
1
1
  import { VNode } from 'vue';
2
+ import { ButtonProps } from '../button';
2
3
  import { ScrollbarProps } from '../scrollbar';
3
4
  export interface ModalProps {
4
5
  /** 弹窗是否可见(v-model) */
@@ -57,6 +58,14 @@ export interface ModalProps {
57
58
  scrollContent?: boolean;
58
59
  /** 滚动容器属性 */
59
60
  scrollbarProps?: ScrollbarProps;
61
+ /** 是否显示确认按钮 */
62
+ confirmBtn?: boolean;
63
+ /** 确认按钮属性 */
64
+ confirmProps?: ButtonProps;
65
+ /** 是否显示取消按钮 */
66
+ cancelBtn?: boolean;
67
+ /** 取消按钮属性 */
68
+ cancelProps?: ButtonProps;
60
69
  /** 弹窗确认事件,需调用 done 函数关闭弹窗 */
61
70
  confirm?: (done: (status: boolean) => void) => void;
62
71
  /** 弹窗关闭事件 */
@@ -12,6 +12,7 @@ export declare const SStatistic: ((__VLS_props: NonNullable<Awaited<typeof __VLS
12
12
  precision?: number | undefined;
13
13
  showGroupSeparator?: boolean | undefined;
14
14
  animation?: boolean | undefined;
15
+ duration?: number | undefined;
15
16
  countdown?: boolean | undefined;
16
17
  format?: string | undefined;
17
18
  start?: boolean | undefined;
@@ -8,68 +8,84 @@ import y from "dayjs/plugin/duration";
8
8
  //#region ../components/src/statistic/statistic.vue?vue&type=script&setup=true&vapor=true&lang.ts
9
9
  var b = m(" "), x = m("<div>"), S = m("<div><div> </div>", 1), C = /*@__PURE__*/ o({
10
10
  name: "SStatistic",
11
+ inheritAttrs: !1,
11
12
  __name: "statistic",
12
13
  props: {
13
14
  title: {},
14
15
  value: {},
15
16
  extra: {},
16
- precision: { default: void 0 },
17
- showGroupSeparator: {
18
- type: Boolean,
19
- default: !1
20
- },
21
- animation: {
22
- type: Boolean,
23
- default: !1
24
- },
25
- countdown: {
26
- type: Boolean,
27
- default: !1
28
- },
17
+ precision: {},
18
+ showGroupSeparator: { type: Boolean },
19
+ animation: { type: Boolean },
20
+ duration: { default: 1e3 },
21
+ countdown: { type: Boolean },
29
22
  format: { default: "HH:mm:ss" },
30
- start: {
31
- type: Boolean,
32
- default: !1
33
- },
23
+ start: { type: Boolean },
34
24
  valueStyle: { default: () => ({}) }
35
25
  },
36
26
  emits: ["stop"],
37
27
  setup(o, { emit: m, slots: C }) {
38
28
  v.extend(y);
39
- let w = o, T = m, E = t("statistic"), D = c(w.value), O = null, k = c(0), A = r(() => {
29
+ let w = o, T = m, E = t("statistic"), D = c(w.value), O = null, k = c(0), A = c(null), j = null, M = (e, t, n, r) => {
30
+ if (j &&= (j(), null), e <= 0) {
31
+ r(n);
32
+ return;
33
+ }
34
+ let i = performance.now(), a, o = () => {
35
+ let s = performance.now() - i, c = Math.min(s / e, 1);
36
+ r(t + (n - t) * c), !(c >= 1) && (a = requestAnimationFrame(o));
37
+ };
38
+ a = requestAnimationFrame(o), j = () => cancelAnimationFrame(a);
39
+ }, N = () => {
40
+ T("stop"), O &&= (clearInterval(O), null);
41
+ }, P = () => {
42
+ O ||= window.setInterval(() => {
43
+ k.value++, D.value - Date.now() <= 0 && N();
44
+ }, 1e3);
45
+ }, F = r(() => {
40
46
  if (w.countdown) {
41
47
  k.value;
42
48
  let e = Date.now(), t = Math.max(0, D.value - e);
43
- return t <= 0 ? (M(), "00:00:00") : v.duration(t).format(w.format);
49
+ return t <= 0 ? v.duration(0).format(w.format) : v.duration(t).format(w.format);
44
50
  }
45
- let t = Number(w.value) || 0, n = t.toFixed(w.precision ?? t.toString().split(".").length - 1);
46
- return w.showGroupSeparator && (n = e(n)), n;
47
- }), j = () => {
48
- O ||= window.setInterval(() => {
49
- k.value++, D.value - Date.now() <= 0 && M();
50
- }, 1e3);
51
- }, M = () => {
52
- T("stop"), O && clearInterval(O), O = null;
53
- };
54
- _(() => w.start, (e) => e ? j() : M(), { immediate: !0 }), _(() => w.value, (e) => {
55
- M(), D.value = e, k.value++, w.start && j();
56
- }), s(M);
57
- let N = S(), P = n(N, 1), F = n(P, 1);
58
- return l(() => u(N, [g(E).b()])), d(N, 0, 0), i(() => o.title || C.title, () => {
51
+ let t = Number(w.value) || 0, n = A.value ?? t, r;
52
+ if (w.precision !== void 0) r = n.toFixed(w.precision);
53
+ else {
54
+ let e = t.toString(), i = e.indexOf("."), a = i > -1 ? e.length - i - 1 : 0;
55
+ r = n.toFixed(a);
56
+ }
57
+ return w.showGroupSeparator && (r = e(r)), r;
58
+ });
59
+ _(() => w.value, (e, t) => {
60
+ let n = Number(e) || 0, r = Number(t) || 0;
61
+ if (w.countdown) {
62
+ N(), D.value = n, k.value++, w.start && P();
63
+ return;
64
+ }
65
+ w.animation ? M(w.duration, r, n, (e) => {
66
+ A.value = e;
67
+ }) : A.value = null;
68
+ }, { immediate: !0 }), _(() => w.start, (e) => {
69
+ e ? P() : N();
70
+ }, { immediate: !0 }), s(() => {
71
+ N(), j && j();
72
+ });
73
+ let I = S(), L = n(I, 1), R = n(L, 1);
74
+ return l(() => u(I, [g(E).b()])), d(I, 0, 0), i(() => o.title || C.title, () => {
59
75
  let e = x();
60
76
  return l(() => u(e, [g(E).e("title")])), d(e, null, 0), a("title", null, () => {
61
77
  let e = b();
62
78
  return l(() => p(e, h(o.title))), e;
63
79
  }), e;
64
80
  }), l(() => {
65
- u(P, [g(E).e("value")]), f(P, o.valueStyle);
66
- }), d(P, 0, 0), a("prefix"), l(() => p(F, " " + h(A.value) + " ")), d(P, null, 2), a("suffix"), d(N, null, 2), i(() => o.extra || C.extra, () => {
81
+ u(L, [g(E).e("value")]), f(L, o.valueStyle);
82
+ }), d(L, 0, 0), a("prefix"), l(() => p(R, " " + h(F.value) + " ")), d(L, null, 2), a("suffix"), d(I, null, 2), i(() => o.extra || C.extra, () => {
67
83
  let e = x();
68
84
  return l(() => u(e, [g(E).e("extra")])), d(e, null, 0), a("extra", null, () => {
69
85
  let e = b();
70
86
  return l(() => p(e, h(o.extra))), e;
71
87
  }), e;
72
- }), N;
88
+ }), I;
73
89
  }
74
90
  });
75
91
  //#endregion