[amis-saas-6725]优化事件变量

Change-Id: I46f76136b4ca362f0f218de3b79a9a68219ff0ee
This commit is contained in:
hsm-lv 2022-10-12 19:39:33 +08:00
parent 9292e4bb4c
commit 66755d4d19
15 changed files with 131 additions and 61 deletions

View File

@ -5,10 +5,7 @@ import {BasePlugin} from 'amis-editor-core';
import type {BaseEventContext} from 'amis-editor-core';
import {ValidatorTag} from '../../validator';
import {
RendererPluginEvent,
RendererPluginAction
} from 'amis-editor-core';
import {RendererPluginEvent, RendererPluginAction} from 'amis-editor-core';
import {getEventControlConfig} from '../../renderer/event-control/helper';
export class CodeEditorControlPlugin extends BasePlugin {
@ -45,6 +42,22 @@ export class CodeEditorControlPlugin extends BasePlugin {
};
events: RendererPluginEvent[] = [
{
eventName: 'change',
eventLabel: '代码变化',
description: '代码变化时触发',
dataSchema: [
{
type: 'object',
properties: {
'event.data.value': {
type: 'string',
title: '当前代码'
}
}
}
]
},
{
eventName: 'focus',
eventLabel: '获取焦点',

View File

@ -15,10 +15,7 @@ import React from 'react';
import {diff, JSONPipeIn} from 'amis-editor-core';
import {JSONPipeOut} from 'amis-editor-core';
import {mockValue} from 'amis-editor-core';
import {
RendererPluginEvent,
RendererPluginAction
} from 'amis-editor-core';
import {RendererPluginEvent, RendererPluginAction} from 'amis-editor-core';
import {setVariable} from 'amis-core';
export class ComboControlPlugin extends BasePlugin {
@ -109,6 +106,10 @@ export class ComboControlPlugin extends BasePlugin {
'event.data.value': {
type: 'string',
title: '现有组合项的值'
},
'event.data.item': {
type: 'object',
title: '被删除的项'
}
}
}
@ -125,6 +126,14 @@ export class ComboControlPlugin extends BasePlugin {
'event.data.key': {
type: 'string',
title: '选项卡索引'
},
'event.data.value': {
type: 'string',
title: '现有组合项的值'
},
'event.data.item': {
type: 'object',
title: '被激活的项'
}
}
}
@ -532,7 +541,8 @@ export class ComboControlPlugin extends BasePlugin {
trigger: 'click',
rootClose: true,
placement: 'left',
content: '如果子表单项里面配置验证器,且又是单条模式。可以允许用户选择清空(不填)。'
content:
'如果子表单项里面配置验证器,且又是单条模式。可以允许用户选择清空(不填)。'
}
}),

View File

