@hailin-zheng/editor-core 2.1.20 → 2.1.22

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
@@ -629,10 +629,60 @@ class CommonUtil {
629
629
  return reg.test(str);
630
630
  }
631
631
  static cloneValue(val) {
632
- if (typeof val === 'object' && val) {
633
- return JSON.parse(JSON.stringify(val));
632
+ return CommonUtil.cloneDeep(val);
633
+ }
634
+ static cloneDeep(source, visited = new WeakMap()) {
635
+ if (source === null || typeof source !== 'object') {
636
+ // 如果是基本类型或 null,则直接返回
637
+ return source;
638
+ }
639
+ // 处理循环引用
640
+ if (visited.has(source)) {
641
+ return visited.get(source);
642
+ }
643
+ if (Array.isArray(source)) {
644
+ // 如果是数组,则递归复制数组元素
645
+ const arrayClone = [];
646
+ visited.set(source, arrayClone);
647
+ source.forEach((item, index) => {
648
+ arrayClone[index] = CommonUtil.cloneDeep(item, visited);
649
+ });
650
+ return arrayClone;
651
+ }
652
+ if (source instanceof Date) {
653
+ // 如果是 Date 对象,则直接创建一个新的 Date 对象
654
+ return new Date(source.getTime());
655
+ }
656
+ if (source instanceof Map) {
657
+ // 如果是 Map 对象,则递归复制键值对
658
+ const mapClone = new Map();
659
+ visited.set(source, mapClone);
660
+ source.forEach((value, key) => {
661
+ mapClone.set(CommonUtil.cloneDeep(key, visited), CommonUtil.cloneDeep(value, visited));
662
+ });
663
+ return mapClone;
664
+ }
665
+ if (source instanceof Set) {
666
+ // 如果是 Set 对象,则递归复制元素
667
+ const setClone = new Set();
668
+ visited.set(source, setClone);
669
+ source.forEach(value => {
670
+ setClone.add(CommonUtil.cloneDeep(value, visited));
671
+ });
672
+ return setClone;
634
673
  }
635
- return val;
674
+ if (Object.prototype.toString.call(source) === '[object Object]') {
675
+ // 如果是普通对象,则递归复制对象属性
676
+ const objectClone = {};
677
+ visited.set(source, objectClone);
678
+ for (const key in source) {
679
+ if (source.hasOwnProperty(key)) {
680
+ objectClone[key] = CommonUtil.cloneDeep(source[key], visited);
681
+ }
682
+ }
683
+ return objectClone;
684
+ }
685
+ return source;
636
686
  }
637
687
  static isConstructor(f) {
638
688
  try {
@@ -712,6 +762,9 @@ class CommonUtil {
712
762
  return btoa(unescape(encodeURIComponent(str)));
713
763
  //return btoa(str.replace(/[\u00A0-\u2666]/g, c => `&#${c.charCodeAt(0)};`));
714
764
  }
765
+ static isEqual(a, b) {
766
+ return JSON.stringify(a) === JSON.stringify(b);
767
+ }
715
768
  }
716
769
 
717
770
  const docOpsMap = new Map();
@@ -1183,6 +1236,8 @@ class Element {
1183
1236
  disposed;
1184
1237
  //加载完毕
1185
1238
  loaded;
1239
+ visibleExpr;
1240
+ attribute;
1186
1241
  _parent;
1187
1242
  get parent() {
1188
1243
  return this._parent;
@@ -1255,7 +1310,6 @@ class Element {
1255
1310
  listeners.forEach(item => item(evt));
1256
1311
  }
1257
1312
  beginMeasure(data) {
1258
- this.paintRenders.length = 0;
1259
1313
  }
1260
1314
  endMeasure() {
1261
1315
  }
@@ -1671,6 +1725,7 @@ class ViewOptions {
1671
1725
  printHeaderFooterLine = false;
1672
1726
  //显示段落回车符号
1673
1727
  showEnterSymbol = false;
1728
+ enableVisibleExpression = false;
1674
1729
  get fullPageView() {
1675
1730
  return this._fullPageView;
1676
1731
  }
@@ -1784,6 +1839,30 @@ class BorderProps {
1784
1839
  return new BorderProps(this.width, this.color, this.style);
1785
1840
  }
1786
1841
  }
1842
+ /**
1843
+ * 克隆元素的基本属性
1844
+ * @param ele
1845
+ * @param target
1846
+ */
1847
+ function cloneElementBase(ele, target) {
1848
+ target.attribute = ele.attribute ? CommonUtil.cloneValue(ele.attribute) : undefined;
1849
+ }
1850
+ /**
1851
+ * 克隆元素的子元素
1852
+ * @param ele
1853
+ * @param target
1854
+ * @param data
1855
+ */
1856
+ function cloneChildren(ele, target, data) {
1857
+ if (!data) {
1858
+ return;
1859
+ }
1860
+ for (let i = 0; i < ele.length; i++) {
1861
+ const child = ele.getChild(i);
1862
+ const cloneChild = child.clone(true);
1863
+ target.addChild(cloneChild);
1864
+ }
1865
+ }
1787
1866
  class IDispose {
1788
1867
  }
1789
1868
  class ResizeLeafRenderObject extends LeafRenderObject {
@@ -2790,11 +2869,8 @@ class CommsContainerElement extends BlockContainerElement {
2790
2869
  }
2791
2870
  clone(data) {
2792
2871
  const clone = new CommsContainerElement();
2793
- if (data) {
2794
- for (let i = 0; i < this.length; i++) {
2795
- clone.addChild(this.getChild(i).clone(true));
2796
- }
2797
- }
2872
+ cloneElementBase(this, clone);
2873
+ cloneChildren(this, clone, data);
2798
2874
  return clone;
2799
2875
  }
2800
2876
  }
@@ -2877,7 +2953,7 @@ class DataDecorateElement extends LeafElement {
2877
2953
  clone() {
2878
2954
  const clone = new DataDecorateElement(this.dataEle, this.isPrefix);
2879
2955
  this.props.clone(clone.props);
2880
- //clone.renderCtx = this.renderCtx;
2956
+ cloneElementBase(this, clone);
2881
2957
  return clone;
2882
2958
  }
2883
2959
  }
@@ -2952,7 +3028,7 @@ class DataDecorateRenderObject extends LeafRenderObject {
2952
3028
  }
2953
3029
  }
2954
3030
 
2955
- function parser(code) {
3031
+ function parser(code, objects) {
2956
3032
  const node = acor.parse(code, { ecmaVersion: 'latest' });
2957
3033
  estraverse.traverse(node, {
2958
3034
  enter: (child, parent) => {
@@ -2960,6 +3036,7 @@ function parser(code) {
2960
3036
  const identifierName = child['name'];
2961
3037
  if (identifierName.startsWith('$')) {
2962
3038
  child['name'] = `getObject('${identifierName.slice(1)}').value`;
3039
+ objects?.push(identifierName.slice(1));
2963
3040
  }
2964
3041
  }
2965
3042
  }
@@ -2986,6 +3063,28 @@ function parser(code) {
2986
3063
  });
2987
3064
  return generate(node);
2988
3065
  }
3066
+ //判断代码的语句,如果最后一个语句不是return,那么加上return
3067
+ function addReturn(code) {
3068
+ const node = acor.parse(code, { ecmaVersion: 'latest' });
3069
+ estraverse.replace(node, {
3070
+ leave: (child) => {
3071
+ //函数调用
3072
+ if (child.type == 'Program') {
3073
+ const body = child['body'];
3074
+ const lastNode = body[body.length - 1];
3075
+ if (lastNode.type !== 'ReturnStatement') {
3076
+ body[body.length - 1] = {
3077
+ type: 'ReturnStatement',
3078
+ start: -1, end: -1,
3079
+ argument: lastNode
3080
+ };
3081
+ }
3082
+ return child;
3083
+ }
3084
+ }
3085
+ });
3086
+ return generate(node);
3087
+ }
2989
3088
  /**
2990
3089
  * 将参数转为函数调用arg => ()=>arg
2991
3090
  * @param nodes
@@ -3079,11 +3178,8 @@ class ParagraphElement extends BlockContentElement {
3079
3178
  clone(data) {
3080
3179
  const clone = new ParagraphElement();
3081
3180
  this.props.clone(clone.props);
3082
- if (data) {
3083
- for (let i = 0; i < this.length; i++) {
3084
- clone.addChild(this.getChild(i).clone(true));
3085
- }
3086
- }
3181
+ cloneElementBase(this, clone);
3182
+ cloneChildren(this, clone, data);
3087
3183
  return clone;
3088
3184
  }
3089
3185
  static createElement() {
@@ -3279,9 +3375,8 @@ class DocumentElement extends BlockContainerElement {
3279
3375
  clone() {
3280
3376
  const clone = new DocumentElement();
3281
3377
  this.props.clone(clone.props);
3282
- for (let i = 0; i < this.length; i++) {
3283
- clone.addChild(this.getChild(i).clone(true));
3284
- }
3378
+ cloneElementBase(this, clone);
3379
+ cloneChildren(this, clone, true);
3285
3380
  return clone;
3286
3381
  }
3287
3382
  /**
@@ -3658,6 +3753,7 @@ class InlineGroupInputElement extends InlineGroupElement {
3658
3753
  }
3659
3754
  cloneSelf(data, constr) {
3660
3755
  const clone = new constr();
3756
+ cloneElementBase(this, clone);
3661
3757
  this.props['clone'](clone.props);
3662
3758
  //cloneFunc.apply(this, clone.props);
3663
3759
  if (data) {
@@ -3780,7 +3876,7 @@ class DataElementInlineGroup extends InlineGroupInputElement {
3780
3876
  const code = parser(this.props.expression);
3781
3877
  this.expressFn = new Function(`with(this){ ${code} }`);
3782
3878
  }
3783
- this.expressFn.bind(data.parser)();
3879
+ this.expressFn.bind(data.execute)();
3784
3880
  //this.expressFn();
3785
3881
  }
3786
3882
  catch (e) {
@@ -4074,11 +4170,8 @@ class DocumentBodyElement extends BlockContainerElement {
4074
4170
  }
4075
4171
  clone(data) {
4076
4172
  const clone = new DocumentBodyElement();
4077
- if (data) {
4078
- for (let i = 0; i < this.length; i++) {
4079
- clone.addChild(this.getChild(i).clone(true));
4080
- }
4081
- }
4173
+ cloneElementBase(this, clone);
4174
+ cloneChildren(this, clone, data);
4082
4175
  return clone;
4083
4176
  }
4084
4177
  beginMeasure(data) {
@@ -4128,11 +4221,8 @@ class DocumentFooterElement extends BlockContainerElement {
4128
4221
  }
4129
4222
  clone(data) {
4130
4223
  const clone = new DocumentFooterElement();
4131
- if (data) {
4132
- for (let i = 0; i < this.length; i++) {
4133
- clone.addChild(this.getChild(i).clone(true));
4134
- }
4135
- }
4224
+ cloneElementBase(this, clone);
4225
+ cloneChildren(this, clone, data);
4136
4226
  return clone;
4137
4227
  }
4138
4228
  beginMeasure(data) {
@@ -4208,11 +4298,8 @@ class DocumentHeaderElement extends BlockContainerElement {
4208
4298
  }
4209
4299
  clone(data) {
4210
4300
  const clone = new DocumentHeaderElement();
4211
- if (data) {
4212
- for (let i = 0; i < this.length; i++) {
4213
- clone.addChild(this.getChild(i).clone(true));
4214
- }
4215
- }
4301
+ cloneElementBase(this, clone);
4302
+ cloneChildren(this, clone, data);
4216
4303
  return clone;
4217
4304
  }
4218
4305
  switchEditMode(evt) {
@@ -4310,6 +4397,7 @@ class PSymbolElement extends LeafElement {
4310
4397
  clone() {
4311
4398
  const clone = new PSymbolElement();
4312
4399
  clone.defaultHeight = this.defaultHeight;
4400
+ cloneElementBase(this, clone);
4313
4401
  return clone;
4314
4402
  }
4315
4403
  getSelfLength(pure) {
@@ -4391,11 +4479,8 @@ class TableCellElement extends BlockContainerElement {
4391
4479
  clone(data) {
4392
4480
  const clone = new TableCellElement();
4393
4481
  this.props.clone(clone.props);
4394
- if (data) {
4395
- for (let i = 0; i < this.length; i++) {
4396
- clone.addChild(this.getChild(i).clone(true));
4397
- }
4398
- }
4482
+ cloneElementBase(this, clone);
4483
+ cloneChildren(this, clone, data);
4399
4484
  return clone;
4400
4485
  }
4401
4486
  getCellWidth() {
@@ -4703,6 +4788,7 @@ class TextGroupElement extends LeafElement {
4703
4788
  const clone = new TextGroupElement();
4704
4789
  this.props.clone(clone.props);
4705
4790
  clone.text = this.text;
4791
+ cloneElementBase(this, clone);
4706
4792
  return clone;
4707
4793
  }
4708
4794
  destroy() {
@@ -4767,6 +4853,8 @@ class TextGroupRenderObject extends LeafRenderObject {
4767
4853
  return;
4768
4854
  }
4769
4855
  const props = this.element.props;
4856
+ //基线位置到top的距离
4857
+ const actualFontBoundingBoxAscent = event.renderCtx.mainContext.getActualFontBoundingBoxAscent(props.getFont());
4770
4858
  let { width, height } = this.rect;
4771
4859
  let vertHeight = 0; //baseLine;
4772
4860
  if (props.vertAlign === 'subscript') {
@@ -4785,10 +4873,11 @@ class TextGroupRenderObject extends LeafRenderObject {
4785
4873
  return curr.actualSize + prev;
4786
4874
  }, this.rect.x);
4787
4875
  const x = arr.join(' ');
4788
- const y = this.rect.y + vertHeight; //this.textMeasures.map(item => this.rect.y + vertHeight).join(' ');
4789
- // const text = this.textMeasures.map(item => {
4790
- // return item.char
4791
- // }).join('');
4876
+ let y = this.rect.y + vertHeight;
4877
+ //基线处理
4878
+ y += actualFontBoundingBoxAscent ?? 0;
4879
+ //行高处理
4880
+ y += (height - props.fontSize) / 2;
4792
4881
  const t = {
4793
4882
  sel: 'text',
4794
4883
  text: text,
@@ -4796,8 +4885,6 @@ class TextGroupRenderObject extends LeafRenderObject {
4796
4885
  ns: "http://www.w3.org/2000/svg",
4797
4886
  attrs: {
4798
4887
  //"transform": `translate(0,${(height - props.fontSize) / 2})`,
4799
- "translate": { x: 0, y: (height - props.fontSize) / 2 },
4800
- 'dominant-baseline': 'hanging',
4801
4888
  'font-family': this.element.props.fontName,
4802
4889
  'font-size': fontSize,
4803
4890
  x,
@@ -4805,6 +4892,9 @@ class TextGroupRenderObject extends LeafRenderObject {
4805
4892
  }
4806
4893
  },
4807
4894
  };
4895
+ if (actualFontBoundingBoxAscent === undefined) {
4896
+ t.data.attrs['dominant-baseline'] = 'hanging';
4897
+ }
4808
4898
  if (this.element.props.fontWeight !== 'normal') {
4809
4899
  t.data.attrs['font-weight'] = this.element.props.fontWeight;
4810
4900
  }
@@ -6428,11 +6518,8 @@ class TableElement extends BlockContainerElement {
6428
6518
  clone(data) {
6429
6519
  const clone = new TableElement();
6430
6520
  this.props.clone(clone.props);
6431
- if (data) {
6432
- for (let i = 0; i < this.length; i++) {
6433
- clone.addChild(this.getChild(i).clone(true));
6434
- }
6435
- }
6521
+ cloneElementBase(this, clone);
6522
+ cloneChildren(this, clone, data);
6436
6523
  return clone;
6437
6524
  }
6438
6525
  createRenderObject() {
@@ -6721,6 +6808,7 @@ class CheckBoxElement extends LeafElement {
6721
6808
  }
6722
6809
  clone() {
6723
6810
  const clone = new CheckBoxElement();
6811
+ cloneElementBase(this, clone);
6724
6812
  this.props.clone(clone.props);
6725
6813
  return clone;
6726
6814
  }
@@ -6824,11 +6912,8 @@ class CommContentElement extends CommContentBaseElement {
6824
6912
  clone(data) {
6825
6913
  const clone = new CommContentElement();
6826
6914
  this.props.clone(clone.props);
6827
- if (data) {
6828
- for (let i = 0; i < this.length; i++) {
6829
- clone.addChild(this.getChild(i).clone(true));
6830
- }
6831
- }
6915
+ cloneElementBase(this, clone);
6916
+ cloneChildren(this, clone, data);
6832
6917
  return clone;
6833
6918
  }
6834
6919
  beginMeasure(data) {
@@ -7105,6 +7190,7 @@ class CommentElement extends LeafElement {
7105
7190
  clone() {
7106
7191
  const clone = new CommentElement();
7107
7192
  this.props.clone(clone.props);
7193
+ cloneElementBase(this, clone);
7108
7194
  return clone;
7109
7195
  }
7110
7196
  }
@@ -7254,11 +7340,8 @@ class ValidateElement extends CommContentBaseElement {
7254
7340
  clone(data) {
7255
7341
  const clone = new ValidateElement();
7256
7342
  this.props.clone(clone.props);
7257
- if (data) {
7258
- for (let i = 0; i < this.length; i++) {
7259
- clone.addChild(this.getChild(i).clone(true));
7260
- }
7261
- }
7343
+ cloneElementBase(this, clone);
7344
+ cloneChildren(this, clone, data);
7262
7345
  return clone;
7263
7346
  }
7264
7347
  setContent(content) {
@@ -8186,6 +8269,7 @@ class DataElementBarcode extends DataElementLeaf {
8186
8269
  clone(data) {
8187
8270
  const clone = new DataElementBarcode();
8188
8271
  this.props.clone(clone.props);
8272
+ cloneElementBase(this, clone);
8189
8273
  return clone;
8190
8274
  }
8191
8275
  setValue(val) {
@@ -8339,6 +8423,7 @@ class DataElementCheck extends DataElementLeaf {
8339
8423
  clone(data) {
8340
8424
  const clone = new DataElementCheck();
8341
8425
  this.props.clone(clone.props);
8426
+ cloneElementBase(this, clone);
8342
8427
  return clone;
8343
8428
  }
8344
8429
  setValue(val) {
@@ -8709,6 +8794,7 @@ class DataElementImage extends DataElementLeaf {
8709
8794
  clone(data) {
8710
8795
  const clone = new DataElementImage();
8711
8796
  this.props.clone(clone.props);
8797
+ cloneElementBase(this, clone);
8712
8798
  return clone;
8713
8799
  }
8714
8800
  destroy() {
@@ -8960,7 +9046,7 @@ class BreakElement extends LeafElement {
8960
9046
  }
8961
9047
  clone() {
8962
9048
  const clone = new BreakElement();
8963
- //clone.renderCtx = this.renderCtx;
9049
+ cloneElementBase(this, clone);
8964
9050
  return clone;
8965
9051
  }
8966
9052
  }
@@ -9181,11 +9267,8 @@ class DocumentBodyPartElement extends BlockContainerElement {
9181
9267
  clone(data) {
9182
9268
  const clone = new DocumentBodyPartElement();
9183
9269
  clone.props.partId = this.props.partId;
9184
- if (data) {
9185
- for (let i = 0; i < this.length; i++) {
9186
- clone.addChild(this.getChild(i).clone(true));
9187
- }
9188
- }
9270
+ cloneElementBase(this, clone);
9271
+ cloneChildren(this, clone, data);
9189
9272
  return clone;
9190
9273
  }
9191
9274
  }
@@ -9283,6 +9366,7 @@ class DataElementMH extends DataElementLeaf {
9283
9366
  clone(data) {
9284
9367
  const element = new DataElementMH();
9285
9368
  this.props.clone(element.props);
9369
+ cloneElementBase(this, element);
9286
9370
  return element;
9287
9371
  }
9288
9372
  getCurrentLayoutItem() {
@@ -9528,6 +9612,152 @@ function renderMHHTML(event, element, isPaint, nodes = []) {
9528
9612
  }
9529
9613
  }
9530
9614
 
9615
+ const fontSize = 12;
9616
+ const verPadding = 2;
9617
+ /**
9618
+ * 恒牙牙位图
9619
+ */
9620
+ class PermanentTeethElement extends DataElementLeaf {
9621
+ constructor() {
9622
+ super('permanent-teeth');
9623
+ this.props = new PermanentTeethProps();
9624
+ this.props.topLeft = '';
9625
+ this.props.topRight = '';
9626
+ this.props.bottomLeft = '';
9627
+ this.props.bottomRight = '';
9628
+ }
9629
+ setValue(val) {
9630
+ if (typeof val === 'string' && val) {
9631
+ const items = val.split(';');
9632
+ if (items.length >= 4) {
9633
+ this.props.topLeft = items[0];
9634
+ this.props.topRight = items[1];
9635
+ this.props.bottomLeft = items[2];
9636
+ this.props.bottomRight = items[3];
9637
+ }
9638
+ }
9639
+ else if (typeof val === 'object') {
9640
+ this.props.topLeft = val?.topLeft ?? '';
9641
+ this.props.topRight = val?.topRight ?? '';
9642
+ this.props.bottomLeft = val?.bottomLeft ?? '';
9643
+ this.props.bottomRight = val?.bottomRight ?? '';
9644
+ }
9645
+ }
9646
+ getValue() {
9647
+ const { topLeft, topRight, bottomLeft, bottomRight } = this.props;
9648
+ return `${topLeft};${topRight};${bottomLeft};${bottomRight}`;
9649
+ }
9650
+ clone(data) {
9651
+ const clone = new PermanentTeethElement();
9652
+ clone.props = this.props.clone();
9653
+ cloneElementBase(this, clone);
9654
+ return clone;
9655
+ }
9656
+ createRenderObject(data) {
9657
+ const clone = new PermanentTeethRenderObject(this);
9658
+ clone.rect.width = 150;
9659
+ //字体大小*2+上下间距2*2
9660
+ clone.rect.height = fontSize * 2 + verPadding * 2;
9661
+ //clone.rect= ElementUtil.cloneRect(this.rect);
9662
+ return clone;
9663
+ }
9664
+ serialize(viewOptions) {
9665
+ return {
9666
+ type: this.type,
9667
+ props: this.props.getSerializeProps(viewOptions)
9668
+ };
9669
+ }
9670
+ }
9671
+ class PermanentTeethRenderObject extends LeafRenderObject {
9672
+ clone() {
9673
+ const clone = new PermanentTeethRenderObject(this.element);
9674
+ clone.rect = ElementUtil.cloneRect(this.rect);
9675
+ return clone;
9676
+ }
9677
+ // measure(): { width: number, height: number } {
9678
+ // const ele = this.element;
9679
+ //
9680
+ // }
9681
+ exportHTML(event) {
9682
+ const ele = this.element;
9683
+ const g = super.exportHTML(event);
9684
+ const contentHorPadding = 4;
9685
+ g.children = [];
9686
+ // g.children.push(ElementUtil.getFillSvgPath(`M 0 ${this.rect.height / 2} h${this.rect.width}`, '#000', 1));
9687
+ // g.children.push(ElementUtil.getFillSvgPath(`M ${this.rect.width / 2} 0 v${this.rect.height}`, '#000', 1));
9688
+ //
9689
+ g.children.push(ElementUtil.getFillSvgRect(0, this.rect.height / 2, this.rect.width, 1, '#000'));
9690
+ g.children.push(ElementUtil.getFillSvgRect(this.rect.width / 2, 0, 1, this.rect.height, '#000'));
9691
+ const getSvgText = (text, x, y) => {
9692
+ return {
9693
+ sel: 'text',
9694
+ text: text,
9695
+ data: {
9696
+ ns: "http://www.w3.org/2000/svg",
9697
+ attrs: {
9698
+ 'dominant-baseline': 'hanging',
9699
+ 'font-family': 'Arial',
9700
+ 'font-size': fontSize,
9701
+ x,
9702
+ y,
9703
+ }
9704
+ },
9705
+ };
9706
+ };
9707
+ const topLeftWidth = event.renderCtx.mainContext.measureTextWidth(ele.props.topLeft, {
9708
+ fontSize: fontSize,
9709
+ fontName: 'Arial'
9710
+ });
9711
+ const bottomLeftWidth = event.renderCtx.mainContext.measureTextWidth(ele.props.bottomLeft, {
9712
+ fontSize: fontSize,
9713
+ fontName: 'Arial'
9714
+ });
9715
+ g.children.push(getSvgText(ele.props.topLeft, this.rect.width / 2 - topLeftWidth - contentHorPadding, verPadding));
9716
+ g.children.push(getSvgText(ele.props.topRight, this.rect.width / 2 + contentHorPadding, verPadding));
9717
+ g.children.push(getSvgText(ele.props.bottomLeft, this.rect.width / 2 - bottomLeftWidth - contentHorPadding, this.rect.height - fontSize + verPadding));
9718
+ g.children.push(getSvgText(ele.props.bottomRight, this.rect.width / 2 + contentHorPadding, this.rect.height - fontSize + verPadding));
9719
+ return g;
9720
+ }
9721
+ }
9722
+ class PermanentTeethFactory extends ElementFactory {
9723
+ match(type) {
9724
+ return type === 'permanent-teeth';
9725
+ }
9726
+ createElement(data) {
9727
+ const ele = new PermanentTeethElement();
9728
+ ele.props.bottomLeft = data.props?.bottomLeft ?? '';
9729
+ ele.props.bottomRight = data.props?.bottomRight ?? '';
9730
+ ele.props.topLeft = data.props?.topLeft ?? '';
9731
+ ele.props.topRight = data.props?.topRight ?? '';
9732
+ return ele;
9733
+ }
9734
+ }
9735
+ /**
9736
+ * 恒牙牙位图属性
9737
+ */
9738
+ class PermanentTeethProps extends INotifyPropertyChanged {
9739
+ topLeft;
9740
+ topRight;
9741
+ bottomLeft;
9742
+ bottomRight;
9743
+ getSerializeProps(viewOptions) {
9744
+ return {
9745
+ topLeft: this.topLeft,
9746
+ topRight: this.topRight,
9747
+ bottomLeft: this.bottomLeft,
9748
+ bottomRight: this.bottomRight,
9749
+ };
9750
+ }
9751
+ clone(dest) {
9752
+ dest = dest || new PermanentTeethProps();
9753
+ dest.topLeft = this.topLeft;
9754
+ dest.topRight = this.topRight;
9755
+ dest.bottomLeft = this.bottomLeft;
9756
+ dest.bottomRight = this.bottomRight;
9757
+ return dest;
9758
+ }
9759
+ }
9760
+
9531
9761
  class PictureElement extends LeafElement {
9532
9762
  //props: PictureProps;
9533
9763
  status = 'no';
@@ -9556,6 +9786,7 @@ class PictureElement extends LeafElement {
9556
9786
  clone(data) {
9557
9787
  const clone = new PictureElement();
9558
9788
  this.props.clone(clone.props);
9789
+ cloneElementBase(this, clone);
9559
9790
  return clone;
9560
9791
  }
9561
9792
  destroy() {
@@ -9681,6 +9912,7 @@ class RadioBoxElement extends LeafElement {
9681
9912
  clone() {
9682
9913
  const clone = new RadioBoxElement();
9683
9914
  this.props.clone(clone.props);
9915
+ cloneElementBase(this, clone);
9684
9916
  return clone;
9685
9917
  }
9686
9918
  }
@@ -9732,7 +9964,7 @@ class PageBreakElement extends LeafElement {
9732
9964
  }
9733
9965
  clone() {
9734
9966
  const clone = new PageBreakElement();
9735
- //clone.renderCtx = this.renderCtx;
9967
+ cloneElementBase(this, clone);
9736
9968
  return clone;
9737
9969
  }
9738
9970
  }
@@ -9769,7 +10001,9 @@ class TabElement extends LeafElement {
9769
10001
  };
9770
10002
  }
9771
10003
  clone() {
9772
- return new TabElement();
10004
+ const clone = new TabElement();
10005
+ cloneElementBase(this, clone);
10006
+ return clone;
9773
10007
  }
9774
10008
  }
9775
10009
  class TabRenderObject extends LeafRenderObject {
@@ -10364,6 +10598,7 @@ class SVGElement extends LeafElement {
10364
10598
  clone(data) {
10365
10599
  const clone = new SVGElement();
10366
10600
  this.props.clone(clone.props);
10601
+ cloneElementBase(this, clone);
10367
10602
  return clone;
10368
10603
  }
10369
10604
  destroy() {
@@ -10490,6 +10725,9 @@ class ElementSerialize {
10490
10725
  if (element.props && element.props['__attachedProperty'] && !result.props['__attachedProperty']) {
10491
10726
  result.props['__attachedProperty'] = CommonUtil.cloneValue(element.props['__attachedProperty']);
10492
10727
  }
10728
+ if (element.attribute) {
10729
+ result['attribute'] = this.serializeAttribute(element);
10730
+ }
10493
10731
  return result;
10494
10732
  }
10495
10733
  static serializeString(element, options = { all: false }) {
@@ -10512,6 +10750,21 @@ class ElementSerialize {
10512
10750
  }
10513
10751
  return "";
10514
10752
  }
10753
+ static serializeAttribute(element) {
10754
+ if (element.attribute) {
10755
+ const result = {};
10756
+ for (const key in element.attribute) {
10757
+ if (element.attribute[key] !== undefined && element.attribute[key] !== null) {
10758
+ result[key] = element.attribute[key];
10759
+ }
10760
+ }
10761
+ if (Object.keys(result).length === 0) {
10762
+ return null;
10763
+ }
10764
+ return CommonUtil.cloneValue(result);
10765
+ }
10766
+ return null;
10767
+ }
10515
10768
  /**
10516
10769
  * 获取选中的结构
10517
10770
  * @param ss
@@ -10610,12 +10863,8 @@ class TrackRunElement extends InlineGroupElement {
10610
10863
  clone(data) {
10611
10864
  const clone = new TrackRunElement(this.type);
10612
10865
  this.props.clone(clone.props);
10613
- if (data) {
10614
- const length = this.length;
10615
- for (let i = 0; i < length; i++) {
10616
- clone.addChild(this.getChild(i).clone(true));
10617
- }
10618
- }
10866
+ cloneElementBase(this, clone);
10867
+ cloneChildren(this, clone, data);
10619
10868
  return clone;
10620
10869
  }
10621
10870
  createRenderObject(data) {
@@ -12499,6 +12748,26 @@ class ElementUtil {
12499
12748
  ss.resetRange(ele.getChild(ele.length - 2), -1);
12500
12749
  }
12501
12750
  }
12751
+ static setEleAttribute(ele, attr, value) {
12752
+ if (!ele.attribute) {
12753
+ ele.attribute = {};
12754
+ }
12755
+ if (ele.attribute[attr] === value) {
12756
+ return;
12757
+ }
12758
+ ele.attribute[attr] = value;
12759
+ }
12760
+ static getEleAttribute(ele, attr) {
12761
+ if (ele.attribute) {
12762
+ return ele.attribute[attr];
12763
+ }
12764
+ return undefined;
12765
+ }
12766
+ static removeEleAttribute(ele, attr) {
12767
+ if (ele.attribute) {
12768
+ delete ele.attribute[attr];
12769
+ }
12770
+ }
12502
12771
  }
12503
12772
 
12504
12773
  class RenderContext {
@@ -12573,7 +12842,18 @@ class PaintContent {
12573
12842
  this.init();
12574
12843
  }
12575
12844
  init() {
12576
- this.ctx.textBaseline = 'top';
12845
+ //this.ctx.textBaseline = 'top';
12846
+ }
12847
+ cacheFontBoundingBoxAscentMap = new Map();
12848
+ getActualFontBoundingBoxAscent(font) {
12849
+ if (this.cacheFontBoundingBoxAscentMap.has(font)) {
12850
+ return this.cacheFontBoundingBoxAscentMap.get(font);
12851
+ }
12852
+ this.ctx.font = font;
12853
+ const textMetrics = this.ctx.measureText('正');
12854
+ const value = textMetrics.actualBoundingBoxAscent;
12855
+ this.cacheFontBoundingBoxAscentMap.set(font, value);
12856
+ return value;
12577
12857
  }
12578
12858
  setGlobalAlpha(alpha) {
12579
12859
  this.ctx.globalAlpha = alpha;
@@ -13133,10 +13413,7 @@ class EditorContext {
13133
13413
  isDirty = false;
13134
13414
  cursorRect;
13135
13415
  _document;
13136
- //文档刷新的订阅事件
13137
- //refSub!: Subscription;
13138
13416
  syncRefresh;
13139
- //imageLoader: IImageLoader;
13140
13417
  dynamicFunc;
13141
13418
  docChange;
13142
13419
  clearPrevDocCb;
@@ -13190,6 +13467,7 @@ class EditorContext {
13190
13467
  //this.imageLoader.clear();
13191
13468
  this.dynamicFunc.destroyScripts();
13192
13469
  this.isDirty = false;
13470
+ //this.clearEleDepMaps();
13193
13471
  }
13194
13472
  get defaultCtx() {
13195
13473
  return new DocumentContext(this._document, this.selectionState);
@@ -13264,17 +13542,6 @@ class EditorContext {
13264
13542
  return this._document.modifyFlag === ModifyFlag$1.None ? 'appearance' : 'content';
13265
13543
  }
13266
13544
  }
13267
- // export interface IImageLoader {
13268
- // clear(): void;
13269
- //
13270
- // loadImage(src: string, onCallback: (status: ImgLoadStatus) => void): void;
13271
- //
13272
- // getImage(src: string): HTMLImageElement | undefined;
13273
- //
13274
- // imagesLoadCompleted(): boolean;
13275
- //
13276
- // getLoadTasks(): Array<Promise<void>>;
13277
- // }
13278
13545
  /**
13279
13546
  * 文档上下文
13280
13547
  */
@@ -13537,13 +13804,23 @@ class DocumentContext {
13537
13804
  }
13538
13805
  }
13539
13806
 
13540
- class DynamicContextParser {
13807
+ class DynamicExecute {
13541
13808
  doc;
13542
13809
  ss;
13810
+ current;
13811
+ depItems;
13543
13812
  constructor(doc, ss) {
13544
13813
  this.doc = doc;
13545
13814
  this.ss = ss;
13546
13815
  }
13816
+ setCurrentCtx(ele, depItems) {
13817
+ this.current = ele;
13818
+ this.depItems = depItems;
13819
+ }
13820
+ clearCurrentCtx() {
13821
+ this.current = undefined;
13822
+ this.depItems = undefined;
13823
+ }
13547
13824
  cacheList;
13548
13825
  getControlById(id) {
13549
13826
  if (!this.cacheList) {
@@ -13555,6 +13832,10 @@ class DynamicContextParser {
13555
13832
  //return this.cacheList.find(item => item['props']['id'] === id);
13556
13833
  }
13557
13834
  getObject(id) {
13835
+ //如果当前存在编译缓存,则直接从缓存中获取
13836
+ if (this.depItems && this.depItems.has(id)) {
13837
+ return this.depItems.get(id);
13838
+ }
13558
13839
  new DocumentContext(this.doc, this.ss);
13559
13840
  if (id.startsWith('$')) {
13560
13841
  id = id.slice(1);
@@ -13573,6 +13854,9 @@ class DynamicContextParser {
13573
13854
  if (control) {
13574
13855
  control.setValue(val);
13575
13856
  }
13857
+ },
13858
+ get ref() {
13859
+ return control;
13576
13860
  }
13577
13861
  };
13578
13862
  }
@@ -13644,9 +13928,12 @@ class DynamicContextParser {
13644
13928
  class ParagraphMeasure {
13645
13929
  options;
13646
13930
  renderCtx;
13647
- constructor(options, renderCtx) {
13931
+ execute;
13932
+ constructor(options, renderCtx, execute) {
13648
13933
  this.options = options;
13649
13934
  this.renderCtx = renderCtx;
13935
+ this.execute = execute;
13936
+ this.execute = execute;
13650
13937
  }
13651
13938
  /**
13652
13939
  * 段落排版:
@@ -13742,7 +14029,10 @@ class ParagraphMeasure {
13742
14029
  const paraRenders = [];
13743
14030
  for (let i = 0; i < paraModels.length; i++) {
13744
14031
  const innerLineRects = paraModels[i].innerLine;
13745
- let render = p.createRenderObject();
14032
+ let render = this.createRenderObject(p);
14033
+ if (!render) {
14034
+ return [];
14035
+ }
13746
14036
  render.setRenderWidth(limitWidth);
13747
14037
  paraRenders.push(render);
13748
14038
  for (let j = 0; j < innerLineRects.length; j++) {
@@ -13883,7 +14173,7 @@ class ParagraphMeasure {
13883
14173
  }
13884
14174
  arrangeInlineGroupElement(parentLine, ele) {
13885
14175
  const { options, renderCtx } = this;
13886
- let render = ele.createRenderObject({ options, renderCtx });
14176
+ let render = this.createRenderObject(ele);
13887
14177
  //记录多行情况下的渲染对象,用于计算总长度,生成fill-null-space
13888
14178
  const inlineGroupRenders = [];
13889
14179
  ele.cacheRender = render;
@@ -13937,10 +14227,7 @@ class ParagraphMeasure {
13937
14227
  const baseTextProps = ele.props;
13938
14228
  nullText.text = baseTextProps.nullText;
13939
14229
  baseTextProps.nullTextProps.clone(nullText.props);
13940
- const nullTextRender = nullText.createRenderObject({
13941
- options: this.options,
13942
- renderCtx: this.renderCtx
13943
- });
14230
+ const nullTextRender = this.createRenderObject(nullText);
13944
14231
  //inlineGroupRender.insertChild(nullTextRender, 1);
13945
14232
  this.arrangeLeafRender(data, nullTextRender);
13946
14233
  }
@@ -13969,7 +14256,7 @@ class ParagraphMeasure {
13969
14256
  }
13970
14257
  }
13971
14258
  arrangeLeafElement(parentLine, ele) {
13972
- ele.cacheRender = ele.createRenderObject({ options: this.options, renderCtx: this.renderCtx });
14259
+ ele.cacheRender = this.createRenderObject(ele);
13973
14260
  if (ele.cacheRender) {
13974
14261
  this.arrangeLeafRender(parentLine, ele.cacheRender);
13975
14262
  }
@@ -14166,6 +14453,80 @@ class ParagraphMeasure {
14166
14453
  }
14167
14454
  throw new Error('未到达计算位置');
14168
14455
  }
14456
+ /**
14457
+ * 解析可见性表达式
14458
+ * @param ele
14459
+ * @param execute
14460
+ * @private
14461
+ */
14462
+ parseVisibleExpression(ele, execute) {
14463
+ if (ele.visibleExpr)
14464
+ return;
14465
+ if (!ele.attribute?.visibleExpr)
14466
+ return;
14467
+ const reactiveMode = this.renderCtx.drawMode !== 'print';
14468
+ try {
14469
+ const depIdItems = [];
14470
+ const depEleMap = new Map();
14471
+ let compliedCode = parser(ele.attribute?.visibleExpr, depIdItems);
14472
+ compliedCode = addReturn(compliedCode);
14473
+ if (depIdItems.length) {
14474
+ depIdItems.forEach(dep => {
14475
+ const refCtx = execute.getObject(dep);
14476
+ if (refCtx.ref) {
14477
+ const refEle = refCtx.ref.item;
14478
+ depEleMap.set(dep, refCtx);
14479
+ //当前有可能是checkbox数组
14480
+ const refEles = Array.isArray(refEle) ? refEle : [refEle];
14481
+ reactiveMode && refEles.forEach(item => {
14482
+ //求值依赖元素更改的时候,发布当前元素重新计算的指令
14483
+ item.onChangeSubject.subscribe(() => {
14484
+ ele.pubOnChange('self');
14485
+ });
14486
+ });
14487
+ }
14488
+ });
14489
+ }
14490
+ ele.visibleExpr = { compliedCode, func: new Function(`with(this){ ${compliedCode} }`), depItems: depEleMap };
14491
+ }
14492
+ catch (e) {
14493
+ console.error('解析表达式出错', ele.attribute?.visibleExpr);
14494
+ }
14495
+ }
14496
+ /**
14497
+ * 元素可见行求值
14498
+ * @param ele
14499
+ * @param executeCtx
14500
+ * @private
14501
+ */
14502
+ evalVisibleExpr(ele, executeCtx) {
14503
+ if (ele.visibleExpr && ele.visibleExpr.func) {
14504
+ try {
14505
+ executeCtx.setCurrentCtx(ele, ele.visibleExpr.depItems);
14506
+ const func = ele.visibleExpr.func.bind(executeCtx);
14507
+ return func() === true;
14508
+ }
14509
+ catch (e) {
14510
+ console.error(e, "表达式执行出错", ele.visibleExpr.compliedCode);
14511
+ }
14512
+ finally {
14513
+ executeCtx.clearCurrentCtx();
14514
+ }
14515
+ }
14516
+ return true;
14517
+ }
14518
+ createRenderObject(element) {
14519
+ if (this.options.enableVisibleExpression) {
14520
+ this.parseVisibleExpression(element, this.execute);
14521
+ if (!this.evalVisibleExpr(element, this.execute)) {
14522
+ return null;
14523
+ }
14524
+ }
14525
+ return element.createRenderObject({
14526
+ options: this.options,
14527
+ renderCtx: this.renderCtx
14528
+ });
14529
+ }
14169
14530
  }
14170
14531
 
14171
14532
  /**
@@ -14297,6 +14658,8 @@ class DocumentArrange {
14297
14658
  renderCtx;
14298
14659
  seo;
14299
14660
  options;
14661
+ execute;
14662
+ pMeasure;
14300
14663
  constructor(docCtx, renderCtx, seo) {
14301
14664
  this.docCtx = docCtx;
14302
14665
  this.renderCtx = renderCtx;
@@ -14316,10 +14679,12 @@ class DocumentArrange {
14316
14679
  //测量阶段,对于空段落会插入段落符号,新表格会插入空段落,此时不需要记录节点的更改,以最大的节点进行记录
14317
14680
  return suppressTracking(() => {
14318
14681
  const doc = this.docCtx.document;
14682
+ this.execute = new DynamicExecute(doc, this.docCtx.selectionState);
14683
+ this.pMeasure = new ParagraphMeasure(this.options, this.renderCtx, this.execute);
14319
14684
  const data = {
14320
14685
  doc,
14321
14686
  viewOptions: this.options,
14322
- parser: new DynamicContextParser(doc, this.docCtx.selectionState),
14687
+ execute: this.execute,
14323
14688
  createParaFn: () => this.createDefaultPara()
14324
14689
  };
14325
14690
  doc.clearMarkItems();
@@ -14435,15 +14800,6 @@ class DocumentArrange {
14435
14800
  cloneFooterRender.rect.x = limitRect.x;
14436
14801
  cloneFooterRender.rect.y = documentRender.rect.height - bodyMarginBottom;
14437
14802
  currColumn === 0 && documentRender.addChild(cloneFooterRender);
14438
- // //审阅模式,添加审阅窗口
14439
- // if (this.options.showReviewWindow && commentsRender) {
14440
- // const commentsContainer = this.createRenderObject(commentsRender.element) as CommsContainerRenderObject;
14441
- // commentsContainer.padding.top = bodyMarginTop;
14442
- // commentsContainer.rect.height = documentRender.rect.height;
14443
- // documentRender.addChild(commentsContainer);
14444
- // commentsContainer.rect.x = documentRender.rect.x + documentRender.rect.width;
14445
- // documentRender.rect.width += this.options.reviewWindowWidth;
14446
- // }
14447
14803
  currColumn++;
14448
14804
  if (currColumn === docColumns) {
14449
14805
  currColumn = 0;
@@ -14454,7 +14810,7 @@ class DocumentArrange {
14454
14810
  return docPages;
14455
14811
  }
14456
14812
  createEmptyBodyRender(bodyRender, limitRect) {
14457
- const pageBodyRender = this.createRenderObject(bodyRender.element);
14813
+ const pageBodyRender = this.pMeasure.createRenderObject(bodyRender.element);
14458
14814
  pageBodyRender.rect.width = limitRect.width;
14459
14815
  const bodyInnerLimitRect = pageBodyRender.getInnerRect();
14460
14816
  if (this.options.fullPageView) {
@@ -14470,12 +14826,11 @@ class DocumentArrange {
14470
14826
  return element.cacheRender;
14471
14827
  }
14472
14828
  if (element instanceof BlockContentElement) {
14473
- const pRange = new ParagraphMeasure(this.options, this.renderCtx);
14474
- return pRange.measureParagraph(element, maxWidth);
14829
+ return this.pMeasure.measureParagraph(element, maxWidth);
14475
14830
  }
14476
14831
  else if (element instanceof BlockContainerElement) {
14477
14832
  const renders = [];
14478
- let render = this.createRenderObject(element);
14833
+ let render = this.pMeasure.createRenderObject(element);
14479
14834
  if (!render) {
14480
14835
  element.cacheRender = null;
14481
14836
  return null;
@@ -14488,8 +14843,8 @@ class DocumentArrange {
14488
14843
  const innerMaxWidth = render.getInnerMaxWidth();
14489
14844
  for (let i = 0; i < element.length; i++) {
14490
14845
  const child = element.getChild(i);
14491
- const blockContentELement = child;
14492
- const childRender = this.measureControl(blockContentELement, innerMaxWidth);
14846
+ const blockContentElement = child;
14847
+ const childRender = this.measureControl(blockContentElement, innerMaxWidth);
14493
14848
  if (!childRender) {
14494
14849
  continue;
14495
14850
  }
@@ -14499,7 +14854,7 @@ class DocumentArrange {
14499
14854
  }
14500
14855
  for (let j = 0; j < childRender.length; j++) {
14501
14856
  if (j > 0) {
14502
- render = this.createRenderObject(element);
14857
+ render = this.pMeasure.createRenderObject(element);
14503
14858
  if (!render.rect.width) {
14504
14859
  render.setRenderWidth(maxWidth);
14505
14860
  }
@@ -14527,12 +14882,6 @@ class DocumentArrange {
14527
14882
  textLineRenderMode(cacheRender, { options: this.options, renderCtx: this.renderCtx });
14528
14883
  }
14529
14884
  }
14530
- createRenderObject(element) {
14531
- return element.createRenderObject({
14532
- options: this.options,
14533
- renderCtx: this.renderCtx
14534
- });
14535
- }
14536
14885
  getDocInnerRect(documentRender) {
14537
14886
  const render = documentRender.element.createRenderObject();
14538
14887
  render.padding = documentRender.padding;
@@ -14551,7 +14900,7 @@ class DocumentArrange {
14551
14900
  if (render instanceof TableRenderObject) {
14552
14901
  return this.cutTable(render, limitHeight);
14553
14902
  }
14554
- const cloneRender = this.createRenderObject(render.element);
14903
+ const cloneRender = this.pMeasure.createRenderObject(render.element);
14555
14904
  cloneRender.setRenderWidth(render.rect.width);
14556
14905
  if (render instanceof MuiltBlockLineRenderObject) {
14557
14906
  let sumHeight = 0;
@@ -14728,7 +15077,7 @@ class DocumentArrange {
14728
15077
  for (let i = 0; i < cutCellRenders.length; i++) {
14729
15078
  let cellRender = cutCellRenders[i];
14730
15079
  if (!cellRender) {
14731
- cellRender = this.createRenderObject(cellRenders[i].element);
15080
+ cellRender = this.pMeasure.createRenderObject(cellRenders[i].element);
14732
15081
  cellRender.rect = ElementUtil.cloneRect(cellRenders[i].rect);
14733
15082
  cellRender.rect.height = 0;
14734
15083
  ElementUtil.remeasure(cellRender);
@@ -14844,647 +15193,18 @@ class DocumentArrange {
14844
15193
  return -1;
14845
15194
  }
14846
15195
  getHeaderRows(tb) {
14847
- const rows = [];
14848
- for (let i = 0; i < tb.length; i++) {
14849
- const rowRender = tb.getChild(i);
14850
- const rowEle = rowRender.element;
14851
- if (rowEle.props.headerRow) {
14852
- rows.push(rowRender);
14853
- }
14854
- else {
14855
- break;
14856
- }
14857
- }
14858
- return rows;
14859
- }
14860
- /**
14861
- * 修改测量完毕后的元素状态
14862
- * @param ele
14863
- */
14864
- setMeasureCompletedModifyFlag(ele) {
14865
- if (ele instanceof BranchElement) {
14866
- for (let i = 0; i < ele.length; i++) {
14867
- this.setMeasureCompletedModifyFlag(ele.getChild(i));
14868
- }
14869
- }
14870
- ele.modifyFlag = ModifyFlag$1.None;
14871
- if (!ele.loaded) {
14872
- ele.loaded = true;
14873
- }
14874
- }
14875
- clearPaintCache(ele, data) {
14876
- ele.beginMeasure(data);
14877
- this.identifyComment(ele);
14878
- if (ele instanceof BranchElement) {
14879
- for (let i = 0; i < ele.length; i++) {
14880
- this.clearPaintCache(ele.getChild(i), data);
14881
- }
14882
- }
14883
- }
14884
- identifyComment(ele) {
14885
- if (ele instanceof CommentElement) {
14886
- this.docCtx.document.identifyCommMark(ele);
14887
- }
14888
- }
14889
- cacheDoc;
14890
- cacheDocRenders(docs) {
14891
- docs.forEach(doc => {
14892
- this.cacheDoc = doc;
14893
- this.cacheRenders(doc);
14894
- });
14895
- this.cacheDoc = null;
14896
- }
14897
- /**
14898
- * 生成批注区间信息
14899
- * @param renderTree
14900
- */
14901
- generateCommRange() {
14902
- this.seo.commRangeSets.clear();
14903
- const commMarks = this.docCtx.document.markPairs;
14904
- for (let i = 0; i < commMarks.length; i++) {
14905
- const commMark = commMarks[i];
14906
- if (commMark.start && commMark.end) {
14907
- const ancestor = DocumentSelection.getAncestorCommonControl(commMark.start, commMark.end);
14908
- const range = RangeUtil.getSectionRange(commMark.start, 0, commMark.end, 1, ancestor);
14909
- SelectionOverlays.addToCommentSets(range, this.seo.commRangeSets, commMark.start.color);
14910
- }
14911
- }
14912
- }
14913
- cacheRenders(renderTree) {
14914
- if (renderTree.element) {
14915
- renderTree.element.paintRenders.push(renderTree);
14916
- }
14917
- for (let i = 0; i < renderTree.length; i++) {
14918
- const currRender = renderTree.getChild(i);
14919
- if (currRender.element) {
14920
- this.cacheCommsRender(currRender);
14921
- }
14922
- if (currRender instanceof BranchRenderObject) {
14923
- this.cacheRenders(currRender);
14924
- }
14925
- else {
14926
- currRender.element && currRender.element.paintRenders.push(currRender);
14927
- }
14928
- }
14929
- }
14930
- /**
14931
- * 缓存批注标志
14932
- * @private
14933
- */
14934
- cacheCommsRender(render) {
14935
- if (render.element && render.element.type === 'comm') {
14936
- const commElement = render.element;
14937
- if (commElement.props.markType === 'start') {
14938
- const currDocRender = this.cacheDoc;
14939
- const docCommContainer = currDocRender.getItems().find(item => item instanceof CommsContainerRenderObject);
14940
- if (docCommContainer) {
14941
- docCommContainer.commsMarks.push(render);
14942
- }
14943
- }
14944
- }
14945
- if (render.element && render.element.type === 'comm-list') {
14946
- const commContainer = render;
14947
- CommentsUtil.createCommentsImage(commContainer);
14948
- }
14949
- }
14950
- endMeasures(ele) {
14951
- ele.endMeasure();
14952
- if (ele instanceof BranchElement) {
14953
- for (let i = 0; i < ele.length; i++) {
14954
- this.endMeasures(ele.getChild(i));
14955
- }
14956
- }
14957
- }
14958
- createDefaultPara() {
14959
- const tmp = new ParagraphElement();
14960
- tmp.props.lineHeight = this.options.defaultLineHeight;
14961
- return tmp;
14962
- }
14963
- }
14964
-
14965
- /**
14966
- * 文字行渲染模式
14967
- 用于医嘱打印模式
14968
- */
14969
- function runTextLineRender(ele, data) {
14970
- if (!data.options.textRowLineMode) {
14971
- return;
14972
- }
14973
- if (ele instanceof TableElement) {
14974
- // textLineRenderMode(ele, data);
14975
- // remeasureParentRenders(ele.cacheRender)
14976
- return;
14977
- }
14978
- if (ele instanceof BranchElement) {
14979
- for (let i = 0; i < ele.length; i++) {
14980
- runTextLineRender(ele.getChild(i), data);
14981
- }
14982
- }
14983
- }
14984
-
14985
- /**
14986
- * 测量阶段,生成Render-UI
14987
- */
14988
- class ElementMeasure {
14989
- docCtx;
14990
- renderCtx;
14991
- options;
14992
- constructor(docCtx, renderCtx) {
14993
- this.docCtx = docCtx;
14994
- this.renderCtx = renderCtx;
14995
- this.options = docCtx.viewOptions;
14996
- }
14997
- measureDocument(document) {
14998
- //测量阶段,对于空段落会插入段落符号,新表格会插入空段落,此时不需要记录节点的更改,以最大的节点进行记录
14999
- return suppressTracking(() => {
15000
- this.clearPaintCache(document, {
15001
- doc: document,
15002
- viewOptions: this.options,
15003
- parser: new DynamicContextParser(document, this.docCtx.selectionState),
15004
- createParaFn: () => new ParagraphElement()
15005
- });
15006
- const docRender = this.measureControl(document, this.options.docPageSettings.width);
15007
- this.setMeasureCompletedModifyFlag(document);
15008
- runTextLineRender(document, { options: this.options, renderCtx: this.renderCtx });
15009
- return docRender;
15010
- });
15011
- }
15012
- measureControl(element, maxWidth) {
15013
- if (element.modifyFlag === ModifyFlag$1.None) {
15014
- return element.cacheRender;
15015
- }
15016
- if (element instanceof BlockContentElement) {
15017
- const render = element.createRenderObject({ options: this.options, renderCtx: this.renderCtx });
15018
- element.cacheRender = render;
15019
- //测量阶段,只限制最大宽度即可
15020
- render.setRenderWidth(maxWidth);
15021
- if (element instanceof ParagraphElement) {
15022
- this.measureParagraph(element, render);
15023
- }
15024
- else {
15025
- throw new Error('未实现');
15026
- }
15027
- return render;
15028
- }
15029
- else if (element instanceof BlockContainerElement) {
15030
- //ElementUtil.fixBlockContainer(element);
15031
- let render = null;
15032
- if (element.modifyFlag === ModifyFlag$1.Modify || element.modifyFlag === ModifyFlag$1.Track) {
15033
- //ElementUtil.fixBlockContainer(element);
15034
- element.cacheRender = null;
15035
- render = element.createRenderObject({ options: this.options, renderCtx: this.renderCtx });
15036
- if (!render) {
15037
- element.cacheRender = null;
15038
- return null;
15039
- }
15040
- if (!render.rect.width) {
15041
- render.setRenderWidth(maxWidth);
15042
- }
15043
- }
15044
- if (!render) {
15045
- throw new Error('render is null');
15046
- }
15047
- element.cacheRender = render;
15048
- const innerMaxWidth = render.getInnerMaxWidth();
15049
- for (let i = 0; i < element.length; i++) {
15050
- const child = element.getChild(i);
15051
- const blockContentELement = child;
15052
- const childRender = this.measureControl(blockContentELement, innerMaxWidth);
15053
- if (!childRender) {
15054
- continue;
15055
- }
15056
- render.addChild(childRender);
15057
- }
15058
- ElementUtil.remeasure(render);
15059
- return render;
15060
- }
15061
- else {
15062
- throw new Error('未实现');
15063
- }
15064
- }
15065
- /**
15066
- * 生成段落 UI 树
15067
- * @param para
15068
- * @param render
15069
- */
15070
- measureParagraph(para, render) {
15071
- ElementUtil.fixParagraphContent(para);
15072
- const renderObjects = [];
15073
- for (let i = 0; i < para.length; i++) {
15074
- const child = para.getChild(i);
15075
- if (child instanceof InlineGroupElement) {
15076
- child.cacheRender = this.getInlineGroupRenderItem(child);
15077
- if (child.cacheRender) {
15078
- renderObjects.push(child.cacheRender);
15079
- }
15080
- }
15081
- else if (child instanceof LeafElement) {
15082
- child.cacheRender = child.createRenderObject({ options: this.options, renderCtx: this.renderCtx });
15083
- if (child.cacheRender) {
15084
- renderObjects.push(child.cacheRender);
15085
- }
15086
- }
15087
- }
15088
- this.measureInnerParagraph(render, para, renderObjects);
15089
- }
15090
- /**
15091
- * 根据段落UI元素,进行排列
15092
- * @param render
15093
- * @param paragraph
15094
- * @param renderObjects
15095
- */
15096
- measureInnerParagraph(render, paragraph, renderObjects) {
15097
- return;
15098
- // let lineRect = render.createLineRect();
15099
- // let maxLineWidth=render.rect.width;
15100
- // //行内框
15101
- // const innerLineRects: Array<ParagraphLineRectRenderObject> = [];
15102
- // const addInnerLineFunc = (lineRect: ParagraphLineRectRenderObject): void => {
15103
- // maxLineWidth=render.rect.width;
15104
- // innerLineRects.push(lineRect);
15105
- // if (innerLineRects.indexOf(lineRect) === 0) {
15106
- // if (paragraph.props.indent > 0) {
15107
- // maxLineWidth -= paragraph.props.indent;
15108
- // }
15109
- // } else {
15110
- // maxLineWidth -= paragraph.props.hanging;
15111
- // }
15112
- // };
15113
- // addInnerLineFunc(lineRect);
15114
- // let i = 0;
15115
- // let currItem = renderObjects[i++];
15116
- // const inCloseBody = paragraph.parent.type === 'body';
15117
- // while (currItem) {
15118
- // const maxWidth = maxLineWidth;
15119
- // const nextItem = renderObjects[i];
15120
- // const {
15121
- // firstItem,
15122
- // lastItem,
15123
- // br
15124
- // } = this.cutRenderItem(currItem, nextItem, maxWidth - lineRect.rect.width, lineRect.length === 0, inCloseBody);
15125
- // if (firstItem) {
15126
- // if (lastItem) {
15127
- // renderObjects.splice(i, 0, lastItem);
15128
- // }
15129
- // currItem = firstItem;
15130
- // } else {
15131
- // lineRect = render.createLineRect();
15132
- // addInnerLineFunc(lineRect);
15133
- // continue;
15134
- // }
15135
- // lineRect.addChild(currItem);
15136
- // currItem.rect.x = lineRect.rect.width;
15137
- // if (currItem.rect.height > lineRect.rect.height) {
15138
- // lineRect.rect.height = currItem.rect.height;
15139
- // }
15140
- // lineRect.rect.width += currItem.rect.width;
15141
- // if (br) {
15142
- // //lineRect.rect.maxWidth = lineRect.rect.width;
15143
- // lineRect = render.createLineRect();
15144
- // addInnerLineFunc(lineRect);
15145
- // }
15146
- // currItem = renderObjects[i++];
15147
- // }
15148
- // for (let i = 0; i < innerLineRects.length; i++) {
15149
- // const innerLineRect = innerLineRects[i] as ParagraphLineRectRenderObject;
15150
- // innerLineRect.rect.x = this.getParaLineRectStartX(innerLineRects.length, i, paragraph, render, innerLineRect);
15151
- // //限制最大行高
15152
- // const maxLineHeight = paragraph.props.lineHeight !== this.options.defaultLineHeight ? 100 : Math.floor(14 * 2);
15153
- // //fillLineHeight填充行高
15154
- // let fillLineHeight = Math.ceil(innerLineRect.rect.height * (paragraph.props.lineHeight - 1));
15155
- // fillLineHeight = fillLineHeight > maxLineHeight ? maxLineHeight : fillLineHeight;
15156
- // const lineHeight = innerLineRect.rect.height + fillLineHeight;
15157
- // const paddingBottom = Math.ceil(fillLineHeight / 2);
15158
- // innerLineRect.rect.height = lineHeight;
15159
- // for (let j = 0; j < innerLineRect.length; j++) {
15160
- // const leaf = innerLineRect.getChild(j);
15161
- // leaf.rect.y = innerLineRect.rect.height - paddingBottom - leaf.rect.height;
15162
- // }
15163
- // //render.rect.height += lineRect.rect.height;
15164
- // const outterLineRect = render.createLineRect();
15165
- // outterLineRect.rect.width = render.rect.width;
15166
- // outterLineRect.addChild(innerLineRect);
15167
- // ElementUtil.remeasure(outterLineRect, false);
15168
- // render.addChild(outterLineRect);
15169
- // }
15170
- // ElementUtil.remeasure(render);
15171
- }
15172
- /**
15173
- * 获取段落行布局横向坐标起始位置,被段落text-align影响
15174
- */
15175
- getParaLineRectStartX(counter, paraLineIndex, paraElement, paraRenderObject, paraLineRender) {
15176
- //左对齐,首行缩进
15177
- let indent = paraElement.props.indent;
15178
- //存在项目符号
15179
- if (paraLineIndex > 0) {
15180
- indent = paraElement.props.hanging;
15181
- }
15182
- if (paraElement.props.textAlign === 'center') {
15183
- const remainSpace = paraRenderObject.rect.width - paraLineRender.rect.width;
15184
- return Math.ceil(remainSpace / 2) + indent;
15185
- }
15186
- else if (paraElement.props.textAlign === 'right') {
15187
- const remainSpace = paraRenderObject.rect.width - paraLineRender.rect.width;
15188
- return remainSpace + indent;
15189
- }
15190
- else if (paraElement.props.textAlign === 'justify') {
15191
- const renderUnitCount = this.getRenderUnitLength(paraLineRender);
15192
- if (paraLineIndex === counter - 1 || renderUnitCount === 1) {
15193
- return indent;
15194
- }
15195
- const spaceWidth = (paraRenderObject.rect.width - paraLineRender.rect.width) / (renderUnitCount - 1);
15196
- this.setAlignJustify(paraLineRender, 0, spaceWidth);
15197
- return indent;
15198
- }
15199
- else {
15200
- return indent;
15201
- }
15202
- }
15203
- /**
15204
- * 设置两端对齐
15205
- * @param render
15206
- * @param count
15207
- * @param spaceWidth
15208
- */
15209
- setAlignJustify(render, count, spaceWidth) {
15210
- if (render instanceof BranchRenderObject) {
15211
- let width = 0;
15212
- for (let i = 0; i < render.length; i++) {
15213
- const currRender = render.getChild(i);
15214
- count += this.setAlignJustify(currRender, count, spaceWidth);
15215
- currRender.rect.x = width;
15216
- width += currRender.rect.width;
15217
- }
15218
- render.rect.width = width;
15219
- }
15220
- else if (render instanceof LeafRenderObject) {
15221
- if (render instanceof TextGroupRenderObject) {
15222
- let i = count === 0 ? 1 : 0;
15223
- for (; i < render.textMeasures.length; i++) {
15224
- render.textMeasures[i].actualSize = render.textMeasures[i].actualSize + spaceWidth;
15225
- }
15226
- render.measure();
15227
- count += render.textMeasures.length;
15228
- }
15229
- else {
15230
- if (count !== 0) {
15231
- render.rect.width += spaceWidth;
15232
- }
15233
- count += 1;
15234
- }
15235
- }
15236
- return count;
15237
- }
15238
- /**
15239
- * 获取段落行渲染单位个数,字符需要计算为字符长度
15240
- */
15241
- getRenderUnitLength(paraLine) {
15242
- if (paraLine instanceof LeafRenderObject) {
15243
- if (paraLine instanceof TextGroupRenderObject) {
15244
- return paraLine.textMeasures.length;
15245
- }
15246
- else {
15247
- return 1;
15248
- }
15249
- }
15250
- else if (paraLine instanceof BranchRenderObject) {
15251
- let count = 0;
15252
- for (let i = 0; i < paraLine.length; i++) {
15253
- count += this.getRenderUnitLength(paraLine.getChild(i));
15254
- }
15255
- return count;
15256
- }
15257
- throw new Error('未到达计算位置');
15258
- }
15259
- getInlineGroupRenderItem(item) {
15260
- const inlineGroupRender = item.createRenderObject({ options: this.options, renderCtx: this.renderCtx });
15261
- if (!inlineGroupRender) {
15262
- return null;
15263
- }
15264
- for (let i = 0; i < item.length; i++) {
15265
- const child = item.getChild(i);
15266
- if (child instanceof LeafElement) {
15267
- child.cacheRender = child.createRenderObject({ options: this.options, renderCtx: this.renderCtx });
15268
- if (child.cacheRender) {
15269
- inlineGroupRender.addChild(child.cacheRender);
15270
- }
15271
- }
15272
- else if (child instanceof InlineGroupElement) {
15273
- item.cacheRender = this.getInlineGroupRenderItem(child);
15274
- if (item.cacheRender) {
15275
- inlineGroupRender.addChild(item.cacheRender);
15276
- }
15277
- }
15278
- else {
15279
- throw new Error('未实现');
15280
- }
15281
- }
15282
- ElementUtil.remeasureInlineGroupRender(inlineGroupRender);
15283
- //限制最小长度
15284
- if (item instanceof DataElementInlineGroup) {
15285
- //需要填充null-text
15286
- if (item.length === 2) {
15287
- const nullText = new TextGroupElement();
15288
- nullText.isDecorate = true;
15289
- nullText.disableClick = true;
15290
- const baseTextProps = item.props;
15291
- nullText.text = baseTextProps.nullText;
15292
- baseTextProps.nullTextProps.clone(nullText.props);
15293
- const nullTextRender = nullText.createRenderObject({ options: this.options, renderCtx: this.renderCtx });
15294
- inlineGroupRender.insertChild(nullTextRender, 1);
15295
- ElementUtil.remeasureInlineGroupRender(inlineGroupRender);
15296
- }
15297
- const props = item.props;
15298
- let minLength = props.minLength ?? 14;
15299
- minLength = minLength < 14 ? 14 : minLength;
15300
- if (item instanceof DataElementInlineGroup && inlineGroupRender.rect.width < minLength) {
15301
- const fillNullSpace = new FillNullSpaceRenderObject();
15302
- fillNullSpace.rect.width = minLength - inlineGroupRender.rect.width;
15303
- fillNullSpace.rect.height = inlineGroupRender.rect.height;
15304
- inlineGroupRender.insertChild(fillNullSpace, inlineGroupRender.length - 1);
15305
- }
15306
- ElementUtil.remeasureInlineGroupRender(inlineGroupRender);
15307
- }
15308
- return inlineGroupRender;
15309
- }
15310
- cutRenderItem(render, nextRender, limitWidth, lineEmpty, inCloseBody) {
15311
- if (render instanceof LeafRenderObject) {
15312
- if (render.rect.width > limitWidth && render instanceof TextGroupRenderObject) {
15313
- return this.cutTextRender(render, nextRender, limitWidth, lineEmpty, inCloseBody);
15314
- }
15315
- if (render instanceof FillNullSpaceRenderObject) {
15316
- return this.cutFillNullRender(render, limitWidth);
15317
- }
15318
- if (render.rect.width < limitWidth || lineEmpty || render.element.type === 'br' || render.element.type === 'psym') {
15319
- return { firstItem: render, lastItem: null, br: render.element.type === 'br' };
15320
- }
15321
- return { firstItem: null, lastItem: null };
15322
- }
15323
- else if (render instanceof InlineGroupRenderObject) {
15324
- return this.cutInlineGroupRenderItem(render, limitWidth, lineEmpty, inCloseBody);
15325
- }
15326
- throw new Error('到达计算边界');
15327
- }
15328
- cutTextRender(render, nextRender, limitWidth, lineEmpty, inCloseBody) {
15329
- let sumWidth = 0;
15330
- const cutRender = render.clone();
15331
- cutRender.textMeasures.length = 0;
15332
- let i = 0;
15333
- for (; i < render.textMeasures.length; i++) {
15334
- sumWidth += render.textMeasures[i].actualSize;
15335
- if (sumWidth > limitWidth) {
15336
- if (lineEmpty && i === 0) {
15337
- i = 1;
15338
- }
15339
- break;
15340
- }
15341
- }
15342
- //后置标点处理
15343
- i = this.patchHandlePostPunctuation(render, nextRender, i, inCloseBody, lineEmpty);
15344
- //前置标点处理
15345
- i = this.patchHandleLeadingPunctuation(render, i, lineEmpty);
15346
- if (i <= 0) {
15347
- return { firstItem: null, lastItem: null };
15348
- }
15349
- cutRender.textMeasures = render.textMeasures.splice(0, i);
15350
- render.measure();
15351
- cutRender.measure();
15352
- return { firstItem: cutRender, lastItem: render, br: true };
15353
- }
15354
- /**
15355
- * 处理前置标点,前置标点不能出现在末尾
15356
- * @param render
15357
- * @param i
15358
- */
15359
- patchHandleLeadingPunctuation(render, i, lineEmpty) {
15360
- if (i === 1 && lineEmpty) {
15361
- return i;
15362
- }
15363
- if (this.containLeadingPunctuation(render.textMeasures[i]?.char)) {
15364
- return i--;
15365
- }
15366
- return i;
15367
- }
15368
- /**
15369
- * 处理后置标点,后置标点不能出现在行首
15370
- * @param render
15371
- * @param i
15372
- * @param lineEmpty
15373
- */
15374
- patchHandlePostPunctuation(render, nextRender, i, inCloseBody, lineEmpty) {
15375
- if (i === render.textMeasures.length - 1) {
15376
- //紧跟着的字符包含后置标点
15377
- if (this.containerStartSymbolInTextStart(nextRender)) {
15378
- i--;
15379
- }
15380
- }
15381
- if (inCloseBody && this.containPostPunctuation(render.textMeasures[i]?.char)) {
15382
- if (this.containPostPunctuation(render.textMeasures[i + 1]?.char)) {
15383
- i--;
15384
- }
15385
- else {
15386
- i++;
15387
- }
15388
- }
15389
- else {
15390
- if (i > 1 && this.containPostPunctuation(render.textMeasures[i]?.char)) {
15391
- i--;
15392
- }
15393
- }
15394
- return i;
15395
- }
15396
- /**
15397
- * 是否包含后置标点
15398
- * @param str
15399
- * @returns
15400
- */
15401
- containPostPunctuation(str) {
15402
- return '!),.:;?]}¨·ˇˉ―‖’”…∶、。〃々〉》」』】〕〗!"'),.:;?]`|}~¢'.indexOf(str) > -1;
15403
- }
15404
- //是否包含前置标点
15405
- containLeadingPunctuation(str) {
15406
- return '‘“〈《「『【〔〖([{£'.indexOf(str) > -1;
15407
- }
15408
- /**
15409
- * 文本开头是否包含后置标点
15410
- * @param render
15411
- * @returns
15412
- */
15413
- containerStartSymbolInTextStart(render) {
15414
- //return false;
15415
- if (render instanceof TextGroupRenderObject) {
15416
- if (render.textMeasures.length > 0) {
15417
- return this.containPostPunctuation(render.textMeasures[0].char);
15418
- }
15419
- }
15420
- return false;
15421
- }
15422
- cutFillNullRender(render, limitWidth) {
15423
- if (limitWidth === 0) {
15424
- return { firstItem: null, lastItem: null };
15425
- }
15426
- if (render.rect.width > limitWidth) {
15427
- const cutRender = new FillNullSpaceRenderObject();
15428
- cutRender.rect.width = limitWidth;
15429
- cutRender.rect.height = render.rect.height;
15430
- render.rect.width = render.rect.width - limitWidth;
15431
- return { firstItem: cutRender, lastItem: render };
15432
- }
15433
- else {
15434
- return { firstItem: render, lastItem: null };
15435
- }
15436
- }
15437
- /**
15438
- * 行内编组元素超出行内可用空间,需要根据剩余空间长度进行截断
15439
- */
15440
- cutInlineGroupRenderItem(render, limitWidth, emptyLine, inCloseBody) {
15441
- const cutRender = render.element.createRenderObject({ options: this.options, renderCtx: this.renderCtx });
15442
- let x = 0;
15443
- let br = false;
15444
- const items = [...render.getItems()];
15445
- for (let i = 0; i < items.length; i++) {
15446
- const child = items[i];
15447
- if (child instanceof LeafRenderObject) {
15448
- if (x + child.rect.width > limitWidth) {
15449
- const { firstItem, lastItem, br: childBr } = this.cutRenderItem(child, items[i + 1], limitWidth - x, emptyLine && cutRender.length === 0, inCloseBody);
15450
- if (firstItem) {
15451
- cutRender.addChild(firstItem);
15452
- }
15453
- br = childBr || br;
15454
- break;
15455
- }
15456
- else {
15457
- render.removeChild(child);
15458
- cutRender.addChild(child);
15459
- }
15460
- //软换行符
15461
- if (child.element && child.element.type === 'br') {
15462
- br = true;
15463
- break;
15464
- }
15196
+ const rows = [];
15197
+ for (let i = 0; i < tb.length; i++) {
15198
+ const rowRender = tb.getChild(i);
15199
+ const rowEle = rowRender.element;
15200
+ if (rowEle.props.headerRow) {
15201
+ rows.push(rowRender);
15465
15202
  }
15466
- else if (child instanceof InlineGroupRenderObject) {
15467
- if (x + child.rect.width > limitWidth) {
15468
- const { firstItem, br: childBr } = this.cutInlineGroupRenderItem(child, limitWidth - x, emptyLine && cutRender.length === 0, inCloseBody);
15469
- if (firstItem) {
15470
- cutRender.addChild(firstItem);
15471
- }
15472
- br = childBr || br;
15473
- break;
15474
- }
15475
- else {
15476
- render.removeChild(child);
15477
- cutRender.addChild(child);
15478
- }
15203
+ else {
15204
+ break;
15479
15205
  }
15480
- x += child.rect.width;
15481
- }
15482
- if (!cutRender.length) {
15483
- return { firstItem: null, lastItem: null };
15484
15206
  }
15485
- ElementUtil.remeasureInlineGroupRender(cutRender);
15486
- ElementUtil.remeasureInlineGroupRender(render);
15487
- return { firstItem: cutRender, lastItem: render.length ? render : null, br };
15207
+ return rows;
15488
15208
  }
15489
15209
  /**
15490
15210
  * 修改测量完毕后的元素状态
@@ -15497,29 +15217,105 @@ class ElementMeasure {
15497
15217
  }
15498
15218
  }
15499
15219
  ele.modifyFlag = ModifyFlag$1.None;
15220
+ if (!ele.loaded) {
15221
+ ele.loaded = true;
15222
+ }
15500
15223
  }
15501
15224
  clearPaintCache(ele, data) {
15225
+ ele.paintRenders.length = 0;
15502
15226
  ele.beginMeasure(data);
15227
+ this.identifyComment(ele);
15503
15228
  if (ele instanceof BranchElement) {
15504
15229
  for (let i = 0; i < ele.length; i++) {
15505
15230
  this.clearPaintCache(ele.getChild(i), data);
15506
15231
  }
15507
15232
  }
15508
15233
  }
15234
+ identifyComment(ele) {
15235
+ if (ele instanceof CommentElement) {
15236
+ this.docCtx.document.identifyCommMark(ele);
15237
+ }
15238
+ }
15239
+ cacheDoc;
15240
+ cacheDocRenders(docs) {
15241
+ docs.forEach(doc => {
15242
+ this.cacheDoc = doc;
15243
+ this.cacheRenders(doc);
15244
+ });
15245
+ this.cacheDoc = null;
15246
+ }
15247
+ /**
15248
+ * 生成批注区间信息
15249
+ * @param renderTree
15250
+ */
15251
+ generateCommRange() {
15252
+ this.seo.commRangeSets.clear();
15253
+ const commMarks = this.docCtx.document.markPairs;
15254
+ for (let i = 0; i < commMarks.length; i++) {
15255
+ const commMark = commMarks[i];
15256
+ if (commMark.start && commMark.end) {
15257
+ const ancestor = DocumentSelection.getAncestorCommonControl(commMark.start, commMark.end);
15258
+ const range = RangeUtil.getSectionRange(commMark.start, 0, commMark.end, 1, ancestor);
15259
+ SelectionOverlays.addToCommentSets(range, this.seo.commRangeSets, commMark.start.color);
15260
+ }
15261
+ }
15262
+ }
15263
+ cacheRenders(renderTree) {
15264
+ if (renderTree.element) {
15265
+ renderTree.element.paintRenders.push(renderTree);
15266
+ }
15267
+ for (let i = 0; i < renderTree.length; i++) {
15268
+ const currRender = renderTree.getChild(i);
15269
+ if (currRender.element) {
15270
+ this.cacheCommsRender(currRender);
15271
+ }
15272
+ if (currRender instanceof BranchRenderObject) {
15273
+ this.cacheRenders(currRender);
15274
+ }
15275
+ else {
15276
+ currRender.element && currRender.element.paintRenders.push(currRender);
15277
+ }
15278
+ }
15279
+ }
15280
+ /**
15281
+ * 缓存批注标志
15282
+ * @private
15283
+ */
15284
+ cacheCommsRender(render) {
15285
+ if (render.element && render.element.type === 'comm') {
15286
+ const commElement = render.element;
15287
+ if (commElement.props.markType === 'start') {
15288
+ const currDocRender = this.cacheDoc;
15289
+ const docCommContainer = currDocRender.getItems().find(item => item instanceof CommsContainerRenderObject);
15290
+ if (docCommContainer) {
15291
+ docCommContainer.commsMarks.push(render);
15292
+ }
15293
+ }
15294
+ }
15295
+ if (render.element && render.element.type === 'comm-list') {
15296
+ const commContainer = render;
15297
+ CommentsUtil.createCommentsImage(commContainer);
15298
+ }
15299
+ }
15509
15300
  endMeasures(ele) {
15301
+ ele.endMeasure();
15510
15302
  if (ele instanceof BranchElement) {
15511
15303
  for (let i = 0; i < ele.length; i++) {
15512
15304
  this.endMeasures(ele.getChild(i));
15513
15305
  }
15514
15306
  }
15515
15307
  }
15308
+ createDefaultPara() {
15309
+ const tmp = new ParagraphElement();
15310
+ tmp.props.lineHeight = this.options.defaultLineHeight;
15311
+ return tmp;
15312
+ }
15516
15313
  }
15517
15314
 
15518
15315
  class DocumentPaint {
15519
15316
  renderContext;
15520
15317
  docCtx;
15521
15318
  seo;
15522
- elementMeasure;
15523
15319
  //elementRenderCut: ElementRenderCut;
15524
15320
  elementPaint;
15525
15321
  docPages;
@@ -15531,7 +15327,6 @@ class DocumentPaint {
15531
15327
  this.docCtx = docCtx;
15532
15328
  this.seo = seo;
15533
15329
  this.viewOptions = this.docCtx.viewOptions;
15534
- this.elementMeasure = new ElementMeasure(this.docCtx, this.renderContext);
15535
15330
  //this.elementRenderCut = new ElementRenderCut(this.viewOptions, this.renderContext);
15536
15331
  this.elementPaint = new ElementPaint(this.renderContext, this.docCtx);
15537
15332
  }
@@ -15691,130 +15486,6 @@ class DocumentPaint {
15691
15486
  }
15692
15487
  }
15693
15488
 
15694
- const fontSize = 12;
15695
- const verPadding = 2;
15696
- /**
15697
- * 恒牙牙位图
15698
- */
15699
- class PermanentTeethElement extends LeafElement {
15700
- constructor() {
15701
- super('permanent-teeth');
15702
- this.props = new PermanentTeethProps();
15703
- this.props.topLeft = '';
15704
- this.props.topRight = '';
15705
- this.props.bottomLeft = '';
15706
- this.props.bottomRight = '';
15707
- }
15708
- clone(data) {
15709
- const clone = new PermanentTeethElement();
15710
- clone.props = this.props.clone();
15711
- return clone;
15712
- }
15713
- createRenderObject(data) {
15714
- const clone = new PermanentTeethRenderObject(this);
15715
- clone.rect.width = 150;
15716
- //字体大小*2+上下间距2*2
15717
- clone.rect.height = fontSize * 2 + verPadding * 2;
15718
- //clone.rect= ElementUtil.cloneRect(this.rect);
15719
- return clone;
15720
- }
15721
- serialize(viewOptions) {
15722
- return {
15723
- type: this.type,
15724
- props: this.props.getSerializeProps(viewOptions)
15725
- };
15726
- }
15727
- }
15728
- class PermanentTeethRenderObject extends LeafRenderObject {
15729
- clone() {
15730
- const clone = new PermanentTeethRenderObject(this.element);
15731
- clone.rect = ElementUtil.cloneRect(this.rect);
15732
- return clone;
15733
- }
15734
- // measure(): { width: number, height: number } {
15735
- // const ele = this.element;
15736
- //
15737
- // }
15738
- exportHTML(event) {
15739
- const ele = this.element;
15740
- const g = super.exportHTML(event);
15741
- const contentHorPadding = 4;
15742
- g.children = [];
15743
- // g.children.push(ElementUtil.getFillSvgPath(`M 0 ${this.rect.height / 2} h${this.rect.width}`, '#000', 1));
15744
- // g.children.push(ElementUtil.getFillSvgPath(`M ${this.rect.width / 2} 0 v${this.rect.height}`, '#000', 1));
15745
- //
15746
- g.children.push(ElementUtil.getFillSvgRect(0, this.rect.height / 2, this.rect.width, 1, '#000'));
15747
- g.children.push(ElementUtil.getFillSvgRect(this.rect.width / 2, 0, 1, this.rect.height, '#000'));
15748
- const getSvgText = (text, x, y) => {
15749
- return {
15750
- sel: 'text',
15751
- text: text,
15752
- data: {
15753
- ns: "http://www.w3.org/2000/svg",
15754
- attrs: {
15755
- 'dominant-baseline': 'hanging',
15756
- 'font-family': 'Arial',
15757
- 'font-size': fontSize,
15758
- x,
15759
- y,
15760
- }
15761
- },
15762
- };
15763
- };
15764
- const topLeftWidth = event.renderCtx.mainContext.measureTextWidth(ele.props.topLeft, {
15765
- fontSize: fontSize,
15766
- fontName: 'Arial'
15767
- });
15768
- const bottomLeftWidth = event.renderCtx.mainContext.measureTextWidth(ele.props.bottomLeft, {
15769
- fontSize: fontSize,
15770
- fontName: 'Arial'
15771
- });
15772
- g.children.push(getSvgText(ele.props.topLeft, this.rect.width / 2 - topLeftWidth - contentHorPadding, verPadding));
15773
- g.children.push(getSvgText(ele.props.topRight, this.rect.width / 2 + contentHorPadding, verPadding));
15774
- g.children.push(getSvgText(ele.props.bottomLeft, this.rect.width / 2 - bottomLeftWidth - contentHorPadding, this.rect.height - fontSize + verPadding));
15775
- g.children.push(getSvgText(ele.props.bottomRight, this.rect.width / 2 + contentHorPadding, this.rect.height - fontSize + verPadding));
15776
- return g;
15777
- }
15778
- }
15779
- class PermanentTeethFactory extends ElementFactory {
15780
- match(type) {
15781
- return type === 'permanent-teeth';
15782
- }
15783
- createElement(data) {
15784
- const ele = new PermanentTeethElement();
15785
- ele.props.bottomLeft = data.props?.bottomLeft ?? '';
15786
- ele.props.bottomRight = data.props?.bottomRight ?? '';
15787
- ele.props.topLeft = data.props?.topLeft ?? '';
15788
- ele.props.topRight = data.props?.topRight ?? '';
15789
- return ele;
15790
- }
15791
- }
15792
- /**
15793
- * 恒牙牙位图属性
15794
- */
15795
- class PermanentTeethProps extends INotifyPropertyChanged {
15796
- topLeft;
15797
- topRight;
15798
- bottomLeft;
15799
- bottomRight;
15800
- getSerializeProps(viewOptions) {
15801
- return {
15802
- topLeft: this.topLeft,
15803
- topRight: this.topRight,
15804
- bottomLeft: this.bottomLeft,
15805
- bottomRight: this.bottomRight,
15806
- };
15807
- }
15808
- clone(dest) {
15809
- dest = dest || new PermanentTeethProps();
15810
- dest.topLeft = this.topLeft;
15811
- dest.topRight = this.topRight;
15812
- dest.bottomLeft = this.bottomLeft;
15813
- dest.bottomRight = this.bottomRight;
15814
- return dest;
15815
- }
15816
- }
15817
-
15818
15489
  class ElementReader {
15819
15490
  docCtx;
15820
15491
  constructor(docCtx) {
@@ -15878,29 +15549,18 @@ class ElementReader {
15878
15549
  this.setDocument(document);
15879
15550
  }
15880
15551
  setDocument(document) {
15881
- // if (this.docCtx.document) {
15882
- // this.docCtx.document.destroy();
15883
- // }
15884
- // this.document?.clearItems();
15885
- // document.docProps.clone(this.document.docProps);
15886
15552
  document.bodyElement = document.find((item) => item instanceof DocumentBodyElement);
15887
15553
  document.headerElement = document.find((item) => item instanceof DocumentHeaderElement);
15888
15554
  document.footerElement = document.find((item) => item instanceof DocumentFooterElement);
15889
- // document.commentsContainerElement = document.find((item) => item instanceof CommsContainerElement) as CommsContainerElement;
15890
- // if (!document.commentsContainerElement) {
15891
- // document.commentsContainerElement = new CommsContainerElement();
15892
- // }
15893
15555
  document.clearItems();
15894
15556
  document.addChild(document.headerElement);
15895
15557
  document.addChild(document.bodyElement);
15896
15558
  document.addChild(document.footerElement);
15897
- //document.addChild(document.commentsContainerElement);
15898
15559
  this.docCtx.document = document;
15899
15560
  document.viewOptions = this.docCtx.viewOptions;
15900
15561
  const width = Math.floor(document.props.width * this.docCtx.viewOptions.mmToPixelsRatio);
15901
15562
  const height = Math.floor(document.props.height * this.docCtx.viewOptions.mmToPixelsRatio);
15902
15563
  this.docCtx.viewOptions.docPageSettings = new PageOptions(width, height, document.props.orient);
15903
- //this.viewOptions.viewSettings.width = this.viewOptions.docPageSettings.width + 10;
15904
15564
  }
15905
15565
  readElement(data, strictMode = false) {
15906
15566
  if (typeof data === 'string') {
@@ -15922,6 +15582,7 @@ class ElementReader {
15922
15582
  }
15923
15583
  }
15924
15584
  factory.readCompleted(element, childArr);
15585
+ this.readAttribute(data, element);
15925
15586
  return element;
15926
15587
  }
15927
15588
  }
@@ -15933,6 +15594,11 @@ class ElementReader {
15933
15594
  return null;
15934
15595
  }
15935
15596
  }
15597
+ readAttribute(data, ele) {
15598
+ if (data.attribute) {
15599
+ ele.attribute = data.attribute;
15600
+ }
15601
+ }
15936
15602
  /**
15937
15603
  * 读取扩展属性
15938
15604
  * @param data
@@ -17186,7 +16852,6 @@ class DocumentEvent {
17186
16852
  startHitInfo: this.startHitInfo,
17187
16853
  endHitInfo: this.endHitInfo
17188
16854
  });
17189
- console.log(this.endHitInfo);
17190
16855
  }
17191
16856
  /**
17192
16857
  * 获取鼠标所在的渲染元素对象
@@ -20156,7 +19821,8 @@ class ElementTrackManage {
20156
19821
  * @private
20157
19822
  */
20158
19823
  mergeOps(ops) {
20159
- return false;
19824
+ return this.mergeFormatOps(ops);
19825
+ //return false;
20160
19826
  //问题在于:
20161
19827
  //1.新输入的字符串,selectState的startOffset、endOffset=1,后输入的字符串的endOffset进行累加
20162
19828
  //2.撤销后重做,选区范围在1-2,英国是0-2,因为之前在创建文本对象后,选区的结束位为1
@@ -20207,6 +19873,41 @@ class ElementTrackManage {
20207
19873
  // }
20208
19874
  // return false;
20209
19875
  }
19876
+ /**
19877
+ * 将对某个元素的最近两次的属性修改合并为一次,ops为当前记录的修改,比较上次的修改,如果为对同一个元素的修改,则合并
19878
+ * @private
19879
+ */
19880
+ mergeFormatOps(ops) {
19881
+ if (ops.length > 1) {
19882
+ return false;
19883
+ }
19884
+ const lastOps = this.actions[this.actions.length - 1];
19885
+ if (!lastOps || lastOps.ops.length > 1) {
19886
+ return false;
19887
+ }
19888
+ const prevOp = lastOps.ops[lastOps.ops.length - 1];
19889
+ const currOp = ops[0];
19890
+ //操作类型相同
19891
+ if ('format' in currOp.ops && 'format' in prevOp.ops && currOp.index === prevOp.index) {
19892
+ // const prevAfterSelection = lastOps.afterSelection;
19893
+ // if (!prevAfterSelection) {
19894
+ // return false;
19895
+ // }
19896
+ //前后是连续的操作
19897
+ const { format: currFormat } = currOp.ops;
19898
+ const { format: prevFormat } = prevOp.ops;
19899
+ Object.keys(currFormat).forEach(key => {
19900
+ const currValue = currFormat[key].newValue;
19901
+ const prevValue = prevFormat[key].newValue;
19902
+ if (CommonUtil.isEqual(currValue, prevValue)) {
19903
+ return;
19904
+ }
19905
+ prevFormat[key].newValue = currValue;
19906
+ });
19907
+ return true;
19908
+ }
19909
+ return false;
19910
+ }
20210
19911
  getSelection() {
20211
19912
  const { startControl, startOffset, endControl, endOffset, editable } = this.docCtx.selectionState;
20212
19913
  if (!startControl) {
@@ -28119,7 +27820,7 @@ class DocEditor {
28119
27820
  rule.setRuleOptions({ width: this.viewOptions.docPageSettings.width, pagePL, pagePR, docLeft });
28120
27821
  }
28121
27822
  version() {
28122
- return "2.1.20";
27823
+ return "2.1.22";
28123
27824
  }
28124
27825
  switchPageHeaderEditor() {
28125
27826
  this.docCtx.document.switchPageHeaderEditor(this.selectionState, null);
@@ -28172,6 +27873,26 @@ class DocumentCombine {
28172
27873
  }
28173
27874
  }
28174
27875
 
27876
+ /**
27877
+ * 文字行渲染模式
27878
+ 用于医嘱打印模式
27879
+ */
27880
+ function runTextLineRender(ele, data) {
27881
+ if (!data.options.textRowLineMode) {
27882
+ return;
27883
+ }
27884
+ if (ele instanceof TableElement) {
27885
+ // textLineRenderMode(ele, data);
27886
+ // remeasureParentRenders(ele.cacheRender)
27887
+ return;
27888
+ }
27889
+ if (ele instanceof BranchElement) {
27890
+ for (let i = 0; i < ele.length; i++) {
27891
+ runTextLineRender(ele.getChild(i), data);
27892
+ }
27893
+ }
27894
+ }
27895
+
28175
27896
  /**
28176
27897
  * 删除当前段落
28177
27898
  * @param evt
@@ -28303,5 +28024,5 @@ function removeDuplicatesEvent(events) {
28303
28024
  return arr;
28304
28025
  }
28305
28026
 
28306
- export { BlockContainerElement, BlockContainerRenderObject, BlockContentElement, BlockContentRenderObject, BlockLineRectRenderObject, BodyPartProps, BooleanEnum, BorderProps, BranchElement, BranchRenderObject, BreakElement, BreakFactory, BreakRenderObject, CheckBoxElement, CheckBoxFactory, CheckBoxProps, CheckBoxRenderObject, ColumnPatchUtil, CommContentBaseElement, CommContentBaseRenderObject, CommContentElement, CommContentProps, CommContentRenderObject, CommProps, CommentContentFactory, CommentElement, CommentFactory, CommentRenderObject, CommentsFactory, CommentsUtil, CommonUtil, CommsContainerElement, CommsContainerRenderObject, ContentMenuItem, ContextMenuElementEvent, CopyElementEvent, DOMEventSource, DOMSubscription, DataDecorateElement, DataDecorateProps, DataDecorateRenderObject, DataEleBaseProps, DataEleBaseTextProps, DataEleCheckProps, DataEleDateProps, DataEleImageProps, DataEleListProps, DataEleMHProps, DataElementBarcode, DataElementBarcodeFactory, DataElementBarcodeProps, DataElementBarcodeRenderObject, DataElementBaseFactory, DataElementCheck, DataElementCheckFactory, DataElementCheckRenderObject, DataElementDate, DataElementDateFactory, DataElementDateRenderObject, DataElementGroupElement, DataElementGroupFactory, DataElementGroupProps, DataElementGroupRenderObject, DataElementImage, DataElementImgFactory, DataElementInlineGroup, DataElementLeaf, DataElementList, DataElementListFactory, DataElementListRenderObject, DataElementMH, DataElementMHFactory, DataElementRenderObject, DataElementText, DataElementTextFactory, DataElementTextRenderObject, DataImageRenderObject, DataRenderMH, DocEditor, DocMode, DocumentBodyElement, DocumentBodyFactory, DocumentBodyPartElement, DocumentBodyPartFactory, DocumentBodyPartRenderObject, DocumentBodyRenderObject, DocumentChange, DocumentCombine, DocumentComment, DocumentContainerRender, DocumentContext, DocumentCursor, DocumentElement, DocumentEvalFunc, DocumentEvent, DocumentFactory, DocumentFooterElement, DocumentFooterFactory, DocumentFooterRenderObject, DocumentHeaderElement, DocumentHeaderFactory, DocumentHeaderRenderObject, DocumentInput, DocumentPaint, DocumentPrintOffscreen, DocumentPrintOffscreenBase, DocumentProps, DocumentRenderObject, DocumentSelection, DocumentTemplate, DropElementEvent, EditMode, EditorContext, Element, ElementEvent, ElementFactory, ElementPaint, ElementReader, ElementSerialize, ElementUtil, EventBus, EventMap, EventSourceCore$1 as EventSourceCore, FillNullSpaceElement, FillNullSpaceRenderObject, GetTrackTipsEvent, GotCursorEvent, IDispose, INotifyPropertyChanged, InlineBlockContainer, InlineGroupElement, InlineGroupInputElement, InlineGroupRenderObject, InlineMuiltBlockLineRenderObject, InputElementEvent, IsInSideDataElement, IsInSideInlineGroupInputElement, KeyboradElementEvent, LeafElement, LeafRenderObject, LostCursorEvent, MarginProps, ModifyFlag$1 as ModifyFlag, MouseElementEvent, MousedownElementEvent, MuiltBlockLineRenderObject, OnceSubject, PSymbolElement, PSymbolRenderObject, PaddingProps, PageBreakElement, PageBreakFactory, PageBreakRenderObject, PageOptions, PaintContent, ParagraphElement, ParagraphFactory, ParagraphLineRectRenderObject, ParagraphNumberType, ParagraphProps, ParagraphRenderObject, PasteElementEvent, PictureElement, PictureFactory, PictureProps, PictureRenderObject, RadioBoxElement, RadioBoxFactory, RadioBoxProps, RadioBoxRenderObject, RangeUtil, Rect, RenderContext, RenderObject, RenderObjectType, ResizeLeafRenderObject, RunElementFactory, SVGElement, SVGFactory, SVGProps, SVGRenderObject, SelectionOverlays, SelectionRange, SelectionState, Subject$1 as Subject, SubjectSubscription$1 as SubjectSubscription, Subscription$1 as Subscription, TabElement, TabFactory, TabRenderObject, TableCellElement, TableCellFactory, TableCellProps, TableCellRenderObject, TableElement, TableFactory, TableProps, TableRenderObject, TableRowElement, TableRowFactory, TableRowProps, TableRowRenderObject, TableSplitCell, TableUtil, TextGroupElement, TextGroupFactory, TextGroupRenderObject, TextProps, TrackRunElement, TrackRunProps, TrackRunRenderObject, TrackRunTypeEnum, ValidateCondition, ValidateElement, ValidateProps, ValidateRenderObject, ViewOptions, clearChildrenRenderCache, clearTraces, createPrintTemplate, defaultParaHanging, deleteCurrentParagraph, docOpsMap, documentPrint, drawDecorator, elementTypeEventHandler, exportDecoratorHTML, falseChar, fontMapFunc, formatEle, fromEvent, generatePatch, getCalleeName, getFocusTextSegment, inputText, insertEle, invokeTypeHandler, isDate, logUpdateEleProps, objectToString$4 as objectToString, onTableContextmenu, onceTask, parser, printNodes, reactiveMap, removeEle, removeText, runTextLineRender, setChildrenModifyFlag, setDataElementProps, setNotifyChangedCallback, setTraceTrackingFlag, suppressTracking, targetMaps, textLineRenderMode, toRawType, toTypeString, trueChar, validateDataEle, validateDataEleRenderObj, validateInlineInputRenderObj, watchChanged };
28027
+ export { BlockContainerElement, BlockContainerRenderObject, BlockContentElement, BlockContentRenderObject, BlockLineRectRenderObject, BodyPartProps, BooleanEnum, BorderProps, BranchElement, BranchRenderObject, BreakElement, BreakFactory, BreakRenderObject, CheckBoxElement, CheckBoxFactory, CheckBoxProps, CheckBoxRenderObject, ColumnPatchUtil, CommContentBaseElement, CommContentBaseRenderObject, CommContentElement, CommContentProps, CommContentRenderObject, CommProps, CommentContentFactory, CommentElement, CommentFactory, CommentRenderObject, CommentsFactory, CommentsUtil, CommonUtil, CommsContainerElement, CommsContainerRenderObject, ContentMenuItem, ContextMenuElementEvent, CopyElementEvent, DOMEventSource, DOMSubscription, DataDecorateElement, DataDecorateProps, DataDecorateRenderObject, DataEleBaseProps, DataEleBaseTextProps, DataEleCheckProps, DataEleDateProps, DataEleImageProps, DataEleListProps, DataEleMHProps, DataElementBarcode, DataElementBarcodeFactory, DataElementBarcodeProps, DataElementBarcodeRenderObject, DataElementBaseFactory, DataElementCheck, DataElementCheckFactory, DataElementCheckRenderObject, DataElementDate, DataElementDateFactory, DataElementDateRenderObject, DataElementGroupElement, DataElementGroupFactory, DataElementGroupProps, DataElementGroupRenderObject, DataElementImage, DataElementImgFactory, DataElementInlineGroup, DataElementLeaf, DataElementList, DataElementListFactory, DataElementListRenderObject, DataElementMH, DataElementMHFactory, DataElementRenderObject, DataElementText, DataElementTextFactory, DataElementTextRenderObject, DataImageRenderObject, DataRenderMH, DocEditor, DocMode, DocumentBodyElement, DocumentBodyFactory, DocumentBodyPartElement, DocumentBodyPartFactory, DocumentBodyPartRenderObject, DocumentBodyRenderObject, DocumentChange, DocumentCombine, DocumentComment, DocumentContainerRender, DocumentContext, DocumentCursor, DocumentElement, DocumentEvalFunc, DocumentEvent, DocumentFactory, DocumentFooterElement, DocumentFooterFactory, DocumentFooterRenderObject, DocumentHeaderElement, DocumentHeaderFactory, DocumentHeaderRenderObject, DocumentInput, DocumentPaint, DocumentPrintOffscreen, DocumentPrintOffscreenBase, DocumentProps, DocumentRenderObject, DocumentSelection, DocumentTemplate, DropElementEvent, EditMode, EditorContext, Element, ElementEvent, ElementFactory, ElementPaint, ElementReader, ElementSerialize, ElementUtil, EventBus, EventMap, EventSourceCore$1 as EventSourceCore, FillNullSpaceElement, FillNullSpaceRenderObject, GetTrackTipsEvent, GotCursorEvent, IDispose, INotifyPropertyChanged, InlineBlockContainer, InlineGroupElement, InlineGroupInputElement, InlineGroupRenderObject, InlineMuiltBlockLineRenderObject, InputElementEvent, IsInSideDataElement, IsInSideInlineGroupInputElement, KeyboradElementEvent, LeafElement, LeafRenderObject, LostCursorEvent, MarginProps, ModifyFlag$1 as ModifyFlag, MouseElementEvent, MousedownElementEvent, MuiltBlockLineRenderObject, OnceSubject, PSymbolElement, PSymbolRenderObject, PaddingProps, PageBreakElement, PageBreakFactory, PageBreakRenderObject, PageOptions, PaintContent, ParagraphElement, ParagraphFactory, ParagraphLineRectRenderObject, ParagraphNumberType, ParagraphProps, ParagraphRenderObject, PasteElementEvent, PermanentTeethElement, PermanentTeethFactory, PermanentTeethProps, PermanentTeethRenderObject, PictureElement, PictureFactory, PictureProps, PictureRenderObject, RadioBoxElement, RadioBoxFactory, RadioBoxProps, RadioBoxRenderObject, RangeUtil, Rect, RenderContext, RenderObject, RenderObjectType, ResizeLeafRenderObject, RunElementFactory, SVGElement, SVGFactory, SVGProps, SVGRenderObject, SelectionOverlays, SelectionRange, SelectionState, Subject$1 as Subject, SubjectSubscription$1 as SubjectSubscription, Subscription$1 as Subscription, TabElement, TabFactory, TabRenderObject, TableCellElement, TableCellFactory, TableCellProps, TableCellRenderObject, TableElement, TableFactory, TableProps, TableRenderObject, TableRowElement, TableRowFactory, TableRowProps, TableRowRenderObject, TableSplitCell, TableUtil, TextGroupElement, TextGroupFactory, TextGroupRenderObject, TextProps, TrackRunElement, TrackRunProps, TrackRunRenderObject, TrackRunTypeEnum, ValidateCondition, ValidateElement, ValidateProps, ValidateRenderObject, ViewOptions, addReturn, clearChildrenRenderCache, clearTraces, cloneChildren, cloneElementBase, createPrintTemplate, defaultParaHanging, deleteCurrentParagraph, docOpsMap, documentPrint, drawDecorator, elementTypeEventHandler, exportDecoratorHTML, falseChar, fontMapFunc, formatEle, fromEvent, generatePatch, getCalleeName, getFocusTextSegment, inputText, insertEle, invokeTypeHandler, isDate, logUpdateEleProps, objectToString$4 as objectToString, onTableContextmenu, onceTask, parser, printNodes, reactiveMap, removeEle, removeText, runTextLineRender, setChildrenModifyFlag, setDataElementProps, setNotifyChangedCallback, setTraceTrackingFlag, suppressTracking, targetMaps, textLineRenderMode, toRawType, toTypeString, trueChar, validateDataEle, validateDataEleRenderObj, validateInlineInputRenderObj, watchChanged };
28307
28028
  //# sourceMappingURL=index.js.map