cnhis-design-vue 3.1.41-beta.3 → 3.1.41-beta.31

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 (226) hide show
  1. package/README.md +87 -87
  2. package/es/components/button-print/index.d.ts +3 -2
  3. package/es/components/button-print/src/ButtonPrint.vue.d.ts +3 -2
  4. package/es/components/button-print/src/ButtonPrint.vue2.js +1 -1
  5. package/es/components/button-print/src/api.d.ts +3 -0
  6. package/es/components/button-print/src/api.js +1 -0
  7. package/es/components/button-print/src/utils/print.d.ts +1 -1
  8. package/es/components/button-print/src/utils/print.js +1 -1
  9. package/es/components/date-picker/index.d.ts +20 -0
  10. package/es/components/date-picker/index.js +1 -0
  11. package/es/components/date-picker/src/DatePicker.vue.d.ts +20 -0
  12. package/es/components/date-picker/src/DatePicker.vue.js +1 -0
  13. package/es/components/fabric-chart/src/hooks/useBirthProcess.js +1 -1
  14. package/es/components/fabric-chart/src/hooks/useBirthProcessChart.js +1 -1
  15. package/es/components/fabric-chart/src/hooks/useDraw.d.ts +1 -0
  16. package/es/components/fabric-chart/src/hooks/useDraw.js +1 -1
  17. package/es/components/fabric-chart/src/hooks/useLeft.js +1 -1
  18. package/es/components/fabric-chart/src/hooks/useOther.js +1 -1
  19. package/es/components/fabric-chart/src/hooks/useTop.js +1 -1
  20. package/es/components/field-set/index.d.ts +8 -0
  21. package/es/components/field-set/src/FieldSet.vue.d.ts +5 -0
  22. package/es/components/field-set/src/FieldSet.vue.js +1 -1
  23. package/es/components/field-set/style/index.css +1 -1
  24. package/es/components/form-config/index.d.ts +6762 -46
  25. package/es/components/form-config/src/FormConfig.vue.d.ts +6903 -186
  26. package/es/components/form-config/src/FormConfig.vue.js +1 -1
  27. package/es/components/form-config/src/components/FormConfigCreator.vue.d.ts +2 -2
  28. package/es/components/form-config/src/components/FormConfigCreator.vue.js +1 -1
  29. package/es/components/form-config/src/components/FormConfigDragDisplay.vue.d.ts +4 -4
  30. package/es/components/form-config/src/components/FormConfigDragDisplay.vue.js +1 -1
  31. package/es/components/form-config/src/components/FormConfigEdit.vue.d.ts +3415 -60
  32. package/es/components/form-config/src/components/FormConfigEdit.vue.js +1 -1
  33. package/es/components/form-config/src/components/FormConfigMaterialItem.d.ts +2 -2
  34. package/es/components/form-config/src/components/FormConfigMaterialItem.js +1 -1
  35. package/es/components/form-config/src/components/renderer/CloseButton.vue.d.ts +3 -3
  36. package/es/components/form-config/src/components/renderer/CloseButton.vue.js +1 -1
  37. package/es/components/form-config/src/components/renderer/ComplexNode.vue.d.ts +10 -10
  38. package/es/components/form-config/src/components/renderer/ComplexNode.vue.js +1 -1
  39. package/es/components/form-config/src/components/renderer/DefaultNode.vue.d.ts +6 -6
  40. package/es/components/form-config/src/components/renderer/DefaultNode.vue.js +1 -1
  41. package/es/components/form-config/src/hooks/useConfigurationField.d.ts +2 -3
  42. package/es/components/form-config/src/hooks/useConfigurationField.js +1 -1
  43. package/es/components/form-config/src/hooks/useDataNormalize.d.ts +4 -2
  44. package/es/components/form-config/src/hooks/useDataNormalize.js +1 -1
  45. package/es/components/form-config/src/hooks/usePresetRenderer.d.ts +1 -1
  46. package/es/components/form-config/src/hooks/useSortalbeConfig.js +1 -1
  47. package/es/components/form-config/src/types/index.d.ts +9 -2
  48. package/es/components/form-config/src/utils/index.d.ts +4 -1
  49. package/es/components/form-config/src/utils/index.js +1 -1
  50. package/es/components/form-config/style/index.css +1 -1
  51. package/es/components/form-render/index.d.ts +2 -2
  52. package/es/components/form-render/index.js +1 -1
  53. package/es/components/form-render/src/FormRender.vue.d.ts +1 -1
  54. package/es/components/form-render/src/FormRender.vue.js +1 -1
  55. package/es/components/form-render/src/FormRenderWrapper.vue.d.ts +22 -21
  56. package/es/components/form-render/src/FormRenderWrapper.vue.js +1 -1
  57. package/es/components/form-render/src/components/renderer/formItem.js +1 -1
  58. package/es/components/form-render/src/components/renderer/radio_checkbox.js +1 -1
  59. package/es/components/form-render/src/constants/index.d.ts +0 -12
  60. package/es/components/form-render/src/constants/index.js +1 -1
  61. package/es/components/form-render/src/hooks/useComplexOptions.d.ts +2 -6
  62. package/es/components/form-render/src/hooks/useComplexOptions.js +1 -1
  63. package/es/components/form-render/src/hooks/useFieldListAdaptor.js +1 -1
  64. package/es/components/form-render/src/hooks/useFormEvent.d.ts +1 -1
  65. package/es/components/form-render/src/hooks/useFormEvent.js +1 -1
  66. package/es/components/form-render/src/hooks/useFormField.d.ts +1 -0
  67. package/es/components/form-render/src/hooks/useFormField.js +1 -1
  68. package/es/components/form-render/src/hooks/useFormValidator.js +1 -1
  69. package/es/components/form-render/src/hooks/useLowCodeReactions.js +1 -1
  70. package/es/components/form-render/src/types/fieldItem.d.ts +4 -0
  71. package/es/components/form-render/src/types/index.d.ts +5 -3
  72. package/es/components/form-render/src/utils/dom.d.ts +2 -1
  73. package/es/components/form-render/src/utils/dom.js +1 -1
  74. package/es/components/iho-table/index.d.ts +5 -5
  75. package/es/components/iho-table/index.js +1 -1
  76. package/es/components/iho-table/src/IhoTable.vue.d.ts +5 -5
  77. package/es/components/iho-table/src/IhoTable.vue.js +1 -1
  78. package/es/components/iho-table/src/constants/index.d.ts +2 -2
  79. package/es/components/iho-table/src/hooks/tapHooks/useEventHooks.d.ts +1 -1
  80. package/es/components/iho-table/src/plugins/defaultConfigPlugin/index.js +1 -1
  81. package/es/components/iho-table/src/plugins/{filterPlugin → filterRenderPlugin}/filter.vue.d.ts +15 -74
  82. package/es/components/iho-table/src/plugins/filterRenderPlugin/filter.vue.js +1 -0
  83. package/es/components/iho-table/src/plugins/filterRenderPlugin/index.d.ts +1 -0
  84. package/es/components/iho-table/src/plugins/filterRenderPlugin/index.js +1 -0
  85. package/es/components/iho-table/src/plugins/index.js +1 -1
  86. package/es/components/iho-table/src/plugins/rendererPlugins/editableWidgets/dateRendererPlugin/editDate.vue.d.ts +20 -7
  87. package/es/components/iho-table/src/plugins/rendererPlugins/editableWidgets/dateRendererPlugin/editDate.vue.js +1 -1
  88. package/es/components/iho-table/src/plugins/rendererPlugins/editableWidgets/timeRendererPlugin/editTime.vue.d.ts +102 -0
  89. package/es/components/iho-table/src/plugins/rendererPlugins/editableWidgets/timeRendererPlugin/editTime.vue.js +1 -0
  90. package/es/components/iho-table/src/plugins/rendererPlugins/editableWidgets/{timeRendererPlugin.d.ts → timeRendererPlugin/index.d.ts} +1 -1
  91. package/es/components/iho-table/src/plugins/rendererPlugins/editableWidgets/timeRendererPlugin/index.js +1 -0
  92. package/es/components/iho-table/src/plugins/rendererPlugins/widgets/colorRendererPlugin.js +1 -1
  93. package/es/components/iho-table/src/plugins/rendererPlugins/widgets/defaultRendererPlugin.js +1 -1
  94. package/es/components/iho-table/src/plugins/rendererPlugins/widgets/labelRendererPlugin.js +1 -1
  95. package/es/components/iho-table/src/plugins/rendererPlugins/widgets/pictureRendererPlugin.js +1 -1
  96. package/es/components/iho-table/src/plugins/virtualTreePlugin/index.js +1 -1
  97. package/es/components/iho-table/src/types/index.d.ts +20 -11
  98. package/es/components/iho-table/src/utils/index.js +1 -1
  99. package/es/components/iho-table/style/index.css +1 -1
  100. package/es/components/index.css +1 -1
  101. package/es/components/index.d.ts +3 -1
  102. package/es/components/index.js +1 -1
  103. package/es/components/info-header/index.d.ts +289 -155
  104. package/es/components/info-header/src/InfoHeader.vue.d.ts +293 -160
  105. package/es/components/info-header/src/InfoHeader.vue.js +1 -1
  106. package/es/components/info-header/src/components/index.d.ts +3 -0
  107. package/es/components/info-header/src/components/index.js +1 -0
  108. package/es/components/info-header/src/components/infoDescription/HiddenContent.vue.js +1 -0
  109. package/es/components/info-header/src/components/infoDescription/InfoEllipsis.vue.js +1 -0
  110. package/es/components/info-header/src/components/infoDescription/index.vue.d.ts +266 -0
  111. package/es/components/info-header/src/components/infoDescription/index.vue.js +1 -0
  112. package/es/components/info-header/src/components/patientInfo/index.vue.d.ts +38 -0
  113. package/es/components/info-header/src/components/patientInfo/index.vue.js +1 -0
  114. package/es/components/info-header/src/types/index.d.ts +29 -0
  115. package/es/components/recommend-search/index.d.ts +10 -10
  116. package/es/components/recommend-search/src/RecommendSearch.vue.d.ts +10 -10
  117. package/es/components/recommend-search/src/components/BaseSearch.vue.d.ts +2 -2
  118. package/es/components/recommend-search/src/components/RecommendInput.vue.d.ts +4 -4
  119. package/es/components/recommend-search/src/components/RecommendSelect.vue.d.ts +4 -4
  120. package/es/components/scale-view/index.d.ts +1 -2
  121. package/es/components/scale-view/src/ScaleView.vue.d.ts +1 -5
  122. package/es/components/scale-view/src/ScaleView.vue.js +1 -1
  123. package/es/components/scale-view/src/components/formitem/text-over-tooltip/TextOverTooltip.vue.d.ts +1 -1
  124. package/es/components/scale-view/src/hooks/scaleview-computed.d.ts +1 -0
  125. package/es/components/scale-view/src/hooks/scaleview-computed.js +1 -1
  126. package/es/components/scale-view/src/hooks/scaleview-submit.js +1 -1
  127. package/es/components/scale-view/src/utils/judge-types.js +1 -1
  128. package/es/components/scale-view/style/index.css +1 -1
  129. package/es/components/shortcut-setter/index.d.ts +4 -3
  130. package/es/components/shortcut-setter/src/ShortcutSetter.vue.d.ts +4 -3
  131. package/es/components/steps-wheel/index.d.ts +1 -1
  132. package/es/components/steps-wheel/src/StepsWheel.vue.d.ts +1 -1
  133. package/es/components/table-filter/index.d.ts +963 -8064
  134. package/es/components/table-filter/index.js +1 -1
  135. package/es/components/table-filter/src/base-search-com/BaseSearch.vue.d.ts +57 -3397
  136. package/es/components/table-filter/src/base-search-com/BaseSearch.vue.js +1 -1
  137. package/es/components/table-filter/src/classification/Classification-com.vue.d.ts +404 -2969
  138. package/es/components/table-filter/src/classification/Classification-com.vue.js +1 -1
  139. package/es/components/table-filter/src/components/classify-filter/ValueCfg.vue.d.ts +2 -2
  140. package/es/components/table-filter/src/components/classify-filter/hooks/useFilterConditions.d.ts +1 -42
  141. package/es/components/table-filter/src/components/classify-filter/hooks/useFilterConditions.js +1 -1
  142. package/es/components/table-filter/src/components/classify-filter/index.vue.d.ts +20 -49
  143. package/es/components/table-filter/src/components/classify-filter/index.vue.js +1 -1
  144. package/es/components/table-filter/src/components/render-widget/index.vue.d.ts +2 -1
  145. package/es/components/table-filter/src/components/render-widget/index.vue.js +1 -1
  146. package/es/components/table-filter/src/components/render-widget/widgetCfgMaps.js +1 -1
  147. package/es/components/table-filter/src/components/search-filter/index.vue.d.ts +372 -0
  148. package/es/components/table-filter/src/components/search-filter/index.vue.js +1 -0
  149. package/es/components/table-filter/src/components/set-classification/index.vue.d.ts +717 -0
  150. package/es/components/table-filter/src/components/set-classification/index.vue.js +1 -0
  151. package/es/components/table-filter/src/components/table-modal/{TableModal.vue.d.ts → index.vue.d.ts} +0 -42
  152. package/es/components/table-filter/src/components/table-modal/index.vue.js +1 -0
  153. package/es/components/table-filter/src/hooks/export.js +1 -1
  154. package/es/components/table-filter/src/hooks/useAdvanced.d.ts +2 -2
  155. package/es/components/table-filter/src/hooks/useAdvanced.js +1 -1
  156. package/es/components/table-filter/src/hooks/useMixins.d.ts +1 -1
  157. package/es/components/table-filter/src/hooks/useMixins.js +1 -1
  158. package/es/components/table-filter/src/quick-search/QuickSearch.vue.d.ts +50 -1291
  159. package/es/components/table-filter/src/quick-search/QuickSearch.vue.js +1 -1
  160. package/es/components/table-filter/src/types/index.d.ts +10 -176
  161. package/es/components/table-filter/style/iconfont.ttf +0 -0
  162. package/es/components/table-filter/style/index.css +1 -1
  163. package/es/components/time-picker/index.d.ts +18 -0
  164. package/es/components/time-picker/index.js +1 -0
  165. package/es/components/time-picker/src/TimePicker.vue.d.ts +18 -0
  166. package/es/components/time-picker/src/TimePicker.vue.js +1 -0
  167. package/es/env.d.ts +24 -24
  168. package/es/shared/components/TextOverTooltip/TextOverTooltip.vue.d.ts +1 -1
  169. package/es/shared/components/no-data/NoData.vue.d.ts +5 -0
  170. package/es/shared/components/no-data/NoData.vue.js +1 -1
  171. package/es/shared/utils/index.d.ts +16 -0
  172. package/es/shared/utils/index.js +1 -1
  173. package/package.json +2 -2
  174. package/es/components/bpmn-workflow/src/BpmnWorkflow.d.ts +0 -0
  175. package/es/components/bpmn-workflow/types/BpmnViewer.d.ts +0 -1
  176. package/es/components/bpmn-workflow/types/ModelingModule.d.ts +0 -1
  177. package/es/components/bpmn-workflow/types/MoveCanvasModule.d.ts +0 -1
  178. package/es/components/callback/src/components/form.d.ts +0 -0
  179. package/es/components/callback/src/components/page.d.ts +0 -0
  180. package/es/components/callback/src/components/table.d.ts +0 -0
  181. package/es/components/callback/src/types/index.d.ts +0 -0
  182. package/es/components/fabric-chart/src/utils/index.d.ts +0 -6823
  183. package/es/components/iho-table/src/plugins/filterPlugin/filter.vue.js +0 -1
  184. package/es/components/iho-table/src/plugins/filterPlugin/index.d.ts +0 -1
  185. package/es/components/iho-table/src/plugins/filterPlugin/index.js +0 -1
  186. package/es/components/iho-table/src/plugins/filterPlugin/types.d.ts +0 -7
  187. package/es/components/iho-table/src/plugins/filterPlugin/types.js +0 -1
  188. package/es/components/iho-table/src/plugins/rendererPlugins/editableWidgets/timeRendererPlugin.js +0 -1
  189. package/es/components/info-header/src/HiddenContent.vue.js +0 -1
  190. package/es/components/info-header/src/InfoEllipsis.vue.js +0 -1
  191. package/es/components/table-filter/src/classification/search-class-name.vue.d.ts +0 -90
  192. package/es/components/table-filter/src/classification/search-class-name.vue.js +0 -1
  193. package/es/components/table-filter/src/classification/search-professional-model.vue.d.ts +0 -1472
  194. package/es/components/table-filter/src/classification/search-professional-model.vue.js +0 -1
  195. package/es/components/table-filter/src/components/age-com/index.vue.d.ts +0 -119
  196. package/es/components/table-filter/src/components/age-com/index.vue.js +0 -1
  197. package/es/components/table-filter/src/components/button-group/ButtonGroup.vue.d.ts +0 -199
  198. package/es/components/table-filter/src/components/button-group/ButtonGroup.vue.js +0 -1
  199. package/es/components/table-filter/src/components/button-icon/getBtnIcon.d.ts +0 -2
  200. package/es/components/table-filter/src/components/button-icon/getBtnIcon.js +0 -1
  201. package/es/components/table-filter/src/components/c-tree-select/tree-select.vue.d.ts +0 -90
  202. package/es/components/table-filter/src/components/c-tree-select/tree-select.vue.js +0 -1
  203. package/es/components/table-filter/src/components/multi-select/multi-select.vue.d.ts +0 -113
  204. package/es/components/table-filter/src/components/multi-select/multi-select.vue.js +0 -1
  205. package/es/components/table-filter/src/components/out-quick-search/out-quick-search.vue.d.ts +0 -266
  206. package/es/components/table-filter/src/components/out-quick-search/out-quick-search.vue.js +0 -1
  207. package/es/components/table-filter/src/components/range-age/index.vue.d.ts +0 -248
  208. package/es/components/table-filter/src/components/range-age/index.vue.js +0 -1
  209. package/es/components/table-filter/src/components/search-condition/SearchCondition.vue.d.ts +0 -789
  210. package/es/components/table-filter/src/components/search-condition/SearchCondition.vue.js +0 -1
  211. package/es/components/table-filter/src/components/search-condition/fieldTypeList.d.ts +0 -18
  212. package/es/components/table-filter/src/components/search-condition/fieldTypeList.js +0 -1
  213. package/es/components/table-filter/src/components/search-filter/SearchFilter.vue.d.ts +0 -1244
  214. package/es/components/table-filter/src/components/search-filter/SearchFilter.vue.js +0 -1
  215. package/es/components/table-filter/src/components/search-modal/set-classification.vue.d.ts +0 -1651
  216. package/es/components/table-filter/src/components/search-modal/set-classification.vue.js +0 -1
  217. package/es/components/table-filter/src/components/table-modal/TableModal.vue.js +0 -1
  218. package/es/components/table-filter/src/const/dataOptions.d.ts +0 -36
  219. package/es/components/table-filter/src/const/dataOptions.js +0 -1
  220. package/es/components/table-filter/src/directive/preventReClick.d.ts +0 -4
  221. package/es/components/table-filter/src/directive/preventReClick.js +0 -1
  222. package/es/shared/components/VueDraggable/src/vuedraggable.d.ts +0 -86
  223. package/es/shared/utils/tapable/index.d.ts +0 -139
  224. package/es/components/info-header/src/{HiddenContent.vue.d.ts → components/infoDescription/HiddenContent.vue.d.ts} +2 -2
  225. package/es/components/info-header/src/{InfoEllipsis.vue.d.ts → components/infoDescription/InfoEllipsis.vue.d.ts} +1 -1
  226. /package/es/components/{callback → info-header}/src/types/index.js +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
