@tuya-miniapp/smart-ui 2.3.6-beta-3 → 2.3.6-beta-5

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.
@@ -5,11 +5,11 @@
5
5
  <view
6
6
  wx:if="{{ labelPosition === 'left' }}"
7
7
  class="label-class {{ utils.bem('checkbox__label', [labelPosition, { disabled: disabled || parentDisabled }]) }}"
8
- bindtap="onClickLabel"
8
+ catch:tap="onClickLabel"
9
9
  >
10
10
  <slot />
11
11
  </view>
12
- <view class="smart-checkbox__icon-wrap" bindtap="toggle">
12
+ <view class="smart-checkbox__icon-wrap" catch:tap="toggle">
13
13
  <slot wx:if="{{ useIconSlot }}" name="icon" />
14
14
  <smart-icon
15
15
  wx:else
@@ -25,7 +25,7 @@
25
25
  <view
26
26
  wx:if="{{ labelPosition === 'right' }}"
27
27
  class="label-class {{ utils.bem('checkbox__label', [labelPosition, { disabled: disabled || parentDisabled }]) }}"
28
- bindtap="onClickLabel"
28
+ catch:tap="onClickLabel"
29
29
  >
30
30
  <slot />
31
31
  </view>
@@ -58,16 +58,20 @@ SmartComponent({
58
58
  value: true,
59
59
  },
60
60
  },
61
+ watch: {
62
+ dpr() {
63
+ this.render(this.data.percent, this.data.canvasId);
64
+ },
65
+ },
61
66
  data: {
62
67
  canvasId: '',
63
68
  dpr: 1,
64
69
  },
