| | |
| | | const CardCellComponent = asyncComponent(() => import('../cardcellcomponent')) |
| | | const CopyComponent = asyncIconComponent(() => import('@/menu/components/share/copycomponent')) |
| | | const PasteComponent = asyncIconComponent(() => import('@/components/paste')) |
| | | const UserComponent = asyncIconComponent(() => import('@/menu/components/share/usercomponent')) |
| | | const ClockComponent = asyncIconComponent(() => import('@/menu/components/share/clockcomponent')) |
| | | |
| | | class BalconyEditComponent extends Component { |
| | |
| | | name: card.name, |
| | | subtype: card.subtype, |
| | | setting: { interType: 'system' }, |
| | | wrap: { name: card.name, width: card.width || 24, linkType: 'static', position: 'relative', datatype: 'static' }, |
| | | style: { marginLeft: '0px', marginRight: '0px', marginTop: '0px', marginBottom: '0px' }, |
| | | wrap: { name: card.name, width: card.width || 24, linkType: 'static', datatype: 'static' }, |
| | | style: { marginLeft: '0px', marginRight: '0px', marginTop: '0px', marginBottom: '0px', position: 'unset' }, |
| | | columns: [], |
| | | scripts: [], |
| | | elements: [], |
| | | } |
| | | |
| | | if (card.config) { |
| | | let config = fromJS(card.config).toJS() |
| | | |
| | | _card.wrap = config.wrap |
| | | _card.wrap.name = card.name |
| | | _card.style = config.style |
| | | |
| | | _card.setting = config.setting |
| | | _card.columns = config.columns |
| | | _card.scripts = config.scripts |
| | | |
| | | _card.elements = _card.elements.map(elem => { |
| | | elem.uuid = Utils.getuuid() |
| | | return elem |
| | | }) |
| | | } |
| | | |
| | | this.updateComponent(_card) |
| | | } else { |
| | | let _card = fromJS(card).toJS() |
| | | |
| | | if (!_card.style.position) { // 兼容 |
| | | if (_card.wrap.position === 'fixed' || _card.wrap.position === 'absolute') { |
| | | _card.style.position = _card.wrap.position |
| | | _card.style.zIndex = _card.wrap.position === 'fixed' ? 3 : 2 |
| | | _card.style.left = _card.wrap.left || '' |
| | | _card.style.right = _card.wrap.right || '' |
| | | _card.style.top = _card.wrap.top || '' |
| | | _card.style.bottom = _card.wrap.bottom || '' |
| | | _card.style.transform = _card.wrap.transform || '' |
| | | _card.style.width = _card.wrap.realwidth || '' |
| | | } else if (_card.wrap.left || _card.wrap.right || _card.wrap.top || _card.wrap.bottom) { |
| | | _card.style.position = 'relative' |
| | | _card.style.zIndex = 1 |
| | | _card.style.left = _card.wrap.left || '' |
| | | _card.style.right = _card.wrap.right || '' |
| | | _card.style.top = _card.wrap.top || '' |
| | | _card.style.bottom = _card.wrap.bottom || '' |
| | | } else { |
| | | _card.style.position = 'unset' |
| | | } |
| | | } |
| | | |
| | | this.setState({ |
| | | card: fromJS(card).toJS() |
| | | card: _card |
| | | }) |
| | | } |
| | | } |
| | |
| | | changeStyle = () => { |
| | | const { card } = this.state |
| | | |
| | | MKEmitter.emit('changeStyle', ['height', 'background', 'border', 'padding', 'margin', 'shadow', 'clear', 'minHeight'], card.style, this.getStyle) |
| | | MKEmitter.emit('changeStyle', ['width', 'height', 'background', 'border', 'padding', 'margin', 'shadow', 'clear', 'minHeight', 'position', 'transform'], card.style, this.getStyle) |
| | | } |
| | | |
| | | getStyle = (style) => { |
| | |
| | | updateWrap = (res) => { |
| | | delete res.quick |
| | | |
| | | res.linkType = res.linkType || 'static' |
| | | |
| | | let _card = {...this.state.card, wrap: res} |
| | | |
| | | if (res.datatype === 'public') { |
| | |
| | | |
| | | if (d) { |
| | | _card.columns = fromJS(d.columns).toJS() |
| | | |
| | | _card.setting = { interType: 'system' } |
| | | _card.scripts = [] |
| | | } |
| | | } |
| | | |
| | |
| | | <div className="mk-popover-control"> |
| | | <PlusOutlined className="plus" title="添加元素" onClick={this.addElement} /> |
| | | <PlusSquareOutlined className="plus" title="添加按钮" onClick={this.addButton} /> |
| | | <NormalForm title="浮动卡设置" width={850} update={this.updateWrap} getForms={this.getWrapForms}> |
| | | <NormalForm title="浮动卡设置" width={900} update={this.updateWrap} getForms={this.getWrapForms}> |
| | | <EditOutlined style={{color: '#1890ff'}} title="编辑"/> |
| | | </NormalForm> |
| | | <CopyComponent type="balcony" card={card}/> |
| | | <PasteComponent options={['action', 'customCardElement']} updateConfig={this.pasteComponent} /> |
| | | <FontColorsOutlined className="style" title="调整样式" onClick={this.changeStyle} /> |
| | | {card.wrap.datatype === 'dynamic' ? <ClockComponent config={card} updateConfig={this.updateComponent}/> : <ClockCircleOutlined style={{color: '#eeeeee', cursor: 'not-allowed'}}/>} |
| | | <UserComponent config={card}/> |
| | | <DeleteOutlined className="close" title="删除组件" onClick={() => this.props.deletecomponent(card.uuid)} /> |
| | | {card.wrap.datatype === 'dynamic' ? <SettingComponent config={card} updateConfig={this.updateComponent} /> : <SettingOutlined style={{color: '#eeeeee', cursor: 'not-allowed'}}/>} |
| | | </div> |