| | |
| | | } |
| | | }) |
| | | |
| | | if (_style.position === 'relative' || _style.position === 'absolute') { |
| | | if (_style.position === 'relative') { |
| | | _style.zIndex = 1 |
| | | } else if (_style.position === 'absolute') { |
| | | _style.zIndex = 2 |
| | | } else if (_style.position === 'fixed') { |
| | | _style.zIndex = 3 |
| | | } else { |
| | | delete _style.zIndex |
| | | } |
| | |
| | | this.updateStyle({textIndent: `${value}px`}) |
| | | } |
| | | |
| | | /** |
| | | * @description 修改字体粗细 |
| | | */ |
| | | boldChange = (val) => { |
| | | this.updateStyle({fontWeight: val}) |
| | | } |
| | | |
| | | /** |
| | | * @description 自动换行 |
| | | */ |
| | | wordBreakChange = (val) => { |
| | | this.updateStyle({wordBreak: 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}) |
| | | } |
| | | |
| | | changeBackground = (val) => { |
| | | const { card } = this.state |
| | | |
| | |
| | | if (!val || /(^linear-gradient|^radial-gradient)\(.*\)$/.test(val)) { |
| | | this.callback && this.callback(_style) |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * @description 修改背景大小 |
| | | */ |
| | | changeBackgroundSize = (val) => { |
| | | this.updateStyle({backgroundSize: val}) |
| | | } |
| | | |
| | | /** |
| | | * @description 修改背景位置 |
| | | */ |
| | | changeBackgroundPositon= (val) => { |
| | | this.updateStyle({backgroundPosition: val}) |
| | | } |
| | | |
| | | /** |
| | | * @description 修改背景重复设置 |
| | | */ |
| | | changeBackgroundRepeat = (val) => { |
| | | this.updateStyle({backgroundRepeat: val}) |
| | | } |
| | | |
| | | /** |
| | |
| | | } |
| | | |
| | | this.updateStyle(_style) |
| | | } |
| | | |
| | | changeWidth = (val) => { |
| | | this.updateStyle({width: val}) |
| | | } |
| | | |
| | | changeHeight = (val) => { |
| | | this.updateStyle({height: val}) |
| | | } |
| | | |
| | | changeNormalStyle = (val, type) => { |
| | |
| | | label={<ColumnWidthOutlined title="宽度"/>} |
| | | labelCol={{xs: { span: 24 }, sm: { span: 4 }}} wrapperCol={ {xs: { span: 24 }, sm: { span: 20 }} } |
| | | > |
| | | <StyleInput clear={true} defaultValue={card.width || ''} options={['px', 'vh', 'vw', '%', 'auto']} onChange={this.changeWidth}/> |
| | | <StyleInput clear={true} defaultValue={card.width || ''} options={['px', 'vh', 'vw', '%', 'auto']} onChange={(val) => this.changeNormalStyle(val, 'width')}/> |
| | | </Form.Item> |
| | | </Col> |
| | | </Panel> : null} |
| | |
| | | label={<ColumnHeightOutlined title="高度"/>} |
| | | labelCol={{xs: { span: 24 }, sm: { span: 4 }}} wrapperCol={ {xs: { span: 24 }, sm: { span: 20 }} } |
| | | > |
| | | <StyleInput clear={true} defaultValue={card.height || ''} options={['px', 'vh', 'vw']} onChange={this.changeHeight}/> |
| | | <StyleInput clear={true} defaultValue={card.height || ''} options={['px', 'vh', 'vw']} onChange={(val) => this.changeNormalStyle(val, 'height')}/> |
| | | </Form.Item> |
| | | </Col> |
| | | </Panel> : null} |
| | |
| | | </Col> : null} |
| | | {fonts.includes('fontWeight') ? <Col span={12}> |
| | | <Form.Item colon={false} label={<BoldOutlined title="字体粗细"/>}> |
| | | <Select defaultValue={card.fontWeight || 'normal'} onChange={this.boldChange}> |
| | | <Select defaultValue={card.fontWeight || 'normal'} onChange={(val) => this.changeNormalStyle(val, 'fontWeight')}> |
| | | <Option value="normal">normal</Option> |
| | | <Option value="bold">bold</Option> |
| | | <Option value="bolder">bolder</Option> |
| | |
| | | </Col> : null} |
| | | {fonts.includes('wordBreak') ? <Col span={12}> |
| | | <Form.Item colon={false} label={<EnterOutlined title="自动换行"/>}> |
| | | <Select defaultValue={card.wordBreak || 'normal'} onChange={this.wordBreakChange}> |
| | | <Select defaultValue={card.wordBreak || 'normal'} onChange={(val) => this.changeNormalStyle(val, 'wordBreak')}> |
| | | <Option value="normal">normal</Option> |
| | | <Option value="break-all">break-all</Option> |
| | | </Select> |
| | |
| | | label={<FontColorsOutlined title="字体颜色"/>} |
| | | labelCol={{xs: { span: 24 }, sm: { span: 4 }}} wrapperCol={ {xs: { span: 24 }, sm: { span: 20 }} } |
| | | > |
| | | <ColorSketch value={card.color || ''} onChange={this.changeFontColor} /> |
| | | <ColorSketch value={card.color || ''} onChange={(val) => this.changeNormalStyle(val, 'color')} /> |
| | | </Form.Item> |
| | | <Form.Item |
| | | colon={false} |
| | | label={<BgColorsOutlined title="系统色"/>} |
| | | labelCol={{xs: { span: 24 }, sm: { span: 4 }}} wrapperCol={ {xs: { span: 24 }, sm: { span: 20 }} } |
| | | > |
| | | <SysColorSketch onChange={this.changeFontColor} /> |
| | | <SysColorSketch onChange={(val) => this.changeNormalStyle(val, 'color')} /> |
| | | </Form.Item> |
| | | </Col> : null} |
| | | {fonts.includes('fontStyle') ? <Col span={24}> |
| | |
| | | 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.Group defaultValue={card.fontStyle || 'normal'} onChange={(e) => this.changeNormalStyle(e.target.value, 'fontStyle')}> |
| | | <Radio.Button value="normal"><span title="标准">N</span></Radio.Button> |
| | | <Radio.Button value="italic"><ItalicOutlined title="斜体"/></Radio.Button> |
| | | <Radio.Button value="oblique" style={{fontStyle: 'oblique'}}><span title="倾斜">B</span></Radio.Button> |
| | |
| | | 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.Group className="text-align" defaultValue={card.textAlign || 'left'} onChange={(e) => this.changeNormalStyle(e.target.value, 'textAlign')}> |
| | | <Radio.Button value="left"><AlignLeftOutlined title="左对齐"/></Radio.Button> |
| | | <Radio.Button value="center"><AlignCenterOutlined title="居中对齐"/></Radio.Button> |
| | | <Radio.Button value="right"><AlignRightOutlined title="右对齐"/></Radio.Button> |
| | |
| | | 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.Group className="text-decoration" defaultValue={card.textDecoration || 'none'} onChange={(e) => this.changeNormalStyle(e.target.value, 'textDecoration')}> |
| | | <Radio.Button value="none"><span title="标准">N</span></Radio.Button> |
| | | <Radio.Button value="underline"><UnderlineOutlined title="下划线"/></Radio.Button> |
| | | <Radio.Button value="line-through"><StrikethroughOutlined title="中划线"/></Radio.Button> |
| | |
| | | label={<BgColorsOutlined title="背景颜色"/>} |
| | | labelCol={{xs: { span: 24 }, sm: { span: 4 }}} wrapperCol={ {xs: { span: 24 }, sm: { span: 20 }} } |
| | | > |
| | | <ColorSketch allowClear={true} value={card.backgroundColor || ''} onChange={this.changeBackgroundColor} /> |
| | | <ColorSketch allowClear={true} value={card.backgroundColor || ''} onChange={(val) => this.changeNormalStyle(val, 'backgroundColor')} /> |
| | | </Form.Item> |
| | | <Form.Item |
| | | colon={false} |
| | | label={<BgColorsOutlined title="系统色"/>} |
| | | labelCol={{xs: { span: 24 }, sm: { span: 4 }}} wrapperCol={ {xs: { span: 24 }, sm: { span: 20 }} } |
| | | > |
| | | <SysColorSketch onChange={this.changeBackgroundColor} /> |
| | | <SysColorSketch onChange={(val) => this.changeNormalStyle(val, 'backgroundColor')} /> |
| | | </Form.Item> |
| | | </Col> |
| | | {window.develop === true ? <Col span={24}> |
| | |
| | | label="比例" |
| | | labelCol={{xs: { span: 24 }, sm: { span: 4 }}} wrapperCol={ {xs: { span: 24 }, sm: { span: 20 }} } |
| | | > |
| | | <Select defaultValue={card.backgroundSize || 'cover'} onChange={this.changeBackgroundSize}> |
| | | <Select defaultValue={card.backgroundSize || 'cover'} onChange={(val) => this.changeNormalStyle(val, 'backgroundSize')}> |
| | | <Option value="100%">100%</Option> |
| | | <Option value="100% 100%">100% 100%</Option> |
| | | <Option value="auto 100%">auto 100%</Option> |
| | |
| | | label="重复" |
| | | labelCol={{xs: { span: 24 }, sm: { span: 4 }}} wrapperCol={ {xs: { span: 24 }, sm: { span: 20 }} } |
| | | > |
| | | <Select defaultValue={card.backgroundRepeat || 'no-repeat'} onChange={this.changeBackgroundRepeat}> |
| | | <Select defaultValue={card.backgroundRepeat || 'no-repeat'} onChange={(val) => this.changeNormalStyle(val, 'backgroundRepeat')}> |
| | | <Option value="repeat">repeat</Option> |
| | | <Option value="no-repeat">no-repeat</Option> |
| | | <Option value="repeat-x">repeat-x</Option> |
| | |
| | | label="位置" |
| | | labelCol={{xs: { span: 24 }, sm: { span: 4 }}} wrapperCol={ {xs: { span: 24 }, sm: { span: 20 }} } |
| | | > |
| | | <Select defaultValue={card.backgroundPosition || 'center'} onChange={this.changeBackgroundPositon}> |
| | | <Select defaultValue={card.backgroundPosition || 'center'} onChange={(val) => this.changeNormalStyle(val, 'backgroundPosition')}> |
| | | <Option value="center">center</Option> |
| | | <Option value="center top">center top</Option> |
| | | <Option value="center bottom">center bottom</Option> |
| | |
| | | </Col> |
| | | </Panel> : null} |
| | | {options.includes('position') ? <Panel header="定位" key="position"> |
| | | <div style={{paddingLeft: '35px', fontSize: '12px'}}>注:定位效果请在运行环境中查看。</div> |
| | | <Col span={24}> |
| | | <Form.Item |
| | | colon={false} |
| | | label={<SwapOutlined title="定位"/>} |
| | | labelCol={{xs: { span: 24 }, sm: { span: 4 }}} wrapperCol={ {xs: { span: 24 }, sm: { span: 20 }} } |
| | | labelCol={{xs: { span: 24 }, sm: { span: 3 }}} wrapperCol={ {xs: { span: 24 }, sm: { span: 21 }} } |
| | | > |
| | | <Radio.Group style={{whiteSpace: 'nowrap'}} defaultValue={card.position || 'unset'} onChange={(e) => this.changeNormalStyle(e.target.value, 'position')}> |
| | | <Radio value="unset">无</Radio> |
| | | <Radio value="relative">相对定位</Radio> |
| | | <Radio value="absolute">绝对定位</Radio> |
| | | <Radio value="relative">相对</Radio> |
| | | <Radio value="absolute">绝对</Radio> |
| | | <Radio value="fixed">固定</Radio> |
| | | </Radio.Group> |
| | | </Form.Item> |
| | | </Col> |
| | |
| | | <Form.Item |
| | | colon={false} |
| | | label={<ArrowUpOutlined title="上"/>} |
| | | labelCol={{xs: { span: 24 }, sm: { span: 4 }}} wrapperCol={ {xs: { span: 24 }, sm: { span: 20 }} } |
| | | labelCol={{xs: { span: 24 }, sm: { span: 3 }}} wrapperCol={ {xs: { span: 24 }, sm: { span: 21 }} } |
| | | > |
| | | <StyleInput clear={true} defaultValue={card.top || ''} options={['px', 'vh', 'vw', '%']} onChange={(val) => this.changeNormalStyle(val, 'top')}/> |
| | | </Form.Item> |
| | |
| | | <Form.Item |
| | | colon={false} |
| | | label={<ArrowDownOutlined title="下"/>} |
| | | labelCol={{xs: { span: 24 }, sm: { span: 4 }}} wrapperCol={ {xs: { span: 24 }, sm: { span: 20 }} } |
| | | labelCol={{xs: { span: 24 }, sm: { span: 3 }}} wrapperCol={ {xs: { span: 24 }, sm: { span: 21 }} } |
| | | > |
| | | <StyleInput clear={true} defaultValue={card.bottom || ''} options={['px', 'vh', 'vw', '%']} onChange={(val) => this.changeNormalStyle(val, 'bottom')}/> |
| | | </Form.Item> |
| | |
| | | <Form.Item |
| | | colon={false} |
| | | label={<ArrowLeftOutlined title="左"/>} |
| | | labelCol={{xs: { span: 24 }, sm: { span: 4 }}} wrapperCol={ {xs: { span: 24 }, sm: { span: 20 }} } |
| | | labelCol={{xs: { span: 24 }, sm: { span: 3 }}} wrapperCol={ {xs: { span: 24 }, sm: { span: 21 }} } |
| | | > |
| | | <StyleInput clear={true} defaultValue={card.left || ''} options={['px', 'vh', 'vw', '%']} onChange={(val) => this.changeNormalStyle(val, 'left')}/> |
| | | </Form.Item> |
| | |
| | | <Form.Item |
| | | colon={false} |
| | | label={<ArrowRightOutlined title="右"/>} |
| | | labelCol={{xs: { span: 24 }, sm: { span: 4 }}} wrapperCol={ {xs: { span: 24 }, sm: { span: 20 }} } |
| | | labelCol={{xs: { span: 24 }, sm: { span: 3 }}} wrapperCol={ {xs: { span: 24 }, sm: { span: 21 }} } |
| | | > |
| | | <StyleInput clear={true} defaultValue={card.right || ''} options={['px', 'vh', 'vw', '%']} onChange={(val) => this.changeNormalStyle(val, 'right')}/> |
| | | </Form.Item> |
| | | </Col> |
| | | </Panel> : null} |
| | | {options.includes('transform') ? <Panel header="位置变换" key="transform"> |
| | | <div style={{paddingLeft: '50px', fontSize: '12px'}}>注:变换效果请在运行环境中查看。</div> |
| | | <Col span={24}> |
| | | <Form.Item |
| | | colon={false} |
| | | label={<BorderOuterOutlined title="变换"/>} |
| | | labelCol={{xs: { span: 24 }, sm: { span: 4 }}} wrapperCol={ {xs: { span: 24 }, sm: { span: 20 }} } |
| | | > |
| | | <Select defaultValue={card.transform || ''} onChange={(val) => this.changeNormalStyle(val, 'transform')}> |
| | | <Option value="">无</Option> |
| | | <Option value="translateY(-50%)">上移50%</Option> |
| | | <Option value="translateY(50%)">下移50%</Option> |
| | | <Option value="translateX(-50%)">左移50%</Option> |
| | | <Option value="translateX(50%)">右移50%</Option> |
| | | <Option value="translate(-50%, -50%)">左上移50%</Option> |
| | | <Option value="translate(-50%, 50%)">左下移50%</Option> |
| | | <Option value="translate(50%, -50%)">右上移50%</Option> |
| | | <Option value="translate(50%, 50%)">右下移50%</Option> |
| | | </Select> |
| | | </Form.Item> |
| | | </Col> |
| | | </Panel> : null} |
| | | </Collapse> : null} |
| | | </Form> |
| | | <div style={{textAlign: 'right', lineHeight: '60px', marginBottom: '30px'}}> |