@hailin-zheng/editor-core 2.2.6 → 2.2.8

Sign up to get free protection for your applications and to get access to all the features.
package/index.js CHANGED
@@ -388,7 +388,6 @@ class BlockContentRenderObject extends BranchRenderObject {
388
388
  }
389
389
  }
390
390
  class InlineGroupRenderObject extends BranchRenderObject {
391
- paintPos;
392
391
  }
393
392
  /**
394
393
  * 包含块级渲染元素的容器元素,例如body、table-cell等
@@ -402,18 +401,18 @@ class BlockContainerRenderObject extends BranchRenderObject {
402
401
  /**
403
402
  * 多级 ‘BlockLineRectRenderObject’ 包裹元素,例如 p、table
404
403
  */
405
- class MuiltBlockLineRenderObject extends BlockContentRenderObject {
404
+ class MultiBlockLineRenderObject extends BlockContentRenderObject {
406
405
  }
407
406
  /**
408
407
  * 容器-子内容为多个行内块级元素,例如table-row
409
408
  */
410
- class InlineBlockContainer extends MuiltBlockLineRenderObject {
409
+ class InlineBlockContainer extends MultiBlockLineRenderObject {
411
410
  }
412
411
  /**
413
412
  * 服务于table-cell
414
413
  * 可被多级拆分的元素
415
414
  */
416
- class InlineMuiltBlockLineRenderObject extends MuiltBlockLineRenderObject {
415
+ class InlineMuiltBlockLineRenderObject extends MultiBlockLineRenderObject {
417
416
  }
418
417
  /**
419
418
  * 最小不可分割单位的块级行框,例如 p-line
@@ -1697,12 +1696,22 @@ class ViewOptions {
1697
1696
  defaultColor = "#000000";
1698
1697
  currentFontSize = 14;
1699
1698
  currentFontName = '宋体';
1700
- selectionOverlaysColor = 'rgb(131,175,155,0.5)';
1701
- dataEleOverlaysColor = 'rgb(131,175,155,0.5)';
1702
- dataEleFocusedBgColor = 'rgb(131,175,155,0.8)';
1699
+ //选区颜色
1700
+ selectionColor = 'rgb(131,175,155,0.5)';
1701
+ dataDecoratorNormalColor = '#0050b3';
1702
+ dataDecoratorMouseEnterColor = '#0050b3';
1703
+ dataDecoratorFocusedColor = '#0050b3';
1704
+ //数据元没有输入值时背景颜色
1705
+ dataEleEmptyBgColor = '';
1706
+ //数据元鼠标悬浮颜色
1707
+ dataEleMouseEnterBgColor = '#d9d9d9';
1708
+ //数据元只读背景颜色
1709
+ dataEleReadOnlyBgColor = '#d9d9d9';
1710
+ //数据元焦点背景颜色
1711
+ dataEleFocusedBgColor = '#d9d9d9';
1712
+ //数据元正常背景颜色
1713
+ dataEleNormalBgColor = '#fafafa';
1703
1714
  dataEleErrorBgColor = '#ff4d4f';
1704
- dataEleReadOnlyOverlayColor = '#d9d9d9';
1705
- dataEleOutlineColor = 'rgb(131,175,155,0.7)';
1706
1715
  viewBackcolor = 'rgb(230,230,230)';
1707
1716
  paraSymbolColor = 'rgb(128,128,128)';
1708
1717
  dataGroupColor = 'rgb(0,80,179)';
@@ -1717,7 +1726,6 @@ class ViewOptions {
1717
1726
  showCharRect;
1718
1727
  //数据元交互修饰模式
1719
1728
  dataEleDecoratorMode = 'outline';
1720
- dataEleDecoratorColor = '#0050b3';
1721
1729
  showTabChar;
1722
1730
  showSpaceChar;
1723
1731
  showLineBreak;
@@ -2499,6 +2507,10 @@ class DataEleListProps extends DataEleBaseTextProps {
2499
2507
  super();
2500
2508
  }
2501
2509
  options = [];
2510
+ /**
2511
+ * 是否保存选项到病历文件里面
2512
+ */
2513
+ saveOptions = true;
2502
2514
  dropDownStyle;
2503
2515
  /**
2504
2516
  * 是否允许多选
@@ -2829,28 +2841,14 @@ class ValidateProps {
2829
2841
  return clone;
2830
2842
  }
2831
2843
  }
2832
- class DataElementGroupProps extends INotifyPropertyChanged {
2833
- id;
2834
- name;
2835
- hidden;
2844
+ class DataElementGroupProps extends DataEleBaseProps {
2836
2845
  clone(dest) {
2837
- dest = dest ?? new DataElementGroupProps();
2838
- dest.id = this.id;
2839
- dest.name = this.name;
2840
- dest.hidden = this.hidden;
2846
+ const clone = dest ?? new DataElementGroupProps();
2847
+ super.cloneBaseProps(clone);
2841
2848
  }
2842
- getSerializeProps() {
2849
+ getSerializeProps(options) {
2843
2850
  const props = {};
2844
- if (this.id) {
2845
- props.id = this.id;
2846
- }
2847
- if (this.name) {
2848
- props.name = this.name;
2849
- }
2850
- if (this.hidden) {
2851
- props.hidden = this.hidden;
2852
- }
2853
- return props;
2851
+ return this.getBaseProps(props, options);
2854
2852
  }
2855
2853
  }
2856
2854
  class DataElementBarcodeProps {
@@ -2910,7 +2908,7 @@ class DataDecorateElement extends LeafElement {
2910
2908
  const render = new DataDecorateRenderObject(this);
2911
2909
  //render.rect.width = this.dProps.size / 2;
2912
2910
  render.rect.width = 1;
2913
- render.rect.height = 14;
2911
+ render.rect.height = Math.ceil(14 * TEXT_HEIGHT_FACTOR);
2914
2912
  return render;
2915
2913
  }
2916
2914
  serialize() {
@@ -2933,6 +2931,17 @@ class DataDecorateRenderObject extends LeafRenderObject {
2933
2931
  if (event.mode === 'print') {
2934
2932
  return null;
2935
2933
  }
2934
+ // if(this.element.parent.parent.type==='data-group'){
2935
+ // return null;
2936
+ // }
2937
+ const options = event.options;
2938
+ let color = options.dataDecoratorNormalColor;
2939
+ if (this.element.dataEle.isMouseenter && options.dataDecoratorMouseEnterColor) {
2940
+ color = options.dataDecoratorMouseEnterColor;
2941
+ }
2942
+ if (this.element.dataEle.isFocused && options.dataDecoratorFocusedColor) {
2943
+ color = options.dataDecoratorFocusedColor;
2944
+ }
2936
2945
  const element = this.element;
2937
2946
  const lineWidth = 3;
2938
2947
  let path = '';
@@ -2946,7 +2955,7 @@ class DataDecorateRenderObject extends LeafRenderObject {
2946
2955
  path = `M ${x - lineWidth} 2 L ${x} 2 L ${x} ${height} L ${x - lineWidth} ${height}`;
2947
2956
  }
2948
2957
  return ElementUtil.createSvgPath({
2949
- stroke: '#0050b3',
2958
+ stroke: color,
2950
2959
  fill: "none",
2951
2960
  'stroke-width': 1,
2952
2961
  d: path
@@ -3112,7 +3121,7 @@ class ParagraphElement extends BlockContentElement {
3112
3121
  return new ParagraphElement();
3113
3122
  }
3114
3123
  }
3115
- class ParagraphRenderObject extends MuiltBlockLineRenderObject {
3124
+ class ParagraphRenderObject extends MultiBlockLineRenderObject {
3116
3125
  /**
3117
3126
  * 绘制项目符号
3118
3127
  */
@@ -3661,7 +3670,7 @@ class DocumentRenderObject extends BlockContainerRenderObject {
3661
3670
  },
3662
3671
  },
3663
3672
  children: [
3664
- pageCorner, copyright, highlight, ...CommonUtil.toArray(event.getChildNodes(this)), pageNum, selection
3673
+ pageCorner, highlight, ...CommonUtil.toArray(event.getChildNodes(this)), pageNum, selection, copyright
3665
3674
  ]
3666
3675
  };
3667
3676
  }
