| | |
| | | import React, {Component} from 'react' |
| | | import PropTypes from 'prop-types' |
| | | import { is, fromJS } from 'immutable' |
| | | import { Icon, Modal, Popover } from 'antd' |
| | | import { Modal, Popover } from 'antd' |
| | | import { EditOutlined, CloseOutlined, PlusOutlined } from '@ant-design/icons' |
| | | |
| | | import Utils from '@/utils/utils.js' |
| | | import zhCN from '@/locales/zh-CN/model.js' |
| | | import enUS from '@/locales/en-US/model.js' |
| | | import { getCardDetailForm } from '@/templates/zshare/formconfig' |
| | | |
| | | import MkIcon from '@/components/mk-icon' |
| | | import DragDetail from './dragdetail' |
| | | import CardDetailForm from './carddetailform' |
| | | import avatar from '@/assets/img/avatar.png' |
| | |
| | | {card.subelement.includes('header') ? |
| | | <Popover overlayClassName="mk-popover-control-wrap" mouseLeaveDelay={0.2} mouseEnterDelay={0.2} content={ |
| | | <div className="mk-popover-control"> |
| | | <Icon className="edit" title="Edit" type="edit" onClick={this.editHeader} /> |
| | | <Icon className="close" title="close" type="close" onClick={() => this.deleteElem('header')} /> |
| | | <EditOutlined className="edit" onClick={this.editHeader} /> |
| | | <CloseOutlined className="close" onClick={() => this.deleteElem('header')} /> |
| | | </div> |
| | | } trigger="hover"> |
| | | <div className="ant-card-head"> |
| | |
| | | {card.header.actions && card.header.actions.length > 0 ? |
| | | <div className="ant-card-extra"> |
| | | <span> |
| | | {['icon', 'all'].includes(card.header.show) ? <Icon type={card.header.actions[0].icon || 'dash'}/> : null} |
| | | {['icon', 'all'].includes(card.header.show) ? <MkIcon type={card.header.actions[0].icon || 'dash'}/> : null} |
| | | {['text', 'all'].includes(card.header.show) ? card.header.actions[0].text : null} |
| | | </span> |
| | | </div> : null |
| | |
| | | } |
| | | <div className="ant-card-body"> |
| | | <div className="ant-card-meta" style={metastyle}> |
| | | <Icon type="plus" onClick={() => this.editdetail()} /> |
| | | <PlusOutlined onClick={() => this.editdetail()} /> |
| | | {card.subelement.includes('avatar') ? |
| | | <Popover overlayClassName="mk-popover-control-wrap" mouseLeaveDelay={0.2} mouseEnterDelay={0.2} content={ |
| | | <div className="mk-popover-control"> |
| | | <Icon className="edit" title="Edit" type="edit" onClick={this.editAvatar} /> |
| | | <Icon className="close" title="close" type="close" onClick={() => this.deleteElem('avatar')} /> |
| | | <EditOutlined className="edit" onClick={this.editAvatar} /> |
| | | <CloseOutlined className="close" onClick={() => this.deleteElem('avatar')} /> |
| | | </div> |
| | | } trigger="hover"> |
| | | <div className="ant-card-meta-avatar" style={card.avatar.type === 'icon' ? {width: card.avatar.width, paddingTop: card.avatar.width} : {width: card.avatar.width + '%', paddingTop: card.avatar.width + '%'}}> |
| | | <span className="ant-avatar ant-avatar-circle ant-avatar-image" style={{borderRadius: card.avatar.radius === 'true' ? '50%' : 0}}> |
| | | {card.avatar.type === 'picture' ? <img src={avatar} alt=""/> : null} |
| | | {card.avatar.type === 'icon' ? <Icon className={'font ' + card.avatar.color} style={{fontSize: card.avatar.size + 'px'}} type={card.avatar.icon} /> : null} |
| | | {card.avatar.type === 'icon' ? <MkIcon className={'font ' + card.avatar.color} style={{fontSize: card.avatar.size + 'px'}} type={card.avatar.icon} /> : null} |
| | | </span> |
| | | </div> |
| | | </Popover> : null |
| | |
| | | {card.subelement.includes('bottom') ? |
| | | <Popover overlayClassName="mk-popover-control-wrap" mouseLeaveDelay={0.2} mouseEnterDelay={0.2} content={ |
| | | <div className="mk-popover-control"> |
| | | <Icon className="edit" title="Edit" type="edit" onClick={this.editBottom} /> |
| | | <Icon className="close" title="close" type="close" onClick={() => this.deleteElem('bottom')} /> |
| | | <EditOutlined className="edit" onClick={this.editBottom} /> |
| | | <CloseOutlined className="close" onClick={() => this.deleteElem('bottom')} /> |
| | | </div> |
| | | } trigger="hover"> |
| | | <ul className="ant-card-actions"> |
| | | {card.bottom.actions.map((item, i) => (<li key={i} style={{width: _width}}> |
| | | <span> |
| | | {['icon', 'all'].includes(card.bottom.show) ? <Icon type={item.icon || 'dash'}/> : null} |
| | | {['icon', 'all'].includes(card.bottom.show) ? <MkIcon type={item.icon || 'dash'}/> : null} |
| | | {['text', 'all'].includes(card.bottom.show) ? item.text : null} |
| | | </span> |
| | | </li>))} |
| | |
| | | </div> |
| | | {card.extraAction ? |
| | | <div className={'ant-card chart-card chart-card-insert ' + outclass} style={{ width: cardwidth, height: cardheight }} > |
| | | <Icon type="plus" style={cardwidth > cardheight ? {fontSize: cardheight / 2 + 'px', lineHeight: cardheight + 'px'} : {fontSize: cardwidth / 2 + 'px', lineHeight: cardheight + 'px'}} /> |
| | | <PlusOutlined style={cardwidth > cardheight ? {fontSize: cardheight / 2 + 'px', lineHeight: cardheight + 'px'} : {fontSize: cardwidth / 2 + 'px', lineHeight: cardheight + 'px'}} /> |
| | | </div> : null |
| | | } |
| | | {/* 显示列编辑 */} |