@king-one/antdv 1.0.95 → 1.0.97

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 (60) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/dist/es/components/cover-scroll-bar/hooks/use-has-scroll.mjs +17 -0
  3. package/dist/es/components/cover-scroll-bar/index.mjs +10 -0
  4. package/dist/es/components/cover-scroll-bar/src/cover-scroll-bar.mjs +146 -0
  5. package/dist/es/components/cover-scroll-bar/src/types.mjs +17 -0
  6. package/dist/es/components/cover-scroll-bar/style/index.mjs +2 -0
  7. package/dist/es/components/index.mjs +30 -25
  8. package/dist/es/components/pro-contract-view/hooks/use-contract-view.mjs +24 -0
  9. package/dist/es/components/pro-contract-view/index.mjs +11 -0
  10. package/dist/es/components/pro-contract-view/src/pro-contract-view.vue.mjs +4 -0
  11. package/dist/es/components/pro-contract-view/src/pro-contract-view.vue2.mjs +41 -0
  12. package/dist/es/components/pro-contract-view/src/types.mjs +13 -0
  13. package/dist/es/components/pro-contract-view/style/index.mjs +2 -0
  14. package/dist/es/components/pro-loading/index.mjs +5 -0
  15. package/dist/es/components/pro-loading/src/pro-loading.mjs +59 -0
  16. package/dist/es/components/pro-loading/src/types.mjs +1 -0
  17. package/dist/es/components/pro-upload/src/file-list.mjs +5 -5
  18. package/dist/es/components/pro-upload/src/gd-upload.mjs +62 -57
  19. package/dist/es/components/pro-upload/src/hooks/useUpload.mjs +24 -21
  20. package/dist/es/index.mjs +54 -44
  21. package/dist/lib/components/cover-scroll-bar/hooks/use-has-scroll.js +1 -0
  22. package/dist/lib/components/cover-scroll-bar/index.js +1 -0
  23. package/dist/lib/components/cover-scroll-bar/src/cover-scroll-bar.js +1 -0
  24. package/dist/lib/components/cover-scroll-bar/src/types.js +1 -0
  25. package/dist/lib/components/cover-scroll-bar/style/index.js +1 -0
  26. package/dist/lib/components/index.js +1 -1
  27. package/dist/lib/components/pro-contract-view/hooks/use-contract-view.js +1 -0
  28. package/dist/lib/components/pro-contract-view/index.js +1 -0
  29. package/dist/lib/components/pro-contract-view/src/pro-contract-view.vue.js +1 -0
  30. package/dist/lib/components/pro-contract-view/src/pro-contract-view.vue2.js +1 -0
  31. package/dist/lib/components/pro-contract-view/src/types.js +1 -0
  32. package/dist/lib/components/pro-contract-view/style/index.js +1 -0
  33. package/dist/lib/components/pro-loading/index.js +1 -0
  34. package/dist/lib/components/pro-loading/src/pro-loading.js +1 -0
  35. package/dist/lib/components/pro-loading/src/types.js +1 -0
  36. package/dist/lib/components/pro-upload/src/file-list.js +1 -1
  37. package/dist/lib/components/pro-upload/src/gd-upload.js +1 -1
  38. package/dist/lib/components/pro-upload/src/hooks/useUpload.js +1 -1
  39. package/dist/lib/index.js +1 -1
  40. package/dist/theme-chalk/cover-scroll-bar.css +1 -0
  41. package/dist/theme-chalk/icon.css +1 -1
  42. package/dist/theme-chalk/index.css +1 -1
  43. package/dist/theme-chalk/pro-contract-view.css +1 -0
  44. package/dist/types/components/cover-scroll-bar/hooks/use-has-scroll.d.ts +5 -0
  45. package/dist/types/components/cover-scroll-bar/index.d.ts +47 -0
  46. package/dist/types/components/cover-scroll-bar/src/cover-scroll-bar.d.ts +45 -0
  47. package/dist/types/components/cover-scroll-bar/src/types.d.ts +15 -0
  48. package/dist/types/components/index.d.ts +3 -0
  49. package/dist/types/components/pro-contract-view/apis/pro-contract-view.api.d.ts +3 -0
  50. package/dist/types/components/pro-contract-view/hooks/use-contract-view.d.ts +28 -0
  51. package/dist/types/components/pro-contract-view/index.d.ts +25 -0
  52. package/dist/types/components/pro-contract-view/src/pro-contract-view.vue.d.ts +22 -0
  53. package/dist/types/components/pro-contract-view/src/types.d.ts +24 -0
  54. package/dist/types/components/pro-loading/index.d.ts +2 -0
  55. package/dist/types/components/pro-loading/src/pro-loading.d.ts +12 -0
  56. package/dist/types/components/pro-loading/src/types.d.ts +7 -0
  57. package/dist/types/components/pro-upload/index.d.ts +2 -0
  58. package/dist/types/components/pro-upload/src/gd-upload.d.ts +2 -0
  59. package/global.d.ts +3 -0
  60. package/package.json +1 -1
