Refactor #3907 - For TieredMenu

This commit is contained in:
Tuğçe Küçükoğlu 2023-04-26 12:59:21 +03:00
parent 09553cbcd3
commit 3ac7e6ec73
4 changed files with 145 additions and 12 deletions

View file

@ -11,6 +11,114 @@ import { VNode } from 'vue';
import { MenuItem } from '../menuitem';
import { ClassComponent, GlobalComponentConstructor } from '../ts-helpers';
export declare type TieredMenuPassThroughOptionType = TieredMenuPassThroughAttributes | ((options: TieredMenuPassThroughMethodOptions) => TieredMenuPassThroughAttributes) | null | undefined;
/**
* Custom passthrough(pt) option method.
*/
export interface TieredMenuPassThroughMethodOptions {
props: TieredMenuProps;
state: TieredMenuState;
}
/**
* Custom passthrough(pt) options.
* @see {@link TieredMenuProps.pt}
*/
export interface TieredMenuPassThroughOptions {
/**
* Uses to pass attributes to the root's DOM element.
*/
root?: TieredMenuPassThroughOptionType;
/**
* Uses to pass attributes to the list's DOM element.
*/
menu?: TieredMenuPassThroughOptionType;
/**
* Uses to pass attributes to the list item's DOM element.
*/
menuitem?: TieredMenuPassThroughOptionType;
/**
* Uses to pass attributes to the content's DOM element.
*/
content?: TieredMenuPassThroughOptionType;
/**
* Uses to pass attributes to the action's DOM element.
*/
action?: TieredMenuPassThroughOptionType;
/**
* Uses to pass attributes to the icon's DOM element.
*/
icon?: TieredMenuPassThroughOptionType;
/**
* Uses to pass attributes to the label's DOM element.
*/
label?: TieredMenuPassThroughOptionType;
/**
* Uses to pass attributes to the submenu icon's DOM element.
*/
submenuIcon?: TieredMenuPassThroughOptionType;
/**
* Uses to pass attributes to the separator's DOM element.
*/
separator?: TieredMenuPassThroughOptionType;
}
/**
* Custom passthrough attributes for each DOM elements
*/
export interface TieredMenuPassThroughAttributes {
[key: string]: any;
}
/**
* Defines focused item info
*/
export interface TieredMenuFocusedItemInfo {
/**
* Active item index
*/
index: number;
/**
* Active item level
*/
level: number;
/**
* Parent key info
*/
parentKey: string;
}
/**
* Defines current inline state in TieredMenu component.
*/
export interface TieredMenuState {
/**
* Current id state as a string.
*/
id: string;
/**
* Current focus state as a boolean.
* @defaultValue false
*/
focused: boolean;
/**
* Current focused item info.
* @type {TieredMenuFocusedItemInfo}
*/
focusedItemInfo: TieredMenuFocusedItemInfo;
/**
* Active item path.
* @type {TieredMenuFocusedItemInfo}
*/
activeItemPath: TieredMenuFocusedItemInfo[];
/**
* Current visible state as a boolean.
* @defaultValue true
*/
visible: boolean;
}
/**
* Defines valid properties in TieredMenuMenu component.
*/
@ -61,6 +169,11 @@ export interface TieredMenuProps {
* Identifier of the underlying menu element.
*/
'aria-labelledby'?: string | undefined;
/**
* Uses to pass attributes to DOM elements inside the component.
* @type {TieredMenuPassThroughOptions}
*/
pt?: TieredMenuPassThroughOptions;
}
/**