@tuya-miniapp/smart-ui 2.1.11-beta-10 → 2.2.0
Sign up to get free protection for your applications and to get access to all the features.
package/dist/toast/toast.js
CHANGED
@@ -13,7 +13,9 @@ const defaultOptions = {
|
|
13
13
|
selector: '#smart-toast',
|
14
14
|
width: '',
|
15
15
|
};
|
16
|
-
|
16
|
+
const queueRef = {
|
17
|
+
value: [],
|
18
|
+
};
|
17
19
|
// @ts-expect-error
|
18
20
|
let currentOptions = Object.assign({}, defaultOptions);
|
19
21
|
function parseOptions(message) {
|
@@ -40,13 +42,13 @@ function Toast(toastOptions) {
|
|
40
42
|
options.onClose();
|
41
43
|
}
|
42
44
|
};
|
43
|
-
|
45
|
+
queueRef.value.push(toast);
|
44
46
|
toast.setData(options);
|
45
47
|
clearTimeout(toast.timer);
|
46
48
|
if (options.duration != null && options.duration > 0) {
|
47
49
|
toast.timer = setTimeout(() => {
|
48
50
|
toast.clear();
|
49
|
-
|
51
|
+
queueRef.value = queueRef.value.filter(item => item !== toast);
|
50
52
|
}, options.duration);
|
51
53
|
}
|
52
54
|
return toast;
|
@@ -57,10 +59,10 @@ Toast.success = createMethod('success');
|
|
57
59
|
Toast.fail = createMethod('fail');
|
58
60
|
Toast.warn = createMethod('warn');
|
59
61
|
Toast.clear = () => {
|
60
|
-
|
62
|
+
queueRef.value.forEach(toast => {
|
61
63
|
toast.clear();
|
62
64
|
});
|
63
|
-
|
65
|
+
queueRef.value = [];
|
64
66
|
};
|
65
67
|
Toast.setDefaultOptions = (options) => {
|
66
68
|
Object.assign(currentOptions, options);
|
@@ -9,7 +9,7 @@ var toast_1 = __importDefault(require("../../toast/toast"));
|
|
9
9
|
data: {
|
10
10
|
minHour: 10,
|
11
11
|
maxHour: 20,
|
12
|
-
columnsOrder: [
|
12
|
+
columnsOrder: [3, 2, 1],
|
13
13
|
minDate: new Date(2018, 0, 1).getTime(),
|
14
14
|
maxDate: new Date(2019, 10, 1).getTime(),
|
15
15
|
currentDate1: new Date(2018, 2, 31).getTime(),
|
@@ -69,6 +69,17 @@ var toast_1 = __importDefault(require("../../toast/toast"));
|
|
69
69
|
message: result,
|
70
70
|
});
|
71
71
|
},
|
72
|
+
onInputChange: function (event) {
|
73
|
+
var detail = event.detail, currentTarget = event.currentTarget;
|
74
|
+
this.setData({
|
75
|
+
currentDate5: detail
|
76
|
+
});
|
77
|
+
var result = this.getResult(detail, currentTarget.dataset.type);
|
78
|
+
(0, toast_1.default)({
|
79
|
+
context: this,
|
80
|
+
message: result,
|
81
|
+
});
|
82
|
+
},
|
72
83
|
getResult: function (time, type) {
|
73
84
|
var date = new Date(time);
|
74
85
|
switch (type) {
|
package/lib/picker/demo/index.js
CHANGED
@@ -47,6 +47,16 @@ var toast_1 = __importDefault(require("../../toast/toast"));
|
|
47
47
|
unit: 'Kg',
|
48
48
|
},
|
49
49
|
],
|
50
|
+
column6: [
|
51
|
+
{
|
52
|
+
values: [I18n.t('zhejiang'), I18n.t('fujian')],
|
53
|
+
order: 2
|
54
|
+
},
|
55
|
+
{
|
56
|
+
values: [I18n.t('hangzhou'), I18n.t('ningbo'), I18n.t('wenzhou'), I18n.t('jiaxing'), I18n.t('huzhou')],
|
57
|
+
order: 1
|
58
|
+
},
|
59
|
+
],
|
50
60
|
},
|
51
61
|
methods: {
|
52
62
|
onChange1: function (event) {
|
package/lib/toast/toast.js
CHANGED
@@ -27,7 +27,9 @@ var defaultOptions = {
|
|
27
27
|
selector: '#smart-toast',
|
28
28
|
width: '',
|
29
29
|
};
|
30
|
-
var
|
30
|
+
var queueRef = {
|
31
|
+
value: [],
|
32
|
+
};
|
31
33
|
// @ts-expect-error
|
32
34
|
var currentOptions = __assign({}, defaultOptions);
|
33
35
|
function parseOptions(message) {
|
@@ -54,13 +56,13 @@ function Toast(toastOptions) {
|
|
54
56
|
options.onClose();
|
55
57
|
}
|
56
58
|
};
|
57
|
-
|
59
|
+
queueRef.value.push(toast);
|
58
60
|
toast.setData(options);
|
59
61
|
clearTimeout(toast.timer);
|
60
62
|
if (options.duration != null && options.duration > 0) {
|
61
63
|
toast.timer = setTimeout(function () {
|
62
64
|
toast.clear();
|
63
|
-
|
65
|
+
queueRef.value = queueRef.value.filter(function (item) { return item !== toast; });
|
64
66
|
}, options.duration);
|
65
67
|
}
|
66
68
|
return toast;
|
@@ -73,10 +75,10 @@ Toast.success = createMethod('success');
|
|
73
75
|
Toast.fail = createMethod('fail');
|
74
76
|
Toast.warn = createMethod('warn');
|
75
77
|
Toast.clear = function () {
|
76
|
-
|
78
|
+
queueRef.value.forEach(function (toast) {
|
77
79
|
toast.clear();
|
78
80
|
});
|
79
|
-
|
81
|
+
queueRef.value = [];
|
80
82
|
};
|
81
83
|
Toast.setDefaultOptions = function (options) {
|
82
84
|
Object.assign(currentOptions, options);
|