@logicflow/extension
Version:
LogicFlow Extensions
87 lines (86 loc) • 3.92 kB
JavaScript
var __extends = (this && this.__extends) || (function () {
var extendStatics = function (d, b) {
extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
return extendStatics(d, b);
};
return function (d, b) {
if (typeof b !== "function" && b !== null)
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
var __assign = (this && this.__assign) || function () {
__assign = Object.assign || function(t) {
for (var s, i = 1, n = arguments.length; i < n; i++) {
s = arguments[i];
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
t[p] = s[p];
}
return t;
};
return __assign.apply(this, arguments);
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.ExclusiveGateway = exports.ExclusiveGatewayView = exports.ExclusiveGatewayModel = void 0;
var core_1 = require("@logicflow/core");
var getBpmnId_1 = require("../getBpmnId");
var ExclusiveGatewayModel = /** @class */ (function (_super) {
__extends(ExclusiveGatewayModel, _super);
function ExclusiveGatewayModel(data, graphModel) {
var _this = this;
if (!data.id) {
data.id = "Gateway_".concat((0, getBpmnId_1.getBpmnId)());
}
if (!data.text) {
data.text = '';
}
if (data.text && typeof data.text === 'string') {
data.text = {
value: data.text,
x: data.x,
y: data.y + 40,
};
}
_this = _super.call(this, data, graphModel) || this;
_this.points = [
[25, 0],
[50, 25],
[25, 50],
[0, 25],
];
return _this;
}
ExclusiveGatewayModel.extendKey = 'ExclusiveGatewayModel';
return ExclusiveGatewayModel;
}(core_1.PolygonNodeModel));
exports.ExclusiveGatewayModel = ExclusiveGatewayModel;
var ExclusiveGatewayView = /** @class */ (function (_super) {
__extends(ExclusiveGatewayView, _super);
function ExclusiveGatewayView() {
return _super !== null && _super.apply(this, arguments) || this;
}
ExclusiveGatewayView.prototype.getShape = function () {
var model = this.props.model;
var _a = model, x = _a.x, y = _a.y, width = _a.width, height = _a.height, points = _a.points;
var style = model.getNodeStyle();
return (0, core_1.h)('g', {
transform: "matrix(1 0 0 1 ".concat(x - width / 2, " ").concat(y - height / 2, ")"),
},
// @ts-ignore TODO: 确认 h('polygon') 报错的问题
(0, core_1.h)('polygon', __assign(__assign({}, style), { x: x, y: y, points: points })), (0, core_1.h)('path', __assign({ d: 'm 16,15 7.42857142857143,9.714285714285715 -7.42857142857143,9.714285714285715 3.428571428571429,0 5.714285714285715,-7.464228571428572 5.714285714285715,7.464228571428572 3.428571428571429,0 -7.42857142857143,-9.714285714285715 7.42857142857143,-9.714285714285715 -3.428571428571429,0 -5.714285714285715,7.464228571428572 -5.714285714285715,-7.464228571428572 -3.428571428571429,0 z' }, style)));
};
ExclusiveGatewayView.extendKey = 'ExclusiveGatewayNode';
return ExclusiveGatewayView;
}(core_1.PolygonNode));
exports.ExclusiveGatewayView = ExclusiveGatewayView;
exports.ExclusiveGateway = {
type: 'bpmn:exclusiveGateway',
view: ExclusiveGatewayView,
model: ExclusiveGatewayModel,
};
exports.default = exports.ExclusiveGateway;
;