UserTask.js 3.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. var __extends = (this && this.__extends) || (function () {
  2. var extendStatics = function (d, b) {
  3. extendStatics = Object.setPrototypeOf ||
  4. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  5. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  6. return extendStatics(d, b);
  7. };
  8. return function (d, b) {
  9. extendStatics(d, b);
  10. function __() { this.constructor = d; }
  11. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  12. };
  13. })();
  14. var __assign = (this && this.__assign) || function () {
  15. __assign = Object.assign || function(t) {
  16. for (var s, i = 1, n = arguments.length; i < n; i++) {
  17. s = arguments[i];
  18. for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
  19. t[p] = s[p];
  20. }
  21. return t;
  22. };
  23. return __assign.apply(this, arguments);
  24. };
  25. import { h, RectNode, RectNodeModel } from '@logicflow/core';
  26. import { getBpmnId } from '../getBpmnId';
  27. var UserTaskModel = /** @class */ (function (_super) {
  28. __extends(UserTaskModel, _super);
  29. function UserTaskModel(data, graphModel) {
  30. var _this = this;
  31. if (!data.id) {
  32. data.id = "Activity_" + getBpmnId();
  33. }
  34. _this = _super.call(this, data, graphModel) || this;
  35. return _this;
  36. }
  37. UserTaskModel.extendKey = 'UserTaskModel';
  38. return UserTaskModel;
  39. }(RectNodeModel));
  40. var UserTaskView = /** @class */ (function (_super) {
  41. __extends(UserTaskView, _super);
  42. function UserTaskView() {
  43. return _super !== null && _super.apply(this, arguments) || this;
  44. }
  45. UserTaskView.prototype.getLabelShape = function () {
  46. var model = this.props.model;
  47. var x = model.x, y = model.y, width = model.width, height = model.height;
  48. var style = model.getNodeStyle();
  49. return h('svg', {
  50. x: x - width / 2 + 5,
  51. y: y - height / 2 + 5,
  52. width: 25,
  53. height: 25,
  54. viewBox: '0 0 1274 1024',
  55. }, h('path', {
  56. fill: style.stroke,
  57. d: 'M655.807326 287.35973m-223.989415 0a218.879 218.879 0 1 0 447.978829 0 218.879 218.879 0 1 0-447.978829 0ZM1039.955839 895.482975c-0.490184-212.177424-172.287821-384.030443-384.148513-384.030443-211.862739 0-383.660376 171.85302-384.15056 384.030443L1039.955839 895.482975z',
  58. }));
  59. };
  60. UserTaskView.prototype.getShape = function () {
  61. var model = this.props.model;
  62. var x = model.x, y = model.y, width = model.width, height = model.height, radius = model.radius;
  63. var style = model.getNodeStyle();
  64. // todo: 将basic-shape对外暴露,在这里可以直接用。现在纯手写有点麻烦。
  65. return h('g', {}, [
  66. h('rect', __assign(__assign({}, style), { x: x - width / 2, y: y - height / 2, rx: radius, ry: radius, width: width,
  67. height: height })),
  68. this.getLabelShape(),
  69. ]);
  70. };
  71. UserTaskView.extendKey = 'UserTaskNode';
  72. return UserTaskView;
  73. }(RectNode));
  74. var UserTask = {
  75. type: 'bpmn:userTask',
  76. view: UserTaskView,
  77. model: UserTaskModel,
  78. };
  79. export { UserTaskView, UserTaskModel };
  80. export default UserTask;