@hailin-zheng/editor-core 2.2.6 → 2.2.8
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/editor.css +348 -348
- package/index-cjs.js +334 -306
- package/index-cjs.js.map +1 -1
- package/index.js +334 -306
- package/index.js.map +1 -1
- package/med_editor/doc-editor.d.ts +1 -1
- package/med_editor/framework/element-define.d.ts +15 -9
- package/med_editor/framework/element-props.d.ts +6 -5
- package/med_editor/framework/element-serialize.d.ts +1 -1
- package/med_editor/framework/impl/data-element/data-container-impl.d.ts +8 -8
- package/med_editor/framework/impl/data-element/data-element-base-impl.d.ts +17 -1
- package/med_editor/framework/impl/data-element/data-element-text-impl.d.ts +2 -2
- package/med_editor/framework/impl/document/doc-body-impl.d.ts +2 -2
- package/med_editor/framework/impl/document/doc-body-part-impl.d.ts +2 -2
- package/med_editor/framework/impl/paragraph/p-impl.d.ts +2 -2
- package/med_editor/framework/impl/table/table-impl.d.ts +2 -2
- package/med_editor/framework/impl/table/table-row-impl.d.ts +2 -2
- package/med_editor/framework/render-define.d.ts +5 -6
- package/med_editor/framework/vnode/editor-calendar-vnode.d.ts +1 -0
- package/package.json +1 -1
package/index-cjs.js
CHANGED
@@ -417,7 +417,6 @@ class BlockContentRenderObject extends BranchRenderObject {
|
|
417
417
|
}
|
418
418
|
}
|
419
419
|
class InlineGroupRenderObject extends BranchRenderObject {
|
420
|
-
paintPos;
|
421
420
|
}
|
422
421
|
/**
|
423
422
|
* 包含块级渲染元素的容器元素,例如body、table-cell等
|
@@ -431,18 +430,18 @@ class BlockContainerRenderObject extends BranchRenderObject {
|
|
431
430
|
/**
|
432
431
|
* 多级 ‘BlockLineRectRenderObject’ 包裹元素,例如 p、table
|
433
432
|
*/
|
434
|
-
class
|
433
|
+
class MultiBlockLineRenderObject extends BlockContentRenderObject {
|
435
434
|
}
|
436
435
|
/**
|
437
436
|
* 容器-子内容为多个行内块级元素,例如table-row
|
438
437
|
*/
|
439
|
-
class InlineBlockContainer extends
|
438
|
+
class InlineBlockContainer extends MultiBlockLineRenderObject {
|
440
439
|
}
|
441
440
|
/**
|
442
441
|
* 服务于table-cell
|
443
442
|
* 可被多级拆分的元素
|
444
443
|
*/
|
445
|
-
class InlineMuiltBlockLineRenderObject extends
|
444
|
+
class InlineMuiltBlockLineRenderObject extends MultiBlockLineRenderObject {
|
446
445
|
}
|
447
446
|
/**
|
448
447
|
* 最小不可分割单位的块级行框,例如 p-line
|
@@ -1726,12 +1725,22 @@ class ViewOptions {
|
|
1726
1725
|
defaultColor = "#000000";
|
1727
1726
|
currentFontSize = 14;
|
1728
1727
|
currentFontName = '宋体';
|
1729
|
-
|
1730
|
-
|
1731
|
-
|
1728
|
+
//选区颜色
|
1729
|
+
selectionColor = 'rgb(131,175,155,0.5)';
|
1730
|
+
dataDecoratorNormalColor = '#0050b3';
|
1731
|
+
dataDecoratorMouseEnterColor = '#0050b3';
|
1732
|
+
dataDecoratorFocusedColor = '#0050b3';
|
1733
|
+
//数据元没有输入值时背景颜色
|
1734
|
+
dataEleEmptyBgColor = '';
|
1735
|
+
//数据元鼠标悬浮颜色
|
1736
|
+
dataEleMouseEnterBgColor = '#d9d9d9';
|
1737
|
+
//数据元只读背景颜色
|
1738
|
+
dataEleReadOnlyBgColor = '#d9d9d9';
|
1739
|
+
//数据元焦点背景颜色
|
1740
|
+
dataEleFocusedBgColor = '#d9d9d9';
|
1741
|
+
//数据元正常背景颜色
|
1742
|
+
dataEleNormalBgColor = '#fafafa';
|
1732
1743
|
dataEleErrorBgColor = '#ff4d4f';
|
1733
|
-
dataEleReadOnlyOverlayColor = '#d9d9d9';
|
1734
|
-
dataEleOutlineColor = 'rgb(131,175,155,0.7)';
|
1735
1744
|
viewBackcolor = 'rgb(230,230,230)';
|
1736
1745
|
paraSymbolColor = 'rgb(128,128,128)';
|
1737
1746
|
dataGroupColor = 'rgb(0,80,179)';
|
@@ -1746,7 +1755,6 @@ class ViewOptions {
|
|
1746
1755
|
showCharRect;
|
1747
1756
|
//数据元交互修饰模式
|
1748
1757
|
dataEleDecoratorMode = 'outline';
|
1749
|
-
dataEleDecoratorColor = '#0050b3';
|
1750
1758
|
showTabChar;
|
1751
1759
|
showSpaceChar;
|
1752
1760
|
showLineBreak;
|
@@ -2528,6 +2536,10 @@ class DataEleListProps extends DataEleBaseTextProps {
|
|
2528
2536
|
super();
|
2529
2537
|
}
|
2530
2538
|
options = [];
|
2539
|
+
/**
|
2540
|
+
* 是否保存选项到病历文件里面
|
2541
|
+
*/
|
2542
|
+
saveOptions = true;
|
2531
2543
|
dropDownStyle;
|
2532
2544
|
/**
|
2533
2545
|
* 是否允许多选
|
@@ -2858,28 +2870,14 @@ class ValidateProps {
|
|
2858
2870
|
return clone;
|
2859
2871
|
}
|
2860
2872
|
}
|
2861
|
-
class DataElementGroupProps extends
|
2862
|
-
id;
|
2863
|
-
name;
|
2864
|
-
hidden;
|
2873
|
+
class DataElementGroupProps extends DataEleBaseProps {
|
2865
2874
|
clone(dest) {
|
2866
|
-
|
2867
|
-
|
2868
|
-
dest.name = this.name;
|
2869
|
-
dest.hidden = this.hidden;
|
2875
|
+
const clone = dest ?? new DataElementGroupProps();
|
2876
|
+
super.cloneBaseProps(clone);
|
2870
2877
|
}
|
2871
|
-
getSerializeProps() {
|
2878
|
+
getSerializeProps(options) {
|
2872
2879
|
const props = {};
|
2873
|
-
|
2874
|
-
props.id = this.id;
|
2875
|
-
}
|
2876
|
-
if (this.name) {
|
2877
|
-
props.name = this.name;
|
2878
|
-
}
|
2879
|
-
if (this.hidden) {
|
2880
|
-
props.hidden = this.hidden;
|
2881
|
-
}
|
2882
|
-
return props;
|
2880
|
+
return this.getBaseProps(props, options);
|
2883
2881
|
}
|
2884
2882
|
}
|
2885
2883
|
class DataElementBarcodeProps {
|
@@ -2939,7 +2937,7 @@ class DataDecorateElement extends LeafElement {
|
|
2939
2937
|
const render = new DataDecorateRenderObject(this);
|
2940
2938
|
//render.rect.width = this.dProps.size / 2;
|
2941
2939
|
render.rect.width = 1;
|
2942
|
-
render.rect.height = 14;
|
2940
|
+
render.rect.height = Math.ceil(14 * TEXT_HEIGHT_FACTOR);
|
2943
2941
|
return render;
|
2944
2942
|
}
|
2945
2943
|
serialize() {
|
@@ -2962,6 +2960,17 @@ class DataDecorateRenderObject extends LeafRenderObject {
|
|
2962
2960
|
if (event.mode === 'print') {
|
2963
2961
|
return null;
|
2964
2962
|
}
|
2963
|
+
// if(this.element.parent.parent.type==='data-group'){
|
2964
|
+
// return null;
|
2965
|
+
// }
|
2966
|
+
const options = event.options;
|
2967
|
+
let color = options.dataDecoratorNormalColor;
|
2968
|
+
if (this.element.dataEle.isMouseenter && options.dataDecoratorMouseEnterColor) {
|
2969
|
+
color = options.dataDecoratorMouseEnterColor;
|
2970
|
+
}
|
2971
|
+
if (this.element.dataEle.isFocused && options.dataDecoratorFocusedColor) {
|
2972
|
+
color = options.dataDecoratorFocusedColor;
|
2973
|
+
}
|
2965
2974
|
const element = this.element;
|
2966
2975
|
const lineWidth = 3;
|
2967
2976
|
let path = '';
|
@@ -2975,7 +2984,7 @@ class DataDecorateRenderObject extends LeafRenderObject {
|
|
2975
2984
|
path = `M ${x - lineWidth} 2 L ${x} 2 L ${x} ${height} L ${x - lineWidth} ${height}`;
|
2976
2985
|
}
|
2977
2986
|
return ElementUtil.createSvgPath({
|
2978
|
-
stroke:
|
2987
|
+
stroke: color,
|
2979
2988
|
fill: "none",
|
2980
2989
|
'stroke-width': 1,
|
2981
2990
|
d: path
|
@@ -3141,7 +3150,7 @@ class ParagraphElement extends BlockContentElement {
|
|
3141
3150
|
return new ParagraphElement();
|
3142
3151
|
}
|
3143
3152
|
}
|
3144
|
-
class ParagraphRenderObject extends
|
3153
|
+
class ParagraphRenderObject extends MultiBlockLineRenderObject {
|
3145
3154
|
/**
|
3146
3155
|
* 绘制项目符号
|
3147
3156
|
*/
|
@@ -3690,7 +3699,7 @@ class DocumentRenderObject extends BlockContainerRenderObject {
|
|
3690
3699
|
},
|
3691
3700
|
},
|
3692
3701
|
children: [
|
3693
|
-
pageCorner,
|
3702
|
+
pageCorner, highlight, ...CommonUtil.toArray(event.getChildNodes(this)), pageNum, selection, copyright
|
3694
3703
|
]
|
3695
3704
|
};
|
3696
3705
|
}
|
@@ -3728,11 +3737,10 @@ class DocumentRenderObject extends BlockContainerRenderObject {
|
|
3728
3737
|
}
|
3729
3738
|
const str = "\u6f14\u793a\u7248\u672c";
|
3730
3739
|
const textProps = new TextProps();
|
3731
|
-
textProps.color = "#
|
3732
|
-
textProps.fontName = '
|
3740
|
+
textProps.color = "#bfbfbf";
|
3741
|
+
textProps.fontName = '宋体';
|
3733
3742
|
textProps.fontSize = 80;
|
3734
3743
|
textProps.fontStyle = 'italic';
|
3735
|
-
event.renderCtx.contentContext.measureText(str, textProps);
|
3736
3744
|
const getTextRotationAngle = (width, height) => {
|
3737
3745
|
return Math.atan(height / width) * 180 / Math.PI;
|
3738
3746
|
};
|
@@ -3751,6 +3759,7 @@ class DocumentRenderObject extends BlockContainerRenderObject {
|
|
3751
3759
|
'font-size': textProps.fontSize,
|
3752
3760
|
"stroke": textProps.color,
|
3753
3761
|
'fill': '#fff',
|
3762
|
+
'opacity': '0.5',
|
3754
3763
|
x: this.rect.width / 2,
|
3755
3764
|
y: this.rect.height / 2,
|
3756
3765
|
}
|
@@ -3962,19 +3971,83 @@ class DataElementInlineGroup extends InlineGroupInputElement {
|
|
3962
3971
|
expressFn;
|
3963
3972
|
beginMeasure(data) {
|
3964
3973
|
super.beginMeasure(data);
|
3965
|
-
if (!this.props.expression || !data.
|
3974
|
+
// if (!this.props.expression || !data.options.enableDyExpression) {
|
3975
|
+
// return;
|
3976
|
+
// }
|
3977
|
+
// try {
|
3978
|
+
// if (!this.expressFn) {
|
3979
|
+
// const code = parser(this.props.expression);
|
3980
|
+
// this.expressFn = new Function(`with(this){ ${code} }`);
|
3981
|
+
// }
|
3982
|
+
// this.expressFn.bind(data.execute)();
|
3983
|
+
// //this.expressFn();
|
3984
|
+
// } catch (e) {
|
3985
|
+
// this.expressFn = new Function();
|
3986
|
+
// }
|
3987
|
+
}
|
3988
|
+
parserExpress;
|
3989
|
+
/**
|
3990
|
+
* 解析可见性表达式
|
3991
|
+
* @param ele
|
3992
|
+
* @param execute
|
3993
|
+
* @private
|
3994
|
+
*/
|
3995
|
+
parseEleExpression(data) {
|
3996
|
+
const execute = data.execute;
|
3997
|
+
//不存在表达式,或者不启用表达式,不做处理
|
3998
|
+
if (!this.props.expression || !data.options.enableDyExpression)
|
3966
3999
|
return;
|
3967
|
-
|
4000
|
+
//存在表达式,并且已经解析过,不再做处理
|
4001
|
+
if (this.parserExpress)
|
4002
|
+
return;
|
4003
|
+
const reactiveMode = data.renderCtx.drawMode !== 'print';
|
3968
4004
|
try {
|
3969
|
-
|
3970
|
-
|
3971
|
-
|
4005
|
+
const depIdItems = [];
|
4006
|
+
const depEleMap = new Map();
|
4007
|
+
let compliedCode = parser(this.props.expression, depIdItems);
|
4008
|
+
compliedCode = addReturn(compliedCode);
|
4009
|
+
if (depIdItems.length) {
|
4010
|
+
depIdItems.forEach(dep => {
|
4011
|
+
const refCtx = execute.getObject(dep);
|
4012
|
+
if (refCtx.ref) {
|
4013
|
+
const refEle = refCtx.ref.item;
|
4014
|
+
depEleMap.set(dep, refCtx);
|
4015
|
+
//当前有可能是checkbox数组
|
4016
|
+
const refEles = Array.isArray(refEle) ? refEle : [refEle];
|
4017
|
+
reactiveMode && refEles.forEach(item => {
|
4018
|
+
//求值依赖元素更改的时候,发布当前元素重新计算的指令
|
4019
|
+
item.onChangeSubject.subscribe(() => {
|
4020
|
+
this.pubOnChange('self');
|
4021
|
+
});
|
4022
|
+
});
|
4023
|
+
}
|
4024
|
+
});
|
3972
4025
|
}
|
3973
|
-
this.
|
3974
|
-
//this.expressFn();
|
4026
|
+
this.parserExpress = { compliedCode, func: new Function(`with(this){ ${compliedCode} }`), depItems: depEleMap };
|
3975
4027
|
}
|
3976
4028
|
catch (e) {
|
3977
|
-
this.
|
4029
|
+
console.error('解析表达式出错,parseEleExpression', this.props.expression);
|
4030
|
+
}
|
4031
|
+
}
|
4032
|
+
/**
|
4033
|
+
* 元素可见行求值
|
4034
|
+
* @param ele
|
4035
|
+
* @param executeCtx
|
4036
|
+
* @private
|
4037
|
+
*/
|
4038
|
+
evalEleExpr(executeCtx) {
|
4039
|
+
if (this.parserExpress && this.parserExpress.func) {
|
4040
|
+
try {
|
4041
|
+
executeCtx.setCurrentCtx(this, this.parserExpress.depItems);
|
4042
|
+
const func = this.parserExpress.func.bind(executeCtx);
|
4043
|
+
func();
|
4044
|
+
}
|
4045
|
+
catch (e) {
|
4046
|
+
console.error(e, "表达式执行出错:evalVisibleExpr", this.parserExpress.compliedCode);
|
4047
|
+
}
|
4048
|
+
finally {
|
4049
|
+
executeCtx.clearCurrentCtx();
|
4050
|
+
}
|
3978
4051
|
}
|
3979
4052
|
}
|
3980
4053
|
/**
|
@@ -4074,68 +4147,85 @@ class DataElementBaseFactory extends ElementFactory {
|
|
4074
4147
|
* @param r
|
4075
4148
|
*/
|
4076
4149
|
function exportDecoratorHTML(event, r) {
|
4077
|
-
|
4078
|
-
if (!canPaint) {
|
4150
|
+
if (event.mode === 'print') {
|
4079
4151
|
return;
|
4080
4152
|
}
|
4081
|
-
const
|
4082
|
-
|
4083
|
-
|
4084
|
-
|
4153
|
+
const options = event.options;
|
4154
|
+
let color = options.dataEleNormalBgColor;
|
4155
|
+
//空数据元填充颜色
|
4156
|
+
if (r.element.length === 2 && options.dataEleEmptyBgColor) {
|
4157
|
+
color = options.dataEleEmptyBgColor;
|
4085
4158
|
}
|
4086
|
-
if (
|
4087
|
-
|
4088
|
-
const bgY = event.relativePagePos.y;
|
4089
|
-
event.highlights.push(ElementUtil.getFillSvgRect(bgX, bgY, r.rect.width, r.rect.height, color));
|
4090
|
-
return;
|
4159
|
+
if (r.element.isMouseenter && options.dataEleMouseEnterBgColor) {
|
4160
|
+
color = options.dataEleMouseEnterBgColor;
|
4091
4161
|
}
|
4092
|
-
|
4093
|
-
|
4094
|
-
const renderPosMap = getCurrentParaGroupRenders(r).map(item => ({ pos: getRenderPosToDoc(item), render: item }));
|
4095
|
-
if (renderPosMap.length > 1) {
|
4096
|
-
const secondGroupRenderPos = renderPosMap[1].pos;
|
4097
|
-
if (secondGroupRenderPos.x + renderPosMap[1].render.rect.width > event.relativePagePos.x) {
|
4098
|
-
const leftPoints = [];
|
4099
|
-
const rightPoints = [];
|
4100
|
-
for (let i = 0; i < renderPosMap.length; i++) {
|
4101
|
-
const groupRender = renderPosMap[i].render;
|
4102
|
-
const groupRenderPos = renderPosMap[i].pos;
|
4103
|
-
leftPoints.push({ x: groupRenderPos.x, y: groupRenderPos.y - verOffset });
|
4104
|
-
rightPoints.push({
|
4105
|
-
x: groupRenderPos.x + groupRender.rect.width,
|
4106
|
-
y: groupRenderPos.y - verOffset
|
4107
|
-
});
|
4108
|
-
leftPoints.push({
|
4109
|
-
x: groupRenderPos.x,
|
4110
|
-
y: groupRenderPos.y + groupRender.rect.height + verOffset * 2
|
4111
|
-
});
|
4112
|
-
rightPoints.push({
|
4113
|
-
x: groupRenderPos.x + groupRender.rect.width,
|
4114
|
-
y: groupRenderPos.y + groupRender.rect.height + verOffset * 2
|
4115
|
-
});
|
4116
|
-
}
|
4117
|
-
const sharpPoints1 = CommonUtil.resharpPoints(rightPoints);
|
4118
|
-
const sharpPoints = CommonUtil.resharpPoints([...leftPoints.reverse()]);
|
4119
|
-
const path = [...sharpPoints, ...sharpPoints1, sharpPoints[0]].map((item, index) => ((index === 0) ? 'M' : "L") + item.x + " " + item.y).join(" ");
|
4120
|
-
event.highlights.push(ElementUtil.createSvgPath({
|
4121
|
-
d: path,
|
4122
|
-
stroke: color,
|
4123
|
-
fill: 'none',
|
4124
|
-
'stroke-width': 1
|
4125
|
-
}));
|
4126
|
-
return;
|
4127
|
-
}
|
4128
|
-
}
|
4129
|
-
for (let i = 0; i < renderPosMap.length; i++) {
|
4130
|
-
const currRen = renderPosMap[i];
|
4131
|
-
event.highlights.push(ElementUtil.createSvgPath({
|
4132
|
-
d: `M${currRen.pos.x} ${currRen.pos.y} L${currRen.pos.x + currRen.render.rect.width} ${currRen.pos.y} L${currRen.pos.x + currRen.render.rect.width} ${currRen.pos.y + currRen.render.rect.height} L${currRen.pos.x} ${currRen.pos.y + currRen.render.rect.height} Z`,
|
4133
|
-
stroke: '#0050b3',
|
4134
|
-
fill: 'none',
|
4135
|
-
'stroke-width': 1
|
4136
|
-
}));
|
4137
|
-
}
|
4162
|
+
if (r.element.isFocused && options.dataEleFocusedBgColor) {
|
4163
|
+
color = options.dataEleFocusedBgColor;
|
4138
4164
|
}
|
4165
|
+
//绘制背景
|
4166
|
+
const bgX = event.relativePagePos.x;
|
4167
|
+
const bgY = event.relativePagePos.y;
|
4168
|
+
event.highlights.push(ElementUtil.getFillSvgRect(bgX, bgY, r.rect.width, r.rect.height, color));
|
4169
|
+
// const canPaint = r.element.isMouseenter || r.element.isFocused;
|
4170
|
+
// if (!canPaint) {
|
4171
|
+
// return;
|
4172
|
+
// }
|
4173
|
+
// const mode = event.options.dataEleDecoratorMode;
|
4174
|
+
// if (mode === 'none') {
|
4175
|
+
// return;
|
4176
|
+
// }
|
4177
|
+
// if (mode === 'overlay') {
|
4178
|
+
// const bgX = event.relativePagePos.x;
|
4179
|
+
// const bgY = event.relativePagePos.y;
|
4180
|
+
// event.highlights.push(ElementUtil.getFillSvgRect(bgX, bgY, r.rect.width, r.rect.height, color));
|
4181
|
+
// return;
|
4182
|
+
// } else if (mode === 'outline') {
|
4183
|
+
// const verOffset = 0;
|
4184
|
+
// const renderPosMap = getCurrentParaGroupRenders(r).map(item => ({ pos: getRenderPosToDoc(item), render: item }));
|
4185
|
+
// if (renderPosMap.length > 1) {
|
4186
|
+
// const secondGroupRenderPos = renderPosMap[1].pos;
|
4187
|
+
// if (secondGroupRenderPos.x + renderPosMap[1].render.rect.width > event.relativePagePos.x) {
|
4188
|
+
// const leftPoints: Array<Position> = [];
|
4189
|
+
// const rightPoints: Array<Position> = [];
|
4190
|
+
// for (let i = 0; i < renderPosMap.length; i++) {
|
4191
|
+
// const groupRender = renderPosMap[i].render;
|
4192
|
+
// const groupRenderPos = renderPosMap[i].pos;
|
4193
|
+
// leftPoints.push({ x: groupRenderPos.x, y: groupRenderPos.y - verOffset });
|
4194
|
+
// rightPoints.push({
|
4195
|
+
// x: groupRenderPos.x + groupRender.rect.width,
|
4196
|
+
// y: groupRenderPos.y - verOffset
|
4197
|
+
// });
|
4198
|
+
// leftPoints.push({
|
4199
|
+
// x: groupRenderPos.x,
|
4200
|
+
// y: groupRenderPos.y + groupRender.rect.height + verOffset * 2
|
4201
|
+
// });
|
4202
|
+
// rightPoints.push({
|
4203
|
+
// x: groupRenderPos.x + groupRender.rect.width,
|
4204
|
+
// y: groupRenderPos.y + groupRender.rect.height + verOffset * 2
|
4205
|
+
// });
|
4206
|
+
// }
|
4207
|
+
// const sharpPoints1 = CommonUtil.resharpPoints(rightPoints);
|
4208
|
+
// const sharpPoints = CommonUtil.resharpPoints([...leftPoints.reverse()]);
|
4209
|
+
// const path = [...sharpPoints, ...sharpPoints1, sharpPoints[0]].map((item, index) => ((index === 0) ? 'M' : "L") + item.x + " " + item.y).join(" ")
|
4210
|
+
// event.highlights.push(ElementUtil.createSvgPath({
|
4211
|
+
// d: path,
|
4212
|
+
// stroke: color,
|
4213
|
+
// fill: 'none',
|
4214
|
+
// 'stroke-width': 1
|
4215
|
+
// }));
|
4216
|
+
// return;
|
4217
|
+
// }
|
4218
|
+
// }
|
4219
|
+
// for (let i = 0; i < renderPosMap.length; i++) {
|
4220
|
+
// const currRen = renderPosMap[i];
|
4221
|
+
// event.highlights.push(ElementUtil.createSvgPath({
|
4222
|
+
// d: `M${currRen.pos.x} ${currRen.pos.y} L${currRen.pos.x + currRen.render.rect.width} ${currRen.pos.y} L${currRen.pos.x + currRen.render.rect.width} ${currRen.pos.y + currRen.render.rect.height} L${currRen.pos.x} ${currRen.pos.y + currRen.render.rect.height} Z`,
|
4223
|
+
// stroke: '#0050b3',
|
4224
|
+
// fill: 'none',
|
4225
|
+
// 'stroke-width': 1
|
4226
|
+
// }));
|
4227
|
+
// }
|
4228
|
+
// }
|
4139
4229
|
}
|
4140
4230
|
/**
|
4141
4231
|
* 渲染数据源验证错误提示框
|
@@ -4240,30 +4330,6 @@ function renderUnderWavyLine(event, r, color) {
|
|
4240
4330
|
d += Array(Math.ceil(width / 3)).fill("3,0").join(' t ');
|
4241
4331
|
const path = ElementUtil.createSvgPath({ d, fill: 'none', stroke: color });
|
4242
4332
|
event.highlights.push(path);
|
4243
|
-
}
|
4244
|
-
/**
|
4245
|
-
* 获取渲染元素相对稳当的位置
|
4246
|
-
* @param render
|
4247
|
-
* @param refPos
|
4248
|
-
*/
|
4249
|
-
function getRenderPosToDoc(render, refPos = null) {
|
4250
|
-
refPos = refPos ?? { x: 0, y: 0 };
|
4251
|
-
if (render instanceof DocumentRenderObject) {
|
4252
|
-
return refPos;
|
4253
|
-
}
|
4254
|
-
const currPos = { x: render.rect.x + refPos.x, y: render.rect.y + refPos.y };
|
4255
|
-
return getRenderPosToDoc(render.parent, currPos);
|
4256
|
-
}
|
4257
|
-
function getCurrentParaGroupRenders(r) {
|
4258
|
-
const renders = [];
|
4259
|
-
const currParaRender = ElementUtil.getParentRender(r, ParagraphRenderObject);
|
4260
|
-
for (let i = 0; i < r.element.paintRenders.length; i++) {
|
4261
|
-
const paraRender = ElementUtil.getParentRender(r.element.paintRenders[i], ParagraphRenderObject);
|
4262
|
-
if (paraRender === currParaRender) {
|
4263
|
-
renders.push(r.element.paintRenders[i]);
|
4264
|
-
}
|
4265
|
-
}
|
4266
|
-
return renders;
|
4267
4333
|
}
|
4268
4334
|
|
4269
4335
|
class DocumentBodyElement extends BlockContainerElement {
|
@@ -4305,7 +4371,7 @@ class DocumentBodyElement extends BlockContainerElement {
|
|
4305
4371
|
super.beginMeasure(data);
|
4306
4372
|
}
|
4307
4373
|
}
|
4308
|
-
class DocumentBodyRenderObject extends
|
4374
|
+
class DocumentBodyRenderObject extends MultiBlockLineRenderObject {
|
4309
4375
|
clone(cloneData = true) {
|
4310
4376
|
const cloneRender = new DocumentBodyRenderObject(this.element);
|
4311
4377
|
cloneRender.rect = ElementUtil.cloneRect(this.rect);
|
@@ -4604,7 +4670,7 @@ class TableRowElement extends BlockContainerElement {
|
|
4604
4670
|
return tr;
|
4605
4671
|
}
|
4606
4672
|
}
|
4607
|
-
class TableRowRenderObject extends
|
4673
|
+
class TableRowRenderObject extends MultiBlockLineRenderObject {
|
4608
4674
|
//被截断的行是否需要重新计算高度
|
4609
4675
|
remeasureState = true;
|
4610
4676
|
//当前行是否存在合并单元格
|
@@ -4834,9 +4900,7 @@ class TextGroupRenderObject extends LeafRenderObject {
|
|
4834
4900
|
event.highlights.push(ElementUtil.getStrokeSvgPath(path, '#000', 1));
|
4835
4901
|
}
|
4836
4902
|
//处理null-text
|
4837
|
-
if (this.element.isDecorate && this.element.disableClick && !this.element.parent)
|
4838
|
-
t.data.attrs['opacity'] = '0.58';
|
4839
|
-
}
|
4903
|
+
if (this.element.isDecorate && this.element.disableClick && !this.element.parent) ;
|
4840
4904
|
return t;
|
4841
4905
|
}
|
4842
4906
|
}
|
@@ -6103,7 +6167,7 @@ class TableElement extends BlockContainerElement {
|
|
6103
6167
|
};
|
6104
6168
|
}
|
6105
6169
|
}
|
6106
|
-
class TableRenderObject extends
|
6170
|
+
class TableRenderObject extends MultiBlockLineRenderObject {
|
6107
6171
|
setRenderWidth(maxWidth) {
|
6108
6172
|
super.setRenderWidth(maxWidth);
|
6109
6173
|
}
|
@@ -8609,7 +8673,7 @@ class DataElementGroupElement extends InlineGroupInputElement {
|
|
8609
8673
|
return {
|
8610
8674
|
type: this.type,
|
8611
8675
|
props: {
|
8612
|
-
...this.props.getSerializeProps()
|
8676
|
+
...this.props.getSerializeProps(viewOptions)
|
8613
8677
|
}
|
8614
8678
|
};
|
8615
8679
|
}
|
@@ -8631,9 +8695,7 @@ class DataElementGroupFactory extends DataElementBaseFactory {
|
|
8631
8695
|
createElement(data) {
|
8632
8696
|
const props = data.props;
|
8633
8697
|
const ele = new DataElementGroupElement();
|
8634
|
-
ele.props
|
8635
|
-
ele.props.name = props.name;
|
8636
|
-
ele.props.hidden = Boolean(props.hidden);
|
8698
|
+
ElementUtil.readEleBaseProps(ele.props, props);
|
8637
8699
|
return ele;
|
8638
8700
|
}
|
8639
8701
|
}
|
@@ -8938,7 +9000,11 @@ class DataElementText extends DataElementInlineGroup {
|
|
8938
9000
|
super('data-ele-text');
|
8939
9001
|
this.props = new DataEleBaseTextProps();
|
8940
9002
|
}
|
8941
|
-
createRenderObject() {
|
9003
|
+
createRenderObject(data) {
|
9004
|
+
if (data.options.enableDyExpression) {
|
9005
|
+
this.parseEleExpression(data);
|
9006
|
+
this.evalEleExpr(data.execute);
|
9007
|
+
}
|
8942
9008
|
return new DataElementTextRenderObject(this);
|
8943
9009
|
}
|
8944
9010
|
serialize(viewOptions) {
|
@@ -9058,33 +9124,23 @@ class DataContainerElement extends BlockContainerElement {
|
|
9058
9124
|
}
|
9059
9125
|
super.beginMeasure(data);
|
9060
9126
|
}
|
9061
|
-
serialize() {
|
9062
|
-
|
9127
|
+
serialize(viewOptions) {
|
9128
|
+
return {
|
9063
9129
|
type: this.type,
|
9064
|
-
props: {
|
9130
|
+
props: {
|
9131
|
+
...this.props.getSerializeProps(viewOptions)
|
9132
|
+
}
|
9065
9133
|
};
|
9066
|
-
if (this.props.id) {
|
9067
|
-
p['id'] = this.props.id;
|
9068
|
-
}
|
9069
|
-
if (this.props.name) {
|
9070
|
-
p['name'] = this.props.name;
|
9071
|
-
}
|
9072
|
-
if (this.props.caption) {
|
9073
|
-
p['caption'] = this.props.caption;
|
9074
|
-
}
|
9075
|
-
return p;
|
9076
9134
|
}
|
9077
9135
|
clone(data) {
|
9078
9136
|
const clone = new DataContainerElement();
|
9079
|
-
|
9080
|
-
clone.props.name = this.props.name;
|
9081
|
-
clone.props.caption = this.props.caption;
|
9137
|
+
this.props.clone(clone.props);
|
9082
9138
|
cloneElementBase(this, clone);
|
9083
9139
|
cloneChildren(this, clone, data);
|
9084
9140
|
return clone;
|
9085
9141
|
}
|
9086
9142
|
}
|
9087
|
-
class DataContainerRenderObject extends
|
9143
|
+
class DataContainerRenderObject extends MultiBlockLineRenderObject {
|
9088
9144
|
clone(cloneData = true) {
|
9089
9145
|
const cloneRender = new DataContainerRenderObject(this.element);
|
9090
9146
|
cloneRender.rect = ElementUtil.cloneRect(this.rect);
|
@@ -9109,24 +9165,21 @@ class DataContainerFactory extends ElementFactory {
|
|
9109
9165
|
return type === 'data-container';
|
9110
9166
|
}
|
9111
9167
|
createElement(data) {
|
9112
|
-
const
|
9168
|
+
const ele = new DataContainerElement();
|
9113
9169
|
const props = data.props;
|
9114
|
-
|
9115
|
-
|
9116
|
-
}
|
9117
|
-
if (props?.name) {
|
9118
|
-
element.props.name = props.name;
|
9119
|
-
}
|
9120
|
-
if (props?.caption) {
|
9121
|
-
element.props.caption = props.caption;
|
9122
|
-
}
|
9123
|
-
return element;
|
9170
|
+
ElementUtil.readEleBaseProps(ele.props, props);
|
9171
|
+
return ele;
|
9124
9172
|
}
|
9125
9173
|
}
|
9126
|
-
class DataContainerProps {
|
9127
|
-
|
9128
|
-
|
9129
|
-
|
9174
|
+
class DataContainerProps extends DataEleBaseProps {
|
9175
|
+
clone(dest) {
|
9176
|
+
const clone = dest ?? new DataContainerProps();
|
9177
|
+
super.cloneBaseProps(clone);
|
9178
|
+
}
|
9179
|
+
getSerializeProps(options) {
|
9180
|
+
const props = {};
|
9181
|
+
return this.getBaseProps(props, options);
|
9182
|
+
}
|
9130
9183
|
}
|
9131
9184
|
|
9132
9185
|
/**
|
@@ -9212,7 +9265,7 @@ class DocumentBodyPartElement extends BlockContainerElement {
|
|
9212
9265
|
return clone;
|
9213
9266
|
}
|
9214
9267
|
}
|
9215
|
-
class DocumentBodyPartRenderObject extends
|
9268
|
+
class DocumentBodyPartRenderObject extends MultiBlockLineRenderObject {
|
9216
9269
|
clone(cloneData = true) {
|
9217
9270
|
const cloneRender = new DocumentBodyPartRenderObject(this.element);
|
9218
9271
|
cloneRender.rect = ElementUtil.cloneRect(this.rect);
|
@@ -10588,10 +10641,10 @@ class ElementSerialize {
|
|
10588
10641
|
}
|
10589
10642
|
}
|
10590
10643
|
if (element.props && element.props['__attachedProperty'] && !result.props['__attachedProperty']) {
|
10591
|
-
result.props['__attachedProperty'] =
|
10644
|
+
result.props['__attachedProperty'] = this.serializeObject(element.props['__attachedProperty']);
|
10592
10645
|
}
|
10593
10646
|
if (element.attribute) {
|
10594
|
-
result['attribute'] = this.
|
10647
|
+
result['attribute'] = this.serializeObject(element.attribute);
|
10595
10648
|
}
|
10596
10649
|
return result;
|
10597
10650
|
}
|
@@ -10615,20 +10668,23 @@ class ElementSerialize {
|
|
10615
10668
|
}
|
10616
10669
|
return "";
|
10617
10670
|
}
|
10618
|
-
static
|
10619
|
-
if (
|
10620
|
-
|
10621
|
-
|
10622
|
-
|
10623
|
-
|
10671
|
+
static serializeObject(obj) {
|
10672
|
+
if (obj === null || obj === undefined) {
|
10673
|
+
return null;
|
10674
|
+
}
|
10675
|
+
const result = {};
|
10676
|
+
for (const key in obj) {
|
10677
|
+
if (obj[key] !== undefined && obj[key] !== null) {
|
10678
|
+
if (key.startsWith("__")) {
|
10679
|
+
continue;
|
10624
10680
|
}
|
10681
|
+
result[key] = obj[key];
|
10625
10682
|
}
|
10626
|
-
if (Object.keys(result).length === 0) {
|
10627
|
-
return null;
|
10628
|
-
}
|
10629
|
-
return CommonUtil.cloneValue(result);
|
10630
10683
|
}
|
10631
|
-
|
10684
|
+
if (Object.keys(result).length === 0) {
|
10685
|
+
return null;
|
10686
|
+
}
|
10687
|
+
return CommonUtil.cloneValue(result);
|
10632
10688
|
}
|
10633
10689
|
/**
|
10634
10690
|
* 获取选中的结构
|
@@ -13896,7 +13952,7 @@ class ParagraphMeasure {
|
|
13896
13952
|
}
|
13897
13953
|
}
|
13898
13954
|
arrangeInlineGroupElement(parentLine, ele) {
|
13899
|
-
const { options, renderCtx } = this;
|
13955
|
+
const { options, renderCtx, execute } = this;
|
13900
13956
|
let render = this.createRenderObject(ele);
|
13901
13957
|
//记录多行情况下的渲染对象,用于计算总长度,生成fill-null-space
|
13902
13958
|
const inlineGroupRenders = [];
|
@@ -13932,7 +13988,7 @@ class ParagraphMeasure {
|
|
13932
13988
|
isCloseToBody: parentLine.isCloseToBody,
|
13933
13989
|
applyNewLine() {
|
13934
13990
|
parentLine.applyNewLine();
|
13935
|
-
render = ele.createRenderObject({ options, renderCtx });
|
13991
|
+
render = ele.createRenderObject({ options, renderCtx, execute });
|
13936
13992
|
parentLine.add(render);
|
13937
13993
|
inlineGroupRenders.push(render);
|
13938
13994
|
},
|
@@ -14267,7 +14323,8 @@ class ParagraphMeasure {
|
|
14267
14323
|
}
|
14268
14324
|
return element.createRenderObject({
|
14269
14325
|
options: this.options,
|
14270
|
-
renderCtx: this.renderCtx
|
14326
|
+
renderCtx: this.renderCtx,
|
14327
|
+
execute: this.execute
|
14271
14328
|
});
|
14272
14329
|
}
|
14273
14330
|
}
|
@@ -14426,8 +14483,9 @@ class DocumentArrange {
|
|
14426
14483
|
this.pMeasure = new ParagraphMeasure(this.options, this.renderCtx, this.execute);
|
14427
14484
|
const data = {
|
14428
14485
|
doc,
|
14429
|
-
|
14486
|
+
options: this.options,
|
14430
14487
|
execute: this.execute,
|
14488
|
+
renderCtx: this.renderCtx,
|
14431
14489
|
createParaFn: () => this.createDefaultPara()
|
14432
14490
|
};
|
14433
14491
|
this.reset(data);
|
@@ -14630,7 +14688,7 @@ class DocumentArrange {
|
|
14630
14688
|
if (this.options.textRowLineMode && ele instanceof TableElement && ele.cacheRender) {
|
14631
14689
|
const cacheRender = ele.cacheRender;
|
14632
14690
|
clearChildrenRenderCache(ele);
|
14633
|
-
textLineRenderMode(cacheRender, { options: this.options, renderCtx: this.renderCtx });
|
14691
|
+
textLineRenderMode(cacheRender, { options: this.options, renderCtx: this.renderCtx, execute: this.execute });
|
14634
14692
|
}
|
14635
14693
|
}
|
14636
14694
|
getDocInnerRect(documentRender) {
|
@@ -14653,7 +14711,7 @@ class DocumentArrange {
|
|
14653
14711
|
}
|
14654
14712
|
const cloneRender = this.pMeasure.createRenderObject(render.element);
|
14655
14713
|
cloneRender.setRenderWidth(render.rect.width);
|
14656
|
-
if (render instanceof
|
14714
|
+
if (render instanceof MultiBlockLineRenderObject) {
|
14657
14715
|
let sumHeight = 0;
|
14658
14716
|
const children = [...render.getItems()];
|
14659
14717
|
let j = 0;
|
@@ -14662,7 +14720,7 @@ class DocumentArrange {
|
|
14662
14720
|
//sumHeight = ElementUtil.remeasure(cloneRender);
|
14663
14721
|
const calcBlockLineHeight = this.getBlockLineHeight(blockLine);
|
14664
14722
|
if (calcBlockLineHeight + sumHeight > limitHeight) {
|
14665
|
-
if (blockLine instanceof
|
14723
|
+
if (blockLine instanceof MultiBlockLineRenderObject) {
|
14666
14724
|
//限制的外框尺寸
|
14667
14725
|
const availHeight = limitHeight - sumHeight;
|
14668
14726
|
//限制的内框尺寸
|
@@ -15372,9 +15430,12 @@ class DocumentEvent {
|
|
15372
15430
|
},
|
15373
15431
|
mouseup: (evt) => {
|
15374
15432
|
this.mouseup(evt, ElementUtil.getMousePos(evt, scale));
|
15433
|
+
this.mouseClickHandle(evt);
|
15375
15434
|
},
|
15376
15435
|
click: (evt) => {
|
15377
|
-
|
15436
|
+
//nulltext 不触发 click 事件,暂且这么处理
|
15437
|
+
//移到 mouseup 事件中处理
|
15438
|
+
//this.mouseClickHandle(evt);
|
15378
15439
|
},
|
15379
15440
|
mousemove: (evt) => {
|
15380
15441
|
this.mousemove(evt, ElementUtil.getMousePos(evt, scale));
|
@@ -18668,103 +18729,56 @@ function getFocusTextSegment(selection) {
|
|
18668
18729
|
let { startControl: element, startOffset: offset } = selection;
|
18669
18730
|
if (!(element instanceof TextGroupElement))
|
18670
18731
|
return false;
|
18671
|
-
if (!supportSegment())
|
18672
|
-
return false;
|
18673
18732
|
const focusEle = element;
|
18674
|
-
|
18675
|
-
|
18676
|
-
|
18677
|
-
|
18678
|
-
const
|
18679
|
-
const
|
18680
|
-
|
18681
|
-
|
18682
|
-
|
18683
|
-
}
|
18684
|
-
if (curr.item === focusEle) {
|
18685
|
-
prev.index += offset;
|
18686
|
-
prev.completed = true;
|
18687
|
-
}
|
18688
|
-
else {
|
18689
|
-
prev.index += curr.item.textMeasures.length;
|
18690
|
-
}
|
18691
|
-
return prev;
|
18692
|
-
}, { completed: false, index: 0, text: '' });
|
18693
|
-
const { index: hitIndex, len: hitLen } = getHitSegment(text, index);
|
18694
|
-
const matchSegment = sortItems.filter(item => (item.index <= hitIndex && item.endIndex > hitIndex) || (item.index <= hitIndex + hitLen && item.endIndex > hitIndex + hitLen));
|
18695
|
-
const startSegment = matchSegment[0];
|
18696
|
-
const endSegment = matchSegment[matchSegment.length - 1];
|
18697
|
-
const startOffset = hitIndex - startSegment.index;
|
18698
|
-
const endOffset = hitIndex + hitLen - endSegment.index;
|
18699
|
-
const newRange = new SelectionRange();
|
18700
|
-
newRange.setStart(startSegment.item, startOffset);
|
18701
|
-
newRange.setEnd(endSegment.item, endOffset);
|
18702
|
-
selection.addRange(newRange);
|
18733
|
+
const focusText = focusEle.text;
|
18734
|
+
if (!focusText) {
|
18735
|
+
return false;
|
18736
|
+
}
|
18737
|
+
const [start, end] = tokenize(focusText, offset);
|
18738
|
+
const range = new SelectionRange();
|
18739
|
+
range.setStart(focusEle, start);
|
18740
|
+
range.setEnd(focusEle, end + 1);
|
18741
|
+
selection.addRange(range);
|
18703
18742
|
return true;
|
18704
18743
|
}
|
18705
|
-
|
18706
|
-
|
18707
|
-
|
18708
|
-
|
18709
|
-
|
18710
|
-
|
18711
|
-
|
18712
|
-
const
|
18713
|
-
|
18714
|
-
|
18715
|
-
|
18716
|
-
|
18717
|
-
|
18718
|
-
|
18719
|
-
|
18720
|
-
|
18721
|
-
|
18722
|
-
|
18723
|
-
|
18744
|
+
function tokenize(text, index) {
|
18745
|
+
if (text.length === 0) {
|
18746
|
+
return [0, 0]; // 处理空字符串的情况
|
18747
|
+
}
|
18748
|
+
const isChinese = (char) => {
|
18749
|
+
return /^[\u4e00-\u9fa5]+$/.test(char);
|
18750
|
+
};
|
18751
|
+
const isEnglish = (char) => {
|
18752
|
+
return /^[a-zA-Z]+$/.test(char);
|
18753
|
+
};
|
18754
|
+
const isNumeric = (char) => {
|
18755
|
+
return /^[0-9]+$/.test(char);
|
18756
|
+
};
|
18757
|
+
let start = index;
|
18758
|
+
let end = index;
|
18759
|
+
// 向左查找开始位置
|
18760
|
+
while (start > 0) {
|
18761
|
+
if ((isChinese(text[start]) && isChinese(text[start - 1])) ||
|
18762
|
+
(isEnglish(text[start]) && isEnglish(text[start - 1])) ||
|
18763
|
+
(isNumeric(text[start]) && isNumeric(text[start - 1]))) {
|
18764
|
+
start--;
|
18765
|
+
}
|
18766
|
+
else {
|
18767
|
+
break;
|
18724
18768
|
}
|
18725
|
-
index += currLen;
|
18726
18769
|
}
|
18727
|
-
|
18728
|
-
|
18729
|
-
|
18730
|
-
|
18731
|
-
|
18732
|
-
|
18733
|
-
|
18734
|
-
|
18735
|
-
|
18736
|
-
|
18737
|
-
let index = 0;
|
18738
|
-
const sortItems = [];
|
18739
|
-
for (let i = 0; i < texts.length; i++) {
|
18740
|
-
const item = texts[i];
|
18741
|
-
const sortData = {
|
18742
|
-
len: item.textMeasures.length,
|
18743
|
-
index,
|
18744
|
-
endIndex: index + item.textMeasures.length,
|
18745
|
-
item,
|
18746
|
-
text: item.text
|
18747
|
-
};
|
18748
|
-
sortItems.push(sortData);
|
18749
|
-
index += sortData.len;
|
18770
|
+
// 向右查找结束位置
|
18771
|
+
while (end < text.length - 1) {
|
18772
|
+
if ((isChinese(text[end]) && isChinese(text[end + 1])) ||
|
18773
|
+
(isEnglish(text[end]) && isEnglish(text[end + 1])) ||
|
18774
|
+
(isNumeric(text[end]) && isNumeric(text[end + 1]))) {
|
18775
|
+
end++;
|
18776
|
+
}
|
18777
|
+
else {
|
18778
|
+
break;
|
18779
|
+
}
|
18750
18780
|
}
|
18751
|
-
return
|
18752
|
-
}
|
18753
|
-
/**
|
18754
|
-
* 获取指定方向上连续的字符
|
18755
|
-
* @param element
|
18756
|
-
* @param prev
|
18757
|
-
*/
|
18758
|
-
function getConsecutiveTextsByDirection(element, prev = true) {
|
18759
|
-
let prevText = element;
|
18760
|
-
const prevTexts = [];
|
18761
|
-
const func = prev ? ElementUtil.getPrevSiblingElement : ElementUtil.getNextSiblingElement;
|
18762
|
-
const addItem = prev ? prevTexts.unshift : prevTexts.push;
|
18763
|
-
while ((prevText = func(prevText)) && prevText instanceof TextGroupElement) {
|
18764
|
-
//addItem(prevText);
|
18765
|
-
addItem.apply(prevTexts, [prevText]);
|
18766
|
-
}
|
18767
|
-
return prevTexts;
|
18781
|
+
return [start, end];
|
18768
18782
|
}
|
18769
18783
|
|
18770
18784
|
/**
|
@@ -19329,7 +19343,7 @@ class DocumentSvg {
|
|
19329
19343
|
ns: 'http://www.w3.org/2000/svg',
|
19330
19344
|
attrs: {
|
19331
19345
|
stroke: 'none',
|
19332
|
-
fill: item.color ??
|
19346
|
+
fill: item.color ?? this.viewOptions.selectionColor,
|
19333
19347
|
'paint-order': 'stroke fill markers',
|
19334
19348
|
d: `M${item.x} ${item.y} L${item.x + item.width} ${item.y} L${item.x + item.width} ${item.y + item.height} L${item.x} ${item.y + item.height} Z`,
|
19335
19349
|
'fill-opacity': '0.5'
|
@@ -19448,7 +19462,7 @@ class EditorCalendarVNode {
|
|
19448
19462
|
data: {
|
19449
19463
|
style: {
|
19450
19464
|
position: 'absolute',
|
19451
|
-
left: (position.x
|
19465
|
+
left: (position.x) + 'px',
|
19452
19466
|
top: position.y + 5 + position.height + 'px',
|
19453
19467
|
'min-width': '100px',
|
19454
19468
|
'background-color': 'white',
|
@@ -19584,6 +19598,9 @@ class EditorCalendarVNode {
|
|
19584
19598
|
on: {
|
19585
19599
|
click: () => {
|
19586
19600
|
this.onClickDayItem(day.date);
|
19601
|
+
},
|
19602
|
+
dblclick: () => {
|
19603
|
+
this.onSave();
|
19587
19604
|
}
|
19588
19605
|
}
|
19589
19606
|
},
|
@@ -19641,12 +19658,7 @@ class EditorCalendarVNode {
|
|
19641
19658
|
data: {
|
19642
19659
|
on: {
|
19643
19660
|
click: () => {
|
19644
|
-
|
19645
|
-
this.onSetValue.next(new Date());
|
19646
|
-
}
|
19647
|
-
else {
|
19648
|
-
this.onSetValue.next(moment__default["default"](this.selectedDate.value + ' ' + this.selectedTime.value).toDate());
|
19649
|
-
}
|
19661
|
+
this.onSave();
|
19650
19662
|
}
|
19651
19663
|
}
|
19652
19664
|
},
|
@@ -19666,6 +19678,14 @@ class EditorCalendarVNode {
|
|
19666
19678
|
]
|
19667
19679
|
};
|
19668
19680
|
}
|
19681
|
+
onSave() {
|
19682
|
+
if (!this.selectedDate.value) {
|
19683
|
+
this.onSetValue.next(new Date());
|
19684
|
+
}
|
19685
|
+
else {
|
19686
|
+
this.onSetValue.next(moment__default["default"](this.selectedDate.value + ' ' + this.selectedTime.value).toDate());
|
19687
|
+
}
|
19688
|
+
}
|
19669
19689
|
navigateToToday() {
|
19670
19690
|
this.currYear.value = new Date().getFullYear();
|
19671
19691
|
this.currMonth.value = new Date().getMonth();
|
@@ -20378,7 +20398,6 @@ class DocEditor {
|
|
20378
20398
|
beforeRenderSubject = new Subject();
|
20379
20399
|
afterRenderSubject = new Subject();
|
20380
20400
|
onBeforeSetCursorSubject = new Subject();
|
20381
|
-
contentChanged = new Subject();
|
20382
20401
|
onPatchVNodeSubject = new Subject();
|
20383
20402
|
selectionState;
|
20384
20403
|
onDblClickEvent = new Subject();
|
@@ -20670,10 +20689,12 @@ class DocEditor {
|
|
20670
20689
|
}
|
20671
20690
|
loadDoc(data) {
|
20672
20691
|
suppressTracking(() => {
|
20673
|
-
this.
|
20674
|
-
|
20675
|
-
|
20676
|
-
|
20692
|
+
this.noEffectChange(() => {
|
20693
|
+
this.adjustPageLayout();
|
20694
|
+
this.elementReader.read(data);
|
20695
|
+
this.refreshDocument();
|
20696
|
+
this.historyMange.clear();
|
20697
|
+
});
|
20677
20698
|
});
|
20678
20699
|
}
|
20679
20700
|
/**
|
@@ -20691,7 +20712,6 @@ class DocEditor {
|
|
20691
20712
|
suppressTracking(() => {
|
20692
20713
|
this.documentPaginator.rePages();
|
20693
20714
|
});
|
20694
|
-
this.contentChanged.next();
|
20695
20715
|
}
|
20696
20716
|
this.updateSelection();
|
20697
20717
|
this.setCursor();
|
@@ -20718,6 +20738,7 @@ class DocEditor {
|
|
20718
20738
|
ssChanged && this.documentEvent.invokeCursor(this.selectionState.startControl);
|
20719
20739
|
this.documentSelection.clearSnapshot();
|
20720
20740
|
this.documentSelection.takeSnapshot();
|
20741
|
+
return ssChanged;
|
20721
20742
|
}
|
20722
20743
|
/**
|
20723
20744
|
* 根据当前选区,更新待输入文本字体信息
|
@@ -20757,6 +20778,7 @@ class DocEditor {
|
|
20757
20778
|
this.selectionState.cursorPos = cursorRect;
|
20758
20779
|
const abPos = ElementUtil.cloneRect(cursorRect);
|
20759
20780
|
this.setCursorPosition(abPos);
|
20781
|
+
this.setCursorVisibility(true);
|
20760
20782
|
//this.documentEvent.invokeCursor(startControl);
|
20761
20783
|
return;
|
20762
20784
|
}
|
@@ -20790,7 +20812,7 @@ class DocEditor {
|
|
20790
20812
|
setCursorVisibility(visibility) {
|
20791
20813
|
if (visibility) {
|
20792
20814
|
//this.editInput.style.removeProperty('display');
|
20793
|
-
this.editInput.focus();
|
20815
|
+
this.editInput.focus({ preventScroll: true });
|
20794
20816
|
}
|
20795
20817
|
}
|
20796
20818
|
hiddenInput(reset = true, pos = null) {
|
@@ -20812,7 +20834,6 @@ class DocEditor {
|
|
20812
20834
|
this.editInput.style.height = position.height + 'px';
|
20813
20835
|
this.editInput.style.width = "1.6px";
|
20814
20836
|
this.editInput.readOnly = false;
|
20815
|
-
this.setCursorVisibility(true);
|
20816
20837
|
//判断光标位置是否被可见,如果不可见,需要将其设置到可见区域
|
20817
20838
|
//TODO:暂时不做处理
|
20818
20839
|
//this.setCursorInputStatus();
|
@@ -20848,7 +20869,7 @@ class DocEditor {
|
|
20848
20869
|
* 文档点击事件
|
20849
20870
|
*/
|
20850
20871
|
docClickHandle(evt) {
|
20851
|
-
this.hiddenInput();
|
20872
|
+
//this.hiddenInput();
|
20852
20873
|
// this.setCursor();
|
20853
20874
|
// this.updateSelection();
|
20854
20875
|
this.refreshDocument();
|
@@ -21148,20 +21169,20 @@ class DocEditor {
|
|
21148
21169
|
const startControl = this.selectionState.startControl;
|
21149
21170
|
if (startControl instanceof TextGroupElement) {
|
21150
21171
|
const selectedStyle = startControl.props.clone(null);
|
21151
|
-
const
|
21152
|
-
this.viewOptions.
|
21172
|
+
const selectionColor = this.viewOptions.selectionColor;
|
21173
|
+
this.viewOptions.selectionColor = "rgba(0,58,140,0.8)";
|
21153
21174
|
const cancelToken = {};
|
21154
21175
|
const sub = this.onClickEvent.subscribe(() => {
|
21155
21176
|
sub.unsubscribe();
|
21156
21177
|
this.setTextFormat(selectedStyle);
|
21157
|
-
this.viewOptions.
|
21178
|
+
this.viewOptions.selectionColor = selectionColor;
|
21158
21179
|
if (cancelToken.onFinish) {
|
21159
21180
|
cancelToken.onFinish(null);
|
21160
21181
|
}
|
21161
21182
|
});
|
21162
21183
|
cancelToken.cancel = () => {
|
21163
21184
|
sub.unsubscribe();
|
21164
|
-
this.viewOptions.
|
21185
|
+
this.viewOptions.selectionColor = selectionColor;
|
21165
21186
|
};
|
21166
21187
|
return cancelToken;
|
21167
21188
|
}
|
@@ -21594,7 +21615,7 @@ class DocEditor {
|
|
21594
21615
|
const scaleFitContainer = {
|
21595
21616
|
sel: 'div#scale-fit-container',
|
21596
21617
|
data: {
|
21597
|
-
style: {
|
21618
|
+
style: { height: '0px', }
|
21598
21619
|
},
|
21599
21620
|
children: [docContent]
|
21600
21621
|
};
|
@@ -21756,7 +21777,7 @@ class DocEditor {
|
|
21756
21777
|
data: {
|
21757
21778
|
style: {
|
21758
21779
|
position: 'absolute',
|
21759
|
-
left: (position.x
|
21780
|
+
left: (position.x) + 'px',
|
21760
21781
|
top: position.y + 5 + position.height + 'px',
|
21761
21782
|
},
|
21762
21783
|
hook: {
|
@@ -21922,7 +21943,7 @@ class DocEditor {
|
|
21922
21943
|
rule.setRuleOptions({ width: this.viewOptions.docPageSettings.width, pagePL, pagePR, docLeft });
|
21923
21944
|
}
|
21924
21945
|
version() {
|
21925
|
-
return "2.2.
|
21946
|
+
return "2.2.8";
|
21926
21947
|
}
|
21927
21948
|
switchPageHeaderEditor() {
|
21928
21949
|
this.docCtx.document.switchPageHeaderEditor(this.selectionState, null);
|
@@ -22225,6 +22246,13 @@ class DocEditor {
|
|
22225
22246
|
this.documentChange.appendText(text, this.docCtx.suggestions.currentMatchedText);
|
22226
22247
|
}
|
22227
22248
|
}
|
22249
|
+
parser(code, returnProcess = false) {
|
22250
|
+
const res = parser(code);
|
22251
|
+
if (returnProcess) {
|
22252
|
+
return addReturn(res);
|
22253
|
+
}
|
22254
|
+
return res;
|
22255
|
+
}
|
22228
22256
|
}
|
22229
22257
|
|
22230
22258
|
/**
|
@@ -27778,7 +27806,7 @@ exports.LostCursorEvent = LostCursorEvent;
|
|
27778
27806
|
exports.MarginProps = MarginProps;
|
27779
27807
|
exports.MouseElementEvent = MouseElementEvent;
|
27780
27808
|
exports.MousedownElementEvent = MousedownElementEvent;
|
27781
|
-
exports.
|
27809
|
+
exports.MultiBlockLineRenderObject = MultiBlockLineRenderObject;
|
27782
27810
|
exports.OnceSubject = OnceSubject;
|
27783
27811
|
exports.PSymbolElement = PSymbolElement;
|
27784
27812
|
exports.PSymbolRenderObject = PSymbolRenderObject;
|