fix:兼容autoFill 自动填充与数据录入场景

Change-Id: Ibc5e8f494b97589187416d33cb8bc2c38a6a4bf3
This commit is contained in:
qianchuan 2022-07-07 14:55:51 +08:00
parent a0bd198573
commit f264e2c34f
12 changed files with 60 additions and 30 deletions

View File

@ -346,7 +346,6 @@ export class FileControlPlugin extends BasePlugin {
getSchemaTpl('labelRemark'),
getSchemaTpl('description'),
getSchemaTpl('autoFillApi')
// getSchemaTpl('autoFill')
]
},
getSchemaTpl('status', {isFormItem: true}),

View File

@ -114,8 +114,6 @@ export class ImageControlPlugin extends BasePlugin {
__isUpload: true
}),
getSchemaTpl('autoFill'),
{
type: 'input-text',
value: '.jpeg, .jpg, .png, .gif',
@ -282,7 +280,13 @@ export class ImageControlPlugin extends BasePlugin {
'当宽高比没有满足条件时,此描述将作为提示信息显示'
}
]
}
},
getSchemaTpl('autoFillApi', {
visibleOn: '!this.autoFill || this.autoFill.api'
}),
getSchemaTpl('autoFill', {
visibleOn: '!this.autoFill || !this.autoFill.api'
})
]
}
},

View File

@ -248,7 +248,8 @@ export class NumberControlPlugin extends BasePlugin {
getSchemaTpl('labelRemark'),
getSchemaTpl('remark'),
getSchemaTpl('placeholder'),
getSchemaTpl('description')
getSchemaTpl('description'),
getSchemaTpl('autoFillApi')
]
},
getSchemaTpl('status', {isFormItem: true}),

View File

@ -141,15 +141,20 @@ export class TagControlPlugin extends BasePlugin {
}),
getSchemaTpl('joinValues'),
getSchemaTpl('delimiter'),
getSchemaTpl('extractValue')
getSchemaTpl('extractValue'),
getSchemaTpl('autoFillApi', {
visibleOn: '!this.autoFill || this.autoFill.api'
}),
getSchemaTpl('autoFill', {
visibleOn: '!this.autoFill || !this.autoFill.api'
})
]
},
option: {
body: [
getSchemaTpl('optionControlV2', {
description: '设置选项后,输入时会下拉这些选项供用户参考。'
}),
getSchemaTpl('autoFill')
})
]
},
status: {}

View File

@ -299,7 +299,8 @@ export class TextControlPlugin extends BasePlugin {
getSchemaTpl('labelRemark'),
getSchemaTpl('remark'),
getSchemaTpl('placeholder'),
getSchemaTpl('description')
getSchemaTpl('description'),
getSchemaTpl('autoFillApi')
]
},
getSchemaTpl('status', {

View File

@ -344,7 +344,12 @@ export class TreeControlPlugin extends BasePlugin {
getSchemaTpl('joinValues'),
getSchemaTpl('delimiter'),
getSchemaTpl('extractValue'),
getSchemaTpl('autoFill')
getSchemaTpl('autoFillApi', {
visibleOn: '!this.autoFill || this.autoFill.api'
}),
getSchemaTpl('autoFill', {
visibleOn: '!this.autoFill || !this.autoFill.api'
})
]
})
]

View File

@ -48,7 +48,7 @@ export class ItemPlugin extends BasePlugin {
render: this.manager.makeSchemaFormRender({
body: this.panelBodyCreator(context),
panelById: store.activeId,
formKey: 'form-item',
formKey: 'form-item'
}),
order: -200
});
@ -84,7 +84,6 @@ export class ItemPlugin extends BasePlugin {
].indexOf(context.schema.type);
/** 不支持配置校验属性的组件 */
const ignoreValidator = !!~['input-group'].indexOf(context.schema.type);
const autoFillApi = context.schema.autoFillApi;
const renderer: any = context.info.renderer;
return [
getSchemaTpl('tabs', [
@ -119,8 +118,7 @@ export class ItemPlugin extends BasePlugin {
? getSchemaTpl('labelRemark', {
mode: 'row'
})
: null,
getSchemaTpl('autoFillApi')
: null
]
},

View File

@ -125,7 +125,12 @@ export class PickerControlPlugin extends BasePlugin {
getSchemaTpl('joinValues'),
getSchemaTpl('delimiter'),
getSchemaTpl('extractValue'),
getSchemaTpl('autoFill')
getSchemaTpl('autoFillApi', {
visibleOn: '!this.autoFill || this.autoFill.api'
}),
getSchemaTpl('autoFill', {
visibleOn: '!this.autoFill || !this.autoFill.api'
})
]
})
];

