@hailin-zheng/editor-core 1.1.3 → 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-cjs.d.ts +1 -0
- package/index-cjs.js +260 -253
- package/index-cjs.js.map +1 -1
- package/index.d.ts +1 -0
- package/index.js +257 -254
- package/index.js.map +1 -1
- package/med_editor/framework/document-arrange.d.ts +1 -0
- package/med_editor/framework/element-define.d.ts +1 -0
- package/med_editor/framework/impl/data-element/data-element-base-impl.d.ts +1 -0
- package/med_editor/framework/impl/data-element/data-element-group-impl.d.ts +1 -5
- package/med_editor/framework/impl/table/table-impl.d.ts +1 -1
- package/package.json +1 -1
- package/timeline/timezone.d.ts +2 -0
package/index-cjs.d.ts
CHANGED
package/index-cjs.js
CHANGED
@@ -3580,6 +3580,173 @@ function getCalleeName(node) {
|
|
3580
3580
|
return node['name'];
|
3581
3581
|
}
|
3582
3582
|
|
3583
|
+
class ParagraphElement extends BlockContentElement {
|
3584
|
+
constructor() {
|
3585
|
+
super('p');
|
3586
|
+
this.props = new ParagraphProps();
|
3587
|
+
this.addEvent('BackspaceKey', (evt) => {
|
3588
|
+
if (evt.selectionState.collapsed) {
|
3589
|
+
const pFirstLeafElement = ElementUtil.getFirstLeafElement(this);
|
3590
|
+
if (pFirstLeafElement === evt.source && evt.sourceOffset === 0) {
|
3591
|
+
if (this.props.numberType >= 0) {
|
3592
|
+
this.props.numberType = -1;
|
3593
|
+
evt.isCancel = true;
|
3594
|
+
}
|
3595
|
+
else if (this.props.indent) {
|
3596
|
+
this.props.indent = 0;
|
3597
|
+
evt.isCancel = true;
|
3598
|
+
}
|
3599
|
+
}
|
3600
|
+
}
|
3601
|
+
}, true);
|
3602
|
+
this.addEvent('ElementKeyDown', evt => {
|
3603
|
+
//当前存在缩进,点击tab
|
3604
|
+
if (evt.sourceEvent.keyCode === 9) {
|
3605
|
+
const { startControl, startOffset } = evt.selectionState;
|
3606
|
+
if (startOffset === 0 && startControl === this.getChild(0)) {
|
3607
|
+
const defaultIndent = evt.ctx.viewOptions.defaultIndent;
|
3608
|
+
let increaseValue = evt.sourceEvent.shiftKey ? -defaultIndent : defaultIndent;
|
3609
|
+
this.props.indent += increaseValue;
|
3610
|
+
evt.isCancel = true;
|
3611
|
+
evt.sourceEvent.preventDefault();
|
3612
|
+
}
|
3613
|
+
}
|
3614
|
+
}, true);
|
3615
|
+
}
|
3616
|
+
/**
|
3617
|
+
* 设置样式
|
3618
|
+
* @param format
|
3619
|
+
*/
|
3620
|
+
setFormat(format) {
|
3621
|
+
formatEle(this, format);
|
3622
|
+
Object.keys(format).forEach(key => {
|
3623
|
+
this.props[key] = format[key];
|
3624
|
+
});
|
3625
|
+
}
|
3626
|
+
createRenderObject() {
|
3627
|
+
return new ParagraphRenderObject(this);
|
3628
|
+
}
|
3629
|
+
createLineRect() {
|
3630
|
+
return new ParagraphLineRectRenderObject(null);
|
3631
|
+
}
|
3632
|
+
serialize(viewOptions) {
|
3633
|
+
return {
|
3634
|
+
type: 'p',
|
3635
|
+
props: {
|
3636
|
+
...this.props.getSerializeProps(viewOptions)
|
3637
|
+
}
|
3638
|
+
};
|
3639
|
+
}
|
3640
|
+
clone(data) {
|
3641
|
+
const clone = new ParagraphElement();
|
3642
|
+
this.props.clone(clone.props);
|
3643
|
+
if (data) {
|
3644
|
+
for (let i = 0; i < this.length; i++) {
|
3645
|
+
clone.addChild(this.getChild(i).clone(true));
|
3646
|
+
}
|
3647
|
+
}
|
3648
|
+
return clone;
|
3649
|
+
}
|
3650
|
+
static createElement() {
|
3651
|
+
return new ParagraphElement();
|
3652
|
+
}
|
3653
|
+
}
|
3654
|
+
class ParagraphRenderObject extends MuiltBlockLineRenderObject {
|
3655
|
+
render(e) {
|
3656
|
+
e.nextRender();
|
3657
|
+
this.drawProjectNumber(e.render, e.docCtx.viewOptions, e);
|
3658
|
+
}
|
3659
|
+
/**
|
3660
|
+
* 绘制项目符号
|
3661
|
+
*/
|
3662
|
+
drawProjectNumber(ctx, viewOptions, e) {
|
3663
|
+
const paraElement = this.element;
|
3664
|
+
if (paraElement.props.numberType !== exports.ParagraphNumberType.none) {
|
3665
|
+
if (paraElement.paintRenders.indexOf(this) > 0) {
|
3666
|
+
return;
|
3667
|
+
}
|
3668
|
+
const line = this.getChild(0);
|
3669
|
+
// const firstInlinePaintPos = ElementUtil.getRenderAbsolutePaintPos(firstInline, {
|
3670
|
+
// x: 0,
|
3671
|
+
// y: -viewOptions.translateY
|
3672
|
+
// });
|
3673
|
+
const firstInlinePaintPos = {
|
3674
|
+
x: e.position.x + line.rect.x,
|
3675
|
+
y: e.position.y + line.rect.y
|
3676
|
+
};
|
3677
|
+
if (paraElement.props.numberType === exports.ParagraphNumberType.ul) {
|
3678
|
+
const numberSymbolY = firstInlinePaintPos.y + line.baseTopLine + Math.floor((line.baseBottomLine - line.baseTopLine) / 2);
|
3679
|
+
ctx.contentContext.fillCircular(firstInlinePaintPos.x + 4 + paraElement.props.indent, numberSymbolY, 4);
|
3680
|
+
}
|
3681
|
+
else if (paraElement.props.numberType === exports.ParagraphNumberType.ol) {
|
3682
|
+
const parent = paraElement.parent;
|
3683
|
+
let i = paraElement.getIndex() - 1;
|
3684
|
+
for (; i >= 0; i--) {
|
3685
|
+
if (parent.getChild(i) instanceof ParagraphElement) {
|
3686
|
+
//紧挨上面的段落
|
3687
|
+
const prevSiblingPara = parent.getChild(i);
|
3688
|
+
if (prevSiblingPara.props.numberType !== paraElement.props.numberType || prevSiblingPara.props.indent !== paraElement.props.indent) {
|
3689
|
+
break;
|
3690
|
+
}
|
3691
|
+
}
|
3692
|
+
}
|
3693
|
+
const olText = (paraElement.getIndex() - i) + '.';
|
3694
|
+
const textProps = new TextProps();
|
3695
|
+
textProps.color = '#000';
|
3696
|
+
textProps.fontSize = line.baseBottomLine - line.baseTopLine;
|
3697
|
+
textProps.fontName = '宋体';
|
3698
|
+
ctx.contentContext.drawText(olText, textProps, firstInlinePaintPos.x, firstInlinePaintPos.y + line.baseTopLine, 40, textProps.fontSize);
|
3699
|
+
}
|
3700
|
+
}
|
3701
|
+
}
|
3702
|
+
clone() {
|
3703
|
+
const cloneRender = new ParagraphRenderObject(this.element);
|
3704
|
+
cloneRender.rect = ElementUtil.cloneRect(this.rect);
|
3705
|
+
for (let i = 0; i < this.length; i++) {
|
3706
|
+
cloneRender.addChild(this.getChild(i).clone());
|
3707
|
+
}
|
3708
|
+
return cloneRender;
|
3709
|
+
}
|
3710
|
+
}
|
3711
|
+
class ParagraphFactory extends ElementFactory {
|
3712
|
+
match(type) {
|
3713
|
+
return type === 'p';
|
3714
|
+
}
|
3715
|
+
createElement(data) {
|
3716
|
+
const paraElement = new ParagraphElement();
|
3717
|
+
const props = data.props;
|
3718
|
+
paraElement.props.indent = props?.indent ?? 0;
|
3719
|
+
paraElement.props.hanging = props?.hanging ?? 0;
|
3720
|
+
paraElement.props.textAlign = props?.textAlign ?? 'left';
|
3721
|
+
paraElement.props.numberType = props?.numberType ?? -1;
|
3722
|
+
paraElement.props.lineHeight = props?.lineHeight ?? this.options.defaultLineHeight;
|
3723
|
+
paraElement.props.marginTop = props?.marginTop ?? 0;
|
3724
|
+
paraElement.props.marginBottom = props?.marginBottom ?? 0;
|
3725
|
+
paraElement.props.tabs = props?.tabs ?? [];
|
3726
|
+
return paraElement;
|
3727
|
+
}
|
3728
|
+
}
|
3729
|
+
/**
|
3730
|
+
* 段落行框
|
3731
|
+
*/
|
3732
|
+
class ParagraphLineRectRenderObject extends BlockLineRectRenderObject {
|
3733
|
+
baseTopLine = 0;
|
3734
|
+
baseBottomLine = 0;
|
3735
|
+
startX = 0;
|
3736
|
+
render(e) {
|
3737
|
+
}
|
3738
|
+
clone() {
|
3739
|
+
const cloneRender = new ParagraphLineRectRenderObject(this.element);
|
3740
|
+
cloneRender.rect = ElementUtil.cloneRect(this.rect);
|
3741
|
+
cloneRender.baseTopLine = this.baseTopLine;
|
3742
|
+
cloneRender.baseBottomLine = this.baseBottomLine;
|
3743
|
+
for (let i = 0; i < this.length; i++) {
|
3744
|
+
cloneRender.addChild(this.getChild(i).clone());
|
3745
|
+
}
|
3746
|
+
return cloneRender;
|
3747
|
+
}
|
3748
|
+
}
|
3749
|
+
|
3583
3750
|
/**
|
3584
3751
|
* 所有的数据元继承上述两个抽象类
|
3585
3752
|
*/
|
@@ -3783,6 +3950,7 @@ function getCurrOptions(ele) {
|
|
3783
3950
|
class DataElementRenderObject extends InlineGroupRenderObject {
|
3784
3951
|
render(e) {
|
3785
3952
|
const { render, position, docCtx: { viewOptions } } = e;
|
3953
|
+
this.paintPos = e.position;
|
3786
3954
|
//数据元不打印
|
3787
3955
|
if (!this.element.props.printable && render.drawMode === 'print') {
|
3788
3956
|
return;
|
@@ -3815,6 +3983,9 @@ class DataElementRenderObject extends InlineGroupRenderObject {
|
|
3815
3983
|
e.nextRender();
|
3816
3984
|
this.drawCaption(e);
|
3817
3985
|
});
|
3986
|
+
e.render.onRenderCompleted.subscribe(() => {
|
3987
|
+
drawDecorator(e, this);
|
3988
|
+
});
|
3818
3989
|
}
|
3819
3990
|
/**
|
3820
3991
|
* 绘制数据元标题
|
@@ -3895,6 +4066,57 @@ class DataElementBaseFactory extends ElementFactory {
|
|
3895
4066
|
}
|
3896
4067
|
}
|
3897
4068
|
}
|
4069
|
+
function drawDecorator(e, r) {
|
4070
|
+
const { render, docCtx: { viewOptions } } = e;
|
4071
|
+
const canPaint = r.element.isMouseenter || r.element.isFocused;
|
4072
|
+
if (canPaint && r.element.paintRenders.indexOf(r) === 0) {
|
4073
|
+
const currParaRenders = getCurrentParaGroupRenders(r);
|
4074
|
+
const verOffset = 3;
|
4075
|
+
if (currParaRenders.length > 1) {
|
4076
|
+
const secondGroupRenderPos = currParaRenders[1].paintPos;
|
4077
|
+
if (secondGroupRenderPos.x + currParaRenders[1].rect.width > r.paintPos.x) {
|
4078
|
+
const leftPoints = [];
|
4079
|
+
const rightPoints = [];
|
4080
|
+
for (let i = 0; i < currParaRenders.length; i++) {
|
4081
|
+
const groupRender = currParaRenders[i];
|
4082
|
+
const groupRenderPos = groupRender.paintPos;
|
4083
|
+
leftPoints.push({ x: groupRenderPos.x, y: groupRenderPos.y - verOffset });
|
4084
|
+
rightPoints.push({
|
4085
|
+
x: groupRenderPos.x + groupRender.rect.width,
|
4086
|
+
y: groupRenderPos.y - verOffset
|
4087
|
+
});
|
4088
|
+
leftPoints.push({
|
4089
|
+
x: groupRenderPos.x,
|
4090
|
+
y: groupRenderPos.y + groupRender.rect.height + verOffset * 2
|
4091
|
+
});
|
4092
|
+
rightPoints.push({
|
4093
|
+
x: groupRenderPos.x + groupRender.rect.width,
|
4094
|
+
y: groupRenderPos.y + groupRender.rect.height + verOffset * 2
|
4095
|
+
});
|
4096
|
+
}
|
4097
|
+
const sharpPoints1 = CommonUtil.resharpPoints(rightPoints);
|
4098
|
+
const sharpPoints = CommonUtil.resharpPoints([...leftPoints.reverse()]);
|
4099
|
+
render.overlaysContext.strokeLines([...sharpPoints, ...sharpPoints1, sharpPoints[0]], 1, viewOptions.dataGroupColor);
|
4100
|
+
return;
|
4101
|
+
}
|
4102
|
+
}
|
4103
|
+
for (let i = 0; i < currParaRenders.length; i++) {
|
4104
|
+
const currRen = currParaRenders[i];
|
4105
|
+
render.overlaysContext.strokeRect(currRen.paintPos.x, currRen.paintPos.y - verOffset, currRen.rect.width, currRen.rect.height + verOffset * 2, viewOptions.dataGroupColor);
|
4106
|
+
}
|
4107
|
+
}
|
4108
|
+
}
|
4109
|
+
function getCurrentParaGroupRenders(r) {
|
4110
|
+
const renders = [];
|
4111
|
+
const currParaRender = ElementUtil.getParentRender(r, ParagraphRenderObject);
|
4112
|
+
for (let i = 0; i < r.element.paintRenders.length; i++) {
|
4113
|
+
const paraRender = ElementUtil.getParentRender(r.element.paintRenders[i], ParagraphRenderObject);
|
4114
|
+
if (paraRender === currParaRender) {
|
4115
|
+
renders.push(r.element.paintRenders[i]);
|
4116
|
+
}
|
4117
|
+
}
|
4118
|
+
return renders;
|
4119
|
+
}
|
3898
4120
|
|
3899
4121
|
class DocumentElement extends BlockContainerElement {
|
3900
4122
|
//props: DocumentProps;
|
@@ -4356,173 +4578,6 @@ class DocumentHeaderFactory extends ElementFactory {
|
|
4356
4578
|
}
|
4357
4579
|
}
|
4358
4580
|
|
4359
|
-
class ParagraphElement extends BlockContentElement {
|
4360
|
-
constructor() {
|
4361
|
-
super('p');
|
4362
|
-
this.props = new ParagraphProps();
|
4363
|
-
this.addEvent('BackspaceKey', (evt) => {
|
4364
|
-
if (evt.selectionState.collapsed) {
|
4365
|
-
const pFirstLeafElement = ElementUtil.getFirstLeafElement(this);
|
4366
|
-
if (pFirstLeafElement === evt.source && evt.sourceOffset === 0) {
|
4367
|
-
if (this.props.numberType >= 0) {
|
4368
|
-
this.props.numberType = -1;
|
4369
|
-
evt.isCancel = true;
|
4370
|
-
}
|
4371
|
-
else if (this.props.indent) {
|
4372
|
-
this.props.indent = 0;
|
4373
|
-
evt.isCancel = true;
|
4374
|
-
}
|
4375
|
-
}
|
4376
|
-
}
|
4377
|
-
}, true);
|
4378
|
-
this.addEvent('ElementKeyDown', evt => {
|
4379
|
-
//当前存在缩进,点击tab
|
4380
|
-
if (evt.sourceEvent.keyCode === 9) {
|
4381
|
-
const { startControl, startOffset } = evt.selectionState;
|
4382
|
-
if (startOffset === 0 && startControl === this.getChild(0)) {
|
4383
|
-
const defaultIndent = evt.ctx.viewOptions.defaultIndent;
|
4384
|
-
let increaseValue = evt.sourceEvent.shiftKey ? -defaultIndent : defaultIndent;
|
4385
|
-
this.props.indent += increaseValue;
|
4386
|
-
evt.isCancel = true;
|
4387
|
-
evt.sourceEvent.preventDefault();
|
4388
|
-
}
|
4389
|
-
}
|
4390
|
-
}, true);
|
4391
|
-
}
|
4392
|
-
/**
|
4393
|
-
* 设置样式
|
4394
|
-
* @param format
|
4395
|
-
*/
|
4396
|
-
setFormat(format) {
|
4397
|
-
formatEle(this, format);
|
4398
|
-
Object.keys(format).forEach(key => {
|
4399
|
-
this.props[key] = format[key];
|
4400
|
-
});
|
4401
|
-
}
|
4402
|
-
createRenderObject() {
|
4403
|
-
return new ParagraphRenderObject(this);
|
4404
|
-
}
|
4405
|
-
createLineRect() {
|
4406
|
-
return new ParagraphLineRectRenderObject(null);
|
4407
|
-
}
|
4408
|
-
serialize(viewOptions) {
|
4409
|
-
return {
|
4410
|
-
type: 'p',
|
4411
|
-
props: {
|
4412
|
-
...this.props.getSerializeProps(viewOptions)
|
4413
|
-
}
|
4414
|
-
};
|
4415
|
-
}
|
4416
|
-
clone(data) {
|
4417
|
-
const clone = new ParagraphElement();
|
4418
|
-
this.props.clone(clone.props);
|
4419
|
-
if (data) {
|
4420
|
-
for (let i = 0; i < this.length; i++) {
|
4421
|
-
clone.addChild(this.getChild(i).clone(true));
|
4422
|
-
}
|
4423
|
-
}
|
4424
|
-
return clone;
|
4425
|
-
}
|
4426
|
-
static createElement() {
|
4427
|
-
return new ParagraphElement();
|
4428
|
-
}
|
4429
|
-
}
|
4430
|
-
class ParagraphRenderObject extends MuiltBlockLineRenderObject {
|
4431
|
-
render(e) {
|
4432
|
-
e.nextRender();
|
4433
|
-
this.drawProjectNumber(e.render, e.docCtx.viewOptions, e);
|
4434
|
-
}
|
4435
|
-
/**
|
4436
|
-
* 绘制项目符号
|
4437
|
-
*/
|
4438
|
-
drawProjectNumber(ctx, viewOptions, e) {
|
4439
|
-
const paraElement = this.element;
|
4440
|
-
if (paraElement.props.numberType !== exports.ParagraphNumberType.none) {
|
4441
|
-
if (paraElement.paintRenders.indexOf(this) > 0) {
|
4442
|
-
return;
|
4443
|
-
}
|
4444
|
-
const line = this.getChild(0);
|
4445
|
-
// const firstInlinePaintPos = ElementUtil.getRenderAbsolutePaintPos(firstInline, {
|
4446
|
-
// x: 0,
|
4447
|
-
// y: -viewOptions.translateY
|
4448
|
-
// });
|
4449
|
-
const firstInlinePaintPos = {
|
4450
|
-
x: e.position.x + line.rect.x,
|
4451
|
-
y: e.position.y + line.rect.y
|
4452
|
-
};
|
4453
|
-
if (paraElement.props.numberType === exports.ParagraphNumberType.ul) {
|
4454
|
-
const numberSymbolY = firstInlinePaintPos.y + line.baseTopLine + Math.floor((line.baseBottomLine - line.baseTopLine) / 2);
|
4455
|
-
ctx.contentContext.fillCircular(firstInlinePaintPos.x + 4 + paraElement.props.indent, numberSymbolY, 4);
|
4456
|
-
}
|
4457
|
-
else if (paraElement.props.numberType === exports.ParagraphNumberType.ol) {
|
4458
|
-
const parent = paraElement.parent;
|
4459
|
-
let i = paraElement.getIndex() - 1;
|
4460
|
-
for (; i >= 0; i--) {
|
4461
|
-
if (parent.getChild(i) instanceof ParagraphElement) {
|
4462
|
-
//紧挨上面的段落
|
4463
|
-
const prevSiblingPara = parent.getChild(i);
|
4464
|
-
if (prevSiblingPara.props.numberType !== paraElement.props.numberType || prevSiblingPara.props.indent !== paraElement.props.indent) {
|
4465
|
-
break;
|
4466
|
-
}
|
4467
|
-
}
|
4468
|
-
}
|
4469
|
-
const olText = (paraElement.getIndex() - i) + '.';
|
4470
|
-
const textProps = new TextProps();
|
4471
|
-
textProps.color = '#000';
|
4472
|
-
textProps.fontSize = line.baseBottomLine - line.baseTopLine;
|
4473
|
-
textProps.fontName = '宋体';
|
4474
|
-
ctx.contentContext.drawText(olText, textProps, firstInlinePaintPos.x, firstInlinePaintPos.y + line.baseTopLine, 40, textProps.fontSize);
|
4475
|
-
}
|
4476
|
-
}
|
4477
|
-
}
|
4478
|
-
clone() {
|
4479
|
-
const cloneRender = new ParagraphRenderObject(this.element);
|
4480
|
-
cloneRender.rect = ElementUtil.cloneRect(this.rect);
|
4481
|
-
for (let i = 0; i < this.length; i++) {
|
4482
|
-
cloneRender.addChild(this.getChild(i).clone());
|
4483
|
-
}
|
4484
|
-
return cloneRender;
|
4485
|
-
}
|
4486
|
-
}
|
4487
|
-
class ParagraphFactory extends ElementFactory {
|
4488
|
-
match(type) {
|
4489
|
-
return type === 'p';
|
4490
|
-
}
|
4491
|
-
createElement(data) {
|
4492
|
-
const paraElement = new ParagraphElement();
|
4493
|
-
const props = data.props;
|
4494
|
-
paraElement.props.indent = props?.indent ?? 0;
|
4495
|
-
paraElement.props.hanging = props?.hanging ?? 0;
|
4496
|
-
paraElement.props.textAlign = props?.textAlign ?? 'left';
|
4497
|
-
paraElement.props.numberType = props?.numberType ?? -1;
|
4498
|
-
paraElement.props.lineHeight = props?.lineHeight ?? this.options.defaultLineHeight;
|
4499
|
-
paraElement.props.marginTop = props?.marginTop ?? 0;
|
4500
|
-
paraElement.props.marginBottom = props?.marginBottom ?? 0;
|
4501
|
-
paraElement.props.tabs = props?.tabs ?? [];
|
4502
|
-
return paraElement;
|
4503
|
-
}
|
4504
|
-
}
|
4505
|
-
/**
|
4506
|
-
* 段落行框
|
4507
|
-
*/
|
4508
|
-
class ParagraphLineRectRenderObject extends BlockLineRectRenderObject {
|
4509
|
-
baseTopLine = 0;
|
4510
|
-
baseBottomLine = 0;
|
4511
|
-
startX = 0;
|
4512
|
-
render(e) {
|
4513
|
-
}
|
4514
|
-
clone() {
|
4515
|
-
const cloneRender = new ParagraphLineRectRenderObject(this.element);
|
4516
|
-
cloneRender.rect = ElementUtil.cloneRect(this.rect);
|
4517
|
-
cloneRender.baseTopLine = this.baseTopLine;
|
4518
|
-
cloneRender.baseBottomLine = this.baseBottomLine;
|
4519
|
-
for (let i = 0; i < this.length; i++) {
|
4520
|
-
cloneRender.addChild(this.getChild(i).clone());
|
4521
|
-
}
|
4522
|
-
return cloneRender;
|
4523
|
-
}
|
4524
|
-
}
|
4525
|
-
|
4526
4581
|
class PSymbolElement extends LeafElement {
|
4527
4582
|
textProps;
|
4528
4583
|
defaultHeight = 14;
|
@@ -5688,8 +5743,8 @@ class TableFactory extends ElementFactory {
|
|
5688
5743
|
/**
|
5689
5744
|
* 行-表格渲染模式
|
5690
5745
|
*/
|
5691
|
-
function textLineRenderMode(
|
5692
|
-
const tb =
|
5746
|
+
function textLineRenderMode(tbRender, data) {
|
5747
|
+
const tb = tbRender;
|
5693
5748
|
const rows = [];
|
5694
5749
|
for (let i = 0; i < tb.length; i++) {
|
5695
5750
|
const row = tb.getChild(i);
|
@@ -8825,60 +8880,9 @@ class DataElementGroupElement extends InlineGroupInputElement {
|
|
8825
8880
|
class DataElementGroupRenderObject extends InlineGroupRenderObject {
|
8826
8881
|
render(e) {
|
8827
8882
|
this.paintPos = e.position;
|
8828
|
-
e.render.onRenderCompleted.subscribe(() => {
|
8829
|
-
|
8830
|
-
|
8831
|
-
const renders = [];
|
8832
|
-
const currParaRender = ElementUtil.getParentRender(this, ParagraphRenderObject);
|
8833
|
-
for (let i = 0; i < this.element.paintRenders.length; i++) {
|
8834
|
-
const paraRender = ElementUtil.getParentRender(this.element.paintRenders[i], ParagraphRenderObject);
|
8835
|
-
if (paraRender === currParaRender) {
|
8836
|
-
renders.push(this.element.paintRenders[i]);
|
8837
|
-
}
|
8838
|
-
}
|
8839
|
-
return renders;
|
8840
|
-
}
|
8841
|
-
paintDecorate(e) {
|
8842
|
-
const { render, docCtx: { viewOptions } } = e;
|
8843
|
-
const canPaint = this.element.isMouseenter || this.element.isFocused;
|
8844
|
-
if (canPaint && this.element.paintRenders.indexOf(this) === 0) {
|
8845
|
-
const currParaRenders = this.getCurrentParaGroupRenders();
|
8846
|
-
const verOffset = 3;
|
8847
|
-
if (currParaRenders.length > 1) {
|
8848
|
-
const secondGroupRenderPos = currParaRenders[1].paintPos;
|
8849
|
-
if (secondGroupRenderPos.x + currParaRenders[1].rect.width > this.paintPos.x) {
|
8850
|
-
const leftPoints = [];
|
8851
|
-
const rightPoints = [];
|
8852
|
-
for (let i = 0; i < currParaRenders.length; i++) {
|
8853
|
-
const groupRender = currParaRenders[i];
|
8854
|
-
const groupRenderPos = groupRender.paintPos;
|
8855
|
-
leftPoints.push({ x: groupRenderPos.x, y: groupRenderPos.y - verOffset });
|
8856
|
-
rightPoints.push({
|
8857
|
-
x: groupRenderPos.x + groupRender.rect.width,
|
8858
|
-
y: groupRenderPos.y - verOffset
|
8859
|
-
});
|
8860
|
-
leftPoints.push({
|
8861
|
-
x: groupRenderPos.x,
|
8862
|
-
y: groupRenderPos.y + groupRender.rect.height + verOffset * 2
|
8863
|
-
});
|
8864
|
-
rightPoints.push({
|
8865
|
-
x: groupRenderPos.x + groupRender.rect.width,
|
8866
|
-
y: groupRenderPos.y + groupRender.rect.height + verOffset * 2
|
8867
|
-
});
|
8868
|
-
}
|
8869
|
-
const sharpPoints1 = CommonUtil.resharpPoints(rightPoints);
|
8870
|
-
const sharpPoints = CommonUtil.resharpPoints([...leftPoints.reverse()]);
|
8871
|
-
render.overlaysContext.strokeLines([...sharpPoints, ...sharpPoints1, sharpPoints[0]], 1, viewOptions.dataGroupColor);
|
8872
|
-
return;
|
8873
|
-
}
|
8874
|
-
}
|
8875
|
-
for (let i = 0; i < currParaRenders.length; i++) {
|
8876
|
-
const currRen = currParaRenders[i];
|
8877
|
-
render.overlaysContext.strokeRect(currRen.paintPos.x, currRen.paintPos.y - verOffset, currRen.rect.width, currRen.rect.height + verOffset * 2, viewOptions.dataGroupColor);
|
8878
|
-
}
|
8879
|
-
}
|
8880
|
-
}
|
8881
|
-
endRender(ctx, position) {
|
8883
|
+
e.render.onRenderCompleted.subscribe(() => {
|
8884
|
+
drawDecorator(e, this);
|
8885
|
+
});
|
8882
8886
|
}
|
8883
8887
|
clone() {
|
8884
8888
|
const cloneRender = new DataElementGroupRenderObject(this.element);
|
@@ -11931,33 +11935,6 @@ class DynamicContextParser {
|
|
11931
11935
|
}
|
11932
11936
|
}
|
11933
11937
|
|
11934
|
-
/**
|
11935
|
-
* 文字行渲染模式
|
11936
|
-
用于医嘱打印模式
|
11937
|
-
*/
|
11938
|
-
function runTextLineRender(ele, data) {
|
11939
|
-
if (!data.options.textRowLineMode) {
|
11940
|
-
return;
|
11941
|
-
}
|
11942
|
-
if (ele instanceof TableElement) {
|
11943
|
-
textLineRenderMode(ele, data);
|
11944
|
-
remeasureParentRenders(ele.cacheRender);
|
11945
|
-
return;
|
11946
|
-
}
|
11947
|
-
if (ele instanceof BranchElement) {
|
11948
|
-
for (let i = 0; i < ele.length; i++) {
|
11949
|
-
runTextLineRender(ele.getChild(i), data);
|
11950
|
-
}
|
11951
|
-
}
|
11952
|
-
}
|
11953
|
-
function remeasureParentRenders(render) {
|
11954
|
-
if (!render) {
|
11955
|
-
return;
|
11956
|
-
}
|
11957
|
-
ElementUtil.remeasure(render);
|
11958
|
-
remeasureParentRenders(render.parent);
|
11959
|
-
}
|
11960
|
-
|
11961
11938
|
class TabElement extends LeafElement {
|
11962
11939
|
constructor() {
|
11963
11940
|
super('tab');
|
@@ -12527,7 +12504,6 @@ class DocumentArrange {
|
|
12527
12504
|
this.docCtx.viewOptions.showReviewWindow = this.docCtx.document.commentsContainerElement.markPairs.length > 0;
|
12528
12505
|
const docRenders = this.arrangeDoc();
|
12529
12506
|
this.setMeasureCompletedModifyFlag(doc);
|
12530
|
-
runTextLineRender(doc, { options: this.options, renderCtx: this.renderCtx });
|
12531
12507
|
this.cacheDocRenders(docRenders);
|
12532
12508
|
return docRenders;
|
12533
12509
|
});
|
@@ -12699,12 +12675,20 @@ class DocumentArrange {
|
|
12699
12675
|
}
|
12700
12676
|
}
|
12701
12677
|
renders.forEach(item => ElementUtil.remeasure(item));
|
12678
|
+
this.processTableTextLineMode(element);
|
12702
12679
|
return renders.length > 1 ? renders : renders[0];
|
12703
12680
|
}
|
12704
12681
|
else {
|
12705
12682
|
throw new Error('未实现');
|
12706
12683
|
}
|
12707
12684
|
}
|
12685
|
+
processTableTextLineMode(ele) {
|
12686
|
+
if (this.options.textRowLineMode && ele instanceof TableElement && ele.cacheRender) {
|
12687
|
+
const cacheRender = ele.cacheRender;
|
12688
|
+
clearChildrenRenderCache(ele);
|
12689
|
+
textLineRenderMode(cacheRender, { options: this.options, renderCtx: this.renderCtx });
|
12690
|
+
}
|
12691
|
+
}
|
12708
12692
|
createRenderObject(element) {
|
12709
12693
|
return element.createRenderObject({
|
12710
12694
|
options: this.options,
|
@@ -13109,6 +13093,26 @@ class DocumentArrange {
|
|
13109
13093
|
}
|
13110
13094
|
}
|
13111
13095
|
|
13096
|
+
/**
|
13097
|
+
* 文字行渲染模式
|
13098
|
+
用于医嘱打印模式
|
13099
|
+
*/
|
13100
|
+
function runTextLineRender(ele, data) {
|
13101
|
+
if (!data.options.textRowLineMode) {
|
13102
|
+
return;
|
13103
|
+
}
|
13104
|
+
if (ele instanceof TableElement) {
|
13105
|
+
// textLineRenderMode(ele, data);
|
13106
|
+
// remeasureParentRenders(ele.cacheRender)
|
13107
|
+
return;
|
13108
|
+
}
|
13109
|
+
if (ele instanceof BranchElement) {
|
13110
|
+
for (let i = 0; i < ele.length; i++) {
|
13111
|
+
runTextLineRender(ele.getChild(i), data);
|
13112
|
+
}
|
13113
|
+
}
|
13114
|
+
}
|
13115
|
+
|
13112
13116
|
/**
|
13113
13117
|
* 测量阶段,生成Render-UI
|
13114
13118
|
*/
|
@@ -14401,6 +14405,7 @@ class ElementReader {
|
|
14401
14405
|
const type = data.type;
|
14402
14406
|
for (const factory of this.factories) {
|
14403
14407
|
if (factory.match(type)) {
|
14408
|
+
data.props = data.props ?? {};
|
14404
14409
|
const element = factory.createElement(data);
|
14405
14410
|
this.readExtendsProps(data, element);
|
14406
14411
|
const childArr = [];
|
@@ -18857,7 +18862,6 @@ class NodeEvent {
|
|
18857
18862
|
this.setActiveAppContext(() => this.onMousemoveHandler(evt));
|
18858
18863
|
});
|
18859
18864
|
canvas.addEventListener('mouseup', evt => {
|
18860
|
-
console.log('##松开了');
|
18861
18865
|
this.setActiveAppContext(() => this.onMouseupHandler(evt));
|
18862
18866
|
});
|
18863
18867
|
canvas.addEventListener('mouseleave', evt => {
|
@@ -18952,7 +18956,6 @@ class NodeEvent {
|
|
18952
18956
|
}
|
18953
18957
|
//按下鼠标并进行拖动时,mousemove在按下的元素上处理
|
18954
18958
|
if (this.appState.mousedown) {
|
18955
|
-
console.log("offsetY:", evt.offsetY);
|
18956
18959
|
if (this.appState.sourceNode && this.appState.sourceNode.parent) {
|
18957
18960
|
const currNodePos = getNodePosition(this.appState.sourceNode, { x: 0, y: 0 });
|
18958
18961
|
this.appState.pos = { x: evt.offsetX, y: evt.offsetY };
|
@@ -22388,19 +22391,23 @@ exports.ValidateElement = ValidateElement;
|
|
22388
22391
|
exports.ValidateProps = ValidateProps;
|
22389
22392
|
exports.ValidateRenderObject = ValidateRenderObject;
|
22390
22393
|
exports.ViewOptions = ViewOptions;
|
22394
|
+
exports.clearChildrenRenderCache = clearChildrenRenderCache;
|
22391
22395
|
exports.createPrintTemplate = createPrintTemplate;
|
22392
22396
|
exports.defaultParaHanging = defaultParaHanging;
|
22393
22397
|
exports.deleteCurrentParagraph = deleteCurrentParagraph;
|
22394
22398
|
exports.documentPrint = documentPrint;
|
22399
|
+
exports.drawDecorator = drawDecorator;
|
22395
22400
|
exports.elementTypeEventHandler = elementTypeEventHandler;
|
22396
22401
|
exports.fontMapFunc = fontMapFunc;
|
22397
22402
|
exports.fromEvent = fromEvent;
|
22403
|
+
exports.getCalleeName = getCalleeName;
|
22398
22404
|
exports.getFocusTextSegment = getFocusTextSegment;
|
22399
22405
|
exports.invokeTypeHandler = invokeTypeHandler;
|
22400
22406
|
exports.isDate = isDate;
|
22401
22407
|
exports.objectToString = objectToString;
|
22402
22408
|
exports.onTableContextmenu = onTableContextmenu;
|
22403
22409
|
exports.onceTask = onceTask$1;
|
22410
|
+
exports.parser = parser;
|
22404
22411
|
exports.printDocOnContextmenu = printDocOnContextmenu;
|
22405
22412
|
exports.printNodes = printNodes;
|
22406
22413
|
exports.reactiveMap = reactiveMap;
|