vxe-pc-ui 4.20.34 → 4.20.35

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 (367) hide show
  1. package/dist/all.esm.js +45718 -45038
  2. package/dist/all.esm.min.js +3 -3
  3. package/dist/style.css +307 -1
  4. package/dist/style.mini.css +1 -1
  5. package/es/alert/src/alert.js +117 -114
  6. package/es/anchor/src/anchor-link.js +110 -107
  7. package/es/anchor/src/anchor.js +212 -209
  8. package/es/avatar/src/avatar.js +132 -129
  9. package/es/backtop/src/backtop.js +267 -264
  10. package/es/badge/src/badge.js +102 -99
  11. package/es/breadcrumb/src/breadcrumb-item.js +104 -101
  12. package/es/breadcrumb/src/breadcrumb.js +70 -67
  13. package/es/button/src/button-group.js +88 -85
  14. package/es/calendar/src/calendar.js +1371 -1368
  15. package/es/card/src/card.js +235 -232
  16. package/es/carousel/src/carousel-item.js +78 -75
  17. package/es/carousel/src/carousel.js +392 -389
  18. package/es/cascader/src/cascader.js +1667 -1664
  19. package/es/checkbox/src/button.js +198 -195
  20. package/es/checkbox/src/checkbox.js +181 -178
  21. package/es/checkbox/src/group.js +210 -207
  22. package/es/collapse/src/collapse-pane.js +98 -95
  23. package/es/collapse/src/collapse.js +340 -337
  24. package/es/color-picker/src/color-picker.js +1116 -1113
  25. package/es/components.d.ts +1 -0
  26. package/es/components.js +3 -0
  27. package/es/context-menu/src/context-menu.js +601 -598
  28. package/es/countdown/src/countdown.js +224 -221
  29. package/es/date-panel/src/date-panel.js +1905 -1902
  30. package/es/date-picker/src/date-picker.js +1537 -1534
  31. package/es/date-range-picker/src/date-range-picker.js +1412 -1409
  32. package/es/divider/src/divider.js +80 -77
  33. package/es/drawer/src/drawer.js +778 -775
  34. package/es/empty/src/empty.js +100 -97
  35. package/es/form/src/form-group.js +74 -71
  36. package/es/form/src/form-item.js +76 -73
  37. package/es/form/src/form.js +789 -786
  38. package/es/icon/src/icon.js +59 -56
  39. package/es/icon/style.css +1 -1
  40. package/es/icon/style.mini.css +1 -1
  41. package/es/icon-picker/src/icon-picker.js +719 -716
  42. package/es/image/src/group.js +130 -127
  43. package/es/image/src/image.js +243 -240
  44. package/es/image/src/preview.js +627 -624
  45. package/es/index.esm.js +2 -0
  46. package/es/index.js +2 -0
  47. package/es/input/src/input.js +2700 -2697
  48. package/es/layout-aside/src/layout-aside.js +138 -135
  49. package/es/layout-body/src/layout-body.js +145 -142
  50. package/es/layout-container/src/layout-container.js +71 -68
  51. package/es/layout-footer/src/layout-footer.js +60 -57
  52. package/es/layout-header/src/layout-header.js +58 -55
  53. package/es/link/src/link.js +131 -128
  54. package/es/list/src/list.js +2174 -2171
  55. package/es/loading/src/loading.js +141 -138
  56. package/es/mention/src/mention.js +49 -46
  57. package/es/menu/src/menu.js +799 -796
  58. package/es/modal/src/modal.js +1519 -1527
  59. package/es/notice-bar/src/notice-bar.js +168 -165
  60. package/es/number-input/src/number-input.js +1094 -1091
  61. package/es/pager/src/pager.js +767 -764
  62. package/es/password-input/src/password-input.js +431 -428
  63. package/es/print/src/page-break.js +63 -60
  64. package/es/print/src/print.js +303 -300
  65. package/es/pulldown/src/pulldown.js +403 -400
  66. package/es/radio/src/button.js +214 -211
  67. package/es/radio/src/group.js +195 -192
  68. package/es/radio/src/radio.js +194 -191
  69. package/es/rate/src/rate.js +164 -161
  70. package/es/result/src/result.js +116 -113
  71. package/es/row/src/col.js +133 -130
  72. package/es/row/src/row.js +111 -108
  73. package/es/scrollbar/src/scrollbar.js +518 -515
  74. package/es/segmented/src/segmented.js +240 -237
  75. package/es/select/src/optgroup.js +44 -41
  76. package/es/select/src/option.js +39 -36
  77. package/es/select/src/select.js +1914 -1896
  78. package/es/slider/src/slider.js +419 -416
  79. package/es/space/src/space.js +190 -187
  80. package/es/splitter/src/splitter-panel.js +146 -143
  81. package/es/splitter/src/splitter.js +917 -914
  82. package/es/step-item/index.d.ts +76 -0
  83. package/es/step-item/index.js +17 -0
  84. package/es/steps/index.d.ts +288 -34
  85. package/es/steps/src/step-info.d.ts +6 -0
  86. package/es/steps/src/step-info.js +20 -0
  87. package/es/steps/src/step-item.d.ts +14 -0
  88. package/es/steps/src/step-item.js +39 -0
  89. package/es/steps/src/steps.d.ts +68 -8
  90. package/es/steps/src/steps.js +299 -47
  91. package/es/steps/src/util.d.ts +7 -0
  92. package/es/steps/src/util.js +44 -0
  93. package/es/steps/style.css +297 -0
  94. package/es/steps/style.mini.css +1 -0
  95. package/es/style.css +307 -1
  96. package/es/style.mini.css +1 -1
  97. package/es/switch/src/switch.js +228 -225
  98. package/es/table-select/src/table-select.js +865 -862
  99. package/es/table-transfer/src/table-transfer.js +61 -58
  100. package/es/tabs/src/tab-pane.js +102 -99
  101. package/es/tabs/src/tabs.js +936 -933
  102. package/es/tag/src/tag.js +163 -160
  103. package/es/text/src/text.js +232 -229
  104. package/es/text-ellipsis/src/text-ellipsis.js +252 -249
  105. package/es/textarea/src/textarea.js +434 -431
  106. package/es/timeline/src/timeline.js +74 -36
  107. package/es/timeline/src/util.js +7 -4
  108. package/es/tip/src/tip.js +117 -114
  109. package/es/tooltip/src/tooltip.js +552 -549
  110. package/es/tour/src/tour.js +49 -46
  111. package/es/transfer/src/transfer.js +95 -92
  112. package/es/tree/src/tree.js +3379 -3376
  113. package/es/tree-select/src/tree-select.js +969 -966
  114. package/es/ui/index.js +8 -2
  115. package/es/ui/src/log.js +1 -1
  116. package/es/upload/src/upload.js +1791 -1788
  117. package/es/vxe-icon/style.css +1 -1
  118. package/es/vxe-icon/style.mini.css +1 -1
  119. package/es/vxe-steps/style.css +297 -0
  120. package/es/vxe-steps/style.mini.css +1 -0
  121. package/es/watermark/src/watermark.js +158 -155
  122. package/lib/alert/src/alert.js +117 -114
  123. package/lib/anchor/src/anchor-link.js +110 -107
  124. package/lib/anchor/src/anchor.js +212 -209
  125. package/lib/avatar/src/avatar.js +132 -129
  126. package/lib/backtop/src/backtop.js +267 -264
  127. package/lib/badge/src/badge.js +102 -99
  128. package/lib/breadcrumb/src/breadcrumb-item.js +104 -101
  129. package/lib/breadcrumb/src/breadcrumb.js +70 -67
  130. package/lib/button/src/button-group.js +88 -85
  131. package/lib/calendar/src/calendar.js +1371 -1368
  132. package/lib/card/src/card.js +235 -232
  133. package/lib/carousel/src/carousel-item.js +78 -75
  134. package/lib/carousel/src/carousel.js +392 -389
  135. package/lib/cascader/src/cascader.js +1665 -1662
  136. package/lib/checkbox/src/button.js +198 -195
  137. package/lib/checkbox/src/checkbox.js +181 -178
  138. package/lib/checkbox/src/group.js +210 -207
  139. package/lib/collapse/src/collapse-pane.js +98 -95
  140. package/lib/collapse/src/collapse.js +340 -337
  141. package/lib/color-picker/src/color-picker.js +1116 -1113
  142. package/lib/components.js +3 -0
  143. package/lib/context-menu/src/context-menu.js +601 -598
  144. package/lib/countdown/src/countdown.js +224 -221
  145. package/lib/date-panel/src/date-panel.js +1905 -1902
  146. package/lib/date-picker/src/date-picker.js +1537 -1534
  147. package/lib/date-range-picker/src/date-range-picker.js +1412 -1409
  148. package/lib/divider/src/divider.js +80 -77
  149. package/lib/drawer/src/drawer.js +778 -775
  150. package/lib/empty/src/empty.js +100 -97
  151. package/lib/form/src/form-group.js +74 -71
  152. package/lib/form/src/form-item.js +76 -73
  153. package/lib/form/src/form.js +789 -786
  154. package/lib/icon/src/icon.js +59 -56
  155. package/lib/icon/style/style.css +1 -1
  156. package/lib/icon/style/style.mini.css +1 -1
  157. package/lib/icon-picker/src/icon-picker.js +719 -716
  158. package/lib/image/src/group.js +130 -127
  159. package/lib/image/src/image.js +243 -240
  160. package/lib/image/src/preview.js +627 -624
  161. package/lib/index.common.js +2 -0
  162. package/lib/index.js +2 -0
  163. package/lib/index.umd.js +47411 -46732
  164. package/lib/index.umd.min.js +3 -3
  165. package/lib/input/src/input.js +2700 -2697
  166. package/lib/layout-aside/src/layout-aside.js +138 -135
  167. package/lib/layout-body/src/layout-body.js +145 -142
  168. package/lib/layout-container/src/layout-container.js +71 -68
  169. package/lib/layout-footer/src/layout-footer.js +60 -57
  170. package/lib/layout-header/src/layout-header.js +58 -55
  171. package/lib/link/src/link.js +131 -128
  172. package/lib/list/src/list.js +2173 -2170
  173. package/lib/loading/src/loading.js +141 -138
  174. package/lib/mention/src/mention.js +49 -46
  175. package/lib/menu/src/menu.js +799 -796
  176. package/lib/modal/src/modal.js +1519 -1527
  177. package/lib/notice-bar/src/notice-bar.js +168 -165
  178. package/lib/number-input/src/number-input.js +1094 -1091
  179. package/lib/pager/src/pager.js +767 -764
  180. package/lib/password-input/src/password-input.js +431 -428
  181. package/lib/print/src/page-break.js +63 -60
  182. package/lib/print/src/print.js +303 -300
  183. package/lib/pulldown/src/pulldown.js +403 -400
  184. package/lib/radio/src/button.js +214 -211
  185. package/lib/radio/src/group.js +195 -192
  186. package/lib/radio/src/radio.js +194 -191
  187. package/lib/rate/src/rate.js +164 -161
  188. package/lib/result/src/result.js +116 -113
  189. package/lib/row/src/col.js +133 -130
  190. package/lib/row/src/row.js +111 -108
  191. package/lib/scrollbar/src/scrollbar.js +518 -515
  192. package/lib/segmented/src/segmented.js +240 -237
  193. package/lib/select/src/optgroup.js +44 -41
  194. package/lib/select/src/option.js +39 -36
  195. package/lib/select/src/select.js +1915 -1897
  196. package/lib/slider/src/slider.js +419 -416
  197. package/lib/space/src/space.js +190 -187
  198. package/lib/splitter/src/splitter-panel.js +146 -143
  199. package/lib/splitter/src/splitter.js +917 -914
  200. package/lib/step-item/index.js +47 -0
  201. package/lib/steps/src/step-info.js +49 -0
  202. package/lib/steps/src/step-item.js +59 -0
  203. package/lib/steps/src/steps.js +298 -46
  204. package/lib/steps/src/util.js +74 -0
  205. package/lib/steps/style/style.css +297 -0
  206. package/lib/steps/style/style.mini.css +1 -0
  207. package/lib/style.css +307 -1
  208. package/lib/style.mini.css +1 -1
  209. package/lib/switch/src/switch.js +228 -225
  210. package/lib/table-select/src/table-select.js +865 -862
  211. package/lib/table-transfer/src/table-transfer.js +61 -58
  212. package/lib/tabs/src/tab-pane.js +102 -99
  213. package/lib/tabs/src/tabs.js +936 -933
  214. package/lib/tag/src/tag.js +163 -160
  215. package/lib/text/src/text.js +232 -229
  216. package/lib/text-ellipsis/src/text-ellipsis.js +252 -249
  217. package/lib/textarea/src/textarea.js +434 -431
  218. package/lib/timeline/src/timeline.js +74 -36
  219. package/lib/timeline/src/util.js +7 -4
  220. package/lib/tip/src/tip.js +117 -114
  221. package/lib/tooltip/src/tooltip.js +552 -549
  222. package/lib/tour/src/tour.js +49 -46
  223. package/lib/transfer/src/transfer.js +95 -92
  224. package/lib/tree/src/tree.js +3379 -3376
  225. package/lib/tree-select/src/tree-select.js +969 -966
  226. package/lib/ui/index.js +8 -2
  227. package/lib/ui/src/log.js +1 -1
  228. package/lib/upload/src/upload.js +1788 -1785
  229. package/lib/vxe-icon/style/style.css +1 -1
  230. package/lib/vxe-icon/style/style.mini.css +1 -1
  231. package/lib/vxe-steps/style/style.css +297 -0
  232. package/lib/vxe-steps/style/style.mini.css +1 -0
  233. package/lib/watermark/src/watermark.js +158 -155
  234. package/package.json +1 -1
  235. package/packages/alert/src/alert.ts +2 -2
  236. package/packages/anchor/src/anchor-link.ts +2 -2
  237. package/packages/anchor/src/anchor.ts +2 -2
  238. package/packages/avatar/src/avatar.ts +2 -2
  239. package/packages/backtop/src/backtop.ts +2 -2
  240. package/packages/badge/src/badge.ts +2 -2
  241. package/packages/breadcrumb/src/breadcrumb-item.ts +2 -2
  242. package/packages/breadcrumb/src/breadcrumb.ts +2 -2
  243. package/packages/button/src/button-group.ts +2 -2
  244. package/packages/calendar/src/calendar.ts +2 -2
  245. package/packages/card/src/card.ts +2 -2
  246. package/packages/carousel/src/carousel-item.ts +2 -2
  247. package/packages/carousel/src/carousel.ts +2 -2
  248. package/packages/cascader/src/cascader.ts +2 -2
  249. package/packages/checkbox/src/button.ts +3 -15
  250. package/packages/checkbox/src/checkbox.ts +2 -2
  251. package/packages/checkbox/src/group.ts +2 -2
  252. package/packages/collapse/src/collapse-pane.ts +2 -2
  253. package/packages/collapse/src/collapse.ts +2 -2
  254. package/packages/color-picker/src/color-picker.ts +2 -2
  255. package/packages/components.ts +3 -0
  256. package/packages/context-menu/src/context-menu.ts +3 -16
  257. package/packages/countdown/src/countdown.ts +2 -2
  258. package/packages/date-panel/src/date-panel.ts +2 -2
  259. package/packages/date-picker/src/date-picker.ts +2 -2
  260. package/packages/date-range-picker/src/date-range-picker.ts +2 -2
  261. package/packages/divider/src/divider.ts +2 -2
  262. package/packages/drawer/src/drawer.ts +2 -2
  263. package/packages/empty/src/empty.ts +2 -2
  264. package/packages/form/src/form-group.ts +2 -2
  265. package/packages/form/src/form-item.ts +2 -2
  266. package/packages/form/src/form.ts +2 -2
  267. package/packages/icon/src/icon.ts +2 -2
  268. package/packages/icon-picker/src/icon-picker.ts +2 -2
  269. package/packages/image/src/group.ts +2 -2
  270. package/packages/image/src/image.ts +2 -2
  271. package/packages/image/src/preview.ts +3 -16
  272. package/packages/index.ts +2 -2
  273. package/packages/input/src/input.ts +2 -2
  274. package/packages/layout-aside/src/layout-aside.ts +2 -2
  275. package/packages/layout-body/src/layout-body.ts +2 -2
  276. package/packages/layout-container/src/layout-container.ts +3 -14
  277. package/packages/layout-footer/src/layout-footer.ts +2 -2
  278. package/packages/layout-header/src/layout-header.ts +2 -2
  279. package/packages/link/src/link.ts +2 -2
  280. package/packages/list/src/list.ts +2 -2
  281. package/packages/loading/src/loading.ts +2 -2
  282. package/packages/mention/src/mention.ts +2 -2
  283. package/packages/menu/src/menu.ts +2 -2
  284. package/packages/modal/src/modal.ts +5 -20
  285. package/packages/notice-bar/src/notice-bar.ts +2 -2
  286. package/packages/number-input/src/number-input.ts +3 -17
  287. package/packages/pager/src/pager.ts +2 -2
  288. package/packages/password-input/src/password-input.ts +2 -2
  289. package/packages/print/src/page-break.ts +2 -2
  290. package/packages/print/src/print.ts +2 -2
  291. package/packages/pulldown/src/pulldown.ts +2 -2
  292. package/packages/radio/src/button.ts +3 -16
  293. package/packages/radio/src/group.ts +3 -17
  294. package/packages/radio/src/radio.ts +2 -2
  295. package/packages/rate/src/rate.ts +2 -2
  296. package/packages/result/src/result.ts +2 -2
  297. package/packages/row/src/col.ts +2 -2
  298. package/packages/row/src/row.ts +2 -2
  299. package/packages/scrollbar/src/scrollbar.ts +3 -4
  300. package/packages/segmented/src/segmented.ts +2 -2
  301. package/packages/select/src/optgroup.ts +2 -2
  302. package/packages/select/src/option.ts +2 -2
  303. package/packages/select/src/select.ts +33 -19
  304. package/packages/slider/src/slider.ts +2 -2
  305. package/packages/space/src/space.ts +2 -2
  306. package/packages/splitter/src/splitter-panel.ts +2 -2
  307. package/packages/splitter/src/splitter.ts +2 -2
  308. package/packages/step-item/index.ts +16 -0
  309. package/packages/steps/src/step-info.ts +18 -0
  310. package/packages/steps/src/step-item.ts +41 -0
  311. package/packages/steps/src/steps.ts +273 -13
  312. package/packages/steps/src/util.ts +44 -0
  313. package/packages/switch/src/switch.ts +2 -2
  314. package/packages/table-select/src/table-select.ts +2 -2
  315. package/packages/table-transfer/src/table-transfer.ts +3 -15
  316. package/packages/tabs/src/tab-pane.ts +2 -2
  317. package/packages/tabs/src/tabs.ts +2 -2
  318. package/packages/tag/src/tag.ts +2 -2
  319. package/packages/text/src/text.ts +2 -2
  320. package/packages/text-ellipsis/src/text-ellipsis.ts +2 -2
  321. package/packages/textarea/src/textarea.ts +2 -2
  322. package/packages/timeline/src/timeline-info.ts +17 -17
  323. package/packages/timeline/src/timeline.ts +93 -49
  324. package/packages/timeline/src/util.ts +44 -41
  325. package/packages/tip/src/tip.ts +2 -2
  326. package/packages/tooltip/src/tooltip.ts +2 -2
  327. package/packages/tour/src/tour.ts +2 -2
  328. package/packages/transfer/src/transfer.ts +2 -2
  329. package/packages/tree/src/tree.ts +2 -2
  330. package/packages/tree-select/src/tree-select.ts +2 -2
  331. package/packages/ui/index.ts +8 -1
  332. package/packages/upload/src/upload.ts +2 -2
  333. package/packages/watermark/src/watermark.ts +2 -2
  334. package/styles/all.scss +1 -0
  335. package/styles/components/step-item.scss +0 -0
  336. package/styles/components/steps.scss +354 -0
  337. package/styles/theme/base.scss +9 -0
  338. package/types/all.d.ts +3 -0
  339. package/types/components/gantt.d.ts +1 -3
  340. package/types/components/select.d.ts +1 -13
  341. package/types/components/step-item.d.ts +72 -0
  342. package/types/components/steps.d.ts +67 -8
  343. package/types/components/table.d.ts +7 -66
  344. package/types/handles/form-design.d.ts +1 -4
  345. package/types/ui/global-config.d.ts +2 -0
  346. package/types/ui/global-icon.d.ts +7 -0
  347. /package/dist/{iconfont.1793330162657.ttf → iconfont.1793359478136.ttf} +0 -0
  348. /package/dist/{iconfont.1793330162657.woff → iconfont.1793359478136.woff} +0 -0
  349. /package/dist/{iconfont.1793330162657.woff2 → iconfont.1793359478136.woff2} +0 -0
  350. /package/es/icon/{iconfont.1793330162657.ttf → iconfont.1793359478136.ttf} +0 -0
  351. /package/es/icon/{iconfont.1793330162657.woff → iconfont.1793359478136.woff} +0 -0
  352. /package/es/icon/{iconfont.1793330162657.woff2 → iconfont.1793359478136.woff2} +0 -0
  353. /package/es/{iconfont.1793330162657.ttf → iconfont.1793359478136.ttf} +0 -0
  354. /package/es/{iconfont.1793330162657.woff → iconfont.1793359478136.woff} +0 -0
  355. /package/es/{iconfont.1793330162657.woff2 → iconfont.1793359478136.woff2} +0 -0
  356. /package/es/vxe-icon/{iconfont.1793330162657.ttf → iconfont.1793359478136.ttf} +0 -0
  357. /package/es/vxe-icon/{iconfont.1793330162657.woff → iconfont.1793359478136.woff} +0 -0
  358. /package/es/vxe-icon/{iconfont.1793330162657.woff2 → iconfont.1793359478136.woff2} +0 -0
  359. /package/lib/icon/style/{iconfont.1793330162657.ttf → iconfont.1793359478136.ttf} +0 -0
  360. /package/lib/icon/style/{iconfont.1793330162657.woff → iconfont.1793359478136.woff} +0 -0
  361. /package/lib/icon/style/{iconfont.1793330162657.woff2 → iconfont.1793359478136.woff2} +0 -0
  362. /package/lib/{iconfont.1793330162657.ttf → iconfont.1793359478136.ttf} +0 -0
  363. /package/lib/{iconfont.1793330162657.woff → iconfont.1793359478136.woff} +0 -0
  364. /package/lib/{iconfont.1793330162657.woff2 → iconfont.1793359478136.woff2} +0 -0
  365. /package/lib/vxe-icon/style/{iconfont.1793330162657.ttf → iconfont.1793359478136.ttf} +0 -0
  366. /package/lib/vxe-icon/style/{iconfont.1793330162657.woff → iconfont.1793359478136.woff} +0 -0
  367. /package/lib/vxe-icon/style/{iconfont.1793330162657.woff2 → iconfont.1793359478136.woff2} +0 -0
