@hailin-zheng/editor-core 1.1.2 → 1.1.4

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
@@ -366,6 +366,7 @@ class BlockContentRenderObject extends BranchRenderObject {
366
366
  }
367
367
  }
368
368
  class InlineGroupRenderObject extends BranchRenderObject {
369
+ paintPos;
369
370
  }
370
371
  /**
371
372
  * 包含块级渲染元素的容器元素,例如body、table-cell等
@@ -907,8 +908,10 @@ class Subject$1 extends EventSourceCore$1 {
907
908
  this.addSub(sub);
908
909
  return sub;
909
910
  }
910
- onceSubscribe(listener) {
911
- const sub = this.subscribe(listener);
911
+ }
912
+ class OnceSubject extends Subject$1 {
913
+ subscribe(listener) {
914
+ const sub = super.subscribe(listener);
912
915
  sub.once = true;
913
916
  return sub;
914
917
  }
@@ -1295,13 +1298,23 @@ class BranchElement extends Element {
1295
1298
  }
1296
1299
  else {
1297
1300
  this.modifyFlag = ModifyFlag$1.Modify;
1298
- for (let i = 0; i < this.length; i++) {
1299
- this.getChild(i).pubOnChange('to-child');
1300
- }
1301
+ clearChildrenRenderCache(this);
1302
+ // for (let i = 0; i < this.length; i++) {
1303
+ // this.getChild(i).pubOnChange('to-child')
1304
+ // }
1301
1305
  }
1302
1306
  this._onChangeEvent.next();
1303
1307
  }
1304
1308
  }
1309
+ function clearChildrenRenderCache(ele) {
1310
+ for (let i = 0; i < ele.length; i++) {
1311
+ const curr = ele.getChild(i);
1312
+ curr.cacheRender = null;
1313
+ if (curr instanceof BranchElement) {
1314
+ clearChildrenRenderCache(curr);
1315
+ }
1316
+ }
1317
+ }
1305
1318
  /**
1306
1319
  * 行内编组元素
1307
1320
  */