package/CHANGELOG.md CHANGED
@@ -1,5 +1,17 @@
1
1
  # @king-one/antdv
2
2
 
3
+ ## 1.0.97
4
+
5
+ ### Patch Changes
6
+
7
+ - feat:增加新的滚动条组件
8
+
9
+ ## 1.0.96
10
+
11
+ ### Patch Changes
12
+
13
+ - king-one 中导入 pro-upload 组件
14
+
3
15
  ## 1.0.95
4
16
 
5
17
  ### Patch Changes
@@ -0,0 +1,17 @@
1
+ import { ref as l, unref as i, onMounted as u, onBeforeUnmount as h } from "vue";
2
+ function v(o, a = 0) {
3
+ const s = l(!1), c = l(!1), r = () => {
4
+ const e = i(o);
5
+ e && (s.value = e.scrollWidth > e.clientWidth - a, c.value = e.scrollHeight > e.clientHeight);
6
+ };
7
+ return u(() => {
8
+ r();
9
+ const e = new MutationObserver(r), n = new ResizeObserver(r), t = i(o);
10
+ t && (e.observe(t, { childList: !0, subtree: !0, characterData: !0 }), n.observe(t)), h(() => {
11
+ e.disconnect(), n.disconnect();
12
+ });
13
+ }), { hasHorizontalScroll: s, hasVerticalScroll: c };
14
+ }
15
+ export {
16
+ v as useHasScroll
17
+ };
@@ -0,0 +1,10 @@
1
+ import { withInstall as r } from "../utils/install.mjs";
2
+ import o from "./src/cover-scroll-bar.mjs";
3
+ import "./style/index.mjs";
4
+ import { CoverScrollbarProps as c } from "./src/types.mjs";
5
+ const e = r(o);
6
+ export {
7
+ c as CoverScrollbarProps,
8
+ e as KCoverScrollBar,
9
+ e as default
10
+ };
@@ -0,0 +1,146 @@
1
+ import { defineComponent as j, createVNode as d, ref as l, computed as c, onMounted as q, unref as A, onBeforeUnmount as F } from "vue";
2
+ import { off as P, on as z } from "evtd";
3
+ import { useNamespace as G } from "../../../hooks/use-namespace/index.mjs";
4
+ import { useHasScroll as J } from "../hooks/use-has-scroll.mjs";
5
+ import { CoverScrollbarProps as K } from "./types.mjs";
6
+ const ne = /* @__PURE__ */ j({
7
+ props: K,
8
+ setup(r) {
9
+ const o = l(null), s = l(null), p = l(null), i = l(null), u = l(null), m = l(0), {
10
+ hasVerticalScroll: D
11
+ } = J(o), {
12
+ b: $
13
+ } = G("cover"), V = $("scrollbar");
14
+ function w() {
15
+ o.value && (m.value = o.value.scrollTop);
16
+ }
17
+ const C = () => {
18
+ o.value && (i.value = o.value.clientHeight, u.value = o.value.scrollHeight);
19
+ const {
20
+ value: e
21
+ } = s;
22
+ e && (p.value = e.offsetHeight);
23
+ };
24
+ function S() {
25
+ C(), w();
26
+ }
27
+ const f = l(!1), M = c(() => {
28
+ const {
29
+ value: e
30
+ } = i, {
31
+ value: t
32
+ } = u, {
33
+ value: n
34
+ } = p;
35
+ return !e || !t || !n ? 0 : Math.min(e, n * e / t + 5 * 1.5);
36
+ }), E = c(() => `${M.value}px`), L = c(() => {
37
+ const {
38
+ value: e
39
+ } = i, {
40
+ value: t
41
+ } = m, {
42
+ value: n
43
+ } = u, {
44
+ value: v
45
+ } = p;
46
+ if (e === null || n === null || v === null)
47
+ return 0;
48
+ {
49
+ const R = n - e;
50
+ return R ? t / R * (v - M.value) : 0;
51
+ }
52
+ }), O = c(() => `${L.value}px`), U = c(() => {
53
+ const {
54
+ trigger: e
55
+ } = r;
56
+ return e !== "none" && (e === "always" || f.value);
57
+ });
58
+ let h = !1, y = 0, g = 0, B, b;
59
+ const T = (e) => {
60
+ if (!h) return;
61
+ b !== void 0 && window.clearTimeout(b), B !== void 0 && window.clearTimeout(B);
62
+ const {
63
+ value: t
64
+ } = i, {
65
+ value: n
66
+ } = u, {
67
+ value: v
68
+ } = M;
69
+ if (t === null || n === null) return;
70
+ const _ = (e.clientY - g) * (n - t) / (t - v), k = n - t;
71
+ let a = y + _;
72
+ a = Math.min(k, a), a = Math.max(a, 0);
73
+ const {
74
+ value: x
75
+ } = o;
76
+ x && (x.scrollTop = a);
77
+ }, Y = (e) => {
78
+ e.preventDefault(), e.stopPropagation(), P("mousemove", window, T, !0), P("mouseup", window, Y, !0), h = !1, S();
79
+ }, I = (e) => {
80
+ e.preventDefault(), e.stopPropagation(), z("mousemove", window, T, !0), z("mouseup", window, Y, !0), y = m.value, g = e.clientY, h = !0, f.value = !0;
81
+ }, H = new MutationObserver(S);
82
+ q(() => {
83
+ S();
84
+ const e = A(o);
85
+ e && H.observe(e, {
86
+ childList: !0,
87
+ subtree: !0,
88
+ characterData: !0
89
+ });
90
+ }), F(() => {
91
+ H.disconnect();
92
+ });
93
+ function N(e) {
94
+ w();
95
+ }
96
+ return {
97
+ be: V,
98
+ contentRef: o,
99
+ hasVerticalScroll: D,
100
+ showYBarRef: U,
101
+ yRailRef: s,
102
+ yBarSizePxRef: E,
103
+ yBarTopPxRef: O,
104
+ handleScroll: N,
105
+ handleYScrollMouseDown: I,
106
+ handleMouseLeave: () => {
107
+ h || (f.value = !1);
108
+ },
109
+ handleMouseEnter: () => {
110
+ f.value = !0;
111
+ }
112
+ };
113
+ },
114
+ render() {
115
+ var s;
116
+ const {
117
+ $slots: r
118
+ } = this, o = () => d("div", {
119
+ class: `${this.be}-rail`,
120
+ ref: "yRailRef",
121
+ style: {
122
+ right: `${this.scrollbarOffset}px`
123
+ }
124
+ }, [this.hasVerticalScroll && this.showYBarRef && d("div", {
125
+ class: `${this.be}-rail__scrollbar--vertical`,
126
+ style: {
127
+ height: this.yBarSizePxRef,
128
+ top: this.yBarTopPxRef,
129
+ background: this.scrollbarColor
130
+ },
131
+ onMousedown: this.handleYScrollMouseDown
132
+ }, null, 46, ["onMousedown"])], 6);
133
+ return d("div", {
134
+ class: `${this.be}`,
135
+ onMouseenter: this.handleMouseEnter,
136
+ onMouseleave: this.handleMouseLeave
137
+ }, [d("div", {
138
+ ref: "contentRef",
139
+ class: `${this.be}-container`,
140
+ onScroll: this.handleScroll
141
+ }, [(s = r.default) == null ? void 0 : s.call(r)], 42, ["onScroll"]), o()], 42, ["onMouseenter", "onMouseleave"]);
142
+ }
143
+ });
144
+ export {
145
+ ne as default
146
+ };
@@ -0,0 +1,17 @@
1
+ const r = {
2
+ trigger: {
3
+ type: String,
4
+ default: "hover"
5
+ },
6
+ scrollbarColor: {
7
+ type: String,
8
+ default: "rgba(0, 0, 0, 0.1)"
9
+ },
10
+ scrollbarOffset: {
11
+ type: [String, Number],
12
+ default: 2
13
+ }
14
+ };
15
+ export {
16
+ r as CoverScrollbarProps
17
+ };
@@ -0,0 +1,2 @@
1
+ import "../../base/style/index.mjs";
2
+ import "@king-one/antdv/dist/theme-chalk/cover-scroll-bar.css";
@@ -1,29 +1,34 @@
1
- import { KForm as e, KFormItem as t } from "./form/index.mjs";
2
- import { KCollapseTranstion as p } from "./collapse-transtion/index.mjs";
3
- import { KProModal as f } from "./pro-modal/index.mjs";
4
- import { KProTitle as a } from "./pro-title/index.mjs";
5
- import { KScrollBar as P } from "./scroll-bar/index.mjs";
6
- import { KScaleVirtualList as c } from "./scale-virtual-list/index.mjs";
7
- import { KProTag as T } from "./pro-tag/index.mjs";
8
- import { KProPicker as S } from "./pro-picker/index.mjs";
9
- import { KProArea as g } from "./pro-area/index.mjs";
10
- import { KProSignature as F } from "./pro-signature/index.mjs";
1
+ import { KForm as t, KFormItem as m } from "./form/index.mjs";
2
+ import { KCollapseTranstion as K } from "./collapse-transtion/index.mjs";
3
+ import { KProModal as x } from "./pro-modal/index.mjs";
4
+ import { KProTitle as l } from "./pro-title/index.mjs";
5
+ import { KScrollBar as i } from "./scroll-bar/index.mjs";
6
+ import { KCoverScrollBar as n } from "./cover-scroll-bar/index.mjs";
7
+ import { KScaleVirtualList as T } from "./scale-virtual-list/index.mjs";
8
+ import { KProTag as C } from "./pro-tag/index.mjs";
9
+ import { KProPicker as g } from "./pro-picker/index.mjs";
10
+ import { KProArea as B } from "./pro-area/index.mjs";
11
+ import { KProSignature as I } from "./pro-signature/index.mjs";
11
12
  import { KProTable as b } from "./pro-table/index.mjs";
