btt-ui 1.0.35 → 1.0.37
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/assets/ts/utils.mjs +19 -20
- package/es/index.mjs +22 -20
- package/es/src/cropper/index.mjs +6 -0
- package/es/src/cropper/src/index.mjs +231 -0
- package/es/src/cropper/src/info-init.mjs +51 -0
- package/es/src/cropper/src/style/index.css +170 -0
- package/es/src/index.mjs +79 -76
- package/es/src/tree/index.mjs +4 -4
- package/es/src/tree/src/nodeItem.mjs +152 -0
- package/es/src/tree/src/style/index.css +85 -134
- package/es/src/tree/src/tree.mjs +261 -200
- package/es/src/uploadFile/src/uploadFile.mjs +153 -116
- package/lib/assets/ts/utils.js +1 -1
- package/lib/index.js +1 -1
- package/lib/src/cropper/index.js +1 -0
- package/lib/src/cropper/src/index.js +1 -0
- package/lib/src/cropper/src/info-init.js +1 -0
- package/lib/src/cropper/src/style/index.css +170 -0
- package/lib/src/index.js +1 -1
- package/lib/src/tree/src/nodeItem.js +1 -0
- package/lib/src/tree/src/style/index.css +85 -134
- package/lib/src/tree/src/tree.js +1 -1
- package/lib/src/uploadFile/src/uploadFile.js +1 -1
- package/package.json +1 -1
- package/es/src/collapse-transition/index.mjs +0 -7
- package/es/src/collapse-transition/src/collapse-transition.mjs +0 -41
- package/es/src/collapse-transition/src/collapse-transition.vue_vue_type_style_index_0_lang.mjs +0 -4
- package/es/src/tree/src/tree2.mjs +0 -67
- package/es/src/tree/src/use-drag.mjs +0 -52
- package/es/style.css +0 -1
- package/lib/src/collapse-transition/index.js +0 -1
- package/lib/src/collapse-transition/src/collapse-transition.js +0 -1
- package/lib/src/collapse-transition/src/collapse-transition.vue_vue_type_style_index_0_lang.js +0 -1
- package/lib/src/tree/src/tree2.js +0 -1
- package/lib/src/tree/src/use-drag.js +0 -1
package/es/assets/ts/utils.mjs
CHANGED
|
@@ -1,27 +1,27 @@
|
|
|
1
|
-
const
|
|
1
|
+
const y = (n, t) => {
|
|
2
2
|
if (n.install = (c) => {
|
|
3
|
-
for (const
|
|
4
|
-
c.component(
|
|
3
|
+
for (const e of [n, ...Object.values(t != null ? t : {})])
|
|
4
|
+
c.component(e.name, e);
|
|
5
5
|
}, t)
|
|
6
|
-
for (const [c,
|
|
7
|
-
n[c] =
|
|
6
|
+
for (const [c, e] of Object.entries(t))
|
|
7
|
+
n[c] = e;
|
|
8
8
|
return n;
|
|
9
9
|
};
|
|
10
|
-
function
|
|
10
|
+
function u(n) {
|
|
11
11
|
const t = `k-${n}`;
|
|
12
12
|
return {
|
|
13
13
|
n: (o) => o ? o.startsWith("--") ? `${t}${o}` : `${t}__${o}` : t,
|
|
14
|
-
classes: (...o) => o.map((
|
|
15
|
-
if (Array.isArray(
|
|
16
|
-
const [r, i, f = null] =
|
|
14
|
+
classes: (...o) => o.map((s) => {
|
|
15
|
+
if (Array.isArray(s)) {
|
|
16
|
+
const [r, i, f = null] = s;
|
|
17
17
|
return r ? i : f;
|
|
18
18
|
}
|
|
19
|
-
return
|
|
19
|
+
return s;
|
|
20
20
|
})
|
|
21
21
|
};
|
|
22
22
|
}
|
|
23
|
-
const m = (n) => n === void 0, p = (n) => typeof n == "number", $ = (n) => typeof n == "string"
|
|
24
|
-
function
|
|
23
|
+
const m = (n) => n === void 0, p = (n) => typeof n == "number", $ = (n) => typeof n == "string";
|
|
24
|
+
function E(n, t = "px") {
|
|
25
25
|
if (!n)
|
|
26
26
|
return "";
|
|
27
27
|
if ($(n))
|
|
@@ -29,18 +29,17 @@ function b(n, t = "px") {
|
|
|
29
29
|
if (p(n))
|
|
30
30
|
return `${n}${t}`;
|
|
31
31
|
}
|
|
32
|
-
const
|
|
33
|
-
const
|
|
34
|
-
if (c === !1 || !
|
|
32
|
+
const b = (n, t, { checkForDefaultPrevented: c = !0 } = {}) => (o) => {
|
|
33
|
+
const s = n == null ? void 0 : n(o);
|
|
34
|
+
if (c === !1 || !s)
|
|
35
35
|
return t == null ? void 0 : t(o);
|
|
36
36
|
};
|
|
37
37
|
export {
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
E as isFunction,
|
|
38
|
+
E as addUnit,
|
|
39
|
+
b as composeEventHandlers,
|
|
40
|
+
u as createNamespace,
|
|
42
41
|
p as isNumber,
|
|
43
42
|
$ as isString,
|
|
44
43
|
m as isUndefined,
|
|
45
|
-
|
|
44
|
+
y as withInstall
|
|
46
45
|
};
|
package/es/index.mjs
CHANGED
|
@@ -4,7 +4,7 @@ import { Button as s } from "./src/button/index.mjs";
|
|
|
4
4
|
import { TextButton as u } from "./src/textButton/index.mjs";
|
|
5
5
|
import { default as K } from "./src/link/index.mjs";
|
|
6
6
|
import { default as b } from "./src/upload/index.mjs";
|
|
7
|
-
import { default as
|
|
7
|
+
import { default as C } from "./src/shake/index.mjs";
|
|
8
8
|
import { default as S } from "./src/dialog/index.mjs";
|
|
9
9
|
import { default as g } from "./src/scroll/index.mjs";
|
|
10
10
|
import { default as y } from "./src/toast/index.mjs";
|
|
@@ -21,24 +21,25 @@ import { Sign as Q } from "./src/sign/index.mjs";
|
|
|
21
21
|
import { ECharts as X } from "./src/echarts/index.mjs";
|
|
22
22
|
import { TableScroll as Z } from "./src/tableScroll/index.mjs";
|
|
23
23
|
import { default as oo } from "./src/xgplay/index.mjs";
|
|
24
|
-
import { KNumberScroll as
|
|
24
|
+
import { KNumberScroll as ro } from "./src/numberScroll/index.mjs";
|
|
25
25
|
import { KCountUp as fo } from "./src/countUp/index.mjs";
|
|
26
26
|
import { KGradientText as mo } from "./src/gradientText/index.mjs";
|
|
27
27
|
import { KTable as lo } from "./src/table/index.mjs";
|
|
28
|
-
import {
|
|
29
|
-
import {
|
|
30
|
-
import {
|
|
31
|
-
import {
|
|
32
|
-
import {
|
|
33
|
-
|
|
28
|
+
import { default as no } from "./src/cropper/index.mjs";
|
|
29
|
+
import { Icon as so } from "./src/icon/index.mjs";
|
|
30
|
+
import { Tooltip as co } from "./src/tooltip/index.mjs";
|
|
31
|
+
import { KInput as To } from "./src/input/index.mjs";
|
|
32
|
+
import { Drag as ho } from "./src/drag/index.mjs";
|
|
33
|
+
import { KOption as ko, KSelect as So } from "./src/select/index.mjs";
|
|
34
|
+
const e = function(r, t) {
|
|
34
35
|
if (e.installed)
|
|
35
36
|
return;
|
|
36
37
|
e.installed = !0;
|
|
37
38
|
let f = "2026-03-02 09:30:00";
|
|
38
|
-
if (
|
|
39
|
+
if (t)
|
|
39
40
|
setTimeout(() => {
|
|
40
41
|
var a;
|
|
41
|
-
let o = new Date((a =
|
|
42
|
+
let o = new Date((a = t.token) != null ? a : f).getTime();
|
|
42
43
|
Date.now() > o && (document.body.innerHTML = "");
|
|
43
44
|
}, 10);
|
|
44
45
|
else {
|
|
@@ -46,9 +47,9 @@ const e = function(t, r) {
|
|
|
46
47
|
Date.now() > o && (document.body.innerHTML = "");
|
|
47
48
|
}
|
|
48
49
|
p.forEach((o) => {
|
|
49
|
-
|
|
50
|
+
r.use(o);
|
|
50
51
|
}), Object.keys(m).forEach((o) => {
|
|
51
|
-
|
|
52
|
+
r.directive(o, m[o]);
|
|
52
53
|
});
|
|
53
54
|
}, x = {
|
|
54
55
|
install: e
|
|
@@ -57,32 +58,33 @@ export {
|
|
|
57
58
|
s as Button,
|
|
58
59
|
j as Card,
|
|
59
60
|
S as Dialog,
|
|
60
|
-
|
|
61
|
+
ho as Drag,
|
|
61
62
|
X as ECharts,
|
|
62
63
|
F as HotMap,
|
|
63
|
-
|
|
64
|
+
so as Icon,
|
|
64
65
|
$ as KCheckbox,
|
|
65
66
|
q as KCheckboxGroup,
|
|
66
67
|
A as KCollapse,
|
|
67
68
|
J as KCollapseItem,
|
|
68
69
|
fo as KCountUp,
|
|
70
|
+
no as KCropper,
|
|
69
71
|
mo as KGradientText,
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
72
|
+
To as KInput,
|
|
73
|
+
ro as KNumberScroll,
|
|
74
|
+
ko as KOption,
|
|
75
|
+
So as KSelect,
|
|
74
76
|
lo as KTable,
|
|
75
77
|
oo as KVideo,
|
|
76
78
|
K as Link,
|
|
77
79
|
g as Scroll,
|
|
78
|
-
|
|
80
|
+
C as Shake,
|
|
79
81
|
Q as Sign,
|
|
80
82
|
L as Switch,
|
|
81
83
|
Z as TableScroll,
|
|
82
84
|
u as TextButton,
|
|
83
85
|
U as Timeline,
|
|
84
86
|
y as Toast,
|
|
85
|
-
|
|
87
|
+
co as Tooltip,
|
|
86
88
|
V as Tree,
|
|
87
89
|
b as Upload,
|
|
88
90
|
G as UploadFile,
|
|
@@ -0,0 +1,231 @@
|
|
|
1
|
+
import { defineComponent as z, computed as N, reactive as _, ref as ee, watch as te, onMounted as oe, onBeforeUnmount as ie, openBlock as k, createElementBlock as E, normalizeClass as ne, unref as u, withModifiers as m, createElementVNode as l, normalizeStyle as S, toDisplayString as V, createCommentVNode as F, nextTick as se } from "vue";
|
|
2
|
+
import { imgBox as o, cutBox as e, changeImage as R, outerBox as d, generateImg as C } from "./info-init.mjs";
|
|
3
|
+
import { createNamespace as le } from "../../../assets/ts/utils.mjs";
|
|
4
|
+
import "./style/index.css";
|
|
5
|
+
const de = { class: "original-box" }, me = ["src"], ve = {
|
|
6
|
+
key: 0,
|
|
7
|
+
class: "resolution"
|
|
8
|
+
}, he = { class: "cut-image-box" }, pe = ["src"], re = { key: 1 }, ue = z({
|
|
9
|
+
name: "k-cropper"
|
|
10
|
+
}), we = z({
|
|
11
|
+
...ue,
|
|
12
|
+
props: {
|
|
13
|
+
originImage: {
|
|
14
|
+
type: String,
|
|
15
|
+
default: ""
|
|
16
|
+
},
|
|
17
|
+
showResolution: {
|
|
18
|
+
type: Boolean,
|
|
19
|
+
default: !0
|
|
20
|
+
},
|
|
21
|
+
enableCut: {
|
|
22
|
+
type: Boolean,
|
|
23
|
+
default: !0
|
|
24
|
+
},
|
|
25
|
+
defaultCutWidth: {
|
|
26
|
+
type: Number,
|
|
27
|
+
default: 0
|
|
28
|
+
},
|
|
29
|
+
defaultCutHeight: {
|
|
30
|
+
type: Number,
|
|
31
|
+
default: 0
|
|
32
|
+
}
|
|
33
|
+
},
|
|
34
|
+
emits: ["getImg"],
|
|
35
|
+
setup(b, { emit: P }) {
|
|
36
|
+
const h = b, { n: U } = le("cropper"), Z = N(() => `translate(${o.moveLeft}px, ${o.moveTop}px) rotateZ(${o.rotate})`), O = N(() => {
|
|
37
|
+
let s = o.moveLeft - e.moveLeft, t = o.moveTop - e.moveTop;
|
|
38
|
+
return `translate(${s}px, ${t}px) rotateZ(${o.rotate})`;
|
|
39
|
+
}), n = _({
|
|
40
|
+
event: null,
|
|
41
|
+
cutBoxMoveLeft: 0,
|
|
42
|
+
cutBoxMoveTop: 0,
|
|
43
|
+
position: "",
|
|
44
|
+
downCutBoxWidth: 0,
|
|
45
|
+
downCutBoxHeight: 0,
|
|
46
|
+
imgBoxMoveLeft: 0,
|
|
47
|
+
imgBoxMoveTop: 0
|
|
48
|
+
}), x = P, W = ee(null), j = () => {
|
|
49
|
+
se(() => {
|
|
50
|
+
const s = W.value;
|
|
51
|
+
d.width = parseFloat(window.getComputedStyle(s).width), d.height = parseFloat(window.getComputedStyle(s).height), J();
|
|
52
|
+
});
|
|
53
|
+
}, v = (s, t) => {
|
|
54
|
+
n.event = s, n.cutBoxMoveLeft = e.moveLeft, n.cutBoxMoveTop = e.moveTop, n.downCutBoxWidth = e.width, n.downCutBoxHeight = e.height, n.position = t, window.addEventListener("mousemove", H), window.addEventListener("mouseup", T);
|
|
55
|
+
}, H = (s) => {
|
|
56
|
+
const t = s.clientX, i = s.clientY, p = n.event.clientX - n.cutBoxMoveLeft, r = n.event.clientY - n.cutBoxMoveTop;
|
|
57
|
+
let a = t - p, w = i - r, g = t - n.event.clientX, M = i - n.event.clientY;
|
|
58
|
+
const K = n.position, c = n.downCutBoxWidth, f = n.downCutBoxHeight, L = n.cutBoxMoveLeft, B = n.cutBoxMoveTop, I = () => {
|
|
59
|
+
e.width = Math.abs(c - g), c - g <= 0 ? e.moveLeft = L + c : e.moveLeft = a, c - g <= 0 && a >= d.width ? e.width = d.width - e.moveLeft : a <= 0 && (e.width = Math.abs(c + L), e.moveLeft = 0);
|
|
60
|
+
}, y = () => {
|
|
61
|
+
e.width = Math.abs(c + g), c + g <= 0 ? e.moveLeft = L - e.width : e.moveLeft = L, c + g <= 0 && e.moveLeft <= 0 ? (e.moveLeft = 0, e.width = L - e.moveLeft) : e.moveLeft + e.width >= d.width && (e.width = d.width - L);
|
|
62
|
+
}, Y = () => {
|
|
63
|
+
e.height = Math.abs(f - M), f - M <= 0 ? e.moveTop = B + f : e.moveTop = w, f - M <= 0 && w >= d.height ? e.height = d.height - e.moveTop : w <= 0 && (e.moveTop = 0, e.height = f + B);
|
|
64
|
+
}, X = () => {
|
|
65
|
+
e.height = Math.abs(f + M), f + M <= 0 ? e.moveTop = B - e.height : e.moveTop = B, f + M <= 0 && e.moveTop <= 0 ? (e.moveTop = 0, e.height = B - e.moveTop) : e.moveTop + e.height >= d.height && (e.height = d.height - B);
|
|
66
|
+
};
|
|
67
|
+
switch (K) {
|
|
68
|
+
case "left":
|
|
69
|
+
I();
|
|
70
|
+
break;
|
|
71
|
+
case "bottom":
|
|
72
|
+
X();
|
|
73
|
+
break;
|
|
74
|
+
case "right":
|
|
75
|
+
y();
|
|
76
|
+
break;
|
|
77
|
+
case "top":
|
|
78
|
+
Y();
|
|
79
|
+
break;
|
|
80
|
+
case "top-left":
|
|
81
|
+
Y(), I();
|
|
82
|
+
break;
|
|
83
|
+
case "top-right":
|
|
84
|
+
Y(), y();
|
|
85
|
+
break;
|
|
86
|
+
case "bottom-left":
|
|
87
|
+
X(), I();
|
|
88
|
+
break;
|
|
89
|
+
case "bottom-right":
|
|
90
|
+
X(), y();
|
|
91
|
+
break;
|
|
92
|
+
}
|
|
93
|
+
C(h.originImage, (Q) => {
|
|
94
|
+
x("getImg", Q);
|
|
95
|
+
});
|
|
96
|
+
}, q = (s) => {
|
|
97
|
+
s.deltaY > 0 ? o.scale > 0.1 && (o.scale -= 0.1) : o.scale += 0.1, o.scale = Number(o.scale.toFixed(1));
|
|
98
|
+
const i = o.initWidth, p = o.initHeight, r = o.width, a = o.height;
|
|
99
|
+
o.width = i * o.scale, o.height = p * o.scale, o.moveLeft = o.moveLeft + (r - o.width) / 2, o.moveTop = o.moveTop + (a - o.height) / 2, C(h.originImage, (w) => {
|
|
100
|
+
x("getImg", w);
|
|
101
|
+
});
|
|
102
|
+
}, A = (s) => {
|
|
103
|
+
n.event = s, n.cutBoxMoveLeft = e.moveLeft, n.cutBoxMoveTop = e.moveTop, window.addEventListener("mousemove", D), window.addEventListener("mouseup", T);
|
|
104
|
+
}, G = (s) => {
|
|
105
|
+
n.event = s, n.imgBoxMoveLeft = o.moveLeft, n.imgBoxMoveTop = o.moveTop, window.addEventListener("mousemove", $), window.addEventListener("mouseup", T);
|
|
106
|
+
}, $ = (s) => {
|
|
107
|
+
const t = s.clientX, i = s.clientY, p = n.event.clientX, r = n.event.clientY;
|
|
108
|
+
let a = t - p, w = i - r;
|
|
109
|
+
o.moveLeft = n.imgBoxMoveLeft + a, o.moveTop = n.imgBoxMoveTop + w, C(h.originImage, (g) => {
|
|
110
|
+
x("getImg", g);
|
|
111
|
+
});
|
|
112
|
+
}, D = (s) => {
|
|
113
|
+
const t = n.event.clientX - n.cutBoxMoveLeft, i = n.event.clientY - n.cutBoxMoveTop;
|
|
114
|
+
let p = s.clientX - t, r = s.clientY - i;
|
|
115
|
+
p <= 0 && (p = 0), r <= 0 && (r = 0), p >= d.width - e.width && (p = d.width - e.width), r >= d.height - e.height && (r = d.height - e.height), e.moveLeft = p, e.moveTop = r, C(h.originImage, (a) => {
|
|
116
|
+
x("getImg", a);
|
|
117
|
+
});
|
|
118
|
+
}, J = () => {
|
|
119
|
+
h.defaultCutWidth ? e.width = h.defaultCutWidth : e.width = d.width / 2, h.defaultCutHeight ? e.height = h.defaultCutHeight : e.height = d.height / 2, e.moveLeft = (d.width - e.width) / 2, e.moveTop = (d.height - e.height) / 2, e.scale = e.width / e.height;
|
|
120
|
+
}, T = () => {
|
|
121
|
+
window.removeEventListener("mousemove", D), window.removeEventListener("mousemove", H), window.removeEventListener("mousemove", $), window.removeEventListener("mouseup", T);
|
|
122
|
+
};
|
|
123
|
+
return te(() => h.originImage, (s) => {
|
|
124
|
+
R(s, (t) => {
|
|
125
|
+
x("getImg", t);
|
|
126
|
+
});
|
|
127
|
+
}), oe(() => {
|
|
128
|
+
j(), h.originImage && R(h.originImage, (s) => {
|
|
129
|
+
x("getImg", s);
|
|
130
|
+
});
|
|
131
|
+
}), ie(() => {
|
|
132
|
+
T();
|
|
133
|
+
}), (s, t) => (k(), E("div", {
|
|
134
|
+
class: ne([u(U)()]),
|
|
135
|
+
ref_key: "myCropper",
|
|
136
|
+
ref: W,
|
|
137
|
+
onMousewheel: m(q, ["stop", "prevent"])
|
|
138
|
+
}, [
|
|
139
|
+
l("div", de, [
|
|
140
|
+
l("div", {
|
|
141
|
+
class: "original-image-box",
|
|
142
|
+
style: S({
|
|
143
|
+
width: u(o).width + "px",
|
|
144
|
+
height: u(o).height + "px",
|
|
145
|
+
transform: Z.value
|
|
146
|
+
})
|
|
147
|
+
}, [
|
|
148
|
+
l("img", { src: b.originImage }, null, 8, me)
|
|
149
|
+
], 4)
|
|
150
|
+
]),
|
|
151
|
+
l("div", {
|
|
152
|
+
class: "outer-shadow",
|
|
153
|
+
onMousedown: m(G, ["stop", "prevent"])
|
|
154
|
+
}, null, 32),
|
|
155
|
+
l("div", {
|
|
156
|
+
class: "cut-box",
|
|
157
|
+
onMousedown: m(A, ["stop", "prevent"]),
|
|
158
|
+
style: S({
|
|
159
|
+
width: u(e).width + "px",
|
|
160
|
+
height: u(e).height + "px",
|
|
161
|
+
transform: `translate(${u(e).moveLeft}px, ${u(e).moveTop}px)`
|
|
162
|
+
})
|
|
163
|
+
}, [
|
|
164
|
+
b.showResolution ? (k(), E("div", ve, V(u(e).width) + " \xD7 " + V(u(e).height), 1)) : F("", !0),
|
|
165
|
+
l("div", he, [
|
|
166
|
+
l("img", {
|
|
167
|
+
src: b.originImage,
|
|
168
|
+
style: S({
|
|
169
|
+
width: u(o).width + "px",
|
|
170
|
+
height: u(o).height + "px",
|
|
171
|
+
transform: O.value
|
|
172
|
+
})
|
|
173
|
+
}, null, 12, pe)
|
|
174
|
+
]),
|
|
175
|
+
b.enableCut ? (k(), E("div", re, [
|
|
176
|
+
l("div", {
|
|
177
|
+
class: "action-line left-line",
|
|
178
|
+
onMousedown: t[0] || (t[0] = m((i) => v(i, "left"), ["stop", "prevent"]))
|
|
179
|
+
}, null, 32),
|
|
180
|
+
l("div", {
|
|
181
|
+
class: "action-line top-line",
|
|
182
|
+
onMousedown: t[1] || (t[1] = m((i) => v(i, "top"), ["stop", "prevent"]))
|
|
183
|
+
}, null, 32),
|
|
184
|
+
l("div", {
|
|
185
|
+
class: "action-line right-line",
|
|
186
|
+
onMousedown: t[2] || (t[2] = m((i) => v(i, "right"), ["stop", "prevent"]))
|
|
187
|
+
}, null, 32),
|
|
188
|
+
l("div", {
|
|
189
|
+
class: "action-line bottom-line",
|
|
190
|
+
onMousedown: t[3] || (t[3] = m((i) => v(i, "bottom"), ["stop", "prevent"]))
|
|
191
|
+
}, null, 32),
|
|
192
|
+
l("div", {
|
|
193
|
+
class: "action-point top-left-point",
|
|
194
|
+
onMousedown: t[4] || (t[4] = m((i) => v(i, "top-left"), ["stop", "prevent"]))
|
|
195
|
+
}, null, 32),
|
|
196
|
+
l("div", {
|
|
197
|
+
class: "action-point top-center-point",
|
|
198
|
+
onMousedown: t[5] || (t[5] = m((i) => v(i, "top"), ["stop", "prevent"]))
|
|
199
|
+
}, null, 32),
|
|
200
|
+
l("div", {
|
|
201
|
+
class: "action-point top-right-point",
|
|
202
|
+
onMousedown: t[6] || (t[6] = m((i) => v(i, "top-right"), ["stop", "prevent"]))
|
|
203
|
+
}, null, 32),
|
|
204
|
+
l("div", {
|
|
205
|
+
class: "action-point right-center-point",
|
|
206
|
+
onMousedown: t[7] || (t[7] = m((i) => v(i, "right"), ["stop", "prevent"]))
|
|
207
|
+
}, null, 32),
|
|
208
|
+
l("div", {
|
|
209
|
+
class: "action-point right-bottom-point",
|
|
210
|
+
onMousedown: t[8] || (t[8] = m((i) => v(i, "bottom-right"), ["stop", "prevent"]))
|
|
211
|
+
}, null, 32),
|
|
212
|
+
l("div", {
|
|
213
|
+
class: "action-point bottom-center-point",
|
|
214
|
+
onMousedown: t[9] || (t[9] = m((i) => v(i, "bottom"), ["stop", "prevent"]))
|
|
215
|
+
}, null, 32),
|
|
216
|
+
l("div", {
|
|
217
|
+
class: "action-point bottom-left-point",
|
|
218
|
+
onMousedown: t[10] || (t[10] = m((i) => v(i, "bottom-left"), ["stop", "prevent"]))
|
|
219
|
+
}, null, 32),
|
|
220
|
+
l("div", {
|
|
221
|
+
class: "action-point left-center-point",
|
|
222
|
+
onMousedown: t[11] || (t[11] = m((i) => v(i, "left"), ["stop", "prevent"]))
|
|
223
|
+
}, null, 32)
|
|
224
|
+
])) : F("", !0)
|
|
225
|
+
], 36)
|
|
226
|
+
], 34));
|
|
227
|
+
}
|
|
228
|
+
});
|
|
229
|
+
export {
|
|
230
|
+
we as default
|
|
231
|
+
};
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { reactive as s } from "vue";
|
|
2
|
+
const t = s({
|
|
3
|
+
width: 0,
|
|
4
|
+
height: 0,
|
|
5
|
+
moveLeft: 0,
|
|
6
|
+
moveTop: 0,
|
|
7
|
+
scale: 1,
|
|
8
|
+
rotate: 0,
|
|
9
|
+
initWidth: 0,
|
|
10
|
+
initHeight: 0
|
|
11
|
+
}), h = s({
|
|
12
|
+
width: 0,
|
|
13
|
+
height: 0
|
|
14
|
+
}), n = s({
|
|
15
|
+
width: 0,
|
|
16
|
+
height: 0,
|
|
17
|
+
moveLeft: 0,
|
|
18
|
+
moveTop: 0,
|
|
19
|
+
scale: 0
|
|
20
|
+
}), f = (o, c) => {
|
|
21
|
+
const e = document.createElement("img");
|
|
22
|
+
e.src = o, e.onload = () => {
|
|
23
|
+
const g = e.width / e.height, i = () => {
|
|
24
|
+
h.width <= e.width ? t.width = h.width : t.width = e.width, t.height = t.width / g;
|
|
25
|
+
}, d = () => {
|
|
26
|
+
h.height <= e.height ? t.height = h.height : t.height = e.height, t.width = t.height * g;
|
|
27
|
+
};
|
|
28
|
+
h.width >= h.height ? e.width > e.height ? i() : d() : e.width >= e.height ? i() : d(), t.initWidth = t.width, t.initHeight = t.height, t.moveLeft = (h.width - t.width) / 2, t.moveTop = (h.height - t.height) / 2, r(o, (m) => {
|
|
29
|
+
c(m);
|
|
30
|
+
});
|
|
31
|
+
};
|
|
32
|
+
}, r = (o, c) => {
|
|
33
|
+
const e = document.createElement("canvas"), g = e.getContext("2d");
|
|
34
|
+
e.width = n.width, e.height = n.height;
|
|
35
|
+
let i = new Image();
|
|
36
|
+
i.src = o;
|
|
37
|
+
const d = t.width, m = t.height;
|
|
38
|
+
let a = t.moveLeft - n.moveLeft, w = t.moveTop - n.moveTop;
|
|
39
|
+
i.onload = () => {
|
|
40
|
+
g.drawImage(i, a, w, d, m);
|
|
41
|
+
const l = e.toDataURL("image/png", 1);
|
|
42
|
+
c(l);
|
|
43
|
+
};
|
|
44
|
+
};
|
|
45
|
+
export {
|
|
46
|
+
f as changeImage,
|
|
47
|
+
n as cutBox,
|
|
48
|
+
r as generateImg,
|
|
49
|
+
t as imgBox,
|
|
50
|
+
h as outerBox
|
|
51
|
+
};
|
|
@@ -0,0 +1,170 @@
|
|
|
1
|
+
.k-cropper {
|
|
2
|
+
position: relative;
|
|
3
|
+
width: 100%;
|
|
4
|
+
height: 100%;
|
|
5
|
+
box-sizing: border-box;
|
|
6
|
+
-webkit-user-select: none;
|
|
7
|
+
-moz-user-select: none;
|
|
8
|
+
user-select: none;
|
|
9
|
+
background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQAQMAAAAlPW0iAAAAA3NCSVQICAjb4U/gAAAABlBMVEXMzMz////TjRV2AAAACXBIWXMAAArrAAAK6wGCiw1aAAAAHHRFWHRTb2Z0d2FyZQBBZG9iZSBGaXJld29ya3MgQ1M26LyyjAAAABFJREFUCJlj+M/AgBVhF/0PAH6/D/HkDxOGAAAAAElFTkSuQmCC);
|
|
10
|
+
}
|
|
11
|
+
.k-cropper .outer-shadow {
|
|
12
|
+
cursor: move;
|
|
13
|
+
position: absolute;
|
|
14
|
+
top: 0;
|
|
15
|
+
right: 0;
|
|
16
|
+
bottom: 0;
|
|
17
|
+
left: 0;
|
|
18
|
+
-webkit-user-select: none;
|
|
19
|
+
-moz-user-select: none;
|
|
20
|
+
user-select: none;
|
|
21
|
+
background-color: rgba(0, 0, 0, 0.5);
|
|
22
|
+
}
|
|
23
|
+
.k-cropper .original-box {
|
|
24
|
+
overflow: hidden;
|
|
25
|
+
position: absolute;
|
|
26
|
+
top: 0;
|
|
27
|
+
right: 0;
|
|
28
|
+
bottom: 0;
|
|
29
|
+
left: 0;
|
|
30
|
+
-webkit-user-select: none;
|
|
31
|
+
-moz-user-select: none;
|
|
32
|
+
user-select: none;
|
|
33
|
+
}
|
|
34
|
+
.k-cropper .original-box .original-image-box {
|
|
35
|
+
position: absolute;
|
|
36
|
+
top: 0;
|
|
37
|
+
right: 0;
|
|
38
|
+
bottom: 0;
|
|
39
|
+
left: 0;
|
|
40
|
+
-webkit-user-select: none;
|
|
41
|
+
-moz-user-select: none;
|
|
42
|
+
user-select: none;
|
|
43
|
+
}
|
|
44
|
+
.k-cropper .original-box .original-image-box img {
|
|
45
|
+
-webkit-user-select: none;
|
|
46
|
+
-moz-user-select: none;
|
|
47
|
+
user-select: none;
|
|
48
|
+
-webkit-user-drag: none;
|
|
49
|
+
height: 100%;
|
|
50
|
+
}
|
|
51
|
+
.k-cropper .cut-box {
|
|
52
|
+
position: absolute;
|
|
53
|
+
top: 0;
|
|
54
|
+
right: 0;
|
|
55
|
+
bottom: 0;
|
|
56
|
+
left: 0;
|
|
57
|
+
-webkit-user-select: none;
|
|
58
|
+
-moz-user-select: none;
|
|
59
|
+
user-select: none;
|
|
60
|
+
cursor: move;
|
|
61
|
+
background-color: rgba(255, 255, 255, 0.2);
|
|
62
|
+
outline: 1px solid rgba(51, 153, 255, 0.75);
|
|
63
|
+
}
|
|
64
|
+
.k-cropper .cut-box .resolution {
|
|
65
|
+
padding: 0 4px;
|
|
66
|
+
position: absolute;
|
|
67
|
+
font-size: 12px;
|
|
68
|
+
top: 0;
|
|
69
|
+
left: 0;
|
|
70
|
+
transform: translateY(-100%);
|
|
71
|
+
color: #ffffff;
|
|
72
|
+
background-color: rgba(0, 0, 0, 0.4);
|
|
73
|
+
}
|
|
74
|
+
.k-cropper .cut-box .cut-image-box {
|
|
75
|
+
height: 100%;
|
|
76
|
+
width: 100%;
|
|
77
|
+
overflow: hidden;
|
|
78
|
+
}
|
|
79
|
+
.k-cropper .cut-box .cut-image-box img {
|
|
80
|
+
-webkit-user-select: none;
|
|
81
|
+
-moz-user-select: none;
|
|
82
|
+
user-select: none;
|
|
83
|
+
-webkit-user-drag: none;
|
|
84
|
+
}
|
|
85
|
+
.k-cropper .cut-box .action-line {
|
|
86
|
+
position: absolute;
|
|
87
|
+
}
|
|
88
|
+
.k-cropper .cut-box .action-line.left-line {
|
|
89
|
+
cursor: w-resize;
|
|
90
|
+
top: 0;
|
|
91
|
+
left: -3px;
|
|
92
|
+
width: 5px;
|
|
93
|
+
height: 100%;
|
|
94
|
+
}
|
|
95
|
+
.k-cropper .cut-box .action-line.top-line {
|
|
96
|
+
cursor: n-resize;
|
|
97
|
+
top: -3px;
|
|
98
|
+
left: 0;
|
|
99
|
+
height: 5px;
|
|
100
|
+
width: 100%;
|
|
101
|
+
}
|
|
102
|
+
.k-cropper .cut-box .action-line.right-line {
|
|
103
|
+
cursor: e-resize;
|
|
104
|
+
top: 0;
|
|
105
|
+
right: -3px;
|
|
106
|
+
height: 100%;
|
|
107
|
+
width: 5px;
|
|
108
|
+
}
|
|
109
|
+
.k-cropper .cut-box .action-line.bottom-line {
|
|
110
|
+
cursor: s-resize;
|
|
111
|
+
bottom: -3px;
|
|
112
|
+
left: 0;
|
|
113
|
+
height: 5px;
|
|
114
|
+
width: 100%;
|
|
115
|
+
}
|
|
116
|
+
.k-cropper .cut-box .action-point {
|
|
117
|
+
position: absolute;
|
|
118
|
+
background-color: rgba(51, 153, 255, 0.75);
|
|
119
|
+
width: 8px;
|
|
120
|
+
height: 8px;
|
|
121
|
+
border-radius: 100%;
|
|
122
|
+
}
|
|
123
|
+
.k-cropper .cut-box .action-point.top-left-point {
|
|
124
|
+
top: -4px;
|
|
125
|
+
left: -4px;
|
|
126
|
+
cursor: nw-resize;
|
|
127
|
+
}
|
|
128
|
+
.k-cropper .cut-box .action-point.top-center-point {
|
|
129
|
+
top: -4px;
|
|
130
|
+
right: 0;
|
|
131
|
+
left: 0;
|
|
132
|
+
margin: 0 auto;
|
|
133
|
+
cursor: n-resize;
|
|
134
|
+
}
|
|
135
|
+
.k-cropper .cut-box .action-point.top-right-point {
|
|
136
|
+
top: -4px;
|
|
137
|
+
right: -4px;
|
|
138
|
+
cursor: ne-resize;
|
|
139
|
+
}
|
|
140
|
+
.k-cropper .cut-box .action-point.right-center-point {
|
|
141
|
+
top: 0;
|
|
142
|
+
bottom: 0;
|
|
143
|
+
right: -4px;
|
|
144
|
+
margin: auto 0;
|
|
145
|
+
cursor: e-resize;
|
|
146
|
+
}
|
|
147
|
+
.k-cropper .cut-box .action-point.right-bottom-point {
|
|
148
|
+
bottom: -4px;
|
|
149
|
+
right: -4px;
|
|
150
|
+
cursor: se-resize;
|
|
151
|
+
}
|
|
152
|
+
.k-cropper .cut-box .action-point.bottom-center-point {
|
|
153
|
+
bottom: -4px;
|
|
154
|
+
right: 0;
|
|
155
|
+
left: 0;
|
|
156
|
+
margin: 0 auto;
|
|
157
|
+
cursor: s-resize;
|
|
158
|
+
}
|
|
159
|
+
.k-cropper .cut-box .action-point.bottom-left-point {
|
|
160
|
+
bottom: -4px;
|
|
161
|
+
left: -4px;
|
|
162
|
+
cursor: sw-resize;
|
|
163
|
+
}
|
|
164
|
+
.k-cropper .cut-box .action-point.left-center-point {
|
|
165
|
+
left: -4px;
|
|
166
|
+
top: 0;
|
|
167
|
+
bottom: 0;
|
|
168
|
+
margin: auto 0;
|
|
169
|
+
cursor: w-resize;
|
|
170
|
+
}
|