Skip to content

Commit 5bfa548

Browse files
committed
feat: pass FEEL popup links configuration
Related to bpmn-io/properties-panel#382
1 parent a0f889a commit 5bfa548

File tree

3 files changed

+63
-2
lines changed

3 files changed

+63
-2
lines changed

src/render/BpmnPropertiesPanel.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,8 @@ import { PanelPlaceholderProvider } from './PanelPlaceholderProvider';
2828
* @param {Object} props.layoutConfig
2929
* @param {Object} props.descriptionConfig
3030
* @param {Object} props.tooltipConfig
31+
* @param {HTMLElement} props.feelPopupContainer
32+
* @param {Function} props.getFeelPopupLinks
3133
*/
3234
export default function BpmnPropertiesPanel(props) {
3335
const {
@@ -37,7 +39,8 @@ export default function BpmnPropertiesPanel(props) {
3739
layoutConfig: initialLayoutConfig,
3840
descriptionConfig,
3941
tooltipConfig,
40-
feelPopupContainer
42+
feelPopupContainer,
43+
getFeelPopupLinks
4144
} = props;
4245

4346
const canvas = injector.get('canvas');
@@ -238,6 +241,7 @@ export default function BpmnPropertiesPanel(props) {
238241
tooltipConfig={ tooltipConfig }
239242
tooltipLoaded={ onTooltipLoaded }
240243
feelPopupContainer={ feelPopupContainer }
244+
getFeelPopupLinks={ getFeelPopupLinks }
241245
eventBus={ eventBus } />
242246
</BpmnPropertiesPanelContext.Provider>;
243247
}

src/render/BpmnPropertiesPanelRenderer.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,8 @@ export default class BpmnPropertiesPanelRenderer {
3131
layout: layoutConfig,
3232
description: descriptionConfig,
3333
tooltip: tooltipConfig,
34-
feelPopupContainer
34+
feelPopupContainer,
35+
getFeelPopupLinks
3536
} = config || {};
3637

3738
this._eventBus = eventBus;
@@ -40,6 +41,7 @@ export default class BpmnPropertiesPanelRenderer {
4041
this._descriptionConfig = descriptionConfig;
4142
this._tooltipConfig = tooltipConfig;
4243
this._feelPopupContainer = feelPopupContainer;
44+
this._getFeelPopupLinks = getFeelPopupLinks;
4345

4446
this._container = domify(
4547
'<div style="height: 100%" class="bio-properties-panel-container"></div>'
@@ -176,6 +178,7 @@ export default class BpmnPropertiesPanelRenderer {
176178
descriptionConfig={ this._descriptionConfig }
177179
tooltipConfig={ this._tooltipConfig }
178180
feelPopupContainer={ this._feelPopupContainer }
181+
getFeelPopupLinks={ this._getFeelPopupLinks }
179182
/>,
180183
this._container
181184
);

test/spec/BpmnPropertiesPanelRenderer.spec.js

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ import {
2222

2323
import {
2424
query as domQuery,
25+
queryAll as domQueryAll,
2526
domify
2627
} from 'min-dom';
2728

@@ -932,6 +933,59 @@ describe('<BpmnPropertiesPanelRenderer>', function() {
932933
});
933934

934935

936+
it('should render links', async function() {
937+
938+
// given
939+
const diagramXml = require('test/fixtures/service-task.bpmn').default;
940+
941+
let modeler;
942+
943+
await act(async () => {
944+
({ modeler } = await createModeler(diagramXml, {
945+
propertiesPanel: {
946+
parent: propertiesContainer,
947+
feelPopupContainer: container,
948+
getFeelPopupLinks: (type) => {
949+
if (type === 'feel') {
950+
return [
951+
{ href: 'https://foo.com/', title: 'Foo' },
952+
{ href: 'https://bar.com/', title: 'Bar' }
953+
];
954+
}
955+
956+
return [];
957+
}
958+
}
959+
}));
960+
});
961+
962+
await act(() => {
963+
const elementRegistry = modeler.get('elementRegistry'),
964+
selection = modeler.get('selection');
965+
966+
selection.select(elementRegistry.get('ServiceTask_1'));
967+
});
968+
969+
// when
970+
await triggerPopupOpen('ServiceTask_1-input-0-source', container);
971+
972+
const feelPopup = getFeelPopupElement(container);
973+
974+
// then
975+
expect(feelPopup).to.exist;
976+
977+
const links = domQueryAll('.bio-properties-panel-feel-popup__title-link', container);
978+
979+
expect(links.length).to.equal(2);
980+
981+
expect(links[0].href).to.equal('https://foo.com/');
982+
expect(links[0].textContent).to.equal('Foo');
983+
984+
expect(links[1].href).to.equal('https://bar.com/');
985+
expect(links[1].textContent).to.equal('Bar');
986+
});
987+
988+
935989
describe('module support', function() {
936990

937991
let modeler;

0 commit comments

Comments
 (0)