@hailin-zheng/editor-core 1.1.17 → 1.1.19
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/controls/SurfaceView.d.ts +2 -0
- package/index-cjs.js +1657 -291
- package/index-cjs.js.map +1 -1
- package/index.js +1654 -292
- package/index.js.map +1 -1
- package/med_editor/framework/document-change.d.ts +2 -1
- package/med_editor/framework/document-event.d.ts +1 -1
- package/med_editor/framework/document-selection.d.ts +1 -0
- package/med_editor/framework/element-define.d.ts +4 -0
- package/med_editor/framework/element-event-define.d.ts +4 -1
- package/med_editor/framework/element-props.d.ts +10 -2
- package/med_editor/framework/element-util.d.ts +1 -0
- package/med_editor/framework/impl/text/text-impl.d.ts +2 -1
- package/med_editor/framework/paragraph-arrange.d.ts +4 -1
- package/med_editor/framework/render-context.d.ts +12 -2
- package/med_editor/texteditor.d.ts +10 -8
- package/package.json +1 -1
- package/timeline/TimeLineControl.d.ts +1 -0
- package/timeline/TimeValueGridControl.d.ts +10 -0
- package/timeline/TimelineConfig.d.ts +1 -0
package/index.js
CHANGED
@@ -4,6 +4,7 @@ import * as acor from 'acorn';
|
|
4
4
|
import { generate } from 'astring';
|
5
5
|
import * as estraverse from 'estraverse';
|
6
6
|
import bwipjs from 'bwip-js';
|
7
|
+
import moment$1 from 'moment/moment';
|
7
8
|
|
8
9
|
/**
|
9
10
|
* 元素事件
|
@@ -49,6 +50,9 @@ class ContentMenuItem {
|
|
49
50
|
*/
|
50
51
|
class MouseElementEvent extends ElementEvent {
|
51
52
|
}
|
53
|
+
class InputElementEvent extends ElementEvent {
|
54
|
+
data;
|
55
|
+
}
|
52
56
|
class MousedownElementEvent extends ElementEvent {
|
53
57
|
}
|
54
58
|
class KeyboradElementEvent extends ElementEvent {
|
@@ -1437,7 +1441,7 @@ class ViewOptions {
|
|
1437
1441
|
viewBackcolor = 'rgb(230,230,230)';
|
1438
1442
|
paraSymbolColor = 'rgb(128,128,128)';
|
1439
1443
|
dataGroupColor = 'rgb(0,80,179)';
|
1440
|
-
defaultLineHeight = 1
|
1444
|
+
defaultLineHeight = 1;
|
1441
1445
|
//新增-留痕块文本颜色
|
1442
1446
|
trackInsColor = '#ff4d4f';
|
1443
1447
|
//删除-留痕块文本颜色
|
@@ -1772,7 +1776,7 @@ class ParagraphProps extends INotifyPropertyChanged {
|
|
1772
1776
|
//textProps!: TextProps;
|
1773
1777
|
indent = 0;
|
1774
1778
|
hanging = 0;
|
1775
|
-
lineHeight = 1
|
1779
|
+
lineHeight = 1;
|
1776
1780
|
textAlign = 'left';
|
1777
1781
|
numberType = ParagraphNumberType.none;
|
1778
1782
|
//段前距
|
@@ -1872,6 +1876,8 @@ class CheckBoxProps extends INotifyPropertyChanged {
|
|
1872
1876
|
isChecked;
|
1873
1877
|
//用于复选框分组
|
1874
1878
|
groupName;
|
1879
|
+
trueChar = '√';
|
1880
|
+
falseChar = '×';
|
1875
1881
|
clone(dest) {
|
1876
1882
|
const clone = dest ?? new CheckBoxProps();
|
1877
1883
|
super.cloneAttachedProperty(clone);
|
@@ -2047,7 +2053,6 @@ class DataEleBaseProps extends INotifyPropertyChanged {
|
|
2047
2053
|
editable;
|
2048
2054
|
deleteable;
|
2049
2055
|
minLength;
|
2050
|
-
type;
|
2051
2056
|
underline;
|
2052
2057
|
expression;
|
2053
2058
|
hidden;
|
@@ -2066,7 +2071,6 @@ class DataEleBaseProps extends INotifyPropertyChanged {
|
|
2066
2071
|
target.secretBrowse = source.secretBrowse;
|
2067
2072
|
target.printable = source.printable;
|
2068
2073
|
target.minLength = source.minLength;
|
2069
|
-
target.type = source.type;
|
2070
2074
|
target.underline = source.underline;
|
2071
2075
|
target.expression = source.expression;
|
2072
2076
|
target.hidden = source.hidden;
|
@@ -2078,7 +2082,6 @@ class DataEleBaseProps extends INotifyPropertyChanged {
|
|
2078
2082
|
props["id"] = this.id;
|
2079
2083
|
props["name"] = this.name;
|
2080
2084
|
props["fieldName"] = this.fieldName;
|
2081
|
-
props["type"] = this.type;
|
2082
2085
|
if (this.caption) {
|
2083
2086
|
props["caption"] = this.caption;
|
2084
2087
|
}
|
@@ -2118,7 +2121,6 @@ class DataEleBaseProps extends INotifyPropertyChanged {
|
|
2118
2121
|
class DataEleBaseTextProps extends DataEleBaseProps {
|
2119
2122
|
constructor() {
|
2120
2123
|
super();
|
2121
|
-
super.type = 'text';
|
2122
2124
|
}
|
2123
2125
|
valueTextProps;
|
2124
2126
|
nullText;
|
@@ -2134,7 +2136,6 @@ class DataEleBaseTextProps extends DataEleBaseProps {
|
|
2134
2136
|
}
|
2135
2137
|
getSerializeProps(options) {
|
2136
2138
|
const props = {
|
2137
|
-
type: this.type,
|
2138
2139
|
valueTextProps: this.valueTextProps.getSerializeProps(options),
|
2139
2140
|
nullText: this.nullText,
|
2140
2141
|
nullTextProps: this.nullTextProps.getSerializeProps(options)
|
@@ -2164,7 +2165,6 @@ class DataEleBaseTextProps extends DataEleBaseProps {
|
|
2164
2165
|
class DataEleListProps extends DataEleBaseTextProps {
|
2165
2166
|
constructor() {
|
2166
2167
|
super();
|
2167
|
-
super.type = 'droplist';
|
2168
2168
|
}
|
2169
2169
|
options = [];
|
2170
2170
|
dropDownStyle;
|
@@ -2230,16 +2230,23 @@ class CommProps extends INotifyPropertyChanged {
|
|
2230
2230
|
};
|
2231
2231
|
}
|
2232
2232
|
}
|
2233
|
+
const trueChar = '✓';
|
2234
|
+
const falseChar = '×';
|
2233
2235
|
class DataEleCheckProps extends DataEleBaseProps {
|
2234
2236
|
constructor() {
|
2235
2237
|
super();
|
2236
|
-
super.type = 'check';
|
2237
2238
|
}
|
2239
|
+
border = true;
|
2238
2240
|
size;
|
2239
2241
|
checked;
|
2240
2242
|
checkedValue = '';
|
2241
2243
|
groupName;
|
2242
2244
|
multiSelect = false;
|
2245
|
+
drawStateChar = false;
|
2246
|
+
trueChar = trueChar;
|
2247
|
+
falseChar = falseChar;
|
2248
|
+
trueStateColor = '#f00000';
|
2249
|
+
falseStateColor = '#000000';
|
2243
2250
|
clone(dest) {
|
2244
2251
|
const clone = dest ?? new DataEleCheckProps();
|
2245
2252
|
super.cloneBaseProps(clone);
|
@@ -2248,6 +2255,12 @@ class DataEleCheckProps extends DataEleBaseProps {
|
|
2248
2255
|
clone.groupName = this.groupName;
|
2249
2256
|
clone.multiSelect = this.multiSelect;
|
2250
2257
|
clone.checkedValue = this.checkedValue;
|
2258
|
+
clone.drawStateChar = this.drawStateChar;
|
2259
|
+
clone.trueChar = this.trueChar;
|
2260
|
+
clone.falseChar = this.falseChar;
|
2261
|
+
clone.border = this.border;
|
2262
|
+
clone.trueStateColor = this.trueStateColor;
|
2263
|
+
clone.falseStateColor = this.falseStateColor;
|
2251
2264
|
return clone;
|
2252
2265
|
}
|
2253
2266
|
getSerializeProps(options) {
|
@@ -2256,8 +2269,26 @@ class DataEleCheckProps extends DataEleBaseProps {
|
|
2256
2269
|
size: this.size,
|
2257
2270
|
groupName: this.groupName,
|
2258
2271
|
multiSelect: this.multiSelect,
|
2259
|
-
checkedValue: this.checkedValue
|
2272
|
+
checkedValue: this.checkedValue,
|
2260
2273
|
};
|
2274
|
+
if (this.drawStateChar) {
|
2275
|
+
props.drawStateChar = this.drawStateChar;
|
2276
|
+
}
|
2277
|
+
if (this.trueChar !== trueChar) {
|
2278
|
+
props.trueChar = this.trueChar;
|
2279
|
+
}
|
2280
|
+
if (this.falseChar !== falseChar) {
|
2281
|
+
props.falseChar = this.falseChar;
|
2282
|
+
}
|
2283
|
+
if (this.border) {
|
2284
|
+
props.border = this.border;
|
2285
|
+
}
|
2286
|
+
if (this.trueStateColor !== '#f00000') {
|
2287
|
+
props.trueStateColor = this.trueStateColor;
|
2288
|
+
}
|
2289
|
+
if (this.falseStateColor !== '#000000') {
|
2290
|
+
props.falseStateColor = this.falseStateColor;
|
2291
|
+
}
|
2261
2292
|
this.getBaseProps(props, options);
|
2262
2293
|
return props;
|
2263
2294
|
}
|
@@ -2268,12 +2299,17 @@ class DataEleCheckProps extends DataEleBaseProps {
|
|
2268
2299
|
this.groupName = props.groupName;
|
2269
2300
|
this.multiSelect = props.multiSelect;
|
2270
2301
|
this.checkedValue = props.checkedValue;
|
2302
|
+
this.drawStateChar = props.drawStateChar;
|
2303
|
+
this.trueChar = props.trueChar;
|
2304
|
+
this.falseChar = props.falseChar;
|
2305
|
+
this.trueStateColor = props.trueStateColor;
|
2306
|
+
this.falseStateColor = props.falseStateColor;
|
2307
|
+
this.border = props.border;
|
2271
2308
|
}
|
2272
2309
|
}
|
2273
2310
|
class DataEleImageProps extends DataEleBaseProps {
|
2274
2311
|
constructor() {
|
2275
2312
|
super();
|
2276
|
-
super.type = 'img';
|
2277
2313
|
}
|
2278
2314
|
width;
|
2279
2315
|
height;
|
@@ -2307,10 +2343,6 @@ class DataEleImageProps extends DataEleBaseProps {
|
|
2307
2343
|
}
|
2308
2344
|
}
|
2309
2345
|
class DataEleDateProps extends DataEleBaseTextProps {
|
2310
|
-
constructor() {
|
2311
|
-
super();
|
2312
|
-
super.type = 'date';
|
2313
|
-
}
|
2314
2346
|
minValue;
|
2315
2347
|
maxValue;
|
2316
2348
|
format;
|
@@ -3137,7 +3169,7 @@ class DataElementRenderObject extends InlineGroupRenderObject {
|
|
3137
3169
|
bgColor = viewOptions.dataEleErrorBgColor;
|
3138
3170
|
}
|
3139
3171
|
if (bgColor) {
|
3140
|
-
render.overlaysContext.fillRect(position.x, position.y
|
3172
|
+
render.overlaysContext.fillRect(position.x, position.y, this.rect.width, this.rect.height, bgColor);
|
3141
3173
|
}
|
3142
3174
|
if (this.element.props.secretBrowse && viewOptions.secretBrowse) {
|
3143
3175
|
render.contentContext.ctx.filter = "blur(10px)";
|
@@ -3174,7 +3206,7 @@ class DataElementRenderObject extends InlineGroupRenderObject {
|
|
3174
3206
|
textProps.fontSize = 16;
|
3175
3207
|
textProps.fontName = viewOptions.defaultFontName;
|
3176
3208
|
textProps.color = '#fff';
|
3177
|
-
const titleWidth = render.contentContext.
|
3209
|
+
const titleWidth = render.contentContext.measureTextWidth(caption, textProps);
|
3178
3210
|
const x = position.x;
|
3179
3211
|
const y = position.y - 20;
|
3180
3212
|
render.contentContext.fillRect(x, y, titleWidth + 10, 20, 'blue');
|
@@ -4057,8 +4089,8 @@ class DocumentContainerRender extends BlockContainerRenderObject {
|
|
4057
4089
|
}
|
4058
4090
|
|
4059
4091
|
class TextGroupElement extends LeafElement {
|
4060
|
-
//props: TextProps;
|
4061
4092
|
textMeasures = [];
|
4093
|
+
fontBoundingBox;
|
4062
4094
|
isMeasure = false;
|
4063
4095
|
constructor() {
|
4064
4096
|
super('text');
|
@@ -4098,6 +4130,7 @@ class TextGroupElement extends LeafElement {
|
|
4098
4130
|
createRenderObject(data) {
|
4099
4131
|
if (!this.isMeasure || this.modifyFlag !== ModifyFlag$1.None || !this.cacheRender) {
|
4100
4132
|
data.renderCtx.contentContext.measureTextUnits(this.textMeasures, this.props);
|
4133
|
+
this.fontBoundingBox = data.renderCtx.contentContext.measureTextMetrics(this.props.getFont());
|
4101
4134
|
this.isMeasure = true;
|
4102
4135
|
}
|
4103
4136
|
const render = new TextGroupRenderObject(this);
|
@@ -4171,10 +4204,7 @@ class TextGroupRenderObject extends LeafRenderObject {
|
|
4171
4204
|
if (this.element.props.border) {
|
4172
4205
|
render.contentContext.strokeRect(position.x, position.y, this.rect.width, this.rect.height);
|
4173
4206
|
}
|
4174
|
-
render.contentContext.drawTextUnits(this, position.x, position.y);
|
4175
|
-
// if (this.element.isMouseenter) {
|
4176
|
-
// ctx.overlaysContext.strokeRect(position.x, position.y, this.rect.width, this.rect.height, CommonUtil.randomColor());
|
4177
|
-
// }
|
4207
|
+
render.contentContext.drawTextUnits(this, position.x, position.y, this.element.fontBoundingBox.fontBoundingBoxAscent);
|
4178
4208
|
}
|
4179
4209
|
constructor(element) {
|
4180
4210
|
super(element);
|
@@ -4193,7 +4223,7 @@ class TextGroupRenderObject extends LeafRenderObject {
|
|
4193
4223
|
}
|
4194
4224
|
measure() {
|
4195
4225
|
this.rect.width = this.textMeasures.reduce((prev, curr) => prev + curr.actualSize, 0);
|
4196
|
-
this.rect.height = this.element.
|
4226
|
+
this.rect.height = this.element.fontBoundingBox.fontBoundingBoxAscent + this.element.fontBoundingBox.fontBoundingBoxDescent;
|
4197
4227
|
}
|
4198
4228
|
}
|
4199
4229
|
class TextGroupFactory extends ElementFactory {
|
@@ -4382,6 +4412,10 @@ class SelectionState {
|
|
4382
4412
|
constructor() {
|
4383
4413
|
this.clear();
|
4384
4414
|
}
|
4415
|
+
destroy() {
|
4416
|
+
this.onChangedEvent.unsubscribe();
|
4417
|
+
this.clear();
|
4418
|
+
}
|
4385
4419
|
clear() {
|
4386
4420
|
this.range = null;
|
4387
4421
|
this.startOffset = -1;
|
@@ -5590,10 +5624,15 @@ class TableUtil {
|
|
5590
5624
|
}
|
5591
5625
|
const remainWidth = tbWidth - sum;
|
5592
5626
|
const ratio = remainWidth / percentSum;
|
5627
|
+
let count = 0;
|
5593
5628
|
for (let i = 0; i < percentCols.length; i++) {
|
5594
5629
|
const width = percentCols[i];
|
5595
5630
|
if (typeof width === 'string') {
|
5596
5631
|
percentCols[i] = Math.floor(Number.parseFloat(width) * ratio);
|
5632
|
+
if (i === percentCols.length - 1) {
|
5633
|
+
percentCols[i] = remainWidth - count;
|
5634
|
+
}
|
5635
|
+
count += percentCols[i];
|
5597
5636
|
}
|
5598
5637
|
}
|
5599
5638
|
return percentCols;
|
@@ -6237,7 +6276,6 @@ class ElementUtil {
|
|
6237
6276
|
dest.secretBrowse = props.secretBrowse;
|
6238
6277
|
dest.deleteable = props.deleteable;
|
6239
6278
|
dest.underline = props.underline;
|
6240
|
-
dest.type = props.type;
|
6241
6279
|
dest.expression = props.expression;
|
6242
6280
|
dest.hidden = props.hidden;
|
6243
6281
|
return dest;
|
@@ -6308,9 +6346,9 @@ class ElementUtil {
|
|
6308
6346
|
}
|
6309
6347
|
static remeasureTableRow(rowRender, foreceColIndex = -1) {
|
6310
6348
|
const rowEle = rowRender.element;
|
6311
|
-
let maxCellHeight = rowEle.props.minHeight >
|
6349
|
+
let maxCellHeight = rowEle.props.minHeight > 20 ? rowEle.props.minHeight : 20;
|
6312
6350
|
//限制行最小高度
|
6313
|
-
maxCellHeight = maxCellHeight <
|
6351
|
+
maxCellHeight = maxCellHeight < 20 ? 20 : maxCellHeight;
|
6314
6352
|
//获取行内非纵向合并单元格的最高单元格高度
|
6315
6353
|
for (let i = 0; i < rowRender.length; i++) {
|
6316
6354
|
const cellRender = rowRender.getChild(i);
|
@@ -7656,6 +7694,19 @@ class ElementUtil {
|
|
7656
7694
|
static getDataElement(ele) {
|
7657
7695
|
return this.getParent(ele, item => item instanceof DataElementInlineGroup);
|
7658
7696
|
}
|
7697
|
+
static getOSPlatform() {
|
7698
|
+
const userAgent = navigator.userAgent;
|
7699
|
+
if (userAgent.indexOf('Windows') > -1) {
|
7700
|
+
return 'Windows';
|
7701
|
+
}
|
7702
|
+
if (userAgent.indexOf('Mac') > -1) {
|
7703
|
+
return 'Mac';
|
7704
|
+
}
|
7705
|
+
if (userAgent.indexOf('Linux') > -1) {
|
7706
|
+
return 'Linux';
|
7707
|
+
}
|
7708
|
+
return 'Windows';
|
7709
|
+
}
|
7659
7710
|
}
|
7660
7711
|
|
7661
7712
|
class RenderContext {
|
@@ -7770,7 +7821,7 @@ class PaintContent {
|
|
7770
7821
|
this.ctx.fill();
|
7771
7822
|
this.ctx.restore();
|
7772
7823
|
}
|
7773
|
-
drawTextUnits(textGroupRender, x, y) {
|
7824
|
+
drawTextUnits(textGroupRender, x, y, baseLine) {
|
7774
7825
|
const textEle = textGroupRender.element;
|
7775
7826
|
const textProps = textEle.props;
|
7776
7827
|
const { width, height } = textGroupRender.rect;
|
@@ -7793,12 +7844,10 @@ class PaintContent {
|
|
7793
7844
|
this.drawHoriLine(x, y, width, textProps.color, 1);
|
7794
7845
|
}
|
7795
7846
|
let horX = 0;
|
7796
|
-
let vertHeight =
|
7847
|
+
let vertHeight = baseLine;
|
7797
7848
|
if (textProps.vertAlign === 'superscript') {
|
7798
7849
|
//到top
|
7799
7850
|
vertHeight -= textProps.fontSize * 2 / 5;
|
7800
|
-
//top在向上收缩 -top行间距
|
7801
|
-
//vertHeight -= textProps.fontSize * this.getParaLineHeight(textEle) / 20
|
7802
7851
|
}
|
7803
7852
|
for (let i = 0; i < textGroupRender.textMeasures.length; i++) {
|
7804
7853
|
const unit = textGroupRender.textMeasures[i];
|
@@ -7807,6 +7856,15 @@ class PaintContent {
|
|
7807
7856
|
}
|
7808
7857
|
this.ctx.restore();
|
7809
7858
|
}
|
7859
|
+
drawText2(str, font, color, x, y, width, height) {
|
7860
|
+
const textMetrics = this.measureTextMetrics(font, str);
|
7861
|
+
this.ctx.save();
|
7862
|
+
this.ctx.fillStyle = color;
|
7863
|
+
this.ctx.font = font;
|
7864
|
+
let vertHeight = textMetrics.actualBoundingBoxAscent;
|
7865
|
+
this.ctx.fillText(str, x + (width - (textMetrics.actualBoundingBoxLeft + textMetrics.actualBoundingBoxRight)) / 2 - textMetrics.actualBoundingBoxLeft, y + vertHeight + (height - (textMetrics.actualBoundingBoxAscent + textMetrics.actualBoundingBoxDescent)) / 2);
|
7866
|
+
this.ctx.restore();
|
7867
|
+
}
|
7810
7868
|
getParaLineHeight(textEle) {
|
7811
7869
|
const para = ElementUtil.getParentByType(textEle, ParagraphElement);
|
7812
7870
|
if (!para) {
|
@@ -7817,10 +7875,23 @@ class PaintContent {
|
|
7817
7875
|
measureText(text, textProps) {
|
7818
7876
|
this.ctx.fillStyle = textProps.color;
|
7819
7877
|
this.ctx.font = textProps.getFont();
|
7820
|
-
const
|
7821
|
-
return { width:
|
7878
|
+
const { width, fontBoundingBoxDescent, fontBoundingBoxAscent } = this.ctx.measureText(text);
|
7879
|
+
return { width: width, height: fontBoundingBoxAscent + fontBoundingBoxDescent };
|
7822
7880
|
}
|
7823
|
-
|
7881
|
+
measureTextMetrics(font, str = 'M') {
|
7882
|
+
this.ctx.font = font;
|
7883
|
+
const textMetrics = this.ctx.measureText(str);
|
7884
|
+
return {
|
7885
|
+
fontBoundingBoxAscent: textMetrics.fontBoundingBoxAscent,
|
7886
|
+
fontBoundingBoxDescent: textMetrics.fontBoundingBoxDescent,
|
7887
|
+
actualBoundingBoxAscent: textMetrics.actualBoundingBoxAscent,
|
7888
|
+
actualBoundingBoxDescent: textMetrics.actualBoundingBoxDescent,
|
7889
|
+
actualBoundingBoxLeft: textMetrics.actualBoundingBoxLeft,
|
7890
|
+
actualBoundingBoxRight: textMetrics.actualBoundingBoxRight,
|
7891
|
+
width: textMetrics.width
|
7892
|
+
};
|
7893
|
+
}
|
7894
|
+
measureTextWidth(text, font) {
|
7824
7895
|
this.ctx.font = font.fontSize + 'px ' + font.fontName;
|
7825
7896
|
return this.ctx.measureText(text).width;
|
7826
7897
|
}
|
@@ -8655,11 +8726,22 @@ class DataElementCheckRenderObject extends LeafRenderObject {
|
|
8655
8726
|
render(e) {
|
8656
8727
|
const { render, position } = e;
|
8657
8728
|
const element = this.element;
|
8658
|
-
if (
|
8659
|
-
|
8729
|
+
if (element.props.drawStateChar) {
|
8730
|
+
const font = `${element.props.size - 2}px 微软雅黑`;
|
8731
|
+
const str = element.props.checked ? element.props.trueChar : element.props.falseChar;
|
8732
|
+
const color = element.props.checked ? element.props.trueStateColor : element.props.falseStateColor;
|
8733
|
+
e.render.contentContext.drawText2(str, font, color, position.x, position.y, element.props.size, element.props.size);
|
8734
|
+
if (element.props.border) {
|
8735
|
+
e.render.contentContext.strokeRect(position.x + 2, position.y, element.props.size, element.props.size);
|
8736
|
+
}
|
8660
8737
|
}
|
8661
8738
|
else {
|
8662
|
-
|
8739
|
+
if (element.props.multiSelect) {
|
8740
|
+
render.contentContext.drawCheckBox(position.x + 2, position.y, element.props.size, element.props.size, element.props.checked);
|
8741
|
+
}
|
8742
|
+
else {
|
8743
|
+
render.contentContext.drawRadioBox(position.x + 2, position.y, element.props.size, element.props.size, element.props.checked);
|
8744
|
+
}
|
8663
8745
|
}
|
8664
8746
|
}
|
8665
8747
|
}
|
@@ -8676,15 +8758,15 @@ class DataElementCheckFactory extends ElementFactory {
|
|
8676
8758
|
createDataEleProps(dest, props) {
|
8677
8759
|
const dataEleProps = dest;
|
8678
8760
|
ElementUtil.readEleBaseProps(dataEleProps, props);
|
8679
|
-
//dataEleProps.id = props.id ?? nanoid(5);
|
8680
|
-
//dataEleProps.name = props.name;
|
8681
|
-
//dataEleProps.caption = props.caption;
|
8682
|
-
//dataEleProps.type = props.type;
|
8683
8761
|
dataEleProps.checked = props.checked;
|
8684
8762
|
dataEleProps.size = props.size;
|
8685
8763
|
dataEleProps.groupName = props.groupName;
|
8686
8764
|
dataEleProps.multiSelect = props.multiSelect ?? false;
|
8687
8765
|
dataEleProps.checkedValue = props.checkedValue;
|
8766
|
+
dataEleProps.drawStateChar = props.drawStateChar ?? false;
|
8767
|
+
dataEleProps.trueChar = props.trueChar ?? trueChar;
|
8768
|
+
dataEleProps.falseChar = props.falseChar ?? falseChar;
|
8769
|
+
dataEleProps.border = props.border ?? true;
|
8688
8770
|
return dataEleProps;
|
8689
8771
|
}
|
8690
8772
|
}
|
@@ -11316,6 +11398,7 @@ class ParagraphMeasure {
|
|
11316
11398
|
}
|
11317
11399
|
},
|
11318
11400
|
parent: null,
|
11401
|
+
isCloseToBody,
|
11319
11402
|
applyNewLine() {
|
11320
11403
|
createInnerLineFunc();
|
11321
11404
|
},
|
@@ -11501,6 +11584,7 @@ class ParagraphMeasure {
|
|
11501
11584
|
parentLine.updateHeight(child);
|
11502
11585
|
},
|
11503
11586
|
parent: parentLine,
|
11587
|
+
isCloseToBody: parentLine.isCloseToBody,
|
11504
11588
|
applyNewLine() {
|
11505
11589
|
parentLine.applyNewLine();
|
11506
11590
|
render = ele.createRenderObject({ options, renderCtx });
|
@@ -11562,7 +11646,7 @@ class ParagraphMeasure {
|
|
11562
11646
|
arrangeLeafRender(parentLine, render) {
|
11563
11647
|
if (parentLine.lineWidth() + render.rect.width > parentLine.limitWidth) {
|
11564
11648
|
if (render instanceof TextGroupRenderObject) {
|
11565
|
-
const { firstItem, lastItem } = this.cutTextRender(render, parentLine.limitWidth - parentLine.lineWidth(), parentLine.lineWidth() === 0);
|
11649
|
+
const { firstItem, lastItem } = this.cutTextRender(render, parentLine.limitWidth - parentLine.lineWidth(), parentLine.lineWidth() === 0, parentLine.isCloseToBody);
|
11566
11650
|
if (firstItem) {
|
11567
11651
|
parentLine.add(firstItem);
|
11568
11652
|
}
|
@@ -11570,6 +11654,10 @@ class ParagraphMeasure {
|
|
11570
11654
|
parentLine.applyNewLine();
|
11571
11655
|
this.arrangeLeafRender(parentLine, lastItem);
|
11572
11656
|
}
|
11657
|
+
if (!firstItem && !lastItem) {
|
11658
|
+
parentLine.applyNewLine();
|
11659
|
+
this.arrangeLeafRender(parentLine, render);
|
11660
|
+
}
|
11573
11661
|
}
|
11574
11662
|
else if (render instanceof FillNullSpaceRenderObject) {
|
11575
11663
|
const { firstItem, lastItem } = this.cutFillNullRender(render, parentLine.limitWidth - parentLine.lineWidth());
|
@@ -11609,7 +11697,7 @@ class ParagraphMeasure {
|
|
11609
11697
|
}
|
11610
11698
|
}
|
11611
11699
|
}
|
11612
|
-
cutTextRender(render, limitWidth, lineEmpty) {
|
11700
|
+
cutTextRender(render, limitWidth, lineEmpty, isCloseToBody) {
|
11613
11701
|
let sumWidth = 0;
|
11614
11702
|
const cutRender = render.clone();
|
11615
11703
|
cutRender.textMeasures.length = 0;
|
@@ -11623,13 +11711,13 @@ class ParagraphMeasure {
|
|
11623
11711
|
break;
|
11624
11712
|
}
|
11625
11713
|
}
|
11626
|
-
|
11627
|
-
|
11628
|
-
|
11629
|
-
|
11630
|
-
|
11631
|
-
|
11632
|
-
|
11714
|
+
//后置标点处理
|
11715
|
+
i = this.patchHandlePostPunctuation(render, i, isCloseToBody, lineEmpty);
|
11716
|
+
//前置标点处理
|
11717
|
+
i = this.patchHandleLeadingPunctuation(render, i, lineEmpty);
|
11718
|
+
if (i <= 0) {
|
11719
|
+
return { firstItem: null, lastItem: null };
|
11720
|
+
}
|
11633
11721
|
cutRender.textMeasures = render.textMeasures.splice(0, i);
|
11634
11722
|
render.measure();
|
11635
11723
|
cutRender.measure();
|
@@ -11639,6 +11727,7 @@ class ParagraphMeasure {
|
|
11639
11727
|
* 处理前置标点,前置标点不能出现在末尾
|
11640
11728
|
* @param render
|
11641
11729
|
* @param i
|
11730
|
+
* @param lineEmpty
|
11642
11731
|
*/
|
11643
11732
|
patchHandleLeadingPunctuation(render, i, lineEmpty) {
|
11644
11733
|
if (i === 1 && lineEmpty) {
|
@@ -11653,15 +11742,10 @@ class ParagraphMeasure {
|
|
11653
11742
|
* 处理后置标点,后置标点不能出现在行首
|
11654
11743
|
* @param render
|
11655
11744
|
* @param i
|
11745
|
+
* @param inCloseBody
|
11656
11746
|
* @param lineEmpty
|
11657
11747
|
*/
|
11658
|
-
patchHandlePostPunctuation(render,
|
11659
|
-
if (i === render.textMeasures.length - 1) {
|
11660
|
-
//紧跟着的字符包含后置标点
|
11661
|
-
if (this.containerStartSymbolInTextStart(nextRender)) {
|
11662
|
-
i--;
|
11663
|
-
}
|
11664
|
-
}
|
11748
|
+
patchHandlePostPunctuation(render, i, inCloseBody, lineEmpty) {
|
11665
11749
|
if (inCloseBody && this.containPostPunctuation(render.textMeasures[i]?.char)) {
|
11666
11750
|
if (this.containPostPunctuation(render.textMeasures[i + 1]?.char)) {
|
11667
11751
|
i--;
|
@@ -13875,7 +13959,7 @@ class DocumentEvent {
|
|
13875
13959
|
}
|
13876
13960
|
const event = new GetTrackTipsEvent(this.docCtx);
|
13877
13961
|
event.source = element;
|
13878
|
-
DocumentEvent.invokeEvent('GetTrackTips', element, event, 'Bubbling'
|
13962
|
+
DocumentEvent.invokeEvent('GetTrackTips', element, event, 'Bubbling');
|
13879
13963
|
if (event.trackTips) {
|
13880
13964
|
this.trackTipsChanged.next({ pos: { ...this.currentPos }, tips: event.trackTips });
|
13881
13965
|
this.prevTrackInfo = true;
|
@@ -13927,7 +14011,7 @@ class DocumentEvent {
|
|
13927
14011
|
this.endHitInfo = this.startHitInfo;
|
13928
14012
|
const mousedownEvent = new MousedownElementEvent(this.docCtx);
|
13929
14013
|
mousedownEvent.source = startElement;
|
13930
|
-
DocumentEvent.invokeEvent('ElementMousedown', startElement, mousedownEvent, 'All'
|
14014
|
+
DocumentEvent.invokeEvent('ElementMousedown', startElement, mousedownEvent, 'All');
|
13931
14015
|
}
|
13932
14016
|
else {
|
13933
14017
|
this.clearHitInfo();
|
@@ -14060,7 +14144,7 @@ class DocumentEvent {
|
|
14060
14144
|
//const { render: { renderPosition: { x: rx, y: ry } } } = this.currentMouseoverRender;
|
14061
14145
|
//const rp = this.currentMouseoverRender?.absoluteRenderRect as Rect;
|
14062
14146
|
const rp = ElementUtil.getRenderAbsolutePaintRect(cellRender);
|
14063
|
-
rp.y -= this.viewOptions.pageOffset.y;
|
14147
|
+
//rp.y -= this.viewOptions.pageOffset.y;
|
14064
14148
|
const relativePos = { x: mousePos.x - rp.x, y: mousePos.y - rp.y };
|
14065
14149
|
const isInCellBorder = CommonUtil.isInRectBorder(cellRender.rect, 2, relativePos);
|
14066
14150
|
cursorType = ElementUtil.getBorderCursor(isInCellBorder.borderType);
|
@@ -14177,7 +14261,7 @@ class DocumentEvent {
|
|
14177
14261
|
const startElement = this.startHitInfo.render.element;
|
14178
14262
|
const mousedownEvent = new MousedownElementEvent(this.docCtx);
|
14179
14263
|
mousedownEvent.source = startElement;
|
14180
|
-
DocumentEvent.invokeEvent('ElementClick', startElement, mousedownEvent, "All"
|
14264
|
+
DocumentEvent.invokeEvent('ElementClick', startElement, mousedownEvent, "All");
|
14181
14265
|
//this.refreshDocument();
|
14182
14266
|
}
|
14183
14267
|
const { startControl, startOffset, collapsed } = this.selectionState;
|
@@ -14189,7 +14273,7 @@ class DocumentEvent {
|
|
14189
14273
|
dropEvent.source = startControl;
|
14190
14274
|
dropEvent.sourceOffset = startOffset;
|
14191
14275
|
dropEvent.dragElement = this.focusedElement;
|
14192
|
-
if (DocumentEvent.invokeEvent('ElementDrop', startControl, dropEvent, 'All'
|
14276
|
+
if (DocumentEvent.invokeEvent('ElementDrop', startControl, dropEvent, 'All')) {
|
14193
14277
|
return;
|
14194
14278
|
}
|
14195
14279
|
this.docCtx.docChange.moveElement(startControl, startOffset, this.focusedElement, this.startHitInfo.offset, this.selectionState);
|
@@ -14225,7 +14309,7 @@ class DocumentEvent {
|
|
14225
14309
|
if (hitInfo) {
|
14226
14310
|
docEvent.source = hitInfo.element;
|
14227
14311
|
docEvent.sourceRender = hitInfo.render;
|
14228
|
-
const res = DocumentEvent.invokeEvent('ElementDblClick', hitInfo.element, docEvent, 'All'
|
14312
|
+
const res = DocumentEvent.invokeEvent('ElementDblClick', hitInfo.element, docEvent, 'All');
|
14229
14313
|
if (res) {
|
14230
14314
|
return;
|
14231
14315
|
}
|
@@ -14406,7 +14490,7 @@ class DocumentEvent {
|
|
14406
14490
|
* @param eventStage
|
14407
14491
|
* @param docCtx
|
14408
14492
|
*/
|
14409
|
-
static invokeEvent(type, sourceElement, event, eventStage
|
14493
|
+
static invokeEvent(type, sourceElement, event, eventStage) {
|
14410
14494
|
const parents = ElementUtil.getParentElements(sourceElement);
|
14411
14495
|
//先执行捕获阶段,在执行冒泡
|
14412
14496
|
for (let i = parents.length - 1; i > -parents.length; i--) {
|
@@ -14876,7 +14960,7 @@ class DocumentEvent {
|
|
14876
14960
|
});
|
14877
14961
|
document.execCommand('copy');
|
14878
14962
|
};
|
14879
|
-
if (
|
14963
|
+
if (ElementUtil.getOSPlatform() === 'Mac') {
|
14880
14964
|
if (evt.metaKey && evt.keyCode === 67) {
|
14881
14965
|
copy();
|
14882
14966
|
}
|
@@ -14925,6 +15009,7 @@ class DocumentInput {
|
|
14925
15009
|
onTabKeyEvent = new Subject$1();
|
14926
15010
|
constructor(node, docCtx) {
|
14927
15011
|
this.docCtx = docCtx;
|
15012
|
+
const os = ElementUtil.getOSPlatform();
|
14928
15013
|
node.addEventListener('input', evt => {
|
14929
15014
|
const { startControl, startOffset } = this.docCtx.selectionState;
|
14930
15015
|
this.onInputEvent.next({
|
@@ -14940,7 +15025,7 @@ class DocumentInput {
|
|
14940
15025
|
const evt = nodeEvt.sourceEvt;
|
14941
15026
|
const keyEvent = new KeyboradElementEvent(this.docCtx);
|
14942
15027
|
keyEvent.sourceEvent = evt;
|
14943
|
-
if (DocumentEvent.invokeEvent('ElementKeyDown', this.docCtx.selectionState.startControl, keyEvent, 'Capture'
|
15028
|
+
if (DocumentEvent.invokeEvent('ElementKeyDown', this.docCtx.selectionState.startControl, keyEvent, 'Capture')) {
|
14944
15029
|
return;
|
14945
15030
|
}
|
14946
15031
|
if (evt.keyCode === 8) {
|
@@ -14972,7 +15057,11 @@ class DocumentInput {
|
|
14972
15057
|
else if (evt.keyCode === 46) {
|
14973
15058
|
this.onDeleteEvent.next(evt);
|
14974
15059
|
}
|
14975
|
-
else if (evt.ctrlKey && evt.keyCode === 65) {
|
15060
|
+
else if (evt.ctrlKey && evt.keyCode === 65 && os !== 'Mac') {
|
15061
|
+
evt.preventDefault();
|
15062
|
+
this.onSelectAllEvent.next();
|
15063
|
+
}
|
15064
|
+
else if (evt.metaKey && evt.keyCode === 65 && os === 'Mac') {
|
14976
15065
|
evt.preventDefault();
|
14977
15066
|
this.onSelectAllEvent.next();
|
14978
15067
|
}
|
@@ -15067,7 +15156,13 @@ class DocumentChange {
|
|
15067
15156
|
this.onInputBySelectRange(data);
|
15068
15157
|
return;
|
15069
15158
|
}
|
15070
|
-
|
15159
|
+
const inputEvent = new InputElementEvent(this.docCtx);
|
15160
|
+
inputEvent.data = data.data;
|
15161
|
+
DocumentEvent.invokeEvent('ElementInput', startControl, inputEvent, 'All');
|
15162
|
+
if (inputEvent.isCancel) {
|
15163
|
+
return;
|
15164
|
+
}
|
15165
|
+
//判断是否需要创建新留痕区域
|
15071
15166
|
if (enableTrackChanges && !this.isInCorrectTrackRegion(startControl, TrackRunTypeEnum.Inserted)) {
|
15072
15167
|
this.newInputTrackChanges(data, startControl, startOffset);
|
15073
15168
|
return;
|
@@ -15174,7 +15269,7 @@ class DocumentChange {
|
|
15174
15269
|
}
|
15175
15270
|
}
|
15176
15271
|
/**
|
15177
|
-
*
|
15272
|
+
* 创建新留痕块,并返回留痕块输入定位文本
|
15178
15273
|
* @param startControl
|
15179
15274
|
* @param startOffset
|
15180
15275
|
* @param trackType
|
@@ -15330,7 +15425,7 @@ class DocumentChange {
|
|
15330
15425
|
eventElement.source = startControl;
|
15331
15426
|
eventElement.sourceEvent = evt;
|
15332
15427
|
eventElement.sourceOffset = startOffset;
|
15333
|
-
const res = DocumentEvent.invokeEvent('BackspaceKey', startControl, eventElement, 'Capture'
|
15428
|
+
const res = DocumentEvent.invokeEvent('BackspaceKey', startControl, eventElement, 'Capture');
|
15334
15429
|
if (res && res.isCancel) {
|
15335
15430
|
return;
|
15336
15431
|
}
|
@@ -15353,7 +15448,7 @@ class DocumentChange {
|
|
15353
15448
|
eventElement.source = startControl;
|
15354
15449
|
eventElement.sourceEvent = evt;
|
15355
15450
|
eventElement.sourceOffset = startOffset;
|
15356
|
-
const res = DocumentEvent.invokeEvent('DeleteKey', startControl, eventElement, 'Capture'
|
15451
|
+
const res = DocumentEvent.invokeEvent('DeleteKey', startControl, eventElement, 'Capture');
|
15357
15452
|
if (res && res.isCancel) {
|
15358
15453
|
return;
|
15359
15454
|
}
|
@@ -16112,6 +16207,25 @@ class DocumentChange {
|
|
16112
16207
|
});
|
16113
16208
|
}
|
16114
16209
|
}
|
16210
|
+
static setParaStyle(ss, setterFunc) {
|
16211
|
+
if (ss.collapsed && ss.startControl) {
|
16212
|
+
const para = ElementUtil.getParentByType(ss.startControl, ParagraphElement);
|
16213
|
+
if (para) {
|
16214
|
+
setterFunc(para.props);
|
16215
|
+
}
|
16216
|
+
}
|
16217
|
+
else {
|
16218
|
+
const range = ss.selectedRange;
|
16219
|
+
if (!range) {
|
16220
|
+
return;
|
16221
|
+
}
|
16222
|
+
RangeUtil.recursionTraversalRangeHandler(range, (itemRange) => {
|
16223
|
+
if (itemRange.target instanceof ParagraphElement) {
|
16224
|
+
setterFunc(itemRange.target.props);
|
16225
|
+
}
|
16226
|
+
});
|
16227
|
+
}
|
16228
|
+
}
|
16115
16229
|
/**
|
16116
16230
|
* 复制
|
16117
16231
|
* @param evt
|
@@ -17697,7 +17811,6 @@ function setCurrentActiveAppContext(ctx) {
|
|
17697
17811
|
currentActiveAppContext = ctx;
|
17698
17812
|
}
|
17699
17813
|
function renderApp(root, renderCtx, nodeEvent) {
|
17700
|
-
window['root'] = root;
|
17701
17814
|
// const nodeEvent = new NodeEvent(root, renderCtx.mainContext.ctx.canvas);
|
17702
17815
|
let delayTask = false;
|
17703
17816
|
const flushTask = () => {
|
@@ -17716,8 +17829,10 @@ function renderApp(root, renderCtx, nodeEvent) {
|
|
17716
17829
|
};
|
17717
17830
|
flushTask();
|
17718
17831
|
root.onChangedEvent.subscribe(() => {
|
17832
|
+
if (root.isDisposed) {
|
17833
|
+
return;
|
17834
|
+
}
|
17719
17835
|
flushTask();
|
17720
|
-
//console.log('准备创建任务'+taskId)
|
17721
17836
|
});
|
17722
17837
|
nodeEvent.onSignal.subscribe(() => {
|
17723
17838
|
flushTask();
|
@@ -18982,6 +19097,7 @@ class SurfaceView extends NodeItems {
|
|
18982
19097
|
renderSchedule;
|
18983
19098
|
nodeEvent;
|
18984
19099
|
renderCtx;
|
19100
|
+
isDisposed = false;
|
18985
19101
|
onSizeChanged = new Subject();
|
18986
19102
|
constructor(canvas, input) {
|
18987
19103
|
super();
|
@@ -19064,6 +19180,10 @@ class SurfaceView extends NodeItems {
|
|
19064
19180
|
clearPopNodes() {
|
19065
19181
|
this.popNodes = [];
|
19066
19182
|
}
|
19183
|
+
destroy() {
|
19184
|
+
this.clearChildren();
|
19185
|
+
this.isDisposed = true;
|
19186
|
+
}
|
19067
19187
|
initInputEvent() {
|
19068
19188
|
let composition = false;
|
19069
19189
|
this.input.addEventListener('input', evt => {
|
@@ -20273,131 +20393,1461 @@ function pointInPoly(pt, poly) {
|
|
20273
20393
|
return c;
|
20274
20394
|
}
|
20275
20395
|
|
20276
|
-
|
20277
|
-
|
20278
|
-
|
20279
|
-
|
20280
|
-
|
20281
|
-
|
20282
|
-
|
20283
|
-
|
20284
|
-
|
20285
|
-
|
20286
|
-
|
20287
|
-
|
20288
|
-
|
20289
|
-
|
20290
|
-
|
20291
|
-
|
20292
|
-
|
20293
|
-
|
20294
|
-
|
20295
|
-
|
20296
|
-
|
20297
|
-
|
20298
|
-
|
20299
|
-
|
20300
|
-
|
20301
|
-
|
20302
|
-
|
20303
|
-
|
20304
|
-
|
20305
|
-
|
20306
|
-
|
20307
|
-
|
20308
|
-
|
20309
|
-
|
20310
|
-
|
20311
|
-
|
20396
|
+
const timelineConfig = {
|
20397
|
+
fontSize: 12,
|
20398
|
+
fontName: '宋体',
|
20399
|
+
/**
|
20400
|
+
* 单个时刻的宽度,像素
|
20401
|
+
*/
|
20402
|
+
timeTickWidth: 14,
|
20403
|
+
/**
|
20404
|
+
* 纵轴一个单位的高度
|
20405
|
+
*/
|
20406
|
+
timeValueHeight: 20,
|
20407
|
+
/**
|
20408
|
+
* 单个时刻宽度代表的小时数
|
20409
|
+
*/
|
20410
|
+
timeTickHours: 4,
|
20411
|
+
/**
|
20412
|
+
* 体温点的大小
|
20413
|
+
*/
|
20414
|
+
temperaturePointSize: 4,
|
20415
|
+
/**
|
20416
|
+
* 心率点的大小
|
20417
|
+
*/
|
20418
|
+
heartRatePointSize: 4,
|
20419
|
+
temperatureModels: [42, 41, 40, 39, 38, 37, 36, 35],
|
20420
|
+
heartRateModels: [180, 160, 140, 120, 100, 80, 40, 20],
|
20421
|
+
valueRuleCounts: 8,
|
20422
|
+
/**
|
20423
|
+
* 时刻头部高度
|
20424
|
+
*/
|
20425
|
+
tickHeaderHeight: 20,
|
20426
|
+
/**
|
20427
|
+
* 体温符号
|
20428
|
+
*/
|
20429
|
+
temperatureSymbol: '℃',
|
20430
|
+
heartRateSymbol: 'BPM'
|
20431
|
+
};
|
20432
|
+
class TimelineBaseControl extends AbsolutePanel {
|
20433
|
+
startTime;
|
20434
|
+
showDays = 0;
|
20435
|
+
constructor() {
|
20312
20436
|
super();
|
20313
|
-
this.
|
20314
|
-
this.
|
20315
|
-
this.
|
20316
|
-
|
20317
|
-
|
20318
|
-
this.
|
20319
|
-
|
20320
|
-
|
20321
|
-
|
20322
|
-
|
20323
|
-
this.
|
20324
|
-
|
20325
|
-
|
20326
|
-
this.
|
20327
|
-
|
20328
|
-
|
20329
|
-
|
20330
|
-
|
20331
|
-
|
20332
|
-
|
20333
|
-
|
20334
|
-
|
20335
|
-
|
20336
|
-
|
20337
|
-
|
20338
|
-
|
20339
|
-
|
20340
|
-
|
20341
|
-
|
20342
|
-
|
20343
|
-
|
20344
|
-
|
20345
|
-
this.
|
20346
|
-
this.
|
20347
|
-
|
20348
|
-
|
20349
|
-
this.
|
20350
|
-
|
20351
|
-
|
20352
|
-
this.
|
20353
|
-
|
20354
|
-
|
20355
|
-
|
20356
|
-
|
20357
|
-
|
20358
|
-
|
20359
|
-
|
20360
|
-
|
20361
|
-
|
20362
|
-
|
20363
|
-
|
20364
|
-
this.documentEvent.trackTipsChanged.subscribe(data => {
|
20437
|
+
this.border = 1;
|
20438
|
+
this.borderColor = '#000';
|
20439
|
+
this.bgColor = '#fff';
|
20440
|
+
}
|
20441
|
+
measureOverride(e, availableSize) {
|
20442
|
+
this.build(e);
|
20443
|
+
return super.measureOverride(e, availableSize);
|
20444
|
+
}
|
20445
|
+
isBuild = false;
|
20446
|
+
build(e) {
|
20447
|
+
if (this.isBuild) {
|
20448
|
+
return;
|
20449
|
+
}
|
20450
|
+
this.clearChildren();
|
20451
|
+
this.buildOverride(e);
|
20452
|
+
this.isBuild = true;
|
20453
|
+
}
|
20454
|
+
reBuild() {
|
20455
|
+
this.isBuild = false;
|
20456
|
+
}
|
20457
|
+
buildOverride(e) {
|
20458
|
+
}
|
20459
|
+
}
|
20460
|
+
class TickContainer extends AbsolutePanel {
|
20461
|
+
tickControl;
|
20462
|
+
_startTime;
|
20463
|
+
_showDays = 0;
|
20464
|
+
scrollX = 0;
|
20465
|
+
get startTime() {
|
20466
|
+
return this._startTime;
|
20467
|
+
}
|
20468
|
+
set startTime(value) {
|
20469
|
+
this._startTime = value;
|
20470
|
+
this.tickControl.startTime = value;
|
20471
|
+
}
|
20472
|
+
get showDays() {
|
20473
|
+
return this._showDays;
|
20474
|
+
}
|
20475
|
+
set showDays(value) {
|
20476
|
+
this._showDays = value;
|
20477
|
+
this.tickControl.showDays = value;
|
20478
|
+
}
|
20479
|
+
arrangeOverride(e, finalSize) {
|
20480
|
+
this.controls.filter(item => item !== this.tickControl).forEach(item => {
|
20481
|
+
const itemRect = {
|
20482
|
+
x: item.x,
|
20483
|
+
y: item.y,
|
20484
|
+
width: item.desiredSize.width,
|
20485
|
+
height: item.desiredSize.height
|
20486
|
+
};
|
20487
|
+
item.arrange(e, itemRect);
|
20365
20488
|
});
|
20366
|
-
this.
|
20367
|
-
|
20368
|
-
|
20369
|
-
|
20370
|
-
|
20371
|
-
|
20372
|
-
|
20373
|
-
|
20374
|
-
|
20489
|
+
this.tickControl.arrange(e, { x: this.tickControl.x - this.scrollX,
|
20490
|
+
y: this.tickControl.y,
|
20491
|
+
width: this.tickControl.desiredSize.width,
|
20492
|
+
height: this.tickControl.desiredSize.height });
|
20493
|
+
return finalSize;
|
20494
|
+
}
|
20495
|
+
}
|
20496
|
+
|
20497
|
+
class TemperaturePoint extends NodeCore {
|
20498
|
+
type;
|
20499
|
+
value;
|
20500
|
+
constructor(type = 'axillary', value) {
|
20501
|
+
super();
|
20502
|
+
this.type = type;
|
20503
|
+
this.value = value;
|
20504
|
+
this.bgColor = 'blue';
|
20505
|
+
this.width = timelineConfig.temperaturePointSize;
|
20506
|
+
this.height = timelineConfig.temperaturePointSize;
|
20507
|
+
this.addEventListener('mouseenter', evt => {
|
20508
|
+
this.bgColor = 'red';
|
20509
|
+
const onMouseLeave = () => {
|
20510
|
+
this.bgColor = 'blue';
|
20511
|
+
this.removeEventListener('mouseleave', onMouseLeave);
|
20512
|
+
};
|
20513
|
+
this.addEventListener('mouseleave', onMouseLeave);
|
20375
20514
|
});
|
20376
20515
|
}
|
20377
|
-
|
20378
|
-
|
20379
|
-
|
20380
|
-
|
20381
|
-
|
20382
|
-
|
20383
|
-
|
20384
|
-
docLeft += this.documentPaint.docContainer.rect.x;
|
20516
|
+
renderOutline(renderCtx) {
|
20517
|
+
translate(renderCtx, this.finalRect.x, this.finalRect.y);
|
20518
|
+
translate(renderCtx, this.border + this.padding, this.border + this.padding);
|
20519
|
+
}
|
20520
|
+
render(e) {
|
20521
|
+
if (this.type === 'axillary') {
|
20522
|
+
this.renderAxillary(e);
|
20385
20523
|
}
|
20386
|
-
if (this.
|
20387
|
-
|
20388
|
-
|
20389
|
-
|
20524
|
+
else if (this.type === 'oral') {
|
20525
|
+
this.renderOral(e);
|
20526
|
+
}
|
20527
|
+
else if (this.type === 'anal') {
|
20528
|
+
this.renderAnal(e);
|
20390
20529
|
}
|
20391
|
-
this.rule.setRuleOptions({ width: this.viewOptions.docPageSettings.width, pagePL, pagePR, docLeft });
|
20392
20530
|
}
|
20393
|
-
|
20394
|
-
|
20395
|
-
|
20396
|
-
|
20397
|
-
|
20398
|
-
|
20399
|
-
|
20400
|
-
|
20531
|
+
/**
|
20532
|
+
* 绘制腋下温度 X
|
20533
|
+
* @private
|
20534
|
+
*/
|
20535
|
+
renderAxillary(e) {
|
20536
|
+
const { width, height } = this.finalRect;
|
20537
|
+
const x = 0, y = 0;
|
20538
|
+
e.render.strokeLines([{ x, y }, { x: x + width, y: y + height }], 3, this.bgColor);
|
20539
|
+
e.render.strokeLines([{ x: x + width, y }, { x, y: y + height }], 3, this.bgColor);
|
20540
|
+
}
|
20541
|
+
/**
|
20542
|
+
* 绘制肛下温度 ○
|
20543
|
+
* @private
|
20544
|
+
*/
|
20545
|
+
renderAnal(e) {
|
20546
|
+
const width = this.finalRect.width;
|
20547
|
+
const ctx = e.render.ctx;
|
20548
|
+
ctx.save();
|
20549
|
+
ctx.beginPath();
|
20550
|
+
ctx.strokeStyle = this.bgColor;
|
20551
|
+
ctx.lineWidth = 2;
|
20552
|
+
ctx.arc(width / 2, width / 2, width, 0, 2 * Math.PI);
|
20553
|
+
ctx.stroke();
|
20554
|
+
ctx.restore();
|
20555
|
+
}
|
20556
|
+
/**
|
20557
|
+
* 绘制口腔温度 ●
|
20558
|
+
* @private
|
20559
|
+
*/
|
20560
|
+
renderOral(e) {
|
20561
|
+
const width = this.finalRect.width;
|
20562
|
+
e.render.fillCircular(width / 2, width / 2, width, this.bgColor);
|
20563
|
+
}
|
20564
|
+
}
|
20565
|
+
class HeartRatePoint extends NodeCore {
|
20566
|
+
value;
|
20567
|
+
constructor() {
|
20568
|
+
super();
|
20569
|
+
this.bgColor = 'red';
|
20570
|
+
this.width = timelineConfig.heartRatePointSize * 2;
|
20571
|
+
this.height = timelineConfig.heartRatePointSize * 2;
|
20572
|
+
this.addEventListener('mouseenter', evt => {
|
20573
|
+
this.bgColor = 'green';
|
20574
|
+
const tipLabel = new LabelNode();
|
20575
|
+
tipLabel.text = this.value;
|
20576
|
+
tipLabel.fontSize = timelineConfig.fontSize;
|
20577
|
+
tipLabel.shadowBlur = 5;
|
20578
|
+
tipLabel.shadowColor = '#000';
|
20579
|
+
tipLabel.bgColor = '#fff';
|
20580
|
+
tipLabel.x = this.x;
|
20581
|
+
tipLabel.y = this.y - tipLabel.fontSize - 2;
|
20582
|
+
this.parent?.addChild(tipLabel);
|
20583
|
+
const onMouseLeave = () => {
|
20584
|
+
this.bgColor = 'red';
|
20585
|
+
this.parent?.removeChild(tipLabel);
|
20586
|
+
this.removeEventListener('mouseleave', onMouseLeave);
|
20587
|
+
};
|
20588
|
+
this.addEventListener('mouseleave', onMouseLeave);
|
20589
|
+
});
|
20590
|
+
}
|
20591
|
+
renderOutline(renderCtx) {
|
20592
|
+
translate(renderCtx, this.finalRect.x, this.finalRect.y);
|
20593
|
+
translate(renderCtx, this.border + this.padding, this.border + this.padding);
|
20594
|
+
}
|
20595
|
+
render(e) {
|
20596
|
+
const heartRatePointSize = this.finalRect.width / 2;
|
20597
|
+
e.render.fillCircular(heartRatePointSize, heartRatePointSize, heartRatePointSize, this.bgColor);
|
20598
|
+
}
|
20599
|
+
}
|
20600
|
+
class TimeLinePath extends NodeCore {
|
20601
|
+
startPos;
|
20602
|
+
endPos;
|
20603
|
+
lineColor = '#000';
|
20604
|
+
lineWidth = 1;
|
20605
|
+
constructor() {
|
20606
|
+
super();
|
20607
|
+
this.allowHitTest = true;
|
20608
|
+
this.enableClip = false;
|
20609
|
+
}
|
20610
|
+
renderOutline(renderCtx) {
|
20611
|
+
translate(renderCtx, this.finalRect.x, this.finalRect.y);
|
20612
|
+
translate(renderCtx, this.border + this.padding, this.border + this.padding);
|
20613
|
+
}
|
20614
|
+
render(e) {
|
20615
|
+
e.render.strokeLines([this.startPos, this.endPos], this.lineWidth, this.lineColor);
|
20616
|
+
}
|
20617
|
+
}
|
20618
|
+
|
20619
|
+
class TimelineControl extends AbsolutePanel {
|
20620
|
+
render(e) {
|
20621
|
+
}
|
20622
|
+
constructor() {
|
20623
|
+
super();
|
20624
|
+
this.border = 1;
|
20625
|
+
this.borderColor = '#000';
|
20626
|
+
}
|
20627
|
+
measureOverride(e, availableSize) {
|
20628
|
+
const height = this.controls.reduce((prev, curr) => {
|
20629
|
+
curr.measure(e, availableSize);
|
20630
|
+
return prev + curr.desiredSize.height;
|
20631
|
+
}, 0);
|
20632
|
+
return {
|
20633
|
+
height, width: availableSize.width
|
20634
|
+
};
|
20635
|
+
}
|
20636
|
+
arrangeOverride(e, finalSize) {
|
20637
|
+
this.controls.reduce((prev, curr) => {
|
20638
|
+
const itemRect = {
|
20639
|
+
x: 0,
|
20640
|
+
y: prev,
|
20641
|
+
width: curr.desiredSize.width,
|
20642
|
+
height: curr.desiredSize.height
|
20643
|
+
};
|
20644
|
+
curr.arrange(e, itemRect);
|
20645
|
+
return prev + curr.desiredSize.height;
|
20646
|
+
}, 0);
|
20647
|
+
return finalSize;
|
20648
|
+
}
|
20649
|
+
rebuild() {
|
20650
|
+
treeForEach(this, item => {
|
20651
|
+
if (item instanceof NodeItems) {
|
20652
|
+
return item.controls;
|
20653
|
+
}
|
20654
|
+
else {
|
20655
|
+
return [];
|
20656
|
+
}
|
20657
|
+
}, (item) => {
|
20658
|
+
if (item instanceof TimelineBaseControl) {
|
20659
|
+
item.reBuild();
|
20660
|
+
}
|
20661
|
+
});
|
20662
|
+
}
|
20663
|
+
}
|
20664
|
+
function treeForEach(root, children, callback) {
|
20665
|
+
callback(root);
|
20666
|
+
children(root).forEach(node => {
|
20667
|
+
treeForEach(node, children, callback);
|
20668
|
+
});
|
20669
|
+
}
|
20670
|
+
/**
|
20671
|
+
* 中间网格数据绘制区域
|
20672
|
+
*/
|
20673
|
+
class TimeGridContainer extends AbsolutePanel {
|
20674
|
+
get gridHeight() {
|
20675
|
+
return this._gridHeight;
|
20676
|
+
}
|
20677
|
+
set gridHeight(value) {
|
20678
|
+
this._gridHeight = value;
|
20679
|
+
this.timelineGridControl.height = value;
|
20680
|
+
this.timeValueRuleContainer.height = value;
|
20681
|
+
}
|
20682
|
+
_startTime;
|
20683
|
+
_showDays = 7;
|
20684
|
+
get startTime() {
|
20685
|
+
return this._startTime;
|
20686
|
+
}
|
20687
|
+
set startTime(value) {
|
20688
|
+
this._startTime = value;
|
20689
|
+
this.timelineGridControl.startTime = value;
|
20690
|
+
}
|
20691
|
+
get showDays() {
|
20692
|
+
return this._showDays;
|
20693
|
+
}
|
20694
|
+
set showDays(value) {
|
20695
|
+
this._showDays = value;
|
20696
|
+
this.timelineGridControl.showDays = value;
|
20697
|
+
}
|
20698
|
+
/**
|
20699
|
+
* 网格区域高度
|
20700
|
+
*/
|
20701
|
+
_gridHeight = 0;
|
20702
|
+
scrollX = 0;
|
20703
|
+
timelineGridControl;
|
20704
|
+
timeValueRuleContainer;
|
20705
|
+
constructor() {
|
20706
|
+
super();
|
20707
|
+
this.timelineGridControl = new TimelineGridControl();
|
20708
|
+
this.addChild(this.timelineGridControl);
|
20709
|
+
this.timeValueRuleContainer = new TimeValueRuleContainer();
|
20710
|
+
this.addChild(this.timeValueRuleContainer);
|
20711
|
+
}
|
20712
|
+
init() {
|
20713
|
+
this.timelineGridControl.init();
|
20714
|
+
}
|
20715
|
+
measureOverride(e, availableSize) {
|
20716
|
+
this.timelineGridControl.measure(e, availableSize);
|
20717
|
+
const height = this.timelineGridControl.desiredSize.height;
|
20718
|
+
this.timeValueRuleContainer.measure(e, { height, width: availableSize.width });
|
20719
|
+
return { height, width: availableSize.width };
|
20720
|
+
}
|
20721
|
+
arrangeOverride(e, finalSize) {
|
20722
|
+
this.controls.filter(item => item !== this.timelineGridControl).forEach(item => {
|
20723
|
+
const itemRect = {
|
20724
|
+
x: item.x,
|
20725
|
+
y: item.y,
|
20726
|
+
width: item.desiredSize.width,
|
20727
|
+
height: item.desiredSize.height
|
20728
|
+
};
|
20729
|
+
item.arrange(e, itemRect);
|
20730
|
+
});
|
20731
|
+
this.timelineGridControl.arrange(e, {
|
20732
|
+
x: this.timelineGridControl.x - this.scrollX,
|
20733
|
+
y: this.timelineGridControl.y,
|
20734
|
+
width: this.timelineGridControl.desiredSize.width,
|
20735
|
+
height: this.timelineGridControl.desiredSize.height
|
20736
|
+
});
|
20737
|
+
return finalSize;
|
20738
|
+
}
|
20739
|
+
render(e) {
|
20740
|
+
}
|
20741
|
+
}
|
20742
|
+
class TimeValueRuleContainer extends AbsolutePanel {
|
20743
|
+
getLayoutWidth() {
|
20744
|
+
return this.controls.reduce((prev, curr) => prev + curr.width, 0);
|
20745
|
+
}
|
20746
|
+
init() {
|
20747
|
+
this.controls.reduce((prev, curr) => {
|
20748
|
+
curr.x = prev;
|
20749
|
+
return prev + curr.width;
|
20750
|
+
}, 0);
|
20751
|
+
}
|
20752
|
+
renderOutline(renderCtx) {
|
20753
|
+
translate(renderCtx, this.finalRect.x, this.finalRect.y);
|
20754
|
+
translate(renderCtx, this.border + this.padding, this.border + this.padding);
|
20755
|
+
}
|
20756
|
+
render(e) {
|
20757
|
+
}
|
20758
|
+
}
|
20759
|
+
/**
|
20760
|
+
* 标题区域
|
20761
|
+
* 时间刻度:日期、住院天数、手术天数、时刻
|
20762
|
+
* 数值标尺区域、数据网格区域
|
20763
|
+
* 文本时间轴区域
|
20764
|
+
*/
|
20765
|
+
class TimelineGridControl extends TimelineBaseControl {
|
20766
|
+
get isShowTemperature() {
|
20767
|
+
return this._isShowTemperature;
|
20768
|
+
}
|
20769
|
+
set isShowTemperature(value) {
|
20770
|
+
this.propertyChanged('isShowTemperature', this._isShowTemperature, value);
|
20771
|
+
this._isShowTemperature = value;
|
20772
|
+
}
|
20773
|
+
get isShowHeartRate() {
|
20774
|
+
return this._isShowHeartRate;
|
20775
|
+
}
|
20776
|
+
set isShowHeartRate(value) {
|
20777
|
+
this.propertyChanged('isShowHeartRate', this._isShowHeartRate, value);
|
20778
|
+
this._isShowHeartRate = value;
|
20779
|
+
}
|
20780
|
+
//体温数据
|
20781
|
+
temperatureData = [];
|
20782
|
+
//心率数据
|
20783
|
+
heartRateData = [];
|
20784
|
+
//体温时间轴值模型
|
20785
|
+
temperatureTimeLineValueModel = [];
|
20786
|
+
//心率时间轴值模型
|
20787
|
+
heartRateTimeLineValueModel = [];
|
20788
|
+
//图章数据
|
20789
|
+
eventData = [];
|
20790
|
+
_isShowTemperature = true;
|
20791
|
+
_isShowHeartRate = true;
|
20792
|
+
mousePos = null;
|
20793
|
+
constructor() {
|
20794
|
+
super();
|
20795
|
+
this.startTime = moment$1(moment$1().format("YYYY-MM-DD")).toDate();
|
20796
|
+
this.addEventListener('mousemove', evt => {
|
20797
|
+
const pos = evt.pos;
|
20798
|
+
const nodePos = getNodePosition(this, { x: 0, y: 0 });
|
20799
|
+
this.mousePos = { x: pos.x - nodePos.x, y: pos.y - nodePos.y };
|
20800
|
+
});
|
20801
|
+
this.addEventListener('mouseleave', evt => {
|
20802
|
+
this.mousePos = null;
|
20803
|
+
});
|
20804
|
+
}
|
20805
|
+
randomNum = (start, end) => {
|
20806
|
+
return Math.floor(Math.random() * (end - start) + start);
|
20807
|
+
};
|
20808
|
+
getLayoutWidth() {
|
20809
|
+
return this.showDays * (24 / timelineConfig.timeTickHours) * timelineConfig.timeTickWidth;
|
20810
|
+
}
|
20811
|
+
init() {
|
20812
|
+
this.temperatureTimeLineValueModel = timelineConfig.temperatureModels.map((item, index, arr) => ({
|
20813
|
+
value: item,
|
20814
|
+
offset: (index + 1) / (arr.length + 1)
|
20815
|
+
}));
|
20816
|
+
this.heartRateTimeLineValueModel = timelineConfig.heartRateModels.map((item, index, arr) => ({
|
20817
|
+
value: item,
|
20818
|
+
offset: (index + 1) / (arr.length + 1)
|
20819
|
+
}));
|
20820
|
+
const { timeTickHours } = timelineConfig;
|
20821
|
+
for (let i = 0; i < this.showDays; i++) {
|
20822
|
+
for (let j = 0; j < 24; j += timeTickHours) {
|
20823
|
+
this.temperatureData.push({
|
20824
|
+
date: moment$1(this.startTime).add(i, 'days').add(j, 'hours').toDate(),
|
20825
|
+
value: this.randomNum(33, 43) + this.randomNum(0, 10) / 10
|
20826
|
+
//value: 43
|
20827
|
+
});
|
20828
|
+
this.heartRateData.push({
|
20829
|
+
date: moment$1(this.startTime).add(i, 'days').add(j, 'hours').toDate(),
|
20830
|
+
value: this.randomNum(70, 150)
|
20831
|
+
});
|
20832
|
+
}
|
20833
|
+
this.eventData.push({ date: moment$1(this.startTime).add(i, 'days').toDate(), value: '入\r\n院' });
|
20834
|
+
}
|
20835
|
+
this.temperatureData.sort((prev, curr) => {
|
20836
|
+
return curr.date > prev.date ? 1 : -1;
|
20837
|
+
});
|
20838
|
+
this.heartRateData.sort((prev, curr) => curr.date > prev.date ? 1 : -1);
|
20839
|
+
}
|
20840
|
+
buildOverride(e) {
|
20841
|
+
this.buildTemperature(e);
|
20842
|
+
this.buildHearRate(e);
|
20843
|
+
this.buildStampUnit(e);
|
20844
|
+
const tipLabel = new LabelNode();
|
20845
|
+
tipLabel.text = '外\r\n科\r\n手\r\n术';
|
20846
|
+
tipLabel.borderColor = '#000';
|
20847
|
+
tipLabel.border = 1;
|
20848
|
+
tipLabel.shadowBlur = 5;
|
20849
|
+
tipLabel.shadowColor = 'red';
|
20850
|
+
tipLabel.fontSize = 12;
|
20851
|
+
tipLabel.bgColor = '#fff';
|
20852
|
+
tipLabel.color = 'red';
|
20853
|
+
tipLabel.textWrapping = 'wrap';
|
20854
|
+
//tipLabel.width = 14;
|
20855
|
+
tipLabel.x = 100;
|
20856
|
+
tipLabel.y = 30;
|
20857
|
+
this.addChild(tipLabel);
|
20858
|
+
}
|
20859
|
+
render(e) {
|
20860
|
+
const { timeValueHeight, timeTickHours, timeTickWidth } = timelineConfig;
|
20861
|
+
const ticks = 24 / timeTickHours;
|
20862
|
+
for (let i = 0; i < this.showDays; i++) {
|
20863
|
+
for (let j = 1; j <= ticks; j++) {
|
20864
|
+
const x = i * timeTickWidth * ticks + j * timeTickWidth;
|
20865
|
+
const color = j < ticks ? '#69c0ff' : '#ffadd2';
|
20866
|
+
e.render.strokeLines([{
|
20867
|
+
x,
|
20868
|
+
y: 0
|
20869
|
+
}, { x, y: this.finalRect.height }], 0.5, color);
|
20870
|
+
}
|
20871
|
+
}
|
20872
|
+
for (let i = timeValueHeight; i < this.finalRect.height; i += timeValueHeight) {
|
20873
|
+
e.render.strokeLines([{
|
20874
|
+
x: 0,
|
20875
|
+
y: i
|
20876
|
+
}, { x: this.finalRect.width, y: i }], 0.5, '#69c0ff');
|
20877
|
+
}
|
20878
|
+
this.renderTemperatureGuideLine(e);
|
20879
|
+
if (this.mousePos) {
|
20880
|
+
e.render.strokeLines([{ x: 0, y: this.mousePos.y }, { x: this.finalRect.width, y: this.mousePos.y }]);
|
20881
|
+
e.render.strokeLines([{ x: this.mousePos.x, y: 0 }, { x: this.mousePos.x, y: this.finalRect.height }]);
|
20882
|
+
}
|
20883
|
+
}
|
20884
|
+
renderTemperatureGuideLine(e) {
|
20885
|
+
const timelineValue = this.temperatureTimeLineValueModel.map(item => ({
|
20886
|
+
value: item.value,
|
20887
|
+
offset: this.height * item.offset
|
20888
|
+
}));
|
20889
|
+
//绘制正常36-37度,辅助线
|
20890
|
+
const startPoint = 36.5;
|
20891
|
+
const endPoint = 37.3;
|
20892
|
+
const startFilter = timelineValue.filter(item => item.value >= startPoint);
|
20893
|
+
const endFilter = timelineValue.filter(item => item.value >= endPoint);
|
20894
|
+
let startY = 0;
|
20895
|
+
let endY = 0;
|
20896
|
+
if (startFilter.length > 1) {
|
20897
|
+
const curr = startFilter[startFilter.length - 1];
|
20898
|
+
const next = startFilter[startFilter.length - 2];
|
20899
|
+
startY = curr.offset + (curr.value - startPoint) * (next.offset - curr.offset) / (curr.value - next.value);
|
20900
|
+
}
|
20901
|
+
if (endFilter.length > 1) {
|
20902
|
+
const curr = endFilter[endFilter.length - 1];
|
20903
|
+
const next = endFilter[endFilter.length - 2];
|
20904
|
+
endY = curr.offset + (curr.value - endPoint) * (next.offset - curr.offset) / (curr.value - next.value);
|
20905
|
+
}
|
20906
|
+
e.render.strokeLines([{ x: 0, y: startY }, { x: this.finalRect.width, y: startY }], 1, 'red');
|
20907
|
+
e.render.strokeLines([{ x: 0, y: endY }, { x: this.finalRect.width, y: endY }], 1, 'red');
|
20908
|
+
}
|
20909
|
+
buildTemperature(e) {
|
20910
|
+
if (this.temperatureData.length === 0) {
|
20911
|
+
return;
|
20912
|
+
}
|
20913
|
+
const height = this.height;
|
20914
|
+
const { timeValueHeight, timeTickHours, timeTickWidth, temperaturePointSize } = timelineConfig;
|
20915
|
+
const timelineValue = this.temperatureTimeLineValueModel.map(item => ({
|
20916
|
+
value: item.value,
|
20917
|
+
offset: height * item.offset
|
20918
|
+
}));
|
20919
|
+
//获取体温点纵向坐标
|
20920
|
+
const getTimelineVerValue = (val) => {
|
20921
|
+
const filter = timelineValue.filter(item => item.value >= val);
|
20922
|
+
if (filter.length) {
|
20923
|
+
if (filter.length > 1) {
|
20924
|
+
const curr = filter[filter.length - 1];
|
20925
|
+
const next = filter[filter.length - 2];
|
20926
|
+
return curr.offset + (curr.value - val) * (next.offset - curr.offset) / (curr.value - next.value);
|
20927
|
+
}
|
20928
|
+
else {
|
20929
|
+
return filter[0].offset;
|
20930
|
+
}
|
20931
|
+
}
|
20932
|
+
return -1;
|
20933
|
+
};
|
20934
|
+
let prevPos = null;
|
20935
|
+
for (let i = 0; i < this.showDays; i++) {
|
20936
|
+
const ticks = 24 / timeTickHours;
|
20937
|
+
for (let j = 0; j < ticks; j++) {
|
20938
|
+
const hourOffset = j * timeTickHours;
|
20939
|
+
const x = i * timeTickWidth * ticks + j * timeTickWidth;
|
20940
|
+
const startTime = moment$1(this.startTime).add(i, 'days').add(hourOffset, 'hours');
|
20941
|
+
const endTime = moment$1(this.startTime).add(i, 'days').add(hourOffset + timeTickHours, 'hours');
|
20942
|
+
const predicate = (item) => {
|
20943
|
+
return moment$1(item).isBetween(startTime, endTime, null, '(]');
|
20944
|
+
};
|
20945
|
+
const currTimePoints = this.temperatureData.filter(item => predicate(item.date));
|
20946
|
+
currTimePoints.forEach(item => {
|
20947
|
+
let currX = x;
|
20948
|
+
const diffMinutes = moment$1(item.date).diff(startTime, 'minutes');
|
20949
|
+
const offsetMinutes = diffMinutes * timeTickWidth / (timeTickHours * 60);
|
20950
|
+
currX += offsetMinutes;
|
20951
|
+
let currY = getTimelineVerValue(item.value);
|
20952
|
+
//超出显示范围
|
20953
|
+
if (currY > height) {
|
20954
|
+
currY = height;
|
20955
|
+
this.setExceededValueTip(e, item.value + '℃', currX, currY - 20);
|
20956
|
+
}
|
20957
|
+
if (currY < 0) {
|
20958
|
+
currY = 0;
|
20959
|
+
this.setExceededValueTip(e, item.value + '℃', currX, currY + 5);
|
20960
|
+
}
|
20961
|
+
const point = new TemperaturePoint('axillary', item.value);
|
20962
|
+
point.x = currX - point.width / 2;
|
20963
|
+
point.y = currY - point.width / 2;
|
20964
|
+
this.addChild(point);
|
20965
|
+
if (prevPos) {
|
20966
|
+
const linePath = new TimeLinePath();
|
20967
|
+
linePath.lineColor = 'blue';
|
20968
|
+
linePath.startPos = prevPos;
|
20969
|
+
linePath.endPos = { x: currX, y: currY };
|
20970
|
+
this.addChild(linePath);
|
20971
|
+
}
|
20972
|
+
prevPos = { x: currX, y: currY };
|
20973
|
+
});
|
20974
|
+
}
|
20975
|
+
}
|
20976
|
+
}
|
20977
|
+
setExceededValueTip(e, tip, x, y) {
|
20978
|
+
const tipLabel = new LabelNode();
|
20979
|
+
tipLabel.text = tip;
|
20980
|
+
tipLabel.borderColor = '#000';
|
20981
|
+
tipLabel.border = 1;
|
20982
|
+
tipLabel.shadowBlur = 5;
|
20983
|
+
tipLabel.shadowColor = '#000';
|
20984
|
+
tipLabel.fontSize = 10;
|
20985
|
+
tipLabel.bgColor = '#fff';
|
20986
|
+
const tipLabelWidth = e.render.measureText2(tipLabel.text, tipLabel);
|
20987
|
+
tipLabel.x = x -= tipLabelWidth / 2;
|
20988
|
+
tipLabel.y = y;
|
20989
|
+
this.addChild(tipLabel);
|
20990
|
+
}
|
20991
|
+
buildHearRate(e) {
|
20992
|
+
const height = this.height;
|
20993
|
+
const { timeTickHours, timeTickWidth, heartRateSymbol } = timelineConfig;
|
20994
|
+
const timelineValue = this.heartRateTimeLineValueModel.map(item => ({
|
20995
|
+
value: item.value,
|
20996
|
+
offset: height * item.offset
|
20997
|
+
}));
|
20998
|
+
//获取心率纵向坐标
|
20999
|
+
const getTimelineVerValue = (val) => {
|
21000
|
+
const filter = timelineValue.filter(item => item.value >= val);
|
21001
|
+
if (filter.length) {
|
21002
|
+
if (filter.length > 1) {
|
21003
|
+
const curr = filter[filter.length - 1];
|
21004
|
+
const next = filter[filter.length - 2];
|
21005
|
+
return curr.offset + (curr.value - val) * (next.offset - curr.offset) / (curr.value - next.value);
|
21006
|
+
}
|
21007
|
+
else {
|
21008
|
+
return filter[0].offset;
|
21009
|
+
}
|
21010
|
+
}
|
21011
|
+
return -1;
|
21012
|
+
};
|
21013
|
+
//const getTimelineHorValue=()
|
21014
|
+
let prevPos = null;
|
21015
|
+
for (let i = 0; i < this.showDays; i++) {
|
21016
|
+
const ticks = 24 / timeTickHours;
|
21017
|
+
for (let j = 0; j < ticks; j++) {
|
21018
|
+
const hourOffset = j * timeTickHours;
|
21019
|
+
const x = i * timeTickWidth * ticks + j * timeTickWidth;
|
21020
|
+
const startTime = moment$1(this.startTime).add(i, 'days').add(hourOffset, 'hours');
|
21021
|
+
const endTime = moment$1(this.startTime).add(i, 'days').add(hourOffset + timeTickHours, 'hours');
|
21022
|
+
const predicate = (item) => {
|
21023
|
+
return moment$1(item).isBetween(startTime, endTime, null, '(]');
|
21024
|
+
};
|
21025
|
+
const currTimePoints = this.heartRateData.filter(item => predicate(item.date));
|
21026
|
+
currTimePoints.forEach(item => {
|
21027
|
+
let currX = x;
|
21028
|
+
const diffMinutes = moment$1(item.date).diff(startTime, 'minutes');
|
21029
|
+
const offsetMinutes = diffMinutes * timeTickWidth / (timeTickHours * 60);
|
21030
|
+
currX += offsetMinutes;
|
21031
|
+
let currY = getTimelineVerValue(item.value);
|
21032
|
+
//超出显示范围
|
21033
|
+
if (currY > height) {
|
21034
|
+
currY = height;
|
21035
|
+
this.setExceededValueTip(e, item.value + heartRateSymbol, currX, currY - 20);
|
21036
|
+
}
|
21037
|
+
if (currY < 0) {
|
21038
|
+
currY = 0;
|
21039
|
+
this.setExceededValueTip(e, item.value + heartRateSymbol, currX, currY + 5);
|
21040
|
+
}
|
21041
|
+
const point = new HeartRatePoint();
|
21042
|
+
point.value = item.value + '次/分';
|
21043
|
+
point.x = currX - point.width / 2;
|
21044
|
+
point.y = currY - point.width / 2;
|
21045
|
+
this.addChild(point);
|
21046
|
+
if (prevPos) {
|
21047
|
+
const linePath = new TimeLinePath();
|
21048
|
+
linePath.lineColor = 'red';
|
21049
|
+
linePath.startPos = prevPos;
|
21050
|
+
linePath.endPos = { x: currX, y: currY };
|
21051
|
+
this.addChild(linePath);
|
21052
|
+
}
|
21053
|
+
prevPos = { x: currX, y: currY };
|
21054
|
+
});
|
21055
|
+
}
|
21056
|
+
}
|
21057
|
+
}
|
21058
|
+
buildStampUnit(e) {
|
21059
|
+
if (!this.eventData.length) {
|
21060
|
+
return;
|
21061
|
+
}
|
21062
|
+
const { timeTickHours, timeTickWidth, heartRateSymbol } = timelineConfig;
|
21063
|
+
for (let i = 0; i < this.showDays; i++) {
|
21064
|
+
const ticks = 24 / timeTickHours;
|
21065
|
+
for (let j = 0; j < ticks; j++) {
|
21066
|
+
const hourOffset = j * timeTickHours;
|
21067
|
+
const x = i * timeTickWidth * ticks + j * timeTickWidth;
|
21068
|
+
const startTime = moment$1(this.startTime).add(i, 'days').add(hourOffset, 'hours');
|
21069
|
+
const endTime = moment$1(this.startTime).add(i, 'days').add(hourOffset + timeTickHours, 'hours');
|
21070
|
+
const predicate = (item) => {
|
21071
|
+
return moment$1(item).isBetween(startTime, endTime, null, '(]');
|
21072
|
+
};
|
21073
|
+
const currTimePoints = this.eventData.filter(item => predicate(item.date));
|
21074
|
+
currTimePoints.forEach(item => {
|
21075
|
+
let currX = x;
|
21076
|
+
const diffMinutes = moment$1(item.date).diff(startTime, 'minutes');
|
21077
|
+
const offsetMinutes = diffMinutes * timeTickWidth / (timeTickHours * 60);
|
21078
|
+
currX += offsetMinutes;
|
21079
|
+
const tipLabel = new LabelNode();
|
21080
|
+
tipLabel.text = item.value;
|
21081
|
+
tipLabel.borderColor = '#000';
|
21082
|
+
tipLabel.border = 1;
|
21083
|
+
tipLabel.shadowBlur = 5;
|
21084
|
+
tipLabel.shadowColor = 'red';
|
21085
|
+
tipLabel.fontSize = 12;
|
21086
|
+
tipLabel.bgColor = '#fff';
|
21087
|
+
tipLabel.color = 'red';
|
21088
|
+
tipLabel.textWrapping = 'wrap';
|
21089
|
+
//tipLabel.width = 14;
|
21090
|
+
tipLabel.x = currX;
|
21091
|
+
tipLabel.y = 30;
|
21092
|
+
this.addChild(tipLabel);
|
21093
|
+
});
|
21094
|
+
}
|
21095
|
+
}
|
21096
|
+
}
|
21097
|
+
}
|
21098
|
+
/**
|
21099
|
+
* 心率数值标尺控件
|
21100
|
+
*/
|
21101
|
+
class HeartRateValueRuleControl extends TimelineBaseControl {
|
21102
|
+
constructor() {
|
21103
|
+
super();
|
21104
|
+
this.width = 50;
|
21105
|
+
}
|
21106
|
+
//体温时间轴值模型
|
21107
|
+
heartRateTimeLineValueModel = [];
|
21108
|
+
buildOverride(e) {
|
21109
|
+
const width = this.width;
|
21110
|
+
const height = this.height;
|
21111
|
+
const label = new LabelNode();
|
21112
|
+
label.text = '心率';
|
21113
|
+
label.fontSize = timelineConfig.fontSize;
|
21114
|
+
label.fontName = timelineConfig.fontName;
|
21115
|
+
label.y = 5;
|
21116
|
+
this.addChild(label);
|
21117
|
+
const textProps = new TextProps();
|
21118
|
+
textProps.fontSize = timelineConfig.fontSize;
|
21119
|
+
textProps.fontName = timelineConfig.fontName;
|
21120
|
+
label.x = (width - e.render.measureText(label.text, textProps).width) / 2;
|
21121
|
+
const timelineValue = this.heartRateTimeLineValueModel.map(item => ({
|
21122
|
+
value: item.value,
|
21123
|
+
offset: (height) * item.offset
|
21124
|
+
}));
|
21125
|
+
timelineValue.forEach(item => {
|
21126
|
+
const valueLabel = new LabelNode();
|
21127
|
+
valueLabel.fontName = timelineConfig.fontName;
|
21128
|
+
valueLabel.fontSize = timelineConfig.fontSize;
|
21129
|
+
valueLabel.text = item.value + '';
|
21130
|
+
valueLabel.x = (width - e.render.measureText(valueLabel.text, textProps).width) / 2;
|
21131
|
+
valueLabel.y = item.offset;
|
21132
|
+
this.addChild(valueLabel);
|
21133
|
+
});
|
21134
|
+
}
|
21135
|
+
render(e) {
|
21136
|
+
}
|
21137
|
+
}
|
21138
|
+
/**
|
21139
|
+
* 体温数值标尺控件
|
21140
|
+
*/
|
21141
|
+
class TemperatureValueRuleControl extends TimelineBaseControl {
|
21142
|
+
constructor() {
|
21143
|
+
super();
|
21144
|
+
this.width = 50;
|
21145
|
+
}
|
21146
|
+
//体温时间轴值模型
|
21147
|
+
temperatureTimeLineValueModel = [];
|
21148
|
+
buildOverride(e) {
|
21149
|
+
const width = this.width;
|
21150
|
+
const height = this.height;
|
21151
|
+
const label = new LabelNode();
|
21152
|
+
label.text = '体温';
|
21153
|
+
label.fontSize = timelineConfig.fontSize;
|
21154
|
+
label.fontName = timelineConfig.fontName;
|
21155
|
+
label.y = 5;
|
21156
|
+
this.addChild(label);
|
21157
|
+
label.x = (width - e.render.measureText2(label.text, label)) / 2;
|
21158
|
+
const timelineValue = this.temperatureTimeLineValueModel.map(item => ({
|
21159
|
+
value: item.value,
|
21160
|
+
offset: (height) * item.offset
|
21161
|
+
}));
|
21162
|
+
timelineValue.forEach(item => {
|
21163
|
+
const valueLabel = new LabelNode();
|
21164
|
+
valueLabel.fontName = timelineConfig.fontName;
|
21165
|
+
valueLabel.fontSize = timelineConfig.fontSize;
|
21166
|
+
valueLabel.text = item.value + '';
|
21167
|
+
valueLabel.x = (width - e.render.measureText2(valueLabel.text, valueLabel)) / 2;
|
21168
|
+
valueLabel.y = item.offset;
|
21169
|
+
this.addChild(valueLabel);
|
21170
|
+
});
|
21171
|
+
}
|
21172
|
+
render(e) {
|
21173
|
+
}
|
21174
|
+
}
|
21175
|
+
|
21176
|
+
/**
|
21177
|
+
* 事件轴标题
|
21178
|
+
* 日期、手术天数、术后天数、时刻
|
21179
|
+
*/
|
21180
|
+
class TimeTickTitleControl extends TimelineBaseControl {
|
21181
|
+
constructor() {
|
21182
|
+
super();
|
21183
|
+
this.bgColor = '#fff';
|
21184
|
+
}
|
21185
|
+
title;
|
21186
|
+
render(e) {
|
21187
|
+
}
|
21188
|
+
buildOverride(e) {
|
21189
|
+
const width = this.width;
|
21190
|
+
const height = this.height;
|
21191
|
+
const label = new LabelNode();
|
21192
|
+
label.text = this.title;
|
21193
|
+
label.fontSize = timelineConfig.fontSize;
|
21194
|
+
label.fontName = timelineConfig.fontName;
|
21195
|
+
const titleWidth = e.render.measureText2(label.text, label);
|
21196
|
+
label.x = (width - titleWidth) / 2;
|
21197
|
+
label.y = (height - label.fontSize) / 2;
|
21198
|
+
this.addChild(label);
|
21199
|
+
}
|
21200
|
+
}
|
21201
|
+
/**
|
21202
|
+
* 文本状态时刻控件,用于显示状态文本,例如:小便等
|
21203
|
+
*/
|
21204
|
+
class TextStatusTickControl extends TimelineBaseControl {
|
21205
|
+
render(e) {
|
21206
|
+
}
|
21207
|
+
buildOverride(e) {
|
21208
|
+
const { timeTickHours, timeTickWidth } = timelineConfig;
|
21209
|
+
const height = this.height;
|
21210
|
+
const ticks = 24 / timeTickHours;
|
21211
|
+
for (let i = 0; i < this.showDays; i++) {
|
21212
|
+
const width = ticks * timeTickWidth;
|
21213
|
+
// const curr = moment(this.startTime).add(i, 'days').format('YYYY-MM-DD');
|
21214
|
+
//
|
21215
|
+
// const label = new LabelNode();
|
21216
|
+
// label.text = curr + '';
|
21217
|
+
// label.fontSize = timelineConfig.fontSize;
|
21218
|
+
// label.fontName = timelineConfig.fontName;
|
21219
|
+
//
|
21220
|
+
// const dateTitleWidth = e.render.measureText2(curr + '', label);
|
21221
|
+
//
|
21222
|
+
// label.x = i * width + (width - dateTitleWidth) / 2;
|
21223
|
+
// label.y = (height - label.fontSize) / 2;
|
21224
|
+
// this.addChild(label);
|
21225
|
+
const path = new TimeLinePath();
|
21226
|
+
path.startPos = { x: i * width, y: 0 };
|
21227
|
+
path.endPos = { x: i * width, y: height };
|
21228
|
+
path.lineColor = '#ffadd2';
|
21229
|
+
this.addChild(path);
|
21230
|
+
}
|
21231
|
+
}
|
21232
|
+
}
|
21233
|
+
/**
|
21234
|
+
* 呼吸状态容器
|
21235
|
+
*/
|
21236
|
+
class TimelineHXStatusContainer extends TickContainer {
|
21237
|
+
tickTitleControl;
|
21238
|
+
constructor() {
|
21239
|
+
super();
|
21240
|
+
this.tickTitleControl = new TimeTickTitleControl();
|
21241
|
+
this.tickTitleControl.title = '呼吸';
|
21242
|
+
this.tickTitleControl.height = timelineConfig.tickHeaderHeight;
|
21243
|
+
this.tickControl = new TextStatusTickControl();
|
21244
|
+
this.tickControl.height = timelineConfig.tickHeaderHeight;
|
21245
|
+
this.addChild(this.tickControl);
|
21246
|
+
this.addChild(this.tickTitleControl);
|
21247
|
+
this.height = timelineConfig.tickHeaderHeight;
|
21248
|
+
}
|
21249
|
+
/**
|
21250
|
+
* 设置标题和刻度宽度
|
21251
|
+
* @param titleWidth
|
21252
|
+
* @param tickWidth
|
21253
|
+
*/
|
21254
|
+
setLayout(titleWidth, tickWidth) {
|
21255
|
+
this.width = tickWidth + titleWidth;
|
21256
|
+
this.tickTitleControl.width = titleWidth;
|
21257
|
+
this.tickControl.width = tickWidth;
|
21258
|
+
this.tickControl.x = titleWidth;
|
21259
|
+
}
|
21260
|
+
render(e) {
|
21261
|
+
}
|
21262
|
+
}
|
21263
|
+
/**
|
21264
|
+
* 小便状态容器
|
21265
|
+
*/
|
21266
|
+
class TimelineXBStatusContainer extends TickContainer {
|
21267
|
+
//statusControl: TextStatusTickControl;
|
21268
|
+
tickTitleControl;
|
21269
|
+
constructor() {
|
21270
|
+
super();
|
21271
|
+
this.tickTitleControl = new TimeTickTitleControl();
|
21272
|
+
this.tickTitleControl.title = '小便 ml';
|
21273
|
+
this.tickTitleControl.height = timelineConfig.tickHeaderHeight;
|
21274
|
+
this.tickControl = new TextStatusTickControl();
|
21275
|
+
this.tickControl.height = timelineConfig.tickHeaderHeight;
|
21276
|
+
this.addChild(this.tickControl);
|
21277
|
+
this.addChild(this.tickTitleControl);
|
21278
|
+
this.height = timelineConfig.tickHeaderHeight;
|
21279
|
+
}
|
21280
|
+
/**
|
21281
|
+
* 设置标题和刻度宽度
|
21282
|
+
* @param titleWidth
|
21283
|
+
* @param tickWidth
|
21284
|
+
*/
|
21285
|
+
setLayout(titleWidth, tickWidth) {
|
21286
|
+
this.width = tickWidth + titleWidth;
|
21287
|
+
this.tickTitleControl.width = titleWidth;
|
21288
|
+
this.tickControl.width = tickWidth;
|
21289
|
+
this.tickControl.x = titleWidth;
|
21290
|
+
}
|
21291
|
+
render(e) {
|
21292
|
+
}
|
21293
|
+
}
|
21294
|
+
/**
|
21295
|
+
* 其他状态容器
|
21296
|
+
*/
|
21297
|
+
class TimelineOtherStatusContainer extends TickContainer {
|
21298
|
+
//statusControl: TextStatusTickControl;
|
21299
|
+
tickTitleControl;
|
21300
|
+
constructor() {
|
21301
|
+
super();
|
21302
|
+
this.tickTitleControl = new TimeTickTitleControl();
|
21303
|
+
this.tickTitleControl.title = '其他';
|
21304
|
+
this.tickTitleControl.height = timelineConfig.tickHeaderHeight;
|
21305
|
+
this.tickControl = new TextStatusTickControl();
|
21306
|
+
this.tickControl.height = timelineConfig.tickHeaderHeight;
|
21307
|
+
this.addChild(this.tickControl);
|
21308
|
+
this.addChild(this.tickTitleControl);
|
21309
|
+
this.height = timelineConfig.tickHeaderHeight;
|
21310
|
+
}
|
21311
|
+
/**
|
21312
|
+
* 设置标题和刻度宽度
|
21313
|
+
* @param titleWidth
|
21314
|
+
* @param tickWidth
|
21315
|
+
*/
|
21316
|
+
setLayout(titleWidth, tickWidth) {
|
21317
|
+
this.width = tickWidth + titleWidth;
|
21318
|
+
this.tickTitleControl.width = titleWidth;
|
21319
|
+
this.tickControl.width = tickWidth;
|
21320
|
+
this.tickControl.x = titleWidth;
|
21321
|
+
}
|
21322
|
+
render(e) {
|
21323
|
+
}
|
21324
|
+
}
|
21325
|
+
|
21326
|
+
/**
|
21327
|
+
* 时间刻度区域
|
21328
|
+
* 循环日期显示
|
21329
|
+
* 住院天数
|
21330
|
+
* 术后天数
|
21331
|
+
* 时刻等
|
21332
|
+
*/
|
21333
|
+
/**
|
21334
|
+
* 日期时刻容器
|
21335
|
+
*/
|
21336
|
+
class DateTickContainer extends TickContainer {
|
21337
|
+
tickTitleControl;
|
21338
|
+
constructor() {
|
21339
|
+
super();
|
21340
|
+
this.tickTitleControl = new TimeTickTitleControl();
|
21341
|
+
this.tickTitleControl.title = '日期';
|
21342
|
+
this.tickTitleControl.height = timelineConfig.tickHeaderHeight;
|
21343
|
+
this.tickControl = new DateTickControl();
|
21344
|
+
this.tickControl.height = timelineConfig.tickHeaderHeight;
|
21345
|
+
this.addChild(this.tickControl);
|
21346
|
+
this.addChild(this.tickTitleControl);
|
21347
|
+
this.height = timelineConfig.tickHeaderHeight;
|
21348
|
+
}
|
21349
|
+
/**
|
21350
|
+
* 设置标题和刻度宽度
|
21351
|
+
* @param titleWidth
|
21352
|
+
* @param tickWidth
|
21353
|
+
*/
|
21354
|
+
setLayout(titleWidth, tickWidth) {
|
21355
|
+
this.width = tickWidth + titleWidth;
|
21356
|
+
this.tickTitleControl.width = titleWidth;
|
21357
|
+
this.tickControl.width = tickWidth;
|
21358
|
+
this.tickControl.x = titleWidth;
|
21359
|
+
}
|
21360
|
+
render(e) {
|
21361
|
+
}
|
21362
|
+
}
|
21363
|
+
/**
|
21364
|
+
* 日期刻度
|
21365
|
+
*/
|
21366
|
+
class DateTickControl extends TimelineBaseControl {
|
21367
|
+
buildOverride(e) {
|
21368
|
+
const { timeTickHours, timeTickWidth } = timelineConfig;
|
21369
|
+
const height = this.height;
|
21370
|
+
const ticks = 24 / timeTickHours;
|
21371
|
+
for (let i = 0; i < this.showDays; i++) {
|
21372
|
+
const width = ticks * timeTickWidth;
|
21373
|
+
const curr = moment$1(this.startTime).add(i, 'days').format('YYYY-MM-DD');
|
21374
|
+
const label = new LabelNode();
|
21375
|
+
label.text = curr + '';
|
21376
|
+
label.fontSize = timelineConfig.fontSize;
|
21377
|
+
label.fontName = timelineConfig.fontName;
|
21378
|
+
const dateTitleWidth = e.render.measureText2(curr + '', label);
|
21379
|
+
label.x = i * width + (width - dateTitleWidth) / 2;
|
21380
|
+
label.y = (height - label.fontSize) / 2;
|
21381
|
+
this.addChild(label);
|
21382
|
+
const path = new TimeLinePath();
|
21383
|
+
path.startPos = { x: i * width, y: 0 };
|
21384
|
+
path.endPos = { x: i * width, y: height };
|
21385
|
+
path.lineColor = '#ffadd2';
|
21386
|
+
this.addChild(path);
|
21387
|
+
}
|
21388
|
+
}
|
21389
|
+
render(e) {
|
21390
|
+
}
|
21391
|
+
}
|
21392
|
+
class TimeTickContainer extends TickContainer {
|
21393
|
+
tickTitleControl;
|
21394
|
+
constructor() {
|
21395
|
+
super();
|
21396
|
+
this.tickTitleControl = new TimeTickTitleControl();
|
21397
|
+
this.tickTitleControl.title = '时刻';
|
21398
|
+
this.tickTitleControl.height = timelineConfig.tickHeaderHeight;
|
21399
|
+
this.tickControl = new TimeTickControl();
|
21400
|
+
this.tickControl.height = timelineConfig.tickHeaderHeight;
|
21401
|
+
this.addChild(this.tickControl);
|
21402
|
+
this.addChild(this.tickTitleControl);
|
21403
|
+
this.height = timelineConfig.tickHeaderHeight;
|
21404
|
+
}
|
21405
|
+
/**
|
21406
|
+
* 设置标题和刻度宽度
|
21407
|
+
* @param titleWidth
|
21408
|
+
* @param tickWidth
|
21409
|
+
*/
|
21410
|
+
setLayout(titleWidth, tickWidth) {
|
21411
|
+
this.width = tickWidth + titleWidth;
|
21412
|
+
this.tickTitleControl.width = titleWidth;
|
21413
|
+
this.tickControl.width = tickWidth;
|
21414
|
+
this.tickControl.x = titleWidth;
|
21415
|
+
}
|
21416
|
+
render(e) {
|
21417
|
+
}
|
21418
|
+
}
|
21419
|
+
class TimeTickControl extends TimelineBaseControl {
|
21420
|
+
constructor() {
|
21421
|
+
super();
|
21422
|
+
this.border = 1;
|
21423
|
+
this.borderColor = '#000';
|
21424
|
+
}
|
21425
|
+
showDays = 7;
|
21426
|
+
buildOverride(e) {
|
21427
|
+
const { timeTickHours, timeTickWidth } = timelineConfig;
|
21428
|
+
const ticks = 24 / timeTickHours;
|
21429
|
+
for (let i = 0; i < this.showDays; i++) {
|
21430
|
+
for (let j = 1; j <= ticks; j++) {
|
21431
|
+
const hourOffset = j * timeTickHours;
|
21432
|
+
const x = i * timeTickWidth * ticks + j * timeTickWidth;
|
21433
|
+
const text = hourOffset + '';
|
21434
|
+
const label = new LabelNode();
|
21435
|
+
label.text = text;
|
21436
|
+
label.fontSize = timelineConfig.fontSize;
|
21437
|
+
label.fontName = timelineConfig.fontName;
|
21438
|
+
const dateTitleWidth = e.render.measureText2(text, label);
|
21439
|
+
label.x = x - timeTickWidth + (timeTickWidth - dateTitleWidth) / 2;
|
21440
|
+
label.y = 0;
|
21441
|
+
this.addChild(label);
|
21442
|
+
}
|
21443
|
+
}
|
21444
|
+
}
|
21445
|
+
render(e) {
|
21446
|
+
const { timeTickHours, timeTickWidth } = timelineConfig;
|
21447
|
+
const ticks = 24 / timeTickHours;
|
21448
|
+
for (let i = 0; i < this.showDays; i++) {
|
21449
|
+
for (let j = 1; j <= ticks; j++) {
|
21450
|
+
const x = i * timeTickWidth * ticks + j * timeTickWidth;
|
21451
|
+
const color = j < ticks ? '#69c0ff' : '#ffadd2';
|
21452
|
+
e.render.strokeLines([{
|
21453
|
+
x,
|
21454
|
+
y: 0
|
21455
|
+
}, { x, y: this.finalRect.height }], 1, color);
|
21456
|
+
}
|
21457
|
+
}
|
21458
|
+
}
|
21459
|
+
}
|
21460
|
+
class InPatDaysTickContainer extends TickContainer {
|
21461
|
+
//inPatDaysControl: InPatDaysControl;
|
21462
|
+
tickTitleControl;
|
21463
|
+
constructor() {
|
21464
|
+
super();
|
21465
|
+
this.tickTitleControl = new TimeTickTitleControl();
|
21466
|
+
this.tickTitleControl.title = '住院天数';
|
21467
|
+
this.tickTitleControl.height = timelineConfig.tickHeaderHeight;
|
21468
|
+
this.tickControl = new InPatDaysControl();
|
21469
|
+
this.tickControl.height = timelineConfig.tickHeaderHeight;
|
21470
|
+
this.addChild(this.tickControl);
|
21471
|
+
this.addChild(this.tickTitleControl);
|
21472
|
+
this.height = timelineConfig.tickHeaderHeight;
|
21473
|
+
}
|
21474
|
+
/**
|
21475
|
+
* 设置标题和刻度宽度
|
21476
|
+
* @param titleWidth
|
21477
|
+
* @param tickWidth
|
21478
|
+
*/
|
21479
|
+
setLayout(titleWidth, tickWidth) {
|
21480
|
+
this.width = tickWidth + titleWidth;
|
21481
|
+
this.tickTitleControl.width = titleWidth;
|
21482
|
+
this.tickControl.width = tickWidth;
|
21483
|
+
this.tickControl.x = titleWidth;
|
21484
|
+
}
|
21485
|
+
render(e) {
|
21486
|
+
}
|
21487
|
+
}
|
21488
|
+
class InPatDaysControl extends TimelineBaseControl {
|
21489
|
+
buildOverride(e) {
|
21490
|
+
const { timeTickHours, timeTickWidth } = timelineConfig;
|
21491
|
+
const height = this.height;
|
21492
|
+
const ticks = 24 / timeTickHours;
|
21493
|
+
for (let i = 0; i < this.showDays; i++) {
|
21494
|
+
const width = ticks * timeTickWidth;
|
21495
|
+
const text = (i + 1) + '';
|
21496
|
+
const label = new LabelNode();
|
21497
|
+
label.text = text;
|
21498
|
+
label.fontSize = timelineConfig.fontSize;
|
21499
|
+
label.fontName = timelineConfig.fontName;
|
21500
|
+
const dateTitleWidth = e.render.measureText2(text, label);
|
21501
|
+
label.x = i * width + (width - dateTitleWidth + label.fontSize) / 2;
|
21502
|
+
label.y = (height - label.fontSize) / 2;
|
21503
|
+
this.addChild(label);
|
21504
|
+
const path = new TimeLinePath();
|
21505
|
+
path.startPos = { x: i * width, y: 0 };
|
21506
|
+
path.endPos = { x: i * width, y: height };
|
21507
|
+
path.lineColor = '#ffadd2';
|
21508
|
+
this.addChild(path);
|
21509
|
+
}
|
21510
|
+
}
|
21511
|
+
render(e) {
|
21512
|
+
}
|
21513
|
+
}
|
21514
|
+
|
21515
|
+
class TimelineScrollBar extends NodeItems {
|
21516
|
+
//滚动条方向
|
21517
|
+
orientation = 'horizontal';
|
21518
|
+
thumb;
|
21519
|
+
thumbSize = 10;
|
21520
|
+
//按照百分比计算
|
21521
|
+
scrollChanged = new Subject();
|
21522
|
+
//总滚动宽度
|
21523
|
+
scrollSize = 0;
|
21524
|
+
//显示区域宽度
|
21525
|
+
viewSize = 0;
|
21526
|
+
scrollX = 0;
|
21527
|
+
scrollY = 0;
|
21528
|
+
constructor(orientation) {
|
21529
|
+
super();
|
21530
|
+
this.bgColor = '#fff';
|
21531
|
+
this.border = 1;
|
21532
|
+
this.borderColor = '#000';
|
21533
|
+
this.height = 16;
|
21534
|
+
this.orientation = orientation;
|
21535
|
+
this.thumb = new ScrollThumb();
|
21536
|
+
this.addChild(this.thumb);
|
21537
|
+
this.thumb.addEventListener('mousedown', evt => {
|
21538
|
+
const pos = { ...evt.pos };
|
21539
|
+
const { x, y } = this.thumb.finalRect;
|
21540
|
+
const mouseMoveListener = (evt2) => {
|
21541
|
+
//const scrollView = this.parent as ScrollView;
|
21542
|
+
const pos2 = evt2.pos;
|
21543
|
+
let moveX = pos2.x - pos.x;
|
21544
|
+
let moveY = pos2.y - pos.y;
|
21545
|
+
moveX += x;
|
21546
|
+
moveY += y;
|
21547
|
+
moveX = (moveX / this.finalRect.width) * this.scrollSize;
|
21548
|
+
moveY = (moveY / this.finalRect.height) * this.scrollSize;
|
21549
|
+
this.updateScroll(moveX, moveY);
|
21550
|
+
};
|
21551
|
+
const mouseUpListener = (evt3) => {
|
21552
|
+
this.thumb.removeEventListener('mousemove', mouseMoveListener);
|
21553
|
+
this.thumb.removeEventListener('mouseup', mouseUpListener);
|
21554
|
+
};
|
21555
|
+
this.thumb.addEventListener('mousemove', mouseMoveListener);
|
21556
|
+
this.thumb.addEventListener('mouseup', mouseUpListener);
|
21557
|
+
});
|
21558
|
+
}
|
21559
|
+
updateScroll(x, y) {
|
21560
|
+
//const scrollView = this.parent as ScrollView;
|
21561
|
+
if (this.orientation === 'horizontal') {
|
21562
|
+
if (this.finalRect.height === 0) {
|
21563
|
+
return;
|
21564
|
+
}
|
21565
|
+
if (x + this.viewSize > this.scrollSize) {
|
21566
|
+
x = this.scrollSize - this.viewSize;
|
21567
|
+
}
|
21568
|
+
x = x < 0 ? 0 : x;
|
21569
|
+
this.scrollChanged.next(x);
|
21570
|
+
this.scrollX = x;
|
21571
|
+
}
|
21572
|
+
}
|
21573
|
+
updateScrollByCurrent(increaseX, increaseY) {
|
21574
|
+
//const scrollView = this.parent as ScrollView;
|
21575
|
+
increaseX += this.scrollX;
|
21576
|
+
increaseY += this.scrollY;
|
21577
|
+
this.updateScroll(increaseX, increaseY);
|
21578
|
+
}
|
21579
|
+
measureOverride(e, availableSize) {
|
21580
|
+
if (this.orientation === 'horizontal') {
|
21581
|
+
return this.measureHorizontalBar(e, availableSize);
|
21582
|
+
}
|
21583
|
+
else {
|
21584
|
+
//return this.measureVerticalBar(e, availableSize);
|
21585
|
+
throw new Error('未实现');
|
21586
|
+
}
|
21587
|
+
}
|
21588
|
+
/**
|
21589
|
+
* 横向滚动条测量
|
21590
|
+
*/
|
21591
|
+
measureHorizontalBar(e, availableSize) {
|
21592
|
+
if (this.scrollSize > this.viewSize) {
|
21593
|
+
//计算滚动按钮的长度
|
21594
|
+
const thumbWidth = (this.viewSize / this.scrollSize) * availableSize.width;
|
21595
|
+
this.thumb.measure(e, { width: thumbWidth, height: this.thumbSize });
|
21596
|
+
return { width: availableSize.width, height: ScrollBarSize };
|
21597
|
+
}
|
21598
|
+
else {
|
21599
|
+
this.thumb.measure(e, { width: 0, height: 0 });
|
21600
|
+
return { width: 0, height: 0 };
|
21601
|
+
}
|
21602
|
+
}
|
21603
|
+
arrangeOverride(e, finalSize) {
|
21604
|
+
//const scrollView = this.parent as ScrollView;
|
21605
|
+
const { width, height } = this.thumb.desiredSize;
|
21606
|
+
const x = this.orientation === 'horizontal' ? (this.scrollX / this.scrollSize) * finalSize.width : (ScrollBarSize - this.thumbSize) / 2;
|
21607
|
+
const y = this.orientation === 'horizontal' ? (ScrollBarSize - this.thumbSize) / 2 : (this.scrollY / this.scrollSize) * finalSize.height;
|
21608
|
+
this.thumb.arrange(e, { x, y, width, height });
|
21609
|
+
return super.arrangeOverride(e, finalSize);
|
21610
|
+
}
|
21611
|
+
render(e) {
|
21612
|
+
//e.render.contentContext.clearRect(0,0,this.finalRect.width,this.finalRect.height);
|
21613
|
+
//e.render.fillRect(0, 0, this.finalRect.width, this.finalRect.height, 'red')
|
21614
|
+
}
|
21615
|
+
}
|
21616
|
+
|
21617
|
+
function createTimeline() {
|
21618
|
+
const timeline = new TimelineControl();
|
21619
|
+
timeline.width = 940;
|
21620
|
+
const timeGridContainer = new TimeGridContainer();
|
21621
|
+
//timeGridContainer.y = 80;
|
21622
|
+
const timelineGridControl = timeGridContainer.timelineGridControl; //new TimeLineControl();
|
21623
|
+
timelineGridControl.showDays = 30;
|
21624
|
+
timelineGridControl.width = timelineGridControl.getLayoutWidth();
|
21625
|
+
timelineGridControl.height = 300;
|
21626
|
+
timelineGridControl.init();
|
21627
|
+
const tempValueRule = new TemperatureValueRuleControl();
|
21628
|
+
tempValueRule.temperatureTimeLineValueModel = timelineGridControl.temperatureTimeLineValueModel;
|
21629
|
+
tempValueRule.bgColor = '#fff';
|
21630
|
+
tempValueRule.height = timelineGridControl.height;
|
21631
|
+
timeGridContainer.timeValueRuleContainer.addChild(tempValueRule);
|
21632
|
+
tempValueRule.addEventListener('mouseenter', evt => {
|
21633
|
+
tempValueRule.bgColor = 'grey';
|
21634
|
+
const mousemoveHandler = () => {
|
21635
|
+
tempValueRule.bgColor = '#fff';
|
21636
|
+
tempValueRule.removeEventListener('mouseleave', mousemoveHandler);
|
21637
|
+
};
|
21638
|
+
tempValueRule.addEventListener('mouseleave', mousemoveHandler);
|
21639
|
+
});
|
21640
|
+
const heartRateValueRule = new HeartRateValueRuleControl();
|
21641
|
+
heartRateValueRule.heartRateTimeLineValueModel = timelineGridControl.heartRateTimeLineValueModel;
|
21642
|
+
heartRateValueRule.bgColor = '#fff';
|
21643
|
+
heartRateValueRule.height = timelineGridControl.height;
|
21644
|
+
timeGridContainer.timeValueRuleContainer.addChild(heartRateValueRule);
|
21645
|
+
heartRateValueRule.addEventListener('mouseenter', evt => {
|
21646
|
+
heartRateValueRule.bgColor = 'grey';
|
21647
|
+
const mousemoveHandler = () => {
|
21648
|
+
heartRateValueRule.bgColor = '#fff';
|
21649
|
+
heartRateValueRule.removeEventListener('mouseleave', mousemoveHandler);
|
21650
|
+
};
|
21651
|
+
heartRateValueRule.addEventListener('mouseleave', mousemoveHandler);
|
21652
|
+
});
|
21653
|
+
timeGridContainer.timeValueRuleContainer.init();
|
21654
|
+
const titleWidth = timeGridContainer.timeValueRuleContainer.getLayoutWidth();
|
21655
|
+
timeGridContainer.timeValueRuleContainer.width = titleWidth;
|
21656
|
+
timeGridContainer.timeValueRuleContainer.height = timelineGridControl.height;
|
21657
|
+
timeGridContainer.timelineGridControl.x = timeGridContainer.timeValueRuleContainer.width;
|
21658
|
+
const dateHeader = new DateTickContainer();
|
21659
|
+
dateHeader.showDays = timelineGridControl.showDays;
|
21660
|
+
dateHeader.setLayout(titleWidth, timelineGridControl.width);
|
21661
|
+
timeline.addChild(dateHeader);
|
21662
|
+
const inDaysHeader = new InPatDaysTickContainer();
|
21663
|
+
inDaysHeader.showDays = timelineGridControl.showDays;
|
21664
|
+
inDaysHeader.setLayout(titleWidth, timelineGridControl.width);
|
21665
|
+
timeline.addChild(inDaysHeader);
|
21666
|
+
const timeHeader = new TimeTickContainer();
|
21667
|
+
timeHeader.showDays = timelineGridControl.showDays;
|
21668
|
+
timeHeader.setLayout(titleWidth, timelineGridControl.width);
|
21669
|
+
timeline.addChild(timeHeader);
|
21670
|
+
timeline.addChild(timeGridContainer);
|
21671
|
+
const hxStatus = new TimelineHXStatusContainer();
|
21672
|
+
hxStatus.showDays = timelineGridControl.showDays;
|
21673
|
+
hxStatus.setLayout(titleWidth, timelineGridControl.width);
|
21674
|
+
timeline.addChild(hxStatus);
|
21675
|
+
const xbStatus = new TimelineXBStatusContainer();
|
21676
|
+
xbStatus.showDays = timelineGridControl.showDays;
|
21677
|
+
xbStatus.setLayout(titleWidth, timelineGridControl.width);
|
21678
|
+
timeline.addChild(xbStatus);
|
21679
|
+
const otStatus = new TimelineOtherStatusContainer();
|
21680
|
+
otStatus.showDays = timelineGridControl.showDays;
|
21681
|
+
otStatus.setLayout(titleWidth, timelineGridControl.width);
|
21682
|
+
timeline.addChild(otStatus);
|
21683
|
+
const timelineScrollbar = new TimelineScrollBar('horizontal');
|
21684
|
+
timelineScrollbar.scrollSize = timelineGridControl.width;
|
21685
|
+
timelineScrollbar.viewSize = 840;
|
21686
|
+
timelineScrollbar.width = timeline.width;
|
21687
|
+
timelineScrollbar.scrollChanged.subscribe(data => {
|
21688
|
+
dateHeader.scrollX = data;
|
21689
|
+
inDaysHeader.scrollX = data;
|
21690
|
+
timeHeader.scrollX = data;
|
21691
|
+
timeGridContainer.scrollX = data;
|
21692
|
+
xbStatus.scrollX = data;
|
21693
|
+
hxStatus.scrollX = data;
|
21694
|
+
otStatus.scrollX = data;
|
21695
|
+
});
|
21696
|
+
timeline.addChild(timelineScrollbar);
|
21697
|
+
return timeline;
|
21698
|
+
}
|
21699
|
+
|
21700
|
+
/**
|
21701
|
+
* Node宽度定义
|
21702
|
+
* 1.在单页模式下,文档最小宽度为单个文档宽度+合适的外边距
|
21703
|
+
* 2.在多页模式下,文档最小宽度为单个文档宽度+合适的外边距
|
21704
|
+
*/
|
21705
|
+
class CanvasTextEditor extends AbsolutePanel {
|
21706
|
+
container;
|
21707
|
+
contentCtx;
|
21708
|
+
viewOptions;
|
21709
|
+
docCtx;
|
21710
|
+
docComment;
|
21711
|
+
renderContext;
|
21712
|
+
documentPaint;
|
21713
|
+
elementReader;
|
21714
|
+
documentEvent;
|
21715
|
+
documentSelection;
|
21716
|
+
documentInput;
|
21717
|
+
documentChange;
|
21718
|
+
selectionOverlays;
|
21719
|
+
//private docRule: DocRule;
|
21720
|
+
historyMange;
|
21721
|
+
selectionChanged = new Subject$1();
|
21722
|
+
beforeRenderSubject = new Subject$1();
|
21723
|
+
afterRenderSubject = new Subject$1();
|
21724
|
+
selectionState;
|
21725
|
+
//显示右键菜单
|
21726
|
+
onContextMenuItemChanged = new Subject$1();
|
21727
|
+
onDblClickEvent = new Subject$1();
|
21728
|
+
onClickEvent = new Subject$1();
|
21729
|
+
onScrollViewEvent = new Subject$1();
|
21730
|
+
//文档改变事件:内容及样式,业务模块需要根据此事件,来追踪当前文档是否改变的状态
|
21731
|
+
onDocChangedEvent = new Subject$1();
|
21732
|
+
//执行flushTask,refreshDoc之前,此时可以在文档计算排版之前改变内容
|
21733
|
+
onBeforeRefreshDocument = new Subject$1();
|
21734
|
+
editCanvas;
|
21735
|
+
editInput;
|
21736
|
+
constructor(container) {
|
21737
|
+
super();
|
21738
|
+
this.container = container;
|
21739
|
+
this.createDocDOM();
|
21740
|
+
this.viewOptions = new ViewOptions();
|
21741
|
+
this.documentSelection = new DocumentSelection();
|
21742
|
+
this.docCtx = new EditorContext(this.documentSelection.selectionState, this.viewOptions);
|
21743
|
+
this.viewOptions.copyRightInfo = '电子病历编辑器(XXX版权所有)';
|
21744
|
+
this.viewOptions.drawCharRectColor = 'green';
|
21745
|
+
this.viewOptions.showLineRect = true;
|
21746
|
+
this.viewOptions.docSpace = 20;
|
21747
|
+
this.viewOptions.reviewWindowWidth = 200;
|
21748
|
+
this.viewOptions.defaultFontName = '宋体';
|
21749
|
+
//this.viewOptions.scale = 2;
|
21750
|
+
//整个画布的尺寸
|
21751
|
+
this.viewOptions.viewSettings = {
|
21752
|
+
width: 1000,
|
21753
|
+
height: 200
|
21754
|
+
};
|
21755
|
+
this.viewOptions.editUser = {
|
21756
|
+
id: '6666',
|
21757
|
+
name: '管理员'
|
21758
|
+
};
|
21759
|
+
this.viewOptions.fullPageView = false;
|
21760
|
+
this.createDocViewer();
|
21761
|
+
this.docComment = new DocumentComment(this.docCtx);
|
21762
|
+
this.contentCtx = this.editCanvas.getContext('2d');
|
21763
|
+
this.renderContext = new RenderContext(new PaintContent(this.contentCtx));
|
21764
|
+
this.renderContext.init({ width: 500, height: 500, scale: 1 });
|
21765
|
+
this.selectionState = this.documentSelection.selectionState;
|
21766
|
+
this.selectionOverlays = new SelectionOverlays(this.documentSelection.selectionState);
|
21767
|
+
this.documentPaint = new DocumentPaint(this.renderContext, this.docCtx, this.selectionOverlays.selectedSets);
|
21768
|
+
this.elementReader = new ElementReader(this.docCtx);
|
21769
|
+
this.documentInput = new DocumentInput(this, this.docCtx);
|
21770
|
+
this.documentChange = new DocumentChange(this.elementReader, this.docCtx, this.docComment, this.documentInput);
|
21771
|
+
this.documentEvent = new DocumentEvent(this, this.documentPaint, this.docCtx, this.documentInput);
|
21772
|
+
this.historyMange = new ElementTrackManage(this.docCtx, this.elementReader);
|
21773
|
+
this.documentEvent.hitInfoChanged.subscribe((hitInfo) => {
|
21774
|
+
this.hitInfoChanged(hitInfo);
|
21775
|
+
});
|
21776
|
+
this.documentEvent.clickEvent.subscribe((evt) => {
|
21777
|
+
this.docClickHandle(evt);
|
21778
|
+
});
|
21779
|
+
this.documentEvent.dblClickEvent.subscribe((evt) => {
|
21780
|
+
this.docDblClickHandle(evt);
|
21781
|
+
});
|
21782
|
+
this.documentEvent.changeCursor.subscribe((cursor) => {
|
21783
|
+
this.changeCursor(cursor);
|
21784
|
+
});
|
21785
|
+
this.documentEvent.contextMenu.subscribe(evt => {
|
21786
|
+
this.onContextMenu(evt);
|
21787
|
+
});
|
21788
|
+
this.documentEvent.trackTipsChanged.subscribe(data => {
|
21789
|
+
});
|
21790
|
+
this.docCtx.docChange = this.documentChange;
|
21791
|
+
//this.listenContainerHeight();
|
21792
|
+
this.start();
|
21793
|
+
this.refreshDocRule();
|
21794
|
+
this.docCtx.syncRefresh = () => {
|
21795
|
+
this.flushToSchedule();
|
21796
|
+
};
|
21797
|
+
this.viewOptions.onChange.subscribe((type) => {
|
21798
|
+
this.resetViewer(type);
|
21799
|
+
});
|
21800
|
+
}
|
21801
|
+
createDocDOM() {
|
21802
|
+
const container = document.getElementById(this.container);
|
21803
|
+
const canvas = document.createElement('canvas');
|
21804
|
+
const input = document.createElement('input');
|
21805
|
+
container.style.overflow = 'hidden';
|
21806
|
+
container.style.position = 'relative';
|
21807
|
+
container.style.fontSize = '0';
|
21808
|
+
container.style.height = '100%';
|
21809
|
+
input.style.position = 'absolute';
|
21810
|
+
input.style.width = '1px';
|
21811
|
+
input.style.padding = '0';
|
21812
|
+
input.style.border = 'none';
|
21813
|
+
input.style.outline = 'none';
|
21814
|
+
input.style.background = 'black';
|
21815
|
+
input.style.pointerEvents = 'none';
|
21816
|
+
this.editCanvas = canvas;
|
21817
|
+
this.editInput = input;
|
21818
|
+
container.appendChild(canvas);
|
21819
|
+
container.appendChild(input);
|
21820
|
+
container.insertAdjacentElement('afterbegin', input);
|
21821
|
+
container.insertAdjacentElement('afterbegin', canvas);
|
21822
|
+
}
|
21823
|
+
destroyDOM() {
|
21824
|
+
this.editInput.remove();
|
21825
|
+
this.editCanvas.remove();
|
21826
|
+
}
|
21827
|
+
/**
|
21828
|
+
* 设置标尺
|
21829
|
+
*/
|
21830
|
+
refreshDocRule() {
|
21831
|
+
let docLeft = 0; //CommonUtil.getOffsetX(this.editCanvas.parentElement as HTMLDivElement);
|
21832
|
+
let pagePL = 0, pagePR = 0;
|
21833
|
+
if (this.documentPaint.docContainer) {
|
21834
|
+
docLeft += this.documentPaint.docContainer.rect.x;
|
21835
|
+
}
|
21836
|
+
if (this.docCtx.document?.props?.padding) {
|
21837
|
+
const { left, right } = this.docCtx.document.props.padding;
|
21838
|
+
pagePL = left;
|
21839
|
+
pagePR = right;
|
21840
|
+
}
|
21841
|
+
this.rule.setRuleOptions({ width: this.viewOptions.docPageSettings.width, pagePL, pagePR, docLeft });
|
21842
|
+
}
|
21843
|
+
createDocViewer() {
|
21844
|
+
this.viewOptions.mmToPixelsRatio = this.measureMMToPixs();
|
21845
|
+
const width = Math.floor(210 * this.viewOptions.mmToPixelsRatio);
|
21846
|
+
const height = Math.floor(297 * this.viewOptions.mmToPixelsRatio);
|
21847
|
+
this.viewOptions.docPageSettings = new PageOptions(width, height);
|
21848
|
+
// this.docScroll.onscroll = (evt) => {
|
21849
|
+
// //this.onScrollViewHandler(evt);
|
21850
|
+
// };
|
20401
21851
|
}
|
20402
21852
|
measureMMToPixs() {
|
20403
21853
|
const div = document.createElement('div');
|
@@ -20697,7 +22147,7 @@ class CanvasTextEditor extends AbsolutePanel {
|
|
20697
22147
|
}
|
20698
22148
|
const elementEvent = new ContextMenuElementEvent(this.docCtx);
|
20699
22149
|
elementEvent.source = startControl;
|
20700
|
-
DocumentEvent.invokeEvent('ElementContextMenu', startControl, elementEvent, 'All'
|
22150
|
+
DocumentEvent.invokeEvent('ElementContextMenu', startControl, elementEvent, 'All');
|
20701
22151
|
const position = { x: evt.offsetX + 10, y: evt.offsetY, translateY: this.viewOptions.pageOffset.y };
|
20702
22152
|
this.onContextMenuItemChanged.next({ pos: position, menus: elementEvent.menus });
|
20703
22153
|
}
|
@@ -20796,6 +22246,9 @@ class CanvasTextEditor extends AbsolutePanel {
|
|
20796
22246
|
destroy() {
|
20797
22247
|
this.docCtx.destroy();
|
20798
22248
|
this.documentEvent.clearSubEvent();
|
22249
|
+
this.selectionState.destroy();
|
22250
|
+
this.surfaceView.destroy();
|
22251
|
+
this.destroyDOM();
|
20799
22252
|
this.flushTask = null;
|
20800
22253
|
}
|
20801
22254
|
/**
|
@@ -20863,14 +22316,16 @@ class CanvasTextEditor extends AbsolutePanel {
|
|
20863
22316
|
return null;
|
20864
22317
|
}
|
20865
22318
|
/**
|
20866
|
-
*
|
20867
|
-
* @param
|
22319
|
+
* 设置段落样式
|
22320
|
+
* @param newProps
|
20868
22321
|
*/
|
20869
|
-
|
22322
|
+
setParaStyle(newProps) {
|
20870
22323
|
const setterFunc = (paraProps) => {
|
20871
|
-
|
22324
|
+
Object.keys(newProps).forEach(key => {
|
22325
|
+
paraProps[key] = newProps[key];
|
22326
|
+
});
|
20872
22327
|
};
|
20873
|
-
DocumentChange.
|
22328
|
+
DocumentChange.setParaStyle(this.selectionState, setterFunc);
|
20874
22329
|
}
|
20875
22330
|
combineCell() {
|
20876
22331
|
TableUtil.mergeCells(this.selectionState);
|
@@ -21081,80 +22536,6 @@ class CanvasTextEditor extends AbsolutePanel {
|
|
21081
22536
|
this.viewOptions.pageLayoutMode = mode;
|
21082
22537
|
this.flushToSchedule();
|
21083
22538
|
}
|
21084
|
-
// test2(): void {
|
21085
|
-
// //获取文档上下文
|
21086
|
-
// const docEleCtx = this.docCtx.getCtx(this.docCtx.document);
|
21087
|
-
// //获取年龄数据元
|
21088
|
-
// const dataEle = docEleCtx.getControlById('1493477712134672386') as DataElementText;
|
21089
|
-
// //获取要隐藏的数据组
|
21090
|
-
// const dataGroup = docEleCtx.ctx.treeFind((item) => item instanceof DataElementGroupElement) as DataElementGroupElement;
|
21091
|
-
// //侦听数据元更改时间
|
21092
|
-
// dataEle.onChangeSubject.subscribe((e) => {
|
21093
|
-
// //在文档重新排版、绘制前,获取最终的指定节点的内容
|
21094
|
-
// const beforeRefreshSub = this.onBeforeRefreshDocument.subscribe((e2) => {
|
21095
|
-
// console.log('内容发生改变,隐藏数据组');
|
21096
|
-
// //获取年龄数据元输入的值
|
21097
|
-
// const age = Number.parseInt(dataEle.getValue());
|
21098
|
-
// //年龄大于20,隐藏数据元
|
21099
|
-
// dataGroup.props.hidden = age > 20;
|
21100
|
-
// //取消订阅事件
|
21101
|
-
// beforeRefreshSub.unsubscribe();
|
21102
|
-
// });
|
21103
|
-
//
|
21104
|
-
// });
|
21105
|
-
// }
|
21106
|
-
//
|
21107
|
-
// //修改纸张尺寸,单位为毫米
|
21108
|
-
// //editor.setPaperSize(200,150)
|
21109
|
-
// test3(width: number, height: number): void {
|
21110
|
-
// this.setPaperSize(200, 150);
|
21111
|
-
// }
|
21112
|
-
//
|
21113
|
-
// //在当前段落后面插入新的段落,段落内容为当前时间
|
21114
|
-
// test4(): void {
|
21115
|
-
// const {startControl} = this.selectionState;
|
21116
|
-
// if (!startControl) {
|
21117
|
-
// return;
|
21118
|
-
// }
|
21119
|
-
// //1.获取当前段落
|
21120
|
-
// const currentParagraph = ElementUtil.getParentByType(startControl, ParagraphElement) as ParagraphElement;
|
21121
|
-
// //2.创建新段落对象
|
21122
|
-
// const newPara = ParagraphElement.createElement();
|
21123
|
-
//
|
21124
|
-
// //3.创建文本对象
|
21125
|
-
// const newText = new TextGroupElement();
|
21126
|
-
// newText.text = '当前时间为' + new Date();
|
21127
|
-
// newText.props.fontName = '楷体';
|
21128
|
-
// newText.props.fontSize = 18;
|
21129
|
-
// newText.props.color = '#5b8c00';
|
21130
|
-
// //4.将文本对象追加到新段落中
|
21131
|
-
// newPara.addChild(newText);
|
21132
|
-
// //5.在当前段落后面追加新段落
|
21133
|
-
// currentParagraph.parent.addChild(newPara, currentParagraph.getIndex() + 1);
|
21134
|
-
// //6.定位光标到新段落末尾处
|
21135
|
-
// this.selectionState.resetRange(newText,-1);
|
21136
|
-
// }
|
21137
|
-
//
|
21138
|
-
// //在当前位置插入文本数据元
|
21139
|
-
// test5():void{
|
21140
|
-
// const {startControl} = this.selectionState;
|
21141
|
-
// if (!startControl) {
|
21142
|
-
// return;
|
21143
|
-
// }
|
21144
|
-
// const newDataTextElement=new DataElementText();
|
21145
|
-
// newDataTextElement.props.nullText='请输入内容';
|
21146
|
-
// newDataTextElement.props.nullTextProps=new TextProps();
|
21147
|
-
// newDataTextElement.props.nullTextProps.fontSize=16;
|
21148
|
-
// newDataTextElement.props.nullTextProps.fontName='宋体';
|
21149
|
-
// newDataTextElement.props.nullTextProps.color='#ffc53d';
|
21150
|
-
// newDataTextElement.props.valueTextProps=new TextProps();
|
21151
|
-
// newDataTextElement.props.valueTextProps.fontSize=18;
|
21152
|
-
// newDataTextElement.props.valueTextProps.fontName='楷体';
|
21153
|
-
// newDataTextElement.props.valueTextProps.color='red';
|
21154
|
-
// this.insertNewElement(newDataTextElement);
|
21155
|
-
//
|
21156
|
-
// }
|
21157
|
-
//
|
21158
22539
|
// //覆盖修改页眉
|
21159
22540
|
// test6():void{
|
21160
22541
|
// //1.获取页眉对象
|
@@ -21214,7 +22595,8 @@ class CanvasTextEditor extends AbsolutePanel {
|
|
21214
22595
|
const win = new Window();
|
21215
22596
|
win.width = 1000;
|
21216
22597
|
win.height = 800;
|
21217
|
-
|
22598
|
+
const timeLineControl = createTimeline();
|
22599
|
+
win.content.addChild(timeLineControl);
|
21218
22600
|
const rule2 = new RuleControl(this.docCtx);
|
21219
22601
|
this.rule = rule2;
|
21220
22602
|
rule2.width = 700;
|
@@ -21430,26 +22812,6 @@ class CanvasTextEditor extends AbsolutePanel {
|
|
21430
22812
|
insertNewRow(tb, insertRowIndex) {
|
21431
22813
|
return TableUtil.insertNewRow(tb, insertRowIndex);
|
21432
22814
|
}
|
21433
|
-
generatorDoc(data) {
|
21434
|
-
//根据传入的参数,动态生成病情信息的结构化报告
|
21435
|
-
const para = new ParagraphElement();
|
21436
|
-
//创建患者姓名文本标签
|
21437
|
-
const patNameLabel = new TextGroupElement();
|
21438
|
-
patNameLabel.text = "患者姓名:";
|
21439
|
-
//添加到段落中
|
21440
|
-
para.addChild(patNameLabel);
|
21441
|
-
//创建患者姓名数据元
|
21442
|
-
const patNameDataEle = new DataElementText();
|
21443
|
-
patNameDataEle.props.valueTextProps = new TextProps();
|
21444
|
-
patNameDataEle.props.valueTextProps.fontName = '宋体';
|
21445
|
-
patNameDataEle.props.valueTextProps.fontSize = 16;
|
21446
|
-
//数据元赋值
|
21447
|
-
patNameDataEle.setValue(data.patName);
|
21448
|
-
//添加到段落中
|
21449
|
-
para.addChild(patNameDataEle);
|
21450
|
-
//添加到正文中
|
21451
|
-
this.docCtx.document.bodyElement.addChild(para);
|
21452
|
-
}
|
21453
22815
|
}
|
21454
22816
|
|
21455
22817
|
/**
|
@@ -21737,5 +23099,5 @@ function removeDuplicatesEvent(events) {
|
|
21737
23099
|
return arr;
|
21738
23100
|
}
|
21739
23101
|
|
21740
|
-
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 };
|
23102
|
+
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, InputElementEvent, 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, falseChar, fontMapFunc, fromEvent, getCalleeName, getFocusTextSegment, invokeTypeHandler, isDate, objectToString, onTableContextmenu, onceTask$1 as onceTask, parser, printDocOnContextmenu, printNodes, reactiveMap, runTextLineRender, setDataElementProps, setNotifyChangedCallback, targetMaps, textLineRenderMode, toRawType, toTypeString, trueChar, validateDataEle, validateDataEleRenderObj, validateInlineInputRenderObj, watchChanged };
|
21741
23103
|
//# sourceMappingURL=index.js.map
|