/* * 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. */ /** * The alignment of dialog, * * @enum { number } * @syscap SystemCapability.ArkUI.ArkUI.Full * @since 7 */ /** * The alignment of dialog, * * @enum { number } * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @since 10 */ declare enum DialogAlignment { /** * Vertical top alignment. * * @syscap SystemCapability.ArkUI.ArkUI.Full * @since 7 */ /** * Vertical top alignment. * * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @since 10 */ Top, /** * Align vertically to the center. * * @syscap SystemCapability.ArkUI.ArkUI.Full * @since 7 */ /** * Align vertically to the center. * * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @since 10 */ Center, /** * Vertical bottom alignment. * * @syscap SystemCapability.ArkUI.ArkUI.Full * @since 7 */ /** * Vertical bottom alignment. * * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @since 10 */ Bottom, /** * Default alignment. * * @syscap SystemCapability.ArkUI.ArkUI.Full * @since 7 */ /** * Default alignment. * * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @since 10 */ Default, /** * Align the upper left corner. * * @syscap SystemCapability.ArkUI.ArkUI.Full * @since 8 */ /** * Align the upper left corner. * * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @since 10 */ TopStart, /** * Align the upper right corner. * * @syscap SystemCapability.ArkUI.ArkUI.Full * @since 8 */ /** * Align the upper right corner. * * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @since 10 */ TopEnd, /** * Left center alignment. * * @syscap SystemCapability.ArkUI.ArkUI.Full * @since 8 */ /** * Left center alignment. * * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @since 10 */ CenterStart, /** * Right center alignment. * * @syscap SystemCapability.ArkUI.ArkUI.Full * @since 8 */ /** * Right center alignment. * * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @since 10 */ CenterEnd, /** * Align the lower left corner. * * @syscap SystemCapability.ArkUI.ArkUI.Full * @since 8 */ /** * Align the lower left corner. * * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @since 10 */ BottomStart, /** * Align the lower right corner. * * @syscap SystemCapability.ArkUI.ArkUI.Full * @since 8 */ /** * Align the lower right corner. * * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @since 10 */ BottomEnd, } /** * The arrangement of buttons in dialog. * * @enum { number } * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @since 10 */ declare enum DialogButtonDirection { /** * Two or fewer buttons are arranged horizontally, * and two or more buttons are arranged vertically. * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @since 10 */ AUTO = 0, /** * Buttons are arranged horizontally. * * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @since 10 */ HORIZONTAL = 1, /** * Buttons are arranged vertically. * * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @since 10 */ VERTICAL = 2, } /** * Base button param used for AlertDialogParamWithOptions. * * @interface AlertDialogButtonOptions * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @since 10 */ declare interface AlertDialogButtonOptions { /** * Enable switch of button. * * @type { ?boolean } * @default true * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @since 10 */ enabled?: boolean; /** * Default focus switch of button. * * @type { ?boolean } * @default false * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @since 10 */ defaultFocus?: boolean; /** * Style of button. * * @type { ?DialogButtonStyle } * @default - * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @since 10 */ style?: DialogButtonStyle; /** * Text content of button. * * @type { ResourceStr } * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @since 10 */ value: ResourceStr; /** * Text color of button. * * @type { ?ResourceColor } * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @since 10 */ fontColor?: ResourceColor; /** * Background color of button. * * @type { ?ResourceColor } * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @since 10 */ backgroundColor?: ResourceColor; /** * Method executed by the callback. * * @type { function } * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @since 10 */ action: () => void; } /** * Base param used for AlertDialog.show method. * * @interface AlertDialogParam * @syscap SystemCapability.ArkUI.ArkUI.Full * @since 7 */ /** * Base param used for AlertDialog.show method. * * @interface AlertDialogParam * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @since 10 */ declare interface AlertDialogParam { /** * Title Properties * * @type { ?ResourceStr } * @syscap SystemCapability.ArkUI.ArkUI.Full * @since 7 */ /** * Title Properties * * @type { ?ResourceStr } * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @since 10 */ title?: ResourceStr; /** * Subtitle Properties * @type { ?ResourceStr } * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @since 10 */ subtitle?: ResourceStr; /** * message Properties * * @type { ResourceStr } * @syscap SystemCapability.ArkUI.ArkUI.Full * @since 7 */ /** * message Properties * * @type { ResourceStr } * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @since 10 */ message: ResourceStr; /** * Allows users to click the mask layer to exit. * * @type { ?boolean } * @syscap SystemCapability.ArkUI.ArkUI.Full * @since 7 */ /** * Allows users to click the mask layer to exit. * * @type { ?boolean } * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @since 10 */ autoCancel?: boolean; /** * Execute Cancel Function. * * @type { ?function } * @syscap SystemCapability.ArkUI.ArkUI.Full * @since 7 */ /** * Execute Cancel Function. * * @type { ?function } * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @since 10 */ cancel?: () => void; /** * Alignment in the vertical direction. * * @type { ?DialogAlignment } * @syscap SystemCapability.ArkUI.ArkUI.Full * @since 7 */ /** * Alignment in the vertical direction. * * @type { ?DialogAlignment } * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @since 10 */ alignment?: DialogAlignment; /** * Offset of the pop-up window relative to the alignment position. * * @type { ?Offset } * @syscap SystemCapability.ArkUI.ArkUI.Full * @since 7 */ /** * Offset of the pop-up window relative to the alignment position. * * @type { ?Offset } * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @since 10 */ offset?: Offset; /** * Grid count of dialog. * * @type { ?number } * @syscap SystemCapability.ArkUI.ArkUI.Full * @since 7 */ /** * Grid count of dialog. * * @type { ?number } * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @since 10 */ gridCount?: number; /** * Mask Region of dialog. The size cannot exceed the main window. * * @type { ?Rectangle } * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @since 10 */ maskRect?: Rectangle; } /** * Defines the AlertDialog with confirm button. * * @interface AlertDialogParamWithConfirm * @syscap SystemCapability.ArkUI.ArkUI.Full * @since 7 */ /** * Defines the AlertDialog with confirm button. * * @interface AlertDialogParamWithConfirm * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @since 10 */ declare interface AlertDialogParamWithConfirm extends AlertDialogParam { /** * Invoke the commit function. * * @type { ?object } * @syscap SystemCapability.ArkUI.ArkUI.Full * @since 7 */ /** * Invoke the commit function. * * @type { ?object } * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @since 10 */ confirm?: { /** * Enable switch of confirmation button * @type { ?boolean } * @default true * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @since 10 */ enabled?: boolean; /** * Default focus switch of confirmation button * @type { ?boolean } * @default false * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @since 10 */ defaultFocus?: boolean; /** * Style of confirmation button. * @type { ?DialogButtonStyle } * @default DialogButtonStyle.DEFAULT * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @since 10 */ style?: DialogButtonStyle; /** * Text content of the confirmation button. * * @type { ResourceStr } * @syscap SystemCapability.ArkUI.ArkUI.Full * @since 7 */ /** * Text content of the confirmation button. * * @type { ResourceStr } * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @since 10 */ value: ResourceStr; /** * Text color of the confirmation button. * * @type { ?ResourceColor } * @syscap SystemCapability.ArkUI.ArkUI.Full * @since 7 */ /** * Text color of the confirmation button. * * @type { ?ResourceColor } * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @since 10 */ fontColor?: ResourceColor; /** * Background color of the confirmation button. * * @type { ?ResourceColor } * @syscap SystemCapability.ArkUI.ArkUI.Full * @since 7 */ /** * Background color of the confirmation button. * * @type { ?ResourceColor } * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @since 10 */ backgroundColor?: ResourceColor; /** * Method executed by the callback. * * @type { function } * @syscap SystemCapability.ArkUI.ArkUI.Full * @since 7 */ /** * Method executed by the callback. * * @type { function } * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @since 10 */ action: () => void; }; } /** * Defines the dialog param with buttons. * * @interface AlertDialogParamWithButtons * @syscap SystemCapability.ArkUI.ArkUI.Full * @since 7 */ /** * Defines the dialog param with buttons. * * @interface AlertDialogParamWithButtons * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @since 10 */ declare interface AlertDialogParamWithButtons extends AlertDialogParam { /** * First button. * * @type { object } * @syscap SystemCapability.ArkUI.ArkUI.Full * @since 7 */ /** * First button. * * @type { object } * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @since 10 */ primaryButton: { /** * Enable switch of primaryButton * @type { ?boolean } * @default true * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @since 10 */ enabled?: boolean; /** * Default focus switch of primaryButton button * @type { ?boolean } * @default false * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @since 10 */ defaultFocus?: boolean; /** * Style of primaryButton button. * @type { ?DialogButtonStyle } * @default DialogButtonStyle.DEFAULT * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @since 10 */ style?: DialogButtonStyle; /** * Text content of the confirmation button. * * @type { ResourceStr } * @syscap SystemCapability.ArkUI.ArkUI.Full * @since 7 */ /** * Text content of the confirmation button. * * @type { ResourceStr } * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @since 10 */ value: ResourceStr; /** * Text color of the confirmation button. * * @type { ?ResourceColor } * @syscap SystemCapability.ArkUI.ArkUI.Full * @since 7 */ /** * Text color of the confirmation button. * * @type { ?ResourceColor } * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @since 10 */ fontColor?: ResourceColor; /** * Background color of the confirmation button. * * @type { ?ResourceColor } * @syscap SystemCapability.ArkUI.ArkUI.Full * @since 7 */ /** * Background color of the confirmation button. * * @type { ?ResourceColor } * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @since 10 */ backgroundColor?: ResourceColor; /** * Method executed by the callback. * * @type { function } * @syscap SystemCapability.ArkUI.ArkUI.Full * @since 7 */ /** * Method executed by the callback. * * @type { function } * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @since 10 */ action: () => void; }; /** * Second button. * * @type { object } * @syscap SystemCapability.ArkUI.ArkUI.Full * @since 7 */ /** * Second button. * * @type { object } * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @since 10 */ secondaryButton: { /** * Enable switch of secondaryButton * @type { ?boolean } * @default true * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @since 10 */ enabled?: boolean; /** * Default focus switch of secondaryButton button * @type { ?boolean } * @default false * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @since 10 */ defaultFocus?: boolean; /** * Style of secondaryButton button. * @type { ?DialogButtonStyle } * @default DialogButtonStyle.DEFAULT * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @since 10 */ style?: DialogButtonStyle; /** * Text content of the confirmation button. * * @type { ResourceStr } * @syscap SystemCapability.ArkUI.ArkUI.Full * @since 7 */ /** * Text content of the confirmation button. * * @type { ResourceStr } * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @since 10 */ value: ResourceStr; /** * Text color of the confirmation button. * * @type { ?ResourceColor } * @syscap SystemCapability.ArkUI.ArkUI.Full * @since 7 */ /** * Text color of the confirmation button. * * @type { ?ResourceColor } * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @since 10 */ fontColor?: ResourceColor; /** * Background color of the confirmation button. * * @type { ?ResourceColor } * @syscap SystemCapability.ArkUI.ArkUI.Full * @since 7 */ /** * Background color of the confirmation button. * * @type { ?ResourceColor } * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @since 10 */ backgroundColor?: ResourceColor; /** * Method executed by the callback. * * @type { function } * @syscap SystemCapability.ArkUI.ArkUI.Full * @since 7 */ /** * Method executed by the callback. * * @type { function } * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @since 10 */ action: () => void; }; } /** * Defines the dialog param with options. * * @interface AlertDialogParamWithOptions * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @since 10 */ declare interface AlertDialogParamWithOptions extends AlertDialogParam { /** * The array of buttons. * @type { Array } * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @since 10 */ buttons: Array; /** * The arrangement of buttons. * @type { ?DialogButtonDirection } * @default DialogButtonDirection.AUTO * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @since 10 */ buttonDirection?: DialogButtonDirection; } /** * Defines AlertDialog which uses show method to show alert dialog. * * @syscap SystemCapability.ArkUI.ArkUI.Full * @since 7 */ /** * Defines AlertDialog which uses show method to show alert dialog. * * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @since 10 */ declare class AlertDialog { /** * Invoking method display. * * @param { AlertDialogParamWithConfirm | AlertDialogParamWithButtons } value * @syscap SystemCapability.ArkUI.ArkUI.Full * @since 7 */ /** * Invoking method display. * * @param { AlertDialogParamWithConfirm | AlertDialogParamWithButtons | AlertDialogParamWithOptions} value * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @since 10 */ static show(value: AlertDialogParamWithConfirm | AlertDialogParamWithButtons | AlertDialogParamWithOptions); } declare module "AlertDialogParam" { module "AlertDialogParam" { // @ts-ignore export { AlertDialogParamWithConfirm, AlertDialogParamWithButtons, DialogAlignment, DialogButtonDirection, AlertDialogParamWithOptions }; } }