cnhis-design-vue 3.1.33-beta.2 → 3.1.33-beta.20

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 (112) hide show
  1. package/README.md +123 -123
  2. package/es/components/big-table/index.d.ts +2 -2
  3. package/es/components/big-table/src/BigTable.vue.d.ts +2 -2
  4. package/es/components/big-table/src/BigTable.vue2.js +11 -14
  5. package/es/components/big-table/src/components/edit-form/edit-input.js +1 -1
  6. package/es/components/big-table/src/components/edit-form/edit-select.js +1 -1
  7. package/es/components/big-table/src/components/edit-form/edit-time.js +7 -4
  8. package/es/components/big-table/src/components/edit-form/useCommon.d.ts +2 -1
  9. package/es/components/big-table/src/components/edit-form/useCommon.js +7 -3
  10. package/es/components/big-table/src/hooks/useFormat.js +1 -1
  11. package/es/components/button-print/index.d.ts +13 -0
  12. package/es/components/button-print/src/ButtonPrint.vue.d.ts +13 -0
  13. package/es/components/button-print/src/ButtonPrint.vue2.js +6 -1
  14. package/es/components/button-print/src/utils/print.d.ts +2 -2
  15. package/es/components/button-print/src/utils/print.js +7 -4
  16. package/es/components/fabric-chart/index.d.ts +389 -181
  17. package/es/components/fabric-chart/src/BirthProcessChart.vue.d.ts +181 -0
  18. package/es/components/fabric-chart/src/BirthProcessChart.vue.js +172 -0
  19. package/es/components/fabric-chart/src/FabricChart.vue.d.ts +390 -182
  20. package/es/components/fabric-chart/src/FabricChart.vue.js +21 -327
  21. package/es/components/fabric-chart/src/TemperatureChart.vue.d.ts +214 -0
  22. package/es/components/fabric-chart/src/TemperatureChart.vue.js +359 -0
  23. package/es/components/fabric-chart/src/components/PopupMenu.js +2 -2
  24. package/es/components/fabric-chart/src/components/PopupTip.vue.d.ts +3 -2
  25. package/es/components/fabric-chart/src/hooks/index.d.ts +1 -0
  26. package/es/components/fabric-chart/src/hooks/index.js +2 -1
  27. package/es/components/fabric-chart/src/hooks/useBirthProcess.d.ts +26 -0
  28. package/es/components/fabric-chart/src/hooks/useBirthProcess.js +419 -0
  29. package/es/components/fabric-chart/src/hooks/useCenter.d.ts +0 -2
  30. package/es/components/fabric-chart/src/hooks/useCenter.js +22 -42
  31. package/es/components/fabric-chart/src/hooks/useCommon.d.ts +8 -0
  32. package/es/components/fabric-chart/src/hooks/useCommon.js +31 -0
  33. package/es/components/fabric-chart/src/hooks/useCumputedPoint.d.ts +9 -2
  34. package/es/components/fabric-chart/src/hooks/useCumputedPoint.js +34 -1
  35. package/es/components/fabric-chart/src/hooks/useGrid.d.ts +2 -2
  36. package/es/components/fabric-chart/src/hooks/useGrid.js +28 -18
  37. package/es/components/fabric-chart/src/hooks/useLeft.d.ts +1 -1
  38. package/es/components/fabric-chart/src/hooks/useLeft.js +11 -7
  39. package/es/components/fabric-chart/src/interface.d.ts +24 -6
  40. package/es/components/fabric-chart/src/interface.js +0 -3
  41. package/es/components/fabric-chart/src/utils/utils.d.ts +11 -0
  42. package/es/components/fabric-chart/src/utils/utils.js +27 -0
  43. package/es/components/form-render/src/hooks/useFormRenderOptions.d.ts +2 -4
  44. package/es/components/form-render/src/hooks/useFormRenderOptions.js +14 -8
  45. package/es/components/iho-table/index.d.ts +1 -0
  46. package/es/components/iho-table/index.js +1 -1
  47. package/es/components/iho-table/src/IhoTable.vue.d.ts +1 -0
  48. package/es/components/iho-table/src/IhoTable.vue.js +7 -1
  49. package/es/components/iho-table/src/hooks/tapHooks/index.d.ts +1 -0
  50. package/es/components/iho-table/src/hooks/tapHooks/index.js +3 -1
  51. package/es/components/iho-table/src/hooks/tapHooks/useExposeHooks.d.ts +11 -0
  52. package/es/components/iho-table/src/hooks/tapHooks/useExposeHooks.js +26 -0
  53. package/es/components/iho-table/src/hooks/useColumnConfigAdaptor.js +5 -1
  54. package/es/components/iho-table/src/plugins/filterPlugin/filter.vue.d.ts +2 -1
  55. package/es/components/iho-table/src/plugins/filterPlugin/filter.vue.js +17 -12
  56. package/es/components/iho-table/src/plugins/filterPlugin/index.js +16 -5
  57. package/es/components/iho-table/src/plugins/lowCodeFieldAdaptorPlugin/index.js +1 -0
  58. package/es/components/iho-table/src/plugins/rendererPlugins/editableWidgets/dateRendererPlugin/index.js +8 -22
  59. package/es/components/iho-table/src/plugins/rendererPlugins/editableWidgets/selectRendererPlugin/index.js +8 -16
  60. package/es/components/iho-table/src/plugins/rowGroupSettingPlugin/rowGroupUtils.js +7 -4
  61. package/es/components/iho-table/src/types/index.d.ts +9 -1
  62. package/es/components/iho-table/src/types/index.js +1 -1
  63. package/es/components/iho-table/src/types/pluginType.d.ts +4 -0
  64. package/es/components/iho-table/src/types/pluginType.js +3 -1
  65. package/es/components/iho-table/style/index.css +1 -1
  66. package/es/components/index.css +1 -1
  67. package/es/components/index.js +1 -1
  68. package/es/components/info-header/index.d.ts +2 -0
  69. package/es/components/info-header/src/InfoHeader.vue.d.ts +2 -0
  70. package/es/components/info-header/src/InfoHeader.vue.js +72 -56
  71. package/es/components/info-header/style/index.css +1 -1
  72. package/es/components/keyboard/index.d.ts +62 -1
  73. package/es/components/keyboard/src/Keyboard.vue.d.ts +62 -1
  74. package/es/components/keyboard/src/Keyboard.vue.js +4 -1
  75. package/es/components/keyboard/src/components/NumberPanel.vue.d.ts +67 -5
  76. package/es/components/keyboard/src/components/NumberPanel.vue.js +48 -26
  77. package/es/components/keyboard/style/index.css +1 -1
  78. package/es/components/shortcut-provider/src/utils/index.d.ts +0 -1
  79. package/es/components/shortcut-provider/src/utils/index.js +26 -3
  80. package/es/components/shortcut-setter/src/ShortcutSetterItem.vue.js +3 -0
  81. package/es/shared/assets/img/failure.js +1 -1
  82. package/es/shared/assets/img/failure.png.js +1 -1
  83. package/es/shared/assets/img/icon-asc.js +1 -1
  84. package/es/shared/assets/img/icon-desc.js +1 -1
  85. package/es/shared/assets/img/no-permission.js +1 -1
  86. package/es/shared/assets/img/no-permission.png.js +1 -1
  87. package/es/shared/assets/img/nodata.js +1 -1
  88. package/es/shared/assets/img/nodata.png.js +1 -1
  89. package/es/shared/assets/img/notfound.js +1 -1
  90. package/es/shared/assets/img/notfound.png.js +1 -1
  91. package/es/shared/assets/img/qr.js +1 -1
  92. package/es/shared/assets/img/qr.png.js +1 -1
  93. package/es/shared/assets/img/success.js +1 -1
  94. package/es/shared/assets/img/success.png.js +1 -1
  95. package/es/shared/assets/img/video.js +1 -1
  96. package/es/shared/assets/img/video.png.js +1 -1
  97. package/es/shared/assets/img/video_default_cover.js +1 -1
  98. package/es/shared/assets/img/video_default_cover.png.js +1 -1
  99. package/es/shared/assets/img/video_hover.js +1 -1
  100. package/es/shared/assets/img/video_play_hover.js +1 -1
  101. package/es/shared/assets/img/xb_big.js +1 -1
  102. package/es/shared/assets/img/xb_big.png.js +1 -1
  103. package/es/shared/assets/img/xb_small.js +1 -1
  104. package/es/shared/assets/img/xb_small.png.js +1 -1
  105. package/package.json +2 -2
  106. package/es/components/bpmn-workflow/src/BpmnWorkflow.d.ts +0 -0
  107. package/es/components/bpmn-workflow/types/BpmnViewer.d.ts +0 -1
  108. package/es/components/bpmn-workflow/types/ModelingModule.d.ts +0 -1
  109. package/es/components/bpmn-workflow/types/MoveCanvasModule.d.ts +0 -1
  110. package/es/components/fabric-chart/src/utils/index.d.ts +0 -6823
  111. package/es/shared/components/VueDraggable/src/vuedraggable.d.ts +0 -86
  112. package/es/shared/utils/tapable/index.d.ts +0 -139
