@tuya-miniapp/smart-ui 2.4.1-beta-5 → 2.5.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.
@@ -1,5 +1,5 @@
1
1
  function getHeight(contentHeight) {
2
- const height = contentHeight
2
+ var height = contentHeight
3
3
  ? typeof contentHeight === 'number'
4
4
  ? contentHeight + 'rpx'
5
5
  : contentHeight
@@ -1,12 +1,7 @@
1
1
  import { SmartComponent } from '../common/component';
2
2
  import { button } from '../mixins/button';
3
- // import { canIUseFormFieldButton } from '../common/version';
4
- const mixins = [button];
5
- // if (canIUseFormFieldButton()) {
6
- // mixins.push('wx://form-field-button');
7
- // }
8
3
  SmartComponent({
9
- mixins,
4
+ mixins: [button],
10
5
  classes: ['hover-class', 'loading-class'],
11
6
  data: {
12
7
  baseStyle: '',
@@ -52,7 +47,7 @@ SmartComponent({
52
47
  onClick(event) {
53
48
  this.$emit('click', event);
54
49
  const { canIUseGetUserProfile, openType, getUserProfileDesc, lang } = this.data;
55
- if (openType === 'getUserInfo' && canIUseGetUserProfile) {
50
+ if (openType === 'getUserInfo' && canIUseGetUserProfile && typeof wx !== 'undefined') {
56
51
  wx.getUserProfile({
57
52
  desc: getUserProfileDesc || ' ',
58
53
  lang: lang || 'en',
@@ -38,15 +38,15 @@ function getVisible(visibleIndex, curIndex) {
38
38
  function formatMonthTitle(date, formatter = 'YYYY-MM') {
39
39
  if (!date) return '';
40
40
  date = getDate(date);
41
- const year = date.getFullYear();
42
- const month = date.getMonth() + 1 < 10 ? '0' + (date.getMonth() + 1) : date.getMonth() + 1 + '';
41
+ var year = date.getFullYear();
42
+ var month = date.getMonth() + 1 < 10 ? '0' + (date.getMonth() + 1) : date.getMonth() + 1 + '';
43
43
  return formatter.replace('YYYY', year + '').replace('MM', month);
44
44
  }
45
45
 
46
46
  function formatYearTitle(date, offset, formatter = 'YYYY') {
47
47
  if (!date) return '';
48
48
  date = getDate(date);
49
- const year = date.getFullYear();
49
+ var year = date.getFullYear();
50
50
  return formatter.replace('YYYY', year + '');
51
51
  }
52
52
 
@@ -48,8 +48,8 @@ function getDayStyle(type, index, date, rowHeight, color, firstDayOfWeek) {
48
48
 
49
49
  function formatMonthTitle(date, formatter = 'YYYY-MM') {
50
50
  date = getDate(date);
51
- const year = date.getFullYear();
52
- const month = date.getMonth() + 1 < 10 ? "0" + (date.getMonth() + 1) : date.getMonth() + 1 + "";
51
+ var year = date.getFullYear();
52
+ var month = date.getMonth() + 1 < 10 ? "0" + (date.getMonth() + 1) : date.getMonth() + 1 + "";
53
53
  return formatter.replace('YYYY', year + '').replace('MM', month);
54
54
  }
55
55
 
@@ -12,7 +12,7 @@ export const init = (tag) => {
12
12
  return Log;
13
13
  }
14
14
  // @ts-ignore
15
- if (typeof ty !== 'undefined' && !ty.getLogManager) {
15
+ if (typeof ty === 'undefined' || (typeof ty !== 'undefined' && !ty.getLogManager)) {
16
16
  // console.warn('不支持ty.getLogManager');
17
17
  return null;
18
18
  }
@@ -0,0 +1,5 @@
1
+ declare const tyApi: {
2
+ vibrateShort: (v: any) => void;
3
+ nativeDisabled: (v: boolean) => void;
4
+ };
5
+ export default tyApi;
@@ -0,0 +1,21 @@
1
+ const tyApi = {
2
+ vibrateShort: (v) => {
3
+ // @ts-ignore
4
+ if (typeof ty !== 'undefined') {
5
+ // @ts-ignore
6
+ ty.vibrateShort(v);
7
+ }
8
+ else if (typeof wx !== 'undefined') {
9
+ wx.vibrateShort(v);
10
+ }
11
+ },
12
+ nativeDisabled: (v) => {
13
+ var _a;
14
+ // @ts-ignore
15
+ if (typeof ty !== 'undefined') {
16
+ // @ts-ignore
17
+ (_a = ty.nativeDisabled) === null || _a === void 0 ? void 0 : _a.call(ty, v);
18
+ }
19
+ },
20
+ };
21
+ export default tyApi;
@@ -30,7 +30,7 @@ function mode(fit) {
30
30
 
31
31
 
32
32
  function maskStyle(url, color) {
33
- const str = 'mask-image: url(' + url + ');-webkit-mask-image: url(' + url + ');background: ' + color + ';'
33
+ var str = 'mask-image: url(' + url + ');-webkit-mask-image: url(' + url + ');background: ' + color + ';'
34
34
  return str
35
35
  }
36
36
 
@@ -3,7 +3,7 @@ var style = require('../wxs/style.wxs');
3
3
  var addUnit = require('../wxs/add-unit.wxs');
4
4
 
5
5
  function textStyle(data) {
6
- const ret = style({
6
+ var ret = style({
7
7
  'font-size': addUnit(data.textSize),
8
8
  color: data.color,
9
9
  });
@@ -12,7 +12,7 @@ function textStyle(data) {
12
12
  }
13
13
 
14
14
  function loadingStyle(data) {
15
- let iconSrc = ''
15
+ var iconSrc = ''
16
16
 
17
17
  if (data.type === 'spinner') {
18
18
  iconSrc = data.spinner
@@ -10,6 +10,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
10
10
  // @ts-nocheck
11
11
  import { requestAnimationFrame } from '../common/utils';
12
12
  import { isObj } from '../common/validator';
13
+ import ty from '../common/ty';
13
14
  const getClassNames = (name) => ({
14
15
  enter: `smart-${name}-enter smart-${name}-enter-active enter-class enter-active-class`,
15
16
  'enter-to': `smart-${name}-enter-to smart-${name}-enter-active enter-to-class enter-active-class`,
@@ -65,13 +66,12 @@ export function transition(showDefaultValue) {
65
66
  });
66
67
  // eslint-disable-next-line no-async-promise-executor
67
68
  this.enterFinishedPromise = new Promise((resolve) => __awaiter(this, void 0, void 0, function* () {
68
- var _a;
69
69
  const { duration, name } = this.data;
70
70
  const classNames = getClassNames(name);
71
71
  const currentDuration = isObj(duration) ? duration.enter : duration;
72
72
  this.$emit('before-enter');
73
73
  if (this.data.nativeDisabled) {
74
- (_a = ty === null || ty === void 0 ? void 0 : ty.nativeDisabled) === null || _a === void 0 ? void 0 : _a.call(ty, true);
74
+ ty.nativeDisabled(true);
75
75
  }
76
76
  yield requestAnimationFrame();
77
77
  this.$emit('enter');
@@ -125,11 +125,10 @@ export function transition(showDefaultValue) {
125
125
  this.transitionEnded = false;
126
126
  clearTimeout(this.timer);
127
127
  setTimeout(() => {
128
- var _a;
129
128
  this.enterFinishedPromise = null;
130
129
  this.$emit('after-leave');
131
130
  if (this.data.nativeDisabled) {
132
- (_a = ty === null || ty === void 0 ? void 0 : ty.nativeDisabled) === null || _a === void 0 ? void 0 : _a.call(ty, false);
131
+ ty.nativeDisabled(false);
133
132
  }
134
133
  this.setData({
135
134
  display: false,
@@ -140,13 +139,12 @@ export function transition(showDefaultValue) {
140
139
  this.setData({ classes: classNames['leave-to'] });
141
140
  }))
142
141
  .catch(err => {
143
- var _a;
144
142
  this.enterFinishedPromise = null;
145
143
  this.setData({ animating: false });
146
144
  console.log(err, '---error-leave');
147
145
  this.$emit('leave-error', err);
148
146
  if (this.data.nativeDisabled) {
149
- (_a = ty === null || ty === void 0 ? void 0 : ty.nativeDisabled) === null || _a === void 0 ? void 0 : _a.call(ty, false);
147
+ ty.nativeDisabled(false);
150
148
  }
151
149
  });
152
150
  });
@@ -10,6 +10,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
10
10
  import { SmartComponent } from '../common/component';
11
11
  import { range } from '../common/utils';
12
12
  import { isObj } from '../common/validator';
13
+ import ty from '../common/ty';
13
14
  const DEFAULT_DURATION = 400;
14
15
  SmartComponent({
15
16
  classes: ['active-class'],
@@ -226,7 +227,6 @@ SmartComponent({
226
227
  },
227
228
  vibrateShort(count, time = 1000) {
228
229
  if (!count) {
229
- // @ts-ignore
230
230
  ty.vibrateShort({ type: 'light' });
231
231
  return;
232
232
  }
@@ -52,10 +52,10 @@ function wrapperItemStyle(data) {
52
52
  }
53
53
 
54
54
  // function wrapperItemStyle(data) {
55
- // const { index, animationIndex: currentIndex } = data;
56
- // const offsetIndex = currentIndex - index;
57
- // const rotateX = offsetIndex * 25 > 0 ? Math.min(offsetIndex * 25, 25 * 2) : Math.max(offsetIndex * 25, -25 * 2)
58
- // const scale = Math.min(Math.abs(offsetIndex * 0.05), 0.05 * 2)
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
59
  // return style({
60
60
  // transition: 'transform ' + data.duration + 'ms ease-out',
61
61
  // transform: `rotateX(${rotateX}deg) scale(${1 - scale})`
@@ -2,7 +2,7 @@
2
2
  var style = require('../wxs/style.wxs');
3
3
 
4
4
  function popupStyle(data) {
5
- const transformStyle = data.position === 'bottom' ? "transform: translate3d(0, calc(100% + " + data.bottomSafeHeight + "px), 0)" : null;
5
+ var transformStyle = data.position === 'bottom' ? "transform: translate3d(0, calc(100% + " + data.bottomSafeHeight + "px), 0)" : null;
6
6
 
7
7
  return style([
8
8
  {
@@ -1,5 +1,6 @@
1
1
  import { SmartComponent } from '../common/component';
2
2
  import { isDef } from '../common/validator';
3
+ import ty from '../common/ty';
3
4
  import Minus from '@tuya-miniapp/icons/dist/svg/Minus';
4
5
  import Plus from '@tuya-miniapp/icons/dist/svg/Plus';
5
6
  const LONG_PRESS_START_TIME = 600;
@@ -151,7 +152,6 @@ SmartComponent({
151
152
  const value = this.format(add(+this.data.currentValue, diff));
152
153
  this.emitChange(value);
153
154
  this.$emit(type);
154
- // @ts-ignore
155
155
  ty.vibrateShort({ type: 'light' });
156
156
  },
157
157
  longPressStep() {
@@ -1,6 +1,7 @@
1
1
  import appLog from '../common/appLog';
2
2
  import { getCurrentPage } from '../common/utils';
3
3
  import { isObj } from '../common/validator';
4
+ import ty from '../common/ty';
4
5
  const defaultOptions = {
5
6
  type: 'text',
6
7
  mask: false,
@@ -31,7 +32,6 @@ export const contextRef = {
31
32
  value: {},
32
33
  };
33
34
  function Toast(toastOptions) {
34
- var _a, _b;
35
35
  const options = Object.assign(Object.assign({}, currentOptions), parseOptions(toastOptions));
36
36
  appLog.info('start open Toast');
37
37
  const context = (typeof options.context === 'function' ? options.context() : options.context) ||
@@ -48,11 +48,9 @@ function Toast(toastOptions) {
48
48
  delete options.context;
49
49
  delete options.selector;
50
50
  toast.clear = () => {
51
- var _a;
52
51
  toast.setData({ show: false });
53
52
  if (options.nativeDisabled) {
54
- // @ts-ignore
55
- (_a = ty === null || ty === void 0 ? void 0 : ty.nativeDisabled) === null || _a === void 0 ? void 0 : _a.call(ty, false);
53
+ ty.nativeDisabled(false);
56
54
  }
57
55
  preDisRef.value[options.selector] = false;
58
56
  if (options.onClose) {
@@ -62,12 +60,10 @@ function Toast(toastOptions) {
62
60
  queueRef.value.push(toast);
63
61
  toast.setData(options);
64
62
  if (options.nativeDisabled) {
65
- // @ts-ignore
66
- (_a = ty === null || ty === void 0 ? void 0 : ty.nativeDisabled) === null || _a === void 0 ? void 0 : _a.call(ty, true);
63
+ ty.nativeDisabled(true);
67
64
  }
68
65
  if (preDisRef.value[options.selector] && !options.nativeDisabled) {
69
- // @ts-ignore
70
- (_b = ty === null || ty === void 0 ? void 0 : ty.nativeDisabled) === null || _b === void 0 ? void 0 : _b.call(ty, false);
66
+ ty.nativeDisabled(false);
71
67
  }
72
68
  preDisRef.value[options.selector] = options.nativeDisabled || false;
73
69
  clearTimeout(toast.timer);
@@ -1,5 +1,5 @@
1
1
  function getHeight(contentHeight) {
2
- const height = contentHeight
2
+ var height = contentHeight
3
3
  ? typeof contentHeight === 'number'
4
4
  ? contentHeight + 'rpx'
5
5
  : contentHeight
@@ -2,13 +2,8 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  var component_1 = require("../common/component");
4
4
  var button_1 = require("../mixins/button");
5
- // import { canIUseFormFieldButton } from '../common/version';
6
- var mixins = [button_1.button];
7
- // if (canIUseFormFieldButton()) {
8
- // mixins.push('wx://form-field-button');
9
- // }
10
5
  (0, component_1.SmartComponent)({
11
- mixins: mixins,
6
+ mixins: [button_1.button],
12
7
  classes: ['hover-class', 'loading-class'],
13
8
  data: {
14
9
  baseStyle: '',
@@ -55,7 +50,7 @@ var mixins = [button_1.button];
55
50
  var _this = this;
56
51
  this.$emit('click', event);
57
52
  var _a = this.data, canIUseGetUserProfile = _a.canIUseGetUserProfile, openType = _a.openType, getUserProfileDesc = _a.getUserProfileDesc, lang = _a.lang;
58
- if (openType === 'getUserInfo' && canIUseGetUserProfile) {
53
+ if (openType === 'getUserInfo' && canIUseGetUserProfile && typeof wx !== 'undefined') {
59
54
  wx.getUserProfile({
60
55
  desc: getUserProfileDesc || ' ',
61
56
  lang: lang || 'en',
@@ -38,15 +38,15 @@ function getVisible(visibleIndex, curIndex) {
38
38
  function formatMonthTitle(date, formatter = 'YYYY-MM') {
39
39
  if (!date) return '';
40
40
  date = getDate(date);
41
- const year = date.getFullYear();
42
- const month = date.getMonth() + 1 < 10 ? '0' + (date.getMonth() + 1) : date.getMonth() + 1 + '';
41
+ var year = date.getFullYear();
42
+ var month = date.getMonth() + 1 < 10 ? '0' + (date.getMonth() + 1) : date.getMonth() + 1 + '';
43
43
  return formatter.replace('YYYY', year + '').replace('MM', month);
44
44
  }
45
45
 
46
46
  function formatYearTitle(date, offset, formatter = 'YYYY') {
47
47
  if (!date) return '';
48
48
  date = getDate(date);
49
- const year = date.getFullYear();
49
+ var year = date.getFullYear();
50
50
  return formatter.replace('YYYY', year + '');
51
51
  }
52
52
 
@@ -48,8 +48,8 @@ function getDayStyle(type, index, date, rowHeight, color, firstDayOfWeek) {
48
48
 
49
49
  function formatMonthTitle(date, formatter = 'YYYY-MM') {
50
50
  date = getDate(date);
51
- const year = date.getFullYear();
52
- const month = date.getMonth() + 1 < 10 ? "0" + (date.getMonth() + 1) : date.getMonth() + 1 + "";
51
+ var year = date.getFullYear();
52
+ var month = date.getMonth() + 1 < 10 ? "0" + (date.getMonth() + 1) : date.getMonth() + 1 + "";
53
53
  return formatter.replace('YYYY', year + '').replace('MM', month);
54
54
  }
55
55
 
@@ -15,7 +15,7 @@ var init = function (tag) {
15
15
  return Log;
16
16
  }
17
17
  // @ts-ignore
18
- if (typeof ty !== 'undefined' && !ty.getLogManager) {
18
+ if (typeof ty === 'undefined' || (typeof ty !== 'undefined' && !ty.getLogManager)) {
19
19
  // console.warn('不支持ty.getLogManager');
20
20
  return null;
21
21
  }
@@ -0,0 +1,5 @@
1
+ declare const tyApi: {
2
+ vibrateShort: (v: any) => void;
3
+ nativeDisabled: (v: boolean) => void;
4
+ };
5
+ export default tyApi;
@@ -0,0 +1,23 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ var tyApi = {
4
+ vibrateShort: function (v) {
5
+ // @ts-ignore
6
+ if (typeof ty !== 'undefined') {
7
+ // @ts-ignore
8
+ ty.vibrateShort(v);
9
+ }
10
+ else if (typeof wx !== 'undefined') {
11
+ wx.vibrateShort(v);
12
+ }
13
+ },
14
+ nativeDisabled: function (v) {
15
+ var _a;
16
+ // @ts-ignore
17
+ if (typeof ty !== 'undefined') {
18
+ // @ts-ignore
19
+ (_a = ty.nativeDisabled) === null || _a === void 0 ? void 0 : _a.call(ty, v);
20
+ }
21
+ },
22
+ };
23
+ exports.default = tyApi;
@@ -30,7 +30,7 @@ function mode(fit) {
30
30
 
31
31
 
32
32
  function maskStyle(url, color) {
33
- const str = 'mask-image: url(' + url + ');-webkit-mask-image: url(' + url + ');background: ' + color + ';'
33
+ var str = 'mask-image: url(' + url + ');-webkit-mask-image: url(' + url + ');background: ' + color + ';'
34
34
  return str
35
35
  }
36
36
 
@@ -3,7 +3,7 @@ var style = require('../wxs/style.wxs');
3
3
  var addUnit = require('../wxs/add-unit.wxs');
4
4
 
5
5
  function textStyle(data) {
6
- const ret = style({
6
+ var ret = style({
7
7
  'font-size': addUnit(data.textSize),
8
8
  color: data.color,
9
9
  });
@@ -12,7 +12,7 @@ function textStyle(data) {
12
12
  }
13
13
 
14
14
  function loadingStyle(data) {
15
- let iconSrc = ''
15
+ var iconSrc = ''
16
16
 
17
17
  if (data.type === 'spinner') {
18
18
  iconSrc = data.spinner
@@ -35,11 +35,15 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
35
35
  if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
36
36
  }
37
37
  };
38
+ var __importDefault = (this && this.__importDefault) || function (mod) {
39
+ return (mod && mod.__esModule) ? mod : { "default": mod };
40
+ };
38
41
  Object.defineProperty(exports, "__esModule", { value: true });
39
42
  exports.transition = void 0;
40
43
  // @ts-nocheck
41
44
  var utils_1 = require("../common/utils");
42
45
  var validator_1 = require("../common/validator");
46
+ var ty_1 = __importDefault(require("../common/ty"));
43
47
  var getClassNames = function (name) { return ({
44
48
  enter: "smart-".concat(name, "-enter smart-").concat(name, "-enter-active enter-class enter-active-class"),
45
49
  'enter-to': "smart-".concat(name, "-enter-to smart-").concat(name, "-enter-active enter-to-class enter-active-class"),
@@ -98,20 +102,19 @@ function transition(showDefaultValue) {
98
102
  this.enterFinishedPromise = new Promise(function (resolve) { return __awaiter(_this, void 0, void 0, function () {
99
103
  var _a, duration, name, classNames, currentDuration;
100
104
  var _this = this;
101
- var _b;
102
- return __generator(this, function (_c) {
103
- switch (_c.label) {
105
+ return __generator(this, function (_b) {
106
+ switch (_b.label) {
104
107
  case 0:
105
108
  _a = this.data, duration = _a.duration, name = _a.name;
106
109
  classNames = getClassNames(name);
107
110
  currentDuration = (0, validator_1.isObj)(duration) ? duration.enter : duration;
108
111
  this.$emit('before-enter');
109
112
  if (this.data.nativeDisabled) {
110
- (_b = ty === null || ty === void 0 ? void 0 : ty.nativeDisabled) === null || _b === void 0 ? void 0 : _b.call(ty, true);
113
+ ty_1.default.nativeDisabled(true);
111
114
  }
112
115
  return [4 /*yield*/, (0, utils_1.requestAnimationFrame)()];
113
116
  case 1:
114
- _c.sent();
117
+ _b.sent();
115
118
  this.$emit('enter');
116
119
  this.setData({
117
120
  inited: true,
@@ -121,7 +124,7 @@ function transition(showDefaultValue) {
121
124
  });
122
125
  return [4 /*yield*/, (0, utils_1.requestAnimationFrame)()];
123
126
  case 2:
124
- _c.sent();
127
+ _b.sent();
125
128
  this.transitionEnded = false;
126
129
  this.setData({ classes: classNames['enter-to'] });
127
130
  clearTimeout(this.timer);
@@ -179,11 +182,10 @@ function transition(showDefaultValue) {
179
182
  this.transitionEnded = false;
180
183
  clearTimeout(this.timer);
181
184
  setTimeout(function () {
182
- var _a;
183
185
  _this.enterFinishedPromise = null;
184
186
  _this.$emit('after-leave');
185
187
  if (_this.data.nativeDisabled) {
186
- (_a = ty === null || ty === void 0 ? void 0 : ty.nativeDisabled) === null || _a === void 0 ? void 0 : _a.call(ty, false);
188
+ ty_1.default.nativeDisabled(false);
187
189
  }
188
190
  _this.setData({
189
191
  display: false,
@@ -197,13 +199,12 @@ function transition(showDefaultValue) {
197
199
  });
198
200
  }); })
199
201
  .catch(function (err) {
200
- var _a;
201
202
  _this.enterFinishedPromise = null;
202
203
  _this.setData({ animating: false });
203
204
  console.log(err, '---error-leave');
204
205
  _this.$emit('leave-error', err);
205
206
  if (_this.data.nativeDisabled) {
206
- (_a = ty === null || ty === void 0 ? void 0 : ty.nativeDisabled) === null || _a === void 0 ? void 0 : _a.call(ty, false);
207
+ ty_1.default.nativeDisabled(false);
207
208
  }
208
209
  });
209
210
  return [2 /*return*/];
@@ -44,10 +44,14 @@ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
44
44
  }
45
45
  return to.concat(ar || Array.prototype.slice.call(from));
46
46
  };
47
+ var __importDefault = (this && this.__importDefault) || function (mod) {
48
+ return (mod && mod.__esModule) ? mod : { "default": mod };
49
+ };
47
50
  Object.defineProperty(exports, "__esModule", { value: true });
48
51
  var component_1 = require("../common/component");
49
52
  var utils_1 = require("../common/utils");
50
53
  var validator_1 = require("../common/validator");
54
+ var ty_1 = __importDefault(require("../common/ty"));
51
55
  var DEFAULT_DURATION = 400;
52
56
  (0, component_1.SmartComponent)({
53
57
  classes: ['active-class'],
@@ -265,8 +269,7 @@ var DEFAULT_DURATION = 400;
265
269
  var _this = this;
266
270
  if (time === void 0) { time = 1000; }
267
271
  if (!count) {
268
- // @ts-ignore
269
- ty.vibrateShort({ type: 'light' });
272
+ ty_1.default.vibrateShort({ type: 'light' });
270
273
  return;
271
274
  }
272
275
  var has = 0;
@@ -52,10 +52,10 @@ function wrapperItemStyle(data) {
52
52
  }
53
53
 
54
54
  // function wrapperItemStyle(data) {
55
- // const { index, animationIndex: currentIndex } = data;
56
- // const offsetIndex = currentIndex - index;
57
- // const rotateX = offsetIndex * 25 > 0 ? Math.min(offsetIndex * 25, 25 * 2) : Math.max(offsetIndex * 25, -25 * 2)
58
- // const scale = Math.min(Math.abs(offsetIndex * 0.05), 0.05 * 2)
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
59
  // return style({
60
60
  // transition: 'transform ' + data.duration + 'ms ease-out',
61
61
  // transform: `rotateX(${rotateX}deg) scale(${1 - scale})`
@@ -2,7 +2,7 @@
2
2
  var style = require('../wxs/style.wxs');
3
3
 
4
4
  function popupStyle(data) {
5
- const transformStyle = data.position === 'bottom' ? "transform: translate3d(0, calc(100% + " + data.bottomSafeHeight + "px), 0)" : null;
5
+ var transformStyle = data.position === 'bottom' ? "transform: translate3d(0, calc(100% + " + data.bottomSafeHeight + "px), 0)" : null;
6
6
 
7
7
  return style([
8
8
  {
@@ -16,6 +16,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
17
  var component_1 = require("../common/component");
18
18
  var validator_1 = require("../common/validator");
19
+ var ty_1 = __importDefault(require("../common/ty"));
19
20
  var Minus_1 = __importDefault(require("@tuya-miniapp/icons/dist/svg/Minus"));
20
21
  var Plus_1 = __importDefault(require("@tuya-miniapp/icons/dist/svg/Plus"));
21
22
  var LONG_PRESS_START_TIME = 600;
@@ -167,8 +168,7 @@ function equal(value1, value2) {
167
168
  var value = this.format(add(+this.data.currentValue, diff));
168
169
  this.emitChange(value);
169
170
  this.$emit(type);
170
- // @ts-ignore
171
- ty.vibrateShort({ type: 'light' });
171
+ ty_1.default.vibrateShort({ type: 'light' });
172
172
  },
173
173
  longPressStep: function () {
174
174
  var _this = this;
@@ -18,6 +18,7 @@ exports.contextRef = void 0;
18
18
  var appLog_1 = __importDefault(require("../common/appLog"));
19
19
  var utils_1 = require("../common/utils");
20
20
  var validator_1 = require("../common/validator");
21
+ var ty_1 = __importDefault(require("../common/ty"));
21
22
  var defaultOptions = {
22
23
  type: 'text',
23
24
  mask: false,
@@ -48,7 +49,6 @@ exports.contextRef = {
48
49
  value: {},
49
50
  };
50
51
  function Toast(toastOptions) {
51
- var _a, _b;
52
52
  var options = __assign(__assign({}, currentOptions), parseOptions(toastOptions));
53
53
  appLog_1.default.info('start open Toast');
54
54
  var context = (typeof options.context === 'function' ? options.context() : options.context) ||
@@ -65,11 +65,9 @@ function Toast(toastOptions) {
65
65
  delete options.context;
66
66
  delete options.selector;
67
67
  toast.clear = function () {
68
- var _a;
69
68
  toast.setData({ show: false });
70
69
  if (options.nativeDisabled) {
71
- // @ts-ignore
72
- (_a = ty === null || ty === void 0 ? void 0 : ty.nativeDisabled) === null || _a === void 0 ? void 0 : _a.call(ty, false);
70
+ ty_1.default.nativeDisabled(false);
73
71
  }
74
72
  preDisRef.value[options.selector] = false;
75
73
  if (options.onClose) {
@@ -79,12 +77,10 @@ function Toast(toastOptions) {
79
77
  queueRef.value.push(toast);
80
78
  toast.setData(options);
81
79
  if (options.nativeDisabled) {
82
- // @ts-ignore
83
- (_a = ty === null || ty === void 0 ? void 0 : ty.nativeDisabled) === null || _a === void 0 ? void 0 : _a.call(ty, true);
80
+ ty_1.default.nativeDisabled(true);
84
81
  }
85
82
  if (preDisRef.value[options.selector] && !options.nativeDisabled) {
86
- // @ts-ignore
87
- (_b = ty === null || ty === void 0 ? void 0 : ty.nativeDisabled) === null || _b === void 0 ? void 0 : _b.call(ty, false);
83
+ ty_1.default.nativeDisabled(false);
88
84
  }
89
85
  preDisRef.value[options.selector] = options.nativeDisabled || false;
90
86
  clearTimeout(toast.timer);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tuya-miniapp/smart-ui",
3
- "version": "2.4.1-beta-5",
3
+ "version": "2.5.0",
4
4
  "author": "MiniApp Team",
5
5
  "license": "MIT",
6
6
  "miniprogram": "lib",