cnhis-design-vue 3.1.48 → 3.1.49-beta.1
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/classification/index.d.ts +4 -2
- package/es/components/classification/src/components/search-filter/index.vue.d.ts +4 -2
- package/es/components/classification/src/components/set-classification/index.vue.d.ts +4 -2
- package/es/components/classification/src/index.vue.d.ts +4 -2
- package/es/components/date-picker/index.d.ts +2 -1
- package/es/components/date-picker/src/DatePicker.vue.d.ts +2 -1
- package/es/components/date-picker/src/DatePicker.vue2.js +1 -1
- package/es/components/fabric-chart/src/FabricChart.vue2.js +1 -1
- package/es/components/fabric-chart/src/components/PopupMenu.js +1 -1
- package/es/components/fabric-chart/src/hooks/birthProcess/useBirthProcess.js +1 -1
- package/es/components/fabric-chart/src/hooks/birthProcess/useBirthProcessChart.js +1 -1
- package/es/components/fabric-chart/src/hooks/index.js +1 -1
- package/es/components/fabric-chart/src/hooks/surgicalAnesthesia/useCenter.js +1 -1
- package/es/components/fabric-chart/src/hooks/surgicalAnesthesia/useLeft.js +1 -1
- package/es/components/fabric-chart/src/hooks/surgicalAnesthesia/useOther.js +1 -1
- package/es/components/fabric-chart/src/hooks/surgicalAnesthesia/useSurgicalAnesthesiaChart.js +1 -1
- package/es/components/fabric-chart/src/hooks/surgicalAnesthesia/useTop.js +1 -1
- package/es/components/fabric-chart/src/hooks/temperature/useBottom.js +1 -1
- package/es/components/fabric-chart/src/hooks/temperature/useCenter.js +1 -1
- package/es/components/fabric-chart/src/hooks/temperature/useLeft.js +1 -1
- package/es/components/fabric-chart/src/hooks/temperature/useOther.js +1 -1
- package/es/components/fabric-chart/src/hooks/temperature/useTemperatureChart.js +1 -1
- package/es/components/fabric-chart/src/hooks/temperature/useTop.js +1 -1
- package/es/components/fabric-chart/src/hooks/useEvent.d.ts +0 -1
- package/es/components/fabric-chart/src/hooks/useEvent.js +1 -1
- package/es/components/field-set/index.d.ts +26 -0
- package/es/components/field-set/src/FieldSet.vue.d.ts +26 -0
- package/es/components/field-set/src/FieldSet.vue2.js +1 -1
- package/es/components/field-set/src/components/Row.vue.d.ts +13 -0
- package/es/components/field-set/src/components/Row.vue2.js +1 -1
- package/es/components/form-config/index.d.ts +7 -0
- package/es/components/form-config/src/FormConfig.vue.d.ts +7 -0
- package/es/components/form-config/src/components/FormConfigEdit.vue.d.ts +3 -0
- package/es/components/form-render/src/components/renderer/inputNumber.d.ts +35 -0
- package/es/components/form-render/src/components/renderer/inputNumber.js +1 -1
- package/es/components/form-render/src/hooks/useFieldListAdaptor.js +1 -1
- package/es/components/form-render/src/hooks/useFormValidator.js +1 -1
- package/es/components/form-render/src/types/fieldItem.d.ts +1 -0
- package/es/components/form-render/style/index.css +1 -1
- package/es/components/iho-table/src/plugins/filterDaterangeRenderPlugin/filter.vue.d.ts +2 -1
- package/es/components/iho-table/src/plugins/rendererPlugins/editableWidgets/dateRendererPlugin/editDate.vue.d.ts +2 -1
- package/es/components/index.css +1 -1
- package/es/components/scale-view/src/ScaleView.vue2.js +1 -1
- package/es/components/select-label/src/LabelFormContent.vue2.js +1 -1
- package/es/components/select-person/src/SearchMultiple.vue.d.ts +6 -0
- package/es/components/shortcut-setter/index.d.ts +1 -0
- package/es/components/shortcut-setter/src/ShortcutSetter.vue.d.ts +1 -0
- package/es/components/table-export-field/src/components/ExportModal.vue.d.ts +0 -3
- package/es/components/table-filter/src/components/classify-filter/ValueCfg.vue.d.ts +4 -2
- package/es/components/table-filter/src/components/classify-filter/components/Date.vue.d.ts +2 -1
- package/es/components/table-filter/src/components/classify-filter/components/DateRange.vue.d.ts +2 -1
- package/es/components/table-filter/src/components/classify-filter/components/index.d.ts +4 -2
- package/es/components/table-filter/src/components/classify-filter/index.vue.d.ts +4 -2
- package/es/components/table-filter/src/components/render-widget/components/DateInner.vue.d.ts +2 -1
- package/es/components/table-filter/src/components/render-widget/components/DateOut.vue.d.ts +2 -1
- package/es/components/table-filter/src/components/render-widget/components/DateRangeInner.vue.d.ts +2 -1
- package/es/components/table-filter/src/components/render-widget/components/DateRangeOut.vue.d.ts +2 -1
- package/es/components/table-filter/src/components/render-widget/components/index.d.ts +8 -4
- package/es/components/table-filter/src/components/render-widget/widgetCfgMaps.d.ts +8 -4
- package/es/env.d.ts +25 -25
- package/es/shared/assets/img/failure.png.js +1 -1
- package/es/shared/assets/img/no-permission.png.js +1 -1
- package/es/shared/assets/img/nodata.png.js +1 -1
- package/es/shared/assets/img/notfound.png.js +1 -1
- package/es/shared/assets/img/qr.png.js +1 -1
- package/es/shared/assets/img/success.png.js +1 -1
- package/es/shared/assets/img/video.png.js +1 -1
- package/es/shared/assets/img/video_default_cover.png.js +1 -1
- package/es/shared/assets/img/xb_big.png.js +1 -1
- package/es/shared/assets/img/xb_small.png.js +1 -1
- package/es/shared/hooks/useDateTime.d.ts +1 -0
- package/es/shared/hooks/useDateTime.js +1 -1
- package/es/shared/package.json.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/shared/components/VueDraggable/src/vuedraggable.d.ts +0 -86
- package/es/shared/utils/fabricjs/index.d.ts +0 -6823
- package/es/shared/utils/tapable/index.d.ts +0 -139
- package/es/shared/utils/tapableLess.d.ts +0 -28
- package/es/shared/utils/tapableLess.js +0 -1
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
|
+
```
|
|
@@ -816,8 +816,9 @@ declare const CClassification: SFCWithInstall<import("vue").DefineComponent<{
|
|
|
816
816
|
panelFormatRef: import("vue").ComputedRef<string | [string, string]>;
|
|
817
817
|
focus: () => any;
|
|
818
818
|
blur: () => any;
|
|
819
|
+
handleConfirm: (target: HTMLInputElement) => void;
|
|
819
820
|
onUpdateShow: (show: boolean) => void;
|
|
820
|
-
onConfirm: (...args: any[]) => void
|
|
821
|
+
onConfirm: (...args: any[]) => Promise<void>;
|
|
821
822
|
NDatePicker: any;
|
|
822
823
|
}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
|
|
823
824
|
updateUnchangedValue: {
|
|
@@ -1375,8 +1376,9 @@ declare const CClassification: SFCWithInstall<import("vue").DefineComponent<{
|
|
|
1375
1376
|
panelFormatRef: import("vue").ComputedRef<string | [string, string]>;
|
|
1376
1377
|
focus: () => any;
|
|
1377
1378
|
blur: () => any;
|
|
1379
|
+
handleConfirm: (target: HTMLInputElement) => void;
|
|
1378
1380
|
onUpdateShow: (show: boolean) => void;
|
|
1379
|
-
onConfirm: (...args: any[]) => void
|
|
1381
|
+
onConfirm: (...args: any[]) => Promise<void>;
|
|
1380
1382
|
NDatePicker: any;
|
|
1381
1383
|
}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
|
|
1382
1384
|
updateUnchangedValue: {
|
|
@@ -293,8 +293,9 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
293
293
|
panelFormatRef: import("vue").ComputedRef<string | [string, string]>;
|
|
294
294
|
focus: () => any;
|
|
295
295
|
blur: () => any;
|
|
296
|
+
handleConfirm: (target: HTMLInputElement) => void;
|
|
296
297
|
onUpdateShow: (show: boolean) => void;
|
|
297
|
-
onConfirm: (...args: any[]) => void
|
|
298
|
+
onConfirm: (...args: any[]) => Promise<void>;
|
|
298
299
|
NDatePicker: any;
|
|
299
300
|
}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
|
|
300
301
|
updateUnchangedValue: {
|
|
@@ -852,8 +853,9 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
852
853
|
panelFormatRef: import("vue").ComputedRef<string | [string, string]>;
|
|
853
854
|
focus: () => any;
|
|
854
855
|
blur: () => any;
|
|
856
|
+
handleConfirm: (target: HTMLInputElement) => void;
|
|
855
857
|
onUpdateShow: (show: boolean) => void;
|
|
856
|
-
onConfirm: (...args: any[]) => void
|
|
858
|
+
onConfirm: (...args: any[]) => Promise<void>;
|
|
857
859
|
NDatePicker: any;
|
|
858
860
|
}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
|
|
859
861
|
updateUnchangedValue: {
|
|
@@ -603,8 +603,9 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
603
603
|
panelFormatRef: import("vue").ComputedRef<string | [string, string]>;
|
|
604
604
|
focus: () => any;
|
|
605
605
|
blur: () => any;
|
|
606
|
+
handleConfirm: (target: HTMLInputElement) => void;
|
|
606
607
|
onUpdateShow: (show: boolean) => void;
|
|
607
|
-
onConfirm: (...args: any[]) => void
|
|
608
|
+
onConfirm: (...args: any[]) => Promise<void>;
|
|
608
609
|
NDatePicker: any;
|
|
609
610
|
}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
|
|
610
611
|
updateUnchangedValue: {
|
|
@@ -1162,8 +1163,9 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
1162
1163
|
panelFormatRef: import("vue").ComputedRef<string | [string, string]>;
|
|
1163
1164
|
focus: () => any;
|
|
1164
1165
|
blur: () => any;
|
|
1166
|
+
handleConfirm: (target: HTMLInputElement) => void;
|
|
1165
1167
|
onUpdateShow: (show: boolean) => void;
|
|
1166
|
-
onConfirm: (...args: any[]) => void
|
|
1168
|
+
onConfirm: (...args: any[]) => Promise<void>;
|
|
1167
1169
|
NDatePicker: any;
|
|
1168
1170
|
}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
|
|
1169
1171
|
updateUnchangedValue: {
|
|
@@ -817,8 +817,9 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
817
817
|
panelFormatRef: import("vue").ComputedRef<string | [string, string]>;
|
|
818
818
|
focus: () => any;
|
|
819
819
|
blur: () => any;
|
|
820
|
+
handleConfirm: (target: HTMLInputElement) => void;
|
|
820
821
|
onUpdateShow: (show: boolean) => void;
|
|
821
|
-
onConfirm: (...args: any[]) => void
|
|
822
|
+
onConfirm: (...args: any[]) => Promise<void>;
|
|
822
823
|
NDatePicker: any;
|
|
823
824
|
}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
|
|
824
825
|
updateUnchangedValue: {
|
|
@@ -1376,8 +1377,9 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
1376
1377
|
panelFormatRef: import("vue").ComputedRef<string | [string, string]>;
|
|
1377
1378
|
focus: () => any;
|
|
1378
1379
|
blur: () => any;
|
|
1380
|
+
handleConfirm: (target: HTMLInputElement) => void;
|
|
1379
1381
|
onUpdateShow: (show: boolean) => void;
|
|
1380
|
-
onConfirm: (...args: any[]) => void
|
|
1382
|
+
onConfirm: (...args: any[]) => Promise<void>;
|
|
1381
1383
|
NDatePicker: any;
|
|
1382
1384
|
}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
|
|
1383
1385
|
updateUnchangedValue: {
|
|
@@ -25,8 +25,9 @@ declare const DatePicker: SFCWithInstall<import("vue").DefineComponent<{
|
|
|
25
25
|
panelFormatRef: import("vue").ComputedRef<string | [string, string]>;
|
|
26
26
|
focus: () => any;
|
|
27
27
|
blur: () => any;
|
|
28
|
+
handleConfirm: (target: HTMLInputElement) => void;
|
|
28
29
|
onUpdateShow: (show: boolean) => void;
|
|
29
|
-
onConfirm: (...args: any[]) => void
|
|
30
|
+
onConfirm: (...args: any[]) => Promise<void>;
|
|
30
31
|
NDatePicker: any;
|
|
31
32
|
}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
|
|
32
33
|
updateUnchangedValue: {
|
|
@@ -25,8 +25,9 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
25
25
|
panelFormatRef: import("vue").ComputedRef<string | [string, string]>;
|
|
26
26
|
focus: () => any;
|
|
27
27
|
blur: () => any;
|
|
28
|
+
handleConfirm: (target: HTMLInputElement) => void;
|
|
28
29
|
onUpdateShow: (show: boolean) => void;
|
|
29
|
-
onConfirm: (...args: any[]) => void
|
|
30
|
+
onConfirm: (...args: any[]) => Promise<void>;
|
|
30
31
|
NDatePicker: any;
|
|
31
32
|
}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
|
|
32
33
|
updateUnchangedValue: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{defineComponent as e,useAttrs as
|
|
1
|
+
import{defineComponent as e,useAttrs as n,ref as t,computed as l,openBlock as a,createBlock as u,unref as o,mergeProps as r,createSlots as i,renderList as s,withCtx as d,renderSlot as p,nextTick as c}from"vue";import{NDatePicker as f}from"naive-ui";import"../../../shared/utils/index.js";import"lodash-es";import{useDateTime as v}from"../../../shared/hooks/useDateTime.js";import{format as m}from"date-fns";var y=e({__name:"DatePicker",props:{updateUnchangedValue:{type:Boolean},onConfirm:{type:Function}},setup(e,{expose:y}){const h=e,g=n(),M=t(null),R=t(null),k=l((()=>{const e=Reflect.get(g,"type")||"";return["datetime","datetimerange"].includes(e)})),w=l((()=>{if(Reflect.get(g,"format"))return g.format;const e=g.type||"";return k.value?"yyyy-MM-dd HH:mm:ss":"month"===e?"yyyy-MM":"year"===e?"yyyy":"yyyy-MM-dd"})),C=l((()=>k.value?w.value.split(" "):"")),{focus:$,blur:D,handleConfirm:E}=v(M,w,g);function I(e){e&&k.value&&c((()=>{var e;R.value=null==(e=M.value)?void 0:e.panelInstRef,v(R,C,g,!0)}))}async function _(...e){var n,t,l,a,u,o;const r=Reflect.get(g,"type")||"",i=null==(a=null==(l=null==(t=null==(n=M.value)?void 0:n.inputInstRef)?void 0:t.$el)?void 0:l.querySelector)?void 0:a.call(l,"input");if(r.includes("range")?null==(u=h.onConfirm)||u.call(h,...e):(await c(),i.focus(),E(i),i.blur(),null==(o=h.onConfirm)||o.call(h,Date.parse(i.value),i.value)),!(null==i?void 0:i.value)||!h.updateUnchangedValue||r.includes("range"))return;const s=i.value;i.value=m(new Date,w.value),i.dispatchEvent(new InputEvent("input")),i.value=s,i.dispatchEvent(new InputEvent("input"))}return y({$datePicker:M,focus:$,blur:D}),(e,n)=>(a(),u(o(f),r({ref_key:"datePickerRef",ref:M},e.$attrs,{"onUpdate:show":I,onConfirm:_}),i({_:2},[s(e.$slots,((n,t)=>({name:t,fn:d((()=>[p(e.$slots,t)]))})))]),1040))}});export{y as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{defineComponent as e,ref as t,reactive as r,onMounted as s,onBeforeUnmount as o,openBlock as a,createElementBlock as
|
|
1
|
+
import{defineComponent as e,ref as t,reactive as r,onMounted as s,onBeforeUnmount as o,openBlock as a,createElementBlock as n,Fragment as i,createElementVNode as p,createBlock as u,mergeProps as l,unref as c,createCommentVNode as h}from"vue";import{fabric as m}from"../../../shared/utils/fabricjs/index.js";import f from"./components/PopupTip.vue.js";import d from"./components/PopupMenu.js";import"./hooks/useDraw.js";import"date-fns";import"lodash-es";import{useBirthProcessChart as v}from"./hooks/birthProcess/useBirthProcessChart.js";import{useTemperatureChart as w}from"./hooks/temperature/useTemperatureChart.js";import{useSurgicalAnesthesiaChart as k}from"./hooks/surgicalAnesthesia/useSurgicalAnesthesiaChart.js";var g=e({__name:"FabricChart",props:{type:{type:String,default:"temperature"},data:{type:Object,required:!0},addRenderItem:{type:Function}},emits:["change","add","remove","select","add:prevent"],setup(e,{expose:g,emit:C}){const y=e,j=t(null),b=t(),P=r({show:!1,point:{x:0,y:0},list:[]}),x=r({show:!1,point:{x:0,y:0},list:[],target:null}),{propItems:I,redrawPoints:M,select:A,clickMenu:R}=function(){const e=[b,y,C,j,P,x];switch(y.type){case"birthProcess":return v(...e);case"surgicalAnesthesia":return k(...e);default:return w(...e)}}();return s((()=>{b.value=new m.Canvas(j.value,{width:I.canvasWidth,height:I.canvasHeight,backgroundColor:"#fff",selection:!1,containerClass:"c-fabric-chart",stopContextMenu:!0,fireRightClick:!0,allowTouchScrolling:!0})})),o((()=>{b.value.off(),b.value.clear()})),g({redrawPoints:M,select:A,canvas:b}),(e,t)=>(a(),n(i,null,[p("canvas",{ref_key:"canvasRef",ref:j},null,512),b.value?(a(),u(f,l({key:0,propItems:c(I)},P),null,16,["propItems"])):h("v-if",!0),b.value?(a(),u(c(d),l({key:1,propItems:c(I)},x,{show:x.show,"onUpdate:show":t[0]||(t[0]=e=>x.show=e),onClickMenu:c(R)}),null,16,["propItems","show","onClickMenu"])):h("v-if",!0)],64))}});export{g as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{defineComponent as e,ref as t,watch as l,createVNode as a,Teleport as o,withDirectives as r,vShow as n}from"vue";import{NSpace as u,NInputNumber as i}from"naive-ui";import s from"./useStyle.js";import{onClickOutside as
|
|
1
|
+
import{defineComponent as e,ref as t,watch as l,createVNode as a,Teleport as o,withDirectives as r,vShow as n}from"vue";import{NSpace as u,NInputNumber as i}from"naive-ui";import s from"./useStyle.js";import{useEventListener as p,onClickOutside as c}from"@vueuse/core";var f=e({name:"PopupMenu",inheritAttrs:!1,props:{show:{type:Boolean,default:!1},list:{type:Array,default:()=>[]},point:{type:Object},propItems:{type:Object},target:{type:Object}},emits:["update:show","clickMenu"],setup(e,{attrs:f,slots:m,emit:d}){let v=!1;const h=t(null);p(h,"contextmenu",(e=>(e.preventDefault(),!1))),c(h,(e=>{!v&&d("update:show",!1),v=!1}));const{left:y}=e.propItems,b=s(e);function g(e){if("string"==typeof e&&(e.startsWith("新增")||e.startsWith("删除")))return!0}function w(t){var l;if("string"==typeof t)return t;if("boolean"==typeof t.value)return t.label;if(t.renderItem)return t.renderItem();const o=+((null==(l=y.yScaleValue.find((t=>t.type===e.target.origin.type)))?void 0:l.list[0])||0);return a(u,{inline:!0,align:"center"},{default:()=>[a("span",null,[t.label]),a(i,{style:"width: 110px",size:"small",value:t.value,"onUpdate:value":e=>t.value=e,clearable:!0,placeholder:"请输入数值",max:e.target.origin.data.value,min:o,showButton:!1,onFocus:()=>d("update:show",!0)},null)]})}return l((()=>e.show),(t=>{t&&(v=!0,e.list.forEach((e=>{"object"==typeof e&&Reflect.has(e,"value")&&"boolean"!=typeof e.value&&(e.value=void 0)})))})),()=>a(o,{to:".c-fabric-chart"},{default:()=>[r(a("ul",{ref:h,class:"c-fabric-chart-popup-menu",style:b.value},[e.list.map((t=>e.show?a("li",{class:{"no-click":g(t)},onClick:l=>function(t,l){g(l)||""===(null==t?void 0:t.target.className)&&(d("update:show",!1),d("clickMenu",{item:l,target:e.target}))}(l,t)},[w(t)]):null))]),[[n,e.show]])]})}});export{f as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{fabric as e}from"../../../../../shared/utils/fabricjs/index.js";import{drawLine as t,drawArrow as
|
|
1
|
+
import{fabric as e}from"../../../../../shared/utils/fabricjs/index.js";import{drawLine as t,drawArrow as n,drawText as o,defaultTextStyle as i,drawPoint as r,drawTextAndIconGroup as l,defaultStyle as s,defaultRectStyle as a}from"../useDraw.js";import{useGrid as u}from"../useGrid.js";import{useBirthProcessCumputedPoint as c}from"../useCumputedPoint.js";import{getScaleInfo as d,drawScaleNumber as f,drawScaleLine as p}from"../useScaleColumn.js";import{useCommon as h}from"../useCommon.js";import"vue";import{getIndex as g,isEffectiveNode as v,getTime as m,getScaleNumberList as y}from"../../utils/index.js";import"../temperature/useShadow.js";import{cloneDeep as k}from"lodash-es";import{format as w}from"date-fns";function x(x,b,j,C,P){const{cumputedX:S,cumputedY:G,getXValue:M,getYValue:T}=c(b),{getEqualXTypes:Y,handleAddPrevent:E,isGridLimit:L}=h(x,j,b),{xAxis:X,grid:A,originX:I,originY:H,xCellWidth:W,endY:O,startTime:V,leftAddAreaWidth:D,leftScales:N,rightScales:R,yCellHeight:$,endX:B,scaleValues:F,canvasWidth:q,borderStyle:z,rightAddAreaWidth:J,event:K,originYCervix:Q,other:U,canvasHeight:Z}=b,_=k(F),ee=new Set;function te(){_.filter((e=>e.show)).forEach(((e,l)=>{var s;const a=[],u=[],c=[];null==(s=e.data)||s.forEach(((s,d)=>{!function(s,d,f){let p,h;const{pointAttr:g={},lineAttr:v={},title:m="",key:y,type:k="circle",childbirthStyle:w={}}=e,P=e.data[f+1],S=le(P,e);if(s&&S&&!d.breakpoint)h=t([...s,...S],{...v});else if(s&&!S&&!d.breakpoint){const n=le(P,e);h=n?t([...s,...n],{...v}):null}let G,Y;if(d.childbirth){const e=s[1]+$;G=n([s[0],s[1],e],w),c.push(G),Y=o([s[0]+W/2,e-$/2],{value:String(d.childbirth),...i,originX:"left",originY:"center",...w}),c.push(Y)}const E=u[f-1],L={origin:{data:d,title:m,key:y||"",dataIndex:l,index:f},leftLine:E,rightLine:h,arrowGroup:G,arrowGroupText:Y,...g,...b.event.hovered?b.event.evented?{selectable:!0}:{selectable:!0,lockMovementX:!0,lockMovementY:!0}:b.event};E?p=r(k,{left:E.get("x2"),top:E.get("y2"),...L}):s&&(L.leftLine=null,p=r(k,{left:s[0],top:s[1],...L}));u.push(h),p&&(!function(e){K.hovered&&(e.on("mouseover",(()=>{re(e,"hover")})),e.on("mouseout",(()=>{C.show=!1})));if(e.lockMovementX&&e.lockMovementY)return;e.on("moving",(()=>{ie(e),function(e){var t,n,o,i;null==(t=e.leftLine)||t.setCoords().set({x2:e.left,y2:e.top}),null==(n=e.rightLine)||n.setCoords().set({x1:e.left,y1:e.top}),null==(o=e.arrowGroup)||o.setCoords().set({left:e.left,top:e.top}),null==(i=e.arrowGroupText)||i.setCoords().set({left:e.left+W/2,top:e.top+$/2})}(e),K.hovered&&re(e)})),e.on("mouseup",(t=>{if(C.show=!1,1===t.button){const{key:t}=e.origin,n={...e.origin,data:{...e.origin.data,time:M(e.left),value:T(t,e.top)}};x.value.discardActiveObject(),j("change",n),ne(n,"change")}}))}(p),a.push(p),ee.add(p))}(le(s,e),s,d)})),Promise.all(a).then((e=>{const t=u.filter((e=>e));let n=null;e=e.filter((e=>(e&&n&&(n.nextPoint=e,e.prevPoint=n),n=e||n,e))),Promise.all(c).then((n=>{x.value.add(...t,...e,...n),e.forEach((e=>{null==e||e.bringToFront()}))}))}))}))}function ne(e,t="add"){const{dataIndex:n,data:o,index:i,key:r}=e,l=_.find((e=>e.key===r));switch(t){case"remove":l.data.splice(i,1);break;case"change":l.data[i]=o;break;default:{const e=g(o.time,l.data);l.data.splice(e,0,o);break}}oe()}function oe(){var e;ee.size&&(null==(e=x.value)||e.remove(...function(e){const t=[];return e.forEach((e=>{e&&t.push(e),(null==e?void 0:e.leftLine)&&t.push(null==e?void 0:e.leftLine),(null==e?void 0:e.rightLine)&&t.push(null==e?void 0:e.rightLine),(null==e?void 0:e.arrowGroup)&&t.push(null==e?void 0:e.arrowGroup),(null==e?void 0:e.arrowGroupText)&&t.push(null==e?void 0:e.arrowGroupText)})),t}([...ee]))),ee.clear(),te()}function ie(e){const t=e.prevPoint?e.prevPoint.left:I,n=e.nextPoint?e.nextPoint.left:B;e.setCoords(),["cervix","fetalPresentation"].includes(e.origin.key)&&e.top<Q&&e.set("top",Q),e.top<H&&e.set("top",H),e.top>O&&e.set("top",O),e.left<t&&e.set("left",t),e.left>n&&e.set("left",n)}function re(e,t="moving"){const{title:n,key:o,data:i}=e.origin;C.point={x:e.left,y:e.top},C.list=[`${n} ${"hover"===t?i.value:T(o,e.top)}`,`时间 ${M(e.left).slice(-5)}`],C.show=!0}function le(e,t){if(v(e)&&function(e){const t=V+864e5,n=m(e);return n>=V&&n<=t}(e.time)){const n=S(e.time),o=G(t.key,t.range,e.value);return[n,o<H?H:o>O?O:o]}}function se(e,t){return e+1>t[1]?t[0]:e+1}return u(x,b),function(){const t=new e.Rect({...z,width:q-D-J-1,height:O-1,left:D,top:0,fill:"transparent"});x.value.add(t)}(),function(){function t(t,n="left"){let r="left"===n?D:B;t.forEach(((t,n)=>{const{range:l,spaceValue:u,width:c,title:h,titleStyle:g,key:v,position:m="center",spaceGridNumber:k=1,showNumber:w,showMaxMinNumber:b}=t,j=[],C=[],P=r+c/2,S=y(l,u),G=S.length;S.forEach(((e,n)=>{const{lineXMain:o,lineXSub:i,textLeft:l}=d(m,r,c),s=O-n*$*k,a=0===n?O-8:n!==S.length-1||H||Q&&"FHR"!==v?s:H+8;!w||(0===n||n===G-1)&&!b||j.push(f(String(e),t,l,a)),C.push(...p(t,n,o,i,s,$,H,G))}));const M=new e.Rect({...a,strokeWidth:.5,width:c,height:O,left:P,top:O/2}),T=o([P,H>0?H-$/2:$/2],{value:String(h),...i,...g}),Y=new e.Group([...C,...j,M,...T?[T]:[]],{objectCaching:!1,...s});x.value.add(Y),Y.sendToBack(),r+=c}))}t(N),t(R,"right")}(),function(){const{show:t,startTime:n,range:r=[0,23],position:l="top",style:a}=X.time,{show:u,range:c=[0,23],position:d,style:f}=X.processTime;if(t||u){const p=[],h=[],g=[],v=[],m=I+W/2,y=$/2;for(let e=0;e<A.mainXCell;e++){if(t){const t=0===e?+n.slice(11,13):se(p.at(-1),r);p.push(t);const s="top"===l?H-y:O+y;g.push(o([m+e*W,s],{value:String(t),...i,...a||{}}))}if(u){const t=0===e?c[0]:h.at(-1)+1;h.push(t);const n="top"===d?y:Z-y;v.push(o([m+e*W,n],{value:String(t),...i,...f||{}}))}}const k=new e.Group([...g,...v],{objectCaching:!1,...s});x.value.add(k),x.value.sendToBack(k)}}(),function(){var e;const n=Object.values(U),o=[],i={},r=_.find((e=>"cervix"===e.key&&e.show)),l=null==(e=null==r?void 0:r.data)?void 0:e.find((e=>3==+e.value));function s(e,t){const{key:n,range:o}=r||{},i=G(n,o,10),l=[0,t],s=[-t/e,0],a=[(O-i-t)/e,O-i],u=[B-I,e*(B-I)+t];let c=[],d=[];function f([n,o]){return Math.abs(o-e*n-t)<=1}function p([e,t]){const[n,o]=[...h([e,t])];return n>=I&&n<=B&&o>=i&&o<=O}function h([e,t]){return[I+e,O-t]}return f(l)&&p(l)&&(c=h(l)),f(s)&&p(s)&&(c=h(s)),f(a)&&p(a)&&(d=h(a)),f(u)&&p(u)&&(d=h(u)),[...c,...d]}n.forEach((e=>{if(!e.show)return;const{key:n}=e;switch(n){case"fetalPresentation":{const{range:i,show:r}=_.find((e=>e.key===n));if(r){const r=G(n,i,0);o.push(t([I,r,B,r],{...e}))}break}case"alert":if(l){const{key:n,range:a}=r||{},u=216e5,c={time:w(new Date(m(l.time)+u),"yyyy-MM-dd HH:mm"),value:10},[d,f]=[S(l.time)-I,O-G(n,a,l.value)],[p,h]=[S(c.time)-I,O-G(n,a,c.value)],g=(h-f)/(p-d),v=f-d*g,y=s(g,v);y.length>0&&(o.push(t(y,{...e})),Object.assign(i,{k:g,b:v}))}break;case"handling":if(l){const{k:n,b:r}=i,a=144e5,u=s(n,r-(S(w(new Date(m(l.time)+a),"yyyy-MM-dd HH:mm"))-S(l.time))*n);u.length>0&&o.push(t(u,{...e}))}}})),x.value.add(...o)}(),te(),function(){function e(e,t){const n=_.findIndex((t=>t.key===e.key));return{renderItem:()=>e.title,origin:{title:e.title,unit:e.unit,dataIndex:n,key:e.key},pointer:t}}b.event.evented&&x.value.on("mouse:up",(t=>{if(3===t.button){const{x:n=0,y:o=0}=t.pointer||{};n>=I&&n<=B&&o>=H&&o<=O&&(P.point={x:n,y:o},P.show=!0,t.target?(P.target=t.target,P.list=["删除节点"],[...ee].forEach((e=>{e.origin&&e.left===t.target.left&&e.top===t.target.top&&P.list.push({renderItem:()=>e.origin.title,origin:{...e.origin},mode:"remove",pointer:t.pointer})}))):(P.target=null,P.list=["新增节点"],_.filter((e=>e.show)).forEach((i=>{if(!Y([...ee],n,"key").includes(i.key)){if(["cervix","fetalPresentation"].includes(i.key)&&o<Q)return;P.list.push(e(i,t.pointer))}})),1===P.list.length&&(P.show=!1,E("repeat"),console.log("当前时间段内无可新增节点"))))}}))}(),function(){const e=q-J/2;function t(e,t){if(!e.length)return;let o=H;const i=[];e.forEach((e=>{const n=e.title.split("").join("\n"),r=F.findIndex((t=>t.key===e.key)),{text:s,icon:a}=l(n,e,{text:{originY:"top",left:t,top:o},icon:{left:t,topY:o,originY:"top",origin:{type:e.type,dataIndex:r},...b.event}},"vertical");var u;o+=s.height+a.height+15,(u=a).on("moving",(()=>{u.set("originY","center"),L(u)?(ie(u),re(u)):C.show=!1})),u.on("mouseup:before",(e=>{if(C.show=!1,0===e.e.button&&L(u))if(Y([...ee],u.left,"key").includes(u.origin.key))E("repeat");else{const e={data:{time:M(u.left),value:T(u.origin.key,u.top)},...u.origin};j("add",e),ne(e)}!function(e){e.setCoords().set({originY:"top",left:e.originLeft,top:e.originTop})}(u)})),i.push(s,a)})),n(i),x.value.add(...i)}function n(e){const t=e.at(-1),n=(O-H)/2,o=(t.height+t.top-H)/2;e.forEach((e=>{const t=e.top+n-o;e.set({top:t,originTop:t})}))}t(N,D/2),t(R,e)}(),{clickMenu:function({item:e,target:t}){const n={...e.origin};"remove"===e.mode?(j("remove",n),ne(n,"remove")):(Object.assign(n,{data:{time:M(e.pointer.x),value:T(e.origin.key,e.pointer.y)}}),j("add",n),ne(n))},redrawPoints:oe}}export{x as useBirthProcess};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{ref as e,computed as a,reactive as t,onMounted as l,nextTick as r}from"vue";import{defaultBorderStyle as u}from"../useDraw.js";import"../../../../../shared/utils/fabricjs/index.js";import"date-fns";import{getTime as i}from"../../utils/index.js";import{
|
|
1
|
+
import{ref as e,computed as a,reactive as t,onMounted as l,nextTick as r}from"vue";import{defaultBorderStyle as u}from"../useDraw.js";import"../../../../../shared/utils/fabricjs/index.js";import"date-fns";import{getTime as i}from"../../utils/index.js";import{useCanvasEvent as s}from"../useEvent.js";import"../temperature/useShadow.js";import"lodash-es";import{useBirthProcess as d}from"./useBirthProcess.js";function n(n,o,v,c,h,m){const f=e(),g=e(),p=e(),x=a((()=>o.data.scaleValues.filter((e=>"left"===e.layout&&e.show)))),w=a((()=>o.data.scaleValues.filter((e=>"right"===e.layout&&e.show)))),y=a((()=>{var e;return(null==(e=w.value)?void 0:e.length)?30:0})),V=a((()=>{var e;return 30+(null==(e=x.value)?void 0:e.reduce(((e,a)=>e+=a.width),0))})),b=a((()=>{var e;const{width:a}=o.data,t=null==(e=w.value)?void 0:e.reduce(((e,a)=>e+=a.width),0);return a-y.value-t})),j=a((()=>o.data.grid.mainXCell)),A=a((()=>{const e=o.data.grid.mainYCell||14;return o.data.scaleValues.find((e=>e.show&&"FHR"===e.key))||14!==e?e:10})),C=a((()=>(b.value-V.value)/j.value)),k=a((()=>{const{xAxis:e,height:a}=o.data,t=Object.values(e).reduce(((e,a)=>(a.show&&e++,e)),0);return a/(A.value+t)})),Y=a((()=>{const{xAxis:e}=o.data,a=Object.values(e).reduce(((e,a)=>(a.show&&"top"===a.position&&e++,e)),0);return k.value*a})),S=a((()=>{var e;const{scaleValues:a}=o.data;if(!(null==(e=a.find((e=>"FHR"===e.key)))?void 0:e.show)&&!Y.value)return Y.value;const t=a.find((e=>"cervix"===e.key)),[,l]=(null==t?void 0:t.range)||[0,10],r=(null==t?void 0:t.spaceValue)||1;return H.value-l*r*k.value})),H=a((()=>{const{xAxis:e,height:a}=o.data,t=Object.values(e).reduce(((e,a)=>(a.show&&"bottom"===a.position&&e++,e)),0);return a-k.value*t})),P=a((()=>i(o.data.xAxis.time.startTime))),X=a((()=>36e5/C.value)),F=a((()=>{const{scaleValues:e}=o.data,a=e.find((e=>"cervix"===e.key));return k.value/((null==a?void 0:a.spaceValue)||1)})),R=a((()=>{const{scaleValues:e}=o.data,a=e.find((e=>"FHR"===e.key));return k.value/((null==a?void 0:a.spaceValue)||10)})),W=a((()=>{const{scaleValues:e}=o.data,a=e.find((e=>"fetalPresentation"===e.key));return k.value/((null==a?void 0:a.spaceValue)||1)})),O=a((()=>{var e;return(null==(e=o.data.grid)?void 0:e.event)||{selectable:!0,evented:!0,hovered:!0}})),M=t({canvasWidth:o.data.width,canvasHeight:o.data.height,borderStyle:{...u,...o.data.borderStyle||{}},selectionStyle:o.data.selectionStyle||{},grid:o.data.grid,other:o.data.other,originX:V.value,endX:b.value,originY:Y.value,endY:H.value,xCellWidth:C.value,yCellHeight:k.value,gridXNumber:j.value,gridYNumber:A.value,xAxis:o.data.xAxis,leftScales:x.value,rightScales:w.value,leftAddAreaWidth:30,rightAddAreaWidth:y.value,startTime:P.value,timeXCell:X.value,cervixYCell:F.value,FHRYCell:R.value,fetalPresentationYCell:W.value,scaleValues:o.data.scaleValues,event:O.value,originYCervix:S.value});return l((()=>{r((()=>{const{clickMenu:e,redrawPoints:a}=d(n,M,v,h,m);g.value=a,p.value=e;const{select:t}=s(n,M,v);f.value=t}))})),{propItems:M,redrawPoints:g,select:f,clickMenu:p}}export{n as useBirthProcessChart};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export{defaultBorderStyle,defaultLineStyle,defaultRectStyle,defaultStyle,defaultTextStyle,drawArrow,drawLine,drawPoint,drawText,drawTextAndIconGroup,drawTextGroup}from"./useDraw.js";export{useGrid}from"./useGrid.js";export{useBirthProcessCumputedPoint,useCumputedPoint}from"./useCumputedPoint.js";export{useCanvasEvent
|
|
1
|
+
export{defaultBorderStyle,defaultLineStyle,defaultRectStyle,defaultStyle,defaultTextStyle,drawArrow,drawLine,drawPoint,drawText,drawTextAndIconGroup,drawTextGroup}from"./useDraw.js";export{useGrid}from"./useGrid.js";export{useBirthProcessCumputedPoint,useCumputedPoint}from"./useCumputedPoint.js";export{useCanvasEvent}from"./useEvent.js";export{drawScaleLine,drawScaleNumber,getScaleInfo}from"./useScaleColumn.js";export{useCommon}from"./useCommon.js";export{useBirthProcessChart}from"./birthProcess/useBirthProcessChart.js";export{useTemperatureChart}from"./temperature/useTemperatureChart.js";export{useSurgicalAnesthesiaChart}from"./surgicalAnesthesia/useSurgicalAnesthesiaChart.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{drawLine as e,drawPoint as t}from"../useDraw.js";import{useGrid as n}from"../useGrid.js";import{useBirthProcessCumputedPoint as i}from"../useCumputedPoint.js";import"
|
|
1
|
+
import{drawLine as e,drawPoint as t}from"../useDraw.js";import{useGrid as n}from"../useGrid.js";import{useBirthProcessCumputedPoint as i}from"../useCumputedPoint.js";import"../../../../../shared/utils/fabricjs/index.js";import{useCommon as o}from"../useCommon.js";import"vue";import{getPointRange as l,getIndex as r,isEffectiveNode as a,getTime as s}from"../../utils/index.js";import{cloneDeep as f}from"lodash-es";import"date-fns";import"../temperature/useShadow.js";function u(u,p,c,d,m){const{cumputedX:v,cumputedY:g,getXValue:h,getYValue:y}=i(p),{xCellWidth:L,yCellHeight:x,originX:k,endX:b,originY:P,endY:A,event:w,scaleValues:j,xAxis:C,startTime:I,timeXCell:T,itemList:X}=p,E=new Map,M=new Set,Y=f(j);let _=[];n(u,p);const{getEqualXTypes:O,handleAddPrevent:V}=o(u,c,p);function $(){Y.forEach((e=>{e.dataList.forEach(((t,n)=>{S(t,n,e)}))})),function(){if(!w.evented)return;function e(e,t,n){Object.assign(m,{point:e,show:!0,target:t,list:n})}u.value.on("mouse:up",(t=>{if(3===t.button){const{x:n=0,y:i=0}=t.pointer||{};if(n>=k&&n<=b&&i>=P&&i<=A)if(t.target){if("main"!==t.target.__type)return;e(t.pointer,t.target,["删除节点"]);const{minLeft:n,maxLeft:i,minTop:o,maxTop:r}=l(t.target);H().forEach((e=>{"main"===e.__type&&e.left>n&&e.left<i&&e.top>o&&e.top<r&&m.list.push({renderItem:()=>e.origin.title,origin:{...e.origin},mode:"remove",pointer:t.pointer})})),1===m.list.length&&(m.show=!1,console.log("当前时间段内无可删除节点"))}else e(t.pointer,null,["新增节点"]),X.forEach((e=>{O(H(),n,"key").includes(e.key)||m.list.push({renderItem:()=>e.title,origin:{title:e.title,unit:e.unit,type:e.bigType,dataIndex:e.dataIndex,key:e.key},pointer:t.pointer})})),1===m.list.length&&(m.show=!1,V("repeat"),console.log("当前时间段内无可新增节点"))}}))}()}function S(n,i,o){var l;const{type:r,unit:a,dataList:s=[]}=o,f=[];E.set(n.key,[]),null==(l=n.list)||l.forEach(((l,s)=>{!function(n,l,s,m){var v;let g,x;const{pointAttr:j={},lineAttr:C={},title:I="",key:X,type:Y="circle"}=m,O=G(m.list[s+1],o);n&&O&&!l.breakpoint&&n[0]!==O[0]&&(x=e([...n,...O],C));const V=f[s-1],$={origin:{data:l,title:I,key:X||"",unit:a,type:r,dataIndex:i,index:s,lineAttr:C},__type:"main",leftLine:V,rightLine:x,...j,...p.event.hovered?p.event.evented?{selectable:!0}:{selectable:!0,lockMovementX:!0,lockMovementY:!0}:p.event};V?g=t(Y,{left:V.get("x2"),top:V.get("y2"),...$}):n&&($.leftLine=null,g=t(Y,{left:n[0],top:n[1],...$}));f.push(x),g&&(g.originLeft=g.left,g.originTop=g.top,function(e){w.hovered&&(e.on("mouseover",(()=>{q(e,"hover")})),e.on("mouseout",(()=>{d.show=!1})));if(e.lockMovementX&&e.lockMovementY)return;e.on("moving",(()=>{!function(e){e.setCoords();const t=6e4/T,n=e.prevPoint?e.prevPoint.left+t:k,i=e.nextPoint?e.nextPoint.left-t:b;e.top<P&&e.set("top",P),e.top>A&&e.set("top",A),e.left<n&&e.set("left",n),e.left>i&&e.set("left",i)}(e),function(e){var t,n;null==(t=e.leftLine)||t.setCoords().set({x2:e.left,y2:e.top}),null==(n=e.rightLine)||n.setCoords().set({x1:e.left,y1:e.top})}(e),w.hovered&&q(e),function(e){const{originLeft:t,originTop:n,left:i,top:o,origin:l}=e,r=~~((i-t)/L);if(i>t+L&&!e.nextPoint){if(0===_.length){z(e,[...e.leftLine?[e.leftLine.x1,e.leftLine.y1]:[t,n],t,n]),e.leftLine&&e.leftLine.set({stroke:"transparent"})}const i=t+L*r;if(_.every((e=>e.left!==i))){const t=h(i),n=y(l.type,o);_.push({data:{time:t,value:n},left:i,top:o}),z(e,[...e.prevPointer,i,o])}_.length<r&&function(e,t){const{originLeft:n,originTop:i,origin:o}=e;let l=1;for(;l<=t;){const t=n+L*l,r=_.some((e=>Math.abs(e.left-t)<=1));if(!r){let l=0;const r=_.find(((e,n)=>(e.left>t&&(l=n),e.left>t)));if(r){const a=JSON.parse(JSON.stringify(r)),s=_[l-1]||{left:n,top:i},f=~~((r.left-(t-L))/L),u=(r.top-s.top)/f;a.top=s.top+u,a.left=t,a.data={time:h(t),value:y(o.type,a.top)},_.splice(l,0,a),z(e,[s.left,s.top,a.left,a.top])}}l++}}(e,r)}if(_.length>0&&i<_[_.length-1].left){for(const e of M)e.left>i&&(e.leftLine&&u.value.remove(e.leftLine),u.value.remove(e));if(_=_.filter((e=>e.left<=i)),0===_.length){e.leftLine&&e.leftLine.set(e.origin.lineAttr);for(const e of M)e.leftLine&&u.value.remove(e.leftLine),u.value.remove(e)}if(_.length>0){const t=_.at(-1);e.prevPointer=[t.left,t.top]}}}(e)})),e.on("mouseup",(t=>{if(d.show=!1,1===t.button){const{key:t,type:n}=e.origin,i={...e.origin,data:{...e.origin.data,time:h(e.left),value:y(n,e.top)}};if(u.value.discardActiveObject(),_.length>0){const e=_.map((e=>e.data));c("add",{...i,data:e}),D({...i,data:e})}else c("change",i),D(i,"change")}}))}(g),null==(v=E.get(X))||v.push(g))}(G(l,o),l,s,n)})),Promise.all(E.get(n.key)).then((e=>{const t=f.filter((e=>e));let n=null;e=e.map((e=>(e&&n&&(n.nextPoint=e,e.prevPoint=n),n=e||n,e))),u.value.add(...t,...e)}))}function z(t,n){const[i,o,l,r]=n;t.clone((i=>{i.set({left:l,top:r}),t.prevPointer=[l,r];const o=e(n,t.origin.lineAttr);i.leftLine=o,M.add(i),u.value.add(o,i)}))}function D(e,t="add"){const{dataIndex:n,data:i,index:o,key:l,type:a}=e,s=Y.find((e=>e.type===a)),f=s.dataList.find((e=>e.key===l));switch(t){case"remove":f.list.splice(o,1);break;case"change":f.list[o]=i;break;default:{const e=Array.isArray(i)?i[0].time:i.time,t=r(e,f.list),n=Array.isArray(i)?i:[i];f.list.splice(t,0,...n);break}}J({dataIndex:n,scaleValue:s})}function J(e){var t,n,i;if(M.size&&(null==(t=u.value)||t.remove(...N([...M]))),M.clear(),_=[],e){const{dataIndex:t,scaleValue:i}=e,o=i.dataList[t];null==(n=u.value)||n.remove(...N(E.get(o.key))),E.delete(o.key),S(o,t,i)}else E.size&&(null==(i=u.value)||i.remove(...N(H()))),E.clear(),$()}function N(e){const t=[];return e.forEach((e=>{e&&t.push(e),(null==e?void 0:e.leftLine)&&t.push(null==e?void 0:e.leftLine),(null==e?void 0:e.rightLine)&&t.push(null==e?void 0:e.rightLine)})),t}function q(e,t="moving"){const{title:n,type:i,data:o,unit:l}=e.origin;d.point={x:e.left,y:e.top};const r=`${"hover"===t?o.value:y(i,e.top)}`;d.list=[`${n} ${r}${l||""}`,`时间 ${h(e.left).slice(-5)}`],d.show=!0}function G(e,t){if(a(e)&&function(e){const t=Date.parse(C.list.at(-1)),n=s(e);return n>=I&&n<=t}(e.time)){const n=v(e.time),i=g(t.type,t.range,e.value);return[n,i<P?P:i>A?A:i]}}function H(){return Array.from(E.values()).flat()}return $(),{redrawPoints:J,clickMenu:function({item:e,target:t}){const n={...e.origin};"remove"===e.mode?(c("remove",n),D(n,"remove")):(Object.assign(n,{data:{time:h(e.pointer.x),value:y(e.origin.type,e.pointer.y)}}),c("add",n),D(n))}}}export{u as useCenter};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{fabric as t}from"../../../../../shared/utils/fabricjs/index.js";import{drawTextGroup as e,defaultRectStyle as i,drawTextAndIconGroup as o,drawText as l,defaultTextStyle as n,defaultStyle as r}from"../useDraw.js";import"date-fns";import{getScaleNumberList as a}from"../../utils/index.js";import
|
|
1
|
+
import{fabric as t}from"../../../../../shared/utils/fabricjs/index.js";import{drawTextGroup as e,defaultRectStyle as i,drawTextAndIconGroup as o,drawText as l,defaultTextStyle as n,defaultStyle as r}from"../useDraw.js";import"date-fns";import{getScaleNumberList as a}from"../../utils/index.js";import{drawScaleNumber as s}from"../useScaleColumn.js";import"vue";import"lodash-es";import"../temperature/useShadow.js";function d(d,h,u){const{originY:c,endY:p,borderStyle:f,left:m,itemList:g,scaleValues:v,originX:w,endX:j,yCellHeight:y,markHeight:S,canvasWidth:W,canvasHeight:b}=h;!function(){if(!m)return;const{title:t,titleWidth:i,titleStyle:o}=m,l=e({width:i,height:p-c+S,...f},{value:t.split("").join("\n"),...o||{}},{left:0,top:c},!0);d.value.add(l)}(),v.forEach(((e,i)=>{var o,h;const u="left"===e.layout?w-5:j+5,{range:c,spaceValue:f,title:g,unit:v,titleStyle:S,spaceGridNumber:b=1,showNumber:x,showMaxMinNumber:N}=e,k=[],X=a(c,f),Y=X.length;X.forEach(((t,i)=>{const o=0===i?p-5:p-i*y*b;!x||(0===i||i===Y-1)&&!N||k.push(s(String(t),{...e,position:e.layout},u,o))}));const C=g&&l(["left"===e.layout?m.width/2:j+(W-j)/2,(null!=(h=null==(o=k.at(-1))?void 0:o.top)?h:330)-y],{value:`${g}${v?"\n"+v:""}`,...n,...S}),E=new t.Group([...k,...C?[C]:[]],{objectCaching:!1,...r});d.value.add(E),E.sendToBack()})),function(){const e=new t.Rect({width:w-m.titleWidth,height:p-c+S,left:m.titleWidth,top:c,...i,originX:"left",originY:"top",...f});d.value.add(e);const l=JSON.parse(JSON.stringify(g));let n=p;const r=m.titleWidth+15;l.reverse().forEach((t=>{n-=10;const e=t.title,{text:i,icon:l}=o(e,t,{text:{left:r,top:n},icon:{leftX:r,topY:n}});n-=i.height||30,d.value.add(i,l)}))}(),d.value.add(new t.Rect({left:0,top:0,width:W-f.strokeWidth,height:b-f.strokeWidth,fill:"transparent",...f}))}export{d as useLeft};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{fabric as t}from"../../../../../shared/utils/fabricjs/index.js";import{drawPoint as e,drawText as o}from"../useDraw.js";import{useBirthProcessCumputedPoint as i}from"../useCumputedPoint.js";import"
|
|
1
|
+
import{fabric as t}from"../../../../../shared/utils/fabricjs/index.js";import{drawPoint as e,drawText as o}from"../useDraw.js";import{useBirthProcessCumputedPoint as i}from"../useCumputedPoint.js";import"vue";import"lodash-es";import"date-fns";import"../temperature/useShadow.js";import{OTHER_MENU as n}from"../../constants/index.js";function r(r,l,a,s,u){const{cumputedX:c,getXValue:f}=i(l),{other:d,yCellHeight:m,endX:h,originX:p,originY:v,endY:g,markHeight:x,event:y,topGridYCellHeight:X}=l;function k(t){y.hovered&&(t.on("mouseover",(()=>{_(t)})),t.on("mouseout",(()=>{s.show=!1}))),y.evented&&t.on("mouseup",(e=>{s.show=!1,3===e.button&&(u.point={x:t.left,y:t.top},u.show=!0,u.target=t,u.list=n.map((t=>({...t,renderItem:()=>t.label}))))}))}function _(t){s.point={x:t.left,y:"mark"===t.__type?t.top:t.top+X/2},s.list=[`时间 ${f(t.left).slice(-5)}`],"mark"===t.__type&&s.list.unshift(t.origin.name+" "),s.show=!0}function S(t){return t>=p&&t<=h}return function(){if(!(null==d?void 0:d.horizontal))return;const{horizontal:i}=d,n=p-5;let l=v+m/2;i.forEach(((i,a)=>{const{title:s,titleStyle:u={},type:f,pointAttr:d={},textStyle:h={},data:p}=i,v=s&&e(s,{...u,originX:"right",left:n,top:l});r.value.add(v),p.forEach(((i,n)=>{const{time:u,value:m}=i,p=c(u);if(!S(p))return;const v=e(f,{...d,left:p,top:l}),g=p+v.width/2+2,x=o([g,l],{value:m,...h,originX:"left"}),y=new t.Group([v,x],{lockMovementX:!0,lockMovementY:!0,objectCaching:!1,hasControls:!1,hasBorders:!1,hoverCursor:"pointer"});y.__type="other",y.origin={__type:"other",key:"horizontal",dataIndex:a,index:n,data:i,title:s},k(y),r.value.add(y)})),l+=m}))}(),function(){if(!(null==d?void 0:d.vertical))return;const{vertical:t}=d;t.forEach(((t,o)=>{const{textStyle:i={},data:n,time:l}=t,a=c(l);if(!S(a))return;let s=v+m/2;n.forEach(((t,n)=>{const u=e(String(t),{...i,lockMovementX:!0,lockMovementY:!0,left:a,originX:"left",top:s,__type:"other",origin:{key:"vertical",dataIndex:o,index:n,data:{time:l,value:t}}});s+=m,k(u),r.value.add(u)}))}))}(),function(){if(!(null==d?void 0:d.mark)||!x)return;const{title:t,titleStyle:i,pointAttr:n,dataList:l}=d.mark,u=o([p-5,g+x/2],{value:t,...i,originX:"right"});r.value.add(u);const m=g+x,X=[];l.forEach((t=>{const{time:o,list:i=[]}=t,l=c(o);if(!S(l))return;let u=g;i.forEach((t=>{let o=!1;const i=e("circleAndText",{...n,text:t.text,left:l,top:u,origin:t,__type:"mark"}),c=i.height;u+c<=m&&u>=g?(i.set("top",u+c/2),u+=c):(o||(u=g,o=!0),i.set("top",u-c/2),u-=c),X.push(i),function(t){y.hovered&&(t.on("mouseover",(()=>{_(t)})),t.on("mouseout",(()=>{s.show=!1})));if(t.lockMovementX&&t.lockMovementY)return;t.on("moving",(()=>{!function(t){t.setCoords(),t.left<t.limitX.x1&&t.set("left",t.limitX.x1);t.left>t.limitX.x2&&t.set("left",t.limitX.x2);t.top<v&&t.set("top",v);const e=g+x-t.height/2;t.top>e&&t.set("top",e)}(t),y.hovered&&_(t)})),t.on("mouseup",(e=>{if(s.show=!1,1===e.button){!function(t){var e;if((null==(e=t.origin)?void 0:e.isStart)&&t.otherPoints)t.otherPoints.forEach((e=>{e.limitX.x1=t.left}));else{const e=t.startPoint.otherPoints.map((t=>t.left));console.log(e);const o=Math.min(...e);console.log(o,t.startPoint),t.startPoint.limitX.x2=o}}(t);const e={type:"mark",time:f(t.left),data:t.origin};r.value.discardActiveObject(),a("change",e)}}))}(i),r.value.add(i)}))})),function(t){const e=t.find((t=>{var e;return null==(e=t.origin)?void 0:e.isStart})),o=t.find((t=>{var o;return!(null==(o=t.origin)?void 0:o.isStart)&&t.left>e.left})),i=t.filter((t=>{var e;return!(null==(e=t.origin)?void 0:e.isStart)}));t.forEach((t=>{var n;const r={x1:p,x2:h};(null==(n=t.origin)?void 0:n.isStart)?(r.x2=o.left,t.otherPoints=i):(r.x1=e.left,t.startPoint=e),t.limitX=r}))}(X)}(),{clickMenu:function({item:t,target:e}){if(!e)return;const{type:o}=t;a(o,{...e.origin,type:"other"})}}}export{r as useOther};
|
package/es/components/fabric-chart/src/hooks/surgicalAnesthesia/useSurgicalAnesthesiaChart.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{ref as e,computed as t,reactive as a,unref as r,onMounted as i,nextTick as l}from"vue";import{defaultBorderStyle as n}from"../useDraw.js";import"../../../../../shared/utils/fabricjs/index.js";import{format as u}from"date-fns";import{getChildrenSize as s}from"../../utils/index.js";import{
|
|
1
|
+
import{ref as e,computed as t,reactive as a,unref as r,onMounted as i,nextTick as l}from"vue";import{defaultBorderStyle as n}from"../useDraw.js";import"../../../../../shared/utils/fabricjs/index.js";import{format as u}from"date-fns";import{getChildrenSize as s}from"../../utils/index.js";import{cloneDeep as o,range as d}from"lodash-es";import"../temperature/useShadow.js";import{OTHER_MENU as c}from"../../constants/index.js";import{useTop as p}from"./useTop.js";import{useLeft as m}from"./useLeft.js";import{useCenter as h}from"./useCenter.js";import{useOther as v}from"./useOther.js";function f(f,g,y,x,w,b){const j=e(),Y=e(),C=e(),H=t((()=>g.data.layout||{top:"drug",center:"xAxis",bottom:"intraoperatively"})),A=t((()=>{var e;return null!=(e=g.data.left.width)?e:0})),D=t((()=>{const{grid:e}=g.data;return e.mainXCell*e.subXCell})),M=t((()=>{const{grid:e}=g.data;return e.mainYCell*e.subYCell})),T=t((()=>s(g.data.top.treeData))),X=t((()=>g.data.top.tree.cellHeight)),V=t((()=>X.value*T.value)),k=t((()=>$(U("drug")||"top"))),G=t((()=>k.value+V.value)),S=t((()=>{var e;return Date.parse((null==(e=g.data.xAxis)?void 0:e.startTime)||u(new Date,"yyyy-MM-dd HH:mm:ss"))})),N=t((()=>{const e=o(g.data.xAxis),{spaceValue:t,spaceTimeStamp:a}=e,r=d(D.value/t+1).map((r=>0===r?e.startTime:u(new Date(S.value+r*t*a),"yyyy-MM-dd HH:mm:ss")));return{...e,list:r,left:A.value}})),O=function(){const e=o(g.data.top.treeData);let t=0;const{cellWidth:a,cellHeight:r}=g.data.top.tree;return function e(i,l=0){i.forEach((i=>{var n;const u={top:t*r+k.value,left:l*a,width:a,height:r};if(t++,null==(n=i.children)?void 0:n.length){t--;const a=s(i.children);u.height=a*r,e(i.children,l+1)}else u.width=A.value-u.left;Object.assign(i,u)}))}(e),e}(),L=t((()=>$(U("xAxis")||"center"))),W=t((()=>{var e;const{width:t,right:a}=g.data;if(!a)return t;return t-(null!=(e=a.width)?e:0)})),E=t((()=>$(U("intraoperatively")||"bottom"))),I=t((()=>{var e;const{show:t=!0,height:a}=(null==(e=g.data.other)?void 0:e.mark)||{};return t&&a?a:0})),P=t((()=>E.value+(g.data.height-V.value-N.value.height-I.value))),q=t((()=>(W.value-A.value)/D.value)),z=t((()=>(P.value-E.value)/M.value)),B=t((()=>N.value.spaceTimeStamp/q.value)),F=t((()=>{const{scaleValues:e}=g.data;return e.map((e=>e.dataList.filter((e=>e.show)).map(((t,a)=>({...t,bigType:e.type,unit:e.unit,dataIndex:a}))))).flat()})),J=t((()=>_("pulse"))),K=t((()=>_("temperature"))),Q=t((()=>{var e;return(null==(e=g.data.grid)?void 0:e.event)||{selectable:!0,evented:!0,hovered:!0}})),R=a({canvasWidth:g.data.width,canvasHeight:g.data.height,borderStyle:{...n,...g.data.borderStyle||{}},grid:g.data.grid,top:g.data.top,left:g.data.left,other:g.data.other,topGridYNumber:r(T),topGridYCellHeight:r(X),topGridOriginY:r(k),topGridEndY:r(G),treeData:O,xAxis:r(N),originYXAxis:r(L),startTime:r(S),timeXCell:r(B),gridXNumber:r(D),gridYNumber:r(M),xCellWidth:r(q),yCellHeight:r(z),originX:r(A),endX:r(W),originY:r(E),endY:r(P),markHeight:r(I),itemList:r(F),scaleValues:g.data.scaleValues,pulseYCell:r(J),temperatureYCell:r(K),event:r(Q)});function U(e){let t="";return Object.entries(H.value).some((([a,r])=>{if(r===e)return t=a,!0})),t}function Z(e){const t=H.value[e],a=N.value.height;switch(t){case"drug":return V.value;case"xAxis":return a;default:return g.data.height-V.value-a}}function $(e){switch(e){case"top":return 0;case"center":return Z("top");default:return Z("top")+Z("center")}}function _(e){const{scaleValues:t}=g.data,a=t.find((t=>t.type===e));return z.value*(a.spaceGridNumber||1)/(a.spaceValue||1)}return i((async()=>{await l(),p(f,R,y,w),m(f,R);const{clickMenu:e}=v(f,R,y,w,b),{redrawPoints:t,clickMenu:a}=h(f,R,y,w,b);Y.value=t,C.value=t=>{const{item:r}=t;r.type&&c.map((e=>e.type)).includes(r.type)?e(t):a(t)}})),{propItems:R,redrawPoints:Y,select:j,clickMenu:C}}export{f as useSurgicalAnesthesiaChart};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{fabric as t}from"../../../../../shared/utils/fabricjs/index.js";import{drawText as e,defaultStyle as i,defaultRectStyle as n,drawTextGroup as o,drawLine as l,drawPoint as r}from"../useDraw.js";import{useGrid as s}from"../useGrid.js";import{useBirthProcessCumputedPoint as f}from"../useCumputedPoint.js";import"
|
|
1
|
+
import{fabric as t}from"../../../../../shared/utils/fabricjs/index.js";import{drawText as e,defaultStyle as i,defaultRectStyle as n,drawTextGroup as o,drawLine as l,drawPoint as r}from"../useDraw.js";import{useGrid as s}from"../useGrid.js";import{useBirthProcessCumputedPoint as f}from"../useCumputedPoint.js";import"vue";import{cloneDeep as c}from"lodash-es";import"date-fns";import"../temperature/useShadow.js";function a(a,d,u,m,h){const{cumputedX:p,getXValue:x}=f(d),{originX:L,endX:g,xCellWidth:v,originYXAxis:X,top:C,topList:w,canvasWidth:y,borderStyle:Y,treeData:S,xAxis:j,topGridYNumber:b,topGridOriginY:k,topGridYCellHeight:G,topGridEndY:I,event:z}=d,A=new Set;function M(t,e,i){let n;const{content:o}=t.value||{};if(o){const{lineStyle:l,textStyle:s,totalStyle:f}=C.data||{},{startLine:c,centerLine:a,endLine:d}=e;n=r(o,{fontSize:12,...s,backgroundColor:"#fff",lockMovementX:!0,lockMovementY:!0});const u=$(n,e,i);n&&(n.set(u),n.origin={data:t},D(n),c&&(c.text=n),d&&(d.text=n))}return n}function $(t,e,i){const n=t.width+1,{startLine:o,centerLine:l,endLine:r}=e,s={top:i,originX:"center",originY:"center"};return l&&n<=l.width?s.left=l.x1+l.width/2:r&&n<=r.limitX.x2-r.left?(s.originX="left",s.left=r.left+1):o&&!r&&n<=o.limitX.x2-o.left?(s.originX="left",s.left=o.left+(o.isCustomIcon?5:1)):o&&n<=o.left-o.limitX.x1?(s.originX="right",s.left=o.left-(o.isCustomIcon?5:1)):l?(s.originY="top",s.left=l.x1+l.width/2,s.top=i+1,s.fontSize=10):o&&(s.originX="left",s.originY="top",s.fontSize=10,s.left=o.left,s.top=i+1),s}function E(e,{isCustomIcon:i,isContinue:n,isLeft:o}){const{x:s,y1:f,y2:c,halfY:a}=e;if(!s||s<L||s>g)return;const{lineStyle:d}=C.data||{};let u;const m={left:s,top:a};u=i?r("circle",{fill:d.stroke,...m}):n?r(">",{fill:d.stroke,...m,fontSize:18}):l([s,f,s,a],d);const h=new t.Rect({width:v,height:G,fill:"transparent",left:s-v/2,top:f}),p=new t.Group([u,h],{originX:"center",originY:"center",hasControls:!1,hasBorders:!1,objectCaching:!1,hoverCursor:"pointer",lockMovementY:!0});return p.isLeft=o,p.isCustomIcon=i,D(p),p}function D(t){z.hovered&&(t.on("mouseover",(()=>{H(t,"hover")})),t.on("mouseout",(()=>{m.show=!1}))),t.lockMovementX&&t.lockMovementY||(t.on("moving",(()=>{!function(t){t.setCoords(),t.left<t.limitX.x1&&t.set("left",t.limitX.x1);t.left>t.limitX.x2&&t.set("left",t.limitX.x2)}(t),function(t){if(t.centerLine){const e=t.isLeft?{x1:t.left}:{x2:t.left};t.centerLine.setCoords().set(e)}if(t.text){const e=$(t.text,{startLine:t.isLeft?t:t.nearLine,centerLine:t.centerLine,endLine:t.isLeft?t.nearLine:t},t.top);t.text.setCoords().set(e)}}(t),z.hovered&&H(t)})),t.on("mouseup",(e=>{if(1===e.button){!function(t){t.isLeft?(t.prevLine&&(t.prevLine.limitX.x2=t.left),t.nearLine&&(t.nearLine.limitX.x1=t.left)):(t.nextLine&&(t.nextLine.limitX.x1=t.left),t.nearLine&&(t.nearLine.limitX.x2=t.left))}(t);const e={type:"tree",...t.origin};u("change",e)}})))}function H(t,e="moving"){var i,n,o;const{data:l}=t.origin;m.point={x:t.left,y:t.top};let[r="",s=""]=l.time||[];if("moving"===e){const e=x(t.left);t.isLeft?r=e:s=e,l.time=[r,s],t.text&&(t.text.origin.data.time=[r,s])}m.list=[`开始时间 ${r}`,`结束时间 ${s}`,`流速 ${(null==(i=l.value)?void 0:i.currentSpeed)||""}`,`浓度 ${(null==(n=l.value)?void 0:n.consistence)||""}`,`总量 ${(null==(o=l.value)?void 0:o.total)||""}`],m.show=!0}s(a,{...d,gridYNumber:b,originY:k,yCellHeight:G,endY:I}),function(){const{height:o,list:l,left:r,spaceValue:s}=j;if(!o)return;const f=[],c=X+o/2;l.forEach(((t,i)=>{const n=r+i*v*s;f.push(e([n,c],{value:t.slice(11,16)}))}));const d=f.length>0?new t.Group([...f],{...i,objectCaching:!1}):null;d&&a.value.add(d);const u=new t.Rect({width:y,height:o,left:0,top:X,...n,originX:"left",originY:"top",...Y});a.value.add(u)}(),function(){var e;const n=(null==(e=null==C?void 0:C.tree)?void 0:e.textStyle)||{},r=[];!function t(e){e.forEach((e=>{var i;const{width:s,height:f,left:a,top:d,title:u=""}=e,m={value:u,...n};(null==(i=e.children)?void 0:i.length)?(m.value=u.split("").join("\n"),t(e.children)):(m.textAlign="left",function(t){if(!(null==t?void 0:t.data)||!Array.isArray(t.data))return;const{lineStyle:e,textStyle:i,totalStyle:n}=C.data||{},o=t.top,r=o+G,s=r-G/2,f={y1:o,y2:r,halfY:s},a=[],d=c(t);delete d.data,t.data.forEach(((t,i,n)=>{const{time:o,continue:r}=t,[c,u]=o,m=c&&p(c),h=u&&p(u),x=E({...f,x:m},{isCustomIcon:!h&&!r,isContinue:!1,isLeft:!0}),v=E({...f,x:h},{isCustomIcon:!1,isContinue:!!r});let X,C,w;if((x||m<L)&&(v||h>g)){X=l([x?m:L,s,v?h:g,s],e)}a.push({startLine:x,centerLine:X,endLine:v}),function(t,e,i){const{startLine:n,centerLine:o,endLine:l}=e[t],{startLine:r,endLine:s}=e[t-1]||{};if(n){n.origin=i;const t={x1:L,x2:l?l.left:g};s?(t.x1=s.left,s.limitX.x2=n.left,n.prevLine=s,s.nextLine=n):r&&(t.x1=r.left,r.limitX.x2=n.left,n.prevLine=r,r.nextLine=n),n.limitX=t,o&&(n.centerLine=o)}if(l){l.origin=i;const t={x1:n?n.left:L,x2:g};l.limitX=t,o&&(l.centerLine=o)}n&&l&&(n.nearLine=l,l.nearLine=n)}(i,a,Object.assign({},d,{data:t,index:i})),n[i-1]&&(C=M(n[i-1],a[i-1],s)),i===n.length-1&&(w=M(t,a[i],s)),X&&A.add(X),x&&A.add(x),v&&A.add(v),C&&A.add(C),w&&A.add(w)}))}(e)),r.push(o({width:s,height:f,...Y},m,{left:a,top:d},!0))}))}(S);const s=r.length>0?new t.Group([...r],{...i,objectCaching:!1}):null;s&&a.value.add(s),A.size&&a.value.add(...A)}()}export{a as useTop};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{fabric as t}from"../../../../../shared/utils/fabricjs/index.js";import{drawTextGroup as e,defaultTextStyle as i,defaultStyle as n}from"../useDraw.js";import"date-fns";import"lodash-es";import"
|
|
1
|
+
import{fabric as t}from"../../../../../shared/utils/fabricjs/index.js";import{drawTextGroup as e,defaultTextStyle as i,defaultStyle as n}from"../useDraw.js";import"date-fns";import"lodash-es";import"vue";import"./useShadow.js";function o(o,s){const{xScaleList:a,originX:l,endX:r,endY:h,xCellWidth:c,canvasWidth:d,canvasHeight:u,bottom:g,breathingHeight:p,iconsWidth:f,borderStyle:m}=s;!function(){var s,d,u;if(!p||!g){const e=new t.Line([f,h-1,r,h-1],m);return o.value.add(e),e.sendToBack(),!1}const v=p,b=(null==(s=g.breathing)?void 0:s.list)||[],w=[];let x=!0;a.forEach(((t,n)=>{const o=l+n*c;let s="";b.forEach(((e,i)=>{const n=new Date(e.time).getTime();n>=t&&n<+t+t.scaleCell&&(s=e.value)}));const a=x?{top:-(v/2-10)}:{top:v/2-10};s&&(x=!x);const r=e({width:c,height:v,...m},Object.assign({},{text:String(s),...i},s?a:{}),{left:o,top:h});w.push(r)}));const j=e({width:r,height:v,...m},{text:String((null==(d=g.breathing)?void 0:d.title)+(null==(u=g.breathing)?void 0:u.unit)),...i,left:-(r-l)/2},{left:0,top:h});w.push(j);const S=w.length>0?new t.Group([...w],{...n}):null;S&&S.sendToBack(),S&&o.value.add(S)}()}export{o as useBottom};
|