@varlet/ui 3.3.12 → 3.3.13-alpha.1722867213138
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/index.bundle.mjs +1 -1
- package/es/index.mjs +1 -1
- package/es/loading-bar/index.mjs +44 -39
- package/es/snackbar/style/index.mjs +1 -1
- package/es/varlet.esm.js +2457 -2454
- package/highlight/web-types.en-US.json +1 -1
- package/highlight/web-types.zh-CN.json +1 -1
- package/lib/varlet.cjs.js +274 -269
- package/package.json +7 -7
- package/types/loadingBar.d.ts +1 -0
- package/umd/varlet.js +7 -7
package/es/index.bundle.mjs
CHANGED
|
@@ -265,7 +265,7 @@ import './tooltip/style/index.mjs'
|
|
|
265
265
|
import './uploader/style/index.mjs'
|
|
266
266
|
import './watermark/style/index.mjs'
|
|
267
267
|
|
|
268
|
-
const version = '3.3.
|
|
268
|
+
const version = '3.3.13-alpha.1722867213138'
|
|
269
269
|
|
|
270
270
|
function install(app) {
|
|
271
271
|
ActionSheet.install && app.use(ActionSheet)
|
package/es/index.mjs
CHANGED
|
@@ -176,7 +176,7 @@ export * from './tooltip/index.mjs'
|
|
|
176
176
|
export * from './uploader/index.mjs'
|
|
177
177
|
export * from './watermark/index.mjs'
|
|
178
178
|
|
|
179
|
-
const version = '3.3.
|
|
179
|
+
const version = '3.3.13-alpha.1722867213138'
|
|
180
180
|
|
|
181
181
|
function install(app) {
|
|
182
182
|
ActionSheet.install && app.use(ActionSheet)
|
package/es/loading-bar/index.mjs
CHANGED
|
@@ -2,84 +2,89 @@ import LoadingBarComponent from "./LoadingBar.mjs";
|
|
|
2
2
|
import { reactive } from "vue";
|
|
3
3
|
import { mountInstance } from "../utils/components.mjs";
|
|
4
4
|
import { props as loadingBarProps } from "./props.mjs";
|
|
5
|
+
const OPACITY_DELAY = 200;
|
|
5
6
|
let valueTimer;
|
|
6
7
|
let errorTimer;
|
|
7
|
-
let opacityTimer;
|
|
8
8
|
let finishTimer;
|
|
9
|
+
let finishErrorTimer;
|
|
10
|
+
let opacityTimer;
|
|
9
11
|
let isMount;
|
|
10
|
-
let
|
|
12
|
+
let internalOptions = {};
|
|
11
13
|
const internalProps = {
|
|
12
14
|
value: 0,
|
|
13
15
|
opacity: 0,
|
|
14
16
|
error: false
|
|
15
17
|
};
|
|
16
|
-
const
|
|
17
|
-
|
|
18
|
-
Object.assign(
|
|
19
|
-
|
|
20
|
-
}
|
|
18
|
+
const ctx = reactive(internalProps);
|
|
19
|
+
function setDefaultOptions(options) {
|
|
20
|
+
Object.assign(ctx, options);
|
|
21
|
+
internalOptions = options;
|
|
22
|
+
}
|
|
21
23
|
const resetDefaultOptions = () => {
|
|
22
|
-
Object.keys(
|
|
23
|
-
if (
|
|
24
|
-
|
|
24
|
+
Object.keys(internalOptions).forEach((key) => {
|
|
25
|
+
if (ctx[key] !== void 0) {
|
|
26
|
+
ctx[key] = void 0;
|
|
25
27
|
}
|
|
26
28
|
});
|
|
27
29
|
};
|
|
28
30
|
const mount = () => {
|
|
29
31
|
if (!isMount) {
|
|
30
32
|
isMount = true;
|
|
31
|
-
mountInstance(LoadingBarComponent,
|
|
33
|
+
mountInstance(LoadingBarComponent, ctx);
|
|
32
34
|
}
|
|
33
35
|
};
|
|
34
|
-
const
|
|
36
|
+
const tick = () => {
|
|
35
37
|
valueTimer = window.setTimeout(() => {
|
|
36
|
-
if (
|
|
38
|
+
if (ctx.value >= 95) {
|
|
37
39
|
return;
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
props.value += num;
|
|
42
|
-
tickValue();
|
|
40
|
+
}
|
|
41
|
+
ctx.value += ctx.value < 70 ? Math.round(5 * Math.random()) : Math.random();
|
|
42
|
+
tick();
|
|
43
43
|
}, 200);
|
|
44
44
|
};
|
|
45
45
|
const clearTimer = () => {
|
|
46
|
-
window.clearTimeout(errorTimer);
|
|
47
46
|
window.clearTimeout(valueTimer);
|
|
48
47
|
window.clearTimeout(opacityTimer);
|
|
49
48
|
window.clearTimeout(finishTimer);
|
|
49
|
+
window.clearTimeout(errorTimer);
|
|
50
|
+
window.clearTimeout(finishErrorTimer);
|
|
51
|
+
};
|
|
52
|
+
const finishTask = () => {
|
|
53
|
+
clearTimer();
|
|
54
|
+
ctx.value = 100;
|
|
55
|
+
opacityTimer = window.setTimeout(() => {
|
|
56
|
+
ctx.opacity = 0;
|
|
57
|
+
finishErrorTimer = window.setTimeout(() => {
|
|
58
|
+
ctx.error = false;
|
|
59
|
+
}, 250);
|
|
60
|
+
}, OPACITY_DELAY + 100);
|
|
50
61
|
};
|
|
51
62
|
const start = () => {
|
|
52
63
|
clearTimer();
|
|
53
|
-
|
|
54
|
-
|
|
64
|
+
ctx.error = false;
|
|
65
|
+
ctx.value = 0;
|
|
55
66
|
mount();
|
|
56
67
|
opacityTimer = window.setTimeout(() => {
|
|
57
|
-
|
|
58
|
-
},
|
|
59
|
-
|
|
68
|
+
ctx.opacity = 1;
|
|
69
|
+
}, OPACITY_DELAY);
|
|
70
|
+
tick();
|
|
60
71
|
};
|
|
61
72
|
const finish = () => {
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
opacityTimer = window.setTimeout(() => {
|
|
65
|
-
props.opacity = 0;
|
|
66
|
-
errorTimer = window.setTimeout(() => {
|
|
67
|
-
props.error = false;
|
|
68
|
-
}, 250);
|
|
69
|
-
}, 300);
|
|
73
|
+
var _a;
|
|
74
|
+
finishTimer = window.setTimeout(finishTask, (_a = ctx.finishDelay) != null ? _a : 0);
|
|
70
75
|
};
|
|
71
76
|
const error = () => {
|
|
72
77
|
clearTimer();
|
|
73
|
-
|
|
74
|
-
if (
|
|
75
|
-
|
|
78
|
+
ctx.error = true;
|
|
79
|
+
if (ctx.value === 100) {
|
|
80
|
+
ctx.value = 0;
|
|
76
81
|
}
|
|
77
82
|
mount();
|
|
78
83
|
opacityTimer = window.setTimeout(() => {
|
|
79
|
-
|
|
80
|
-
},
|
|
81
|
-
|
|
82
|
-
|
|
84
|
+
ctx.opacity = 1;
|
|
85
|
+
}, OPACITY_DELAY);
|
|
86
|
+
tick();
|
|
87
|
+
errorTimer = window.setTimeout(finishTask, 300);
|
|
83
88
|
};
|
|
84
89
|
const LoadingBar = {
|
|
85
90
|
start,
|