@@ -0,0 +1,419 @@
1
+ import { reactive, onMounted, nextTick } from 'vue';
2
+ import { useBirthProcessCumputedPoint } from './useCumputedPoint.js';
3
+ import useGrid from './useGrid.js';
4
+ import { drawLine, drawPoint, drawText, defaultTextStyle, defaultRectStyle } from './useDraw.js';
5
+ import { fabric } from '../utils/index.js';
6
+ import { getIndex, isEffectiveNode } from '../utils/utils.js';
7
+ import useCommmon from './useCommon.js';
8
+ import { cloneDeep } from 'lodash-es';
9
+
10
+ function useBirthProcess(canvas, propItems, emits) {
11
+ const { cumputedX, cumputedY, getXValue, getYValue } = useBirthProcessCumputedPoint(propItems);
12
+ const { getEqualXTypes } = useCommmon(canvas);
13
+ const {
14
+ xAxis,
15
+ grid,
16
+ originX,
17
+ originY,
18
+ xCellWidth,
19
+ endY,
20
+ startTime,
21
+ leftAddAreaWidth,
22
+ leftScales,
23
+ rightScales,
24
+ yCellHeight,
25
+ endX,
26
+ scaleValues,
27
+ canvasWidth,
28
+ borderStyle,
29
+ rightAddAreaWidth,
30
+ event,
31
+ originYCervix
32
+ } = propItems;
33
+ const pointTipProps = reactive({
34
+ show: false,
35
+ point: { x: 0, y: 0 },
36
+ list: []
37
+ });
38
+ const pointMenuProps = reactive({
39
+ show: false,
40
+ point: { x: 0, y: 0 },
41
+ list: [],
42
+ target: null
43
+ });
44
+ const yScaleValue = cloneDeep(scaleValues);
45
+ const gridPoints = /* @__PURE__ */ new Set();
46
+ useGrid(canvas, propItems, true);
47
+ function drawPolyLine() {
48
+ yScaleValue.forEach((item, dataIndex) => {
49
+ var _a;
50
+ const pointList = [];
51
+ const lineList = [];
52
+ (_a = item.data) == null ? void 0 : _a.forEach((v, index) => {
53
+ const points = getPointer(v, item);
54
+ drawPointLine(points, v, index);
55
+ });
56
+ Promise.all(pointList).then((res) => {
57
+ const lineListFilter = lineList.filter((v) => v);
58
+ let prevPoint = null;
59
+ res = res.filter((v) => {
60
+ if (v && prevPoint) {
61
+ prevPoint.nextPoint = v;
62
+ v.prevPoint = prevPoint;
63
+ }
64
+ prevPoint = v || prevPoint;
65
+ v == null ? void 0 : v.bringToFront();
66
+ return v;
67
+ });
68
+ canvas.value.add(...lineListFilter, ...res);
69
+ res.forEach((v) => {
70
+ v == null ? void 0 : v.bringToFront();
71
+ });
72
+ });
73
+ function drawPointLine(points, v, index) {
74
+ let point;
75
+ let line;
76
+ const { pointAttr = {}, lineAttr = {}, title = "", key, type: pointType = "circle" } = item;
77
+ const nextV = item.data[index + 1];
78
+ const nextPoint = getPointer(nextV, item);
79
+ if (points && nextPoint && !v.breakpoint) {
80
+ line = drawLine([...points, ...nextPoint], {
81
+ ...lineAttr
82
+ });
83
+ } else if (points && !nextPoint && !v.breakpoint) {
84
+ const nextLinePoint = getPointer(nextV, item);
85
+ line = nextLinePoint ? drawLine([...points, ...nextLinePoint], {
86
+ ...lineAttr
87
+ }) : null;
88
+ }
89
+ const previousLine = lineList[index - 1];
90
+ const pointAttrNew = {
91
+ origin: {
92
+ data: v,
93
+ title,
94
+ key: key || "",
95
+ dataIndex,
96
+ index
97
+ },
98
+ leftLine: previousLine,
99
+ rightLine: line,
100
+ ...pointAttr,
101
+ ...propItems.event
102
+ };
103
+ if (previousLine) {
104
+ point = drawPoint(pointType, {
105
+ left: previousLine.get("x2"),
106
+ top: previousLine.get("y2"),
107
+ ...pointAttrNew
108
+ });
109
+ } else {
110
+ if (points) {
111
+ pointAttrNew.leftLine = null;
112
+ point = drawPoint(pointType, {
113
+ left: points[0],
114
+ top: points[1],
115
+ ...pointAttrNew
116
+ });
117
+ }
118
+ }
119
+ lineList.push(line);
120
+ if (point) {
121
+ setPointEvent(point);
122
+ pointList.push(point);
123
+ gridPoints.add(point);
124
+ }
125
+ }
126
+ });
127
+ }
128
+ function setPointEvent(point) {
129
+ if (event.hovered) {
130
+ point.on("mouseover", () => {
131
+ setPopup(point);
132
+ });
133
+ point.on("mouseout", () => {
134
+ pointTipProps.show = false;
135
+ });
136
+ }
137
+ point.on("moving", () => {
138
+ moveLimit(point);
139
+ updateLine(point);
140
+ event.hovered && setPopup(point);
141
+ });
142
+ point.on("mouseup", (event2) => {
143
+ pointTipProps.show = false;
144
+ if (event2.button === 1) {
145
+ const { key } = point.origin;
146
+ const params = {
147
+ ...point.origin,
148
+ data: {
149
+ ...point.origin.data,
150
+ time: getXValue(point.left),
151
+ value: getYValue(key, point.top)
152
+ }
153
+ };
154
+ canvas.value.discardActiveObject();
155
+ emits("change", params);
156
+ updateData(params, "change");
157
+ }
158
+ });
159
+ }
160
+ function updateData(params, mode = "add") {
161
+ const { dataIndex, data, index, key } = params;
162
+ const item = yScaleValue.find((v) => v.key === key);
163
+ switch (mode) {
164
+ case "delete":
165
+ item.data.splice(index, 0);
166
+ break;
167
+ case "change":
168
+ item.data[index] = data;
169
+ break;
170
+ default: {
171
+ const index2 = getIndex(data.time, item.data);
172
+ console.log("index :>> ", index2);
173
+ item.data.splice(index2, 0, data);
174
+ break;
175
+ }
176
+ }
177
+ redrawPoints();
178
+ }
179
+ function getRemovePoints(points) {
180
+ const removePoints = [];
181
+ points.forEach((point) => {
182
+ point && removePoints.push(point);
183
+ (point == null ? void 0 : point.leftLine) && removePoints.push(point == null ? void 0 : point.leftLine);
184
+ (point == null ? void 0 : point.rightLine) && removePoints.push(point == null ? void 0 : point.rightLine);
185
+ });
186
+ return removePoints;
187
+ }
188
+ function redrawPoints() {
189
+ var _a;
190
+ gridPoints.size && ((_a = canvas.value) == null ? void 0 : _a.remove(...getRemovePoints([...gridPoints])));
191
+ gridPoints.clear();
192
+ drawPolyLine();
193
+ }
194
+ function updateLine(point) {
195
+ var _a, _b;
196
+ (_a = point.leftLine) == null ? void 0 : _a.setCoords().set({ x2: point.left, y2: point.top });
197
+ (_b = point.rightLine) == null ? void 0 : _b.setCoords().set({ x1: point.left, y1: point.top });
198
+ }
199
+ function moveLimit(point) {
200
+ const limitLeft = point.prevPoint ? point.prevPoint.left : originX;
201
+ const limitRight = point.nextPoint ? point.nextPoint.left : endX;
202
+ point.setCoords();
203
+ ["cervix", "fetalPresentation"].includes(point.origin.key) && point.top < originYCervix && point.set("top", originYCervix);
204
+ point.top < originY && point.set("top", originY);
205
+ point.top > endY && point.set("top", endY);
206
+ point.left < limitLeft && point.set("left", limitLeft);
207
+ point.left > limitRight && point.set("left", limitRight);
208
+ }
209
+ function setPopup(point) {
210
+ const { title, key } = point.origin;
211
+ pointTipProps.point = {
212
+ x: point.left,
213
+ y: point.top
214
+ };
215
+ pointTipProps.list = [`${title} ${getYValue(key, point.top)}`, `\u65F6\u95F4 ${getXValue(point.left).slice(-5)}`];
216
+ pointTipProps.show = true;
217
+ }
218
+ function getPointer(v, item) {
219
+ if (isEffectiveNode(v) && isLimit(v.time)) {
220
+ const x = cumputedX(v.time);
221
+ const y = cumputedY(item.key, item.range, v.value);
222
+ return [x, y < originY ? originY : y > endY ? endY : y];
223
+ }
224
+ }
225
+ function isLimit(time) {
226
+ const maxMinute = startTime + 24 * 60 * 60 * 1e3;
227
+ const getTime = new Date(time).getTime();
228
+ return getTime >= startTime && getTime <= maxMinute;
229
+ }
230
+ function setCanvasEvent() {
231
+ if (!propItems.event.evented)
232
+ return;
233
+ canvas.value.on("mouse:up", (event2) => {
234
+ if (event2.button === 3) {
235
+ const { x = 0, y = 0 } = event2.pointer || {};
236
+ if (x >= originX && x <= endX && y >= originY && y <= endY) {
237
+ pointMenuProps.point = { x, y };
238
+ pointMenuProps.show = true;
239
+ if (!event2.target) {
240
+ pointMenuProps.target = null;
241
+ pointMenuProps.list = ["\u65B0\u589E\u8282\u70B9"];
242
+ yScaleValue.forEach((item) => {
243
+ if (!getEqualXTypes(x, "key").includes(item.key)) {
244
+ if (["cervix", "fetalPresentation"].includes(item.key) && y < originYCervix)
245
+ return;
246
+ pointMenuProps.list.push(getPointMenuList(item, event2.pointer));
247
+ }
248
+ });
249
+ if (pointMenuProps.list.length === 1) {
250
+ pointMenuProps.show = false;
251
+ console.log("\u5F53\u524D\u65F6\u95F4\u6BB5\u5185\u65E0\u53EF\u65B0\u589E\u8282\u70B9");
252
+ }
253
+ } else {
254
+ pointMenuProps.target = event2.target;
255
+ pointMenuProps.list = ["\u5220\u9664\u8282\u70B9"];
256
+ yScaleValue.forEach((item) => {
257
+ if (getEqualXTypes(x, "key").includes(item.key)) {
258
+ pointMenuProps.list.push({
259
+ ...getPointMenuList(item, event2.pointer),
260
+ mode: "delete",
261
+ index: event2.target.origin.index
262
+ });
263
+ }
264
+ });
265
+ }
266
+ }
267
+ }
268
+ });
269
+ function getPointMenuList(item, pointer) {
270
+ const dataIndex = yScaleValue.findIndex((_item) => _item.key === item.key);
271
+ return {
272
+ renderItem: () => item.title,
273
+ origin: {
274
+ title: item.title,
275
+ unit: item.unit,
276
+ dataIndex,
277
+ key: item.key
278
+ },
279
+ pointer
280
+ };
281
+ }
282
+ }
283
+ function clickMenu({ item, target }) {
284
+ console.log("item :>> ", item);
285
+ const params = {
286
+ data: {
287
+ time: getXValue(item.pointer.x),
288
+ value: getYValue(item.origin.key, item.pointer.y)
289
+ },
290
+ ...item.origin
291
+ };
292
+ if (item.mode === "delete") {
293
+ emits("delete", params);
294
+ updateData(params, "delete");
295
+ } else {
296
+ emits("add", params);
297
+ updateData(params);
298
+ }
299
+ }
300
+ function drawXScale() {
301
+ const { show, startTime: startTime2, range = [0, 23], position = "top", style } = xAxis.time;
302
+ const { show: processTimeShow, range: processTimeRange = [0, 23], style: processTimeStyle } = xAxis.processTime;
303
+ if (show || processTimeShow) {
304
+ const timeList = [];
305
+ const processTimeList = [];
306
+ const timeTextList = [];
307
+ const processTimeTextList = [];
308
+ const left = originX + xCellWidth / 2;
309
+ for (let i = 0; i < grid.mainXCell; i++) {
310
+ if (show) {
311
+ const currentTime = i === 0 ? +startTime2.slice(11, 13) : getCurrentTime(timeList.at(-1), range);
312
+ timeList.push(currentTime);
313
+ const top = position == "top" ? originY - 15 : endY + 15;
314
+ timeTextList.push(
315
+ drawText([left + i * xCellWidth, top], {
316
+ value: String(currentTime),
317
+ ...defaultTextStyle,
318
+ ...style || {}
319
+ })
320
+ );
321
+ }
322
+ if (processTimeShow) {
323
+ const currentProcessTime = i === 0 ? processTimeRange[0] : processTimeList.at(-1) + 1;
324
+ processTimeList.push(currentProcessTime);
325
+ const top = position == "top" ? endY + 15 : originY - 15;
326
+ processTimeTextList.push(
327
+ drawText([left + i * xCellWidth, top], {
328
+ value: String(currentProcessTime),
329
+ ...defaultTextStyle,
330
+ ...processTimeStyle || {}
331
+ })
332
+ );
333
+ }
334
+ }
335
+ const group = new fabric.Group([...timeTextList, ...processTimeTextList], {
336
+ evented: false,
337
+ selectable: false
338
+ });
339
+ canvas.value.add(group);
340
+ canvas.value.sendToBack(group);
341
+ }
342
+ }
343
+ function getCurrentTime(lastTime, range) {
344
+ return lastTime + 1 > range[1] ? range[0] : lastTime + 1;
345
+ }
346
+ function drawYScale() {
347
+ let baseLeft = leftAddAreaWidth;
348
+ [...leftScales, ...rightScales].forEach((item, index) => {
349
+ const { range, spaceValue, width, title, titleStyle, layout } = item;
350
+ const textList = [];
351
+ if (layout === "right")
352
+ baseLeft = endX;
353
+ const left = baseLeft + width / 2;
354
+ const list = getScaleNumberList(range, spaceValue);
355
+ list.forEach((num, i) => {
356
+ const top = i === 0 ? endY - 8 : endY - i * yCellHeight;
357
+ textList.push(
358
+ drawText([left, top], {
359
+ value: String(num),
360
+ ...defaultTextStyle
361
+ })
362
+ );
363
+ });
364
+ const border = new fabric.Rect({
365
+ ...defaultRectStyle,
366
+ width,
367
+ height: endY,
368
+ left,
369
+ top: endY / 2
370
+ });
371
+ const titleText = originY > 0 ? drawText([left, originY - yCellHeight / 2], {
372
+ value: String(title),
373
+ ...defaultTextStyle,
374
+ ...titleStyle
375
+ }) : null;
376
+ const group = new fabric.Group([...textList, border, ...titleText ? [titleText] : []], {
377
+ evented: false,
378
+ selectable: false
379
+ });
380
+ canvas.value.add(group);
381
+ baseLeft += width;
382
+ });
383
+ }
384
+ function getScaleNumberList(range, spaceValue) {
385
+ const list = [];
386
+ const [min, max] = range;
387
+ for (let i = min; spaceValue > 0 ? i <= max : i >= max; i += spaceValue) {
388
+ list.push(i);
389
+ }
390
+ return list;
391
+ }
392
+ function drawBorder() {
393
+ const border = new fabric.Rect({
394
+ ...borderStyle,
395
+ width: canvasWidth - leftAddAreaWidth - rightAddAreaWidth,
396
+ height: endY,
397
+ left: leftAddAreaWidth,
398
+ top: 0,
399
+ fill: "transparent"
400
+ });
401
+ canvas.value.add(border);
402
+ }
403
+ onMounted(() => {
404
+ nextTick(() => {
405
+ drawYScale();
406
+ drawXScale();
407
+ drawBorder();
408
+ drawPolyLine();
409
+ setCanvasEvent();
410
+ });
411
+ });
412
+ return {
413
+ pointTipProps,
414
+ pointMenuProps,
415
+ clickMenu
416
+ };
417
+ }
418
+
419
+ export { useBirthProcess };
@@ -1,7 +1,6 @@
1
1
  import { Ref } from 'vue';
