-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'develop' into feature/swimlanes
# Conflicts: # src/main/i18n/de.json # src/main/i18n/en.json # src/main/packages/bpmn/bpmn-diagram-preview.ts # src/main/packages/bpmn/index.ts # src/main/packages/components.ts # src/main/packages/uml-elements.ts
- Loading branch information
Showing
11 changed files
with
113 additions
and
3 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
34 changes: 34 additions & 0 deletions
34
src/main/packages/bpmn/bpmn-data-object/bpmn-data-object-component.tsx
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 |
---|---|---|
@@ -0,0 +1,34 @@ | ||
import React, { FunctionComponent } from 'react'; | ||
import { ThemedPath, ThemedPolyline, ThemedRect } from '../../../components/theme/themedComponents'; | ||
import { Multiline } from '../../../utils/svg/multiline'; | ||
import { BPMNDataObject } from './bpmn-data-object'; | ||
|
||
export const BPMNDataObjectComponent: FunctionComponent<Props> = ({ element }) => ( | ||
<g> | ||
<ThemedPolyline | ||
points={`0 0, 0 ${element.bounds.height}, ${element.bounds.width} ${element.bounds.height}, ${ | ||
element.bounds.width | ||
} 15, ${element.bounds.width - 15} 0, ${element.bounds.width - 15} 15, ${element.bounds.width} 15, ${ | ||
element.bounds.width - 15 | ||
} 0, 0 0`} | ||
strokeColor={element.strokeColor} | ||
fillColor={element.fillColor} | ||
/> | ||
<Multiline | ||
x={element.bounds.width / 2} | ||
y={element.bounds.height / 2} | ||
width={element.bounds.width} | ||
height={element.bounds.height} | ||
fontWeight="bold" | ||
fill={element.textColor} | ||
lineHeight={16} | ||
capHeight={11} | ||
> | ||
{element.name} | ||
</Multiline> | ||
</g> | ||
); | ||
|
||
interface Props { | ||
element: BPMNDataObject; | ||
} |
19 changes: 19 additions & 0 deletions
19
src/main/packages/bpmn/bpmn-data-object/bpmn-data-object.ts
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 |
---|---|---|
@@ -0,0 +1,19 @@ | ||
import { BPMNElementType } from '..'; | ||
import { ILayer } from '../../../services/layouter/layer'; | ||
import { ILayoutable } from '../../../services/layouter/layoutable'; | ||
import { calculateNameBounds } from '../../../utils/name-bounds'; | ||
import { UMLElementType } from '../../uml-element-type'; | ||
import { UMLElementFeatures } from '../../../services/uml-element/uml-element-features'; | ||
import { UMLElement } from '../../../services/uml-element/uml-element'; | ||
import { UMLContainer } from '../../../services/uml-container/uml-container'; | ||
|
||
export class BPMNDataObject extends UMLContainer { | ||
static features: UMLElementFeatures = { ...UMLContainer.features }; | ||
|
||
type: UMLElementType = BPMNElementType.BPMNDataObject; | ||
|
||
render(canvas: ILayer): ILayoutable[] { | ||
this.bounds = calculateNameBounds(this, canvas); | ||
return [this]; | ||
} | ||
} |
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
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
34 changes: 34 additions & 0 deletions
34
src/tests/unit/packages/bpmn/bpmn-data-object/__snapshots__/bpmn-data-object-test.tsx.snap
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 |
---|---|---|
@@ -0,0 +1,34 @@ | ||
// Jest Snapshot v1, https://goo.gl/fbAQLP | ||
|
||
exports[`render the bpmn-transaction-component 1`] = ` | ||
<body> | ||
<div> | ||
<svg> | ||
<g> | ||
<polyline | ||
class="sc-aXZVg bUvEJV" | ||
fill="white" | ||
points="0 0, 0 100, 200 100, 200 15, 185 0, 185 15, 200 15, 185 0, 0 0" | ||
stroke="black" | ||
/> | ||
<text | ||
font-weight="bold" | ||
height="100" | ||
pointer-events="none" | ||
text-anchor="middle" | ||
width="200" | ||
x="100" | ||
y="50" | ||
> | ||
<tspan | ||
dy="5.5" | ||
x="100" | ||
> | ||
Data Object | ||
</tspan> | ||
</text> | ||
</g> | ||
</svg> | ||
</div> | ||
</body> | ||
`; |
15 changes: 15 additions & 0 deletions
15
src/tests/unit/packages/bpmn/bpmn-data-object/bpmn-data-object-test.tsx
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 |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import { wrappedRender } from '../../../test-utils/render'; | ||
import * as React from 'react'; | ||
import { BPMNDataObject } from '../../../../../main/packages/bpmn/bpmn-data-object/bpmn-data-object'; | ||
import { BPMNDataObjectComponent } from '../../../../../main/packages/bpmn/bpmn-data-object/bpmn-data-object-component'; | ||
|
||
it('render the bpmn-transaction-component', () => { | ||
const dataObject: BPMNDataObject = new BPMNDataObject({ name: 'Data Object' }); | ||
const { getByText, baseElement } = wrappedRender( | ||
<svg> | ||
<BPMNDataObjectComponent element={dataObject} /> | ||
</svg>, | ||
); | ||
expect(getByText(dataObject.name)).toBeInTheDocument(); | ||
expect(baseElement).toMatchSnapshot(); | ||
}); |