diff --git a/packages/amis-editor/package.json b/packages/amis-editor/package.json index 4da2b1554..ac3d89e13 100644 --- a/packages/amis-editor/package.json +++ b/packages/amis-editor/package.json @@ -24,7 +24,6 @@ ] }, "dependencies": { - "amis-editor-comp": "*", "amis-editor-core": "*", "lodash": "^4.17.15", "@webcomponents/webcomponentsjs": "^2.6.0" diff --git a/packages/amis-editor/src/event-action/actions.ts b/packages/amis-editor/src/event-action/actions.ts index 6792b6368..1a4c20db9 100644 --- a/packages/amis-editor/src/event-action/actions.ts +++ b/packages/amis-editor/src/event-action/actions.ts @@ -1,10 +1,7 @@ -import type { - ActionTypeNode, - RendererAction -} from 'amis-editor-comp/dist/renderers/event-action'; +import type {RendererPluginAction} from 'amis-editor-core'; // 表单类动作 -const formActions: RendererAction[] = [ +const formActions: RendererPluginAction[] = [ { actionLabel: '提交', actionType: 'submit', @@ -28,7 +25,7 @@ const formActions: RendererAction[] = [ ]; // 页面类动作 -const pageActions: RendererAction[] = [ +const pageActions: RendererPluginAction[] = [ { actionLabel: '打开页面', actionType: 'openPage', @@ -47,7 +44,7 @@ const pageActions: RendererAction[] = [ ]; // 弹框类动作 -const dialogActions: RendererAction[] = [ +const dialogActions: RendererPluginAction[] = [ { actionLabel: '打开弹窗', actionType: 'dialog', @@ -87,7 +84,7 @@ const dialogActions: RendererAction[] = [ ]; // 服务类动作 -const serviceActions: RendererAction[] = [ +const serviceActions: RendererPluginAction[] = [ { actionLabel: '发送请求', actionType: 'ajax', @@ -100,7 +97,7 @@ const serviceActions: RendererAction[] = [ } ]; -const ACTION_TYPE_TREE: ActionTypeNode[] = [ +const ACTION_TYPE_TREE: RendererPluginAction[] = [ { actionLabel: '页面', actionType: 'page', diff --git a/packages/amis-editor/src/event-action/schema.tsx b/packages/amis-editor/src/event-action/schema.tsx index da062e2ef..e6ede6cf6 100644 --- a/packages/amis-editor/src/event-action/schema.tsx +++ b/packages/amis-editor/src/event-action/schema.tsx @@ -1,7 +1,6 @@ import React from 'react'; import {Button} from 'amis'; -import {defaultValue, getSchemaTpl} from 'amis-editor-core'; -import type {ActionConfigItemsMap} from 'amis-editor-comp/dist/renderers/event-action'; +import {defaultValue, getSchemaTpl, RendererPluginAction} from 'amis-editor-core'; export const getComboWrapper = (items: any, multiple: boolean = false) => ({ type: 'combo', @@ -16,7 +15,7 @@ export const getComboWrapper = (items: any, multiple: boolean = false) => ({ * 获取动作配置项map * @param manager */ -export function getActionConfigItemsMap(manager: any): ActionConfigItemsMap { +export function getActionConfigItemsMap(manager: any): {[propName: string]: RendererPluginAction} { return { ajax: { config: ['api'], diff --git a/packages/amis-editor/src/index.tsx b/packages/amis-editor/src/index.tsx index cc9a1d6f1..23dfafb94 100644 --- a/packages/amis-editor/src/index.tsx +++ b/packages/amis-editor/src/index.tsx @@ -153,6 +153,7 @@ import './renderer/RangePartsControl'; import './renderer/DataBindingControl'; import './renderer/DataMappingControl'; import './renderer/DataPickerControl'; +import './renderer/event-control/index'; export * from './component/BaseControl'; diff --git a/packages/amis-editor/src/plugin/Button.tsx b/packages/amis-editor/src/plugin/Button.tsx index b200c626e..292e999fd 100644 --- a/packages/amis-editor/src/plugin/Button.tsx +++ b/packages/amis-editor/src/plugin/Button.tsx @@ -9,10 +9,7 @@ import { import {defaultValue, getSchemaTpl} from 'amis-editor-core'; import {BUTTON_DEFAULT_ACTION, tipedLabel} from '../component/BaseControl'; import {getEventControlConfig} from '../util'; -import { - RendererAction, - RendererEvent -} from 'amis-editor-comp/dist/renderers/event-action'; +import {RendererPluginAction, RendererPluginEvent} from 'amis-editor-core'; import {SchemaObject} from 'amis/lib/Schema'; export class ButtonPlugin extends BasePlugin { @@ -41,7 +38,7 @@ export class ButtonPlugin extends BasePlugin { panelTitle = '按钮'; // 事件定义 - events: RendererEvent[] = [ + events: RendererPluginEvent[] = [ { eventName: 'click', eventLabel: '点击', @@ -66,7 +63,7 @@ export class ButtonPlugin extends BasePlugin { ]; // 动作定义 - actions: RendererAction[] = []; + actions: RendererPluginAction[] = []; panelJustify = true; diff --git a/packages/amis-editor/src/plugin/Chart.tsx b/packages/amis-editor/src/plugin/Chart.tsx index 0e7ab8d64..c8d772a41 100644 --- a/packages/amis-editor/src/plugin/Chart.tsx +++ b/packages/amis-editor/src/plugin/Chart.tsx @@ -7,10 +7,10 @@ import { RegionConfig, RendererInfo } from 'amis-editor-core'; -import {defaultValue, getSchemaTpl} from 'amis-editor-core'; +import {defaultValue, getSchemaTpl, } from 'amis-editor-core'; import {diff} from 'amis-editor-core'; import AMisCodeEditor from 'amis-editor-core'; -import {RendererAction} from 'amis-editor-comp/dist/renderers/event-action'; +import {RendererPluginAction} from 'amis-editor-core'; const ChartConfigEditor = ({value, onChange}: any) => { return ( @@ -57,7 +57,7 @@ export class ChartPlugin extends BasePlugin { }; // 动作定义 - actions: RendererAction[] = [ + actions: RendererPluginAction[] = [ { actionType: 'reload', actionLabel: '重新加载', diff --git a/packages/amis-editor/src/plugin/Form/ButtonGroupSelect.tsx b/packages/amis-editor/src/plugin/Form/ButtonGroupSelect.tsx index 56257175c..e9af18ae3 100644 --- a/packages/amis-editor/src/plugin/Form/ButtonGroupSelect.tsx +++ b/packages/amis-editor/src/plugin/Form/ButtonGroupSelect.tsx @@ -2,9 +2,9 @@ import {registerEditorPlugin} from 'amis-editor-core'; import {BasePlugin, BaseEventContext} from 'amis-editor-core'; import { - RendererAction, - RendererEvent -} from 'amis-editor-comp/dist/renderers/event-action'; + RendererPluginAction, + RendererPluginEvent +} from 'amis-editor-core'; import {getSchemaTpl} from 'amis-editor-core'; import {formItemControl} from '../../component/BaseControl'; @@ -52,7 +52,7 @@ export class ButtonGroupControlPlugin extends BasePlugin { panelTitle = '按钮点选'; // 事件定义 - events: RendererEvent[] = [ + events: RendererPluginEvent[] = [ { eventName: 'change', eventLabel: '值变化', @@ -72,7 +72,7 @@ export class ButtonGroupControlPlugin extends BasePlugin { ]; // 动作定义 - actions: RendererAction[] = [ + actions: RendererPluginAction[] = [ { actionType: 'clear', actionLabel: '清空', diff --git a/packages/amis-editor/src/plugin/Form/ChainedSelect.tsx b/packages/amis-editor/src/plugin/Form/ChainedSelect.tsx index 932300fe6..8731401e0 100644 --- a/packages/amis-editor/src/plugin/Form/ChainedSelect.tsx +++ b/packages/amis-editor/src/plugin/Form/ChainedSelect.tsx @@ -11,9 +11,9 @@ import {ValidatorTag} from '../../validator'; import {tipedLabel} from '../../component/BaseControl'; import {getEventControlConfig} from '../../util'; import { - RendererAction, - RendererEvent -} from 'amis-editor-comp/dist/renderers/event-action'; + RendererPluginAction, + RendererPluginEvent +} from 'amis-editor-core'; export class ChainedSelectControlPlugin extends BasePlugin { // 关联渲染器名字 @@ -45,7 +45,7 @@ export class ChainedSelectControlPlugin extends BasePlugin { }; // 事件定义 - events: RendererEvent[] = [ + events: RendererPluginEvent[] = [ { eventName: 'change', eventLabel: '值变化', @@ -65,7 +65,7 @@ export class ChainedSelectControlPlugin extends BasePlugin { ]; // 动作定义 - actions: RendererAction[] = [ + actions: RendererPluginAction[] = [ { actionType: 'clear', actionLabel: '清空', diff --git a/packages/amis-editor/src/plugin/Form/Checkbox.tsx b/packages/amis-editor/src/plugin/Form/Checkbox.tsx index 5dda4310f..95036e8af 100644 --- a/packages/amis-editor/src/plugin/Form/Checkbox.tsx +++ b/packages/amis-editor/src/plugin/Form/Checkbox.tsx @@ -15,9 +15,9 @@ import { import {ValidatorTag} from '../../validator'; import {tipedLabel} from '../../component/BaseControl'; import { - RendererAction, - RendererEvent -} from 'amis-editor-comp/dist/renderers/event-action'; + RendererPluginAction, + RendererPluginEvent +} from 'amis-editor-core'; import {getEventControlConfig} from '../../util'; setSchemaTpl('option', { @@ -59,7 +59,7 @@ export class CheckboxControlPlugin extends BasePlugin { panelTitle = '勾选框'; panelJustify = true; // 事件定义 - events: RendererEvent[] = [ + events: RendererPluginEvent[] = [ { eventName: 'change', eventLabel: '值变化', @@ -78,7 +78,7 @@ export class CheckboxControlPlugin extends BasePlugin { } ]; // 动作定义 - actions: RendererAction[] = [ + actions: RendererPluginAction[] = [ { actionType: 'clear', actionLabel: '清空', diff --git a/packages/amis-editor/src/plugin/Form/Checkboxes.tsx b/packages/amis-editor/src/plugin/Form/Checkboxes.tsx index 8bba6b537..9bc18d2a9 100644 --- a/packages/amis-editor/src/plugin/Form/Checkboxes.tsx +++ b/packages/amis-editor/src/plugin/Form/Checkboxes.tsx @@ -15,9 +15,9 @@ import { import {ValidatorTag} from '../../validator'; import { - RendererAction, - RendererEvent -} from 'amis-editor-comp/dist/renderers/event-action'; + RendererPluginAction, + RendererPluginEvent +} from 'amis-editor-core'; import {getEventControlConfig} from '../../util'; export class CheckboxesControlPlugin extends BasePlugin { @@ -70,7 +70,7 @@ export class CheckboxesControlPlugin extends BasePlugin { panelTitle = '复选框'; // 事件定义 - events: RendererEvent[] = [ + events: RendererPluginEvent[] = [ { eventName: 'change', eventLabel: '值变化', @@ -90,7 +90,7 @@ export class CheckboxesControlPlugin extends BasePlugin { ]; // 动作定义 - actions: RendererAction[] = [ + actions: RendererPluginAction[] = [ { actionType: 'clear', actionLabel: '清空', diff --git a/packages/amis-editor/src/plugin/Form/CodeEditor.tsx b/packages/amis-editor/src/plugin/Form/CodeEditor.tsx index 8bc4bd94b..b5e427491 100644 --- a/packages/amis-editor/src/plugin/Form/CodeEditor.tsx +++ b/packages/amis-editor/src/plugin/Form/CodeEditor.tsx @@ -6,9 +6,9 @@ import {BasePlugin} from 'amis-editor-core'; import type {BaseEventContext} from 'amis-editor-core'; import {ValidatorTag} from '../../validator'; import { - RendererEvent, - RendererAction -} from 'amis-editor-comp/dist/renderers/event-action'; + RendererPluginEvent, + RendererPluginAction +} from 'amis-editor-core'; import {getEventControlConfig} from '../../util'; export class CodeEditorControlPlugin extends BasePlugin { @@ -43,7 +43,7 @@ export class CodeEditorControlPlugin extends BasePlugin { ] }; - events: RendererEvent[] = [ + events: RendererPluginEvent[] = [ { eventName: 'focus', eventLabel: '获取焦点', @@ -78,7 +78,7 @@ export class CodeEditorControlPlugin extends BasePlugin { } ]; - actions: RendererAction[] = [ + actions: RendererPluginAction[] = [ { actionType: 'clear', actionLabel: '清空', diff --git a/packages/amis-editor/src/plugin/Form/Combo.tsx b/packages/amis-editor/src/plugin/Form/Combo.tsx index f7e98ca79..795fede2d 100644 --- a/packages/amis-editor/src/plugin/Form/Combo.tsx +++ b/packages/amis-editor/src/plugin/Form/Combo.tsx @@ -16,9 +16,9 @@ import {diff, JSONPipeIn} from 'amis-editor-core'; import {JSONPipeOut} from 'amis-editor-core'; import {mockValue} from 'amis-editor-core'; import { - RendererEvent, - RendererAction -} from 'amis-editor-comp/dist/renderers/event-action'; + RendererPluginEvent, + RendererPluginAction +} from 'amis-editor-core'; import {setVariable} from 'amis-core'; export class ComboControlPlugin extends BasePlugin { @@ -76,7 +76,7 @@ export class ComboControlPlugin extends BasePlugin { }; // 事件定义 - events: RendererEvent[] = [ + events: RendererPluginEvent[] = [ { eventName: 'add', eventLabel: '添加', @@ -132,7 +132,7 @@ export class ComboControlPlugin extends BasePlugin { ]; // 动作定义 - actions: RendererAction[] = [ + actions: RendererPluginAction[] = [ { actionType: 'clear', actionLabel: '清空', diff --git a/packages/amis-editor/src/plugin/Form/DiffEditor.tsx b/packages/amis-editor/src/plugin/Form/DiffEditor.tsx index 1fbb71d00..3939e873c 100644 --- a/packages/amis-editor/src/plugin/Form/DiffEditor.tsx +++ b/packages/amis-editor/src/plugin/Form/DiffEditor.tsx @@ -12,9 +12,9 @@ import type {BaseEventContext} from 'amis-editor-core'; import {ValidatorTag} from '../../validator'; import {getEventControlConfig} from '../../util'; import { - RendererEvent, - RendererAction -} from 'amis-editor-comp/dist/renderers/event-action'; + RendererPluginEvent, + RendererPluginAction +} from 'amis-editor-core'; export class DiffEditorControlPlugin extends BasePlugin { // 关联渲染器名字 @@ -49,7 +49,7 @@ export class DiffEditorControlPlugin extends BasePlugin { ] }; - events: RendererEvent[] = [ + events: RendererPluginEvent[] = [ { eventName: 'focus', eventLabel: '获取焦点', @@ -84,7 +84,7 @@ export class DiffEditorControlPlugin extends BasePlugin { } ]; - actions: RendererAction[] = [ + actions: RendererPluginAction[] = [ { actionType: 'clear', actionLabel: '清空', diff --git a/packages/amis-editor/src/plugin/Form/Form.tsx b/packages/amis-editor/src/plugin/Form/Form.tsx index 94ded5b76..7bb0980e3 100644 --- a/packages/amis-editor/src/plugin/Form/Form.tsx +++ b/packages/amis-editor/src/plugin/Form/Form.tsx @@ -11,9 +11,9 @@ import {defaultValue, getSchemaTpl} from 'amis-editor-core'; import {jsonToJsonSchema} from 'amis-editor-core'; import {EditorNodeType} from 'amis-editor-core'; import { - RendererAction, - RendererEvent -} from 'amis-editor-comp/dist/renderers/event-action'; + RendererPluginAction, + RendererPluginEvent +} from 'amis-editor-core'; import {setVariable} from 'amis-core'; import {getEventControlConfig} from '../../util'; @@ -213,7 +213,7 @@ export class FormPlugin extends BasePlugin { panelTitle = '表单'; // 事件定义 - events: RendererEvent[] = [ + events: RendererPluginEvent[] = [ { eventName: 'inited', eventLabel: '初始化完成', @@ -346,7 +346,7 @@ export class FormPlugin extends BasePlugin { ]; // 动作定义 - actions: RendererAction[] = [ + actions: RendererPluginAction[] = [ { actionLabel: '提交表单', actionType: 'submit', diff --git a/packages/amis-editor/src/plugin/Form/InputCity.tsx b/packages/amis-editor/src/plugin/Form/InputCity.tsx index ed5928f35..88e8a6c28 100644 --- a/packages/amis-editor/src/plugin/Form/InputCity.tsx +++ b/packages/amis-editor/src/plugin/Form/InputCity.tsx @@ -10,9 +10,9 @@ import { import {formItemControl} from '../../component/BaseControl'; import { - RendererAction, - RendererEvent -} from 'amis-editor-comp/dist/renderers/event-action'; + RendererPluginAction, + RendererPluginEvent +} from 'amis-editor-core'; export class CityControlPlugin extends BasePlugin { // 关联渲染器名字 @@ -48,7 +48,7 @@ export class CityControlPlugin extends BasePlugin { panelTitle = '城市选择'; // 事件定义 - events: RendererEvent[] = [ + events: RendererPluginEvent[] = [ { eventName: 'change', eventLabel: '值变化', @@ -68,7 +68,7 @@ export class CityControlPlugin extends BasePlugin { ]; // 动作定义 - actions: RendererAction[] = [ + actions: RendererPluginAction[] = [ { actionType: 'clear', actionLabel: '清空', diff --git a/packages/amis-editor/src/plugin/Form/InputDate.tsx b/packages/amis-editor/src/plugin/Form/InputDate.tsx index 4f0a72d30..08e469fd3 100644 --- a/packages/amis-editor/src/plugin/Form/InputDate.tsx +++ b/packages/amis-editor/src/plugin/Form/InputDate.tsx @@ -6,9 +6,9 @@ import {tipedLabel} from '../../component/BaseControl'; import {ValidatorTag} from '../../validator'; import {getEventControlConfig} from '../../util'; import { - RendererAction, - RendererEvent -} from 'amis-editor-comp/dist/renderers/event-action'; + RendererPluginAction, + RendererPluginEvent +} from 'amis-editor-core'; const formatX = [ { @@ -180,7 +180,7 @@ export class DateControlPlugin extends BasePlugin { panelTitle = '日期配置'; - events: RendererEvent[] = [ + events: RendererPluginEvent[] = [ { eventName: 'change', eventLabel: '值变化', @@ -210,7 +210,7 @@ export class DateControlPlugin extends BasePlugin { ]; // 动作定义 - actions: RendererAction[] = [ + actions: RendererPluginAction[] = [ { actionType: 'clear', actionLabel: '清空', diff --git a/packages/amis-editor/src/plugin/Form/InputDateRange.tsx b/packages/amis-editor/src/plugin/Form/InputDateRange.tsx index e8b893507..4d10e088f 100644 --- a/packages/amis-editor/src/plugin/Form/InputDateRange.tsx +++ b/packages/amis-editor/src/plugin/Form/InputDateRange.tsx @@ -6,9 +6,9 @@ import {tipedLabel} from '../../component/BaseControl'; import {ValidatorTag} from '../../validator'; import {getEventControlConfig} from '../../util'; import { - RendererAction, - RendererEvent -} from 'amis-editor-comp/dist/renderers/event-action'; + RendererPluginAction, + RendererPluginEvent +} from 'amis-editor-core'; const DateType: { [key: string]: { @@ -105,7 +105,7 @@ export class DateRangeControlPlugin extends BasePlugin { panelTitle = '日期范围'; - events: RendererEvent[] = [ + events: RendererPluginEvent[] = [ { eventName: 'change', eventLabel: '值变化', @@ -157,7 +157,7 @@ export class DateRangeControlPlugin extends BasePlugin { ]; // 动作定义 - actions: RendererAction[] = [ + actions: RendererPluginAction[] = [ { actionType: 'clear', actionLabel: '清空', diff --git a/packages/amis-editor/src/plugin/Form/InputExcel.tsx b/packages/amis-editor/src/plugin/Form/InputExcel.tsx index f7c2965c0..ef5825e9c 100644 --- a/packages/amis-editor/src/plugin/Form/InputExcel.tsx +++ b/packages/amis-editor/src/plugin/Form/InputExcel.tsx @@ -12,9 +12,9 @@ import { } from 'amis-editor-core'; import {formItemControl} from '../../component/BaseControl'; import { - RendererAction, - RendererEvent -} from 'amis-editor-comp/dist/renderers/event-action'; + RendererPluginAction, + RendererPluginEvent +} from 'amis-editor-core'; export class ExcelControlPlugin extends BasePlugin { // 关联渲染器名字 @@ -49,7 +49,7 @@ export class ExcelControlPlugin extends BasePlugin { notRenderFormZone = true; // 事件定义 - events: RendererEvent[] = [ + events: RendererPluginEvent[] = [ { eventName: 'change', eventLabel: '值变化', @@ -69,7 +69,7 @@ export class ExcelControlPlugin extends BasePlugin { ]; // 动作定义 - actions: RendererAction[] = [ + actions: RendererPluginAction[] = [ { actionType: 'clear', actionLabel: '清空', diff --git a/packages/amis-editor/src/plugin/Form/InputFile.tsx b/packages/amis-editor/src/plugin/Form/InputFile.tsx index 58390c0af..defb30b6f 100644 --- a/packages/amis-editor/src/plugin/Form/InputFile.tsx +++ b/packages/amis-editor/src/plugin/Form/InputFile.tsx @@ -5,9 +5,9 @@ import {tipedLabel} from '../../component/BaseControl'; import {ValidatorTag} from '../../validator'; import {getEventControlConfig} from '../../util'; import { - RendererAction, - RendererEvent -} from 'amis-editor-comp/dist/renderers/event-action'; + RendererPluginAction, + RendererPluginEvent +} from 'amis-editor-core'; export class FileControlPlugin extends BasePlugin { // 关联渲染器名字 @@ -41,7 +41,7 @@ export class FileControlPlugin extends BasePlugin { notRenderFormZone = true; // 事件定义 - events: RendererEvent[] = [ + events: RendererPluginEvent[] = [ { eventName: 'change', eventLabel: '值变化', @@ -113,7 +113,7 @@ export class FileControlPlugin extends BasePlugin { ]; // 动作定义 - actions: RendererAction[] = [ + actions: RendererPluginAction[] = [ { actionType: 'clear', actionLabel: '清空数据', diff --git a/packages/amis-editor/src/plugin/Form/InputImage.tsx b/packages/amis-editor/src/plugin/Form/InputImage.tsx index ceb8eaec7..f98a5872c 100644 --- a/packages/amis-editor/src/plugin/Form/InputImage.tsx +++ b/packages/amis-editor/src/plugin/Form/InputImage.tsx @@ -3,9 +3,9 @@ import {registerEditorPlugin} from 'amis-editor-core'; import {BasePlugin, BaseEventContext} from 'amis-editor-core'; import {formItemControl} from '../../component/BaseControl'; import { - RendererAction, - RendererEvent -} from 'amis-editor-comp/dist/renderers/event-action'; + RendererPluginAction, + RendererPluginEvent +} from 'amis-editor-core'; export class ImageControlPlugin extends BasePlugin { // 关联渲染器名字 rendererName = 'input-image'; @@ -38,7 +38,7 @@ export class ImageControlPlugin extends BasePlugin { notRenderFormZone = true; // 事件定义 - events: RendererEvent[] = [ + events: RendererPluginEvent[] = [ { eventName: 'change', eventLabel: '值变化', @@ -62,7 +62,7 @@ export class ImageControlPlugin extends BasePlugin { ]; // 动作定义 - actions: RendererAction[] = [ + actions: RendererPluginAction[] = [ { actionType: 'clear', actionLabel: '清空数据', diff --git a/packages/amis-editor/src/plugin/Form/InputKV.tsx b/packages/amis-editor/src/plugin/Form/InputKV.tsx index f79eff5ac..ff4f4a3ea 100644 --- a/packages/amis-editor/src/plugin/Form/InputKV.tsx +++ b/packages/amis-editor/src/plugin/Form/InputKV.tsx @@ -2,9 +2,9 @@ * @file input-kv 组件的素项目部 */ import { - RendererAction, - RendererEvent -} from 'amis-editor-comp/dist/renderers/event-action'; + RendererPluginAction, + RendererPluginEvent +} from 'amis-editor-core'; import {defaultValue, getSchemaTpl, valuePipeOut} from 'amis-editor-core'; import {registerEditorPlugin} from 'amis-editor-core'; import { @@ -44,7 +44,7 @@ export class KVControlPlugin extends BasePlugin { }; // 事件定义 - events: RendererEvent[] = [ + events: RendererPluginEvent[] = [ { eventName: 'add', eventLabel: '添加', @@ -84,7 +84,7 @@ export class KVControlPlugin extends BasePlugin { ]; // 动作定义 - actions: RendererAction[] = [ + actions: RendererPluginAction[] = [ { actionType: 'clear', actionLabel: '清空', diff --git a/packages/amis-editor/src/plugin/Form/InputNumber.tsx b/packages/amis-editor/src/plugin/Form/InputNumber.tsx index a8e13ff20..7ecdb9ea0 100644 --- a/packages/amis-editor/src/plugin/Form/InputNumber.tsx +++ b/packages/amis-editor/src/plugin/Form/InputNumber.tsx @@ -1,7 +1,7 @@ import { - RendererAction, - RendererEvent -} from 'amis-editor-comp/dist/renderers/event-action'; + RendererPluginAction, + RendererPluginEvent +} from 'amis-editor-core'; import flatten from 'lodash/flatten'; import {ContainerWrapper} from 'amis-editor-core'; import {registerEditorPlugin} from 'amis-editor-core'; @@ -56,7 +56,7 @@ export class NumberControlPlugin extends BasePlugin { panelJustify = true; // 事件定义 - events: RendererEvent[] = [ + events: RendererPluginEvent[] = [ { eventName: 'change', eventLabel: '值变化', @@ -108,7 +108,7 @@ export class NumberControlPlugin extends BasePlugin { ]; // 动作定义 - actions: RendererAction[] = [ + actions: RendererPluginAction[] = [ { actionType: 'clear', actionLabel: '清空', diff --git a/packages/amis-editor/src/plugin/Form/InputRange.tsx b/packages/amis-editor/src/plugin/Form/InputRange.tsx index 2a5af2e20..f449270b7 100644 --- a/packages/amis-editor/src/plugin/Form/InputRange.tsx +++ b/packages/amis-editor/src/plugin/Form/InputRange.tsx @@ -1,7 +1,7 @@ import { - RendererAction, - RendererEvent -} from 'amis-editor-comp/dist/renderers/event-action'; + RendererPluginAction, + RendererPluginEvent +} from 'amis-editor-core'; import {defaultValue, getSchemaTpl} from 'amis-editor-core'; import {registerEditorPlugin} from 'amis-editor-core'; import {BasePlugin, BaseEventContext} from 'amis-editor-core'; @@ -40,7 +40,7 @@ export class RangeControlPlugin extends BasePlugin { notRenderFormZone = true; // 事件定义 - events: RendererEvent[] = [ + events: RendererPluginEvent[] = [ { eventName: 'change', eventLabel: '值变化', @@ -92,7 +92,7 @@ export class RangeControlPlugin extends BasePlugin { ]; // 动作定义 - actions: RendererAction[] = [ + actions: RendererPluginAction[] = [ { actionType: 'clear', actionLabel: '清空', diff --git a/packages/amis-editor/src/plugin/Form/InputRating.tsx b/packages/amis-editor/src/plugin/Form/InputRating.tsx index 6ccf0f0dc..0c1578aae 100644 --- a/packages/amis-editor/src/plugin/Form/InputRating.tsx +++ b/packages/amis-editor/src/plugin/Form/InputRating.tsx @@ -10,9 +10,9 @@ import {tipedLabel} from '../../component/BaseControl'; import {ValidatorTag} from '../../validator'; import {getEventControlConfig} from '../../util'; import { - RendererAction, - RendererEvent -} from 'amis-editor-comp/dist/renderers/event-action'; + RendererPluginAction, + RendererPluginEvent +} from 'amis-editor-core'; export class RateControlPlugin extends BasePlugin { // 关联渲染器名字 @@ -50,7 +50,7 @@ export class RateControlPlugin extends BasePlugin { count = 5; // 事件定义 - events: RendererEvent[] = [ + events: RendererPluginEvent[] = [ { eventName: 'change', eventLabel: '值变化', @@ -70,7 +70,7 @@ export class RateControlPlugin extends BasePlugin { ]; // 动作定义 - actions: RendererAction[] = [ + actions: RendererPluginAction[] = [ { actionType: 'clear', actionLabel: '清空', diff --git a/packages/amis-editor/src/plugin/Form/InputTag.tsx b/packages/amis-editor/src/plugin/Form/InputTag.tsx index 6c67204e5..d6255b716 100644 --- a/packages/amis-editor/src/plugin/Form/InputTag.tsx +++ b/packages/amis-editor/src/plugin/Form/InputTag.tsx @@ -10,9 +10,9 @@ import { import {formItemControl} from '../../component/BaseControl'; import { - RendererAction, - RendererEvent -} from 'amis-editor-comp/dist/renderers/event-action'; + RendererPluginAction, + RendererPluginEvent +} from 'amis-editor-core'; export class TagControlPlugin extends BasePlugin { // 关联渲染器名字 @@ -50,7 +50,7 @@ export class TagControlPlugin extends BasePlugin { panelTitle = '标签'; // 事件定义 - events: RendererEvent[] = [ + events: RendererPluginEvent[] = [ { eventName: 'change', eventLabel: '值变化', @@ -102,7 +102,7 @@ export class TagControlPlugin extends BasePlugin { ]; // 动作定义 - actions: RendererAction[] = [ + actions: RendererPluginAction[] = [ { actionType: 'clear', actionLabel: '清空', diff --git a/packages/amis-editor/src/plugin/Form/InputTree.tsx b/packages/amis-editor/src/plugin/Form/InputTree.tsx index 80aa3f218..c7786f1d0 100644 --- a/packages/amis-editor/src/plugin/Form/InputTree.tsx +++ b/packages/amis-editor/src/plugin/Form/InputTree.tsx @@ -1,8 +1,8 @@ import React from 'react'; import { - RendererAction, - RendererEvent -} from 'amis-editor-comp/dist/renderers/event-action'; + 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'; @@ -62,7 +62,7 @@ export class TreeControlPlugin extends BasePlugin { panelTitle = '树选择'; // 事件定义 - events: RendererEvent[] = [ + events: RendererPluginEvent[] = [ { eventName: 'change', eventLabel: '值变化', @@ -158,7 +158,7 @@ export class TreeControlPlugin extends BasePlugin { ]; // 动作定义 - actions: RendererAction[] = [ + actions: RendererPluginAction[] = [ { actionType: 'expand', actionLabel: '展开', diff --git a/packages/amis-editor/src/plugin/Form/ListSelect.tsx b/packages/amis-editor/src/plugin/Form/ListSelect.tsx index cbf29d26b..0afa353d7 100644 --- a/packages/amis-editor/src/plugin/Form/ListSelect.tsx +++ b/packages/amis-editor/src/plugin/Form/ListSelect.tsx @@ -4,9 +4,9 @@ import {BasePlugin, BaseEventContext} from 'amis-editor-core'; import {formItemControl} from '../../component/BaseControl'; import { - RendererAction, - RendererEvent -} from 'amis-editor-comp/dist/renderers/event-action'; + RendererPluginAction, + RendererPluginEvent +} from 'amis-editor-core'; export class ListControlPlugin extends BasePlugin { // 关联渲染器名字 @@ -56,7 +56,7 @@ export class ListControlPlugin extends BasePlugin { panelTitle = '列表选择'; // 事件定义 - events: RendererEvent[] = [ + events: RendererPluginEvent[] = [ { eventName: 'change', eventLabel: '值变化', @@ -76,7 +76,7 @@ export class ListControlPlugin extends BasePlugin { ]; // 动作定义 - actions: RendererAction[] = [ + actions: RendererPluginAction[] = [ { actionType: 'clear', actionLabel: '清空', diff --git a/packages/amis-editor/src/plugin/Form/MatrixCheckboxes.tsx b/packages/amis-editor/src/plugin/Form/MatrixCheckboxes.tsx index d9628c857..bbb7513d1 100644 --- a/packages/amis-editor/src/plugin/Form/MatrixCheckboxes.tsx +++ b/packages/amis-editor/src/plugin/Form/MatrixCheckboxes.tsx @@ -11,9 +11,9 @@ import {tipedLabel} from '../../component/BaseControl'; import {ValidatorTag} from '../../validator'; import {getEventControlConfig} from '../../util'; import { - RendererAction, - RendererEvent -} from 'amis-editor-comp/dist/renderers/event-action'; + RendererPluginAction, + RendererPluginEvent +} from 'amis-editor-core'; export class MatrixControlPlugin extends BasePlugin { // 关联渲染器名字 @@ -66,7 +66,7 @@ export class MatrixControlPlugin extends BasePlugin { panelTitle = '矩阵开关'; panelJustify = true; // 事件定义 - events: RendererEvent[] = [ + events: RendererPluginEvent[] = [ { eventName: 'change', eventLabel: '值变化', @@ -86,7 +86,7 @@ export class MatrixControlPlugin extends BasePlugin { ]; // 动作定义 - actions: RendererAction[] = [ + actions: RendererPluginAction[] = [ { actionType: 'clear', actionLabel: '清空', diff --git a/packages/amis-editor/src/plugin/Form/NestedSelect.tsx b/packages/amis-editor/src/plugin/Form/NestedSelect.tsx index 9c8e73e84..60706f9d2 100644 --- a/packages/amis-editor/src/plugin/Form/NestedSelect.tsx +++ b/packages/amis-editor/src/plugin/Form/NestedSelect.tsx @@ -1,8 +1,8 @@ import {relativeValueRe} from 'amis'; import { - RendererAction, - RendererEvent -} from 'amis-editor-comp/dist/renderers/event-action'; + RendererPluginAction, + RendererPluginEvent +} from 'amis-editor-core'; import {availableLanguages} from 'amis/lib/renderers/Form/Editor'; import {defaultValue, getSchemaTpl, valuePipeOut} from 'amis-editor-core'; import {registerEditorPlugin} from 'amis-editor-core'; @@ -113,7 +113,7 @@ export class NestedSelectControlPlugin extends BasePlugin { }; panelJustify = true; // 事件定义 - events: RendererEvent[] = [ + events: RendererPluginEvent[] = [ { eventName: 'change', eventLabel: '值变化', @@ -165,7 +165,7 @@ export class NestedSelectControlPlugin extends BasePlugin { ]; // 动作定义 - actions: RendererAction[] = [ + actions: RendererPluginAction[] = [ { actionType: 'clear', actionLabel: '清空', diff --git a/packages/amis-editor/src/plugin/Form/Radios.tsx b/packages/amis-editor/src/plugin/Form/Radios.tsx index 4b72f9cd2..0d2847681 100644 --- a/packages/amis-editor/src/plugin/Form/Radios.tsx +++ b/packages/amis-editor/src/plugin/Form/Radios.tsx @@ -5,9 +5,9 @@ import {BasePlugin, BaseEventContext} from 'amis-editor-core'; import {ValidatorTag} from '../../validator'; import {getEventControlConfig} from '../../util'; import { - RendererAction, - RendererEvent -} from 'amis-editor-comp/dist/renderers/event-action'; + RendererPluginAction, + RendererPluginEvent +} from 'amis-editor-core'; export class RadiosControlPlugin extends BasePlugin { // 关联渲染器名字 @@ -57,7 +57,7 @@ export class RadiosControlPlugin extends BasePlugin { panelTitle = '单选框'; // 事件定义 - events: RendererEvent[] = [ + events: RendererPluginEvent[] = [ { eventName: 'change', eventLabel: '值变化', @@ -77,7 +77,7 @@ export class RadiosControlPlugin extends BasePlugin { ]; // 动作定义 - actions: RendererAction[] = [ + actions: RendererPluginAction[] = [ { actionType: 'clear', actionLabel: '清空', diff --git a/packages/amis-editor/src/plugin/Form/Select.tsx b/packages/amis-editor/src/plugin/Form/Select.tsx index 632c511d3..25cf84456 100644 --- a/packages/amis-editor/src/plugin/Form/Select.tsx +++ b/packages/amis-editor/src/plugin/Form/Select.tsx @@ -7,9 +7,9 @@ import {tipedLabel} from '../../component/BaseControl'; import {ValidatorTag} from '../../validator'; import {getEventControlConfig} from '../../util'; import { - RendererAction, - RendererEvent -} from 'amis-editor-comp/dist/renderers/event-action'; + RendererPluginAction, + RendererPluginEvent +} from 'amis-editor-core'; export class SelectControlPlugin extends BasePlugin { // 关联渲染器名字 @@ -58,7 +58,7 @@ export class SelectControlPlugin extends BasePlugin { panelTitle = '下拉框'; // 事件定义 - events: RendererEvent[] = [ + events: RendererPluginEvent[] = [ { eventName: 'change', eventLabel: '值变化', @@ -170,7 +170,7 @@ export class SelectControlPlugin extends BasePlugin { ]; // 动作定义 - actions: RendererAction[] = [ + actions: RendererPluginAction[] = [ { actionType: 'clear', actionLabel: '清空', diff --git a/packages/amis-editor/src/plugin/Form/Switch.tsx b/packages/amis-editor/src/plugin/Form/Switch.tsx index 7928b47ba..24bf698d0 100644 --- a/packages/amis-editor/src/plugin/Form/Switch.tsx +++ b/packages/amis-editor/src/plugin/Form/Switch.tsx @@ -5,9 +5,9 @@ import {tipedLabel} from '../../component/BaseControl'; import {ValidatorTag} from '../../validator'; import {getEventControlConfig} from '../../util'; import type { - RendererAction, - RendererEvent -} from 'amis-editor-comp/dist/renderers/event-action'; + RendererPluginAction, + RendererPluginEvent +} from 'amis-editor-core'; export class SwitchControlPlugin extends BasePlugin { // 关联渲染器名字 @@ -47,7 +47,7 @@ export class SwitchControlPlugin extends BasePlugin { panelTitle = '开关'; - events: RendererEvent[] = [ + events: RendererPluginEvent[] = [ { eventName: 'change', eventLabel: '值变化', @@ -67,7 +67,7 @@ export class SwitchControlPlugin extends BasePlugin { ]; // 动作定义 - actions: RendererAction[] = [ + actions: RendererPluginAction[] = [ { actionType: 'setValue', actionLabel: '赋值', diff --git a/packages/amis-editor/src/plugin/Form/TabsTransfer.tsx b/packages/amis-editor/src/plugin/Form/TabsTransfer.tsx index bf1ead79f..51e8c7f68 100644 --- a/packages/amis-editor/src/plugin/Form/TabsTransfer.tsx +++ b/packages/amis-editor/src/plugin/Form/TabsTransfer.tsx @@ -4,9 +4,9 @@ import {registerEditorPlugin} from 'amis-editor-core'; import {BasePlugin, BaseEventContext} from 'amis-editor-core'; import { - RendererAction, - RendererEvent -} from 'amis-editor-comp/dist/renderers/event-action'; + RendererPluginAction, + RendererPluginEvent +} from 'amis-editor-core'; import {getEventControlConfig} from '../../util'; export class TabsTransferPlugin extends BasePlugin { @@ -134,7 +134,7 @@ export class TabsTransferPlugin extends BasePlugin { panelTitle = '组合穿梭器'; - events: RendererEvent[] = [ + events: RendererPluginEvent[] = [ { eventName: 'change', eventLabel: '值变化', @@ -186,7 +186,7 @@ export class TabsTransferPlugin extends BasePlugin { ]; // 动作定义 - actions: RendererAction[] = [ + actions: RendererPluginAction[] = [ { actionType: 'clear', actionLabel: '清空', diff --git a/packages/amis-editor/src/plugin/Form/Textarea.tsx b/packages/amis-editor/src/plugin/Form/Textarea.tsx index 3221a148f..2ea3c181b 100644 --- a/packages/amis-editor/src/plugin/Form/Textarea.tsx +++ b/packages/amis-editor/src/plugin/Form/Textarea.tsx @@ -7,9 +7,9 @@ import {tipedLabel} from '../../component/BaseControl'; import {ValidatorTag} from '../../validator'; import {getEventControlConfig} from '../../util'; import { - RendererAction, - RendererEvent -} from 'amis-editor-comp/dist/renderers/event-action'; + RendererPluginAction, + RendererPluginEvent +} from 'amis-editor-core'; export class TextareaControlPlugin extends BasePlugin { // 关联渲染器名字 @@ -43,7 +43,7 @@ export class TextareaControlPlugin extends BasePlugin { panelTitle = '多行文本'; - events: RendererEvent[] = [ + events: RendererPluginEvent[] = [ { eventName: 'change', eventLabel: '值变化', @@ -94,7 +94,7 @@ export class TextareaControlPlugin extends BasePlugin { } ]; - actions: RendererAction[] = [ + actions: RendererPluginAction[] = [ { actionType: 'clear', actionLabel: '清空', diff --git a/packages/amis-editor/src/plugin/Form/Transfer.tsx b/packages/amis-editor/src/plugin/Form/Transfer.tsx index b2f0e9832..a65b4c55b 100644 --- a/packages/amis-editor/src/plugin/Form/Transfer.tsx +++ b/packages/amis-editor/src/plugin/Form/Transfer.tsx @@ -3,9 +3,9 @@ import {registerEditorPlugin} from 'amis-editor-core'; import {BasePlugin, BaseEventContext} from 'amis-editor-core'; import {getEventControlConfig} from '../../util'; import { - RendererAction, - RendererEvent -} from 'amis-editor-comp/dist/renderers/event-action'; + RendererPluginAction, + RendererPluginEvent +} from 'amis-editor-core'; export class TransferPlugin extends BasePlugin { // 关联渲染器名字 @@ -79,7 +79,7 @@ export class TransferPlugin extends BasePlugin { panelTitle = '穿梭器'; - events: RendererEvent[] = [ + events: RendererPluginEvent[] = [ { eventName: 'change', eventLabel: '值变化', @@ -115,7 +115,7 @@ export class TransferPlugin extends BasePlugin { ]; // 动作定义 - actions: RendererAction[] = [ + actions: RendererPluginAction[] = [ { actionType: 'clear', actionLabel: '清空', diff --git a/packages/amis-editor/src/plugin/Form/TreeSelect.tsx b/packages/amis-editor/src/plugin/Form/TreeSelect.tsx index 0e2873d1c..8eee85b71 100644 --- a/packages/amis-editor/src/plugin/Form/TreeSelect.tsx +++ b/packages/amis-editor/src/plugin/Form/TreeSelect.tsx @@ -1,7 +1,7 @@ import { - RendererAction, - RendererEvent -} from 'amis-editor-comp/dist/renderers/event-action'; + 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'; @@ -60,7 +60,7 @@ export class TreeSelectControlPlugin extends BasePlugin { panelTitle = '树下拉'; // 事件定义 - events: RendererEvent[] = [ + events: RendererPluginEvent[] = [ { eventName: 'change', eventLabel: '值变化', @@ -188,7 +188,7 @@ export class TreeSelectControlPlugin extends BasePlugin { ]; // 动作定义 - actions: RendererAction[] = [ + actions: RendererPluginAction[] = [ { actionType: 'clear', actionLabel: '清空', diff --git a/packages/amis-editor/src/plugin/Link.tsx b/packages/amis-editor/src/plugin/Link.tsx index a39c6f3b0..cfb2ce305 100644 --- a/packages/amis-editor/src/plugin/Link.tsx +++ b/packages/amis-editor/src/plugin/Link.tsx @@ -5,9 +5,9 @@ import {tipedLabel} from '../component/BaseControl'; import {ValidatorTag} from '../validator'; import {getEventControlConfig} from '../util'; import { - RendererAction, - RendererEvent -} from 'amis-editor-comp/dist/renderers/event-action'; + RendererPluginAction, + RendererPluginEvent +} from 'amis-editor-core'; export class LinkPlugin extends BasePlugin { // 关联渲染器名字 diff --git a/packages/amis-editor/src/plugin/Page.tsx b/packages/amis-editor/src/plugin/Page.tsx index a6676a8fb..7278feaa4 100644 --- a/packages/amis-editor/src/plugin/Page.tsx +++ b/packages/amis-editor/src/plugin/Page.tsx @@ -4,9 +4,9 @@ import {BaseEventContext, BasePlugin} from 'amis-editor-core'; import {getSchemaTpl} from 'amis-editor-core'; import {getEventControlConfig} from '../util'; import { - RendererAction, - RendererEvent -} from 'amis-editor-comp/dist/renderers/event-action'; + RendererPluginAction, + RendererPluginEvent +} from 'amis-editor-core'; import type {SchemaObject} from 'amis/lib/Schema'; export class PagePlugin extends BasePlugin { @@ -42,7 +42,7 @@ export class PagePlugin extends BasePlugin { body: '内容' }; - events: RendererEvent[] = [ + events: RendererPluginEvent[] = [ { eventName: 'inited', eventLabel: '初始化完成', @@ -67,7 +67,7 @@ export class PagePlugin extends BasePlugin { ]; // 动作定义 - actions: RendererAction[] = [ + actions: RendererPluginAction[] = [ { actionType: 'reload', actionLabel: '重新加载', diff --git a/packages/amis-editor/src/plugin/Pagination.tsx b/packages/amis-editor/src/plugin/Pagination.tsx index 5d2087c56..6bedcb57d 100644 --- a/packages/amis-editor/src/plugin/Pagination.tsx +++ b/packages/amis-editor/src/plugin/Pagination.tsx @@ -3,7 +3,7 @@ import {BasePlugin, RegionConfig, BaseEventContext} from 'amis-editor-core'; import {tipedLabel} from '../component/BaseControl'; import {ValidatorTag} from '../validator'; import {getEventControlConfig} from '../util'; -import {RendererEvent} from 'amis-editor-comp/dist/renderers/event-action'; +import {RendererPluginEvent} from 'amis-editor-core'; import {defaultValue, getSchemaTpl} from 'amis-editor-core'; @@ -45,7 +45,7 @@ export class PaginationPlugin extends BasePlugin { panelTitle = '分页器'; // 事件定义 - events: RendererEvent[] = [ + events: RendererPluginEvent[] = [ { eventName: 'pageChange', eventLabel: '分页改变', diff --git a/packages/amis-editor/src/plugin/Service.tsx b/packages/amis-editor/src/plugin/Service.tsx index d67d03730..2529b4c22 100644 --- a/packages/amis-editor/src/plugin/Service.tsx +++ b/packages/amis-editor/src/plugin/Service.tsx @@ -6,9 +6,9 @@ import {getSchemaTpl} from 'amis-editor-core'; import {getEventControlConfig} from '../util'; import type { - RendererAction, - RendererEvent -} from 'amis-editor-comp/dist/renderers/event-action'; + RendererPluginAction, + RendererPluginEvent +} from 'amis-editor-core'; export class ServicePlugin extends BasePlugin { // 关联渲染器名字 @@ -45,7 +45,7 @@ export class ServicePlugin extends BasePlugin { } ]; - events: RendererEvent[] = [ + events: RendererPluginEvent[] = [ { eventName: 'fetchInited', eventLabel: 'api 初始化数据', @@ -58,7 +58,7 @@ export class ServicePlugin extends BasePlugin { } ]; - actions: RendererAction[] = [ + actions: RendererPluginAction[] = [ { actionType: 'reload', actionLabel: '重新加载', diff --git a/packages/amis-editor/src/plugin/Table.tsx b/packages/amis-editor/src/plugin/Table.tsx index a4d3f32db..8a73c1244 100644 --- a/packages/amis-editor/src/plugin/Table.tsx +++ b/packages/amis-editor/src/plugin/Table.tsx @@ -1,8 +1,8 @@ import {resolveVariable} from 'amis'; import { - RendererAction, - RendererEvent -} from 'amis-editor-comp/dist/renderers/event-action'; + RendererPluginAction, + RendererPluginEvent +} from 'amis-editor-core'; import {setVariable} from 'amis-core'; import {registerEditorPlugin, repeatArray} from 'amis-editor-core'; @@ -156,7 +156,7 @@ export class TablePlugin extends BasePlugin { panelTitle = '表格'; - events: RendererEvent[] = [ + events: RendererPluginEvent[] = [ { eventName: 'selectedChange', eventLabel: '选择表格项', @@ -287,7 +287,7 @@ export class TablePlugin extends BasePlugin { } ]; - actions: RendererAction[] = [ + actions: RendererPluginAction[] = [ { actionType: 'select', actionLabel: '设置选中项', diff --git a/packages/amis-editor/src/plugin/Wizard.tsx b/packages/amis-editor/src/plugin/Wizard.tsx index 1147ce823..862d17f9a 100644 --- a/packages/amis-editor/src/plugin/Wizard.tsx +++ b/packages/amis-editor/src/plugin/Wizard.tsx @@ -13,9 +13,9 @@ import {mapReactElement} from 'amis-editor-core'; import {RegionWrapper as Region} from 'amis-editor-core'; import { - RendererAction, - RendererEvent -} from 'amis-editor-comp/dist/renderers/event-action'; + RendererPluginAction, + RendererPluginEvent +} from 'amis-editor-core'; import {getEventControlConfig} from '../util'; import {getComboWrapper} from '../event-action/schema'; @@ -82,7 +82,7 @@ export class WizardPlugin extends BasePlugin { }; // 事件定义 - events: RendererEvent[] = [ + events: RendererPluginEvent[] = [ { eventName: 'inited', eventLabel: '初始化完成', @@ -203,7 +203,7 @@ export class WizardPlugin extends BasePlugin { ]; // 动作定义 - actions: RendererAction[] = [ + actions: RendererPluginAction[] = [ { actionType: 'submit', actionLabel: '全部提交', diff --git a/packages/amis-editor/src/renderer/event-control/action-config-panel.tsx b/packages/amis-editor/src/renderer/event-control/action-config-panel.tsx new file mode 100644 index 000000000..adb3a00f9 --- /dev/null +++ b/packages/amis-editor/src/renderer/event-control/action-config-panel.tsx @@ -0,0 +1,50 @@ +/** + * 动作配置面板 + */ + +import {RendererProps, Schema} from 'amis-core'; +import {RendererPluginAction} from 'amis-editor-core'; +import React from 'react'; +import cx from 'classnames'; + +export default class ActionConfigPanel extends React.Component { + render() { + const {actionConfigItems, data, onBulkChange, render, actions} = this.props; + const hasParentType = ['component', 'openPage'].includes(data.actionType); + const actionType = hasParentType ? data.__cmptActionType : data.actionType; + let schema = undefined; + if (data.actionType === 'component') { + // 对于组件从actions中获取 + schema = actions?.[data.__rendererName]?.find( + (item: RendererPluginAction) => item.actionType === actionType + )?.schema; + } + if (!schema) { + schema = { + ...actionConfigItems[actionType] + }.schema; + } + + return schema ? ( + render('inner', schema as Schema, { + data, + onChange: (value: any, field: any) => { + onBulkChange({ + [field]: value + }); + } + }) + ) : data.__showSelectCmpt || hasParentType ? ( + <> + ) : ( +
+
+ {actionType ? '无配置内容' : '请选择执行动作'} +
+ ); + } +} diff --git a/packages/amis-editor/src/renderer/event-control/comp-action-select.tsx b/packages/amis-editor/src/renderer/event-control/comp-action-select.tsx new file mode 100644 index 000000000..1d279fd21 --- /dev/null +++ b/packages/amis-editor/src/renderer/event-control/comp-action-select.tsx @@ -0,0 +1,70 @@ +/** + * 组件专有动作选择器 + */ + +import {Option, Select} from 'amis'; +import {RendererProps} from 'amis-core'; +import React from 'react'; + +// 动作基本配置项 +export const BASE_ACTION_PROPS = [ + 'actionType', + '__actionDesc', + 'preventDefault', + 'stopPropagation', + 'expression', + 'outputVar' +]; + +export default class CmptActionSelect extends React.Component { + onChange(option: Option) { + const {formStore} = this.props; + let removeKeys: { + [key: string]: any; + } = {}; + + // 保留必须字段,其他过滤掉 + Object.keys(formStore.data).forEach((key: string) => { + if ( + ![ + ...BASE_ACTION_PROPS, + 'componentId', + '__rendererName', + '__rendererLabel', + '__componentTreeSource', + '__showSelectCmpt' + ].includes(key) + ) { + removeKeys[key] = undefined; + } + }); + + formStore.setValues({ + ...removeKeys, + args: undefined, + __cmptActionType: option.value, + __cmptActionDesc: option.description + }); + + this.props.onChange(option.value); + } + render() { + const {data, formStore, pluginActions} = this.props; + // 根据type 从组件树中获取actions + const actions = pluginActions[data.__rendererName] || []; + + return ( +