提交 d04aa831 编写于 作者: E ester.zhou

Update docs (20374)

Signed-off-by: Nester.zhou <ester.zhou@huawei.com>
上级 5a59a8cd
......@@ -29,7 +29,7 @@ In addition to the [universal attributes](ts-universal-attributes-size.md), the
| Name | Type | Description |
| ----------------------- | ------------------------------------------------ | ---------------------------------------------- |
| searchButton<sup>10+</sup> | value: string,<br>option?: [SearchButtonOption](#searchbuttonoption10) | Text on the search button located next to the search text box. By default, there is no search button. |
| searchButton<sup>10+</sup> | value: string,<br>option?: [SearchButtonOptions](#searchbuttonoptions10) | Text on the search button located next to the search text box. By default, there is no search button. |
| placeholderColor | [ResourceColor](ts-types.md#resourcecolor) | Placeholder text color. |
| placeholderFont | [Font](ts-types.md#font) | Placeholder text style, including the font size, font width, font family, and font style. Currently, only the default font family is supported. |
| textFont | [Font](ts-types.md#font) | Style of the text entered in the search box, including the font size, font width, font family, and font style. Currently, only the default font family is supported. |
......@@ -56,7 +56,7 @@ In addition to the [universal attributes](ts-universal-attributes-size.md), the
| width | [Length](ts-types.md#length) | No | Caret width.|
| color | [ResourceColor](ts-types.md#resourcecolor) | No | Caret color.|
## SearchButtonOption<sup>10+</sup>
## SearchButtonOptions<sup>10+</sup>
| Name | Type | Mandatory| Description |
| --------- | ------------------------------------------ | ---- | ---------------- |
......@@ -111,6 +111,47 @@ stopEditing(): void
Exits the editing state.
### getTextContentRect<sup>10+</sup>
getTextContentRect(): [RectResult](#rectresult10)
Obtains the position of the edited text area relative to the component and its size. The unit of the return value is pixel.
**Return value**
| Type | Description |
| ------------------- | -------- |
| [RectResult](#rectresult10) | Position of the edited text area relative to the component and its size.|
> **NOTE**
>
> - The returned position information is the offset of the first character relative to the search icon in the **\<Search>** component.
> - If no text is entered, the return value contains the position information, but the size is 0.
### RectResult<sup>10+</sup>
Describes the position and size.
| Parameter | Type | Description|
| ------- | ------ | ----------------------- |
| x | number | X coordinate.|
| y | number | Y coordinate.|
| width | number | Content width.|
| height | number | Content height.|
### getTextContentLineCount<sup>10+</sup>
getTextContentLineCount(): number
Obtains the number of lines of the edited text.
**Return value**
| Type | Description |
| ----- | -------- |
| number| Number of lines of the edited text.|
## Example
### Example 1
......
......@@ -20,8 +20,8 @@ TextArea(value?:{placeholder?: ResourceStr, text?: ResourceStr, controller?: Tex
| Name | Type | Mandatory | Description |
| ----------------------- | ---------------------------------------- | ---- | -------------- |
| placeholder | [ResourceStr](ts-types.md#resourcestr) | No | Placeholder text displayed when no text input is set.<br>When only the **placeholder** attribute is set, the text selection handle is still available; the caret stays at the beginning of the placeholder text when the handle is released. |
| text | [ResourceStr](ts-types.md#resourcestr) | No | Current text input.<br>If the component has [stateStyles](ts-universal-attributes-polymorphic-style.md) or any other attribute that may trigger updating configured, you are advised to bind the state variable to the text in real time through the **onChange** event,<br>so as to prevent display errors when the component is updated.<br>Since API version 10, this parameter supports [$$](../../quick-start/arkts-two-way-sync.md) for two-way binding of variables.|
| placeholder | [ResourceStr](ts-types.md#resourcestr) | No | Text displayed when there is no input.<br>When only the **placeholder** attribute is set, the text selection handle is still available; the caret stays at the beginning of the placeholder text when the handle is released. |
| text | [ResourceStr](ts-types.md#resourcestr) | No | Current text input.<br>If the component has [stateStyles](ts-universal-attributes-polymorphic-style.md) or any other attribute that may trigger updating configured, you are advised to bind the state variable to the text in real time through the **onChange** event,<br>so as to prevent display errors when the component is updated.<br>Since API version 10, this parameter supports two-way binding through [$$](../../quick-start/arkts-two-way-sync.md).|
| controller<sup>8+</sup> | [TextAreaController](#textareacontroller8) | No | Text area controller.|
......@@ -102,6 +102,48 @@ stopEditing(): void
Exits the editing state.
### getTextContentRect<sup>10+</sup>
getTextContentRect(): [RectResult](#rectresult10)
Obtains the position of the edited text area relative to the component and its size. The unit of the return value is pixel.
**Return value**
| Type | Description |
| ------------------- | -------- |
| [RectResult](#rectresult10) | Position of the edited text area relative to the component and its size.|
> **NOTE**
>
> - If no text is entered, the return value contains the position information, but the size is 0.
> - The position information is the offset of the first character relative to the editable area.
> - If there is input, the width in the return value is the fixed width of the editable area.
### RectResult<sup>10+</sup>
Describes the position and size.
| Parameter | Type | Description|
| ------- | ------ | ----------------------- |
| x | number | X coordinate.|
| y | number | Y coordinate.|
| width | number | Content width.|
| height | number | Content height.|
### getTextContentLineCount<sup>10+</sup>
getTextContentLineCount(): number
Obtains the number of lines of the edited text.
**Return value**
| Type | Description |
| ----- | -------- |
| number| Number of lines of the edited text.|
## Example
```ts
......
......@@ -20,8 +20,8 @@ TextInput(value?:{placeholder?: ResourceStr, text?: ResourceStr, controller?: Te
| Name | Type | Mandatory | Description |
| ----------------------- | ---------------------------------------- | ---- | --------------- |
| placeholder | [ResourceStr](ts-types.md#resourcestr) | No | Placeholder text displayed when there is no input. |
| text | [ResourceStr](ts-types.md#resourcestr) | No | Current text input.<br>If the component has [stateStyles](ts-universal-attributes-polymorphic-style.md) or any other attribute that may trigger updating configured, you are advised to bind the state variable to the text in real time through the **onChange** event, so as to prevent display errors when the component is updated.<br>Since API version 10, this parameter supports [$$](../../quick-start/arkts-two-way-sync.md) for two-way binding of variables.|
| placeholder | [ResourceStr](ts-types.md#resourcestr) | No | Text displayed when there is no input. |
| text | [ResourceStr](ts-types.md#resourcestr) | No | Current text input.<br>If the component has [stateStyles](ts-universal-attributes-polymorphic-style.md) or any other attribute that may trigger updating configured, you are advised to bind the state variable to the text in real time through the **onChange** event, so as to prevent display errors when the component is updated.<br>Since API version 10, this parameter supports two-way binding through [$$](../../quick-start/arkts-two-way-sync.md).|
| controller<sup>8+</sup> | [TextInputController](#textinputcontroller8) | No | Text input controller.|
......@@ -54,7 +54,7 @@ Among the [universal attributes](ts-universal-attributes-size.md) and [universal
> **NOTE**
>
> The default value of the universal attribute [padding](ts-universal-attributes-size.md) is as follows: { top: 8 vp, right: 16 vp, bottom: 8 vp, left: 16 vp }
> The default value of the universal attribute [padding](ts-universal-attributes-size.md) is as follows: <br>{<br> top: 8 vp,<br> right: 16 vp,<br> bottom: 8 vp,<br> left: 16 vp<br> }
## EnterKeyType
......@@ -96,7 +96,7 @@ In addition to the [universal events](ts-universal-events-click.md), the followi
| Name | Description |
| ------------------------------------------------------------ | ------------------------------------------------------------ |
| onChange(callback: (value: string) =&gt; void) | Triggered when the input changes.<br>**value**: text content.<br>This event is triggered when any of the following conditions is met:<br>1. Keyboard input is received.<br>2. Paste and cut is performed.<br>3. Ctrl+V is pressed.|
| onChange(callback: (value: string) =&gt; void) | Triggered when the input in the text box changes.<br>**value**: text content.<br>This event is triggered when any of the following conditions is met:<br>1. Keyboard input is received.<br>2. Paste and cut is performed.<br>3. Ctrl+V is pressed.|
| onSubmit(callback: (enterKey: EnterKeyType) =&gt; void) | Triggered when the Enter key on the keyboard is pressed. The return value is the current type of the Enter key.<br>**enterKeyType**: type of the Enter key. For details, see [EnterKeyType](#enterkeytype).|
| onEditChanged(callback: (isEditing: boolean) =&gt; void)<sup>(deprecated)</sup> | Triggered when the input status changes. Since API version 8, **onEditChange** is recommended.|
| onEditChange(callback: (isEditing: boolean) =&gt; void)<sup>8+</sup> | Triggered when the input status changes. When the cursor is placed in the text box, it is in the editing state. Otherwise, it is in the non-editing state. If the value of **isEditing** is **true**, text input is in progress.|
......@@ -135,8 +135,8 @@ Sets the text selection area, which will be highlighted.
| Name | Type| Mandatory| Description |
| -------------- | -------- | ---- | ---------------------- |
| selectionStart | number | Yes | Start position of the text selection area. The start position of the text in the text box is 0.|
| selectionEnd | number | Yes | End position of the text selection area.|
| selectionStart | number | Yes | Start position of the text selection range. The start position of text in the text box is 0.|
| selectionEnd | number | Yes | End position of the text selection range.|
### stopEditing<sup>10+</sup>
......@@ -144,6 +144,47 @@ stopEditing(): void
Exits the editing state.
### getTextContentRect<sup>10+</sup>
getTextContentRect(): [RectResult](#rectresult10)
Obtains the position of the edited text area relative to the component and its size. The unit of the return value is pixel.
**Return value**
| Type | Description |
| ------------------- | -------- |
| [RectResult](#rectresult10) | Position of the edited text area relative to the component and its size.|
> **NOTE**
>
> - If no text is entered, the return value contains the position information, but the size is 0.
> - The position information is the offset of the first character relative to the editable area.
### RectResult<sup>10+</sup>
Describes the position and size.
| Parameter | Type | Description|
| ------- | ------ | ----------------------- |
| x | number | X coordinate.|
| y | number | Y coordinate.|
| width | number | Content width.|
| height | number | Content height.|
### getTextContentLineCount<sup>10+</sup>
getTextContentLineCount(): number
Obtains the number of lines of the edited text.
**Return value**
| Type | Description |
| ----- | -------- |
| number| Number of lines of the edited text.|
## Example
```ts
......
# ArkUI Subsystem Changelog
## cl.arkui.1 Support for the undefined Parameter by Universal Events
Added support for passing **undefined** as a parameter for universal events (click, touch, show/hide, key, focus, mouse, and component area change events).
**Example**
```ts
// xxx.ets
@Entry
@Component
struct Example {
build() {
Button("test")
.onClick(()=>{
console.log("click");
})
.onClick(undefined)
}
}
```
**Change Impact**
If the event callback parameter is **undefined**, the system will not respond to the configured event callback.
**Key API/Component Changes**
N/A
**Adaptation Guide**
If the event parameter is set to **undefined**, the event is disabled. Set the parameter based on the use case.
## cl.arkui.2 Initialization Requirement Change of @Prop/@BuilderParam Decorated Variables
**Example**
```ts
// xxx.ets
@Entry
@Component
struct Parent {
@State message: string = 'Parent'
build() {
Column() {
Child() // Compile time error.
}
}
}
@Component
struct Child {
@Prop message: string
build() {
Column() {
}
}
}
```
**Change Impact**
If the @Prop or @BuilderParam decorated variable is not initialized locally or initialized from its parent component, a compile time error will occur.
**Key API/Component Changes**
N/A
**Adaptation Guide**
Assign an initial value to the @Prop or @BuilderParam decorated variable or pass the value from the parent component.
## cl.arkui.3 Initial Value Requirement Change of @BuilderParam Decorated Variables
**Example**
```ts
// xxx.ets
@Builder
function builderFunction() {
Text('Hello Builder')
}
function normal () {
}
@Component
struct Index {
@BuilderParam builderParam: ()=>void = builderFunction
@BuilderParam builderParam2: ()=>void = normal // Compile time error.
build() {
Column() {
}
}
}
```
**Change Impact**
If the initial value of the @BuilderParam decorated variable is not an @Builder method, the compilation will fail.
**Key API/Component Changes**
N/A
**Adaptation Guide**
Pass in an @Builder method as the initial value of the @BuilderParam variable.
## cl.arkui.4 Type Change of the searchButton Attribute of the \<Search> Component from SearchButtonOption to SearchButtonOptions
**Change Impact**
If the **SearchButtonOption** type is explicitly used, the compilation will fail.
**Key API/Component Changes**
The type **SearchButtonOption** of the **searchButton** attribute is changed to **SearchButtonOptions**.
**Adaptation Guide**
Change **SearchButtonOption** to **SearchButtonOptions**.
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册