@tuya-miniapp/smart-ui 2.7.0 → 2.7.1-beta-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.
|
@@ -157,7 +157,7 @@ function wrapperItemStyle(data) {
|
|
|
157
157
|
}
|
|
158
158
|
|
|
159
159
|
function wrapperItemClass(data) {
|
|
160
|
-
var optionsVIndexList = getVisibleOptions(data.animationIndex, data.instanceId) || data.optionsVIndexList;
|
|
160
|
+
var optionsVIndexList = getVisibleOptions(data.animationIndex, data.instanceId, data.options) || data.optionsVIndexList;
|
|
161
161
|
var animationIndex = data.animationIndex;
|
|
162
162
|
var intAnimationIndex = Math.round(animationIndex);
|
|
163
163
|
var activeIndex = (intAnimationIndex + 1) % data.options.length - 1;
|
|
@@ -172,7 +172,7 @@ function wrapperItemClass(data) {
|
|
|
172
172
|
}
|
|
173
173
|
|
|
174
174
|
function wrapperItemTextStyle(data) {
|
|
175
|
-
var optionsVIndexList = getVisibleOptions(data.animationIndex, data.instanceId) || data.optionsVIndexList;
|
|
175
|
+
var optionsVIndexList = getVisibleOptions(data.animationIndex, data.instanceId, data.options) || data.optionsVIndexList;
|
|
176
176
|
var animationIndex = data.animationIndex;
|
|
177
177
|
var intAnimationIndex = Math.round(animationIndex);
|
|
178
178
|
var activeIndex = (intAnimationIndex + 1) % data.options.length - 1;
|
|
@@ -457,9 +457,12 @@ function updateVisibleOptions(currentIndex, instanceId) {
|
|
|
457
457
|
|
|
458
458
|
var Cache = {}
|
|
459
459
|
|
|
460
|
-
function getVisibleOptions(currentIndex, instanceId) {
|
|
460
|
+
function getVisibleOptions(currentIndex, instanceId, options) {
|
|
461
461
|
var state = getCurrState(instanceId);
|
|
462
|
-
if(!state) return
|
|
462
|
+
if (!state) return
|
|
463
|
+
if (!options) {
|
|
464
|
+
options = state.options;
|
|
465
|
+
}
|
|
463
466
|
var animationIndex = Math.round(
|
|
464
467
|
currentIndex !== undefined ? currentIndex : state.animationIndex
|
|
465
468
|
);
|
|
@@ -467,7 +470,7 @@ function getVisibleOptions(currentIndex, instanceId) {
|
|
|
467
470
|
visibleItemCount: state.visibleItemCount,
|
|
468
471
|
animationIndex: animationIndex,
|
|
469
472
|
loop: state.loop,
|
|
470
|
-
optionsLength:
|
|
473
|
+
optionsLength: options.length,
|
|
471
474
|
}
|
|
472
475
|
if (!Cache[instanceId]) {
|
|
473
476
|
Cache[instanceId] = {}
|
|
@@ -483,7 +486,7 @@ function getVisibleOptions(currentIndex, instanceId) {
|
|
|
483
486
|
var newValueArr = wxUtils.createArray(partCount * 2 + 1, '');
|
|
484
487
|
if (state.loop) {
|
|
485
488
|
// 循环模式:根据 options 首尾填充 newValueArr 数组
|
|
486
|
-
var optionsLength =
|
|
489
|
+
var optionsLength = options.length;
|
|
487
490
|
if (optionsLength === 0) {
|
|
488
491
|
// 如果没有选项,填充空值
|
|
489
492
|
wxUtils.fillArray(newValueArr, '');
|
|
@@ -505,8 +508,8 @@ function getVisibleOptions(currentIndex, instanceId) {
|
|
|
505
508
|
if (animationIndex < 0) {
|
|
506
509
|
animationIndex = 0;
|
|
507
510
|
}
|
|
508
|
-
if (animationIndex >
|
|
509
|
-
animationIndex =
|
|
511
|
+
if (animationIndex > options.length - 1) {
|
|
512
|
+
animationIndex = options.length - 1;
|
|
510
513
|
}
|
|
511
514
|
newValueArr.forEach(function(item, index) {
|
|
512
515
|
var valueIndex =
|
|
@@ -157,7 +157,7 @@ function wrapperItemStyle(data) {
|
|
|
157
157
|
}
|
|
158
158
|
|
|
159
159
|
function wrapperItemClass(data) {
|
|
160
|
-
var optionsVIndexList = getVisibleOptions(data.animationIndex, data.instanceId) || data.optionsVIndexList;
|
|
160
|
+
var optionsVIndexList = getVisibleOptions(data.animationIndex, data.instanceId, data.options) || data.optionsVIndexList;
|
|
161
161
|
var animationIndex = data.animationIndex;
|
|
162
162
|
var intAnimationIndex = Math.round(animationIndex);
|
|
163
163
|
var activeIndex = (intAnimationIndex + 1) % data.options.length - 1;
|
|
@@ -172,7 +172,7 @@ function wrapperItemClass(data) {
|
|
|
172
172
|
}
|
|
173
173
|
|
|
174
174
|
function wrapperItemTextStyle(data) {
|
|
175
|
-
var optionsVIndexList = getVisibleOptions(data.animationIndex, data.instanceId) || data.optionsVIndexList;
|
|
175
|
+
var optionsVIndexList = getVisibleOptions(data.animationIndex, data.instanceId, data.options) || data.optionsVIndexList;
|
|
176
176
|
var animationIndex = data.animationIndex;
|
|
177
177
|
var intAnimationIndex = Math.round(animationIndex);
|
|
178
178
|
var activeIndex = (intAnimationIndex + 1) % data.options.length - 1;
|
|
@@ -457,9 +457,12 @@ function updateVisibleOptions(currentIndex, instanceId) {
|
|
|
457
457
|
|
|
458
458
|
var Cache = {}
|
|
459
459
|
|
|
460
|
-
function getVisibleOptions(currentIndex, instanceId) {
|
|
460
|
+
function getVisibleOptions(currentIndex, instanceId, options) {
|
|
461
461
|
var state = getCurrState(instanceId);
|
|
462
|
-
if(!state) return
|
|
462
|
+
if (!state) return
|
|
463
|
+
if (!options) {
|
|
464
|
+
options = state.options;
|
|
465
|
+
}
|
|
463
466
|
var animationIndex = Math.round(
|
|
464
467
|
currentIndex !== undefined ? currentIndex : state.animationIndex
|
|
465
468
|
);
|
|
@@ -467,7 +470,7 @@ function getVisibleOptions(currentIndex, instanceId) {
|
|
|
467
470
|
visibleItemCount: state.visibleItemCount,
|
|
468
471
|
animationIndex: animationIndex,
|
|
469
472
|
loop: state.loop,
|
|
470
|
-
optionsLength:
|
|
473
|
+
optionsLength: options.length,
|
|
471
474
|
}
|
|
472
475
|
if (!Cache[instanceId]) {
|
|
473
476
|
Cache[instanceId] = {}
|
|
@@ -483,7 +486,7 @@ function getVisibleOptions(currentIndex, instanceId) {
|
|
|
483
486
|
var newValueArr = wxUtils.createArray(partCount * 2 + 1, '');
|
|
484
487
|
if (state.loop) {
|
|
485
488
|
// 循环模式:根据 options 首尾填充 newValueArr 数组
|
|
486
|
-
var optionsLength =
|
|
489
|
+
var optionsLength = options.length;
|
|
487
490
|
if (optionsLength === 0) {
|
|
488
491
|
// 如果没有选项,填充空值
|
|
489
492
|
wxUtils.fillArray(newValueArr, '');
|
|
@@ -505,8 +508,8 @@ function getVisibleOptions(currentIndex, instanceId) {
|
|
|
505
508
|
if (animationIndex < 0) {
|
|
506
509
|
animationIndex = 0;
|
|
507
510
|
}
|
|
508
|
-
if (animationIndex >
|
|
509
|
-
animationIndex =
|
|
511
|
+
if (animationIndex > options.length - 1) {
|
|
512
|
+
animationIndex = options.length - 1;
|
|
510
513
|
}
|
|
511
514
|
newValueArr.forEach(function(item, index) {
|
|
512
515
|
var valueIndex =
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tuya-miniapp/smart-ui",
|
|
3
|
-
"version": "2.7.0",
|
|
3
|
+
"version": "2.7.1-beta-0",
|
|
4
4
|
"author": "MiniApp Team",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"miniprogram": "lib",
|
|
@@ -99,4 +99,4 @@
|
|
|
99
99
|
"type": "git",
|
|
100
100
|
"url": "https://github.com/Tuya-Community/miniapp-smart-ui.git"
|
|
101
101
|
}
|
|
102
|
-
}
|
|
102
|
+
}
|