cnhis-design-vue 3.1.33-beta.1 → 3.1.33-beta.10
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/README.md +123 -123
- package/es/components/big-table/index.d.ts +1 -1
- package/es/components/big-table/src/BigTable.vue.d.ts +1 -1
- package/es/components/big-table/src/BigTable.vue2.js +8 -8
- package/es/components/big-table/src/components/edit-form/edit-time.js +7 -4
- package/es/components/fabric-chart/index.d.ts +389 -181
- package/es/components/fabric-chart/src/BirthProcessChart.vue.d.ts +181 -0
- package/es/components/fabric-chart/src/BirthProcessChart.vue.js +171 -0
- package/es/components/fabric-chart/src/FabricChart.vue.d.ts +390 -182
- package/es/components/fabric-chart/src/FabricChart.vue.js +21 -327
- package/es/components/fabric-chart/src/TemperatureChart.vue.d.ts +214 -0
- package/es/components/fabric-chart/src/TemperatureChart.vue.js +358 -0
- package/es/components/fabric-chart/src/components/PopupMenu.js +2 -2
- package/es/components/fabric-chart/src/components/PopupTip.vue.d.ts +3 -2
- package/es/components/fabric-chart/src/hooks/index.d.ts +1 -0
- package/es/components/fabric-chart/src/hooks/index.js +2 -1
- package/es/components/fabric-chart/src/hooks/useBirthProcess.d.ts +26 -0
- package/es/components/fabric-chart/src/hooks/useBirthProcess.js +419 -0
- package/es/components/fabric-chart/src/hooks/useCenter.d.ts +0 -2
- package/es/components/fabric-chart/src/hooks/useCenter.js +4 -37
- package/es/components/fabric-chart/src/hooks/useCommon.d.ts +5 -0
- package/es/components/fabric-chart/src/hooks/useCommon.js +16 -0
- package/es/components/fabric-chart/src/hooks/useCumputedPoint.d.ts +9 -2
- package/es/components/fabric-chart/src/hooks/useCumputedPoint.js +34 -1
- package/es/components/fabric-chart/src/hooks/useGrid.d.ts +2 -2
- package/es/components/fabric-chart/src/hooks/useGrid.js +28 -18
- package/es/components/fabric-chart/src/hooks/useLeft.d.ts +1 -1
- package/es/components/fabric-chart/src/hooks/useLeft.js +3 -1
- package/es/components/fabric-chart/src/interface.d.ts +24 -6
- package/es/components/fabric-chart/src/interface.js +0 -3
- package/es/components/fabric-chart/src/utils/utils.d.ts +11 -0
- package/es/components/fabric-chart/src/utils/utils.js +27 -0
- package/es/components/form-render/src/FormRender.vue.js +1 -0
- package/es/components/form-render/src/FormRenderWrapper.vue.js +5 -1
- package/es/components/form-render/src/components/renderer/radio.js +10 -3
- package/es/components/form-render/src/hooks/useFormRenderOptions.d.ts +2 -4
- package/es/components/form-render/src/hooks/useFormRenderOptions.js +14 -8
- package/es/components/form-render/src/types/index.d.ts +2 -1
- package/es/components/iho-table/index.d.ts +1 -0
- package/es/components/iho-table/index.js +1 -1
- package/es/components/iho-table/src/IhoTable.vue.d.ts +1 -0
- package/es/components/iho-table/src/IhoTable.vue.js +7 -1
- package/es/components/iho-table/src/hooks/tapHooks/index.d.ts +1 -0
- package/es/components/iho-table/src/hooks/tapHooks/index.js +3 -1
- package/es/components/iho-table/src/hooks/tapHooks/useExposeHooks.d.ts +11 -0
- package/es/components/iho-table/src/hooks/tapHooks/useExposeHooks.js +26 -0
- package/es/components/iho-table/src/hooks/useColumnConfigAdaptor.js +1 -2
- package/es/components/iho-table/src/plugins/filterPlugin/filter.vue.d.ts +2 -1
- package/es/components/iho-table/src/plugins/filterPlugin/filter.vue.js +17 -12
- package/es/components/iho-table/src/plugins/filterPlugin/index.js +16 -5
- package/es/components/iho-table/src/plugins/rendererPlugins/editableWidgets/dateRendererPlugin/index.js +8 -22
- package/es/components/iho-table/src/plugins/rendererPlugins/editableWidgets/inputRendererPlugin.js +9 -22
- package/es/components/iho-table/src/plugins/rendererPlugins/editableWidgets/numberRendererPlugin.js +11 -24
- package/es/components/iho-table/src/plugins/rendererPlugins/editableWidgets/selectRendererPlugin/index.js +8 -16
- package/es/components/iho-table/src/plugins/rendererPlugins/editableWidgets/separateRendererPlugin/index.js +10 -16
- package/es/components/iho-table/src/plugins/rendererPlugins/editableWidgets/timeRendererPlugin.js +10 -23
- package/es/components/iho-table/src/types/index.d.ts +6 -1
- package/es/components/iho-table/src/types/index.js +1 -1
- package/es/components/iho-table/src/types/pluginType.d.ts +4 -0
- package/es/components/iho-table/src/types/pluginType.js +3 -1
- package/es/components/iho-table/src/utils/index.d.ts +10 -0
- package/es/components/iho-table/src/utils/index.js +34 -7
- package/es/components/iho-table/style/index.css +1 -1
- package/es/components/index.css +1 -1
- package/es/components/index.js +1 -1
- package/es/components/info-header/index.d.ts +2 -0
- package/es/components/info-header/src/InfoHeader.vue.d.ts +2 -0
- package/es/components/info-header/src/InfoHeader.vue.js +72 -56
- package/es/components/info-header/style/index.css +1 -1
- package/es/components/shortcut-provider/src/utils/index.d.ts +0 -1
- package/es/components/shortcut-provider/src/utils/index.js +26 -3
- package/es/components/shortcut-setter/src/ShortcutSetterItem.vue.js +3 -0
- package/es/shared/assets/img/failure.js +1 -1
- package/es/shared/assets/img/failure.png.js +1 -1
- package/es/shared/assets/img/icon-asc.js +1 -1
- package/es/shared/assets/img/icon-desc.js +1 -1
- package/es/shared/assets/img/no-permission.js +1 -1
- package/es/shared/assets/img/no-permission.png.js +1 -1
- package/es/shared/assets/img/nodata.js +1 -1
- package/es/shared/assets/img/nodata.png.js +1 -1
- package/es/shared/assets/img/notfound.js +1 -1
- package/es/shared/assets/img/notfound.png.js +1 -1
- package/es/shared/assets/img/qr.js +1 -1
- package/es/shared/assets/img/qr.png.js +1 -1
- package/es/shared/assets/img/success.js +1 -1
- package/es/shared/assets/img/success.png.js +1 -1
- package/es/shared/assets/img/video.js +1 -1
- package/es/shared/assets/img/video.png.js +1 -1
- package/es/shared/assets/img/video_default_cover.js +1 -1
- package/es/shared/assets/img/video_default_cover.png.js +1 -1
- package/es/shared/assets/img/video_hover.js +1 -1
- package/es/shared/assets/img/video_play_hover.js +1 -1
- package/es/shared/assets/img/xb_big.js +1 -1
- package/es/shared/assets/img/xb_big.png.js +1 -1
- package/es/shared/assets/img/xb_small.js +1 -1
- package/es/shared/assets/img/xb_small.png.js +1 -1
- package/package.json +2 -2
- package/es/components/bpmn-workflow/src/BpmnWorkflow.d.ts +0 -0
- package/es/components/bpmn-workflow/types/BpmnViewer.d.ts +0 -1
- package/es/components/bpmn-workflow/types/ModelingModule.d.ts +0 -1
- package/es/components/bpmn-workflow/types/MoveCanvasModule.d.ts +0 -1
- package/es/components/fabric-chart/src/utils/index.d.ts +0 -6823
- package/es/shared/components/VueDraggable/src/vuedraggable.d.ts +0 -86
- 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 } = 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 &&
|
|
137
|
+
if (event2.target && ["temperature", "pain"].includes(type)) {
|
|
160
138
|
if (type === "temperature") {
|
|
161
139
|
pointMenuProps.list = [...TEMPERATURE_MENU];
|
|
162
140
|
}
|
|
@@ -194,16 +172,6 @@ function useCenter(canvas, propItems, emits, cumputedX, cumputedY, getXValue, ge
|
|
|
194
172
|
}
|
|
195
173
|
});
|
|
196
174
|
}
|
|
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
175
|
function drawOverlapPoint() {
|
|
208
176
|
var _a;
|
|
209
177
|
const pulseObj = yScaleValue.find((item) => item.type === "pulse");
|
|
@@ -680,7 +648,6 @@ function useCenter(canvas, propItems, emits, cumputedX, cumputedY, getXValue, ge
|
|
|
680
648
|
pointMenuProps,
|
|
681
649
|
clickMenu,
|
|
682
650
|
setPopup,
|
|
683
|
-
getEqualXTypes,
|
|
684
651
|
isAddPoint,
|
|
685
652
|
updateData,
|
|
686
653
|
redrawPoints
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
function useCommmon(canvas) {
|
|
2
|
+
function getEqualXTypes(pointX, field = "type") {
|
|
3
|
+
const types = [];
|
|
4
|
+
canvas.value.forEachObject((obj) => {
|
|
5
|
+
if (obj.origin && obj.left >= pointX - 3 && obj.left <= pointX + 3) {
|
|
6
|
+
types.push(obj.origin[field]);
|
|
7
|
+
}
|
|
8
|
+
});
|
|
9
|
+
return [...new Set(types)];
|
|
10
|
+
}
|
|
11
|
+
return {
|
|
12
|
+
getEqualXTypes
|
|
13
|
+
};
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export { useCommmon as default };
|
|
@@ -1,7 +1,14 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
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 {
|
|
4
|
-
export default function useGrid(canvas: Ref<fabric.Canvas>, propItems:
|
|
3
|
+
import { AnyObject } from '../../../../../es/shared/types';
|
|
4
|
+
export default function useGrid(canvas: Ref<fabric.Canvas>, propItems: AnyObject, isBirthProcess?: boolean): void;
|
|
@@ -2,36 +2,46 @@ import { onMounted, nextTick } from 'vue';
|
|
|
2
2
|
import { fabric } from '../utils/index.js';
|
|
3
3
|
import { drawLine, defaultBorderStyle } from './useDraw.js';
|
|
4
4
|
|
|
5
|
-
function useGrid(canvas, propItems) {
|
|
6
|
-
var _a, _b;
|
|
5
|
+
function useGrid(canvas, propItems, isBirthProcess = false) {
|
|
6
|
+
var _a, _b, _c, _d;
|
|
7
7
|
const { gridYNumber, originY, grid, originX, endX, xCellWidth, yCellHeight, gridXNumber, endY } = propItems;
|
|
8
8
|
const yList = [];
|
|
9
9
|
const xList = [];
|
|
10
10
|
const mainList = /* @__PURE__ */ new Set();
|
|
11
11
|
for (let i = 0; i <= gridYNumber; i++) {
|
|
12
12
|
const y = originY + parseInt(String(yCellHeight * (gridYNumber - i)));
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
if (i % grid.subYCell === 0) {
|
|
16
|
-
mainList.add(line);
|
|
17
|
-
} else {
|
|
13
|
+
if (isBirthProcess) {
|
|
14
|
+
const line = drawLine([originX, y, endX, y], { ...defaultBorderStyle, ...((_a = grid.mainLineStyle) == null ? void 0 : _a.x) || {} });
|
|
18
15
|
yList.push(line);
|
|
16
|
+
} else {
|
|
17
|
+
const style = i % grid.subYCell === 0 ? ((_b = grid.mainLineStyle) == null ? void 0 : _b.x) || {} : grid.subLineStyle || {};
|
|
18
|
+
const line = drawLine([originX, y, endX, y], style);
|
|
19
|
+
if (i % grid.subYCell === 0) {
|
|
20
|
+
mainList.add(line);
|
|
21
|
+
} else {
|
|
22
|
+
yList.push(line);
|
|
23
|
+
}
|
|
19
24
|
}
|
|
20
25
|
}
|
|
21
26
|
for (let i = 0; i <= gridXNumber; i++) {
|
|
22
27
|
const x = originX + parseInt(String(xCellWidth * i));
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
style = grid.subSecondLineStyle || {};
|
|
26
|
-
}
|
|
27
|
-
if (i % grid.subXCell === 0) {
|
|
28
|
-
style = i !== 0 && i !== gridXNumber ? ((_b = grid.mainLineStyle) == null ? void 0 : _b.y) || {} : defaultBorderStyle;
|
|
29
|
-
}
|
|
30
|
-
const line = drawLine([x, originY, x, endY], style);
|
|
31
|
-
if (i % grid.subXCell === 0 && i !== 0 && i !== gridXNumber) {
|
|
32
|
-
mainList.add(line);
|
|
33
|
-
} else {
|
|
28
|
+
if (isBirthProcess) {
|
|
29
|
+
const line = drawLine([x, originY, x, endY], { ...defaultBorderStyle, ...((_c = grid.mainLineStyle) == null ? void 0 : _c.y) || {} });
|
|
34
30
|
xList.push(line);
|
|
31
|
+
} else {
|
|
32
|
+
let style = grid.subLineStyle || {};
|
|
33
|
+
if (i % grid.subSecondXCell === 0) {
|
|
34
|
+
style = grid.subSecondLineStyle || {};
|
|
35
|
+
}
|
|
36
|
+
if (i % grid.subXCell === 0) {
|
|
37
|
+
style = i !== 0 && i !== gridXNumber ? ((_d = grid.mainLineStyle) == null ? void 0 : _d.y) || {} : defaultBorderStyle;
|
|
38
|
+
}
|
|
39
|
+
const line = drawLine([x, originY, x, endY], style);
|
|
40
|
+
if (i % grid.subXCell === 0 && i !== 0 && i !== gridXNumber) {
|
|
41
|
+
mainList.add(line);
|
|
42
|
+
} else {
|
|
43
|
+
xList.push(line);
|
|
44
|
+
}
|
|
35
45
|
}
|
|
36
46
|
}
|
|
37
47
|
const group = new fabric.Group([...xList, ...yList, ...mainList], {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Ref } from 'vue';
|
|
2
2
|
import { fabric } from '../utils';
|
|
3
3
|
import { IPropItems } from '../interface';
|
|
4
|
-
export declare function useLeft(canvas: Ref<fabric.Canvas>, propItems: IPropItems, emits: any, setPopup: Function, pointTipProps: any,
|
|
4
|
+
export declare function useLeft(canvas: Ref<fabric.Canvas>, propItems: IPropItems, emits: any, setPopup: Function, pointTipProps: any, cumputedX: Function, cumputedY: Function, getXValue: Function, getYValue: Function, isAddPoint: Function, updateData: Function): {
|
|
5
5
|
drawScaleValue: (yScaleValueList: any[]) => void;
|
|
6
6
|
};
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import { onMounted, nextTick } from 'vue';
|
|
2
2
|
import { fabric } from '../utils/index.js';
|
|
3
3
|
import { defaultBorderStyle, defaultTextStyle, defaultStyle, defaultRectStyle, drawPoint, drawTextGroup } from './useDraw.js';
|
|
4
|
+
import useCommmon from './useCommon.js';
|
|
4
5
|
|
|
5
|
-
function useLeft(canvas, propItems, emits, setPopup, pointTipProps, getXValue, getYValue,
|
|
6
|
+
function useLeft(canvas, propItems, emits, setPopup, pointTipProps, cumputedX, cumputedY, getXValue, getYValue, isAddPoint, updateData) {
|
|
7
|
+
const { getEqualXTypes } = useCommmon(canvas);
|
|
6
8
|
const {
|
|
7
9
|
originY,
|
|
8
10
|
endY,
|