hoeditor-web 3.3.6 → 3.3.7-beta.0

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.
package/lib/hoeditor.mjs CHANGED
@@ -1,5 +1,5 @@
1
1
  import "vue";
2
- import { H as i, d as r, b as e, a as l, e as t, T as H, f as d, i as f } from "./index-pT8dR-E7.mjs";
2
+ import { H as i, d as r, b as e, a as l, e as t, T as H, f as d, i as f } from "./index-BMBgyj0h.mjs";
3
3
  export {
4
4
  i as HoDocs,
5
5
  r as HoEditorProvide,
@@ -23031,7 +23031,7 @@ WebPDecoder.prototype.getData = function() {
23031
23031
  (function(a) {
23032
23032
  function t() {
23033
23033
  return function() {
23034
- return globalObject.canvg ? Promise.resolve(globalObject.canvg) : import("./index.es-D60_bPyW.mjs");
23034
+ return globalObject.canvg ? Promise.resolve(globalObject.canvg) : import("./index.es-BcdwwgwB.mjs");
23035
23035
  }().catch(function(r) {
23036
23036
  return Promise.reject(new Error("Could not load canvg: " + r));
23037
23037
  }).then(function(r) {
@@ -24626,7 +24626,7 @@ class DrawSignNode extends DrawCombineNode {
24626
24626
  }
24627
24627
  }
24628
24628
  }
24629
- const version = "3.3.6";
24629
+ const version = "3.3.7-beta.0";
24630
24630
  var FingerPosition = /* @__PURE__ */ ((a) => (a[a.left = 0] = "left", a[a.center = 1] = "center", a[a.right = 2] = "right", a))(FingerPosition || {});
24631
24631
  class SignNode extends BaseNode {
24632
24632
  constructor(hoEditorFactoryID, rootNodes, pNode, nodeType, number, type, name, signType, signFormat, signor, signTime, signTimeFormat, imgSrc, imgWidth, imgHeight, customProperty, isTemplate, styleIndex, connectMode, isFront, allowEditSignTime, fingerPrintSrc, fingerPosition, attribute, connectChar, otherProperties, dataId, associatedElement, associatedPatientElement, isTemp, innerIdentifier) {
@@ -26433,7 +26433,7 @@ class DrawImageNode extends DrawCombineNode {
26433
26433
  }
26434
26434
  }
26435
26435
  class ImageNode extends BaseNode {
26436
- // 业务标识字段
26436
+ //是否已回填(回填占位图是否已被真实图片替换)
26437
26437
  constructor(r, o, n, s, l, c, d, u, f, p, m, g) {
26438
26438
  super(r, o, n, s);
26439
26439
  b(this, "_id");
@@ -26467,7 +26467,9 @@ class ImageNode extends BaseNode {
26467
26467
  b(this, "_backFillType", "");
26468
26468
  //回填类型
26469
26469
  b(this, "_bizCode", "");
26470
- this._id = l, this._dataId = l, this._mId = g || "", this._imageDataBase64String = c, this._remark = "", this._isFormula = f != null && f.isFormula ? f.isFormula : !1, this._markImage = p || "", this._imageJson = m || "", this.isBackFill = f != null && f.isBackFill ? f.isBackFill : !1, this.innerIdentifier = (f == null ? void 0 : f.innerIdentifier) || "", this.backFillType = (f == null ? void 0 : f.backFillType) || "", this.bizCode = (f == null ? void 0 : f.bizCode) || "", this.parentNode && this.parentNode instanceof CellNode, this._width = d, this._height = u, this.node2DrawNodeRange(0, 0);
26470
+ // 业务标识字段
26471
+ b(this, "_isBackFilled", !1);
26472
+ this._id = l, this._dataId = l, this._mId = g || "", this._imageDataBase64String = c, this._remark = "", this._isFormula = f != null && f.isFormula ? f.isFormula : !1, this._markImage = p || "", this._imageJson = m || "", this.isBackFill = f != null && f.isBackFill ? f.isBackFill : !1, this.innerIdentifier = (f == null ? void 0 : f.innerIdentifier) || "", this.backFillType = (f == null ? void 0 : f.backFillType) || "", this.bizCode = (f == null ? void 0 : f.bizCode) || "", this.isBackFilled = !!(f != null && f.isBackFilled), this.parentNode && this.parentNode instanceof CellNode, this._width = d, this._height = u, this.node2DrawNodeRange(0, 0);
26471
26473
  }
26472
26474
  get hoEditorFactoryID() {
26473
26475
  return this._hoEditorFactoryID;
@@ -26562,6 +26564,12 @@ class ImageNode extends BaseNode {
26562
26564
  set bizCode(r) {
26563
26565
  this._bizCode !== r && (this._bizCode = r);
26564
26566
  }
26567
+ get isBackFilled() {
26568
+ return this._isBackFilled;
26569
+ }
26570
+ set isBackFilled(r) {
26571
+ this._isBackFilled !== r && (this._isBackFilled = r);
26572
+ }
26565
26573
  /**
26566
26574
  * imageNode 节点删除时 如果 imageDataBase64String是url地址形式 需要保存url列表
26567
26575
  */
@@ -26626,12 +26634,12 @@ class ImageNode extends BaseNode {
26626
26634
  //imageJson: this.imageJson,
26627
26635
  bizCode: this.bizCode
26628
26636
  };
26629
- return this.isFormula && (c.isFormula = this.isFormula), this.remark && (c.remark = this.remark), this.markImage && (c.markImage = this.markImage), this.imageJson && (c.imageJson = this.imageJson), this.isBackFill && (c.isBackFill = this.isBackFill), this.innerIdentifier && (c.innerIdentifier = this.innerIdentifier), this.backFillType && (c.backFillType = this.backFillType), o ? c : {
26637
+ return this.isFormula && (c.isFormula = this.isFormula), this.remark && (c.remark = this.remark), this.markImage && (c.markImage = this.markImage), this.imageJson && (c.imageJson = this.imageJson), this.isBackFill && (c.isBackFill = this.isBackFill), this.isBackFilled && (c.isBackFilled = this.isBackFilled), this.innerIdentifier && (c.innerIdentifier = this.innerIdentifier), this.backFillType && (c.backFillType = this.backFillType), o ? c : {
26630
26638
  ImageNode: c
26631
26639
  };
26632
26640
  }
26633
26641
  static json2Node(r, o, n, s) {
26634
- const l = Number(o.width), c = Number(o.height), d = o.isFormula == !0 || o.isFormula === "true", u = o.isBackFill == !0 || o.isBackFill === "true", f = o.innerIdentifier || "", p = o.backFillType || "";
26642
+ const l = Number(o.width), c = Number(o.height), d = o.isFormula == !0 || o.isFormula === "true", u = o.isBackFill == !0 || o.isBackFill === "true", f = o.isBackFilled == !0 || o.isBackFilled === "true", p = o.innerIdentifier || "", m = o.backFillType || "";
26635
26643
  return new ImageNode(
26636
26644
  r,
26637
26645
  n,
@@ -26643,7 +26651,7 @@ class ImageNode extends BaseNode {
26643
26651
  c,
26644
26652
  //scaleX,
26645
26653
  //scaleY,
26646
- { isFormula: d, isBackFill: u, innerIdentifier: f, backFillType: p, bizCode: o.bizCode || "" },
26654
+ { isFormula: d, isBackFill: u, isBackFilled: f, innerIdentifier: p, backFillType: m, bizCode: o.bizCode || "" },
26647
26655
  o.markImage,
26648
26656
  o.imageJson,
26649
26657
  o.mId
@@ -58928,6 +58936,15 @@ class TOHTMLConverter {
58928
58936
  return n ? s = n.combineStyle : s = o.docTree.styles[0].combineStyle, r += this.CombineStyleToHTMLStyle(s), r;
58929
58937
  }
58930
58938
  }
58939
+ function getBackFillText(a) {
58940
+ return a === "1" ? "公章" : a === "9" ? "其他" : "";
58941
+ }
58942
+ function createBackFillPlaceholder(a, t, r) {
58943
+ const o = Math.max(1, t || 200), n = Math.max(1, r || 100), s = document.createElement("canvas");
58944
+ s.width = o, s.height = n;
58945
+ const l = s.getContext("2d");
58946
+ return l.fillStyle = "#f5f5f5", l.fillRect(0, 0, o, n), l.strokeStyle = "#d9d9d9", l.lineWidth = 2, l.font = `${Math.max(12, Math.min(48, Math.floor(n / 4)))}px sans-serif`, l.textAlign = "center", l.textBaseline = "middle", l.fillStyle = "#bfbfbf", l.fillText(a, o / 2, n / 2), s.toDataURL("image/png");
58947
+ }
58931
58948
  const commonParamList = /* @__PURE__ */ new Map();
58932
58949
  [
58933
58950
  "viewBlack"
@@ -63767,7 +63784,18 @@ class VueController {
63767
63784
  const o = HOEditorFactorys.instance().getFactory(this._hoEditorFactoryID);
63768
63785
  let n = o.docTree.getNodeLastPath(t.previousLeaf());
63769
63786
  const s = t.getNodePath(), l = new NodeChangeEvent(this._hoEditorFactoryID, DocAction.daModifyStyle, n, s);
63770
- l.oldEndPath = s, l.afterChangePath = s, l.oldDrawLines = new SelectRange(this._hoEditorFactoryID).getRangeDrawLines(n, s, !0, !0), t.imageDataBase64String = r, t.node2DrawNode(), o.docTree.change(l);
63787
+ l.oldEndPath = s, l.afterChangePath = s, l.oldDrawLines = new SelectRange(this._hoEditorFactoryID).getRangeDrawLines(n, s, !0, !0), t.imageDataBase64String = r, t.isBackFilled = !0, t.node2DrawNode(), o.docTree.change(l);
63788
+ }
63789
+ /**
63790
+ * 恢复回填占位:删除已回填的真实图片,还原为空占位图
63791
+ * @param node 回填占位 ImageNode(isBackFill 为 true,已回填 isBackFilled 为 true)
63792
+ */
63793
+ resetBackFillImage(t) {
63794
+ if (!t.isBackFill) return;
63795
+ const r = createBackFillPlaceholder(getBackFillText(t.backFillType), Number(t.width), Number(t.height)), o = HOEditorFactorys.instance().getFactory(this._hoEditorFactoryID);
63796
+ let n = o.docTree.getNodeLastPath(t.previousLeaf());
63797
+ const s = t.getNodePath(), l = new NodeChangeEvent(this._hoEditorFactoryID, DocAction.daModifyStyle, n, s);
63798
+ l.oldEndPath = s, l.afterChangePath = s, l.oldDrawLines = new SelectRange(this._hoEditorFactoryID).getRangeDrawLines(n, s, !0, !0), t.imageDataBase64String = r, t.isBackFilled = !1, t.node2DrawNode(), o.docTree.change(l);
63771
63799
  }
63772
63800
  updateFigure(t, r, o, n, s, l = !1) {
63773
63801
  const c = HOEditorFactorys.instance().getFactory(this._hoEditorFactoryID);
@@ -78806,7 +78834,7 @@ const Slider = __component__$M.exports, uploadImages = (a) => new Promise((t, r)
78806
78834
  }
78807
78835
  },
78808
78836
  insertEmptyImage() {
78809
- const a = this.backFillType === "1" ? "公章" : this.backFillType === "9" ? "其他" : "", t = a ? this.generateBackFillPlaceholder(a, Number(this.backFillWidth), Number(this.backFillHeight)) : "";
78837
+ const a = getBackFillText(this.backFillType), t = a ? this.generateBackFillPlaceholder(a, Number(this.backFillWidth), Number(this.backFillHeight)) : "";
78810
78838
  this.vueController.insertImage(t, Number(this.backFillWidth), Number(this.backFillHeight), {
78811
78839
  isBackFill: !0,
78812
78840
  innerIdentifier: this.innerIdentifier,
@@ -78816,10 +78844,7 @@ const Slider = __component__$M.exports, uploadImages = (a) => new Promise((t, r)
78816
78844
  });
78817
78845
  },
78818
78846
  generateBackFillPlaceholder(a, t, r) {
78819
- const o = Math.max(1, t || 200), n = Math.max(1, r || 100), s = document.createElement("canvas");
78820
- s.width = o, s.height = n;
78821
- const l = s.getContext("2d");
78822
- return l.fillStyle = "#f5f5f5", l.fillRect(0, 0, o, n), l.strokeStyle = "#d9d9d9", l.lineWidth = 2, l.font = `${Math.max(12, Math.min(48, Math.floor(n / 4)))}px sans-serif`, l.textAlign = "center", l.textBaseline = "middle", l.fillStyle = "#bfbfbf", l.fillText(a, o / 2, n / 2), s.toDataURL("image/png");
78847
+ return createBackFillPlaceholder(a, t, r);
78823
78848
  },
78824
78849
  async sure() {
78825
78850
  if (this.multiple) {
@@ -1,4 +1,4 @@
1
- import { c as Da, _ as Va, g as il } from "./index-pT8dR-E7.mjs";
1
+ import { c as Da, _ as Va, g as il } from "./index-BMBgyj0h.mjs";
2
2
  var fn = {}, cn = {}, cr, vn;
3
3
  function Q() {
4
4
  if (vn) return cr;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "hoeditor-web",
3
- "version": "3.3.6",
3
+ "version": "3.3.7-beta.0",
4
4
  "private": false,
5
5
  "main": "lib/hoeditor.mjs",
6
6
  "typings": "types/index.d.ts",