@tuya/miniapp-smart-ui 2.13.5-beta-1 → 2.13.5-beta-2

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.
@@ -151,9 +151,6 @@ SmartComponent({
151
151
  getPicker() {
152
152
  if (this.picker == null) {
153
153
  this.picker = this.selectComponent('.smart-datetime-picker');
154
- const { picker } = this;
155
- const { setColumnValues } = picker;
156
- picker.setColumnValues = (...args) => setColumnValues.apply(picker, [...args, false]);
157
154
  }
158
155
  return this.picker;
159
156
  },
@@ -1,5 +1,6 @@
1
1
  <smart-picker
2
2
  class="smart-datetime-picker"
3
+ auto-reset="{{ false }}"
3
4
  active-class="active-class"
4
5
  toolbar-class="toolbar-class"
5
6
  column-class="column-class"
@@ -284,6 +284,7 @@ Page({
284
284
  | active-index | 单列选择器的当前选中项索引,<br>多列选择器请参考下方的 Columns 配置 | _number_ | `-1` |
285
285
  | cancel-button-text | 取消按钮文字 | _string_ | `取消` |
286
286
  | columns | 对象数组,配置每一列显示的数据 | _Array_ | `[]` |
287
+ | auto-reset `v2.13.6` | columns 变化时是否把发生变化的列重置回第 0 项。安卓容器上库内重置会异步覆盖 activeIndex 定位(跨数据源复用滚轮时初始档位丢失),此场景建议传 `false` | _boolean_ | `true` |
287
288
  | confirm-button-text | 确认按钮文字 | _string_ | `确认` |
288
289
  | default-index | 单列选择器的默认选中项索引,<br>多列选择器请参考下方的 Columns 配置 | _number_ | `0` |
289
290
  | item-height | 选项高度 | _number_ | `44` |
@@ -325,7 +326,7 @@ Picker 组件的事件会根据 columns 是单列或多列返回不同的参数
325
326
  | style `v2.0.0` | 列的样式 |
326
327
  | fontStyle `v2.3.5` | 列的文字样式 |
327
328
  | unit | 列对应的单位,默认为空 |
328
- | unitGap `v2.10.0` | 单位和值的间隔,默认为 undefined(使用 CSS 默认样式),支持传入数字(自动添加 px 单位)或字符串(如 "8rpx") | _string \| number_ | `undefined` |
329
+ | unitGap `v2.10.0` | 单位和值的间隔,默认为 ''(使用 CSS 默认样式),支持传入数字(自动添加 px 单位)或字符串(如 "8rpx") | _string \| number_ | `''` |
329
330
  | values | 列中对应的备选值 |
330
331
  | order `v2.2.0` | 设置列的顺序,同`flex order`属性,只是从样式角度修改列的顺序,逻辑还是不变 | _number_ | - |
331
332
  | disabled `v2.3.5` | 禁用此列 | _boolean_ | `false` |
@@ -40,6 +40,15 @@ SmartComponent({
40
40
  this.setColumns().catch(() => { });
41
41
  }
42
42
  },
43
+ },
44
+ /**
45
+ * 列数据(columns)变化时,是否把发生变化的列重置回第 0 项。默认 true 保持历史行为。
46
+ * 传 false 后定位由各列 activeIndex 驱动——安卓容器上库内重置(setIndex(0))会
47
+ * 异步覆盖 activeIndex 定位,跨数据源复用滚轮时初始档位丢失,此场景建议传 false。
48
+ */
49
+ autoReset: {
50
+ type: Boolean,
51
+ value: true,
43
52
  } }),
44
53
  data: {
45
54
  animating: false,
@@ -157,7 +166,9 @@ SmartComponent({
157
166
  if (this._windows[index] && this._windows[index].windowed) {
158
167
  return Promise.resolve();
159
168
  }
160
- return this.setColumnValues(index, column.values);
169
+ // autoReset=false 时定位由各列 activeIndex 驱动:安卓容器上库内重置
170
+ // (setIndex(0))会异步覆盖 activeIndex 定位,跨数据源复用滚轮时档位丢失
171
+ return this.setColumnValues(index, column.values, this.data.autoReset);
161
172
  });
162
173
  return Promise.all(stack);
163
174
  },
@@ -27,7 +27,7 @@
27
27
  windowed="{{ item._windowed || false }}"
28
28
  disabled="{{ item.disabled || false }}"
29
29
  unit="{{ item.unit || unit }}"
30
- unit-gap="{{ item.unitGap }}"
30
+ unit-gap="{{ item.unitGap === undefined || item.unitGap === null ? '' : item.unitGap }}"
31
31
  changeAnimation="{{ changeAnimation }}"
32
32
  default-index="{{ item.defaultIndex || defaultIndex }}"
33
33
  active-index="{{ (item.activeIndex === null || item.activeIndex === undefined) ? activeIndex : item.activeIndex }}"
@@ -69,7 +69,9 @@ SmartComponent({
69
69
  },
70
70
  unitGap: {
71
71
  type: null,
72
- value: undefined,
72
+ // 默认空串而非 undefined:undefined 会触发运行时 setData 告警,
73
+ // 且在安卓容器上导致同批数据(含初始 activeIndex 定位)被整批拒绝
74
+ value: '',
73
75
  },
74
76
  animationTime: {
75
77
  type: Number,
@@ -4,7 +4,7 @@ var addUnit = require('../wxs/add-unit.wxs');
4
4
  var wxUtils = require('../wxs/utils.wxs');
5
5
 
6
6
  function unitGapStyle(unitGap) {
7
- if (unitGap === undefined || unitGap === null) {
7
+ if (unitGap === undefined || unitGap === null || unitGap === '') {
8
8
  return '';
9
9
  }
10
10
  return style({
@@ -175,15 +175,6 @@ var defaultFormatter = function (type, value) {
175
175
  getPicker: function () {
176
176
  if (this.picker == null) {
177
177
  this.picker = this.selectComponent('.smart-datetime-picker');
178
- var picker_1 = this.picker;
179
- var setColumnValues_1 = picker_1.setColumnValues;
180
- picker_1.setColumnValues = function () {
181
- var args = [];
182
- for (var _i = 0; _i < arguments.length; _i++) {
183
- args[_i] = arguments[_i];
184
- }
185
- return setColumnValues_1.apply(picker_1, __spreadArray(__spreadArray([], args, true), [false], false));
186
- };
187
178
  }
188
179
  return this.picker;
189
180
  },
@@ -1,5 +1,6 @@
1
1
  <smart-picker
2
2
  class="smart-datetime-picker"
3
+ auto-reset="{{ false }}"
3
4
  active-class="active-class"
4
5
  toolbar-class="toolbar-class"
5
6
  column-class="column-class"
@@ -284,6 +284,7 @@ Page({
284
284
  | active-index | 单列选择器的当前选中项索引,<br>多列选择器请参考下方的 Columns 配置 | _number_ | `-1` |
285
285
  | cancel-button-text | 取消按钮文字 | _string_ | `取消` |
286
286
  | columns | 对象数组,配置每一列显示的数据 | _Array_ | `[]` |
287
+ | auto-reset `v2.13.6` | columns 变化时是否把发生变化的列重置回第 0 项。安卓容器上库内重置会异步覆盖 activeIndex 定位(跨数据源复用滚轮时初始档位丢失),此场景建议传 `false` | _boolean_ | `true` |
287
288
  | confirm-button-text | 确认按钮文字 | _string_ | `确认` |
288
289
  | default-index | 单列选择器的默认选中项索引,<br>多列选择器请参考下方的 Columns 配置 | _number_ | `0` |
289
290
  | item-height | 选项高度 | _number_ | `44` |
@@ -325,7 +326,7 @@ Picker 组件的事件会根据 columns 是单列或多列返回不同的参数
325
326
  | style `v2.0.0` | 列的样式 |
326
327
  | fontStyle `v2.3.5` | 列的文字样式 |
327
328
  | unit | 列对应的单位,默认为空 |
328
- | unitGap `v2.10.0` | 单位和值的间隔,默认为 undefined(使用 CSS 默认样式),支持传入数字(自动添加 px 单位)或字符串(如 "8rpx") | _string \| number_ | `undefined` |
329
+ | unitGap `v2.10.0` | 单位和值的间隔,默认为 ''(使用 CSS 默认样式),支持传入数字(自动添加 px 单位)或字符串(如 "8rpx") | _string \| number_ | `''` |
329
330
  | values | 列中对应的备选值 |
330
331
  | order `v2.2.0` | 设置列的顺序,同`flex order`属性,只是从样式角度修改列的顺序,逻辑还是不变 | _number_ | - |
331
332
  | disabled `v2.3.5` | 禁用此列 | _boolean_ | `false` |
@@ -54,6 +54,15 @@ var clamp = function (value, min, max) { return Math.min(Math.max(value, min), m
54
54
  this.setColumns().catch(function () { });
55
55
  }
56
56
  },
57
+ },
58
+ /**
59
+ * 列数据(columns)变化时,是否把发生变化的列重置回第 0 项。默认 true 保持历史行为。
60
+ * 传 false 后定位由各列 activeIndex 驱动——安卓容器上库内重置(setIndex(0))会
61
+ * 异步覆盖 activeIndex 定位,跨数据源复用滚轮时初始档位丢失,此场景建议传 false。
62
+ */
63
+ autoReset: {
64
+ type: Boolean,
65
+ value: true,
57
66
  } }),
58
67
  data: {
59
68
  animating: false,
@@ -176,7 +185,9 @@ var clamp = function (value, min, max) { return Math.min(Math.max(value, min), m
176
185
  if (_this._windows[index] && _this._windows[index].windowed) {
177
186
  return Promise.resolve();
178
187
  }
179
- return _this.setColumnValues(index, column.values);
188
+ // autoReset=false 时定位由各列 activeIndex 驱动:安卓容器上库内重置
189
+ // (setIndex(0))会异步覆盖 activeIndex 定位,跨数据源复用滚轮时档位丢失
190
+ return _this.setColumnValues(index, column.values, _this.data.autoReset);
180
191
  });
181
192
  return Promise.all(stack);
182
193
  },
@@ -27,7 +27,7 @@
27
27
  windowed="{{ item._windowed || false }}"
28
28
  disabled="{{ item.disabled || false }}"
29
29
  unit="{{ item.unit || unit }}"
30
- unit-gap="{{ item.unitGap }}"
30
+ unit-gap="{{ item.unitGap === undefined || item.unitGap === null ? '' : item.unitGap }}"
31
31
  changeAnimation="{{ changeAnimation }}"
32
32
  default-index="{{ item.defaultIndex || defaultIndex }}"
33
33
  active-index="{{ (item.activeIndex === null || item.activeIndex === undefined) ? activeIndex : item.activeIndex }}"
@@ -74,7 +74,9 @@ var getId = function () {
74
74
  },
75
75
  unitGap: {
76
76
  type: null,
77
- value: undefined,
77
+ // 默认空串而非 undefined:undefined 会触发运行时 setData 告警,
78
+ // 且在安卓容器上导致同批数据(含初始 activeIndex 定位)被整批拒绝
79
+ value: '',
78
80
  },
79
81
  animationTime: {
80
82
  type: Number,
@@ -4,7 +4,7 @@ var addUnit = require('../wxs/add-unit.wxs');
4
4
  var wxUtils = require('../wxs/utils.wxs');
5
5
 
6
6
  function unitGapStyle(unitGap) {
7
- if (unitGap === undefined || unitGap === null) {
7
+ if (unitGap === undefined || unitGap === null || unitGap === '') {
8
8
  return '';
9
9
  }
10
10
  return style({
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tuya/miniapp-smart-ui",
3
- "version": "2.13.5-beta-1",
3
+ "version": "2.13.5-beta-2",
4
4
  "author": "MiniApp Team",
5
5
  "license": "MIT",
6
6
  "miniprogram": "lib",