@aliretail/react-materials-components
Version:
119 lines (118 loc) • 2.97 kB
TypeScript
export interface IObjectType {
[key: string]: any;
}
export interface IWarehouseType {
name: string;
id: string;
}
export interface IOptionType {
label?: string;
value: string;
name?: string;
}
interface IStoreType {
[channelId: string]: Array<IOptionType>;
}
export interface SingeleValue {
id?: string;
dataSource: any[];
totalProportion?: number;
channelId?: string;
}
export interface IPropsType {
/**
* 最大比例值
* @default 100
*/
maxRatio?: number;
/**
* 列表表头
* @default 无
*/
columns: Array<any>;
/**
* 列表数据,因为可以可能是多个列表,且有两个数据,每个数组对象都是一个对象;
* 每个对象格式{ channelId:"", dataSource:[] },channelId为对应列表的渠道id,dataSource为每个对应渠道的列表信息
* @default []
*/
value: Array<SingeleValue>;
/**
* 同步比例的key,用于计算每个列表里面的同步比例总和,若不传则默认外部计算比例总和
* @default 无
*/
ratioKey: string;
/**
* 仓库名
* @default 无
*/
warehouseName: string;
/**
* 仓库Id
* @default 无
*/
warehouseId: string;
/**
* 仓库列表
* @default []
*/
warehouseList: Array<IOptionType>;
/**
* 渠道列表
* @default []
*/
channelList: Array<IOptionType>;
/**
* 店铺信息,是个对象,对象格式{[key]:[]},key为渠道id,即选中渠道时返回的唯一值
* @default {}
*/
storeData: IStoreType;
/**
* 仓库id变化回调
* @default 无
*/
onWarehouseChange: (val: string) => void;
/**
* 渠道id变化回调
* @default 无
*/
onChannelChange: (val: string) => void;
/**
* value变化回调
* @default ()=>{}
*/
onChange: (val: Array<SingeleValue>) => void;
/**
* 渠道变化时,校验方法,true继续往下走,修改数据,false结束
* @default ()=>{}
*/
validatorChannel?: (value: string, key: string) => boolean;
}
export interface IStateType {
warehouseSearchRes?: any[];
isWareHouseSearch: boolean;
}
export interface IStoreTableProps {
channelId?: string;
dataSource: any[];
columns: any[];
otherTableProps?: IObjectType;
onChange: (key: string, val: any[], total: number) => void;
status: string;
channelList: Array<IOptionType>;
storeList: Array<IOptionType>;
totalProportion: number;
maxRatio: number;
onChangeChannel: (channelId: any, key: any) => void;
dataKey: string;
ratioKey: string;
validatorStore?: (value: string) => boolean;
storeKey?: string;
fieldInit: any;
fieldGetError: any;
addArrayValue: any;
deleteArrayValue: any;
filed: any;
hasDelete?: boolean;
onDeleteTable: (key: any) => void;
}
export {};