bind menu add enabled param and context menu add preview

Signed-off-by: limeng <limeng208@huawei.com>
This commit is contained in:
limeng 2023-09-07 16:39:32 +08:00 committed by tengfan
parent 6e2f172c59
commit dcd2886e18

View File

@ -5644,6 +5644,33 @@ declare interface CustomPopupOptions {
offset?: Position
}
/**
* Defines the menu preview mode.
*
* @enum { number }
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @crossplatform
* @since 11
*/
declare enum MenuPreviewMode {
/**
* No preview content.
*
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @crossplatform
* @since 11
*/
NONE = 0,
/**
* Defines image type preview content.
*
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @crossplatform
* @since 11
*/
IMAGE = 1
}
/**
* Defines the context menu options.
*
@ -5693,7 +5720,18 @@ declare interface ContextMenuOptions {
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @since 10
*/
arrowOffset?: Length;
arrowOffset?: Length;
/**
* The preview content of context menu.
*
* @type { ?(MenuPreviewMode | CustomBuilder) }
* @default MenuPreviewMode.NONE
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @crossplatform
* @since 11
*/
preview?: MenuPreviewMode | CustomBuilder;
/**
* Callback function when the context menu appears.
@ -5891,6 +5929,86 @@ declare interface NestedScrollOptions {
scrollBackward: NestedScrollMode;
}
/**
* Defines the menu element.
*
* @interface MenuElement
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @since 7
*/
/**
* Defines the menu element.
*
* @interface MenuElement
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @crossplatform
* @since 10
*/
declare interface MenuElement {
/**
* Sets the value of the menu element.
*
* @type { ResourceStr }
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @since 7
*/
/**
* Sets the value of the menu element.
*
* @type { ResourceStr }
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @crossplatform
* @since 10
*/
value: ResourceStr;
/**
* Sets the icon of the menu element.
*
* @type { ?ResourceStr }
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @since 7
*/
/**
* Sets the icon of the menu element.
*
* @type { ?ResourceStr }
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @crossplatform
* @since 10
*/
icon?: ResourceStr;
/**
* If the value is true, the menu element is available and can respond to operations such as clicking.
* If the value is false, the menu element is not available and click operations are not responded.
*
* @type { ?boolean }
* @default true
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @crossplatform
* @since 11
*/
enabled?: boolean;
/**
* 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;
}
/**
* CommonMethod.
*
@ -8504,10 +8622,17 @@ declare class CommonMethod<T> {
* @crossplatform
* @since 10
*/
bindMenu(
content: { value: ResourceStr; icon?: ResourceStr; action: () => void }[] | CustomBuilder,
options?: MenuOptions
): T;
/**
* Menu control
*
* @param { Array<MenuElement> | CustomBuilder } content - Indicates the content of menu.
* @param { MenuOptions } options - Indicates the options of menu.
* @returns { T }
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @crossplatform
* @since 11
*/
bindMenu(content: Array<MenuElement> | CustomBuilder, options?: MenuOptions): T;
/**
* ContextMenu control