cnhis-design-vue 3.1.13-beta.0 → 3.1.13-beta.11

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.
Files changed (102) hide show
  1. package/es/packages/big-table/src/BigTable.vue.d.ts +3 -16
  2. package/es/packages/big-table/src/BigTable.vue_vue_type_script_setup_true_lang.js +40 -21
  3. package/es/packages/big-table/src/bigTableEmits.js +2 -1
  4. package/es/packages/big-table/src/utils.js +2 -1
  5. package/es/packages/big-table/style/index.css +5 -0
  6. package/es/packages/bpmn-workflow/src/BpmnWorkflow.d.ts +5 -0
  7. package/es/packages/bpmn-workflow/types/BpmnViewer.d.ts +1 -0
  8. package/es/packages/bpmn-workflow/types/ModelingModule.d.ts +1 -0
  9. package/es/packages/bpmn-workflow/types/MoveCanvasModule.d.ts +1 -0
  10. package/es/packages/button-print/index.d.ts +15 -1
  11. package/es/packages/button-print/src/ButtonPrint.vue.d.ts +199 -185
  12. package/es/packages/button-print/src/ButtonPrint.vue_vue_type_script_setup_true_lang.js +39 -4
  13. package/es/packages/button-print/src/utils/print.d.ts +41 -0
  14. package/es/packages/button-print/src/utils/print.js +325 -0
  15. package/es/packages/fabric-chart/index.d.ts +3 -4
  16. package/es/packages/fabric-chart/src/FabricChart.vue.d.ts +3 -4
  17. package/es/packages/fabric-chart/src/FabricChart.vue_vue_type_script_setup_true_lang.js +24 -18
  18. package/es/packages/fabric-chart/src/hooks/useBottom.js +1 -2
  19. package/es/packages/fabric-chart/src/hooks/useCenter.js +89 -19
  20. package/es/packages/fabric-chart/src/hooks/useCumputedPoint.d.ts +2 -2
  21. package/es/packages/fabric-chart/src/hooks/useCumputedPoint.js +27 -13
  22. package/es/packages/fabric-chart/src/hooks/useDraw.d.ts +1 -1
  23. package/es/packages/fabric-chart/src/hooks/useDraw.js +64 -7
  24. package/es/packages/fabric-chart/src/hooks/useLeft.js +83 -22
  25. package/es/packages/fabric-chart/src/hooks/useOther.js +3 -2
  26. package/es/packages/fabric-chart/src/hooks/useShadow.js +1 -1
  27. package/es/packages/fabric-chart/src/hooks/useTop.js +6 -4
  28. package/es/packages/fabric-chart/src/interface.d.ts +2 -2
  29. package/es/packages/fabric-chart/src/utils/index.d.ts +6823 -2
  30. package/es/packages/form-render/index.d.ts +311 -0
  31. package/es/packages/form-render/src/FormRender.vue.d.ts +313 -2
  32. package/es/packages/form-render/src/FormRender.vue_vue_type_script_setup_true_lang.js +58 -27
  33. package/es/packages/form-render/src/components/renderer/cascader.d.ts +7 -1
  34. package/es/packages/form-render/src/components/renderer/cascader.js +65 -53
  35. package/es/packages/form-render/src/components/renderer/formItem.d.ts +8 -293
  36. package/es/packages/form-render/src/components/renderer/formItem.js +137 -2
  37. package/es/packages/form-render/src/components/renderer/input.js +3 -3
  38. package/es/packages/form-render/src/components/renderer/select.d.ts +7 -5
  39. package/es/packages/form-render/src/components/renderer/select.js +35 -40
  40. package/es/packages/form-render/src/components/renderer/simpleComponent.js +2 -15
  41. package/es/packages/form-render/src/constants/index.d.ts +2 -1
  42. package/es/packages/form-render/src/constants/index.js +2 -1
  43. package/es/packages/form-render/src/hooks/useFieldListAdaptor.js +4 -2
  44. package/es/packages/form-render/src/hooks/useFormContext.d.ts +2 -1
  45. package/es/packages/form-render/src/hooks/useFormContext.js +13 -2
  46. package/es/packages/form-render/src/types/fieldItem.d.ts +58 -7
  47. package/es/packages/form-render/src/types/index.d.ts +5 -0
  48. package/es/packages/form-render/src/utils/index.d.ts +13 -4
  49. package/es/packages/form-render/src/utils/index.js +44 -3
  50. package/es/packages/form-render/style/index.css +44 -6
  51. package/es/packages/form-table/src/hooks/useNuiThemeOverrides.d.ts +4 -0
  52. package/es/packages/form-table/src/hooks/useNuiThemeOverrides.js +18 -0
  53. package/es/packages/index.css +228 -8
  54. package/es/packages/index.d.ts +5 -1
  55. package/es/packages/index.js +12 -1
  56. package/es/packages/scale-view/src/hooks/scaleview-init.js +1 -5
  57. package/es/packages/scale-view/src/hooks/scaleview-submit.js +1 -6
  58. package/es/packages/scale-view/src/hooks/scaleview-validate.js +0 -3
  59. package/es/packages/shortcut-provider/index.d.ts +17 -0
  60. package/es/packages/shortcut-provider/index.js +13 -0
  61. package/es/packages/shortcut-provider/src/ShortcutProvider.js +4 -0
  62. package/es/packages/shortcut-provider/src/ShortcutProvider.vue.d.ts +15 -0
  63. package/es/packages/shortcut-provider/src/ShortcutProvider.vue_vue_type_script_setup_true_lang.js +32 -0
  64. package/es/packages/shortcut-provider/src/constants/index.d.ts +7 -0
  65. package/es/packages/shortcut-provider/src/constants/index.js +8 -0
  66. package/es/packages/shortcut-provider/src/hooks/index.d.ts +2 -0
  67. package/es/packages/shortcut-provider/src/hooks/index.js +2 -0
  68. package/es/packages/shortcut-provider/src/hooks/useShortcutSignature.d.ts +4 -0
  69. package/es/packages/shortcut-provider/src/hooks/useShortcutSignature.js +12 -0
  70. package/es/packages/shortcut-provider/src/hooks/useShortcuts.d.ts +30 -0
  71. package/es/packages/shortcut-provider/src/hooks/useShortcuts.js +157 -0
  72. package/es/packages/shortcut-provider/src/types/index.d.ts +30 -0
  73. package/es/packages/shortcut-provider/src/types/index.js +1 -0
  74. package/es/packages/shortcut-provider/src/utils/index.d.ts +7 -0
  75. package/es/packages/shortcut-provider/src/utils/index.js +49 -0
  76. package/es/packages/shortcut-provider/style/index.css +3 -0
  77. package/es/packages/shortcut-setter/constant/index.d.ts +4 -0
  78. package/es/packages/shortcut-setter/constant/index.js +7 -0
  79. package/es/packages/shortcut-setter/index.d.ts +4258 -0
  80. package/es/packages/shortcut-setter/index.js +11 -0
  81. package/es/packages/shortcut-setter/src/ShortcutSetter.js +4 -0
  82. package/es/packages/shortcut-setter/src/ShortcutSetter.vue.d.ts +4258 -0
  83. package/es/packages/shortcut-setter/src/ShortcutSetter.vue_vue_type_script_setup_true_lang.js +38 -0
  84. package/es/packages/shortcut-setter/src/ShortcutSetterItem.js +4 -0
  85. package/es/packages/shortcut-setter/src/ShortcutSetterItem.vue.d.ts +4238 -0
  86. package/es/packages/shortcut-setter/src/ShortcutSetterItem.vue_vue_type_script_setup_true_lang.js +125 -0
  87. package/es/packages/shortcut-setter/style/index.css +8 -0
  88. package/es/packages/steps-wheel/index.d.ts +548 -0
  89. package/es/packages/steps-wheel/index.js +11 -0
  90. package/es/packages/steps-wheel/src/StepsWheel.js +4 -0
  91. package/es/packages/steps-wheel/src/StepsWheel.vue.d.ts +547 -0
  92. package/es/packages/steps-wheel/src/StepsWheel.vue_vue_type_script_setup_true_lang.js +252 -0
  93. package/es/packages/steps-wheel/style/index.css +161 -0
  94. package/es/packages/time-line/index.d.ts +1 -0
  95. package/es/packages/time-line/src/TimeLine.vue.d.ts +1 -0
  96. package/es/packages/time-line/src/TimeLine.vue_vue_type_script_setup_true_lang.js +6 -1
  97. package/es/packages/time-line/style/index.css +7 -2
  98. package/es/src/types/index.d.ts +1 -0
  99. package/package.json +153 -153
  100. package/es/packages/button-print/src/utils/print.es.min.d.ts +0 -2
  101. package/es/packages/button-print/src/utils/print.es.min.js +0 -2532
  102. package/test.ts +0 -326
