-
Notifications
You must be signed in to change notification settings - Fork 484
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
5f836d7
commit ed0a483
Showing
10 changed files
with
352 additions
and
127 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -25,6 +25,10 @@ import css from './BpmnEditor.less'; | |
|
||
import generateImage from '../../util/generateImage'; | ||
|
||
import classNames from 'classnames'; | ||
|
||
import { merge } from 'min-dash'; | ||
|
||
const COLORS = [{ | ||
title: 'White', | ||
fill: 'white', | ||
|
@@ -57,7 +61,13 @@ export class BpmnEditor extends CachedComponent { | |
constructor(props) { | ||
super(props); | ||
|
||
this.state = {}; | ||
const { | ||
layout | ||
} = this.props; | ||
|
||
this.state = { | ||
This comment has been minimized.
Sorry, something went wrong. |
||
layout | ||
}; | ||
|
||
this.ref = React.createRef(); | ||
this.propertiesPanelRef = React.createRef(); | ||
|
@@ -148,9 +158,11 @@ export class BpmnEditor extends CachedComponent { | |
} | ||
|
||
handleMinimapToggle = (event) => { | ||
console.warn('minimap toggle', event.open); | ||
|
||
// TODO(nikku): persist minimap toggle state | ||
this.handleLayoutChange({ | ||
minimap: { | ||
open: event.open | ||
} | ||
}); | ||
} | ||
|
||
handleElementTemplateErrors = (event) => { | ||
|
@@ -352,6 +364,36 @@ export class BpmnEditor extends CachedComponent { | |
} | ||
} | ||
|
||
handlePropertiesPanelToggle = () => { | ||
const { | ||
layout | ||
} = this.state; | ||
|
||
this.handleLayoutChange({ | ||
propertiesPanel: { | ||
open: !layout.propertiesPanel.open | ||
} | ||
}); | ||
} | ||
|
||
handleLayoutChange(newLayout) { | ||
const { | ||
onLayoutChanged | ||
} = this.props; | ||
|
||
const { | ||
layout | ||
} = this.state; | ||
|
||
newLayout = merge(layout, newLayout); | ||
|
||
this.setState({ | ||
layout: newLayout | ||
}); | ||
|
||
onLayoutChanged(newLayout); | ||
This comment has been minimized.
Sorry, something went wrong.
nikku
Member
|
||
} | ||
|
||
resize = () => { | ||
const { | ||
modeler | ||
|
@@ -363,11 +405,13 @@ export class BpmnEditor extends CachedComponent { | |
} | ||
|
||
render() { | ||
|
||
const { | ||
layout, | ||
loading | ||
} = this.state; | ||
|
||
const propertiesPanelOpen = layout.propertiesPanel && layout.propertiesPanel.open; | ||
|
||
return ( | ||
<div className={ css.BpmnEditor }> | ||
|
||
|
@@ -476,20 +520,27 @@ export class BpmnEditor extends CachedComponent { | |
onContextMenu={ this.handleContextMenu } | ||
></div> | ||
|
||
<div className="properties"> | ||
<div className="toggle">Properties Panel</div> | ||
<div className={ classNames('properties', { 'open': propertiesPanelOpen }) }> | ||
<div className="toggle" onClick={ this.handlePropertiesPanelToggle }>Properties Panel</div> | ||
<div className="resize-handle"></div> | ||
<div className="properties-container" ref={ this.propertiesPanelRef }></div> | ||
</div> | ||
</div> | ||
); | ||
} | ||
|
||
static createCachedState() { | ||
static createCachedState(props) { | ||
|
||
const { | ||
layout | ||
} = props; | ||
|
||
// TODO(nikku): wire element template loading | ||
const modeler = new CamundaBpmnModeler({ | ||
position: 'absolute' | ||
position: 'absolute', | ||
minimap: { | ||
open: layout.minimap.open | ||
} | ||
}); | ||
|
||
return { | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Why is it required to transform the props into state?