| | |
| | | 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')) |
| | | |
| | |
| | | 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: '导航栏', |
| | |
| | | mainsearch: '搜索', |
| | | group: '分组', |
| | | menubar: '菜单' |
| | | } |
| | | |
| | | if (appType !== 'mob') { |
| | | options.push('editable', 'antvG6', 'antvX6', 'tree', 'dashboard', 'chart') |
| | | } |
| | | |
| | | this.pasteFormRef.handleConfirm().then(res => { |
| | |
| | | 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}) |
| | | |
| | |
| | | |
| | | 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} |