Skip to content

Commit

Permalink
Merge branch 'develop' into feature/swimlanes
Browse files Browse the repository at this point in the history
# 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
matthiaslehnertum committed Oct 31, 2023
2 parents fec8bd8 + b15a894 commit 49d42df
Show file tree
Hide file tree
Showing 11 changed files with 113 additions and 3 deletions.
1 change: 1 addition & 0 deletions src/main/i18n/de.json
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,7 @@
"BPMNSequenceFlow": "Sequenz",
"BPMNMessageFlow": "Nachricht",
"BPMNAssociationFlow": "Assoziation",
"BPMNDataObject": "Datenobjekt",
"BPMNPool": "Pool",
"BPMNSwimlane": "Bahn",
"BPMNCreateSwimlane": "Bahn anlegen",
Expand Down
1 change: 1 addition & 0 deletions src/main/i18n/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,7 @@
"BPMNSequenceFlow": "Sequence",
"BPMNMessageFlow": "Message",
"BPMNAssociationFlow": "Association",
"BPMNDataObject": "Data Object",
"BPMNPool": "Pool",
"BPMNSwimlane": "Lane",
"BPMNCreateSwimlane": "Insert lane",
Expand Down
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 src/main/packages/bpmn/bpmn-data-object/bpmn-data-object.ts
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];
}
}
6 changes: 3 additions & 3 deletions src/main/packages/bpmn/bpmn-diagram-preview.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import { BPMNAnnotation } from './bpmn-annotation/bpmn-annotation';
import { BPMNConversation } from './bpmn-conversation/bpmn-conversation';
import { BPMNPool } from './bpmn-pool/bpmn-pool';
import { BPMNSwimlane } from './bpmn-swimlane/bpmn-swimlane';
import { BPMNDataObject } from './bpmn-data-object/bpmn-data-object';
import { BPMNGroup } from './bpmn-group/bpmn-group';

export const composeBPMNPreview: ComposePreview = (
Expand Down Expand Up @@ -92,9 +93,8 @@ export const composeBPMNPreview: ComposePreview = (
);

elements.push(
new BPMNConversation({
name: translate('packages.BPMN.BPMNConversation'),
bounds: { x: 0, y: 0, width: 40, height: 40 },
new BPMNDataObject({
bounds: { x: 0, y: 0, width: 50, height: 60 },
}),
);

Expand Down
1 change: 1 addition & 0 deletions src/main/packages/bpmn/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ export const BPMNElementType = {
BPMNEndEvent: 'BPMNEndEvent',
BPMNGateway: 'BPMNGateway',
BPMNConversation: 'BPMNConversation',
BPMNDataObject: 'BPMNDataObject',
BPMNPool: 'BPMNPool',
BPMNSwimlane: 'BPMNSwimlane',
BPMNGroup: 'BPMNGroup',
Expand Down
2 changes: 2 additions & 0 deletions src/main/packages/components.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ import { BPMNTransactionComponent } from './bpmn/bpmn-transaction/bpmn-transacti
import { BPMNCallActivityComponent } from './bpmn/bpmn-call-activity/bpmn-call-activity-component';
import { BPMNAnnotationComponent } from './bpmn/bpmn-annotation/bpmn-annotation-component';
import { BPMNConversationComponent } from './bpmn/bpmn-conversation/bpmn-conversation-component';
import { BPMNDataObjectComponent } from './bpmn/bpmn-data-object/bpmn-data-object-component';
import { BPMNGroupComponent } from './bpmn/bpmn-group/bpmn-group-component';
import { BPMNPoolComponent } from './bpmn/bpmn-pool/bpmn-pool-component';
import { BPMNSwimlaneComponent } from './bpmn/bpmn-swimlane/bpmn-swimlane-component';
Expand Down Expand Up @@ -118,6 +119,7 @@ export const Components: {
[UMLElementType.BPMNEndEvent]: BPMNEndEventComponent,
[UMLElementType.BPMNGateway]: BPMNGatewayComponent,
[UMLElementType.BPMNConversation]: BPMNConversationComponent,
[UMLElementType.BPMNDataObject]: BPMNDataObjectComponent,
[UMLElementType.BPMNPool]: BPMNPoolComponent,
[UMLElementType.BPMNSwimlane]: BPMNSwimlaneComponent,
[UMLElementType.BPMNGroup]: BPMNGroupComponent,
Expand Down
1 change: 1 addition & 0 deletions src/main/packages/popups.ts
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ export const Popups: { [key in UMLElementType | UMLRelationshipType]: ComponentT
[UMLElementType.BPMNEndEvent]: DefaultPopup,
[UMLElementType.BPMNGateway]: BPMNGatewayUpdate,
[UMLElementType.BPMNConversation]: BPMNConversationUpdate,
[UMLElementType.BPMNDataObject]: DefaultPopup,
[UMLElementType.BPMNGroup]: DefaultPopup,
[UMLElementType.BPMNPool]: BPMNPoolUpdate,
[UMLElementType.BPMNSwimlane]: DefaultPopup,
Expand Down
2 changes: 2 additions & 0 deletions src/main/packages/uml-elements.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ import { BPMNTransaction } from './bpmn/bpmn-transaction/bpmn-transaction';
import { BPMNCallActivity } from './bpmn/bpmn-call-activity/bpmn-call-activity';
import { BPMNAnnotation } from './bpmn/bpmn-annotation/bpmn-annotation';
import { BPMNConversation } from './bpmn/bpmn-conversation/bpmn-conversation';
import { BPMNDataObject } from './bpmn/bpmn-data-object/bpmn-data-object';
import { BPMNPool } from './bpmn/bpmn-pool/bpmn-pool';
import { BPMNSwimlane } from './bpmn/bpmn-swimlane/bpmn-swimlane';
import { BPMNGroup } from './bpmn/bpmn-group/bpmn-group';
Expand Down Expand Up @@ -104,6 +105,7 @@ export const UMLElements = {
[UMLElementType.BPMNEndEvent]: BPMNEndEvent,
[UMLElementType.BPMNGateway]: BPMNGateway,
[UMLElementType.BPMNConversation]: BPMNConversation,
[UMLElementType.BPMNDataObject]: BPMNDataObject,
[UMLElementType.BPMNPool]: BPMNPool,
[UMLElementType.BPMNSwimlane]: BPMNSwimlane,
[UMLElementType.BPMNGroup]: BPMNGroup,
Expand Down
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>
`;
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();
});

0 comments on commit 49d42df

Please sign in to comment.