amis-model-design
Version:
amis模型设计器
1,280 lines • 133 kB
TypeScript
/**
* @file CRUDBuilder
* @desc 新版CRUD表格使用, 和TableListSchemaBuilder有区别所以单独列出来了
*/
/// <reference types="react" />
import { BaseSchemaBuilder } from './SchemaBuilder';
import { Manager } from '../base/Manager';
import { ApiBuilder } from './ApiBuilder';
import { SharedContext } from './SharedContext';
import { ApiStrategyInterface } from './ApiStrategyInterface';
import { EntityFormSchemaBuilder } from './EntityFormBuilder';
import type { Schema } from 'amis';
import type { ModelItem, ModelEntityApiSchema, ExtraField, FeatType } from '../type';
import type { ModelStore } from 'base/ModelStore';
export interface CRUDBuilderOptions {
/** 表格的展示模式 */
mode: 'table2' | 'list' | 'cards' | 'table';
/** 支持的功能场景 */
feats: FeatType[];
/** 支持列表查看的字段集合 */
listFields: ExtraField[];
/** 支持新增的字段集合 */
insertFields?: ExtraField[];
/** 支持批量编辑字段集合 */
bulkEditFields?: ExtraField[];
/** 支持查看详情的字段集合 */
viewFields?: ExtraField[];
/** 支持编辑的字段集合 */
editFields?: ExtraField[];
/** 支持模糊查询的字段集合 */
fuzzyQueryFields?: ExtraField[];
/** 支持简单查询的字段集合 */
simpleQueryFields?: ExtraField[];
/** 支持高级查询的字段集合 */
advancedQueryFields?: ExtraField[];
/** 列表接口的预过滤条件 */
filters?: ModelEntityApiSchema['filters'];
/** 列表接口的排序规则 */
orders?: ModelEntityApiSchema['orders'];
}
export declare class CRUDSchemaBuilder extends BaseSchemaBuilder<CRUDBuilderOptions> {
readonly model: ModelItem;
readonly apiStrategy: ApiStrategyInterface;
readonly manager: Manager;
readonly sharedContext: SharedContext;
static id: string;
options?: CRUDBuilderOptions;
readonly ApiIdentifier: 'model-entity';
readonly formSchemaBuilder: EntityFormSchemaBuilder;
constructor(model: ModelItem, apiStrategy: ApiStrategyInterface, manager: Manager, sharedContext: SharedContext);
/** 默认使用全量字段 */
makeDefaultOptions(): Promise<CRUDBuilderOptions>;
/** 重新构建时从Schema中解析初始化配置, 不同于模型组件的是,配置项信息直接放在对应功能区的schema中,不再需要$$m了 */
guessOptionsFromSchema(schema: any): Promise<CRUDBuilderOptions>;
/** 从Schema中提取指定功能场景的可用字段集合 */
extractFieldsBySchema(fields: {
id: string;
fieldId?: string;
[propName: string]: any;
}[], feat: FeatType): Promise<ExtraField[]>;
getFeatKey(feat: FeatType): Exclude<keyof CRUDBuilderOptions, 'mode' | 'feats' | 'filters' | 'orders'>;
/** 根据过滤类型构建Where条件子句 */
buildListWhereClause(ab: ApiBuilder, options?: CRUDBuilderOptions, context?: {
columns?: Array<{
title: string;
key: string;
fieldId: string;
searchable?: any;
[propName: string]: any;
}>;
fuzzyQueryKey?: string;
}): Promise<void>;
/** 构建列表展示API */
buildListApi(options?: CRUDBuilderOptions, columns?: any[]): Promise<{
orders?: {
field: string;
order: boolean;
}[] | undefined;
filters?: import("amis").ConditionValue | undefined;
limit: string;
jsonql?: any;
vars?: any[] | undefined;
sourceType?: string | undefined;
runtimeQuery?: Record<string, string> | undefined;
config?: {
withCredentials?: boolean | undefined;
cancelExecutor?: ((cancel: Function) => void) | undefined;
} | undefined;
originUrl?: string | undefined;
graphql?: string | undefined;
operationName?: string | undefined;
body?: import("amis").PlainObject | undefined;
query?: import("amis").PlainObject | undefined;
mockResponse?: {
status: number;
data?: any;
delay?: number | undefined;
} | undefined;
adaptor?: import("amis").ResponseAdaptor | undefined;
requestAdaptor?: import("amis").RequestAdaptor | undefined;
context?: any;
filterEmptyQuery?: boolean | undefined;
downloadFileName?: string | undefined; /**
* "action": 功能 -- 用于标识API的功能场景
* "behavior": 功能 -- 用于标识普通组件的功能场景
* "feat": 功能 -- 用于标识Form组件的功能场景
*/
method?: string | undefined;
url: string;
data?: {
[propName: string]: any;
} | undefined;
convertKeyToPath?: boolean | undefined;
responseData?: {
[propName: string]: any;
} | undefined;
attachDataToQuery?: boolean | undefined;
dataType?: "form" | "json" | "form-data" | undefined;
responseType?: "blob" | undefined;
headers?: {
[propName: string]: string | number;
} | undefined;
sendOn?: string | undefined;
replaceData?: boolean | undefined;
concatDataFields?: string | string[] | undefined;
autoRefresh?: boolean | undefined;
trackExpression?: string | undefined;
cache?: number | undefined;
forceAppendDataToQuery?: boolean | undefined;
qsOptions?: {
arrayFormat?: "repeat" | "indices" | "brackets" | "comma" | undefined;
indices?: boolean | undefined;
allowDots?: boolean | undefined;
} | undefined;
silent?: boolean | undefined;
messages?: {
success?: string | undefined;
failed?: string | undefined;
} | undefined;
action?: FeatType | undefined;
origin?: "sdk" | "saas" | undefined;
strategy?: "restful" | "jsonql" | undefined;
scene?: "list" | "suggestion" | "autoFill" | "options" | undefined;
entity?: {
value: string;
label: string;
dsId: string;
dsKey: string;
dsLabel: string;
mId: string;
mKey: string;
mLabel: string;
} | undefined;
select?: import("../type").SelectField[] | undefined;
}>;
parseRelationModel(model: ModelStore, host: string[], ab: ApiBuilder): Promise<void>;
/** 构建列表项展示API */
buildDetailApi(options: CRUDBuilderOptions, feat: 'Edit' | 'View'): Promise<{
limit: string;
jsonql?: any;
vars?: any[] | undefined;
sourceType?: string | undefined;
runtimeQuery?: Record<string, string> | undefined;
config?: {
withCredentials?: boolean | undefined;
cancelExecutor?: ((cancel: Function) => void) | undefined;
} | undefined;
originUrl?: string | undefined;
graphql?: string | undefined;
operationName?: string | undefined;
body?: import("amis").PlainObject | undefined;
query?: import("amis").PlainObject | undefined;
mockResponse?: {
status: number;
data?: any;
delay?: number | undefined;
} | undefined;
adaptor?: import("amis").ResponseAdaptor | undefined;
requestAdaptor?: import("amis").RequestAdaptor | undefined;
context?: any;
filterEmptyQuery?: boolean | undefined;
downloadFileName?: string | undefined; /**
* "action": 功能 -- 用于标识API的功能场景
* "behavior": 功能 -- 用于标识普通组件的功能场景
* "feat": 功能 -- 用于标识Form组件的功能场景
*/
method?: string | undefined;
url: string;
data?: {
[propName: string]: any;
} | undefined;
convertKeyToPath?: boolean | undefined;
responseData?: {
[propName: string]: any;
} | undefined;
attachDataToQuery?: boolean | undefined;
dataType?: "form" | "json" | "form-data" | undefined;
responseType?: "blob" | undefined;
headers?: {
[propName: string]: string | number;
} | undefined;
sendOn?: string | undefined;
replaceData?: boolean | undefined;
concatDataFields?: string | string[] | undefined;
autoRefresh?: boolean | undefined;
trackExpression?: string | undefined;
cache?: number | undefined;
forceAppendDataToQuery?: boolean | undefined;
qsOptions?: {
arrayFormat?: "repeat" | "indices" | "brackets" | "comma" | undefined;
indices?: boolean | undefined;
allowDots?: boolean | undefined;
} | undefined;
silent?: boolean | undefined;
messages?: {
success?: string | undefined;
failed?: string | undefined;
} | undefined;
action?: FeatType | undefined;
origin?: "sdk" | "saas" | undefined;
strategy?: "restful" | "jsonql" | undefined;
scene?: "list" | "suggestion" | "autoFill" | "options" | undefined;
entity?: {
value: string;
label: string;
dsId: string;
dsKey: string;
dsLabel: string;
mId: string;
mKey: string;
mLabel: string;
} | undefined;
select?: import("../type").SelectField[] | undefined;
filters?: import("amis").ConditionValue | undefined;
orders?: {
field: string;
order: boolean;
}[] | undefined;
}>;
/** 新增 */
buildInsertApi(options: CRUDBuilderOptions): Promise<{
/** 新增后接口会返回主键字段,此时再次提交的时候可能会携带导致 SQL 执行错误 */
data: {
[x: string]: string;
'&': string;
};
config?: {
withCredentials?: boolean | undefined;
cancelExecutor?: ((cancel: Function) => void) | undefined;
} | undefined;
originUrl?: string | undefined;
jsonql?: any;
graphql?: string | undefined;
operationName?: string | undefined;
body?: import("amis").PlainObject | undefined;
query?: import("amis").PlainObject | undefined;
mockResponse?: {
status: number;
data?: any;
delay?: number | undefined;
} | undefined;
adaptor?: import("amis").ResponseAdaptor | undefined;
requestAdaptor?: import("amis").RequestAdaptor | undefined;
context?: any;
filterEmptyQuery?: boolean | undefined;
downloadFileName?: string | undefined; /**
* "action": 功能 -- 用于标识API的功能场景
* "behavior": 功能 -- 用于标识普通组件的功能场景
* "feat": 功能 -- 用于标识Form组件的功能场景
*/
method?: string | undefined;
url: string;
convertKeyToPath?: boolean | undefined;
responseData?: {
[propName: string]: any;
} | undefined;
attachDataToQuery?: boolean | undefined;
dataType?: "form" | "json" | "form-data" | undefined;
responseType?: "blob" | undefined;
headers?: {
[propName: string]: string | number;
} | undefined;
sendOn?: string | undefined;
replaceData?: boolean | undefined;
concatDataFields?: string | string[] | undefined;
autoRefresh?: boolean | undefined;
trackExpression?: string | undefined;
cache?: number | undefined;
forceAppendDataToQuery?: boolean | undefined;
qsOptions?: {
arrayFormat?: "repeat" | "indices" | "brackets" | "comma" | undefined;
indices?: boolean | undefined;
allowDots?: boolean | undefined;
} | undefined;
silent?: boolean | undefined;
messages?: {
success?: string | undefined;
failed?: string | undefined;
} | undefined;
action?: FeatType | undefined;
origin?: "sdk" | "saas" | undefined;
sourceType?: "model-entity" | "api" | "apicenter" | undefined;
strategy?: "restful" | "jsonql" | undefined;
scene?: "list" | "suggestion" | "autoFill" | "options" | undefined;
entity?: {
value: string;
label: string;
dsId: string;
dsKey: string;
dsLabel: string;
mId: string;
mKey: string;
mLabel: string;
} | undefined;
select?: import("../type").SelectField[] | undefined;
limit?: "piece" | "multiple" | undefined;
filters?: import("amis").ConditionValue | undefined;
orders?: {
field: string;
order: boolean;
}[] | undefined;
runtimeQuery?: Record<string, string> | undefined;
}>;
/** 删除 */
buildDeleteApi(options: CRUDBuilderOptions): Promise<{
config?: {
withCredentials?: boolean | undefined;
cancelExecutor?: ((cancel: Function) => void) | undefined;
} | undefined;
originUrl?: string | undefined;
jsonql?: any;
graphql?: string | undefined;
operationName?: string | undefined;
body?: import("amis").PlainObject | undefined;
query?: import("amis").PlainObject | undefined;
mockResponse?: {
status: number;
data?: any;
delay?: number | undefined;
} | undefined;
adaptor?: import("amis").ResponseAdaptor | undefined;
requestAdaptor?: import("amis").RequestAdaptor | undefined;
context?: any;
filterEmptyQuery?: boolean | undefined;
downloadFileName?: string | undefined; /**
* "action": 功能 -- 用于标识API的功能场景
* "behavior": 功能 -- 用于标识普通组件的功能场景
* "feat": 功能 -- 用于标识Form组件的功能场景
*/
method?: string | undefined;
url: string;
data?: {
[propName: string]: any;
} | undefined;
convertKeyToPath?: boolean | undefined;
responseData?: {
[propName: string]: any;
} | undefined;
attachDataToQuery?: boolean | undefined;
dataType?: "form" | "json" | "form-data" | undefined;
responseType?: "blob" | undefined;
headers?: {
[propName: string]: string | number;
} | undefined;
sendOn?: string | undefined;
replaceData?: boolean | undefined;
concatDataFields?: string | string[] | undefined;
autoRefresh?: boolean | undefined;
trackExpression?: string | undefined;
cache?: number | undefined;
forceAppendDataToQuery?: boolean | undefined;
qsOptions?: {
arrayFormat?: "repeat" | "indices" | "brackets" | "comma" | undefined;
indices?: boolean | undefined;
allowDots?: boolean | undefined;
} | undefined;
silent?: boolean | undefined;
messages?: {
success?: string | undefined;
failed?: string | undefined;
} | undefined;
action?: FeatType | undefined;
origin?: "sdk" | "saas" | undefined;
sourceType?: "model-entity" | "api" | "apicenter" | undefined;
strategy?: "restful" | "jsonql" | undefined;
scene?: "list" | "suggestion" | "autoFill" | "options" | undefined;
entity?: {
value: string;
label: string;
dsId: string;
dsKey: string;
dsLabel: string;
mId: string;
mKey: string;
mLabel: string;
} | undefined;
select?: import("../type").SelectField[] | undefined;
limit?: "piece" | "multiple" | undefined;
filters?: import("amis").ConditionValue | undefined;
orders?: {
field: string;
order: boolean;
}[] | undefined;
runtimeQuery?: Record<string, string> | undefined;
}>;
/** 批量删除 */
buildBulkDeleteApi(options: CRUDBuilderOptions): Promise<{
config?: {
withCredentials?: boolean | undefined;
cancelExecutor?: ((cancel: Function) => void) | undefined;
} | undefined;
originUrl?: string | undefined;
jsonql?: any;
graphql?: string | undefined;
operationName?: string | undefined;
body?: import("amis").PlainObject | undefined;
query?: import("amis").PlainObject | undefined;
mockResponse?: {
status: number;
data?: any;
delay?: number | undefined;
} | undefined;
adaptor?: import("amis").ResponseAdaptor | undefined;
requestAdaptor?: import("amis").RequestAdaptor | undefined;
context?: any;
filterEmptyQuery?: boolean | undefined;
downloadFileName?: string | undefined; /**
* "action": 功能 -- 用于标识API的功能场景
* "behavior": 功能 -- 用于标识普通组件的功能场景
* "feat": 功能 -- 用于标识Form组件的功能场景
*/
method?: string | undefined;
url: string;
data?: {
[propName: string]: any;
} | undefined;
convertKeyToPath?: boolean | undefined;
responseData?: {
[propName: string]: any;
} | undefined;
attachDataToQuery?: boolean | undefined;
dataType?: "form" | "json" | "form-data" | undefined;
responseType?: "blob" | undefined;
headers?: {
[propName: string]: string | number;
} | undefined;
sendOn?: string | undefined;
replaceData?: boolean | undefined;
concatDataFields?: string | string[] | undefined;
autoRefresh?: boolean | undefined;
trackExpression?: string | undefined;
cache?: number | undefined;
forceAppendDataToQuery?: boolean | undefined;
qsOptions?: {
arrayFormat?: "repeat" | "indices" | "brackets" | "comma" | undefined;
indices?: boolean | undefined;
allowDots?: boolean | undefined;
} | undefined;
silent?: boolean | undefined;
messages?: {
success?: string | undefined;
failed?: string | undefined;
} | undefined;
action?: FeatType | undefined;
origin?: "sdk" | "saas" | undefined;
sourceType?: "model-entity" | "api" | "apicenter" | undefined;
strategy?: "restful" | "jsonql" | undefined;
scene?: "list" | "suggestion" | "autoFill" | "options" | undefined;
entity?: {
value: string;
label: string;
dsId: string;
dsKey: string;
dsLabel: string;
mId: string;
mKey: string;
mLabel: string;
} | undefined;
select?: import("../type").SelectField[] | undefined;
limit?: "piece" | "multiple" | undefined;
filters?: import("amis").ConditionValue | undefined;
orders?: {
field: string;
order: boolean;
}[] | undefined;
runtimeQuery?: Record<string, string> | undefined;
}>;
/** 编辑 */
buildEditApi(options: CRUDBuilderOptions): Promise<{
config?: {
withCredentials?: boolean | undefined;
cancelExecutor?: ((cancel: Function) => void) | undefined;
} | undefined;
originUrl?: string | undefined;
jsonql?: any;
graphql?: string | undefined;
operationName?: string | undefined;
body?: import("amis").PlainObject | undefined;
query?: import("amis").PlainObject | undefined;
mockResponse?: {
status: number;
data?: any;
delay?: number | undefined;
} | undefined;
adaptor?: import("amis").ResponseAdaptor | undefined;
requestAdaptor?: import("amis").RequestAdaptor | undefined;
context?: any;
filterEmptyQuery?: boolean | undefined;
downloadFileName?: string | undefined; /**
* "action": 功能 -- 用于标识API的功能场景
* "behavior": 功能 -- 用于标识普通组件的功能场景
* "feat": 功能 -- 用于标识Form组件的功能场景
*/
method?: string | undefined;
url: string;
data?: {
[propName: string]: any;
} | undefined;
convertKeyToPath?: boolean | undefined;
responseData?: {
[propName: string]: any;
} | undefined;
attachDataToQuery?: boolean | undefined;
dataType?: "form" | "json" | "form-data" | undefined;
responseType?: "blob" | undefined;
headers?: {
[propName: string]: string | number;
} | undefined;
sendOn?: string | undefined;
replaceData?: boolean | undefined;
concatDataFields?: string | string[] | undefined;
autoRefresh?: boolean | undefined;
trackExpression?: string | undefined;
cache?: number | undefined;
forceAppendDataToQuery?: boolean | undefined;
qsOptions?: {
arrayFormat?: "repeat" | "indices" | "brackets" | "comma" | undefined;
indices?: boolean | undefined;
allowDots?: boolean | undefined;
} | undefined;
silent?: boolean | undefined;
messages?: {
success?: string | undefined;
failed?: string | undefined;
} | undefined;
action?: FeatType | undefined;
origin?: "sdk" | "saas" | undefined;
sourceType?: "model-entity" | "api" | "apicenter" | undefined;
strategy?: "restful" | "jsonql" | undefined;
scene?: "list" | "suggestion" | "autoFill" | "options" | undefined;
entity?: {
value: string;
label: string;
dsId: string;
dsKey: string;
dsLabel: string;
mId: string;
mKey: string;
mLabel: string;
} | undefined;
select?: import("../type").SelectField[] | undefined;
limit?: "piece" | "multiple" | undefined;
filters?: import("amis").ConditionValue | undefined;
orders?: {
field: string;
order: boolean;
}[] | undefined;
runtimeQuery?: Record<string, string> | undefined;
}>;
/** 批量编辑 */
buildBulkEditApi(options: CRUDBuilderOptions): Promise<{
config?: {
withCredentials?: boolean | undefined;
cancelExecutor?: ((cancel: Function) => void) | undefined;
} | undefined;
originUrl?: string | undefined;
jsonql?: any;
graphql?: string | undefined;
operationName?: string | undefined;
body?: import("amis").PlainObject | undefined;
query?: import("amis").PlainObject | undefined;
mockResponse?: {
status: number;
data?: any;
delay?: number | undefined;
} | undefined;
adaptor?: import("amis").ResponseAdaptor | undefined;
requestAdaptor?: import("amis").RequestAdaptor | undefined;
context?: any;
filterEmptyQuery?: boolean | undefined;
downloadFileName?: string | undefined; /**
* "action": 功能 -- 用于标识API的功能场景
* "behavior": 功能 -- 用于标识普通组件的功能场景
* "feat": 功能 -- 用于标识Form组件的功能场景
*/
method?: string | undefined;
url: string;
data?: {
[propName: string]: any;
} | undefined;
convertKeyToPath?: boolean | undefined;
responseData?: {
[propName: string]: any;
} | undefined;
attachDataToQuery?: boolean | undefined;
dataType?: "form" | "json" | "form-data" | undefined;
responseType?: "blob" | undefined;
headers?: {
[propName: string]: string | number;
} | undefined;
sendOn?: string | undefined;
replaceData?: boolean | undefined;
concatDataFields?: string | string[] | undefined;
autoRefresh?: boolean | undefined;
trackExpression?: string | undefined;
cache?: number | undefined;
forceAppendDataToQuery?: boolean | undefined;
qsOptions?: {
arrayFormat?: "repeat" | "indices" | "brackets" | "comma" | undefined;
indices?: boolean | undefined;
allowDots?: boolean | undefined;
} | undefined;
silent?: boolean | undefined;
messages?: {
success?: string | undefined;
failed?: string | undefined;
} | undefined;
action?: FeatType | undefined;
origin?: "sdk" | "saas" | undefined;
sourceType?: "model-entity" | "api" | "apicenter" | undefined;
strategy?: "restful" | "jsonql" | undefined;
scene?: "list" | "suggestion" | "autoFill" | "options" | undefined;
entity?: {
value: string;
label: string;
dsId: string;
dsKey: string;
dsLabel: string;
mId: string;
mKey: string;
mLabel: string;
} | undefined;
select?: import("../type").SelectField[] | undefined;
limit?: "piece" | "multiple" | undefined;
filters?: import("amis").ConditionValue | undefined;
orders?: {
field: string;
order: boolean;
}[] | undefined;
runtimeQuery?: Record<string, string> | undefined;
}>;
/** 快速编辑 */
buildQuickEditApi(options: CRUDBuilderOptions, bulk?: boolean): Promise<{
config?: {
withCredentials?: boolean | undefined;
cancelExecutor?: ((cancel: Function) => void) | undefined;
} | undefined;
originUrl?: string | undefined;
jsonql?: any;
graphql?: string | undefined;
operationName?: string | undefined;
body?: import("amis").PlainObject | undefined;
query?: import("amis").PlainObject | undefined;
mockResponse?: {
status: number;
data?: any;
delay?: number | undefined;
} | undefined;
adaptor?: import("amis").ResponseAdaptor | undefined;
requestAdaptor?: import("amis").RequestAdaptor | undefined;
context?: any;
filterEmptyQuery?: boolean | undefined;
downloadFileName?: string | undefined; /**
* "action": 功能 -- 用于标识API的功能场景
* "behavior": 功能 -- 用于标识普通组件的功能场景
* "feat": 功能 -- 用于标识Form组件的功能场景
*/
method?: string | undefined;
url: string;
data?: {
[propName: string]: any;
} | undefined;
convertKeyToPath?: boolean | undefined;
responseData?: {
[propName: string]: any;
} | undefined;
attachDataToQuery?: boolean | undefined;
dataType?: "form" | "json" | "form-data" | undefined;
responseType?: "blob" | undefined;
headers?: {
[propName: string]: string | number;
} | undefined;
sendOn?: string | undefined;
replaceData?: boolean | undefined;
concatDataFields?: string | string[] | undefined;
autoRefresh?: boolean | undefined;
trackExpression?: string | undefined;
cache?: number | undefined;
forceAppendDataToQuery?: boolean | undefined;
qsOptions?: {
arrayFormat?: "repeat" | "indices" | "brackets" | "comma" | undefined;
indices?: boolean | undefined;
allowDots?: boolean | undefined;
} | undefined;
silent?: boolean | undefined;
messages?: {
success?: string | undefined;
failed?: string | undefined;
} | undefined;
action?: FeatType | undefined;
origin?: "sdk" | "saas" | undefined;
sourceType?: "model-entity" | "api" | "apicenter" | undefined;
strategy?: "restful" | "jsonql" | undefined;
scene?: "list" | "suggestion" | "autoFill" | "options" | undefined;
entity?: {
value: string;
label: string;
dsId: string;
dsKey: string;
dsLabel: string;
mId: string;
mKey: string;
mLabel: string;
} | undefined;
select?: import("../type").SelectField[] | undefined;
limit?: "piece" | "multiple" | undefined;
filters?: import("amis").ConditionValue | undefined;
orders?: {
field: string;
order: boolean;
}[] | undefined;
runtimeQuery?: Record<string, string> | undefined;
}>;
/** TODO: 目前实体似乎不支持排序API */
buildSaveOrderApi(options: CRUDBuilderOptions): Promise<void>;
/**
* 构建创建表单
*/
buildCreateForm(options: CRUDBuilderOptions, componentId: string): Promise<{
title: string;
size: string;
id: string;
body: {
api: {
/** 新增后接口会返回主键字段,此时再次提交的时候可能会携带导致 SQL 执行错误 */
data: {
[x: string]: string;
'&': string;
};
config?: {
withCredentials?: boolean | undefined;
cancelExecutor?: ((cancel: Function) => void) | undefined;
} | undefined;
originUrl?: string | undefined;
jsonql?: any;
graphql?: string | undefined;
operationName?: string | undefined;
body?: import("amis").PlainObject | undefined;
query?: import("amis").PlainObject | undefined;
mockResponse?: {
status: number;
data?: any;
delay?: number | undefined;
} | undefined;
adaptor?: import("amis").ResponseAdaptor | undefined;
requestAdaptor?: import("amis").RequestAdaptor | undefined;
context?: any;
filterEmptyQuery?: boolean | undefined;
downloadFileName?: string | undefined; /**
* "action": 功能 -- 用于标识API的功能场景
* "behavior": 功能 -- 用于标识普通组件的功能场景
* "feat": 功能 -- 用于标识Form组件的功能场景
*/
method?: string | undefined;
url: string;
convertKeyToPath?: boolean | undefined;
responseData?: {
[propName: string]: any;
} | undefined;
attachDataToQuery?: boolean | undefined;
dataType?: "form" | "json" | "form-data" | undefined;
responseType?: "blob" | undefined;
headers?: {
[propName: string]: string | number;
} | undefined;
sendOn?: string | undefined;
replaceData?: boolean | undefined;
concatDataFields?: string | string[] | undefined;
autoRefresh?: boolean | undefined;
trackExpression?: string | undefined;
cache?: number | undefined;
forceAppendDataToQuery?: boolean | undefined;
qsOptions?: {
arrayFormat?: "repeat" | "indices" | "brackets" | "comma" | undefined;
indices?: boolean | undefined;
allowDots?: boolean | undefined;
} | undefined;
silent?: boolean | undefined;
messages?: {
success?: string | undefined;
failed?: string | undefined;
} | undefined;
action?: FeatType | undefined;
origin?: "sdk" | "saas" | undefined;
sourceType?: "model-entity" | "api" | "apicenter" | undefined;
strategy?: "restful" | "jsonql" | undefined;
scene?: "list" | "suggestion" | "autoFill" | "options" | undefined;
entity?: {
value: string;
label: string;
dsId: string;
dsKey: string;
dsLabel: string;
mId: string;
mKey: string;
mLabel: string;
} | undefined;
select?: import("../type").SelectField[] | undefined;
limit?: "piece" | "multiple" | undefined;
filters?: import("amis").ConditionValue | undefined;
orders?: {
field: string;
order: boolean;
}[] | undefined;
runtimeQuery?: Record<string, string> | undefined;
};
onEvent: {
submitSucc: {
actions: {
actionType: string;
groupType: string;
componentId: string;
}[];
};
};
body: any;
feat: any;
type: any;
mode: any;
id: any;
dsType: any;
};
actions: ({
type: string;
id: string;
actionType: string;
label: string;
level?: undefined;
} | {
type: string;
id: string;
actionType: string;
label: string;
level: string;
})[];
}>;
/** 查看详情 */
buildViewForm(options: CRUDBuilderOptions, componentId: string): Promise<{
title: string;
id: string;
size: string;
body: {
static: boolean;
/** 这里覆盖一下EntityForm 构建出来的标识符 */
feat: string;
initApi: {
limit: string;
jsonql?: any;
vars?: any[] | undefined;
sourceType?: string | undefined;
runtimeQuery?: Record<string, string> | undefined;
config?: {
withCredentials?: boolean | undefined;
cancelExecutor?: ((cancel: Function) => void) | undefined;
} | undefined;
originUrl?: string | undefined;
graphql?: string | undefined;
operationName?: string | undefined;
body?: import("amis").PlainObject | undefined;
query?: import("amis").PlainObject | undefined;
mockResponse?: {
status: number;
data?: any;
delay?: number | undefined;
} | undefined;
adaptor?: import("amis").ResponseAdaptor | undefined;
requestAdaptor?: import("amis").RequestAdaptor | undefined;
context?: any;
filterEmptyQuery?: boolean | undefined;
downloadFileName?: string | undefined; /**
* "action": 功能 -- 用于标识API的功能场景
* "behavior": 功能 -- 用于标识普通组件的功能场景
* "feat": 功能 -- 用于标识Form组件的功能场景
*/
method?: string | undefined;
url: string;
data?: {
[propName: string]: any;
} | undefined;
convertKeyToPath?: boolean | undefined;
responseData?: {
[propName: string]: any;
} | undefined;
attachDataToQuery?: boolean | undefined;
dataType?: "form" | "json" | "form-data" | undefined;
responseType?: "blob" | undefined;
headers?: {
[propName: string]: string | number;
} | undefined;
sendOn?: string | undefined;
replaceData?: boolean | undefined;
concatDataFields?: string | string[] | undefined;
autoRefresh?: boolean | undefined;
trackExpression?: string | undefined;
cache?: number | undefined;
forceAppendDataToQuery?: boolean | undefined;
qsOptions?: {
arrayFormat?: "repeat" | "indices" | "brackets" | "comma" | undefined;
indices?: boolean | undefined;
allowDots?: boolean | undefined;
} | undefined;
silent?: boolean | undefined;
messages?: {
success?: string | undefined;
failed?: string | undefined;
} | undefined;
action?: FeatType | undefined;
origin?: "sdk" | "saas" | undefined;
strategy?: "restful" | "jsonql" | undefined;
scene?: "list" | "suggestion" | "autoFill" | "options" | undefined;
entity?: {
value: string;
label: string;
dsId: string;
dsKey: string;
dsLabel: string;
mId: string;
mKey: string;
mLabel: string;
} | undefined;
select?: import("../type").SelectField[] | undefined;
filters?: import("amis").ConditionValue | undefined;
orders?: {
field: string;
order: boolean;
}[] | undefined;
};
onEvent: {
submitSucc: {
actions: {
actionType: string;
groupType: string;
componentId: string;
}[];
};
};
body: any;
type: any;
mode: any;
id: any;
dsType: any;
};
actions: {
id: string;
type: string;
actionType: string;
label: string;
}[];
}>;
/**
* 构建编辑表单
*/
buildEditForm(options: CRUDBuilderOptions, componentId: string): Promise<{
size: string;
id: string;
title: string;
body: {
api: {
config?: {
withCredentials?: boolean | undefined;
cancelExecutor?: ((cancel: Function) => void) | undefined;
} | undefined;
originUrl?: string | undefined;
jsonql?: any;
graphql?: string | undefined;
operationName?: string | undefined;
body?: import("amis").PlainObject | undefined;
query?: import("amis").PlainObject | undefined;
mockResponse?: {
status: number;
data?: any;
delay?: number | undefined;
} | undefined;
adaptor?: import("amis").ResponseAdaptor | undefined;
requestAdaptor?: import("amis").RequestAdaptor | undefined;
context?: any;
filterEmptyQuery?: boolean | undefined;
downloadFileName?: string | undefined; /**
* "action": 功能 -- 用于标识API的功能场景
* "behavior": 功能 -- 用于标识普通组件的功能场景
* "feat": 功能 -- 用于标识Form组件的功能场景
*/
method?: string | undefined;
url: string;
data?: {
[propName: string]: any;
} | undefined;
convertKeyToPath?: boolean | undefined;
responseData?: {
[propName: string]: any;
} | undefined;
attachDataToQuery?: boolean | undefined;
dataType?: "form" | "json" | "form-data" | undefined;
responseType?: "blob" | undefined;
headers?: {
[propName: string]: string | number;
} | undefined;
sendOn?: string | undefined;
replaceData?: boolean | undefined;
concatDataFields?: string | string[] | undefined;
autoRefresh?: boolean | undefined;
trackExpression?: string | undefined;
cache?: number | undefined;
forceAppendDataToQuery?: boolean | undefined;
qsOptions?: {
arrayFormat?: "repeat" | "indices" | "brackets" | "comma" | undefined;
indices?: boolean | undefined;
allowDots?: boolean | undefined;
} | undefined;
silent?: boolean | undefined;
messages?: {
success?: string | undefined;
failed?: string | undefined;
} | undefined;
action?: FeatType | undefined;
origin?: "sdk" | "saas" | undefined;
sourceType?: "model-entity" | "api" | "apicenter" | undefined;
strategy?: "restful" | "jsonql" | undefined;
scene?: "list" | "suggestion" | "autoFill" | "options" | undefined;
entity?: {
value: string;
label: string;
dsId: string;
dsKey: string;
dsLabel: string;
mId: string;
mKey: string;
mLabel: string;
} | undefined;
select?: import("../type").SelectField[] | undefined;
limit?: "piece" | "multiple" | undefined;
filters?: import("amis").ConditionValue | undefined;
orders?: {
field: string;
order: boolean;
}[] | undefined;
runtimeQuery?: Record<string, string> | undefined;
};
initApi: {
limit: string;
jsonql?: any;
vars?: any[] | undefined;
sourceType?: string | undefined;
runtimeQuery?: Record<string, string> | undefined;
config?: {
withCredentials?: boolean | undefined;
cancelExecutor?: ((cancel: Function) => void) | undefined;
} | undefined;
originUrl?: string | undefined;
graphql?: string | undefined;
operationName?: string | undefined;
body?: import("amis").PlainObject | undefined;
query?: import("amis").PlainObject | undefined;
mockResponse?: {
status: number;
data?: any;
delay?: number | undefined;
} | undefined;
adaptor?: import("amis").ResponseAdaptor | undefined;
requestAdaptor?: import("amis").RequestAdaptor | undefined;
context?: any;
filterEmptyQuery?: boolean | undefined;
downloadFileName?: string | undefined; /**
* "action": 功能 -- 用于标识API的功能场景
* "behavior": 功能 -- 用于标识普通组件的功能场景
* "feat": 功能 -- 用于标识Form组件的功能场景
*/
method?: string | undefined;
url: string;
data?: {
[propName: string]: any;
} | undefined;
convertKeyToPath?: boolean | undefined;
responseData?: {
[propName: string]: any;
} | undefined;
attachDataToQuery?: boolean | undefined;
dataType?: "form" | "json" | "form-data" | undefined;
responseType?: "blob" | undefined;
headers?: {
[propName: string]: string | number;
} | undefined;
sendOn?: string | undefined;
replaceData?: boolean | undefined;
concatDataFields?: string | string[] | undefined;
autoRefresh?: boolean | undefined;
trackExpression?: string | undefined;
cache?: number | undefined;
forceAppendDataToQuery?: boolean | undefined;
qsOptions?: {
arrayFormat?: "repeat" | "indices" | "brackets" | "comma" | undefined;
indices?: boolean | undefined;
allowDots?: boolean | undefined;
} | undefined;
silent?: boolean | undefined;
messages?: {
success?: string | undefined;
failed?: string | undefined;
} | undefined;
action?: FeatType | undefined;
origin?: "sdk" | "saas" | undefined;
strategy?: "restful" | "jsonql" | undefined;
scene?: "list" | "suggestion" | "autoFill" | "options" | undefined;
entity?: {
value: string;
label: string;
dsId: string;
dsKey: string;
dsLabel: string;
mId: string;
mKey: string;
mLabel: string;
} | undefined;
select?: import("../type").SelectField[] | undefined;
filters?: import("amis").ConditionValue | undefined;
orders?: {
field: string;
order: boolean;
}[] | undefined;
};
onEvent: {
submitSucc: {
actions: {
actionType: string;
groupType: string;
componentId: string;
}[];
};
};
body: any;
feat: any;
type: any;
mode: any;
id: any;
dsType: any;
};
actions: ({
id: string;
type: string;
actionType: string;
label: string;
level?: undefined;
} | {
id: string;
type: string;
actionType: string;
label: string;
level: string;
})[];
}>;
/**
* 构建编辑表单
*/
buildBulkEditForm(options: CRUDBuilderOptions, componentId: string): Promise<{
size: string;
id: string;
title: string;
body: {
api: {
config?: {
withCredentials?: boolean | undefined;
cancelExecutor?: ((cancel: Function) => void) | undefined;
} | undefined;
originUrl?: string | undefined;
jsonql?: any;
graphql?: string | undefined;
operationName?: string | undefined;
body?: import("amis").PlainObject | undefined;
query?: import("amis").PlainObject | undefined;
mockResponse?: {
status: number;
data?: any;
delay?: number | undefined;
} | undefined;
adaptor?: import("amis").ResponseAdaptor | undefined;
requestAdaptor?: import("amis").RequestAdaptor | undefined;
context?: any;
filterEmptyQuery?: boolean | undefined;
downloadFileName?: string | undefined; /**
* "action": 功能 -- 用于标识API的功能场景
* "behavior": 功能 -- 用于标识普通组件的功能场景
* "feat": 功能 -- 用于标识Form组件的功能场景
*/
method?: string | undefined;
url: string;
data?: {
[propName: string]: any;
} | undefined;
convertKeyToPath?: boolean | undefined;
responseData?: {
[propName: string]: any;
} | undefined;
attachDataToQuery?: boolean | undefined;
dataType?: "form" | "json" | "form-data" | undefined;
responseType?: "blob" | undefined;
headers?: {
[propName: string]: string | number;
} | undefined;
sendOn?: string | undefined;
replaceData?: boolean | undefined;
concatDataFields?: string | string[] | undefined;
autoRefresh?: boolean | undefined;
trackExpression?: string | undefined;
cache?: number | undefined;
forceAppendDataToQuery?: boolean | undefined;
qsOptions?: {
arrayFormat?: "repeat" | "indices" | "brackets" | "comma" | undefined;
indices?: boolean | undefined;
allowDots?: boolean | undefined;
} | undefined;
silent?: boolean | undefined;
messages?: {
success?: string | undefined;
failed?: string | undefined;
} | undefined;
action?: FeatType | undefined;
origin?: "sdk" | "saas" | undefined;
sourceType?: "model-entity" | "api" | "apicenter" | undefined;
strategy?: "restful" | "jsonql" | undefined;
scene?: "list" | "suggestion" | "autoFill" | "options" | undefined;
entity?: {
value: string;
label: string;
dsId: string;
dsKey: string;
dsLabel: string;
mId: string;
mKey: string;
mLabel: string;
} | undefined;
select?: import("../type").SelectField[] | undefined;
limit?: "piece" | "multiple" | undefined;
filters?: import("amis").ConditionValue | undefined;
orders?: {
field: string;
order: boolean;
}[] | undefined;
runtimeQuery?: Record<string, string> | undefined;
};
onEvent: {
submitSucc: {
actions: {
actionType: string;
groupType: string;
componentId: string;
}[];
};
};
body: any;
feat: any;
type: any;
mode: any;
id: any;
dsType: any;
};
actions: ({
id: string;
type: string;
actionType: string;
label: