@keyblade/pro-components 1.13.2 → 1.13.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -599,6 +599,7 @@ declare const __VLS_component: import('vue').DefineComponent<__VLS_PublicProps,
599
599
  listType: import('@arco-design/web-vue/es/upload/interfaces').ListType;
600
600
  }> | undefined>;
601
601
  cropperInsRef: import('vue').Ref<any, any>;
602
+ isUploadComplete: import('vue').ComputedRef<boolean>;
602
603
  }, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
603
604
  "update:modelValue": (value: FileItem[]) => any;
604
605
  } & {
@@ -609,9 +610,9 @@ declare const __VLS_component: import('vue').DefineComponent<__VLS_PublicProps,
609
610
  }>, {
610
611
  name: string;
611
612
  accept: string[];
613
+ disabled: boolean;
612
614
  multiple: boolean;
613
615
  singleLimit: number;
614
- disabled: boolean;
615
616
  hideInnerBeforeUploadLoading: boolean;
616
617
  }, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {
617
618
  uploadInsRef: unknown;
@@ -1,13 +1,13 @@
1
- import { defineComponent as me, mergeModels as J, useSlots as ge, useModel as pe, ref as m, computed as M, watch as K, resolveComponent as he, createElementBlock as Ie, openBlock as X, createVNode as xe, createBlock as Ue, createCommentVNode as ye, normalizeClass as Ce, createSlots as Be, withCtx as Y, unref as Z, renderSlot as A } from "vue";
1
+ import { defineComponent as ge, mergeModels as J, useSlots as pe, useModel as he, ref as m, computed as w, watch as K, resolveComponent as Ie, createElementBlock as xe, openBlock as X, createVNode as Ue, createBlock as ye, createCommentVNode as Ce, normalizeClass as Be, createSlots as we, withCtx as Y, unref as Z, renderSlot as A } from "vue";
2
2
  import { Message as g } from "@arco-design/web-vue";
3
3
  import { conclude as L } from "vue-global-config";
4
4
  import { EImageUploadInnerBeforeUploadStep as v } from "./types.js";
5
5
  import { defaultImageUploadOptions as U } from "./constant.js";
6
- import we from "./cropper.vue.js";
7
- import { defaultImageUploadCheckOptions as Ee, defaultImageUploadCompressorOptions as Me, defaultImageUploadCropOptions as Se, oneTravelImageCheckAndTransform as be, oneTravelImageCompressor as Le } from "@keyblade/one-travel";
8
- const Oe = "keyblade-pro-image-upload";
6
+ import Ee from "./cropper.vue.js";
7
+ import { defaultImageUploadCheckOptions as Me, defaultImageUploadCompressorOptions as Se, defaultImageUploadCropOptions as be, oneTravelImageCheckAndTransform as Le, oneTravelImageCompressor as Oe } from "@keyblade/one-travel";
8
+ const $e = "keyblade-pro-image-upload";
9
9
  var R, _, ee;
10
- const We = /* @__PURE__ */ me({
10
+ const He = /* @__PURE__ */ ge({
11
11
  __name: "image-upload",
12
12
  props: /* @__PURE__ */ J({
13
13
  action: {},
@@ -41,18 +41,16 @@ const We = /* @__PURE__ */ me({
41
41
  }),
42
42
  emits: /* @__PURE__ */ J(["cropperImgLoad"], ["update:modelValue"]),
43
43
  setup(y, { expose: ae, emit: le }) {
44
- const O = ge(), r = pe(y, "modelValue"), e = y, oe = le, S = m(), $ = m(), p = m(), h = m(
45
- []
46
- ), n = m(), c = m(), s = m(), ne = M(() => e.accept.map((a) => `.${a}`).join(",")), f = M(() => L([e.checkOptions, Ee]) || {}), C = M(() => L([e.compressorOptions, Me]) || {}), B = M(() => L([e.cropOptions, Se]) || {}), te = (a) => {
44
+ const O = pe(), r = he(y, "modelValue"), e = y, oe = le, S = m(), $ = m(), p = m(), h = m([]), n = m(), c = m(), s = m(), ne = w(() => e.accept.map((a) => `.${a}`).join(",")), f = w(() => L([e.checkOptions, Me]) || {}), C = w(() => L([e.compressorOptions, Se]) || {}), B = w(() => L([e.cropOptions, be]) || {}), te = (a) => {
47
45
  var t, u, d, i;
48
46
  const l = (i = (d = (u = (t = S.value) == null ? void 0 : t.$el) == null ? void 0 : u.querySelector) == null ? void 0 : d.call(u, "input")) == null ? void 0 : i.files;
49
47
  return l && l.length > 0 && (s.value = {
50
48
  selectCount: l.length
51
- }), e != null && e.onBeforeUpload ? e == null ? void 0 : e.onBeforeUpload(a) : s.value && (e != null && e.singleLimit) && s.value.selectCount > (e == null ? void 0 : e.singleLimit) ? (s.value.handleIndex === void 0 ? (s.value.handleIndex = 0, g.clear(), g.error(`单次最多可选择${e == null ? void 0 : e.singleLimit}张图片`)) : s.value.handleIndex += 1, s.value.handleIndex === s.value.selectCount - 1 && (s.value = void 0), !1) : new Promise(async (w, E) => {
49
+ }), e != null && e.onBeforeUpload ? e == null ? void 0 : e.onBeforeUpload(a) : s.value && (e != null && e.singleLimit) && s.value.selectCount > (e == null ? void 0 : e.singleLimit) ? (s.value.handleIndex === void 0 ? (s.value.handleIndex = 0, g.clear(), g.error(`单次最多可选择${e == null ? void 0 : e.singleLimit}张图片`)) : s.value.handleIndex += 1, s.value.handleIndex === s.value.selectCount - 1 && (s.value = void 0), !1) : new Promise(async (E, M) => {
52
50
  try {
53
- w(await se(a));
51
+ E(await se(a));
54
52
  } catch {
55
- E();
53
+ M();
56
54
  } finally {
57
55
  k();
58
56
  }
@@ -93,22 +91,22 @@ const We = /* @__PURE__ */ me({
93
91
  oe("cropperImgLoad", a);
94
92
  };
95
93
  K(n, async () => {
96
- var w, E, b, F, z, j, Q, T, V, W, H, N, P, q, D, G;
94
+ var E, M, b, F, z, j, Q, T, V, W, H, N, P, q, D, G;
97
95
  if (n.value === void 0 || h.value.length === 0)
98
96
  return;
99
97
  const a = h.value[n.value], { file: l, resolve: t, reject: u } = a;
100
98
  let d = l.name, i = l;
101
- if ((w = f.value) != null && w.enable) {
99
+ if ((E = f.value) != null && E.enable) {
102
100
  c.value = {
103
101
  loading: !0,
104
102
  text: `第${n.value + 1}张图片检测中,请稍等`
105
- }, (E = e == null ? void 0 : e.onInnerBeforeUploadStart) == null || E.call(
103
+ }, (M = e == null ? void 0 : e.onInnerBeforeUploadStart) == null || M.call(
106
104
  e,
107
105
  l,
108
106
  n.value,
109
107
  v.check
110
108
  );
111
- const o = await be(l, l.name, {
109
+ const o = await Le(l, l.name, {
112
110
  imageMaxSize: f.value.maxSize,
113
111
  imageAllowedType: f.value.allowedType,
114
112
  imageMinWidth: f.value.minWidth,
@@ -183,7 +181,7 @@ const We = /* @__PURE__ */ me({
183
181
  n.value,
184
182
  v.compress
185
183
  );
186
- const o = await Le(i, {
184
+ const o = await Oe(i, {
187
185
  maxSize: C.value.maxSize,
188
186
  size: C.value.size,
189
187
  excludeAllowedTypes: (P = C.value.excludeAllowedTypes) == null ? void 0 : P.map((x) => `image/${x}`)
@@ -217,7 +215,7 @@ const We = /* @__PURE__ */ me({
217
215
  ), t(i);
218
216
  });
219
217
  let I;
220
- return K(
218
+ K(
221
219
  () => c.value,
222
220
  () => {
223
221
  var a;
@@ -227,15 +225,18 @@ const We = /* @__PURE__ */ me({
227
225
  duration: 0
228
226
  }) : (a = I == null ? void 0 : I.close) == null || a.call(I);
229
227
  }
230
- ), ae({
228
+ );
229
+ const me = w(() => r.value.every((a) => a.status && ["done", "error"].includes(a.status)));
230
+ return ae({
231
231
  uploadInsRef: S,
232
- cropperInsRef: $
232
+ cropperInsRef: $,
233
+ isUploadComplete: me
233
234
  }), (a, l) => {
234
235
  var u, d;
235
- const t = he("a-upload");
236
- return X(), Ie("div", null, [
237
- xe(t, {
238
- class: Ce([`${Oe}-upload`]),
236
+ const t = Ie("a-upload");
237
+ return X(), xe("div", null, [
238
+ Ue(t, {
239
+ class: Be([`${$e}-upload`]),
239
240
  ref_key: "uploadInsRef",
240
241
  ref: S,
241
242
  "list-type": "picture-card",
@@ -256,7 +257,7 @@ const We = /* @__PURE__ */ me({
256
257
  onExceedLimit: re,
257
258
  onSuccess: ue,
258
259
  onError: de
259
- }, Be({ _: 2 }, [
260
+ }, we({ _: 2 }, [
260
261
  (u = Z(O)) != null && u.image ? {
261
262
  name: "image",
262
263
  fn: Y(({ fileItem: i }) => [
@@ -272,7 +273,7 @@ const We = /* @__PURE__ */ me({
272
273
  key: "1"
273
274
  } : void 0
274
275
  ]), 1032, ["class", "tip", "file-list", "action", "headers", "data", "name", "accept", "multiple", "limit", "disabled"]),
275
- p.value && n.value !== void 0 ? (X(), Ue(we, {
276
+ p.value && n.value !== void 0 ? (X(), ye(Ee, {
276
277
  key: 0,
277
278
  ref_key: "cropperInsRef",
278
279
  ref: $,
@@ -282,11 +283,11 @@ const We = /* @__PURE__ */ me({
282
283
  onCancel: ce,
283
284
  onConfirm: fe,
284
285
  onImgLoad: ve
285
- }, null, 8, ["file", "index", "options"])) : ye("", !0)
286
+ }, null, 8, ["file", "index", "options"])) : Ce("", !0)
286
287
  ]);
287
288
  };
288
289
  }
289
290
  });
290
291
  export {
291
- We as default
292
+ He as default
292
293
  };
@@ -521,6 +521,7 @@ declare const ProImageUpload: {
521
521
  listType: import('@arco-design/web-vue/es/upload/interfaces').ListType;
522
522
  }> | undefined>;
523
523
  cropperInsRef: import('vue').Ref<any, any>;
524
+ isUploadComplete: import('vue').ComputedRef<boolean>;
524
525
  }, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
525
526
  "update:modelValue": (value: import('@arco-design/web-vue').FileItem[]) => any;
526
527
  } & {
@@ -528,9 +529,9 @@ declare const ProImageUpload: {
528
529
  }, import('vue').PublicProps, {
529
530
  name: string;
530
531
  accept: string[];
532
+ disabled: boolean;
531
533
  multiple: boolean;
532
534
  singleLimit: number;
533
- disabled: boolean;
534
535
  hideInnerBeforeUploadLoading: boolean;
535
536
  }, false, {}, {}, import('vue').GlobalComponents, import('vue').GlobalDirectives, string, {
536
537
  uploadInsRef: unknown;
@@ -1099,12 +1100,13 @@ declare const ProImageUpload: {
1099
1100
  listType: import('@arco-design/web-vue/es/upload/interfaces').ListType;
1100
1101
  }> | undefined>;
1101
1102
  cropperInsRef: import('vue').Ref<any, any>;
1103
+ isUploadComplete: import('vue').ComputedRef<boolean>;
1102
1104
  }, {}, {}, {}, {
1103
1105
  name: string;
1104
1106
  accept: string[];
1107
+ disabled: boolean;
1105
1108
  multiple: boolean;
1106
1109
  singleLimit: number;
1107
- disabled: boolean;
1108
1110
  hideInnerBeforeUploadLoading: boolean;
1109
1111
  }>;
1110
1112
  __isFragment?: never;
@@ -1631,6 +1633,7 @@ declare const ProImageUpload: {
1631
1633
  listType: import('@arco-design/web-vue/es/upload/interfaces').ListType;
1632
1634
  }> | undefined>;
1633
1635
  cropperInsRef: import('vue').Ref<any, any>;
1636
+ isUploadComplete: import('vue').ComputedRef<boolean>;
1634
1637
  }, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
1635
1638
  "update:modelValue": (value: import('@arco-design/web-vue').FileItem[]) => any;
1636
1639
  } & {
@@ -1638,9 +1641,9 @@ declare const ProImageUpload: {
1638
1641
  }, string, {
1639
1642
  name: string;
1640
1643
  accept: string[];
1644
+ disabled: boolean;
1641
1645
  multiple: boolean;
1642
1646
  singleLimit: number;
1643
- disabled: boolean;
1644
1647
  hideInnerBeforeUploadLoading: boolean;
1645
1648
  }, {}, string, {}, import('vue').GlobalComponents, import('vue').GlobalDirectives, string, import('vue').ComponentProvideOptions> & import('vue').VNodeProps & import('vue').AllowedComponentProps & import('vue').ComponentCustomProps & (new () => {
1646
1649
  $slots: {
@@ -1,4 +1,4 @@
1
- import { FileItem } from '@arco-design/web-vue';
1
+ import { FileItem, UploadInstance } from '@arco-design/web-vue';
2
2
  import { ImageUploadCheckOptions, ImageUploadCompressorOptions, ImageUploadCropOptions } from '@keyblade/one-travel';
3
3
  export declare enum EImageUploadInnerBeforeUploadStep {
4
4
  check = 1,
@@ -75,3 +75,19 @@ export interface ImageUploadOptions {
75
75
  errorMessage?: string;
76
76
  }) => void;
77
77
  }
78
+ export interface ImageUploadBeforeUploadQueue {
79
+ file: File;
80
+ resolve: (file: File) => void;
81
+ reject: () => void;
82
+ }
83
+ /**
84
+ * 导出实例对象
85
+ */
86
+ export interface ImageUploadRef {
87
+ /** 原始上传组件实例对象 */
88
+ uploadInsRef: UploadInstance;
89
+ /** 剪裁组件对象 */
90
+ cropperInsRef: any;
91
+ /** 是否上传完成 */
92
+ isUploadComplete: boolean;
93
+ }
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@keyblade/pro-components",
3
3
  "description": "KeyBlade Pro Components",
4
4
  "author": "yangshuai <704807396@qq.com>",
5
- "version": "1.13.2",
5
+ "version": "1.13.3",
6
6
  "private": false,
7
7
  "type": "module",
8
8
  "main": "es/index.js",