用于创建数据字段。
class CollectionFieldInterface {
app: Application;
collectionManager: CollectionManager;
name: string;
group: string;
title?: string;
description?: string;
order?: number;
default?: {
type: string;
uiSchema?: ISchema;
[key: string]: any;
};
sortable?: boolean;
availableTypes?: string[];
hasDefaultValue?: boolean;
isAssociation?: boolean;
operators?: any[];
filterable?: {
operators?: any[];
children?: any[];
[key: string]: any;
};
titleUsable?: boolean;
validateSchema(fieldSchema: ISchema): Record<string, ISchema>
usePathOptions(field: CollectionFieldOptions): any
schemaInitialize(schema: ISchema, data: any): void
}
其需要结合 CollectionFieldInterfaceManager 使用。
class EmailFieldInterface extends CollectionFieldInterface {
name = 'email';
type = 'object';
group = 'basic';
order = 4;
title = '{{t("Email")}}';
sortable = true;
// ...
}
class MyPlugin extends Plugin {
load() {
this.app.dataSourceManager.addFieldInterfaces([ EmailFieldInterface ]);
}
}
唯一标识符。
分组。
标题。
配置表单默认值字段 schema。