@aplus-frontend/ui 0.1.25 → 0.1.26

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.
@@ -1,15 +1,15 @@
1
- import { defineComponent as $, useSlots as j, ref as f, onMounted as q, computed as B, unref as l, watch as E, cloneVNode as K, openBlock as g, createBlock as C, mergeProps as Q, createSlots as U, withCtx as i, resolveDynamicComponent as G, createCommentVNode as H, createElementVNode as V, normalizeClass as J, createVNode as k, normalizeStyle as M, toDisplayString as W, renderList as X, renderSlot as Y, normalizeProps as Z, guardReactiveProps as ee } from "vue";
1
+ import { defineComponent as $, useSlots as j, ref as f, onMounted as q, computed as B, unref as l, watch as E, cloneVNode as K, openBlock as g, createBlock as V, mergeProps as Q, createSlots as U, withCtx as i, resolveDynamicComponent as G, createCommentVNode as H, createElementVNode as C, normalizeClass as J, createVNode as k, normalizeStyle as M, toDisplayString as W, renderList as X, renderSlot as Y, normalizeProps as Z, guardReactiveProps as ee } from "vue";
2
2
  import { Form as oe, Tooltip as le } from "ant-design-vue";
3
3
  import { useToken as te } from "ant-design-vue/es/theme/internal";
4
- import { isFunction as ae, isArray as re, omit as N } from "lodash-unified";
5
- import { apFormItemColPropKeys as ne } from "./constant.mjs";
6
- import { QuestionCircleOutlined as ie } from "@ant-design/icons-vue";
4
+ import { isFunction as ae, cloneDeep as re, isArray as ne, omit as N } from "lodash-unified";
5
+ import { apFormItemColPropKeys as ie } from "./constant.mjs";
6
+ import { QuestionCircleOutlined as ue } from "@ant-design/icons-vue";
7
7
  import "../config-provider/index.mjs";
8
- import { useInjectForm as ue } from "./context.mjs";
8
+ import { useInjectForm as se } from "./context.mjs";
9
9
  import "./style/ap-form-item.css";
