添加过的事件禁用

Change-Id: Ica47534ee092cf4fd5f8d17b73bc456c28d29348
This commit is contained in:
pianruijie 2022-08-22 16:48:11 +08:00
parent 3282287beb
commit 3e8c095493

View File

@ -150,13 +150,12 @@ export class EventControl extends React.Component<
return Object.keys(onEvent).length ? onEvent : {};
}
addEvent(event: RendererPluginEvent) {
addEvent(event: RendererPluginEvent, disabled: boolean) {
const {onChange} = this.props;
let onEvent = {
...this.state.onEvent
};
if (onEvent[`${event.eventName}`]) {
if (disabled) {
return;
}
onEvent[`${event.eventName}`] = {
@ -628,7 +627,6 @@ export class EventControl extends React.Component<
const enventSnapshot = cloneDeep(onEvent);
const {showOldEntry} = this.props;
const eventKeys = Object.keys(enventSnapshot);
return (
<div className="ae-event-control">
<header
@ -647,9 +645,12 @@ export class EventControl extends React.Component<
closeOnClick: true,
buttons: events.map(item => ({
type: 'button',
disabledTip: '您已添加该事件',
tooltipPlacement: 'left',
disabled: Object.keys(onEvent).includes(item.eventName),
actionType: '',
label: item.eventLabel,
onClick: this.addEvent.bind(this, item)
onClick: this.addEvent.bind(this, item, Object.keys(onEvent).includes(item.eventName))
}))
})}
</header>