• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1/*
2 * Copyright (c) 2021-2023 Huawei Device Co., Ltd.
3 * Licensed under the Apache License, Version 2.0 (the "License");
4 * you may not use this file except in compliance with the License.
5 * You may obtain a copy of the License at
6 *
7 *     http://www.apache.org/licenses/LICENSE-2.0
8 *
9 * Unless required by applicable law or agreed to in writing, software
10 * distributed under the License is distributed on an "AS IS" BASIS,
11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 * See the License for the specific language governing permissions and
13 * limitations under the License.
14 */
15
16/**
17 * Provides the method of switching the cursor position.
18 *
19 * @extends TextContentControllerBase
20 * @since 8
21 */
22/**
23 * Provides the method of switching the cursor position.
24 *
25 * @extends TextContentControllerBase
26 * @syscap SystemCapability.ArkUI.ArkUI.Full
27 * @crossplatform
28 * @since 10
29 */
30declare class TextAreaController extends TextContentControllerBase {
31  /**
32   * constructor.
33   *
34   * @syscap SystemCapability.ArkUI.ArkUI.Full
35   * @since 8
36   */
37  /**
38   * constructor.
39   *
40   * @syscap SystemCapability.ArkUI.ArkUI.Full
41   * @crossplatform
42   * @since 10
43   */
44  constructor();
45
46  /**
47   * Called when the position of the insertion cursor is set.
48   *
49   * @param { number } value
50   * @syscap SystemCapability.ArkUI.ArkUI.Full
51   * @since 8
52   */
53  /**
54   * Called when the position of the insertion cursor is set.
55   *
56   * @param { number } value
57   * @syscap SystemCapability.ArkUI.ArkUI.Full
58   * @crossplatform
59   * @since 10
60   */
61  caretPosition(value: number): void;
62
63  /**
64   * Text selection is achieved by specifying the start and end positions of the text.
65   *
66   * @param { number } selectionStart - The start position of the selected text.
67   * @param { number } selectionEnd - The end position of the selected text.
68   * @syscap SystemCapability.ArkUI.ArkUI.Full
69   * @crossplatform
70   * @since 10
71   */
72  setTextSelection(selectionStart: number, selectionEnd: number): void;
73
74  /**
75   * Exit edit state.
76   *
77   * @syscap SystemCapability.ArkUI.ArkUI.Full
78   * @crossplatform
79   * @since 10
80   */
81  stopEditing(): void;
82}
83
84/**
85 * Defines the options of TextArea.
86 *
87 * @interface TextAreaOptions
88 * @syscap SystemCapability.ArkUI.ArkUI.Full
89 * @since 7
90 */
91/**
92 * Defines the options of TextArea.
93 *
94 * @interface TextAreaOptions
95 * @syscap SystemCapability.ArkUI.ArkUI.Full
96 * @crossplatform
97 * @since 10
98 */
99declare interface TextAreaOptions {
100  /**
101   * The place holder text string.
102   *
103   * @type { ?ResourceStr }
104   * @syscap SystemCapability.ArkUI.ArkUI.Full
105   * @since 7
106   */
107  /**
108   * The place holder text string.
109   *
110   * @type { ?ResourceStr }
111   * @syscap SystemCapability.ArkUI.ArkUI.Full
112   * @crossplatform
113   * @since 10
114   */
115  placeholder?: ResourceStr;
116
117  /**
118   * Sets the current value of TextArea.
119   *
120   * @type { ?ResourceStr }
121   * @syscap SystemCapability.ArkUI.ArkUI.Full
122   * @since 7
123   */
124  /**
125   * Sets the current value of TextArea.
126   *
127   * @type { ?ResourceStr }
128   * @syscap SystemCapability.ArkUI.ArkUI.Full
129   * @crossplatform
130   * @since 10
131   */
132  text?: ResourceStr;
133
134  /**
135   * Called when the position of the insertion cursor is set.
136   *
137   * @type { ?TextAreaController }
138   * @syscap SystemCapability.ArkUI.ArkUI.Full
139   * @since 8
140   */
141  /**
142   * Called when the position of the insertion cursor is set.
143   *
144   * @type { ?TextAreaController }
145   * @syscap SystemCapability.ArkUI.ArkUI.Full
146   * @crossplatform
147   * @since 10
148   */
149  controller?: TextAreaController;
150}
151
152/**
153 * Provides an interface for the multi-line text input component.
154 *
155 * @interface TextAreaInterface
156 * @syscap SystemCapability.ArkUI.ArkUI.Full
157 * @since 7
158 */
159/**
160 * Provides an interface for the multi-line text input component.
161 *
162 * @interface TextAreaInterface
163 * @syscap SystemCapability.ArkUI.ArkUI.Full
164 * @crossplatform
165 * @since 10
166 */
167interface TextAreaInterface {
168  /**
169   * Called when writing multiple lines of text.
170   *
171   * @param { TextAreaOptions } value
172   * @returns { TextAreaAttribute }
173   * @syscap SystemCapability.ArkUI.ArkUI.Full
174   * @since 7
175   */
176  /**
177   * Called when writing multiple lines of text.
178   *
179   * @param { TextAreaOptions } value
180   * @returns { TextAreaAttribute }
181   * @syscap SystemCapability.ArkUI.ArkUI.Full
182   * @crossplatform
183   * @since 10
184   */
185  (value?: TextAreaOptions): TextAreaAttribute;
186}
187
188/**
189 * Defines the attribute functions of TextArea.
190 *
191 * @extends CommonMethod
192 * @syscap SystemCapability.ArkUI.ArkUI.Full
193 * @since 7
194 */
195/**
196 * Defines the attribute functions of TextArea.
197 *
198 * @extends CommonMethod
199 * @syscap SystemCapability.ArkUI.ArkUI.Full
200 * @crossplatform
201 * @since 10
202 */
203declare class TextAreaAttribute extends CommonMethod<TextAreaAttribute> {
204  /**
205   * Called when the color of the placeholder is set.
206   *
207   * @param { ResourceColor } value
208   * @returns { TextAreaAttribute }
209   * @syscap SystemCapability.ArkUI.ArkUI.Full
210   * @since 7
211   */
212  /**
213   * Called when the color of the placeholder is set.
214   *
215   * @param { ResourceColor } value
216   * @returns { TextAreaAttribute }
217   * @syscap SystemCapability.ArkUI.ArkUI.Full
218   * @crossplatform
219   * @since 10
220   */
221  placeholderColor(value: ResourceColor): TextAreaAttribute;
222
223  /**
224   * Called when the font property of the placeholder is set.
225   *
226   * @param { Font } value
227   * @returns { TextAreaAttribute }
228   * @syscap SystemCapability.ArkUI.ArkUI.Full
229   * @since 7
230   */
231  /**
232   * Called when the font property of the placeholder is set.
233   *
234   * @param { Font } value
235   * @returns { TextAreaAttribute }
236   * @syscap SystemCapability.ArkUI.ArkUI.Full
237   * @crossplatform
238   * @since 10
239   */
240  placeholderFont(value: Font): TextAreaAttribute;
241
242  /**
243   * Called when the alignment of the contents of a multiline text box is set.
244   *
245   * @param { TextAlign } value
246   * @returns { TextAreaAttribute }
247   * @syscap SystemCapability.ArkUI.ArkUI.Full
248   * @since 7
249   */
250  /**
251   * Called when the alignment of the contents of a multiline text box is set.
252   *
253   * @param { TextAlign } value
254   * @returns { TextAreaAttribute }
255   * @syscap SystemCapability.ArkUI.ArkUI.Full
256   * @crossplatform
257   * @since 10
258   */
259  textAlign(value: TextAlign): TextAreaAttribute;
260
261  /**
262   * Called when the insertion cursor color is set.
263   *
264   * @param { ResourceColor } value
265   * @returns { TextAreaAttribute }
266   * @syscap SystemCapability.ArkUI.ArkUI.Full
267   * @since 7
268   */
269  /**
270   * Called when the insertion cursor color is set.
271   *
272   * @param { ResourceColor } value
273   * @returns { TextAreaAttribute }
274   * @syscap SystemCapability.ArkUI.ArkUI.Full
275   * @crossplatform
276   * @since 10
277   */
278  caretColor(value: ResourceColor): TextAreaAttribute;
279
280  /**
281   * Called when the font color is set.
282   *
283   * @param { ResourceColor } value
284   * @returns { TextAreaAttribute }
285   * @syscap SystemCapability.ArkUI.ArkUI.Full
286   * @since 7
287   */
288  /**
289   * Called when the font color is set.
290   *
291   * @param { ResourceColor } value
292   * @returns { TextAreaAttribute }
293   * @syscap SystemCapability.ArkUI.ArkUI.Full
294   * @crossplatform
295   * @since 10
296   */
297  fontColor(value: ResourceColor): TextAreaAttribute;
298
299  /**
300   * Called when the font size is set.
301   *
302   * @param { Length } value
303   * @returns { TextAreaAttribute }
304   * @syscap SystemCapability.ArkUI.ArkUI.Full
305   * @since 7
306   */
307  /**
308   * Called when the font size is set.
309   *
310   * @param { Length } value
311   * @returns { TextAreaAttribute }
312   * @syscap SystemCapability.ArkUI.ArkUI.Full
313   * @crossplatform
314   * @since 10
315   */
316  fontSize(value: Length): TextAreaAttribute;
317
318  /**
319   * Called when the font style of a font is set.
320   *
321   * @param { FontStyle } value
322   * @returns { TextAreaAttribute }
323   * @syscap SystemCapability.ArkUI.ArkUI.Full
324   * @since 7
325   */
326  /**
327   * Called when the font style of a font is set.
328   *
329   * @param { FontStyle } value
330   * @returns { TextAreaAttribute }
331   * @syscap SystemCapability.ArkUI.ArkUI.Full
332   * @crossplatform
333   * @since 10
334   */
335  fontStyle(value: FontStyle): TextAreaAttribute;
336
337  /**
338   * Called when the font weight is set.
339   *
340   * @param { number | FontWeight | string } value
341   * @returns { TextAreaAttribute }
342   * @syscap SystemCapability.ArkUI.ArkUI.Full
343   * @since 7
344   */
345  /**
346   * Called when the font weight is set.
347   *
348   * @param { number | FontWeight | string } value
349   * @returns { TextAreaAttribute }
350   * @syscap SystemCapability.ArkUI.ArkUI.Full
351   * @crossplatform
352   * @since 10
353   */
354  fontWeight(value: number | FontWeight | string): TextAreaAttribute;
355
356  /**
357   * Called when the font list of text is set.
358   *
359   * @param { ResourceStr } value
360   * @returns { TextAreaAttribute }
361   * @syscap SystemCapability.ArkUI.ArkUI.Full
362   * @since 7
363   */
364  /**
365   * Called when the font list of text is set.
366   *
367   * @param { ResourceStr } value
368   * @returns { TextAreaAttribute }
369   * @syscap SystemCapability.ArkUI.ArkUI.Full
370   * @crossplatform
371   * @since 10
372   */
373  fontFamily(value: ResourceStr): TextAreaAttribute;
374
375  /**
376   * Called when the inputFilter of text is set.
377   *
378   * @param { ResourceStr } value
379   * @param { function } error
380   * @returns { TextAreaAttribute }
381   * @syscap SystemCapability.ArkUI.ArkUI.Full
382   * @since 8
383   */
384  /**
385   * Called when the inputFilter of text is set.
386   *
387   * @param { ResourceStr } value
388   * @param { function } error
389   * @returns { TextAreaAttribute }
390   * @syscap SystemCapability.ArkUI.ArkUI.Full
391   * @crossplatform
392   * @since 10
393   */
394  inputFilter(value: ResourceStr, error?: (value: string) => void): TextAreaAttribute;
395
396  /**
397   * Called when the input changes.
398   *
399   * @param { function } callback
400   * @returns { TextAreaAttribute }
401   * @syscap SystemCapability.ArkUI.ArkUI.Full
402   * @since 7
403   */
404  /**
405   * Called when the input changes.
406   *
407   * @param { function } callback
408   * @returns { TextAreaAttribute }
409   * @syscap SystemCapability.ArkUI.ArkUI.Full
410   * @crossplatform
411   * @since 10
412   */
413  onChange(callback: (value: string) => void): TextAreaAttribute;
414
415  /**
416   * Called when the text selection changes.
417   *
418   * @param { function } callback - callback of the listened event.
419   * @returns { TextAreaAttribute } returns the instance of the TextAreaAttribute.
420   * @syscap SystemCapability.ArkUI.ArkUI.Full
421   * @crossplatform
422   * @since 10
423   */
424  onTextSelectionChange(callback: (selectionStart: number, selectionEnd: number) => void): TextAreaAttribute;
425
426  /**
427   * Called when the content scrolls.
428   *
429   * @param { function } callback - callback of the listened event.
430   * @returns { TextAreaAttribute } returns the instance of the TextAreaAttribute.
431   * @syscap SystemCapability.ArkUI.ArkUI.Full
432   * @crossplatform
433   * @since 10
434   */
435  onContentScroll(callback: (totalOffsetX: number, totalOffsetY: number) => void): TextAreaAttribute;
436
437  /**
438   * Called when judging whether the text editing change finished.
439   *
440   * @param { function } callback - Triggered when the text area status changes.
441   * If the value of isEditing is true, text area is in progress.
442   * @returns { TextAreaAttribute }
443   * @syscap SystemCapability.ArkUI.ArkUI.Full
444   * @crossplatform
445   * @since 10
446   */
447  onEditChange(callback: (isEditing: boolean) => void): TextAreaAttribute;
448
449  /**
450   * Called when using the Clipboard menu
451   *
452   * @param { function } callback
453   * @returns { TextAreaAttribute }
454   * @syscap SystemCapability.ArkUI.ArkUI.Full
455   * @since 7
456   */
457  /**
458   * Called when using the Clipboard menu
459   *
460   * @param { function } callback
461   * @returns { TextAreaAttribute }
462   * @syscap SystemCapability.ArkUI.ArkUI.Full
463   * @crossplatform
464   * @since 10
465   */
466  onCopy(callback: (value: string) => void): TextAreaAttribute;
467
468  /**
469   * Called when using the Clipboard menu
470   *
471   * @param { function } callback
472   * @returns { TextAreaAttribute }
473   * @syscap SystemCapability.ArkUI.ArkUI.Full
474   * @since 7
475   */
476  /**
477   * Called when using the Clipboard menu
478   *
479   * @param { function } callback
480   * @returns { TextAreaAttribute }
481   * @syscap SystemCapability.ArkUI.ArkUI.Full
482   * @crossplatform
483   * @since 10
484   */
485  onCut(callback: (value: string) => void): TextAreaAttribute;
486
487  /**
488   * Called when using the Clipboard menu
489   *
490   * @param { function } callback
491   * @returns { TextAreaAttribute }
492   * @syscap SystemCapability.ArkUI.ArkUI.Full
493   * @since 7
494   */
495  /**
496   * Called when using the Clipboard menu
497   *
498   * @param { function } callback
499   * @returns { TextAreaAttribute }
500   * @syscap SystemCapability.ArkUI.ArkUI.Full
501   * @crossplatform
502   * @since 10
503   */
504  onPaste(callback: (value: string) => void): TextAreaAttribute;
505
506  /**
507   * Called when the copy option is set.
508   *
509   * @param { CopyOptions } value
510   * @returns { TextAreaAttribute }
511   * @syscap SystemCapability.ArkUI.ArkUI.Full
512   * @since 9
513   */
514  /**
515   * Called when the copy option is set.
516   *
517   * @param { CopyOptions } value
518   * @returns { TextAreaAttribute }
519   * @syscap SystemCapability.ArkUI.ArkUI.Full
520   * @crossplatform
521   * @since 10
522   */
523  copyOption(value: CopyOptions): TextAreaAttribute;
524
525  /**
526   * Sets whether request keyboard or not when on focus.
527   *
528   * @param { boolean } value
529   * @returns { TextAreaAttribute } Returns the instance of the TextAreaAttribute.
530   * @syscap SystemCapability.ArkUI.ArkUI.Full
531   * @crossplatform
532   * @since 10
533   */
534  enableKeyboardOnFocus(value: boolean): TextAreaAttribute;
535
536  /**
537   * Define the max length content of the text area.
538   *
539   * @param { number } value
540   * @returns { TextAreaAttribute }
541   * @syscap SystemCapability.ArkUI.ArkUI.Full
542   * @since 10
543   */
544  maxLength(value: number): TextAreaAttribute;
545
546  /**
547   * Define show counter of the text area.
548   *
549   * @param { boolean } value
550   * @returns { TextAreaAttribute }
551   * @syscap SystemCapability.ArkUI.ArkUI.Full
552   * @since 10
553   */
554  showCounter(value: boolean): TextAreaAttribute;
555
556  /**
557   * Define style of the text area.
558   *
559   * @param { TextContentStyle } value
560   * @returns { TextAreaAttribute }
561   * @syscap SystemCapability.ArkUI.ArkUI.Full
562   * @since 10
563   */
564  style(value: TextContentStyle): TextAreaAttribute;
565
566  /**
567   * Define bar state of the text area.
568   *
569   * @param { BarState } value
570   * @returns { TextAreaAttribute }
571   * @syscap SystemCapability.ArkUI.ArkUI.Full
572   * @since 10
573   */
574  barState(value: BarState): TextAreaAttribute;
575
576  /**
577   * Controls whether the selection menu pops up.
578   *
579   * @param { boolean } value
580   * @returns { TextAreaAttribute } returns the instance of the TextAreaAttribute.
581   * @syscap SystemCapability.ArkUI.ArkUI.Full
582   * @crossplatform
583   * @since 10
584   */
585  selectionMenuHidden(value: boolean): TextAreaAttribute;
586
587  /**
588   * Define max lines of the text area.
589   *
590   * @param { number } value
591   * @returns { TextAreaAttribute } returns the instance of the TextAreaAttribute.
592   * @syscap SystemCapability.ArkUI.ArkUI.Full
593   * @since 10
594   */
595  maxLines(value: number): TextAreaAttribute;
596
597  /**
598   * Define custom keyboard of the text area.
599   *
600   * @param { CustomBuilder } value
601   * @returns { TextAreaAttribute } returns the instance of the TextAreaAttribute.
602   * @syscap SystemCapability.ArkUI.ArkUI.Full
603   * @since 10
604   */
605  customKeyboard(value: CustomBuilder): TextAreaAttribute;
606}
607
608/**
609 * Defines TextArea Component.
610 *
611 * @syscap SystemCapability.ArkUI.ArkUI.Full
612 * @since 7
613 */
614/**
615 * Defines TextArea Component.
616 *
617 * @syscap SystemCapability.ArkUI.ArkUI.Full
618 * @crossplatform
619 * @since 10
620 */
621declare const TextArea: TextAreaInterface;
622
623/**
624 * Defines TextArea Component instance.
625 *
626 * @syscap SystemCapability.ArkUI.ArkUI.Full
627 * @since 7
628 */
629/**
630 * Defines TextArea Component instance.
631 *
632 * @syscap SystemCapability.ArkUI.ArkUI.Full
633 * @crossplatform
634 * @since 10
635 */
636declare const TextAreaInstance: TextAreaAttribute;
637