@tuya-miniapp/smart-ui 2.8.1-beta-4 → 2.8.1-beta-6
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.
- package/dist/common/ty.d.ts +2 -0
- package/dist/common/ty.js +19 -2
- package/dist/field/index.js +2 -0
- package/dist/picker-column/index.js +3 -3
- package/dist/stepper/index.js +3 -2
- package/dist/switch/index.js +2 -0
- package/dist/tabbar-item/index.js +2 -0
- package/dist/tabs/index.js +2 -0
- package/dist/toast/toast.js +16 -5
- package/lib/common/ty.d.ts +2 -0
- package/lib/common/ty.js +19 -2
- package/lib/field/index.js +2 -0
- package/lib/stepper/index.js +2 -1
- package/lib/switch/index.js +5 -0
- package/lib/tabbar-item/index.js +5 -0
- package/lib/tabs/index.js +5 -0
- package/lib/toast/toast.js +9 -0
- package/package.json +2 -2
package/dist/common/ty.d.ts
CHANGED
package/dist/common/ty.js
CHANGED
|
@@ -1,12 +1,29 @@
|
|
|
1
1
|
const tyApi = {
|
|
2
2
|
vibrateShort: (v) => {
|
|
3
|
+
var _a, _b;
|
|
3
4
|
// @ts-ignore
|
|
4
5
|
if (typeof ty !== 'undefined') {
|
|
5
6
|
// @ts-ignore
|
|
6
|
-
ty.vibrateShort(v);
|
|
7
|
+
(_a = ty.vibrateShort) === null || _a === void 0 ? void 0 : _a.call(ty, v);
|
|
7
8
|
}
|
|
8
9
|
else if (typeof wx !== 'undefined') {
|
|
9
|
-
wx.vibrateShort(v);
|
|
10
|
+
(_b = wx.vibrateShort) === null || _b === void 0 ? void 0 : _b.call(wx, v);
|
|
11
|
+
}
|
|
12
|
+
},
|
|
13
|
+
selectionVibrate: () => {
|
|
14
|
+
var _a;
|
|
15
|
+
// @ts-ignore
|
|
16
|
+
if (typeof ty !== 'undefined') {
|
|
17
|
+
// @ts-ignore
|
|
18
|
+
(_a = ty.selectionVibrate) === null || _a === void 0 ? void 0 : _a.call(ty);
|
|
19
|
+
}
|
|
20
|
+
},
|
|
21
|
+
notificationVibrate: (v) => {
|
|
22
|
+
var _a;
|
|
23
|
+
// @ts-ignore
|
|
24
|
+
if (typeof ty !== 'undefined') {
|
|
25
|
+
// @ts-ignore
|
|
26
|
+
(_a = ty.notificationVibrate) === null || _a === void 0 ? void 0 : _a.call(ty, v);
|
|
10
27
|
}
|
|
11
28
|
},
|
|
12
29
|
nativeDisabled: (v) => {
|
package/dist/field/index.js
CHANGED
|
@@ -2,6 +2,7 @@ import { nextTick } from '../common/utils';
|
|
|
2
2
|
import { SmartComponent } from '../common/component';
|
|
3
3
|
import { commonProps, inputProps, textareaProps } from './props';
|
|
4
4
|
import Xmark from '@tuya-miniapp/icons/dist/svg/Xmark';
|
|
5
|
+
import tyApi from '../common/ty';
|
|
5
6
|
SmartComponent({
|
|
6
7
|
field: true,
|
|
7
8
|
classes: ['input-class', 'right-icon-class', 'label-class'],
|
|
@@ -66,6 +67,7 @@ SmartComponent({
|
|
|
66
67
|
return this.emitChange(Object.assign(Object.assign({}, event.detail), { value: formatValue }));
|
|
67
68
|
},
|
|
68
69
|
onFocus(event) {
|
|
70
|
+
tyApi.selectionVibrate();
|
|
69
71
|
this.focused = true;
|
|
70
72
|
this.setShowClear();
|
|
71
73
|
this.$emit('focus', event.detail);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { SmartComponent } from '../common/component';
|
|
2
2
|
import { range } from '../common/utils';
|
|
3
3
|
import { isObj } from '../common/validator';
|
|
4
|
-
import
|
|
4
|
+
import tyApi from '../common/ty';
|
|
5
5
|
const DEFAULT_DURATION = 400;
|
|
6
6
|
const compIdList = [];
|
|
7
7
|
const getId = () => {
|
|
@@ -138,7 +138,7 @@ SmartComponent({
|
|
|
138
138
|
});
|
|
139
139
|
}
|
|
140
140
|
if (!count) {
|
|
141
|
-
|
|
141
|
+
tyApi.vibrateShort({ type: 'light' });
|
|
142
142
|
return;
|
|
143
143
|
}
|
|
144
144
|
let has = 0;
|
|
@@ -148,7 +148,7 @@ SmartComponent({
|
|
|
148
148
|
return;
|
|
149
149
|
}
|
|
150
150
|
has++;
|
|
151
|
-
|
|
151
|
+
tyApi.vibrateShort({ type: 'light' });
|
|
152
152
|
}, time / count - 20);
|
|
153
153
|
this.setData({
|
|
154
154
|
vibrateTimer: timer,
|
package/dist/stepper/index.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { SmartComponent } from '../common/component';
|
|
2
2
|
import { isDef } from '../common/validator';
|
|
3
|
-
import ty from '../common/ty';
|
|
4
3
|
import Minus from '@tuya-miniapp/icons/dist/svg/Minus';
|
|
5
4
|
import Plus from '@tuya-miniapp/icons/dist/svg/Plus';
|
|
5
|
+
import tyApi from '../common/ty';
|
|
6
6
|
const LONG_PRESS_START_TIME = 600;
|
|
7
7
|
const LONG_PRESS_INTERVAL = 200;
|
|
8
8
|
// add num and avoid float number
|
|
@@ -112,6 +112,7 @@ SmartComponent({
|
|
|
112
112
|
return disabled || disableMinus || +currentValue <= +min;
|
|
113
113
|
},
|
|
114
114
|
onFocus(event) {
|
|
115
|
+
tyApi.selectionVibrate();
|
|
115
116
|
this.$emit('focus', event.detail);
|
|
116
117
|
this.setData({ focus: true });
|
|
117
118
|
},
|
|
@@ -176,7 +177,7 @@ SmartComponent({
|
|
|
176
177
|
const value = this.format(add(+this.data.currentValue, diff), true);
|
|
177
178
|
this.emitChange(value);
|
|
178
179
|
this.$emit(type);
|
|
179
|
-
|
|
180
|
+
tyApi.vibrateShort({ type: 'light' });
|
|
180
181
|
},
|
|
181
182
|
longPressStep() {
|
|
182
183
|
this.longPressTimer = setTimeout(() => {
|
package/dist/switch/index.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import tyApi from '../common/ty';
|
|
1
2
|
import { SmartComponent } from '../common/component';
|
|
2
3
|
SmartComponent({
|
|
3
4
|
field: true,
|
|
@@ -35,6 +36,7 @@ SmartComponent({
|
|
|
35
36
|
}
|
|
36
37
|
const checked = this.data.checked === activeValue;
|
|
37
38
|
const value = checked ? inactiveValue : activeValue;
|
|
39
|
+
tyApi.vibrateShort({ type: 'light' });
|
|
38
40
|
this.$emit('input', value);
|
|
39
41
|
this.$emit('change', value);
|
|
40
42
|
},
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import tyApi from '../common/ty';
|
|
1
2
|
import { SmartComponent } from '../common/component';
|
|
2
3
|
import { useParent } from '../common/relation';
|
|
3
4
|
SmartComponent({
|
|
@@ -39,6 +40,7 @@ SmartComponent({
|
|
|
39
40
|
const active = this.data.name || index;
|
|
40
41
|
if (active !== this.data.active) {
|
|
41
42
|
parent.$emit('change', active);
|
|
43
|
+
tyApi.selectionVibrate();
|
|
42
44
|
}
|
|
43
45
|
}
|
|
44
46
|
const { url, linkType } = this.data;
|
package/dist/tabs/index.js
CHANGED
|
@@ -3,6 +3,7 @@ import { touch } from '../mixins/touch';
|
|
|
3
3
|
import { getAllRect, getRect, groupSetData, nextTick, requestAnimationFrame, } from '../common/utils';
|
|
4
4
|
import { isDef } from '../common/validator';
|
|
5
5
|
import { useChildren } from '../common/relation';
|
|
6
|
+
import tyApi from '../common/ty';
|
|
6
7
|
SmartComponent({
|
|
7
8
|
mixins: [touch],
|
|
8
9
|
classes: ['nav-class', 'tab-class', 'tab-active-class', 'line-class', 'wrap-class'],
|
|
@@ -130,6 +131,7 @@ SmartComponent({
|
|
|
130
131
|
}
|
|
131
132
|
this.onBeforeChange(index)
|
|
132
133
|
.then(() => {
|
|
134
|
+
tyApi.selectionVibrate();
|
|
133
135
|
this.setCurrentIndex(index);
|
|
134
136
|
nextTick(() => {
|
|
135
137
|
this.trigger('click');
|
package/dist/toast/toast.js
CHANGED
|
@@ -1,7 +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
|
|
4
|
+
import tyApi from '../common/ty';
|
|
5
5
|
const defaultOptions = {
|
|
6
6
|
type: 'text',
|
|
7
7
|
mask: false,
|
|
@@ -50,7 +50,7 @@ function Toast(toastOptions) {
|
|
|
50
50
|
toast.clear = () => {
|
|
51
51
|
toast.setData({ show: false });
|
|
52
52
|
if (options.nativeDisabled) {
|
|
53
|
-
|
|
53
|
+
tyApi.nativeDisabled(false);
|
|
54
54
|
}
|
|
55
55
|
preDisRef.value[options.selector] = false;
|
|
56
56
|
if (options.onClose) {
|
|
@@ -60,10 +60,10 @@ function Toast(toastOptions) {
|
|
|
60
60
|
queueRef.value.push(toast);
|
|
61
61
|
toast.setData(options);
|
|
62
62
|
if (options.nativeDisabled) {
|
|
63
|
-
|
|
63
|
+
tyApi.nativeDisabled(true);
|
|
64
64
|
}
|
|
65
65
|
if (preDisRef.value[options.selector] && !options.nativeDisabled) {
|
|
66
|
-
|
|
66
|
+
tyApi.nativeDisabled(false);
|
|
67
67
|
}
|
|
68
68
|
preDisRef.value[options.selector] = options.nativeDisabled || false;
|
|
69
69
|
clearTimeout(toast.timer);
|
|
@@ -76,7 +76,18 @@ function Toast(toastOptions) {
|
|
|
76
76
|
}
|
|
77
77
|
return toast;
|
|
78
78
|
}
|
|
79
|
-
const createMethod = (type) => (options) =>
|
|
79
|
+
const createMethod = (type) => (options) => {
|
|
80
|
+
if (type === 'success') {
|
|
81
|
+
tyApi.notificationVibrate({ type: 'success' });
|
|
82
|
+
}
|
|
83
|
+
else if (type === 'fail') {
|
|
84
|
+
tyApi.notificationVibrate({ type: 'error' });
|
|
85
|
+
}
|
|
86
|
+
else if (type === 'warn') {
|
|
87
|
+
tyApi.notificationVibrate({ type: 'warning' });
|
|
88
|
+
}
|
|
89
|
+
return Toast(Object.assign({ type }, parseOptions(options)));
|
|
90
|
+
};
|
|
80
91
|
Toast.loading = createMethod('loading');
|
|
81
92
|
Toast.success = createMethod('success');
|
|
82
93
|
Toast.fail = createMethod('fail');
|
package/lib/common/ty.d.ts
CHANGED
package/lib/common/ty.js
CHANGED
|
@@ -2,13 +2,30 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
var tyApi = {
|
|
4
4
|
vibrateShort: function (v) {
|
|
5
|
+
var _a, _b;
|
|
5
6
|
// @ts-ignore
|
|
6
7
|
if (typeof ty !== 'undefined') {
|
|
7
8
|
// @ts-ignore
|
|
8
|
-
ty.vibrateShort(v);
|
|
9
|
+
(_a = ty.vibrateShort) === null || _a === void 0 ? void 0 : _a.call(ty, v);
|
|
9
10
|
}
|
|
10
11
|
else if (typeof wx !== 'undefined') {
|
|
11
|
-
wx.vibrateShort(v);
|
|
12
|
+
(_b = wx.vibrateShort) === null || _b === void 0 ? void 0 : _b.call(wx, v);
|
|
13
|
+
}
|
|
14
|
+
},
|
|
15
|
+
selectionVibrate: function () {
|
|
16
|
+
var _a;
|
|
17
|
+
// @ts-ignore
|
|
18
|
+
if (typeof ty !== 'undefined') {
|
|
19
|
+
// @ts-ignore
|
|
20
|
+
(_a = ty.selectionVibrate) === null || _a === void 0 ? void 0 : _a.call(ty);
|
|
21
|
+
}
|
|
22
|
+
},
|
|
23
|
+
notificationVibrate: function (v) {
|
|
24
|
+
var _a;
|
|
25
|
+
// @ts-ignore
|
|
26
|
+
if (typeof ty !== 'undefined') {
|
|
27
|
+
// @ts-ignore
|
|
28
|
+
(_a = ty.notificationVibrate) === null || _a === void 0 ? void 0 : _a.call(ty, v);
|
|
12
29
|
}
|
|
13
30
|
},
|
|
14
31
|
nativeDisabled: function (v) {
|
package/lib/field/index.js
CHANGED
|
@@ -18,6 +18,7 @@ var utils_1 = require("../common/utils");
|
|
|
18
18
|
var component_1 = require("../common/component");
|
|
19
19
|
var props_1 = require("./props");
|
|
20
20
|
var Xmark_1 = __importDefault(require("@tuya-miniapp/icons/dist/svg/Xmark"));
|
|
21
|
+
var ty_1 = __importDefault(require("../common/ty"));
|
|
21
22
|
(0, component_1.SmartComponent)({
|
|
22
23
|
field: true,
|
|
23
24
|
classes: ['input-class', 'right-icon-class', 'label-class'],
|
|
@@ -82,6 +83,7 @@ var Xmark_1 = __importDefault(require("@tuya-miniapp/icons/dist/svg/Xmark"));
|
|
|
82
83
|
return this.emitChange(__assign(__assign({}, event.detail), { value: formatValue }));
|
|
83
84
|
},
|
|
84
85
|
onFocus: function (event) {
|
|
86
|
+
ty_1.default.selectionVibrate();
|
|
85
87
|
this.focused = true;
|
|
86
88
|
this.setShowClear();
|
|
87
89
|
this.$emit('focus', event.detail);
|
package/lib/stepper/index.js
CHANGED
|
@@ -16,9 +16,9 @@ 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"));
|
|
20
19
|
var Minus_1 = __importDefault(require("@tuya-miniapp/icons/dist/svg/Minus"));
|
|
21
20
|
var Plus_1 = __importDefault(require("@tuya-miniapp/icons/dist/svg/Plus"));
|
|
21
|
+
var ty_1 = __importDefault(require("../common/ty"));
|
|
22
22
|
var LONG_PRESS_START_TIME = 600;
|
|
23
23
|
var LONG_PRESS_INTERVAL = 200;
|
|
24
24
|
// add num and avoid float number
|
|
@@ -128,6 +128,7 @@ function equal(value1, value2) {
|
|
|
128
128
|
return disabled || disableMinus || +currentValue <= +min;
|
|
129
129
|
},
|
|
130
130
|
onFocus: function (event) {
|
|
131
|
+
ty_1.default.selectionVibrate();
|
|
131
132
|
this.$emit('focus', event.detail);
|
|
132
133
|
this.setData({ focus: true });
|
|
133
134
|
},
|
package/lib/switch/index.js
CHANGED
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
2
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
var ty_1 = __importDefault(require("../common/ty"));
|
|
3
7
|
var component_1 = require("../common/component");
|
|
4
8
|
(0, component_1.SmartComponent)({
|
|
5
9
|
field: true,
|
|
@@ -37,6 +41,7 @@ var component_1 = require("../common/component");
|
|
|
37
41
|
}
|
|
38
42
|
var checked = this.data.checked === activeValue;
|
|
39
43
|
var value = checked ? inactiveValue : activeValue;
|
|
44
|
+
ty_1.default.vibrateShort({ type: 'light' });
|
|
40
45
|
this.$emit('input', value);
|
|
41
46
|
this.$emit('change', value);
|
|
42
47
|
},
|
package/lib/tabbar-item/index.js
CHANGED
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
2
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
var ty_1 = __importDefault(require("../common/ty"));
|
|
3
7
|
var component_1 = require("../common/component");
|
|
4
8
|
var relation_1 = require("../common/relation");
|
|
5
9
|
(0, component_1.SmartComponent)({
|
|
@@ -41,6 +45,7 @@ var relation_1 = require("../common/relation");
|
|
|
41
45
|
var active = this.data.name || index;
|
|
42
46
|
if (active !== this.data.active) {
|
|
43
47
|
parent.$emit('change', active);
|
|
48
|
+
ty_1.default.selectionVibrate();
|
|
44
49
|
}
|
|
45
50
|
}
|
|
46
51
|
var _a = this.data, url = _a.url, linkType = _a.linkType;
|
package/lib/tabs/index.js
CHANGED
|
@@ -10,12 +10,16 @@ var __assign = (this && this.__assign) || function () {
|
|
|
10
10
|
};
|
|
11
11
|
return __assign.apply(this, arguments);
|
|
12
12
|
};
|
|
13
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
14
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
15
|
+
};
|
|
13
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
14
17
|
var component_1 = require("../common/component");
|
|
15
18
|
var touch_1 = require("../mixins/touch");
|
|
16
19
|
var utils_1 = require("../common/utils");
|
|
17
20
|
var validator_1 = require("../common/validator");
|
|
18
21
|
var relation_1 = require("../common/relation");
|
|
22
|
+
var ty_1 = __importDefault(require("../common/ty"));
|
|
19
23
|
(0, component_1.SmartComponent)({
|
|
20
24
|
mixins: [touch_1.touch],
|
|
21
25
|
classes: ['nav-class', 'tab-class', 'tab-active-class', 'line-class', 'wrap-class'],
|
|
@@ -148,6 +152,7 @@ var relation_1 = require("../common/relation");
|
|
|
148
152
|
}
|
|
149
153
|
this.onBeforeChange(index)
|
|
150
154
|
.then(function () {
|
|
155
|
+
ty_1.default.selectionVibrate();
|
|
151
156
|
_this.setCurrentIndex(index);
|
|
152
157
|
(0, utils_1.nextTick)(function () {
|
|
153
158
|
_this.trigger('click');
|
package/lib/toast/toast.js
CHANGED
|
@@ -94,6 +94,15 @@ function Toast(toastOptions) {
|
|
|
94
94
|
return toast;
|
|
95
95
|
}
|
|
96
96
|
var createMethod = function (type) { return function (options) {
|
|
97
|
+
if (type === 'success') {
|
|
98
|
+
ty_1.default.notificationVibrate({ type: 'success' });
|
|
99
|
+
}
|
|
100
|
+
else if (type === 'fail') {
|
|
101
|
+
ty_1.default.notificationVibrate({ type: 'error' });
|
|
102
|
+
}
|
|
103
|
+
else if (type === 'warn') {
|
|
104
|
+
ty_1.default.notificationVibrate({ type: 'warning' });
|
|
105
|
+
}
|
|
97
106
|
return Toast(__assign({ type: type }, parseOptions(options)));
|
|
98
107
|
}; };
|
|
99
108
|
Toast.loading = createMethod('loading');
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tuya-miniapp/smart-ui",
|
|
3
|
-
"version": "2.8.1-beta-
|
|
3
|
+
"version": "2.8.1-beta-6",
|
|
4
4
|
"author": "MiniApp Team",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"miniprogram": "lib",
|
|
@@ -87,7 +87,7 @@
|
|
|
87
87
|
"iOS >= 9"
|
|
88
88
|
],
|
|
89
89
|
"dependencies": {
|
|
90
|
-
"@ray-js/components-ty-slider": "^0.3.
|
|
90
|
+
"@ray-js/components-ty-slider": "^0.3.8-beta-3",
|
|
91
91
|
"@tuya-miniapp/icons": "^2.3.0"
|
|
92
92
|
},
|
|
93
93
|
"maintainers": [
|