feat:迁移事件面板组件

Change-Id: Ibc8d894fc321ed6d792da39df5552404e4271f62
This commit is contained in:
hsm-lv 2022-06-17 21:19:00 +08:00
parent 0799c70b52
commit 926ebf327a
47 changed files with 2233 additions and 197 deletions

View File

@ -24,7 +24,6 @@
] ]
}, },
"dependencies": { "dependencies": {
"amis-editor-comp": "*",
"amis-editor-core": "*", "amis-editor-core": "*",
"lodash": "^4.17.15", "lodash": "^4.17.15",
"@webcomponents/webcomponentsjs": "^2.6.0" "@webcomponents/webcomponentsjs": "^2.6.0"

View File

@ -1,10 +1,7 @@
import type { import type {RendererPluginAction} from 'amis-editor-core';
ActionTypeNode,
RendererAction
} from 'amis-editor-comp/dist/renderers/event-action';
// 表单类动作 // 表单类动作
const formActions: RendererAction[] = [ const formActions: RendererPluginAction[] = [
{ {
actionLabel: '提交', actionLabel: '提交',
actionType: 'submit', actionType: 'submit',
@ -28,7 +25,7 @@ const formActions: RendererAction[] = [
]; ];
// 页面类动作 // 页面类动作
const pageActions: RendererAction[] = [ const pageActions: RendererPluginAction[] = [
{ {
actionLabel: '打开页面', actionLabel: '打开页面',
actionType: 'openPage', actionType: 'openPage',
@ -47,7 +44,7 @@ const pageActions: RendererAction[] = [
]; ];
// 弹框类动作 // 弹框类动作
const dialogActions: RendererAction[] = [ const dialogActions: RendererPluginAction[] = [
{ {
actionLabel: '打开弹窗', actionLabel: '打开弹窗',
actionType: 'dialog', actionType: 'dialog',
@ -87,7 +84,7 @@ const dialogActions: RendererAction[] = [
]; ];
// 服务类动作 // 服务类动作
const serviceActions: RendererAction[] = [ const serviceActions: RendererPluginAction[] = [
{ {
actionLabel: '发送请求', actionLabel: '发送请求',
actionType: 'ajax', actionType: 'ajax',
@ -100,7 +97,7 @@ const serviceActions: RendererAction[] = [
} }
]; ];
const ACTION_TYPE_TREE: ActionTypeNode[] = [ const ACTION_TYPE_TREE: RendererPluginAction[] = [
{ {
actionLabel: '页面', actionLabel: '页面',
actionType: 'page', actionType: 'page',

View File

@ -1,7 +1,6 @@
import React from 'react'; import React from 'react';
import {Button} from 'amis'; import {Button} from 'amis';
import {defaultValue, getSchemaTpl} from 'amis-editor-core'; import {defaultValue, getSchemaTpl, RendererPluginAction} from 'amis-editor-core';
import type {ActionConfigItemsMap} from 'amis-editor-comp/dist/renderers/event-action';
export const getComboWrapper = (items: any, multiple: boolean = false) => ({ export const getComboWrapper = (items: any, multiple: boolean = false) => ({
type: 'combo', type: 'combo',
@ -16,7 +15,7 @@ export const getComboWrapper = (items: any, multiple: boolean = false) => ({
* map * map
* @param manager * @param manager
*/ */
export function getActionConfigItemsMap(manager: any): ActionConfigItemsMap { export function getActionConfigItemsMap(manager: any): {[propName: string]: RendererPluginAction} {
return { return {
ajax: { ajax: {
config: ['api'], config: ['api'],

View File

@ -153,6 +153,7 @@ import './renderer/RangePartsControl';
import './renderer/DataBindingControl'; import './renderer/DataBindingControl';
import './renderer/DataMappingControl'; import './renderer/DataMappingControl';
import './renderer/DataPickerControl'; import './renderer/DataPickerControl';
import './renderer/event-control/index';
export * from './component/BaseControl'; export * from './component/BaseControl';

View File

@ -9,10 +9,7 @@ import {
import {defaultValue, getSchemaTpl} from 'amis-editor-core'; import {defaultValue, getSchemaTpl} from 'amis-editor-core';
import {BUTTON_DEFAULT_ACTION, tipedLabel} from '../component/BaseControl'; import {BUTTON_DEFAULT_ACTION, tipedLabel} from '../component/BaseControl';
import {getEventControlConfig} from '../util'; import {getEventControlConfig} from '../util';
import { import {RendererPluginAction, RendererPluginEvent} from 'amis-editor-core';
RendererAction,
RendererEvent
} from 'amis-editor-comp/dist/renderers/event-action';
import {SchemaObject} from 'amis/lib/Schema'; import {SchemaObject} from 'amis/lib/Schema';
export class ButtonPlugin extends BasePlugin { export class ButtonPlugin extends BasePlugin {
@ -41,7 +38,7 @@ export class ButtonPlugin extends BasePlugin {
panelTitle = '按钮'; panelTitle = '按钮';
// 事件定义 // 事件定义
events: RendererEvent[] = [ events: RendererPluginEvent[] = [
{ {
eventName: 'click', eventName: 'click',
eventLabel: '点击', eventLabel: '点击',
@ -66,7 +63,7 @@ export class ButtonPlugin extends BasePlugin {
]; ];
// 动作定义 // 动作定义
actions: RendererAction[] = []; actions: RendererPluginAction[] = [];
panelJustify = true; panelJustify = true;

View File

@ -7,10 +7,10 @@ import {
RegionConfig, RegionConfig,
RendererInfo RendererInfo
} from 'amis-editor-core'; } 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 {diff} from 'amis-editor-core';
import AMisCodeEditor 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) => { const ChartConfigEditor = ({value, onChange}: any) => {
return ( return (
@ -57,7 +57,7 @@ export class ChartPlugin extends BasePlugin {
}; };
// 动作定义 // 动作定义
actions: RendererAction[] = [ actions: RendererPluginAction[] = [
{ {
actionType: 'reload', actionType: 'reload',
actionLabel: '重新加载', actionLabel: '重新加载',

View File

@ -2,9 +2,9 @@ import {registerEditorPlugin} from 'amis-editor-core';
import {BasePlugin, BaseEventContext} from 'amis-editor-core'; import {BasePlugin, BaseEventContext} from 'amis-editor-core';
import { import {
RendererAction, RendererPluginAction,
RendererEvent RendererPluginEvent
} from 'amis-editor-comp/dist/renderers/event-action'; } from 'amis-editor-core';
import {getSchemaTpl} from 'amis-editor-core'; import {getSchemaTpl} from 'amis-editor-core';
import {formItemControl} from '../../component/BaseControl'; import {formItemControl} from '../../component/BaseControl';
@ -52,7 +52,7 @@ export class ButtonGroupControlPlugin extends BasePlugin {
panelTitle = '按钮点选'; panelTitle = '按钮点选';
// 事件定义 // 事件定义
events: RendererEvent[] = [ events: RendererPluginEvent[] = [
{ {
eventName: 'change', eventName: 'change',
eventLabel: '值变化', eventLabel: '值变化',
@ -72,7 +72,7 @@ export class ButtonGroupControlPlugin extends BasePlugin {
]; ];
// 动作定义 // 动作定义
actions: RendererAction[] = [ actions: RendererPluginAction[] = [
{ {
actionType: 'clear', actionType: 'clear',
actionLabel: '清空', actionLabel: '清空',

View File

@ -11,9 +11,9 @@ import {ValidatorTag} from '../../validator';
import {tipedLabel} from '../../component/BaseControl'; import {tipedLabel} from '../../component/BaseControl';
import {getEventControlConfig} from '../../util'; import {getEventControlConfig} from '../../util';
import { import {
RendererAction, RendererPluginAction,
RendererEvent RendererPluginEvent
} from 'amis-editor-comp/dist/renderers/event-action'; } from 'amis-editor-core';
export class ChainedSelectControlPlugin extends BasePlugin { export class ChainedSelectControlPlugin extends BasePlugin {
// 关联渲染器名字 // 关联渲染器名字
@ -45,7 +45,7 @@ export class ChainedSelectControlPlugin extends BasePlugin {
}; };
// 事件定义 // 事件定义
events: RendererEvent[] = [ events: RendererPluginEvent[] = [
{ {
eventName: 'change', eventName: 'change',
eventLabel: '值变化', eventLabel: '值变化',
@ -65,7 +65,7 @@ export class ChainedSelectControlPlugin extends BasePlugin {
]; ];
// 动作定义 // 动作定义
actions: RendererAction[] = [ actions: RendererPluginAction[] = [
{ {
actionType: 'clear', actionType: 'clear',
actionLabel: '清空', actionLabel: '清空',

View File

@ -15,9 +15,9 @@ import {
import {ValidatorTag} from '../../validator'; import {ValidatorTag} from '../../validator';
import {tipedLabel} from '../../component/BaseControl'; import {tipedLabel} from '../../component/BaseControl';
import { import {
RendererAction, RendererPluginAction,
RendererEvent RendererPluginEvent
} from 'amis-editor-comp/dist/renderers/event-action'; } from 'amis-editor-core';
import {getEventControlConfig} from '../../util'; import {getEventControlConfig} from '../../util';
setSchemaTpl('option', { setSchemaTpl('option', {
@ -59,7 +59,7 @@ export class CheckboxControlPlugin extends BasePlugin {
panelTitle = '勾选框'; panelTitle = '勾选框';
panelJustify = true; panelJustify = true;
// 事件定义 // 事件定义
events: RendererEvent[] = [ events: RendererPluginEvent[] = [
{ {
eventName: 'change', eventName: 'change',
eventLabel: '值变化', eventLabel: '值变化',
@ -78,7 +78,7 @@ export class CheckboxControlPlugin extends BasePlugin {
} }
]; ];
// 动作定义 // 动作定义
actions: RendererAction[] = [ actions: RendererPluginAction[] = [
{ {
actionType: 'clear', actionType: 'clear',
actionLabel: '清空', actionLabel: '清空',

View File

@ -15,9 +15,9 @@ import {
import {ValidatorTag} from '../../validator'; import {ValidatorTag} from '../../validator';
import { import {
RendererAction, RendererPluginAction,
RendererEvent RendererPluginEvent
} from 'amis-editor-comp/dist/renderers/event-action'; } from 'amis-editor-core';
import {getEventControlConfig} from '../../util'; import {getEventControlConfig} from '../../util';
export class CheckboxesControlPlugin extends BasePlugin { export class CheckboxesControlPlugin extends BasePlugin {
@ -70,7 +70,7 @@ export class CheckboxesControlPlugin extends BasePlugin {
panelTitle = '复选框'; panelTitle = '复选框';
// 事件定义 // 事件定义
events: RendererEvent[] = [ events: RendererPluginEvent[] = [
{ {
eventName: 'change', eventName: 'change',
eventLabel: '值变化', eventLabel: '值变化',
@ -90,7 +90,7 @@ export class CheckboxesControlPlugin extends BasePlugin {
]; ];
// 动作定义 // 动作定义
actions: RendererAction[] = [ actions: RendererPluginAction[] = [
{ {
actionType: 'clear', actionType: 'clear',
actionLabel: '清空', actionLabel: '清空',

View File

@ -6,9 +6,9 @@ import {BasePlugin} from 'amis-editor-core';
import type {BaseEventContext} from 'amis-editor-core'; import type {BaseEventContext} from 'amis-editor-core';
import {ValidatorTag} from '../../validator'; import {ValidatorTag} from '../../validator';
import { import {
RendererEvent, RendererPluginEvent,
RendererAction RendererPluginAction
} from 'amis-editor-comp/dist/renderers/event-action'; } from 'amis-editor-core';
import {getEventControlConfig} from '../../util'; import {getEventControlConfig} from '../../util';
export class CodeEditorControlPlugin extends BasePlugin { export class CodeEditorControlPlugin extends BasePlugin {
@ -43,7 +43,7 @@ export class CodeEditorControlPlugin extends BasePlugin {
] ]
}; };
events: RendererEvent[] = [ events: RendererPluginEvent[] = [
{ {
eventName: 'focus', eventName: 'focus',
eventLabel: '获取焦点', eventLabel: '获取焦点',
@ -78,7 +78,7 @@ export class CodeEditorControlPlugin extends BasePlugin {
} }
]; ];
actions: RendererAction[] = [ actions: RendererPluginAction[] = [
{ {
actionType: 'clear', actionType: 'clear',
actionLabel: '清空', actionLabel: '清空',

View File

@ -16,9 +16,9 @@ import {diff, JSONPipeIn} from 'amis-editor-core';
import {JSONPipeOut} from 'amis-editor-core'; import {JSONPipeOut} from 'amis-editor-core';
import {mockValue} from 'amis-editor-core'; import {mockValue} from 'amis-editor-core';
import { import {
RendererEvent, RendererPluginEvent,
RendererAction RendererPluginAction
} from 'amis-editor-comp/dist/renderers/event-action'; } from 'amis-editor-core';
import {setVariable} from 'amis-core'; import {setVariable} from 'amis-core';
export class ComboControlPlugin extends BasePlugin { export class ComboControlPlugin extends BasePlugin {
@ -76,7 +76,7 @@ export class ComboControlPlugin extends BasePlugin {
}; };
// 事件定义 // 事件定义
events: RendererEvent[] = [ events: RendererPluginEvent[] = [
{ {
eventName: 'add', eventName: 'add',
eventLabel: '添加', eventLabel: '添加',
@ -132,7 +132,7 @@ export class ComboControlPlugin extends BasePlugin {
]; ];
// 动作定义 // 动作定义
actions: RendererAction[] = [ actions: RendererPluginAction[] = [
{ {
actionType: 'clear', actionType: 'clear',
actionLabel: '清空', actionLabel: '清空',

View File

@ -12,9 +12,9 @@ import type {BaseEventContext} from 'amis-editor-core';
import {ValidatorTag} from '../../validator'; import {ValidatorTag} from '../../validator';
import {getEventControlConfig} from '../../util'; import {getEventControlConfig} from '../../util';
import { import {
RendererEvent, RendererPluginEvent,
RendererAction RendererPluginAction
} from 'amis-editor-comp/dist/renderers/event-action'; } from 'amis-editor-core';
export class DiffEditorControlPlugin extends BasePlugin { export class DiffEditorControlPlugin extends BasePlugin {
// 关联渲染器名字 // 关联渲染器名字
@ -49,7 +49,7 @@ export class DiffEditorControlPlugin extends BasePlugin {
] ]
}; };
events: RendererEvent[] = [ events: RendererPluginEvent[] = [
{ {
eventName: 'focus', eventName: 'focus',
eventLabel: '获取焦点', eventLabel: '获取焦点',
@ -84,7 +84,7 @@ export class DiffEditorControlPlugin extends BasePlugin {
} }
]; ];
actions: RendererAction[] = [ actions: RendererPluginAction[] = [
{ {
actionType: 'clear', actionType: 'clear',
actionLabel: '清空', actionLabel: '清空',

View File

@ -11,9 +11,9 @@ import {defaultValue, getSchemaTpl} from 'amis-editor-core';
import {jsonToJsonSchema} from 'amis-editor-core'; import {jsonToJsonSchema} from 'amis-editor-core';
import {EditorNodeType} from 'amis-editor-core'; import {EditorNodeType} from 'amis-editor-core';
import { import {
RendererAction, RendererPluginAction,
RendererEvent RendererPluginEvent
} from 'amis-editor-comp/dist/renderers/event-action'; } from 'amis-editor-core';
import {setVariable} from 'amis-core'; import {setVariable} from 'amis-core';
import {getEventControlConfig} from '../../util'; import {getEventControlConfig} from '../../util';
@ -213,7 +213,7 @@ export class FormPlugin extends BasePlugin {
panelTitle = '表单'; panelTitle = '表单';
// 事件定义 // 事件定义
events: RendererEvent[] = [ events: RendererPluginEvent[] = [
{ {
eventName: 'inited', eventName: 'inited',
eventLabel: '初始化完成', eventLabel: '初始化完成',
@ -346,7 +346,7 @@ export class FormPlugin extends BasePlugin {
]; ];
// 动作定义 // 动作定义
actions: RendererAction[] = [ actions: RendererPluginAction[] = [
{ {
actionLabel: '提交表单', actionLabel: '提交表单',
actionType: 'submit', actionType: 'submit',

View File

@ -10,9 +10,9 @@ import {
import {formItemControl} from '../../component/BaseControl'; import {formItemControl} from '../../component/BaseControl';
import { import {
RendererAction, RendererPluginAction,
RendererEvent RendererPluginEvent
} from 'amis-editor-comp/dist/renderers/event-action'; } from 'amis-editor-core';
export class CityControlPlugin extends BasePlugin { export class CityControlPlugin extends BasePlugin {
// 关联渲染器名字 // 关联渲染器名字
@ -48,7 +48,7 @@ export class CityControlPlugin extends BasePlugin {
panelTitle = '城市选择'; panelTitle = '城市选择';
// 事件定义 // 事件定义
events: RendererEvent[] = [ events: RendererPluginEvent[] = [
{ {
eventName: 'change', eventName: 'change',
eventLabel: '值变化', eventLabel: '值变化',
@ -68,7 +68,7 @@ export class CityControlPlugin extends BasePlugin {
]; ];
// 动作定义 // 动作定义
actions: RendererAction[] = [ actions: RendererPluginAction[] = [
{ {
actionType: 'clear', actionType: 'clear',
actionLabel: '清空', actionLabel: '清空',

View File

@ -6,9 +6,9 @@ import {tipedLabel} from '../../component/BaseControl';
import {ValidatorTag} from '../../validator'; import {ValidatorTag} from '../../validator';
import {getEventControlConfig} from '../../util'; import {getEventControlConfig} from '../../util';
import { import {
RendererAction, RendererPluginAction,
RendererEvent RendererPluginEvent
} from 'amis-editor-comp/dist/renderers/event-action'; } from 'amis-editor-core';
const formatX = [ const formatX = [
{ {
@ -180,7 +180,7 @@ export class DateControlPlugin extends BasePlugin {
panelTitle = '日期配置'; panelTitle = '日期配置';
events: RendererEvent[] = [ events: RendererPluginEvent[] = [
{ {
eventName: 'change', eventName: 'change',
eventLabel: '值变化', eventLabel: '值变化',
@ -210,7 +210,7 @@ export class DateControlPlugin extends BasePlugin {
]; ];
// 动作定义 // 动作定义
actions: RendererAction[] = [ actions: RendererPluginAction[] = [
{ {
actionType: 'clear', actionType: 'clear',
actionLabel: '清空', actionLabel: '清空',

View File

@ -6,9 +6,9 @@ import {tipedLabel} from '../../component/BaseControl';
import {ValidatorTag} from '../../validator'; import {ValidatorTag} from '../../validator';
import {getEventControlConfig} from '../../util'; import {getEventControlConfig} from '../../util';
import { import {
RendererAction, RendererPluginAction,
RendererEvent RendererPluginEvent
} from 'amis-editor-comp/dist/renderers/event-action'; } from 'amis-editor-core';
const DateType: { const DateType: {
[key: string]: { [key: string]: {
@ -105,7 +105,7 @@ export class DateRangeControlPlugin extends BasePlugin {
panelTitle = '日期范围'; panelTitle = '日期范围';
events: RendererEvent[] = [ events: RendererPluginEvent[] = [
{ {
eventName: 'change', eventName: 'change',
eventLabel: '值变化', eventLabel: '值变化',
@ -157,7 +157,7 @@ export class DateRangeControlPlugin extends BasePlugin {
]; ];
// 动作定义 // 动作定义
actions: RendererAction[] = [ actions: RendererPluginAction[] = [
{ {
actionType: 'clear', actionType: 'clear',
actionLabel: '清空', actionLabel: '清空',

View File

@ -12,9 +12,9 @@ import {
} from 'amis-editor-core'; } from 'amis-editor-core';
import {formItemControl} from '../../component/BaseControl'; import {formItemControl} from '../../component/BaseControl';
import { import {
RendererAction, RendererPluginAction,
RendererEvent RendererPluginEvent
} from 'amis-editor-comp/dist/renderers/event-action'; } from 'amis-editor-core';
export class ExcelControlPlugin extends BasePlugin { export class ExcelControlPlugin extends BasePlugin {
// 关联渲染器名字 // 关联渲染器名字
@ -49,7 +49,7 @@ export class ExcelControlPlugin extends BasePlugin {
notRenderFormZone = true; notRenderFormZone = true;
// 事件定义 // 事件定义
events: RendererEvent[] = [ events: RendererPluginEvent[] = [
{ {
eventName: 'change', eventName: 'change',
eventLabel: '值变化', eventLabel: '值变化',
@ -69,7 +69,7 @@ export class ExcelControlPlugin extends BasePlugin {
]; ];
// 动作定义 // 动作定义
actions: RendererAction[] = [ actions: RendererPluginAction[] = [
{ {
actionType: 'clear', actionType: 'clear',
actionLabel: '清空', actionLabel: '清空',

View File

@ -5,9 +5,9 @@ import {tipedLabel} from '../../component/BaseControl';
import {ValidatorTag} from '../../validator'; import {ValidatorTag} from '../../validator';
import {getEventControlConfig} from '../../util'; import {getEventControlConfig} from '../../util';
import { import {
RendererAction, RendererPluginAction,
RendererEvent RendererPluginEvent
} from 'amis-editor-comp/dist/renderers/event-action'; } from 'amis-editor-core';
export class FileControlPlugin extends BasePlugin { export class FileControlPlugin extends BasePlugin {
// 关联渲染器名字 // 关联渲染器名字
@ -41,7 +41,7 @@ export class FileControlPlugin extends BasePlugin {
notRenderFormZone = true; notRenderFormZone = true;
// 事件定义 // 事件定义
events: RendererEvent[] = [ events: RendererPluginEvent[] = [
{ {
eventName: 'change', eventName: 'change',
eventLabel: '值变化', eventLabel: '值变化',
@ -113,7 +113,7 @@ export class FileControlPlugin extends BasePlugin {
]; ];
// 动作定义 // 动作定义
actions: RendererAction[] = [ actions: RendererPluginAction[] = [
{ {
actionType: 'clear', actionType: 'clear',
actionLabel: '清空数据', actionLabel: '清空数据',

View File

@ -3,9 +3,9 @@ import {registerEditorPlugin} from 'amis-editor-core';
import {BasePlugin, BaseEventContext} from 'amis-editor-core'; import {BasePlugin, BaseEventContext} from 'amis-editor-core';
import {formItemControl} from '../../component/BaseControl'; import {formItemControl} from '../../component/BaseControl';
import { import {
RendererAction, RendererPluginAction,
RendererEvent RendererPluginEvent
} from 'amis-editor-comp/dist/renderers/event-action'; } from 'amis-editor-core';
export class ImageControlPlugin extends BasePlugin { export class ImageControlPlugin extends BasePlugin {
// 关联渲染器名字 // 关联渲染器名字
rendererName = 'input-image'; rendererName = 'input-image';
@ -38,7 +38,7 @@ export class ImageControlPlugin extends BasePlugin {
notRenderFormZone = true; notRenderFormZone = true;
// 事件定义 // 事件定义
events: RendererEvent[] = [ events: RendererPluginEvent[] = [
{ {
eventName: 'change', eventName: 'change',
eventLabel: '值变化', eventLabel: '值变化',
@ -62,7 +62,7 @@ export class ImageControlPlugin extends BasePlugin {
]; ];
// 动作定义 // 动作定义
actions: RendererAction[] = [ actions: RendererPluginAction[] = [
{ {
actionType: 'clear', actionType: 'clear',
actionLabel: '清空数据', actionLabel: '清空数据',

View File

@ -2,9 +2,9 @@
* @file input-kv * @file input-kv
*/ */
import { import {
RendererAction, RendererPluginAction,
RendererEvent RendererPluginEvent
} from 'amis-editor-comp/dist/renderers/event-action'; } from 'amis-editor-core';
import {defaultValue, getSchemaTpl, valuePipeOut} from 'amis-editor-core'; import {defaultValue, getSchemaTpl, valuePipeOut} from 'amis-editor-core';
import {registerEditorPlugin} from 'amis-editor-core'; import {registerEditorPlugin} from 'amis-editor-core';
import { import {
@ -44,7 +44,7 @@ export class KVControlPlugin extends BasePlugin {
}; };
// 事件定义 // 事件定义
events: RendererEvent[] = [ events: RendererPluginEvent[] = [
{ {
eventName: 'add', eventName: 'add',
eventLabel: '添加', eventLabel: '添加',
@ -84,7 +84,7 @@ export class KVControlPlugin extends BasePlugin {
]; ];
// 动作定义 // 动作定义
actions: RendererAction[] = [ actions: RendererPluginAction[] = [
{ {
actionType: 'clear', actionType: 'clear',
actionLabel: '清空', actionLabel: '清空',

View File

@ -1,7 +1,7 @@
import { import {
RendererAction, RendererPluginAction,
RendererEvent RendererPluginEvent
} from 'amis-editor-comp/dist/renderers/event-action'; } from 'amis-editor-core';
import flatten from 'lodash/flatten'; import flatten from 'lodash/flatten';
import {ContainerWrapper} from 'amis-editor-core'; import {ContainerWrapper} from 'amis-editor-core';
import {registerEditorPlugin} from 'amis-editor-core'; import {registerEditorPlugin} from 'amis-editor-core';
@ -56,7 +56,7 @@ export class NumberControlPlugin extends BasePlugin {
panelJustify = true; panelJustify = true;
// 事件定义 // 事件定义
events: RendererEvent[] = [ events: RendererPluginEvent[] = [
{ {
eventName: 'change', eventName: 'change',
eventLabel: '值变化', eventLabel: '值变化',
@ -108,7 +108,7 @@ export class NumberControlPlugin extends BasePlugin {
]; ];
// 动作定义 // 动作定义
actions: RendererAction[] = [ actions: RendererPluginAction[] = [
{ {
actionType: 'clear', actionType: 'clear',
actionLabel: '清空', actionLabel: '清空',

View File

@ -1,7 +1,7 @@
import { import {
RendererAction, RendererPluginAction,
RendererEvent RendererPluginEvent
} from 'amis-editor-comp/dist/renderers/event-action'; } from 'amis-editor-core';
import {defaultValue, getSchemaTpl} from 'amis-editor-core'; import {defaultValue, getSchemaTpl} from 'amis-editor-core';
import {registerEditorPlugin} from 'amis-editor-core'; import {registerEditorPlugin} from 'amis-editor-core';
import {BasePlugin, BaseEventContext} from 'amis-editor-core'; import {BasePlugin, BaseEventContext} from 'amis-editor-core';
@ -40,7 +40,7 @@ export class RangeControlPlugin extends BasePlugin {
notRenderFormZone = true; notRenderFormZone = true;
// 事件定义 // 事件定义
events: RendererEvent[] = [ events: RendererPluginEvent[] = [
{ {
eventName: 'change', eventName: 'change',
eventLabel: '值变化', eventLabel: '值变化',
@ -92,7 +92,7 @@ export class RangeControlPlugin extends BasePlugin {
]; ];
// 动作定义 // 动作定义
actions: RendererAction[] = [ actions: RendererPluginAction[] = [
{ {
actionType: 'clear', actionType: 'clear',
actionLabel: '清空', actionLabel: '清空',

View File

@ -10,9 +10,9 @@ import {tipedLabel} from '../../component/BaseControl';
import {ValidatorTag} from '../../validator'; import {ValidatorTag} from '../../validator';
import {getEventControlConfig} from '../../util'; import {getEventControlConfig} from '../../util';
import { import {
RendererAction, RendererPluginAction,
RendererEvent RendererPluginEvent
} from 'amis-editor-comp/dist/renderers/event-action'; } from 'amis-editor-core';
export class RateControlPlugin extends BasePlugin { export class RateControlPlugin extends BasePlugin {
// 关联渲染器名字 // 关联渲染器名字
@ -50,7 +50,7 @@ export class RateControlPlugin extends BasePlugin {
count = 5; count = 5;
// 事件定义 // 事件定义
events: RendererEvent[] = [ events: RendererPluginEvent[] = [
{ {
eventName: 'change', eventName: 'change',
eventLabel: '值变化', eventLabel: '值变化',
@ -70,7 +70,7 @@ export class RateControlPlugin extends BasePlugin {
]; ];
// 动作定义 // 动作定义
actions: RendererAction[] = [ actions: RendererPluginAction[] = [
{ {
actionType: 'clear', actionType: 'clear',
actionLabel: '清空', actionLabel: '清空',

View File

@ -10,9 +10,9 @@ import {
import {formItemControl} from '../../component/BaseControl'; import {formItemControl} from '../../component/BaseControl';
import { import {
RendererAction, RendererPluginAction,
RendererEvent RendererPluginEvent
} from 'amis-editor-comp/dist/renderers/event-action'; } from 'amis-editor-core';
export class TagControlPlugin extends BasePlugin { export class TagControlPlugin extends BasePlugin {
// 关联渲染器名字 // 关联渲染器名字
@ -50,7 +50,7 @@ export class TagControlPlugin extends BasePlugin {
panelTitle = '标签'; panelTitle = '标签';
// 事件定义 // 事件定义
events: RendererEvent[] = [ events: RendererPluginEvent[] = [
{ {
eventName: 'change', eventName: 'change',
eventLabel: '值变化', eventLabel: '值变化',
@ -102,7 +102,7 @@ export class TagControlPlugin extends BasePlugin {
]; ];
// 动作定义 // 动作定义
actions: RendererAction[] = [ actions: RendererPluginAction[] = [
{ {
actionType: 'clear', actionType: 'clear',
actionLabel: '清空', actionLabel: '清空',

View File

@ -1,8 +1,8 @@
import React from 'react'; import React from 'react';
import { import {
RendererAction, RendererPluginAction,
RendererEvent RendererPluginEvent
} from 'amis-editor-comp/dist/renderers/event-action'; } from 'amis-editor-core';
import {defaultValue, getSchemaTpl} from 'amis-editor-core'; import {defaultValue, getSchemaTpl} from 'amis-editor-core';
import {registerEditorPlugin} from 'amis-editor-core'; import {registerEditorPlugin} from 'amis-editor-core';
import {BaseEventContext, BasePlugin} from 'amis-editor-core'; import {BaseEventContext, BasePlugin} from 'amis-editor-core';
@ -62,7 +62,7 @@ export class TreeControlPlugin extends BasePlugin {
panelTitle = '树选择'; panelTitle = '树选择';
// 事件定义 // 事件定义
events: RendererEvent[] = [ events: RendererPluginEvent[] = [
{ {
eventName: 'change', eventName: 'change',
eventLabel: '值变化', eventLabel: '值变化',
@ -158,7 +158,7 @@ export class TreeControlPlugin extends BasePlugin {
]; ];
// 动作定义 // 动作定义
actions: RendererAction[] = [ actions: RendererPluginAction[] = [
{ {
actionType: 'expand', actionType: 'expand',
actionLabel: '展开', actionLabel: '展开',

View File

@ -4,9 +4,9 @@ import {BasePlugin, BaseEventContext} from 'amis-editor-core';
import {formItemControl} from '../../component/BaseControl'; import {formItemControl} from '../../component/BaseControl';
import { import {
RendererAction, RendererPluginAction,
RendererEvent RendererPluginEvent
} from 'amis-editor-comp/dist/renderers/event-action'; } from 'amis-editor-core';
export class ListControlPlugin extends BasePlugin { export class ListControlPlugin extends BasePlugin {
// 关联渲染器名字 // 关联渲染器名字
@ -56,7 +56,7 @@ export class ListControlPlugin extends BasePlugin {
panelTitle = '列表选择'; panelTitle = '列表选择';
// 事件定义 // 事件定义
events: RendererEvent[] = [ events: RendererPluginEvent[] = [
{ {
eventName: 'change', eventName: 'change',
eventLabel: '值变化', eventLabel: '值变化',
@ -76,7 +76,7 @@ export class ListControlPlugin extends BasePlugin {
]; ];
// 动作定义 // 动作定义
actions: RendererAction[] = [ actions: RendererPluginAction[] = [
{ {
actionType: 'clear', actionType: 'clear',
actionLabel: '清空', actionLabel: '清空',

View File

@ -11,9 +11,9 @@ import {tipedLabel} from '../../component/BaseControl';
import {ValidatorTag} from '../../validator'; import {ValidatorTag} from '../../validator';
import {getEventControlConfig} from '../../util'; import {getEventControlConfig} from '../../util';
import { import {
RendererAction, RendererPluginAction,
RendererEvent RendererPluginEvent
} from 'amis-editor-comp/dist/renderers/event-action'; } from 'amis-editor-core';
export class MatrixControlPlugin extends BasePlugin { export class MatrixControlPlugin extends BasePlugin {
// 关联渲染器名字 // 关联渲染器名字
@ -66,7 +66,7 @@ export class MatrixControlPlugin extends BasePlugin {
panelTitle = '矩阵开关'; panelTitle = '矩阵开关';
panelJustify = true; panelJustify = true;
// 事件定义 // 事件定义
events: RendererEvent[] = [ events: RendererPluginEvent[] = [
{ {
eventName: 'change', eventName: 'change',
eventLabel: '值变化', eventLabel: '值变化',
@ -86,7 +86,7 @@ export class MatrixControlPlugin extends BasePlugin {
]; ];
// 动作定义 // 动作定义
actions: RendererAction[] = [ actions: RendererPluginAction[] = [
{ {
actionType: 'clear', actionType: 'clear',
actionLabel: '清空', actionLabel: '清空',

View File

@ -1,8 +1,8 @@
import {relativeValueRe} from 'amis'; import {relativeValueRe} from 'amis';
import { import {
RendererAction, RendererPluginAction,
RendererEvent RendererPluginEvent
} from 'amis-editor-comp/dist/renderers/event-action'; } from 'amis-editor-core';
import {availableLanguages} from 'amis/lib/renderers/Form/Editor'; import {availableLanguages} from 'amis/lib/renderers/Form/Editor';
import {defaultValue, getSchemaTpl, valuePipeOut} from 'amis-editor-core'; import {defaultValue, getSchemaTpl, valuePipeOut} from 'amis-editor-core';
import {registerEditorPlugin} from 'amis-editor-core'; import {registerEditorPlugin} from 'amis-editor-core';
@ -113,7 +113,7 @@ export class NestedSelectControlPlugin extends BasePlugin {
}; };
panelJustify = true; panelJustify = true;
// 事件定义 // 事件定义
events: RendererEvent[] = [ events: RendererPluginEvent[] = [
{ {
eventName: 'change', eventName: 'change',
eventLabel: '值变化', eventLabel: '值变化',
@ -165,7 +165,7 @@ export class NestedSelectControlPlugin extends BasePlugin {
]; ];
// 动作定义 // 动作定义
actions: RendererAction[] = [ actions: RendererPluginAction[] = [
{ {
actionType: 'clear', actionType: 'clear',
actionLabel: '清空', actionLabel: '清空',

View File

@ -5,9 +5,9 @@ import {BasePlugin, BaseEventContext} from 'amis-editor-core';
import {ValidatorTag} from '../../validator'; import {ValidatorTag} from '../../validator';
import {getEventControlConfig} from '../../util'; import {getEventControlConfig} from '../../util';
import { import {
RendererAction, RendererPluginAction,
RendererEvent RendererPluginEvent
} from 'amis-editor-comp/dist/renderers/event-action'; } from 'amis-editor-core';
export class RadiosControlPlugin extends BasePlugin { export class RadiosControlPlugin extends BasePlugin {
// 关联渲染器名字 // 关联渲染器名字
@ -57,7 +57,7 @@ export class RadiosControlPlugin extends BasePlugin {
panelTitle = '单选框'; panelTitle = '单选框';
// 事件定义 // 事件定义
events: RendererEvent[] = [ events: RendererPluginEvent[] = [
{ {
eventName: 'change', eventName: 'change',
eventLabel: '值变化', eventLabel: '值变化',
@ -77,7 +77,7 @@ export class RadiosControlPlugin extends BasePlugin {
]; ];
// 动作定义 // 动作定义
actions: RendererAction[] = [ actions: RendererPluginAction[] = [
{ {
actionType: 'clear', actionType: 'clear',
actionLabel: '清空', actionLabel: '清空',

View File

@ -7,9 +7,9 @@ import {tipedLabel} from '../../component/BaseControl';
import {ValidatorTag} from '../../validator'; import {ValidatorTag} from '../../validator';
import {getEventControlConfig} from '../../util'; import {getEventControlConfig} from '../../util';
import { import {
RendererAction, RendererPluginAction,
RendererEvent RendererPluginEvent
} from 'amis-editor-comp/dist/renderers/event-action'; } from 'amis-editor-core';
export class SelectControlPlugin extends BasePlugin { export class SelectControlPlugin extends BasePlugin {
// 关联渲染器名字 // 关联渲染器名字
@ -58,7 +58,7 @@ export class SelectControlPlugin extends BasePlugin {
panelTitle = '下拉框'; panelTitle = '下拉框';
// 事件定义 // 事件定义
events: RendererEvent[] = [ events: RendererPluginEvent[] = [
{ {
eventName: 'change', eventName: 'change',
eventLabel: '值变化', eventLabel: '值变化',
@ -170,7 +170,7 @@ export class SelectControlPlugin extends BasePlugin {
]; ];
// 动作定义 // 动作定义
actions: RendererAction[] = [ actions: RendererPluginAction[] = [
{ {
actionType: 'clear', actionType: 'clear',
actionLabel: '清空', actionLabel: '清空',

View File

@ -5,9 +5,9 @@ import {tipedLabel} from '../../component/BaseControl';
import {ValidatorTag} from '../../validator'; import {ValidatorTag} from '../../validator';
import {getEventControlConfig} from '../../util'; import {getEventControlConfig} from '../../util';
import type { import type {
RendererAction, RendererPluginAction,
RendererEvent RendererPluginEvent
} from 'amis-editor-comp/dist/renderers/event-action'; } from 'amis-editor-core';
export class SwitchControlPlugin extends BasePlugin { export class SwitchControlPlugin extends BasePlugin {
// 关联渲染器名字 // 关联渲染器名字
@ -47,7 +47,7 @@ export class SwitchControlPlugin extends BasePlugin {
panelTitle = '开关'; panelTitle = '开关';
events: RendererEvent[] = [ events: RendererPluginEvent[] = [
{ {
eventName: 'change', eventName: 'change',
eventLabel: '值变化', eventLabel: '值变化',
@ -67,7 +67,7 @@ export class SwitchControlPlugin extends BasePlugin {
]; ];
// 动作定义 // 动作定义
actions: RendererAction[] = [ actions: RendererPluginAction[] = [
{ {
actionType: 'setValue', actionType: 'setValue',
actionLabel: '赋值', actionLabel: '赋值',

View File

@ -4,9 +4,9 @@ import {registerEditorPlugin} from 'amis-editor-core';
import {BasePlugin, BaseEventContext} from 'amis-editor-core'; import {BasePlugin, BaseEventContext} from 'amis-editor-core';
import { import {
RendererAction, RendererPluginAction,
RendererEvent RendererPluginEvent
} from 'amis-editor-comp/dist/renderers/event-action'; } from 'amis-editor-core';
import {getEventControlConfig} from '../../util'; import {getEventControlConfig} from '../../util';
export class TabsTransferPlugin extends BasePlugin { export class TabsTransferPlugin extends BasePlugin {
@ -134,7 +134,7 @@ export class TabsTransferPlugin extends BasePlugin {
panelTitle = '组合穿梭器'; panelTitle = '组合穿梭器';
events: RendererEvent[] = [ events: RendererPluginEvent[] = [
{ {
eventName: 'change', eventName: 'change',
eventLabel: '值变化', eventLabel: '值变化',
@ -186,7 +186,7 @@ export class TabsTransferPlugin extends BasePlugin {
]; ];
// 动作定义 // 动作定义
actions: RendererAction[] = [ actions: RendererPluginAction[] = [
{ {
actionType: 'clear', actionType: 'clear',
actionLabel: '清空', actionLabel: '清空',

View File

@ -7,9 +7,9 @@ import {tipedLabel} from '../../component/BaseControl';
import {ValidatorTag} from '../../validator'; import {ValidatorTag} from '../../validator';
import {getEventControlConfig} from '../../util'; import {getEventControlConfig} from '../../util';
import { import {
RendererAction, RendererPluginAction,
RendererEvent RendererPluginEvent
} from 'amis-editor-comp/dist/renderers/event-action'; } from 'amis-editor-core';
export class TextareaControlPlugin extends BasePlugin { export class TextareaControlPlugin extends BasePlugin {
// 关联渲染器名字 // 关联渲染器名字
@ -43,7 +43,7 @@ export class TextareaControlPlugin extends BasePlugin {
panelTitle = '多行文本'; panelTitle = '多行文本';
events: RendererEvent[] = [ events: RendererPluginEvent[] = [
{ {
eventName: 'change', eventName: 'change',
eventLabel: '值变化', eventLabel: '值变化',
@ -94,7 +94,7 @@ export class TextareaControlPlugin extends BasePlugin {
} }
]; ];
actions: RendererAction[] = [ actions: RendererPluginAction[] = [
{ {
actionType: 'clear', actionType: 'clear',
actionLabel: '清空', actionLabel: '清空',

View File

@ -3,9 +3,9 @@ import {registerEditorPlugin} from 'amis-editor-core';
import {BasePlugin, BaseEventContext} from 'amis-editor-core'; import {BasePlugin, BaseEventContext} from 'amis-editor-core';
import {getEventControlConfig} from '../../util'; import {getEventControlConfig} from '../../util';
import { import {
RendererAction, RendererPluginAction,
RendererEvent RendererPluginEvent
} from 'amis-editor-comp/dist/renderers/event-action'; } from 'amis-editor-core';
export class TransferPlugin extends BasePlugin { export class TransferPlugin extends BasePlugin {
// 关联渲染器名字 // 关联渲染器名字
@ -79,7 +79,7 @@ export class TransferPlugin extends BasePlugin {
panelTitle = '穿梭器'; panelTitle = '穿梭器';
events: RendererEvent[] = [ events: RendererPluginEvent[] = [
{ {
eventName: 'change', eventName: 'change',
eventLabel: '值变化', eventLabel: '值变化',
@ -115,7 +115,7 @@ export class TransferPlugin extends BasePlugin {
]; ];
// 动作定义 // 动作定义
actions: RendererAction[] = [ actions: RendererPluginAction[] = [
{ {
actionType: 'clear', actionType: 'clear',
actionLabel: '清空', actionLabel: '清空',

View File

@ -1,7 +1,7 @@
import { import {
RendererAction, RendererPluginAction,
RendererEvent RendererPluginEvent
} from 'amis-editor-comp/dist/renderers/event-action'; } from 'amis-editor-core';
import {defaultValue, getSchemaTpl} from 'amis-editor-core'; import {defaultValue, getSchemaTpl} from 'amis-editor-core';
import {registerEditorPlugin} from 'amis-editor-core'; import {registerEditorPlugin} from 'amis-editor-core';
import {BaseEventContext, BasePlugin} from 'amis-editor-core'; import {BaseEventContext, BasePlugin} from 'amis-editor-core';
@ -60,7 +60,7 @@ export class TreeSelectControlPlugin extends BasePlugin {
panelTitle = '树下拉'; panelTitle = '树下拉';
// 事件定义 // 事件定义
events: RendererEvent[] = [ events: RendererPluginEvent[] = [
{ {
eventName: 'change', eventName: 'change',
eventLabel: '值变化', eventLabel: '值变化',
@ -188,7 +188,7 @@ export class TreeSelectControlPlugin extends BasePlugin {
]; ];
// 动作定义 // 动作定义
actions: RendererAction[] = [ actions: RendererPluginAction[] = [
{ {
actionType: 'clear', actionType: 'clear',
actionLabel: '清空', actionLabel: '清空',

View File

@ -5,9 +5,9 @@ import {tipedLabel} from '../component/BaseControl';
import {ValidatorTag} from '../validator'; import {ValidatorTag} from '../validator';
import {getEventControlConfig} from '../util'; import {getEventControlConfig} from '../util';
import { import {
RendererAction, RendererPluginAction,
RendererEvent RendererPluginEvent
} from 'amis-editor-comp/dist/renderers/event-action'; } from 'amis-editor-core';
export class LinkPlugin extends BasePlugin { export class LinkPlugin extends BasePlugin {
// 关联渲染器名字 // 关联渲染器名字

View File

@ -4,9 +4,9 @@ import {BaseEventContext, BasePlugin} from 'amis-editor-core';
import {getSchemaTpl} from 'amis-editor-core'; import {getSchemaTpl} from 'amis-editor-core';
import {getEventControlConfig} from '../util'; import {getEventControlConfig} from '../util';
import { import {
RendererAction, RendererPluginAction,
RendererEvent RendererPluginEvent
} from 'amis-editor-comp/dist/renderers/event-action'; } from 'amis-editor-core';
import type {SchemaObject} from 'amis/lib/Schema'; import type {SchemaObject} from 'amis/lib/Schema';
export class PagePlugin extends BasePlugin { export class PagePlugin extends BasePlugin {
@ -42,7 +42,7 @@ export class PagePlugin extends BasePlugin {
body: '内容' body: '内容'
}; };
events: RendererEvent[] = [ events: RendererPluginEvent[] = [
{ {
eventName: 'inited', eventName: 'inited',
eventLabel: '初始化完成', eventLabel: '初始化完成',
@ -67,7 +67,7 @@ export class PagePlugin extends BasePlugin {
]; ];
// 动作定义 // 动作定义
actions: RendererAction[] = [ actions: RendererPluginAction[] = [
{ {
actionType: 'reload', actionType: 'reload',
actionLabel: '重新加载', actionLabel: '重新加载',

View File

@ -3,7 +3,7 @@ import {BasePlugin, RegionConfig, BaseEventContext} from 'amis-editor-core';
import {tipedLabel} from '../component/BaseControl'; import {tipedLabel} from '../component/BaseControl';
import {ValidatorTag} from '../validator'; import {ValidatorTag} from '../validator';
import {getEventControlConfig} from '../util'; 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'; import {defaultValue, getSchemaTpl} from 'amis-editor-core';
@ -45,7 +45,7 @@ export class PaginationPlugin extends BasePlugin {
panelTitle = '分页器'; panelTitle = '分页器';
// 事件定义 // 事件定义
events: RendererEvent[] = [ events: RendererPluginEvent[] = [
{ {
eventName: 'pageChange', eventName: 'pageChange',
eventLabel: '分页改变', eventLabel: '分页改变',

View File

@ -6,9 +6,9 @@ import {getSchemaTpl} from 'amis-editor-core';
import {getEventControlConfig} from '../util'; import {getEventControlConfig} from '../util';
import type { import type {
RendererAction, RendererPluginAction,
RendererEvent RendererPluginEvent
} from 'amis-editor-comp/dist/renderers/event-action'; } from 'amis-editor-core';
export class ServicePlugin extends BasePlugin { export class ServicePlugin extends BasePlugin {
// 关联渲染器名字 // 关联渲染器名字
@ -45,7 +45,7 @@ export class ServicePlugin extends BasePlugin {
} }
]; ];
events: RendererEvent[] = [ events: RendererPluginEvent[] = [
{ {
eventName: 'fetchInited', eventName: 'fetchInited',
eventLabel: 'api 初始化数据', eventLabel: 'api 初始化数据',
@ -58,7 +58,7 @@ export class ServicePlugin extends BasePlugin {
} }
]; ];
actions: RendererAction[] = [ actions: RendererPluginAction[] = [
{ {
actionType: 'reload', actionType: 'reload',
actionLabel: '重新加载', actionLabel: '重新加载',

View File

@ -1,8 +1,8 @@
import {resolveVariable} from 'amis'; import {resolveVariable} from 'amis';
import { import {
RendererAction, RendererPluginAction,
RendererEvent RendererPluginEvent
} from 'amis-editor-comp/dist/renderers/event-action'; } from 'amis-editor-core';
import {setVariable} from 'amis-core'; import {setVariable} from 'amis-core';
import {registerEditorPlugin, repeatArray} from 'amis-editor-core'; import {registerEditorPlugin, repeatArray} from 'amis-editor-core';
@ -156,7 +156,7 @@ export class TablePlugin extends BasePlugin {
panelTitle = '表格'; panelTitle = '表格';
events: RendererEvent[] = [ events: RendererPluginEvent[] = [
{ {
eventName: 'selectedChange', eventName: 'selectedChange',
eventLabel: '选择表格项', eventLabel: '选择表格项',
@ -287,7 +287,7 @@ export class TablePlugin extends BasePlugin {
} }
]; ];
actions: RendererAction[] = [ actions: RendererPluginAction[] = [
{ {
actionType: 'select', actionType: 'select',
actionLabel: '设置选中项', actionLabel: '设置选中项',

View File

@ -13,9 +13,9 @@ import {mapReactElement} from 'amis-editor-core';
import {RegionWrapper as Region} from 'amis-editor-core'; import {RegionWrapper as Region} from 'amis-editor-core';
import { import {
RendererAction, RendererPluginAction,
RendererEvent RendererPluginEvent
} from 'amis-editor-comp/dist/renderers/event-action'; } from 'amis-editor-core';
import {getEventControlConfig} from '../util'; import {getEventControlConfig} from '../util';
import {getComboWrapper} from '../event-action/schema'; import {getComboWrapper} from '../event-action/schema';
@ -82,7 +82,7 @@ export class WizardPlugin extends BasePlugin {
}; };
// 事件定义 // 事件定义
events: RendererEvent[] = [ events: RendererPluginEvent[] = [
{ {
eventName: 'inited', eventName: 'inited',
eventLabel: '初始化完成', eventLabel: '初始化完成',
@ -203,7 +203,7 @@ export class WizardPlugin extends BasePlugin {
]; ];
// 动作定义 // 动作定义
actions: RendererAction[] = [ actions: RendererPluginAction[] = [
{ {
actionType: 'submit', actionType: 'submit',
actionLabel: '全部提交', actionLabel: '全部提交',

View File

@ -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<RendererProps> {
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 ? (
<></>
) : (
<div
className={cx('ae-event-control-action-placeholder', {
'no-settings': actionType
})}
>
<div className="ae-event-control-action-placeholder-img" />
<span>{actionType ? '无配置内容' : '请选择执行动作'}</span>
</div>
);
}
}

View File

@ -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<RendererProps> {
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 (
<Select
value={formStore.data.__cmptActionType}
className="cmpt-action-select"
options={actions.map((item: any) => ({
label: item.actionLabel,
value: item.actionType,
description: item.description
}))}
onChange={this.onChange.bind(this)}
clearable={false}
/>
);
}
}

View File

@ -0,0 +1,699 @@
/**
* @file
*/
import React from 'react';
import {RendererPluginAction} from 'amis-editor-core';
const MSG_TYPES: {[key: string]: string} = {
info: '提示',
warning: '警告',
success: '成功',
error: '错误'
};
// 数据容器范围
export const DATA_CONTAINER = [
'form',
'dialog',
'drawer',
'wizard',
'service',
'page',
'app',
'chart'
];
// 是否数据容器
export const IS_DATA_CONTAINER = `${JSON.stringify(
DATA_CONTAINER
)}.includes(__rendererName)`;
export function defaultValue(defaultValue: any, strictMode: boolean = true) {
return strictMode
? (value: any) => (typeof value === 'undefined' ? defaultValue : value)
: (value: any) => value || defaultValue;
}
export const getComboWrapper = (items: any, multiple: boolean = false) => ({
type: 'combo',
name: 'args',
// label: '动作参数',
multiple,
strictMode: false,
items: Array.isArray(items) ? items : [items]
});
// 表单项组件
export const FORMITEM_CMPTS = [
'button-group-select',
'button-toolbar',
'chained-select',
'chart-radios',
'checkbox',
'checkboxes',
'combo',
'input-kv',
'condition-builder',
'diff-editor',
'editor',
'formula',
'hidden',
'icon-picker',
'input-array',
'input-city',
'input-color',
'input-date',
'input-date-range',
'input-datetime-range',
'input-time-range',
'input-excel',
'input-file',
'input-formula',
'input-group',
'input-image',
'input-month-range',
'input-number',
'input-quarter-range',
'input-range',
'input-rating',
'input-repeat',
'input-rich-text',
'input-sub-form',
'input-table',
'input-tag',
'input-text',
'input-password',
'input-email',
'input-url',
'native-date',
'native-time',
'native-number',
'input-tree',
'input-year-range',
'list-select',
'location-picker',
'matrix-checkboxes',
'nested-select',
'cascader-select',
'picker',
'radios',
'select',
'multi-select',
'switch',
'tabs-transfer',
'tabs-transfer-picker',
'textarea',
'transfer',
'transfer-picker',
'tree-select',
'uuid'
];
// 动作配置项schema map
export const COMMON_ACTION_SCHEMA_MAP: {[propName: string]: RendererPluginAction} = {
url: {
config: ['url', 'params', 'blank'],
desc: (info: any) => {
return (
<div>
<span className="variable-left">{info?.args?.url}</span>
</div>
);
},
schema: getComboWrapper([
{
type: 'wrapper',
className: 'p-none',
body: [
{
label: '页面地址',
type: 'input-formula',
variables: '${variables}',
evalMode: false,
variableMode: 'tabs',
inputMode: 'input-group',
name: 'url',
placeholder: 'http://',
mode: 'horizontal',
size: 'lg',
required: true
},
{
type: 'combo',
name: 'params',
label: '页面参数',
multiple: true,
mode: 'horizontal',
items: [
{
name: 'key',
placeholder: '参数名',
type: 'input-text',
mode: 'inline',
size: 'xs'
},
{
name: 'val',
placeholder: '参数值',
type: 'input-formula',
variables: '${variables}',
evalMode: false,
variableMode: 'tabs',
inputMode: 'input-group',
size: 'xs'
}
]
},
{
type: 'switch',
name: 'blank',
label: '新窗口打开',
onText: '是',
offText: '否',
mode: 'horizontal',
pipeIn: defaultValue(true)
}
]
}
])
},
custom: {
schema: {
type: 'js-editor',
allowFullscreen: true,
required: true,
name: 'script',
label: '自定义JS',
mode: 'horizontal',
className: 'ae-event-control-action-js-editor',
value: `/* 自定义JS使用说明
* 1.doAction
* 2.context可以获取当前组件实例context.props可以获取该组件相关属性
* 3.eventdoAction之后执行event.stopPropagation = true;
*/
const myMsg = '我是自定义JS';
doAction({
actionType: 'toast',
args: {
msg: myMsg
}
});
`
}
},
toast: {
config: [
'title',
'msgType',
'msg',
'position',
'timeout',
'closeButton',
'showIcon'
],
desc: (info: any) => {
return (
<div>
<span className="variable-right">
{MSG_TYPES[info?.args?.msgType] || ''}
</span>
<span className="variable-left">{info?.args?.msg}</span>
</div>
);
},
schema: getComboWrapper({
type: 'wrapper',
className: 'p-none',
body: [
{
type: 'button-group-select',
name: 'msgType',
label: '消息类型',
value: 'info',
required: true,
mode: 'horizontal',
options: Object.keys(MSG_TYPES).map(key => ({
label: MSG_TYPES[key],
value: key,
level: 'default'
}))
},
{
name: 'msg',
label: '消息内容',
mode: 'horizontal',
type: 'input-formula',
variables: '${variables}',
evalMode: false,
variableMode: 'tabs',
inputMode: 'input-group',
size: 'lg',
required: true
},
{
name: 'title',
type: 'input-formula',
variables: '${variables}',
evalMode: false,
variableMode: 'tabs',
inputMode: 'input-group',
label: '标题内容',
size: 'lg',
mode: 'horizontal'
},
{
name: 'timeout',
type: 'input-formula',
variables: '${variables}',
evalMode: false,
variableMode: 'tabs',
inputMode: 'input-group',
label: '持续时间(ms)',
size: 'lg',
mode: 'horizontal'
},
{
type: 'button-group-select',
name: 'position',
value: 'top-right',
mode: 'horizontal',
label: '显示位置',
options: [
{
label: '左上',
value: 'top-left'
},
{
label: '中上',
value: 'top-center'
},
{
label: '右上',
value: 'top-right'
},
{
label: '左下',
value: 'bottom-left'
},
{
label: '中下',
value: 'bottom-center'
},
{
label: '右下',
value: 'bottom-right'
}
]
},
{
type: 'switch',
name: 'closeButton',
value: true,
label: '展示关闭按钮',
mode: 'horizontal'
},
{
type: 'switch',
name: 'showIcon',
value: true,
label: '展示图标',
mode: 'horizontal'
}
]
})
},
setValue: {
config: ['value', 'valueInput'],
withComponentId: true,
desc: (info: any) => {
return (
<div>
<span className="variable-left variable-right">
{info?.__rendererLabel}
</span>
<span className="variable-left variable-right">
{info?.args?.value
? JSON.stringify(info?.args?.value)
: info?.args?.valueInput}
</span>
</div>
);
},
schema: getComboWrapper({
type: 'wrapper',
className: 'p-none',
body: [
{
type: 'combo',
name: 'value',
label: '变量赋值',
multiple: true,
removable: true,
required: true,
addable: true,
strictMode: false,
canAccessSuperData: true,
mode: 'horizontal',
items: [
{
name: 'key',
type: 'input-text',
placeholder: '变量名',
required: true
},
{
name: 'val',
type: 'input-formula',
placeholder: '变量值',
variables: '${variables}',
evalMode: false,
variableMode: 'tabs',
inputMode: 'input-group'
}
],
visibleOn: `data.__rendererName && ${IS_DATA_CONTAINER}`
},
{
type: 'combo',
name: 'value',
label: '变量赋值',
multiple: true,
removable: true,
required: true,
addable: true,
strictMode: false,
canAccessSuperData: true,
mode: 'horizontal',
items: [
{
type: 'combo',
name: 'item',
label: false,
renderLabel: false,
multiple: true,
removable: true,
required: true,
addable: true,
strictMode: false,
canAccessSuperData: true,
className: 'm-l',
mode: 'horizontal',
items: [
{
name: 'key',
type: 'input-text',
required: true
},
{
name: 'val',
type: 'input-formula',
variables: '${variables}',
evalMode: false,
variableMode: 'tabs',
inputMode: 'input-group'
}
]
}
],
visibleOn: `data.__rendererName && __rendererName === 'combo'`
},
{
name: 'valueInput',
type: 'input-formula',
variables: '${variables}',
evalMode: false,
variableMode: 'tabs',
inputMode: 'input-group',
label: '变量赋值',
size: 'lg',
mode: 'horizontal',
visibleOn: `data.__rendererName && !${IS_DATA_CONTAINER} && __rendererName !== 'combo'`,
required: true
}
]
})
},
broadcast: {
schema: {
type: 'wrapper',
className: 'p-none',
body: [
{
type: 'input-text',
name: 'eventName',
label: '广播标识',
mode: 'horizontal',
required: true,
description: '广播事件标识派发出去后,其他组件可以进行监听并作出响应'
},
{
type: 'input-text',
label: '广播名称',
name: 'eventLabel',
mode: 'horizontal',
required: true
},
{
type: 'textarea',
label: '描述',
name: 'description',
mode: 'horizontal',
required: true
}
]
}
},
copy: {
config: ['content', 'copyFormat'],
desc: (info: any) => {
return (
<div>
<span className="variable-left">{info?.args?.content}</span>
</div>
);
},
schema: getComboWrapper({
type: 'wrapper',
className: 'p-none',
body: [
{
name: 'content',
type: 'input-formula',
variables: '${variables}',
evalMode: false,
variableMode: 'tabs',
inputMode: 'input-group',
label: '内容模板',
mode: 'horizontal',
size: 'lg',
required: true
},
{
type: 'select',
name: 'copyFormat',
mode: 'horizontal',
value: 'text/plain',
size: 'lg',
options: [
{
label: '纯文本',
value: 'text/plain'
},
{
label: '富文本',
value: 'text/html'
}
],
label: '复制格式'
}
]
})
},
refresh: {
desc: (info: any) => <div></div>
},
goBack: {
desc: (info: any) => <div></div>
},
alert: {
desc: (info: any) => <div></div>
},
confirm: {
desc: (info: any) => <div></div>
},
reload: {
withComponentId: true,
desc: (info: any) => {
return (
<div>
<span className="variable-left variable-right">
{info?.__rendererLabel}
</span>
</div>
);
}
},
show: {
withComponentId: true,
desc: (info: any) => {
return (
<div>
<span className="variable-left variable-right">
{info?.__rendererLabel}
</span>
</div>
);
}
},
hidden: {
withComponentId: true,
desc: (info: any) => {
return (
<div>
<span className="variable-left variable-right">
{info?.__rendererLabel}
</span>
</div>
);
}
},
enabled: {
withComponentId: true,
desc: (info: any) => {
return (
<div>
<span className="variable-left variable-right">
{info?.__rendererLabel}
</span>
</div>
);
}
},
disabled: {
withComponentId: true,
desc: (info: any) => {
return (
<div>
<span className="variable-left variable-right">
{info?.__rendererLabel}
</span>
</div>
);
}
},
clear: {
withComponentId: true,
desc: (info: any) => {
return (
<div>
<span className="variable-right">{info?.__rendererLabel}</span>
</div>
);
}
},
reset: {
withComponentId: true,
desc: (info: any) => {
return (
<div>
<span className="variable-right">{info?.__rendererLabel}</span>
</div>
);
}
},
focus: {
desc: (info: any) => {
return (
<div>
<span className="variable-right">{info?.__rendererLabel}</span>
</div>
);
}
},
prev: {
desc: (info: any) => {
return (
<div>
<span className="variable-right">{info?.__rendererLabel}</span>
{info?.__rendererName === 'carousel' ? '滚动至上一张' : null}
{info?.__rendererName === 'wizard' ? '返回前一步' : null}
</div>
);
}
},
next: {
desc: (info: any) => {
return (
<div>
<span className="variable-right">{info?.__rendererLabel}</span>
{info?.__rendererName === 'carousel' ? '滚动至下一张' : null}
{info?.__rendererName === 'wizard' ? '提交当前步骤数据' : null}
</div>
);
}
},
submit: {
withComponentId: true,
desc: (info: any) => {
return (
<div>
<span className="variable-right">{info?.__rendererLabel}</span>
{info?.__rendererName === 'form' ? '提交' : null}
{info?.__rendererName === 'wizard' ? '提交全部数据' : null}
</div>
);
}
},
validate: {
withComponentId: true,
desc: (info: any) => {
return (
<div>
<span className="variable-right">{info?.__rendererLabel}</span>
</div>
);
}
},
collapse: {
desc: (info: any) => {
return (
<div>
<span className="variable-right">{info?.__rendererLabel}</span>
</div>
);
}
},
selectAll: {
desc: (info: any) => {
return (
<div>
<span className="variable-right">{info?.__rendererLabel}</span>
</div>
);
}
}
};

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,32 @@
import {ListenerAction} from 'amis-core';
import {RendererPluginAction} from 'amis-editor-core';
export interface ActionConfig extends ListenerAction {
[propName: string]: any;
}
export interface ActionEventConfig {
[propName: string]: {
weight?: number; // 权重
actions: ActionConfig[]; // 执行的动作集
__isBroadcast?: boolean; // 区分一下广播事件
};
}
// 组件树结构
export interface ComponentInfo {
label: string;
value: string;
type: string;
disabled?: boolean;
actions?: RendererPluginAction[]; // 动作集
children?: ComponentInfo[];
}
export interface ContextVariables {
// 上下文公式变量
label: string;
value?: any;
tag?: string | string[];
children?: any[];
}