savor-ui 0.15.1 → 0.15.3

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,21 @@
2
2
 
3
3
 
4
4
 
5
+ ## [0.15.3](https://gitee.com/mach552/savor-ui/compare/v0.15.2...v0.15.3) (2026-08-04)
6
+
7
+
8
+ ### Bug Fixes
9
+
10
+ * **cascader:** 修复选择时输入框失焦问题 ([1bc1cc9](https://gitee.com/mach552/savor-ui/commits/1bc1cc9f7ac71d40897f691aa520ffa65622c7b4))
11
+ * **upload:** 修复文件上传进度展示问题 ([46e4a45](https://gitee.com/mach552/savor-ui/commits/46e4a45d940bd7c529abe8ccc116ccf57c99d7c4))
12
+
13
+ ## [0.15.2](https://gitee.com/mach552/savor-ui/compare/v0.15.1...v0.15.2) (2026-08-03)
14
+
15
+
16
+ ### Bug Fixes
17
+
18
+ * **upload:** 修复上传文件字段 ([462e464](https://gitee.com/mach552/savor-ui/commits/462e4645aca8a9301f48505126f169c173d55cb0))
19
+
5
20
  ## [0.15.1](https://gitee.com/mach552/savor-ui/compare/v0.15.0...v0.15.1) (2026-08-03)
6
21
 
7
22
 
@@ -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 o from "./cascader-column.vue.mjs";
10
- import { computed as s, createComponent as c, createComponentWithFallback as l, createIf as u, createInvoker as d, createTemplateRefSetter as f, defineVaporComponent as p, delegateEvents as m, mergeModels as h, on as g, onMounted as _, ref as v, renderEffect as y, resolveComponent as ee, setClass as b, setInsertionState as x, template as S, toRefs as C, unref as w, useModel as T, useTemplateRef as E, watch as te, withModifiers as ne } from "vue";
10
+ import { computed as s, createComponent as c, createComponentWithFallback as l, createIf as u, createInvoker as d, createTemplateRefSetter as f, defineVaporComponent as p, delegateEvents as m, mergeModels as h, on as g, onMounted as _, ref as v, renderEffect as y, resolveComponent as ee, setClass as b, setInsertionState as x, template as S, toRefs as C, unref as w, useModel as T, useTemplateRef as E, watch as te, withModifiers as ne, 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 = S("<div style=\"padding: 12px\">"), D = S("<div>"), O = S("<div>", 1);
13
- m("click");
14
- var k = /*@__PURE__*/ p({
12
+ var O = S("<div style=\"padding: 12px\">"), k = S("<div>"), A = S("<div>", 1);
13
+ m("mousedown", "click");
14
+ var j = /*@__PURE__*/ p({
15
15
  name: "SCascader",
16
16
  __name: "cascader",
17
17
  props: /*@__PURE__*/ h({
@@ -52,42 +52,42 @@ var k = /*@__PURE__*/ p({
52
52
  "update:expanded"
53
53
  ]),
54
54
  setup(p, { emit: m }) {
55
- let h = p, S = e("cascader"), k = m, A = T(p, "modelValue"), { size: j, error: M } = C(h), { mergedSize: N, mergedError: P } = n({
56
- size: j,
57
- error: M
58
- }), F = T(p, "expandedKeys"), I = T(p, "expanded"), L = s(() => ({
55
+ let h = p, S = e("cascader"), j = m, M = T(p, "modelValue"), { size: N, error: P } = C(h), { mergedSize: F, mergedError: I } = n({
56
+ size: N,
57
+ error: P
58
+ }), L = T(p, "expandedKeys"), R = T(p, "expanded"), z = s(() => ({
59
59
  label: "label",
60
60
  key: "key",
61
61
  children: "children",
62
62
  ...h.fieldNames
63
- })), R = v(""), z = v([]), B = (e) => h.pathMode ? e.map((e) => e[L.value.key]).join(h.pathSeparator) : e[e.length - 1][L.value.key], V = (e) => e.map((e) => e[L.value.label]).join(h.pathSeparator), H = ({ item: e, expandeds: t, unchecked: n }) => {
63
+ })), B = v(""), V = v([]), H = (e) => h.pathMode ? e.map((e) => e[z.value.key]).join(h.pathSeparator) : e[e.length - 1][z.value.key], U = (e) => e.map((e) => e[z.value.label]).join(h.pathSeparator), W = ({ item: e, expandeds: t, unchecked: n }) => {
64
64
  if (h.multiple) {
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(", "), k("selectItem", {
65
+ let r = e[z.value.key], i = V.value.findIndex((e) => e[e.length - 1][z.value.key] === r);
66
+ n ? i !== -1 && (V.value = V.value.toSpliced(i, 1)) : i === -1 && (V.value = [...V.value, t]), M.value = V.value.map(H), B.value = V.value.map(U).join(", "), j("selectItem", {
67
67
  item: e,
68
68
  expandeds: t
69
69
  });
70
70
  return;
71
71
  }
72
- K(!1), R.value = V(t), A.value = B(t), k("selectItem", {
72
+ J(!1), B.value = U(t), M.value = H(t), j("selectItem", {
73
73
  item: e,
74
74
  expandeds: t
75
75
  });
76
- }, U = () => {
77
- k("expand", F.value);
78
- }, W = E("popoverRef"), G = v(!1), K = (e) => {
79
- G.value = e, e ? W.value?.show() : W.value?.hide();
80
- }, q = () => {
81
- let e = !G.value;
82
- e && Z(), K(e);
83
- }, J = () => {
84
- K(!1);
76
+ }, G = () => {
77
+ j("expand", L.value);
78
+ }, K = E("popoverRef"), q = v(!1), J = (e) => {
79
+ q.value = e, e ? K.value?.show() : K.value?.hide();
80
+ }, re = () => {
81
+ let e = !q.value;
82
+ e && Z(), J(e);
83
+ }, ie = () => {
84
+ J(!1);
85
85
  }, Y = (e, t, n = []) => {
86
86
  for (let r of e) {
87
87
  let e = [...n, r];
88
- if (r[L.value.key] === t) return e;
89
- if (r[L.value.children]) {
90
- let n = Y(r[L.value.children], t, e);
88
+ if (r[z.value.key] === t) return e;
89
+ if (r[z.value.children]) {
90
+ let n = Y(r[z.value.children], t, e);
91
91
  if (n) return n;
92
92
  }
93
93
  }
@@ -95,58 +95,58 @@ var k = /*@__PURE__*/ p({
95
95
  }, X = (e, t) => {
96
96
  let n = [], r = e;
97
97
  for (let e of t) {
98
- let t = r.find((t) => t[L.value.key] === e);
98
+ let t = r.find((t) => t[z.value.key] === e);
99
99
  if (!t) return null;
100
- n.push(t), r = t[L.value.children] || [];
100
+ n.push(t), r = t[z.value.children] || [];
101
101
  }
102
102
  return n;
103
103
  }, Z = () => {
104
- if (A.value === void 0 || A.value === "") {
105
- R.value = "", F.value = [], I.value = [], z.value = [];
104
+ if (M.value === void 0 || M.value === "") {
105
+ B.value = "", L.value = [], R.value = [], V.value = [];
106
106
  return;
107
107
  }
108
108
  if (h.multiple) {
109
- z.value = (Array.isArray(A.value) ? A.value : []).map((e) => {
109
+ V.value = (Array.isArray(M.value) ? M.value : []).map((e) => {
110
110
  if (h.pathMode && typeof e == "string") {
111
111
  let t = e.split(h.pathSeparator);
112
112
  return X(h.options, t);
113
113
  }
114
114
  return Y(h.options, e);
115
- }).filter((e) => e !== null), R.value = z.value.map(V).join(", ");
115
+ }).filter((e) => e !== null), B.value = V.value.map(U).join(", ");
116
116
  return;
117
117
  }
118
118
  let e = null;
119
- if (h.pathMode && typeof A.value == "string") {
120
- let t = A.value.split(h.pathSeparator);
119
+ if (h.pathMode && typeof M.value == "string") {
120
+ let t = M.value.split(h.pathSeparator);
121
121
  e = X(h.options, t);
122
- } else Array.isArray(A.value) || (e = Y(h.options, A.value));
123
- e && (F.value = e.map((e) => e[L.value.key]), I.value = e, R.value = V(e));
122
+ } else Array.isArray(M.value) || (e = Y(h.options, M.value));
123
+ e && (L.value = e.map((e) => e[z.value.key]), R.value = e, B.value = U(e));
124
124
  }, Q = (e) => {
125
- A.value === void 0 ? e.forEach((e) => {
126
- F.value.includes(e[L.value.key]) && (R.value = R.value ? `${R.value}${h.pathSeparator}${e[L.value.label]}` : e[L.value.label], e[L.value.children] && Q(e[L.value.children]));
125
+ M.value === void 0 ? e.forEach((e) => {
126
+ L.value.includes(e[z.value.key]) && (B.value = B.value ? `${B.value}${h.pathSeparator}${e[z.value.label]}` : e[z.value.label], e[z.value.children] && Q(e[z.value.children]));
127
127
  }) : Z();
128
- }, ie = () => {
129
- A.value = h.multiple ? [] : "", F.value = [], I.value = [], z.value = [], R.value = "", k("clear");
128
+ }, ae = () => {
129
+ M.value = h.multiple ? [] : "", L.value = [], R.value = [], V.value = [], B.value = "", j("clear");
130
130
  };
131
- te(A, () => {
131
+ te(M, () => {
132
132
  Z();
133
133
  }), _(() => {
134
134
  Q(h.options);
135
135
  });
136
- let ae = f(), oe = ee("SIcon"), $ = O();
137
- return y(() => b($, [w(S).b()])), x($, null, 0), ae(c(w(r), { $: [() => ({
136
+ let oe = f(), se = ee("SIcon"), $ = A();
137
+ return y(() => b($, [w(S).b()])), x($, null, 0), oe(c(w(r), { $: [() => ({
138
138
  offset: [0, 4],
139
139
  placement: "bottom-start",
140
140
  manual: !0,
141
141
  ...p.popoverProps
142
- }), { onClickOutside: () => J }] }, {
142
+ }), { onClickOutside: () => ie }] }, {
143
143
  content: () => {
144
- let e = D();
144
+ let e = k();
145
145
  return y(() => b(e, [w(S).e("wrapper")])), x(e, null, 0), u(() => !p.options.length, () => {
146
- let e = re();
146
+ let e = O();
147
147
  return x(e, null, 0), c(w(a)), e;
148
148
  }, () => {
149
- let e = D();
149
+ let e = k();
150
150
  return y(() => b(e, [w(S).e("panel")])), x(e, null, 0), c(o, {
151
151
  expandTrigger: () => p.expandTrigger,
152
152
  fieldNames: () => p.fieldNames,
@@ -155,35 +155,35 @@ var k = /*@__PURE__*/ p({
155
155
  multiple: () => p.multiple,
156
156
  pathMode: () => p.pathMode,
157
157
  pathSeparator: () => p.pathSeparator,
158
- onClickItem: () => H,
159
- onExpand: () => U,
160
- modelValue: () => A.value,
161
- "onUpdate:modelValue": () => (e) => A.value = e,
162
- expanded: () => I.value,
163
- "onUpdate:expanded": () => (e) => I.value = e,
164
- expandedKeys: () => F.value,
165
- "onUpdate:expandedKeys": () => (e) => F.value = e
158
+ onClickItem: () => W,
159
+ onExpand: () => G,
160
+ modelValue: () => M.value,
161
+ "onUpdate:modelValue": () => (e) => M.value = e,
162
+ expanded: () => R.value,
163
+ "onUpdate:expanded": () => (e) => R.value = e,
164
+ expandedKeys: () => L.value,
165
+ "onUpdate:expandedKeys": () => (e) => L.value = e
166
166
  }), e;
167
- }, 261), g(e, "click", ne(() => {}, ["stop"])), e;
167
+ }, 261), g(e, "click", ne(() => {}, ["stop"])), e.$evtmousedown = D(() => {}, ["prevent"]), e;
168
168
  },
169
169
  default: () => c(w(i), {
170
170
  placeholder: () => p.placeholder,
171
171
  disabled: () => p.disabled,
172
- error: () => w(P),
173
- size: () => w(N),
172
+ error: () => w(I),
173
+ size: () => w(F),
174
174
  filled: () => p.filled,
175
- modelValue: () => R.value,
176
- "onUpdate:modelValue": () => (e) => R.value = e,
175
+ modelValue: () => B.value,
176
+ "onUpdate:modelValue": () => (e) => B.value = e,
177
177
  readonly: "",
178
178
  clearable: () => p.clearable,
179
179
  style: "width: 100%",
180
- onClear: () => ie
181
- }, { suffix: () => l(oe, {
180
+ onClear: () => ae
181
+ }, { suffix: () => l(se, {
182
182
  class: () => [w(S).e("suffix-icon")],
183
- style: () => ({ transform: G.value ? "rotate(180deg)" : "" })
183
+ style: () => ({ transform: q.value ? "rotate(180deg)" : "" })
184
184
  }, () => c(w(t))) })
185
- }), W, null, "popoverRef"), $.$evtclick = d(q), $;
185
+ }), K, null, "popoverRef"), $.$evtclick = d(re), $;
186
186
  }
187
187
  });
188
188
  //#endregion
189
- export { k as default };
189
+ export { j as default };
@@ -19,6 +19,7 @@ export declare const SUpload: ((__VLS_props: NonNullable<Awaited<typeof __VLS_se
19
19
  autoUpload?: boolean | undefined;
20
20
  drag?: boolean | undefined;
21
21
  showList?: boolean | undefined;
22
+ name?: string | undefined;
22
23
  picture?: boolean | undefined;
23
24
  accept?: string | undefined;
24
25
  limit?: number | undefined;
@@ -1,15 +1,15 @@
1
1
  //#region ../components/src/upload/request.ts
2
2
  var e = (e) => {
3
3
  let t = new XMLHttpRequest(), n = e.action || "";
4
- if (e.headers) for (let n in e.headers) t.setRequestHeader(n, e.headers[n]);
4
+ if (t.open(e.method, n), e.headers) for (let n in e.headers) t.setRequestHeader(n, e.headers[n]);
5
5
  let r = new FormData();
6
6
  if (e.data) for (let t in e.data) r.append(t, e.data[t]);
7
- return r.append(e.name, e.file), t.open(e.method, n), t.send(r), t.onprogress = (t) => {
7
+ return r.append(e.name, e.file), t.send(r), t.onprogress = (t) => {
8
8
  e.onProgress?.(t.loaded / t.total * 100);
9
9
  }, t.onload = () => {
10
- e.onSuccess?.(t.response);
11
- }, t.onerror = (t) => {
12
- e.onError?.(t);
10
+ t.status >= 200 && t.status < 300 ? e.onSuccess?.(t.response) : e.onError?.(/* @__PURE__ */ Error(`Request failed with status ${t.status}`));
11
+ }, t.onerror = () => {
12
+ e.onError?.(/* @__PURE__ */ Error("Network error"));
13
13
  }, t;
14
14
  };
15
15
  //#endregion
@@ -33,6 +33,8 @@ export interface UploadProps {
33
33
  drag?: boolean;
34
34
  /** 是否显示上传列表 */
35
35
  showList?: boolean;
36
+ /** 上传文件的名称 */
37
+ name?: string;
36
38
  /** 是否显示图片墙 */
37
39
  picture?: boolean;
38
40
  /** 文件的类型 */
@@ -11,13 +11,13 @@ import s from "../../../icons/src/upload.vue.mjs";
11
11
  import c from "../../../icons/src/zoom-in.vue.mjs";
12
12
  import "../../../icons/index.mjs";
13
13
  import { SButton as l } from "../button/index.mjs";
14
- import { SImagePreview as ee } from "../image/index.mjs";
15
- import { SProgress as u } from "../progress/index.mjs";
16
- import { httpRequest as d } from "./request.mjs";
14
+ import { SImagePreview as u } from "../image/index.mjs";
15
+ import { SProgress as d } from "../progress/index.mjs";
16
+ import { httpRequest as ee } from "./request.mjs";
17
17
  import te from "./upload-drag.vue.mjs";
18
- import { child as f, computed as p, createComponent as m, createFor as h, createIf as g, createInvoker as _, createSlot as v, createTemplateRefSetter as ne, defineVaporComponent as y, delegateEvents as b, mergeModels as x, next as S, on as re, onUnmounted as ie, ref as C, renderEffect as w, setClass as T, setInsertionState as E, setProp as D, setText as ae, template as O, toDisplayString as oe, txt as se, unref as k, useModel as A, useTemplateRef as ce } from "vue";
18
+ import { child as f, computed as p, createComponent as m, createFor as h, createIf as g, createInvoker as _, createSlot as v, createTemplateRefSetter as ne, defineVaporComponent as y, delegateEvents as b, mergeModels as x, next as S, on as re, onUnmounted as ie, ref as C, renderEffect as w, setClass as T, setInsertionState as E, setProp as D, setStyle as O, setText as ae, template as k, toDisplayString as oe, txt as se, unref as A, useModel as ce, useTemplateRef as le } from "vue";
19
19
  //#region ../components/src/upload/upload.vue?vue&type=script&setup=true&vapor=true&lang.ts
20
- var le = O("<img>"), j = O("<div>"), ue = O("<div></div>"), de = O("<div><div> </div><div></div><div>"), fe = O("<div><input type=file>", 1);
20
+ var ue = k("<img>"), j = k("<div>"), de = k("<div></div>"), fe = k("<div><div><div> </div><div></div><div>"), pe = k("<div><input type=file>", 1);
21
21
  b("click");
22
22
  var M = /*@__PURE__*/ y({
23
23
  name: "SUpload",
@@ -33,6 +33,7 @@ var M = /*@__PURE__*/ y({
33
33
  type: Boolean,
34
34
  default: !0
35
35
  },
36
+ name: { default: "file" },
36
37
  picture: { type: Boolean },
37
38
  accept: {},
38
39
  limit: {},
@@ -65,22 +66,22 @@ var M = /*@__PURE__*/ y({
65
66
  "remove"
66
67
  ], ["update:modelValue"]),
67
68
  setup(y, { expose: b, emit: x }) {
68
- let O = y, M = x, N = t("upload"), P = ce("inputRef"), F = C([]), I = A(y, "modelValue"), L = (e) => e ? e.split(",").map((e) => e.trim()).filter(Boolean) : [], R = p(() => L(I.value).map((e, t) => ({
69
+ let k = y, M = x, N = t("upload"), P = le("inputRef"), F = C([]), I = ce(y, "modelValue"), L = (e) => e ? e.split(",").map((e) => e.trim()).filter(Boolean) : [], R = p(() => L(I.value).map((e, t) => ({
69
70
  uid: `model-${t}-${e}`,
70
71
  name: decodeURIComponent(e.split("/").pop()?.split("?")[0] || e),
71
72
  size: 0,
72
73
  url: e,
73
74
  status: "success",
74
75
  percentage: 100
75
- }))), z = p(() => [...F.value, ...R.value]), B = p(() => F.value.length + R.value.length), pe = p(() => !(O.limit && B.value >= O.limit)), V = C(!1), H = C(""), U = /* @__PURE__ */ new Map(), me = (e) => e.type.startsWith("image/"), W = (e) => {
76
+ }))), z = p(() => [...F.value, ...R.value]), B = p(() => F.value.length + R.value.length), me = p(() => !(k.limit && B.value >= k.limit)), V = C(!1), H = C(""), U = /* @__PURE__ */ new Map(), he = (e) => e.type.startsWith("image/"), W = (e) => {
76
77
  e && e.startsWith("blob:") && URL.revokeObjectURL(e);
77
78
  }, G = () => {
78
- O.disabled || P.value?.click();
79
+ k.disabled || P.value?.click();
79
80
  }, K = (t) => {
80
81
  let n = [];
81
82
  for (let e of t) n.push(e);
82
- if (O.limit) {
83
- let t = O.limit - B.value;
83
+ if (k.limit) {
84
+ let t = k.limit - B.value;
84
85
  if (t <= 0) {
85
86
  M("exceed", z.value);
86
87
  return;
@@ -100,18 +101,18 @@ var M = /*@__PURE__*/ y({
100
101
  name: t.name,
101
102
  size: t.size,
102
103
  raw: t,
103
- url: me(t) ? URL.createObjectURL(t) : void 0,
104
+ url: he(t) ? URL.createObjectURL(t) : void 0,
104
105
  status: "ready",
105
106
  percentage: 0
106
107
  };
107
108
  F.value = [...F.value, n];
108
109
  }
109
- M("change", z.value), O.autoUpload && Z();
110
- }, he = (e) => {
110
+ M("change", z.value), k.autoUpload && Z();
111
+ }, ge = (e) => {
111
112
  let t = e.target, n = t.files;
112
113
  n && K(n), t.value = "";
113
- }, ge = (e) => {
114
- O.disabled || K(e);
114
+ }, _e = (e) => {
115
+ k.disabled || K(e);
115
116
  }, q = (e) => {
116
117
  if (e.uid.startsWith("model-")) {
117
118
  I.value = L(I.value).filter((t) => t !== e.url).join(","), M("remove", e, z.value), M("change", z.value);
@@ -121,18 +122,18 @@ var M = /*@__PURE__*/ y({
121
122
  t !== -1 && (W(e.url), F.value = F.value.toSpliced(t, 1), M("remove", e, z.value), M("change", z.value));
122
123
  }, J = (e) => {
123
124
  Z(e);
124
- }, _e = (e) => {
125
+ }, Y = (e) => {
125
126
  let t = U.get(e.uid);
126
127
  t && (t.abort(), U.delete(e.uid), X(e.uid, { status: "error" }));
127
- }, Y = (e) => {
128
+ }, ve = (e) => {
128
129
  H.value = e.url || "", V.value = !0, M("preview", e);
129
130
  }, X = (e, t) => {
130
131
  let n = F.value.findIndex((t) => t.uid === e);
131
- n !== -1 && (F.value[n] = {
132
- ...F.value[n],
132
+ n !== -1 && (F.value = F.value.map((e, r) => r === n ? {
133
+ ...e,
133
134
  ...t
134
- }, F.value = [...F.value]);
135
- }, ve = (e) => {
135
+ } : e));
136
+ }, ye = (e) => {
136
137
  if (!e) return;
137
138
  let t = L(I.value);
138
139
  t.includes(e) || (t.push(e), I.value = t.join(","));
@@ -140,7 +141,7 @@ var M = /*@__PURE__*/ y({
140
141
  let t = async (e) => {
141
142
  if (e.status === "uploading" || !e.raw) return;
142
143
  try {
143
- await O.beforeUpload?.(e);
144
+ await k.beforeUpload?.(e);
144
145
  } catch {
145
146
  return;
146
147
  }
@@ -148,18 +149,18 @@ var M = /*@__PURE__*/ y({
148
149
  status: "uploading",
149
150
  percentage: 0
150
151
  });
151
- let t = d({
152
+ let t = ee({
152
153
  method: "POST",
153
154
  file: e.raw,
154
- name: e.name,
155
- action: O.action,
156
- headers: O.headers,
157
- data: O.data,
155
+ name: k.name,
156
+ action: k.action,
157
+ headers: k.headers,
158
+ data: k.data,
158
159
  onProgress: (t) => {
159
160
  X(e.uid, { percentage: t }), M("progress", e, t);
160
161
  },
161
162
  onSuccess: (t) => {
162
- ve(O.afterSuccess?.(e, t) ?? "");
163
+ ye(k.afterSuccess?.(e, t) ?? "");
163
164
  let n = F.value.findIndex((t) => t.uid === e.uid);
164
165
  n !== -1 && (W(e.url), F.value = F.value.toSpliced(n, 1)), U.delete(e.uid), M("success", e, t);
165
166
  },
@@ -177,95 +178,110 @@ var M = /*@__PURE__*/ y({
177
178
  ie(() => {
178
179
  U.forEach((e) => e.abort()), U.clear(), F.value.forEach((e) => W(e.url));
179
180
  }), b({ upload: Z });
180
- let ye = ne(), Q = fe(), $ = f(Q);
181
- return re($, "change", he), ye($, P, null, "inputRef"), w(() => {
182
- let e = k(N);
181
+ let be = ne(), Q = pe(), $ = f(Q);
182
+ return re($, "change", ge), be($, P, null, "inputRef"), w(() => {
183
+ let e = A(N);
183
184
  T(Q, [
184
185
  e.b(),
185
186
  e.is("picture", y.picture),
186
- e.is("disabled", O.disabled)
187
+ e.is("disabled", k.disabled)
187
188
  ]), T($, [e.e("inner")]), D($, "multiple", y.multiple), D($, "accept", y.accept);
188
189
  }), E(Q, null, 1), g(() => y.picture, () => {
189
190
  let e = j();
190
- return w(() => T(e, [k(N).e("picture-wall")])), E(e, null, 0), h(() => z.value, (e) => {
191
+ return w(() => T(e, [A(N).e("picture-wall")])), E(e, null, 0), h(() => z.value, (e) => {
191
192
  let t = j();
192
193
  return w(() => {
193
- let n = k(N);
194
+ let n = A(N);
194
195
  T(t, [n.e("picture-item"), n.is(e.value.status)]);
195
196
  }), E(t, null, 0), g(() => e.value.url, () => {
196
- let t = le();
197
+ let t = ue();
197
198
  return w(() => {
198
199
  let n = e.value;
199
- D(t, "src", n.url), T(t, [k(N).e("picture-thumb")]), D(t, "alt", n.name);
200
+ D(t, "src", n.url), T(t, [A(N).e("picture-thumb")]), D(t, "alt", n.name);
200
201
  }), t;
201
202
  }, () => {
202
203
  let e = j();
203
- return w(() => T(e, [k(N).e("picture-placeholder")])), E(e, null, 0), m(k(i)), e;
204
+ return w(() => T(e, [A(N).e("picture-placeholder")])), E(e, null, 0), m(A(i)), e;
204
205
  }, 261), E(t, null, 1), g(() => e.value.status === "uploading", () => {
205
206
  let t = j();
206
- return w(() => T(t, [k(N).e("picture-loading")])), E(t, null, 0), m(k(u), {
207
+ return w(() => {
208
+ T(t, [A(N).e("picture-progress-bar")]), O(t, { height: 100 - (e.value.percentage ?? 0) + "%" });
209
+ }), t;
210
+ }), E(t, null, 2), g(() => e.value.status === "uploading", () => {
211
+ let t = j();
212
+ return w(() => T(t, [A(N).e("picture-loading")])), E(t, null, 0), m(A(d), {
207
213
  percent: () => parseInt((e.value.percentage / 100).toFixed(1)),
208
214
  type: "primary"
209
215
  }), t;
210
216
  }, () => {
211
217
  let t = j();
212
- return w(() => T(t, [k(N).e("picture-mask")])), E(t, null, 0), g(() => !O.disabled && !y.autoUpload && y.showUpload && (e.value.status === "ready" || e.value.status === "error"), () => {
218
+ return w(() => T(t, [A(N).e("picture-mask")])), E(t, null, 0), g(() => !k.disabled && !y.autoUpload && y.showUpload && e.value.status === "ready", () => {
213
219
  let t = j();
214
- return w(() => T(t, [k(N).e("picture-action")])), E(t, null, 0), m(k(s)), t.$evtclick = _(() => Z(e.value)), t;
220
+ return w(() => T(t, [A(N).e("picture-action")])), E(t, null, 0), m(A(s)), t.$evtclick = _(() => Z(e.value)), t;
215
221
  }), E(t, null, 1), g(() => e.value.url, () => {
216
222
  let t = j();
217
- return w(() => T(t, [k(N).e("picture-action")])), E(t, null, 0), m(k(c)), t.$evtclick = _(() => Y(e.value)), t;
218
- }), E(t, null, 2), g(() => !O.disabled && y.showRetry && e.value.status === "error", () => {
223
+ return w(() => T(t, [A(N).e("picture-action")])), E(t, null, 0), m(A(c)), t.$evtclick = _(() => ve(e.value)), t;
224
+ }), E(t, null, 2), g(() => !k.disabled && y.showRetry && e.value.status === "error", () => {
219
225
  let t = j();
220
- return w(() => T(t, [k(N).e("picture-action")])), E(t, null, 0), m(k(o)), t.$evtclick = _(() => J(e.value)), t;
221
- }), E(t, null, 3), g(() => !O.disabled, () => {
226
+ return w(() => T(t, [A(N).e("picture-action")])), E(t, null, 0), m(A(o)), t.$evtclick = _(() => J(e.value)), t;
227
+ }), E(t, null, 3), g(() => !k.disabled, () => {
222
228
  let t = j();
223
- return w(() => T(t, [k(N).e("picture-action")])), E(t, null, 0), m(k(r)), t.$evtclick = _(() => q(e.value)), t;
229
+ return w(() => T(t, [A(N).e("picture-action")])), E(t, null, 0), m(A(r)), t.$evtclick = _(() => q(e.value)), t;
224
230
  }), t;
225
- }, 517), t;
226
- }, (e) => e.uid, 8), E(e, null, 1), g(() => pe.value, () => {
231
+ }, 773), t;
232
+ }, (e) => e.uid, 8), E(e, null, 1), g(() => me.value, () => {
227
233
  let e = j();
228
- return w(() => T(e, [k(N).e("picture-trigger")])), E(e, null, 0), v("trigger", null, () => m(k(a))), e.$evtclick = _(G), e;
234
+ return w(() => T(e, [A(N).e("picture-trigger")])), E(e, null, 0), v("trigger", null, () => m(A(a))), e.$evtclick = _(G), e;
229
235
  }), e;
230
236
  }, () => {
231
- let e = ue();
232
- return w(() => T(e, [k(N).e("content")])), E(e, null, 0), g(() => y.drag, () => m(te, {
233
- disabled: () => O.disabled,
237
+ let e = de();
238
+ return w(() => T(e, [A(N).e("content")])), E(e, null, 0), g(() => y.drag, () => m(te, {
239
+ disabled: () => k.disabled,
234
240
  onClick: () => G,
235
- onChange: () => ge
241
+ onChange: () => _e
236
242
  }, () => v("drag", null, null, 4)), () => {
237
243
  let e = j();
238
- return w(() => T(e, [k(N).e("btn")])), E(e, null, 0), v("btn", null, () => m(k(l), {
244
+ return w(() => T(e, [A(N).e("btn")])), E(e, null, 0), v("btn", null, () => m(A(l), {
239
245
  type: "primary",
240
246
  label: "选择文件",
241
- disabled: () => O.disabled
247
+ disabled: () => k.disabled
242
248
  })), e.$evtclick = _(G), e;
243
- }, 2309), [e, g(() => y.showList && z.value.length > 0, () => {
249
+ }, 2565), [e, g(() => y.showList && z.value.length > 0, () => {
244
250
  let e = j();
245
- return w(() => T(e, [k(N).e("list")])), E(e, null, 0), h(() => z.value, (e) => {
246
- let t = de(), i = f(t), a = S(i, 1), c = S(a, 2), l = se(i);
251
+ return w(() => T(e, [A(N).e("list")])), E(e, null, 0), h(() => z.value, (e) => {
252
+ let t = fe(), i = f(t, 1), a = f(i), c = S(a, 1), l = S(c, 2);
253
+ w(() => {
254
+ let n = A(N);
255
+ T(t, [n.e("item"), n.is(e.value.status, !0)]);
256
+ }), E(t, 0, 0), g(() => e.value.status === "uploading", () => {
257
+ let t = j();
258
+ return w(() => {
259
+ T(t, [A(N).e("progress-bar")]), O(t, { width: (e.value.percentage ?? 0) + "%" });
260
+ }), t;
261
+ });
262
+ let u = se(a);
247
263
  return w(() => {
248
- let n = k(N), r = e.value;
249
- T(t, [n.e("item"), n.is(r.status)]), T(i, [n.e("name")]), ae(l, oe(r.name)), T(a, [n.e("progress")]);
250
- }), E(a, null, 0), g(() => e.value.percentage && e.value.status === "uploading", () => m(k(u), {
264
+ let t = A(N);
265
+ T(i, [t.e("item-content")]), T(a, [t.e("name")]), ae(u, oe(e.value.name)), T(c, [t.e("progress")]);
266
+ }), E(c, null, 0), g(() => e.value.percentage && e.value.status === "uploading", () => m(A(d), {
251
267
  percent: () => parseInt((e.value.percentage / 100).toFixed(1)),
252
268
  type: "primary"
253
- })), w(() => T(c, [k(N).e("actions")])), E(c, null, 0), g(() => !O.disabled && !y.autoUpload && y.showUpload && (e.value.status === "ready" || e.value.status === "error"), () => {
269
+ })), w(() => T(l, [A(N).e("actions")])), E(l, null, 0), g(() => !k.disabled && !y.autoUpload && y.showUpload && e.value.status === "ready", () => {
254
270
  let t = j();
255
- return w(() => T(t, [k(N).e("action")])), E(t, null, 0), m(k(s)), t.$evtclick = _(() => Z(e.value)), t;
256
- }), E(c, null, 1), g(() => !O.disabled && y.showRetry && e.value.status === "error", () => {
271
+ return w(() => T(t, [A(N).e("action")])), E(t, null, 0), m(A(s)), t.$evtclick = _(() => Z(e.value)), t;
272
+ }), E(l, null, 1), g(() => !k.disabled && y.showRetry && e.value.status === "error", () => {
257
273
  let t = j();
258
- return w(() => T(t, [k(N).e("action")])), E(t, null, 0), m(k(o)), t.$evtclick = _(() => J(e.value)), t;
259
- }), E(c, null, 2), g(() => !O.disabled && y.showCancel && e.value.status === "uploading", () => {
274
+ return w(() => T(t, [A(N).e("action")])), E(t, null, 0), m(A(o)), t.$evtclick = _(() => J(e.value)), t;
275
+ }), E(l, null, 2), g(() => !k.disabled && y.showCancel && e.value.status === "uploading", () => {
260
276
  let t = j();
261
- return w(() => T(t, [k(N).e("action")])), E(t, null, 0), m(k(n)), t.$evtclick = _(() => _e(e.value)), t;
262
- }), E(c, null, 3), g(() => !O.disabled, () => {
277
+ return w(() => T(t, [A(N).e("action")])), E(t, null, 0), m(A(n)), t.$evtclick = _(() => Y(e.value)), t;
278
+ }), E(l, null, 3), g(() => !k.disabled, () => {
263
279
  let t = j();
264
- return w(() => T(t, [k(N).e("action")])), E(t, null, 0), m(k(r)), t.$evtclick = _(() => q(e.value)), t;
280
+ return w(() => T(t, [A(N).e("action")])), E(t, null, 0), m(A(r)), t.$evtclick = _(() => q(e.value)), t;
265
281
  }), t;
266
282
  }, (e) => e.uid, 9), e;
267
283
  })];
268
- }, 2057), E(Q, null, 2), m(k(ee), {
284
+ }, 2313), E(Q, null, 2), m(A(u), {
269
285
  modelValue: () => V.value,
270
286
  "onUpdate:modelValue": () => (e) => V.value = e,
271
287
  src: () => H.value
@@ -279,7 +279,7 @@
279
279
  }
280
280
 
281
281
  @include b(button-group) {
282
- display: flex;
282
+ display: inline-flex;
283
283
  @include b(button) {
284
284
  &:not(:last-child) {
285
285
  border-top-right-radius: 0;
@@ -100,6 +100,7 @@
100
100
  vertical-align: top;
101
101
  resize: vertical;
102
102
  color: getCssVar("color", "text-1");
103
+ font-family: inherit;
103
104
  &::placeholder {
104
105
  color: getCssVar("color", "text-3");
105
106
  }
@@ -45,12 +45,37 @@
45
45
  gap: 4px;
46
46
  }
47
47
  @include e(item) {
48
+ position: relative;
49
+ overflow: hidden;
48
50
  display: flex;
49
51
  align-items: center;
50
52
  background-color: getCssVar("color", "fill-2");
51
53
  padding: 8px 12px;
52
54
  gap: 12px;
53
55
  border-radius: getCssVar("radius", "medium");
56
+ @include when(success) {
57
+ background-color: getCssVar("color", "success-1");
58
+ }
59
+ @include when(error) {
60
+ background-color: getCssVar("color", "danger-1");
61
+ }
62
+ }
63
+ @include e(progress-bar) {
64
+ position: absolute;
65
+ top: 0;
66
+ left: 0;
67
+ bottom: 0;
68
+ background-color: getCssVar("color", "primary-1");
69
+ transition: width 0.2s getCssVar("bezier", "1");
70
+ z-index: 0;
71
+ }
72
+ @include e(item-content) {
73
+ position: relative;
74
+ z-index: 1;
75
+ display: flex;
76
+ align-items: center;
77
+ gap: 12px;
78
+ width: 100%;
54
79
  }
55
80
  @include e(name) {
56
81
  max-width: 200px;
@@ -127,6 +152,16 @@
127
152
  }
128
153
  }
129
154
  }
155
+ @include e(picture-progress-bar) {
156
+ position: absolute;
157
+ bottom: 0;
158
+ left: 0;
159
+ right: 0;
160
+ background-color: getCssVar("color", "primary-1");
161
+ transition: height 0.2s getCssVar("bezier", "1");
162
+ z-index: 0;
163
+ pointer-events: none;
164
+ }
130
165
  @include e(picture-thumb) {
131
166
  width: 100%;
132
167
  height: 100%;
@@ -2748,6 +2748,10 @@
2748
2748
  "description": "是否显示上传列表",
2749
2749
  "type": "boolean"
2750
2750
  },
2751
+ "s-upload/name": {
2752
+ "description": "上传文件的名称",
2753
+ "type": "string"
2754
+ },
2751
2755
  "s-upload/picture": {
2752
2756
  "description": "是否显示图片墙",
2753
2757
  "type": "boolean"
@@ -1135,6 +1135,7 @@
1135
1135
  "autoUpload",
1136
1136
  "drag",
1137
1137
  "showList",
1138
+ "name",
1138
1139
  "picture",
1139
1140
  "accept",
1140
1141
  "limit",
@@ -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.15.0",
5
+ "version": "0.15.2",
6
6
  "contributions": {
7
7
  "html": {
8
8
  "types-syntax": "typescript",
@@ -6971,6 +6971,14 @@
6971
6971
  "kind": "expression"
6972
6972
  }
6973
6973
  },
6974
+ {
6975
+ "name": "name",
6976
+ "description": "上传文件的名称",
6977
+ "value": {
6978
+ "type": "string",
6979
+ "kind": "expression"
6980
+ }
6981
+ },
6974
6982
  {
6975
6983
  "name": "picture",
6976
6984
  "description": "是否显示图片墙",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "savor-ui",
3
- "version": "0.15.1",
3
+ "version": "0.15.3",
4
4
  "description": "A Vue3 Components Library",
5
5
  "keywords": [
6
6
  "component library",