@opentiny/vue-renderless 3.10.7 → 3.11.0

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 (800) hide show
  1. package/action-menu/index.js +1 -1
  2. package/action-menu/vue.js +7 -9
  3. package/action-sheet/index.js +4 -1
  4. package/action-sheet/vue.js +1 -1
  5. package/alert/index.js +1 -1
  6. package/alert/vue.js +1 -1
  7. package/amount/index.js +1 -1
  8. package/amount/vue.js +1 -1
  9. package/anchor/index.js +39 -28
  10. package/anchor/vue.js +38 -10
  11. package/area/index.js +1 -1
  12. package/area/vue.js +1 -1
  13. package/async-flowchart/index.js +66 -0
  14. package/async-flowchart/vue.js +40 -0
  15. package/autocomplete/index.js +1 -1
  16. package/autocomplete/vue.js +1 -1
  17. package/autonavi-map/index.js +1 -1
  18. package/avatar/index.js +1 -1
  19. package/avatar/vue.js +1 -1
  20. package/badge/index.js +1 -1
  21. package/badge/vue.js +1 -1
  22. package/baidu-map/index.js +1 -1
  23. package/breadcrumb/index.js +2 -2
  24. package/breadcrumb/vue.js +2 -1
  25. package/breadcrumb-item/index.js +1 -1
  26. package/breadcrumb-item/vue.js +1 -1
  27. package/bulletin-board/index.js +1 -1
  28. package/bulletin-board/vue.js +1 -1
  29. package/button/index.js +2 -2
  30. package/button/vue.js +2 -2
  31. package/button-group/index.js +2 -2
  32. package/button-group/vue.js +1 -1
  33. package/calendar/index.js +15 -15
  34. package/calendar/vue.js +1 -1
  35. package/calendar-bar/index.js +4 -4
  36. package/calendar-bar/vue.js +1 -1
  37. package/calendar-view/index.js +600 -0
  38. package/calendar-view/vue.js +289 -0
  39. package/card/index.js +1 -1
  40. package/card/vue.js +1 -1
  41. package/card-group/index.js +1 -1
  42. package/card-group/vue.js +1 -1
  43. package/card-template/index.js +1 -1
  44. package/card-template/vue.js +1 -1
  45. package/carousel/index.js +1 -1
  46. package/carousel/vue.js +1 -1
  47. package/carousel-item/index.js +1 -1
  48. package/carousel-item/vue.js +1 -1
  49. package/cascader/index.js +3 -5
  50. package/cascader/vue.js +2 -1
  51. package/cascader-menu/index.js +11 -3
  52. package/cascader-menu/vue.js +1 -1
  53. package/cascader-mobile/index.js +1 -1
  54. package/cascader-mobile/vue.js +1 -1
  55. package/cascader-node/index.js +2 -2
  56. package/cascader-node/vue.js +1 -1
  57. package/cascader-panel/index.js +22 -17
  58. package/cascader-panel/node.js +14 -5
  59. package/cascader-panel/store.js +18 -1
  60. package/cascader-panel/vue.js +16 -3
  61. package/cascader-select/index.js +1 -1
  62. package/cascader-select/vue.js +1 -1
  63. package/cell/vue.js +1 -1
  64. package/chart-bar/index.js +1 -1
  65. package/chart-boxplot/index.js +2 -1
  66. package/chart-candle/index.js +1 -1
  67. package/chart-core/deps/constants.js +1 -1
  68. package/chart-core/deps/numerify.js +1 -1
  69. package/chart-core/deps/utils.js +1 -1
  70. package/chart-core/index.js +1 -1
  71. package/chart-core/modules/animation.js +1 -1
  72. package/chart-core/modules/extend.js +1 -1
  73. package/chart-core/modules/mark.js +1 -1
  74. package/chart-core/vue.js +1 -1
  75. package/chart-funnel/index.js +1 -1
  76. package/chart-gauge/index.js +1 -1
  77. package/chart-graph/index.js +1 -1
  78. package/chart-heatmap/index.js +1 -1
  79. package/chart-line/index.js +1 -1
  80. package/chart-liquidfill/index.js +1 -1
  81. package/chart-map/index.js +1 -1
  82. package/chart-pie/index.js +1 -1
  83. package/chart-radar/index.js +1 -1
  84. package/chart-sankey/index.js +1 -1
  85. package/chart-scatter/index.js +1 -1
  86. package/chart-sunburst/index.js +1 -1
  87. package/chart-tree/index.js +1 -1
  88. package/chart-waterfall/index.js +1 -1
  89. package/chart-wordcloud/index.js +1 -1
  90. package/checkbox/index.js +23 -6
  91. package/checkbox/vue.js +15 -2
  92. package/checkbox-button/index.js +1 -1
  93. package/checkbox-button/vue.js +1 -1
  94. package/checkbox-group/index.js +1 -1
  95. package/checkbox-group/vue.js +1 -1
  96. package/col/index.js +8 -7
  97. package/col/vue.js +1 -1
  98. package/collapse/index.js +1 -1
  99. package/collapse/vue.js +2 -2
  100. package/collapse-item/index.js +1 -1
  101. package/collapse-item/vue.js +1 -1
  102. package/color-picker/alpha-select/index.js +24 -0
  103. package/color-picker/alpha-select/vue.js +58 -0
  104. package/color-picker/color-select/index.js +73 -0
  105. package/color-picker/color-select/vue.js +67 -0
  106. package/color-picker/index.js +52 -0
  107. package/color-picker/utils/color.js +96 -0
  108. package/color-picker/utils/use-drag.js +38 -0
  109. package/color-picker/vue.js +63 -0
  110. package/color-select-panel/alpha-select/index.js +24 -0
  111. package/color-select-panel/alpha-select/vue.js +59 -0
  112. package/color-select-panel/hue-select/index.js +73 -0
  113. package/color-select-panel/hue-select/vue.js +67 -0
  114. package/color-select-panel/index.js +74 -0
  115. package/color-select-panel/utils/color.js +97 -0
  116. package/color-select-panel/utils/use-drag.js +38 -0
  117. package/color-select-panel/vue.js +92 -0
  118. package/column-list-group/vue.js +1 -1
  119. package/column-list-item/index.js +1 -1
  120. package/column-list-item/vue.js +1 -1
  121. package/common/array.js +1 -1
  122. package/common/bigInt.js +12 -3
  123. package/common/browser.js +1 -1
  124. package/common/calendar/calendar.js +97 -0
  125. package/common/dataset/index.js +1 -1
  126. package/common/date.js +3 -3
  127. package/common/decimal.js +1 -1
  128. package/common/deps/ResizeObserver.js +1 -1
  129. package/common/deps/after-leave.js +1 -1
  130. package/common/deps/clickoutside.js +1 -1
  131. package/common/deps/date-util.js +1 -1
  132. package/common/deps/date.js +3 -3
  133. package/common/deps/debounce.js +1 -1
  134. package/common/deps/dom.js +21 -70
  135. package/common/deps/eSpaceCtrl.js +1 -1
  136. package/common/deps/fastdom/async.js +1 -1
  137. package/common/deps/fastdom/index.js +1 -1
  138. package/common/deps/fastdom/sandbox.js +1 -1
  139. package/common/deps/fastdom/singleton.js +2 -2
  140. package/common/deps/fullscreen/apis.js +1 -1
  141. package/common/deps/fullscreen/screenfull.js +1 -1
  142. package/common/deps/infinite-scroll.js +1 -1
  143. package/common/deps/letter-only.js +1 -1
  144. package/common/deps/memorize.js +4 -4
  145. package/common/deps/modal-queue.js +1 -1
  146. package/common/deps/number-only.js +1 -1
  147. package/common/deps/observe-visibility.js +1 -1
  148. package/common/deps/popper.js +344 -449
  149. package/common/deps/popup-manager.js +56 -37
  150. package/common/deps/repeat-click.js +1 -1
  151. package/common/deps/requestAnimationFrame.js +1 -1
  152. package/common/deps/resize-event.js +1 -1
  153. package/common/deps/scroll-into-view.js +1 -1
  154. package/common/deps/scrollbar-width.js +1 -1
  155. package/common/deps/throttle.js +3 -3
  156. package/common/deps/touch.js +2 -1
  157. package/common/deps/tree-model/node.js +1 -1
  158. package/common/deps/tree-model/tree-store.js +1 -1
  159. package/common/deps/tree-model/util.js +1 -1
  160. package/common/deps/upload-ajax.js +1 -1
  161. package/common/deps/vue-emitter.js +1 -1
  162. package/common/deps/vue-popper.js +89 -220
  163. package/common/deps/vue-popup.js +65 -81
  164. package/common/event.js +9 -2
  165. package/common/index.js +2 -2
  166. package/common/object.js +20 -22
  167. package/common/runtime.js +2 -2
  168. package/common/string.js +14 -4
  169. package/common/type.js +2 -2
  170. package/common/validate/index.js +1 -1
  171. package/common/validate/messages.js +1 -1
  172. package/common/validate/rules/enum.js +1 -1
  173. package/common/validate/rules/index.js +1 -1
  174. package/common/validate/rules/pattern.js +1 -1
  175. package/common/validate/rules/range.js +1 -1
  176. package/common/validate/rules/required.js +1 -1
  177. package/common/validate/rules/type.js +1 -1
  178. package/common/validate/rules/whitespace.js +1 -1
  179. package/common/validate/schema.js +8 -1
  180. package/common/validate/util.js +4 -4
  181. package/common/validate/validations/array.js +1 -1
  182. package/common/validate/validations/date.js +1 -1
  183. package/common/validate/validations/enum.js +1 -1
  184. package/common/validate/validations/float.js +1 -1
  185. package/common/validate/validations/index.js +1 -1
  186. package/common/validate/validations/integer.js +1 -1
  187. package/common/validate/validations/method.js +1 -1
  188. package/common/validate/validations/number.js +1 -1
  189. package/common/validate/validations/pattern.js +1 -1
  190. package/common/validate/validations/required.js +1 -1
  191. package/common/validate/validations/string.js +1 -1
  192. package/common/validate/validations/type.js +1 -1
  193. package/common/xss.js +4 -156
  194. package/company/index.js +1 -1
  195. package/company/vue.js +1 -1
  196. package/container/index.js +1 -1
  197. package/container/vue.js +1 -1
  198. package/country/index.js +1 -1
  199. package/country/vue.js +1 -1
  200. package/credit-card/index.js +1 -1
  201. package/credit-card/vue.js +1 -1
  202. package/credit-card-form/index.js +1 -1
  203. package/credit-card-form/vue.js +3 -3
  204. package/crop/index.js +1 -1
  205. package/crop/vue.js +1 -1
  206. package/currency/index.js +1 -1
  207. package/currency/vue.js +1 -1
  208. package/date-panel/index.js +4 -4
  209. package/date-panel/vue.js +3 -3
  210. package/date-picker/index.js +1 -1
  211. package/date-picker/vue.js +1 -1
  212. package/date-picker-mobile/index.js +127 -85
  213. package/date-picker-mobile/vue.js +42 -23
  214. package/date-picker-mobile/year-month.js +53 -0
  215. package/date-range/index.js +7 -7
  216. package/date-range/vue.js +3 -3
  217. package/date-table/index.js +2 -2
  218. package/date-table/vue.js +1 -1
  219. package/dept/index.js +1 -1
  220. package/dept/vue.js +1 -1
  221. package/detail-page/index.js +1 -1
  222. package/detail-page/vue.js +1 -1
  223. package/dialog-box/index.js +28 -8
  224. package/dialog-box/vue.js +12 -16
  225. package/dialog-select/index.js +1 -1
  226. package/dialog-select/vue.js +1 -1
  227. package/divider/vue.js +9 -0
  228. package/drawer/index.js +2 -2
  229. package/drawer/vue.js +1 -1
  230. package/drop-roles/index.js +1 -1
  231. package/drop-roles/vue.js +1 -1
  232. package/drop-times/index.js +1 -1
  233. package/drop-times/vue.js +1 -1
  234. package/dropdown/index.js +33 -24
  235. package/dropdown/vue.js +8 -8
  236. package/dropdown-item/index.js +1 -1
  237. package/dropdown-item/mf.js +1 -1
  238. package/dropdown-item/vue.js +3 -3
  239. package/dropdown-menu/index.js +7 -5
  240. package/dropdown-menu/vue.js +3 -3
  241. package/dynamic-scroller/index.js +1 -1
  242. package/dynamic-scroller/vue.js +1 -1
  243. package/dynamic-scroller-item/index.js +1 -1
  244. package/dynamic-scroller-item/vue.js +1 -1
  245. package/espace/index.js +1 -1
  246. package/espace/vue.js +1 -1
  247. package/exception/index.js +1 -1
  248. package/exception/vue.js +1 -1
  249. package/fall-menu/index.js +1 -1
  250. package/fall-menu/vue.js +1 -1
  251. package/file-upload/index.js +213 -31
  252. package/file-upload/vue.js +13 -7
  253. package/filter/index.js +1 -1
  254. package/filter/tag-group.js +1 -1
  255. package/filter/vue.js +1 -1
  256. package/filter-bar/index.js +1 -1
  257. package/filter-bar/vue.js +1 -1
  258. package/filter-box/index.js +1 -1
  259. package/filter-box/vue.js +1 -1
  260. package/filter-panel/index.js +1 -1
  261. package/filter-panel/vue.js +1 -1
  262. package/floatbar/index.js +1 -1
  263. package/floatbar/vue.js +1 -1
  264. package/floating-button/index.js +1 -1
  265. package/floating-button/vue.js +1 -1
  266. package/flowchart/index.js +648 -227
  267. package/flowchart/node.js +52 -0
  268. package/flowchart/vue.js +25 -9
  269. package/form/index.js +37 -5
  270. package/form/vue.js +16 -3
  271. package/form-item/index.js +56 -27
  272. package/form-item/vue.js +25 -9
  273. package/fullscreen/index.js +1 -1
  274. package/fullscreen/vue.js +2 -1
  275. package/grid/core/index.js +1 -1
  276. package/grid/core/interceptor.js +1 -1
  277. package/grid/core/storeMap.js +1 -1
  278. package/grid/plugins/export.js +1 -1
  279. package/grid/plugins/exportExcel.js +4 -1
  280. package/grid/plugins/header.js +1 -1
  281. package/grid/plugins/resize.js +1 -1
  282. package/grid/static/array/arrayEach.js +1 -1
  283. package/grid/static/array/arrayIndexOf.js +1 -1
  284. package/grid/static/array/eachTree.js +1 -1
  285. package/grid/static/array/every.js +1 -1
  286. package/grid/static/array/filterTree.js +1 -1
  287. package/grid/static/array/find.js +1 -1
  288. package/grid/static/array/findTree.js +1 -1
  289. package/grid/static/array/helperCreateIterateHandle.js +1 -1
  290. package/grid/static/array/helperCreateTreeFunc.js +1 -1
  291. package/grid/static/array/includes.js +1 -1
  292. package/grid/static/array/lastArrayEach.js +1 -1
  293. package/grid/static/array/map.js +1 -1
  294. package/grid/static/array/mapTree.js +1 -1
  295. package/grid/static/array/slice.js +1 -1
  296. package/grid/static/array/sortBy.js +1 -1
  297. package/grid/static/array/sum.js +1 -1
  298. package/grid/static/array/toArray.js +1 -1
  299. package/grid/static/array/toTreeArray.js +1 -1
  300. package/grid/static/base/clear.js +1 -1
  301. package/grid/static/base/clone.js +1 -1
  302. package/grid/static/base/destructuring.js +1 -1
  303. package/grid/static/base/each.js +1 -1
  304. package/grid/static/base/eqNull.js +1 -1
  305. package/grid/static/base/findIndexOf.js +1 -1
  306. package/grid/static/base/get.js +1 -1
  307. package/grid/static/base/has.js +1 -1
  308. package/grid/static/base/hasOwnProp.js +1 -1
  309. package/grid/static/base/helperCreateGetObjects.js +1 -1
  310. package/grid/static/base/helperCreateInInObjectString.js +1 -1
  311. package/grid/static/base/helperCreateInTypeof.js +1 -1
  312. package/grid/static/base/helperCreateIndexOf.js +1 -1
  313. package/grid/static/base/helperCreateiterateIndexOf.js +1 -1
  314. package/grid/static/base/helperDefaultCompare.js +1 -1
  315. package/grid/static/base/helperDeleteProperty.js +1 -1
  316. package/grid/static/base/helperEqualCompare.js +1 -1
  317. package/grid/static/base/helperGetHGSKeys.js +5 -2
  318. package/grid/static/base/indexOf.js +1 -1
  319. package/grid/static/base/isArray.js +1 -1
  320. package/grid/static/base/isBoolean.js +1 -1
  321. package/grid/static/base/isDate.js +1 -1
  322. package/grid/static/base/isEmpty.js +1 -1
  323. package/grid/static/base/isEqual.js +1 -1
  324. package/grid/static/base/isFunction.js +1 -1
  325. package/grid/static/base/isNaN.js +1 -1
  326. package/grid/static/base/isNull.js +1 -1
  327. package/grid/static/base/isNumber.js +1 -1
  328. package/grid/static/base/isObject.js +1 -1
  329. package/grid/static/base/isPlainObject.js +1 -1
  330. package/grid/static/base/isRegExp.js +1 -1
  331. package/grid/static/base/isSet.js +1 -1
  332. package/grid/static/base/isString.js +1 -1
  333. package/grid/static/base/isUndefined.js +1 -1
  334. package/grid/static/base/keys.js +1 -1
  335. package/grid/static/base/lastEach.js +1 -1
  336. package/grid/static/base/remove.js +1 -1
  337. package/grid/static/base/set.js +1 -1
  338. package/grid/static/base/toJSONString.js +1 -1
  339. package/grid/static/base/toStringJSON.js +1 -1
  340. package/grid/static/base/uniqueId.js +1 -1
  341. package/grid/static/browse/browse.js +1 -1
  342. package/grid/static/function/property.js +1 -1
  343. package/grid/static/function/throttle.js +1 -1
  344. package/grid/static/index.js +1 -1
  345. package/grid/static/number/helperCreateToNumber.js +1 -1
  346. package/grid/static/number/toNumber.js +1 -1
  347. package/grid/static/object/assign.js +1 -1
  348. package/grid/static/object/extend.js +1 -1
  349. package/grid/static/object/lastObjectEach.js +1 -1
  350. package/grid/static/object/objectEach.js +1 -1
  351. package/grid/static/object/objectMap.js +1 -1
  352. package/grid/static/object/values.js +1 -1
  353. package/grid/static/static/staticDocument.js +1 -1
  354. package/grid/static/static/staticHGKeyRE.js +1 -1
  355. package/grid/static/static/staticParseInt.js +1 -1
  356. package/grid/static/static/staticStrUndefined.js +1 -1
  357. package/grid/static/static/staticWindow.js +1 -1
  358. package/grid/static/string/template.js +1 -1
  359. package/grid/static/string/toString.js +1 -1
  360. package/grid/utils/column.js +1 -1
  361. package/grid/utils/common.js +1 -1
  362. package/grid/utils/dom.js +3 -2
  363. package/grid/utils/event.js +1 -1
  364. package/grid/utils/index.js +1 -1
  365. package/guide/index.js +4 -3
  366. package/guide/vue.js +1 -1
  367. package/hrapprover/index.js +1 -1
  368. package/hrapprover/vue.js +1 -1
  369. package/image/index.js +6 -3
  370. package/image/vue.js +19 -3
  371. package/image-viewer/index.js +327 -42
  372. package/image-viewer/vue.js +64 -19
  373. package/index-bar/index.js +1 -2
  374. package/index-bar/vue.js +1 -1
  375. package/index-bar-anchor/vue.js +1 -1
  376. package/input/index.js +19 -6
  377. package/input/vue.js +43 -5
  378. package/ip-address/index.js +1 -1
  379. package/ip-address/vue.js +1 -1
  380. package/layout/vue.js +1 -1
  381. package/link/index.js +1 -1
  382. package/link/vue.js +1 -1
  383. package/link-menu/index.js +1 -1
  384. package/link-menu/vue.js +1 -1
  385. package/list/index.js +1 -1
  386. package/list/vue.js +1 -1
  387. package/loading/index.js +1 -1
  388. package/loading/vue.js +1 -1
  389. package/locales/index.js +2 -2
  390. package/locales/vue.js +1 -1
  391. package/logon-user/index.js +1 -1
  392. package/logon-user/vue.js +1 -1
  393. package/logout/index.js +1 -1
  394. package/logout/vue.js +1 -1
  395. package/milestone/index.js +3 -3
  396. package/milestone/vue.js +4 -4
  397. package/mini-picker/index.js +1 -1
  398. package/mini-picker/vue.js +1 -1
  399. package/modal/index.js +210 -107
  400. package/modal/vue.js +10 -7
  401. package/month-range/index.js +2 -2
  402. package/month-range/vue.js +3 -3
  403. package/month-table/index.js +3 -3
  404. package/month-table/vue.js +1 -1
  405. package/multi-select/index.js +1 -1
  406. package/multi-select/vue.js +1 -1
  407. package/nav-menu/index.js +103 -20
  408. package/nav-menu/vue.js +19 -9
  409. package/notify/index.js +1 -1
  410. package/notify/vue.js +1 -1
  411. package/numeric/index.js +28 -5
  412. package/numeric/vue.js +21 -11
  413. package/option/index.js +1 -1
  414. package/option/vue.js +1 -1
  415. package/option-group/index.js +1 -1
  416. package/option-group/vue.js +1 -1
  417. package/package.json +5 -4
  418. package/pager/vue.js +1 -1
  419. package/pager-item/index.js +1 -1
  420. package/pager-item/vue.js +1 -1
  421. package/panel/index.js +1 -1
  422. package/panel/vue.js +1 -1
  423. package/picker/index.js +8 -19
  424. package/picker/timezone.js +1 -1
  425. package/picker/vue.js +25 -30
  426. package/picker-column/index.js +1 -1
  427. package/picker-column/vue.js +1 -1
  428. package/pop-upload/index.js +1 -1
  429. package/pop-upload/vue.js +1 -1
  430. package/popconfirm/index.js +1 -1
  431. package/popconfirm/vue.js +1 -1
  432. package/popeditor/index.js +4 -1
  433. package/popeditor/vue.js +1 -1
  434. package/popover/index.js +21 -9
  435. package/popover/vue.js +49 -9
  436. package/popup/index.js +1 -1
  437. package/popup/vue.js +1 -1
  438. package/progress/index.js +1 -1
  439. package/progress/vue.js +1 -1
  440. package/pull-refresh/index.js +1 -3
  441. package/pull-refresh/vue.js +1 -1
  442. package/query-builder/index.js +1 -1
  443. package/query-builder/vue.js +1 -1
  444. package/radio/index.js +29 -6
  445. package/radio/vue.js +2 -2
  446. package/radio-button/index.js +26 -12
  447. package/radio-button/vue.js +14 -6
  448. package/radio-group/index.js +3 -3
  449. package/radio-group/vue.js +2 -2
  450. package/rate/index.js +1 -1
  451. package/rate/vue.js +1 -1
  452. package/record/index.js +1 -1
  453. package/record/vue.js +1 -1
  454. package/recycle-scroller/index.js +2 -1
  455. package/recycle-scroller/vue.js +1 -1
  456. package/rich-text-edtior/index.js +254 -0
  457. package/rich-text-edtior/vue.js +320 -0
  458. package/river/index.js +1 -1
  459. package/river/river.js +1 -1
  460. package/river/vue.js +1 -1
  461. package/roles/index.js +1 -1
  462. package/roles/vue.js +1 -1
  463. package/row/index.js +1 -1
  464. package/row/vue.js +1 -1
  465. package/scroll-text/index.js +1 -1
  466. package/scroll-text/vue.js +1 -1
  467. package/scrollbar/index.js +1 -1
  468. package/scrollbar/vue-bar.js +1 -1
  469. package/scrollbar/vue.js +1 -1
  470. package/search/index.js +12 -9
  471. package/search/vue.js +7 -7
  472. package/select/index.js +42 -22
  473. package/select/vue.js +7 -4
  474. package/select-dropdown/index.js +3 -3
  475. package/select-dropdown/vue.js +1 -1
  476. package/select-mobile/index.js +1 -1
  477. package/select-mobile/vue.js +1 -1
  478. package/select-view/index.js +1 -1
  479. package/select-view/vue.js +1 -1
  480. package/selected-box/index.js +1 -1
  481. package/selected-box/vue.js +1 -1
  482. package/slide-bar/index.js +1 -1
  483. package/slide-bar/vue.js +1 -1
  484. package/slider/index.js +36 -13
  485. package/slider/vue.js +5 -2
  486. package/slider-button/index.js +1 -1
  487. package/slider-button/vue.js +1 -1
  488. package/slider-button-group/slide-button.js +1 -1
  489. package/slider-button-group/vue.js +1 -1
  490. package/split/index.js +65 -22
  491. package/split/vue.js +48 -41
  492. package/standard-list-item/index.js +1 -1
  493. package/standard-list-item/vue.js +1 -1
  494. package/steps/index.js +1 -1
  495. package/steps/slide-bar.js +2 -1
  496. package/steps/vue.js +3 -2
  497. package/switch/index.js +4 -10
  498. package/switch/vue.js +4 -6
  499. package/tab-bar/index.js +33 -31
  500. package/tab-bar/vue.js +1 -1
  501. package/tab-dropdown/index.js +1 -1
  502. package/tab-dropdown/vue.js +1 -1
  503. package/tab-item/index.js +1 -1
  504. package/tab-item/vue.js +1 -1
  505. package/tab-item-mf/vue.js +1 -1
  506. package/tab-nav/index.js +19 -8
  507. package/tab-nav/vue.js +3 -2
  508. package/tabbar/index.js +36 -3
  509. package/tabbar/vue.js +34 -9
  510. package/tabbar-item/index.js +11 -6
  511. package/tabbar-item/vue.js +13 -8
  512. package/table/index.js +1 -1
  513. package/table/vue.js +1 -1
  514. package/tabs/index.js +22 -8
  515. package/tabs/vue.js +9 -2
  516. package/tabs-mf/index.js +1 -1
  517. package/tabs-mf/vue-bar.js +1 -1
  518. package/tabs-mf/vue-nav-item.js +1 -1
  519. package/tabs-mf/vue-nav.js +1 -1
  520. package/tabs-mf/vue.js +1 -1
  521. package/tabs-mf/wheel.js +1 -1
  522. package/tag/index.js +2 -2
  523. package/tag/vue.js +1 -1
  524. package/tag-group/index.js +1 -1
  525. package/tag-group/vue.js +1 -1
  526. package/tall-storage/index.js +1 -1
  527. package/tall-storage/vue-storage-box.js +1 -1
  528. package/tall-storage/vue.js +1 -1
  529. package/text-popup/index.js +1 -1
  530. package/text-popup/vue.js +1 -1
  531. package/time/index.js +2 -2
  532. package/time/vue.js +4 -4
  533. package/time-line/index.js +2 -2
  534. package/time-line/vue.js +5 -4
  535. package/time-panel/index.js +1 -1
  536. package/time-panel/scrollIntoView.js +1 -1
  537. package/time-panel/vue.js +1 -1
  538. package/time-picker-mobile/index.js +1 -1
  539. package/time-picker-mobile/vue.js +1 -1
  540. package/time-range/index.js +5 -5
  541. package/time-range/vue.js +4 -4
  542. package/time-spinner/index.js +1 -1
  543. package/time-spinner/vue.js +3 -3
  544. package/timeline-item/index.js +14 -15
  545. package/timeline-item/vue.js +7 -6
  546. package/toggle-menu/index.js +1 -1
  547. package/toggle-menu/vue.js +2 -1
  548. package/tooltip/index.js +6 -11
  549. package/tooltip/vue.js +5 -10
  550. package/top-box/index.js +1 -1
  551. package/top-box/vue.js +1 -1
  552. package/transfer/index.js +1 -1
  553. package/transfer/vue.js +1 -1
  554. package/transfer-panel/index.js +1 -1
  555. package/transfer-panel/vue.js +1 -1
  556. package/tree/index.js +2 -1
  557. package/tree/vue.js +1 -1
  558. package/tree-menu/index.js +6 -6
  559. package/tree-menu/vue.js +3 -3
  560. package/tree-node/index.js +5 -3
  561. package/tree-node/vue.js +6 -6
  562. package/types/action-menu.type.d.mts +88 -0
  563. package/types/action-sheet.type.d.mts +2 -0
  564. package/types/alert.type.d.mts +112 -0
  565. package/types/amount.type.d.mts +2 -0
  566. package/types/anchor.type.d.mts +87 -0
  567. package/types/area.type.d.mts +2 -0
  568. package/types/autocomplete.type.d.mts +2 -0
  569. package/types/autonavi-map.type.d.mts +2 -0
  570. package/types/avatar.type.d.mts +2 -0
  571. package/types/badge.type.d.mts +82 -0
  572. package/types/baidu-map.type.d.mts +2 -0
  573. package/types/breadcrumb-item.type.d.mts +31 -0
  574. package/types/breadcrumb.type.d.mts +57 -0
  575. package/types/bulletin-board.type.d.mts +2 -0
  576. package/types/button-group.type.d.mts +87 -0
  577. package/types/button.type.d.mts +90 -0
  578. package/types/calendar-bar.type.d.mts +2 -0
  579. package/types/calendar.type.d.mts +2 -0
  580. package/types/card-group.type.d.mts +2 -0
  581. package/types/card-template.type.d.mts +2 -0
  582. package/types/card.type.d.mts +2 -0
  583. package/types/carousel-item.type.d.mts +2 -0
  584. package/types/carousel.type.d.mts +2 -0
  585. package/types/cascader-menu.type.d.mts +49 -0
  586. package/types/cascader-mobile.type.d.mts +2 -0
  587. package/types/cascader-node.type.d.mts +53 -0
  588. package/types/cascader-panel.type.d.mts +241 -0
  589. package/types/cascader-select.type.d.mts +2 -0
  590. package/types/cascader.type.d.mts +2 -0
  591. package/types/cell.type.d.mts +2 -0
  592. package/types/chart-bar.type.d.mts +2 -0
  593. package/types/chart-boxplot.type.d.mts +2 -0
  594. package/types/chart-candle.type.d.mts +2 -0
  595. package/types/chart-core.type.d.mts +2 -0
  596. package/types/chart-funnel.type.d.mts +2 -0
  597. package/types/chart-gauge.type.d.mts +2 -0
  598. package/types/chart-graph.type.d.mts +2 -0
  599. package/types/chart-heatmap.type.d.mts +2 -0
  600. package/types/chart-line.type.d.mts +2 -0
  601. package/types/chart-liquidfill.type.d.mts +2 -0
  602. package/types/chart-map.type.d.mts +2 -0
  603. package/types/chart-pie.type.d.mts +2 -0
  604. package/types/chart-radar.type.d.mts +2 -0
  605. package/types/chart-sankey.type.d.mts +2 -0
  606. package/types/chart-scatter.type.d.mts +2 -0
  607. package/types/chart-sunburst.type.d.mts +2 -0
  608. package/types/chart-tree.type.d.mts +2 -0
  609. package/types/chart-waterfall.type.d.mts +2 -0
  610. package/types/chart-wordcloud.type.d.mts +2 -0
  611. package/types/checkbox-button.type.d.mts +2 -0
  612. package/types/checkbox-group.type.d.mts +2 -0
  613. package/types/checkbox.type.d.mts +154 -0
  614. package/types/col.type.d.mts +2 -0
  615. package/types/collapse-item.type.d.mts +60 -0
  616. package/types/collapse.type.d.mts +56 -0
  617. package/types/color-picker.type.d.mts +5 -0
  618. package/types/color-select-panel.type.d.mts +5 -0
  619. package/types/column-list-group.type.d.mts +2 -0
  620. package/types/column-list-item.type.d.mts +2 -0
  621. package/types/common.type.d.mts +2 -0
  622. package/types/company.type.d.mts +2 -0
  623. package/types/container.type.d.mts +2 -0
  624. package/types/country.type.d.mts +2 -0
  625. package/types/credit-card-form.type.d.mts +2 -0
  626. package/types/credit-card.type.d.mts +2 -0
  627. package/types/crop.type.d.mts +2 -0
  628. package/types/currency.type.d.mts +2 -0
  629. package/types/date-panel.type.d.mts +2 -0
  630. package/types/date-picker-mobile.type.d.mts +2 -0
  631. package/types/date-picker.type.d.mts +212 -0
  632. package/types/date-range.type.d.mts +2 -0
  633. package/types/date-table.type.d.mts +138 -0
  634. package/types/dept.type.d.mts +2 -0
  635. package/types/detail-page.type.d.mts +2 -0
  636. package/types/dialog-box.type.d.mts +250 -0
  637. package/types/dialog-select.type.d.mts +2 -0
  638. package/types/drawer.type.d.mts +2 -0
  639. package/types/drop-roles.type.d.mts +2 -0
  640. package/types/drop-times.type.d.mts +2 -0
  641. package/types/dropdown-item.type-e59174b8.d.ts +336 -0
  642. package/types/dropdown-item.type.d.mts +4 -0
  643. package/types/dropdown-menu.type.d.mts +4 -0
  644. package/types/dropdown.type.d.mts +142 -0
  645. package/types/dynamic-scroller-item.type.d.mts +2 -0
  646. package/types/dynamic-scroller.type.d.mts +2 -0
  647. package/types/espace.type.d.mts +2 -0
  648. package/types/exception.type.d.mts +2 -0
  649. package/types/fall-menu.type.d.mts +2 -0
  650. package/types/file-upload.type.d.mts +3 -0
  651. package/types/filter-bar.type.d.mts +2 -0
  652. package/types/filter-box.type.d.mts +2 -0
  653. package/types/filter-panel.type.d.mts +2 -0
  654. package/types/filter.type.d.mts +2 -0
  655. package/types/floatbar.type.d.mts +45 -0
  656. package/types/floating-button.type.d.mts +2 -0
  657. package/types/flowchart.type.d.mts +2 -0
  658. package/types/form-item.type.d.mts +3 -0
  659. package/types/form.type-004ecf93.d.ts +394 -0
  660. package/types/form.type.d.mts +3 -0
  661. package/types/fullscreen.type.d.mts +2 -0
  662. package/types/grid.type.d.mts +2 -0
  663. package/types/guide.type.d.mts +2 -0
  664. package/types/hrapprover.type.d.mts +2 -0
  665. package/types/image-viewer.type.d.mts +2 -0
  666. package/types/image.type.d.mts +176 -0
  667. package/types/index-bar-anchor.type.d.mts +2 -0
  668. package/types/index-bar.type.d.mts +2 -0
  669. package/types/index-e0250f63.d.ts +43 -0
  670. package/types/input.type.d.mts +294 -0
  671. package/types/ip-address.type.d.mts +2 -0
  672. package/types/layout.type.d.mts +2 -0
  673. package/types/link-menu.type.d.mts +2 -0
  674. package/types/link.type.d.mts +40 -0
  675. package/types/list.type.d.mts +2 -0
  676. package/types/loading.type.d.mts +90 -0
  677. package/types/locales.type.d.mts +2 -0
  678. package/types/logon-user.type.d.mts +2 -0
  679. package/types/logout.type.d.mts +2 -0
  680. package/types/milestone.type.d.mts +144 -0
  681. package/types/mini-picker.type.d.mts +2 -0
  682. package/types/modal.type.d.mts +264 -0
  683. package/types/month-range.type.d.mts +2 -0
  684. package/types/month-table.type.d.mts +2 -0
  685. package/types/multi-select.type.d.mts +2 -0
  686. package/types/nav-menu.type.d.mts +124 -0
  687. package/types/notify.type.d.mts +2 -0
  688. package/types/numeric.type.d.mts +275 -0
  689. package/types/option-group.type.d.mts +2 -0
  690. package/types/option.type.d.mts +2 -0
  691. package/types/pager-item.type.d.mts +2 -0
  692. package/types/pager.type.d.mts +2 -0
  693. package/types/panel.type.d.mts +2 -0
  694. package/types/picker-column.type.d.mts +2 -0
  695. package/types/picker.type.d.mts +191 -0
  696. package/types/pop-upload.type.d.mts +2 -0
  697. package/types/popconfirm.type.d.mts +2 -0
  698. package/types/popeditor.type.d.mts +275 -0
  699. package/types/popover.type.d.mts +164 -0
  700. package/types/popup.type.d.mts +2 -0
  701. package/types/progress.type.d.mts +216 -0
  702. package/types/pull-refresh.type.d.mts +2 -0
  703. package/types/query-builder.type.d.mts +2 -0
  704. package/types/radio-button.type.d.mts +90 -0
  705. package/types/radio-group.type.d.mts +67 -0
  706. package/types/radio.type.d.mts +103 -0
  707. package/types/rate.type.d.mts +2 -0
  708. package/types/record.type.d.mts +2 -0
  709. package/types/recycle-scroller.type.d.mts +2 -0
  710. package/types/river.type.d.mts +2 -0
  711. package/types/roles.type.d.mts +2 -0
  712. package/types/row.type.d.mts +2 -0
  713. package/types/scroll-text.type.d.mts +2 -0
  714. package/types/scrollbar.type.d.mts +2 -0
  715. package/types/search.type.d.mts +40 -0
  716. package/types/select-dropdown.type.d.mts +2 -0
  717. package/types/select-mobile.type.d.mts +2 -0
  718. package/types/select-view.type.d.mts +2 -0
  719. package/types/select.type.d.mts +2 -0
  720. package/types/selected-box.type.d.mts +2 -0
  721. package/types/shared.type.d.mts +178 -0
  722. package/types/slide-bar.type.d.mts +2 -0
  723. package/types/slider-button-group.type.d.mts +2 -0
  724. package/types/slider-button.type.d.mts +2 -0
  725. package/types/slider.type.d.mts +199 -0
  726. package/types/split.type.d.mts +2 -0
  727. package/types/standard-list-item.type.d.mts +2 -0
  728. package/types/steps.type.d.mts +78 -0
  729. package/types/switch.type.d.mts +113 -0
  730. package/types/tab-bar.type.d.mts +42 -0
  731. package/types/tab-dropdown.type.d.mts +2 -0
  732. package/types/tab-item-mf.type.d.mts +2 -0
  733. package/types/tab-item.type.d.mts +71 -0
  734. package/types/tab-nav.type.d.mts +106 -0
  735. package/types/tabbar-item.type.d.mts +2 -0
  736. package/types/tabbar.type.d.mts +2 -0
  737. package/types/table.type.d.mts +2 -0
  738. package/types/tabs-mf.type.d.mts +2 -0
  739. package/types/tabs.type.d.mts +148 -0
  740. package/types/tag-group.type.d.mts +2 -0
  741. package/types/tag.type.d.mts +51 -0
  742. package/types/tall-storage.type.d.mts +2 -0
  743. package/types/text-popup.type.d.mts +2 -0
  744. package/types/time-line.type-4a01d597.d.ts +280 -0
  745. package/types/time-line.type.d.mts +3 -0
  746. package/types/time-panel.type.d.mts +2 -0
  747. package/types/time-picker-mobile.type.d.mts +2 -0
  748. package/types/time-range.type.d.mts +2 -0
  749. package/types/time-spinner.type.d.mts +2 -0
  750. package/types/time.type.d.mts +2 -0
  751. package/types/timeline-item.type.d.mts +3 -0
  752. package/types/toggle-menu.type.d.mts +2 -0
  753. package/types/tooltip.type.d.mts +189 -0
  754. package/types/top-box.type.d.mts +2 -0
  755. package/types/transfer-panel.type.d.mts +2 -0
  756. package/types/transfer.type.d.mts +2 -0
  757. package/types/tree-menu.type.d.mts +2 -0
  758. package/types/tree-node.type.d.mts +2 -0
  759. package/types/tree.type.d.mts +2 -0
  760. package/types/upload-dragger.type.d.mts +50 -0
  761. package/types/upload-list.type-aa21a42e.d.ts +1130 -0
  762. package/types/upload-list.type.d.mts +3 -0
  763. package/types/upload.type.d.mts +3 -0
  764. package/types/user-account.type.d.mts +2 -0
  765. package/types/user-contact.type.d.mts +2 -0
  766. package/types/user-head-group.type.d.mts +2 -0
  767. package/types/user-head.type.d.mts +2 -0
  768. package/types/user-link.type.d.mts +2 -0
  769. package/types/user.type.d.mts +2 -0
  770. package/types/wheel.type.d.mts +2 -0
  771. package/types/wizard.type.d.mts +95 -0
  772. package/types/year-range.type.d.mts +2 -0
  773. package/types/year-table.type.d.mts +2 -0
  774. package/upload/index.js +103 -25
  775. package/upload/vue.js +4 -1
  776. package/upload-dragger/index.js +3 -2
  777. package/upload-dragger/vue.js +1 -1
  778. package/upload-list/index.js +7 -5
  779. package/upload-list/vue.js +3 -2
  780. package/user/index.js +5 -3
  781. package/user/vue.js +2 -2
  782. package/user-account/index.js +1 -1
  783. package/user-account/vue.js +1 -1
  784. package/user-contact/index.js +1 -1
  785. package/user-contact/vue.js +1 -1
  786. package/user-head/index.js +26 -31
  787. package/user-head/vue.js +16 -13
  788. package/user-head-group/index.js +20 -0
  789. package/user-head-group/vue.js +18 -5
  790. package/user-link/index.js +1 -1
  791. package/user-link/vue.js +1 -1
  792. package/wheel/index.js +1 -1
  793. package/wheel/vue.js +1 -1
  794. package/wizard/index.js +1 -1
  795. package/wizard/vue.js +1 -2
  796. package/year-range/index.js +2 -2
  797. package/year-range/vue.js +4 -4
  798. package/year-table/index.js +3 -3
  799. package/year-table/vue.js +1 -1
  800. /package/{chunk-PKUHTIDK.js → chunk-G2ADBYYC.js} +0 -0
