@king-one/antdv 1.0.57 → 1.0.60
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/CHANGELOG.md +18 -0
- package/dist/es/components/form/component/form-item.vue.mjs +4 -0
- package/dist/es/components/form/component/form-item.vue2.mjs +56 -0
- package/dist/es/components/form/component/form.mjs +8 -6
- package/dist/es/components/form/component/form.vue2.mjs +16 -14
- package/dist/es/components/form/content/form-content.mjs +13 -0
- package/dist/es/components/form/index.mjs +10 -6
- package/dist/es/components/index.mjs +16 -13
- package/dist/es/components/pro-modal/index.mjs +8 -7
- package/dist/es/components/pro-modal/src/ProModal.vue.mjs +4 -0
- package/dist/es/components/pro-modal/src/ProModal.vue2.mjs +82 -0
- package/dist/es/components/pro-modal/src/types.mjs +4 -0
- package/dist/es/components/pro-signature/index.mjs +10 -0
- package/dist/es/components/pro-signature/src/ProSignature.vue.mjs +4 -0
- package/dist/es/components/pro-signature/src/ProSignature.vue2.mjs +145 -0
- package/dist/es/components/pro-signature/src/types.mjs +40 -0
- package/dist/es/components/scale-virtual-list/component/scale-virtual-list.vue2.mjs +32 -26
- package/dist/es/components/scale-virtual-list/hooks/useVirtualList.mjs +35 -35
- package/dist/es/components/scroll-bar/index.mjs +6 -5
- package/dist/es/components/scroll-bar/src/scroll-bar.mjs +163 -156
- package/dist/es/components/scroll-bar/src/types.mjs +4 -3
- package/dist/es/components/scroll-bar/style/index.mjs +2 -0
- package/dist/es/components/utils/install.mjs +4 -2
- package/dist/es/index.mjs +48 -42
- package/dist/lib/components/form/component/form-item.vue.js +1 -0
- package/dist/lib/components/form/component/form-item.vue2.js +1 -0
- package/dist/lib/components/form/component/form.js +1 -1
- package/dist/lib/components/form/component/form.vue2.js +1 -1
- package/dist/lib/components/form/content/form-content.js +1 -0
- package/dist/lib/components/form/index.js +1 -1
- package/dist/lib/components/index.js +1 -1
- package/dist/lib/components/pro-modal/index.js +1 -1
- package/dist/lib/components/pro-modal/src/ProModal.vue.js +1 -0
- package/dist/lib/components/pro-modal/src/ProModal.vue2.js +1 -0
- package/dist/lib/components/pro-modal/src/types.js +1 -1
- package/dist/lib/components/pro-signature/index.js +1 -0
- package/dist/lib/components/pro-signature/src/ProSignature.vue.js +1 -0
- package/dist/lib/components/pro-signature/src/ProSignature.vue2.js +1 -0
- package/dist/lib/components/pro-signature/src/types.js +1 -0
- package/dist/lib/components/scale-virtual-list/component/scale-virtual-list.vue2.js +1 -1
- package/dist/lib/components/scale-virtual-list/hooks/useVirtualList.js +1 -1
- package/dist/lib/components/scroll-bar/index.js +1 -1
- package/dist/lib/components/scroll-bar/src/scroll-bar.js +1 -1
- package/dist/lib/components/scroll-bar/src/types.js +1 -1
- package/dist/lib/components/scroll-bar/style/index.js +1 -0
- package/dist/lib/components/utils/install.js +1 -1
- package/dist/lib/index.js +1 -1
- package/dist/theme-chalk/icon.css +1 -1
- package/dist/theme-chalk/index.css +1 -1
- package/dist/theme-chalk/pro-modal.css +1 -1
- package/dist/theme-chalk/scale-virtual-list.css +1 -1
- package/dist/types/components/form/component/form-item.vue.d.ts +30 -0
- package/dist/types/components/form/component/form.d.ts +11 -6
- package/dist/types/components/form/component/form.vue.d.ts +2 -17
- package/dist/types/components/form/content/form-content.d.ts +8 -0
- package/dist/types/components/form/index.d.ts +31 -18
- package/dist/types/components/index.d.ts +1 -0
- package/dist/types/components/pro-modal/index.d.ts +81 -13
- package/dist/types/components/pro-modal/src/Modal.d.ts +12 -4
- package/dist/types/components/pro-modal/src/ProModal.vue.d.ts +52 -0
- package/dist/types/components/pro-modal/src/types.d.ts +5 -1
- package/dist/types/components/pro-signature/index.d.ts +95 -0
- package/dist/types/components/pro-signature/src/ProSignature.vue.d.ts +95 -0
- package/dist/types/components/pro-signature/src/types.d.ts +37 -0
- package/dist/types/components/scale-virtual-list/component/scale-virtual-list.vue.d.ts +3 -1
- package/dist/types/components/scale-virtual-list/hooks/useVirtualList.d.ts +1 -1
- package/dist/types/components/scroll-bar/index.d.ts +7 -3
- package/dist/types/components/scroll-bar/src/scroll-bar.d.ts +7 -3
- package/dist/types/components/scroll-bar/src/types.d.ts +1 -0
- package/dist/types/components/utils/install.d.ts +2 -1
- package/global.d.ts +1 -0
- package/package.json +1 -3
- package/dist/es/components/pro-modal/src/Modal.mjs +0 -44
- package/dist/lib/components/pro-modal/src/Modal.js +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,23 @@
|
|
|
1
1
|
# @king-one/antdv
|
|
2
2
|
|
|
3
|
+
## 1.0.60
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- feat:增加手写签名组件
|
|
8
|
+
|
|
9
|
+
## 1.0.59
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- a4fcf1a: feat:增加 form-item 组件
|
|
14
|
+
|
|
15
|
+
## 1.0.58
|
|
16
|
+
|
|
17
|
+
### Patch Changes
|
|
18
|
+
|
|
19
|
+
- feat:modal 增加拖拽功能
|
|
20
|
+
|
|
3
21
|
## 1.0.57
|
|
4
22
|
|
|
5
23
|
### Patch Changes
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { defineComponent as p, computed as f, ref as d, toRaw as u, openBlock as v, createElementBlock as g, normalizeClass as e, createElementVNode as r, unref as s, renderSlot as _, toDisplayString as b } from "vue";
|
|
2
|
+
import { useNamespace as I } from "../../../hooks/use-namespace/index.mjs";
|
|
3
|
+
import { useProvideFormItem as k } from "../content/form-content.mjs";
|
|
4
|
+
import { formItemProps as y } from "./form.mjs";
|
|
5
|
+
const P = /* @__PURE__ */ p({
|
|
6
|
+
name: "KFormItem",
|
|
7
|
+
__name: "form-item",
|
|
8
|
+
props: y,
|
|
9
|
+
setup(a) {
|
|
10
|
+
const l = a, { b: m, e: o } = I("form-item"), n = f(() => [m()]), c = async (t) => {
|
|
11
|
+
console.log("trigger", t);
|
|
12
|
+
}, i = d("请输入姓名");
|
|
13
|
+
return k({ ...u(l), validate: c }), (t, B) => (v(), g(
|
|
14
|
+
"div",
|
|
15
|
+
{
|
|
16
|
+
class: e(n.value)
|
|
17
|
+
},
|
|
18
|
+
[
|
|
19
|
+
r(
|
|
20
|
+
"label",
|
|
21
|
+
{
|
|
22
|
+
class: e(s(o)("lable"))
|
|
23
|
+
},
|
|
24
|
+
null,
|
|
25
|
+
2
|
|
26
|
+
/* CLASS */
|
|
27
|
+
),
|
|
28
|
+
r(
|
|
29
|
+
"div",
|
|
30
|
+
{
|
|
31
|
+
class: e(s(o)("content"))
|
|
32
|
+
},
|
|
33
|
+
[
|
|
34
|
+
_(t.$slots, "default"),
|
|
35
|
+
r(
|
|
36
|
+
"div",
|
|
37
|
+
{
|
|
38
|
+
class: e(s(o)("error"))
|
|
39
|
+
},
|
|
40
|
+
b(i.value),
|
|
41
|
+
3
|
|
42
|
+
/* TEXT, CLASS */
|
|
43
|
+
)
|
|
44
|
+
],
|
|
45
|
+
2
|
|
46
|
+
/* CLASS */
|
|
47
|
+
)
|
|
48
|
+
],
|
|
49
|
+
2
|
|
50
|
+
/* CLASS */
|
|
51
|
+
));
|
|
52
|
+
}
|
|
53
|
+
});
|
|
54
|
+
export {
|
|
55
|
+
P as default
|
|
56
|
+
};
|
|
@@ -1,11 +1,13 @@
|
|
|
1
|
-
const e = {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
},
|
|
1
|
+
const e = (r) => r, t = {
|
|
2
|
+
label: String,
|
|
3
|
+
prop: String,
|
|
5
4
|
rules: {
|
|
6
|
-
type: Object
|
|
5
|
+
// type: [Object, Array] as Arrayable<FormItemRule> // 优化前语法,即使类型不正确,也会被强行断言成正确的
|
|
6
|
+
type: e([Object, Array])
|
|
7
|
+
// 优化后语法 根据返回类型,确保正确性
|
|
7
8
|
}
|
|
8
9
|
};
|
|
9
10
|
export {
|
|
10
|
-
e as
|
|
11
|
+
e as definePropType,
|
|
12
|
+
t as formItemProps
|
|
11
13
|
};
|
|
@@ -1,19 +1,21 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
const
|
|
4
|
-
"
|
|
5
|
-
null,
|
|
6
|
-
"伟大的好歌",
|
|
7
|
-
-1
|
|
8
|
-
/* HOISTED */
|
|
9
|
-
), d = /* @__PURE__ */ t({
|
|
1
|
+
import { defineComponent as t, computed as m, openBlock as n, createElementBlock as s, normalizeClass as a, renderSlot as c } from "vue";
|
|
2
|
+
import { useNamespace as l } from "../../../hooks/use-namespace/index.mjs";
|
|
3
|
+
const d = /* @__PURE__ */ t({
|
|
4
|
+
name: "KForm",
|
|
10
5
|
__name: "form",
|
|
11
|
-
props: m,
|
|
12
6
|
setup(p) {
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
7
|
+
const { b: e } = l("form"), o = m(() => [e()]);
|
|
8
|
+
return (r, f) => (n(), s(
|
|
9
|
+
"form",
|
|
10
|
+
{
|
|
11
|
+
class: a(o.value)
|
|
12
|
+
},
|
|
13
|
+
[
|
|
14
|
+
c(r.$slots, "default")
|
|
15
|
+
],
|
|
16
|
+
2
|
|
17
|
+
/* CLASS */
|
|
18
|
+
));
|
|
17
19
|
}
|
|
18
20
|
});
|
|
19
21
|
export {
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { provide as o, inject as r } from "vue";
|
|
2
|
+
const e = Symbol("formItemContextKey");
|
|
3
|
+
function n(t) {
|
|
4
|
+
return o(e, t);
|
|
5
|
+
}
|
|
6
|
+
function i() {
|
|
7
|
+
return r(e);
|
|
8
|
+
}
|
|
9
|
+
export {
|
|
10
|
+
e as formItemContextKey,
|
|
11
|
+
i as useInjectFormItem,
|
|
12
|
+
n as useProvideFormItem
|
|
13
|
+
};
|
|
@@ -1,10 +1,14 @@
|
|
|
1
1
|
import { withInstall as o } from "../utils/install.mjs";
|
|
2
2
|
import "./component/form.vue.mjs";
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
|
|
3
|
+
import "./component/form-item.vue.mjs";
|
|
4
|
+
import { definePropType as _, formItemProps as l } from "./component/form.mjs";
|
|
5
|
+
import m from "./component/form.vue2.mjs";
|
|
6
|
+
import r from "./component/form-item.vue2.mjs";
|
|
7
|
+
const s = o(m), n = o(r);
|
|
6
8
|
export {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
9
|
+
s as KForm,
|
|
10
|
+
n as KFormItem,
|
|
11
|
+
s as default,
|
|
12
|
+
_ as definePropType,
|
|
13
|
+
l as formItemProps
|
|
10
14
|
};
|
|
@@ -1,22 +1,25 @@
|
|
|
1
|
-
import { KForm as e } from "./form/index.mjs";
|
|
2
|
-
import { KCollapseTranstion as
|
|
1
|
+
import { KForm as e, KFormItem as t } from "./form/index.mjs";
|
|
2
|
+
import { KCollapseTranstion as p } from "./collapse-transtion/index.mjs";
|
|
3
3
|
import { KProModal as f } from "./pro-modal/index.mjs";
|
|
4
|
-
import { KProTitle as
|
|
5
|
-
import { KScrollBar as
|
|
6
|
-
import { KScaleVirtualList as
|
|
7
|
-
import { KProTag as
|
|
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 s } from "./pro-tag/index.mjs";
|
|
8
8
|
import { KProPicker as T } from "./pro-picker/index.mjs";
|
|
9
|
-
import { KProArea as
|
|
9
|
+
import { KProArea as u } from "./pro-area/index.mjs";
|
|
10
|
+
import { KProSignature as I } from "./pro-signature/index.mjs";
|
|
10
11
|
import { KIcon as k } from "./icon/index.mjs";
|
|
11
12
|
export {
|
|
12
|
-
|
|
13
|
+
p as KCollapseTranstion,
|
|
13
14
|
e as KForm,
|
|
15
|
+
t as KFormItem,
|
|
14
16
|
k as KIcon,
|
|
15
|
-
|
|
17
|
+
u as KProArea,
|
|
16
18
|
f as KProModal,
|
|
17
19
|
T as KProPicker,
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
20
|
+
I as KProSignature,
|
|
21
|
+
s as KProTag,
|
|
22
|
+
a as KProTitle,
|
|
23
|
+
c as KScaleVirtualList,
|
|
24
|
+
P as KScrollBar
|
|
22
25
|
};
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import { withInstall as o } from "../utils/install.mjs";
|
|
2
|
-
import
|
|
2
|
+
import "./src/ProModal.vue.mjs";
|
|
3
3
|
import "./style/index.mjs";
|
|
4
|
-
import { useProModal as
|
|
5
|
-
|
|
4
|
+
import { useProModal as e, useProModalInit as f } from "./hooks/useProModal.mjs";
|
|
5
|
+
import r from "./src/ProModal.vue2.mjs";
|
|
6
|
+
const l = o(r);
|
|
6
7
|
export {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
8
|
+
l as KProModal,
|
|
9
|
+
l as default,
|
|
10
|
+
e as useProModal,
|
|
11
|
+
f as useProModalInit
|
|
11
12
|
};
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import { defineComponent as X, mergeModels as M, ref as e, useModel as Y, computed as y, watch as R, watchEffect as _, openBlock as b, createBlock as w, unref as $, mergeProps as E, withCtx as c, createElementVNode as P, toDisplayString as N, normalizeStyle as q, resolveDynamicComponent as z, renderSlot as O } from "vue";
|
|
2
|
+
import { Modal as U } from "ant-design-vue";
|
|
3
|
+
import { useNamespace as j } from "../../../hooks/use-namespace/index.mjs";
|
|
4
|
+
import { useDraggable as A } from "@vueuse/core";
|
|
5
|
+
import { ProModalProps as F } from "./types.mjs";
|
|
6
|
+
const L = /* @__PURE__ */ X({
|
|
7
|
+
name: "ProModal",
|
|
8
|
+
__name: "ProModal",
|
|
9
|
+
props: /* @__PURE__ */ M(F, {
|
|
10
|
+
modelValue: { required: !0, type: Boolean },
|
|
11
|
+
modelModifiers: {}
|
|
12
|
+
}),
|
|
13
|
+
emits: /* @__PURE__ */ M(["onConfirm", "onCancel"], ["update:modelValue"]),
|
|
14
|
+
setup(k, { emit: x }) {
|
|
15
|
+
const d = x, l = e(null), v = Y(k, "modelValue"), { b: B } = j("pro-modal"), D = y(() => B());
|
|
16
|
+
function S() {
|
|
17
|
+
d("onConfirm");
|
|
18
|
+
}
|
|
19
|
+
function T() {
|
|
20
|
+
d("onCancel");
|
|
21
|
+
}
|
|
22
|
+
const { x: r, y: u, isDragging: f } = A(l), p = e(0), g = e(0), n = e(!1), s = e(0), m = e(0), h = e(0), C = e(0), t = e({ left: 0, right: 0, top: 0, bottom: 0 });
|
|
23
|
+
R([r, u], () => {
|
|
24
|
+
if (!n.value && l.value) {
|
|
25
|
+
p.value = r.value, g.value = u.value;
|
|
26
|
+
const o = document.body.getBoundingClientRect(), a = l.value.getBoundingClientRect();
|
|
27
|
+
t.value.right = o.width - a.width, t.value.bottom = o.height - a.height, h.value = s.value, C.value = m.value;
|
|
28
|
+
}
|
|
29
|
+
n.value = !0;
|
|
30
|
+
}), R(f, () => {
|
|
31
|
+
f || (n.value = !1);
|
|
32
|
+
}), _(() => {
|
|
33
|
+
n.value && (s.value = h.value + Math.min(Math.max(t.value.left, r.value), t.value.right) - p.value, m.value = C.value + Math.min(Math.max(t.value.top, u.value), t.value.bottom) - g.value);
|
|
34
|
+
});
|
|
35
|
+
const V = y(() => ({
|
|
36
|
+
transform: `translate(${s.value}px, ${m.value}px)`
|
|
37
|
+
}));
|
|
38
|
+
return (o, a) => (b(), w($(U), E({
|
|
39
|
+
open: v.value,
|
|
40
|
+
"onUpdate:open": a[0] || (a[0] = (i) => v.value = i)
|
|
41
|
+
}, o.modalProps, {
|
|
42
|
+
"wrap-class-name": D.value,
|
|
43
|
+
onOk: S,
|
|
44
|
+
onCancel: T
|
|
45
|
+
}), {
|
|
46
|
+
title: c(() => [
|
|
47
|
+
P(
|
|
48
|
+
"div",
|
|
49
|
+
{
|
|
50
|
+
ref_key: "modalTitleRef",
|
|
51
|
+
ref: l,
|
|
52
|
+
class: "pro-modal-title"
|
|
53
|
+
},
|
|
54
|
+
N(o.title),
|
|
55
|
+
513
|
|
56
|
+
/* TEXT, NEED_PATCH */
|
|
57
|
+
)
|
|
58
|
+
]),
|
|
59
|
+
modalRender: c(({ originVNode: i }) => [
|
|
60
|
+
P(
|
|
61
|
+
"div",
|
|
62
|
+
{
|
|
63
|
+
style: q(V.value)
|
|
64
|
+
},
|
|
65
|
+
[
|
|
66
|
+
(b(), w(z(i)))
|
|
67
|
+
],
|
|
68
|
+
4
|
|
69
|
+
/* STYLE */
|
|
70
|
+
)
|
|
71
|
+
]),
|
|
72
|
+
default: c(() => [
|
|
73
|
+
O(o.$slots, "default")
|
|
74
|
+
]),
|
|
75
|
+
_: 3
|
|
76
|
+
/* FORWARDED */
|
|
77
|
+
}, 16, ["open", "wrap-class-name"]));
|
|
78
|
+
}
|
|
79
|
+
});
|
|
80
|
+
export {
|
|
81
|
+
L as default
|
|
82
|
+
};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { withInstall as r } from "../utils/install.mjs";
|
|
2
|
+
import "./src/ProSignature.vue.mjs";
|
|
3
|
+
import { ProSignatureProps as f } from "./src/types.mjs";
|
|
4
|
+
import o from "./src/ProSignature.vue2.mjs";
|
|
5
|
+
const a = r(o);
|
|
6
|
+
export {
|
|
7
|
+
a as KProSignature,
|
|
8
|
+
f as ProSignatureProps,
|
|
9
|
+
a as default
|
|
10
|
+
};
|
|
@@ -0,0 +1,145 @@
|
|
|
1
|
+
import { defineComponent as A, ref as o, computed as k, watch as F, onMounted as N, onBeforeUnmount as $, reactive as H, openBlock as Q, createElementBlock as G, normalizeStyle as K, withModifiers as V } from "vue";
|
|
2
|
+
import { ProSignatureProps as Z } from "./types.mjs";
|
|
3
|
+
const te = /* @__PURE__ */ A({
|
|
4
|
+
__name: "ProSignature",
|
|
5
|
+
props: Z,
|
|
6
|
+
emits: ["update:bgColor"],
|
|
7
|
+
setup(R, { expose: X, emit: Y }) {
|
|
8
|
+
const u = R, b = Y, a = o(null), t = o(null), p = o(!1), C = o(""), h = o([]), f = o(0), d = o(0), w = o(!1), T = o(1), D = k(() => u.height / u.width), y = k(() => u.bgColor ? u.bgColor : "rgba(255, 255, 255, 0)");
|
|
9
|
+
function x() {
|
|
10
|
+
if (!a.value || !t.value)
|
|
11
|
+
return;
|
|
12
|
+
const e = window.devicePixelRatio || 1;
|
|
13
|
+
a.value.style.width = `${u.width}px`;
|
|
14
|
+
const l = Number.parseFloat(window.getComputedStyle(a.value).width);
|
|
15
|
+
a.value.style.height = `${D.value * l}px`, a.value.width = l * e, a.value.height = D.value * l * e, t.value.scale(e, e), T.value = l / u.width;
|
|
16
|
+
}
|
|
17
|
+
function P(e) {
|
|
18
|
+
t.value && (f.value = e.x, d.value = e.y, t.value.beginPath(), t.value.moveTo(f.value, d.value), t.value.lineTo(e.x, e.y), t.value.lineCap = "round", t.value.lineJoin = "round", t.value.lineWidth = u.lineWidth * T.value, t.value.stroke(), t.value.closePath(), h.value.push(e));
|
|
19
|
+
}
|
|
20
|
+
function M(e) {
|
|
21
|
+
t.value && (t.value.beginPath(), t.value.moveTo(f.value, d.value), t.value.lineTo(e.x, e.y), t.value.strokeStyle = u.lineColor, t.value.lineWidth = u.lineWidth * T.value, t.value.lineCap = "round", t.value.lineJoin = "round", t.value.stroke(), t.value.closePath(), d.value = e.y, f.value = e.x, h.value.push(e));
|
|
22
|
+
}
|
|
23
|
+
function S(e) {
|
|
24
|
+
t.value && (t.value.beginPath(), t.value.moveTo(f.value, d.value), t.value.lineTo(e.x, e.y), t.value.lineCap = "round", t.value.lineJoin = "round", t.value.stroke(), t.value.closePath(), h.value.push(e), h.value.push({ x: -1, y: -1 }));
|
|
25
|
+
}
|
|
26
|
+
function B(e) {
|
|
27
|
+
e.preventDefault(), w.value = !0, p.value = !0, P({
|
|
28
|
+
x: e.offsetX,
|
|
29
|
+
y: e.offsetY
|
|
30
|
+
});
|
|
31
|
+
}
|
|
32
|
+
function I(e) {
|
|
33
|
+
e.preventDefault(), w.value && M({
|
|
34
|
+
x: e.offsetX,
|
|
35
|
+
y: e.offsetY
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
function E(e) {
|
|
39
|
+
e.preventDefault(), S({
|
|
40
|
+
x: e.offsetX,
|
|
41
|
+
y: e.offsetY
|
|
42
|
+
}), w.value = !1;
|
|
43
|
+
}
|
|
44
|
+
function _(e) {
|
|
45
|
+
if (p.value = !0, e.touches.length === 1 && a.value) {
|
|
46
|
+
const l = a.value.getBoundingClientRect();
|
|
47
|
+
P({
|
|
48
|
+
x: e.targetTouches[0].clientX - l.left,
|
|
49
|
+
y: e.targetTouches[0].clientY - l.top
|
|
50
|
+
});
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
function L(e) {
|
|
54
|
+
if (e.preventDefault(), e.touches.length === 1 && a.value) {
|
|
55
|
+
const l = a.value.getBoundingClientRect();
|
|
56
|
+
M({
|
|
57
|
+
x: e.targetTouches[0].clientX - l.left,
|
|
58
|
+
y: e.targetTouches[0].clientY - l.top
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
function W(e) {
|
|
63
|
+
if (e.preventDefault(), e.touches.length === 1 && a.value) {
|
|
64
|
+
const l = a.value.getBoundingClientRect();
|
|
65
|
+
S({
|
|
66
|
+
x: e.targetTouches[0].clientX - l.left,
|
|
67
|
+
y: e.targetTouches[0].clientY - l.top
|
|
68
|
+
});
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
function z(e) {
|
|
72
|
+
if (!a.value)
|
|
73
|
+
return [0, 0, 0, 0];
|
|
74
|
+
let l = a.value.width, g = 0, r = a.value.height, s = 0;
|
|
75
|
+
for (let i = 0; i < a.value.width; i++)
|
|
76
|
+
for (let v = 0; v < a.value.height; v++) {
|
|
77
|
+
const n = (i + a.value.width * v) * 4;
|
|
78
|
+
(e[n] > 0 || e[n + 1] > 0 || e[n + 2] || e[n + 3] > 0) && (s = Math.max(v, s), g = Math.max(i, g), r = Math.min(v, r), l = Math.min(i, l));
|
|
79
|
+
}
|
|
80
|
+
return [l + 1, r + 1, g + 1, s + 1];
|
|
81
|
+
}
|
|
82
|
+
function U(e) {
|
|
83
|
+
return new Promise((l, g) => {
|
|
84
|
+
if (!p.value || !a.value || !t.value) {
|
|
85
|
+
g("Warning: Not Signned!");
|
|
86
|
+
return;
|
|
87
|
+
}
|
|
88
|
+
const r = (e == null ? void 0 : e.format) || u.format, s = (e == null ? void 0 : e.quality) || u.quality, i = t.value.getImageData(0, 0, a.value.width, a.value.height);
|
|
89
|
+
t.value.globalCompositeOperation = "destination-over", t.value.fillStyle = y.value, t.value.fillRect(0, 0, a.value.width, a.value.height), C.value = a.value.toDataURL(r, s);
|
|
90
|
+
let v = C.value;
|
|
91
|
+
if (t.value.clearRect(0, 0, a.value.width, a.value.height), t.value.putImageData(i, 0, 0), t.value.globalCompositeOperation = "source-over", u.isCrop) {
|
|
92
|
+
const n = z(i.data), c = document.createElement("canvas"), m = c.getContext("2d");
|
|
93
|
+
if (m) {
|
|
94
|
+
c.width = n[2] - n[0], c.height = n[3] - n[1];
|
|
95
|
+
const q = t.value.getImageData(n[0], n[1], n[2] - n[0], n[3] - n[1]);
|
|
96
|
+
m.globalCompositeOperation = "destination-over", m.putImageData(q, 0, 0), m.fillStyle = y.value, m.fillRect(0, 0, c.width, c.height), v = c.toDataURL(r, s);
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
l(v);
|
|
100
|
+
});
|
|
101
|
+
}
|
|
102
|
+
function J() {
|
|
103
|
+
!a.value || !t.value || (t.value.clearRect(0, 0, a.value.width, a.value.height), u.isClearBgColor && (b("update:bgColor", ""), a.value.style.background = "rgba(255, 255, 255, 0)"), h.value = [], p.value = !1, C.value = "");
|
|
104
|
+
}
|
|
105
|
+
F(
|
|
106
|
+
() => [u.width, u.height],
|
|
107
|
+
([e, l]) => {
|
|
108
|
+
!a.value || !t.value || (a.value.width = e, a.value.height = l, a.value.style.background = y.value, x());
|
|
109
|
+
}
|
|
110
|
+
), N(() => {
|
|
111
|
+
a.value && (a.value.height = u.height, a.value.width = u.width, a.value.style.background = y.value, t.value = a.value.getContext("2d"), x(), window.addEventListener("resize", x), document.addEventListener("mouseup", () => {
|
|
112
|
+
w.value = !1;
|
|
113
|
+
}));
|
|
114
|
+
}), $(() => {
|
|
115
|
+
window.removeEventListener("resize", x);
|
|
116
|
+
});
|
|
117
|
+
const O = H({
|
|
118
|
+
width: "100%",
|
|
119
|
+
height: "100%"
|
|
120
|
+
});
|
|
121
|
+
return X({
|
|
122
|
+
generate: U,
|
|
123
|
+
reset: J
|
|
124
|
+
}), (e, l) => (Q(), G(
|
|
125
|
+
"canvas",
|
|
126
|
+
{
|
|
127
|
+
ref_key: "canvas",
|
|
128
|
+
ref: a,
|
|
129
|
+
style: K(O),
|
|
130
|
+
onMousedown: B,
|
|
131
|
+
onMousemove: I,
|
|
132
|
+
onMouseup: E,
|
|
133
|
+
onTouchstartPassive: _,
|
|
134
|
+
onTouchmovePassive: L,
|
|
135
|
+
onTouchend: V(W, ["prevent"])
|
|
136
|
+
},
|
|
137
|
+
null,
|
|
138
|
+
36
|
|
139
|
+
/* STYLE, NEED_HYDRATION */
|
|
140
|
+
));
|
|
141
|
+
}
|
|
142
|
+
});
|
|
143
|
+
export {
|
|
144
|
+
te as default
|
|
145
|
+
};
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { definePropType as e } from "../../utils/install.mjs";
|
|
2
|
+
const r = {
|
|
3
|
+
width: {
|
|
4
|
+
type: e(Number),
|
|
5
|
+
default: 800
|
|
6
|
+
},
|
|
7
|
+
height: {
|
|
8
|
+
type: Number,
|
|
9
|
+
default: 300
|
|
10
|
+
},
|
|
11
|
+
lineWidth: {
|
|
12
|
+
type: Number,
|
|
13
|
+
default: 4
|
|
14
|
+
},
|
|
15
|
+
bgColor: {
|
|
16
|
+
type: String,
|
|
17
|
+
default: ""
|
|
18
|
+
},
|
|
19
|
+
lineColor: {
|
|
20
|
+
type: String,
|
|
21
|
+
default: "#000000"
|
|
22
|
+
},
|
|
23
|
+
isCrop: {
|
|
24
|
+
type: Boolean
|
|
25
|
+
},
|
|
26
|
+
isClearBgColor: {
|
|
27
|
+
type: Boolean
|
|
28
|
+
},
|
|
29
|
+
format: {
|
|
30
|
+
type: String,
|
|
31
|
+
default: "image/png"
|
|
32
|
+
},
|
|
33
|
+
quality: {
|
|
34
|
+
type: Number,
|
|
35
|
+
default: 1
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
export {
|
|
39
|
+
r as ProSignatureProps
|
|
40
|
+
};
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import { defineComponent as
|
|
1
|
+
import { defineComponent as h, ref as B, computed as E, toRefs as P, openBlock as a, createElementBlock as l, mergeProps as i, unref as e, createElementVNode as p, normalizeClass as c, normalizeStyle as R, Fragment as S, renderList as z, renderSlot as L } from "vue";
|
|
2
2
|
import { defaultNamespace as s } from "../../../hooks/use-namespace/index.mjs";
|
|
3
|
-
import {
|
|
4
|
-
|
|
3
|
+
import { useElementBounding as T } from "@vueuse/core";
|
|
4
|
+
import { useVirtualList as V } from "../hooks/useVirtualList.mjs";
|
|
5
|
+
const q = /* @__PURE__ */ h({
|
|
5
6
|
__name: "scale-virtual-list",
|
|
6
7
|
props: {
|
|
7
8
|
list: {},
|
|
@@ -9,43 +10,48 @@ const z = /* @__PURE__ */ P({
|
|
|
9
10
|
itemClassName: { default: `${s}-scale-virtual-item` }
|
|
10
11
|
},
|
|
11
12
|
emits: ["update:state"],
|
|
12
|
-
setup(
|
|
13
|
-
const o =
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
13
|
+
setup(m, { expose: u, emit: d }) {
|
|
14
|
+
const o = m, f = d, n = B(null), { width: v } = T(n), w = E(() => ({
|
|
15
|
+
width: `${v.value}px`
|
|
16
|
+
})), { list: $ } = P(o), { list: x, containerProps: y, wrapperProps: _, scrollTo: k, scaleTo: C, state: N, onUpdate: g } = V($, o.option);
|
|
17
|
+
return u({
|
|
18
|
+
scrollTo: k,
|
|
19
|
+
scaleTo: C,
|
|
20
|
+
state: N
|
|
21
|
+
}), g((t) => f("update:state", t)), (t, F) => (a(), l(
|
|
19
22
|
"div",
|
|
20
23
|
i({
|
|
21
24
|
class: `${e(s)}-scale-virtual-list`
|
|
22
|
-
}, e(
|
|
25
|
+
}, e(y)),
|
|
23
26
|
[
|
|
24
|
-
|
|
27
|
+
p(
|
|
25
28
|
"div",
|
|
26
29
|
{
|
|
27
|
-
class: c(`${e(s)}-scale-virtual-list-container`)
|
|
30
|
+
class: c(`${e(s)}-scale-virtual-list-container`),
|
|
31
|
+
style: R(w.value)
|
|
28
32
|
},
|
|
29
33
|
[
|
|
30
|
-
|
|
34
|
+
p(
|
|
31
35
|
"div",
|
|
32
|
-
i({
|
|
36
|
+
i(e(_), {
|
|
37
|
+
ref_key: "wrapperRef",
|
|
38
|
+
ref: n,
|
|
33
39
|
class: `${e(s)}-scale-vittual-wrapper`
|
|
34
|
-
}
|
|
40
|
+
}),
|
|
35
41
|
[
|
|
36
|
-
(
|
|
37
|
-
|
|
42
|
+
(a(!0), l(
|
|
43
|
+
S,
|
|
38
44
|
null,
|
|
39
|
-
|
|
45
|
+
z(e(x), (r) => (a(), l(
|
|
40
46
|
"div",
|
|
41
47
|
{
|
|
42
|
-
key:
|
|
48
|
+
key: r.index,
|
|
43
49
|
class: c(t.itemClassName)
|
|
44
50
|
},
|
|
45
51
|
[
|
|
46
|
-
|
|
47
|
-
item:
|
|
48
|
-
index:
|
|
52
|
+
L(t.$slots, "default", {
|
|
53
|
+
item: r,
|
|
54
|
+
index: r.index
|
|
49
55
|
})
|
|
50
56
|
],
|
|
51
57
|
2
|
|
@@ -59,8 +65,8 @@ const z = /* @__PURE__ */ P({
|
|
|
59
65
|
/* FULL_PROPS */
|
|
60
66
|
)
|
|
61
67
|
],
|
|
62
|
-
|
|
63
|
-
/* CLASS */
|
|
68
|
+
6
|
|
69
|
+
/* CLASS, STYLE */
|
|
64
70
|
)
|
|
65
71
|
],
|
|
66
72
|
16
|
|
@@ -69,5 +75,5 @@ const z = /* @__PURE__ */ P({
|
|
|
69
75
|
}
|
|
70
76
|
});
|
|
71
77
|
export {
|
|
72
|
-
|
|
78
|
+
q as default
|
|
73
79
|
};
|