Skip to content

Commit

Permalink
fix:事件动作-变量赋值交互问题
Browse files Browse the repository at this point in the history
  • Loading branch information
hsm-lv committed Jan 30, 2024
1 parent 4314e1d commit 0f17441
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 82 deletions.
4 changes: 0 additions & 4 deletions packages/amis-editor-core/scss/control/_event-action.scss
Original file line number Diff line number Diff line change
Expand Up @@ -397,10 +397,6 @@
.action-exec-on {
width: 100%;
}

label {
text-align: left;
}
}
.ae-BaseRemark {
margin-left: 0;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,10 @@
*/

import {RendererProps, Schema} from 'amis-core';
import {defaultValue, RendererPluginAction} from 'amis-editor-core';
import {RendererPluginAction} from 'amis-editor-core';
import React from 'react';
import cx from 'classnames';
import {COMMON_ACTION_SCHEMA_MAP, renderCmptActionSelect} from './helper';
import {Button} from 'amis';

export default class ActionConfigPanel extends React.Component<RendererProps> {
render() {
Expand Down
108 changes: 32 additions & 76 deletions packages/amis-editor/src/renderer/event-control/helper.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -302,7 +302,6 @@ export const ACTION_TYPE_TREE = (manager: any): RendererPluginAction[] => {
schema: getArgsWrapper([
{
type: 'wrapper',
className: 'p-none',
body: [
getSchemaTpl('textareaFormulaControl', {
name: 'url',
Expand Down Expand Up @@ -456,7 +455,6 @@ export const ACTION_TYPE_TREE = (manager: any): RendererPluginAction[] => {
description: '关闭当前弹窗' // 或者关闭指定弹窗
// schema: getArgsWrapper({
// type: 'wrapper',
// className: 'p-none',
// body: [
// {
// type: 'radios',
Expand Down Expand Up @@ -516,7 +514,6 @@ export const ACTION_TYPE_TREE = (manager: any): RendererPluginAction[] => {
},
schema: getArgsWrapper({
type: 'wrapper',
className: 'p-none',
body: [
{
type: 'button-group-select',
Expand Down Expand Up @@ -750,7 +747,7 @@ export const ACTION_TYPE_TREE = (manager: any): RendererPluginAction[] => {
// innerArgs: ['api'],
schema: {
type: 'wrapper',
style: {padding: '0'},
className: 'p-none',
body: [
// getArgsWrapper(
// getSchemaTpl('apiControl', {
Expand Down Expand Up @@ -1075,7 +1072,6 @@ export const ACTION_TYPE_TREE = (manager: any): RendererPluginAction[] => {
{
type: 'wrapper',
size: 'sm',
visibleOn: 'data.componentId === "customCmptId"',
body: [
...renderCmptSelect(
'目标组件',
Expand All @@ -1090,23 +1086,6 @@ export const ACTION_TYPE_TREE = (manager: any): RendererPluginAction[] => {
)
]
},
{
type: 'wrapper',
size: 'sm',
visibleOn: 'data.componentId !== "customCmptId"',
body: [
...renderCmptSelect(
'目标组件',
true,
(value: string, oldVal: any, data: any, form: any) => {
form.setValueByName('args.resetPage', true);
form.setValueByName('__addParam', false);
form.setValueByName('__containerType', 'all');
form.setValueByName('__reloadParam', []);
}
)
]
},
renderCmptIdInput(
(value: string, oldVal: any, data: any, form: any) => {
// 找到组件并设置相关的属性
Expand Down Expand Up @@ -1373,7 +1352,6 @@ export const ACTION_TYPE_TREE = (manager: any): RendererPluginAction[] => {
),
getArgsWrapper({
type: 'wrapper',
className: 'p-none',
body: [
{
type: 'radios',
Expand Down Expand Up @@ -1440,7 +1418,7 @@ export const ACTION_TYPE_TREE = (manager: any): RendererPluginAction[] => {
size: 'lg',
placeholder: '请输入待更新序号',
visibleOn: `(data.__rendererName === 'input-table' || data.__rendererName === 'combo')
&& data.__comboType === 'appoint'`
&& data.__comboType === 'appoint'`
},
{
type: 'combo',
Expand Down Expand Up @@ -1517,7 +1495,7 @@ export const ACTION_TYPE_TREE = (manager: any): RendererPluginAction[] => {
}
],
visibleOn: `(data.__rendererName === 'combo' || data.__rendererName === 'input-table')
&& data.__comboType === 'all'`
&& data.__comboType === 'all'`
},
getSchemaTpl('formulaControl', {
name: '__valueInput',
Expand Down Expand Up @@ -1549,7 +1527,6 @@ export const ACTION_TYPE_TREE = (manager: any): RendererPluginAction[] => {
getArgsWrapper([
{
type: 'wrapper',
className: 'p-none',
body: [
getCustomNodeTreeSelectSchema({
label: '页面参数',
Expand Down Expand Up @@ -1584,7 +1561,6 @@ export const ACTION_TYPE_TREE = (manager: any): RendererPluginAction[] => {
getArgsWrapper([
{
type: 'wrapper',
className: 'p-none',
body: [
getCustomNodeTreeSelectSchema({
options: variableOptions,
Expand Down Expand Up @@ -1836,7 +1812,6 @@ export const ACTION_TYPE_TREE = (manager: any): RendererPluginAction[] => {
},
schema: getArgsWrapper({
type: 'wrapper',
className: 'p-none',
body: [
getSchemaTpl('textareaFormulaControl', {
name: 'content',
Expand Down Expand Up @@ -1952,52 +1927,34 @@ export const renderCmptSelect = (
required: boolean,
onChange?: (value: string, oldVal: any, data: any, form: any) => void,
hideAutoFill?: boolean
) => {
if (hideAutoFill) {
return [
{
type: 'tree-select',
name: 'componentId',
label: componentLabel || '选择组件',
showIcon: false,
searchable: true,
required,
selfDisabledAffectChildren: false,
size: 'lg',
source: '${__cmptTreeSource}',
mode: 'horizontal',
onChange: async (value: string, oldVal: any, data: any, form: any) => {
onChange?.(value, oldVal, data, form);
}
}
];
} else {
return [
{
type: 'tree-select',
name: 'componentId',
label: componentLabel || '选择组件',
showIcon: false,
searchable: true,
required,
selfDisabledAffectChildren: false,
size: 'lg',
source: '${__cmptTreeSource}',
mode: 'horizontal',
autoFill: {
__rendererLabel: '${label}',
__rendererName: '${type}',
__nodeId: '${id}',
__nodeSchema: '${schema}',
__isScopeContainer: '${isScopeContainer}'
},
onChange: async (value: string, oldVal: any, data: any, form: any) => {
onChange?.(value, oldVal, data, form);
}
}
];
) => [
{
type: 'tree-select',
name: 'componentId',
label: componentLabel || '选择组件',
showIcon: false,
searchable: true,
required,
selfDisabledAffectChildren: false,
size: 'lg',
source: '${__cmptTreeSource}',
mode: 'horizontal',
autoFill: {
__isScopeContainer: '${isScopeContainer}',
...(hideAutoFill
? {}
: {
__rendererLabel: '${label}',
__rendererName: '${type}',
__nodeId: '${id}',
__nodeSchema: '${schema}'
})
},
onChange: async (value: string, oldVal: any, data: any, form: any) => {
onChange?.(value, oldVal, data, form);
}
}
};
];

// 渲染组件特性动作配置项
export const renderCmptActionSelect = (
Expand Down Expand Up @@ -2124,7 +2081,6 @@ export const COMMON_ACTION_SCHEMA_MAP: {
},
schema: getArgsWrapper({
type: 'wrapper',
className: 'p-none',
body: [
{
type: 'radios',
Expand Down Expand Up @@ -2181,7 +2137,7 @@ export const COMMON_ACTION_SCHEMA_MAP: {
size: 'lg',
placeholder: '请输入待更新序号',
visibleOn: `(data.__rendererName === 'input-table' || data.__rendererName === 'combo')
&& data.__comboType === 'appoint'`
&& data.__comboType === 'appoint'`
},
{
type: 'combo',
Expand Down Expand Up @@ -2258,7 +2214,7 @@ export const COMMON_ACTION_SCHEMA_MAP: {
}
],
visibleOn: `(data.__rendererName === 'combo' || data.__rendererName === 'input-table')
&& data.__comboType === 'all'`
&& data.__comboType === 'all'`
},
getSchemaTpl('formulaControl', {
name: '__valueInput',
Expand Down

0 comments on commit 0f17441

Please sign in to comment.