@varlet/ui 1.27.13 → 1.27.14
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/action-sheet/index.js +1 -1
- package/es/back-top/BackTop.js +2 -1
- package/es/badge/Badge.js +1 -1
- package/es/bottom-navigation/BottomNavigation.js +1 -1
- package/es/checkbox-group/CheckboxGroup.js +1 -1
- package/es/col/Col.js +1 -1
- package/es/collapse/Collapse.js +1 -1
- package/es/collapse-item/CollapseItem.js +1 -1
- package/es/countdown/Countdown.js +28 -1
- package/es/counter/Counter.js +1 -1
- package/es/date-picker/DatePicker.js +1 -1
- package/es/date-picker/src/day-picker-panel.js +1 -1
- package/es/date-picker/src/month-picker-panel.js +1 -1
- package/es/date-picker/src/panel-header.js +1 -1
- package/es/date-picker/src/year-picker-panel.js +1 -1
- package/es/dialog/index.js +1 -1
- package/es/divider/Divider.js +3 -3
- package/es/icon/Icon.js +1 -1
- package/es/image-preview/ImagePreview.js +1 -1
- package/es/image-preview/index.js +1 -1
- package/es/index-bar/IndexBar.js +2 -1
- package/es/input/Input.js +1 -1
- package/es/lazy/index.js +2 -1
- package/es/list/List.js +2 -1
- package/es/pagination/Pagination.js +1 -1
- package/es/picker/Picker.js +2 -1
- package/es/picker/index.js +1 -1
- package/es/progress/Progress.js +1 -1
- package/es/pull-refresh/PullRefresh.js +1 -1
- package/es/rate/Rate.js +1 -1
- package/es/ripple/index.js +15 -8
- package/es/select/Select.js +1 -1
- package/es/skeleton/Skeleton.js +1 -1
- package/es/slider/Slider.js +1 -1
- package/es/snackbar/index.js +1 -1
- package/es/space/Space.js +1 -1
- package/es/space/props.js +1 -1
- package/es/sticky/Sticky.js +1 -1
- package/es/swipe/Swipe.js +1 -1
- package/es/tabs/Tabs.js +2 -1
- package/es/time-picker/TimePicker.js +1 -1
- package/es/time-picker/clock.js +1 -1
- package/es/time-picker/utils.js +1 -1
- package/es/uploader/Uploader.js +2 -1
- package/es/utils/components.js +1 -1
- package/es/utils/elements.js +1 -1
- package/es/utils/jest.js +1 -1
- package/es/utils/shared.js +1 -92
- package/es/varlet.esm.js +115 -107
- package/highlight/web-types.json +1 -1
- package/lib/action-sheet/index.js +1 -1
- package/lib/back-top/BackTop.js +4 -2
- package/lib/badge/Badge.js +2 -2
- package/lib/bottom-navigation/BottomNavigation.js +1 -1
- package/lib/checkbox-group/CheckboxGroup.js +1 -1
- package/lib/col/Col.js +1 -1
- package/lib/collapse/Collapse.js +1 -1
- package/lib/collapse-item/CollapseItem.js +1 -1
- package/lib/countdown/Countdown.js +29 -2
- package/lib/counter/Counter.js +1 -1
- package/lib/date-picker/DatePicker.js +1 -1
- package/lib/date-picker/src/day-picker-panel.js +1 -1
- package/lib/date-picker/src/month-picker-panel.js +1 -1
- package/lib/date-picker/src/panel-header.js +1 -1
- package/lib/date-picker/src/year-picker-panel.js +1 -1
- package/lib/dialog/index.js +1 -1
- package/lib/divider/Divider.js +3 -3
- package/lib/icon/Icon.js +1 -1
- package/lib/image-preview/ImagePreview.js +1 -1
- package/lib/image-preview/index.js +1 -1
- package/lib/index-bar/IndexBar.js +4 -2
- package/lib/input/Input.js +1 -1
- package/lib/lazy/index.js +4 -2
- package/lib/list/List.js +4 -2
- package/lib/pagination/Pagination.js +1 -1
- package/lib/picker/Picker.js +4 -2
- package/lib/picker/index.js +1 -1
- package/lib/progress/Progress.js +1 -1
- package/lib/pull-refresh/PullRefresh.js +1 -1
- package/lib/rate/Rate.js +1 -1
- package/lib/ripple/index.js +15 -8
- package/lib/select/Select.js +1 -1
- package/lib/skeleton/Skeleton.js +1 -1
- package/lib/slider/Slider.js +1 -1
- package/lib/snackbar/index.js +1 -1
- package/lib/space/Space.js +1 -1
- package/lib/space/props.js +1 -1
- package/lib/sticky/Sticky.js +1 -1
- package/lib/swipe/Swipe.js +1 -1
- package/lib/tabs/Tabs.js +5 -3
- package/lib/time-picker/TimePicker.js +1 -1
- package/lib/time-picker/clock.js +1 -1
- package/lib/time-picker/utils.js +1 -1
- package/lib/uploader/Uploader.js +7 -5
- package/lib/utils/components.js +1 -1
- package/lib/utils/elements.js +1 -1
- package/lib/utils/jest.js +1 -1
- package/lib/utils/shared.js +2 -135
- package/package.json +13 -6
- package/umd/varlet.js +3 -3
package/es/utils/shared.js
CHANGED
|
@@ -1,15 +1,3 @@
|
|
|
1
|
-
export var toNumber = val => {
|
|
2
|
-
if (val == null) return 0;
|
|
3
|
-
|
|
4
|
-
if (isString(val)) {
|
|
5
|
-
val = parseFloat(val);
|
|
6
|
-
val = Number.isNaN(val) ? 0 : val;
|
|
7
|
-
return val;
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
if (isBool(val)) return Number(val);
|
|
11
|
-
return val;
|
|
12
|
-
};
|
|
13
1
|
export var isHTMLSupportImage = val => {
|
|
14
2
|
if (val == null) {
|
|
15
3
|
return false;
|
|
@@ -24,20 +12,6 @@ export var isHTMLSupportVideo = val => {
|
|
|
24
12
|
|
|
25
13
|
return val.startsWith('data:video') || /\.(mp4|webm|ogg)$/.test(val);
|
|
26
14
|
};
|
|
27
|
-
export var isString = val => typeof val === 'string';
|
|
28
|
-
export var isBool = val => typeof val === 'boolean';
|
|
29
|
-
export var isNumber = val => typeof val === 'number';
|
|
30
|
-
export var isPlainObject = val => Object.prototype.toString.call(val) === '[object Object]';
|
|
31
|
-
export var isObject = val => typeof val === 'object' && val !== null;
|
|
32
|
-
export var isArray = val => Array.isArray(val);
|
|
33
|
-
export var isURL = val => {
|
|
34
|
-
if (!val) {
|
|
35
|
-
return false;
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
return /^(http)|(\.*\/)/.test(val);
|
|
39
|
-
};
|
|
40
|
-
export var isEmpty = val => val === undefined || val === null || val === '' || Array.isArray(val) && !val.length;
|
|
41
15
|
export var removeItem = (arr, item) => {
|
|
42
16
|
if (arr.length) {
|
|
43
17
|
var index = arr.indexOf(item);
|
|
@@ -47,39 +21,6 @@ export var removeItem = (arr, item) => {
|
|
|
47
21
|
}
|
|
48
22
|
}
|
|
49
23
|
};
|
|
50
|
-
export var throttle = function (method, mustRunDelay) {
|
|
51
|
-
if (mustRunDelay === void 0) {
|
|
52
|
-
mustRunDelay = 200;
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
var timer;
|
|
56
|
-
var start = 0;
|
|
57
|
-
return function loop() {
|
|
58
|
-
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
59
|
-
args[_key] = arguments[_key];
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
var now = Date.now();
|
|
63
|
-
var elapsed = now - start;
|
|
64
|
-
|
|
65
|
-
if (!start) {
|
|
66
|
-
start = now;
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
if (timer) {
|
|
70
|
-
window.clearTimeout(timer);
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
if (elapsed >= mustRunDelay) {
|
|
74
|
-
method.apply(this, args);
|
|
75
|
-
start = now;
|
|
76
|
-
} else {
|
|
77
|
-
timer = window.setTimeout(() => {
|
|
78
|
-
loop.apply(this, args);
|
|
79
|
-
}, mustRunDelay - elapsed);
|
|
80
|
-
}
|
|
81
|
-
};
|
|
82
|
-
};
|
|
83
24
|
export var createCache = max => {
|
|
84
25
|
var cache = [];
|
|
85
26
|
return {
|
|
@@ -111,36 +52,4 @@ export var createCache = max => {
|
|
|
111
52
|
export var linear = value => value;
|
|
112
53
|
export var cubic = value => Math.pow(value, 3);
|
|
113
54
|
export var easeInOutCubic = value => value < 0.5 ? cubic(value * 2) / 2 : 1 - cubic((1 - value) * 2) / 2;
|
|
114
|
-
export
|
|
115
|
-
var scannedTimes = Object.values(time);
|
|
116
|
-
var scannedFormats = ['DD', 'HH', 'mm', 'ss'];
|
|
117
|
-
var padValues = [24, 60, 60, 1000];
|
|
118
|
-
scannedFormats.forEach((scannedFormat, index) => {
|
|
119
|
-
if (!format.includes(scannedFormat)) {
|
|
120
|
-
scannedTimes[index + 1] += scannedTimes[index] * padValues[index];
|
|
121
|
-
} else {
|
|
122
|
-
format = format.replace(scannedFormat, String(scannedTimes[index]).padStart(2, '0'));
|
|
123
|
-
}
|
|
124
|
-
});
|
|
125
|
-
|
|
126
|
-
if (format.includes('S')) {
|
|
127
|
-
var ms = String(scannedTimes[scannedTimes.length - 1]).padStart(3, '0');
|
|
128
|
-
|
|
129
|
-
if (format.includes('SSS')) {
|
|
130
|
-
format = format.replace('SSS', ms);
|
|
131
|
-
} else if (format.includes('SS')) {
|
|
132
|
-
format = format.replace('SS', ms.slice(0, 2));
|
|
133
|
-
} else {
|
|
134
|
-
format = format.replace('S', ms.slice(0, 1));
|
|
135
|
-
}
|
|
136
|
-
}
|
|
137
|
-
|
|
138
|
-
return format;
|
|
139
|
-
}
|
|
140
|
-
export var dt = (value, defaultText) => value == null ? defaultText : value;
|
|
141
|
-
export var inBrowser = () => typeof window !== 'undefined';
|
|
142
|
-
export var uniq = arr => [...new Set(arr)];
|
|
143
|
-
export function kebabCase(str) {
|
|
144
|
-
var ret = str.replace(/([A-Z])/g, ' $1').trim();
|
|
145
|
-
return ret.split(' ').join('-').toLowerCase();
|
|
146
|
-
}
|
|
55
|
+
export var dt = (value, defaultText) => value == null ? defaultText : value;
|
package/es/varlet.esm.js
CHANGED
|
@@ -6,7 +6,20 @@ var context = {
|
|
|
6
6
|
};
|
|
7
7
|
reactive(context);
|
|
8
8
|
var Context = reactive(context);
|
|
9
|
-
|
|
9
|
+
const isString = (val) => typeof val === "string";
|
|
10
|
+
const isBoolean = (val) => typeof val === "boolean";
|
|
11
|
+
const isNumber = (val) => typeof val === "number";
|
|
12
|
+
const isPlainObject = (val) => Object.prototype.toString.call(val) === "[object Object]";
|
|
13
|
+
const isObject = (val) => typeof val === "object" && val !== null;
|
|
14
|
+
const isArray = (val) => Array.isArray(val);
|
|
15
|
+
const isURL = (val) => {
|
|
16
|
+
if (!val) {
|
|
17
|
+
return false;
|
|
18
|
+
}
|
|
19
|
+
return /^(http)|(\.*\/)/.test(val);
|
|
20
|
+
};
|
|
21
|
+
const isEmpty = (val) => val === void 0 || val === null || val === "" || Array.isArray(val) && !val.length;
|
|
22
|
+
const toNumber = (val) => {
|
|
10
23
|
if (val == null)
|
|
11
24
|
return 0;
|
|
12
25
|
if (isString(val)) {
|
|
@@ -14,55 +27,24 @@ var toNumber = (val) => {
|
|
|
14
27
|
val = Number.isNaN(val) ? 0 : val;
|
|
15
28
|
return val;
|
|
16
29
|
}
|
|
17
|
-
if (
|
|
30
|
+
if (isBoolean(val))
|
|
18
31
|
return Number(val);
|
|
19
32
|
return val;
|
|
20
33
|
};
|
|
21
|
-
|
|
22
|
-
if (val == null) {
|
|
23
|
-
return false;
|
|
24
|
-
}
|
|
25
|
-
return val.startsWith("data:image") || /\.(png|jpg|gif|jpeg|svg)$/.test(val);
|
|
26
|
-
};
|
|
27
|
-
var isHTMLSupportVideo = (val) => {
|
|
28
|
-
if (val == null) {
|
|
29
|
-
return false;
|
|
30
|
-
}
|
|
31
|
-
return val.startsWith("data:video") || /\.(mp4|webm|ogg)$/.test(val);
|
|
32
|
-
};
|
|
33
|
-
var isString = (val) => typeof val === "string";
|
|
34
|
-
var isBool = (val) => typeof val === "boolean";
|
|
35
|
-
var isNumber = (val) => typeof val === "number";
|
|
36
|
-
var isPlainObject = (val) => Object.prototype.toString.call(val) === "[object Object]";
|
|
37
|
-
var isObject = (val) => typeof val === "object" && val !== null;
|
|
38
|
-
var isArray = (val) => Array.isArray(val);
|
|
39
|
-
var isURL = (val) => {
|
|
40
|
-
if (!val) {
|
|
41
|
-
return false;
|
|
42
|
-
}
|
|
43
|
-
return /^(http)|(\.*\/)/.test(val);
|
|
44
|
-
};
|
|
45
|
-
var isEmpty = (val) => val === void 0 || val === null || val === "" || Array.isArray(val) && !val.length;
|
|
46
|
-
var removeItem = (arr, item) => {
|
|
34
|
+
const removeItem$1 = (arr, item) => {
|
|
47
35
|
if (arr.length) {
|
|
48
|
-
|
|
36
|
+
const index = arr.indexOf(item);
|
|
49
37
|
if (index > -1) {
|
|
50
38
|
return arr.splice(index, 1);
|
|
51
39
|
}
|
|
52
40
|
}
|
|
53
41
|
};
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
return function loop() {
|
|
61
|
-
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
62
|
-
args[_key] = arguments[_key];
|
|
63
|
-
}
|
|
64
|
-
var now = Date.now();
|
|
65
|
-
var elapsed = now - start;
|
|
42
|
+
const throttle = (method, mustRunDelay = 200) => {
|
|
43
|
+
let timer;
|
|
44
|
+
let start = 0;
|
|
45
|
+
return function loop(...args) {
|
|
46
|
+
const now = Date.now();
|
|
47
|
+
const elapsed = now - start;
|
|
66
48
|
if (!start) {
|
|
67
49
|
start = now;
|
|
68
50
|
}
|
|
@@ -79,61 +61,12 @@ var throttle = function(method, mustRunDelay) {
|
|
|
79
61
|
}
|
|
80
62
|
};
|
|
81
63
|
};
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
has(key) {
|
|
87
|
-
return this.cache.includes(key);
|
|
88
|
-
},
|
|
89
|
-
add(key) {
|
|
90
|
-
if (this.has(key)) {
|
|
91
|
-
return;
|
|
92
|
-
}
|
|
93
|
-
this.cache.length === max2 && cache.shift();
|
|
94
|
-
this.cache.push(key);
|
|
95
|
-
},
|
|
96
|
-
remove(key) {
|
|
97
|
-
this.has(key) && removeItem(this.cache, key);
|
|
98
|
-
},
|
|
99
|
-
clear() {
|
|
100
|
-
this.cache.length = 0;
|
|
101
|
-
}
|
|
102
|
-
};
|
|
103
|
-
};
|
|
104
|
-
var linear = (value) => value;
|
|
105
|
-
var cubic = (value) => Math.pow(value, 3);
|
|
106
|
-
var easeInOutCubic = (value) => value < 0.5 ? cubic(value * 2) / 2 : 1 - cubic((1 - value) * 2) / 2;
|
|
107
|
-
function parseFormat(format, time) {
|
|
108
|
-
var scannedTimes = Object.values(time);
|
|
109
|
-
var scannedFormats = ["DD", "HH", "mm", "ss"];
|
|
110
|
-
var padValues = [24, 60, 60, 1e3];
|
|
111
|
-
scannedFormats.forEach((scannedFormat, index) => {
|
|
112
|
-
if (!format.includes(scannedFormat)) {
|
|
113
|
-
scannedTimes[index + 1] += scannedTimes[index] * padValues[index];
|
|
114
|
-
} else {
|
|
115
|
-
format = format.replace(scannedFormat, String(scannedTimes[index]).padStart(2, "0"));
|
|
116
|
-
}
|
|
117
|
-
});
|
|
118
|
-
if (format.includes("S")) {
|
|
119
|
-
var ms = String(scannedTimes[scannedTimes.length - 1]).padStart(3, "0");
|
|
120
|
-
if (format.includes("SSS")) {
|
|
121
|
-
format = format.replace("SSS", ms);
|
|
122
|
-
} else if (format.includes("SS")) {
|
|
123
|
-
format = format.replace("SS", ms.slice(0, 2));
|
|
124
|
-
} else {
|
|
125
|
-
format = format.replace("S", ms.slice(0, 1));
|
|
126
|
-
}
|
|
127
|
-
}
|
|
128
|
-
return format;
|
|
129
|
-
}
|
|
130
|
-
var dt = (value, defaultText) => value == null ? defaultText : value;
|
|
131
|
-
var inBrowser = () => typeof window !== "undefined";
|
|
132
|
-
var uniq = (arr) => [...new Set(arr)];
|
|
133
|
-
function kebabCase(str) {
|
|
134
|
-
var ret = str.replace(/([A-Z])/g, " $1").trim();
|
|
64
|
+
const inBrowser = () => typeof window !== "undefined";
|
|
65
|
+
const uniq = (arr) => [...new Set(arr)];
|
|
66
|
+
const kebabCase = (s) => {
|
|
67
|
+
const ret = s.replace(/([A-Z])/g, " $1").trim();
|
|
135
68
|
return ret.split(" ").join("-").toLowerCase();
|
|
136
|
-
}
|
|
69
|
+
};
|
|
137
70
|
function asyncGeneratorStep$d(gen, resolve, reject, _next, _throw, key, arg) {
|
|
138
71
|
try {
|
|
139
72
|
var info = gen[key](arg);
|
|
@@ -473,7 +406,7 @@ function useAtChildrenCounter(key) {
|
|
|
473
406
|
sortInstances();
|
|
474
407
|
};
|
|
475
408
|
var clear2 = (instance) => {
|
|
476
|
-
removeItem(instances, instance);
|
|
409
|
+
removeItem$1(instances, instance);
|
|
477
410
|
};
|
|
478
411
|
provide(key, {
|
|
479
412
|
collect,
|
|
@@ -515,7 +448,7 @@ function useChildren(key) {
|
|
|
515
448
|
childProviders.push(childProvider);
|
|
516
449
|
};
|
|
517
450
|
var clear2 = (childProvider) => {
|
|
518
|
-
removeItem(childProviders, childProvider);
|
|
451
|
+
removeItem$1(childProviders, childProvider);
|
|
519
452
|
};
|
|
520
453
|
var bindChildren = (parentProvider) => {
|
|
521
454
|
provide(key, _extends$e({
|
|
@@ -800,14 +733,20 @@ function unmounted(el) {
|
|
|
800
733
|
document.removeEventListener("touchcancel", el._ripple.removeRipple);
|
|
801
734
|
}
|
|
802
735
|
function updated$1(el, binding) {
|
|
803
|
-
var _binding$value3, _binding$
|
|
804
|
-
|
|
805
|
-
|
|
736
|
+
var _binding$value$touchm2, _binding$value3, _binding$value4, _binding$value5, _el$_ripple, _el$_ripple2, _el$_ripple3;
|
|
737
|
+
var newBinding = {
|
|
738
|
+
touchmoveForbid: (_binding$value$touchm2 = (_binding$value3 = binding.value) == null ? void 0 : _binding$value3.touchmoveForbid) != null ? _binding$value$touchm2 : Context.touchmoveForbid,
|
|
739
|
+
color: (_binding$value4 = binding.value) == null ? void 0 : _binding$value4.color,
|
|
740
|
+
disabled: (_binding$value5 = binding.value) == null ? void 0 : _binding$value5.disabled
|
|
741
|
+
};
|
|
742
|
+
var diff2 = newBinding.touchmoveForbid !== ((_el$_ripple = el._ripple) == null ? void 0 : _el$_ripple.touchmoveForbid) || newBinding.color !== ((_el$_ripple2 = el._ripple) == null ? void 0 : _el$_ripple2.color) || newBinding.disabled !== ((_el$_ripple3 = el._ripple) == null ? void 0 : _el$_ripple3.disabled);
|
|
743
|
+
if (diff2) {
|
|
744
|
+
var _el$_ripple4, _el$_ripple5;
|
|
745
|
+
el._ripple = _extends$d({
|
|
746
|
+
tasker: (_el$_ripple4 = el._ripple) == null ? void 0 : _el$_ripple4.tasker,
|
|
747
|
+
removeRipple: (_el$_ripple5 = el._ripple) == null ? void 0 : _el$_ripple5.removeRipple
|
|
748
|
+
}, newBinding);
|
|
806
749
|
}
|
|
807
|
-
el._ripple = _extends$d({}, el._ripple, (_binding$value3 = binding.value) != null ? _binding$value3 : {}, {
|
|
808
|
-
touchmoveForbid: (_binding$value$touchm2 = (_binding$value4 = binding.value) == null ? void 0 : _binding$value4.touchmoveForbid) != null ? _binding$value$touchm2 : Context.touchmoveForbid,
|
|
809
|
-
tasker: null
|
|
810
|
-
});
|
|
811
750
|
}
|
|
812
751
|
var Ripple = {
|
|
813
752
|
mounted: mounted$1,
|
|
@@ -1245,6 +1184,52 @@ var props$S = _extends$b({
|
|
|
1245
1184
|
"onClickOverlay",
|
|
1246
1185
|
"onRouteChange"
|
|
1247
1186
|
]));
|
|
1187
|
+
var isHTMLSupportImage = (val) => {
|
|
1188
|
+
if (val == null) {
|
|
1189
|
+
return false;
|
|
1190
|
+
}
|
|
1191
|
+
return val.startsWith("data:image") || /\.(png|jpg|gif|jpeg|svg)$/.test(val);
|
|
1192
|
+
};
|
|
1193
|
+
var isHTMLSupportVideo = (val) => {
|
|
1194
|
+
if (val == null) {
|
|
1195
|
+
return false;
|
|
1196
|
+
}
|
|
1197
|
+
return val.startsWith("data:video") || /\.(mp4|webm|ogg)$/.test(val);
|
|
1198
|
+
};
|
|
1199
|
+
var removeItem = (arr, item) => {
|
|
1200
|
+
if (arr.length) {
|
|
1201
|
+
var index = arr.indexOf(item);
|
|
1202
|
+
if (index > -1) {
|
|
1203
|
+
return arr.splice(index, 1);
|
|
1204
|
+
}
|
|
1205
|
+
}
|
|
1206
|
+
};
|
|
1207
|
+
var createCache = (max2) => {
|
|
1208
|
+
var cache = [];
|
|
1209
|
+
return {
|
|
1210
|
+
cache,
|
|
1211
|
+
has(key) {
|
|
1212
|
+
return this.cache.includes(key);
|
|
1213
|
+
},
|
|
1214
|
+
add(key) {
|
|
1215
|
+
if (this.has(key)) {
|
|
1216
|
+
return;
|
|
1217
|
+
}
|
|
1218
|
+
this.cache.length === max2 && cache.shift();
|
|
1219
|
+
this.cache.push(key);
|
|
1220
|
+
},
|
|
1221
|
+
remove(key) {
|
|
1222
|
+
this.has(key) && removeItem(this.cache, key);
|
|
1223
|
+
},
|
|
1224
|
+
clear() {
|
|
1225
|
+
this.cache.length = 0;
|
|
1226
|
+
}
|
|
1227
|
+
};
|
|
1228
|
+
};
|
|
1229
|
+
var linear = (value) => value;
|
|
1230
|
+
var cubic = (value) => Math.pow(value, 3);
|
|
1231
|
+
var easeInOutCubic = (value) => value < 0.5 ? cubic(value * 2) / 2 : 1 - cubic((1 - value) * 2) / 2;
|
|
1232
|
+
var dt = (value, defaultText) => value == null ? defaultText : value;
|
|
1248
1233
|
var zhCN = {
|
|
1249
1234
|
dialogTitle: "\u63D0\u793A",
|
|
1250
1235
|
dialogConfirmButtonText: "\u786E\u8BA4",
|
|
@@ -4015,6 +4000,29 @@ var Countdown = defineComponent({
|
|
|
4015
4000
|
seconds: 0,
|
|
4016
4001
|
milliseconds: 0
|
|
4017
4002
|
});
|
|
4003
|
+
var parseFormat = (format, time) => {
|
|
4004
|
+
var scannedTimes = Object.values(time);
|
|
4005
|
+
var scannedFormats = ["DD", "HH", "mm", "ss"];
|
|
4006
|
+
var padValues = [24, 60, 60, 1e3];
|
|
4007
|
+
scannedFormats.forEach((scannedFormat, index) => {
|
|
4008
|
+
if (!format.includes(scannedFormat)) {
|
|
4009
|
+
scannedTimes[index + 1] += scannedTimes[index] * padValues[index];
|
|
4010
|
+
} else {
|
|
4011
|
+
format = format.replace(scannedFormat, String(scannedTimes[index]).padStart(2, "0"));
|
|
4012
|
+
}
|
|
4013
|
+
});
|
|
4014
|
+
if (format.includes("S")) {
|
|
4015
|
+
var ms = String(scannedTimes[scannedTimes.length - 1]).padStart(3, "0");
|
|
4016
|
+
if (format.includes("SSS")) {
|
|
4017
|
+
format = format.replace("SSS", ms);
|
|
4018
|
+
} else if (format.includes("SS")) {
|
|
4019
|
+
format = format.replace("SS", ms.slice(0, 2));
|
|
4020
|
+
} else {
|
|
4021
|
+
format = format.replace("S", ms.slice(0, 1));
|
|
4022
|
+
}
|
|
4023
|
+
}
|
|
4024
|
+
return format;
|
|
4025
|
+
};
|
|
4018
4026
|
var formatTime = (durationTime) => {
|
|
4019
4027
|
var days = Math.floor(durationTime / DAY);
|
|
4020
4028
|
var hours = Math.floor(durationTime % DAY / HOUR);
|
|
@@ -8857,7 +8865,7 @@ var Divider = defineComponent({
|
|
|
8857
8865
|
var state = reactive({
|
|
8858
8866
|
withText: false
|
|
8859
8867
|
});
|
|
8860
|
-
var isInset = computed(() =>
|
|
8868
|
+
var isInset = computed(() => isBoolean(props2.inset) ? props2.inset : true);
|
|
8861
8869
|
var style = computed(() => {
|
|
8862
8870
|
var {
|
|
8863
8871
|
inset,
|
|
@@ -8867,7 +8875,7 @@ var Divider = defineComponent({
|
|
|
8867
8875
|
var baseStyle = {
|
|
8868
8876
|
margin
|
|
8869
8877
|
};
|
|
8870
|
-
if (
|
|
8878
|
+
if (isBoolean(inset) || inset === 0)
|
|
8871
8879
|
return _extends$5({}, baseStyle);
|
|
8872
8880
|
var _inset = toNumber(inset);
|
|
8873
8881
|
var absInsetWithUnit = Math.abs(_inset) + (inset + "").replace(_inset + "", "");
|
|
@@ -9175,7 +9183,7 @@ function _add() {
|
|
|
9175
9183
|
return _add.apply(this, arguments);
|
|
9176
9184
|
}
|
|
9177
9185
|
function clear(el) {
|
|
9178
|
-
removeItem(lazyElements, el);
|
|
9186
|
+
removeItem$1(lazyElements, el);
|
|
9179
9187
|
lazyElements.length === 0 && unbindEvents();
|
|
9180
9188
|
}
|
|
9181
9189
|
function diff(el, binding) {
|
package/highlight/web-types.json
CHANGED
package/lib/back-top/BackTop.js
CHANGED
|
@@ -12,7 +12,9 @@ var _icon = _interopRequireDefault(require("../icon"));
|
|
|
12
12
|
|
|
13
13
|
var _props = require("./props");
|
|
14
14
|
|
|
15
|
-
var _shared = require("
|
|
15
|
+
var _shared = require("@varlet/shared");
|
|
16
|
+
|
|
17
|
+
var _shared2 = require("../utils/shared");
|
|
16
18
|
|
|
17
19
|
var _elements = require("../utils/elements");
|
|
18
20
|
|
|
@@ -84,7 +86,7 @@ var _default = (0, _vue.defineComponent)({
|
|
|
84
86
|
(0, _elements.scrollTo)(target, {
|
|
85
87
|
left,
|
|
86
88
|
duration: props.duration,
|
|
87
|
-
animation:
|
|
89
|
+
animation: _shared2.easeInOutCubic
|
|
88
90
|
});
|
|
89
91
|
};
|
|
90
92
|
|
package/lib/badge/Badge.js
CHANGED
|
@@ -6,12 +6,12 @@ exports.render = render;
|
|
|
6
6
|
|
|
7
7
|
var _icon = _interopRequireDefault(require("../icon"));
|
|
8
8
|
|
|
9
|
+
var _shared = require("@varlet/shared");
|
|
10
|
+
|
|
9
11
|
var _vue = require("vue");
|
|
10
12
|
|
|
11
13
|
var _props = require("./props");
|
|
12
14
|
|
|
13
|
-
var _shared = require("../utils/shared");
|
|
14
|
-
|
|
15
15
|
var _components = require("../utils/components");
|
|
16
16
|
|
|
17
17
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
@@ -14,7 +14,7 @@ var _provide = require("./provide");
|
|
|
14
14
|
|
|
15
15
|
var _components = require("../utils/components");
|
|
16
16
|
|
|
17
|
-
var _shared = require("
|
|
17
|
+
var _shared = require("@varlet/shared");
|
|
18
18
|
|
|
19
19
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
20
20
|
|
|
@@ -16,7 +16,7 @@ var _provide = require("./provide");
|
|
|
16
16
|
|
|
17
17
|
var _provide2 = require("../form/provide");
|
|
18
18
|
|
|
19
|
-
var _shared = require("
|
|
19
|
+
var _shared = require("@varlet/shared");
|
|
20
20
|
|
|
21
21
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
22
22
|
|
package/lib/col/Col.js
CHANGED
package/lib/collapse/Collapse.js
CHANGED
|
@@ -10,7 +10,7 @@ var _props = require("./props");
|
|
|
10
10
|
|
|
11
11
|
var _elements = require("../utils/elements");
|
|
12
12
|
|
|
13
|
-
var _shared = require("
|
|
13
|
+
var _shared = require("@varlet/shared");
|
|
14
14
|
|
|
15
15
|
var _components = require("../utils/components");
|
|
16
16
|
|
|
@@ -51,6 +51,33 @@ var _default = (0, _vue.defineComponent)({
|
|
|
51
51
|
milliseconds: 0
|
|
52
52
|
});
|
|
53
53
|
|
|
54
|
+
var parseFormat = (format, time) => {
|
|
55
|
+
var scannedTimes = Object.values(time);
|
|
56
|
+
var scannedFormats = ['DD', 'HH', 'mm', 'ss'];
|
|
57
|
+
var padValues = [24, 60, 60, 1000];
|
|
58
|
+
scannedFormats.forEach((scannedFormat, index) => {
|
|
59
|
+
if (!format.includes(scannedFormat)) {
|
|
60
|
+
scannedTimes[index + 1] += scannedTimes[index] * padValues[index];
|
|
61
|
+
} else {
|
|
62
|
+
format = format.replace(scannedFormat, String(scannedTimes[index]).padStart(2, '0'));
|
|
63
|
+
}
|
|
64
|
+
});
|
|
65
|
+
|
|
66
|
+
if (format.includes('S')) {
|
|
67
|
+
var ms = String(scannedTimes[scannedTimes.length - 1]).padStart(3, '0');
|
|
68
|
+
|
|
69
|
+
if (format.includes('SSS')) {
|
|
70
|
+
format = format.replace('SSS', ms);
|
|
71
|
+
} else if (format.includes('SS')) {
|
|
72
|
+
format = format.replace('SS', ms.slice(0, 2));
|
|
73
|
+
} else {
|
|
74
|
+
format = format.replace('S', ms.slice(0, 1));
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
return format;
|
|
79
|
+
};
|
|
80
|
+
|
|
54
81
|
var formatTime = durationTime => {
|
|
55
82
|
var days = Math.floor(durationTime / DAY);
|
|
56
83
|
var hours = Math.floor(durationTime % DAY / HOUR);
|
|
@@ -66,7 +93,7 @@ var _default = (0, _vue.defineComponent)({
|
|
|
66
93
|
};
|
|
67
94
|
timeData.value = time;
|
|
68
95
|
(0, _components.call)(props.onChange, timeData.value);
|
|
69
|
-
showTime.value =
|
|
96
|
+
showTime.value = parseFormat(props.format, time);
|
|
70
97
|
};
|
|
71
98
|
|
|
72
99
|
var countdown = () => {
|
package/lib/counter/Counter.js
CHANGED
|
@@ -16,7 +16,7 @@ var _dayPickerPanel = _interopRequireDefault(require("./src/day-picker-panel.js"
|
|
|
16
16
|
|
|
17
17
|
var _props = require("./props");
|
|
18
18
|
|
|
19
|
-
var _shared = require("
|
|
19
|
+
var _shared = require("@varlet/shared");
|
|
20
20
|
|
|
21
21
|
var _elements = require("../utils/elements");
|
|
22
22
|
|
|
@@ -18,7 +18,7 @@ var _panelHeader = _interopRequireDefault(require("./panel-header.js"));
|
|
|
18
18
|
|
|
19
19
|
var _button = _interopRequireDefault(require("../../button"));
|
|
20
20
|
|
|
21
|
-
var _shared = require("
|
|
21
|
+
var _shared = require("@varlet/shared");
|
|
22
22
|
|
|
23
23
|
var _components = require("../../utils/components");
|
|
24
24
|
|
package/lib/dialog/index.js
CHANGED
package/lib/divider/Divider.js
CHANGED
|
@@ -8,7 +8,7 @@ var _vue = require("vue");
|
|
|
8
8
|
|
|
9
9
|
var _elements = require("../utils/elements");
|
|
10
10
|
|
|
11
|
-
var _shared = require("
|
|
11
|
+
var _shared = require("@varlet/shared");
|
|
12
12
|
|
|
13
13
|
var _props = require("./props");
|
|
14
14
|
|
|
@@ -47,7 +47,7 @@ var _default = (0, _vue.defineComponent)({
|
|
|
47
47
|
var state = (0, _vue.reactive)({
|
|
48
48
|
withText: false
|
|
49
49
|
});
|
|
50
|
-
var isInset = (0, _vue.computed)(() => (0, _shared.
|
|
50
|
+
var isInset = (0, _vue.computed)(() => (0, _shared.isBoolean)(props.inset) ? props.inset : true);
|
|
51
51
|
var style = (0, _vue.computed)(() => {
|
|
52
52
|
var {
|
|
53
53
|
inset,
|
|
@@ -57,7 +57,7 @@ var _default = (0, _vue.defineComponent)({
|
|
|
57
57
|
var baseStyle = {
|
|
58
58
|
margin
|
|
59
59
|
};
|
|
60
|
-
if ((0, _shared.
|
|
60
|
+
if ((0, _shared.isBoolean)(inset) || inset === 0) return _extends({}, baseStyle); // -18px -> -18
|
|
61
61
|
|
|
62
62
|
var _inset = (0, _shared.toNumber)(inset); // -18px -> 18px
|
|
63
63
|
|