import React, {Component} from 'react'
|
import PropTypes from 'prop-types'
|
import { is, fromJS } from 'immutable'
|
import { Collapse, Form, Col, Icon, InputNumber, Select, Radio, Drawer, Button } from 'antd'
|
|
import MKEmitter from '@/utils/events.js'
|
import zhCN from '@/locales/zh-CN/mob.js'
|
import enUS from '@/locales/en-US/mob.js'
|
import asyncComponent from '@/utils/asyncComponent'
|
import StyleInput from './styleInput'
|
import './index.scss'
|
|
const { Panel } = Collapse
|
const { Option } = Select
|
const ColorSketch = asyncComponent(() => import('@/mob/colorsketch'))
|
const SourceComponent = asyncComponent(() => import('@/menu/components/share/sourcecomponent'))
|
|
class MobController extends Component {
|
static propTpyes = {
|
editElem: PropTypes.any,
|
updateStyle: PropTypes.func,
|
}
|
|
state = {
|
dict: sessionStorage.getItem('lang') !== 'en-US' ? zhCN : enUS,
|
card: null,
|
comIds: [],
|
backgroundImage: '',
|
options: [],
|
borposition: 'outer'
|
}
|
|
shouldComponentUpdate (nextProps, nextState) {
|
return !is(fromJS(this.state), fromJS(nextState))
|
}
|
|
componentDidMount () {
|
MKEmitter.addListener('changeStyle', this.initStyle)
|
}
|
|
/**
|
* @description 组件销毁,清除state更新,清除快捷键设置
|
*/
|
componentWillUnmount () {
|
this.setState = () => {
|
return
|
}
|
MKEmitter.removeListener('changeStyle', this.initStyle)
|
}
|
|
initStyle = (comIds, options, style = {}) => {
|
let backgroundImage = ''
|
if (style.backgroundImage && /^url/ig.test(style.backgroundImage)) {
|
backgroundImage = style.backgroundImage.replace(/^url\(/ig, '').replace(/\)$/ig, '')
|
}
|
|
this.setState({
|
visible: true,
|
comIds: comIds,
|
card: fromJS(style).toJS(),
|
options: options,
|
borposition: 'outer',
|
backgroundImage
|
})
|
}
|
|
onCloseDrawer = () => {
|
let { card } = this.state
|
|
let check = false
|
if (card.borderWidth === '0px') {
|
delete card.borderWidth
|
delete card.borderColor
|
check = true
|
} else if (card.borderLeftWidth === '0px') {
|
delete card.borderLeftWidth
|
delete card.borderLeftColor
|
check = true
|
} else if (card.borderRightWidth === '0px') {
|
delete card.borderRightWidth
|
delete card.borderRightWidth
|
check = true
|
} else if (card.borderTopWidth === '0px') {
|
delete card.borderTopWidth
|
delete card.borderTopWidth
|
check = true
|
} else if (card.borderBottomWidth === '0px') {
|
delete card.borderBottomWidth
|
delete card.borderBottomWidth
|
check = true
|
}
|
|
if (check) {
|
MKEmitter.emit('submitStyle', this.state.comIds, card)
|
}
|
|
this.setState({
|
visible: false,
|
comIds: [],
|
card: null,
|
options: [],
|
backgroundImage: ''
|
})
|
}
|
|
updateStyle = (style) => {
|
const { comIds, card } = this.state
|
|
let _style = {
|
...card,
|
...style
|
}
|
|
this.setState({
|
card: _style,
|
})
|
|
MKEmitter.emit('submitStyle', comIds, _style)
|
}
|
|
/**
|
* @description 字体大小切换,超出范围忽略
|
*/
|
changeFontSize = (val) => {
|
let value = parseInt(val)
|
|
if (isNaN(value) || value < 12 || value > 100) return
|
|
this.updateStyle({fontSize: `${value}px`})
|
}
|
|
/**
|
* @description 修改行间距,超出范围忽略
|
*/
|
changeLineHeight = (val) => {
|
let value = parseFloat(val)
|
|
if (isNaN(value) || value < 1 || value > 10) return
|
|
this.updateStyle({lineHeight: value})
|
}
|
|
/**
|
* @description 字体间距修改,超出范围忽略
|
*/
|
changeLetterSpacing = (val) => {
|
let value = parseFloat(val)
|
|
if (isNaN(value) || value < 0 || value > 100) return
|
|
this.updateStyle({letterSpacing: `${value}px`})
|
}
|
|
/**
|
* @description 修改字体粗细
|
*/
|
boldChange = (val) => {
|
this.updateStyle({fontWeight: val})
|
}
|
|
/**
|
* @description 修改字体颜色 ,颜色控件
|
*/
|
changeFontColor = (val) => {
|
this.updateStyle({color: val})
|
}
|
|
/**
|
* @description 字体对齐
|
*/
|
changeTextAlign = (e) => {
|
this.updateStyle({textAlign: e.target.value})
|
}
|
|
/**
|
* @description 字体样式,倾斜
|
*/
|
changeFontStyle = (e) => {
|
this.updateStyle({fontStyle: e.target.value})
|
}
|
|
/**
|
* @description 字体装饰,下划线、贯穿线、上划线
|
*/
|
changeTextDecoration = (e) => {
|
this.updateStyle({textDecoration: e.target.value})
|
}
|
|
/**
|
* @description 修改背景颜色 ,颜色控件
|
*/
|
changeBackgroundColor = (val) => {
|
this.updateStyle({backgroundColor: val})
|
}
|
|
/**
|
* @description 修改阴影颜色 ,颜色控件
|
*/
|
changeShadowColor = (val) => {
|
this.updateStyle({shadow: val})
|
}
|
|
imgChange = (val) => {
|
this.setState({
|
backgroundImage: val
|
})
|
if (val) {
|
this.updateStyle({backgroundImage: `url(${val})`})
|
} else {
|
this.updateStyle({backgroundImage: ''})
|
}
|
}
|
|
changeBorderStyle = (val) => {
|
const { borposition } = this.state
|
let _style = {}
|
|
if (borposition === 'outer') {
|
_style.borderStyle = val
|
} else if (borposition === 'left') {
|
_style.borderLeftStyle = val
|
} else if (borposition === 'right') {
|
_style.borderRightStyle = val
|
} else if (borposition === 'top') {
|
_style.borderTopStyle = val
|
} else if (borposition === 'bottom') {
|
_style.borderBottomStyle = val
|
}
|
|
this.updateStyle(_style)
|
}
|
|
changeBorderWidth = (val) => {
|
const { borposition } = this.state
|
let _style = {}
|
|
if (borposition === 'outer') {
|
_style.borderWidth = val
|
} else if (borposition === 'left') {
|
_style.borderLeftWidth = val
|
} else if (borposition === 'right') {
|
_style.borderRightWidth = val
|
} else if (borposition === 'top') {
|
_style.borderTopWidth = val
|
} else if (borposition === 'bottom') {
|
_style.borderBottomWidth = val
|
}
|
|
this.updateStyle(_style)
|
}
|
|
changeBorderColor = (val) => {
|
const { borposition } = this.state
|
let _style = {}
|
|
if (borposition === 'outer') {
|
_style.borderColor = val
|
} else if (borposition === 'left') {
|
_style.borderLeftColor = val
|
} else if (borposition === 'right') {
|
_style.borderRightColor = val
|
} else if (borposition === 'top') {
|
_style.borderTopColor = val
|
} else if (borposition === 'bottom') {
|
_style.borderBottomColor = val
|
}
|
|
this.updateStyle(_style)
|
}
|
|
changeWidth = (val) => {
|
let _val = val
|
if (_val === '0px') {
|
_val = 'auto'
|
}
|
|
this.updateStyle({width: _val})
|
}
|
|
changeHeight = (val) => {
|
let _val = val
|
if (_val === '0px') {
|
_val = 'auto'
|
}
|
|
this.updateStyle({height: _val})
|
}
|
|
changeNormalStyle = (val, type) => {
|
this.updateStyle({[type]: val})
|
}
|
|
render () {
|
const { card, options, backgroundImage, borposition } = this.state
|
const formItemLayout = {
|
labelCol: {
|
xs: { span: 24 },
|
sm: { span: 8 }
|
},
|
wrapperCol: {
|
xs: { span: 24 },
|
sm: { span: 16 }
|
}
|
}
|
|
return (
|
<Drawer
|
title={
|
<div className="header-logo">
|
<img src={window.GLOB.mainlogo} alt=""/>
|
</div>
|
}
|
placement="left"
|
width="300"
|
className="menu-style-drawer"
|
closable={true}
|
maskClosable={false}
|
onClose={this.onCloseDrawer}
|
maskStyle={{opacity: 0.1}}
|
visible={this.state.visible}
|
>
|
<div className="menu-style-controller">
|
<Form {...formItemLayout}>
|
{card ? <Collapse expandIconPosition="right" destroyInactivePanel={true} defaultActiveKey={options[0]}>
|
{options.includes('width') ? <Panel header="宽度" key="width">
|
<Col span={24}>
|
<Form.Item
|
colon={false}
|
label={<Icon title="宽度" type="column-width" />}
|
labelCol={{xs: { span: 24 }, sm: { span: 4 }}} wrapperCol={ {xs: { span: 24 }, sm: { span: 20 }} }
|
>
|
<StyleInput defaultValue={card.width || ''} options={['px']} onChange={this.changeWidth}/>
|
</Form.Item>
|
</Col>
|
</Panel> : null}
|
{options.includes('height') ? <Panel header="高度" key="height">
|
<Col span={24}>
|
<Form.Item
|
colon={false}
|
label={<Icon title="高度" type="column-height" />}
|
labelCol={{xs: { span: 24 }, sm: { span: 4 }}} wrapperCol={ {xs: { span: 24 }, sm: { span: 20 }} }
|
>
|
<StyleInput defaultValue={card.height || ''} options={['px']} onChange={this.changeHeight}/>
|
</Form.Item>
|
</Col>
|
</Panel> : null}
|
{options.includes('font') ? <Panel header="字体" key="font">
|
<Col span={12}>
|
<Form.Item colon={false} label={<Icon title="字体大小" type="font-size" />}>
|
<InputNumber defaultValue={card.fontSize || 14} min={12} max={100} precision={0} onChange={this.changeFontSize} />
|
</Form.Item>
|
</Col>
|
<Col span={12}>
|
<Form.Item colon={false} label={<Icon title="字体粗细" type="bold" />}>
|
<Select defaultValue={card.fontWeight || 'normal'} onChange={this.boldChange}>
|
<Option value="normal">normal</Option>
|
<Option value="bold">bold</Option>
|
<Option value="bolder">bolder</Option>
|
<Option value="lighter">lighter</Option>
|
<Option value="100">100</Option>
|
<Option value="200">200</Option>
|
<Option value="300">300</Option>
|
<Option value="400">400</Option>
|
<Option value="500">500</Option>
|
<Option value="600">600</Option>
|
<Option value="700">700</Option>
|
<Option value="800">800</Option>
|
<Option value="900">900</Option>
|
</Select>
|
</Form.Item>
|
</Col>
|
<Col span={12}>
|
<Form.Item colon={false} label={<Icon title="行高" type="line-height" />}>
|
<InputNumber defaultValue={card.lineHeight || 1.5} min={1} max={10} precision={1} onChange={this.changeLineHeight} />
|
</Form.Item>
|
</Col>
|
<Col span={12}>
|
<Form.Item colon={false} label={<Icon title="字间距" type="column-width" />}>
|
<InputNumber defaultValue={card.letterSpacing || 0} min={0} max={100} precision={0} onChange={this.changeLetterSpacing}/>
|
</Form.Item>
|
</Col>
|
<Col span={24}>
|
<Form.Item
|
colon={false}
|
label={<Icon title="字体颜色" type="font-colors" />}
|
labelCol={{xs: { span: 24 }, sm: { span: 4 }}} wrapperCol={ {xs: { span: 24 }, sm: { span: 20 }} }
|
>
|
<ColorSketch value={card.color || 'rgba(0, 0, 0, 0.85)'} onChange={this.changeFontColor} />
|
</Form.Item>
|
</Col>
|
<Col span={24}>
|
<Form.Item
|
colon={false}
|
label={' '}
|
labelCol={{xs: { span: 24 }, sm: { span: 4 }}} wrapperCol={ {xs: { span: 24 }, sm: { span: 20 }} }
|
>
|
<Radio.Group defaultValue={card.fontStyle || 'normal'} onChange={this.changeFontStyle}>
|
<Radio.Button value="normal"><span title="标准">N</span></Radio.Button>
|
<Radio.Button value="italic"><Icon title="斜体" type="italic" /></Radio.Button>
|
<Radio.Button value="oblique" style={{fontStyle: 'oblique'}}><span title="倾斜">B</span></Radio.Button>
|
</Radio.Group>
|
</Form.Item>
|
</Col>
|
<Col span={24}>
|
<Form.Item
|
colon={false}
|
label={' '}
|
labelCol={{xs: { span: 24 }, sm: { span: 4 }}} wrapperCol={ {xs: { span: 24 }, sm: { span: 20 }} }
|
>
|
<Radio.Group className="text-align" defaultValue={card.textAlign || 'left'} onChange={this.changeTextAlign}>
|
<Radio.Button value="left"><Icon title="左对齐" type="align-left" /></Radio.Button>
|
<Radio.Button value="center"><Icon title="居中对齐" type="align-center" /></Radio.Button>
|
<Radio.Button value="right"><Icon title="右对齐" type="align-right" /></Radio.Button>
|
</Radio.Group>
|
</Form.Item>
|
</Col>
|
<Col span={24}>
|
<Form.Item
|
colon={false}
|
label={' '}
|
labelCol={{xs: { span: 24 }, sm: { span: 4 }}} wrapperCol={ {xs: { span: 24 }, sm: { span: 20 }} }
|
>
|
<Radio.Group className="text-decoration" defaultValue={card.textDecoration || 'none'} onChange={this.changeTextDecoration}>
|
<Radio.Button value="none"><span title="标准">N</span></Radio.Button>
|
<Radio.Button value="underline"><Icon title="下划线" type="underline" /></Radio.Button>
|
<Radio.Button value="line-through"><Icon title="中划线" type="strikethrough" /></Radio.Button>
|
<Radio.Button value="overline" style={{textDecoration: 'overline'}}><span title="上划线">O</span></Radio.Button>
|
</Radio.Group>
|
</Form.Item>
|
</Col>
|
</Panel> : null}
|
{options.includes('background') || options.includes('backgroundColor') ? <Panel header="背景" key="background">
|
<Col span={24}>
|
<Form.Item
|
colon={false}
|
label={<Icon title="背景颜色" type="bg-colors" />}
|
labelCol={{xs: { span: 24 }, sm: { span: 4 }}} wrapperCol={ {xs: { span: 24 }, sm: { span: 20 }} }
|
>
|
<ColorSketch value={card.backgroundColor || '#ffffff'} onChange={this.changeBackgroundColor} />
|
</Form.Item>
|
</Col>
|
{!options.includes('backgroundColor') ? <Col span={24}>
|
<Form.Item
|
colon={false}
|
label={<Icon title="背景图片" type="picture" />}
|
labelCol={{xs: { span: 24 }, sm: { span: 4 }}} wrapperCol={ {xs: { span: 24 }, sm: { span: 20 }} }
|
>
|
<SourceComponent value={backgroundImage} type="" placement="right" onChange={this.imgChange}/>
|
</Form.Item>
|
</Col> : null}
|
</Panel> : null}
|
{options.includes('border') ? <Panel header="边框" key="border">
|
<Col span={24}>
|
<Form.Item
|
colon={false}
|
label={<Icon title="边框位置" type="border" />}
|
labelCol={{xs: { span: 24 }, sm: { span: 4 }}} wrapperCol={ {xs: { span: 24 }, sm: { span: 20 }} }
|
>
|
<Radio.Group className="border-position" defaultValue={'outer'} onChange={(e) => this.setState({borposition: e.target.value})}>
|
<Radio value="outer"><Icon title="外边框" type="border-outer" /></Radio>
|
<Radio value="left"><Icon title="左边框" type="border-left" /></Radio>
|
<Radio value="right"><Icon title="右边框" type="border-right" /></Radio>
|
<Radio value="top"><Icon title="上边框" type="border-top" /></Radio>
|
<Radio value="bottom"><Icon title="下边框" type="border-bottom" /></Radio>
|
</Radio.Group>
|
</Form.Item>
|
</Col>
|
<Col span={24}>
|
<Form.Item
|
colon={false}
|
label={<Icon title="边框样式" type="border-outer" />}
|
labelCol={{xs: { span: 24 }, sm: { span: 4 }}} wrapperCol={ {xs: { span: 24 }, sm: { span: 20 }} }
|
>
|
{borposition === 'outer' ? <Select defaultValue={card.borderStyle || 'solid'} onChange={this.changeBorderStyle}>
|
<Option value="solid">实线</Option>
|
<Option value="dotted">点划线</Option>
|
<Option value="dashed">虚线</Option>
|
<Option value="double">双线</Option>
|
</Select> : null}
|
{borposition === 'left' ? <Select defaultValue={card.borderLeftStyle || 'solid'} onChange={this.changeBorderStyle}>
|
<Option value="solid">实线</Option>
|
<Option value="dotted">点划线</Option>
|
<Option value="dashed">虚线</Option>
|
<Option value="double">双线</Option>
|
</Select> : null}
|
{borposition === 'right' ? <Select defaultValue={card.borderRightStyle || 'solid'} onChange={this.changeBorderStyle}>
|
<Option value="solid">实线</Option>
|
<Option value="dotted">点划线</Option>
|
<Option value="dashed">虚线</Option>
|
<Option value="double">双线</Option>
|
</Select> : null}
|
{borposition === 'top' ? <Select defaultValue={card.borderTopStyle || 'solid'} onChange={this.changeBorderStyle}>
|
<Option value="solid">实线</Option>
|
<Option value="dotted">点划线</Option>
|
<Option value="dashed">虚线</Option>
|
<Option value="double">双线</Option>
|
</Select> : null}
|
{borposition === 'bottom' ? <Select defaultValue={card.borderBottomStyle || 'solid'} onChange={this.changeBorderStyle}>
|
<Option value="solid">实线</Option>
|
<Option value="dotted">点划线</Option>
|
<Option value="dashed">虚线</Option>
|
<Option value="double">双线</Option>
|
</Select> : null}
|
</Form.Item>
|
</Col>
|
<Col span={24}>
|
<Form.Item
|
colon={false}
|
label={<Icon title="边框宽度" type="column-width" />}
|
labelCol={{xs: { span: 24 }, sm: { span: 4 }}} wrapperCol={ {xs: { span: 24 }, sm: { span: 20 }} }
|
>
|
{borposition === 'outer' ? <StyleInput defaultValue={card.borderWidth || '0px'} options={['px']} onChange={this.changeBorderWidth}/> : null}
|
{borposition === 'left' ? <StyleInput defaultValue={card.borderLeftWidth || '0px'} options={['px']} onChange={this.changeBorderWidth}/> : null}
|
{borposition === 'right' ? <StyleInput defaultValue={card.borderRightWidth || '0px'} options={['px']} onChange={this.changeBorderWidth}/> : null}
|
{borposition === 'top' ? <StyleInput defaultValue={card.borderTopWidth || '0px'} options={['px']} onChange={this.changeBorderWidth}/> : null}
|
{borposition === 'bottom' ? <StyleInput defaultValue={card.borderBottomWidth || '0px'} options={['px']} onChange={this.changeBorderWidth}/> : null}
|
</Form.Item>
|
</Col>
|
<Col span={24}>
|
<Form.Item
|
colon={false}
|
label={<Icon title="边框颜色" type="bg-colors" />}
|
labelCol={{xs: { span: 24 }, sm: { span: 4 }}} wrapperCol={ {xs: { span: 24 }, sm: { span: 20 }} }
|
>
|
{borposition === 'outer' ? <ColorSketch defaultValue={card.borderColor || 'transparent'} onChange={this.changeBorderColor} /> : null}
|
{borposition === 'left' ? <ColorSketch defaultValue={card.borderLeftColor || 'transparent'} onChange={this.changeBorderColor} /> : null}
|
{borposition === 'right' ? <ColorSketch defaultValue={card.borderRightColor || 'transparent'} onChange={this.changeBorderColor} /> : null}
|
{borposition === 'top' ? <ColorSketch defaultValue={card.borderTopColor || 'transparent'} onChange={this.changeBorderColor} /> : null}
|
{borposition === 'bottom' ? <ColorSketch defaultValue={card.borderBottomColor || 'transparent'} onChange={this.changeBorderColor} /> : null}
|
</Form.Item>
|
</Col>
|
<Col span={24}>
|
<Form.Item
|
colon={false}
|
label={<Icon title="圆角" type="radius-setting" />}
|
labelCol={{xs: { span: 24 }, sm: { span: 4 }}} wrapperCol={ {xs: { span: 24 }, sm: { span: 20 }} }
|
>
|
<StyleInput defaultValue={card.borderRadius || '0px'} options={['px', '%']} onChange={(val) => this.changeNormalStyle(val, 'borderRadius')}/>
|
</Form.Item>
|
</Col>
|
</Panel> : null}
|
{options.includes('shadow') ? <Panel header="阴影" key="shadow">
|
<Col span={24}>
|
<Form.Item
|
colon={false}
|
label={<Icon title="阴影颜色" type="bg-colors" />}
|
labelCol={{xs: { span: 24 }, sm: { span: 4 }}} wrapperCol={ {xs: { span: 24 }, sm: { span: 20 }} }
|
>
|
<ColorSketch value={card.shadow || 'transparent'} onChange={this.changeShadowColor} />
|
</Form.Item>
|
</Col>
|
</Panel> : null}
|
{options.includes('margin') ? <Panel header="外边距" key="margin">
|
<Col span={24}>
|
<Form.Item
|
colon={false}
|
label={<Icon title="上边距" type="arrow-up"/>}
|
labelCol={{xs: { span: 24 }, sm: { span: 4 }}} wrapperCol={ {xs: { span: 24 }, sm: { span: 20 }} }
|
>
|
<StyleInput defaultValue={card.marginTop || '0px'} options={['px', 'vh', 'vw']} onChange={(val) => this.changeNormalStyle(val, 'marginTop')}/>
|
</Form.Item>
|
</Col>
|
<Col span={24}>
|
<Form.Item
|
colon={false}
|
label={<Icon title="下边距" type="arrow-down"/>}
|
labelCol={{xs: { span: 24 }, sm: { span: 4 }}} wrapperCol={ {xs: { span: 24 }, sm: { span: 20 }} }
|
>
|
<StyleInput defaultValue={card.marginBottom || '0px'} options={['px', 'vh', 'vw']} onChange={(val) => this.changeNormalStyle(val, 'marginBottom')}/>
|
</Form.Item>
|
</Col>
|
<Col span={24}>
|
<Form.Item
|
colon={false}
|
label={<Icon title="左边距" type="arrow-left"/>}
|
labelCol={{xs: { span: 24 }, sm: { span: 4 }}} wrapperCol={ {xs: { span: 24 }, sm: { span: 20 }} }
|
>
|
<StyleInput defaultValue={card.marginLeft || '0px'} options={['px', 'vh', 'vw']} onChange={(val) => this.changeNormalStyle(val, 'marginLeft')}/>
|
</Form.Item>
|
</Col>
|
<Col span={24}>
|
<Form.Item
|
colon={false}
|
label={<Icon title="右边距" type="arrow-right"/>}
|
labelCol={{xs: { span: 24 }, sm: { span: 4 }}} wrapperCol={ {xs: { span: 24 }, sm: { span: 20 }} }
|
>
|
<StyleInput defaultValue={card.marginRight || '0px'} options={['px', 'vh', 'vw']} onChange={(val) => this.changeNormalStyle(val, 'marginRight')}/>
|
</Form.Item>
|
</Col>
|
</Panel> : null}
|
{options.includes('padding') ? <Panel header="内边距" key="padding">
|
<Col span={24}>
|
<Form.Item
|
colon={false}
|
label={<Icon title="上边距" type="arrow-up"/>}
|
labelCol={{xs: { span: 24 }, sm: { span: 4 }}} wrapperCol={ {xs: { span: 24 }, sm: { span: 20 }} }
|
>
|
<StyleInput defaultValue={card.paddingTop || '0px'} options={['px', 'vh', 'vw']} onChange={(val) => this.changeNormalStyle(val, 'paddingTop')}/>
|
</Form.Item>
|
</Col>
|
<Col span={24}>
|
<Form.Item
|
colon={false}
|
label={<Icon title="下边距" type="arrow-down"/>}
|
labelCol={{xs: { span: 24 }, sm: { span: 4 }}} wrapperCol={ {xs: { span: 24 }, sm: { span: 20 }} }
|
>
|
<StyleInput defaultValue={card.paddingBottom || '0px'} options={['px', 'vh', 'vw']} onChange={(val) => this.changeNormalStyle(val, 'paddingBottom')}/>
|
</Form.Item>
|
</Col>
|
<Col span={24}>
|
<Form.Item
|
colon={false}
|
label={<Icon title="左边距" type="arrow-left"/>}
|
labelCol={{xs: { span: 24 }, sm: { span: 4 }}} wrapperCol={ {xs: { span: 24 }, sm: { span: 20 }} }
|
>
|
<StyleInput defaultValue={card.paddingLeft || '0px'} options={['px', 'vh', 'vw']} onChange={(val) => this.changeNormalStyle(val, 'paddingLeft')}/>
|
</Form.Item>
|
</Col>
|
<Col span={24}>
|
<Form.Item
|
colon={false}
|
label={<Icon title="右边距" type="arrow-right"/>}
|
labelCol={{xs: { span: 24 }, sm: { span: 4 }}} wrapperCol={ {xs: { span: 24 }, sm: { span: 20 }} }
|
>
|
<StyleInput defaultValue={card.paddingRight || '0px'} options={['px', 'vh', 'vw']} onChange={(val) => this.changeNormalStyle(val, 'paddingRight')}/>
|
</Form.Item>
|
</Col>
|
</Panel> : null}
|
{options.includes('float') ? <Panel header="浮动" key="float">
|
<Col span={24}>
|
<Form.Item
|
colon={false}
|
label={<Icon title="浮动" type="swap" />}
|
labelCol={{xs: { span: 24 }, sm: { span: 4 }}} wrapperCol={ {xs: { span: 24 }, sm: { span: 20 }} }
|
>
|
<Radio.Group defaultValue={card.float || 'left'} onChange={(e) => this.changeNormalStyle(e.target.value, 'float')}>
|
<Radio value="left">左浮动</Radio>
|
<Radio value="right">右浮动</Radio>
|
<Radio value="none">不浮动</Radio>
|
</Radio.Group>
|
</Form.Item>
|
</Col>
|
</Panel> : null}
|
</Collapse> : null}
|
</Form>
|
<div style={{textAlign: 'right'}}>
|
<Button style={{margin: '30px 10px 30px 0px'}} onClick={this.onCloseDrawer}>关闭</Button>
|
</div>
|
</div>
|
</Drawer>
|
)
|
}
|
}
|
|
export default MobController
|