@vrojs/base 0.0.6 → 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/dist/vro-circle-progress/index.d.ts +19 -9
- package/dist/vro-circle-progress/types.d.ts +4 -1
- package/dist/vro-circle-progress/types.js +3 -3
- package/dist/vro-circle-progress/vro-circle-progress.vue.d.ts +9 -5
- package/dist/vro-circle-progress/vro-circle-progress.vue.js +62 -49
- package/package.json +1 -1
|
@@ -10,7 +10,7 @@ export declare const VroCircleProgress: import('..').WithInstall<{
|
|
|
10
10
|
default: number;
|
|
11
11
|
};
|
|
12
12
|
strokeWidth: {
|
|
13
|
-
type:
|
|
13
|
+
type: import('vue').PropType<string | number>;
|
|
14
14
|
default: number;
|
|
15
15
|
};
|
|
16
16
|
strokeLinecap: {
|
|
@@ -24,10 +24,14 @@ export declare const VroCircleProgress: import('..').WithInstall<{
|
|
|
24
24
|
color: StringConstructor;
|
|
25
25
|
backgroundColor: StringConstructor;
|
|
26
26
|
curve: StringConstructor;
|
|
27
|
-
}>> & Readonly<{
|
|
27
|
+
}>> & Readonly<{
|
|
28
|
+
onFinish?: ((value: number) => any) | undefined;
|
|
29
|
+
}>, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
|
|
30
|
+
finish: (value: number) => any;
|
|
31
|
+
}, import('vue').PublicProps, {
|
|
28
32
|
size: string | number;
|
|
29
33
|
modelValue: number;
|
|
30
|
-
strokeWidth: number;
|
|
34
|
+
strokeWidth: string | number;
|
|
31
35
|
strokeLinecap: import('./types').VroCircleProgressStrokeLinecap;
|
|
32
36
|
duration: string | number;
|
|
33
37
|
}, true, {}, {}, import('vue').GlobalComponents, import('vue').GlobalDirectives, string, {}, HTMLDivElement, import('vue').ComponentProvideOptions, {
|
|
@@ -47,7 +51,7 @@ export declare const VroCircleProgress: import('..').WithInstall<{
|
|
|
47
51
|
default: number;
|
|
48
52
|
};
|
|
49
53
|
strokeWidth: {
|
|
50
|
-
type:
|
|
54
|
+
type: import('vue').PropType<string | number>;
|
|
51
55
|
default: number;
|
|
52
56
|
};
|
|
53
57
|
strokeLinecap: {
|
|
@@ -61,10 +65,12 @@ export declare const VroCircleProgress: import('..').WithInstall<{
|
|
|
61
65
|
color: StringConstructor;
|
|
62
66
|
backgroundColor: StringConstructor;
|
|
63
67
|
curve: StringConstructor;
|
|
64
|
-
}>> & Readonly<{
|
|
68
|
+
}>> & Readonly<{
|
|
69
|
+
onFinish?: ((value: number) => any) | undefined;
|
|
70
|
+
}>, {}, {}, {}, {}, {
|
|
65
71
|
size: string | number;
|
|
66
72
|
modelValue: number;
|
|
67
|
-
strokeWidth: number;
|
|
73
|
+
strokeWidth: string | number;
|
|
68
74
|
strokeLinecap: import('./types').VroCircleProgressStrokeLinecap;
|
|
69
75
|
duration: string | number;
|
|
70
76
|
}>;
|
|
@@ -81,7 +87,7 @@ export declare const VroCircleProgress: import('..').WithInstall<{
|
|
|
81
87
|
default: number;
|
|
82
88
|
};
|
|
83
89
|
strokeWidth: {
|
|
84
|
-
type:
|
|
90
|
+
type: import('vue').PropType<string | number>;
|
|
85
91
|
default: number;
|
|
86
92
|
};
|
|
87
93
|
strokeLinecap: {
|
|
@@ -95,10 +101,14 @@ export declare const VroCircleProgress: import('..').WithInstall<{
|
|
|
95
101
|
color: StringConstructor;
|
|
96
102
|
backgroundColor: StringConstructor;
|
|
97
103
|
curve: StringConstructor;
|
|
98
|
-
}>> & Readonly<{
|
|
104
|
+
}>> & Readonly<{
|
|
105
|
+
onFinish?: ((value: number) => any) | undefined;
|
|
106
|
+
}>, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
|
|
107
|
+
finish: (value: number) => any;
|
|
108
|
+
}, string, {
|
|
99
109
|
size: string | number;
|
|
100
110
|
modelValue: number;
|
|
101
|
-
strokeWidth: number;
|
|
111
|
+
strokeWidth: string | number;
|
|
102
112
|
strokeLinecap: import('./types').VroCircleProgressStrokeLinecap;
|
|
103
113
|
duration: string | number;
|
|
104
114
|
}, {}, string, {}, import('vue').GlobalComponents, import('vue').GlobalDirectives, string, import('vue').ComponentProvideOptions> & import('vue').VNodeProps & import('vue').AllowedComponentProps & import('vue').ComponentCustomProps & (new () => {
|
|
@@ -19,7 +19,7 @@ export declare const vroCircleProgressProps: {
|
|
|
19
19
|
* 进度条宽度。
|
|
20
20
|
*/
|
|
21
21
|
strokeWidth: {
|
|
22
|
-
type:
|
|
22
|
+
type: PropType<string | number>;
|
|
23
23
|
default: number;
|
|
24
24
|
};
|
|
25
25
|
/**
|
|
@@ -54,4 +54,7 @@ export interface VroCircleProgressSlots {
|
|
|
54
54
|
value: number;
|
|
55
55
|
}) => any;
|
|
56
56
|
}
|
|
57
|
+
export interface VroCircleProgressEmits {
|
|
58
|
+
finish: [value: number];
|
|
59
|
+
}
|
|
57
60
|
export type VroCircleProgressProps = ExtractPropTypes<typeof vroCircleProgressProps>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const
|
|
1
|
+
const r = {
|
|
2
2
|
/**
|
|
3
3
|
* 当前进度,取值范围为 0 ~ 100。
|
|
4
4
|
*/
|
|
@@ -17,7 +17,7 @@ const e = {
|
|
|
17
17
|
* 进度条宽度。
|
|
18
18
|
*/
|
|
19
19
|
strokeWidth: {
|
|
20
|
-
type: Number,
|
|
20
|
+
type: [Number, String],
|
|
21
21
|
default: 10
|
|
22
22
|
},
|
|
23
23
|
/**
|
|
@@ -48,5 +48,5 @@ const e = {
|
|
|
48
48
|
curve: String
|
|
49
49
|
};
|
|
50
50
|
export {
|
|
51
|
-
|
|
51
|
+
r as vroCircleProgressProps
|
|
52
52
|
};
|
|
@@ -16,7 +16,7 @@ declare const __VLS_component: import('vue').DefineComponent<import('vue').Extra
|
|
|
16
16
|
default: number;
|
|
17
17
|
};
|
|
18
18
|
strokeWidth: {
|
|
19
|
-
type:
|
|
19
|
+
type: import('vue').PropType<string | number>;
|
|
20
20
|
default: number;
|
|
21
21
|
};
|
|
22
22
|
strokeLinecap: {
|
|
@@ -30,7 +30,9 @@ declare const __VLS_component: import('vue').DefineComponent<import('vue').Extra
|
|
|
30
30
|
color: StringConstructor;
|
|
31
31
|
backgroundColor: StringConstructor;
|
|
32
32
|
curve: StringConstructor;
|
|
33
|
-
}>, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
|
|
33
|
+
}>, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
|
|
34
|
+
finish: (value: number) => any;
|
|
35
|
+
}, string, import('vue').PublicProps, Readonly<import('vue').ExtractPropTypes<{
|
|
34
36
|
modelValue: {
|
|
35
37
|
type: NumberConstructor;
|
|
36
38
|
default: number;
|
|
@@ -40,7 +42,7 @@ declare const __VLS_component: import('vue').DefineComponent<import('vue').Extra
|
|
|
40
42
|
default: number;
|
|
41
43
|
};
|
|
42
44
|
strokeWidth: {
|
|
43
|
-
type:
|
|
45
|
+
type: import('vue').PropType<string | number>;
|
|
44
46
|
default: number;
|
|
45
47
|
};
|
|
46
48
|
strokeLinecap: {
|
|
@@ -54,10 +56,12 @@ declare const __VLS_component: import('vue').DefineComponent<import('vue').Extra
|
|
|
54
56
|
color: StringConstructor;
|
|
55
57
|
backgroundColor: StringConstructor;
|
|
56
58
|
curve: StringConstructor;
|
|
57
|
-
}>> & Readonly<{
|
|
59
|
+
}>> & Readonly<{
|
|
60
|
+
onFinish?: ((value: number) => any) | undefined;
|
|
61
|
+
}>, {
|
|
58
62
|
size: string | number;
|
|
59
63
|
modelValue: number;
|
|
60
|
-
strokeWidth: number;
|
|
64
|
+
strokeWidth: string | number;
|
|
61
65
|
strokeLinecap: import('./types').VroCircleProgressStrokeLinecap;
|
|
62
66
|
duration: string | number;
|
|
63
67
|
}, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {}, HTMLDivElement>;
|
|
@@ -1,70 +1,83 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
import { clamp as
|
|
3
|
-
import { addUnit as
|
|
4
|
-
import { vroCircleProgressProps as
|
|
5
|
-
const
|
|
6
|
-
class: "vro-circle-progress-svg",
|
|
7
|
-
viewBox: "0 0 100 100"
|
|
8
|
-
}, x = ["r", "stroke-width"], b = ["r", "stroke-width", "stroke-linecap", "stroke-dasharray", "stroke-dashoffset"], s = 50, W = /* @__PURE__ */ p({
|
|
1
|
+
import { defineComponent as y, computed as x, createElementBlock as l, openBlock as u, normalizeStyle as _, renderSlot as b, createElementVNode as v, createTextVNode as w, toDisplayString as N } from "vue";
|
|
2
|
+
import { clamp as d } from "@daysnap/utils";
|
|
3
|
+
import { addUnit as m } from "../utils/addUnit.js";
|
|
4
|
+
import { vroCircleProgressProps as z } from "./types.js";
|
|
5
|
+
const B = ["aria-valuenow"], V = ["viewBox"], W = ["cx", "cy", "r", "stroke-width"], C = ["cx", "cy", "r", "stroke-width", "stroke-linecap", "stroke-dasharray", "stroke-dashoffset"], F = /* @__PURE__ */ y({
|
|
9
6
|
name: "VroCircleProgress",
|
|
10
7
|
__name: "vro-circle-progress",
|
|
11
|
-
props:
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
8
|
+
props: z,
|
|
9
|
+
emits: ["finish"],
|
|
10
|
+
setup(p, { emit: f }) {
|
|
11
|
+
const s = p, h = f, a = (r) => {
|
|
12
|
+
const o = Number(r);
|
|
13
|
+
return Number.isFinite(o) ? o : void 0;
|
|
14
|
+
}, k = (r) => {
|
|
15
|
+
if (typeof r == "number") return r;
|
|
16
|
+
const o = Number.parseFloat(r);
|
|
17
|
+
return Number.isFinite(o) ? r.trim().endsWith("ms") ? o : o * 1e3 : 0;
|
|
18
|
+
}, e = x(() => {
|
|
19
|
+
const r = a(s.size) || 100, o = r / 2, t = d(0, s.modelValue, 100), c = d(0, a(s.strokeWidth) || 0, r), i = o - c / 2, n = 2 * Math.PI * i;
|
|
15
20
|
return {
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
21
|
+
center: o,
|
|
22
|
+
value: t,
|
|
23
|
+
strokeWidth: c,
|
|
24
|
+
radius: i,
|
|
25
|
+
circumference: n,
|
|
26
|
+
viewBox: `0 0 ${r} ${r}`,
|
|
27
|
+
strokeDashoffset: n * (1 - t / 100),
|
|
28
|
+
text: `${Math.round(t)}%`,
|
|
22
29
|
style: {
|
|
23
|
-
"--size":
|
|
24
|
-
"--color":
|
|
25
|
-
"--background-color":
|
|
26
|
-
"--duration":
|
|
27
|
-
"--curve":
|
|
30
|
+
"--size": m(s.size) || "var(--vro-circle-progress-size)",
|
|
31
|
+
"--color": s.color || "var(--vro-circle-progress-color)",
|
|
32
|
+
"--background-color": s.backgroundColor || "var(--vro-circle-progress-background-color)",
|
|
33
|
+
"--duration": m(s.duration, "ms") || "var(--vro-circle-progress-duration)",
|
|
34
|
+
"--curve": s.curve || "var(--vro-circle-progress-curve)"
|
|
28
35
|
}
|
|
29
36
|
};
|
|
30
|
-
})
|
|
31
|
-
|
|
37
|
+
}), g = (r) => {
|
|
38
|
+
r.propertyName !== "stroke-dashoffset" || k(s.duration) <= 0 || h("finish", e.value.value);
|
|
39
|
+
};
|
|
40
|
+
return (r, o) => (u(), l("div", {
|
|
32
41
|
class: "vro-circle-progress",
|
|
33
|
-
style:
|
|
42
|
+
style: _(e.value.style),
|
|
34
43
|
role: "progressbar",
|
|
35
|
-
"aria-valuenow":
|
|
44
|
+
"aria-valuenow": e.value.value,
|
|
36
45
|
"aria-valuemin": "0",
|
|
37
46
|
"aria-valuemax": "100"
|
|
38
47
|
}, [
|
|
39
|
-
(
|
|
40
|
-
|
|
48
|
+
(u(), l("svg", {
|
|
49
|
+
class: "vro-circle-progress-svg",
|
|
50
|
+
viewBox: e.value.viewBox
|
|
51
|
+
}, [
|
|
52
|
+
v("circle", {
|
|
41
53
|
class: "vro-circle-progress-track",
|
|
42
|
-
cx:
|
|
43
|
-
cy:
|
|
44
|
-
r:
|
|
54
|
+
cx: e.value.center,
|
|
55
|
+
cy: e.value.center,
|
|
56
|
+
r: e.value.radius,
|
|
45
57
|
fill: "none",
|
|
46
|
-
"stroke-width":
|
|
47
|
-
}, null, 8,
|
|
48
|
-
|
|
58
|
+
"stroke-width": e.value.strokeWidth
|
|
59
|
+
}, null, 8, W),
|
|
60
|
+
v("circle", {
|
|
49
61
|
class: "vro-circle-progress-line",
|
|
50
|
-
cx:
|
|
51
|
-
cy:
|
|
52
|
-
r:
|
|
62
|
+
cx: e.value.center,
|
|
63
|
+
cy: e.value.center,
|
|
64
|
+
r: e.value.radius,
|
|
53
65
|
fill: "none",
|
|
54
|
-
"stroke-width":
|
|
55
|
-
"stroke-linecap":
|
|
56
|
-
"stroke-dasharray":
|
|
57
|
-
"stroke-dashoffset":
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
66
|
+
"stroke-width": e.value.strokeWidth,
|
|
67
|
+
"stroke-linecap": r.strokeLinecap,
|
|
68
|
+
"stroke-dasharray": e.value.circumference,
|
|
69
|
+
"stroke-dashoffset": e.value.strokeDashoffset,
|
|
70
|
+
onTransitionend: g
|
|
71
|
+
}, null, 40, C)
|
|
72
|
+
], 8, V)),
|
|
73
|
+
b(r.$slots, "default", {
|
|
74
|
+
value: e.value.value
|
|
62
75
|
}, () => [
|
|
63
|
-
|
|
76
|
+
w(N(e.value.text), 1)
|
|
64
77
|
])
|
|
65
|
-
], 12,
|
|
78
|
+
], 12, B));
|
|
66
79
|
}
|
|
67
80
|
});
|
|
68
81
|
export {
|
|
69
|
-
|
|
82
|
+
F as default
|
|
70
83
|
};
|