View File

@ -3,10 +3,7 @@ import {getSchemaTpl} from 'amis-editor-core';
import {registerEditorPlugin} from 'amis-editor-core';
import {BasePlugin, BaseEventContext} from 'amis-editor-core';
import {
RendererPluginAction,
RendererPluginEvent
} from 'amis-editor-core';
import {RendererPluginAction, RendererPluginEvent} from 'amis-editor-core';
import {getEventControlConfig} from '../../util';
export class TabsTransferPlugin extends BasePlugin {
@ -338,7 +335,12 @@ export class TabsTransferPlugin extends BasePlugin {
getSchemaTpl('joinValues'),
getSchemaTpl('delimiter'),
getSchemaTpl('extractValue'),
getSchemaTpl('autoFill')
getSchemaTpl('autoFillApi', {
visibleOn: '!this.autoFill || this.autoFill.api'
}),
getSchemaTpl('autoFill', {
visibleOn: '!this.autoFill || !this.autoFill.api'
})
]
})
])

View File

@ -2,10 +2,7 @@ import {getSchemaTpl} from 'amis-editor-core';
import {registerEditorPlugin} from 'amis-editor-core';
import {BasePlugin, BaseEventContext} from 'amis-editor-core';
import {getEventControlConfig} from '../../util';
import {
RendererPluginAction,
RendererPluginEvent
} from 'amis-editor-core';
import {RendererPluginAction, RendererPluginEvent} from 'amis-editor-core';
export class TransferPlugin extends BasePlugin {
// 关联渲染器名字
@ -412,7 +409,12 @@ export class TransferPlugin extends BasePlugin {
getSchemaTpl('joinValues'),
getSchemaTpl('delimiter'),
getSchemaTpl('extractValue'),
getSchemaTpl('autoFill')
getSchemaTpl('autoFillApi', {
visibleOn: '!this.autoFill || this.autoFill.api'
}),
getSchemaTpl('autoFill', {
visibleOn: '!this.autoFill || !this.autoFill.api'
})
]
})
])

View File

@ -1,7 +1,4 @@
import {
RendererPluginAction,
RendererPluginEvent
} from 'amis-editor-core';
import {RendererPluginAction, RendererPluginEvent} from 'amis-editor-core';
import {defaultValue, getSchemaTpl} from 'amis-editor-core';
import {registerEditorPlugin} from 'amis-editor-core';
import {BaseEventContext, BasePlugin} from 'amis-editor-core';
@ -363,7 +360,12 @@ export class TreeSelectControlPlugin extends BasePlugin {
getSchemaTpl('joinValues'),
getSchemaTpl('delimiter'),
getSchemaTpl('extractValue'),
getSchemaTpl('autoFill'),
getSchemaTpl('autoFillApi', {
visibleOn: '!this.autoFill || this.autoFill.api'
}),
getSchemaTpl('autoFill', {
visibleOn: '!this.autoFill || !this.autoFill.api'
}),
getSchemaTpl('creatable'),
getSchemaTpl('api', {

View File

@ -629,6 +629,12 @@ setSchemaTpl('autoFill', {
)
});
setSchemaTpl('autoFillApi', {
type: 'input-kv',
name: 'autoFill',
label: tipedLabel('数据录入', '自动填充或参照录入')
});
setSchemaTpl('required', {
type: 'switch',
name: 'required',