@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.js CHANGED
@@ -2646,7 +2646,7 @@ class ValidateProps {
2646
2646
  return clone;
2647
2647
  }
2648
2648
  }
2649
- class DataElementGroupProps {
2649
+ class DataElementGroupProps extends INotifyPropertyChanged {
2650
2650
  id;
2651
2651
  name;
2652
2652
  hidden;
@@ -8269,8 +8269,9 @@ class DataElementBarcode extends DataElementLeaf {
8269
8269
  }
8270
8270
  createRenderObject() {
8271
8271
  const render = new DataElementBarcodeRenderObject(this);
8272
- render.rect.width = this.props.width + 2;
8273
- render.rect.height = this.props.height + 2;
8272
+ const { width, height } = render.measureSize();
8273
+ render.rect.width = width + 2;
8274
+ render.rect.height = height + 2;
8274
8275
  return render;
8275
8276
  }
8276
8277
  serialize(options) {
@@ -8341,11 +8342,27 @@ class DataElementBarcodeRenderObject extends ResizeLeafRenderObject {
8341
8342
  else {
8342
8343
  const svg = document.createElementNS('http://www.w3.org/2000/svg', 'svg');
8343
8344
  JsBarcode(svg, this.element.props.text);
8345
+ const width = Number.parseInt(svg.getAttribute('width').replace('px', ''));
8346
+ const height = Number.parseInt(svg.getAttribute('height').replace('px', ''));
8347
+ svg.setAttribute('width', this.element.props.width + 'px');
8348
+ svg.setAttribute('height', height * (this.element.props.width / width) + 'px');
8344
8349
  const vNode = toVNode(svg);
8345
8350
  t.children = [vNode];
8346
8351
  }
8347
8352
  return t;
8348
8353
  }
8354
+ measureSize() {
8355
+ if (this.element.props.type === 'qrcode') {
8356
+ return { width: this.element.props.width, height: this.element.props.height };
8357
+ }
8358
+ else {
8359
+ const svg = document.createElementNS('http://www.w3.org/2000/svg', 'svg');
8360
+ JsBarcode(svg, this.element.props.text);
8361
+ const width = Number.parseInt(svg.getAttribute('width').replace('px', ''));
8362
+ const height = Number.parseInt(svg.getAttribute('height').replace('px', ''));
8363
+ return { width: this.element.props.width, height: height * (this.element.props.width / width) };
8364
+ }
8365
+ }
8349
8366
  toSvgString(qr, border, lightColor, darkColor) {
8350
8367
  let parts = [];
8351
8368
  for (let y = 0; y < qr.size; y++) {
@@ -28542,8 +28559,7 @@ class DocEditor {
28542
28559
  });
28543
28560
  offPrint.afterPrint.subscribe(() => {
28544
28561
  });
28545
- const html = offPrint.getSvgNodes(this.docCtx.document.paintRenders);
28546
- console.log(html);
28562
+ return offPrint.getSvgNodes(this.docCtx.document.paintRenders);
28547
28563
  }
28548
28564
  /**
28549
28565
  * 设置光标在数据元内容末尾
@@ -28789,7 +28805,7 @@ class DocEditor {
28789
28805
  rule.setRuleOptions({ width: this.viewOptions.docPageSettings.width, pagePL, pagePR, docLeft });
28790
28806
  }
28791
28807
  version() {
28792
- return "2.1.15";
28808
+ return "2.1.17";
28793
28809
  }
28794
28810
  switchPageHeaderEditor() {
28795
28811
  this.docCtx.document.switchPageHeaderEditor(this.selectionState, null);