10
- import { isPromise as se } from "@fruits-chain/utils";
11
- import { useNamespace as de } from "../config-provider/hooks/use-namespace.mjs";
12
- const me = ["title"], Ve = /* @__PURE__ */ $({
10
+ import { isPromise as de } from "@fruits-chain/utils";
11
+ import { useNamespace as me } from "../config-provider/hooks/use-namespace.mjs";
12
+ const fe = ["title"], ke = /* @__PURE__ */ $({
13
13
  name: "ApFormItem",
14
14
  __name: "ap-form-item",
15
15
  props: {
@@ -54,15 +54,15 @@ const me = ["title"], Ve = /* @__PURE__ */ $({
54
54
  },
55
55
  setup(P, { expose: S }) {
56
56
  var b, F;
57
- const o = P, t = j(), { model: u, updateModel: s, internalInstance: d } = ue(), { m: p, b: w } = de("ap-form-item"), m = f(!1), a = f(), [, x] = te();
57
+ const o = P, t = j(), { model: u, updateModel: s, internalInstance: d } = se(), { m: p, b: w } = me("ap-form-item"), m = f(!1), a = f(), [, x] = te();
58
58
  q(async () => {
59
59
  let e = ae(o.initialValue) ? o.initialValue() : o.initialValue;
60
- se(e) && (e = await e), d == null || d.registerField({
60
+ de(e) && (e = await e), d == null || d.registerField({
61
61
  name: o.name,
62
- initialValue: e
62
+ initialValue: re(e)
63
63
  });
64
64
  });
65
- const c = B(() => o.name ? re(o.name) ? o.name.reduce((e, r) => e == null ? void 0 : e[r], l(u)) : u == null ? void 0 : u.value[o.name] : null), v = f((F = (b = t.default) == null ? void 0 : b.call(t)) == null ? void 0 : F[0]);
65
+ const c = B(() => o.name ? ne(o.name) ? o.name.reduce((e, r) => e == null ? void 0 : e[r], l(u)) : u == null ? void 0 : u.value[o.name] : null), v = f((F = (b = t.default) == null ? void 0 : b.call(t)) == null ? void 0 : F[0]);
66
66
  E(
67
67
  () => {
68
68
  var e;
@@ -98,15 +98,15 @@ const me = ["title"], Ve = /* @__PURE__ */ $({
98
98
  var e;
99
99
  (e = a.value) == null || e.onFieldBlur();
100
100
  }
101
- function R() {
101
+ function D() {
102
102
  var e;
103
103
  (e = a.value) == null || e.onFieldChange();
104
104
  }
105
- function T() {
105
+ function R() {
106
106
  var e;
107
107
  (e = a.value) == null || e.clearValidate();
108
108
  }
109
- function D() {
109
+ function T() {
110
110
  var e;
111
111
  (e = a.value) == null || e.resetField();
112
112
  }
@@ -115,14 +115,14 @@ const me = ["title"], Ve = /* @__PURE__ */ $({
115
115
  }
116
116
  return S({
117
117
  onFieldBlur: A,
118
- onFieldChange: R,
119
- clearValidate: T,
120
- resetField: D,
118
+ onFieldChange: D,
119
+ clearValidate: R,
120
+ resetField: T,
121
121
  getFieldValue: L
122
- }), (e, r) => (g(), C(l(oe).Item, Q({
122
+ }), (e, r) => (g(), V(l(oe).Item, Q({
123
123
  ref_key: "formItemRef",
124
124
  ref: a
125
- }, l(N)(o, [...l(ne), "tooltip", "label"]), {
125
+ }, l(N)(o, [...l(ie), "tooltip", "label"]), {
126
126
  class: {
127
127
  [l(p)("bordered")]: e.bordered,
128
128
  [l(p)("focused")]: e.bordered && m.value,
@@ -131,21 +131,21 @@ const me = ["title"], Ve = /* @__PURE__ */ $({
131
131
  colon: e.bordered ? !1 : o.colon
132
132
  }), U({
133
133
  default: i(() => [
134
- y.value ? (g(), C(G(y.value), { key: 0 })) : H("", !0)
134
+ y.value ? (g(), V(G(y.value), { key: 0 })) : H("", !0)
135
135
  ]),
136
136
  _: 2
137
137
  }, [
138
138
  o.tooltip ? {
139
139
  name: "tooltip",
140
140
  fn: i(({ class: n }) => [
141
- V("span", {
141
+ C("span", {
142
142
  class: J(n)
143
143
  }, [
144
144
  k(l(le), {
145
145
  title: o.tooltip
146
146
  }, {
147
147
  default: i(() => [
148
- k(l(ie), {
148
+ k(l(ue), {
149
149
  style: M({ color: l(x).colorPrimary })
150
150
  }, null, 8, ["style"])
151
151
  ]),
@@ -158,14 +158,14 @@ const me = ["title"], Ve = /* @__PURE__ */ $({
158
158
  e.label ? {
159
159
  name: "label",
160
160
  fn: i(() => [
161
- V("span", {
161
+ C("span", {
162
162
  title: e.label,
163
163
  style: {
164
164
  whiteSpace: "nowrap",
165
165
  overflow: "hidden",
166
166
  textOverflow: "ellipsis"
167
167
  }
168
- }, W(e.label), 9, me)
168
+ }, W(e.label), 9, fe)
169
169
  ]),
170
170
  key: "1"
171
171
  } : void 0,
@@ -179,5 +179,5 @@ const me = ["title"], Ve = /* @__PURE__ */ $({
179
179
  }
180
180
  });
181
181
  export {
182
- Ve as default
182
+ ke as default
183
183
  };
@@ -1,81 +1,83 @@
1
- import { defineComponent as D, inject as n, ref as M, watch as $, nextTick as j, openBlock as v, createElementBlock as C, normalizeClass as W, unref as s, createVNode as _, withCtx as E, createElementVNode as b, createTextVNode as G, toDisplayString as L, withModifiers as H, createBlock as J, resolveDynamicComponent as K, createCommentVNode as Q } from "vue";
1
+ import { defineComponent as $, inject as n, ref as j, watch as W, nextTick as G, openBlock as x, createElementBlock as C, normalizeClass as H, unref as s, createVNode as _, withCtx as b, createElementVNode as L, createTextVNode as J, toDisplayString as S, withModifiers as K, createBlock as Q, resolveDynamicComponent as V, createCommentVNode as X } from "vue";
2
2
  import "../../config-provider/index.mjs";
3
- import { getPath as V, getName as X, getReturnData as x } from "../utils/returnData.mjs";
4
- import { useOss as Y, getOssInstance as Z } from "../hooks/useOss.mjs";
5
- import { message as p, Upload as ee, Button as te } from "ant-design-vue";
6
- import { UploadOutlined as oe } from "@ant-design/icons-vue";
7
- import { fileMatchesAccept as ae, getAcceptText as se } from "../utils/accept.mjs";
3
+ import { getPath as Y, getName as Z, getReturnData as y } from "../utils/returnData.mjs";
4
+ import { useOss as ee, getOssInstance as te } from "../hooks/useOss.mjs";
5
+ import { message as c, Upload as oe, Button as ae } from "ant-design-vue";
6
+ import { UploadOutlined as se } from "@ant-design/icons-vue";
7
+ import { fileMatchesAccept as ne, getAcceptText as ie } from "../utils/accept.mjs";
8
8
  import "../styles/multiple-file.css";
9
- import { useLocale as ne } from "../../config-provider/hooks/use-locale.mjs";
10
- import { useNamespace as ie } from "../../config-provider/hooks/use-namespace.mjs";
11
- const le = { class: "multiple-file-context" }, re = { key: 0 }, pe = { key: 1 }, ke = /* @__PURE__ */ D({
9
+ import { useLocale as re } from "../../config-provider/hooks/use-locale.mjs";
10
+ import { useNamespace as le } from "../../config-provider/hooks/use-namespace.mjs";
11
+ const ue = { class: "multiple-file-context" }, pe = { key: 0 }, ce = { key: 1 }, _e = /* @__PURE__ */ $({
12
12
  __name: "MultipleFile",
13
- setup(ue) {
14
- const { t: i } = ne(), { b: U } = ie("ap-upload-multiple-file"), { put: R } = Y(), S = n("theme"), B = n("dirName"), y = n("accept") || "*", A = n("maxSize") ?? 500, I = n("title") || i("ap.apUpload.uploadFile"), g = n("subTitle"), l = n("maxCount") ?? 10, u = n("uploadingCount"), F = n("beforeUpload"), N = n("customRequest"), P = n("getOssAccess"), a = n("value"), d = [], c = n("needName"), f = M(null);
15
- $(
13
+ setup(me) {
14
+ const { t: i } = re(), { b: U } = le("ap-upload-multiple-file"), { put: B } = ee(), I = n("theme"), P = n("dirName"), w = n("accept") || "*", A = n("maxSize") ?? 500, z = n("title") || i("ap.apUpload.uploadFile"), h = n("subTitle"), r = n("maxCount") ?? 10, m = n("uploadingCount"), F = n("beforeUpload"), N = n("customRequest"), R = n("getOssAccess"), a = n("value"), g = [], d = n("needName"), p = j(null);
15
+ W(
16
16
  () => a == null ? void 0 : a.value,
17
17
  function(e) {
18
- !f.value.fileList.length && e && j(() => {
19
- const t = e.map((o) => {
20
- const r = V(c, o), w = X(c, o), k = new File(
21
- [o],
22
- w,
18
+ var t, o;
19
+ !((o = (t = p == null ? void 0 : p.value) == null ? void 0 : t.fileList) != null && o.length) && e && G(() => {
20
+ const l = e.map((u) => {
21
+ const E = Y(d, u), M = Z(d, u), k = new File(
22
+ [u],
23
+ M,
23
24
  {}
24
25
  );
25
- return k.response = r, k.uid = r, k;
26
+ return k.response = E, k.uid = E, k;
26
27
  });
27
- if (l && t.length > l) {
28
- p.warning(
28
+ if (r && l.length > r) {
29
+ c.warning(
29
30
  i("ap.apUpload.fileInitializationException", {
30
- maxCount: l
31
+ maxCount: r
31
32
  })
32
33
  );
33
34
  return;
34
35
  }
35
- t.forEach((o) => {
36
- m.push(o), d.push({
37
- uid: o.uid,
38
- path: o.response
36
+ l.forEach((u) => {
37
+ f.push(u), g.push({
38
+ uid: u.uid,
39
+ path: u.response
39
40
  });
40
- }), f.value.fileList = t;
41
+ }), p.value.fileList = l;
41
42
  });
42
- }
43
+ },
44
+ { immediate: !0 }
43
45
  );
44
- let m = [], T;
45
- function h(e) {
46
+ let f = [], T;
47
+ function v(e) {
46
48
  setTimeout(() => {
47
- const t = f.value.fileList.findIndex(
49
+ const t = p.value.fileList.findIndex(
48
50
  (o) => o.uid === e.uid
49
51
  );
50
- t >= 0 && f.value.fileList.splice(t, 1);
52
+ t >= 0 && p.value.fileList.splice(t, 1);
51
53
  });
52
54
  }
53
- function z(e) {
54
- if (l && l > 1 && m.length >= l)
55
+ function O(e) {
56
+ if (r && r > 1 && f.length >= r)
55
57
  return clearTimeout(T), T = setTimeout(() => {
56
- p.warning(
58
+ c.warning(
57
59
  i("ap.apUpload.maxUploadFiles", {
58
- maxCount: l
60
+ maxCount: r
59
61
  })
60
62
  );
61
- }), h(e), !1;
63
+ }), v(e), !1;
62
64
  if (typeof F == "function") {
63
65
  if (F(e) === !1)
64
- return h(e), !1;
66
+ return v(e), !1;
65
67
  } else {
66
68
  if (e.size > A * 1024 * 1024)
67
- return p.warning(
69
+ return c.warning(
68
70
  i("ap.apUpload.maxUploadFileSize", {
69
71
  maxSize: A
70
72
  })
71
- ), h(e), !1;
72
- if (!ae(e, y))
73
- return p.warning(i("ap.apUpload.fileFormatNotSupported")), h(e), !1;
73
+ ), v(e), !1;
74
+ if (!ne(e, w))
75
+ return c.warning(i("ap.apUpload.fileFormatNotSupported")), v(e), !1;
74
76
  }
75
- l && l === 1 && (m = [], a.value = void 0), m.push(e);
77
+ r && r === 1 && (f = [], a.value = void 0), f.push(e);
76
78
  }
77
- async function O(e) {
78
- if (u.value++, typeof N == "function") {
79
+ async function q(e) {
80
+ if (m.value++, typeof N == "function") {
79
81
  N({
80
82
  onProgress: (t) => {
81
83
  setTimeout(() => {
@@ -85,50 +87,50 @@ const le = { class: "multiple-file-context" }, re = { key: 0 }, pe = { key: 1 },
85
87
  });
86
88
  },
87
89
  onError: (t) => {
88
- p.warning(t || i("ap.apUpload.networkAnomaly")), setTimeout(() => {
90
+ c.warning(t || i("ap.apUpload.networkAnomaly")), setTimeout(() => {
89
91
  e.onError({
90
92
  name: t,
91
93
  message: t
92
94
  });
93
- }), u.value--;
95
+ }), m.value--;
94
96
  },
95
97
  onSuccess: (t) => {
96
98
  setTimeout(() => {
97
99
  e.onSuccess(t);
98
100
  }), a.value ? a.value.push(
99
- x(c, t, e.file.name)
101
+ y(d, t, e.file.name)
100
102
  ) : a.value = [
101
- x(c, t, e.file.name)
102
- ], d.push({
103
+ y(d, t, e.file.name)
104
+ ], g.push({
103
105
  uid: e.file.uid,
104
106
  path: t
105
- }), u.value--;
107
+ }), m.value--;
106
108
  },
107
109
  file: e.file
108
110
  });
109
111
  return;
110
112
  }
111
113
  try {
112
- const t = await Z(P);
113
- e.file.oss = t, R({
114
+ const t = await te(R);
115
+ e.file.oss = t, B({
114
116
  file: e.file,
115
- dirName: B,
117
+ dirName: P,
116
118
  oss: t,
117
119
  successCallBack(o) {
118
120
  e.onSuccess(o), a.value ? a.value.push(
119
- x(c, o, e.file.name)
121
+ y(d, o, e.file.name)
120
122
  ) : a.value = [
121
- x(c, o, e.file.name)
122
- ], d.push({
123
+ y(d, o, e.file.name)
124
+ ], g.push({
123
125
  uid: e.file.uid,
124
126
  path: o
125
- }), u.value--;
127
+ }), m.value--;
126
128
  },
127
129
  errorCallBack(o) {
128
- p.warning(o || i("ap.apUpload.networkAnomaly")), e.onError({
130
+ c.warning(o || i("ap.apUpload.networkAnomaly")), e.onError({
129
131
  name: o,
130
132
  message: o
131
- }), u.value--;
133
+ }), m.value--;
132
134
  },
133
135
  progressCallBack(o) {
134
136
  e.onProgress({
@@ -137,66 +139,66 @@ const le = { class: "multiple-file-context" }, re = { key: 0 }, pe = { key: 1 },
137
139
  }
138
140
  });
139
141
  } catch (t) {
140
- p.warning(
142
+ c.warning(
141
143
  typeof (t == null ? void 0 : t.message) == "string" ? t.message : i("ap.apUpload.networkAnomaly")
142
144
  ), e.onError({
143
145
  name: (t == null ? void 0 : t.message) || i("ap.apUpload.networkAnomaly"),
144
146
  message: (t == null ? void 0 : t.message) || i("ap.apUpload.networkAnomaly")
145
- }), u.value--;
147
+ }), m.value--;
146
148
  }
147
149
  }
148
- function q(e) {
150
+ function D(e) {
149
151
  var o;
150
152
  if (e.response) {
151
153
  if (Array.isArray(a.value)) {
152
- const r = d.findIndex((w) => w.uid === e.uid);
153
- r >= 0 && (a == null || a.value.splice(r, 1), d.splice(r, 1)), a.value.length === 0 && (a.value = void 0);
154
+ const l = g.findIndex((u) => u.uid === e.uid);
155
+ l >= 0 && (a == null || a.value.splice(l, 1), g.splice(l, 1)), a.value.length === 0 && (a.value = void 0);
154
156
  }
155
157
  } else
156
158
  (o = e == null ? void 0 : e.oss) == null || o.pauseUpload();
157
- const t = m.findIndex(
158
- (r) => r.uid === e.uid
159
+ const t = f.findIndex(
160
+ (l) => l.uid === e.uid
159
161
  );
160
- return m.splice(t, 1), Promise.resolve(!0);
162
+ return f.splice(t, 1), Promise.resolve(!0);
161
163
  }
162
- return (e, t) => (v(), C("div", {
163
- class: W({
164
+ return (e, t) => (x(), C("div", {
165
+ class: H({
164
166
  [s(U)()]: !0,
165
- [s(U)("admin")]: s(S) === "admin"
167
+ [s(U)("admin")]: s(I) === "admin"
166
168
  })
167
169
  }, [
168
- _(s(ee), {
170
+ _(s(oe), {
169
171
  ref_key: "uploadRef",
170
- ref: f,
171
- accept: s(y),
172
+ ref: p,
173
+ accept: s(w),
172
174
  multiple: "",
173
- maxCount: s(l),
175
+ maxCount: s(r),
174
176
  progress: {
175
177
  strokeWidth: 3,
176
178
  showInfo: !1,
177
179
  strokeColor: "#0070FF"
178
180
  },
179
- beforeUpload: z,
180
- customRequest: O,
181
- onRemove: q
181
+ beforeUpload: O,
182
+ customRequest: q,
183
+ onRemove: D
182
184
  }, {
183
- default: E(() => [
184
- b("div", le, [
185
- _(s(te), { class: "file-btn" }, {
186
- default: E(() => [
187
- _(s(oe)),
188
- G(" " + L(s(I)), 1)
185
+ default: b(() => [
186
+ L("div", ue, [
187
+ _(s(ae), { class: "file-btn" }, {
188
+ default: b(() => [
189
+ _(s(se)),
190
+ J(" " + S(s(z)), 1)
189
191
  ]),
190
192
  _: 1
191
193
  }),
192
- b("div", {
194
+ L("div", {
193
195
  class: "sub-title",
194
- onClick: t[0] || (t[0] = H(() => {
196
+ onClick: t[0] || (t[0] = K(() => {
195
197
  }, ["stop"]))
196
198
  }, [
197
- typeof s(g) == "string" ? (v(), C("div", re, L(s(g) || `${s(i)("ap.apUpload.supportExtension")}:${s(se)(s(y))}`), 1)) : s(g) ? (v(), C("div", pe, [
198
- (v(), J(K(s(g))))
199
- ])) : Q("", !0)
199
+ typeof s(h) == "string" ? (x(), C("div", pe, S(s(h) || `${s(i)("ap.apUpload.supportExtension")}:${s(ie)(s(w))}`), 1)) : s(h) ? (x(), C("div", ce, [
200
+ (x(), Q(V(s(h))))
201
+ ])) : X("", !0)
200
202
  ])
201
203
  ])
202
204
  ]),
@@ -206,5 +208,5 @@ const le = { class: "multiple-file-context" }, re = { key: 0 }, pe = { key: 1 },
206
208
  }
207
209
  });
208
210
  export {
209
- ke as default
211
+ _e as default
210
212
  };