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