@aplus-frontend/ui 7.14.1 → 7.14.2

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,151 +1,164 @@
1
- import { useToken as C } from "@aplus-frontend/antdv/es/theme/internal";
2
- import { isBoolean as J, isNumber as v, isObject as x, mergeWith as y, omit as M, isString as j } from "lodash-unified";
3
- import { ref as S, unref as c, watch as h } from "vue";
1
+ import { useToken as j } from "@aplus-frontend/antdv/es/theme/internal";
2
+ import { isBoolean as G, isNumber as h, isObject as b, mergeWith as z, omit as P, isString as R } from "lodash-unified";
3
+ import { ref as y, unref as p, watch as v } from "vue";
4
4
  import "../../config-provider/index.mjs";
5
- import { randomStr as A } from "../../utils/index.mjs";
6
- import { getColumnStateString as G } from "../components/setting/utils.mjs";
7
- import { useInjectApTable as P } from "../context.mjs";
8
- import { getTableTitle as R } from "../utils.mjs";
9
- import { useLocale as U } from "../../config-provider/hooks/use-locale.mjs";
10
- import { useNamespace as W } from "../../config-provider/hooks/use-namespace.mjs";
11
- function X(t, e, i, o) {
12
- return o ? o.fixed : e ? e.fixed : i && "fixed" in i ? i.fixed : J(t.fixed) ? t.fixed ? "left" : void 0 : t.fixed;
5
+ import { randomStr as E } from "../../utils/index.mjs";
6
+ import { getColumnStateString as U } from "../components/setting/utils.mjs";
7
+ import { useInjectApTable as W } from "../context.mjs";
8
+ import { getTableTitle as X } from "../utils.mjs";
9
+ import { useLocale as q } from "../../config-provider/hooks/use-locale.mjs";
10
+ import { useNamespace as D } from "../../config-provider/hooks/use-namespace.mjs";
11
+ function H(t, e, o, a) {
12
+ return a ? a.fixed : e ? e.fixed : o && "fixed" in o ? o.fixed : G(t.fixed) ? t.fixed ? "left" : void 0 : t.fixed;
13
13
  }
14
- const b = Number.MAX_SAFE_INTEGER, q = A();
15
- function D(t, e) {
16
- const i = v(t.order) ? t.order : b;
17
- let o = v(e.order) ? e.order : b;
18
- return t.fixed === "right" && e.fixed !== "right" && (o = i - 1), e.fixed === "left" && t.fixed !== "left" && (o = i - 1), i - o;
14
+ const k = Number.MAX_SAFE_INTEGER, A = E();
15
+ function Q(t, e) {
16
+ const o = h(t.order) ? t.order : k;
17
+ let a = h(e.order) ? e.order : k;
18
+ return t.fixed === "right" && e.fixed !== "right" && (a = o - 1), e.fixed === "left" && t.fixed !== "left" && (a = o - 1), o - a;
19
19
  }
20
- function H(t, e) {
20
+ function V(t, e) {
21
21
  e && t.removeItem(e);
22
22
  }
23
- function K(t, e) {
23
+ function I(t, e) {
24
24
  if (!e)
25
25
  return [];
26
- const i = t.getItem(e);
27
- if (!i)
26
+ const o = t.getItem(e);
27
+ if (!o)
28
28
  return [];
29
- const o = JSON.parse(i);
30
- return Array.isArray(o) ? o : (H(t, e), []);
29
+ const a = JSON.parse(o);
30
+ return Array.isArray(a) ? a : (V(t, e), []);
31
31
  }
32
- function k(t, e) {
33
- if (x(t) && x(e))
34
- return y({}, t, e, k);
32
+ function N(t, e) {
33
+ if (b(t) && b(e))
34
+ return z({}, t, e, N);
35
35
  }
36
- const ae = (t, e) => {
37
- const { columnsBackup: i, size: o } = P(), { t: I } = U(), { be: E } = W("ap-table"), [Q, N] = C(), m = S(), l = S(
38
- z(
39
- K(localStorage, c(e))
36
+ const le = (t, e, o) => {
37
+ const { columnsBackup: a, size: d } = W(), { t: _ } = q(), { be: L } = D("ap-table"), [Y, O] = j(), s = y(), l = y(
38
+ T(
39
+ I(localStorage, p(e))
40
40
  )
41
41
  );
42
- h(
43
- [i, o],
44
- ([r, n]) => {
45
- r && (m.value = {
42
+ v(
43
+ [a, d],
44
+ ([r, i]) => {
45
+ r && (s.value = {
46
46
  label: "basic_template",
47
47
  columnState: f(r),
48
- key: q,
49
- size: n
48
+ key: A,
49
+ size: i
50
50
  });
51
51
  },
52
52
  { immediate: !0, deep: !0 }
53
+ ), v(
54
+ () => e.value,
55
+ (r) => {
56
+ const i = T(
57
+ I(localStorage, r)
58
+ );
59
+ l.value = i, s.value = {
60
+ label: "basic_template",
61
+ columnState: f(a?.value || []),
62
+ key: A,
63
+ size: d?.value
64
+ }, o(i ?? []);
65
+ }
53
66
  );
54
- function z(r) {
55
- return r.length ? r.map((n) => ({
56
- ...n,
67
+ function T(r) {
68
+ return r.length ? r.map((i) => ({
69
+ ...i,
57
70
  columnState: f(
58
- i.value,
59
- n.columnState,
71
+ a.value,
72
+ i.columnState,
60
73
  !1
61
74
  )
62
75
  })) : [
63
76
  {
64
- label: I("ap.apTable.setting.defaultTemplate"),
65
- key: t.getActiveKey?.("DEFAULT_TEMPLATE") ?? A(),
66
- size: o?.value,
67
- columnState: f(i?.value || [])
77
+ label: _("ap.apTable.setting.defaultTemplate"),
78
+ key: t.getActiveKey?.("DEFAULT_TEMPLATE") ?? E(),
79
+ size: d?.value,
80
+ columnState: f(a?.value || [])
68
81
  }
69
82
  ];
70
83
  }
71
- function f(r, n = {}, a = !0) {
72
- const d = y(
84
+ function f(r, i = {}, n = !0) {
85
+ const c = z(
73
86
  {},
74
- a ? t.defaultValue || {} : {},
75
- n,
76
- k
87
+ n ? t.defaultValue || {} : {},
88
+ i,
89
+ N
77
90
  );
78
- function T(B, F, w) {
79
- return B.map((u) => {
80
- const g = F?.[u.key] || {}, s = {
91
+ function x(C, J, M) {
92
+ return C.map((u) => {
93
+ const S = J?.[u.key] || {}, m = {
81
94
  key: u.key,
82
- label: j(u.title) ? R(
95
+ label: R(u.title) ? X(
83
96
  u,
84
- E("table-header", "title"),
97
+ L("table-header", "title"),
85
98
  void 0,
86
- N.value.colorTextTertiary
99
+ O.value.colorTextTertiary
87
100
  ) : u.title,
88
101
  show: !0,
89
- fixed: X(
102
+ fixed: H(
90
103
  u,
91
104
  void 0,
92
- a ? t.defaultValue?.[u.key] : void 0,
93
- w
105
+ n ? t.defaultValue?.[u.key] : void 0,
106
+ M
94
107
  ),
95
108
  disabled: !1,
96
- ...M(g, ["children", "fixed"])
109
+ ...P(S, ["children", "fixed"])
97
110
  };
98
- return s.children = u.children?.length ? T(
111
+ return m.children = u.children?.length ? x(
99
112
  u.children,
100
- g.children,
101
- s
102
- ) : void 0, s;
103
- }).sort(D);
113
+ S.children,
114
+ m
115
+ ) : void 0, m;
116
+ }).sort(Q);
104
117
  }
105
- return T(r || [], d);
118
+ return x(r || [], c);
106
119
  }
107
- function p(r) {
108
- if (c(e)) {
109
- const n = r.map((a) => ({
110
- ...a,
111
- columnState: G(a.columnState)
120
+ function g(r) {
121
+ if (p(e)) {
122
+ const i = r.map((n) => ({
123
+ ...n,
124
+ columnState: U(n.columnState)
112
125
  }));
113
- localStorage.setItem(c(e), JSON.stringify(n));
126
+ localStorage.setItem(p(e), JSON.stringify(i));
114
127
  }
115
128
  }
116
- function L(r) {
129
+ function B(r) {
117
130
  l.value.push(r);
118
131
  }
119
- function _(r) {
120
- const n = l.value.findIndex(
121
- (a) => a.key === r
132
+ function F(r) {
133
+ const i = l.value.findIndex(
134
+ (n) => n.key === r
122
135
  );
123
- l.value.splice(n, 1);
136
+ l.value.splice(i, 1);
124
137
  }
125
- function O(r, n) {
126
- const a = l.value.findIndex(
127
- (d) => d.key === r
138
+ function w(r, i) {
139
+ const n = l.value.findIndex(
140
+ (c) => c.key === r
128
141
  );
129
- return l.value[a] = {
130
- ...l.value[a],
131
- ...n
132
- }, l.value[a];
142
+ return l.value[n] = {
143
+ ...l.value[n],
144
+ ...i
145
+ }, l.value[n];
133
146
  }
134
- return h(
147
+ return v(
135
148
  () => l.value,
136
149
  (r) => {
137
- p(r);
150
+ g(r);
138
151
  },
139
152
  { deep: !0, immediate: !0 }
140
153
  ), {
141
- basicTemplate: m,
154
+ basicTemplate: s,
142
155
  customizeTemplateList: l,
143
- syncTemplateListToStorage: p,
144
- addTemplate: L,
145
- deleteTemplate: _,
146
- updateTemplate: O
156
+ syncTemplateListToStorage: g,
157
+ addTemplate: B,
158
+ deleteTemplate: F,
159
+ updateTemplate: w
147
160
  };
148
161
  };
149
162
  export {
150
- ae as useTableTemplateStorage
163
+ le as useTableTemplateStorage
151
164
  };
@@ -1,42 +1,43 @@
1
- import { defineComponent as oe, inject as s, ref as te, watch as se, nextTick as ae, createElementBlock as U, openBlock as y, normalizeClass as ne, unref as a, createVNode as k, withCtx as N, createElementVNode as M, createTextVNode as re, toDisplayString as L, withModifiers as ie, createCommentVNode as le, createBlock as ce, resolveDynamicComponent as ue } from "vue";
1
+ import { defineComponent as oe, inject as s, ref as te, watch as se, nextTick as ae, createElementBlock as N, openBlock as y, normalizeClass as ne, unref as a, createVNode as k, withCtx as U, createElementVNode as S, createTextVNode as re, toDisplayString as D, withModifiers as ie, createCommentVNode as le, createBlock as ce, resolveDynamicComponent as ue } from "vue";
2
2
  import { UploadOutlined as pe } from "@ant-design/icons-vue";
3
- import { message as p, Upload as de, Button as me } from "@aplus-frontend/antdv";
3
+ import { message as p, Upload as me, Button as de } from "@aplus-frontend/antdv";
4
4
  import { IconApAdLineDownload as fe } from "@aplus-frontend/icon";
5
5
  import { ApFilePreview as ge } from "../../ap-file-preview/index.mjs";
6
6
  import "../../../config-provider/index.mjs";
7
- import { useOss as we, getOssInstance as S } from "../hooks/useOss.mjs";
8
- import he from "../style/index.mjs";
9
- import { fileMatchesAccept as ve, getAcceptText as xe } from "../utils/accept.mjs";
10
- import { getPath as ye, getName as ke, getReturnData as z } from "../utils/returnData.mjs";
11
- import { useGlobalConfig as be } from "../../../config-provider/hooks/use-global-config.mjs";
12
- import { useLocale as Ce } from "../../../config-provider/hooks/use-locale.mjs";
7
+ import { randomStr as we } from "../../../utils/index.mjs";
8
+ import { useOss as he, getOssInstance as L } from "../hooks/useOss.mjs";
9
+ import ve from "../style/index.mjs";
10
+ import { fileMatchesAccept as xe, getAcceptText as ye } from "../utils/accept.mjs";
11
+ import { getPath as ke, getName as be, getReturnData as z } from "../utils/returnData.mjs";
12
+ import { useGlobalConfig as Ce } from "../../../config-provider/hooks/use-global-config.mjs";
13
+ import { useLocale as Ne } from "../../../config-provider/hooks/use-locale.mjs";
13
14
  import { useNamespace as Ue } from "../../../config-provider/hooks/use-namespace.mjs";
14
- const Ne = { class: "multiple-file-context" }, Ee = { key: 0 }, _e = { key: 1 }, qe = /* @__PURE__ */ oe({
15
+ const Ee = { class: "multiple-file-context" }, _e = { key: 0 }, Fe = { key: 1 }, $e = /* @__PURE__ */ oe({
15
16
  __name: "MultipleFile",
16
- setup(Fe, { expose: B }) {
17
- const E = be(
17
+ setup(Ae, { expose: B }) {
18
+ const E = Ce(
18
19
  "downloadCenterTriggerConfig"
19
- ), { t: i } = Ce(), { b: O } = Ue("ap-upload-multiple-file"), V = he("ap-upload"), { put: q } = we(), j = s("dirName"), $ = s("baseDirName"), b = s("accept") || "*", _ = s("maxSize") ?? 500, G = s("title") || i("ap.apUpload.uploadFile"), f = s("subTitle"), l = s("maxCount") ?? 10, d = s("uploadingCount"), F = s("beforeUpload"), A = s("customRequest"), g = s("getOssAccess"), W = s("maxSizeErrorMsg"), H = s("maxCountErrorMsg"), J = s("acceptErrorMsg"), I = s("onRemove"), C = s("showUploadErrorMsg"), P = s("bucket"), K = s("showDownload") ?? !0, w = s("showPreview") ?? !0, r = s("value"), c = [], h = s("needName"), m = te(null);
20
+ ), { t: i } = Ne(), { b: O } = Ue("ap-upload-multiple-file"), V = ve("ap-upload"), { put: q } = he(), j = s("dirName"), $ = s("baseDirName"), b = s("accept") || "*", _ = s("maxSize") ?? 500, G = s("title") || i("ap.apUpload.uploadFile"), f = s("subTitle"), l = s("maxCount") ?? 10, m = s("uploadingCount"), F = s("beforeUpload"), A = s("customRequest"), g = s("getOssAccess"), W = s("maxSizeErrorMsg"), H = s("maxCountErrorMsg"), J = s("acceptErrorMsg"), P = s("onRemove"), C = s("showUploadErrorMsg"), T = s("bucket"), K = s("showDownload") ?? !0, w = s("showPreview") ?? !0, r = s("value"), c = [], h = s("needName"), d = te(null);
20
21
  se(
21
22
  () => r?.value,
22
23
  function(e) {
23
- !m?.value?.fileList?.length && e && T(e);
24
+ !d?.value?.fileList?.length && e && I(e);
24
25
  },
25
26
  { immediate: !0 }
26
27
  );
27
- function T(e) {
28
+ function I(e) {
28
29
  if (!e) {
29
- u = [], m.value.fileList = [], r.value = void 0, c.splice(0, c.length);
30
+ u = [], d.value.fileList = [], r.value = void 0, c.splice(0, c.length);
30
31
  return;
31
32
  }
32
33
  ae(() => {
33
34
  const o = e.map((t) => {
34
- const n = ye(h, t), D = ke(h, t), x = new File(
35
+ const n = ke(h, t), M = be(h, t), x = new File(
35
36
  [t],
36
- D,
37
+ M,
37
38
  {}
38
39
  );
39
- return x.response = n, x.uid = crypto.randomUUID(), x.status = "done", x;
40
+ return x.response = n, x.uid = we(18), x.status = "done", x;
40
41
  });
41
42
  if (l && o.length > l) {
42
43
  p.warning(
@@ -51,17 +52,17 @@ const Ne = { class: "multiple-file-context" }, Ee = { key: 0 }, _e = { key: 1 },
51
52
  uid: t.uid,
52
53
  path: t.response
53
54
  });
54
- }), m.value.fileList = o, r.value = e;
55
+ }), d.value.fileList = o, r.value = e;
55
56
  });
56
57
  }
57
- B({ setValue: T });
58
+ B({ setValue: I });
58
59
  let u = [], R;
59
60
  function v(e) {
60
61
  setTimeout(() => {
61
- const o = m.value.fileList.findIndex(
62
+ const o = d.value.fileList.findIndex(
62
63
  (t) => t.uid === e.uid
63
64
  );
64
- o >= 0 && m.value.fileList.splice(o, 1);
65
+ o >= 0 && d.value.fileList.splice(o, 1);
65
66
  });
66
67
  }
67
68
  async function Q(e) {
@@ -79,7 +80,7 @@ const Ne = { class: "multiple-file-context" }, Ee = { key: 0 }, _e = { key: 1 },
79
80
  maxSize: _
80
81
  })
81
82
  ), v(e), !1;
82
- if (!ve(e, b))
83
+ if (!xe(e, b))
83
84
  return p.warning(
84
85
  J || i("ap.apUpload.fileFormatNotSupported")
85
86
  ), v(e), !1;
@@ -88,7 +89,7 @@ const Ne = { class: "multiple-file-context" }, Ee = { key: 0 }, _e = { key: 1 },
88
89
  l && l === 1 && (u = [], r.value = void 0), u.push(e);
89
90
  }
90
91
  async function X(e) {
91
- if (d.value++, typeof A == "function") {
92
+ if (m.value++, typeof A == "function") {
92
93
  A({
93
94
  onProgress: (o) => {
94
95
  setTimeout(() => {
@@ -103,7 +104,7 @@ const Ne = { class: "multiple-file-context" }, Ee = { key: 0 }, _e = { key: 1 },
103
104
  name: o,
104
105
  message: o
105
106
  });
106
- }), d.value--;
107
+ }), m.value--;
107
108
  },
108
109
  onSuccess: (o) => {
109
110
  setTimeout(() => {
@@ -114,14 +115,14 @@ const Ne = { class: "multiple-file-context" }, Ee = { key: 0 }, _e = { key: 1 },
114
115
  ], c.push({
115
116
  uid: e.file.uid,
116
117
  path: o
117
- }), d.value--;
118
+ }), m.value--;
118
119
  },
119
120
  file: e.file
120
121
  });
121
122
  return;
122
123
  }
123
124
  try {
124
- const o = await (P ? g(P) : g()), t = await S(async () => o);
125
+ const o = await (T ? g(T) : g()), t = await L(async () => o);
125
126
  e.file.oss = t, q({
126
127
  file: e.file,
127
128
  dirName: j,
@@ -133,13 +134,13 @@ const Ne = { class: "multiple-file-context" }, Ee = { key: 0 }, _e = { key: 1 },
133
134
  ], c.push({
134
135
  uid: e.file.uid,
135
136
  path: n
136
- }), d.value--;
137
+ }), m.value--;
137
138
  },
138
139
  errorCallBack(n) {
139
140
  C && p.warning(n || i("ap.apUpload.networkAnomaly")), e.onError({
140
141
  name: n,
141
142
  message: n
142
- }), d.value--;
143
+ }), m.value--;
143
144
  },
144
145
  progressCallBack(n) {
145
146
  e.onProgress({
@@ -155,11 +156,11 @@ const Ne = { class: "multiple-file-context" }, Ee = { key: 0 }, _e = { key: 1 },
155
156
  ), e.onError({
156
157
  name: o?.message || i("ap.apUpload.networkAnomaly"),
157
158
  message: o?.message || i("ap.apUpload.networkAnomaly")
158
- }), d.value--;
159
+ }), m.value--;
159
160
  }
160
161
  }
161
162
  function Y(e) {
162
- if (I && I?.(e), e.response) {
163
+ if (P && P?.(e), e.response) {
163
164
  if (Array.isArray(r.value)) {
164
165
  const t = c.findIndex((n) => n.uid === e.uid);
165
166
  t >= 0 && (r?.value.splice(t, 1), c.splice(t, 1)), r.value.length === 0 && (r.value = void 0);
@@ -180,7 +181,7 @@ const Ne = { class: "multiple-file-context" }, Ee = { key: 0 }, _e = { key: 1 },
180
181
  E.value?.trigger?.(o);
181
182
  } else {
182
183
  const o = e.response?.match(/^([^:]+):(.*)$/), t = o?.[1], n = o?.[2] ?? e.response;
183
- (await S(
184
+ (await L(
184
185
  () => t ? g?.(t) : g?.()
185
186
  )).downloadFile([
186
187
  {
@@ -195,15 +196,15 @@ const Ne = { class: "multiple-file-context" }, Ee = { key: 0 }, _e = { key: 1 },
195
196
  fileName: e.name
196
197
  });
197
198
  };
198
- return (e, o) => (y(), U("div", {
199
+ return (e, o) => (y(), N("div", {
199
200
  class: ne({
200
201
  [a(O)()]: !0,
201
202
  [a(V) ?? ""]: !0
202
203
  })
203
204
  }, [
204
- k(a(de), {
205
+ k(a(me), {
205
206
  ref_key: "uploadRef",
206
- ref: m,
207
+ ref: d,
207
208
  accept: a(b),
208
209
  multiple: "",
209
210
  "max-count": a(l),
@@ -223,24 +224,24 @@ const Ne = { class: "multiple-file-context" }, Ee = { key: 0 }, _e = { key: 1 },
223
224
  onRemove: Y,
224
225
  onDownload: Z
225
226
  }, {
226
- downloadIcon: N(() => [
227
+ downloadIcon: U(() => [
227
228
  k(a(fe), { class: "anticon anticon-vertical-align-bottom" })
228
229
  ]),
229
- default: N(() => [
230
- M("div", Ne, [
231
- k(a(me), { class: "file-btn" }, {
232
- default: N(() => [
230
+ default: U(() => [
231
+ S("div", Ee, [
232
+ k(a(de), { class: "file-btn" }, {
233
+ default: U(() => [
233
234
  k(a(pe)),
234
- re(" " + L(a(G)), 1)
235
+ re(" " + D(a(G)), 1)
235
236
  ]),
236
237
  _: 1
237
238
  }),
238
- M("div", {
239
+ S("div", {
239
240
  class: "sub-title",
240
241
  onClick: o[0] || (o[0] = ie(() => {
241
242
  }, ["stop"]))
242
243
  }, [
243
- typeof a(f) == "string" ? (y(), U("div", Ee, L(a(f) || `${a(i)("ap.apUpload.supportExtension")}:${a(xe)(a(b))}`), 1)) : a(f) ? (y(), U("div", _e, [
244
+ typeof a(f) == "string" ? (y(), N("div", _e, D(a(f) || `${a(i)("ap.apUpload.supportExtension")}:${a(ye)(a(b))}`), 1)) : a(f) ? (y(), N("div", Fe, [
244
245
  (y(), ce(ue(a(f))))
245
246
  ])) : le("", !0)
246
247
  ])
@@ -252,5 +253,5 @@ const Ne = { class: "multiple-file-context" }, Ee = { key: 0 }, _e = { key: 1 },
252
253
  }
253
254
  });
254
255
  export {
255
- qe as default
256
+ $e as default
256
257
  };