| | |
| | | import PropTypes from 'prop-types' |
| | | import {connect} from 'react-redux' |
| | | import { is, fromJS } from 'immutable' |
| | | import { Icon, Popover } from 'antd' |
| | | import { Icon, Popover, Switch } from 'antd' |
| | | |
| | | import asyncComponent from '@/utils/asyncComponent' |
| | | import asyncIconComponent from '@/utils/asyncIconComponent' |
| | |
| | | |
| | | const SettingComponent = asyncIconComponent(() => import('@/menu/datasource')) |
| | | const WrapComponent = asyncIconComponent(() => import('./wrapsetting')) |
| | | const ActionComponent = asyncComponent(() => import('@/menu/actioncomponent')) |
| | | // const ActionComponent = asyncComponent(() => import('@/menu/actioncomponent')) |
| | | const CardCellComponent = asyncComponent(() => import('../cardcellcomponent')) |
| | | |
| | | class antvBarLineChart extends Component { |
| | |
| | | |
| | | state = { |
| | | dict: localStorage.getItem('lang') !== 'en-US' ? zhCN : enUS, |
| | | card: null |
| | | card: null, |
| | | back: false |
| | | } |
| | | |
| | | UNSAFE_componentWillMount () { |
| | |
| | | subtype: card.subtype, |
| | | setting: { interType: 'system' }, |
| | | wrap: { name: card.name, width: 24, cardWidth: 6, addable: 'false', switch: 'false' }, |
| | | style: { marginLeft: '8px', marginRight: '8px', marginTop: '8px', marginBottom: '8px' }, |
| | | columns: [], |
| | | scripts: [], |
| | | action: [], |
| | | // action: [], |
| | | elements: [] |
| | | } |
| | | this.setState({ |
| | |
| | | } |
| | | |
| | | componentDidMount () { |
| | | |
| | | MKEmitter.addListener('submitStyle', this.getStyle) |
| | | } |
| | | |
| | | shouldComponentUpdate (nextProps, nextState) { |
| | |
| | | this.setState = () => { |
| | | return |
| | | } |
| | | MKEmitter.removeListener('submitStyle', this.getStyle) |
| | | } |
| | | |
| | | updateComponent = (component) => { |
| | |
| | | } |
| | | |
| | | changeStyle = () => { |
| | | // MKEmitter.emit('changeStyle', card.uuid, newcard) |
| | | const { card } = this.state |
| | | |
| | | MKEmitter.emit('changeStyle', [card.uuid], ['font', 'background', 'border'], {}) |
| | | } |
| | | |
| | | changeOutStyle = () => { |
| | | const { card } = this.state |
| | | |
| | | MKEmitter.emit('changeStyle', [card.uuid], ['background', 'border', 'padding', 'margin'], card.style) |
| | | } |
| | | |
| | | getStyle = (comIds, style) => { |
| | | const { card } = this.state |
| | | |
| | | if (comIds[0] !== card.uuid) return |
| | | |
| | | this.setState({ |
| | | card: {...card, style} |
| | | }) |
| | | console.log(style) |
| | | } |
| | | |
| | | changeSide = () => { |
| | | this.setState(prev => ({ back: !prev.back })) |
| | | } |
| | | |
| | | render() { |
| | | const { card } = this.state |
| | | |
| | | return ( |
| | | <div className="menu-data-card-edit-box"> |
| | | <div className="menu-data-card-edit-box" style={card.style}> |
| | | <Popover overlayClassName="mk-popover-control-wrap" mouseLeaveDelay={0.2} mouseEnterDelay={0.2} content={ |
| | | <div className="mk-popover-control"> |
| | | <WrapComponent config={card} updateConfig={this.updateComponent} /> |
| | | <Icon className="style" title="调整样式" onClick={this.changeOutStyle} type="font-colors" /> |
| | | <Icon className="close" title="delete" type="delete" onClick={() => this.props.deletecomponent(card.uuid)} /> |
| | | <SettingComponent config={card} updateConfig={this.updateComponent} /> |
| | | </div> |
| | |
| | | </Popover> |
| | | <div className={'ant-col card-item ant-col-' + (card.wrap.cardWidth || 6)} style={{height: card.wrap.height ? card.wrap.height + 'px' : 'auto'}}> |
| | | <CardCellComponent config={card} updateElement={this.updateComponent}/> |
| | | <ActionComponent plus="false" config={card} updateaction={this.updateComponent}/> |
| | | {/* <ActionComponent plus="false" config={card} updateaction={this.updateComponent}/> */} |
| | | <div className="card-control"> |
| | | <Popover overlayClassName="mk-popover-control-wrap" mouseLeaveDelay={0.2} mouseEnterDelay={0.2} content={ |
| | | <div className="mk-popover-control"> |
| | | <Icon className="plus" title="添加元素" onClick={this.addElement} type="plus" /> |
| | | <Icon className="plus" title="添加按钮" onClick={this.addButton} type="plus-square" /> |
| | | <Icon className="style" title="调整样式" onClick={this.changeStyle} type="font-colors" /> |
| | | <Switch size="small" onClick={this.changeSide} defaultChecked /> |
| | | </div> |
| | | } trigger="hover"> |
| | | <Icon type="tool" /> |