king
2021-01-07 0da0262bc236cfce928429fc4c48e1666eab3402
src/menu/components/card/cardcellcomponent/index.jsx
@@ -59,6 +59,7 @@
    MKEmitter.addListener('cardAddElement', this.cardAddElement)
    MKEmitter.addListener('submitStyle', this.getStyle)
    MKEmitter.addListener('submitModal', this.handleSave)
    MKEmitter.addListener('submitComponentStyle', this.updateComponentStyle)
  }
  shouldComponentUpdate (nextProps, nextState) {
@@ -87,6 +88,28 @@
    MKEmitter.removeListener('cardAddElement', this.cardAddElement)
    MKEmitter.removeListener('submitStyle', this.getStyle)
    MKEmitter.removeListener('submitModal', this.handleSave)
    MKEmitter.removeListener('submitComponentStyle', this.updateComponentStyle)
  }
  updateComponentStyle = (parentId, keys, style) => {
    const { cardCell } = this.props
    if (!cardCell || cardCell.uuid !== parentId) return
    const { elements } = this.state
    let _elements = elements.map(item => {
      if (keys.includes(item.uuid)) {
        return this.resetCardStyle(item, {...item.style, ...style})
      }
      return item
    })
    this.setState({
      elements: _elements
    }, () => {
      this.props.updateElement(_elements)
    })
  }
  cardAddElement = (ids, element) => {
@@ -132,6 +155,21 @@
    if (comIds.length !== 3 || comIds[0] !== cards.uuid || comIds[1] !== cardCell.uuid) return
    let _card = this.resetCardStyle(card, style)
    let _elements = elements.map(cell => {
      if (cell.uuid === _card.uuid) return _card
      return cell
    })
    this.setState({
      elements: _elements
    }, () => {
      this.props.updateElement(_elements)
    })
  }
  resetCardStyle = (card, style) => {
    let _card = fromJS(card).toJS()
    
    if (_card.eleType === 'text' || _card.eleType === 'number') {
@@ -205,16 +243,7 @@
      _card.style = style
    }
    let _elements = elements.map(cell => {
      if (cell.uuid === _card.uuid) return _card
      return cell
    })
    this.setState({
      elements: _elements
    }, () => {
      this.props.updateElement(_elements)
    })
    return _card
  }
  /**
@@ -471,7 +500,7 @@
    const { cards } = this.props
    let btn = fromJS(item).toJS()
    if (btn.eleType !== 'button') return
    if (btn.eleType !== 'button' || (sessionStorage.getItem('style-control') && sessionStorage.getItem('style-control') !== 'false')) return
    if (btn.OpenType === 'pop') {
      if (!btn.modal) {
@@ -549,13 +578,14 @@
  }
  render() {
    const { cards } = this.props
    const { cards, cardCell } = this.props
    const { elements, visible, actvisible, profVisible, card, dict } = this.state
    return (
      <div className="model-menu-card-cell-list">
        <DragElement
          list={elements}
          parent={{...cardCell, components: elements}}
          fields={cards.columns}
          updateMarks={this.updateMarks}
          handleList={this.handleList}