@@ -3699,11 +3708,10 @@ class DocumentRenderObject extends BlockContainerRenderObject {
3699
3708
  }
3700
3709
  const str = "\u6f14\u793a\u7248\u672c";
3701
3710
  const textProps = new TextProps();
3702
- textProps.color = "#000";
3703
- textProps.fontName = '仿宋';
3711
+ textProps.color = "#bfbfbf";
3712
+ textProps.fontName = '宋体';
3704
3713
  textProps.fontSize = 80;
3705
3714
  textProps.fontStyle = 'italic';
3706
- event.renderCtx.contentContext.measureText(str, textProps);
3707
3715
  const getTextRotationAngle = (width, height) => {
3708
3716
  return Math.atan(height / width) * 180 / Math.PI;
3709
3717
  };
@@ -3722,6 +3730,7 @@ class DocumentRenderObject extends BlockContainerRenderObject {
3722
3730
  'font-size': textProps.fontSize,
3723
3731
  "stroke": textProps.color,
3724
3732
  'fill': '#fff',
3733
+ 'opacity': '0.5',
3725
3734
  x: this.rect.width / 2,
3726
3735
  y: this.rect.height / 2,
3727
3736
  }
@@ -3933,19 +3942,83 @@ class DataElementInlineGroup extends InlineGroupInputElement {
3933
3942
  expressFn;
3934
3943
  beginMeasure(data) {
3935
3944
  super.beginMeasure(data);
3936
- if (!this.props.expression || !data.viewOptions.enableDyExpression) {
3945
+ // if (!this.props.expression || !data.options.enableDyExpression) {
3946
+ // return;
3947
+ // }
3948
+ // try {
3949
+ // if (!this.expressFn) {
3950
+ // const code = parser(this.props.expression);
3951
+ // this.expressFn = new Function(`with(this){ ${code} }`);
3952
+ // }
3953
+ // this.expressFn.bind(data.execute)();
3954
+ // //this.expressFn();
3955
+ // } catch (e) {
3956
+ // this.expressFn = new Function();
3957
+ // }
3958
+ }
3959
+ parserExpress;
3960
+ /**
3961
+ * 解析可见性表达式
3962
+ * @param ele
3963
+ * @param execute
3964
+ * @private
3965
+ */
3966
+ parseEleExpression(data) {
3967
+ const execute = data.execute;
3968
+ //不存在表达式,或者不启用表达式,不做处理
3969
+ if (!this.props.expression || !data.options.enableDyExpression)
3937
3970
  return;
3938
- }
3971
+ //存在表达式,并且已经解析过,不再做处理
3972
+ if (this.parserExpress)
3973
+ return;
3974
+ const reactiveMode = data.renderCtx.drawMode !== 'print';
3939
3975
  try {
3940
- if (!this.expressFn) {
3941
- const code = parser(this.props.expression);
3942
- this.expressFn = new Function(`with(this){ ${code} }`);
3976
+ const depIdItems = [];
3977
+ const depEleMap = new Map();
3978
+ let compliedCode = parser(this.props.expression, depIdItems);
3979
+ compliedCode = addReturn(compliedCode);
3980
+ if (depIdItems.length) {
3981
+ depIdItems.forEach(dep => {
3982
+ const refCtx = execute.getObject(dep);
3983
+ if (refCtx.ref) {
3984
+ const refEle = refCtx.ref.item;
3985
+ depEleMap.set(dep, refCtx);
3986
+ //当前有可能是checkbox数组
3987
+ const refEles = Array.isArray(refEle) ? refEle : [refEle];
3988
+ reactiveMode && refEles.forEach(item => {
3989
+ //求值依赖元素更改的时候,发布当前元素重新计算的指令
3990
+ item.onChangeSubject.subscribe(() => {
3991
+ this.pubOnChange('self');
3992
+ });
3993
+ });
3994
+ }
3995
+ });
3943
3996
  }
3944
- this.expressFn.bind(data.execute)();
3945
- //this.expressFn();
3997
+ this.parserExpress = { compliedCode, func: new Function(`with(this){ ${compliedCode} }`), depItems: depEleMap };
3946
3998
  }
3947
3999
  catch (e) {
3948
- this.expressFn = new Function();
4000
+ console.error('解析表达式出错,parseEleExpression', this.props.expression);
4001
+ }
4002
+ }
4003
+ /**
4004
+ * 元素可见行求值
4005
+ * @param ele
4006
+ * @param executeCtx
4007
+ * @private
4008
+ */
4009
+ evalEleExpr(executeCtx) {
4010
+ if (this.parserExpress && this.parserExpress.func) {
4011
+ try {
4012
+ executeCtx.setCurrentCtx(this, this.parserExpress.depItems);
4013
+ const func = this.parserExpress.func.bind(executeCtx);
4014
+ func();
4015
+ }
4016
+ catch (e) {
4017
+ console.error(e, "表达式执行出错:evalVisibleExpr", this.parserExpress.compliedCode);
4018
+ }
4019
+ finally {
4020
+ executeCtx.clearCurrentCtx();
4021
+ }
3949
4022
  }
3950
4023
  }
3951
4024
  /**
@@ -4045,68 +4118,85 @@ class DataElementBaseFactory extends ElementFactory {
4045
4118
  * @param r
4046
4119
  */
4047
4120
  function exportDecoratorHTML(event, r) {
4048
- const canPaint = r.element.isMouseenter || r.element.isFocused;
4049
- if (!canPaint) {
4121
+ if (event.mode === 'print') {
4050
4122
  return;
4051
4123
  }
4052
- const mode = event.options.dataEleDecoratorMode;
4053
- const color = event.options.dataEleDecoratorColor;
4054
- if (mode === 'none') {
4055
- return;
4124
+ const options = event.options;
4125
+ let color = options.dataEleNormalBgColor;
4126
+ //空数据元填充颜色
4127
+ if (r.element.length === 2 && options.dataEleEmptyBgColor) {
4128
+ color = options.dataEleEmptyBgColor;
4056
4129
  }
4057
- if (mode === 'overlay') {
4058
- const bgX = event.relativePagePos.x;
4059
- const bgY = event.relativePagePos.y;
4060
- event.highlights.push(ElementUtil.getFillSvgRect(bgX, bgY, r.rect.width, r.rect.height, color));
4061
- return;
4130
+ if (r.element.isMouseenter && options.dataEleMouseEnterBgColor) {
4131
+ color = options.dataEleMouseEnterBgColor;
4062
4132
  }
4063
- else if (mode === 'outline') {
4064
- const verOffset = 0;
4065
- const renderPosMap = getCurrentParaGroupRenders(r).map(item => ({ pos: getRenderPosToDoc(item), render: item }));
4066
- if (renderPosMap.length > 1) {
4067
- const secondGroupRenderPos = renderPosMap[1].pos;
4068
- if (secondGroupRenderPos.x + renderPosMap[1].render.rect.width > event.relativePagePos.x) {
4069
- const leftPoints = [];
4070
- const rightPoints = [];
4071
- for (let i = 0; i < renderPosMap.length; i++) {
4072
- const groupRender = renderPosMap[i].render;
4073
- const groupRenderPos = renderPosMap[i].pos;
4074
- leftPoints.push({ x: groupRenderPos.x, y: groupRenderPos.y - verOffset });
4075
- rightPoints.push({
4076
- x: groupRenderPos.x + groupRender.rect.width,
4077
- y: groupRenderPos.y - verOffset
4078
- });
4079
- leftPoints.push({
4080
- x: groupRenderPos.x,
4081
- y: groupRenderPos.y + groupRender.rect.height + verOffset * 2
4082
- });
4083
- rightPoints.push({
4084
- x: groupRenderPos.x + groupRender.rect.width,
4085
- y: groupRenderPos.y + groupRender.rect.height + verOffset * 2
4086
- });
4087
- }
4088
- const sharpPoints1 = CommonUtil.resharpPoints(rightPoints);
4089
- const sharpPoints = CommonUtil.resharpPoints([...leftPoints.reverse()]);
4090
- const path = [...sharpPoints, ...sharpPoints1, sharpPoints[0]].map((item, index) => ((index === 0) ? 'M' : "L") + item.x + " " + item.y).join(" ");
4091
- event.highlights.push(ElementUtil.createSvgPath({
4092
- d: path,
4093
- stroke: color,
4094
- fill: 'none',
4095
- 'stroke-width': 1
4096
- }));
4097
- return;
4098
- }
4099
- }
4100
- for (let i = 0; i < renderPosMap.length; i++) {
4101
- const currRen = renderPosMap[i];
4102
- event.highlights.push(ElementUtil.createSvgPath({
4103
- d: `M${currRen.pos.x} ${currRen.pos.y} L${currRen.pos.x + currRen.render.rect.width} ${currRen.pos.y} L${currRen.pos.x + currRen.render.rect.width} ${currRen.pos.y + currRen.render.rect.height} L${currRen.pos.x} ${currRen.pos.y + currRen.render.rect.height} Z`,
4104
- stroke: '#0050b3',
4105
- fill: 'none',
4106
- 'stroke-width': 1
4107
- }));
4108
- }
4133
+ if (r.element.isFocused && options.dataEleFocusedBgColor) {
4134
+ color = options.dataEleFocusedBgColor;
4109
4135
  }
4136
+ //绘制背景
4137
+ const bgX = event.relativePagePos.x;
4138
+ const bgY = event.relativePagePos.y;
4139
+ event.highlights.push(ElementUtil.getFillSvgRect(bgX, bgY, r.rect.width, r.rect.height, color));
4140
+ // const canPaint = r.element.isMouseenter || r.element.isFocused;
4141
+ // if (!canPaint) {
4142
+ // return;
4143
+ // }
4144
+ // const mode = event.options.dataEleDecoratorMode;
4145
+ // if (mode === 'none') {
4146
+ // return;
4147
+ // }
4148
+ // if (mode === 'overlay') {
4149
+ // const bgX = event.relativePagePos.x;
4150
+ // const bgY = event.relativePagePos.y;
4151
+ // event.highlights.push(ElementUtil.getFillSvgRect(bgX, bgY, r.rect.width, r.rect.height, color));
4152
+ // return;
4153
+ // } else if (mode === 'outline') {
4154
+ // const verOffset = 0;
4155
+ // const renderPosMap = getCurrentParaGroupRenders(r).map(item => ({ pos: getRenderPosToDoc(item), render: item }));
4156
+ // if (renderPosMap.length > 1) {
4157
+ // const secondGroupRenderPos = renderPosMap[1].pos;
4158
+ // if (secondGroupRenderPos.x + renderPosMap[1].render.rect.width > event.relativePagePos.x) {
4159
+ // const leftPoints: Array<Position> = [];
4160
+ // const rightPoints: Array<Position> = [];
4161
+ // for (let i = 0; i < renderPosMap.length; i++) {
4162
+ // const groupRender = renderPosMap[i].render;
4163
+ // const groupRenderPos = renderPosMap[i].pos;
4164
+ // leftPoints.push({ x: groupRenderPos.x, y: groupRenderPos.y - verOffset });
4165
+ // rightPoints.push({
4166
+ // x: groupRenderPos.x + groupRender.rect.width,
4167
+ // y: groupRenderPos.y - verOffset
4168
+ // });
4169
+ // leftPoints.push({
4170
+ // x: groupRenderPos.x,
4171
+ // y: groupRenderPos.y + groupRender.rect.height + verOffset * 2
4172
+ // });
4173
+ // rightPoints.push({
4174
+ // x: groupRenderPos.x + groupRender.rect.width,
4175
+ // y: groupRenderPos.y + groupRender.rect.height + verOffset * 2
4176
+ // });
4177
+ // }
4178
+ // const sharpPoints1 = CommonUtil.resharpPoints(rightPoints);
4179
+ // const sharpPoints = CommonUtil.resharpPoints([...leftPoints.reverse()]);
4180
+ // const path = [...sharpPoints, ...sharpPoints1, sharpPoints[0]].map((item, index) => ((index === 0) ? 'M' : "L") + item.x + " " + item.y).join(" ")
4181
+ // event.highlights.push(ElementUtil.createSvgPath({
4182
+ // d: path,
4183
+ // stroke: color,
4184
+ // fill: 'none',
4185
+ // 'stroke-width': 1
4186
+ // }));
4187
+ // return;
4188
+ // }
4189
+ // }
4190
+ // for (let i = 0; i < renderPosMap.length; i++) {
4191
+ // const currRen = renderPosMap[i];
4192
+ // event.highlights.push(ElementUtil.createSvgPath({
4193
+ // d: `M${currRen.pos.x} ${currRen.pos.y} L${currRen.pos.x + currRen.render.rect.width} ${currRen.pos.y} L${currRen.pos.x + currRen.render.rect.width} ${currRen.pos.y + currRen.render.rect.height} L${currRen.pos.x} ${currRen.pos.y + currRen.render.rect.height} Z`,
4194
+ // stroke: '#0050b3',
4195
+ // fill: 'none',
4196
+ // 'stroke-width': 1
4197
+ // }));
4198
+ // }
4199
+ // }
4110
4200
  }
4111
4201
  /**
4112
4202
  * 渲染数据源验证错误提示框
@@ -4211,30 +4301,6 @@ function renderUnderWavyLine(event, r, color) {
4211
4301
  d += Array(Math.ceil(width / 3)).fill("3,0").join(' t ');
4212
4302
  const path = ElementUtil.createSvgPath({ d, fill: 'none', stroke: color });
4213
4303
  event.highlights.push(path);
4214
- }
4215
- /**
4216
- * 获取渲染元素相对稳当的位置
4217
- * @param render
4218
- * @param refPos
4219
- */
4220
- function getRenderPosToDoc(render, refPos = null) {
4221
- refPos = refPos ?? { x: 0, y: 0 };
4222
- if (render instanceof DocumentRenderObject) {
4223
- return refPos;
4224
- }
4225
- const currPos = { x: render.rect.x + refPos.x, y: render.rect.y + refPos.y };
4226
- return getRenderPosToDoc(render.parent, currPos);
4227
- }
4228
- function getCurrentParaGroupRenders(r) {
4229
- const renders = [];
4230
- const currParaRender = ElementUtil.getParentRender(r, ParagraphRenderObject);
4231
- for (let i = 0; i < r.element.paintRenders.length; i++) {
4232
- const paraRender = ElementUtil.getParentRender(r.element.paintRenders[i], ParagraphRenderObject);
4233
- if (paraRender === currParaRender) {
4234
- renders.push(r.element.paintRenders[i]);
4235
- }
4236
- }
4237
- return renders;
4238
4304
  }
4239
4305
 
4240
4306
  class DocumentBodyElement extends BlockContainerElement {
@@ -4276,7 +4342,7 @@ class DocumentBodyElement extends BlockContainerElement {
4276
4342
  super.beginMeasure(data);
4277
4343
  }
4278
4344
  }
4279
- class DocumentBodyRenderObject extends MuiltBlockLineRenderObject {
4345
+ class DocumentBodyRenderObject extends MultiBlockLineRenderObject {
4280
4346
  clone(cloneData = true) {
4281
4347
  const cloneRender = new DocumentBodyRenderObject(this.element);
4282
4348
  cloneRender.rect = ElementUtil.cloneRect(this.rect);
@@ -4575,7 +4641,7 @@ class TableRowElement extends BlockContainerElement {
4575
4641
  return tr;
4576
4642
  }
4577
4643
  }
4578
- class TableRowRenderObject extends MuiltBlockLineRenderObject {
4644
+ class TableRowRenderObject extends MultiBlockLineRenderObject {
4579
4645
  //被截断的行是否需要重新计算高度
4580
4646
  remeasureState = true;
4581
4647
  //当前行是否存在合并单元格
@@ -4805,9 +4871,7 @@ class TextGroupRenderObject extends LeafRenderObject {
4805
4871
  event.highlights.push(ElementUtil.getStrokeSvgPath(path, '#000', 1));
4806
4872
  }
4807
4873
  //处理null-text
4808
- if (this.element.isDecorate && this.element.disableClick && !this.element.parent) {
4809
- t.data.attrs['opacity'] = '0.58';
4810
- }
4874
+ if (this.element.isDecorate && this.element.disableClick && !this.element.parent) ;
4811
4875
  return t;
4812
4876
  }
4813
4877
  }
@@ -6074,7 +6138,7 @@ class TableElement extends BlockContainerElement {
6074
6138
  };
6075
6139
  }
6076
6140
  }
6077
- class TableRenderObject extends MuiltBlockLineRenderObject {
6141
+ class TableRenderObject extends MultiBlockLineRenderObject {
6078
6142
  setRenderWidth(maxWidth) {
6079
6143
  super.setRenderWidth(maxWidth);
6080
6144
  }
@@ -8580,7 +8644,7 @@ class DataElementGroupElement extends InlineGroupInputElement {
8580
8644
  return {
8581
8645
  type: this.type,
8582
8646
  props: {
8583
- ...this.props.getSerializeProps()
8647
+ ...this.props.getSerializeProps(viewOptions)
8584
8648
  }
8585
8649
  };
8586
8650
  }
@@ -8602,9 +8666,7 @@ class DataElementGroupFactory extends DataElementBaseFactory {
8602
8666
  createElement(data) {
8603
8667
  const props = data.props;
8604
8668
  const ele = new DataElementGroupElement();
8605
- ele.props.id = props.id;
8606
- ele.props.name = props.name;
8607
- ele.props.hidden = Boolean(props.hidden);
8669
+ ElementUtil.readEleBaseProps(ele.props, props);
8608
8670
  return ele;
8609
8671
  }
8610
8672
  }
@@ -8909,7 +8971,11 @@ class DataElementText extends DataElementInlineGroup {
8909
8971
  super('data-ele-text');
8910
8972
  this.props = new DataEleBaseTextProps();
8911
8973
  }
8912
- createRenderObject() {
8974
+ createRenderObject(data) {
8975
+ if (data.options.enableDyExpression) {
8976
+ this.parseEleExpression(data);
8977
+ this.evalEleExpr(data.execute);
8978
+ }
8913
8979
  return new DataElementTextRenderObject(this);
8914
8980
  }
8915
8981
  serialize(viewOptions) {
@@ -9029,33 +9095,23 @@ class DataContainerElement extends BlockContainerElement {
9029
9095
  }
9030
9096
  super.beginMeasure(data);
9031
9097
  }
9032
- serialize() {
9033
- const p = {
9098
+ serialize(viewOptions) {
9099
+ return {
9034
9100
  type: this.type,
9035
- props: {}
9101
+ props: {
9102
+ ...this.props.getSerializeProps(viewOptions)
9103
+ }
9036
9104
  };
9037
- if (this.props.id) {
9038
- p['id'] = this.props.id;
9039
- }
9040
- if (this.props.name) {
9041
- p['name'] = this.props.name;
9042
- }
9043
- if (this.props.caption) {
9044
- p['caption'] = this.props.caption;
9045
- }
9046
- return p;
9047
9105
  }
9048
9106
  clone(data) {
9049
9107
  const clone = new DataContainerElement();
9050
- clone.props.id = this.props.id;
9051
- clone.props.name = this.props.name;
9052
- clone.props.caption = this.props.caption;
9108
+ this.props.clone(clone.props);
9053
9109
  cloneElementBase(this, clone);
9054
9110
  cloneChildren(this, clone, data);
9055
9111
  return clone;
9056
9112
  }
9057
9113
  }
9058
- class DataContainerRenderObject extends MuiltBlockLineRenderObject {
9114
+ class DataContainerRenderObject extends MultiBlockLineRenderObject {
9059
9115
  clone(cloneData = true) {
9060
9116
  const cloneRender = new DataContainerRenderObject(this.element);
9061
9117
  cloneRender.rect = ElementUtil.cloneRect(this.rect);
@@ -9080,24 +9136,21 @@ class DataContainerFactory extends ElementFactory {
9080
9136
  return type === 'data-container';
9081
9137
  }
9082
9138
  createElement(data) {
9083
- const element = new DataContainerElement();
9139
+ const ele = new DataContainerElement();
9084
9140
  const props = data.props;
9085
- if (props?.id) {
9086
- element.props.id = props.id;
9087
- }
9088
- if (props?.name) {
9089
- element.props.name = props.name;
9090
- }
9091
- if (props?.caption) {
9092
- element.props.caption = props.caption;
9093
- }
9094
- return element;
9141
+ ElementUtil.readEleBaseProps(ele.props, props);
9142
+ return ele;
9095
9143
  }
9096
9144
  }
9097
- class DataContainerProps {
9098
- caption;
9099
- id;
9100
- name;
9145
+ class DataContainerProps extends DataEleBaseProps {
9146
+ clone(dest) {
9147
+ const clone = dest ?? new DataContainerProps();
9148
+ super.cloneBaseProps(clone);
9149
+ }
9150
+ getSerializeProps(options) {
9151
+ const props = {};
9152
+ return this.getBaseProps(props, options);
9153
+ }
9101
9154
  }
9102
9155
 
9103
9156
  /**
@@ -9183,7 +9236,7 @@ class DocumentBodyPartElement extends BlockContainerElement {
9183
9236
  return clone;
9184
9237
  }
9185
9238
  }
9186
- class DocumentBodyPartRenderObject extends MuiltBlockLineRenderObject {
9239
+ class DocumentBodyPartRenderObject extends MultiBlockLineRenderObject {
9187
9240
  clone(cloneData = true) {
9188
9241
  const cloneRender = new DocumentBodyPartRenderObject(this.element);
9189
9242
  cloneRender.rect = ElementUtil.cloneRect(this.rect);
@@ -10559,10 +10612,10 @@ class ElementSerialize {
10559
10612
  }
10560
10613
  }
10561
10614
  if (element.props && element.props['__attachedProperty'] && !result.props['__attachedProperty']) {
10562
- result.props['__attachedProperty'] = CommonUtil.cloneValue(element.props['__attachedProperty']);
10615
+ result.props['__attachedProperty'] = this.serializeObject(element.props['__attachedProperty']);
10563
10616
  }
10564
10617
  if (element.attribute) {
10565
- result['attribute'] = this.serializeAttribute(element);
10618
+ result['attribute'] = this.serializeObject(element.attribute);
10566
10619
  }
10567
10620
  return result;
10568
10621
  }
@@ -10586,20 +10639,23 @@ class ElementSerialize {
10586
10639
  }
10587
10640
  return "";
10588
10641
  }
10589
- static serializeAttribute(element) {
10590
- if (element.attribute) {
10591
- const result = {};
10592
- for (const key in element.attribute) {
10593
- if (element.attribute[key] !== undefined && element.attribute[key] !== null) {
10594
- result[key] = element.attribute[key];
10642
+ static serializeObject(obj) {
10643
+ if (obj === null || obj === undefined) {
10644
+ return null;
10645
+ }
10646
+ const result = {};
10647
+ for (const key in obj) {
10648
+ if (obj[key] !== undefined && obj[key] !== null) {
10649
+ if (key.startsWith("__")) {
10650
+ continue;
10595
10651
  }
10652
+ result[key] = obj[key];
10596
10653
  }
10597
- if (Object.keys(result).length === 0) {
10598
- return null;
10599
- }
10600
- return CommonUtil.cloneValue(result);
10601
10654
  }
10602
- return null;
10655
+ if (Object.keys(result).length === 0) {
10656
+ return null;
10657
+ }
10658
+ return CommonUtil.cloneValue(result);
10603
10659
  }
10604
10660
  /**
10605
10661
  * 获取选中的结构
@@ -13867,7 +13923,7 @@ class ParagraphMeasure {
13867
13923
  }
13868
13924
  }
13869
13925
  arrangeInlineGroupElement(parentLine, ele) {
13870
- const { options, renderCtx } = this;
13926
+ const { options, renderCtx, execute } = this;
13871
13927
  let render = this.createRenderObject(ele);
13872
13928
  //记录多行情况下的渲染对象,用于计算总长度,生成fill-null-space
13873
13929
  const inlineGroupRenders = [];
@@ -13903,7 +13959,7 @@ class ParagraphMeasure {
13903
13959
  isCloseToBody: parentLine.isCloseToBody,
13904
13960
  applyNewLine() {
13905
13961
  parentLine.applyNewLine();
13906
- render = ele.createRenderObject({ options, renderCtx });
13962
+ render = ele.createRenderObject({ options, renderCtx, execute });
13907
13963
  parentLine.add(render);
13908
13964
  inlineGroupRenders.push(render);
13909
13965
  },
@@ -14238,7 +14294,8 @@ class ParagraphMeasure {
14238
14294
  }
14239
14295
  return element.createRenderObject({
14240
14296
  options: this.options,
14241
- renderCtx: this.renderCtx
14297
+ renderCtx: this.renderCtx,
14298
+ execute: this.execute
14242
14299
  });
14243
14300
  }
14244
14301
  }
@@ -14397,8 +14454,9 @@ class DocumentArrange {
14397
14454
  this.pMeasure = new ParagraphMeasure(this.options, this.renderCtx, this.execute);
14398
14455
  const data = {
14399
14456
  doc,
14400
- viewOptions: this.options,
14457
+ options: this.options,
14401
14458
  execute: this.execute,
14459
+ renderCtx: this.renderCtx,
14402
14460
  createParaFn: () => this.createDefaultPara()
14403
14461
  };
14404
14462
  this.reset(data);
@@ -14601,7 +14659,7 @@ class DocumentArrange {
14601
14659
  if (this.options.textRowLineMode && ele instanceof TableElement && ele.cacheRender) {
14602
14660
  const cacheRender = ele.cacheRender;
14603
14661
  clearChildrenRenderCache(ele);
14604
- textLineRenderMode(cacheRender, { options: this.options, renderCtx: this.renderCtx });
14662
+ textLineRenderMode(cacheRender, { options: this.options, renderCtx: this.renderCtx, execute: this.execute });
14605
14663
  }
14606
14664
  }
14607
14665
  getDocInnerRect(documentRender) {
@@ -14624,7 +14682,7 @@ class DocumentArrange {
14624
14682
  }
14625
14683
  const cloneRender = this.pMeasure.createRenderObject(render.element);
14626
14684
  cloneRender.setRenderWidth(render.rect.width);
14627
- if (render instanceof MuiltBlockLineRenderObject) {
14685
+ if (render instanceof MultiBlockLineRenderObject) {
14628
14686
  let sumHeight = 0;
14629
14687
  const children = [...render.getItems()];
14630
14688
  let j = 0;
@@ -14633,7 +14691,7 @@ class DocumentArrange {
14633
14691
  //sumHeight = ElementUtil.remeasure(cloneRender);
14634
14692
  const calcBlockLineHeight = this.getBlockLineHeight(blockLine);
14635
14693
  if (calcBlockLineHeight + sumHeight > limitHeight) {
14636
- if (blockLine instanceof MuiltBlockLineRenderObject) {
14694
+ if (blockLine instanceof MultiBlockLineRenderObject) {
14637
14695
  //限制的外框尺寸
14638
14696
  const availHeight = limitHeight - sumHeight;
14639
14697
  //限制的内框尺寸
@@ -15343,9 +15401,12 @@ class DocumentEvent {
15343
15401
  },
15344
15402
  mouseup: (evt) => {
15345
15403
  this.mouseup(evt, ElementUtil.getMousePos(evt, scale));
15404
+ this.mouseClickHandle(evt);
15346
15405
  },
15347
15406
  click: (evt) => {
15348
- this.mouseClickHandle(evt);
15407
+ //nulltext 不触发 click 事件,暂且这么处理
15408
+ //移到 mouseup 事件中处理
15409
+ //this.mouseClickHandle(evt);
15349
15410
  },
15350
15411
  mousemove: (evt) => {
15351
15412
  this.mousemove(evt, ElementUtil.getMousePos(evt, scale));
@@ -18639,103 +18700,56 @@ function getFocusTextSegment(selection) {
18639
18700
  let { startControl: element, startOffset: offset } = selection;
18640
18701
  if (!(element instanceof TextGroupElement))
18641
18702
  return false;
18642
- if (!supportSegment())
18643
- return false;
18644
18703
  const focusEle = element;
18645
- offset = offset + 1;
18646
- offset = offset > focusEle.textMeasures.length ? focusEle.textMeasures.length : offset;
18647
- //获取连续的字符
18648
- const items = [...getConsecutiveTextsByDirection(element), element, ...getConsecutiveTextsByDirection(element, false)];
18649
- const sortItems = getTextSortData(items);
18650
- const { index, text } = sortItems.reduce((prev, curr) => {
18651
- prev.text += curr.text;
18652
- if (prev.completed) {
18653
- return prev;
18654
- }
18655
- if (curr.item === focusEle) {
18656
- prev.index += offset;
18657
- prev.completed = true;
18658
- }
18659
- else {
18660
- prev.index += curr.item.textMeasures.length;
18661
- }
18662
- return prev;
18663
- }, { completed: false, index: 0, text: '' });
18664
- const { index: hitIndex, len: hitLen } = getHitSegment(text, index);
18665
- const matchSegment = sortItems.filter(item => (item.index <= hitIndex && item.endIndex > hitIndex) || (item.index <= hitIndex + hitLen && item.endIndex > hitIndex + hitLen));
18666
- const startSegment = matchSegment[0];
18667
- const endSegment = matchSegment[matchSegment.length - 1];
18668
- const startOffset = hitIndex - startSegment.index;
18669
- const endOffset = hitIndex + hitLen - endSegment.index;
18670
- const newRange = new SelectionRange();
18671
- newRange.setStart(startSegment.item, startOffset);
18672
- newRange.setEnd(endSegment.item, endOffset);
18673
- selection.addRange(newRange);
18704
+ const focusText = focusEle.text;
18705
+ if (!focusText) {
18706
+ return false;
18707
+ }
18708
+ const [start, end] = tokenize(focusText, offset);
18709
+ const range = new SelectionRange();
18710
+ range.setStart(focusEle, start);
18711
+ range.setEnd(focusEle, end + 1);
18712
+ selection.addRange(range);
18674
18713
  return true;
18675
18714
  }
18676
- /**
18677
- * 进行分词
18678
- * @param text
18679
- * @param focusOffset
18680
- */
18681
- function getHitSegment(text, focusOffset) {
18682
- const segmenter = new Intl.Segmenter("zh-CN", { granularity: "word" });
18683
- const iterator1 = segmenter.segment(text)[Symbol.iterator]();
18684
- const segItems = Array.from(iterator1);
18685
- let index = 0;
18686
- for (let i = 0; i < segItems.length; i++) {
18687
- const segItem = segItems[i];
18688
- const currIndex = segItem.index;
18689
- const currLen = segItem.segment.length;
18690
- if (focusOffset > currIndex && focusOffset <= currLen + currIndex) {
18691
- return {
18692
- index,
18693
- len: currLen
18694
- };
18715
+ function tokenize(text, index) {
18716
+ if (text.length === 0) {
18717
+ return [0, 0]; // 处理空字符串的情况
18718
+ }
18719
+ const isChinese = (char) => {
18720
+ return /^[\u4e00-\u9fa5]+$/.test(char);
18721
+ };
18722
+ const isEnglish = (char) => {
18723
+ return /^[a-zA-Z]+$/.test(char);
18724
+ };
18725
+ const isNumeric = (char) => {
18726
+ return /^[0-9]+$/.test(char);
18727
+ };
18728
+ let start = index;
18729
+ let end = index;
18730
+ // 向左查找开始位置
18731
+ while (start > 0) {
18732
+ if ((isChinese(text[start]) && isChinese(text[start - 1])) ||
18733
+ (isEnglish(text[start]) && isEnglish(text[start - 1])) ||
18734
+ (isNumeric(text[start]) && isNumeric(text[start - 1]))) {
18735
+ start--;
18736
+ }
18737
+ else {
18738
+ break;
18695
18739
  }
18696
- index += currLen;
18697
18740
  }
18698
- throw new Error('未获取到对应的分词词组');
18699
- }
18700
- function supportSegment() {
18701
- return typeof Intl.Segmenter === 'function';
18702
- }
18703
- /**
18704
- * 根据前后顺序标识索引位
18705
- * @param texts
18706
- */
18707
- function getTextSortData(texts) {
18708
- let index = 0;
18709
- const sortItems = [];
18710
- for (let i = 0; i < texts.length; i++) {
18711
- const item = texts[i];
18712
- const sortData = {
18713
- len: item.textMeasures.length,
18714
- index,
18715
- endIndex: index + item.textMeasures.length,
18716
- item,
18717
- text: item.text
18718
- };
18719
- sortItems.push(sortData);
18720
- index += sortData.len;
18741
+ // 向右查找结束位置
18742
+ while (end < text.length - 1) {
18743
+ if ((isChinese(text[end]) && isChinese(text[end + 1])) ||
18744
+ (isEnglish(text[end]) && isEnglish(text[end + 1])) ||
18745
+ (isNumeric(text[end]) && isNumeric(text[end + 1]))) {
18746
+ end++;
18747
+ }
18748
+ else {
18749
+ break;
18750
+ }
18721
18751
  }
18722
- return sortItems;
18723
- }
18724
- /**
18725
- * 获取指定方向上连续的字符
18726
- * @param element
18727
- * @param prev
18728
- */
18729
- function getConsecutiveTextsByDirection(element, prev = true) {
18730
- let prevText = element;
18731
- const prevTexts = [];
18732
- const func = prev ? ElementUtil.getPrevSiblingElement : ElementUtil.getNextSiblingElement;
18733
- const addItem = prev ? prevTexts.unshift : prevTexts.push;
18734
- while ((prevText = func(prevText)) && prevText instanceof TextGroupElement) {
18735
- //addItem(prevText);
18736
- addItem.apply(prevTexts, [prevText]);
18737
- }
18738
- return prevTexts;
18752
+ return [start, end];
18739
18753
  }
18740
18754
 
18741
18755
  /**
@@ -19300,7 +19314,7 @@ class DocumentSvg {
19300
19314
  ns: 'http://www.w3.org/2000/svg',
19301
19315
  attrs: {
19302
19316
  stroke: 'none',
19303
- fill: item.color ?? 'rgb(85,165,255)',
19317
+ fill: item.color ?? this.viewOptions.selectionColor,
19304
19318
  'paint-order': 'stroke fill markers',
19305
19319
  d: `M${item.x} ${item.y} L${item.x + item.width} ${item.y} L${item.x + item.width} ${item.y + item.height} L${item.x} ${item.y + item.height} Z`,
19306
19320
  'fill-opacity': '0.5'
@@ -19419,7 +19433,7 @@ class EditorCalendarVNode {
19419
19433
  data: {
19420
19434
  style: {
19421
19435
  position: 'absolute',
19422
- left: (position.x - 10) + 'px',
19436
+ left: (position.x) + 'px',
19423
19437
  top: position.y + 5 + position.height + 'px',
19424
19438
  'min-width': '100px',
19425
19439
  'background-color': 'white',
@@ -19555,6 +19569,9 @@ class EditorCalendarVNode {
19555
19569
  on: {
19556
19570
  click: () => {
19557
19571
  this.onClickDayItem(day.date);
19572
+ },
19573
+ dblclick: () => {
19574
+ this.onSave();
19558
19575
  }
19559
19576
  }
19560
19577
  },
@@ -19612,12 +19629,7 @@ class EditorCalendarVNode {
19612
19629
  data: {
19613
19630
  on: {
19614
19631
  click: () => {
19615
- if (!this.selectedDate.value) {
19616
- this.onSetValue.next(new Date());
19617
- }
19618
- else {
19619
- this.onSetValue.next(moment(this.selectedDate.value + ' ' + this.selectedTime.value).toDate());
19620
- }
19632
+ this.onSave();
19621
19633
  }
19622
19634
  }
19623
19635
  },
@@ -19637,6 +19649,14 @@ class EditorCalendarVNode {
19637
19649
  ]
19638
19650
  };
19639
19651
  }
19652
+ onSave() {
19653
+ if (!this.selectedDate.value) {
19654
+ this.onSetValue.next(new Date());
19655
+ }
19656
+ else {
19657
+ this.onSetValue.next(moment(this.selectedDate.value + ' ' + this.selectedTime.value).toDate());
19658
+ }
19659
+ }
19640
19660
  navigateToToday() {
19641
19661
  this.currYear.value = new Date().getFullYear();
19642
19662
  this.currMonth.value = new Date().getMonth();
@@ -20349,7 +20369,6 @@ class DocEditor {
20349
20369
  beforeRenderSubject = new Subject();
20350
20370
  afterRenderSubject = new Subject();
20351
20371
  onBeforeSetCursorSubject = new Subject();
20352
- contentChanged = new Subject();
20353
20372
  onPatchVNodeSubject = new Subject();
20354
20373
  selectionState;
20355
20374
  onDblClickEvent = new Subject();
@@ -20641,10 +20660,12 @@ class DocEditor {
20641
20660
  }
20642
20661
  loadDoc(data) {
20643
20662
  suppressTracking(() => {
20644
- this.adjustPageLayout();
20645
- this.elementReader.read(data);
20646
- this.refreshDocument();
20647
- this.historyMange.clear();
20663
+ this.noEffectChange(() => {
20664
+ this.adjustPageLayout();
20665
+ this.elementReader.read(data);
20666
+ this.refreshDocument();
20667
+ this.historyMange.clear();
20668
+ });
20648
20669
  });
20649
20670
  }
20650
20671
  /**
@@ -20662,7 +20683,6 @@ class DocEditor {
20662
20683
  suppressTracking(() => {
20663
20684
  this.documentPaginator.rePages();
20664
20685
  });
20665
- this.contentChanged.next();
20666
20686
  }
20667
20687
  this.updateSelection();
20668
20688
  this.setCursor();
@@ -20689,6 +20709,7 @@ class DocEditor {
20689
20709
  ssChanged && this.documentEvent.invokeCursor(this.selectionState.startControl);
20690
20710
  this.documentSelection.clearSnapshot();
20691
20711
  this.documentSelection.takeSnapshot();
20712
+ return ssChanged;
20692
20713
  }
20693
20714
  /**
20694
20715
  * 根据当前选区,更新待输入文本字体信息
@@ -20728,6 +20749,7 @@ class DocEditor {
20728
20749
  this.selectionState.cursorPos = cursorRect;
20729
20750
  const abPos = ElementUtil.cloneRect(cursorRect);
20730
20751
  this.setCursorPosition(abPos);
20752
+ this.setCursorVisibility(true);
20731
20753
  //this.documentEvent.invokeCursor(startControl);
20732
20754
  return;
20733
20755
  }
@@ -20761,7 +20783,7 @@ class DocEditor {
20761
20783
  setCursorVisibility(visibility) {
20762
20784
  if (visibility) {
20763
20785
  //this.editInput.style.removeProperty('display');
20764
- this.editInput.focus();
20786
+ this.editInput.focus({ preventScroll: true });
20765
20787
  }
20766
20788
  }
20767
20789
  hiddenInput(reset = true, pos = null) {
@@ -20783,7 +20805,6 @@ class DocEditor {
20783
20805
  this.editInput.style.height = position.height + 'px';
20784
20806
  this.editInput.style.width = "1.6px";
20785
20807
  this.editInput.readOnly = false;
20786
- this.setCursorVisibility(true);
20787
20808
  //判断光标位置是否被可见,如果不可见,需要将其设置到可见区域
20788
20809
  //TODO:暂时不做处理
20789
20810
  //this.setCursorInputStatus();
@@ -20819,7 +20840,7 @@ class DocEditor {
20819
20840
  * 文档点击事件
20820
20841
  */
20821
20842
  docClickHandle(evt) {
20822
- this.hiddenInput();
20843
+ //this.hiddenInput();
20823
20844
  // this.setCursor();
20824
20845
  // this.updateSelection();
20825
20846
  this.refreshDocument();
@@ -21119,20 +21140,20 @@ class DocEditor {
21119
21140
  const startControl = this.selectionState.startControl;
21120
21141
  if (startControl instanceof TextGroupElement) {
21121
21142
  const selectedStyle = startControl.props.clone(null);
21122
- const selectionOverlayColor = this.viewOptions.selectionOverlaysColor;
21123
- this.viewOptions.selectionOverlaysColor = "rgba(0,58,140,0.8)";
21143
+ const selectionColor = this.viewOptions.selectionColor;
21144
+ this.viewOptions.selectionColor = "rgba(0,58,140,0.8)";
21124
21145
  const cancelToken = {};
21125
21146
  const sub = this.onClickEvent.subscribe(() => {
21126
21147
  sub.unsubscribe();
21127
21148
  this.setTextFormat(selectedStyle);
21128
- this.viewOptions.selectionOverlaysColor = selectionOverlayColor;
21149
+ this.viewOptions.selectionColor = selectionColor;
21129
21150
  if (cancelToken.onFinish) {
21130
21151
  cancelToken.onFinish(null);
21131
21152
  }
21132
21153
  });
21133
21154
  cancelToken.cancel = () => {
21134
21155
  sub.unsubscribe();
21135
- this.viewOptions.selectionOverlaysColor = selectionOverlayColor;
21156
+ this.viewOptions.selectionColor = selectionColor;
21136
21157
  };
21137
21158
  return cancelToken;
21138
21159
  }
@@ -21565,7 +21586,7 @@ class DocEditor {
21565
21586
  const scaleFitContainer = {
21566
21587
  sel: 'div#scale-fit-container',
21567
21588
  data: {
21568
- style: { overflow: 'hidden', height: '0px', }
21589
+ style: { height: '0px', }
21569
21590
  },
21570
21591
  children: [docContent]
21571
21592
  };
@@ -21727,7 +21748,7 @@ class DocEditor {
21727
21748
  data: {
21728
21749
  style: {
21729
21750
  position: 'absolute',
21730
- left: (position.x - 10) + 'px',
21751
+ left: (position.x) + 'px',
21731
21752
  top: position.y + 5 + position.height + 'px',
21732
21753
  },
21733
21754
  hook: {
@@ -21893,7 +21914,7 @@ class DocEditor {
21893
21914
  rule.setRuleOptions({ width: this.viewOptions.docPageSettings.width, pagePL, pagePR, docLeft });
21894
21915
  }
21895
21916
  version() {
21896
- return "2.2.6";
21917
+ return "2.2.8";
21897
21918
  }
21898
21919
  switchPageHeaderEditor() {
21899
21920
  this.docCtx.document.switchPageHeaderEditor(this.selectionState, null);
@@ -22196,6 +22217,13 @@ class DocEditor {
22196
22217
  this.documentChange.appendText(text, this.docCtx.suggestions.currentMatchedText);
22197
22218
  }
22198
22219
  }
22220
+ parser(code, returnProcess = false) {
22221
+ const res = parser(code);
22222
+ if (returnProcess) {
22223
+ return addReturn(res);
22224
+ }
22225
+ return res;
22226
+ }
22199
22227
  }
22200
22228
 
22201
22229
  /**
@@ -27605,5 +27633,5 @@ function removeDuplicatesEvent(events) {
27605
27633
  return arr;
27606
27634
  }
27607
27635
 
27608
- 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, CommonUtil, CommsContainerElement, CommsContainerRenderObject, ContentMenuItem, ContextMenuElementEvent, CopyElementEvent, DOMEventSource, DOMSubscription, DataContainerElement, DataContainerFactory, DataContainerProps, DataContainerRenderObject, 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, DocInputSuggestions, DocMode, DocumentBodyElement, DocumentBodyFactory, DocumentBodyPartElement, DocumentBodyPartFactory, DocumentBodyPartRenderObject, DocumentBodyRenderObject, DocumentChange, DocumentCombine, DocumentComment, DocumentContainerRender, DocumentContext, DocumentCursor, DocumentElement, DocumentEvalFunc, DocumentEvent, DocumentFactory, DocumentFooterElement, DocumentFooterFactory, DocumentFooterRenderObject, DocumentHeaderElement, DocumentHeaderFactory, DocumentHeaderRenderObject, DocumentInput, DocumentPaginator, DocumentPrintOffscreen, DocumentPrintOffscreenBase, DocumentProps, DocumentRenderObject, DocumentSelection, DocumentTemplate, DropElementEvent, EditMode, EditorContext, Element, ElementEvent, ElementFactory, ElementReader, ElementSerialize, ElementUtil, EventBus, EventMap, EventSourceCore, FillNullSpaceElement, FillNullSpaceRenderObject, GetTrackTipsEvent, GotCursorEvent, IDispose, INotifyPropertyChanged, InlineBlockContainer, InlineGroupElement, InlineGroupInputElement, InlineGroupRenderObject, InlineMuiltBlockLineRenderObject, InputElementEvent, IsInSideDataElement, IsInSideInlineGroupInputElement, KeyboradElementEvent, LeafElement, LeafRenderObject, LostCursorEvent, MarginProps, 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, RowMinHeight, RunElementFactory, SVGElement, SVGFactory, SVGProps, SVGRenderObject, SelectionOverlays, SelectionRange, SelectionState, Subject, SubjectSubscription, Subscription, TEXT_HEIGHT_FACTOR, TabElement, TabFactory, TabRenderObject, TableCellElement, TableCellFactory, TableCellProps, TableCellRenderObject, TableElement, TableFactory, TableProps, TableRenderObject, TableRowElement, TableRowFactory, TableRowProps, TableRowRenderObject, TableSplitCell, TableUtil, TextGroupElement, TextGroupFactory, TextGroupRenderObject, TextProps, TextUnitsHolder, TrackRunElement, TrackRunProps, TrackRunRenderObject, TrackRunTypeEnum, ValidateCondition, ValidateElement, ValidateProps, ValidateRenderObject, ViewOptions, addReturn, clearChildrenRenderCache, clearTraces, cloneChildren, cloneElementBase, defaultParaHanging, deleteCurrentParagraph, docOpsMap, elementTypeEventHandler, exportDecoratorHTML, falseChar, fontMapFunc, formatEle, fromEvent, generatePatch, getCalleeName, getFocusTextSegment, inputText, insertEle, invokeTypeHandler, isDate, logUpdateEleProps, objectToString$4 as objectToString, onTableContextmenu, onceTask, parser, reactiveMap, removeEle, removeText, renderErrorTip, renderUnderWavyLine, runTextLineRender, setChildrenModifyFlag, setNotifyChangedCallback, setTraceTrackingFlag, suppressTracking, targetMaps, textLineRenderMode, toRawType, toTypeString, trueChar, validateDataEle, validateDataEleRenderObj, validateInlineInputRenderObj, watchChanged };
27636
+ 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, CommonUtil, CommsContainerElement, CommsContainerRenderObject, ContentMenuItem, ContextMenuElementEvent, CopyElementEvent, DOMEventSource, DOMSubscription, DataContainerElement, DataContainerFactory, DataContainerProps, DataContainerRenderObject, 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, DocInputSuggestions, DocMode, DocumentBodyElement, DocumentBodyFactory, DocumentBodyPartElement, DocumentBodyPartFactory, DocumentBodyPartRenderObject, DocumentBodyRenderObject, DocumentChange, DocumentCombine, DocumentComment, DocumentContainerRender, DocumentContext, DocumentCursor, DocumentElement, DocumentEvalFunc, DocumentEvent, DocumentFactory, DocumentFooterElement, DocumentFooterFactory, DocumentFooterRenderObject, DocumentHeaderElement, DocumentHeaderFactory, DocumentHeaderRenderObject, DocumentInput, DocumentPaginator, DocumentPrintOffscreen, DocumentPrintOffscreenBase, DocumentProps, DocumentRenderObject, DocumentSelection, DocumentTemplate, DropElementEvent, EditMode, EditorContext, Element, ElementEvent, ElementFactory, ElementReader, ElementSerialize, ElementUtil, EventBus, EventMap, EventSourceCore, FillNullSpaceElement, FillNullSpaceRenderObject, GetTrackTipsEvent, GotCursorEvent, IDispose, INotifyPropertyChanged, InlineBlockContainer, InlineGroupElement, InlineGroupInputElement, InlineGroupRenderObject, InlineMuiltBlockLineRenderObject, InputElementEvent, IsInSideDataElement, IsInSideInlineGroupInputElement, KeyboradElementEvent, LeafElement, LeafRenderObject, LostCursorEvent, MarginProps, ModifyFlag, MouseElementEvent, MousedownElementEvent, MultiBlockLineRenderObject, 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, RowMinHeight, RunElementFactory, SVGElement, SVGFactory, SVGProps, SVGRenderObject, SelectionOverlays, SelectionRange, SelectionState, Subject, SubjectSubscription, Subscription, TEXT_HEIGHT_FACTOR, TabElement, TabFactory, TabRenderObject, TableCellElement, TableCellFactory, TableCellProps, TableCellRenderObject, TableElement, TableFactory, TableProps, TableRenderObject, TableRowElement, TableRowFactory, TableRowProps, TableRowRenderObject, TableSplitCell, TableUtil, TextGroupElement, TextGroupFactory, TextGroupRenderObject, TextProps, TextUnitsHolder, TrackRunElement, TrackRunProps, TrackRunRenderObject, TrackRunTypeEnum, ValidateCondition, ValidateElement, ValidateProps, ValidateRenderObject, ViewOptions, addReturn, clearChildrenRenderCache, clearTraces, cloneChildren, cloneElementBase, defaultParaHanging, deleteCurrentParagraph, docOpsMap, elementTypeEventHandler, exportDecoratorHTML, falseChar, fontMapFunc, formatEle, fromEvent, generatePatch, getCalleeName, getFocusTextSegment, inputText, insertEle, invokeTypeHandler, isDate, logUpdateEleProps, objectToString$4 as objectToString, onTableContextmenu, onceTask, parser, reactiveMap, removeEle, removeText, renderErrorTip, renderUnderWavyLine, runTextLineRender, setChildrenModifyFlag, setNotifyChangedCallback, setTraceTrackingFlag, suppressTracking, targetMaps, textLineRenderMode, toRawType, toTypeString, trueChar, validateDataEle, validateDataEleRenderObj, validateInlineInputRenderObj, watchChanged };
27609
27637
  //# sourceMappingURL=index.js.map