feat: 简单筛选的字段过滤条件设置 & 部分问题修复

Change-Id: Iae1e078295932ea4e8a89208daf90cf8f8e8f1e3
This commit is contained in:
yangwei9012 2022-07-08 16:05:25 +08:00
parent 3a039d1427
commit e50e098fd3
2 changed files with 9 additions and 8 deletions

View File

@ -1,6 +1,6 @@
{
"name": "amis-editor",
"version": "5.2.0-beta.16",
"version": "5.2.0-beta.18",
"description": "amis 可视化编辑器",
"main": "lib/index.js",
"module": "esm/index.js",

View File

@ -441,14 +441,14 @@ export class CRUDPlugin extends BasePlugin {
this.dsBuilderMgr = new DSBuilderManager('crud2', 'api');
}
afterBuildPanelBody(event: PluginEvent<AfterBuildPanelBody>) {
async afterBuildPanelBody(event: PluginEvent<AfterBuildPanelBody>) {
const {context} = event.context;
if (
context.info.renderer?.isFormItem &&
new RegExp('/crud2/filter/d/form/').test(context.path)
new RegExp('/crud2/filter/').test(context.path)
) {
this.addFilterPanelSetting(event.context);
await this.addFilterPanelSetting(event.context);
} else if (
context.schema.type === 'crud2' &&
context.schema.mode === this.scaffold.mode
@ -457,7 +457,7 @@ export class CRUDPlugin extends BasePlugin {
}
}
addFilterPanelSetting(context: AfterBuildPanelBody) {
async addFilterPanelSetting(context: AfterBuildPanelBody) {
const {info, node} = context.context;
if (info.renderer?.isFormItem) {
const form = node.getClosestParentByType('form');
@ -476,12 +476,13 @@ export class CRUDPlugin extends BasePlugin {
host.schema,
'api'
);
const body = builder.makeFieldFilterSetting({
const body = await builder.makeFieldFilterSetting({
schema: host.schema,
sourceKey: 'api'
sourceKey: 'api',
fieldName: node.schema.name
});
if (!body) {
if (!body || !body.length) {
return;
}