2
2
  import { fabric } from '../utils';
3
3
  import { IPropItems } from '../interface';
4
- import { IPointType } from '../interface';
5
4
  export declare function useCenter(canvas: Ref<fabric.Canvas>, propItems: IPropItems, emits: any, cumputedX: Function, cumputedY: Function, getXValue: Function, getYValue: Function, addRenderItem: Function | undefined): {
6
5
  pointTipProps: {
7
6
  show: boolean;
@@ -25,7 +24,6 @@ export declare function useCenter(canvas: Ref<fabric.Canvas>, propItems: IPropIt
25
24
  target: any;
26
25
  }) => void;
27
26
  setPopup: (point: any) => void;
28
- getEqualXTypes: (pointX: number) => IPointType[];
29
27
  isAddPoint: (x: number) => boolean;
30
28
  updateData: (params: any, mode?: string) => void;
31
29
  redrawPoints: () => void;
@@ -4,35 +4,13 @@ import { drawLine, defaultStyle, drawPoint, drawText, drawArrow } from './useDra
4
4
  import useGrid from './useGrid.js';
5
5
  import { useShadow } from './useShadow.js';
6
6
  import { TEMPERATURE_MENU, PAIN_MENU, OVERLAP } from './constant.js';
7
+ import useCommmon from './useCommon.js';
7
8
  import { cloneDeep } from 'lodash-es';
9
+ import { getPointArr, isEffectiveNode, getIndex, deleteProperty } from '../utils/utils.js';
8
10
 
9
- function isEffectiveNode(node) {
10
- return (node == null ? void 0 : node.time) && ((node == null ? void 0 : node.value) || (node == null ? void 0 : node.value) === 0);
11
- }
12
- function getPointArr(arr) {
13
- let _arr = [];
14
- return arr.reduce((pre, cur, index) => {
15
- var _a, _b;
16
- _arr.push([cur.left, cur.top]);
17
- if (((_b = (_a = cur.origin) == null ? void 0 : _a.data) == null ? void 0 : _b.breakpoint) || arr.length - 1 === index) {
18
- pre.push(_arr);
19
- _arr = [];
20
- }
21
- return pre;
22
- }, []);
23
- }
24
- function deleteProperty(data, list) {
25
- list.map((v) => v.type).forEach((key) => {
26
- if (Reflect.has(data, key))
27
- Reflect.deleteProperty(data, key);
28
- });
29
- }
30
- function getIndex(time, list) {
31
- const index = list.findIndex((v) => new Date(v.time).getTime() > new Date(time).getTime());
32
- return !~index ? list.length : index;
33
- }
34
11
  function useCenter(canvas, propItems, emits, cumputedX, cumputedY, getXValue, getYValue, addRenderItem) {
35
12
  useGrid(canvas, propItems);
13
+ const { getEqualXTypes, repeatTip, maxLimitTip, minLimitTip } = useCommmon(canvas);
36
14
  const {
37
15
  left,
38
16
  xScaleList,
@@ -156,7 +134,7 @@ function useCenter(canvas, propItems, emits, cumputedX, cumputedY, getXValue, ge
156
134
  pointMenuProps.point = { x, y };
157
135
  pointMenuProps.show = true;
158
136
  const { type } = ((_a = event2.target) == null ? void 0 : _a.origin) || {};
159
- if (event2.target && (type === "temperature" || type === "pain")) {
137
+ if (event2.target && ["temperature", "pain"].includes(type)) {
160
138
  if (type === "temperature") {
161
139
  pointMenuProps.list = [...TEMPERATURE_MENU];
162
140
  }
@@ -185,25 +163,16 @@ function useCenter(canvas, propItems, emits, cumputedX, cumputedY, getXValue, ge
185
163
  }
186
164
  }
187
165
  });
188
- if (!isAddPoint(x) || pointMenuProps.list.length === 1) {
166
+ const isLimitAdd = isAddPoint(x);
167
+ if (!isLimitAdd || pointMenuProps.list.length === 1) {
189
168
  pointMenuProps.show = false;
190
- console.log("\u5F53\u524D\u65F6\u95F4\u6BB5\u5185\u65E0\u53EF\u65B0\u589E\u8282\u70B9");
169
+ pointMenuProps.list.length === 1 && isLimitAdd && repeatTip();
191
170
  }
192
171
  }
193
172
  }
194
173
  }
195
174
  });
