cnhis-design-vue 3.1.41-release.4 → 3.1.41-release.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (198) hide show
  1. package/README.md +87 -87
  2. package/es/components/bpmn-workflow/src/BpmnWorkflow.d.ts +0 -0
  3. package/es/components/bpmn-workflow/types/BpmnViewer.d.ts +1 -0
  4. package/es/components/bpmn-workflow/types/ModelingModule.d.ts +1 -0
  5. package/es/components/bpmn-workflow/types/MoveCanvasModule.d.ts +1 -0
  6. package/es/components/button-print/src/utils/print.js +1 -1
  7. package/es/components/fabric-chart/src/hooks/useBirthProcess.js +1 -1
  8. package/es/components/fabric-chart/src/hooks/useDraw.d.ts +1 -0
  9. package/es/components/fabric-chart/src/hooks/useDraw.js +1 -1
  10. package/es/components/fabric-chart/src/hooks/useLeft.js +1 -1
  11. package/es/components/fabric-chart/src/hooks/useOther.js +1 -1
  12. package/es/components/fabric-chart/src/hooks/useTop.js +1 -1
  13. package/es/components/fabric-chart/src/utils/index.d.ts +6823 -0
  14. package/es/components/field-set/index.d.ts +8 -0
  15. package/es/components/field-set/src/FieldSet.vue.d.ts +5 -0
  16. package/es/components/field-set/src/FieldSet.vue.js +1 -1
  17. package/es/components/field-set/style/index.css +1 -1
  18. package/es/components/form-config/index.d.ts +6761 -45
  19. package/es/components/form-config/src/FormConfig.vue.d.ts +6902 -185
  20. package/es/components/form-config/src/FormConfig.vue.js +1 -1
  21. package/es/components/form-config/src/components/FormConfigCreator.vue.d.ts +2 -2
  22. package/es/components/form-config/src/components/FormConfigCreator.vue.js +1 -1
  23. package/es/components/form-config/src/components/FormConfigDragDisplay.vue.d.ts +4 -4
  24. package/es/components/form-config/src/components/FormConfigDragDisplay.vue.js +1 -1
  25. package/es/components/form-config/src/components/FormConfigEdit.vue.d.ts +3414 -59
  26. package/es/components/form-config/src/components/FormConfigEdit.vue.js +1 -1
  27. package/es/components/form-config/src/components/FormConfigMaterialItem.d.ts +2 -2
  28. package/es/components/form-config/src/components/FormConfigMaterialItem.js +1 -1
  29. package/es/components/form-config/src/components/renderer/CloseButton.vue.d.ts +3 -3
  30. package/es/components/form-config/src/components/renderer/CloseButton.vue.js +1 -1
  31. package/es/components/form-config/src/components/renderer/ComplexNode.vue.d.ts +10 -10
  32. package/es/components/form-config/src/components/renderer/ComplexNode.vue.js +1 -1
  33. package/es/components/form-config/src/components/renderer/DefaultNode.vue.d.ts +6 -6
  34. package/es/components/form-config/src/components/renderer/DefaultNode.vue.js +1 -1
  35. package/es/components/form-config/src/hooks/useConfigurationField.d.ts +2 -3
  36. package/es/components/form-config/src/hooks/useConfigurationField.js +1 -1
  37. package/es/components/form-config/src/hooks/useDataNormalize.d.ts +4 -2
  38. package/es/components/form-config/src/hooks/useDataNormalize.js +1 -1
  39. package/es/components/form-config/src/hooks/usePresetRenderer.d.ts +1 -1
  40. package/es/components/form-config/src/hooks/useSortalbeConfig.js +1 -1
  41. package/es/components/form-config/src/types/index.d.ts +9 -2
  42. package/es/components/form-config/src/utils/index.d.ts +4 -1
  43. package/es/components/form-config/src/utils/index.js +1 -1
  44. package/es/components/form-config/style/index.css +1 -1
  45. package/es/components/form-render/index.d.ts +2 -2
  46. package/es/components/form-render/index.js +1 -1
  47. package/es/components/form-render/src/FormRender.vue.d.ts +1 -1
  48. package/es/components/form-render/src/FormRender.vue.js +1 -1
  49. package/es/components/form-render/src/FormRenderWrapper.vue.d.ts +22 -21
  50. package/es/components/form-render/src/FormRenderWrapper.vue.js +1 -1
  51. package/es/components/form-render/src/components/renderer/formItem.js +1 -1
  52. package/es/components/form-render/src/components/renderer/radio_checkbox.js +1 -1
  53. package/es/components/form-render/src/constants/index.d.ts +0 -12
  54. package/es/components/form-render/src/constants/index.js +1 -1
  55. package/es/components/form-render/src/hooks/useComplexOptions.d.ts +2 -6
  56. package/es/components/form-render/src/hooks/useComplexOptions.js +1 -1
  57. package/es/components/form-render/src/hooks/useFieldListAdaptor.js +1 -1
  58. package/es/components/form-render/src/hooks/useFormEvent.d.ts +1 -1
  59. package/es/components/form-render/src/hooks/useFormEvent.js +1 -1
  60. package/es/components/form-render/src/hooks/useFormField.d.ts +1 -0
  61. package/es/components/form-render/src/hooks/useFormField.js +1 -1
  62. package/es/components/form-render/src/hooks/useFormValidator.js +1 -1
  63. package/es/components/form-render/src/hooks/useLowCodeReactions.js +1 -1
  64. package/es/components/form-render/src/types/fieldItem.d.ts +4 -0
  65. package/es/components/form-render/src/types/index.d.ts +5 -3
  66. package/es/components/form-render/src/utils/dom.d.ts +2 -1
  67. package/es/components/form-render/src/utils/dom.js +1 -1
  68. package/es/components/iho-table/index.d.ts +5 -5
  69. package/es/components/iho-table/index.js +1 -1
  70. package/es/components/iho-table/src/IhoTable.vue.d.ts +5 -5
  71. package/es/components/iho-table/src/IhoTable.vue.js +1 -1
  72. package/es/components/iho-table/src/constants/index.d.ts +2 -2
  73. package/es/components/iho-table/src/hooks/tapHooks/useEventHooks.d.ts +1 -1
  74. package/es/components/iho-table/src/plugins/{filterPlugin → filterRenderPlugin}/filter.vue.d.ts +15 -74
  75. package/es/components/iho-table/src/plugins/filterRenderPlugin/filter.vue.js +1 -0
  76. package/es/components/iho-table/src/plugins/filterRenderPlugin/index.d.ts +1 -0
  77. package/es/components/iho-table/src/plugins/filterRenderPlugin/index.js +1 -0
  78. package/es/components/iho-table/src/plugins/index.js +1 -1
  79. package/es/components/iho-table/src/plugins/rendererPlugins/editableWidgets/timeRendererPlugin/editTime.vue.d.ts +85 -0
  80. package/es/components/iho-table/src/plugins/rendererPlugins/editableWidgets/timeRendererPlugin/editTime.vue.js +1 -0
  81. package/es/components/iho-table/src/plugins/rendererPlugins/editableWidgets/{timeRendererPlugin.d.ts → timeRendererPlugin/index.d.ts} +1 -1
  82. package/es/components/iho-table/src/plugins/rendererPlugins/editableWidgets/timeRendererPlugin/index.js +1 -0
  83. package/es/components/iho-table/src/plugins/rendererPlugins/editableWidgets/timeRendererPlugin/timeUtils.d.ts +2 -0
  84. package/es/components/iho-table/src/plugins/rendererPlugins/editableWidgets/timeRendererPlugin/timeUtils.js +1 -0
  85. package/es/components/iho-table/src/plugins/rendererPlugins/widgets/colorRendererPlugin.js +1 -1
  86. package/es/components/iho-table/src/plugins/rendererPlugins/widgets/defaultRendererPlugin.js +1 -1
  87. package/es/components/iho-table/src/types/index.d.ts +20 -11
  88. package/es/components/iho-table/src/utils/index.js +1 -1
  89. package/es/components/iho-table/style/index.css +1 -1
  90. package/es/components/index.css +1 -1
  91. package/es/components/index.js +1 -1
  92. package/es/components/info-header/index.d.ts +289 -155
  93. package/es/components/info-header/src/InfoHeader.vue.d.ts +293 -160
  94. package/es/components/info-header/src/InfoHeader.vue.js +1 -1
  95. package/es/components/info-header/src/components/index.d.ts +3 -0
  96. package/es/components/info-header/src/components/index.js +1 -0
  97. package/es/components/info-header/src/components/infoDescription/HiddenContent.vue.js +1 -0
  98. package/es/components/info-header/src/components/infoDescription/InfoEllipsis.vue.js +1 -0
  99. package/es/components/info-header/src/components/infoDescription/index.vue.d.ts +266 -0
  100. package/es/components/info-header/src/components/infoDescription/index.vue.js +1 -0
  101. package/es/components/info-header/src/components/patientInfo/index.vue.d.ts +38 -0
  102. package/es/components/info-header/src/components/patientInfo/index.vue.js +1 -0
  103. package/es/components/info-header/src/types/index.d.ts +29 -0
  104. package/es/components/recommend-search/index.d.ts +10 -10
  105. package/es/components/recommend-search/src/RecommendSearch.vue.d.ts +10 -10
  106. package/es/components/recommend-search/src/components/BaseSearch.vue.d.ts +2 -2
  107. package/es/components/recommend-search/src/components/RecommendInput.vue.d.ts +4 -4
  108. package/es/components/recommend-search/src/components/RecommendSelect.vue.d.ts +4 -4
  109. package/es/components/scale-view/index.d.ts +1 -2
  110. package/es/components/scale-view/src/ScaleView.vue.d.ts +1 -2
  111. package/es/components/scale-view/src/ScaleView.vue.js +1 -1
  112. package/es/components/scale-view/src/components/formitem/text-over-tooltip/TextOverTooltip.vue.d.ts +1 -1
  113. package/es/components/scale-view/src/hooks/scaleview-computed.d.ts +1 -0
  114. package/es/components/scale-view/src/hooks/scaleview-computed.js +1 -1
  115. package/es/components/scale-view/src/hooks/scaleview-submit.js +1 -1
  116. package/es/components/scale-view/src/utils/judge-types.js +1 -1
  117. package/es/components/scale-view/style/index.css +1 -1
  118. package/es/components/shortcut-setter/index.d.ts +3 -2
  119. package/es/components/shortcut-setter/src/ShortcutSetter.vue.d.ts +3 -2
  120. package/es/components/steps-wheel/index.d.ts +1 -1
  121. package/es/components/steps-wheel/src/StepsWheel.vue.d.ts +1 -1
  122. package/es/components/table-filter/index.d.ts +902 -7615
  123. package/es/components/table-filter/index.js +1 -1
  124. package/es/components/table-filter/src/base-search-com/BaseSearch.vue.d.ts +44 -3313
  125. package/es/components/table-filter/src/base-search-com/BaseSearch.vue.js +1 -1
  126. package/es/components/table-filter/src/classification/Classification-com.vue.d.ts +461 -2810
  127. package/es/components/table-filter/src/classification/Classification-com.vue.js +1 -1
  128. package/es/components/table-filter/src/components/classify-filter/ValueCfg.vue.d.ts +2 -2
  129. package/es/components/table-filter/src/components/classify-filter/hooks/useFilterConditions.d.ts +1 -42
  130. package/es/components/table-filter/src/components/classify-filter/hooks/useFilterConditions.js +1 -1
  131. package/es/components/table-filter/src/components/classify-filter/index.vue.d.ts +20 -7
  132. package/es/components/table-filter/src/components/classify-filter/index.vue.js +1 -1
  133. package/es/components/table-filter/src/components/render-widget/widgetCfgMaps.js +1 -1
  134. package/es/components/table-filter/src/components/search-filter/index.vue.d.ts +456 -0
  135. package/es/components/table-filter/src/components/search-filter/index.vue.js +1 -0
  136. package/es/components/table-filter/src/components/set-classification/index.vue.d.ts +843 -0
  137. package/es/components/table-filter/src/components/set-classification/index.vue.js +1 -0
  138. package/es/components/table-filter/src/components/table-modal/index.vue.js +1 -0
  139. package/es/components/table-filter/src/hooks/export.js +1 -1
  140. package/es/components/table-filter/src/hooks/useAdvanced.d.ts +2 -2
  141. package/es/components/table-filter/src/hooks/useAdvanced.js +1 -1
  142. package/es/components/table-filter/src/hooks/useMixins.d.ts +1 -1
  143. package/es/components/table-filter/src/hooks/useMixins.js +1 -1
  144. package/es/components/table-filter/src/quick-search/QuickSearch.vue.d.ts +51 -1190
  145. package/es/components/table-filter/src/quick-search/QuickSearch.vue.js +1 -1
  146. package/es/components/table-filter/src/types/index.d.ts +4 -14
  147. package/es/components/table-filter/style/index.css +1 -1
  148. package/es/env.d.ts +24 -24
  149. package/es/shared/components/TextOverTooltip/TextOverTooltip.vue.d.ts +1 -1
  150. package/es/shared/components/VueDraggable/src/vuedraggable.d.ts +86 -0
  151. package/es/shared/components/no-data/NoData.vue.d.ts +5 -0
  152. package/es/shared/components/no-data/NoData.vue.js +1 -1
  153. package/es/shared/utils/index.d.ts +16 -0
  154. package/es/shared/utils/index.js +1 -1
  155. package/es/shared/utils/tapable/index.d.ts +139 -0
  156. package/package.json +64 -64
  157. package/es/components/iho-table/src/plugins/filterPlugin/filter.vue.js +0 -1
  158. package/es/components/iho-table/src/plugins/filterPlugin/index.d.ts +0 -1
  159. package/es/components/iho-table/src/plugins/filterPlugin/index.js +0 -1
  160. package/es/components/iho-table/src/plugins/filterPlugin/types.d.ts +0 -7
  161. package/es/components/iho-table/src/plugins/rendererPlugins/editableWidgets/timeRendererPlugin.js +0 -1
  162. package/es/components/info-header/src/HiddenContent.vue.js +0 -1
  163. package/es/components/info-header/src/InfoEllipsis.vue.js +0 -1
  164. package/es/components/table-filter/src/classification/search-class-name.vue.d.ts +0 -90
  165. package/es/components/table-filter/src/classification/search-class-name.vue.js +0 -1
  166. package/es/components/table-filter/src/classification/search-professional-model.vue.d.ts +0 -1469
  167. package/es/components/table-filter/src/classification/search-professional-model.vue.js +0 -1
  168. package/es/components/table-filter/src/components/age-com/index.vue.d.ts +0 -119
  169. package/es/components/table-filter/src/components/age-com/index.vue.js +0 -1
  170. package/es/components/table-filter/src/components/button-group/ButtonGroup.vue.d.ts +0 -199
  171. package/es/components/table-filter/src/components/button-group/ButtonGroup.vue.js +0 -1
  172. package/es/components/table-filter/src/components/button-icon/getBtnIcon.d.ts +0 -2
  173. package/es/components/table-filter/src/components/button-icon/getBtnIcon.js +0 -1
  174. package/es/components/table-filter/src/components/c-tree-select/tree-select.vue.d.ts +0 -90
  175. package/es/components/table-filter/src/components/c-tree-select/tree-select.vue.js +0 -1
  176. package/es/components/table-filter/src/components/multi-select/multi-select.vue.d.ts +0 -113
  177. package/es/components/table-filter/src/components/multi-select/multi-select.vue.js +0 -1
  178. package/es/components/table-filter/src/components/out-quick-search/out-quick-search.vue.d.ts +0 -266
  179. package/es/components/table-filter/src/components/out-quick-search/out-quick-search.vue.js +0 -1
  180. package/es/components/table-filter/src/components/range-age/index.vue.d.ts +0 -248
  181. package/es/components/table-filter/src/components/range-age/index.vue.js +0 -1
  182. package/es/components/table-filter/src/components/search-condition/SearchCondition.vue.d.ts +0 -789
  183. package/es/components/table-filter/src/components/search-condition/SearchCondition.vue.js +0 -1
  184. package/es/components/table-filter/src/components/search-condition/fieldTypeList.d.ts +0 -18
  185. package/es/components/table-filter/src/components/search-condition/fieldTypeList.js +0 -1
  186. package/es/components/table-filter/src/components/search-filter/SearchFilter.vue.d.ts +0 -1244
  187. package/es/components/table-filter/src/components/search-filter/SearchFilter.vue.js +0 -1
  188. package/es/components/table-filter/src/components/search-modal/set-classification.vue.d.ts +0 -1651
  189. package/es/components/table-filter/src/components/search-modal/set-classification.vue.js +0 -1
  190. package/es/components/table-filter/src/components/table-modal/TableModal.vue.js +0 -1
  191. package/es/components/table-filter/src/const/dataOptions.d.ts +0 -36
  192. package/es/components/table-filter/src/const/dataOptions.js +0 -1
  193. package/es/components/table-filter/src/directive/preventReClick.d.ts +0 -4
  194. package/es/components/table-filter/src/directive/preventReClick.js +0 -1
  195. package/es/components/info-header/src/{HiddenContent.vue.d.ts → components/infoDescription/HiddenContent.vue.d.ts} +2 -2
  196. package/es/components/info-header/src/{InfoEllipsis.vue.d.ts → components/infoDescription/InfoEllipsis.vue.d.ts} +1 -1
  197. /package/es/components/{iho-table/src/plugins/filterPlugin/types.js → info-header/src/types/index.js} +0 -0
  198. /package/es/components/table-filter/src/components/table-modal/{TableModal.vue.d.ts → index.vue.d.ts} +0 -0
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
+ ```
@@ -0,0 +1 @@
1
+ declare module 'bpmn-js/lib/Viewer';
@@ -0,0 +1 @@
1
+ declare module 'bpmn-js/lib/features/modeling';
@@ -0,0 +1 @@
1
+ declare module 'diagram-js/lib/navigation/movecanvas';
@@ -1 +1 @@
1
- import t from"axios";import{isArray as e}from"lodash-es";import{IdentityVerificationDialog as i,PreviewDialog as n}from"./dialog.js";import{getFileUrl as s,useBrowserPrint as r,isIReport as a}from"./browserPrint.js";import{getCurrentInstance as o}from"vue";import{format as l}from"date-fns";const d=t.create({timeout:1e3,withCredentials:!1}),h=t.create({withCredentials:!1}),c=`${window.location.protocol}//${window.location.host}`,p=`${c}/fdp-api/print/assembly/printIReport`,u=`${c}/bi-api/reprot/print/open/client/getRemote`,m=`${c}/printService/file`;let w=null;class f{constructor(){var t;if(this.webview=null,this.dialog=new i,this.dialogPreview=new n,this.instance=null,this.downloadPath="",this.printOrigin="http://127.0.0.1:11111",this.isRemote=!1,this.messageHandlerQueue=[],w)return w;w=this;const e=window;this.webview=null==(t=e.chrome)?void 0:t.webview,this.webview&&(this.currentMessageHandler=this.messageHandler.bind(this),this.webview.addEventListener("message",this.currentMessageHandler),this.postMessage({exec:"config",data:""}))}messageHandler(t){var e;const i=this.messageHandlerQueue.shift();if(!i)return console.log("当前回执",t,"没有可用的handler");const{resolve:n,reject:s}=i;try{const{exec:i}=JSON.parse(t.data);"config"===i&&(this.downloadPath=(null==(e=JSON.parse(t.data).res)?void 0:e.downloadpath)||""),console.log(t),n(JSON.parse(t.data).res)}catch(t){s(t)}}async postMessage(t){return this.webview?new Promise(((e,i)=>{this.messageHandlerQueue.push({resolve:e,reject:i}),this.webview.postMessage(t)})):Promise.reject()}destroy(){this.webview&&this.currentMessageHandler&&(this.webview.removeEventListener("message",this.currentMessageHandler),this.currentMessageHandler=void 0)}show(...t){return this.dialog.show(...t)}showPreview(...t){return this.dialogPreview.show(...t)}_testConnection(){return this.webview?Promise.resolve(!0):new Promise((t=>{d({url:`${this.printOrigin}/test`,method:"get",withCredentials:!1,params:{inputdata:{result:"success"}}}).then((({data:e})=>{"success"===e.result?t(!0):t(!1)})).catch((e=>{t(!1)}))}))}_queryServicesPrint(t){return this.webview?this.postMessage({exec:"print",data:{inputData:t}}):h({url:this.printOrigin+"/services/print",method:"get",params:{inputData:JSON.stringify(t)}}).then((({data:t})=>t))}_callPrintWithFile(t){const e={cmdid:"7",flag:"1"},i={inputData:JSON.stringify(Object.assign({},e,t))};return this.webview?this.postMessage({exec:"print",data:n(i)}):h({url:this.printOrigin+"/PrintLocal",method:"post",data:i,transformRequest:[n]}).then((({data:t})=>t));function n(t){let e="";for(const i in t)e+=encodeURIComponent(i)+"="+encodeURIComponent(t[i])+"&";return e=e.slice(0,-1),e}}_handleResult(t,e){if("success"!==t.result){const i={type:"printError",message:t.message||t.Message,result:t.result,errinfo:t.errinfo};return null==e||e(i),!1}return t}_handleResultTest(t,e){return!!t||(console.log("notInstalledApp"),null==e||e({type:"notInstalledApp",message:"请打开打印服务器插件"}),!1)}async _handleEventQueryPrintData(t,e,i,n){const s={templateId:t,formatId:e,params:i,cmdid:"7"},r=await this._queryServicesPrint(s);return this._handleQueryPrintDataResult(r,e,n)}_handleQueryPrintDataResult(t,e,i){if(!(null==t?void 0:t.file)){try{const e=t.message||t.Message;console.log(e),null==i||i({type:"queryPrintDataFailure",message:e})}catch(t){console.log(t)}return!1}return{file:t.file,printerName:t.defprinter,pageCount:t.pagecount,formatId:e}}async _handleEventDirect({templateId:t,formatId:e,params:i,cmdid:n,print:s,printdlgshow:r="1",nobillnode:a="1",btnprint:o="1"}){const d={templateId:t,formatId:e,params:i,cmdid:n,nobillnode:a,printdlgshow:r,btnprint:o};if(s){try{s=JSON.parse(s)}catch(t){}d.print=s}else this.isRemote&&(d.print={print:"1",type:"6",zip:"0",filename:`F:\\WorkSpace\\crmweb\\web\\${l(new Date,"yyyyMMddHHmmss")}`});return await this._queryServicesPrint(d)}async _handleEventEditFormat({templateId:t,formatId:e="",params:i="",token:n}){const s={};let r={};try{r=Object.assign({},s,JSON.parse(i))}catch(t){r=s}const a={templateId:t,formatId:e,cmdid:"9",token:n,params:JSON.stringify(r)};return await this._queryServicesPrint(a)}async _queryProxyOrigin(){if(this.isRemote)return;const{data:t}=await h({method:"get",url:u})||{},{map:e={}}=t;e.isRemote&&(this.printOrigin=c+"/printService",this.isRemote=!0)}async _queryPrintFile(t,e=""){const{data:i}=await h({method:"post",url:p,responseType:"blob",params:{formatId:t.split("_")[1],params:e}})||{};return i}async _browserPrint(t,e){if(this.isRemote){const{filedir:i}=t,n=JSON.parse(i)[0].replace(/\\/g,"/").split("/"),a=n[n.length-1],o=await s(`${m}/${a}`),l=r(null,e,o);if("preview"===e)return l}}async preview({templateId:t,formatId:e,params:i="",btnprint:n},s,l){if(a(e)){const t=await this._queryPrintFile(e,i);if(!t)return null==l?void 0:l("获取文件失败!");const n=r(t,"preview");return this.instance||(this.instance=o()),this.showPreview(this.instance,n),void(null==s||s({file:t}))}await this._queryProxyOrigin();const d=await this._testConnection();if(!this._handleResultTest(d,l))return!1;const h=await this._handleEventDirect({templateId:t,formatId:e,params:i,cmdid:this.isRemote?"7":"8",btnprint:n});if(!h)return!1;const c=this._handleResult(h,l);if(!c)return!1;if(this.isRemote){const t=await this._browserPrint(c,"preview");this.instance||(this.instance=o()),this.showPreview(this.instance,t)}s&&s(c)}async printDirect({templateId:t,formatId:e,params:i="",print:n,printdlgshow:s,nobillnode:o,isDownloadFile:l=!0},d,h,c="printDirect"){if(a(e)){const t=await this._queryPrintFile(e,i);return t?(r(t,c),void(null==d||d({file:t}))):null==h?void 0:h("获取文件失败!")}await this._queryProxyOrigin();const p=await this._testConnection();if(!this._handleResultTest(p,h))return!1;const u=await this._handleEventDirect({templateId:t,formatId:e,params:i,cmdid:"7",print:n,printdlgshow:s,nobillnode:o});if(!u)return!1;const m=this._handleResult(u,h);if(!m)return!1;l&&["downloadPDF"].includes(c)&&await this._browserPrint(m,c),d&&d(m)}_downloadPDF(t){return this.webview?this.postMessage({exec:"pdf",data:{file:t}}):h.get(this.printOrigin+"/download",{params:{inputData:t}}).then((({data:t})=>t))}downloadPDF(t,i,n){this.webview&&this.downloadPath&&(t.print.filename=this.downloadPath.replace(/\\/g,"/")),this.printDirect(t,(async s=>{if(s||n(null),a(t.formatId))return i(s);const r=this,o=await async function(t){const i=[],n=JSON.parse(t);if(!e(n))return await r._downloadPDF("");if(1===n.length)return await r._downloadPDF(n[0]||"");for(let t=0,e=n.length;t<e;t++)i.push(await r._downloadPDF(n[t]||""));return i}(s.filedir);i(o)}),(t=>n(t)),"downloadPDF")}async print({templateId:t,formatId:e,params:i=""},n,s){const r=await this._testConnection();if(!this._handleResultTest(r,s))return!1;const a=await this.queryPrintData({templateId:t,formatId:e,params:i},void 0,s);if(!a)return!1;const o=this.printFileData({formatId:e,file:a.file,printerName:a.printerName},void 0,s);if(!o)return!1;n&&n(o)}async queryPrintData({templateId:t,formatId:e,params:i=""},n,s){const r=await this._testConnection();if(!this._handleResultTest(r,s))return!1;const a=await this._handleEventQueryPrintData(t,e,i,s);return!!a&&(n&&n(a),a)}async printFileData({formatId:t,file:e,printerName:i="Default"},n,s){const r=await this._testConnection();if(!this._handleResultTest(r,s))return!1;const a=await this._callPrintWithFile({formatId:t,printname:i,file:e}),o=this._handleResult(a,s);return!!o&&(n&&n(o),o)}async editPrintFormat({templateId:t,formatId:e,params:i,token:n},s,r){const a=await this._testConnection();if(!this._handleResultTest(a,r))return!1;const o=await this._handleEventEditFormat({templateId:t,formatId:e,params:i,token:n}),l=this._handleResult(o,r);if(!l)return!1;s&&s(l)}async addPrintFormat({templateId:t,params:e,token:i},n,s){const r=await this._testConnection();if(!this._handleResultTest(r,s))return!1;const a=await this._handleEventEditFormat({templateId:t,params:e,token:i}),o=this._handleResult(a,s);if(!o)return!1;n&&n(o)}}export{f as Print};
1
+ import t from"axios";import{isArray as e}from"lodash-es";import{IdentityVerificationDialog as i,PreviewDialog as n}from"./dialog.js";import{getFileUrl as s,useBrowserPrint as r,isIReport as a}from"./browserPrint.js";import{getCurrentInstance as o}from"vue";import{format as l}from"date-fns";const d=t.create({timeout:1e3,withCredentials:!1}),h=`${window.location.protocol}//${window.location.host}`,c=`${h}/fdp-api/print/assembly/printIReport`,p=`${h}/bi-api/reprot/print/open/client/getRemote`,u=`${h}/printService/file`;let m=null;class w{constructor(){var t;if(this.webview=null,this.dialog=new i,this.dialogPreview=new n,this.instance=null,this.downloadPath="",this.printOrigin="http://127.0.0.1:11111",this.isRemote=!1,this.messageHandlerQueue=[],m)return m;m=this;const e=window;this.webview=null==(t=e.chrome)?void 0:t.webview,this.webview&&(this.currentMessageHandler=this.messageHandler.bind(this),this.webview.addEventListener("message",this.currentMessageHandler),this.postMessage({exec:"config",data:""}))}messageHandler(t){var e;const i=this.messageHandlerQueue.shift();if(!i)return console.log("当前回执",t,"没有可用的handler");const{resolve:n,reject:s}=i;try{const{exec:i}=JSON.parse(t.data);"config"===i&&(this.downloadPath=(null==(e=JSON.parse(t.data).res)?void 0:e.downloadpath)||""),console.log(t),n(JSON.parse(t.data).res)}catch(t){s(t)}}async postMessage(t){return this.webview?new Promise(((e,i)=>{this.messageHandlerQueue.push({resolve:e,reject:i}),this.webview.postMessage(t)})):Promise.reject()}destroy(){this.webview&&this.currentMessageHandler&&(this.webview.removeEventListener("message",this.currentMessageHandler),this.currentMessageHandler=void 0)}show(...t){return this.dialog.show(...t)}showPreview(...t){return this.dialogPreview.show(...t)}_testConnection(){return this.webview?Promise.resolve(!0):new Promise((t=>{d({url:`${this.printOrigin}/test`,method:"get",withCredentials:!1,params:{inputdata:{result:"success"}}}).then((({data:e})=>{"success"===e.result?t(!0):t(!1)})).catch((e=>{t(!1)}))}))}_queryServicesPrint(t){return this.webview?this.postMessage({exec:"print",data:{inputData:t}}):d({url:this.printOrigin+"/services/print",method:"get",params:{inputData:JSON.stringify(t)}}).then((({data:t})=>t))}_callPrintWithFile(t){const e={cmdid:"7",flag:"1"},i={inputData:JSON.stringify(Object.assign({},e,t))};return this.webview?this.postMessage({exec:"print",data:n(i)}):d({url:this.printOrigin+"/PrintLocal",method:"post",data:i,transformRequest:[n]}).then((({data:t})=>t));function n(t){let e="";for(const i in t)e+=encodeURIComponent(i)+"="+encodeURIComponent(t[i])+"&";return e=e.slice(0,-1),e}}_handleResult(t,e){if("success"!==t.result){const i={type:"printError",message:t.message||t.Message,result:t.result,errinfo:t.errinfo};return null==e||e(i),!1}return t}_handleResultTest(t,e){return!!t||(console.log("notInstalledApp"),null==e||e({type:"notInstalledApp",message:"请打开打印服务器插件"}),!1)}async _handleEventQueryPrintData(t,e,i,n){const s={templateId:t,formatId:e,params:i,cmdid:"7"},r=await this._queryServicesPrint(s);return this._handleQueryPrintDataResult(r,e,n)}_handleQueryPrintDataResult(t,e,i){if(!(null==t?void 0:t.file)){try{const e=t.message||t.Message;console.log(e),null==i||i({type:"queryPrintDataFailure",message:e})}catch(t){console.log(t)}return!1}return{file:t.file,printerName:t.defprinter,pageCount:t.pagecount,formatId:e}}async _handleEventDirect({templateId:t,formatId:e,params:i,cmdid:n,print:s,printdlgshow:r="1",nobillnode:a="1",btnprint:o="1"}){const d={templateId:t,formatId:e,params:i,cmdid:n,nobillnode:a,printdlgshow:r,btnprint:o};if(s){try{s=JSON.parse(s)}catch(t){}d.print=s}else if(this.isRemote){const t=l(new Date,"yyyyMMddHHmmss");d.print={print:"1",type:"1",zip:"0",filename:`F:\\WorkSpace\\crmweb\\web\\${t}\\${t}`}}return await this._queryServicesPrint(d)}async _handleEventEditFormat({templateId:t,formatId:e="",params:i="",token:n}){const s={};let r={};try{r=Object.assign({},s,JSON.parse(i))}catch(t){r=s}const a={templateId:t,formatId:e,cmdid:"9",token:n,params:JSON.stringify(r)};return await this._queryServicesPrint(a)}async _queryProxyOrigin(){if(this.isRemote)return;const{data:t}=await d({method:"get",url:p})||{},{map:e={}}=t;e.isRemote&&(this.printOrigin=h+"/printService",this.isRemote=!0)}async _queryPrintFile(t,e=""){const{data:i}=await d({method:"post",url:c,responseType:"blob",params:{formatId:t.split("_")[1],params:e}})||{};return i}async _browserPrint(t,e){if(this.isRemote){const{filedir:i}=t,n=JSON.parse(i)[0].replace(/\\/g,"/").split("/"),a=n[n.length-2],o=n[n.length-1],l=await s(`${u}/${a}/${o}`),d=r(null,e,l);if("preview"===e)return d}}async preview({templateId:t,formatId:e,params:i="",btnprint:n},s,l){if(a(e)){const t=await this._queryPrintFile(e,i);if(!t)return null==l?void 0:l("获取文件失败!");const n=r(t,"preview");return this.instance||(this.instance=o()),this.showPreview(this.instance,n),void(null==s||s({file:t}))}await this._queryProxyOrigin();const d=await this._testConnection();if(!this._handleResultTest(d,l))return!1;const h=await this._handleEventDirect({templateId:t,formatId:e,params:i,cmdid:this.isRemote?"7":"8",btnprint:n});if(!h)return!1;const c=this._handleResult(h,l);if(!c)return!1;if(this.isRemote){const t=await this._browserPrint(c,"preview");this.instance||(this.instance=o()),this.showPreview(this.instance,t)}s&&s(c)}async printDirect({templateId:t,formatId:e,params:i="",print:n,printdlgshow:s,nobillnode:o,isDownloadFile:l=!0},d,h,c="printDirect"){if(a(e)){const t=await this._queryPrintFile(e,i);return t?(r(t,c),void(null==d||d({file:t}))):null==h?void 0:h("获取文件失败!")}await this._queryProxyOrigin();const p=await this._testConnection();if(!this._handleResultTest(p,h))return!1;const u=await this._handleEventDirect({templateId:t,formatId:e,params:i,cmdid:"7",print:n,printdlgshow:s,nobillnode:o});if(!u)return!1;const m=this._handleResult(u,h);if(!m)return!1;l&&["downloadPDF"].includes(c)&&await this._browserPrint(m,c),d&&d(m)}_downloadPDF(t){return this.webview?this.postMessage({exec:"pdf",data:{file:t}}):d.get(this.printOrigin+"/download",{params:{inputData:t}}).then((({data:t})=>t))}downloadPDF(t,i,n){this.webview&&this.downloadPath&&(t.print.filename=this.downloadPath.replace(/\\/g,"/")),this.printDirect(t,(async s=>{if(s||n(null),a(t.formatId))return i(s);const r=this,o=await async function(t){const i=[],n=JSON.parse(t);if(!e(n))return await r._downloadPDF("");if(1===n.length)return await r._downloadPDF(n[0]||"");for(let t=0,e=n.length;t<e;t++)i.push(await r._downloadPDF(n[t]||""));return i}(s.filedir);i(o)}),(t=>n(t)),"downloadPDF")}async print({templateId:t,formatId:e,params:i=""},n,s){const r=await this._testConnection();if(!this._handleResultTest(r,s))return!1;const a=await this.queryPrintData({templateId:t,formatId:e,params:i},void 0,s);if(!a)return!1;const o=this.printFileData({formatId:e,file:a.file,printerName:a.printerName},void 0,s);if(!o)return!1;n&&n(o)}async queryPrintData({templateId:t,formatId:e,params:i=""},n,s){const r=await this._testConnection();if(!this._handleResultTest(r,s))return!1;const a=await this._handleEventQueryPrintData(t,e,i,s);return!!a&&(n&&n(a),a)}async printFileData({formatId:t,file:e,printerName:i="Default"},n,s){const r=await this._testConnection();if(!this._handleResultTest(r,s))return!1;const a=await this._callPrintWithFile({formatId:t,printname:i,file:e}),o=this._handleResult(a,s);return!!o&&(n&&n(o),o)}async editPrintFormat({templateId:t,formatId:e,params:i,token:n},s,r){const a=await this._testConnection();if(!this._handleResultTest(a,r))return!1;const o=await this._handleEventEditFormat({templateId:t,formatId:e,params:i,token:n}),l=this._handleResult(o,r);if(!l)return!1;s&&s(l)}async addPrintFormat({templateId:t,params:e,token:i},n,s){const r=await this._testConnection();if(!this._handleResultTest(r,s))return!1;const a=await this._handleEventEditFormat({templateId:t,params:e,token:i}),o=this._handleResult(a,s);if(!o)return!1;n&&n(o)}}export{w as Print};
@@ -1 +1 @@
1
- import{useBirthProcessCumputedPoint as t}from"./useCumputedPoint.js";import e from"./useGrid.js";import{drawLine as n,drawArrow as o,drawText as i,defaultTextStyle as r,drawPoint as l,defaultRectStyle as s}from"./useDraw.js";import{fabric as a}from"../utils/index.js";import{getIndex as u,isEffectiveNode as c}from"../utils/utils.js";import{cloneDeep as f}from"lodash-es";import{format as p}from"date-fns";function d(d,h,g,v,m,y){const{cumputedX:k,cumputedY:w,getXValue:x,getYValue:b}=t(h),{getEqualXTypes:T,repeatTip:E}=y,{xAxis:P,grid:S,originX:j,originY:C,xCellWidth:G,endY:L,startTime:Y,leftAddAreaWidth:A,leftScales:I,rightScales:M,yCellHeight:X,endX:D,scaleValues:H,canvasWidth:O,borderStyle:V,rightAddAreaWidth:W,event:$,originYCervix:R,other:q}=h,z=f(H),B=new Set;function F(){z.forEach(((t,e)=>{var s;const a=[],u=[],c=[];null==(s=t.data)||s.forEach(((s,f)=>{!function(s,f,p){let m,y;const{pointAttr:k={},lineAttr:w={},title:T="",key:E,type:P="circle",childbirth:S={}}=t,j=t.data[p+1],C=Q(j,t);if(s&&C&&!f.breakpoint)y=n([...s,...C],{...w});else if(s&&!C&&!f.breakpoint){const e=Q(j,t);y=e?n([...s,...e],{...w}):null}let L,Y;if(f.childbirth){const t=s[1]+X;L=o([s[0],s[1],t],S.style||{}),c.push(L),S.text&&(Y=i([s[0]+G/2,t-X/2],{value:String(S.text),...r,originX:"left",originY:"center",...S.style||{}}),c.push(Y))}const A=u[p-1],I={origin:{data:f,title:T,key:E||"",dataIndex:e,index:p},leftLine:A,rightLine:y,arrowGroup:L,arrowGroupText:Y,...k,...h.event};A?m=l(P,{left:A.get("x2"),top:A.get("y2"),...I}):s&&(I.leftLine=null,m=l(P,{left:s[0],top:s[1],...I}));u.push(y),m&&(!function(t){$.hovered&&(t.on("mouseover",(()=>{N(t)})),t.on("mouseout",(()=>{v.show=!1})));t.on("moving",(()=>{K(t),function(t){var e,n,o,i;null==(e=t.leftLine)||e.setCoords().set({x2:t.left,y2:t.top}),null==(n=t.rightLine)||n.setCoords().set({x1:t.left,y1:t.top}),null==(o=t.arrowGroup)||o.setCoords().set({left:t.left,top:t.top}),null==(i=t.arrowGroupText)||i.setCoords().set({left:t.left+G/2,top:t.top+X/2})}(t),$.hovered&&N(t)})),t.on("mouseup",(e=>{if(v.show=!1,1===e.button){const{key:e}=t.origin,n={...t.origin,data:{...t.origin.data,time:x(t.left),value:b(e,t.top)}};d.value.discardActiveObject(),g("change",n),J(n,"change")}}))}(m),a.push(m),B.add(m))}(Q(s,t),s,f)})),Promise.all(a).then((t=>{const e=u.filter((t=>t));let n=null;t=t.filter((t=>(t&&n&&(n.nextPoint=t,t.prevPoint=n),n=t||n,t))),Promise.all(c).then((n=>{d.value.add(...e,...t,...n),t.forEach((t=>{null==t||t.bringToFront()}))}))}))}))}function J(t,e="add"){const{dataIndex:n,data:o,index:i,key:r}=t,l=z.find((t=>t.key===r));switch(e){case"remove":l.data.splice(i,1);break;case"change":l.data[i]=o;break;default:{const t=u(o.time,l.data);l.data.splice(t,0,o);break}}var s;B.size&&(null==(s=d.value)||s.remove(...function(t){const e=[];return t.forEach((t=>{t&&e.push(t),(null==t?void 0:t.leftLine)&&e.push(null==t?void 0:t.leftLine),(null==t?void 0:t.rightLine)&&e.push(null==t?void 0:t.rightLine),(null==t?void 0:t.arrowGroup)&&e.push(null==t?void 0:t.arrowGroup),(null==t?void 0:t.arrowGroupText)&&e.push(null==t?void 0:t.arrowGroupText)})),e}([...B]))),B.clear(),F()}function K(t){const e=t.prevPoint?t.prevPoint.left:j,n=t.nextPoint?t.nextPoint.left:D;t.setCoords(),["cervix","fetalPresentation"].includes(t.origin.key)&&t.top<R&&t.set("top",R),t.top<C&&t.set("top",C),t.top>L&&t.set("top",L),t.left<e&&t.set("left",e),t.left>n&&t.set("left",n)}function N(t){const{title:e,key:n}=t.origin;v.point={x:t.left,y:t.top},v.list=[`${e} ${b(n,t.top)}`,`时间 ${x(t.left).slice(-5)}`],v.show=!0}function Q(t,e){if(c(t)&&function(t){const e=Y+864e5,n=new Date(t).getTime();return n>=Y&&n<=e}(t.time)){const n=k(t.time),o=w(e.key,e.range,t.value);return[n,o<C?C:o>L?L:o]}}function U(t,e){return t+1>e[1]?e[0]:t+1}return e(d,h,!0),function(){const t=new a.Rect({...V,width:O-A-W,height:L,left:A,top:0,fill:"transparent"});d.value.add(t)}(),function(){let t=A;[...I,...M].forEach(((e,n)=>{const{range:o,spaceValue:l,width:u,title:c,titleStyle:f,layout:p}=e,h=[];"right"===p&&(t=D);const g=t+u/2,v=function(t,e){const n=[],[o,i]=t;for(let t=o;e>0?t<=i:t>=i;t+=e)n.push(t);return n}(o,l);v.forEach(((t,e)=>{const n=0===e?L-8:L-e*X;h.push(i([g,n],{value:String(t),...r}))}));const m=new a.Rect({...s,width:u,height:L,left:g,top:L/2}),y=C>0?i([g,C-X/2],{value:String(c),...r,...f}):null,k=new a.Group([...h,m,...y?[y]:[]],{evented:!1,selectable:!1});d.value.add(k),t+=u}))}(),function(){const{show:t,startTime:e,range:n=[0,23],position:o="top",style:l}=P.time,{show:s,range:u=[0,23],style:c}=P.processTime;if(t||s){const f=[],p=[],h=[],g=[],v=j+G/2;for(let a=0;a<S.mainXCell;a++){if(t){const t=0===a?+e.slice(11,13):U(f.at(-1),n);f.push(t);const s="top"==o?C-15:L+15;h.push(i([v+a*G,s],{value:String(t),...r,...l||{}}))}if(s){const t=0===a?u[0]:p.at(-1)+1;p.push(t);const e="top"==o?L+15:C-15;g.push(i([v+a*G,e],{value:String(t),...r,...c||{}}))}}const m=new a.Group([...h,...g],{evented:!1,selectable:!1});d.value.add(m),d.value.sendToBack(m)}}(),function(){const t=Object.values(q),e=[],o={},i=z.find((t=>"cervix"===t.key)),r=i.data.find((t=>3==+t.value));function l(t,e){const{key:n,range:o}=i||{},r=w(n,o,10),l=[0,e],s=[-e/t,0],a=[(L-r-e)/t,L-r],u=[D-j,t*(D-j)+e];let c=[],f=[];function p([n,o]){return Math.abs(o-t*n-e)<=1}function d([t,e]){const[n,o]=[...h([t,e])];return n>=j&&n<=D&&o>=r&&o<=L}function h([t,e]){return[j+t,L-e]}return p(l)&&d(l)&&(c=h(l)),p(s)&&d(s)&&(c=h(s)),p(a)&&d(a)&&(f=h(a)),p(u)&&d(u)&&(f=h(u)),[...c,...f]}t.forEach((t=>{if(!t.show)return;const{key:s}=t;switch(s){case"fetalPresentation":{const{range:o}=z.find((t=>t.key===s)),i=w(s,o,0);e.push(n([j,i,D,i],{...t}));break}case"alert":if(r){const{key:s,range:a}=i||{},u=216e5,c={time:p(new Date(new Date(r.time).getTime()+u),"yyyy-MM-dd HH:mm"),value:10},[f,d]=[k(r.time)-j,L-w(s,a,r.value)],[h,g]=[k(c.time)-j,L-w(s,a,c.value)],v=(g-d)/(h-f),m=d-f*v,y=l(v,m);y.length>0&&(e.push(n(y,{...t})),Object.assign(o,{k:v,b:m}))}break;case"handling":if(r){const{k:i,b:s}=o,a=144e5,u=l(i,s-(k(p(new Date(new Date(r.time).getTime()+a),"yyyy-MM-dd HH:mm"))-k(r.time))*i);u.length>0&&e.push(n(u,{...t}))}}})),d.value.add(...e)}(),F(),function(){function t(t,e){const n=z.findIndex((e=>e.key===t.key));return{renderItem:()=>t.title,origin:{title:t.title,unit:t.unit,dataIndex:n,key:t.key},pointer:e}}h.event.evented&&d.value.on("mouse:up",(e=>{if(3===e.button){const{x:n=0,y:o=0}=e.pointer||{};n>=j&&n<=D&&o>=C&&o<=L&&(m.point={x:n,y:o},m.show=!0,e.target?(m.target=e.target,m.list=["删除节点"],d.value.forEachObject((t=>{t.origin&&t.left===e.target.left&&t.top===e.target.top&&m.list.push({renderItem:()=>t.origin.title,origin:{...t.origin},mode:"remove",pointer:e.pointer})}))):(m.target=null,m.list=["新增节点"],z.forEach((i=>{if(!T(n,"key",G).includes(i.key)){if(["cervix","fetalPresentation"].includes(i.key)&&o<R)return;m.list.push(t(i,e.pointer))}})),1===m.list.length&&(m.show=!1,E(),console.log("当前时间段内无可新增节点"))))}}))}(),function(){const t=O-W/2;function e(t,e){if(!t.length)return;let o=C;const i=[];t.forEach((t=>{const n=t.title.split("").join("\n"),s=H.findIndex((e=>e.key===t.key)),u=new a.Text(String(n),{...r,...t.titleStyle||{},originY:"top",left:e,top:o,lineHeight:1}),c=l(t.type,{left:e,top:o+u.height+3,...t.pointAttr,originY:"top",origin:{title:t.title,unit:t.unit,type:t.type,dataIndex:s,key:t.key,isMenu:!0},originLeft:e,originTop:o+u.height+3,...h.event});o+=u.height+c.height+15,function(t){function e(t){const{left:e,top:n}=t;return e>=j&&e<=D&&n>=C&&n<=L}t.on("moving",(()=>{t.set("originY","center"),e(t)?(K(t),N(t)):v.show=!1})),t.on("mouseup:before",(n=>{if(v.show=!1,0===n.e.button&&e(t))if(T(t.left,"key",G).includes(t.origin.key))E();else{const e={data:{time:x(t.left),value:b(t.origin.key,t.top)},...t.origin};g("add",e),J(e)}!function(t){t.setCoords().set({originY:"top",left:t.originLeft,top:t.originTop})}(t)}))}(c),i.push(u,c)})),n(i),d.value.add(...i)}function n(t){const e=t.at(-1),n=(L-C)/2,o=(e.height+e.top-C)/2;t.forEach((t=>{const e=t.top+n-o;t.set({top:e,originTop:e})}))}e(I,A/2),e(M,t)}(),{clickMenu:function({item:t,target:e}){const n={...t.origin};"remove"===t.mode?(g("remove",n),J(n,"remove")):(Object.assign(n,{data:{time:x(t.pointer.x),value:b(t.origin.key,t.pointer.y)}}),g("add",n),J(n))}}}export{d as useBirthProcess};
1
+ import{useBirthProcessCumputedPoint as t}from"./useCumputedPoint.js";import e from"./useGrid.js";import{drawLine as n,drawArrow as o,drawText as i,defaultTextStyle as r,drawPoint as l,defaultStyle as s,defaultRectStyle as a}from"./useDraw.js";import{fabric as u}from"../utils/index.js";import{getIndex as c,isEffectiveNode as f}from"../utils/utils.js";import{cloneDeep as p}from"lodash-es";import{format as d}from"date-fns";function h(h,g,m,v,y,k){const{cumputedX:w,cumputedY:x,getXValue:b,getYValue:T}=t(g),{getEqualXTypes:j,repeatTip:C}=k,{xAxis:E,grid:P,originX:S,originY:G,xCellWidth:L,endY:Y,startTime:A,leftAddAreaWidth:I,leftScales:M,rightScales:X,yCellHeight:D,endX:H,scaleValues:O,canvasWidth:V,borderStyle:W,rightAddAreaWidth:$,event:R,originYCervix:q,other:z}=g,B=p(O),F=new Set;function J(){B.forEach(((t,e)=>{var s;const a=[],u=[],c=[];null==(s=t.data)||s.forEach(((s,f)=>{!function(s,f,p){let d,y;const{pointAttr:k={},lineAttr:w={},title:x="",key:j,type:C="circle",childbirth:E={}}=t,P=t.data[p+1],S=U(P,t);if(s&&S&&!f.breakpoint)y=n([...s,...S],{...w});else if(s&&!S&&!f.breakpoint){const e=U(P,t);y=e?n([...s,...e],{...w}):null}let G,Y;if(f.childbirth){const t=s[1]+D;G=o([s[0],s[1],t],E.style||{}),c.push(G),E.text&&(Y=i([s[0]+L/2,t-D/2],{value:String(E.text),...r,originX:"left",originY:"center",...E.style||{}}),c.push(Y))}const A=u[p-1],I={origin:{data:f,title:x,key:j||"",dataIndex:e,index:p},leftLine:A,rightLine:y,arrowGroup:G,arrowGroupText:Y,...k,...g.event};A?d=l(C,{left:A.get("x2"),top:A.get("y2"),...I}):s&&(I.leftLine=null,d=l(C,{left:s[0],top:s[1],...I}));u.push(y),d&&(!function(t){R.hovered&&(t.on("mouseover",(()=>{Q(t)})),t.on("mouseout",(()=>{v.show=!1})));t.on("moving",(()=>{N(t),function(t){var e,n,o,i;null==(e=t.leftLine)||e.setCoords().set({x2:t.left,y2:t.top}),null==(n=t.rightLine)||n.setCoords().set({x1:t.left,y1:t.top}),null==(o=t.arrowGroup)||o.setCoords().set({left:t.left,top:t.top}),null==(i=t.arrowGroupText)||i.setCoords().set({left:t.left+L/2,top:t.top+D/2})}(t),R.hovered&&Q(t)})),t.on("mouseup",(e=>{if(v.show=!1,1===e.button){const{key:e}=t.origin,n={...t.origin,data:{...t.origin.data,time:b(t.left),value:T(e,t.top)}};h.value.discardActiveObject(),m("change",n),K(n,"change")}}))}(d),a.push(d),F.add(d))}(U(s,t),s,f)})),Promise.all(a).then((t=>{const e=u.filter((t=>t));let n=null;t=t.filter((t=>(t&&n&&(n.nextPoint=t,t.prevPoint=n),n=t||n,t))),Promise.all(c).then((n=>{h.value.add(...e,...t,...n),t.forEach((t=>{null==t||t.bringToFront()}))}))}))}))}function K(t,e="add"){const{dataIndex:n,data:o,index:i,key:r}=t,l=B.find((t=>t.key===r));switch(e){case"remove":l.data.splice(i,1);break;case"change":l.data[i]=o;break;default:{const t=c(o.time,l.data);l.data.splice(t,0,o);break}}var s;F.size&&(null==(s=h.value)||s.remove(...function(t){const e=[];return t.forEach((t=>{t&&e.push(t),(null==t?void 0:t.leftLine)&&e.push(null==t?void 0:t.leftLine),(null==t?void 0:t.rightLine)&&e.push(null==t?void 0:t.rightLine),(null==t?void 0:t.arrowGroup)&&e.push(null==t?void 0:t.arrowGroup),(null==t?void 0:t.arrowGroupText)&&e.push(null==t?void 0:t.arrowGroupText)})),e}([...F]))),F.clear(),J()}function N(t){const e=t.prevPoint?t.prevPoint.left:S,n=t.nextPoint?t.nextPoint.left:H;t.setCoords(),["cervix","fetalPresentation"].includes(t.origin.key)&&t.top<q&&t.set("top",q),t.top<G&&t.set("top",G),t.top>Y&&t.set("top",Y),t.left<e&&t.set("left",e),t.left>n&&t.set("left",n)}function Q(t){const{title:e,key:n}=t.origin;v.point={x:t.left,y:t.top},v.list=[`${e} ${T(n,t.top)}`,`时间 ${b(t.left).slice(-5)}`],v.show=!0}function U(t,e){if(f(t)&&function(t){const e=A+864e5,n=new Date(t).getTime();return n>=A&&n<=e}(t.time)){const n=w(t.time),o=x(e.key,e.range,t.value);return[n,o<G?G:o>Y?Y:o]}}function Z(t,e){return t+1>e[1]?e[0]:t+1}return e(h,g,!0),function(){const t=new u.Rect({...W,width:V-I-$,height:Y,left:I,top:0,fill:"transparent"});h.value.add(t)}(),function(){let t=I;[...M,...X].forEach(((e,n)=>{const{range:o,spaceValue:l,width:c,title:f,titleStyle:p,layout:d}=e,g=[];"right"===d&&(t=H);const m=t+c/2,v=function(t,e){const n=[],[o,i]=t;for(let t=o;e>0?t<=i:t>=i;t+=e)n.push(t);return n}(o,l);v.forEach(((t,e)=>{const n=0===e?Y-8:Y-e*D;g.push(i([m,n],{value:String(t),...r}))}));const y=new u.Rect({...a,width:c,height:Y,left:m,top:Y/2}),k=G>0?i([m,G-D/2],{value:String(f),...r,...p}):null,w=new u.Group([...g,y,...k?[k]:[]],{objectCaching:!1,...s});h.value.add(w),t+=c}))}(),function(){const{show:t,startTime:e,range:n=[0,23],position:o="top",style:l}=E.time,{show:a,range:c=[0,23],style:f}=E.processTime;if(t||a){const p=[],d=[],g=[],m=[],v=S+L/2;for(let s=0;s<P.mainXCell;s++){if(t){const t=0===s?+e.slice(11,13):Z(p.at(-1),n);p.push(t);const a="top"==o?G-15:Y+15;g.push(i([v+s*L,a],{value:String(t),...r,...l||{}}))}if(a){const t=0===s?c[0]:d.at(-1)+1;d.push(t);const e="top"==o?Y+15:G-15;m.push(i([v+s*L,e],{value:String(t),...r,...f||{}}))}}const y=new u.Group([...g,...m],{objectCaching:!1,...s});h.value.add(y),h.value.sendToBack(y)}}(),function(){const t=Object.values(z),e=[],o={},i=B.find((t=>"cervix"===t.key)),r=i.data.find((t=>3==+t.value));function l(t,e){const{key:n,range:o}=i||{},r=x(n,o,10),l=[0,e],s=[-e/t,0],a=[(Y-r-e)/t,Y-r],u=[H-S,t*(H-S)+e];let c=[],f=[];function p([n,o]){return Math.abs(o-t*n-e)<=1}function d([t,e]){const[n,o]=[...h([t,e])];return n>=S&&n<=H&&o>=r&&o<=Y}function h([t,e]){return[S+t,Y-e]}return p(l)&&d(l)&&(c=h(l)),p(s)&&d(s)&&(c=h(s)),p(a)&&d(a)&&(f=h(a)),p(u)&&d(u)&&(f=h(u)),[...c,...f]}t.forEach((t=>{if(!t.show)return;const{key:s}=t;switch(s){case"fetalPresentation":{const{range:o}=B.find((t=>t.key===s)),i=x(s,o,0);e.push(n([S,i,H,i],{...t}));break}case"alert":if(r){const{key:s,range:a}=i||{},u=216e5,c={time:d(new Date(new Date(r.time).getTime()+u),"yyyy-MM-dd HH:mm"),value:10},[f,p]=[w(r.time)-S,Y-x(s,a,r.value)],[h,g]=[w(c.time)-S,Y-x(s,a,c.value)],m=(g-p)/(h-f),v=p-f*m,y=l(m,v);y.length>0&&(e.push(n(y,{...t})),Object.assign(o,{k:m,b:v}))}break;case"handling":if(r){const{k:i,b:s}=o,a=144e5,u=l(i,s-(w(d(new Date(new Date(r.time).getTime()+a),"yyyy-MM-dd HH:mm"))-w(r.time))*i);u.length>0&&e.push(n(u,{...t}))}}})),h.value.add(...e)}(),J(),function(){function t(t,e){const n=B.findIndex((e=>e.key===t.key));return{renderItem:()=>t.title,origin:{title:t.title,unit:t.unit,dataIndex:n,key:t.key},pointer:e}}g.event.evented&&h.value.on("mouse:up",(e=>{if(3===e.button){const{x:n=0,y:o=0}=e.pointer||{};n>=S&&n<=H&&o>=G&&o<=Y&&(y.point={x:n,y:o},y.show=!0,e.target?(y.target=e.target,y.list=["删除节点"],h.value.forEachObject((t=>{t.origin&&t.left===e.target.left&&t.top===e.target.top&&y.list.push({renderItem:()=>t.origin.title,origin:{...t.origin},mode:"remove",pointer:e.pointer})}))):(y.target=null,y.list=["新增节点"],B.forEach((i=>{if(!j(n,"key",L).includes(i.key)){if(["cervix","fetalPresentation"].includes(i.key)&&o<q)return;y.list.push(t(i,e.pointer))}})),1===y.list.length&&(y.show=!1,C(),console.log("当前时间段内无可新增节点"))))}}))}(),function(){const t=V-$/2;function e(t,e){if(!t.length)return;let o=G;const i=[];t.forEach((t=>{const n=t.title.split("").join("\n"),s=O.findIndex((e=>e.key===t.key)),a=new u.Text(String(n),{...r,...t.titleStyle||{},originY:"top",left:e,top:o,lineHeight:1}),c=l(t.type,{left:e,top:o+a.height+3,...t.pointAttr,originY:"top",origin:{title:t.title,unit:t.unit,type:t.type,dataIndex:s,key:t.key,isMenu:!0},originLeft:e,originTop:o+a.height+3,...g.event});o+=a.height+c.height+15,function(t){function e(t){const{left:e,top:n}=t;return e>=S&&e<=H&&n>=G&&n<=Y}t.on("moving",(()=>{t.set("originY","center"),e(t)?(N(t),Q(t)):v.show=!1})),t.on("mouseup:before",(n=>{if(v.show=!1,0===n.e.button&&e(t))if(j(t.left,"key",L).includes(t.origin.key))C();else{const e={data:{time:b(t.left),value:T(t.origin.key,t.top)},...t.origin};m("add",e),K(e)}!function(t){t.setCoords().set({originY:"top",left:t.originLeft,top:t.originTop})}(t)}))}(c),i.push(a,c)})),n(i),h.value.add(...i)}function n(t){const e=t.at(-1),n=(Y-G)/2,o=(e.height+e.top-G)/2;t.forEach((t=>{const e=t.top+n-o;t.set({top:e,originTop:e})}))}e(M,I/2),e(X,t)}(),{clickMenu:function({item:t,target:e}){const n={...t.origin};"remove"===t.mode?(m("remove",n),K(n,"remove")):(Object.assign(n,{data:{time:b(t.pointer.x),value:T(t.origin.key,t.pointer.y)}}),m("add",n),K(n))}}}export{h as useBirthProcess};
@@ -36,6 +36,7 @@ export declare const defaultTextStyle: {
36
36
  originX: string;
37
37
  originY: string;
38
38
  lineHeight: number;
39
+ objectCaching: boolean;
39
40
  };
