CollectionFieldInterface

用于创建数据字段。

1class CollectionFieldInterface {
2  app: Application;
3  collectionManager: CollectionManager;
4
5  name: string;
6  group: string;
7  title?: string;
8  description?: string;
9  order?: number;
10  default?: {
11    type: string;
12    uiSchema?: ISchema;
13    [key: string]: any;
14  };
15  sortable?: boolean;
16  availableTypes?: string[];
17  hasDefaultValue?: boolean;
18  isAssociation?: boolean;
19  operators?: any[];
20  filterable?: {
21    operators?: any[];
22    children?: any[];
23    [key: string]: any;
24  };
25  titleUsable?: boolean;
26
27  validateSchema(fieldSchema: ISchema): Record<string, ISchema>
28  usePathOptions(field: CollectionFieldOptions): any
29  schemaInitialize(schema: ISchema, data: any): void
30}

其需要结合 CollectionFieldInterfaceManager 使用。

1class EmailFieldInterface extends CollectionFieldInterface {
2  name = 'email';
3  type = 'object';
4  group = 'basic';
5  order = 4;
6  title = '{{t("Email")}}';
7  sortable = true;
8  // ...
9}
10
11class MyPlugin extends Plugin {
12  load() {
13    this.app.dataSourceManager.addFieldInterfaces([ EmailFieldInterface ]);
14  }
15}

实例属性

name

唯一标识符。

group

分组。

title

标题。

default

配置表单默认值字段 schema。