ng-layout-form
Version:
layout form
190 lines (189 loc) • 5 kB
TypeScript
import { ColumnProps, IObject } from 'ng-lib-tsx';
import React, { ComponentClass, FunctionComponent } from 'react';
import { LabelPosition, Layout } from '../interface';
export interface CONF_INFO {
form?: {
[propskey: string]: FORM_ENTRY;
};
fieldSetForm?: {
desTitle: string;
id?: string;
itemId?: string;
fieldSets: Array<FORM_ENTRY>;
[propskey: string]: any;
};
grid?: {
[propskey: string]: {};
};
tabPanel: {
id: string;
desTitle: string;
items: Array<TabPanelItem>;
};
}
export interface TabPanelItem {
/**
* @description 标签页Id
*/
id: string;
/**
* @description 标签页标题
*/
title: string;
/**
* @description 标签页内容组件
*/
xtype?: React.ReactNode;
/**
* @description 是否强制渲染
* @default false
*/
forceRender?: boolean;
height?: number | string;
}
interface COMMON_LAYOUT_ENTRY {
id?: string;
name?: string;
label?: React.ReactNode;
}
export declare type FORM_ENTRY = {
/**
* @description 标签宽度
* @default 85
*/
labelWidth?: number | string;
/**
* @description 绑定的数据库表名
*/
bindtable?: string;
/**
* @description 表单条目配置
*/
children: Array<FIELD_PROPERTYS>;
/**
* @description 标签位置
* @default right
*/
labelPosition?: LabelPosition;
/**
* @description 表格表单
*/
bordered?: boolean;
/**
* @description 表格列数
*/
colspan?: number | Array<number> | {
[propsKey: number]: number;
};
layout?: Layout;
[propskey: string]: any;
} & COMMON_LAYOUT_ENTRY;
export declare type FIELD_PROPERTYS = {
/**
* @description 组件类型
* @default NGInput
*/
xtype?: COMP_TYPE;
/**
* @description 跨列
* @default 1
*/
colspan?: number;
/**
* @description 提示
*/
placeholder?: string;
/**
* @description 是否必填
*/
required?: boolean;
/**
* @description 是否禁用
*/
disabled?: boolean;
/**
* @description 表填条目组件私有属性
*/
antProps?: object;
/**
* @description 多语言的key值
*/
langKey?: string;
/**
* @description 子元素
*/
children?: FIELD_PROPERTYS[];
/**
* @description 子元素,元数据配置中原ext配置
*/
items?: FIELD_PROPERTYS[];
/**
* @description 额外的提示信息
*/
extra?: React.ReactNode;
/**
* @description 其他属性,根据xtype进行配置
*/
[propskey: string]: any;
} & Partial<DataItemType> & COMMON_LAYOUT_ENTRY;
export declare type CONF_INFO_KEY = keyof CONF_INFO;
export declare type COMP_TYPE = 'ngFormPanel' | 'container' | 'NGCheckBoxGroup' | 'NGInput' | 'NGInputNumber' | 'NGSelect' | 'NGDatePicker' | 'NGDateTimePicker' | 'NGTimePicker' | 'NGSingleHelp' | 'NGMultipleHelp' | 'NGPassword' | 'NGButton' | 'NGTextArea' | 'NGRadio' | 'NGRadioGroup' | String | React.ComponentType<any>;
export declare type DataItemType = {
value?: string;
label?: React.ReactNode;
children?: Array<DataItemType>;
[propskey: string]: any;
};
export interface Common_Property {
type: string;
defaultValue?: any;
editor: ComponentClass<any, any> | FunctionComponent<any>;
writeable: boolean;
cnLabel?: string;
}
export declare type Comp_Props = {
[propskey: string]: Common_Property;
};
export interface COMP_ENTRY {
instance: React.ComponentType<any> | string;
defaultProps?: IObject;
props?: Comp_Props;
children?: any;
listener?: {
[propskey: string]: string;
};
}
export interface COMP_CONF {
[xtype: string]: COMP_ENTRY;
}
export interface treeNode {
value: any;
name: string;
label: React.ReactNode;
children: Array<treeNode> | null;
}
declare type Lay_Config_Props = Comp_Props | {
childItem?: Comp_Props;
};
export declare type Config_Props = {
grid: Lay_Config_Props;
tabPanel: Lay_Config_Props;
fieldSetForm: Lay_Config_Props | {
childItem: Lay_Config_Props;
};
form: Lay_Config_Props;
};
export declare namespace formConfProps {
type FormFieldSet = Array<FIELD_PROPERTYS> | FORM_ENTRY;
type FormLayout = FormFieldSet;
type FormSet = Array<FORM_ENTRY> | {
children: Array<FORM_ENTRY>;
[propskey: string]: any;
};
type GridView = {
children: Array<ColumnProps>;
[propskey: string]: any;
} | Array<ColumnProps>;
type TabPanel = Array<TabPanelItem>;
}
export {};