cnhis-design-vue 3.2.3 → 3.2.4-beta.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (309) hide show
  1. package/README.md +87 -87
  2. package/es/components/biunique-chat/index.d.ts +102 -63
  3. package/es/components/biunique-chat/src/Index.vue.d.ts +102 -63
  4. package/es/components/biunique-chat/src/Index.vue2.js +1 -1
  5. package/es/components/biunique-chat/src/api/index.d.ts +1 -0
  6. package/es/components/biunique-chat/src/api/index.js +1 -1
  7. package/es/components/biunique-chat/src/components/ChatFooter.vue2.js +1 -1
  8. package/es/components/biunique-chat/src/components/ChatHeader.vue.d.ts +60 -39
  9. package/es/components/biunique-chat/src/components/ChatHeader.vue2.js +1 -1
  10. package/es/components/biunique-chat/src/components/ChatMain.vue.d.ts +33 -19
  11. package/es/components/biunique-chat/src/components/ChatMain.vue2.js +1 -1
  12. package/es/components/biunique-chat/src/components/ChatSearch.vue.d.ts +3 -3
  13. package/es/components/biunique-chat/src/components/ChatSearch.vue2.js +1 -1
  14. package/es/components/biunique-chat/src/components/ChatSet.vue.d.ts +42 -30
  15. package/es/components/biunique-chat/src/components/ChatSet.vue2.js +1 -1
  16. package/es/components/biunique-chat/src/components/MessageTemplate.vue.d.ts +3 -0
  17. package/es/components/biunique-chat/src/components/MessageTemplate.vue2.js +1 -1
  18. package/es/components/biunique-chat/src/components/PersonProfile.vue.d.ts +28 -20
  19. package/es/components/biunique-chat/src/components/PersonProfile.vue2.js +1 -1
  20. package/es/components/biunique-chat/src/components/SiderList.vue.d.ts +2 -2
  21. package/es/components/biunique-chat/src/components/SiderList.vue2.js +1 -1
  22. package/es/components/biunique-chat/src/hooks/useSession.d.ts +4 -1
  23. package/es/components/biunique-chat/src/hooks/useSession.js +1 -1
  24. package/es/components/biunique-chat/src/utils/emoji.js +1 -1
  25. package/es/components/biunique-chat/style/index.css +1 -1
  26. package/es/components/button-print/index.d.ts +13 -0
  27. package/es/components/button-print/src/ButtonPrint.vue.d.ts +13 -0
  28. package/es/components/button-print/src/ButtonPrint.vue2.js +1 -1
  29. package/es/components/button-print/src/components/IdentityVerification.vue2.js +1 -1
  30. package/es/components/button-print/src/utils/print.d.ts +2 -2
  31. package/es/components/button-print/src/utils/print.js +1 -1
  32. package/es/components/classification/src/index.vue.d.ts +0 -3
  33. package/es/components/default-page/index.d.ts +3 -24
  34. package/es/components/default-page/src/constants/index.d.ts +7 -5
  35. package/es/components/default-page/src/constants/index.js +1 -1
  36. package/es/components/default-page/src/index.vue.d.ts +3 -24
  37. package/es/components/default-page/src/index.vue2.js +1 -1
  38. package/es/components/fabric-chart/src/hooks/birthProcess/useBirthProcess.js +1 -1
  39. package/es/components/fabric-chart/src/hooks/birthProcess/useBirthProcessChart.js +1 -1
  40. package/es/components/fabric-chart/src/hooks/electrocardiogram/hooks/useDetailEvent.js +1 -1
  41. package/es/components/fabric-chart/src/hooks/electrocardiogram/useElectrocardiogram.js +1 -1
  42. package/es/components/fabric-chart/src/hooks/electrocardiogram/useElectrocardiogramChart.js +1 -1
  43. package/es/components/fabric-chart/src/hooks/electrocardiogram/useMeasureInstrument.js +1 -1
  44. package/es/components/fabric-chart/src/hooks/newBirthProcess/useNewBirthProcess.js +1 -1
  45. package/es/components/fabric-chart/src/hooks/newBirthProcess/useNewBirthProcessChart.js +1 -1
  46. package/es/components/fabric-chart/src/hooks/surgicalAnesthesia/useCenter.js +1 -1
  47. package/es/components/fabric-chart/src/hooks/surgicalAnesthesia/useLeft.js +1 -1
  48. package/es/components/fabric-chart/src/hooks/surgicalAnesthesia/useOther.js +1 -1
  49. package/es/components/fabric-chart/src/hooks/surgicalAnesthesia/useSurgicalAnesthesiaChart.js +1 -1
  50. package/es/components/fabric-chart/src/hooks/surgicalAnesthesia/useTop.js +1 -1
  51. package/es/components/fabric-chart/src/hooks/temperature/useBottom.js +1 -1
  52. package/es/components/fabric-chart/src/hooks/temperature/useCenter.js +1 -1
  53. package/es/components/fabric-chart/src/hooks/temperature/useLeft.js +1 -1
  54. package/es/components/fabric-chart/src/hooks/temperature/useOther.js +1 -1
  55. package/es/components/fabric-chart/src/hooks/temperature/useTop.js +1 -1
  56. package/es/components/fabric-chart/src/utils/index.js +1 -1
  57. package/es/components/form-render/index.js +1 -1
  58. package/es/components/form-render/src/components/renderer/index.js +1 -1
  59. package/es/components/form-render/src/components/renderer/simpleComponent.d.ts +0 -8
  60. package/es/components/form-render/src/components/renderer/simpleComponent.js +1 -1
  61. package/es/components/form-render/src/components/renderer/text.d.ts +17 -0
  62. package/es/components/form-render/src/components/renderer/text.js +1 -0
  63. package/es/components/form-render/src/hooks/useFieldNormalize.js +1 -1
  64. package/es/components/form-render/src/types/index.d.ts +4 -0
  65. package/es/components/form-render/src/utils/index.d.ts +8 -1
  66. package/es/components/form-render/src/utils/index.js +1 -1
  67. package/es/components/index.css +1 -1
  68. package/es/components/index.js +1 -1
  69. package/es/components/scale-view/src/ScaleView.vue2.js +1 -1
  70. package/es/components/select-label/src/LabelFormContent.vue2.js +1 -1
  71. package/es/components/select-person/src/SearchMultiple.vue.d.ts +6 -0
  72. package/es/shared/assets/img/defaultCover/10review_successful.png.js +1 -0
  73. package/es/shared/assets/img/defaultCover/11review_fail.png.js +1 -0
  74. package/es/shared/assets/img/defaultCover/12no_setting.png.js +1 -0
  75. package/es/shared/assets/img/defaultCover/1location.png.js +1 -0
  76. package/es/shared/assets/img/defaultCover/2notfound.png.js +1 -0
  77. package/es/shared/assets/img/defaultCover/3loading.png.js +1 -0
  78. package/es/shared/assets/img/defaultCover/4no_permission.png.js +1 -0
  79. package/es/shared/assets/img/defaultCover/5no_data.png.js +1 -0
  80. package/es/shared/assets/img/defaultCover/6no_network.png.js +1 -0
  81. package/es/shared/assets/img/defaultCover/7no_doctor.png.js +1 -0
  82. package/es/shared/assets/img/defaultCover/8system_error.png.js +1 -0
  83. package/es/shared/assets/img/defaultCover/9system_upgrade.png.js +1 -0
  84. package/es/shared/assets/img/emoji/emotion_001.png.js +1 -1
  85. package/es/shared/assets/img/emoji/emotion_002.png.js +1 -1
  86. package/es/shared/assets/img/emoji/emotion_003.png.js +1 -1
  87. package/es/shared/assets/img/emoji/emotion_004.png.js +1 -1
  88. package/es/shared/assets/img/emoji/emotion_005.png.js +1 -1
  89. package/es/shared/assets/img/emoji/emotion_006.png.js +1 -1
  90. package/es/shared/assets/img/emoji/emotion_007.png.js +1 -1
  91. package/es/shared/assets/img/emoji/emotion_008.png.js +1 -1
  92. package/es/shared/assets/img/emoji/emotion_009.png.js +1 -1
  93. package/es/shared/assets/img/emoji/emotion_010.png.js +1 -1
  94. package/es/shared/assets/img/emoji/emotion_011.png.js +1 -1
  95. package/es/shared/assets/img/emoji/emotion_012.png.js +1 -1
  96. package/es/shared/assets/img/emoji/emotion_013.png.js +1 -1
  97. package/es/shared/assets/img/emoji/emotion_014.png.js +1 -1
  98. package/es/shared/assets/img/emoji/emotion_015.png.js +1 -1
  99. package/es/shared/assets/img/emoji/emotion_016.png.js +1 -1
  100. package/es/shared/assets/img/emoji/emotion_017.png.js +1 -1
  101. package/es/shared/assets/img/emoji/emotion_018.png.js +1 -1
  102. package/es/shared/assets/img/emoji/emotion_019.png.js +1 -1
  103. package/es/shared/assets/img/emoji/emotion_020.png.js +1 -1
  104. package/es/shared/assets/img/emoji/emotion_021.png.js +1 -1
  105. package/es/shared/assets/img/emoji/emotion_022.png.js +1 -1
  106. package/es/shared/assets/img/emoji/emotion_023.png.js +1 -1
  107. package/es/shared/assets/img/emoji/emotion_024.png.js +1 -1
  108. package/es/shared/assets/img/emoji/emotion_025.png.js +1 -1
  109. package/es/shared/assets/img/emoji/emotion_026.png.js +1 -1
  110. package/es/shared/assets/img/emoji/emotion_027.png.js +1 -1
  111. package/es/shared/assets/img/emoji/emotion_028.png.js +1 -1
  112. package/es/shared/assets/img/emoji/emotion_029.png.js +1 -1
  113. package/es/shared/assets/img/emoji/emotion_030.png.js +1 -1
  114. package/es/shared/assets/img/emoji/emotion_031.png.js +1 -1
  115. package/es/shared/assets/img/emoji/emotion_032.png.js +1 -1
  116. package/es/shared/assets/img/emoji/emotion_033.png.js +1 -1
  117. package/es/shared/assets/img/emoji/emotion_034.png.js +1 -1
  118. package/es/shared/assets/img/emoji/emotion_035.png.js +1 -1
  119. package/es/shared/assets/img/emoji/emotion_036.png.js +1 -1
  120. package/es/shared/assets/img/emoji/emotion_037.png.js +1 -1
  121. package/es/shared/assets/img/emoji/emotion_038.png.js +1 -1
  122. package/es/shared/assets/img/emoji/emotion_039.png.js +1 -1
  123. package/es/shared/assets/img/emoji/emotion_040.png.js +1 -1
  124. package/es/shared/assets/img/emoji/emotion_041.png.js +1 -1
  125. package/es/shared/assets/img/emoji/emotion_042.png.js +1 -1
  126. package/es/shared/assets/img/emoji/emotion_043.png.js +1 -1
  127. package/es/shared/assets/img/emoji/emotion_044.png.js +1 -1
  128. package/es/shared/assets/img/emoji/emotion_045.png.js +1 -1
  129. package/es/shared/assets/img/emoji/emotion_046.png.js +1 -1
  130. package/es/shared/assets/img/emoji/emotion_047.png.js +1 -1
  131. package/es/shared/assets/img/emoji/emotion_048.png.js +1 -1
  132. package/es/shared/assets/img/emoji/emotion_049.png.js +1 -1
  133. package/es/shared/assets/img/emoji/emotion_050.png.js +1 -1
  134. package/es/shared/assets/img/emoji/emotion_051.png.js +1 -1
  135. package/es/shared/assets/img/emoji/emotion_052.png.js +1 -1
  136. package/es/shared/assets/img/emoji/emotion_053.png.js +1 -1
  137. package/es/shared/assets/img/emoji/emotion_054.png.js +1 -1
  138. package/es/shared/assets/img/emoji/emotion_055.png.js +1 -1
  139. package/es/shared/assets/img/emoji/emotion_056.png.js +1 -1
  140. package/es/shared/assets/img/emoji/emotion_057.png.js +1 -1
  141. package/es/shared/assets/img/emoji/emotion_058.png.js +1 -1
  142. package/es/shared/assets/img/emoji/emotion_059.png.js +1 -1
  143. package/es/shared/assets/img/emoji/emotion_060.png.js +1 -1
  144. package/es/shared/assets/img/emoji/emotion_061.png.js +1 -1
  145. package/es/shared/assets/img/emoji/emotion_062.png.js +1 -1
  146. package/es/shared/assets/img/emoji/emotion_063.png.js +1 -1
  147. package/es/shared/assets/img/emoji/emotion_064.png.js +1 -1
  148. package/es/shared/assets/img/emoji/emotion_065.png.js +1 -1
  149. package/es/shared/assets/img/emoji/emotion_066.png.js +1 -1
  150. package/es/shared/assets/img/emoji/emotion_067.png.js +1 -1
  151. package/es/shared/assets/img/emoji/emotion_068.png.js +1 -1
  152. package/es/shared/assets/img/emoji/emotion_069.png.js +1 -1
  153. package/es/shared/assets/img/emoji/emotion_070.png.js +1 -1
  154. package/es/shared/assets/img/emoji/emotion_071.png.js +1 -1
  155. package/es/shared/assets/img/emoji/emotion_072.png.js +1 -1
  156. package/es/shared/assets/img/emoji/emotion_073.png.js +1 -1
  157. package/es/shared/assets/img/emoji/emotion_074.png.js +1 -1
  158. package/es/shared/assets/img/emoji/emotion_075.png.js +1 -1
  159. package/es/shared/assets/img/emoji/emotion_076.png.js +1 -1
  160. package/es/shared/assets/img/emoji/emotion_077.png.js +1 -1
  161. package/es/shared/assets/img/emoji/emotion_078.png.js +1 -1
  162. package/es/shared/assets/img/emoji/emotion_079.png.js +1 -1
  163. package/es/shared/assets/img/emoji/emotion_080.png.js +1 -1
  164. package/es/shared/assets/img/emoji/emotion_081.png.js +1 -1
  165. package/es/shared/assets/img/emoji/emotion_082.png.js +1 -1
  166. package/es/shared/assets/img/emoji/emotion_083.png.js +1 -1
  167. package/es/shared/assets/img/emoji/emotion_084.png.js +1 -1
  168. package/es/shared/assets/img/emoji/emotion_085.png.js +1 -1
  169. package/es/shared/assets/img/emoji/emotion_086.png.js +1 -1
  170. package/es/shared/assets/img/emoji/emotion_087.png.js +1 -1
  171. package/es/shared/assets/img/emoji/emotion_088.png.js +1 -1
  172. package/es/shared/assets/img/emoji/emotion_089.png.js +1 -1
  173. package/es/shared/assets/img/emoji/emotion_090.png.js +1 -1
  174. package/es/shared/assets/img/emoji/emotion_091.png.js +1 -1
  175. package/es/shared/assets/img/emoji/emotion_092.png.js +1 -1
  176. package/es/shared/assets/img/emoji/emotion_093.png.js +1 -1
  177. package/es/shared/assets/img/emoji/emotion_094.png.js +1 -1
  178. package/es/shared/assets/img/emoji/emotion_095.png.js +1 -1
  179. package/es/shared/assets/img/emoji/emotion_096.png.js +1 -1
  180. package/es/shared/assets/img/emoji/emotion_097.png.js +1 -1
  181. package/es/shared/assets/img/emoji/emotion_098.png.js +1 -1
  182. package/es/shared/assets/img/emoji/emotion_099.png.js +1 -1
  183. package/es/shared/assets/img/emoji/emotion_100.png.js +1 -1
  184. package/es/shared/assets/img/emoji/emotion_101.png.js +1 -1
  185. package/es/shared/assets/img/emoji/emotion_102.png.js +1 -1
  186. package/es/shared/assets/img/emoji/emotion_103.png.js +1 -1
  187. package/es/shared/assets/img/emoji/emotion_104.png.js +1 -1
  188. package/es/shared/assets/img/emoji/emotion_105.png.js +1 -1
  189. package/es/shared/assets/img/emoji/emotion_106.png.js +1 -1
  190. package/es/shared/assets/img/emoji/emotion_107.png.js +1 -1
  191. package/es/shared/assets/img/emoji/emotion_108.png.js +1 -1
  192. package/es/shared/assets/img/emoji/emotion_109.png.js +1 -1
  193. package/es/shared/assets/img/emoji/emotion_110.png.js +1 -1
  194. package/es/shared/assets/img/emoji/emotion_111.png.js +1 -1
  195. package/es/shared/assets/img/emoji/emotion_112.png.js +1 -1
  196. package/es/shared/assets/img/emoji/emotion_113.png.js +1 -1
  197. package/es/shared/assets/img/emoji/emotion_114.png.js +1 -1
  198. package/es/shared/assets/img/emoji/emotion_115.png.js +1 -1
  199. package/es/shared/assets/img/emoji/emotion_116.png.js +1 -1
  200. package/es/shared/assets/img/emoji/emotion_117.png.js +1 -1
  201. package/es/shared/assets/img/emoji/emotion_118.png.js +1 -1
  202. package/es/shared/assets/img/emoji/emotion_119.png.js +1 -1
  203. package/es/shared/assets/img/emoji/emotion_120.png.js +1 -1
  204. package/es/shared/assets/img/emoji/emotion_121.png.js +1 -1
  205. package/es/shared/assets/img/emoji/emotion_122.png.js +1 -1
  206. package/es/shared/assets/img/emoji/emotion_123.png.js +1 -1
  207. package/es/shared/assets/img/emoji/emotion_124.png.js +1 -1
  208. package/es/shared/assets/img/emoji/emotion_125.png.js +1 -1
  209. package/es/shared/assets/img/emoji/emotion_126.png.js +1 -1
  210. package/es/shared/assets/img/emoji/emotion_127.png.js +1 -1
  211. package/es/shared/assets/img/emoji/emotion_128.png.js +1 -1
  212. package/es/shared/assets/img/emoji/emotion_129.png.js +1 -1
  213. package/es/shared/assets/img/emoji/emotion_130.png.js +1 -1
  214. package/es/shared/assets/img/emoji/emotion_131.png.js +1 -1
  215. package/es/shared/assets/img/emoji/emotion_132.png.js +1 -1
  216. package/es/shared/assets/img/emoji/emotion_133.png.js +1 -1
  217. package/es/shared/assets/img/emoji/emotion_134.png.js +1 -1
  218. package/es/shared/assets/img/emoji/emotion_135.png.js +1 -1
  219. package/es/shared/assets/img/emoji/emotion_136.png.js +1 -1
  220. package/es/shared/assets/img/emoji/emotion_137.png.js +1 -1
  221. package/es/shared/assets/img/emoji/emotion_138.png.js +1 -1
  222. package/es/shared/assets/img/emoji/emotion_139.png.js +1 -1
  223. package/es/shared/assets/img/emoji/emotion_140.png.js +1 -1
  224. package/es/shared/assets/img/emoji/emotion_141.png.js +1 -1
  225. package/es/shared/assets/img/emoji/emotion_142.png.js +1 -1
  226. package/es/shared/assets/img/emoji/emotion_143.png.js +1 -1
  227. package/es/shared/assets/img/emoji/emotion_144.png.js +1 -1
  228. package/es/shared/assets/img/emoji/emotion_145.png.js +1 -1
  229. package/es/shared/assets/img/emoji/emotion_146.png.js +1 -1
  230. package/es/shared/assets/img/emoji/emotion_147.png.js +1 -1
  231. package/es/shared/assets/img/emoji/emotion_148.png.js +1 -1
  232. package/es/shared/assets/img/emoji/emotion_149.png.js +1 -1
  233. package/es/shared/assets/img/emoji/emotion_150.png.js +1 -1
  234. package/es/shared/assets/img/emoji/emotion_151.png.js +1 -1
  235. package/es/shared/assets/img/emoji/emotion_152.png.js +1 -1
  236. package/es/shared/assets/img/emoji/emotion_153.png.js +1 -1
  237. package/es/shared/assets/img/emoji/emotion_154.png.js +1 -1
  238. package/es/shared/assets/img/emoji/emotion_155.png.js +1 -1
  239. package/es/shared/assets/img/emoji/emotion_156.png.js +1 -1
  240. package/es/shared/assets/img/emoji/emotion_157.png.js +1 -1
  241. package/es/shared/assets/img/emoji/emotion_158.png.js +1 -1
  242. package/es/shared/assets/img/emoji/emotion_159.png.js +1 -1
  243. package/es/shared/assets/img/emoji/emotion_160.png.js +1 -1
  244. package/es/shared/assets/img/emoji/emotion_161.png.js +1 -1
  245. package/es/shared/assets/img/emoji/emotion_162.png.js +1 -1
  246. package/es/shared/assets/img/emoji/emotion_163.png.js +1 -1
  247. package/es/shared/assets/img/emoji/emotion_164.png.js +1 -1
  248. package/es/shared/assets/img/emoji/emotion_165.png.js +1 -1
  249. package/es/shared/assets/img/emoji/emotion_166.png.js +1 -1
  250. package/es/shared/assets/img/emoji/emotion_167.png.js +1 -1
  251. package/es/shared/assets/img/failure.png.js +1 -1
  252. package/es/shared/assets/img/no-permission.png.js +1 -1
  253. package/es/shared/assets/img/nodata.png.js +1 -1
  254. package/es/shared/assets/img/notfound.png.js +1 -1
  255. package/es/shared/assets/img/qr.png.js +1 -1
  256. package/es/shared/assets/img/success.png.js +1 -1
  257. package/es/shared/assets/img/table_style_2.png.js +1 -1
  258. package/es/shared/assets/img/video.png.js +1 -1
  259. package/es/shared/assets/img/video_default_cover.png.js +1 -1
  260. package/es/shared/assets/img/xb_big.png.js +1 -1
  261. package/es/shared/assets/img/xb_small.png.js +1 -1
  262. package/es/shared/package.json.js +1 -1
  263. package/package.json +2 -2
  264. package/es/components/bpmn-workflow/src/BpmnWorkflow.d.ts +0 -0
  265. package/es/components/bpmn-workflow/types/BpmnViewer.d.ts +0 -1
  266. package/es/components/bpmn-workflow/types/ModelingModule.d.ts +0 -1
  267. package/es/components/bpmn-workflow/types/MoveCanvasModule.d.ts +0 -1
  268. package/es/shared/assets/img/defaultCover/10reload.jpg.js +0 -1
  269. package/es/shared/assets/img/defaultCover/1tab.jpg.js +0 -1
  270. package/es/shared/assets/img/defaultCover/2menu.jpg.js +0 -1
  271. package/es/shared/assets/img/defaultCover/3view.jpg.js +0 -1
  272. package/es/shared/assets/img/defaultCover/4system.jpg.js +0 -1
  273. package/es/shared/assets/img/defaultCover/5location.jpg.js +0 -1
  274. package/es/shared/assets/img/defaultCover/6notfound.jpg.js +0 -1
  275. package/es/shared/assets/img/defaultCover/7loading.jpg.js +0 -1
  276. package/es/shared/assets/img/defaultCover/8nopermission.jpg.js +0 -1
  277. package/es/shared/assets/img/defaultCover/9nodata.jpg.js +0 -1
  278. package/es/shared/assets/img/emoji/emotion_168.png.js +0 -1
  279. package/es/shared/assets/img/emoji/emotion_169.png.js +0 -1
  280. package/es/shared/assets/img/emoji/emotion_170.png.js +0 -1
  281. package/es/shared/assets/img/emoji/emotion_171.png.js +0 -1
  282. package/es/shared/assets/img/emoji/emotion_172.png.js +0 -1
  283. package/es/shared/assets/img/emoji/emotion_173.png.js +0 -1
  284. package/es/shared/assets/img/emoji/emotion_174.png.js +0 -1
  285. package/es/shared/assets/img/emoji/emotion_175.png.js +0 -1
  286. package/es/shared/assets/img/emoji/emotion_176.png.js +0 -1
  287. package/es/shared/assets/img/emoji/emotion_177.png.js +0 -1
  288. package/es/shared/assets/img/emoji/emotion_178.png.js +0 -1
  289. package/es/shared/assets/img/emoji/emotion_179.png.js +0 -1
  290. package/es/shared/assets/img/emoji/emotion_180.png.js +0 -1
  291. package/es/shared/assets/img/emoji/emotion_181.png.js +0 -1
  292. package/es/shared/assets/img/emoji/emotion_182.png.js +0 -1
  293. package/es/shared/assets/img/emoji/emotion_183.png.js +0 -1
  294. package/es/shared/assets/img/emoji/emotion_184.png.js +0 -1
  295. package/es/shared/assets/img/emoji/emotion_185.png.js +0 -1
  296. package/es/shared/assets/img/emoji/emotion_186.png.js +0 -1
  297. package/es/shared/assets/img/emoji/emotion_187.png.js +0 -1
  298. package/es/shared/assets/img/emoji/emotion_188.png.js +0 -1
  299. package/es/shared/assets/img/emoji/emotion_189.png.js +0 -1
  300. package/es/shared/assets/img/emoji/emotion_190.png.js +0 -1
  301. package/es/shared/assets/img/emoji/emotion_191.png.js +0 -1
  302. package/es/shared/assets/img/emoji/emotion_192.png.js +0 -1
  303. package/es/shared/assets/img/emoji/emotion_193.png.js +0 -1
  304. package/es/shared/assets/img/emoji/emotion_194.png.js +0 -1
  305. package/es/shared/assets/img/emoji/emotion_195.png.js +0 -1
  306. package/es/shared/assets/img/emoji/emotion_196.png.js +0 -1
  307. package/es/shared/components/VueDraggable/src/vuedraggable.d.ts +0 -86
  308. package/es/shared/utils/fabricjs/index.d.ts +0 -6823
  309. package/es/shared/utils/tapable/index.d.ts +0 -139
