From f6a1ab6a58215cf7546976a86eb6face1a7be32f Mon Sep 17 00:00:00 2001
From: king <18310653075@163.com>
Date: 星期五, 30 七月 2021 15:37:17 +0800
Subject: [PATCH] 2021-07-30

---
 src/menu/stylecontroller/index.jsx |  473 ++++++++++++++++++++++++++++++++++++++++++++++++++--------
 1 files changed, 407 insertions(+), 66 deletions(-)

diff --git a/src/menu/stylecontroller/index.jsx b/src/menu/stylecontroller/index.jsx
index bd24434..d1c5585 100644
--- a/src/menu/stylecontroller/index.jsx
+++ b/src/menu/stylecontroller/index.jsx
@@ -1,18 +1,19 @@
 import React, {Component} from 'react'
 import PropTypes from 'prop-types'
 import { is, fromJS } from 'immutable'
-import { Collapse, Form, Input, Col, Icon, InputNumber, Select, Radio, Drawer } from 'antd'
+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 ColorSketch from '@/mob/colorsketch'
+import asyncComponent from '@/utils/asyncComponent'
 import StyleInput from './styleInput'
-import FileUpload from '@/tabviews/zshare/fileupload'
 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 = {
@@ -21,12 +22,12 @@
   }
 
   state = {
-    dict: localStorage.getItem('lang') !== 'en-US' ? zhCN : enUS,
+    dict: sessionStorage.getItem('lang') !== 'en-US' ? zhCN : enUS,
     card: null,
     comIds: [],
-    bgimages: [],
     backgroundImage: '',
     options: [],
+    borposition: 'outer'
   }
 
   shouldComponentUpdate (nextProps, nextState) {
@@ -49,12 +50,8 @@
 
   initStyle = (comIds, options, style = {}) => {
     let backgroundImage = ''
-    if (style.backgroundImage) {
-      if (/^url/ig.test(style.backgroundImage)) {
-        backgroundImage = style.backgroundImage.replace(/^url\(/ig, '').replace(/\)$/ig, '')
-      } else if (/^linear-gradient/ig.test(style.backgroundImage)) {
-        backgroundImage = style.backgroundImage.replace(/^linear-gradient\(/ig, '').replace(/\)$/ig, '')
-      }
+    if (style.backgroundImage && /^url/ig.test(style.backgroundImage)) {
+      backgroundImage = style.backgroundImage.replace(/^url\(/ig, '').replace(/\)$/ig, '')
     }
 
     this.setState({
@@ -62,11 +59,41 @@
       comIds: comIds,
       card: fromJS(style).toJS(),
       options: options,
+      borposition: 'outer',
       backgroundImage
     })
   }
 
   onCloseDrawer = () => {
+    let card = fromJS(this.state.card).toJS()
+
+    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.borderRightColor
+      check = true
+    } else if (card.borderTopWidth === '0px') {
+      delete card.borderTopWidth
+      delete card.borderTopColor
+      check = true
+    } else if (card.borderBottomWidth === '0px') {
+      delete card.borderBottomWidth
+      delete card.borderBottomColor
+      check = true
+    }
+
+    if (check) {
+      MKEmitter.emit('submitStyle', this.state.comIds, card)
+    }
+
     this.setState({
       visible: false,
       comIds: [],
@@ -166,49 +193,163 @@
     this.updateStyle({backgroundColor: val})
   }
 
-  imgChange = (list) => {
-    if (list[0] && list[0].response) {
-      this.setState({
-        bgimages: [],
-        backgroundImage: list[0].response
-      })
-      this.updateStyle({backgroundImage: `url(${list[0].response})`})
+  /**
+   * @description 淇敼鑳屾櫙澶у皬
+   */
+  changeBackgroundSize = (val) => {
+    this.updateStyle({backgroundSize: val})
+  }
+
+  /**
+   * @description 淇敼鑳屾櫙浣嶇疆
+   */
+  changeBackgroundPositon= (val) => {
+    this.updateStyle({backgroundPositon: val})
+  }
+
+  /**
+   * @description 淇敼鑳屾櫙閲嶅璁剧疆
+   */
+  changeBackgroundRepeat = (val) => {
+    this.updateStyle({backgroundRepeat: val})
+  }
+
+  /**
+   * @description 淇敼闃村奖棰滆壊 锛岄鑹叉帶浠�
+   */
+  changeShadowColor = (val) => {
+    const { card } = this.state
+
+    let boxShadow = `${card.hShadow || '0px'} ${card.vShadow || '0px'} ${card.shadowBlur || '0px'} ${val}`
+
+    this.updateStyle({shadowColor: val, boxShadow})
+  }
+
+  /**
+   * @description 淇敼闃村奖棰滆壊 锛岄鑹叉帶浠�
+   */
+  changeShadowBlur = (val) => {
+    const { card } = this.state
+
+    let boxShadow = `${card.hShadow || '0px'} ${card.vShadow || '0px'} ${val || '0px'} ${card.shadowColor || 'transparent'}`
+
+    this.updateStyle({shadowBlur: val, boxShadow})
+  }
+
+  /**
+   * @description 淇敼闃村奖棰滆壊 锛岄鑹叉帶浠�
+   */
+  changeHShadow = (val) => {
+    const { card } = this.state
+
+    let boxShadow = `${val || '0px'} ${card.vShadow || '0px'} ${card.shadowBlur || '0px'} ${card.shadowColor || 'transparent'}`
+
+    this.updateStyle({hShadow: val, boxShadow})
+  }
+
+  /**
+   * @description 淇敼闃村奖棰滆壊 锛岄鑹叉帶浠�
+   */
+  changeVShadow = (val) => {
+    const { card } = this.state
+
+    let boxShadow = `${card.hShadow || '0px'} ${val || '0px'} ${card.shadowBlur || '0px'} ${card.shadowColor || 'transparent'}`
+
+    this.updateStyle({vShadow: val, boxShadow})
+  }
+
+  imgChange = (val) => {
+    this.setState({
+      backgroundImage: val
+    })
+    if (val) {
+      this.updateStyle({backgroundImage: `url(${val})`})
     } else {
-      this.setState({bgimages: list})
+      this.updateStyle({backgroundImage: ''})
     }
   }
 
-  changeBackgroundImageInput = (e) => {
-    let val = e.target.value
-    val = val.replace(/^\s*|\s*$/ig, '')
+  changeBorderStyle = (val) => {
+    const { borposition } = this.state
+    let _style = {}
 
-    if (/^http|^\/\//.test(val)) {
-      val = `url(${val})`
-    } else if (/^#|,/ig.test(val)) {
-      val = `linear-gradient(${val})`
+    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.setState({backgroundImage: e.target.value})
-    this.updateStyle({backgroundImage: val})
+
+    this.updateStyle(_style)
   }
 
-  submitBorder = (val) => {
-    let border = '0px'
-    if (!/,\s0\)$/.test(val)) {
-      border = `1px solid ${val}`
+  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({border: border})
+    
+    this.updateStyle(_style)
   }
 
-  changeBorderRadius = (val) => {
-    this.updateStyle({borderRadius: val})
+  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)
   }
 
-  changeMarginOrPadding = (val, type) => {
+  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, bgimages } = this.state
+    const { card, options, backgroundImage, borposition } = this.state
     const formItemLayout = {
       labelCol: {
         xs: { span: 24 },
@@ -231,17 +372,40 @@
         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]} accordion={true}>
+            {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', 'vh', 'vw', '%']} 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', 'vh', 'vw']} 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} min={12} max={100} precision={0} onChange={this.changeFontSize} />
+                    <InputNumber defaultValue={card.fontSize || 14} min={12} max={100} precision={0} onChange={this.changeFontSize} />
                   </Form.Item>
                 </Col>
                 <Col span={12}>
@@ -264,13 +428,13 @@
                   </Form.Item>
                 </Col>
                 <Col span={12}>
-                  <Form.Item colon={false} label={<Icon title="琛岄棿璺�" type="line-height" />}>
-                    <InputNumber defaultValue={card.lineHeight} min={1} max={10} precision={1} onChange={this.changeLineHeight} />
+                  <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} min={0} max={100} precision={0} onChange={this.changeLetterSpacing}/>
+                    <InputNumber defaultValue={card.letterSpacing || 0} min={0} max={100} precision={0} onChange={this.changeLetterSpacing}/>
                   </Form.Item>
                 </Col>
                 <Col span={24}>
@@ -323,7 +487,7 @@
                   </Form.Item>
                 </Col>
               </Panel> : null}
-              {options.includes('background') ? <Panel header="鑳屾櫙" key="background">
+              {options.includes('background') || options.includes('backgroundColor') ? <Panel header="鑳屾櫙" key="background">
                 <Col span={24}>
                   <Form.Item
                     colon={false}
@@ -333,25 +497,138 @@
                     <ColorSketch value={card.backgroundColor || '#ffffff'} onChange={this.changeBackgroundColor} />
                   </Form.Item>
                 </Col>
-                <Col span={24}>
+                {!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 }} }
                   >
-                    <FileUpload value={bgimages} maxFile={2} fileType="text" onChange={this.imgChange}/>
-                    <Input placeholder="" value={backgroundImage} autoComplete="off" onChange={this.changeBackgroundImageInput} />
+                    <SourceComponent value={backgroundImage} type="" placement="right" onChange={this.imgChange}/>
                   </Form.Item>
-                </Col>
+                </Col> : null}
+                {!options.includes('backgroundColor') ? <Col span={24}>
+                  <Form.Item
+                    colon={false}
+                    label="姣斾緥"
+                    labelCol={{xs: { span: 24 }, sm: { span: 4 }}} wrapperCol={ {xs: { span: 24 }, sm: { span: 20 }} }
+                  >
+                    <Select defaultValue={card.backgroundSize || 'cover'} onChange={this.changeBackgroundSize}>
+                      <Option value="100%">100%</Option>
+                      <Option value="100% 100%">100% 100%</Option>
+                      <Option value="auto 100%">auto 100%</Option>
+                      <Option value="100% auto">100% auto</Option>
+                      <Option value="auto">auto</Option>
+                      <Option value="contain">contain</Option>
+                      <Option value="cover">cover</Option>
+                    </Select>
+                  </Form.Item>
+                </Col> : null}
+                {!options.includes('backgroundColor') ? <Col span={24}>
+                  <Form.Item
+                    colon={false}
+                    label="閲嶅"
+                    labelCol={{xs: { span: 24 }, sm: { span: 4 }}} wrapperCol={ {xs: { span: 24 }, sm: { span: 20 }} }
+                  >
+                    <Select defaultValue={card.backgroundRepeat || 'no-repeat'} onChange={this.changeBackgroundRepeat}>
+                      <Option value="repeat">repeat</Option>
+                      <Option value="no-repeat">no-repeat</Option>
+                      <Option value="repeat-x">repeat-x</Option>
+                      <Option value="repeat-y">repeat-y</Option>
+                    </Select>
+                  </Form.Item>
+                </Col> : null}
+                {!options.includes('backgroundColor') ? <Col span={24}>
+                  <Form.Item
+                    colon={false}
+                    label="浣嶇疆"
+                    labelCol={{xs: { span: 24 }, sm: { span: 4 }}} wrapperCol={ {xs: { span: 24 }, sm: { span: 20 }} }
+                  >
+                    <Select defaultValue={card.backgroundPositon || 'center'} onChange={this.changeBackgroundPositon}>
+                      <Option value="center">center</Option>
+                      <Option value="top">top</Option>
+                      <Option value="bottom">bottom</Option>
+                    </Select>
+                  </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-outer" />}
+                    label={<Icon title="杈规浣嶇疆" type="border" />}
                     labelCol={{xs: { span: 24 }, sm: { span: 4 }}} wrapperCol={ {xs: { span: 24 }, sm: { span: 20 }} }
                   >
-                    <ColorSketch defaultValue={card.border ? card.border.replace(/^1px solid /ig, '').replace('0px', 'transparent') : 'transparent'} onChange={this.submitBorder} />
+                    <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}>
@@ -360,80 +637,144 @@
                     label={<Icon title="鍦嗚" type="radius-setting" />}
                     labelCol={{xs: { span: 24 }, sm: { span: 4 }}} wrapperCol={ {xs: { span: 24 }, sm: { span: 20 }} }
                   >
-                    <StyleInput defaultValue={card.borderRadius || ''} width={210} options={['px', '%']} onChange={this.changeBorderRadius}/>
+                    <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.shadowColor || 'transparent'} onChange={this.changeShadowColor} />
+                  </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 }} }
+                  >
+                    <StyleInput defaultValue={card.shadowBlur || '0px'} options={['px']} onChange={this.changeShadowBlur}/>
+                  </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.hShadow || '0px'} options={['px']} onChange={this.changeHShadow}/>
+                  </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.vShadow || '0px'} options={['px']} onChange={this.changeVShadow}/>
                   </Form.Item>
                 </Col>
               </Panel> : null}
               {options.includes('margin') ? <Panel header="澶栬竟璺�" key="margin">
-                <Col span={12}>
+                <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} width={80} options={['px', 'vh', 'vw']} onChange={(val) => this.changeMarginOrPadding(val, 'marginTop')}/>
+                    <StyleInput defaultValue={card.marginTop || '0px'} options={['px', 'vh', 'vw', '%']} onChange={(val) => this.changeNormalStyle(val, 'marginTop')}/>
                   </Form.Item>
                 </Col>
