mirror of
https://gitee.com/baidu/amis.git
synced 2024-12-02 03:58:07 +08:00
feat:迁移事件面板组件
Change-Id: Ibc8d894fc321ed6d792da39df5552404e4271f62
This commit is contained in:
parent
0799c70b52
commit
926ebf327a
@ -24,7 +24,6 @@
|
||||
]
|
||||
},
|
||||
"dependencies": {
|
||||
"amis-editor-comp": "*",
|
||||
"amis-editor-core": "*",
|
||||
"lodash": "^4.17.15",
|
||||
"@webcomponents/webcomponentsjs": "^2.6.0"
|
||||
|
@ -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',
|
||||
|
@ -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'],
|
||||
|
@ -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';
|
||||
|
||||
|
@ -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;
|
||||
|
||||
|
@ -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: '重新加载',
|
||||
|
@ -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: '清空',
|
||||
|
@ -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: '清空',
|
||||
|
@ -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: '清空',
|
||||
|
@ -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: '清空',
|
||||
|
@ -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: '清空',
|
||||
|
@ -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: '清空',
|
||||
|
@ -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: '清空',
|
||||
|
@ -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',
|
||||
|
@ -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: '清空',
|
||||
|
@ -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: '清空',
|
||||
|
@ -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: '清空',
|
||||
|
@ -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: '清空',
|
||||
|
@ -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: '清空数据',
|
||||
|
@ -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: '清空数据',
|
||||
|
@ -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: '清空',
|
||||
|
@ -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: '清空',
|
||||
|
@ -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: '清空',
|
||||
|
@ -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: '清空',
|
||||
|
@ -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: '清空',
|
||||
|
@ -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: '展开',
|
||||
|
@ -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: '清空',
|
||||
|
@ -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: '清空',
|
||||
|
@ -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: '清空',
|
||||
|
@ -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: '清空',
|
||||
|
@ -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: '清空',
|
||||
|
@ -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: '赋值',
|
||||
|
@ -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: '清空',
|
||||
|
@ -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: '清空',
|
||||
|
@ -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: '清空',
|
||||
|
@ -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: '清空',
|
||||
|
@ -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 {
|
||||
// 关联渲染器名字
|
||||
|
@ -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: '重新加载',
|
||||
|
@ -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: '分页改变',
|
||||
|
@ -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: '重新加载',
|
||||
|
@ -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: '设置选中项',
|
||||
|
@ -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: '全部提交',
|
||||
|
@ -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>
|
||||
);
|
||||
}
|
||||
}
|
@ -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}
|
||||
/>
|
||||
);
|
||||
}
|
||||
}
|
699
packages/amis-editor/src/renderer/event-control/helper.tsx
Normal file
699
packages/amis-editor/src/renderer/event-control/helper.tsx
Normal 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.事件对象event,在doAction之后执行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>
|
||||
);
|
||||
}
|
||||
}
|
||||
};
|
1192
packages/amis-editor/src/renderer/event-control/index.tsx
Normal file
1192
packages/amis-editor/src/renderer/event-control/index.tsx
Normal file
File diff suppressed because it is too large
Load Diff
32
packages/amis-editor/src/renderer/event-control/types.ts
Normal file
32
packages/amis-editor/src/renderer/event-control/types.ts
Normal 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[];
|
||||
}
|
Loading…
Reference in New Issue
Block a user