@tuya-miniapp/smart-ui 1.2.0 → 1.2.3

Sign up to get free protection for your applications and to get access to all the features.
@@ -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): Promise<WechatMiniprogram.Component.TrivialInstance>;
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;
@@ -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();
@@ -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) {
@@ -1 +1 @@
1
- @import '../common/index.css';.contain{--thumb-active-color:var(var(--app-B3,#fff),#fff)}
1
+ @import '../common/index.css';.contain{--thumb-active-color:var(--app-B3,#fff)}
@@ -1 +1 @@
1
- @import '../common/index.wxss';.contain{--thumb-active-color:var(var(--app-B3,#fff),#fff)}
1
+ @import '../common/index.wxss';.contain{--thumb-active-color:var(--app-B3,#fff)}
@@ -174,7 +174,14 @@ SmartComponent({
174
174
  animate: true,
175
175
  duration: DEFAULT_DURATION,
176
176
  }).then(() => {
177
- userAction && (this.fireChange = true);
177
+ if (!userAction)
178
+ return;
179
+ if ([0, data.optionsV.length - 1].includes(index)) {
180
+ this.$emit('change', index);
181
+ return;
182
+ }
183
+ ;
184
+ this.fireChange = true;
178
185
  });
179
186
  });
180
187
  }
@@ -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): Promise<WechatMiniprogram.Component.TrivialInstance>;
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;
@@ -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();
@@ -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) {
@@ -1 +1 @@
1
- @import '../common/index.css';.contain{--thumb-active-color:var(var(--app-B3,#fff),#fff)}
1
+ @import '../common/index.css';.contain{--thumb-active-color:var(--app-B3,#fff)}
@@ -1 +1 @@
1
- @import '../common/index.wxss';.contain{--thumb-active-color:var(var(--app-B3,#fff),#fff)}
1
+ @import '../common/index.wxss';.contain{--thumb-active-color:var(--app-B3,#fff)}
@@ -177,7 +177,14 @@ var DEFAULT_DURATION = 200;
177
177
  animate: true,
178
178
  duration: DEFAULT_DURATION,
179
179
  }).then(function () {
180
- userAction && (_this.fireChange = true);
180
+ if (!userAction)
181
+ return;
182
+ if ([0, data.optionsV.length - 1].includes(index)) {
183
+ _this.$emit('change', index);
184
+ return;
185
+ }
186
+ ;
187
+ _this.fireChange = true;
181
188
  });
182
189
  });
183
190
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tuya-miniapp/smart-ui",
3
- "version": "1.2.0",
3
+ "version": "1.2.3",
4
4
  "author": "MiniApp Team",
5
5
  "license": "MIT",
6
6
  "miniprogram": "lib",
@@ -66,7 +66,7 @@
66
66
  "iOS >= 9"
67
67
  ],
68
68
  "dependencies": {
69
- "@ray-js/components-ty-slider": "^0.2.44",
69
+ "@ray-js/components-ty-slider": "^0.2.48",
70
70
  "@tuya-miniapp/icons": "^1.0.0"
71
71
  },
72
72
  "maintainers": [