+ ```
@@ -144,6 +144,7 @@ declare const ButtonPrint: SFCWithInstall<import("vue").DefineComponent<{
144
144
  onClickoutside?: ((...args: any[]) => any) | undefined;
145
145
  }>>;
146
146
  emit: (event: "success" | "error" | "clickoutside", ...args: any[]) => void;
147
+ defaultFormatInfo: import("../../../es/shared/types").AnyObject;
147
148
  state: {
148
149
  spinning: boolean;
149
150
  visible: boolean;
@@ -173,10 +174,10 @@ declare const ButtonPrint: SFCWithInstall<import("vue").DefineComponent<{
173
174
  handleClickPreview: () => Promise<void>;
174
175
  handleClickPdf: () => Promise<void>;
175
176
  handleClickEdit: () => void;
176
- handleSelect: (key: string) => void;
177
+ handleSelect: (key: string) => Promise<void>;
177
178
  handleClickOutside: () => void;
178
179
  instantiatePrintSDK: () => false | undefined;
179
- getDefaultFormatId: (list: any[], key: string | number) => any;
180
+ getDefaultFormatId: (list: any[], key: string | number) => Promise<any>;
180
181
  setOptions: () => void;
181
182
  formatFormatList: (list: any[]) => any;
182
183
  requestError: () => boolean;
@@ -152,6 +152,7 @@ declare const _default: import("vue").DefineComponent<{
152
152
  onClickoutside?: ((...args: any[]) => any) | undefined;
153
153
  }>>;
154
154
  emit: (event: "success" | "error" | "clickoutside", ...args: any[]) => void;
155
+ defaultFormatInfo: AnyObject;
155
156
  state: {
156
157
  spinning: boolean;
157
158
  visible: boolean;
@@ -181,10 +182,10 @@ declare const _default: import("vue").DefineComponent<{
181
182
  handleClickPreview: () => Promise<void>;
182
183
  handleClickPdf: () => Promise<void>;
183
184
  handleClickEdit: () => void;
184
- handleSelect: (key: string) => void;
185
+ handleSelect: (key: string) => Promise<void>;
185
186
  handleClickOutside: () => void;
186
187
  instantiatePrintSDK: () => false | undefined;
187
- getDefaultFormatId: (list: any[], key: string | number) => any;
188
+ getDefaultFormatId: (list: any[], key: string | number) => Promise<any>;
188
189
  setOptions: () => void;
189
190
  formatFormatList: (list: any[]) => any;
190
191
  requestError: () => boolean;
@@ -1 +1 @@
1
- import{defineComponent as t,reactive as e,computed as r,onMounted as a,onUnmounted as i,watch as n,openBlock as s,createElementBlock as o,Fragment as l,createVNode as m,unref as p,withCtx as d,renderSlot as u,withModifiers as c,createCommentVNode as f,createTextVNode as y,toDisplayString as v,mergeProps as b}from"vue";import{isObject as g}from"@vue/shared";import{useMessage as P,NDropdown as I,NButton as h,NIcon as F}from"naive-ui";import{ChevronDown as w}from"@vicons/ionicons5";import{Print as T}from"./utils/print.js";import{isIReport as k}from"./utils/browserPrint.js";import x from"./components/IdentityVerification.vue.js";import{format as S}from"date-fns";var D=t({__name:"ButtonPrint",props:{printParams:{type:Array},params:{default:()=>[],type:Array},btnText:{default:"打印",type:String},printText:{default:"直接打印",type:String},previewText:{default:"打印预览",type:String},pdfLoadText:{default:"下载pdf",type:String},formatEditText:{default:"格式编辑",type:String},prevFn:{default:()=>Promise.resolve(),type:Function},queryPrintFormatByNumber:{default:()=>Promise.resolve({}),type:Function},queryTemplateParams:{default:()=>Promise.resolve({}),type:Function},strategy:{default:"MULTI",type:String},clickPrevFn:{default:()=>Promise.resolve(!0),type:Function},noDataMsg:{default:"请选中需要打印的数据",type:String},token:{type:String},printdlgshow:{default:"0",type:String},btnprint:{type:String,default:"1"},directPrint:{type:Boolean,default:!1}},emits:["success","error","clickoutside"],setup(t,{expose:D,emit:j}){const E=t,L=P();let M;const N=e({spinning:!1,visible:!1,formatList:[],templateParams:{},printParams:[],currentFormatId:"",identityVerification:{visible:!1},isInited:!1,watchPrintParamsReformatFn:null,spinTimer:null}),V=e([{label:E.printText,key:"printText"},{label:E.previewText,key:"previewText"},{label:E.pdfLoadText,key:"downloadPdf"},{label:E.formatEditText,key:"formatEditText"}]),O=r((()=>{if(!N.currentFormatId)return{};let t=N.currentFormatId;return N.formatList.find((e=>e.id===t))})),Y=r((()=>O.value.name||"格式选择")),B=r((()=>{let t=N.formatList.find((t=>t.id===N.currentFormatId));return null==t?void 0:t.templateId})),J=async t=>{if(E.directPrint){if(N.spinning)return;return"button"===t?void await rt():Z()}return Z()},U=t=>m("span",{class:{active:t.key===N.currentFormatId}},[t.label]),A=(t,e)=>{let r={type:e,formatId:N.currentFormatId,templateId:B.value};j("success",t,r)},R=t=>{j("error",t),g(t)&&"notInstalledApp"===t.type&&L.error(t.message)},q=()=>{j("error",{message:"前置条件执行错误"})},C=(t=0)=>{var e;const r=(null==(e=E.printParams)?void 0:e.length)?E.printParams[t]:N.printParams[t];return JSON.stringify({...r||{},...E.token?{token:E.token}:{}})},_=()=>{var t,e;let r={},a={};if(null==(t=N.templateParams.customizeDataset)?void 0:t.length){const t=(null==(e=Object.keys(N.printParams[0].datasetData||{}))?void 0:e[0])||"",r=JSON.stringify(N.printParams.map((e=>JSON.parse(e.datasetData[t]))));a={datasetData:{}},a.datasetData[t]=r}else Object.keys(N.printParams[0]).forEach((t=>{a[t]=[],N.printParams.forEach((e=>{a[t].push(e[t])})),a[t]=a[t].join(",")}));return r=Object.assign({},JSON.parse(C(0)),a),JSON.stringify(r)},z=()=>{let t=N.printParams.length;const e=async e=>{try{--t<=0&&A(e,"print")}catch(t){console.log("error",t)}};E.prevFn().catch((()=>(q(),Promise.reject()))).then((()=>{const t={formatId:N.currentFormatId,templateId:B.value,printdlgshow:E.printdlgshow};if("MULTI"===E.strategy)for(let r=0;r<N.printParams.length;r++)r>0&&(t.printdlgshow="0"),M.printDirect({...t,params:C(r)},e,R);else M.printDirect({...t,params:_()},(t=>{A(t,"print")}),R)})).finally((()=>{N.visible=!1}))},H=t=>{switch(t){case"printText":z();break;case"previewText":(async()=>{E.prevFn().catch((()=>(q(),Promise.reject()))).then((()=>{const t="MULTI"===E.strategy?C():_(),e={formatId:N.currentFormatId,templateId:B.value,params:t,btnprint:E.btnprint};M.preview(e,(t=>{A(t,"preview")}),R)})).finally((()=>{N.visible=!1}))})();break;case"formatEditText":E.prevFn().catch((()=>(q(),Promise.reject()))).then((()=>{N.identityVerification.visible=!0})).finally((()=>{N.visible=!1}));break;case"downloadPdf":(async()=>{E.prevFn().catch((()=>(q(),Promise.reject()))).then((()=>{const t="MULTI"===E.strategy?C():_(),e={formatId:N.currentFormatId,templateId:B.value,print:{print:"1",type:"1"},params:t};M.downloadPDF(e,(t=>A(t,"preview")),R)})).finally((()=>{N.visible=!1}))})();break;default:N.currentFormatId=t,N.visible=!1}},$=()=>{N.visible=!1,j("clickoutside")},G=()=>(N.isInited=!1,N.spinning=!1,setTimeout((()=>{N.visible=!1}),0),!1),K=(t,e,r)=>{const a={};return e.forEach((e=>{let i=((t,e)=>{let r=t.defaultValue||"",a=e;return"NUMBER"===t.type&&(a=Number(e)||0),"DATE"===t.type&&(a=e?S(e,"YYYY-MM-DD"):""),"DATETIME"===t.type&&(a=e?S(e,"YYYY-MM-DD HH:mm:ss"):""),r||a})(e,t[e[r]]);t[e[r]]&&i&&(a[e[r]]=i)})),a},Q=({customizeDataset:t=[],param:e=[]},r=[])=>r.map((r=>{let a={};return t.forEach((t=>{const e=t.dataSetting[0].selectFieldList;a.datasetData={[t.name]:JSON.stringify(K(r,e,"fieldName"))}})),a=Object.assign({},a,K(r,e,"key")),a})),W=async t=>{var e;if(N.formatList=t?(t=>{let e=[];return t&&t.forEach((t=>{if(!t.format)return!1;e.push(...t.format)})),e})(t.obj):[],N.currentFormatId=((t,e)=>{if(!(null==t?void 0:t.length))return"";let r=t.find((t=>1==t[e]));return(null==r?void 0:r.id)||t[0].id})(N.formatList,"defaultFlag"),!N.currentFormatId)return L.error("获取打印格式失败,请联系管理员!"),G();(()=>{const t=N.formatList.map((t=>({label:t.name,key:t.id})));V.unshift({label:Y.value,key:"format",children:t})})();let r=null==(e=await E.queryTemplateParams())?void 0:e.obj;if(!r||!B.value)return L.error("获取打印模板失败,请联系管理员!"),G();N.templateParams=r,N.printParams=Q(N.templateParams,E.params)},X=async()=>{if(N.isInited)return!0;N.isInited=!0,N.spinning=!0,(()=>{if(M)return!1;M=new T})();const t=await E.queryPrintFormatByNumber();return await W(t),N.spinning=!1,!0},Z=async(t=!0)=>{var e;if(await E.clickPrevFn())if(null==(e=E.params)?void 0:e.length){if(!N.visible){if(!await X())return!1}t&&(N.visible=!N.visible)}else L.warning(E.noDataMsg)},tt=()=>{N.watchPrintParamsReformatFn&&N.watchPrintParamsReformatFn(),N.isInited?N.printParams=Q(N.templateParams,E.params):N.watchPrintParamsReformatFn=()=>n((()=>N.isInited),(t=>{if(!t)return!1;tt()}))},et=t=>{if(N.identityVerification.visible=!1,k(N.currentFormatId))return A(null,"edit");const e={formatId:N.currentFormatId,templateId:B.value,params:C(),token:t};M.editPrintFormat(e,(t=>{A(t,"edit")}),R)};async function rt(){await Z(!1),z()}return a((()=>{N.isInited=!1})),i((()=>{null==M||M.destroy()})),n((()=>E.params),(t=>{if(!(null==t?void 0:t.length))return!1;tt()}),{deep:!0}),D({directPrint:rt}),(e,r)=>(s(),o(l,null,[m(p(I),{class:"c-dropdown",placement:"bottom-start",trigger:"click",show:N.visible,onClickoutside:$,options:V,onSelect:H,"render-label":U},{default:d((()=>[u(e.$slots,"button",{handleClickPrintBtn:Z,printSpinning:N.spinning,printbtnText:t.btnText,printVisible:N.visible},(()=>[m(p(h),{class:"dropdown-button",onClick:r[1]||(r[1]=c((()=>J("button")),["stop"]))},{default:d((()=>[f(' <n-spin v-show="state.spinning" size="small"></n-spin> '),y(v(t.btnText)+" ",1),m(p(F),{component:p(w),style:{"margin-left":"5px"},onClick:r[0]||(r[0]=c((()=>J("icon")),["stop"]))},null,8,["component"])])),_:1})]))])),_:3},8,["show","options"]),m(x,b(e.$attrs,{modelValue:N.identityVerification.visible,"onUpdate:modelValue":r[2]||(r[2]=t=>N.identityVerification.visible=t),formatId:N.currentFormatId,templateId:p(B),onSuccess:et}),null,16,["modelValue","formatId","templateId"])],64))}});export{D as default};
1
+ import{defineComponent as t,reactive as e,computed as r,onMounted as a,onUnmounted as i,watch as n,openBlock as s,createElementBlock as o,Fragment as l,createVNode as m,unref as p,withCtx as d,renderSlot as u,withModifiers as c,createCommentVNode as f,createTextVNode as y,toDisplayString as v,mergeProps as b}from"vue";import{isObject as g}from"@vue/shared";import{useMessage as P,NDropdown as I,NButton as h,NIcon as F}from"naive-ui";import{ChevronDown as w}from"@vicons/ionicons5";import{Print as k}from"./utils/print.js";import{isIReport as T}from"./utils/browserPrint.js";import S from"./components/IdentityVerification.vue.js";import{format as x}from"date-fns";import{savePrivateFormatApi as D,getPrivateFormatApi as j}from"./api.js";var E=t({__name:"ButtonPrint",props:{printParams:{type:Array},params:{default:()=>[],type:Array},btnText:{default:"打印",type:String},printText:{default:"直接打印",type:String},previewText:{default:"打印预览",type:String},pdfLoadText:{default:"下载pdf",type:String},formatEditText:{default:"格式编辑",type:String},prevFn:{default:()=>Promise.resolve(),type:Function},queryPrintFormatByNumber:{default:()=>Promise.resolve({}),type:Function},queryTemplateParams:{default:()=>Promise.resolve({}),type:Function},strategy:{default:"MULTI",type:String},clickPrevFn:{default:()=>Promise.resolve(!0),type:Function},noDataMsg:{default:"请选中需要打印的数据",type:String},token:{type:String},printdlgshow:{default:"0",type:String},btnprint:{type:String,default:"1"},directPrint:{type:Boolean,default:!1}},emits:["success","error","clickoutside"],setup(t,{expose:E,emit:L}){const N=t,M=P();let O;const V={},Y=e({spinning:!1,visible:!1,formatList:[],templateParams:{},printParams:[],currentFormatId:"",identityVerification:{visible:!1},isInited:!1,watchPrintParamsReformatFn:null,spinTimer:null}),U=e([{label:N.printText,key:"printText"},{label:N.previewText,key:"previewText"},{label:N.pdfLoadText,key:"downloadPdf"},{label:N.formatEditText,key:"formatEditText"}]),B=r((()=>{if(!Y.currentFormatId)return{};let t=Y.currentFormatId;return Y.formatList.find((e=>e.id===t))})),C=r((()=>B.value.name||"格式选择")),J=r((()=>{let t=Y.formatList.find((t=>t.id===Y.currentFormatId));return null==t?void 0:t.templateId})),A=async t=>{if(N.directPrint){if(Y.spinning)return;return"button"===t?void await nt():rt()}return rt()},R=t=>m("span",{class:{active:t.key===Y.currentFormatId}},[t.label]),q=(t,e)=>{let r={type:e,formatId:Y.currentFormatId,templateId:J.value};L("success",t,r)},_=t=>{L("error",t),g(t)&&"notInstalledApp"===t.type&&M.error(t.message)},z=()=>{L("error",{message:"前置条件执行错误"})},H=(t=0)=>{var e;const r=(null==(e=N.printParams)?void 0:e.length)?N.printParams[t]:Y.printParams[t];return JSON.stringify({...r||{},...N.token?{token:N.token}:{}})},$=()=>{var t,e;let r={},a={};if(null==(t=Y.templateParams.customizeDataset)?void 0:t.length){const t=(null==(e=Object.keys(Y.printParams[0].datasetData||{}))?void 0:e[0])||"",r=JSON.stringify(Y.printParams.map((e=>JSON.parse(e.datasetData[t]))));a={datasetData:{}},a.datasetData[t]=r}else Object.keys(Y.printParams[0]).forEach((t=>{a[t]=[],Y.printParams.forEach((e=>{a[t].push(e[t])})),a[t]=a[t].join(",")}));return r=Object.assign({},JSON.parse(H(0)),a),JSON.stringify(r)},G=()=>{let t=Y.printParams.length;const e=async e=>{try{--t<=0&&q(e,"print")}catch(t){console.log("error",t)}};N.prevFn().catch((()=>(z(),Promise.reject()))).then((()=>{const t={formatId:Y.currentFormatId,templateId:J.value,printdlgshow:N.printdlgshow};if("MULTI"===N.strategy)for(let r=0;r<Y.printParams.length;r++)r>0&&(t.printdlgshow="0"),O.printDirect({...t,params:H(r)},e,_);else O.printDirect({...t,params:$()},(t=>{q(t,"print")}),_)})).finally((()=>{Y.visible=!1}))},K=async t=>{switch(t){case"printText":G();break;case"previewText":(async()=>{N.prevFn().catch((()=>(z(),Promise.reject()))).then((()=>{const t="MULTI"===N.strategy?H():$(),e={formatId:Y.currentFormatId,templateId:J.value,params:t,btnprint:N.btnprint};O.preview(e,(t=>{q(t,"preview")}),_)})).finally((()=>{Y.visible=!1}))})();break;case"formatEditText":N.prevFn().catch((()=>(z(),Promise.reject()))).then((()=>{Y.identityVerification.visible=!0})).finally((()=>{Y.visible=!1}));break;case"downloadPdf":(async()=>{N.prevFn().catch((()=>(z(),Promise.reject()))).then((()=>{const t="MULTI"===N.strategy?H():$(),e={formatId:Y.currentFormatId,templateId:J.value,print:{print:"1",type:"1"},params:t};O.downloadPDF(e,(t=>q(t,"preview")),_)})).finally((()=>{Y.visible=!1}))})();break;default:{Y.currentFormatId=t,Y.visible=!1;const e=Y.formatList.find((e=>e.id===t));await D({formatForms:[{...e}],name:V.name||e.templateName,number:V.number||e.number,templateId:V.templateId||e.templateId,...V.id?{id:V.id}:{}},{token:N.token});break}}},Q=()=>{Y.visible=!1,L("clickoutside")},W=()=>(Y.isInited=!1,Y.spinning=!1,setTimeout((()=>{Y.visible=!1}),0),!1),X=(t,e,r)=>{const a={};return e.forEach((e=>{let i=((t,e)=>{let r=t.defaultValue||"",a=e;return"NUMBER"===t.type&&(a=Number(e)||0),"DATE"===t.type&&(a=e?x(e,"YYYY-MM-DD"):""),"DATETIME"===t.type&&(a=e?x(e,"YYYY-MM-DD HH:mm:ss"):""),r||a})(e,t[e[r]]);t[e[r]]&&i&&(a[e[r]]=i)})),a},Z=({customizeDataset:t=[],param:e=[]},r=[])=>r.map((r=>{let a={};return t.forEach((t=>{const e=t.dataSetting[0].selectFieldList;a.datasetData={[t.name]:JSON.stringify(X(r,e,"fieldName"))}})),a=Object.assign({},a,X(r,e,"key")),a})),tt=async t=>{var e;if(Y.formatList=t?(t=>{let e=[];return t&&t.forEach((t=>{if(!t.format)return!1;e.push(...t.format.map((e=>Object.assign({},e,{templateName:t.name}))))})),e})(t.obj):[],Y.currentFormatId=await(async(t,e)=>{var r;if(!(null==t?void 0:t.length))return"";const{data:a}=await j({templateId:t[0].templateId},{token:N.token});if("SUCCESS"===a.result){const{formatForms:t=[]}=a.map||{};Object.assign(V,a.map||{});const e=null==(r=null==t?void 0:t[0])?void 0:r.id;if(e)return e}const i=t.find((t=>1==t[e]));return(null==i?void 0:i.id)||t[0].id})(Y.formatList,"defaultFlag"),!Y.currentFormatId)return M.error("获取打印格式失败,请联系管理员!"),W();(()=>{const t=Y.formatList.map((t=>({label:t.name,key:t.id})));U.unshift({label:C.value,key:"format",children:t})})();let r=null==(e=await N.queryTemplateParams())?void 0:e.obj;if(!r||!J.value)return M.error("获取打印模板失败,请联系管理员!"),W();Y.templateParams=r,Y.printParams=Z(Y.templateParams,N.params)},et=async()=>{if(Y.isInited)return!0;Y.isInited=!0,Y.spinning=!0,(()=>{if(O)return!1;O=new k})();const t=await N.queryPrintFormatByNumber();return await tt(t),Y.spinning=!1,!0},rt=async(t=!0)=>{var e;if(await N.clickPrevFn())if(null==(e=N.params)?void 0:e.length){if(!Y.visible){if(!await et())return!1}t&&(Y.visible=!Y.visible)}else M.warning(N.noDataMsg)},at=()=>{Y.watchPrintParamsReformatFn&&Y.watchPrintParamsReformatFn(),Y.isInited?Y.printParams=Z(Y.templateParams,N.params):Y.watchPrintParamsReformatFn=()=>n((()=>Y.isInited),(t=>{if(!t)return!1;at()}))},it=t=>{if(Y.identityVerification.visible=!1,T(Y.currentFormatId))return q(null,"edit");const e={formatId:Y.currentFormatId,templateId:J.value,params:H(),token:t};O.editPrintFormat(e,(t=>{q(t,"edit")}),_)};async function nt(){await rt(!1),G()}return a((()=>{Y.isInited=!1})),i((()=>{null==O||O.destroy()})),n((()=>N.params),(t=>{if(!(null==t?void 0:t.length))return!1;at()}),{deep:!0}),E({directPrint:nt}),(e,r)=>(s(),o(l,null,[m(p(I),{class:"c-dropdown",placement:"bottom-start",trigger:"click",show:Y.visible,onClickoutside:Q,options:U,onSelect:K,"render-label":R},{default:d((()=>[u(e.$slots,"button",{handleClickPrintBtn:rt,printSpinning:Y.spinning,printbtnText:t.btnText,printVisible:Y.visible},(()=>[m(p(h),{class:"dropdown-button",onClick:r[1]||(r[1]=c((()=>A("button")),["stop"]))},{default:d((()=>[f(' <n-spin v-show="state.spinning" size="small"></n-spin> '),y(v(t.btnText)+" ",1),m(p(F),{component:p(w),style:{"margin-left":"5px"},onClick:r[0]||(r[0]=c((()=>A("icon")),["stop"]))},null,8,["component"])])),_:1})]))])),_:3},8,["show","options"]),m(S,b(e.$attrs,{modelValue:Y.identityVerification.visible,"onUpdate:modelValue":r[2]||(r[2]=t=>Y.identityVerification.visible=t),formatId:Y.currentFormatId,templateId:p(J),onSuccess:it}),null,16,["modelValue","formatId","templateId"])],64))}});export{E as default};
@@ -0,0 +1,3 @@
1
+ import { AnyObject } from '../../../../es/shared/types';
2
+ export declare function getPrivateFormatApi(params: AnyObject, headers: AnyObject): Promise<AnyObject>;
3
+ export declare function savePrivateFormatApi(params: AnyObject, headers: AnyObject): Promise<AnyObject>;
@@ -0,0 +1 @@
1
+ import o from"axios";const t=o.create({}),e=`${window.location.protocol}//${window.location.host}/fdp-api`,r=`${e}/behaviour/getPrivateFormat`,n=`${e}/behaviour/savePrivateFormat`;function a(o,e,r,n={}){return n&&(t.defaults.headers.common={"Content-Type":"application/x-www-form-urlencoded",...n.token?{Authorization:"bearer "+n.token}:{},...n}),new Promise(((n,a)=>{t({url:o,method:e,withCredentials:!1,...e.includes("get")||o.includes("getPrivateFormat")?{params:r}:{data:r}}).then((o=>{n(o)})).catch((o=>{console.log("error :>> ",o)}))}))}function i(o,t){return a(r,"post",o,t)}function c(o,t){return a(n,"post",o,t)}export{i as getPrivateFormatApi,c as savePrivateFormatApi};
@@ -42,7 +42,7 @@ export declare class Print {
42
42
  _queryPrintFile(formatId: string, params?: string): Promise<any>;
43
43
  _browserPrint(result: AnyObject, mode: string): Promise<string | void>;
44
44
  preview({ templateId, formatId, params, btnprint }: AnyObject, successCallbackFn?: Func, errorCallbackFn?: Func): Promise<any>;
45
- printDirect({ templateId, formatId, params, print, printdlgshow, nobillnode }: AnyObject, successCallbackFn: Func, errorCallbackFn: Func, mode?: string): Promise<any>;
45
+ printDirect({ templateId, formatId, params, print, printdlgshow, nobillnode, isDownloadFile }: AnyObject, successCallbackFn: Func, errorCallbackFn: Func, mode?: string): Promise<any>;
46
46
  private _downloadPDF;
47
47
  /**
48
48
  * 下载pdf
@@ -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},l,d,h="printDirect"){if(a(e)){const t=await this._queryPrintFile(e,i);return t?(r(t,h),void(null==l||l({file:t}))):null==d?void 0:d("获取文件失败!")}await this._queryProxyOrigin();const c=await this._testConnection();if(!this._handleResultTest(c,d))return!1;const p=await this._handleEventDirect({templateId:t,formatId:e,params:i,cmdid:"7",print:n,printdlgshow:s,nobillnode:o});if(!p)return!1;const u=this._handleResult(p,d);if(!u)return!1;await this._browserPrint(u,h),l&&l(u)}_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};
@@ -0,0 +1,20 @@
1
+ import { SFCWithInstall } from '../../../es/shared/types';
2
+ declare const DatePicker: SFCWithInstall<import("vue").DefineComponent<{}, {
3
+ attrs: {
4
+ [x: string]: unknown;
5
+ };
6
+ emits: (event: "update:formattedValue", ...args: any[]) => void;
7
+ datePickerRef: import("vue").Ref<null>;
8
+ __formattedValue: import("vue").Ref<any>;
9
+ keyupValue: import("vue").Ref<string>;
10
+ inputIndex: number;
11
+ placeholder: string;
12
+ formatRef: import("vue").ComputedRef<unknown>;
13
+ updateFormattedValue: (value: any) => void;
14
+ onBlur: () => void;
15
+ onKeyUp: (event: import("../../../es/shared/types").AnyObject) => any;
16
+ NDatePicker: any;
17
+ }, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, "update:formattedValue"[], "update:formattedValue", import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{}>> & {
18
+ "onUpdate:formattedValue"?: ((...args: any[]) => any) | undefined;
19
+ }, {}>>;
20
+ export default DatePicker;
@@ -0,0 +1 @@
1
+ import{COMPONENT_NAMESPACE as r}from"../../shared/global/variable.js";import{safeComponentRegister as e}from"../../shared/utils/index.js";import t from"./src/DatePicker.vue.js";const a=t;a.install=function(t){e(t,a,r+"DatePicker")};export{a as default};
@@ -0,0 +1,20 @@
1
+ import { AnyObject } from '../../../../es/shared/types';
2
+ declare const _default: import("vue").DefineComponent<{}, {
3
+ attrs: {
4
+ [x: string]: unknown;
5
+ };
6
+ emits: (event: "update:formattedValue", ...args: any[]) => void;
7
+ datePickerRef: import("vue").Ref<null>;
8
+ __formattedValue: import("vue").Ref<any>;
9
+ keyupValue: import("vue").Ref<string>;
10
+ inputIndex: number;
11
+ placeholder: string;
12
+ formatRef: import("vue").ComputedRef<unknown>;
13
+ updateFormattedValue: (value: any) => void;
14
+ onBlur: () => void;
15
+ onKeyUp: (event: AnyObject) => any;
16
+ NDatePicker: any;
17
+ }, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, "update:formattedValue"[], "update:formattedValue", import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{}>> & {
18
+ "onUpdate:formattedValue"?: ((...args: any[]) => any) | undefined;
19
+ }, {}>;
20
+ export default _default;
@@ -0,0 +1 @@
1
+ import{defineComponent as e,useAttrs as t,ref as a,computed as l,watch as u,openBlock as r,createBlock as o,unref as n,mergeProps as i,createSlots as v,renderList as d,withCtx as m,renderSlot as f}from"vue";import{NDatePicker as s}from"naive-ui";import{parse as c,isValid as y,format as p}from"date-fns";import _ from"../../../_virtual/plugin-vue_export-helper.js";var g=_(e({__name:"DatePicker",emits:["update:formattedValue"],setup(e,{expose:_,emit:g}){const k=t(),M=a(null),h=a(),P=a("");let $=-1,b="";const x=l((()=>{if(k.format)return k.format;const e=k.type||"";return["datetime","datetimerange"].includes(e)?"yyyy-MM-dd HH:mm:ss":"month"===e?"yyyy-MM":"year"===e?"yyyy":"yyyy-MM-dd"}));function D(e){g("update:formattedValue",e)}function V(){var e;const t=c(P.value,null==(e=x.value.match(/[a-zA-Z]/g))?void 0:e.join(""),new Date);if(y(t)){const e=p(t,x.value);~$?h.value?h.value[$]=e:h.value=[e,e]:h.value=e,D(h.value)}}function j(e){var t,a,l,u;const{keyCode:r=0}=e;if((k.type||"").includes("range")&&(b=(null==(t=e.target)?void 0:t.placeholder)||b,$=b.includes("开始")?0:1),13==r)return null==(l=null==(a=M.value)?void 0:a.blur)?void 0:l.call(a);P.value=(null==(u=e.target)?void 0:u.value)||""}return u((()=>k["formatted-value"]),(e=>{h.value=e}),{immediate:!0}),_({$datePicker:M,focus:()=>{var e,t;return null==(t=null==(e=M.value)?void 0:e.focus)?void 0:t.call(e)},blur:()=>{var e,t;return null==(t=null==(e=M.value)?void 0:e.blur)?void 0:t.call(e)}}),(e,t)=>(r(),o(n(s),i({ref_key:"datePickerRef",ref:M},e.$attrs,{"formatted-value":h.value,"onUpdate:formattedValue":D,onBlur:V,onKeyup:j}),v({_:2},[d(e.$slots,((t,a)=>({name:a,fn:m((()=>[f(e.$slots,a)]))})))]),1040,["formatted-value"]))}}),[["__file","DatePicker.vue"]]);export{g as default};
@@ -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 d}from"lodash-es";import{format as p}from"date-fns";function h(h,g,v,m,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:Y,xCellWidth:G,endY:L,startTime:M,leftAddAreaWidth:A,leftScales:X,rightScales:I,yCellHeight:D,endX:H,scaleValues:O,canvasWidth:V,borderStyle:W,rightAddAreaWidth:$,event:R,originYCervix:q,other:z}=g,B=d(O),F=new Set;function J(){B.filter((t=>t.show)).forEach(((t,e)=>{var s;const a=[],u=[],c=[];null==(s=t.data)||s.forEach(((s,f)=>{!function(s,f,d){let p,y;const{pointAttr:k={},lineAttr:w={},title:x="",key:j,type:C="circle",childbirth:E={}}=t,P=t.data[d+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 Y,L;if(f.childbirth){const t=s[1]+D;Y=o([s[0],s[1],t],E.style||{}),c.push(Y),E.text&&(L=i([s[0]+G/2,t-D/2],{value:String(E.text),...r,originX:"left",originY:"center",...E.style||{}}),c.push(L))}const M=u[d-1],A={origin:{data:f,title:x,key:j||"",dataIndex:e,index:d},leftLine:M,rightLine:y,arrowGroup:Y,arrowGroupText:L,...k,...g.event.hovered?g.event.evented?{selectable:!0}:{selectable:!0,lockMovementX:!0,lockMovementY:!0}:g.event};M?p=l(C,{left:M.get("x2"),top:M.get("y2"),...A}):s&&(A.leftLine=null,p=l(C,{left:s[0],top:s[1],...A}));u.push(y),p&&(!function(t){R.hovered&&(t.on("mouseover",(()=>{Q(t)})),t.on("mouseout",(()=>{m.show=!1})));if(t.lockMovementX&&t.lockMovementY)return;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+G/2,top:t.top+D/2})}(t),R.hovered&&Q(t)})),t.on("mouseup",(e=>{if(m.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(),v("change",n),K(n,"change")}}))}(p),a.push(p),F.add(p))}(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<Y&&t.set("top",Y),t.top>L&&t.set("top",L),t.left<e&&t.set("left",e),t.left>n&&t.set("left",n)}function Q(t){const{title:e,key:n}=t.origin;m.point={x:t.left,y:t.top},m.list=[`${e} ${T(n,t.top)}`,`时间 ${b(t.left).slice(-5)}`],m.show=!0}function U(t,e){if(f(t)&&function(t){const e=M+864e5,n=new Date(t).getTime();return n>=M&&n<=e}(t.time)){const n=w(t.time),o=x(e.key,e.range,t.value);return[n,o<Y?Y:o>L?L: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-A-$-1,height:L,left:A,top:0,fill:"transparent"});h.value.add(t)}(),function(){let t=A;[...X,...I].forEach(((e,n)=>{const{range:o,spaceValue:l,width:c,title:f,titleStyle:d,layout:p}=e,g=[];"right"===p&&(t=H);const v=t+c/2,m=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);m.forEach(((t,e)=>{const n=0===e?L-8:L-e*D;g.push(i([v,n],{value:String(t),...r}))}));const y=new u.Rect({...a,width:c,height:L,left:v,top:L/2}),k=Y>0?i([v,Y-D/2],{value:String(f),...r,...d}):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 d=[],p=[],g=[],v=[],m=S+G/2;for(let s=0;s<P.mainXCell;s++){if(t){const t=0===s?+e.slice(11,13):Z(d.at(-1),n);d.push(t);const a="top"==o?Y-15:L+15;g.push(i([m+s*G,a],{value:String(t),...r,...l||{}}))}if(a){const t=0===s?c[0]:p.at(-1)+1;p.push(t);const e="top"==o?L+15:Y-15;v.push(i([m+s*G,e],{value:String(t),...r,...f||{}}))}}const y=new u.Group([...g,...v],{objectCaching:!1,...s});h.value.add(y),h.value.sendToBack(y)}}(),function(){var t;const e=Object.values(z),o=[],i={},r=B.find((t=>"cervix"===t.key&&t.show)),l=null==(t=null==r?void 0:r.data)?void 0:t.find((t=>3==+t.value));function s(t,e){const{key:n,range:o}=r||{},i=x(n,o,10),l=[0,e],s=[-e/t,0],a=[(L-i-e)/t,L-i],u=[H-S,t*(H-S)+e];let c=[],f=[];function d([n,o]){return Math.abs(o-t*n-e)<=1}function p([t,e]){const[n,o]=[...h([t,e])];return n>=S&&n<=H&&o>=i&&o<=L}function h([t,e]){return[S+t,L-e]}return d(l)&&p(l)&&(c=h(l)),d(s)&&p(s)&&(c=h(s)),d(a)&&p(a)&&(f=h(a)),d(u)&&p(u)&&(f=h(u)),[...c,...f]}e.forEach((t=>{if(!t.show)return;const{key:e}=t;switch(e){case"fetalPresentation":{const{range:i,show:r}=B.find((t=>t.key===e));if(r){const r=x(e,i,0);o.push(n([S,r,H,r],{...t}))}break}case"alert":if(l){const{key:e,range:a}=r||{},u=216e5,c={time:p(new Date(new Date(l.time).getTime()+u),"yyyy-MM-dd HH:mm"),value:10},[f,d]=[w(l.time)-S,L-x(e,a,l.value)],[h,g]=[w(c.time)-S,L-x(e,a,c.value)],v=(g-d)/(h-f),m=d-f*v,y=s(v,m);y.length>0&&(o.push(n(y,{...t})),Object.assign(i,{k:v,b:m}))}break;case"handling":if(l){const{k:e,b:r}=i,a=144e5,u=s(e,r-(w(p(new Date(new Date(l.time).getTime()+a),"yyyy-MM-dd HH:mm"))-w(l.time))*e);u.length>0&&o.push(n(u,{...t}))}}})),h.value.add(...o)}(),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>=Y&&o<=L&&(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.filter((t=>t.show)).forEach((i=>{if(!j(n,"key",G).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=Y;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>=Y&&n<=L}t.on("moving",(()=>{t.set("originY","center"),e(t)?(N(t),Q(t)):m.show=!1})),t.on("mouseup:before",(n=>{if(m.show=!1,0===n.e.button&&e(t))if(j(t.left,"key",G).includes(t.origin.key))C();else{const e={data:{time:b(t.left),value:T(t.origin.key,t.top)},...t.origin};v("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=(L-Y)/2,o=(e.height+e.top-Y)/2;t.forEach((t=>{const e=t.top+n-o;t.set({top:e,originTop:e})}))}e(X,A/2),e(I,t)}(),{clickMenu:function({item:t,target:e}){const n={...t.origin};"remove"===t.mode?(v("remove",n),K(n,"remove")):(Object.assign(n,{data:{time:b(t.pointer.x),value:T(t.origin.key,t.pointer.y)}}),v("add",n),K(n))}}}export{h as useBirthProcess};
@@ -1 +1 @@
1
- import{ref as e,reactive as a,computed as l,onMounted as t,nextTick as u}from"vue";import{defaultBorderStyle as r}from"./useDraw.js";import"date-fns";import"../utils/index.js";import"lodash-es";import"./useShadow.js";import{useEvent as i,useCanvasEvent as s}from"./useEvent.js";import{useBirthProcess as n}from"./useBirthProcess.js";import{useCommon as d}from"./useCommon.js";function o(o,v,c,h){const m=e(),p=e(),g=e(),f=a({show:!1,point:{x:0,y:0},list:[]}),x=a({show:!1,point:{x:0,y:0},list:[],target:null}),y=l((()=>v.data.scaleValues.filter((e=>"left"===e.layout)))),V=l((()=>v.data.scaleValues.filter((e=>"right"===e.layout)))),w=l((()=>{var e;return(null==(e=V.value)?void 0:e.length)?30:0})),C=l((()=>{var e;return 30+(null==(e=y.value)?void 0:e.reduce(((e,a)=>e+=a.width),0))})),A=l((()=>{var e;const{width:a}=v.data,l=null==(e=V.value)?void 0:e.reduce(((e,a)=>e+=a.width),0);return a-w.value-l})),Y=l((()=>v.data.grid.mainXCell)),j=l((()=>v.data.grid.mainYCell)),S=l((()=>(A.value-C.value)/Y.value)),b=l((()=>{const{xAxis:e,height:a}=v.data,l=Object.values(e).reduce(((e,a)=>(a.show&&e++,e)),0);return a/(j.value+l)})),k=l((()=>b.value)),P=l((()=>{const{scaleValues:e}=v.data,a=e.find((e=>"cervix"===e.key)),[,l]=(null==a?void 0:a.range)||[0,10],t=(null==a?void 0:a.spaceValue)||1;return X.value-l*t*b.value})),X=l((()=>{const{height:e}=v.data;return e-b.value})),H=l((()=>new Date(v.data.xAxis.time.startTime).getTime())),T=l((()=>36e5/S.value)),W=l((()=>{const{scaleValues:e}=v.data,a=e.find((e=>"cervix"===e.key));return((null==a?void 0:a.spaceValue)||1)/b.value})),M=l((()=>{const{scaleValues:e}=v.data,a=e.find((e=>"FHR"===e.key));return((null==a?void 0:a.spaceValue)||10)/b.value})),D=l((()=>{const{scaleValues:e}=v.data,a=e.find((e=>"fetalPresentation"===e.key));return((null==a?void 0:a.spaceValue)||1)/b.value})),F=l((()=>{var e;return(null==(e=v.data.grid)?void 0:e.event)||{selectable:!0,evented:!0,hovered:!0}})),N=a({canvasWidth:v.data.width,canvasHeight:v.data.height,borderStyle:{...r,...v.data.borderStyle},selectionStyle:v.data.selectionStyle||{},grid:v.data.grid,other:v.data.other,originX:C.value,endX:A.value,originY:k.value,endY:X.value,xCellWidth:S.value,yCellHeight:b.value,gridXNumber:Y.value,gridYNumber:j.value,xAxis:v.data.xAxis,leftScales:y.value,rightScales:V.value,leftAddAreaWidth:30,rightAddAreaWidth:w.value,startTime:H.value,timeXCell:T.value,cervixYCell:W.value,FHRYCell:M.value,fetalPresentationYCell:D.value,scaleValues:v.data.scaleValues,event:F.value,originYCervix:P.value}),R=d(o);return t((()=>{u((()=>{const{clickMenu:e}=n(o,N,c,f,x,R);g.value=e,i(h.value);const{select:a}=s(o,N,c);m.value=a}))})),{propItems:N,redrawPoints:p,select:m,pointTipProps:f,pointMenuProps:x,clickMenu:g}}export{o as default};
1
+ import{ref as e,reactive as a,computed as l,onMounted as t,nextTick as u}from"vue";import{defaultBorderStyle as r}from"./useDraw.js";import"date-fns";import"../utils/index.js";import"lodash-es";import"./useShadow.js";import{useEvent as i,useCanvasEvent as s}from"./useEvent.js";import{useBirthProcess as n}from"./useBirthProcess.js";import{useCommon as d}from"./useCommon.js";function o(o,v,c,h){const m=e(),p=e(),g=e(),f=a({show:!1,point:{x:0,y:0},list:[]}),x=a({show:!1,point:{x:0,y:0},list:[],target:null}),w=l((()=>v.data.scaleValues.filter((e=>"left"===e.layout&&e.show)))),y=l((()=>v.data.scaleValues.filter((e=>"right"===e.layout&&e.show)))),V=l((()=>{var e;return(null==(e=y.value)?void 0:e.length)?30:0})),C=l((()=>{var e;return 30+(null==(e=w.value)?void 0:e.reduce(((e,a)=>e+=a.width),0))})),A=l((()=>{var e;const{width:a}=v.data,l=null==(e=y.value)?void 0:e.reduce(((e,a)=>e+=a.width),0);return a-V.value-l})),Y=l((()=>v.data.grid.mainXCell)),j=l((()=>v.data.grid.mainYCell)),S=l((()=>(A.value-C.value)/Y.value)),b=l((()=>{const{xAxis:e,height:a}=v.data,l=Object.values(e).reduce(((e,a)=>(a.show&&e++,e)),0);return a/(j.value+l)})),k=l((()=>b.value)),P=l((()=>{const{scaleValues:e}=v.data,a=e.find((e=>"cervix"===e.key)),[,l]=(null==a?void 0:a.range)||[0,10],t=(null==a?void 0:a.spaceValue)||1;return X.value-l*t*b.value})),X=l((()=>{const{height:e}=v.data;return e-b.value})),H=l((()=>new Date(v.data.xAxis.time.startTime).getTime())),T=l((()=>36e5/S.value)),W=l((()=>{const{scaleValues:e}=v.data,a=e.find((e=>"cervix"===e.key));return((null==a?void 0:a.spaceValue)||1)/b.value})),M=l((()=>{const{scaleValues:e}=v.data,a=e.find((e=>"FHR"===e.key));return((null==a?void 0:a.spaceValue)||10)/b.value})),D=l((()=>{const{scaleValues:e}=v.data,a=e.find((e=>"fetalPresentation"===e.key));return((null==a?void 0:a.spaceValue)||1)/b.value})),F=l((()=>{var e;return(null==(e=v.data.grid)?void 0:e.event)||{selectable:!0,evented:!0,hovered:!0}})),N=a({canvasWidth:v.data.width,canvasHeight:v.data.height,borderStyle:{...r,...v.data.borderStyle},selectionStyle:v.data.selectionStyle||{},grid:v.data.grid,other:v.data.other,originX:C.value,endX:A.value,originY:k.value,endY:X.value,xCellWidth:S.value,yCellHeight:b.value,gridXNumber:Y.value,gridYNumber:j.value,xAxis:v.data.xAxis,leftScales:w.value,rightScales:y.value,leftAddAreaWidth:30,rightAddAreaWidth:V.value,startTime:H.value,timeXCell:T.value,cervixYCell:W.value,FHRYCell:M.value,fetalPresentationYCell:D.value,scaleValues:v.data.scaleValues,event:F.value,originYCervix:P.value}),R=d(o);return t((()=>{u((()=>{const{clickMenu:e}=n(o,N,c,f,x,R);g.value=e,i(h.value);const{select:a}=s(o,N,c);m.value=a}))})),{propItems:N,redrawPoints:p,select:m,pointTipProps:f,pointMenuProps:x,clickMenu:g}}export{o as default};
@@ -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};
@@ -19,6 +19,10 @@ declare const FieldSet: SFCWithInstall<import("vue").DefineComponent<{
19
19
  }, {
20
20
  fieldsMapping: Record<string, string>;
21
21
  selectOptions: Record<string, string>[];
22
+ sortOptions: {
23
+ label: string;
24
+ value: string;
25
+ }[];
22
26
  emit: (event: "onSave" | "onClose" | "reset", ...args: any[]) => void;
23
27
  settingView: any;
24
28
  props: Readonly<import("@vue/shared").LooseRequired<Readonly<import("vue").ExtractPropTypes<{
@@ -56,6 +60,7 @@ declare const FieldSet: SFCWithInstall<import("vue").DefineComponent<{
56
60
  name: string;
57
61
  show: boolean;
58
62
  sort: boolean;
63
+ sortDirection: "NONE" | "ASC" | "DESC";
59
64
  title: string;
60
65
  alias: string;
61
66
  fixedShow: boolean;
@@ -76,6 +81,7 @@ declare const FieldSet: SFCWithInstall<import("vue").DefineComponent<{
76
81
  name: string;
77
82
  show: boolean;
78
83
  sort: boolean;
84
+ sortDirection: "NONE" | "ASC" | "DESC";
79
85
  title: string;
80
86
  alias: string;
81
87
  fixedShow: boolean;
@@ -103,6 +109,7 @@ declare const FieldSet: SFCWithInstall<import("vue").DefineComponent<{
103
109
  name: string;
104
110
  show: boolean;
105
111
  sort: boolean;
112
+ sortDirection: "NONE" | "ASC" | "DESC";
106
113
  title: string;
107
114
  alias: string;
108
115
  fixedShow: boolean;
@@ -120,6 +127,7 @@ declare const FieldSet: SFCWithInstall<import("vue").DefineComponent<{
120
127
  name: string;
121
128
  show: boolean;
122
129
  sort: boolean;
130
+ sortDirection: "NONE" | "ASC" | "DESC";
123
131
  title: string;
124
132
  alias: string;
125
133
  fixedShow: boolean;