12
- import { KIcon as A } from "./icon/index.mjs";
13
- import { KProUpload as C } from "./pro-upload/index.mjs";
13
+ import { KIcon as v } from "./icon/index.mjs";
14
+ import { KProUpload as A } from "./pro-upload/index.mjs";
15
+ import { KProContractView as M } from "./pro-contract-view/index.mjs";
16
+ import "./pro-loading/index.mjs";
14
17
  export {
15
- p as KCollapseTranstion,
16
- e as KForm,
17
- t as KFormItem,
18
- A as KIcon,
19
- g as KProArea,
20
- f as KProModal,
21
- S as KProPicker,
22
- F as KProSignature,
18
+ K as KCollapseTranstion,
19
+ n as KCoverScrollBar,
20
+ t as KForm,
21
+ m as KFormItem,
22
+ v as KIcon,
23
+ B as KProArea,
24
+ M as KProContractView,
25
+ x as KProModal,
26
+ g as KProPicker,
27
+ I as KProSignature,
23
28
  b as KProTable,
24
- T as KProTag,
25
- a as KProTitle,
26
- C as KProUpload,
27
- c as KScaleVirtualList,
28
- P as KScrollBar
29
+ C as KProTag,
30
+ l as KProTitle,
31
+ A as KProUpload,
32
+ T as KScaleVirtualList,
33
+ i as KScrollBar
29
34
  };
