@hailin-zheng/editor-core 2.1.15 → 2.1.17

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/index-cjs.js CHANGED
@@ -2675,7 +2675,7 @@ class ValidateProps {
2675
2675
  return clone;
2676
2676
  }
2677
2677
  }
2678
- class DataElementGroupProps {
2678
+ class DataElementGroupProps extends INotifyPropertyChanged {
2679
2679
  id;
2680
2680
  name;
2681
2681
  hidden;
@@ -8298,8 +8298,9 @@ class DataElementBarcode extends DataElementLeaf {
8298
8298
  }
8299
8299
  createRenderObject() {
8300
8300
  const render = new DataElementBarcodeRenderObject(this);
8301
- render.rect.width = this.props.width + 2;
8302
- render.rect.height = this.props.height + 2;
8301
+ const { width, height } = render.measureSize();
8302
+ render.rect.width = width + 2;
8303
+ render.rect.height = height + 2;
8303
8304
  return render;
8304
8305
  }
8305
8306
  serialize(options) {
@@ -8370,11 +8371,27 @@ class DataElementBarcodeRenderObject extends ResizeLeafRenderObject {
8370
8371
  else {
8371
8372
  const svg = document.createElementNS('http://www.w3.org/2000/svg', 'svg');
8372
8373
  JsBarcode__default["default"](svg, this.element.props.text);
8374
+ const width = Number.parseInt(svg.getAttribute('width').replace('px', ''));
8375
+ const height = Number.parseInt(svg.getAttribute('height').replace('px', ''));
8376
+ svg.setAttribute('width', this.element.props.width + 'px');
8377
+ svg.setAttribute('height', height * (this.element.props.width / width) + 'px');
8373
8378
  const vNode = snabbdom.toVNode(svg);
8374
8379
  t.children = [vNode];
8375
8380
  }
8376
8381
  return t;
8377
8382
  }
8383
+ measureSize() {
8384
+ if (this.element.props.type === 'qrcode') {
8385
+ return { width: this.element.props.width, height: this.element.props.height };
8386
+ }
8387
+ else {
8388
+ const svg = document.createElementNS('http://www.w3.org/2000/svg', 'svg');
8389
+ JsBarcode__default["default"](svg, this.element.props.text);
8390
+ const width = Number.parseInt(svg.getAttribute('width').replace('px', ''));
8391
+ const height = Number.parseInt(svg.getAttribute('height').replace('px', ''));
8392
+ return { width: this.element.props.width, height: height * (this.element.props.width / width) };
8393
+ }
8394
+ }
8378
8395
  toSvgString(qr, border, lightColor, darkColor) {
8379
8396
  let parts = [];
8380
8397
  for (let y = 0; y < qr.size; y++) {
@@ -28571,8 +28588,7 @@ class DocEditor {
28571
28588
  });
28572
28589
  offPrint.afterPrint.subscribe(() => {
28573
28590
  });
28574
- const html = offPrint.getSvgNodes(this.docCtx.document.paintRenders);
28575
- console.log(html);
28591
+ return offPrint.getSvgNodes(this.docCtx.document.paintRenders);
28576
28592
  }
28577
28593
  /**
28578
28594
  * 设置光标在数据元内容末尾
@@ -28818,7 +28834,7 @@ class DocEditor {
28818
28834
  rule.setRuleOptions({ width: this.viewOptions.docPageSettings.width, pagePL, pagePR, docLeft });
28819
28835
  }
28820
28836
  version() {
28821
- return "2.1.15";
28837
+ return "2.1.17";
28822
28838
  }
28823
28839
  switchPageHeaderEditor() {
28824
28840
  this.docCtx.document.switchPageHeaderEditor(this.selectionState, null);