@aplus-frontend/ui 0.4.13 → 0.4.15

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (97) hide show
  1. package/es/index.mjs +84 -80
  2. package/es/src/ap-descriptions/help-message/index.vue2.mjs +17 -12
  3. package/es/src/ap-field/date/helper.mjs +9 -9
  4. package/es/src/ap-table/ap-table.vue2.mjs +206 -181
  5. package/es/src/ap-table/hooks/use-table-paging-ng.mjs +62 -62
  6. package/es/src/ap-upload/apUpload.vue.d.ts +9 -0
  7. package/es/src/ap-upload/apUpload.vue.mjs +22 -18
  8. package/es/src/ap-upload/components/MultipleFile.vue2.mjs +66 -66
  9. package/es/src/ap-upload/components/Picture.vue2.mjs +82 -82
  10. package/es/src/ap-upload/components/SingleFile.vue2.mjs +114 -114
  11. package/es/src/business/ap-export-group/ApExportGroup.vue2.mjs +79 -67
  12. package/es/src/config-provider/config-provider.d.ts +3 -0
  13. package/es/src/config-provider/css-var.d.ts +3 -0
  14. package/es/src/config-provider/css-var.mjs +21 -14
  15. package/es/src/config-provider/index.d.ts +15 -0
  16. package/es/src/hooks/index.d.ts +1 -0
  17. package/es/src/hooks/index.mjs +6 -4
  18. package/es/src/hooks/useResize.d.ts +8 -0
  19. package/es/src/hooks/useResize.mjs +23 -0
  20. package/es/src/index.d.ts +1 -0
  21. package/es/src/index.mjs +212 -209
  22. package/es/src/path-map.mjs +2 -1
  23. package/es/src/resize-observer/index.d.ts +3 -0
  24. package/es/src/resize-observer/index.mjs +2 -0
  25. package/es/src/resize-observer/index.vue.d.ts +25 -0
  26. package/es/src/resize-observer/index.vue.mjs +45 -0
  27. package/es/src/resize-observer/index.vue2.mjs +4 -0
  28. package/es/src/resize-observer/interface.d.ts +27 -0
  29. package/es/src/resize-observer/interface.mjs +1 -0
  30. package/es/src/resize-observer/style/css.d.ts +1 -0
  31. package/es/src/resize-observer/style/css.js +1 -0
  32. package/es/src/resize-observer/style/index.d.ts +1 -0
  33. package/es/src/resize-observer/style/index.js +1 -0
  34. package/es/src/scroll-bar/index.vue.d.ts +1 -0
  35. package/es/src/scroll-bar/index.vue.mjs +31 -30
  36. package/es/src/scroll-bar/interface.d.ts +3 -1
  37. package/es/src/theme/antd-global-overwrite/admin/index.css +24 -2
  38. package/es/src/theme/antd-global-overwrite/admin/table.css +24 -2
  39. package/es/src/theme/antd-global-overwrite/aplus/index.css +24 -2
  40. package/es/src/theme/antd-global-overwrite/aplus/table.css +24 -2
  41. package/es/src/utils/index.d.ts +1 -0
  42. package/es/src/utils/index.mjs +40 -30
  43. package/lib/index.js +1 -1
  44. package/lib/src/ap-descriptions/help-message/index.vue2.js +1 -1
  45. package/lib/src/ap-field/date/helper.js +1 -1
  46. package/lib/src/ap-table/ap-table.vue2.js +1 -1
  47. package/lib/src/ap-table/hooks/use-table-paging-ng.js +1 -1
  48. package/lib/src/ap-upload/apUpload.vue.d.ts +9 -0
  49. package/lib/src/ap-upload/apUpload.vue.js +1 -1
  50. package/lib/src/ap-upload/components/MultipleFile.vue2.js +1 -1
  51. package/lib/src/ap-upload/components/Picture.vue2.js +1 -1
  52. package/lib/src/ap-upload/components/SingleFile.vue2.js +1 -1
  53. package/lib/src/business/ap-export-group/ApExportGroup.vue2.js +1 -1
  54. package/lib/src/config-provider/config-provider.d.ts +3 -0
  55. package/lib/src/config-provider/css-var.d.ts +3 -0
  56. package/lib/src/config-provider/css-var.js +1 -1
  57. package/lib/src/config-provider/index.d.ts +15 -0
  58. package/lib/src/hooks/index.d.ts +1 -0
  59. package/lib/src/hooks/index.js +1 -1
  60. package/lib/src/hooks/useResize.d.ts +8 -0
  61. package/lib/src/hooks/useResize.js +1 -0
  62. package/lib/src/index.d.ts +1 -0
  63. package/lib/src/index.js +1 -1
  64. package/lib/src/path-map.js +1 -1
  65. package/lib/src/resize-observer/index.d.ts +3 -0
  66. package/lib/src/resize-observer/index.js +1 -0
  67. package/lib/src/resize-observer/index.vue.d.ts +25 -0
  68. package/lib/src/resize-observer/index.vue.js +1 -0
  69. package/lib/src/resize-observer/index.vue2.js +1 -0
  70. package/lib/src/resize-observer/interface.d.ts +27 -0
  71. package/lib/src/resize-observer/interface.js +1 -0
  72. package/lib/src/resize-observer/style/css.cjs +1 -0
  73. package/lib/src/resize-observer/style/css.d.ts +1 -0
  74. package/lib/src/resize-observer/style/index.cjs +1 -0
  75. package/lib/src/resize-observer/style/index.d.ts +1 -0
  76. package/lib/src/scroll-bar/index.vue.d.ts +1 -0
  77. package/lib/src/scroll-bar/index.vue.js +1 -1
  78. package/lib/src/scroll-bar/interface.d.ts +3 -1
  79. package/lib/src/theme/antd-global-overwrite/admin/index.css +24 -2
  80. package/lib/src/theme/antd-global-overwrite/admin/table.css +24 -2
  81. package/lib/src/theme/antd-global-overwrite/aplus/index.css +24 -2
  82. package/lib/src/theme/antd-global-overwrite/aplus/table.css +24 -2
  83. package/lib/src/utils/index.d.ts +1 -0
  84. package/lib/src/utils/index.js +1 -1
  85. package/package.json +3 -3
  86. package/theme/antd-global-overwrite/admin/index.css +24 -2
  87. package/theme/antd-global-overwrite/admin/table.css +24 -2
  88. package/theme/antd-global-overwrite/admin/table.less +8 -2
  89. package/theme/antd-global-overwrite/aplus/index.css +24 -2
  90. package/theme/antd-global-overwrite/aplus/table.css +24 -2
  91. package/theme/antd-global-overwrite/aplus/table.less +7 -2
  92. package/theme/ap-descriptions/ap-descriptions.css +3 -0
  93. package/theme/ap-descriptions/ap-descriptions.less +7 -0
  94. package/theme/ap-table/ap-table.css +8 -1
  95. package/theme/ap-table/ap-table.less +11 -9
  96. package/theme/ap-table-modal/index.css +8 -1
  97. package/theme/index.css +11 -1
