cnhis-design-vue 3.1.12-beta.5 → 3.1.12

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 (68) hide show
  1. package/es/packages/big-table/index.d.ts +4 -9
  2. package/es/packages/big-table/src/BigTable.vue.d.ts +15 -12
  3. package/es/packages/big-table/src/BigTable.vue_vue_type_script_setup_true_lang.js +87 -63
  4. package/es/packages/big-table/src/bigTableState.d.ts +2 -0
  5. package/es/packages/big-table/src/bigTableState.js +1 -1
  6. package/es/packages/big-table/src/hooks/useFormat.js +1 -1
  7. package/es/packages/big-table/src/hooks/useNestTable.js +1 -1
  8. package/es/packages/big-table/src/utils.d.ts +5 -1
  9. package/es/packages/big-table/src/utils.js +100 -78
  10. package/es/packages/fabric-chart/index.d.ts +195 -1
  11. package/es/packages/fabric-chart/src/FabricChart.vue.d.ts +196 -1
  12. package/es/packages/fabric-chart/src/FabricChart.vue_vue_type_script_setup_true_lang.js +269 -6
  13. package/es/packages/fabric-chart/src/components/PopupMenu.d.ts +46 -0
  14. package/es/packages/fabric-chart/src/components/PopupMenu.js +105 -0
  15. package/es/packages/fabric-chart/src/components/PopupTip.js +4 -0
  16. package/es/packages/fabric-chart/src/components/PopupTip.vue.d.ts +63 -0
  17. package/es/packages/fabric-chart/src/components/PopupTip.vue_vue_type_script_setup_true_lang.js +32 -0
  18. package/es/packages/fabric-chart/src/components/useStyle.d.ts +7 -0
  19. package/es/packages/fabric-chart/src/components/useStyle.js +36 -0
  20. package/es/packages/fabric-chart/src/hooks/constant.d.ts +14 -0
  21. package/es/packages/fabric-chart/src/hooks/constant.js +36 -0
  22. package/es/packages/fabric-chart/src/hooks/index.d.ts +9 -0
  23. package/es/packages/fabric-chart/src/hooks/index.js +9 -0
  24. package/es/packages/fabric-chart/src/hooks/useBottom.d.ts +4 -0
  25. package/es/packages/fabric-chart/src/hooks/useBottom.js +86 -0
  26. package/es/packages/fabric-chart/src/hooks/useCenter.d.ts +29 -0
  27. package/es/packages/fabric-chart/src/hooks/useCenter.js +469 -0
  28. package/es/packages/fabric-chart/src/hooks/useCumputedPoint.d.ts +7 -0
  29. package/es/packages/fabric-chart/src/hooks/useCumputedPoint.js +44 -0
  30. package/es/packages/fabric-chart/src/hooks/useDraw.d.ts +42 -0
  31. package/es/packages/fabric-chart/src/hooks/useDraw.js +86 -0
  32. package/es/packages/fabric-chart/src/hooks/useEvent.d.ts +1 -0
  33. package/es/packages/fabric-chart/src/hooks/useEvent.js +10 -0
  34. package/es/packages/fabric-chart/src/hooks/useGrid.d.ts +4 -0
  35. package/es/packages/fabric-chart/src/hooks/useGrid.js +44 -0
  36. package/es/packages/fabric-chart/src/hooks/useLeft.d.ts +4 -0
  37. package/es/packages/fabric-chart/src/hooks/useLeft.js +180 -0
  38. package/es/packages/fabric-chart/src/hooks/useOther.d.ts +4 -0
  39. package/es/packages/fabric-chart/src/hooks/useOther.js +34 -0
  40. package/es/packages/fabric-chart/src/hooks/useRight.d.ts +4 -0
  41. package/es/packages/fabric-chart/src/hooks/useRight.js +89 -0
  42. package/es/packages/fabric-chart/src/hooks/useShadow.d.ts +6 -0
  43. package/es/packages/fabric-chart/src/hooks/useShadow.js +127 -0
  44. package/es/packages/fabric-chart/src/hooks/useTop.d.ts +4 -0
  45. package/es/packages/fabric-chart/src/hooks/useTop.js +148 -0
  46. package/es/packages/fabric-chart/src/interface.d.ts +115 -0
  47. package/es/packages/fabric-chart/src/interface.js +3 -0
  48. package/es/packages/fabric-chart/src/utils/index.d.ts +2 -0
  49. package/es/packages/fabric-chart/src/utils/index.js +15081 -0
  50. package/es/packages/fabric-chart/style/index.css +43 -0
  51. package/es/packages/form-render/src/components/renderer/cascader.js +14 -0
  52. package/es/packages/form-render/src/components/renderer/checkbox.d.ts +2 -0
  53. package/es/packages/form-render/src/components/renderer/checkbox.js +4 -5
  54. package/es/packages/form-render/src/components/renderer/date.js +42 -10
  55. package/es/packages/form-render/src/components/renderer/index.d.ts +1 -0
  56. package/es/packages/form-render/src/components/renderer/index.js +1 -0
  57. package/es/packages/form-render/src/components/renderer/linebar.js +1 -1
  58. package/es/packages/form-render/src/components/renderer/select.js +11 -0
  59. package/es/packages/form-render/src/components/renderer/simpleComponent.d.ts +2 -0
  60. package/es/packages/form-render/src/components/renderer/simpleComponent.js +64 -0
  61. package/es/packages/form-render/src/components/renderer/slider.js +1 -1
  62. package/es/packages/form-render/src/hooks/useFieldListAdaptor.d.ts +1 -1
  63. package/es/packages/form-render/src/hooks/useFieldListAdaptor.js +24 -15
  64. package/es/packages/index.css +50 -0
  65. package/es/packages/scale-view/src/hooks/scaleview-computed.js +7 -12
  66. package/es/packages/scale-view/src/hooks/scaleview-init.js +1 -6
  67. package/es/packages/select-label/style/index.css +7 -0
  68. package/package.json +2 -2
