Merge pull request #9058 from igrowp/fix-editor-dialog-show

fix(editor): 修改dialog组件show默认值修改后部分弹窗打不开的问题
This commit is contained in:
hsm-lv 2023-12-07 19:51:49 +08:00 committed by GitHub
commit f1798d4da5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 86 additions and 85 deletions

View File

@ -614,6 +614,7 @@ export class NavSourceControl extends React.Component<
modalParent, modalParent,
modalUrl, modalUrl,
modalTarget, modalTarget,
showDialog,
isEdit isEdit
} = this.state; } = this.state;
const treeData = cloneDeep(links); const treeData = cloneDeep(links);
@ -739,6 +740,7 @@ export class NavSourceControl extends React.Component<
modalUrl, modalUrl,
modalTarget modalTarget
}, },
show: showDialog,
onClose: this.closeModal, onClose: this.closeModal,
onConfirm: this.handleSubmit onConfirm: this.handleSubmit
} }
@ -771,7 +773,7 @@ export class NavSourceControl extends React.Component<
this.renderApiPanel() this.renderApiPanel()
)} )}
{showDialog && this.renderDialog()} {this.renderDialog()}
</div> </div>
); );
} }

View File

@ -1255,99 +1255,98 @@ export class EventControl extends React.Component<
</div> </div>
)} )}
</ul> </ul>
{showEventDialog {amisRender(
? amisRender( {
type: 'dialog',
title: `${eventDialogData?.eventLabel}-事件配置`,
showCloseButton: false,
body: [
{ {
type: 'dialog', type: 'form',
title: `${eventDialogData?.eventLabel}-事件配置`, title: '表单',
showCloseButton: false, data: {
'&': '$$'
},
mode: 'horizontal',
horizontal: {
left: 3,
right: 9
},
body: [ body: [
{ {
type: 'form', label: '事件防重',
title: '表单', type: 'switch',
data: { name: 'debounce.open',
'&': '$$' description:
}, '开启事件防重后,防重时间内多次触发事件只会执行最后一次'
mode: 'horizontal',
horizontal: {
left: 3,
right: 9
},
body: [
{
label: '事件防重',
type: 'switch',
name: 'debounce.open',
description:
'开启事件防重后,防重时间内多次触发事件只会执行最后一次'
},
{
label: '防重时间',
required: true,
hiddenOn: '!debounce.open',
name: 'debounce.wait',
suffix: 'ms',
max: 10000,
min: 0,
type: 'input-number'
},
{
label: '事件埋点',
type: 'switch',
name: 'track.open',
description:
'开启事件埋点后,每次事件触发都会发送埋点数据到后台'
},
{
label: 'track-id',
required: true,
hiddenOn: '!track.open',
name: 'track.id',
type: 'input-text'
},
{
label: 'track-name',
required: true,
hiddenOn: '!track.open',
name: 'track.name',
type: 'input-text'
}
],
onSubmit: this.eventDialogSubmit.bind(this)
}
],
actions: [
{
type: 'button',
label: '取消',
onEvent: {
click: {
actions: [
{
actionType: 'custom',
script: () => {
this.setState({
showEventDialog: false
});
}
}
]
}
}
}, },
{ {
type: 'button', label: '防重时间',
actionType: 'confirm', required: true,
label: '确认', hiddenOn: '!debounce.open',
primary: true name: 'debounce.wait',
suffix: 'ms',
max: 10000,
min: 0,
type: 'input-number'
},
{
label: '事件埋点',
type: 'switch',
name: 'track.open',
description:
'开启事件埋点后,每次事件触发都会发送埋点数据到后台'
},
{
label: 'track-id',
required: true,
hiddenOn: '!track.open',
name: 'track.id',
type: 'input-text'
},
{
label: 'track-name',
required: true,
hiddenOn: '!track.open',
name: 'track.name',
type: 'input-text'
} }
] ],
onSubmit: this.eventDialogSubmit.bind(this)
}
],
actions: [
{
type: 'button',
label: '取消',
onEvent: {
click: {
actions: [
{
actionType: 'custom',
script: () => {
this.setState({
showEventDialog: false
});
}
}
]
}
}
}, },
{ {
data: eventDialogData type: 'button',
actionType: 'confirm',
label: '确认',
primary: true
} }
) ]
: null} },
{
data: eventDialogData,
show: showEventDialog
}
)}
<ActionDialog <ActionDialog
show={showAcionDialog} show={showAcionDialog}
type={type} type={type}