@tuya-miniapp/smart-ui 2.9.1 → 2.9.3-beta-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.
package/dist/common/ty.js CHANGED
@@ -36,8 +36,6 @@ const tyApi = {
36
36
  },
37
37
  nativeDisabled: (v) => {
38
38
  var _a;
39
- if (!isIOS)
40
- return;
41
39
  // @ts-ignore
42
40
  if (typeof ty !== 'undefined') {
43
41
  // @ts-ignore
@@ -54,6 +54,7 @@ interface DialogInputOptions extends DialogOptions {
54
54
  placeholder?: string;
55
55
  maxlength?: number;
56
56
  emptyDisabled?: boolean;
57
+ onInput?: (value: string) => void;
57
58
  }
58
59
  export declare const contextRef: {
59
60
  value: Record<string, DialogContext | null>;
@@ -90,7 +90,7 @@ const Dialog = (options) => {
90
90
  };
91
91
  Dialog.alert = (options) => Dialog(options);
92
92
  Dialog.confirm = (options) => Dialog(Object.assign({ showCancelButton: true }, options));
93
- Dialog.input = ((options) => Dialog(Object.assign({ showCancelButton: true }, options)));
93
+ Dialog.input = ((options) => { var _a; return Dialog(Object.assign(Object.assign({ showCancelButton: true }, options), { value: (_a = options.value) !== null && _a !== void 0 ? _a : '' })); });
94
94
  Dialog.close = () => {
95
95
  queueRef.value.forEach(dialog => {
96
96
  dialog.close();
@@ -103,6 +103,7 @@ SmartComponent({
103
103
  },
104
104
  actionType: '',
105
105
  callback: (() => { }),
106
+ onInput: (() => { }),
106
107
  },
107
108
  mounted: function () {
108
109
  if (!this.id)
@@ -133,7 +134,11 @@ SmartComponent({
133
134
  },
134
135
  onInput(evt) {
135
136
  var _a, _b;
136
- this.setData({ inputValue: (_b = (_a = evt === null || evt === void 0 ? void 0 : evt.detail) === null || _a === void 0 ? void 0 : _a.value) !== null && _b !== void 0 ? _b : '' });
137
+ const inputValue = (_b = (_a = evt === null || evt === void 0 ? void 0 : evt.detail) === null || _a === void 0 ? void 0 : _a.value) !== null && _b !== void 0 ? _b : '';
138
+ this.setData({ inputValue });
139
+ if (this.data.onInput) {
140
+ this.data.onInput(inputValue);
141
+ }
137
142
  },
138
143
  close(action) {
139
144
  if (this.data.autoClose) {
package/lib/common/ty.js CHANGED
@@ -38,8 +38,6 @@ var tyApi = {
38
38
  },
39
39
  nativeDisabled: function (v) {
40
40
  var _a;
41
- if (!isIOS)
42
- return;
43
41
  // @ts-ignore
44
42
  if (typeof ty !== 'undefined') {
45
43
  // @ts-ignore
@@ -54,6 +54,7 @@ interface DialogInputOptions extends DialogOptions {
54
54
  placeholder?: string;
55
55
  maxlength?: number;
56
56
  emptyDisabled?: boolean;
57
+ onInput?: (value: string) => void;
57
58
  }
58
59
  export declare const contextRef: {
59
60
  value: Record<string, DialogContext | null>;
@@ -109,9 +109,7 @@ Dialog.alert = function (options) { return Dialog(options); };
109
109
  Dialog.confirm = function (options) {
110
110
  return Dialog(__assign({ showCancelButton: true }, options));
111
111
  };
112
- Dialog.input = (function (options) {
113
- return Dialog(__assign({ showCancelButton: true }, options));
114
- });
112
+ Dialog.input = (function (options) { var _a; return Dialog(__assign(__assign({ showCancelButton: true }, options), { value: (_a = options.value) !== null && _a !== void 0 ? _a : '' })); });
115
113
  Dialog.close = function () {
116
114
  exports.queueRef.value.forEach(function (dialog) {
117
115
  dialog.close();
@@ -108,6 +108,7 @@ var dialog_1 = require("./dialog");
108
108
  },
109
109
  actionType: '',
110
110
  callback: (function () { }),
111
+ onInput: (function () { }),
111
112
  },
112
113
  mounted: function () {
113
114
  if (!this.id)
@@ -139,7 +140,11 @@ var dialog_1 = require("./dialog");
139
140
  },
140
141
  onInput: function (evt) {
141
142
  var _a, _b;
142
- this.setData({ inputValue: (_b = (_a = evt === null || evt === void 0 ? void 0 : evt.detail) === null || _a === void 0 ? void 0 : _a.value) !== null && _b !== void 0 ? _b : '' });
143
+ var inputValue = (_b = (_a = evt === null || evt === void 0 ? void 0 : evt.detail) === null || _a === void 0 ? void 0 : _a.value) !== null && _b !== void 0 ? _b : '';
144
+ this.setData({ inputValue: inputValue });
145
+ if (this.data.onInput) {
146
+ this.data.onInput(inputValue);
147
+ }
143
148
  },
144
149
  close: function (action) {
145
150
  var _this = this;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tuya-miniapp/smart-ui",
3
- "version": "2.9.1",
3
+ "version": "2.9.3-beta-0",
4
4
  "author": "MiniApp Team",
5
5
  "license": "MIT",
6
6
  "miniprogram": "lib",