@hailin-zheng/editor-core 1.1.23 → 1.1.25

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/index.js CHANGED
@@ -4,7 +4,6 @@ import * as acor from 'acorn';
4
4
  import { generate } from 'astring';
5
5
  import estraverse from 'estraverse';
6
6
  import * as bwipjs from 'bwip-js';
7
- import moment$1 from 'moment/moment';
8
7
 
9
8
  /**
10
9
  * 元素事件
@@ -6202,6 +6201,7 @@ class ElementUtil {
6202
6201
  canvas.style.height = scaleHeight + 'px';
6203
6202
  canvas.width = scaleWidth * dpr;
6204
6203
  canvas.height = scaleHeight * dpr;
6204
+ ctx.textBaseline = 'top';
6205
6205
  ctx.scale(dpr, dpr);
6206
6206
  }
6207
6207
  // static setOffscreenCanvas(canvas: OffscreenCanvas, ctx: OffscreenCanvasRenderingContext2D, viewOptions: { width: number, height: number }, scale: number = 1): void {
@@ -11692,8 +11692,13 @@ class ParagraphMeasure {
11692
11692
  return;
11693
11693
  }
11694
11694
  else {
11695
- parentLine.add(render);
11696
- parentLine.applyNewLine();
11695
+ if (parentLine.lineWidth() === 0) {
11696
+ parentLine.add(render);
11697
+ }
11698
+ else {
11699
+ parentLine.applyNewLine();
11700
+ this.arrangeLeafRender(parentLine, render);
11701
+ }
11697
11702
  }
11698
11703
  }
11699
11704
  else {
@@ -18810,7 +18815,7 @@ class ViewPaint {
18810
18815
  this.init();
18811
18816
  }
18812
18817
  init() {
18813
- this.ctx.textBaseline = 'alphabetic';
18818
+ this.ctx.textBaseline = 'top';
18814
18819
  }
18815
18820
  /**
18816
18821
  * 更新绘制画布大小
@@ -18837,8 +18842,8 @@ class ViewPaint {
18837
18842
  this.ctx.save();
18838
18843
  this.ctx.fillStyle = textProps.color;
18839
18844
  this.ctx.font = textProps.getFont();
18840
- const vertHeight = textProps.vertAlign === 'superscript' ? 0 : height;
18841
- this.ctx.fillText(text, x, y + vertHeight - height / 7);
18845
+ const vertHeight = 0; //textProps.vertAlign === 'superscript' ? 0 : height;
18846
+ this.ctx.fillText(text, x, y + vertHeight);
18842
18847
  this.ctx.restore();
18843
18848
  if (textProps.linethrough) {
18844
18849
  this.drawHoriLine(x, y + (Math.ceil(height / 2)), width, textProps.color, 1);
@@ -20402,1314 +20407,6 @@ function pointInPoly(pt, poly) {
20402
20407
  return c;
20403
20408
  }
20404
20409
 
20405
- const timelineConfig = {
20406
- fontSize: 12,
20407
- fontName: '宋体',
20408
- /**
20409
- * 单个时刻的宽度,像素
20410
- */
20411
- timeTickWidth: 14,
20412
- /**
20413
- * 纵轴一个单位的高度
20414
- */
20415
- timeValueHeight: 20,
20416
- /**
20417
- * 单个时刻宽度代表的小时数
20418
- */
20419
- timeTickHours: 4,
20420
- /**
20421
- * 体温点的大小
20422
- */
20423
- temperaturePointSize: 4,
20424
- /**
20425
- * 心率点的大小
20426
- */
20427
- heartRatePointSize: 4,
20428
- temperatureModels: [42, 41, 40, 39, 38, 37, 36, 35],
20429
- heartRateModels: [180, 160, 140, 120, 100, 80, 40, 20],
20430
- valueRuleCounts: 8,
20431
- /**
20432
- * 时刻头部高度
20433
- */
20434
- tickHeaderHeight: 20,
20435
- /**
20436
- * 体温符号
20437
- */
20438
- temperatureSymbol: '℃',
20439
- heartRateSymbol: 'BPM'
20440
- };
20441
- class TimelineBaseControl extends AbsolutePanel {
20442
- startTime;
20443
- showDays = 0;
20444
- constructor() {
20445
- super();
20446
- this.border = 1;
20447
- this.borderColor = '#000';
20448
- this.bgColor = '#fff';
20449
- }
20450
- measureOverride(e, availableSize) {
20451
- this.build(e);
20452
- return super.measureOverride(e, availableSize);
20453
- }
20454
- isBuild = false;
20455
- build(e) {
20456
- if (this.isBuild) {
20457
- return;
20458
- }
20459
- this.clearChildren();
20460
- this.buildOverride(e);
20461
- this.isBuild = true;
20462
- }
20463
- reBuild() {
20464
- this.isBuild = false;
20465
- }
20466
- buildOverride(e) {
20467
- }
20468
- }
20469
- class TickContainer extends AbsolutePanel {
20470
- tickControl;
20471
- _startTime;
20472
- _showDays = 0;
20473
- scrollX = 0;
20474
- get startTime() {
20475
- return this._startTime;
20476
- }
20477
- set startTime(value) {
20478
- this._startTime = value;
20479
- this.tickControl.startTime = value;
20480
- }
20481
- get showDays() {
20482
- return this._showDays;
20483
- }
20484
- set showDays(value) {
20485
- this._showDays = value;
20486
- this.tickControl.showDays = value;
20487
- }
20488
- arrangeOverride(e, finalSize) {
20489
- this.controls.filter(item => item !== this.tickControl).forEach(item => {
20490
- const itemRect = {
20491
- x: item.x,
20492
- y: item.y,
20493
- width: item.desiredSize.width,
20494
- height: item.desiredSize.height
20495
- };
20496
- item.arrange(e, itemRect);
20497
- });
20498
- this.tickControl.arrange(e, { x: this.tickControl.x - this.scrollX,
20499
- y: this.tickControl.y,
20500
- width: this.tickControl.desiredSize.width,
20501
- height: this.tickControl.desiredSize.height });
20502
- return finalSize;
20503
- }
20504
- }
20505
-
20506
- class TemperaturePoint extends NodeCore {
20507
- type;
20508
- value;
20509
- constructor(type = 'axillary', value) {
20510
- super();
20511
- this.type = type;
20512
- this.value = value;
20513
- this.bgColor = 'blue';
20514
- this.width = timelineConfig.temperaturePointSize;
20515
- this.height = timelineConfig.temperaturePointSize;
20516
- this.addEventListener('mouseenter', evt => {
20517
- this.bgColor = 'red';
20518
- const onMouseLeave = () => {
20519
- this.bgColor = 'blue';
20520
- this.removeEventListener('mouseleave', onMouseLeave);
20521
- };
20522
- this.addEventListener('mouseleave', onMouseLeave);
20523
- });
20524
- }
20525
- renderOutline(renderCtx) {
20526
- translate(renderCtx, this.finalRect.x, this.finalRect.y);
20527
- translate(renderCtx, this.border + this.padding, this.border + this.padding);
20528
- }
20529
- render(e) {
20530
- if (this.type === 'axillary') {
20531
- this.renderAxillary(e);
20532
- }
20533
- else if (this.type === 'oral') {
20534
- this.renderOral(e);
20535
- }
20536
- else if (this.type === 'anal') {
20537
- this.renderAnal(e);
20538
- }
20539
- }
20540
- /**
20541
- * 绘制腋下温度 X
20542
- * @private
20543
- */
20544
- renderAxillary(e) {
20545
- const { width, height } = this.finalRect;
20546
- const x = 0, y = 0;
20547
- e.render.strokeLines([{ x, y }, { x: x + width, y: y + height }], 3, this.bgColor);
20548
- e.render.strokeLines([{ x: x + width, y }, { x, y: y + height }], 3, this.bgColor);
20549
- }
20550
- /**
20551
- * 绘制肛下温度 ○
20552
- * @private
20553
- */
20554
- renderAnal(e) {
20555
- const width = this.finalRect.width;
20556
- const ctx = e.render.ctx;
20557
- ctx.save();
20558
- ctx.beginPath();
20559
- ctx.strokeStyle = this.bgColor;
20560
- ctx.lineWidth = 2;
20561
- ctx.arc(width / 2, width / 2, width, 0, 2 * Math.PI);
20562
- ctx.stroke();
20563
- ctx.restore();
20564
- }
20565
- /**
20566
- * 绘制口腔温度 ●
20567
- * @private
20568
- */
20569
- renderOral(e) {
20570
- const width = this.finalRect.width;
20571
- e.render.fillCircular(width / 2, width / 2, width, this.bgColor);
20572
- }
20573
- }
20574
- class HeartRatePoint extends NodeCore {
20575
- value;
20576
- constructor() {
20577
- super();
20578
- this.bgColor = 'red';
20579
- this.width = timelineConfig.heartRatePointSize * 2;
20580
- this.height = timelineConfig.heartRatePointSize * 2;
20581
- this.addEventListener('mouseenter', evt => {
20582
- this.bgColor = 'green';
20583
- const tipLabel = new LabelNode();
20584
- tipLabel.text = this.value;
20585
- tipLabel.fontSize = timelineConfig.fontSize;
20586
- tipLabel.shadowBlur = 5;
20587
- tipLabel.shadowColor = '#000';
20588
- tipLabel.bgColor = '#fff';
20589
- tipLabel.x = this.x;
20590
- tipLabel.y = this.y - tipLabel.fontSize - 2;
20591
- this.parent?.addChild(tipLabel);
20592
- const onMouseLeave = () => {
20593
- this.bgColor = 'red';
20594
- this.parent?.removeChild(tipLabel);
20595
- this.removeEventListener('mouseleave', onMouseLeave);
20596
- };
20597
- this.addEventListener('mouseleave', onMouseLeave);
20598
- });
20599
- }
20600
- renderOutline(renderCtx) {
20601
- translate(renderCtx, this.finalRect.x, this.finalRect.y);
20602
- translate(renderCtx, this.border + this.padding, this.border + this.padding);
20603
- }
20604
- render(e) {
20605
- const heartRatePointSize = this.finalRect.width / 2;
20606
- e.render.fillCircular(heartRatePointSize, heartRatePointSize, heartRatePointSize, this.bgColor);
20607
- }
20608
- }
20609
- class TimeLinePath extends NodeCore {
20610
- startPos;
20611
- endPos;
20612
- lineColor = '#000';
20613
- lineWidth = 1;
20614
- constructor() {
20615
- super();
20616
- this.allowHitTest = true;
20617
- this.enableClip = false;
20618
- }
20619
- renderOutline(renderCtx) {
20620
- translate(renderCtx, this.finalRect.x, this.finalRect.y);
20621
- translate(renderCtx, this.border + this.padding, this.border + this.padding);
20622
- }
20623
- render(e) {
20624
- e.render.strokeLines([this.startPos, this.endPos], this.lineWidth, this.lineColor);
20625
- }
20626
- }
20627
-
20628
- class TimelineControl extends AbsolutePanel {
20629
- render(e) {
20630
- }
20631
- constructor() {
20632
- super();
20633
- this.border = 1;
20634
- this.borderColor = '#000';
20635
- }
20636
- measureOverride(e, availableSize) {
20637
- const height = this.controls.reduce((prev, curr) => {
20638
- curr.measure(e, availableSize);
20639
- return prev + curr.desiredSize.height;
20640
- }, 0);
20641
- return {
20642
- height, width: availableSize.width
20643
- };
20644
- }
20645
- arrangeOverride(e, finalSize) {
20646
- this.controls.reduce((prev, curr) => {
20647
- const itemRect = {
20648
- x: 0,
20649
- y: prev,
20650
- width: curr.desiredSize.width,
20651
- height: curr.desiredSize.height
20652
- };
20653
- curr.arrange(e, itemRect);
20654
- return prev + curr.desiredSize.height;
20655
- }, 0);
20656
- return finalSize;
20657
- }
20658
- reBuild() {
20659
- treeForEach(this, item => {
20660
- if (item instanceof NodeItems) {
20661
- return item.controls;
20662
- }
20663
- else {
20664
- return [];
20665
- }
20666
- }, (item) => {
20667
- if (item instanceof TimelineBaseControl) {
20668
- item.reBuild();
20669
- }
20670
- });
20671
- }
20672
- }
20673
- function treeForEach(root, children, callback) {
20674
- callback(root);
20675
- children(root).forEach(node => {
20676
- treeForEach(node, children, callback);
20677
- });
20678
- }
20679
- /**
20680
- * 中间网格数据绘制区域
20681
- */
20682
- class TimeGridContainer extends AbsolutePanel {
20683
- get gridHeight() {
20684
- return this._gridHeight;
20685
- }
20686
- set gridHeight(value) {
20687
- this._gridHeight = value;
20688
- this.timelineGridControl.height = value;
20689
- this.timeValueRuleContainer.height = value;
20690
- }
20691
- _startTime;
20692
- _showDays = 7;
20693
- get startTime() {
20694
- return this._startTime;
20695
- }
20696
- set startTime(value) {
20697
- this._startTime = value;
20698
- this.timelineGridControl.startTime = value;
20699
- }
20700
- get showDays() {
20701
- return this._showDays;
20702
- }
20703
- set showDays(value) {
20704
- this._showDays = value;
20705
- this.timelineGridControl.showDays = value;
20706
- }
20707
- /**
20708
- * 网格区域高度
20709
- */
20710
- _gridHeight = 0;
20711
- scrollX = 0;
20712
- timelineGridControl;
20713
- timeValueRuleContainer;
20714
- constructor() {
20715
- super();
20716
- this.timelineGridControl = new TimelineGridControl();
20717
- this.addChild(this.timelineGridControl);
20718
- this.timeValueRuleContainer = new TimeValueRuleContainer();
20719
- this.addChild(this.timeValueRuleContainer);
20720
- }
20721
- init() {
20722
- this.timelineGridControl.init();
20723
- }
20724
- measureOverride(e, availableSize) {
20725
- this.timelineGridControl.measure(e, availableSize);
20726
- const height = this.timelineGridControl.desiredSize.height;
20727
- this.timeValueRuleContainer.measure(e, { height, width: availableSize.width });
20728
- return { height, width: availableSize.width };
20729
- }
20730
- arrangeOverride(e, finalSize) {
20731
- this.controls.filter(item => item !== this.timelineGridControl).forEach(item => {
20732
- const itemRect = {
20733
- x: item.x,
20734
- y: item.y,
20735
- width: item.desiredSize.width,
20736
- height: item.desiredSize.height
20737
- };
20738
- item.arrange(e, itemRect);
20739
- });
20740
- this.timelineGridControl.arrange(e, {
20741
- x: this.timelineGridControl.x - this.scrollX,
20742
- y: this.timelineGridControl.y,
20743
- width: this.timelineGridControl.desiredSize.width,
20744
- height: this.timelineGridControl.desiredSize.height
20745
- });
20746
- return finalSize;
20747
- }
20748
- render(e) {
20749
- }
20750
- }
20751
- class TimeValueRuleContainer extends AbsolutePanel {
20752
- getLayoutWidth() {
20753
- return this.controls.reduce((prev, curr) => prev + curr.width, 0);
20754
- }
20755
- init() {
20756
- this.controls.reduce((prev, curr) => {
20757
- curr.x = prev;
20758
- return prev + curr.width;
20759
- }, 0);
20760
- }
20761
- renderOutline(renderCtx) {
20762
- translate(renderCtx, this.finalRect.x, this.finalRect.y);
20763
- translate(renderCtx, this.border + this.padding, this.border + this.padding);
20764
- }
20765
- render(e) {
20766
- }
20767
- }
20768
- /**
20769
- * 标题区域
20770
- * 时间刻度:日期、住院天数、手术天数、时刻
20771
- * 数值标尺区域、数据网格区域
20772
- * 文本时间轴区域
20773
- */
20774
- class TimelineGridControl extends TimelineBaseControl {
20775
- get isShowTemperature() {
20776
- return this._isShowTemperature;
20777
- }
20778
- set isShowTemperature(value) {
20779
- this.propertyChanged('isShowTemperature', this._isShowTemperature, value);
20780
- this._isShowTemperature = value;
20781
- }
20782
- get isShowHeartRate() {
20783
- return this._isShowHeartRate;
20784
- }
20785
- set isShowHeartRate(value) {
20786
- this.propertyChanged('isShowHeartRate', this._isShowHeartRate, value);
20787
- this._isShowHeartRate = value;
20788
- }
20789
- //体温数据
20790
- temperatureData = [];
20791
- //心率数据
20792
- heartRateData = [];
20793
- //体温时间轴值模型
20794
- temperatureTimeLineValueModel = [];
20795
- //心率时间轴值模型
20796
- heartRateTimeLineValueModel = [];
20797
- //图章数据
20798
- eventData = [];
20799
- _isShowTemperature = true;
20800
- _isShowHeartRate = true;
20801
- mousePos = null;
20802
- constructor() {
20803
- super();
20804
- this.startTime = moment$1(moment$1().format("YYYY-MM-DD")).toDate();
20805
- this.addEventListener('mousemove', evt => {
20806
- const pos = evt.pos;
20807
- const nodePos = getNodePosition(this, { x: 0, y: 0 });
20808
- this.mousePos = { x: pos.x - nodePos.x, y: pos.y - nodePos.y };
20809
- });
20810
- this.addEventListener('mouseleave', evt => {
20811
- this.mousePos = null;
20812
- });
20813
- }
20814
- randomNum = (start, end) => {
20815
- return Math.floor(Math.random() * (end - start) + start);
20816
- };
20817
- getLayoutWidth() {
20818
- return this.showDays * (24 / timelineConfig.timeTickHours) * timelineConfig.timeTickWidth;
20819
- }
20820
- init() {
20821
- this.temperatureTimeLineValueModel = timelineConfig.temperatureModels.map((item, index, arr) => ({
20822
- value: item,
20823
- offset: (index + 1) / (arr.length + 1)
20824
- }));
20825
- this.heartRateTimeLineValueModel = timelineConfig.heartRateModels.map((item, index, arr) => ({
20826
- value: item,
20827
- offset: (index + 1) / (arr.length + 1)
20828
- }));
20829
- const { timeTickHours } = timelineConfig;
20830
- for (let i = 0; i < this.showDays; i++) {
20831
- for (let j = 0; j < 24; j += timeTickHours) {
20832
- this.temperatureData.push({
20833
- date: moment$1(this.startTime).add(i, 'days').add(j, 'hours').toDate(),
20834
- value: this.randomNum(33, 43) + this.randomNum(0, 10) / 10
20835
- //value: 43
20836
- });
20837
- this.heartRateData.push({
20838
- date: moment$1(this.startTime).add(i, 'days').add(j, 'hours').toDate(),
20839
- value: this.randomNum(70, 150)
20840
- });
20841
- }
20842
- this.eventData.push({ date: moment$1(this.startTime).add(i, 'days').toDate(), value: '入\r\n院\r\n111' });
20843
- }
20844
- this.temperatureData.sort((prev, curr) => {
20845
- return curr.date > prev.date ? 1 : -1;
20846
- });
20847
- this.heartRateData.sort((prev, curr) => curr.date > prev.date ? 1 : -1);
20848
- }
20849
- buildOverride(e) {
20850
- this.temperatureData.length = 0;
20851
- this.heartRateData.length = 0;
20852
- this.eventData.length = 0;
20853
- this.init();
20854
- this.buildTemperature(e);
20855
- this.buildHearRate(e);
20856
- this.buildStampUnit(e);
20857
- const tipLabel = new LabelNode();
20858
- tipLabel.text = '外\r\n科\r\n手\r\n术';
20859
- tipLabel.borderColor = '#000';
20860
- tipLabel.border = 1;
20861
- tipLabel.shadowBlur = 5;
20862
- tipLabel.shadowColor = 'red';
20863
- tipLabel.fontSize = 12;
20864
- tipLabel.bgColor = '#fff';
20865
- tipLabel.color = 'red';
20866
- tipLabel.textWrapping = 'wrap';
20867
- //tipLabel.width = 14;
20868
- tipLabel.x = 100;
20869
- tipLabel.y = 30;
20870
- this.addChild(tipLabel);
20871
- }
20872
- render(e) {
20873
- const { timeValueHeight, timeTickHours, timeTickWidth } = timelineConfig;
20874
- const ticks = 24 / timeTickHours;
20875
- for (let i = 0; i < this.showDays; i++) {
20876
- for (let j = 1; j <= ticks; j++) {
20877
- const x = i * timeTickWidth * ticks + j * timeTickWidth;
20878
- const color = j < ticks ? '#69c0ff' : '#ffadd2';
20879
- e.render.strokeLines([{
20880
- x,
20881
- y: 0
20882
- }, { x, y: this.finalRect.height }], 0.5, color);
20883
- }
20884
- }
20885
- for (let i = timeValueHeight; i < this.finalRect.height; i += timeValueHeight) {
20886
- e.render.strokeLines([{
20887
- x: 0,
20888
- y: i
20889
- }, { x: this.finalRect.width, y: i }], 0.5, '#69c0ff');
20890
- }
20891
- this.renderTemperatureGuideLine(e);
20892
- if (this.mousePos) {
20893
- e.render.strokeLines([{ x: 0, y: this.mousePos.y }, { x: this.finalRect.width, y: this.mousePos.y }]);
20894
- e.render.strokeLines([{ x: this.mousePos.x, y: 0 }, { x: this.mousePos.x, y: this.finalRect.height }]);
20895
- }
20896
- }
20897
- renderTemperatureGuideLine(e) {
20898
- const timelineValue = this.temperatureTimeLineValueModel.map(item => ({
20899
- value: item.value,
20900
- offset: this.height * item.offset
20901
- }));
20902
- //绘制正常36-37度,辅助线
20903
- const startPoint = 36.5;
20904
- const endPoint = 37.3;
20905
- const startFilter = timelineValue.filter(item => item.value >= startPoint);
20906
- const endFilter = timelineValue.filter(item => item.value >= endPoint);
20907
- let startY = 0;
20908
- let endY = 0;
20909
- if (startFilter.length > 1) {
20910
- const curr = startFilter[startFilter.length - 1];
20911
- const next = startFilter[startFilter.length - 2];
20912
- startY = curr.offset + (curr.value - startPoint) * (next.offset - curr.offset) / (curr.value - next.value);
20913
- }
20914
- if (endFilter.length > 1) {
20915
- const curr = endFilter[endFilter.length - 1];
20916
- const next = endFilter[endFilter.length - 2];
20917
- endY = curr.offset + (curr.value - endPoint) * (next.offset - curr.offset) / (curr.value - next.value);
20918
- }
20919
- e.render.strokeLines([{ x: 0, y: startY }, { x: this.finalRect.width, y: startY }], 1, 'red');
20920
- e.render.strokeLines([{ x: 0, y: endY }, { x: this.finalRect.width, y: endY }], 1, 'red');
20921
- }
20922
- buildTemperature(e) {
20923
- if (this.temperatureData.length === 0) {
20924
- return;
20925
- }
20926
- const height = this.height;
20927
- const { timeValueHeight, timeTickHours, timeTickWidth, temperaturePointSize } = timelineConfig;
20928
- const timelineValue = this.temperatureTimeLineValueModel.map(item => ({
20929
- value: item.value,
20930
- offset: height * item.offset
20931
- }));
20932
- //获取体温点纵向坐标
20933
- const getTimelineVerValue = (val) => {
20934
- const filter = timelineValue.filter(item => item.value >= val);
20935
- if (filter.length) {
20936
- if (filter.length > 1) {
20937
- const curr = filter[filter.length - 1];
20938
- const next = filter[filter.length - 2];
20939
- return curr.offset + (curr.value - val) * (next.offset - curr.offset) / (curr.value - next.value);
20940
- }
20941
- else {
20942
- return filter[0].offset;
20943
- }
20944
- }
20945
- return -1;
20946
- };
20947
- let prevPos = null;
20948
- for (let i = 0; i < this.showDays; i++) {
20949
- const ticks = 24 / timeTickHours;
20950
- for (let j = 0; j < ticks; j++) {
20951
- const hourOffset = j * timeTickHours;
20952
- const x = i * timeTickWidth * ticks + j * timeTickWidth;
20953
- const startTime = moment$1(this.startTime).add(i, 'days').add(hourOffset, 'hours');
20954
- const endTime = moment$1(this.startTime).add(i, 'days').add(hourOffset + timeTickHours, 'hours');
20955
- const predicate = (item) => {
20956
- return moment$1(item).isBetween(startTime, endTime, null, '(]');
20957
- };
20958
- const currTimePoints = this.temperatureData.filter(item => predicate(item.date));
20959
- currTimePoints.forEach(item => {
20960
- let currX = x;
20961
- const diffMinutes = moment$1(item.date).diff(startTime, 'minutes');
20962
- const offsetMinutes = diffMinutes * timeTickWidth / (timeTickHours * 60);
20963
- currX += offsetMinutes;
20964
- let currY = getTimelineVerValue(item.value);
20965
- //超出显示范围
20966
- if (currY > height) {
20967
- currY = height;
20968
- this.setExceededValueTip(e, item.value + '℃', currX, currY - 20);
20969
- }
20970
- if (currY < 0) {
20971
- currY = 0;
20972
- this.setExceededValueTip(e, item.value + '℃', currX, currY + 5);
20973
- }
20974
- const point = new TemperaturePoint('axillary', item.value);
20975
- point.x = currX - point.width / 2;
20976
- point.y = currY - point.width / 2;
20977
- this.addChild(point);
20978
- if (prevPos) {
20979
- const linePath = new TimeLinePath();
20980
- linePath.lineColor = 'blue';
20981
- linePath.startPos = prevPos;
20982
- linePath.endPos = { x: currX, y: currY };
20983
- this.addChild(linePath);
20984
- }
20985
- prevPos = { x: currX, y: currY };
20986
- });
20987
- }
20988
- }
20989
- }
20990
- setExceededValueTip(e, tip, x, y) {
20991
- const tipLabel = new LabelNode();
20992
- tipLabel.text = tip;
20993
- tipLabel.borderColor = '#000';
20994
- tipLabel.border = 1;
20995
- tipLabel.shadowBlur = 5;
20996
- tipLabel.shadowColor = '#000';
20997
- tipLabel.fontSize = 10;
20998
- tipLabel.bgColor = '#fff';
20999
- const tipLabelWidth = e.render.measureText2(tipLabel.text, tipLabel);
21000
- tipLabel.x = x -= tipLabelWidth / 2;
21001
- tipLabel.y = y;
21002
- this.addChild(tipLabel);
21003
- }
21004
- buildHearRate(e) {
21005
- const height = this.height;
21006
- const { timeTickHours, timeTickWidth, heartRateSymbol } = timelineConfig;
21007
- const timelineValue = this.heartRateTimeLineValueModel.map(item => ({
21008
- value: item.value,
21009
- offset: height * item.offset
21010
- }));
21011
- //获取心率纵向坐标
21012
- const getTimelineVerValue = (val) => {
21013
- const filter = timelineValue.filter(item => item.value >= val);
21014
- if (filter.length) {
21015
- if (filter.length > 1) {
21016
- const curr = filter[filter.length - 1];
21017
- const next = filter[filter.length - 2];
21018
- return curr.offset + (curr.value - val) * (next.offset - curr.offset) / (curr.value - next.value);
21019
- }
21020
- else {
21021
- return filter[0].offset;
21022
- }
21023
- }
21024
- return -1;
21025
- };
21026
- //const getTimelineHorValue=()
21027
- let prevPos = null;
21028
- for (let i = 0; i < this.showDays; i++) {
21029
- const ticks = 24 / timeTickHours;
21030
- for (let j = 0; j < ticks; j++) {
21031
- const hourOffset = j * timeTickHours;
21032
- const x = i * timeTickWidth * ticks + j * timeTickWidth;
21033
- const startTime = moment$1(this.startTime).add(i, 'days').add(hourOffset, 'hours');
21034
- const endTime = moment$1(this.startTime).add(i, 'days').add(hourOffset + timeTickHours, 'hours');
21035
- const predicate = (item) => {
21036
- return moment$1(item).isBetween(startTime, endTime, null, '(]');
21037
- };
21038
- const currTimePoints = this.heartRateData.filter(item => predicate(item.date));
21039
- currTimePoints.forEach(item => {
21040
- let currX = x;
21041
- const diffMinutes = moment$1(item.date).diff(startTime, 'minutes');
21042
- const offsetMinutes = diffMinutes * timeTickWidth / (timeTickHours * 60);
21043
- currX += offsetMinutes;
21044
- let currY = getTimelineVerValue(item.value);
21045
- //超出显示范围
21046
- if (currY > height) {
21047
- currY = height;
21048
- this.setExceededValueTip(e, item.value + heartRateSymbol, currX, currY - 20);
21049
- }
21050
- if (currY < 0) {
21051
- currY = 0;
21052
- this.setExceededValueTip(e, item.value + heartRateSymbol, currX, currY + 5);
21053
- }
21054
- const point = new HeartRatePoint();
21055
- point.value = item.value + '次/分';
21056
- point.x = currX - point.width / 2;
21057
- point.y = currY - point.width / 2;
21058
- this.addChild(point);
21059
- if (prevPos) {
21060
- const linePath = new TimeLinePath();
21061
- linePath.lineColor = 'red';
21062
- linePath.startPos = prevPos;
21063
- linePath.endPos = { x: currX, y: currY };
21064
- this.addChild(linePath);
21065
- }
21066
- prevPos = { x: currX, y: currY };
21067
- });
21068
- }
21069
- }
21070
- }
21071
- buildStampUnit(e) {
21072
- if (!this.eventData.length) {
21073
- return;
21074
- }
21075
- const { timeTickHours, timeTickWidth, heartRateSymbol } = timelineConfig;
21076
- for (let i = 0; i < this.showDays; i++) {
21077
- const ticks = 24 / timeTickHours;
21078
- for (let j = 0; j < ticks; j++) {
21079
- const hourOffset = j * timeTickHours;
21080
- const x = i * timeTickWidth * ticks + j * timeTickWidth;
21081
- const startTime = moment$1(this.startTime).add(i, 'days').add(hourOffset, 'hours');
21082
- const endTime = moment$1(this.startTime).add(i, 'days').add(hourOffset + timeTickHours, 'hours');
21083
- const predicate = (item) => {
21084
- return moment$1(item).isBetween(startTime, endTime, null, '(]');
21085
- };
21086
- const currTimePoints = this.eventData.filter(item => predicate(item.date));
21087
- currTimePoints.forEach(item => {
21088
- let currX = x;
21089
- const diffMinutes = moment$1(item.date).diff(startTime, 'minutes');
21090
- const offsetMinutes = diffMinutes * timeTickWidth / (timeTickHours * 60);
21091
- currX += offsetMinutes;
21092
- const tipLabel = new LabelNode();
21093
- tipLabel.text = item.value;
21094
- tipLabel.borderColor = '#000';
21095
- tipLabel.border = 1;
21096
- tipLabel.shadowBlur = 5;
21097
- tipLabel.shadowColor = 'red';
21098
- tipLabel.fontSize = 12;
21099
- tipLabel.bgColor = '#fff';
21100
- tipLabel.color = 'red';
21101
- tipLabel.textWrapping = 'wrap';
21102
- //tipLabel.width = 14;
21103
- tipLabel.x = currX;
21104
- tipLabel.y = 30;
21105
- this.addChild(tipLabel);
21106
- });
21107
- }
21108
- }
21109
- }
21110
- }
21111
- /**
21112
- * 心率数值标尺控件
21113
- */
21114
- class HeartRateValueRuleControl extends TimelineBaseControl {
21115
- constructor() {
21116
- super();
21117
- this.width = 50;
21118
- }
21119
- //体温时间轴值模型
21120
- heartRateTimeLineValueModel = [];
21121
- buildOverride(e) {
21122
- const width = this.width;
21123
- const height = this.height;
21124
- const label = new LabelNode();
21125
- label.text = '心率';
21126
- label.fontSize = timelineConfig.fontSize;
21127
- label.fontName = timelineConfig.fontName;
21128
- label.y = 5;
21129
- this.addChild(label);
21130
- const textProps = new TextProps();
21131
- textProps.fontSize = timelineConfig.fontSize;
21132
- textProps.fontName = timelineConfig.fontName;
21133
- label.x = (width - e.render.measureText(label.text, textProps).width) / 2;
21134
- const timelineValue = this.heartRateTimeLineValueModel.map(item => ({
21135
- value: item.value,
21136
- offset: (height) * item.offset
21137
- }));
21138
- timelineValue.forEach(item => {
21139
- const valueLabel = new LabelNode();
21140
- valueLabel.fontName = timelineConfig.fontName;
21141
- valueLabel.fontSize = timelineConfig.fontSize;
21142
- valueLabel.text = item.value + '';
21143
- valueLabel.x = (width - e.render.measureText(valueLabel.text, textProps).width) / 2;
21144
- valueLabel.y = item.offset;
21145
- this.addChild(valueLabel);
21146
- });
21147
- }
21148
- render(e) {
21149
- }
21150
- }
21151
- /**
21152
- * 体温数值标尺控件
21153
- */
21154
- class TemperatureValueRuleControl extends TimelineBaseControl {
21155
- constructor() {
21156
- super();
21157
- this.width = 50;
21158
- }
21159
- //体温时间轴值模型
21160
- temperatureTimeLineValueModel = [];
21161
- buildOverride(e) {
21162
- const width = this.width;
21163
- const height = this.height;
21164
- const label = new LabelNode();
21165
- label.text = '体温';
21166
- label.fontSize = timelineConfig.fontSize;
21167
- label.fontName = timelineConfig.fontName;
21168
- label.y = 5;
21169
- this.addChild(label);
21170
- label.x = (width - e.render.measureText2(label.text, label)) / 2;
21171
- const timelineValue = this.temperatureTimeLineValueModel.map(item => ({
21172
- value: item.value,
21173
- offset: (height) * item.offset
21174
- }));
21175
- timelineValue.forEach(item => {
21176
- const valueLabel = new LabelNode();
21177
- valueLabel.fontName = timelineConfig.fontName;
21178
- valueLabel.fontSize = timelineConfig.fontSize;
21179
- valueLabel.text = item.value + '';
21180
- valueLabel.x = (width - e.render.measureText2(valueLabel.text, valueLabel)) / 2;
21181
- valueLabel.y = item.offset;
21182
- this.addChild(valueLabel);
21183
- });
21184
- }
21185
- render(e) {
21186
- }
21187
- }
21188
-
21189
- /**
21190
- * 事件轴标题
21191
- * 日期、手术天数、术后天数、时刻
21192
- */
21193
- class TimeTickTitleControl extends TimelineBaseControl {
21194
- constructor() {
21195
- super();
21196
- this.bgColor = '#fff';
21197
- }
21198
- title;
21199
- render(e) {
21200
- }
21201
- buildOverride(e) {
21202
- const width = this.width;
21203
- const height = this.height;
21204
- const label = new LabelNode();
21205
- label.text = this.title;
21206
- label.fontSize = timelineConfig.fontSize;
21207
- label.fontName = timelineConfig.fontName;
21208
- const titleWidth = e.render.measureText2(label.text, label);
21209
- label.x = (width - titleWidth) / 2;
21210
- label.y = (height - label.fontSize) / 2;
21211
- this.addChild(label);
21212
- }
21213
- }
21214
- /**
21215
- * 文本状态时刻控件,用于显示状态文本,例如:小便等
21216
- */
21217
- class TextStatusTickControl extends TimelineBaseControl {
21218
- render(e) {
21219
- }
21220
- buildOverride(e) {
21221
- const { timeTickHours, timeTickWidth } = timelineConfig;
21222
- const height = this.height;
21223
- const ticks = 24 / timeTickHours;
21224
- for (let i = 0; i < this.showDays; i++) {
21225
- const width = ticks * timeTickWidth;
21226
- // const curr = moment(this.startTime).add(i, 'days').format('YYYY-MM-DD');
21227
- //
21228
- // const label = new LabelNode();
21229
- // label.text = curr + '';
21230
- // label.fontSize = timelineConfig.fontSize;
21231
- // label.fontName = timelineConfig.fontName;
21232
- //
21233
- // const dateTitleWidth = e.render.measureText2(curr + '', label);
21234
- //
21235
- // label.x = i * width + (width - dateTitleWidth) / 2;
21236
- // label.y = (height - label.fontSize) / 2;
21237
- // this.addChild(label);
21238
- const path = new TimeLinePath();
21239
- path.startPos = { x: i * width, y: 0 };
21240
- path.endPos = { x: i * width, y: height };
21241
- path.lineColor = '#ffadd2';
21242
- this.addChild(path);
21243
- }
21244
- }
21245
- }
21246
- /**
21247
- * 呼吸状态容器
21248
- */
21249
- class TimelineHXStatusContainer extends TickContainer {
21250
- tickTitleControl;
21251
- constructor() {
21252
- super();
21253
- this.tickTitleControl = new TimeTickTitleControl();
21254
- this.tickTitleControl.title = '呼吸';
21255
- this.tickTitleControl.height = timelineConfig.tickHeaderHeight;
21256
- this.tickControl = new TextStatusTickControl();
21257
- this.tickControl.height = timelineConfig.tickHeaderHeight;
21258
- this.addChild(this.tickControl);
21259
- this.addChild(this.tickTitleControl);
21260
- this.height = timelineConfig.tickHeaderHeight;
21261
- }
21262
- /**
21263
- * 设置标题和刻度宽度
21264
- * @param titleWidth
21265
- * @param tickWidth
21266
- */
21267
- setLayout(titleWidth, tickWidth) {
21268
- this.width = tickWidth + titleWidth;
21269
- this.tickTitleControl.width = titleWidth;
21270
- this.tickControl.width = tickWidth;
21271
- this.tickControl.x = titleWidth;
21272
- }
21273
- render(e) {
21274
- }
21275
- }
21276
- /**
21277
- * 小便状态容器
21278
- */
21279
- class TimelineXBStatusContainer extends TickContainer {
21280
- //statusControl: TextStatusTickControl;
21281
- tickTitleControl;
21282
- constructor() {
21283
- super();
21284
- this.tickTitleControl = new TimeTickTitleControl();
21285
- this.tickTitleControl.title = '小便 ml';
21286
- this.tickTitleControl.height = timelineConfig.tickHeaderHeight;
21287
- this.tickControl = new TextStatusTickControl();
21288
- this.tickControl.height = timelineConfig.tickHeaderHeight;
21289
- this.addChild(this.tickControl);
21290
- this.addChild(this.tickTitleControl);
21291
- this.height = timelineConfig.tickHeaderHeight;
21292
- }
21293
- /**
21294
- * 设置标题和刻度宽度
21295
- * @param titleWidth
21296
- * @param tickWidth
21297
- */
21298
- setLayout(titleWidth, tickWidth) {
21299
- this.width = tickWidth + titleWidth;
21300
- this.tickTitleControl.width = titleWidth;
21301
- this.tickControl.width = tickWidth;
21302
- this.tickControl.x = titleWidth;
21303
- }
21304
- render(e) {
21305
- }
21306
- }
21307
- /**
21308
- * 其他状态容器
21309
- */
21310
- class TimelineOtherStatusContainer extends TickContainer {
21311
- //statusControl: TextStatusTickControl;
21312
- tickTitleControl;
21313
- constructor() {
21314
- super();
21315
- this.tickTitleControl = new TimeTickTitleControl();
21316
- this.tickTitleControl.title = '其他';
21317
- this.tickTitleControl.height = timelineConfig.tickHeaderHeight;
21318
- this.tickControl = new TextStatusTickControl();
21319
- this.tickControl.height = timelineConfig.tickHeaderHeight;
21320
- this.addChild(this.tickControl);
21321
- this.addChild(this.tickTitleControl);
21322
- this.height = timelineConfig.tickHeaderHeight;
21323
- }
21324
- /**
21325
- * 设置标题和刻度宽度
21326
- * @param titleWidth
21327
- * @param tickWidth
21328
- */
21329
- setLayout(titleWidth, tickWidth) {
21330
- this.width = tickWidth + titleWidth;
21331
- this.tickTitleControl.width = titleWidth;
21332
- this.tickControl.width = tickWidth;
21333
- this.tickControl.x = titleWidth;
21334
- }
21335
- render(e) {
21336
- }
21337
- }
21338
-
21339
- /**
21340
- * 时间刻度区域
21341
- * 循环日期显示
21342
- * 住院天数
21343
- * 术后天数
21344
- * 时刻等
21345
- */
21346
- /**
21347
- * 日期时刻容器
21348
- */
21349
- class DateTickContainer extends TickContainer {
21350
- tickTitleControl;
21351
- constructor() {
21352
- super();
21353
- this.tickTitleControl = new TimeTickTitleControl();
21354
- this.tickTitleControl.title = '日期';
21355
- this.tickTitleControl.height = timelineConfig.tickHeaderHeight;
21356
- this.tickControl = new DateTickControl();
21357
- this.tickControl.height = timelineConfig.tickHeaderHeight;
21358
- this.addChild(this.tickControl);
21359
- this.addChild(this.tickTitleControl);
21360
- this.height = timelineConfig.tickHeaderHeight;
21361
- }
21362
- /**
21363
- * 设置标题和刻度宽度
21364
- * @param titleWidth
21365
- * @param tickWidth
21366
- */
21367
- setLayout(titleWidth, tickWidth) {
21368
- this.width = tickWidth + titleWidth;
21369
- this.tickTitleControl.width = titleWidth;
21370
- this.tickControl.width = tickWidth;
21371
- this.tickControl.x = titleWidth;
21372
- }
21373
- render(e) {
21374
- }
21375
- }
21376
- /**
21377
- * 日期刻度
21378
- */
21379
- class DateTickControl extends TimelineBaseControl {
21380
- buildOverride(e) {
21381
- const { timeTickHours, timeTickWidth } = timelineConfig;
21382
- const height = this.height;
21383
- const ticks = 24 / timeTickHours;
21384
- for (let i = 0; i < this.showDays; i++) {
21385
- const width = ticks * timeTickWidth;
21386
- const curr = moment$1(this.startTime).add(i, 'days').format('YYYY-MM-DD');
21387
- const label = new LabelNode();
21388
- label.text = curr + '';
21389
- label.fontSize = timelineConfig.fontSize;
21390
- label.fontName = timelineConfig.fontName;
21391
- const dateTitleWidth = e.render.measureText2(curr + '', label);
21392
- label.x = i * width + (width - dateTitleWidth) / 2;
21393
- label.y = (height - label.fontSize) / 2;
21394
- this.addChild(label);
21395
- const path = new TimeLinePath();
21396
- path.startPos = { x: i * width, y: 0 };
21397
- path.endPos = { x: i * width, y: height };
21398
- path.lineColor = '#ffadd2';
21399
- this.addChild(path);
21400
- }
21401
- }
21402
- render(e) {
21403
- }
21404
- }
21405
- class TimeTickContainer extends TickContainer {
21406
- tickTitleControl;
21407
- constructor() {
21408
- super();
21409
- this.tickTitleControl = new TimeTickTitleControl();
21410
- this.tickTitleControl.title = '时刻';
21411
- this.tickTitleControl.height = timelineConfig.tickHeaderHeight;
21412
- this.tickControl = new TimeTickControl();
21413
- this.tickControl.height = timelineConfig.tickHeaderHeight;
21414
- this.addChild(this.tickControl);
21415
- this.addChild(this.tickTitleControl);
21416
- this.height = timelineConfig.tickHeaderHeight;
21417
- }
21418
- /**
21419
- * 设置标题和刻度宽度
21420
- * @param titleWidth
21421
- * @param tickWidth
21422
- */
21423
- setLayout(titleWidth, tickWidth) {
21424
- this.width = tickWidth + titleWidth;
21425
- this.tickTitleControl.width = titleWidth;
21426
- this.tickControl.width = tickWidth;
21427
- this.tickControl.x = titleWidth;
21428
- }
21429
- render(e) {
21430
- }
21431
- }
21432
- class TimeTickControl extends TimelineBaseControl {
21433
- constructor() {
21434
- super();
21435
- this.border = 1;
21436
- this.borderColor = '#000';
21437
- }
21438
- showDays = 7;
21439
- buildOverride(e) {
21440
- const { timeTickHours, timeTickWidth } = timelineConfig;
21441
- const ticks = 24 / timeTickHours;
21442
- for (let i = 0; i < this.showDays; i++) {
21443
- for (let j = 1; j <= ticks; j++) {
21444
- const hourOffset = j * timeTickHours;
21445
- const x = i * timeTickWidth * ticks + j * timeTickWidth;
21446
- const text = hourOffset + '';
21447
- const label = new LabelNode();
21448
- label.text = text;
21449
- label.fontSize = timelineConfig.fontSize;
21450
- label.fontName = timelineConfig.fontName;
21451
- const dateTitleWidth = e.render.measureText2(text, label);
21452
- label.x = x - timeTickWidth + (timeTickWidth - dateTitleWidth) / 2;
21453
- label.y = 0;
21454
- this.addChild(label);
21455
- }
21456
- }
21457
- }
21458
- render(e) {
21459
- const { timeTickHours, timeTickWidth } = timelineConfig;
21460
- const ticks = 24 / timeTickHours;
21461
- for (let i = 0; i < this.showDays; i++) {
21462
- for (let j = 1; j <= ticks; j++) {
21463
- const x = i * timeTickWidth * ticks + j * timeTickWidth;
21464
- const color = j < ticks ? '#69c0ff' : '#ffadd2';
21465
- e.render.strokeLines([{
21466
- x,
21467
- y: 0
21468
- }, { x, y: this.finalRect.height }], 1, color);
21469
- }
21470
- }
21471
- }
21472
- }
21473
- class InPatDaysTickContainer extends TickContainer {
21474
- //inPatDaysControl: InPatDaysControl;
21475
- tickTitleControl;
21476
- constructor() {
21477
- super();
21478
- this.tickTitleControl = new TimeTickTitleControl();
21479
- this.tickTitleControl.title = '住院天数';
21480
- this.tickTitleControl.height = timelineConfig.tickHeaderHeight;
21481
- this.tickControl = new InPatDaysControl();
21482
- this.tickControl.height = timelineConfig.tickHeaderHeight;
21483
- this.addChild(this.tickControl);
21484
- this.addChild(this.tickTitleControl);
21485
- this.height = timelineConfig.tickHeaderHeight;
21486
- }
21487
- /**
21488
- * 设置标题和刻度宽度
21489
- * @param titleWidth
21490
- * @param tickWidth
21491
- */
21492
- setLayout(titleWidth, tickWidth) {
21493
- this.width = tickWidth + titleWidth;
21494
- this.tickTitleControl.width = titleWidth;
21495
- this.tickControl.width = tickWidth;
21496
- this.tickControl.x = titleWidth;
21497
- }
21498
- render(e) {
21499
- }
21500
- }
21501
- class InPatDaysControl extends TimelineBaseControl {
21502
- buildOverride(e) {
21503
- const { timeTickHours, timeTickWidth } = timelineConfig;
21504
- const height = this.height;
21505
- const ticks = 24 / timeTickHours;
21506
- for (let i = 0; i < this.showDays; i++) {
21507
- const width = ticks * timeTickWidth;
21508
- const text = (i + 1) + '';
21509
- const label = new LabelNode();
21510
- label.text = text;
21511
- label.fontSize = timelineConfig.fontSize;
21512
- label.fontName = timelineConfig.fontName;
21513
- const dateTitleWidth = e.render.measureText2(text, label);
21514
- label.x = i * width + (width - dateTitleWidth + label.fontSize) / 2;
21515
- label.y = (height - label.fontSize) / 2;
21516
- this.addChild(label);
21517
- const path = new TimeLinePath();
21518
- path.startPos = { x: i * width, y: 0 };
21519
- path.endPos = { x: i * width, y: height };
21520
- path.lineColor = '#ffadd2';
21521
- this.addChild(path);
21522
- }
21523
- }
21524
- render(e) {
21525
- }
21526
- }
21527
-
21528
- class TimelineScrollBar extends NodeItems {
21529
- //滚动条方向
21530
- orientation = 'horizontal';
21531
- thumb;
21532
- thumbSize = 10;
21533
- //按照百分比计算
21534
- scrollChanged = new Subject();
21535
- //总滚动宽度
21536
- scrollSize = 0;
21537
- //显示区域宽度
21538
- viewSize = 0;
21539
- scrollX = 0;
21540
- scrollY = 0;
21541
- constructor(orientation) {
21542
- super();
21543
- this.bgColor = '#fff';
21544
- this.border = 1;
21545
- this.borderColor = '#000';
21546
- this.height = 16;
21547
- this.orientation = orientation;
21548
- this.thumb = new ScrollThumb();
21549
- this.addChild(this.thumb);
21550
- this.thumb.addEventListener('mousedown', evt => {
21551
- const pos = { ...evt.pos };
21552
- const { x, y } = this.thumb.finalRect;
21553
- const mouseMoveListener = (evt2) => {
21554
- //const scrollView = this.parent as ScrollView;
21555
- const pos2 = evt2.pos;
21556
- let moveX = pos2.x - pos.x;
21557
- let moveY = pos2.y - pos.y;
21558
- moveX += x;
21559
- moveY += y;
21560
- moveX = (moveX / this.finalRect.width) * this.scrollSize;
21561
- moveY = (moveY / this.finalRect.height) * this.scrollSize;
21562
- this.updateScroll(moveX, moveY);
21563
- };
21564
- const mouseUpListener = (evt3) => {
21565
- this.thumb.removeEventListener('mousemove', mouseMoveListener);
21566
- this.thumb.removeEventListener('mouseup', mouseUpListener);
21567
- };
21568
- this.thumb.addEventListener('mousemove', mouseMoveListener);
21569
- this.thumb.addEventListener('mouseup', mouseUpListener);
21570
- });
21571
- }
21572
- updateScroll(x, y) {
21573
- //const scrollView = this.parent as ScrollView;
21574
- if (this.orientation === 'horizontal') {
21575
- if (this.finalRect.height === 0) {
21576
- return;
21577
- }
21578
- if (x + this.viewSize > this.scrollSize) {
21579
- x = this.scrollSize - this.viewSize;
21580
- }
21581
- x = x < 0 ? 0 : x;
21582
- this.scrollChanged.next(x);
21583
- this.scrollX = x;
21584
- }
21585
- }
21586
- updateScrollByCurrent(increaseX, increaseY) {
21587
- //const scrollView = this.parent as ScrollView;
21588
- increaseX += this.scrollX;
21589
- increaseY += this.scrollY;
21590
- this.updateScroll(increaseX, increaseY);
21591
- }
21592
- measureOverride(e, availableSize) {
21593
- if (this.orientation === 'horizontal') {
21594
- return this.measureHorizontalBar(e, availableSize);
21595
- }
21596
- else {
21597
- //return this.measureVerticalBar(e, availableSize);
21598
- throw new Error('未实现');
21599
- }
21600
- }
21601
- /**
21602
- * 横向滚动条测量
21603
- */
21604
- measureHorizontalBar(e, availableSize) {
21605
- if (this.scrollSize > this.viewSize) {
21606
- //计算滚动按钮的长度
21607
- const thumbWidth = (this.viewSize / this.scrollSize) * availableSize.width;
21608
- this.thumb.measure(e, { width: thumbWidth, height: this.thumbSize });
21609
- return { width: availableSize.width, height: ScrollBarSize };
21610
- }
21611
- else {
21612
- this.thumb.measure(e, { width: 0, height: 0 });
21613
- return { width: 0, height: 0 };
21614
- }
21615
- }
21616
- arrangeOverride(e, finalSize) {
21617
- //const scrollView = this.parent as ScrollView;
21618
- const { width, height } = this.thumb.desiredSize;
21619
- const x = this.orientation === 'horizontal' ? (this.scrollX / this.scrollSize) * finalSize.width : (ScrollBarSize - this.thumbSize) / 2;
21620
- const y = this.orientation === 'horizontal' ? (ScrollBarSize - this.thumbSize) / 2 : (this.scrollY / this.scrollSize) * finalSize.height;
21621
- this.thumb.arrange(e, { x, y, width, height });
21622
- return super.arrangeOverride(e, finalSize);
21623
- }
21624
- render(e) {
21625
- //e.render.contentContext.clearRect(0,0,this.finalRect.width,this.finalRect.height);
21626
- //e.render.fillRect(0, 0, this.finalRect.width, this.finalRect.height, 'red')
21627
- }
21628
- }
21629
-
21630
- function createTimeline() {
21631
- const timeline = new TimelineControl();
21632
- timeline.width = 940;
21633
- const timeGridContainer = new TimeGridContainer();
21634
- //timeGridContainer.y = 80;
21635
- const timelineGridControl = timeGridContainer.timelineGridControl; //new TimeLineControl();
21636
- timelineGridControl.showDays = 100;
21637
- timelineGridControl.width = timelineGridControl.getLayoutWidth();
21638
- timelineGridControl.height = 300;
21639
- timelineGridControl.init();
21640
- const tempValueRule = new TemperatureValueRuleControl();
21641
- tempValueRule.temperatureTimeLineValueModel = timelineGridControl.temperatureTimeLineValueModel;
21642
- tempValueRule.bgColor = '#fff';
21643
- tempValueRule.height = timelineGridControl.height;
21644
- timeGridContainer.timeValueRuleContainer.addChild(tempValueRule);
21645
- tempValueRule.addEventListener('mouseenter', evt => {
21646
- tempValueRule.bgColor = 'grey';
21647
- const mousemoveHandler = () => {
21648
- tempValueRule.bgColor = '#fff';
21649
- tempValueRule.removeEventListener('mouseleave', mousemoveHandler);
21650
- };
21651
- tempValueRule.addEventListener('mouseleave', mousemoveHandler);
21652
- });
21653
- const heartRateValueRule = new HeartRateValueRuleControl();
21654
- heartRateValueRule.heartRateTimeLineValueModel = timelineGridControl.heartRateTimeLineValueModel;
21655
- heartRateValueRule.bgColor = '#fff';
21656
- heartRateValueRule.height = timelineGridControl.height;
21657
- timeGridContainer.timeValueRuleContainer.addChild(heartRateValueRule);
21658
- heartRateValueRule.addEventListener('mouseenter', evt => {
21659
- heartRateValueRule.bgColor = 'grey';
21660
- const mousemoveHandler = () => {
21661
- heartRateValueRule.bgColor = '#fff';
21662
- heartRateValueRule.removeEventListener('mouseleave', mousemoveHandler);
21663
- };
21664
- heartRateValueRule.addEventListener('mouseleave', mousemoveHandler);
21665
- });
21666
- timeGridContainer.timeValueRuleContainer.init();
21667
- const titleWidth = timeGridContainer.timeValueRuleContainer.getLayoutWidth();
21668
- timeGridContainer.timeValueRuleContainer.width = titleWidth;
21669
- timeGridContainer.timeValueRuleContainer.height = timelineGridControl.height;
21670
- timeGridContainer.timelineGridControl.x = timeGridContainer.timeValueRuleContainer.width;
21671
- const dateHeader = new DateTickContainer();
21672
- dateHeader.showDays = timelineGridControl.showDays;
21673
- dateHeader.setLayout(titleWidth, timelineGridControl.width);
21674
- timeline.addChild(dateHeader);
21675
- const inDaysHeader = new InPatDaysTickContainer();
21676
- inDaysHeader.showDays = timelineGridControl.showDays;
21677
- inDaysHeader.setLayout(titleWidth, timelineGridControl.width);
21678
- timeline.addChild(inDaysHeader);
21679
- const timeHeader = new TimeTickContainer();
21680
- timeHeader.showDays = timelineGridControl.showDays;
21681
- timeHeader.setLayout(titleWidth, timelineGridControl.width);
21682
- timeline.addChild(timeHeader);
21683
- timeline.addChild(timeGridContainer);
21684
- const hxStatus = new TimelineHXStatusContainer();
21685
- hxStatus.showDays = timelineGridControl.showDays;
21686
- hxStatus.setLayout(titleWidth, timelineGridControl.width);
21687
- timeline.addChild(hxStatus);
21688
- const xbStatus = new TimelineXBStatusContainer();
21689
- xbStatus.showDays = timelineGridControl.showDays;
21690
- xbStatus.setLayout(titleWidth, timelineGridControl.width);
21691
- timeline.addChild(xbStatus);
21692
- const otStatus = new TimelineOtherStatusContainer();
21693
- otStatus.showDays = timelineGridControl.showDays;
21694
- otStatus.setLayout(titleWidth, timelineGridControl.width);
21695
- timeline.addChild(otStatus);
21696
- const timelineScrollbar = new TimelineScrollBar('horizontal');
21697
- timelineScrollbar.scrollSize = timelineGridControl.width;
21698
- timelineScrollbar.viewSize = 840;
21699
- timelineScrollbar.width = timeline.width;
21700
- timelineScrollbar.scrollChanged.subscribe(data => {
21701
- dateHeader.scrollX = data;
21702
- inDaysHeader.scrollX = data;
21703
- timeHeader.scrollX = data;
21704
- timeGridContainer.scrollX = data;
21705
- xbStatus.scrollX = data;
21706
- hxStatus.scrollX = data;
21707
- otStatus.scrollX = data;
21708
- });
21709
- timeline.addChild(timelineScrollbar);
21710
- return timeline;
21711
- }
21712
-
21713
20410
  /**
21714
20411
  * Node宽度定义
21715
20412
  * 1.在单页模式下,文档最小宽度为单个文档宽度+合适的外边距
@@ -22305,7 +21002,7 @@ class CanvasTextEditor extends AbsolutePanel {
22305
21002
  /**
22306
21003
  * 开启格式刷
22307
21004
  */
22308
- enableFormatBrush() {
21005
+ enableFormatBrush(once = false) {
22309
21006
  const startControl = this.selectionState.startControl;
22310
21007
  if (startControl instanceof TextGroupElement) {
22311
21008
  const selectedStyle = startControl.props.clone(null);
@@ -22602,8 +21299,8 @@ class CanvasTextEditor extends AbsolutePanel {
22602
21299
  const win = new Window();
22603
21300
  win.width = 1000;
22604
21301
  win.height = 800;
22605
- const timeLineControl = createTimeline();
22606
- win.content.addChild(timeLineControl);
21302
+ //const timeLineControl = createTimeline();
21303
+ //win.content.addChild(timeLineControl)
22607
21304
  const rule2 = new RuleControl(this.docCtx);
22608
21305
  this.rule = rule2;
22609
21306
  rule2.width = 700;