65
- created() {
70
+ created() { },
71
+ mounted() {
66
72
  this.initId();
67
73
  this.initRate();
68
- },
69
- mounted() {
70
- this.render(this.data.percent, this.data.canvasId);
74
+ // this.render(this.data.percent, this.data.canvasId);
71
75
  },
72
76
  destroyed() {
73
77
  idListRef.value = idListRef.value.filter(id => id !== this.data.canvasId);
@@ -90,25 +94,20 @@ SmartComponent({
90
94
  wx.getSystemInfo({
91
95
  success: res => {
92
96
  const dpr = res.pixelRatio; // 获取设备像素比
93
- this.setData({
94
- dpr: dpr,
95
- });
97
+ const sizeVal = this.parseSize();
98
+ const params = {
99
+ width: +sizeVal,
100
+ height: +sizeVal,
101
+ lineWidth: this.data.trackWidth,
102
+ trackColor: this.data.trackColor,
103
+ fillColor: this.data.fillColor,
104
+ fillColorStops: this.data.fillColorStops,
105
+ maskColor: this.data.maskColor,
106
+ dpr: this.data.dpr,
107
+ };
108
+ this.setData(Object.assign(Object.assign({}, params), { dpr: dpr }));
96
109
  },
97
110
  });
98
- const sizeVal = this.parseSize();
99
- const params = {
100
- canvasWidth: +sizeVal,
101
- canvasHeight: +sizeVal,
102
- width: +sizeVal,
103
- height: +sizeVal,
104
- lineWidth: this.data.trackWidth,
105
- trackColor: this.data.trackColor,
106
- fillColor: this.data.fillColor,
107
- fillColorStops: this.data.fillColorStops,
108
- maskColor: this.data.maskColor,
109
- dpr: this.data.dpr,
110
- };
111
- this.setData(params);
112
111
  },
113
112
  renderAll(canvas, ctx, progress, ops = {
114
113
  lineCap: 'round',
@@ -119,7 +118,6 @@ SmartComponent({
119
118
  const endAngle = 4 * Math.PI; // 结束角度(360度)
120
119
  // 绘制环形进度条的函数
121
120
  function drawProgressBar(progress, color) {
122
- ctx.clearRect(0, 0, canvas.width, canvas.height); // 清除画布
123
121
  // 绘制灰色背景
124
122
  ctx.beginPath();
125
123
  ctx.arc(canvas.width / 2, canvas.height / 2, radius, startAngle, endAngle);
@@ -149,7 +147,6 @@ SmartComponent({
149
147
  }
150
148
  ctx.setLineCap(ops.lineCap); // 设置圆角效果
151
149
  ctx.stroke();
152
- ctx.scale(canvas.dpr, canvas.dpr);
153
150
  ctx.draw();
154
151
  }
155
152
  // 示例:绘制不同的进度条
@@ -164,7 +161,6 @@ SmartComponent({
164
161
  const endAngle = 2 * Math.PI; // 结束角度(360度)
165
162
  // 绘制环形进度条的函数
166
163
  function drawProgressBar(progress, color) {
167
- ctx.clearRect(0, 0, canvas.width, canvas.height); // 清除画布
168
164
  // 绘制灰色背景
169
165
  ctx.beginPath();
170
166
  ctx.arc(canvas.width / 2, canvas.height / 2, radius, startAngle, endAngle);
@@ -194,7 +190,6 @@ SmartComponent({
194
190
  }
195
191
  ctx.setLineCap(ops.lineCap); // 设置圆角效果
196
192
  ctx.stroke();
197
- ctx.scale(canvas.dpr, canvas.dpr);
198
193
  ctx.draw();
199
194
  }
200
195
  // 示例:绘制不同的进度条
@@ -220,7 +215,6 @@ SmartComponent({
220
215
  const endAngle = 2.2 * Math.PI; // 结束角度(360度)
221
216
  // 绘制环形进度条的函数
222
217
  function drawProgressBar(progress, color) {
223
- ctx.clearRect(0, 0, canvas.width, canvas.height); // 清除画布
224
218
  // 绘制灰色背景
225
219
  ctx.beginPath();
226
220
  ctx.arc(canvas.width / 2, canvas.height / 2, radius, startAngle, endAngle);
@@ -250,7 +244,6 @@ SmartComponent({
250
244
  }
251
245
  ctx.setLineCap(ops.lineCap); // 设置圆角效果
252
246
  ctx.stroke();
253
- ctx.scale(canvas.dpr, canvas.dpr);
254
247
  ctx.draw();
255
248
  }
256
249
  // 示例:绘制不同的进度条
@@ -259,6 +252,11 @@ SmartComponent({
259
252
  render(val, canvasId) {
260
253
  // @ts-ignore
261
254
  const context = ty.createCanvasContext(canvasId);
255
+ context.clearRect(0, 0, this.data.width, this.data.height); // 清除画布
256
+ context.scale(this.data.dpr, this.data.dpr);
257
+ this.data.width /= this.data.dpr;
258
+ this.data.height /= this.data.dpr;
259
+ this.data.lineWidth /= this.data.dpr;
262
260
  if (this.data.mode === 'basic') {
263
261
  this.renderAll(this.data, context, val / 100, this.data.round ? { lineCap: 'round' } : { lineCap: '' });
264
262
  }
@@ -2,8 +2,8 @@
2
2
  class="smart-progress-circle"
3
3
  type="2d"
4
4
  wx:if="{{canvasId}}"
5
- width="{{ canvasWidth * dpr }}"
6
- height="{{ canvasHeight * dpr }}"
5
+ width="{{ width * dpr }}"
6
+ height="{{ height * dpr }}"
7
7
  canvas-id="{{canvasId}}"
8
8
  style="width: {{width}}px; height:{{height}}px; {{customStyle}}"
9
9
  ></canvas>
@@ -86,6 +86,12 @@ SmartComponent({
86
86
  }, formatterMap: {
87
87
  type: Object,
88
88
  value: undefined,
89
+ }, columnStyles: {
90
+ type: Object,
91
+ value: undefined,
92
+ }, fontStyles: {
93
+ type: Object,
94
+ value: undefined,
89
95
  } }),
90
96
  data: {
91
97
  part: 0,
@@ -134,11 +140,13 @@ SmartComponent({
134
140
  return formatter(type, value);
135
141
  },
136
142
  updateColumns() {
137
- const { locale } = this.data;
143
+ const { locale, columnStyles, fontStyles } = this.data;
138
144
  const results = this.getOriginColumns().map(column => ({
139
145
  values: column.values.map(value => this.formatterFunc(column.type, value, this.data)),
140
146
  order: column.order,
141
147
  unit: locale === null || locale === void 0 ? void 0 : locale[column.type],
148
+ style: columnStyles === null || columnStyles === void 0 ? void 0 : columnStyles[column.type],
149
+ fontStyle: fontStyles === null || fontStyles === void 0 ? void 0 : fontStyles[column.type],
142
150
  }));
143
151
  return this.set({ columns: results });
144
152
  },
@@ -6,6 +6,8 @@
6
6
  title="{{ title }}"
7
7
  columns="{{ columns }}"
8
8
  item-height="{{ itemHeight }}"
9
+ active-style="{{ activeStyle }}"
10
+ animation-time="{{ animationTime }}"
9
11
  show-toolbar="{{ showToolbar }}"
10
12
  visible-item-count="{{ visibleItemCount }}"
11
13
  confirm-button-text="{{ confirmButtonText }}"
@@ -69,7 +69,7 @@ function svgStyle(data) {
69
69
 
70
70
  function svgPathStyle(data) {
71
71
  // 构建SVG字符串
72
- var svg = '<svg class="icon" width="100%" height="100%" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg"><path d="' + data.name + " fill=" + (data.color || 'currentColor') + '" fill-rule="evenodd"></path></svg>'
72
+ var svg = '<svg class="icon" width="100%" height="100%" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg"><path d="' + data.name + " fill=" + ('currentColor') + '" fill-rule="evenodd"></path></svg>'
73
73
  var imageBase64Src = 'url("data:image/svg+xml,' + encodeURIComponent(svg) + '")';
74
74
  var ret = style([
75
75
  {
@@ -2,10 +2,7 @@ import { SmartComponent } from '../common/component';
2
2
  import { pickerProps } from './shared';
3
3
  SmartComponent({
4
4
  classes: ['active-class', 'toolbar-class', 'column-class'],
5
- props: Object.assign(Object.assign({}, pickerProps), { activeStyle: {
6
- type: String,
7
- value: '',
8
- }, valueKey: {
5
+ props: Object.assign(Object.assign({}, pickerProps), { valueKey: {
9
6
  type: String,
10
7
  value: 'text',
11
8
  }, toolbarPosition: {
@@ -17,6 +17,7 @@
17
17
  wx:for="{{ computed.columns(columns) }}"
18
18
  wx:key="index"
19
19
  data-index="{{ index }}"
20
+ animation-time="{{ animationTime }}"
20
21
  custom-class="column-class"
21
22
  value-key="{{ valueKey }}"
22
23
  style="order: {{ item.order }}; {{ computed.style(item.style) }}"
@@ -22,4 +22,12 @@ export declare const pickerProps: {
22
22
  type: BooleanConstructor;
23
23
  value: boolean;
24
24
  };
25
+ animationTime: {
26
+ type: NumberConstructor;
27
+ value: number;
28
+ };
29
+ activeStyle: {
30
+ type: StringConstructor;
31
+ value: string;
32
+ };
25
33
  };
@@ -22,4 +22,12 @@ export const pickerProps = {
22
22
  type: Boolean,
23
23
  value: true,
24
24
  },
25
+ animationTime: {
26
+ type: Number,
27
+ value: 800,
28
+ },
29
+ activeStyle: {
30
+ type: String,
31
+ value: '',
32
+ },
25
33
  };
@@ -58,6 +58,10 @@ SmartComponent({
58
58
  type: String,
59
59
  value: '',
60
60
  },
61
+ animationTime: {
62
+ type: Number,
63
+ value: 800,
64
+ },
61
65
  },
62
66
  data: {
63
67
  startY: 0,
@@ -175,11 +179,11 @@ SmartComponent({
175
179
  if (Math.abs(offsetData - data.offset) > data.itemHeight && !isSameTouch) {
176
180
  const countVibrate = Math.abs(offsetData - data.offset) / data.itemHeight;
177
181
  // @ts-ignore
178
- this.vibrateShort(Math.floor(countVibrate), 800);
182
+ this.vibrateShort(Math.floor(countVibrate), data.animationTime);
179
183
  }
180
184
  // 最终定位索引
181
185
  this.setData({
182
- duration: isSameTouch ? 150 : 800,
186
+ duration: isSameTouch ? 150 : data.animationTime,
183
187
  // animationIndex: index,
184
188
  offset: offsetData,
185
189
  animate: true,
@@ -200,7 +204,7 @@ SmartComponent({
200
204
  // // animationIndex: index,
201
205
  // });
202
206
  // this.$emit('change', index);
203
- }), isSameTouch ? 150 : 800),
207
+ }), isSameTouch ? 150 : data.animationTime),
204
208
  });
205
209
  }
206
210
  this.setData({
@@ -2,6 +2,7 @@
2
2
  var style = require('../wxs/style.wxs');
3
3
 
4
4
  function popupStyle(data) {
5
+ const transformStyle = "transform: translate3d(0, calc(100% + " + data.bottomSafeHeight + "px), 0)";
5
6
  return style([
6
7
  {
7
8
  'margin-bottom': data.bottomSafeHeight + 'px',
@@ -9,6 +10,7 @@ function popupStyle(data) {
9
10
  '-webkit-transition-duration': data.currentDuration + 'ms',
10
11
  'transition-duration': data.currentDuration + 'ms',
11
12
  },
13
+ data.status === 'enter' ? null : transformStyle,
12
14
  data.display ? null : 'display: none',
13
15
  data.customStyle,
14
16
  ]);
@@ -3,7 +3,7 @@
3
3
  <view
4
4
  wx:if="{{ inited }}"
5
5
  class="custom-class {{ classes }} {{ utils.bem('popup', [position, { round, safeTop: safeAreaInsetTop, safeTabBar: safeAreaTabBar }]) }}"
6
- style="{{ computed.popupStyle({ zIndex, currentDuration, display, customStyle, bottomSafeHeight }) }}"
6
+ style="{{ computed.popupStyle({ status, zIndex, currentDuration, display, customStyle, bottomSafeHeight }) }}"
7
7
  catch:touchmove="{{ lockScroll ? 'noop' : ''}}"
8
8
  >
9
9
  <slot />
@@ -5,11 +5,11 @@
5
5
  <view
6
6
  wx:if="{{ labelPosition === 'left' }}"
7
7
  class="label-class {{ utils.bem('checkbox__label', [labelPosition, { disabled: disabled || parentDisabled }]) }}"
8
- bindtap="onClickLabel"
8
+ catch:tap="onClickLabel"
9
9
  >
10
10
  <slot />
11
11
  </view>
12
- <view class="smart-checkbox__icon-wrap" bindtap="toggle">
12
+ <view class="smart-checkbox__icon-wrap" catch:tap="toggle">
13
13
  <slot wx:if="{{ useIconSlot }}" name="icon" />
14
14
  <smart-icon
15
15
  wx:else
@@ -25,7 +25,7 @@
25
25
  <view
26
26
  wx:if="{{ labelPosition === 'right' }}"
27
27
  class="label-class {{ utils.bem('checkbox__label', [labelPosition, { disabled: disabled || parentDisabled }]) }}"
28
- bindtap="onClickLabel"
28
+ catch:tap="onClickLabel"
29
29
  >
30
30
  <slot />
31
31
  </view>
@@ -1,4 +1,15 @@
1
1
  "use strict";
2
+ var __assign = (this && this.__assign) || function () {
3
+ __assign = Object.assign || function(t) {
4
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
5
+ s = arguments[i];
6
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
7
+ t[p] = s[p];
8
+ }
9
+ return t;
10
+ };
11
+ return __assign.apply(this, arguments);
12
+ };
2
13
  Object.defineProperty(exports, "__esModule", { value: true });
3
14
  /* eslint-disable guard-for-in */
4
15
  /* eslint-disable no-restricted-syntax */
@@ -60,16 +71,20 @@ var idListRef = {
60
71
  value: true,
61
72
  },
62
73
  },
74
+ watch: {
75
+ dpr: function () {
76
+ this.render(this.data.percent, this.data.canvasId);
77
+ },
78
+ },
63
79
  data: {
64
80
  canvasId: '',
65
81
  dpr: 1,
66
82
  },
67
- created: function () {
83
+ created: function () { },
84
+ mounted: function () {
68
85
  this.initId();
69
86
  this.initRate();
70
- },
71
- mounted: function () {
72
- this.render(this.data.percent, this.data.canvasId);
87
+ // this.render(this.data.percent, this.data.canvasId);
73
88
  },
74
89
  destroyed: function () {
75
90
  var _this = this;
@@ -94,25 +109,20 @@ var idListRef = {
94
109
  wx.getSystemInfo({
95
110
  success: function (res) {
96
111
  var dpr = res.pixelRatio; // 获取设备像素比
97
- _this.setData({
98
- dpr: dpr,
99
- });
112
+ var sizeVal = _this.parseSize();
113
+ var params = {
114
+ width: +sizeVal,
115
+ height: +sizeVal,
116
+ lineWidth: _this.data.trackWidth,
117
+ trackColor: _this.data.trackColor,
118
+ fillColor: _this.data.fillColor,
119
+ fillColorStops: _this.data.fillColorStops,
120
+ maskColor: _this.data.maskColor,
121
+ dpr: _this.data.dpr,
122
+ };
123
+ _this.setData(__assign(__assign({}, params), { dpr: dpr }));
100
124
  },
101
125
  });
102
- var sizeVal = this.parseSize();
103
- var params = {
104
- canvasWidth: +sizeVal,
105
- canvasHeight: +sizeVal,
106
- width: +sizeVal,
107
- height: +sizeVal,
108
- lineWidth: this.data.trackWidth,
109
- trackColor: this.data.trackColor,
110
- fillColor: this.data.fillColor,
111
- fillColorStops: this.data.fillColorStops,
112
- maskColor: this.data.maskColor,
113
- dpr: this.data.dpr,
114
- };
115
- this.setData(params);
116
126
  },
117
127
  renderAll: function (canvas, ctx, progress, ops) {
118
128
  if (ops === void 0) { ops = {
@@ -124,7 +134,6 @@ var idListRef = {
124
134
  var endAngle = 4 * Math.PI; // 结束角度(360度)
125
135
  // 绘制环形进度条的函数
126
136
  function drawProgressBar(progress, color) {
127
- ctx.clearRect(0, 0, canvas.width, canvas.height); // 清除画布
128
137
  // 绘制灰色背景
129
138
  ctx.beginPath();
130
139
  ctx.arc(canvas.width / 2, canvas.height / 2, radius, startAngle, endAngle);
@@ -154,7 +163,6 @@ var idListRef = {
154
163
  }
155
164
  ctx.setLineCap(ops.lineCap); // 设置圆角效果
156
165
  ctx.stroke();
157
- ctx.scale(canvas.dpr, canvas.dpr);
158
166
  ctx.draw();
159
167
  }
160
168
  // 示例:绘制不同的进度条
@@ -170,7 +178,6 @@ var idListRef = {
170
178
  var endAngle = 2 * Math.PI; // 结束角度(360度)
171
179
  // 绘制环形进度条的函数
172
180
  function drawProgressBar(progress, color) {
173
- ctx.clearRect(0, 0, canvas.width, canvas.height); // 清除画布
174
181
  // 绘制灰色背景
175
182
  ctx.beginPath();
176
183
  ctx.arc(canvas.width / 2, canvas.height / 2, radius, startAngle, endAngle);
@@ -200,7 +207,6 @@ var idListRef = {
200
207
  }
201
208
  ctx.setLineCap(ops.lineCap); // 设置圆角效果
202
209
  ctx.stroke();
203
- ctx.scale(canvas.dpr, canvas.dpr);
204
210
  ctx.draw();
205
211
  }
206
212
  // 示例:绘制不同的进度条
@@ -227,7 +233,6 @@ var idListRef = {
227
233
  var endAngle = 2.2 * Math.PI; // 结束角度(360度)
228
234
  // 绘制环形进度条的函数
229
235
  function drawProgressBar(progress, color) {
230
- ctx.clearRect(0, 0, canvas.width, canvas.height); // 清除画布
231
236
  // 绘制灰色背景
232
237
  ctx.beginPath();
233
238
  ctx.arc(canvas.width / 2, canvas.height / 2, radius, startAngle, endAngle);
@@ -257,7 +262,6 @@ var idListRef = {
257
262
  }
258
263
  ctx.setLineCap(ops.lineCap); // 设置圆角效果
259
264
  ctx.stroke();
260
- ctx.scale(canvas.dpr, canvas.dpr);
261
265
  ctx.draw();
262
266
  }
263
267
  // 示例:绘制不同的进度条
@@ -266,6 +270,11 @@ var idListRef = {
266
270
  render: function (val, canvasId) {
267
271
  // @ts-ignore
268
272
  var context = ty.createCanvasContext(canvasId);
273
+ context.clearRect(0, 0, this.data.width, this.data.height); // 清除画布
274
+ context.scale(this.data.dpr, this.data.dpr);
275
+ this.data.width /= this.data.dpr;
276
+ this.data.height /= this.data.dpr;
277
+ this.data.lineWidth /= this.data.dpr;
269
278
  if (this.data.mode === 'basic') {
270
279
  this.renderAll(this.data, context, val / 100, this.data.round ? { lineCap: 'round' } : { lineCap: '' });
271
280
  }
@@ -2,8 +2,8 @@
2
2
  class="smart-progress-circle"
3
3
  type="2d"
4
4
  wx:if="{{canvasId}}"
5
- width="{{ canvasWidth * dpr }}"
6
- height="{{ canvasHeight * dpr }}"
5
+ width="{{ width * dpr }}"
6
+ height="{{ height * dpr }}"
7
7
  canvas-id="{{canvasId}}"
8
8
  style="width: {{width}}px; height:{{height}}px; {{customStyle}}"
9
9
  ></canvas>
@@ -110,6 +110,12 @@ var defaultFormatter = function (type, value) {
110
110
  }, formatterMap: {
111
111
  type: Object,
112
112
  value: undefined,
113
+ }, columnStyles: {
114
+ type: Object,
115
+ value: undefined,
116
+ }, fontStyles: {
117
+ type: Object,
118
+ value: undefined,
113
119
  } }),
114
120
  data: {
115
121
  part: 0,
@@ -168,11 +174,13 @@ var defaultFormatter = function (type, value) {
168
174
  },
169
175
  updateColumns: function () {
170
176
  var _this = this;
171
- var locale = this.data.locale;
177
+ var _a = this.data, locale = _a.locale, columnStyles = _a.columnStyles, fontStyles = _a.fontStyles;
172
178
  var results = this.getOriginColumns().map(function (column) { return ({
173
179
  values: column.values.map(function (value) { return _this.formatterFunc(column.type, value, _this.data); }),
174
180
  order: column.order,
175
181
  unit: locale === null || locale === void 0 ? void 0 : locale[column.type],
182
+ style: columnStyles === null || columnStyles === void 0 ? void 0 : columnStyles[column.type],
183
+ fontStyle: fontStyles === null || fontStyles === void 0 ? void 0 : fontStyles[column.type],
176
184
  }); });
177
185
  return this.set({ columns: results });
178
186
  },
@@ -6,6 +6,8 @@
6
6
  title="{{ title }}"
7
7
  columns="{{ columns }}"
8
8
  item-height="{{ itemHeight }}"
9
+ active-style="{{ activeStyle }}"
10
+ animation-time="{{ animationTime }}"
9
11
  show-toolbar="{{ showToolbar }}"
10
12
  visible-item-count="{{ visibleItemCount }}"
11
13
  confirm-button-text="{{ confirmButtonText }}"
@@ -69,7 +69,7 @@ function svgStyle(data) {
69
69
 
70
70
  function svgPathStyle(data) {
71
71
  // 构建SVG字符串
72
- var svg = '<svg class="icon" width="100%" height="100%" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg"><path d="' + data.name + " fill=" + (data.color || 'currentColor') + '" fill-rule="evenodd"></path></svg>'
72
+ var svg = '<svg class="icon" width="100%" height="100%" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg"><path d="' + data.name + " fill=" + ('currentColor') + '" fill-rule="evenodd"></path></svg>'
73
73
  var imageBase64Src = 'url("data:image/svg+xml,' + encodeURIComponent(svg) + '")';
74
74
  var ret = style([
75
75
  {
@@ -15,10 +15,7 @@ var component_1 = require("../common/component");
15
15
  var shared_1 = require("./shared");
16
16
  (0, component_1.SmartComponent)({
17
17
  classes: ['active-class', 'toolbar-class', 'column-class'],
18
- props: __assign(__assign({}, shared_1.pickerProps), { activeStyle: {
19
- type: String,
20
- value: '',
21
- }, valueKey: {
18
+ props: __assign(__assign({}, shared_1.pickerProps), { valueKey: {
22
19
  type: String,
23
20
  value: 'text',
24
21
  }, toolbarPosition: {
@@ -17,6 +17,7 @@
17
17
  wx:for="{{ computed.columns(columns) }}"
18
18
  wx:key="index"
19
19
  data-index="{{ index }}"
20
+ animation-time="{{ animationTime }}"
20
21
  custom-class="column-class"
21
22
  value-key="{{ valueKey }}"
22
23
  style="order: {{ item.order }}; {{ computed.style(item.style) }}"
@@ -22,4 +22,12 @@ export declare const pickerProps: {
22
22
  type: BooleanConstructor;
23
23
  value: boolean;
24
24
  };
25
+ animationTime: {
26
+ type: NumberConstructor;
27
+ value: number;
28
+ };
29
+ activeStyle: {
30
+ type: StringConstructor;
31
+ value: string;
32
+ };
25
33
  };
@@ -25,4 +25,12 @@ exports.pickerProps = {
25
25
  type: Boolean,
26
26
  value: true,
27
27
  },
28
+ animationTime: {
29
+ type: Number,
30
+ value: 800,
31
+ },
32
+ activeStyle: {
33
+ type: String,
34
+ value: '',
35
+ },
28
36
  };
@@ -96,6 +96,10 @@ var DEFAULT_DURATION = 400;
96
96
  type: String,
97
97
  value: '',
98
98
  },
99
+ animationTime: {
100
+ type: Number,
101
+ value: 800,
102
+ },
99
103
  },
100
104
  data: {
101
105
  startY: 0,
@@ -210,11 +214,11 @@ var DEFAULT_DURATION = 400;
210
214
  if (Math.abs(offsetData - data.offset) > data.itemHeight && !isSameTouch) {
211
215
  countVibrate = Math.abs(offsetData - data.offset) / data.itemHeight;
212
216
  // @ts-ignore
213
- this.vibrateShort(Math.floor(countVibrate), 800);
217
+ this.vibrateShort(Math.floor(countVibrate), data.animationTime);
214
218
  }
215
219
  // 最终定位索引
216
220
  this.setData({
217
- duration: isSameTouch ? 150 : 800,
221
+ duration: isSameTouch ? 150 : data.animationTime,
218
222
  // animationIndex: index,
219
223
  offset: offsetData,
220
224
  animate: true,
@@ -234,7 +238,7 @@ var DEFAULT_DURATION = 400;
234
238
  this.setIndex(index, true, false);
235
239
  return [2 /*return*/];
236
240
  });
237
- }); }, isSameTouch ? 150 : 800),
241
+ }); }, isSameTouch ? 150 : data.animationTime),
238
242
  })];
239
243
  }
240
244
  this.setData({
@@ -2,6 +2,7 @@
2
2
  var style = require('../wxs/style.wxs');
3
3
 
4
4
  function popupStyle(data) {
5
+ const transformStyle = "transform: translate3d(0, calc(100% + " + data.bottomSafeHeight + "px), 0)";
5
6
  return style([
6
7
  {
7
8
  'margin-bottom': data.bottomSafeHeight + 'px',
@@ -9,6 +10,7 @@ function popupStyle(data) {
9
10
  '-webkit-transition-duration': data.currentDuration + 'ms',
10
11
  'transition-duration': data.currentDuration + 'ms',
11
12
  },
13
+ data.status === 'enter' ? null : transformStyle,
12
14
  data.display ? null : 'display: none',
13
15
  data.customStyle,
14
16
  ]);
@@ -3,7 +3,7 @@
3
3
  <view
4
4
  wx:if="{{ inited }}"
5
5
  class="custom-class {{ classes }} {{ utils.bem('popup', [position, { round, safeTop: safeAreaInsetTop, safeTabBar: safeAreaTabBar }]) }}"
6
- style="{{ computed.popupStyle({ zIndex, currentDuration, display, customStyle, bottomSafeHeight }) }}"
6
+ style="{{ computed.popupStyle({ status, zIndex, currentDuration, display, customStyle, bottomSafeHeight }) }}"
7
7
  catch:touchmove="{{ lockScroll ? 'noop' : ''}}"
8
8
  >
9
9
  <slot />
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tuya-miniapp/smart-ui",
3
- "version": "2.3.6-beta-3",
3
+ "version": "2.3.6-beta-5",
4
4
  "author": "MiniApp Team",
5
5
  "license": "MIT",
6
6
  "miniprogram": "lib",