/*
* Copyright (c) 2026 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
*/
/**
* Enum for the CounterV2 type.
*
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @stagemodelonly
* @crossplatform
* @atomicservice
* @since 26.0.0 dynamic
*/
declare enum CounterV2Type {
/**
* List counter.
*
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @stagemodelonly
* @crossplatform
* @atomicservice
* @since 26.0.0 dynamic
*/
LIST = 0,
/**
* Compact counter.
*
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @stagemodelonly
* @crossplatform
* @atomicservice
* @since 26.0.0 dynamic
*/
COMPACT = 1,
/**
* Inline counter.
*
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @stagemodelonly
* @crossplatform
* @atomicservice
* @since 26.0.0 dynamic
*/
INLINE = 2,
/**
* Date inline counter.
*
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @stagemodelonly
* @crossplatform
* @atomicservice
* @since 26.0.0 dynamic
*/
INLINE_DATE = 3
}
/**
* The hover callback of CounterV2.
*
* @param { boolean } isHover - isHover
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @stagemodelonly
* @crossplatform
* @atomicservice
* @since 26.0.0 dynamic
*/
export type OnCounterV2HoverCallback = (isHover: boolean) => void;
/**
* Defines the common options.
*
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @stagemodelonly
* @crossplatform
* @atomicservice
* @since 26.0.0 dynamic
*/
declare class CounterV2CommonOptions {
/**
* Set the focusable of the counter component.
*
* @default true
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @stagemodelonly
* @crossplatform
* @atomicservice
* @since 26.0.0 dynamic
*/
focusable?: boolean;
/**
* Set the step of the counter component, ranges greater than or equal to 1
*
* @default 1
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @stagemodelonly
* @crossplatform
* @atomicservice
* @since 26.0.0 dynamic
*/
step?: int;
/**
* Trigger a mouse hover event at the increase button.
*
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @stagemodelonly
* @crossplatform
* @atomicservice
* @since 26.0.0 dynamic
*/
onHoverIncrease?: OnCounterV2HoverCallback;
/**
* Trigger a mouse hover event at the decrease button.
*
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @stagemodelonly
* @crossplatform
* @atomicservice
* @since 26.0.0 dynamic
*/
onHoverDecrease?: OnCounterV2HoverCallback;
}
/**
* The change callback of the inline CounterV2.
*
* @param { int } value - value.
* <br>The value should be an integer.
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @stagemodelonly
* @crossplatform
* @atomicservice
* @since 26.0.0 dynamic
*/
export type OnInlineCounterV2Change = (value: int) => void;
/**
* Defines the inline style options.
*
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @stagemodelonly
* @crossplatform
* @atomicservice
* @since 26.0.0 dynamic
*/
declare class CounterV2InlineStyleOptions extends CounterV2CommonOptions {
/**
* Set initial value of the counter component, ranges from min to max.
*
* @default 0
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @stagemodelonly
* @crossplatform
* @atomicservice
* @since 26.0.0 dynamic
*/
value?: int;
/**
* Set minimum value of the counter component
*
* @default 0
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @stagemodelonly
* @crossplatform
* @atomicservice
* @since 26.0.0 dynamic
*/
min?: int;
/**
* Set maximum value of the counter component
*
* @default 999
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @stagemodelonly
* @crossplatform
* @atomicservice
* @since 26.0.0 dynamic
*/
max?: int;
/**
* Set text width of the counter component, ranges greater than or equal to 0.
* If undefined is passed, the text width will adapt to the text content.
*
* @default undefined
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @stagemodelonly
* @crossplatform
* @atomicservice
* @since 26.0.0 dynamic
*/
textWidth?: double;
/**
* Trigger an event when the value of the counter has been changed.
*
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @stagemodelonly
* @crossplatform
* @atomicservice
* @since 26.0.0 dynamic
*/
onChange?: OnInlineCounterV2Change;
}
/**
* Defines the number style options.
*
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @stagemodelonly
* @crossplatform
* @atomicservice
* @since 26.0.0 dynamic
*/
declare class CounterV2NumberStyleOptions extends CounterV2InlineStyleOptions {
/**
* Set the label of the counter component.
*
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @stagemodelonly
* @crossplatform
* @atomicservice
* @since 26.0.0 dynamic
*/
label?: ResourceStr;
/**
* Trigger an event when the increase button gets focus.
*
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @stagemodelonly
* @crossplatform
* @atomicservice
* @since 26.0.0 dynamic
*/
onFocusIncrease?: VoidCallback;
/**
* Trigger an event when the decrease button gets focus.
*
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @stagemodelonly
* @crossplatform
* @atomicservice
* @since 26.0.0 dynamic
*/
onFocusDecrease?: VoidCallback;
/**
* Trigger an event when the increase button loses focus.
*
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @stagemodelonly
* @crossplatform
* @atomicservice
* @since 26.0.0 dynamic
*/
onBlurIncrease?: VoidCallback;
/**
* Trigger an event when the decrease button loses focus.
*
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @stagemodelonly
* @crossplatform
* @atomicservice
* @since 26.0.0 dynamic
*/
onBlurDecrease?: VoidCallback;
}
/**
* Defines the date data.
*
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @stagemodelonly
* @crossplatform
* @atomicservice
* @since 26.0.0 dynamic
*/
declare class CounterV2DateData {
/**
* The year of the DateData, ranges from 1 to 5000.
*
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @stagemodelonly
* @crossplatform
* @atomicservice
* @since 26.0.0 dynamic
*/
year: int;
/**
* The month of the DateData.
*
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @stagemodelonly
* @crossplatform
* @atomicservice
* @since 26.0.0 dynamic
*/
month: int;
/**
* The day of the DateData.
*
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @stagemodelonly
* @crossplatform
* @atomicservice
* @since 26.0.0 dynamic
*/
day: int;
/**
* Constructor of the DateData.
*
* @param { int } year - set the year of the DateData.
* @param { int } month - set the month of the DateData.
* @param { int } day - set the day of the DateData.
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @stagemodelonly
* @crossplatform
* @atomicservice
* @since 26.0.0 dynamic
*/
constructor(year: int, month: int, day: int);
/**
* Convert the date data to string.
*
* @returns { string } date data in string form.
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @stagemodelonly
* @crossplatform
* @atomicservice
* @since 26.0.0 dynamic
*/
toString(): string;
}
/**
* The change callback of the date style counter.
*
* @param { CounterV2DateData } date - date
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @stagemodelonly
* @crossplatform
* @atomicservice
* @since 26.0.0 dynamic
*/
export type OnDateCounterV2ChangeCallback = (date: CounterV2DateData) => void;
/**
* Defines the date style options.
*
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @stagemodelonly
* @crossplatform
* @atomicservice
* @since 26.0.0 dynamic
*/
declare class CounterV2DateStyleOptions extends CounterV2CommonOptions {
/**
* Set the year of the counter component, ranges from 1 to 5000.
*
* @default 1
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @stagemodelonly
* @crossplatform
* @atomicservice
* @since 26.0.0 dynamic
*/
year?: int;
/**
* Set the month of the counter component.
*
* @default 1
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @stagemodelonly
* @crossplatform
* @atomicservice
* @since 26.0.0 dynamic
*/
month?: int;
/**
* Set the day of the counter component.
*
* @default 1
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @stagemodelonly
* @crossplatform
* @atomicservice
* @since 26.0.0 dynamic
*/
day?: int;
/**
* Trigger an event when the date of the counter has been changed.
*
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @stagemodelonly
* @crossplatform
* @atomicservice
* @since 26.0.0 dynamic
*/
onDateChange?: OnDateCounterV2ChangeCallback;
}
/**
* Defines the counter options.
*
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @stagemodelonly
* @crossplatform
* @atomicservice
* @since 26.0.0 dynamic
*/
declare class CounterV2Options {
/**
* Set the type of the counter component.
*
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @stagemodelonly
* @crossplatform
* @atomicservice
* @since 26.0.0 dynamic
*/
type: CounterV2Type;
/**
* Set the counter attribute of the LIST or COMPACT counter component.
*
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @stagemodelonly
* @crossplatform
* @atomicservice
* @since 26.0.0 dynamic
*/
numberOptions?: CounterV2NumberStyleOptions;
/**
* Set the counter attribute of the INLINE counter component.
*
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @stagemodelonly
* @crossplatform
* @atomicservice
* @since 26.0.0 dynamic
*/
inlineOptions?: CounterV2InlineStyleOptions;
/**
* Set the counter attribute of the INLINE_DATE counter component.
*
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @stagemodelonly
* @crossplatform
* @atomicservice
* @since 26.0.0 dynamic
*/
dateOptions?: CounterV2DateStyleOptions;
/**
* Indicates the attribute of the current counter direction.
*
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @stagemodelonly
* @crossplatform
* @atomicservice
* @since 26.0.0 dynamic
*/
direction?: Direction;
}
/**
* Defines Counter Component.
*
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @stagemodelonly
* @crossplatform
* @atomicservice
* @since 26.0.0 dynamic
*/
@ComponentV2
declare struct CounterV2Component {
/**
* The options of a counter component.
*
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @stagemodelonly
* @crossplatform
* @atomicservice
* @since 26.0.0 dynamic
*/
@Param
options: CounterV2Options;
}
export {
CounterV2Component,
CounterV2Options,
CounterV2DateData,
CounterV2Type
}