@aplus-frontend/ui 7.19.0-beta.2 → 7.19.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,8 +1,8 @@
1
1
  import { useToken as G } from "@aplus-frontend/antdv/es/theme/internal";
2
- import { isBoolean as P, isNumber as S, isObject as b, mergeWith as z, omit as R, isString as U } from "lodash-unified";
3
- import { ref as y, watch as d, unref as v } from "vue";
2
+ import { isBoolean as P, isNumber as b, isObject as y, mergeWith as E, omit as R, isString as U } from "lodash-unified";
3
+ import { ref as k, watch as d, unref as v } from "vue";
4
4
  import "../../config-provider/index.mjs";
5
- import { randomStr as E } from "../../utils/index.mjs";
5
+ import { randomStr as N } from "../../utils/index.mjs";
6
6
  import { getColumnStateString as W } from "../components/setting/utils.mjs";
7
7
  import { useInjectApTable as X } from "../context.mjs";
8
8
  import { getTableTitle as q } from "../utils.mjs";
@@ -11,16 +11,16 @@ import { useNamespace as H } from "../../config-provider/hooks/use-namespace.mjs
11
11
  function Q(r, e, o, a) {
12
12
  return a ? a.fixed : e ? e.fixed : o && "fixed" in o ? o.fixed : P(r.fixed) ? r.fixed ? "left" : void 0 : r.fixed;
13
13
  }
14
- const k = Number.MAX_SAFE_INTEGER, A = E();
14
+ const A = Number.MAX_SAFE_INTEGER, I = N();
15
15
  function V(r, e) {
16
- const o = S(r.order) ? r.order : k;
17
- let a = S(e.order) ? e.order : k;
16
+ const o = b(r.order) ? r.order : A;
17
+ let a = b(e.order) ? e.order : A;
18
18
  return r.fixed === "right" && e.fixed !== "right" && (a = o - 1), e.fixed === "left" && r.fixed !== "left" && (a = o - 1), o - a;
19
19
  }
20
20
  function Y(r, e) {
21
21
  e && r.removeItem(e);
22
22
  }
