@tuya-miniapp/smart-ui 2.5.1-beta-3 → 2.5.1-beta-4
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.
@@ -136,10 +136,10 @@ SmartComponent({
|
|
136
136
|
// @ts-ignore
|
137
137
|
this.vibrateShort();
|
138
138
|
}
|
139
|
-
|
139
|
+
const animationIndex = Math.abs(-offset / data.itemHeight);
|
140
140
|
this.setData({
|
141
141
|
offset,
|
142
|
-
|
142
|
+
animationIndex: animationIndex,
|
143
143
|
preOffsetList: [...data.preOffsetList, offset],
|
144
144
|
animate: false,
|
145
145
|
});
|
@@ -185,7 +185,7 @@ SmartComponent({
|
|
185
185
|
// 最终定位索引
|
186
186
|
this.setData({
|
187
187
|
duration: isSameTouch ? 150 : data.animationTime,
|
188
|
-
|
188
|
+
animationIndex: index,
|
189
189
|
offset: offsetData,
|
190
190
|
animate: true,
|
191
191
|
});
|
@@ -324,7 +324,7 @@ SmartComponent({
|
|
324
324
|
if (animate) {
|
325
325
|
return this.set({
|
326
326
|
currentIndex: index,
|
327
|
-
|
327
|
+
animationIndex: index,
|
328
328
|
offset,
|
329
329
|
animate: true,
|
330
330
|
duration: time,
|
@@ -344,11 +344,9 @@ SmartComponent({
|
|
344
344
|
});
|
345
345
|
}
|
346
346
|
return this.set({
|
347
|
-
optionsV: data.options,
|
348
347
|
offset,
|
349
348
|
currentIndex: index,
|
350
|
-
|
351
|
-
renderStart: 0,
|
349
|
+
animationIndex: index,
|
352
350
|
animate: !!animate,
|
353
351
|
}).then(() => {
|
354
352
|
if (!userAction) {
|
@@ -16,7 +16,7 @@
|
|
16
16
|
wx:for-item="option"
|
17
17
|
wx:key="index"
|
18
18
|
data-index="{{ renderStart + index }}"
|
19
|
-
style="{{computed.wrapperItemStyle({ itemHeight, fontStyle, activeStyle: renderStart + index === currentIndex ? activeStyle : ''})}}"
|
19
|
+
style="{{computed.wrapperItemStyle({ itemHeight, fontStyle, activeStyle: renderStart + index === currentIndex ? activeStyle : '', animationIndex, index: renderStart + index })}}"
|
20
20
|
class="smart-ellipsis {{ utils.bem('picker-column__item', { disabled: option && option.disabled, selected: renderStart + index === currentIndex }) }} {{ renderStart + index === currentIndex ? 'active-class' : '' }}"
|
21
21
|
>
|
22
22
|
{{ computed.optionText(option, valueKey) }}
|
@@ -48,20 +48,17 @@ function wrapperItemStyle(data) {
|
|
48
48
|
var heightStyleStr = "height: " + data.itemHeight + 'px;'
|
49
49
|
var fontStyleStr = style(data.fontStyle);
|
50
50
|
var activeStyleStr = style(data.activeStyle);
|
51
|
+
|
52
|
+
// var offsetIndex = data.animationIndex - data.index;
|
53
|
+
// var scale = Math.min(Math.abs(offsetIndex * 0.05), 0.05 * 2)
|
54
|
+
// var rotateX = offsetIndex * 25 > 0 ? Math.min(offsetIndex * 25, 25 * 2) : Math.max(offsetIndex * 25, -25 * 2)
|
55
|
+
// const transStyle = style({
|
56
|
+
// transform: `rotateX(${rotateX}deg) scale(${1 - scale})`
|
57
|
+
// });
|
58
|
+
// return trans + ';' + heightStyleStr + (fontStyleStr ? fontStyleStr + ';' : fontStyleStr) + activeStyleStr
|
51
59
|
return heightStyleStr + (fontStyleStr ? fontStyleStr + ';' : fontStyleStr) + activeStyleStr
|
52
60
|
}
|
53
61
|
|
54
|
-
// function wrapperItemStyle(data) {
|
55
|
-
// var { index, animationIndex: currentIndex } = data;
|
56
|
-
// var offsetIndex = currentIndex - index;
|
57
|
-
// var rotateX = offsetIndex * 25 > 0 ? Math.min(offsetIndex * 25, 25 * 2) : Math.max(offsetIndex * 25, -25 * 2)
|
58
|
-
// var scale = Math.min(Math.abs(offsetIndex * 0.05), 0.05 * 2)
|
59
|
-
// return style({
|
60
|
-
// transition: 'transform ' + data.duration + 'ms ease-out',
|
61
|
-
// transform: `rotateX(${rotateX}deg) scale(${1 - scale})`
|
62
|
-
// });
|
63
|
-
// }
|
64
|
-
|
65
62
|
module.exports = {
|
66
63
|
optionText: optionText,
|
67
64
|
rootStyle: rootStyle,
|
@@ -177,10 +177,10 @@ var DEFAULT_DURATION = 400;
|
|
177
177
|
// @ts-ignore
|
178
178
|
this.vibrateShort();
|
179
179
|
}
|
180
|
-
|
180
|
+
var animationIndex = Math.abs(-offset / data.itemHeight);
|
181
181
|
this.setData({
|
182
182
|
offset: offset,
|
183
|
-
|
183
|
+
animationIndex: animationIndex,
|
184
184
|
preOffsetList: __spreadArray(__spreadArray([], data.preOffsetList, true), [offset], false),
|
185
185
|
animate: false,
|
186
186
|
});
|
@@ -223,7 +223,7 @@ var DEFAULT_DURATION = 400;
|
|
223
223
|
// 最终定位索引
|
224
224
|
this.setData({
|
225
225
|
duration: isSameTouch ? 150 : data.animationTime,
|
226
|
-
|
226
|
+
animationIndex: index,
|
227
227
|
offset: offsetData,
|
228
228
|
animate: true,
|
229
229
|
});
|
@@ -368,7 +368,7 @@ var DEFAULT_DURATION = 400;
|
|
368
368
|
if (animate) {
|
369
369
|
return this.set({
|
370
370
|
currentIndex: index,
|
371
|
-
|
371
|
+
animationIndex: index,
|
372
372
|
offset: offset,
|
373
373
|
animate: true,
|
374
374
|
duration: time,
|
@@ -388,11 +388,9 @@ var DEFAULT_DURATION = 400;
|
|
388
388
|
});
|
389
389
|
}
|
390
390
|
return this.set({
|
391
|
-
optionsV: data.options,
|
392
391
|
offset: offset,
|
393
392
|
currentIndex: index,
|
394
|
-
|
395
|
-
renderStart: 0,
|
393
|
+
animationIndex: index,
|
396
394
|
animate: !!animate,
|
397
395
|
}).then(function () {
|
398
396
|
if (!userAction) {
|
@@ -16,7 +16,7 @@
|
|
16
16
|
wx:for-item="option"
|
17
17
|
wx:key="index"
|
18
18
|
data-index="{{ renderStart + index }}"
|
19
|
-
style="{{computed.wrapperItemStyle({ itemHeight, fontStyle, activeStyle: renderStart + index === currentIndex ? activeStyle : ''})}}"
|
19
|
+
style="{{computed.wrapperItemStyle({ itemHeight, fontStyle, activeStyle: renderStart + index === currentIndex ? activeStyle : '', animationIndex, index: renderStart + index })}}"
|
20
20
|
class="smart-ellipsis {{ utils.bem('picker-column__item', { disabled: option && option.disabled, selected: renderStart + index === currentIndex }) }} {{ renderStart + index === currentIndex ? 'active-class' : '' }}"
|
21
21
|
>
|
22
22
|
{{ computed.optionText(option, valueKey) }}
|
@@ -48,20 +48,17 @@ function wrapperItemStyle(data) {
|
|
48
48
|
var heightStyleStr = "height: " + data.itemHeight + 'px;'
|
49
49
|
var fontStyleStr = style(data.fontStyle);
|
50
50
|
var activeStyleStr = style(data.activeStyle);
|
51
|
+
|
52
|
+
// var offsetIndex = data.animationIndex - data.index;
|
53
|
+
// var scale = Math.min(Math.abs(offsetIndex * 0.05), 0.05 * 2)
|
54
|
+
// var rotateX = offsetIndex * 25 > 0 ? Math.min(offsetIndex * 25, 25 * 2) : Math.max(offsetIndex * 25, -25 * 2)
|
55
|
+
// const transStyle = style({
|
56
|
+
// transform: `rotateX(${rotateX}deg) scale(${1 - scale})`
|
57
|
+
// });
|
58
|
+
// return trans + ';' + heightStyleStr + (fontStyleStr ? fontStyleStr + ';' : fontStyleStr) + activeStyleStr
|
51
59
|
return heightStyleStr + (fontStyleStr ? fontStyleStr + ';' : fontStyleStr) + activeStyleStr
|
52
60
|
}
|
53
61
|
|
54
|
-
// function wrapperItemStyle(data) {
|
55
|
-
// var { index, animationIndex: currentIndex } = data;
|
56
|
-
// var offsetIndex = currentIndex - index;
|
57
|
-
// var rotateX = offsetIndex * 25 > 0 ? Math.min(offsetIndex * 25, 25 * 2) : Math.max(offsetIndex * 25, -25 * 2)
|
58
|
-
// var scale = Math.min(Math.abs(offsetIndex * 0.05), 0.05 * 2)
|
59
|
-
// return style({
|
60
|
-
// transition: 'transform ' + data.duration + 'ms ease-out',
|
61
|
-
// transform: `rotateX(${rotateX}deg) scale(${1 - scale})`
|
62
|
-
// });
|
63
|
-
// }
|
64
|
-
|
65
62
|
module.exports = {
|
66
63
|
optionText: optionText,
|
67
64
|
rootStyle: rootStyle,
|