king
2022-09-06 fa381753ef2a2b25b1c0722549ac17e333da79be
src/mob/components/menubar/normal-menubar/index.jsx
@@ -88,10 +88,6 @@
    }
  }
  componentDidMount () {
    MKEmitter.addListener('submitStyle', this.getStyle)
  }
  shouldComponentUpdate (nextProps, nextState) {
    return !is(fromJS(this.state), fromJS(nextState))
  }
@@ -103,7 +99,6 @@
    this.setState = () => {
      return
    }
    MKEmitter.removeListener('submitStyle', this.getStyle)
  }
  /**
@@ -170,15 +165,11 @@
  changeStyle = () => {
    const { card } = this.state
    MKEmitter.emit('changeStyle', [card.uuid], ['background', 'border', 'padding', 'margin', 'shadow'], card.style)
    MKEmitter.emit('changeStyle', ['background', 'border', 'padding', 'margin', 'shadow'], card.style, this.getStyle)
  }
  getStyle = (comIds, style) => {
    const { card } = this.state
    if (comIds.length !== 1 || comIds[0] !== card.uuid) return
    let _card = {...card, style}
  getStyle = (style) => {
    let _card = {...this.state.card, style}
    this.setState({
      card: _card
@@ -221,6 +212,22 @@
    setTimeout(() => {
      let node = document.getElementById(newcard.uuid)
      node && node.click()
    }, 200)
  }
  filterComponent = (config) => {
    let item = null
    config.subMenus.forEach(menu => {
      if (menu.setting.type === 'linkmenu' && menu.setting.linkMenuId === '') {
        item = menu
      }
    })
    this.updateComponent(config)
    setTimeout(() => {
      let node = document.getElementById(item.uuid)
      node && node.click()
    }, 200)
  }
@@ -286,7 +293,7 @@
              <EditOutlined style={{color: '#1890ff'}} title="编辑"/>
            </NormalForm>
            <CopyComponent type="menubar" card={card}/>
            <PasteComponent config={card} options={['menucell']} updateConfig={this.updateComponent} />
            <PasteComponent config={card} options={['menucell']} updateConfig={this.filterComponent} />
            <FontColorsOutlined className="style" title="调整样式" onClick={this.changeStyle} />
            <UserComponent config={card}/>
            <DeleteOutlined className="close" title="删除组件" onClick={() => this.props.deletecomponent(card.uuid)} />