• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1/*
2 * Copyright (c) 2021 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 * @since 8
19 */
20declare class TextAreaController {
21  /**
22   * constructor.
23   * @since 8
24   */
25  constructor();
26  /**
27   * Called when the position of the insertion cursor is set.
28   * @since 8
29   */
30  caretPosition(value: number): void;
31}
32
33/**
34 * Defines the options of TextArea.
35 * @since 7
36 */
37declare interface TextAreaOptions {
38  /**
39   * The place holder text string.
40   * @since 7
41   */
42  placeholder?: ResourceStr;
43
44  /**
45   * Sets the current value of TextArea.
46   * @since 7
47   */
48  text?: ResourceStr;
49
50  /**
51   * Called when the position of the insertion cursor is set.
52   * @since 8
53   */
54  controller?: TextAreaController;
55}
56
57/**
58 * Provides an interface for the multi-line text input component.
59 * @since 7
60 */
61interface TextAreaInterface {
62  /**
63   * Called when writing multiple lines of text.
64   * @since 7
65   */
66  (value?: TextAreaOptions): TextAreaAttribute;
67}
68
69/**
70 * Defines the attribute functions of TextArea.
71 * @since 7
72 */
73declare class TextAreaAttribute extends CommonMethod<TextAreaAttribute> {
74  /**
75   * Called when the color of the placeholder is set.
76   * @since 7
77   */
78  placeholderColor(value: ResourceColor): TextAreaAttribute;
79
80  /**
81   * Called when the font property of the placeholder is set.
82   * @since 7
83   */
84  placeholderFont(value: Font): TextAreaAttribute;
85
86  /**
87   * Called when the alignment of the contents of a multiline text box is set.
88   * @since 7
89   */
90  textAlign(value: TextAlign): TextAreaAttribute;
91
92  /**
93   * Called when the insertion cursor color is set.
94   * @since 7
95   */
96  caretColor(value: ResourceColor): TextAreaAttribute;
97
98  /**
99   * Called when the font color is set.
100   * @since 7
101   */
102  fontColor(value: ResourceColor): TextAreaAttribute;
103
104  /**
105   * Called when the font size is set.
106   * @since 7
107   */
108  fontSize(value: Length): TextAreaAttribute;
109
110  /**
111   * Called when the font style of a font is set.
112   * @since 7
113   */
114  fontStyle(value: FontStyle): TextAreaAttribute;
115
116  /**
117   * Called when the font weight is set.
118   * @since 7
119   */
120  fontWeight(value: number | FontWeight | string): TextAreaAttribute;
121
122  /**
123   * Called when the font list of text is set.
124   * @since 7
125   */
126  fontFamily(value: ResourceStr): TextAreaAttribute;
127
128  /**
129   * Called when the inputFilter of text is set.
130   * @since 8
131   */
132  inputFilter(value: ResourceStr, error?: (value: string) => void): TextAreaAttribute;
133
134  /**
135   * Called when the input changes.
136   * @since 7
137   */
138  onChange(callback: (value: string) => void): TextAreaAttribute;
139
140  /**
141   * Called when using the Clipboard menu
142   * @since 7
143   */
144  onCopy(callback: (value: string) => void): TextAreaAttribute;
145
146  /**
147   * Called when using the Clipboard menu
148   * @since 7
149   */
150  onCut(callback: (value: string) => void): TextAreaAttribute;
151
152  /**
153   * Called when using the Clipboard menu
154   * @since 7
155   */
156  onPaste(callback: (value: string) => void): TextAreaAttribute;
157
158  /**
159   * Called when the copy option is set.
160   * @since 9
161   */
162  copyOption(value: CopyOptions): TextAreaAttribute;
163}
164
165/**
166 * Defines TextArea Component.
167 * @since 7
168 */
169declare const TextArea: TextAreaInterface;
170
171/**
172 * Defines TextArea Component instance.
173 * @since 7
174 */
175declare const TextAreaInstance: TextAreaAttribute;
176