| | |
| | | MKEmitter.removeListener('submitComponentStyle', this.updateComponentStyle) |
| | | } |
| | | |
| | | updateComponentStyle = (item) => { |
| | | updateComponentStyle = (parentId, keys, style) => { |
| | | const { group } = this.state |
| | | |
| | | if (group.uuid !== item.uuid) return |
| | | if (group.uuid !== parentId) return |
| | | |
| | | let components = group.components.map(item => { |
| | | if (keys.includes(item.uuid)) { |
| | | item.style = {...item.style, ...style} |
| | | } |
| | | return item |
| | | }) |
| | | |
| | | this.setState({ |
| | | group: {...group, components: []} |
| | | }, () => { |
| | | this.setState({ |
| | | group: {...group, components: item.components} |
| | | }) |
| | | this.updateComponent({...group, components: components}) |
| | | }) |
| | | } |
| | | |
| | |
| | | updateComponent = (component) => { |
| | | const { group } = this.state |
| | | |
| | | if (!is(fromJS(group.setting), fromJS(component.setting))) { |
| | | // 注册事件-标签变化,通知标签内元素 |
| | | if (!is(fromJS(group.setting), fromJS(component.setting)) || !is(fromJS(group.style), fromJS(component.style))) { |
| | | // 注册事件-标签变化,通知组内元素 |
| | | MKEmitter.emit('tabsChange', group.uuid) |
| | | } |
| | | |
| | |
| | | } |
| | | |
| | | clickComponent = (e) => { |
| | | if (sessionStorage.getItem('style-control') === 'true') { |
| | | if (sessionStorage.getItem('style-control') === 'true' || sessionStorage.getItem('style-control') === 'component') { |
| | | e.stopPropagation() |
| | | MKEmitter.emit('clickComponent', this.state.group) |
| | | } |