dmn-js-literal-expression
Advanced tools
Comparing version 5.1.1 to 5.1.2
@@ -28,6 +28,7 @@ var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); | ||
value: function render() { | ||
var _viewer$_decision = this._viewer._decision, | ||
name = _viewer$_decision.name, | ||
id = _viewer$_decision.id; | ||
// there is only one single element | ||
var _viewer$getDecision = this._viewer.getDecision(), | ||
name = _viewer$getDecision.name, | ||
id = _viewer$getDecision.id; | ||
@@ -34,0 +35,0 @@ return createVNode(1, 'div', 'decision-properties', [createVNode(1, 'h3', 'decision-name', name, 0), createVNode(1, 'h5', 'decision-id', id, 0)], 4); |
@@ -13,3 +13,3 @@ var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); | ||
import { validateId as _validateId } from 'dmn-js-shared/lib/util/IdsUtil'; | ||
import { validateId } from 'dmn-js-shared/lib/util/IdsUtil'; | ||
@@ -26,14 +26,30 @@ import EditableComponent from 'dmn-js-shared/lib/components/EditableComponent'; | ||
var viewer = _this._viewer = context.injector.get('viewer'); | ||
_this._modeling = context.injector.get('modeling'); | ||
_this.onElementsChanged = function () { | ||
_this.forceUpdate(); | ||
}; | ||
_this.setDecisionName = _this.setDecisionName.bind(_this); | ||
_this.setDecisionId = _this.setDecisionId.bind(_this); | ||
_this.onElementsChanged = _this.onElementsChanged.bind(_this); | ||
_this.validateId = _this.validateId.bind(_this); | ||
_this.setDecisionName = function (name) { | ||
_this._modeling.editDecisionName(name); | ||
}; | ||
var id = viewer._decision.id; | ||
_this.setDecisionId = function (id) { | ||
var oldId = _this.getDecision().id; | ||
if (oldId === id) { | ||
return; | ||
} | ||
_this.setupChangeListeners({ bind: id }); | ||
_this._modeling.editDecisionId(id); | ||
}; | ||
_this.validateId = function (id) { | ||
return validateId(_this.getDecision(), id); | ||
}; | ||
_this._viewer = context.injector.get('viewer'); | ||
_this._modeling = context.injector.get('modeling'); | ||
_this.setupChangeListeners({ | ||
bind: _this.getDecision().id | ||
}); | ||
return _this; | ||
@@ -45,13 +61,10 @@ } | ||
value: function componentWillUnmount() { | ||
var id = this._viewer._decision.id; | ||
this.setupChangeListeners({ | ||
unbind: id | ||
unbind: this.getDecision().id | ||
}); | ||
} | ||
}, { | ||
key: 'onElementsChanged', | ||
value: function onElementsChanged() { | ||
this.forceUpdate(); | ||
key: 'getDecision', | ||
value: function getDecision() { | ||
return this._viewer.getDecision(); | ||
} | ||
@@ -75,33 +88,8 @@ }, { | ||
}, { | ||
key: 'setDecisionName', | ||
value: function setDecisionName(name) { | ||
this._modeling.editDecisionName(name); | ||
} | ||
}, { | ||
key: 'setDecisionId', | ||
value: function setDecisionId(id) { | ||
var oldId = this._viewer._decision.id; | ||
if (oldId === id) { | ||
return; | ||
} | ||
// re-bind change listeners from oldId to new id | ||
this.setupChangeListeners({ bind: id, unbind: oldId }); | ||
this._modeling.editDecisionId(id); | ||
} | ||
}, { | ||
key: 'validateId', | ||
value: function validateId(id) { | ||
return _validateId(this._viewer._decision, id); | ||
} | ||
}, { | ||
key: 'render', | ||
value: function render() { | ||
var _viewer$_decision = this._viewer._decision, | ||
name = _viewer$_decision.name, | ||
id = _viewer$_decision.id; | ||
var _getDecision = this.getDecision(), | ||
name = _getDecision.name, | ||
id = _getDecision.id; | ||
return createVNode(1, 'header', 'decision-properties', [createComponentVNode(2, DecisionName, { | ||
@@ -108,0 +96,0 @@ 'className': 'decision-name editor', |
@@ -28,7 +28,6 @@ var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); | ||
value: function render() { | ||
var _viewer$_decision = this._viewer._decision, | ||
literalExpression = _viewer$_decision.literalExpression, | ||
variable = _viewer$_decision.variable; | ||
var _viewer$getDecision = this._viewer.getDecision(), | ||
literalExpression = _viewer$getDecision.literalExpression, | ||
variable = _viewer$getDecision.variable; | ||
return createVNode(1, 'div', 'literal-expression-properties', createVNode(1, 'table', null, [createVNode(1, 'tr', null, [createVNode(1, 'td', null, createTextVNode('Variable Name:'), 2), createVNode(1, 'td', null, createVNode(1, 'span', null, variable.name || '-', 0), 2)], 4), createVNode(1, 'tr', null, [createVNode(1, 'td', null, createTextVNode('Variable Type:'), 2), createVNode(1, 'td', null, createVNode(1, 'span', null, variable.typeRef || '-', 0), 2)], 4), createVNode(1, 'tr', null, [createVNode(1, 'td', null, createTextVNode('Expression Language:'), 2), createVNode(1, 'td', null, createVNode(1, 'span', null, literalExpression.expressionLanguage || '-', 0), 2)], 4)], 4), 2); | ||
@@ -35,0 +34,0 @@ } |
@@ -64,6 +64,6 @@ var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); | ||
var viewer = _this._viewer = context.injector.get('viewer'); | ||
_this._viewer = context.injector.get('viewer'); | ||
_this._modeling = context.injector.get('modeling'); | ||
var decision = viewer._decision; | ||
var decision = _this._viewer.getDecision(); | ||
@@ -70,0 +70,0 @@ _this.state = { |
@@ -10,3 +10,3 @@ var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); | ||
var Modeling = function () { | ||
function Modeling(eventBus, commandStack, viewer) { | ||
function Modeling(commandStack, viewer, eventBus) { | ||
var _this = this; | ||
@@ -16,5 +16,5 @@ | ||
this._eventBus = eventBus; | ||
this._commandStack = commandStack; | ||
this._viewer = viewer; | ||
this._eventBus = eventBus; | ||
@@ -34,5 +34,10 @@ eventBus.on('viewer.init', function () { | ||
}, { | ||
key: 'getDecision', | ||
value: function getDecision() { | ||
return this._viewer.getDecision(); | ||
} | ||
}, { | ||
key: 'editDecisionName', | ||
value: function editDecisionName(name) { | ||
var decision = this._viewer._decision; | ||
var decision = this.getDecision(); | ||
@@ -51,3 +56,3 @@ var context = { | ||
value: function editDecisionId(id) { | ||
var decision = this._viewer._decision; | ||
var decision = this.getDecision(); | ||
@@ -66,3 +71,3 @@ var context = { | ||
value: function editLiteralExpressionText(text) { | ||
var decision = this._viewer._decision, | ||
var decision = this.getDecision(), | ||
literalExpression = decision.literalExpression; | ||
@@ -82,3 +87,3 @@ | ||
value: function editExpressionLanguage(expressionLanguage) { | ||
var decision = this._viewer._decision, | ||
var decision = this.getDecision(), | ||
literalExpression = decision.literalExpression; | ||
@@ -98,3 +103,3 @@ | ||
value: function editVariableName(name) { | ||
var decision = this._viewer._decision, | ||
var decision = this.getDecision(), | ||
variable = decision.variable; | ||
@@ -114,3 +119,3 @@ | ||
value: function editVariableType(typeRef) { | ||
var decision = this._viewer._decision, | ||
var decision = this.getDecision(), | ||
variable = decision.variable; | ||
@@ -142,3 +147,3 @@ | ||
Modeling.$inject = ['eventBus', 'commandStack', 'viewer']; | ||
Modeling.$inject = ['commandStack', 'viewer', 'eventBus']; | ||
@@ -145,0 +150,0 @@ // helpers ////////////////////// |
@@ -28,5 +28,4 @@ var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); | ||
value: function render() { | ||
var text = this._viewer._decision.literalExpression.text; | ||
var text = this._viewer.getDecision().literalExpression.text; | ||
return createVNode(1, 'div', 'textarea', createVNode(1, 'div', 'content', text, 0), 2); | ||
@@ -33,0 +32,0 @@ } |
@@ -24,9 +24,12 @@ var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); | ||
_this._modeling = context.injector.get('modeling'); | ||
var viewer = _this._viewer = context.injector.get('viewer'); | ||
_this._viewer = context.injector.get('viewer'); | ||
_this.editLiteralExpressionText = _this.editLiteralExpressionText.bind(_this); | ||
_this.onElementsChanged = _this.onElementsChanged.bind(_this); | ||
var id = viewer._decision.literalExpression.id; | ||
// there is only one single element | ||
var _this$getLiteralExpre = _this.getLiteralExpression(), | ||
id = _this$getLiteralExpre.id; | ||
@@ -38,2 +41,7 @@ context.changeSupport.onElementsChanged(id, _this.onElementsChanged); | ||
_createClass(TextareaEditorComponent, [{ | ||
key: 'getLiteralExpression', | ||
value: function getLiteralExpression() { | ||
return this._viewer.getDecision().literalExpression; | ||
} | ||
}, { | ||
key: 'onElementsChanged', | ||
@@ -51,4 +59,6 @@ value: function onElementsChanged() { | ||
value: function render() { | ||
var text = this._viewer._decision.literalExpression.text; | ||
// there is only one single element | ||
var _getLiteralExpression = this.getLiteralExpression(), | ||
text = _getLiteralExpression.text; | ||
@@ -55,0 +65,0 @@ return createComponentVNode(2, Editor, { |
@@ -10,3 +10,3 @@ var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); | ||
var ViewDrd = function () { | ||
function ViewDrd(components, eventBus, injector, viewer) { | ||
function ViewDrd(components, viewer, eventBus, injector) { | ||
var _this = this; | ||
@@ -28,3 +28,4 @@ | ||
var definitions = getDefinitions(viewer._decision); | ||
// there is only one single element | ||
var definitions = _this.getDefinitions(); | ||
@@ -47,6 +48,12 @@ // open definitions | ||
var definitions = getDefinitions(this._viewer._decision); | ||
// there is only one single element | ||
var definitions = this.getDefinitions(); | ||
return !!parent.getView(definitions); | ||
} | ||
}, { | ||
key: 'getDefinitions', | ||
value: function getDefinitions() { | ||
return _getDefinitions(this._viewer.getDecision()); | ||
} | ||
}]); | ||
@@ -60,7 +67,7 @@ | ||
ViewDrd.$inject = ['components', 'eventBus', 'injector', 'viewer']; | ||
ViewDrd.$inject = ['components', 'viewer', 'eventBus', 'injector']; | ||
// helpers ////////////////////// | ||
function getDefinitions(decision) { | ||
function _getDefinitions(decision) { | ||
var definitions = decision.$parent; | ||
@@ -67,0 +74,0 @@ |
@@ -21,2 +21,3 @@ var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); | ||
import CoreModule from './core'; | ||
import DecisionPropertiesModule from './features/decision-properties'; | ||
@@ -157,2 +158,14 @@ import LiteralExpressionPropertiesModule from './features/literal-expression-properties'; | ||
/** | ||
* Returns the currently displayed decision. | ||
* | ||
* @return {ModdleElement} | ||
*/ | ||
}, { | ||
key: 'getDecision', | ||
value: function getDecision() { | ||
return this._decision; | ||
} | ||
/** | ||
* Attach viewer to given parent node. | ||
@@ -214,3 +227,3 @@ * | ||
value: function _getModules() { | ||
return [DecisionPropertiesModule, LiteralExpressionPropertiesModule, PoweredByModule, TextareaModule, ViewDrdModule]; | ||
return [CoreModule, DecisionPropertiesModule, LiteralExpressionPropertiesModule, PoweredByModule, TextareaModule, ViewDrdModule]; | ||
} | ||
@@ -217,0 +230,0 @@ }, { |
{ | ||
"name": "dmn-js-literal-expression", | ||
"description": "A literal expression view for dmn-js", | ||
"version": "5.1.1", | ||
"version": "5.1.2", | ||
"scripts": { | ||
@@ -29,3 +29,3 @@ "test": "karma start", | ||
"diagram-js": "^2.4.0", | ||
"dmn-js-shared": "^5.1.1", | ||
"dmn-js-shared": "^5.1.2", | ||
"escape-html": "^1.0.3", | ||
@@ -32,0 +32,0 @@ "inferno": "^5.0.5", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
148464
78
1576
Updateddmn-js-shared@^5.1.2