@keyblade/pro-components 1.11.7 → 1.12.0-alpha.2
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/_virtual/_plugin-vue_export-helper.js +9 -0
- package/es/components.d.ts +1 -0
- package/es/index.d.ts +1 -0
- package/es/index.js +20 -17
- package/es/pro-image-upload/constant.d.ts +3 -0
- package/es/pro-image-upload/constant.js +15 -0
- package/es/pro-image-upload/cropper.vue.d.ts +41 -0
- package/es/pro-image-upload/cropper.vue.js +7 -0
- package/es/pro-image-upload/cropper.vue2.js +211 -0
- package/es/pro-image-upload/cropper.vue3.js +1 -0
- package/es/pro-image-upload/image-upload.vue.d.ts +539 -0
- package/es/pro-image-upload/image-upload.vue.js +272 -0
- package/es/pro-image-upload/image-upload.vue2.js +4 -0
- package/es/pro-image-upload/index.d.ts +1432 -0
- package/es/pro-image-upload/index.js +11 -0
- package/es/pro-image-upload/types.d.ts +76 -0
- package/es/pro-image-upload/types.js +4 -0
- package/es/pro-layout/index.d.ts +3 -3
- package/es/pro-layout/pro-layout.vue.d.ts +1 -1
- package/es/pro-page-header/index.d.ts +3 -3
- package/es/pro-page-header/pro-page-header.vue.d.ts +1 -1
- package/es/style.css +1 -1
- package/package.json +8 -3
- package/src/index.ts +0 -36
package/es/components.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
declare module 'vue' {
|
|
2
2
|
interface GlobalComponents {
|
|
3
|
+
KbProImageUpload: typeof import('./index')['ProImageUpload'];
|
|
3
4
|
KbProPageHeader: typeof import('./index')['ProPageHeader'];
|
|
4
5
|
KbProKeepAliveRouterView: typeof import('./index')['ProKeepAliveRouterView'];
|
|
5
6
|
KbProLayout: typeof import('./index')['ProLayout'];
|
package/es/index.d.ts
CHANGED
|
@@ -12,4 +12,5 @@ export type { IProMenuItem } from './pro-menu';
|
|
|
12
12
|
export { default as ProPageContainer } from './pro-page-container';
|
|
13
13
|
export { default as ProReuseTabs } from './pro-reuse-tabs';
|
|
14
14
|
export type { IProTab } from './pro-reuse-tabs';
|
|
15
|
+
export { default as ProImageUpload } from './pro-image-upload';
|
|
15
16
|
export type {} from './components';
|
package/es/index.js
CHANGED
|
@@ -1,26 +1,29 @@
|
|
|
1
1
|
import { ProPageHeader as o } from "./pro-page-header/index.js";
|
|
2
|
-
import { default as
|
|
2
|
+
import { default as b } from "./pro-page-header/index.js";
|
|
3
3
|
import { ProKeepAliveRouterView as r } from "./pro-keep-alive-router-view/index.js";
|
|
4
|
-
import { default as
|
|
4
|
+
import { default as w } from "./pro-keep-alive-router-view/index.js";
|
|
5
5
|
import { ProLayout as t } from "./pro-layout/index.js";
|
|
6
|
-
import { default as
|
|
6
|
+
import { default as A } from "./pro-layout/index.js";
|
|
7
7
|
import { ProMenu as a } from "./pro-menu/index.js";
|
|
8
|
-
import { default as
|
|
9
|
-
import { ProPageContainer as
|
|
10
|
-
import { default as
|
|
11
|
-
import { ProReuseTabs as
|
|
12
|
-
import { default as
|
|
13
|
-
|
|
8
|
+
import { default as H } from "./pro-menu/index.js";
|
|
9
|
+
import { ProPageContainer as m } from "./pro-page-container/index.js";
|
|
10
|
+
import { default as K } from "./pro-page-container/index.js";
|
|
11
|
+
import { ProReuseTabs as u } from "./pro-reuse-tabs/index.js";
|
|
12
|
+
import { default as M } from "./pro-reuse-tabs/index.js";
|
|
13
|
+
import { ProImageUpload as f } from "./pro-image-upload/index.js";
|
|
14
|
+
import { default as U } from "./pro-image-upload/index.js";
|
|
15
|
+
const p = {
|
|
14
16
|
install(e) {
|
|
15
|
-
e.use(o), e.use(r), e.use(t), e.use(a), e.use(u), e.use(f);
|
|
17
|
+
e.use(o), e.use(r), e.use(t), e.use(a), e.use(m), e.use(u), e.use(f);
|
|
16
18
|
}
|
|
17
19
|
};
|
|
18
20
|
export {
|
|
19
|
-
|
|
20
|
-
w as
|
|
21
|
-
A as
|
|
22
|
-
H as
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
21
|
+
U as ProImageUpload,
|
|
22
|
+
w as ProKeepAliveRouterView,
|
|
23
|
+
A as ProLayout,
|
|
24
|
+
H as ProMenu,
|
|
25
|
+
K as ProPageContainer,
|
|
26
|
+
b as ProPageHeader,
|
|
27
|
+
M as ProReuseTabs,
|
|
28
|
+
p as default
|
|
26
29
|
};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { defaultImageUploadCheckOptions as e, defaultImageUploadCompressorOptions as o, defaultImageUploadCropOptions as p } from "@keyblade/one-travel";
|
|
2
|
+
const l = {
|
|
3
|
+
name: "file",
|
|
4
|
+
accept: e.allowedType,
|
|
5
|
+
multiple: !0,
|
|
6
|
+
singleLimit: 10,
|
|
7
|
+
disabled: !1,
|
|
8
|
+
hideInnerBeforeUploadLoading: !1,
|
|
9
|
+
checkOptions: e,
|
|
10
|
+
compressorOptions: o,
|
|
11
|
+
cropOptions: p
|
|
12
|
+
};
|
|
13
|
+
export {
|
|
14
|
+
l as defaultImageUploadOptions
|
|
15
|
+
};
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { ImageUploadCropOptions } from '@keyblade/one-travel';
|
|
2
|
+
|
|
3
|
+
declare const _default: import('vue').DefineComponent<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<{
|
|
4
|
+
file: File;
|
|
5
|
+
index: number;
|
|
6
|
+
options: ImageUploadCropOptions;
|
|
7
|
+
}>, {}>, {
|
|
8
|
+
cropperInsRef: import('vue').Ref<any>;
|
|
9
|
+
}, unknown, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
|
|
10
|
+
cancel: () => void;
|
|
11
|
+
confirm: (value: File) => void;
|
|
12
|
+
imgLoad: (value: File) => void;
|
|
13
|
+
reUpload: (index: number) => void;
|
|
14
|
+
}, string, import('vue').VNodeProps & import('vue').AllowedComponentProps & import('vue').ComponentCustomProps, Readonly<import('vue').ExtractPropTypes<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<{
|
|
15
|
+
file: File;
|
|
16
|
+
index: number;
|
|
17
|
+
options: ImageUploadCropOptions;
|
|
18
|
+
}>, {}>>> & {
|
|
19
|
+
onCancel?: (() => any) | undefined;
|
|
20
|
+
onConfirm?: ((value: File) => any) | undefined;
|
|
21
|
+
onImgLoad?: ((value: File) => any) | undefined;
|
|
22
|
+
onReUpload?: ((index: number) => any) | undefined;
|
|
23
|
+
}, {}, {}>;
|
|
24
|
+
export default _default;
|
|
25
|
+
type __VLS_NonUndefinedable<T> = T extends undefined ? never : T;
|
|
26
|
+
type __VLS_TypePropsToRuntimeProps<T> = {
|
|
27
|
+
[K in keyof T]-?: {} extends Pick<T, K> ? {
|
|
28
|
+
type: import('vue').PropType<__VLS_NonUndefinedable<T[K]>>;
|
|
29
|
+
} : {
|
|
30
|
+
type: import('vue').PropType<T[K]>;
|
|
31
|
+
required: true;
|
|
32
|
+
};
|
|
33
|
+
};
|
|
34
|
+
type __VLS_WithDefaults<P, D> = {
|
|
35
|
+
[K in keyof Pick<P, keyof P>]: K extends keyof D ? __VLS_Prettify<P[K] & {
|
|
36
|
+
default: D[K];
|
|
37
|
+
}> : P[K];
|
|
38
|
+
};
|
|
39
|
+
type __VLS_Prettify<T> = {
|
|
40
|
+
[K in keyof T]: T[K];
|
|
41
|
+
} & {};
|
|
@@ -0,0 +1,211 @@
|
|
|
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
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|