From abaf53c31dd061ac55bee8f00260b74aefb43cf0 Mon Sep 17 00:00:00 2001 From: mertsincan Date: Wed, 1 Dec 2021 16:52:04 +0300 Subject: [PATCH] Fixed #1836 - For MenuItem --- src/components/menuitem/MenuItem.d.ts | 80 +++++++++++++++++++++++++++ src/components/menuitem/package.json | 3 + 2 files changed, 83 insertions(+) create mode 100644 src/components/menuitem/MenuItem.d.ts create mode 100644 src/components/menuitem/package.json diff --git a/src/components/menuitem/MenuItem.d.ts b/src/components/menuitem/MenuItem.d.ts new file mode 100644 index 000000000..df8ea7f9a --- /dev/null +++ b/src/components/menuitem/MenuItem.d.ts @@ -0,0 +1,80 @@ +type MenuItemLabelType = string | ((...args: any) => string) | undefined; + +type MenuItemDisabledType = boolean | ((...args: any) => boolean) | undefined; + +type MenuItemVisibleType = boolean | ((...args: any) => boolean) | undefined; + +export interface MenuItemCommandEvent { + /** + * Browser event. + */ + originalEvent: Event; + /** + * Menuitem instance. + */ + item: MenuItem; + /** + * Optional + */ + [key: string]: any; +} + +export interface MenuItem { + /** + * Property name or getter function to use as the label of an item. + */ + label?: MenuItemLabelType; + /** + * Icon of the item. + */ + icon?: string | undefined; + /** + * Route configuration such as path, name and parameters. + */ + to?: string | undefined; + /** + * Callback to execute when item is clicked. + * @param {@link MenuItemCommandEvent} event - Custom command event. + */ + command?(event: MenuItemCommandEvent): void; + /** + * External link to navigate when item is clicked. + */ + url?: string | undefined; + /** + * An array of children menuitems. + */ + items?: MenuItem[] | undefined; + /** + * A boolean or a function to return a boolean to specify if the item is disabled. + */ + disabled?: MenuItemDisabledType; + /** + * A boolean or a function to return a boolean to specify if the item is visible. + */ + visible?: MenuItemVisibleType; + /** + * Specifies where to open the linked document. + */ + target?: string | undefined; + /** + * Defines the item as a separator. + */ + separator?: boolean | undefined; + /** + * Inline style of the menuitem. + */ + style?: any; + /** + * Style class of the menuitem. + */ + class?: string | undefined; + /** + * Unique identifier of an item. + */ + key?: string | undefined + /** + * Optional + */ + [key: string]: any; +} diff --git a/src/components/menuitem/package.json b/src/components/menuitem/package.json new file mode 100644 index 000000000..dfb77615c --- /dev/null +++ b/src/components/menuitem/package.json @@ -0,0 +1,3 @@ +{ + "types": "./MenuItem.d.ts" +}