@keyblade/pro-components 1.12.0-alpha.8 → 1.12.1-alpha.10
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.
- package/es/pro-image-upload/image-upload.vue.d.ts +34 -34
- package/es/pro-image-upload/image-upload.vue.js +105 -125
- package/es/pro-image-upload/index.d.ts +115 -115
- package/es/pro-keep-alive-router-view/index.d.ts +1 -1
- package/es/pro-layout/index.d.ts +1 -1
- package/es/pro-menu/index.d.ts +1 -1
- package/es/pro-page-container/index.d.ts +1 -1
- package/es/pro-page-header/index.d.ts +4 -4
- package/es/pro-page-header/pro-page-header.vue.d.ts +1 -1
- package/es/pro-reuse-tabs/index.d.ts +1 -1
- package/es/style.css +1 -1
- package/package.json +1 -1
- package/es/_virtual/_plugin-vue_export-helper.js +0 -9
- package/es/pro-image-upload/cropper.vue.d.ts +0 -41
- package/es/pro-image-upload/cropper.vue.js +0 -7
- package/es/pro-image-upload/cropper.vue2.js +0 -211
- package/es/pro-image-upload/cropper.vue3.js +0 -1
|
@@ -1,211 +0,0 @@
|
|
|
1
|
-
import { defineComponent as j, ref as d, watch as D, resolveComponent as l, openBlock as M, createBlock as P, normalizeClass as _, withCtx as a, createVNode as e, mergeProps as q, createElementVNode as y, createTextVNode as x, nextTick as C } from "vue";
|
|
2
|
-
import "vue-cropper/dist/index.css";
|
|
3
|
-
import G from "vue-cropper/lib/vue-cropper.vue";
|
|
4
|
-
const i = "keyblade-pro-image-upload-cropper", Q = /* @__PURE__ */ j({
|
|
5
|
-
__name: "cropper",
|
|
6
|
-
props: {
|
|
7
|
-
file: {},
|
|
8
|
-
index: {},
|
|
9
|
-
options: {}
|
|
10
|
-
},
|
|
11
|
-
emits: ["cancel", "confirm", "imgLoad", "reUpload"],
|
|
12
|
-
setup(H, { expose: R, emit: f }) {
|
|
13
|
-
const s = H, o = d(), w = d(), u = d(!0), g = d(!1), m = d({
|
|
14
|
-
autoCropWidth: 100,
|
|
15
|
-
autoCropHeight: 100
|
|
16
|
-
}), W = () => {
|
|
17
|
-
o.value.changeScale(1);
|
|
18
|
-
}, z = () => {
|
|
19
|
-
o.value.changeScale(-1);
|
|
20
|
-
}, I = () => {
|
|
21
|
-
o.value.rotateRight();
|
|
22
|
-
const { w: t, h: n } = v();
|
|
23
|
-
C(() => {
|
|
24
|
-
o.value.goAutoCrop(t, n);
|
|
25
|
-
});
|
|
26
|
-
}, L = () => {
|
|
27
|
-
o.value.rotateLeft();
|
|
28
|
-
const { w: t, h: n } = v();
|
|
29
|
-
C(() => {
|
|
30
|
-
o.value.goAutoCrop(t, n);
|
|
31
|
-
});
|
|
32
|
-
}, $ = () => {
|
|
33
|
-
o.value.reload(), o.value.rotateClear(), C(() => {
|
|
34
|
-
o.value.goAutoCrop();
|
|
35
|
-
});
|
|
36
|
-
}, b = () => {
|
|
37
|
-
f("cancel");
|
|
38
|
-
}, N = () => {
|
|
39
|
-
u.value || g.value || (g.value = !0, o.value.getCropBlob((t) => {
|
|
40
|
-
g.value = !1;
|
|
41
|
-
const n = new File([t], s.file.name, { type: "image/jpeg" });
|
|
42
|
-
f("confirm", n);
|
|
43
|
-
}));
|
|
44
|
-
}, S = () => {
|
|
45
|
-
u.value = !1;
|
|
46
|
-
const { w: t, h: n } = v();
|
|
47
|
-
m.value.autoCropWidth = t, m.value.autoCropHeight = n, f("imgLoad", s.file);
|
|
48
|
-
}, v = () => {
|
|
49
|
-
const t = Math.abs(o.value.rotate) % 2 > 0, n = (t ? o.value.trueHeight : o.value.trueWidth) * o.value.scale, r = (t ? o.value.trueWidth : o.value.trueHeight) * o.value.scale;
|
|
50
|
-
return { w: n, h: r };
|
|
51
|
-
};
|
|
52
|
-
return D(
|
|
53
|
-
() => s.file,
|
|
54
|
-
() => {
|
|
55
|
-
if (s.file) {
|
|
56
|
-
u.value = !0, o.value && o.value.clearCrop();
|
|
57
|
-
const t = new FileReader();
|
|
58
|
-
t.onloadend = () => {
|
|
59
|
-
const n = t.result, r = new Image();
|
|
60
|
-
r.onload = () => {
|
|
61
|
-
const h = r.width, c = r.height;
|
|
62
|
-
w.value = {
|
|
63
|
-
data: n,
|
|
64
|
-
width: h,
|
|
65
|
-
height: c
|
|
66
|
-
};
|
|
67
|
-
}, r.src = n;
|
|
68
|
-
}, t.readAsDataURL(s.file);
|
|
69
|
-
}
|
|
70
|
-
},
|
|
71
|
-
{ immediate: !0 }
|
|
72
|
-
), R({
|
|
73
|
-
cropperInsRef: o
|
|
74
|
-
}), (t, n) => {
|
|
75
|
-
const r = l("a-spin"), h = l("icon-zoom-in"), c = l("a-button"), p = l("a-tooltip"), A = l("icon-zoom-out"), B = l("icon-rotate-right"), V = l("icon-rotate-left"), E = l("icon-sync"), F = l("a-button-group"), T = l("a-space"), U = l("a-modal");
|
|
76
|
-
return M(), P(U, {
|
|
77
|
-
"render-to-body": "",
|
|
78
|
-
class: _(`${i}-dialog`),
|
|
79
|
-
title: "编辑图片",
|
|
80
|
-
width: "675px",
|
|
81
|
-
visible: !0,
|
|
82
|
-
footer: !1,
|
|
83
|
-
"mask-closable": !1,
|
|
84
|
-
"esc-to-close": !1,
|
|
85
|
-
"unmount-on-close": "",
|
|
86
|
-
onClose: b
|
|
87
|
-
}, {
|
|
88
|
-
default: a(() => [
|
|
89
|
-
e(r, {
|
|
90
|
-
class: _(`${i}-dialog-cropper-wrapper`),
|
|
91
|
-
loading: u.value
|
|
92
|
-
}, {
|
|
93
|
-
default: a(() => {
|
|
94
|
-
var k;
|
|
95
|
-
return [
|
|
96
|
-
e(G, q({
|
|
97
|
-
ref_key: "cropperInsRef",
|
|
98
|
-
ref: o,
|
|
99
|
-
class: `${i}-dialog-cropper`,
|
|
100
|
-
img: (k = w.value) == null ? void 0 : k.data,
|
|
101
|
-
info: !1,
|
|
102
|
-
autoCrop: !0,
|
|
103
|
-
autoCropWidth: m.value.autoCropWidth,
|
|
104
|
-
autoCropHeight: m.value.autoCropHeight,
|
|
105
|
-
full: !0
|
|
106
|
-
}, t.options, { onImgLoad: S }), null, 16, ["class", "img", "autoCropWidth", "autoCropHeight"])
|
|
107
|
-
];
|
|
108
|
-
}),
|
|
109
|
-
_: 1
|
|
110
|
-
}, 8, ["class", "loading"]),
|
|
111
|
-
y("div", {
|
|
112
|
-
class: _(`${i}-dialog-operate`)
|
|
113
|
-
}, [
|
|
114
|
-
e(F, { type: "primary" }, {
|
|
115
|
-
default: a(() => [
|
|
116
|
-
e(p, { content: "放大" }, {
|
|
117
|
-
default: a(() => [
|
|
118
|
-
e(c, { onClick: W }, {
|
|
119
|
-
icon: a(() => [
|
|
120
|
-
e(h)
|
|
121
|
-
]),
|
|
122
|
-
_: 1
|
|
123
|
-
})
|
|
124
|
-
]),
|
|
125
|
-
_: 1
|
|
126
|
-
}),
|
|
127
|
-
e(p, { content: "缩小" }, {
|
|
128
|
-
default: a(() => [
|
|
129
|
-
e(c, { onClick: z }, {
|
|
130
|
-
icon: a(() => [
|
|
131
|
-
e(A)
|
|
132
|
-
]),
|
|
133
|
-
_: 1
|
|
134
|
-
})
|
|
135
|
-
]),
|
|
136
|
-
_: 1
|
|
137
|
-
}),
|
|
138
|
-
e(p, { content: "向右旋转" }, {
|
|
139
|
-
default: a(() => [
|
|
140
|
-
e(c, { onClick: I }, {
|
|
141
|
-
icon: a(() => [
|
|
142
|
-
e(B)
|
|
143
|
-
]),
|
|
144
|
-
_: 1
|
|
145
|
-
})
|
|
146
|
-
]),
|
|
147
|
-
_: 1
|
|
148
|
-
}),
|
|
149
|
-
e(p, { content: "向左旋转" }, {
|
|
150
|
-
default: a(() => [
|
|
151
|
-
e(c, { onClick: L }, {
|
|
152
|
-
icon: a(() => [
|
|
153
|
-
e(V)
|
|
154
|
-
]),
|
|
155
|
-
_: 1
|
|
156
|
-
})
|
|
157
|
-
]),
|
|
158
|
-
_: 1
|
|
159
|
-
}),
|
|
160
|
-
e(p, { content: "重置" }, {
|
|
161
|
-
default: a(() => [
|
|
162
|
-
e(c, { onClick: $ }, {
|
|
163
|
-
icon: a(() => [
|
|
164
|
-
e(E)
|
|
165
|
-
]),
|
|
166
|
-
_: 1
|
|
167
|
-
})
|
|
168
|
-
]),
|
|
169
|
-
_: 1
|
|
170
|
-
})
|
|
171
|
-
]),
|
|
172
|
-
_: 1
|
|
173
|
-
})
|
|
174
|
-
], 2),
|
|
175
|
-
y("div", {
|
|
176
|
-
class: _(`${i}-dialog-footer`)
|
|
177
|
-
}, [
|
|
178
|
-
e(T, {
|
|
179
|
-
class: _(`${i}-dialog-footer-right`)
|
|
180
|
-
}, {
|
|
181
|
-
default: a(() => [
|
|
182
|
-
e(c, { onClick: b }, {
|
|
183
|
-
default: a(() => [
|
|
184
|
-
x("取消")
|
|
185
|
-
]),
|
|
186
|
-
_: 1
|
|
187
|
-
}),
|
|
188
|
-
e(c, {
|
|
189
|
-
disabled: u.value,
|
|
190
|
-
type: "primary",
|
|
191
|
-
onClick: N,
|
|
192
|
-
loading: g.value
|
|
193
|
-
}, {
|
|
194
|
-
default: a(() => [
|
|
195
|
-
x("确定")
|
|
196
|
-
]),
|
|
197
|
-
_: 1
|
|
198
|
-
}, 8, ["disabled", "loading"])
|
|
199
|
-
]),
|
|
200
|
-
_: 1
|
|
201
|
-
}, 8, ["class"])
|
|
202
|
-
], 2)
|
|
203
|
-
]),
|
|
204
|
-
_: 1
|
|
205
|
-
}, 8, ["class"]);
|
|
206
|
-
};
|
|
207
|
-
}
|
|
208
|
-
});
|
|
209
|
-
export {
|
|
210
|
-
Q as default
|
|
211
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
|