UNPKG

@logicflow/extension

Version:
93 lines (92 loc) 3.52 kB
"use strict"; 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.EndEvent = exports.EndEventView = exports.EndEventModel = void 0; var core_1 = require("@logicflow/core"); var getBpmnId_1 = require("../getBpmnId"); var EndEventModel = /** @class */ (function (_super) { __extends(EndEventModel, _super); function EndEventModel(data, graphModel) { if (!data.id) { data.id = "Event_".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, }; } return _super.call(this, data, graphModel) || this; } EndEventModel.prototype.setAttributes = function () { this.r = 18; }; EndEventModel.prototype.getConnectedSourceRules = function () { var rules = _super.prototype.getConnectedSourceRules.call(this); var notAsSource = { message: '结束节点不能作为边的起点', validate: function () { return false; }, }; rules.push(notAsSource); return rules; }; EndEventModel.extendKey = 'EndEventModel'; return EndEventModel; }(core_1.CircleNodeModel)); exports.EndEventModel = EndEventModel; var EndEventView = /** @class */ (function (_super) { __extends(EndEventView, _super); function EndEventView() { return _super !== null && _super.apply(this, arguments) || this; } EndEventView.prototype.getAnchorStyle = function () { return { visibility: 'hidden', }; }; EndEventView.prototype.getShape = function () { var model = this.props.model; var style = model.getNodeStyle(); var _a = model, x = _a.x, y = _a.y, r = _a.r; var outCircle = _super.prototype.getShape.call(this); return (0, core_1.h)('g', {}, outCircle, (0, core_1.h)('circle', __assign(__assign({}, style), { cx: x, cy: y, r: r - 5 }))); }; EndEventView.extendKey = 'EndEventView'; return EndEventView; }(core_1.CircleNode)); exports.EndEventView = EndEventView; exports.EndEvent = { type: 'bpmn:endEvent', view: EndEventView, model: EndEventModel, }; exports.default = exports.EndEvent;