@@ -1,55 +1,55 @@
1
- import { ref as ee, reactive as q, unref as h, nextTick as te, onMounted as re, watch as oe, computed as A, createVNode as x } from "vue";
1
+ import { ref as ee, reactive as I, unref as h, nextTick as te, onMounted as re, watch as oe, computed as A, createVNode as C } from "vue";
2
2
  import { useTableSortedAndFiltered as ne } from "./use-sorted-filtered.mjs";
3
3
  import "../../config-provider/index.mjs";
4
4
  import { parseFieldValue as ae, dataIndexToStr as se, isEqualCustom as ce } from "../utils.mjs";
5
- import { isArray as I, isEqualWith as ie } from "lodash-unified";
5
+ import { isArray as N, isEqualWith as ie } from "lodash-unified";
6
6
  import { useLocale as le } from "../../config-provider/hooks/use-locale.mjs";
7
7
  import { useNamespace as ue } from "../../config-provider/hooks/use-namespace.mjs";
8
- const C = 1, N = 10;
8
+ const S = 1, L = 100;
9
9
  function fe(g) {
10
10
  const l = {};
11
- return g && (g === !0 ? (l.current = C, l.pageSize = N) : (l.current = g.defaultCurrent || C, l.pageSize = g.defaultPageSize || N)), l;
11
+ return g && (g === !0 ? (l.current = S, l.pageSize = L) : (l.current = g.defaultCurrent || S, l.pageSize = g.defaultPageSize || L)), l;
12
12
  }