@@ -1 +1,470 @@
1
+ import { reactive, onMounted, nextTick } from 'vue';
2
+ import { fabric } from '../utils/index.js';
3
+ import { defaultStyle, drawLine, drawPoint, defaultTextStyle } from './useDraw.js';
4
+ import useGrid from './useGrid.js';
5
+ import { useShadow } from './useShadow.js';
6
+ import { TEMPERATURE_MENU, PAIN_MENU } from './constant.js';
1
7
 
8
+ function isEffectiveNode(node) {
9
+ return (node == null ? void 0 : node.time) && ((node == null ? void 0 : node.value) || (node == null ? void 0 : node.value) === 0);
10
+ }
11
+ function useCenter(canvas, propItems, emits, cumputedX, cumputedY, getXValue, getYValue, addRenderItem) {
12
+ useGrid(canvas, propItems);
13
+ const {
14
+ left,
15
+ xScaleList,
16
+ yCellHeight,
17
+ originX,
18
+ endX,
19
+ originY,
20
+ endY,
21
+ itemList,
22
+ painIndex,
23
+ painHeight,
24
+ vitalSignsOriginY,
25
+ painOriginY
26
+ } = propItems;
27
+ const pointTipProps = reactive({
28
+ show: false,
29
+ point: { x: 0, y: 0 },
30
+ list: []
31
+ });
32
+ const pointMenuProps = reactive({
33
+ show: false,
34
+ point: { x: 0, y: 0 },
35
+ list: [],
36
+ target: null
37
+ });
38
+ const shadowLinesCache = /* @__PURE__ */ new Set();
39
+ onMounted(() => {
40
+ nextTick(() => {
41
+ init();
42
+ });
43
+ });
44
+ function init() {
45
+ drawShaDow();
46
+ left.yScaleValue.forEach((scaleValue) => {
47
+ scaleValue.dataList.forEach((item, dataIndex) => {
48
+ drawPolyLine(item, dataIndex, scaleValue);
49
+ });
50
+ });
51
+ setCanvasEvent();
52
+ }
53
+ function drawShaDow(target) {
54
+ var _a, _b;
55
+ const pulseObj = left.yScaleValue.find((item) => item.type === "pulse");
56
+ if (!pulseObj || !((_a = pulseObj.dataList) == null ? void 0 : _a.length))
57
+ return;
58
+ if (shadowLinesCache.size)
59
+ canvas.value.remove(...shadowLinesCache);
60
+ shadowLinesCache.clear();
61
+ const data = [];
62
+ if (((_b = pulseObj.dataList) == null ? void 0 : _b.length) > 1) {
63
+ let points1 = [];
64
+ let points2 = [];
65
+ const copyDataList = JSON.parse(JSON.stringify(pulseObj.dataList));
66
+ if (target) {
67
+ const { type, dataIndex, index } = target.origin || {};
68
+ if (type === "pulse") {
69
+ Object.assign(copyDataList[dataIndex].list[index], {
70
+ x: target.left,
71
+ y: target.top
72
+ });
73
+ }
74
+ }
75
+ const [data1, data2] = copyDataList;
76
+ const getPoint = (item) => {
77
+ return item.x && item.y ? {
78
+ x: item.x,
79
+ y: item.y
80
+ } : {
81
+ x: cumputedX(item.time),
82
+ y: cumputedY(pulseObj.type, pulseObj.list, item.value)
83
+ };
84
+ };
85
+ data1.list.forEach((item, index) => {
86
+ const point1 = getPoint(item);
87
+ const item2 = data2.list[index];
88
+ const point2 = item2 ? getPoint(item2) : null;
89
+ if (point2 && point1.x === point2.x && point1.y !== point2.y) {
90
+ points1.push(point1);
91
+ points2.push(point2);
92
+ const itemPrev = data1.list[index - 1];
93
+ const itemNext = data1.list[index + 1];
94
+ const itemNext2 = data2.list[index + 1];
95
+ if (itemPrev && points1.length === 1) {
96
+ const point = getPoint(itemPrev);
97
+ points1.unshift(point);
98
+ points2.unshift(point);
99
+ }
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);
105
+ }
106
+ } else {
107
+ if (points1.length && points2.length) {
108
+ data.push({ points1, points2 });
109
+ points1 = [];
110
+ points2 = [];
111
+ }
112
+ }
113
+ });
114
+ }
115
+ if (data.length) {
116
+ const newData = data.reduce((pre, cur) => {
117
+ const arr1 = cur.points1.map((v) => [v.x, v.y]);
118
+ const arr2 = cur.points2.map((v) => [v.x, v.y]);
119
+ const [, ...newArr2] = arr2;
120
+ return pre.concat([[...arr1, ...newArr2.reverse()]]);
121
+ }, []);
122
+ const { createShadowLines } = useShadow();
123
+ newData.forEach((item) => {
124
+ const shadowLines = createShadowLines(item, pulseObj.shadowStyle._angle, pulseObj.shadowStyle.space);
125
+ shadowLines.forEach((l) => {
126
+ Object.assign(l, {
127
+ ...defaultStyle,
128
+ ...pulseObj.shadowStyle || {}
129
+ });
130
+ shadowLinesCache.add(l);
131
+ });
132
+ canvas.value.add(...shadowLines);
133
+ canvas.value.renderAll();
134
+ });
135
+ }
136
+ }
137
+ function setCanvasEvent() {
138
+ canvas.value.on("mouse:up", (event) => {
139
+ var _a;
140
+ if (event.button === 3) {
141
+ const { x = 0, y = 0 } = event.pointer || {};
142
+ if (x >= originX && x <= endX && y >= originY && y <= endY) {
143
+ pointTipProps.show = false;
144
+ pointMenuProps.point = { x, y };
145
+ pointMenuProps.show = true;
146
+ const { type } = ((_a = event.target) == null ? void 0 : _a.origin) || {};
147
+ if (event.target && (type === "temperature" || type === "pain")) {
148
+ if (type === "temperature") {
149
+ pointMenuProps.list = [...TEMPERATURE_MENU];
150
+ }
151
+ if (type === "pain") {
152
+ pointMenuProps.list = [...PAIN_MENU];
153
+ }
154
+ pointMenuProps.target = event.target;
155
+ } else {
156
+ pointMenuProps.target = null;
157
+ pointMenuProps.list = ["\u65B0\u589E\u8282\u70B9"];
158
+ itemList.forEach((v) => {
159
+ if (!getEqualXTypes(x).includes(v.bigType)) {
160
+ pointMenuProps.list.push({
161
+ renderItem: addRenderItem ? addRenderItem(v) : () => v.title,
162
+ origin: {
163
+ title: v.title,
164
+ unit: v.unit,
165
+ type: v.bigType,
166
+ dataIndex: v.dataIndex
167
+ },
168
+ pointer: event.pointer
169
+ });
170
+ }
171
+ });
172
+ if (pointMenuProps.list.length === 1) {
173
+ pointMenuProps.show = false;
174
+ console.log("\u5F53\u524D\u65F6\u95F4\u6BB5\u5185\u65E0\u53EF\u65B0\u589E\u8282\u70B9");
175
+ }
176
+ }
177
+ }
178
+ }
179
+ });
180
+ }
181
+ function getEqualXTypes(pointX) {
182
+ const types = [];
183
+ canvas.value.forEachObject((obj) => {
184
+ if (obj.origin && cumputedX(getXValue(pointX)) === obj.left) {
185
+ types.push(obj.origin.type);
186
+ }
187
+ });
188
+ return [...new Set(types)];
189
+ }
190
+ function drawPolyLine(item, dataIndex, scaleValue) {
191
+ const {
192
+ pointAttr = {},
193
+ lineAttr = {},
194
+ noRiseStyle = {},
195
+ verifiedStyle = {},
196
+ coolingStyle = {},
197
+ type = "circle"
198
+ } = item;
199
+ const pointList = [];
200
+ const lineList = [];
201
+ const otherList = [];
202
+ item.list.forEach((v, index) => {
203
+ const newY = scaleValue.type === "pain" ? painOriginY : vitalSignsOriginY;
204
+ let points = null;
205
+ if (isEffectiveNode(v)) {
206
+ const x = cumputedX(v.time);
207
+ const y = cumputedY(scaleValue.type, scaleValue.list, v.value);
208
+ if (isLimit(v.time)) {
209
+ points = [x, y < newY.originY ? newY.originY : y > newY.endY ? newY.endY : y];
210
+ }
211
+ }
212
+ const nextV = item.list[index + 1];
213
+ let nextPoint = null;
214
+ if (isEffectiveNode(nextV)) {
215
+ const nextX = cumputedX(nextV.time);
216
+ const nextY = cumputedY(scaleValue.type, scaleValue.list, nextV.value);
217
+ if (isLimit(nextV.time)) {
218
+ nextPoint = [nextX, nextY < newY.originY ? newY.originY : nextY > newY.endY ? newY.endY : nextY];
219
+ }
220
+ }
221
+ let coolLine, coolPoint, noRiseText, arrowGroup, verifiedText;
222
+ if (points && scaleValue.type === "temperature") {
223
+ if (v.noRise) {
224
+ if (typeof v.noRise === "string") {
225
+ noRiseText = drawText([points[0], points[1] + 5], {
226
+ value: v.noRise.split("").join("\n"),
227
+ originY: "top",
228
+ ...noRiseStyle
229
+ });
230
+ otherList.push(noRiseText);
231
+ } else {
232
+ const top = points[1] + yCellHeight * 2;
233
+ const arrowLine = drawLine([...points, points[0], top], {
234
+ ...lineAttr,
235
+ stroke: noRiseStyle.fill
236
+ });
237
+ const arrow = drawText([points[0] + 0.5, top + 3], {
238
+ value: "v",
239
+ originX: "center",
240
+ originY: "bottom",
241
+ fontSize: 16,
242
+ ...noRiseStyle
243
+ });
244
+ arrowGroup = new fabric.Group([arrowLine, arrow], {
245
+ ...defaultStyle,
246
+ originX: "center",
247
+ originY: "top"
248
+ });
249
+ otherList.push(arrowGroup);
250
+ }
251
+ }
252
+ if (v.verified) {
253
+ verifiedText = drawText([points[0], points[1] - 5], {
254
+ value: "v",
255
+ originX: "center",
256
+ originY: "bottom",
257
+ ...verifiedStyle
258
+ });
259
+ otherList.push(verifiedText);
260
+ }
261
+ if (v.physicalCooling || v.drugCooling) {
262
+ const coolingLineStyle = {
263
+ ...lineAttr,
264
+ stroke: coolingStyle.stroke,
265
+ strokeDashArray: [3, 3]
266
+ };
267
+ const coolY = cumputedY(scaleValue.type, scaleValue.list, v.physicalCooling || v.drugCooling);
268
+ coolLine = drawLine([...points, points[0], coolY], {
269
+ ...coolingLineStyle
270
+ });
271
+ coolPoint = drawPoint("circle", {
272
+ left: points[0],
273
+ top: coolY,
274
+ ...coolingStyle,
275
+ ...defaultStyle
276
+ });
277
+ coolLine && otherList.push(coolLine);
278
+ coolPoint && otherList.push(coolPoint);
279
+ }
280
+ }
281
+ let line;
282
+ let point;
283
+ let previousLine;
284
+ line = points && nextPoint && !v.breakpoint ? drawLine([...points, ...nextPoint], {
285
+ ...lineAttr
286
+ }) : null;
287
+ previousLine = lineList[index - 1];
288
+ const pointAttrNew = {
289
+ origin: {
290
+ data: v,
291
+ title: item.title,
292
+ unit: scaleValue.unit,
293
+ type: scaleValue.type,
294
+ dataIndex,
295
+ index
296
+ },
297
+ noRiseText,
298
+ arrowGroup,
299
+ verifiedText,
300
+ leftLine: previousLine,
301
+ rightLine: line,
302
+ coolLine,
303
+ coolPoint,
304
+ lockMovementX: true,
305
+ ...pointAttr
306
+ };
307
+ if (previousLine) {
308
+ point = drawPoint(type, {
309
+ left: previousLine.get("x2"),
310
+ top: previousLine.get("y2"),
311
+ ...pointAttrNew
312
+ });
313
+ } else {
314
+ if (points) {
315
+ pointAttrNew.leftLine = null;
316
+ point = drawPoint(type, {
317
+ left: points[0],
318
+ top: points[1],
319
+ ...pointAttrNew
320
+ });
321
+ }
322
+ }
323
+ lineList.push(line);
324
+ if (point) {
325
+ setPointEvent(point);
326
+ pointList.push(point);
327
+ }
328
+ });
329
+ Promise.all(pointList).then((res) => {
330
+ const lineListFilter = lineList.filter((v) => v);
331
+ let prevPoint = null;
332
+ res = res.filter((v) => {
333
+ if (v && prevPoint) {
334
+ prevPoint.nextPoint = v;
335
+ v.prevPoint = prevPoint;
336
+ }
337
+ prevPoint = v || prevPoint;
338
+ v == null ? void 0 : v.bringToFront();
339
+ return v;
340
+ });
341
+ Promise.all(otherList).then((r) => {
342
+ canvas.value.add(...lineListFilter, ...res, ...r);
343
+ res.forEach((v) => {
344
+ v == null ? void 0 : v.bringToFront();
345
+ });
346
+ canvas.value.requestRenderAll();
347
+ });
348
+ });
349
+ }
350
+ function setPointEvent(point) {
351
+ point.on("mouseover", () => {
352
+ setPopup(point);
353
+ });
354
+ point.on("mouseout", () => {
355
+ pointTipProps.show = false;
356
+ });
357
+ point.on("moving", () => {
358
+ moveLimit(point);
359
+ updateLine(point);
360
+ canvas.value.renderAll();
361
+ setPopup(point);
362
+ });
363
+ point.on("mouseup:before", (event) => {
364
+ pointTipProps.show = false;
365
+ if (event.e.button === 0) {
366
+ const { type } = point.origin;
367
+ const value = getYValue(type, point.top);
368
+ emits("change", {
369
+ ...point.origin,
370
+ data: {
371
+ ...point.origin.data,
372
+ value
373
+ }
374
+ });
375
+ }
376
+ });
377
+ }
378
+ function setPopup(point) {
379
+ const { title, unit, type, data } = point.origin;
380
+ pointTipProps.point = {
381
+ x: point.left,
382
+ y: point.top
383
+ };
384
+ const yValue = getYValue(type, point.top);
385
+ pointTipProps.list = [`${title} ${yValue}${unit || ""}`, `\u65F6\u95F4 ${((data == null ? void 0 : data.time) || getXValue(point.left)).slice(-5)}`];
386
+ pointTipProps.show = true;
387
+ }
388
+ function moveLimit(point) {
389
+ point.setCoords();
390
+ const newY = point.origin.type === "pain" ? painOriginY : vitalSignsOriginY;
391
+ if (point.top < newY.originY) {
392
+ point.set("top", newY.originY);
393
+ }
394
+ if (point.top > newY.endY) {
395
+ point.set("top", newY.endY);
396
+ }
397
+ }
398
+ function updateLine(point) {
399
+ if (point.leftLine) {
400
+ point.leftLine.setCoords();
401
+ point.leftLine.set({ x2: point.left, y2: point.top });
402
+ }
403
+ if (point.rightLine) {
404
+ point.rightLine.setCoords();
405
+ point.rightLine.set({ x1: point.left, y1: point.top });
406
+ }
407
+ if (point.coolLine) {
408
+ point.coolLine.setCoords();
409
+ point.coolLine.set({ x1: point.left, y1: point.top });
410
+ }
411
+ if (point.noRiseText) {
412
+ point.noRiseText.setCoords();
413
+ point.noRiseText.set({ left: point.left, top: point.top + 5 });
414
+ }
415
+ if (point.arrowGroup) {
416
+ point.arrowGroup.setCoords();
417
+ point.arrowGroup.set({ left: point.left, top: point.top });
418
+ }
419
+ if (point.verifiedText) {
420
+ point.verifiedText.setCoords();
421
+ point.verifiedText.set({ left: point.left, top: point.top - 5 });
422
+ }
423
+ drawShaDow(point);
424
+ }
425
+ function drawText([x, y], style) {
426
+ const text = new fabric.Text(style.value, {
427
+ ...defaultTextStyle,
428
+ left: x,
429
+ top: y,
430
+ ...style
431
+ });
432
+ return text;
433
+ }
434
+ function isLimit(time) {
435
+ const minMinute = Math.min(...xScaleList.map((v) => +v));
436
+ const maxMinute = Math.max(...xScaleList.map((v) => +v));
437
+ const getTime = new Date(time).getTime();
438
+ return getTime >= minMinute && getTime <= maxMinute;
439
+ }
440
+ function clickMenu({ item, target }) {
441
+ if (!target) {
442
+ emits("add", {
443
+ data: {
444
+ time: getXValue(item.pointer.x),
445
+ value: getYValue(item.origin.type, item.pointer.y)
446
+ },
447
+ ...item.origin
448
+ });
449
+ } else {
450
+ const data = {
451
+ time: target.origin.data.time,
452
+ value: target.origin.data.value
453
+ };
454
+ data[`${item.type}`] = item.value;
455
+ emits("change", {
456
+ ...target.origin,
457
+ data
458
+ });
459
+ }
460
+ }
461
+ return {
462
+ pointTipProps,
463
+ pointMenuProps,
464
+ clickMenu,
465
+ setPopup,
466
+ getEqualXTypes
467
+ };
468
+ }
469
+
470
+ export { useCenter };
@@ -0,0 +1,7 @@
1
+ import { IPropItems, IPointType } from '../interface';
2
+ export declare function useCumputedPoint(propItems: IPropItems): {
3
+ cumputedX: (value: number | string) => number;
4
+ cumputedY: (type: IPointType, scaleValueList: number[], value: number | string) => number;
5
+ getXValue: (pointX: number) => string;
6
+ getYValue: (type: IPointType, pointY: number) => number;
7
+ };
@@ -0,0 +1,44 @@
1
+ function useCumputedPoint(propItems) {
2
+ const { xScaleList, xScaleCell, originX, endY, xCellWidth, left, vitalSignsOriginY, painOriginY } = propItems;
3
+ function cumputedX(value) {
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;
9
+ }
10
+ return originX + xCellWidth * i + xCellWidth / 2;
11
+ }
12
+ function cumputedY(type, scaleValueList, value) {
13
+ const yScaleCell = propItems[`${type}YCell`];
14
+ const yCellUnit = +value - Math.min(...scaleValueList);
15
+ const newEndY = type === "pain" ? painOriginY.endY : vitalSignsOriginY.endY;
16
+ return newEndY - yScaleCell * yCellUnit;
17
+ }
18
+ 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;
26
+ }
27
+ function getYValue(type, pointY) {
28
+ var _a;
29
+ const yScaleCell = propItems[`${type}YCell`];
30
+ const list = ((_a = left.yScaleValue.find((v) => v.type === type)) == null ? void 0 : _a.list) || [];
31
+ const minVal = list.length ? Math.min(...list) : 0;
32
+ const newEndY = type === "pain" ? painOriginY.endY : vitalSignsOriginY.endY;
33
+ const y = (newEndY - pointY) / yScaleCell + minVal;
34
+ return Math.floor(y * 100) / 100;
35
+ }
36
+ return {
37
+ cumputedX,
38
+ cumputedY,
39
+ getXValue,
40
+ getYValue
41
+ };
42
+ }
43
+
44
+ export { useCumputedPoint };
@@ -0,0 +1,42 @@
1
+ import { fabric } from '../utils';
2
+ import { ILineOptions, ITextOptions } from '../interface';
3
+ export declare const defaultStyle: {
4
+ evented: boolean;
5
+ selectable: boolean;
6
+ };
7
+ export declare const defaultBorderStyle: {
8
+ evented: boolean;
9
+ selectable: boolean;
10
+ stroke: string;
11
+ strokeWidth: number;
12
+ };
13
+ export declare const defaultLineStyle: {
14
+ evented: boolean;
15
+ selectable: boolean;
16
+ stroke: string;
17
+ strokeWidth: number;
18
+ strokeDashArray: number[];
19
+ };
20
+ export declare const defaultRectStyle: {
21
+ evented: boolean;
22
+ selectable: boolean;
23
+ fill: string;
24
+ stroke: string;
25
+ strokeWidth: number;
26
+ originX: string;
27
+ originY: string;
28
+ };
29
+ export declare const defaultTextStyle: {
30
+ evented: boolean;
31
+ selectable: boolean;
32
+ fontFamily: string;
33
+ fontSize: number;
34
+ fill: string;
35
+ centeredRotation: boolean;
36
+ originX: string;
37
+ originY: string;
38
+ lineHeight: number;
39
+ };
40
+ export declare function drawLine(points: number[], style: Partial<ILineOptions>): fabric.Line;
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;
@@ -1 +1,87 @@
1
+ import { fabric } from '../utils/index.js';
1
2
 
