@tuya-miniapp/smart-ui 1.2.0 → 1.2.2
Sign up to get free protection for your applications and to get access to all the features.
package/dist/dialog/dialog.d.ts
CHANGED
@@ -2,6 +2,7 @@
|
|
2
2
|
/// <reference types="miniprogram-api-typings" />
|
3
3
|
export type Action = 'confirm' | 'cancel' | 'overlay';
|
4
4
|
type DialogContext = WechatMiniprogram.Page.TrivialInstance | WechatMiniprogram.Component.TrivialInstance;
|
5
|
+
type AnyObject = {};
|
5
6
|
interface DialogOptions {
|
6
7
|
lang?: string;
|
7
8
|
show?: boolean;
|
@@ -49,7 +50,12 @@ declare const Dialog: {
|
|
49
50
|
(options: DialogOptions): Promise<WechatMiniprogram.Component.TrivialInstance>;
|
50
51
|
alert(options: DialogOptions): Promise<WechatMiniprogram.Component.TrivialInstance>;
|
51
52
|
confirm(options: DialogOptions): Promise<WechatMiniprogram.Component.TrivialInstance>;
|
52
|
-
input(options: DialogInputOptions)
|
53
|
+
input: (options: DialogInputOptions) => Promise<WechatMiniprogram.Component.Instance<{
|
54
|
+
/**
|
55
|
+
* 输入框的当前值
|
56
|
+
*/
|
57
|
+
inputValue: string;
|
58
|
+
}, AnyObject, AnyObject>>;
|
53
59
|
close(): void;
|
54
60
|
stopLoading(): void;
|
55
61
|
currentOptions: DialogOptions;
|
package/dist/dialog/dialog.js
CHANGED
@@ -61,7 +61,7 @@ const Dialog = (options) => {
|
|
61
61
|
};
|
62
62
|
Dialog.alert = (options) => Dialog(options);
|
63
63
|
Dialog.confirm = (options) => Dialog(Object.assign({ showCancelButton: true }, options));
|
64
|
-
Dialog.input = (options) => Dialog(Object.assign({ showCancelButton: true }, options));
|
64
|
+
Dialog.input = ((options) => Dialog(Object.assign({ showCancelButton: true }, options)));
|
65
65
|
Dialog.close = () => {
|
66
66
|
queue.forEach((dialog) => {
|
67
67
|
dialog.close();
|
package/dist/dialog/index.js
CHANGED
@@ -123,6 +123,10 @@ SmartComponent({
|
|
123
123
|
});
|
124
124
|
},
|
125
125
|
handleAction(action) {
|
126
|
+
// 避免快速点击时,dialog 已经被关闭了,但是还往下走导致 loading 一直存在
|
127
|
+
// see /tuyarn-kit/base/ray-smart-ui/-/issues/11
|
128
|
+
if (!this.data.show)
|
129
|
+
return;
|
126
130
|
this.$emit(action, { dialog: this, value: this.data.inputValue });
|
127
131
|
const { asyncClose, beforeClose } = this.data;
|
128
132
|
if (!asyncClose && !beforeClose) {
|
package/lib/dialog/dialog.d.ts
CHANGED
@@ -2,6 +2,7 @@
|
|
2
2
|
/// <reference types="miniprogram-api-typings" />
|
3
3
|
export type Action = 'confirm' | 'cancel' | 'overlay';
|
4
4
|
type DialogContext = WechatMiniprogram.Page.TrivialInstance | WechatMiniprogram.Component.TrivialInstance;
|
5
|
+
type AnyObject = {};
|
5
6
|
interface DialogOptions {
|
6
7
|
lang?: string;
|
7
8
|
show?: boolean;
|
@@ -49,7 +50,12 @@ declare const Dialog: {
|
|
49
50
|
(options: DialogOptions): Promise<WechatMiniprogram.Component.TrivialInstance>;
|
50
51
|
alert(options: DialogOptions): Promise<WechatMiniprogram.Component.TrivialInstance>;
|
51
52
|
confirm(options: DialogOptions): Promise<WechatMiniprogram.Component.TrivialInstance>;
|
52
|
-
input(options: DialogInputOptions)
|
53
|
+
input: (options: DialogInputOptions) => Promise<WechatMiniprogram.Component.Instance<{
|
54
|
+
/**
|
55
|
+
* 输入框的当前值
|
56
|
+
*/
|
57
|
+
inputValue: string;
|
58
|
+
}, AnyObject, AnyObject>>;
|
53
59
|
close(): void;
|
54
60
|
stopLoading(): void;
|
55
61
|
currentOptions: DialogOptions;
|
package/lib/dialog/dialog.js
CHANGED
@@ -76,9 +76,9 @@ Dialog.alert = function (options) { return Dialog(options); };
|
|
76
76
|
Dialog.confirm = function (options) {
|
77
77
|
return Dialog(__assign({ showCancelButton: true }, options));
|
78
78
|
};
|
79
|
-
Dialog.input = function (options) {
|
79
|
+
Dialog.input = (function (options) {
|
80
80
|
return Dialog(__assign({ showCancelButton: true }, options));
|
81
|
-
};
|
81
|
+
});
|
82
82
|
Dialog.close = function () {
|
83
83
|
queue.forEach(function (dialog) {
|
84
84
|
dialog.close();
|
package/lib/dialog/index.js
CHANGED
@@ -131,6 +131,10 @@ var utils_1 = require("../common/utils");
|
|
131
131
|
handleAction: function (action) {
|
132
132
|
var _a;
|
133
133
|
var _this = this;
|
134
|
+
// 避免快速点击时,dialog 已经被关闭了,但是还往下走导致 loading 一直存在
|
135
|
+
// see /tuyarn-kit/base/ray-smart-ui/-/issues/11
|
136
|
+
if (!this.data.show)
|
137
|
+
return;
|
134
138
|
this.$emit(action, { dialog: this, value: this.data.inputValue });
|
135
139
|
var _b = this.data, asyncClose = _b.asyncClose, beforeClose = _b.beforeClose;
|
136
140
|
if (!asyncClose && !beforeClose) {
|