@@ -1,6 +1,6 @@
1
1
  import { reactive, onMounted, nextTick } from 'vue';
2
2
  import { fabric } from '../utils/index.js';
3
- import { defaultStyle, drawLine, drawPoint, defaultTextStyle } from './useDraw.js';
3
+ import { defaultStyle, drawPoint, drawLine, defaultTextStyle } from './useDraw.js';
4
4
  import useGrid from './useGrid.js';
5
5
  import { useShadow } from './useShadow.js';
6
6
  import { TEMPERATURE_MENU, PAIN_MENU } from './constant.js';
@@ -36,6 +36,8 @@ function useCenter(canvas, propItems, emits, cumputedX, cumputedY, getXValue, ge
36
36
  target: null
37
37
  });
38
38
  const shadowLinesCache = /* @__PURE__ */ new Set();
39
+ const maiboPoints = /* @__PURE__ */ new Set();
40
+ const otherPoints = /* @__PURE__ */ new Set();
39
41
  onMounted(() => {
40
42
  nextTick(() => {
41
43
  init();
@@ -43,11 +45,14 @@ function useCenter(canvas, propItems, emits, cumputedX, cumputedY, getXValue, ge
43
45
  });
44
46
  function init() {
45
47
  drawShaDow();
48
+ maiboPoints.clear();
49
+ otherPoints.clear();
46
50
  left.yScaleValue.forEach((scaleValue) => {
47
51
  scaleValue.dataList.forEach((item, dataIndex) => {
48
52
  drawPolyLine(item, dataIndex, scaleValue);
49
53
  });
50
54
  });
55
+ drawOverlapPoint();
51
56
  setCanvasEvent();
52
57
  }
53
58
  function drawShaDow(target) {
@@ -95,13 +100,15 @@ function useCenter(canvas, propItems, emits, cumputedX, cumputedY, getXValue, ge
95
100
  if (itemPrev && points1.length === 1) {
96
101
  const point = getPoint(itemPrev);
97
102
  points1.unshift(point);
98
- points2.unshift(point);
99
103
  }
100
- const pointNext = getPoint(itemNext);
101
- const pointNext2 = itemNext2 ? getPoint(itemNext2) : null;
102
- if (itemNext && pointNext2 && pointNext.x === pointNext2.x && pointNext.y === pointNext2.y) {
103
- points1.push(pointNext);
104
- points2.push(pointNext);
104
+ if (itemNext && itemNext2) {
105
+ const pointNext = getPoint(itemNext);
106
+ const pointNext2 = getPoint(itemNext2);
107
+ if (pointNext.x === pointNext2.x && pointNext.y === pointNext2.y) {
108
+ points1.push(pointNext);
109
+ }
110
+ } else {
111
+ data.push({ points1, points2 });
105
112
  }
106
113
  } else {
107
114
  if (points1.length && points2.length) {
@@ -116,20 +123,31 @@ function useCenter(canvas, propItems, emits, cumputedX, cumputedY, getXValue, ge
116
123
  const newData = data.reduce((pre, cur) => {
117
124
  const arr1 = cur.points1.map((v) => [v.x, v.y]);
118
125
  const arr2 = cur.points2.map((v) => [v.x, v.y]);
119
- const [, ...newArr2] = arr2;
120
- return pre.concat([[...arr1, ...newArr2.reverse()]]);
126
+ return pre.concat([[...arr1, ...arr2.reverse()]]);
121
127
  }, []);
122
128
  const { createShadowLines } = useShadow();
123
129
  newData.forEach((item) => {
124
- const shadowLines = createShadowLines(item, pulseObj.shadowStyle._angle, pulseObj.shadowStyle.space);
125
- shadowLines.forEach((l) => {
126
- Object.assign(l, {
130
+ var _a2, _b2, _c, _d;
131
+ if (((_a2 = pulseObj.shadow) == null ? void 0 : _a2.mode) == "color") {
132
+ const points = item.map((v) => ({ x: v[0], y: v[1] }));
133
+ const polygon = new fabric.Polygon(points, {
127
134
  ...defaultStyle,
128
- ...pulseObj.shadowStyle || {}
135
+ ...((_b2 = pulseObj.shadow) == null ? void 0 : _b2.style) || {}
129
136
  });
130
- shadowLinesCache.add(l);
131
- });
132
- canvas.value.add(...shadowLines);
137
+ shadowLinesCache.add(polygon);
138
+ canvas.value.add(polygon);
139
+ } else {
140
+ const shadowLines = createShadowLines(item, (_c = pulseObj.shadow) == null ? void 0 : _c.style._angle, (_d = pulseObj.shadow) == null ? void 0 : _d.style.space);
141
+ shadowLines.forEach((l) => {
142
+ var _a3;
143
+ Object.assign(l, {
144
+ ...defaultStyle,
145
+ ...((_a3 = pulseObj.shadow) == null ? void 0 : _a3.style) || {}
146
+ });
147
+ shadowLinesCache.add(l);
148
+ });
149
+ canvas.value.add(...shadowLines);
150
+ }
133
151
  canvas.value.renderAll();
134
152
  });
135
153
  }
@@ -180,13 +198,57 @@ function useCenter(canvas, propItems, emits, cumputedX, cumputedY, getXValue, ge
180
198
  }
181
199
  function getEqualXTypes(pointX) {
182
200
  const types = [];
201
+ const left2 = cumputedX(getXValue(pointX));
183
202
  canvas.value.forEachObject((obj) => {
184
- if (obj.origin && cumputedX(getXValue(pointX)) === obj.left) {
203
+ if (obj.origin && left2 === obj.left) {
185
204
  types.push(obj.origin.type);
186
205
  }
187
206
  });
188
207
  return [...new Set(types)];
189
208
  }
209
+ function drawOverlapPoint() {
210
+ var _a;
211
+ const pulseObj = left.yScaleValue.find((item) => item.type === "pulse");
212
+ if (!pulseObj || !((_a = pulseObj.dataList) == null ? void 0 : _a.length))
213
+ return;
214
+ if (!pulseObj.dataList.some((item) => item.title.includes("\u8109\u640F")))
215
+ return;
216
+ const overlap = left.overlap || {};
217
+ const points = [];
218
+ maiboPoints.size && [...maiboPoints].forEach((item) => {
219
+ [...otherPoints].forEach((obj) => {
220
+ if (obj.origin && item.left === obj.left && item.top === obj.top) {
221
+ const key = obj.origin.key;
222
+ if (key) {
223
+ const pointer = {
224
+ left: obj.left,
225
+ top: obj.top,
226
+ ...defaultStyle,
227
+ hoverCursor: "default"
228
+ };
229
+ let type = "koumai";
230
+ if (key === "yemai") {
231
+ type = key;
232
+ }
233
+ if (key === "humai") {
234
+ type = "circle";
235
+ }
236
+ points.push(drawPoint(type, {
237
+ ...overlap[key] || {},
238
+ ...pointer
239
+ }));
240
+ }
241
+ }
242
+ });
243
+ });
244
+ setTimeout(() => {
245
+ canvas.value.add(...points);
246
+ points.forEach((v) => {
247
+ v == null ? void 0 : v.bringToFront();
248
+ });
249
+ canvas.value.renderAll();
250
+ });
251
+ }
190
252
  function drawPolyLine(item, dataIndex, scaleValue) {
191
253
  const {
192
254
  pointAttr = {},
@@ -289,6 +351,7 @@ function useCenter(canvas, propItems, emits, cumputedX, cumputedY, getXValue, ge
289
351
  origin: {
290
352
  data: v,
291
353
  title: item.title,
354
+ key: item.key || "",
292
355
  unit: scaleValue.unit,
293
356
  type: scaleValue.type,
294
357
  dataIndex,
@@ -322,6 +385,11 @@ function useCenter(canvas, propItems, emits, cumputedX, cumputedY, getXValue, ge
322
385
  }
323
386
  lineList.push(line);
324
387
  if (point) {
388
+ if (item.title.includes("\u8109\u640F")) {
389
+ maiboPoints.add(point);
390
+ } else {
391
+ otherPoints.add(point);
392
+ }
325
393
  setPointEvent(point);
326
394
  pointList.push(point);
327
395
  }
@@ -432,8 +500,10 @@ function useCenter(canvas, propItems, emits, cumputedX, cumputedY, getXValue, ge
432
500
  return text;
433
501
  }
434
502
  function isLimit(time) {
435
- const minMinute = Math.min(...xScaleList.map((v) => +v));
436
- const maxMinute = Math.max(...xScaleList.map((v) => +v));
503
+ const [minScale] = xScaleList;
504
+ const maxScale = xScaleList.at(-1);
505
+ const minMinute = minScale.start;
506
+ const maxMinute = maxScale.end;
437
507
  const getTime = new Date(time).getTime();
438
508
  return getTime >= minMinute && getTime <= maxMinute;
439
509
  }
@@ -1,7 +1,7 @@
1
1
  import { IPropItems, IPointType } from '../interface';
2
2
  export declare function useCumputedPoint(propItems: IPropItems): {
3
- cumputedX: (value: number | string) => number;
3
+ cumputedX: (value: number | string) => any;
4
4
  cumputedY: (type: IPointType, scaleValueList: number[], value: number | string) => number;
5
- getXValue: (pointX: number) => string;
5
+ getXValue: (pointX: number) => string | undefined;
6
6
  getYValue: (type: IPointType, pointY: number) => number;
7
7
  };
@@ -1,13 +1,22 @@
1
1
  function useCumputedPoint(propItems) {
2
- const { xScaleList, xScaleCell, originX, endY, xCellWidth, left, vitalSignsOriginY, painOriginY } = propItems;
2
+ const { xScaleList, originX, endY, xCellWidth, left, vitalSignsOriginY, painOriginY, canvasWidth } = propItems;
3
3
  function cumputedX(value) {
4
4
  const time = new Date(value).getTime();
5
- const minScale = Math.min(...xScaleList.map((v) => +v));
6
- const i = Math.floor((time - minScale) / xScaleCell);
7
- if (xScaleList.includes(time)) {
8
- return originX + xCellWidth * i;
5
+ const [minScale] = xScaleList;
6
+ const maxScale = xScaleList.at(-1);
7
+ if (time < minScale.start)
8
+ return 0;
9
+ if (time > maxScale.end)
10
+ return canvasWidth;
11
+ const index = xScaleList.findIndex((v) => v.end >= time);
12
+ if (index > -1) {
13
+ const item = xScaleList[index];
14
+ if (time === item.start) {
15
+ return item.left;
16
+ } else {
17
+ return item.center;
18
+ }
9
19
  }
10
- return originX + xCellWidth * i + xCellWidth / 2;
11
20
  }
12
21
  function cumputedY(type, scaleValueList, value) {
13
22
  const yScaleCell = propItems[`${type}YCell`];
@@ -16,13 +25,18 @@ function useCumputedPoint(propItems) {
16
25
  return newEndY - yScaleCell * yCellUnit;
17
26
  }
18
27
  function getXValue(pointX) {
19
- const minScale = Math.min(...xScaleList.map((v) => +v));
20
- const time = minScale + (pointX - originX) / xCellWidth * xScaleCell;
21
- let d = new Date(time);
22
- const month = `00${d.getMonth() + 1}`.slice(-2);
23
- const day = `00${d.getDate()}`.slice(-2);
24
- const date = `${d.getFullYear()}-${month}-${day} ${d.getHours()}:00`;
25
- return date;
28
+ const index = xScaleList.findIndex((v) => v.left + xCellWidth >= pointX);
29
+ if (index > -1) {
30
+ const item = xScaleList[index];
31
+ const residueX = pointX - item.left;
32
+ const residueTime = item.scaleCell * residueX;
33
+ const time = item.start + residueTime;
34
+ let d = new Date(time);
35
+ const month = `00${d.getMonth() + 1}`.slice(-2);
36
+ const day = `00${d.getDate()}`.slice(-2);
37
+ const date = `${d.getFullYear()}-${month}-${day} ${d.getHours()}:${d.getMinutes()}`;
38
+ return date;
39
+ }
26
40
  }
27
41
  function getYValue(type, pointY) {
28
42
  var _a;
@@ -39,4 +39,4 @@ export declare const defaultTextStyle: {
39
39
  };
40
40
  export declare function drawLine(points: number[], style: Partial<ILineOptions>): fabric.Line;
41
41
  export declare function drawTextGroup(rectStyle: Partial<fabric.IRectOptions>, fontStyle: Partial<ITextOptions>, groupStyle: Partial<fabric.IGroupOptions>): fabric.Group;
42
- export declare function drawPoint(type: string | undefined, style: any): fabric.Circle | fabric.Triangle;
42
+ export declare function drawPoint(type: string | undefined, style: any): fabric.Object;
@@ -46,14 +46,17 @@ function drawTextGroup(rectStyle, fontStyle, groupStyle) {
46
46
  });
47
47
  const texts = new fabric.Text(String(fontStyle.value), {
48
48
  ...defaultTextStyle,
49
- ...fontStyle
49
+ ...fontStyle,
50
+ ...fontStyle.textAlign == "left" ? {
51
+ originX: "left",
52
+ left: -(rectStyle.width / 2)
53
+ } : {}
50
54
  });
51
55
  return new fabric.Group([rect, texts], {
52
56
  ...groupStyle
53
57
  });
54
58
  }
55
59
  function drawPoint(type = "circle", style) {
56
- let point = null;
57
60
  const newStyle = {
58
61
  originX: "center",
59
62
  originY: "center",
@@ -61,27 +64,81 @@ function drawPoint(type = "circle", style) {
61
64
  hasBorders: false,
62
65
  ...style
63
66
  };
67
+ const createCircleBorder = () => {
68
+ return new fabric.Circle({
69
+ objectCaching: false,
70
+ strokeWidth: style.strokeWidth || 1,
71
+ stroke: style.stroke || "red",
72
+ radius: style.radius || 5,
73
+ fill: "#fff"
74
+ });
75
+ };
64
76
  switch (type) {
65
77
  case "triangle":
66
- point = new fabric.Triangle({
78
+ return new fabric.Triangle({
67
79
  width: 20,
68
80
  height: 20,
69
81
  strokeWidth: 1,
70
82
  scale: 1,
71
83
  ...newStyle
72
84
  });
73
- break;
74
85
  case "circle":
75
- point = new fabric.Circle({
86
+ return new fabric.Circle({
76
87
  objectCaching: false,
77
88
  strokeWidth: 1,
78
89
  radius: 5,
79
90
  scale: 1,
80
91
  ...newStyle
81
92
  });
82
- break;
93
+ case "image":
94
+ if (style == null ? void 0 : style.url) ; else {
95
+ return new fabric.Image(style.element, {
96
+ ...newStyle,
97
+ scale: 1
98
+ });
99
+ }
100
+ case "yemai":
101
+ const createAdd = () => {
102
+ const width = ((style.radius || 5) + (style.strokeWidth || 1)) * 2;
103
+ const subLineStyle = {
104
+ stroke: style.strokeX || "blue",
105
+ strokeWidth: style.strokeWidthX || 1,
106
+ originX: "center",
107
+ originY: "center"
108
+ };
109
+ const line1 = new fabric.Line([0, width / 2, width, width / 2], subLineStyle);
110
+ const line2 = new fabric.Line([width / 2, 0, width / 2, width], subLineStyle);
111
+ return new fabric.Group([line1, line2]);
112
+ };
113
+ return new fabric.Group([createCircleBorder(), createAdd()], {
114
+ scale: 1,
115
+ ...newStyle
116
+ });
117
+ case "koumai":
118
+ const left = (style.radius || 5) + (style.strokeWidth || 1);
119
+ const circle = new fabric.Circle({
120
+ objectCaching: false,
121
+ radius: style.radiusCircle || 2,
122
+ fill: style.fillCircle || "#000",
123
+ originX: "center",
124
+ originY: "center",
125
+ left,
126
+ top: left
127
+ });
128
+ return new fabric.Group([createCircleBorder(), circle], {
129
+ scale: 1,
130
+ ...newStyle
131
+ });
132
+ default:
133
+ style && Reflect.deleteProperty(style, "stroke");
134
+ return new fabric.Text(String(type), {
135
+ fontFamily: "\u5FAE\u8F6F\u96C5\u9ED1",
136
+ scale: 1,
137
+ fontSize: 14,
138
+ fill: "#000",
139
+ ...newStyle
140
+ });
83
141
  }
84
- return point;
85
142
  }
86
143
 
87
144
  export { defaultBorderStyle, defaultLineStyle, defaultRectStyle, defaultStyle, defaultTextStyle, drawLine, drawPoint, drawTextGroup };
@@ -17,6 +17,36 @@ function useLeft(canvas, propItems, emits, setPopup, pointTipProps, getXValue, g
17
17
  iconsWidth,
18
18
  itemList
19
19
  } = propItems;
20
+ const mainScaleWidth = 9;
21
+ const subScaleWidth = 5;
22
+ function drawScaleNumber(text, item, left2, top) {
23
+ return new fabric.Text(String(text), {
24
+ ...defaultTextStyle,
25
+ originX: item.position || "center",
26
+ left: left2,
27
+ top,
28
+ ...item.style
29
+ });
30
+ }
31
+ function getScaleInfo(position = "center", x, width) {
32
+ let scaleLeft = x + width / 2;
33
+ let lineXMain = [scaleLeft - mainScaleWidth / 2, scaleLeft + mainScaleWidth / 2];
34
+ let lineXSub = [scaleLeft - subScaleWidth / 2, scaleLeft + subScaleWidth / 2];
35
+ let textLeft = scaleLeft;
36
+ if (position === "left") {
37
+ scaleLeft = x;
38
+ lineXMain = [scaleLeft, scaleLeft + mainScaleWidth];
39
+ lineXSub = [scaleLeft, scaleLeft + subScaleWidth];
40
+ textLeft = lineXMain[1];
41
+ }
42
+ if (position === "right") {
43
+ scaleLeft = x + width;
44
+ lineXMain = [scaleLeft - mainScaleWidth, scaleLeft];
45
+ lineXSub = [scaleLeft - subScaleWidth, scaleLeft];
46
+ textLeft = lineXMain[0];
47
+ }
48
+ return { lineXMain, lineXSub, textLeft };
49
+ }
20
50
  function drwaPainScaleValue(item) {
21
51
  const title = drawTextGroup({
22
52
  width: originX - iconsWidth,
@@ -32,17 +62,26 @@ ${item.title.slice(-2)}`,
32
62
  top: painOriginY.originY
33
63
  });
34
64
  const list = [];
35
- item.list.forEach((v, i) => {
36
- const top = painOriginY.endY - i * yCellHeight * item.spaceGridNumber;
37
- const text = new fabric.Text(String(v), {
38
- ...defaultTextStyle,
39
- originX: "right",
40
- left: originX - (item.marginRight || 3),
41
- top: i === 0 ? endY - 5 : top,
42
- ...item.style
65
+ if (item.showScale || item.showNumber) {
66
+ const { lineXMain, textLeft } = getScaleInfo(item.position, iconsWidth, originX - iconsWidth);
67
+ item.list.forEach((v, i) => {
68
+ let top = painOriginY.endY - i * yCellHeight * item.spaceGridNumber;
69
+ if (i === 0) {
70
+ top = endY - 5;
71
+ }
72
+ if (item.showNumber) {
73
+ list.push(drawScaleNumber(v, item, textLeft, top));
74
+ }
75
+ if (item.showScale && i !== 0) {
76
+ const [x1, x2] = lineXMain;
77
+ const line = new fabric.Line([x1, top, x2, top], {
78
+ ...defaultBorderStyle,
79
+ ...item.style
80
+ });
81
+ list.push(line);
82
+ }
43
83
  });
44
- list.push(text);
45
- });
84
+ }
46
85
  canvas.value.add(title, ...list);
47
86
  }
48
87
  function drawScaleValue() {
@@ -63,24 +102,46 @@ ${item.title.slice(-2)}`,
63
102
  ...defaultBorderStyle
64
103
  }) : null;
65
104
  line && list.push(line);
66
- const leftVal = rectLeft + rectWidth / 2;
67
- const spaceGridNumber = left.spaceGridNumber || 5;
68
- item.list.forEach((v, i) => {
69
- const top = vitalSignsOriginY.endY - i * yCellHeight * spaceGridNumber;
70
- const text = new fabric.Text(String(v), {
71
- ...defaultTextStyle,
72
- left: leftVal,
73
- top: i === 0 ? top - 5 : top,
74
- ...item.style
105
+ const centerX = rectLeft + rectWidth / 2;
106
+ const spaceGridNumber = item.spaceGridNumber || 5;
107
+ if (item.showScale || item.showNumber) {
108
+ const spaceScale = spaceGridNumber * yCellHeight / 5;
109
+ const position = item.position || "center";
110
+ const { lineXMain, lineXSub, textLeft } = getScaleInfo(item.position, rectLeft, rectWidth);
111
+ item.list.forEach((v, i) => {
112
+ const top = vitalSignsOriginY.endY - i * yCellHeight * spaceGridNumber;
113
+ if (item.showNumber) {
114
+ const text = drawScaleNumber(v, item, textLeft, i === 0 ? top - 5 : top);
115
+ list.push(text);
116
+ }
117
+ if (item.showScale && i !== item.list.length - 1) {
118
+ for (let j = 0; j < 5; j++) {
119
+ if (j > 0 || !item.showNumber || position !== "center") {
120
+ let createLine = function(points) {
121
+ const line2 = new fabric.Line(points, {
122
+ ...defaultBorderStyle,
123
+ ...item.style
124
+ });
125
+ list.push(line2);
126
+ };
127
+ const x1 = j == 0 ? lineXMain[0] : lineXSub[0];
128
+ const x2 = j == 0 ? lineXMain[1] : lineXSub[1];
129
+ const y = top - j * spaceScale;
130
+ createLine([x1, y, x2, y]);
131
+ if (i == item.list.length - 2 && j == 4) {
132
+ createLine([lineXMain[0], y - spaceScale, lineXMain[1], y - spaceScale]);
133
+ }
134
+ }
135
+ }
136
+ }
75
137
  });
76
- list.push(text);
77
- });
138
+ }
78
139
  let title = item.title || "";
79
140
  if (item.unit)
80
141
  title += "\n" + item.unit;
81
142
  title && list.push(new fabric.Text(String(title), {
82
143
  ...defaultTextStyle,
83
- left: leftVal,
144
+ left: centerX,
84
145
  top: vitalSignsOriginY.originY + yCellHeight * spaceGridNumber / 2,
85
146
  textAlign: "center",
86
147
  ...item.style
@@ -9,13 +9,14 @@ function useOther(canvas, propItems, cumputedX) {
9
9
  return false;
10
10
  const list = [];
11
11
  other.list.forEach((v, i) => {
12
+ var _a;
12
13
  const text = new fabric.Text(String(v.value.toString().split("").join("\n")), {
13
14
  originX: "center",
14
- top: vitalSignsOriginY.originY,
15
+ top: (((_a = v.style) == null ? void 0 : _a.baseTop) || 0) + vitalSignsOriginY.originY,
15
16
  left: cumputedX(v.time),
16
17
  textAlign: "center",
17
18
  ...defaultStyle,
18
- ...other.style || {}
19
+ ...v.style || {}
19
20
  });
20
21
  list.push(text);
21
22
  });
@@ -101,7 +101,7 @@ function useShadow() {
101
101
  let counter = 0;
102
102
  let xinters;
103
103
  let p1, p2;
104
- let pointCount = polygonPoints.length;
104
+ const pointCount = polygonPoints.length;
105
105
  p1 = polygonPoints[0];
106
106
  for (let i = 1; i <= pointCount; i++) {
107
107
  p2 = polygonPoints[i % pointCount];
@@ -35,7 +35,7 @@ function useTop(canvas, propItems) {
35
35
  }
36
36
  if (item.key == "xScalevalue") {
37
37
  drawDay(list, topY);
38
- drawTime(list, topY);
38
+ drawTime(item, list, topY);
39
39
  } else {
40
40
  propItems[`${item.key}Height`] && drawDate(item, list, topY);
41
41
  }
@@ -44,7 +44,7 @@ function useTop(canvas, propItems) {
44
44
  group && group.sendToBack();
45
45
  group && canvas.value.add(group);
46
46
  }
47
- function drawTime(list, topY) {
47
+ function drawTime(item, list, topY) {
48
48
  var _a;
49
49
  const dayHeight = top.xScalevalue.show ? top.dayHeight || 0 : 0;
50
50
  const height = xScalevalueHeight - dayHeight;
@@ -55,7 +55,8 @@ function useTop(canvas, propItems) {
55
55
  }, {
56
56
  value: top.xScalevalue.title,
57
57
  ...defaultTextStyle,
58
- ...((_a = top.date) == null ? void 0 : _a.style) || {}
58
+ ...((_a = top.date) == null ? void 0 : _a.style) || {},
59
+ ...item.titleStyle || {}
59
60
  }, {
60
61
  left: iconsWidth,
61
62
  top: topY
@@ -115,7 +116,8 @@ function useTop(canvas, propItems) {
115
116
  }, {
116
117
  value: item.title,
117
118
  ...defaultTextStyle,
118
- ...(item == null ? void 0 : item.style) || {}
119
+ ...(item == null ? void 0 : item.style) || {},
120
+ ...item.titleStyle || {}
119
121
  }, {
120
122
  left: iconsWidth,
121
123
  top: topY
@@ -43,8 +43,7 @@ export interface IPropItems {
43
43
  endY: number;
44
44
  xCellWidth: number;
45
45
  yCellHeight: number;
46
- xScaleList: Array<string | number>;
47
- xScaleCell: number;
46
+ xScaleList: Array<any>;
48
47
  breatheYCell: number;
49
48
  pulseYCell: number;
50
49
  temperatureYCell: number;
@@ -80,6 +79,7 @@ export interface ITop {
80
79
  operationDays?: IDate;
81
80
  }
82
81
  interface ILeft {
82
+ overlap?: any;
83
83
  spaceGridNumber?: number;
84
84
  yScaleValue: Array<any>;
85
85
  icons?: any;