@tarojs/components 4.1.10 → 4.1.11-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/cjs/index.cjs.js +1 -1
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/taro-components.cjs.js +1 -1
- package/dist/cjs/taro-textarea-core.cjs.entry.js +1 -1
- package/dist/cjs/{textarea-3f14df1c.js → textarea-80e6b1d0.js} +59 -7
- package/dist/collection/components/textarea/textarea.js +61 -8
- package/dist/components/taro-textarea-core.js +60 -7
- package/dist/esm/index.js +1 -1
- package/dist/esm/loader.js +1 -1
- package/dist/esm/taro-components.js +1 -1
- package/dist/esm/taro-textarea-core.entry.js +1 -1
- package/dist/esm/{textarea-c722fd22.js → textarea-31371acd.js} +59 -7
- package/dist/hydrate/index.js +60 -7
- package/dist/taro-components/index.esm.js +1 -1
- package/dist/taro-components/p-66554c2d.entry.js +1 -0
- package/dist/taro-components/p-b8e1a7de.js +1 -0
- package/dist/taro-components/taro-components.esm.js +1 -1
- package/dist/types/components/textarea/textarea.d.ts +8 -2
- package/package.json +5 -5
- package/dist/taro-components/p-052dbbd9.entry.js +0 -1
- package/dist/taro-components/p-6e2f460d.js +0 -1
|
@@ -1,7 +1,9 @@
|
|
|
1
|
-
import { ComponentInterface, EventEmitter } from '../../stencil-public-runtime';
|
|
1
|
+
import { ComponentInterface, Event, EventEmitter } from '../../stencil-public-runtime';
|
|
2
2
|
import { TaroEvent } from '../../../types';
|
|
3
3
|
export declare class Textarea implements ComponentInterface {
|
|
4
4
|
private textareaRef;
|
|
5
|
+
private isComposing;
|
|
6
|
+
private onInputExecuted;
|
|
5
7
|
el: HTMLElement;
|
|
6
8
|
value: string;
|
|
7
9
|
placeholder: string;
|
|
@@ -12,6 +14,7 @@ export declare class Textarea implements ComponentInterface {
|
|
|
12
14
|
name: string;
|
|
13
15
|
nativeProps: {};
|
|
14
16
|
line: number;
|
|
17
|
+
compositionValue?: string;
|
|
15
18
|
onInput: EventEmitter;
|
|
16
19
|
onFocus: EventEmitter;
|
|
17
20
|
onBlur: EventEmitter;
|
|
@@ -22,7 +25,10 @@ export declare class Textarea implements ComponentInterface {
|
|
|
22
25
|
watchAutoFocus(newValue: boolean, oldValue: boolean): void;
|
|
23
26
|
watchValue(newValue: string): void;
|
|
24
27
|
focus(): Promise<void>;
|
|
25
|
-
|
|
28
|
+
componentDidLoad(): void;
|
|
29
|
+
disconnectedCallback(): void;
|
|
30
|
+
handleInput: (e: TaroEvent<HTMLTextAreaElement>) => void;
|
|
31
|
+
handleComposition: (e: Event) => void;
|
|
26
32
|
handleFocus: (e: TaroEvent<HTMLInputElement> & FocusEvent) => void;
|
|
27
33
|
handleBlur: (e: TaroEvent<HTMLInputElement> & FocusEvent) => void;
|
|
28
34
|
handleChange: (e: TaroEvent<HTMLInputElement>) => void;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tarojs/components",
|
|
3
|
-
"version": "4.1.
|
|
3
|
+
"version": "4.1.11-beta.0",
|
|
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.
|
|
44
|
-
"@tarojs/shared": "4.1.
|
|
45
|
-
"@tarojs/taro": "4.1.
|
|
43
|
+
"@tarojs/runtime": "4.1.11-beta.0",
|
|
44
|
+
"@tarojs/shared": "4.1.11-beta.0",
|
|
45
|
+
"@tarojs/taro": "4.1.11-beta.0"
|
|
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.
|
|
71
|
+
"@tarojs/helper": "4.1.11-beta.0"
|
|
72
72
|
},
|
|
73
73
|
"peerDependenciesMeta": {
|
|
74
74
|
"@types/react": {
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export{T as taro_textarea_core}from"./p-6e2f460d.js";import"./p-f72fcd8c.js";
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{r as t,c as s,h as i,g as h}from"./p-f72fcd8c.js";function e(t){return null!=t?t:""}const a=class{constructor(i){t(this,i),this.onInput=s(this,"input",7),this.onFocus=s(this,"focus",7),this.onBlur=s(this,"blur",7),this.onConfirm=s(this,"confirm",7),this.onChange=s(this,"change",7),this.onLineChange=s(this,"linechange",7),this.onKeyDown=s(this,"keydown",7),this.handleInput=t=>{t.stopPropagation(),this.handleLineChange();const s=t.target.value||"";this.value=s,this.onInput.emit({value:s,cursor:s.length})},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:s}=t.target,i=t.keyCode||t.code;this.onKeyDown.emit({value:s,cursor:s.length,keyCode:i}),13===i&&this.onConfirm.emit({value:s})},this.calculateContentHeight=(t,s)=>{let i=t.style.height,h=t.offsetHeight,e=t.scrollHeight,a=t.style.overflow,o=t.style.minHeight||null;if(!(h>=e))return e;if(t.style.minHeight=0,t.style.height=h+s+"px",t.style.overflow="hidden",e<t.scrollHeight){for(;t.offsetHeight>=t.scrollHeight;)t.style.height=(h-=s)+"px";for(;t.offsetHeight<t.scrollHeight;)t.style.height=h+++"px";return t.style.height=i,t.style.overflow=a,t.style.minHeight=o,h}},this.getNumberOfLines=()=>{const t=this.textareaRef,s=window.getComputedStyle?window.getComputedStyle(t):t.style,i=parseInt(s.lineHeight,10),h=this.calculateContentHeight(t,i);return Math.floor(h/i)},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}watchAutoFocus(t,s){var i;!s&&t&&(null===(i=this.textareaRef)||void 0===i||i.focus())}watchValue(t){const s=e(t);this.textareaRef.value!==s&&(this.textareaRef.value=s)}async focus(){this.textareaRef.focus()}render(){const{value:t,placeholder:s,disabled:h,maxlength:a,autoFocus:o,autoHeight:n,name:r,nativeProps:u,handleInput:c,handleFocus:l,handleBlur:d,handleChange:p}=this,g={};return n&&(g.rows=this.line),i("textarea",Object.assign({ref:t=>{t&&(this.textareaRef=t,o&&t&&t.focus())},class:"taro-textarea "+(n?"auto-height":""),value:e(t),placeholder:s,name:r,disabled:h,maxlength:a,autofocus:o,onInput:c,onFocus:l,onBlur:d,onChange:p,onKeyDown:this.handleKeyDown},u,g))}get el(){return h(this)}static get watchers(){return{autoFocus:["watchAutoFocus"],value:["watchValue"]}}};a.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{a as T}
|