@@ -0,0 +1,24 @@
1
+ import { ref as t, onMounted as i } from "vue";
2
+ function s({
3
+ contractId: e,
4
+ prefix: o = "contract"
5
+ }) {
6
+ const a = t([]), r = t([]);
7
+ return i(() => {
8
+ globalThis.$http.get(`/${o}/file/detail/list`, {
9
+ Headers: {
10
+ useridentity: "aaa",
11
+ token: "1asd"
12
+ },
13
+ params: {
14
+ contractId: e
15
+ }
16
+ });
17
+ }), {
18
+ pages: a,
19
+ fileList: r
20
+ };
21
+ }
22
+ export {
23
+ s as useProContractView
24
+ };
@@ -0,0 +1,11 @@
1
+ import { withInstall as o } from "../utils/install.mjs";
2
+ import "./src/pro-contract-view.vue.mjs";
3
+ import "./style/index.mjs";
4
+ import { useProContractView as n } from "./hooks/use-contract-view.mjs";
5
+ import t from "./src/pro-contract-view.vue2.mjs";
6
+ const e = o(t);
7
+ export {
8
+ e as KProContractView,
9
+ e as default,
10
+ n as useProContractView
11
+ };
@@ -0,0 +1,4 @@
1
+ import f from "./pro-contract-view.vue2.mjs";
2
+ export {
3
+ f as default
4
+ };
@@ -0,0 +1,41 @@
1
+ import { defineComponent as a, ref as n, computed as u, onMounted as p, createElementBlock as i, openBlock as r, normalizeClass as f, createVNode as l, createCommentVNode as m, unref as v } from "vue";
2
+ import { Spin as _ } from "ant-design-vue";
3
+ import { useNamespace as d } from "../../../hooks/use-namespace/index.mjs";
4
+ import { ProContractViewProps as g } from "./types.mjs";
5
+ const h = { key: 0 }, N = /* @__PURE__ */ a({
6
+ __name: "pro-contract-view",
7
+ props: g,
8
+ setup(k) {
9
+ const t = n(!0), o = n(null), { b: c } = d("pro-contract-view"), s = u(() => [
10
+ c()
11
+ ]);
12
+ return p(() => {
13
+ if (o.value) {
14
+ const e = o.value.parentElement;
15
+ !o.value.clientHeight && (e != null && e.offsetHeight) && (o.value.style.height = `${e == null ? void 0 : e.offsetHeight}px`);
16
+ }
17
+ setTimeout(() => {
18
+ t.value = !0;
19
+ }, 1e3);
20
+ }), (e, C) => (r(), i(
21
+ "div",
22
+ {
23
+ ref_key: "containerRef",
24
+ ref: o,
25
+ class: f(s.value)
26
+ },
27
+ [
28
+ l(v(_), {
29
+ tip: "Loading...",
30
+ spinning: t.value
31
+ }, null, 8, ["spinning"]),
32
+ t.value ? m("v-if", !0) : (r(), i("div", h, " 合同预览 "))
33
+ ],
34
+ 2
35
+ /* CLASS */
36
+ ));
37
+ }
38
+ });
39
+ export {
40
+ N as default
41
+ };
@@ -0,0 +1,13 @@
1
+ import { definePropType as e } from "../../utils/install.mjs";
2
+ const t = {
3
+ fileId: {
4
+ type: e(String)
5
+ },
6
+ fileList: {
7
+ type: e(Array),
8
+ default: () => []
9
+ }
10
+ };
11
+ export {
12
+ t as ProContractViewProps
13
+ };
@@ -0,0 +1,2 @@
1
+ import "../../base/style/index.mjs";
2
+ import "@king-one/antdv/dist/theme-chalk/pro-contract-view.css";
@@ -0,0 +1,5 @@
1
+ import { default as t } from "./src/pro-loading.mjs";
2
+ import "./src/types.mjs";
3
+ export {
4
+ t as KProloading
5
+ };
@@ -0,0 +1,59 @@
1
+ import { defineComponent as d, h as a, createApp as p } from "vue";
2
+ import { Spin as m } from "ant-design-vue";
3
+ let i;
4
+ function f(e) {
5
+ const { target: t, ...n } = e, o = d({
6
+ name: "Spin",
7
+ setup() {
8
+ return () => a("div", null, a(m, { ...n }));
9
+ }
10
+ }), r = p(o), c = r.mount(document.createElement("div"));
11
+ function u() {
12
+ var s, l;
13
+ (l = (s = c.$el) == null ? void 0 : s.parentNode) == null || l.removeChild(c.$el), r.unmount(), i = void 0;
14
+ }
15
+ return {
16
+ close: u,
17
+ get $el() {
18
+ return c.$el;
19
+ }
20
+ };
21
+ }
22
+ function g(e = {}) {
23
+ if (i)
24
+ return i;
25
+ const t = y(e), n = f({
26
+ ...t
27
+ });
28
+ return v(n, e), t.target.appendChild(n.$el), i = n, n;
29
+ }
30
+ function y(e) {
31
+ let t;
32
+ return ((o) => typeof o == "string")(e.target) ? t = document.querySelector(e.target) ?? document.body : t = e.target || document.body, {
33
+ ...e,
34
+ target: t
35
+ };
36
+ }
37
+ function v(e, t = {}) {
38
+ const n = {
39
+ position: t.target ? "absolute" : "fixed",
40
+ zIndex: 2e3,
41
+ top: 0,
42
+ right: 0,
43
+ bottom: 0,
44
+ left: 0,
45
+ backgroundColor: "rgba(0, 0, 0, 0.3)",
46
+ display: "flex",
47
+ justifyContent: "center",
48
+ alignItems: "center"
49
+ };
50
+ for (const [o, r] of Object.entries(n))
51
+ e.$el.style[o] = r;
52
+ }
53
+ const C = {
54
+ service: g
55
+ };
56
+ export {
57
+ f as createSpinComponent,
58
+ C as default
59
+ };
@@ -31,7 +31,7 @@ const z = /* @__PURE__ */ u({
31
31
  deleteFileApi: d
32
32
  } = w(i.http), {
33
33
  downloadFile: p
34
- } = v(i.http), n = x(i.list), a = async (t) => {
34
+ } = v(i.http), n = x(i.list), r = async (t) => {
35
35
  try {
36
36
  const l = await d({
37
37
  params: {
@@ -40,9 +40,9 @@ const z = /* @__PURE__ */ u({
40
40
  });
41
41
  l.status === 0 ? (o.success("文件删除成功~"), n.value = n.value.filter((c) => t.id !== c.id), s("update:list", n.value)) : o.error(l.msg);
42
42
  } catch (l) {
43
- console.log(l);
43
+ console.log(l), o.error(l);
44
44
  }
45
- }, r = async (t) => {
45
+ }, a = async (t) => {
46
46
  t.spining = !0, await p([t.id]) && (t.spining = !1);
47
47
  };
48
48
  return () => e(h, null, [n.value.map((t) => e("div", {
@@ -73,7 +73,7 @@ const z = /* @__PURE__ */ u({
73
73
  alignItems: "center",
74
74
  justifyContent: "center"
75
75
  },
76
- onClick: () => a(t)
76
+ onClick: () => r(t)
77
77
  }, [e(y, {
78
78
  style: {
79
79
  fontSize: "8px",
@@ -90,7 +90,7 @@ const z = /* @__PURE__ */ u({
90
90
  color: "#cccccc",
91
91
  cursor: "pointer"
92
92
  },
93
- onClick: () => r(t)
93
+ onClick: () => a(t)
94
94
  }, null, 8, ["onClick"]) : "", e("div", null, [t.type === "img" ? e(m, {
95
95
  src: t.icon,
96
96
  style: {
@@ -1,9 +1,9 @@
1
- import { defineComponent as F, ref as p, computed as W, watch as z, onMounted as H, createVNode as d, Fragment as g } from "vue";
1
+ import { defineComponent as F, ref as f, computed as W, watch as z, onMounted as H, createVNode as d, Fragment as g } from "vue";
2
2
  import { message as h, Upload as I, Spin as R } from "ant-design-vue";
3
3
  import { useNamespace as D } from "../../../hooks/use-namespace/index.mjs";
4
4
  import { KIcon as S } from "../../icon/index.mjs";
5
5
  import { UploadComponentProps as $ } from "./props.mjs";
6
- import { getFileExtension as r, getUploadIcon as x, getBase64 as j } from "./utils/index.mjs";
6
+ import { getFileExtension as m, getUploadIcon as x, getBase64 as j } from "./utils/index.mjs";
7
7
  import "./hooks/index.mjs";
8
8
  import q from "./file-list.mjs";
9
9
  import { useUpload as T } from "./hooks/useUpload.mjs";
@@ -14,72 +14,77 @@ const A = /* @__PURE__ */ F({
14
14
  "update:fileList": (e) => !0,
15
15
  // 文件上传成功
16
16
  "upload-success": (e) => e,
17
- change: (e) => e
17
+ change: (e) => e,
18
+ "upload-error": (e) => e
18
19
  },
19
20
  setup(e, {
20
- emit: u,
21
+ emit: c,
21
22
  expose: y
22
23
  }) {
23
24
  const {
24
25
  b: v
25
- } = D("pro-upload"), l = p([]), m = p(!1), {
26
+ } = D("pro-upload"), l = f([]), r = f(!1), {
26
27
  uploadFile: b,
27
28
  getFileDetails: N,
28
29
  getImgUrl: U
29
30
  } = T(e.http), w = W(() => {
30
31
  if (e.disabled || l.value.length === e.maxCount) return !0;
31
- }), L = (t) => {
32
+ }), L = (i) => {
32
33
  var s;
33
34
  const {
34
- name: i,
35
+ name: t,
35
36
  size: n
36
- } = t, a = r(i), o = n / 1024 / 1024;
37
+ } = i, a = m(t), o = n / 1024 / 1024;
37
38
  return e.accept && e.accept.length > 0 && !e.accept.includes(a) ? (h.warning(`只能上传${(s = e.accept) == null ? void 0 : s.join(".")}后缀的文件!`), !1) : o > e.maxSize ? (h.warning(`上传的文件不能大于${e.maxSize}M!`), !1) : !0;
38
- }, C = async (t) => {
39
- const {
40
- file: i
41
- } = t;
42
- m.value = !0;
43
- const n = await b({
44
- business: e.business,
45
- file: i
46
- });
47
- if (m.value = !1, !n) return;
48
- const a = r(n.originName), o = x(a);
49
- if (o === "img") {
50
- const c = await j(i);
51
- l.value.push({
52
- icon: c,
53
- id: n.id,
54
- type: o,
55
- spining: !1,
56
- fileName: t.file.name
57
- });
58
- } else
59
- l.value.push({
60
- icon: o,
61
- id: n.id,
62
- type: o,
63
- spining: !1,
64
- fileName: t.file.name
39
+ }, C = async (i) => {
40
+ try {
41
+ const {
42
+ file: t
43
+ } = i;
44
+ r.value = !0;
45
+ const n = await b({
46
+ business: e.business,
47
+ file: t
65
48
  });
66
- const s = l.value.map((c) => ({
67
- fileName: c.fileName,
68
- type: c.type,
69
- id: c.id
70
- }));
71
- u("update:fileList", s), u("upload-success", s);
72
- }, f = async (t) => {
73
- const i = t == null ? void 0 : t.map((a) => a.id);
74
- if ((i == null ? void 0 : i.length) === 0) return;
75
- const n = await N(i);
49
+ if (r.value = !1, !n) return;
50
+ const a = m(n.originName), o = x(a);
51
+ if (o === "img") {
52
+ const u = await j(t);
53
+ l.value.push({
54
+ icon: u,
55
+ id: n.id,
56
+ type: o,
57
+ spining: !1,
58
+ fileName: i.file.name
59
+ });
60
+ } else
61
+ l.value.push({
62
+ icon: o,
63
+ id: n.id,
64
+ type: o,
65
+ spining: !1,
66
+ fileName: i.file.name
67
+ });
68
+ const s = l.value.map((u) => ({
69
+ fileName: u.fileName,
70
+ type: u.type,
71
+ id: u.id
72
+ }));
73
+ c("update:fileList", s), c("upload-success", s);
74
+ } catch (t) {
75
+ r.value = !1, c("upload-error", t);
76
+ }
77
+ }, p = async (i) => {
78
+ const t = i == null ? void 0 : i.map((a) => a.id);
79
+ if ((t == null ? void 0 : t.length) === 0) return;
80
+ const n = await N(t);
76
81
  for (const a of n.data) {
77
- const o = r(a.originName), s = x(o);
82
+ const o = m(a.originName), s = x(o);
78
83
  if (s === "img") {
79
- const c = await U([a.id]);
84
+ const u = await U([a.id]);
80
85
  l.value.push({
81
86
  id: a.id,
82
- icon: c[a.id],
87
+ icon: u[a.id],
83
88
  fileName: a.originName,
84
89
  spining: !1,
85
90
  type: s
@@ -94,21 +99,21 @@ const A = /* @__PURE__ */ F({
94
99
  });
95
100
  }
96
101
  };
97
- return z(() => l.value, (t) => {
98
- const i = t.map((n) => ({
102
+ return z(() => l.value, (i) => {
103
+ const t = i.map((n) => ({
99
104
  fileName: n.fileName,
100
105
  type: n.type,
101
106
  id: n.id
102
107
  }));
103
- u("update:fileList", i), u("change", i);
108
+ c("update:fileList", t), c("change", t);
104
109
  }, {
105
110
  deep: !0
106
111
  }), H(async () => {
107
- f(e.fileList);
112
+ p(e.fileList);
108
113
  }), y({
109
- updateFileList: f
114
+ updateFileList: p
110
115
  }), () => {
111
- var t;
116
+ var i;
112
117
  return d("div", {
113
118
  class: v(),
114
119
  style: {
@@ -121,9 +126,9 @@ const A = /* @__PURE__ */ F({
121
126
  itemWidth: e.itemWidth,
122
127
  itemHeight: e.itemHeight,
123
128
  list: l.value,
124
- "onUpdate:list": (i) => l.value = i
129
+ "onUpdate:list": (t) => l.value = t
125
130
  }, null, 8, ["http", "itemWidth", "itemHeight", "list", "onUpdate:list"]), l.value.length < (e.maxCount ?? 20) ? d(I, {
126
- accept: (t = e.accept) == null ? void 0 : t.join(","),
131
+ accept: (i = e.accept) == null ? void 0 : i.join(","),
127
132
  disabled: w.value,
128
133
  customRequest: C,
129
134
  beforeUpload: L,
@@ -132,7 +137,7 @@ const A = /* @__PURE__ */ F({
132
137
  }
133
138
  }, {
134
139
  default: () => d(R, {
135
- spinning: m.value
140
+ spinning: r.value
136
141
  }, {
137
142
  default: () => [d("div", {
138
143
  style: {