@qxs-bns/components 0.0.5 → 0.0.7
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/index.cjs +1 -1
- package/index.js +898 -13
- package/package.json +3 -2
- package/theme-chalk/base.scss +17 -0
- package/theme-chalk/file-upload.scss +33 -0
- package/theme-chalk/fixed-action-bar.scss +17 -0
- package/theme-chalk/image-upload.scss +136 -0
- package/theme-chalk/index.scss +8 -0
- package/theme-chalk/photo-crop-tool.scss +84 -0
- package/theme-chalk/rich-editor.scss +23 -0
- package/theme-chalk/var.scss +87 -0
- package/vendor.cjs +6 -0
- package/vendor.js +1377 -0
- package/dist/hooks/src/use-namespace/index.cjs +0 -1
- package/dist/hooks/src/use-namespace/index.js +0 -49
- package/package.json.cjs +0 -1
- package/package.json.js +0 -4
- package/src/components.cjs +0 -1
- package/src/components.js +0 -10
- package/src/defaults.cjs +0 -1
- package/src/defaults.js +0 -6
- package/src/file-upload/index.cjs +0 -1
- package/src/file-upload/index.js +0 -7
- package/src/file-upload/src/file-upload.vue.cjs +0 -1
- package/src/file-upload/src/file-upload.vue.js +0 -82
- package/src/file-upload/src/file-upload.vue2.cjs +0 -1
- package/src/file-upload/src/file-upload.vue2.js +0 -4
- package/src/fixed-action-bar/index.cjs +0 -1
- package/src/fixed-action-bar/index.js +0 -7
- package/src/fixed-action-bar/src/fixed-action-bar.vue.cjs +0 -1
- package/src/fixed-action-bar/src/fixed-action-bar.vue.js +0 -63
- package/src/fixed-action-bar/src/fixed-action-bar.vue2.cjs +0 -1
- package/src/fixed-action-bar/src/fixed-action-bar.vue2.js +0 -4
- package/src/image-upload/index.cjs +0 -1
- package/src/image-upload/index.js +0 -7
- package/src/image-upload/src/image-upload.vue.cjs +0 -1
- package/src/image-upload/src/image-upload.vue.js +0 -164
- package/src/image-upload/src/image-upload.vue2.cjs +0 -1
- package/src/image-upload/src/image-upload.vue2.js +0 -4
- package/src/make-installer.cjs +0 -1
- package/src/make-installer.js +0 -13
- package/src/photo-crop-tool/index.cjs +0 -1
- package/src/photo-crop-tool/index.js +0 -7
- package/src/photo-crop-tool/src/composables.cjs +0 -1
- package/src/photo-crop-tool/src/composables.js +0 -33
- package/src/photo-crop-tool/src/photo-crop-tool.vue.cjs +0 -1
- package/src/photo-crop-tool/src/photo-crop-tool.vue.js +0 -224
- package/src/photo-crop-tool/src/photo-crop-tool.vue2.cjs +0 -1
- package/src/photo-crop-tool/src/photo-crop-tool.vue2.js +0 -4
- package/src/withInstall.cjs +0 -1
- package/src/withInstall.js +0 -9
@@ -1,224 +0,0 @@
|
|
1
|
-
var A = ($, X, i) => new Promise((L, I) => {
|
2
|
-
var f = (v) => {
|
3
|
-
try {
|
4
|
-
h(i.next(v));
|
5
|
-
} catch (o) {
|
6
|
-
I(o);
|
7
|
-
}
|
8
|
-
}, b = (v) => {
|
9
|
-
try {
|
10
|
-
h(i.throw(v));
|
11
|
-
} catch (o) {
|
12
|
-
I(o);
|
13
|
-
}
|
14
|
-
}, h = (v) => v.done ? L(v.value) : Promise.resolve(v.value).then(f, b);
|
15
|
-
h((i = i.apply($, X)).next());
|
16
|
-
});
|
17
|
-
import { defineComponent as ie, ref as W, computed as C, watch as ae, onMounted as oe, nextTick as ue, onUnmounted as ne, openBlock as D, createElementBlock as O, normalizeClass as x, unref as m, toDisplayString as se, Fragment as he, createElementVNode as k, normalizeStyle as ve } from "vue";
|
18
|
-
import { useNamespace as re } from "../../../dist/hooks/src/use-namespace/index.js";
|
19
|
-
import { useElementSize as G, useDraggable as fe } from "../../../node_modules/.pnpm/@vueuse_core@10.11.1_vue@3.5.12_typescript@5.6.3_/node_modules/@vueuse/core/index.js";
|
20
|
-
import { useCanvas as ce } from "./composables.js";
|
21
|
-
const de = ["src"], xe = /* @__PURE__ */ ie({
|
22
|
-
name: "QxsPhotoCropTool",
|
23
|
-
__name: "photo-crop-tool",
|
24
|
-
props: {
|
25
|
-
imgFile: {
|
26
|
-
type: Object,
|
27
|
-
default: () => null
|
28
|
-
},
|
29
|
-
aspectRatio: {
|
30
|
-
type: String,
|
31
|
-
default: () => "16 / 9"
|
32
|
-
},
|
33
|
-
defaultWidth: {
|
34
|
-
type: Number,
|
35
|
-
default: () => 320
|
36
|
-
},
|
37
|
-
defaultHeight: {
|
38
|
-
type: Number,
|
39
|
-
default: () => 180
|
40
|
-
},
|
41
|
-
/**
|
42
|
-
* free 自由缩放
|
43
|
-
* fixed 固定比例缩放
|
44
|
-
*/
|
45
|
-
zoomType: {
|
46
|
-
type: String,
|
47
|
-
default: () => "fixed"
|
48
|
-
}
|
49
|
-
},
|
50
|
-
setup($, { expose: X }) {
|
51
|
-
const i = $;
|
52
|
-
let L = 0, I = 0, f = 0, b = 0;
|
53
|
-
const h = re("photo-crop-tool"), v = W(null), o = W(null), B = W(null), S = W(""), r = W(""), Y = W({
|
54
|
-
x: 0,
|
55
|
-
y: 0
|
56
|
-
}), e = W({
|
57
|
-
width: i.defaultWidth,
|
58
|
-
height: i.defaultHeight,
|
59
|
-
x: 0,
|
60
|
-
y: 0
|
61
|
-
}), { width: F, height: N } = G(v), { width: J } = G(B), { x: p, y: g, style: K } = fe(v, {
|
62
|
-
containerElement: o,
|
63
|
-
draggingElement: v,
|
64
|
-
disabled: C(() => !!r.value),
|
65
|
-
exact: !0,
|
66
|
-
initialValue: Y
|
67
|
-
}), j = C(() => i.imgFile ? URL.createObjectURL(i.imgFile) : "");
|
68
|
-
ae(() => i.imgFile, (t) => {
|
69
|
-
t && !t.type.startsWith("image/") ? S.value = "文件类型错误" : S.value = "";
|
70
|
-
});
|
71
|
-
const Z = C(() => {
|
72
|
-
var t;
|
73
|
-
return (((t = B.value) == null ? void 0 : t.naturalWidth) || 0) / J.value;
|
74
|
-
}), d = C(() => {
|
75
|
-
const t = {
|
76
|
-
left: 0,
|
77
|
-
top: 0
|
78
|
-
};
|
79
|
-
return r.value === "bottom-right" ? (t.left = e.value.x, t.top = e.value.y) : r.value === "top-left" ? (t.left = e.value.x - F.value, t.top = e.value.y - N.value) : r.value === "top-right" ? (t.top = e.value.y - N.value, t.left = e.value.x) : r.value === "bottom-left" && (t.left = e.value.x - F.value, t.top = e.value.y), t;
|
80
|
-
}), ee = C(() => {
|
81
|
-
const { aspectRatio: t } = i, l = {
|
82
|
-
width: `${e.value.width || i.defaultWidth}`,
|
83
|
-
height: `${e.value.height || i.defaultHeight}`,
|
84
|
-
"aspect-ratio": t,
|
85
|
-
top: `${d.value.top}px`,
|
86
|
-
left: `${d.value.left}px`
|
87
|
-
};
|
88
|
-
return i.zoomType === "free" ? delete l["aspect-ratio"] : i.zoomType === "fixed" && delete l.height, h.cssVarBlock(l);
|
89
|
-
});
|
90
|
-
function w(t) {
|
91
|
-
return t * Z.value;
|
92
|
-
}
|
93
|
-
function te() {
|
94
|
-
return A(this, arguments, function* (t = B.value) {
|
95
|
-
var E, M;
|
96
|
-
let l = "transparent";
|
97
|
-
o.value && (l = window.getComputedStyle(o.value).backgroundColor);
|
98
|
-
const u = document.createElement("canvas");
|
99
|
-
u.width = w(((E = o.value) == null ? void 0 : E.clientWidth) || 0), u.height = w(((M = o.value) == null ? void 0 : M.clientHeight) || 0);
|
100
|
-
const { drawImage: T, cropCanvas: R, drawColor: H } = ce(u);
|
101
|
-
return H(0, 0, u.width, u.height, l), T(t, w(t.offsetLeft), w(t.offsetTop), t.naturalWidth, t.naturalHeight), yield R(w(p.value), w(g.value), w(F.value), w(N.value));
|
102
|
-
});
|
103
|
-
}
|
104
|
-
function y(t, l) {
|
105
|
-
var R, H;
|
106
|
-
const u = ((R = o.value) == null ? void 0 : R.clientWidth) || 1 / 0, T = ((H = o.value) == null ? void 0 : H.clientHeight) || 1 / 0;
|
107
|
-
return {
|
108
|
-
width: Math.min(Math.max(t, 0), u),
|
109
|
-
height: Math.min(Math.max(l, 0), T)
|
110
|
-
};
|
111
|
-
}
|
112
|
-
function P(t) {
|
113
|
-
var T, R, H, E, M, _, Q, q;
|
114
|
-
const l = t.clientX - L, u = t.clientY - I;
|
115
|
-
if (r.value === "bottom-right") {
|
116
|
-
if (i.zoomType === "free") {
|
117
|
-
const { width: n, height: a } = y(f + l, b + u);
|
118
|
-
e.value.width = n, e.value.height = a;
|
119
|
-
} else if (i.zoomType === "fixed") {
|
120
|
-
const n = Number.parseFloat(i.aspectRatio.split(" / ")[0]) / Number.parseFloat(i.aspectRatio.split(" / ")[1]);
|
121
|
-
let a = f + l, s = a / n;
|
122
|
-
const { width: z, height: c } = y(a, s);
|
123
|
-
c > (((T = o.value) == null ? void 0 : T.clientHeight) || 1 / 0) && (s = ((R = o.value) == null ? void 0 : R.clientHeight) || 1 / 0, a = s * n), e.value.width = z, e.value.height = c;
|
124
|
-
}
|
125
|
-
} else if (r.value === "top-left") {
|
126
|
-
if (i.zoomType === "free") {
|
127
|
-
const { width: n, height: a } = y(f - l, b - u);
|
128
|
-
e.value.width = n, e.value.height = a;
|
129
|
-
} else if (i.zoomType === "fixed") {
|
130
|
-
const n = Number.parseFloat(i.aspectRatio.split(" / ")[0]) / Number.parseFloat(i.aspectRatio.split(" / ")[1]);
|
131
|
-
let a = f - l, s = a / n;
|
132
|
-
const { width: z, height: c } = y(a, s);
|
133
|
-
c > (((H = o.value) == null ? void 0 : H.clientHeight) || 1 / 0) && (s = ((E = o.value) == null ? void 0 : E.clientHeight) || 1 / 0, a = s * n), e.value.width = z, e.value.height = c;
|
134
|
-
}
|
135
|
-
p.value = d.value.left, g.value = d.value.top;
|
136
|
-
} else if (r.value === "top-right") {
|
137
|
-
if (i.zoomType === "free") {
|
138
|
-
const { width: n, height: a } = y(f + l, b - u);
|
139
|
-
e.value.width = n, e.value.height = a;
|
140
|
-
} else if (i.zoomType === "fixed") {
|
141
|
-
const n = Number.parseFloat(i.aspectRatio.split(" / ")[0]) / Number.parseFloat(i.aspectRatio.split(" / ")[1]);
|
142
|
-
let a = f + l, s = a / n;
|
143
|
-
const { width: z, height: c } = y(a, s);
|
144
|
-
c > (((M = o.value) == null ? void 0 : M.clientHeight) || 1 / 0) && (s = ((_ = o.value) == null ? void 0 : _.clientHeight) || 1 / 0, a = s * n), e.value.width = z, e.value.height = c;
|
145
|
-
}
|
146
|
-
p.value = d.value.left, g.value = d.value.top;
|
147
|
-
} else if (r.value === "bottom-left") {
|
148
|
-
if (i.zoomType === "free") {
|
149
|
-
const { width: n, height: a } = y(f - l, b + u);
|
150
|
-
e.value.width = n, e.value.height = a;
|
151
|
-
} else if (i.zoomType === "fixed") {
|
152
|
-
const n = Number.parseFloat(i.aspectRatio.split(" / ")[0]) / Number.parseFloat(i.aspectRatio.split(" / ")[1]);
|
153
|
-
let a = f - l, s = a / n;
|
154
|
-
const { width: z, height: c } = y(a, s);
|
155
|
-
c > (((Q = o.value) == null ? void 0 : Q.clientHeight) || 1 / 0) && (s = ((q = o.value) == null ? void 0 : q.clientHeight) || 1 / 0, a = s * n), e.value.width = z, e.value.height = c;
|
156
|
-
}
|
157
|
-
p.value = d.value.left, g.value = d.value.top;
|
158
|
-
}
|
159
|
-
t.preventDefault(), t.stopPropagation();
|
160
|
-
}
|
161
|
-
function U(t, l) {
|
162
|
-
r.value = l, L = t.clientX, I = t.clientY, f = e.value.width, b = e.value.height, l === "bottom-right" ? (e.value.x = p.value, e.value.y = g.value) : l === "top-left" ? (e.value.x = p.value + F.value, e.value.y = g.value + N.value) : l === "top-right" ? (e.value.x = p.value, e.value.y = g.value + N.value) : l === "bottom-left" && (e.value.x = p.value + F.value, e.value.y = g.value);
|
163
|
-
}
|
164
|
-
function V() {
|
165
|
-
r.value = "";
|
166
|
-
}
|
167
|
-
function le() {
|
168
|
-
e.value.width = i.defaultWidth, e.value.height = i.defaultHeight, p.value = 0, g.value = 0;
|
169
|
-
}
|
170
|
-
return document.addEventListener("mouseup", V), document.addEventListener("mousemove", P), oe(() => {
|
171
|
-
ue(() => {
|
172
|
-
var t, l;
|
173
|
-
Y.value.x = (((t = o.value) == null ? void 0 : t.offsetWidth) || 0) / 2 - e.value.width / 2, Y.value.y = (((l = o.value) == null ? void 0 : l.offsetHeight) || 0) / 2 - e.value.height / 2;
|
174
|
-
});
|
175
|
-
}), ne(() => {
|
176
|
-
j.value && URL.revokeObjectURL(j.value), document.removeEventListener("mouseup", V), document.removeEventListener("mousemove", P);
|
177
|
-
}), X({
|
178
|
-
crop: te,
|
179
|
-
resize: le
|
180
|
-
}), (t, l) => (D(), O("div", {
|
181
|
-
ref_key: "containerBoxRef",
|
182
|
-
ref: o,
|
183
|
-
class: x([m(h).e("img-box")])
|
184
|
-
}, [
|
185
|
-
S.value ? (D(), O("div", {
|
186
|
-
key: 0,
|
187
|
-
class: x([m(h).e("error-message")])
|
188
|
-
}, se(S.value), 3)) : (D(), O(he, { key: 1 }, [
|
189
|
-
k("img", {
|
190
|
-
ref_key: "imgRef",
|
191
|
-
ref: B,
|
192
|
-
class: x([m(h).e("image")]),
|
193
|
-
src: j.value
|
194
|
-
}, null, 10, de),
|
195
|
-
k("div", {
|
196
|
-
ref_key: "cropBoxRef",
|
197
|
-
ref: v,
|
198
|
-
class: x([m(h).e("crop-tool-box")]),
|
199
|
-
style: ve([ee.value, r.value ? `left: ${d.value.left}px;top: ${d.value.top}px` : m(K)])
|
200
|
-
}, [
|
201
|
-
k("div", {
|
202
|
-
class: x([m(h).e("top-left")]),
|
203
|
-
onMousedown: l[0] || (l[0] = (u) => U(u, "top-left"))
|
204
|
-
}, null, 34),
|
205
|
-
k("div", {
|
206
|
-
class: x([m(h).e("top-right")]),
|
207
|
-
onMousedown: l[1] || (l[1] = (u) => U(u, "top-right"))
|
208
|
-
}, null, 34),
|
209
|
-
k("div", {
|
210
|
-
class: x([m(h).e("bottom-right")]),
|
211
|
-
onMousedown: l[2] || (l[2] = (u) => U(u, "bottom-right"))
|
212
|
-
}, null, 34),
|
213
|
-
k("div", {
|
214
|
-
class: x([m(h).e("bottom-left")]),
|
215
|
-
onMousedown: l[3] || (l[3] = (u) => U(u, "bottom-left"))
|
216
|
-
}, null, 34)
|
217
|
-
], 6)
|
218
|
-
], 64))
|
219
|
-
], 2));
|
220
|
-
}
|
221
|
-
});
|
222
|
-
export {
|
223
|
-
xe as default
|
224
|
-
};
|
@@ -1 +0,0 @@
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("./photo-crop-tool.vue.cjs");exports.default=e.default;
|
package/src/withInstall.cjs
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});function l(t,n){return t.install=o=>{for(const e of[t,...Object.values({})])o.component(e.name,e)},t}exports.withInstall=l;
|