@web-utils/component 2.9.13 → 2.9.14

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.
@@ -1,22 +1,22 @@
1
- var h = (e, t, i) => new Promise((o, a) => {
2
- var f = (s) => {
1
+ var d = (e, t, i) => new Promise((o, a) => {
2
+ var h = (s) => {
3
3
  try {
4
4
  n(i.next(s));
5
5
  } catch (r) {
6
6
  a(r);
7
7
  }
8
- }, l = (s) => {
8
+ }, f = (s) => {
9
9
  try {
10
10
  n(i.throw(s));
11
11
  } catch (r) {
12
12
  a(r);
13
13
  }
14
- }, n = (s) => s.done ? o(s.value) : Promise.resolve(s.value).then(f, l);
14
+ }, n = (s) => s.done ? o(s.value) : Promise.resolve(s.value).then(h, f);
15
15
  n((i = i.apply(e, t)).next());
16
16
  });
17
- import { getComputedWidth as u, getComputedHeight as c } from "@web-utils/core";
18
- import { n as p } from "../chunks/vueComponentNormalizer.446f5dc4.mjs";
19
- var _ = function() {
17
+ import { getComputedWidth as p, getComputedHeight as u } from "@web-utils/core";
18
+ import { n as c } from "../chunks/vueComponentNormalizer.446f5dc4.mjs";
19
+ var x = function() {
20
20
  var e = this, t = e.$createElement, i = e._self._c || t;
21
21
  return i("Transition", {
22
22
  attrs: {
@@ -32,12 +32,14 @@ var _ = function() {
32
32
  ref: "container",
33
33
  class: ["easy-popup", {
34
34
  "easy-popup__visible": e.visible,
35
- "easy-popup__hide": !e.visible
35
+ "easy-popup__hide": !e.visible,
36
+ "flex-row": e.flexRow,
37
+ "flex-column": e.flexColumn
36
38
  }],
37
39
  style: e.position
38
40
  }, [e._t("default")], 2) : e._e()]);
39
- }, v = [];
40
- const y = {
41
+ }, y = [];
42
+ const _ = {
41
43
  name: "EasyPopup",
42
44
  props: {
43
45
  // 是否开启边界检测
@@ -54,7 +56,10 @@ const y = {
54
56
  borderWidth: {
55
57
  type: Number,
56
58
  default: 6
57
- }
59
+ },
60
+ appendToBody: Boolean,
61
+ flexRow: Boolean,
62
+ flexColumn: Boolean
58
63
  },
59
64
  data() {
60
65
  return {
@@ -75,41 +80,44 @@ const y = {
75
80
  },
76
81
  watch: {
77
82
  axis() {
78
- return h(this, null, function* () {
83
+ return d(this, null, function* () {
79
84
  if (this.border) {
80
85
  yield this.$nextTick();
81
- const e = u(this.$refs.container), t = c(this.$refs.container), i = document.body.offsetWidth, o = document.body.offsetHeight;
86
+ const e = p(this.$refs.container), t = u(this.$refs.container), i = document.body.offsetWidth, o = document.body.offsetHeight;
82
87
  this.axis.x + this.offset.x + e >= i && (this.axis.x = i - e - this.borderWidth - this.offset.x), this.axis.y + this.offset.y + t >= o && (this.axis.y = o - t - this.borderWidth - this.offset.y);
83
88
  }
84
89
  });
85
90
  }
86
91
  },
92
+ destroyed() {
93
+ this.$el.remove();
94
+ },
87
95
  methods: {
88
96
  show({ clientX: e, clientY: t }) {
89
- this.axis = { x: e, y: t }, this.visible || (document.addEventListener("click", this.hide, !0), this.rendered = !0, this.visible = !0);
97
+ this.axis = { x: e, y: t }, this.visible || (document.addEventListener("click", this.hide, !0), this.rendered = !0, this.visible = !0), this.appendToBody && document.body.appendChild(this.$el);
90
98
  },
91
99
  hide() {
92
100
  this.visible = !1, document.removeEventListener("click", this.hide);
93
101
  }
94
102
  }
95
- }, d = {};
96
- var x = /* @__PURE__ */ p(
97
- y,
103
+ }, l = {};
104
+ var m = /* @__PURE__ */ c(
98
105
  _,
99
- v,
106
+ x,
107
+ y,
100
108
  !1,
101
- m,
109
+ v,
102
110
  null,
103
111
  null,
104
112
  null
105
113
  );
106
- function m(e) {
107
- for (let t in d)
108
- this[t] = d[t];
114
+ function v(e) {
115
+ for (let t in l)
116
+ this[t] = l[t];
109
117
  }
110
- const E = /* @__PURE__ */ function() {
111
- return x.exports;
118
+ const g = /* @__PURE__ */ function() {
119
+ return m.exports;
112
120
  }();
113
121
  export {
114
- E as default
122
+ g as default
115
123
  };
@@ -1,39 +1,39 @@
1
- var k = Object.defineProperty, b = Object.defineProperties;
2
- var x = Object.getOwnPropertyDescriptors;
1
+ var b = Object.defineProperty, x = Object.defineProperties;
2
+ var M = Object.getOwnPropertyDescriptors;
3
3
  var f = Object.getOwnPropertySymbols;
4
- var M = Object.prototype.hasOwnProperty, V = Object.prototype.propertyIsEnumerable;
5
- var u = (e, i, t) => i in e ? k(e, i, { enumerable: !0, configurable: !0, writable: !0, value: t }) : e[i] = t, w = (e, i) => {
4
+ var V = Object.prototype.hasOwnProperty, $ = Object.prototype.propertyIsEnumerable;
5
+ var u = (e, i, t) => i in e ? b(e, i, { enumerable: !0, configurable: !0, writable: !0, value: t }) : e[i] = t, w = (e, i) => {
6
6
  for (var t in i || (i = {}))
7
- M.call(i, t) && u(e, t, i[t]);
7
+ V.call(i, t) && u(e, t, i[t]);
8
8
  if (f)
9
9
  for (var t of f(i))
10
- V.call(i, t) && u(e, t, i[t]);
10
+ $.call(i, t) && u(e, t, i[t]);
11
11
  return e;
12
- }, v = (e, i) => b(e, x(i));
13
- var y = (e, i, t) => new Promise((l, o) => {
14
- var h = (r) => {
12
+ }, v = (e, i) => x(e, M(i));
13
+ var y = (e, i, t) => new Promise((s, n) => {
14
+ var h = (o) => {
15
15
  try {
16
- a(t.next(r));
17
- } catch (n) {
18
- o(n);
16
+ a(t.next(o));
17
+ } catch (r) {
18
+ n(r);
19
19
  }
20
- }, s = (r) => {
20
+ }, l = (o) => {
21
21
  try {
22
- a(t.throw(r));
23
- } catch (n) {
24
- o(n);
22
+ a(t.throw(o));
23
+ } catch (r) {
24
+ n(r);
25
25
  }
26
- }, a = (r) => r.done ? l(r.value) : Promise.resolve(r.value).then(h, s);
26
+ }, a = (o) => o.done ? s(o.value) : Promise.resolve(o.value).then(h, l);
27
27
  a((t = t.apply(e, i)).next());
28
28
  });
29
- import $ from "bpmn-js/lib/NavigatedViewer";
29
+ import E from "bpmn-js/lib/NavigatedViewer";
30
30
  import d from "diagram-js/lib/navigation/zoomscroll/ZoomScroll";
31
- import { create as c, attr as m, append as p } from "tiny-svg";
32
- import { query as E } from "min-dom";
31
+ import { create as c, attr as p, append as m } from "tiny-svg";
32
+ import { query as A } from "min-dom";
33
33
  import F from "@web-utils/component/easy-popup";
34
34
  import "@web-utils/component/easy-popup/style.css";
35
35
  import { n as S } from "../chunks/vueComponentNormalizer.446f5dc4.mjs";
36
- var A = function() {
36
+ var B = function() {
37
37
  var e = this, i = e.$createElement, t = e._self._c || i;
38
38
  return t("div", {
39
39
  ref: "container",
@@ -44,6 +44,8 @@ var A = function() {
44
44
  }, [t("EasyPopup", {
45
45
  ref: "popup",
46
46
  attrs: {
47
+ "append-to-body": "",
48
+ "flex-column": "",
47
49
  offset: {
48
50
  x: 6,
49
51
  y: 6
@@ -54,7 +56,7 @@ var A = function() {
54
56
  }, {
55
57
  element: e.element
56
58
  })], 2)], 1);
57
- }, B = [];
59
+ }, P = [];
58
60
  const g = d.prototype._handleWheel, W = {
59
61
  __init__: ["zoomScroll"],
60
62
  zoomScroll: ["type", d]
@@ -83,7 +85,9 @@ const g = d.prototype._handleWheel, W = {
83
85
  type: String,
84
86
  default: "rgb(0 190 0 / 100%)"
85
87
  },
86
- ctrlKey: Boolean
88
+ ctrlKey: Boolean,
89
+ nodePopup: Boolean,
90
+ events: Array
87
91
  },
88
92
  data() {
89
93
  return {
@@ -98,35 +102,39 @@ const g = d.prototype._handleWheel, W = {
98
102
  },
99
103
  mounted() {
100
104
  d.prototype._handleWheel = this.ctrlKey ? g : function(e) {
101
- const { target: i, deltaMode: t, clientX: l, clientY: o, deltaX: h, deltaY: s } = e;
105
+ const { target: i, deltaMode: t, clientX: s, clientY: n, deltaX: h, deltaY: l } = e;
102
106
  g.call(this, {
103
107
  target: i,
104
108
  deltaMode: t,
105
- clientX: l,
106
- clientY: o,
109
+ clientX: s,
110
+ clientY: n,
107
111
  deltaX: h,
108
- deltaY: s,
112
+ deltaY: l,
109
113
  preventDefault() {
110
114
  e.preventDefault();
111
115
  },
112
116
  ctrlKey: !0
113
117
  });
114
- }, this.bpmnViewer = new $(v(w({}, this.options), {
118
+ }, this.bpmnViewer = new E(v(w({}, this.options), {
115
119
  container: this.$refs.container,
116
120
  additionalModules: [W]
117
121
  })), this.bpmnViewer.on("import.done", (e) => {
118
122
  const i = e.error, t = e.warnings;
119
123
  i ? this.$emit("error", i) : this.$emit("shown", t), this.bpmnViewer.get("canvas").zoom("fit-viewport", "center"), this.canvas = this.bpmnViewer.get("canvas"), this.elementRegistry = this.bpmnViewer.get("elementRegistry");
120
- const l = this.bpmnViewer.get("eventBus");
121
- l.on("element.mousemove", (n) => {
122
- n.element.type === "bpmn:UserTask" && requestAnimationFrame(() => y(this, null, function* () {
123
- this.$emit("node-mousemove", n.element), this.element = n.element, yield this.$nextTick(), this.$refs.popup.show(n.originalEvent);
124
+ const s = this.bpmnViewer.get("eventBus");
125
+ this.events && this.events.forEach((r) => {
126
+ s.on(r, (k) => {
127
+ this.$emit(r.replace(".", "-"), k.element);
128
+ });
129
+ }), this.nodePopup && s.on("element.mousemove", (r) => {
130
+ r.element.type === "bpmn:UserTask" && requestAnimationFrame(() => y(this, null, function* () {
131
+ this.$emit("node-mousemove", r.element), this.element = r.element, yield this.$nextTick(), this.$refs.popup.show(r.originalEvent);
124
132
  }));
125
- }), l.on("element.out", () => {
133
+ }), this.nodePopup && s.on("element.out", () => {
126
134
  this.$refs.popup.hide(), this.element = {};
127
135
  }), this.highlightFlow(this.historicActivities, this.activities);
128
- const o = c("marker");
129
- m(o, {
136
+ const n = c("marker");
137
+ p(n, {
130
138
  id: "sequenceflow-arrow-green",
131
139
  viewBox: "0 0 20 20",
132
140
  refX: "11",
@@ -136,12 +144,12 @@ const g = d.prototype._handleWheel, W = {
136
144
  orient: "auto"
137
145
  });
138
146
  const h = c("path");
139
- m(h, {
147
+ p(h, {
140
148
  d: "M 1 5 L 11 10 L 1 15 Z",
141
149
  style: "stroke-linecap: round; stroke-linejoin: round; stroke: var(--highlight-color); stroke-width: 1px; fill: var(--highlight-color);"
142
- }), p(o, h);
143
- const s = c("marker");
144
- m(s, {
150
+ }), m(n, h);
151
+ const l = c("marker");
152
+ p(l, {
145
153
  id: "conditional-default-flow-marker-green",
146
154
  viewBox: "0 0 20 20",
147
155
  refX: "0",
@@ -151,12 +159,12 @@ const g = d.prototype._handleWheel, W = {
151
159
  orient: "auto"
152
160
  });
153
161
  const a = c("path");
154
- m(a, {
162
+ p(a, {
155
163
  d: "M 6 4 L 10 16",
156
164
  style: "stroke-linecap: round; stroke-linejoin: round; stroke: var(--highlight-color); stroke-width: 2px; fill: var(--highlight-color);"
157
- }), p(s, a);
158
- const r = E("defs", this.$el);
159
- p(r, o), p(r, s);
165
+ }), m(l, a);
166
+ const o = A("defs", this.$el);
167
+ m(o, n), m(o, l);
160
168
  }), this.bpmnViewer.importXML(this.xml), this.$watch(() => ({
161
169
  activities: this.activities,
162
170
  historicActivities: this.historicActivities
@@ -178,8 +186,8 @@ const g = d.prototype._handleWheel, W = {
178
186
  }, _ = {};
179
187
  var q = /* @__PURE__ */ S(
180
188
  X,
181
- A,
182
189
  B,
190
+ P,
183
191
  !1,
184
192
  C,
185
193
  null,
@@ -190,9 +198,9 @@ function C(e) {
190
198
  for (let i in _)
191
199
  this[i] = _[i];
192
200
  }
193
- const P = /* @__PURE__ */ function() {
201
+ const U = /* @__PURE__ */ function() {
194
202
  return q.exports;
195
203
  }();
196
204
  export {
197
- P as default
205
+ U as default
198
206
  };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@web-utils/component",
3
3
  "description": "Web Components",
4
- "version": "2.9.13",
4
+ "version": "2.9.14",
5
5
  "author": "Simple",
6
6
  "license": "MIT",
7
7
  "type": "module",
package/web-types.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "$schema": "https://json.schemastore.org/web-types",
3
3
  "framework": "vue",
4
4
  "name": "@web-utils/component",
5
- "version": "2.9.13",
5
+ "version": "2.9.14",
6
6
  "contributions": {
7
7
  "html": {
8
8
  "description-markup": "markdown",
@@ -1428,6 +1428,30 @@
1428
1428
  "type": "number"
1429
1429
  },
1430
1430
  "default": "6"
1431
+ },
1432
+ {
1433
+ "name": "appendToBody",
1434
+ "value": {
1435
+ "kind": "expression",
1436
+ "type": "boolean"
1437
+ },
1438
+ "default": ""
1439
+ },
1440
+ {
1441
+ "name": "flexRow",
1442
+ "value": {
1443
+ "kind": "expression",
1444
+ "type": "boolean"
1445
+ },
1446
+ "default": ""
1447
+ },
1448
+ {
1449
+ "name": "flexColumn",
1450
+ "value": {
1451
+ "kind": "expression",
1452
+ "type": "boolean"
1453
+ },
1454
+ "default": ""
1431
1455
  }
1432
1456
  ],
1433
1457
  "slots": [
@@ -2643,6 +2667,22 @@
2643
2667
  "type": "boolean"
2644
2668
  },
2645
2669
  "default": ""
2670
+ },
2671
+ {
2672
+ "name": "nodePopup",
2673
+ "value": {
2674
+ "kind": "expression",
2675
+ "type": "boolean"
2676
+ },
2677
+ "default": ""
2678
+ },
2679
+ {
2680
+ "name": "events",
2681
+ "value": {
2682
+ "kind": "expression",
2683
+ "type": "array"
2684
+ },
2685
+ "default": ""
2646
2686
  }
2647
2687
  ],
2648
2688
  "events": [