From 326aa6b3effaccc71cfe0775d47b0f29eb3695a6 Mon Sep 17 00:00:00 2001
From: king <18310653075@163.com>
Date: 星期日, 25 八月 2024 00:36:40 +0800
Subject: [PATCH] 2024-08-25

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

diff --git a/src/menu/components/group/normal-group/index.jsx b/src/menu/components/group/normal-group/index.jsx
index 0544f9d..aa41f27 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, Modal } from 'antd'
+import { EditOutlined, ToolOutlined, DeleteOutlined, FontColorsOutlined, UngroupOutlined } from '@ant-design/icons'
 
 import MKEmitter from '@/utils/events.js'
 import asyncComponent from '@/utils/asyncComponent'
@@ -11,16 +11,18 @@
 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'))
-const PasteComponent = asyncIconComponent(() => import('../paste'))
+const PasteController = asyncIconComponent(() => import('@/menu/pastecontroller'))
 const GroupComponents = asyncComponent(() => import('../groupcomponents'))
 
 class NormalGroup extends Component {
   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 that = this
+    confirm({
+      title: '纭畾閲婃斁鍒嗙粍鍏冪礌鍚楋紵',
+      content: '',
+      onOk() {
+        that.props.unGroup(group.uuid)
+
+        setTimeout(() => {
+          that.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)
@@ -146,15 +178,15 @@
             <NormalForm title="鍒嗙粍璁剧疆" width={700} update={this.updateWrap} getForms={this.getWrapForms}>
               <EditOutlined style={{color: '#1890ff'}} title="缂栬緫"/>
             </NormalForm>
-            <CopyComponent type="tabs" card={group}/>
-            <PasteComponent insert={this.insert} />
+            <CopyComponent type="group" card={group}/>
+            <UngroupOutlined title="閲婃斁" style={group.components.length > 0 ? {color: '#32c5d2'} : {color: '#eeeeee', cursor: 'not-allowed'}} onClick={this.unGroup}/>
+            <PasteController type="group" tab={group} insert={this.insert} />
             <FontColorsOutlined className="style" title="璋冩暣鏍峰紡" onClick={this.changeStyle}/>
             <DeleteOutlined className="close" title="delete" onClick={() => this.props.deletecomponent(group.uuid)} />
           </div>
         } trigger="hover">
           <ToolOutlined />
         </Popover>
-        {group.setting && group.setting.print === 'true' ? <Button className="print-button" onClick={this.print}><PrinterOutlined /></Button> : null}
         <GroupComponents config={group} handleList={this.updateComponent} deleteCard={this.deleteCard} />
       </div>
     )

--
Gitblit v1.8.0