@hailin-zheng/editor-core 2.1.20 → 2.1.21

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,61 @@ 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
+ // @ts-ignore
635
+ static cloneDeep(source, visited = new WeakMap()) {
636
+ if (source === null || typeof source !== 'object') {
637
+ // 如果是基本类型或 null,则直接返回
638
+ return source;
639
+ }
640
+ // 处理循环引用
641
+ if (visited.has(source)) {
642
+ return visited.get(source);
643
+ }
644
+ if (Array.isArray(source)) {
645
+ // 如果是数组,则递归复制数组元素
646
+ const arrayClone = [];
647
+ visited.set(source, arrayClone);
648
+ source.forEach((item, index) => {
649
+ arrayClone[index] = CommonUtil.cloneDeep(item, visited);
650
+ });
651
+ return arrayClone;
652
+ }
653
+ if (source instanceof Date) {
654
+ // 如果是 Date 对象,则直接创建一个新的 Date 对象
655
+ return new Date(source.getTime());
656
+ }
657
+ if (source instanceof Map) {
658
+ // 如果是 Map 对象,则递归复制键值对
659
+ const mapClone = new Map();
660
+ visited.set(source, mapClone);
661
+ source.forEach((value, key) => {
662
+ mapClone.set(CommonUtil.cloneDeep(key, visited), CommonUtil.cloneDeep(value, visited));
663
+ });
664
+ return mapClone;
665
+ }
666
+ if (source instanceof Set) {
667
+ // 如果是 Set 对象,则递归复制元素
668
+ const setClone = new Set();
669
+ visited.set(source, setClone);
670
+ source.forEach(value => {
671
+ setClone.add(CommonUtil.cloneDeep(value, visited));
672
+ });
673
+ return setClone;
634
674
  }
635
- return val;
675
+ if (Object.prototype.toString.call(source) === '[object Object]') {
676
+ // 如果是普通对象,则递归复制对象属性
677
+ const objectClone = {};
678
+ visited.set(source, objectClone);
679
+ for (const key in source) {
680
+ if (source.hasOwnProperty(key)) {
681
+ objectClone[key] = CommonUtil.cloneDeep(source[key], visited);
682
+ }
683
+ }
684
+ return objectClone;
685
+ }
686
+ return source;
636
687
  }
