From 9628cc08e94ff46e8eee16436d2678e2ca9e6766 Mon Sep 17 00:00:00 2001 From: liyi0309 Date: Mon, 10 Mar 2025 15:37:55 +0800 Subject: [PATCH] =?UTF-8?q?OH6.0API=E8=AE=BE=E8=AE=A1=20Signed-off-by:=20l?= =?UTF-8?q?iyi0309?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- api/@internal/component/ets/common.d.ts | 215 ++++++++++++++++++ .../ets/custom_dialog_controller.d.ts | 11 + api/@internal/component/ets/enums.d.ts | 28 +++ api/@internal/component/ets/menu_item.d.ts | 94 ++++++++ api/@internal/component/ets/select.d.ts | 12 + api/@ohos.arkui.advanced.PopupV2.d.ets | 203 +++++++++++++++++ api/@ohos.promptAction.d.ts | 55 +++++ 7 files changed, 618 insertions(+) create mode 100644 api/@ohos.arkui.advanced.PopupV2.d.ets diff --git a/api/@internal/component/ets/common.d.ts b/api/@internal/component/ets/common.d.ts index 4cf968e15b..1589096770 100644 --- a/api/@internal/component/ets/common.d.ts +++ b/api/@internal/component/ets/common.d.ts @@ -15285,6 +15285,18 @@ declare interface PopupCommonOptions { * @since 18 */ followTransformOfTarget?: boolean; + + /** + * Determine if popup can avoid the target when the display space is insufficient. + * + * @type { ?AvoidanceMode } + * @default AvoidanceMode.COVER_TARGET + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 20 + */ + avoidTarget?: AvoidanceMode; } /** @@ -16067,6 +16079,62 @@ declare interface PopupOptions { * @since 15 */ keyboardAvoidMode?: KeyboardAvoidMode; + + /** + * Determine if popup can avoid the target when the display space is insufficient. + * + * @type { ?AvoidanceMode } + * @default AvoidanceMode.COVER_TARGET + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 20 + */ + avoidTarget?: AvoidanceMode; + + /** + * Callback function when the popup appears. + * + * @type { ?Callback } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 20 + */ + onDidAppear?: Callback; + + /** + * Callback function when the popup disappears. + * + * @type { ?Callback } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 20 + */ + onDidDisappear?: Callback; + + /** + * Callback function before the popup openAnimation starts. + * + * @type { ?Callback } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 20 + */ + onWillAppear?: Callback; + + /** + * Callback function before the popup closeAnimation starts. + * + * @type { ?Callback } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 20 + */ + onWillDisappear?: Callback; } /** @@ -16614,6 +16682,62 @@ declare interface CustomPopupOptions { * @since 15 */ keyboardAvoidMode?: KeyboardAvoidMode; + + /** + * Determine if popup can avoid the target when the display space is insufficient. + * + * @type { ?AvoidanceMode } + * @default AvoidanceMode.COVER_TARGET + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 20 + */ + avoidTarget?: AvoidanceMode; + + /** + * Callback function when the popup appears. + * + * @type { ?Callback } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 20 + */ + onDidAppear?: Callback; + + /** + * Callback function when the popup disappears. + * + * @type { ?Callback } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 20 + */ + onDidDisappear?: Callback; + + /** + * Callback function before the popup openAnimation starts. + * + * @type { ?Callback } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 20 + */ + onWillAppear?: Callback; + + /** + * Callback function before the popup closeAnimation starts. + * + * @type { ?Callback } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 20 + */ + onWillDisappear?: Callback; } /** @@ -16798,6 +16922,41 @@ declare enum HapticFeedbackMode { AUTO = 2 } +/** + * Menu mask type + * + * @interface MenuMaskType + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 20 + */ +declare interface MenuMaskType { + /** + * Mask color of menu. + * + * @type { ?ResourceColor } + * @default Color.Transparent + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 20 + */ + color?: ResourceColor; + + /** + * Set menu mask background blur Style. + * + * @type { ?BlurStyle } + * @default BlurStyle.COMPONENT_ULTRA_THICK + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 20 + */ + backgroundBlurStyle?: BlurStyle; +} + /** * Defines the context menu options. * @@ -17145,6 +17304,62 @@ declare interface ContextMenuOptions { * @since 18 */ hapticFeedbackMode?: HapticFeedbackMode; + + /** + * Whether it is a menu without mask. + * + * @type { ?(boolean | MenuMaskType) } + * @default true + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 20 + */ + mask?: boolean | MenuMaskType; + + /** + * Callback function when the menu appears. + * + * @type { ?Callback } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 20 + */ + onDidAppear?: Callback; + + /** + * Callback function when the menu disappears. + * + * @type { ?Callback } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 20 + */ + onDidDisappear?: Callback; + + /** + * Callback function before the menu openAnimation starts. + * + * @type { ?Callback } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 20 + */ + onWillAppear?: Callback; + + /** + * Callback function before the menu closeAnimation starts. + * + * @type { ?Callback } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 20 + */ + onWillDisappear?: Callback; } /** diff --git a/api/@internal/component/ets/custom_dialog_controller.d.ts b/api/@internal/component/ets/custom_dialog_controller.d.ts index d0a5591578..0423ca2979 100644 --- a/api/@internal/component/ets/custom_dialog_controller.d.ts +++ b/api/@internal/component/ets/custom_dialog_controller.d.ts @@ -638,6 +638,17 @@ declare interface CustomDialogControllerOptions { * @since 18 */ focusable?: boolean; + + /** + * Defines the customDialog's display mode when show in subwindow + * + * @type { ?DialogDisplayMode } + * @default DialogDisplayMode.CENTER_IN_SCREEN + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @atomicservice + * @since 20 + */ + displayModeInSubWindow?: DialogDisplayMode; } /** diff --git a/api/@internal/component/ets/enums.d.ts b/api/@internal/component/ets/enums.d.ts index 57039794ad..8083f177d2 100644 --- a/api/@internal/component/ets/enums.d.ts +++ b/api/@internal/component/ets/enums.d.ts @@ -10210,4 +10210,32 @@ declare enum DividerMode { * @since 18 */ EMBEDDED_IN_MENU = 1, +} + +/** + * Dialog display mode. + * + * @enum { number } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @atomicservice + * @since 20 + */ +declare enum DialogDisplayMode { + /** + * dialog display in screen. + * + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @atomicservice + * @since 20 + */ + CENTER_IN_SCREEN = 0, + + /** + * dialog display in app window. + * + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @atomicservice + * @since 20 + */ + CENTER_IN_WINDOW = 1, } \ No newline at end of file diff --git a/api/@internal/component/ets/menu_item.d.ts b/api/@internal/component/ets/menu_item.d.ts index b95257ffab..9f203bc10f 100644 --- a/api/@internal/component/ets/menu_item.d.ts +++ b/api/@internal/component/ets/menu_item.d.ts @@ -194,6 +194,72 @@ declare interface MenuItemOptions { builder?: CustomBuilder; } +/** + * Defines the option of MenuItem. + * + * @interface MenuItemOptionsV2 + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 20 + */ +declare interface MenuItemOptionsV2 { + /** + * Defines the start display image info. + * + * @type { ?(ResourceStr | SymbolGlyphModifier | DrawableDescriptor) } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 20 + */ + startIcon?: ResourceStr | SymbolGlyphModifier | DrawableDescriptor; + + /** + * Defines the content string display info. + * + * @type { ?ResourceStr } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 20 + */ + content?: ResourceStr; + + /** + * Defines the end display image info. + * + * @type { ?(ResourceStr | SymbolGlyphModifier | DrawableDescriptor) } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 20 + */ + endIcon?: ResourceStr | SymbolGlyphModifier | DrawableDescriptor; + + /** + * Defines the end label info like shortcut. + * + * @type { ?ResourceStr } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 20 + */ + labelInfo?: ResourceStr; + + /** + * Create the submenu. + * + * @type { ?CustomBuilder } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 20 + */ + builder?: CustomBuilder; +} + /** * Defines the MenuItem Component. * @@ -247,6 +313,18 @@ interface MenuItemInterface { * @since 11 */ (value?: MenuItemOptions | CustomBuilder): MenuItemAttribute; + + /** + * Creates the MenuItem component. + * + * @param { MenuItemOptions | MenuItemOptionsV2 | CustomBuilder } item + * @returns { MenuItemAttribute } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 20 + */ + (item?: MenuItemOptions | MenuItemOptionsV2 | CustomBuilder): MenuItemAttribute; } /** @@ -354,6 +432,22 @@ declare class MenuItemAttribute extends CommonMethod { */ selectIcon(value: boolean | ResourceStr | SymbolGlyphModifier): MenuItemAttribute; + /** + * Whether the relevant check icon is displayed when a menu item is selected. + * Use type ResourceStr or SymbolGlyphModifier to specify icon instead of the default check mark. + * + * @param { boolean | ResourceStr | SymbolGlyphModifier | DrawableDescriptor } value - Icon when selected. + *
true: displays the default check mark when selected. + *
false: does not displays icon when selected. + *
ResourceStr or SymbolGlyphModifier or DrawableDescriptor: displays the specified icon when selected. + * @returns { MenuItemAttribute } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 20 + */ + selectIcon(value: boolean | ResourceStr | SymbolGlyphModifier | DrawableDescriptor): MenuItemAttribute; + /** * Triggers a callback when a menu item is selected or unchecked. * diff --git a/api/@internal/component/ets/select.d.ts b/api/@internal/component/ets/select.d.ts index ab1ea4bebe..2feeab4cd5 100644 --- a/api/@internal/component/ets/select.d.ts +++ b/api/@internal/component/ets/select.d.ts @@ -1159,6 +1159,18 @@ declare class SelectAttribute extends CommonMethod { * @since 18 */ avoidance(mode: AvoidanceMode): SelectAttribute; + + /** + * Whether to display in the sub window. + * + * @param { Optional } showInSubWindow + * @returns { SelectAttribute } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 20 + */ + showInSubWindow(showInSubWindow: Optional): SelectAttribute; } /** diff --git a/api/@ohos.arkui.advanced.PopupV2.d.ets b/api/@ohos.arkui.advanced.PopupV2.d.ets new file mode 100644 index 0000000000..cccf4dd4e3 --- /dev/null +++ b/api/@ohos.arkui.advanced.PopupV2.d.ets @@ -0,0 +1,203 @@ +/* +* Copyright (C) 2025 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 + */ + +import { ButtonModifier, ImageModifier, TextModifier } from '@ohos.arkui.modifier'; + +/** + * Defines the popup button options + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 20 + */ +export interface PopupV2Button { + /** + * Set the button display content. + * @type { ResourceStr }. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 20 + */ + text: ResourceStr; + + /** + * Set the button callback. + * @type { ?Callback } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 20 + */ + action?: Callback; + + /** + * The button attributes of Popup. + * + * @type { ?ButtonModifier } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 20 + */ + buttonModifier?: ButtonModifier; +} + +/** + * Defines the popup options. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 20 + */ +export interface PopupV2InitInfo { + /** + * The icon of Popup. + * + * @type { ?ResourceStr } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 20 + */ + icon?: ResourceStr; + + /** + * The icon attributes of Popup. + * + * @type { ?ImageModifier } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 20 + */ + iconModifier?: ImageModifier; + + /** + * The title of Popup. + * + * @type { ?ResourceStr } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 20 + */ + title?: ResourceStr; + + /** + * The title attributes of Popup. + * + * @type { ?TextModifier } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 20 + */ + titleModifier?: TextModifier; + + /** + * The message of Popup. + * + * @type { ResourceStr } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 20 + */ + message: ResourceStr; + + /** + * The message attributes of Popup. + * + * @type { TextModifier } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 20 + */ + messageModifier?: TextModifier; + + /** + * The show close of Popup. + * + * @type { ?(boolean | Resource) } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 20 + */ + showClose?: boolean | Resource; + + /** + * The close button callback of Popup. + * + * @type { ?Callback } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 20 + */ + onClose?: Callback; + + /** + * The buttons of Popup. + * + * @type { ?[PopupV2Button?, PopupV2Button?] } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 20 + */ + buttons?: [PopupV2Button?, PopupV2Button?]; + + /** + * Indicates the attribute of the current popup direction. + * + * @type { ?Direction } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 20 + */ + direction?: Direction; + + /** + * Set the max width of the popup. + * + * @type { ?Dimension } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 20 + */ + maxWidth?: Dimension; +} + +/** + * Build function of PopupV2. + * + * @param { PopupV2InitInfo } options - popup option. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 20 + */ + @Builder + export declare function PopupV2(options: PopupV2InitInfo): void; \ No newline at end of file diff --git a/api/@ohos.promptAction.d.ts b/api/@ohos.promptAction.d.ts index a07be30d8f..7867bac276 100644 --- a/api/@ohos.promptAction.d.ts +++ b/api/@ohos.promptAction.d.ts @@ -1304,6 +1304,17 @@ declare namespace promptAction { * @since 18 */ focusable?: boolean; + + /** + * Defines the customDialog's display mode when show in subwindow + * + * @type { ?DialogDisplayMode } + * @default DialogDisplayMode.CENTER_IN_SCREEN + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @atomicservice + * @since 20 + */ + displayModeInSubWindow?: DialogDisplayMode; } /** @@ -1810,6 +1821,50 @@ declare namespace promptAction { * @since 15 */ immersiveMode?: ImmersiveMode; + + /** + * Callback function when the menu appears. + * + * @type { ?Callback } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 20 + */ + onDidAppear?: Callback; + + /** + * Callback function when the menu disappears. + * + * @type { ?Callback } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 20 + */ + onDidDisappear?: Callback; + + /** + * Callback function before the menu openAnimation starts. + * + * @type { ?Callback } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 20 + */ + onWillAppear?: Callback; + + /** + * Callback function before the menu closeAnimation starts. + * + * @type { ?Callback } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 20 + */ + onWillDisappear?: Callback; } /** -- Gitee