chowa
Version:
UI component library based on React
66 lines (65 loc) • 2.16 kB
TypeScript
/**
* @license chowa v1.1.3
*
* Copyright (c) Chowa Techonlogies Co.,Ltd.(http://www.chowa.cn).
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
import * as React from 'react';
import * as PropTypes from 'prop-types';
import MenuItem from './menu-item';
import MenuGroup from './menu-group';
import MenuSubmenu from './menu-submenu';
import { Data, CollapseManager } from './tool';
export interface MenuProps {
className?: string;
style?: React.CSSProperties;
mode?: 'horizontal' | 'vertical';
collapse?: boolean;
accordion?: boolean;
theme?: 'light' | 'dark' | 'primary';
activeIndex?: React.ReactText;
onChange?: (activeIndex: React.ReactText) => any;
}
export interface MenuState {
renderData: Data;
selfActiveIndex: React.ReactText;
collapseManager: CollapseManager;
}
declare class Menu extends React.PureComponent<MenuProps, MenuState> {
static propTypes: {
className: PropTypes.Requireable<string>;
style: PropTypes.Requireable<object>;
mode: PropTypes.Requireable<string>;
collapse: PropTypes.Requireable<boolean>;
accordion: PropTypes.Requireable<boolean>;
theme: PropTypes.Requireable<string>;
activeIndex: PropTypes.Requireable<string | number>;
onChange: PropTypes.Requireable<(...args: any[]) => any>;
};
static defaultProps: {
mode: string;
theme: string;
collapse: boolean;
accordion: boolean;
};
static Item: typeof MenuItem;
static Submenu: typeof MenuSubmenu;
static Group: typeof MenuGroup;
private wrapperEle;
constructor(props: MenuProps & {
children: React.ReactNode;
});
componentDidUpdate(preProps: MenuProps & {
children: React.ReactNode;
}): void;
componentDidMount(): void;
componentWillUnmount(): void;
private reCollectionRenderData;
private adaptiveLayout;
setActiveIndex(activeIndex: number): void;
updateCollapseManager(parentKey: string, collapseKey: number): void;
render(): JSX.Element;
}
export default Menu;