From 1ba430d58ea3fd662d09b99f6e22ed3b3564a356 Mon Sep 17 00:00:00 2001
From: king <18310653075@163.com>
Date: 星期五, 03 二月 2023 14:15:31 +0800
Subject: [PATCH] 2023-02-03

---
 src/menu/components/group/normal-group/index.jsx |   39 ++++++++++++++++++++++++++++++++++++---
 1 files changed, 36 insertions(+), 3 deletions(-)

diff --git a/src/menu/components/group/normal-group/index.jsx b/src/menu/components/group/normal-group/index.jsx
index 0544f9d..b635bea 100644
--- a/src/menu/components/group/normal-group/index.jsx
+++ b/src/menu/components/group/normal-group/index.jsx
@@ -1,8 +1,8 @@
 import React, {Component} from 'react'
 import PropTypes from 'prop-types'
 import { is, fromJS } from 'immutable'
-import { Popover, Button } from 'antd'
-import { EditOutlined, ToolOutlined, DeleteOutlined, FontColorsOutlined, PrinterOutlined } from '@ant-design/icons'
+import { Popover, Button, Modal } from 'antd'
+import { EditOutlined, ToolOutlined, DeleteOutlined, FontColorsOutlined, PrinterOutlined, UngroupOutlined } from '@ant-design/icons'
 
 import MKEmitter from '@/utils/events.js'
 import asyncComponent from '@/utils/asyncComponent'
@@ -11,6 +11,7 @@
 import getSettingForm from './options'
 import './index.scss'
 
+const { confirm } = Modal
 const NormalForm = asyncIconComponent(() => import('@/components/normalform'))
 const CopyComponent = asyncIconComponent(() => import('@/menu/components/share/copycomponent'))
 const NormalHeader = asyncComponent(() => import('@/menu/components/share/normalheader'))
@@ -21,6 +22,7 @@
   static propTpyes = {
     group: PropTypes.object,
     deletecomponent: PropTypes.func,
+    unGroup: PropTypes.func,
     updateConfig: PropTypes.func,
   }
 
@@ -70,7 +72,7 @@
   changeStyle = () => {
     const { group } = this.state
 
-    MKEmitter.emit('changeStyle', ['background', 'border', 'padding', 'margin', 'shadow', 'clear'], group.style, this.getStyle)
+    MKEmitter.emit('changeStyle', ['background', 'border', 'padding', 'margin', 'shadow', 'clear', 'minHeight'], group.style, this.getStyle)
   }
 
   getStyle = (style) => {
@@ -129,6 +131,36 @@
     this.updateComponent(group)
   }
 
+  unGroup = () => {
+    const { group } = this.state
+
+    if (group.components.length === 0) return
+
+    const _this = this
+    confirm({
+      title: '纭畾閲婃斁鍒嗙粍鍏冪礌鍚楋紵',
+      content: '',
+      onOk() {
+        _this.props.unGroup(group.uuid)
+
+        setTimeout(() => {
+          _this.updataGroup()
+        }, 10)
+      },
+      onCancel() {}
+    })
+  }
+
+  updataGroup = () => {
+    const { group } = this.props
+
+    if (group.components.length === 0) {
+      this.setState({
+        group: fromJS(group).toJS()
+      })
+    }
+  }
+
   render() {
     const { group } = this.state
     let _style = resetStyle(group.style)
@@ -147,6 +179,7 @@
               <EditOutlined style={{color: '#1890ff'}} title="缂栬緫"/>
             </NormalForm>
             <CopyComponent type="tabs" card={group}/>
+            <UngroupOutlined title="閲婃斁" style={group.components.length > 0 ? {color: '#32c5d2'} : {color: '#eeeeee', cursor: 'not-allowed'}} onClick={this.unGroup}/>
             <PasteComponent insert={this.insert} />
             <FontColorsOutlined className="style" title="璋冩暣鏍峰紡" onClick={this.changeStyle}/>
             <DeleteOutlined className="close" title="delete" onClick={() => this.props.deletecomponent(group.uuid)} />

--
Gitblit v1.8.0