mx-framework-plus 1.1.2 → 1.1.4

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.
@@ -4448,20 +4448,20 @@ function Me(t) {
4448
4448
  // 继承样式
4449
4449
  ), U = 10, I = 10, R = g.getCellGeometry(h);
4450
4450
  let $ = R.getTerminalPoint(!0), T = R.getTerminalPoint(!1);
4451
- var K = new mxGeometry();
4452
- K.setTerminalPoint(
4451
+ var G = new mxGeometry();
4452
+ G.setTerminalPoint(
4453
4453
  new mxPoint(
4454
4454
  $.x + U,
4455
4455
  $.y + I
4456
4456
  ),
4457
4457
  !0
4458
- ), K.setTerminalPoint(
4458
+ ), G.setTerminalPoint(
4459
4459
  new mxPoint(
4460
4460
  T.x + U,
4461
4461
  T.y + I
4462
4462
  ),
4463
4463
  !1
4464
- ), C.setGeometry(K), C.value = h.value, C.type = h.type, C.model = "yes", C.type = "edge", C.iconName = h.iconName, k(C);
4464
+ ), C.setGeometry(G), C.value = h.value, C.type = h.type, C.model = "yes", C.type = "edge", C.iconName = h.iconName, k(C);
4465
4465
  } finally {
4466
4466
  z.endUpdate();
4467
4467
  }
@@ -4555,8 +4555,8 @@ function Tt(t) {
4555
4555
  let $ = C.value.style || {};
4556
4556
  $.background && $.background.indexOf("files/") > -1 && $["background-image"] ? I.style.background = `${$["background-image"]} center center no-repeat` : I.style.background = "";
4557
4557
  }
