@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.d.ts
CHANGED
package/index.js
CHANGED
@@ -3552,6 +3552,173 @@ function getCalleeName(node) {
|
|
3552
3552
|
return node['name'];
|
3553
3553
|
}
|
3554
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
|
+
|
3555
3722
|
/**
|
3556
3723
|
* 所有的数据元继承上述两个抽象类
|
3557
3724
|
*/
|
@@ -3755,6 +3922,7 @@ function getCurrOptions(ele) {
|
|
3755
3922
|
class DataElementRenderObject extends InlineGroupRenderObject {
|
3756
3923
|
render(e) {
|
3757
3924
|
const { render, position, docCtx: { viewOptions } } = e;
|
3925
|
+
this.paintPos = e.position;
|
3758
3926
|
//数据元不打印
|
3759
3927
|
if (!this.element.props.printable && render.drawMode === 'print') {
|
3760
3928
|
return;
|
@@ -3787,6 +3955,9 @@ class DataElementRenderObject extends InlineGroupRenderObject {
|
|
3787
3955
|
e.nextRender();
|
3788
3956
|
this.drawCaption(e);
|
3789
3957
|
});
|
3958
|
+
e.render.onRenderCompleted.subscribe(() => {
|
3959
|
+
drawDecorator(e, this);
|
3960
|
+
});
|
3790
3961
|
}
|
3791
3962
|
/**
|
3792
3963
|
* 绘制数据元标题
|
@@ -3867,6 +4038,57 @@ class DataElementBaseFactory extends ElementFactory {
|
|
3867
4038
|
}
|
3868
4039
|
}
|
3869
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
|
+
}
|
3870
4092
|
|
3871
4093
|
class DocumentElement extends BlockContainerElement {
|
3872
4094
|
//props: DocumentProps;
|
@@ -4328,173 +4550,6 @@ class DocumentHeaderFactory extends ElementFactory {
|
|
4328
4550
|
}
|
4329
4551
|
}
|
4330
4552
|
|
4331
|
-
class ParagraphElement extends BlockContentElement {
|
4332
|
-
constructor() {
|
4333
|
-
super('p');
|
4334
|
-
this.props = new ParagraphProps();
|
4335
|
-
this.addEvent('BackspaceKey', (evt) => {
|
4336
|
-
if (evt.selectionState.collapsed) {
|
4337
|
-
const pFirstLeafElement = ElementUtil.getFirstLeafElement(this);
|
4338
|
-
if (pFirstLeafElement === evt.source && evt.sourceOffset === 0) {
|
4339
|
-
if (this.props.numberType >= 0) {
|
4340
|
-
this.props.numberType = -1;
|
4341
|
-
evt.isCancel = true;
|
4342
|
-
}
|
4343
|
-
else if (this.props.indent) {
|
4344
|
-
this.props.indent = 0;
|
4345
|
-
evt.isCancel = true;
|
4346
|
-
}
|
4347
|
-
}
|
4348
|
-
}
|
4349
|
-
}, true);
|
4350
|
-
this.addEvent('ElementKeyDown', evt => {
|
4351
|
-
//当前存在缩进,点击tab
|
4352
|
-
if (evt.sourceEvent.keyCode === 9) {
|
4353
|
-
const { startControl, startOffset } = evt.selectionState;
|
4354
|
-
if (startOffset === 0 && startControl === this.getChild(0)) {
|
4355
|
-
const defaultIndent = evt.ctx.viewOptions.defaultIndent;
|
4356
|
-
let increaseValue = evt.sourceEvent.shiftKey ? -defaultIndent : defaultIndent;
|
4357
|
-
this.props.indent += increaseValue;
|
4358
|
-
evt.isCancel = true;
|
4359
|
-
evt.sourceEvent.preventDefault();
|
4360
|
-
}
|
4361
|
-
}
|
4362
|
-
}, true);
|
4363
|
-
}
|
4364
|
-
/**
|
4365
|
-
* 设置样式
|
4366
|
-
* @param format
|
4367
|
-
*/
|
4368
|
-
setFormat(format) {
|
4369
|
-
formatEle(this, format);
|
4370
|
-
Object.keys(format).forEach(key => {
|
4371
|
-
this.props[key] = format[key];
|
4372
|
-
});
|
4373
|
-
}
|
4374
|
-
createRenderObject() {
|
4375
|
-
return new ParagraphRenderObject(this);
|
4376
|
-
}
|
4377
|
-
createLineRect() {
|
4378
|
-
return new ParagraphLineRectRenderObject(null);
|
4379
|
-
}
|
4380
|
-
serialize(viewOptions) {
|
4381
|
-
return {
|
4382
|
-
type: 'p',
|
4383
|
-
props: {
|
4384
|
-
...this.props.getSerializeProps(viewOptions)
|
4385
|
-
}
|
4386
|
-
};
|
4387
|
-
}
|
4388
|
-
clone(data) {
|
4389
|
-
const clone = new ParagraphElement();
|
4390
|
-
this.props.clone(clone.props);
|
4391
|
-
if (data) {
|
4392
|
-
for (let i = 0; i < this.length; i++) {
|
4393
|
-
clone.addChild(this.getChild(i).clone(true));
|
4394
|
-
}
|
4395
|
-
}
|
4396
|
-
return clone;
|
4397
|
-
}
|
4398
|
-
static createElement() {
|
4399
|
-
return new ParagraphElement();
|
4400
|
-
}
|
4401
|
-
}
|
4402
|
-
class ParagraphRenderObject extends MuiltBlockLineRenderObject {
|
4403
|
-
render(e) {
|
4404
|
-
e.nextRender();
|
4405
|
-
this.drawProjectNumber(e.render, e.docCtx.viewOptions, e);
|
4406
|
-
}
|
4407
|
-
/**
|
4408
|
-
* 绘制项目符号
|
4409
|
-
*/
|
4410
|
-
drawProjectNumber(ctx, viewOptions, e) {
|
4411
|
-
const paraElement = this.element;
|
4412
|
-
if (paraElement.props.numberType !== ParagraphNumberType.none) {
|
4413
|
-
if (paraElement.paintRenders.indexOf(this) > 0) {
|
4414
|
-
return;
|
4415
|
-
}
|
4416
|
-
const line = this.getChild(0);
|
4417
|
-
// const firstInlinePaintPos = ElementUtil.getRenderAbsolutePaintPos(firstInline, {
|
4418
|
-
// x: 0,
|
4419
|
-
// y: -viewOptions.translateY
|
4420
|
-
// });
|
4421
|
-
const firstInlinePaintPos = {
|
4422
|
-
x: e.position.x + line.rect.x,
|
4423
|
-
y: e.position.y + line.rect.y
|
4424
|
-
};
|
4425
|
-
if (paraElement.props.numberType === ParagraphNumberType.ul) {
|
4426
|
-
const numberSymbolY = firstInlinePaintPos.y + line.baseTopLine + Math.floor((line.baseBottomLine - line.baseTopLine) / 2);
|
4427
|
-
ctx.contentContext.fillCircular(firstInlinePaintPos.x + 4 + paraElement.props.indent, numberSymbolY, 4);
|
4428
|
-
}
|
4429
|
-
else if (paraElement.props.numberType === ParagraphNumberType.ol) {
|
4430
|
-
const parent = paraElement.parent;
|
4431
|
-
let i = paraElement.getIndex() - 1;
|
4432
|
-
for (; i >= 0; i--) {
|
4433
|
-
if (parent.getChild(i) instanceof ParagraphElement) {
|
4434
|
-
//紧挨上面的段落
|
4435
|
-
const prevSiblingPara = parent.getChild(i);
|
4436
|
-
if (prevSiblingPara.props.numberType !== paraElement.props.numberType || prevSiblingPara.props.indent !== paraElement.props.indent) {
|
4437
|
-
break;
|
4438
|
-
}
|
4439
|
-
}
|
4440
|
-
}
|
4441
|
-
const olText = (paraElement.getIndex() - i) + '.';
|
4442
|
-
const textProps = new TextProps();
|
4443
|
-
textProps.color = '#000';
|
4444
|
-
textProps.fontSize = line.baseBottomLine - line.baseTopLine;
|
4445
|
-
textProps.fontName = '宋体';
|
4446
|
-
ctx.contentContext.drawText(olText, textProps, firstInlinePaintPos.x, firstInlinePaintPos.y + line.baseTopLine, 40, textProps.fontSize);
|
4447
|
-
}
|
4448
|
-
}
|
4449
|
-
}
|
4450
|
-
clone() {
|
4451
|
-
const cloneRender = new ParagraphRenderObject(this.element);
|
4452
|
-
cloneRender.rect = ElementUtil.cloneRect(this.rect);
|
4453
|
-
for (let i = 0; i < this.length; i++) {
|
4454
|
-
cloneRender.addChild(this.getChild(i).clone());
|
4455
|
-
}
|
4456
|
-
return cloneRender;
|
4457
|
-
}
|
4458
|
-
}
|
4459
|
-
class ParagraphFactory extends ElementFactory {
|
4460
|
-
match(type) {
|
4461
|
-
return type === 'p';
|
4462
|
-
}
|
4463
|
-
createElement(data) {
|
4464
|
-
const paraElement = new ParagraphElement();
|
4465
|
-
const props = data.props;
|
4466
|
-
paraElement.props.indent = props?.indent ?? 0;
|
4467
|
-
paraElement.props.hanging = props?.hanging ?? 0;
|
4468
|
-
paraElement.props.textAlign = props?.textAlign ?? 'left';
|
4469
|
-
paraElement.props.numberType = props?.numberType ?? -1;
|
4470
|
-
paraElement.props.lineHeight = props?.lineHeight ?? this.options.defaultLineHeight;
|
4471
|
-
paraElement.props.marginTop = props?.marginTop ?? 0;
|
4472
|
-
paraElement.props.marginBottom = props?.marginBottom ?? 0;
|
4473
|
-
paraElement.props.tabs = props?.tabs ?? [];
|
4474
|
-
return paraElement;
|
4475
|
-
}
|
4476
|
-
}
|
4477
|
-
/**
|
4478
|
-
* 段落行框
|
4479
|
-
*/
|
4480
|
-
class ParagraphLineRectRenderObject extends BlockLineRectRenderObject {
|
4481
|
-
baseTopLine = 0;
|
4482
|
-
baseBottomLine = 0;
|
4483
|
-
startX = 0;
|
4484
|
-
render(e) {
|
4485
|
-
}
|
4486
|
-
clone() {
|
4487
|
-
const cloneRender = new ParagraphLineRectRenderObject(this.element);
|
4488
|
-
cloneRender.rect = ElementUtil.cloneRect(this.rect);
|
4489
|
-
cloneRender.baseTopLine = this.baseTopLine;
|
4490
|
-
cloneRender.baseBottomLine = this.baseBottomLine;
|
4491
|
-
for (let i = 0; i < this.length; i++) {
|
4492
|
-
cloneRender.addChild(this.getChild(i).clone());
|
4493
|
-
}
|
4494
|
-
return cloneRender;
|
4495
|
-
}
|
4496
|
-
}
|
4497
|
-
|
4498
4553
|
class PSymbolElement extends LeafElement {
|
4499
4554
|
textProps;
|
4500
4555
|
defaultHeight = 14;
|
@@ -5660,8 +5715,8 @@ class TableFactory extends ElementFactory {
|
|
5660
5715
|
/**
|
5661
5716
|
* 行-表格渲染模式
|
5662
5717
|
*/
|
5663
|
-
function textLineRenderMode(
|
5664
|
-
const tb =
|
5718
|
+
function textLineRenderMode(tbRender, data) {
|
5719
|
+
const tb = tbRender;
|
5665
5720
|
const rows = [];
|
5666
5721
|
for (let i = 0; i < tb.length; i++) {
|
5667
5722
|
const row = tb.getChild(i);
|
@@ -8797,60 +8852,9 @@ class DataElementGroupElement extends InlineGroupInputElement {
|
|
8797
8852
|
class DataElementGroupRenderObject extends InlineGroupRenderObject {
|
8798
8853
|
render(e) {
|
8799
8854
|
this.paintPos = e.position;
|
8800
|
-
e.render.onRenderCompleted.subscribe(() => {
|
8801
|
-
|
8802
|
-
|
8803
|
-
const renders = [];
|
8804
|
-
const currParaRender = ElementUtil.getParentRender(this, ParagraphRenderObject);
|
8805
|
-
for (let i = 0; i < this.element.paintRenders.length; i++) {
|
8806
|
-
const paraRender = ElementUtil.getParentRender(this.element.paintRenders[i], ParagraphRenderObject);
|
8807
|
-
if (paraRender === currParaRender) {
|
8808
|
-
renders.push(this.element.paintRenders[i]);
|
8809
|
-
}
|
8810
|
-
}
|
8811
|
-
return renders;
|
8812
|
-
}
|
8813
|
-
paintDecorate(e) {
|
8814
|
-
const { render, docCtx: { viewOptions } } = e;
|
8815
|
-
const canPaint = this.element.isMouseenter || this.element.isFocused;
|
8816
|
-
if (canPaint && this.element.paintRenders.indexOf(this) === 0) {
|
8817
|
-
const currParaRenders = this.getCurrentParaGroupRenders();
|
8818
|
-
const verOffset = 3;
|
8819
|
-
if (currParaRenders.length > 1) {
|
8820
|
-
const secondGroupRenderPos = currParaRenders[1].paintPos;
|
8821
|
-
if (secondGroupRenderPos.x + currParaRenders[1].rect.width > this.paintPos.x) {
|
8822
|
-
const leftPoints = [];
|
8823
|
-
const rightPoints = [];
|
8824
|
-
for (let i = 0; i < currParaRenders.length; i++) {
|
8825
|
-
const groupRender = currParaRenders[i];
|
8826
|
-
const groupRenderPos = groupRender.paintPos;
|
8827
|
-
leftPoints.push({ x: groupRenderPos.x, y: groupRenderPos.y - verOffset });
|
8828
|
-
rightPoints.push({
|
8829
|
-
x: groupRenderPos.x + groupRender.rect.width,
|
8830
|
-
y: groupRenderPos.y - verOffset
|
8831
|
-
});
|
8832
|
-
leftPoints.push({
|
8833
|
-
x: groupRenderPos.x,
|
8834
|
-
y: groupRenderPos.y + groupRender.rect.height + verOffset * 2
|
8835
|
-
});
|
8836
|
-
rightPoints.push({
|
8837
|
-
x: groupRenderPos.x + groupRender.rect.width,
|
8838
|
-
y: groupRenderPos.y + groupRender.rect.height + verOffset * 2
|
8839
|
-
});
|
8840
|
-
}
|
8841
|
-
const sharpPoints1 = CommonUtil.resharpPoints(rightPoints);
|
8842
|
-
const sharpPoints = CommonUtil.resharpPoints([...leftPoints.reverse()]);
|
8843
|
-
render.overlaysContext.strokeLines([...sharpPoints, ...sharpPoints1, sharpPoints[0]], 1, viewOptions.dataGroupColor);
|
8844
|
-
return;
|
8845
|
-
}
|
8846
|
-
}
|
8847
|
-
for (let i = 0; i < currParaRenders.length; i++) {
|
8848
|
-
const currRen = currParaRenders[i];
|
8849
|
-
render.overlaysContext.strokeRect(currRen.paintPos.x, currRen.paintPos.y - verOffset, currRen.rect.width, currRen.rect.height + verOffset * 2, viewOptions.dataGroupColor);
|
8850
|
-
}
|
8851
|
-
}
|
8852
|
-
}
|
8853
|
-
endRender(ctx, position) {
|
8855
|
+
e.render.onRenderCompleted.subscribe(() => {
|
8856
|
+
drawDecorator(e, this);
|
8857
|
+
});
|
8854
8858
|
}
|
8855
8859
|
clone() {
|
8856
8860
|
const cloneRender = new DataElementGroupRenderObject(this.element);
|
@@ -11903,33 +11907,6 @@ class DynamicContextParser {
|
|
11903
11907
|
}
|
11904
11908
|
}
|
11905
11909
|
|
11906
|
-
/**
|
11907
|
-
* 文字行渲染模式
|
11908
|
-
用于医嘱打印模式
|
11909
|
-
*/
|
11910
|
-
function runTextLineRender(ele, data) {
|
11911
|
-
if (!data.options.textRowLineMode) {
|
11912
|
-
return;
|
11913
|
-
}
|
11914
|
-
if (ele instanceof TableElement) {
|
11915
|
-
textLineRenderMode(ele, data);
|
11916
|
-
remeasureParentRenders(ele.cacheRender);
|
11917
|
-
return;
|
11918
|
-
}
|
11919
|
-
if (ele instanceof BranchElement) {
|
11920
|
-
for (let i = 0; i < ele.length; i++) {
|
11921
|
-
runTextLineRender(ele.getChild(i), data);
|
11922
|
-
}
|
11923
|
-
}
|
11924
|
-
}
|
11925
|
-
function remeasureParentRenders(render) {
|
11926
|
-
if (!render) {
|
11927
|
-
return;
|
11928
|
-
}
|
11929
|
-
ElementUtil.remeasure(render);
|
11930
|
-
remeasureParentRenders(render.parent);
|
11931
|
-
}
|
11932
|
-
|
11933
11910
|
class TabElement extends LeafElement {
|
11934
11911
|
constructor() {
|
11935
11912
|
super('tab');
|
@@ -12499,7 +12476,6 @@ class DocumentArrange {
|
|
12499
12476
|
this.docCtx.viewOptions.showReviewWindow = this.docCtx.document.commentsContainerElement.markPairs.length > 0;
|
12500
12477
|
const docRenders = this.arrangeDoc();
|
12501
12478
|
this.setMeasureCompletedModifyFlag(doc);
|
12502
|
-
runTextLineRender(doc, { options: this.options, renderCtx: this.renderCtx });
|
12503
12479
|
this.cacheDocRenders(docRenders);
|
12504
12480
|
return docRenders;
|
12505
12481
|
});
|
@@ -12671,12 +12647,20 @@ class DocumentArrange {
|
|
12671
12647
|
}
|
12672
12648
|
}
|
12673
12649
|
renders.forEach(item => ElementUtil.remeasure(item));
|
12650
|
+
this.processTableTextLineMode(element);
|
12674
12651
|
return renders.length > 1 ? renders : renders[0];
|
12675
12652
|
}
|
12676
12653
|
else {
|
12677
12654
|
throw new Error('未实现');
|
12678
12655
|
}
|
12679
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
|
+
}
|
12680
12664
|
createRenderObject(element) {
|
12681
12665
|
return element.createRenderObject({
|
12682
12666
|
options: this.options,
|
@@ -13081,6 +13065,26 @@ class DocumentArrange {
|
|
13081
13065
|
}
|
13082
13066
|
}
|
13083
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
|
+
|
13084
13088
|
/**
|
13085
13089
|
* 测量阶段,生成Render-UI
|
13086
13090
|
*/
|
@@ -14373,6 +14377,7 @@ class ElementReader {
|
|
14373
14377
|
const type = data.type;
|
14374
14378
|
for (const factory of this.factories) {
|
14375
14379
|
if (factory.match(type)) {
|
14380
|
+
data.props = data.props ?? {};
|
14376
14381
|
const element = factory.createElement(data);
|
14377
14382
|
this.readExtendsProps(data, element);
|
14378
14383
|
const childArr = [];
|
@@ -18829,7 +18834,6 @@ class NodeEvent {
|
|
18829
18834
|
this.setActiveAppContext(() => this.onMousemoveHandler(evt));
|
18830
18835
|
});
|
18831
18836
|
canvas.addEventListener('mouseup', evt => {
|
18832
|
-
console.log('##松开了');
|
18833
18837
|
this.setActiveAppContext(() => this.onMouseupHandler(evt));
|
18834
18838
|
});
|
18835
18839
|
canvas.addEventListener('mouseleave', evt => {
|
@@ -18924,7 +18928,6 @@ class NodeEvent {
|
|
18924
18928
|
}
|
18925
18929
|
//按下鼠标并进行拖动时,mousemove在按下的元素上处理
|
18926
18930
|
if (this.appState.mousedown) {
|
18927
|
-
console.log("offsetY:", evt.offsetY);
|
18928
18931
|
if (this.appState.sourceNode && this.appState.sourceNode.parent) {
|
18929
18932
|
const currNodePos = getNodePosition(this.appState.sourceNode, { x: 0, y: 0 });
|
18930
18933
|
this.appState.pos = { x: evt.offsetX, y: evt.offsetY };
|
@@ -22162,5 +22165,5 @@ function removeDuplicatesEvent(events) {
|
|
22162
22165
|
return arr;
|
22163
22166
|
}
|
22164
22167
|
|
22165
|
-
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, 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 };
|
22166
22169
|
//# sourceMappingURL=index.js.map
|