Skip to content

Commit

Permalink
feat(feel-popup): provide container for feel popup editors
Browse files Browse the repository at this point in the history
Use via

```js
propertiesPanel: {
  feelPopupContainer: ...
}
```
  • Loading branch information
Niklas Kiefer committed Sep 18, 2023
1 parent d7cc7e8 commit 811dc4e
Show file tree
Hide file tree
Showing 5 changed files with 63 additions and 12 deletions.
16 changes: 8 additions & 8 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@
"@babel/plugin-transform-react-jsx": "^7.14.3",
"@bpmn-io/element-template-chooser": "^1.0.0",
"@bpmn-io/element-templates-icons-renderer": "^0.3.0",
"@bpmn-io/properties-panel": "^3.4.0",
"@bpmn-io/properties-panel": "^3.5.0",
"@bpmn-io/variable-resolver": "^1.1.0",
"@rollup/plugin-alias": "^5.0.0",
"@rollup/plugin-babel": "^6.0.3",
Expand Down Expand Up @@ -113,7 +113,7 @@
"zeebe-bpmn-moddle": "^1.0.0"
},
"peerDependencies": {
"@bpmn-io/properties-panel": ">= 3.2",
"@bpmn-io/properties-panel": ">= 3.5",
"bpmn-js": ">= 11.5",
"camunda-bpmn-js-behaviors": ">= 0.4",
"diagram-js": ">= 11.9"
Expand Down
4 changes: 3 additions & 1 deletion src/render/BpmnPropertiesPanel.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,8 @@ export default function BpmnPropertiesPanel(props) {
getProviders,
layoutConfig: initialLayoutConfig,
descriptionConfig,
tooltipConfig
tooltipConfig,
feelPopupContainer
} = props;

const canvas = injector.get('canvas');
Expand Down Expand Up @@ -236,6 +237,7 @@ export default function BpmnPropertiesPanel(props) {
descriptionLoaded={ onDescriptionLoaded }
tooltipConfig={ tooltipConfig }
tooltipLoaded={ onTooltipLoaded }
feelPopupContainer={ feelPopupContainer }
eventBus={ eventBus } />
</BpmnPropertiesPanelContext.Provider>;
}
Expand Down
5 changes: 4 additions & 1 deletion src/render/BpmnPropertiesPanelRenderer.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,14 +30,16 @@ export default class BpmnPropertiesPanelRenderer {
parent,
layout: layoutConfig,
description: descriptionConfig,
tooltip: tooltipConfig
tooltip: tooltipConfig,
feelPopupContainer
} = config || {};

this._eventBus = eventBus;
this._injector = injector;
this._layoutConfig = layoutConfig;
this._descriptionConfig = descriptionConfig;
this._tooltipConfig = tooltipConfig;
this._feelPopupContainer = feelPopupContainer;

this._container = domify(
'<div style="height: 100%" class="bio-properties-panel-container"></div>'
Expand Down Expand Up @@ -173,6 +175,7 @@ export default class BpmnPropertiesPanelRenderer {
layoutConfig={ this._layoutConfig }
descriptionConfig={ this._descriptionConfig }
tooltipConfig={ this._tooltipConfig }
feelPopupContainer={ this._feelPopupContainer }
/>,
this._container
);
Expand Down
46 changes: 46 additions & 0 deletions test/spec/BpmnPropertiesPanelRenderer.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -888,6 +888,48 @@ describe('<BpmnPropertiesPanelRenderer>', function() {
});


describe('feel popup', function() {

withPropertiesPanel('>=3.5')('should render feel popup in given container', async function() {

// given
const diagramXml = require('test/fixtures/service-task.bpmn').default;

let modeler;

await act(async () => {
({ modeler } = await createModeler(diagramXml, {
propertiesPanel: {
parent: propertiesContainer,
feelPopupContainer: container
}
}));
});

await act(() => {
const elementRegistry = modeler.get('elementRegistry'),
selection = modeler.get('selection');

selection.select(elementRegistry.get('ServiceTask_1'));
});

const openPopupBtn = findOpenFeelPopup('ServiceTask_1-input-0-source', container);

// when
await act(() => {
openPopupBtn.click();
});

const feelPopup = domQuery('.bio-properties-panel-feel-popup', container);

// then
expect(feelPopup).to.exist;
expect(feelPopup.parentNode).to.eql(container);
});

});


describe('a11y', function() {

it('should have no violations', async function() {
Expand Down Expand Up @@ -972,3 +1014,7 @@ function getGroup(container, id) {
function getHeaderName(container) {
return domQuery('.bio-properties-panel-header-label', container).innerText;
}

function findOpenFeelPopup(id, container) {
return container.querySelector(`[data-entry-id="${id}"] .bio-properties-panel-open-feel-popup`);
}

0 comments on commit 811dc4e

Please sign in to comment.