mirror of
https://gitee.com/baidu/amis.git
synced 2024-12-02 03:58:07 +08:00
amis-saas-9796 fix: 事件动作数据设置控件缺少应用变量
Change-Id: Iaf98787bd579d4f3c23350e3488e0aaf9181f2ee
This commit is contained in:
parent
a736945485
commit
afbfd382fc
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "amis-editor",
|
||||
"version": "5.2.1-alpha.5",
|
||||
"version": "5.2.1-alpha.6",
|
||||
"description": "amis 可视化编辑器",
|
||||
"main": "lib/index.js",
|
||||
"module": "esm/index.js",
|
||||
|
@ -38,6 +38,7 @@ import {
|
||||
} from 'amis-editor-core';
|
||||
export * from './helper';
|
||||
import {i18n as _i18n} from 'i18n-runtime';
|
||||
import type {VariableItem} from 'amis-ui/lib/components/formula/Editor';
|
||||
|
||||
interface EventControlProps extends FormControlProps {
|
||||
actions: PluginActions; // 组件的动作列表
|
||||
@ -556,7 +557,8 @@ export class EventControl extends React.Component<
|
||||
actionConfigInitFormatter,
|
||||
getComponents,
|
||||
actionTree,
|
||||
allComponents
|
||||
allComponents,
|
||||
manager
|
||||
} = this.props;
|
||||
|
||||
let rawVariables = [];
|
||||
@ -568,7 +570,28 @@ export class EventControl extends React.Component<
|
||||
|
||||
// 收集事件变量
|
||||
const eventVariables = this.getEventVariables(data);
|
||||
const appVariables: VariableItem[] =
|
||||
manager?.variableManager?.getVariableFormulaOptions() || [];
|
||||
const variables = [...eventVariables, ...rawVariables];
|
||||
const systemVarIndex = variables.findIndex(
|
||||
item => item.label === '系统变量'
|
||||
);
|
||||
|
||||
// 插入应用变量
|
||||
if (!!~systemVarIndex) {
|
||||
appVariables.forEach(item => {
|
||||
if (Array.isArray(item?.children) && item.children.length) {
|
||||
variables.splice(systemVarIndex, 0, item);
|
||||
}
|
||||
});
|
||||
} else {
|
||||
appVariables.forEach(item => {
|
||||
if (Array.isArray(item?.children) && item.children.length) {
|
||||
variables.push(item);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// 编辑操作,需要格式化动作配置
|
||||
if (data.type === 'update') {
|
||||
const action = data.actionData!.action!;
|
||||
|
Loading…
Reference in New Issue
Block a user