@@ -49,15 +49,6 @@ In addition to [universal attributes](ts-universal-attributes-index.md), the fol
| End | Align the tail horizontally. |
### TextAreaController<sup>8+</sup>
Defines the controller for controlling the **<TextArea>** component.
| Name | Description |
| -------- | -------- |
| caretPosition(value: number): void | Position of the input cursor.<br/>**value**: indicates the length from the start of the string to the position where the input cursor is located. |
## Events
| Name | Description |
...
...
@@ -67,6 +58,28 @@ Defines the controller for controlling the **<TextArea>** component.
| onCut<sup>8+</sup>(callback:(value: string) => void) | Triggered when the cut button on the pasteboard, which displays when the text box is long pressed, is clicked.<br/>**value**: text to be cut. |
| onPaste<sup>8+</sup>(callback:(value: string) => void) | Triggered when the paste button on the pasteboard, which displays when the text box is long pressed, is clicked.<br/>**value**: text to be pasted. |
## TextAreaController<sup>8+</sup>
Defines the controller for controlling the **<TextArea>** component.
### Objects to Import
```
controller: TextAreaController = new TextAreaController()
```
### caretPosition<sup>8+</sup>
caretPosition(value: number): void
Sets the position of the caret.
- Parameters
| Name | Type | Mandatory | Default Value | Description |
| timeZoneOffset | number | No| Time zone offset| Sets the time zone offset. The value range is [-14, 12], indicating UTC+12 to UTC-12. A negative value indicates Eastern Standard Time, and a positive value indicates Western Standard Time. For example, **-8** indicates UTC+8. For countries or regions crossing the International Date Line, use -13 (UTC+13) and -14 (UTC+14) to ensure consistent time within the entire country or region.|
| timeZoneOffset | number | No| Time zone offset| Sets the time zone offset. The value range is [-14, 12], indicating UTC+12 to UTC-12. A negative value indicates Eastern Standard Time, and a positive value indicates Western Standard Time. For example, **-8** indicates UTC+8. For countries or regions crossing the International Date Line, use -13 (UTC+13) and -14 (UTC+14) to ensure consistent time within the entire country or region.|
| contorller | [TextClockContorller](#TextClockController) | No| null | Binds a controller to control the status of the **<TextClock\>** component.|
| format | string | 'hhmmss' | Time format, for example, **yyyy/mm/dd** or **yyyy-mm-dd**. Supported time format strings: <ul><li>yyyy (year)</li><li>mm (two-letter abbreviated month name)</li><li>mmm (three-letter abbreviated month name)</li><li>mmmm (full month name)</li><li>dd (two-letter abbreviated day of the week)</li><li>ddd (three-letter abbreviated day of the week)</li><li>dddd (full day of the week)</li><li>HH (24-hour format)</li><li>hh (12-hour format)</li><li>MM/mm (minute)</li><li>SS/ss (second)</li></ul>|
| onDateChange(event: (value: number) => void) | Triggered when the time changes in seconds at minimum.<br>**value**: Unix time stamp, which is the number of milliseconds that have elapsed since the Unix epoch.|
## TextClockController
Controller of the **<TextClock\>** component, which can be bound to the component for status control.
| onDateChange(event: (value: number) => void) | Triggered when the time changes in seconds at minimum. <br/> value: Unix time stamp, which is the number of milliseconds that have elapsed since the Unix epoch.|
| count | number | No | 60000 | Countdown time, in milliseconds. This parameter is valid only when **isCountDown** is set to **true**.<br/>- If the value of **count** is less than or equal to 0, the default value is used.<br/>- If the value of **count** is greater than 0, it is used. |
Defines the controller for controlling the **<TextTimer>** component.
| Name | Description |
| -------- | -------- |
| start() | Starts the timer. |
| pause() | Pauses the timer. |
| reset() | Resets the timer. |
## Attributes
| Name | Type | Default Value | Description |
| Name | Type | Default Value | Description |
| -------- | -------- | -------- | -------- |
| format | string | 'hh:mm:ss.ms' | Custom format. The value must contain at least one of the following keywords: **hh**, **mm**, **ss**, and **ms**. |
## Events
| Name | Description |
| Name | Description |
| -------- | -------- |
| onTimer(callback: (utc: number, elapsedTime: number) => void) | Triggered when the time text changes.<br/>**utc**: currently displayed time, in milliseconds.<br/>**elapsedTime**: elapsed time of the timer, in milliseconds. |
## TextTimerController
Defines the controller for controlling the **<TextTimer>** component.
### Objects to Import
```
textTimerController: TextTimerController = new TextTimerController()
```
### start
start()
Starts the timer.
### pause
pause()
Pauses the timer.
### reset
reset()
Resets the timer.
## Example
...
...
@@ -62,12 +80,12 @@ Defines the controller for controlling the **<TextTimer>** component.
@Entry
@Component
struct TextTimerExample {
myTimerController: TextTimerController = new TextTimerController()
textTimerController: TextTimerController = new TextTimerController()
| End | If the **vertical** attribute is set to **true**, the tab is on the right of the container. If the **vertical** attribute is set to **false**, the tab is at the bottom of the container. |
### TabsController
Defines a tab controller, which is used to control switching of tabs.
| API | Description |
| -------- | -------- |
| changeIndex(value: number): void | Changes the index of a tab. The value starts from **0**. |
## Attributes
Touch target configuration is not supported.
...
...
@@ -71,6 +62,27 @@ Touch target configuration is not supported.
| -------- | -------- |
| onChange(callback: (index: number) => void) | Event triggered when a tab is switched. |
## TabsController
Defines a tab controller, which is used to control switching of tabs.
### Objects to Import
```
controller: TabsController = new TabsController()
```
### changeIndex
changeIndex(value: number): void
Switches to the specified tab.
- Parameters
| Name | Type | Mandatory | Default Value | Description |
| onUpdate(event?: { time: number }) => void | Triggered once per 250 ms when the playback progress changes. The unit of the current playback time is second. |