@@ -1415,6 +1428,8 @@ class ViewOptions {
1415
1428
  defaultColor = "rgb(0,0,0)";
1416
1429
  selectionOverlaysColor = 'rgb(131,175,155,0.5)';
1417
1430
  dataEleOverlaysColor = 'rgb(131,175,155,0.5)';
1431
+ dataEleFocusedBgColor = 'rgb(131,175,155,0.8)';
1432
+ dataEleErrorBgColor = '#ff4d4f';
1418
1433
  dataEleReadOnlyOverlayColor = '#d9d9d9';
1419
1434
  dataEleOutlineColor = 'rgb(131,175,155,0.7)';
1420
1435
  viewBackcolor = 'rgb(230,230,230)';
@@ -1446,6 +1461,8 @@ class ViewOptions {
1446
1461
  enableDyExpression = false;
1447
1462
  //是否显示标尺
1448
1463
  showRule = true;
1464
+ //是否开启数据元输入验证功能
1465
+ enableDataEleInputValidate = false;
1449
1466
  //整页模式,不分页
1450
1467
  _fullPageView = false;
1451
1468
  get fullPageView() {
@@ -3535,6 +3552,173 @@ function getCalleeName(node) {
3535
3552
  return node['name'];
3536
3553
  }
3537
3554
 
3555
+ class ParagraphElement extends BlockContentElement {
3556
+ constructor() {
3557
+ super('p');
3558
+ this.props = new ParagraphProps();
3559
+ this.addEvent('BackspaceKey', (evt) => {
3560
+ if (evt.selectionState.collapsed) {
3561
+ const pFirstLeafElement = ElementUtil.getFirstLeafElement(this);
3562
+ if (pFirstLeafElement === evt.source && evt.sourceOffset === 0) {
3563
+ if (this.props.numberType >= 0) {
3564
+ this.props.numberType = -1;
3565
+ evt.isCancel = true;
3566
+ }
3567
+ else if (this.props.indent) {
3568
+ this.props.indent = 0;
3569
+ evt.isCancel = true;
3570
+ }
3571
+ }
3572
+ }
3573
+ }, true);
3574
+ this.addEvent('ElementKeyDown', evt => {
3575
+ //当前存在缩进,点击tab
3576
+ if (evt.sourceEvent.keyCode === 9) {
3577
+ const { startControl, startOffset } = evt.selectionState;
3578
+ if (startOffset === 0 && startControl === this.getChild(0)) {
3579
+ const defaultIndent = evt.ctx.viewOptions.defaultIndent;
3580
+ let increaseValue = evt.sourceEvent.shiftKey ? -defaultIndent : defaultIndent;
3581
+ this.props.indent += increaseValue;
3582
+ evt.isCancel = true;
3583
+ evt.sourceEvent.preventDefault();
3584
+ }
3585
+ }
3586
+ }, true);
3587
+ }
3588
+ /**
3589
+ * 设置样式
3590
+ * @param format
3591
+ */
3592
+ setFormat(format) {
3593
+ formatEle(this, format);
3594
+ Object.keys(format).forEach(key => {
3595
+ this.props[key] = format[key];
3596
+ });
3597
+ }
3598
+ createRenderObject() {
3599
+ return new ParagraphRenderObject(this);
3600
+ }
3601
+ createLineRect() {
3602
+ return new ParagraphLineRectRenderObject(null);
3603
+ }
3604
+ serialize(viewOptions) {
3605
+ return {
3606
+ type: 'p',
3607
+ props: {
3608
+ ...this.props.getSerializeProps(viewOptions)
3609
+ }
3610
+ };
3611
+ }
3612
+ clone(data) {
3613
+ const clone = new ParagraphElement();
3614
+ this.props.clone(clone.props);
3615
+ if (data) {
3616
+ for (let i = 0; i < this.length; i++) {
3617
+ clone.addChild(this.getChild(i).clone(true));
3618
+ }
3619
+ }
3620
+ return clone;
3621
+ }
3622
+ static createElement() {
3623
+ return new ParagraphElement();
3624
+ }
3625
+ }
3626
+ class ParagraphRenderObject extends MuiltBlockLineRenderObject {
3627
+ render(e) {
3628
+ e.nextRender();
3629
+ this.drawProjectNumber(e.render, e.docCtx.viewOptions, e);
3630
+ }
3631
+ /**
3632
+ * 绘制项目符号
3633
+ */
3634
+ drawProjectNumber(ctx, viewOptions, e) {
3635
+ const paraElement = this.element;
3636
+ if (paraElement.props.numberType !== ParagraphNumberType.none) {
3637
+ if (paraElement.paintRenders.indexOf(this) > 0) {
3638
+ return;
3639
+ }
3640
+ const line = this.getChild(0);
3641
+ // const firstInlinePaintPos = ElementUtil.getRenderAbsolutePaintPos(firstInline, {
3642
+ // x: 0,
3643
+ // y: -viewOptions.translateY
3644
+ // });
3645
+ const firstInlinePaintPos = {
3646
+ x: e.position.x + line.rect.x,
3647
+ y: e.position.y + line.rect.y
3648
+ };
3649
+ if (paraElement.props.numberType === ParagraphNumberType.ul) {
3650
+ const numberSymbolY = firstInlinePaintPos.y + line.baseTopLine + Math.floor((line.baseBottomLine - line.baseTopLine) / 2);
3651
+ ctx.contentContext.fillCircular(firstInlinePaintPos.x + 4 + paraElement.props.indent, numberSymbolY, 4);
3652
+ }
3653
+ else if (paraElement.props.numberType === ParagraphNumberType.ol) {
3654
+ const parent = paraElement.parent;
3655
+ let i = paraElement.getIndex() - 1;
3656
+ for (; i >= 0; i--) {
3657
+ if (parent.getChild(i) instanceof ParagraphElement) {
3658
+ //紧挨上面的段落
3659
+ const prevSiblingPara = parent.getChild(i);
3660
+ if (prevSiblingPara.props.numberType !== paraElement.props.numberType || prevSiblingPara.props.indent !== paraElement.props.indent) {
3661
+ break;
3662
+ }
3663
+ }
3664
+ }
3665
+ const olText = (paraElement.getIndex() - i) + '.';
3666
+ const textProps = new TextProps();
3667
+ textProps.color = '#000';
3668
+ textProps.fontSize = line.baseBottomLine - line.baseTopLine;
3669
+ textProps.fontName = '宋体';
3670
+ ctx.contentContext.drawText(olText, textProps, firstInlinePaintPos.x, firstInlinePaintPos.y + line.baseTopLine, 40, textProps.fontSize);
3671
+ }
3672
+ }
3673
+ }
3674
+ clone() {
3675
+ const cloneRender = new ParagraphRenderObject(this.element);
3676
+ cloneRender.rect = ElementUtil.cloneRect(this.rect);
3677
+ for (let i = 0; i < this.length; i++) {
3678
+ cloneRender.addChild(this.getChild(i).clone());
3679
+ }
3680
+ return cloneRender;
3681
+ }
3682
+ }
3683
+ class ParagraphFactory extends ElementFactory {
3684
+ match(type) {
3685
+ return type === 'p';
3686
+ }
3687
+ createElement(data) {
3688
+ const paraElement = new ParagraphElement();
3689
+ const props = data.props;
3690
+ paraElement.props.indent = props?.indent ?? 0;
3691
+ paraElement.props.hanging = props?.hanging ?? 0;
3692
+ paraElement.props.textAlign = props?.textAlign ?? 'left';
3693
+ paraElement.props.numberType = props?.numberType ?? -1;
3694
+ paraElement.props.lineHeight = props?.lineHeight ?? this.options.defaultLineHeight;
3695
+ paraElement.props.marginTop = props?.marginTop ?? 0;
3696
+ paraElement.props.marginBottom = props?.marginBottom ?? 0;
3697
+ paraElement.props.tabs = props?.tabs ?? [];
3698
+ return paraElement;
3699
+ }
3700
+ }
3701
+ /**
3702
+ * 段落行框
3703
+ */
3704
+ class ParagraphLineRectRenderObject extends BlockLineRectRenderObject {
3705
+ baseTopLine = 0;
3706
+ baseBottomLine = 0;
3707
+ startX = 0;
3708
+ render(e) {
3709
+ }
3710
+ clone() {
3711
+ const cloneRender = new ParagraphLineRectRenderObject(this.element);
3712
+ cloneRender.rect = ElementUtil.cloneRect(this.rect);
3713
+ cloneRender.baseTopLine = this.baseTopLine;
3714
+ cloneRender.baseBottomLine = this.baseBottomLine;
3715
+ for (let i = 0; i < this.length; i++) {
3716
+ cloneRender.addChild(this.getChild(i).clone());
3717
+ }
3718
+ return cloneRender;
3719
+ }
3720
+ }
3721
+
3538
3722
  /**
3539
3723
  * 所有的数据元继承上述两个抽象类
3540
3724
  */
@@ -3650,8 +3834,12 @@ class InlineGroupInputElement extends InlineGroupElement {
3650
3834
  }
3651
3835
  }
3652
3836
  class DataElementInlineGroup extends InlineGroupInputElement {
3837
+ errorTip;
3653
3838
  constructor(type) {
3654
3839
  super(type);
3840
+ this.onChangeSubject.subscribe(() => {
3841
+ this.onChangedValidate();
3842
+ });
3655
3843
  this.addEvent('ElementMousemove', (evt) => {
3656
3844
  this.isMouseenter = true;
3657
3845
  this.refreshView();
@@ -3715,19 +3903,44 @@ class DataElementInlineGroup extends InlineGroupInputElement {
3715
3903
  this.expressFn = new Function();
3716
3904
  }
3717
3905
  }
3906
+ /**
3907
+ * 数据元发生更改后,进行数据验证
3908
+ */
3909
+ onChangedValidate() {
3910
+ this.errorTip = '';
3911
+ const options = getCurrOptions(this);
3912
+ if (!options || !options.enableDataEleInputValidate) {
3913
+ return;
3914
+ }
3915
+ this.errorTip = this.validate();
3916
+ }
3917
+ }
3918
+ function getCurrOptions(ele) {
3919
+ const doc = ElementUtil.getParent(ele, item => item.type === 'doc');
3920
+ return doc?.viewOptions;
3718
3921
  }
3719
3922
  class DataElementRenderObject extends InlineGroupRenderObject {
3720
3923
  render(e) {
3721
3924
  const { render, position, docCtx: { viewOptions } } = e;
3925
+ this.paintPos = e.position;
3722
3926
  //数据元不打印
3723
3927
  if (!this.element.props.printable && render.drawMode === 'print') {
3724
3928
  return;
3725
3929
  }
3726
3930
  render.contentContext.tran(() => {
3727
3931
  //绘制数据元区域底色
3932
+ let bgColor = '';
3728
3933
  if (this.element.isMouseenter) {
3729
- const overlayColor = this.element.props.editable ? viewOptions.dataEleOverlaysColor : viewOptions.dataEleReadOnlyOverlayColor;
3730
- render.overlaysContext.fillRect(position.x, position.y - 2, this.rect.width, this.rect.height + 4, overlayColor);
3934
+ bgColor = this.element.props.editable ? viewOptions.dataEleOverlaysColor : viewOptions.dataEleReadOnlyOverlayColor;
3935
+ }
3936
+ if (this.element.isFocused) {
3937
+ bgColor = e.docCtx.viewOptions.dataEleFocusedBgColor;
3938
+ }
3939
+ if (this.element.errorTip) {
3940
+ bgColor = viewOptions.dataEleErrorBgColor;
3941
+ }
3942
+ if (bgColor) {
3943
+ render.overlaysContext.fillRect(position.x, position.y - 2, this.rect.width, this.rect.height + 4, bgColor);
3731
3944
  }
3732
3945
  if (this.element.props.secretBrowse && viewOptions.secretBrowse) {
3733
3946
  render.contentContext.ctx.filter = "blur(10px)";
@@ -3742,6 +3955,9 @@ class DataElementRenderObject extends InlineGroupRenderObject {
3742
3955
  e.nextRender();
3743
3956
  this.drawCaption(e);
3744
3957
  });
3958
+ e.render.onRenderCompleted.subscribe(() => {
3959
+ drawDecorator(e, this);
3960
+ });
3745
3961
  }
3746
3962
  /**
3747
3963
  * 绘制数据元标题
@@ -3749,23 +3965,25 @@ class DataElementRenderObject extends InlineGroupRenderObject {
3749
3965
  * @private
3750
3966
  */
3751
3967
  drawCaption(e) {
3752
- const { render, position, docCtx: { viewOptions } } = e;
3753
- //获取到焦点时,绘制数据元标题
3754
- if (render.drawMode === 'view' && this.element.isFocused && this.element.paintRenders.indexOf(this) === 0) {
3755
- const { caption } = this.element.props;
3756
- if (!caption) {
3757
- return;
3968
+ e.render.onRenderCompleted.subscribe(() => {
3969
+ const { render, position, docCtx: { viewOptions } } = e;
3970
+ //获取到焦点时,绘制数据元标题
3971
+ if (render.drawMode === 'view' && this.element.isFocused && this.element.paintRenders.indexOf(this) === 0) {
3972
+ const { caption } = this.element.props;
3973
+ if (!caption) {
3974
+ return;
3975
+ }
3976
+ const textProps = new TextProps();
3977
+ textProps.fontSize = 16;
3978
+ textProps.fontName = viewOptions.defaultFontName;
3979
+ textProps.color = '#fff';
3980
+ const titleWidth = render.contentContext.measureText(caption, textProps).width;
3981
+ const x = position.x;
3982
+ const y = position.y - 20;
3983
+ render.contentContext.fillRect(x, y, titleWidth + 10, 20, 'blue');
3984
+ render.contentContext.drawText(caption, textProps, x + 5, y, titleWidth, 20);
3758
3985
  }
3759
- const textProps = new TextProps();
3760
- textProps.fontSize = 16;
3761
- textProps.fontName = viewOptions.defaultFontName;
3762
- textProps.color = '#fff';
3763
- const titleWidth = render.contentContext.measureText(caption, textProps).width;
3764
- const x = position.x;
3765
- const y = position.y - 20;
3766
- render.contentContext.fillRect(x, y, titleWidth + 10, 20, 'blue');
3767
- render.contentContext.drawText(caption, textProps, x + 5, y, titleWidth, 20);
3768
- }
3986
+ });
3769
3987
  }
3770
3988
  }
3771
3989
  const validateDataEle = (ele) => {
@@ -3820,6 +4038,57 @@ class DataElementBaseFactory extends ElementFactory {
3820
4038
  }
3821
4039
  }
3822
4040
  }
4041
+ function drawDecorator(e, r) {
4042
+ const { render, docCtx: { viewOptions } } = e;
4043
+ const canPaint = r.element.isMouseenter || r.element.isFocused;
4044
+ if (canPaint && r.element.paintRenders.indexOf(r) === 0) {
4045
+ const currParaRenders = getCurrentParaGroupRenders(r);
4046
+ const verOffset = 3;
4047
+ if (currParaRenders.length > 1) {
4048
+ const secondGroupRenderPos = currParaRenders[1].paintPos;
4049
+ if (secondGroupRenderPos.x + currParaRenders[1].rect.width > r.paintPos.x) {
4050
+ const leftPoints = [];
4051
+ const rightPoints = [];
4052
+ for (let i = 0; i < currParaRenders.length; i++) {
4053
+ const groupRender = currParaRenders[i];
4054
+ const groupRenderPos = groupRender.paintPos;
4055
+ leftPoints.push({ x: groupRenderPos.x, y: groupRenderPos.y - verOffset });
4056
+ rightPoints.push({
4057
+ x: groupRenderPos.x + groupRender.rect.width,
4058
+ y: groupRenderPos.y - verOffset
4059
+ });
4060
+ leftPoints.push({
4061
+ x: groupRenderPos.x,
4062
+ y: groupRenderPos.y + groupRender.rect.height + verOffset * 2
4063
+ });
4064
+ rightPoints.push({
4065
+ x: groupRenderPos.x + groupRender.rect.width,
4066
+ y: groupRenderPos.y + groupRender.rect.height + verOffset * 2
4067
+ });
4068
+ }
4069
+ const sharpPoints1 = CommonUtil.resharpPoints(rightPoints);
4070
+ const sharpPoints = CommonUtil.resharpPoints([...leftPoints.reverse()]);
4071
+ render.overlaysContext.strokeLines([...sharpPoints, ...sharpPoints1, sharpPoints[0]], 1, viewOptions.dataGroupColor);
4072
+ return;
4073
+ }
4074
+ }
4075
+ for (let i = 0; i < currParaRenders.length; i++) {
4076
+ const currRen = currParaRenders[i];
4077
+ render.overlaysContext.strokeRect(currRen.paintPos.x, currRen.paintPos.y - verOffset, currRen.rect.width, currRen.rect.height + verOffset * 2, viewOptions.dataGroupColor);
4078
+ }
4079
+ }
4080
+ }
4081
+ function getCurrentParaGroupRenders(r) {
4082
+ const renders = [];
4083
+ const currParaRender = ElementUtil.getParentRender(r, ParagraphRenderObject);
4084
+ for (let i = 0; i < r.element.paintRenders.length; i++) {
4085
+ const paraRender = ElementUtil.getParentRender(r.element.paintRenders[i], ParagraphRenderObject);
4086
+ if (paraRender === currParaRender) {
4087
+ renders.push(r.element.paintRenders[i]);
4088
+ }
4089
+ }
4090
+ return renders;
4091
+ }
3823
4092
 
3824
4093
  class DocumentElement extends BlockContainerElement {
3825
4094
  //props: DocumentProps;
@@ -4281,173 +4550,6 @@ class DocumentHeaderFactory extends ElementFactory {
4281
4550
  }
4282
4551
  }
4283
4552
 
4284
- class ParagraphElement extends BlockContentElement {
4285
- constructor() {
4286
- super('p');
4287
- this.props = new ParagraphProps();
4288
- this.addEvent('BackspaceKey', (evt) => {
4289
- if (evt.selectionState.collapsed) {
4290
- const pFirstLeafElement = ElementUtil.getFirstLeafElement(this);
4291
- if (pFirstLeafElement === evt.source && evt.sourceOffset === 0) {
4292
- if (this.props.numberType >= 0) {
4293
- this.props.numberType = -1;
4294
- evt.isCancel = true;
4295
- }
4296
- else if (this.props.indent) {
4297
- this.props.indent = 0;
4298
- evt.isCancel = true;
4299
- }
4300
- }
4301
- }
4302
- }, true);
4303
- this.addEvent('ElementKeyDown', evt => {
4304
- //当前存在缩进,点击tab
4305
- if (evt.sourceEvent.keyCode === 9) {
4306
- const { startControl, startOffset } = evt.selectionState;
4307
- if (startOffset === 0 && startControl === this.getChild(0)) {
4308
- const defaultIndent = evt.ctx.viewOptions.defaultIndent;
4309
- let increaseValue = evt.sourceEvent.shiftKey ? -defaultIndent : defaultIndent;
4310
- this.props.indent += increaseValue;
4311
- evt.isCancel = true;
4312
- evt.sourceEvent.preventDefault();
4313
- }
4314
- }
4315
- }, true);
4316
- }
4317
- /**
4318
- * 设置样式
4319
- * @param format
4320
- */
4321
- setFormat(format) {
4322
- formatEle(this, format);
4323
- Object.keys(format).forEach(key => {
4324
- this.props[key] = format[key];
4325
- });
4326
- }
4327
- createRenderObject() {
4328
- return new ParagraphRenderObject(this);
4329
- }
4330
- createLineRect() {
4331
- return new ParagraphLineRectRenderObject(null);
4332
- }
4333
- serialize(viewOptions) {
4334
- return {
4335
- type: 'p',
4336
- props: {
4337
- ...this.props.getSerializeProps(viewOptions)
4338
- }
4339
- };
4340
- }
4341
- clone(data) {
4342
- const clone = new ParagraphElement();
4343
- this.props.clone(clone.props);
4344
- if (data) {
4345
- for (let i = 0; i < this.length; i++) {
4346
- clone.addChild(this.getChild(i).clone(true));
4347
- }
4348
- }
4349
- return clone;
4350
- }
4351
- static createElement() {
4352
- return new ParagraphElement();
4353
- }
4354
- }
4355
- class ParagraphRenderObject extends MuiltBlockLineRenderObject {
4356
- render(e) {
4357
- e.nextRender();
4358
- this.drawProjectNumber(e.render, e.docCtx.viewOptions, e);
4359
- }
4360
- /**
4361
- * 绘制项目符号
4362
- */
4363
- drawProjectNumber(ctx, viewOptions, e) {
4364
- const paraElement = this.element;
4365
- if (paraElement.props.numberType !== ParagraphNumberType.none) {
4366
- if (paraElement.paintRenders.indexOf(this) > 0) {
4367
- return;
4368
- }
4369
- const line = this.getChild(0);
4370
- // const firstInlinePaintPos = ElementUtil.getRenderAbsolutePaintPos(firstInline, {
4371
- // x: 0,
4372
- // y: -viewOptions.translateY
4373
- // });
4374
- const firstInlinePaintPos = {
4375
- x: e.position.x + line.rect.x,
4376
- y: e.position.y + line.rect.y
4377
- };
4378
- if (paraElement.props.numberType === ParagraphNumberType.ul) {
4379
- const numberSymbolY = firstInlinePaintPos.y + line.baseTopLine + Math.floor((line.baseBottomLine - line.baseTopLine) / 2);
4380
- ctx.contentContext.fillCircular(firstInlinePaintPos.x + 4 + paraElement.props.indent, numberSymbolY, 4);
4381
- }
4382
- else if (paraElement.props.numberType === ParagraphNumberType.ol) {
4383
- const parent = paraElement.parent;
4384
- let i = paraElement.getIndex() - 1;
4385
- for (; i >= 0; i--) {
4386
- if (parent.getChild(i) instanceof ParagraphElement) {
4387
- //紧挨上面的段落
4388
- const prevSiblingPara = parent.getChild(i);
4389
- if (prevSiblingPara.props.numberType !== paraElement.props.numberType || prevSiblingPara.props.indent !== paraElement.props.indent) {
4390
- break;
4391
- }
4392
- }
4393
- }
4394
- const olText = (paraElement.getIndex() - i) + '.';
4395
- const textProps = new TextProps();
4396
- textProps.color = '#000';
4397
- textProps.fontSize = line.baseBottomLine - line.baseTopLine;
4398
- textProps.fontName = '宋体';
4399
- ctx.contentContext.drawText(olText, textProps, firstInlinePaintPos.x, firstInlinePaintPos.y + line.baseTopLine, 40, textProps.fontSize);
4400
- }
4401
- }
4402
- }
4403
- clone() {
4404
- const cloneRender = new ParagraphRenderObject(this.element);
4405
- cloneRender.rect = ElementUtil.cloneRect(this.rect);
4406
- for (let i = 0; i < this.length; i++) {
4407
- cloneRender.addChild(this.getChild(i).clone());
4408
- }
4409
- return cloneRender;
4410
- }
4411
- }
4412
- class ParagraphFactory extends ElementFactory {
4413
- match(type) {
4414
- return type === 'p';
4415
- }
4416
- createElement(data) {
4417
- const paraElement = new ParagraphElement();
4418
- const props = data.props;
4419
- paraElement.props.indent = props?.indent ?? 0;
4420
- paraElement.props.hanging = props?.hanging ?? 0;
4421
- paraElement.props.textAlign = props?.textAlign ?? 'left';
4422
- paraElement.props.numberType = props?.numberType ?? -1;
4423
- paraElement.props.lineHeight = props?.lineHeight ?? this.options.defaultLineHeight;
4424
- paraElement.props.marginTop = props?.marginTop ?? 0;
4425
- paraElement.props.marginBottom = props?.marginBottom ?? 0;
4426
- paraElement.props.tabs = props?.tabs ?? [];
4427
- return paraElement;
4428
- }
4429
- }
4430
- /**
4431
- * 段落行框
4432
- */
4433
- class ParagraphLineRectRenderObject extends BlockLineRectRenderObject {
4434
- baseTopLine = 0;
4435
- baseBottomLine = 0;
4436
- startX = 0;
4437
- render(e) {
4438
- }
4439
- clone() {
4440
- const cloneRender = new ParagraphLineRectRenderObject(this.element);
4441
- cloneRender.rect = ElementUtil.cloneRect(this.rect);
4442
- cloneRender.baseTopLine = this.baseTopLine;
4443
- cloneRender.baseBottomLine = this.baseBottomLine;
4444
- for (let i = 0; i < this.length; i++) {
4445
- cloneRender.addChild(this.getChild(i).clone());
4446
- }
4447
- return cloneRender;
4448
- }
4449
- }
4450
-
4451
4553
  class PSymbolElement extends LeafElement {
4452
4554
  textProps;
4453
4555
  defaultHeight = 14;
@@ -4550,6 +4652,9 @@ class TableCellElement extends BlockContainerElement {
4550
4652
  throw new Error('row is null');
4551
4653
  }
4552
4654
  const table = row.parent;
4655
+ if (!table) {
4656
+ debugger;
4657
+ }
4553
4658
  const cellIndex = row.getChildIndex(this);
4554
4659
  let cellWidth = table.getCellWidth(cellIndex);
4555
4660
  const cellOffset = table.getCellOffsetX(cellIndex);
@@ -5610,8 +5715,8 @@ class TableFactory extends ElementFactory {
5610
5715
  /**
5611
5716
  * 行-表格渲染模式
5612
5717
  */
5613
- function textLineRenderMode(ele, data) {
5614
- const tb = ele.cacheRender;
5718
+ function textLineRenderMode(tbRender, data) {
5719
+ const tb = tbRender;
5615
5720
  const rows = [];
5616
5721
  for (let i = 0; i < tb.length; i++) {
5617
5722
  const row = tb.getChild(i);
@@ -7595,8 +7700,7 @@ class RenderContext {
7595
7700
  drawMode = 'view';
7596
7701
  contentOffCanvas;
7597
7702
  overlayOffCanvas;
7598
- //pageRect!: Omit<Rect, any>;
7599
- onRenderCompleted = new Subject$1();
7703
+ onRenderCompleted = new OnceSubject();
7600
7704
  constructor(mainContext) {
7601
7705
  this.mainContext = mainContext;
7602
7706
  }
@@ -7618,7 +7722,6 @@ class RenderContext {
7618
7722
  this.pageRect = { x: 0, y: 0, width: pageSetting.width, height: pageSetting.height };
7619
7723
  ElementUtil.setCanvasProps(this.contentOffCanvas, this.contentContext.ctx, pageSetting);
7620
7724
  ElementUtil.setCanvasProps(this.overlayOffCanvas, this.overlaysContext.ctx, pageSetting);
7621
- //ElementUtil.setCanvasProps(this.mainContext.ctx.canvas, this.mainContext.ctx, pageSetting)
7622
7725
  }
7623
7726
  clear() {
7624
7727
  this.contentContext.clear();
@@ -8657,7 +8760,7 @@ class DataElementDate extends DataElementInlineGroup {
8657
8760
  this.props.valueTextProps.clone(valueText.props);
8658
8761
  valueText.text = formatStr;
8659
8762
  this.addChild(valueText, this.length - 1);
8660
- //this.beginMeasure();
8763
+ this.onChangedValidate();
8661
8764
  }
8662
8765
  getValue() {
8663
8766
  return ElementSerialize.serializeString(this);
@@ -8747,62 +8850,11 @@ class DataElementGroupElement extends InlineGroupInputElement {
8747
8850
  }
8748
8851
  }
8749
8852
  class DataElementGroupRenderObject extends InlineGroupRenderObject {
8750
- paintPos;
8751
8853
  render(e) {
8752
8854
  this.paintPos = e.position;
8753
- }
8754
- getCurrentParaGroupRenders() {
8755
- const renders = [];
8756
- const currParaRender = ElementUtil.getParentRender(this, ParagraphRenderObject);
8757
- for (let i = 0; i < this.element.paintRenders.length; i++) {
8758
- const paraRender = ElementUtil.getParentRender(this.element.paintRenders[i], ParagraphRenderObject);
8759
- if (paraRender === currParaRender) {
8760
- renders.push(this.element.paintRenders[i]);
8761
- }
8762
- }
8763
- return renders;
8764
- }
8765
- pagePaintCompleted(e) {
8766
- const { render, docCtx: { viewOptions } } = e;
8767
- const canPaint = this.element.isMouseenter || this.element.isFocused;
8768
- if (canPaint && this.element.paintRenders.indexOf(this) === 0) {
8769
- const currParaRenders = this.getCurrentParaGroupRenders();
8770
- const verOffset = 3;
8771
- if (currParaRenders.length > 1) {
8772
- const secondGroupRenderPos = currParaRenders[1].paintPos;
8773
- if (secondGroupRenderPos.x + currParaRenders[1].rect.width > this.paintPos.x) {
8774
- const leftPoints = [];
8775
- const rightPoints = [];
8776
- for (let i = 0; i < currParaRenders.length; i++) {
8777
- const groupRender = currParaRenders[i];
8778
- const groupRenderPos = groupRender.paintPos;
8779
- leftPoints.push({ x: groupRenderPos.x, y: groupRenderPos.y - verOffset });
8780
- rightPoints.push({
8781
- x: groupRenderPos.x + groupRender.rect.width,
8782
- y: groupRenderPos.y - verOffset
8783
- });
8784
- leftPoints.push({
8785
- x: groupRenderPos.x,
8786
- y: groupRenderPos.y + groupRender.rect.height + verOffset * 2
8787
- });
8788
- rightPoints.push({
8789
- x: groupRenderPos.x + groupRender.rect.width,
8790
- y: groupRenderPos.y + groupRender.rect.height + verOffset * 2
8791
- });
8792
- }
8793
- const sharpPoints1 = CommonUtil.resharpPoints(rightPoints);
8794
- const sharpPoints = CommonUtil.resharpPoints([...leftPoints.reverse()]);
8795
- render.overlaysContext.strokeLines([...sharpPoints, ...sharpPoints1, sharpPoints[0]], 1, viewOptions.dataGroupColor);
8796
- return;
8797
- }
8798
- }
8799
- for (let i = 0; i < currParaRenders.length; i++) {
8800
- const currRen = currParaRenders[i];
8801
- render.overlaysContext.strokeRect(currRen.paintPos.x, currRen.paintPos.y - verOffset, currRen.rect.width, currRen.rect.height + verOffset * 2, viewOptions.dataGroupColor);
8802
- }
8803
- }
8804
- }
8805
- endRender(ctx, position) {
8855
+ e.render.onRenderCompleted.subscribe(() => {
8856
+ drawDecorator(e, this);
8857
+ });
8806
8858
  }
8807
8859
  clone() {
8808
8860
  const cloneRender = new DataElementGroupRenderObject(this.element);
@@ -9023,6 +9075,7 @@ class DataElementList extends DataElementInlineGroup {
9023
9075
  this.addChild(valueText, this.length - 1);
9024
9076
  }
9025
9077
  }
9078
+ this.onChangedValidate();
9026
9079
  }
9027
9080
  getValue() {
9028
9081
  const values = ElementSerialize.serializeString(this);
@@ -9116,6 +9169,7 @@ class DataElementText extends DataElementInlineGroup {
9116
9169
  valueText.text = val + '';
9117
9170
  this.addChild(valueText, this.length - 1);
9118
9171
  }
9172
+ this.onChangedValidate();
9119
9173
  }
9120
9174
  getValue() {
9121
9175
  return ElementSerialize.serializeString(this, { all: false });
@@ -10952,8 +11006,6 @@ class ElementPaint {
10952
11006
  }
10953
11007
  paintPagePos;
10954
11008
  drawPages(docContainer, selectedSets) {
10955
- // this.rePaint = rePaint;
10956
- //this.measureCommContainer = measureCommContainer;
10957
11009
  this.selectedSets = selectedSets;
10958
11010
  const pageCount = docContainer.length;
10959
11011
  const containerPos = { x: docContainer.rect.x - this.viewOptions.pageOffset.x, y: docContainer.rect.y - this.viewOptions.pageOffset.y };
@@ -10979,13 +11031,13 @@ class ElementPaint {
10979
11031
  });
10980
11032
  nextRenderFn();
10981
11033
  const { scale, viewSettings: { width, height } } = this.viewOptions;
11034
+ while (this.renderCtx.onRenderCompleted.subs.length > 0) {
11035
+ this.renderCtx.onRenderCompleted.next();
11036
+ }
10982
11037
  this.renderCtx.commit({ width, height, scale }, this.viewOptions.pageOffset);
10983
11038
  }
10984
11039
  drawRenderObject(renderObject, parent, parentInViewPort = false) {
10985
11040
  const element = renderObject.element;
10986
- // if (this.rePaint && element) {
10987
- // //element.paintRenders.push(renderObject);
10988
- // }
10989
11041
  const { x: rx, y: ry, width: rw, height: rh } = renderObject.rect;
10990
11042
  const currPosition = { x: rx + parent.x, y: ry + parent.y };
10991
11043
  //判断当前绘制元素是否在视窗内
@@ -11025,18 +11077,6 @@ class ElementPaint {
11025
11077
  };
11026
11078
  renderObject.render(renderData);
11027
11079
  }
11028
- // //审阅信息
11029
- // if (this.viewOptions.showReviewWindow && element && element.type === 'comm') {
11030
- // const commElement = element as CommentElement;
11031
- // if (commElement.props.markType === 'start') {
11032
- // //获取当前绘制元素相对于当前页的坐标
11033
- // this.paintCommMap.push({
11034
- // ele: commElement,
11035
- // render: renderObject,
11036
- // pos: { x: currPosition.x - this.paintPagePos.x, y: currPosition.y - this.paintPagePos.y }
11037
- // });
11038
- // }
11039
- // }
11040
11080
  }
11041
11081
  //处理选中拖蓝
11042
11082
  if (inViewPort && this.selectedSets.has(element)) {
@@ -11472,6 +11512,7 @@ class EditorContext {
11472
11512
  this.clearPrevDocCb?.();
11473
11513
  //this.ele_types_handlers.length = 0;
11474
11514
  this.imageLoader.clear();
11515
+ this._document = null;
11475
11516
  }
11476
11517
  /**
11477
11518
  * 切换行打印模式
@@ -11851,6 +11892,8 @@ class DynamicContextParser {
11851
11892
  TableData(tableId, startRow, startCol, endRow, endCol) {
11852
11893
  const tb = this.doc.treeFind(item => item instanceof TableElement && item.props.id === tableId);
11853
11894
  const res = [];
11895
+ startRow = startRow < 0 ? tb.length + startRow : startRow;
11896
+ startCol = startCol < 0 ? tb.length + startCol : startCol;
11854
11897
  endRow = endRow < 0 ? tb.length + endRow : endRow;
11855
11898
  endCol = endCol < 0 ? tb.length + endCol : endCol;
11856
11899
  for (let i = startRow; i <= endRow; i++) {
@@ -11864,33 +11907,6 @@ class DynamicContextParser {
11864
11907
  }
11865
11908
  }
11866
11909
 
11867
- /**
11868
- * 文字行渲染模式
11869
- 用于医嘱打印模式
11870
- */
11871
- function runTextLineRender(ele, data) {
11872
- if (!data.options.textRowLineMode) {
11873
- return;
11874
- }
11875
- if (ele instanceof TableElement) {
11876
- textLineRenderMode(ele, data);
11877
- remeasureParentRenders(ele.cacheRender);
11878
- return;
11879
- }
11880
- if (ele instanceof BranchElement) {
11881
- for (let i = 0; i < ele.length; i++) {
11882
- runTextLineRender(ele.getChild(i), data);
11883
- }
11884
- }
11885
- }
11886
- function remeasureParentRenders(render) {
11887
- if (!render) {
11888
- return;
11889
- }
11890
- ElementUtil.remeasure(render);
11891
- remeasureParentRenders(render.parent);
11892
- }
11893
-
11894
11910
  class TabElement extends LeafElement {
11895
11911
  constructor() {
11896
11912
  super('tab');
@@ -12228,8 +12244,15 @@ class ParagraphMeasure {
12228
12244
  }
12229
12245
  }
12230
12246
  }
12231
- if (ele.length > 2) ;
12232
- this.arrange(data, ele.getChild(i));
12247
+ this.arrangeInlineItems(data, ele.getChild(i));
12248
+ }
12249
+ }
12250
+ arrangeInlineItems(parentLine, ele) {
12251
+ if (ele instanceof InlineGroupElement) {
12252
+ this.arrangeInlineGroupElement(parentLine, ele);
12253
+ }
12254
+ else {
12255
+ this.arrange(parentLine, ele);
12233
12256
  }
12234
12257
  }
12235
12258
  arrangeLeafElement(parentLine, ele) {
@@ -12453,7 +12476,6 @@ class DocumentArrange {
12453
12476
  this.docCtx.viewOptions.showReviewWindow = this.docCtx.document.commentsContainerElement.markPairs.length > 0;
12454
12477
  const docRenders = this.arrangeDoc();
12455
12478
  this.setMeasureCompletedModifyFlag(doc);
12456
- runTextLineRender(doc, { options: this.options, renderCtx: this.renderCtx });
12457
12479
  this.cacheDocRenders(docRenders);
12458
12480
  return docRenders;
12459
12481
  });
@@ -12606,7 +12628,9 @@ class DocumentArrange {
12606
12628
  continue;
12607
12629
  }
12608
12630
  if (Array.isArray(childRender)) {
12609
- element.cacheRender = null;
12631
+ if (childRender.length > 1) {
12632
+ element.cacheRender = null;
12633
+ }
12610
12634
  for (let j = 0; j < childRender.length; j++) {
12611
12635
  if (j > 0) {
12612
12636
  render = this.createRenderObject(element);
@@ -12623,12 +12647,20 @@ class DocumentArrange {
12623
12647
  }
12624
12648
  }
12625
12649
  renders.forEach(item => ElementUtil.remeasure(item));
12650
+ this.processTableTextLineMode(element);
12626
12651
  return renders.length > 1 ? renders : renders[0];
12627
12652
  }
12628
12653
  else {
12629
12654
  throw new Error('未实现');
12630
12655
  }
12631
12656
  }
12657
+ processTableTextLineMode(ele) {
12658
+ if (this.options.textRowLineMode && ele instanceof TableElement && ele.cacheRender) {
12659
+ const cacheRender = ele.cacheRender;
12660
+ clearChildrenRenderCache(ele);
12661
+ textLineRenderMode(cacheRender, { options: this.options, renderCtx: this.renderCtx });
12662
+ }
12663
+ }
12632
12664
  createRenderObject(element) {
12633
12665
  return element.createRenderObject({
12634
12666
  options: this.options,
@@ -13033,6 +13065,26 @@ class DocumentArrange {
13033
13065
  }
13034
13066
  }
13035
13067
 
13068
+ /**
13069
+ * 文字行渲染模式
13070
+ 用于医嘱打印模式
13071
+ */
13072
+ function runTextLineRender(ele, data) {
13073
+ if (!data.options.textRowLineMode) {
13074
+ return;
13075
+ }
13076
+ if (ele instanceof TableElement) {
13077
+ // textLineRenderMode(ele, data);
13078
+ // remeasureParentRenders(ele.cacheRender)
13079
+ return;
13080
+ }
13081
+ if (ele instanceof BranchElement) {
13082
+ for (let i = 0; i < ele.length; i++) {
13083
+ runTextLineRender(ele.getChild(i), data);
13084
+ }
13085
+ }
13086
+ }
13087
+
13036
13088
  /**
13037
13089
  * 测量阶段,生成Render-UI
13038
13090
  */
@@ -14325,6 +14377,7 @@ class ElementReader {
14325
14377
  const type = data.type;
14326
14378
  for (const factory of this.factories) {
14327
14379
  if (factory.match(type)) {
14380
+ data.props = data.props ?? {};
14328
14381
  const element = factory.createElement(data);
14329
14382
  this.readExtendsProps(data, element);
14330
14383
  const childArr = [];
@@ -18278,7 +18331,6 @@ function getCurrentActiveAppContext() {
18278
18331
  function setCurrentActiveAppContext(ctx) {
18279
18332
  currentActiveAppContext = ctx;
18280
18333
  }
18281
- let taskId;
18282
18334
  function renderApp(root, renderCtx, nodeEvent) {
18283
18335
  window['root'] = root;
18284
18336
  // const nodeEvent = new NodeEvent(root, renderCtx.mainContext.ctx.canvas);
@@ -18288,15 +18340,13 @@ function renderApp(root, renderCtx, nodeEvent) {
18288
18340
  return;
18289
18341
  }
18290
18342
  delayTask = true;
18291
- taskId = setTimeout(() => {
18292
- console.log(taskId + "正在运行中");
18343
+ setTimeout(() => {
18293
18344
  currentActiveAppContext = { root, render: flushTask };
18294
18345
  delayTask = false;
18295
18346
  root.clearPopNodes();
18296
18347
  prepareRender(root, renderCtx, nodeEvent.appState);
18297
18348
  updateCursor(nodeEvent, renderCtx);
18298
18349
  currentActiveAppContext = null;
18299
- console.log(taskId + "运行完成");
18300
18350
  }, 16);
18301
18351
  };
18302
18352
  flushTask();
@@ -18784,7 +18834,6 @@ class NodeEvent {
18784
18834
  this.setActiveAppContext(() => this.onMousemoveHandler(evt));
18785
18835
  });
18786
18836
  canvas.addEventListener('mouseup', evt => {
18787
- console.log('##松开了');
18788
18837
  this.setActiveAppContext(() => this.onMouseupHandler(evt));
18789
18838
  });
18790
18839
  canvas.addEventListener('mouseleave', evt => {
@@ -18879,7 +18928,6 @@ class NodeEvent {
18879
18928
  }
18880
18929
  //按下鼠标并进行拖动时,mousemove在按下的元素上处理
18881
18930
  if (this.appState.mousedown) {
18882
- console.log("offsetY:", evt.offsetY);
18883
18931
  if (this.appState.sourceNode && this.appState.sourceNode.parent) {
18884
18932
  const currNodePos = getNodePosition(this.appState.sourceNode, { x: 0, y: 0 });
18885
18933
  this.appState.pos = { x: evt.offsetX, y: evt.offsetY };
@@ -19237,7 +19285,7 @@ function invokeNodeEvent(node, event, name, useCapture) {
19237
19285
 
19238
19286
  class ViewPaint {
19239
19287
  ctx;
19240
- onRenderCompleted = new Subject$1();
19288
+ onRenderCompleted = new OnceSubject();
19241
19289
  pageSetting;
19242
19290
  pageRect;
19243
19291
  constructor(ctx) {
@@ -20000,7 +20048,7 @@ class MenuContainer extends NodeItems {
20000
20048
  }
20001
20049
  preRender(e) {
20002
20050
  const { render, renderPos, next } = e;
20003
- e.render.onRenderCompleted.onceSubscribe((render) => {
20051
+ e.render.onRenderCompleted.subscribe((render) => {
20004
20052
  e.appState.surface.registerPopNode(this);
20005
20053
  const parentPos = { x: renderPos.x - this.finalRect.x, y: renderPos.y - this.finalRect.y };
20006
20054
  render.tran(() => {
@@ -20074,11 +20122,31 @@ class ScrollView extends NodeItems {
20074
20122
  });
20075
20123
  this.addEventListener('wheel', evt => {
20076
20124
  const { deltaY, deltaX } = evt;
20077
- console.log(`deltaX:${deltaX},deltaY:${deltaY}`);
20078
20125
  this.horBar.updateScrollByCurrent(deltaX / 10, deltaY / 10);
20079
20126
  this.verBar.updateScrollByCurrent(deltaX / 10, deltaY / 10);
20080
20127
  });
20081
20128
  }
20129
+ scrollTo(x, y) {
20130
+ if (!this.content.finalRect || !this.finalRect) {
20131
+ return;
20132
+ }
20133
+ if (y > this.content.finalRect.height) {
20134
+ y = this.content.finalRect.height;
20135
+ }
20136
+ if (x > this.content.finalRect.width) {
20137
+ x = this.content.finalRect.width;
20138
+ }
20139
+ let scrollX = x - this.finalRect.width;
20140
+ let scrollY = y - this.finalRect.height;
20141
+ scrollX = scrollX < 0 ? 0 : scrollX;
20142
+ scrollY = scrollY < 0 ? 0 : scrollY;
20143
+ this.scrollX = scrollX;
20144
+ this.scrollY = scrollY;
20145
+ this.onScrollEvent.next({
20146
+ x: this.scrollX,
20147
+ y: this.scrollY
20148
+ });
20149
+ }
20082
20150
  measureOverride(e, availableSize) {
20083
20151
  const measureSize = availableSize;
20084
20152
  this.content.measure(e, measureSize);
@@ -20301,10 +20369,6 @@ class ScrollBar extends NodeItems {
20301
20369
  const x = this.orientation === 'horizontal' ? (scrollView.scrollX / scrollView.content.finalRect.width) * finalSize.width : (ScrollBarSize - this.thumbSize) / 2;
20302
20370
  const y = this.orientation === 'horizontal' ? (ScrollBarSize - this.thumbSize) / 2 : (scrollView.scrollY / scrollView.content.finalRect.height) * finalSize.height;
20303
20371
  this.thumb.arrange(e, { x, y, width, height });
20304
- if (this.orientation === 'vertical') {
20305
- console.log(y, height, finalSize.width, finalSize.height, scrollView.scrollY);
20306
- if (scrollView.scrollY === 4.723577235772358) ;
20307
- }
20308
20372
  return super.arrangeOverride(e, finalSize);
20309
20373
  }
20310
20374
  render(e) {
@@ -20408,6 +20472,9 @@ class RuleControl extends NodeItems {
20408
20472
  super();
20409
20473
  this.docCtx = docCtx;
20410
20474
  this.ss = docCtx.selectionState;
20475
+ this.bgColor = '#fff';
20476
+ this.shadowBlur = 5;
20477
+ this.shadowColor = '#000';
20411
20478
  this.options = {
20412
20479
  width: 0,
20413
20480
  pagePL: 0,
@@ -21107,7 +21174,7 @@ class CanvasTextEditor extends NodeItems {
21107
21174
  */
21108
21175
  docClickHandle(evt) {
21109
21176
  this.setCursor();
21110
- this.selectionOverlays.getSelectionTreeData();
21177
+ this.updateSelection();
21111
21178
  this.onClickEvent.next(evt);
21112
21179
  }
21113
21180
  /**
@@ -21119,6 +21186,7 @@ class CanvasTextEditor extends NodeItems {
21119
21186
  if (res) {
21120
21187
  this.flushToSchedule();
21121
21188
  }
21189
+ this.updateSelection();
21122
21190
  this.onDblClickEvent.next(evt);
21123
21191
  }
21124
21192
  /**
@@ -21525,6 +21593,7 @@ class CanvasTextEditor extends NodeItems {
21525
21593
  return;
21526
21594
  }
21527
21595
  //this.docScroll.scrollTo(cursorPos.rect.x, cursorPos.rect.y - this.viewOptions.translateY);
21596
+ this.scrollView.scrollTo(cursorPos.rect.x, cursorPos.rect.y + 100);
21528
21597
  }
21529
21598
  }
21530
21599
  /**
@@ -21681,6 +21750,13 @@ class CanvasTextEditor extends NodeItems {
21681
21750
  scrollView.y = 30;
21682
21751
  this.scrollView = scrollView;
21683
21752
  scrollView.content.addChild(this);
21753
+ const label = new LabelNode();
21754
+ label.text = '请注意了';
21755
+ label.bgColor = '#fff';
21756
+ label.padding = 2;
21757
+ label.x = 100;
21758
+ label.y = 100;
21759
+ //this.addChild(label);
21684
21760
  scrollView.onScrollEvent.subscribe(data => {
21685
21761
  //console.log(data);
21686
21762
  this.viewOptions.pageOffset.x = data.x;
@@ -21784,6 +21860,24 @@ class CanvasTextEditor extends NodeItems {
21784
21860
  appCtx.root.setInputPosition(caretPos);
21785
21861
  }
21786
21862
  }
21863
+ measureOverride(e, availableSize) {
21864
+ this.controls.forEach(item => {
21865
+ item.measure(e, availableSize);
21866
+ });
21867
+ return super.measureOverride(e, availableSize);
21868
+ }
21869
+ arrangeOverride(e, finalSize) {
21870
+ this.controls.forEach(item => {
21871
+ const itemRect = {
21872
+ x: item.x,
21873
+ y: item.y,
21874
+ width: item.desiredSize.width,
21875
+ height: item.desiredSize.height
21876
+ };
21877
+ item.arrange(e, itemRect);
21878
+ });
21879
+ return super.arrangeOverride(e, finalSize);
21880
+ }
21787
21881
  }
21788
21882
 
21789
21883
  /**
@@ -22071,5 +22165,5 @@ function removeDuplicatesEvent(events) {
22071
22165
  return arr;
22072
22166
  }
22073
22167
 
22074
- export { BlockContainerElement, BlockContainerRenderObject, BlockContentElement, BlockContentRenderObject, BlockLineRectRenderObject, BodyPartProps, BooleanEnum, BorderProps, BranchElement, BranchRenderObject, BreakElement, BreakFactory, BreakRenderObject, CanvasTextEditor, CheckBoxElement, CheckBoxFactory, CheckBoxProps, CheckBoxRenderObject, ColumnPatchUtil, CommContentBaseElement, CommContentBaseRenderObject, CommContentElement, CommContentProps, CommContentRenderObject, CommProps, CommentContentFactory, CommentElement, CommentFactory, CommentRenderObject, CommentsFactory, CommentsUtil, CommonUtil, CommsContainerElement, CommsContainerRenderObject, ContentMenuItem, ContextMenuElementEvent, 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, DocMode, DocumentBodyElement, DocumentBodyFactory, DocumentBodyPartElement, DocumentBodyPartFactory, DocumentBodyPartRenderObject, DocumentBodyRenderObject, DocumentChange, DocumentCombine, DocumentComment, DocumentContainerRender, DocumentContext, DocumentCursor, DocumentElement, DocumentEvalFunc, DocumentEvent, DocumentFactory, DocumentFooterElement, DocumentFooterFactory, DocumentFooterRenderObject, DocumentHeaderElement, DocumentHeaderFactory, DocumentHeaderRenderObject, DocumentImagesBaseLoader, DocumentImagesLoader, DocumentInput, DocumentPaint, DocumentPrintOffscreen, DocumentPrintOffscreenBase, DocumentProps, DocumentRenderObject, DocumentSelection, DocumentTemplate, DropElementEvent, EditMode, EditorContext, Element, ElementEvent, ElementFactory, ElementPaint, ElementReader, ElementSerialize, ElementUtil, EventMap, EventSourceCore$1 as EventSourceCore, FillNullSpaceElement, FillNullSpaceRenderObject, GetTrackTipsEvent, GotCursorEvent, IDispose, INotifyPropertyChanged, InlineBlockContainer, InlineGroupElement, InlineGroupInputElement, InlineGroupRenderObject, InlineMuiltBlockLineRenderObject, IsInSideDataElement, IsInSideInlineGroupInputElement, KeyboradElementEvent, LeafElement, LeafRenderObject, LostCursorEvent, MarginProps, ModifyFlag$1 as ModifyFlag, MouseElementEvent, MousedownElementEvent, MuiltBlockLineRenderObject, PSymbolElement, PSymbolRenderObject, PaddingProps, PageOptions, PaintContent, ParagraphElement, ParagraphFactory, ParagraphLineRectRenderObject, ParagraphNumberType, ParagraphProps, ParagraphRenderObject, PictureElement, PictureFactory, PictureProps, PictureRenderObject, RadioBoxElement, RadioBoxFactory, RadioBoxProps, RadioBoxRenderObject, RangeUtil, Rect, RenderContext, RenderObject, RenderObjectType, ResizeLeafRenderObject, RunElementFactory, SelectionOverlays, SelectionRange, SelectionState, Subject$1 as Subject, SubjectSubscription$1 as SubjectSubscription, Subscription$1 as Subscription, 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, createPrintTemplate, defaultParaHanging, deleteCurrentParagraph, documentPrint, elementTypeEventHandler, fontMapFunc, fromEvent, getFocusTextSegment, invokeTypeHandler, isDate, objectToString, onTableContextmenu, onceTask$1 as onceTask, printDocOnContextmenu, printNodes, reactiveMap, runTextLineRender, setDataElementProps, setNotifyChangedCallback, targetMaps, textLineRenderMode, toRawType, toTypeString, validateDataEle, validateDataEleRenderObj, validateInlineInputRenderObj, watchChanged };
22168
+ export { BlockContainerElement, BlockContainerRenderObject, BlockContentElement, BlockContentRenderObject, BlockLineRectRenderObject, BodyPartProps, BooleanEnum, BorderProps, BranchElement, BranchRenderObject, BreakElement, BreakFactory, BreakRenderObject, CanvasTextEditor, CheckBoxElement, CheckBoxFactory, CheckBoxProps, CheckBoxRenderObject, ColumnPatchUtil, CommContentBaseElement, CommContentBaseRenderObject, CommContentElement, CommContentProps, CommContentRenderObject, CommProps, CommentContentFactory, CommentElement, CommentFactory, CommentRenderObject, CommentsFactory, CommentsUtil, CommonUtil, CommsContainerElement, CommsContainerRenderObject, ContentMenuItem, ContextMenuElementEvent, 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, DocMode, DocumentBodyElement, DocumentBodyFactory, DocumentBodyPartElement, DocumentBodyPartFactory, DocumentBodyPartRenderObject, DocumentBodyRenderObject, DocumentChange, DocumentCombine, DocumentComment, DocumentContainerRender, DocumentContext, DocumentCursor, DocumentElement, DocumentEvalFunc, DocumentEvent, DocumentFactory, DocumentFooterElement, DocumentFooterFactory, DocumentFooterRenderObject, DocumentHeaderElement, DocumentHeaderFactory, DocumentHeaderRenderObject, DocumentImagesBaseLoader, DocumentImagesLoader, DocumentInput, DocumentPaint, DocumentPrintOffscreen, DocumentPrintOffscreenBase, DocumentProps, DocumentRenderObject, DocumentSelection, DocumentTemplate, DropElementEvent, EditMode, EditorContext, Element, ElementEvent, ElementFactory, ElementPaint, ElementReader, ElementSerialize, ElementUtil, EventMap, EventSourceCore$1 as EventSourceCore, FillNullSpaceElement, FillNullSpaceRenderObject, GetTrackTipsEvent, GotCursorEvent, IDispose, INotifyPropertyChanged, InlineBlockContainer, InlineGroupElement, InlineGroupInputElement, InlineGroupRenderObject, InlineMuiltBlockLineRenderObject, IsInSideDataElement, IsInSideInlineGroupInputElement, KeyboradElementEvent, LeafElement, LeafRenderObject, LostCursorEvent, MarginProps, ModifyFlag$1 as ModifyFlag, MouseElementEvent, MousedownElementEvent, MuiltBlockLineRenderObject, OnceSubject, PSymbolElement, PSymbolRenderObject, PaddingProps, PageOptions, PaintContent, ParagraphElement, ParagraphFactory, ParagraphLineRectRenderObject, ParagraphNumberType, ParagraphProps, ParagraphRenderObject, PictureElement, PictureFactory, PictureProps, PictureRenderObject, RadioBoxElement, RadioBoxFactory, RadioBoxProps, RadioBoxRenderObject, RangeUtil, Rect, RenderContext, RenderObject, RenderObjectType, ResizeLeafRenderObject, RunElementFactory, SelectionOverlays, SelectionRange, SelectionState, Subject$1 as Subject, SubjectSubscription$1 as SubjectSubscription, Subscription$1 as Subscription, 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, createPrintTemplate, defaultParaHanging, deleteCurrentParagraph, documentPrint, drawDecorator, elementTypeEventHandler, fontMapFunc, fromEvent, getCalleeName, getFocusTextSegment, invokeTypeHandler, isDate, objectToString, onTableContextmenu, onceTask$1 as onceTask, parser, printDocOnContextmenu, printNodes, reactiveMap, runTextLineRender, setDataElementProps, setNotifyChangedCallback, targetMaps, textLineRenderMode, toRawType, toTypeString, validateDataEle, validateDataEleRenderObj, validateInlineInputRenderObj, watchChanged };
22075
22169
  //# sourceMappingURL=index.js.map