import { Component } from "react"; import { LabelList as LabelListComponent } from "@Component/LabelList/LabelList"; import { useStatusWithEvent, IMixinStatusProps } from "@Context/Status"; import { useSetting, IMixinSettingProps } from "@Context/Setting"; import { ConfirmPopup } from "@Component/ConfirmPopup/ConfirmPopup"; import { Message } from "@Input/Message/Message"; import { Label } from "@Model/Label"; import "./LabelList.scss"; interface ILabelListProps { } @useSetting @useStatusWithEvent("labelChange", "focusLabelChange", "labelAttrChange") class LabelList extends Component { private labelInnerClick: boolean = false; public render() { let labels: Label[] = []; if (this.props.status) { labels = this.props.status.model.labelPool.concat([]); } return
{ if (this.props.status && !this.labelInnerClick) { this.props.status.setLabelObject(); } this.labelInnerClick = false; }} > {labels.length <=0 ? : null } { if (this.props.status) { this.props.status.setLabelObject(label); } if (this.props.setting) { this.props.setting.layout.focus("LabelDetails"); } this.labelInnerClick = true; }} deleteLabel={(label) => { if (this.props.status) { const status = this.props.status; status.popup.showPopup(ConfirmPopup, { infoI18n: "Popup.Delete.Objects.Confirm", titleI18N: "Popup.Action.Objects.Confirm.Title", yesI18n: "Popup.Action.Objects.Confirm.Delete", red: "yes", yes: () => { status.model.deleteLabel(label); status.setLabelObject(); } }) } this.labelInnerClick = true; }} minHeight={26} addLabel={() => { this.props.status ? this.props.status.newLabel() : undefined; }} />
; } } export { LabelList };