@topconsultnpm/sdkui-react 6.17.0-test10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (698) hide show
  1. package/lib/assets/IconsS4t/add.svg +12 -0
  2. package/lib/assets/IconsS4t/aggiorna.svg +18 -0
  3. package/lib/assets/IconsS4t/bookmark.svg +42 -0
  4. package/lib/assets/IconsS4t/cancella.svg +15 -0
  5. package/lib/assets/IconsS4t/check-box.svg +19 -0
  6. package/lib/assets/IconsS4t/down-arrow-signBook.svg +40 -0
  7. package/lib/assets/IconsS4t/down.svg +28 -0
  8. package/lib/assets/IconsS4t/edit-file.svg +19 -0
  9. package/lib/assets/IconsS4t/edita.svg +32 -0
  10. package/lib/assets/IconsS4t/firma.svg +19 -0
  11. package/lib/assets/IconsS4t/icona_download.svg +16 -0
  12. package/lib/assets/IconsS4t/info.svg +51 -0
  13. package/lib/assets/IconsS4t/left.svg +20 -0
  14. package/lib/assets/IconsS4t/line.svg +40 -0
  15. package/lib/assets/IconsS4t/more.svg +19 -0
  16. package/lib/assets/IconsS4t/new-signature.svg +1 -0
  17. package/lib/assets/IconsS4t/plus.svg +23 -0
  18. package/lib/assets/IconsS4t/printer.svg +49 -0
  19. package/lib/assets/IconsS4t/radio-on-button.svg +25 -0
  20. package/lib/assets/IconsS4t/rectangle.svg +41 -0
  21. package/lib/assets/IconsS4t/redo.svg +19 -0
  22. package/lib/assets/IconsS4t/right-arrow-signBook-finish.svg +40 -0
  23. package/lib/assets/IconsS4t/right-arrow-signBook.svg +40 -0
  24. package/lib/assets/IconsS4t/right.svg +22 -0
  25. package/lib/assets/IconsS4t/searchbar.svg +21 -0
  26. package/lib/assets/IconsS4t/text-box.svg +36 -0
  27. package/lib/assets/IconsS4t/tick.svg +8 -0
  28. package/lib/assets/IconsS4t/trash-white.svg +11 -0
  29. package/lib/assets/IconsS4t/trash.svg +1 -0
  30. package/lib/assets/IconsS4t/undo.svg +19 -0
  31. package/lib/assets/IconsS4t/up.svg +32 -0
  32. package/lib/assets/IconsS4t/video-streaming.svg +2 -0
  33. package/lib/assets/IconsS4t/zoom-in.svg +58 -0
  34. package/lib/assets/IconsS4t/zoom-out.svg +56 -0
  35. package/lib/assets/ImageLibrary/arrow_001.png +0 -0
  36. package/lib/assets/ImageLibrary/arrow_002.png +0 -0
  37. package/lib/assets/ImageLibrary/arrow_003.png +0 -0
  38. package/lib/assets/ImageLibrary/arrow_004.png +0 -0
  39. package/lib/assets/ImageLibrary/arrow_005.png +0 -0
  40. package/lib/assets/ImageLibrary/arrow_006.png +0 -0
  41. package/lib/assets/ImageLibrary/arrow_007.png +0 -0
  42. package/lib/assets/ImageLibrary/arrow_008.png +0 -0
  43. package/lib/assets/ImageLibrary/arrow_009.png +0 -0
  44. package/lib/assets/ImageLibrary/arrow_010.png +0 -0
  45. package/lib/assets/ImageLibrary/arrow_011.png +0 -0
  46. package/lib/assets/ImageLibrary/arrow_012.png +0 -0
  47. package/lib/assets/ImageLibrary/book_001.png +0 -0
  48. package/lib/assets/ImageLibrary/book_002.png +0 -0
  49. package/lib/assets/ImageLibrary/book_003.png +0 -0
  50. package/lib/assets/ImageLibrary/book_004.png +0 -0
  51. package/lib/assets/ImageLibrary/book_005.png +0 -0
  52. package/lib/assets/ImageLibrary/book_006.png +0 -0
  53. package/lib/assets/ImageLibrary/book_007.png +0 -0
  54. package/lib/assets/ImageLibrary/clock_001.png +0 -0
  55. package/lib/assets/ImageLibrary/clock_002.png +0 -0
  56. package/lib/assets/ImageLibrary/clock_003.png +0 -0
  57. package/lib/assets/ImageLibrary/cube_001.png +0 -0
  58. package/lib/assets/ImageLibrary/cube_002.png +0 -0
  59. package/lib/assets/ImageLibrary/cube_003.png +0 -0
  60. package/lib/assets/ImageLibrary/dcmt_001.png +0 -0
  61. package/lib/assets/ImageLibrary/dcmt_002.png +0 -0
  62. package/lib/assets/ImageLibrary/dcmt_003.png +0 -0
  63. package/lib/assets/ImageLibrary/dcmt_004.png +0 -0
  64. package/lib/assets/ImageLibrary/dcmt_005.png +0 -0
  65. package/lib/assets/ImageLibrary/dcmt_006.png +0 -0
  66. package/lib/assets/ImageLibrary/dcmt_007.png +0 -0
  67. package/lib/assets/ImageLibrary/dcmt_008.png +0 -0
  68. package/lib/assets/ImageLibrary/emoticon_001.png +0 -0
  69. package/lib/assets/ImageLibrary/emoticon_002.png +0 -0
  70. package/lib/assets/ImageLibrary/emoticon_003.png +0 -0
  71. package/lib/assets/ImageLibrary/emoticon_004.png +0 -0
  72. package/lib/assets/ImageLibrary/fld_001.png +0 -0
  73. package/lib/assets/ImageLibrary/fld_002.png +0 -0
  74. package/lib/assets/ImageLibrary/fld_003.png +0 -0
  75. package/lib/assets/ImageLibrary/fld_004.png +0 -0
  76. package/lib/assets/ImageLibrary/fld_005.png +0 -0
  77. package/lib/assets/ImageLibrary/fld_006.png +0 -0
  78. package/lib/assets/ImageLibrary/fld_007.png +0 -0
  79. package/lib/assets/ImageLibrary/fld_008.png +0 -0
  80. package/lib/assets/ImageLibrary/fld_009.png +0 -0
  81. package/lib/assets/ImageLibrary/fld_010.png +0 -0
  82. package/lib/assets/ImageLibrary/fld_011.png +0 -0
  83. package/lib/assets/ImageLibrary/fld_012.png +0 -0
  84. package/lib/assets/ImageLibrary/fld_013.png +0 -0
  85. package/lib/assets/ImageLibrary/fld_014.png +0 -0
  86. package/lib/assets/ImageLibrary/fld_015.png +0 -0
  87. package/lib/assets/ImageLibrary/fld_016.png +0 -0
  88. package/lib/assets/ImageLibrary/fld_017.png +0 -0
  89. package/lib/assets/ImageLibrary/fld_018.png +0 -0
  90. package/lib/assets/ImageLibrary/fld_019.png +0 -0
  91. package/lib/assets/ImageLibrary/fld_020.png +0 -0
  92. package/lib/assets/ImageLibrary/fld_021.png +0 -0
  93. package/lib/assets/ImageLibrary/fld_022.png +0 -0
  94. package/lib/assets/ImageLibrary/fld_023.png +0 -0
  95. package/lib/assets/ImageLibrary/fld_024.png +0 -0
  96. package/lib/assets/ImageLibrary/fld_025.png +0 -0
  97. package/lib/assets/ImageLibrary/fld_026.png +0 -0
  98. package/lib/assets/ImageLibrary/fld_027.png +0 -0
  99. package/lib/assets/ImageLibrary/fld_028.png +0 -0
  100. package/lib/assets/ImageLibrary/fld_029.png +0 -0
  101. package/lib/assets/ImageLibrary/fld_030.png +0 -0
  102. package/lib/assets/ImageLibrary/fld_031.png +0 -0
  103. package/lib/assets/ImageLibrary/fld_032.png +0 -0
  104. package/lib/assets/ImageLibrary/fld_033.png +0 -0
  105. package/lib/assets/ImageLibrary/gen_001.png +0 -0
  106. package/lib/assets/ImageLibrary/gen_002.png +0 -0
  107. package/lib/assets/ImageLibrary/gen_003.png +0 -0
  108. package/lib/assets/ImageLibrary/gen_004.png +0 -0
  109. package/lib/assets/ImageLibrary/gen_005.png +0 -0
  110. package/lib/assets/ImageLibrary/gen_006.png +0 -0
  111. package/lib/assets/ImageLibrary/gen_007.png +0 -0
  112. package/lib/assets/ImageLibrary/gen_008.png +0 -0
  113. package/lib/assets/ImageLibrary/gen_009.png +0 -0
  114. package/lib/assets/ImageLibrary/gen_010.png +0 -0
  115. package/lib/assets/ImageLibrary/gen_011.png +0 -0
  116. package/lib/assets/ImageLibrary/gen_012.png +0 -0
  117. package/lib/assets/ImageLibrary/gen_013.png +0 -0
  118. package/lib/assets/ImageLibrary/gen_014.png +0 -0
  119. package/lib/assets/ImageLibrary/gen_015.png +0 -0
  120. package/lib/assets/ImageLibrary/gen_016.png +0 -0
  121. package/lib/assets/ImageLibrary/gen_017.png +0 -0
  122. package/lib/assets/ImageLibrary/gen_018.png +0 -0
  123. package/lib/assets/ImageLibrary/gen_019.png +0 -0
  124. package/lib/assets/ImageLibrary/gen_020.png +0 -0
  125. package/lib/assets/ImageLibrary/gen_021.png +0 -0
  126. package/lib/assets/ImageLibrary/gen_022.png +0 -0
  127. package/lib/assets/ImageLibrary/gen_023.png +0 -0
  128. package/lib/assets/ImageLibrary/gen_024.png +0 -0
  129. package/lib/assets/ImageLibrary/gen_025.png +0 -0
  130. package/lib/assets/ImageLibrary/gen_026.png +0 -0
  131. package/lib/assets/ImageLibrary/gen_027.png +0 -0
  132. package/lib/assets/ImageLibrary/gen_028.png +0 -0
  133. package/lib/assets/ImageLibrary/gen_029.png +0 -0
  134. package/lib/assets/ImageLibrary/gen_030.png +0 -0
  135. package/lib/assets/ImageLibrary/gen_031.png +0 -0
  136. package/lib/assets/ImageLibrary/gen_032.png +0 -0
  137. package/lib/assets/ImageLibrary/gen_033.png +0 -0
  138. package/lib/assets/ImageLibrary/gen_034.png +0 -0
  139. package/lib/assets/ImageLibrary/gen_035.png +0 -0
  140. package/lib/assets/ImageLibrary/gen_036.png +0 -0
  141. package/lib/assets/ImageLibrary/gen_037.png +0 -0
  142. package/lib/assets/ImageLibrary/gen_038.png +0 -0
  143. package/lib/assets/ImageLibrary/gen_039.png +0 -0
  144. package/lib/assets/ImageLibrary/gen_040.png +0 -0
  145. package/lib/assets/ImageLibrary/gen_041.png +0 -0
  146. package/lib/assets/ImageLibrary/gen_042.png +0 -0
  147. package/lib/assets/ImageLibrary/gen_043.png +0 -0
  148. package/lib/assets/ImageLibrary/gen_044.png +0 -0
  149. package/lib/assets/ImageLibrary/gen_045.png +0 -0
  150. package/lib/assets/ImageLibrary/gen_046.png +0 -0
  151. package/lib/assets/ImageLibrary/gen_047.png +0 -0
  152. package/lib/assets/ImageLibrary/gen_048.png +0 -0
  153. package/lib/assets/ImageLibrary/gen_049.png +0 -0
  154. package/lib/assets/ImageLibrary/gen_050.png +0 -0
  155. package/lib/assets/ImageLibrary/gen_051.png +0 -0
  156. package/lib/assets/ImageLibrary/gen_052.png +0 -0
  157. package/lib/assets/ImageLibrary/hand_001.png +0 -0
  158. package/lib/assets/ImageLibrary/hand_002.png +0 -0
  159. package/lib/assets/ImageLibrary/hand_003.png +0 -0
  160. package/lib/assets/ImageLibrary/hand_004.png +0 -0
  161. package/lib/assets/ImageLibrary/hand_005.png +0 -0
  162. package/lib/assets/ImageLibrary/hand_006.png +0 -0
  163. package/lib/assets/ImageLibrary/law_001.png +0 -0
  164. package/lib/assets/ImageLibrary/law_002.png +0 -0
  165. package/lib/assets/ImageLibrary/law_003.png +0 -0
  166. package/lib/assets/ImageLibrary/lock_001.png +0 -0
  167. package/lib/assets/ImageLibrary/lock_002.png +0 -0
  168. package/lib/assets/ImageLibrary/lock_003.png +0 -0
  169. package/lib/assets/ImageLibrary/mail_001.png +0 -0
  170. package/lib/assets/ImageLibrary/mail_002.png +0 -0
  171. package/lib/assets/ImageLibrary/mail_003.png +0 -0
  172. package/lib/assets/ImageLibrary/mail_004.png +0 -0
  173. package/lib/assets/ImageLibrary/mail_005.png +0 -0
  174. package/lib/assets/ImageLibrary/mail_006.png +0 -0
  175. package/lib/assets/ImageLibrary/mail_007.png +0 -0
  176. package/lib/assets/ImageLibrary/mail_008.png +0 -0
  177. package/lib/assets/ImageLibrary/mail_009.png +0 -0
  178. package/lib/assets/ImageLibrary/mail_010.png +0 -0
  179. package/lib/assets/ImageLibrary/mail_011.png +0 -0
  180. package/lib/assets/ImageLibrary/mail_012.png +0 -0
  181. package/lib/assets/ImageLibrary/mail_013.png +0 -0
  182. package/lib/assets/ImageLibrary/mail_014.png +0 -0
  183. package/lib/assets/ImageLibrary/mail_015.png +0 -0
  184. package/lib/assets/ImageLibrary/net_001.png +0 -0
  185. package/lib/assets/ImageLibrary/net_002.png +0 -0
  186. package/lib/assets/ImageLibrary/net_003.png +0 -0
  187. package/lib/assets/ImageLibrary/net_004.png +0 -0
  188. package/lib/assets/ImageLibrary/nmbr_001.png +0 -0
  189. package/lib/assets/ImageLibrary/nmbr_002.png +0 -0
  190. package/lib/assets/ImageLibrary/nmbr_003.png +0 -0
  191. package/lib/assets/ImageLibrary/nmbr_004.png +0 -0
  192. package/lib/assets/ImageLibrary/nmbr_005.png +0 -0
  193. package/lib/assets/ImageLibrary/nmbr_006.png +0 -0
  194. package/lib/assets/ImageLibrary/nmbr_007.png +0 -0
  195. package/lib/assets/ImageLibrary/nmbr_008.png +0 -0
  196. package/lib/assets/ImageLibrary/nmbr_009.png +0 -0
  197. package/lib/assets/ImageLibrary/note_001.png +0 -0
  198. package/lib/assets/ImageLibrary/note_002.png +0 -0
  199. package/lib/assets/ImageLibrary/note_003.png +0 -0
  200. package/lib/assets/ImageLibrary/note_004.png +0 -0
  201. package/lib/assets/ImageLibrary/note_005.png +0 -0
  202. package/lib/assets/ImageLibrary/note_006.png +0 -0
  203. package/lib/assets/ImageLibrary/note_007.png +0 -0
  204. package/lib/assets/ImageLibrary/note_008.png +0 -0
  205. package/lib/assets/ImageLibrary/note_009.png +0 -0
  206. package/lib/assets/ImageLibrary/note_010.png +0 -0
  207. package/lib/assets/ImageLibrary/note_011.png +0 -0
  208. package/lib/assets/ImageLibrary/note_012.png +0 -0
  209. package/lib/assets/ImageLibrary/note_013.png +0 -0
  210. package/lib/assets/ImageLibrary/note_014.png +0 -0
  211. package/lib/assets/ImageLibrary/note_015.png +0 -0
  212. package/lib/assets/ImageLibrary/note_016.png +0 -0
  213. package/lib/assets/ImageLibrary/run_001.png +0 -0
  214. package/lib/assets/ImageLibrary/run_002.png +0 -0
  215. package/lib/assets/ImageLibrary/run_003.png +0 -0
  216. package/lib/assets/ImageLibrary/sem_001.png +0 -0
  217. package/lib/assets/ImageLibrary/sem_002.png +0 -0
  218. package/lib/assets/ImageLibrary/sem_003.png +0 -0
  219. package/lib/assets/ImageLibrary/sem_004.png +0 -0
  220. package/lib/assets/ImageLibrary/sem_005.png +0 -0
  221. package/lib/assets/ImageLibrary/star_001.png +0 -0
  222. package/lib/assets/ImageLibrary/star_002.png +0 -0
  223. package/lib/assets/ImageLibrary/star_003.png +0 -0
  224. package/lib/assets/ImageLibrary/star_004.png +0 -0
  225. package/lib/assets/ImageLibrary/star_005.png +0 -0
  226. package/lib/assets/ImageLibrary/star_006.png +0 -0
  227. package/lib/assets/ImageLibrary/state_001.png +0 -0
  228. package/lib/assets/ImageLibrary/state_002.png +0 -0
  229. package/lib/assets/ImageLibrary/state_003.png +0 -0
  230. package/lib/assets/ImageLibrary/state_004.png +0 -0
  231. package/lib/assets/ImageLibrary/state_005.png +0 -0
  232. package/lib/assets/ImageLibrary/study_001.png +0 -0
  233. package/lib/assets/ImageLibrary/study_002.png +0 -0
  234. package/lib/assets/ImageLibrary/user_001.png +0 -0
  235. package/lib/assets/ImageLibrary/user_002.png +0 -0
  236. package/lib/assets/ImageLibrary/user_003.png +0 -0
  237. package/lib/assets/ImageLibrary/user_004.png +0 -0
  238. package/lib/assets/ImageLibrary/user_005.png +0 -0
  239. package/lib/assets/ImageLibrary/user_006.png +0 -0
  240. package/lib/assets/ImageLibrary/user_007.png +0 -0
  241. package/lib/assets/ImageLibrary/user_008.png +0 -0
  242. package/lib/assets/ImageLibrary/user_009.png +0 -0
  243. package/lib/assets/ImageLibrary/user_010.png +0 -0
  244. package/lib/assets/ImageLibrary/user_011.png +0 -0
  245. package/lib/assets/ImageLibrary/user_012.png +0 -0
  246. package/lib/assets/ImageLibrary/user_013.png +0 -0
  247. package/lib/assets/ImageLibrary/user_014.png +0 -0
  248. package/lib/assets/ImageLibrary/user_015.png +0 -0
  249. package/lib/assets/ImageLibrary/user_016.png +0 -0
  250. package/lib/assets/ImageLibrary/user_017.png +0 -0
  251. package/lib/assets/ImageLibrary/user_018.png +0 -0
  252. package/lib/assets/ImageLibrary/user_019.png +0 -0
  253. package/lib/assets/ImageLibrary/user_020.png +0 -0
  254. package/lib/assets/ImageLibrary/user_021.png +0 -0
  255. package/lib/assets/ImageLibrary/user_022.png +0 -0
  256. package/lib/assets/ImageLibrary/user_023.png +0 -0
  257. package/lib/assets/ImageLibrary/vehicle_001.png +0 -0
  258. package/lib/assets/ImageLibrary/vehicle_002.png +0 -0
  259. package/lib/assets/ImageLibrary/vehicle_003.png +0 -0
  260. package/lib/assets/ImageLibrary/vehicle_004.png +0 -0
  261. package/lib/assets/ImageLibrary/vehicle_005.png +0 -0
  262. package/lib/assets/ImageLibrary/vehicle_006.png +0 -0
  263. package/lib/assets/ImageLibrary/vehicle_007.png +0 -0
  264. package/lib/assets/ImageLibrary/vehicle_008.png +0 -0
  265. package/lib/assets/Toppy-generico.png +0 -0
  266. package/lib/assets/france.svg +1 -0
  267. package/lib/assets/german.svg +1 -0
  268. package/lib/assets/icomoon.eot +0 -0
  269. package/lib/assets/icomoon.svg +97 -0
  270. package/lib/assets/icomoon.ttf +0 -0
  271. package/lib/assets/icomoon.woff +0 -0
  272. package/lib/assets/italy.svg +16 -0
  273. package/lib/assets/loading.png +0 -0
  274. package/lib/assets/login-bg.png +0 -0
  275. package/lib/assets/multipleSelectionManager.jpg +0 -0
  276. package/lib/assets/portugal.svg +1 -0
  277. package/lib/assets/six.png +0 -0
  278. package/lib/assets/six.svg +4 -0
  279. package/lib/assets/spain.svg +1 -0
  280. package/lib/assets/thumbnails/dicom.png +0 -0
  281. package/lib/assets/thumbnails/doc.png +0 -0
  282. package/lib/assets/thumbnails/docx.png +0 -0
  283. package/lib/assets/thumbnails/dwg.png +0 -0
  284. package/lib/assets/thumbnails/email.png +0 -0
  285. package/lib/assets/thumbnails/exe.png +0 -0
  286. package/lib/assets/thumbnails/folder.png +0 -0
  287. package/lib/assets/thumbnails/html.png +0 -0
  288. package/lib/assets/thumbnails/image.png +0 -0
  289. package/lib/assets/thumbnails/index.d.ts +19 -0
  290. package/lib/assets/thumbnails/index.js +19 -0
  291. package/lib/assets/thumbnails/index.ts +39 -0
  292. package/lib/assets/thumbnails/mp4.png +0 -0
  293. package/lib/assets/thumbnails/other.png +0 -0
  294. package/lib/assets/thumbnails/p7m.png +0 -0
  295. package/lib/assets/thumbnails/pdf.png +0 -0
  296. package/lib/assets/thumbnails/ppt.png +0 -0
  297. package/lib/assets/thumbnails/slddrw.png +0 -0
  298. package/lib/assets/thumbnails/txt.png +0 -0
  299. package/lib/assets/thumbnails/xls.png +0 -0
  300. package/lib/assets/thumbnails/xml.png +0 -0
  301. package/lib/assets/thumbnails/zip.png +0 -0
  302. package/lib/assets/topmedia-six.svg +66 -0
  303. package/lib/assets/topmeida-six-bianco.svg +66 -0
  304. package/lib/assets/united-kingdom.svg +1 -0
  305. package/lib/components/base/Styled.d.ts +63 -0
  306. package/lib/components/base/Styled.js +337 -0
  307. package/lib/components/base/TMAccordion.d.ts +12 -0
  308. package/lib/components/base/TMAccordion.js +62 -0
  309. package/lib/components/base/TMAlert.d.ts +73 -0
  310. package/lib/components/base/TMAlert.js +77 -0
  311. package/lib/components/base/TMAreaManager.d.ts +25 -0
  312. package/lib/components/base/TMAreaManager.js +733 -0
  313. package/lib/components/base/TMButton.d.ts +21 -0
  314. package/lib/components/base/TMButton.js +174 -0
  315. package/lib/components/base/TMClosableList.d.ts +10 -0
  316. package/lib/components/base/TMClosableList.js +70 -0
  317. package/lib/components/base/TMConfirm.d.ts +13 -0
  318. package/lib/components/base/TMConfirm.js +119 -0
  319. package/lib/components/base/TMContextMenu.d.ts +25 -0
  320. package/lib/components/base/TMContextMenu.js +109 -0
  321. package/lib/components/base/TMContextMenuOLD.d.ts +26 -0
  322. package/lib/components/base/TMContextMenuOLD.js +56 -0
  323. package/lib/components/base/TMCounterBar.d.ts +10 -0
  324. package/lib/components/base/TMCounterBar.js +43 -0
  325. package/lib/components/base/TMCounterContainer.d.ts +23 -0
  326. package/lib/components/base/TMCounterContainer.js +58 -0
  327. package/lib/components/base/TMCustomButton.d.ts +11 -0
  328. package/lib/components/base/TMCustomButton.js +116 -0
  329. package/lib/components/base/TMDataGrid.d.ts +56 -0
  330. package/lib/components/base/TMDataGrid.js +237 -0
  331. package/lib/components/base/TMDataGridExportForm.d.ts +15 -0
  332. package/lib/components/base/TMDataGridExportForm.js +215 -0
  333. package/lib/components/base/TMDeviceProvider.d.ts +15 -0
  334. package/lib/components/base/TMDeviceProvider.js +41 -0
  335. package/lib/components/base/TMDropDownMenu.d.ts +23 -0
  336. package/lib/components/base/TMDropDownMenu.js +45 -0
  337. package/lib/components/base/TMEditorBase.d.ts +39 -0
  338. package/lib/components/base/TMEditorBase.js +1 -0
  339. package/lib/components/base/TMFileManager.d.ts +45 -0
  340. package/lib/components/base/TMFileManager.js +233 -0
  341. package/lib/components/base/TMFileManagerDataGridView.d.ts +16 -0
  342. package/lib/components/base/TMFileManagerDataGridView.js +101 -0
  343. package/lib/components/base/TMFileManagerThumbnailItems.d.ts +18 -0
  344. package/lib/components/base/TMFileManagerThumbnailItems.js +148 -0
  345. package/lib/components/base/TMFileManagerThumbnailsView.d.ts +19 -0
  346. package/lib/components/base/TMFileManagerThumbnailsView.js +46 -0
  347. package/lib/components/base/TMFileManagerUtils.d.ts +78 -0
  348. package/lib/components/base/TMFileManagerUtils.js +207 -0
  349. package/lib/components/base/TMFloatingToolbar.d.ts +9 -0
  350. package/lib/components/base/TMFloatingToolbar.js +101 -0
  351. package/lib/components/base/TMLayout.d.ts +55 -0
  352. package/lib/components/base/TMLayout.js +201 -0
  353. package/lib/components/base/TMList.d.ts +9 -0
  354. package/lib/components/base/TMList.js +54 -0
  355. package/lib/components/base/TMListView.d.ts +42 -0
  356. package/lib/components/base/TMListView.js +387 -0
  357. package/lib/components/base/TMModal.d.ts +16 -0
  358. package/lib/components/base/TMModal.js +70 -0
  359. package/lib/components/base/TMPanel.d.ts +32 -0
  360. package/lib/components/base/TMPanel.js +181 -0
  361. package/lib/components/base/TMPopUp.d.ts +33 -0
  362. package/lib/components/base/TMPopUp.js +267 -0
  363. package/lib/components/base/TMProgressBar.d.ts +11 -0
  364. package/lib/components/base/TMProgressBar.js +32 -0
  365. package/lib/components/base/TMResizableMenu.d.ts +20 -0
  366. package/lib/components/base/TMResizableMenu.js +98 -0
  367. package/lib/components/base/TMRightSidebar.d.ts +19 -0
  368. package/lib/components/base/TMRightSidebar.js +80 -0
  369. package/lib/components/base/TMShowAllOrMaxItemsButton.d.ts +8 -0
  370. package/lib/components/base/TMShowAllOrMaxItemsButton.js +20 -0
  371. package/lib/components/base/TMSpinner.d.ts +14 -0
  372. package/lib/components/base/TMSpinner.js +160 -0
  373. package/lib/components/base/TMTab.d.ts +20 -0
  374. package/lib/components/base/TMTab.js +42 -0
  375. package/lib/components/base/TMToggleButton.d.ts +10 -0
  376. package/lib/components/base/TMToggleButton.js +58 -0
  377. package/lib/components/base/TMToolbarCard.d.ts +19 -0
  378. package/lib/components/base/TMToolbarCard.js +51 -0
  379. package/lib/components/base/TMTooltip.d.ts +14 -0
  380. package/lib/components/base/TMTooltip.js +20 -0
  381. package/lib/components/base/TMTreeView.d.ts +32 -0
  382. package/lib/components/base/TMTreeView.js +356 -0
  383. package/lib/components/base/TMUserAvatar.d.ts +8 -0
  384. package/lib/components/base/TMUserAvatar.js +34 -0
  385. package/lib/components/base/TMVilViewer.d.ts +5 -0
  386. package/lib/components/base/TMVilViewer.js +22 -0
  387. package/lib/components/base/TMWaitPanel.d.ts +32 -0
  388. package/lib/components/base/TMWaitPanel.js +44 -0
  389. package/lib/components/choosers/TMCultureIDPicker.d.ts +9 -0
  390. package/lib/components/choosers/TMCultureIDPicker.js +72 -0
  391. package/lib/components/choosers/TMDataListItemChooser.d.ts +17 -0
  392. package/lib/components/choosers/TMDataListItemChooser.js +49 -0
  393. package/lib/components/choosers/TMDataListItemPicker.d.ts +9 -0
  394. package/lib/components/choosers/TMDataListItemPicker.js +96 -0
  395. package/lib/components/choosers/TMDcmtTypeChooser.d.ts +25 -0
  396. package/lib/components/choosers/TMDcmtTypeChooser.js +61 -0
  397. package/lib/components/choosers/TMDiskChooser.d.ts +10 -0
  398. package/lib/components/choosers/TMDiskChooser.js +41 -0
  399. package/lib/components/choosers/TMDistinctValues.d.ts +21 -0
  400. package/lib/components/choosers/TMDistinctValues.js +140 -0
  401. package/lib/components/choosers/TMDynDataListItemChooser.d.ts +40 -0
  402. package/lib/components/choosers/TMDynDataListItemChooser.js +159 -0
  403. package/lib/components/choosers/TMGroupChooser.d.ts +7 -0
  404. package/lib/components/choosers/TMGroupChooser.js +37 -0
  405. package/lib/components/choosers/TMInvoiceRetrieveFormats.d.ts +4 -0
  406. package/lib/components/choosers/TMInvoiceRetrieveFormats.js +22 -0
  407. package/lib/components/choosers/TMMetadataChooser.d.ts +54 -0
  408. package/lib/components/choosers/TMMetadataChooser.js +155 -0
  409. package/lib/components/choosers/TMOrderRetrieveFormats.d.ts +4 -0
  410. package/lib/components/choosers/TMOrderRetrieveFormats.js +22 -0
  411. package/lib/components/choosers/TMPathChooser.d.ts +12 -0
  412. package/lib/components/choosers/TMPathChooser.js +147 -0
  413. package/lib/components/choosers/TMRelationChooser.d.ts +31 -0
  414. package/lib/components/choosers/TMRelationChooser.js +94 -0
  415. package/lib/components/choosers/TMUserChooser.d.ts +40 -0
  416. package/lib/components/choosers/TMUserChooser.js +141 -0
  417. package/lib/components/editors/TMCheckBox.d.ts +9 -0
  418. package/lib/components/editors/TMCheckBox.js +90 -0
  419. package/lib/components/editors/TMDateBox.d.ts +17 -0
  420. package/lib/components/editors/TMDateBox.js +75 -0
  421. package/lib/components/editors/TMDropDown.d.ts +10 -0
  422. package/lib/components/editors/TMDropDown.js +62 -0
  423. package/lib/components/editors/TMEditorStyled.d.ts +41 -0
  424. package/lib/components/editors/TMEditorStyled.js +90 -0
  425. package/lib/components/editors/TMFormulaEditor.d.ts +49 -0
  426. package/lib/components/editors/TMFormulaEditor.js +727 -0
  427. package/lib/components/editors/TMHtmlContentDisplay.d.ts +7 -0
  428. package/lib/components/editors/TMHtmlContentDisplay.js +78 -0
  429. package/lib/components/editors/TMHtmlEditor.d.ts +38 -0
  430. package/lib/components/editors/TMHtmlEditor.js +203 -0
  431. package/lib/components/editors/TMLocalizedTextBox.d.ts +19 -0
  432. package/lib/components/editors/TMLocalizedTextBox.js +125 -0
  433. package/lib/components/editors/TMMetadataEditor.d.ts +29 -0
  434. package/lib/components/editors/TMMetadataEditor.js +140 -0
  435. package/lib/components/editors/TMMetadataValues.d.ts +46 -0
  436. package/lib/components/editors/TMMetadataValues.js +530 -0
  437. package/lib/components/editors/TMRadioButton.d.ts +10 -0
  438. package/lib/components/editors/TMRadioButton.js +57 -0
  439. package/lib/components/editors/TMSummary.d.ts +20 -0
  440. package/lib/components/editors/TMSummary.js +92 -0
  441. package/lib/components/editors/TMTextArea.d.ts +17 -0
  442. package/lib/components/editors/TMTextArea.js +155 -0
  443. package/lib/components/editors/TMTextBox.d.ts +20 -0
  444. package/lib/components/editors/TMTextBox.js +249 -0
  445. package/lib/components/editors/TMTextExpression.d.ts +25 -0
  446. package/lib/components/editors/TMTextExpression.js +174 -0
  447. package/lib/components/editors/TMTreeDropDown.d.ts +18 -0
  448. package/lib/components/editors/TMTreeDropDown.js +66 -0
  449. package/lib/components/features/archive/TMArchive.d.ts +29 -0
  450. package/lib/components/features/archive/TMArchive.js +193 -0
  451. package/lib/components/features/assistant/ToppyHelpCenter.d.ts +12 -0
  452. package/lib/components/features/assistant/ToppyHelpCenter.js +173 -0
  453. package/lib/components/features/blog/TMBlogCommentForm.d.ts +17 -0
  454. package/lib/components/features/blog/TMBlogCommentForm.js +333 -0
  455. package/lib/components/features/documents/TMBatchUpdateForm.d.ts +17 -0
  456. package/lib/components/features/documents/TMBatchUpdateForm.js +159 -0
  457. package/lib/components/features/documents/TMDcmtBlog.d.ts +23 -0
  458. package/lib/components/features/documents/TMDcmtBlog.js +65 -0
  459. package/lib/components/features/documents/TMDcmtForm.d.ts +64 -0
  460. package/lib/components/features/documents/TMDcmtForm.js +1498 -0
  461. package/lib/components/features/documents/TMDcmtIcon.d.ts +18 -0
  462. package/lib/components/features/documents/TMDcmtIcon.js +93 -0
  463. package/lib/components/features/documents/TMDcmtPreview.d.ts +31 -0
  464. package/lib/components/features/documents/TMDcmtPreview.js +446 -0
  465. package/lib/components/features/documents/TMDcmtTasks.d.ts +13 -0
  466. package/lib/components/features/documents/TMDcmtTasks.js +24 -0
  467. package/lib/components/features/documents/TMDragDropOverlay.d.ts +6 -0
  468. package/lib/components/features/documents/TMDragDropOverlay.js +97 -0
  469. package/lib/components/features/documents/TMFileUploader.d.ts +14 -0
  470. package/lib/components/features/documents/TMFileUploader.js +115 -0
  471. package/lib/components/features/documents/TMMasterDetailDcmts.d.ts +26 -0
  472. package/lib/components/features/documents/TMMasterDetailDcmts.js +288 -0
  473. package/lib/components/features/documents/TMRelationViewer.d.ts +121 -0
  474. package/lib/components/features/documents/TMRelationViewer.js +753 -0
  475. package/lib/components/features/search/TMSavedQueryForm.d.ts +9 -0
  476. package/lib/components/features/search/TMSavedQueryForm.js +41 -0
  477. package/lib/components/features/search/TMSavedQuerySelector.d.ts +16 -0
  478. package/lib/components/features/search/TMSavedQuerySelector.js +226 -0
  479. package/lib/components/features/search/TMSearch.d.ts +40 -0
  480. package/lib/components/features/search/TMSearch.js +253 -0
  481. package/lib/components/features/search/TMSearchQueryEditor.d.ts +15 -0
  482. package/lib/components/features/search/TMSearchQueryEditor.js +367 -0
  483. package/lib/components/features/search/TMSearchQueryPanel.d.ts +29 -0
  484. package/lib/components/features/search/TMSearchQueryPanel.js +438 -0
  485. package/lib/components/features/search/TMSearchResult.d.ts +53 -0
  486. package/lib/components/features/search/TMSearchResult.js +1092 -0
  487. package/lib/components/features/search/TMSearchResultFloatingActionButton.d.ts +16 -0
  488. package/lib/components/features/search/TMSearchResultFloatingActionButton.js +50 -0
  489. package/lib/components/features/search/TMSearchResultsMenuItems.d.ts +11 -0
  490. package/lib/components/features/search/TMSearchResultsMenuItems.js +725 -0
  491. package/lib/components/features/search/TMTreeSelector.d.ts +12 -0
  492. package/lib/components/features/search/TMTreeSelector.js +270 -0
  493. package/lib/components/features/tasks/TMTaskForm.d.ts +38 -0
  494. package/lib/components/features/tasks/TMTaskForm.js +392 -0
  495. package/lib/components/features/tasks/TMTasksAgenda.d.ts +17 -0
  496. package/lib/components/features/tasks/TMTasksAgenda.js +107 -0
  497. package/lib/components/features/tasks/TMTasksCalendar.d.ts +21 -0
  498. package/lib/components/features/tasks/TMTasksCalendar.js +240 -0
  499. package/lib/components/features/tasks/TMTasksHeader.d.ts +14 -0
  500. package/lib/components/features/tasks/TMTasksHeader.js +37 -0
  501. package/lib/components/features/tasks/TMTasksPanelContent.d.ts +20 -0
  502. package/lib/components/features/tasks/TMTasksPanelContent.js +65 -0
  503. package/lib/components/features/tasks/TMTasksUtils.d.ts +133 -0
  504. package/lib/components/features/tasks/TMTasksUtils.js +649 -0
  505. package/lib/components/features/tasks/TMTasksUtilsView.d.ts +39 -0
  506. package/lib/components/features/tasks/TMTasksUtilsView.js +140 -0
  507. package/lib/components/features/tasks/TMTasksView.d.ts +40 -0
  508. package/lib/components/features/tasks/TMTasksView.js +566 -0
  509. package/lib/components/features/wg/TMWGsCopyMoveForm.d.ts +39 -0
  510. package/lib/components/features/wg/TMWGsCopyMoveForm.js +439 -0
  511. package/lib/components/features/workflow/TMWorkflowPopup.d.ts +42 -0
  512. package/lib/components/features/workflow/TMWorkflowPopup.js +286 -0
  513. package/lib/components/features/workflow/diagram/ConnectionComponent.d.ts +14 -0
  514. package/lib/components/features/workflow/diagram/ConnectionComponent.js +90 -0
  515. package/lib/components/features/workflow/diagram/ConnectionForm.d.ts +9 -0
  516. package/lib/components/features/workflow/diagram/ConnectionForm.js +73 -0
  517. package/lib/components/features/workflow/diagram/DiagramItemComponent.d.ts +18 -0
  518. package/lib/components/features/workflow/diagram/DiagramItemComponent.js +264 -0
  519. package/lib/components/features/workflow/diagram/DiagramItemForm.d.ts +10 -0
  520. package/lib/components/features/workflow/diagram/DiagramItemForm.js +686 -0
  521. package/lib/components/features/workflow/diagram/DiagramItemSvgContent.d.ts +12 -0
  522. package/lib/components/features/workflow/diagram/DiagramItemSvgContent.js +97 -0
  523. package/lib/components/features/workflow/diagram/RecipientList.d.ts +27 -0
  524. package/lib/components/features/workflow/diagram/RecipientList.js +204 -0
  525. package/lib/components/features/workflow/diagram/WFDiagram.d.ts +9 -0
  526. package/lib/components/features/workflow/diagram/WFDiagram.js +1680 -0
  527. package/lib/components/features/workflow/diagram/WorkitemRecipientsEditor.d.ts +18 -0
  528. package/lib/components/features/workflow/diagram/WorkitemRecipientsEditor.js +97 -0
  529. package/lib/components/features/workflow/diagram/interfaces.d.ts +126 -0
  530. package/lib/components/features/workflow/diagram/interfaces.js +26 -0
  531. package/lib/components/features/workflow/diagram/metadataParser.d.ts +14 -0
  532. package/lib/components/features/workflow/diagram/metadataParser.js +54 -0
  533. package/lib/components/features/workflow/diagram/queryDescriptorParser.d.ts +3 -0
  534. package/lib/components/features/workflow/diagram/queryDescriptorParser.js +188 -0
  535. package/lib/components/features/workflow/diagram/workflowHelpers.d.ts +122 -0
  536. package/lib/components/features/workflow/diagram/workflowHelpers.js +488 -0
  537. package/lib/components/features/workflow/diagram/xmlParser.d.ts +10 -0
  538. package/lib/components/features/workflow/diagram/xmlParser.js +490 -0
  539. package/lib/components/filesystem/ProgressBar.d.ts +7 -0
  540. package/lib/components/filesystem/ProgressBar.js +25 -0
  541. package/lib/components/forms/Login/ChangePassword.d.ts +9 -0
  542. package/lib/components/forms/Login/ChangePassword.js +22 -0
  543. package/lib/components/forms/Login/ChangePasswordInputs.d.ts +14 -0
  544. package/lib/components/forms/Login/ChangePasswordInputs.js +80 -0
  545. package/lib/components/forms/Login/Chooser.d.ts +28 -0
  546. package/lib/components/forms/Login/Chooser.js +145 -0
  547. package/lib/components/forms/Login/LOGINLocalizator.d.ts +29 -0
  548. package/lib/components/forms/Login/LOGINLocalizator.js +247 -0
  549. package/lib/components/forms/Login/LoginValidatorService.d.ts +50 -0
  550. package/lib/components/forms/Login/LoginValidatorService.js +162 -0
  551. package/lib/components/forms/Login/Menu.d.ts +10 -0
  552. package/lib/components/forms/Login/Menu.js +48 -0
  553. package/lib/components/forms/Login/OTPReader.d.ts +14 -0
  554. package/lib/components/forms/Login/OTPReader.js +90 -0
  555. package/lib/components/forms/Login/PasswordStrengthChecker.d.ts +7 -0
  556. package/lib/components/forms/Login/PasswordStrengthChecker.js +45 -0
  557. package/lib/components/forms/Login/RapidAccessLogin.d.ts +25 -0
  558. package/lib/components/forms/Login/RapidAccessLogin.js +310 -0
  559. package/lib/components/forms/Login/RecoverPasswordFlow.d.ts +11 -0
  560. package/lib/components/forms/Login/RecoverPasswordFlow.js +111 -0
  561. package/lib/components/forms/Login/SelectBox.d.ts +23 -0
  562. package/lib/components/forms/Login/SelectBox.js +96 -0
  563. package/lib/components/forms/Login/StepIndicator.d.ts +7 -0
  564. package/lib/components/forms/Login/StepIndicator.js +19 -0
  565. package/lib/components/forms/Login/TMLoginForm.d.ts +44 -0
  566. package/lib/components/forms/Login/TMLoginForm.js +737 -0
  567. package/lib/components/forms/Login/TextBox.d.ts +27 -0
  568. package/lib/components/forms/Login/TextBox.js +111 -0
  569. package/lib/components/forms/TMApplyForm.d.ts +4 -0
  570. package/lib/components/forms/TMApplyForm.js +105 -0
  571. package/lib/components/forms/TMChooserForm.d.ts +3 -0
  572. package/lib/components/forms/TMChooserForm.js +94 -0
  573. package/lib/components/forms/TMResultDialog.d.ts +20 -0
  574. package/lib/components/forms/TMResultDialog.js +44 -0
  575. package/lib/components/forms/TMSaveForm.d.ts +31 -0
  576. package/lib/components/forms/TMSaveForm.js +176 -0
  577. package/lib/components/grids/TMBlogAttachments.d.ts +42 -0
  578. package/lib/components/grids/TMBlogAttachments.js +43 -0
  579. package/lib/components/grids/TMBlogHeader.d.ts +31 -0
  580. package/lib/components/grids/TMBlogHeader.js +41 -0
  581. package/lib/components/grids/TMBlogsPost.d.ts +89 -0
  582. package/lib/components/grids/TMBlogsPost.js +644 -0
  583. package/lib/components/grids/TMBlogsPostUtils.d.ts +113 -0
  584. package/lib/components/grids/TMBlogsPostUtils.js +250 -0
  585. package/lib/components/grids/TMRecentsManager.d.ts +13 -0
  586. package/lib/components/grids/TMRecentsManager.js +155 -0
  587. package/lib/components/grids/TMValidationItemsList.d.ts +6 -0
  588. package/lib/components/grids/TMValidationItemsList.js +82 -0
  589. package/lib/components/index.d.ts +115 -0
  590. package/lib/components/index.js +137 -0
  591. package/lib/components/layout/panelManager/TMPanelManagerContainer.d.ts +10 -0
  592. package/lib/components/layout/panelManager/TMPanelManagerContainer.js +215 -0
  593. package/lib/components/layout/panelManager/TMPanelManagerContext.d.ts +39 -0
  594. package/lib/components/layout/panelManager/TMPanelManagerContext.js +257 -0
  595. package/lib/components/layout/panelManager/TMPanelManagerToolbar.d.ts +11 -0
  596. package/lib/components/layout/panelManager/TMPanelManagerToolbar.js +83 -0
  597. package/lib/components/layout/panelManager/TMPanelManagerWithPersistenceProvider.d.ts +21 -0
  598. package/lib/components/layout/panelManager/TMPanelManagerWithPersistenceProvider.js +64 -0
  599. package/lib/components/layout/panelManager/TMPanelWrapper.d.ts +8 -0
  600. package/lib/components/layout/panelManager/TMPanelWrapper.js +59 -0
  601. package/lib/components/layout/panelManager/types.d.ts +42 -0
  602. package/lib/components/layout/panelManager/types.js +1 -0
  603. package/lib/components/layout/panelManager/utils.d.ts +21 -0
  604. package/lib/components/layout/panelManager/utils.js +208 -0
  605. package/lib/components/pages/TMPage.d.ts +38 -0
  606. package/lib/components/pages/TMPage.js +220 -0
  607. package/lib/components/query/TMQueryEditor.d.ts +58 -0
  608. package/lib/components/query/TMQueryEditor.js +1001 -0
  609. package/lib/components/query/TMQuerySummary.d.ts +16 -0
  610. package/lib/components/query/TMQuerySummary.js +35 -0
  611. package/lib/components/settings/SettingsAppearance.d.ts +14 -0
  612. package/lib/components/settings/SettingsAppearance.js +73 -0
  613. package/lib/components/sidebar/TMAboutApp.d.ts +8 -0
  614. package/lib/components/sidebar/TMAboutApp.js +14 -0
  615. package/lib/components/sidebar/TMCommandsPanel.d.ts +16 -0
  616. package/lib/components/sidebar/TMCommandsPanel.js +27 -0
  617. package/lib/components/sidebar/TMHeader.d.ts +43 -0
  618. package/lib/components/sidebar/TMHeader.js +616 -0
  619. package/lib/components/sidebar/TMSidebar.d.ts +21 -0
  620. package/lib/components/sidebar/TMSidebar.js +61 -0
  621. package/lib/components/sidebar/TMSidebarItem.d.ts +15 -0
  622. package/lib/components/sidebar/TMSidebarItem.js +39 -0
  623. package/lib/components/viewers/TMDataListItemViewer.d.ts +10 -0
  624. package/lib/components/viewers/TMDataListItemViewer.js +80 -0
  625. package/lib/components/viewers/TMMidViewer.d.ts +36 -0
  626. package/lib/components/viewers/TMMidViewer.js +128 -0
  627. package/lib/components/viewers/TMTidViewer.d.ts +256 -0
  628. package/lib/components/viewers/TMTidViewer.js +343 -0
  629. package/lib/components/wizard/TMStepIndicator.d.ts +11 -0
  630. package/lib/components/wizard/TMStepIndicator.js +165 -0
  631. package/lib/components/wizard/TMWizard.d.ts +18 -0
  632. package/lib/components/wizard/TMWizard.js +93 -0
  633. package/lib/css/tm-sdkui.css +1 -0
  634. package/lib/helper/DeepCompareHelper.d.ts +7 -0
  635. package/lib/helper/DeepCompareHelper.js +106 -0
  636. package/lib/helper/Enum_Localizator.d.ts +18 -0
  637. package/lib/helper/Enum_Localizator.js +247 -0
  638. package/lib/helper/GlobalStyles.d.ts +2 -0
  639. package/lib/helper/GlobalStyles.js +10 -0
  640. package/lib/helper/Globalization.d.ts +15 -0
  641. package/lib/helper/Globalization.js +110 -0
  642. package/lib/helper/SDKUI_Globals.d.ts +96 -0
  643. package/lib/helper/SDKUI_Globals.js +174 -0
  644. package/lib/helper/SDKUI_Localizator.d.ts +739 -0
  645. package/lib/helper/SDKUI_Localizator.js +7298 -0
  646. package/lib/helper/TMCommandsContextMenu.d.ts +14 -0
  647. package/lib/helper/TMCommandsContextMenu.js +6 -0
  648. package/lib/helper/TMConditionalWrapper.d.ts +8 -0
  649. package/lib/helper/TMConditionalWrapper.js +4 -0
  650. package/lib/helper/TMCustomSearchBar.d.ts +8 -0
  651. package/lib/helper/TMCustomSearchBar.js +54 -0
  652. package/lib/helper/TMIcons.d.ts +274 -0
  653. package/lib/helper/TMIcons.js +673 -0
  654. package/lib/helper/TMImageLibrary.d.ts +4 -0
  655. package/lib/helper/TMImageLibrary.js +466 -0
  656. package/lib/helper/TMToppyMessage.d.ts +7 -0
  657. package/lib/helper/TMToppyMessage.js +42 -0
  658. package/lib/helper/TMUtils.d.ts +26 -0
  659. package/lib/helper/TMUtils.js +212 -0
  660. package/lib/helper/dcmtsHelper.d.ts +8 -0
  661. package/lib/helper/dcmtsHelper.js +53 -0
  662. package/lib/helper/helpers.d.ts +84 -0
  663. package/lib/helper/helpers.js +826 -0
  664. package/lib/helper/index.d.ts +13 -0
  665. package/lib/helper/index.js +13 -0
  666. package/lib/helper/queryHelper.d.ts +19 -0
  667. package/lib/helper/queryHelper.js +336 -0
  668. package/lib/hooks/useDcmtOperations.d.ts +24 -0
  669. package/lib/hooks/useDcmtOperations.js +482 -0
  670. package/lib/hooks/useForm.d.ts +24 -0
  671. package/lib/hooks/useForm.js +157 -0
  672. package/lib/hooks/useInputDialog.d.ts +9 -0
  673. package/lib/hooks/useInputDialog.js +105 -0
  674. package/lib/hooks/useOutsideClick.d.ts +2 -0
  675. package/lib/hooks/useOutsideClick.js +38 -0
  676. package/lib/hooks/usePreventFileDrop.d.ts +3 -0
  677. package/lib/hooks/usePreventFileDrop.js +37 -0
  678. package/lib/hooks/useQueryParametersDialog.d.ts +2 -0
  679. package/lib/hooks/useQueryParametersDialog.js +71 -0
  680. package/lib/hooks/useRelatedDocuments.d.ts +72 -0
  681. package/lib/hooks/useRelatedDocuments.js +664 -0
  682. package/lib/hooks/useResizeObserver.d.ts +4 -0
  683. package/lib/hooks/useResizeObserver.js +22 -0
  684. package/lib/hooks/useWorkflowApprove.d.ts +11 -0
  685. package/lib/hooks/useWorkflowApprove.js +57 -0
  686. package/lib/index.d.ts +12 -0
  687. package/lib/index.js +15 -0
  688. package/lib/services/index.d.ts +1 -0
  689. package/lib/services/index.js +1 -0
  690. package/lib/services/platform_services.d.ts +18 -0
  691. package/lib/services/platform_services.js +492 -0
  692. package/lib/ts/index.d.ts +1 -0
  693. package/lib/ts/index.js +1 -0
  694. package/lib/ts/types.d.ts +310 -0
  695. package/lib/ts/types.js +100 -0
  696. package/lib/utils/theme.d.ts +69 -0
  697. package/lib/utils/theme.js +81 -0
  698. package/package.json +54 -0