196
175
  }
197
- function getEqualXTypes(pointX) {
198
- const types = [];
199
- const left2 = cumputedX(getXValue(pointX));
200
- canvas.value.forEachObject((obj) => {
201
- if (obj.origin && left2 === obj.left) {
202
- types.push(obj.origin.type);
203
- }
204
- });
205
- return [...new Set(types)];
206
- }
207
176
  function drawOverlapPoint() {
208
177
  var _a;
209
178
  const pulseObj = yScaleValue.find((item) => item.type === "pulse");
@@ -440,7 +409,9 @@ function useCenter(canvas, propItems, emits, cumputedX, cumputedY, getXValue, ge
440
409
  const { pointAttr = {}, lineAttr = {}, title = "", key, type: pointType = "circle" } = _item;
441
410
  const nextV = item.list[index + 1];
442
411
  const nextPoint = getPointer(nextV, scaleValue);
443
- if (points && nextPoint && !v.breakpoint) {
412
+ const isNonePain = isNoneValuePain(type, item.list[index].value);
413
+ const isNextNonePain = nextPoint && isNoneValuePain(type, nextV.value);
414
+ if (points && nextPoint && !v.breakpoint && !isNonePain && !isNextNonePain) {
444
415
  line = drawLine([...points, ...nextPoint], {
445
416
  ...lineAttr
446
417
  });
@@ -454,6 +425,7 @@ function useCenter(canvas, propItems, emits, cumputedX, cumputedY, getXValue, ge
454
425
  line
455
426
  });
456
427
  }
428
+ const currentPointType = v.pacemakerShow && type == "pulse" ? pacemaker.value : isNonePain ? 0 : pointType;
457
429
  const previousLine = lineList[index - 1];
458
430
  const pointAttrNew = {
459
431
  origin: {
@@ -469,10 +441,10 @@ function useCenter(canvas, propItems, emits, cumputedX, cumputedY, getXValue, ge
469
441
  rightLine: line,
470
442
  otherObj,
471
443
  lockMovementX: true,
444
+ lockMoveMentY: currentPointType == 0 ? true : false,
472
445
  ...v.pacemakerShow && type == "pulse" ? pacemaker.style : pointAttr,
473
446
  ...propItems.event
474
447
  };
475
- const currentPointType = v.pacemakerShow && type == "pulse" ? pacemaker.value : pointType;
476
448
  if (previousLine) {
477
449
  point = drawPoint(currentPointType, {
478
450
  left: previousLine.get("x2"),
@@ -502,6 +474,9 @@ function useCenter(canvas, propItems, emits, cumputedX, cumputedY, getXValue, ge
502
474
  }
503
475
  }
504
476
  }
477
+ function isNoneValuePain(type, value) {
478
+ return type === "pain" && value == 0;
479
+ }
505
480
  function setPointEvent(point) {
506
481
  if (event.hovered) {
507
482
  point.on("mouseover", () => {
@@ -601,8 +576,14 @@ function useCenter(canvas, propItems, emits, cumputedX, cumputedY, getXValue, ge
601
576
  const day = `00${d.getDate()}`.slice(-2);
602
577
  const todayTime = new Date(`${d.getFullYear()}-${month}-${day} 23:59:59`).getTime();
603
578
  const pointTime = new Date(`${getXValue(x)}:00`).getTime();
604
- if (hospitalizationDate && pointTime < new Date(hospitalizationDate).getTime() || pointTime > todayTime)
579
+ if (hospitalizationDate && pointTime < new Date(hospitalizationDate).getTime()) {
580
+ minLimitTip();
605
581
  return false;
582
+ }
583
+ if (pointTime > todayTime) {
584
+ maxLimitTip();
585
+ return false;
586
+ }
606
587
  return true;
607
588
  }
608
589
  function clickMenu({ item, target }) {
@@ -680,7 +661,6 @@ function useCenter(canvas, propItems, emits, cumputedX, cumputedY, getXValue, ge
680
661
  pointMenuProps,
681
662
  clickMenu,
682
663
  setPopup,
683
- getEqualXTypes,
684
664
  isAddPoint,
685
665
  updateData,
686
666
  redrawPoints
@@ -0,0 +1,8 @@
1
+ import { Ref } from 'vue';
2
+ import { fabric } from '../utils';
3
+ export default function useCommmon(canvas: Ref<fabric.Canvas>): {
4
+ getEqualXTypes: (pointX: number, field?: string) => string[];
5
+ repeatTip: () => void;
6
+ maxLimitTip: () => void;
7
+ minLimitTip: () => void;
8
+ };
@@ -0,0 +1,31 @@
1
+ import { useMessage } from 'naive-ui';
2
+
3
+ function useCommmon(canvas) {
4
+ const $message = useMessage();
5
+ function getEqualXTypes(pointX, field = "type") {
6
+ const types = [];
7
+ canvas.value.forEachObject((obj) => {
8
+ if (obj.origin && !obj.origin.isMenu && obj.left >= pointX - 3 && obj.left <= pointX + 3) {
9
+ types.push(obj.origin[field]);
10
+ }
11
+ });
12
+ return [...new Set(types)];
13
+ }
14
+ function repeatTip() {
15
+ $message.warning("\u8BE5\u65F6\u6BB5\u5DF2\u5B58\u5728\u6570\u503C\u4E0D\u80FD\u65B0\u589E");
16
+ }
17
+ function maxLimitTip() {
18
+ $message.warning("\u672A\u6765\u65F6\u95F4\u4E0D\u5141\u8BB8\u5F55\u5165");
19
+ }
20
+ function minLimitTip() {
21
+ $message.warning("\u4E0D\u5141\u8BB8\u5C0F\u4E8E\u5165\u9662\u65F6\u95F4");
22
+ }
23
+ return {
24
+ getEqualXTypes,
25
+ repeatTip,
26
+ maxLimitTip,
27
+ minLimitTip
28
+ };
29
+ }
30
+
31
+ export { useCommmon as default };
@@ -1,7 +1,14 @@
1
- import { IPropItems, IPointType } from '../interface';
2
- export declare function useCumputedPoint(propItems: IPropItems): {
1
+ import { IPointType } from '../interface';
2
+ import { AnyObject } from '../../../../../es/shared/types';
3
+ export declare function useCumputedPoint(propItems: AnyObject): {
3
4
  cumputedX: (value: number | string, setAllCenter?: boolean) => any;
4
5
  cumputedY: (type: IPointType, scaleValueList: number[], value: number | string) => number;
5
6
  getXValue: (pointX: number) => string | undefined;
6
7
  getYValue: (type: IPointType, pointY: number) => number;
7
8
  };
9
+ export declare function useBirthProcessCumputedPoint(propItems: AnyObject): {
10
+ cumputedX: (value: number | string) => any;
11
+ cumputedY: (key: string, range: [number, number], value: number | string) => number;
12
+ getXValue: (pointX: number) => string;
13
+ getYValue: (key: string, pointY: number) => number;
14
+ };
@@ -56,5 +56,38 @@ function useCumputedPoint(propItems) {
56
56
  getYValue
57
57
  };
58
58
  }
59
+ function useBirthProcessCumputedPoint(propItems) {
60
+ const { xAxis, originX, originY, xCellWidth, endY, timeXCell, startTime, scaleValues } = propItems;
61
+ function cumputedX(value) {
62
+ const time = new Date(value).getTime();
63
+ return (time - startTime) / timeXCell + originX;
64
+ }
65
+ function cumputedY(key, range, value) {
66
+ const [minValue] = range;
67
+ return endY - (+value - minValue) / propItems[`${key}YCell`];
68
+ }
69
+ function getXValue(pointX) {
70
+ const time = (pointX - originX) * timeXCell + startTime;
71
+ const d = new Date(time);
72
+ const month = `00${d.getMonth() + 1}`.slice(-2);
73
+ const day = `00${d.getDate()}`.slice(-2);
74
+ const hours = `00${d.getHours()}`.slice(-2);
75
+ const minutes = `00${d.getMinutes()}`.slice(-2);
76
+ const date = `${d.getFullYear()}-${month}-${day} ${hours}:${minutes}`;
77
+ return date;
78
+ }
79
+ function getYValue(key, pointY) {
80
+ const item = scaleValues.find((item2) => key === item2.key);
81
+ const [minValue] = (item == null ? void 0 : item.range) || [0];
82
+ const y = (endY - pointY) * propItems[`${key}YCell`] + minValue;
83
+ return Math.floor(y * 100) / 100;
84
+ }
85
+ return {
86
+ cumputedX,
87
+ cumputedY,
88
+ getXValue,
89
+ getYValue
90
+ };
91
+ }
59
92
 
60
- export { useCumputedPoint };
93
+ export { useBirthProcessCumputedPoint, useCumputedPoint };
@@ -1,4 +1,4 @@
1
1
  import { Ref } from 'vue';
2
2
  import { fabric } from '../utils';
3
- import { IPropItems } from '../interface';
4
- export default function useGrid(canvas: Ref<fabric.Canvas>, propItems: IPropItems): void;
3
+ import { AnyObject } from '../../../../../es/shared/types';
4
+ export default function useGrid(canvas: Ref<fabric.Canvas>, propItems: AnyObject, isBirthProcess?: boolean): void;