Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Model boxed expression of BKM #705

Closed
wants to merge 7 commits into from
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
wip: view drd
barmac committed Jul 4, 2022
commit 15b15d7b87285da2ddad439a9dc23d35461e355b
29 changes: 3 additions & 26 deletions packages/dmn-js-decision-table/src/features/view-drd/ViewDrd.js
Original file line number Diff line number Diff line change
@@ -3,7 +3,6 @@ import ViewDrdComponent from './components/ViewDrdComponent';
export default class ViewDrd {
constructor(components, eventBus, injector, sheet) {
this._injector = injector;
this._sheet = sheet;

components.onGetComponent('table.before', () => {
if (this.canViewDrd()) {
@@ -14,9 +13,7 @@ export default class ViewDrd {
eventBus.on('showDrd', () => {
const parent = injector.get('_parent', false);

const root = sheet.getRoot();

const definitions = getDefinitions(root);
const definitions = parent.getDefinitions();

if (!definitions) {
return;
@@ -36,30 +33,10 @@ export default class ViewDrd {
return false;
}

const root = this._sheet.getRoot();

const definitions = getDefinitions(root);
const definitions = parent.getDefinitions();

return !!parent.getView(definitions);
}
}

ViewDrd.$inject = [ 'components', 'eventBus', 'injector', 'sheet' ];


// helpers //////////////////////

function getDefinitions(root) {
const { businessObject } = root;

// root might not have business object
if (!businessObject) {
return;
}

const decision = businessObject.$parent;

const definitions = decision.$parent;

return definitions;
}
ViewDrd.$inject = [ 'components', 'eventBus', 'injector' ];
7 changes: 6 additions & 1 deletion packages/dmn-js-shared/src/base/EditingManager.js
Original file line number Diff line number Diff line change
@@ -4,6 +4,11 @@ import Ids from 'ids';

import { isAny } from '../util/ModelUtil';

const VIEWABLE_ELEMENTS = [
'dmn:Decision',
'dmn:Definitions',
'dmn:BusinessKnowledgeModel'
];

export default class EditingManager extends Manager {

@@ -27,7 +32,7 @@ export default class EditingManager extends Manager {
viewer.on('elements.changed', ({ elements }) => {

var viewsChanged = elements.some(function(e) {
return isAny(e, [ 'dmn:Decision', 'dmn:Definitions', 'dmn:BusinessKnowledgeModel' ]);
return isAny(e, VIEWABLE_ELEMENTS);
});

if (viewsChanged) {