@web-utils/component 2.8.14 → 2.8.16

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -58,7 +58,7 @@ const a = {
58
58
  },
59
59
  methods: {
60
60
  show(e) {
61
- document.addEventListener("click", this.hide, !0), this.axis = { x: e.clientX, y: e.clientY }, this.rendered = !0, this.visible = !0;
61
+ this.axis = { x: e.clientX, y: e.clientY }, this.visible || (document.addEventListener("click", this.hide, !0), this.rendered = !0, this.visible = !0);
62
62
  },
63
63
  hide() {
64
64
  this.visible = !1, document.removeEventListener("click", this.hide);
@@ -79,9 +79,9 @@ function h(e) {
79
79
  for (let t in s)
80
80
  this[t] = s[t];
81
81
  }
82
- const f = /* @__PURE__ */ function() {
82
+ const l = /* @__PURE__ */ function() {
83
83
  return d.exports;
84
84
  }();
85
85
  export {
86
- f as default
86
+ l as default
87
87
  };
@@ -0,0 +1,538 @@
1
+ import { assign as u, isArray as z, forEach as B } from "min-dash";
2
+ import { is as D } from "bpmn-js/lib/util/ModelUtil";
3
+ import { isExpanded as U, isEventSubProcess as Y } from "bpmn-js/lib/util/DiUtil";
4
+ import { isAny as F } from "bpmn-js/lib/features/modeling/util/ModelingUtil";
5
+ import { getChildLanes as H } from "bpmn-js/lib/features/modeling/util/LaneUtil";
6
+ import { hasPrimaryModifier as q } from "diagram-js/lib/util/Mouse";
7
+ import $ from "bpmn-js/lib/features/palette/PaletteProvider";
8
+ import I from "diagram-js/lib/features/auto-place/AutoPlace";
9
+ import { getMid as V, asTRBL as W } from "diagram-js/lib/layout/LayoutUtil";
10
+ import J from "@web-utils/component/properties-panel";
11
+ import K from "@web-utils/component/process-designer";
12
+ import { n as Q } from "../chunks/vueComponentNormalizer.446f5dc4.mjs";
13
+ function R(e, i, n, t, a, r, l, c, v, y, s, o, p) {
14
+ e = e || {}, t.registerProvider(this), this._contextPad = t, this._modeling = a, this._elementFactory = r, this._connect = l, this._create = c, this._popupMenu = v, this._canvas = y, this._rules = s, this._translate = o, e.autoPlace !== !1 && (this._autoPlace = i.get("autoPlace", !1)), n.on("create.end", 250, function(h) {
15
+ const g = h.context.shape;
16
+ if (!q(h) || !t.isOpen(g))
17
+ return;
18
+ const d = t.getEntries(g);
19
+ d.replace && d.replace.action.click(h, g);
20
+ });
21
+ }
22
+ R.$inject = [
23
+ "config.contextPad",
24
+ "injector",
25
+ "eventBus",
26
+ "contextPad",
27
+ "modeling",
28
+ "elementFactory",
29
+ "connect",
30
+ "create",
31
+ "popupMenu",
32
+ "canvas",
33
+ "rules",
34
+ "translate",
35
+ "elementRegistry"
36
+ ];
37
+ R.prototype.getContextPadEntries = function(e) {
38
+ const i = this._contextPad, n = this._modeling, t = this._elementFactory, a = this._connect, r = this._create, l = this._popupMenu, c = this._canvas, v = this._rules, y = this._autoPlace, s = this._translate, o = {};
39
+ if (e.type === "label")
40
+ return o;
41
+ const p = e.businessObject;
42
+ function h(m, b) {
43
+ a.start(m, b);
44
+ }
45
+ function C() {
46
+ n.removeElements([e]);
47
+ }
48
+ function g(m) {
49
+ const f = c.getContainer(), P = i.getPad(m).html, E = f.getBoundingClientRect(), w = P.getBoundingClientRect(), k = w.top - E.top;
50
+ return {
51
+ x: w.left - E.left,
52
+ y: k + w.height + 5
53
+ };
54
+ }
55
+ function d(m, b, f, P) {
56
+ typeof f != "string" && (P = f, f = s("Append {type}", { type: m.replace(/^bpmn:/, "") }));
57
+ function E(k, S) {
58
+ const A = t.createShape(u({ type: m }, P));
59
+ r.start(k, A, {
60
+ source: S
61
+ });
62
+ }
63
+ return {
64
+ group: "model",
65
+ className: b,
66
+ title: f,
67
+ action: {
68
+ dragstart: E,
69
+ click: y ? function(k, S) {
70
+ const A = t.createShape(u({ type: m }, P));
71
+ y.append(S, A);
72
+ } : E
73
+ }
74
+ };
75
+ }
76
+ function T(m) {
77
+ return function(b, f) {
78
+ n.splitLane(f, m), i.open(f, !0);
79
+ };
80
+ }
81
+ if (F(p, ["bpmn:Lane", "bpmn:Participant"]) && U(p)) {
82
+ const m = H(e);
83
+ u(o, {
84
+ "lane-insert-above": {
85
+ group: "lane-insert-above",
86
+ className: "bpmn-icon-lane-insert-above",
87
+ title: s("Add Lane above"),
88
+ action: {
89
+ click: function(b, f) {
90
+ n.addLane(f, "top");
91
+ }
92
+ }
93
+ }
94
+ }), m.length < 2 && (e.height >= 120 && u(o, {
95
+ "lane-divide-two": {
96
+ group: "lane-divide",
97
+ className: "bpmn-icon-lane-divide-two",
98
+ title: s("Divide into two Lanes"),
99
+ action: {
100
+ click: T(2)
101
+ }
102
+ }
103
+ }), e.height >= 180 && u(o, {
104
+ "lane-divide-three": {
105
+ group: "lane-divide",
106
+ className: "bpmn-icon-lane-divide-three",
107
+ title: s("Divide into three Lanes"),
108
+ action: {
109
+ click: T(3)
110
+ }
111
+ }
112
+ })), u(o, {
113
+ "lane-insert-below": {
114
+ group: "lane-insert-below",
115
+ className: "bpmn-icon-lane-insert-below",
116
+ title: s("Add Lane below"),
117
+ action: {
118
+ click: function(b, f) {
119
+ n.addLane(f, "bottom");
120
+ }
121
+ }
122
+ }
123
+ });
124
+ }
125
+ D(p, "bpmn:FlowNode") && (D(p, "bpmn:EventBasedGateway") ? u(o, {
126
+ "append.receive-task": d("bpmn:ReceiveTask", "bpmn-icon-receive-task", s("Append ReceiveTask")),
127
+ "append.message-intermediate-event": d(
128
+ "bpmn:IntermediateCatchEvent",
129
+ "bpmn-icon-intermediate-event-catch-message",
130
+ s("Append MessageIntermediateCatchEvent"),
131
+ { eventDefinitionType: "bpmn:MessageEventDefinition" }
132
+ ),
133
+ "append.timer-intermediate-event": d(
134
+ "bpmn:IntermediateCatchEvent",
135
+ "bpmn-icon-intermediate-event-catch-timer",
136
+ s("Append TimerIntermediateCatchEvent"),
137
+ { eventDefinitionType: "bpmn:TimerEventDefinition" }
138
+ ),
139
+ "append.condition-intermediate-event": d(
140
+ "bpmn:IntermediateCatchEvent",
141
+ "bpmn-icon-intermediate-event-catch-condition",
142
+ s("Append ConditionIntermediateCatchEvent"),
143
+ { eventDefinitionType: "bpmn:ConditionalEventDefinition" }
144
+ ),
145
+ "append.signal-intermediate-event": d(
146
+ "bpmn:IntermediateCatchEvent",
147
+ "bpmn-icon-intermediate-event-catch-signal",
148
+ s("Append SignalIntermediateCatchEvent"),
149
+ { eventDefinitionType: "bpmn:SignalEventDefinition" }
150
+ )
151
+ }) : M(p, "bpmn:BoundaryEvent", "bpmn:CompensateEventDefinition") ? u(o, {
152
+ "append.compensation-activity": d("bpmn:Task", "bpmn-icon-task", s("Append compensation activity"), {
153
+ isForCompensation: !0
154
+ })
155
+ }) : !D(p, "bpmn:EndEvent") && !p.isForCompensation && !M(p, "bpmn:IntermediateThrowEvent", "bpmn:LinkEventDefinition") && !Y(p) && u(o, {
156
+ "append.end-event": d("bpmn:EndEvent", "bpmn-icon-end-event-none", s("Append EndEvent")),
157
+ "append.gateway": d("bpmn:ExclusiveGateway", "bpmn-icon-gateway-none", s("Append Gateway")),
158
+ "append.append-task": d("bpmn:UserTask", "bpmn-icon-user-task", s("Append Task")),
159
+ "append.intermediate-event": d(
160
+ "bpmn:IntermediateThrowEvent",
161
+ "bpmn-icon-intermediate-event-none",
162
+ s("Append Intermediate/Boundary Event")
163
+ )
164
+ })), l.isEmpty(e, "bpmn-replace") || u(o, {
165
+ replace: {
166
+ group: "edit",
167
+ className: "bpmn-icon-screw-wrench",
168
+ title: s("Change type"),
169
+ action: {
170
+ click: function(m, b) {
171
+ const f = u(g(b), {
172
+ cursor: { x: m.x, y: m.y }
173
+ });
174
+ l.open(b, "bpmn-replace", f);
175
+ }
176
+ }
177
+ }
178
+ }), F(p, ["bpmn:FlowNode", "bpmn:InteractionNode", "bpmn:DataObjectReference", "bpmn:DataStoreReference"]) && u(o, {
179
+ "append.text-annotation": d("bpmn:TextAnnotation", "bpmn-icon-text-annotation"),
180
+ connect: {
181
+ group: "connect",
182
+ className: "bpmn-icon-connection-multi",
183
+ title: s(`Connect using ${p.isForCompensation ? "" : "Sequence/MessageFlow or "}Association`),
184
+ action: {
185
+ click: h,
186
+ dragstart: h
187
+ }
188
+ }
189
+ }), F(p, ["bpmn:DataObjectReference", "bpmn:DataStoreReference"]) && u(o, {
190
+ connect: {
191
+ group: "connect",
192
+ className: "bpmn-icon-connection-multi",
193
+ title: s("Connect using DataInputAssociation"),
194
+ action: {
195
+ click: h,
196
+ dragstart: h
197
+ }
198
+ }
199
+ }), D(p, "bpmn:Group") && u(o, {
200
+ "append.text-annotation": d("bpmn:TextAnnotation", "bpmn-icon-text-annotation")
201
+ });
202
+ let _ = v.allowed("elements.delete", { elements: [e] });
203
+ return z(_) && (_ = _[0] === e), _ && u(o, {
204
+ delete: {
205
+ group: "edit",
206
+ className: "bpmn-icon-trash",
207
+ title: s("Remove"),
208
+ action: {
209
+ click: C
210
+ }
211
+ }
212
+ }), o;
213
+ };
214
+ function M(e, i, n) {
215
+ const t = e.$instanceOf(i);
216
+ let a = !1;
217
+ const r = e.eventDefinitions || [];
218
+ return B(r, function(l) {
219
+ l.$type === n && (a = !0);
220
+ }), t && a;
221
+ }
222
+ const X = {
223
+ __init__: ["contextPadProvider"],
224
+ contextPadProvider: ["type", R]
225
+ };
226
+ function x(e, i, n, t, a, r, l, c, v) {
227
+ $.call(this, e, i, n, t, a, r, l, c, v, 2e3), this._create = i, this._elementFactory = n, this._spaceTool = t, this._lassoTool = a, this._handTool = r, this._globalConnect = l, this._moddle = c, this._translate = v;
228
+ }
229
+ const N = function() {
230
+ };
231
+ N.prototype = $.prototype;
232
+ N.prototype.getPaletteEntries = function() {
233
+ const e = {}, i = this._create, n = this._elementFactory, t = this._spaceTool, a = this._lassoTool, r = this._handTool, l = this._globalConnect, c = this._translate;
234
+ function v(o, p, h, C, g) {
235
+ function d(_) {
236
+ const m = n.createShape(u({ type: o }, g));
237
+ g && (m.businessObject.di.isExpanded = g.isExpanded), i.start(_, m);
238
+ }
239
+ const T = o.replace(/^bpmn:/, "");
240
+ return {
241
+ group: p,
242
+ className: h,
243
+ title: C || c("Create {type}", { type: T }),
244
+ action: {
245
+ dragstart: d,
246
+ click: d
247
+ }
248
+ };
249
+ }
250
+ function y(o) {
251
+ const p = n.createShape({
252
+ type: "bpmn:SubProcess",
253
+ x: 0,
254
+ y: 0,
255
+ isExpanded: !0
256
+ }), h = n.createShape({
257
+ type: "bpmn:StartEvent",
258
+ x: 40,
259
+ y: 82,
260
+ parent: p
261
+ });
262
+ i.start(o, [p, h], {
263
+ hints: {
264
+ autoSelect: [h]
265
+ }
266
+ });
267
+ }
268
+ function s(o) {
269
+ i.start(o, n.createParticipantShape());
270
+ }
271
+ return u(e, {
272
+ "hand-tool": {
273
+ group: "tools",
274
+ className: "bpmn-icon-hand-tool",
275
+ title: c("Activate the hand tool"),
276
+ action: {
277
+ click: function(o) {
278
+ r.activateHand(o);
279
+ }
280
+ }
281
+ },
282
+ "lasso-tool": {
283
+ group: "tools",
284
+ className: "bpmn-icon-lasso-tool",
285
+ title: c("Activate the lasso tool"),
286
+ action: {
287
+ click: function(o) {
288
+ a.activateSelection(o);
289
+ }
290
+ }
291
+ },
292
+ "space-tool": {
293
+ group: "tools",
294
+ className: "bpmn-icon-space-tool",
295
+ title: c("Activate the create/remove space tool"),
296
+ action: {
297
+ click: function(o) {
298
+ t.activateSelection(o);
299
+ }
300
+ }
301
+ },
302
+ "global-connect-tool": {
303
+ group: "tools",
304
+ className: "bpmn-icon-connection-multi",
305
+ title: c("Activate the global connect tool"),
306
+ action: {
307
+ click: function(o) {
308
+ l.toggle(o);
309
+ }
310
+ }
311
+ },
312
+ "tool-separator": {
313
+ group: "tools",
314
+ separator: !0
315
+ },
316
+ "create.start-event": v("bpmn:StartEvent", "event", "bpmn-icon-start-event-none", c("Create StartEvent")),
317
+ "create.intermediate-event": v("bpmn:IntermediateThrowEvent", "event", "bpmn-icon-intermediate-event-none", c("Create Intermediate/Boundary Event")),
318
+ "create.user-task": v("bpmn:UserTask", "activity", "bpmn-icon-user-task", c("Create User Task")),
319
+ "create.exclusive-gateway": v("bpmn:ExclusiveGateway", "activity", "bpmn-icon-gateway-none", c("Create Gateway")),
320
+ "create.end-event": v("bpmn:EndEvent", "activity", "bpmn-icon-end-event-none", c("Create EndEvent")),
321
+ // 'create.sql-task': createAction('user:MySql', 'activity', 'bpmn-icon-mysql', 'MySQL 节点'),
322
+ // 'create.data-object': createAction('bpmn:DataObjectReference', 'data-object', 'bpmn-icon-data-object', translate('Create DataObjectReference')),
323
+ // 'create.data-store': createAction('bpmn:DataStoreReference', 'data-store', 'bpmn-icon-data-store', translate('Create DataStoreReference')),
324
+ "create.subprocess-expanded": {
325
+ group: "activity",
326
+ className: "bpmn-icon-subprocess-expanded",
327
+ title: c("Create expanded SubProcess"),
328
+ action: {
329
+ dragstart: y,
330
+ click: y
331
+ }
332
+ },
333
+ "create.participant-expanded": {
334
+ group: "collaboration",
335
+ className: "bpmn-icon-participant",
336
+ title: c("Create Pool/Participant"),
337
+ action: {
338
+ dragstart: s,
339
+ click: s
340
+ }
341
+ }
342
+ // 'create.group': createAction('bpmn:Group', 'artifact', 'bpmn-icon-group', translate('Create Group'))
343
+ }), e;
344
+ };
345
+ x.$inject = ["palette", "create", "elementFactory", "spaceTool", "lassoTool", "handTool", "globalConnect", "moddle", "translate"];
346
+ x.prototype = new N();
347
+ x.prototype.constructor = x;
348
+ const Z = {
349
+ __init__: ["customPalette"],
350
+ customPalette: ["type", x]
351
+ };
352
+ function O(e, i) {
353
+ I.call(this, e, i, 3e3), e.on("autoPlace", 3e3, function(n) {
354
+ const t = n.shape, a = n.source;
355
+ return oe(a, t);
356
+ }), this.append = function(n, t, a) {
357
+ e.fire("autoPlace.start", {
358
+ source: n,
359
+ shape: t
360
+ });
361
+ const r = e.fire("autoPlace", {
362
+ source: n,
363
+ shape: t
364
+ });
365
+ console.log("hints", a, "position", r);
366
+ const l = i.appendShape(n, t, r, n.parent, a);
367
+ return e.fire("autoPlace.end", {
368
+ source: n,
369
+ shape: l
370
+ }), l;
371
+ };
372
+ }
373
+ function ee(e) {
374
+ return {
375
+ top: e.y,
376
+ right: e.x + (e.width || 0),
377
+ bottom: e.y + (e.height || 0),
378
+ left: e.x
379
+ };
380
+ }
381
+ function te(e) {
382
+ return {
383
+ x: Math.round(e.x),
384
+ y: Math.round(e.y)
385
+ };
386
+ }
387
+ function ne(e) {
388
+ return te({
389
+ x: e.x + (e.width || 0) / 2,
390
+ y: e.y + (e.height || 0) / 2
391
+ });
392
+ }
393
+ function oe(e, i, n) {
394
+ n || (n = {});
395
+ const t = n.defaultDistance || 50, a = ne(e), r = ee(e);
396
+ return {
397
+ x: a.x,
398
+ y: r.bottom + t + i.height / 2
399
+ };
400
+ }
401
+ const j = function() {
402
+ };
403
+ j.prototype = I.prototype;
404
+ O.prototype = new j();
405
+ O.prototype.constructor = I;
406
+ const ie = 200, ae = 100;
407
+ function G(e, i, n) {
408
+ e.on("autoPlace", ae, function(t) {
409
+ const a = t.shape, r = t.source;
410
+ return ce(r, a);
411
+ }), e.on("autoPlace.end", function(t) {
412
+ n.scrollToElement(t.shape);
413
+ }), this.append = function(t, a, r) {
414
+ e.fire("autoPlace.start", {
415
+ source: t,
416
+ shape: a
417
+ });
418
+ const l = e.fire("autoPlace", {
419
+ source: t,
420
+ shape: a
421
+ }), c = i.appendShape(t, a, l, t.parent, r);
422
+ return e.fire("autoPlace.end", {
423
+ source: t,
424
+ shape: c
425
+ }), c;
426
+ };
427
+ }
428
+ G.$inject = ["eventBus", "modeling", "canvas"];
429
+ function ce(e, i) {
430
+ const n = ie, t = V(e);
431
+ return {
432
+ x: W(e).right + n + i.width / 2,
433
+ y: t.y
434
+ };
435
+ }
436
+ const se = {
437
+ __init__: ["autoPlaceSelectionBehavior"],
438
+ autoPlace: ["type", G]
439
+ };
440
+ var re = function() {
441
+ var e = this, i = e.$createElement, n = e._self._c || i;
442
+ return n("div", {
443
+ staticClass: "flow-designer"
444
+ }, [n("ProcessDesigner", e._b({
445
+ key: `designer-${e.reloadIndex}`,
446
+ ref: "processDesigner",
447
+ attrs: {
448
+ value: e.value,
449
+ "extend-types": e.extendTypes,
450
+ options: {
451
+ taskResizingEnabled: !0,
452
+ eventResizingEnabled: !0
453
+ },
454
+ keyboard: ""
455
+ },
456
+ on: {
457
+ input: function(t) {
458
+ return e.$emit("input", t);
459
+ },
460
+ "init-finished": e.initModeler
461
+ }
462
+ }, "ProcessDesigner", e.controlForm, !1)), n("PropertiesPanel", {
463
+ key: `penal-${e.reloadIndex}`,
464
+ staticClass: "process-panel",
465
+ attrs: {
466
+ "bpmn-modeler": e.modeler,
467
+ prefix: e.controlForm.prefix
468
+ },
469
+ scopedSlots: e._u([{
470
+ key: "task",
471
+ fn: function(t) {
472
+ var a = t.id, r = t.bpmnInstances, l = t.element, c = t.type;
473
+ return [e._t("task", null, {
474
+ id: a,
475
+ bpmnInstances: r,
476
+ element: l,
477
+ type: c
478
+ })];
479
+ }
480
+ }], null, !0)
481
+ })], 1);
482
+ }, pe = [];
483
+ const le = {
484
+ name: "FlowDesigner",
485
+ components: {
486
+ PropertiesPanel: J,
487
+ ProcessDesigner: K
488
+ },
489
+ props: {
490
+ value: String,
491
+ extendTypes: Array
492
+ },
493
+ data() {
494
+ return {
495
+ modeler: null,
496
+ reloadIndex: 0,
497
+ controlForm: {
498
+ processId: "",
499
+ processName: "",
500
+ simulation: !0,
501
+ labelEditing: !1,
502
+ labelVisible: !1,
503
+ prefix: "flowable",
504
+ headerButtonSize: "mini",
505
+ additionalModel: [
506
+ X,
507
+ Z,
508
+ se
509
+ ]
510
+ }
511
+ };
512
+ },
513
+ methods: {
514
+ initModeler(e) {
515
+ this.modeler = e;
516
+ }
517
+ }
518
+ }, L = {};
519
+ var de = /* @__PURE__ */ Q(
520
+ le,
521
+ re,
522
+ pe,
523
+ !1,
524
+ me,
525
+ null,
526
+ null,
527
+ null
528
+ );
529
+ function me(e) {
530
+ for (let i in L)
531
+ this[i] = L[i];
532
+ }
533
+ const ke = /* @__PURE__ */ function() {
534
+ return de.exports;
535
+ }();
536
+ export {
537
+ ke as default
538
+ };
@@ -0,0 +1 @@
1
+ .flow-designer{display:flex;width:100%;height:100%}