///
import { Result } from 'ahooks/es/useRequest/src/types';
import { ActionsItem } from '../../dataSourceForm/serve';
export interface Field {
name: string;
type: string;
allowNull: boolean;
primaryKey: boolean;
unique: boolean;
autoIncrement: boolean;
description?: (null | string)[];
possibleTypes?: string[];
rawType: string;
interface: string;
uiSchema: UiSchema;
key?: string;
collectionName?: string;
collectionKey?: any;
dataSourceKey?: string;
defaultValue?: any;
}
interface UiSchema {
type?: string;
'x-component': string;
'x-component-props'?: Xcomponentprops;
'x-validator'?: string;
title: string;
default?: any;
enum?: any[];
}
interface Xcomponentprops {
style?: Style;
autoSize?: AutoSize;
stringMode?: boolean;
step?: string;
dateFormat?: string;
showTime?: boolean;
}
interface AutoSize {
minRows: number;
}
interface Style {
width: string;
}
export declare type ActionTypes = 'list' | 'get' | 'update' | 'create' | 'destroy';
export declare type DataSourceType = {
fromSettingMeta: boolean;
fromDeviceSettingMeta?: boolean;
actions: {
get: ActionsItem;
update: ActionsItem;
create: ActionsItem;
delete: ActionsItem;
list: ActionsItem;
};
headerDataSource: string;
dataSourceKey: string;
filterTargetKey: string;
introspected: boolean;
isCustomApi: boolean;
key: string;
tableName: string;
logging: boolean;
name: string;
title: string;
titleField: string;
types: ActionTypes[];
fields: Field[];
options: {
apiType: string;
baseUrl: string;
};
};
export declare type DataSourceContextProps = {
dataSource: DataSourceType;
children?: React.ReactNode;
currentValue?: string;
actions?: {
list?: () => Promise;
get?: () => Promise;
update?: () => Promise;
create?: () => Promise;
destroy?: () => Promise;
};
requestOptions?: {
list?: any;
get?: any;
update?: any;
create?: any;
destroy?: any;
};
overrideData?: {
list?: any;
get?: any;
};
autoRun?: {
list?: boolean;
get?: boolean;
};
extraParams?: {
list?: Record;
get?: Record;
update?: Record;
create?: Record;
destroy?: Record;
};
__id?: string;
__designMode?: string;
};
export interface DataSourceContextType {
dataSource?: DataSourceType;
list: Result;
destroy: Result;
get: Result;
update: Result;
create: Result;
__designMode?: string;
getCurrentRecord: () => any;
}
export declare const DataSourceContext: import("react").Context;
export default DataSourceContext;