dmn-js-decision-table-custom-z
Version:
A decision table view for dmn-js
237 lines (202 loc) • 8.72 kB
JavaScript
function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a 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); } }
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); }
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
function _get(target, property, receiver) { if (typeof Reflect !== "undefined" && Reflect.get) { _get = Reflect.get; } else { _get = function _get(target, property, receiver) { var base = _superPropBase(target, property); if (!base) return; var desc = Object.getOwnPropertyDescriptor(base, property); if (desc.get) { return desc.get.call(receiver); } return desc.value; }; } return _get(target, property, receiver || target); }
function _superPropBase(object, property) { while (!Object.prototype.hasOwnProperty.call(object, property)) { object = _getPrototypeOf(object); if (object === null) break; } return object; }
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
import { assign } from 'min-dash';
import BaseModeling from 'table-js/lib/features/modeling/Modeling';
import UpdateAllowedValuesHandler from './cmd/UpdateAllowedValuesHandler';
import UpdatePropertiesHandler from 'dmn-js-shared/lib/features/modeling/cmd/UpdatePropertiesHandler';
import IdClaimHandler from './cmd/IdClaimHandler';
var Modeling = /*#__PURE__*/function (_BaseModeling) {
_inherits(Modeling, _BaseModeling);
function Modeling(eventBus, elementFactory, commandStack, sheet) {
var _this;
_classCallCheck(this, Modeling);
_this = _possibleConstructorReturn(this, _getPrototypeOf(Modeling).call(this, eventBus, elementFactory, commandStack));
_this._eventBus = eventBus;
_this._elementFactory = elementFactory;
_this._commandStack = commandStack;
_this._sheet = sheet;
return _this;
}
_createClass(Modeling, [{
key: "getHandlers",
value: function getHandlers() {
return Modeling._getHandlers();
}
}, {
key: "editDecisionTableName",
value: function editDecisionTableName(name) {
var root = this._sheet.getRoot(),
businessObject = root.businessObject,
parentBusinessObject = businessObject.$parent;
var context = {
element: parentBusinessObject,
properties: {
name: name
}
};
this._commandStack.execute('element.updateProperties', context);
}
}, {
key: "editDecisionTableId",
value: function editDecisionTableId(id) {
var root = this._sheet.getRoot(),
businessObject = root.businessObject,
parentBusinessObject = businessObject.$parent;
var context = {
element: parentBusinessObject,
properties: {
id: id
}
};
this._commandStack.execute('element.updateProperties', context);
}
}, {
key: "editHitPolicy",
value: function editHitPolicy(hitPolicy, aggregation) {
var root = this._sheet.getRoot(),
businessObject = root.businessObject;
var context = {
element: businessObject,
properties: {
hitPolicy: hitPolicy,
aggregation: aggregation
}
};
this._commandStack.execute('element.updateProperties', context);
}
}, {
key: "updateProperties",
value: function updateProperties(el, props) {
var context = {
element: el,
properties: props
};
this._commandStack.execute('element.updateProperties', context);
}
}, {
key: "editInputExpression",
value: function editInputExpression(inputExpression, props) {
var context = {
element: inputExpression,
properties: props
};
this._commandStack.execute('element.updateProperties', context);
}
}, {
key: "editOutputName",
value: function editOutputName(output, name) {
var context = {
element: output,
properties: {
name: name
}
};
this._commandStack.execute('element.updateProperties', context);
}
}, {
key: "editInputExpressionTypeRef",
value: function editInputExpressionTypeRef(inputExpression, typeRef) {
var context = {
element: inputExpression,
properties: {
typeRef: typeRef
}
};
this._commandStack.execute('element.updateProperties', context);
}
}, {
key: "editOutputTypeRef",
value: function editOutputTypeRef(output, typeRef) {
var context = {
element: output,
properties: {
typeRef: typeRef
}
};
this._commandStack.execute('element.updateProperties', context);
}
}, {
key: "editCell",
value: function editCell(cell, text) {
var context = {
element: cell,
properties: {
text: text
}
};
this._commandStack.execute('element.updateProperties', context);
}
}, {
key: "editAnnotation",
value: function editAnnotation(rule, description) {
var context = {
element: rule,
properties: {
description: description
}
};
this._commandStack.execute('element.updateProperties', context);
}
}, {
key: "editAllowedValues",
value: function editAllowedValues(element, allowedValues) {
var context = {
element: element,
allowedValues: allowedValues
};
this._commandStack.execute('editAllowedValues', context);
}
}, {
key: "editExpressionLanguage",
value: function editExpressionLanguage(element, expressionLanguage) {
var context = {
element: element,
properties: {
expressionLanguage: expressionLanguage
}
};
this._commandStack.execute('element.updateProperties', context);
}
}, {
key: "claimId",
value: function claimId(id, moddleElement) {
var context = {
id: id,
element: moddleElement,
claiming: true
};
this._commandStack.execute('id.updateClaim', context);
}
}, {
key: "unclaimId",
value: function unclaimId(id, moddleElement) {
var context = {
id: id,
element: moddleElement
};
this._commandStack.execute('id.updateClaim', context);
}
}], [{
key: "_getHandlers",
value: function _getHandlers() {
return assign({}, _get(_getPrototypeOf(Modeling), "_getHandlers", this).call(this), {
'editAllowedValues': UpdateAllowedValuesHandler,
'element.updateProperties': UpdatePropertiesHandler,
'id.updateClaim': IdClaimHandler
});
}
}]);
return Modeling;
}(BaseModeling);
export { Modeling as default };
Modeling.$inject = ['eventBus', 'elementFactory', 'commandStack', 'sheet'];
//# sourceMappingURL=Modeling.js.map