| | |
| | | updateComponent = (component) => { |
| | | const card = fromJS(this.state.card).toJS() |
| | | let refresh = false |
| | | if (!is(fromJS(component.plot), fromJS(card.plot))) { |
| | | if (!is(fromJS(component.plot), fromJS(card.plot)) || !is(fromJS(component.style), fromJS(card.style))) { |
| | | let _element = document.getElementById(card.uuid + 'canvas') |
| | | if (_element) { |
| | | _element.innerHTML = '' |
| | |
| | | |
| | | let _card = {...card, style} |
| | | |
| | | this.setState({ |
| | | card: _card |
| | | }) |
| | | // this.setState({ |
| | | // card: _card |
| | | // }) |
| | | |
| | | this.props.updateConfig(_card) |
| | | this.updateComponent(_card) |
| | | // this.props.updateConfig(_card) |
| | | } |
| | | |
| | | handleLog = (type, logs, item) => { |
| | |
| | | updateComponent = (component) => { |
| | | const card = fromJS(this.state.card).toJS() |
| | | let refresh = false |
| | | if (!is(fromJS(component.plot), fromJS(card.plot))) { |
| | | if (!is(fromJS(component.plot), fromJS(card.plot)) || !is(fromJS(component.style), fromJS(card.style))) { |
| | | let _element = document.getElementById(card.uuid + 'canvas') |
| | | if (_element) { |
| | | _element.innerHTML = '' |
| | |
| | | |
| | | let _card = {...card, style} |
| | | |
| | | this.setState({ |
| | | card: _card |
| | | }) |
| | | this.updateComponent(_card) |
| | | // this.setState({ |
| | | // card: _card |
| | | // }) |
| | | |
| | | this.props.updateConfig(_card) |
| | | // this.props.updateConfig(_card) |
| | | } |
| | | |
| | | handleLog = (type, logs, item) => { |
| | |
| | | } |
| | | |
| | | componentDidMount () { |
| | | MKEmitter.addListener('tabsChange', this.handleTabsChange) |
| | | MKEmitter.addListener('submitStyle', this.getStyle) |
| | | MKEmitter.addListener('tabsChange', this.handleTabsChange) |
| | | MKEmitter.addListener('submitComponentStyle', this.updateComponentStyle) |
| | | } |
| | | |
| | | /** |
| | |
| | | this.setState = () => { |
| | | return |
| | | } |
| | | MKEmitter.removeListener('submitStyle', this.getStyle) |
| | | MKEmitter.removeListener('tabsChange', this.handleTabsChange) |
| | | MKEmitter.addListener('submitStyle', this.getStyle) |
| | | MKEmitter.removeListener('submitComponentStyle', this.updateComponentStyle) |
| | | } |
| | | |
| | | updateComponentStyle = (item) => { |
| | | const { group } = this.state |
| | | |
| | | if (group.uuid !== item.uuid) return |
| | | |
| | | this.setState({ |
| | | group: {...group, components: []} |
| | | }, () => { |
| | | this.setState({ |
| | | group: {...group, components: item.components} |
| | | }) |
| | | }) |
| | | } |
| | | |
| | | changeStyle = () => { |
| | |
| | | .ant-table-body { |
| | | overflow-x: auto; |
| | | padding-bottom: 20px; |
| | | tr td:not(.ant-table-selection-column) { |
| | | position: relative; |
| | | padding: 12px 8px; |
| | | background: #ffffff; |
| | | >.profile { |
| | | position: absolute; |
| | | top: 2px; |
| | | right: 2px; |
| | | color: purple; |
| | | font-size: 12px; |
| | | tr { |
| | | td { |
| | | background: #ffffff; |
| | | } |
| | | td:not(.ant-table-selection-column) { |
| | | position: relative; |
| | | padding: 12px 8px; |
| | | >.profile { |
| | | position: absolute; |
| | | top: 2px; |
| | | right: 2px; |
| | | color: purple; |
| | | font-size: 12px; |
| | | } |
| | | } |
| | | } |
| | | .action-column { |
| | |
| | | } |
| | | |
| | | componentDidMount () { |
| | | MKEmitter.addListener('tabsChange', this.handleTabsChange) |
| | | MKEmitter.addListener('submitStyle', this.getStyle) |
| | | MKEmitter.addListener('tabsChange', this.handleTabsChange) |
| | | MKEmitter.addListener('submitComponentStyle', this.updateComponentStyle) |
| | | } |
| | | |
| | | /** |
| | |
| | | this.setState = () => { |
| | | return |
| | | } |
| | | MKEmitter.removeListener('submitStyle', this.getStyle) |
| | | MKEmitter.removeListener('tabsChange', this.handleTabsChange) |
| | | MKEmitter.addListener('submitStyle', this.getStyle) |
| | | MKEmitter.removeListener('submitComponentStyle', this.updateComponentStyle) |
| | | } |
| | | |
| | | updateComponentStyle = (item) => { |
| | | const { group } = this.state |
| | | |
| | | if (group.uuid !== item.uuid) return |
| | | |
| | | this.setState({ |
| | | group: {...group, components: []} |
| | | }, () => { |
| | | this.setState({ |
| | | group: {...group, components: item.components} |
| | | }) |
| | | }) |
| | | } |
| | | |
| | | changeStyle = () => { |
| | |
| | | } |
| | | |
| | | componentDidMount () { |
| | | sessionStorage.setItem('style-control', 'false') |
| | | MKEmitter.addListener('clickComponent', this.clickComponent) |
| | | MKEmitter.addListener('submitCombineStyle', this.submitCombineStyle) |
| | | } |
| | |
| | | } |
| | | |
| | | submitCombineStyle = (style) => { |
| | | const { components } = this.state |
| | | const { menu } = this.props |
| | | const { components, parent } = this.state |
| | | |
| | | components.forEach((item, i) => { |
| | | setTimeout(() => { |
| | | MKEmitter.emit('submitStyle', [item.uuid], {...item.style, ...style}) |
| | | }, i * 5) |
| | | let _parent = null |
| | | let getParents = (box) => { |
| | | box.components.forEach(item => { |
| | | if (item.type === 'tabs') { |
| | | item.subtabs.forEach(tab => { |
| | | if (tab.uuid === parent.uuid) { |
| | | _parent = tab |
| | | } else { |
| | | getParents(tab) |
| | | } |
| | | }) |
| | | } else if (item.type === 'group') { |
| | | if (item.uuid === parent.uuid) { |
| | | _parent = item |
| | | } |
| | | } |
| | | }) |
| | | } |
| | | |
| | | if (menu.uuid === parent.uuid) { |
| | | _parent = menu |
| | | } else { |
| | | getParents(menu) |
| | | } |
| | | |
| | | let keys = components.map(item => item.uuid) |
| | | |
| | | _parent.components = _parent.components.map(item => { |
| | | if (keys.includes(item.uuid)) { |
| | | item.style = {...item.style, ...style} |
| | | } |
| | | return item |
| | | }) |
| | | |
| | | MKEmitter.emit('submitComponentStyle', _parent) |
| | | |
| | | setTimeout(() => { |
| | | keys.forEach(key => { |
| | | document.getElementById(key).classList.add('selected-control-element') |
| | | }) |
| | | }, 100) |
| | | } |
| | | |
| | | clickComponent = (card) => { |
| | |
| | | document.getElementById(card.uuid).classList.add('selected-control-element') |
| | | } |
| | | |
| | | if (components.length === 0) { |
| | | MKEmitter.emit('closeCombineStyle') |
| | | } |
| | | |
| | | this.setState({ |
| | | components: components, |
| | | parent: components.length ? parent : null |
| | |
| | | } |
| | | |
| | | .selected-control-element { |
| | | box-shadow: 0px 0px 4px orange; |
| | | box-shadow: 0px 0px 6px orange; |
| | | } |
| | | } |
| | |
| | | |
| | | closeStyle = () => { |
| | | this.setState({ |
| | | visible: false |
| | | visible: false, |
| | | options: [] |
| | | }) |
| | | } |
| | | |
| | |
| | | label={<Icon title="字体颜色" type="font-colors" />} |
| | | labelCol={{xs: { span: 24 }, sm: { span: 4 }}} wrapperCol={ {xs: { span: 24 }, sm: { span: 20 }} } |
| | | > |
| | | <ColorSketch value={''} onChange={this.changeFontColor} /> |
| | | <ColorSketch onChange={this.changeFontColor} /> |
| | | </Form.Item> |
| | | </Col> |
| | | <Col span={24}> |
| | |
| | | label={<Icon title="背景颜色" type="bg-colors" />} |
| | | labelCol={{xs: { span: 24 }, sm: { span: 4 }}} wrapperCol={ {xs: { span: 24 }, sm: { span: 20 }} } |
| | | > |
| | | <ColorSketch value={''} onChange={this.changeBackgroundColor} /> |
| | | <ColorSketch onChange={this.changeBackgroundColor} /> |
| | | </Form.Item> |
| | | </Col> |
| | | </Panel> : null} |
| | |
| | | label={<Icon title="边框颜色" type="bg-colors" />} |
| | | labelCol={{xs: { span: 24 }, sm: { span: 4 }}} wrapperCol={ {xs: { span: 24 }, sm: { span: 20 }} } |
| | | > |
| | | {borposition === 'outer' ? <ColorSketch defaultValue={'transparent'} onChange={this.changeBorderColor} /> : null} |
| | | {borposition === 'left' ? <ColorSketch defaultValue={'transparent'} onChange={this.changeBorderColor} /> : null} |
| | | {borposition === 'right' ? <ColorSketch defaultValue={'transparent'} onChange={this.changeBorderColor} /> : null} |
| | | {borposition === 'top' ? <ColorSketch defaultValue={'transparent'} onChange={this.changeBorderColor} /> : null} |
| | | {borposition === 'bottom' ? <ColorSketch defaultValue={'transparent'} onChange={this.changeBorderColor} /> : null} |
| | | {borposition === 'outer' ? <ColorSketch onChange={this.changeBorderColor} /> : null} |
| | | {borposition === 'left' ? <ColorSketch onChange={this.changeBorderColor} /> : null} |
| | | {borposition === 'right' ? <ColorSketch onChange={this.changeBorderColor} /> : null} |
| | | {borposition === 'top' ? <ColorSketch onChange={this.changeBorderColor} /> : null} |
| | | {borposition === 'bottom' ? <ColorSketch onChange={this.changeBorderColor} /> : null} |
| | | </Form.Item> |
| | | </Col> |
| | | <Col span={24}> |
| | |
| | | label={<Icon title="阴影颜色" type="bg-colors" />} |
| | | labelCol={{xs: { span: 24 }, sm: { span: 4 }}} wrapperCol={ {xs: { span: 24 }, sm: { span: 20 }} } |
| | | > |
| | | <ColorSketch value={'transparent'} onChange={this.changeShadowColor} /> |
| | | <ColorSketch onChange={this.changeShadowColor} /> |
| | | </Form.Item> |
| | | </Col> |
| | | </Panel> : null} |
| | |
| | | |
| | | handleChange = (color) => { |
| | | let _color = `rgba(${ color.rgb.r }, ${ color.rgb.g }, ${ color.rgb.b }, ${ color.rgb.a })` |
| | | |
| | | |
| | | this.setState({ color: _color }, () => { |
| | | this.props.onChange && this.props.onChange(_color) |
| | | }) |
| | |
| | | MKEmitter.addListener('delButtons', this.delButtons) |
| | | MKEmitter.addListener('copyButtons', this.copyButtons) |
| | | MKEmitter.addListener('changePopview', this.initPopview) |
| | | MKEmitter.addListener('submitComponentStyle', this.updateComponentStyle) |
| | | } |
| | | |
| | | /** |
| | |
| | | MKEmitter.removeListener('delButtons', this.delButtons) |
| | | MKEmitter.removeListener('copyButtons', this.copyButtons) |
| | | MKEmitter.removeListener('changePopview', this.initPopview) |
| | | MKEmitter.removeListener('submitComponentStyle', this.updateComponentStyle) |
| | | } |
| | | |
| | | updateComponentStyle = (item) => { |
| | | const { config } = this.state |
| | | |
| | | if (config.uuid !== item.uuid) return |
| | | |
| | | this.setState({ |
| | | config: {...config, components: []} |
| | | }, () => { |
| | | this.setState({ |
| | | config: {...config, components: item.components} |
| | | }) |
| | | }) |
| | | } |
| | | |
| | | delButtons = (items) => { |