/* * Copyright (c) 2021-2023 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /** * @file * @kit ArkUI */ /*** if arkts 1.2 */ import { CommonConfiguration,CommonMethod,ShadowOptions,ContentModifier } from './common' import { ResourceColor,Length,ResourceStr } from './units' import { FontStyle,FontWeight } from './enums' /*** endif */ /** * Provides a way to control the process. * * @since 8 */ /** * Provides a way to control the process. * * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @form * @since 10 */ /** * Provides a way to control the process. * * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @form * @atomicservice * @since arkts {'1.1':'11','1.2':'20'} * @arkts 1.1&1.2 */ declare class TextTimerController { /** * constructor. * * @syscap SystemCapability.ArkUI.ArkUI.Full * @since 8 */ /** * constructor. * * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @form * @since 10 */ /** * constructor. * A constructor used to create a TextTimerController object. * * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @form * @atomicservice * @since arkts {'1.1':'11','1.2':'20'} * @arkts 1.1&1.2 */ constructor(); /** * Provides a start event for timer. * * @syscap SystemCapability.ArkUI.ArkUI.Full * @since 8 */ /** * Provides a start event for timer. * * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @form * @since 10 */ /** * Starts the timer. * * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @form * @atomicservice * @since 11 */ start(); /** * Provides a start event for timer. * * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @form * @atomicservice * @since 20 * @arkts 1.2 */ start():void; /** * Provides a pause event for timer. * * @syscap SystemCapability.ArkUI.ArkUI.Full * @since 8 */ /** * Provides a pause event for timer. * * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @form * @since 10 */ /** * Pauses the timer. * * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @form * @atomicservice * @since 11 */ pause(); /** * Provides a pause event for timer. * * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @form * @atomicservice * @since 20 * @arkts 1.2 */ pause():void; /** * Provides an event to reset timer. * * @syscap SystemCapability.ArkUI.ArkUI.Full * @since 8 */ /** * Provides an event to reset timer. * * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @form * @since 10 */ /** * Resets the timer. * * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @form * @atomicservice * @since 11 */ reset(); /** * Provides an event to reset timer. * * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @form * @atomicservice * @since 20 * @arkts 1.2 */ reset():void; } /** * TextTimerConfiguration used by content modifier. * * @extends CommonConfiguration * @interface TextTimerConfiguration * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice * @since arkts {'1.1':'12','1.2':'20'} * @arkts 1.1&1.2 */ declare interface TextTimerConfiguration extends CommonConfiguration { /** * Timer duration, in milliseconds. * It is effective only when isCountDown is true. * The maximum value is 86400000 ms (24 hours). * *

NOTE: *
If the value is between 0 and 86,400,000, it is used as the initial countdown time. *
Otherwise, the default value is used as the initial countdown time. *

* * @type { number } * @default 60000 * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice * @since arkts {'1.1':'12','1.2':'20'} * @arkts 1.1&1.2 */ count: number; /** * Whether the timer is a countdown. * The value true means that the timer counts down, * and false means that the timer counts up. * * @type { boolean } * @default false * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice * @since arkts {'1.1':'12','1.2':'20'} * @arkts 1.1&1.2 */ isCountDown: boolean; /** * Whether the timer has already started. * * @type { boolean } * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice * @since arkts {'1.1':'12','1.2':'20'} * @arkts 1.1&1.2 */ started: boolean; /** * Elapsed time of the timer, in the minimum unit of the format. * * @type { number } * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice * @since arkts {'1.1':'12','1.2':'20'} * @arkts 1.1&1.2 */ elapsedTime: number; } /** * Defines the options of TextTimer. * * @interface TextTimerOptions * @syscap SystemCapability.ArkUI.ArkUI.Full * @since 8 */ /** * Defines the options of TextTimer. * * @interface TextTimerOptions * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @form * @since 10 */ /** * Parameters of the TextTimer component. * * @interface TextTimerOptions * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @form * @atomicservice * @since arkts {'1.1':'11','1.2':'20'} * @arkts 1.1&1.2 */ interface TextTimerOptions { /** * Sets whether to countdown.The default value is false. * * @type { ?boolean } * @syscap SystemCapability.ArkUI.ArkUI.Full * @since 8 */ /** * Sets whether to countdown.The default value is false. * * @type { ?boolean } * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @form * @since 10 */ /** * Whether the timer is a countdown. * The value true means that the timer counts down, * and false means that the timer counts up. * * @type { ?boolean } - Default value: false * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @form * @atomicservice * @since arkts {'1.1':'11','1.2':'20'} * @arkts 1.1&1.2 */ isCountDown?: boolean; /** * Specifies the timer range. * In the non-countDown scenario, a negative value indicates that the timer is not limited. * The unit is millisecond. * * @type { ?number } * @syscap SystemCapability.ArkUI.ArkUI.Full * @since 8 */ /** * Specifies the timer range. * In the non-countDown scenario, a negative value indicates that the timer is not limited. * The unit is millisecond. * * @type { ?number } * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @form * @since 10 */ /** * Timer duration, in milliseconds. * It is effective only when isCountDown is true. * The maximum value is 86400000 ms (24 hours). * *

NOTE: *
If the value is between 0 and 86,400,000, it is used as the initial countdown time. *
Otherwise, the default value is used as the initial countdown time. *

* * @type { ?number } - Default value: 60000 * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @form * @atomicservice * @since arkts {'1.1':'11','1.2':'20'} * @arkts 1.1&1.2 */ count?: number; /** * Controller of Texttimer. * * @type { ?TextTimerController } * @syscap SystemCapability.ArkUI.ArkUI.Full * @since 8 */ /** * Controller of Texttimer. * * @type { ?TextTimerController } * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @form * @since 10 */ /** * TextTimer controller. * * @type { ?TextTimerController } * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @form * @atomicservice * @since arkts {'1.1':'11','1.2':'20'} * @arkts 1.1&1.2 */ controller?: TextTimerController; } /** * Provides an interface for texttimer containers. * * @interface TextTimerInterface * @syscap SystemCapability.ArkUI.ArkUI.Full * @since 8 */ /** * Provides an interface for texttimer containers. * * @interface TextTimerInterface * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @form * @since 10 */ /** * Provides an interface for texttimer containers. * * @interface TextTimerInterface * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @form * @atomicservice * @since arkts {'1.1':'11','1.2':'20'} * @arkts 1.1&1.2 */ interface TextTimerInterface { /** * Defines the TextTimer constructor. * * @param { TextTimerOptions } options * @returns { TextTimerAttribute } * @syscap SystemCapability.ArkUI.ArkUI.Full * @since 8 */ /** * Defines the TextTimer constructor. * * @param { TextTimerOptions } options * @returns { TextTimerAttribute } * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @form * @since 10 */ /** * A constructor used to create a TextTimerController object. * * @param { TextTimerOptions } options * @returns { TextTimerAttribute } * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @form * @atomicservice * @since arkts {'1.1':'11','1.2':'20'} * @arkts 1.1&1.2 */ (options?: TextTimerOptions): TextTimerAttribute; } /** * Defines the TextTimer attribute functions. * * @extends CommonMethod * @since 8 */ /** * Defines the TextTimer attribute functions. * * @extends CommonMethod * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @form * @since 10 */ /** * Defines the TextTimer attribute functions. * * @extends CommonMethod * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @form * @atomicservice * @since arkts {'1.1':'11','1.2':'20'} * @arkts 1.1&1.2 */ declare class TextTimerAttribute extends CommonMethod { /** * Set the display time format, for example, now is hh/mm/ss/ms and current: hh-mm-ss-ms. * The time format string can be hh, mm, ss, or ms. * * @param { string } value * @returns { TextTimerAttribute } * @syscap SystemCapability.ArkUI.ArkUI.Full * @since 8 */ /** * Set the display time format, for example, now is hh/mm/ss/ms and current: hh-mm-ss-ms. * The time format string can be hh, mm, ss, or ms. * * @param { string } value * @returns { TextTimerAttribute } * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @form * @since 10 */ /** * Sets the custom format. * The value must contain at least one of the following keywords: HH, mm, ss, and SS. * *

NOTE: *
If the specified date format is yy, MM, or dd, the default value is used instead. *

* * @param { string } value - Custom format.Default value: 'HH:mm:ss.SS' * @returns { TextTimerAttribute } * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @form * @atomicservice * @since arkts {'1.1':'11','1.2':'20'} * @arkts 1.1&1.2 */ format(value: string): TextTimerAttribute; /** * Called when the font color is set. * * @param { ResourceColor } value * @returns { TextTimerAttribute } * @syscap SystemCapability.ArkUI.ArkUI.Full * @since 8 */ /** * Called when the font color is set. * * @param { ResourceColor } value * @returns { TextTimerAttribute } * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @form * @since 10 */ /** * Sets the font color. * * @param { ResourceColor } value * @returns { TextTimerAttribute } * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @form * @atomicservice * @since arkts {'1.1':'11','1.2':'20'} * @arkts 1.1&1.2 */ fontColor(value: ResourceColor): TextTimerAttribute; /** * Called when the font size is set. * * @param { Length } value * @returns { TextTimerAttribute } * @syscap SystemCapability.ArkUI.ArkUI.Full * @since 8 */ /** * Called when the font size is set. * * @param { Length } value * @returns { TextTimerAttribute } * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @form * @since 10 */ /** * Sets the font size. * * @param { Length } value - Font size.The default font size is 16 fp. *
If fontSize is of the number type, the unit fp is used. *
The value cannot be a percentage. * @returns { TextTimerAttribute } * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @form * @atomicservice * @since arkts {'1.1':'11','1.2':'20'} * @arkts 1.1&1.2 */ fontSize(value: Length): TextTimerAttribute; /** * Called when the fontStyle is set * * @param { FontStyle } value * @returns { TextTimerAttribute } * @syscap SystemCapability.ArkUI.ArkUI.Full * @since 8 */ /** * Called when the fontStyle is set * * @param { FontStyle } value * @returns { TextTimerAttribute } * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @form * @since 10 */ /** * Sets the font style. * * @param { FontStyle } value - Font style.Default value: FontStyle.Normal * @returns { TextTimerAttribute } * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @form * @atomicservice * @since arkts {'1.1':'11','1.2':'20'} * @arkts 1.1&1.2 */ fontStyle(value: FontStyle): TextTimerAttribute; /** * Called when the fontWeight is set * * @param { number | FontWeight | string } value * @returns { TextTimerAttribute } * @syscap SystemCapability.ArkUI.ArkUI.Full * @since 8 */ /** * Called when the fontWeight is set * * @param { number | FontWeight | string } value * @returns { TextTimerAttribute } * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @form * @since 10 */ /** * Called when the fontWeight is set * * @param { number | FontWeight | string } value * @returns { TextTimerAttribute } * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @form * @atomicservice * @since 11 */ /** * Sets the font weight. * *

NOTE: *
If the value is too large, the text may be clipped depending on the font. *

* * @param { number | FontWeight | ResourceStr } value - Font weight. *
For the number type, Value range: [100, 900], at an interval of 100.The default value is 400. *
A larger value indicates a heavier font weight. *
For the string type, only strings that represent a number. * @returns { TextTimerAttribute } * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @form * @atomicservice * @since 20 * @arkts 1.1&1.2 */ fontWeight(value: number | FontWeight | ResourceStr): TextTimerAttribute; /** * Called when the fontFamily is set * * @param { ResourceStr } value * @returns { TextTimerAttribute } * @syscap SystemCapability.ArkUI.ArkUI.Full * @since 8 */ /** * Called when the fontFamily is set * * @param { ResourceStr } value * @returns { TextTimerAttribute } * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @form * @since 10 */ /** * Sets the font family. * * @param { ResourceStr } value - Font family. Default font: 'HarmonyOS Sans' * @returns { TextTimerAttribute } * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @form * @atomicservice * @since arkts {'1.1':'11','1.2':'20'} * @arkts 1.1&1.2 */ fontFamily(value: ResourceStr): TextTimerAttribute; /** * Called when the timer value is returned. * * @param { function } event * @returns { TextTimerAttribute } * @syscap SystemCapability.ArkUI.ArkUI.Full * @since 8 */ /** * Called when the timer value is returned. * * @param { function } event * @returns { TextTimerAttribute } * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @form * @since 10 */ /** * Triggered when the time text changes. * This event is not triggered when the screen is locked or the application is running in the background. * When high-precision formats (such as SSS or SS) are used, the callback interval may vary. * * @param { function } event * @returns { TextTimerAttribute } * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @form * @atomicservice * @since arkts {'1.1':'11','1.2':'20'} * @arkts 1.1&1.2 */ onTimer(event: (utc: number, elapsedTime: number) => void): TextTimerAttribute; /** * Called when the text shadow is set. * * @param { ShadowOptions | Array } value - The shadow options. * @returns { TextTimerAttribute } * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @since 11 */ /** * Sets the text shadow. * It supports input parameters in an array to implement multiple text shadows. * This API does not work with the fill attribute or coloring strategy. * * @param { ShadowOptions | Array } value - The shadow options. * @returns { TextTimerAttribute } * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice * @since arkts {'1.1':'12','1.2':'20'} * @arkts 1.1&1.2 */ textShadow(value: ShadowOptions | Array): TextTimerAttribute; /** * Creates a content modifier. * * @param { ContentModifier } modifier - The content modifier of texttimer. * @returns { TextTimerAttribute } * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice * @since arkts {'1.1':'12','1.2':'20'} * @arkts 1.1&1.2 */ contentModifier(modifier: ContentModifier): TextTimerAttribute; } /** * Defines TextTimer Component. * * @syscap SystemCapability.ArkUI.ArkUI.Full * @since 8 */ /** * Defines TextTimer Component. * * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @form * @since 10 */ /** * Defines TextTimer Component. * * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @form * @atomicservice * @since 11 */ declare const TextTimer: TextTimerInterface; /** * Defines TextTimer Component instance. * * @syscap SystemCapability.ArkUI.ArkUI.Full * @since 8 */ /** * Defines TextTimer Component instance. * * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @form * @since 10 */ /** * Defines TextTimer Component instance. * * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @form * @atomicservice * @since 11 */ declare const TextTimerInstance: TextTimerAttribute;