diff --git a/packages/amis-editor/src/plugin/Form/InputFile.tsx b/packages/amis-editor/src/plugin/Form/InputFile.tsx index 7b3de9673..52281a3de 100644 --- a/packages/amis-editor/src/plugin/Form/InputFile.tsx +++ b/packages/amis-editor/src/plugin/Form/InputFile.tsx @@ -346,7 +346,6 @@ export class FileControlPlugin extends BasePlugin { getSchemaTpl('labelRemark'), getSchemaTpl('description'), getSchemaTpl('autoFillApi') - // getSchemaTpl('autoFill') ] }, getSchemaTpl('status', {isFormItem: true}), diff --git a/packages/amis-editor/src/plugin/Form/InputImage.tsx b/packages/amis-editor/src/plugin/Form/InputImage.tsx index ec4e014cd..7c64d81b3 100644 --- a/packages/amis-editor/src/plugin/Form/InputImage.tsx +++ b/packages/amis-editor/src/plugin/Form/InputImage.tsx @@ -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' + }) ] } }, diff --git a/packages/amis-editor/src/plugin/Form/InputNumber.tsx b/packages/amis-editor/src/plugin/Form/InputNumber.tsx index f3e94b593..4025fe241 100644 --- a/packages/amis-editor/src/plugin/Form/InputNumber.tsx +++ b/packages/amis-editor/src/plugin/Form/InputNumber.tsx @@ -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}), diff --git a/packages/amis-editor/src/plugin/Form/InputTag.tsx b/packages/amis-editor/src/plugin/Form/InputTag.tsx index 3ef32dfe9..1c6cb52d2 100644 --- a/packages/amis-editor/src/plugin/Form/InputTag.tsx +++ b/packages/amis-editor/src/plugin/Form/InputTag.tsx @@ -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: {} diff --git a/packages/amis-editor/src/plugin/Form/InputText.tsx b/packages/amis-editor/src/plugin/Form/InputText.tsx index 1f545e6b1..a729aeecd 100644 --- a/packages/amis-editor/src/plugin/Form/InputText.tsx +++ b/packages/amis-editor/src/plugin/Form/InputText.tsx @@ -299,7 +299,8 @@ export class TextControlPlugin extends BasePlugin { getSchemaTpl('labelRemark'), getSchemaTpl('remark'), getSchemaTpl('placeholder'), - getSchemaTpl('description') + getSchemaTpl('description'), + getSchemaTpl('autoFillApi') ] }, getSchemaTpl('status', { diff --git a/packages/amis-editor/src/plugin/Form/InputTree.tsx b/packages/amis-editor/src/plugin/Form/InputTree.tsx index e08f32379..d187a4d25 100644 --- a/packages/amis-editor/src/plugin/Form/InputTree.tsx +++ b/packages/amis-editor/src/plugin/Form/InputTree.tsx @@ -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' + }) ] }) ] diff --git a/packages/amis-editor/src/plugin/Form/Item.tsx b/packages/amis-editor/src/plugin/Form/Item.tsx index 76b74da2a..74ad8cdc2 100644 --- a/packages/amis-editor/src/plugin/Form/Item.tsx +++ b/packages/amis-editor/src/plugin/Form/Item.tsx @@ -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 ] }, diff --git a/packages/amis-editor/src/plugin/Form/Picker.tsx b/packages/amis-editor/src/plugin/Form/Picker.tsx index cdebc3f78..bc20bd9c9 100644 --- a/packages/amis-editor/src/plugin/Form/Picker.tsx +++ b/packages/amis-editor/src/plugin/Form/Picker.tsx @@ -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' + }) ] }) ]; diff --git a/packages/amis-editor/src/plugin/Form/TabsTransfer.tsx b/packages/amis-editor/src/plugin/Form/TabsTransfer.tsx index 6775581b1..12bc9c7c5 100644 --- a/packages/amis-editor/src/plugin/Form/TabsTransfer.tsx +++ b/packages/amis-editor/src/plugin/Form/TabsTransfer.tsx @@ -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' + }) ] }) ]) diff --git a/packages/amis-editor/src/plugin/Form/Transfer.tsx b/packages/amis-editor/src/plugin/Form/Transfer.tsx index 2ba281be4..be62d6bac 100644 --- a/packages/amis-editor/src/plugin/Form/Transfer.tsx +++ b/packages/amis-editor/src/plugin/Form/Transfer.tsx @@ -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' + }) ] }) ]) diff --git a/packages/amis-editor/src/plugin/Form/TreeSelect.tsx b/packages/amis-editor/src/plugin/Form/TreeSelect.tsx index 3703db0e2..6f511c71e 100644 --- a/packages/amis-editor/src/plugin/Form/TreeSelect.tsx +++ b/packages/amis-editor/src/plugin/Form/TreeSelect.tsx @@ -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', { diff --git a/packages/amis-editor/src/tpl/common.tsx b/packages/amis-editor/src/tpl/common.tsx index 8eda44524..0f305cc53 100644 --- a/packages/amis-editor/src/tpl/common.tsx +++ b/packages/amis-editor/src/tpl/common.tsx @@ -629,6 +629,12 @@ setSchemaTpl('autoFill', { ) }); +setSchemaTpl('autoFillApi', { + type: 'input-kv', + name: 'autoFill', + label: tipedLabel('数据录入', '自动填充或参照录入') +}); + setSchemaTpl('required', { type: 'switch', name: 'required',