@@ -88,422 +88,382 @@ function createInternalData() {
88
88
  // isUpdateMode: false
89
89
  };
90
90
  }
91
- var cascader_default = (0, import_comp.defineVxeComponent)({
92
- name: "VxeCascader",
93
- props: {
94
- modelValue: [String, Number, Array],
95
- clearable: Boolean,
96
- placeholder: {
97
- type: String,
98
- default: () => import_xe_utils.default.eqNull(getConfig().cascader.placeholder) ? getI18n("vxe.base.pleaseSelect") : getConfig().cascader.placeholder
99
- },
100
- readonly: {
101
- type: Boolean,
102
- default: null
103
- },
104
- loading: Boolean,
105
- disabled: {
106
- type: Boolean,
107
- default: null
108
- },
109
- filterable: Boolean,
110
- filterConfig: Object,
111
- showFullLabel: {
112
- type: Boolean,
113
- default: () => getConfig().cascader.showFullLabel
114
- },
115
- separator: {
116
- type: String,
117
- default: () => getConfig().cascader.separator
118
- },
119
- multiple: Boolean,
120
- className: [String, Function],
121
- prefixIcon: String,
122
- lazyOptions: Array,
123
- options: Array,
124
- optionProps: Object,
125
- size: {
126
- type: String,
127
- default: () => getConfig().cascader.size || getConfig().size
128
- },
129
- treeConfig: Object,
130
- showRadio: {
131
- type: Boolean,
132
- default: () => getConfig().cascader.showRadio
133
- },
134
- radioConfig: Object,
135
- showCheckbox: {
136
- type: Boolean,
137
- default: () => getConfig().cascader.showCheckbox
138
- },
139
- checkboxConfig: Object,
140
- remote: Boolean,
141
- remoteConfig: Function,
142
- popupConfig: Object,
143
- checkedClosable: {
144
- type: Boolean,
145
- default: () => getConfig().cascader.checkedClosable
146
- },
147
- clearClosable: {
148
- type: Boolean,
149
- default: () => getConfig().cascader.clearClosable
150
- },
151
- showCloseButton: {
152
- type: Boolean,
153
- default: () => getConfig().cascader.showCloseButton
154
- },
155
- showTotalButton: {
156
- type: Boolean,
157
- default: () => getConfig().cascader.showTotalButton
158
- },
159
- showCheckedButton: {
160
- type: Boolean,
161
- default: () => getConfig().cascader.showCheckedButton
91
+ var cascader_default = (
92
+ /* define-vxe-component start */
93
+ (0, import_comp.defineVxeComponent)({
94
+ name: "VxeCascader",
95
+ props: {
96
+ modelValue: [String, Number, Array],
97
+ clearable: Boolean,
98
+ placeholder: {
99
+ type: String,
100
+ default: () => import_xe_utils.default.eqNull(getConfig().cascader.placeholder) ? getI18n("vxe.base.pleaseSelect") : getConfig().cascader.placeholder
101
+ },
102
+ readonly: {
103
+ type: Boolean,
104
+ default: null
105
+ },
106
+ loading: Boolean,
107
+ disabled: {
108
+ type: Boolean,
109
+ default: null
110
+ },
111
+ filterable: Boolean,
112
+ filterConfig: Object,
113
+ showFullLabel: {
114
+ type: Boolean,
115
+ default: () => getConfig().cascader.showFullLabel
116
+ },
117
+ separator: {
118
+ type: String,
119
+ default: () => getConfig().cascader.separator
120
+ },
121
+ multiple: Boolean,
122
+ className: [String, Function],
123
+ prefixIcon: String,
124
+ lazyOptions: Array,
125
+ options: Array,
126
+ optionProps: Object,
127
+ size: {
128
+ type: String,
129
+ default: () => getConfig().cascader.size || getConfig().size
130
+ },
131
+ treeConfig: Object,
132
+ showRadio: {
133
+ type: Boolean,
134
+ default: () => getConfig().cascader.showRadio
135
+ },
136
+ radioConfig: Object,
137
+ showCheckbox: {
138
+ type: Boolean,
139
+ default: () => getConfig().cascader.showCheckbox
140
+ },
141
+ checkboxConfig: Object,
142
+ remote: Boolean,
143
+ remoteConfig: Function,
144
+ popupConfig: Object,
145
+ checkedClosable: {
146
+ type: Boolean,
147
+ default: () => getConfig().cascader.checkedClosable
148
+ },
149
+ clearClosable: {
150
+ type: Boolean,
151
+ default: () => getConfig().cascader.clearClosable
152
+ },
153
+ showCloseButton: {
154
+ type: Boolean,
155
+ default: () => getConfig().cascader.showCloseButton
156
+ },
157
+ showTotalButton: {
158
+ type: Boolean,
159
+ default: () => getConfig().cascader.showTotalButton
160
+ },
161
+ showCheckedButton: {
162
+ type: Boolean,
163
+ default: () => getConfig().cascader.showCheckedButton
164
+ },
165
+ showClearButton: {
166
+ type: Boolean,
167
+ default: () => getConfig().cascader.showClearButton
168
+ }
162
169
  },
163
- showClearButton: {
164
- type: Boolean,
165
- default: () => getConfig().cascader.showClearButton
166
- }
167
- },
168
- emits: ["update:modelValue", "change", "all-change", "clear", "blur", "focus", "click", "node-click", "node-expand", "current-change", "radio-change", "checkbox-change", "load-success", "load-error", "visible-change"],
169
- setup(props, context) {
170
- const { emit, slots } = context;
171
- const $xeModal = (0, import_vue.inject)("$xeModal", null);
172
- const $xeDrawer = (0, import_vue.inject)("$xeDrawer", null);
173
- const $xeTable = (0, import_vue.inject)("$xeTable", null);
174
- const $xeForm = (0, import_vue.inject)("$xeForm", null);
175
- const formItemInfo = (0, import_vue.inject)("xeFormItemInfo", null);
176
- const xID = import_xe_utils.default.uniqueId();
177
- const { computeSize } = useFns.useSize(props);
178
- const refElem = (0, import_vue.ref)();
179
- const refInput = (0, import_vue.ref)();
180
- const refInpSearch = (0, import_vue.ref)();
181
- const refChunkWrapper = (0, import_vue.ref)();
182
- const refOptionPanel = (0, import_vue.ref)();
183
- const reactData = (0, import_vue.reactive)(createReactData());
184
- const internalData = createInternalData();
185
- const refMaps = {
186
- refElem
187
- };
188
- const computeFormReadonly = (0, import_vue.computed)(() => {
189
- const { readonly } = props;
190
- if (readonly === null) {
191
- if ($xeForm) {
192
- return $xeForm.props.readonly;
170
+ emits: ["update:modelValue", "change", "all-change", "clear", "blur", "focus", "click", "node-click", "node-expand", "current-change", "radio-change", "checkbox-change", "load-success", "load-error", "visible-change"],
171
+ setup(props, context) {
172
+ const { emit, slots } = context;
173
+ const $xeModal = (0, import_vue.inject)("$xeModal", null);
174
+ const $xeDrawer = (0, import_vue.inject)("$xeDrawer", null);
175
+ const $xeTable = (0, import_vue.inject)("$xeTable", null);
176
+ const $xeForm = (0, import_vue.inject)("$xeForm", null);
177
+ const formItemInfo = (0, import_vue.inject)("xeFormItemInfo", null);
178
+ const xID = import_xe_utils.default.uniqueId();
179
+ const { computeSize } = useFns.useSize(props);
180
+ const refElem = (0, import_vue.ref)();
181
+ const refInput = (0, import_vue.ref)();
182
+ const refInpSearch = (0, import_vue.ref)();
183
+ const refChunkWrapper = (0, import_vue.ref)();
184
+ const refOptionPanel = (0, import_vue.ref)();
185
+ const reactData = (0, import_vue.reactive)(createReactData());
186
+ const internalData = createInternalData();
187
+ const refMaps = {
188
+ refElem
189
+ };
190
+ const computeFormReadonly = (0, import_vue.computed)(() => {
191
+ const { readonly } = props;
192
+ if (readonly === null) {
193
+ if ($xeForm) {
194
+ return $xeForm.props.readonly;
195
+ }
196
+ return false;
193
197
  }
194
- return false;
195
- }
196
- return readonly;
197
- });
198
- const computeIsDisabled = (0, import_vue.computed)(() => {
199
- const { disabled } = props;
200
- if (disabled === null) {
201
- if ($xeForm) {
202
- return $xeForm.props.disabled;
198
+ return readonly;
199
+ });
200
+ const computeIsDisabled = (0, import_vue.computed)(() => {
201
+ const { disabled } = props;
202
+ if (disabled === null) {
203
+ if ($xeForm) {
204
+ return $xeForm.props.disabled;
205
+ }
206
+ return false;
203
207
  }
204
- return false;
205
- }
206
- return disabled;
207
- });
208
- const computeBtnTransfer = (0, import_vue.computed)(() => {
209
- const popupOpts = computePopupOpts.value;
210
- const { transfer } = popupOpts;
211
- if (import_xe_utils.default.isBoolean(transfer)) {
212
- return transfer;
213
- }
214
- if ($xeTable || $xeModal || $xeDrawer || $xeForm) {
215
- return true;
216
- }
217
- return false;
218
- });
219
- const computeTreeOpts = (0, import_vue.computed)(() => {
220
- return Object.assign({}, getConfig().cascader.treeConfig, props.treeConfig);
221
- });
222
- const computeRadioOpts = (0, import_vue.computed)(() => {
223
- return Object.assign({}, getConfig().cascader.radioConfig, props.radioConfig);
224
- });
225
- const computeCheckboxOpts = (0, import_vue.computed)(() => {
226
- return Object.assign({}, getConfig().cascader.checkboxConfig, props.checkboxConfig);
227
- });
228
- const computePopupOpts = (0, import_vue.computed)(() => {
229
- return Object.assign({}, getConfig().cascader.popupConfig, props.popupConfig);
230
- });
231
- const computePropsOpts = (0, import_vue.computed)(() => {
232
- return props.optionProps || {};
233
- });
234
- const computeLabelField = (0, import_vue.computed)(() => {
235
- const propsOpts = computePropsOpts.value;
236
- return propsOpts.label || "label";
237
- });
238
- const computeValueField = (0, import_vue.computed)(() => {
239
- const propsOpts = computePropsOpts.value;
240
- return propsOpts.value || "value";
241
- });
242
- const computeKeyField = (0, import_vue.computed)(() => {
243
- const treeOpts = computeTreeOpts.value;
244
- return treeOpts.keyField || "id";
245
- });
246
- const computeParentField = (0, import_vue.computed)(() => {
247
- const treeOpts = computeTreeOpts.value;
248
- return treeOpts.parentField || "parentId";
249
- });
250
- const computeChildrenField = (0, import_vue.computed)(() => {
251
- const treeOpts = computeTreeOpts.value;
252
- return treeOpts.childrenField || "children";
253
- });
254
- const computeMapChildrenField = (0, import_vue.computed)(() => {
255
- const treeOpts = computeTreeOpts.value;
256
- return treeOpts.mapChildrenField || "mapChildren";
257
- });
258
- const computeHasChildField = (0, import_vue.computed)(() => {
259
- const treeOpts = computeTreeOpts.value;
260
- return treeOpts.hasChildField || "hasChild";
261
- });
262
- const computeRemoteOpts = (0, import_vue.computed)(() => {
263
- return Object.assign({}, getConfig().cascader.remoteConfig, props.remoteConfig);
264
- });
265
- const computeSelectVals = (0, import_vue.computed)(() => {
266
- const { modelValue } = props;
267
- return import_xe_utils.default.eqNull(modelValue) ? [] : import_xe_utils.default.isArray(modelValue) ? modelValue : [modelValue];
268
- });
269
- const computeSelectLabel = (0, import_vue.computed)(() => {
270
- const { showFullLabel } = props;
271
- const { fullOptFlag, lazyOptFlag } = reactData;
272
- const { fullNodeMaps, lazyNodeMaps } = internalData;
273
- const labelField = computeLabelField.value;
274
- const selectVals = computeSelectVals.value;
275
- return selectVals.map((val) => {
276
- const cacheItem = fullNodeMaps[val];
277
- if (fullOptFlag && cacheItem) {
278
- return showFullLabel ? cacheItem.fullLabel : cacheItem.item[labelField];
208
+ return disabled;
209
+ });
210
+ const computeBtnTransfer = (0, import_vue.computed)(() => {
211
+ const popupOpts = computePopupOpts.value;
212
+ const { transfer } = popupOpts;
213
+ if (import_xe_utils.default.isBoolean(transfer)) {
214
+ return transfer;
215
+ }
216
+ if ($xeTable || $xeModal || $xeDrawer || $xeForm) {
217
+ return true;
279
218
  }
280
- if (lazyOptFlag) {
281
- const lazyCacheItem = lazyNodeMaps[val];
282
- if (lazyCacheItem) {
283
- return showFullLabel ? lazyCacheItem.fullLabel : lazyCacheItem.item[labelField];
219
+ return false;
220
+ });
221
+ const computeTreeOpts = (0, import_vue.computed)(() => {
222
+ return Object.assign({}, getConfig().cascader.treeConfig, props.treeConfig);
223
+ });
224
+ const computeRadioOpts = (0, import_vue.computed)(() => {
225
+ return Object.assign({}, getConfig().cascader.radioConfig, props.radioConfig);
226
+ });
227
+ const computeCheckboxOpts = (0, import_vue.computed)(() => {
228
+ return Object.assign({}, getConfig().cascader.checkboxConfig, props.checkboxConfig);
229
+ });
230
+ const computePopupOpts = (0, import_vue.computed)(() => {
231
+ return Object.assign({}, getConfig().cascader.popupConfig, props.popupConfig);
232
+ });
233
+ const computePropsOpts = (0, import_vue.computed)(() => {
234
+ return props.optionProps || {};
235
+ });
236
+ const computeLabelField = (0, import_vue.computed)(() => {
237
+ const propsOpts = computePropsOpts.value;
238
+ return propsOpts.label || "label";
239
+ });
240
+ const computeValueField = (0, import_vue.computed)(() => {
241
+ const propsOpts = computePropsOpts.value;
242
+ return propsOpts.value || "value";
243
+ });
244
+ const computeKeyField = (0, import_vue.computed)(() => {
245
+ const treeOpts = computeTreeOpts.value;
246
+ return treeOpts.keyField || "id";
247
+ });
248
+ const computeParentField = (0, import_vue.computed)(() => {
249
+ const treeOpts = computeTreeOpts.value;
250
+ return treeOpts.parentField || "parentId";
251
+ });
252
+ const computeChildrenField = (0, import_vue.computed)(() => {
253
+ const treeOpts = computeTreeOpts.value;
254
+ return treeOpts.childrenField || "children";
255
+ });
256
+ const computeMapChildrenField = (0, import_vue.computed)(() => {
257
+ const treeOpts = computeTreeOpts.value;
258
+ return treeOpts.mapChildrenField || "mapChildren";
259
+ });
260
+ const computeHasChildField = (0, import_vue.computed)(() => {
261
+ const treeOpts = computeTreeOpts.value;
262
+ return treeOpts.hasChildField || "hasChild";
263
+ });
264
+ const computeRemoteOpts = (0, import_vue.computed)(() => {
265
+ return Object.assign({}, getConfig().cascader.remoteConfig, props.remoteConfig);
266
+ });
267
+ const computeSelectVals = (0, import_vue.computed)(() => {
268
+ const { modelValue } = props;
269
+ return import_xe_utils.default.eqNull(modelValue) ? [] : import_xe_utils.default.isArray(modelValue) ? modelValue : [modelValue];
270
+ });
271
+ const computeSelectLabel = (0, import_vue.computed)(() => {
272
+ const { showFullLabel } = props;
273
+ const { fullOptFlag, lazyOptFlag } = reactData;
274
+ const { fullNodeMaps, lazyNodeMaps } = internalData;
275
+ const labelField = computeLabelField.value;
276
+ const selectVals = computeSelectVals.value;
277
+ return selectVals.map((val) => {
278
+ const cacheItem = fullNodeMaps[val];
279
+ if (fullOptFlag && cacheItem) {
280
+ return showFullLabel ? cacheItem.fullLabel : cacheItem.item[labelField];
284
281
  }
282
+ if (lazyOptFlag) {
283
+ const lazyCacheItem = lazyNodeMaps[val];
284
+ if (lazyCacheItem) {
285
+ return showFullLabel ? lazyCacheItem.fullLabel : lazyCacheItem.item[labelField];
286
+ }
287
+ }
288
+ return val;
289
+ }).join(", ");
290
+ });
291
+ const computePopupWrapperStyle = (0, import_vue.computed)(() => {
292
+ const { currentCunkList, panelStyle } = reactData;
293
+ const popupOpts = computePopupOpts.value;
294
+ const { height, nodeWidth, nodeHeight } = popupOpts;
295
+ const stys = {
296
+ ...panelStyle,
297
+ "--vxe-ui-cascader-chunk-size": currentCunkList.length
298
+ };
299
+ if (height) {
300
+ stys["--vxe-ui-cascader-chunk-height"] = (0, import_dom.toCssUnit)(height);
301
+ }
302
+ if (nodeWidth) {
303
+ stys["--vxe-ui-cascader-node-width"] = (0, import_dom.toCssUnit)(nodeWidth);
285
304
  }
286
- return val;
287
- }).join(", ");
288
- });
289
- const computePopupWrapperStyle = (0, import_vue.computed)(() => {
290
- const { currentCunkList, panelStyle } = reactData;
291
- const popupOpts = computePopupOpts.value;
292
- const { height, nodeWidth, nodeHeight } = popupOpts;
293
- const stys = {
294
- ...panelStyle,
295
- "--vxe-ui-cascader-chunk-size": currentCunkList.length
305
+ if (nodeHeight) {
306
+ stys["--vxe-ui-cascader-node-height"] = (0, import_dom.toCssUnit)(nodeHeight);
307
+ }
308
+ return stys;
309
+ });
310
+ const computeFilterOpts = (0, import_vue.computed)(() => {
311
+ return Object.assign({}, getConfig().cascader.filterConfig, props.filterConfig);
312
+ });
313
+ const computeMaps = {};
314
+ const $xeCascader = {
315
+ xID,
316
+ props,
317
+ context,
318
+ reactData,
319
+ internalData,
320
+ getRefMaps: () => refMaps,
321
+ getComputeMaps: () => computeMaps
296
322
  };
297
- if (height) {
298
- stys["--vxe-ui-cascader-chunk-height"] = (0, import_dom.toCssUnit)(height);
299
- }
300
- if (nodeWidth) {
301
- stys["--vxe-ui-cascader-node-width"] = (0, import_dom.toCssUnit)(nodeWidth);
302
- }
303
- if (nodeHeight) {
304
- stys["--vxe-ui-cascader-node-height"] = (0, import_dom.toCssUnit)(nodeHeight);
305
- }
306
- return stys;
307
- });
308
- const computeFilterOpts = (0, import_vue.computed)(() => {
309
- return Object.assign({}, getConfig().cascader.filterConfig, props.filterConfig);
310
- });
311
- const computeMaps = {};
312
- const $xeCascader = {
313
- xID,
314
- props,
315
- context,
316
- reactData,
317
- internalData,
318
- getRefMaps: () => refMaps,
319
- getComputeMaps: () => computeMaps
320
- };
321
- const dispatchEvent = (type, params, evnt) => {
322
- emit(type, createEvent(evnt, { $cascader: $xeCascader }, params));
323
- };
324
- const emitModel = (value) => {
325
- emit("update:modelValue", value);
326
- };
327
- const cascaderMethods = {
328
- dispatchEvent
329
- };
330
- const getNodeId = (node) => {
331
- if (!node) {
332
- return "";
333
- }
334
- const valueField = computeValueField.value;
335
- const nodeKey = node[valueField];
336
- return (0, import_util.enNodeValue)(nodeKey);
337
- };
338
- const isPathInTree = (treeData, pathIds) => {
339
- if (!pathIds || !pathIds.length) {
340
- return false;
341
- }
342
- let currentNodes = treeData;
343
- for (const nodeid of pathIds) {
344
- const found = currentNodes.find((node) => getNodeId(node) === nodeid);
345
- if (!found) {
323
+ const dispatchEvent = (type, params, evnt) => {
324
+ emit(type, createEvent(evnt, { $cascader: $xeCascader }, params));
325
+ };
326
+ const emitModel = (value) => {
327
+ emit("update:modelValue", value);
328
+ };
329
+ const cascaderMethods = {
330
+ dispatchEvent
331
+ };
332
+ const getNodeId = (node) => {
333
+ if (!node) {
334
+ return "";
335
+ }
336
+ const valueField = computeValueField.value;
337
+ const nodeKey = node[valueField];
338
+ return (0, import_util.enNodeValue)(nodeKey);
339
+ };
340
+ const isPathInTree = (treeData, pathIds) => {
341
+ if (!pathIds || !pathIds.length) {
346
342
  return false;
347
343
  }
348
- currentNodes = found.children || [];
349
- }
350
- return true;
351
- };
352
- const isCheckedByCheckboxNodeId = (nodeid) => {
353
- const { updateCheckboxFlag } = reactData;
354
- const { selectCheckboxMaps } = internalData;
355
- return !!(updateCheckboxFlag && selectCheckboxMaps[nodeid]);
356
- };
357
- const handleCheckedCheckboxNode = (nodeList, checked) => {
358
- const { selectCheckboxMaps } = internalData;
359
- const mapChildrenField = computeMapChildrenField.value;
360
- const childrenField = computeChildrenField.value;
361
- const checkboxOpts = computeCheckboxOpts.value;
362
- const { checkStrictly } = checkboxOpts;
363
- const treeOpts = computeTreeOpts.value;
364
- const { transform } = treeOpts;
365
- const handleSelect = (node) => {
366
- const nodeid = getNodeId(node);
367
- if (checked) {
368
- if (!selectCheckboxMaps[nodeid]) {
369
- selectCheckboxMaps[nodeid] = node;
370
- }
371
- } else {
372
- if (selectCheckboxMaps[nodeid]) {
373
- delete selectCheckboxMaps[nodeid];
344
+ let currentNodes = treeData;
345
+ for (const nodeid of pathIds) {
346
+ const found = currentNodes.find((node) => getNodeId(node) === nodeid);
347
+ if (!found) {
348
+ return false;
374
349
  }
350
+ currentNodes = found.children || [];
375
351
  }
352
+ return true;
376
353
  };
377
- if (checkStrictly) {
378
- nodeList.forEach(handleSelect);
379
- } else {
380
- import_xe_utils.default.eachTree(nodeList, handleSelect, { children: transform ? mapChildrenField : childrenField });
381
- }
382
- reactData.updateCheckboxFlag++;
383
- updateCheckboxStatus();
384
- };
385
- const createNode = (records) => {
386
- const valueField = computeValueField.value;
387
- return Promise.resolve(
388
- records.map((obj) => {
389
- const item = { ...obj };
390
- let nodeid = getNodeId(item);
391
- if (!nodeid) {
392
- nodeid = getNodeUniqueId();
393
- import_xe_utils.default.set(item, valueField, nodeid);
354
+ const isCheckedByCheckboxNodeId = (nodeid) => {
355
+ const { updateCheckboxFlag } = reactData;
356
+ const { selectCheckboxMaps } = internalData;
357
+ return !!(updateCheckboxFlag && selectCheckboxMaps[nodeid]);
358
+ };
359
+ const handleCheckedCheckboxNode = (nodeList, checked) => {
360
+ const { selectCheckboxMaps } = internalData;
361
+ const mapChildrenField = computeMapChildrenField.value;
362
+ const childrenField = computeChildrenField.value;
363
+ const checkboxOpts = computeCheckboxOpts.value;
364
+ const { checkStrictly } = checkboxOpts;
365
+ const treeOpts = computeTreeOpts.value;
366
+ const { transform } = treeOpts;
367
+ const handleSelect = (node) => {
368
+ const nodeid = getNodeId(node);
369
+ if (checked) {
370
+ if (!selectCheckboxMaps[nodeid]) {
371
+ selectCheckboxMaps[nodeid] = node;
372
+ }
373
+ } else {
374
+ if (selectCheckboxMaps[nodeid]) {
375
+ delete selectCheckboxMaps[nodeid];
376
+ }
394
377
  }
395
- return item;
396
- })
397
- );
398
- };
399
- const handleSetCheckboxByNodeId = (nodeKeys, checked) => {
400
- const { nodeMaps } = internalData;
401
- if (nodeKeys) {
402
- if (!import_xe_utils.default.isArray(nodeKeys)) {
403
- nodeKeys = [nodeKeys];
378
+ };
379
+ if (checkStrictly) {
380
+ nodeList.forEach(handleSelect);
381
+ } else {
382
+ import_xe_utils.default.eachTree(nodeList, handleSelect, { children: transform ? mapChildrenField : childrenField });
404
383
  }
405
- const nodeList = [];
406
- nodeKeys.forEach((nodeKey) => {
407
- const nodeid = (0, import_util.enNodeValue)(nodeKey);
408
- const nodeItem = nodeMaps[nodeid];
409
- if (nodeItem) {
410
- nodeList.push(nodeItem.item);
384
+ reactData.updateCheckboxFlag++;
385
+ updateCheckboxStatus();
386
+ };
387
+ const createNode = (records) => {
388
+ const valueField = computeValueField.value;
389
+ return Promise.resolve(
390
+ records.map((obj) => {
391
+ const item = { ...obj };
392
+ let nodeid = getNodeId(item);
393
+ if (!nodeid) {
394
+ nodeid = getNodeUniqueId();
395
+ import_xe_utils.default.set(item, valueField, nodeid);
396
+ }
397
+ return item;
398
+ })
399
+ );
400
+ };
401
+ const handleSetCheckboxByNodeId = (nodeKeys, checked) => {
402
+ const { nodeMaps } = internalData;
403
+ if (nodeKeys) {
404
+ if (!import_xe_utils.default.isArray(nodeKeys)) {
405
+ nodeKeys = [nodeKeys];
411
406
  }
412
- });
413
- handleCheckedCheckboxNode(nodeList, checked);
414
- }
415
- return (0, import_vue.nextTick)();
416
- };
417
- const updateCheckboxChecked = (nodeKeys) => {
418
- internalData.selectCheckboxMaps = {};
419
- handleSetCheckboxByNodeId(nodeKeys, true);
420
- };
421
- const updateModelChecked = () => {
422
- const { modelValue } = props;
423
- const { nodeMaps } = internalData;
424
- const expandedMaps = {};
425
- if (props.multiple) {
426
- if (modelValue && modelValue.length) {
427
- updateCheckboxChecked(modelValue);
407
+ const nodeList = [];
408
+ nodeKeys.forEach((nodeKey) => {
409
+ const nodeid = (0, import_util.enNodeValue)(nodeKey);
410
+ const nodeItem = nodeMaps[nodeid];
411
+ if (nodeItem) {
412
+ nodeList.push(nodeItem.item);
413
+ }
414
+ });
415
+ handleCheckedCheckboxNode(nodeList, checked);
428
416
  }
429
- } else {
430
- if (modelValue) {
431
- const nodeid = (0, import_util.enNodeValue)(import_xe_utils.default.isArray(modelValue) ? modelValue[0] : modelValue);
432
- const itemRest = nodeMaps[nodeid];
433
- if (itemRest) {
434
- itemRest.nodes.forEach((item) => {
435
- expandedMaps[getNodeId(item)] = true;
436
- });
437
- reactData.selectRadioKey = nodeid;
417
+ return (0, import_vue.nextTick)();
418
+ };
419
+ const updateCheckboxChecked = (nodeKeys) => {
420
+ internalData.selectCheckboxMaps = {};
421
+ handleSetCheckboxByNodeId(nodeKeys, true);
422
+ };
423
+ const updateModelChecked = () => {
424
+ const { modelValue } = props;
425
+ const { nodeMaps } = internalData;
426
+ const expandedMaps = {};
427
+ if (props.multiple) {
428
+ if (modelValue && modelValue.length) {
429
+ updateCheckboxChecked(modelValue);
438
430
  }
439
- }
440
- }
441
- internalData.treeExpandedMaps = expandedMaps;
442
- };
443
- const cacheNodeMap = () => {
444
- const { separator } = props;
445
- const { treeFullData } = internalData;
446
- const valueField = computeValueField.value;
447
- const labelField = computeLabelField.value;
448
- const childrenField = computeChildrenField.value;
449
- const keyMaps = {};
450
- const fullMaps = {};
451
- import_xe_utils.default.eachTree(
452
- treeFullData,
453
- (item, index, items, path, parenItem, nodes) => {
454
- let nodeid = getNodeId(item);
455
- if (!nodeid) {
456
- nodeid = getNodeUniqueId();
457
- item[valueField] = nodeid;
431
+ } else {
432
+ if (modelValue) {
433
+ const nodeid = (0, import_util.enNodeValue)(import_xe_utils.default.isArray(modelValue) ? modelValue[0] : modelValue);
434
+ const itemRest = nodeMaps[nodeid];
435
+ if (itemRest) {
436
+ itemRest.nodes.forEach((item) => {
437
+ expandedMaps[getNodeId(item)] = true;
438
+ });
439
+ reactData.selectRadioKey = nodeid;
440
+ }
458
441
  }
459
- const nodeVal = item[valueField];
460
- const itemRest = {
461
- item,
462
- index,
463
- $index: -1,
464
- _index: -1,
465
- items,
466
- parent: parenItem,
467
- nodes,
468
- level: nodes.length - 1,
469
- treeIndex: index,
470
- lineCount: 0,
471
- treeLoaded: false,
472
- fullLabel: nodes.map((item2) => item2[labelField]).join(separator || " / ")
473
- };
474
- keyMaps[nodeid] = itemRest;
475
- fullMaps[nodeVal] = itemRest;
476
- },
477
- { children: childrenField }
478
- );
479
- internalData.nodeMaps = keyMaps;
480
- internalData.fullNodeMaps = fullMaps;
481
- reactData.fullOptFlag++;
482
- };
483
- const updateAfterDataIndex = () => {
484
- const { separator } = props;
485
- const { afterTreeList, nodeMaps } = internalData;
486
- const labelField = computeLabelField.value;
487
- const childrenField = computeChildrenField.value;
488
- const mapChildrenField = computeMapChildrenField.value;
489
- const treeOpts = computeTreeOpts.value;
490
- const { transform } = treeOpts;
491
- let vtIndex = 0;
492
- import_xe_utils.default.eachTree(
493
- afterTreeList,
494
- (item, index, items, path, parenItem, nodes) => {
495
- const nodeid = getNodeId(item);
496
- const nodeItem = nodeMaps[nodeid];
497
- if (nodeItem) {
498
- nodeItem.items = items;
499
- nodeItem.treeIndex = index;
500
- nodeItem._index = vtIndex;
501
- } else {
502
- const rest = {
442
+ }
443
+ internalData.treeExpandedMaps = expandedMaps;
444
+ };
445
+ const cacheNodeMap = () => {
446
+ const { separator } = props;
447
+ const { treeFullData } = internalData;
448
+ const valueField = computeValueField.value;
449
+ const labelField = computeLabelField.value;
450
+ const childrenField = computeChildrenField.value;
451
+ const keyMaps = {};
452
+ const fullMaps = {};
453
+ import_xe_utils.default.eachTree(
454
+ treeFullData,
455
+ (item, index, items, path, parenItem, nodes) => {
456
+ let nodeid = getNodeId(item);
457
+ if (!nodeid) {
458
+ nodeid = getNodeUniqueId();
459
+ item[valueField] = nodeid;
460
+ }
461
+ const nodeVal = item[valueField];
462
+ const itemRest = {
503
463
  item,
504
464
  index,
505
465
  $index: -1,
506
- _index: vtIndex,
466
+ _index: -1,
507
467
  items,
508
468
  parent: parenItem,
509
469
  nodes,
@@ -513,1383 +473,1426 @@ var cascader_default = (0, import_comp.defineVxeComponent)({
513
473
  treeLoaded: false,
514
474
  fullLabel: nodes.map((item2) => item2[labelField]).join(separator || " / ")
515
475
  };
516
- nodeMaps[nodeid] = rest;
476
+ keyMaps[nodeid] = itemRest;
477
+ fullMaps[nodeVal] = itemRest;
478
+ },
479
+ { children: childrenField }
480
+ );
481
+ internalData.nodeMaps = keyMaps;
482
+ internalData.fullNodeMaps = fullMaps;
483
+ reactData.fullOptFlag++;
484
+ };
485
+ const updateAfterDataIndex = () => {
486
+ const { separator } = props;
487
+ const { afterTreeList, nodeMaps } = internalData;
488
+ const labelField = computeLabelField.value;
489
+ const childrenField = computeChildrenField.value;
490
+ const mapChildrenField = computeMapChildrenField.value;
491
+ const treeOpts = computeTreeOpts.value;
492
+ const { transform } = treeOpts;
493
+ let vtIndex = 0;
494
+ import_xe_utils.default.eachTree(
495
+ afterTreeList,
496
+ (item, index, items, path, parenItem, nodes) => {
497
+ const nodeid = getNodeId(item);
498
+ const nodeItem = nodeMaps[nodeid];
499
+ if (nodeItem) {
500
+ nodeItem.items = items;
501
+ nodeItem.treeIndex = index;
502
+ nodeItem._index = vtIndex;
503
+ } else {
504
+ const rest = {
505
+ item,
506
+ index,
507
+ $index: -1,
508
+ _index: vtIndex,
509
+ items,
510
+ parent: parenItem,
511
+ nodes,
512
+ level: nodes.length - 1,
513
+ treeIndex: index,
514
+ lineCount: 0,
515
+ treeLoaded: false,
516
+ fullLabel: nodes.map((item2) => item2[labelField]).join(separator || " / ")
517
+ };
518
+ nodeMaps[nodeid] = rest;
519
+ }
520
+ vtIndex++;
521
+ },
522
+ { children: transform ? mapChildrenField : childrenField }
523
+ );
524
+ };
525
+ const updateAfterFullData = () => {
526
+ const { searchValue } = reactData;
527
+ const { treeFullData, lastFilterValue } = internalData;
528
+ const labelField = computeLabelField.value;
529
+ const childrenField = computeChildrenField.value;
530
+ const mapChildrenField = computeMapChildrenField.value;
531
+ const treeOpts = computeTreeOpts.value;
532
+ const { transform } = treeOpts;
533
+ const filterOpts = computeFilterOpts.value;
534
+ const { beforeFilterMethod, filterMethod, afterFilterMethod } = filterOpts;
535
+ let fullList = treeFullData;
536
+ let treeList = fullList;
537
+ let filterStr = "";
538
+ if (searchValue) {
539
+ filterStr = `${searchValue}`;
540
+ const handleSearch = filterMethod ? (item) => {
541
+ return filterMethod({
542
+ $cascader: $xeCascader,
543
+ node: item,
544
+ filterValue: filterStr
545
+ });
546
+ } : (item) => {
547
+ return String(item[labelField]).toLowerCase().indexOf(filterStr.toLowerCase()) > -1;
548
+ };
549
+ const bafParams = { $cascader: $xeCascader, filterValue: filterStr };
550
+ if (beforeFilterMethod) {
551
+ beforeFilterMethod(bafParams);
517
552
  }
518
- vtIndex++;
519
- },
520
- { children: transform ? mapChildrenField : childrenField }
521
- );
522
- };
523
- const updateAfterFullData = () => {
524
- const { searchValue } = reactData;
525
- const { treeFullData, lastFilterValue } = internalData;
526
- const labelField = computeLabelField.value;
527
- const childrenField = computeChildrenField.value;
528
- const mapChildrenField = computeMapChildrenField.value;
529
- const treeOpts = computeTreeOpts.value;
530
- const { transform } = treeOpts;
531
- const filterOpts = computeFilterOpts.value;
532
- const { beforeFilterMethod, filterMethod, afterFilterMethod } = filterOpts;
533
- let fullList = treeFullData;
534
- let treeList = fullList;
535
- let filterStr = "";
536
- if (searchValue) {
537
- filterStr = `${searchValue}`;
538
- const handleSearch = filterMethod ? (item) => {
539
- return filterMethod({
540
- $cascader: $xeCascader,
541
- node: item,
542
- filterValue: filterStr
543
- });
544
- } : (item) => {
545
- return String(item[labelField]).toLowerCase().indexOf(filterStr.toLowerCase()) > -1;
546
- };
547
- const bafParams = { $cascader: $xeCascader, filterValue: filterStr };
548
- if (beforeFilterMethod) {
549
- beforeFilterMethod(bafParams);
550
- }
551
- if (transform) {
552
- treeList = import_xe_utils.default.searchTree(treeFullData, handleSearch, {
553
- original: true,
554
- isEvery: false,
555
- children: childrenField,
556
- mapChildren: mapChildrenField
553
+ if (transform) {
554
+ treeList = import_xe_utils.default.searchTree(treeFullData, handleSearch, {
555
+ original: true,
556
+ isEvery: false,
557
+ children: childrenField,
558
+ mapChildren: mapChildrenField
559
+ });
560
+ fullList = treeList;
561
+ } else {
562
+ fullList = treeFullData.filter(handleSearch);
563
+ }
564
+ internalData.lastFilterValue = filterStr;
565
+ (0, import_vue.nextTick)(() => {
566
+ if (afterFilterMethod) {
567
+ afterFilterMethod(bafParams);
568
+ }
557
569
  });
558
- fullList = treeList;
559
570
  } else {
560
- fullList = treeFullData.filter(handleSearch);
561
- }
562
- internalData.lastFilterValue = filterStr;
563
- (0, import_vue.nextTick)(() => {
564
- if (afterFilterMethod) {
565
- afterFilterMethod(bafParams);
571
+ if (transform) {
572
+ treeList = import_xe_utils.default.searchTree(treeFullData, () => true, {
573
+ original: true,
574
+ isEvery: false,
575
+ children: childrenField,
576
+ mapChildren: mapChildrenField
577
+ });
578
+ fullList = treeList;
579
+ if (lastFilterValue) {
580
+ const bafParams = { $cascader: $xeCascader, filterValue: filterStr };
581
+ if (beforeFilterMethod) {
582
+ beforeFilterMethod(bafParams);
583
+ }
584
+ (0, import_vue.nextTick)(() => {
585
+ if (afterFilterMethod) {
586
+ afterFilterMethod(bafParams);
587
+ }
588
+ });
589
+ }
566
590
  }
567
- });
568
- } else {
591
+ internalData.lastFilterValue = "";
592
+ }
593
+ internalData.afterVisibleList = fullList;
594
+ internalData.afterTreeList = treeList;
595
+ updateAfterDataIndex();
596
+ };
597
+ const handleTreeToList = () => {
598
+ const { afterTreeList, treeExpandedMaps } = internalData;
599
+ const mapChildrenField = computeMapChildrenField.value;
600
+ const treeOpts = computeTreeOpts.value;
601
+ const { transform } = treeOpts;
602
+ const expandMaps = {};
569
603
  if (transform) {
570
- treeList = import_xe_utils.default.searchTree(treeFullData, () => true, {
571
- original: true,
572
- isEvery: false,
573
- children: childrenField,
574
- mapChildren: mapChildrenField
575
- });
576
- fullList = treeList;
577
- if (lastFilterValue) {
578
- const bafParams = { $cascader: $xeCascader, filterValue: filterStr };
579
- if (beforeFilterMethod) {
580
- beforeFilterMethod(bafParams);
581
- }
582
- (0, import_vue.nextTick)(() => {
583
- if (afterFilterMethod) {
584
- afterFilterMethod(bafParams);
604
+ const fullData = [];
605
+ import_xe_utils.default.eachTree(
606
+ afterTreeList,
607
+ (item, index, items, path, parentRow) => {
608
+ const nodeid = getNodeId(item);
609
+ const parentNodeid = getNodeId(parentRow);
610
+ if (!parentRow || expandMaps[parentNodeid] && treeExpandedMaps[parentNodeid]) {
611
+ expandMaps[nodeid] = 1;
612
+ fullData.push(item);
585
613
  }
586
- });
587
- }
614
+ },
615
+ { children: mapChildrenField }
616
+ );
617
+ internalData.afterVisibleList = fullData;
618
+ return fullData;
588
619
  }
589
- internalData.lastFilterValue = "";
590
- }
591
- internalData.afterVisibleList = fullList;
592
- internalData.afterTreeList = treeList;
593
- updateAfterDataIndex();
594
- };
595
- const handleTreeToList = () => {
596
- const { afterTreeList, treeExpandedMaps } = internalData;
597
- const mapChildrenField = computeMapChildrenField.value;
598
- const treeOpts = computeTreeOpts.value;
599
- const { transform } = treeOpts;
600
- const expandMaps = {};
601
- if (transform) {
602
- const fullData = [];
603
- import_xe_utils.default.eachTree(
604
- afterTreeList,
605
- (item, index, items, path, parentRow) => {
606
- const nodeid = getNodeId(item);
607
- const parentNodeid = getNodeId(parentRow);
608
- if (!parentRow || expandMaps[parentNodeid] && treeExpandedMaps[parentNodeid]) {
609
- expandMaps[nodeid] = 1;
610
- fullData.push(item);
620
+ return internalData.afterVisibleList;
621
+ };
622
+ const handleData = (force) => {
623
+ let fullList = internalData.afterVisibleList;
624
+ if (force) {
625
+ updateAfterFullData();
626
+ fullList = handleTreeToList();
627
+ }
628
+ const treeList = fullList.slice(0);
629
+ reactData.treeList = treeList;
630
+ };
631
+ function handleHasChildNodeIds(treeList, type) {
632
+ const childrenField = computeChildrenField.value;
633
+ const mapChildrenField = computeMapChildrenField.value;
634
+ const treeOpts = computeTreeOpts.value;
635
+ const { transform } = treeOpts;
636
+ const childField = transform ? mapChildrenField : childrenField;
637
+ const nodeIds = [];
638
+ let currList = treeList;
639
+ while (currList.length) {
640
+ let targetNode = null;
641
+ for (const item of currList) {
642
+ const kids = item[childField];
643
+ if (import_xe_utils.default.isArray(kids) && kids.length > 0) {
644
+ targetNode = item;
645
+ break;
611
646
  }
612
- },
613
- { children: mapChildrenField }
614
- );
615
- internalData.afterVisibleList = fullData;
616
- return fullData;
617
- }
618
- return internalData.afterVisibleList;
619
- };
620
- const handleData = (force) => {
621
- let fullList = internalData.afterVisibleList;
622
- if (force) {
623
- updateAfterFullData();
624
- fullList = handleTreeToList();
625
- }
626
- const treeList = fullList.slice(0);
627
- reactData.treeList = treeList;
628
- };
629
- function handleHasChildNodeIds(treeList, type) {
630
- const childrenField = computeChildrenField.value;
631
- const mapChildrenField = computeMapChildrenField.value;
632
- const treeOpts = computeTreeOpts.value;
633
- const { transform } = treeOpts;
634
- const childField = transform ? mapChildrenField : childrenField;
635
- const nodeIds = [];
636
- let currList = treeList;
637
- while (currList.length) {
638
- let targetNode = null;
639
- for (const item of currList) {
640
- const kids = item[childField];
641
- if (import_xe_utils.default.isArray(kids) && kids.length > 0) {
642
- targetNode = item;
647
+ }
648
+ if (targetNode) {
649
+ nodeIds.push(getNodeId(targetNode));
650
+ currList = targetNode[childField];
651
+ } else {
652
+ const endNode = import_xe_utils.default[type](currList);
653
+ nodeIds.push(getNodeId(endNode));
643
654
  break;
644
655
  }
645
656
  }
646
- if (targetNode) {
647
- nodeIds.push(getNodeId(targetNode));
648
- currList = targetNode[childField];
649
- } else {
650
- const endNode = import_xe_utils.default[type](currList);
651
- nodeIds.push(getNodeId(endNode));
652
- break;
653
- }
657
+ return nodeIds;
654
658
  }
655
- return nodeIds;
656
- }
657
- const triggerSearchEvent = import_xe_utils.default.debounce(
658
- () => {
659
+ const triggerSearchEvent = import_xe_utils.default.debounce(
660
+ () => {
661
+ handleData(true);
662
+ updateCheckboxStatus();
663
+ const { currentItems } = reactData;
664
+ const { afterTreeList } = internalData;
665
+ const filterOpts = computeFilterOpts.value;
666
+ const { autoExpandMode } = filterOpts;
667
+ if (!isPathInTree(afterTreeList, currentItems)) {
668
+ if (autoExpandMode === "first" || autoExpandMode === "last") {
669
+ const stItems = handleHasChildNodeIds(afterTreeList, autoExpandMode);
670
+ const expandedMaps = {};
671
+ stItems.forEach((nodeid) => {
672
+ expandedMaps[nodeid] = true;
673
+ });
674
+ internalData.treeExpandedMaps = expandedMaps;
675
+ reactData.currentItems = stItems;
676
+ } else {
677
+ handleCurrentItems();
678
+ }
679
+ }
680
+ updateCurrentChunk();
681
+ },
682
+ 350,
683
+ { trailing: true }
684
+ );
685
+ const loadData = (list) => {
686
+ const treeOpts = computeTreeOpts.value;
687
+ const keyField = computeKeyField.value;
688
+ const parentField = computeParentField.value;
689
+ const childrenField = computeChildrenField.value;
690
+ const { rootParentValue, rootValues } = treeOpts;
691
+ const { transform } = treeOpts;
692
+ const fullData = transform ? import_xe_utils.default.toArrayTree(list, {
693
+ key: keyField,
694
+ parentKey: parentField,
695
+ mapChildren: childrenField,
696
+ rootParentValue,
697
+ rootValues
698
+ }) : list ? list.slice(0) : [];
699
+ internalData.treeFullData = fullData;
700
+ cacheNodeMap();
659
701
  handleData(true);
660
- updateCheckboxStatus();
702
+ updateModelChecked();
703
+ handleCurrentItems();
704
+ updateCurrentChunk();
705
+ return (0, import_vue.nextTick)();
706
+ };
707
+ const updateCurrentChunk = () => {
661
708
  const { currentItems } = reactData;
662
709
  const { afterTreeList } = internalData;
663
- const filterOpts = computeFilterOpts.value;
664
- const { autoExpandMode } = filterOpts;
665
- if (!isPathInTree(afterTreeList, currentItems)) {
666
- if (autoExpandMode === "first" || autoExpandMode === "last") {
667
- const stItems = handleHasChildNodeIds(afterTreeList, autoExpandMode);
668
- const expandedMaps = {};
669
- stItems.forEach((nodeid) => {
710
+ const childrenField = computeChildrenField.value;
711
+ const mapChildrenField = computeMapChildrenField.value;
712
+ const treeOpts = computeTreeOpts.value;
713
+ const { transform } = treeOpts;
714
+ const currentCunkList = [afterTreeList];
715
+ if (currentItems.length) {
716
+ let chunkIndex = 0;
717
+ let stNodeid = currentItems[chunkIndex];
718
+ let optList = afterTreeList;
719
+ while (stNodeid && optList && optList.length) {
720
+ stNodeid = currentItems[chunkIndex++];
721
+ const currOption = optList.find((item) => stNodeid === getNodeId(item));
722
+ optList = currOption ? currOption[transform ? mapChildrenField : childrenField] : [];
723
+ if (!optList || !optList.length) {
724
+ break;
725
+ }
726
+ currentCunkList.push(optList);
727
+ }
728
+ }
729
+ reactData.currentCunkList = currentCunkList;
730
+ };
731
+ const handleCurrentItems = () => {
732
+ const { currentNode } = reactData;
733
+ const { afterTreeList } = internalData;
734
+ const selectVals = computeSelectVals.value;
735
+ const childrenField = computeChildrenField.value;
736
+ const mapChildrenField = computeMapChildrenField.value;
737
+ const treeOpts = computeTreeOpts.value;
738
+ const { transform } = treeOpts;
739
+ const stItems = [];
740
+ const expandedMaps = {};
741
+ const lastVal = currentNode ? getNodeId(currentNode) : (0, import_util.enNodeValue)(import_xe_utils.default.last(selectVals));
742
+ if (lastVal) {
743
+ const stRest = import_xe_utils.default.findTree(afterTreeList, (item) => lastVal === getNodeId(item), { children: transform ? mapChildrenField : childrenField });
744
+ if (stRest) {
745
+ const { nodes } = stRest;
746
+ nodes.forEach((item) => {
747
+ const nodeid = getNodeId(item);
670
748
  expandedMaps[nodeid] = true;
749
+ stItems.push(nodeid);
671
750
  });
672
- internalData.treeExpandedMaps = expandedMaps;
673
- reactData.currentItems = stItems;
674
- } else {
675
- handleCurrentItems();
676
751
  }
677
752
  }
678
- updateCurrentChunk();
679
- },
680
- 350,
681
- { trailing: true }
682
- );
683
- const loadData = (list) => {
684
- const treeOpts = computeTreeOpts.value;
685
- const keyField = computeKeyField.value;
686
- const parentField = computeParentField.value;
687
- const childrenField = computeChildrenField.value;
688
- const { rootParentValue, rootValues } = treeOpts;
689
- const { transform } = treeOpts;
690
- const fullData = transform ? import_xe_utils.default.toArrayTree(list, {
691
- key: keyField,
692
- parentKey: parentField,
693
- mapChildren: childrenField,
694
- rootParentValue,
695
- rootValues
696
- }) : list ? list.slice(0) : [];
697
- internalData.treeFullData = fullData;
698
- cacheNodeMap();
699
- handleData(true);
700
- updateModelChecked();
701
- handleCurrentItems();
702
- updateCurrentChunk();
703
- return (0, import_vue.nextTick)();
704
- };
705
- const updateCurrentChunk = () => {
706
- const { currentItems } = reactData;
707
- const { afterTreeList } = internalData;
708
- const childrenField = computeChildrenField.value;
709
- const mapChildrenField = computeMapChildrenField.value;
710
- const treeOpts = computeTreeOpts.value;
711
- const { transform } = treeOpts;
712
- const currentCunkList = [afterTreeList];
713
- if (currentItems.length) {
714
- let chunkIndex = 0;
715
- let stNodeid = currentItems[chunkIndex];
716
- let optList = afterTreeList;
717
- while (stNodeid && optList && optList.length) {
718
- stNodeid = currentItems[chunkIndex++];
719
- const currOption = optList.find((item) => stNodeid === getNodeId(item));
720
- optList = currOption ? currOption[transform ? mapChildrenField : childrenField] : [];
721
- if (!optList || !optList.length) {
722
- break;
723
- }
724
- currentCunkList.push(optList);
753
+ reactData.currentItems = stItems;
754
+ internalData.treeExpandedMaps = expandedMaps;
755
+ };
756
+ const updateZindex = () => {
757
+ const popupOpts = computePopupOpts.value;
758
+ const { zIndex } = popupOpts;
759
+ if (zIndex) {
760
+ reactData.panelIndex = zIndex;
761
+ } else if (reactData.panelIndex < (0, import_utils.getLastZIndex)()) {
762
+ reactData.panelIndex = (0, import_utils.nextZIndex)();
725
763
  }
726
- }
727
- reactData.currentCunkList = currentCunkList;
728
- };
729
- const handleCurrentItems = () => {
730
- const { currentNode } = reactData;
731
- const { afterTreeList } = internalData;
732
- const selectVals = computeSelectVals.value;
733
- const childrenField = computeChildrenField.value;
734
- const mapChildrenField = computeMapChildrenField.value;
735
- const treeOpts = computeTreeOpts.value;
736
- const { transform } = treeOpts;
737
- const stItems = [];
738
- const expandedMaps = {};
739
- const lastVal = currentNode ? getNodeId(currentNode) : (0, import_util.enNodeValue)(import_xe_utils.default.last(selectVals));
740
- if (lastVal) {
741
- const stRest = import_xe_utils.default.findTree(afterTreeList, (item) => lastVal === getNodeId(item), { children: transform ? mapChildrenField : childrenField });
742
- if (stRest) {
743
- const { nodes } = stRest;
744
- nodes.forEach((item) => {
745
- const nodeid = getNodeId(item);
746
- expandedMaps[nodeid] = true;
747
- stItems.push(nodeid);
764
+ };
765
+ const updatePlacement = () => {
766
+ const { panelIndex } = reactData;
767
+ const targetElem = refElem.value;
768
+ const panelElem = refOptionPanel.value;
769
+ const btnTransfer = computeBtnTransfer.value;
770
+ const popupOpts = computePopupOpts.value;
771
+ const handleStyle = () => {
772
+ const ppObj = (0, import_dom.updatePanelPlacement)(targetElem, panelElem, {
773
+ placement: popupOpts.placement,
774
+ defaultPlacement: popupOpts.defaultPlacement,
775
+ appendTo: popupOpts.appendTo,
776
+ teleportTo: btnTransfer,
777
+ isMinWidth: false
778
+ });
779
+ const panelStyle = Object.assign(ppObj.style, {
780
+ zIndex: panelIndex
748
781
  });
782
+ reactData.panelStyle = panelStyle;
783
+ reactData.panelPlacement = ppObj.placement;
784
+ };
785
+ handleStyle();
786
+ return (0, import_vue.nextTick)().then(handleStyle);
787
+ };
788
+ const showOptionPanel = (evnt) => {
789
+ const { loading, remote, filterable } = props;
790
+ const { treeFullData } = internalData;
791
+ const isDisabled = computeIsDisabled.value;
792
+ const remoteOpts = computeRemoteOpts.value;
793
+ if (!loading && !isDisabled) {
794
+ clearTimeout(internalData.hpTimeout);
795
+ if (!reactData.initialized) {
796
+ reactData.initialized = true;
797
+ }
798
+ reactData.isActivated = true;
799
+ reactData.isAniVisible = true;
800
+ if (filterable) {
801
+ if (remote && remoteOpts.enabled && remoteOpts.autoLoad && !treeFullData.length) {
802
+ handleSearchEvent();
803
+ }
804
+ }
805
+ setTimeout(() => {
806
+ reactData.visiblePanel = true;
807
+ handleFocusSearch();
808
+ }, 10);
809
+ updateZindex();
810
+ updatePlacement();
811
+ dispatchEvent("visible-change", { visible: true }, evnt || null);
749
812
  }
750
- }
751
- reactData.currentItems = stItems;
752
- internalData.treeExpandedMaps = expandedMaps;
753
- };
754
- const updateZindex = () => {
755
- const popupOpts = computePopupOpts.value;
756
- const { zIndex } = popupOpts;
757
- if (zIndex) {
758
- reactData.panelIndex = zIndex;
759
- } else if (reactData.panelIndex < (0, import_utils.getLastZIndex)()) {
760
- reactData.panelIndex = (0, import_utils.nextZIndex)();
761
- }
762
- };
763
- const updatePlacement = () => {
764
- const { panelIndex } = reactData;
765
- const targetElem = refElem.value;
766
- const panelElem = refOptionPanel.value;
767
- const btnTransfer = computeBtnTransfer.value;
768
- const popupOpts = computePopupOpts.value;
769
- const handleStyle = () => {
770
- const ppObj = (0, import_dom.updatePanelPlacement)(targetElem, panelElem, {
771
- placement: popupOpts.placement,
772
- defaultPlacement: popupOpts.defaultPlacement,
773
- appendTo: popupOpts.appendTo,
774
- teleportTo: btnTransfer,
775
- isMinWidth: false
813
+ };
814
+ const hideOptionPanel = (evnt) => {
815
+ reactData.visiblePanel = false;
816
+ internalData.hpTimeout = setTimeout(() => {
817
+ reactData.isAniVisible = false;
818
+ }, 350);
819
+ dispatchEvent("visible-change", { visible: false }, evnt || null);
820
+ };
821
+ const setCurrentNode = (node) => {
822
+ reactData.currentNode = node;
823
+ updateCurrentChunk();
824
+ return (0, import_vue.nextTick)();
825
+ };
826
+ const setAllCheckboxNode = (checked) => {
827
+ const selectMaps = {};
828
+ const childrenField = computeChildrenField.value;
829
+ const mapChildrenField = computeMapChildrenField.value;
830
+ const treeOpts = computeTreeOpts.value;
831
+ const { transform } = treeOpts;
832
+ const checkKeys = [];
833
+ const checkNodes = [];
834
+ if (checked) {
835
+ import_xe_utils.default.eachTree(
836
+ internalData.afterTreeList,
837
+ (node) => {
838
+ const nodeid = getNodeId(node);
839
+ checkKeys.push(nodeid);
840
+ checkNodes.push(node);
841
+ selectMaps[nodeid] = true;
842
+ },
843
+ { children: transform ? mapChildrenField : childrenField }
844
+ );
845
+ }
846
+ internalData.indeterminateRowMaps = {};
847
+ internalData.selectCheckboxMaps = selectMaps;
848
+ reactData.updateCheckboxFlag++;
849
+ updateCheckboxStatus();
850
+ return (0, import_vue.nextTick)().then(() => {
851
+ return { checkNodeKeys: checkKeys, checkNodes };
776
852
  });
777
- const panelStyle = Object.assign(ppObj.style, {
778
- zIndex: panelIndex
853
+ };
854
+ const clearSelectedNode = () => {
855
+ internalData.indeterminateRowMaps = {};
856
+ internalData.selectCheckboxMaps = {};
857
+ reactData.updateCheckboxFlag++;
858
+ reactData.selectRadioKey = null;
859
+ updateCheckboxStatus();
860
+ return (0, import_vue.nextTick)().then(() => {
861
+ return { checkNodeKeys: [], checkNodes: [] };
779
862
  });
780
- reactData.panelStyle = panelStyle;
781
- reactData.panelPlacement = ppObj.placement;
782
863
  };
783
- handleStyle();
784
- return (0, import_vue.nextTick)().then(handleStyle);
785
- };
786
- const showOptionPanel = (evnt) => {
787
- const { loading, remote, filterable } = props;
788
- const { treeFullData } = internalData;
789
- const isDisabled = computeIsDisabled.value;
790
- const remoteOpts = computeRemoteOpts.value;
791
- if (!loading && !isDisabled) {
792
- clearTimeout(internalData.hpTimeout);
793
- if (!reactData.initialized) {
794
- reactData.initialized = true;
795
- }
796
- reactData.isActivated = true;
797
- reactData.isAniVisible = true;
798
- if (filterable) {
799
- if (remote && remoteOpts.enabled && remoteOpts.autoLoad && !treeFullData.length) {
800
- handleSearchEvent();
864
+ const changeEvent = (evnt, selectValue, node) => {
865
+ const value = import_xe_utils.default.isArray(selectValue) ? selectValue.map(import_util.deNodeValue) : (0, import_util.deNodeValue)(selectValue);
866
+ internalData.isUpdateMode = true;
867
+ emitModel(value);
868
+ if (value !== props.modelValue) {
869
+ dispatchEvent("change", { value, node, option: node }, evnt);
870
+ if ($xeForm && formItemInfo) {
871
+ $xeForm.triggerItemEvent(evnt, formItemInfo.itemConfig.field, value);
801
872
  }
802
873
  }
803
- setTimeout(() => {
804
- reactData.visiblePanel = true;
805
- handleFocusSearch();
806
- }, 10);
807
- updateZindex();
808
- updatePlacement();
809
- dispatchEvent("visible-change", { visible: true }, evnt || null);
810
- }
811
- };
812
- const hideOptionPanel = (evnt) => {
813
- reactData.visiblePanel = false;
814
- internalData.hpTimeout = setTimeout(() => {
815
- reactData.isAniVisible = false;
816
- }, 350);
817
- dispatchEvent("visible-change", { visible: false }, evnt || null);
818
- };
819
- const setCurrentNode = (node) => {
820
- reactData.currentNode = node;
821
- updateCurrentChunk();
822
- return (0, import_vue.nextTick)();
823
- };
824
- const setAllCheckboxNode = (checked) => {
825
- const selectMaps = {};
826
- const childrenField = computeChildrenField.value;
827
- const mapChildrenField = computeMapChildrenField.value;
828
- const treeOpts = computeTreeOpts.value;
829
- const { transform } = treeOpts;
830
- const checkKeys = [];
831
- const checkNodes = [];
832
- if (checked) {
833
- import_xe_utils.default.eachTree(
834
- internalData.afterTreeList,
835
- (node) => {
836
- const nodeid = getNodeId(node);
837
- checkKeys.push(nodeid);
838
- checkNodes.push(node);
839
- selectMaps[nodeid] = true;
840
- },
841
- { children: transform ? mapChildrenField : childrenField }
842
- );
843
- }
844
- internalData.indeterminateRowMaps = {};
845
- internalData.selectCheckboxMaps = selectMaps;
846
- reactData.updateCheckboxFlag++;
847
- updateCheckboxStatus();
848
- return (0, import_vue.nextTick)().then(() => {
849
- return { checkNodeKeys: checkKeys, checkNodes };
850
- });
851
- };
852
- const clearSelectedNode = () => {
853
- internalData.indeterminateRowMaps = {};
854
- internalData.selectCheckboxMaps = {};
855
- reactData.updateCheckboxFlag++;
856
- reactData.selectRadioKey = null;
857
- updateCheckboxStatus();
858
- return (0, import_vue.nextTick)().then(() => {
859
- return { checkNodeKeys: [], checkNodes: [] };
860
- });
861
- };
862
- const changeEvent = (evnt, selectValue, node) => {
863
- const value = import_xe_utils.default.isArray(selectValue) ? selectValue.map(import_util.deNodeValue) : (0, import_util.deNodeValue)(selectValue);
864
- internalData.isUpdateMode = true;
865
- emitModel(value);
866
- if (value !== props.modelValue) {
867
- dispatchEvent("change", { value, node, option: node }, evnt);
868
- if ($xeForm && formItemInfo) {
869
- $xeForm.triggerItemEvent(evnt, formItemInfo.itemConfig.field, value);
874
+ };
875
+ const clearValueEvent = (evnt, selectValue) => {
876
+ changeEvent(evnt, selectValue, null);
877
+ dispatchEvent("clear", { value: selectValue }, evnt);
878
+ };
879
+ const clearEvent = (params, evnt) => {
880
+ clearValueEvent(evnt, null);
881
+ hideOptionPanel(evnt);
882
+ };
883
+ const allCheckedPanelEvent = (params) => {
884
+ const { $event } = params;
885
+ const { multiple, checkedClosable } = props;
886
+ if (multiple) {
887
+ setAllCheckboxNode(true).then(({ checkNodeKeys, checkNodes }) => {
888
+ changeEvent($event, checkNodeKeys, checkNodes[0]);
889
+ dispatchEvent("all-change", { value: checkNodeKeys }, $event);
890
+ if (checkedClosable) {
891
+ hideOptionPanel($event);
892
+ }
893
+ });
870
894
  }
871
- }
872
- };
873
- const clearValueEvent = (evnt, selectValue) => {
874
- changeEvent(evnt, selectValue, null);
875
- dispatchEvent("clear", { value: selectValue }, evnt);
876
- };
877
- const clearEvent = (params, evnt) => {
878
- clearValueEvent(evnt, null);
879
- hideOptionPanel(evnt);
880
- };
881
- const allCheckedPanelEvent = (params) => {
882
- const { $event } = params;
883
- const { multiple, checkedClosable } = props;
884
- if (multiple) {
885
- setAllCheckboxNode(true).then(({ checkNodeKeys, checkNodes }) => {
886
- changeEvent($event, checkNodeKeys, checkNodes[0]);
887
- dispatchEvent("all-change", { value: checkNodeKeys }, $event);
895
+ };
896
+ const clearCheckedPanelEvent = (params) => {
897
+ const { $event } = params;
898
+ const { multiple, checkedClosable } = props;
899
+ const value = multiple ? [] : null;
900
+ clearSelectedNode().then(() => {
888
901
  if (checkedClosable) {
889
902
  hideOptionPanel($event);
890
903
  }
891
904
  });
892
- }
893
- };
894
- const clearCheckedPanelEvent = (params) => {
895
- const { $event } = params;
896
- const { multiple, checkedClosable } = props;
897
- const value = multiple ? [] : null;
898
- clearSelectedNode().then(() => {
899
- if (checkedClosable) {
900
- hideOptionPanel($event);
905
+ changeEvent($event, value, null);
906
+ dispatchEvent("clear", { value }, $event);
907
+ };
908
+ const closePanelEvent = (params) => {
909
+ const { $event } = params;
910
+ hideOptionPanel($event);
911
+ };
912
+ const handleGlobalMousedownEvent = (evnt) => {
913
+ const { visiblePanel } = reactData;
914
+ const isDisabled = computeIsDisabled.value;
915
+ if (!isDisabled) {
916
+ const el = refElem.value;
917
+ const panelElem = refOptionPanel.value;
918
+ reactData.isActivated = (0, import_dom.getEventTargetNode)(evnt, el).flag || (0, import_dom.getEventTargetNode)(evnt, panelElem).flag;
919
+ if (visiblePanel && !reactData.isActivated) {
920
+ hideOptionPanel(evnt);
921
+ }
901
922
  }
902
- });
903
- changeEvent($event, value, null);
904
- dispatchEvent("clear", { value }, $event);
905
- };
906
- const closePanelEvent = (params) => {
907
- const { $event } = params;
908
- hideOptionPanel($event);
909
- };
910
- const handleGlobalMousedownEvent = (evnt) => {
911
- const { visiblePanel } = reactData;
912
- const isDisabled = computeIsDisabled.value;
913
- if (!isDisabled) {
914
- const el = refElem.value;
915
- const panelElem = refOptionPanel.value;
916
- reactData.isActivated = (0, import_dom.getEventTargetNode)(evnt, el).flag || (0, import_dom.getEventTargetNode)(evnt, panelElem).flag;
917
- if (visiblePanel && !reactData.isActivated) {
923
+ };
924
+ const handleGlobalBlurEvent = (evnt) => {
925
+ const { visiblePanel, isActivated } = reactData;
926
+ if (visiblePanel) {
918
927
  hideOptionPanel(evnt);
919
928
  }
920
- }
921
- };
922
- const handleGlobalBlurEvent = (evnt) => {
923
- const { visiblePanel, isActivated } = reactData;
924
- if (visiblePanel) {
925
- hideOptionPanel(evnt);
926
- }
927
- if (isActivated) {
928
- reactData.isActivated = false;
929
- }
930
- if (visiblePanel || isActivated) {
931
- const $input = refInput.value;
932
- if ($input) {
933
- $input.blur();
929
+ if (isActivated) {
930
+ reactData.isActivated = false;
934
931
  }
935
- }
936
- };
937
- const handleGlobalResizeEvent = () => {
938
- const { visiblePanel } = reactData;
939
- if (visiblePanel) {
940
- updatePlacement();
941
- }
942
- };
943
- const handleGlobalScrollEvent = () => {
944
- const { visiblePanel } = reactData;
945
- if (visiblePanel) {
946
- updatePlacement();
947
- }
948
- };
949
- const handleFocusSearch = () => {
950
- if (props.filterable) {
951
- (0, import_vue.nextTick)(() => {
952
- const inpSearch = refInpSearch.value;
953
- if (inpSearch) {
954
- inpSearch.focus();
932
+ if (visiblePanel || isActivated) {
933
+ const $input = refInput.value;
934
+ if ($input) {
935
+ $input.blur();
955
936
  }
956
- });
957
- }
958
- };
959
- const changeCurrentEvent = (evnt, node) => {
960
- evnt.preventDefault();
961
- const isChecked = true;
962
- reactData.currentNode = node;
963
- dispatchEvent("current-change", { node, checked: isChecked }, evnt);
964
- };
965
- const changeRadioEvent = (evnt, node, chunks, chunkIndex) => {
966
- evnt.preventDefault();
967
- evnt.stopPropagation();
968
- const { currentItems } = reactData;
969
- const { nodeMaps } = internalData;
970
- const radioOpts = computeRadioOpts.value;
971
- const childrenField = computeChildrenField.value;
972
- const treeOpts = computeTreeOpts.value;
973
- const { transform } = treeOpts;
974
- const mapChildrenField = computeMapChildrenField.value;
975
- const { checkMode, checkMethod } = radioOpts;
976
- const nodeid = getNodeId(node);
977
- const childList = node[transform ? mapChildrenField : childrenField];
978
- const isExistChild = childList && childList.length > 0;
979
- const nodeItem = nodeMaps[nodeid] || {};
980
- const nLevel = nodeItem.level;
981
- const isDisabled = checkMethod ? !checkMethod({ $cascader: $xeCascader, node }) : !handleVisibleOrCheckMode(checkMode, isExistChild, nLevel);
982
- if (isDisabled) {
983
- return;
984
- }
985
- const value = nodeid;
986
- reactData.selectRadioKey = value;
987
- changeEvent(evnt, value, node);
988
- if (!currentItems.includes(nodeid)) {
989
- changeCurrentEvent(evnt, node);
990
- toggleExpandEvent(evnt, node, chunks, chunkIndex);
991
- }
992
- hideOptionPanel(evnt);
993
- };
994
- const handleAsyncTreeExpandChilds = (node) => {
995
- const checkboxOpts = computeCheckboxOpts.value;
996
- const treeOpts = computeTreeOpts.value;
997
- const { loadMethod } = treeOpts;
998
- const { checkStrictly } = checkboxOpts;
999
- return new Promise((resolve) => {
1000
- if (loadMethod) {
1001
- const { nodeMaps } = internalData;
1002
- const nodeid = getNodeId(node);
1003
- const nodeItem = nodeMaps[nodeid];
1004
- internalData.treeExpandLazyLoadedMaps[nodeid] = true;
1005
- Promise.resolve(loadMethod({ $cascader: $xeCascader, node })).then((childRecords) => {
1006
- const { treeExpandLazyLoadedMaps } = internalData;
1007
- nodeItem.treeLoaded = true;
1008
- if (treeExpandLazyLoadedMaps[nodeid]) {
1009
- treeExpandLazyLoadedMaps[nodeid] = false;
1010
- }
1011
- if (!import_xe_utils.default.isArray(childRecords)) {
1012
- childRecords = [];
1013
- }
1014
- if (childRecords) {
1015
- return $xeCascader.loadChildrenNode(node, childRecords).then((childRows) => {
1016
- const { treeExpandedMaps } = internalData;
1017
- if (childRows.length && !treeExpandedMaps[nodeid]) {
1018
- treeExpandedMaps[nodeid] = true;
1019
- }
1020
- reactData.updateExpandedFlag++;
1021
- if (!checkStrictly && $xeCascader.isCheckedByCheckboxNodeId(nodeid)) {
1022
- handleCheckedCheckboxNode(childRows, true);
1023
- }
1024
- dispatchEvent("load-success", { node, data: childRecords }, new Event("load-success"));
1025
- return (0, import_vue.nextTick)();
1026
- });
1027
- } else {
1028
- dispatchEvent("load-success", { node, data: childRecords }, new Event("load-success"));
1029
- }
1030
- }).catch((e) => {
1031
- const { treeExpandLazyLoadedMaps } = internalData;
1032
- nodeItem.treeLoaded = false;
1033
- if (treeExpandLazyLoadedMaps[nodeid]) {
1034
- treeExpandLazyLoadedMaps[nodeid] = false;
937
+ }
938
+ };
939
+ const handleGlobalResizeEvent = () => {
940
+ const { visiblePanel } = reactData;
941
+ if (visiblePanel) {
942
+ updatePlacement();
943
+ }
944
+ };
945
+ const handleGlobalScrollEvent = () => {
946
+ const { visiblePanel } = reactData;
947
+ if (visiblePanel) {
948
+ updatePlacement();
949
+ }
950
+ };
951
+ const handleFocusSearch = () => {
952
+ if (props.filterable) {
953
+ (0, import_vue.nextTick)(() => {
954
+ const inpSearch = refInpSearch.value;
955
+ if (inpSearch) {
956
+ inpSearch.focus();
1035
957
  }
1036
- dispatchEvent("load-error", { node, data: e }, new Event("load-error"));
1037
- }).finally(() => {
1038
- handleTreeToList();
1039
- handleData();
1040
958
  });
1041
- } else {
1042
- resolve();
1043
959
  }
1044
- });
1045
- };
1046
- const handleBaseTreeExpand = (nodeList, expanded) => {
1047
- const { treeExpandLazyLoadedMaps, treeExpandedMaps } = internalData;
1048
- const { nodeMaps } = internalData;
1049
- const childrenField = computeChildrenField.value;
1050
- const hasChildField = computeHasChildField.value;
1051
- const treeOpts = computeTreeOpts.value;
1052
- const { lazy, toggleMethod } = treeOpts;
1053
- const result = [];
1054
- let validNodes = toggleMethod ? nodeList.filter((node) => toggleMethod({ $cascader: $xeCascader, expanded, node })) : nodeList;
1055
- validNodes = validNodes.length ? [validNodes[validNodes.length - 1]] : [];
1056
- const nodeid = getNodeId(validNodes[0]);
1057
- const nodeItem = nodeMaps[nodeid];
1058
- if (nodeItem) {
1059
- nodeItem.items.forEach((item) => {
1060
- const itemNodeId = getNodeId(item);
1061
- if (treeExpandedMaps[itemNodeId]) {
1062
- delete treeExpandedMaps[itemNodeId];
960
+ };
961
+ const changeCurrentEvent = (evnt, node) => {
962
+ evnt.preventDefault();
963
+ const isChecked = true;
964
+ reactData.currentNode = node;
965
+ dispatchEvent("current-change", { node, checked: isChecked }, evnt);
966
+ };
967
+ const changeRadioEvent = (evnt, node, chunks, chunkIndex) => {
968
+ evnt.preventDefault();
969
+ evnt.stopPropagation();
970
+ const { currentItems } = reactData;
971
+ const { nodeMaps } = internalData;
972
+ const radioOpts = computeRadioOpts.value;
973
+ const childrenField = computeChildrenField.value;
974
+ const treeOpts = computeTreeOpts.value;
975
+ const { transform } = treeOpts;
976
+ const mapChildrenField = computeMapChildrenField.value;
977
+ const { checkMode, checkMethod } = radioOpts;
978
+ const nodeid = getNodeId(node);
979
+ const childList = node[transform ? mapChildrenField : childrenField];
980
+ const isExistChild = childList && childList.length > 0;
981
+ const nodeItem = nodeMaps[nodeid] || {};
982
+ const nLevel = nodeItem.level;
983
+ const isDisabled = checkMethod ? !checkMethod({ $cascader: $xeCascader, node }) : !handleVisibleOrCheckMode(checkMode, isExistChild, nLevel);
984
+ if (isDisabled) {
985
+ return;
986
+ }
987
+ const value = nodeid;
988
+ reactData.selectRadioKey = value;
989
+ changeEvent(evnt, value, node);
990
+ if (!currentItems.includes(nodeid)) {
991
+ changeCurrentEvent(evnt, node);
992
+ toggleExpandEvent(evnt, node, chunks, chunkIndex);
993
+ }
994
+ hideOptionPanel(evnt);
995
+ };
996
+ const handleAsyncTreeExpandChilds = (node) => {
997
+ const checkboxOpts = computeCheckboxOpts.value;
998
+ const treeOpts = computeTreeOpts.value;
999
+ const { loadMethod } = treeOpts;
1000
+ const { checkStrictly } = checkboxOpts;
1001
+ return new Promise((resolve) => {
1002
+ if (loadMethod) {
1003
+ const { nodeMaps } = internalData;
1004
+ const nodeid = getNodeId(node);
1005
+ const nodeItem = nodeMaps[nodeid];
1006
+ internalData.treeExpandLazyLoadedMaps[nodeid] = true;
1007
+ Promise.resolve(loadMethod({ $cascader: $xeCascader, node })).then((childRecords) => {
1008
+ const { treeExpandLazyLoadedMaps } = internalData;
1009
+ nodeItem.treeLoaded = true;
1010
+ if (treeExpandLazyLoadedMaps[nodeid]) {
1011
+ treeExpandLazyLoadedMaps[nodeid] = false;
1012
+ }
1013
+ if (!import_xe_utils.default.isArray(childRecords)) {
1014
+ childRecords = [];
1015
+ }
1016
+ if (childRecords) {
1017
+ return $xeCascader.loadChildrenNode(node, childRecords).then((childRows) => {
1018
+ const { treeExpandedMaps } = internalData;
1019
+ if (childRows.length && !treeExpandedMaps[nodeid]) {
1020
+ treeExpandedMaps[nodeid] = true;
1021
+ }
1022
+ reactData.updateExpandedFlag++;
1023
+ if (!checkStrictly && $xeCascader.isCheckedByCheckboxNodeId(nodeid)) {
1024
+ handleCheckedCheckboxNode(childRows, true);
1025
+ }
1026
+ dispatchEvent("load-success", { node, data: childRecords }, new Event("load-success"));
1027
+ return (0, import_vue.nextTick)();
1028
+ });
1029
+ } else {
1030
+ dispatchEvent("load-success", { node, data: childRecords }, new Event("load-success"));
1031
+ }
1032
+ }).catch((e) => {
1033
+ const { treeExpandLazyLoadedMaps } = internalData;
1034
+ nodeItem.treeLoaded = false;
1035
+ if (treeExpandLazyLoadedMaps[nodeid]) {
1036
+ treeExpandLazyLoadedMaps[nodeid] = false;
1037
+ }
1038
+ dispatchEvent("load-error", { node, data: e }, new Event("load-error"));
1039
+ }).finally(() => {
1040
+ handleTreeToList();
1041
+ handleData();
1042
+ });
1043
+ } else {
1044
+ resolve();
1063
1045
  }
1064
1046
  });
1065
- }
1066
- const expandNodes = [];
1067
- if (expanded) {
1068
- validNodes.forEach((item) => {
1069
- const itemNodeId = getNodeId(item);
1070
- if (!treeExpandedMaps[itemNodeId]) {
1071
- const nodeItem2 = nodeMaps[itemNodeId];
1072
- const isLoad = lazy && item[hasChildField] && !nodeItem2.treeLoaded && !treeExpandLazyLoadedMaps[itemNodeId];
1073
- if (isLoad) {
1074
- result.push(handleAsyncTreeExpandChilds(item));
1075
- } else {
1076
- if (item[childrenField] && item[childrenField].length) {
1077
- treeExpandedMaps[itemNodeId] = true;
1078
- expandNodes.push(item);
1047
+ };
1048
+ const handleBaseTreeExpand = (nodeList, expanded) => {
1049
+ const { treeExpandLazyLoadedMaps, treeExpandedMaps } = internalData;
1050
+ const { nodeMaps } = internalData;
1051
+ const childrenField = computeChildrenField.value;
1052
+ const hasChildField = computeHasChildField.value;
1053
+ const treeOpts = computeTreeOpts.value;
1054
+ const { lazy, toggleMethod } = treeOpts;
1055
+ const result = [];
1056
+ let validNodes = toggleMethod ? nodeList.filter((node) => toggleMethod({ $cascader: $xeCascader, expanded, node })) : nodeList;
1057
+ validNodes = validNodes.length ? [validNodes[validNodes.length - 1]] : [];
1058
+ const nodeid = getNodeId(validNodes[0]);
1059
+ const nodeItem = nodeMaps[nodeid];
1060
+ if (nodeItem) {
1061
+ nodeItem.items.forEach((item) => {
1062
+ const itemNodeId = getNodeId(item);
1063
+ if (treeExpandedMaps[itemNodeId]) {
1064
+ delete treeExpandedMaps[itemNodeId];
1065
+ }
1066
+ });
1067
+ }
1068
+ const expandNodes = [];
1069
+ if (expanded) {
1070
+ validNodes.forEach((item) => {
1071
+ const itemNodeId = getNodeId(item);
1072
+ if (!treeExpandedMaps[itemNodeId]) {
1073
+ const nodeItem2 = nodeMaps[itemNodeId];
1074
+ const isLoad = lazy && item[hasChildField] && !nodeItem2.treeLoaded && !treeExpandLazyLoadedMaps[itemNodeId];
1075
+ if (isLoad) {
1076
+ result.push(handleAsyncTreeExpandChilds(item));
1077
+ } else {
1078
+ if (item[childrenField] && item[childrenField].length) {
1079
+ treeExpandedMaps[itemNodeId] = true;
1080
+ expandNodes.push(item);
1081
+ }
1079
1082
  }
1080
1083
  }
1081
- }
1082
- });
1083
- } else {
1084
- validNodes.forEach((item) => {
1085
- const itemNodeId = getNodeId(item);
1086
- if (treeExpandedMaps[itemNodeId]) {
1087
- delete treeExpandedMaps[itemNodeId];
1088
- expandNodes.push(item);
1089
- }
1090
- });
1091
- }
1092
- reactData.updateExpandedFlag++;
1093
- handleTreeToList();
1094
- handleData();
1095
- return Promise.all(result);
1096
- };
1097
- const toggleExpandEvent = (evnt, node, chunks, chunkIndex) => {
1098
- const { currentItems } = reactData;
1099
- const { treeExpandLazyLoadedMaps } = internalData;
1100
- const treeOpts = computeTreeOpts.value;
1101
- const { lazy } = treeOpts;
1102
- const stItems = currentItems.slice(0, chunkIndex);
1103
- const nodeid = getNodeId(node);
1104
- const expanded = true;
1105
- evnt.stopPropagation();
1106
- stItems.push(nodeid);
1107
- reactData.currentItems = stItems;
1108
- if (!lazy || !treeExpandLazyLoadedMaps[nodeid]) {
1109
- handleBaseTreeExpand([node], expanded);
1110
- }
1111
- setCurrentNode(node);
1112
- dispatchEvent("node-expand", { node, expanded }, evnt);
1113
- };
1114
- const updateCheckboxStatus = () => {
1115
- const { selectCheckboxMaps, indeterminateRowMaps, afterTreeList } = internalData;
1116
- const childrenField = computeChildrenField.value;
1117
- const mapChildrenField = computeMapChildrenField.value;
1118
- const checkboxOpts = computeCheckboxOpts.value;
1119
- const { checkStrictly, checkMethod } = checkboxOpts;
1120
- const treeOpts = computeTreeOpts.value;
1121
- const { transform } = treeOpts;
1122
- if (!checkStrictly) {
1123
- const childRowMaps = {};
1124
- const childRowList = [];
1125
- import_xe_utils.default.eachTree(
1126
- afterTreeList,
1127
- (node) => {
1128
- const nodeid = getNodeId(node);
1129
- const childList = node[transform ? mapChildrenField : childrenField];
1130
- if (childList && childList.length && !childRowMaps[nodeid]) {
1131
- childRowMaps[nodeid] = 1;
1132
- childRowList.unshift([node, nodeid, childList]);
1084
+ });
1085
+ } else {
1086
+ validNodes.forEach((item) => {
1087
+ const itemNodeId = getNodeId(item);
1088
+ if (treeExpandedMaps[itemNodeId]) {
1089
+ delete treeExpandedMaps[itemNodeId];
1090
+ expandNodes.push(item);
1133
1091
  }
1134
- },
1135
- { children: transform ? mapChildrenField : childrenField }
1136
- );
1137
- childRowList.forEach((vals) => {
1138
- const node = vals[0];
1139
- const nodeid = vals[1];
1140
- const childList = vals[2];
1141
- let sLen = 0;
1142
- let hLen = 0;
1143
- let vLen = 0;
1144
- const cLen = childList.length;
1145
- childList.forEach(
1146
- checkMethod ? (item) => {
1147
- const childNodeid = getNodeId(item);
1148
- const isSelect = selectCheckboxMaps[childNodeid];
1149
- if (checkMethod({ $cascader: $xeCascader, node: item })) {
1150
- if (isSelect) {
1151
- sLen++;
1152
- } else if (indeterminateRowMaps[childNodeid]) {
1153
- hLen++;
1092
+ });
1093
+ }
1094
+ reactData.updateExpandedFlag++;
1095
+ handleTreeToList();
1096
+ handleData();
1097
+ return Promise.all(result);
1098
+ };
1099
+ const toggleExpandEvent = (evnt, node, chunks, chunkIndex) => {
1100
+ const { currentItems } = reactData;
1101
+ const { treeExpandLazyLoadedMaps } = internalData;
1102
+ const treeOpts = computeTreeOpts.value;
1103
+ const { lazy } = treeOpts;
1104
+ const stItems = currentItems.slice(0, chunkIndex);
1105
+ const nodeid = getNodeId(node);
1106
+ const expanded = true;
1107
+ evnt.stopPropagation();
1108
+ stItems.push(nodeid);
1109
+ reactData.currentItems = stItems;
1110
+ if (!lazy || !treeExpandLazyLoadedMaps[nodeid]) {
1111
+ handleBaseTreeExpand([node], expanded);
1112
+ }
1113
+ setCurrentNode(node);
1114
+ dispatchEvent("node-expand", { node, expanded }, evnt);
1115
+ };
1116
+ const updateCheckboxStatus = () => {
1117
+ const { selectCheckboxMaps, indeterminateRowMaps, afterTreeList } = internalData;
1118
+ const childrenField = computeChildrenField.value;
1119
+ const mapChildrenField = computeMapChildrenField.value;
1120
+ const checkboxOpts = computeCheckboxOpts.value;
1121
+ const { checkStrictly, checkMethod } = checkboxOpts;
1122
+ const treeOpts = computeTreeOpts.value;
1123
+ const { transform } = treeOpts;
1124
+ if (!checkStrictly) {
1125
+ const childRowMaps = {};
1126
+ const childRowList = [];
1127
+ import_xe_utils.default.eachTree(
1128
+ afterTreeList,
1129
+ (node) => {
1130
+ const nodeid = getNodeId(node);
1131
+ const childList = node[transform ? mapChildrenField : childrenField];
1132
+ if (childList && childList.length && !childRowMaps[nodeid]) {
1133
+ childRowMaps[nodeid] = 1;
1134
+ childRowList.unshift([node, nodeid, childList]);
1135
+ }
1136
+ },
1137
+ { children: transform ? mapChildrenField : childrenField }
1138
+ );
1139
+ childRowList.forEach((vals) => {
1140
+ const node = vals[0];
1141
+ const nodeid = vals[1];
1142
+ const childList = vals[2];
1143
+ let sLen = 0;
1144
+ let hLen = 0;
1145
+ let vLen = 0;
1146
+ const cLen = childList.length;
1147
+ childList.forEach(
1148
+ checkMethod ? (item) => {
1149
+ const childNodeid = getNodeId(item);
1150
+ const isSelect = selectCheckboxMaps[childNodeid];
1151
+ if (checkMethod({ $cascader: $xeCascader, node: item })) {
1152
+ if (isSelect) {
1153
+ sLen++;
1154
+ } else if (indeterminateRowMaps[childNodeid]) {
1155
+ hLen++;
1156
+ }
1157
+ vLen++;
1158
+ } else {
1159
+ if (isSelect) {
1160
+ sLen++;
1161
+ } else if (indeterminateRowMaps[childNodeid]) {
1162
+ hLen++;
1163
+ }
1154
1164
  }
1155
- vLen++;
1156
- } else {
1165
+ } : (item) => {
1166
+ const childNodeid = getNodeId(item);
1167
+ const isSelect = selectCheckboxMaps[childNodeid];
1157
1168
  if (isSelect) {
1158
1169
  sLen++;
1159
1170
  } else if (indeterminateRowMaps[childNodeid]) {
1160
1171
  hLen++;
1161
1172
  }
1173
+ vLen++;
1162
1174
  }
1163
- } : (item) => {
1164
- const childNodeid = getNodeId(item);
1165
- const isSelect = selectCheckboxMaps[childNodeid];
1166
- if (isSelect) {
1167
- sLen++;
1168
- } else if (indeterminateRowMaps[childNodeid]) {
1169
- hLen++;
1170
- }
1171
- vLen++;
1172
- }
1173
- );
1174
- let isSelected = false;
1175
- if (cLen > 0) {
1176
- if (vLen > 0) {
1177
- isSelected = (sLen > 0 || hLen > 0) && sLen >= vLen;
1178
- } else {
1179
- if (sLen > 0 && sLen >= vLen) {
1180
- isSelected = true;
1181
- } else if (selectCheckboxMaps[nodeid]) {
1182
- isSelected = true;
1175
+ );
1176
+ let isSelected = false;
1177
+ if (cLen > 0) {
1178
+ if (vLen > 0) {
1179
+ isSelected = (sLen > 0 || hLen > 0) && sLen >= vLen;
1183
1180
  } else {
1184
- isSelected = false;
1181
+ if (sLen > 0 && sLen >= vLen) {
1182
+ isSelected = true;
1183
+ } else if (selectCheckboxMaps[nodeid]) {
1184
+ isSelected = true;
1185
+ } else {
1186
+ isSelected = false;
1187
+ }
1185
1188
  }
1186
- }
1187
- } else {
1188
- isSelected = selectCheckboxMaps[nodeid];
1189
- }
1190
- const halfSelect = !isSelected && (sLen > 0 || hLen > 0);
1191
- if (isSelected) {
1192
- selectCheckboxMaps[nodeid] = node;
1193
- if (indeterminateRowMaps[nodeid]) {
1194
- delete indeterminateRowMaps[nodeid];
1195
- }
1196
- } else {
1197
- if (selectCheckboxMaps[nodeid]) {
1198
- delete selectCheckboxMaps[nodeid];
1199
- }
1200
- if (halfSelect) {
1201
- indeterminateRowMaps[nodeid] = node;
1202
1189
  } else {
1203
- if (indeterminateRowMaps[nodeid]) {
1204
- delete indeterminateRowMaps[nodeid];
1205
- }
1190
+ isSelected = selectCheckboxMaps[nodeid];
1206
1191
  }
1207
- }
1208
- });
1209
- reactData.updateCheckboxFlag++;
1210
- }
1211
- };
1212
- const changeCheckboxEvent = (evnt, node, chunks, chunkIndex) => {
1213
- evnt.preventDefault();
1214
- evnt.stopPropagation();
1215
- const { currentItems } = reactData;
1216
- const { selectCheckboxMaps, nodeMaps } = internalData;
1217
- const childrenField = computeChildrenField.value;
1218
- const mapChildrenField = computeMapChildrenField.value;
1219
- const checkboxOpts = computeCheckboxOpts.value;
1220
- const { checkStrictly, checkMode, checkMethod } = checkboxOpts;
1221
- const treeOpts = computeTreeOpts.value;
1222
- const { transform } = treeOpts;
1223
- const nodeid = getNodeId(node);
1224
- const childList = node[transform ? mapChildrenField : childrenField];
1225
- const isExistChild = childList && childList.length > 0;
1226
- const nodeItem = nodeMaps[nodeid] || {};
1227
- const nLevel = nodeItem.level;
1228
- const isDisabled = checkMethod ? !checkMethod({ $cascader: $xeCascader, node }) : !handleVisibleOrCheckMode(checkMode, isExistChild, nLevel);
1229
- if (isDisabled) {
1230
- return;
1231
- }
1232
- let isChecked = false;
1233
- if (selectCheckboxMaps[nodeid]) {
1234
- delete selectCheckboxMaps[nodeid];
1235
- } else {
1236
- isChecked = true;
1237
- selectCheckboxMaps[nodeid] = node;
1238
- }
1239
- if (!checkStrictly) {
1240
- import_xe_utils.default.eachTree(
1241
- childList,
1242
- (childNode) => {
1243
- const childNodeid = getNodeId(childNode);
1244
- if (isChecked) {
1245
- if (!selectCheckboxMaps[childNodeid]) {
1246
- selectCheckboxMaps[childNodeid] = childNode;
1192
+ const halfSelect = !isSelected && (sLen > 0 || hLen > 0);
1193
+ if (isSelected) {
1194
+ selectCheckboxMaps[nodeid] = node;
1195
+ if (indeterminateRowMaps[nodeid]) {
1196
+ delete indeterminateRowMaps[nodeid];
1247
1197
  }
1248
1198
  } else {
1249
- if (selectCheckboxMaps[childNodeid]) {
1250
- delete selectCheckboxMaps[childNodeid];
1199
+ if (selectCheckboxMaps[nodeid]) {
1200
+ delete selectCheckboxMaps[nodeid];
1201
+ }
1202
+ if (halfSelect) {
1203
+ indeterminateRowMaps[nodeid] = node;
1204
+ } else {
1205
+ if (indeterminateRowMaps[nodeid]) {
1206
+ delete indeterminateRowMaps[nodeid];
1207
+ }
1251
1208
  }
1252
1209
  }
1253
- },
1254
- { children: transform ? mapChildrenField : childrenField }
1255
- );
1256
- }
1257
- selectCheckboxMaps[nodeid] = node;
1258
- reactData.updateCheckboxFlag++;
1259
- updateCheckboxStatus();
1260
- const nodeids = import_xe_utils.default.keys(selectCheckboxMaps);
1261
- const value = nodeids;
1262
- changeEvent(evnt, value, node);
1263
- if (!currentItems.includes(nodeid)) {
1264
- changeCurrentEvent(evnt, node);
1265
- toggleExpandEvent(evnt, node, chunks, chunkIndex);
1266
- }
1267
- };
1268
- const handleNodeClickEvent = (evnt, node, chunks, chunkIndex) => {
1269
- const { multiple, showCheckbox, showRadio } = props;
1270
- const treeOpts = computeTreeOpts.value;
1271
- const radioOpts = computeRadioOpts.value;
1272
- const checkboxOpts = computeCheckboxOpts.value;
1273
- const childrenField = computeChildrenField.value;
1274
- const mapChildrenField = computeMapChildrenField.value;
1275
- const { transform, trigger } = treeOpts;
1276
- const childList = node[transform ? mapChildrenField : childrenField];
1277
- let triggerCurrent = false;
1278
- let triggerRadio = false;
1279
- let triggerCheckbox = false;
1280
- let triggerExpand = false;
1281
- triggerCurrent = true;
1282
- changeCurrentEvent(evnt, node);
1283
- if (trigger !== "icon") {
1284
- triggerExpand = true;
1285
- toggleExpandEvent(evnt, node, chunks, chunkIndex);
1286
- }
1287
- if (multiple) {
1288
- if (checkboxOpts.trigger === "node" || !showCheckbox && (!childList || !childList.length)) {
1289
- triggerCheckbox = true;
1290
- changeCheckboxEvent(evnt, node, chunks, chunkIndex);
1210
+ });
1211
+ reactData.updateCheckboxFlag++;
1291
1212
  }
1292
- } else {
1293
- if (radioOpts.trigger === "node" || !showRadio && (!childList || !childList.length)) {
1294
- triggerRadio = true;
1295
- changeRadioEvent(evnt, node, chunks, chunkIndex);
1213
+ };
1214
+ const changeCheckboxEvent = (evnt, node, chunks, chunkIndex) => {
1215
+ evnt.preventDefault();
1216
+ evnt.stopPropagation();
1217
+ const { currentItems } = reactData;
1218
+ const { selectCheckboxMaps, nodeMaps } = internalData;
1219
+ const childrenField = computeChildrenField.value;
1220
+ const mapChildrenField = computeMapChildrenField.value;
1221
+ const checkboxOpts = computeCheckboxOpts.value;
1222
+ const { checkStrictly, checkMode, checkMethod } = checkboxOpts;
1223
+ const treeOpts = computeTreeOpts.value;
1224
+ const { transform } = treeOpts;
1225
+ const nodeid = getNodeId(node);
1226
+ const childList = node[transform ? mapChildrenField : childrenField];
1227
+ const isExistChild = childList && childList.length > 0;
1228
+ const nodeItem = nodeMaps[nodeid] || {};
1229
+ const nLevel = nodeItem.level;
1230
+ const isDisabled = checkMethod ? !checkMethod({ $cascader: $xeCascader, node }) : !handleVisibleOrCheckMode(checkMode, isExistChild, nLevel);
1231
+ if (isDisabled) {
1232
+ return;
1296
1233
  }
1297
- }
1298
- dispatchEvent("node-click", { node, triggerCurrent, triggerRadio, triggerCheckbox, triggerExpand }, evnt);
1299
- };
1300
- const focusEvent = (evnt) => {
1301
- const isDisabled = computeIsDisabled.value;
1302
- if (!isDisabled) {
1303
- if (!reactData.visiblePanel) {
1304
- reactData.triggerFocusPanel = true;
1305
- showOptionPanel(evnt);
1306
- setTimeout(() => {
1307
- reactData.triggerFocusPanel = false;
1308
- }, 150);
1234
+ let isChecked = false;
1235
+ if (selectCheckboxMaps[nodeid]) {
1236
+ delete selectCheckboxMaps[nodeid];
1237
+ } else {
1238
+ isChecked = true;
1239
+ selectCheckboxMaps[nodeid] = node;
1309
1240
  }
1310
- }
1311
- dispatchEvent("focus", {}, evnt);
1312
- };
1313
- const clickEvent = (evnt) => {
1314
- evnt.preventDefault();
1315
- if (reactData.triggerFocusPanel) {
1316
- reactData.triggerFocusPanel = false;
1317
- } else {
1318
- if (!reactData.visiblePanel) {
1319
- showOptionPanel(evnt);
1241
+ if (!checkStrictly) {
1242
+ import_xe_utils.default.eachTree(
1243
+ childList,
1244
+ (childNode) => {
1245
+ const childNodeid = getNodeId(childNode);
1246
+ if (isChecked) {
1247
+ if (!selectCheckboxMaps[childNodeid]) {
1248
+ selectCheckboxMaps[childNodeid] = childNode;
1249
+ }
1250
+ } else {
1251
+ if (selectCheckboxMaps[childNodeid]) {
1252
+ delete selectCheckboxMaps[childNodeid];
1253
+ }
1254
+ }
1255
+ },
1256
+ { children: transform ? mapChildrenField : childrenField }
1257
+ );
1320
1258
  }
1321
- }
1322
- dispatchEvent("click", {}, evnt);
1323
- };
1324
- const blurEvent = (evnt) => {
1325
- reactData.isActivated = false;
1326
- dispatchEvent("blur", {}, evnt);
1327
- };
1328
- const modelSearchEvent = (value) => {
1329
- reactData.searchValue = value;
1330
- triggerSearchEvent(new Event("filter"));
1331
- };
1332
- const handleSearchEvent = () => {
1333
- const { modelValue, remote } = props;
1334
- const { searchValue } = reactData;
1335
- const remoteOpts = computeRemoteOpts.value;
1336
- const queryMethod = remoteOpts.queryMethod;
1337
- if (remote && queryMethod && remoteOpts.enabled) {
1338
- reactData.searchLoading = true;
1339
- Promise.resolve(queryMethod({ $cascader: $xeCascader, searchValue, value: modelValue })).then(() => (0, import_vue.nextTick)()).catch(() => (0, import_vue.nextTick)()).finally(() => {
1340
- reactData.searchLoading = false;
1341
- });
1342
- }
1343
- };
1344
- const togglePanelEvent = (params) => {
1345
- const { $event } = params;
1346
- $event.preventDefault();
1347
- if (reactData.triggerFocusPanel) {
1348
- reactData.triggerFocusPanel = false;
1349
- } else {
1350
- if (reactData.visiblePanel) {
1351
- hideOptionPanel($event);
1352
- } else {
1353
- showOptionPanel($event);
1259
+ selectCheckboxMaps[nodeid] = node;
1260
+ reactData.updateCheckboxFlag++;
1261
+ updateCheckboxStatus();
1262
+ const nodeids = import_xe_utils.default.keys(selectCheckboxMaps);
1263
+ const value = nodeids;
1264
+ changeEvent(evnt, value, node);
1265
+ if (!currentItems.includes(nodeid)) {
1266
+ changeCurrentEvent(evnt, node);
1267
+ toggleExpandEvent(evnt, node, chunks, chunkIndex);
1354
1268
  }
1355
- }
1356
- };
1357
- const cascaderPrivateMethods = {
1358
- isCheckedByCheckboxNodeId,
1359
- /**
1360
- * 用于树结构,给行数据加载子节点
1361
- */
1362
- loadChildrenNode(node, childRecords) {
1363
- const { separator } = props;
1364
- const { nodeMaps } = internalData;
1269
+ };
1270
+ const handleNodeClickEvent = (evnt, node, chunks, chunkIndex) => {
1271
+ const { multiple, showCheckbox, showRadio } = props;
1365
1272
  const treeOpts = computeTreeOpts.value;
1366
- const labelField = computeLabelField.value;
1367
- const { lazy, transform } = treeOpts;
1368
- if (!lazy) {
1369
- return Promise.resolve([]);
1370
- }
1273
+ const radioOpts = computeRadioOpts.value;
1274
+ const checkboxOpts = computeCheckboxOpts.value;
1371
1275
  const childrenField = computeChildrenField.value;
1372
1276
  const mapChildrenField = computeMapChildrenField.value;
1373
- const parentNodeItem = nodeMaps[getNodeId(node)];
1374
- const parentLevel = parentNodeItem ? parentNodeItem.level : 0;
1375
- const parentNodes = parentNodeItem ? parentNodeItem.nodes : [];
1376
- return createNode(childRecords).then((nodeList) => {
1377
- import_xe_utils.default.eachTree(
1378
- nodeList,
1379
- (childRow, index, items, path, parent, nodes) => {
1380
- const itemNodeId = getNodeId(childRow);
1381
- nodeMaps[itemNodeId] = {
1382
- item: childRow,
1383
- index: -1,
1384
- $index: -1,
1385
- _index: -1,
1386
- items,
1387
- parent: parent || parentNodeItem.item,
1388
- nodes: parentNodes.concat(nodes),
1389
- level: parentLevel + nodes.length,
1390
- treeIndex: -1,
1391
- lineCount: 0,
1392
- treeLoaded: false,
1393
- fullLabel: nodes.map((item) => item[labelField]).join(separator || " / ")
1394
- };
1395
- },
1396
- { children: childrenField }
1397
- );
1398
- node[childrenField] = nodeList;
1399
- if (transform) {
1400
- node[mapChildrenField] = nodeList;
1277
+ const { transform, trigger } = treeOpts;
1278
+ const childList = node[transform ? mapChildrenField : childrenField];
1279
+ let triggerCurrent = false;
1280
+ let triggerRadio = false;
1281
+ let triggerCheckbox = false;
1282
+ let triggerExpand = false;
1283
+ triggerCurrent = true;
1284
+ changeCurrentEvent(evnt, node);
1285
+ if (trigger !== "icon") {
1286
+ triggerExpand = true;
1287
+ toggleExpandEvent(evnt, node, chunks, chunkIndex);
1288
+ }
1289
+ if (multiple) {
1290
+ if (checkboxOpts.trigger === "node" || !showCheckbox && (!childList || !childList.length)) {
1291
+ triggerCheckbox = true;
1292
+ changeCheckboxEvent(evnt, node, chunks, chunkIndex);
1293
+ }
1294
+ } else {
1295
+ if (radioOpts.trigger === "node" || !showRadio && (!childList || !childList.length)) {
1296
+ triggerRadio = true;
1297
+ changeRadioEvent(evnt, node, chunks, chunkIndex);
1401
1298
  }
1402
- updateAfterDataIndex();
1403
- return nodeList;
1404
- });
1405
- }
1406
- };
1407
- Object.assign($xeCascader, cascaderMethods, cascaderPrivateMethods);
1408
- const handleVisibleOrCheckMode = (mode, isExistChild, nLevel) => {
1409
- if (mode) {
1410
- if (mode === "first") {
1411
- return !nLevel;
1412
1299
  }
1413
- if (mode === "last") {
1414
- return !isExistChild;
1300
+ dispatchEvent("node-click", { node, triggerCurrent, triggerRadio, triggerCheckbox, triggerExpand }, evnt);
1301
+ };
1302
+ const focusEvent = (evnt) => {
1303
+ const isDisabled = computeIsDisabled.value;
1304
+ if (!isDisabled) {
1305
+ if (!reactData.visiblePanel) {
1306
+ reactData.triggerFocusPanel = true;
1307
+ showOptionPanel(evnt);
1308
+ setTimeout(() => {
1309
+ reactData.triggerFocusPanel = false;
1310
+ }, 150);
1311
+ }
1415
1312
  }
1416
- }
1417
- return true;
1418
- };
1419
- const renderRadio = (node, isExistChild, nLevel, isChecked, chunks, chunkIndex) => {
1420
- const { showRadio } = props;
1421
- const radioOpts = computeRadioOpts.value;
1422
- const { checkMode, checkMethod, visibleMode, visibleMethod } = radioOpts;
1423
- const isVisible = visibleMethod ? visibleMethod({ $cascader: $xeCascader, node }) : handleVisibleOrCheckMode(visibleMode, isExistChild, nLevel);
1424
- if (showRadio && isVisible) {
1425
- const isDisabled = checkMethod ? !checkMethod({ $cascader: $xeCascader, node }) : !handleVisibleOrCheckMode(checkMode, isExistChild, nLevel);
1426
- return (0, import_vue.h)(
1427
- "div",
1428
- {
1429
- class: [
1430
- "vxe-tree--radio-option",
1431
- {
1432
- "is--checked": isChecked,
1433
- "is--disabled": isDisabled
1313
+ dispatchEvent("focus", {}, evnt);
1314
+ };
1315
+ const clickEvent = (evnt) => {
1316
+ evnt.preventDefault();
1317
+ if (reactData.triggerFocusPanel) {
1318
+ reactData.triggerFocusPanel = false;
1319
+ } else {
1320
+ if (!reactData.visiblePanel) {
1321
+ showOptionPanel(evnt);
1322
+ }
1323
+ }
1324
+ dispatchEvent("click", {}, evnt);
1325
+ };
1326
+ const blurEvent = (evnt) => {
1327
+ reactData.isActivated = false;
1328
+ dispatchEvent("blur", {}, evnt);
1329
+ };
1330
+ const modelSearchEvent = (value) => {
1331
+ reactData.searchValue = value;
1332
+ triggerSearchEvent(new Event("filter"));
1333
+ };
1334
+ const handleSearchEvent = () => {
1335
+ const { modelValue, remote } = props;
1336
+ const { searchValue } = reactData;
1337
+ const remoteOpts = computeRemoteOpts.value;
1338
+ const queryMethod = remoteOpts.queryMethod;
1339
+ if (remote && queryMethod && remoteOpts.enabled) {
1340
+ reactData.searchLoading = true;
1341
+ Promise.resolve(queryMethod({ $cascader: $xeCascader, searchValue, value: modelValue })).then(() => (0, import_vue.nextTick)()).catch(() => (0, import_vue.nextTick)()).finally(() => {
1342
+ reactData.searchLoading = false;
1343
+ });
1344
+ }
1345
+ };
1346
+ const togglePanelEvent = (params) => {
1347
+ const { $event } = params;
1348
+ $event.preventDefault();
1349
+ if (reactData.triggerFocusPanel) {
1350
+ reactData.triggerFocusPanel = false;
1351
+ } else {
1352
+ if (reactData.visiblePanel) {
1353
+ hideOptionPanel($event);
1354
+ } else {
1355
+ showOptionPanel($event);
1356
+ }
1357
+ }
1358
+ };
1359
+ const cascaderPrivateMethods = {
1360
+ isCheckedByCheckboxNodeId,
1361
+ /**
1362
+ * 用于树结构,给行数据加载子节点
1363
+ */
1364
+ loadChildrenNode(node, childRecords) {
1365
+ const { separator } = props;
1366
+ const { nodeMaps } = internalData;
1367
+ const treeOpts = computeTreeOpts.value;
1368
+ const labelField = computeLabelField.value;
1369
+ const { lazy, transform } = treeOpts;
1370
+ if (!lazy) {
1371
+ return Promise.resolve([]);
1372
+ }
1373
+ const childrenField = computeChildrenField.value;
1374
+ const mapChildrenField = computeMapChildrenField.value;
1375
+ const parentNodeItem = nodeMaps[getNodeId(node)];
1376
+ const parentLevel = parentNodeItem ? parentNodeItem.level : 0;
1377
+ const parentNodes = parentNodeItem ? parentNodeItem.nodes : [];
1378
+ return createNode(childRecords).then((nodeList) => {
1379
+ import_xe_utils.default.eachTree(
1380
+ nodeList,
1381
+ (childRow, index, items, path, parent, nodes) => {
1382
+ const itemNodeId = getNodeId(childRow);
1383
+ nodeMaps[itemNodeId] = {
1384
+ item: childRow,
1385
+ index: -1,
1386
+ $index: -1,
1387
+ _index: -1,
1388
+ items,
1389
+ parent: parent || parentNodeItem.item,
1390
+ nodes: parentNodes.concat(nodes),
1391
+ level: parentLevel + nodes.length,
1392
+ treeIndex: -1,
1393
+ lineCount: 0,
1394
+ treeLoaded: false,
1395
+ fullLabel: nodes.map((item) => item[labelField]).join(separator || " / ")
1396
+ };
1397
+ },
1398
+ { children: childrenField }
1399
+ );
1400
+ node[childrenField] = nodeList;
1401
+ if (transform) {
1402
+ node[mapChildrenField] = nodeList;
1403
+ }
1404
+ updateAfterDataIndex();
1405
+ return nodeList;
1406
+ });
1407
+ }
1408
+ };
1409
+ Object.assign($xeCascader, cascaderMethods, cascaderPrivateMethods);
1410
+ const handleVisibleOrCheckMode = (mode, isExistChild, nLevel) => {
1411
+ if (mode) {
1412
+ if (mode === "first") {
1413
+ return !nLevel;
1414
+ }
1415
+ if (mode === "last") {
1416
+ return !isExistChild;
1417
+ }
1418
+ }
1419
+ return true;
1420
+ };
1421
+ const renderRadio = (node, isExistChild, nLevel, isChecked, chunks, chunkIndex) => {
1422
+ const { showRadio } = props;
1423
+ const radioOpts = computeRadioOpts.value;
1424
+ const { checkMode, checkMethod, visibleMode, visibleMethod } = radioOpts;
1425
+ const isVisible = visibleMethod ? visibleMethod({ $cascader: $xeCascader, node }) : handleVisibleOrCheckMode(visibleMode, isExistChild, nLevel);
1426
+ if (showRadio && isVisible) {
1427
+ const isDisabled = checkMethod ? !checkMethod({ $cascader: $xeCascader, node }) : !handleVisibleOrCheckMode(checkMode, isExistChild, nLevel);
1428
+ return (0, import_vue.h)(
1429
+ "div",
1430
+ {
1431
+ class: [
1432
+ "vxe-tree--radio-option",
1433
+ {
1434
+ "is--checked": isChecked,
1435
+ "is--disabled": isDisabled
1436
+ }
1437
+ ],
1438
+ onClick: (evnt) => {
1439
+ if (!isDisabled) {
1440
+ changeRadioEvent(evnt, node, chunks, chunkIndex);
1441
+ }
1434
1442
  }
1435
- ],
1436
- onClick: (evnt) => {
1437
- if (!isDisabled) {
1438
- changeRadioEvent(evnt, node, chunks, chunkIndex);
1443
+ },
1444
+ [
1445
+ (0, import_vue.h)("span", {
1446
+ class: ["vxe-radio--icon", isChecked ? getIcon().RADIO_CHECKED : isDisabled ? getIcon().RADIO_DISABLED_UNCHECKED : getIcon().RADIO_UNCHECKED]
1447
+ })
1448
+ ]
1449
+ );
1450
+ }
1451
+ return renderEmptyElement($xeCascader);
1452
+ };
1453
+ const renderCheckbox = (node, isExistChild, nLevel, isChecked, isIndeterminate, chunks, chunkIndex) => {
1454
+ const { showCheckbox } = props;
1455
+ const checkboxOpts = computeCheckboxOpts.value;
1456
+ const { checkMode, checkMethod, visibleMode, visibleMethod } = checkboxOpts;
1457
+ const isVisible = visibleMethod ? visibleMethod({ $cascader: $xeCascader, node }) : handleVisibleOrCheckMode(visibleMode, isExistChild, nLevel);
1458
+ if (showCheckbox && isVisible) {
1459
+ const isDisabled = checkMethod ? !checkMethod({ $cascader: $xeCascader, node }) : !handleVisibleOrCheckMode(checkMode, isExistChild, nLevel);
1460
+ return (0, import_vue.h)(
1461
+ "div",
1462
+ {
1463
+ class: [
1464
+ "vxe-cascader--checkbox-option",
1465
+ {
1466
+ "is--checked": isChecked,
1467
+ "is--indeterminate": isIndeterminate,
1468
+ "is--disabled": isDisabled
1469
+ }
1470
+ ],
1471
+ onClick: (evnt) => {
1472
+ if (!isDisabled) {
1473
+ changeCheckboxEvent(evnt, node, chunks, chunkIndex);
1474
+ }
1439
1475
  }
1440
- }
1441
- },
1442
- [
1443
- (0, import_vue.h)("span", {
1444
- class: ["vxe-radio--icon", isChecked ? getIcon().RADIO_CHECKED : isDisabled ? getIcon().RADIO_DISABLED_UNCHECKED : getIcon().RADIO_UNCHECKED]
1445
- })
1446
- ]
1447
- );
1448
- }
1449
- return renderEmptyElement($xeCascader);
1450
- };
1451
- const renderCheckbox = (node, isExistChild, nLevel, isChecked, isIndeterminate, chunks, chunkIndex) => {
1452
- const { showCheckbox } = props;
1453
- const checkboxOpts = computeCheckboxOpts.value;
1454
- const { checkMode, checkMethod, visibleMode, visibleMethod } = checkboxOpts;
1455
- const isVisible = visibleMethod ? visibleMethod({ $cascader: $xeCascader, node }) : handleVisibleOrCheckMode(visibleMode, isExistChild, nLevel);
1456
- if (showCheckbox && isVisible) {
1457
- const isDisabled = checkMethod ? !checkMethod({ $cascader: $xeCascader, node }) : !handleVisibleOrCheckMode(checkMode, isExistChild, nLevel);
1476
+ },
1477
+ [
1478
+ (0, import_vue.h)("span", {
1479
+ class: ["vxe-checkbox--icon", isIndeterminate ? getIcon().CHECKBOX_INDETERMINATE : isChecked ? getIcon().CHECKBOX_CHECKED : isDisabled ? getIcon().CHECKBOX_DISABLED_UNCHECKED : getIcon().CHECKBOX_UNCHECKED]
1480
+ })
1481
+ ]
1482
+ );
1483
+ }
1484
+ return renderEmptyElement($xeCascader);
1485
+ };
1486
+ const renderNode = (node, nodeid, nodeIndex, chunks, chunkIndex) => {
1487
+ const { multiple } = props;
1488
+ const { currentNode, selectRadioKey, updateCheckboxFlag, updateExpandedFlag } = reactData;
1489
+ const { nodeMaps, selectCheckboxMaps, indeterminateRowMaps, treeExpandedMaps, treeExpandLazyLoadedMaps } = internalData;
1490
+ const treeOpts = computeTreeOpts.value;
1491
+ const { lazy, transform, iconLoaded, iconOpen, iconClose } = treeOpts;
1492
+ const childrenField = computeChildrenField.value;
1493
+ const mapChildrenField = computeMapChildrenField.value;
1494
+ const labelField = computeLabelField.value;
1495
+ const hasChildField = computeHasChildField.value;
1496
+ const childList = node[transform ? mapChildrenField : childrenField];
1497
+ const isExistChild = childList && childList.length > 0;
1498
+ const iconSlot = slots.icon;
1499
+ const titleSlot = slots.title;
1500
+ const isExpand = updateExpandedFlag && treeExpandedMaps[nodeid];
1501
+ const nodeItem = nodeMaps[nodeid] || {};
1502
+ const nodeTitle = node[labelField];
1503
+ const nLevel = nodeItem.level;
1504
+ let isRadioChecked = false;
1505
+ if (!multiple) {
1506
+ isRadioChecked = nodeid === selectRadioKey;
1507
+ }
1508
+ let isCheckboxChecked = false;
1509
+ let isIndeterminate = false;
1510
+ if (multiple) {
1511
+ isCheckboxChecked = !!(updateCheckboxFlag && selectCheckboxMaps[nodeid]);
1512
+ isIndeterminate = !!(updateCheckboxFlag && indeterminateRowMaps[nodeid]);
1513
+ }
1514
+ let hasLazyChilds = false;
1515
+ let isLazyLoading = false;
1516
+ let isLazyLoaded = false;
1517
+ if (lazy) {
1518
+ isLazyLoading = !!treeExpandLazyLoadedMaps[nodeid];
1519
+ hasLazyChilds = node[hasChildField];
1520
+ isLazyLoaded = !!nodeItem.treeLoaded;
1521
+ }
1522
+ const nParams = { node };
1458
1523
  return (0, import_vue.h)(
1459
1524
  "div",
1460
1525
  {
1526
+ key: `${chunkIndex}_${nodeIndex}`,
1461
1527
  class: [
1462
- "vxe-cascader--checkbox-option",
1528
+ "vxe-cascader-chunk--node-item",
1463
1529
  {
1464
- "is--checked": isChecked,
1465
- "is--indeterminate": isIndeterminate,
1466
- "is--disabled": isDisabled
1530
+ "is--current": currentNode && (currentNode === node || getNodeId(currentNode) === nodeid),
1531
+ "is-radio--checked": isRadioChecked,
1532
+ "is-checkbox--checked": isCheckboxChecked,
1533
+ "is-checkbox--indeterminate": isIndeterminate,
1534
+ "is--expand": isExpand
1467
1535
  }
1468
1536
  ],
1469
- onClick: (evnt) => {
1470
- if (!isDisabled) {
1471
- changeCheckboxEvent(evnt, node, chunks, chunkIndex);
1537
+ title: nodeTitle,
1538
+ onMousedown: (evnt) => {
1539
+ const isLeftBtn = evnt.button === 0;
1540
+ if (isLeftBtn) {
1541
+ evnt.stopPropagation();
1472
1542
  }
1543
+ },
1544
+ onClick(evnt) {
1545
+ handleNodeClickEvent(evnt, node, chunks, chunkIndex);
1473
1546
  }
1474
1547
  },
1475
1548
  [
1476
- (0, import_vue.h)("span", {
1477
- class: ["vxe-checkbox--icon", isIndeterminate ? getIcon().CHECKBOX_INDETERMINATE : isChecked ? getIcon().CHECKBOX_CHECKED : isDisabled ? getIcon().CHECKBOX_DISABLED_UNCHECKED : getIcon().CHECKBOX_UNCHECKED]
1478
- })
1549
+ multiple ? renderCheckbox(node, isExistChild, nLevel, isCheckboxChecked, isIndeterminate, chunks, chunkIndex) : renderRadio(node, isExistChild, nLevel, isRadioChecked, chunks, chunkIndex),
1550
+ (0, import_vue.h)(
1551
+ "div",
1552
+ {
1553
+ class: "vxe-cascader-chunk--node-item-inner"
1554
+ },
1555
+ [
1556
+ (0, import_vue.h)(
1557
+ "div",
1558
+ {
1559
+ class: "vxe-cascader-chunk--node-item-title"
1560
+ },
1561
+ titleSlot ? getSlotVNs(titleSlot(nParams)) : nodeTitle
1562
+ )
1563
+ ]
1564
+ ),
1565
+ treeOpts.showIcon && (lazy ? isLazyLoaded ? isExistChild : hasLazyChilds : isExistChild) ? (0, import_vue.h)(
1566
+ "div",
1567
+ {
1568
+ class: "vxe-cascader-chunk--node-item-switcher"
1569
+ },
1570
+ [
1571
+ [
1572
+ (0, import_vue.h)(
1573
+ "div",
1574
+ {
1575
+ class: "vxe-cascader--node-item-icon",
1576
+ onClick(evnt) {
1577
+ if (treeOpts.trigger === "icon") {
1578
+ toggleExpandEvent(evnt, node, chunks, chunkIndex);
1579
+ }
1580
+ }
1581
+ },
1582
+ iconSlot ? getSlotVNs(iconSlot(nParams)) : [
1583
+ (0, import_vue.h)("i", {
1584
+ class: isLazyLoading ? iconLoaded || getIcon().CASCADER_NODE_LOADED : isExpand ? iconOpen || getIcon().CASCADER_NODE_OPEN : iconClose || getIcon().CASCADER_NODE_CLOSE
1585
+ })
1586
+ ]
1587
+ )
1588
+ ]
1589
+ ]
1590
+ ) : renderEmptyElement($xeCascader)
1479
1591
  ]
1480
1592
  );
1481
- }
1482
- return renderEmptyElement($xeCascader);
1483
- };
1484
- const renderNode = (node, nodeid, nodeIndex, chunks, chunkIndex) => {
1485
- const { multiple } = props;
1486
- const { currentNode, selectRadioKey, updateCheckboxFlag, updateExpandedFlag } = reactData;
1487
- const { nodeMaps, selectCheckboxMaps, indeterminateRowMaps, treeExpandedMaps, treeExpandLazyLoadedMaps } = internalData;
1488
- const treeOpts = computeTreeOpts.value;
1489
- const { lazy, transform, iconLoaded, iconOpen, iconClose } = treeOpts;
1490
- const childrenField = computeChildrenField.value;
1491
- const mapChildrenField = computeMapChildrenField.value;
1492
- const labelField = computeLabelField.value;
1493
- const hasChildField = computeHasChildField.value;
1494
- const childList = node[transform ? mapChildrenField : childrenField];
1495
- const isExistChild = childList && childList.length > 0;
1496
- const iconSlot = slots.icon;
1497
- const titleSlot = slots.title;
1498
- const isExpand = updateExpandedFlag && treeExpandedMaps[nodeid];
1499
- const nodeItem = nodeMaps[nodeid] || {};
1500
- const nodeTitle = node[labelField];
1501
- const nLevel = nodeItem.level;
1502
- let isRadioChecked = false;
1503
- if (!multiple) {
1504
- isRadioChecked = nodeid === selectRadioKey;
1505
- }
1506
- let isCheckboxChecked = false;
1507
- let isIndeterminate = false;
1508
- if (multiple) {
1509
- isCheckboxChecked = !!(updateCheckboxFlag && selectCheckboxMaps[nodeid]);
1510
- isIndeterminate = !!(updateCheckboxFlag && indeterminateRowMaps[nodeid]);
1511
- }
1512
- let hasLazyChilds = false;
1513
- let isLazyLoading = false;
1514
- let isLazyLoaded = false;
1515
- if (lazy) {
1516
- isLazyLoading = !!treeExpandLazyLoadedMaps[nodeid];
1517
- hasLazyChilds = node[hasChildField];
1518
- isLazyLoaded = !!nodeItem.treeLoaded;
1519
- }
1520
- const nParams = { node };
1521
- return (0, import_vue.h)(
1522
- "div",
1523
- {
1524
- key: `${chunkIndex}_${nodeIndex}`,
1525
- class: [
1526
- "vxe-cascader-chunk--node-item",
1527
- {
1528
- "is--current": currentNode && (currentNode === node || getNodeId(currentNode) === nodeid),
1529
- "is-radio--checked": isRadioChecked,
1530
- "is-checkbox--checked": isCheckboxChecked,
1531
- "is-checkbox--indeterminate": isIndeterminate,
1532
- "is--expand": isExpand
1533
- }
1534
- ],
1535
- title: nodeTitle,
1536
- onMousedown: (evnt) => {
1537
- const isLeftBtn = evnt.button === 0;
1538
- if (isLeftBtn) {
1539
- evnt.stopPropagation();
1540
- }
1541
- },
1542
- onClick(evnt) {
1543
- handleNodeClickEvent(evnt, node, chunks, chunkIndex);
1544
- }
1545
- },
1546
- [
1547
- multiple ? renderCheckbox(node, isExistChild, nLevel, isCheckboxChecked, isIndeterminate, chunks, chunkIndex) : renderRadio(node, isExistChild, nLevel, isRadioChecked, chunks, chunkIndex),
1548
- (0, import_vue.h)(
1593
+ };
1594
+ const renderVN = () => {
1595
+ const { className, modelValue, multiple, loading, filterable, showTotalButton, showCheckedButton, showClearButton, showCloseButton } = props;
1596
+ const { initialized, isActivated, isAniVisible, visiblePanel, searchValue, currentCunkList } = reactData;
1597
+ const { listVirtualYOpts } = internalData;
1598
+ const vSize = computeSize.value;
1599
+ const isDisabled = computeIsDisabled.value;
1600
+ const selectLabel = computeSelectLabel.value;
1601
+ const btnTransfer = computeBtnTransfer.value;
1602
+ const formReadonly = computeFormReadonly.value;
1603
+ const popupWrapperStyle = computePopupWrapperStyle.value;
1604
+ const headerSlot = slots.header;
1605
+ const footerSlot = slots.footer;
1606
+ const prefixSlot = slots.prefix;
1607
+ const popupOpts = computePopupOpts.value;
1608
+ const popupClassName = popupOpts.className;
1609
+ if (formReadonly) {
1610
+ return (0, import_vue.h)(
1549
1611
  "div",
1550
1612
  {
1551
- class: "vxe-cascader-chunk--node-item-inner"
1613
+ ref: refElem,
1614
+ class: ["vxe-cascader--readonly", className]
1552
1615
  },
1553
1616
  [
1554
1617
  (0, import_vue.h)(
1555
- "div",
1618
+ "span",
1556
1619
  {
1557
- class: "vxe-cascader-chunk--node-item-title"
1620
+ class: "vxe-cascader-label"
1558
1621
  },
1559
- titleSlot ? getSlotVNs(titleSlot(nParams)) : nodeTitle
1622
+ selectLabel
1560
1623
  )
1561
1624
  ]
1562
- ),
1563
- treeOpts.showIcon && (lazy ? isLazyLoaded ? isExistChild : hasLazyChilds : isExistChild) ? (0, import_vue.h)(
1564
- "div",
1565
- {
1566
- class: "vxe-cascader-chunk--node-item-switcher"
1567
- },
1568
- [
1569
- [
1570
- (0, import_vue.h)(
1571
- "div",
1572
- {
1573
- class: "vxe-cascader--node-item-icon",
1574
- onClick(evnt) {
1575
- if (treeOpts.trigger === "icon") {
1576
- toggleExpandEvent(evnt, node, chunks, chunkIndex);
1577
- }
1578
- }
1579
- },
1580
- iconSlot ? getSlotVNs(iconSlot(nParams)) : [
1581
- (0, import_vue.h)("i", {
1582
- class: isLazyLoading ? iconLoaded || getIcon().CASCADER_NODE_LOADED : isExpand ? iconOpen || getIcon().CASCADER_NODE_OPEN : iconClose || getIcon().CASCADER_NODE_CLOSE
1583
- })
1584
- ]
1585
- )
1586
- ]
1587
- ]
1588
- ) : renderEmptyElement($xeCascader)
1589
- ]
1590
- );
1591
- };
1592
- const renderVN = () => {
1593
- const { className, modelValue, multiple, loading, filterable, showTotalButton, showCheckedButton, showClearButton, showCloseButton } = props;
1594
- const { initialized, isActivated, isAniVisible, visiblePanel, searchValue, currentCunkList } = reactData;
1595
- const { listVirtualYOpts } = internalData;
1596
- const vSize = computeSize.value;
1597
- const isDisabled = computeIsDisabled.value;
1598
- const selectLabel = computeSelectLabel.value;
1599
- const btnTransfer = computeBtnTransfer.value;
1600
- const formReadonly = computeFormReadonly.value;
1601
- const popupWrapperStyle = computePopupWrapperStyle.value;
1602
- const headerSlot = slots.header;
1603
- const footerSlot = slots.footer;
1604
- const prefixSlot = slots.prefix;
1605
- const popupOpts = computePopupOpts.value;
1606
- const popupClassName = popupOpts.className;
1607
- if (formReadonly) {
1625
+ );
1626
+ }
1627
+ const selectVals = import_xe_utils.default.eqNull(modelValue) ? [] : import_xe_utils.default.isArray(modelValue) ? modelValue : [modelValue];
1608
1628
  return (0, import_vue.h)(
1609
1629
  "div",
1610
1630
  {
1611
1631
  ref: refElem,
1612
- class: ["vxe-cascader--readonly", className]
1632
+ class: [
1633
+ "vxe-cascader",
1634
+ className ? import_xe_utils.default.isFunction(className) ? className({ $cascader: $xeCascader }) : className : "",
1635
+ {
1636
+ [`size--${vSize}`]: vSize,
1637
+ "is--filterable": filterable,
1638
+ "is--visible": visiblePanel,
1639
+ "is--disabled": isDisabled,
1640
+ "is--loading": loading,
1641
+ "is--active": isActivated
1642
+ }
1643
+ ]
1613
1644
  },
1614
1645
  [
1615
1646
  (0, import_vue.h)(
1616
- "span",
1647
+ import_input.default,
1617
1648
  {
1618
- class: "vxe-cascader-label"
1649
+ ref: refInput,
1650
+ clearable: props.clearable,
1651
+ placeholder: loading ? getI18n("vxe.select.loadingText") : props.placeholder,
1652
+ editable: false,
1653
+ disabled: isDisabled,
1654
+ type: "text",
1655
+ prefixIcon: props.prefixIcon,
1656
+ suffixIcon: loading ? getIcon().TREE_SELECT_LOADED : visiblePanel ? getIcon().TREE_SELECT_OPEN : getIcon().TREE_SELECT_CLOSE,
1657
+ modelValue: loading ? "" : selectLabel,
1658
+ title: selectLabel,
1659
+ onClear: clearEvent,
1660
+ onClick: clickEvent,
1661
+ onFocus: focusEvent,
1662
+ onBlur: blurEvent,
1663
+ onSuffixClick: togglePanelEvent
1619
1664
  },
1620
- selectLabel
1621
- )
1622
- ]
1623
- );
1624
- }
1625
- const selectVals = import_xe_utils.default.eqNull(modelValue) ? [] : import_xe_utils.default.isArray(modelValue) ? modelValue : [modelValue];
1626
- return (0, import_vue.h)(
1627
- "div",
1628
- {
1629
- ref: refElem,
1630
- class: [
1631
- "vxe-cascader",
1632
- className ? import_xe_utils.default.isFunction(className) ? className({ $cascader: $xeCascader }) : className : "",
1633
- {
1634
- [`size--${vSize}`]: vSize,
1635
- "is--filterable": filterable,
1636
- "is--visible": visiblePanel,
1637
- "is--disabled": isDisabled,
1638
- "is--loading": loading,
1639
- "is--active": isActivated
1640
- }
1641
- ]
1642
- },
1643
- [
1644
- (0, import_vue.h)(
1645
- import_input.default,
1646
- {
1647
- ref: refInput,
1648
- clearable: props.clearable,
1649
- placeholder: loading ? getI18n("vxe.select.loadingText") : props.placeholder,
1650
- editable: false,
1651
- disabled: isDisabled,
1652
- type: "text",
1653
- prefixIcon: props.prefixIcon,
1654
- suffixIcon: loading ? getIcon().TREE_SELECT_LOADED : visiblePanel ? getIcon().TREE_SELECT_OPEN : getIcon().TREE_SELECT_CLOSE,
1655
- modelValue: loading ? "" : selectLabel,
1656
- title: selectLabel,
1657
- onClear: clearEvent,
1658
- onClick: clickEvent,
1659
- onFocus: focusEvent,
1660
- onBlur: blurEvent,
1661
- onSuffixClick: togglePanelEvent
1662
- },
1663
- prefixSlot ? {
1664
- prefix: () => prefixSlot({})
1665
- } : {}
1666
- ),
1667
- (0, import_vue.h)(
1668
- import_vue.Teleport,
1669
- {
1670
- to: "body",
1671
- disabled: btnTransfer ? !initialized : true
1672
- },
1673
- [
1674
- (0, import_vue.h)(
1675
- "div",
1676
- {
1677
- ref: refOptionPanel,
1678
- class: [
1679
- "vxe-table--ignore-clear vxe-cascader--panel",
1680
- popupClassName ? import_xe_utils.default.isFunction(popupClassName) ? popupClassName({ $cascader: $xeCascader }) : popupClassName : "",
1681
- {
1682
- [`size--${vSize}`]: vSize,
1683
- "is--transfer": btnTransfer,
1684
- "ani--leave": !loading && isAniVisible,
1685
- "ani--enter": !loading && visiblePanel
1686
- }
1687
- ],
1688
- placement: reactData.panelPlacement,
1689
- style: popupWrapperStyle
1690
- },
1691
- initialized ? [
1692
- (0, import_vue.h)(
1693
- "div",
1694
- {
1695
- class: "vxe-cascader--panel-wrapper"
1696
- },
1697
- [
1698
- filterable ? (0, import_vue.h)(
1699
- "div",
1700
- {
1701
- class: "vxe-cascader--panel-search"
1702
- },
1703
- [
1704
- (0, import_vue.h)(import_input.default, {
1705
- ref: refInpSearch,
1706
- class: "vxe-cascader-search--input",
1707
- modelValue: searchValue,
1708
- clearable: true,
1709
- disabled: false,
1710
- readonly: false,
1711
- placeholder: getI18n("vxe.cascader.search"),
1712
- prefixIcon: getIcon().INPUT_SEARCH,
1713
- "onUpdate:modelValue": modelSearchEvent
1714
- })
1715
- ]
1716
- ) : renderEmptyElement($xeCascader),
1717
- showCheckedButton && multiple || showClearButton || headerSlot ? (0, import_vue.h)(
1718
- "div",
1719
- {
1720
- class: "vxe-cascader--panel-header"
1721
- },
1722
- headerSlot ? headerSlot({}) : [
1723
- (0, import_vue.h)(
1724
- "div",
1725
- {
1726
- class: "vxe-cascader--header-button"
1727
- },
1728
- [
1729
- showCheckedButton && multiple || showClearButton ? (0, import_vue.h)(
1730
- "div",
1731
- {
1732
- class: "vxe-cascader--selected-btns"
1733
- },
1734
- [
1735
- showCheckedButton && multiple ? (0, import_vue.h)(import_button.default, {
1736
- content: getI18n("vxe.treeSelect.allChecked"),
1737
- mode: "text",
1738
- onClick: allCheckedPanelEvent
1739
- }) : renderEmptyElement($xeCascader),
1740
- showClearButton ? (0, import_vue.h)(import_button.default, {
1741
- content: getI18n("vxe.treeSelect.clearChecked"),
1742
- mode: "text",
1743
- onClick: clearCheckedPanelEvent
1744
- }) : renderEmptyElement($xeCascader)
1745
- ]
1746
- ) : renderEmptyElement($xeCascader)
1747
- ]
1748
- )
1749
- ]
1750
- ) : renderEmptyElement($xeCascader),
1751
- (0, import_vue.h)(
1752
- "div",
1753
- {
1754
- class: "vxe-cascader--panel-body"
1755
- },
1756
- [
1757
- (0, import_vue.h)(
1758
- "div",
1759
- {
1760
- ref: refChunkWrapper,
1761
- class: "vxe-cascader-chunk--wrapper"
1762
- },
1763
- [
1764
- currentCunkList.map((chunks, chunkIndex) => {
1765
- return (0, import_vue.h)(
1665
+ prefixSlot ? {
1666
+ prefix: () => prefixSlot({})
1667
+ } : {}
1668
+ ),
1669
+ (0, import_vue.h)(
1670
+ import_vue.Teleport,
1671
+ {
1672
+ to: "body",
1673
+ disabled: btnTransfer ? !initialized : true
1674
+ },
1675
+ [
1676
+ (0, import_vue.h)(
1677
+ "div",
1678
+ {
1679
+ ref: refOptionPanel,
1680
+ class: [
1681
+ "vxe-table--ignore-clear vxe-cascader--panel",
1682
+ popupClassName ? import_xe_utils.default.isFunction(popupClassName) ? popupClassName({ $cascader: $xeCascader }) : popupClassName : "",
1683
+ {
1684
+ [`size--${vSize}`]: vSize,
1685
+ "is--transfer": btnTransfer,
1686
+ "ani--leave": !loading && isAniVisible,
1687
+ "ani--enter": !loading && visiblePanel
1688
+ }
1689
+ ],
1690
+ placement: reactData.panelPlacement,
1691
+ style: popupWrapperStyle
1692
+ },
1693
+ initialized ? [
1694
+ (0, import_vue.h)(
1695
+ "div",
1696
+ {
1697
+ class: "vxe-cascader--panel-wrapper"
1698
+ },
1699
+ [
1700
+ filterable ? (0, import_vue.h)(
1701
+ "div",
1702
+ {
1703
+ class: "vxe-cascader--panel-search"
1704
+ },
1705
+ [
1706
+ (0, import_vue.h)(import_input.default, {
1707
+ ref: refInpSearch,
1708
+ class: "vxe-cascader-search--input",
1709
+ modelValue: searchValue,
1710
+ clearable: true,
1711
+ disabled: false,
1712
+ readonly: false,
1713
+ placeholder: getI18n("vxe.cascader.search"),
1714
+ prefixIcon: getIcon().INPUT_SEARCH,
1715
+ "onUpdate:modelValue": modelSearchEvent
1716
+ })
1717
+ ]
1718
+ ) : renderEmptyElement($xeCascader),
1719
+ showCheckedButton && multiple || showClearButton || headerSlot ? (0, import_vue.h)(
1720
+ "div",
1721
+ {
1722
+ class: "vxe-cascader--panel-header"
1723
+ },
1724
+ headerSlot ? headerSlot({}) : [
1725
+ (0, import_vue.h)(
1726
+ "div",
1727
+ {
1728
+ class: "vxe-cascader--header-button"
1729
+ },
1730
+ [
1731
+ showCheckedButton && multiple || showClearButton ? (0, import_vue.h)(
1766
1732
  "div",
1767
1733
  {
1768
- key: chunkIndex,
1769
- class: "vxe-cascader-chunk--item-wrapper"
1734
+ class: "vxe-cascader--selected-btns"
1770
1735
  },
1771
1736
  [
1772
- (0, import_vue.h)(
1773
- import_list.default,
1774
- {
1775
- data: chunks,
1776
- virtualYConfig: listVirtualYOpts
1777
- },
1778
- {
1779
- default(slotParams) {
1780
- const { items } = slotParams;
1781
- return items.map((node, nodeIndex) => {
1782
- const nodeid = getNodeId(node);
1783
- return renderNode(node, nodeid, nodeIndex, chunks, chunkIndex);
1784
- });
1737
+ showCheckedButton && multiple ? (0, import_vue.h)(import_button.default, {
1738
+ content: getI18n("vxe.treeSelect.allChecked"),
1739
+ mode: "text",
1740
+ onClick: allCheckedPanelEvent
1741
+ }) : renderEmptyElement($xeCascader),
1742
+ showClearButton ? (0, import_vue.h)(import_button.default, {
1743
+ content: getI18n("vxe.treeSelect.clearChecked"),
1744
+ mode: "text",
1745
+ onClick: clearCheckedPanelEvent
1746
+ }) : renderEmptyElement($xeCascader)
1747
+ ]
1748
+ ) : renderEmptyElement($xeCascader)
1749
+ ]
1750
+ )
1751
+ ]
1752
+ ) : renderEmptyElement($xeCascader),
1753
+ (0, import_vue.h)(
1754
+ "div",
1755
+ {
1756
+ class: "vxe-cascader--panel-body"
1757
+ },
1758
+ [
1759
+ (0, import_vue.h)(
1760
+ "div",
1761
+ {
1762
+ ref: refChunkWrapper,
1763
+ class: "vxe-cascader-chunk--wrapper"
1764
+ },
1765
+ [
1766
+ currentCunkList.map((chunks, chunkIndex) => {
1767
+ return (0, import_vue.h)(
1768
+ "div",
1769
+ {
1770
+ key: chunkIndex,
1771
+ class: "vxe-cascader-chunk--item-wrapper"
1772
+ },
1773
+ [
1774
+ (0, import_vue.h)(
1775
+ import_list.default,
1776
+ {
1777
+ data: chunks,
1778
+ virtualYConfig: listVirtualYOpts
1779
+ },
1780
+ {
1781
+ default(slotParams) {
1782
+ const { items } = slotParams;
1783
+ return items.map((node, nodeIndex) => {
1784
+ const nodeid = getNodeId(node);
1785
+ return renderNode(node, nodeid, nodeIndex, chunks, chunkIndex);
1786
+ });
1787
+ }
1785
1788
  }
1786
- }
1787
- )
1789
+ )
1790
+ ]
1791
+ );
1792
+ })
1793
+ ]
1794
+ )
1795
+ ]
1796
+ ),
1797
+ footerSlot || showTotalButton || showCloseButton ? (0, import_vue.h)(
1798
+ "div",
1799
+ {
1800
+ class: "vxe-cascader--panel-footer"
1801
+ },
1802
+ footerSlot ? footerSlot({}) : [
1803
+ (0, import_vue.h)(
1804
+ "div",
1805
+ {
1806
+ class: "vxe-cascader--footer-button"
1807
+ },
1808
+ [
1809
+ showTotalButton ? (0, import_vue.h)(
1810
+ "div",
1811
+ {
1812
+ class: "vxe-cascader--total-btns"
1813
+ },
1814
+ getI18n("vxe.treeSelect.total", [selectVals.length])
1815
+ ) : renderEmptyElement($xeCascader),
1816
+ showCloseButton ? (0, import_vue.h)(
1817
+ "div",
1818
+ {
1819
+ class: "vxe-cascader--oper-btns"
1820
+ },
1821
+ [
1822
+ (0, import_vue.h)(import_button.default, {
1823
+ content: getI18n("vxe.select.close"),
1824
+ mode: "text",
1825
+ onClick: closePanelEvent
1826
+ })
1788
1827
  ]
1789
- );
1790
- })
1791
- ]
1792
- )
1793
- ]
1794
- ),
1795
- footerSlot || showTotalButton || showCloseButton ? (0, import_vue.h)(
1796
- "div",
1797
- {
1798
- class: "vxe-cascader--panel-footer"
1799
- },
1800
- footerSlot ? footerSlot({}) : [
1801
- (0, import_vue.h)(
1802
- "div",
1803
- {
1804
- class: "vxe-cascader--footer-button"
1805
- },
1806
- [
1807
- showTotalButton ? (0, import_vue.h)(
1808
- "div",
1809
- {
1810
- class: "vxe-cascader--total-btns"
1811
- },
1812
- getI18n("vxe.treeSelect.total", [selectVals.length])
1813
- ) : renderEmptyElement($xeCascader),
1814
- showCloseButton ? (0, import_vue.h)(
1815
- "div",
1816
- {
1817
- class: "vxe-cascader--oper-btns"
1818
- },
1819
- [
1820
- (0, import_vue.h)(import_button.default, {
1821
- content: getI18n("vxe.select.close"),
1822
- mode: "text",
1823
- onClick: closePanelEvent
1824
- })
1825
- ]
1826
- ) : renderEmptyElement($xeCascader)
1827
- ]
1828
- )
1829
- ]
1830
- ) : renderEmptyElement($xeCascader)
1831
- ]
1832
- )
1833
- ] : []
1834
- )
1835
- ]
1836
- )
1837
- ]
1828
+ ) : renderEmptyElement($xeCascader)
1829
+ ]
1830
+ )
1831
+ ]
1832
+ ) : renderEmptyElement($xeCascader)
1833
+ ]
1834
+ )
1835
+ ] : []
1836
+ )
1837
+ ]
1838
+ )
1839
+ ]
1840
+ );
1841
+ };
1842
+ (0, import_vue.watch)(
1843
+ () => props.modelValue,
1844
+ () => {
1845
+ if (!internalData.isUpdateMode) {
1846
+ updateModelChecked();
1847
+ handleCurrentItems();
1848
+ updateCurrentChunk();
1849
+ }
1850
+ internalData.isUpdateMode = false;
1851
+ }
1838
1852
  );
1839
- };
1840
- (0, import_vue.watch)(
1841
- () => props.modelValue,
1842
- () => {
1843
- if (!internalData.isUpdateMode) {
1844
- updateModelChecked();
1845
- handleCurrentItems();
1846
- updateCurrentChunk();
1853
+ (0, import_vue.watch)(
1854
+ () => props.options,
1855
+ () => {
1856
+ cacheNodeMap();
1847
1857
  }
1848
- internalData.isUpdateMode = false;
1849
- }
1850
- );
1851
- (0, import_vue.watch)(
1852
- () => props.options,
1853
- () => {
1854
- cacheNodeMap();
1855
- }
1856
- );
1857
- const dataFlag = (0, import_vue.ref)(0);
1858
- (0, import_vue.watch)(
1859
- () => props.options ? props.options.length : 0,
1860
- () => {
1861
- dataFlag.value++;
1862
- }
1863
- );
1864
- (0, import_vue.watch)(
1865
- () => props.options,
1866
- () => {
1867
- dataFlag.value++;
1868
- }
1869
- );
1870
- (0, import_vue.watch)(dataFlag, () => {
1858
+ );
1859
+ const dataFlag = (0, import_vue.ref)(0);
1860
+ (0, import_vue.watch)(
1861
+ () => props.options ? props.options.length : 0,
1862
+ () => {
1863
+ dataFlag.value++;
1864
+ }
1865
+ );
1866
+ (0, import_vue.watch)(
1867
+ () => props.options,
1868
+ () => {
1869
+ dataFlag.value++;
1870
+ }
1871
+ );
1872
+ (0, import_vue.watch)(dataFlag, () => {
1873
+ loadData(props.options || []);
1874
+ });
1871
1875
  loadData(props.options || []);
1872
- });
1873
- loadData(props.options || []);
1874
- (0, import_vue.onMounted)(() => {
1875
- globalEvents.on($xeCascader, "mousedown", handleGlobalMousedownEvent);
1876
- globalEvents.on($xeCascader, "blur", handleGlobalBlurEvent);
1877
- globalEvents.on($xeCascader, "resize", handleGlobalResizeEvent);
1878
- globalEvents.on($xeCascader, "scroll", handleGlobalScrollEvent);
1879
- });
1880
- (0, import_vue.onUnmounted)(() => {
1881
- globalEvents.off($xeCascader, "mousedown");
1882
- globalEvents.off($xeCascader, "blur");
1883
- globalEvents.off($xeCascader, "resize");
1884
- globalEvents.off($xeCascader, "scroll");
1885
- import_xe_utils.default.assign(reactData, createReactData());
1886
- import_xe_utils.default.assign(internalData, createInternalData());
1887
- });
1888
- (0, import_vue.provide)("$xeCascader", $xeCascader);
1889
- $xeCascader.renderVN = renderVN;
1890
- return $xeCascader;
1891
- },
1892
- render() {
1893
- return this.renderVN();
1894
- }
1895
- });
1876
+ (0, import_vue.onMounted)(() => {
1877
+ globalEvents.on($xeCascader, "mousedown", handleGlobalMousedownEvent);
1878
+ globalEvents.on($xeCascader, "blur", handleGlobalBlurEvent);
1879
+ globalEvents.on($xeCascader, "resize", handleGlobalResizeEvent);
1880
+ globalEvents.on($xeCascader, "scroll", handleGlobalScrollEvent);
1881
+ });
1882
+ (0, import_vue.onUnmounted)(() => {
1883
+ globalEvents.off($xeCascader, "mousedown");
1884
+ globalEvents.off($xeCascader, "blur");
1885
+ globalEvents.off($xeCascader, "resize");
1886
+ globalEvents.off($xeCascader, "scroll");
1887
+ import_xe_utils.default.assign(reactData, createReactData());
1888
+ import_xe_utils.default.assign(internalData, createInternalData());
1889
+ });
1890
+ (0, import_vue.provide)("$xeCascader", $xeCascader);
1891
+ $xeCascader.renderVN = renderVN;
1892
+ return $xeCascader;
1893
+ },
1894
+ render() {
1895
+ return this.renderVN();
1896
+ }
1897
+ })
1898
+ );