king
2022-01-21 46f79b491173d284a4900d19e7aecf7509481438
src/menu/components/card/cardcellcomponent/index.jsx
@@ -145,7 +145,14 @@
    let options = ['font', 'border', 'padding', 'margin', 'background']
    if (element.eleType === 'button') {
      options.push('width', 'float')
      if (element.OpenType === 'form') {
        options = ['margin', 'float']
      } else {
        options.push('width', 'minHeight', 'float')
      }
      if (element.wrapStyle) {
        _style.float = element.wrapStyle.textAlign || 'left'
      }
    } else if (element.eleType === 'picture') {
      options = ['border', 'margin']
    } else if (element.eleType === 'slider') {
@@ -167,11 +174,11 @@
    if (comIds.length !== 3 || comIds[0] !== cards.uuid || comIds[1] !== cardCell.uuid || !card) return
    if (card.eleType === 'button') {
      if ((style.paddingLeft || style.paddingRight) && !style.width) {
        style.width = 'auto'
      }
    }
    // if (card.eleType === 'button') {
    //   if ((style.paddingLeft || style.paddingRight) && !style.width) {
    //     style.width = 'auto'
    //   }
    // }
    let _card = this.resetCardStyle(card, style)
@@ -229,7 +236,12 @@
      _card.innerHeight = _card.barHeight + (_card.displayValue === 'true' ? fontSize + 2 : 0)
    } else if (_card.eleType === 'button') { // 拆分style
      _card.style = style
      _card.style = fromJS(style).toJS()
      if (style.float) {
        _card.wrapStyle = {textAlign: style.float}
        delete _card.style.float
      }
    } else {
      _card.style = style
    }
@@ -406,9 +418,13 @@
          }
          
          delete res.focus
          let style = {}
          if (res.class !== cell.class || res.show !== cell.show || !res.style) {
          if (res.OpenType === 'form') {
            if (cell.OpenType !== 'form') {
              res.style = {}
            }
          } else if (res.class !== cell.class || res.show !== cell.show || !res.style) {
            let style = {}
            if (res.show === 'link' || res.show === 'icon') {
              style.color = color[res.class]
              style.backgroundColor = 'transparent'
@@ -416,8 +432,8 @@
              style.color = '#ffffff'
              style.backgroundColor = color[res.class]
            }
            res.style = {...res.style, ...style}
          }
          res.style = {...res.style, ...style}
          return res
        }
@@ -591,6 +607,25 @@
    let btn = cards.action[index]
    btn.eleType = 'button'
    if (!btn.width) {
      btn.width = 12
    }
    if (btn.color) {
      btn.style = btn.style || {}
      btn.style.color = '#ffffff'
      if (btn.color === 'primary') {
        btn.style.backgroundColor = '#1677ff'
      } else if (btn.color === 'danger') {
        btn.style.backgroundColor = '#ff3141'
      } else if (btn.color === 'warning') {
        btn.style.backgroundColor = '#ff8f1f'
      } else if (btn.color === 'success') {
        btn.style.backgroundColor = '#00b578'
      } else if (btn.color === 'light') {
        btn.style.backgroundColor = '#cccccc'
      }
    }
    let _elements = [...this.state.elements, btn]
    this.setState({
@@ -622,9 +657,9 @@
        <div onDoubleClick={(e) => e.stopPropagation()}>
          {/* 编辑按钮:复制、编辑 */}
          <Modal
            title={'编辑元素'}
            title="编辑元素"
            visible={visible}
            width={800}
            width={850}
            maskClosable={false}
            onCancel={this.editModalCancel}
            onOk={this.handleSubmit}