king
2022-10-19 8f394e7ef20cc0abba3f47c23a63b069e9dd0e45
src/menu/components/group/normal-group/index.jsx
@@ -35,8 +35,6 @@
      let _group = {
        uuid: group.uuid,
        type: group.type,
        tabId: group.tabId || '',
        parentId: group.parentId || '',
        subtype: group.subtype,
        width: 24,
        name: group.name,
@@ -59,11 +57,6 @@
    return !is(fromJS(this.state), fromJS(nextState))
  }
  componentDidMount () {
    MKEmitter.addListener('tabsChange', this.handleTabsChange)
    MKEmitter.addListener('submitComponentStyle', this.updateComponentStyle)
  }
  /**
   * @description 组件销毁,清除state更新,清除快捷键设置
   */
@@ -71,27 +64,6 @@
    this.setState = () => {
      return
    }
    MKEmitter.removeListener('tabsChange', this.handleTabsChange)
    MKEmitter.removeListener('submitComponentStyle', this.updateComponentStyle)
  }
  updateComponentStyle = (parentId, keys, style) => {
    const { group } = this.state
    if (group.uuid !== parentId) return
    let components = group.components.map(item => {
      if (keys.includes(item.uuid)) {
        item.style = {...item.style, ...style}
      }
      return item
    })
    this.setState({
      group: {...group, components: []}
    }, () => {
      this.updateComponent({...group, components: components})
    })
  }
  changeStyle = () => {
@@ -110,20 +82,16 @@
    this.props.updateConfig(_card)
  }
  handleTabsChange = (parentId) => {
    const { group } = this.state
    if (parentId === group.parentId) {
      MKEmitter.emit('tabsChange', group.uuid)
    }
  }
  updateComponent = (component) => {
    const { group } = this.state
    if (!is(fromJS(group.setting), fromJS(component.setting)) || !is(fromJS(group.style), fromJS(component.style))) {
      // 注册事件-标签变化,通知组内元素
      MKEmitter.emit('tabsChange', group.uuid)
      let ids = []
      group.components.forEach(item => {
        ids.push(item.uuid)
      })
      MKEmitter.emit('tabsChange', ids.join(','))
    }
    component.width = component.setting.width
@@ -137,8 +105,6 @@
  insert = (item) => {
    let group = fromJS(this.state.group).toJS()
    item.parentId = group.parentId
    group.components.push(item)
@@ -156,13 +122,6 @@
    this.updateComponent({...this.state.group, setting: res})
  }
  clickComponent = (e) => {
    if (sessionStorage.getItem('style-control') === 'true' || sessionStorage.getItem('style-control') === 'component') {
      e.stopPropagation()
      MKEmitter.emit('clickComponent', this.state.group)
    }
  }
  render() {
    const { group } = this.state
    let _style = resetStyle(group.style)
@@ -173,7 +132,7 @@
    }
    return (
      <div className={'menu-group-edit-box ' + (paddingTop ? 'padding ' : '') + (group.setting.layout || '')} style={_style} onClick={this.clickComponent} id={group.uuid}>
      <div className={'menu-group-edit-box ' + (paddingTop ? 'padding ' : '') + (group.setting.layout || '')} style={_style} id={group.uuid}>
        <Popover overlayClassName="mk-popover-control-wrap" mouseLeaveDelay={0.2} mouseEnterDelay={0.2} content={
          <div className="mk-popover-control">
            <NormalForm title="分组设置" width={700} update={this.updateWrap} getForms={this.getWrapForms}>