| | |
| | | |
| | | state = { |
| | | selectIcon: '', |
| | | icons: [...minkeIconSystem.normal, ...minkeIconSystem.trademark, ...minkeIconSystem.data, ...minkeIconSystem.edit, ...minkeIconSystem.hint, ...minkeIconSystem.direction], |
| | | allowClear: false, |
| | | icons: [...minkeIconSystem.direction, ...minkeIconSystem.edit, ...minkeIconSystem.normal, ...minkeIconSystem.trademark, ...minkeIconSystem.data, ...minkeIconSystem.hint], |
| | | visible: false |
| | | } |
| | | |
| | |
| | | if (this.props['data-__meta']) { |
| | | val = this.props['data-__meta'].initialValue || '' |
| | | } |
| | | this.setState({selectIcon: val}) |
| | | |
| | | this.setState({selectIcon: val, allowClear: this.props.allowClear === true}) |
| | | } |
| | | |
| | | shouldComponentUpdate (nextProps, nextState) { |
| | |
| | | } |
| | | |
| | | render() { |
| | | const { selectIcon, visible, icons } = this.state |
| | | const { selectIcon, visible, icons, allowClear } = this.state |
| | | |
| | | return ( |
| | | <div className="mk-icon-box"> |
| | | {selectIcon ? <Icon type={selectIcon}/> : null} |
| | | <Icon onClick={() => this.setState({visible: true})} type="appstore"/> |
| | | {selectIcon ? <Icon type={selectIcon}/> : <Icon style={{opacity: 0}} type="plus"/>} |
| | | <Icon className="trigger" onClick={() => this.setState({visible: true})} type="swap"/> |
| | | {allowClear && selectIcon ? <Icon className="close" onClick={() => this.checkIcon('')} theme="filled" type="close-circle"/> : null} |
| | | <Modal |
| | | wrapClassName="popview-modal mk-icon-wrap" |
| | | title={'图标选择'} |