cgreact-layui
Version:
CGReact基于Layui样式的组件库
103 lines (93 loc) • 5.41 kB
TypeScript
/** CGReactLayui导出类型定义*/
import CGReact from "cgreact-core";
export = CGReactLayui;
export as namespace CGReactLayui;
declare namespace CGReactLayui
{
/** Layui基础样式*/
const CGReactLayuiStyle: JSS;
/** CGReact图标组件*/
class CGReactIcon<STATE = IconState, PROP = IconProps> extends CGReact.CGReactComponent<STATE, PROP>
{
/** 继承方法定义*/
protected affectStyle(): JSS; //生效样式
protected renderView(): React.ReactElement<any>; //渲染页面
/** 拓展方法定义*/
protected renderView(): React.ReactElement<any>;//允许用户复写自己的渲染方法
}
/** CGReact按钮组件*/
class CGReactButton<STATE = ButtonState, PROP = ButtonProps> extends CGReact.CGReactComponent<STATE, PROP>
{
/** 继承方法定义*/
protected affectStyle(): JSS; //生效样式
protected renderView(): React.ReactElement<any>; //渲染页面
/** 拓展方法定义*/
protected onSimpleButtonClick(config: SimpleButtonConfig); //普通按钮点击回调
protected onCheckButtonClick(config: CheckButtonConfig, newChecked: boolean): void;//复选框组点击回调
protected onRadioButtonClick(config: RadioButtonConfig, newChecked: boolean): void;//单选按钮点击回调
protected onSwitchButtonClick(config: SwitchButtonConfig, newChecked: boolean, newValue: string);//选择按钮点击回调
}
/** CGReact表单组件*/
class CGReactForm<STATE = FormState, PROP = FormProp> extends CGReact.CGReactLayout<STATE, PROP>
{
}
/** CGReact输入框组件*/
class CGReactInput<STATE = InputState, PROP = InputProp> extends CGReact.CGReactComponent<STATE, PROP>
{
/** 继承方法定义*/
protected affectStyle(): JSS; //生效样式
protected renderView(): React.ReactElement<any>; //渲染页面
/** 拓展方法定义*/
protected onInputValueChange(config: InputConfig, newValue: string);//输入框值变化回调
}
/** CGReact选择框组件*/
class CGReactSelect<STATE = SelectState, PROP = SelectProp> extends CGReact.CGReactComponent<STATE, PROP>
{
/** 继承方法定义*/
protected affectStyle(): JSS; //生效样式
protected renderView(): React.ReactElement<any>; //渲染页面
/** 拓展方法定义*/
protected onOptionSelect(config: OptionSelectConfig, newValue: string);//选择框选择回调
}
/** CGReact行、列、弹出菜单组件*/
class CGReactMenu<STATE = MenuState, PROP = MenuProp> extends CGReact.CGReactComponent<STATE, PROP>
{
/** 继承方法定义*/
protected affectStyle(): JSS; //生效样式
protected renderView(): React.ReactElement<any>; //渲染页面
/** 拓展方法定义*/
protected onMenuItemClick(item: MenuItem);//菜单条目点击回调
}
/** CGReact页面容器组件*/
class CGReactPageTab<STATE = PageTabState, PROP = PageTabProp> extends CGReact.CGReactComponent<STATE, PROP>
{
/** 继承方法定义*/
protected affectStyle(): JSS; //生效样式
protected renderView(): React.ReactElement<any>; //渲染页面
/** 拓展方法定义*/
protected onPageTabClick(tab: TabTitle);//分页点击回调
protected onPageTabCloseButtonClick(tab: TabTitle);//分页关闭回调
}
/** CGReact动态数据表格组件*/
class CGReactTable<STATE = TableState, PROP = TableProps> extends CGReact.CGReactComponent<STATE, PROP>
{
/** 继承方法定义*/
protected affectStyle(): JSS; //生效样式
protected renderView(): React.ReactElement<any>; //渲染页面
/*@ts-ignore 当请求分页数据时回调此方法*/
protected async onFetchTableBodyRowData(page: TablePage, setRecordCount: (count: number) => void): Promise<CGReactTableRowState<TableKey>[]>;//@ts-ignore当请求分页数据时回调此方法
protected async onFetchTableBodyRowChild(row: TableRow): Promise<CGReactTableRowState<TableKey>[]>;//当获取行展开数据时自动回调
protected onHeaderExpandButtonClick(config: TableColumn, expand: boolean);//行展开按钮点击回调
protected onHeaderSortButtonClick(page: TablePage, config: TableColumn, newSort: "asc" | "desc");//行排序按钮点击回调
protected onPaginatePageChange(page: TablePage);//分页变更回调
protected onAddButtonClick(): void; //Table工具条左侧"添加"按钮回调
protected onEditButtonClick(): void; //Table工具条左侧"编辑"按钮回调
protected onDeleteButtonClick(): void; //Table工具左侧条"删除"按钮回调
protected onSortButtonClick(): void; //Table工具条左侧"排序"按钮回调
protected onFilterButtonClick(): void; //Table工具条右侧"过滤"按钮回调
protected onPrintButtonClick(): void; //Table工具条右侧"打印"按钮回调
protected onExportButtonClick(): void; //Table工具条右侧"导出"按钮回调
protected onInfoButtonClick(): void; //Table工具条右侧"信息"按钮回调
protected onFavorButtonClick(): void;//Table工具条右侧"收藏"按钮回调
}
}