UNPKG

@logicflow/extension

Version:
46 lines (45 loc) 1.49 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.genBpmnId = exports.groupRule = void 0; /* eslint-disable no-bitwise */ function groupRule() { var rule = { message: '分组外的节点不允许连接分组内的', validate: function (_sourceNode, _targetNode) { var isSourceNodeInsideTheGroup = !!_sourceNode.properties.parent; var isTargetNodeInsideTheGroup = !!_targetNode.properties.parent; return !(!isSourceNodeInsideTheGroup && isTargetNodeInsideTheGroup); }, }; this.targetRules.push(rule); } exports.groupRule = groupRule; /* eslint-disable no-bitwise */ var IDs = /** @class */ (function () { function IDs() { globalThis._ids = this; this._ids = new Set(); } IDs.prototype.generateId = function () { var id = 'xxxxxxx'.replace(/[x]/g, function (c) { var r = (Math.random() * 16) | 0; var v = c === 'x' ? r : (r & 0x3) | 0x8; return v.toString(16); }); return id; }; IDs.prototype.next = function () { var id = this.generateId(); while (this._ids.has(id)) { id = this.generateId(); } this._ids.add(id); return id; }; return IDs; }()); var ids = (globalThis === null || globalThis === void 0 ? void 0 : globalThis._ids) || new IDs(); function genBpmnId() { return ids.next(); } exports.genBpmnId = genBpmnId;