UNPKG

@ccs-design/rc-pro

Version:

ccs design basic react component

131 lines (130 loc) 3.56 kB
import React, { ReactNode } from 'react'; import { History } from 'history-with-query'; import { Dispatch, AnyAction } from 'redux'; import './index.less'; export declare const classPrefix = "ccs-bl"; export declare function stringToHex(str: string): string; export interface TabsPageType { title: string; content: ReactNode; key: string; top: number; } export declare type RouteType = { path: string; name: string; hiddenBreadcrumb: boolean; routes?: RouteType[]; }; export declare type LayoutType = 'left' | 'top'; export interface RenderHeaderType extends Pick<BasicLayoutType, 'logo' | 'location'> { menuData: MenuType[]; layout: LayoutType; menus: MenuType[]; } export interface MenuParentType { key: string; url: string; name: string; } export interface MenuType { nodeId: string; nodeName: string; leaf: boolean; icon: string; nodeData: { menuCode: string; menuName: string; menuUrl: string; menuType: number; menuDesc: string; }; children?: MenuType[]; topUrl?: string; parents?: MenuParentType[]; } export interface UserDetailType { menuData?: MenuType[]; userName?: string; loginCode?: string; urls?: string[]; token?: string; loginId?: number; orgs?: any[]; roles?: any[]; avatar?: string; } export interface CcsBasicDefaultLayout { /** 菜单收起状态 */ collapsed: boolean; /** 系统布局 */ layout: LayoutType; } export interface BasicLayoutType { /** logo图片 */ logo?: string | ReactNode; /** umi route */ route: { routes: RouteType[]; }; /** umi history */ history: History; /** umi location */ location: Location; /** umi router children */ children: any; /** 用户信息 */ userDetail: UserDetailType; /** 布局配置 */ layoutConfig: ConfigType; /** 用户下拉菜单 */ userOverlayMenu?: ReactNode; /** 头部额外信息 */ headerExtra?: ReactNode; /** 首页地址 */ homePage?: string; /** dva dispatch */ dispatch?: Dispatch<AnyAction>; /** 隐藏左侧菜单 */ hideLeftMenu?: boolean; /** 自定义下级菜单 */ renderChildrenMenu?: (menuData: MenuType[], selectedKeys: string[], openKeys: string[]) => ReactNode; /** 自定义header */ renderHeader?: ({ logo, layout, menus, menuData, location }: RenderHeaderType) => ReactNode; } export interface ConfigType { /** app名称 */ AppName: string; /** 主题色 */ BrandPrimary: string; /** 菜单展开宽度 */ MenuExpandWidth: number; /** 菜单收起宽度 */ MenuCollapsedWidth: number; /** 启用tabs缓存页面 */ IsTabsPage: boolean; /** 启用按钮权限 */ IsAuthButton: boolean; /** 暗黑模式 */ IsDark: boolean; /** 紧凑模式 */ IsCompact: boolean; /** 可以切换布局模式 */ LayoutChange?: boolean; /** 用户首次访问菜单模式 left | top */ LayoutMode: 'left' | 'top'; /** 菜单在收起状态,或者顶部菜单模式,查看下级菜单模式 default | all (一次性展开所有下级菜单) */ MenuExpandMode: 'default' | 'all'; /** 菜单始终收起状态? */ MenuCollapsed?: boolean; /** 接口名称统一前缀 */ Api: string; /** url上下文名称 */ Context: string; } /** * 布局 * @param BasicLayoutType */ declare const CcsBasicLayout: React.FC<BasicLayoutType>; export default CcsBasicLayout;