本地logicflow依赖包
This commit is contained in:
1 parent
8ff82208ad
commit
30f225df00
290 files changed
+18624
-16276
No files matched your search
@@ -0,0 +1,46 @@
|
||||
export declare const StartEventConfig: {
|
||||
width: number;
|
||||
height: number;
|
||||
};
|
||||
export declare const EndEventConfig: {
|
||||
width: number;
|
||||
height: number;
|
||||
};
|
||||
export declare const ExclusiveGatewayConfig: {
|
||||
width: number;
|
||||
height: number;
|
||||
};
|
||||
export declare const ServiceTaskConfig: {
|
||||
width: number;
|
||||
height: number;
|
||||
};
|
||||
export declare const UserTaskConfig: {
|
||||
width: number;
|
||||
height: number;
|
||||
};
|
||||
export declare const theme: {
|
||||
rect: {
|
||||
radius: number;
|
||||
stroke: string;
|
||||
};
|
||||
circle: {
|
||||
r: number;
|
||||
stroke: string;
|
||||
};
|
||||
polygon: {
|
||||
stroke: string;
|
||||
};
|
||||
polyline: {
|
||||
stroke: string;
|
||||
hoverStroke: string;
|
||||
selectedStroke: string;
|
||||
};
|
||||
edgeText: {
|
||||
background: {
|
||||
fill: string;
|
||||
height: number;
|
||||
stroke: string;
|
||||
radius: number;
|
||||
};
|
||||
};
|
||||
};
|
||||
@@ -0,0 +1,46 @@
|
||||
export var StartEventConfig = {
|
||||
width: 40,
|
||||
height: 40,
|
||||
};
|
||||
export var EndEventConfig = {
|
||||
width: 40,
|
||||
height: 40,
|
||||
};
|
||||
export var ExclusiveGatewayConfig = {
|
||||
width: 40,
|
||||
height: 40,
|
||||
};
|
||||
export var ServiceTaskConfig = {
|
||||
width: 100,
|
||||
height: 80,
|
||||
};
|
||||
export var UserTaskConfig = {
|
||||
width: 100,
|
||||
height: 80,
|
||||
};
|
||||
export var theme = {
|
||||
rect: {
|
||||
radius: 5,
|
||||
stroke: 'rgb(24, 125, 255)',
|
||||
},
|
||||
circle: {
|
||||
r: 18,
|
||||
stroke: 'rgb(24, 125, 255)',
|
||||
},
|
||||
polygon: {
|
||||
stroke: 'rgb(24, 125, 255)',
|
||||
},
|
||||
polyline: {
|
||||
stroke: 'rgb(24, 125, 255)',
|
||||
hoverStroke: 'rgb(24, 125, 255)',
|
||||
selectedStroke: 'rgb(24, 125, 255)',
|
||||
},
|
||||
edgeText: {
|
||||
background: {
|
||||
fill: 'white',
|
||||
height: 14,
|
||||
stroke: 'transparent',
|
||||
radius: 3,
|
||||
},
|
||||
},
|
||||
};
|
||||
@@ -0,0 +1,21 @@
|
||||
import { CircleNode, CircleNodeModel } from '@logicflow/core';
|
||||
declare class EndEventModel extends CircleNodeModel {
|
||||
static extendKey: string;
|
||||
constructor(data: any, graphModel: any);
|
||||
setAttributes(): void;
|
||||
getConnectedSourceRules(): import("@logicflow/core").ConnectRule[];
|
||||
}
|
||||
declare class EndEventView extends CircleNode {
|
||||
static extendKey: string;
|
||||
getAnchorStyle(): {
|
||||
visibility: string;
|
||||
};
|
||||
getShape(): import("preact").VNode<any>;
|
||||
}
|
||||
declare const EndEvent: {
|
||||
type: string;
|
||||
view: typeof EndEventView;
|
||||
model: typeof EndEventModel;
|
||||
};
|
||||
export { EndEventView, EndEventModel };
|
||||
export default EndEvent;
|
||||
@@ -0,0 +1,88 @@
|
||||
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 (b.hasOwnProperty(p)) d[p] = b[p]; };
|
||||
return extendStatics(d, b);
|
||||
};
|
||||
return function (d, b) {
|
||||
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 { CircleNode, CircleNodeModel, h } from '@logicflow/core';
|
||||
import { getBpmnId } from '../getBpmnId';
|
||||
var EndEventModel = /** @class */ (function (_super) {
|
||||
__extends(EndEventModel, _super);
|
||||
function EndEventModel(data, graphModel) {
|
||||
var _this = this;
|
||||
if (!data.id) {
|
||||
data.id = "Event_" + 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;
|
||||
return _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;
|
||||
}(CircleNodeModel));
|
||||
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 x = model.x, y = model.y, r = model.r;
|
||||
var outCircle = _super.prototype.getShape.call(this);
|
||||
return h('g', {}, outCircle, h('circle', __assign(__assign({}, style), { cx: x, cy: y, r: r - 5 })));
|
||||
};
|
||||
EndEventView.extendKey = 'EndEventView';
|
||||
return EndEventView;
|
||||
}(CircleNode));
|
||||
var EndEvent = {
|
||||
type: 'bpmn:endEvent',
|
||||
view: EndEventView,
|
||||
model: EndEventModel,
|
||||
};
|
||||
export { EndEventView, EndEventModel };
|
||||
export default EndEvent;
|
||||
@@ -0,0 +1,17 @@
|
||||
import { CircleNode, CircleNodeModel } from '@logicflow/core';
|
||||
declare class StartEventModel extends CircleNodeModel {
|
||||
static extendKey: string;
|
||||
constructor(data: any, graphModel: any);
|
||||
setAttributes(): void;
|
||||
getConnectedTargetRules(): import("@logicflow/core").ConnectRule[];
|
||||
}
|
||||
declare class StartEventView extends CircleNode {
|
||||
static extendKey: string;
|
||||
}
|
||||
declare const StartEvent: {
|
||||
type: string;
|
||||
view: typeof StartEventView;
|
||||
model: typeof StartEventModel;
|
||||
};
|
||||
export { StartEventModel, StartEventView };
|
||||
export default StartEvent;
|
||||
@@ -0,0 +1,67 @@
|
||||
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 (b.hasOwnProperty(p)) d[p] = b[p]; };
|
||||
return extendStatics(d, b);
|
||||
};
|
||||
return function (d, b) {
|
||||
extendStatics(d, b);
|
||||
function __() { this.constructor = d; }
|
||||
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
||||
};
|
||||
})();
|
||||
import { CircleNode, CircleNodeModel } from '@logicflow/core';
|
||||
import { getBpmnId } from '../getBpmnId';
|
||||
var StartEventModel = /** @class */ (function (_super) {
|
||||
__extends(StartEventModel, _super);
|
||||
function StartEventModel(data, graphModel) {
|
||||
var _this = this;
|
||||
if (!data.id) {
|
||||
data.id = "Event_" + 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,
|
||||
};
|
||||
}
|
||||
// fix: 不能直接全部加,会导致下载后再次上传,位置错误。
|
||||
// data.text.y += 40;
|
||||
_this = _super.call(this, data, graphModel) || this;
|
||||
return _this;
|
||||
}
|
||||
StartEventModel.prototype.setAttributes = function () {
|
||||
this.r = 18;
|
||||
};
|
||||
StartEventModel.prototype.getConnectedTargetRules = function () {
|
||||
var rules = _super.prototype.getConnectedTargetRules.call(this);
|
||||
var notAsTarget = {
|
||||
message: '起始节点不能作为边的终点',
|
||||
validate: function () { return false; },
|
||||
};
|
||||
rules.push(notAsTarget);
|
||||
return rules;
|
||||
};
|
||||
StartEventModel.extendKey = 'StartEventModel';
|
||||
return StartEventModel;
|
||||
}(CircleNodeModel));
|
||||
var StartEventView = /** @class */ (function (_super) {
|
||||
__extends(StartEventView, _super);
|
||||
function StartEventView() {
|
||||
return _super !== null && _super.apply(this, arguments) || this;
|
||||
}
|
||||
StartEventView.extendKey = 'StartEventNode';
|
||||
return StartEventView;
|
||||
}(CircleNode));
|
||||
var StartEvent = {
|
||||
type: 'bpmn:startEvent',
|
||||
view: StartEventView,
|
||||
model: StartEventModel,
|
||||
};
|
||||
export { StartEventModel, StartEventView };
|
||||
export default StartEvent;
|
||||
@@ -0,0 +1,15 @@
|
||||
import { PolylineEdge, PolylineEdgeModel } from '@logicflow/core';
|
||||
declare class SequenceFlowModel extends PolylineEdgeModel {
|
||||
static extendKey: string;
|
||||
constructor(data: any, graphModel: any);
|
||||
}
|
||||
declare class SequenceFlowView extends PolylineEdge {
|
||||
static extendKey: string;
|
||||
}
|
||||
declare const SequenceFlow: {
|
||||
type: string;
|
||||
view: typeof SequenceFlowView;
|
||||
model: typeof SequenceFlowModel;
|
||||
};
|
||||
export { SequenceFlowView, SequenceFlowModel };
|
||||
export default SequenceFlow;
|
||||
@@ -0,0 +1,43 @@
|
||||
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 (b.hasOwnProperty(p)) d[p] = b[p]; };
|
||||
return extendStatics(d, b);
|
||||
};
|
||||
return function (d, b) {
|
||||
extendStatics(d, b);
|
||||
function __() { this.constructor = d; }
|
||||
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
||||
};
|
||||
})();
|
||||
import { PolylineEdge, PolylineEdgeModel } from '@logicflow/core';
|
||||
import { getBpmnId } from '../getBpmnId';
|
||||
var SequenceFlowModel = /** @class */ (function (_super) {
|
||||
__extends(SequenceFlowModel, _super);
|
||||
function SequenceFlowModel(data, graphModel) {
|
||||
var _this = this;
|
||||
if (!data.id) {
|
||||
data.id = "Flow_" + getBpmnId();
|
||||
}
|
||||
_this = _super.call(this, data, graphModel) || this;
|
||||
return _this;
|
||||
}
|
||||
SequenceFlowModel.extendKey = 'SequenceFlowModel';
|
||||
return SequenceFlowModel;
|
||||
}(PolylineEdgeModel));
|
||||
var SequenceFlowView = /** @class */ (function (_super) {
|
||||
__extends(SequenceFlowView, _super);
|
||||
function SequenceFlowView() {
|
||||
return _super !== null && _super.apply(this, arguments) || this;
|
||||
}
|
||||
SequenceFlowView.extendKey = 'SequenceFlowEdge';
|
||||
return SequenceFlowView;
|
||||
}(PolylineEdge));
|
||||
var SequenceFlow = {
|
||||
type: 'bpmn:sequenceFlow',
|
||||
view: SequenceFlowView,
|
||||
model: SequenceFlowModel,
|
||||
};
|
||||
export { SequenceFlowView, SequenceFlowModel };
|
||||
export default SequenceFlow;
|
||||
@@ -0,0 +1,16 @@
|
||||
import { PolygonNode, PolygonNodeModel } from '@logicflow/core';
|
||||
declare class ExclusiveGatewayModel extends PolygonNodeModel {
|
||||
static extendKey: string;
|
||||
constructor(data: any, graphModel: any);
|
||||
}
|
||||
declare class ExclusiveGatewayView extends PolygonNode {
|
||||
static extendKey: string;
|
||||
getShape(): import("preact").VNode<any>;
|
||||
}
|
||||
declare const ExclusiveGateway: {
|
||||
type: string;
|
||||
view: typeof ExclusiveGatewayView;
|
||||
model: typeof ExclusiveGatewayModel;
|
||||
};
|
||||
export { ExclusiveGatewayView, ExclusiveGatewayModel };
|
||||
export default ExclusiveGateway;
|
||||
@@ -0,0 +1,80 @@
|
||||
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 (b.hasOwnProperty(p)) d[p] = b[p]; };
|
||||
return extendStatics(d, b);
|
||||
};
|
||||
return function (d, b) {
|
||||
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 { h, PolygonNode, PolygonNodeModel } from '@logicflow/core';
|
||||
import { getBpmnId } from '../getBpmnId';
|
||||
var ExclusiveGatewayModel = /** @class */ (function (_super) {
|
||||
__extends(ExclusiveGatewayModel, _super);
|
||||
function ExclusiveGatewayModel(data, graphModel) {
|
||||
var _this = this;
|
||||
if (!data.id) {
|
||||
data.id = "Gateway_" + 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;
|
||||
}(PolygonNodeModel));
|
||||
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 x = model.x, y = model.y, width = model.width, height = model.height, points = model.points;
|
||||
var style = model.getNodeStyle();
|
||||
return h('g', {
|
||||
transform: "matrix(1 0 0 1 " + (x - width / 2) + " " + (y - height / 2) + ")",
|
||||
}, h('polygon', __assign(__assign({}, style), { x: x,
|
||||
y: y,
|
||||
points: points })), 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;
|
||||
}(PolygonNode));
|
||||
var ExclusiveGateway = {
|
||||
type: 'bpmn:exclusiveGateway',
|
||||
view: ExclusiveGatewayView,
|
||||
model: ExclusiveGatewayModel,
|
||||
};
|
||||
export { ExclusiveGatewayView, ExclusiveGatewayModel };
|
||||
export default ExclusiveGateway;
|
||||
@@ -0,0 +1 @@
|
||||
export declare function getBpmnId(): string;
|
||||
@@ -0,0 +1,5 @@
|
||||
import Ids from 'ids';
|
||||
var ids = new Ids([32, 32, 1]);
|
||||
export function getBpmnId() {
|
||||
return ids.next();
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
import { StartEventModel, StartEventView } from './events/StartEvent';
|
||||
import { EndEventView, EndEventModel } from './events/EndEvent';
|
||||
import { ExclusiveGatewayView, ExclusiveGatewayModel } from './gateways/ExclusiveGateway';
|
||||
import { UserTaskView, UserTaskModel } from './tasks/UserTask';
|
||||
import { ServiceTaskView, ServiceTaskModel } from './tasks/ServiceTask';
|
||||
import { SequenceFlowView, SequenceFlowModel } from './flow/SequenceFlow';
|
||||
declare class BpmnElement {
|
||||
static pluginName: string;
|
||||
constructor({ lf }: {
|
||||
lf: any;
|
||||
});
|
||||
}
|
||||
export { BpmnElement, StartEventModel, StartEventView, EndEventView, EndEventModel, ExclusiveGatewayView, ExclusiveGatewayModel, UserTaskView, UserTaskModel, ServiceTaskView, ServiceTaskModel, SequenceFlowView, SequenceFlowModel, };
|
||||
@@ -0,0 +1,28 @@
|
||||
// import LogicFlow from '@logicflow/core';
|
||||
import StartEvent, { StartEventModel, StartEventView } from './events/StartEvent';
|
||||
import EndEvent, { EndEventView, EndEventModel } from './events/EndEvent';
|
||||
import ExclusiveGateway, { ExclusiveGatewayView, ExclusiveGatewayModel } from './gateways/ExclusiveGateway';
|
||||
import UserTask, { UserTaskView, UserTaskModel } from './tasks/UserTask';
|
||||
import ServiceTask, { ServiceTaskView, ServiceTaskModel } from './tasks/ServiceTask';
|
||||
import SequenceFlow, { SequenceFlowView, SequenceFlowModel } from './flow/SequenceFlow';
|
||||
import { theme } from './constant';
|
||||
// todo: name
|
||||
var BpmnElement = /** @class */ (function () {
|
||||
function BpmnElement(_a) {
|
||||
var lf = _a.lf;
|
||||
lf.setTheme(theme);
|
||||
lf.register(StartEvent);
|
||||
lf.register(EndEvent);
|
||||
lf.register(ExclusiveGateway);
|
||||
lf.register(UserTask);
|
||||
lf.register(ServiceTask);
|
||||
// 支持自定义bpmn元素的边
|
||||
if (!lf.options.customBpmnEdge) {
|
||||
lf.register(SequenceFlow);
|
||||
lf.setDefaultEdgeType('bpmn:sequenceFlow');
|
||||
}
|
||||
}
|
||||
BpmnElement.pluginName = 'bpmnElement';
|
||||
return BpmnElement;
|
||||
}());
|
||||
export { BpmnElement, StartEventModel, StartEventView, EndEventView, EndEventModel, ExclusiveGatewayView, ExclusiveGatewayModel, UserTaskView, UserTaskModel, ServiceTaskView, ServiceTaskModel, SequenceFlowView, SequenceFlowModel, };
|
||||
@@ -0,0 +1,17 @@
|
||||
import { RectNodeModel, RectNode } from '@logicflow/core';
|
||||
declare class ServiceTaskModel extends RectNodeModel {
|
||||
static extendKey: string;
|
||||
constructor(data: any, graphModel: any);
|
||||
}
|
||||
declare class ServiceTaskView extends RectNode {
|
||||
static extendKey: string;
|
||||
getLabelShape(): import("preact").VNode<any>;
|
||||
getShape(): import("preact").VNode<any>;
|
||||
}
|
||||
declare const ServiceTask: {
|
||||
type: string;
|
||||
view: typeof ServiceTaskView;
|
||||
model: typeof ServiceTaskModel;
|
||||
};
|
||||
export { ServiceTaskView, ServiceTaskModel };
|
||||
export default ServiceTask;
|
||||
@@ -0,0 +1,79 @@
|
||||
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 (b.hasOwnProperty(p)) d[p] = b[p]; };
|
||||
return extendStatics(d, b);
|
||||
};
|
||||
return function (d, b) {
|
||||
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 { h, RectNodeModel, RectNode } from '@logicflow/core';
|
||||
import { getBpmnId } from '../getBpmnId';
|
||||
var ServiceTaskModel = /** @class */ (function (_super) {
|
||||
__extends(ServiceTaskModel, _super);
|
||||
function ServiceTaskModel(data, graphModel) {
|
||||
var _this = this;
|
||||
if (!data.id) {
|
||||
data.id = "Activity_" + getBpmnId();
|
||||
}
|
||||
_this = _super.call(this, data, graphModel) || this;
|
||||
return _this;
|
||||
}
|
||||
ServiceTaskModel.extendKey = 'ServiceTaskModel';
|
||||
return ServiceTaskModel;
|
||||
}(RectNodeModel));
|
||||
var ServiceTaskView = /** @class */ (function (_super) {
|
||||
__extends(ServiceTaskView, _super);
|
||||
function ServiceTaskView() {
|
||||
return _super !== null && _super.apply(this, arguments) || this;
|
||||
}
|
||||
ServiceTaskView.prototype.getLabelShape = function () {
|
||||
var model = this.props.model;
|
||||
var x = model.x, y = model.y, width = model.width, height = model.height;
|
||||
var style = model.getNodeStyle();
|
||||
return h('svg', {
|
||||
x: x - width / 2 + 5,
|
||||
y: y - height / 2 + 5,
|
||||
width: 30,
|
||||
height: 30,
|
||||
viewBox: '0 0 1274 1024',
|
||||
}, h('path', {
|
||||
fill: style.stroke,
|
||||
d: 'M882.527918 434.149934c-2.234901-5.303796-7.311523-8.853645-13.059434-9.138124l-61.390185-3.009544c-6.635117-20.973684-15.521508-41.175795-26.513864-60.282968l42.051745-47.743374c4.308119-4.889357 4.955872-12.004405 1.602498-17.59268-46.384423-77.30362-103.969956-101.422947-106.400309-102.410438-5.332449-2.170432-11.432377-1.090844-15.693424 2.77009L654.674467 240.664222c-17.004279-8.654101-35.092239-15.756869-53.995775-21.210068l-3.26537-66.490344c-0.280386-5.747911-3.833305-10.824533-9.134031-13.059434-1.683339-0.709151-30.193673-12.391215-76.866668-12.051477-46.672996-0.339738-75.18333 11.342326-76.866668 12.051477-5.300726 2.234901-8.853645 7.311523-9.134031 13.059434l-3.26537 66.490344c-18.903535 5.453199-36.991496 12.555967-53.995775 21.210068l-48.450479-43.922349c-4.261047-3.860934-10.360975-4.940522-15.693424-2.77009-2.430352 0.98749-60.015885 25.106818-106.400309 102.410438-3.353374 5.588275-2.705622 12.703323 1.602498 17.59268l42.051745 47.743374c-10.992355 19.107173-19.878746 39.309284-26.513864 60.282968l-61.390185 3.009544c-5.747911 0.284479-10.824533 3.834328-13.059434 9.138124-1.01512 2.415003-24.687262 60.190871-2.822278 147.651828 1.583055 6.324032 7.072069 10.893094 13.57518 11.308557 5.892197 0.37146 11.751648 0.523933 17.419741 0.667196 14.498202 0.372483 28.193109 0.723477 40.908712 4.63353 4.212952 1.294482 6.435573 8.270361 9.349949 18.763342 1.287319 4.640694 2.617617 9.43693 4.484128 14.010085 1.794879 4.393054 3.75758 8.570189 5.66093 12.607132 1.302669 2.765997 2.529613 5.380544 3.689019 8.018627 2.986007 6.803963 2.682086 9.773598 2.578732 10.349719-3.061732 3.672646-6.391571 7.238868-9.91379 11.015891-1.810229 1.943258-3.680832 3.949962-5.523807 5.980201l-22.560832 24.8909c-3.865028 4.261047-4.940522 10.365068-2.774183 15.693424 0.991584 2.426259 25.102724 60.011792 102.414531 106.400309 5.588275 3.353374 12.703323 2.701528 17.591657-1.603521l23.476691-20.682042c2.346441-2.061962 4.64888-4.336772 6.875594-6.534833 9.05319-8.93858 14.018272-12.95608 17.73185-11.576663 3.305279 1.222851 6.907317 3.166109 10.720156 5.228071 3.325745 1.794879 6.764054 3.650133 10.465352 5.288446 6.016017 2.662643 12.120039 4.688789 18.019399 6.65149 6.827499 2.266623 13.279445 4.409426 18.819624 7.275707 1.518586 0.782829 1.926886 0.994654 2.358721 7.830339 0.726547 11.496845 1.25048 23.276123 1.753947 34.672684 0.264013 5.900384 0.528026 11.803837 0.815575 17.700127 0.284479 5.743818 3.833305 10.82044 9.138124 13.05534 1.654686 0.698918 29.371958 12.063757 74.869175 12.063757 0.328481 0 3.65832 0 3.986801 0 45.497217 0 73.214489-11.364839 74.869175-12.063757 5.304819-2.234901 8.853645-7.311523 9.138124-13.05534 0.287549-5.89629 0.551562-11.799744 0.815575-17.700127 0.503467-11.396561 1.027399-23.175839 1.753947-34.672684 0.431835-6.835685 0.840134-7.04751 2.358721-7.830339 5.54018-2.866281 11.992125-5.009084 18.819624-7.275707 5.89936-1.962701 12.003382-3.988848 18.019399-6.65149 3.701299-1.638313 7.139607-3.493567 10.465352-5.288446 3.812839-2.061962 7.414877-4.00522 10.720156-5.228071 3.713578-1.379417 8.67866 2.638083 17.73185 11.576663 2.226714 2.198062 4.529153 4.472871 6.875594 6.534833l23.476691 20.682042c4.888334 4.305049 12.003382 4.956895 17.591657 1.603521 77.311807-46.388517 101.422947-103.97405 102.414531-106.400309 2.166339-5.328355 1.090844-11.432377-2.774183-15.693424l-22.560832-24.8909c-1.842974-2.030239-3.713578-4.036943-5.523807-5.980201-3.52222-3.777023-6.852058-7.343245-9.91379-11.015891-0.103354-0.576121-0.407276-3.545756 2.578732-10.349719 1.159406-2.638083 2.38635-5.252631 3.689019-8.018627 1.90335-4.036943 3.866051-8.214079 5.66093-12.607132 1.866511-4.573155 3.196809-9.369392 4.484128-14.010085 2.914376-10.492982 5.136997-17.46886 9.349949-18.763342 12.715603-3.910053 26.41051-4.261047 40.908712-4.63353 5.668093-0.143263 11.527544-0.295735 17.419741-0.667196 6.503111-0.415462 11.992125-4.984524 13.57518-11.308557C907.21518 494.340805 883.543038 436.564937 882.527918 434.149934zM643.49894 643.761929c-35.280528 35.280528-82.191954 54.711066-132.086317 54.711066s-96.806813-19.430538-132.086317-54.711066c-35.280528-35.279504-54.711066-82.191954-54.711066-132.086317 0-49.894364 19.430538-96.80272 54.711066-132.082224 35.283598-35.284621 82.191954-54.711066 132.086317-54.711066s96.80579 19.426445 132.086317 54.711066c35.279504 35.279504 54.711066 82.187861 54.711066 132.082224C698.210006 561.569976 678.782537 608.482425 643.49894 643.761929z',
|
||||
}));
|
||||
};
|
||||
ServiceTaskView.prototype.getShape = function () {
|
||||
var model = this.props.model;
|
||||
var x = model.x, y = model.y, width = model.width, height = model.height, radius = model.radius;
|
||||
var style = model.getNodeStyle();
|
||||
return h('g', {}, [
|
||||
h('rect', __assign({ x: x - width / 2, y: y - height / 2, rx: radius, ry: radius, width: width,
|
||||
height: height }, style)),
|
||||
this.getLabelShape(),
|
||||
]);
|
||||
};
|
||||
ServiceTaskView.extendKey = 'ServiceTaskNode';
|
||||
return ServiceTaskView;
|
||||
}(RectNode));
|
||||
var ServiceTask = {
|
||||
type: 'bpmn:serviceTask',
|
||||
view: ServiceTaskView,
|
||||
model: ServiceTaskModel,
|
||||
};
|
||||
export { ServiceTaskView, ServiceTaskModel };
|
||||
export default ServiceTask;
|
||||
@@ -0,0 +1,17 @@
|
||||
import { RectNode, RectNodeModel } from '@logicflow/core';
|
||||
declare class UserTaskModel extends RectNodeModel {
|
||||
static extendKey: string;
|
||||
constructor(data: any, graphModel: any);
|
||||
}
|
||||
declare class UserTaskView extends RectNode {
|
||||
static extendKey: string;
|
||||
getLabelShape(): import("preact").VNode<any>;
|
||||
getShape(): import("preact").VNode<any>;
|
||||
}
|
||||
declare const UserTask: {
|
||||
type: string;
|
||||
view: typeof UserTaskView;
|
||||
model: typeof UserTaskModel;
|
||||
};
|
||||
export { UserTaskView, UserTaskModel };
|
||||
export default UserTask;
|
||||
@@ -0,0 +1,80 @@
|
||||
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 (b.hasOwnProperty(p)) d[p] = b[p]; };
|
||||
return extendStatics(d, b);
|
||||
};
|
||||
return function (d, b) {
|
||||
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 { h, RectNode, RectNodeModel } from '@logicflow/core';
|
||||
import { getBpmnId } from '../getBpmnId';
|
||||
var UserTaskModel = /** @class */ (function (_super) {
|
||||
__extends(UserTaskModel, _super);
|
||||
function UserTaskModel(data, graphModel) {
|
||||
var _this = this;
|
||||
if (!data.id) {
|
||||
data.id = "Activity_" + getBpmnId();
|
||||
}
|
||||
_this = _super.call(this, data, graphModel) || this;
|
||||
return _this;
|
||||
}
|
||||
UserTaskModel.extendKey = 'UserTaskModel';
|
||||
return UserTaskModel;
|
||||
}(RectNodeModel));
|
||||
var UserTaskView = /** @class */ (function (_super) {
|
||||
__extends(UserTaskView, _super);
|
||||
function UserTaskView() {
|
||||
return _super !== null && _super.apply(this, arguments) || this;
|
||||
}
|
||||
UserTaskView.prototype.getLabelShape = function () {
|
||||
var model = this.props.model;
|
||||
var x = model.x, y = model.y, width = model.width, height = model.height;
|
||||
var style = model.getNodeStyle();
|
||||
return h('svg', {
|
||||
x: x - width / 2 + 5,
|
||||
y: y - height / 2 + 5,
|
||||
width: 25,
|
||||
height: 25,
|
||||
viewBox: '0 0 1274 1024',
|
||||
}, h('path', {
|
||||
fill: style.stroke,
|
||||
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',
|
||||
}));
|
||||
};
|
||||
UserTaskView.prototype.getShape = function () {
|
||||
var model = this.props.model;
|
||||
var x = model.x, y = model.y, width = model.width, height = model.height, radius = model.radius;
|
||||
var style = model.getNodeStyle();
|
||||
// todo: 将basic-shape对外暴露,在这里可以直接用。现在纯手写有点麻烦。
|
||||
return h('g', {}, [
|
||||
h('rect', __assign(__assign({}, style), { x: x - width / 2, y: y - height / 2, rx: radius, ry: radius, width: width,
|
||||
height: height })),
|
||||
this.getLabelShape(),
|
||||
]);
|
||||
};
|
||||
UserTaskView.extendKey = 'UserTaskNode';
|
||||
return UserTaskView;
|
||||
}(RectNode));
|
||||
var UserTask = {
|
||||
type: 'bpmn:userTask',
|
||||
view: UserTaskView,
|
||||
model: UserTaskModel,
|
||||
};
|
||||
export { UserTaskView, UserTaskModel };
|
||||
export default UserTask;
|
||||
Reference in new issue
Block a user