1 | import { RenderFunction, SetupContext, ComponentPublicInstance, Ref } from 'vue'
|
2 | import { VXEComponent, VxeComponentBase, VxeEvent, SizeType, ValueOf } from './component'
|
3 |
|
4 |
|
5 |
|
6 |
|
7 |
|
8 |
|
9 |
|
10 | export const VxeTextarea: VXEComponent<VxeTextareaProps, VxeTextareaEventProps, VxeTextareaSlots>
|
11 |
|
12 |
|
13 |
|
14 | export const Textarea: typeof VxeTextarea
|
15 |
|
16 | export type VxeTextareaInstance = ComponentPublicInstance<VxeTextareaProps, VxeTextareaConstructor>
|
17 |
|
18 | export interface VxeTextareaConstructor extends VxeComponentBase, VxeTextareaMethods {
|
19 | props: VxeTextareaProps
|
20 | context: SetupContext<VxeTextareaEmits>
|
21 | reactData: TextareaReactData
|
22 | getRefMaps(): TextareaPrivateRef
|
23 | renderVN: RenderFunction
|
24 | }
|
25 |
|
26 | export interface TextareaReactData {
|
27 | inputValue: any
|
28 | }
|
29 |
|
30 | export interface TextareaPrivateRef {
|
31 | refElem: Ref<HTMLDivElement>
|
32 | refTextarea: Ref<HTMLTextAreaElement>
|
33 | }
|
34 | export interface VxeTextareaPrivateRef extends TextareaPrivateRef { }
|
35 |
|
36 | export type VxeTextareaProps = {
|
37 | size?: VxeTextareaPropTypes.Size
|
38 | |
39 |
|
40 |
|
41 | modelValue?: VxeTextareaPropTypes.ModelValue
|
42 | className?: VxeTextareaPropTypes.ClassName
|
43 | immediate?: VxeTextareaPropTypes.Immediate
|
44 | |
45 |
|
46 |
|
47 | name?: VxeTextareaPropTypes.Name
|
48 | |
49 |
|
50 |
|
51 | readonly?: VxeTextareaPropTypes.Readonly
|
52 | |
53 |
|
54 |
|
55 | disabled?: VxeTextareaPropTypes.Disabled
|
56 | |
57 |
|
58 |
|
59 | placeholder?: VxeTextareaPropTypes.Placeholder
|
60 | |
61 |
|
62 |
|
63 | maxlength?: VxeTextareaPropTypes.Maxlength
|
64 | |
65 |
|
66 |
|
67 | rows?: VxeTextareaPropTypes.Rows
|
68 | |
69 |
|
70 |
|
71 | cols?: VxeTextareaPropTypes.Cols
|
72 | |
73 |
|
74 |
|
75 | showWordCount?: VxeTextareaPropTypes.ShowWordCount
|
76 | |
77 |
|
78 |
|
79 | countMethod?: VxeTextareaPropTypes.CountMethod
|
80 | |
81 |
|
82 |
|
83 | autosize?: VxeTextareaPropTypes.Autosize
|
84 | |
85 |
|
86 |
|
87 | form?: VxeTextareaPropTypes.Form
|
88 | |
89 |
|
90 |
|
91 | resize?: VxeTextareaPropTypes.Resize
|
92 | }
|
93 |
|
94 | export namespace VxeTextareaPropTypes {
|
95 | export type Size = SizeType
|
96 | export type ModelValue = string | number
|
97 | export type ClassName = string
|
98 | export type Immediate = boolean
|
99 | export type Name = string
|
100 | export type Readonly = boolean
|
101 | export type Disabled = boolean
|
102 | export type Placeholder = string
|
103 | export type Maxlength = string | number
|
104 | export type Rows = string | number
|
105 | export type Cols = string | number
|
106 | export type ShowWordCount = boolean
|
107 | export type CountMethod = (params: {
|
108 | value: string
|
109 | }) => number
|
110 | export type Autosize = {
|
111 | minRows?: number
|
112 | maxRows?: number
|
113 | }
|
114 | export type Form = string
|
115 | export type Resize = string
|
116 | }
|
117 |
|
118 | export interface TextareaMethods {
|
119 | dispatchEvent(type: ValueOf<VxeTextareaEmits>, params: any, evnt: Event): void
|
120 | |
121 |
|
122 |
|
123 | focus(): Promise<any>
|
124 | |
125 |
|
126 |
|
127 | blur(): Promise<any>
|
128 | }
|
129 | export interface VxeTextareaMethods extends TextareaMethods { }
|
130 |
|
131 | export interface TextareaPrivateMethods { }
|
132 | export interface VxeTextareaPrivateMethods extends TextareaPrivateMethods { }
|
133 |
|
134 | export type VxeTextareaEmits = [
|
135 | 'update:modelValue',
|
136 | 'input',
|
137 | 'keydown',
|
138 | 'keyup',
|
139 | 'click',
|
140 | 'change',
|
141 | 'focus',
|
142 | 'blur'
|
143 | ]
|
144 |
|
145 | export namespace VxeTextareaDefines {
|
146 | interface TextareaEventParams extends VxeEvent {
|
147 | $textarea: VxeTextareaConstructor
|
148 | }
|
149 |
|
150 | export interface InputParams {
|
151 | value: string
|
152 | }
|
153 | export interface InputEventParams extends TextareaEventParams, InputParams { }
|
154 |
|
155 | export interface ChangeParams extends InputParams {}
|
156 | export interface ChangeEventParams extends TextareaEventParams, ChangeParams { }
|
157 |
|
158 | export interface KeyupParams extends InputParams {}
|
159 | export interface KeyupEventParams extends TextareaEventParams, KeyupParams { }
|
160 |
|
161 | export interface KeydownParams extends InputParams {}
|
162 | export interface KeydownEventParams extends TextareaEventParams, KeydownParams { }
|
163 |
|
164 | export interface ClickParams extends InputParams {}
|
165 | export interface ClickEventParams extends TextareaEventParams, ClickParams { }
|
166 |
|
167 | export interface FocusParams extends InputParams {}
|
168 | export interface FocusEventParams extends TextareaEventParams, FocusParams { }
|
169 |
|
170 | export interface BlurParams extends InputParams {}
|
171 | export interface BlurEventParams extends TextareaEventParams, BlurParams { }
|
172 | }
|
173 |
|
174 | export type VxeTextareaEventProps = {
|
175 | onInput?: VxeTextareaEvents.Input
|
176 | onChange?: VxeTextareaEvents.Change
|
177 | onKeydown?: VxeTextareaEvents.Keydown
|
178 | onKeyup?: VxeTextareaEvents.Keyup
|
179 | onClick?: VxeTextareaEvents.Click
|
180 | onFocus?: VxeTextareaEvents.Focus
|
181 | onBlur?: VxeTextareaEvents.Blur
|
182 | }
|
183 |
|
184 | export interface VxeTextareaListeners {
|
185 | input?: VxeTextareaEvents.Input
|
186 | change?: VxeTextareaEvents.Change
|
187 | keydown?: VxeTextareaEvents.Keydown
|
188 | keyup?: VxeTextareaEvents.Keyup
|
189 | click?: VxeTextareaEvents.Click
|
190 | focus?: VxeTextareaEvents.Focus
|
191 | blur?: VxeTextareaEvents.Blur
|
192 | }
|
193 |
|
194 | export namespace VxeTextareaEvents {
|
195 | export type Input = (params: VxeTextareaDefines.InputEventParams) => void
|
196 | export type Change = (params: VxeTextareaDefines.ChangeEventParams) => void
|
197 | export type Keydown = (params: VxeTextareaDefines.KeydownEventParams) => void
|
198 | export type Keyup = (params: VxeTextareaDefines.KeyupEventParams) => void
|
199 | export type Click = (params: VxeTextareaDefines.ClickEventParams) => void
|
200 | export type Focus = (params: VxeTextareaDefines.FocusEventParams) => void
|
201 | export type Blur = (params: VxeTextareaDefines.BlurEventParams) => void
|
202 | }
|
203 |
|
204 | export interface VxeTextareaSlots {
|
205 | |
206 |
|
207 |
|
208 | [key: string]: ((params: {
|
209 | [key: string]: any
|
210 | }) => any) | undefined
|
211 | }
|