23
- function I(r, e) {
23
+ function z(r, e) {
24
24
  if (!e)
25
25
  return [];
26
26
  const o = r.getItem(e);
@@ -29,29 +29,30 @@ function I(r, e) {
29
29
  const a = JSON.parse(o);
30
30
  return Array.isArray(a) ? a : (Y(r, e), []);
31
31
  }
32
- function N(r, e) {
33
- if (b(r) && b(e))
34
- return z({}, r, e, N);
32
+ function _(r, e) {
33
+ if (y(r) && y(e))
34
+ return E({}, r, e, _);
35
35
  }
36
36
  const ue = (r, e, o) => {
37
- const { columnsBackup: a, size: s } = X(), { t: _ } = D(), { be: L } = H("ap-table"), [Z, O] = G(), c = y(), n = y([]), B = d(
37
+ const { columnsBackup: a, size: s } = X(), { t: L } = D(), { be: O } = H("ap-table"), [Z, B] = G(), m = k(), n = k([]);
38
+ let g;
39
+ g = d(
38
40
  () => a?.value,
39
41
  (t, i) => {
40
- t?.length && !i?.length && (n.value = g(
41
- I(localStorage, v(e))
42
- ), B?.());
42
+ t?.length && !i?.length && (n.value = T(
43
+ z(localStorage, v(e))
44
+ ), g?.());
43
45
  },
44
46
  {
45
47
  immediate: !0
46
48
  }
47
- );
48
- d(
49
+ ), d(
49
50
  [a, s],
50
51
  ([t, i]) => {
51
- t && (c.value = {
52
+ t && (m.value = {
52
53
  label: "basic_template",
53
54
  columnState: f(t),
54
- key: A,
55
+ key: I,
55
56
  size: i
56
57
  });
57
58
  },
@@ -59,18 +60,18 @@ const ue = (r, e, o) => {
59
60
  ), d(
60
61
  () => e.value,
61
62
  (t) => {
62
- const i = g(
63
- I(localStorage, t)
63
+ const i = T(
64
+ z(localStorage, t)
64
65
  );
65
- n.value = i, c.value = {
66
+ n.value = i, m.value = {
66
67
  label: "basic_template",
67
68
  columnState: f(a?.value || []),
68
- key: A,
69
+ key: I,
69
70
  size: s?.value
70
71
  }, o(i ?? []);
71
72
  }
72
73
  );
73
- function g(t) {
74
+ function T(t) {
74
75
  return t.length ? t.map((i) => ({
75
76
  ...i,
76
77
  columnState: f(
@@ -80,29 +81,29 @@ const ue = (r, e, o) => {
80
81
  )
81
82
  })) : [
82
83
  {
83
- label: _("ap.apTable.setting.defaultTemplate"),
84
- key: r.getActiveKey?.("DEFAULT_TEMPLATE") ?? E(),
84
+ label: L("ap.apTable.setting.defaultTemplate"),
85
+ key: r.getActiveKey?.("DEFAULT_TEMPLATE") ?? N(),
85
86
  size: s?.value,
86
87
  columnState: f(a?.value || [])
87
88
  }
88
89
  ];
89
90
  }
90
91
  function f(t, i = {}, l = !0) {
91
- const m = z(
92
+ const c = E(
92
93
  {},
93
94
  l ? r.defaultValue || {} : {},
94
95
  i,
95
- N
96
+ _
96
97
  );
97
- function x(M, j, C) {
98
+ function h(M, j, C) {
98
99
  return M.map((u) => {
99
- const h = j?.[u.key] || {}, p = {
100
+ const S = j?.[u.key] || {}, p = {
100
101
  key: u.key,
101
102
  label: U(u.title) ? q(
102
103
  u,
103
- L("table-header", "title"),
104
+ O("table-header", "title"),
104
105
  void 0,
105
- O.value.colorTextTertiary
106
+ B.value.colorTextTertiary
106
107
  ) : u.title,
107
108
  show: !0,
108
109
  fixed: Q(
@@ -112,18 +113,18 @@ const ue = (r, e, o) => {
112
113
  C
113
114
  ),
114
115
  disabled: !1,
115
- ...R(h, ["children", "fixed"])
116
+ ...R(S, ["children", "fixed"])
116
117
  };
117
- return p.children = u.children?.length ? x(
118
+ return p.children = u.children?.length ? h(
118
119
  u.children,
119
- h.children,
120
+ S.children,
120
121
  p
121
122
  ) : void 0, p;
122
123
  }).sort(V);
123
124
  }
124
- return x(t || [], m);
125
+ return h(t || [], c);
125
126
  }
126
- function T(t) {
127
+ function x(t) {
127
128
  if (v(e)) {
128
129
  const i = t.map((l) => ({
129
130
  ...l,
@@ -143,7 +144,7 @@ const ue = (r, e, o) => {
143
144
  }
144
145
  function J(t, i) {
145
146
  const l = n.value.findIndex(
146
- (m) => m.key === t
147
+ (c) => c.key === t
147
148
  );
148
149
  return n.value[l] = {
149
150
  ...n.value[l],
@@ -153,13 +154,13 @@ const ue = (r, e, o) => {
153
154
  return d(
154
155
  () => n.value,
155
156
  (t) => {
156
- t.length && T(t);
157
+ t.length && x(t);
157
158
  },
158
159
  { deep: !0, immediate: !0 }
159
160
  ), {
160
- basicTemplate: c,
161
+ basicTemplate: m,
161
162
  customizeTemplateList: n,
162
- syncTemplateListToStorage: T,
163
+ syncTemplateListToStorage: x,
163
164
  addTemplate: F,
164
165
  deleteTemplate: w,
165
166
  updateTemplate: J
@@ -1,96 +1,96 @@
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
- import { UploadOutlined as pe } from "@ant-design/icons-vue";
3
- import { message as p, Upload as me, Button as de } from "@aplus-frontend/antdv";
4
- import { IconApAdLineDownload as fe } from "@aplus-frontend/icon";
5
- import { ApFilePreview as ge } from "../../ap-file-preview/index.mjs";
1
+ import { defineComponent as ne, inject as s, ref as re, watch as ie, nextTick as le, createElementBlock as N, openBlock as g, normalizeClass as ce, unref as a, createVNode as h, withCtx as w, createElementVNode as D, createTextVNode as L, toDisplayString as U, withModifiers as ue, createCommentVNode as pe, createBlock as z, resolveDynamicComponent as B, createSlots as de } from "vue";
2
+ import { UploadOutlined as me } from "@ant-design/icons-vue";
3
+ import { message as d, Upload as fe, Button as we, Tooltip as ge } from "@aplus-frontend/antdv";
4
+ import { IconApAdLineDownload as he } from "@aplus-frontend/icon";
5
+ import { ApFilePreview as ve } from "../../ap-file-preview/index.mjs";
6
6
  import "../../../config-provider/index.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";
14
- import { useNamespace as Ue } from "../../../config-provider/hooks/use-namespace.mjs";
15
- const Ee = { class: "multiple-file-context" }, _e = { key: 0 }, Fe = { key: 1 }, $e = /* @__PURE__ */ oe({
7
+ import { randomStr as xe } from "../../../utils/index.mjs";
8
+ import { useOss as ye, getOssInstance as O } from "../hooks/useOss.mjs";
9
+ import ke from "../style/index.mjs";
10
+ import { fileMatchesAccept as be, getAcceptText as Ce } from "../utils/accept.mjs";
11
+ import { getPath as _e, getName as Ne, getReturnData as V } from "../utils/returnData.mjs";
12
+ import { useGlobalConfig as Ue } from "../../../config-provider/hooks/use-global-config.mjs";
13
+ import { useLocale as Ee } from "../../../config-provider/hooks/use-locale.mjs";
14
+ import { useNamespace as Fe } from "../../../config-provider/hooks/use-namespace.mjs";
15
+ const Ae = { class: "multiple-file-context" }, Te = { key: 0 }, Pe = { key: 1 }, He = /* @__PURE__ */ ne({
16
16
  __name: "MultipleFile",
17
- setup(Ae, { expose: B }) {
18
- const E = Ce(
17
+ setup(Re, { expose: q }) {
18
+ const E = Ue(
19
19
  "downloadCenterTriggerConfig"
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);
21
- se(
22
- () => r?.value,
20
+ ), { t: r } = Ee(), { b: j } = Fe("ap-upload-multiple-file"), $ = ke("ap-upload"), { put: G } = ye(), W = s("dirName"), H = s("baseDirName"), C = s("accept") || "*", F = s("maxSize") ?? 500, J = s("title") || r("ap.apUpload.uploadFile"), v = s("subTitle"), l = s("maxCount") ?? 10, m = s("uploadingCount"), A = s("beforeUpload"), T = s("customRequest"), x = s("getOssAccess"), K = s("maxSizeErrorMsg"), Q = s("maxCountErrorMsg"), X = s("acceptErrorMsg"), P = s("onRemove"), _ = s("showUploadErrorMsg"), R = s("bucket"), Y = s("showDownload") ?? !0, c = s("showPreview") ?? !0, i = s("value"), u = [], y = s("needName"), f = re(null);
21
+ ie(
22
+ () => i?.value,
23
23
  function(e) {
24
- !d?.value?.fileList?.length && e && I(e);
24
+ !f?.value?.fileList?.length && e && I(e);
25
25
  },
26
26
  { immediate: !0 }
27
27
  );
28
28
  function I(e) {
29
29
  if (!e) {
30
- u = [], d.value.fileList = [], r.value = void 0, c.splice(0, c.length);
30
+ p = [], f.value.fileList = [], i.value = void 0, u.splice(0, u.length);
31
31
  return;
32
32
  }
33
- ae(() => {
33
+ le(() => {
34
34
  const o = e.map((t) => {
35
- const n = ke(h, t), M = be(h, t), x = new File(
35
+ const n = _e(y, t), M = Ne(y, t), b = new File(
36
36
  [t],
37
37
  M,
38
38
  {}
39
39
  );
40
- return x.response = n, x.uid = we(18), x.status = "done", x;
40
+ return b.response = n, b.uid = xe(18), b.status = "done", b;
41
41
  });
42
42
  if (l && o.length > l) {
43
- p.warning(
44
- i("ap.apUpload.fileInitializationException", {
43
+ d.warning(
44
+ r("ap.apUpload.fileInitializationException", {
45
45
  maxCount: l
46
46
  })
47
47
  );
48
48
  return;
49
49
  }
50
50
  o.forEach((t) => {
51
- u.push(t), c.push({
51
+ p.push(t), u.push({
52
52
  uid: t.uid,
53
53
  path: t.response
54
54
  });
55
- }), d.value.fileList = o, r.value = e;
55
+ }), f.value.fileList = o, i.value = e;
56
56
  });
57
57
  }
58
- B({ setValue: I });
59
- let u = [], R;
60
- function v(e) {
58
+ q({ setValue: I });
59
+ let p = [], S;
60
+ function k(e) {
61
61
  setTimeout(() => {
62
- const o = d.value.fileList.findIndex(
62
+ const o = f.value.fileList.findIndex(
63
63
  (t) => t.uid === e.uid
64
64
  );
65
- o >= 0 && d.value.fileList.splice(o, 1);
65
+ o >= 0 && f.value.fileList.splice(o, 1);
66
66
  });
67
67
  }
68
- async function Q(e) {
69
- if (l && l > 1 && u.length >= l)
70
- return clearTimeout(R), R = setTimeout(() => {
71
- p.warning(
72
- H || i("ap.apUpload.maxUploadFiles", {
68
+ async function Z(e) {
69
+ if (l && l > 1 && p.length >= l)
70
+ return clearTimeout(S), S = setTimeout(() => {
71
+ d.warning(
72
+ Q || r("ap.apUpload.maxUploadFiles", {
73
73
  maxCount: l
74
74
  })
75
75
  );
76
- }), v(e), !1;
77
- if (e.size > _ * 1024 * 1024)
78
- return p.warning(
79
- W || i("ap.apUpload.maxUploadFileSize", {
80
- maxSize: _
76
+ }), k(e), !1;
77
+ if (e.size > F * 1024 * 1024)
78
+ return d.warning(
79
+ K || r("ap.apUpload.maxUploadFileSize", {
80
+ maxSize: F
81
81
  })
82
- ), v(e), !1;
83
- if (!xe(e, b))
84
- return p.warning(
85
- J || i("ap.apUpload.fileFormatNotSupported")
86
- ), v(e), !1;
87
- if (typeof F == "function" && await F(e) === !1)
88
- return v(e), !1;
89
- l && l === 1 && (u = [], r.value = void 0), u.push(e);
82
+ ), k(e), !1;
83
+ if (!be(e, C))
84
+ return d.warning(
85
+ X || r("ap.apUpload.fileFormatNotSupported")
86
+ ), k(e), !1;
87
+ if (typeof A == "function" && await A(e) === !1)
88
+ return k(e), !1;
89
+ l && l === 1 && (p = [], i.value = void 0), p.push(e);
90
90
  }
91
- async function X(e) {
92
- if (m.value++, typeof A == "function") {
93
- A({
91
+ async function ee(e) {
92
+ if (m.value++, typeof T == "function") {
93
+ T({
94
94
  onProgress: (o) => {
95
95
  setTimeout(() => {
96
96
  e.onProgress({
@@ -99,7 +99,7 @@ const Ee = { class: "multiple-file-context" }, _e = { key: 0 }, Fe = { key: 1 },
99
99
  });
100
100
  },
101
101
  onError: (o) => {
102
- C && p.warning(o || i("ap.apUpload.networkAnomaly")), setTimeout(() => {
102
+ _ && d.warning(o || r("ap.apUpload.networkAnomaly")), setTimeout(() => {
103
103
  e.onError({
104
104
  name: o,
105
105
  message: o
@@ -109,10 +109,10 @@ const Ee = { class: "multiple-file-context" }, _e = { key: 0 }, Fe = { key: 1 },
109
109
  onSuccess: (o) => {
110
110
  setTimeout(() => {
111
111
  e.onSuccess(o);
112
- }), r.value = [
113
- ...r.value || [],
114
- z(h, o, e.file.name)
115
- ], c.push({
112
+ }), i.value = [
113
+ ...i.value || [],
114
+ V(y, o, e.file.name)
115
+ ], u.push({
116
116
  uid: e.file.uid,
117
117
  path: o
118
118
  }), m.value--;
@@ -122,22 +122,22 @@ const Ee = { class: "multiple-file-context" }, _e = { key: 0 }, Fe = { key: 1 },
122
122
  return;
123
123
  }
124
124
  try {
125
- const o = await (T ? g(T) : g()), t = await L(async () => o);
126
- e.file.oss = t, q({
125
+ const o = await (R ? x(R) : x()), t = await O(async () => o);
126
+ e.file.oss = t, G({
127
127
  file: e.file,
128
- dirName: j,
128
+ dirName: W,
129
129
  oss: t,
130
130
  successCallBack(n) {
131
- e.onSuccess(n), r.value = [
132
- ...r.value || [],
133
- z(h, n, e.file.name)
134
- ], c.push({
131
+ e.onSuccess(n), i.value = [
132
+ ...i.value || [],
133
+ V(y, n, e.file.name)
134
+ ], u.push({
135
135
  uid: e.file.uid,
136
136
  path: n
137
137
  }), m.value--;
138
138
  },
139
139
  errorCallBack(n) {
140
- C && p.warning(n || i("ap.apUpload.networkAnomaly")), e.onError({
140
+ _ && d.warning(n || r("ap.apUpload.networkAnomaly")), e.onError({
141
141
  name: n,
142
142
  message: n
143
143
  }), m.value--;
@@ -147,32 +147,32 @@ const Ee = { class: "multiple-file-context" }, _e = { key: 0 }, Fe = { key: 1 },
147
147
  percent: n
148
148
  });
149
149
  },
150
- baseDirName: $,
150
+ baseDirName: H,
151
151
  bucket: o?.bucket
152
152
  });
153
153
  } catch (o) {
154
- C && p.warning(
155
- typeof o?.message == "string" ? o.message : i("ap.apUpload.networkAnomaly")
154
+ _ && d.warning(
155
+ typeof o?.message == "string" ? o.message : r("ap.apUpload.networkAnomaly")
156
156
  ), e.onError({
157
- name: o?.message || i("ap.apUpload.networkAnomaly"),
158
- message: o?.message || i("ap.apUpload.networkAnomaly")
157
+ name: o?.message || r("ap.apUpload.networkAnomaly"),
158
+ message: o?.message || r("ap.apUpload.networkAnomaly")
159
159
  }), m.value--;
160
160
  }
161
161
  }
162
- function Y(e) {
162
+ function oe(e) {
163
163
  if (P && P?.(e), e.response) {
164
- if (Array.isArray(r.value)) {
165
- const t = c.findIndex((n) => n.uid === e.uid);
166
- t >= 0 && (r?.value.splice(t, 1), c.splice(t, 1)), r.value.length === 0 && (r.value = void 0);
164
+ if (Array.isArray(i.value)) {
165
+ const t = u.findIndex((n) => n.uid === e.uid);
166
+ t >= 0 && (i?.value.splice(t, 1), u.splice(t, 1)), i.value.length === 0 && (i.value = void 0);
167
167
  }
168
168
  } else
169
169
  e?.oss?.pauseUpload();
170
- const o = u.findIndex(
170
+ const o = p.findIndex(
171
171
  (t) => t.uid === e.uid
172
172
  );
173
- return u.splice(o, 1), Promise.resolve(!0);
173
+ return p.splice(o, 1), Promise.resolve(!0);
174
174
  }
175
- const Z = async (e) => {
175
+ const te = async (e) => {
176
176
  if (E.value?.trigger) {
177
177
  let o = [e].map((t) => ({
178
178
  objectName: t.response,
@@ -181,8 +181,8 @@ const Ee = { class: "multiple-file-context" }, _e = { key: 0 }, Fe = { key: 1 },
181
181
  E.value?.trigger?.(o);
182
182
  } else {
183
183
  const o = e.response?.match(/^([^:]+):(.*)$/), t = o?.[1], n = o?.[2] ?? e.response;
184
- (await L(
185
- () => t ? g?.(t) : g?.()
184
+ (await O(
185
+ () => t ? x?.(t) : x?.()
186
186
  )).downloadFile([
187
187
  {
188
188
  path: n,
@@ -190,22 +190,22 @@ const Ee = { class: "multiple-file-context" }, _e = { key: 0 }, Fe = { key: 1 },
190
190
  }
191
191
  ]);
192
192
  }
193
- }, ee = (e) => {
194
- (typeof w == "function" ? w(e) : w) && ge.createFilePreviewModal({
193
+ }, se = (e) => {
194
+ (typeof c == "function" ? c(e) : c) && ve.createFilePreviewModal({
195
195
  src: e.response,
196
196
  fileName: e.name
197
197
  });
198
- };
199
- return (e, o) => (y(), N("div", {
200
- class: ne({
201
- [a(O)()]: !0,
202
- [a(V) ?? ""]: !0
198
+ }, ae = (e) => (typeof c == "function" ? c(e) : c) ? ["done"].includes(e.status) : !1;
199
+ return (e, o) => (g(), N("div", {
200
+ class: ce({
201
+ [a(j)()]: !0,
202
+ [a($) ?? ""]: !0
203
203
  })
204
204
  }, [
205
- k(a(me), {
205
+ h(a(fe), {
206
206
  ref_key: "uploadRef",
207
- ref: d,
208
- accept: a(b),
207
+ ref: f,
208
+ accept: a(C),
209
209
  multiple: "",
210
210
  "max-count": a(l),
211
211
  progress: {
@@ -213,37 +213,53 @@ const Ee = { class: "multiple-file-context" }, _e = { key: 0 }, Fe = { key: 1 },
213
213
  showInfo: !1,
214
214
  strokeColor: "#0070FF"
215
215
  },
216
- "before-upload": Q,
217
- "custom-request": X,
216
+ "before-upload": Z,
217
+ "custom-request": ee,
218
218
  "show-upload-list": {
219
- showDownloadIcon: a(K),
219
+ showDownloadIcon: a(Y),
220
220
  showRemoveIcon: !0,
221
- showPreviewIcon: a(w)
221
+ showPreviewIcon: a(c)
222
222
  },
223
- onPreview: ee,
224
- onRemove: Y,
225
- onDownload: Z
223
+ onPreview: se,
224
+ onRemove: oe,
225
+ onDownload: te
226
226
  }, {
227
- downloadIcon: U(() => [
228
- k(a(fe), { class: "anticon anticon-vertical-align-bottom" })
227
+ downloadIcon: w(() => [
228
+ h(a(he), { class: "anticon anticon-vertical-align-bottom" })
229
229
  ]),
230
- default: U(() => [
231
- S("div", Ee, [
232
- k(a(de), { class: "file-btn" }, {
233
- default: U(() => [
234
- k(a(pe)),
235
- re(" " + D(a(G)), 1)
230
+ itemRender: w(({ originNode: t, file: n }) => [
231
+ h(a(ge), null, de({
232
+ default: w(() => [
233
+ (g(), z(B(t)))
234
+ ]),
235
+ _: 2
236
+ }, [
237
+ ae(n) ? {
238
+ name: "title",
239
+ fn: w(() => [
240
+ L(U(a(r)("ap.apAppendix.previewFile")), 1)
241
+ ]),
242
+ key: "0"
243
+ } : void 0
244
+ ]), 1024)
245
+ ]),
246
+ default: w(() => [
247
+ D("div", Ae, [
248
+ h(a(we), { class: "file-btn" }, {
249
+ default: w(() => [
250
+ h(a(me)),
251
+ L(" " + U(a(J)), 1)
236
252
  ]),
237
253
  _: 1
238
254
  }),
239
- S("div", {
255
+ D("div", {
240
256
  class: "sub-title",
241
- onClick: o[0] || (o[0] = ie(() => {
257
+ onClick: o[0] || (o[0] = ue(() => {
242
258
  }, ["stop"]))
243
259
  }, [
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, [
245
- (y(), ce(ue(a(f))))
246
- ])) : le("", !0)
260
+ typeof a(v) == "string" ? (g(), N("div", Te, U(a(v) || `${a(r)("ap.apUpload.supportExtension")}:${a(Ce)(a(C))}`), 1)) : a(v) ? (g(), N("div", Pe, [
261
+ (g(), z(B(a(v))))
262
+ ])) : pe("", !0)
247
263
  ])
248
264
  ])
249
265
  ]),
@@ -253,5 +269,5 @@ const Ee = { class: "multiple-file-context" }, _e = { key: 0 }, Fe = { key: 1 },
253
269
  }
254
270
  });
255
271
  export {
256
- $e as default
272
+ He as default
257
273
  };
@@ -1,2 +1,2 @@
1
- declare const _default: "7.19.0-beta.2";
1
+ declare const _default: "7.19.1";
2
2
  export default _default;
@@ -1,4 +1,4 @@
1
- const e = "7.19.0-beta.2";
1
+ const e = "7.19.1";
2
2
  export {
3
3
  e as default
4
4
  };
@@ -1 +1 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const o=require("vue"),r=require("lodash-unified"),w=require("../../ap-form/index.js"),k=require("../../ap-form/context.js"),A=require("../../ap-form/hooks/use-watch.js"),P=require("../../ap-form/utils/get.js"),z=require("../../ap-form/utils/transform.js");require("../../config-provider/index.js");const H=require("../hooks/use-editable-columns.js"),K=require("../hooks/use-editable-form-item-api.js");require("../index.vue2.js");const G=require("../style/editable.js"),L=require("../utils.js"),m=require("./utils.js"),W=require("../../config-provider/hooks/use-namespace.js"),U=require("../../config-provider/hooks/use-global-config.js"),$=require("../index.vue.js"),J=o.defineComponent({name:"EditableGrid",__name:"form-item",props:{dropdownPrefixCls:{},bordered:{type:Boolean},locale:{},onResizeColumn:{},getPopupContainer:{},scroll:{},sortDirections:{},showSorterTooltip:{type:[Boolean,Object]},prefixCls:{},rowKey:{type:[String,Function],default:"key"},tableLayout:{},title:{},id:{},showHeader:{type:Boolean},components:{},customHeaderRow:{},direction:{},expandFixed:{type:[String,Boolean]},expandColumnWidth:{},expandedRowKeys:{},defaultExpandedRowKeys:{},expandedRowRender:{},expandRowByClick:{type:Boolean},expandIcon:{},onExpand:{},onExpandedRowsChange:{},defaultExpandAllRows:{type:Boolean},indentSize:{},expandIconColumnIndex:{},showExpandColumn:{type:Boolean},expandedRowClassName:{},childrenColumnName:{},rowExpandable:{},transformCellText:{},rowHoverable:{type:Boolean},rowSelection:{type:[Boolean,Object]},onLoadingChange:{},onShownColumnsChange:{},pagination:{type:[Boolean,Object],default:!1},searchFormWrapperStyle:{},tableWrapperStyle:{},wrapperStyle:{},tableStyle:{},adaptive:{type:Boolean},columnResizable:{type:Boolean,default:!1},loading:{type:Boolean,default:void 0},summary:{},rowHeight:{default:66},getRowHeight:{},advanceRenderer:{type:Boolean},browserTooltips:{type:Boolean},virtual:{type:[Boolean,Object],default:void 0},onRowClicked:{},onScrollEnd:{},rowClassName:{},rowClassRules:{},autoHeight:{type:Boolean},onUpdate:{},customRow:{},theme:{},emptyComponent:{},emptyText:{},onColumnResized:{},animateRows:{type:Boolean},plugins:{},columns:{},defaultValue:{},onChange:{},maxLength:{},onFieldChange:{},label:{},name:{},formItem:{}},setup(y,{expose:h}){const b=o.useSlots(),t=y,{b:C}=W.useNamespace("editable-aggrid"),R=G.default("editable-aggrid"),s=o.ref(),{internalInstance:u}=k.useInjectForm();function v(e){const n=m.getColumnTransformOptions(t.columns||[]);if(!Object.keys(n).length||!e?.length)return e;let a=[];for(const d of e)a.push(z.transformValues(d,n));return a}const i=L.getShadowName(t.name);let p=[];o.onMounted(()=>{const e=t.formItem?.initialValue??P.getModelValue(u?.getInitialValues()??{},t.name);e&&(u?.updateInitialModel(i,m.arrayToObject(r.cloneDeep(e),t.rowKey)),p=r.cloneDeep(e),l.value||_(r.cloneDeep(e),"suffix",!0))});const l=o.ref([]),x=A.useWatch(t.name);o.watch(()=>x.value,e=>{r.isEqual(e,l.value)||f(e??r.cloneDeep(p))},{deep:!0,flush:"post",immediate:!0});const B=U.useGlobalConfig("valueTypeMap"),q=H.useGetEditableColumns(t,B,i),{add:I,addMultiple:S,__addMultiple:_,remove:T,removeByKey:E,getRowData:F,getRowsData:N,setRowData:V,clear:j,refreshRowIds:c}=K.useEditableFormItemApi(t,u,l,i);function D(){const e=s.value?._internalGridApi;if(!c.value?.length||!e)return;const n=c.value.map(a=>e.getRowNode(a)).filter(a=>!!a);e.refreshCells({rowNodes:n,force:!0}),c.value=[]}function f(e){l.value=[...e];const n=m.arrayToObject(e,t.rowKey);u?.setFieldValue(t.name,[...e]),u?.setFieldValue(i,n)}function g(e,n){const a=e==="end"?l.value.length-1:e;s.value?.scrollToRow(a,n)}function O(e,n){s.value?.scrollToColumn(e,n)}return h({add:I,addMultiple:S,remove:T,removeByKey:E,getRowData:F,getRowsData:N,setRowData:V,clear:j,setTableData:f,scrollTo:g,scrollToRow:g,scrollToColumn:O,table:s}),(e,n)=>(o.openBlock(),o.createElementBlock(o.Fragment,null,[o.createVNode(o.unref(w.ApForm).FormItem,{hidden:"",name:e.name,"initial-value":e.formItem?.initialValue,transform:v},null,8,["name","initial-value"]),o.createVNode(o.unref(w.ApForm).FormItem,o.mergeProps({label:e.label},e.formItem),{default:o.withCtx(()=>[o.createVNode($.default,o.mergeProps(o.unref(r.omit)(t,["name","maxLength","onChange","defaultValue","formItem"]),{ref_key:"tableRef",ref:s,class:[o.unref(C)(),o.unref(R)],size:"mini",columns:o.unref(q),"data-source":l.value,"search-form":!1,onUpdate:D}),o.createSlots({_:2},[o.renderList(b,(a,d)=>({name:d,fn:o.withCtx(M=>[o.renderSlot(e.$slots,d,o.normalizeProps(o.guardReactiveProps(M||{})))])}))]),1040,["class","columns","data-source"])]),_:3},16,["label"])],64))}});exports.default=J;
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const o=require("vue"),u=require("lodash-unified"),y=require("../../ap-form/index.js"),k=require("../../ap-form/context.js"),A=require("../../ap-form/hooks/use-watch.js"),z=require("../../ap-form/utils/get.js"),H=require("../../ap-form/utils/transform.js");require("../../config-provider/index.js");const L=require("../hooks/use-editable-columns.js"),G=require("../hooks/use-editable-form-item-api.js");require("../index.vue2.js");const W=require("../style/editable.js"),U=require("../utils.js"),c=require("./utils.js"),$=require("../../config-provider/hooks/use-namespace.js"),J=require("../../config-provider/hooks/use-global-config.js"),Q=require("../index.vue.js"),X=o.defineComponent({name:"EditableGrid",__name:"form-item",props:{dropdownPrefixCls:{},bordered:{type:Boolean},locale:{},onResizeColumn:{},getPopupContainer:{},scroll:{},sortDirections:{},showSorterTooltip:{type:[Boolean,Object]},prefixCls:{},rowKey:{type:[String,Function],default:"key"},tableLayout:{},title:{},id:{},showHeader:{type:Boolean},components:{},customHeaderRow:{},direction:{},expandFixed:{type:[String,Boolean]},expandColumnWidth:{},expandedRowKeys:{},defaultExpandedRowKeys:{},expandedRowRender:{},expandRowByClick:{type:Boolean},expandIcon:{},onExpand:{},onExpandedRowsChange:{},defaultExpandAllRows:{type:Boolean},indentSize:{},expandIconColumnIndex:{},showExpandColumn:{type:Boolean},expandedRowClassName:{},childrenColumnName:{},rowExpandable:{},transformCellText:{},rowHoverable:{type:Boolean},rowSelection:{type:[Boolean,Object]},onLoadingChange:{},onShownColumnsChange:{},pagination:{type:[Boolean,Object],default:!1},searchFormWrapperStyle:{},tableWrapperStyle:{},wrapperStyle:{},tableStyle:{},adaptive:{type:Boolean},columnResizable:{type:Boolean,default:!1},loading:{type:Boolean,default:void 0},summary:{},rowHeight:{default:66},getRowHeight:{},advanceRenderer:{type:Boolean},browserTooltips:{type:Boolean},virtual:{type:[Boolean,Object],default:void 0},onRowClicked:{},onScrollEnd:{},rowClassName:{},rowClassRules:{},autoHeight:{type:Boolean},onUpdate:{},customRow:{},theme:{},emptyComponent:{},emptyText:{},onColumnResized:{},animateRows:{type:Boolean},plugins:{},columns:{},defaultValue:{},onChange:{},maxLength:{},onFieldChange:{},label:{},name:{},formItem:{}},setup(h,{expose:b}){const C=o.useSlots(),a=h,{b:R}=$.useNamespace("editable-aggrid"),v=W.default("editable-aggrid"),d=o.ref(),{internalInstance:l}=k.useInjectForm();function x(e){const t=c.getColumnTransformOptions(a.columns||[]);if(!Object.keys(t).length||!e?.length)return e;let n=[];for(const i of e)n.push(H.transformValues(i,t));return n}const s=U.getShadowName(a.name);let f=[];o.onMounted(()=>{const e=a.formItem?.initialValue??z.getModelValue(l?.getInitialValues()??{},a.name);e&&(l?.updateInitialModel(s,c.arrayToObject(u.cloneDeep(e),a.rowKey)),f=u.cloneDeep(e),r.value||F(u.cloneDeep(e),"suffix",!0))});const r=o.ref([]),B=A.useWatch(a.name);o.watch(()=>B.value,e=>{u.isEqual(e,r.value)||g(e??u.cloneDeep(f))},{deep:!0,flush:"post",immediate:!0});const S=J.useGlobalConfig("valueTypeMap"),q=L.useGetEditableColumns(a,S,s),{add:I,addMultiple:_,__addMultiple:F,remove:T,removeByKey:E,getRowData:N,getRowsData:V,setRowData:j,clear:D,refreshRowIds:m}=G.useEditableFormItemApi(a,l,r,s);function O(){const e=d.value?._internalGridApi;if(!m.value?.length||!e)return;const t=m.value.map(n=>e.getRowNode(n)).filter(n=>!!n);e.refreshCells({rowNodes:t,force:!0}),m.value=[]}function g(e){r.value=[...e];const t=c.arrayToObject(e,a.rowKey);l?.setFieldValue(a.name,[...e]),l?.setFieldValue(s,t)}function w(e,t){const n=e==="end"?r.value.length-1:e;d.value?.scrollToRow(n,t)}function K(e,t){d.value?.scrollToColumn(e,t)}function M(e,t){const n=[s,String(e),t].flat();return l?.validateFields([n])}function P(e){const n=o.unref(r).map((i,p)=>[s,String(c.getRowKey(i,p,a.rowKey)),e].flat());return l?.validateFields(n)}return b({add:I,addMultiple:_,remove:T,removeByKey:E,getRowData:N,getRowsData:V,setRowData:j,clear:D,setTableData:g,scrollTo:w,scrollToRow:w,scrollToColumn:K,validateCell:M,validateColumn:P,table:d}),(e,t)=>(o.openBlock(),o.createElementBlock(o.Fragment,null,[o.createVNode(o.unref(y.ApForm).FormItem,{hidden:"",name:e.name,"initial-value":e.formItem?.initialValue,transform:x},null,8,["name","initial-value"]),o.createVNode(o.unref(y.ApForm).FormItem,o.mergeProps({label:e.label},e.formItem),{default:o.withCtx(()=>[o.createVNode(Q.default,o.mergeProps(o.unref(u.omit)(a,["name","maxLength","onChange","defaultValue","formItem"]),{ref_key:"tableRef",ref:d,class:[o.unref(R)(),o.unref(v)],size:"mini",columns:o.unref(q),"data-source":r.value,"search-form":!1,onUpdate:O}),o.createSlots({_:2},[o.renderList(C,(n,i)=>({name:i,fn:o.withCtx(p=>[o.renderSlot(e.$slots,i,o.normalizeProps(o.guardReactiveProps(p||{})))])}))]),1040,["class","columns","data-source"])]),_:3},16,["label"])],64))}});exports.default=X;
@@ -87,7 +87,21 @@ export type EditableAgGridExpose<RecordType = any, ModelType = RecordType[]> = O
87
87
  validateFieldsReturnTransformed: EditableTableExpose<ModelType, RecordType>['validateFields'];
88
88
  table: AgGridExpose;
89
89
  };
90
- export type EditableAgGridFormItemExpose<RecordType = any, ModelType = RecordType[]> = Omit<EditableAgGridExpose<RecordType, ModelType>, 'resetFields' | 'validateFields' | 'validateFieldsReturnTransformed'>;
90
+ export type EditableAgGridFormItemExpose<RecordType = any, ModelType = RecordType[]> = Omit<EditableAgGridExpose<RecordType, ModelType>, 'resetFields' | 'validateFields' | 'validateFieldsReturnTransformed'> & {
91
+ /**
92
+ * 校验单元格
93
+ * @param rowId 行唯一标识
94
+ * @param field 字段
95
+ * @returns
96
+ */
97
+ validateCell: (rowId: any, field: NamePath) => any;
98
+ /**
99
+ * 校验列
100
+ * @param colKey 列唯一标识
101
+ * @returns
102
+ */
103
+ validateColumn: (colKey: string | number) => any;
104
+ };
91
105
  export type EditableAgGridFormItemProps<RecordType = any> = Omit<EditableAgGridProps<RecordType>, 'name' | 'value' | 'onUpdate:value'> & {
92
106
  label?: string;
93
107
  /**