40
41
  export declare function drawLine(points: number[], style: Partial<ILineOptions>): fabric.Line;
41
42
  export declare function drawText([x, y]: [x: number, y: number], style: ITextOptions): fabric.Text;
@@ -1 +1 @@
1
- import{fabric as e}from"../utils/index.js";const t={evented:!1,selectable:!1},r={stroke:"#999",strokeWidth:1,...t},i={stroke:"#000",strokeWidth:1,strokeDashArray:[0,0],...t},n={fill:"transparent",stroke:"#999",strokeWidth:1,originX:"center",originY:"center",...t},o={fontFamily:"微软雅黑",fontSize:12,fill:"#000",centeredRotation:!0,originX:"center",originY:"center",lineHeight:1,...t};function c(t,r){return new e.Line(t,{...i,...r})}function s([t,r],i){return new e.Text(String(i.value),{...o,left:t,top:r,...i})}function l([r,i,n],o,l="down"){const a=c([r,i,r,n],{strokeWidth:1,stroke:o.fill}),u=s([r+.5,"up"===l?n-3:n+3],{value:"v",originX:"center",originY:"bottom",fontSize:16,angle:"up"===l?180:0,...o});return new e.Group([a,u],{...t,originX:"center",originY:"top"})}function a(r,i,c){const s=new e.Rect({...n,...r}),{value:l="标题",textAlign:a="center",verticalAlign:u="center"}=i,g=r.width/2,d=r.height/2,f=new e.Text(String(l),{...o,...i,..."left"==a||"right"==a?{originX:a,left:"left"==a?-g:g}:{},..."top"==u||"bottom"==u?{originY:u,top:"top"==u?-d:d}:{}});return new e.Group([s,f],{...t,...c})}function u(t="circle",r){const i={originX:"center",originY:"center",hasControls:!1,hasBorders:!1,hoverCursor:"pointer",...r},n=()=>new e.Circle({objectCaching:!1,strokeWidth:r.strokeWidth||1,stroke:r.stroke||"red",radius:r.radius||5,fill:"#fff"});switch(t){case"triangle":return new e.Triangle({width:20,height:20,strokeWidth:1,scale:1,...i});case"circle":return new e.Circle({objectCaching:!1,strokeWidth:1,radius:5,scale:1,...i});case"image":return new e.Image(r.element,{...i,scale:1});case"yemai":{const t=()=>{const t=2*((r.radius||5)+(r.strokeWidth||1)),i={stroke:r.strokeX||"blue",strokeWidth:r.strokeWidthX||1,originX:"center",originY:"center"},n=new e.Line([0,t/2,t,t/2],i),o=new e.Line([t/2,0,t/2,t],i);return new e.Group([n,o])};return new e.Group([n(),t()],{scale:1,...i})}case"koumai":{const t=(r.radius||5)+(r.strokeWidth||1),o=new e.Circle({objectCaching:!1,radius:r.radiusCircle||2,fill:r.fillCircle||"#000",originX:"center",originY:"center",left:t,top:t});return new e.Group([n(),o],{scale:1,...i})}default:return r&&Reflect.deleteProperty(r,"stroke"),new e.Text(String(t),{fontFamily:"微软雅黑",scale:1,fontSize:14,fill:"#000",...i})}}export{r as defaultBorderStyle,i as defaultLineStyle,n as defaultRectStyle,t as defaultStyle,o as defaultTextStyle,l as drawArrow,c as drawLine,u as drawPoint,s as drawText,a as drawTextGroup};
1
+ import{fabric as e}from"../utils/index.js";const t={evented:!1,selectable:!1},r={stroke:"#999",strokeWidth:1,...t},i={stroke:"#000",strokeWidth:1,strokeDashArray:[0,0],...t},n={fill:"transparent",stroke:"#999",strokeWidth:1,originX:"center",originY:"center",...t},o={fontFamily:"微软雅黑",fontSize:12,fill:"#000",centeredRotation:!0,originX:"center",originY:"center",lineHeight:1,objectCaching:!1,...t};function c(t,r){return new e.Line(t,{...i,...r})}function s([t,r],i){return new e.Text(String(i.value),{...o,left:t,top:r,...i})}function l([r,i,n],o,l="down"){const a=c([r,i,r,n],{strokeWidth:1,stroke:o.fill}),u=s([r+.5,"up"===l?n-3:n+3],{value:"v",originX:"center",originY:"bottom",fontSize:16,angle:"up"===l?180:0,...o});return new e.Group([a,u],{...t,originX:"center",originY:"top"})}function a(r,i,c){const s=new e.Rect({...n,...r}),{value:l="标题",textAlign:a="center",verticalAlign:u="center"}=i,g=r.width/2,h=r.height/2,d=new e.Text(String(l),{...o,...i,..."left"==a||"right"==a?{originX:a,left:"left"==a?-g:g}:{},..."top"==u||"bottom"==u?{originY:u,top:"top"==u?-h:h}:{}});return new e.Group([s,d],{objectCaching:!1,...t,...c})}function u(t="circle",r){const i={originX:"center",originY:"center",hasControls:!1,hasBorders:!1,hoverCursor:"pointer",objectCaching:!1,...r},n=()=>new e.Circle({objectCaching:!1,strokeWidth:r.strokeWidth||1,stroke:r.stroke||"red",radius:r.radius||5,fill:"#fff"});switch(t){case"triangle":return new e.Triangle({width:20,height:20,strokeWidth:1,scale:1,...i});case"circle":return new e.Circle({objectCaching:!1,strokeWidth:1,radius:5,scale:1,...i});case"image":return new e.Image(r.element,{...i,scale:1});case"yemai":{const t=()=>{const t=2*((r.radius||5)+(r.strokeWidth||1)),i={stroke:r.strokeX||"blue",strokeWidth:r.strokeWidthX||1,originX:"center",originY:"center"},n=new e.Line([0,t/2,t,t/2],i),o=new e.Line([t/2,0,t/2,t],i);return new e.Group([n,o])};return new e.Group([n(),t()],{scale:1,...i})}case"koumai":{const t=(r.radius||5)+(r.strokeWidth||1),o=new e.Circle({objectCaching:!1,radius:r.radiusCircle||2,fill:r.fillCircle||"#000",originX:"center",originY:"center",left:t,top:t});return new e.Group([n(),o],{scale:1,...i})}default:return r&&Reflect.deleteProperty(r,"stroke"),new e.Text(String(t),{fontFamily:"微软雅黑",scale:1,fontSize:14,fill:"#000",...i})}}export{r as defaultBorderStyle,i as defaultLineStyle,n as defaultRectStyle,t as defaultStyle,o as defaultTextStyle,l as drawArrow,c as drawLine,u as drawPoint,s as drawText,a as drawTextGroup};
@@ -1 +1 @@
1
- import{fabric as t}from"../utils/index.js";import{defaultBorderStyle as e,defaultTextStyle as i,defaultStyle as n,defaultRectStyle as o,drawPoint as l,drawTextGroup as r}from"./useDraw.js";import{getType as s,isOneLine as u}from"../utils/utils.js";function h(h,a,g,c,p,f,d,y,w,v,S,m){var Y,b;const{getEqualXTypes:x,repeatTip:X}=m,{originY:N,endY:T,originX:L,endX:M,xCellWidth:V,yCellHeight:k,left:E,vitalSignsOriginY:C,painOriginY:G,painHeight:H,iconsWidth:I,itemList:O,painIndex:R,right:W,canvasWidth:j,canvasHeight:A,getRightInfo:_}=a;function B(e,n,o,l){const{position:r}=n;return new t.Text(String(e),{...i,originX:"left"==r?"right":"right"==r?"left":"center",left:o,top:l,...n.style})}function J(t="center",e,i){let n=e+i/2,o=[n-4.5,n+4.5],l=[n-2.5,n+2.5],r=n;return"right"===t&&(n=e,o=[n,n+9],l=[n,n+5],r=o[1]),"left"===t&&(n=e+i,o=[n-9,n],l=[n-5,n],r=o[0]),{lineXMain:o,lineXSub:l,textLeft:r}}function $(l){var s;if(!(null==l?void 0:l.length))return;const{layout:u}=l[0];let a=I,g=L;"right"===u&&(a=M,g=M+(null!=(s=null==W?void 0:W.width)?s:0));const c=[],p=H&&"right"!==u?l.length-1:l.length,f=(g-a)/p,d=f+(g-a)%p;l.forEach(((l,s)=>{var u,g;if("pain"===l.type)return void function(n){const l=r({width:L-I,height:H,...o},{value:`${n.title}`,...i,...n.style||{}},{left:I,top:G.originY}),s=[];if(n.showScale||n.showNumber){const{lineXMain:i,textLeft:o}=J(n.position,I,L-I),l=n.list.length;n.list.forEach(((r,u)=>{let h=G.endY-u*k*n.spaceGridNumber;0===u&&(h=T-5);const a=0===u||u===l-1;if(!n.showNumber||a&&!n.showMaxMinNumber||s.push(B(r,n,o,h)),n.showScale&&0!==u){const[o,l]=i,r=new t.Line([o,h,l,h],{...e,...n.style});s.push(r)}}))}h.value.add(l,...s),l.sendToBack()}(l);const p=[];function y(i){const n=new t.Line(i,{...e,...l.style});p.push(n)}const w=0===s?d:f,v=0===s?a:d+a+(s-1)*f,S=s>0?new t.Line([v,C.originY,v,C.endY],{...e}):null;S&&p.push(S);const m=v+w/2,Y=l.spaceGridNumber||5;if(l.showScale||l.showNumber){const t=Y*k/5,e=l.position||"center",{lineXMain:i,lineXSub:n,textLeft:o}=J(l.position,v,w),r=null==(u=l.list)?void 0:u.length;null==(g=null==l?void 0:l.list)||g.forEach(((s,u)=>{const h=C.endY-u*k*Y,a=0===u||u===r-1;if(l.showNumber&&(!a||l.showMaxMinNumber)){const t=0==u?h-5:h,e=B(s,l,o,t),i=C.originY+e.height/2;t<i&&e.set({top:i}),p.push(e)}if(l.showScale&&u!==r-1)for(let o=0;o<5;o++)if(o>0||!l.showNumber||"center"!==e){const e=0==o?i[0]:n[0],l=0==o?i[1]:n[1],s=h-o*t;s>C.originY&&(y([e,s,l,s]),u==r-2&&4==o&&y([i[0],s-t,i[1],s-t]))}}))}let b=l.title||"";l.unit&&(b+="\n"+l.unit),b&&p.push(new t.Text(String(b),{...i,left:m,top:C.originY+k*Y/2,textAlign:"center",...l.style}));const x=new t.Group(p,n);c.push(x)})),c.push(new t.Rect({...o,width:"right"===u?g-a-1:g-a,height:"right"===u?T-N-1:T-N,left:a,top:N,originX:"left",originY:"top"}));const y=c.length>0?new t.Group([...c],{...n}):null;y&&h.value.add(y),y&&y.sendToBack()}function q(t){return t.left>=L&&t.left<M&&t.top>=N&&t.top<=T}I&&function(){const e=JSON.parse(JSON.stringify(O));let i=T;const o=I-E.icons.marginRight;e.reverse().forEach((e=>{i-=10;let r=e.title.replace(/(.{2})/g,"$1\n");r.endsWith("\n")&&(r=r.slice(0,r.length-1));const f=new t.Text(String(r),{...n,...e.titleStyle||{},originX:"right",originY:"bottom",left:o-(e.pointAttr.width||10)-5,top:i,lineHeight:1,fontSize:12}),d=l(e.type,{left:o,top:i-(f.height||30)/2-1,...e.pointAttr,originY:"center",originX:"right",origin:{title:e.title,unit:e.unit,type:s(e.bigType),_type:e.bigType,dataIndex:e.dataIndex,key:e.key,isMenu:!0},originLeft:o,originTop:i-(f.height||30)/2-1,...a.event});var m;i-=f.height||30,(m=d).on("moving",(()=>{m.set("originX","center"),function(t){if(t.left>=L&&t.left<=M){t.setCoords();const e="pain"===t.origin.type?G:C;t.top<e.originY&&t.set("top",e.originY),t.top>e.endY&&t.set("top",e.endY)}}(m),q(m)?c(m):p.show=!1})),m.on("mouseup:before",(t=>{if(p.show=!1,0===t.e.button&&q(m)){const t=x(m.left,"_type",V).includes(m.origin._type),e=v(m.left);if(!e||t)t&&e&&X();else{const t={data:{time:y(m.left),value:w(m.origin.type,m.top),...u(m.origin.type)?{key:m.origin.key}:{}},...m.origin};g("add",t),S(t)}}!function(t){t.setCoords().set({originX:"right",left:t.originLeft,top:t.originTop})}(m)})),h.value.add(f,d)}))}();const z=E.yScaleValue.filter((t=>"left"===t.layout&&"pain"!==t.type&&t.show));if((null==W?void 0:W.width)&&"left"===(null==(Y=null==W?void 0:W.yScaleValue)?void 0:Y.layout)&&(null==(b=null==W?void 0:W.yScaleValue)?void 0:b.show)&&z.push(_),R>0&&E.yScaleValue[R].show){const t=E.yScaleValue[R];0===R&&E.yScaleValue.length>1&&z.unshift(t),R==E.yScaleValue.length-1&&z.push(t)}return $(z),h.value.add(new t.Rect({left:I,top:0,width:j-I-1,height:A-1,fill:"transparent",...e})),{drawScaleValue:$}}export{h as useLeft};
1
+ import{fabric as t}from"../utils/index.js";import{defaultBorderStyle as e,defaultTextStyle as i,defaultStyle as n,defaultRectStyle as o,drawPoint as l,drawTextGroup as r}from"./useDraw.js";import{getType as s,isOneLine as h}from"../utils/utils.js";function u(u,a,g,c,p,f,d,y,w,v,S,m){var b,Y;const{getEqualXTypes:x,repeatTip:X}=m,{originY:N,endY:T,originX:L,endX:M,xCellWidth:V,yCellHeight:C,left:j,vitalSignsOriginY:k,painOriginY:E,painHeight:G,iconsWidth:H,itemList:I,painIndex:O,right:R,canvasWidth:W,canvasHeight:A,getRightInfo:_}=a;function B(e,n,o,l){const{position:r}=n;return new t.Text(String(e),{...i,originX:"left"==r?"right":"right"==r?"left":"center",left:o,top:l,...n.style})}function J(t="center",e,i){let n=e+i/2,o=[n-4.5,n+4.5],l=[n-2.5,n+2.5],r=n;return"right"===t&&(n=e,o=[n,n+9],l=[n,n+5],r=o[1]),"left"===t&&(n=e+i,o=[n-9,n],l=[n-5,n],r=o[0]),{lineXMain:o,lineXSub:l,textLeft:r}}function $(l){var s;if(!(null==l?void 0:l.length))return;const{layout:h}=l[0];let a=H,g=L;"right"===h&&(a=M,g=M+(null!=(s=null==R?void 0:R.width)?s:0));const c=[],p=G&&"right"!==h?l.length-1:l.length,f=(g-a)/p,d=f+(g-a)%p;l.forEach(((l,s)=>{var h,g;if("pain"===l.type)return void function(n){const l=r({width:L-H,height:G,...o},{value:`${n.title}`,...i,...n.style||{}},{left:H,top:E.originY}),s=[];if(n.showScale||n.showNumber){const{lineXMain:i,textLeft:o}=J(n.position,H,L-H),l=n.list.length;n.list.forEach(((r,h)=>{let u=E.endY-h*C*n.spaceGridNumber;0===h&&(u=T-5);const a=0===h||h===l-1;if(!n.showNumber||a&&!n.showMaxMinNumber||s.push(B(r,n,o,u)),n.showScale&&0!==h){const[o,l]=i,r=new t.Line([o,u,l,u],{...e,...n.style});s.push(r)}}))}u.value.add(l,...s),l.sendToBack()}(l);const p=[];function y(i){const n=new t.Line(i,{...e,...l.style});p.push(n)}const w=0===s?d:f,v=0===s?a:d+a+(s-1)*f,S=s>0?new t.Line([v,k.originY,v,k.endY],{...e}):null;S&&p.push(S);const m=v+w/2,b=l.spaceGridNumber||5;if(l.showScale||l.showNumber){const t=b*C/5,e=l.position||"center",{lineXMain:i,lineXSub:n,textLeft:o}=J(l.position,v,w),r=null==(h=l.list)?void 0:h.length;null==(g=null==l?void 0:l.list)||g.forEach(((s,h)=>{const u=k.endY-h*C*b,a=0===h||h===r-1;if(l.showNumber&&(!a||l.showMaxMinNumber)){const t=0==h?u-5:u,e=B(s,l,o,t),i=k.originY+e.height/2;t<i&&e.set({top:i}),p.push(e)}if(l.showScale&&h!==r-1)for(let o=0;o<5;o++)if(o>0||!l.showNumber||"center"!==e){const e=0==o?i[0]:n[0],l=0==o?i[1]:n[1],s=u-o*t;s>k.originY&&(y([e,s,l,s]),h==r-2&&4==o&&y([i[0],s-t,i[1],s-t]))}}))}let Y=l.title||"";l.unit&&(Y+="\n"+l.unit),Y&&p.push(new t.Text(String(Y),{...i,left:m,top:k.originY+C*b/2,textAlign:"center",...l.style}));const x=new t.Group(p,{...n,objectCaching:!1});c.push(x)})),c.push(new t.Rect({...o,width:"right"===h?g-a-1:g-a,height:"right"===h?T-N-1:T-N,left:a,top:N,originX:"left",originY:"top"}));const y=c.length>0?new t.Group([...c],{...n,objectCaching:!1}):null;y&&u.value.add(y),y&&y.sendToBack()}function q(t){return t.left>=L&&t.left<M&&t.top>=N&&t.top<=T}H&&function(){const e=JSON.parse(JSON.stringify(I));let i=T;const o=H-j.icons.marginRight;e.reverse().forEach((e=>{i-=10;let r=e.title.replace(/(.{2})/g,"$1\n");r.endsWith("\n")&&(r=r.slice(0,r.length-1));const f=new t.Text(String(r),{...n,objectCaching:!1,...e.titleStyle||{},originX:"right",originY:"bottom",left:o-(e.pointAttr.width||10)-5,top:i,lineHeight:1,fontSize:12}),d=l(e.type,{left:o,top:i-(f.height||30)/2-1,...e.pointAttr,originY:"center",originX:"right",origin:{title:e.title,unit:e.unit,type:s(e.bigType),_type:e.bigType,dataIndex:e.dataIndex,key:e.key,isMenu:!0},originLeft:o,originTop:i-(f.height||30)/2-1,...a.event});var m;i-=f.height||30,(m=d).on("moving",(()=>{m.set("originX","center"),function(t){if(t.left>=L&&t.left<=M){t.setCoords();const e="pain"===t.origin.type?E:k;t.top<e.originY&&t.set("top",e.originY),t.top>e.endY&&t.set("top",e.endY)}}(m),q(m)?c(m):p.show=!1})),m.on("mouseup:before",(t=>{if(p.show=!1,0===t.e.button&&q(m)){const t=x(m.left,"_type",V).includes(m.origin._type),e=v(m.left);if(!e||t)t&&e&&X();else{const t={data:{time:y(m.left),value:w(m.origin.type,m.top),...h(m.origin.type)?{key:m.origin.key}:{}},...m.origin};g("add",t),S(t)}}!function(t){t.setCoords().set({originX:"right",left:t.originLeft,top:t.originTop})}(m)})),u.value.add(f,d)}))}();const z=j.yScaleValue.filter((t=>"left"===t.layout&&"pain"!==t.type&&t.show));if((null==R?void 0:R.width)&&"left"===(null==(b=null==R?void 0:R.yScaleValue)?void 0:b.layout)&&(null==(Y=null==R?void 0:R.yScaleValue)?void 0:Y.show)&&z.push(_),O>0&&j.yScaleValue[O].show){const t=j.yScaleValue[O];0===O&&j.yScaleValue.length>1&&z.unshift(t),O==j.yScaleValue.length-1&&z.push(t)}return $(z),u.value.add(new t.Rect({left:H,top:0,width:W-H-1,height:A-1,fill:"transparent",...e})),{drawScaleValue:$}}export{u as useLeft};
@@ -1 +1 @@
1
- import{fabric as t}from"../utils/index.js";import{defaultStyle as e}from"./useDraw.js";function n(n,l,i){const{other:o,vitalSignsOriginY:r,xCellWidth:s,yCellHeight:a}=l;let u=0;function f(n,l,i){const o=[];String(n.value).split("").forEach(((l,i)=>{const r=new t.Text(l,{left:0,top:a*i,originX:"center",...e,...n.style||{}});u=(a-(r.height||0))/2,o.push(r)}));const r={originX:"center",left:l,top:i+u,baseTop:(n.baseTop||0)*a,trueLeft:l,trueHeight:o.length*a};return new t.Group(o,r)}!function(){if(!(null==o?void 0:o.list))return!1;const l=[],u=[];o.list.forEach(((t,e)=>{const n=0===e?"vertical":t.align||"vertical",l=i(t.time,!0),o=u.find((t=>t.left==l));if(o)o[n].push(t);else{const e={left:l,vertical:[],horizontal:[]};e[n].push(t),u.push(e)}})),u.forEach((t=>{let e=r.originY,n=t.left;t.vertical.forEach(((i,o)=>{var u,h;const c=(i.baseTop||0)*a,g=(null==(u=l.at(-1))?void 0:u.left)||0;0===o&&t.left<=g&&(n=g+s);if(l.filter((t=>t.trueLeft===n)).length){const t=String(i.value).length*a,o=(null==(h=l.at(-1))?void 0:h.trueHeight)||0;e+=o,e+t+c>r.endY&&(e=r.originY,n+=s)}e+=c,String(i.value).length&&l.push(f(i,n,e))})),t.horizontal.forEach(((e,i)=>{var o;const u=r.originY+(e.baseTop||0)*a,h=(null==(o=l.at(-1))?void 0:o.left)||0;t.left<=h&&(n=h+s),String(e.value).length&&l.push(f(e,n,u))}))}));const h=l.length>0?new t.Group([...l],{...e}):null;h&&n.value.add(h)}()}export{n as useOther};
1
+ import{fabric as t}from"../utils/index.js";import{defaultStyle as e}from"./useDraw.js";function n(n,i,l){const{other:o,vitalSignsOriginY:r,xCellWidth:a,yCellHeight:c}=i;let s=0;function h(n,i,l){const o=[];String(n.value).split("").forEach(((i,l)=>{const r=new t.Text(i,{left:0,top:c*l,originX:"center",...e,objectCaching:!1,...n.style||{}});s=(c-(r.height||0))/2,o.push(r)}));const r={originX:"center",left:i,top:l+s,baseTop:(n.baseTop||0)*c,trueLeft:i,trueHeight:o.length*c,objectCaching:!1};return new t.Group(o,r)}!function(){if(!(null==o?void 0:o.list))return!1;const i=[],s=[];o.list.forEach(((t,e)=>{const n=0===e?"vertical":t.align||"vertical",i=l(t.time,!0),o=s.find((t=>t.left==i));if(o)o[n].push(t);else{const e={left:i,vertical:[],horizontal:[]};e[n].push(t),s.push(e)}})),s.forEach((t=>{let e=r.originY,n=t.left;t.vertical.forEach(((l,o)=>{var s,u;const f=(l.baseTop||0)*c,g=(null==(s=i.at(-1))?void 0:s.left)||0;0===o&&t.left<=g&&(n=g+a);if(i.filter((t=>t.trueLeft===n)).length){const t=String(l.value).length*c,o=(null==(u=i.at(-1))?void 0:u.trueHeight)||0;e+=o,e+t+f>r.endY&&(e=r.originY,n+=a)}e+=f,String(l.value).length&&i.push(h(l,n,e))})),t.horizontal.forEach(((e,l)=>{var o;const s=r.originY+(e.baseTop||0)*c,u=(null==(o=i.at(-1))?void 0:o.left)||0;t.left<=u&&(n=u+a),String(e.value).length&&i.push(h(e,n,s))}))}));const u=i.length>0?new t.Group([...i],{...e,objectCaching:!1}):null;u&&n.value.add(u)}()}export{n as useOther};
@@ -1 +1 @@
1
- import{fabric as t}from"../utils/index.js";import{defaultBorderStyle as e,defaultStyle as l,drawTextGroup as i,defaultTextStyle as o,defaultRectStyle as s}from"./useDraw.js";function n(n,u){const{grid:h,originX:a,xCellWidth:c,gridXNumber:d,top:r,xScalevalueHeight:f,iconsWidth:p,topList:g,endXLimit:v,canvasWidth:y}=u;!function(){const w=[];v&&w.push(new t.Line([v,0,y,0],e));let S=0;g.forEach(((t,e)=>{e>0&&(S+=u[`${g[e-1].key}Height`]),"xScalevalue"==t.key?(function(t,e,l){if(!r.dayHeight)return!1;const s=r.dayHeight,n=c*h.subSecondXCell,u=(d-h.surplusXCell)/h.subSecondXCell;for(let h=0;h<u;h++){const u=a+h*n,c=i({width:n,height:s},{value:h%2==0?"上午":"下午",...o,...t.style||{}},{left:u,top:l});e.push(c)}}(t,w,S),function(t,e,l){var n;const u=r.xScalevalue.show&&null!=(n=r.dayHeight)?n:0,d=f-u,g=i({width:a-p,height:f,...s},{value:r.xScalevalue.title,...o,...t.style||{},...t.titleStyle||{}},{left:p,top:l});e.push(g);const v=[];for(let t=0;t<h.mainXCell;t++)v.push(r.xScalevalue.list);v.flat().forEach(((s,n)=>{const h=a+n*c,r=i({width:c,height:d},{value:s.value,...o,...t.style||{},...s.style||{}},{left:h,top:l+u});e.push(r)}))}(t,w,S)):u[`${t.key}Height`]&&function(t,e,l){const n=u[`${t.key}Height`],d=i({width:a-p,height:n,...s},{value:t.title,...o,...(null==t?void 0:t.style)||{},...t.titleStyle||{}},{left:p,top:l});e.push(d);const r=c*h.subXCell;t.list.forEach(((s,u)=>{const h=a+u*r,c=i({width:r,height:n},{value:s,...o,...(null==t?void 0:t.style)||{}},{left:h,top:l});e.push(c)}))}(t,w,S)}));const x=w.length>0?new t.Group([...w],{...l}):null;x&&x.sendToBack(),x&&n.value.add(x)}()}export{n as useTop};
1
+ import{fabric as t}from"../utils/index.js";import{defaultBorderStyle as e,defaultStyle as l,drawTextGroup as i,defaultTextStyle as o,defaultRectStyle as n}from"./useDraw.js";function s(s,h){const{grid:u,originX:a,xCellWidth:c,gridXNumber:d,top:r,xScalevalueHeight:f,iconsWidth:p,topList:g,endXLimit:v,canvasWidth:y}=h;!function(){const w=[];v&&w.push(new t.Line([v,0,y,0],e));let S=0;g.forEach(((t,e)=>{e>0&&(S+=h[`${g[e-1].key}Height`]),"xScalevalue"==t.key?(function(t,e,l){if(!r.dayHeight)return!1;const n=r.dayHeight,s=c*u.subSecondXCell,h=(d-u.surplusXCell)/u.subSecondXCell;for(let u=0;u<h;u++){const h=a+u*s,c=i({width:s,height:n},{value:u%2==0?"上午":"下午",...o,...t.style||{}},{left:h,top:l});e.push(c)}}(t,w,S),function(t,e,l){var s;const h=r.xScalevalue.show&&null!=(s=r.dayHeight)?s:0,d=f-h,g=i({width:a-p,height:f,...n},{value:r.xScalevalue.title,...o,...t.style||{},...t.titleStyle||{}},{left:p,top:l});e.push(g);const v=[];for(let t=0;t<u.mainXCell;t++)v.push(r.xScalevalue.list);v.flat().forEach(((n,s)=>{const u=a+s*c,r=i({width:c,height:d},{value:n.value,...o,...t.style||{},...n.style||{}},{left:u,top:l+h});e.push(r)}))}(t,w,S)):h[`${t.key}Height`]&&function(t,e,l){const s=h[`${t.key}Height`],d=i({width:a-p,height:s,...n},{value:t.title,...o,...(null==t?void 0:t.style)||{},...t.titleStyle||{}},{left:p,top:l});e.push(d);const r=c*u.subXCell;t.list.forEach(((n,h)=>{const u=a+h*r,c=i({width:r,height:s},{value:n,...o,...(null==t?void 0:t.style)||{}},{left:u,top:l});e.push(c)}))}(t,w,S)}));const x=w.length>0?new t.Group([...w],{...l,objectCaching:!1}):null;x&&x.sendToBack(),x&&s.value.add(x)}()}export{s as useTop};