UNPKG

@logicflow/vue-node-registry

Version:

LogicFlow Vue Component Node Registry

62 lines 2.76 kB
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); }; import { HtmlNodeModel } from '@logicflow/core'; import { cloneDeep, isNil } from 'lodash-es'; var VueNodeModel = /** @class */ (function (_super) { __extends(VueNodeModel, _super); function VueNodeModel() { return _super !== null && _super.apply(this, arguments) || this; } VueNodeModel.prototype.setAttributes = function () { // DONE: 解决 width、height、radius 为 0 时的问题 var _a = this.properties, width = _a.width, height = _a.height, radius = _a.radius; if (!isNil(width)) { this.width = width; } if (!isNil(height)) { this.height = height; } if (!isNil(radius)) { this.radius = radius; } }; VueNodeModel.prototype.getTextStyle = function () { var _a = this.properties, _b = _a.refX, refX = _b === void 0 ? 0 : _b, _c = _a.refY, refY = _c === void 0 ? 0 : _c, textStyle = _a.textStyle; var style = _super.prototype.getTextStyle.call(this); // 通过 transform 重新设置 text 的位置 return __assign(__assign(__assign({}, style), (cloneDeep(textStyle) || {})), { transform: "matrix(1 0 0 1 ".concat(refX, " ").concat(refY, ")") }); }; VueNodeModel.prototype.getNodeStyle = function () { var style = _super.prototype.getNodeStyle.call(this); var customNodeStyle = this.properties.style; return __assign(__assign({}, style), (cloneDeep(customNodeStyle) || {})); }; return VueNodeModel; }(HtmlNodeModel)); export { VueNodeModel }; export default VueNodeModel; //# sourceMappingURL=model.js.map