@@ -0,0 +1,1680 @@
1
+ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
2
+ import { useState, useEffect, useCallback, useRef, useMemo } from 'react';
3
+ import { DiagramItemTypes, ArrowSymbol } from './interfaces';
4
+ import { parseWfDiagramXml, serializeWfDiagramToXml } from './xmlParser';
5
+ import styled, { css, keyframes } from 'styled-components';
6
+ import { CultureIDs, DataListCacheService, SearchEngine, WFAppTypes, WorkItemStatus } from "@topconsultnpm/sdk-ts";
7
+ import ConnectionComponent from './ConnectionComponent';
8
+ import DiagramItemComponent from './DiagramItemComponent';
9
+ import DiagramItemSvgContent from './DiagramItemSvgContent';
10
+ import { calculateArrowAngle, downloadFile, getConnectionPoint, getNewWfDiagram, isConnectionNonLinear, validateDiagram } from './workflowHelpers';
11
+ import { IconFlowChart, IconUndo, IconRestore, IconAdjust, IconCopy, IconCut, IconPaste, IconPin, IconUnpin, IconChevronRight, IconCloseOutline, IconNew, SDKUI_Localizator, generateUUID, IconExport, IconImport, IconWindowMaximize, IconZoomIn, IconZoomOut, IconPencil, IconLock, LocalizeDiagramItemType, IconWindowMinimize } from '../../../../helper';
12
+ import { ButtonNames, TMExceptionBoxManager, TMMessageBoxManager } from '../../../base/TMPopUp';
13
+ import { StyledLoadingContainer, StyledSpinner } from '../../../base/Styled';
14
+ import DiagramItemForm from './DiagramItemForm';
15
+ import ReactDOM from 'react-dom';
16
+ import ConnectionForm from './ConnectionForm';
17
+ const ZoomLevelText = styled.span `
18
+ font-size: 0.9em;
19
+ color: #555;
20
+ white-space: nowrap;
21
+ background-color: white;
22
+ padding: 2px 4px; /* Aggiunto un leggero padding per chiarezza */
23
+ border-radius: 4px;
24
+
25
+ /* A. Modalità Compressa (non Floating & Collapsed) */
26
+ ${props => !props.$isFloating && props.$isCollapsed
27
+ ? `
28
+ padding: 0 2px;
29
+ margin: 0;
30
+ display: inline-block;
31
+ line-height: 20px;
32
+ `
33
+ // B. Modalità Flottante (Verticale)
34
+ : props.$isFloating
35
+ ? `
36
+ display: block;
37
+ text-align: center;
38
+ margin: 4px 0;
39
+ padding: 2px 4px;
40
+ `
41
+ // C. Modalità Standard (Orizzontale & non Collapsed)
42
+ : `
43
+ display: flex;
44
+ align-items: center;
45
+ margin: 0 8px;
46
+ padding: 2px 4px;
47
+ `}
48
+ `;
49
+ const DiagramWrapper = styled.div `
50
+ height: 100%;
51
+ width: 100%;
52
+ border: 1px solid #ddd;
53
+ border-radius: 8px;
54
+ overflow: hidden;
55
+ background-color: white;
56
+ box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
57
+ display: flex;
58
+ flex-direction: column;
59
+ position: relative;
60
+ transition: all 0.3s ease-in-out;
61
+ `;
62
+ const FullScreenContainer = styled.div `
63
+ position: fixed;
64
+ top: 0;
65
+ left: 0;
66
+ width: 100vw;
67
+ height: 100vh;
68
+ z-index: 1500;
69
+ background-color: white;
70
+ display: flex;
71
+ flex-direction: column;
72
+ justify-content: center;
73
+ align-items: center;
74
+ `;
75
+ const CanvasContainer = styled.div `
76
+ position: relative;
77
+ width: 100%;
78
+ height: 100%;
79
+ border: 1px solid #ccc;
80
+ background-color: #f9f9f9;
81
+ display: flex;
82
+ overflow: hidden; /* Ensure content doesn't overflow when panels are collapsed */
83
+ `;
84
+ const pulse = keyframes `
85
+ 0% {
86
+ transform: scale(1.0);
87
+ /* 💡 NUOVO: Ombra bianca/chiara per massimo contrasto contro il blu */
88
+ box-shadow: 0 0 0 0px rgba(255, 255, 255, 0.9);
89
+ }
90
+ 50% {
91
+ transform: scale(1.3); /* Aumentato a 1.3 per maggiore impatto visivo */
92
+ box-shadow: 0 0 0 12px rgba(255, 255, 255, 0); /* Aumentato lo spread a 12px */
93
+ }
94
+ 100% {
95
+ transform: scale(1.0);
96
+ box-shadow: 0 0 0 0px rgba(255, 255, 255, 0);
97
+ }
98
+ `;
99
+ const ToolbarContainer = styled.div `
100
+ display: flex;
101
+ gap: 5px;
102
+ background: ${props => props.$isReadOnly
103
+ ? 'transparent linear-gradient(180deg, #007bff 0%, #1E90FF 45%, #0056b3 100%) 0% 0% no-repeat padding-box'
104
+ : 'transparent linear-gradient(180deg, #E03A8B 9%, #C2388B 34%, #A63B8D 60%, #943C8D 83%, #8F3C8D 100%) 0% 0% no-repeat padding-box'};
105
+ padding: 8px;
106
+ border-radius: 4px;
107
+ z-index: 10;
108
+ flex-shrink: 0;
109
+ transition: all 0.3s ease-in-out;
110
+
111
+ ${props => props.$isFloating ? `
112
+ position: absolute;
113
+ bottom: 20px;
114
+ left: ${props.$isReadOnly ? '20px' : props.$isToolboxVisible ? '160px' : '20px'};
115
+ flex-direction: row;
116
+ width: auto;
117
+ box-shadow: 0px 4px 8px rgba(0, 0, 0, 0.2);
118
+ padding: 5px 8px;
119
+ ` : `
120
+ position: relative;
121
+ flex-direction: column;
122
+ width: ${props.$isCollapsed ? '40px' : 'auto'};
123
+ `}
124
+ overflow-y: auto;
125
+
126
+ button {
127
+ background: none;
128
+ border: none;
129
+ cursor: pointer;
130
+ padding: 5px;
131
+ display: flex;
132
+ align-items: center;
133
+ justify-content: ${props => props.$isCollapsed || props.$isFloating ? 'center' : 'flex-start'}; // Centra icone in entrambe le modalità
134
+ white-space: nowrap;
135
+
136
+ position: relative;
137
+ overflow: visible;
138
+ transition: background-color 0.3s; /* Aggiunto transform per l'animazione */
139
+ &[title="Progettazione"] {
140
+ ${props => props.$isReadOnly && css `
141
+ svg {
142
+ /* Applicazione animazione */
143
+ animation: ${pulse} 2s infinite;
144
+
145
+ /* Assicura che l'animazione sia sopra */
146
+ z-index: 2;
147
+
148
+ /* FIX: box-shadow e transform necessitano di spazio visibile */
149
+ overflow: visible; /* Assicurati che l'SVG non tagli l'ombra */
150
+ position: relative; /* Necessario per z-index in alcuni contesti */
151
+
152
+ /* Assicura una transizione base per trasformazione */
153
+ transition: transform 0.2s;
154
+ }
155
+ `}
156
+ }
157
+
158
+ svg {
159
+ color: white;
160
+ font-size: ${props => props.$isFloating ? '20px' : '30px'}; // Icone più piccole in modalità floating
161
+ min-width: ${props => props.$isFloating ? '20px' : '30px'};
162
+ }
163
+
164
+ span {
165
+ display: ${props => (props.$isCollapsed || props.$isFloating) ? 'none' : 'block'}; // Nascondi testo in modalità collapsed e floating
166
+ color: white;
167
+ margin-left: 8px;
168
+ }
169
+
170
+ &:hover {
171
+ background-color: rgba(255, 255, 255, 0.2);
172
+ }
173
+
174
+ &:disabled {
175
+ cursor: not-allowed;
176
+ opacity: 0.5;
177
+ background-color: transparent;
178
+ &:hover {
179
+ background-color: transparent;
180
+ }
181
+ svg {
182
+ color: #cccccc;
183
+ }
184
+ }
185
+ }
186
+ `;
187
+ const ButtonGroup = styled.div `
188
+ display: flex;
189
+ gap: 5px; // Spazio tra i pulsanti all'interno di un gruppo
190
+ flex-shrink: 0; // Impedisce ai gruppi di restringersi
191
+
192
+ ${props => props.$isFloating ? `
193
+ flex-direction: row;
194
+ ${!props.$isLast && `
195
+ border-right: 1px solid rgba(255, 255, 255, 0.3);
196
+ padding-right: 5px;
197
+ margin-right: 5px;
198
+ `}
199
+ ` : `
200
+ flex-direction: column;
201
+ ${!props.$isLast && `
202
+ border-bottom: 1px solid rgba(255, 255, 255, 0.3);
203
+ padding-bottom: 5px;
204
+ margin-bottom: 5px;
205
+ `}
206
+ `}
207
+ `;
208
+ const ToolbarToggle = styled.button `
209
+ background: none;
210
+ border: none;
211
+ cursor: pointer;
212
+ padding: 5px;
213
+ display: flex;
214
+ align-items: center;
215
+ justify-content: center;
216
+ margin-top: auto; /* Push to the bottom */
217
+
218
+ svg {
219
+ /* color: white; */
220
+ font-size: 20px;
221
+ }
222
+ `;
223
+ const ToolboxContainer = styled.div `
224
+ display: flex;
225
+ flex-direction: column;
226
+ gap: 5px;
227
+ background-color: #f0f0f0;
228
+ padding: 5px;
229
+ border-radius: 4px;
230
+ z-index: 10;
231
+ flex-shrink: 0;
232
+ border-right: 1px solid #ccc;
233
+ overflow-y: auto;
234
+ transition: width 0.3s ease-in-out, padding 0.3s ease-in-out, opacity 0.3s ease-in-out;
235
+ opacity: ${props => props.$isVisible ? '1' : '0'};
236
+ pointer-events: ${props => props.$isVisible ? 'auto' : 'none'};
237
+ `;
238
+ const ToolboxIconWrapper = styled.div `
239
+ display: flex;
240
+ align-items: center;
241
+ justify-content: center;
242
+ width: 50px;
243
+ height: 50px;
244
+ border-radius: 50%;
245
+ border: 1px solid #ddd;
246
+ background-color: #fff;
247
+ margin-bottom: 5px;
248
+ transition: all 0.2s ease-in-out;
249
+ `;
250
+ const ToolboxItem = styled.div `
251
+ display: flex;
252
+ flex-direction: column;
253
+ align-items: center;
254
+ justify-content: center;
255
+ padding: 2px;
256
+ border-radius: 5px;
257
+ cursor: grab;
258
+ transition: background-color 0.2s ease-in-out;
259
+ min-width: 80px;
260
+ text-align: center;
261
+
262
+ &:hover {
263
+ background-color: #e9e9e9;
264
+
265
+ ${ToolboxIconWrapper} {
266
+ background-color: #e0e0e0;
267
+ border-color: #a0a0a0;
268
+ }
269
+ }
270
+
271
+ span {
272
+ font-size: 0.8em;
273
+ color: #333;
274
+ word-break: break-word;
275
+ line-height: 1.1;
276
+ max-width: 70px;
277
+ }
278
+ `;
279
+ const SvgScrollContainer = styled.div `
280
+ flex-grow: 1;
281
+ overflow: auto;
282
+ position: relative;
283
+ `;
284
+ const StyledSvg = styled.svg `
285
+ min-width: calc(100% - 5px);
286
+ min-height: calc(100% - 5px);
287
+ background-color: transparent;
288
+
289
+ &:focus {
290
+ outline: none;
291
+ }
292
+ `;
293
+ const ScalableGroup = styled.g `
294
+ transform: translate(${props => props.$translateX}px, ${props => props.$translateY}px) scale(${props => props.$scale});
295
+ transform-origin: 0 0;
296
+ `;
297
+ const SelectionRect = styled.rect `
298
+ fill: rgba(0, 123, 255, 0.1);
299
+ stroke: #007bff;
300
+ stroke-width: 1;
301
+ stroke-dasharray: 3 3;
302
+ pointer-events: none;
303
+ `;
304
+ const TempConnectionPath = styled.path `
305
+ fill: none;
306
+ stroke: #888;
307
+ stroke-width: 2;
308
+ stroke-dasharray: 5 5;
309
+ pointer-events: none;
310
+ `;
311
+ const DiagramMessage = styled.div `
312
+ position: absolute;
313
+ top: 50%;
314
+ left: 50%;
315
+ transform: translate(-50%, -50%);
316
+ font-size: 1.2em;
317
+ color: #555;
318
+ text-align: center;
319
+ `;
320
+ const WFDiagram = ({ xmlDiagramString, currentSetID, allowEdit = true, onDiagramChange }) => {
321
+ const [isReadOnly, setIsReadOnly] = useState(true);
322
+ const [isFullScreen, setIsFullScreen] = useState(false);
323
+ const [zoomLevel, setZoomLevel] = useState(1);
324
+ const [translateX, setTranslateX] = useState(0);
325
+ const [translateY, setTranslateY] = useState(0);
326
+ const [isLoading, setIsLoading] = useState(true);
327
+ const [wfDiagram, setWfDiagram] = useState(null);
328
+ const [selectedItems, setSelectedItems] = useState(new Set());
329
+ const [selectedConnections, setSelectedConnections] = useState(new Set());
330
+ const [wfDiagramHistory, setWfDiagramHistory] = useState([]);
331
+ const [historyIndex, setHistoryIndex] = useState(-1);
332
+ const isUndoingRedoing = useRef(false);
333
+ const initialDiagramRef = useRef(null);
334
+ const notifiedXmlRef = useRef(null);
335
+ const svgRef = useRef(null);
336
+ const [isDrawingConnection, setIsDrawingConnection] = useState(false);
337
+ const [tempConnectionSource, setTempConnectionSource] = useState(null);
338
+ const [tempConnectionEnd, setTempConnectionEnd] = useState(null);
339
+ const [mouseDownPos, setMouseDownPos] = useState(null);
340
+ const [isDraggingExistingConnectionEndpoint, setIsDraggingExistingConnectionEndpoint] = useState(false);
341
+ const [draggingConnectionId, setDraggingConnectionId] = useState(null);
342
+ const [draggingEndpointType, setDraggingEndpointType] = useState(null);
343
+ const [draggingConnectionFixedPoint, setDraggingConnectionFixedPoint] = useState(null);
344
+ const [isDrawingSelectionRect, setIsDrawingSelectionRect] = useState(false);
345
+ const [selectionRectStart, setSelectionRectStart] = useState(null);
346
+ const [selectionRectEnd, setSelectionRectEnd] = useState(null);
347
+ const [copiedItems, setCopiedItems] = useState([]);
348
+ const [copiedConnections, setCopiedConnections] = useState([]);
349
+ const [isCutOperation, setIsCutOperation] = useState(false);
350
+ const [isDraggingFromToolbox, setIsDraggingFromToolbox] = useState(false);
351
+ const [draggedItemType, setDraggedItemType] = useState(null);
352
+ const [isToolbarCollapsed, setIsToolbarCollapsed] = useState(false);
353
+ const [isToolbarFloating, setIsToolbarFloating] = useState(true);
354
+ const [isToolboxVisible, setIsToolboxVisible] = useState(true);
355
+ const [isModalOpen, setIsModalOpen] = useState(false);
356
+ const [itemToEdit, setItemToEdit] = useState(null);
357
+ const [isConnectionModalOpen, setIsConnectionModalOpen] = useState(false);
358
+ const [connectionToEdit, setConnectionToEdit] = useState(null);
359
+ const { svgWidth, svgHeight } = useMemo(() => {
360
+ if (!wfDiagram) {
361
+ return { svgWidth: 0, svgHeight: 0 };
362
+ }
363
+ let minX = Infinity;
364
+ let minY = Infinity;
365
+ let maxX = 0;
366
+ let maxY = 0;
367
+ const connectionPadding = 50;
368
+ const itemPadding = 50;
369
+ wfDiagram.DiagramItems.forEach(item => {
370
+ minX = Math.min(minX, item.Left);
371
+ minY = Math.min(minY, item.Top);
372
+ maxX = Math.max(maxX, item.Left + item.Width);
373
+ maxY = Math.max(maxY, item.Top + item.Height + 50);
374
+ });
375
+ wfDiagram.Connections.forEach(connection => {
376
+ const sourceItem = wfDiagram.DiagramItems.find(item => item.ID === connection.Source.ParentDiagramItem.ID);
377
+ const sinkItem = wfDiagram.DiagramItems.find(item => item.ID === connection.Sink.ParentDiagramItem.ID);
378
+ if (sourceItem && sinkItem) {
379
+ minX = Math.min(minX, sourceItem.Left - connectionPadding, sinkItem.Left - connectionPadding);
380
+ minY = Math.min(minY, sourceItem.Top - connectionPadding, sinkItem.Top - connectionPadding);
381
+ maxX = Math.max(maxX, sourceItem.Left + sourceItem.Width + connectionPadding, sinkItem.Left + sinkItem.Width + connectionPadding);
382
+ maxY = Math.max(maxY, sourceItem.Top + sourceItem.Height + connectionPadding, sinkItem.Top + sinkItem.Height + connectionPadding);
383
+ }
384
+ });
385
+ const finalMinX = minX - itemPadding;
386
+ const finalMinY = minY - itemPadding;
387
+ const finalMaxX = maxX + itemPadding;
388
+ const finalMaxY = maxY + itemPadding;
389
+ const totalWidth = finalMaxX - finalMinX;
390
+ const totalHeight = finalMaxY - finalMinY;
391
+ return { svgWidth: Math.max(0, totalWidth * zoomLevel), svgHeight: Math.max(0, totalHeight * zoomLevel) };
392
+ }, [wfDiagram, zoomLevel]);
393
+ const updateDiagram = useCallback((newDiagram, validate = true) => {
394
+ if (isReadOnly)
395
+ return;
396
+ try {
397
+ if (validate) {
398
+ validateDiagram(newDiagram);
399
+ }
400
+ if (!isUndoingRedoing.current) {
401
+ const newHistory = wfDiagramHistory.slice(0, historyIndex + 1);
402
+ setWfDiagramHistory([...newHistory, newDiagram]);
403
+ setHistoryIndex(newHistory.length);
404
+ }
405
+ setWfDiagram(newDiagram);
406
+ (async () => {
407
+ try {
408
+ // await è necessario per attendere il risultato stringa
409
+ const newXml = await serializeWfDiagramToXml(newDiagram);
410
+ notifiedXmlRef.current = newXml;
411
+ // Chiama il callback per notificare TMWFEditor
412
+ // L'invio dell'XML al genitore avviene solo a serializzazione completata.
413
+ onDiagramChange?.(newXml);
414
+ }
415
+ catch (e) {
416
+ console.error("Errore durante la serializzazione del diagramma:", e);
417
+ // Puoi gestire l'errore di serializzazione qui, ad esempio mostrando una notifica
418
+ // TMExceptionBoxManager.show({ exception: new Error("Errore serializzazione WF") });
419
+ }
420
+ })();
421
+ }
422
+ catch (e) {
423
+ TMExceptionBoxManager.show({ exception: e });
424
+ }
425
+ }, [wfDiagramHistory, historyIndex, isUndoingRedoing, setWfDiagramHistory, setHistoryIndex, setWfDiagram, isReadOnly]);
426
+ const handleUndo = useCallback(() => {
427
+ if (isReadOnly)
428
+ return;
429
+ if (historyIndex > 0) {
430
+ isUndoingRedoing.current = true;
431
+ const newIndex = historyIndex - 1;
432
+ const newDiagram = wfDiagramHistory[newIndex];
433
+ setHistoryIndex(newIndex);
434
+ setWfDiagram(newDiagram);
435
+ serializeWfDiagramToXml(newDiagram).then(newXml => {
436
+ notifiedXmlRef.current = newXml;
437
+ onDiagramChange?.(newXml);
438
+ });
439
+ }
440
+ }, [historyIndex, wfDiagramHistory, isReadOnly, onDiagramChange]);
441
+ const handleRedo = useCallback(() => {
442
+ if (isReadOnly)
443
+ return;
444
+ if (historyIndex < wfDiagramHistory.length - 1) {
445
+ isUndoingRedoing.current = true;
446
+ const newIndex = historyIndex + 1;
447
+ const newDiagram = wfDiagramHistory[newIndex];
448
+ setHistoryIndex(newIndex);
449
+ setWfDiagram(newDiagram);
450
+ serializeWfDiagramToXml(newDiagram).then(newXml => {
451
+ notifiedXmlRef.current = newXml;
452
+ onDiagramChange?.(newXml);
453
+ });
454
+ }
455
+ }, [historyIndex, wfDiagramHistory, isReadOnly, onDiagramChange]);
456
+ const handleDelete = useCallback(() => {
457
+ if (isReadOnly)
458
+ return;
459
+ if (!wfDiagram || (selectedItems.size === 0 && selectedConnections.size === 0)) {
460
+ return;
461
+ }
462
+ // 1. Filtra i nodi "Start" e "End" dal set di elementi selezionati
463
+ const nonDeletableItems = wfDiagram.DiagramItems.filter(item => item.Type === DiagramItemTypes.Start || item.Type === DiagramItemTypes.End);
464
+ const deletableSelectedItems = new Set([...selectedItems].filter(id => !nonDeletableItems.some(item => item.ID === id)));
465
+ let newDiagramItems = wfDiagram.DiagramItems;
466
+ let newConnections = wfDiagram.Connections;
467
+ if (deletableSelectedItems.size > 0) {
468
+ // 2. Filtra gli elementi del diagramma usando il set filtrato
469
+ newDiagramItems = wfDiagram.DiagramItems.filter(item => !deletableSelectedItems.has(item.ID));
470
+ // 3. Filtra le connessioni usando il set filtrato
471
+ newConnections = newConnections.filter(conn => !deletableSelectedItems.has(conn.Source.ParentDiagramItem.ID) &&
472
+ !deletableSelectedItems.has(conn.Sink.ParentDiagramItem.ID));
473
+ }
474
+ if (selectedConnections.size > 0) {
475
+ newConnections = newConnections.filter(conn => !selectedConnections.has(conn.ID));
476
+ }
477
+ const newWfDiagram = {
478
+ ...wfDiagram,
479
+ DiagramItems: newDiagramItems,
480
+ Connections: newConnections,
481
+ };
482
+ // Assicura che i nodi non cancellabili restino selezionati per coerenza UI
483
+ setSelectedItems(new Set([...deletableSelectedItems, ...[...selectedItems].filter(id => nonDeletableItems.some(item => item.ID === id))]));
484
+ setSelectedConnections(new Set());
485
+ updateDiagram(newWfDiagram, false);
486
+ }, [wfDiagram, selectedItems, selectedConnections, setWfDiagram, setSelectedItems, setSelectedConnections, updateDiagram, isReadOnly]);
487
+ const handleCopy = useCallback(() => {
488
+ if (isReadOnly)
489
+ return;
490
+ if (!wfDiagram || selectedItems.size === 0) {
491
+ return;
492
+ }
493
+ const itemsToCopy = wfDiagram.DiagramItems.filter(item => selectedItems.has(item.ID));
494
+ const connectionsToCopy = wfDiagram.Connections.filter(connection => selectedItems.has(connection.Source.ParentDiagramItem.ID) &&
495
+ selectedItems.has(connection.Sink.ParentDiagramItem.ID));
496
+ setCopiedItems(itemsToCopy);
497
+ setCopiedConnections(connectionsToCopy);
498
+ setIsCutOperation(false);
499
+ }, [wfDiagram, selectedItems, isReadOnly]);
500
+ const handleCut = useCallback(() => {
501
+ if (isReadOnly)
502
+ return;
503
+ if (!wfDiagram || selectedItems.size === 0) {
504
+ return;
505
+ }
506
+ const itemsToCut = wfDiagram.DiagramItems.filter(item => selectedItems.has(item.ID));
507
+ const connectionsToCut = wfDiagram.Connections.filter(connection => selectedItems.has(connection.Source.ParentDiagramItem.ID) &&
508
+ selectedItems.has(connection.Sink.ParentDiagramItem.ID));
509
+ setCopiedItems(itemsToCut);
510
+ setCopiedConnections(connectionsToCut);
511
+ setIsCutOperation(true);
512
+ let newDiagramItems = wfDiagram.DiagramItems.filter(item => !selectedItems.has(item.ID));
513
+ let newConnections = wfDiagram.Connections.filter(conn => !selectedItems.has(conn.Source.ParentDiagramItem.ID) &&
514
+ !selectedItems.has(conn.Sink.ParentDiagramItem.ID));
515
+ const newWfDiagram = {
516
+ ...wfDiagram,
517
+ DiagramItems: newDiagramItems,
518
+ Connections: newConnections,
519
+ };
520
+ setSelectedItems(new Set());
521
+ setSelectedConnections(new Set());
522
+ updateDiagram(newWfDiagram, false);
523
+ }, [wfDiagram, selectedItems, setSelectedItems, setSelectedConnections, updateDiagram, isReadOnly]);
524
+ const handlePaste = useCallback(() => {
525
+ if (isReadOnly)
526
+ return;
527
+ if (!wfDiagram || (copiedItems.length === 0 && copiedConnections.length === 0)) {
528
+ return;
529
+ }
530
+ const offset = 20;
531
+ const newDiagramItems = [];
532
+ const oldIdToNewIdMap = new Map();
533
+ copiedItems.forEach(item => {
534
+ const newId = generateUUID();
535
+ oldIdToNewIdMap.set(item.ID, newId);
536
+ newDiagramItems.push({
537
+ ...item,
538
+ ID: newId,
539
+ Left: item.Left + offset,
540
+ Top: item.Top + offset,
541
+ });
542
+ });
543
+ const newConnections = [];
544
+ copiedConnections.forEach(connection => {
545
+ const newSourceItemId = oldIdToNewIdMap.get(connection.Source.ParentDiagramItem.ID);
546
+ const newSinkItemId = oldIdToNewIdMap.get(connection.Sink.ParentDiagramItem.ID);
547
+ if (newSourceItemId && newSinkItemId) {
548
+ newConnections.push({
549
+ ...connection,
550
+ ID: generateUUID(),
551
+ Source: { ParentDiagramItem: { ID: newSourceItemId }, ConnectorName: connection.Source.ConnectorName },
552
+ Sink: { ParentDiagramItem: { ID: newSinkItemId }, ConnectorName: connection.Sink.ConnectorName },
553
+ PathGeometry: "",
554
+ });
555
+ }
556
+ });
557
+ const combinedDiagramItems = [...wfDiagram.DiagramItems, ...newDiagramItems];
558
+ const combinedConnections = [...wfDiagram.Connections, ...newConnections];
559
+ if (isCutOperation) {
560
+ setCopiedItems([]);
561
+ setCopiedConnections([]);
562
+ setIsCutOperation(false);
563
+ }
564
+ const newlySelectedItems = new Set(newDiagramItems.map(item => item.ID));
565
+ setSelectedItems(newlySelectedItems);
566
+ setSelectedConnections(new Set());
567
+ const newWfDiagram = {
568
+ ...wfDiagram,
569
+ DiagramItems: combinedDiagramItems,
570
+ Connections: combinedConnections,
571
+ };
572
+ updateDiagram(newWfDiagram, false);
573
+ }, [wfDiagram, copiedItems, copiedConnections, isCutOperation, updateDiagram, setSelectedItems, setSelectedConnections, isReadOnly]);
574
+ const handleNew = useCallback(() => {
575
+ if (isReadOnly)
576
+ return;
577
+ const newWfDiagram = getNewWfDiagram(wfDiagram?.Info || null);
578
+ updateDiagram(newWfDiagram);
579
+ setWfDiagramHistory([newWfDiagram]);
580
+ setHistoryIndex(0);
581
+ setSelectedItems(new Set());
582
+ setSelectedConnections(new Set());
583
+ setCopiedItems([]);
584
+ setCopiedConnections([]);
585
+ setIsCutOperation(false);
586
+ }, [wfDiagram, isReadOnly]);
587
+ const handleToggleToolbarMode = () => {
588
+ setIsToolbarFloating(prev => !prev);
589
+ };
590
+ const handleToggleToolboxVisibility = () => {
591
+ setIsToolboxVisible(prev => !prev);
592
+ };
593
+ const handleDoubleClickItem = useCallback((itemId) => {
594
+ if (isReadOnly)
595
+ return;
596
+ const itemFound = wfDiagram?.DiagramItems.find(item => item.ID === itemId);
597
+ if (itemFound) {
598
+ setItemToEdit(itemFound);
599
+ setIsModalOpen(true);
600
+ }
601
+ }, [wfDiagram, isReadOnly]);
602
+ const handleCloseModal = useCallback(() => {
603
+ if (isReadOnly)
604
+ return;
605
+ setIsModalOpen(prevIsModalOpen => {
606
+ return false;
607
+ });
608
+ }, [isReadOnly]);
609
+ const handleDoubleClickConnection = useCallback((connectionId) => {
610
+ if (isReadOnly)
611
+ return;
612
+ const connFound = wfDiagram?.Connections.find(c => c.ID === connectionId);
613
+ if (connFound) {
614
+ const sinkItem = wfDiagram?.DiagramItems.find(item => item.ID === connFound.Sink.ParentDiagramItem.ID);
615
+ if (sinkItem) {
616
+ const canOpen = [
617
+ DiagramItemTypes.Approval,
618
+ DiagramItemTypes.DataEntry,
619
+ DiagramItemTypes.ExecTask
620
+ ].includes(sinkItem.Type);
621
+ if (canOpen) {
622
+ setConnectionToEdit(connFound);
623
+ setIsConnectionModalOpen(true);
624
+ }
625
+ }
626
+ }
627
+ }, [wfDiagram, isReadOnly]);
628
+ const handleKeyDown = useCallback((event) => {
629
+ if (isReadOnly)
630
+ return;
631
+ if (['ArrowUp', 'ArrowDown', 'ArrowLeft', 'ArrowRight', 'Delete', 'Backspace', 'z', 'y'].includes(event.key)) {
632
+ // Prevent the event from bubbling up to parent components (like the TabPanel)
633
+ event.stopPropagation();
634
+ if (['z', 'y'].includes(event.key) && !event.ctrlKey) {
635
+ return;
636
+ }
637
+ event.preventDefault();
638
+ }
639
+ if (event.ctrlKey) {
640
+ if (event.key === 'z') {
641
+ handleUndo();
642
+ return;
643
+ }
644
+ else if (event.key === 'y') {
645
+ handleRedo();
646
+ return;
647
+ }
648
+ else if (event.key === 'c') {
649
+ handleCopy();
650
+ return;
651
+ }
652
+ else if (event.key === 'x') {
653
+ handleCut();
654
+ return;
655
+ }
656
+ else if (event.key === 'v') {
657
+ handlePaste();
658
+ return;
659
+ }
660
+ }
661
+ if (!wfDiagram) {
662
+ return;
663
+ }
664
+ if (selectedItems.size > 0) {
665
+ let deltaX = 0;
666
+ let deltaY = 0;
667
+ const step = event.shiftKey ? 1 : (event.ctrlKey ? 50 : 10);
668
+ switch (event.key) {
669
+ case 'ArrowUp':
670
+ deltaY = -step;
671
+ break;
672
+ case 'ArrowDown':
673
+ deltaY = step;
674
+ break;
675
+ case 'ArrowLeft':
676
+ deltaX = -step;
677
+ break;
678
+ case 'ArrowRight':
679
+ deltaX = step;
680
+ break;
681
+ }
682
+ if (deltaX !== 0 || deltaY !== 0) {
683
+ const newDiagramItems = wfDiagram.DiagramItems.map(item => {
684
+ if (selectedItems.has(item.ID)) {
685
+ return {
686
+ ...item,
687
+ Left: item.Left + deltaX,
688
+ Top: item.Top + deltaY,
689
+ };
690
+ }
691
+ return item;
692
+ });
693
+ const newWfDiagram = {
694
+ ...wfDiagram,
695
+ DiagramItems: newDiagramItems,
696
+ };
697
+ updateDiagram(newWfDiagram, false);
698
+ return;
699
+ }
700
+ }
701
+ if (event.key === 'Delete' || event.key === 'Backspace') {
702
+ handleDelete();
703
+ return;
704
+ }
705
+ }, [wfDiagram, selectedItems, selectedConnections, handleUndo, handleRedo, handleDelete, updateDiagram, handleCopy, handleCut, handlePaste, isReadOnly]);
706
+ const handleExportDiagram = useCallback(async () => {
707
+ if (!wfDiagram) {
708
+ // Visualizza un errore se il diagramma non è stato caricato o è vuoto
709
+ TMExceptionBoxManager.show({ exception: new Error('Diagram not loaded.') });
710
+ return;
711
+ }
712
+ try {
713
+ // 1. Serializza il diagramma in XML
714
+ const xmlString = await serializeWfDiagramToXml(wfDiagram);
715
+ // 2. Determina il nome del file (usa l'ID o un UUID se non disponibile)
716
+ const filename = `WorkflowDiagram_${wfDiagram.Info?.ID || generateUUID()}.xml`;
717
+ // 3. Avvia il download (la cartella è scelta dal browser)
718
+ downloadFile(xmlString, filename, 'application/xml');
719
+ }
720
+ catch (e) {
721
+ TMExceptionBoxManager.show({ exception: e });
722
+ }
723
+ }, [wfDiagram]);
724
+ const fileInputRef = useRef(null);
725
+ const handleImportDiagramClick = useCallback(() => {
726
+ if (fileInputRef.current) {
727
+ fileInputRef.current.click();
728
+ }
729
+ }, []);
730
+ const handleFileChange = useCallback((event) => {
731
+ const file = event.target.files?.[0];
732
+ if (!file) {
733
+ return;
734
+ }
735
+ const reader = new FileReader();
736
+ reader.onload = (e) => {
737
+ try {
738
+ const xmlContent = e.target?.result;
739
+ const newWfDiagram = parseWfDiagramXml(xmlContent);
740
+ updateDiagram(newWfDiagram, false);
741
+ if (fileInputRef.current) {
742
+ fileInputRef.current.value = '';
743
+ }
744
+ }
745
+ catch (error) {
746
+ const errorMessage = 'Error importing diagram. Invalid XML format.';
747
+ TMExceptionBoxManager.show({ exception: new Error(errorMessage + `\n${error.message}`) });
748
+ if (fileInputRef.current) {
749
+ fileInputRef.current.value = '';
750
+ }
751
+ }
752
+ };
753
+ reader.readAsText(file, 'UTF-8');
754
+ }, [updateDiagram]);
755
+ const calculateConnectionPath = useCallback((connection, sourceItem, sinkItem) => {
756
+ const sourcePoint = getConnectionPoint(sourceItem, connection.Source.ConnectorName);
757
+ const sinkPoint = getConnectionPoint(sinkItem, connection.Sink.ConnectorName);
758
+ const sourceRect = { x: sourceItem.Left, y: sourceItem.Top, width: sourceItem.Width, height: sourceItem.Height };
759
+ const sinkRect = { x: sinkItem.Left, y: sinkItem.Top, width: sinkItem.Width, height: sinkItem.Height };
760
+ const sourceConnectorName = connection.Source.ConnectorName.toLowerCase();
761
+ const sinkConnectorName = connection.Sink.ConnectorName.toLowerCase();
762
+ const isNonLinearConnection = isConnectionNonLinear(sourceRect, sinkRect, sourceConnectorName, sinkConnectorName);
763
+ let pathPoints = [];
764
+ let sinkArrowAngle = 0;
765
+ const offsetStub = 15;
766
+ const bypassBuffer = 50;
767
+ const getDirection = (connectorName) => {
768
+ if (connectorName === 'Left' || connectorName === 'Right')
769
+ return 'H';
770
+ return 'V';
771
+ };
772
+ const sourceDir = getDirection(connection.Source.ConnectorName);
773
+ const sinkDir = getDirection(connection.Sink.ConnectorName);
774
+ let startStubPoint;
775
+ switch (connection.Source.ConnectorName) {
776
+ case 'Right':
777
+ startStubPoint = { x: sourcePoint.x + offsetStub, y: sourcePoint.y };
778
+ break;
779
+ case 'Left':
780
+ startStubPoint = { x: sourcePoint.x - offsetStub, y: sourcePoint.y };
781
+ break;
782
+ case 'Bottom':
783
+ startStubPoint = { x: sourcePoint.x, y: sourcePoint.y + offsetStub };
784
+ break;
785
+ case 'Top':
786
+ startStubPoint = { x: sourcePoint.x, y: sourcePoint.y - offsetStub };
787
+ break;
788
+ default: startStubPoint = sourcePoint;
789
+ }
790
+ pathPoints.push(sourcePoint);
791
+ pathPoints.push(startStubPoint);
792
+ let endStubPoint;
793
+ switch (connection.Sink.ConnectorName) {
794
+ case 'Right':
795
+ endStubPoint = { x: sinkPoint.x + offsetStub, y: sinkPoint.y };
796
+ break;
797
+ case 'Left':
798
+ endStubPoint = { x: sinkPoint.x - offsetStub, y: sinkPoint.y };
799
+ break;
800
+ case 'Bottom':
801
+ endStubPoint = { x: sinkPoint.x, y: sinkPoint.y + offsetStub };
802
+ break;
803
+ case 'Top':
804
+ endStubPoint = { x: sinkPoint.x, y: sinkPoint.y - offsetStub };
805
+ break;
806
+ default: endStubPoint = sinkPoint;
807
+ }
808
+ let currentPathPoint = startStubPoint;
809
+ const doesSegmentIntersectRect = (p1, p2, rect) => {
810
+ const bufferedRect = {
811
+ x: rect.x - 0.5, y: rect.y - 0.5,
812
+ width: rect.width + 1, height: rect.height + 1
813
+ };
814
+ if ((p1.x > bufferedRect.x && p1.x < bufferedRect.x + bufferedRect.width && p1.y > bufferedRect.y && p1.y < bufferedRect.y + bufferedRect.height) ||
815
+ (p2.x > bufferedRect.x && p2.x < bufferedRect.x + bufferedRect.width && p2.y > bufferedRect.y && p2.y < bufferedRect.y + bufferedRect.height)) {
816
+ return true;
817
+ }
818
+ if (p1.y === p2.y) {
819
+ const segMinX = Math.min(p1.x, p2.x);
820
+ const segMaxX = Math.max(p1.x, p2.x);
821
+ if (p1.y >= bufferedRect.y && p1.y <= bufferedRect.y + bufferedRect.height) {
822
+ if (segMaxX > bufferedRect.x && segMinX < bufferedRect.x + bufferedRect.width) {
823
+ return true;
824
+ }
825
+ }
826
+ }
827
+ else if (p1.x === p2.x) {
828
+ const segMinY = Math.min(p1.y, p2.y);
829
+ const segMaxY = Math.max(p1.y, p2.y);
830
+ if (p1.x >= bufferedRect.x && p1.x <= bufferedRect.x + bufferedRect.height) {
831
+ if (segMaxY > bufferedRect.y && segMinY < bufferedRect.y + bufferedRect.height) {
832
+ return true;
833
+ }
834
+ }
835
+ }
836
+ return false;
837
+ };
838
+ const canTakeDirectLPath = () => {
839
+ const itemsToAvoid = [sourceRect, sinkRect];
840
+ const p_hv_mid = { x: endStubPoint.x, y: currentPathPoint.y };
841
+ const pathHV = [currentPathPoint, p_hv_mid, endStubPoint];
842
+ const crossesHV = pathHV.some((p, i) => i < pathHV.length - 1 && itemsToAvoid.some(rect => doesSegmentIntersectRect(p, pathHV[i + 1], rect)));
843
+ const p_vh_mid = { x: currentPathPoint.x, y: endStubPoint.y };
844
+ const pathVH = [currentPathPoint, p_vh_mid, endStubPoint];
845
+ const crossesVH = pathVH.some((p, i) => i < pathVH.length - 1 && itemsToAvoid.some(rect => doesSegmentIntersectRect(p, pathVH[i + 1], rect)));
846
+ if (sourceDir === 'H' && !crossesHV)
847
+ return p_hv_mid;
848
+ if (sourceDir === 'V' && !crossesVH)
849
+ return p_vh_mid;
850
+ if (!crossesHV)
851
+ return p_hv_mid;
852
+ if (!crossesVH)
853
+ return p_vh_mid;
854
+ return null;
855
+ };
856
+ const proximityTolerance = 20; // Regola questo valore in base alle tue esigenze (in pixel)
857
+ // Crea i rettangoli espansi
858
+ const expandedSourceRect = {
859
+ x: sourceRect.x - proximityTolerance,
860
+ y: sourceRect.y - proximityTolerance,
861
+ width: sourceRect.width + (2 * proximityTolerance),
862
+ height: sourceRect.height + (2 * proximityTolerance),
863
+ };
864
+ const expandedSinkRect = {
865
+ x: sinkRect.x - proximityTolerance,
866
+ y: sinkRect.y - proximityTolerance,
867
+ width: sinkRect.width + (2 * proximityTolerance),
868
+ height: sinkRect.height + (2 * proximityTolerance),
869
+ };
870
+ // Ora, controlla se i rettangoli espansi si sovrappongono.
871
+ // Questa è una delle implementazioni più comuni e robuste per determinare la "vicinanza" tra due rettangoli.
872
+ const isNodesVeryClose = expandedSourceRect.x < (expandedSinkRect.x + expandedSinkRect.width) &&
873
+ (expandedSourceRect.x + expandedSourceRect.width) > expandedSinkRect.x &&
874
+ expandedSourceRect.y < (expandedSinkRect.y + expandedSinkRect.height) &&
875
+ (expandedSourceRect.y + expandedSourceRect.height) > expandedSinkRect.y;
876
+ if (isNodesVeryClose && !isNonLinearConnection) {
877
+ // Force an L-path. Decide between H-V and V-H based on which is more direct/less "bent"
878
+ let p_mid_forced;
879
+ if (sourceDir === 'H' || (sourceDir === 'V' && Math.abs(sourcePoint.x - sinkPoint.x) > Math.abs(sourcePoint.y - sinkPoint.y))) {
880
+ p_mid_forced = { x: endStubPoint.x, y: currentPathPoint.y };
881
+ }
882
+ else {
883
+ p_mid_forced = { x: currentPathPoint.x, y: endStubPoint.y };
884
+ }
885
+ pathPoints.push(p_mid_forced);
886
+ currentPathPoint = p_mid_forced;
887
+ }
888
+ else {
889
+ // Original logic for complex routing if not "very close"
890
+ const directLPathMidPoint = canTakeDirectLPath();
891
+ if (directLPathMidPoint) {
892
+ pathPoints.push(directLPathMidPoint);
893
+ currentPathPoint = directLPathMidPoint;
894
+ }
895
+ else {
896
+ const minOverallX = Math.min(sourceRect.x, sinkRect.x);
897
+ const maxOverallX = Math.max(sourceRect.x + sourceRect.width, sinkRect.x + sinkRect.width);
898
+ const minOverallY = Math.min(sourceRect.y, sinkRect.y);
899
+ const maxOverallY = Math.max(sourceRect.y + sourceRect.height, sinkRect.y + sinkRect.height);
900
+ let p2;
901
+ let p3;
902
+ let preferredBypassAxis;
903
+ const avgMidX = (sourceRect.x + sourceRect.width / 2 + sinkRect.x + sinkRect.width / 2) / 2;
904
+ const avgMidY = (sourceRect.y + sourceRect.height / 2 + sinkRect.y + sinkRect.height / 2) / 2;
905
+ if (sourceDir === 'H') {
906
+ preferredBypassAxis = 'Y';
907
+ }
908
+ else {
909
+ preferredBypassAxis = 'X';
910
+ }
911
+ if (preferredBypassAxis === 'Y') {
912
+ let bypassY_coord;
913
+ if (currentPathPoint.y < avgMidY) {
914
+ bypassY_coord = minOverallY - bypassBuffer;
915
+ }
916
+ else {
917
+ bypassY_coord = maxOverallY + bypassBuffer;
918
+ }
919
+ p2 = { x: currentPathPoint.x, y: bypassY_coord };
920
+ p3 = { x: endStubPoint.x, y: bypassY_coord };
921
+ pathPoints.push(p2);
922
+ pathPoints.push(p3);
923
+ currentPathPoint = p3;
924
+ }
925
+ else {
926
+ let bypassX_coord;
927
+ if (currentPathPoint.x < avgMidX) {
928
+ bypassX_coord = minOverallX - bypassBuffer;
929
+ }
930
+ else {
931
+ bypassX_coord = maxOverallX + bypassBuffer;
932
+ }
933
+ p2 = { x: bypassX_coord, y: currentPathPoint.y };
934
+ p3 = { x: bypassX_coord, y: endStubPoint.y };
935
+ pathPoints.push(p2);
936
+ pathPoints.push(p3);
937
+ currentPathPoint = p3;
938
+ }
939
+ }
940
+ }
941
+ pathPoints.push(endStubPoint);
942
+ pathPoints.push(sinkPoint);
943
+ const prevPointForArrow = pathPoints.length > 1 ? pathPoints[pathPoints.length - 2] : startStubPoint;
944
+ sinkArrowAngle = calculateArrowAngle(prevPointForArrow, sinkPoint);
945
+ let pathData = `M${pathPoints[0].x},${pathPoints[0].y}`;
946
+ for (let i = 1; i < pathPoints.length; i++) {
947
+ pathData += ` L${pathPoints[i].x},${pathPoints[i].y}`;
948
+ }
949
+ return { path: pathData, sinkArrowAngle: sinkArrowAngle };
950
+ }, []);
951
+ const calculatedConnections = useMemo(() => {
952
+ if (!wfDiagram)
953
+ return [];
954
+ return wfDiagram.Connections.map(connection => {
955
+ const sourceItem = wfDiagram.DiagramItems.find(item => item.ID === connection.Source.ParentDiagramItem.ID);
956
+ const sinkItem = wfDiagram.DiagramItems.find(item => item.ID === connection.Sink.ParentDiagramItem.ID);
957
+ if (!sourceItem || !sinkItem) {
958
+ console.warn(`Cannot find source or sink item for connection ${connection.ID}`);
959
+ return { ...connection, PathGeometry: "" };
960
+ }
961
+ const { path, sinkArrowAngle } = calculateConnectionPath(connection, sourceItem, sinkItem);
962
+ return {
963
+ ...connection,
964
+ PathGeometry: path,
965
+ sinkArrowAngle: sinkArrowAngle,
966
+ };
967
+ });
968
+ }, [wfDiagram, calculateConnectionPath]);
969
+ const tempConnectionPathData = useMemo(() => {
970
+ if (isDrawingConnection && tempConnectionSource && tempConnectionEnd && wfDiagram) {
971
+ const sourceItem = tempConnectionSource.item;
972
+ const sourcePoint = getConnectionPoint(sourceItem, tempConnectionSource.connectorName);
973
+ return `M ${sourcePoint.x} ${sourcePoint.y} L ${tempConnectionEnd.x} ${tempConnectionEnd.y}`;
974
+ }
975
+ else if (isDraggingExistingConnectionEndpoint && draggingConnectionFixedPoint && tempConnectionEnd) {
976
+ // Disegna la linea temporanea dal punto fisso all'attuale posizione del mouse
977
+ return `M ${draggingConnectionFixedPoint.x} ${draggingConnectionFixedPoint.y} L ${tempConnectionEnd.x} ${tempConnectionEnd.y}`;
978
+ }
979
+ return "";
980
+ }, [isDrawingConnection, tempConnectionSource, tempConnectionEnd, wfDiagram, isDraggingExistingConnectionEndpoint, draggingConnectionFixedPoint]);
981
+ const handleRestore = useCallback(() => {
982
+ if (isReadOnly)
983
+ return;
984
+ if (!initialDiagramRef.current)
985
+ return;
986
+ TMMessageBoxManager.show({
987
+ title: SDKUI_Localizator.WorkflowRestoreDiagram,
988
+ message: SDKUI_Localizator.WorkflowRestoreDiagramMessage,
989
+ buttons: [ButtonNames.YES, ButtonNames.NO],
990
+ onButtonClick: async (e) => {
991
+ if (e === ButtonNames.YES) {
992
+ setWfDiagram(initialDiagramRef.current);
993
+ setWfDiagramHistory([initialDiagramRef.current]);
994
+ setHistoryIndex(0);
995
+ }
996
+ }
997
+ });
998
+ }, [isReadOnly]);
999
+ const autoAdjustDiagram = (diagram) => {
1000
+ if (!diagram)
1001
+ return diagram;
1002
+ let newDiagramItems = diagram.DiagramItems.map(item => ({ ...item }));
1003
+ const alignmentThreshold = 25;
1004
+ const spacingBuffer = 10;
1005
+ let changed = true;
1006
+ let iteration = 0;
1007
+ const maxIterations = 100;
1008
+ while (changed && iteration < maxIterations) {
1009
+ changed = false;
1010
+ const itemsForIteration = newDiagramItems.map(item => ({ ...item }));
1011
+ for (let i = 0; i < itemsForIteration.length; i++) {
1012
+ const item1 = itemsForIteration[i];
1013
+ for (let j = 0; j < itemsForIteration.length; j++) {
1014
+ if (i === j)
1015
+ continue;
1016
+ const item2 = itemsForIteration[j];
1017
+ if (item1.Left < item2.Left + item2.Width &&
1018
+ item1.Left + item1.Width > item2.Left &&
1019
+ item1.Top < item2.Top + item2.Height &&
1020
+ item1.Top + item1.Height > item2.Top) {
1021
+ const overlapX = Math.min(item1.Left + item1.Width, item2.Left + item2.Width) - Math.max(item1.Left, item2.Left);
1022
+ const overlapY = Math.min(item1.Top + item1.Height, item2.Top + item2.Height) - Math.max(item1.Top, item2.Top);
1023
+ if (overlapX < overlapY) {
1024
+ if (item1.Left < item2.Left) {
1025
+ item2.Left = item1.Left + item1.Width + spacingBuffer;
1026
+ }
1027
+ else {
1028
+ item2.Left = item1.Left - item2.Width - spacingBuffer;
1029
+ }
1030
+ }
1031
+ else {
1032
+ if (item1.Top < item2.Top) {
1033
+ item2.Top = item1.Top + item1.Height + spacingBuffer;
1034
+ }
1035
+ else {
1036
+ item2.Top = item1.Top - item2.Height - spacingBuffer;
1037
+ }
1038
+ }
1039
+ changed = true;
1040
+ }
1041
+ }
1042
+ const relevantConnections = diagram.Connections.filter(conn => conn.Source.ParentDiagramItem.ID === item1.ID || conn.Sink.ParentDiagramItem.ID === item1.ID);
1043
+ for (const connection of relevantConnections) {
1044
+ const sourceItem = itemsForIteration.find(it => it.ID === connection.Source.ParentDiagramItem.ID);
1045
+ const sinkItem = itemsForIteration.find(it => it.ID === connection.Sink.ParentDiagramItem.ID);
1046
+ if (!sourceItem || !sinkItem)
1047
+ continue;
1048
+ const sourceCenterX = sourceItem.Left + sourceItem.Width / 2;
1049
+ const sourceCenterY = sourceItem.Top + sourceItem.Height / 2;
1050
+ const sinkCenterX = sinkItem.Left + sinkItem.Width / 2;
1051
+ const sinkCenterY = sinkItem.Top + sinkItem.Height / 2;
1052
+ if (Math.abs(sourceCenterY - sinkCenterY) < alignmentThreshold) {
1053
+ if (sourceItem.ID === item1.ID && Math.abs(sourceCenterY - sinkCenterY) > 0) {
1054
+ item1.Top = sinkCenterY - item1.Height / 2;
1055
+ changed = true;
1056
+ }
1057
+ else if (sinkItem.ID === item1.ID && Math.abs(sourceCenterY - sinkCenterY) > 0) {
1058
+ item1.Top = sourceCenterY - item1.Height / 2;
1059
+ changed = true;
1060
+ }
1061
+ }
1062
+ if (Math.abs(sourceCenterX - sinkCenterX) < alignmentThreshold) {
1063
+ if (sourceItem.ID === item1.ID && Math.abs(sourceCenterX - sinkCenterX) > 0) {
1064
+ item1.Left = sinkCenterX - item1.Width / 2;
1065
+ changed = true;
1066
+ }
1067
+ else if (sinkItem.ID === item1.ID && Math.abs(sourceCenterX - sinkCenterX) > 0) {
1068
+ item1.Left = sourceCenterX - item1.Width / 2;
1069
+ changed = true;
1070
+ }
1071
+ }
1072
+ }
1073
+ }
1074
+ newDiagramItems = itemsForIteration;
1075
+ iteration++;
1076
+ }
1077
+ let minLeft = Infinity;
1078
+ let minTop = Infinity;
1079
+ const minimumPadding = 50;
1080
+ newDiagramItems.forEach(item => {
1081
+ minLeft = Math.min(minLeft, item.Left);
1082
+ minTop = Math.min(minTop, item.Top);
1083
+ });
1084
+ const offsetX = (minLeft < minimumPadding) ? minimumPadding - minLeft : 0;
1085
+ const offsetY = (minTop < minimumPadding) ? minimumPadding - minTop : 0;
1086
+ if (offsetX > 0 || offsetY > 0) {
1087
+ newDiagramItems = newDiagramItems.map(item => ({
1088
+ ...item,
1089
+ Left: item.Left + offsetX,
1090
+ Top: item.Top + offsetY,
1091
+ }));
1092
+ }
1093
+ return { ...diagram, DiagramItems: newDiagramItems };
1094
+ };
1095
+ const getAdjustedAndRecalculatedDiagram = useCallback((diagramToProcess) => {
1096
+ // Aggiusta le posizioni degli elementi
1097
+ const adjustedItemsDiagram = autoAdjustDiagram(diagramToProcess);
1098
+ // Ricalcola le connessioni basandosi sulle nuove posizioni
1099
+ const diagramItemsMap = new Map(adjustedItemsDiagram.DiagramItems.map(item => [item.ID, item]));
1100
+ const adjustedConnections = adjustedItemsDiagram.Connections.map(conn => {
1101
+ const sourceItem = diagramItemsMap.get(conn.Source.ParentDiagramItem.ID);
1102
+ const sinkItem = diagramItemsMap.get(conn.Sink.ParentDiagramItem.ID);
1103
+ if (sourceItem && sinkItem) {
1104
+ const { path, sinkArrowAngle } = calculateConnectionPath(conn, sourceItem, sinkItem);
1105
+ const finalSinkArrowSymbol = conn.SinkArrowSymbol === ArrowSymbol.None ? ArrowSymbol.Arrow : conn.SinkArrowSymbol;
1106
+ return { ...conn, PathGeometry: path, sinkArrowAngle: sinkArrowAngle, SinkArrowSymbol: finalSinkArrowSymbol };
1107
+ }
1108
+ return conn;
1109
+ });
1110
+ // Ritorna l'oggetto diagramma finale e completo
1111
+ return { ...adjustedItemsDiagram, Connections: adjustedConnections };
1112
+ }, [calculateConnectionPath]);
1113
+ const handleAutoAdjust = useCallback(() => {
1114
+ if (isReadOnly || !wfDiagram)
1115
+ return;
1116
+ const finalDiagram = getAdjustedAndRecalculatedDiagram(wfDiagram);
1117
+ updateDiagram(finalDiagram, false);
1118
+ }, [wfDiagram, isReadOnly, updateDiagram, getAdjustedAndRecalculatedDiagram]);
1119
+ const handleMouseDown = useCallback((event) => {
1120
+ if (isReadOnly)
1121
+ return;
1122
+ if (event.target === svgRef.current) {
1123
+ setSelectedItems(new Set());
1124
+ setSelectedConnections(new Set());
1125
+ setIsDrawingSelectionRect(true);
1126
+ setSelectionRectStart({ x: event.nativeEvent.offsetX, y: event.nativeEvent.offsetY });
1127
+ setSelectionRectEnd(null);
1128
+ }
1129
+ }, [isReadOnly]);
1130
+ const handleMouseMove = useCallback((event) => {
1131
+ if (isReadOnly)
1132
+ return;
1133
+ // Questa parte gestisce la transizione da "clic potenziale" a "trascinamento".
1134
+ // Viene eseguita solo se un mousedown è avvenuto ma il drag non è ancora iniziato.
1135
+ if (mouseDownPos && !isDrawingConnection && !isDrawingSelectionRect && !isDraggingFromToolbox && !isDraggingExistingConnectionEndpoint) {
1136
+ const deltaX = Math.abs(event.nativeEvent.offsetX - mouseDownPos.x);
1137
+ const deltaY = Math.abs(event.nativeEvent.offsetY - mouseDownPos.y);
1138
+ const threshold = 5; // Soglia in pixel.
1139
+ if (deltaX > threshold || deltaY > threshold) {
1140
+ // Se il mouse si è spostato oltre la soglia, inizia il trascinamento del connettore.
1141
+ // L'onMouseDown del connettore ha già impostato tempConnectionSource.
1142
+ if (tempConnectionSource) {
1143
+ setIsDrawingConnection(true);
1144
+ const initialPoint = getConnectionPoint(tempConnectionSource.item, tempConnectionSource.connectorName);
1145
+ setTempConnectionEnd(initialPoint);
1146
+ }
1147
+ }
1148
+ }
1149
+ // Qui inizia la logica principale, che si basa sugli stati già attivi.
1150
+ // L'ordine è importante: il primo `if` che è `true` viene eseguito.
1151
+ if (isDrawingConnection && tempConnectionSource) {
1152
+ // Logica per aggiornare il punto finale della connessione in fase di creazione.
1153
+ setTempConnectionEnd({ x: event.nativeEvent.offsetX, y: event.nativeEvent.offsetY });
1154
+ }
1155
+ else if (isDraggingExistingConnectionEndpoint && draggingConnectionFixedPoint) {
1156
+ // Logica per aggiornare il punto finale di un endpoint esistente.
1157
+ setTempConnectionEnd({ x: event.nativeEvent.offsetX, y: event.nativeEvent.offsetY });
1158
+ }
1159
+ else if (isDrawingSelectionRect && selectionRectStart) {
1160
+ // Logica per disegnare il rettangolo di selezione.
1161
+ const currentX = event.nativeEvent.offsetX;
1162
+ const currentY = event.nativeEvent.offsetY;
1163
+ setSelectionRectEnd({ x: currentX, y: currentY });
1164
+ const rect = {
1165
+ x: Math.min(selectionRectStart.x, currentX),
1166
+ y: Math.min(selectionRectStart.y, currentY),
1167
+ width: Math.abs(selectionRectStart.x - currentX),
1168
+ height: Math.abs(selectionRectStart.y - currentY)
1169
+ };
1170
+ const newSelectedItems = new Set();
1171
+ const newSelectedConnections = new Set();
1172
+ if (wfDiagram) {
1173
+ wfDiagram.DiagramItems.forEach(item => {
1174
+ const itemRect = {
1175
+ x: item.Left * zoomLevel + translateX,
1176
+ y: item.Top * zoomLevel + translateY,
1177
+ width: item.Width * zoomLevel,
1178
+ height: (item.Height + 50) * zoomLevel
1179
+ };
1180
+ if (rect.x < itemRect.x + itemRect.width &&
1181
+ rect.x + rect.width > itemRect.x &&
1182
+ rect.y < itemRect.y + itemRect.height &&
1183
+ rect.y + rect.height > itemRect.y) {
1184
+ newSelectedItems.add(item.ID);
1185
+ }
1186
+ });
1187
+ if (calculatedConnections) {
1188
+ calculatedConnections.forEach(connection => {
1189
+ const sourceItem = wfDiagram.DiagramItems.find(item => item.ID === connection.Source.ParentDiagramItem.ID);
1190
+ const sinkItem = wfDiagram.DiagramItems.find(item => item.ID === connection.Sink.ParentDiagramItem.ID);
1191
+ if (sourceItem && sinkItem) {
1192
+ const sourcePoint = getConnectionPoint(sourceItem, connection.Source.ConnectorName);
1193
+ const sinkPoint = getConnectionPoint(sinkItem, connection.Sink.ConnectorName);
1194
+ // Controlla se almeno uno dei due punti estremi è all'interno del rettangolo
1195
+ if ((sourcePoint.x >= rect.x && sourcePoint.x <= rect.x + rect.width && sourcePoint.y >= rect.y && sourcePoint.y <= rect.y + rect.height) ||
1196
+ (sinkPoint.x >= rect.x && sinkPoint.x <= rect.x + rect.width && sinkPoint.y >= rect.y && sinkPoint.y <= rect.y + rect.height)) {
1197
+ newSelectedConnections.add(connection.ID);
1198
+ }
1199
+ }
1200
+ });
1201
+ }
1202
+ }
1203
+ setSelectedItems(newSelectedItems);
1204
+ setSelectedConnections(newSelectedConnections);
1205
+ }
1206
+ else if (isDraggingFromToolbox && draggedItemType !== null) {
1207
+ // Logica per il trascinamento di un elemento dalla toolbox.
1208
+ setTempConnectionEnd({ x: event.nativeEvent.offsetX, y: event.nativeEvent.offsetY });
1209
+ }
1210
+ }, [isDrawingConnection, tempConnectionSource, isDrawingSelectionRect, selectionRectStart, wfDiagram, zoomLevel, translateX, translateY, isDraggingFromToolbox, draggedItemType, isReadOnly, isDraggingExistingConnectionEndpoint, draggingConnectionFixedPoint, mouseDownPos]);
1211
+ const handleMouseUp = useCallback((event) => {
1212
+ if (isReadOnly)
1213
+ return;
1214
+ if (isDrawingConnection) {
1215
+ // Logica per una nuova connessione, rimane invariata
1216
+ setIsDrawingConnection(false);
1217
+ setTempConnectionSource(null);
1218
+ setTempConnectionEnd(null);
1219
+ }
1220
+ else if (isDraggingExistingConnectionEndpoint) {
1221
+ // Se si stava trascinando un endpoint di connessione esistente e non è stato agganciato
1222
+ // Reset degli stati di trascinamento e ripristino della selezione originale
1223
+ setIsDraggingExistingConnectionEndpoint(false);
1224
+ setDraggingConnectionId(null);
1225
+ setDraggingEndpointType(null);
1226
+ setDraggingConnectionFixedPoint(null);
1227
+ setTempConnectionEnd(null); // Pulisci la linea temporanea
1228
+ // La connessione originale verrà renderizzata di nuovo grazie a calculatedConnections
1229
+ }
1230
+ if (isDrawingSelectionRect) {
1231
+ setIsDrawingSelectionRect(false);
1232
+ setSelectionRectStart(null);
1233
+ setSelectionRectEnd(null);
1234
+ }
1235
+ setIsDraggingFromToolbox(false);
1236
+ setDraggedItemType(null);
1237
+ }, [isDrawingConnection, tempConnectionSource, tempConnectionEnd, isDrawingSelectionRect, selectionRectStart, selectionRectEnd, wfDiagram, zoomLevel, translateX, translateY, isReadOnly, isDraggingExistingConnectionEndpoint, draggingConnectionId, draggingEndpointType, draggingConnectionFixedPoint]);
1238
+ const handleDiagramItemClick = useCallback((id, event) => {
1239
+ if (isReadOnly)
1240
+ return;
1241
+ event.stopPropagation();
1242
+ const isCtrlPressed = event.ctrlKey || event.metaKey;
1243
+ setSelectedItems(prev => {
1244
+ const newSelection = new Set(prev);
1245
+ if (isCtrlPressed) {
1246
+ if (newSelection.has(id)) {
1247
+ newSelection.delete(id);
1248
+ }
1249
+ else {
1250
+ newSelection.add(id);
1251
+ }
1252
+ }
1253
+ else {
1254
+ newSelection.clear();
1255
+ newSelection.add(id);
1256
+ }
1257
+ return newSelection;
1258
+ });
1259
+ if (!isCtrlPressed)
1260
+ setSelectedConnections(new Set());
1261
+ }, [isReadOnly]);
1262
+ const handleConnectionClick = useCallback((id, event) => {
1263
+ if (isReadOnly)
1264
+ return;
1265
+ event.stopPropagation();
1266
+ const isCtrlPressed = event.ctrlKey || event.metaKey;
1267
+ setSelectedConnections(prev => {
1268
+ const newSelection = new Set(prev);
1269
+ if (isCtrlPressed) {
1270
+ if (newSelection.has(id)) {
1271
+ newSelection.delete(id);
1272
+ }
1273
+ else {
1274
+ newSelection.add(id);
1275
+ }
1276
+ }
1277
+ else {
1278
+ newSelection.clear();
1279
+ newSelection.add(id);
1280
+ }
1281
+ return newSelection;
1282
+ });
1283
+ if (!isCtrlPressed)
1284
+ setSelectedItems(new Set());
1285
+ }, [isReadOnly]);
1286
+ const handleDrag = useCallback((id, newX, newY) => {
1287
+ if (isReadOnly)
1288
+ return;
1289
+ setWfDiagram(prevDiagram => {
1290
+ if (!prevDiagram)
1291
+ return null;
1292
+ return {
1293
+ ...prevDiagram,
1294
+ DiagramItems: prevDiagram.DiagramItems.map(item => item.ID === id ? { ...item, Left: newX, Top: newY } : item),
1295
+ };
1296
+ });
1297
+ }, [isReadOnly]);
1298
+ const handleDragEnd = useCallback((id, finalX, finalY) => {
1299
+ if (isReadOnly)
1300
+ return;
1301
+ setWfDiagram(prevDiagram => {
1302
+ if (!prevDiagram)
1303
+ return null;
1304
+ const updatedDiagram = {
1305
+ ...prevDiagram,
1306
+ DiagramItems: prevDiagram.DiagramItems.map(item => item.ID === id ? { ...item, Left: finalX, Top: finalY } : item),
1307
+ };
1308
+ updateDiagram(updatedDiagram);
1309
+ return updatedDiagram;
1310
+ });
1311
+ }, [updateDiagram, isReadOnly]);
1312
+ const handleConnectorMouseDown = useCallback((itemId, connectorName, event) => {
1313
+ if (isReadOnly || !wfDiagram)
1314
+ return;
1315
+ event.stopPropagation();
1316
+ // Salva la posizione iniziale del mouse.
1317
+ setMouseDownPos({ x: event.clientX, y: event.clientY });
1318
+ // Imposta il connettore di partenza per un potenziale drag.
1319
+ setTempConnectionSource({ item: wfDiagram.DiagramItems.find(i => i.ID === itemId), connectorName });
1320
+ // NON avviare il drag qui. Lo faremo in base al movimento del mouse.
1321
+ }, [wfDiagram, isReadOnly]);
1322
+ const handleConnectionEndpointMouseDown = useCallback((connectionId, endpointType, event) => {
1323
+ if (isReadOnly)
1324
+ return;
1325
+ event.stopPropagation();
1326
+ setIsDraggingExistingConnectionEndpoint(true);
1327
+ setDraggingConnectionId(connectionId);
1328
+ setDraggingEndpointType(endpointType);
1329
+ // Trova la connessione e l'item all'altra estremità per impostare il punto fisso
1330
+ const connection = wfDiagram?.Connections.find(conn => conn.ID === connectionId);
1331
+ if (connection) {
1332
+ let fixedItem;
1333
+ let fixedConnectorName;
1334
+ if (endpointType === 'source') {
1335
+ // Se trascino la sorgente, il sink è fisso
1336
+ fixedItem = wfDiagram?.DiagramItems.find(item => item.ID === connection.Sink.ParentDiagramItem.ID);
1337
+ fixedConnectorName = connection.Sink.ConnectorName;
1338
+ }
1339
+ else {
1340
+ // Se trascino il sink, la sorgente è fissa
1341
+ fixedItem = wfDiagram?.DiagramItems.find(item => item.ID === connection.Source.ParentDiagramItem.ID);
1342
+ fixedConnectorName = connection.Source.ConnectorName;
1343
+ }
1344
+ if (fixedItem) {
1345
+ setDraggingConnectionFixedPoint(getConnectionPoint(fixedItem, fixedConnectorName));
1346
+ }
1347
+ }
1348
+ setTempConnectionEnd({ x: event.nativeEvent.offsetX, y: event.nativeEvent.offsetY });
1349
+ }, [wfDiagram, isReadOnly]);
1350
+ const handleConnectorMouseUp = useCallback((targetItemId, targetConnectorName) => {
1351
+ if (isReadOnly)
1352
+ return;
1353
+ // Se isDrawingConnection è false, significa che il mouseup è avvenuto
1354
+ // prima che il drag fosse avviato (cioè, il mouse non si è mosso oltre la soglia).
1355
+ // Questo è un "clic".
1356
+ if (!isDrawingConnection && !isDraggingExistingConnectionEndpoint) {
1357
+ // Il drag non è iniziato, pulisci solo lo stato di partenza.
1358
+ setMouseDownPos(null);
1359
+ setTempConnectionSource(null);
1360
+ return;
1361
+ }
1362
+ if (isDrawingConnection && tempConnectionSource && wfDiagram) {
1363
+ const sourceItem = tempConnectionSource.item;
1364
+ let outputStatus = WorkItemStatus.New;
1365
+ if (sourceItem.Type === DiagramItemTypes.Condition || sourceItem.Type === DiagramItemTypes.Approval) {
1366
+ const existingConnectionsFromSource = wfDiagram.Connections.filter(conn => conn.Source.ParentDiagramItem.ID === sourceItem.ID);
1367
+ if (existingConnectionsFromSource.length === 0) {
1368
+ outputStatus = WorkItemStatus.Completed;
1369
+ }
1370
+ else if (existingConnectionsFromSource.length === 1) {
1371
+ outputStatus = WorkItemStatus.Rejected;
1372
+ }
1373
+ }
1374
+ const newConnection = {
1375
+ ID: generateUUID(),
1376
+ Source: { ParentDiagramItem: { ID: tempConnectionSource.item.ID }, ConnectorName: tempConnectionSource.connectorName },
1377
+ Sink: { ParentDiagramItem: { ID: targetItemId }, ConnectorName: targetConnectorName },
1378
+ OutputStatus: outputStatus,
1379
+ Description: "",
1380
+ PathGeometry: "",
1381
+ SourceArrowSymbol: ArrowSymbol.None,
1382
+ SinkArrowSymbol: ArrowSymbol.Arrow,
1383
+ };
1384
+ const updatedDiagram = {
1385
+ ...wfDiagram,
1386
+ Connections: [...wfDiagram.Connections, newConnection],
1387
+ };
1388
+ updateDiagram(updatedDiagram);
1389
+ }
1390
+ else if (isDraggingExistingConnectionEndpoint && draggingConnectionId && draggingEndpointType && wfDiagram) {
1391
+ // Logica per la riconnessione di un endpoint esistente
1392
+ const updatedConnections = wfDiagram.Connections.map(conn => {
1393
+ if (conn.ID === draggingConnectionId) {
1394
+ if (draggingEndpointType === 'source') {
1395
+ return {
1396
+ ...conn,
1397
+ Source: { ParentDiagramItem: { ID: targetItemId }, ConnectorName: targetConnectorName },
1398
+ };
1399
+ }
1400
+ else { // 'sink'
1401
+ return {
1402
+ ...conn,
1403
+ Sink: { ParentDiagramItem: { ID: targetItemId }, ConnectorName: targetConnectorName },
1404
+ };
1405
+ }
1406
+ }
1407
+ return conn;
1408
+ });
1409
+ const updatedDiagram = {
1410
+ ...wfDiagram,
1411
+ Connections: updatedConnections,
1412
+ };
1413
+ updateDiagram(updatedDiagram);
1414
+ // Resetta tutti gli stati di trascinamento dell'endpoint
1415
+ setIsDraggingExistingConnectionEndpoint(false);
1416
+ setDraggingConnectionId(null);
1417
+ setDraggingEndpointType(null);
1418
+ setDraggingConnectionFixedPoint(null);
1419
+ setTempConnectionEnd(null);
1420
+ }
1421
+ setIsDrawingConnection(false);
1422
+ setTempConnectionSource(null);
1423
+ setTempConnectionEnd(null);
1424
+ setMouseDownPos(null);
1425
+ }, [isDrawingConnection, tempConnectionSource, wfDiagram, updateDiagram, isReadOnly, isDraggingExistingConnectionEndpoint, draggingConnectionId, draggingEndpointType, draggingConnectionFixedPoint]);
1426
+ const handleDragOver = useCallback((event) => {
1427
+ if (isReadOnly) {
1428
+ event.preventDefault();
1429
+ return;
1430
+ }
1431
+ event.preventDefault();
1432
+ }, [isReadOnly]);
1433
+ const handleDropOnCanvas = useCallback(async (event) => {
1434
+ if (isReadOnly)
1435
+ return;
1436
+ event.preventDefault();
1437
+ if (isDraggingFromToolbox && draggedItemType !== null && wfDiagram) {
1438
+ const svgRect = svgRef.current?.getBoundingClientRect();
1439
+ if (!svgRect)
1440
+ return;
1441
+ const x = (event.clientX - svgRect.left) / zoomLevel;
1442
+ const y = (event.clientY - svgRect.top) / zoomLevel;
1443
+ let newQD = undefined;
1444
+ if (draggedItemType === DiagramItemTypes.Condition) {
1445
+ newQD = SearchEngine.NewQueryDescriptor();
1446
+ if (newQD.from)
1447
+ newQD.from.tid = wfDiagram.Info?.MTID;
1448
+ }
1449
+ let statusProps = {};
1450
+ if (draggedItemType === DiagramItemTypes.Status && wfDiagram.Info?.MStatusDLID) {
1451
+ try {
1452
+ const statusDataList = await DataListCacheService.GetAsync(wfDiagram.Info.MStatusDLID);
1453
+ if (statusDataList && statusDataList.items && statusDataList.items.length > 0) {
1454
+ const firstItem = statusDataList.items[0];
1455
+ statusProps = {
1456
+ ItemName: firstItem.name || `New ${DiagramItemTypes[draggedItemType]}`,
1457
+ StatusValue: firstItem.value
1458
+ };
1459
+ }
1460
+ }
1461
+ catch (error) {
1462
+ console.error("Errore nel recuperare la DataList per lo stato:", error);
1463
+ TMExceptionBoxManager.show({ exception: new Error("Impossibile caricare i valori per lo stato.") });
1464
+ }
1465
+ }
1466
+ const newItem = {
1467
+ ID: generateUUID(),
1468
+ Left: x - 50,
1469
+ Top: y - 50,
1470
+ Width: 64,
1471
+ Height: 64,
1472
+ Type: draggedItemType,
1473
+ ItemName: `New ${DiagramItemTypes[draggedItemType]}`,
1474
+ Description: "",
1475
+ ...(draggedItemType === DiagramItemTypes.Condition ? { QD: newQD } : {}),
1476
+ ...(draggedItemType === DiagramItemTypes.RunApp || draggedItemType === DiagramItemTypes.ExecTask ? { AppType: WFAppTypes.EXE, FormatCultureID: CultureIDs.It_IT } : {}),
1477
+ ...statusProps,
1478
+ };
1479
+ const updatedDiagram = {
1480
+ ...wfDiagram,
1481
+ DiagramItems: [...wfDiagram.DiagramItems, newItem],
1482
+ };
1483
+ updateDiagram(updatedDiagram);
1484
+ setIsDraggingFromToolbox(false);
1485
+ setDraggedItemType(null);
1486
+ }
1487
+ }, [isDraggingFromToolbox, draggedItemType, wfDiagram, updateDiagram, zoomLevel, isReadOnly]);
1488
+ const currentSelectionRect = useMemo(() => {
1489
+ if (isDrawingSelectionRect && selectionRectStart && selectionRectEnd) {
1490
+ const x = Math.min(selectionRectStart.x, selectionRectEnd.x);
1491
+ const y = Math.min(selectionRectStart.y, selectionRectEnd.y);
1492
+ const width = Math.abs(selectionRectStart.x - selectionRectEnd.x);
1493
+ const height = Math.abs(selectionRectStart.y - selectionRectEnd.y);
1494
+ return { x, y, width, height };
1495
+ }
1496
+ return null;
1497
+ }, [isDrawingSelectionRect, selectionRectStart, selectionRectEnd]);
1498
+ const handleToolboxDragStart = useCallback((event, itemType) => {
1499
+ if (isReadOnly) {
1500
+ event.preventDefault();
1501
+ return;
1502
+ }
1503
+ setIsDraggingFromToolbox(true);
1504
+ setDraggedItemType(itemType);
1505
+ event.dataTransfer.setData("text/plain", itemType.toString());
1506
+ }, [isReadOnly]);
1507
+ const handleToolboxDragEnd = () => {
1508
+ if (isReadOnly)
1509
+ return;
1510
+ setIsDraggingFromToolbox(false);
1511
+ setDraggedItemType(null);
1512
+ };
1513
+ const handleItemDimensionsChange = useCallback((itemId, width, height) => {
1514
+ setWfDiagram(prevDiagram => {
1515
+ if (!prevDiagram)
1516
+ return null;
1517
+ const updatedDiagram = {
1518
+ ...prevDiagram,
1519
+ DiagramItems: prevDiagram.DiagramItems.map(item => item.ID === itemId ? { ...item, Width: width, Height: height } : item),
1520
+ };
1521
+ updateDiagram(updatedDiagram);
1522
+ return updatedDiagram;
1523
+ });
1524
+ }, []);
1525
+ const handleUpdateDiagramItem = useCallback((updatedItem) => {
1526
+ if (!wfDiagram)
1527
+ return;
1528
+ const updatedDiagramItems = wfDiagram.DiagramItems.map(item => {
1529
+ if (item.ID === updatedItem.ID) {
1530
+ return updatedItem;
1531
+ }
1532
+ return item;
1533
+ });
1534
+ const newDiagram = { ...wfDiagram, DiagramItems: updatedDiagramItems };
1535
+ updateDiagram(newDiagram);
1536
+ }, [wfDiagram, updateDiagram]);
1537
+ const handleUpdateConnection = useCallback((updatedConnection) => {
1538
+ setWfDiagram(prevDiagram => {
1539
+ if (!prevDiagram)
1540
+ return null;
1541
+ const updatedConnections = prevDiagram.Connections.map(conn => {
1542
+ if (conn.ID === updatedConnection.ID) {
1543
+ return updatedConnection;
1544
+ }
1545
+ return conn;
1546
+ });
1547
+ const newDiagram = { ...prevDiagram, Connections: updatedConnections };
1548
+ updateDiagram(newDiagram);
1549
+ return newDiagram;
1550
+ });
1551
+ }, [updateDiagram]);
1552
+ const availableItemTypes = useMemo(() => {
1553
+ return [
1554
+ DiagramItemTypes.Approval,
1555
+ DiagramItemTypes.Condition,
1556
+ DiagramItemTypes.Exit,
1557
+ DiagramItemTypes.Status,
1558
+ // DiagramItemTypes.DataEntry,
1559
+ DiagramItemTypes.ExecTask,
1560
+ DiagramItemTypes.UpdateDcmt,
1561
+ DiagramItemTypes.RunApp,
1562
+ DiagramItemTypes.Notification,
1563
+ DiagramItemTypes.WorkGroup_Create,
1564
+ DiagramItemTypes.WorkGroup_AddParts,
1565
+ DiagramItemTypes.CaseFlow_Create,
1566
+ DiagramItemTypes.CaseFlow_AddParts,
1567
+ // DiagramItemTypes.SignAndTimeStamp
1568
+ ];
1569
+ }, []);
1570
+ const toggleReadOnlyMode = useCallback(() => {
1571
+ if (isReadOnly) {
1572
+ setIsReadOnly(false);
1573
+ return;
1574
+ }
1575
+ // Condizione per mostrare il messaggio di conferma
1576
+ const hasPendingState = wfDiagramHistory.length > 1 || selectedItems.size > 0 || selectedConnections.size > 0;
1577
+ if (hasPendingState) {
1578
+ TMMessageBoxManager.show({
1579
+ title: "Progettazione diagramma",
1580
+ message: "Attenzione: Stai uscendo dalla modalità di progettazione. Tutte le selezioni attive verranno annullate. Vuoi continuare?",
1581
+ buttons: [ButtonNames.YES, ButtonNames.NO],
1582
+ onButtonClick: async (e) => {
1583
+ try {
1584
+ if (e !== ButtonNames.YES)
1585
+ return;
1586
+ setIsReadOnly(true);
1587
+ setSelectedItems(new Set());
1588
+ setSelectedConnections(new Set());
1589
+ }
1590
+ catch (error) {
1591
+ console.error("Errore nel cambio modalità:", error);
1592
+ }
1593
+ }
1594
+ });
1595
+ }
1596
+ else {
1597
+ // Nessuna modifica pendente o elemento selezionato, cambia direttamente
1598
+ setIsReadOnly(true);
1599
+ }
1600
+ }, [isReadOnly, wfDiagramHistory, selectedItems, selectedConnections]);
1601
+ const toggleFullScreenMode = useCallback(() => {
1602
+ setIsFullScreen(prev => !prev);
1603
+ }, []);
1604
+ const handleZoomIn = useCallback(() => {
1605
+ setZoomLevel(prev => Math.min(prev + 0.1, 2.0)); // Limite max a 2.0
1606
+ }, []);
1607
+ const handleZoomOut = useCallback(() => {
1608
+ setZoomLevel(prev => Math.max(prev - 0.1, 0.5)); // Limite min a 0.5
1609
+ }, []);
1610
+ const formattedZoomLevel = useMemo(() => {
1611
+ return `${Math.round(zoomLevel * 100)}%`;
1612
+ }, [zoomLevel]);
1613
+ useEffect(() => {
1614
+ // Se l'XML che ho appena ricevuto (xmlDiagramString) è lo stesso che ho notificato al genitore,
1615
+ // significa che la modifica è partita da me ed è solo un ciclo di riconciliazione.
1616
+ if (xmlDiagramString && notifiedXmlRef.current === xmlDiagramString) {
1617
+ notifiedXmlRef.current = null;
1618
+ return;
1619
+ }
1620
+ // se undo/redo, il `xmlDiagramString` è cambiato ma la storia non deve essere resettata.
1621
+ if (isUndoingRedoing.current) {
1622
+ isUndoingRedoing.current = false;
1623
+ return;
1624
+ }
1625
+ setIsLoading(true);
1626
+ try {
1627
+ let initialDiagram = xmlDiagramString ? parseWfDiagramXml(xmlDiagramString) : null;
1628
+ if (initialDiagram) {
1629
+ const finalDiagram = getAdjustedAndRecalculatedDiagram(initialDiagram);
1630
+ // Aggiungi un controllo per evitare di resettare la storia se il diagramma è lo stesso.
1631
+ if (JSON.stringify(wfDiagram) !== JSON.stringify(finalDiagram)) {
1632
+ setWfDiagram(finalDiagram);
1633
+ initialDiagramRef.current = finalDiagram;
1634
+ setWfDiagramHistory([finalDiagram]);
1635
+ setHistoryIndex(0);
1636
+ }
1637
+ }
1638
+ else {
1639
+ setWfDiagram(null);
1640
+ initialDiagramRef.current = null;
1641
+ setWfDiagramHistory([]);
1642
+ setHistoryIndex(-1);
1643
+ }
1644
+ }
1645
+ catch (error) {
1646
+ console.error("Errore durante l'elaborazione del diagramma:", error);
1647
+ setWfDiagram(null);
1648
+ }
1649
+ finally {
1650
+ setIsLoading(false);
1651
+ }
1652
+ }, [xmlDiagramString, getAdjustedAndRecalculatedDiagram]);
1653
+ useEffect(() => {
1654
+ if (isUndoingRedoing.current) {
1655
+ isUndoingRedoing.current = false;
1656
+ }
1657
+ }, [wfDiagram]);
1658
+ const handleCanvasDoubleClick = useCallback((event) => {
1659
+ if (isReadOnly) {
1660
+ toggleReadOnlyMode();
1661
+ }
1662
+ }, [isReadOnly, toggleReadOnlyMode]);
1663
+ const diagramContent = (_jsxs(CanvasContainer, { onDoubleClick: handleCanvasDoubleClick, children: [_jsx("input", { ref: fileInputRef, type: "file", accept: ".xml" // Filtra per file XML
1664
+ , onChange: handleFileChange, style: { display: 'none' } }), _jsxs(ToolbarContainer, { "$isCollapsed": isToolbarCollapsed, "$isFloating": isToolbarFloating, "$isToolboxVisible": isToolboxVisible, "$isReadOnly": isReadOnly, children: [allowEdit && _jsx(ButtonGroup, { "$isFloating": isToolbarFloating, children: _jsxs("button", { onClick: toggleReadOnlyMode, title: isReadOnly ? SDKUI_Localizator.Design : SDKUI_Localizator.ReadOnly, children: [isReadOnly ? _jsx(IconPencil, {}) : _jsx(IconLock, {}), !isToolbarCollapsed && _jsx("span", { children: isReadOnly ? SDKUI_Localizator.Design : SDKUI_Localizator.ReadOnly })] }) }), allowEdit && _jsxs(ButtonGroup, { "$isFloating": isToolbarFloating, children: [!isReadOnly && _jsxs("button", { onClick: handleToggleToolboxVisibility, title: SDKUI_Localizator.ShowToolbox, children: [_jsx(IconFlowChart, {}), !isToolbarCollapsed && _jsx("span", { children: SDKUI_Localizator.ShowToolboxToggle })] }), _jsxs("button", { onClick: toggleFullScreenMode, title: SDKUI_Localizator.ShowFullScreen, children: [isFullScreen ? _jsx(IconWindowMinimize, {}) : _jsx(IconWindowMaximize, {}), !isToolbarCollapsed && _jsx("span", { children: SDKUI_Localizator.ShowFullScreen })] })] }), _jsxs(ButtonGroup, { "$isFloating": isToolbarFloating, children: [_jsxs("button", { onClick: handleZoomIn, title: SDKUI_Localizator.ZoomIn, children: [_jsx(IconZoomIn, {}), !isToolbarCollapsed && _jsx("span", { children: SDKUI_Localizator.ZoomIn })] }), _jsxs("button", { onClick: handleZoomOut, title: SDKUI_Localizator.ZoomOut, children: [_jsx(IconZoomOut, {}), !isToolbarCollapsed && _jsx("span", { children: SDKUI_Localizator.ZoomOut })] }), _jsx(ZoomLevelText, { "$isFloating": isToolbarFloating, "$isCollapsed": isToolbarCollapsed, children: formattedZoomLevel })] }), !isReadOnly && _jsxs(ButtonGroup, { "$isFloating": isToolbarFloating, children: [_jsxs("button", { onClick: handleUndo, disabled: historyIndex === 0, title: SDKUI_Localizator.Undo, children: [_jsx(IconUndo, {}), " ", !isToolbarCollapsed && _jsx("span", { children: SDKUI_Localizator.Undo })] }), _jsxs("button", { onClick: handleRedo, disabled: historyIndex === wfDiagramHistory.length - 1, title: SDKUI_Localizator.Redo, children: [_jsx(IconUndo, { style: { transform: 'scaleX(-1)' } }), " ", !isToolbarCollapsed && _jsx("span", { children: SDKUI_Localizator.Redo })] }), _jsxs("button", { onClick: handleRestore, title: SDKUI_Localizator.Restore, children: [_jsx(IconRestore, {}), " ", !isToolbarCollapsed && _jsx("span", { children: SDKUI_Localizator.Restore })] }), _jsxs("button", { onClick: handleNew, title: SDKUI_Localizator.DiagramNew, disabled: isReadOnly, children: [_jsx(IconNew, {}), " ", !isToolbarCollapsed && _jsx("span", { children: SDKUI_Localizator.DiagramNew })] }), _jsxs("button", { onClick: handleExportDiagram, disabled: isReadOnly || !wfDiagram, title: SDKUI_Localizator.Export, children: [_jsx(IconExport, {}), _jsx("span", { children: SDKUI_Localizator.Export })] }), _jsxs("button", { onClick: handleImportDiagramClick, disabled: isReadOnly, title: SDKUI_Localizator.Import, children: [_jsx(IconImport, {}), _jsx("span", { children: SDKUI_Localizator.Import })] })] }), !isReadOnly && _jsx(ButtonGroup, { "$isFloating": isToolbarFloating, children: _jsxs("button", { onClick: handleAutoAdjust, title: SDKUI_Localizator.AutoAdjust, children: [_jsx(IconAdjust, {}), " ", !isToolbarCollapsed && _jsx("span", { children: SDKUI_Localizator.AutoAdjust })] }) }), !isReadOnly && _jsxs(ButtonGroup, { "$isFloating": isToolbarFloating, children: [_jsxs("button", { onClick: handleCopy, disabled: selectedItems.size === 0, title: SDKUI_Localizator.Copy, children: [_jsx(IconCopy, {}), " ", !isToolbarCollapsed && _jsx("span", { children: SDKUI_Localizator.Copy })] }), _jsxs("button", { onClick: handleCut, disabled: selectedItems.size === 0, title: SDKUI_Localizator.Cut, children: [_jsx(IconCut, {}), " ", !isToolbarCollapsed && _jsx("span", { children: SDKUI_Localizator.Cut })] }), _jsxs("button", { onClick: handlePaste, disabled: copiedItems.length === 0 && copiedConnections.length === 0, title: SDKUI_Localizator.Paste, children: [_jsx(IconPaste, {}), " ", !isToolbarCollapsed && _jsx("span", { children: SDKUI_Localizator.Paste })] })] }), allowEdit && _jsxs("button", { onClick: handleToggleToolbarMode, title: isToolbarFloating ? SDKUI_Localizator.ToolbarDock : SDKUI_Localizator.ToolbarFloat, children: [isToolbarFloating ? _jsx(IconPin, {}) : _jsx(IconUnpin, {}), !isToolbarCollapsed && !isToolbarFloating && _jsx("span", { children: SDKUI_Localizator.ToggleMode })] }), !isToolbarFloating && _jsx(ToolbarToggle, { onClick: () => setIsToolbarCollapsed(!isToolbarCollapsed), title: isToolbarCollapsed ? SDKUI_Localizator.ToolbarExpand : SDKUI_Localizator.ToolbarCollapse, children: isToolbarCollapsed ? _jsx(IconChevronRight, {}) : _jsx(IconCloseOutline, {}) })] }), !isReadOnly && (_jsx(ToolboxContainer, { "$isVisible": isToolboxVisible, children: isToolboxVisible && availableItemTypes.map(type => (_jsxs(ToolboxItem, { draggable: true, onDragStart: (e) => handleToolboxDragStart(e, type), onDragEnd: handleToolboxDragEnd, children: [_jsx(ToolboxIconWrapper, { children: _jsx(DiagramItemSvgContent, { itemType: type, width: 38, height: 38, isToolboxPreview: true }) }), _jsx("span", { children: LocalizeDiagramItemType(type) })] }, type))) })), _jsx(SvgScrollContainer, { children: isLoading ?
1665
+ (_jsxs(StyledLoadingContainer, { children: [_jsx(StyledSpinner, {}), _jsx("span", { children: `${'Caricamento diagramma'}...` })] })) : wfDiagram ? (_jsx(StyledSvg, { ref: svgRef, tabIndex: 0, onKeyDownCapture: handleKeyDown, onMouseMove: handleMouseMove, onMouseUp: handleMouseUp, onMouseDown: handleMouseDown, onDrop: handleDropOnCanvas, onDragOver: handleDragOver, width: svgWidth, height: svgHeight, children: _jsxs(ScalableGroup, { "$scale": zoomLevel, "$translateX": translateX, "$translateY": translateY, children: [wfDiagram?.DiagramItems.map(item => (_jsx(DiagramItemComponent, { wf: wfDiagram?.Info, readOnly: isReadOnly, item: item, isSelected: selectedItems.has(item.ID), isCurrent: item.ID === currentSetID, onClick: handleDiagramItemClick, onDrag: handleDrag, onDragEnd: handleDragEnd, onConnectorMouseDown: handleConnectorMouseDown, onConnectorMouseUp: handleConnectorMouseUp, onDimensionsChange: handleItemDimensionsChange, onDoubleClick: handleDoubleClickItem }, item.ID))), calculatedConnections.map(connection => {
1666
+ const sourceItem = wfDiagram?.DiagramItems.find(item => item.ID === connection.Source.ParentDiagramItem.ID);
1667
+ const sinkItem = wfDiagram?.DiagramItems.find(item => item.ID === connection.Sink.ParentDiagramItem.ID);
1668
+ if (!sourceItem || !sinkItem)
1669
+ return null;
1670
+ // Calcola i punti di origine e destinazione della connessione
1671
+ const sourcePoint = getConnectionPoint(sourceItem, connection.Source.ConnectorName);
1672
+ const sinkPoint = getConnectionPoint(sinkItem, connection.Sink.ConnectorName);
1673
+ // Determina se questa è la connessione che stiamo trascinando
1674
+ const isThisConnectionBeingDragged = isDraggingExistingConnectionEndpoint && draggingConnectionId === connection.ID;
1675
+ return (_jsx(ConnectionComponent, { connection: connection, isSelected: selectedConnections.has(connection.ID), sourcePoint: sourcePoint, sinkPoint: sinkPoint, isTemporary: isThisConnectionBeingDragged, onClick: handleConnectionClick, onDoubleClick: handleDoubleClickConnection, onConnectionEndpointMouseDown: handleConnectionEndpointMouseDown }, connection.ID));
1676
+ }), isDrawingConnection && tempConnectionPathData && (_jsx(TempConnectionPath, { d: tempConnectionPathData })), isDraggingExistingConnectionEndpoint && tempConnectionPathData && (_jsx(TempConnectionPath, { d: tempConnectionPathData })), isDrawingSelectionRect && currentSelectionRect && (_jsx(SelectionRect, { x: currentSelectionRect.x, y: currentSelectionRect.y, width: currentSelectionRect.width, height: currentSelectionRect.height }))] }) })) : (_jsx(DiagramMessage, { children: `${SDKUI_Localizator.WorkflowDiagramMissingOrInvalid} ...` })) }), isModalOpen && itemToEdit && (_jsx(DiagramItemForm, { itemToEdit: itemToEdit, wf: wfDiagram?.Info, onClose: handleCloseModal, onApply: handleUpdateDiagramItem })), isConnectionModalOpen && connectionToEdit && (_jsx(ConnectionForm, { connectionToEdit: connectionToEdit, onClose: () => setIsConnectionModalOpen(false), onApply: handleUpdateConnection }))] }));
1677
+ const diagramRef = useRef(null);
1678
+ return (_jsxs(_Fragment, { children: [!isFullScreen && (_jsx(DiagramWrapper, { ref: diagramRef, children: diagramContent })), isFullScreen && ReactDOM.createPortal(_jsx(FullScreenContainer, { children: diagramContent }), document.body)] }));
1679
+ };
1680
+ export default WFDiagram;