Skip to content

Commit

Permalink
feat: allow multiple elements
Browse files Browse the repository at this point in the history
  • Loading branch information
philippfromme committed Aug 9, 2024
1 parent 9cd9fd0 commit 6b51c4b
Show file tree
Hide file tree
Showing 10 changed files with 284 additions and 144 deletions.
3 changes: 1 addition & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,7 @@
"start": "npm run start:cloud",
"start:cloud": "cross-env SINGLE_START=cloud npm run dev",
"start:platform": "cross-env SINGLE_START=platform npm run dev",
"start:bpmn": "cross-env SINGLE_START=bpmn npm run dev",
"prepare": "run-s build"
"start:bpmn": "cross-env SINGLE_START=bpmn npm run dev"
},
"repository": {
"type": "git",
Expand Down
11 changes: 11 additions & 0 deletions src/icons/icon-multiple-elements.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 3 additions & 1 deletion src/icons/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ import TaskNoneIcon from './bpmn-icon-task-none.svg';
import TextAnnotationicon from './bpmn-icon-text-annotation.svg';
import TransactionIcon from './bpmn-icon-transaction.svg';
import UserTaskIcon from './bpmn-icon-user-task.svg';
import MultipleElementsIcon from './icon-multiple-elements.svg';

export default {
'Association': AssociationIcon,
Expand Down Expand Up @@ -195,5 +196,6 @@ export default {
'Task': TaskNoneIcon,
'TextAnnotation': TextAnnotationicon,
'Transaction': TransactionIcon,
'UserTask': UserTaskIcon
'UserTask': UserTaskIcon,
'multipleElements': MultipleElementsIcon
};
5 changes: 5 additions & 0 deletions src/provider/HOCs/withVariableContext.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { getVariablesForElement } from '@bpmn-io/extract-process-variables/zeebe';
import { useEffect, useState } from '@bpmn-io/properties-panel/preact/hooks';
import { useService } from '../../hooks';
import { isArray } from 'min-dash';

const fallbackResolver = {
getVariablesForElement: bo => getVariablesForElement(bo)
Expand All @@ -10,6 +11,10 @@ export function withVariableContext(Component) {
return props => {
const { bpmnElement, element } = props;

if (isArray(element) && element.length > 1) {
return <Component { ...props } variables={ [] }></Component>;
}

const bo = (bpmnElement || element).businessObject;

const [ variables, setVariables ] = useState([]);
Expand Down
2 changes: 2 additions & 0 deletions src/provider/bpmn/BpmnPropertiesProvider.js
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,8 @@ function EscalationGroup(element, injector) {
}

function TimerGroup(element, injector) {
if (element.length > 1) return null;

const translate = injector.get('translate');
const group = {
label: translate('Timer'),
Expand Down
10 changes: 9 additions & 1 deletion src/provider/zeebe/ZeebePropertiesProvider.js
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,10 @@ export default class ZeebePropertiesProvider {
// (3) remove message group when not applicable
groups = removeMessageGroup(groups, element);

if (element.length > 1) {
return groups.filter(group => group.multiElement);
}

return groups;
};
}
Expand Down Expand Up @@ -132,7 +136,8 @@ function TaskDefinitionGroup(element, injector) {
entries: [
...TaskDefinitionProps({ element })
],
component: Group
component: Group,
multiElement: true
};

return group.entries.length ? group : null;
Expand Down Expand Up @@ -302,6 +307,7 @@ function AssignmentDefinitionGroup(element, injector) {
}

function ExecutionListenersGroup(element, injector) {
if (element.length > 1) return null;
const translate = injector.get('translate');
const group = {
label: translate('Execution listeners'),
Expand All @@ -318,6 +324,8 @@ function ExecutionListenersGroup(element, injector) {
}

function ExtensionPropertiesGroup(element, injector) {
if (element.length > 1) return null;

const translate = injector.get('translate');
const group = {
label: translate('Extension properties'),
Expand Down
Loading

0 comments on commit 6b51c4b

Please sign in to comment.