From 46f79b491173d284a4900d19e7aecf7509481438 Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期五, 21 一月 2022 17:21:25 +0800 Subject: [PATCH] 2022-01-21 --- src/menu/stylecontroller/index.jsx | 128 +++++++++++++++++++++++++++--------------- 1 files changed, 82 insertions(+), 46 deletions(-) diff --git a/src/menu/stylecontroller/index.jsx b/src/menu/stylecontroller/index.jsx index d1c5585..a6143e6 100644 --- a/src/menu/stylecontroller/index.jsx +++ b/src/menu/stylecontroller/index.jsx @@ -1,11 +1,37 @@ 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 { Collapse, Form, Col, InputNumber, Select, Radio, Drawer, Button } from 'antd' +import { + ColumnHeightOutlined, + FontSizeOutlined, + BoldOutlined, + LineHeightOutlined, + ColumnWidthOutlined, + FontColorsOutlined, + ItalicOutlined, + AlignLeftOutlined, + AlignCenterOutlined, + AlignRightOutlined, + UnderlineOutlined, + StrikethroughOutlined, + BgColorsOutlined, + PictureOutlined, + BorderOutlined, + BorderOuterOutlined, + BorderLeftOutlined, + BorderRightOutlined, + BorderTopOutlined, + BorderBottomOutlined, + RadiusSettingOutlined, + ArrowUpOutlined, + ArrowDownOutlined, + ArrowLeftOutlined, + ArrowRightOutlined, + SwapOutlined, +} from '@ant-design/icons' 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' @@ -22,7 +48,6 @@ } state = { - dict: sessionStorage.getItem('lang') !== 'en-US' ? zhCN : enUS, card: null, comIds: [], backgroundImage: '', @@ -384,7 +409,7 @@ <Col span={24}> <Form.Item colon={false} - label={<Icon title="瀹藉害" type="column-width" />} + label={<ColumnWidthOutlined title="瀹藉害"/>} 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}/> @@ -395,7 +420,7 @@ <Col span={24}> <Form.Item colon={false} - label={<Icon title="楂樺害" type="column-height" />} + label={<ColumnHeightOutlined title="楂樺害"/>} 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}/> @@ -404,12 +429,12 @@ </Panel> : null} {options.includes('font') ? <Panel header="瀛椾綋" key="font"> <Col span={12}> - <Form.Item colon={false} label={<Icon title="瀛椾綋澶у皬" type="font-size" />}> + <Form.Item colon={false} label={<FontSizeOutlined title="瀛椾綋澶у皬"/>}> <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" />}> + <Form.Item colon={false} label={<BoldOutlined title="瀛椾綋绮楃粏"/>}> <Select defaultValue={card.fontWeight || 'normal'} onChange={this.boldChange}> <Option value="normal">normal</Option> <Option value="bold">bold</Option> @@ -428,19 +453,19 @@ </Form.Item> </Col> <Col span={12}> - <Form.Item colon={false} label={<Icon title="琛岄珮" type="line-height" />}> + <Form.Item colon={false} label={<LineHeightOutlined title="琛岄珮"/>}> <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" />}> + <Form.Item colon={false} label={<ColumnWidthOutlined title="瀛楅棿璺�"/>}> <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" />} + label={<FontColorsOutlined title="瀛椾綋棰滆壊"/>} 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} /> @@ -454,7 +479,7 @@ > <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="italic"><ItalicOutlined title="鏂滀綋"/></Radio.Button> <Radio.Button value="oblique" style={{fontStyle: 'oblique'}}><span title="鍊炬枩">B</span></Radio.Button> </Radio.Group> </Form.Item> @@ -466,9 +491,9 @@ 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.Button value="left"><AlignLeftOutlined title="宸﹀榻�"/></Radio.Button> + <Radio.Button value="center"><AlignCenterOutlined title="灞呬腑瀵归綈"/></Radio.Button> + <Radio.Button value="right"><AlignRightOutlined title="鍙冲榻�"/></Radio.Button> </Radio.Group> </Form.Item> </Col> @@ -480,8 +505,8 @@ > <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="underline"><UnderlineOutlined title="涓嬪垝绾�"/></Radio.Button> + <Radio.Button value="line-through"><StrikethroughOutlined title="涓垝绾�"/></Radio.Button> <Radio.Button value="overline" style={{textDecoration: 'overline'}}><span title="涓婂垝绾�">O</span></Radio.Button> </Radio.Group> </Form.Item> @@ -491,7 +516,7 @@ <Col span={24}> <Form.Item colon={false} - label={<Icon title="鑳屾櫙棰滆壊" type="bg-colors" />} + label={<BgColorsOutlined title="鑳屾櫙棰滆壊"/>} labelCol={{xs: { span: 24 }, sm: { span: 4 }}} wrapperCol={ {xs: { span: 24 }, sm: { span: 20 }} } > <ColorSketch value={card.backgroundColor || '#ffffff'} onChange={this.changeBackgroundColor} /> @@ -500,7 +525,7 @@ {!options.includes('backgroundColor') ? <Col span={24}> <Form.Item colon={false} - label={<Icon title="鑳屾櫙鍥剧墖" type="picture" />} + label={<PictureOutlined title="鑳屾櫙鍥剧墖"/>} labelCol={{xs: { span: 24 }, sm: { span: 4 }}} wrapperCol={ {xs: { span: 24 }, sm: { span: 20 }} } > <SourceComponent value={backgroundImage} type="" placement="right" onChange={this.imgChange}/> @@ -555,22 +580,22 @@ <Col span={24}> <Form.Item colon={false} - label={<Icon title="杈规浣嶇疆" type="border" />} + label={<BorderOutlined title="杈规浣嶇疆"/>} 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 value="outer"><BorderOuterOutlined title="澶栬竟妗�"/></Radio> + <Radio value="left"><BorderLeftOutlined title="宸﹁竟妗�"/></Radio> + <Radio value="right"><BorderRightOutlined title="鍙宠竟妗�"/></Radio> + <Radio value="top"><BorderTopOutlined title="涓婅竟妗�"/></Radio> + <Radio value="bottom"><BorderBottomOutlined title="涓嬭竟妗�"/></Radio> </Radio.Group> </Form.Item> </Col> <Col span={24}> <Form.Item colon={false} - label={<Icon title="杈规鏍峰紡" type="border-outer" />} + label={<BorderOuterOutlined title="杈规鏍峰紡"/>} labelCol={{xs: { span: 24 }, sm: { span: 4 }}} wrapperCol={ {xs: { span: 24 }, sm: { span: 20 }} } > {borposition === 'outer' ? <Select defaultValue={card.borderStyle || 'solid'} onChange={this.changeBorderStyle}> @@ -608,7 +633,7 @@ <Col span={24}> <Form.Item colon={false} - label={<Icon title="杈规瀹藉害" type="column-width" />} + label={<ColumnWidthOutlined title="杈规瀹藉害"/>} 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} @@ -621,7 +646,7 @@ <Col span={24}> <Form.Item colon={false} - label={<Icon title="杈规棰滆壊" type="bg-colors" />} + label={<BgColorsOutlined title="杈规棰滆壊"/>} 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} @@ -634,7 +659,7 @@ <Col span={24}> <Form.Item colon={false} - label={<Icon title="鍦嗚" type="radius-setting" />} + label={<RadiusSettingOutlined title="鍦嗚"/>} 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')}/> @@ -645,7 +670,7 @@ <Col span={24}> <Form.Item colon={false} - label={<Icon title="闃村奖棰滆壊" type="bg-colors" />} + label={<BgColorsOutlined title="闃村奖棰滆壊"/>} labelCol={{xs: { span: 24 }, sm: { span: 4 }}} wrapperCol={ {xs: { span: 24 }, sm: { span: 20 }} } > <ColorSketch value={card.shadowColor || 'transparent'} onChange={this.changeShadowColor} /> @@ -654,7 +679,7 @@ <Col span={24}> <Form.Item colon={false} - label={<Icon title="妯$硦璺濈" type="column-width" />} + label={<ColumnWidthOutlined title="妯$硦璺濈"/>} labelCol={{xs: { span: 24 }, sm: { span: 4 }}} wrapperCol={ {xs: { span: 24 }, sm: { span: 20 }} } > <StyleInput defaultValue={card.shadowBlur || '0px'} options={['px']} onChange={this.changeShadowBlur}/> @@ -663,7 +688,7 @@ <Col span={24}> <Form.Item colon={false} - label={<Icon title="姘村钩浣嶇疆" type="arrow-right" />} + label={<ArrowRightOutlined title="姘村钩浣嶇疆"/>} labelCol={{xs: { span: 24 }, sm: { span: 4 }}} wrapperCol={ {xs: { span: 24 }, sm: { span: 20 }} } > <StyleInput defaultValue={card.hShadow || '0px'} options={['px']} onChange={this.changeHShadow}/> @@ -672,7 +697,7 @@ <Col span={24}> <Form.Item colon={false} - label={<Icon title="鍨傜洿浣嶇疆" type="arrow-down" />} + label={<ArrowDownOutlined title="鍨傜洿浣嶇疆"/>} labelCol={{xs: { span: 24 }, sm: { span: 4 }}} wrapperCol={ {xs: { span: 24 }, sm: { span: 20 }} } > <StyleInput defaultValue={card.vShadow || '0px'} options={['px']} onChange={this.changeVShadow}/> @@ -683,7 +708,7 @@ <Col span={24}> <Form.Item colon={false} - label={<Icon title="涓婅竟璺�" type="arrow-up"/>} + label={<ArrowUpOutlined title="涓婅竟璺�"/>} 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')}/> @@ -692,7 +717,7 @@ <Col span={24}> <Form.Item colon={false} - label={<Icon title="涓嬭竟璺�" type="arrow-down"/>} + label={<ArrowDownOutlined title="涓嬭竟璺�"/>} 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')}/> @@ -701,7 +726,7 @@ <Col span={24}> <Form.Item colon={false} - label={<Icon title="宸﹁竟璺�" type="arrow-left"/>} + label={<ArrowLeftOutlined title="宸﹁竟璺�"/>} 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')}/> @@ -710,7 +735,7 @@ <Col span={24}> <Form.Item colon={false} - label={<Icon title="鍙宠竟璺�" type="arrow-right"/>} + label={<ArrowRightOutlined title="鍙宠竟璺�"/>} 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')}/> @@ -721,7 +746,7 @@ <Col span={24}> <Form.Item colon={false} - label={<Icon title="涓婅竟璺�" type="arrow-up"/>} + label={<ArrowUpOutlined title="涓婅竟璺�"/>} 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')}/> @@ -730,7 +755,7 @@ <Col span={24}> <Form.Item colon={false} - label={<Icon title="涓嬭竟璺�" type="arrow-down"/>} + label={<ArrowDownOutlined title="涓嬭竟璺�"/>} 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')}/> @@ -739,7 +764,7 @@ <Col span={24}> <Form.Item colon={false} - label={<Icon title="宸﹁竟璺�" type="arrow-left"/>} + label={<ArrowLeftOutlined title="宸﹁竟璺�"/>} 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')}/> @@ -748,28 +773,39 @@ <Col span={24}> <Form.Item colon={false} - label={<Icon title="鍙宠竟璺�" type="arrow-right"/>} + label={<ArrowRightOutlined title="鍙宠竟璺�"/>} 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"> + {options.includes('float') ? <Panel header="瀵归綈鏂瑰紡" key="float"> <Col span={24}> <Form.Item colon={false} - label={<Icon title="娴姩" type="swap" />} + label={<SwapOutlined title="瀵归綈"/>} 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 value="left">宸�</Radio> + <Radio value="center">灞呬腑</Radio> + <Radio value="right">鍙�</Radio> </Radio.Group> </Form.Item> </Col> </Panel> : null} + {options.includes('minHeight') ? <Panel header="鏈�灏忛珮搴�" key="minHeight"> + <Col span={24}> + <Form.Item + colon={false} + label={<ColumnHeightOutlined title="鏈�灏忛珮搴�"/>} + labelCol={{xs: { span: 24 }, sm: { span: 4 }}} wrapperCol={ {xs: { span: 24 }, sm: { span: 20 }} } + > + <StyleInput defaultValue={card.minHeight || '28px'} options={['px']} onChange={(val) => this.changeNormalStyle(val, 'minHeight')}/> + </Form.Item> + </Col> + </Panel> : null} </Collapse> : null} </Form> <div style={{textAlign: 'right'}}> -- Gitblit v1.8.0