@tuya-miniapp/smart-ui 2.13.4-beta-2 → 2.13.4-beta-3
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/common/utils.js +2 -2
- package/dist/rate/index.js +2 -2
- package/dist/tabs/index.js +6 -1
- package/lib/common/utils.js +2 -2
- package/lib/rate/index.js +2 -1
- package/lib/tabs/index.js +6 -1
- package/package.json +1 -1
package/dist/common/utils.js
CHANGED
|
@@ -47,7 +47,7 @@ export function getRect(context, selector) {
|
|
|
47
47
|
.in(context)
|
|
48
48
|
.select(selector)
|
|
49
49
|
.boundingClientRect()
|
|
50
|
-
.exec((rect = []) => resolve(rect[0]));
|
|
50
|
+
.exec((rect = []) => resolve((rect || [])[0]));
|
|
51
51
|
});
|
|
52
52
|
}
|
|
53
53
|
export function getAllRect(context, selector) {
|
|
@@ -56,7 +56,7 @@ export function getAllRect(context, selector) {
|
|
|
56
56
|
.in(context)
|
|
57
57
|
.selectAll(selector)
|
|
58
58
|
.boundingClientRect()
|
|
59
|
-
.exec((rect = []) => resolve(rect[0]));
|
|
59
|
+
.exec((rect = []) => resolve((rect || [])[0] || []));
|
|
60
60
|
});
|
|
61
61
|
}
|
|
62
62
|
export function groupSetData(context, cb) {
|
package/dist/rate/index.js
CHANGED
|
@@ -76,8 +76,8 @@ SmartComponent({
|
|
|
76
76
|
if (!touchable)
|
|
77
77
|
return;
|
|
78
78
|
const { clientX } = event.touches[0];
|
|
79
|
-
getAllRect(this, '.smart-rate__icon').then(list => {
|
|
80
|
-
const target = list
|
|
79
|
+
getAllRect(this, '.smart-rate__icon').then((list = []) => {
|
|
80
|
+
const target = (list || [])
|
|
81
81
|
.sort((cur, next) => cur.dataset.score - next.dataset.score)
|
|
82
82
|
.find(item => clientX >= item.left && clientX <= item.right);
|
|
83
83
|
if (target != null) {
|
package/dist/tabs/index.js
CHANGED
|
@@ -227,7 +227,12 @@ SmartComponent({
|
|
|
227
227
|
return;
|
|
228
228
|
}
|
|
229
229
|
Promise.all([getAllRect(this, '.smart-tab'), getRect(this, '.smart-tabs__nav')]).then(([tabRects, navRect]) => {
|
|
230
|
-
const tabRect = tabRects[currentIndex];
|
|
230
|
+
const tabRect = tabRects === null || tabRects === void 0 ? void 0 : tabRects[currentIndex];
|
|
231
|
+
// On Android the layout query can resolve before the tabs are laid out,
|
|
232
|
+
// in which case there is nothing to scroll to yet.
|
|
233
|
+
if (tabRect == null || navRect == null) {
|
|
234
|
+
return;
|
|
235
|
+
}
|
|
231
236
|
const offsetLeft = tabRects
|
|
232
237
|
.slice(0, currentIndex)
|
|
233
238
|
.reduce((prev, curr) => prev + curr.width, 0);
|
package/lib/common/utils.js
CHANGED
|
@@ -59,7 +59,7 @@ function getRect(context, selector) {
|
|
|
59
59
|
.boundingClientRect()
|
|
60
60
|
.exec(function (rect) {
|
|
61
61
|
if (rect === void 0) { rect = []; }
|
|
62
|
-
return resolve(rect[0]);
|
|
62
|
+
return resolve((rect || [])[0]);
|
|
63
63
|
});
|
|
64
64
|
});
|
|
65
65
|
}
|
|
@@ -72,7 +72,7 @@ function getAllRect(context, selector) {
|
|
|
72
72
|
.boundingClientRect()
|
|
73
73
|
.exec(function (rect) {
|
|
74
74
|
if (rect === void 0) { rect = []; }
|
|
75
|
-
return resolve(rect[0]);
|
|
75
|
+
return resolve((rect || [])[0] || []);
|
|
76
76
|
});
|
|
77
77
|
});
|
|
78
78
|
}
|
package/lib/rate/index.js
CHANGED
|
@@ -95,7 +95,8 @@ var version_1 = require("../common/version");
|
|
|
95
95
|
return;
|
|
96
96
|
var clientX = event.touches[0].clientX;
|
|
97
97
|
(0, utils_1.getAllRect)(this, '.smart-rate__icon').then(function (list) {
|
|
98
|
-
|
|
98
|
+
if (list === void 0) { list = []; }
|
|
99
|
+
var target = (list || [])
|
|
99
100
|
.sort(function (cur, next) { return cur.dataset.score - next.dataset.score; })
|
|
100
101
|
.find(function (item) { return clientX >= item.left && clientX <= item.right; });
|
|
101
102
|
if (target != null) {
|
package/lib/tabs/index.js
CHANGED
|
@@ -253,7 +253,12 @@ var ty_1 = __importDefault(require("../common/ty"));
|
|
|
253
253
|
}
|
|
254
254
|
Promise.all([(0, utils_1.getAllRect)(this, '.smart-tab'), (0, utils_1.getRect)(this, '.smart-tabs__nav')]).then(function (_a) {
|
|
255
255
|
var tabRects = _a[0], navRect = _a[1];
|
|
256
|
-
var tabRect = tabRects[currentIndex];
|
|
256
|
+
var tabRect = tabRects === null || tabRects === void 0 ? void 0 : tabRects[currentIndex];
|
|
257
|
+
// On Android the layout query can resolve before the tabs are laid out,
|
|
258
|
+
// in which case there is nothing to scroll to yet.
|
|
259
|
+
if (tabRect == null || navRect == null) {
|
|
260
|
+
return;
|
|
261
|
+
}
|
|
257
262
|
var offsetLeft = tabRects
|
|
258
263
|
.slice(0, currentIndex)
|
|
259
264
|
.reduce(function (prev, curr) { return prev + curr.width; }, 0);
|