Merge branch 'pre-release' into master

This commit is contained in:
hsm-lv 2022-07-29 14:39:06 +08:00
commit d45b0a464d
3 changed files with 48 additions and 14 deletions

View File

@ -15,7 +15,7 @@ import {
renderCmptSelect, renderCmptSelect,
SUPPORT_DISABLED_CMPTS SUPPORT_DISABLED_CMPTS
} from './helper'; } from './helper';
import {BaseLabelMark} from '../../component/BaseControl';
const MSG_TYPES: {[key: string]: string} = { const MSG_TYPES: {[key: string]: string} = {
info: '提示', info: '提示',
warning: '警告', warning: '警告',
@ -450,16 +450,16 @@ const ACTION_TYPE_TREE = (manager: any): RendererPluginAction[] => {
type: 'checkbox', type: 'checkbox',
name: 'silent', name: 'silent',
option: '静默模式', option: '静默模式',
mode: 'inline',
className: 'm-r-none',
value: false,
remark: { remark: {
className: 'ae-BaseRemark', className: 'ae-BaseRemark',
icon: 'fa fa-question-circle', icon: 'fa fa-question-circle',
trigger: ['hover', 'click'], shape: "circle",
placement: 'left', placement: "left",
content: '勾选后,服务请求将以静默模式发送,即不会弹出成功或报错提示。' content: '勾选后,服务请求将以静默模式发送,即不会弹出成功或报错提示。'
}, }
mode: 'inline',
className: 'm-r-none',
value: false
} }
] ]
} }
@ -477,7 +477,26 @@ const ACTION_TYPE_TREE = (manager: any): RendererPluginAction[] => {
required: true required: true
} }
] ]
},
outputVarDataSchema: [
{
type: 'object',
properties: {
'event.data.${outputVar}.responseData': {
type: 'object',
title: '数据'
},
'event.data.${outputVar}.responseStatus': {
type: 'number',
title: '状态标识'
},
'event.data.${outputVar}.responseMsg': {
type: 'string',
title: '提示信息'
} }
}
}
]
}, },
{ {
actionLabel: '下载文件', actionLabel: '下载文件',
@ -490,7 +509,11 @@ const ACTION_TYPE_TREE = (manager: any): RendererPluginAction[] => {
body: [ body: [
getArgsWrapper( getArgsWrapper(
getSchemaTpl('apiControl', { getSchemaTpl('apiControl', {
name: 'api' name: 'api',
label: '配置请求',
mode: 'horizontal',
size: 'lg',
required: true
}) })
) )
] ]

View File

@ -984,7 +984,7 @@ export const getEventControlConfig = (
true true
); );
const checkComponent = (node: any, action: RendererPluginAction) => { const checkComponent = (node: any, action: RendererPluginAction) => {
const actionType = action.actionType; const actionType = action.actionType!;
const actions = manager?.pluginActions[node.type]; const actions = manager?.pluginActions[node.type];
const haveChild = !!node.children?.length; const haveChild = !!node.children?.length;
let isSupport = false; let isSupport = false;

View File

@ -2,7 +2,7 @@ import React from 'react';
import {findDOMNode} from 'react-dom'; import {findDOMNode} from 'react-dom';
import cx from 'classnames'; import cx from 'classnames';
import Sortable from 'sortablejs'; import Sortable from 'sortablejs';
import {DataSchema, FormItem, Icon, TooltipWrapper} from 'amis'; import {DataSchema, FormItem, Button, Icon, TooltipWrapper} from 'amis';
import cloneDeep from 'lodash/cloneDeep'; import cloneDeep from 'lodash/cloneDeep';
import { import {
FormControlProps, FormControlProps,
@ -446,7 +446,8 @@ export class EventControl extends React.Component<
// 收集当前事件已有ajax动作的请求返回结果作为事件变量 // 收集当前事件已有ajax动作的请求返回结果作为事件变量
let oldActions = onEvent[activeData.actionData!.eventKey].actions; let oldActions = onEvent[activeData.actionData!.eventKey].actions;
if (activeData.type === 'update') { if (activeData.type === 'update') {
oldActions = oldActions.slice(0, activeData.actionData!.actionIndex || oldActions?.length); // 编辑的时候只能拿到当前动作前面动作的事件变量
oldActions = oldActions.slice(0, activeData.actionData!.actionIndex);
} }
const withOutputVarActions = oldActions?.filter(item => item.outputVar); const withOutputVarActions = oldActions?.filter(item => item.outputVar);
@ -458,11 +459,21 @@ export class EventControl extends React.Component<
pluginActions, pluginActions,
commonActions commonActions
); );
const dataSchemaJson = getPropOfAcion(
item,
'outputVarDataSchema',
actionTree,
pluginActions,
commonActions
);
const dataSchema = new DataSchema(dataSchemaJson || []);
return { return {
label: `${item.outputVar ? item.outputVar + `${actionLabel}结果)` : `${actionLabel}结果`}`, label: `${item.outputVar ? item.outputVar + `${actionLabel}结果)` : `${actionLabel}结果`}`,
tag: 'object', tag: 'object',
type: 'object', children: dataSchema.getDataPropsAsOptions()?.map(variable => ({
value: `${item.outputVar ? ('event.data.' + item.outputVar) : 'event.data'}` ...variable,
value: variable.value.replace('${outputVar}', item.outputVar)
}))
}; };
}); });
const eventVariables: ContextVariables[] = [ const eventVariables: ContextVariables[] = [