@tarojs/components 4.1.11-beta.2 → 4.1.11-beta.4
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/cjs/index.cjs.js +2 -2
- package/dist/cjs/{input-f39a63db.js → input-54879868.js} +1 -1
- package/dist/cjs/taro-input-core.cjs.entry.js +1 -1
- package/dist/cjs/taro-textarea-core.cjs.entry.js +1 -1
- package/dist/cjs/{textarea-80e6b1d0.js → textarea-f758aae0.js} +46 -3
- package/dist/collection/components/input/style/index.css +1 -1
- package/dist/collection/components/textarea/textarea.js +46 -3
- package/dist/components/taro-input-core.js +1 -1
- package/dist/components/taro-textarea-core.js +46 -3
- package/dist/esm/index.js +2 -2
- package/dist/esm/{input-4104e3ea.js → input-4833d070.js} +1 -1
- package/dist/esm/taro-input-core.entry.js +1 -1
- package/dist/esm/taro-textarea-core.entry.js +1 -1
- package/dist/esm/{textarea-31371acd.js → textarea-83ef7caf.js} +46 -3
- package/dist/hydrate/index.js +47 -4
- package/dist/taro-components/index.esm.js +1 -1
- package/dist/taro-components/p-15c2bd13.js +1 -0
- package/dist/taro-components/p-256ab08a.entry.js +1 -0
- package/dist/taro-components/p-717960a7.entry.js +1 -0
- package/dist/taro-components/{p-2b1afb2c.js → p-fa9a3a11.js} +1 -1
- package/dist/taro-components/taro-components.esm.js +1 -1
- package/dist/types/components/textarea/textarea.d.ts +5 -1
- package/package.json +5 -5
- package/dist/taro-components/p-66554c2d.entry.js +0 -1
- package/dist/taro-components/p-9a0251c5.entry.js +0 -1
- package/dist/taro-components/p-b8e1a7de.js +0 -1
package/dist/cjs/index.cjs.js
CHANGED
|
@@ -35,7 +35,7 @@ const script$2 = require('./script-d39c17ed.js');
|
|
|
35
35
|
const icon = require('./icon-93e7c472.js');
|
|
36
36
|
const image = require('./image-4303ed3a.js');
|
|
37
37
|
const inlinePaymentPanel = require('./inline-payment-panel-0068d0e4.js');
|
|
38
|
-
const input = require('./input-
|
|
38
|
+
const input = require('./input-54879868.js');
|
|
39
39
|
const keyboardAccessory = require('./keyboard-accessory-d7d227b7.js');
|
|
40
40
|
const label = require('./label-e54a79ee.js');
|
|
41
41
|
const lifestyle = require('./lifestyle-189b4b3a.js');
|
|
@@ -87,7 +87,7 @@ const tabItem = require('./tab-item-cfa3339e.js');
|
|
|
87
87
|
const tabs = require('./tabs-be7f918d.js');
|
|
88
88
|
const script$7 = require('./script-2eb2d361.js');
|
|
89
89
|
const text = require('./text-642f2f48.js');
|
|
90
|
-
const textarea = require('./textarea-
|
|
90
|
+
const textarea = require('./textarea-f758aae0.js');
|
|
91
91
|
const script$8 = require('./script-66238de4.js');
|
|
92
92
|
const video = require('./video-cd8fa901.js');
|
|
93
93
|
const view = require('./view-609adfc6.js');
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
const index = require('./index-ae99cbcc.js');
|
|
4
4
|
|
|
5
|
-
const indexCss = ".weui-input{-webkit-appearance:none;width:100%;font-size:inherit;color:inherit;background-color:transparent;border:0;outline:0;height:1.47059em;line-height:1.47059}.weui-input::-webkit-outer-spin-button,.weui-input::-webkit-inner-spin-button{-webkit-appearance:none;margin:0}taro-input-core{display:block}";
|
|
5
|
+
const indexCss = ".weui-input{-webkit-appearance:none;width:100%;font-size:inherit;color:inherit;background-color:transparent;border:0;outline:0;height:1.47059em;line-height:1.47059}.weui-input::-webkit-outer-spin-button,.weui-input::-webkit-inner-spin-button{-webkit-appearance:none;margin:0}taro-input-core{display:block}taro-input-core input[type=search]::-webkit-search-cancel-button{-webkit-appearance:none;display:none}";
|
|
6
6
|
|
|
7
7
|
function getTrueType(type, confirmType, password) {
|
|
8
8
|
if (confirmType === 'search')
|
|
@@ -27,6 +27,7 @@ const Textarea = class {
|
|
|
27
27
|
return;
|
|
28
28
|
}
|
|
29
29
|
const value = e.target.value || '';
|
|
30
|
+
const cursor = this.getCursorFromTarget(e.target, value.length);
|
|
30
31
|
if (this.isComposing) {
|
|
31
32
|
this.compositionValue = value;
|
|
32
33
|
return;
|
|
@@ -38,7 +39,7 @@ const Textarea = class {
|
|
|
38
39
|
this.value = value;
|
|
39
40
|
this.onInput.emit({
|
|
40
41
|
value,
|
|
41
|
-
cursor
|
|
42
|
+
cursor
|
|
42
43
|
});
|
|
43
44
|
this.onInputExecuted = false;
|
|
44
45
|
};
|
|
@@ -49,12 +50,13 @@ const Textarea = class {
|
|
|
49
50
|
if (e.type === 'compositionend') {
|
|
50
51
|
this.isComposing = false;
|
|
51
52
|
const value = e.target.value || '';
|
|
53
|
+
const cursor = this.getCursorFromTarget(e.target, value.length);
|
|
52
54
|
this.compositionValue = undefined;
|
|
53
55
|
this.handleLineChange();
|
|
54
56
|
this.value = value;
|
|
55
57
|
this.onInput.emit({
|
|
56
58
|
value,
|
|
57
|
-
cursor
|
|
59
|
+
cursor
|
|
58
60
|
});
|
|
59
61
|
}
|
|
60
62
|
else {
|
|
@@ -72,6 +74,7 @@ const Textarea = class {
|
|
|
72
74
|
this.onBlur.emit({
|
|
73
75
|
value: e.target.value
|
|
74
76
|
});
|
|
77
|
+
this.lastSelectionRange = undefined;
|
|
75
78
|
};
|
|
76
79
|
this.handleChange = (e) => {
|
|
77
80
|
e.stopPropagation();
|
|
@@ -92,10 +95,11 @@ const Textarea = class {
|
|
|
92
95
|
this.handleKeyDown = (e) => {
|
|
93
96
|
e.stopPropagation();
|
|
94
97
|
const { value } = e.target;
|
|
98
|
+
const cursor = this.getCursorFromTarget(e.target, value.length);
|
|
95
99
|
const keyCode = e.keyCode || e.code;
|
|
96
100
|
this.onKeyDown.emit({
|
|
97
101
|
value,
|
|
98
|
-
cursor
|
|
102
|
+
cursor,
|
|
99
103
|
keyCode
|
|
100
104
|
});
|
|
101
105
|
keyCode === 13 && this.onConfirm.emit({ value });
|
|
@@ -172,7 +176,12 @@ const Textarea = class {
|
|
|
172
176
|
return;
|
|
173
177
|
const value = fixControlledValue(newValue);
|
|
174
178
|
if (this.textareaRef.value !== value) {
|
|
179
|
+
const isActive = typeof document !== 'undefined' && document.activeElement === this.textareaRef;
|
|
180
|
+
const selection = isActive ? (this.lastSelectionRange || this.getSelectionSnapshot(this.textareaRef)) : null;
|
|
175
181
|
this.textareaRef.value = value;
|
|
182
|
+
if (selection) {
|
|
183
|
+
this.restoreSelection(this.textareaRef, selection);
|
|
184
|
+
}
|
|
176
185
|
}
|
|
177
186
|
}
|
|
178
187
|
async focus() {
|
|
@@ -188,6 +197,40 @@ const Textarea = class {
|
|
|
188
197
|
(_a = this.textareaRef) === null || _a === void 0 ? void 0 : _a.removeEventListener('compositionstart', this.handleComposition);
|
|
189
198
|
(_b = this.textareaRef) === null || _b === void 0 ? void 0 : _b.removeEventListener('compositionend', this.handleComposition);
|
|
190
199
|
}
|
|
200
|
+
getSelectionSnapshot(target) {
|
|
201
|
+
if (!target)
|
|
202
|
+
return null;
|
|
203
|
+
const { selectionStart, selectionEnd } = target;
|
|
204
|
+
if (selectionStart === null || selectionEnd === null)
|
|
205
|
+
return null;
|
|
206
|
+
this.lastSelectionRange = { selectionStart, selectionEnd };
|
|
207
|
+
return { selectionStart, selectionEnd };
|
|
208
|
+
}
|
|
209
|
+
getCursorFromTarget(target, fallback) {
|
|
210
|
+
var _a;
|
|
211
|
+
if (!target)
|
|
212
|
+
return fallback;
|
|
213
|
+
const { selectionEnd } = target;
|
|
214
|
+
if (typeof selectionEnd === 'number') {
|
|
215
|
+
const selectionStart = (_a = target.selectionStart) !== null && _a !== void 0 ? _a : selectionEnd;
|
|
216
|
+
this.lastSelectionRange = { selectionStart, selectionEnd };
|
|
217
|
+
return selectionEnd;
|
|
218
|
+
}
|
|
219
|
+
return fallback;
|
|
220
|
+
}
|
|
221
|
+
restoreSelection(target, selection) {
|
|
222
|
+
if (!target)
|
|
223
|
+
return;
|
|
224
|
+
const range = selection || this.lastSelectionRange || null;
|
|
225
|
+
if (!range)
|
|
226
|
+
return;
|
|
227
|
+
const max = target.value.length;
|
|
228
|
+
const start = Math.min(range.selectionStart, max);
|
|
229
|
+
const end = Math.min(range.selectionEnd, max);
|
|
230
|
+
if (typeof target.setSelectionRange === 'function') {
|
|
231
|
+
target.setSelectionRange(start, end);
|
|
232
|
+
}
|
|
233
|
+
}
|
|
191
234
|
render() {
|
|
192
235
|
const { value, placeholder, disabled, maxlength, autoFocus, autoHeight, name, nativeProps, handleInput, handleFocus, handleBlur, handleChange, compositionValue } = this;
|
|
193
236
|
const otherProps = {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
.weui-input{-webkit-appearance:none;width:100%;font-size:inherit;color:inherit;background-color:transparent;border:0;outline:0;height:1.47059em;line-height:1.47059}.weui-input::-webkit-outer-spin-button,.weui-input::-webkit-inner-spin-button{-webkit-appearance:none;margin:0}taro-input-core{display:block}
|
|
1
|
+
.weui-input{-webkit-appearance:none;width:100%;font-size:inherit;color:inherit;background-color:transparent;border:0;outline:0;height:1.47059em;line-height:1.47059}.weui-input::-webkit-outer-spin-button,.weui-input::-webkit-inner-spin-button{-webkit-appearance:none;margin:0}taro-input-core{display:block}taro-input-core input[type=search]::-webkit-search-cancel-button{-webkit-appearance:none;display:none}
|
|
@@ -14,6 +14,7 @@ export class Textarea {
|
|
|
14
14
|
return;
|
|
15
15
|
}
|
|
16
16
|
const value = e.target.value || '';
|
|
17
|
+
const cursor = this.getCursorFromTarget(e.target, value.length);
|
|
17
18
|
if (this.isComposing) {
|
|
18
19
|
this.compositionValue = value;
|
|
19
20
|
return;
|
|
@@ -25,7 +26,7 @@ export class Textarea {
|
|
|
25
26
|
this.value = value;
|
|
26
27
|
this.onInput.emit({
|
|
27
28
|
value,
|
|
28
|
-
cursor
|
|
29
|
+
cursor
|
|
29
30
|
});
|
|
30
31
|
this.onInputExecuted = false;
|
|
31
32
|
};
|
|
@@ -36,12 +37,13 @@ export class Textarea {
|
|
|
36
37
|
if (e.type === 'compositionend') {
|
|
37
38
|
this.isComposing = false;
|
|
38
39
|
const value = e.target.value || '';
|
|
40
|
+
const cursor = this.getCursorFromTarget(e.target, value.length);
|
|
39
41
|
this.compositionValue = undefined;
|
|
40
42
|
this.handleLineChange();
|
|
41
43
|
this.value = value;
|
|
42
44
|
this.onInput.emit({
|
|
43
45
|
value,
|
|
44
|
-
cursor
|
|
46
|
+
cursor
|
|
45
47
|
});
|
|
46
48
|
}
|
|
47
49
|
else {
|
|
@@ -59,6 +61,7 @@ export class Textarea {
|
|
|
59
61
|
this.onBlur.emit({
|
|
60
62
|
value: e.target.value
|
|
61
63
|
});
|
|
64
|
+
this.lastSelectionRange = undefined;
|
|
62
65
|
};
|
|
63
66
|
this.handleChange = (e) => {
|
|
64
67
|
e.stopPropagation();
|
|
@@ -79,10 +82,11 @@ export class Textarea {
|
|
|
79
82
|
this.handleKeyDown = (e) => {
|
|
80
83
|
e.stopPropagation();
|
|
81
84
|
const { value } = e.target;
|
|
85
|
+
const cursor = this.getCursorFromTarget(e.target, value.length);
|
|
82
86
|
const keyCode = e.keyCode || e.code;
|
|
83
87
|
this.onKeyDown.emit({
|
|
84
88
|
value,
|
|
85
|
-
cursor
|
|
89
|
+
cursor,
|
|
86
90
|
keyCode
|
|
87
91
|
});
|
|
88
92
|
keyCode === 13 && this.onConfirm.emit({ value });
|
|
@@ -159,7 +163,12 @@ export class Textarea {
|
|
|
159
163
|
return;
|
|
160
164
|
const value = fixControlledValue(newValue);
|
|
161
165
|
if (this.textareaRef.value !== value) {
|
|
166
|
+
const isActive = typeof document !== 'undefined' && document.activeElement === this.textareaRef;
|
|
167
|
+
const selection = isActive ? (this.lastSelectionRange || this.getSelectionSnapshot(this.textareaRef)) : null;
|
|
162
168
|
this.textareaRef.value = value;
|
|
169
|
+
if (selection) {
|
|
170
|
+
this.restoreSelection(this.textareaRef, selection);
|
|
171
|
+
}
|
|
163
172
|
}
|
|
164
173
|
}
|
|
165
174
|
async focus() {
|
|
@@ -175,6 +184,40 @@ export class Textarea {
|
|
|
175
184
|
(_a = this.textareaRef) === null || _a === void 0 ? void 0 : _a.removeEventListener('compositionstart', this.handleComposition);
|
|
176
185
|
(_b = this.textareaRef) === null || _b === void 0 ? void 0 : _b.removeEventListener('compositionend', this.handleComposition);
|
|
177
186
|
}
|
|
187
|
+
getSelectionSnapshot(target) {
|
|
188
|
+
if (!target)
|
|
189
|
+
return null;
|
|
190
|
+
const { selectionStart, selectionEnd } = target;
|
|
191
|
+
if (selectionStart === null || selectionEnd === null)
|
|
192
|
+
return null;
|
|
193
|
+
this.lastSelectionRange = { selectionStart, selectionEnd };
|
|
194
|
+
return { selectionStart, selectionEnd };
|
|
195
|
+
}
|
|
196
|
+
getCursorFromTarget(target, fallback) {
|
|
197
|
+
var _a;
|
|
198
|
+
if (!target)
|
|
199
|
+
return fallback;
|
|
200
|
+
const { selectionEnd } = target;
|
|
201
|
+
if (typeof selectionEnd === 'number') {
|
|
202
|
+
const selectionStart = (_a = target.selectionStart) !== null && _a !== void 0 ? _a : selectionEnd;
|
|
203
|
+
this.lastSelectionRange = { selectionStart, selectionEnd };
|
|
204
|
+
return selectionEnd;
|
|
205
|
+
}
|
|
206
|
+
return fallback;
|
|
207
|
+
}
|
|
208
|
+
restoreSelection(target, selection) {
|
|
209
|
+
if (!target)
|
|
210
|
+
return;
|
|
211
|
+
const range = selection || this.lastSelectionRange || null;
|
|
212
|
+
if (!range)
|
|
213
|
+
return;
|
|
214
|
+
const max = target.value.length;
|
|
215
|
+
const start = Math.min(range.selectionStart, max);
|
|
216
|
+
const end = Math.min(range.selectionEnd, max);
|
|
217
|
+
if (typeof target.setSelectionRange === 'function') {
|
|
218
|
+
target.setSelectionRange(start, end);
|
|
219
|
+
}
|
|
220
|
+
}
|
|
178
221
|
render() {
|
|
179
222
|
const { value, placeholder, disabled, maxlength, autoFocus, autoHeight, name, nativeProps, handleInput, handleFocus, handleBlur, handleChange, compositionValue } = this;
|
|
180
223
|
const otherProps = {};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { proxyCustomElement, HTMLElement, createEvent, h } from '@stencil/core/internal/client';
|
|
2
2
|
|
|
3
|
-
const indexCss = ".weui-input{-webkit-appearance:none;width:100%;font-size:inherit;color:inherit;background-color:transparent;border:0;outline:0;height:1.47059em;line-height:1.47059}.weui-input::-webkit-outer-spin-button,.weui-input::-webkit-inner-spin-button{-webkit-appearance:none;margin:0}taro-input-core{display:block}";
|
|
3
|
+
const indexCss = ".weui-input{-webkit-appearance:none;width:100%;font-size:inherit;color:inherit;background-color:transparent;border:0;outline:0;height:1.47059em;line-height:1.47059}.weui-input::-webkit-outer-spin-button,.weui-input::-webkit-inner-spin-button{-webkit-appearance:none;margin:0}taro-input-core{display:block}taro-input-core input[type=search]::-webkit-search-cancel-button{-webkit-appearance:none;display:none}";
|
|
4
4
|
|
|
5
5
|
function getTrueType(type, confirmType, password) {
|
|
6
6
|
if (confirmType === 'search')
|
|
@@ -26,6 +26,7 @@ const Textarea = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
26
26
|
return;
|
|
27
27
|
}
|
|
28
28
|
const value = e.target.value || '';
|
|
29
|
+
const cursor = this.getCursorFromTarget(e.target, value.length);
|
|
29
30
|
if (this.isComposing) {
|
|
30
31
|
this.compositionValue = value;
|
|
31
32
|
return;
|
|
@@ -37,7 +38,7 @@ const Textarea = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
37
38
|
this.value = value;
|
|
38
39
|
this.onInput.emit({
|
|
39
40
|
value,
|
|
40
|
-
cursor
|
|
41
|
+
cursor
|
|
41
42
|
});
|
|
42
43
|
this.onInputExecuted = false;
|
|
43
44
|
};
|
|
@@ -48,12 +49,13 @@ const Textarea = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
48
49
|
if (e.type === 'compositionend') {
|
|
49
50
|
this.isComposing = false;
|
|
50
51
|
const value = e.target.value || '';
|
|
52
|
+
const cursor = this.getCursorFromTarget(e.target, value.length);
|
|
51
53
|
this.compositionValue = undefined;
|
|
52
54
|
this.handleLineChange();
|
|
53
55
|
this.value = value;
|
|
54
56
|
this.onInput.emit({
|
|
55
57
|
value,
|
|
56
|
-
cursor
|
|
58
|
+
cursor
|
|
57
59
|
});
|
|
58
60
|
}
|
|
59
61
|
else {
|
|
@@ -71,6 +73,7 @@ const Textarea = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
71
73
|
this.onBlur.emit({
|
|
72
74
|
value: e.target.value
|
|
73
75
|
});
|
|
76
|
+
this.lastSelectionRange = undefined;
|
|
74
77
|
};
|
|
75
78
|
this.handleChange = (e) => {
|
|
76
79
|
e.stopPropagation();
|
|
@@ -91,10 +94,11 @@ const Textarea = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
91
94
|
this.handleKeyDown = (e) => {
|
|
92
95
|
e.stopPropagation();
|
|
93
96
|
const { value } = e.target;
|
|
97
|
+
const cursor = this.getCursorFromTarget(e.target, value.length);
|
|
94
98
|
const keyCode = e.keyCode || e.code;
|
|
95
99
|
this.onKeyDown.emit({
|
|
96
100
|
value,
|
|
97
|
-
cursor
|
|
101
|
+
cursor,
|
|
98
102
|
keyCode
|
|
99
103
|
});
|
|
100
104
|
keyCode === 13 && this.onConfirm.emit({ value });
|
|
@@ -171,7 +175,12 @@ const Textarea = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
171
175
|
return;
|
|
172
176
|
const value = fixControlledValue(newValue);
|
|
173
177
|
if (this.textareaRef.value !== value) {
|
|
178
|
+
const isActive = typeof document !== 'undefined' && document.activeElement === this.textareaRef;
|
|
179
|
+
const selection = isActive ? (this.lastSelectionRange || this.getSelectionSnapshot(this.textareaRef)) : null;
|
|
174
180
|
this.textareaRef.value = value;
|
|
181
|
+
if (selection) {
|
|
182
|
+
this.restoreSelection(this.textareaRef, selection);
|
|
183
|
+
}
|
|
175
184
|
}
|
|
176
185
|
}
|
|
177
186
|
async focus() {
|
|
@@ -187,6 +196,40 @@ const Textarea = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
187
196
|
(_a = this.textareaRef) === null || _a === void 0 ? void 0 : _a.removeEventListener('compositionstart', this.handleComposition);
|
|
188
197
|
(_b = this.textareaRef) === null || _b === void 0 ? void 0 : _b.removeEventListener('compositionend', this.handleComposition);
|
|
189
198
|
}
|
|
199
|
+
getSelectionSnapshot(target) {
|
|
200
|
+
if (!target)
|
|
201
|
+
return null;
|
|
202
|
+
const { selectionStart, selectionEnd } = target;
|
|
203
|
+
if (selectionStart === null || selectionEnd === null)
|
|
204
|
+
return null;
|
|
205
|
+
this.lastSelectionRange = { selectionStart, selectionEnd };
|
|
206
|
+
return { selectionStart, selectionEnd };
|
|
207
|
+
}
|
|
208
|
+
getCursorFromTarget(target, fallback) {
|
|
209
|
+
var _a;
|
|
210
|
+
if (!target)
|
|
211
|
+
return fallback;
|
|
212
|
+
const { selectionEnd } = target;
|
|
213
|
+
if (typeof selectionEnd === 'number') {
|
|
214
|
+
const selectionStart = (_a = target.selectionStart) !== null && _a !== void 0 ? _a : selectionEnd;
|
|
215
|
+
this.lastSelectionRange = { selectionStart, selectionEnd };
|
|
216
|
+
return selectionEnd;
|
|
217
|
+
}
|
|
218
|
+
return fallback;
|
|
219
|
+
}
|
|
220
|
+
restoreSelection(target, selection) {
|
|
221
|
+
if (!target)
|
|
222
|
+
return;
|
|
223
|
+
const range = selection || this.lastSelectionRange || null;
|
|
224
|
+
if (!range)
|
|
225
|
+
return;
|
|
226
|
+
const max = target.value.length;
|
|
227
|
+
const start = Math.min(range.selectionStart, max);
|
|
228
|
+
const end = Math.min(range.selectionEnd, max);
|
|
229
|
+
if (typeof target.setSelectionRange === 'function') {
|
|
230
|
+
target.setSelectionRange(start, end);
|
|
231
|
+
}
|
|
232
|
+
}
|
|
190
233
|
render() {
|
|
191
234
|
const { value, placeholder, disabled, maxlength, autoFocus, autoHeight, name, nativeProps, handleInput, handleFocus, handleBlur, handleChange, compositionValue } = this;
|
|
192
235
|
const otherProps = {};
|
package/dist/esm/index.js
CHANGED
|
@@ -31,7 +31,7 @@ export { H as HorizontalDragGestureHandler } from './script-661db6af.js';
|
|
|
31
31
|
export { I as Icon } from './icon-88383f2c.js';
|
|
32
32
|
export { I as Image } from './image-b0b222bc.js';
|
|
33
33
|
export { I as InlinePaymentPanel } from './inline-payment-panel-73925dd2.js';
|
|
34
|
-
export { I as Input } from './input-
|
|
34
|
+
export { I as Input } from './input-4833d070.js';
|
|
35
35
|
export { K as KeyboardAccessory } from './keyboard-accessory-fd485a31.js';
|
|
36
36
|
export { L as Label } from './label-94ef4b17.js';
|
|
37
37
|
export { L as Lifestyle } from './lifestyle-4db11299.js';
|
|
@@ -83,7 +83,7 @@ export { T as TabItem } from './tab-item-f58dd1b0.js';
|
|
|
83
83
|
export { T as Tabs } from './tabs-da838bbd.js';
|
|
84
84
|
export { T as TapGestureHandler } from './script-11e3884a.js';
|
|
85
85
|
export { T as Text } from './text-a3b91b23.js';
|
|
86
|
-
export { T as Textarea } from './textarea-
|
|
86
|
+
export { T as Textarea } from './textarea-83ef7caf.js';
|
|
87
87
|
export { V as VerticalDragGestureHandler } from './script-5c55afcb.js';
|
|
88
88
|
export { b as Video, V as VideoControl, a as VideoDanmu } from './video-8a258487.js';
|
|
89
89
|
export { V as View } from './view-965a491b.js';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { r as registerInstance, c as createEvent, h, g as getElement } from './index-0004ce39.js';
|
|
2
2
|
|
|
3
|
-
const indexCss = ".weui-input{-webkit-appearance:none;width:100%;font-size:inherit;color:inherit;background-color:transparent;border:0;outline:0;height:1.47059em;line-height:1.47059}.weui-input::-webkit-outer-spin-button,.weui-input::-webkit-inner-spin-button{-webkit-appearance:none;margin:0}taro-input-core{display:block}";
|
|
3
|
+
const indexCss = ".weui-input{-webkit-appearance:none;width:100%;font-size:inherit;color:inherit;background-color:transparent;border:0;outline:0;height:1.47059em;line-height:1.47059}.weui-input::-webkit-outer-spin-button,.weui-input::-webkit-inner-spin-button{-webkit-appearance:none;margin:0}taro-input-core{display:block}taro-input-core input[type=search]::-webkit-search-cancel-button{-webkit-appearance:none;display:none}";
|
|
4
4
|
|
|
5
5
|
function getTrueType(type, confirmType, password) {
|
|
6
6
|
if (confirmType === 'search')
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { I as taro_input_core } from './input-
|
|
1
|
+
export { I as taro_input_core } from './input-4833d070.js';
|
|
2
2
|
import './index-0004ce39.js';
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { T as taro_textarea_core } from './textarea-
|
|
1
|
+
export { T as taro_textarea_core } from './textarea-83ef7caf.js';
|
|
2
2
|
import './index-0004ce39.js';
|
|
@@ -25,6 +25,7 @@ const Textarea = class {
|
|
|
25
25
|
return;
|
|
26
26
|
}
|
|
27
27
|
const value = e.target.value || '';
|
|
28
|
+
const cursor = this.getCursorFromTarget(e.target, value.length);
|
|
28
29
|
if (this.isComposing) {
|
|
29
30
|
this.compositionValue = value;
|
|
30
31
|
return;
|
|
@@ -36,7 +37,7 @@ const Textarea = class {
|
|
|
36
37
|
this.value = value;
|
|
37
38
|
this.onInput.emit({
|
|
38
39
|
value,
|
|
39
|
-
cursor
|
|
40
|
+
cursor
|
|
40
41
|
});
|
|
41
42
|
this.onInputExecuted = false;
|
|
42
43
|
};
|
|
@@ -47,12 +48,13 @@ const Textarea = class {
|
|
|
47
48
|
if (e.type === 'compositionend') {
|
|
48
49
|
this.isComposing = false;
|
|
49
50
|
const value = e.target.value || '';
|
|
51
|
+
const cursor = this.getCursorFromTarget(e.target, value.length);
|
|
50
52
|
this.compositionValue = undefined;
|
|
51
53
|
this.handleLineChange();
|
|
52
54
|
this.value = value;
|
|
53
55
|
this.onInput.emit({
|
|
54
56
|
value,
|
|
55
|
-
cursor
|
|
57
|
+
cursor
|
|
56
58
|
});
|
|
57
59
|
}
|
|
58
60
|
else {
|
|
@@ -70,6 +72,7 @@ const Textarea = class {
|
|
|
70
72
|
this.onBlur.emit({
|
|
71
73
|
value: e.target.value
|
|
72
74
|
});
|
|
75
|
+
this.lastSelectionRange = undefined;
|
|
73
76
|
};
|
|
74
77
|
this.handleChange = (e) => {
|
|
75
78
|
e.stopPropagation();
|
|
@@ -90,10 +93,11 @@ const Textarea = class {
|
|
|
90
93
|
this.handleKeyDown = (e) => {
|
|
91
94
|
e.stopPropagation();
|
|
92
95
|
const { value } = e.target;
|
|
96
|
+
const cursor = this.getCursorFromTarget(e.target, value.length);
|
|
93
97
|
const keyCode = e.keyCode || e.code;
|
|
94
98
|
this.onKeyDown.emit({
|
|
95
99
|
value,
|
|
96
|
-
cursor
|
|
100
|
+
cursor,
|
|
97
101
|
keyCode
|
|
98
102
|
});
|
|
99
103
|
keyCode === 13 && this.onConfirm.emit({ value });
|
|
@@ -170,7 +174,12 @@ const Textarea = class {
|
|
|
170
174
|
return;
|
|
171
175
|
const value = fixControlledValue(newValue);
|
|
172
176
|
if (this.textareaRef.value !== value) {
|
|
177
|
+
const isActive = typeof document !== 'undefined' && document.activeElement === this.textareaRef;
|
|
178
|
+
const selection = isActive ? (this.lastSelectionRange || this.getSelectionSnapshot(this.textareaRef)) : null;
|
|
173
179
|
this.textareaRef.value = value;
|
|
180
|
+
if (selection) {
|
|
181
|
+
this.restoreSelection(this.textareaRef, selection);
|
|
182
|
+
}
|
|
174
183
|
}
|
|
175
184
|
}
|
|
176
185
|
async focus() {
|
|
@@ -186,6 +195,40 @@ const Textarea = class {
|
|
|
186
195
|
(_a = this.textareaRef) === null || _a === void 0 ? void 0 : _a.removeEventListener('compositionstart', this.handleComposition);
|
|
187
196
|
(_b = this.textareaRef) === null || _b === void 0 ? void 0 : _b.removeEventListener('compositionend', this.handleComposition);
|
|
188
197
|
}
|
|
198
|
+
getSelectionSnapshot(target) {
|
|
199
|
+
if (!target)
|
|
200
|
+
return null;
|
|
201
|
+
const { selectionStart, selectionEnd } = target;
|
|
202
|
+
if (selectionStart === null || selectionEnd === null)
|
|
203
|
+
return null;
|
|
204
|
+
this.lastSelectionRange = { selectionStart, selectionEnd };
|
|
205
|
+
return { selectionStart, selectionEnd };
|
|
206
|
+
}
|
|
207
|
+
getCursorFromTarget(target, fallback) {
|
|
208
|
+
var _a;
|
|
209
|
+
if (!target)
|
|
210
|
+
return fallback;
|
|
211
|
+
const { selectionEnd } = target;
|
|
212
|
+
if (typeof selectionEnd === 'number') {
|
|
213
|
+
const selectionStart = (_a = target.selectionStart) !== null && _a !== void 0 ? _a : selectionEnd;
|
|
214
|
+
this.lastSelectionRange = { selectionStart, selectionEnd };
|
|
215
|
+
return selectionEnd;
|
|
216
|
+
}
|
|
217
|
+
return fallback;
|
|
218
|
+
}
|
|
219
|
+
restoreSelection(target, selection) {
|
|
220
|
+
if (!target)
|
|
221
|
+
return;
|
|
222
|
+
const range = selection || this.lastSelectionRange || null;
|
|
223
|
+
if (!range)
|
|
224
|
+
return;
|
|
225
|
+
const max = target.value.length;
|
|
226
|
+
const start = Math.min(range.selectionStart, max);
|
|
227
|
+
const end = Math.min(range.selectionEnd, max);
|
|
228
|
+
if (typeof target.setSelectionRange === 'function') {
|
|
229
|
+
target.setSelectionRange(start, end);
|
|
230
|
+
}
|
|
231
|
+
}
|
|
189
232
|
render() {
|
|
190
233
|
const { value, placeholder, disabled, maxlength, autoFocus, autoHeight, name, nativeProps, handleInput, handleFocus, handleBlur, handleChange, compositionValue } = this;
|
|
191
234
|
const otherProps = {};
|
package/dist/hydrate/index.js
CHANGED
|
@@ -7147,7 +7147,7 @@ class InlinePaymentPanel {
|
|
|
7147
7147
|
}; }
|
|
7148
7148
|
}
|
|
7149
7149
|
|
|
7150
|
-
const indexCss$g = ".weui-input{-webkit-appearance:none;width:100%;font-size:inherit;color:inherit;background-color:transparent;border:0;outline:0;height:1.47059em;line-height:1.47059}.weui-input::-webkit-outer-spin-button,.weui-input::-webkit-inner-spin-button{-webkit-appearance:none;margin:0}taro-input-core{display:block}";
|
|
7150
|
+
const indexCss$g = ".weui-input{-webkit-appearance:none;width:100%;font-size:inherit;color:inherit;background-color:transparent;border:0;outline:0;height:1.47059em;line-height:1.47059}.weui-input::-webkit-outer-spin-button,.weui-input::-webkit-inner-spin-button{-webkit-appearance:none;margin:0}taro-input-core{display:block}taro-input-core input[type=search]::-webkit-search-cancel-button{-webkit-appearance:none;display:none}";
|
|
7151
7151
|
|
|
7152
7152
|
function getTrueType(type, confirmType, password) {
|
|
7153
7153
|
if (confirmType === 'search')
|
|
@@ -12816,6 +12816,7 @@ class Textarea {
|
|
|
12816
12816
|
return;
|
|
12817
12817
|
}
|
|
12818
12818
|
const value = e.target.value || '';
|
|
12819
|
+
const cursor = this.getCursorFromTarget(e.target, value.length);
|
|
12819
12820
|
if (this.isComposing) {
|
|
12820
12821
|
this.compositionValue = value;
|
|
12821
12822
|
return;
|
|
@@ -12827,7 +12828,7 @@ class Textarea {
|
|
|
12827
12828
|
this.value = value;
|
|
12828
12829
|
this.onInput.emit({
|
|
12829
12830
|
value,
|
|
12830
|
-
cursor
|
|
12831
|
+
cursor
|
|
12831
12832
|
});
|
|
12832
12833
|
this.onInputExecuted = false;
|
|
12833
12834
|
};
|
|
@@ -12838,12 +12839,13 @@ class Textarea {
|
|
|
12838
12839
|
if (e.type === 'compositionend') {
|
|
12839
12840
|
this.isComposing = false;
|
|
12840
12841
|
const value = e.target.value || '';
|
|
12842
|
+
const cursor = this.getCursorFromTarget(e.target, value.length);
|
|
12841
12843
|
this.compositionValue = undefined;
|
|
12842
12844
|
this.handleLineChange();
|
|
12843
12845
|
this.value = value;
|
|
12844
12846
|
this.onInput.emit({
|
|
12845
12847
|
value,
|
|
12846
|
-
cursor
|
|
12848
|
+
cursor
|
|
12847
12849
|
});
|
|
12848
12850
|
}
|
|
12849
12851
|
else {
|
|
@@ -12861,6 +12863,7 @@ class Textarea {
|
|
|
12861
12863
|
this.onBlur.emit({
|
|
12862
12864
|
value: e.target.value
|
|
12863
12865
|
});
|
|
12866
|
+
this.lastSelectionRange = undefined;
|
|
12864
12867
|
};
|
|
12865
12868
|
this.handleChange = (e) => {
|
|
12866
12869
|
e.stopPropagation();
|
|
@@ -12881,10 +12884,11 @@ class Textarea {
|
|
|
12881
12884
|
this.handleKeyDown = (e) => {
|
|
12882
12885
|
e.stopPropagation();
|
|
12883
12886
|
const { value } = e.target;
|
|
12887
|
+
const cursor = this.getCursorFromTarget(e.target, value.length);
|
|
12884
12888
|
const keyCode = e.keyCode || e.code;
|
|
12885
12889
|
this.onKeyDown.emit({
|
|
12886
12890
|
value,
|
|
12887
|
-
cursor
|
|
12891
|
+
cursor,
|
|
12888
12892
|
keyCode
|
|
12889
12893
|
});
|
|
12890
12894
|
keyCode === 13 && this.onConfirm.emit({ value });
|
|
@@ -12961,7 +12965,12 @@ class Textarea {
|
|
|
12961
12965
|
return;
|
|
12962
12966
|
const value = fixControlledValue(newValue);
|
|
12963
12967
|
if (this.textareaRef.value !== value) {
|
|
12968
|
+
const isActive = typeof document !== 'undefined' && document.activeElement === this.textareaRef;
|
|
12969
|
+
const selection = isActive ? (this.lastSelectionRange || this.getSelectionSnapshot(this.textareaRef)) : null;
|
|
12964
12970
|
this.textareaRef.value = value;
|
|
12971
|
+
if (selection) {
|
|
12972
|
+
this.restoreSelection(this.textareaRef, selection);
|
|
12973
|
+
}
|
|
12965
12974
|
}
|
|
12966
12975
|
}
|
|
12967
12976
|
async focus() {
|
|
@@ -12977,6 +12986,40 @@ class Textarea {
|
|
|
12977
12986
|
(_a = this.textareaRef) === null || _a === void 0 ? void 0 : _a.removeEventListener('compositionstart', this.handleComposition);
|
|
12978
12987
|
(_b = this.textareaRef) === null || _b === void 0 ? void 0 : _b.removeEventListener('compositionend', this.handleComposition);
|
|
12979
12988
|
}
|
|
12989
|
+
getSelectionSnapshot(target) {
|
|
12990
|
+
if (!target)
|
|
12991
|
+
return null;
|
|
12992
|
+
const { selectionStart, selectionEnd } = target;
|
|
12993
|
+
if (selectionStart === null || selectionEnd === null)
|
|
12994
|
+
return null;
|
|
12995
|
+
this.lastSelectionRange = { selectionStart, selectionEnd };
|
|
12996
|
+
return { selectionStart, selectionEnd };
|
|
12997
|
+
}
|
|
12998
|
+
getCursorFromTarget(target, fallback) {
|
|
12999
|
+
var _a;
|
|
13000
|
+
if (!target)
|
|
13001
|
+
return fallback;
|
|
13002
|
+
const { selectionEnd } = target;
|
|
13003
|
+
if (typeof selectionEnd === 'number') {
|
|
13004
|
+
const selectionStart = (_a = target.selectionStart) !== null && _a !== void 0 ? _a : selectionEnd;
|
|
13005
|
+
this.lastSelectionRange = { selectionStart, selectionEnd };
|
|
13006
|
+
return selectionEnd;
|
|
13007
|
+
}
|
|
13008
|
+
return fallback;
|
|
13009
|
+
}
|
|
13010
|
+
restoreSelection(target, selection) {
|
|
13011
|
+
if (!target)
|
|
13012
|
+
return;
|
|
13013
|
+
const range = selection || this.lastSelectionRange || null;
|
|
13014
|
+
if (!range)
|
|
13015
|
+
return;
|
|
13016
|
+
const max = target.value.length;
|
|
13017
|
+
const start = Math.min(range.selectionStart, max);
|
|
13018
|
+
const end = Math.min(range.selectionEnd, max);
|
|
13019
|
+
if (typeof target.setSelectionRange === 'function') {
|
|
13020
|
+
target.setSelectionRange(start, end);
|
|
13021
|
+
}
|
|
13022
|
+
}
|
|
12980
13023
|
render() {
|
|
12981
13024
|
const { value, placeholder, disabled, maxlength, autoFocus, autoHeight, name, nativeProps, handleInput, handleFocus, handleBlur, handleChange, compositionValue } = this;
|
|
12982
13025
|
const otherProps = {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export{A as Ad}from"./p-9d4a6732.js";export{A as AdCustom}from"./p-915aa78c.js";export{A as AnimationVideo}from"./p-f6e5beeb.js";export{A as AnimationView}from"./p-a5798672.js";export{A as ArCamera}from"./p-c3a8af99.js";export{A as Audio}from"./p-cae824d1.js";export{A as AwemeData}from"./p-2f7b8388.js";export{B as Block}from"./p-e3de8581.js";export{B as Button}from"./p-61cec685.js";export{C as Camera}from"./p-245fcd36.js";export{C as Canvas}from"./p-24ef5f8c.js";export{C as ChannelLive}from"./p-27622761.js";export{C as ChannelVideo}from"./p-150a55a3.js";export{a as Checkbox,C as CheckboxGroup}from"./p-046319d8.js";export{C as CommentDetail}from"./p-fff1a810.js";export{C as CommentList}from"./p-febc484e.js";export{C as ContactButton}from"./p-36e83be9.js";export{C as CoverImage}from"./p-d5773721.js";export{C as CoverView}from"./p-c7f9e228.js";export{C as CustomWrapper}from"./p-a293fa24.js";export{D as DoubleTapGestureHandler}from"./p-4bb83c7d.js";export{D as DraggableSheet}from"./p-6c93b540.js";export{E as Editor}from"./p-31c75fd5.js";export{F as FollowSwan}from"./p-b9446784.js";export{F as ForcePressGestureHandler}from"./p-64a5e7a7.js";export{F as Form}from"./p-a6c178f3.js";export{F as FunctionalPageNavigator}from"./p-3a6ec908.js";export{G as GridBuilder}from"./p-c3cf4884.js";export{G as GridView}from"./p-d5f0d48c.js";export{H as HorizontalDragGestureHandler}from"./p-8e3bac82.js";export{I as Icon}from"./p-53b69659.js";export{I as Image}from"./p-1f81d4f4.js";export{I as InlinePaymentPanel}from"./p-99863698.js";export{I as Input}from"./p-
|
|
1
|
+
export{A as Ad}from"./p-9d4a6732.js";export{A as AdCustom}from"./p-915aa78c.js";export{A as AnimationVideo}from"./p-f6e5beeb.js";export{A as AnimationView}from"./p-a5798672.js";export{A as ArCamera}from"./p-c3a8af99.js";export{A as Audio}from"./p-cae824d1.js";export{A as AwemeData}from"./p-2f7b8388.js";export{B as Block}from"./p-e3de8581.js";export{B as Button}from"./p-61cec685.js";export{C as Camera}from"./p-245fcd36.js";export{C as Canvas}from"./p-24ef5f8c.js";export{C as ChannelLive}from"./p-27622761.js";export{C as ChannelVideo}from"./p-150a55a3.js";export{a as Checkbox,C as CheckboxGroup}from"./p-046319d8.js";export{C as CommentDetail}from"./p-fff1a810.js";export{C as CommentList}from"./p-febc484e.js";export{C as ContactButton}from"./p-36e83be9.js";export{C as CoverImage}from"./p-d5773721.js";export{C as CoverView}from"./p-c7f9e228.js";export{C as CustomWrapper}from"./p-a293fa24.js";export{D as DoubleTapGestureHandler}from"./p-4bb83c7d.js";export{D as DraggableSheet}from"./p-6c93b540.js";export{E as Editor}from"./p-31c75fd5.js";export{F as FollowSwan}from"./p-b9446784.js";export{F as ForcePressGestureHandler}from"./p-64a5e7a7.js";export{F as Form}from"./p-a6c178f3.js";export{F as FunctionalPageNavigator}from"./p-3a6ec908.js";export{G as GridBuilder}from"./p-c3cf4884.js";export{G as GridView}from"./p-d5f0d48c.js";export{H as HorizontalDragGestureHandler}from"./p-8e3bac82.js";export{I as Icon}from"./p-53b69659.js";export{I as Image}from"./p-1f81d4f4.js";export{I as InlinePaymentPanel}from"./p-99863698.js";export{I as Input}from"./p-fa9a3a11.js";export{K as KeyboardAccessory}from"./p-137eb06b.js";export{L as Label}from"./p-8b1b513a.js";export{L as Lifestyle}from"./p-af5e0304.js";export{L as Like}from"./p-a17695f9.js";export{L as ListBuilder}from"./p-4cf49968.js";export{L as ListView}from"./p-52c6b16d.js";export{L as LivePlayer}from"./p-2884aec2.js";export{L as LivePusher}from"./p-582cbc31.js";export{L as Login}from"./p-b74ad8e4.js";export{L as LongPressGestureHandler}from"./p-1d3cfd13.js";export{L as Lottie}from"./p-5fe2d7cb.js";export{M as Map}from"./p-b2979101.js";export{M as MatchMedia}from"./p-2e5daff6.js";export{M as MovableArea,a as MovableView}from"./p-45c3b3bf.js";export{N as NavigationBar}from"./p-d11af89d.js";export{N as Navigator}from"./p-3d450082.js";export{N as NestedScrollBody}from"./p-ee9bae70.js";export{N as NestedScrollHeader}from"./p-f441b5e7.js";export{O as OfficialAccount}from"./p-50ffadb4.js";export{O as OpenContainer}from"./p-96f65f1d.js";export{O as OpenData}from"./p-c872ed50.js";export{P as PageContainer}from"./p-1c19d1dd.js";export{P as PageMeta}from"./p-c9a01a1f.js";export{P as PanGestureHandler}from"./p-7ea32cac.js";export{P as Picker,T as TaroPickerGroup}from"./p-13d455f5.js";export{a as PickerView,P as PickerViewColumn}from"./p-d1a1274a.js";export{P as Progress}from"./p-bd7613d0.js";export{P as PullToRefresh}from"./p-67c4cf7e.js";export{a as Radio,R as RadioGroup}from"./p-4818a4aa.js";export{R as RichText}from"./p-553b9dc1.js";export{R as RootPortal}from"./p-08cfc9f4.js";export{R as RtcRoomItem}from"./p-c48b7222.js";export{R as RtcRoom}from"./p-79d3e109.js";export{S as ScaleGestureHandler}from"./p-956bc9d5.js";export{S as Script}from"./p-baed3510.js";export{S as ScrollView}from"./p-58a709ad.js";export{S as ShareElement}from"./p-7bb097de.js";export{S as Slider}from"./p-35aac6e0.js";export{N as NativeSlot}from"./p-49e4d6ae.js";export{S as Slot}from"./p-680d07ac.js";export{S as Snapshot}from"./p-99383bc2.js";export{S as Span}from"./p-a2cb2d73.js";export{S as StickyHeader}from"./p-2e841a1d.js";export{S as StickySection}from"./p-da4fcba5.js";export{a as Swiper,S as SwiperItem}from"./p-8d26b600.js";export{S as Switch}from"./p-4d79a974.js";export{a as Tabbar,T as TabbarItem}from"./p-8d996705.js";export{T as TabItem}from"./p-2bf24716.js";export{T as Tabs}from"./p-93e3cefb.js";export{T as TapGestureHandler}from"./p-5bd1aed9.js";export{T as Text}from"./p-1c317d71.js";export{T as Textarea}from"./p-15c2bd13.js";export{V as VerticalDragGestureHandler}from"./p-2f9a4db4.js";export{b as Video,V as VideoControl,a as VideoDanmu}from"./p-465dbd80.js";export{V as View}from"./p-c5666cb2.js";export{V as VoipRoom}from"./p-c0687b94.js";export{W as WebView}from"./p-beae3fe0.js";import"./p-f72fcd8c.js";import"./p-dbdb9de9.js";import"@tarojs/taro";import"./p-160d710a.js";import"hammerjs";import"./p-5893c3ed.js";import"swiper/bundle";import"@tarojs/runtime";import"resolve-pathname";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as t,c as i,h as s,g as e}from"./p-f72fcd8c.js";function o(t){return null!=t?t:""}const h=class{constructor(s){t(this,s),this.onInput=i(this,"input",7),this.onFocus=i(this,"focus",7),this.onBlur=i(this,"blur",7),this.onConfirm=i(this,"confirm",7),this.onChange=i(this,"change",7),this.onLineChange=i(this,"linechange",7),this.onKeyDown=i(this,"keydown",7),this.isComposing=!1,this.onInputExecuted=!1,this.handleInput=t=>{if(t.stopPropagation(),this.handleLineChange(),this.onInputExecuted)return void(this.onInputExecuted=!1);const i=t.target.value||"",s=this.getCursorFromTarget(t.target,i.length);this.isComposing?this.compositionValue=i:(this.onInputExecuted=!0,void 0!==this.compositionValue&&(this.compositionValue=void 0),this.value=i,this.onInput.emit({value:i,cursor:s}),this.onInputExecuted=!1)},this.handleComposition=t=>{if(t.stopPropagation(),t.target instanceof HTMLTextAreaElement)if("compositionend"===t.type){this.isComposing=!1;const i=t.target.value||"",s=this.getCursorFromTarget(t.target,i.length);this.compositionValue=void 0,this.handleLineChange(),this.value=i,this.onInput.emit({value:i,cursor:s})}else this.isComposing=!0},this.handleFocus=t=>{t.stopPropagation(),this.onFocus.emit({value:t.target.value})},this.handleBlur=t=>{t.stopPropagation(),this.onBlur.emit({value:t.target.value}),this.lastSelectionRange=void 0},this.handleChange=t=>{t.stopPropagation(),this.onChange.emit({value:t.target.value})},this.handleLineChange=()=>{const t=this.getNumberOfLines();t!==this.line&&(this.line=t,this.onLineChange.emit({height:this.textareaRef.clientHeight,lineCount:this.line}))},this.handleKeyDown=t=>{t.stopPropagation();const{value:i}=t.target,s=this.getCursorFromTarget(t.target,i.length),e=t.keyCode||t.code;this.onKeyDown.emit({value:i,cursor:s,keyCode:e}),13===e&&this.onConfirm.emit({value:i})},this.calculateContentHeight=(t,i)=>{const s=t.style.height;let e=t.offsetHeight;const o=t.scrollHeight,h=t.style.overflow,n=t.style.minHeight||null;if(!(e>=o))return o;if(t.style.minHeight=0,t.style.height=e+i+"px",t.style.overflow="hidden",o<t.scrollHeight){for(;t.offsetHeight>=t.scrollHeight;)t.style.height=(e-=i)+"px";for(;t.offsetHeight<t.scrollHeight;)t.style.height=e+++"px";return t.style.height=s,t.style.overflow=h,t.style.minHeight=n,e}},this.getNumberOfLines=()=>{const t=this.textareaRef,i=window.getComputedStyle?window.getComputedStyle(t):t.style,s=parseInt(i.lineHeight,10),e=this.calculateContentHeight(t,s);return Math.floor(e/s)},this.value="",this.placeholder=void 0,this.disabled=!1,this.maxlength=140,this.autoFocus=!1,this.autoHeight=!1,this.name=void 0,this.nativeProps={},this.line=1,this.compositionValue=void 0}watchAutoFocus(t,i){var s;!i&&t&&(null===(s=this.textareaRef)||void 0===s||s.focus())}watchValue(t){if(this.isComposing)return;const i=o(t);if(this.textareaRef.value!==i){const t="undefined"!=typeof document&&document.activeElement===this.textareaRef?this.lastSelectionRange||this.getSelectionSnapshot(this.textareaRef):null;this.textareaRef.value=i,t&&this.restoreSelection(this.textareaRef,t)}}async focus(){this.textareaRef.focus()}componentDidLoad(){var t,i;null===(t=this.textareaRef)||void 0===t||t.addEventListener("compositionstart",this.handleComposition),null===(i=this.textareaRef)||void 0===i||i.addEventListener("compositionend",this.handleComposition)}disconnectedCallback(){var t,i;null===(t=this.textareaRef)||void 0===t||t.removeEventListener("compositionstart",this.handleComposition),null===(i=this.textareaRef)||void 0===i||i.removeEventListener("compositionend",this.handleComposition)}getSelectionSnapshot(t){if(!t)return null;const{selectionStart:i,selectionEnd:s}=t;return null===i||null===s?null:(this.lastSelectionRange={selectionStart:i,selectionEnd:s},{selectionStart:i,selectionEnd:s})}getCursorFromTarget(t,i){var s;if(!t)return i;const{selectionEnd:e}=t;if("number"==typeof e){const i=null!==(s=t.selectionStart)&&void 0!==s?s:e;return this.lastSelectionRange={selectionStart:i,selectionEnd:e},e}return i}restoreSelection(t,i){if(!t)return;const s=i||this.lastSelectionRange||null;if(!s)return;const e=t.value.length,o=Math.min(s.selectionStart,e),h=Math.min(s.selectionEnd,e);"function"==typeof t.setSelectionRange&&t.setSelectionRange(o,h)}render(){const{value:t,placeholder:i,disabled:e,maxlength:h,autoFocus:n,autoHeight:a,name:r,nativeProps:l,handleInput:u,handleFocus:c,handleBlur:d,handleChange:v,compositionValue:p}=this,f={};return a&&(f.rows=this.line),s("textarea",Object.assign({ref:t=>{t&&(this.textareaRef=t,n&&t&&t.focus())},class:"taro-textarea "+(a?"auto-height":""),value:void 0!==p?p:o(t),placeholder:i,name:r,disabled:e,maxLength:h,autoFocus:n,onInput:u,onFocus:c,onBlur:d,onChange:v,onKeyDown:this.handleKeyDown},l,f))}get el(){return e(this)}static get watchers(){return{autoFocus:["watchAutoFocus"],value:["watchValue"]}}};h.style="taro-textarea-core{width:300px;display:block}taro-textarea-core .auto-height{height:auto}.taro-textarea{width:100%;height:inherit;appearance:none;cursor:auto;border:0;line-height:1.5;display:block;position:relative}.taro-textarea:focus{outline:none}";export{h as T}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export{I as taro_input_core}from"./p-fa9a3a11.js";import"./p-f72fcd8c.js";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export{T as taro_textarea_core}from"./p-15c2bd13.js";import"./p-f72fcd8c.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as t,c as i,h as s,g as
|
|
1
|
+
import{r as t,c as i,h as s,g as e}from"./p-f72fcd8c.js";function h(t,i,s){if("search"===i&&(t="search"),s&&(t="password"),void 0===t)return"text";if(!t)throw new Error("unexpected type");return"digit"===t&&(t="number"),t}function n(t){return null!=t?t:""}const o=class{constructor(s){t(this,s),this.onInput=i(this,"input",7),this.onPaste=i(this,"paste",7),this.onFocus=i(this,"focus",7),this.onBlur=i(this,"blur",7),this.onConfirm=i(this,"confirm",7),this.onChange=i(this,"change",7),this.onKeyDown=i(this,"keydown",7),this.isOnComposition=!1,this.isOnPaste=!1,this.onInputExcuted=!1,this.handleInput=t=>{t.stopPropagation();const{type:i,maxlength:s,confirmType:e,password:n}=this;if(!this.isOnComposition&&!this.onInputExcuted){let o=t.target.value;const a=h(i,e,n);this.onInputExcuted=!0,"number"===a&&o&&s>-1&&s<=o.length&&(o=o.substring(0,s),t.target.value=o),this.value=o,this.onInput.emit({value:o,cursor:o.length}),this.onInputExcuted=!1}},this.handlePaste=t=>{t.stopPropagation(),this.isOnPaste=!0,this.onPaste.emit({value:t.target.value})},this.handleFocus=t=>{t.stopPropagation(),this.onInputExcuted=!1,this.onFocus.emit({value:t.target.value})},this.handleBlur=t=>{t.stopPropagation(),this.onBlur.emit({value:t.target.value})},this.handleChange=t=>{t.stopPropagation(),this.onChange.emit({value:t.target.value}),this.isOnPaste&&(this.isOnPaste=!1,this.value=t.target.value,this.onInput.emit({value:t.target.value,cursor:t.target.value.length}))},this.handleKeyDown=t=>{t.stopPropagation();const{value:i}=t.target,s=t.keyCode||t.code;this.onInputExcuted=!1,this.onKeyDown.emit({value:i,cursor:i.length,keyCode:s}),13===s&&this.onConfirm.emit({value:i})},this.handleComposition=t=>{t.stopPropagation(),t.target instanceof HTMLInputElement&&("compositionend"===t.type?(this.isOnComposition=!1,this.value=t.target.value,this.onInput.emit({value:t.target.value,cursor:t.target.value.length})):this.isOnComposition=!0)},this.handleBeforeInput=t=>{if(!t.data)return;const i=t.data&&/[0-9]/.test(t.data);"number"!==this.type||i||t.preventDefault(),"digit"!==this.type||i||("."!==t.data||"."===t.data&&t.target.value.indexOf(".")>-1)&&t.preventDefault()},this.value="",this.type=void 0,this.password=!1,this.placeholder=void 0,this.disabled=!1,this.maxlength=140,this.autoFocus=!1,this.confirmType="done",this.name=void 0,this.readonly=!1,this.nativeProps={}}async focus(){this.inputRef.focus()}watchAutoFocus(t,i){var s;!i&&t&&(null===(s=this.inputRef)||void 0===s||s.focus())}watchValue(t){const i=n(t);this.inputRef.value!==i&&(this.inputRef.value=i)}componentDidLoad(){var t,i,s,e,h;"file"===this.type?(this.fileListener=()=>{this.onInput.emit()},null===(t=this.inputRef)||void 0===t||t.addEventListener("change",this.fileListener)):(null===(i=this.inputRef)||void 0===i||i.addEventListener("compositionstart",this.handleComposition),null===(s=this.inputRef)||void 0===s||s.addEventListener("compositionend",this.handleComposition),null===(e=this.inputRef)||void 0===e||e.addEventListener("beforeinput",this.handleBeforeInput),null===(h=this.inputRef)||void 0===h||h.addEventListener("textInput",this.handleBeforeInput))}disconnectedCallback(){var t,i,s,e,h;"file"===this.type?null===(t=this.inputRef)||void 0===t||t.removeEventListener("change",this.fileListener):(null===(i=this.inputRef)||void 0===i||i.removeEventListener("compositionstart",this.handleComposition),null===(s=this.inputRef)||void 0===s||s.removeEventListener("compositionend",this.handleComposition),null===(e=this.inputRef)||void 0===e||e.removeEventListener("beforeinput",this.handleBeforeInput),null===(h=this.inputRef)||void 0===h||h.removeEventListener("textInput",this.handleBeforeInput))}render(){const{value:t,type:i,password:e,placeholder:o,autoFocus:a,disabled:u,maxlength:r,confirmType:c,name:l,readonly:p,nativeProps:d}=this;return s("input",Object.assign({ref:t=>{this.inputRef=t,a&&t&&t.focus()},class:"weui-input",type:h(i,c,e),placeholder:o,autoFocus:a,disabled:u,maxlength:r,name:l,readonly:p?"readonly":void 0,onInput:this.handleInput,onFocus:this.handleFocus,onBlur:this.handleBlur,onChange:this.handleChange,onKeyDown:this.handleKeyDown,onPaste:this.handlePaste,onCompositionStart:this.handleComposition,onCompositionEnd:this.handleComposition},d,{value:n(t)}))}get el(){return e(this)}static get watchers(){return{autoFocus:["watchAutoFocus"],value:["watchValue"]}}};o.style=".weui-input{-webkit-appearance:none;width:100%;font-size:inherit;color:inherit;background-color:transparent;border:0;outline:0;height:1.47059em;line-height:1.47059}.weui-input::-webkit-outer-spin-button,.weui-input::-webkit-inner-spin-button{-webkit-appearance:none;margin:0}taro-input-core{display:block}taro-input-core input[type=search]::-webkit-search-cancel-button{-webkit-appearance:none;display:none}";export{o as I}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{p as e,b as o}from"./p-f72fcd8c.js";export{s as setNonce}from"./p-f72fcd8c.js";(()=>{const o=import.meta.url,a={};return""!==o&&(a.resourcesUrl=new URL(".",o).href),e(a)})().then((e=>o(JSON.parse('[["p-aca7aea1",[[4,"taro-checkbox-core",{"name":[1],"value":[1032],"color":[1],"id":[1025],"checked":[4],"disabled":[4],"nativeProps":[16],"isWillLoadCalled":[32]}],[0,"taro-checkbox-group-core",{"name":[8]},[[0,"checkboxchange","function"]]]]],["p-14795db7",[[0,"taro-movable-area-core",{"scaleArea":[4,"scale-area"]}],[0,"taro-movable-view-core",{"x":[8],"y":[8],"direction":[1],"outOfBounds":[4,"out-of-bounds"],"inertia":[4],"friction":[2],"damping":[2],"disabled":[4],"scale":[4],"scaleMin":[2,"scale-min"],"scaleMax":[2,"scale-max"],"scaleValue":[2,"scale-value"],"animation":[4],"setParent":[64],"endScale":[64],"setScale":[64]}]]],["p-127391cb",[[0,"taro-picker-view-column-core",{"col":[1],"initialPosition":[1,"initial-position"],"paddingVertical":[2,"padding-vertical"],"isInit":[32]},[[1,"touchstart","onTouchStart"],[1,"touchend","onTouchEnd"]]],[4,"taro-picker-view-core",{"indicatorStyle":[1,"indicator-style"],"indicatorClass":[1,"indicator-class"],"value":[16],"maskStyle":[1,"mask-style"],"maskClass":[1,"mask-class"]},[[0,"onselect","onSelect"],[0,"onselectstart","onSelectStart"],[0,"onselectend","onPickerColEnd"]]]]],["p-df86c576",[[4,"taro-radio-core",{"name":[1],"value":[1],"id":[1025],"checked":[1540],"disabled":[4],"nativeProps":[16],"isWillLoadCalled":[32]}],[0,"taro-radio-group-core",{"name":[8]},[[0,"radiochange","function"]]]]],["p-b70027b2",[[4,"taro-swiper-core",{"indicatorDots":[4,"indicator-dots"],"indicatorColor":[1,"indicator-color"],"indicatorActiveColor":[1,"indicator-active-color"],"autoplay":[4],"current":[2],"currentItemId":[1,"current-item-id"],"interval":[2],"duration":[2],"circular":[4],"vertical":[4],"previousMargin":[1,"previous-margin"],"nextMargin":[1,"next-margin"],"displayMultipleItems":[2,"display-multiple-items"],"full":[4],"zoom":[4],"effectsProps":[16],"swiperWrapper":[32],"swiper":[32],"isWillLoadCalled":[32],"observer":[32]}],[4,"taro-swiper-item-core",{"itemId":[1,"item-id"]}]]],["p-7c455a65",[[0,"taro-ad-core"]]],["p-38598f5b",[[0,"taro-ad-custom-core"]]],["p-0f829f27",[[0,"taro-animation-video-core"]]],["p-92a39ad9",[[0,"taro-animation-view-core"]]],["p-b19ea38d",[[0,"taro-ar-camera-core"]]],["p-6223811d",[[0,"taro-audio-core",{"src":[1],"controls":[4],"autoplay":[4],"loop":[4],"muted":[4],"nativeProps":[16]}]]],["p-922047dd",[[0,"taro-aweme-data-core"]]],["p-4f4b08df",[[0,"taro-block-core"]]],["p-71384476",[[4,"taro-button-core",{"disabled":[516],"hoverClass":[1,"hover-class"],"type":[1],"hoverStartTime":[2,"hover-start-time"],"hoverStayTime":[2,"hover-stay-time"],"size":[1],"plain":[4],"loading":[4],"formType":[513,"form-type"],"hover":[32],"touch":[32]},[[0,"click","onClick"],[1,"touchstart","onTouchStart"],[1,"touchend","onTouchEnd"]]]]],["p-773bed49",[[0,"taro-camera-core"]]],["p-1ad94bf6",[[0,"taro-canvas-core",{"canvasId":[1,"id"],"height":[1537],"width":[1537],"nativeProps":[16]}]]],["p-e0de8e35",[[0,"taro-channel-live-core"]]],["p-094ba888",[[0,"taro-channel-video-core"]]],["p-c66f2363",[[0,"taro-comment-detail-core"]]],["p-a0ff43d9",[[0,"taro-comment-list-core"]]],["p-74ac6c91",[[0,"taro-contact-button-core"]]],["p-5ea030de",[[0,"taro-cover-image-core",{"src":[1],"nativeProps":[16]}]]],["p-80fa0c7c",[[4,"taro-cover-view-core",{"animation":[1],"hoverClass":[1,"hover-class"],"hoverStartTime":[2,"hover-start-time"],"hoverStayTime":[2,"hover-stay-time"],"hover":[32],"touch":[32]},[[1,"touchstart","onTouchStart"],[1,"touchmove","onTouchMove"],[1,"touchend","onTouchEnd"]]]]],["p-eac9f475",[[0,"taro-custom-wrapper-core"]]],["p-806e3c4f",[[0,"taro-double-tap-gesture-handler-core"]]],["p-65c51f07",[[0,"taro-draggable-sheet-core"]]],["p-03b54b0b",[[0,"taro-editor-core"]]],["p-3f650751",[[0,"taro-follow-swan-core"]]],["p-145ba514",[[0,"taro-force-press-gesture-handler-core"]]],["p-69147844",[[4,"taro-form-core",null,[[0,"tarobuttonsubmit","onButtonSubmit"],[0,"tarobuttonreset","onButtonReset"]]]]],["p-0741aa7f",[[0,"taro-functional-page-navigator-core"]]],["p-f57bed55",[[0,"taro-grid-builder-core"]]],["p-61b23b53",[[0,"taro-grid-view-core"]]],["p-c5c71b89",[[0,"taro-horizontal-drag-gesture-handler-core"]]],["p-d45a75d9",[[0,"taro-icon-core",{"type":[1],"size":[8],"color":[1]}]]],["p-cb7e1d6e",[[0,"taro-image-core",{"src":[1],"mode":[1],"lazyLoad":[4,"lazy-load"],"nativeProps":[16],"aspectFillMode":[32],"didLoad":[32]}]]],["p-0a92117d",[[0,"taro-inline-payment-panel-core"]]],["p-9a0251c5",[[0,"taro-input-core",{"value":[1025],"type":[1],"password":[4],"placeholder":[1],"disabled":[4],"maxlength":[2],"autoFocus":[4,"focus"],"confirmType":[1,"confirm-type"],"name":[1],"readonly":[4],"nativeProps":[16],"focus":[64]}]]],["p-168a6355",[[0,"taro-keyboard-accessory-core"]]],["p-2602cd28",[[4,"taro-label-core",{"for":[1]}]]],["p-1d2b2125",[[0,"taro-lifestyle-core"]]],["p-e87d4a75",[[0,"taro-like-core"]]],["p-e6565988",[[0,"taro-list-builder-core"]]],["p-ae203a0b",[[0,"taro-list-view-core"]]],["p-975f1b0c",[[0,"taro-live-player-core"]]],["p-3f4449b0",[[0,"taro-live-pusher-core"]]],["p-8837c166",[[0,"taro-login-core"]]],["p-eee2d2f9",[[0,"taro-long-press-gesture-handler-core"]]],["p-2ff21d39",[[0,"taro-lottie-core"]]],["p-5bd11f73",[[0,"taro-map-core",{"latitude":[2],"longitude":[2],"scale":[2],"minScale":[2,"min-scale"],"maxScale":[2,"max-scale"],"markers":[16],"polyline":[16],"circles":[16],"polygons":[16],"subkey":[1],"layerStyle":[2,"layer-style"],"rotate":[2],"skew":[2],"showCompass":[4,"show-compass"],"showScale":[4,"show-scale"],"enableOverlooking":[4,"enable-overlooking"],"enableZoom":[4,"enable-zoom"],"enableScroll":[4,"enable-scroll"],"enableRotate":[4,"enable-rotate"],"enableSatellite":[4,"enable-satellite"],"enableTraffic":[4,"enable-traffic"],"enableBuilding":[4,"enable-building"],"enableAutoMaxOverlooking":[4,"enable-auto-max-overlooking"],"enable3D":[4,"enable-3-d"],"width":[1],"height":[1]}]]],["p-9581e63b",[[0,"taro-match-media-core"]]],["p-b89414d7",[[0,"taro-native-slot-core"]]],["p-5b216b21",[[0,"taro-navigation-bar-core"]]],["p-ab09cecf",[[0,"taro-navigator-core",{"hoverClass":[1,"hover-class"],"url":[1],"openType":[1,"open-type"],"isHover":[4,"is-hover"],"delta":[2]},[[0,"click","onClick"]]]]],["p-ad865966",[[0,"taro-nested-scroll-body-core"]]],["p-e6643dc0",[[0,"taro-nested-scroll-header-core"]]],["p-fe1c20a9",[[0,"taro-official-account-core"]]],["p-edab4852",[[0,"taro-open-container-core"]]],["p-bcceaa84",[[0,"taro-open-data-core"]]],["p-582a0e0f",[[0,"taro-page-container-core"]]],["p-c09eb36f",[[0,"taro-page-meta-core"]]],["p-496a9932",[[0,"taro-pan-gesture-handler-core"]]],["p-f52b25aa",[[0,"taro-progress-core",{"percent":[2],"showInfo":[4,"show-info"],"borderRadius":[8,"border-radius"],"fontSize":[8,"font-size"],"strokeWidth":[8,"stroke-width"],"activeColor":[1,"active-color"],"backgroundColor":[1,"background-color"],"active":[4]}]]],["p-931bba41",[[4,"taro-pull-to-refresh-core",{"prefixCls":[1,"prefix-cls"],"distanceToRefresh":[2,"distance-to-refresh"],"damping":[2],"indicator":[16],"currSt":[32],"dragOnEdge":[32]}]]],["p-9f953e69",[[0,"taro-rich-text-core",{"nodes":[1],"selectable":[1028],"userSelect":[1028,"user-select"],"space":[1]}]]],["p-e298a2c3",[[0,"taro-root-portal-core"]]],["p-cdeebf36",[[0,"taro-rtc-room-core"]]],["p-8f2a4c66",[[0,"taro-rtc-room-item-core"]]],["p-c3d39813",[[0,"taro-scale-gesture-handler-core"]]],["p-2c48f6cb",[[0,"taro-script-core"]]],["p-00e72620",[[4,"taro-scroll-view-core",{"scrollX":[4,"scroll-x"],"scrollY":[4,"scroll-y"],"upperThreshold":[8,"upper-threshold"],"lowerThreshold":[8,"lower-threshold"],"mpScrollTop":[520,"scroll-top"],"mpScrollLeft":[520,"scroll-left"],"mpScrollIntoView":[513,"scroll-into-view"],"mpScrollIntoViewAlignment":[1,"scroll-into-view-alignment"],"animated":[4,"scroll-with-animation"],"enhanced":[4],"showScrollbar":[4,"show-scrollbar"],"mpScrollToMethod":[64],"mpScrollIntoViewMethod":[64]},[[1,"scroll","handleScroll"],[1,"touchmove","handleTouchMove"]]]]],["p-a3b266d5",[[0,"taro-share-element-core"]]],["p-d6be1ceb",[[0,"taro-slider-core",{"min":[2],"max":[2],"step":[2],"disabled":[4],"value":[1538],"activeColor":[1,"active-color"],"backgroundColor":[1,"background-color"],"blockSize":[2,"block-size"],"blockColor":[1,"block-color"],"showValue":[4,"show-value"],"name":[1],"totalWidth":[32],"touching":[32],"ogX":[32],"touchId":[32],"percent":[32],"ogPercent":[32],"isWillLoadCalled":[32]}]]],["p-fa398c76",[[0,"taro-slot-core"]]],["p-8c520f1e",[[0,"taro-snapshot-core"]]],["p-06b4ba14",[[0,"taro-span-core"]]],["p-3837f853",[[0,"taro-sticky-header-core"]]],["p-ea5d6d41",[[0,"taro-sticky-section-core"]]],["p-5cbc249f",[[0,"taro-switch-core",{"type":[1],"checked":[1028],"color":[1],"name":[1],"disabled":[4],"nativeProps":[16],"isWillLoadCalled":[32]}]]],["p-31f2f332",[[0,"taro-tab-item-core"]]],["p-2b8fae1c",[[0,"taro-tabbar",{"conf":[16],"list":[32],"borderStyle":[32],"backgroundColor":[32],"color":[32],"selectedColor":[32],"selectedIndex":[32],"status":[32]}]]],["p-c84153ae",[[0,"taro-tabs-core"]]],["p-8bc13e66",[[0,"taro-tap-gesture-handler-core"]]],["p-73aae58b",[[4,"taro-text-core",{"selectable":[1028],"userSelect":[1028,"user-select"],"space":[1025],"numberOfLines":[2,"number-of-lines"]}]]],["p-66554c2d",[[0,"taro-textarea-core",{"value":[1025],"placeholder":[1],"disabled":[4],"maxlength":[2],"autoFocus":[4,"focus"],"autoHeight":[4,"auto-height"],"name":[1],"nativeProps":[16],"line":[32],"compositionValue":[32],"focus":[64]}]]],["p-0ecccbb4",[[0,"taro-vertical-drag-gesture-handler-core"]]],["p-88048df9",[[4,"taro-view-core",{"animation":[1],"hoverClass":[1,"hover-class"],"hoverStartTime":[2,"hover-start-time"],"hoverStayTime":[2,"hover-stay-time"],"hover":[32],"touch":[32]},[[1,"touchstart","onTouchStart"],[1,"touchmove","onTouchMove"],[1,"touchend","onTouchEnd"]]]]],["p-ffcacf9a",[[0,"taro-voip-room-core"]]],["p-5570a53e",[[0,"taro-web-view-core",{"src":[1]}]]],["p-b90499e4",[[4,"taro-picker-core",{"mode":[1],"disabled":[4],"range":[16],"rangeKey":[1,"range-key"],"value":[1032],"start":[1],"end":[1],"fields":[1],"name":[1],"textProps":[16],"pickerValue":[32],"height":[32],"hidden":[32],"fadeOut":[32],"isWillLoadCalled":[32]}],[0,"taro-picker-group",{"mode":[1],"range":[16],"rangeKey":[1,"range-key"],"height":[2],"columnId":[1,"column-id"],"updateHeight":[16],"updateDay":[16],"startY":[32],"preY":[32],"hadMove":[32],"touchEnd":[32],"isMove":[32],"handleMoveStart":[64],"handleMoving":[64],"handleMoveEnd":[64]},[[1,"mousedown","onMouseDown"],[3,"mousemove","onMouseMove"],[1,"mouseup","onMouseMoveEnd"],[1,"mouseleave","onMouseMoveEnd"],[1,"touchstart","onTouchStart"],[3,"touchmove","onTouchMove"],[1,"touchend","onTouchEnd"]]]]],["p-905410a9",[[0,"taro-video-core",{"src":[1],"duration":[2],"controls":[4],"autoplay":[4],"loop":[4],"muted":[4],"initialTime":[2,"initial-time"],"poster":[1],"objectFit":[1,"object-fit"],"showProgress":[4,"show-progress"],"showFullscreenBtn":[4,"show-fullscreen-btn"],"showPlayBtn":[4,"show-play-btn"],"showCenterPlayBtn":[4,"show-center-play-btn"],"showMuteBtn":[4,"show-mute-btn"],"danmuList":[16],"danmuBtn":[4,"danmu-btn"],"enableDanmu":[4,"enable-danmu"],"enablePlayGesture":[4,"enable-play-gesture"],"enableProgressGesture":[4,"enable-progress-gesture"],"vslideGesture":[4,"vslide-gesture"],"vslideGestureInFullscreen":[4,"vslide-gesture-in-fullscreen"],"nativeProps":[16],"_duration":[32],"_enableDanmu":[32],"isPlaying":[32],"isFirst":[32],"isFullScreen":[32],"fullScreenTimestamp":[32],"isMute":[32],"getHlsObject":[64],"play":[64],"pause":[64],"stop":[64],"seek":[64],"requestFullScreen":[64],"exitFullScreen":[64]},[[5,"touchmove","onDocumentTouchMove"],[5,"touchend","onDocumentTouchEnd"],[5,"touchcancel","onDocumentTouchEnd"]]],[4,"taro-video-control",{"controls":[4],"currentTime":[2,"current-time"],"duration":[2],"isPlaying":[4,"is-playing"],"pauseFunc":[16],"playFunc":[16],"seekFunc":[16],"showPlayBtn":[4,"show-play-btn"],"showProgress":[4,"show-progress"],"setProgressBall":[64],"toggleVisibility":[64],"getIsDraggingProgressBall":[64],"setCurrentTime":[64]},[[5,"touchmove","onDocumentTouchMove"],[5,"touchend","onDocumentTouchEnd"],[5,"touchcancel","onDocumentTouchEnd"]]],[0,"taro-video-danmu",{"enable":[4],"danmuList":[32],"sendDanmu":[64],"tick":[64]}]]]]'),e)));
|
|
1
|
+
import{p as e,b as o}from"./p-f72fcd8c.js";export{s as setNonce}from"./p-f72fcd8c.js";(()=>{const o=import.meta.url,a={};return""!==o&&(a.resourcesUrl=new URL(".",o).href),e(a)})().then((e=>o(JSON.parse('[["p-aca7aea1",[[4,"taro-checkbox-core",{"name":[1],"value":[1032],"color":[1],"id":[1025],"checked":[4],"disabled":[4],"nativeProps":[16],"isWillLoadCalled":[32]}],[0,"taro-checkbox-group-core",{"name":[8]},[[0,"checkboxchange","function"]]]]],["p-14795db7",[[0,"taro-movable-area-core",{"scaleArea":[4,"scale-area"]}],[0,"taro-movable-view-core",{"x":[8],"y":[8],"direction":[1],"outOfBounds":[4,"out-of-bounds"],"inertia":[4],"friction":[2],"damping":[2],"disabled":[4],"scale":[4],"scaleMin":[2,"scale-min"],"scaleMax":[2,"scale-max"],"scaleValue":[2,"scale-value"],"animation":[4],"setParent":[64],"endScale":[64],"setScale":[64]}]]],["p-127391cb",[[0,"taro-picker-view-column-core",{"col":[1],"initialPosition":[1,"initial-position"],"paddingVertical":[2,"padding-vertical"],"isInit":[32]},[[1,"touchstart","onTouchStart"],[1,"touchend","onTouchEnd"]]],[4,"taro-picker-view-core",{"indicatorStyle":[1,"indicator-style"],"indicatorClass":[1,"indicator-class"],"value":[16],"maskStyle":[1,"mask-style"],"maskClass":[1,"mask-class"]},[[0,"onselect","onSelect"],[0,"onselectstart","onSelectStart"],[0,"onselectend","onPickerColEnd"]]]]],["p-df86c576",[[4,"taro-radio-core",{"name":[1],"value":[1],"id":[1025],"checked":[1540],"disabled":[4],"nativeProps":[16],"isWillLoadCalled":[32]}],[0,"taro-radio-group-core",{"name":[8]},[[0,"radiochange","function"]]]]],["p-b70027b2",[[4,"taro-swiper-core",{"indicatorDots":[4,"indicator-dots"],"indicatorColor":[1,"indicator-color"],"indicatorActiveColor":[1,"indicator-active-color"],"autoplay":[4],"current":[2],"currentItemId":[1,"current-item-id"],"interval":[2],"duration":[2],"circular":[4],"vertical":[4],"previousMargin":[1,"previous-margin"],"nextMargin":[1,"next-margin"],"displayMultipleItems":[2,"display-multiple-items"],"full":[4],"zoom":[4],"effectsProps":[16],"swiperWrapper":[32],"swiper":[32],"isWillLoadCalled":[32],"observer":[32]}],[4,"taro-swiper-item-core",{"itemId":[1,"item-id"]}]]],["p-7c455a65",[[0,"taro-ad-core"]]],["p-38598f5b",[[0,"taro-ad-custom-core"]]],["p-0f829f27",[[0,"taro-animation-video-core"]]],["p-92a39ad9",[[0,"taro-animation-view-core"]]],["p-b19ea38d",[[0,"taro-ar-camera-core"]]],["p-6223811d",[[0,"taro-audio-core",{"src":[1],"controls":[4],"autoplay":[4],"loop":[4],"muted":[4],"nativeProps":[16]}]]],["p-922047dd",[[0,"taro-aweme-data-core"]]],["p-4f4b08df",[[0,"taro-block-core"]]],["p-71384476",[[4,"taro-button-core",{"disabled":[516],"hoverClass":[1,"hover-class"],"type":[1],"hoverStartTime":[2,"hover-start-time"],"hoverStayTime":[2,"hover-stay-time"],"size":[1],"plain":[4],"loading":[4],"formType":[513,"form-type"],"hover":[32],"touch":[32]},[[0,"click","onClick"],[1,"touchstart","onTouchStart"],[1,"touchend","onTouchEnd"]]]]],["p-773bed49",[[0,"taro-camera-core"]]],["p-1ad94bf6",[[0,"taro-canvas-core",{"canvasId":[1,"id"],"height":[1537],"width":[1537],"nativeProps":[16]}]]],["p-e0de8e35",[[0,"taro-channel-live-core"]]],["p-094ba888",[[0,"taro-channel-video-core"]]],["p-c66f2363",[[0,"taro-comment-detail-core"]]],["p-a0ff43d9",[[0,"taro-comment-list-core"]]],["p-74ac6c91",[[0,"taro-contact-button-core"]]],["p-5ea030de",[[0,"taro-cover-image-core",{"src":[1],"nativeProps":[16]}]]],["p-80fa0c7c",[[4,"taro-cover-view-core",{"animation":[1],"hoverClass":[1,"hover-class"],"hoverStartTime":[2,"hover-start-time"],"hoverStayTime":[2,"hover-stay-time"],"hover":[32],"touch":[32]},[[1,"touchstart","onTouchStart"],[1,"touchmove","onTouchMove"],[1,"touchend","onTouchEnd"]]]]],["p-eac9f475",[[0,"taro-custom-wrapper-core"]]],["p-806e3c4f",[[0,"taro-double-tap-gesture-handler-core"]]],["p-65c51f07",[[0,"taro-draggable-sheet-core"]]],["p-03b54b0b",[[0,"taro-editor-core"]]],["p-3f650751",[[0,"taro-follow-swan-core"]]],["p-145ba514",[[0,"taro-force-press-gesture-handler-core"]]],["p-69147844",[[4,"taro-form-core",null,[[0,"tarobuttonsubmit","onButtonSubmit"],[0,"tarobuttonreset","onButtonReset"]]]]],["p-0741aa7f",[[0,"taro-functional-page-navigator-core"]]],["p-f57bed55",[[0,"taro-grid-builder-core"]]],["p-61b23b53",[[0,"taro-grid-view-core"]]],["p-c5c71b89",[[0,"taro-horizontal-drag-gesture-handler-core"]]],["p-d45a75d9",[[0,"taro-icon-core",{"type":[1],"size":[8],"color":[1]}]]],["p-cb7e1d6e",[[0,"taro-image-core",{"src":[1],"mode":[1],"lazyLoad":[4,"lazy-load"],"nativeProps":[16],"aspectFillMode":[32],"didLoad":[32]}]]],["p-0a92117d",[[0,"taro-inline-payment-panel-core"]]],["p-256ab08a",[[0,"taro-input-core",{"value":[1025],"type":[1],"password":[4],"placeholder":[1],"disabled":[4],"maxlength":[2],"autoFocus":[4,"focus"],"confirmType":[1,"confirm-type"],"name":[1],"readonly":[4],"nativeProps":[16],"focus":[64]}]]],["p-168a6355",[[0,"taro-keyboard-accessory-core"]]],["p-2602cd28",[[4,"taro-label-core",{"for":[1]}]]],["p-1d2b2125",[[0,"taro-lifestyle-core"]]],["p-e87d4a75",[[0,"taro-like-core"]]],["p-e6565988",[[0,"taro-list-builder-core"]]],["p-ae203a0b",[[0,"taro-list-view-core"]]],["p-975f1b0c",[[0,"taro-live-player-core"]]],["p-3f4449b0",[[0,"taro-live-pusher-core"]]],["p-8837c166",[[0,"taro-login-core"]]],["p-eee2d2f9",[[0,"taro-long-press-gesture-handler-core"]]],["p-2ff21d39",[[0,"taro-lottie-core"]]],["p-5bd11f73",[[0,"taro-map-core",{"latitude":[2],"longitude":[2],"scale":[2],"minScale":[2,"min-scale"],"maxScale":[2,"max-scale"],"markers":[16],"polyline":[16],"circles":[16],"polygons":[16],"subkey":[1],"layerStyle":[2,"layer-style"],"rotate":[2],"skew":[2],"showCompass":[4,"show-compass"],"showScale":[4,"show-scale"],"enableOverlooking":[4,"enable-overlooking"],"enableZoom":[4,"enable-zoom"],"enableScroll":[4,"enable-scroll"],"enableRotate":[4,"enable-rotate"],"enableSatellite":[4,"enable-satellite"],"enableTraffic":[4,"enable-traffic"],"enableBuilding":[4,"enable-building"],"enableAutoMaxOverlooking":[4,"enable-auto-max-overlooking"],"enable3D":[4,"enable-3-d"],"width":[1],"height":[1]}]]],["p-9581e63b",[[0,"taro-match-media-core"]]],["p-b89414d7",[[0,"taro-native-slot-core"]]],["p-5b216b21",[[0,"taro-navigation-bar-core"]]],["p-ab09cecf",[[0,"taro-navigator-core",{"hoverClass":[1,"hover-class"],"url":[1],"openType":[1,"open-type"],"isHover":[4,"is-hover"],"delta":[2]},[[0,"click","onClick"]]]]],["p-ad865966",[[0,"taro-nested-scroll-body-core"]]],["p-e6643dc0",[[0,"taro-nested-scroll-header-core"]]],["p-fe1c20a9",[[0,"taro-official-account-core"]]],["p-edab4852",[[0,"taro-open-container-core"]]],["p-bcceaa84",[[0,"taro-open-data-core"]]],["p-582a0e0f",[[0,"taro-page-container-core"]]],["p-c09eb36f",[[0,"taro-page-meta-core"]]],["p-496a9932",[[0,"taro-pan-gesture-handler-core"]]],["p-f52b25aa",[[0,"taro-progress-core",{"percent":[2],"showInfo":[4,"show-info"],"borderRadius":[8,"border-radius"],"fontSize":[8,"font-size"],"strokeWidth":[8,"stroke-width"],"activeColor":[1,"active-color"],"backgroundColor":[1,"background-color"],"active":[4]}]]],["p-931bba41",[[4,"taro-pull-to-refresh-core",{"prefixCls":[1,"prefix-cls"],"distanceToRefresh":[2,"distance-to-refresh"],"damping":[2],"indicator":[16],"currSt":[32],"dragOnEdge":[32]}]]],["p-9f953e69",[[0,"taro-rich-text-core",{"nodes":[1],"selectable":[1028],"userSelect":[1028,"user-select"],"space":[1]}]]],["p-e298a2c3",[[0,"taro-root-portal-core"]]],["p-cdeebf36",[[0,"taro-rtc-room-core"]]],["p-8f2a4c66",[[0,"taro-rtc-room-item-core"]]],["p-c3d39813",[[0,"taro-scale-gesture-handler-core"]]],["p-2c48f6cb",[[0,"taro-script-core"]]],["p-00e72620",[[4,"taro-scroll-view-core",{"scrollX":[4,"scroll-x"],"scrollY":[4,"scroll-y"],"upperThreshold":[8,"upper-threshold"],"lowerThreshold":[8,"lower-threshold"],"mpScrollTop":[520,"scroll-top"],"mpScrollLeft":[520,"scroll-left"],"mpScrollIntoView":[513,"scroll-into-view"],"mpScrollIntoViewAlignment":[1,"scroll-into-view-alignment"],"animated":[4,"scroll-with-animation"],"enhanced":[4],"showScrollbar":[4,"show-scrollbar"],"mpScrollToMethod":[64],"mpScrollIntoViewMethod":[64]},[[1,"scroll","handleScroll"],[1,"touchmove","handleTouchMove"]]]]],["p-a3b266d5",[[0,"taro-share-element-core"]]],["p-d6be1ceb",[[0,"taro-slider-core",{"min":[2],"max":[2],"step":[2],"disabled":[4],"value":[1538],"activeColor":[1,"active-color"],"backgroundColor":[1,"background-color"],"blockSize":[2,"block-size"],"blockColor":[1,"block-color"],"showValue":[4,"show-value"],"name":[1],"totalWidth":[32],"touching":[32],"ogX":[32],"touchId":[32],"percent":[32],"ogPercent":[32],"isWillLoadCalled":[32]}]]],["p-fa398c76",[[0,"taro-slot-core"]]],["p-8c520f1e",[[0,"taro-snapshot-core"]]],["p-06b4ba14",[[0,"taro-span-core"]]],["p-3837f853",[[0,"taro-sticky-header-core"]]],["p-ea5d6d41",[[0,"taro-sticky-section-core"]]],["p-5cbc249f",[[0,"taro-switch-core",{"type":[1],"checked":[1028],"color":[1],"name":[1],"disabled":[4],"nativeProps":[16],"isWillLoadCalled":[32]}]]],["p-31f2f332",[[0,"taro-tab-item-core"]]],["p-2b8fae1c",[[0,"taro-tabbar",{"conf":[16],"list":[32],"borderStyle":[32],"backgroundColor":[32],"color":[32],"selectedColor":[32],"selectedIndex":[32],"status":[32]}]]],["p-c84153ae",[[0,"taro-tabs-core"]]],["p-8bc13e66",[[0,"taro-tap-gesture-handler-core"]]],["p-73aae58b",[[4,"taro-text-core",{"selectable":[1028],"userSelect":[1028,"user-select"],"space":[1025],"numberOfLines":[2,"number-of-lines"]}]]],["p-717960a7",[[0,"taro-textarea-core",{"value":[1025],"placeholder":[1],"disabled":[4],"maxlength":[2],"autoFocus":[4,"focus"],"autoHeight":[4,"auto-height"],"name":[1],"nativeProps":[16],"line":[32],"compositionValue":[32],"focus":[64]}]]],["p-0ecccbb4",[[0,"taro-vertical-drag-gesture-handler-core"]]],["p-88048df9",[[4,"taro-view-core",{"animation":[1],"hoverClass":[1,"hover-class"],"hoverStartTime":[2,"hover-start-time"],"hoverStayTime":[2,"hover-stay-time"],"hover":[32],"touch":[32]},[[1,"touchstart","onTouchStart"],[1,"touchmove","onTouchMove"],[1,"touchend","onTouchEnd"]]]]],["p-ffcacf9a",[[0,"taro-voip-room-core"]]],["p-5570a53e",[[0,"taro-web-view-core",{"src":[1]}]]],["p-b90499e4",[[4,"taro-picker-core",{"mode":[1],"disabled":[4],"range":[16],"rangeKey":[1,"range-key"],"value":[1032],"start":[1],"end":[1],"fields":[1],"name":[1],"textProps":[16],"pickerValue":[32],"height":[32],"hidden":[32],"fadeOut":[32],"isWillLoadCalled":[32]}],[0,"taro-picker-group",{"mode":[1],"range":[16],"rangeKey":[1,"range-key"],"height":[2],"columnId":[1,"column-id"],"updateHeight":[16],"updateDay":[16],"startY":[32],"preY":[32],"hadMove":[32],"touchEnd":[32],"isMove":[32],"handleMoveStart":[64],"handleMoving":[64],"handleMoveEnd":[64]},[[1,"mousedown","onMouseDown"],[3,"mousemove","onMouseMove"],[1,"mouseup","onMouseMoveEnd"],[1,"mouseleave","onMouseMoveEnd"],[1,"touchstart","onTouchStart"],[3,"touchmove","onTouchMove"],[1,"touchend","onTouchEnd"]]]]],["p-905410a9",[[0,"taro-video-core",{"src":[1],"duration":[2],"controls":[4],"autoplay":[4],"loop":[4],"muted":[4],"initialTime":[2,"initial-time"],"poster":[1],"objectFit":[1,"object-fit"],"showProgress":[4,"show-progress"],"showFullscreenBtn":[4,"show-fullscreen-btn"],"showPlayBtn":[4,"show-play-btn"],"showCenterPlayBtn":[4,"show-center-play-btn"],"showMuteBtn":[4,"show-mute-btn"],"danmuList":[16],"danmuBtn":[4,"danmu-btn"],"enableDanmu":[4,"enable-danmu"],"enablePlayGesture":[4,"enable-play-gesture"],"enableProgressGesture":[4,"enable-progress-gesture"],"vslideGesture":[4,"vslide-gesture"],"vslideGestureInFullscreen":[4,"vslide-gesture-in-fullscreen"],"nativeProps":[16],"_duration":[32],"_enableDanmu":[32],"isPlaying":[32],"isFirst":[32],"isFullScreen":[32],"fullScreenTimestamp":[32],"isMute":[32],"getHlsObject":[64],"play":[64],"pause":[64],"stop":[64],"seek":[64],"requestFullScreen":[64],"exitFullScreen":[64]},[[5,"touchmove","onDocumentTouchMove"],[5,"touchend","onDocumentTouchEnd"],[5,"touchcancel","onDocumentTouchEnd"]]],[4,"taro-video-control",{"controls":[4],"currentTime":[2,"current-time"],"duration":[2],"isPlaying":[4,"is-playing"],"pauseFunc":[16],"playFunc":[16],"seekFunc":[16],"showPlayBtn":[4,"show-play-btn"],"showProgress":[4,"show-progress"],"setProgressBall":[64],"toggleVisibility":[64],"getIsDraggingProgressBall":[64],"setCurrentTime":[64]},[[5,"touchmove","onDocumentTouchMove"],[5,"touchend","onDocumentTouchEnd"],[5,"touchcancel","onDocumentTouchEnd"]]],[0,"taro-video-danmu",{"enable":[4],"danmuList":[32],"sendDanmu":[64],"tick":[64]}]]]]'),e)));
|
|
@@ -4,6 +4,7 @@ export declare class Textarea implements ComponentInterface {
|
|
|
4
4
|
private textareaRef;
|
|
5
5
|
private isComposing;
|
|
6
6
|
private onInputExecuted;
|
|
7
|
+
private lastSelectionRange?;
|
|
7
8
|
el: HTMLElement;
|
|
8
9
|
value: string;
|
|
9
10
|
placeholder: string;
|
|
@@ -33,7 +34,10 @@ export declare class Textarea implements ComponentInterface {
|
|
|
33
34
|
handleBlur: (e: TaroEvent<HTMLInputElement> & FocusEvent) => void;
|
|
34
35
|
handleChange: (e: TaroEvent<HTMLInputElement>) => void;
|
|
35
36
|
handleLineChange: () => void;
|
|
36
|
-
handleKeyDown: (e: TaroEvent<
|
|
37
|
+
handleKeyDown: (e: TaroEvent<HTMLTextAreaElement> & KeyboardEvent) => void;
|
|
38
|
+
private getSelectionSnapshot;
|
|
39
|
+
private getCursorFromTarget;
|
|
40
|
+
private restoreSelection;
|
|
37
41
|
calculateContentHeight: (ta: any, scanAmount: any) => any;
|
|
38
42
|
getNumberOfLines: () => number;
|
|
39
43
|
render(): any;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tarojs/components",
|
|
3
|
-
"version": "4.1.11-beta.
|
|
3
|
+
"version": "4.1.11-beta.4",
|
|
4
4
|
"description": "Taro 组件库",
|
|
5
5
|
"browser": "dist/index.js",
|
|
6
6
|
"main:h5": "dist/index.js",
|
|
@@ -40,9 +40,9 @@
|
|
|
40
40
|
"resolve-pathname": "^3.0.0",
|
|
41
41
|
"swiper": "11.1.15",
|
|
42
42
|
"tslib": "^2.6.2",
|
|
43
|
-
"@tarojs/runtime": "4.1.11-beta.
|
|
44
|
-
"@tarojs/
|
|
45
|
-
"@tarojs/
|
|
43
|
+
"@tarojs/runtime": "4.1.11-beta.4",
|
|
44
|
+
"@tarojs/taro": "4.1.11-beta.4",
|
|
45
|
+
"@tarojs/shared": "4.1.11-beta.4"
|
|
46
46
|
},
|
|
47
47
|
"devDependencies": {
|
|
48
48
|
"@babel/generator": "^7.21.4",
|
|
@@ -68,7 +68,7 @@
|
|
|
68
68
|
"jest-cli": "27.5.1",
|
|
69
69
|
"jest-runner": "27.5.1",
|
|
70
70
|
"jest-environment-node": "27.5.1",
|
|
71
|
-
"@tarojs/helper": "4.1.11-beta.
|
|
71
|
+
"@tarojs/helper": "4.1.11-beta.4"
|
|
72
72
|
},
|
|
73
73
|
"peerDependenciesMeta": {
|
|
74
74
|
"@types/react": {
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export{T as taro_textarea_core}from"./p-b8e1a7de.js";import"./p-f72fcd8c.js";
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export{I as taro_input_core}from"./p-2b1afb2c.js";import"./p-f72fcd8c.js";
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{r as t,c as i,h as s,g as h}from"./p-f72fcd8c.js";function o(t){return null!=t?t:""}const e=class{constructor(s){t(this,s),this.onInput=i(this,"input",7),this.onFocus=i(this,"focus",7),this.onBlur=i(this,"blur",7),this.onConfirm=i(this,"confirm",7),this.onChange=i(this,"change",7),this.onLineChange=i(this,"linechange",7),this.onKeyDown=i(this,"keydown",7),this.isComposing=!1,this.onInputExecuted=!1,this.handleInput=t=>{if(t.stopPropagation(),this.handleLineChange(),this.onInputExecuted)return void(this.onInputExecuted=!1);const i=t.target.value||"";this.isComposing?this.compositionValue=i:(this.onInputExecuted=!0,void 0!==this.compositionValue&&(this.compositionValue=void 0),this.value=i,this.onInput.emit({value:i,cursor:i.length}),this.onInputExecuted=!1)},this.handleComposition=t=>{if(t.stopPropagation(),t.target instanceof HTMLTextAreaElement)if("compositionend"===t.type){this.isComposing=!1;const i=t.target.value||"";this.compositionValue=void 0,this.handleLineChange(),this.value=i,this.onInput.emit({value:i,cursor:i.length})}else this.isComposing=!0},this.handleFocus=t=>{t.stopPropagation(),this.onFocus.emit({value:t.target.value})},this.handleBlur=t=>{t.stopPropagation(),this.onBlur.emit({value:t.target.value})},this.handleChange=t=>{t.stopPropagation(),this.onChange.emit({value:t.target.value})},this.handleLineChange=()=>{const t=this.getNumberOfLines();t!==this.line&&(this.line=t,this.onLineChange.emit({height:this.textareaRef.clientHeight,lineCount:this.line}))},this.handleKeyDown=t=>{t.stopPropagation();const{value:i}=t.target,s=t.keyCode||t.code;this.onKeyDown.emit({value:i,cursor:i.length,keyCode:s}),13===s&&this.onConfirm.emit({value:i})},this.calculateContentHeight=(t,i)=>{const s=t.style.height;let h=t.offsetHeight;const o=t.scrollHeight,e=t.style.overflow,a=t.style.minHeight||null;if(!(h>=o))return o;if(t.style.minHeight=0,t.style.height=h+i+"px",t.style.overflow="hidden",o<t.scrollHeight){for(;t.offsetHeight>=t.scrollHeight;)t.style.height=(h-=i)+"px";for(;t.offsetHeight<t.scrollHeight;)t.style.height=h+++"px";return t.style.height=s,t.style.overflow=e,t.style.minHeight=a,h}},this.getNumberOfLines=()=>{const t=this.textareaRef,i=window.getComputedStyle?window.getComputedStyle(t):t.style,s=parseInt(i.lineHeight,10),h=this.calculateContentHeight(t,s);return Math.floor(h/s)},this.value="",this.placeholder=void 0,this.disabled=!1,this.maxlength=140,this.autoFocus=!1,this.autoHeight=!1,this.name=void 0,this.nativeProps={},this.line=1,this.compositionValue=void 0}watchAutoFocus(t,i){var s;!i&&t&&(null===(s=this.textareaRef)||void 0===s||s.focus())}watchValue(t){if(this.isComposing)return;const i=o(t);this.textareaRef.value!==i&&(this.textareaRef.value=i)}async focus(){this.textareaRef.focus()}componentDidLoad(){var t,i;null===(t=this.textareaRef)||void 0===t||t.addEventListener("compositionstart",this.handleComposition),null===(i=this.textareaRef)||void 0===i||i.addEventListener("compositionend",this.handleComposition)}disconnectedCallback(){var t,i;null===(t=this.textareaRef)||void 0===t||t.removeEventListener("compositionstart",this.handleComposition),null===(i=this.textareaRef)||void 0===i||i.removeEventListener("compositionend",this.handleComposition)}render(){const{value:t,placeholder:i,disabled:h,maxlength:e,autoFocus:a,autoHeight:n,name:r,nativeProps:u,handleInput:c,handleFocus:l,handleBlur:d,handleChange:v,compositionValue:p}=this,f={};return n&&(f.rows=this.line),s("textarea",Object.assign({ref:t=>{t&&(this.textareaRef=t,a&&t&&t.focus())},class:"taro-textarea "+(n?"auto-height":""),value:void 0!==p?p:o(t),placeholder:i,name:r,disabled:h,maxLength:e,autoFocus:a,onInput:c,onFocus:l,onBlur:d,onChange:v,onKeyDown:this.handleKeyDown},u,f))}get el(){return h(this)}static get watchers(){return{autoFocus:["watchAutoFocus"],value:["watchValue"]}}};e.style="taro-textarea-core{width:300px;display:block}taro-textarea-core .auto-height{height:auto}.taro-textarea{width:100%;height:inherit;appearance:none;cursor:auto;border:0;line-height:1.5;display:block;position:relative}.taro-textarea:focus{outline:none}";export{e as T}
|