@@ -1 +1 @@
1
- import{onUnmounted as e}from"vue";import{fabric as t}from"../../../../../shared/utils/fabricjs/index.js";import{defaultStyle as n,drawLine as i,drawPoint as o}from"../useDraw.js";import{useGrid as l}from"../useGrid.js";import{useBirthProcessCumputedPoint as r}from"../useCumputedPoint.js";import{bus as s}from"../useEvent.js";import{useCommon as a}from"../useCommon.js";import{getPointRange as f,getIndex as u,isEffectiveNode as c,getTime as p}from"../../utils/index.js";import{cloneDeep as d,last as m,omit as v,flatten as g}from"lodash-es";import"date-fns";import"../temperature/useShadow.js";import"naive-ui";import{useIntervalFn as y}from"@vueuse/core";function h(h,k,x,L,P,w){const{computedX:b,computedY:A,getXValue:I,getYValue:C}=r(k),{xCellWidth:K,pointSelectionStyle:E,originX:j,endX:T,originY:X,endY:V,event:Y,scaleValues:M,xAxis:S,startTime:D,timeXCell:O,itemList:$,dialog:F,topGridOriginY:_,topGridEndY:z}=k,G=new Map,N=new Set,J=d(M);let q=[],R=null;const W=new Set;l(h,k);const{getEqualXTypes:B,handleAddPrevent:H,setPrevAndNextPoint:Q,getPointEventProps:U}=a(h,x,k),{pause:Z,resume:ee}=y((()=>{!function(){if(!W.size)return;for(const e of W)e.set("opacity",1===e.opacity?.5:1);h.value.renderAll()}()}),800);function te(){J.forEach((e=>{const{range:t=[],spaceValue:n}=e;n&&(t[0]||t[1])&&e.dataList.forEach(((t,n)=>{t.show&&(!function(e,t){const{max:n={},min:o={}}=e.panicValue||{},{max:l={},min:r={}}=e.diffValue||{};function s({show:e=!1,value:n,name:o,lineStyle:l}){if(!e||!n)return;const r=A(t.type,t.range,n),s=i([j,r,T,r],{...l,evented:!0,lockMovementX:!0,lockMovementY:!0,hoverCursor:"pointer"});Y.hovered&&o&&(s.on("mousemove",(({pointer:e})=>{L.point={...e||{x:s.left,y:s.top}},L.list=[`${o} ${n}${t.unit||""}`],L.show=!0})),s.on("mouseout",(()=>{L.show=!1}))),h.value.add(s)}s(n),s(o),s(l),s(r)}(t,e),le(t,n,e))}))}))}function ne(e=[]){if(!(null==R?void 0:R.areaPos))return[];const{startPos:t,endPos:n}=R.areaPos,[i,o]=[t.x,n.x].sort(((e,t)=>e-t)),[l,r]=[t.y,n.y].sort(((e,t)=>e-t));return(e.length?e:me()).filter((e=>e.left>=i&&e.left<=o&&e.top>=l&&e.top<=r))}function ie(e){F.warning({maskClosable:!1,closeOnEsc:!1,title:"警告",content:"确认删除当前选中的节点?",positiveText:"确定",negativeText:"取消",onPositiveClick:()=>{e(),oe()},onNegativeClick:()=>oe(),onClose:()=>oe()})}function oe(){R&&h.value.remove(R),R=null}function le(e,t,n){var l;const{type:r,unit:s,dataList:a=[]}=n,f=[];G.set(e.key,[]),function(e,t){W.size&&[...W].forEach((n=>{const{dataIndex:i,type:o}=n.origin;i===t&&o===e&&W.delete(n)}))}(r,t),null==(l=e.list)||l.forEach(((l,u)=>{!function(e,l,u,c){var p;let d,g,y=c;l.key&&(y=a.find((e=>e.key===l.key)));const{pointAttr:k={},lineAttr:P={},title:w="",key:b,type:A="circle"}=y,E=de(c.list[u+1],n);e&&E&&!l.breakpoint&&e[0]!==E[0]&&(g=i([...e,...E],P));const j=f[u-1],T={origin:{data:l,title:w,key:c.key,selfKey:b,unit:s,type:r,dataIndex:t,index:u,lineAttr:P},__type:"main",leftLine:j,rightLine:g,...k,...U()};e&&(j||(T.leftLine=null),d=o(A,{left:e[0],top:e[1],...T}));f.push(g),d&&(d.originLeft=d.left,d.originTop=d.top,function(e){Y.hovered&&(e.on("mouseover",(()=>{ce(e,"hover")})),e.on("mouseout",(()=>{L.show=!1})));if(e.lockMovementX&&e.lockMovementY)return;e.on("moving",(()=>{pe(e),function(e){var t,n;null==(t=e.leftLine)||t.setCoords().set({x2:e.left,y2:e.top}),null==(n=e.rightLine)||n.setCoords().set({x1:e.left,y1:e.top})}(e),Y.hovered&&ce(e),function(e){var t,n,i,o;const{originLeft:l,originTop:r,left:s,top:a,origin:f}=e,u=~~((s-l)/K);if(s>l+K){if(0===q.length){se(e,[...e.leftLine?[e.leftLine.x1,e.leftLine.y1]:[l,r],l,r]),null==(n=null==(t=e.leftLine)?void 0:t.set)||n.call(t,"stroke","transparent"),null==(o=null==(i=e.rightLine)?void 0:i.set)||o.call(i,"stroke","transparent")}const c=l+K*u;if(q.every((e=>e.left!==c))){const t=I(c),n=C(f.type,a);q.push({data:{time:t,value:n,...f.selfKey!==f.key?{key:f.selfKey}:{}},left:c,top:a}),se(e,[...e.prevPointer,c,a])}if(q.length<u&&function(e,t){const{originLeft:n,originTop:i,origin:o}=e;let l=1;for(;l<=t;){const t=n+K*l,r=q.some((e=>Math.abs(e.left-t)<=1));if(!r){let l=0;const r=q.find(((e,n)=>(e.left>t&&(l=n),e.left>t)));if(r){const s=JSON.parse(JSON.stringify(r)),a=q[l-1]||{left:n,top:i},f=~~((r.left-(t-K))/K),u=(r.top-a.top)/f;s.top=a.top+u,s.left=t,s.data={time:I(t),value:C(o.type,s.top),...o.selfKey!==o.key?{key:o.selfKey}:{}},q.splice(l,0,s),se(e,[a.left,a.top,s.left,s.top])}}l++}}(e,u),e.nextPoint){const t=G.get(f.key);!function(e,t){const{left:n,top:i,origin:o}=t,l=K/2,r=e.findIndex((e=>Math.abs(n-e.left)<l&&Math.abs(i-e.top)<l&&o.index!==e.origin.index));r>-1?(t.set({scaleX:2.5,scaleY:2.5}),t.coincidePoint=e[r]):t.set({scaleX:t.scale,scaleY:t.scale})}(t,e),null==t||t.forEach((e=>{e.left<=l||f.index===e.origin.index||(e.left<s?re(e,"#999"):re(e,e.origin.lineAttr.stroke))}))}}!function(e){var t,n;const{left:i}=e;if(q.length>0&&i<q[q.length-1].left){for(const e of N)e.left>i&&(e.leftLine&&h.value.remove(e.leftLine),h.value.remove(e));if(q=q.filter((e=>e.left<=i)),0===q.length){null==(n=null==(t=e.leftLine)?void 0:t.set)||n.call(t,e.origin.lineAttr);for(const e of N)e.leftLine&&h.value.remove(e.leftLine),h.value.remove(e)}if(q.length>0){const t=m(q);e.prevPointer=[t.left,t.top]}}}(e)}(e)})),e.on("mouseup",(t=>{if(L.show=!1,1===t.button){const{type:t,selfKey:n,dataIndex:i}=e.origin,o={...e.origin,data:{...e.origin.data,time:I(e.left),value:C(t,e.top)}};if(h.value.discardActiveObject(),q.length>0){const l=J.find((e=>e.type===t));let r=-1;const s=q.map((e=>e.data));if(e.nextPoint){if(2.5!==e.scaleX)return void fe({dataIndex:i,scaleValue:l});const t=e.coincidePoint.origin,n=t.data;r=t.index;const o=s.findIndex((e=>e.time===n.time));o>-1?s[o].value=n.value:s.push({...m(s),time:n.time,value:n.value})}const a=l.dataList.findIndex((e=>e.key===n));x("add",{...v(o,["index","selfKey","lineAttr"]),dataIndex:a,key:n,data:s}),ae({...o,data:s,coincideIndex:r})}else x("change",{...v(o,["selfKey","lineAttr"]),key:n}),ae(o,"change")}}))}(d),null==(p=G.get(c.key))||p.push(d))}(de(l,n),l,u,e)})),Promise.all(G.get(e.key)).then((t=>{const n=f.filter((e=>e));Q(t),h.value.add(...n,...t),function(e,t){const{max:n={},min:i={}}=t.panicValue||{},{max:o={},min:l={}}=t.diffValue||{};function r({show:t=!1,value:n,flickerable:i},o){!t&&n&&i&&e.forEach((e=>{const t=e.origin.data.value;"max"===o&&t<n||"min"===o&&t>n||W.add(e)}))}r(n,"max"),r(i,"min"),r(o,"max"),r(l,"min")}(t,e)}))}function re(e,t){["stroke","fill"].forEach((n=>{const i=e[n];i&&!["transparent","#fff","#ffffff","#FFFFFF"].includes(i)&&i!==t&&e.set(n,t)})),e.rightLine&&e.rightLine.stroke!==t&&e.rightLine.set("stroke",t)}function se(e,t){const[,,n,o]=t;e.clone((l=>{l.set({left:n,top:o,scaleX:1,scaleY:1}),e.prevPointer=[n,o];const r=i(t,e.origin.lineAttr);l.leftLine=r,N.add(l),h.value.add(r,l)}))}function ae(e,t="add",n=1){const{data:i,index:o,key:l,type:r,coincideIndex:s}=e;let{dataIndex:a}=e;const f=J.find((e=>e.type===r)),c=f.dataList.find(((e,t)=>(a=t,e.key===l)));switch(t){case"remove":c.list.splice(o,n),c.list[o-1]&&(c.list[o-1].breakpoint=!0);break;case"change":c.list[o]=i;break;default:{const e=Array.isArray(i)?i[0].time:i.time,t=u(e,c.list),n=Array.isArray(i)?i:[i];c.list.splice(t,s>-1?s-t+1:0,...n);break}}fe({dataIndex:a,scaleValue:f})}function fe(e){var t,n,i;if(N.size&&(null==(t=h.value)||t.remove(...ue([...N]))),N.clear(),q=[],e){const{dataIndex:t,scaleValue:i}=e,o=i.dataList[t];null==(n=h.value)||n.remove(...ue(G.get(o.key))),G.delete(o.key),le(o,t,i)}else G.size&&(null==(i=h.value)||i.remove(...ue(me()))),G.clear(),te()}function ue(e){const t=[];return e.forEach((e=>{e&&t.push(e),(null==e?void 0:e.leftLine)&&t.push(null==e?void 0:e.leftLine),(null==e?void 0:e.rightLine)&&t.push(null==e?void 0:e.rightLine)})),t}function ce(e,t="moving"){const{title:n,type:i,data:o,unit:l,selfKey:r}=e.origin;L.point={x:e.left,y:e.top};const s=I(e.left),a=`${"hover"===t?o.value:C(i,e.top)}`;L.list=[`${n} ${a}${l||""}`,`时间 ${s.slice(-5)}`],L.sourceData=[{type:i,title:n,unit:l,key:r,time:s,value:a}],L.isTarget=!0,L.show=!0}function pe(e){e.setCoords();const t=6e4/O,n=e.prevPoint?e.prevPoint.left+t:j,i=T;e.top<X&&e.set("top",X),e.top>V&&e.set("top",V),e.left<n&&e.set("left",n),e.left>i&&e.set("left",i)}function de(e,t){if(c(e)&&function(e){const t=Date.parse(m(S.list)),n=p(e);return n>=D&&n<=t}(e.time)){const n=b(e.time),i=A(t.type,t.range,e.value);return[n,i<X?X:i>V?V:i]}}function me(){return g(Array.from(G.values()))}return e((()=>{Z()})),te(),function(){if(!Y.evented)return;let e=!1,i={x:0,y:0};h.value.on("mouse:up",(t=>{if(3===t.button&&function(e){L.show=!1;const{x:t=0,y:n=0}=e.pointer||{};if(t>=j&&t<=T&&n>=X&&n<=V)if(e.target){if("main"!==e.target.__type)return;i(e.pointer,e.target,["删除节点"]);const{minLeft:t,maxLeft:n,minTop:o,maxTop:l}=f(e.target);me().forEach((i=>{"main"===i.__type&&i.left>t&&i.left<n&&i.top>o&&i.top<l&&P.list.push({renderItem:()=>i.origin.title,origin:{...i.origin},mode:"remove",pointer:e.pointer})})),1===P.list.length&&(P.show=!1,console.log("当前时间段内无可删除节点"))}else i(e.pointer,null,["新增节点"]),$.forEach((n=>{B(me(),t,"key",2*K).includes(n.linkKey||n.key)||P.list.push({renderItem:()=>n.title,origin:{title:n.title,unit:n.unit,type:n.bigType,dataIndex:n.dataIndex,key:n.key,linkKey:n.linkKey},pointer:e.pointer})})),1===P.list.length&&(P.show=!1,H("repeat"),console.log("当前时间段内无可新增节点"));function i(e,t,n){Object.assign(P,{point:e,show:!0,target:t,list:n})}}(t),1===t.button&&e){e=!1;const t=ne();t.length>0?ie((()=>{const e=function(e){const t=e.reduce(((e,t)=>{const{key:n}=t.origin;return e[n]=e[n]?e[n].concat(t.origin):[t.origin],e}),{});return Object.keys(t).map((e=>{const n=t[e].sort(((e,t)=>Date.parse(e.data.time)-Date.parse(t.data.time)));return ae(n[0],"remove",n.length),n.map((e=>({...v(e,["selfKey","lineAttr"]),key:e.selfKey})))}))}(t);x("remove",e)})):s.emit(R)}})),h.value.on("mouse:down",(t=>{1!==t.button||t.target||(e=!0,i=t.pointer)})),h.value.on("mouse:move",(o=>{if(function(e){if(!w||P.show)return;const{target:t,pointer:n}=e,{x:i=0,y:o=0}=n;L.movable=!1,(i<j||i>T)&&(L.show=!1);if(!t&&i>=j&&i<=T){const e=o>=X&&o<=V,l=o>=_&&o<=z;if(e||l){const l=I(i);L.sourceData=e?J.map((e=>{const{type:t,title:n,unit:i}=e;return{type:t,title:n,unit:i,time:l,value:C(t,o)}})):[{type:"tree",time:l}],L.isTarget=!!t,L.point=n,L.movable=!0}else L.show=!1}}(o),!e)return;const{x:l,y:r}=i,{x:s,y:a}=o.pointer;R&&h.value.remove(R),R=new t.Rect({...n,fill:"#CAF982",opacity:.4,...E,left:l,top:r,width:s-l,height:a-r,objectCaching:!0}),R.areaPos={startPos:i,endPos:o.pointer},h.value.add(R)}))}(),{redrawPoints:fe,clickMenu:function({item:e,target:t}){const n={...e.origin};"remove"===e.mode?(x("remove",n),ae(n,"remove")):(Object.assign(n,{data:{time:I(e.pointer.x),value:C(e.origin.type,e.pointer.y),...e.origin.linkKey?{key:e.origin.key}:{}}}),x("add",n),ae({...n,key:e.origin.linkKey||e.origin.key}))},moveLimit:pe,setPopup:ce,updateData:ae,getGridPoints:me,getContainPoints:ne,showDialog:ie,removeCurrentSelection:oe}}export{h as useCenter};
1
+ import{onUnmounted as e}from"vue";import{fabric as t}from"../../../../../shared/utils/fabricjs/index.js";import{defaultStyle as n,drawLine as i,drawPoint as o}from"../useDraw.js";import{useGrid as l}from"../useGrid.js";import{useBirthProcessCumputedPoint as r}from"../useCumputedPoint.js";import{bus as s}from"../useEvent.js";import{useCommon as a}from"../useCommon.js";import{getPointRange as f,getIndex as u,isEffectiveNode as c,getTime as p}from"../../utils/index.js";import{cloneDeep as d,last as m,omit as v,flatten as g}from"lodash-es";import"date-fns";import"../temperature/useShadow.js";import"@vueuse/shared";import"naive-ui";import{useIntervalFn as y}from"@vueuse/core";function h(h,k,x,L,P,w){const{computedX:b,computedY:A,getXValue:I,getYValue:C}=r(k),{xCellWidth:K,pointSelectionStyle:E,originX:j,endX:T,originY:X,endY:V,event:Y,scaleValues:M,xAxis:S,startTime:D,timeXCell:O,itemList:$,dialog:F,topGridOriginY:_,topGridEndY:z}=k,G=new Map,N=new Set,J=d(M);let q=[],R=null;const W=new Set;l(h,k);const{getEqualXTypes:B,handleAddPrevent:H,setPrevAndNextPoint:Q,getPointEventProps:U}=a(h,x,k),{pause:Z,resume:ee}=y((()=>{!function(){if(!W.size)return;for(const e of W)e.set("opacity",1===e.opacity?.5:1);h.value.renderAll()}()}),800);function te(){J.forEach((e=>{const{range:t=[],spaceValue:n}=e;n&&(t[0]||t[1])&&e.dataList.forEach(((t,n)=>{t.show&&(!function(e,t){const{max:n={},min:o={}}=e.panicValue||{},{max:l={},min:r={}}=e.diffValue||{};function s({show:e=!1,value:n,name:o,lineStyle:l}){if(!e||!n)return;const r=A(t.type,t.range,n),s=i([j,r,T,r],{...l,evented:!0,lockMovementX:!0,lockMovementY:!0,hoverCursor:"pointer"});Y.hovered&&o&&(s.on("mousemove",(({pointer:e})=>{L.point={...e||{x:s.left,y:s.top}},L.list=[`${o} ${n}${t.unit||""}`],L.show=!0})),s.on("mouseout",(()=>{L.show=!1}))),h.value.add(s)}s(n),s(o),s(l),s(r)}(t,e),le(t,n,e))}))}))}function ne(e=[]){if(!(null==R?void 0:R.areaPos))return[];const{startPos:t,endPos:n}=R.areaPos,[i,o]=[t.x,n.x].sort(((e,t)=>e-t)),[l,r]=[t.y,n.y].sort(((e,t)=>e-t));return(e.length?e:me()).filter((e=>e.left>=i&&e.left<=o&&e.top>=l&&e.top<=r))}function ie(e){F.warning({maskClosable:!1,closeOnEsc:!1,title:"警告",content:"确认删除当前选中的节点?",positiveText:"确定",negativeText:"取消",onPositiveClick:()=>{e(),oe()},onNegativeClick:()=>oe(),onClose:()=>oe()})}function oe(){R&&h.value.remove(R),R=null}function le(e,t,n){var l;const{type:r,unit:s,dataList:a=[]}=n,f=[];G.set(e.key,[]),function(e,t){W.size&&[...W].forEach((n=>{const{dataIndex:i,type:o}=n.origin;i===t&&o===e&&W.delete(n)}))}(r,t),null==(l=e.list)||l.forEach(((l,u)=>{!function(e,l,u,c){var p;let d,g,y=c;l.key&&(y=a.find((e=>e.key===l.key)));const{pointAttr:k={},lineAttr:P={},title:w="",key:b,type:A="circle"}=y,E=de(c.list[u+1],n);e&&E&&!l.breakpoint&&e[0]!==E[0]&&(g=i([...e,...E],P));const j=f[u-1],T={origin:{data:l,title:w,key:c.key,selfKey:b,unit:s,type:r,dataIndex:t,index:u,lineAttr:P},__type:"main",leftLine:j,rightLine:g,...k,...U()};e&&(j||(T.leftLine=null),d=o(A,{left:e[0],top:e[1],...T}));f.push(g),d&&(d.originLeft=d.left,d.originTop=d.top,function(e){Y.hovered&&(e.on("mouseover",(()=>{ce(e,"hover")})),e.on("mouseout",(()=>{L.show=!1})));if(e.lockMovementX&&e.lockMovementY)return;e.on("moving",(()=>{pe(e),function(e){var t,n;null==(t=e.leftLine)||t.setCoords().set({x2:e.left,y2:e.top}),null==(n=e.rightLine)||n.setCoords().set({x1:e.left,y1:e.top})}(e),Y.hovered&&ce(e),function(e){var t,n,i,o;const{originLeft:l,originTop:r,left:s,top:a,origin:f}=e,u=~~((s-l)/K);if(s>l+K){if(0===q.length){se(e,[...e.leftLine?[e.leftLine.x1,e.leftLine.y1]:[l,r],l,r]),null==(n=null==(t=e.leftLine)?void 0:t.set)||n.call(t,"stroke","transparent"),null==(o=null==(i=e.rightLine)?void 0:i.set)||o.call(i,"stroke","transparent")}const c=l+K*u;if(q.every((e=>e.left!==c))){const t=I(c),n=C(f.type,a);q.push({data:{time:t,value:n,...f.selfKey!==f.key?{key:f.selfKey}:{}},left:c,top:a}),se(e,[...e.prevPointer,c,a])}if(q.length<u&&function(e,t){const{originLeft:n,originTop:i,origin:o}=e;let l=1;for(;l<=t;){const t=n+K*l,r=q.some((e=>Math.abs(e.left-t)<=1));if(!r){let l=0;const r=q.find(((e,n)=>(e.left>t&&(l=n),e.left>t)));if(r){const s=JSON.parse(JSON.stringify(r)),a=q[l-1]||{left:n,top:i},f=~~((r.left-(t-K))/K),u=(r.top-a.top)/f;s.top=a.top+u,s.left=t,s.data={time:I(t),value:C(o.type,s.top),...o.selfKey!==o.key?{key:o.selfKey}:{}},q.splice(l,0,s),se(e,[a.left,a.top,s.left,s.top])}}l++}}(e,u),e.nextPoint){const t=G.get(f.key);!function(e,t){const{left:n,top:i,origin:o}=t,l=K/2,r=e.findIndex((e=>Math.abs(n-e.left)<l&&Math.abs(i-e.top)<l&&o.index!==e.origin.index));r>-1?(t.set({scaleX:2.5,scaleY:2.5}),t.coincidePoint=e[r]):t.set({scaleX:t.scale,scaleY:t.scale})}(t,e),null==t||t.forEach((e=>{e.left<=l||f.index===e.origin.index||(e.left<s?re(e,"#999"):re(e,e.origin.lineAttr.stroke))}))}}!function(e){var t,n;const{left:i}=e;if(q.length>0&&i<q[q.length-1].left){for(const e of N)e.left>i&&(e.leftLine&&h.value.remove(e.leftLine),h.value.remove(e));if(q=q.filter((e=>e.left<=i)),0===q.length){null==(n=null==(t=e.leftLine)?void 0:t.set)||n.call(t,e.origin.lineAttr);for(const e of N)e.leftLine&&h.value.remove(e.leftLine),h.value.remove(e)}if(q.length>0){const t=m(q);e.prevPointer=[t.left,t.top]}}}(e)}(e)})),e.on("mouseup",(t=>{if(L.show=!1,1===t.button){const{type:t,selfKey:n,dataIndex:i}=e.origin,o={...e.origin,data:{...e.origin.data,time:I(e.left),value:C(t,e.top)}};if(h.value.discardActiveObject(),q.length>0){const l=J.find((e=>e.type===t));let r=-1;const s=q.map((e=>e.data));if(e.nextPoint){if(2.5!==e.scaleX)return void fe({dataIndex:i,scaleValue:l});const t=e.coincidePoint.origin,n=t.data;r=t.index;const o=s.findIndex((e=>e.time===n.time));o>-1?s[o].value=n.value:s.push({...m(s),time:n.time,value:n.value})}const a=l.dataList.findIndex((e=>e.key===n));x("add",{...v(o,["index","selfKey","lineAttr"]),dataIndex:a,key:n,data:s}),ae({...o,data:s,coincideIndex:r})}else x("change",{...v(o,["selfKey","lineAttr"]),key:n}),ae(o,"change")}}))}(d),null==(p=G.get(c.key))||p.push(d))}(de(l,n),l,u,e)})),Promise.all(G.get(e.key)).then((t=>{const n=f.filter((e=>e));Q(t),h.value.add(...n,...t),function(e,t){const{max:n={},min:i={}}=t.panicValue||{},{max:o={},min:l={}}=t.diffValue||{};function r({show:t=!1,value:n,flickerable:i},o){!t&&n&&i&&e.forEach((e=>{const t=e.origin.data.value;"max"===o&&t<n||"min"===o&&t>n||W.add(e)}))}r(n,"max"),r(i,"min"),r(o,"max"),r(l,"min")}(t,e)}))}function re(e,t){["stroke","fill"].forEach((n=>{const i=e[n];i&&!["transparent","#fff","#ffffff","#FFFFFF"].includes(i)&&i!==t&&e.set(n,t)})),e.rightLine&&e.rightLine.stroke!==t&&e.rightLine.set("stroke",t)}function se(e,t){const[,,n,o]=t;e.clone((l=>{l.set({left:n,top:o,scaleX:1,scaleY:1}),e.prevPointer=[n,o];const r=i(t,e.origin.lineAttr);l.leftLine=r,N.add(l),h.value.add(r,l)}))}function ae(e,t="add",n=1){const{data:i,index:o,key:l,type:r,coincideIndex:s}=e;let{dataIndex:a}=e;const f=J.find((e=>e.type===r)),c=f.dataList.find(((e,t)=>(a=t,e.key===l)));switch(t){case"remove":c.list.splice(o,n),c.list[o-1]&&(c.list[o-1].breakpoint=!0);break;case"change":c.list[o]=i;break;default:{const e=Array.isArray(i)?i[0].time:i.time,t=u(e,c.list),n=Array.isArray(i)?i:[i];c.list.splice(t,s>-1?s-t+1:0,...n);break}}fe({dataIndex:a,scaleValue:f})}function fe(e){var t,n,i;if(N.size&&(null==(t=h.value)||t.remove(...ue([...N]))),N.clear(),q=[],e){const{dataIndex:t,scaleValue:i}=e,o=i.dataList[t];null==(n=h.value)||n.remove(...ue(G.get(o.key))),G.delete(o.key),le(o,t,i)}else G.size&&(null==(i=h.value)||i.remove(...ue(me()))),G.clear(),te()}function ue(e){const t=[];return e.forEach((e=>{e&&t.push(e),(null==e?void 0:e.leftLine)&&t.push(null==e?void 0:e.leftLine),(null==e?void 0:e.rightLine)&&t.push(null==e?void 0:e.rightLine)})),t}function ce(e,t="moving"){const{title:n,type:i,data:o,unit:l,selfKey:r}=e.origin;L.point={x:e.left,y:e.top};const s=I(e.left),a=`${"hover"===t?o.value:C(i,e.top)}`;L.list=[`${n} ${a}${l||""}`,`时间 ${s.slice(-5)}`],L.sourceData=[{type:i,title:n,unit:l,key:r,time:s,value:a}],L.isTarget=!0,L.show=!0}function pe(e){e.setCoords();const t=6e4/O,n=e.prevPoint?e.prevPoint.left+t:j,i=T;e.top<X&&e.set("top",X),e.top>V&&e.set("top",V),e.left<n&&e.set("left",n),e.left>i&&e.set("left",i)}function de(e,t){if(c(e)&&function(e){const t=Date.parse(m(S.list)),n=p(e);return n>=D&&n<=t}(e.time)){const n=b(e.time),i=A(t.type,t.range,e.value);return[n,i<X?X:i>V?V:i]}}function me(){return g(Array.from(G.values()))}return e((()=>{Z()})),te(),function(){if(!Y.evented)return;let e=!1,i={x:0,y:0};h.value.on("mouse:up",(t=>{if(3===t.button&&function(e){L.show=!1;const{x:t=0,y:n=0}=e.pointer||{};if(t>=j&&t<=T&&n>=X&&n<=V)if(e.target){if("main"!==e.target.__type)return;i(e.pointer,e.target,["删除节点"]);const{minLeft:t,maxLeft:n,minTop:o,maxTop:l}=f(e.target);me().forEach((i=>{"main"===i.__type&&i.left>t&&i.left<n&&i.top>o&&i.top<l&&P.list.push({renderItem:()=>i.origin.title,origin:{...i.origin},mode:"remove",pointer:e.pointer})})),1===P.list.length&&(P.show=!1,console.log("当前时间段内无可删除节点"))}else i(e.pointer,null,["新增节点"]),$.forEach((n=>{B(me(),t,"key",2*K).includes(n.linkKey||n.key)||P.list.push({renderItem:()=>n.title,origin:{title:n.title,unit:n.unit,type:n.bigType,dataIndex:n.dataIndex,key:n.key,linkKey:n.linkKey},pointer:e.pointer})})),1===P.list.length&&(P.show=!1,H("repeat"),console.log("当前时间段内无可新增节点"));function i(e,t,n){Object.assign(P,{point:e,show:!0,target:t,list:n})}}(t),1===t.button&&e){e=!1;const t=ne();t.length>0?ie((()=>{const e=function(e){const t=e.reduce(((e,t)=>{const{key:n}=t.origin;return e[n]=e[n]?e[n].concat(t.origin):[t.origin],e}),{});return Object.keys(t).map((e=>{const n=t[e].sort(((e,t)=>Date.parse(e.data.time)-Date.parse(t.data.time)));return ae(n[0],"remove",n.length),n.map((e=>({...v(e,["selfKey","lineAttr"]),key:e.selfKey})))}))}(t);x("remove",e)})):s.emit(R)}})),h.value.on("mouse:down",(t=>{1!==t.button||t.target||(e=!0,i=t.pointer)})),h.value.on("mouse:move",(o=>{if(function(e){if(!w||P.show)return;const{target:t,pointer:n}=e,{x:i=0,y:o=0}=n;L.movable=!1,(i<j||i>T)&&(L.show=!1);if(!t&&i>=j&&i<=T){const e=o>=X&&o<=V,l=o>=_&&o<=z;if(e||l){const l=I(i);L.sourceData=e?J.map((e=>{const{type:t,title:n,unit:i}=e;return{type:t,title:n,unit:i,time:l,value:C(t,o)}})):[{type:"tree",time:l}],L.isTarget=!!t,L.point=n,L.movable=!0}else L.show=!1}}(o),!e)return;const{x:l,y:r}=i,{x:s,y:a}=o.pointer;R&&h.value.remove(R),R=new t.Rect({...n,fill:"#CAF982",opacity:.4,...E,left:l,top:r,width:s-l,height:a-r,objectCaching:!0}),R.areaPos={startPos:i,endPos:o.pointer},h.value.add(R)}))}(),{redrawPoints:fe,clickMenu:function({item:e,target:t}){const n={...e.origin};"remove"===e.mode?(x("remove",n),ae(n,"remove")):(Object.assign(n,{data:{time:I(e.pointer.x),value:C(e.origin.type,e.pointer.y),...e.origin.linkKey?{key:e.origin.key}:{}}}),x("add",n),ae({...n,key:e.origin.linkKey||e.origin.key}))},moveLimit:pe,setPopup:ce,updateData:ae,getGridPoints:me,getContainPoints:ne,showDialog:ie,removeCurrentSelection:oe}}export{h as useCenter};
@@ -1 +1 @@
1
- import{fabric as t}from"../../../../../shared/utils/fabricjs/index.js";import{drawTextGroup as e,defaultRectStyle as i,drawTextAndIconGroup as o,drawText as n,defaultTextStyle as r,defaultStyle as l}from"../useDraw.js";import{useBirthProcessCumputedPoint as s}from"../useCumputedPoint.js";import"../useEvent.js";import{drawScaleNumber as a}from"../useScaleColumn.js";import{useCommon as u}from"../useCommon.js";import"vue";import{getScaleNumberList as d}from"../../utils/index.js";import{cloneDeep as c,last as f}from"lodash-es";import"date-fns";import"../temperature/useShadow.js";import"naive-ui";import"@vueuse/core";function p(p,g,h,m,v,y,k,w){const{getYValue:j,getXValue:x}=s(g),{getEqualXTypes:b,handleAddPrevent:X,isGridLimit:W}=u(p,h,g),{originY:C,endY:E,borderStyle:S,left:Y,itemList:K,scaleValues:L,originX:M,endX:N,yCellHeight:V,markHeight:G,canvasWidth:H,canvasHeight:T,xCellWidth:A}=g;!function(){if(!Y)return;const{title:t,titleWidth:i,titleStyle:o}=Y,n=e({width:i,height:E-C+G,...S},{value:t.split("").join("\n"),...o||{}},{left:0,top:C},!0);p.value.add(n)}(),L.forEach(((e,i)=>{var o,s;const{range:u,spaceValue:c,title:g,unit:h,titleStyle:m,spaceGridNumber:v=1,showNumber:y,showMaxMinNumber:k,titleMargin:w=[5,30],margin:j=5}=e,x="left"===e.layout?M-j:N+j,b=[],X=d(u,c),W=X.length;X.forEach(((t,i)=>{const o=0===i?E-5:E-i*V*v;!y||(0===i||i===W-1)&&!k||b.push(a(String(t),{...e,position:e.layout},x,o))}));const C="left"===e.layout?"right":"left",S=(g||h)&&n(["left"===e.layout?M-w[0]:N+w[0],(null!=(s=null==(o=f(b))?void 0:o.top)?s:330)-V-w[1]],{value:`${g}${h?"\n"+h:""}`,...r,...m,textAlign:C,originX:C,originY:"bottom"}),Y=new t.Group([...b,...S?[S]:[]],{objectCaching:!1,...l});p.value.add(Y),Y.sendToBack()})),function(){const e=new t.Rect({width:M-Y.titleWidth,height:E-C+G,left:Y.titleWidth,top:C,...i,originX:"left",originY:"top",...S});p.value.add(e);const n=c(K),r=c(Y.externalIconList||[]).map((t=>({...t,isExternal:!0}))),{projectNameMargin:l=[5,30],titleWidth:s=20}=Y;let a=E+G-l[0];const u=s+l[1];r.concat(n.reverse()).forEach((t=>{a-=10;const e=t.title,{text:i,icon:n}=o(e,t,{text:{left:u,top:a},icon:{leftX:u,topY:a,originX:"center",...t.isExternal?{evented:!1,selectable:!1}:{},origin:{linkKey:t.linkKey}}});var r;a-=i.height||30,n.set("left",n.left+n.width/2),(r=n).on("moving",(()=>{r.set("originX","center"),W(r)?(v(r),y(r)):m.show=!1})),r.on("mouseup:before",(t=>{if(m.show=!1,0===t.e.button&&W(r)){const t=r.origin.linkKey||r.origin.key;if(b(w(),r.left,"key",2*A).includes(t))X("repeat");else{const e={data:{time:x(r.left),value:j(r.origin.type,r.top),...r.origin.linkKey?{key:r.origin.key}:{}},...r.origin};h("add",e),k({...e,key:t})}}!function(t){t.setCoords().set({originX:"left",left:t.originLeft,top:t.originTop})}(r)})),p.value.add(i,n)}))}(),p.value.add(new t.Rect({left:0,top:0,width:H-S.strokeWidth,height:T-S.strokeWidth,fill:"transparent",...S}))}export{p as useLeft};
1
+ import{fabric as t}from"../../../../../shared/utils/fabricjs/index.js";import{drawTextGroup as e,defaultRectStyle as i,drawTextAndIconGroup as o,drawText as n,defaultTextStyle as r,defaultStyle as l}from"../useDraw.js";import{useBirthProcessCumputedPoint as s}from"../useCumputedPoint.js";import"../useEvent.js";import{drawScaleNumber as a}from"../useScaleColumn.js";import{useCommon as u}from"../useCommon.js";import"vue";import{getScaleNumberList as d}from"../../utils/index.js";import{cloneDeep as c,last as p}from"lodash-es";import"date-fns";import"../temperature/useShadow.js";import"@vueuse/shared";import"naive-ui";import"@vueuse/core";function f(f,h,m,g,v,y,k,w){const{getYValue:j,getXValue:x}=s(h),{getEqualXTypes:b,handleAddPrevent:X,isGridLimit:W}=u(f,m,h),{originY:C,endY:E,borderStyle:S,left:Y,itemList:K,scaleValues:L,originX:M,endX:N,yCellHeight:V,markHeight:G,canvasWidth:H,canvasHeight:T,xCellWidth:A}=h;!function(){if(!Y)return;const{title:t,titleWidth:i,titleStyle:o}=Y,n=e({width:i,height:E-C+G,...S},{value:t.split("").join("\n"),...o||{}},{left:0,top:C},!0);f.value.add(n)}(),L.forEach(((e,i)=>{var o,s;const{range:u,spaceValue:c,title:h,unit:m,titleStyle:g,spaceGridNumber:v=1,showNumber:y,showMaxMinNumber:k,titleMargin:w=[5,30],margin:j=5}=e,x="left"===e.layout?M-j:N+j,b=[],X=d(u,c),W=X.length;X.forEach(((t,i)=>{const o=0===i?E-5:E-i*V*v;!y||(0===i||i===W-1)&&!k||b.push(a(String(t),{...e,position:e.layout},x,o))}));const C="left"===e.layout?"right":"left",S=(h||m)&&n(["left"===e.layout?M-w[0]:N+w[0],(null!=(s=null==(o=p(b))?void 0:o.top)?s:330)-V-w[1]],{value:`${h}${m?"\n"+m:""}`,...r,...g,textAlign:C,originX:C,originY:"bottom"}),Y=new t.Group([...b,...S?[S]:[]],{objectCaching:!1,...l});f.value.add(Y),Y.sendToBack()})),function(){const e=new t.Rect({width:M-Y.titleWidth,height:E-C+G,left:Y.titleWidth,top:C,...i,originX:"left",originY:"top",...S});f.value.add(e);const n=c(K),r=c(Y.externalIconList||[]).map((t=>({...t,isExternal:!0}))),{projectNameMargin:l=[5,30],titleWidth:s=20}=Y;let a=E+G-l[0];const u=s+l[1];r.concat(n.reverse()).forEach((t=>{a-=10;const e=t.title,{text:i,icon:n}=o(e,t,{text:{left:u,top:a},icon:{leftX:u,topY:a,originX:"center",...t.isExternal?{evented:!1,selectable:!1}:{},origin:{linkKey:t.linkKey}}});var r;a-=i.height||30,n.set("left",n.left+n.width/2),(r=n).on("moving",(()=>{r.set("originX","center"),W(r)?(v(r),y(r)):g.show=!1})),r.on("mouseup:before",(t=>{if(g.show=!1,0===t.e.button&&W(r)){const t=r.origin.linkKey||r.origin.key;if(b(w(),r.left,"key",2*A).includes(t))X("repeat");else{const e={data:{time:x(r.left),value:j(r.origin.type,r.top),...r.origin.linkKey?{key:r.origin.key}:{}},...r.origin};m("add",e),k({...e,key:t})}}!function(t){t.setCoords().set({originX:"left",left:t.originLeft,top:t.originTop})}(r)})),f.value.add(i,n)}))}(),f.value.add(new t.Rect({left:0,top:0,width:H-S.strokeWidth,height:T-S.strokeWidth,fill:"transparent",...S}))}export{f as useLeft};
@@ -1 +1 @@
1
- import{fabric as t}from"../../../../../shared/utils/fabricjs/index.js";import{drawPoint as e,drawText as i}from"../useDraw.js";import{useBirthProcessCumputedPoint as o}from"../useCumputedPoint.js";import{bus as n}from"../useEvent.js";import{useCommon as r}from"../useCommon.js";import"vue";import{getIndex as a}from"../../utils/index.js";import{cloneDeep as l,flatten as s}from"lodash-es";import"date-fns";import"../temperature/useShadow.js";import{OTHER_MENU as c}from"../../constants/index.js";import"naive-ui";import"@vueuse/core";function d(d,u,f,h,m,g,p,v,x){const{computedX:k,getXValue:y}=o(u),{getEqualXTypes:X,handleAddPrevent:P,isGridLimit:b,getPointEventProps:w}=r(d,f,u),{other:E,yCellHeight:j,xCellWidth:z,endX:A,originX:C,originY:L,endY:M,markHeight:S,event:T,topGridYCellHeight:I}=u,H=new Map,Y=l(E);function W(){var o;if(!(null==(o=null==Y?void 0:Y.horizontal)?void 0:o.length))return;const n="horizontal";H.set(n,[]);const{horizontal:r}=Y;let a=L+j/2;r.forEach(((o,r)=>{const{title:l,type:s,pointAttr:c={},textStyle:d={},data:u}=o;let f=null;u.forEach(((o,u)=>{const{time:h,value:m}=o,g=k(h);if(!$(g))return;const p=e(s,{...c,left:g,top:a}),v=g+p.width/2+2,x=i([v,a],{value:m,...d,originX:"left"}),y=new t.Group([p,x],{lockMovementY:!0,objectCaching:!1,hasControls:!1,hasBorders:!1,hoverCursor:"pointer",...w()});Object.assign(y,{originLeft:g,iconHalfWidth:p.width/2,origin:{type:"other",key:n,dataIndex:r,index:u,data:o,title:l},limitX:{x1:C,x2:A-y.width}}),f&&(y.limitX.x1=f.left,f.limitX.x2=y.left,y.prevPoint=f,f.nextPoint=y),f=y,q(y),H.get(n).push(y)})),a+=j})),d.value.add(...H.get(n))}function V(){var t;if(!(null==(t=null==Y?void 0:Y.vertical)?void 0:t.length))return;const i="vertical";H.set(i,[]);const{vertical:o}=Y;o.forEach(((t,o)=>{const{show:n=!0,marginTop:r=0,textStyle:a={},data:l,time:s}=t,c=k(s);if(!n||!$(c))return;const{lineHeight:d=j}=a;let u=L+r+d/2;l.forEach(((t,n)=>{const r=e(String(t),{...a,lockMovementY:!0,left:c,originX:"left",top:u,origin:{type:"other",key:i,dataIndex:o,index:n,data:{value:t}},...w()});u+=d,q(r),H.get(i).push(r)}));const f=H.get(i).filter((t=>t.origin.dataIndex===o)),h=Math.max(...f.map((t=>t.width))),m=c>A-h;f.forEach(((t,e,i)=>{t.siblingPoints=i.filter((e=>e.origin.index!==t.origin.index)),t.maxTextWidth=h,m&&t.set("originX","right")}))})),d.value.add(...H.get(i))}function G(t,e="add"){const{dataIndex:i,data:o,index:n,key:r}=t,l=Y[r],s=["mark"].includes(r)?l.dataList[i]:l[i];switch(e){case"remove":s.data.splice(n,1);break;case"change":s.data[n]=o;break;default:{const t=Array.isArray(o)?o[0].time:o.time,e=a(t,s.data),i=Array.isArray(o)?o:[o];s.data.splice(e,0,...i);break}}O(t)}function O(t){var e;const{key:i}=t;switch(null==(e=d.value)||e.remove(...H.get(i)),H.delete(i),i){case"horizontal":W();break;case"vertical":V();break;case"mark":D()}}function D(){if(!(null==E?void 0:E.mark)||!S)return;const{title:t,titleStyle:o,pointAttr:n,dataList:r}=E.mark,a=i([C-5,M+S/2],{value:t,...o,originX:"right"});d.value.add(a);const l=M+S,s=[];r.forEach((t=>{const{time:i,list:o=[]}=t,r=k(i);if(!$(r))return;let a=M;o.forEach((t=>{let i=!1;const o=e("circleAndText",{...n,text:t.text,left:r,top:a,origin:{data:t,key:"mark",type:"other"}}),c=o.height;a+c<=l&&a>=M?(o.set("top",a+c/2),a+=c):(i||(a=M,i=!0),o.set("top",a-c/2),a-=c),s.push(o),q(o),d.value.add(o)}))})),function(t){const e=t=>{var e,i;return null==(i=null==(e=t.origin)?void 0:e.data)?void 0:i.isStart},i=t.find((t=>e(t))),o=t.find((t=>!e(t)&&t.left>i.left)),n=t.filter((t=>!e(t)));t.forEach((t=>{const r={x1:C,x2:A};e(t)?(r.x2=o.left,t.otherPoints=n):(r.x1=i.left,t.startPoint=i),t.limitX=r}))}(s)}function q(t){if(T.hovered&&(t.on("mouseover",(()=>{B(t)})),t.on("mouseout",(()=>{h.show=!1}))),t.lockMovementX&&t.lockMovementY)return;const{key:e}=t.origin,i=["mark","horizontal"].includes(e),o=["mark","vertical"].includes(e);t.on("moving",(()=>{i?function(t){const e=t.origin.key,i="horizontal"===e;t.setCoords(),t.left<t.limitX.x1&&t.set("left",t.limitX.x1+(i?1:0));t.left>t.limitX.x2&&t.set("left",t.limitX.x2+(i?-1:0));if("mark"===e){t.top<L&&t.set("top",L);const e=M+S-t.height/2;t.top>e&&t.set("top",e)}i&&(t.originLeft=t.left+t.iconHalfWidth)}(t):(g(t),function(t){const e=t.left+t.maxTextWidth>A?"right":"left";t.setCoords().set({originX:e}),t.siblingPoints.forEach((i=>i.setCoords().set({originX:e,left:t.left})))}(t)),T.hovered&&B(t)})),t.on("mouseup",(n=>{var r;if(h.show=!1,1===n.button){i&&function(t){var e,i;if("mark"===t.origin.key){if((null==(i=null==(e=t.origin)?void 0:e.data)?void 0:i.isStart)&&t.otherPoints)t.otherPoints.forEach((e=>{e.limitX.x1=t.left}));else{const e=t.startPoint.otherPoints.map((t=>t.left)),i=Math.min(...e);t.startPoint.limitX.x2=i}return}t.prevPoint&&(t.prevPoint.limitX.x2=t.left);t.nextPoint&&(t.nextPoint.limitX.x1=t.left)}(t);const e=y(null!=(r=t.originLeft)?r:t.left),n={...t.origin,...o?{time:e}:{data:{...t.origin.data,time:e}}};d.value.discardActiveObject(),f("change",n)}3===n.button&&["horizontal","vertical"].includes(e)&&(m.point={x:t.left,y:t.top},m.show=!0,m.target=t,m.list=c.map((t=>({...t,renderItem:()=>t.label}))))}))}function B(t){const{key:e,data:i={}}=t.origin||{};let o=i.value;h.point={x:t.left,y:"mark"===e?t.top:t.top+I/2};const n=!t.origin.isMenu&&t.originLeft?t.originLeft:t.left,r=y(n);h.list=[`时间 ${r.slice(-5)}`],"mark"===e&&(o=i.name,h.list.unshift(o+" ")),h.sourceData=[{type:"other",key:e,time:r,value:o}],h.isTarget=!0,h.show=!0}function $(t){return t>=C&&t<=A}return function(){var t;if(!(null==(t=null==Y?void 0:Y.horizontal)?void 0:t.length))return;const{horizontal:i}=Y,o=C-5;let n=L+j/2;i.forEach(((t,i)=>{const{title:r,titleStyle:a={},defaultAddValue:l}=t,s=r&&e(r,{...a,originX:"right",left:o,top:n,origin:{defaultAddValue:l,dataIndex:i,type:"other",key:"horizontal",title:r,isMenu:!0},originLeft:o,originTop:n});var c;(c=s).on("moving",(()=>{c.set("originX","center"),b(c)?B(c):h.show=!1})),c.on("mouseup:before",(t=>{if(h.show=!1,0===t.e.button&&b(c))if(X(H.get("horizontal"),c.left,"key",z).includes(c.origin.key))P("repeat"),console.log("重复节点");else{const t={data:{time:y(c.left),value:c.origin.defaultAddValue},...c.origin};f("add",t),G(t)}!function(t){t.setCoords().set({originX:"right",left:t.originLeft,top:t.originTop})}(c)})),d.value.add(s),n+=j}))}(),W(),V(),D(),n.on((()=>{const t="horizontal",e=p(H.get(t));e.length>0?v((()=>{const i=function(t){const e=t.reduce(((t,e)=>{const{dataIndex:i}=e.origin;return t[i]=t[i]?t[i].concat(e.origin):[e.origin],t}),{});return s(Object.keys(e).map((t=>{const i=e[t];return Y.horizontal[t].data.splice(i[0].index,i.length),i})))}(e);O({key:t}),f("remove",i)})):x()})),{clickMenu:function({item:t,target:e}){if(!e)return;const{type:i}=t,o={...e.origin,type:"other"};f(i,o),"remove"===i&&G(o,i)}}}export{d as useOther};
1
+ import{fabric as t}from"../../../../../shared/utils/fabricjs/index.js";import{drawPoint as e,drawText as i}from"../useDraw.js";import{useBirthProcessCumputedPoint as o}from"../useCumputedPoint.js";import{bus as n}from"../useEvent.js";import{useCommon as r}from"../useCommon.js";import"vue";import{getIndex as a}from"../../utils/index.js";import{cloneDeep as l,flatten as s}from"lodash-es";import"date-fns";import"../temperature/useShadow.js";import{OTHER_MENU as d}from"../../constants/index.js";import"@vueuse/shared";import"naive-ui";import"@vueuse/core";function c(c,u,f,h,m,g,p,v,x){const{computedX:k,getXValue:y}=o(u),{getEqualXTypes:X,handleAddPrevent:P,isGridLimit:b,getPointEventProps:w}=r(c,f,u),{other:E,yCellHeight:j,xCellWidth:z,endX:A,originX:C,originY:L,endY:M,markHeight:S,event:T,topGridYCellHeight:I}=u,H=new Map,Y=l(E);function W(){var o;if(!(null==(o=null==Y?void 0:Y.horizontal)?void 0:o.length))return;const n="horizontal";H.set(n,[]);const{horizontal:r}=Y;let a=L+j/2;r.forEach(((o,r)=>{const{title:l,type:s,pointAttr:d={},textStyle:c={},data:u}=o;let f=null;u.forEach(((o,u)=>{const{time:h,value:m}=o,g=k(h);if(!$(g))return;const p=e(s,{...d,left:g,top:a}),v=g+p.width/2+2,x=i([v,a],{value:m,...c,originX:"left"}),y=new t.Group([p,x],{lockMovementY:!0,objectCaching:!1,hasControls:!1,hasBorders:!1,hoverCursor:"pointer",...w()});Object.assign(y,{originLeft:g,iconHalfWidth:p.width/2,origin:{type:"other",key:n,dataIndex:r,index:u,data:o,title:l},limitX:{x1:C,x2:A-y.width}}),f&&(y.limitX.x1=f.left,f.limitX.x2=y.left,y.prevPoint=f,f.nextPoint=y),f=y,q(y),H.get(n).push(y)})),a+=j})),c.value.add(...H.get(n))}function V(){var t;if(!(null==(t=null==Y?void 0:Y.vertical)?void 0:t.length))return;const i="vertical";H.set(i,[]);const{vertical:o}=Y;o.forEach(((t,o)=>{const{show:n=!0,marginTop:r=0,textStyle:a={},data:l,time:s}=t,d=k(s);if(!n||!$(d))return;const{lineHeight:c=j}=a;let u=L+r+c/2;l.forEach(((t,n)=>{const r=e(String(t),{...a,lockMovementY:!0,left:d,originX:"left",top:u,origin:{type:"other",key:i,dataIndex:o,index:n,data:{value:t}},...w()});u+=c,q(r),H.get(i).push(r)}));const f=H.get(i).filter((t=>t.origin.dataIndex===o)),h=Math.max(...f.map((t=>t.width))),m=d>A-h;f.forEach(((t,e,i)=>{t.siblingPoints=i.filter((e=>e.origin.index!==t.origin.index)),t.maxTextWidth=h,m&&t.set("originX","right")}))})),c.value.add(...H.get(i))}function G(t,e="add"){const{dataIndex:i,data:o,index:n,key:r}=t,l=Y[r],s=["mark"].includes(r)?l.dataList[i]:l[i];switch(e){case"remove":s.data.splice(n,1);break;case"change":s.data[n]=o;break;default:{const t=Array.isArray(o)?o[0].time:o.time,e=a(t,s.data),i=Array.isArray(o)?o:[o];s.data.splice(e,0,...i);break}}O(t)}function O(t){var e;const{key:i}=t;switch(null==(e=c.value)||e.remove(...H.get(i)),H.delete(i),i){case"horizontal":W();break;case"vertical":V();break;case"mark":D()}}function D(){if(!(null==E?void 0:E.mark)||!S)return;const{title:t,titleStyle:o,pointAttr:n,dataList:r}=E.mark,a=i([C-5,M+S/2],{value:t,...o,originX:"right"});c.value.add(a);const l=M+S,s=[];r.forEach((t=>{const{time:i,list:o=[]}=t,r=k(i);if(!$(r))return;let a=M;o.forEach((t=>{let i=!1;const o=e("circleAndText",{...n,text:t.text,left:r,top:a,origin:{data:t,key:"mark",type:"other"}}),d=o.height;a+d<=l&&a>=M?(o.set("top",a+d/2),a+=d):(i||(a=M,i=!0),o.set("top",a-d/2),a-=d),s.push(o),q(o),c.value.add(o)}))})),function(t){const e=t=>{var e,i;return null==(i=null==(e=t.origin)?void 0:e.data)?void 0:i.isStart},i=t.find((t=>e(t))),o=t.find((t=>!e(t)&&t.left>i.left)),n=t.filter((t=>!e(t)));t.forEach((t=>{const r={x1:C,x2:A};e(t)?(r.x2=o.left,t.otherPoints=n):(r.x1=i.left,t.startPoint=i),t.limitX=r}))}(s)}function q(t){if(T.hovered&&(t.on("mouseover",(()=>{B(t)})),t.on("mouseout",(()=>{h.show=!1}))),t.lockMovementX&&t.lockMovementY)return;const{key:e}=t.origin,i=["mark","horizontal"].includes(e),o=["mark","vertical"].includes(e);t.on("moving",(()=>{i?function(t){const e=t.origin.key,i="horizontal"===e;t.setCoords(),t.left<t.limitX.x1&&t.set("left",t.limitX.x1+(i?1:0));t.left>t.limitX.x2&&t.set("left",t.limitX.x2+(i?-1:0));if("mark"===e){t.top<L&&t.set("top",L);const e=M+S-t.height/2;t.top>e&&t.set("top",e)}i&&(t.originLeft=t.left+t.iconHalfWidth)}(t):(g(t),function(t){const e=t.left+t.maxTextWidth>A?"right":"left";t.setCoords().set({originX:e}),t.siblingPoints.forEach((i=>i.setCoords().set({originX:e,left:t.left})))}(t)),T.hovered&&B(t)})),t.on("mouseup",(n=>{var r;if(h.show=!1,1===n.button){i&&function(t){var e,i;if("mark"===t.origin.key){if((null==(i=null==(e=t.origin)?void 0:e.data)?void 0:i.isStart)&&t.otherPoints)t.otherPoints.forEach((e=>{e.limitX.x1=t.left}));else{const e=t.startPoint.otherPoints.map((t=>t.left)),i=Math.min(...e);t.startPoint.limitX.x2=i}return}t.prevPoint&&(t.prevPoint.limitX.x2=t.left);t.nextPoint&&(t.nextPoint.limitX.x1=t.left)}(t);const e=y(null!=(r=t.originLeft)?r:t.left),n={...t.origin,...o?{time:e}:{data:{...t.origin.data,time:e}}};c.value.discardActiveObject(),f("change",n)}3===n.button&&["horizontal","vertical"].includes(e)&&(m.point={x:t.left,y:t.top},m.show=!0,m.target=t,m.list=d.map((t=>({...t,renderItem:()=>t.label}))))}))}function B(t){const{key:e,data:i={}}=t.origin||{};let o=i.value;h.point={x:t.left,y:"mark"===e?t.top:t.top+I/2};const n=!t.origin.isMenu&&t.originLeft?t.originLeft:t.left,r=y(n);h.list=[`时间 ${r.slice(-5)}`],"mark"===e&&(o=i.name,h.list.unshift(o+" ")),h.sourceData=[{type:"other",key:e,time:r,value:o}],h.isTarget=!0,h.show=!0}function $(t){return t>=C&&t<=A}return function(){var t;if(!(null==(t=null==Y?void 0:Y.horizontal)?void 0:t.length))return;const{horizontal:i}=Y,o=C-5;let n=L+j/2;i.forEach(((t,i)=>{const{title:r,titleStyle:a={},defaultAddValue:l}=t,s=r&&e(r,{...a,originX:"right",left:o,top:n,origin:{defaultAddValue:l,dataIndex:i,type:"other",key:"horizontal",title:r,isMenu:!0},originLeft:o,originTop:n});var d;(d=s).on("moving",(()=>{d.set("originX","center"),b(d)?B(d):h.show=!1})),d.on("mouseup:before",(t=>{if(h.show=!1,0===t.e.button&&b(d))if(X(H.get("horizontal"),d.left,"key",z).includes(d.origin.key))P("repeat"),console.log("重复节点");else{const t={data:{time:y(d.left),value:d.origin.defaultAddValue},...d.origin};f("add",t),G(t)}!function(t){t.setCoords().set({originX:"right",left:t.originLeft,top:t.originTop})}(d)})),c.value.add(s),n+=j}))}(),W(),V(),D(),n.on((()=>{const t="horizontal",e=p(H.get(t));e.length>0?v((()=>{const i=function(t){const e=t.reduce(((t,e)=>{const{dataIndex:i}=e.origin;return t[i]=t[i]?t[i].concat(e.origin):[e.origin],t}),{});return s(Object.keys(e).map((t=>{const i=e[t];return Y.horizontal[t].data.splice(i[0].index,i.length),i})))}(e);O({key:t}),f("remove",i)})):x()})),{clickMenu:function({item:t,target:e}){if(!e)return;const{type:i}=t,o={...e.origin,type:"other"};f(i,o),"remove"===i&&G(o,i)}}}export{c as useOther};
@@ -1 +1 @@
1
- import{ref as e,computed as t,reactive as a,unref as r,onMounted as i,nextTick as l,watch as o}from"vue";import{useDialog as n}from"naive-ui";import{defaultBorderStyle as u}from"../useDraw.js";import"../../../../../shared/utils/fabricjs/index.js";import{format as s}from"date-fns";import{getChildrenSize as d}from"../../utils/index.js";import{cloneDeep as c,range as p,flatten as m}from"lodash-es";import"../useEvent.js";import"../temperature/useShadow.js";import{OTHER_MENU as v}from"../../constants/index.js";import"@vueuse/core";import{useTop as h}from"./useTop.js";import{useLeft as f}from"./useLeft.js";import{useCenter as g}from"./useCenter.js";import{useOther as y}from"./useOther.js";function w(w,x,b,j,C,Y,H){const S=n(),T=e(),D=e(),A=e();let M=null;const X=t((()=>x.data.layout||{top:"drug",center:"xAxis",bottom:"intraoperatively"})),G=t((()=>{var e;return null!=(e=x.data.left.width)?e:0})),V=t((()=>{const{grid:e}=x.data;return e.mainXCell*e.subXCell})),k=t((()=>{const{grid:e}=x.data;return e.mainYCell*e.subYCell})),P=t((()=>{const{treeData:e=[],show:t=!0}=x.data.top;return t?d(e):0})),L=t((()=>x.data.top.tree.cellHeight)),N=t((()=>L.value*P.value)),O=t((()=>ie(ae("drug")||"top"))),E=t((()=>O.value+N.value)),W=t((()=>{var e;return Date.parse((null==(e=x.data.xAxis)?void 0:e.startTime)||s(new Date,"yyyy-MM-dd HH:mm:ss"))})),I=t((()=>{const e=c(x.data.xAxis),{spaceValue:t,spaceTimeStamp:a}=e,r=p(V.value/t+1).map((r=>0===r?e.startTime:s(new Date(W.value+r*t*a),"yyyy-MM-dd HH:mm:ss")));return{...e,list:r,left:G.value}})),q=function(){const{show:e=!0}=x.data.top;if(!e)return[];const t=c(x.data.top.treeData);let a=0;const{cellWidth:r,cellHeight:i}=x.data.top.tree;return function e(t,l=0){t.forEach((t=>{var o;const n={top:a*i+O.value,left:l*r,width:r,height:i};if(a++,null==(o=t.children)?void 0:o.length){a--;const r=d(t.children);n.height=r*i,e(t.children,l+1)}else n.width=G.value-n.left;Object.assign(t,n)}))}(t),t}(),z=t((()=>ie(ae("xAxis")||"center"))),B=t((()=>{var e;const{width:t,right:a}=x.data;if(!a)return t;return t-(null!=(e=a.width)?e:0)})),F=t((()=>ie(ae("intraoperatively")||"bottom"))),J=t((()=>{var e;const{show:t=!0,height:a}=(null==(e=x.data.other)?void 0:e.mark)||{};return t&&a?a:0})),K=t((()=>F.value+(x.data.height-N.value-I.value.height-J.value))),Q=t((()=>(B.value-G.value)/V.value)),R=t((()=>(K.value-F.value)/k.value)),U=t((()=>I.value.spaceTimeStamp/Q.value)),Z=t((()=>{const{scaleValues:e}=x.data;return m(e.map((e=>e.dataList.filter((e=>e.show)).map(((t,a)=>({...t,bigType:e.type,unit:e.unit,dataIndex:a}))))))})),$=t((()=>le("pulse"))),_=t((()=>le("temperature"))),ee=t((()=>{var e;return(null==(e=x.data.grid)?void 0:e.event)||{selectable:!0,evented:!0,hovered:!0}})),te=a({canvasWidth:x.data.width,canvasHeight:x.data.height,borderStyle:{...u,...x.data.borderStyle},pointSelectionStyle:x.data.pointSelectionStyle||{},grid:x.data.grid,top:x.data.top,left:x.data.left,other:x.data.other,topGridYNumber:r(P),topGridYCellHeight:r(L),topGridOriginY:r(O),topGridEndY:r(E),treeData:q,xAxis:r(I),originYXAxis:r(z),startTime:r(W),timeXCell:r(U),gridXNumber:r(V),gridYNumber:r(k),xCellWidth:r(Q),yCellHeight:r(R),originX:r(G),endX:r(B),originY:r(F),endY:r(K),markHeight:r(J),itemList:r(Z),scaleValues:x.data.scaleValues,pulseYCell:r($),temperatureYCell:r(_),event:r(ee),dialog:S});function ae(e){let t="";return Object.entries(X.value).some((([a,r])=>{if(r===e)return t=a,!0})),t}function re(e){const t=X.value[e],a=I.value.height;switch(t){case"drug":return N.value;case"xAxis":return a;default:return x.data.height-N.value-a}}function ie(e){switch(e){case"top":return 0;case"center":return re("top");default:return re("top")+re("center")}}function le(e){const{scaleValues:t}=x.data,a=t.find((t=>t.type===e));return R.value*(a.spaceGridNumber||1)/(a.spaceValue||1)}return i((async()=>{await l(),h(w,te,b,C);const{redrawPoints:e,clickMenu:t,moveLimit:a,setPopup:r,updateData:i,getGridPoints:o,getContainPoints:n,showDialog:u,removeCurrentSelection:s}=g(w,te,b,C,Y,H);f(w,te,b,C,a,r,i,o);const{clickMenu:d}=y(w,te,b,C,Y,a,n,u,s);D.value=e,A.value=e=>{const{item:a}=e;a.type&&v.map((e=>e.type)).includes(a.type)?d(e):t(e)}})),H&&o((()=>null==C?void 0:C.point),(()=>{C.movable?(C.show=!0,M&&clearTimeout(M),M=setTimeout((()=>{C.show=!1,C.movable=!1}),3e3)):M&&clearTimeout(M)}),{deep:!0}),{propItems:te,redrawPoints:D,select:T,clickMenu:A}}export{w as useSurgicalAnesthesiaChart};
1
+ import{ref as e,computed as t,reactive as a,unref as r,onMounted as i,nextTick as o,watch as l}from"vue";import{useDialog as n}from"naive-ui";import{defaultBorderStyle as u}from"../useDraw.js";import"../../../../../shared/utils/fabricjs/index.js";import{format as s}from"date-fns";import{getChildrenSize as d}from"../../utils/index.js";import{cloneDeep as c,range as p,flatten as m}from"lodash-es";import"../useEvent.js";import"../temperature/useShadow.js";import{OTHER_MENU as v}from"../../constants/index.js";import"@vueuse/shared";import"@vueuse/core";import{useTop as h}from"./useTop.js";import{useLeft as f}from"./useLeft.js";import{useCenter as g}from"./useCenter.js";import{useOther as y}from"./useOther.js";function w(w,x,b,j,C,Y,H){const S=n(),T=e(),D=e(),A=e();let M=null;const X=t((()=>x.data.layout||{top:"drug",center:"xAxis",bottom:"intraoperatively"})),G=t((()=>{var e;return null!=(e=x.data.left.width)?e:0})),V=t((()=>{const{grid:e}=x.data;return e.mainXCell*e.subXCell})),k=t((()=>{const{grid:e}=x.data;return e.mainYCell*e.subYCell})),P=t((()=>{const{treeData:e=[],show:t=!0}=x.data.top;return t?d(e):0})),L=t((()=>x.data.top.tree.cellHeight)),N=t((()=>L.value*P.value)),O=t((()=>ie(ae("drug")||"top"))),E=t((()=>O.value+N.value)),W=t((()=>{var e;return Date.parse((null==(e=x.data.xAxis)?void 0:e.startTime)||s(new Date,"yyyy-MM-dd HH:mm:ss"))})),I=t((()=>{const e=c(x.data.xAxis),{spaceValue:t,spaceTimeStamp:a}=e,r=p(V.value/t+1).map((r=>0===r?e.startTime:s(new Date(W.value+r*t*a),"yyyy-MM-dd HH:mm:ss")));return{...e,list:r,left:G.value}})),q=function(){const{show:e=!0}=x.data.top;if(!e)return[];const t=c(x.data.top.treeData);let a=0;const{cellWidth:r,cellHeight:i}=x.data.top.tree;return function e(t,o=0){t.forEach((t=>{var l;const n={top:a*i+O.value,left:o*r,width:r,height:i};if(a++,null==(l=t.children)?void 0:l.length){a--;const r=d(t.children);n.height=r*i,e(t.children,o+1)}else n.width=G.value-n.left;Object.assign(t,n)}))}(t),t}(),z=t((()=>ie(ae("xAxis")||"center"))),B=t((()=>{var e;const{width:t,right:a}=x.data;if(!a)return t;return t-(null!=(e=a.width)?e:0)})),F=t((()=>ie(ae("intraoperatively")||"bottom"))),J=t((()=>{var e;const{show:t=!0,height:a}=(null==(e=x.data.other)?void 0:e.mark)||{};return t&&a?a:0})),K=t((()=>F.value+(x.data.height-N.value-I.value.height-J.value))),Q=t((()=>(B.value-G.value)/V.value)),R=t((()=>(K.value-F.value)/k.value)),U=t((()=>I.value.spaceTimeStamp/Q.value)),Z=t((()=>{const{scaleValues:e}=x.data;return m(e.map((e=>e.dataList.filter((e=>e.show)).map(((t,a)=>({...t,bigType:e.type,unit:e.unit,dataIndex:a}))))))})),$=t((()=>oe("pulse"))),_=t((()=>oe("temperature"))),ee=t((()=>{var e;return(null==(e=x.data.grid)?void 0:e.event)||{selectable:!0,evented:!0,hovered:!0}})),te=a({canvasWidth:x.data.width,canvasHeight:x.data.height,borderStyle:{...u,...x.data.borderStyle},pointSelectionStyle:x.data.pointSelectionStyle||{},grid:x.data.grid,top:x.data.top,left:x.data.left,other:x.data.other,topGridYNumber:r(P),topGridYCellHeight:r(L),topGridOriginY:r(O),topGridEndY:r(E),treeData:q,xAxis:r(I),originYXAxis:r(z),startTime:r(W),timeXCell:r(U),gridXNumber:r(V),gridYNumber:r(k),xCellWidth:r(Q),yCellHeight:r(R),originX:r(G),endX:r(B),originY:r(F),endY:r(K),markHeight:r(J),itemList:r(Z),scaleValues:x.data.scaleValues,pulseYCell:r($),temperatureYCell:r(_),event:r(ee),dialog:S});function ae(e){let t="";return Object.entries(X.value).some((([a,r])=>{if(r===e)return t=a,!0})),t}function re(e){const t=X.value[e],a=I.value.height;switch(t){case"drug":return N.value;case"xAxis":return a;default:return x.data.height-N.value-a}}function ie(e){switch(e){case"top":return 0;case"center":return re("top");default:return re("top")+re("center")}}function oe(e){const{scaleValues:t}=x.data,a=t.find((t=>t.type===e));return R.value*(a.spaceGridNumber||1)/(a.spaceValue||1)}return i((async()=>{await o(),h(w,te,b,C);const{redrawPoints:e,clickMenu:t,moveLimit:a,setPopup:r,updateData:i,getGridPoints:l,getContainPoints:n,showDialog:u,removeCurrentSelection:s}=g(w,te,b,C,Y,H);f(w,te,b,C,a,r,i,l);const{clickMenu:d}=y(w,te,b,C,Y,a,n,u,s);D.value=e,A.value=e=>{const{item:a}=e;a.type&&v.map((e=>e.type)).includes(a.type)?d(e):t(e)}})),H&&l((()=>null==C?void 0:C.point),(()=>{C.movable?(C.show=!0,M&&clearTimeout(M),M=setTimeout((()=>{C.show=!1,C.movable=!1}),3e3)):M&&clearTimeout(M)}),{deep:!0}),{propItems:te,redrawPoints:D,select:T,clickMenu:A}}export{w as useSurgicalAnesthesiaChart};
@@ -1 +1 @@
1
- import{fabric as t}from"../../../../../shared/utils/fabricjs/index.js";import{drawText as e,defaultStyle as i,defaultRectStyle as n,drawTextGroup as o,drawLine as l,drawPoint as r}from"../useDraw.js";import{useGrid as s}from"../useGrid.js";import{useBirthProcessCumputedPoint as a}from"../useCumputedPoint.js";import"../useEvent.js";import"vue";import{cloneDeep as c}from"lodash-es";import"date-fns";import"../temperature/useShadow.js";import"naive-ui";import"@vueuse/core";function f(f,u,d,m,h){const{computedX:v,getXValue:p}=a(u),{originX:g,endX:x,xCellWidth:L,originYXAxis:X,top:C,canvasWidth:w,borderStyle:Y,treeData:y,xAxis:S,topGridYNumber:j,topGridOriginY:b,topGridYCellHeight:k,topGridEndY:G,event:I}=u,z=new Set;function A(t,e,i){let n;const{content:o}=t.value||{};if(o){const{textStyle:l}=C.data||{},{startLine:s,endLine:a}=e;n=r(o,{fontSize:12,...l,backgroundColor:"#fff",lockMovementX:!0,lockMovementY:!0});const c=E(n,e,i);n&&(n.set(c),n.origin={data:t},$(n),s&&(s.text=n),a&&(a.text=n))}return n}function E(t,e,i){const n=t.width+1,{startLine:o,centerLine:l,endLine:r}=e,s={top:i,originX:"center",originY:"center"};return l&&n<=l.width?s.left=l.x1+l.width/2:r&&n<=r.limitX.x2-r.left?(s.originX="left",s.left=r.left+1):o&&!r&&n<=o.limitX.x2-o.left?(s.originX="left",s.left=o.left+(o.isCustomIcon?5:1)):o&&n<=o.left-o.limitX.x1?(s.originX="right",s.left=o.left-(o.isCustomIcon?5:1)):l?(s.originY="top",s.left=l.x1+l.width/2,s.top=i+1,s.fontSize=10):o&&(s.originX="left",s.originY="top",s.fontSize=10,s.left=o.left,s.top=i+1),s}function M(e,{isCustomIcon:i,isContinue:n,isLeft:o}){const{x:s,y1:a,y2:c,halfY:f}=e;if(!s||s<g||s>x)return;const{lineStyle:u}=C.data||{};let d;const m={left:s,top:f};d=i?r("circle",{fill:u.stroke,...m}):n?r(">",{fill:u.stroke,...m,fontSize:18}):l([s,a,s,f],u);const h=new t.Rect({width:L,height:k,fill:"transparent",left:s-L/2,top:a}),v=new t.Group([d,h],{originX:"center",originY:"center",hasControls:!1,hasBorders:!1,objectCaching:!1,hoverCursor:"pointer",lockMovementY:!0});return v.isLeft=o,v.isCustomIcon=i,$(v),v}function $(t){I.hovered&&(t.on("mouseover",(()=>{D(t,"hover")})),t.on("mouseout",(()=>{m.show=!1}))),t.lockMovementX&&t.lockMovementY||(t.on("moving",(()=>{!function(t){t.setCoords(),t.left<t.limitX.x1&&t.set("left",t.limitX.x1);t.left>t.limitX.x2&&t.set("left",t.limitX.x2)}(t),function(t){if(t.centerLine){const e=t.isLeft?{x1:t.left}:{x2:t.left};t.centerLine.setCoords().set(e)}if(t.text){const e=E(t.text,{startLine:t.isLeft?t:t.nearLine,centerLine:t.centerLine,endLine:t.isLeft?t.nearLine:t},t.top);t.text.setCoords().set(e)}}(t),I.hovered&&D(t)})),t.on("mouseup",(e=>{if(1===e.button){!function(t){t.isLeft?(t.prevLine&&(t.prevLine.limitX.x2=t.left),t.nearLine&&(t.nearLine.limitX.x1=t.left)):(t.nextLine&&(t.nextLine.limitX.x1=t.left),t.nearLine&&(t.nearLine.limitX.x2=t.left))}(t);const e={type:"tree",...t.origin};d("change",e)}})))}function D(t,e="moving"){var i,n,o;const{data:l}=t.origin;m.point={x:t.left,y:t.top};let[r="",s=""]=l.time||[];if("moving"===e){const e=p(t.left);t.isLeft?r=e:s=e,l.time=[r,s],t.text&&(t.text.origin.data.time=[r,s])}m.list=[`开始时间 ${r}`,`结束时间 ${s}`,`流速 ${(null==(i=l.value)?void 0:i.currentSpeed)||""}`,`浓度 ${(null==(n=l.value)?void 0:n.consistence)||""}`,`总量 ${(null==(o=l.value)?void 0:o.total)||""}`],m.sourceData=[{type:"tree",startTime:r,endTime:s,value:l.value}],m.isTarget=!0,m.show=!0}s(f,{...u,gridYNumber:j,originY:b,yCellHeight:k,endY:G}),function(){var o;const{height:l,list:r,left:s,spaceValue:a,style:c,marginBottom:u}=S;if(!l)return;const d=[],m=X+(u?l-u:l/2),h=u?"bottom":"center";r.forEach(((t,i)=>{const n=s+i*L*a;d.push(e([n,m],{value:t.slice(11,16),originY:h,...c}))}));const v=d.length>0?new t.Group([...d],{...i,objectCaching:!1}):null;v&&f.value.add(v);const p=new t.Rect({width:w,height:l,left:0,top:X,...n,originX:"left",originY:"top",...Y});f.value.add(p);const{show:g=!0}=C;if(!g)return;const y=e([x+(w-x)/2,m],{value:"总量",...null==(o=C.data)?void 0:o.totalStyle});f.value.add(y)}(),function(){var n;const r=(null==(n=null==C?void 0:C.tree)?void 0:n.textStyle)||{},s=[];!function t(i){i.forEach((i=>{var n;const{width:a,height:u,left:d,top:m,title:h=""}=i,p={value:h,...r};(null==(n=i.children)?void 0:n.length)?(p.value=h.split("").join("\n"),t(i.children)):(p.textAlign="left",function(t){if(!(null==t?void 0:t.data)||!Array.isArray(t.data))return;const{lineStyle:e}=C.data||{},i=t.top,n=i+k,o=n-k/2,r={y1:i,y2:n,halfY:o};let s=null;const a=c(t);delete a.data,t.data.forEach(((t,i,n)=>{const{time:c,continue:f}=t,[u,d]=c,m=u&&v(u),h=d&&v(d),p=M({...r,x:m},{isCustomIcon:!h&&!f,isContinue:!1,isLeft:!0}),L=M({...r,x:h},{isCustomIcon:!1,isContinue:!!f});let X;if((p||m<g)&&(L||h>x)){X=l([p?m:g,o,L?h:x,o],e)}const C={startLine:p,centerLine:X,endLine:L};let w,Y;!function(t,e,i){const{startLine:n,centerLine:o,endLine:l}=e,{startLine:r,endLine:s}=t||{};if(n){n.origin=i;const t={x1:g,x2:l?l.left:x};s?(t.x1=s.left,s.limitX.x2=n.left,n.prevLine=s,s.nextLine=n):r&&(t.x1=r.left,r.limitX.x2=n.left,n.prevLine=r,r.nextLine=n),n.limitX=t,o&&(n.centerLine=o)}if(l){l.origin=i;const t={x1:n?n.left:g,x2:x};l.limitX=t,o&&(l.centerLine=o)}n&&l&&(n.nearLine=l,l.nearLine=n)}(s,C,Object.assign({},a,{data:t,index:i})),s&&(w=A(n[i-1],s,o)),i===n.length-1&&(Y=A(t,C,o)),s=C,X&&z.add(X),p&&z.add(p),L&&z.add(L),w&&z.add(w),Y&&z.add(Y)}))}(i),function(t){var i;if(!(null==t?void 0:t.total))return;const n=t.top+k/2,o=x+(w-x)/2,l=e([o,n],{value:t.total,...null==(i=C.data)?void 0:i.totalStyle}),r=w-Y.strokeWidth;o+l.width>r&&l.set({originX:"right",left:r});l&&f.value.add(l)}(i)),s.push(o({width:a,height:u,...Y},p,{left:d,top:m},!0))}))}(y);const a=s.length>0?new t.Group([...s],{...i,objectCaching:!1}):null;a&&f.value.add(a),z.size&&f.value.add(...z)}()}export{f as useTop};
1
+ import{fabric as t}from"../../../../../shared/utils/fabricjs/index.js";import{drawText as e,defaultStyle as i,defaultRectStyle as n,drawTextGroup as o,drawLine as l,drawPoint as r}from"../useDraw.js";import{useGrid as s}from"../useGrid.js";import{useBirthProcessCumputedPoint as a}from"../useCumputedPoint.js";import"../useEvent.js";import"vue";import{cloneDeep as c}from"lodash-es";import"date-fns";import"../temperature/useShadow.js";import"@vueuse/shared";import"naive-ui";import"@vueuse/core";function f(f,u,d,m,h){const{computedX:v,getXValue:p}=a(u),{originX:g,endX:x,xCellWidth:L,originYXAxis:X,top:C,canvasWidth:w,borderStyle:Y,treeData:y,xAxis:S,topGridYNumber:j,topGridOriginY:b,topGridYCellHeight:k,topGridEndY:G,event:I}=u,z=new Set;function A(t,e,i){let n;const{content:o}=t.value||{};if(o){const{textStyle:l}=C.data||{},{startLine:s,endLine:a}=e;n=r(o,{fontSize:12,...l,backgroundColor:"#fff",lockMovementX:!0,lockMovementY:!0});const c=E(n,e,i);n&&(n.set(c),n.origin={data:t},$(n),s&&(s.text=n),a&&(a.text=n))}return n}function E(t,e,i){const n=t.width+1,{startLine:o,centerLine:l,endLine:r}=e,s={top:i,originX:"center",originY:"center"};return l&&n<=l.width?s.left=l.x1+l.width/2:r&&n<=r.limitX.x2-r.left?(s.originX="left",s.left=r.left+1):o&&!r&&n<=o.limitX.x2-o.left?(s.originX="left",s.left=o.left+(o.isCustomIcon?5:1)):o&&n<=o.left-o.limitX.x1?(s.originX="right",s.left=o.left-(o.isCustomIcon?5:1)):l?(s.originY="top",s.left=l.x1+l.width/2,s.top=i+1,s.fontSize=10):o&&(s.originX="left",s.originY="top",s.fontSize=10,s.left=o.left,s.top=i+1),s}function M(e,{isCustomIcon:i,isContinue:n,isLeft:o}){const{x:s,y1:a,y2:c,halfY:f}=e;if(!s||s<g||s>x)return;const{lineStyle:u}=C.data||{};let d;const m={left:s,top:f};d=i?r("circle",{fill:u.stroke,...m}):n?r(">",{fill:u.stroke,...m,fontSize:18}):l([s,a,s,f],u);const h=new t.Rect({width:L,height:k,fill:"transparent",left:s-L/2,top:a}),v=new t.Group([d,h],{originX:"center",originY:"center",hasControls:!1,hasBorders:!1,objectCaching:!1,hoverCursor:"pointer",lockMovementY:!0});return v.isLeft=o,v.isCustomIcon=i,$(v),v}function $(t){I.hovered&&(t.on("mouseover",(()=>{D(t,"hover")})),t.on("mouseout",(()=>{m.show=!1}))),t.lockMovementX&&t.lockMovementY||(t.on("moving",(()=>{!function(t){t.setCoords(),t.left<t.limitX.x1&&t.set("left",t.limitX.x1);t.left>t.limitX.x2&&t.set("left",t.limitX.x2)}(t),function(t){if(t.centerLine){const e=t.isLeft?{x1:t.left}:{x2:t.left};t.centerLine.setCoords().set(e)}if(t.text){const e=E(t.text,{startLine:t.isLeft?t:t.nearLine,centerLine:t.centerLine,endLine:t.isLeft?t.nearLine:t},t.top);t.text.setCoords().set(e)}}(t),I.hovered&&D(t)})),t.on("mouseup",(e=>{if(1===e.button){!function(t){t.isLeft?(t.prevLine&&(t.prevLine.limitX.x2=t.left),t.nearLine&&(t.nearLine.limitX.x1=t.left)):(t.nextLine&&(t.nextLine.limitX.x1=t.left),t.nearLine&&(t.nearLine.limitX.x2=t.left))}(t);const e={type:"tree",...t.origin};d("change",e)}})))}function D(t,e="moving"){var i,n,o;const{data:l}=t.origin;m.point={x:t.left,y:t.top};let[r="",s=""]=l.time||[];if("moving"===e){const e=p(t.left);t.isLeft?r=e:s=e,l.time=[r,s],t.text&&(t.text.origin.data.time=[r,s])}m.list=[`开始时间 ${r}`,`结束时间 ${s}`,`流速 ${(null==(i=l.value)?void 0:i.currentSpeed)||""}`,`浓度 ${(null==(n=l.value)?void 0:n.consistence)||""}`,`总量 ${(null==(o=l.value)?void 0:o.total)||""}`],m.sourceData=[{type:"tree",startTime:r,endTime:s,value:l.value}],m.isTarget=!0,m.show=!0}s(f,{...u,gridYNumber:j,originY:b,yCellHeight:k,endY:G}),function(){var o;const{height:l,list:r,left:s,spaceValue:a,style:c,marginBottom:u}=S;if(!l)return;const d=[],m=X+(u?l-u:l/2),h=u?"bottom":"center";r.forEach(((t,i)=>{const n=s+i*L*a;d.push(e([n,m],{value:t.slice(11,16),originY:h,...c}))}));const v=d.length>0?new t.Group([...d],{...i,objectCaching:!1}):null;v&&f.value.add(v);const p=new t.Rect({width:w,height:l,left:0,top:X,...n,originX:"left",originY:"top",...Y});f.value.add(p);const{show:g=!0}=C;if(!g)return;const y=e([x+(w-x)/2,m],{value:"总量",...null==(o=C.data)?void 0:o.totalStyle});f.value.add(y)}(),function(){var n;const r=(null==(n=null==C?void 0:C.tree)?void 0:n.textStyle)||{},s=[];!function t(i){i.forEach((i=>{var n;const{width:a,height:u,left:d,top:m,title:h=""}=i,p={value:h,...r};(null==(n=i.children)?void 0:n.length)?(p.value=h.split("").join("\n"),t(i.children)):(p.textAlign="left",function(t){if(!(null==t?void 0:t.data)||!Array.isArray(t.data))return;const{lineStyle:e}=C.data||{},i=t.top,n=i+k,o=n-k/2,r={y1:i,y2:n,halfY:o};let s=null;const a=c(t);delete a.data,t.data.forEach(((t,i,n)=>{const{time:c,continue:f}=t,[u,d]=c,m=u&&v(u),h=d&&v(d),p=M({...r,x:m},{isCustomIcon:!h&&!f,isContinue:!1,isLeft:!0}),L=M({...r,x:h},{isCustomIcon:!1,isContinue:!!f});let X;if((p||m<g)&&(L||h>x)){X=l([p?m:g,o,L?h:x,o],e)}const C={startLine:p,centerLine:X,endLine:L};let w,Y;!function(t,e,i){const{startLine:n,centerLine:o,endLine:l}=e,{startLine:r,endLine:s}=t||{};if(n){n.origin=i;const t={x1:g,x2:l?l.left:x};s?(t.x1=s.left,s.limitX.x2=n.left,n.prevLine=s,s.nextLine=n):r&&(t.x1=r.left,r.limitX.x2=n.left,n.prevLine=r,r.nextLine=n),n.limitX=t,o&&(n.centerLine=o)}if(l){l.origin=i;const t={x1:n?n.left:g,x2:x};l.limitX=t,o&&(l.centerLine=o)}n&&l&&(n.nearLine=l,l.nearLine=n)}(s,C,Object.assign({},a,{data:t,index:i})),s&&(w=A(n[i-1],s,o)),i===n.length-1&&(Y=A(t,C,o)),s=C,X&&z.add(X),p&&z.add(p),L&&z.add(L),w&&z.add(w),Y&&z.add(Y)}))}(i),function(t){var i;if(!(null==t?void 0:t.total))return;const n=t.top+k/2,o=x+(w-x)/2,l=e([o,n],{value:t.total,...null==(i=C.data)?void 0:i.totalStyle}),r=w-Y.strokeWidth;o+l.width>r&&l.set({originX:"right",left:r});l&&f.value.add(l)}(i)),s.push(o({width:a,height:u,...Y},p,{left:d,top:m},!0))}))}(y);const a=s.length>0?new t.Group([...s],{...i,objectCaching:!1}):null;a&&f.value.add(a),z.size&&f.value.add(...z)}()}export{f as useTop};
@@ -1 +1 @@
1
- import{fabric as t}from"../../../../../shared/utils/fabricjs/index.js";import{drawTextGroup as e,defaultTextStyle as i,defaultStyle as n}from"../useDraw.js";import"date-fns";import"lodash-es";import"../useEvent.js";import"vue";import"./useShadow.js";import"naive-ui";import"@vueuse/core";function o(o,s){const{xScaleList:r,originX:a,endX:l,endY:c,xCellWidth:h,canvasWidth:d,canvasHeight:u,bottom:p,breathingHeight:g,iconsWidth:m,borderStyle:v}=s;!function(){var s,d,u;if(!g||!p){const e=new t.Line([m,c-1,l,c-1],v);return o.value.add(e),e.sendToBack(),!1}const f=g,b=(null==(s=p.breathing)?void 0:s.list)||[],w=[];let j=!0;r.forEach(((t,n)=>{const o=a+n*h;let s="";b.forEach(((e,i)=>{const n=new Date(e.time).getTime();n>=t&&n<+t+t.scaleCell&&(s=e.value)}));const r=j?{top:-(f/2-10)}:{top:f/2-10};s&&(j=!j);const l=e({width:h,height:f,...v},Object.assign({},{text:String(s),...i},s?r:{}),{left:o,top:c});w.push(l)}));const x=e({width:l,height:f,...v},{text:String((null==(d=p.breathing)?void 0:d.title)+(null==(u=p.breathing)?void 0:u.unit)),...i,left:-(l-a)/2},{left:0,top:c});w.push(x);const S=w.length>0?new t.Group([...w],{...n}):null;S&&S.sendToBack(),S&&o.value.add(S)}()}export{o as useBottom};
1
+ import{fabric as t}from"../../../../../shared/utils/fabricjs/index.js";import{drawTextGroup as e,defaultTextStyle as i,defaultStyle as o}from"../useDraw.js";import"date-fns";import"lodash-es";import"../useEvent.js";import"vue";import"./useShadow.js";import"@vueuse/shared";import"naive-ui";import"@vueuse/core";function n(n,s){const{xScaleList:r,originX:a,endX:l,endY:h,xCellWidth:u,canvasWidth:c,canvasHeight:d,bottom:p,breathingHeight:m,iconsWidth:g,borderStyle:v}=s;!function(){var s,c,d;if(!m||!p){const e=new t.Line([g,h-1,l,h-1],v);return n.value.add(e),e.sendToBack(),!1}const f=m,b=(null==(s=p.breathing)?void 0:s.list)||[],w=[];let j=!0;r.forEach(((t,o)=>{const n=a+o*u;let s="";b.forEach(((e,i)=>{const o=new Date(e.time).getTime();o>=t&&o<+t+t.scaleCell&&(s=e.value)}));const r=j?{top:-(f/2-10)}:{top:f/2-10};s&&(j=!j);const l=e({width:u,height:f,...v},Object.assign({},{text:String(s),...i},s?r:{}),{left:n,top:h});w.push(l)}));const x=e({width:l,height:f,...v},{text:String((null==(c=p.breathing)?void 0:c.title)+(null==(d=p.breathing)?void 0:d.unit)),...i,left:-(l-a)/2},{left:0,top:h});w.push(x);const S=w.length>0?new t.Group([...w],{...o}):null;S&&S.sendToBack(),S&&n.value.add(S)}()}export{n as useBottom};
@@ -1 +1 @@
1
- import{fabric as e}from"../../../../../shared/utils/fabricjs/index.js";import{useShadow as t}from"./useShadow.js";import{drawLine as i,defaultStyle as n,drawPoint as o,drawText as l,drawArrow as s}from"../useDraw.js";import{useGrid as r}from"../useGrid.js";import"date-fns";import{isOneLine as u,getType as a,isOverlapPoint as c,getFloorNumber as d,isValidValue as p,setOtherType as f,getTime as h,isEffectiveNode as v,getIndex as g,deleteProperty as y}from"../../utils/index.js";import{cloneDeep as m,flatten as x,last as b}from"lodash-es";import"../useEvent.js";import{useCommon as j}from"../useCommon.js";import"vue";import"naive-ui";import"@vueuse/core";import{TEMPERATURE_MENU as w,PAIN_MENU as L,OVERLAP as k}from"../../constants/index.js";function S(S,E,M,$,O,P,C,A,I,R){r(S,E);const{getEqualXTypes:T,handleAddPrevent:V,getPointEventProps:X}=j(S,M,E),{createShadowLines:z}=t(),{left:D,xScaleList:F,xCellWidth:H,yCellHeight:_,originX:W,endX:q,originY:G,endY:B,itemList:J,event:K,vitalSignsOriginY:N,painOriginY:Q,hospitalizationDate:U,config:Z,canvasHeight:ee}=E,te=new Set,ie=["xinmai","mai"],ne=new Map,oe=new Set,le=new Set,se=new Set,re=m(D.yScaleValue);function ue(t){var o;const l=re.find((e=>"pulse"===e.type));if(l&&(null==(o=l.dataList)?void 0:o.length)&&(te.size&&S.value.remove(...te),te.clear(),ne.size>1)){if(t){const{type:e,key:i}=t.origin||{};if("pulse"===e){const e=ne.get(i),n=null==e?void 0:e.findIndex((e=>e[0]===t.left));e.splice(n,1,[t.left,t.top])}}const o=function(){const e=[],t=[],i=[];for(const e of ne)t.push(e[1]),e[0]===ie[0]&&e[1].forEach((e=>{(ne.get(ie[1])||[]).findIndex((t=>t[0]===e[0]))>-1&&i.push(e[0])}));const[n,o]=t;let l=[],s=[];return i.forEach((t=>{const i=n.findIndex((e=>e[0]===t)),r=o.findIndex((e=>e[0]===t)),u=n[i],a=o[r],c=n[i-1],d=n[i+1],p=o[r-1],f=o[r+1];if(c&&p){if(c[0]!==p[0]){const e=Math.max(c[0],p[0]);l.push([c,p].find((t=>t[0]===e)))}}else c?l.push(c):p&&s.push(p);const h=Math.min(u[1],a[1]);l.push([u,a].find((e=>e[1]===h)));const v=Math.max(u[1],a[1]);s.push([u,a].find((e=>e[1]===v)));const g=()=>{const t=[...l,...s.reverse()],[i]=t,n=b(t);i[0]===n[0]&&i[1]===n[1]&&t.splice(-1,1),e.push(t),l=[],s=[]};if(d&&f){if(d[0]!==f[0]){const e=Math.min(d[0],f[0]);l.push([d,f].find((t=>t[0]===e))),g()}}else d?(l.push(d),g()):f?(s.push(f),g()):g()})),e}(),{mode:s,style:r={}}=l.shadow||{};o.forEach((t=>{const o=t.map((e=>({x:e[0],y:e[1]}))),l=new e.Polygon(o,{...n,...r,strokeWidth:1});if(["slash","line"].includes(s)){l.set({fill:"transparent",stroke:r.stroke||"#f00"});const e=[];if(["slash"].includes(s))e.push(...z(t,r._angle,r.space)),e.forEach((e=>{Object.assign(e,{...n,...r}),te.add(e)}));else{const n=function(e){const t=e.reduce(((e,t)=>{const i=Math.trunc(t[0]);return e[i]=e[i]?e[i].concat([t]):[t],e}),{}),i=Object.values(t).filter((e=>2===e.length&&Math.trunc(e[0][1])!==Math.trunc(e[1][1])));return i}(t);n.forEach((t=>{const n=i([...x(t)],{...r,originX:"center"});e.push(n),te.add(n)}))}S.value.add(...e)}te.add(l),S.value.add(l)}))}}function ae(){var e;const t=re.find((e=>"pulse"===e.type));if(!t||!(null==(e=t.dataList)?void 0:e.length))return;if(!t.dataList.some((e=>e.title.includes("脉搏"))))return;const i=Object.assign({},k,D.overlap||{}),l=[];oe.size&&[...oe].forEach((e=>{[...le].forEach((t=>{if(t.origin&&c(e,t)){const e=t.origin.key;if(e){const s={left:t.left,top:t.top,...n,hoverCursor:"default"};let r="koumai";"yemai"===e&&(r=e),"humai"===e&&(r="circle"),l.push(o(r,{...i[e]||{},...s}))}}}))})),setTimeout((()=>{S.value.add(...l),l.forEach((e=>{null==e||e.bringToFront(),se.add(e)}))}))}function ce(e,t,r){var a;const{type:c,riseStyle:h={},noRiseStyle:v={},verifiedStyle:g={},reduceStyle:y={},pacemaker:m={},upArrowStyle:x={},limitValueStyle:b={},nonePainPointStyle:j={},belowMinValueStyle:w={},dataList:L=[],list:k=[]}=r,{type:E,textStyle:P,showConnectLine:A=!1}=j,R=[],T=[],V=[];let z=null;if(null==(a=e.list)||a.forEach(((a,j)=>{const D=u(c)?L.find((e=>e.key===a.key)):e,F=he(a,r),W=e.list[j+1],q=W?he(W,r):void 0,G=W?u(c)?L.find((e=>e.key===W.key)):e:{},{title:B=""}=D;if("脉搏"===B&&"脉搏"!==G.title||"脉搏"!==B&&"脉搏"===G.title||!F||!q||d(F[0],1)!==d(q[0],1))F&&z&&(F[0]=z),z=null;else{const e=F[0]-H/2;F[0]=e+H/4,q[0]=z=F[0]+H/2}const J={};J.value=function(e,t,i){if(!(null==e?void 0:e.length)||!Z.showValue)return;const{lineAttr:n={}}=i,o=e[1]<=N.originY+_?e[1]+_:e[1]-_,s=l([e[0],o],{value:t.value,originX:"center",originY:"center",fill:n.stroke||"#000"});return V.push(s),{obj:s,top:-_}}(F,a,D),function(e,t,r,u){var a,d;if(!["temperature","pain"].includes(c))return;if(!(null==e?void 0:e.length)&&("pain"===c||"temperature"===c&&!fe(t.time)))return;const{lineAttr:f={}}=r,{value:m}=u,x=$(t.time);let b,j,w,L,S;if(t.noRise&&v.show){const i=Y(v,t)?O(c,k,35):(null==e?void 0:e[1])||0;if(v.text)w=l([x,Y(v,t)?i:i+5],{value:v.text.split("").join("\n"),originY:"top",...v.style}),t.value||se.add(w);else if(t.value){w=s([x,i,i+2*_],{...v.style})}w&&V.push(w)}if((null==e?void 0:e[1])&&(t.rise&&h.show&&h.text&&(L=l([x,e[1]-(m?_:0)-5],{value:h.text.split("").join("\n"),originY:"bottom",...h.style}),V.push(L)),t.verified&&(S=l([x,e[1]-(m?_:0)-5],{value:"v",originX:"center",originY:"bottom",...g}),V.push(S)),p(t.physicsReduce)||p(t.drugReduce))){const l=O(c,k,null!=(a=t.physicsReduce)?a:t.drugReduce),s=l<e[1]&&(null==Z?void 0:Z.hypothermyViewCustom)?x+H/2:x;b=i([...e,s,l],{...f,...y.line,...n}),j=o((null==(d=null==y?void 0:y.point)?void 0:d.type)||"circle",{left:s,top:l,...y.point,...n,originY:l===ee?"bottom":"center"}),b&&V.push(b),j&&V.push(j)}Object.assign(u,{reduceLine:{obj:b,type:"line"},noRiseText:{obj:w,top:v.text?5:2*_,isFixed:Y(v,t)},riseText:{obj:L,top:(m?-_:0)-5},verifiedText:{obj:S,top:(m?-_:0)-5},reducePoint:{obj:j,type:"reduce"}})}(F,a,D,J),function(e,t,i,n){if(!(null==e?void 0:e.length)||!["pulse"].includes(c))return;const o=Math.max(...k),r=Math.min(...k);let u,a,d;const{upArrowShow:p=!1,limitValueShow:f=!1}=i;if(p&&+t.value>180){let t=e[1]-2.5*_,i=[e[1]-_/2,t];t<N.originY&&(t=e[1]+2.5*_,i=[t,e[1]+_/2]),u=s([e[0],i[0],i[1]],x,"up"),V.push(u)}if(f){const i={value:t.value,originX:"center",originY:"center",...b};if(+t.value>o){const t=u?e[1]+_/2+u.height:e[1]+_;a=l([e[0],t],i),V.push(a)}+t.value<r&&(a=l([e[0],e[1]-_],i),V.push(a))}if(w.show&&+t.value<r){const t=e[1];if(w.text)d=l([e[0],e[1]+5],{value:w.text.split("").join("\n"),originY:"top",...w.style});else{const i=t+2*_;d=s([e[0],t,i],{...w.style})}V.push(d)}Object.assign(n,{upArrow:{obj:u},limitValue:{obj:a,top:-_},belowMinValue:{obj:d,top:w.text?5:2*_,moveHide:!0}})}(F,a,D,J),function(n,l,s,u,a,d){let p,h;const{pointAttr:v={},lineAttr:g={},title:y="",key:x,type:b="circle"}=a,j=e.list[u+1],w=de(c,e.list[u].value),L=l&&de(c,j.value);if(n&&l&&!s.breakpoint&&(!w&&!L||A)){h=i([...n,...l],{...g});const{obj:e}=(null==d?void 0:d.reducePoint)||{};if((null==e?void 0:e.top)<n[1]&&(null==Z?void 0:Z.hypothermyViewCustom)){const t=i([e.left,e.top,...l],{...g});V.unshift(t),Object.assign(d,{reduceRightLine:{obj:t,type:"reduce"}}),h.set("stroke","transparent")}}const k=s.pacemakerShow&&"pulse"==c?m.value:w&&"number"===E?0:b,Y=T[u-1],$={origin:{data:s,title:y,key:x||"",unit:r.unit,type:c,_type:f(y,c),dataIndex:t,index:u},leftLine:Y,rightLine:h,otherObj:d,...s.pacemakerShow&&"pulse"==c?m.style:v,lockMovementX:!0,...X(),...w?{selectable:!1,evented:!1,..."number"===E?P:{}}:{}};n&&(Y?$.leftLine.set("x2",n[0]):$.leftLine=null,p=o(k,{left:n[0],top:w?n[1]-5:n[1],...$}));T.push(h),p&&(y.includes("脉搏")?oe.add(p):le.add(p),function(e){K.hovered&&(e.on("mouseover",(()=>{pe(e,"hover")})),e.on("mouseout",(()=>{I.show=!1})));if(e.lockMovementX&&e.lockMovementY)return;e.on("moving",(()=>{!function(e){e.setCoords();const t="pain"===e.origin.type?Q:N;e.top<t.originY&&e.set("top",t.originY);e.top>t.endY&&e.set("top",t.endY)}(e),function(e){var t,i;null==(t=e.leftLine)||t.setCoords().set({x2:e.left,y2:e.top}),null==(i=e.rightLine)||i.setCoords().set({x1:e.left,y1:e.top}),Object.values(e.otherObj).forEach((t=>{const{obj:i,type:n="",top:o=0,isFixed:l,moveHide:s=!1}=t||{};"reduce"!==n&&i&&("line"===n?i.setCoords().set({x1:e.left,y1:e.top}):(l||i.setCoords().set({left:e.left,top:e.top+o}),s&&(S.value.remove(i),delete e.otherObj.obj)))})),ue(e)}(e),K.hovered&&pe(e)})),e.on("mouseup",(t=>{if(I.show=!1,1===t.button){const{type:t}=e.origin,i=C(t,e.top),n={...e.origin,data:{...e.origin.data,value:i}};S.value.discardActiveObject(),M("change",n),ge(n,"change")}}))}(p),R.push(p),se.add(p))}(F,q,a,j,D,J)})),"pulse"===c){const e={};ie.forEach((t=>{e[t]=R.filter((e=>{var i;return(null==(i=e.origin)?void 0:i.key)===t}))}));let t=null;ie.forEach((i=>{ne.set(i,e[i].map(((e,i,n)=>{var o,l;const s=n[i+1];if(s&&d(e.left,1)===d(s.left,1)){const i=e.left-H/2;e.set("left",i+H/4),null==(o=e.rightLine)||o.set("x1",e.left),t=e.left+H/2,s.set("left",t)}else t&&(null==(l=e.leftLine)||l.set("x2",t),e.set("left",t)),t=null;return[e.left,e.top]})))}))}Promise.all(R).then((e=>{const t=T.filter((e=>e));Promise.all(V).then((i=>{S.value.add(...t,...e,...i),e.forEach((t=>{null==t||t.bringToFront(),function(e,t){if("pulse"===e.origin.type){t.filter((t=>t.left===e.left&&"pulse"===t.origin.type)).length>1&&(e.leftLine&&S.value.remove(e.leftLine),e.rightLine&&S.value.remove(e.rightLine))}}(t,e)}))}))}))}function de(e,t){return"pain"===e&&0==t}function pe(e,t="moving"){const{title:i,unit:n,type:o,data:l}=e.origin;I.point={x:e.left,y:e.top},I.list=[function(){const{drugReduce:s,physicsReduce:r}=l||{},u="hover"===t?l.value:C(o,e.top);if(p(s))return`药物降${"pain"==o?"痛":"温"} ${u}—>${s}${n||""}`;if(p(r))return`物理降${"pain"==o?"痛":"温"} ${u}—>${r}${n||""}`;return`${i} ${u}${n||""}`}(),`时间 ${((null==l?void 0:l.time)||P(e.left)).slice(-5)}`],I.show=!0}function fe(e){const[t]=F,i=b(F),n=t.start,o=i.end,l=h(e);return l>=n&&l<=o}function he(e,t){const i="pain"===t.type?Q:N;if(!v(e)||!fe(e.time))return;const n=$(e.time),o=O(t.type,t.list,e.value);return[n,o<i.originY?i.originY:o>i.endY?i.endY:o]}function ve(e){const t=new Date,i=String(t.getMonth()+1).padStart(2,"0"),n=String(t.getDate()).padStart(2,"0"),o=h(`${t.getFullYear()}-${i}-${n} 23:59:59`),l=h(`${P(e)}:00`);return U&&l<h(U)?(V("exceedMin"),!1):!(l>o)||(V("exceedMax"),!1)}function ge(e,t="add"){const{type:i,dataIndex:n,index:o,data:l,key:s}=e,r=re.find((e=>e.type===i));if("add"===t){const e=u(i)?r.dataList.find((e=>e.enable)):r.dataList[n],t=g(l.time,e.list);e.list.splice(t,0,l)}else r.dataList[n].list[o]=l;ye()}function ye(){var e;se.size&&(null==(e=S.value)||e.remove(...function(e){const t=[];return e.forEach((e=>{e&&t.push(e),(null==e?void 0:e.leftLine)&&t.push(null==e?void 0:e.leftLine),(null==e?void 0:e.rightLine)&&t.push(null==e?void 0:e.rightLine),Object.values((null==e?void 0:e.otherObj)||{}).forEach((e=>{(null==e?void 0:e.obj)&&t.push(null==e?void 0:e.obj)}))})),t}([...se]))),ne.clear(),se.clear(),oe.clear(),le.clear(),re.forEach((e=>{e.dataList.forEach(((t,i)=>{u(e.type)&&!t.enable||ce(t,i,e)}))})),ue(),ae()}return ne.clear(),oe.clear(),le.clear(),re.forEach((e=>{!function(e){if("temperature"!==e.type||!e.positionLine)return;const t=O(e.type,e.list,e.positionLine.value),n=i([W,t,q,t],e.positionLine);S.value.add(n)}(e),e.dataList.forEach(((t,i)=>{!t.show||u(e.type)&&!t.enable||ce(t,i,e)}))})),ue(),ae(),S.value.on("mouse:up",(e=>{const{button:t,target:i,pointer:n={}}=e;if(3===t){if(!E.event.evented)return;const{x:e=0,y:t=0}=n;if(e>=W&&e<=q&&t>=G&&t<=B){R.point={x:e,y:t},R.show=!0;const{type:o}=(null==i?void 0:i.origin)||{};if(i&&["temperature","pain"].includes(o))"temperature"===o&&(R.list=[...w]),"pain"===o&&(R.list=[...L]),R.target=i;else{R.target=null,R.list=["新增节点"],J.forEach((i=>{if(!T([...se],e,"_type").includes(i.bigType)){const e=["pain"].includes(i.bigType)?Q:N;t>=e.originY&&t<=e.endY&&R.list.push({renderItem:A?A(i):()=>i.title,origin:{title:i.title,unit:i.unit,type:a(i.bigType),dataIndex:i.dataIndex,key:i.key},pointer:n})}}));const i=ve(e);i&&1!==R.list.length||(R.show=!1,1===R.list.length&&i&&V("repeat"))}}}if(1===t){if(i)return;const{x:e=0,y:t=0}=n;e>=W&&e<=q&&t>0&&t<ee&&M("click:grid",{x:e,y:t,time:P(e)})}})),{clickMenu:function({item:e,target:t}){if(t){const{data:i,type:n,dataIndex:o,index:l}=t.origin,s=y(i,[...w,...L]);s[`${e.type}`]=e.value,u(n)&&(s.key=t.origin.key);const r={...t.origin,data:s};M("change",r),ge(r,"change")}else{const t={data:{time:P(e.pointer.x),value:C(e.origin.type,e.pointer.y),...u(e.origin.type)?{key:e.origin.key}:{}},...e.origin};M("add",t),ge(t)}},setPopup:pe,isAddPoint:ve,updateData:ge,redrawPoints:ye,gridPoints:se}}function Y(e,t){return"fixed"===e.position||!t.value&&0!==t.value}export{S as useCenter};
1
+ import{fabric as e}from"../../../../../shared/utils/fabricjs/index.js";import{useShadow as t}from"./useShadow.js";import{drawLine as i,defaultStyle as n,drawPoint as o,drawText as l,drawArrow as s}from"../useDraw.js";import{useGrid as r}from"../useGrid.js";import"date-fns";import{isOneLine as u,getType as a,isOverlapPoint as c,getFloorNumber as d,isValidValue as p,setOtherType as f,getTime as h,isEffectiveNode as v,getIndex as g,deleteProperty as y}from"../../utils/index.js";import{cloneDeep as m,flatten as x,last as b}from"lodash-es";import"../useEvent.js";import{useCommon as j}from"../useCommon.js";import"vue";import"naive-ui";import"@vueuse/core";import{TEMPERATURE_MENU as w,PAIN_MENU as k,OVERLAP as L}from"../../constants/index.js";import{promiseTimeout as S}from"@vueuse/shared";function E(E,M,$,O,C,P,A,I,R,T){r(E,M);const{getEqualXTypes:V,handleAddPrevent:X,getPointEventProps:z}=j(E,$,M),{createShadowLines:D}=t(),{left:F,xScaleList:H,xCellWidth:_,yCellHeight:W,originX:q,endX:G,originY:B,endY:J,itemList:K,event:N,vitalSignsOriginY:Q,painOriginY:U,hospitalizationDate:Z,config:ee,canvasHeight:te}=M,ie=new Set,ne=["xinmai","mai"],oe=new Map,le=new Set,se=new Set,re=new Set,ue=m(F.yScaleValue);function ae(){[...re].forEach((e=>{null==e||e.bringToFront()}))}function ce(t){var o;const l=ue.find((e=>"pulse"===e.type));if(l&&(null==(o=l.dataList)?void 0:o.length)&&(ie.size&&E.value.remove(...ie),ie.clear(),oe.size>1)){if(t){const{type:e,key:i}=t.origin||{};if("pulse"===e){const e=oe.get(i),n=null==e?void 0:e.findIndex((e=>e[0]===t.left));e.splice(n,1,[t.left,t.top])}}const o=function(){const e=[],t=[],i=[];for(const e of oe)t.push(e[1]),e[0]===ne[0]&&e[1].forEach((e=>{(oe.get(ne[1])||[]).findIndex((t=>t[0]===e[0]))>-1&&i.push(e[0])}));const[n,o]=t;let l=[],s=[];return i.forEach((t=>{const i=n.findIndex((e=>e[0]===t)),r=o.findIndex((e=>e[0]===t)),u=n[i],a=o[r],c=n[i-1],d=n[i+1],p=o[r-1],f=o[r+1];if(c&&p){if(c[0]!==p[0]){const e=Math.max(c[0],p[0]);l.push([c,p].find((t=>t[0]===e)))}}else c?l.push(c):p&&s.push(p);const h=Math.min(u[1],a[1]);l.push([u,a].find((e=>e[1]===h)));const v=Math.max(u[1],a[1]);s.push([u,a].find((e=>e[1]===v)));const g=()=>{const t=[...l,...s.reverse()],[i]=t,n=b(t);i[0]===n[0]&&i[1]===n[1]&&t.splice(-1,1),e.push(t),l=[],s=[]};if(d&&f){if(d[0]!==f[0]){const e=Math.min(d[0],f[0]);l.push([d,f].find((t=>t[0]===e))),g()}}else d?(l.push(d),g()):f?(s.push(f),g()):g()})),e}();o.length>0&&function(e){S(0).then((()=>{e.forEach((e=>{const t=[],i=[];Array.from(re).forEach((n=>{var o,l;"pulse"===(null==(o=null==n?void 0:n.origin)?void 0:o.type)&&e.find((e=>Math.abs(n.left-e[0])<=1&&Math.abs(n.top-e[1])<=1))&&((null==(l=null==n?void 0:n.origin)?void 0:l.key)===ne[0]?t.push(n):i.push(n))})),[t,i].forEach((e=>{1!==(null==e?void 0:e.length)&&e.sort(((e,t)=>e.left-t.left)).forEach(((e,t)=>{t>0&&e.leftLine&&E.value.remove(e.leftLine)}))}))}))}))}(o);const{mode:s,style:r={}}=l.shadow||{};o.forEach((t=>{const o=t.map((e=>({x:e[0],y:e[1]}))),l=new e.Polygon(o,{...n,...r,strokeWidth:1});if(["slash","line"].includes(s)){l.set({fill:"transparent",stroke:r.stroke||"#f00"});const e=[];if(["slash"].includes(s))e.push(...D(t,r._angle,r.space)),e.forEach((e=>{Object.assign(e,{...n,...r}),ie.add(e)}));else{const n=function(e){const t=e.reduce(((e,t)=>{const i=Math.trunc(t[0]);return e[i]=e[i]?e[i].concat([t]):[t],e}),{}),i=Object.values(t).filter((e=>2===e.length&&Math.trunc(e[0][1])!==Math.trunc(e[1][1])));return i}(t);n.forEach((t=>{const n=i([...x(t)],{...r,originX:"center"});e.push(n),ie.add(n)}))}E.value.add(...e)}ie.add(l),E.value.add(l)}))}}function de(){var e;const t=ue.find((e=>"pulse"===e.type));if(!t||!(null==(e=t.dataList)?void 0:e.length))return;if(!t.dataList.some((e=>e.title.includes("脉搏"))))return;const i=Object.assign({},L,F.overlap||{}),l=[];le.size&&[...le].forEach((e=>{[...se].forEach((t=>{if(t.origin&&c(e,t)){const e=t.origin.key;if(e){const s={left:t.left,top:t.top,...n,hoverCursor:"default"};let r="koumai";"yemai"===e&&(r=e),"humai"===e&&(r="circle"),l.push(o(r,{...i[e]||{},...s}))}}}))})),setTimeout((()=>{E.value.add(...l),l.forEach((e=>{null==e||e.bringToFront(),re.add(e)}))}))}function pe(e,t,r){var a;const{type:c,riseStyle:h={},noRiseStyle:v={},verifiedStyle:g={},reduceStyle:y={},pacemaker:m={},upArrowStyle:x={},limitValueStyle:b={},nonePainPointStyle:j={},belowMinValueStyle:w={},dataList:k=[],list:L=[]}=r,{type:S,textStyle:M,showConnectLine:P=!1}=j,I=[],T=[],V=[];let X=null;if(null==(a=e.list)||a.forEach(((a,j)=>{const D=u(c)?k.find((e=>e.key===a.key)):e,F=ge(a,r),H=e.list[j+1],q=H?ge(H,r):void 0,G=H?u(c)?k.find((e=>e.key===H.key)):e:{},{title:B=""}=D;if("脉搏"===B&&"脉搏"!==G.title||"脉搏"!==B&&"脉搏"===G.title||!F||!q||d(F[0],1)!==d(q[0],1))F&&X&&(F[0]=X),X=null;else{const e=F[0]-_/2;F[0]=e+_/4,q[0]=X=F[0]+_/2}const J={};J.value=function(e,t,i){if(!(null==e?void 0:e.length)||!ee.showValue)return;const{lineAttr:n={}}=i,o=e[1]<=Q.originY+W?e[1]+W:e[1]-W,s=l([e[0],o],{value:t.value,originX:"center",originY:"center",fill:n.stroke||"#000"});return V.push(s),{obj:s,top:-W}}(F,a,D),function(e,t,r,u){var a,d;if(!["temperature","pain"].includes(c))return;if(!(null==e?void 0:e.length)&&("pain"===c||"temperature"===c&&!ve(t.time)))return;const{lineAttr:f={}}=r,{value:m}=u,x=O(t.time);let b,j,w,k,S;if(t.noRise&&v.show){const i=Y(v,t)?C(c,L,35):(null==e?void 0:e[1])||0;if(v.text)w=l([x,Y(v,t)?i:i+5],{value:v.text.split("").join("\n"),originY:"top",...v.style}),t.value||re.add(w);else if(t.value){w=s([x,i,i+2*W],{...v.style})}w&&V.push(w)}if((null==e?void 0:e[1])&&(t.rise&&h.show&&h.text&&(k=l([x,e[1]-(m?W:0)-5],{value:h.text.split("").join("\n"),originY:"bottom",...h.style}),V.push(k)),t.verified&&(S=l([x,e[1]-(m?W:0)-5],{value:"v",originX:"center",originY:"bottom",...g}),V.push(S)),p(t.physicsReduce)||p(t.drugReduce))){const l=C(c,L,null!=(a=t.physicsReduce)?a:t.drugReduce),s=l<e[1]&&(null==ee?void 0:ee.hypothermyViewCustom)?x+_/2:x;b=i([...e,s,l],{...f,...y.line,...n}),j=o((null==(d=null==y?void 0:y.point)?void 0:d.type)||"circle",{left:s,top:l,...y.point,...n,originY:l===te?"bottom":"center"}),b&&V.push(b),j&&V.push(j)}Object.assign(u,{reduceLine:{obj:b,type:"line"},noRiseText:{obj:w,top:v.text?5:2*W,isFixed:Y(v,t)},riseText:{obj:k,top:(m?-W:0)-5},verifiedText:{obj:S,top:(m?-W:0)-5},reducePoint:{obj:j,type:"reduce"}})}(F,a,D,J),function(e,t,i,n){if(!(null==e?void 0:e.length)||!["pulse"].includes(c))return;const o=Math.max(...L),r=Math.min(...L);let u,a,d;const{upArrowShow:p=!1,limitValueShow:f=!1}=i;if(p&&+t.value>180){let t=e[1]-2.5*W,i=[e[1]-W/2,t];t<Q.originY&&(t=e[1]+2.5*W,i=[t,e[1]+W/2]),u=s([e[0],i[0],i[1]],x,"up"),V.push(u)}if(f){const i={value:t.value,originX:"center",originY:"center",...b};if(+t.value>o){const t=u?e[1]+W/2+u.height:e[1]+W;a=l([e[0],t],i),V.push(a)}+t.value<r&&(a=l([e[0],e[1]-W],i),V.push(a))}if(w.show&&+t.value<r){const t=e[1];if(w.text)d=l([e[0],e[1]+5],{value:w.text.split("").join("\n"),originY:"top",...w.style});else{const i=t+2*W;d=s([e[0],t,i],{...w.style})}V.push(d)}Object.assign(n,{upArrow:{obj:u},limitValue:{obj:a,top:-W},belowMinValue:{obj:d,top:w.text?5:2*W,moveHide:!0}})}(F,a,D,J),function(n,l,s,u,a,d){let p,h;const{pointAttr:v={},lineAttr:g={},title:y="",key:x,type:b="circle"}=a,j=e.list[u+1],w=fe(c,e.list[u].value),k=l&&fe(c,j.value);if(n&&l&&!s.breakpoint&&(!w&&!k||P)){h=i([...n,...l],{...g});const{obj:e}=(null==d?void 0:d.reducePoint)||{};if((null==e?void 0:e.top)<n[1]&&(null==ee?void 0:ee.hypothermyViewCustom)){const t=i([e.left,e.top,...l],{...g});V.unshift(t),Object.assign(d,{reduceRightLine:{obj:t,type:"reduce"}}),h.set("stroke","transparent")}}const L=s.pacemakerShow&&"pulse"==c?m.value:w&&"number"===S?0:b,Y=T[u-1],O={origin:{data:s,title:y,key:x||"",unit:r.unit,type:c,_type:f(y,c),dataIndex:t,index:u},leftLine:Y,rightLine:h,otherObj:d,...s.pacemakerShow&&"pulse"==c?m.style:v,lockMovementX:!0,...z(),...w?{selectable:!1,evented:!1,..."number"===S?M:{}}:{}};n&&(Y?O.leftLine.set("x2",n[0]):O.leftLine=null,p=o(L,{left:n[0],top:w?n[1]-5:n[1],...O}));T.push(h),p&&(x===ne[1]?le.add(p):se.add(p),function(e){N.hovered&&(e.on("mouseover",(()=>{he(e,"hover")})),e.on("mouseout",(()=>{R.show=!1})));if(e.lockMovementX&&e.lockMovementY)return;e.on("moving",(()=>{!function(e){e.setCoords();const t="pain"===e.origin.type?U:Q;e.top<t.originY&&e.set("top",t.originY);e.top>t.endY&&e.set("top",t.endY)}(e),function(e){var t,i;null==(t=e.leftLine)||t.setCoords().set({x2:e.left,y2:e.top}),null==(i=e.rightLine)||i.setCoords().set({x1:e.left,y1:e.top}),Object.values(e.otherObj).forEach((t=>{const{obj:i,type:n="",top:o=0,isFixed:l,moveHide:s=!1}=t||{};"reduce"!==n&&i&&("line"===n?i.setCoords().set({x1:e.left,y1:e.top}):(l||i.setCoords().set({left:e.left,top:e.top+o}),s&&(E.value.remove(i),delete e.otherObj.obj)))})),ce(e)}(e),N.hovered&&he(e)})),e.on("mouseup",(t=>{if(R.show=!1,1===t.button){const{type:t}=e.origin,i=A(t,e.top),n={...e.origin,data:{...e.origin.data,value:i}};E.value.discardActiveObject(),$("change",n),me(n,"change")}}))}(p),I.push(p),re.add(p))}(F,q,a,j,D,J)})),"pulse"===c){const{key:t}=e;let i=null;oe.set(t,I.map(((e,t,n)=>{var o,l;const s=n[t+1];if(s&&d(e.left,1)===d(s.left,1)){const t=e.left-_/2;e.set("left",t+_/4),null==(o=e.rightLine)||o.set("x1",e.left),i=e.left+_/2,s.set("left",i)}else i&&(null==(l=e.leftLine)||l.set("x2",i),e.set("left",i)),i=null;return[e.left,e.top]})))}const D=T.filter((e=>e));E.value.add(...D,...I,...V)}function fe(e,t){return"pain"===e&&0==t}function he(e,t="moving"){const{title:i,unit:n,type:o,data:l}=e.origin;R.point={x:e.left,y:e.top},R.list=[function(){const{drugReduce:s,physicsReduce:r}=l||{},u="hover"===t?l.value:A(o,e.top);if(p(s))return`药物降${"pain"==o?"痛":"温"} ${u}—>${s}${n||""}`;if(p(r))return`物理降${"pain"==o?"痛":"温"} ${u}—>${r}${n||""}`;return`${i} ${u}${n||""}`}(),`时间 ${((null==l?void 0:l.time)||P(e.left)).slice(-5)}`],R.show=!0}function ve(e){const[t]=H,i=b(H),n=t.start,o=i.end,l=h(e);return l>=n&&l<=o}function ge(e,t){const i="pain"===t.type?U:Q;if(!v(e)||!ve(e.time))return;const n=O(e.time),o=C(t.type,t.list,e.value);return[n,o<i.originY?i.originY:o>i.endY?i.endY:o]}function ye(e){const t=new Date,i=String(t.getMonth()+1).padStart(2,"0"),n=String(t.getDate()).padStart(2,"0"),o=h(`${t.getFullYear()}-${i}-${n} 23:59:59`),l=h(`${P(e)}:00`);return Z&&l<h(Z)?(X("exceedMin"),!1):!(l>o)||(X("exceedMax"),!1)}function me(e,t="add"){const{type:i,dataIndex:n,index:o,data:l,key:s}=e,r=ue.find((e=>e.type===i));if("add"===t){const e=u(i)?r.dataList.find((e=>e.enable)):r.dataList[n],t=g(l.time,e.list);e.list.splice(t,0,l)}else r.dataList[n].list[o]=l;xe()}function xe(){var e;re.size&&(null==(e=E.value)||e.remove(...function(e){const t=[];return e.forEach((e=>{e&&t.push(e),(null==e?void 0:e.leftLine)&&t.push(null==e?void 0:e.leftLine),(null==e?void 0:e.rightLine)&&t.push(null==e?void 0:e.rightLine),Object.values((null==e?void 0:e.otherObj)||{}).forEach((e=>{(null==e?void 0:e.obj)&&t.push(null==e?void 0:e.obj)}))})),t}([...re]))),oe.clear(),re.clear(),le.clear(),se.clear(),ue.forEach((e=>{e.dataList.forEach(((t,i)=>{u(e.type)&&!t.enable||pe(t,i,e)}))})),ce(),ae(),de()}return oe.clear(),le.clear(),se.clear(),ue.forEach((e=>{!function(e){if("temperature"!==e.type||!e.positionLine)return;const t=C(e.type,e.list,e.positionLine.value),n=i([q,t,G,t],e.positionLine);E.value.add(n)}(e),e.dataList.forEach(((t,i)=>{!t.show||u(e.type)&&!t.enable||pe(t,i,e)}))})),ce(),ae(),de(),E.value.on("mouse:up",(e=>{const{button:t,target:i,pointer:n={}}=e;if(3===t){if(!M.event.evented)return;const{x:e=0,y:t=0}=n;if(e>=q&&e<=G&&t>=B&&t<=J){T.point={x:e,y:t},T.show=!0;const{type:o}=(null==i?void 0:i.origin)||{};if(i&&["temperature","pain"].includes(o))"temperature"===o&&(T.list=[...w]),"pain"===o&&(T.list=[...k]),T.target=i;else{T.target=null,T.list=["新增节点"],K.forEach((i=>{if(!V([...re],e,"_type").includes(i.bigType)){const e=["pain"].includes(i.bigType)?U:Q;t>=e.originY&&t<=e.endY&&T.list.push({renderItem:I?I(i):()=>i.title,origin:{title:i.title,unit:i.unit,type:a(i.bigType),dataIndex:i.dataIndex,key:i.key},pointer:n})}}));const i=ye(e);i&&1!==T.list.length||(T.show=!1,1===T.list.length&&i&&X("repeat"))}}}if(1===t){if(i)return;const{x:e=0,y:t=0}=n;e>=q&&e<=G&&t>0&&t<te&&$("click:grid",{x:e,y:t,time:P(e)})}})),{clickMenu:function({item:e,target:t}){if(t){const{data:i,type:n,dataIndex:o,index:l}=t.origin,s=y(i,[...w,...k]);s[`${e.type}`]=e.value,u(n)&&(s.key=t.origin.key);const r={...t.origin,data:s};$("change",r),me(r,"change")}else{const t={data:{time:P(e.pointer.x),value:A(e.origin.type,e.pointer.y),...u(e.origin.type)?{key:e.origin.key}:{}},...e.origin};$("add",t),me(t)}},setPopup:he,isAddPoint:ye,updateData:me,redrawPoints:xe,gridPoints:re}}function Y(e,t){return"fixed"===e.position||!t.value&&0!==t.value}export{E as useCenter};
@@ -1 +1 @@
1
- import{fabric as t}from"../../../../../shared/utils/fabricjs/index.js";import{drawLine as e,defaultTextStyle as i,defaultStyle as n,drawTextAndIconGroup as o,drawTextGroup as l}from"../useDraw.js";import"date-fns";import{getType as r,isOneLine as s}from"../../utils/index.js";import"lodash-es";import"../useEvent.js";import{getScaleInfo as u,drawScaleNumber as a,drawScaleLine as h}from"../useScaleColumn.js";import{useCommon as c}from"../useCommon.js";import"vue";import"./useShadow.js";import"naive-ui";import"@vueuse/core";function g(g,d,p,f,m,v,y,w,S,Y,b,x){var j,C;const{getEqualXTypes:X,handleAddPrevent:N,isGridLimit:T}=c(g,p,d),{originY:V,endY:L,originX:k,endX:E,xCellWidth:M,yCellHeight:W,left:G,vitalSignsOriginY:O,painOriginY:R,painHeight:A,iconsWidth:H,itemList:I,painIndex:_,right:B,canvasWidth:J,canvasHeight:$,getRightInfo:q,borderStyle:D,surplusCell:P}=d;function z(o){var r;if(!(null==o?void 0:o.length))return;const{layout:s}=o[0];let c=H,d=k;"right"===s&&(c=E,d=E+(null!=(r=null==B?void 0:B.width)?r:0));const p=[],f=A&&"right"!==s?o.length-1:o.length,m=(d-c)/f,v=m+(d-c)%f;o.forEach(((o,r)=>{if("pain"===o.type)return void function(n){const{list:o=[],spaceGridNumber:r=5,showScale:s,showNumber:h,position:c,showMaxMinNumber:d,style:p,title:f}=n,m=l({width:k-H,height:A,...D},{value:`${f}`,...i,...p||{}},{left:H,top:R.originY}),v=e([H,R.originY,k,R.originY],D),y=[];if(s||h){const{lineXMain:e,textLeft:i}=u(c,H,k-H),l=o.length;o.forEach(((o,u)=>{let c=R.endY-u*W*r;if(0===u&&(c=L-5),!h||(0===u||u===l-1)&&!d||y.push(a(o,n,i,c)),s&&0!==u){const[i,n]=e,o=new t.Line([i,c,n,c],{...D,...p});y.push(o)}}))}g.value.add(v,m,...y),m.sendToBack()}(o);const d=[],f=0===r?v:m,y=0===r?c:v+c+(r-1)*m,w="right"===s?0:O.originY,S="right"===s?$:O.endY,Y=r>0?e([y,w,y,S],{objectCaching:!1,...D}):null;Y&&d.push(Y);const b=y+f/2,{list:x=[],spaceGridNumber:j=5,showScale:C,showNumber:X,position:N,showMaxMinNumber:T,detailedList:E=[],showdetailedScale:M,showRange:G=[]}=o;if(C||X){const[t,e]=G,{lineXMain:i,lineXSub:n,textLeft:l}=u(N,y,f),r=(x[1]-x[0])/2,s=M&&!E.length?x.reduce(((t,e,i)=>{const n=t[t.length-1];return 0===i?[e]:t.concat([n+r,n+2*r])}),[]):M&&(null==E?void 0:E.length)?E:x,c=s.length;s.forEach(((r,s)=>{if(t&&+r<t)return;if(e&&+r>e)return;const u=O.endY-s*W*(M?j/2:j);if(X&&(!(0===s||s===c-1)||T)&&t!==+r){const t=0==s?u-5:u,e=a(r,o,l,t),i=O.originY+e.height/2;t<i&&e.set({top:i}),d.push(e)}d.push(...h(o,s,i,n,u,W,O.originY))}))}let I=o.title||"";o.unit&&(I+="\n"+o.unit);let B=O.originY+W;0!==_&&P[0]>1&&(B=V+W*P[0]/2),I&&d.push(new t.Text(String(I),{...i,left:b,top:B,textAlign:"center",...o.style}));const J=new t.Group(d,{...n,objectCaching:!1});p.push(J)}));const y=p.length>0?new t.Group([...p],{...n,objectCaching:!1}):null;y&&g.value.add(y),y&&y.sendToBack()}H&&function(){const t=JSON.parse(JSON.stringify(I));let e=L;const i=H-G.icons.marginRight;t.reverse().forEach((t=>{e-=10;let n=t.title.replace(/(.{2})/g,"$1\n");n.endsWith("\n")&&(n=n.slice(0,n.length-1));const{text:l,icon:u}=o(n,t,{text:{left:i-(t.pointAttr.width||10)-5,top:e,originX:"right"},icon:{originX:"right",left:i,topY:e,origin:{type:r(t.bigType),_type:t.bigType},...d.event}});var a;e-=l.height||30,(a=u).on("moving",(()=>{a.set("originX","center"),function(t){if(t.left>=k&&t.left<=E){t.setCoords();const e="pain"===t.origin.type?R:O;t.top<e.originY&&t.set("top",e.originY),t.top>e.endY&&t.set("top",e.endY)}}(a),T(a)?f(a):m.show=!1})),a.on("mouseup:before",(t=>{if(m.show=!1,0===t.e.button&&T(a)){const t=X([...x],a.left,"_type").includes(a.origin._type),e=Y(a.left);if(!e||t)t&&e&&N("repeat");else{const t={data:{time:w(a.left),value:S(a.origin.type,a.top),...s(a.origin.type)?{key:a.origin.key}:{}},...a.origin};p("add",t),b(t)}}!function(t){t.setCoords().set({originX:"right",left:t.originLeft,top:t.originTop})}(a)})),g.value.add(l,u)}))}();const F=G.yScaleValue.filter((t=>"left"===t.layout&&"pain"!==t.type&&t.show));if((null==B?void 0:B.width)&&"left"===(null==(j=null==B?void 0:B.yScaleValue)?void 0:j.layout)&&(null==(C=null==B?void 0:B.yScaleValue)?void 0:C.show)&&F.push(q),_>0&&G.yScaleValue[_].show){const t=G.yScaleValue[_];0===_&&G.yScaleValue.length>1&&F.unshift(t),_==G.yScaleValue.length-1&&F.push(t)}const K=F.findIndex((t=>"pulse"===t.type&&t.show&&t.doubleShow)),Q=F[K];return K>-1&&F.splice(K,0,{...Q,title:(null==Q?void 0:Q.doubleTitle)||(null==Q?void 0:Q.title)}),z(F),g.value.add(new t.Rect({left:H,top:0,width:J-H-D.strokeWidth,height:$-D.strokeWidth,fill:"transparent",...D})),{drawScaleValue:z}}export{g as useLeft};
1
+ import{fabric as t}from"../../../../../shared/utils/fabricjs/index.js";import{drawLine as e,defaultTextStyle as i,defaultStyle as n,drawTextAndIconGroup as o,drawTextGroup as l}from"../useDraw.js";import"date-fns";import{getType as r,isOneLine as s}from"../../utils/index.js";import"lodash-es";import"../useEvent.js";import{getScaleInfo as u,drawScaleNumber as a,drawScaleLine as h}from"../useScaleColumn.js";import{useCommon as c}from"../useCommon.js";import"vue";import"./useShadow.js";import"@vueuse/shared";import"naive-ui";import"@vueuse/core";function d(d,g,p,f,m,v,y,w,S,Y,b,x){var j,C;const{getEqualXTypes:X,handleAddPrevent:N,isGridLimit:T}=c(d,p,g),{originY:V,endY:L,originX:k,endX:E,xCellWidth:M,yCellHeight:W,left:G,vitalSignsOriginY:O,painOriginY:R,painHeight:A,iconsWidth:H,itemList:I,painIndex:_,right:B,canvasWidth:J,canvasHeight:$,getRightInfo:q,borderStyle:D,surplusCell:P}=g;function z(o){var r;if(!(null==o?void 0:o.length))return;const{layout:s}=o[0];let c=H,g=k;"right"===s&&(c=E,g=E+(null!=(r=null==B?void 0:B.width)?r:0));const p=[],f=A&&"right"!==s?o.length-1:o.length,m=(g-c)/f,v=m+(g-c)%f;o.forEach(((o,r)=>{if("pain"===o.type)return void function(n){const{list:o=[],spaceGridNumber:r=5,showScale:s,showNumber:h,position:c,showMaxMinNumber:g,style:p,title:f}=n,m=l({width:k-H,height:A,...D},{value:`${f}`,...i,...p||{}},{left:H,top:R.originY}),v=e([H,R.originY,k,R.originY],D),y=[];if(s||h){const{lineXMain:e,textLeft:i}=u(c,H,k-H),l=o.length;o.forEach(((o,u)=>{let c=R.endY-u*W*r;if(0===u&&(c=L-5),!h||(0===u||u===l-1)&&!g||y.push(a(o,n,i,c)),s&&0!==u){const[i,n]=e,o=new t.Line([i,c,n,c],{...D,...p});y.push(o)}}))}d.value.add(v,m,...y),m.sendToBack()}(o);const g=[],f=0===r?v:m,y=0===r?c:v+c+(r-1)*m,w="right"===s?0:O.originY,S="right"===s?$:O.endY,Y=r>0?e([y,w,y,S],{objectCaching:!1,...D}):null;Y&&g.push(Y);const b=y+f/2,{list:x=[],spaceGridNumber:j=5,showScale:C,showNumber:X,position:N,showMaxMinNumber:T,detailedList:E=[],showdetailedScale:M,showRange:G=[]}=o;if(C||X){const[t,e]=G,{lineXMain:i,lineXSub:n,textLeft:l}=u(N,y,f),r=(x[1]-x[0])/2,s=M&&!E.length?x.reduce(((t,e,i)=>{const n=t[t.length-1];return 0===i?[e]:t.concat([n+r,n+2*r])}),[]):M&&(null==E?void 0:E.length)?E:x,c=s.length;s.forEach(((r,s)=>{if(t&&+r<t)return;if(e&&+r>e)return;const u=O.endY-s*W*(M?j/2:j);if(X&&(!(0===s||s===c-1)||T)&&t!==+r){const t=0==s?u-5:u,e=a(r,o,l,t),i=O.originY+e.height/2;t<i&&e.set({top:i}),g.push(e)}g.push(...h(o,s,i,n,u,W,O.originY))}))}let I=o.title||"";o.unit&&(I+="\n"+o.unit);let B=O.originY+W;0!==_&&P[0]>1&&(B=V+W*P[0]/2),I&&g.push(new t.Text(String(I),{...i,left:b,top:B,textAlign:"center",...o.style}));const J=new t.Group(g,{...n,objectCaching:!1});p.push(J)}));const y=p.length>0?new t.Group([...p],{...n,objectCaching:!1}):null;y&&d.value.add(y),y&&y.sendToBack()}H&&function(){const t=JSON.parse(JSON.stringify(I));let e=L;const i=H-G.icons.marginRight;t.reverse().forEach((t=>{e-=10;let n=t.title.replace(/(.{2})/g,"$1\n");n.endsWith("\n")&&(n=n.slice(0,n.length-1));const{text:l,icon:u}=o(n,t,{text:{left:i-(t.pointAttr.width||10)-5,top:e,originX:"right"},icon:{originX:"right",left:i,topY:e,origin:{type:r(t.bigType),_type:t.bigType},...g.event}});var a;e-=l.height||30,(a=u).on("moving",(()=>{a.set("originX","center"),function(t){if(t.left>=k&&t.left<=E){t.setCoords();const e="pain"===t.origin.type?R:O;t.top<e.originY&&t.set("top",e.originY),t.top>e.endY&&t.set("top",e.endY)}}(a),T(a)?f(a):m.show=!1})),a.on("mouseup:before",(t=>{if(m.show=!1,0===t.e.button&&T(a)){const t=X([...x],a.left,"_type").includes(a.origin._type),e=Y(a.left);if(!e||t)t&&e&&N("repeat");else{const t={data:{time:w(a.left),value:S(a.origin.type,a.top),...s(a.origin.type)?{key:a.origin.key}:{}},...a.origin};p("add",t),b(t)}}!function(t){t.setCoords().set({originX:"right",left:t.originLeft,top:t.originTop})}(a)})),d.value.add(l,u)}))}();const F=G.yScaleValue.filter((t=>"left"===t.layout&&"pain"!==t.type&&t.show));if((null==B?void 0:B.width)&&"left"===(null==(j=null==B?void 0:B.yScaleValue)?void 0:j.layout)&&(null==(C=null==B?void 0:B.yScaleValue)?void 0:C.show)&&F.push(q),_>0&&G.yScaleValue[_].show){const t=G.yScaleValue[_];0===_&&G.yScaleValue.length>1&&F.unshift(t),_==G.yScaleValue.length-1&&F.push(t)}const K=F.findIndex((t=>"pulse"===t.type&&t.show&&t.doubleShow)),Q=F[K];return K>-1&&F.splice(K,0,{...Q,title:(null==Q?void 0:Q.doubleTitle)||(null==Q?void 0:Q.title)}),z(F),d.value.add(new t.Rect({left:H,top:0,width:J-H-D.strokeWidth,height:$-D.strokeWidth,fill:"transparent",...D})),{drawScaleValue:z}}export{d as useLeft};
@@ -1 +1 @@
1
- import{fabric as t}from"../../../../../shared/utils/fabricjs/index.js";import{defaultStyle as e}from"../useDraw.js";import"date-fns";import{last as i}from"lodash-es";import"../useEvent.js";import"vue";import"./useShadow.js";import"naive-ui";import"@vueuse/core";function n(n,o,r,l){const{other:s,vitalSignsOriginY:h,xCellWidth:a,yCellHeight:u,endX:c}=o;let f=0;function g(i,o,l){const h=[];String(i.value).split("").forEach(((n,o)=>{const r=new t.Text(n,{left:0,top:u*o,originX:"center",...e,objectCaching:!1,...i.style||{}});f=(u-(r.height||0))/2,h.push(r)}));const c=new t.Rect({left:0,top:0,width:a,height:u*h.length,fill:"transparent",originX:"center",...e}),{eventHighlight:g=!1}=s||{},p={originX:"center",left:o,top:l+f,baseTop:(i.baseTop||0)*u,trueLeft:o,trueHeight:h.length*u,objectCaching:!1,hoverCursor:"pointer",highlightObject:c,originData:i,selectable:!1,evented:g},v=new t.Group([c,...h],p);return function(t){const{highlightColor:e="#ffff00"}=s||{};t.on("mouseover",(()=>{t.highlightObject.set("fill",e),n.value.requestRenderAll()})),t.on("mouseout",(()=>{t.highlightObject.set("fill","transparent"),n.value.requestRenderAll()})),t.on("mousedown",(function(){r("eventClick",t.originData)}))}(v),n.value.add(v),v}!function(){if(!(null==s?void 0:s.list))return!1;const t=[],e=[];s.list.forEach(((t,i)=>{const n=0===i?"vertical":t.align||"vertical",o=l(t.time,!0);if(o>c)return;const r=e.find((t=>t.left==o));if(r)r[n].push(t);else{const i={left:o,vertical:[],horizontal:[]};i[n].push(t),e.push(i)}})),e.forEach((e=>{let n=h.originY,o=e.left;e.vertical.forEach(((r,l)=>{var s,c;const f=(r.baseTop||0)*u,p=(null==(s=i(t))?void 0:s.left)||0;0===l&&e.left<=p&&(o=p+a);if(t.filter((t=>t.trueLeft===o)).length){const e=String(r.value).length*u,l=(null==(c=i(t))?void 0:c.trueHeight)||0;n+=l,n+e+f>h.endY&&(n=h.originY,o+=a)}n+=f,String(r.value).length&&t.push(g(r,o,n))})),e.horizontal.forEach(((n,r)=>{var l;const s=h.originY+(n.baseTop||0)*u,c=(null==(l=i(t))?void 0:l.left)||0;e.left<=c&&(o=c+a),String(n.value).length&&t.push(g(n,o,s))}))}))}()}export{n as useOther};
1
+ import{fabric as e}from"../../../../../shared/utils/fabricjs/index.js";import{defaultStyle as t}from"../useDraw.js";import"date-fns";import{last as i}from"lodash-es";import"../useEvent.js";import"vue";import"./useShadow.js";import"@vueuse/shared";import"naive-ui";import"@vueuse/core";function n(n,o,r,l){const{other:s,vitalSignsOriginY:h,xCellWidth:u,yCellHeight:a,endX:c}=o;let f=0;function g(i,o,l){const h=[];String(i.value).split("").forEach(((n,o)=>{const r=new e.Text(n,{left:0,top:a*o,originX:"center",...t,objectCaching:!1,...i.style||{}});f=(a-(r.height||0))/2,h.push(r)}));const c=new e.Rect({left:0,top:0,width:u,height:a*h.length,fill:"transparent",originX:"center",...t}),{eventHighlight:g=!1}=s||{},p={originX:"center",left:o,top:l+f,baseTop:(i.baseTop||0)*a,trueLeft:o,trueHeight:h.length*a,objectCaching:!1,hoverCursor:"pointer",highlightObject:c,originData:i,selectable:!1,evented:g},v=new e.Group([c,...h],p);return function(e){const{highlightColor:t="#ffff00"}=s||{};e.on("mouseover",(()=>{e.highlightObject.set("fill",t),n.value.requestRenderAll()})),e.on("mouseout",(()=>{e.highlightObject.set("fill","transparent"),n.value.requestRenderAll()})),e.on("mousedown",(function(){r("eventClick",e.originData)}))}(v),n.value.add(v),v}!function(){if(!(null==s?void 0:s.list))return!1;const e=[],t=[];s.list.forEach(((e,i)=>{const n=0===i?"vertical":e.align||"vertical",o=l(e.time,!0);if(o>c)return;const r=t.find((e=>e.left==o));if(r)r[n].push(e);else{const i={left:o,vertical:[],horizontal:[]};i[n].push(e),t.push(i)}})),t.forEach((t=>{let n=h.originY,o=t.left;t.vertical.forEach(((r,l)=>{var s,c;const f=(r.baseTop||0)*a,p=(null==(s=i(e))?void 0:s.left)||0;0===l&&t.left<=p&&(o=p+u);if(e.filter((e=>e.trueLeft===o)).length){const t=String(r.value).length*a,l=(null==(c=i(e))?void 0:c.trueHeight)||0;n+=l,n+t+f>h.endY&&(n=h.originY,o+=u)}n+=f,String(r.value).length&&e.push(g(r,o,n))})),t.horizontal.forEach(((n,r)=>{var l;const s=h.originY+(n.baseTop||0)*a,c=(null==(l=i(e))?void 0:l.left)||0;t.left<=c&&(o=c+u),String(n.value).length&&e.push(g(n,o,s))}))}))}()}export{n as useOther};
@@ -1 +1 @@
1
- import{fabric as t}from"../../../../../shared/utils/fabricjs/index.js";import{drawLine as e,defaultStyle as l,drawTextGroup as i,defaultTextStyle as s}from"../useDraw.js";import"date-fns";import{flatten as o}from"lodash-es";import"../useEvent.js";import"vue";import"./useShadow.js";import"naive-ui";import"@vueuse/core";function u(u,h){const{grid:n,originX:r,endX:a,xCellWidth:c,gridXNumber:p,top:d,xScalevalueHeight:f,iconsWidth:v,topList:g,endXLimit:y,canvasWidth:m,borderStyle:S,surplusCell:w}=h;!function(){const x=[];y&&x.push(new t.Line([y,0,m,0],S));let X=0;g.forEach(((t,l)=>{if(l>0&&(X+=h[`${g[l-1].key}Height`]),"xScalevalue"==t.key)!function(t,l,o){const u=d.dayHeight;if(!u)return;l.push(e([r,o+u,a,o+u],S));const h=c*n.subSecondXCell,f=(p-w[1]-w[3])/n.subSecondXCell;for(let n=0;n<f;n++){const a=r+n*h,c=n%2==0?"上午":"下午",p=i({width:h,height:u,...S},{value:c,...s,...t.style||{}},{left:a,top:o});l.push(p),l.push(e([a+h,o,a+h,o+u],S))}}(t,x,X),function(t,l,u){var h;const p=d.xScalevalue.show&&null!=(h=d.dayHeight)?h:0,g=f-p;if(!g)return;l.push(e([v,u+f,a,u+f],S));const y=i({width:r-v,height:f,...S},{value:d.xScalevalue.title,...s,...t.style||{},...t.titleStyle||{}},{left:v,top:u});l.push(y),l.push(e([r,u,r,u+f],S));const m=[];for(let t=0;t<n.mainXCell;t++)m.push(d.xScalevalue.list);o(m).forEach(((o,h)=>{const n=r+h*c,a=i({width:c,height:g,...S},{value:o.value,...s,...t.style||{},...o.style||{}},{left:n,top:u+p});l.push(a),l.push(e([n+c,u+p,n+c,u+p+g],S))}))}(t,x,X);else{if(!h[`${t.key}Height`])return;const o=h[`${g[l].key}Height`];!function(t,l,o){const u=h[`${t.key}Height`],a=i({width:r-v,height:u,...S},{value:t.title,...s,...(null==t?void 0:t.style)||{},...t.titleStyle||{}},{left:v,top:o});l.push(a);const p=c*n.subXCell;t.list.forEach(((h,n)=>{const a=r+n*p,c=i({width:p,height:u,...S},{value:h,...s,...(null==t?void 0:t.style)||{}},{left:a,top:o});l.push(e([a+p,o,a+p,o+u],S)),l.push(c)}))}(t,x,X),x.push(e([v,X+o,a,X+o],S)),x.push(e([r,X,r,X+o],S))}}));const b=x.length>0?new t.Group([...x],{...l,objectCaching:!1}):null;b&&b.sendToBack(),b&&u.value.add(b)}()}export{u as useTop};
1
+ import{fabric as e}from"../../../../../shared/utils/fabricjs/index.js";import{drawLine as t,defaultStyle as l,drawTextGroup as s,defaultTextStyle as i}from"../useDraw.js";import"date-fns";import{flatten as o}from"lodash-es";import"../useEvent.js";import"vue";import"./useShadow.js";import"@vueuse/shared";import"naive-ui";import"@vueuse/core";function u(u,h){const{grid:n,originX:r,endX:a,xCellWidth:c,gridXNumber:p,top:d,xScalevalueHeight:f,iconsWidth:v,topList:g,endXLimit:m,canvasWidth:y,borderStyle:S,surplusCell:w}=h;!function(){const x=[];m&&x.push(new e.Line([m,0,y,0],S));let X=0;g.forEach(((e,l)=>{if(l>0&&(X+=h[`${g[l-1].key}Height`]),"xScalevalue"==e.key)!function(e,l,o){const u=d.dayHeight;if(!u)return;l.push(t([r,o+u,a,o+u],S));const h=c*n.subSecondXCell,f=(p-w[1]-w[3])/n.subSecondXCell;for(let n=0;n<f;n++){const a=r+n*h,c=n%2==0?"上午":"下午",p=s({width:h,height:u,...S},{value:c,...i,...e.style||{}},{left:a,top:o});l.push(p),l.push(t([a+h,o,a+h,o+u],S))}}(e,x,X),function(e,l,u){var h;const p=d.xScalevalue.show&&null!=(h=d.dayHeight)?h:0,g=f-p;if(!g)return;l.push(t([v,u+f,a,u+f],S));const m=s({width:r-v,height:f,...S},{value:d.xScalevalue.title,...i,...e.style||{},...e.titleStyle||{}},{left:v,top:u});l.push(m),l.push(t([r,u,r,u+f],S));const y=[];for(let e=0;e<n.mainXCell;e++)y.push(d.xScalevalue.list);o(y).forEach(((o,h)=>{const n=r+h*c,a=s({width:c,height:g,...S},{value:o.value,...i,...e.style||{},...o.style||{}},{left:n,top:u+p});l.push(a),l.push(t([n+c,u+p,n+c,u+p+g],S))}))}(e,x,X);else{if(!h[`${e.key}Height`])return;const o=h[`${g[l].key}Height`];!function(e,l,o){const u=h[`${e.key}Height`],a=s({width:r-v,height:u,...S},{value:e.title,...i,...(null==e?void 0:e.style)||{},...e.titleStyle||{}},{left:v,top:o});l.push(a);const p=c*n.subXCell;e.list.forEach(((h,n)=>{const a=r+n*p,c=s({width:p,height:u,...S},{value:h,...i,...(null==e?void 0:e.style)||{}},{left:a,top:o});l.push(t([a+p,o,a+p,o+u],S)),l.push(c)}))}(e,x,X),x.push(t([v,X+o,a,X+o],S)),x.push(t([r,X,r,X+o],S))}}));const b=x.length>0?new e.Group([...x],{...l,objectCaching:!1}):null;b&&b.sendToBack(),b&&u.value.add(b)}()}export{u as useTop};
@@ -1 +1 @@
1
- import{isNull as n,isNumber as t}from"lodash-es";function e(n){return(null==n?void 0:n.time)&&((null==n?void 0:n.value)||0===(null==n?void 0:n.value))}function r(n,t){const e={};for(const r in n)t.map((n=>n.type)).includes(r)||(e[r]=n[r]);return e}function u(n,t){const e=t.findIndex((t=>p(t.time)>p(n)));return~e?e:t.length}function o(n){return["temperature","pulse"].includes(n)}function i(n,t){return n.includes("心率")?"pulse_other":t}function l(n){return n.includes("_other")?n.split("_")[0]:n}function c(t){return!Number.isNaN(+t)&&!n(t)}function f(n,t){return a(n.left,1)===a(t.left,1)&&Math.abs(a(n.top,1)-a(t.top,1))<=2}function a(n,t=100){return Math.floor(n*t)/t}function s(n){let t=0;return n.forEach((n=>{var e;(null==(e=n.children)?void 0:e.length)?t+=s(n.children):t++})),t}function p(n){return n?t(n)?new Date(n).getTime():Date.parse(n.replace(/-/g,"/")):Date.now()}function d(n,t){const e=[],[r,u]=n;t=t||1;for(let n=r;t>0?n<=u:n>=u;n+=t)e.push(n);return e}function h(n){const{width:t,height:e,left:r,top:u}=n,o=t/2,i=e/2;return{minLeft:r-o,maxLeft:r+o,minTop:u-i,maxTop:u+i}}export{r as deleteProperty,s as getChildrenSize,a as getFloorNumber,u as getIndex,h as getPointRange,d as getScaleNumberList,p as getTime,l as getType,e as isEffectiveNode,o as isOneLine,f as isOverlapPoint,c as isValidValue,i as setOtherType};
1
+ import{isNull as n,isNumber as t}from"lodash-es";function e(n){return(null==n?void 0:n.time)&&((null==n?void 0:n.value)||0===(null==n?void 0:n.value))}function r(n,t){const e={};for(const r in n)t.map((n=>n.type)).includes(r)||(e[r]=n[r]);return e}function u(n,t){const e=t.findIndex((t=>p(t.time)>p(n)));return~e?e:t.length}function o(n){return["temperature"].includes(n)}function i(n,t){return n.includes("心率")?"pulse_other":t}function l(n){return n.includes("_other")?n.split("_")[0]:n}function c(t){return!Number.isNaN(+t)&&!n(t)}function f(n,t){return a(n.left,1)===a(t.left,1)&&Math.abs(a(n.top,1)-a(t.top,1))<=2}function a(n,t=100){return Math.floor(n*t)/t}function s(n){let t=0;return n.forEach((n=>{var e;(null==(e=n.children)?void 0:e.length)?t+=s(n.children):t++})),t}function p(n){return n?t(n)?new Date(n).getTime():Date.parse(n.replace(/-/g,"/")):Date.now()}function d(n,t){const e=[],[r,u]=n;t=t||1;for(let n=r;t>0?n<=u:n>=u;n+=t)e.push(n);return e}function h(n){const{width:t,height:e,left:r,top:u}=n,o=t/2,i=e/2;return{minLeft:r-o,maxLeft:r+o,minTop:u-i,maxTop:u+i}}export{r as deleteProperty,s as getChildrenSize,a as getFloorNumber,u as getIndex,h as getPointRange,d as getScaleNumberList,p as getTime,l as getType,e as isEffectiveNode,o as isOneLine,f as isOverlapPoint,c as isValidValue,i as setOtherType};
@@ -1 +1 @@
1
- import{COMPONENT_NAMESPACE as e}from"../../shared/global/variable.js";import{safeComponentRegister as o}from"../../shared/utils/index.js";import s from"./src/FormRenderWrapper.vue.js";export{useAnchor}from"./src/hooks/useAnchor.js";export{useAutoHidden}from"./src/hooks/useAutoHidden.js";export{BusinessCollector,useBusinessBinding}from"./src/hooks/useBusinessBinding.js";export{ContextCollector,useChangeContext}from"./src/hooks/useChangeContext.js";export{useCommonInjection,useSelectOptionProps}from"./src/hooks/useCommonInjection.js";export{useCommonLog}from"./src/hooks/useCommonLog.js";export{useComplexOptions,useComplexOptionsSpan}from"./src/hooks/useComplexOptions.js";export{useFieldListAdaptor}from"./src/hooks/useFieldListAdaptor.js";export{useFieldNormalize}from"./src/hooks/useFieldNormalize.js";export{useFieldVisitor}from"./src/hooks/useFieldVisitor.js";export{useFormContext}from"./src/hooks/useFormContext.js";export{useFormDomEvent,useFormExposeEvent}from"./src/hooks/useFormEvent.js";export{useFormField}from"./src/hooks/useFormField.js";export{useFormGraph}from"./src/hooks/useFormGraph.js";export{FormItemDepsCollector,useFormItemDeps}from"./src/hooks/useFormItemDeps.js";export{useFormRenderLifeCycle}from"./src/hooks/useFormRenderLifeCycle.js";export{useAutographOptions,useRecommendOptions,useUrlConfigOptions}from"./src/hooks/useFormRenderOptions.js";export{useFormValidator,validateMessageLocale}from"./src/hooks/useFormValidator.js";export{useLowCodeEvent}from"./src/hooks/useLowCodeEvent.js";export{useLowCodeReactions}from"./src/hooks/useLowCodeReactions.js";export{useNuiThemeOverrides}from"./src/hooks/useNuiThemeOverrides.js";export{useOperationalForm}from"./src/hooks/useOperationalForm.js";export{usePresetScope}from"./src/hooks/usePresetScope.js";export{useWordbookSetting,wordbookSettingHandler}from"./src/hooks/useWordbookSetting.js";export{useNewLowCodeReactions}from"./src/hooks/useNewLowCodeReactions.js";export{useSelectedSetting}from"./src/hooks/useSelectedSetting.js";export{combineExtendKey,createInputSlot,createSlot,editorUnescape,formRenderLog,getAbsoluteKey,injectOrProvide,isNestedFieldType,isNestedType,mergeDeepProperties,parseNumberFromMaybeString,renderDescOption,splitExtendKey,validateMessageParser}from"./src/utils/index.js";export{businessDateParser,isIdCard,isMobile,parseAge2Birthday,parseAgeFromContext,parseBirthday,parseIdCard,transformDateFormat}from"./src/utils/business.js";export{findNextWidget,queryDecoratorByAddress,queryDecoratorByFieldKey,queryInput}from"./src/utils/dom.js";export{assignClearBindVisited,assignUpdateValue,assignValueBindKey,createLinebarId,createObjSchema,createVisitedSetter,dotEscape,fieldKeyEscape,getParentLinebar,traverseDependKey,traverseSchema}from"./src/utils/schema.js";const r=s;r.install=function(s){o(s,r,e+"FormRender")};export{r as default};
1
+ import{COMPONENT_NAMESPACE as e}from"../../shared/global/variable.js";import{safeComponentRegister as o}from"../../shared/utils/index.js";import s from"./src/FormRenderWrapper.vue.js";export{useAnchor}from"./src/hooks/useAnchor.js";export{useAutoHidden}from"./src/hooks/useAutoHidden.js";export{BusinessCollector,useBusinessBinding}from"./src/hooks/useBusinessBinding.js";export{ContextCollector,useChangeContext}from"./src/hooks/useChangeContext.js";export{useCommonInjection,useSelectOptionProps}from"./src/hooks/useCommonInjection.js";export{useCommonLog}from"./src/hooks/useCommonLog.js";export{useComplexOptions,useComplexOptionsSpan}from"./src/hooks/useComplexOptions.js";export{useFieldListAdaptor}from"./src/hooks/useFieldListAdaptor.js";export{useFieldNormalize}from"./src/hooks/useFieldNormalize.js";export{useFieldVisitor}from"./src/hooks/useFieldVisitor.js";export{useFormContext}from"./src/hooks/useFormContext.js";export{useFormDomEvent,useFormExposeEvent}from"./src/hooks/useFormEvent.js";export{useFormField}from"./src/hooks/useFormField.js";export{useFormGraph}from"./src/hooks/useFormGraph.js";export{FormItemDepsCollector,useFormItemDeps}from"./src/hooks/useFormItemDeps.js";export{useFormRenderLifeCycle}from"./src/hooks/useFormRenderLifeCycle.js";export{useAutographOptions,useRecommendOptions,useUrlConfigOptions}from"./src/hooks/useFormRenderOptions.js";export{useFormValidator,validateMessageLocale}from"./src/hooks/useFormValidator.js";export{useLowCodeEvent}from"./src/hooks/useLowCodeEvent.js";export{useLowCodeReactions}from"./src/hooks/useLowCodeReactions.js";export{useNuiThemeOverrides}from"./src/hooks/useNuiThemeOverrides.js";export{useOperationalForm}from"./src/hooks/useOperationalForm.js";export{usePresetScope}from"./src/hooks/usePresetScope.js";export{useWordbookSetting,wordbookSettingHandler}from"./src/hooks/useWordbookSetting.js";export{useNewLowCodeReactions}from"./src/hooks/useNewLowCodeReactions.js";export{useSelectedSetting}from"./src/hooks/useSelectedSetting.js";export{FieldListFilter,combineExtendKey,createInputSlot,createSlot,editorUnescape,findItemByValCondition,formRenderLog,getAbsoluteKey,injectOrProvide,isNestedFieldType,isNestedType,mergeDeepProperties,parseEnhanceText,parseNumberFromMaybeString,renderDescOption,replace2Any,splitExtendKey,validateMessageParser}from"./src/utils/index.js";export{businessDateParser,isIdCard,isMobile,parseAge2Birthday,parseAgeFromContext,parseBirthday,parseIdCard,transformDateFormat}from"./src/utils/business.js";export{findNextWidget,queryDecoratorByAddress,queryDecoratorByFieldKey,queryInput}from"./src/utils/dom.js";export{assignClearBindVisited,assignUpdateValue,assignValueBindKey,createLinebarId,createObjSchema,createVisitedSetter,dotEscape,fieldKeyEscape,getParentLinebar,traverseDependKey,traverseSchema}from"./src/utils/schema.js";const r=s;r.install=function(s){o(s,r,e+"FormRender")};export{r as default};
@@ -1 +1 @@
1
- import*as s from"./combination/index.js";import*as t from"./complex.js";import*as r from"./date.js";import*as o from"./formItem.js";import*as e from"./input.js";import*as m from"./inputGroup.js";import*as i from"./inputNumber.js";import*as a from"./levelSearchCascader/index.js";import*as p from"./lineBar/index.js";import*as x from"./radio_checkbox.js";import*as n from"./remoteSearch.js";import*as c from"./searchCascade.js";import*as f from"./select.js";import*as j from"./simpleComponent.js";import*as d from"./slider.js";import*as l from"./switch.js";import*as u from"./textarea.js";import*as h from"./time.js";import{separateMetaModule as b}from"../../../../../shared/utils/index.js";var C=b(Object.assign({"./combination/index.ts":s,"./complex.tsx":t,"./date.tsx":r,"./formItem.tsx":o,"./input.tsx":e,"./inputGroup.ts":m,"./inputNumber.tsx":i,"./levelSearchCascader/index.tsx":a,"./lineBar/index.ts":p,"./radio&checkbox.tsx":x,"./remoteSearch.tsx":n,"./searchCascade.tsx":c,"./select.tsx":f,"./simpleComponent.tsx":j,"./slider.tsx":d,"./switch.tsx":l,"./textarea.tsx":u,"./time.tsx":h}));export{C as default};
1
+ import*as s from"./combination/index.js";import*as t from"./complex.js";import*as r from"./date.js";import*as o from"./formItem.js";import*as e from"./input.js";import*as m from"./inputGroup.js";import*as i from"./inputNumber.js";import*as a from"./levelSearchCascader/index.js";import*as p from"./lineBar/index.js";import*as x from"./radio_checkbox.js";import*as n from"./remoteSearch.js";import*as c from"./searchCascade.js";import*as f from"./select.js";import*as j from"./simpleComponent.js";import*as d from"./slider.js";import*as l from"./switch.js";import*as u from"./text.js";import*as h from"./textarea.js";import*as b from"./time.js";import{separateMetaModule as C}from"../../../../../shared/utils/index.js";var S=C(Object.assign({"./combination/index.ts":s,"./complex.tsx":t,"./date.tsx":r,"./formItem.tsx":o,"./input.tsx":e,"./inputGroup.ts":m,"./inputNumber.tsx":i,"./levelSearchCascader/index.tsx":a,"./lineBar/index.ts":p,"./radio&checkbox.tsx":x,"./remoteSearch.tsx":n,"./searchCascade.tsx":c,"./select.tsx":f,"./simpleComponent.tsx":j,"./slider.tsx":d,"./switch.tsx":l,"./text.tsx":u,"./textarea.tsx":h,"./time.tsx":b}));export{S as default};
@@ -1,12 +1,4 @@
1
1
  import { AnyObject } from '../../../../../shared/types';