13
13
  const Te = ({
14
14
  manual: g = !1,
15
15
  request: l,
16
- defaultParams: L = {},
17
- defaultData: v = [],
18
- formatParams: y,
19
- paramsValueTypeMap: D,
20
- resetFieldsIgnores: R,
16
+ defaultParams: v = {},
17
+ defaultData: y = [],
18
+ formatParams: D,
19
+ paramsValueTypeMap: R,
20
+ resetFieldsIgnores: V,
21
21
  filterFields: U,
22
22
  sortFields: B,
23
23
  pagination: p = {
24
- defaultCurrent: 1,
25
- defaultPageSize: 10,
24
+ defaultCurrent: S,
25
+ defaultPageSize: L,
26
26
  showLessItems: !1,
27
27
  showTotal: !0
28
28
  }
29
29
  }) => {
30
30
  let b = 0, s = {};
31
- const K = p ?? {}, M = (e) => y ? y(e) : e, S = ee(), c = q(fe(p)), {
31
+ const K = p ?? {}, M = (e) => D ? D(e) : e, z = ee(), c = I(fe(p)), {
32
32
  getColumnSFConfig: $,
33
33
  setSF: G,
34
34
  clearAll: J
35
35
  } = ne(), {
36
- t: z
36
+ t: T
37
37
  } = le(), {
38
- b: T
39
- } = ue("ap-table"), o = q({
40
- total: v.length,
41
- records: v,
38
+ b: P
39
+ } = ue("ap-table"), o = I({
40
+ total: y.length,
41
+ records: y,
42
42
  loading: !1
43
- }), P = () => {
43
+ }), F = () => {
44
44
  var e, t;
45
- return ((t = (e = S.value) == null ? void 0 : e.apForm) == null ? void 0 : t.getFieldsValueTransformed(!0)) || {};
46
- }, V = async (e) => {
45
+ return ((t = (e = z.value) == null ? void 0 : e.apForm) == null ? void 0 : t.getFieldsValueTransformed(!0)) || {};
46
+ }, O = async (e) => {
47
47
  var n;
48
48
  const t = M(e), r = Date.now();
49
49
  b = r, o.loading = !0;
50
50
  try {
51
51
  const a = await l({
52
- ...h(L),
52
+ ...h(v),
53
53
  ...t
54
54
  });
55
55
  b === r && (o.total = a.total || ((n = a.data) == null ? void 0 : n.length) || 0, o.records = [...a.data || []]);
@@ -58,47 +58,47 @@ const Te = ({
58
58
  } finally {
59
59
  o.loading = !1;
60
60
  }
61
- }, O = (e) => {
61
+ }, _ = (e) => {
62
62
  const t = {};
63
63
  return Object.entries(e).forEach(([r, n]) => {
64
- if (t[r] = n, D && n) {
65
- const a = D[r];
64
+ if (t[r] = n, R && n) {
65
+ const a = R[r];
66
66
  a && (t[r] = ae(a, n));
67
67
  }
68
68
  }), t;
69
69
  }, Q = async (e) => {
70
70
  var n, a, u, f, d;
71
- const t = P(), r = {};
72
- Object.entries(t).forEach(([m, w]) => {
73
- R && R.indexOf(m) > -1 && (r[m] = w);
74
- }), await ((a = (n = S.value) == null ? void 0 : n.apForm) == null ? void 0 : a.resetFields()), (d = (f = (u = S.value) == null ? void 0 : u.apForm) == null ? void 0 : f.setFieldsValue) == null || d.call(f, r), te(() => {
71
+ const t = F(), r = {};
72
+ Object.entries(t).forEach(([m, x]) => {
73
+ V && V.indexOf(m) > -1 && (r[m] = x);
74
+ }), await ((a = (n = z.value) == null ? void 0 : n.apForm) == null ? void 0 : a.resetFields()), (d = (f = (u = z.value) == null ? void 0 : u.apForm) == null ? void 0 : f.setFieldsValue) == null || d.call(f, r), te(() => {
75
75
  e == null || e();
76
76
  });
77
- }, F = (e) => {
77
+ }, w = (e) => {
78
78
  s = e;
79
- const t = O(e);
80
- V(t);
79
+ const t = _(e);
80
+ O(t);
81
81
  }, W = (e) => {
82
- F({
82
+ w({
83
83
  ...s,
84
84
  ...e
85
85
  });
86
86
  }, E = () => {
87
- const e = P();
88
- p && (c.current = C), F({
87
+ const e = F();
88
+ p && (c.current = S), w({
89
89
  ...e,
90
90
  filter: s.filter,
91
91
  sort: s.sort,
92
- current: p ? C : void 0,
92
+ current: p ? S : void 0,
93
93
  pageSize: p ? s.pageSize || c.pageSize : void 0
94
94
  });
95
95
  }, Z = () => {
96
96
  J(), s.sort = {}, s.filter = {}, Q(E);
97
- }, _ = () => {
98
- F(s);
97
+ }, j = () => {
98
+ w(s);
99
99
  }, H = (e) => {
100
100
  if (!p)
101
- _();
101
+ j();
102
102
  else {
103
103
  const {
104
104
  current: t,
@@ -108,16 +108,16 @@ const Te = ({
108
108
  current: u > 0 ? u : 1
109
109
  });
110
110
  }
111
- }, j = (e, t, r) => {
112
- var m, w;
113
- const n = P();
111
+ }, q = (e, t, r) => {
112
+ var m, x;
113
+ const n = F();
114
114
  c.current = e.current, c.pageSize = e.pageSize, G(t, r);
115
- const a = I(r) ? [...r] : [r], u = {};
115
+ const a = N(r) ? [...r] : [r], u = {};
116
116
  for (const i of a)
117
117
  (m = h(B)) != null && m.includes(i.columnKey || i.field) && i.order && (u[se(i.columnKey || i.field)] = i.order);
118
118
  const f = {};
119
119
  for (const i of Object.keys(t))
120
- (w = h(U)) != null && w.includes(i) && t[i] && (f[i] = t[i]);
120
+ (x = h(U)) != null && x.includes(i) && t[i] && (f[i] = t[i]);
121
121
  const d = {
122
122
  ...n,
123
123
  filter: f,
@@ -125,10 +125,10 @@ const Te = ({
125
125
  current: e.current,
126
126
  pageSize: e.pageSize
127
127
  };
128
- ie(s, d, ce) || F(d);
128
+ ie(s, d, ce) || w(d);
129
129
  };
130
130
  re(() => {
131
- const e = P(), {
131
+ const e = F(), {
132
132
  current: t,
133
133
  pageSize: r
134
134
  } = c;
@@ -139,10 +139,10 @@ const Te = ({
139
139
  sort: {},
140
140
  ...e
141
141
  }, !g) {
142
- const n = O(s);
143
- V(n);
142
+ const n = _(s);
143
+ O(n);
144
144
  }
145
- }), oe(() => h(L), () => {
145
+ }), oe(() => h(v), () => {
146
146
  E();
147
147
  }, {
148
148
  deep: !0
@@ -157,7 +157,7 @@ const Te = ({
157
157
  return `${e}/${Math.ceil(o.total / t)}`;
158
158
  });
159
159
  function Y(e) {
160
- I(e) && (o.records = e, o.total = e.length);
160
+ N(e) && (o.records = e, o.total = e.length);
161
161
  }
162
162
  const k = A(() => {
163
163
  const {
@@ -174,30 +174,30 @@ const Te = ({
174
174
  showQuickJumper: !e,
175
175
  showLessItems: e,
176
176
  size: "default",
177
- showTotal: t ? (r) => x("span", {
178
- class: T("pagination-total-wrapper")
179
- }, [z("ap.apTable.pagination.totalLeftPrefix"), " ", x("span", {
180
- class: T("pagination-count-text")
181
- }, [r]), " ", z("ap.apTable.pagination.totalLeftSuffix"), x("span", {
182
- class: T("pagination--total-right")
183
- }, [z("ap.apTable.pagination.totalRightPrefix"), " ", x("span", {
184
- class: T("pagination-count-text")
185
- }, [h(X)]), " ", z("ap.apTable.pagination.totalRightSuffix")])]) : void 0
177
+ showTotal: t ? (r) => C("span", {
178
+ class: P("pagination-total-wrapper")
179
+ }, [T("ap.apTable.pagination.totalLeftPrefix"), " ", C("span", {
180
+ class: P("pagination-count-text")
181
+ }, [r]), " ", T("ap.apTable.pagination.totalLeftSuffix"), C("span", {
182
+ class: P("pagination--total-right")
183
+ }, [T("ap.apTable.pagination.totalRightPrefix"), " ", C("span", {
184
+ class: P("pagination-count-text")
185
+ }, [h(X)]), " ", T("ap.apTable.pagination.totalRightSuffix")])]) : void 0
186
186
  },
187
- onChange: j,
187
+ onChange: q,
188
188
  dataSource: o.records
189
189
  };
190
190
  });
191
191
  return {
192
- formRef: S,
192
+ formRef: z,
193
193
  submit: E,
194
194
  reset: Z,
195
- refresh: _,
195
+ refresh: j,
196
196
  refreshByDelete: H,
197
197
  data: o,
198
198
  current: c.current,
199
199
  pageSize: c.pageSize,
200
- handleTableChange: j,
200
+ handleTableChange: q,
201
201
  tableProps: k,
202
202
  dataSource: A(() => o.records),
203
203
  setDataSource: Y,
@@ -77,6 +77,10 @@ declare const __VLS_component: DefineComponent<ExtractPropTypes<{
77
77
  type: StringConstructor;
78
78
  default: undefined;
79
79
  };
80
+ onRemove: {
81
+ type: FunctionConstructor;
82
+ default: undefined;
83
+ };
80
84
  }>, {
81
85
  done: ComputedRef<boolean>;
82
86
  clear: typeof clear;
@@ -148,6 +152,10 @@ declare const __VLS_component: DefineComponent<ExtractPropTypes<{
148
152
  type: StringConstructor;
149
153
  default: undefined;
150
154
  };
155
+ onRemove: {
156
+ type: FunctionConstructor;
157
+ default: undefined;
158
+ };
151
159
  }>> & Readonly<{
152
160
  "onUpdate:value"?: ((...args: any[]) => any) | undefined;
153
161
  }>, {
@@ -167,6 +175,7 @@ declare const __VLS_component: DefineComponent<ExtractPropTypes<{
167
175
  customRequest: CustomRequest;
168
176
  maxSizeErrorMsg: string;
169
177
  acceptErrorMsg: string;
178
+ onRemove: Function;
170
179
  maxCount: number;
171
180
  maxCountErrorMsg: string;
172
181
  }, {}, {}, {}, string, ComponentProvideOptions, true, {
@@ -1,4 +1,4 @@
1
- import { defineComponent as A, ref as g, computed as v, provide as t, openBlock as y, createElementBlock as U, normalizeClass as $, unref as k, createBlock as T, resolveDynamicComponent as B, mergeProps as L, createSlots as R, renderList as q, withCtx as P, renderSlot as V, normalizeProps as w, guardReactiveProps as D } from "vue";
1
+ import { defineComponent as A, ref as g, computed as v, provide as t, openBlock as y, createElementBlock as R, normalizeClass as U, unref as $, createBlock as k, resolveDynamicComponent as T, mergeProps as B, createSlots as L, renderList as q, withCtx as P, renderSlot as V, normalizeProps as w, guardReactiveProps as D } from "vue";
2
2
  import "../config-provider/index.mjs";
3
3
  import "./components/SingleFile.vue.mjs";
4
4
  import "./components/MultipleFile.vue.mjs";
@@ -12,7 +12,7 @@ import Q from "./components/SingleFile.vue2.mjs";
12
12
  import W from "./components/MultipleFile.vue2.mjs";
13
13
  import X from "./components/Picture.vue2.mjs";
14
14
  import { useGlobalConfig as C } from "../config-provider/hooks/use-global-config.mjs";
15
- const me = /* @__PURE__ */ A({
15
+ const pe = /* @__PURE__ */ A({
16
16
  name: "AplusFileUpload",
17
17
  __name: "apUpload",
18
18
  props: {
@@ -79,35 +79,39 @@ const me = /* @__PURE__ */ A({
79
79
  acceptErrorMsg: {
80
80
  type: String,
81
81
  default: void 0
82
+ },
83
+ onRemove: {
84
+ type: Function,
85
+ default: void 0
82
86
  }
83
87
  },
84
88
  emits: ["update:value"],
85
89
  setup(S, { expose: b, emit: x }) {
86
- var p, m, d, f;
87
- const { t: l, lang: M } = J();
88
- G(l), I(l, M);
89
- const { b: N } = K("ap-upload"), n = g(null), e = S, _ = x, E = {
90
+ var m, p, d, f;
91
+ const { t: u, lang: F } = J();
92
+ G(u), I(u, F);
93
+ const { b: M } = K("ap-upload"), n = g(null), e = S, N = x, _ = {
90
94
  singleFile: Q,
91
95
  multipleFile: W,
92
96
  picture: X
93
- }, s = H.useInjectFormItemContext(), F = v({
97
+ }, s = H.useInjectFormItemContext(), E = v({
94
98
  get() {
95
99
  return e.value;
96
100
  },
97
101
  set(o) {
98
102
  var a;
99
- _("update:value", o), s == null || s.onFieldChange(), (a = e.onChange) == null || a.call(e, o);
103
+ N("update:value", o), s == null || s.onFieldChange(), (a = e.onChange) == null || a.call(e, o);
100
104
  }
101
105
  }), O = C("uiMode"), i = C("apUpload");
102
- t("theme", O.value), t("value", F), t("dirName", e.dirName ?? ((p = i.value) == null ? void 0 : p.dirName)), t(
106
+ t("theme", O.value), t("value", E), t("dirName", e.dirName ?? ((m = i.value) == null ? void 0 : m.dirName)), t(
103
107
  "needName",
104
- e.needName ?? ((m = i.value) == null ? void 0 : m.needName) ?? !1
108
+ e.needName ?? ((p = i.value) == null ? void 0 : p.needName) ?? !1
105
109
  ), t("accept", e.accept ?? ((d = i.value) == null ? void 0 : d.accept) ?? ""), t("maxSize", e.maxSize), t("title", e.title), t("subTitle", e.subTitle), t("maxCount", e.maxCount), t("beforeUpload", e.beforeUpload), t("customRequest", e.customRequest), t(
106
110
  "getOssAccess",
107
111
  e.getOssAccess ?? ((f = i.value) == null ? void 0 : f.getOssAccess)
108
- ), t("maxSizeErrorMsg", e.maxSizeErrorMsg), t("maxCountErrorMsg", e.maxCountErrorMsg), t("acceptErrorMsg", e.acceptErrorMsg);
109
- const z = v(() => u.value === 0), u = g(0);
110
- t("uploadingCount", u);
112
+ ), t("maxSizeErrorMsg", e.maxSizeErrorMsg), t("maxCountErrorMsg", e.maxCountErrorMsg), t("acceptErrorMsg", e.acceptErrorMsg), t("onRemove", e.onRemove);
113
+ const z = v(() => l.value === 0), l = g(0);
114
+ t("uploadingCount", l);
111
115
  function h() {
112
116
  c(void 0);
113
117
  }
@@ -119,13 +123,13 @@ const me = /* @__PURE__ */ A({
119
123
  done: z,
120
124
  clear: h,
121
125
  setValue: c
122
- }), (o, a) => (y(), U("div", {
123
- class: $(k(N)())
126
+ }), (o, a) => (y(), R("div", {
127
+ class: U($(M)())
124
128
  }, [
125
- (y(), T(B(E[e.type]), L(o.$attrs, {
129
+ (y(), k(T(_[e.type]), B(o.$attrs, {
126
130
  ref_key: "uploadRef",
127
131
  ref: n
128
- }), R({ _: 2 }, [
132
+ }), L({ _: 2 }, [
129
133
  q(Object.keys(o.$slots), (r) => ({
130
134
  name: r,
131
135
  fn: P((j) => [
@@ -137,5 +141,5 @@ const me = /* @__PURE__ */ A({
137
141
  }
138
142
  });
139
143
  export {
140
- me as default
144
+ pe as default
141
145
  };
@@ -1,37 +1,37 @@
1
- import { defineComponent as W, inject as s, ref as G, watch as H, nextTick as J, openBlock as x, createElementBlock as k, normalizeClass as K, unref as n, createVNode as C, withCtx as T, createElementVNode as b, createTextVNode as Q, toDisplayString as S, withModifiers as X, createBlock as Y, resolveDynamicComponent as Z, createCommentVNode as ee } from "vue";
1
+ import { defineComponent as G, inject as s, ref as H, watch as J, nextTick as K, openBlock as h, createElementBlock as C, normalizeClass as Q, unref as n, createVNode as U, withCtx as b, createElementVNode as S, createTextVNode as X, toDisplayString as L, withModifiers as Y, createBlock as Z, resolveDynamicComponent as ee, createCommentVNode as te } from "vue";
2
2
  import "../../config-provider/index.mjs";
3
- import { getPath as te, getName as oe, getReturnData as L } from "../utils/returnData.mjs";
4
- import { useOss as ae, getOssInstance as se } from "../hooks/useOss.mjs";
5
- import { message as m, Upload as ne, Button as re } from "@aplus-frontend/antdv";
6
- import { UploadOutlined as ie } from "@ant-design/icons-vue";
7
- import { fileMatchesAccept as le, getAcceptText as ue } from "../utils/accept.mjs";
8
- import { useLocale as ce } from "../../config-provider/hooks/use-locale.mjs";
9
- import { useNamespace as pe } from "../../config-provider/hooks/use-namespace.mjs";
10
- const me = { class: "multiple-file-context" }, de = { key: 0 }, fe = { key: 1 }, _e = /* @__PURE__ */ W({
3
+ import { getPath as oe, getName as se, getReturnData as M } from "../utils/returnData.mjs";
4
+ import { useOss as ae, getOssInstance as ne } from "../hooks/useOss.mjs";
5
+ import { message as m, Upload as re, Button as ie } from "@aplus-frontend/antdv";
6
+ import { UploadOutlined as le } from "@ant-design/icons-vue";
7
+ import { fileMatchesAccept as ue, getAcceptText as ce } from "../utils/accept.mjs";
8
+ import { useLocale as pe } from "../../config-provider/hooks/use-locale.mjs";
9
+ import { useNamespace as me } from "../../config-provider/hooks/use-namespace.mjs";
10
+ const de = { class: "multiple-file-context" }, fe = { key: 0 }, ge = { key: 1 }, Ae = /* @__PURE__ */ G({
11
11
  __name: "MultipleFile",
12
- setup(ge, { expose: M }) {
13
- const { t: r } = ce(), { b: U } = pe("ap-upload-multiple-file"), { put: z } = ae(), R = s("theme"), B = s("dirName"), h = s("accept") || "*", E = s("maxSize") ?? 500, I = s("title") || r("ap.apUpload.uploadFile"), f = s("subTitle"), i = s("maxCount") ?? 10, d = s("uploadingCount"), _ = s("beforeUpload"), A = s("customRequest"), P = s("getOssAccess"), O = s("maxSizeErrorMsg"), q = s("maxCountErrorMsg"), D = s("acceptErrorMsg"), a = s("value"), c = [], g = s("needName"), l = G(null);
14
- H(
12
+ setup(ve, { expose: z }) {
13
+ const { t: r } = pe(), { b: E } = me("ap-upload-multiple-file"), { put: R } = ae(), B = s("theme"), I = s("dirName"), y = s("accept") || "*", _ = s("maxSize") ?? 500, P = s("title") || r("ap.apUpload.uploadFile"), f = s("subTitle"), i = s("maxCount") ?? 10, d = s("uploadingCount"), A = s("beforeUpload"), F = s("customRequest"), O = s("getOssAccess"), q = s("maxSizeErrorMsg"), D = s("maxCountErrorMsg"), $ = s("acceptErrorMsg"), g = s("onRemove"), a = s("value"), c = [], v = s("needName"), l = H(null);
14
+ J(
15
15
  () => a == null ? void 0 : a.value,
16
16
  function(e) {
17
17
  var t, o;
18
- !((o = (t = l == null ? void 0 : l.value) == null ? void 0 : t.fileList) != null && o.length) && e && F(e);
18
+ !((o = (t = l == null ? void 0 : l.value) == null ? void 0 : t.fileList) != null && o.length) && e && N(e);
19
19
  },
20
20
  { immediate: !0 }
21
21
  );
22
- function F(e) {
22
+ function N(e) {
23
23
  if (!e) {
24
24
  p = [], l.value.fileList = [], a.value = void 0, c.splice(0, c.length);
25
25
  return;
26
26
  }
27
- J(() => {
27
+ K(() => {
28
28
  const t = e.map((o) => {
29
- const u = te(g, o), y = oe(g, o), w = new File(
29
+ const u = oe(v, o), w = se(v, o), k = new File(
30
30
  [o],
31
- y,
31
+ w,
32
32
  {}
33
33
  );
34
- return w.response = u, w.uid = u, w;
34
+ return k.response = u, k.uid = u, k;
35
35
  });
36
36
  if (i && t.length > i) {
37
37
  m.warning(
@@ -49,9 +49,9 @@ const me = { class: "multiple-file-context" }, de = { key: 0 }, fe = { key: 1 },
49
49
  }), l.value.fileList = t, a.value = e;
50
50
  });
51
51
  }
52
- M({ setValue: F });
53
- let p = [], N;
54
- function v(e) {
52
+ z({ setValue: N });
53
+ let p = [], T;
54
+ function x(e) {
55
55
  setTimeout(() => {
56
56
  const t = l.value.fileList.findIndex(
57
57
  (o) => o.uid === e.uid
@@ -59,32 +59,32 @@ const me = { class: "multiple-file-context" }, de = { key: 0 }, fe = { key: 1 },
59
59
  t >= 0 && l.value.fileList.splice(t, 1);
60
60
  });
61
61
  }
62
- async function $(e) {
62
+ async function j(e) {
63
63
  if (i && i > 1 && p.length >= i)
64
- return clearTimeout(N), N = setTimeout(() => {
64
+ return clearTimeout(T), T = setTimeout(() => {
65
65
  m.warning(
66
- q || r("ap.apUpload.maxUploadFiles", {
66
+ D || r("ap.apUpload.maxUploadFiles", {
67
67
  maxCount: i
68
68
  })
69
69
  );
70
- }), v(e), !1;
71
- if (e.size > E * 1024 * 1024)
70
+ }), x(e), !1;
71
+ if (e.size > _ * 1024 * 1024)
72
72
  return m.warning(
73
- O || r("ap.apUpload.maxUploadFileSize", {
74
- maxSize: E
73
+ q || r("ap.apUpload.maxUploadFileSize", {
74
+ maxSize: _
75
75
  })
76
- ), v(e), !1;
77
- if (!le(e, h))
76
+ ), x(e), !1;
77
+ if (!ue(e, y))
78
78
  return m.warning(
79
- D || r("ap.apUpload.fileFormatNotSupported")
80
- ), v(e), !1;
81
- if (typeof _ == "function" && await _(e) === !1)
82
- return v(e), !1;
79
+ $ || r("ap.apUpload.fileFormatNotSupported")
80
+ ), x(e), !1;
81
+ if (typeof A == "function" && await A(e) === !1)
82
+ return x(e), !1;
83
83
  i && i === 1 && (p = [], a.value = void 0), p.push(e);
84
84
  }
85
- async function j(e) {
86
- if (d.value++, typeof A == "function") {
87
- A({
85
+ async function V(e) {
86
+ if (d.value++, typeof F == "function") {
87
+ F({
88
88
  onProgress: (t) => {
89
89
  setTimeout(() => {
90
90
  e.onProgress({
@@ -105,7 +105,7 @@ const me = { class: "multiple-file-context" }, de = { key: 0 }, fe = { key: 1 },
105
105
  e.onSuccess(t);
106
106
  }), a.value = [
107
107
  ...a.value || [],
108
- L(g, t, e.file.name)
108
+ M(v, t, e.file.name)
109
109
  ], c.push({
110
110
  uid: e.file.uid,
111
111
  path: t
@@ -116,15 +116,15 @@ const me = { class: "multiple-file-context" }, de = { key: 0 }, fe = { key: 1 },
116
116
  return;
117
117
  }
118
118
  try {
119
- const t = await se(P);
120
- e.file.oss = t, z({
119
+ const t = await ne(O);
120
+ e.file.oss = t, R({
121
121
  file: e.file,
122
- dirName: B,
122
+ dirName: I,
123
123
  oss: t,
124
124
  successCallBack(o) {
125
125
  e.onSuccess(o), a.value = [
126
126
  ...a.value || [],
127
- L(g, o, e.file.name)
127
+ M(v, o, e.file.name)
128
128
  ], c.push({
129
129
  uid: e.file.uid,
130
130
  path: o
@@ -151,11 +151,11 @@ const me = { class: "multiple-file-context" }, de = { key: 0 }, fe = { key: 1 },
151
151
  }), d.value--;
152
152
  }
153
153
  }
154
- function V(e) {
154
+ function W(e) {
155
155
  var o;
156
- if (e.response) {
156
+ if (g && (g == null || g(e)), e.response) {
157
157
  if (Array.isArray(a.value)) {
158
- const u = c.findIndex((y) => y.uid === e.uid);
158
+ const u = c.findIndex((w) => w.uid === e.uid);
159
159
  u >= 0 && (a == null || a.value.splice(u, 1), c.splice(u, 1)), a.value.length === 0 && (a.value = void 0);
160
160
  }
161
161
  } else
@@ -165,16 +165,16 @@ const me = { class: "multiple-file-context" }, de = { key: 0 }, fe = { key: 1 },
165
165
  );
166
166
  return p.splice(t, 1), Promise.resolve(!0);
167
167
  }
168
- return (e, t) => (x(), k("div", {
169
- class: K({
170
- [n(U)()]: !0,
171
- [n(U)("admin")]: n(R) === "admin"
168
+ return (e, t) => (h(), C("div", {
169
+ class: Q({
170
+ [n(E)()]: !0,
171
+ [n(E)("admin")]: n(B) === "admin"
172
172
  })
173
173
  }, [
174
- C(n(ne), {
174
+ U(n(re), {
175
175
  ref_key: "uploadRef",
176
176
  ref: l,
177
- accept: n(h),
177
+ accept: n(y),
178
178
  multiple: "",
179
179
  "max-count": n(i),
180
180
  progress: {
@@ -182,27 +182,27 @@ const me = { class: "multiple-file-context" }, de = { key: 0 }, fe = { key: 1 },
182
182
  showInfo: !1,
183
183
  strokeColor: "#0070FF"
184
184
  },
185
- "before-upload": $,
186
- "custom-request": j,
187
- onRemove: V
185
+ "before-upload": j,
186
+ "custom-request": V,
187
+ onRemove: W
188
188
  }, {
189
- default: T(() => [
190
- b("div", me, [
191
- C(n(re), { class: "file-btn" }, {
192
- default: T(() => [
193
- C(n(ie)),
194
- Q(" " + S(n(I)), 1)
189
+ default: b(() => [
190
+ S("div", de, [
191
+ U(n(ie), { class: "file-btn" }, {
192
+ default: b(() => [
193
+ U(n(le)),
194
+ X(" " + L(n(P)), 1)
195
195
  ]),
196
196
  _: 1
197
197
  }),
198
- b("div", {
198
+ S("div", {
199
199
  class: "sub-title",
200
- onClick: t[0] || (t[0] = X(() => {
200
+ onClick: t[0] || (t[0] = Y(() => {
201
201
  }, ["stop"]))
202
202
  }, [
203
- typeof n(f) == "string" ? (x(), k("div", de, S(n(f) || `${n(r)("ap.apUpload.supportExtension")}:${n(ue)(n(h))}`), 1)) : n(f) ? (x(), k("div", fe, [
204
- (x(), Y(Z(n(f))))
205
- ])) : ee("", !0)
203
+ typeof n(f) == "string" ? (h(), C("div", fe, L(n(f) || `${n(r)("ap.apUpload.supportExtension")}:${n(ce)(n(y))}`), 1)) : n(f) ? (h(), C("div", ge, [
204
+ (h(), Z(ee(n(f))))
205
+ ])) : te("", !0)
206
206
  ])
207
207
  ])
208
208
  ]),
@@ -212,5 +212,5 @@ const me = { class: "multiple-file-context" }, de = { key: 0 }, fe = { key: 1 },
212
212
  }
213
213
  });
214
214
  export {
215
- _e as default
215
+ Ae as default
216
216
  };