@ -11,10 +11,7 @@ import {BasePlugin} from 'amis-editor-core';
import type {BaseEventContext} from 'amis-editor-core';
import {ValidatorTag} from '../../validator';
import {getEventControlConfig} from '../../renderer/event-control/helper';
import {
RendererPluginEvent,
RendererPluginAction
} from 'amis-editor-core';
import {RendererPluginEvent, RendererPluginAction} from 'amis-editor-core';
export class DiffEditorControlPlugin extends BasePlugin {
// 关联渲染器名字
@ -51,6 +48,22 @@ export class DiffEditorControlPlugin extends BasePlugin {
};
events: RendererPluginEvent[] = [
{
eventName: 'change',
eventLabel: '代码变化',
description: '代码变化时触发',
dataSchema: [
{
type: 'object',
properties: {
'event.data.value': {
type: 'string',
title: '当前代码'
}
}
}
]
},
{
eventName: 'focus',
eventLabel: '获取焦点',

View File

@ -67,7 +67,7 @@ export class FileControlPlugin extends BasePlugin {
{
type: 'object',
properties: {
'event.data.file': {
'event.data.item': {
type: 'object',
title: '被移除的文件'
}
@ -83,7 +83,7 @@ export class FileControlPlugin extends BasePlugin {
{
type: 'object',
properties: {
'event.data.file': {
'event.data.item': {
type: 'object',
title: '远程上传请求成功后返回的结果数据'
}
@ -99,7 +99,7 @@ export class FileControlPlugin extends BasePlugin {
{
type: 'object',
properties: {
'event.data.file': {
'event.data.item': {
type: 'object',
title: '上传的文件'
},

View File

@ -73,7 +73,7 @@ export class ImageControlPlugin extends BasePlugin {
{
type: 'object',
properties: {
'event.data.file': {
'event.data.item': {
type: 'object',
title: '被移除的文件'
}
@ -89,7 +89,7 @@ export class ImageControlPlugin extends BasePlugin {
{
type: 'object',
properties: {
'event.data.file': {
'event.data.item': {
type: 'object',
title: '远程上传请求成功后返回的结果数据'
}
@ -105,7 +105,7 @@ export class ImageControlPlugin extends BasePlugin {
{
type: 'object',
properties: {
'event.data.file': {
'event.data.item': {
type: 'object',
title: '上传的文件'
},

View File

@ -1,10 +1,7 @@
/**
* @file input-kv
*/
import {
RendererPluginAction,
RendererPluginEvent
} from 'amis-editor-core';
import {RendererPluginAction, RendererPluginEvent} from 'amis-editor-core';
import {defaultValue, getSchemaTpl, valuePipeOut} from 'amis-editor-core';
import {registerEditorPlugin} from 'amis-editor-core';
import {
@ -77,6 +74,10 @@ export class KVControlPlugin extends BasePlugin {
'event.data.value': {
type: 'string',
title: '当前组合项的值'
},
'event.data.item': {
type: 'object',
title: '被移除的项'
}
}
}

View File

@ -76,6 +76,10 @@ export class TagControlPlugin extends BasePlugin {
'event.data.value': {
type: 'string',
title: '选中值'
},
'event.data.items': {
type: 'array',
title: '选项集合'
}
}
}
@ -92,6 +96,10 @@ export class TagControlPlugin extends BasePlugin {
'event.data.value': {
type: 'string',
title: '选中值'
},
'event.data.items': {
type: 'array',
title: '选项集合'
}
}
}

View File

@ -93,7 +93,7 @@ export class TreeControlPlugin extends BasePlugin {
type: 'object',
title: '新增的节点信息'
},
'event.data.options': {
'event.data.items': {
type: 'array',
title: '选项集合'
}
@ -113,7 +113,7 @@ export class TreeControlPlugin extends BasePlugin {
type: 'object',
title: '编辑的节点信息'
},
'event.data.options': {
'event.data.items': {
type: 'array',
title: '选项集合'
}
@ -133,7 +133,7 @@ export class TreeControlPlugin extends BasePlugin {
type: 'object',
title: '删除的节点信息'
},
'event.data.options': {
'event.data.items': {
type: 'array',
title: '选项集合'
}

View File

@ -72,13 +72,29 @@ export class PickerControlPlugin extends BasePlugin {
type: 'string',
title: '选中值'
},
'event.data.option': {
'event.data.selectedItems': {
type: 'string',
title: '选中的行数据'
}
}
}
]
},
{
eventName: 'itemclick',
eventLabel: '点击选项',
description: '选项被点击时触发',
dataSchema: [
{
type: 'object',
properties: {
'event.data.item': {
type: 'object',
title: '所点击的选项'
}
}
}
]
}
];

View File

@ -4,10 +4,7 @@ import {BasePlugin, BaseEventContext} from 'amis-editor-core';
import {ValidatorTag} from '../../validator';
import {getEventControlConfig} from '../../renderer/event-control/helper';
import {
RendererPluginAction,
RendererPluginEvent
} from 'amis-editor-core';
import {RendererPluginAction, RendererPluginEvent} from 'amis-editor-core';
export class RadiosControlPlugin extends BasePlugin {
// 关联渲染器名字
@ -70,6 +67,10 @@ export class RadiosControlPlugin extends BasePlugin {
'event.data.value': {
type: 'string',
title: '选中值'
},
'event.data.items': {
type: 'array',
title: '选项集合'
}
}
}

View File

@ -67,6 +67,10 @@ export class SelectControlPlugin extends BasePlugin {
'event.data.value': {
type: 'string',
title: '选中值'
},
'event.data.items': {
type: 'array',
title: '选项集合'
}
}
}
@ -83,6 +87,10 @@ export class SelectControlPlugin extends BasePlugin {
'event.data.value': {
type: 'string',
title: '选中值'
},
'event.data.items': {
type: 'array',
title: '选项集合'
}
}
}
@ -99,6 +107,10 @@ export class SelectControlPlugin extends BasePlugin {
'event.data.value': {
type: 'string',
title: '选中值'
},
'event.data.items': {
type: 'array',
title: '选项集合'
}
}
}
@ -116,7 +128,7 @@ export class SelectControlPlugin extends BasePlugin {
type: 'object',
title: '新增的选项'
},
'event.data.options': {
'event.data.items': {
type: 'array',
title: '选项集合'
}
@ -136,7 +148,7 @@ export class SelectControlPlugin extends BasePlugin {
type: 'object',
title: '编辑的选项'
},
'event.data.options': {
'event.data.items': {
type: 'array',
title: '选项集合'
}
@ -156,7 +168,7 @@ export class SelectControlPlugin extends BasePlugin {
type: 'object',
title: '删除的选项'
},
'event.data.options': {
'event.data.items': {
type: 'array',
title: '选项集合'
}

View File

@ -144,22 +144,10 @@ export class TabsTransferPlugin extends BasePlugin {
'event.data.value': {
type: 'string',
title: '选中值'
}
}
}
]
},
{
eventName: 'selectAll',
eventLabel: '全选',
description: '选中所有选项',
dataSchema: [
{
type: 'object',
properties: {
'event.data.value': {
type: 'string',
title: '选中值'
},
'event.data.items': {
type: 'array',
title: '选项集合'
}
}
}
@ -279,12 +267,12 @@ export class TabsTransferPlugin extends BasePlugin {
getSchemaTpl('label'),
getSchemaTpl('searchable'),
getSchemaTpl('api', {
label: '检索接口',
name: 'searchApi'
}),
{
label: '查询时勾选展示模式',
name: 'searchResultMode',
@ -309,16 +297,16 @@ export class TabsTransferPlugin extends BasePlugin {
}
]
},
getSchemaTpl('sortable'),
getSchemaTpl('formulaControl', {
label: '左侧选项标题',
name: 'selectTitle',
type: 'input-text',
inputClassName: 'is-inline '
}),
getSchemaTpl('formulaControl', {
label: '右侧结果标题',
name: 'resultTitle',

View File

@ -63,6 +63,10 @@ export class TransferPlugin extends BasePlugin {
'event.data.value': {
type: 'string',
title: '选中值'
},
'event.data.items': {
type: 'array',
title: '选项集合'
}
}
}
@ -76,9 +80,9 @@ export class TransferPlugin extends BasePlugin {
{
type: 'object',
properties: {
'event.data': {
'event.data.items': {
type: 'array',
title: '选中值'
title: '选项集合'
}
}
}

View File

@ -89,7 +89,7 @@ export class TreeSelectControlPlugin extends BasePlugin {
type: 'object',
title: '新增的选项信息'
},
'event.data.options': {
'event.data.items': {
type: 'array',
title: '选项集合'
}
@ -109,7 +109,7 @@ export class TreeSelectControlPlugin extends BasePlugin {
type: 'object',
title: '编辑的选项信息'
},
'event.data.options': {
'event.data.items': {
type: 'array',
title: '选项集合'
}
@ -129,7 +129,7 @@ export class TreeSelectControlPlugin extends BasePlugin {
type: 'object',
title: '删除的选项信息'
},
'event.data.options': {
'event.data.items': {
type: 'array',
title: '选项集合'
}

View File

@ -1,4 +1,8 @@
import {EditorNodeType, jsonToJsonSchema, registerEditorPlugin} from 'amis-editor-core';
import {
EditorNodeType,
jsonToJsonSchema,
registerEditorPlugin
} from 'amis-editor-core';
import {
BaseEventContext,
BasePlugin,