3
+ const defaultStyle = {
4
+ evented: false,
5
+ selectable: false
6
+ };
7
+ const defaultBorderStyle = {
8
+ stroke: "#999",
9
+ strokeWidth: 1,
10
+ ...defaultStyle
11
+ };
12
+ const defaultLineStyle = {
13
+ stroke: "#000",
14
+ strokeWidth: 1,
15
+ strokeDashArray: [0, 0],
16
+ ...defaultStyle
17
+ };
18
+ const defaultRectStyle = {
19
+ fill: "transparent",
20
+ stroke: "#999",
21
+ strokeWidth: 1,
22
+ originX: "center",
23
+ originY: "center",
24
+ ...defaultStyle
25
+ };
26
+ const defaultTextStyle = {
27
+ fontFamily: "\u5FAE\u8F6F\u96C5\u9ED1",
28
+ fontSize: 12,
29
+ fill: "#000",
30
+ centeredRotation: true,
31
+ originX: "center",
32
+ originY: "center",
33
+ lineHeight: 1,
34
+ ...defaultStyle
35
+ };
36
+ function drawLine(points, style) {
37
+ return new fabric.Line(points, {
38
+ ...defaultLineStyle,
39
+ ...style
40
+ });
41
+ }
42
+ function drawTextGroup(rectStyle, fontStyle, groupStyle) {
43
+ const rect = new fabric.Rect({
44
+ ...defaultRectStyle,
45
+ ...rectStyle
46
+ });
47
+ const texts = new fabric.Text(String(fontStyle.value), {
48
+ ...defaultTextStyle,
49
+ ...fontStyle
50
+ });
51
+ return new fabric.Group([rect, texts], {
52
+ ...groupStyle
53
+ });
54
+ }
55
+ function drawPoint(type = "circle", style) {
56
+ let point = null;
57
+ const newStyle = {
58
+ originX: "center",
59
+ originY: "center",
60
+ hasControls: false,
61
+ hasBorders: false,
62
+ ...style
63
+ };
64
+ switch (type) {
65
+ case "triangle":
66
+ point = new fabric.Triangle({
67
+ width: 20,
68
+ height: 20,
69
+ strokeWidth: 1,
70
+ scale: 1,
71
+ ...newStyle
72
+ });
73
+ break;
74
+ case "circle":
75
+ point = new fabric.Circle({
76
+ objectCaching: false,
77
+ strokeWidth: 1,
78
+ radius: 5,
79
+ scale: 1,
80
+ ...newStyle
81
+ });
82
+ break;
83
+ }
84
+ return point;
85
+ }
86
+
87
+ export { defaultBorderStyle, defaultLineStyle, defaultRectStyle, defaultStyle, defaultTextStyle, drawLine, drawPoint, drawTextGroup };
@@ -0,0 +1 @@
1
+ export declare function useEvent(element: HTMLCanvasElement | any): void;
@@ -0,0 +1,10 @@
1
+ import { useEventListener } from '@vueuse/core';
2
+
3
+ function useEvent(element) {
4
+ useEventListener(element.nextSibling, "contextmenu", (e) => {
5
+ e.preventDefault();
6
+ return false;
7
+ });
8
+ }
9
+
10
+ export { useEvent };
@@ -0,0 +1,4 @@
1
+ import { Ref } from 'vue';
2
+ import { fabric } from '../utils';
3
+ import { IPropItems } from '../interface';
4
+ export default function useGrid(canvas: Ref<fabric.Canvas>, propItems: IPropItems): void;