4558
- let K = k.container.querySelector("#gridCanvas_" + C.id);
4559
- K && K.remove(), k.container.prepend(I), I.width = I.offsetWidth, I.height = I.offsetHeight, U ? s = "transparent" : s = "#dddddd", A(I), I.addEventListener("wheel", function($) {
4558
+ let G = k.container.querySelector("#gridCanvas_" + C.id);
4559
+ G && G.remove(), k.container.prepend(I), I.width = I.offsetWidth, I.height = I.offsetHeight, U ? s = "transparent" : s = "#dddddd", A(I), I.addEventListener("wheel", function($) {
4560
4560
  $.preventDefault();
4561
4561
  const T = I.getBoundingClientRect(), Z = $.clientX - T.left, te = $.clientY - T.top, ie = 0.1, oe = $.deltaY < 0 ? 1 : -1, ce = Math.exp(oe * ie), ye = Z / h, fe = te / h;
4562
4562
  h *= ce, h = Math.min(Math.max(0.5, h), 5), x = ye - Z / h, g = fe - te / h, A(I), k && (k.view.scale = h, k.refresh());
@@ -4567,8 +4567,8 @@ function Tt(t) {
4567
4567
  if (!k) return;
4568
4568
  k.snapPoint = function(C, U, I) {
4569
4569
  if (!I && this.snapToGrid && l > 0) {
4570
- const R = l / h, K = C.x - x, $ = C.y - g;
4571
- C.x = Math.round(K / R) * R + x, C.y = Math.round($ / R) * R + g;
4570
+ const R = l / h, G = C.x - x, $ = C.y - g;
4571
+ C.x = Math.round(G / R) * R + x, C.y = Math.round($ / R) * R + g;
4572
4572
  }
4573
4573
  return C;
4574
4574
  };
@@ -4584,8 +4584,8 @@ function Tt(t) {
4584
4584
  for (let C = 0; C < z.length; C++) {
4585
4585
  const U = z[C], I = this.getCellGeometry(U);
4586
4586
  if (I) {
4587
- const R = I.clone(), K = this.snapPoint({ x: R.x, y: R.y });
4588
- R.x = K.x, R.y = K.y, this.getModel().setGeometry(U, R);
4587
+ const R = I.clone(), G = this.snapPoint({ x: R.x, y: R.y });
4588
+ R.x = G.x, R.y = G.y, this.getModel().setGeometry(U, R);
4589
4589
  }
4590
4590
  }
4591
4591
  } finally {
@@ -4600,17 +4600,17 @@ function Tt(t) {
4600
4600
  const U = l * h;
4601
4601
  if (U < 2) return;
4602
4602
  C.strokeStyle = s, C.lineWidth = m, C.globalAlpha = v;
4603
- const I = Math.floor(-x * h / U) * U, R = Math.floor(-g * h / U) * U, K = z.width + U, $ = z.height + U;
4603
+ const I = Math.floor(-x * h / U) * U, R = Math.floor(-g * h / U) * U, G = z.width + U, $ = z.height + U;
4604
4604
  switch (p) {
4605
4605
  case "dotted":
4606
4606
  C.fillStyle = s;
4607
- for (let T = I; T < K; T += U)
4607
+ for (let T = I; T < G; T += U)
4608
4608
  for (let Z = R; Z < $; Z += U)
4609
4609
  C.beginPath(), C.arc(T + 0.5, Z + 0.5, m, 0, Math.PI * 2), C.fill();
4610
4610
  break;
4611
4611
  case "dashed":
4612
4612
  C.setLineDash([5, 3]), C.beginPath();
4613
- for (let T = I; T < K; T += U)
4613
+ for (let T = I; T < G; T += U)
4614
4614
  C.moveTo(T + 0.5, 0), C.lineTo(T + 0.5, z.height);
4615
4615
  for (let T = R; T < $; T += U)
4616
4616
  C.moveTo(0, T + 0.5), C.lineTo(z.width, T + 0.5);
@@ -4618,7 +4618,7 @@ function Tt(t) {
4618
4618
  break;
4619
4619
  case "square":
4620
4620
  C.beginPath();
4621
- for (let T = I; T < K; T += U)
4621
+ for (let T = I; T < G; T += U)
4622
4622
  C.moveTo(T + 0.5, 0), C.lineTo(T + 0.5, z.height);
4623
4623
  for (let T = R; T < $; T += U)
4624
4624
  C.moveTo(0, T + 0.5), C.lineTo(z.width, T + 0.5);
@@ -4626,7 +4626,7 @@ function Tt(t) {
4626
4626
  break;
4627
4627
  default:
4628
4628
  C.beginPath();
4629
- for (let T = I; T < K; T += U)
4629
+ for (let T = I; T < G; T += U)
4630
4630
  C.moveTo(T + 0.5, 0), C.lineTo(T + 0.5, z.height);
4631
4631
  for (let T = R; T < $; T += U)
4632
4632
  C.moveTo(0, T + 0.5), C.lineTo(z.width, T + 0.5);
@@ -5534,7 +5534,7 @@ function je(t) {
5534
5534
  e.firstStyle = !1;
5535
5535
  }
5536
5536
  }, i.view.scaleGrid = !0, i.view.roundPoints = !0, mxSvgCanvas2D.prototype.updateTextNodes = function(w, E, L, O, M, B, F, V, H, W, q) {
5537
- var G = this.state.scale;
5537
+ var K = this.state.scale;
5538
5538
  mxSvgCanvas2D.createCss(
5539
5539
  L + 2,
5540
5540
  O,
@@ -5547,11 +5547,11 @@ function je(t) {
5547
5547
  this.state.fontBorderColor != null ? this.state.fontBorderColor : null,
5548
5548
  "display: flex; align-items: unsafe " + (B == mxConstants.ALIGN_TOP ? "flex-start" : B == mxConstants.ALIGN_BOTTOM ? "flex-end" : "center") + "; justify-content: unsafe " + (M == mxConstants.ALIGN_LEFT ? "flex-start" : M == mxConstants.ALIGN_RIGHT ? "flex-end" : "center") + "; ",
5549
5549
  this.getTextCss(),
5550
- G,
5550
+ K,
5551
5551
  mxUtils.bind(this, function(ne, re, Y, se, X) {
5552
5552
  w += this.state.dx, E += this.state.dy;
5553
- var he = q.firstChild, Ue = he.firstChild, Le = Ue.firstChild, et = Le.firstChild, Pe = (this.rotateHtml ? this.state.rotation : 0) + (W ?? 0), Ce = (this.foOffset != 0 ? "translate(" + this.foOffset + " " + this.foOffset + ")" : "") + (G != 1 ? "scale(" + G + ")" : "");
5554
- et.setAttribute("style", X), Le.setAttribute("style", se), he.setAttribute("width", Math.ceil(1 / Math.min(1, G) * 100) + "%"), he.setAttribute("height", Math.ceil(1 / Math.min(1, G) * 100) + "%");
5553
+ var he = q.firstChild, Ue = he.firstChild, Le = Ue.firstChild, et = Le.firstChild, Pe = (this.rotateHtml ? this.state.rotation : 0) + (W ?? 0), Ce = (this.foOffset != 0 ? "translate(" + this.foOffset + " " + this.foOffset + ")" : "") + (K != 1 ? "scale(" + K + ")" : "");
5554
+ et.setAttribute("style", X), Le.setAttribute("style", se), he.setAttribute("width", Math.ceil(1 / Math.min(1, K) * 100) + "%"), he.setAttribute("height", Math.ceil(1 / Math.min(1, K) * 100) + "%");
5555
5555
  let ge = Math.round(E + re), tt = Math.round(w + ne), lt = s(ge), at = s(tt);
5556
5556
  if (ge < 0)
5557
5557
  he.setAttribute("y", ge);
@@ -5943,12 +5943,12 @@ function je(t) {
5943
5943
  return i === "gap" && (y = `${o}px`), `${i}=${y}`;
5944
5944
  }).join("; ") + ";" : "";
5945
5945
  }
5946
- function K(a) {
5946
+ function G(a) {
5947
5947
  const u = String(a).match(/\d+/);
5948
5948
  return u ? Number(u[0]) : null;
5949
5949
  }
5950
5950
  function $(a, n, u) {
5951
- let d = a.value, o = K(d);
5951
+ let d = a.value, o = G(d);
5952
5952
  return n === "-inf" ? o <= u : u === "+inf" ? o >= n : o >= n && o <= u;
5953
5953
  }
5954
5954
  function T(a, n) {
@@ -6124,8 +6124,8 @@ function je(t) {
6124
6124
  f && (M = u.getPointForEvent(f));
6125
6125
  let B = ue(), F = u.insertEdge(d, null, "", null, null, w.perimeter + `;strokeWidth=${w.strokeWidth || 1};strokeColor=${w.strokeColor || "#333333"}`);
6126
6126
  F.id = B;
6127
- let V = new mxGeometry(), { startX: H, startY: W, endX: q, endY: G } = ze(M, E, L);
6128
- V.setTerminalPoint(new mxPoint(H, W), !0), V.setTerminalPoint(new mxPoint(q, G), !1), F.setGeometry(V), F.model = "yes", F.type = "edge", F.iconName = O, F.value = {
6127
+ let V = new mxGeometry(), { startX: H, startY: W, endX: q, endY: K } = ze(M, E, L);
6128
+ V.setTerminalPoint(new mxPoint(H, W), !0), V.setTerminalPoint(new mxPoint(q, K), !1), F.setGeometry(V), F.model = "yes", F.type = "edge", F.iconName = O, F.value = {
6129
6129
  data: { ...b },
6130
6130
  //存储对象
6131
6131
  style: { ...w }
@@ -6158,9 +6158,9 @@ function je(t) {
6158
6158
  se.value = W;
6159
6159
  }
6160
6160
  b.layout = W;
6161
- let G = n.getDefaultParent();
6161
+ let K = n.getDefaultParent();
6162
6162
  ce(n, null);
6163
- let ne = R(b), re = ue(), Y = n.insertVertex(G, re, b.text || "", H.x, H.y, F, V, ne);
6163
+ let ne = R(b), re = ue(), Y = n.insertVertex(K, re, b.text || "", H.x, H.y, F, V, ne);
6164
6164
  Y.crtype = "creatComp", Y.cmp = L, Y.codeType = O, Y.type = E, Y.realType = B, Y.model = "yes", Y.name = b.text || "", Y.iconName = M, Y.style = ne, Y.value = {
6165
6165
  data: c,
6166
6166
  //存储对象
@@ -6195,14 +6195,14 @@ function je(t) {
6195
6195
  }
6196
6196
  let W = R(b);
6197
6197
  b.gtype == "rect" && (Number(b.borderValue) === 0 && (b.stroke = "transparent"), W = b.perimeter + `;fillColor=${b.background || "transparent"};strokeColor=${b.stroke || "#333333"};strokeWidth=${b.borderWidth || 0}`);
6198
- let q = ue(), G = n.insertVertex(B, q, b.text || "", M.x, M.y, S, w, W);
6199
- b.gtype == "rect" ? G.type = "rect" : G.type = "vertex", G.model = "yes", G.name = b.text || "", G.iconName = E, G.value = {
6198
+ let q = ue(), K = n.insertVertex(B, q, b.text || "", M.x, M.y, S, w, W);
6199
+ b.gtype == "rect" ? K.type = "rect" : K.type = "vertex", K.model = "yes", K.name = b.text || "", K.iconName = E, K.value = {
6200
6200
  data: { ...c },
6201
6201
  //存储对象
6202
6202
  style: { ...b }
6203
6203
  //存储样式对象
6204
- }, G.from = O || "other", G.realType = L, G.style = W, d.push(G), n.fireEvent(new mxEventObject(mxEvent.SELECTION_CHANGED, {
6205
- cells: [G]
6204
+ }, K.from = O || "other", K.realType = L, K.style = W, d.push(K), n.fireEvent(new mxEventObject(mxEvent.SELECTION_CHANGED, {
6205
+ cells: [K]
6206
6206
  }));
6207
6207
  }
6208
6208
  n.setSelectionCells(d);
@@ -6293,9 +6293,9 @@ function je(t) {
6293
6293
  height: H,
6294
6294
  x: W.x,
6295
6295
  y: W.y
6296
- }, G = i.children;
6297
- if (G && G.length > 0) {
6298
- let Y = G.find((se) => se.key == "layout");
6296
+ }, K = i.children;
6297
+ if (K && K.length > 0) {
6298
+ let Y = K.find((se) => se.key == "layout");
6299
6299
  Y.value = q;
6300
6300
  }
6301
6301
  f.layout = q;
@@ -6967,8 +6967,7 @@ const $e = {
6967
6967
  isShowPup: !1,
6968
6968
  wndAry: [],
6969
6969
  thisObj: /* @__PURE__ */ new Map(),
6970
- centeredWindow: [],
6971
- maskObj: {}
6970
+ centeredWindow: []
6972
6971
  };
6973
6972
  },
6974
6973
  watch: {
@@ -6976,7 +6975,9 @@ const $e = {
6976
6975
  handler(t, e) {
6977
6976
  let l = this;
6978
6977
  l.yhz && (l.yhz.isPreview(!t), l.$nextTick(() => {
6979
- t ? (l.keys = Math.random().toString(36).substring(2), l.graph.refresh(), l.scheduleUpdateOverlay()) : l.removeMaskOrWnd();
6978
+ t ? (l.keys = Math.random().toString(36).substring(2), l.graph.refresh(), l.scheduleUpdateOverlay()) : l.centeredWindow && l.centeredWindow.forEach((r) => {
6979
+ r && (r.setVisible(!1), r.destroy());
6980
+ });
6980
6981
  }));
6981
6982
  },
6982
6983
  immediate: !0,
@@ -7141,7 +7142,7 @@ const $e = {
7141
7142
  },
7142
7143
  onResize() {
7143
7144
  let t = this;
7144
- t.yhz && (t.removeMaskOrWnd(!1), t.yhz.changePageSize(), t.yhz.getFloatingPosition());
7145
+ t.yhz && (t.yhz.changePageSize(), t.yhz.getFloatingPosition());
7145
7146
  },
7146
7147
  //清空并重新加载
7147
7148
  clearCanvas() {
@@ -7151,7 +7152,9 @@ const $e = {
7151
7152
  openPupop(t, e = !0) {
7152
7153
  let l = this;
7153
7154
  if (l.pupAry = t, t && t.length > 0) {
7154
- l.removeMaskOrWnd(!0);
7155
+ l.centeredWindow && l.centeredWindow.forEach((m) => {
7156
+ m && (m.setVisible(!1), m.destroy());
7157
+ });
7155
7158
  let s = [];
7156
7159
  t.forEach((r, m) => {
7157
7160
  var p = document.createElement("div");
@@ -7188,10 +7191,12 @@ const $e = {
7188
7191
  "mxWindowTitle"
7189
7192
  );
7190
7193
  U.setClosable(!0), U.setMaximizable(!0), U.setScrollable(!0), U.setResizable(!0), U.setVisible(e), U.constrainWithinViewport = !0, U.addListener(mxEvent.CLOSE, function(I, R) {
7191
- l.isShowPup = !1, document.body.removeChild(z), z.style.display = "none";
7194
+ l.isShowPup = !1, C && C.length > 0 && C.forEach((G) => {
7195
+ document.body.removeChild(G);
7196
+ }), z.style.display = "none";
7192
7197
  }), U.addListener(mxEvent.MOVE, function(I, R) {
7193
- var K = U.getX(), $ = U.getY(), T = U.getElement().offsetWidth, Z = U.getElement().offsetHeight, te = document.documentElement.clientWidth, ie = document.documentElement.clientHeight, oe = 0, ce = 0, ye = te - T, fe = ie - Z;
7194
- K = Math.max(oe, Math.min(K, ye)), $ = Math.max(ce, Math.min($, fe)), U.setLocation(K, $);
7198
+ var G = U.getX(), $ = U.getY(), T = U.getElement().offsetWidth, Z = U.getElement().offsetHeight, te = document.documentElement.clientWidth, ie = document.documentElement.clientHeight, oe = 0, ce = 0, ye = te - T, fe = ie - Z;
7199
+ G = Math.max(oe, Math.min(G, ye)), $ = Math.max(ce, Math.min($, fe)), U.setLocation(G, $);
7195
7200
  }), U.div && C.length === 0 && (U.div.style.zIndex = 2e3 + m, z.className = "mx-window-mask", z.style.zIndex = 30 + m, document.body.appendChild(z), z.style.display = "block"), s.push(U);
7196
7201
  }), l.centeredWindow = s, l.wndAry = s;
7197
7202
  }
@@ -7221,14 +7226,6 @@ const $e = {
7221
7226
  console.log("元素滚动:", l.scrollTop, l.scrollLeft);
7222
7227
  });
7223
7228
  }
7224
- },
7225
- removeMaskOrWnd(t) {
7226
- let e = this, l = document.querySelectorAll(".mx-window-mask");
7227
- l && l.length > 0 && l.forEach((s) => {
7228
- s.remove();
7229
- }), t && e.centeredWindow && e.centeredWindow.forEach((r) => {
7230
- r && (r.setVisible(!1), r.destroy());
7231
- });
7232
7229
  }
7233
7230
  },
7234
7231
  mounted() {
@@ -7241,7 +7238,9 @@ const $e = {
7241
7238
  },
7242
7239
  unmounted() {
7243
7240
  let t = this;
7244
- t.resizeObserver && t.resizeObserver.disconnect(), t.isShowPup = !1, t.removeMaskOrWnd(!0), window.removeEventListener("resize", t.getWindowInfo);
7241
+ t.resizeObserver && t.resizeObserver.disconnect(), t.isShowPup = !1, t.centeredWindow && t.centeredWindow.forEach((l) => {
7242
+ l && (l.setVisible(!1), l.destroy());
7243
+ }), window.removeEventListener("resize", t.getWindowInfo);
7245
7244
  }
7246
7245
  }, Nl = ["id"], Ul = {
7247
7246
  key: 0,
@@ -7505,7 +7504,7 @@ const jl = /* @__PURE__ */ ae(zl, [["render", Pl]]), Tl = {
7505
7504
  A.setClosable(!0), A.setMaximizable(!1), A.setResizable(!0), A.setVisible(e), A.constrainWithinViewport = !0, A.addListener(mxEvent.CLOSE, function(z, C) {
7506
7505
  l.isShowPup = !1;
7507
7506
  }), A.addListener(mxEvent.MOVE, function(z, C) {
7508
- var U = A.getX(), I = A.getY(), R = A.getElement().offsetWidth, K = A.getElement().offsetHeight, $ = document.documentElement.clientWidth, T = document.documentElement.clientHeight, Z = 0, te = 0, ie = $ - R, oe = T - K;
7507
+ var U = A.getX(), I = A.getY(), R = A.getElement().offsetWidth, G = A.getElement().offsetHeight, $ = document.documentElement.clientWidth, T = document.documentElement.clientHeight, Z = 0, te = 0, ie = $ - R, oe = T - G;
7509
7508
  U = Math.max(Z, Math.min(U, ie)), I = Math.max(te, Math.min(I, oe)), A.setLocation(U, I);
7510
7509
  }), s.push(A);
7511
7510
  }), window.centeredWindow = s, l.wndAry = s;