cnhis-design-vue 3.1.33-beta.6 → 3.1.33-beta.7
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 +3 -2
- package/es/components/fabric-chart/index.d.ts +45 -0
- package/es/components/fabric-chart/src/BirthProcessChart.vue.d.ts +2 -2
- package/es/components/fabric-chart/src/BirthProcessChart.vue.js +118 -0
- package/es/components/fabric-chart/src/FabricChart.vue.d.ts +45 -0
- package/es/components/fabric-chart/src/FabricChart.vue.js +3 -2
- package/es/components/fabric-chart/src/hooks/index.js +1 -1
- package/es/components/fabric-chart/src/hooks/useBirthProcess.d.ts +4 -0
- package/es/components/fabric-chart/src/hooks/useBirthProcess.js +123 -0
- package/es/components/fabric-chart/src/hooks/useCenter.js +1 -1
- package/es/components/fabric-chart/src/hooks/useCumputedPoint.d.ts +4 -0
- package/es/components/fabric-chart/src/hooks/useCumputedPoint.js +13 -1
- package/es/components/fabric-chart/src/hooks/useGrid.d.ts +2 -3
- package/es/components/fabric-chart/src/hooks/useGrid.js +29 -45
- package/es/components/iho-table/index.d.ts +36 -36
- package/es/components/iho-table/src/IhoTable.vue.d.ts +36 -36
- package/es/components/iho-table/src/plugins/filterPlugin/filter.vue.d.ts +1 -1
- package/es/components/iho-table/src/plugins/filterPlugin/filter.vue.js +10 -9
- 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
package/README.md
CHANGED
|
@@ -1,123 +1,123 @@
|
|
|
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. 注意
|
|
65
|
-
|
|
66
|
-
由于 vxe-table 目前的引入方式是由组件 install 触发的,所以如果需要使用 c-grid/c-big-table 组件,需要全局注册二者任意一个
|
|
67
|
-
|
|
68
|
-
```typescript
|
|
69
|
-
// main.ts
|
|
70
|
-
import { createApp } from 'vue';
|
|
71
|
-
import App from './App.vue';
|
|
72
|
-
|
|
73
|
-
import { CGrid } from 'cnhis-design-vue';
|
|
74
|
-
// 或者
|
|
75
|
-
import { CBigTable } from 'cnhis-design-vue';
|
|
76
|
-
|
|
77
|
-
const app = createApp(App);
|
|
78
|
-
app.use(CGrid);
|
|
79
|
-
// 或者
|
|
80
|
-
app.use(CBigTable);
|
|
81
|
-
app.mount('#app');
|
|
82
|
-
```
|
|
83
|
-
|
|
84
|
-
## 4.FAQ
|
|
85
|
-
|
|
86
|
-
### 4.1 项目打包后样式丢失
|
|
87
|
-
|
|
88
|
-
> 处理方法, 将 cnhis-design-vue 从 vendor 包中移除
|
|
89
|
-
|
|
90
|
-
```typescript
|
|
91
|
-
// vite.config.ts
|
|
92
|
-
import { defineConfig } from 'vite';
|
|
93
|
-
|
|
94
|
-
export default defineConfig({
|
|
95
|
-
rollupOptions: {
|
|
96
|
-
// ..otherOptions
|
|
97
|
-
output: {
|
|
98
|
-
dir: './dist',
|
|
99
|
-
manualChunks(id: string) {
|
|
100
|
-
if (id.includes('node_modules') && !id.includes('cnhis-design-vue')) {
|
|
101
|
-
return 'vendor';
|
|
102
|
-
}
|
|
103
|
-
}
|
|
104
|
-
}
|
|
105
|
-
}
|
|
106
|
-
});
|
|
107
|
-
```
|
|
108
|
-
|
|
109
|
-
### 4.2 找不到文件
|
|
110
|
-
|
|
111
|
-
> 由于组件库输出文件类型由 js 修改成了 mjs, 如果配置了 resolve 属性的项目, 需要将 mjs 文件类型添加至 extensions 中
|
|
112
|
-
|
|
113
|
-
```javascript
|
|
114
|
-
// vite.config.ts
|
|
115
|
-
const config = {
|
|
116
|
-
// ...otherOptions
|
|
117
|
-
resolve: {
|
|
118
|
-
// ...otherOptions
|
|
119
|
-
// 如果没有配置, 则不用考虑
|
|
120
|
-
extensions: ['.js', '.ts', '.vue', '.json', '.mjs']
|
|
121
|
-
}
|
|
122
|
-
};
|
|
123
|
-
```
|
|
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. 注意
|
|
65
|
+
|
|
66
|
+
由于 vxe-table 目前的引入方式是由组件 install 触发的,所以如果需要使用 c-grid/c-big-table 组件,需要全局注册二者任意一个
|
|
67
|
+
|
|
68
|
+
```typescript
|
|
69
|
+
// main.ts
|
|
70
|
+
import { createApp } from 'vue';
|
|
71
|
+
import App from './App.vue';
|
|
72
|
+
|
|
73
|
+
import { CGrid } from 'cnhis-design-vue';
|
|
74
|
+
// 或者
|
|
75
|
+
import { CBigTable } from 'cnhis-design-vue';
|
|
76
|
+
|
|
77
|
+
const app = createApp(App);
|
|
78
|
+
app.use(CGrid);
|
|
79
|
+
// 或者
|
|
80
|
+
app.use(CBigTable);
|
|
81
|
+
app.mount('#app');
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
## 4.FAQ
|
|
85
|
+
|
|
86
|
+
### 4.1 项目打包后样式丢失
|
|
87
|
+
|
|
88
|
+
> 处理方法, 将 cnhis-design-vue 从 vendor 包中移除
|
|
89
|
+
|
|
90
|
+
```typescript
|
|
91
|
+
// vite.config.ts
|
|
92
|
+
import { defineConfig } from 'vite';
|
|
93
|
+
|
|
94
|
+
export default defineConfig({
|
|
95
|
+
rollupOptions: {
|
|
96
|
+
// ..otherOptions
|
|
97
|
+
output: {
|
|
98
|
+
dir: './dist',
|
|
99
|
+
manualChunks(id: string) {
|
|
100
|
+
if (id.includes('node_modules') && !id.includes('cnhis-design-vue')) {
|
|
101
|
+
return 'vendor';
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
});
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
### 4.2 找不到文件
|
|
110
|
+
|
|
111
|
+
> 由于组件库输出文件类型由 js 修改成了 mjs, 如果配置了 resolve 属性的项目, 需要将 mjs 文件类型添加至 extensions 中
|
|
112
|
+
|
|
113
|
+
```javascript
|
|
114
|
+
// vite.config.ts
|
|
115
|
+
const config = {
|
|
116
|
+
// ...otherOptions
|
|
117
|
+
resolve: {
|
|
118
|
+
// ...otherOptions
|
|
119
|
+
// 如果没有配置, 则不用考虑
|
|
120
|
+
extensions: ['.js', '.ts', '.vue', '.json', '.mjs']
|
|
121
|
+
}
|
|
122
|
+
};
|
|
123
|
+
```
|
|
@@ -323,7 +323,8 @@ var _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
323
323
|
isEdit = false,
|
|
324
324
|
editConfig = {},
|
|
325
325
|
rowConfig = {},
|
|
326
|
-
showSeq = true
|
|
326
|
+
showSeq = true,
|
|
327
|
+
seqWidth = 34
|
|
327
328
|
} = map;
|
|
328
329
|
if (isEdit) {
|
|
329
330
|
Object.assign(state.editConfig, editConfig);
|
|
@@ -373,7 +374,7 @@ var _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
373
374
|
align: "center",
|
|
374
375
|
visible: showSeq,
|
|
375
376
|
resizable: true,
|
|
376
|
-
width:
|
|
377
|
+
width: seqWidth,
|
|
377
378
|
showOverflow: true,
|
|
378
379
|
slots: {
|
|
379
380
|
header: () => {
|
|
@@ -228,6 +228,51 @@ declare const FabricChart: SFCWithInstall<import("vue").DefineComponent<{
|
|
|
228
228
|
onSelect?: ((...args: any[]) => any) | undefined;
|
|
229
229
|
onAdd?: ((...args: any[]) => any) | undefined;
|
|
230
230
|
}, {}>;
|
|
231
|
+
BirthProcessChart: import("vue").DefineComponent<{
|
|
232
|
+
data: {
|
|
233
|
+
type: import("vue").PropType<import("./src/interface").IBirthProcessData>;
|
|
234
|
+
required: true;
|
|
235
|
+
};
|
|
236
|
+
}, {
|
|
237
|
+
props: Readonly<import("@vue/shared").LooseRequired<Readonly<import("vue").ExtractPropTypes<{
|
|
238
|
+
data: {
|
|
239
|
+
type: import("vue").PropType<import("./src/interface").IBirthProcessData>;
|
|
240
|
+
required: true;
|
|
241
|
+
};
|
|
242
|
+
}>> & {
|
|
243
|
+
onChange?: ((...args: any[]) => any) | undefined;
|
|
244
|
+
onSelect?: ((...args: any[]) => any) | undefined;
|
|
245
|
+
onAdd?: ((...args: any[]) => any) | undefined;
|
|
246
|
+
onDelete?: ((...args: any[]) => any) | undefined;
|
|
247
|
+
}>>;
|
|
248
|
+
emits: (event: "delete" | "change" | "add" | "select", ...args: any[]) => void;
|
|
249
|
+
leftScales: import("vue").ComputedRef<import("../../../es/shared/types").AnyObject[]>;
|
|
250
|
+
rightScales: import("vue").ComputedRef<import("../../../es/shared/types").AnyObject[]>;
|
|
251
|
+
leftAddAreaWidth: number;
|
|
252
|
+
rightAddAreaWidth: import("vue").ComputedRef<0 | 30>;
|
|
253
|
+
originX: import("vue").ComputedRef<number>;
|
|
254
|
+
endX: import("vue").ComputedRef<number>;
|
|
255
|
+
gridXNumber: import("vue").ComputedRef<any>;
|
|
256
|
+
gridYNumber: import("vue").ComputedRef<any>;
|
|
257
|
+
xCellWidth: import("vue").ComputedRef<number>;
|
|
258
|
+
yCellHeight: import("vue").ComputedRef<number>;
|
|
259
|
+
originY: import("vue").ComputedRef<number>;
|
|
260
|
+
endY: import("vue").ComputedRef<number>;
|
|
261
|
+
select: import("vue").Ref<any>;
|
|
262
|
+
canvasRef: any;
|
|
263
|
+
canvas: import("vue").Ref<any>;
|
|
264
|
+
propItems: any;
|
|
265
|
+
}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("delete" | "change" | "add" | "select")[], "delete" | "change" | "add" | "select", import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
|
|
266
|
+
data: {
|
|
267
|
+
type: import("vue").PropType<import("./src/interface").IBirthProcessData>;
|
|
268
|
+
required: true;
|
|
269
|
+
};
|
|
270
|
+
}>> & {
|
|
271
|
+
onChange?: ((...args: any[]) => any) | undefined;
|
|
272
|
+
onSelect?: ((...args: any[]) => any) | undefined;
|
|
273
|
+
onAdd?: ((...args: any[]) => any) | undefined;
|
|
274
|
+
onDelete?: ((...args: any[]) => any) | undefined;
|
|
275
|
+
}, {}>;
|
|
231
276
|
}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
|
|
232
277
|
mode: {
|
|
233
278
|
type: import("vue").PropType<import("./src/interface").IMode>;
|
|
@@ -19,8 +19,8 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
19
19
|
onDelete?: ((...args: any[]) => any) | undefined;
|
|
20
20
|
}>>;
|
|
21
21
|
emits: (event: "delete" | "change" | "add" | "select", ...args: any[]) => void;
|
|
22
|
-
leftScales: import("vue").ComputedRef<AnyObject
|
|
23
|
-
rightScales: import("vue").ComputedRef<AnyObject
|
|
22
|
+
leftScales: import("vue").ComputedRef<AnyObject[]>;
|
|
23
|
+
rightScales: import("vue").ComputedRef<AnyObject[]>;
|
|
24
24
|
leftAddAreaWidth: number;
|
|
25
25
|
rightAddAreaWidth: import("vue").ComputedRef<0 | 30>;
|
|
26
26
|
originX: import("vue").ComputedRef<number>;
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
import { defineComponent, computed, ref, reactive, onMounted, onBeforeUnmount, openBlock, createElementBlock } from 'vue';
|
|
2
|
+
import { fabric } from './utils/index.js';
|
|
3
|
+
import { defaultBorderStyle } from './hooks/useDraw.js';
|
|
4
|
+
import './hooks/useShadow.js';
|
|
5
|
+
import 'lodash-es';
|
|
6
|
+
import '@vueuse/core';
|
|
7
|
+
import { useBirthProcess } from './hooks/useBirthProcess.js';
|
|
8
|
+
import _export_sfc from '../../../_virtual/plugin-vue_export-helper.js';
|
|
9
|
+
|
|
10
|
+
const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
11
|
+
__name: "BirthProcessChart",
|
|
12
|
+
props: {
|
|
13
|
+
data: { type: Object, required: true }
|
|
14
|
+
},
|
|
15
|
+
emits: [
|
|
16
|
+
"change",
|
|
17
|
+
"add",
|
|
18
|
+
"delete",
|
|
19
|
+
"select"
|
|
20
|
+
],
|
|
21
|
+
setup(__props, { expose, emit: emits }) {
|
|
22
|
+
const props = __props;
|
|
23
|
+
const leftScales = computed(() => props.data.scaleValues.filter((item) => item.layout === "left"));
|
|
24
|
+
const rightScales = computed(() => props.data.scaleValues.filter((item) => item.layout === "right"));
|
|
25
|
+
const leftAddAreaWidth = 30;
|
|
26
|
+
const rightAddAreaWidth = computed(() => {
|
|
27
|
+
var _a;
|
|
28
|
+
return !((_a = rightScales.value) == null ? void 0 : _a.length) ? 0 : 30;
|
|
29
|
+
});
|
|
30
|
+
const originX = computed(() => {
|
|
31
|
+
var _a;
|
|
32
|
+
const leftScalesWidth = (_a = leftScales.value) == null ? void 0 : _a.reduce((width, item) => {
|
|
33
|
+
width += item.width;
|
|
34
|
+
return width;
|
|
35
|
+
}, 0);
|
|
36
|
+
return leftAddAreaWidth + leftScalesWidth;
|
|
37
|
+
});
|
|
38
|
+
const endX = computed(() => {
|
|
39
|
+
var _a;
|
|
40
|
+
const { width } = props.data;
|
|
41
|
+
const rightScalesWidth = (_a = rightScales.value) == null ? void 0 : _a.reduce((width2, item) => {
|
|
42
|
+
width2 += item.width;
|
|
43
|
+
return width2;
|
|
44
|
+
}, 0);
|
|
45
|
+
return width - rightAddAreaWidth.value - rightScalesWidth;
|
|
46
|
+
});
|
|
47
|
+
const gridXNumber = computed(() => props.data.grid.mainXCell);
|
|
48
|
+
const gridYNumber = computed(() => props.data.grid.mainYCell);
|
|
49
|
+
const xCellWidth = computed(() => {
|
|
50
|
+
return (endX.value - originX.value) / gridXNumber.value;
|
|
51
|
+
});
|
|
52
|
+
const yCellHeight = computed(() => {
|
|
53
|
+
const { xAxis, height } = props.data;
|
|
54
|
+
const xAxisNumber = Object.values(xAxis).reduce((num, item) => {
|
|
55
|
+
if (item.show)
|
|
56
|
+
num++;
|
|
57
|
+
return num;
|
|
58
|
+
}, 0);
|
|
59
|
+
return height / (gridYNumber.value + xAxisNumber);
|
|
60
|
+
});
|
|
61
|
+
const originY = computed(() => yCellHeight.value);
|
|
62
|
+
const endY = computed(() => {
|
|
63
|
+
const { height } = props.data;
|
|
64
|
+
return height - yCellHeight.value;
|
|
65
|
+
});
|
|
66
|
+
let select = ref();
|
|
67
|
+
const canvasRef = ref(null);
|
|
68
|
+
let canvas = ref();
|
|
69
|
+
const propItems = reactive({
|
|
70
|
+
canvasWidth: props.data.width,
|
|
71
|
+
canvasHeight: props.data.height,
|
|
72
|
+
borderStyle: { ...defaultBorderStyle, ...props.data.borderStyle },
|
|
73
|
+
selectionStyle: props.data.selectionStyle || {},
|
|
74
|
+
grid: props.data.grid,
|
|
75
|
+
originX: originX.value,
|
|
76
|
+
endX: endX.value,
|
|
77
|
+
originY: originY.value,
|
|
78
|
+
endY: endY.value,
|
|
79
|
+
xCellWidth: xCellWidth.value,
|
|
80
|
+
yCellHeight: yCellHeight.value,
|
|
81
|
+
gridXNumber: gridXNumber.value,
|
|
82
|
+
gridYNumber: gridYNumber.value,
|
|
83
|
+
xAxis: props.data.xAxis,
|
|
84
|
+
leftScales: leftScales.value,
|
|
85
|
+
rightScales: rightScales.value,
|
|
86
|
+
leftAddAreaWidth,
|
|
87
|
+
rightAddAreaWidth: rightAddAreaWidth.value
|
|
88
|
+
});
|
|
89
|
+
useBirthProcess(canvas, propItems);
|
|
90
|
+
onMounted(() => {
|
|
91
|
+
canvas.value = new fabric.Canvas(canvasRef.value, {
|
|
92
|
+
width: propItems.canvasWidth,
|
|
93
|
+
height: propItems.canvasHeight,
|
|
94
|
+
backgroundColor: "#fff",
|
|
95
|
+
selection: false,
|
|
96
|
+
containerClass: "c-fabric-chart",
|
|
97
|
+
fireRightClick: true
|
|
98
|
+
});
|
|
99
|
+
});
|
|
100
|
+
onBeforeUnmount(() => {
|
|
101
|
+
canvas.value.clear();
|
|
102
|
+
canvas.value = null;
|
|
103
|
+
});
|
|
104
|
+
expose({
|
|
105
|
+
select,
|
|
106
|
+
canvas
|
|
107
|
+
});
|
|
108
|
+
return (_ctx, _cache) => {
|
|
109
|
+
return openBlock(), createElementBlock("canvas", {
|
|
110
|
+
ref_key: "canvasRef",
|
|
111
|
+
ref: canvasRef
|
|
112
|
+
}, null, 512);
|
|
113
|
+
};
|
|
114
|
+
}
|
|
115
|
+
});
|
|
116
|
+
var BirthProcessChart = /* @__PURE__ */ _export_sfc(_sfc_main, [["__file", "BirthProcessChart.vue"]]);
|
|
117
|
+
|
|
118
|
+
export { BirthProcessChart as default };
|
|
@@ -229,6 +229,51 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
229
229
|
onSelect?: ((...args: any[]) => any) | undefined;
|
|
230
230
|
onAdd?: ((...args: any[]) => any) | undefined;
|
|
231
231
|
}, {}>;
|
|
232
|
+
BirthProcessChart: import("vue").DefineComponent<{
|
|
233
|
+
data: {
|
|
234
|
+
type: PropType<import("./interface").IBirthProcessData>;
|
|
235
|
+
required: true;
|
|
236
|
+
};
|
|
237
|
+
}, {
|
|
238
|
+
props: Readonly<import("@vue/shared").LooseRequired<Readonly<import("vue").ExtractPropTypes<{
|
|
239
|
+
data: {
|
|
240
|
+
type: PropType<import("./interface").IBirthProcessData>;
|
|
241
|
+
required: true;
|
|
242
|
+
};
|
|
243
|
+
}>> & {
|
|
244
|
+
onChange?: ((...args: any[]) => any) | undefined;
|
|
245
|
+
onSelect?: ((...args: any[]) => any) | undefined;
|
|
246
|
+
onAdd?: ((...args: any[]) => any) | undefined;
|
|
247
|
+
onDelete?: ((...args: any[]) => any) | undefined;
|
|
248
|
+
}>>;
|
|
249
|
+
emits: (event: "delete" | "change" | "add" | "select", ...args: any[]) => void;
|
|
250
|
+
leftScales: import("vue").ComputedRef<import("../../../shared/types").AnyObject[]>;
|
|
251
|
+
rightScales: import("vue").ComputedRef<import("../../../shared/types").AnyObject[]>;
|
|
252
|
+
leftAddAreaWidth: number;
|
|
253
|
+
rightAddAreaWidth: import("vue").ComputedRef<0 | 30>;
|
|
254
|
+
originX: import("vue").ComputedRef<number>;
|
|
255
|
+
endX: import("vue").ComputedRef<number>;
|
|
256
|
+
gridXNumber: import("vue").ComputedRef<any>;
|
|
257
|
+
gridYNumber: import("vue").ComputedRef<any>;
|
|
258
|
+
xCellWidth: import("vue").ComputedRef<number>;
|
|
259
|
+
yCellHeight: import("vue").ComputedRef<number>;
|
|
260
|
+
originY: import("vue").ComputedRef<number>;
|
|
261
|
+
endY: import("vue").ComputedRef<number>;
|
|
262
|
+
select: import("vue").Ref<any>;
|
|
263
|
+
canvasRef: any;
|
|
264
|
+
canvas: import("vue").Ref<any>;
|
|
265
|
+
propItems: any;
|
|
266
|
+
}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("delete" | "change" | "add" | "select")[], "delete" | "change" | "add" | "select", import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
|
|
267
|
+
data: {
|
|
268
|
+
type: PropType<import("./interface").IBirthProcessData>;
|
|
269
|
+
required: true;
|
|
270
|
+
};
|
|
271
|
+
}>> & {
|
|
272
|
+
onChange?: ((...args: any[]) => any) | undefined;
|
|
273
|
+
onSelect?: ((...args: any[]) => any) | undefined;
|
|
274
|
+
onAdd?: ((...args: any[]) => any) | undefined;
|
|
275
|
+
onDelete?: ((...args: any[]) => any) | undefined;
|
|
276
|
+
}, {}>;
|
|
232
277
|
}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
|
|
233
278
|
mode: {
|
|
234
279
|
type: PropType<IMode>;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import { defineComponent, computed, ref, unref, openBlock, createBlock, mergeProps
|
|
1
|
+
import { defineComponent, computed, ref, unref, openBlock, createBlock, mergeProps } from 'vue';
|
|
2
2
|
import TemperatureChart from './TemperatureChart.vue.js';
|
|
3
|
+
import BirthProcessChart from './BirthProcessChart.vue.js';
|
|
3
4
|
import _export_sfc from '../../../_virtual/plugin-vue_export-helper.js';
|
|
4
5
|
|
|
5
6
|
const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
@@ -31,7 +32,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
31
32
|
key: 0,
|
|
32
33
|
ref_key: "fabricChartRef",
|
|
33
34
|
ref: fabricChartRef
|
|
34
|
-
}, _ctx.$attrs), null, 16)) :
|
|
35
|
+
}, _ctx.$attrs), null, 16)) : (openBlock(), createBlock(BirthProcessChart, { key: 1 }));
|
|
35
36
|
};
|
|
36
37
|
}
|
|
37
38
|
});
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export { defaultBorderStyle, defaultLineStyle, defaultRectStyle, defaultStyle, defaultTextStyle, drawArrow, drawLine, drawPoint, drawText, drawTextGroup } from './useDraw.js';
|
|
2
|
-
export { useCumputedPoint } from './useCumputedPoint.js';
|
|
2
|
+
export { useBirthProcessCumputedPoint, useCumputedPoint } from './useCumputedPoint.js';
|
|
3
3
|
export { useTop } from './useTop.js';
|
|
4
4
|
export { useLeft } from './useLeft.js';
|
|
5
5
|
export { useRight } from './useRight.js';
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
import { onMounted, nextTick } from 'vue';
|
|
2
|
+
import useGrid from './useGrid.js';
|
|
3
|
+
import { drawText, defaultTextStyle, defaultRectStyle } from './useDraw.js';
|
|
4
|
+
import { fabric } from '../utils/index.js';
|
|
5
|
+
|
|
6
|
+
function useBirthProcess(canvas, propItems) {
|
|
7
|
+
useGrid(canvas, propItems, true);
|
|
8
|
+
function drawXScale() {
|
|
9
|
+
const { xAxis, grid, originX, originY, xCellWidth, endY } = propItems;
|
|
10
|
+
const { show, startTime, range = [0, 23], position = "top", style } = xAxis.time;
|
|
11
|
+
const { show: processTimeShow, range: processTimeRange = [0, 23], style: processTimeStyle } = xAxis.processTime;
|
|
12
|
+
if (show || processTimeShow) {
|
|
13
|
+
const timeList = [];
|
|
14
|
+
const processTimeList = [];
|
|
15
|
+
const timeTextList = [];
|
|
16
|
+
const processTimeTextList = [];
|
|
17
|
+
const left = originX + xCellWidth / 2;
|
|
18
|
+
for (let i = 0; i < grid.mainXCell; i++) {
|
|
19
|
+
if (show) {
|
|
20
|
+
const currentTime = i === 0 ? +startTime.slice(11, 13) : getCurrentTime(timeList.at(-1), range);
|
|
21
|
+
timeList.push(currentTime);
|
|
22
|
+
const top = position == "top" ? originY - 15 : endY + 15;
|
|
23
|
+
timeTextList.push(
|
|
24
|
+
drawText([left + i * xCellWidth, top], {
|
|
25
|
+
value: String(currentTime),
|
|
26
|
+
...defaultTextStyle,
|
|
27
|
+
...style || {}
|
|
28
|
+
})
|
|
29
|
+
);
|
|
30
|
+
}
|
|
31
|
+
if (processTimeShow) {
|
|
32
|
+
const currentProcessTime = i === 0 ? processTimeRange[0] : processTimeList.at(-1) + 1;
|
|
33
|
+
processTimeList.push(currentProcessTime);
|
|
34
|
+
const top = position == "top" ? endY + 15 : originY - 15;
|
|
35
|
+
processTimeTextList.push(
|
|
36
|
+
drawText([left + i * xCellWidth, top], {
|
|
37
|
+
value: String(currentProcessTime),
|
|
38
|
+
...defaultTextStyle,
|
|
39
|
+
...processTimeStyle || {}
|
|
40
|
+
})
|
|
41
|
+
);
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
const group = new fabric.Group([...timeTextList, ...processTimeTextList], {
|
|
45
|
+
evented: false,
|
|
46
|
+
selectable: false
|
|
47
|
+
});
|
|
48
|
+
canvas.value.add(group);
|
|
49
|
+
canvas.value.sendToBack(group);
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
function getCurrentTime(lastTime, range) {
|
|
53
|
+
return lastTime + 1 > range[1] ? range[0] : lastTime + 1;
|
|
54
|
+
}
|
|
55
|
+
function drawYScale() {
|
|
56
|
+
const { leftAddAreaWidth, leftScales, rightScales, originY, endY, yCellHeight, endX } = propItems;
|
|
57
|
+
let baseLeft = leftAddAreaWidth;
|
|
58
|
+
[...leftScales, ...rightScales].forEach((item, index) => {
|
|
59
|
+
const { range, spaceValue, width, title, titleStyle, layout } = item;
|
|
60
|
+
const textList = [];
|
|
61
|
+
if (layout === "right")
|
|
62
|
+
baseLeft = endX;
|
|
63
|
+
const left = baseLeft + width / 2;
|
|
64
|
+
const list = getScaleNumberList(range, spaceValue);
|
|
65
|
+
list.forEach((num, i) => {
|
|
66
|
+
const top = i === 0 ? endY - 8 : endY - i * yCellHeight;
|
|
67
|
+
textList.push(
|
|
68
|
+
drawText([left, top], {
|
|
69
|
+
value: String(num),
|
|
70
|
+
...defaultTextStyle
|
|
71
|
+
})
|
|
72
|
+
);
|
|
73
|
+
});
|
|
74
|
+
const border = new fabric.Rect({
|
|
75
|
+
...defaultRectStyle,
|
|
76
|
+
width,
|
|
77
|
+
height: endY,
|
|
78
|
+
left,
|
|
79
|
+
top: endY / 2
|
|
80
|
+
});
|
|
81
|
+
const titleText = originY > 0 ? drawText([left, originY - yCellHeight / 2], {
|
|
82
|
+
value: String(title),
|
|
83
|
+
...defaultTextStyle,
|
|
84
|
+
...titleStyle
|
|
85
|
+
}) : null;
|
|
86
|
+
const group = new fabric.Group([...textList, border, ...titleText ? [titleText] : []], {
|
|
87
|
+
evented: false,
|
|
88
|
+
selectable: false
|
|
89
|
+
});
|
|
90
|
+
canvas.value.add(group);
|
|
91
|
+
baseLeft += width;
|
|
92
|
+
});
|
|
93
|
+
}
|
|
94
|
+
function getScaleNumberList(range, spaceValue) {
|
|
95
|
+
const list = [];
|
|
96
|
+
const [min, max] = range;
|
|
97
|
+
for (let i = min; i <= max; i += spaceValue) {
|
|
98
|
+
list.push(i);
|
|
99
|
+
}
|
|
100
|
+
return list;
|
|
101
|
+
}
|
|
102
|
+
function drawBorder() {
|
|
103
|
+
const { canvasWidth, borderStyle, endY, leftAddAreaWidth, rightAddAreaWidth } = propItems;
|
|
104
|
+
const border = new fabric.Rect({
|
|
105
|
+
...borderStyle,
|
|
106
|
+
width: canvasWidth - leftAddAreaWidth - rightAddAreaWidth,
|
|
107
|
+
height: endY,
|
|
108
|
+
left: leftAddAreaWidth,
|
|
109
|
+
top: 0,
|
|
110
|
+
fill: "transparent"
|
|
111
|
+
});
|
|
112
|
+
canvas.value.add(border);
|
|
113
|
+
}
|
|
114
|
+
onMounted(() => {
|
|
115
|
+
nextTick(() => {
|
|
116
|
+
drawYScale();
|
|
117
|
+
drawXScale();
|
|
118
|
+
drawBorder();
|
|
119
|
+
});
|
|
120
|
+
});
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
export { useBirthProcess };
|