637
688
  static isConstructor(f) {
638
689
  try {
@@ -712,6 +763,9 @@ class CommonUtil {
712
763
  return btoa(unescape(encodeURIComponent(str)));
713
764
  //return btoa(str.replace(/[\u00A0-\u2666]/g, c => `&#${c.charCodeAt(0)};`));
714
765
  }
766
+ static isEqual(a, b) {
767
+ return JSON.stringify(a) === JSON.stringify(b);
768
+ }
715
769
  }
716
770
 
717
771
  const docOpsMap = new Map();
@@ -1183,6 +1237,8 @@ class Element {
1183
1237
  disposed;
1184
1238
  //加载完毕
1185
1239
  loaded;
1240
+ visibleExpr;
1241
+ attribute;
1186
1242
  _parent;
1187
1243
  get parent() {
1188
1244
  return this._parent;
@@ -1255,7 +1311,6 @@ class Element {
1255
1311
  listeners.forEach(item => item(evt));
1256
1312
  }
1257
1313
  beginMeasure(data) {
1258
- this.paintRenders.length = 0;
1259
1314
  }
1260
1315
  endMeasure() {
1261
1316
  }
@@ -1671,6 +1726,7 @@ class ViewOptions {
1671
1726
  printHeaderFooterLine = false;
1672
1727
  //显示段落回车符号
1673
1728
  showEnterSymbol = false;
1729
+ enableVisibleExpression = false;
1674
1730
  get fullPageView() {
1675
1731
  return this._fullPageView;
1676
1732
  }
@@ -1784,6 +1840,30 @@ class BorderProps {
1784
1840
  return new BorderProps(this.width, this.color, this.style);
1785
1841
  }
1786
1842
  }
1843
+ /**
1844
+ * 克隆元素的基本属性
1845
+ * @param ele
1846
+ * @param target
1847
+ */
1848
+ function cloneElementBase(ele, target) {
1849
+ target.attribute = ele.attribute ? CommonUtil.cloneValue(ele.attribute) : undefined;
1850
+ }
1851
+ /**
1852
+ * 克隆元素的子元素
1853
+ * @param ele
1854
+ * @param target
1855
+ * @param data
1856
+ */
1857
+ function cloneChildren(ele, target, data) {
1858
+ if (!data) {
1859
+ return;
1860
+ }
1861
+ for (let i = 0; i < ele.length; i++) {
1862
+ const child = ele.getChild(i);
1863
+ const cloneChild = child.clone(true);
1864
+ target.addChild(cloneChild);
1865
+ }
1866
+ }
1787
1867
  class IDispose {
1788
1868
  }
1789
1869
  class ResizeLeafRenderObject extends LeafRenderObject {
@@ -2790,11 +2870,8 @@ class CommsContainerElement extends BlockContainerElement {
2790
2870
  }
2791
2871
  clone(data) {
2792
2872
  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
- }
2873
+ cloneElementBase(this, clone);
2874
+ cloneChildren(this, clone, data);
2798
2875
  return clone;
2799
2876
  }
2800
2877
  }
@@ -2877,7 +2954,7 @@ class DataDecorateElement extends LeafElement {
2877
2954
  clone() {
2878
2955
  const clone = new DataDecorateElement(this.dataEle, this.isPrefix);
2879
2956
  this.props.clone(clone.props);
2880
- //clone.renderCtx = this.renderCtx;
2957
+ cloneElementBase(this, clone);
2881
2958
  return clone;
2882
2959
  }
2883
2960
  }
@@ -2952,7 +3029,7 @@ class DataDecorateRenderObject extends LeafRenderObject {
2952
3029
  }
2953
3030
  }
2954
3031
 
2955
- function parser(code) {
3032
+ function parser(code, objects) {
2956
3033
  const node = acor.parse(code, { ecmaVersion: 'latest' });
2957
3034
  estraverse.traverse(node, {
2958
3035
  enter: (child, parent) => {
@@ -2960,6 +3037,7 @@ function parser(code) {
2960
3037
  const identifierName = child['name'];
2961
3038
  if (identifierName.startsWith('$')) {
2962
3039
  child['name'] = `getObject('${identifierName.slice(1)}').value`;
3040
+ objects?.push(identifierName.slice(1));
2963
3041
  }
2964
3042
  }
2965
3043
  }
@@ -2986,6 +3064,28 @@ function parser(code) {
2986
3064
  });
2987
3065
  return generate(node);
2988
3066
  }
3067
+ //判断代码的语句,如果最后一个语句不是return,那么加上return
3068
+ function addReturn(code) {
3069
+ const node = acor.parse(code, { ecmaVersion: 'latest' });
3070
+ estraverse.replace(node, {
3071
+ leave: (child) => {
3072
+ //函数调用
3073
+ if (child.type == 'Program') {
3074
+ const body = child['body'];
3075
+ const lastNode = body[body.length - 1];
3076
+ if (lastNode.type !== 'ReturnStatement') {
3077
+ body[body.length - 1] = {
3078
+ type: 'ReturnStatement',
3079
+ start: -1, end: -1,
3080
+ argument: lastNode
3081
+ };
3082
+ }
3083
+ return child;
3084
+ }
3085
+ }
3086
+ });
3087
+ return generate(node);
3088
+ }
2989
3089
  /**
2990
3090
  * 将参数转为函数调用arg => ()=>arg
2991
3091
  * @param nodes
@@ -3079,11 +3179,8 @@ class ParagraphElement extends BlockContentElement {
3079
3179
  clone(data) {
3080
3180
  const clone = new ParagraphElement();
3081
3181
  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
- }
3182
+ cloneElementBase(this, clone);
3183
+ cloneChildren(this, clone, data);
3087
3184
  return clone;
3088
3185
  }
3089
3186
  static createElement() {
@@ -3279,9 +3376,8 @@ class DocumentElement extends BlockContainerElement {
3279
3376
  clone() {
3280
3377
  const clone = new DocumentElement();
3281
3378
  this.props.clone(clone.props);
3282
- for (let i = 0; i < this.length; i++) {
3283
- clone.addChild(this.getChild(i).clone(true));
3284
- }
3379
+ cloneElementBase(this, clone);
3380
+ cloneChildren(this, clone, true);
3285
3381
  return clone;
3286
3382
  }
3287
3383
  /**
@@ -3658,6 +3754,7 @@ class InlineGroupInputElement extends InlineGroupElement {
3658
3754
  }
3659
3755
  cloneSelf(data, constr) {
3660
3756
  const clone = new constr();
3757
+ cloneElementBase(this, clone);
3661
3758
  this.props['clone'](clone.props);
3662
3759
  //cloneFunc.apply(this, clone.props);
3663
3760
  if (data) {
@@ -3780,7 +3877,7 @@ class DataElementInlineGroup extends InlineGroupInputElement {
3780
3877
  const code = parser(this.props.expression);
3781
3878
  this.expressFn = new Function(`with(this){ ${code} }`);
3782
3879
  }
3783
- this.expressFn.bind(data.parser)();
3880
+ this.expressFn.bind(data.execute)();
3784
3881
  //this.expressFn();
3785
3882
  }
3786
3883
  catch (e) {
@@ -4074,11 +4171,8 @@ class DocumentBodyElement extends BlockContainerElement {
4074
4171
  }
4075
4172
  clone(data) {
4076
4173
  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
- }
4174
+ cloneElementBase(this, clone);
4175
+ cloneChildren(this, clone, data);
4082
4176
  return clone;
4083
4177
  }
4084
4178
  beginMeasure(data) {
@@ -4128,11 +4222,8 @@ class DocumentFooterElement extends BlockContainerElement {
4128
4222
  }
4129
4223
  clone(data) {
4130
4224
  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
- }
4225
+ cloneElementBase(this, clone);
4226
+ cloneChildren(this, clone, data);
4136
4227
  return clone;
4137
4228
  }
4138
4229
  beginMeasure(data) {
@@ -4208,11 +4299,8 @@ class DocumentHeaderElement extends BlockContainerElement {
4208
4299
  }
4209
4300
  clone(data) {
4210
4301
  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
- }
4302
+ cloneElementBase(this, clone);
4303
+ cloneChildren(this, clone, data);
4216
4304
  return clone;
4217
4305
  }
4218
4306
  switchEditMode(evt) {
@@ -4310,6 +4398,7 @@ class PSymbolElement extends LeafElement {
4310
4398
  clone() {
4311
4399
  const clone = new PSymbolElement();
4312
4400
  clone.defaultHeight = this.defaultHeight;
4401
+ cloneElementBase(this, clone);
4313
4402
  return clone;
4314
4403
  }
4315
4404
  getSelfLength(pure) {
@@ -4391,11 +4480,8 @@ class TableCellElement extends BlockContainerElement {
4391
4480
  clone(data) {
4392
4481
  const clone = new TableCellElement();
4393
4482
  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
- }
4483
+ cloneElementBase(this, clone);
4484
+ cloneChildren(this, clone, data);
4399
4485
  return clone;
4400
4486
  }
4401
4487
  getCellWidth() {
@@ -4703,6 +4789,7 @@ class TextGroupElement extends LeafElement {
4703
4789
  const clone = new TextGroupElement();
4704
4790
  this.props.clone(clone.props);
4705
4791
  clone.text = this.text;
4792
+ cloneElementBase(this, clone);
4706
4793
  return clone;
4707
4794
  }
4708
4795
  destroy() {
@@ -6428,11 +6515,8 @@ class TableElement extends BlockContainerElement {
6428
6515
  clone(data) {
6429
6516
  const clone = new TableElement();
6430
6517
  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
- }
6518
+ cloneElementBase(this, clone);
6519
+ cloneChildren(this, clone, data);
6436
6520
  return clone;
6437
6521
  }
6438
6522
  createRenderObject() {
@@ -6721,6 +6805,7 @@ class CheckBoxElement extends LeafElement {
6721
6805
  }
6722
6806
  clone() {
6723
6807
  const clone = new CheckBoxElement();
6808
+ cloneElementBase(this, clone);
6724
6809
  this.props.clone(clone.props);
6725
6810
  return clone;
6726
6811
  }
@@ -6824,11 +6909,8 @@ class CommContentElement extends CommContentBaseElement {
6824
6909
  clone(data) {
6825
6910
  const clone = new CommContentElement();
6826
6911
  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
- }
6912
+ cloneElementBase(this, clone);
6913
+ cloneChildren(this, clone, data);
6832
6914
  return clone;
6833
6915
  }
6834
6916
  beginMeasure(data) {
@@ -7105,6 +7187,7 @@ class CommentElement extends LeafElement {
7105
7187
  clone() {
7106
7188
  const clone = new CommentElement();
7107
7189
  this.props.clone(clone.props);
7190
+ cloneElementBase(this, clone);
7108
7191
  return clone;
7109
7192
  }
7110
7193
  }
@@ -7254,11 +7337,8 @@ class ValidateElement extends CommContentBaseElement {
7254
7337
  clone(data) {
7255
7338
  const clone = new ValidateElement();
7256
7339
  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
- }
7340
+ cloneElementBase(this, clone);
7341
+ cloneChildren(this, clone, data);
7262
7342
  return clone;
7263
7343
  }
7264
7344
  setContent(content) {
@@ -8186,6 +8266,7 @@ class DataElementBarcode extends DataElementLeaf {
8186
8266
  clone(data) {
8187
8267
  const clone = new DataElementBarcode();
8188
8268
  this.props.clone(clone.props);
8269
+ cloneElementBase(this, clone);
8189
8270
  return clone;
8190
8271
  }
8191
8272
  setValue(val) {
@@ -8339,6 +8420,7 @@ class DataElementCheck extends DataElementLeaf {
8339
8420
  clone(data) {
8340
8421
  const clone = new DataElementCheck();
8341
8422
  this.props.clone(clone.props);
8423
+ cloneElementBase(this, clone);
8342
8424
  return clone;
8343
8425
  }
8344
8426
  setValue(val) {
@@ -8709,6 +8791,7 @@ class DataElementImage extends DataElementLeaf {
8709
8791
  clone(data) {
8710
8792
  const clone = new DataElementImage();
8711
8793
  this.props.clone(clone.props);
8794
+ cloneElementBase(this, clone);
8712
8795
  return clone;
8713
8796
  }
8714
8797
  destroy() {
@@ -8960,7 +9043,7 @@ class BreakElement extends LeafElement {
8960
9043
  }
8961
9044
  clone() {
8962
9045
  const clone = new BreakElement();
8963
- //clone.renderCtx = this.renderCtx;
9046
+ cloneElementBase(this, clone);
8964
9047
  return clone;
8965
9048
  }
8966
9049
  }
@@ -9181,11 +9264,8 @@ class DocumentBodyPartElement extends BlockContainerElement {
9181
9264
  clone(data) {
9182
9265
  const clone = new DocumentBodyPartElement();
9183
9266
  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
- }
9267
+ cloneElementBase(this, clone);
9268
+ cloneChildren(this, clone, data);
9189
9269
  return clone;
9190
9270
  }
9191
9271
  }
@@ -9283,6 +9363,7 @@ class DataElementMH extends DataElementLeaf {
9283
9363
  clone(data) {
9284
9364
  const element = new DataElementMH();
9285
9365
  this.props.clone(element.props);
9366
+ cloneElementBase(this, element);
9286
9367
  return element;
9287
9368
  }
9288
9369
  getCurrentLayoutItem() {
@@ -9528,6 +9609,152 @@ function renderMHHTML(event, element, isPaint, nodes = []) {
9528
9609
  }
9529
9610
  }
9530
9611
 
9612
+ const fontSize = 12;
9613
+ const verPadding = 2;
9614
+ /**
9615
+ * 恒牙牙位图
9616
+ */
9617
+ class PermanentTeethElement extends DataElementLeaf {
9618
+ constructor() {
9619
+ super('permanent-teeth');
9620
+ this.props = new PermanentTeethProps();
9621
+ this.props.topLeft = '';
9622
+ this.props.topRight = '';
9623
+ this.props.bottomLeft = '';
9624
+ this.props.bottomRight = '';
9625
+ }
9626
+ setValue(val) {
9627
+ if (typeof val === 'string' && val) {
9628
+ const items = val.split(';');
9629
+ if (items.length >= 4) {
9630
+ this.props.topLeft = items[0];
9631
+ this.props.topRight = items[1];
9632
+ this.props.bottomLeft = items[2];
9633
+ this.props.bottomRight = items[3];
9634
+ }
9635
+ }
9636
+ else if (typeof val === 'object') {
9637
+ this.props.topLeft = val?.topLeft ?? '';
9638
+ this.props.topRight = val?.topRight ?? '';
9639
+ this.props.bottomLeft = val?.bottomLeft ?? '';
9640
+ this.props.bottomRight = val?.bottomRight ?? '';
9641
+ }
9642
+ }
9643
+ getValue() {
9644
+ const { topLeft, topRight, bottomLeft, bottomRight } = this.props;
9645
+ return `${topLeft};${topRight};${bottomLeft};${bottomRight}`;
9646
+ }
9647
+ clone(data) {
9648
+ const clone = new PermanentTeethElement();
9649
+ clone.props = this.props.clone();
9650
+ cloneElementBase(this, clone);
9651
+ return clone;
9652
+ }
9653
+ createRenderObject(data) {
9654
+ const clone = new PermanentTeethRenderObject(this);
9655
+ clone.rect.width = 150;
9656
+ //字体大小*2+上下间距2*2
9657
+ clone.rect.height = fontSize * 2 + verPadding * 2;
9658
+ //clone.rect= ElementUtil.cloneRect(this.rect);
9659
+ return clone;
9660
+ }
9661
+ serialize(viewOptions) {
9662
+ return {
9663
+ type: this.type,
9664
+ props: this.props.getSerializeProps(viewOptions)
9665
+ };
9666
+ }
9667
+ }
9668
+ class PermanentTeethRenderObject extends LeafRenderObject {
9669
+ clone() {
9670
+ const clone = new PermanentTeethRenderObject(this.element);
9671
+ clone.rect = ElementUtil.cloneRect(this.rect);
9672
+ return clone;
9673
+ }
9674
+ // measure(): { width: number, height: number } {
9675
+ // const ele = this.element;
9676
+ //
9677
+ // }
9678
+ exportHTML(event) {
9679
+ const ele = this.element;
9680
+ const g = super.exportHTML(event);
9681
+ const contentHorPadding = 4;
9682
+ g.children = [];
9683
+ // g.children.push(ElementUtil.getFillSvgPath(`M 0 ${this.rect.height / 2} h${this.rect.width}`, '#000', 1));
9684
+ // g.children.push(ElementUtil.getFillSvgPath(`M ${this.rect.width / 2} 0 v${this.rect.height}`, '#000', 1));
9685
+ //
9686
+ g.children.push(ElementUtil.getFillSvgRect(0, this.rect.height / 2, this.rect.width, 1, '#000'));
9687
+ g.children.push(ElementUtil.getFillSvgRect(this.rect.width / 2, 0, 1, this.rect.height, '#000'));
9688
+ const getSvgText = (text, x, y) => {
9689
+ return {
9690
+ sel: 'text',
9691
+ text: text,
9692
+ data: {
9693
+ ns: "http://www.w3.org/2000/svg",
9694
+ attrs: {
9695
+ 'dominant-baseline': 'hanging',
9696
+ 'font-family': 'Arial',
9697
+ 'font-size': fontSize,
9698
+ x,
9699
+ y,
9700
+ }
9701
+ },
9702
+ };
9703
+ };
9704
+ const topLeftWidth = event.renderCtx.mainContext.measureTextWidth(ele.props.topLeft, {
9705
+ fontSize: fontSize,
9706
+ fontName: 'Arial'
9707
+ });
9708
+ const bottomLeftWidth = event.renderCtx.mainContext.measureTextWidth(ele.props.bottomLeft, {
9709
+ fontSize: fontSize,
9710
+ fontName: 'Arial'
9711
+ });
9712
+ g.children.push(getSvgText(ele.props.topLeft, this.rect.width / 2 - topLeftWidth - contentHorPadding, verPadding));
9713
+ g.children.push(getSvgText(ele.props.topRight, this.rect.width / 2 + contentHorPadding, verPadding));
9714
+ g.children.push(getSvgText(ele.props.bottomLeft, this.rect.width / 2 - bottomLeftWidth - contentHorPadding, this.rect.height - fontSize + verPadding));
9715
+ g.children.push(getSvgText(ele.props.bottomRight, this.rect.width / 2 + contentHorPadding, this.rect.height - fontSize + verPadding));
9716
+ return g;
9717
+ }
9718
+ }
9719
+ class PermanentTeethFactory extends ElementFactory {
9720
+ match(type) {
9721
+ return type === 'permanent-teeth';
9722
+ }
9723
+ createElement(data) {
9724
+ const ele = new PermanentTeethElement();
9725
+ ele.props.bottomLeft = data.props?.bottomLeft ?? '';
9726
+ ele.props.bottomRight = data.props?.bottomRight ?? '';
9727
+ ele.props.topLeft = data.props?.topLeft ?? '';
9728
+ ele.props.topRight = data.props?.topRight ?? '';
9729
+ return ele;
9730
+ }
9731
+ }
9732
+ /**
9733
+ * 恒牙牙位图属性
9734
+ */
9735
+ class PermanentTeethProps extends INotifyPropertyChanged {
9736
+ topLeft;
9737
+ topRight;
9738
+ bottomLeft;
9739
+ bottomRight;
9740
+ getSerializeProps(viewOptions) {
9741
+ return {
9742
+ topLeft: this.topLeft,
9743
+ topRight: this.topRight,
9744
+ bottomLeft: this.bottomLeft,
9745
+ bottomRight: this.bottomRight,
9746
+ };
9747
+ }
9748
+ clone(dest) {
9749
+ dest = dest || new PermanentTeethProps();
9750
+ dest.topLeft = this.topLeft;
9751
+ dest.topRight = this.topRight;
9752
+ dest.bottomLeft = this.bottomLeft;
9753
+ dest.bottomRight = this.bottomRight;
9754
+ return dest;
9755
+ }
9756
+ }
9757
+
9531
9758
  class PictureElement extends LeafElement {
9532
9759
  //props: PictureProps;
9533
9760
  status = 'no';
@@ -9556,6 +9783,7 @@ class PictureElement extends LeafElement {
9556
9783
  clone(data) {
9557
9784
  const clone = new PictureElement();
9558
9785
  this.props.clone(clone.props);
9786
+ cloneElementBase(this, clone);
9559
9787
  return clone;
9560
9788
  }
9561
9789
  destroy() {
@@ -9681,6 +9909,7 @@ class RadioBoxElement extends LeafElement {
9681
9909
  clone() {
9682
9910
  const clone = new RadioBoxElement();
9683
9911
  this.props.clone(clone.props);
9912
+ cloneElementBase(this, clone);
9684
9913
  return clone;
9685
9914
  }
9686
9915
  }
@@ -9732,7 +9961,7 @@ class PageBreakElement extends LeafElement {
9732
9961
  }
9733
9962
  clone() {
9734
9963
  const clone = new PageBreakElement();
9735
- //clone.renderCtx = this.renderCtx;
9964
+ cloneElementBase(this, clone);
9736
9965
  return clone;
9737
9966
  }
9738
9967
  }
@@ -9769,7 +9998,9 @@ class TabElement extends LeafElement {
9769
9998
  };
9770
9999
  }
9771
10000
  clone() {
9772
- return new TabElement();
10001
+ const clone = new TabElement();
10002
+ cloneElementBase(this, clone);
10003
+ return clone;
9773
10004
  }
9774
10005
  }
9775
10006
  class TabRenderObject extends LeafRenderObject {
@@ -10364,6 +10595,7 @@ class SVGElement extends LeafElement {
10364
10595
  clone(data) {
10365
10596
  const clone = new SVGElement();
10366
10597
  this.props.clone(clone.props);
10598
+ cloneElementBase(this, clone);
10367
10599
  return clone;
10368
10600
  }
10369
10601
  destroy() {
@@ -10490,6 +10722,9 @@ class ElementSerialize {
10490
10722
  if (element.props && element.props['__attachedProperty'] && !result.props['__attachedProperty']) {
10491
10723
  result.props['__attachedProperty'] = CommonUtil.cloneValue(element.props['__attachedProperty']);
10492
10724
  }
10725
+ if (element.attribute) {
10726
+ result['attribute'] = this.serializeAttribute(element);
10727
+ }
10493
10728
  return result;
10494
10729
  }
10495
10730
  static serializeString(element, options = { all: false }) {
@@ -10512,6 +10747,21 @@ class ElementSerialize {
10512
10747
  }
10513
10748
  return "";
10514
10749
  }
10750
+ static serializeAttribute(element) {
10751
+ if (element.attribute) {
10752
+ const result = {};
10753
+ for (const key in element.attribute) {
10754
+ if (element.attribute[key] !== undefined && element.attribute[key] !== null) {
10755
+ result[key] = element.attribute[key];
10756
+ }
10757
+ }
10758
+ if (Object.keys(result).length === 0) {
10759
+ return null;
10760
+ }
10761
+ return CommonUtil.cloneValue(result);
10762
+ }
10763
+ return null;
10764
+ }
10515
10765
  /**
10516
10766
  * 获取选中的结构
10517
10767
  * @param ss
@@ -10610,12 +10860,8 @@ class TrackRunElement extends InlineGroupElement {
10610
10860
  clone(data) {
10611
10861
  const clone = new TrackRunElement(this.type);
10612
10862
  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
- }
10863
+ cloneElementBase(this, clone);
10864
+ cloneChildren(this, clone, data);
10619
10865
  return clone;
10620
10866
  }
10621
10867
  createRenderObject(data) {
@@ -12499,6 +12745,26 @@ class ElementUtil {
12499
12745
  ss.resetRange(ele.getChild(ele.length - 2), -1);
12500
12746
  }
12501
12747
  }
12748
+ static setEleAttribute(ele, attr, value) {
12749
+ if (!ele.attribute) {
12750
+ ele.attribute = {};
12751
+ }
12752
+ if (ele.attribute[attr] === value) {
12753
+ return;
12754
+ }
12755
+ ele.attribute[attr] = value;
12756
+ }
12757
+ static getEleAttribute(ele, attr) {
12758
+ if (ele.attribute) {
12759
+ return ele.attribute[attr];
12760
+ }
12761
+ return undefined;
12762
+ }
12763
+ static removeEleAttribute(ele, attr) {
12764
+ if (ele.attribute) {
12765
+ delete ele.attribute[attr];
12766
+ }
12767
+ }
12502
12768
  }
12503
12769
 
12504
12770
  class RenderContext {
@@ -13133,10 +13399,7 @@ class EditorContext {
13133
13399
  isDirty = false;
13134
13400
  cursorRect;
13135
13401
  _document;
13136
- //文档刷新的订阅事件
13137
- //refSub!: Subscription;
13138
13402
  syncRefresh;
13139
- //imageLoader: IImageLoader;
13140
13403
  dynamicFunc;
13141
13404
  docChange;
13142
13405
  clearPrevDocCb;
@@ -13190,6 +13453,7 @@ class EditorContext {
13190
13453
  //this.imageLoader.clear();
13191
13454
  this.dynamicFunc.destroyScripts();
13192
13455
  this.isDirty = false;
13456
+ //this.clearEleDepMaps();
13193
13457
  }
13194
13458
  get defaultCtx() {
13195
13459
  return new DocumentContext(this._document, this.selectionState);
@@ -13264,17 +13528,6 @@ class EditorContext {
13264
13528
  return this._document.modifyFlag === ModifyFlag$1.None ? 'appearance' : 'content';
13265
13529
  }
13266
13530
  }
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
13531
  /**
13279
13532
  * 文档上下文
13280
13533
  */
@@ -13537,13 +13790,23 @@ class DocumentContext {
13537
13790
  }
13538
13791
  }
13539
13792
 
13540
- class DynamicContextParser {
13793
+ class DynamicExecute {
13541
13794
  doc;
13542
13795
  ss;
13796
+ current;
13797
+ depItems;
13543
13798
  constructor(doc, ss) {
13544
13799
  this.doc = doc;
13545
13800
  this.ss = ss;
13546
13801
  }
13802
+ setCurrentCtx(ele, depItems) {
13803
+ this.current = ele;
13804
+ this.depItems = depItems;
13805
+ }
13806
+ clearCurrentCtx() {
13807
+ this.current = undefined;
13808
+ this.depItems = undefined;
13809
+ }
13547
13810
  cacheList;
13548
13811
  getControlById(id) {
13549
13812
  if (!this.cacheList) {
@@ -13555,6 +13818,10 @@ class DynamicContextParser {
13555
13818
  //return this.cacheList.find(item => item['props']['id'] === id);
13556
13819
  }
13557
13820
  getObject(id) {
13821
+ //如果当前存在编译缓存,则直接从缓存中获取
13822
+ if (this.depItems && this.depItems.has(id)) {
13823
+ return this.depItems.get(id);
13824
+ }
13558
13825
  new DocumentContext(this.doc, this.ss);
13559
13826
  if (id.startsWith('$')) {
13560
13827
  id = id.slice(1);
@@ -13573,6 +13840,9 @@ class DynamicContextParser {
13573
13840
  if (control) {
13574
13841
  control.setValue(val);
13575
13842
  }
13843
+ },
13844
+ get ref() {
13845
+ return control;
13576
13846
  }
13577
13847
  };
13578
13848
  }
@@ -13644,9 +13914,12 @@ class DynamicContextParser {
13644
13914
  class ParagraphMeasure {
13645
13915
  options;
13646
13916
  renderCtx;
13647
- constructor(options, renderCtx) {
13917
+ execute;
13918
+ constructor(options, renderCtx, execute) {
13648
13919
  this.options = options;
13649
13920
  this.renderCtx = renderCtx;
13921
+ this.execute = execute;
13922
+ this.execute = execute;
13650
13923
  }
13651
13924
  /**
13652
13925
  * 段落排版:
@@ -13742,7 +14015,10 @@ class ParagraphMeasure {
13742
14015
  const paraRenders = [];
13743
14016
  for (let i = 0; i < paraModels.length; i++) {
13744
14017
  const innerLineRects = paraModels[i].innerLine;
13745
- let render = p.createRenderObject();
14018
+ let render = this.createRenderObject(p);
14019
+ if (!render) {
14020
+ return [];
14021
+ }
13746
14022
  render.setRenderWidth(limitWidth);
13747
14023
  paraRenders.push(render);
13748
14024
  for (let j = 0; j < innerLineRects.length; j++) {
@@ -13883,7 +14159,7 @@ class ParagraphMeasure {
13883
14159
  }
13884
14160
  arrangeInlineGroupElement(parentLine, ele) {
13885
14161
  const { options, renderCtx } = this;
13886
- let render = ele.createRenderObject({ options, renderCtx });
14162
+ let render = this.createRenderObject(ele);
13887
14163
  //记录多行情况下的渲染对象,用于计算总长度,生成fill-null-space
13888
14164
  const inlineGroupRenders = [];
13889
14165
  ele.cacheRender = render;
@@ -13937,10 +14213,7 @@ class ParagraphMeasure {
13937
14213
  const baseTextProps = ele.props;
13938
14214
  nullText.text = baseTextProps.nullText;
13939
14215
  baseTextProps.nullTextProps.clone(nullText.props);
13940
- const nullTextRender = nullText.createRenderObject({
13941
- options: this.options,
13942
- renderCtx: this.renderCtx
13943
- });
14216
+ const nullTextRender = this.createRenderObject(nullText);
13944
14217
  //inlineGroupRender.insertChild(nullTextRender, 1);
13945
14218
  this.arrangeLeafRender(data, nullTextRender);
13946
14219
  }
@@ -13969,7 +14242,7 @@ class ParagraphMeasure {
13969
14242
  }
13970
14243
  }
13971
14244
  arrangeLeafElement(parentLine, ele) {
13972
- ele.cacheRender = ele.createRenderObject({ options: this.options, renderCtx: this.renderCtx });
14245
+ ele.cacheRender = this.createRenderObject(ele);
13973
14246
  if (ele.cacheRender) {
13974
14247
  this.arrangeLeafRender(parentLine, ele.cacheRender);
13975
14248
  }
@@ -14166,11 +14439,85 @@ class ParagraphMeasure {
14166
14439
  }
14167
14440
  throw new Error('未到达计算位置');
14168
14441
  }
14169
- }
14170
-
14171
- /**
14172
- * 用于处理选区拖蓝
14173
- */
14442
+ /**
14443
+ * 解析可见性表达式
14444
+ * @param ele
14445
+ * @param execute
14446
+ * @private
14447
+ */
14448
+ parseVisibleExpression(ele, execute) {
14449
+ if (ele.visibleExpr)
14450
+ return;
14451
+ if (!ele.attribute?.visibleExpr)
14452
+ return;
14453
+ const reactiveMode = this.renderCtx.drawMode !== 'print';
14454
+ try {
14455
+ const depIdItems = [];
14456
+ const depEleMap = new Map();
14457
+ let compliedCode = parser(ele.attribute?.visibleExpr, depIdItems);
14458
+ compliedCode = addReturn(compliedCode);
14459
+ if (depIdItems.length) {
14460
+ depIdItems.forEach(dep => {
14461
+ const refCtx = execute.getObject(dep);
14462
+ if (refCtx.ref) {
14463
+ const refEle = refCtx.ref.item;
14464
+ depEleMap.set(dep, refCtx);
14465
+ //当前有可能是checkbox数组
14466
+ const refEles = Array.isArray(refEle) ? refEle : [refEle];
14467
+ reactiveMode && refEles.forEach(item => {
14468
+ //求值依赖元素更改的时候,发布当前元素重新计算的指令
14469
+ item.onChangeSubject.subscribe(() => {
14470
+ ele.pubOnChange('self');
14471
+ });
14472
+ });
14473
+ }
14474
+ });
14475
+ }
14476
+ ele.visibleExpr = { compliedCode, func: new Function(`with(this){ ${compliedCode} }`), depItems: depEleMap };
14477
+ }
14478
+ catch (e) {
14479
+ console.error('解析表达式出错', ele.attribute?.visibleExpr);
14480
+ }
14481
+ }
14482
+ /**
14483
+ * 元素可见行求值
14484
+ * @param ele
14485
+ * @param executeCtx
14486
+ * @private
14487
+ */
14488
+ evalVisibleExpr(ele, executeCtx) {
14489
+ if (ele.visibleExpr && ele.visibleExpr.func) {
14490
+ try {
14491
+ executeCtx.setCurrentCtx(ele, ele.visibleExpr.depItems);
14492
+ const func = ele.visibleExpr.func.bind(executeCtx);
14493
+ return func() === true;
14494
+ }
14495
+ catch (e) {
14496
+ console.error(e, "表达式执行出错", ele.visibleExpr.compliedCode);
14497
+ }
14498
+ finally {
14499
+ executeCtx.clearCurrentCtx();
14500
+ }
14501
+ }
14502
+ return true;
14503
+ }
14504
+ createRenderObject(element) {
14505
+ if (this.options.enableVisibleExpression) {
14506
+ this.parseVisibleExpression(element, this.execute);
14507
+ if (!this.evalVisibleExpr(element, this.execute)) {
14508
+ return null;
14509
+ }
14510
+ }
14511
+ return element.createRenderObject({
14512
+ options: this.options,
14513
+ renderCtx: this.renderCtx
14514
+ });
14515
+ }
14516
+ }
14517
+
14518
+ /**
14519
+ * 用于处理选区拖蓝
14520
+ */
14174
14521
  class SelectionOverlays {
14175
14522
  selectionState;
14176
14523
  selectionRange;
@@ -14297,6 +14644,8 @@ class DocumentArrange {
14297
14644
  renderCtx;
14298
14645
  seo;
14299
14646
  options;
14647
+ execute;
14648
+ pMeasure;
14300
14649
  constructor(docCtx, renderCtx, seo) {
14301
14650
  this.docCtx = docCtx;
14302
14651
  this.renderCtx = renderCtx;
@@ -14316,10 +14665,12 @@ class DocumentArrange {
14316
14665
  //测量阶段,对于空段落会插入段落符号,新表格会插入空段落,此时不需要记录节点的更改,以最大的节点进行记录
14317
14666
  return suppressTracking(() => {
14318
14667
  const doc = this.docCtx.document;
14668
+ this.execute = new DynamicExecute(doc, this.docCtx.selectionState);
14669
+ this.pMeasure = new ParagraphMeasure(this.options, this.renderCtx, this.execute);
14319
14670
  const data = {
14320
14671
  doc,
14321
14672
  viewOptions: this.options,
14322
- parser: new DynamicContextParser(doc, this.docCtx.selectionState),
14673
+ execute: this.execute,
14323
14674
  createParaFn: () => this.createDefaultPara()
14324
14675
  };
14325
14676
  doc.clearMarkItems();
@@ -14435,15 +14786,6 @@ class DocumentArrange {
14435
14786
  cloneFooterRender.rect.x = limitRect.x;
14436
14787
  cloneFooterRender.rect.y = documentRender.rect.height - bodyMarginBottom;
14437
14788
  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
14789
  currColumn++;
14448
14790
  if (currColumn === docColumns) {
14449
14791
  currColumn = 0;
@@ -14454,7 +14796,7 @@ class DocumentArrange {
14454
14796
  return docPages;
14455
14797
  }
14456
14798
  createEmptyBodyRender(bodyRender, limitRect) {
14457
- const pageBodyRender = this.createRenderObject(bodyRender.element);
14799
+ const pageBodyRender = this.pMeasure.createRenderObject(bodyRender.element);
14458
14800
  pageBodyRender.rect.width = limitRect.width;
14459
14801
  const bodyInnerLimitRect = pageBodyRender.getInnerRect();
14460
14802
  if (this.options.fullPageView) {
@@ -14470,12 +14812,11 @@ class DocumentArrange {
14470
14812
  return element.cacheRender;
14471
14813
  }
14472
14814
  if (element instanceof BlockContentElement) {
14473
- const pRange = new ParagraphMeasure(this.options, this.renderCtx);
14474
- return pRange.measureParagraph(element, maxWidth);
14815
+ return this.pMeasure.measureParagraph(element, maxWidth);
14475
14816
  }
14476
14817
  else if (element instanceof BlockContainerElement) {
14477
14818
  const renders = [];
14478
- let render = this.createRenderObject(element);
14819
+ let render = this.pMeasure.createRenderObject(element);
14479
14820
  if (!render) {
14480
14821
  element.cacheRender = null;
14481
14822
  return null;
@@ -14488,8 +14829,8 @@ class DocumentArrange {
14488
14829
  const innerMaxWidth = render.getInnerMaxWidth();
14489
14830
  for (let i = 0; i < element.length; i++) {
14490
14831
  const child = element.getChild(i);
14491
- const blockContentELement = child;
14492
- const childRender = this.measureControl(blockContentELement, innerMaxWidth);
14832
+ const blockContentElement = child;
14833
+ const childRender = this.measureControl(blockContentElement, innerMaxWidth);
14493
14834
  if (!childRender) {
14494
14835
  continue;
14495
14836
  }
@@ -14499,7 +14840,7 @@ class DocumentArrange {
14499
14840
  }
14500
14841
  for (let j = 0; j < childRender.length; j++) {
14501
14842
  if (j > 0) {
14502
- render = this.createRenderObject(element);
14843
+ render = this.pMeasure.createRenderObject(element);
14503
14844
  if (!render.rect.width) {
14504
14845
  render.setRenderWidth(maxWidth);
14505
14846
  }
@@ -14527,12 +14868,6 @@ class DocumentArrange {
14527
14868
  textLineRenderMode(cacheRender, { options: this.options, renderCtx: this.renderCtx });
14528
14869
  }
14529
14870
  }
14530
- createRenderObject(element) {
14531
- return element.createRenderObject({
14532
- options: this.options,
14533
- renderCtx: this.renderCtx
14534
- });
14535
- }
14536
14871
  getDocInnerRect(documentRender) {
14537
14872
  const render = documentRender.element.createRenderObject();
14538
14873
  render.padding = documentRender.padding;
@@ -14551,7 +14886,7 @@ class DocumentArrange {
14551
14886
  if (render instanceof TableRenderObject) {
14552
14887
  return this.cutTable(render, limitHeight);
14553
14888
  }
14554
- const cloneRender = this.createRenderObject(render.element);
14889
+ const cloneRender = this.pMeasure.createRenderObject(render.element);
14555
14890
  cloneRender.setRenderWidth(render.rect.width);
14556
14891
  if (render instanceof MuiltBlockLineRenderObject) {
14557
14892
  let sumHeight = 0;
@@ -14728,7 +15063,7 @@ class DocumentArrange {
14728
15063
  for (let i = 0; i < cutCellRenders.length; i++) {
14729
15064
  let cellRender = cutCellRenders[i];
14730
15065
  if (!cellRender) {
14731
- cellRender = this.createRenderObject(cellRenders[i].element);
15066
+ cellRender = this.pMeasure.createRenderObject(cellRenders[i].element);
14732
15067
  cellRender.rect = ElementUtil.cloneRect(cellRenders[i].rect);
14733
15068
  cellRender.rect.height = 0;
14734
15069
  ElementUtil.remeasure(cellRender);
@@ -14844,647 +15179,18 @@ class DocumentArrange {
14844
15179
  return -1;
14845
15180
  }
14846
15181
  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
- }
15182
+ const rows = [];
15183
+ for (let i = 0; i < tb.length; i++) {
15184
+ const rowRender = tb.getChild(i);
15185
+ const rowEle = rowRender.element;
15186
+ if (rowEle.props.headerRow) {
15187
+ rows.push(rowRender);
15465
15188
  }
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
- }
15189
+ else {
15190
+ break;
15479
15191
  }
15480
- x += child.rect.width;
15481
- }
15482
- if (!cutRender.length) {
15483
- return { firstItem: null, lastItem: null };
15484
15192
  }
15485
- ElementUtil.remeasureInlineGroupRender(cutRender);
15486
- ElementUtil.remeasureInlineGroupRender(render);
15487
- return { firstItem: cutRender, lastItem: render.length ? render : null, br };
15193
+ return rows;
15488
15194
  }
15489
15195
  /**
15490
15196
  * 修改测量完毕后的元素状态
@@ -15497,29 +15203,105 @@ class ElementMeasure {
15497
15203
  }
15498
15204
  }
15499
15205
  ele.modifyFlag = ModifyFlag$1.None;
15206
+ if (!ele.loaded) {
15207
+ ele.loaded = true;
15208
+ }
15500
15209
  }
15501
15210
  clearPaintCache(ele, data) {
15211
+ ele.paintRenders.length = 0;
15502
15212
  ele.beginMeasure(data);
15213
+ this.identifyComment(ele);
15503
15214
  if (ele instanceof BranchElement) {
15504
15215
  for (let i = 0; i < ele.length; i++) {
15505
15216
  this.clearPaintCache(ele.getChild(i), data);
15506
15217
  }
15507
15218
  }
15508
15219
  }
15220
+ identifyComment(ele) {
15221
+ if (ele instanceof CommentElement) {
15222
+ this.docCtx.document.identifyCommMark(ele);
15223
+ }
15224
+ }
15225
+ cacheDoc;
15226
+ cacheDocRenders(docs) {
15227
+ docs.forEach(doc => {
15228
+ this.cacheDoc = doc;
15229
+ this.cacheRenders(doc);
15230
+ });
15231
+ this.cacheDoc = null;
15232
+ }
15233
+ /**
15234
+ * 生成批注区间信息
15235
+ * @param renderTree
15236
+ */
15237
+ generateCommRange() {
15238
+ this.seo.commRangeSets.clear();
15239
+ const commMarks = this.docCtx.document.markPairs;
15240
+ for (let i = 0; i < commMarks.length; i++) {
15241
+ const commMark = commMarks[i];
15242
+ if (commMark.start && commMark.end) {
15243
+ const ancestor = DocumentSelection.getAncestorCommonControl(commMark.start, commMark.end);
15244
+ const range = RangeUtil.getSectionRange(commMark.start, 0, commMark.end, 1, ancestor);
15245
+ SelectionOverlays.addToCommentSets(range, this.seo.commRangeSets, commMark.start.color);
15246
+ }
15247
+ }
15248
+ }
15249
+ cacheRenders(renderTree) {
15250
+ if (renderTree.element) {
15251
+ renderTree.element.paintRenders.push(renderTree);
15252
+ }
15253
+ for (let i = 0; i < renderTree.length; i++) {
15254
+ const currRender = renderTree.getChild(i);
15255
+ if (currRender.element) {
15256
+ this.cacheCommsRender(currRender);
15257
+ }
15258
+ if (currRender instanceof BranchRenderObject) {
15259
+ this.cacheRenders(currRender);
15260
+ }
15261
+ else {
15262
+ currRender.element && currRender.element.paintRenders.push(currRender);
15263
+ }
15264
+ }
15265
+ }
15266
+ /**
15267
+ * 缓存批注标志
15268
+ * @private
15269
+ */
15270
+ cacheCommsRender(render) {
15271
+ if (render.element && render.element.type === 'comm') {
15272
+ const commElement = render.element;
15273
+ if (commElement.props.markType === 'start') {
15274
+ const currDocRender = this.cacheDoc;
15275
+ const docCommContainer = currDocRender.getItems().find(item => item instanceof CommsContainerRenderObject);
15276
+ if (docCommContainer) {
15277
+ docCommContainer.commsMarks.push(render);
15278
+ }
15279
+ }
15280
+ }
15281
+ if (render.element && render.element.type === 'comm-list') {
15282
+ const commContainer = render;
15283
+ CommentsUtil.createCommentsImage(commContainer);
15284
+ }
15285
+ }
15509
15286
  endMeasures(ele) {
15287
+ ele.endMeasure();
15510
15288
  if (ele instanceof BranchElement) {
15511
15289
  for (let i = 0; i < ele.length; i++) {
15512
15290
  this.endMeasures(ele.getChild(i));
15513
15291
  }
15514
15292
  }
15515
15293
  }
15294
+ createDefaultPara() {
15295
+ const tmp = new ParagraphElement();
15296
+ tmp.props.lineHeight = this.options.defaultLineHeight;
15297
+ return tmp;
15298
+ }
15516
15299
  }
15517
15300
 
15518
15301
  class DocumentPaint {
15519
15302
  renderContext;
15520
15303
  docCtx;
15521
15304
  seo;
15522
- elementMeasure;
15523
15305
  //elementRenderCut: ElementRenderCut;
15524
15306
  elementPaint;
15525
15307
  docPages;
@@ -15531,7 +15313,6 @@ class DocumentPaint {
15531
15313
  this.docCtx = docCtx;
15532
15314
  this.seo = seo;
15533
15315
  this.viewOptions = this.docCtx.viewOptions;
15534
- this.elementMeasure = new ElementMeasure(this.docCtx, this.renderContext);
15535
15316
  //this.elementRenderCut = new ElementRenderCut(this.viewOptions, this.renderContext);
15536
15317
  this.elementPaint = new ElementPaint(this.renderContext, this.docCtx);
15537
15318
  }
@@ -15691,130 +15472,6 @@ class DocumentPaint {
15691
15472
  }
15692
15473
  }
15693
15474
 
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
15475
  class ElementReader {
15819
15476
  docCtx;
15820
15477
  constructor(docCtx) {
@@ -15878,29 +15535,18 @@ class ElementReader {
15878
15535
  this.setDocument(document);
15879
15536
  }
15880
15537
  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
15538
  document.bodyElement = document.find((item) => item instanceof DocumentBodyElement);
15887
15539
  document.headerElement = document.find((item) => item instanceof DocumentHeaderElement);
15888
15540
  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
15541
  document.clearItems();
15894
15542
  document.addChild(document.headerElement);
15895
15543
  document.addChild(document.bodyElement);
15896
15544
  document.addChild(document.footerElement);
15897
- //document.addChild(document.commentsContainerElement);
15898
15545
  this.docCtx.document = document;
15899
15546
  document.viewOptions = this.docCtx.viewOptions;
15900
15547
  const width = Math.floor(document.props.width * this.docCtx.viewOptions.mmToPixelsRatio);
15901
15548
  const height = Math.floor(document.props.height * this.docCtx.viewOptions.mmToPixelsRatio);
15902
15549
  this.docCtx.viewOptions.docPageSettings = new PageOptions(width, height, document.props.orient);
15903
- //this.viewOptions.viewSettings.width = this.viewOptions.docPageSettings.width + 10;
15904
15550
  }
15905
15551
  readElement(data, strictMode = false) {
15906
15552
  if (typeof data === 'string') {
@@ -15922,6 +15568,7 @@ class ElementReader {
15922
15568
  }
15923
15569
  }
15924
15570
  factory.readCompleted(element, childArr);
15571
+ this.readAttribute(data, element);
15925
15572
  return element;
15926
15573
  }
15927
15574
  }
@@ -15933,6 +15580,11 @@ class ElementReader {
15933
15580
  return null;
15934
15581
  }
15935
15582
  }
15583
+ readAttribute(data, ele) {
15584
+ if (data.attribute) {
15585
+ ele.attribute = data.attribute;
15586
+ }
15587
+ }
15936
15588
  /**
15937
15589
  * 读取扩展属性
15938
15590
  * @param data
@@ -17186,7 +16838,6 @@ class DocumentEvent {
17186
16838
  startHitInfo: this.startHitInfo,
17187
16839
  endHitInfo: this.endHitInfo
17188
16840
  });
17189
- console.log(this.endHitInfo);
17190
16841
  }
17191
16842
  /**
17192
16843
  * 获取鼠标所在的渲染元素对象
@@ -20156,7 +19807,8 @@ class ElementTrackManage {
20156
19807
  * @private
20157
19808
  */
20158
19809
  mergeOps(ops) {
20159
- return false;
19810
+ return this.mergeFormatOps(ops);
19811
+ //return false;
20160
19812
  //问题在于:
20161
19813
  //1.新输入的字符串,selectState的startOffset、endOffset=1,后输入的字符串的endOffset进行累加
20162
19814
  //2.撤销后重做,选区范围在1-2,英国是0-2,因为之前在创建文本对象后,选区的结束位为1
@@ -20207,6 +19859,41 @@ class ElementTrackManage {
20207
19859
  // }
20208
19860
  // return false;
20209
19861
  }
19862
+ /**
19863
+ * 将对某个元素的最近两次的属性修改合并为一次,ops为当前记录的修改,比较上次的修改,如果为对同一个元素的修改,则合并
19864
+ * @private
19865
+ */
19866
+ mergeFormatOps(ops) {
19867
+ if (ops.length > 1) {
19868
+ return false;
19869
+ }
19870
+ const lastOps = this.actions[this.actions.length - 1];
19871
+ if (!lastOps || lastOps.ops.length > 1) {
19872
+ return false;
19873
+ }
19874
+ const prevOp = lastOps.ops[lastOps.ops.length - 1];
19875
+ const currOp = ops[0];
19876
+ //操作类型相同
19877
+ if ('format' in currOp.ops && 'format' in prevOp.ops && currOp.index === prevOp.index) {
19878
+ // const prevAfterSelection = lastOps.afterSelection;
19879
+ // if (!prevAfterSelection) {
19880
+ // return false;
19881
+ // }
19882
+ //前后是连续的操作
19883
+ const { format: currFormat } = currOp.ops;
19884
+ const { format: prevFormat } = prevOp.ops;
19885
+ Object.keys(currFormat).forEach(key => {
19886
+ const currValue = currFormat[key].newValue;
19887
+ const prevValue = prevFormat[key].newValue;
19888
+ if (CommonUtil.isEqual(currValue, prevValue)) {
19889
+ return;
19890
+ }
19891
+ prevFormat[key].newValue = currValue;
19892
+ });
19893
+ return true;
19894
+ }
19895
+ return false;
19896
+ }
20210
19897
  getSelection() {
20211
19898
  const { startControl, startOffset, endControl, endOffset, editable } = this.docCtx.selectionState;
20212
19899
  if (!startControl) {
@@ -28119,7 +27806,7 @@ class DocEditor {
28119
27806
  rule.setRuleOptions({ width: this.viewOptions.docPageSettings.width, pagePL, pagePR, docLeft });
28120
27807
  }
28121
27808
  version() {
28122
- return "2.1.20";
27809
+ return "2.1.21";
28123
27810
  }
28124
27811
  switchPageHeaderEditor() {
28125
27812
  this.docCtx.document.switchPageHeaderEditor(this.selectionState, null);
@@ -28172,6 +27859,26 @@ class DocumentCombine {
28172
27859
  }
28173
27860
  }
28174
27861
 
27862
+ /**
27863
+ * 文字行渲染模式
27864
+ 用于医嘱打印模式
27865
+ */
27866
+ function runTextLineRender(ele, data) {
27867
+ if (!data.options.textRowLineMode) {
27868
+ return;
27869
+ }
27870
+ if (ele instanceof TableElement) {
27871
+ // textLineRenderMode(ele, data);
27872
+ // remeasureParentRenders(ele.cacheRender)
27873
+ return;
27874
+ }
27875
+ if (ele instanceof BranchElement) {
27876
+ for (let i = 0; i < ele.length; i++) {
27877
+ runTextLineRender(ele.getChild(i), data);
27878
+ }
27879
+ }
27880
+ }
27881
+
28175
27882
  /**
28176
27883
  * 删除当前段落
28177
27884
  * @param evt
@@ -28303,5 +28010,5 @@ function removeDuplicatesEvent(events) {
28303
28010
  return arr;
28304
28011
  }
28305
28012
 
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 };
28013
+ 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
28014
  //# sourceMappingURL=index.js.map