@varlet/ui 2.9.0-alpha.1678546817949 → 2.9.0

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.
@@ -238,7 +238,7 @@ import './time-picker/style/index.mjs'
238
238
  import './tooltip/style/index.mjs'
239
239
  import './uploader/style/index.mjs'
240
240
 
241
- const version = '2.9.0-alpha.1678546817949'
241
+ const version = '2.9.0'
242
242
 
243
243
  function install(app) {
244
244
  ActionSheet.install && app.use(ActionSheet)
package/es/index.mjs CHANGED
@@ -158,7 +158,7 @@ export * from './time-picker/index.mjs'
158
158
  export * from './tooltip/index.mjs'
159
159
  export * from './uploader/index.mjs'
160
160
 
161
- const version = '2.9.0-alpha.1678546817949'
161
+ const version = '2.9.0'
162
162
 
163
163
  function install(app) {
164
164
  ActionSheet.install && app.use(ActionSheet)
@@ -1,7 +1,10 @@
1
1
  import LoadingBarComponent from './LoadingBar.mjs';
2
2
  import { reactive } from 'vue';
3
3
  import { mountInstance } from '../utils/components.mjs';
4
- var timer;
4
+ var valueTimer;
5
+ var errorTimer;
6
+ var opacityTimer;
7
+ var finishTimer;
5
8
  var isMount;
6
9
  var setOptions = {};
7
10
  var internalProps = {
@@ -28,47 +31,66 @@ var resetDefaultOptions = () => {
28
31
  });
29
32
  };
30
33
 
31
- var changeValue = () => {
32
- timer = window.setTimeout(() => {
34
+ var mount = () => {
35
+ if (!isMount) {
36
+ isMount = true;
37
+ mountInstance(LoadingBarComponent, props);
38
+ }
39
+ };
40
+
41
+ var tickValue = () => {
42
+ valueTimer = window.setTimeout(() => {
33
43
  if (props.value >= 95) return;
34
44
  var num = Math.random();
35
45
  if (props.value < 70) num = Math.round(5 * Math.random());
36
46
  props.value += num;
37
- changeValue();
47
+ tickValue();
38
48
  }, 200);
39
49
  };
40
50
 
41
- var start = () => {
42
- if (!isMount) {
43
- isMount = true;
44
- mountInstance(LoadingBarComponent, props);
45
- }
46
-
47
- if (!props.error || props.value === 100) {
48
- props.value = 0;
49
- }
51
+ var clearTimer = () => {
52
+ window.clearTimeout(errorTimer);
53
+ window.clearTimeout(valueTimer);
54
+ window.clearTimeout(opacityTimer);
55
+ window.clearTimeout(finishTimer);
56
+ };
50
57
 
51
- setTimeout(() => {
58
+ var start = () => {
59
+ clearTimer();
60
+ props.error = false;
61
+ props.value = 0;
62
+ mount();
63
+ opacityTimer = window.setTimeout(() => {
52
64
  props.opacity = 1;
53
65
  }, 200);
54
- changeValue();
66
+ tickValue();
55
67
  };
56
68
 
57
69
  var finish = () => {
70
+ clearTimer();
58
71
  props.value = 100;
59
- setTimeout(() => {
72
+ opacityTimer = window.setTimeout(() => {
60
73
  props.opacity = 0;
61
- setTimeout(() => {
74
+ errorTimer = window.setTimeout(() => {
62
75
  props.error = false;
63
76
  }, 250);
64
77
  }, 300);
65
- window.clearTimeout(timer);
66
78
  };
67
79
 
68
80
  var error = () => {
81
+ clearTimer();
69
82
  props.error = true;
70
- LoadingBar.start();
71
- setTimeout(LoadingBar.finish, 300);
83
+
84
+ if (props.value === 100) {
85
+ props.value = 0;
86
+ }
87
+
88
+ mount();
89
+ opacityTimer = window.setTimeout(() => {
90
+ props.opacity = 1;
91
+ }, 200);
92
+ tickValue();
93
+ finishTimer = window.setTimeout(finish, 300);
72
94
  };
73
95
 
74
96
  var LoadingBar = {