/* * @Author: 疯狂秀才(Lucas Huang) * @Date: 2019-07-10 11:44:49 * @LastEditors: 疯狂秀才(Lucas Huang) * @LastEditTime: 2019-09-25 18:10:54 * @QQ: 1055818239 * @Version: v0.0.1 */ import { DataColumn } from '@farris/ui-common/column'; export type ONLY_SELECT_LEAF = 'default' | 'yes' | 'no'; export type LOAD_DATA_TYPE = 'all' | 'fav' | 'list' | 'nav' | 'search' | 'children' | 'textchange' | 'sort' | 'navsearch' | 'selected' | 'allChildren'; export interface TreeInfo { /** 数据加载方式: all, async */ loadDataType?: 'all' | 'async'; /** 分层方式: pathcode, parentId */ layerType?: string; /** 数据中带有分级信息的字段 */ dataField?: string; /** 父ID字段 */ parentField?: string; /** 分级码字段 */ pathField?: string; /** 级数字段 */ layerField?: string; /** 是否明细字段 */ isDetailField?: string; /** * 只允许选择叶子节点 * - default: 应用服务器端设置,如服务器未设置,功能同 `no` * - `yes`: 服务器端设置失效。仅允许选择叶子节点。 * - `no`: 服务器端设置失效。所有节点均可选择。 */ onlySelectLeaf?: boolean | ONLY_SELECT_LEAF; /** 树结构数据是否已初始化完成 */ treeDataIsInit?: boolean; } export interface LookupGridResult { /** 列信息 */ columns?: DataColumn[]; /** 数据列表 */ items?: any[]; /** 查询字段 */ searchFields?: { label: string, value: string }[]; /** 分页信息 */ pageInfo?: { pageIndex: number, pageSize: number, pageList?: number[], enablePager: boolean }; /** 总记录数 */ total?: number; /** 废弃 */ mapFields?: { desgine: string, runtime: string }[]; /** 树分级信息 */ treeInfo?: TreeInfo; displayType?: string; displayInfo?: DisplayInfo; title?: string; navigation?: NavigationOptions; valueField?: string; textField?: string; idField?: string; /** 已选择数据列表 */ selectedItems?: any; /** 收藏数据 */ favoriteItems?: any[]; } /** 个性化数据 */ export interface PersonalConfig { tabIndex?: string; favorite?: { [lang: string]: any[]; }; quickSelected?: { [lang: string]: any[]; }; size?: any; selections?: any; [key: string]: any; } export interface NavigationOptions extends LookupGridResult { [key: string]: any; displayType: 'List' | 'TreeList'; width: number; idField?: string; relations?: { groupField: string, helpField: string }[]; hover?: boolean; } export interface LookupGridOptions extends LookupGridResult { singleSelect?: boolean; idField?: string; uri?: string; // 可以为元数据ID、webapi 地址 showFilterBar?: boolean; pagination?: boolean; pageIndex?: number; pageSize?: number; pageList?: number[]; total?: number; width?: number; height?: number; hover?: boolean; } export class DisplayInfo { title?: string; favorites?: string; okText?: string; cancelText?: string; allColumns?: string; } export const lookupGridDefaults: LookupGridOptions = { singleSelect: true, showFilterBar: true, pagination: true, pageIndex: 1, pageSize: 10, pageList: [10, 20, 30, 50, 100] }; export const displayInfoDefault = { title: '此处显示标题', favorites: '收藏夹', okText: '确定', cancelText: '取消', allColumns: '所有列' }; /** 帮助前事件返回类型 */ export interface PickingResult { /** true: 继续打开帮助;false: 不打开帮助窗口 */ showDialog: boolean; /** 携带的一些自定义数据,由业务在服务器端帮助前事件中处理 */ data?: any; message?: any; } export interface PickedResult { closeDialog: boolean; message?: any; }