cnhis-design-vue 3.4.0-beta.55 → 3.4.0-beta.58
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 +87 -87
- package/es/components/fabric-chart/src/hooks/birthProcess/useBirthProcessChart.js +69 -117
- package/es/components/fabric-chart/src/hooks/electrocardiogram/useElectrocardiogramChart.d.ts +2 -2
- package/es/components/fabric-chart/src/hooks/electrocardiogram/useElectrocardiogramChart.js +75 -117
- package/es/components/fabric-chart/src/hooks/newBirthProcess/useNewBirthProcessChart.js +65 -113
- package/es/components/fabric-chart/src/hooks/surgicalAnesthesia/useSurgicalAnesthesiaChart.js +152 -208
- package/es/components/fabric-chart/src/hooks/temperature/useCenter.js +3 -3
- package/es/components/fabric-chart/src/hooks/temperature/useTemperatureChart.js +194 -272
- package/es/components/form-render/src/hooks/useNewLowCodeReactions.js +8 -0
- package/es/components/iho-chat/src/components/ChatMain.vue2.js +1 -1
- package/es/components/iho-chat/src/components/PersonProfile.vue2.js +1 -1
- package/es/components/iho-chat/src/hooks/useData.js +1 -1
- package/es/env.d.ts +25 -25
- package/es/shared/package.json.js +1 -1
- package/es/shared/types/business.d.ts +3 -2
- package/es/shared/utils/business.js +16 -0
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -1,87 +1,87 @@
|
|
|
1
|
-
# 安装
|
|
2
|
-
|
|
3
|
-
```shell
|
|
4
|
-
npm i cnhis-design-vue@[版本号]
|
|
5
|
-
# or
|
|
6
|
-
yarn add cnhis-design-vue@[版本号] #推荐
|
|
7
|
-
```
|
|
8
|
-
|
|
9
|
-
## 1.全局引入
|
|
10
|
-
|
|
11
|
-
```typescript
|
|
12
|
-
// main.ts
|
|
13
|
-
import { createApp } from 'vue';
|
|
14
|
-
import App from './App.vue';
|
|
15
|
-
import 'cnhis-design-vue/es/packages/index.css';
|
|
16
|
-
import cui from 'cnhis-design-vue';
|
|
17
|
-
|
|
18
|
-
const app = createApp(App);
|
|
19
|
-
app.use(cui).mount('#app');
|
|
20
|
-
```
|
|
21
|
-
|
|
22
|
-
## 2. 按需引入
|
|
23
|
-
|
|
24
|
-
组件现在支持了自动按需引入, 但是样式文件需要额外的处理
|
|
25
|
-
|
|
26
|
-
### 2.1 样式处理方式1 (按需引入样式)
|
|
27
|
-
|
|
28
|
-
```shell
|
|
29
|
-
# 安装自动导入样式的插件
|
|
30
|
-
npm i -d vite-plugin-style-import
|
|
31
|
-
```
|
|
32
|
-
|
|
33
|
-
```typescript
|
|
34
|
-
// vite.config.ts
|
|
35
|
-
import { defineConfig } from 'vite';
|
|
36
|
-
import { createStyleImportPlugin } from 'vite-plugin-style-import';
|
|
37
|
-
|
|
38
|
-
export default defineConfig({
|
|
39
|
-
plugins: [
|
|
40
|
-
// ...otherPlugins
|
|
41
|
-
createStyleImportPlugin({
|
|
42
|
-
libs: [
|
|
43
|
-
{
|
|
44
|
-
libraryName: 'cnhis-design-vue',
|
|
45
|
-
esModule: true,
|
|
46
|
-
ensureStyleFile: true,
|
|
47
|
-
resolveStyle: name => {
|
|
48
|
-
return `cnhis-design-vue/es/components/${ name.slice(2) }/style/index.css`;
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
]
|
|
52
|
-
})
|
|
53
|
-
]
|
|
54
|
-
});
|
|
55
|
-
```
|
|
56
|
-
|
|
57
|
-
### 2.2 样式处理方式2 (全局引入样式)
|
|
58
|
-
|
|
59
|
-
```typescript
|
|
60
|
-
// main.ts
|
|
61
|
-
import 'cnhis-design-vue/es/components/index.css';
|
|
62
|
-
```
|
|
63
|
-
|
|
64
|
-
## 3.FAQ
|
|
65
|
-
|
|
66
|
-
### 3.1 项目打包后样式丢失
|
|
67
|
-
|
|
68
|
-
处理方法, 将 cnhis-design-vue 从 vendor 包中移除 (没有出现此问题则不需要)
|
|
69
|
-
|
|
70
|
-
```typescript
|
|
71
|
-
// vite.config.ts
|
|
72
|
-
import { defineConfig } from 'vite';
|
|
73
|
-
|
|
74
|
-
export default defineConfig({
|
|
75
|
-
build: {
|
|
76
|
-
rollupOptions: {
|
|
77
|
-
// ..otherOptions
|
|
78
|
-
output: {
|
|
79
|
-
dir: './dist',
|
|
80
|
-
manualChunks: {
|
|
81
|
-
'cnhis-vendor': ['cnhis-design-vue']
|
|
82
|
-
}
|
|
83
|
-
}
|
|
84
|
-
}
|
|
85
|
-
}
|
|
86
|
-
});
|
|
87
|
-
```
|
|
1
|
+
# 安装
|
|
2
|
+
|
|
3
|
+
```shell
|
|
4
|
+
npm i cnhis-design-vue@[版本号]
|
|
5
|
+
# or
|
|
6
|
+
yarn add cnhis-design-vue@[版本号] #推荐
|
|
7
|
+
```
|
|
8
|
+
|
|
9
|
+
## 1.全局引入
|
|
10
|
+
|
|
11
|
+
```typescript
|
|
12
|
+
// main.ts
|
|
13
|
+
import { createApp } from 'vue';
|
|
14
|
+
import App from './App.vue';
|
|
15
|
+
import 'cnhis-design-vue/es/packages/index.css';
|
|
16
|
+
import cui from 'cnhis-design-vue';
|
|
17
|
+
|
|
18
|
+
const app = createApp(App);
|
|
19
|
+
app.use(cui).mount('#app');
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
## 2. 按需引入
|
|
23
|
+
|
|
24
|
+
组件现在支持了自动按需引入, 但是样式文件需要额外的处理
|
|
25
|
+
|
|
26
|
+
### 2.1 样式处理方式1 (按需引入样式)
|
|
27
|
+
|
|
28
|
+
```shell
|
|
29
|
+
# 安装自动导入样式的插件
|
|
30
|
+
npm i -d vite-plugin-style-import
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
```typescript
|
|
34
|
+
// vite.config.ts
|
|
35
|
+
import { defineConfig } from 'vite';
|
|
36
|
+
import { createStyleImportPlugin } from 'vite-plugin-style-import';
|
|
37
|
+
|
|
38
|
+
export default defineConfig({
|
|
39
|
+
plugins: [
|
|
40
|
+
// ...otherPlugins
|
|
41
|
+
createStyleImportPlugin({
|
|
42
|
+
libs: [
|
|
43
|
+
{
|
|
44
|
+
libraryName: 'cnhis-design-vue',
|
|
45
|
+
esModule: true,
|
|
46
|
+
ensureStyleFile: true,
|
|
47
|
+
resolveStyle: name => {
|
|
48
|
+
return `cnhis-design-vue/es/components/${ name.slice(2) }/style/index.css`;
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
]
|
|
52
|
+
})
|
|
53
|
+
]
|
|
54
|
+
});
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
### 2.2 样式处理方式2 (全局引入样式)
|
|
58
|
+
|
|
59
|
+
```typescript
|
|
60
|
+
// main.ts
|
|
61
|
+
import 'cnhis-design-vue/es/components/index.css';
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
## 3.FAQ
|
|
65
|
+
|
|
66
|
+
### 3.1 项目打包后样式丢失
|
|
67
|
+
|
|
68
|
+
处理方法, 将 cnhis-design-vue 从 vendor 包中移除 (没有出现此问题则不需要)
|
|
69
|
+
|
|
70
|
+
```typescript
|
|
71
|
+
// vite.config.ts
|
|
72
|
+
import { defineConfig } from 'vite';
|
|
73
|
+
|
|
74
|
+
export default defineConfig({
|
|
75
|
+
build: {
|
|
76
|
+
rollupOptions: {
|
|
77
|
+
// ..otherOptions
|
|
78
|
+
output: {
|
|
79
|
+
dir: './dist',
|
|
80
|
+
manualChunks: {
|
|
81
|
+
'cnhis-vendor': ['cnhis-design-vue']
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
});
|
|
87
|
+
```
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { reactive,
|
|
1
|
+
import { reactive, watch, toRefs } from 'vue';
|
|
2
2
|
import { defaultBorderStyle } from '../useDraw.js';
|
|
3
3
|
import '../../../../../shared/utils/fabricjs/index.js';
|
|
4
4
|
import 'date-fns';
|
|
@@ -22,101 +22,83 @@ function useBirthProcessChart(canvas, props, emits, canvasRef, pointTipProps, po
|
|
|
22
22
|
redrawPoints: null,
|
|
23
23
|
clickMenu: null
|
|
24
24
|
});
|
|
25
|
-
const leftScales = computed(
|
|
26
|
-
() => props.data.scaleValues.map((item) => {
|
|
27
|
-
var _a;
|
|
28
|
-
return { ...item, width: (_a = item.width) != null ? _a : 60 };
|
|
29
|
-
}).filter(({ layout = "left", show = true }) => layout === "left" && show)
|
|
30
|
-
);
|
|
31
|
-
const rightScales = computed(
|
|
32
|
-
() => props.data.scaleValues.map((item) => {
|
|
33
|
-
var _a;
|
|
34
|
-
return { ...item, width: (_a = item.width) != null ? _a : 60 };
|
|
35
|
-
}).filter(({ layout = "left", show = true }) => layout === "right" && show)
|
|
36
|
-
);
|
|
37
25
|
const leftAddAreaWidth = 30;
|
|
38
|
-
|
|
39
|
-
var _a;
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
const
|
|
45
|
-
|
|
46
|
-
return width;
|
|
47
|
-
},
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
var _a;
|
|
26
|
+
function buildDerived() {
|
|
27
|
+
var _a, _b;
|
|
28
|
+
const leftScales = props.data.scaleValues.map((item) => {
|
|
29
|
+
var _a2;
|
|
30
|
+
return { ...item, width: (_a2 = item.width) != null ? _a2 : 60 };
|
|
31
|
+
}).filter(({ layout = "left", show = true }) => layout === "left" && show);
|
|
32
|
+
const rightScales = props.data.scaleValues.map((item) => {
|
|
33
|
+
var _a2;
|
|
34
|
+
return { ...item, width: (_a2 = item.width) != null ? _a2 : 60 };
|
|
35
|
+
}).filter(({ layout = "left", show = true }) => layout === "right" && show);
|
|
36
|
+
const rightAddAreaWidth = !(rightScales == null ? void 0 : rightScales.length) ? 0 : 30;
|
|
37
|
+
const leftScalesWidth = leftScales == null ? void 0 : leftScales.reduce((width2, item) => width2 + item.width, 0);
|
|
38
|
+
const originX = leftAddAreaWidth + leftScalesWidth;
|
|
52
39
|
const { width } = props.data;
|
|
53
|
-
const rightScalesWidth =
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
}, 0);
|
|
57
|
-
return width - rightAddAreaWidth.value - rightScalesWidth;
|
|
58
|
-
});
|
|
59
|
-
const gridXNumber = computed(() => props.data.grid.mainXCell);
|
|
60
|
-
const gridYNumber = computed(() => {
|
|
40
|
+
const rightScalesWidth = rightScales == null ? void 0 : rightScales.reduce((w, item) => w + item.width, 0);
|
|
41
|
+
const endX = width - rightAddAreaWidth - rightScalesWidth;
|
|
42
|
+
const gridXNumber = props.data.grid.mainXCell;
|
|
61
43
|
const mainYCell = props.data.grid.mainYCell || 14;
|
|
62
|
-
const
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
return (endX.value - originX.value) / gridXNumber.value;
|
|
67
|
-
});
|
|
68
|
-
const padding = computed(() => {
|
|
69
|
-
const p = props.data.padding || [5, 5];
|
|
44
|
+
const fhrItemShow = props.data.scaleValues.find((item) => item.show && item.key === "FHR");
|
|
45
|
+
const gridYNumber = !fhrItemShow && mainYCell === 14 ? 10 : mainYCell;
|
|
46
|
+
const xCellWidth = (endX - originX) / gridXNumber;
|
|
47
|
+
const defaultPadding = props.data.padding || [5, 5];
|
|
70
48
|
const xAxisNumberTop = getxAxisNumber("top");
|
|
71
49
|
const xAxisNumberBottom = getxAxisNumber("bottom");
|
|
72
|
-
|
|
73
|
-
});
|
|
74
|
-
const yCellHeight = computed(() => {
|
|
50
|
+
const padding = [xAxisNumberTop ? 0 : defaultPadding[0], xAxisNumberBottom ? 0 : defaultPadding[1]];
|
|
75
51
|
const { height } = props.data;
|
|
76
|
-
const
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
const
|
|
81
|
-
return yCellHeight.value * xAxisNumber + padding.value[0];
|
|
82
|
-
});
|
|
83
|
-
const originYCervix = computed(() => {
|
|
84
|
-
var _a;
|
|
85
|
-
const { scaleValues } = props.data;
|
|
52
|
+
const xAxisNumberAll = getxAxisNumber();
|
|
53
|
+
const yCellHeight = (height - padding.reduce((p1, p2) => p1 + p2, 0)) / (gridYNumber + xAxisNumberAll);
|
|
54
|
+
const originY = yCellHeight * xAxisNumberTop + padding[0];
|
|
55
|
+
const endY = height - yCellHeight * xAxisNumberBottom - padding[1];
|
|
56
|
+
const scaleValues = props.data.scaleValues;
|
|
86
57
|
const FHRisShow = (_a = scaleValues.find((item) => item.key === "FHR")) == null ? void 0 : _a.show;
|
|
87
|
-
if (!FHRisShow && !originY.value)
|
|
88
|
-
return originY.value;
|
|
89
58
|
const cervixItem = scaleValues.find((item) => item.key === "cervix");
|
|
90
59
|
const [, max] = (cervixItem == null ? void 0 : cervixItem.range) || [0, 10];
|
|
91
60
|
const spaceValue = (cervixItem == null ? void 0 : cervixItem.spaceValue) || 1;
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
const
|
|
96
|
-
const
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
61
|
+
const originYCervix = !FHRisShow && !originY ? originY : endY - padding[0] - max * spaceValue * yCellHeight;
|
|
62
|
+
const startTime = getTime(props.data.xAxis.time.startTime);
|
|
63
|
+
const timeXCell = 1 * 60 * 60 * 1e3 / xCellWidth;
|
|
64
|
+
const cervixYCell = yCellHeight / ((cervixItem == null ? void 0 : cervixItem.spaceValue) || 1);
|
|
65
|
+
const FHRItem = scaleValues.find((item) => item.key === "FHR");
|
|
66
|
+
const FHRYCell = yCellHeight / ((FHRItem == null ? void 0 : FHRItem.spaceValue) || 10);
|
|
67
|
+
const fetalPresentationItem = scaleValues.find((item) => item.key === "fetalPresentation");
|
|
68
|
+
const fetalPresentationYCell = yCellHeight / ((fetalPresentationItem == null ? void 0 : fetalPresentationItem.spaceValue) || 1);
|
|
69
|
+
const event = ((_b = props.data.grid) == null ? void 0 : _b.event) || { selectable: true, evented: true, hovered: true };
|
|
70
|
+
return {
|
|
71
|
+
canvasWidth: props.data.width,
|
|
72
|
+
canvasHeight: props.data.height,
|
|
73
|
+
borderStyle: { ...defaultBorderStyle, ...props.data.borderStyle },
|
|
74
|
+
selectionStyle: props.data.selectionStyle || {},
|
|
75
|
+
grid: props.data.grid,
|
|
76
|
+
other: props.data.other,
|
|
77
|
+
originX,
|
|
78
|
+
endX,
|
|
79
|
+
originY,
|
|
80
|
+
endY,
|
|
81
|
+
xCellWidth,
|
|
82
|
+
yCellHeight,
|
|
83
|
+
gridXNumber,
|
|
84
|
+
gridYNumber,
|
|
85
|
+
xAxis: props.data.xAxis,
|
|
86
|
+
leftScales,
|
|
87
|
+
rightScales,
|
|
88
|
+
leftAddAreaWidth,
|
|
89
|
+
rightAddAreaWidth,
|
|
90
|
+
startTime,
|
|
91
|
+
timeXCell,
|
|
92
|
+
cervixYCell,
|
|
93
|
+
FHRYCell,
|
|
94
|
+
fetalPresentationYCell,
|
|
95
|
+
scaleValues: props.data.scaleValues,
|
|
96
|
+
event,
|
|
97
|
+
originYCervix,
|
|
98
|
+
scalebarBorder: Reflect.has(props.data, "scalebarBorder") ? props.data.scalebarBorder : true,
|
|
99
|
+
padding
|
|
100
|
+
};
|
|
101
|
+
}
|
|
120
102
|
function getxAxisNumber(position) {
|
|
121
103
|
const { xAxis } = props.data;
|
|
122
104
|
return Object.values(xAxis).reduce((num, item) => {
|
|
@@ -125,37 +107,7 @@ function useBirthProcessChart(canvas, props, emits, canvasRef, pointTipProps, po
|
|
|
125
107
|
return num;
|
|
126
108
|
}, 0);
|
|
127
109
|
}
|
|
128
|
-
const propItems = reactive(
|
|
129
|
-
canvasWidth: props.data.width,
|
|
130
|
-
canvasHeight: props.data.height,
|
|
131
|
-
borderStyle: { ...defaultBorderStyle, ...props.data.borderStyle || {} },
|
|
132
|
-
selectionStyle: props.data.selectionStyle || {},
|
|
133
|
-
grid: props.data.grid,
|
|
134
|
-
other: props.data.other,
|
|
135
|
-
originX: originX.value,
|
|
136
|
-
endX: endX.value,
|
|
137
|
-
originY: originY.value,
|
|
138
|
-
endY: endY.value,
|
|
139
|
-
xCellWidth: xCellWidth.value,
|
|
140
|
-
yCellHeight: yCellHeight.value,
|
|
141
|
-
gridXNumber: gridXNumber.value,
|
|
142
|
-
gridYNumber: gridYNumber.value,
|
|
143
|
-
xAxis: props.data.xAxis,
|
|
144
|
-
leftScales: leftScales.value,
|
|
145
|
-
rightScales: rightScales.value,
|
|
146
|
-
leftAddAreaWidth,
|
|
147
|
-
rightAddAreaWidth: rightAddAreaWidth.value,
|
|
148
|
-
startTime: startTime.value,
|
|
149
|
-
timeXCell: timeXCell.value,
|
|
150
|
-
cervixYCell: cervixYCell.value,
|
|
151
|
-
FHRYCell: FHRYCell.value,
|
|
152
|
-
fetalPresentationYCell: fetalPresentationYCell.value,
|
|
153
|
-
scaleValues: props.data.scaleValues,
|
|
154
|
-
event: event.value,
|
|
155
|
-
originYCervix: originYCervix.value,
|
|
156
|
-
scalebarBorder: Reflect.has(props.data, "scalebarBorder") ? props.data.scalebarBorder : true,
|
|
157
|
-
padding: padding.value
|
|
158
|
-
});
|
|
110
|
+
const propItems = reactive(buildDerived());
|
|
159
111
|
watch(
|
|
160
112
|
() => canvas.value,
|
|
161
113
|
(value) => {
|
package/es/components/fabric-chart/src/hooks/electrocardiogram/useElectrocardiogramChart.d.ts
CHANGED
|
@@ -5,8 +5,8 @@ import { IPointTipProps, IPointMenuProps } from '../../../../../components/fabri
|
|
|
5
5
|
import { ECG } from '../../../../../components/fabric-chart/src/constants';
|
|
6
6
|
export declare function useElectrocardiogramChart(canvas: Ref<fabric.Canvas>, props: AnyObject, emits: Function, canvasRef: Ref<HTMLCanvasElement | null>, pointTipProps: IPointTipProps, pointMenuProps: IPointMenuProps): {
|
|
7
7
|
getGridInfo: () => {
|
|
8
|
-
cellWidth:
|
|
9
|
-
cellHeight:
|
|
8
|
+
cellWidth: any;
|
|
9
|
+
cellHeight: any;
|
|
10
10
|
smallCellNumber: ECG;
|
|
11
11
|
};
|
|
12
12
|
select?: Ref<import("../../../../../shared/types").AnyFn | null | undefined, import("../../../../../shared/types").AnyFn | null | undefined> | undefined;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { reactive,
|
|
1
|
+
import { reactive, watch, toRefs } from 'vue';
|
|
2
2
|
import { defaultBorderStyle, defaultLineStyle, defaultTextStyle } from '../useDraw.js';
|
|
3
3
|
import '../../../../../shared/utils/fabricjs/index.js';
|
|
4
4
|
import 'date-fns';
|
|
5
|
-
import { cloneDeep,
|
|
5
|
+
import { cloneDeep, last, isNumber } from 'lodash-es';
|
|
6
6
|
import '../useEvent.js';
|
|
7
7
|
import '../useShadow.js';
|
|
8
8
|
import '../useCommon.js';
|
|
@@ -25,142 +25,100 @@ function useElectrocardiogramChart(canvas, props, emits, canvasRef, pointTipProp
|
|
|
25
25
|
useRectRuler: null
|
|
26
26
|
});
|
|
27
27
|
const originX = 0, originY = 0;
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
const
|
|
32
|
-
const
|
|
33
|
-
const
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
});
|
|
39
|
-
const xCellWidth = computed(() => {
|
|
40
|
-
return (endX.value - originX) / gridXNumber.value;
|
|
41
|
-
});
|
|
42
|
-
const yCellHeight = computed(() => {
|
|
43
|
-
return (endY.value - originY) / gridYNumber.value;
|
|
44
|
-
});
|
|
45
|
-
const gridXNumber = computed(() => {
|
|
46
|
-
var _a, _b, _c;
|
|
47
|
-
const { config, grid } = props.data;
|
|
48
|
-
if (isNumber(grid.gridXNumber))
|
|
49
|
-
return grid.gridXNumber;
|
|
50
|
-
const totalLength = (_c = (_b = (_a = last(__dataList.value)) == null ? void 0 : _a.data) == null ? void 0 : _b.length) != null ? _c : 0;
|
|
28
|
+
function buildDerived() {
|
|
29
|
+
var _a, _b, _c, _d, _e, _f;
|
|
30
|
+
const endX = props.data.width;
|
|
31
|
+
const endY = props.data.height;
|
|
32
|
+
const { dataList = [], config = {} } = props.data;
|
|
33
|
+
const list = cloneDeep(dataList);
|
|
34
|
+
const matchItem = list.find((item) => config.lastDataKey && item.key === config.lastDataKey);
|
|
35
|
+
const __dataList = matchItem ? [...list, matchItem] : list;
|
|
36
|
+
const { grid } = props.data;
|
|
37
|
+
const totalLength = (_c = (_b = (_a = last(__dataList)) == null ? void 0 : _a.data) == null ? void 0 : _b.length) != null ? _c : 0;
|
|
51
38
|
const totalSeconds = totalLength / config.hz;
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
const gridYNumber = computed(() => {
|
|
55
|
-
const { config, grid } = props.data;
|
|
56
|
-
if (isNumber(grid.gridYNumber))
|
|
57
|
-
return grid.gridYNumber;
|
|
58
|
-
const totalLineLength = __dataList.value.length;
|
|
59
|
-
return Math.ceil(totalValueMV.value * totalLineLength * 2 / config.mainYCellValue);
|
|
60
|
-
});
|
|
61
|
-
const totalValueMV = computed(() => {
|
|
62
|
-
var _a;
|
|
63
|
-
const { config } = props.data;
|
|
64
|
-
const totalData = (_a = last(__dataList.value)) == null ? void 0 : _a.data;
|
|
39
|
+
const gridXNumber = isNumber(grid.gridXNumber) ? grid.gridXNumber : Math.ceil(totalSeconds / config.mainXCellValue);
|
|
40
|
+
const totalData = ((_d = last(__dataList)) == null ? void 0 : _d.data) || [];
|
|
65
41
|
const maxValue = Math.max(...totalData);
|
|
66
42
|
const minValue = Math.min(...totalData);
|
|
67
43
|
const totalValue = maxValue - minValue;
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
const layoutInfo = computed(() => {
|
|
44
|
+
const totalValueMV = config.valueUnit === "uv" ? totalValue * 1e-3 : config.valueUnit === "v" ? totalValue * 1e3 : totalValue;
|
|
45
|
+
const totalLineLength = __dataList.length;
|
|
46
|
+
const gridYNumber = isNumber(grid.gridYNumber) ? grid.gridYNumber : Math.ceil(totalValueMV * totalLineLength * 2 / config.mainYCellValue);
|
|
47
|
+
const xCellWidth = (endX - originX) / gridXNumber;
|
|
48
|
+
const yCellHeight = (endY - originY) / gridYNumber;
|
|
49
|
+
const event = ((_e = props.data.grid) == null ? void 0 : _e.event) || { selectable: true, evented: true };
|
|
75
50
|
const { mode = "2-6" } = props.data;
|
|
76
51
|
const [columnNumber, rowNumber] = mode.split("-").map((n) => +n);
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
};
|
|
81
|
-
});
|
|
82
|
-
const rowSpace = computed(() => {
|
|
83
|
-
const { rowNumber } = layoutInfo.value;
|
|
84
|
-
const totalLineLength = __dataList.value.length;
|
|
85
|
-
return Math.round(gridYNumber.value / (rowNumber + (totalLineLength === ECG.MAXLINENUMBER ? 1 : 0)));
|
|
86
|
-
});
|
|
87
|
-
const dataList = computed(() => {
|
|
88
|
-
const { width, config, grid } = props.data;
|
|
89
|
-
const { columnNumber, rowNumber } = layoutInfo.value;
|
|
90
|
-
const columnWidth = width / columnNumber;
|
|
91
|
-
const dataListLen = __dataList.value.length;
|
|
92
|
-
const baseYCellNumber = Math.ceil(rowSpace.value / 2);
|
|
93
|
-
const firstRowLineMaxHeight = getFirstRowLineMaxHeight();
|
|
94
|
-
const _baseY = yCellHeight.value * baseYCellNumber;
|
|
95
|
-
const baseY = columnNumber === 1 || _baseY < firstRowLineMaxHeight ? yCellHeight.value * Math.ceil(firstRowLineMaxHeight / yCellHeight.value) : _baseY;
|
|
96
|
-
const baseX = xCellWidth.value;
|
|
97
|
-
return __dataList.value.map((item, idx) => {
|
|
98
|
-
const itemRowIdx = ECG.MAXLINENUMBER === dataListLen && idx === dataListLen - 1 ? rowNumber : idx % rowNumber;
|
|
99
|
-
const itemColumnIdx = ECG.MAXLINENUMBER === dataListLen && idx === dataListLen - 1 ? 0 : Math.floor(idx / rowNumber);
|
|
100
|
-
return {
|
|
101
|
-
...item,
|
|
102
|
-
origin: {
|
|
103
|
-
x: itemColumnIdx * columnWidth + baseX,
|
|
104
|
-
y: itemRowIdx * (yCellHeight.value * rowSpace.value) + baseY,
|
|
105
|
-
rowIdx: itemRowIdx,
|
|
106
|
-
limitX: columnWidth - baseX
|
|
107
|
-
}
|
|
108
|
-
};
|
|
109
|
-
});
|
|
52
|
+
const rowSpace = Math.round(gridYNumber / (rowNumber + (totalLineLength === ECG.MAXLINENUMBER ? 1 : 0)));
|
|
53
|
+
const columnWidth = props.data.width / columnNumber;
|
|
54
|
+
const baseYCellNumber = Math.ceil(rowSpace / 2);
|
|
110
55
|
function getFirstRowLineMaxHeight() {
|
|
111
|
-
const { valueUnit, mainYCellValue } = config;
|
|
112
|
-
const data1 = __dataList
|
|
56
|
+
const { valueUnit, mainYCellValue: mainYCellValue2 } = config;
|
|
57
|
+
const data1 = __dataList[0].data;
|
|
113
58
|
const data1Max = Math.max(...data1);
|
|
114
59
|
const data1MaxHeight = computedY(data1Max);
|
|
115
60
|
if (columnNumber !== 2) {
|
|
116
61
|
return data1MaxHeight;
|
|
117
62
|
}
|
|
118
|
-
const data7 = __dataList
|
|
63
|
+
const data7 = __dataList[6].data;
|
|
119
64
|
const data7Max = Math.max(...data7);
|
|
120
65
|
const data7MaxHeight = computedY(data7Max);
|
|
121
66
|
return Math.max(data1MaxHeight, data7MaxHeight);
|
|
122
67
|
function computedY(value) {
|
|
123
68
|
const currentMV = valueUnit === "uv" ? value * 1e-3 : valueUnit === "v" ? value * 1e3 : value;
|
|
124
|
-
return currentMV /
|
|
69
|
+
return currentMV / mainYCellValue2 * yCellHeight;
|
|
125
70
|
}
|
|
126
71
|
}
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
const
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
72
|
+
const firstRowLineMaxHeight = getFirstRowLineMaxHeight();
|
|
73
|
+
const _baseY = yCellHeight * baseYCellNumber;
|
|
74
|
+
const baseY = columnNumber === 1 || _baseY < firstRowLineMaxHeight ? yCellHeight * Math.ceil(firstRowLineMaxHeight / yCellHeight) : _baseY;
|
|
75
|
+
const baseX = xCellWidth;
|
|
76
|
+
const derivedDataList = __dataList.map((item, idx) => {
|
|
77
|
+
const itemRowIdx = ECG.MAXLINENUMBER === totalLineLength && idx === totalLineLength - 1 ? rowNumber : idx % rowNumber;
|
|
78
|
+
const itemColumnIdx = ECG.MAXLINENUMBER === totalLineLength && idx === totalLineLength - 1 ? 0 : Math.floor(idx / rowNumber);
|
|
79
|
+
return {
|
|
80
|
+
...item,
|
|
81
|
+
origin: {
|
|
82
|
+
x: itemColumnIdx * columnWidth + baseX,
|
|
83
|
+
y: itemRowIdx * (yCellHeight * rowSpace) + baseY,
|
|
84
|
+
rowIdx: itemRowIdx,
|
|
85
|
+
limitX: columnWidth - baseX
|
|
86
|
+
}
|
|
87
|
+
};
|
|
88
|
+
});
|
|
89
|
+
const { calibrationLineGridYNumber, mainYCellValue } = ((_f = props.data) == null ? void 0 : _f.config) || {};
|
|
90
|
+
const calibrationLineHeight = calibrationLineGridYNumber ? yCellHeight * calibrationLineGridYNumber : mainYCellValue ? yCellHeight / mainYCellValue : yCellHeight;
|
|
91
|
+
return {
|
|
92
|
+
canvasWidth: props.data.width,
|
|
93
|
+
canvasHeight: props.data.height,
|
|
94
|
+
borderStyle: { ...defaultBorderStyle, ...props.data.borderStyle },
|
|
95
|
+
lineStyle: { ...defaultLineStyle, ...props.data.lineStyle },
|
|
96
|
+
titleStyle: { ...defaultTextStyle, ...props.data.titleStyle },
|
|
97
|
+
titleOffset: props.data.titleOffset,
|
|
98
|
+
measureLineStyle: { ...defaultLineStyle, ...props.data.measureLineStyle },
|
|
99
|
+
measureTextStyle: { ...defaultTextStyle, ...props.data.measureTextStyle },
|
|
100
|
+
grid: props.data.grid,
|
|
101
|
+
originX,
|
|
102
|
+
endX,
|
|
103
|
+
originY,
|
|
104
|
+
endY,
|
|
105
|
+
xCellWidth,
|
|
106
|
+
yCellHeight,
|
|
107
|
+
gridXNumber,
|
|
108
|
+
gridYNumber,
|
|
109
|
+
event,
|
|
110
|
+
dataList: derivedDataList,
|
|
111
|
+
columnNumber,
|
|
112
|
+
rowNumber,
|
|
113
|
+
config: props.data.config,
|
|
114
|
+
calibrationLineHeight
|
|
115
|
+
};
|
|
116
|
+
}
|
|
117
|
+
const propItems = reactive(buildDerived());
|
|
160
118
|
function getGridInfo() {
|
|
161
119
|
return {
|
|
162
|
-
cellWidth: xCellWidth
|
|
163
|
-
cellHeight: yCellHeight
|
|
120
|
+
cellWidth: propItems.xCellWidth,
|
|
121
|
+
cellHeight: propItems.yCellHeight,
|
|
164
122
|
smallCellNumber: ECG.SMALLCELLNUMBER
|
|
165
123
|
};
|
|
166
124
|
}
|