king
2023-06-28 f07c42a322f41e14ef5b1bf8f2fd66fc5d338cdd
src/menu/components/group/paste/index.jsx
@@ -1,11 +1,11 @@
import React, {Component} from 'react'
import PropTypes from 'prop-types'
import { Icon, Modal, notification } from 'antd'
import { Modal, notification } from 'antd'
import { SnippetsOutlined } from '@ant-design/icons'
import MenuUtils from '@/utils/utils-custom.js'
import MKEmitter from '@/utils/events.js'
import asyncComponent from '@/utils/asyncComponent'
import './index.scss'
// import './index.scss'
const PasteForm = asyncComponent(() => import('@/templates/zshare/pasteform'))
@@ -18,12 +18,9 @@
    visible: false
  }
  handleMenuClick = () => {
    this.setState({visible: true})
  }
  pasteSubmit = () => {
    let options = ['datacard', 'propcard', 'balcony', 'stepform', 'tabform', 'normaltable', 'tablecard', 'line', 'bar', 'pie', 'dashboard', 'scatter']
    let appType = sessionStorage.getItem('appType')
    let options = ['datacard', 'propcard', 'balcony', 'timeline', 'simpleform', 'stepform', 'tabform', 'normaltable', 'tablecard', 'editor', 'line', 'bar', 'pie', 'scatter', 'sandbox']
    let types = {
      login: '登录',
      navbar: '导航栏',
@@ -33,6 +30,10 @@
      mainsearch: '搜索',
      group: '分组',
      menubar: '菜单'
    }
    if (appType !== 'mob') {
      options.push('editable', 'antvG6', 'antvX6', 'tree', 'dashboard', 'chart')
    }
    this.pasteFormRef.handleConfirm().then(res => {
@@ -52,19 +53,11 @@
        return
      }
      let copyBtns = new Map()
      res = MenuUtils.resetComponentConfig(res, copyBtns)
      res = MenuUtils.resetComponentConfig(res, appType)
      delete res.copyType
      
      this.props.insert(res)
      copyBtns = [...copyBtns.values()]
      if (copyBtns.length > 0) {
        MKEmitter.emit('copyButtons', copyBtns)
      }
      this.setState({visible: false})
@@ -81,7 +74,7 @@
    return (
      <div style={{display: 'inline-block'}}>
        <Icon type="snippets" style={{color: 'purple'}} onClick={() => {this.setState({visible: true})}} />
        <SnippetsOutlined style={{color: 'purple'}} onClick={() => {this.setState({visible: true})}} />
        <Modal
          title="粘贴"
          visible={visible}