From 9ef5a477c14a8d11d6cbb5ea44c197e7cdec3516 Mon Sep 17 00:00:00 2001 From: "ester.zhou" Date: Fri, 8 Apr 2022 11:14:00 +0800 Subject: [PATCH] update docs Signed-off-by: ester.zhou --- .../arkui-ts/ts-basic-components-textarea.md | 31 +++++--- .../arkui-ts/ts-basic-components-textclock.md | 36 ++++++--- .../arkui-ts/ts-basic-components-texttimer.md | 64 +++++++++------ .../reference/arkui-ts/ts-container-tabs.md | 30 ++++--- .../arkui-ts/ts-media-components-video.md | 78 ++++++++++++++++--- 5 files changed, 176 insertions(+), 63 deletions(-) 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 e6fd236223..9acf78b975 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 @@ -49,15 +49,6 @@ In addition to [universal attributes](ts-universal-attributes-index.md), the fol | End | Align the tail horizontally. | -### TextAreaController8+ - -Defines the controller for controlling the **<TextArea>** component. - -| Name | Description | -| -------- | -------- | -| caretPosition(value: number): void | Position of the input cursor.
**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. | onCut8+(callback:(value: string) => void) | Triggered when the cut button on the pasteboard, which displays when the text box is long pressed, is clicked.
**value**: text to be cut. | | onPaste8+(callback:(value: string) => void) | Triggered when the paste button on the pasteboard, which displays when the text box is long pressed, is clicked.
**value**: text to be pasted. | +## TextAreaController8+ + +Defines the controller for controlling the **<TextArea>** component. + +### Objects to Import + +``` +controller: TextAreaController = new TextAreaController() + +``` + +### caretPosition8+ + +caretPosition(value: number): void + +Sets the position of the caret. + +- Parameters + | Name | Type | Mandatory | Default Value | Description | + | ----- | ------ | ---- | ---- | ------------------- | + | value | number | Yes | - | Length from the start of the string to the position where the input cursor is located. | + ## Example diff --git a/en/application-dev/reference/arkui-ts/ts-basic-components-textclock.md b/en/application-dev/reference/arkui-ts/ts-basic-components-textclock.md index 6f23dd45ae..32e8897dfc 100644 --- a/en/application-dev/reference/arkui-ts/ts-basic-components-textclock.md +++ b/en/application-dev/reference/arkui-ts/ts-basic-components-textclock.md @@ -18,32 +18,46 @@ TextClock(options?: {timeZoneOffset?: number, contorller?: TextClockController}) - Parameters - | Name| Type| Mandatory| Default Value| Description| + | 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 **** component.| ## Attributes -| Name| Type| Default Value| Description| +| Name | Type| Default Value | Description | | ------ | -------- | -------- | ------------------------------------------------------------ | | format | string | 'hhmmss' | Time format, for example, **yyyy/mm/dd** or **yyyy-mm-dd**. Supported time format strings:
  • yyyy (year)
  • mm (two-letter abbreviated month name)
  • mmm (three-letter abbreviated month name)
  • mmmm (full month name)
  • dd (two-letter abbreviated day of the week)
  • ddd (three-letter abbreviated day of the week)
  • dddd (full day of the week)
  • HH (24-hour format)
  • hh (12-hour format)
  • MM/mm (minute)
  • SS/ss (second)