@@ -1,4 +1,4 @@
1
- import "../chunk-PKUHTIDK.js";
1
+ import "../chunk-G2ADBYYC.js";
2
2
  import debounce from "../common/deps/debounce";
3
3
  import { omitText as omit } from "../common/string";
4
4
  const compute = ({ api, markRaw, props, state }) => () => {
@@ -16,7 +16,7 @@ const compute = ({ api, markRaw, props, state }) => () => {
16
16
  const heights = seg(config.height, config.rows);
17
17
  const afterNodes = api.buildAfterNode(nodes, widths, heights);
18
18
  const afterLinks = api.buildAfterLink(links, widths, heights, afterNodes);
19
- const hoverState = api.buildHoverState(afterLinks);
19
+ const hoverState = api.buildHoverState({ afterLinks });
20
20
  const allItem = api.getAllItem(nodes);
21
21
  const dropdowns = api.initDropdowns(nodes);
22
22
  state.afterData = markRaw({ afterNodes, afterLinks, widths, heights, allItem, hoverState });
@@ -110,40 +110,99 @@ const buildAfterLink = () => (links, widths, heights, afterNodes) => {
110
110
  };
111
111
  return links.map((link) => path(link, widths[1], heights[1], afterNodes));
112
112
  };
113
+ const clearHoverList = ({ afterLink, state }) => {
114
+ const { hoverMap, hoverList } = state.afterData.hoverState;
115
+ const indices = [];
116
+ hoverList.forEach((tri, i) => hoverMap.get(tri) === afterLink && indices.unshift(i));
117
+ indices.forEach((index) => hoverList.splice(index, 1));
118
+ };
119
+ const drawLinePart = (ctx, p) => {
120
+ const mmap = { m: "moveTo", l: "lineTo", a: "arcTo" };
121
+ const paths = p.split(",");
122
+ ctx[mmap[paths[0]]](...paths.slice(1).map(Number));
123
+ };
124
+ const styleDraw = ({ afterLink, afterNodes, api, config, ctx }) => {
125
+ if (typeof config.styleLink === "function") {
126
+ config.styleLink(ctx, afterLink, afterNodes);
127
+ } else {
128
+ ctx.strokeStyle = config.colors[afterLink.raw.info.status];
129
+ afterLink.raw.info.style !== "solid" && ctx.setLineDash(api.isMf() ? [6, 6] : [2, 4]);
130
+ }
131
+ if (api.isLinkHover(afterLink) && typeof config.styleHoverLink === "function") {
132
+ config.styleHoverLink(ctx, afterLink, afterNodes);
133
+ }
134
+ };
135
+ const hitMatch = (drawCfg, afterLink) => {
136
+ let matched = true;
137
+ if (drawCfg.filter) {
138
+ if (drawCfg.filter.from && drawCfg.filter.to) {
139
+ matched = afterLink.raw.from === drawCfg.filter.from && afterLink.raw.to === drawCfg.filter.to;
140
+ } else if (drawCfg.filter.from) {
141
+ matched = afterLink.raw.from === drawCfg.filter.from;
142
+ } else if (drawCfg.filter.to) {
143
+ matched = afterLink.raw.to === drawCfg.filter.to;
144
+ } else {
145
+ matched = false;
146
+ }
147
+ }
148
+ return matched;
149
+ };
150
+ const setLinear = ({ afterLink, ctx }) => {
151
+ if (afterLink.linearGrad) {
152
+ const { from, to, linear } = afterLink.linearGrad;
153
+ const grad = ctx.createLinearGradient(from.x, from.y, to.x, to.y);
154
+ if (Array.isArray(linear.stops) && Array.isArray(linear.colors) && linear.stops.length === linear.colors.length && linear.stops.length > 0) {
155
+ linear.stops.forEach((stop, i) => grad.addColorStop(stop, linear.colors[i]));
156
+ }
157
+ ctx.strokeStyle = grad;
158
+ afterLink._grad = grad;
159
+ }
160
+ };
161
+ const realDraw = ({ afterLink, afterNodes, config, ctx, state }) => {
162
+ const defaultDrawLink = () => {
163
+ setLinear({ afterLink, ctx });
164
+ afterLink.p.map((p) => drawLinePart(ctx, p));
165
+ };
166
+ let drawn = false;
167
+ if (typeof config.drawLink === "function") {
168
+ drawn = true;
169
+ config.drawLink({ ctx, afterLink, afterNodes });
170
+ } else if (Array.isArray(config.drawLink)) {
171
+ if (config.drawLink.length) {
172
+ for (let i = 0; i < config.drawLink.length; i++) {
173
+ if (drawn = hitMatch(config.drawLink[i], afterLink)) {
174
+ config.drawLink[i].method({ ctx, afterLink, afterNodes });
175
+ break;
176
+ }
177
+ }
178
+ }
179
+ } else if (config.drawLink && typeof config.drawLink.method === "function") {
180
+ if (drawn = hitMatch(config.drawLink, afterLink)) {
181
+ config.drawLink.method({ ctx, afterLink, afterNodes });
182
+ }
183
+ }
184
+ if (drawn) {
185
+ state.temporary.customLinks.push(afterLink.raw);
186
+ clearHoverList({ afterLink, state });
187
+ } else {
188
+ defaultDrawLink();
189
+ }
190
+ };
191
+ const draw = ({ afterLink, afterNodes, api, config, ctx, state }) => {
192
+ ctx.save();
193
+ ctx.beginPath();
194
+ styleDraw({ afterLink, afterNodes, api, config, ctx });
195
+ realDraw({ afterLink, afterNodes, config, ctx, state });
196
+ ctx.stroke();
197
+ ctx.restore();
198
+ drawArrow({ afterLink, config, ctx, state });
199
+ };
113
200
  const drawAfterLink = ({ api, props, state, vm }) => () => {
114
201
  const { config } = props;
115
202
  const { afterData } = state;
116
203
  const { $refs } = vm;
117
204
  const { afterLinks, afterNodes, graph } = afterData;
118
- const mmap = { m: "moveTo", l: "lineTo", a: "arcTo" };
119
205
  const dpr = window.devicePixelRatio;
120
- const drawLinePart = (ctx, p) => {
121
- const paths = p.split(",");
122
- ctx[mmap[paths[0]]](...paths.slice(1).map(Number));
123
- };
124
- const draw = (ctx, afterLink) => {
125
- const { p, raw } = afterLink;
126
- const { status, style } = raw.info;
127
- const color = config.colors[status];
128
- ctx.save();
129
- ctx.beginPath();
130
- if (typeof config.drawLink === "function") {
131
- config.drawLink(ctx, afterLink, afterNodes);
132
- } else {
133
- if (typeof config.styleLink === "function") {
134
- config.styleLink(ctx);
135
- } else {
136
- ctx.strokeStyle = color;
137
- style !== "solid" && ctx.setLineDash(api.isMf() ? [6, 6] : [2, 4]);
138
- }
139
- if (api.isLinkHover(afterLink) && typeof config.styleHoverLink === "function") {
140
- config.styleHoverLink(ctx);
141
- }
142
- p.map((p2) => drawLinePart(ctx, p2));
143
- }
144
- ctx.stroke();
145
- ctx.restore();
146
- };
147
206
  if ($refs.canvas && $refs.canvas.getContext) {
148
207
  const ctx = $refs.canvas.getContext("2d");
149
208
  const width = graph ? graph.width : config.width;
@@ -163,14 +222,19 @@ const drawAfterLink = ({ api, props, state, vm }) => () => {
163
222
  ctx.lineWidth = api.isMf() ? (config.lineWidth || 1) / dpr : 2;
164
223
  ctx.miterLimit = 0;
165
224
  ctx.lineDashOffset = 0;
166
- afterLinks.map((afterLink) => draw(ctx, afterLink));
225
+ state.temporary.customLinks = [];
226
+ afterLinks.map((afterLink) => draw({ afterLink, afterNodes, api, config, ctx, state }));
167
227
  ctx.restore();
228
+ api.isMf() && drawGroup({ state, ctx });
168
229
  }
169
230
  }
170
- api.isMf() && api.drawArrow();
171
231
  };
172
- const refresh = ({ api, nextTick, state }) => () => {
232
+ const refresh = ({ api, nextTick, state }) => ({ graphWidth = 0, adjustX = 0 } = {}) => {
173
233
  api.removeListeners();
234
+ if (graphWidth && graphWidth !== state.temporary.graphWidth) {
235
+ state.temporary.graphWidth = graphWidth;
236
+ state.temporary.adjustX = adjustX;
237
+ }
174
238
  if (api.isMf()) {
175
239
  api.computeMf();
176
240
  } else {
@@ -180,6 +244,7 @@ const refresh = ({ api, nextTick, state }) => () => {
180
244
  nextTick(() => {
181
245
  api.drawAfterLink();
182
246
  api.addListeners();
247
+ state.temporary.emitter.emit("after-graph-refresh");
183
248
  });
184
249
  };
185
250
  const getAllItem = (props) => (nodes) => {
@@ -215,15 +280,30 @@ const getVars = () => (afterNode, config) => {
215
280
  };
216
281
  const isLinkHover = (state) => (afterLink) => state.hoverAfterLink === afterLink;
217
282
  const omitText = omit;
218
- const buildHoverState = (props) => (afterLinks) => {
283
+ const buildHoverState = (props) => ({ afterGroups, afterLinks }) => {
219
284
  const { config } = props;
220
- const { hoverHit } = config;
221
285
  const hoverMap = /* @__PURE__ */ new WeakMap();
222
286
  const hoverList = [];
287
+ buildLinkHoverState({ afterLinks, hoverMap, hoverList, config });
288
+ const groupHoverMap = /* @__PURE__ */ new WeakMap();
289
+ const groupHoverList = [];
290
+ if (afterGroups) {
291
+ buildGroupHoverState({ afterGroups, groupHoverMap, groupHoverList });
292
+ }
293
+ return { hoverMap, hoverList, groupHoverMap, groupHoverList };
294
+ };
295
+ const buildLinkHoverState = ({ afterLinks, hoverMap, hoverList, config }) => {
296
+ const { hoverHit } = config;
223
297
  const createItem = (cur, next, afterLink) => {
224
298
  if (cur[0] === next[0]) {
225
- const top = cur[1] < next[1] ? cur : next;
226
- const bottom = cur[1] < next[1] ? next : cur;
299
+ let top, bottom;
300
+ if (cur[1] < next[1]) {
301
+ top = cur;
302
+ bottom = next;
303
+ } else {
304
+ top = next;
305
+ bottom = cur;
306
+ }
227
307
  const tri1 = [top[0] + hoverHit, top[1], top[0] - hoverHit, top[1], bottom[0] - hoverHit, bottom[1]];
228
308
  const tri2 = [bottom[0] - hoverHit, bottom[1], bottom[0] + hoverHit, bottom[1], top[0] + hoverHit, top[1]];
229
309
  hoverList.push(tri1);
@@ -231,8 +311,14 @@ const buildHoverState = (props) => (afterLinks) => {
231
311
  hoverList.push(tri2);
232
312
  hoverMap.set(tri2, afterLink);
233
313
  } else if (cur[1] === next[1]) {
234
- const left = cur[0] < next[0] ? cur : next;
235
- const right = cur[0] < next[0] ? next : cur;
314
+ let left, right;
315
+ if (cur[0] < next[0]) {
316
+ left = cur;
317
+ right = next;
318
+ } else {
319
+ left = next;
320
+ right = cur;
321
+ }
236
322
  const tri1 = [left[0], left[1] - hoverHit, left[0], left[1] + hoverHit, right[0], right[1] + hoverHit];
237
323
  const tri2 = [right[0], right[1] + hoverHit, right[0], right[1] - hoverHit, left[0], left[1] - hoverHit];
238
324
  hoverList.push(tri1);
@@ -259,7 +345,17 @@ const buildHoverState = (props) => (afterLinks) => {
259
345
  }
260
346
  });
261
347
  });
262
- return { hoverMap, hoverList };
348
+ };
349
+ const buildGroupHoverState = ({ afterGroups, groupHoverMap, groupHoverList }) => {
350
+ afterGroups.forEach((afterGroup) => {
351
+ const [p0, p1, p2, p3] = afterGroup.coords;
352
+ const tri0 = [p0.x, p3.y, p0.x, p1.y, p2.x, p3.y];
353
+ const tri1 = [p0.x, p1.y, p2.x, p1.y, p2.x, p3.y];
354
+ groupHoverList.push(tri0);
355
+ groupHoverMap.set(tri0, afterGroup);
356
+ groupHoverList.push(tri1);
357
+ groupHoverMap.set(tri1, afterGroup);
358
+ });
263
359
  };
264
360
  const addListeners = ({ api, state, vm }) => () => {
265
361
  api.setListeners();
@@ -276,6 +372,8 @@ const setListeners = ({ api, emit, props, state, vm }) => () => {
276
372
  const { config } = props;
277
373
  const { delay } = config;
278
374
  state.mousemoveListener = debounce(delay, (e) => {
375
+ if (!vm.$refs.canvas)
376
+ return;
279
377
  const { left, top } = vm.$refs.canvas.getBoundingClientRect();
280
378
  const { clientX, clientY } = e;
281
379
  let x = clientX - left;
@@ -288,55 +386,65 @@ const setListeners = ({ api, emit, props, state, vm }) => () => {
288
386
  });
289
387
  state.clickListener = debounce(delay, (e) => {
290
388
  const afterLink = state.hoverAfterLink;
389
+ const afterGroup = state.hoverAfterGroup;
291
390
  if (afterLink) {
292
391
  emit("click-link", afterLink, e);
392
+ } else if (afterGroup) {
393
+ emit("click-group", afterGroup, e);
293
394
  } else {
294
395
  emit("click-blank", null, e);
295
396
  }
296
397
  api.clearDropdown();
297
398
  });
298
399
  };
400
+ const pointInTriangle = (x0, y0, x1, y1, x2, y2, px, py) => {
401
+ const v0 = [x2 - x0, y2 - y0];
402
+ const v1 = [x1 - x0, y1 - y0];
403
+ const v2 = [px - x0, py - y0];
404
+ const dot00 = v0[0] * v0[0] + v0[1] * v0[1];
405
+ const dot01 = v0[0] * v1[0] + v0[1] * v1[1];
406
+ const dot02 = v0[0] * v2[0] + v0[1] * v2[1];
407
+ const dot11 = v1[0] * v1[0] + v1[1] * v1[1];
408
+ const dot12 = v1[0] * v2[0] + v1[1] * v2[1];
409
+ const inverDeno = 1 / (dot00 * dot11 - dot01 * dot01);
410
+ const u = (dot11 * dot02 - dot01 * dot12) * inverDeno;
411
+ if (u < 0 || u > 1) {
412
+ return false;
413
+ }
414
+ const v = (dot00 * dot12 - dot01 * dot02) * inverDeno;
415
+ if (v < 0 || v > 1) {
416
+ return false;
417
+ }
418
+ return u + v <= 1;
419
+ };
299
420
  const hitTest = ({ api, state, vm }) => (x, y) => {
421
+ const { hoverAfterLink = null, hoverAfterGroup = null } = state;
300
422
  const { afterData } = state;
301
423
  const { hoverState } = afterData;
302
- const { hoverMap, hoverList } = hoverState;
303
- const pointInTriangle = (x0, y0, x1, y1, x2, y2, px, py) => {
304
- const v0 = [x2 - x0, y2 - y0];
305
- const v1 = [x1 - x0, y1 - y0];
306
- const v2 = [px - x0, py - y0];
307
- const dot00 = v0[0] * v0[0] + v0[1] * v0[1];
308
- const dot01 = v0[0] * v1[0] + v0[1] * v1[1];
309
- const dot02 = v0[0] * v2[0] + v0[1] * v2[1];
310
- const dot11 = v1[0] * v1[0] + v1[1] * v1[1];
311
- const dot12 = v1[0] * v2[0] + v1[1] * v2[1];
312
- const inverDeno = 1 / (dot00 * dot11 - dot01 * dot01);
313
- const u = (dot11 * dot02 - dot01 * dot12) * inverDeno;
314
- if (u < 0 || u > 1) {
315
- return false;
316
- }
317
- const v = (dot00 * dot12 - dot01 * dot02) * inverDeno;
318
- if (v < 0 || v > 1) {
319
- return false;
320
- }
321
- return u + v <= 1;
322
- };
323
- const tri = hoverList.find((item) => pointInTriangle(...item, x, y));
424
+ const { hoverMap, hoverList, groupHoverMap, groupHoverList } = hoverState;
425
+ let tri = hoverList.find((item) => pointInTriangle(...item, x, y));
324
426
  state.hoverAfterLink = tri ? hoverMap.get(tri) : null;
325
- if (state.hoverAfterLink) {
326
- api.drawAfterLink();
327
- vm.$refs.canvas.style.cursor = "pointer";
328
- } else {
329
- api.clearHoverAfterLink();
427
+ if (!tri) {
428
+ tri = groupHoverList.find((item) => pointInTriangle(...item, x, y));
429
+ state.hoverAfterGroup = tri ? groupHoverMap.get(tri) : null;
430
+ }
431
+ if (hoverAfterLink !== state.hoverAfterLink || hoverAfterGroup !== state.hoverAfterGroup) {
432
+ if (state.hoverAfterLink || state.hoverAfterGroup) {
433
+ vm.$refs.canvas.style.cursor = "pointer";
434
+ api.drawAfterLink();
435
+ } else {
436
+ api.clearHoverAfterLink();
437
+ }
330
438
  }
331
439
  };
332
440
  const clearHoverAfterLink = ({ api, state, vm }) => () => {
333
- if (state.hoverAfterLink) {
441
+ if (state.hoverAfterLink)
334
442
  state.hoverAfterLink = null;
335
- }
336
- api.drawAfterLink();
337
- if (vm.$refs.canvas.style.cursor) {
443
+ if (state.hoverAfterGroup)
444
+ state.hoverAfterGroup = null;
445
+ if (vm.$refs.canvas.style.cursor)
338
446
  vm.$refs.canvas.style.cursor = "";
339
- }
447
+ api.drawAfterLink();
340
448
  };
341
449
  const clickNode = ({ api, emit }) => (params, e) => {
342
450
  const { node, afterNode } = params;
@@ -352,35 +460,37 @@ const clearDropdown = (state) => (nodeName) => {
352
460
  });
353
461
  };
354
462
  const computeMf = ({ api, markRaw, props, state }) => () => {
355
- const { data, config } = props;
356
- const { nodes, links } = hideNodeLink(data);
357
- const { gap = 0, align = "", width = 0, height = 0, padding = 0 } = config;
358
- const { prior = "", radius = 4, font, showArrow = true, lineWidth = 1, arrowEdge = 4 } = config;
359
- const thin = false;
360
- const getRow = buildGetRow(gap);
361
- const getCol = buildGetCol(gap);
362
- const rectRow = buildRectRow({ getRow, gap });
363
- const rectNode = buildRectNode({ rectRow, gap, align, getRow });
364
- const { afterNodes, graph } = buildAfterNodeGraph({ nodes, thin, getRow, getCol, rectNode, padding, width, height });
365
- const { afterLinks, arrows } = buildAfterLinkArrow({
366
- links,
367
- afterNodes,
368
- graph,
369
- prior,
370
- radius,
371
- showArrow,
372
- lineWidth,
373
- arrowEdge
374
- });
375
- const hoverState = api.buildHoverState(afterLinks);
376
- state.afterData = markRaw({ afterNodes, afterLinks, hoverState, graph, arrows });
377
- state.wrapperStyle = `width:${graph.width}px;height:${graph.height}px;font:${font}`;
463
+ const afterConfig = normalConfig(props);
464
+ const { nodes, links, groups } = hideNodeLink(props.data);
465
+ const getRow = buildGetRow({ afterConfig, api });
466
+ const getCol = buildGetCol({ afterConfig, api });
467
+ const rectRow = buildRectRow({ afterConfig, getRow });
468
+ const rectNode = buildRectNode({ afterConfig, api, getRow, rectRow });
469
+ let args = { afterConfig, api, getCol, getRow, groups, nodes, rectNode, state };
470
+ const { afterGroups, afterNodes, graph } = buildAfterNodeGraph(args);
471
+ args = { afterConfig, afterNodes, graph, links };
472
+ const { afterLinks, arrows } = buildAfterLinkArrow(args);
473
+ const hoverState = api.buildHoverState({ afterGroups, afterLinks });
474
+ state.afterData = markRaw({ afterConfig, afterGroups, afterLinks, afterNodes, arrows, graph, hoverState });
475
+ state.wrapperStyle = { width: `${graph.width}px`, height: `${graph.height}px` };
476
+ };
477
+ const normalConfig = (props) => {
478
+ const { config } = props;
479
+ const { align = "", arrowEdge = 4, condHeight = 20, condWidth = 60 } = config;
480
+ const { font = "", gap = 0, height = 0, lineWidth = 1, linkEndMinus = 3 } = config;
481
+ const { padding = 0, prior = "", radius = 4, showArrow = true, width = 0 } = config;
482
+ const { extraWidth = 0, extraHeight = 0 } = config;
483
+ const cfg = { align, arrowEdge, condHeight, condWidth, font, gap, height, lineWidth, linkEndMinus };
484
+ Object.assign(cfg, { padding, prior, radius, showArrow, width, extraWidth, extraHeight });
485
+ const afterConfig = Object.assign({}, config, cfg);
486
+ afterConfig.thin = false;
487
+ return afterConfig;
378
488
  };
379
489
  const isMf = (mode) => () => mode === "mobile-first";
380
- const getNodeDef = (node, type) => {
490
+ const getNodeDef = (props) => (node, type) => {
381
491
  const shape = node.info.shape || "circle";
382
492
  if (shape === "circle")
383
- return 40;
493
+ return props.config.nodeWrapperSize || 40;
384
494
  if (shape === "rectangle") {
385
495
  if (type === "width")
386
496
  return 160;
@@ -389,45 +499,45 @@ const getNodeDef = (node, type) => {
389
499
  }
390
500
  return 0;
391
501
  };
392
- const getNode = (node, type) => {
502
+ const getNode = (api) => (node, type) => {
393
503
  const shape = node.info.shape || "circle";
394
504
  if (shape === "circle") {
395
- return node.info.width || getNodeDef(node, type);
505
+ return node.info.width || api.getNodeDef(node, type);
396
506
  }
397
507
  if (shape === "rectangle") {
398
- return node.info[type] || getNodeDef(node, type);
508
+ return node.info[type] || api.getNodeDef(node, type);
399
509
  }
400
510
  return 0;
401
511
  };
402
- const buildGetRow = (gap) => (afterNodes, row, type) => {
512
+ const buildGetRow = ({ api, afterConfig }) => (afterNodes, row, type) => {
403
513
  const rowAfterNodes = afterNodes.filter((afterNode) => afterNode.row === row);
404
514
  const rowNodes = rowAfterNodes.map((rowAfterNode) => rowAfterNode.raw);
405
515
  if (rowNodes.length > 0) {
406
516
  if (type === "width") {
407
- return rowNodes.reduce((p, c) => p + getNode(c, type), 0) + (rowNodes.length - 1) * gap;
517
+ return rowNodes.reduce((p, c) => p + api.getNode(c, type), 0) + (rowNodes.length - 1) * afterConfig.gap;
408
518
  }
409
519
  if (type === "height") {
410
- return Math.max(...rowNodes.map((rowNode) => getNode(rowNode, type)));
520
+ return Math.max(...rowNodes.map((rowNode) => api.getNode(rowNode, type)));
411
521
  }
412
522
  }
413
523
  return 0;
414
524
  };
415
- const buildGetCol = (gap) => (afterNodes, col, type) => {
525
+ const buildGetCol = ({ api, afterConfig }) => (afterNodes, col, type) => {
416
526
  const colAfterNodes = afterNodes.filter((afterNode) => afterNode.col === col);
417
527
  const colNodes = colAfterNodes.map((colAfterNode) => colAfterNode.raw);
418
528
  if (colNodes.length > 0) {
419
529
  if (type === "width") {
420
- return Math.max(...colNodes.map((colNode) => getNode(colNode, type)));
530
+ return Math.max(...colNodes.map((colNode) => api.getNode(colNode, type)));
421
531
  }
422
532
  if (type === "height") {
423
- return colNodes.reduce((p, c) => p + getNode(c, type), 0) + (colNodes.length - 1) * gap;
533
+ return colNodes.reduce((p, c) => p + api.getNode(c, type), 0) + (colNodes.length - 1) * afterConfig.gap;
424
534
  }
425
535
  }
426
536
  return 0;
427
537
  };
428
- const buildRectRow = ({ getRow, gap }) => (afterNodes, row, graph) => {
538
+ const buildRectRow = ({ getRow, afterConfig }) => (afterNodes, row, graph) => {
429
539
  const accrueRowHeight = Array.from({ length: row }).map((c, i) => i).map((i) => getRow(afterNodes, i, "height")).reduce((p, c) => p + c, 0);
430
- const accrueGapHeight = row > 0 ? row * gap : 0;
540
+ const accrueGapHeight = row > 0 ? row * afterConfig.gap : 0;
431
541
  return {
432
542
  x: 0,
433
543
  y: accrueRowHeight + accrueGapHeight,
@@ -435,30 +545,31 @@ const buildRectRow = ({ getRow, gap }) => (afterNodes, row, graph) => {
435
545
  height: getRow(afterNodes, row, "height")
436
546
  };
437
547
  };
438
- const buildRectNode = ({ rectRow, gap, align, getRow }) => (afterNode, afterNodes, graph) => {
548
+ const buildRectNode = ({ api, rectRow, afterConfig, getRow }) => (afterNode, afterNodes, graph) => {
439
549
  const { row, col } = afterNode;
440
550
  const prevRowRect = rectRow(afterNodes, row - 1, graph);
441
551
  const rowRect = rectRow(afterNodes, row, graph);
442
- const width = getNode(afterNode.raw, "width");
443
- const height = getNode(afterNode.raw, "height");
444
- const y = prevRowRect.y + prevRowRect.height + (row > 0 ? gap : 0) + (rowRect.height - height) / 2;
552
+ const width = api.getNode(afterNode.raw, "width");
553
+ const height = api.getNode(afterNode.raw, "height");
554
+ const y = prevRowRect.y + prevRowRect.height + (row > 0 ? afterConfig.gap : 0) + (rowRect.height - height) / 2;
445
555
  const rowAfterNodes = afterNodes.filter((afterNode2) => afterNode2.row === row);
446
556
  const get = (i) => rowAfterNodes.find((rowAfterNode) => rowAfterNode.col === i);
447
557
  const accrueColWidth = Array.from({ length: col }).map((c, i) => i).map((i) => {
448
558
  const afterNode2 = get(i);
449
- return afterNode2 ? getNode(afterNode2.raw, "width") : 0;
559
+ return afterNode2 ? api.getNode(afterNode2.raw, "width") : 0;
450
560
  }).reduce((p, c) => p + c, 0);
451
- const accrueGapWidth = col > 0 ? col * gap : 0;
452
- const dx = align === "center" ? (graph.width - getRow(afterNodes, row, "width")) / 2 : 0;
561
+ const accrueGapWidth = col > 0 ? col * afterConfig.gap : 0;
562
+ const dx = afterConfig.align === "center" ? (graph.width - getRow(afterNodes, row, "width")) / 2 : 0;
453
563
  const x = accrueColWidth + accrueGapWidth + dx;
454
564
  return { x, y, width, height };
455
565
  };
456
- const normalRowCol = (nodes) => {
566
+ const normalRowCol = ({ afterConfig, nodes }) => {
457
567
  let rows = /* @__PURE__ */ new Set();
458
568
  const rowMap = /* @__PURE__ */ new Map();
569
+ const autoAdjustPos = afterConfig.autoAdjust !== false;
459
570
  nodes.forEach((node) => !rows.has(node.info.row) && rows.add(node.info.row));
460
571
  rows = [...rows].sort((a, b) => a - b);
461
- rows.forEach((row, i) => rowMap.set(row, i));
572
+ rows.forEach((row, i) => rowMap.set(row, autoAdjustPos ? i : row));
462
573
  const afterNodes = nodes.map((node) => {
463
574
  return { type: "node", row: rowMap.get(node.info.row), col: 0, raw: node };
464
575
  });
@@ -468,120 +579,361 @@ const normalRowCol = (nodes) => {
468
579
  const colMap = /* @__PURE__ */ new Map();
469
580
  cols = new Set(cols);
470
581
  cols = [...cols].sort((a, b) => a - b);
471
- cols.forEach((col, i) => colMap.set(col, i));
582
+ cols.forEach((col, i) => colMap.set(col, autoAdjustPos ? i : col));
472
583
  rowAfterNodes.forEach((rowAfterNode) => rowAfterNode.col = colMap.get(rowAfterNode.raw.info.col));
473
584
  });
474
585
  return afterNodes;
475
586
  };
476
- const buildAfterNodeGraph = ({ nodes, thin, getRow, getCol, rectNode, padding, width, height }) => {
477
- const afterNodes = normalRowCol(nodes);
478
- const maxRow = Math.max(...afterNodes.map((afterNode) => afterNode.row));
479
- const maxCol = Math.max(...afterNodes.map((afterNode) => afterNode.col));
480
- const graph = { width: 0, height: 0, thin, thinValue: 1 };
587
+ const defaultLayout = ({ afterConfig, afterNodes, getCol, getRow, graph, maxCol, maxRow, rectNode }) => {
588
+ const { height, padding, width } = afterConfig;
589
+ let tmp;
481
590
  for (let i = 0; i <= maxRow; i++) {
482
- const tmp = getRow(afterNodes, i, "width");
483
- tmp > graph.width && (graph.width = tmp);
591
+ if ((tmp = getRow(afterNodes, i, "width")) > graph.width)
592
+ graph.width = tmp;
484
593
  }
485
594
  for (let i = 0; i <= maxCol; i++) {
486
- const tmp = getCol(afterNodes, i, "height");
487
- tmp > graph.height && (graph.height = tmp);
595
+ if ((tmp = getCol(afterNodes, i, "height")) > graph.height)
596
+ graph.height = tmp;
488
597
  }
489
598
  afterNodes.forEach((afterNode) => Object.assign(afterNode, rectNode(afterNode, afterNodes, graph)));
490
599
  if (padding > 0) {
491
- graph.width += 2 * padding;
492
- graph.height += 2 * padding;
600
+ tmp = 2 * padding;
601
+ graph.width += tmp;
602
+ graph.height += tmp;
493
603
  afterNodes.forEach((afterNode) => {
494
604
  afterNode.x += padding;
495
605
  afterNode.y += padding;
496
606
  });
497
607
  }
498
- let dx = 0;
499
- let dy = 0;
500
608
  if (width > graph.width) {
501
- dx = (width - graph.width) / 2;
609
+ tmp = (width - graph.width) / 2;
502
610
  graph.width = width;
503
- afterNodes.forEach((afterNode) => afterNode.x += dx);
611
+ afterNodes.forEach((afterNode) => afterNode.x += tmp);
504
612
  }
505
613
  if (height > graph.height) {
506
- dy = (height - graph.height) / 2;
614
+ tmp = (height - graph.height) / 2;
507
615
  graph.height = height;
508
- afterNodes.forEach((afterNode) => afterNode.y += dy);
616
+ afterNodes.forEach((afterNode) => afterNode.y += tmp);
509
617
  }
510
- return { afterNodes, graph };
511
618
  };
512
- const adjustLine = ({ lineWidth }) => (f, t) => {
513
- const dpr = window.devicePixelRatio;
514
- const isOdd = lineWidth & 1;
515
- const dx = Math.abs(f.x - t.x);
516
- const isVertical = dx < Number.EPSILON;
517
- if (isOdd) {
619
+ const dotModeAdjust = ({ afterConfig, afterNodes, graph, maxCol, state }) => {
620
+ const { padding } = afterConfig;
621
+ if (afterConfig.type === "dot" && state.temporary.graphWidth) {
622
+ graph.width = state.temporary.graphWidth < graph.minWidth ? graph.minWidth : state.temporary.graphWidth;
623
+ const colSize = (graph.width - 2 * padding) / (maxCol + 1);
624
+ afterNodes.forEach((afterNode) => {
625
+ afterNode.x = ~~((afterNode.col + 0.5) * colSize + padding) + state.temporary.adjustX;
626
+ });
627
+ }
628
+ };
629
+ const customLayout = ({ afterConfig, afterNodes, graph }) => {
630
+ if (typeof afterConfig.layout === "function") {
631
+ const graphHeight = graph.height;
632
+ const graphWidth = graph.width;
633
+ const coords = afterConfig.layout({ afterNodes, graphHeight, graphWidth });
634
+ if (coords && coords.length === afterNodes.length) {
635
+ afterNodes.forEach((afterNode, i) => {
636
+ if (coords[i]) {
637
+ afterNode.x = Number(coords[i].x) || 0;
638
+ afterNode.y = Number(coords[i].y) || 0;
639
+ }
640
+ });
641
+ }
642
+ }
643
+ };
644
+ const calcGraphMinSize = ({ afterConfig, afterNodes, api, graph, maxCol, maxRow }) => {
645
+ const { gap, padding, extraWidth, extraHeight } = afterConfig;
646
+ const maxNodeSize = { width: 0, height: 0 };
647
+ let tempSize;
648
+ afterNodes.forEach((afterNode) => {
649
+ if ((tempSize = api.getNode(afterNode.raw, "width")) > maxNodeSize.width) {
650
+ maxNodeSize.width = tempSize;
651
+ }
652
+ if ((tempSize = api.getNode(afterNode.raw, "height")) > maxNodeSize.height) {
653
+ maxNodeSize.height = tempSize;
654
+ }
655
+ });
656
+ graph.minWidth = (maxCol + 1) * maxNodeSize.width + maxCol * gap + 2 * padding + extraWidth;
657
+ graph.minHeight = (maxRow + 1) * maxNodeSize.height + maxRow * gap + 2 * padding + extraHeight;
658
+ };
659
+ const buildAfterNodeGraph = (args) => {
660
+ const { afterConfig, api, getCol, getRow, groups, nodes, rectNode, state } = args;
661
+ const afterNodes = normalRowCol({ afterConfig, nodes });
662
+ const maxRow = Math.max(...afterNodes.map((afterNode) => afterNode.row));
663
+ const maxCol = Math.max(...afterNodes.map((afterNode) => afterNode.col));
664
+ const graph = { width: 0, height: 0, minWidth: 0, minHeight: 0, thin: afterConfig.thin, thinValue: 1 };
665
+ calcGraphMinSize({ afterConfig, afterNodes, api, graph, maxCol, maxRow });
666
+ defaultLayout({ afterConfig, afterNodes, getCol, getRow, graph, maxCol, maxRow, rectNode });
667
+ dotModeAdjust({ afterConfig, afterNodes, graph, maxCol, state });
668
+ customLayout({ afterConfig, afterNodes, graph });
669
+ const afterGroups = computeGroup({ afterConfig, afterNodes, graph, groups });
670
+ return { afterGroups, afterNodes, graph };
671
+ };
672
+ const computeGroup = ({ afterConfig, afterNodes, graph, groups }) => {
673
+ if (groups && groups.length) {
674
+ return groups.map((group) => {
675
+ const afterGroup = { coords: [], width: 0, height: 0, raw: group };
676
+ const coords = computeGroupCoord({ afterNodes, group });
677
+ const padding = [0, 0];
678
+ const adjust = adjustLine(afterConfig);
679
+ const { condWidth, condHeight } = afterConfig;
680
+ afterGroup.width = condWidth;
681
+ afterGroup.height = condHeight;
682
+ if (typeof group.padding === "number") {
683
+ padding[0] = padding[1] = group.padding;
684
+ } else if (Array.isArray(group.padding) && group.padding.length > 1) {
685
+ padding[0] = group.padding[0];
686
+ padding[1] = group.padding[1];
687
+ }
688
+ coords[0] = coords[0] - padding[1] < 0 ? 0 : coords[0] - padding[1];
689
+ coords[1] = coords[1] + padding[1] > graph.width ? graph.width : coords[1] + padding[1];
690
+ coords[2] = coords[2] - padding[0] < 0 ? 0 : coords[2] - padding[0];
691
+ coords[3] = coords[3] + padding[0] > graph.height ? graph.height : coords[3] + padding[0];
692
+ const p0 = { x: coords[0], y: coords[2] };
693
+ const p1 = { x: coords[0], y: coords[3] };
694
+ const p2 = { x: coords[1], y: coords[3] };
695
+ const p3 = { x: coords[1], y: coords[2] };
696
+ adjust({ from: p0, to: p1 });
697
+ adjust({ from: p1, to: p2 });
698
+ adjust({ from: p2, to: p3 });
699
+ adjust({ from: p3, to: p0 });
700
+ const dx = ~~((p3.x - p0.x) / 2);
701
+ const dy = ~~((p1.y - p0.y) / 2);
702
+ p0.y += dy;
703
+ p1.x += dx;
704
+ p2.y -= dy;
705
+ p3.x -= dx;
706
+ afterGroup.coords.push(p0, p1, p2, p3);
707
+ return afterGroup;
708
+ });
709
+ }
710
+ };
711
+ const computeGroupCoord = ({ afterNodes, group }) => {
712
+ const points = [];
713
+ const coords = ["", "", "", ""];
714
+ group.nodes.map((name) => afterNodes.find((afterNode) => afterNode.raw.name === name)).forEach(({ x, y, width, height }) => {
715
+ points.push({ x, y });
716
+ points.push({ x: x + width, y: y + height });
717
+ });
718
+ points.forEach(({ x, y }) => {
719
+ if (typeof coords[0] !== "number" || x < coords[0])
720
+ coords[0] = x;
721
+ if (typeof coords[1] !== "number" || x > coords[1])
722
+ coords[1] = x;
723
+ if (typeof coords[2] !== "number" || y < coords[2])
724
+ coords[2] = y;
725
+ if (typeof coords[3] !== "number" || y > coords[3])
726
+ coords[3] = y;
727
+ });
728
+ return coords;
729
+ };
730
+ const adjustLineEnd = ({ arrowEndMinus, e, from, isVertical, linkEndMinus, linkOffset, s, to }) => {
731
+ if (s) {
518
732
  if (isVertical) {
519
- f.x = t.x = Math.floor(f.x) + 0.5 / dpr;
733
+ to.y += (to.y > from.y ? -1 : 1) * (linkEndMinus + (arrowEndMinus || 0));
520
734
  } else {
521
- f.y = t.y = Math.floor(f.y) + 0.5 / dpr;
735
+ to.x += (to.x > from.x ? -1 : 1) * (linkEndMinus + (arrowEndMinus || 0));
522
736
  }
523
- } else {
737
+ }
738
+ if (e) {
524
739
  if (isVertical) {
525
- f.x = t.x = Math.floor(f.x);
740
+ from.y += (to.y > from.y ? 1 : -1) * (linkOffset || 0);
526
741
  } else {
527
- f.y = t.y = Math.floor(f.y);
742
+ from.x += (to.x > from.x ? 1 : -1) * (linkOffset || 0);
528
743
  }
529
744
  }
530
745
  };
531
- const buildAfterLinkArrow = ({ links, afterNodes, graph, prior, radius, showArrow, lineWidth, arrowEdge }) => {
532
- const arrows = [];
533
- const buildArrow = getBuildArrow({ arrows, arrowEdge });
534
- const adjust = adjustLine({ lineWidth });
535
- const afterLinks = links.map((link) => {
536
- const { from, to, fromJoint = "bottom", toJoint = "top" } = link;
537
- const fromAfterNode = afterNodes.find((afterNode) => afterNode.raw.name === from);
538
- const toAfterNode = afterNodes.find((afterNode) => afterNode.raw.name === to);
539
- const f = point(fromAfterNode, fromJoint, graph);
540
- const t = point(toAfterNode, toJoint, graph);
541
- const p = [];
542
- const dx = Math.abs(f.x - t.x);
543
- const dy = Math.abs(f.y - t.y);
544
- if (dx < Number.EPSILON || dy < Number.EPSILON) {
545
- adjust(f, t);
746
+ const adjustLine = ({ lineWidth, linkEndMinus }) => ({ from, to, s, arrowEndMinus, e, linkOffset }) => {
747
+ const dpr = window.devicePixelRatio;
748
+ const isOdd = lineWidth & 1;
749
+ const dx = Math.abs(from.x - to.x);
750
+ const isVertical = dx < Number.EPSILON;
751
+ if (isVertical) {
752
+ from.x = to.x = Math.floor(from.x) + (isOdd ? 0.5 / dpr : 0);
753
+ } else {
754
+ from.y = to.y = Math.floor(from.y) + (isOdd ? 0.5 / dpr : 0);
755
+ }
756
+ adjustLineEnd({ arrowEndMinus, e, from, isVertical, linkEndMinus, linkOffset, s, to });
757
+ return { x: ~~((from.x + to.x) / 2), y: ~~((from.y + to.y) / 2) };
758
+ };
759
+ const pathParser = ({ adjust, afterLink, arrow, linear, midpoint, middir, points, radius }) => {
760
+ const arrowEndMinus = afterLink.raw.arrowEndMinus;
761
+ const linkOffset = afterLink.raw.linkOffset;
762
+ const len = points.length;
763
+ const p = [];
764
+ for (let i = 1; i < len; i++) {
765
+ adjust({ from: points[i - 1], to: points[i], s: i === len - 1, arrowEndMinus, e: i === 1, linkOffset });
766
+ }
767
+ const prevPoint = points[points.length - 2];
768
+ const lastPoint = points[points.length - 1];
769
+ if (len === 2) {
770
+ p.push(`m,${points[0].x},${points[0].y}`);
771
+ p.push(`l,${points[1].x},${points[1].y}`);
772
+ } else {
773
+ for (let i = 0; i < len - 1; i++) {
774
+ if (i === 0) {
775
+ p.push(`m,${points[i].x},${points[i].y}`);
776
+ } else {
777
+ p.push(`a,${points[i].x},${points[i].y},${points[i + 1].x},${points[i + 1].y},${radius}`);
778
+ }
779
+ }
780
+ p.push(`l,${lastPoint.x},${lastPoint.y}`);
781
+ }
782
+ afterLink.p = p;
783
+ if (linear) {
784
+ afterLink.linearGrad = { from: points[0], to: lastPoint, linear };
785
+ }
786
+ if (midpoint) {
787
+ afterLink.mid = midpoint;
788
+ } else {
789
+ afterLink.mid = { x: ~~((prevPoint.x + lastPoint.x) / 2), y: ~~((prevPoint.y + lastPoint.y) / 2) };
790
+ middir = getMiddir(prevPoint, lastPoint);
791
+ }
792
+ afterLink.middir = middir;
793
+ arrow(prevPoint, lastPoint);
794
+ };
795
+ const getMiddir = (prev, last) => {
796
+ let middir = "r";
797
+ if (prev.x !== last.x) {
798
+ middir = prev.x > last.x ? "l" : "r";
799
+ } else if (prev.y !== last.y) {
800
+ middir = prev.y > last.y ? "u" : "d";
801
+ }
802
+ return middir;
803
+ };
804
+ const validLinkPath = (res) => {
805
+ let points, midpoint, middir, linear, flag;
806
+ if (Array.isArray(res) && res.length > 1) {
807
+ points = res;
808
+ midpoint = null;
809
+ middir = null;
810
+ linear = null;
811
+ flag = true;
812
+ } else if (res && Array.isArray(res.path) && res.path.length > 1) {
813
+ points = res.path;
814
+ midpoint = res.mid ? res.mid : null;
815
+ middir = res.middir || "r";
816
+ linear = res.linear ? res.linear : null;
817
+ flag = true;
818
+ }
819
+ return { points, midpoint, middir, linear, flag };
820
+ };
821
+ const customRoute = ({ adjust, afterConfig, afterLink, afterNodes, arrow }) => {
822
+ const { linkPath, radius } = afterConfig;
823
+ let valid = false;
824
+ if (Array.isArray(linkPath)) {
825
+ for (let i = 0; i < linkPath.length; i++) {
826
+ if (hitMatch(linkPath[i], afterLink)) {
827
+ const { points, midpoint, middir, linear, flag } = validLinkPath(linkPath[i].method({ afterLink, afterNodes }));
828
+ if (flag) {
829
+ valid = true;
830
+ pathParser({ adjust, afterLink, arrow, linear, midpoint, middir, points, radius });
831
+ }
832
+ break;
833
+ }
834
+ }
835
+ } else if (linkPath && typeof linkPath.method === "function") {
836
+ if (hitMatch(linkPath, afterLink)) {
837
+ const { points, midpoint, middir, linear, flag } = validLinkPath(linkPath.method({ afterLink, afterNodes }));
838
+ if (flag) {
839
+ valid = true;
840
+ pathParser({ adjust, afterLink, arrow, linear, midpoint, middir, points, radius });
841
+ }
842
+ }
843
+ }
844
+ return valid;
845
+ };
846
+ const defaultRoute = (args) => {
847
+ const { adjust, afterConfig, afterLink, arrow, link } = args;
848
+ const { prior, radius } = afterConfig;
849
+ const { f, t, p } = afterLink;
850
+ const { arrowEndMinus, linkOffset } = link;
851
+ const dx = Math.abs(f.x - t.x);
852
+ const dy = Math.abs(f.y - t.y);
853
+ if (dx < Number.EPSILON || dy < Number.EPSILON) {
854
+ afterLink.mid = adjust({ from: f, to: t, s: 1, arrowEndMinus, e: 1, linkOffset });
855
+ afterLink.middir = getMiddir(f, t);
856
+ p.push(`m,${f.x},${f.y}`);
857
+ p.push(`l,${t.x},${t.y}`);
858
+ arrow(f, t);
859
+ } else {
860
+ const mid = [(f.x + t.x) / 2, (f.y + t.y) / 2];
861
+ if (!prior || prior === "vertical") {
862
+ const tmp0 = { x: f.x, y: mid[1] };
863
+ const tmp1 = { x: t.x, y: mid[1] };
864
+ adjust({ from: f, to: tmp0, s: 0, e: 1, linkOffset });
865
+ afterLink.mid = adjust({ from: tmp0, to: tmp1, s: 0, e: 0 });
866
+ afterLink.middir = getMiddir(tmp0, tmp1);
867
+ adjust({ from: tmp1, to: t, s: 1, arrowEndMinus, e: 0 });
868
+ mid[1] = tmp0.y;
546
869
  p.push(`m,${f.x},${f.y}`);
870
+ p.push(`a,${f.x},${mid[1]},${mid[0]},${mid[1]},${radius}`);
871
+ p.push(`a,${t.x},${mid[1]},${t.x},${t.y},${radius}`);
547
872
  p.push(`l,${t.x},${t.y}`);
548
- showArrow && buildArrow([f.x, f.y], [t.x, t.y], link);
549
- } else {
550
- const mid = [(f.x + t.x) / 2, (f.y + t.y) / 2];
551
- if (!prior || prior === "vertical") {
552
- const tmp0 = { x: f.x, y: mid[1] };
553
- const tmp1 = { x: t.x, y: mid[1] };
554
- adjust(f, tmp0);
555
- adjust(tmp0, tmp1);
556
- adjust(tmp1, t);
557
- mid[1] = tmp0.y;
558
- p.push(`m,${f.x},${f.y}`);
559
- p.push(`a,${f.x},${mid[1]},${mid[0]},${mid[1]},${radius}`);
560
- p.push(`a,${t.x},${mid[1]},${t.x},${t.y},${radius}`);
561
- p.push(`l,${t.x},${t.y}`);
562
- showArrow && buildArrow([t.x, mid[1]], [t.x, t.y], link);
563
- } else if (prior === "horizontal") {
564
- const tmp0 = { x: mid[0], y: f.y };
565
- const tmp1 = { x: mid[0], y: t.y };
566
- adjust(f, tmp0);
567
- adjust(tmp0, tmp1);
568
- adjust(tmp1, t);
569
- mid[0] = tmp0.x;
570
- p.push(`m,${f.x},${f.y}`);
571
- p.push(`a,${mid[0]},${f.y},${mid[0]},${mid[1]},${radius}`);
572
- p.push(`a,${mid[0]},${t.y},${t.x},${t.y},${radius}`);
573
- p.push(`l,${t.x},${t.y}`);
574
- showArrow && buildArrow([mid[0], t.y], [t.x, t.y], link);
575
- }
873
+ arrow({ x: t.x, y: mid[1] }, t);
874
+ } else if (prior === "horizontal") {
875
+ const tmp0 = { x: mid[0], y: f.y };
876
+ const tmp1 = { x: mid[0], y: t.y };
877
+ adjust({ from: f, to: tmp0, s: 0, e: 1, linkOffset });
878
+ afterLink.mid = adjust({ from: tmp0, to: tmp1, s: 0, e: 0 });
879
+ afterLink.middir = getMiddir(tmp0, tmp1);
880
+ adjust({ from: tmp1, to: t, s: 1, arrowEndMinus, e: 0 });
881
+ mid[0] = tmp0.x;
882
+ p.push(`m,${f.x},${f.y}`);
883
+ p.push(`a,${mid[0]},${f.y},${mid[0]},${mid[1]},${radius}`);
884
+ p.push(`a,${mid[0]},${t.y},${t.x},${t.y},${radius}`);
885
+ p.push(`l,${t.x},${t.y}`);
886
+ arrow({ x: mid[0], y: t.y }, t);
887
+ }
888
+ }
889
+ };
890
+ const computeLinkEnds = ({ afterNodes, graph, link }) => {
891
+ const { from, to } = link;
892
+ const f = point({
893
+ afterNode: afterNodes.find((afterNode) => afterNode.raw.name === from),
894
+ graph,
895
+ link,
896
+ type: 0
897
+ });
898
+ const t = point({
899
+ afterNode: afterNodes.find((afterNode) => afterNode.raw.name === to),
900
+ graph,
901
+ link,
902
+ type: 1
903
+ });
904
+ return { f, t };
905
+ };
906
+ const buildAfterLinkArrow = (args) => {
907
+ let { afterConfig, afterNodes, graph, links } = args;
908
+ const { condWidth, condHeight } = afterConfig;
909
+ const arrows = [];
910
+ const buildArrow = getBuildArrow({ arrows, afterConfig });
911
+ const adjust = adjustLine(afterConfig);
912
+ const afterLinks = links.map((link) => {
913
+ const { f, t } = computeLinkEnds({ afterNodes, graph, link });
914
+ const cond = !!(link && link.info.other && link.info.other.title);
915
+ const afterLink = { arrow: null, cond, f, linearGrad: null, mid: null };
916
+ Object.assign(afterLink, { p: [], raw: link, rect: null, t, type: "link" });
917
+ const arrow = (f2, t2) => buildArrow(f2, t2, link, afterLink);
918
+ const flag = customRoute({ adjust, afterConfig, afterLink, afterNodes, arrow });
919
+ if (!flag) {
920
+ defaultRoute({ adjust, afterConfig, afterLink, arrow, link });
576
921
  }
577
- return { type: "link", f, t, p, raw: link };
922
+ afterLink.rect = {
923
+ x: ~~(afterLink.mid.x - condWidth / 2),
924
+ y: ~~(afterLink.mid.y - condHeight / 2),
925
+ w: condWidth,
926
+ h: condHeight
927
+ };
928
+ return afterLink;
578
929
  });
579
930
  return { afterLinks, arrows };
580
931
  };
581
- const point = (afterNode, joint, graph) => {
932
+ const point = ({ afterNode, graph, link, type }) => {
582
933
  const exp = /^(bottom|top|left|right)$/;
583
934
  const variant = /^(bottom|top|left|right)-(\d+)\/(\d+)$/;
584
935
  const res = { x: 0, y: 0 };
936
+ const joint = type ? link.toJoint || "top" : link.fromJoint || "bottom";
585
937
  if (exp.test(joint)) {
586
938
  if (joint === "bottom") {
587
939
  res.x = afterNode.x + afterNode.width / 2;
@@ -621,66 +973,110 @@ const point = (afterNode, joint, graph) => {
621
973
  }
622
974
  return res;
623
975
  };
624
- const getBuildArrow = ({ arrows, arrowEdge }) => (from, to, link) => {
625
- const p0 = [0, 0];
626
- const p2 = [0, 0];
627
- const dx = from[0] - to[0];
628
- const dy = from[1] - to[1];
976
+ const getBuildArrow = ({ arrows, afterConfig }) => (from, to, link, afterLink) => {
977
+ const { arrowEdge, linkEndMinus, showArrow } = afterConfig;
978
+ const { showArrow: linkShowArrow = true } = link;
979
+ if (!showArrow || !linkShowArrow)
980
+ return;
981
+ const p0 = { x: 0, y: 0 };
982
+ const p2 = { x: 0, y: 0 };
983
+ const dx = from.x - to.x;
984
+ const dy = from.y - to.y;
629
985
  const absx = Math.abs(dx);
630
986
  const absy = Math.abs(dy);
631
987
  let t = 1;
632
988
  const edge = arrowEdge;
633
989
  if (absx < Number.EPSILON) {
634
990
  t = dy > 0 ? 1 : dy < 0 ? -1 : 1;
635
- p0[0] = to[0] - edge;
636
- p0[1] = to[1] + Math.sqrt(3) * edge * t;
637
- p2[0] = to[0] + edge;
638
- p2[1] = p0[1];
991
+ to.y -= t * linkEndMinus;
992
+ p0.x = to.x - edge;
993
+ p0.y = to.y + Math.sqrt(3) * edge * t;
994
+ p2.x = to.x + edge;
995
+ p2.y = p0.y;
639
996
  if (dy !== 0) {
640
- arrows.push({ p0, p1: to, p2, link });
997
+ arrows.push(afterLink.arrow = { p0, p1: to, p2, link });
641
998
  }
642
999
  }
643
1000
  if (absy < Number.EPSILON) {
644
1001
  t = dx > 0 ? 1 : dx < 0 ? -1 : 1;
645
- p0[0] = to[0] + Math.sqrt(3) * edge * t;
646
- p0[1] = to[1] - edge;
647
- p2[0] = p0[0];
648
- p2[1] = to[1] + edge;
1002
+ to.x -= t * linkEndMinus;
1003
+ p0.x = to.x + Math.sqrt(3) * edge * t;
1004
+ p0.y = to.y - edge;
1005
+ p2.x = p0.x;
1006
+ p2.y = to.y + edge;
649
1007
  if (dx !== 0) {
650
- arrows.push({ p0, p1: to, p2, link });
1008
+ arrows.push(afterLink.arrow = { p0, p1: to, p2, link });
651
1009
  }
652
1010
  }
653
1011
  };
654
1012
  const hideNodeLink = (data) => {
655
- let { nodes, links } = data;
1013
+ let { nodes, links, groups } = data;
656
1014
  const hiddenNodeNames = nodes.filter((node) => node.hidden === true).map((node) => node.name);
657
1015
  nodes = nodes.filter((node) => node.hidden !== true);
658
1016
  links = links.filter((link) => !~hiddenNodeNames.indexOf(link.from) && !~hiddenNodeNames.indexOf(link.to));
659
- return { nodes, links };
1017
+ if (Array.isArray(groups)) {
1018
+ groups = groups.filter((group) => {
1019
+ group.nodes = group.nodes.filter((name) => !~hiddenNodeNames.indexOf(name));
1020
+ return group.nodes.length > 0;
1021
+ });
1022
+ }
1023
+ return { nodes, links, groups };
660
1024
  };
661
- const drawArrow = ({ state, vm, props }) => () => {
662
- const { $refs } = vm;
663
- const { config } = props;
664
- const { showArrow = true } = config;
1025
+ const drawArrow = ({ afterLink, config, ctx, state }) => {
1026
+ const { arrow } = afterLink;
1027
+ ctx.save();
1028
+ if (arrow && !~state.temporary.customLinks.indexOf(arrow.link)) {
1029
+ ctx.beginPath();
1030
+ ctx.moveTo(arrow.p0.x, arrow.p0.y);
1031
+ ctx.lineTo(arrow.p1.x, arrow.p1.y);
1032
+ ctx.lineTo(arrow.p2.x, arrow.p2.y);
1033
+ ctx.closePath();
1034
+ if (afterLink._grad) {
1035
+ ctx.fillStyle = afterLink._grad;
1036
+ afterLink._grad = null;
1037
+ } else {
1038
+ ctx.fillStyle = config.colors[arrow.link.info.status];
1039
+ }
1040
+ ctx.fill();
1041
+ }
1042
+ ctx.restore();
1043
+ };
1044
+ const drawGroup = ({ state, ctx }) => {
665
1045
  const { afterData } = state;
666
- const { arrows } = afterData;
667
- if (showArrow && $refs.canvas && $refs.canvas.getContext) {
668
- const ctx = $refs.canvas.getContext("2d");
669
- if (ctx) {
1046
+ const { afterConfig, afterGroups } = afterData;
1047
+ const { showGroup = true, radius } = afterConfig;
1048
+ if (showGroup && ctx && afterGroups) {
1049
+ afterGroups.forEach((afterGroup) => {
1050
+ const [p0, p1, p2, p3] = afterGroup.coords;
670
1051
  ctx.save();
671
- arrows.forEach((arrow) => {
672
- ctx.beginPath();
673
- ctx.moveTo(...arrow.p0);
674
- ctx.lineTo(...arrow.p1);
675
- ctx.lineTo(...arrow.p2);
676
- ctx.closePath();
677
- ctx.fillStyle = config.colors[arrow.link.info.status];
1052
+ ctx.beginPath();
1053
+ ctx.moveTo(p0.x, p0.y);
1054
+ ctx.arcTo(p0.x, p1.y, p1.x, p1.y, radius);
1055
+ ctx.arcTo(p2.x, p1.y, p2.x, p2.y, radius);
1056
+ ctx.arcTo(p2.x, p3.y, p3.x, p3.y, radius);
1057
+ ctx.arcTo(p0.x, p3.y, p0.x, p0.y, radius);
1058
+ ctx.closePath();
1059
+ ctx.globalAlpha = 0.3;
1060
+ if (afterGroup.raw.fillStyle) {
1061
+ ctx.fillStyle = afterGroup.raw.fillStyle;
678
1062
  ctx.fill();
679
- });
1063
+ }
1064
+ if (afterGroup.raw.strokeStyle) {
1065
+ ctx.strokeStyle = afterGroup.raw.strokeStyle;
1066
+ if (Array.isArray(afterGroup.raw.lineDash)) {
1067
+ ctx.setLineDash(afterGroup.raw.lineDash);
1068
+ } else {
1069
+ ctx.setLineDash([3, 3]);
1070
+ }
1071
+ ctx.stroke();
1072
+ }
680
1073
  ctx.restore();
681
- }
1074
+ });
682
1075
  }
683
1076
  };
1077
+ const clickGroup = (emit) => (afterGroup, e) => {
1078
+ emit("click-group", afterGroup, e);
1079
+ };
684
1080
  const antialiasing = (vm) => () => {
685
1081
  const canvas = vm.$refs.canvas;
686
1082
  const context = canvas.getContext("2d");
@@ -695,6 +1091,28 @@ const antialiasing = (vm) => () => {
695
1091
  context.scale(dpr, dpr);
696
1092
  }
697
1093
  };
1094
+ const handleNodeResize = ({ state, vm }) => () => {
1095
+ const el = vm.$el;
1096
+ const { padding, height } = state.temporary;
1097
+ state.nodeHeight = el.offsetHeight;
1098
+ state.isSmall = (state.sizeMini || state.sizeMedium) && Math.abs(state.nodeHeight - height) < 0.1 || state.sizeSmall;
1099
+ if (state.layUpdown) {
1100
+ const titleWidth = vm.$refs.title.offsetWidth;
1101
+ const iconWidth = vm.$refs.icon.offsetWidth;
1102
+ state.posLeft = ~~((titleWidth - iconWidth) / 2);
1103
+ state.nodeWidth = iconWidth + padding;
1104
+ } else {
1105
+ let paddingLeft;
1106
+ if (state.isSmall) {
1107
+ paddingLeft = 24;
1108
+ } else if (state.sizeMini) {
1109
+ paddingLeft = 16;
1110
+ } else if (state.sizeMedium) {
1111
+ paddingLeft = 32;
1112
+ }
1113
+ state.nodeWidth = vm.$refs.title.offsetWidth + paddingLeft + padding;
1114
+ }
1115
+ };
698
1116
  export {
699
1117
  addListeners,
700
1118
  antialiasing,
@@ -703,13 +1121,16 @@ export {
703
1121
  buildHoverState,
704
1122
  clearDropdown,
705
1123
  clearHoverAfterLink,
1124
+ clickGroup,
706
1125
  clickNode,
707
1126
  compute,
708
1127
  computeMf,
709
1128
  drawAfterLink,
710
- drawArrow,
711
1129
  getAllItem,
1130
+ getNode,
1131
+ getNodeDef,
712
1132
  getVars,
1133
+ handleNodeResize,
713
1134
  hitTest,
714
1135
  initDropdowns,
715
1136
  isLinkHover,