From d04aa8312e4e4385a3f2167533e3b5c6821833cc Mon Sep 17 00:00:00 2001 From: "ester.zhou" Date: Wed, 19 Jul 2023 19:35:58 +0800 Subject: [PATCH] Update docs (20374) Signed-off-by: ester.zhou --- .../arkui-ts/ts-basic-components-search.md | 45 +++++- .../arkui-ts/ts-basic-components-textarea.md | 46 +++++- .../arkui-ts/ts-basic-components-textinput.md | 53 ++++++- .../OpenHarmony_4.0.9.1/changelogs-arkui.md | 132 ++++++++++++++++++ 4 files changed, 266 insertions(+), 10 deletions(-) create mode 100644 en/release-notes/changelogs/OpenHarmony_4.0.9.1/changelogs-arkui.md diff --git a/en/application-dev/reference/arkui-ts/ts-basic-components-search.md b/en/application-dev/reference/arkui-ts/ts-basic-components-search.md index 733bb8ba86..39a42e0e1d 100644 --- a/en/application-dev/reference/arkui-ts/ts-basic-components-search.md +++ b/en/application-dev/reference/arkui-ts/ts-basic-components-search.md @@ -29,7 +29,7 @@ In addition to the [universal attributes](ts-universal-attributes-size.md), the | Name | Type | Description | | ----------------------- | ------------------------------------------------ | ---------------------------------------------- | -| searchButton10+ | value: string,
option?: [SearchButtonOption](#searchbuttonoption10) | Text on the search button located next to the search text box. By default, there is no search button. | +| searchButton10+ | value: string,
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.| -## SearchButtonOption10+ +## SearchButtonOptions10+ | Name | Type | Mandatory| Description | | --------- | ------------------------------------------ | ---- | ---------------- | @@ -111,6 +111,47 @@ stopEditing(): void Exits the editing state. +### getTextContentRect10+ + +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 **\** component. +> - If no text is entered, the return value contains the position information, but the size is 0. + +### RectResult10+ + +Describes the position and size. + +| Parameter | Type | Description| +| ------- | ------ | ----------------------- | +| x | number | X coordinate.| +| y | number | Y coordinate.| +| width | number | Content width.| +| height | number | Content height.| + + +### getTextContentLineCount10+ + +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 diff --git a/en/application-dev/reference/arkui-ts/ts-basic-components-textarea.md b/en/application-dev/reference/arkui-ts/ts-basic-components-textarea.md index cd906dd3c5..96f949ec3f 100644 --- a/en/application-dev/reference/arkui-ts/ts-basic-components-textarea.md +++ b/en/application-dev/reference/arkui-ts/ts-basic-components-textarea.md @@ -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.
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.
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.
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.
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.
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.
Since API version 10, this parameter supports two-way binding through [$$](../../quick-start/arkts-two-way-sync.md).| | controller8+ | [TextAreaController](#textareacontroller8) | No | Text area controller.| @@ -102,6 +102,48 @@ stopEditing(): void Exits the editing state. +### getTextContentRect10+ + +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. + +### RectResult10+ + +Describes the position and size. + +| Parameter | Type | Description| +| ------- | ------ | ----------------------- | +| x | number | X coordinate.| +| y | number | Y coordinate.| +| width | number | Content width.| +| height | number | Content height.| + + +### getTextContentLineCount10+ + +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 diff --git a/en/application-dev/reference/arkui-ts/ts-basic-components-textinput.md b/en/application-dev/reference/arkui-ts/ts-basic-components-textinput.md index f0f381f1ab..d09c8f9eb1 100644 --- a/en/application-dev/reference/arkui-ts/ts-basic-components-textinput.md +++ b/en/application-dev/reference/arkui-ts/ts-basic-components-textinput.md @@ -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.
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.
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.
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.
Since API version 10, this parameter supports two-way binding through [$$](../../quick-start/arkts-two-way-sync.md).| | controller8+ | [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:
{
top: 8 vp,
right: 16 vp,
bottom: 8 vp,
left: 16 vp
} ## EnterKeyType @@ -96,7 +96,7 @@ In addition to the [universal events](ts-universal-events-click.md), the followi | Name | Description | | ------------------------------------------------------------ | ------------------------------------------------------------ | -| onChange(callback: (value: string) => void) | Triggered when the input changes.
**value**: text content.
This event is triggered when any of the following conditions is met:
1. Keyboard input is received.
2. Paste and cut is performed.
3. Ctrl+V is pressed.| +| onChange(callback: (value: string) => void) | Triggered when the input in the text box changes.
**value**: text content.
This event is triggered when any of the following conditions is met:
1. Keyboard input is received.
2. Paste and cut is performed.
3. Ctrl+V is pressed.| | onSubmit(callback: (enterKey: EnterKeyType) => void) | Triggered when the Enter key on the keyboard is pressed. The return value is the current type of the Enter key.
**enterKeyType**: type of the Enter key. For details, see [EnterKeyType](#enterkeytype).| | onEditChanged(callback: (isEditing: boolean) => void)(deprecated) | Triggered when the input status changes. Since API version 8, **onEditChange** is recommended.| | onEditChange(callback: (isEditing: boolean) => void)8+ | 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.| ### stopEditing10+ @@ -144,6 +144,47 @@ stopEditing(): void Exits the editing state. +### getTextContentRect10+ + +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. + +### RectResult10+ + +Describes the position and size. + +| Parameter | Type | Description| +| ------- | ------ | ----------------------- | +| x | number | X coordinate.| +| y | number | Y coordinate.| +| width | number | Content width.| +| height | number | Content height.| + + +### getTextContentLineCount10+ + +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 diff --git a/en/release-notes/changelogs/OpenHarmony_4.0.9.1/changelogs-arkui.md b/en/release-notes/changelogs/OpenHarmony_4.0.9.1/changelogs-arkui.md new file mode 100644 index 0000000000..edaac9bc3f --- /dev/null +++ b/en/release-notes/changelogs/OpenHarmony_4.0.9.1/changelogs-arkui.md @@ -0,0 +1,132 @@ +# 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 \ 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**. -- GitLab