2
- export declare const TEXT: {
3
- (props: AnyObject): JSX.Element;
4
- props: {
5
- content: {};
6
- fieldItem: {};
7
- value: {};
8
- };
9
- };
10
2
  export declare const BUTTON: {
11
3
  (props: AnyObject): JSX.Element;
12
4
  props: {
@@ -1 +1 @@
1
- import{inject as n,createVNode as l}from"vue";import{connect as t,mapProps as o}from"@formily/vue";import{isString as e,isFunction as r}from"lodash-es";import{NButton as i}from"naive-ui";import{InjectionFormGlobalProps as u}from"../../constants/index.js";import{createSlot as c}from"../../utils/index.js";const m=n=>{var t,o,r;return l("div",null,[null==(r=(o=c(null!=(t=n.content)?t:n.value,n,(n=>e(n)?n.replaceAll("\n","<br>").split("<br>").map(((n,t,o)=>[n,t<o.length-1?l("br",null,null):null])):[n]))).default)?void 0:r.call(o)])};m.props={content:{},fieldItem:{},value:{}};const d=t(m,o((n=>{var l;return{...n,content:null==(l=n.fieldItem)?void 0:l.content}}))),s=n=>{const t=function(n){return l=>{var t;return null==(t=n.fieldItem)?void 0:t[l]}}(n);return l(i,{onClick:function(){var l;const o=t("onClick")||(null==(l=t("componentProps"))?void 0:l.onClick);return()=>r(o)&&o(n.fieldItem)}()},c(n.content,n))};s.props={onClick:{},fieldItem:{},content:{}};const a=t(s,o((n=>{var l,t,o;return{...n,content:null!=(o=null==(l=n.fieldItem)?void 0:l.content)?o:null==(t=n.fieldItem)?void 0:t.alias}}))),f=t((t=>{var o;const e=n(u,{}),r=(null!=(o=t.border)?o:null==e?void 0:e.outBordered)?{background:"rgb(31,34,37)",margin:"0 -8px"}:null;return l("section",{class:"form-render__linebreaks",style:{"--form-item-column":999,height:"1px",...r}},null)}));export{a as BUTTON,f as LINE_BREAKS,d as TEXT};
1
+ import{inject as n,createVNode as o}from"vue";import{connect as r,mapProps as t}from"@formily/vue";import{isFunction as e}from"lodash-es";import{NButton as l}from"naive-ui";import{InjectionFormGlobalProps as i}from"../../constants/index.js";import{createSlot as m}from"../../utils/index.js";const u=n=>{const r=function(n){return o=>{var r;return null==(r=n.fieldItem)?void 0:r[o]}}(n);return o(l,{onClick:function(){var o;const t=r("onClick")||(null==(o=r("componentProps"))?void 0:o.onClick);return()=>e(t)&&t(n.fieldItem)}()},m(n.content,n))};u.props={onClick:{},fieldItem:{},content:{}};const c=r(u,t((n=>{var o,r,t;return{...n,content:null!=(t=null==(o=n.fieldItem)?void 0:o.content)?t:null==(r=n.fieldItem)?void 0:r.alias}}))),s=r((r=>{var t;const e=n(i,{}),l=(null!=(t=r.border)?t:null==e?void 0:e.outBordered)?{background:"rgb(31,34,37)",margin:"0 -8px"}:null;return o("section",{class:"form-render__linebreaks",style:{"--form-item-column":999,height:"1px",...l}},null)}));export{c as BUTTON,s as LINE_BREAKS};
@@ -0,0 +1,17 @@
1
+ import { PropType } from 'vue';
2
+ import { FieldItem } from '../../../../../components/form-render';
3
+ export declare const TEXT: import("vue").DefineComponent<{
4
+ content: {};
5
+ fieldItem: {
6
+ type: PropType<FieldItem>;
7
+ };
8
+ value: {};
9
+ onChange: {};
10
+ }, () => JSX.Element, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
11
+ content: {};
12
+ fieldItem: {
13
+ type: PropType<FieldItem>;
14
+ };
15
+ value: {};
16
+ onChange: {};
17
+ }>>, {}>;
@@ -0,0 +1 @@
1
+ import{defineComponent as e,computed as t,inject as n,createVNode as o}from"vue";import{connect as r,mapProps as l,RecursionField as i}from"@formily/vue";import{isString as s}from"lodash-es";import"../../../index.js";import{InjectionBusinessCollector as a,InjectionFormGlobalProps as u}from"../../constants/index.js";import{createSlot as m,replace2Any as c}from"../../utils/index.js";import{useFieldListAdaptor as p}from"../../hooks/useFieldListAdaptor.js";import{createObjSchema as d}from"../../utils/schema.js";const f=r(e({name:"FORM_TEXT",props:{content:{},fieldItem:{type:Object},value:{},onChange:{}},setup(e){function r(t,n=!1){var r,l;return o("div",{style:n?{display:"flex",alignItems:"center"}:{}},[null==(l=(r=m(t,e,(e=>s(e)?e=c(e.replace("\n","<br>"),[{from:"<br>",to:o("br",null,null)},{from:" ",to:o("i",{style:{display:"inline-block",width:"4px"}},null)}]):[e]))).default)?void 0:l.call(r)])}const l=t((()=>{var t,n;return null!=(n=null==(t=e.fieldItem)?void 0:t.__textEnhance)?n:[]})),f=t((()=>l.value.length&&l.value.some((e=>"widget"===e.type)))),v=n(a),h=n(u),{schemaAdaptor:y}=p(v,h.lifeCycle);return()=>{var t;return f.value?o("div",{style:{display:"flex",alignItems:"center"}},[l.value.map((e=>{if("text"===e.type)return r(e.content,!0);if(s(e.content))return r(e.content,!0);const t={...e.content};return t.decoratorProps={...t.decoratorProps,showLabel:!1,showFeedback:!1},o(i,{basePath:".",schema:d(y([t]))},null)}))]):r(null!=(t=e.content)?t:e.value)}}}),l((e=>{var t;return{...e,content:null==(t=e.fieldItem)?void 0:t.content}})));export{f as TEXT};
@@ -1 +1 @@
1
- import{arrayed as e,traverse as t}from"../../../../shared/utils/index.js";import"../../../../shared/utils/tapable/SyncHook.js";import"../../../../shared/utils/tapable/SyncBailHook.js";import l from"../../../../shared/utils/tapable/SyncWaterfallHook.js";import"../../../../shared/utils/tapable/SyncLoopHook.js";import"../../../../shared/utils/tapable/AsyncParallelHook.js";import"../../../../shared/utils/tapable/AsyncParallelBailHook.js";import"../../../../shared/utils/tapable/AsyncSeriesHook.js";import"../../../../shared/utils/tapable/AsyncSeriesBailHook.js";import"../../../../shared/utils/tapable/AsyncSeriesLoopHook.js";import"../../../../shared/utils/tapable/AsyncSeriesWaterfallHook.js";import{isString as o}from"lodash-es";import"../../index.js";import{FIELD_BUSINESS_TYPE as r}from"../constants/index.js";import{transformDateFormat as i}from"../utils/business.js";function s(){const s=new l(["fieldList","props"]),a=new l(["fieldItem","props"]);a.tap("__forceClearable",((e,t)=>(t.forceClearable&&(e.componentProps={...e.componentProps,clearable:!0}),e))),a.tap("__time",(e=>("DATE"===e.html_type&&"time"===i(e.date_format)&&(e.html_type="TIME"),e))),a.tap("__block",(e=>(["CHECKBOX_BLOCK","RADIO_BLOCK"].includes(e.html_type)&&(e.__vertical=!0),e))),a.tap("__age",(t=>("AGE"===t.html_type&&(t.html_type="INPUT_NUMBER",t.reactions=t.reactions?e(t.reactions):[],t.reactions.push({target:t.val_key_unit,fulfill:{state:{disabled:"{{$self.disabled}}"}}}),t.suffixConfig=[{validate:{obj_type:r.AGE_UNIT},val_key:t.val_key_unit,html_type:"SELECT",option:t.option,urlConfig:t.urlConfig}]),t))),a.tap("__multiple_select",(e=>{const{html_type:t,multi_select:l,__multiple:o}=e;return e.__multiple="SEARCH"!==t&&("SEARCH_MORE"===t||("SELECT"===t?"0"===l:o)),e}));const p=[[["SEARCH","PHONE_TYPE","IDCARD_TYPE","SEARCH_MORE"],"SELECT"],["DIGITAL","INPUT_NUMBER"],["CHECKBOX_BLOCK","CHECKBOX"],["RADIO_BLOCK","RADIO"],[["DATE-INPUT","DATETIME-INPUT"],"DATE"],["SWITCH_COMPONENT","SWITCH"],["SLIDER_COMPONENT","SLIDER"],["LEVEL_SEARCH_CASCADE","LEVEL_SEARCH_CASCADER"],["SEARCH_CASCADE","SEARCH_CASCADER"]];a.tap("__normalize",(e=>(p.some((([t,l])=>(Array.isArray(t)?t.includes(e.html_type):t===e.html_type)&&(e.html_type=l))),e)));const _=new Map([[["SELECT","SEARCH","SEARCH_MORE"],new Map([["H_TILE",e=>e.html_type=e.__multiple?"CHECKBOX":"RADIO"],["V_TILE",e=>{e.html_type=e.__multiple?"CHECKBOX":"RADIO",e.__vertical=!0}]])],["RADIO",new Map([["DROPDOWN",e=>e.html_type="SELECT"]])],["CHECKBOX",new Map([["DROPDOWN",e=>{e.__multiple=!0,e.html_type="SELECT"}]])]]);return a.tap({stage:9999,name:"__show_mode"},(t=>t.show_mode?([..._].some((([l,o])=>{if(!e(l).includes(t.html_type))return;const r=o.get(t.show_mode);return r&&r(t),!0})),t):t)),s.tap("__out_bordered",((e,{column:t,outBordered:l})=>e)),s.tap("__prefix/suffix",(e=>{const l=[];return t(e,(r=>{["prefix","suffix"].forEach((i=>{const s=r[i];if(!o(s))return;const a=s.match("#{(.+)}");if(!a)return;const p=o(a[1])&&function(l){let o=null;return t(e,((e,t)=>{e.val_key===l&&(o=e,t())}),["children","properties"]),o}(a[1].trim());p&&(Reflect.deleteProperty(r,i),r[`${i}Config`]=r[`${i}Config`]||[],r[`${i}Config`].push(p),l.push(p))}))}),["children","properties"]),l.length?function e(t){return t.reduce(((t,o)=>(l.includes(o)||(t.push(o),o.properties&&(o.properties=e(o.properties)),o.children&&(o.children=e(o.children))),t)),[])}(e):e})),{FieldNormalizeWaterfallHook:a,FieldListNormalizeWaterfallHook:s}}export{s as useFieldNormalize};
1
+ import{arrayed as e,traverse as t}from"../../../../shared/utils/index.js";import"../../../../shared/utils/tapable/SyncHook.js";import"../../../../shared/utils/tapable/SyncBailHook.js";import l from"../../../../shared/utils/tapable/SyncWaterfallHook.js";import"../../../../shared/utils/tapable/SyncLoopHook.js";import"../../../../shared/utils/tapable/AsyncParallelHook.js";import"../../../../shared/utils/tapable/AsyncParallelBailHook.js";import"../../../../shared/utils/tapable/AsyncSeriesHook.js";import"../../../../shared/utils/tapable/AsyncSeriesBailHook.js";import"../../../../shared/utils/tapable/AsyncSeriesLoopHook.js";import"../../../../shared/utils/tapable/AsyncSeriesWaterfallHook.js";import{isString as o}from"lodash-es";import"../../index.js";import{FIELD_BUSINESS_TYPE as r}from"../constants/index.js";import{FieldListFilter as a,findItemByValCondition as s,parseEnhanceText as i}from"../utils/index.js";import{transformDateFormat as _}from"../utils/business.js";function p(){const p=new l(["fieldList","props"]),n=new l(["fieldItem","props"]);n.tap("__forceClearable",((e,t)=>(t.forceClearable&&(e.componentProps={...e.componentProps,clearable:!0}),e))),n.tap("__time",(e=>("DATE"===e.html_type&&"time"===_(e.date_format)&&(e.html_type="TIME"),e))),n.tap("__block",(e=>(["CHECKBOX_BLOCK","RADIO_BLOCK"].includes(e.html_type)&&(e.__vertical=!0),e))),n.tap("__age",(t=>("AGE"===t.html_type&&(t.html_type="INPUT_NUMBER",t.reactions=t.reactions?e(t.reactions):[],t.reactions.push({target:t.val_key_unit,fulfill:{state:{disabled:"{{$self.disabled}}"}}}),t.suffixConfig=[{validate:{obj_type:r.AGE_UNIT},val_key:t.val_key_unit,html_type:"SELECT",option:t.option,urlConfig:t.urlConfig}]),t))),n.tap("__multiple_select",(e=>{const{html_type:t,multi_select:l,__multiple:o}=e;return e.__multiple="SEARCH"!==t&&("SEARCH_MORE"===t||("SELECT"===t?"0"===l:o)),e}));const m=[[["SEARCH","PHONE_TYPE","IDCARD_TYPE","SEARCH_MORE"],"SELECT"],["DIGITAL","INPUT_NUMBER"],["CHECKBOX_BLOCK","CHECKBOX"],["RADIO_BLOCK","RADIO"],[["DATE-INPUT","DATETIME-INPUT"],"DATE"],["SWITCH_COMPONENT","SWITCH"],["SLIDER_COMPONENT","SLIDER"],["LEVEL_SEARCH_CASCADE","LEVEL_SEARCH_CASCADER"],["SEARCH_CASCADE","SEARCH_CASCADER"]];n.tap("__normalize",(e=>(m.some((([t,l])=>(Array.isArray(t)?t.includes(e.html_type):t===e.html_type)&&(e.html_type=l))),e)));const E=new Map([[["SELECT","SEARCH","SEARCH_MORE"],new Map([["H_TILE",e=>e.html_type=e.__multiple?"CHECKBOX":"RADIO"],["V_TILE",e=>{e.html_type=e.__multiple?"CHECKBOX":"RADIO",e.__vertical=!0}]])],["RADIO",new Map([["DROPDOWN",e=>e.html_type="SELECT"]])],["CHECKBOX",new Map([["DROPDOWN",e=>{e.__multiple=!0,e.html_type="SELECT"}]])]]);return n.tap({stage:9999,name:"__show_mode"},(t=>t.show_mode?([...E].some((([l,o])=>{if(!e(l).includes(t.html_type))return;const r=o.get(t.show_mode);return r&&r(t),!0})),t):t)),p.tap("__out_bordered",((e,{column:t,outBordered:l})=>e)),p.tap("__prefix/suffix",(e=>{const l=[];return t(e,(t=>{["prefix","suffix"].forEach((r=>{const a=t[r];if(!o(a))return;const i=a.match("#{(.+)}");if(!i)return;const _=o(i[1])&&s(e,(e=>e.val_key===i[1].trim()));_&&(Reflect.deleteProperty(t,r),t[`${r}Config`]=t[`${r}Config`]||[],t[`${r}Config`].push(_),l.push(_))}))}),["children","properties"]),l.length?a(e,(e=>l.includes(e))):e})),p.tap("__textEnhance",(e=>{const l=[];return t(e,(t=>{if("TEXT"!==t.html_type||!o(t.default_val))return;const r=i(t.default_val);t.__textEnhance=r,r.forEach((o=>{if("text"===o.type)return;const r=s(e,(e=>[e.name,e.val_key].includes(o.content)));r&&(Reflect.deleteProperty(t,"default_val"),l.push(r),o.content=r)}))}),["children","properties"]),a(e,(e=>l.includes(e)))})),{FieldNormalizeWaterfallHook:n,FieldListNormalizeWaterfallHook:p}}export{p as useFieldNormalize};
@@ -165,3 +165,7 @@ export declare type FormBusinessFormatter = (payload: {
165
165
  type: FIELD_BUSINESS_TYPE;
166
166
  from: FIELD_BUSINESS_TYPE;
167
167
  }) => unknown;
168
+ export declare type TextNodeType<T extends 'text' | 'widget' = 'text' | 'widget'> = {
169
+ type: T;
170
+ content: T extends 'text' ? string : FieldItem | string;
171
+ };
@@ -2,7 +2,7 @@ import { AnyObject, ArrayAble } from '../../../../shared/types';
2
2
  import { GeneralField } from '@formily/core';
3
3
  import { Pattern } from '@formily/path';
4
4
  import { FunctionalComponent, InjectionKey, VNode } from 'vue';
5
- import { FieldItem } from '../types';
5
+ import { FieldItem, TextNodeType } from '../types';
6
6
  export * from './business';
7
7
  export * from './dom';
8
8
  export * from './schema';
@@ -22,3 +22,10 @@ export declare function isNestedFieldType(field: FieldItem | GeneralField): bool
22
22
  export declare function renderDescOption(labelNode: any, option: AnyObject): JSX.Element;
23
23
  export declare function getAbsoluteKey(fieldKey: string, field: Pattern): string;
24
24
  export declare function editorUnescape(content: string): string;
25
+ export declare function FieldListFilter(list: FieldItem[], condition: (item: FieldItem) => boolean): FieldItem[];
26
+ export declare function findItemByValCondition(fieldList: FieldItem[], condition: (item: FieldItem) => boolean): FieldItem | null;
27
+ export declare function parseEnhanceText(str: string): TextNodeType<"text" | "widget">[];
28
+ export declare function replace2Any(str: string, replacer: {
29
+ from: string;
30
+ to: any;
31
+ }[]): any[];
@@ -1 +1 @@
1
- import{inject as n,provide as t,computed as e,createVNode as r,Fragment as o}from"vue";import{arrayed as i}from"../../../../shared/utils/index.js";import{isGeneralField as u}from"@formily/core";import{Path as f}from"@formily/path";import{HelpCircleSharp as c}from"@vicons/ionicons5";import{isObject as s}from"@vue/shared";import{useMemoize as l}from"@vueuse/core";import{isString as a,isFunction as p,omit as m}from"lodash-es";import{NTooltip as d,NIcon as h}from"naive-ui";import{NESTED_FORM_ITEM_TYPE as x}from"../constants/index.js";import"date-fns";function y(n){console.warn(`[FormRender]: ${n}`)}function g(n,t,e=["children","properties","suffixConfig"],r="val_key",o="default_val"){return function n(t,r){r.forEach((r=>{s(r)&&(null!=c(r)&&null==t[u(r)]&&f.setIn(t,u(r),c(r)),e.forEach((e=>{r[e]&&(t[u(r)]||(t[u(r)]={}),n(t[u(r)],i(r[e])))})))}))}(n,t),n;function u(n){return n[r]}function c(n){return n[o]}}function v(e,r){let o=n(e,null);return o||(o=r(),t(e,o)),o}function E(n){return n&&a(n)?+n:n}function _(n,t,e){if(s(n)&&!p(n)){const e={};return Object.entries(n).forEach((([n,r])=>{p(r)&&(e[n]=()=>r(t))})),e}return{default:()=>p(n)?n(t):e?e(n):[n]}}function K(n,t){return e((()=>{const e={};return n.prefix&&(e.prefix=()=>r(o,null,[_(n.prefix,n,t).default()])),n.suffix&&(e.suffix=()=>r(o,null,[_(n.suffix,n,t).default()])),e}))}function j(n,t){return a(n)&&n?n.replace(/\$\{([^}]*)}/g,(function(n,e){const r=e.split("||");for(const n of r){const e=t[n.trim()];if(e)return e}return""})):""}function k(n){return n.reduce(((n,t)=>(a(t.extendKey)&&t.extendKey&&n.push(t),b(t)&&n.push(...k(t.children||[])),n)),[])}function O(n,t){const e=k(n);if(!e.length)return t;const r={},o=new Map;return Object.entries(t).forEach((([n,i])=>{const u=e.find((t=>t.val_key===n));if(!u)return r[n]=i;const{val_key:f,extendKey:c}=u,s=o.get(c)||{};o.set(c,s),s[f]=t[f]})),[...o.entries()].forEach((([n,t])=>{r[n]=JSON.stringify(t)})),r}function S(n,t){const e=k(n);if(!e.length)return t;const r=l((n=>{try{return s(t[n])?t[n]:JSON.parse(t[n])||{}}catch(n){return{}}})),o=m(t,e.map((n=>n.extendKey)));return e.forEach((({val_key:n,extendKey:t})=>{Reflect.has(o,n)||(o[n]=r(t)[n])})),o}function $(n){return n&&x.includes(n)}function b(n){return $(u(n)?n.componentType:n.html_type)}function w(n,t){return r("section",{style:{display:"flex",alignItems:"center",gap:"4px"}},[n,t.desc?r(d,null,{trigger:()=>r(h,{component:c},null),default:()=>t.desc}):null])}function I(n,t){return f.parse(n.startsWith(".")?n:`.${n}`,t).toString()}function J(n){return n.replace(/&lt;/g,"<").replace(/&gt;/g,">")}export{O as combineExtendKey,K as createInputSlot,_ as createSlot,J as editorUnescape,y as formRenderLog,I as getAbsoluteKey,v as injectOrProvide,b as isNestedFieldType,$ as isNestedType,g as mergeDeepProperties,E as parseNumberFromMaybeString,w as renderDescOption,S as splitExtendKey,j as validateMessageParser};
1
+ import{inject as t,provide as n,computed as e,createVNode as r,Fragment as o}from"vue";import{traverse as i,arrayed as u}from"../../../../shared/utils/index.js";import{isGeneralField as c}from"@formily/core";import{Path as f}from"@formily/path";import{HelpCircleSharp as s}from"@vicons/ionicons5";import{isObject as l}from"@vue/shared";import{useMemoize as p}from"@vueuse/core";import{isString as a,isFunction as d,omit as E,castArray as T,flattenDeep as h}from"lodash-es";import{NTooltip as m,NIcon as R}from"naive-ui";import{NESTED_FORM_ITEM_TYPE as v}from"../constants/index.js";import"date-fns";function x(t){console.warn(`[FormRender]: ${t}`)}function y(t,n,e=["children","properties","suffixConfig"],r="val_key",o="default_val"){return function t(n,r){r.forEach((r=>{l(r)&&(null!=c(r)&&null==n[i(r)]&&f.setIn(n,i(r),c(r)),e.forEach((e=>{r[e]&&(n[i(r)]||(n[i(r)]={}),t(n[i(r)],u(r[e])))})))}))}(t,n),t;function i(t){return t[r]}function c(t){return t[o]}}function g(e,r){let o=t(e,null);return o||(o=r(),n(e,o)),o}function I(t){return t&&a(t)?+t:t}function A(t,n,e){if(l(t)&&!d(t)){const e={};return Object.entries(t).forEach((([t,r])=>{d(r)&&(e[t]=()=>r(n))})),e}return{default:()=>d(t)?t(n):e?e(t):[t]}}function W(t,n){return e((()=>{const e={};return t.prefix&&(e.prefix=()=>r(o,null,[A(t.prefix,t,n).default()])),t.suffix&&(e.suffix=()=>r(o,null,[A(t.suffix,t,n).default()])),e}))}function _(t,n){return a(t)&&t?t.replace(/\$\{([^}]*)}/g,(function(t,e){const r=e.split("||");for(const t of r){const e=n[t.trim()];if(e)return e}return""})):""}function D(t){return t.reduce(((t,n)=>(a(n.extendKey)&&n.extendKey&&t.push(n),$(n)&&t.push(...D(n.children||[])),t)),[])}function G(t,n){const e=D(t);if(!e.length)return n;const r={},o=new Map;return Object.entries(n).forEach((([t,i])=>{const u=e.find((n=>n.val_key===t));if(!u)return r[t]=i;const{val_key:c,extendKey:f}=u,s=o.get(f)||{};o.set(f,s),s[c]=n[c]})),[...o.entries()].forEach((([t,n])=>{r[t]=JSON.stringify(n)})),r}function P(t,n){const e=D(t);if(!e.length)return n;const r=p((t=>{try{return l(n[t])?n[t]:JSON.parse(n[t])||{}}catch(t){return{}}})),o=E(n,e.map((t=>t.extendKey)));return e.forEach((({val_key:t,extendKey:n})=>{Reflect.has(o,t)||(o[t]=r(n)[t])})),o}function S(t){return t&&v.includes(t)}function $(t){return S(c(t)?t.componentType:t.html_type)}function w(t,n){return r("section",{style:{display:"flex",alignItems:"center",gap:"4px"}},[t,n.desc?r(m,null,{trigger:()=>r(R,{component:s},null),default:()=>n.desc}):null])}function K(t,n){return f.parse(t.startsWith(".")?t:`.${t}`,n).toString()}function X(t){return t.replace(/&lt;/g,"<").replace(/&gt;/g,">")}function j(t,n){return t.reduce(((t,e)=>(n(e)||(t.push(e),e.properties&&(e.properties=j(e.properties,n)),e.children&&(e.children=j(e.children,n))),t)),[])}function k(t,n){let e=null;return i(t,((t,r)=>{n(t)&&(e=t,r())}),["children","properties"]),e}var O=function(t){return t[t.PREPARE=0]="PREPARE",t[t.TEXT=1]="TEXT",t[t.WIDGET_START=2]="WIDGET_START",t[t.WIDGET=3]="WIDGET",t}(O||{});function b(t){const n=[...t],e=[];let r=O.PREPARE,o="";function i(t){switch(r=t,r){case O.PREPARE:case O.WIDGET_START:case O.WIDGET:o=""}}function u(t="text",n=o){e.push({type:t,content:n})}function c(){const t=e.pop();t&&("text"===t.type?o=t.content:e.push(t))}return n.forEach(((t,e)=>{const f=e===n.length-1;switch(r){case O.PREPARE:return"#"===t?(i(O.WIDGET_START),void(f&&u())):(i(O.TEXT),o=t,void(f&&u()));case O.TEXT:return"#"===t?void(f?(o+=t,u()):(u(),i(O.WIDGET_START))):(o+=t,void(f&&u()));case O.WIDGET_START:return"{"!==t||f?(c(),i(O.TEXT),o+=`#${t}`,void(f&&u())):void i(O.WIDGET);case O.WIDGET:return"}"===t?(u("widget"),void i(O.PREPARE)):"#"===t?(c(),u(),i(O.WIDGET_START),o+=`#${t}`,void(f&&u())):(o+=t,void(f&&u("text",`#{${o}`)))}})),e}function J(t,n){let e=T(t);return n.forEach((({from:t,to:n})=>{e.forEach(((r,o)=>{a(r)&&(e[o]=r.split(t).map(((t,e,r)=>[t,e<r.length-1?n:null])))})),e=h(e)})),e}export{j as FieldListFilter,G as combineExtendKey,W as createInputSlot,A as createSlot,X as editorUnescape,k as findItemByValCondition,x as formRenderLog,K as getAbsoluteKey,g as injectOrProvide,$ as isNestedFieldType,S as isNestedType,y as mergeDeepProperties,b as parseEnhanceText,I as parseNumberFromMaybeString,w as renderDescOption,J as replace2Any,P as splitExtendKey,_ as validateMessageParser};