/* * 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 { Rectangle, AnimateParam, Callback, ShadowOptions, ShadowStyle, KeyboardAvoidMode, BlurStyle, HoverModeAreaType, DismissReason, BackgroundBlurStyleOptions, BackgroundEffectOptions } from './common'; import { CustomBuilder } from './builder'; import { DialogAlignment } from './alertDialog'; import { Offset, ResourceColor, Dimension, BorderRadiuses, EdgeWidths, EdgeColors, EdgeStyles } from './units'; import { BorderStyle } from './enums'; import { LengthMetrics } from '../Graphics'; import { LevelMode, LevelOrder, ImmersiveMode } from '../../@ohos.promptAction'; import { CustomBuilder } from './builder'; /*** endif */ /** * Defines the options of CustomDialogController. * * @interface CustomDialogControllerOptions * @syscap SystemCapability.ArkUI.ArkUI.Full * @since 7 */ /** * Defines the options of CustomDialogController. * * @interface CustomDialogControllerOptions * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @since 10 */ /** * Defines the options of CustomDialogController. * * @interface CustomDialogControllerOptions * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice * @since arkts {'1.1':'11','1.2':'20'} * @arkts 1.1&1.2 */ declare interface CustomDialogControllerOptions { /** * Custom builder function. * * @type { any } * @syscap SystemCapability.ArkUI.ArkUI.Full * @since 7 */ /** * Custom builder function. * * @type { any } * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @since 10 */ /** * Custom builder function. * * @type { any } * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice * @since 11 */ builder: any; /** * Custom builder function. * * @type { CustomBuilder } * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice * @since 20 * @arkts 1.2 */ builder: CustomBuilder; /** * Defines the cancel function. * * @type { ?function } * @syscap SystemCapability.ArkUI.ArkUI.Full * @since 7 */ /** * Defines the cancel function. * * @type { ?function } * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @since 10 */ /** * Defines the cancel function. * * @type { ?function } * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice * @since arkts {'1.1':'11','1.2':'20'} * @arkts 1.1&1.2 */ cancel?: () => void; /** * Defines if use auto cancel when click on the outside of the dialog. * * @type { ?boolean } * @syscap SystemCapability.ArkUI.ArkUI.Full * @since 7 */ /** * Defines if use auto cancel when click on the outside of the dialog. * * @type { ?boolean } * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @since 10 */ /** * Defines if use auto cancel when click on the outside of the dialog. * * @type { ?boolean } * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice * @since arkts {'1.1':'11','1.2':'20'} * @arkts 1.1&1.2 */ autoCancel?: boolean; /** * Defines the dialog alignment of the screen. * * @type { ?DialogAlignment } * @syscap SystemCapability.ArkUI.ArkUI.Full * @since 7 */ /** * Defines the dialog alignment of the screen. * * @type { ?DialogAlignment } * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @since 10 */ /** * Defines the dialog alignment of the screen. * * @type { ?DialogAlignment } * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice * @since arkts {'1.1':'11','1.2':'20'} * @arkts 1.1&1.2 */ alignment?: DialogAlignment; /** * Defines the dialog offset. * * @type { ?Offset } * @syscap SystemCapability.ArkUI.ArkUI.Full * @since 7 */ /** * Defines the dialog offset. * * @type { ?Offset } * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @since 10 */ /** * Defines the dialog offset. * * @type { ?Offset } * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice * @since arkts {'1.1':'11','1.2':'20'} * @arkts 1.1&1.2 */ offset?: Offset; /** * Defines if use custom style. * * @type { ?boolean } * @syscap SystemCapability.ArkUI.ArkUI.Full * @since 7 */ /** * Defines if use custom style. * * @type { ?boolean } * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @since 10 */ /** * Defines if use custom style. * * @type { ?boolean } * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice * @since arkts {'1.1':'11','1.2':'20'} * @arkts 1.1&1.2 */ customStyle?: boolean; /** * Grid count of dialog. * * @type { ?number } * @syscap SystemCapability.ArkUI.ArkUI.Full * @since 8 */ /** * Grid count of dialog. * * @type { ?number } * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @since 10 */ /** * Grid count of dialog. * * @type { ?number } * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice * @since arkts {'1.1':'11','1.2':'20'} * @arkts 1.1&1.2 */ gridCount?: number; /** * Mask color of dialog. * * @type { ?ResourceColor } * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @since 10 */ /** * Mask color of dialog. * * @type { ?ResourceColor } * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice * @since arkts {'1.1':'11','1.2':'20'} * @arkts 1.1&1.2 */ maskColor?: ResourceColor; /** * Mask Region of dialog. The size cannot exceed the main window. * * @type { ?Rectangle } * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @since 10 */ /** * Mask Region of dialog. The size cannot exceed the main window. * * @type { ?Rectangle } * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice * @since arkts {'1.1':'11','1.2':'20'} * @arkts 1.1&1.2 */ maskRect?: Rectangle; /** * Animation parameters of dialog opening. * * @type { ?AnimateParam } * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @since 10 */ /** * Animation parameters of dialog opening. * * @type { ?AnimateParam } * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice * @since arkts {'1.1':'11','1.2':'20'} * @arkts 1.1&1.2 */ openAnimation?: AnimateParam; /** * Animation parameters of dialog closing. * * @type { ?AnimateParam } * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @since 10 */ /** * Animation parameters of dialog closing. * * @type { ?AnimateParam } * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice * @since arkts {'1.1':'11','1.2':'20'} * @arkts 1.1&1.2 */ closeAnimation?: AnimateParam; /** * Whether to display in the sub window. * * @type { ?boolean } * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @since 10 */ /** * Whether to display in the sub window. * * @type { ?boolean } * @default false * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice * @since arkts {'1.1':'11','1.2':'20'} * @arkts 1.1&1.2 */ showInSubWindow?: boolean; /** * Background color of dialog. * * @type { ?ResourceColor } * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @since 10 */ /** * Background color of dialog. * * @type { ?ResourceColor } * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice * @since arkts {'1.1':'11','1.2':'20'} * @arkts 1.1&1.2 */ backgroundColor?: ResourceColor; /** * Corner radius of dialog. * * @type { ?(Dimension | BorderRadiuses) } * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @since 10 */ /** * Corner radius of dialog. * * @type { ?(Dimension | BorderRadiuses) } * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice * @since arkts {'1.1':'11','1.2':'20'} * @arkts 1.1&1.2 */ cornerRadius?: Dimension | BorderRadiuses; /** * Whether it is a modal dialog * @type { ?boolean } * @default true * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @since 11 */ /** * Whether it is a modal dialog * @type { ?boolean } * @default true * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice * @since arkts {'1.1':'12','1.2':'20'} * @arkts 1.1&1.2 */ isModal?: boolean; /** * Callback function when the CustomDialog interactive dismiss. * * @type { ?Callback } * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice * @since arkts {'1.1':'12','1.2':'20'} * @arkts 1.1&1.2 */ onWillDismiss?: Callback; /** * Defines the custom dialog's width. * * @type { ?Dimension } * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice * @since arkts {'1.1':'12','1.2':'20'} * @arkts 1.1&1.2 */ width?: Dimension; /** * Defines the custom dialog's height. * * @type { ?Dimension } * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice * @since arkts {'1.1':'12','1.2':'20'} * @arkts 1.1&1.2 */ height?: Dimension; /** * Defines the custom dialog's border width. * * @type { ?(Dimension | EdgeWidths) } * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice * @since arkts {'1.1':'12','1.2':'20'} * @arkts 1.1&1.2 */ borderWidth?: Dimension | EdgeWidths; /** * Defines the custom dialog's border color. * * @type { ?(ResourceColor | EdgeColors) } * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice * @since arkts {'1.1':'12','1.2':'20'} * @arkts 1.1&1.2 */ borderColor?: ResourceColor | EdgeColors; /** * Defines the custom dialog's border style. * * @type { ?(BorderStyle | EdgeStyles) } * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice * @since arkts {'1.1':'12','1.2':'20'} * @arkts 1.1&1.2 */ borderStyle?: BorderStyle | EdgeStyles; /** * Defines the custom dialog's shadow. * * @type { ?(ShadowOptions | ShadowStyle) } * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice * @since arkts {'1.1':'12','1.2':'20'} * @arkts 1.1&1.2 */ shadow?: ShadowOptions | ShadowStyle; /** * Defines the customDialog's background blur Style * * @type { ?BlurStyle } * @default BlurStyle.COMPONENT_ULTRA_THICK * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice * @since arkts {'1.1':'12','1.2':'20'} * @arkts 1.1&1.2 */ backgroundBlurStyle?: BlurStyle; /** * Defines the customDialog's background blur style with options * * @type { ?BackgroundBlurStyleOptions } * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice * @since arkts {'1.1':'19','1.2':'20'} * @arkts 1.1&1.2 */ backgroundBlurStyleOptions?: BackgroundBlurStyleOptions; /** * Defines the customDialog's background effect with options * * @type { ?BackgroundEffectOptions } * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice * @since arkts {'1.1':'19','1.2':'20'} * @arkts 1.1&1.2 */ backgroundEffect?: BackgroundEffectOptions; /** * Defines the customDialog's keyboard avoid mode * * @type { ?KeyboardAvoidMode } * @default KeyboardAvoidMode.DEFAULT * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice * @since arkts {'1.1':'12','1.2':'20'} * @arkts 1.1&1.2 */ keyboardAvoidMode?: KeyboardAvoidMode; /** * Defines whether to respond to the hover mode. * * @type { ?boolean } * @default false * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice * @since arkts {'1.1':'14','1.2':'20'} * @arkts 1.1&1.2 */ enableHoverMode?: boolean; /** * Defines the customDialog's display area in hover mode. * * @type { ?HoverModeAreaType } * @default HoverModeAreaType.BOTTOM_SCREEN * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice * @since arkts {'1.1':'14','1.2':'20'} * @arkts 1.1&1.2 */ hoverModeArea?: HoverModeAreaType; /** * Callback function when the dialog appears. * * @type { ?Callback } * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice * @since arkts {'1.1':'19','1.2':'20'} * @arkts 1.1&1.2 */ onDidAppear?: Callback; /** * Callback function when the dialog disappears. * * @type { ?Callback } * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice * @since arkts {'1.1':'19','1.2':'20'} * @arkts 1.1&1.2 */ onDidDisappear?: Callback; /** * Callback function before the dialog openAnimation starts. * * @type { ?Callback } * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice * @since arkts {'1.1':'19','1.2':'20'} * @arkts 1.1&1.2 */ onWillAppear?: Callback; /** * Callback function before the dialog closeAnimation starts. * * @type { ?Callback } * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice * @since arkts {'1.1':'19','1.2':'20'} * @arkts 1.1&1.2 */ onWillDisappear?: Callback; /** * Defines the distance between the customDialog and system keyboard. * * @type { ?LengthMetrics } * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice * @since arkts {'1.1':'15','1.2':'20'} * @arkts 1.1&1.2 */ keyboardAvoidDistance?: LengthMetrics; /** * Determine the display level of the dialog. * * @type { ?LevelMode } * @default LevelMode.OVERLAY * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice * @since arkts {'1.1':'15','1.2':'20'} * @arkts 1.1&1.2 */ levelMode?: LevelMode; /** * The uniqueId of any node in the router or navigation page. * * @type { ?number } * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice * @since arkts {'1.1':'15','1.2':'20'} * @arkts 1.1&1.2 */ levelUniqueId?: number; /** * Determine the immersive mode of the dialog. * * @type { ?ImmersiveMode } * @default ImmersiveMode.DEFAULT * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice * @since arkts {'1.1':'15','1.2':'20'} * @arkts 1.1&1.2 */ immersiveMode?: ImmersiveMode; /** * Determine the display order of the dialog. * * @type { ?LevelOrder } * @default The value returns by LevelOrder.clamp(0) * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice * @since arkts {'1.1':'18','1.2':'20'} * @arkts 1.1&1.2 */ levelOrder?: LevelOrder; /** * Specifies whether to get focus when the custom dialog is displayed. * * @type { ?boolean } * @default true * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice * @since arkts {'1.1':'19','1.2':'20'} * @arkts 1.1&1.2 */ focusable?: boolean; } /** * Component dialog dismiss action. * * @interface DismissDialogAction * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice * @since arkts {'1.1':'12','1.2':'20'} * @arkts 1.1&1.2 */ declare interface DismissDialogAction { /** * Defines dialog dismiss function * * @type { Callback } * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice * @since arkts {'1.1':'12','1.2':'20'} * @arkts 1.1&1.2 */ dismiss: Callback; /** * Dismiss reason type. * * @type { DismissReason } * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice * @since arkts {'1.1':'12','1.2':'20'} * @arkts 1.1&1.2 */ reason: DismissReason; } /** * Import the CommonState type from promptAction. * * @typedef { import('../api/@ohos.promptAction').promptAction.CommonState } PromptActionCommonState * @syscap SystemCapability.ArkUI.ArkUI.Full * @atomicservice * @since 20 */ declare type PromptActionCommonState = import('../api/@ohos.promptAction').promptAction.CommonState; /** * Use the CustomDialogController class to display the custom pop-up window. * * @syscap SystemCapability.ArkUI.ArkUI.Full * @since 7 */ /** * Use the CustomDialogController class to display the custom pop-up window. * * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @since 10 */ /** * Use the CustomDialogController class to display the custom pop-up window. * * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice * @since arkts {'1.1':'11','1.2':'20'} * @arkts 1.1&1.2 */ declare class CustomDialogController { /** * The constructor transfers parameter settings. * * @param { CustomDialogControllerOptions } value * @syscap SystemCapability.ArkUI.ArkUI.Full * @since 7 */ /** * The constructor transfers parameter settings. * * @param { CustomDialogControllerOptions } value * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @since 10 */ /** * The constructor transfers parameter settings. * * @param { CustomDialogControllerOptions } value * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice * @since arkts {'1.1':'11','1.2':'20'} * @arkts 1.1&1.2 */ constructor(value: CustomDialogControllerOptions); /** * Display the content of the customized pop-up window. If the content has been displayed, it does not take effect. * * @syscap SystemCapability.ArkUI.ArkUI.Full * @since 7 */ /** * Display the content of the customized pop-up window. If the content has been displayed, it does not take effect. * * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @since 10 */ /** * Display the content of the customized pop-up window. If the content has been displayed, it does not take effect. * * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice * @since 11 */ open(); /** * Display the content of the customized pop-up window. If the content has been displayed, it does not take effect. * * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice * @since 20 * @arkts 1.2 */ open(): void; /** * Closes the custom pop-up window. If the window is closed, the window does not take effect. * * @syscap SystemCapability.ArkUI.ArkUI.Full * @since 7 */ /** * Closes the custom pop-up window. If the window is closed, the window does not take effect. * * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @since 10 */ /** * Closes the custom pop-up window. If the window is closed, the window does not take effect. * * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice * @since 11 */ close(); /** * Closes the custom pop-up window. If the window is closed, the window does not take effect. * * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice * @since 20 * @arkts 1.2 */ close(): void; /** * Get the state of the custom pop-up window. * * @returns { PromptActionCommonState } return the state of dialog. * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice * @since 20 */ getState(): PromptActionCommonState; }