| +## Events + +| Name | Description | +| -------------------------------------------- | ------------------------------------------------------------ | +| onDateChange(event: (value: number) => void) | Triggered when the time changes in seconds at minimum.
**value**: Unix time stamp, which is the number of milliseconds that have elapsed since the Unix epoch.| + ## TextClockController Controller of the **** component, which can be bound to the component for status control. -| API| Description| -| -------------------------------------------- | ------------------------------------------------------------ | -| start() | Starts the **** component.| -| stop() | Stops the **** component.| +### Objects to Import +``` +controller: TextClockController = new TextClockController() -## Events +``` + +### start + +start() + +Starts the **** component. + +### stop + +stop() + +Stops the **** component. -| Name| Description| -| -------------------------------------------- | ------------------------------------------------------------ | -| onDateChange(event: (value: number) => void) | Triggered when the time changes in seconds at minimum.
value: Unix time stamp, which is the number of milliseconds that have elapsed since the Unix epoch.| ## Example diff --git a/en/application-dev/reference/arkui-ts/ts-basic-components-texttimer.md b/en/application-dev/reference/arkui-ts/ts-basic-components-texttimer.md index 0fef4104bb..9664340b21 100644 --- a/en/application-dev/reference/arkui-ts/ts-basic-components-texttimer.md +++ b/en/application-dev/reference/arkui-ts/ts-basic-components-texttimer.md @@ -23,36 +23,54 @@ None TextTimer(options: { isCountDown?: boolean, count?: number, controller?: TextTimerController }) - Parameters - | Name | Type | Mandatory | Default Value | Description | + | Name | Type | Mandatory | Default Value | Description | | -------- | -------- | -------- | -------- | -------- | - | isCountDown | boolean | No | false | Whether to count down. | - | count | number | No | 60000 | Countdown time, in milliseconds. This parameter is valid only when **isCountDown** is set to **true**.
- If the value of **count** is less than or equal to 0, the default value is used.
- If the value of **count** is greater than 0, it is used. | - | controller | [TextTimerController](#texttimercontroller) | No | null | **<TextTimer>** controller. | + | isCountDown | boolean | No | false | Whether to count down. | + | count | number | No | 60000 | Countdown time, in milliseconds. This parameter is valid only when **isCountDown** is set to **true**.
- If the value of **count** is less than or equal to 0, the default value is used.
- If the value of **count** is greater than 0, it is used. | + | controller | [TextTimerController](#texttimercontroller) | No | null | **<TextTimer>** controller. | +## Attributes -### TextTimerController +| 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**. | -Defines the controller for controlling the **<TextTimer>** component. - | Name | Description | +## Events + +| Name | Description | | -------- | -------- | -| start() | Starts the timer. | -| pause() | Pauses the timer. | -| reset() | Resets the timer. | +| onTimer(callback: (utc: number, elapsedTime: number) => void) | Triggered when the time text changes.
**utc**: currently displayed time, in milliseconds.
**elapsedTime**: elapsed time of the timer, in milliseconds. | -## Attributes +## TextTimerController - | 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**. | +Defines the controller for controlling the **<TextTimer>** component. +### Objects to Import -## Events +``` +textTimerController: TextTimerController = new TextTimerController() - | Name | Description | -| -------- | -------- | -| onTimer(callback: (utc: number, elapsedTime: number) => void) | Triggered when the time text changes.
**utc**: currently displayed time, in milliseconds.
**elapsedTime**: elapsed time of the timer, in milliseconds. | +``` + +### 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() @State format: string = 'hh:mm:ss.ms' build() { Column() { - TextTimer({controller: this.myTimerController}) + TextTimer({controller: this.textTimerController}) .format(this.format) .fontColor(Color.Black) .fontSize(this.textSize) @@ -76,13 +94,13 @@ struct TextTimerExample { }) Row() { Button("start").onClick(() => { - this.myTimerController.start(); + this.textTimerController.start(); }); Button("pause").onClick(() => { - this.myTimerController.pause(); + this.textTimerController.pause(); }); Button("reset").onClick(() => { - this.myTimerController.reset(); + this.textTimerController.reset(); }); } } diff --git a/en/application-dev/reference/arkui-ts/ts-container-tabs.md b/en/application-dev/reference/arkui-ts/ts-container-tabs.md index 42797131ce..4f797a9f48 100644 --- a/en/application-dev/reference/arkui-ts/ts-container-tabs.md +++ b/en/application-dev/reference/arkui-ts/ts-container-tabs.md @@ -36,15 +36,6 @@ Tabs(value: {barPosition?: BarPosition, index?: number, controller?: [TabsContro | 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 | + | -------- | -------- | -------- | -------- | -------- | + | value | number | Yes | - | Index of a tab. The value starts from **0**. | + ## Example diff --git a/en/application-dev/reference/arkui-ts/ts-media-components-video.md b/en/application-dev/reference/arkui-ts/ts-media-components-video.md index 129b48228f..461eac8e50 100644 --- a/en/application-dev/reference/arkui-ts/ts-media-components-video.md +++ b/en/application-dev/reference/arkui-ts/ts-media-components-video.md @@ -61,21 +61,77 @@ Video(value: VideoOptions) | onUpdate(event?: { time: number }) => void | Triggered once per 250 ms when the playback progress changes. The unit of the current playback time is second. | -### VideoController +## VideoController -> ![icon-note.gif](public_sys-resources/icon-note.gif) **NOTE** -> A **VideoController** object can control one or more videos. +A **VideoController** object can control one or more videos. -| Name | Description | -| -------- | -------- | -| start() : void | Starts playback. | -| pause() : void | Pauses playback. | -| stop() : void | Stops playback. | -| setCurrentTime(value: number) | Sets the video playback position. | -| setCurrentTime(value: number, seekMode: SeekMode)8+ | Sets the video playback position with the specified seek mode. | + +### Objects to Import + +``` +controller: VideoController = new VideoController(); +``` + +### start + +start(): void + +Starts playback. + +### pause + +pause(): void + +Pauses playback. + +### stop + +stop(): void + +Stops playback. + +### setCurrentTime + +setCurrentTime(value: number) + +Sets the video playback position. + +- Parameters + | Name | Type | Mandatory | Default Value | Description | + | -------- | -------- | -------- | -------- | -------- | + | value | number | Yes | - | Video playback position. | + +### requestFullscreen + +requestFullscreen(value: boolean) + +Requests full-screen mode. + +- Parameters + | Name | Type | Mandatory | Default Value | Description | + | -------- | -------- | -------- | -------- | -------- | + | value | number | Yes | false | Whether the playback is in full-screen mode. | + +### exitFullscreen + +exitFullscreen() + +Exits full-screen mode. + +### setCurrentTime8+ + +setCurrentTime(value: number, seekMode: SeekMode) + +Sets the video playback position with the specified seek mode. + +- Parameters + | Name | Type | Mandatory | Default Value | Description | + | -------- | -------- | -------- | -------- | -------- | + | value | number | Yes | - | Video playback position. | + | seekMode | SeekMode | Yes | - | Seek mode. | - SeekMode8+ - | Name | Description | + | Name | Description | | -------- | -------- | | PreviousKeyframe | Seeks to the nearest previous keyframe. | | NextKeyframe | Seeks to the nearest next keyframe. | -- GitLab