-                <Col span={12}>
+                <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} width={80} options={['px', 'vh', 'vw']} onChange={(val) => this.changeMarginOrPadding(val, 'marginBottom')}/>
+                    <StyleInput defaultValue={card.marginBottom || '0px'} options={['px', 'vh', 'vw', '%']} onChange={(val) => this.changeNormalStyle(val, 'marginBottom')}/>
                   </Form.Item>
                 </Col>
-                <Col span={12}>
+                <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} width={80} options={['px', 'vh', 'vw']} onChange={(val) => this.changeMarginOrPadding(val, 'marginLeft')}/>
+                    <StyleInput defaultValue={card.marginLeft || '0px'} options={['px', 'vh', 'vw', '%']} onChange={(val) => this.changeNormalStyle(val, 'marginLeft')}/>
                   </Form.Item>
                 </Col>
-                <Col span={12}>
+                <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} width={80} options={['px', 'vh', 'vw']} onChange={(val) => this.changeMarginOrPadding(val, 'marginRight')}/>
+                    <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={12}>
+                <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} width={80} options={['px', 'vh', 'vw']} onChange={(val) => this.changeMarginOrPadding(val, 'paddingTop')}/>
+                    <StyleInput defaultValue={card.paddingTop || '0px'} options={['px', 'vh', 'vw', '%']} onChange={(val) => this.changeNormalStyle(val, 'paddingTop')}/>
                   </Form.Item>
                 </Col>
-                <Col span={12}>
+                <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} width={80} options={['px', 'vh', 'vw']} onChange={(val) => this.changeMarginOrPadding(val, 'paddingBottom')}/>
+                    <StyleInput defaultValue={card.paddingBottom || '0px'} options={['px', 'vh', 'vw', '%']} onChange={(val) => this.changeNormalStyle(val, 'paddingBottom')}/>
                   </Form.Item>
                 </Col>
-                <Col span={12}>
+                <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} width={80} options={['px', 'vh', 'vw']} onChange={(val) => this.changeMarginOrPadding(val, 'paddingLeft')}/>
+                    <StyleInput defaultValue={card.paddingLeft || '0px'} options={['px', 'vh', 'vw', '%']} onChange={(val) => this.changeNormalStyle(val, 'paddingLeft')}/>
                   </Form.Item>
                 </Col>
-                <Col span={12}>
+                <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} width={80} options={['px', 'vh', 'vw']} onChange={(val) => this.changeMarginOrPadding(val, 'paddingRight')}/>
+                    <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 style={{whiteSpace: 'nowrap'}} 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>
     )

--
Gitblit v1.8.0