import { Connect } from "dob-react" import * as _ from "lodash" import * as React from "react" import * as ReactDOM from "react-dom" import Icon from "../../components/icon/src" import { TabPanel, Tabs } from "../../components/tabs/src/" import { Tooltip } from "../../components/tooltip/src" import * as Styled from "./index.style" import { Props, State } from "./index.type" @Connect class MainToolEditorEvent extends React.Component { public static defaultProps = new Props() public state = new State() /** * 组件实例的信息 */ private instanceInfo: InstanceInfo public render() { // 当前编辑组件的 key const instanceKey = this.props.stores.ViewportStore.currentEditInstanceKey if (!this.props.stores.ViewportStore.instances.has(instanceKey)) { return null } this.instanceInfo = this.props.stores.ViewportStore.instances.get(instanceKey) const Events = this.instanceInfo.data && this.instanceInfo.data.events && this.instanceInfo.data.events.map((event, index) => { return ( {this.props.actions.ApplicationAction.loadPluginByPosition(`mainToolEditorEventTrigger`, { index })} {this.props.actions.ApplicationAction.loadPluginByPosition(`mainToolEditorEventAction`, { index })} ) }) return ( 事件 {Events} ) } private handleAdd = () => { this.props.actions.ViewportAction.instanceAddEvent(this.props.stores.ViewportStore.currentEditInstanceKey) } private handleRemove = (index: number) => { this.props.actions.ViewportAction.instanceRemoveEvent(this.props.stores.ViewportStore.currentEditInstanceKey, index) } } export default { position: "mainToolEditorEvent", class: MainToolEditorEvent }