vxe-pc-ui 4.20.24 → 4.20.26

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 (627) hide show
  1. package/dist/all.esm.js +15151 -10366
  2. package/dist/style.css +1 -1
  3. package/dist/style.mini.css +1 -1
  4. package/es/alert/src/alert.js +61 -36
  5. package/es/anchor/src/anchor-link.js +39 -20
  6. package/es/anchor/src/anchor.js +74 -45
  7. package/es/avatar/src/avatar.js +47 -27
  8. package/es/backtop/src/backtop.js +65 -40
  9. package/es/badge/src/badge.js +32 -16
  10. package/es/breadcrumb/src/breadcrumb-item.js +52 -27
  11. package/es/breadcrumb/src/breadcrumb.js +11 -8
  12. package/es/button/src/button-group.js +24 -18
  13. package/es/button/src/button.js +284 -185
  14. package/es/calendar/src/calendar.js +571 -358
  15. package/es/card/src/card.js +123 -68
  16. package/es/carousel/src/carousel-item.js +14 -7
  17. package/es/carousel/src/carousel.js +174 -112
  18. package/es/cascader/src/cascader.js +526 -380
  19. package/es/checkbox/src/button.js +90 -55
  20. package/es/checkbox/src/checkbox.js +60 -40
  21. package/es/checkbox/src/group.js +34 -26
  22. package/es/collapse/src/collapse-pane.js +33 -16
  23. package/es/collapse/src/collapse.js +133 -79
  24. package/es/color-picker/src/color-picker.js +489 -350
  25. package/es/components.d.ts +3 -1
  26. package/es/components.js +3 -2
  27. package/es/context-menu/src/context-menu.js +190 -110
  28. package/es/countdown/src/countdown.js +91 -59
  29. package/es/date-panel/src/date-panel.js +760 -450
  30. package/es/date-picker/src/date-picker.js +331 -228
  31. package/es/date-range-picker/src/date-range-picker.js +366 -265
  32. package/es/divider/src/divider.js +26 -12
  33. package/es/drawer/src/drawer.js +254 -154
  34. package/es/dynamics/index.js +38 -25
  35. package/es/empty/src/empty.js +53 -29
  36. package/es/form/render/index.js +66 -41
  37. package/es/form/src/form-config-item.js +22 -16
  38. package/es/form/src/form-group.js +23 -14
  39. package/es/form/src/form-item.js +23 -17
  40. package/es/form/src/form.js +139 -95
  41. package/es/form/src/itemInfo.js +2 -1
  42. package/es/form/src/render.js +207 -127
  43. package/es/form/src/util.js +8 -4
  44. package/es/icon/src/icon.js +14 -10
  45. package/es/icon/style.css +1 -1
  46. package/es/icon/style.mini.css +1 -1
  47. package/es/icon-picker/src/icon-picker.js +250 -157
  48. package/es/image/src/group.js +26 -20
  49. package/es/image/src/image.js +33 -32
  50. package/es/image/src/preview.js +182 -122
  51. package/es/image/src/util.js +6 -3
  52. package/es/index.d.ts +3 -0
  53. package/es/index.esm.js +12 -0
  54. package/es/index.js +12 -0
  55. package/es/input/src/input.js +820 -507
  56. package/es/layout-aside/src/layout-aside.js +54 -38
  57. package/es/layout-body/src/layout-body.js +39 -27
  58. package/es/layout-container/src/layout-container.js +16 -9
  59. package/es/layout-footer/src/layout-footer.js +16 -7
  60. package/es/layout-header/src/layout-header.js +15 -7
  61. package/es/link/src/link.js +65 -44
  62. package/es/list/src/list.js +453 -333
  63. package/es/loading/index.js +8 -5
  64. package/es/loading/src/loading.js +60 -33
  65. package/es/mention/src/mention.js +2 -1
  66. package/es/menu/src/menu.js +341 -210
  67. package/es/modal/index.js +60 -37
  68. package/es/modal/src/modal.js +303 -205
  69. package/es/notice-bar/src/notice-bar.js +64 -37
  70. package/es/number-input/src/number-input.js +249 -172
  71. package/es/pager/src/pager.js +346 -202
  72. package/es/password-input/src/password-input.js +145 -105
  73. package/es/print/src/page-break.js +2 -1
  74. package/es/print/src/print.js +184 -99
  75. package/es/pulldown/src/pulldown.js +113 -71
  76. package/es/radio/src/button.js +92 -57
  77. package/es/radio/src/group.js +33 -25
  78. package/es/radio/src/radio.js +61 -41
  79. package/es/rate/src/rate.js +48 -36
  80. package/es/result/src/result.js +67 -35
  81. package/es/row/src/col.js +30 -16
  82. package/es/row/src/row.js +21 -14
  83. package/es/scrollbar/src/scrollbar.js +177 -145
  84. package/es/segmented/src/segmented.js +93 -60
  85. package/es/select/src/optgroup.js +7 -3
  86. package/es/select/src/select.js +483 -340
  87. package/es/select/src/util.js +6 -3
  88. package/es/slider/src/slider.js +108 -80
  89. package/es/space/src/space.js +43 -26
  90. package/es/splitter/src/splitter-panel.js +50 -25
  91. package/es/splitter/src/splitter.js +219 -144
  92. package/es/steps/src/steps.js +10 -5
  93. package/es/style.css +1 -1
  94. package/es/style.mini.css +1 -1
  95. package/es/switch/src/switch.js +115 -64
  96. package/es/table-select/src/table-select.js +232 -153
  97. package/es/table-transfer/src/table-transfer.js +10 -5
  98. package/es/tabs/src/tab-pane.js +33 -16
  99. package/es/tabs/src/tabs.js +363 -230
  100. package/es/tag/src/tag.js +61 -43
  101. package/es/text/src/text.js +89 -65
  102. package/es/text-ellipsis/src/text-ellipsis.js +82 -51
  103. package/es/textarea/src/textarea.js +116 -86
  104. package/es/timeline/src/timeline-item.js +2 -1
  105. package/es/timeline/src/timeline.js +2 -1
  106. package/es/tip/src/tip.js +53 -29
  107. package/es/tooltip/src/tooltip.js +114 -74
  108. package/es/tour/src/tour.js +2 -1
  109. package/es/transfer/src/transfer.js +42 -25
  110. package/es/tree/src/tree.js +709 -492
  111. package/es/tree-select/src/tree-select.js +320 -225
  112. package/es/ui/index.d.ts +0 -1
  113. package/es/ui/index.js +46 -3
  114. package/es/ui/src/dom.js +9 -6
  115. package/es/ui/src/log.js +1 -1
  116. package/es/ui/src/utils.d.ts +1 -1
  117. package/es/upload/src/upload.js +614 -398
  118. package/es/vxe-icon/style.css +1 -1
  119. package/es/vxe-icon/style.mini.css +1 -1
  120. package/es/watermark/src/util.js +15 -12
  121. package/es/watermark/src/watermark.js +55 -25
  122. package/lib/alert/src/alert.js +62 -37
  123. package/lib/anchor/src/anchor-link.js +39 -20
  124. package/lib/anchor/src/anchor.js +75 -46
  125. package/lib/avatar/src/avatar.js +52 -32
  126. package/lib/backtop/src/backtop.js +81 -56
  127. package/lib/badge/src/badge.js +35 -19
  128. package/lib/breadcrumb/src/breadcrumb-item.js +52 -27
  129. package/lib/breadcrumb/src/breadcrumb.js +13 -10
  130. package/lib/button/src/button-group.js +27 -21
  131. package/lib/button/src/button.js +306 -207
  132. package/lib/calendar/src/calendar.js +575 -362
  133. package/lib/card/src/card.js +133 -78
  134. package/lib/carousel/src/carousel-item.js +15 -8
  135. package/lib/carousel/src/carousel.js +182 -120
  136. package/lib/cascader/src/cascader.js +555 -409
  137. package/lib/checkbox/src/button.js +93 -58
  138. package/lib/checkbox/src/checkbox.js +63 -43
  139. package/lib/checkbox/src/group.js +37 -29
  140. package/lib/collapse/src/collapse-pane.js +34 -17
  141. package/lib/collapse/src/collapse.js +139 -85
  142. package/lib/color-picker/src/color-picker.js +516 -377
  143. package/lib/components.js +3 -2
  144. package/lib/context-menu/src/context-menu.js +212 -132
  145. package/lib/countdown/src/countdown.js +95 -63
  146. package/lib/date-panel/src/date-panel.js +776 -466
  147. package/lib/date-picker/src/date-picker.js +377 -274
  148. package/lib/date-range-picker/src/date-range-picker.js +401 -300
  149. package/lib/divider/src/divider.js +31 -17
  150. package/lib/drawer/src/drawer.js +255 -155
  151. package/lib/dynamics/index.js +38 -25
  152. package/lib/empty/src/empty.js +55 -31
  153. package/lib/form/render/index.js +68 -43
  154. package/lib/form/src/form-config-item.js +24 -18
  155. package/lib/form/src/form-group.js +25 -16
  156. package/lib/form/src/form-item.js +25 -19
  157. package/lib/form/src/form.js +140 -96
  158. package/lib/form/src/itemInfo.js +4 -3
  159. package/lib/form/src/render.js +214 -134
  160. package/lib/form/src/util.js +9 -5
  161. package/lib/icon/src/icon.js +17 -13
  162. package/lib/icon/style/style.css +1 -1
  163. package/lib/icon/style/style.mini.css +1 -1
  164. package/lib/icon-picker/src/icon-picker.js +251 -158
  165. package/lib/image/src/group.js +26 -20
  166. package/lib/image/src/image.js +41 -40
  167. package/lib/image/src/preview.js +206 -146
  168. package/lib/image/src/util.js +6 -3
  169. package/lib/index.common.js +12 -0
  170. package/lib/index.js +12 -0
  171. package/lib/index.umd.js +15359 -10558
  172. package/lib/index.umd.min.js +3 -3
  173. package/lib/input/src/input.js +878 -565
  174. package/lib/layout-aside/src/layout-aside.js +61 -45
  175. package/lib/layout-body/src/layout-body.js +47 -35
  176. package/lib/layout-container/src/layout-container.js +18 -11
  177. package/lib/layout-footer/src/layout-footer.js +17 -8
  178. package/lib/layout-header/src/layout-header.js +16 -8
  179. package/lib/link/src/link.js +69 -48
  180. package/lib/list/src/list.js +456 -336
  181. package/lib/loading/index.js +8 -5
  182. package/lib/loading/src/loading.js +69 -42
  183. package/lib/mention/src/mention.js +4 -3
  184. package/lib/menu/src/menu.js +351 -220
  185. package/lib/modal/index.js +60 -37
  186. package/lib/modal/src/modal.js +306 -208
  187. package/lib/notice-bar/src/notice-bar.js +70 -43
  188. package/lib/number-input/src/number-input.js +290 -213
  189. package/lib/pager/src/pager.js +347 -203
  190. package/lib/password-input/src/password-input.js +155 -115
  191. package/lib/print/src/page-break.js +3 -2
  192. package/lib/print/src/print.js +193 -108
  193. package/lib/pulldown/src/pulldown.js +128 -86
  194. package/lib/radio/src/button.js +96 -61
  195. package/lib/radio/src/group.js +37 -29
  196. package/lib/radio/src/radio.js +65 -45
  197. package/lib/rate/src/rate.js +50 -38
  198. package/lib/result/src/result.js +68 -36
  199. package/lib/row/src/col.js +32 -18
  200. package/lib/row/src/row.js +25 -18
  201. package/lib/scrollbar/src/scrollbar.js +178 -146
  202. package/lib/segmented/src/segmented.js +97 -64
  203. package/lib/select/src/optgroup.js +7 -3
  204. package/lib/select/src/select.js +486 -343
  205. package/lib/select/src/util.js +6 -3
  206. package/lib/slider/src/slider.js +122 -94
  207. package/lib/space/src/space.js +57 -40
  208. package/lib/splitter/src/splitter-panel.js +51 -26
  209. package/lib/splitter/src/splitter.js +233 -158
  210. package/lib/steps/src/steps.js +11 -6
  211. package/lib/style.css +1 -1
  212. package/lib/style.mini.css +1 -1
  213. package/lib/switch/src/switch.js +116 -65
  214. package/lib/table-select/src/table-select.js +234 -155
  215. package/lib/table-transfer/src/table-transfer.js +12 -7
  216. package/lib/tabs/src/tab-pane.js +34 -17
  217. package/lib/tabs/src/tabs.js +365 -232
  218. package/lib/tag/src/tag.js +67 -49
  219. package/lib/text/src/text.js +100 -76
  220. package/lib/text-ellipsis/src/text-ellipsis.js +86 -55
  221. package/lib/textarea/src/textarea.js +127 -97
  222. package/lib/timeline/src/timeline-item.js +3 -2
  223. package/lib/timeline/src/timeline.js +4 -3
  224. package/lib/tip/src/tip.js +58 -34
  225. package/lib/tooltip/src/tooltip.js +116 -76
  226. package/lib/tour/src/tour.js +4 -3
  227. package/lib/transfer/src/transfer.js +44 -27
  228. package/lib/tree/src/tree.js +717 -500
  229. package/lib/tree-select/src/tree-select.js +351 -256
  230. package/lib/ui/index.js +46 -4
  231. package/lib/ui/src/dom.js +9 -6
  232. package/lib/ui/src/log.js +1 -1
  233. package/lib/upload/src/upload.js +708 -492
  234. package/lib/vxe-icon/style/style.css +1 -1
  235. package/lib/vxe-icon/style/style.mini.css +1 -1
  236. package/lib/watermark/src/util.js +15 -12
  237. package/lib/watermark/src/watermark.js +60 -30
  238. package/package.json +10 -4
  239. package/packages/alert/index.ts +16 -16
  240. package/packages/alert/src/alert.ts +148 -126
  241. package/packages/anchor/index.ts +16 -16
  242. package/packages/anchor/src/anchor-link.ts +139 -121
  243. package/packages/anchor/src/anchor.ts +266 -237
  244. package/packages/anchor/src/util.ts +23 -23
  245. package/packages/anchor-link/index.ts +16 -16
  246. package/packages/avatar/index.ts +16 -16
  247. package/packages/avatar/src/avatar.ts +166 -149
  248. package/packages/backtop/index.ts +16 -16
  249. package/packages/backtop/src/backtop.ts +337 -313
  250. package/packages/badge/index.ts +16 -16
  251. package/packages/badge/src/badge.ts +131 -118
  252. package/packages/breadcrumb/index.ts +16 -16
  253. package/packages/breadcrumb/src/breadcrumb-item.ts +129 -106
  254. package/packages/breadcrumb/src/breadcrumb.ts +94 -92
  255. package/packages/breadcrumb-item/index.ts +16 -16
  256. package/packages/button/index.ts +16 -16
  257. package/packages/button/src/button-group.ts +116 -110
  258. package/packages/button/src/button.ts +975 -855
  259. package/packages/button-group/index.ts +16 -16
  260. package/packages/calendar/index.ts +16 -16
  261. package/packages/calendar/src/calendar.ts +1566 -1352
  262. package/packages/card/index.ts +16 -16
  263. package/packages/card/src/card.ts +285 -236
  264. package/packages/carousel/index.ts +16 -16
  265. package/packages/carousel/src/carousel-item.ts +120 -102
  266. package/packages/carousel/src/carousel.ts +475 -414
  267. package/packages/carousel/src/util.ts +21 -21
  268. package/packages/carousel-item/index.ts +16 -16
  269. package/packages/cascader/index.ts +16 -16
  270. package/packages/cascader/src/cascader.ts +2074 -1896
  271. package/packages/cascader/src/util.ts +9 -9
  272. package/packages/checkbox/index.ts +16 -16
  273. package/packages/checkbox/src/button.ts +267 -221
  274. package/packages/checkbox/src/checkbox.ts +219 -199
  275. package/packages/checkbox/src/group.ts +292 -269
  276. package/packages/checkbox-button/index.ts +16 -16
  277. package/packages/checkbox-group/index.ts +16 -16
  278. package/packages/col/index.ts +16 -16
  279. package/packages/collapse/index.ts +16 -16
  280. package/packages/collapse/src/collapse-pane.ts +142 -114
  281. package/packages/collapse/src/collapse.ts +453 -384
  282. package/packages/collapse/src/util.ts +21 -21
  283. package/packages/collapse-pane/index.ts +16 -16
  284. package/packages/color-picker/index.ts +31 -31
  285. package/packages/color-picker/src/color-picker.ts +1310 -1147
  286. package/packages/color-picker/src/util.ts +436 -423
  287. package/packages/components.ts +350 -349
  288. package/packages/context-menu/index.ts +54 -54
  289. package/packages/context-menu/src/context-menu.ts +773 -681
  290. package/packages/countdown/index.ts +16 -16
  291. package/packages/countdown/src/countdown.ts +295 -262
  292. package/packages/date-panel/index.ts +16 -16
  293. package/packages/date-panel/src/date-panel.ts +2214 -1900
  294. package/packages/date-panel/src/util.ts +354 -326
  295. package/packages/date-picker/index.ts +16 -16
  296. package/packages/date-picker/src/date-picker.ts +1884 -1752
  297. package/packages/date-range-picker/index.ts +16 -16
  298. package/packages/date-range-picker/src/date-range-picker.ts +1728 -1604
  299. package/packages/divider/index.ts +16 -16
  300. package/packages/divider/src/divider.ts +105 -93
  301. package/packages/drawer/index.ts +78 -78
  302. package/packages/drawer/src/drawer.ts +920 -802
  303. package/packages/drawer/src/store.ts +3 -3
  304. package/packages/dynamics/index.ts +124 -117
  305. package/packages/empty/index.ts +16 -16
  306. package/packages/empty/src/empty.ts +124 -103
  307. package/packages/form/index.ts +16 -16
  308. package/packages/form/render/index.ts +646 -614
  309. package/packages/form/src/form-config-item.ts +85 -80
  310. package/packages/form/src/form-group.ts +96 -86
  311. package/packages/form/src/form-item.ts +181 -174
  312. package/packages/form/src/form.ts +1122 -1069
  313. package/packages/form/src/itemInfo.ts +84 -82
  314. package/packages/form/src/render.ts +470 -387
  315. package/packages/form/src/util.ts +98 -93
  316. package/packages/form-gather/index.ts +26 -26
  317. package/packages/form-group/index.ts +16 -16
  318. package/packages/form-item/index.ts +16 -16
  319. package/packages/icon/index.ts +16 -16
  320. package/packages/icon/src/icon.ts +78 -75
  321. package/packages/icon-picker/index.ts +16 -16
  322. package/packages/icon-picker/src/icon-picker.ts +922 -809
  323. package/packages/image/index.ts +16 -16
  324. package/packages/image/src/group.ts +159 -153
  325. package/packages/image/src/image.ts +298 -298
  326. package/packages/image/src/preview.ts +749 -672
  327. package/packages/image/src/util.ts +62 -59
  328. package/packages/image-group/index.ts +16 -16
  329. package/packages/image-preview/index.ts +19 -19
  330. package/packages/index.ts +20 -4
  331. package/packages/input/index.ts +16 -16
  332. package/packages/input/src/input.ts +3201 -2863
  333. package/packages/language/fr-FR.ts +15 -15
  334. package/packages/language/it-IT.ts +4 -4
  335. package/packages/language/uk-UA.ts +1 -1
  336. package/packages/language/uz-UZ.ts +13 -13
  337. package/packages/language/zh-CN.ts +907 -907
  338. package/packages/layout-aside/index.ts +16 -16
  339. package/packages/layout-aside/src/layout-aside.ts +172 -156
  340. package/packages/layout-body/index.ts +16 -16
  341. package/packages/layout-body/src/layout-body.ts +191 -181
  342. package/packages/layout-container/index.ts +16 -16
  343. package/packages/layout-container/src/layout-container.ts +108 -92
  344. package/packages/layout-footer/index.ts +16 -16
  345. package/packages/layout-footer/src/layout-footer.ts +81 -74
  346. package/packages/layout-header/index.ts +16 -16
  347. package/packages/layout-header/src/layout-header.ts +79 -73
  348. package/packages/link/index.ts +16 -16
  349. package/packages/link/src/link.ts +180 -161
  350. package/packages/list/index.ts +16 -16
  351. package/packages/list/src/list.ts +2690 -2564
  352. package/packages/list/src/store.ts +10 -10
  353. package/packages/list/src/util.ts +10 -11
  354. package/packages/loading/index.ts +39 -36
  355. package/packages/loading/src/loading.ts +179 -152
  356. package/packages/mention/index.ts +16 -16
  357. package/packages/mention/src/mention.ts +69 -71
  358. package/packages/menu/index.ts +16 -16
  359. package/packages/menu/src/menu.ts +1000 -857
  360. package/packages/modal/index.ts +164 -141
  361. package/packages/modal/src/modal.ts +1803 -1681
  362. package/packages/modal/src/store.ts +3 -3
  363. package/packages/notice-bar/index.ts +16 -16
  364. package/packages/notice-bar/src/notice-bar.ts +207 -181
  365. package/packages/number-input/index.ts +16 -16
  366. package/packages/number-input/src/number-input.ts +1322 -1242
  367. package/packages/number-input/src/util.ts +25 -25
  368. package/packages/optgroup/index.ts +16 -16
  369. package/packages/option/index.ts +16 -16
  370. package/packages/pager/index.ts +16 -16
  371. package/packages/pager/src/pager.ts +919 -775
  372. package/packages/password-input/index.ts +16 -16
  373. package/packages/password-input/src/password-input.ts +523 -482
  374. package/packages/print/index.ts +18 -18
  375. package/packages/print/src/page-break.ts +104 -92
  376. package/packages/print/src/print.ts +366 -281
  377. package/packages/print/src/util.ts +299 -304
  378. package/packages/print-page-break/index.ts +16 -16
  379. package/packages/pulldown/index.ts +16 -16
  380. package/packages/pulldown/src/pulldown.ts +505 -445
  381. package/packages/radio/index.ts +16 -16
  382. package/packages/radio/src/button.ts +290 -243
  383. package/packages/radio/src/group.ts +275 -252
  384. package/packages/radio/src/radio.ts +237 -218
  385. package/packages/radio-button/index.ts +16 -16
  386. package/packages/radio-group/index.ts +16 -16
  387. package/packages/rate/index.ts +16 -16
  388. package/packages/rate/src/rate.ts +203 -192
  389. package/packages/result/index.ts +16 -16
  390. package/packages/result/src/result.ts +141 -112
  391. package/packages/row/index.ts +16 -16
  392. package/packages/row/src/col.ts +171 -159
  393. package/packages/row/src/row.ts +143 -138
  394. package/packages/scrollbar/index.ts +16 -16
  395. package/packages/scrollbar/src/scrollbar.ts +626 -595
  396. package/packages/segmented/index.ts +16 -16
  397. package/packages/segmented/src/segmented.ts +297 -264
  398. package/packages/select/index.ts +16 -16
  399. package/packages/select/src/optgroup.ts +53 -49
  400. package/packages/select/src/option-info.ts +20 -20
  401. package/packages/select/src/option.ts +47 -47
  402. package/packages/select/src/select.ts +2390 -2214
  403. package/packages/select/src/util.ts +50 -47
  404. package/packages/slider/index.ts +16 -16
  405. package/packages/slider/src/slider.ts +547 -506
  406. package/packages/space/index.ts +16 -16
  407. package/packages/space/src/space.ts +225 -209
  408. package/packages/split/index.ts +16 -16
  409. package/packages/split-pane/index.ts +17 -17
  410. package/packages/splitter/index.ts +16 -16
  411. package/packages/splitter/src/splitter-panel.ts +199 -163
  412. package/packages/splitter/src/splitter.ts +1110 -1020
  413. package/packages/splitter/src/util.ts +21 -21
  414. package/packages/splitter-panel/index.ts +16 -16
  415. package/packages/steps/index.ts +16 -16
  416. package/packages/steps/src/steps.ts +69 -68
  417. package/packages/switch/index.ts +16 -16
  418. package/packages/switch/src/switch.ts +300 -245
  419. package/packages/tab-pane/index.ts +16 -16
  420. package/packages/table-select/index.ts +16 -16
  421. package/packages/table-select/src/table-select.ts +1103 -999
  422. package/packages/table-transfer/index.ts +16 -16
  423. package/packages/table-transfer/src/table-transfer.ts +104 -91
  424. package/packages/tabs/index.ts +16 -16
  425. package/packages/tabs/src/tab-pane.ts +132 -117
  426. package/packages/tabs/src/tabs.ts +1137 -997
  427. package/packages/tabs/src/util.ts +21 -21
  428. package/packages/tag/index.ts +16 -16
  429. package/packages/tag/src/tag.ts +204 -187
  430. package/packages/text/index.ts +16 -16
  431. package/packages/text/src/text.ts +282 -260
  432. package/packages/text-ellipsis/index.ts +16 -16
  433. package/packages/text-ellipsis/src/text-ellipsis.ts +312 -282
  434. package/packages/textarea/index.ts +16 -16
  435. package/packages/textarea/src/textarea.ts +526 -495
  436. package/packages/timeline/index.ts +16 -16
  437. package/packages/timeline/src/timeline-item.ts +65 -67
  438. package/packages/timeline/src/timeline.ts +70 -71
  439. package/packages/timeline-item/index.ts +16 -16
  440. package/packages/tip/index.ts +19 -19
  441. package/packages/tip/src/tip.ts +150 -129
  442. package/packages/tooltip/index.ts +72 -72
  443. package/packages/tooltip/src/tooltip.ts +669 -627
  444. package/packages/tour/index.ts +16 -16
  445. package/packages/tour/src/tour.ts +70 -71
  446. package/packages/transfer/index.ts +16 -16
  447. package/packages/transfer/src/transfer.ts +130 -117
  448. package/packages/tree/index.ts +16 -16
  449. package/packages/tree/src/store.ts +10 -10
  450. package/packages/tree/src/tree.ts +4077 -3852
  451. package/packages/tree/src/util.ts +51 -51
  452. package/packages/tree-select/index.ts +16 -16
  453. package/packages/tree-select/src/tree-select.ts +1217 -1094
  454. package/packages/ui/index.ts +836 -793
  455. package/packages/ui/src/anime.ts +51 -52
  456. package/packages/ui/src/comp.ts +3 -3
  457. package/packages/ui/src/dom.ts +357 -354
  458. package/packages/ui/src/log.ts +19 -19
  459. package/packages/ui/src/utils.ts +79 -79
  460. package/packages/ui/src/vn.ts +39 -39
  461. package/packages/upload/index.ts +20 -20
  462. package/packages/upload/src/upload.ts +2271 -2021
  463. package/packages/upload/src/util.ts +109 -109
  464. package/packages/watermark/index.ts +33 -33
  465. package/packages/watermark/src/util.ts +186 -180
  466. package/packages/watermark/src/watermark.ts +196 -168
  467. package/types/all.d.ts +552 -552
  468. package/types/components/alert.d.ts +83 -87
  469. package/types/components/anchor-link.d.ts +88 -91
  470. package/types/components/anchor.d.ts +97 -104
  471. package/types/components/avatar.d.ts +85 -88
  472. package/types/components/backtop.d.ts +119 -122
  473. package/types/components/badge.d.ts +77 -80
  474. package/types/components/breadcrumb-item.d.ts +77 -80
  475. package/types/components/breadcrumb.d.ts +83 -87
  476. package/types/components/button-group.d.ts +118 -120
  477. package/types/components/button.d.ts +331 -339
  478. package/types/components/calendar.d.ts +247 -264
  479. package/types/components/card.d.ts +111 -113
  480. package/types/components/carousel-item.d.ts +73 -75
  481. package/types/components/carousel.d.ts +130 -134
  482. package/types/components/cascader.d.ts +336 -386
  483. package/types/components/checkbox-button.d.ts +109 -114
  484. package/types/components/checkbox-group.d.ts +152 -154
  485. package/types/components/checkbox.d.ts +123 -128
  486. package/types/components/col.d.ts +77 -80
  487. package/types/components/colgroup.d.ts +64 -69
  488. package/types/components/collapse-pane.d.ts +86 -89
  489. package/types/components/collapse.d.ts +123 -133
  490. package/types/components/color-picker.d.ts +275 -280
  491. package/types/components/column.d.ts +834 -851
  492. package/types/components/context-menu.d.ts +282 -289
  493. package/types/components/countdown.d.ts +108 -112
  494. package/types/components/date-panel.d.ts +319 -331
  495. package/types/components/date-picker.d.ts +361 -384
  496. package/types/components/date-range-picker.d.ts +351 -371
  497. package/types/components/divider.d.ts +72 -75
  498. package/types/components/drawer.d.ts +333 -344
  499. package/types/components/empty.d.ts +75 -78
  500. package/types/components/flow-design.d.ts +73 -85
  501. package/types/components/flow-view.d.ts +73 -85
  502. package/types/components/form-design.d.ts +370 -376
  503. package/types/components/form-gather.d.ts +120 -124
  504. package/types/components/form-group.d.ts +73 -77
  505. package/types/components/form-item.d.ts +395 -413
  506. package/types/components/form-view.d.ts +179 -183
  507. package/types/components/form.d.ts +499 -495
  508. package/types/components/gantt-module/gantt-view.d.ts +195 -200
  509. package/types/components/gantt-module/index.d.ts +1 -1
  510. package/types/components/gantt-plugins/extend-gantt-chart.d.ts +137 -131
  511. package/types/components/gantt-plugins/index.d.ts +1 -1
  512. package/types/components/gantt.d.ts +1248 -1399
  513. package/types/components/grid.d.ts +1289 -1317
  514. package/types/components/icon-picker.d.ts +242 -253
  515. package/types/components/icon.d.ts +332 -87
  516. package/types/components/image-group.d.ts +124 -127
  517. package/types/components/image-preview.d.ts +167 -167
  518. package/types/components/image.d.ts +166 -173
  519. package/types/components/input.d.ts +429 -453
  520. package/types/components/layout-aside.d.ts +123 -123
  521. package/types/components/layout-body.d.ts +110 -113
  522. package/types/components/layout-container.d.ts +73 -75
  523. package/types/components/layout-footer.d.ts +71 -73
  524. package/types/components/layout-header.d.ts +67 -69
  525. package/types/components/link.d.ts +107 -111
  526. package/types/components/list-design.d.ts +189 -190
  527. package/types/components/list-view.d.ts +193 -199
  528. package/types/components/list.d.ts +678 -715
  529. package/types/components/loading.d.ts +98 -103
  530. package/types/components/mention.d.ts +70 -77
  531. package/types/components/menu.d.ts +284 -295
  532. package/types/components/modal.d.ts +567 -584
  533. package/types/components/notice-bar.d.ts +102 -106
  534. package/types/components/number-input.d.ts +359 -365
  535. package/types/components/optgroup.d.ts +85 -88
  536. package/types/components/option.d.ts +94 -103
  537. package/types/components/pager.d.ts +330 -335
  538. package/types/components/password-input.d.ts +143 -156
  539. package/types/components/print-page-break.d.ts +65 -69
  540. package/types/components/print.d.ts +243 -245
  541. package/types/components/pulldown.d.ts +231 -239
  542. package/types/components/radio-button.d.ts +113 -118
  543. package/types/components/radio-group.d.ts +151 -153
  544. package/types/components/radio.d.ts +129 -134
  545. package/types/components/rate.d.ts +83 -88
  546. package/types/components/result.d.ts +81 -84
  547. package/types/components/row.d.ts +77 -81
  548. package/types/components/scrollbar.d.ts +299 -305
  549. package/types/components/segmented.d.ts +119 -123
  550. package/types/components/select.d.ts +598 -616
  551. package/types/components/slider.d.ts +137 -151
  552. package/types/components/space.d.ts +120 -127
  553. package/types/components/split-pane.d.ts +126 -133
  554. package/types/components/split.d.ts +301 -312
  555. package/types/components/splitter-panel.d.ts +123 -130
  556. package/types/components/splitter.d.ts +290 -301
  557. package/types/components/steps.d.ts +63 -68
  558. package/types/components/switch.d.ts +127 -133
  559. package/types/components/tab-pane.d.ts +111 -114
  560. package/types/components/table-module/custom.d.ts +123 -123
  561. package/types/components/table-module/edit.d.ts +297 -276
  562. package/types/components/table-module/export.d.ts +88 -96
  563. package/types/components/table-module/filter.d.ts +144 -144
  564. package/types/components/table-module/index.d.ts +7 -7
  565. package/types/components/table-module/keyboard.d.ts +26 -26
  566. package/types/components/table-module/menu.d.ts +46 -46
  567. package/types/components/table-module/validator.d.ts +53 -53
  568. package/types/components/table-plugins/extend-cell-area.d.ts +781 -781
  569. package/types/components/table-plugins/extend-pivot-table.d.ts +59 -58
  570. package/types/components/table-plugins/filters-combination.d.ts +15 -15
  571. package/types/components/table-plugins/filters-complex-input.d.ts +9 -9
  572. package/types/components/table-plugins/index.d.ts +4 -4
  573. package/types/components/table-select.d.ts +268 -276
  574. package/types/components/table-transfer.d.ts +80 -84
  575. package/types/components/table.d.ts +7530 -8000
  576. package/types/components/tabs.d.ts +314 -352
  577. package/types/components/tag.d.ts +108 -114
  578. package/types/components/text-ellipsis.d.ts +107 -112
  579. package/types/components/text.d.ts +112 -122
  580. package/types/components/textarea.d.ts +261 -275
  581. package/types/components/timeline-item.d.ts +66 -75
  582. package/types/components/timeline.d.ts +70 -77
  583. package/types/components/tip.d.ts +81 -83
  584. package/types/components/toolbar.d.ts +327 -336
  585. package/types/components/tooltip.d.ts +250 -255
  586. package/types/components/tour.d.ts +70 -77
  587. package/types/components/transfer.d.ts +80 -84
  588. package/types/components/tree-select.d.ts +361 -376
  589. package/types/components/tree.d.ts +994 -1036
  590. package/types/components/upload.d.ts +477 -518
  591. package/types/components/watermark.d.ts +116 -120
  592. package/types/handles/form-design.d.ts +50 -50
  593. package/types/handles/index.d.ts +3 -3
  594. package/types/handles/list-design.d.ts +1 -2
  595. package/types/handles/table.d.ts +15 -15
  596. package/types/index.d.ts +8 -8
  597. package/types/ui/commands.d.ts +57 -57
  598. package/types/ui/formats.d.ts +62 -62
  599. package/types/ui/global-config.d.ts +269 -269
  600. package/types/ui/global-icon.d.ts +315 -315
  601. package/types/ui/hooks.d.ts +13 -13
  602. package/types/ui/index.d.ts +100 -100
  603. package/types/ui/interceptor.d.ts +52 -52
  604. package/types/ui/menus.d.ts +89 -89
  605. package/types/ui/renderer.d.ts +1033 -1047
  606. package/types/ui/validators.d.ts +37 -38
  607. /package/dist/{iconfont.1792979107495.ttf → iconfont.1793007755017.ttf} +0 -0
  608. /package/dist/{iconfont.1792979107495.woff → iconfont.1793007755017.woff} +0 -0
  609. /package/dist/{iconfont.1792979107495.woff2 → iconfont.1793007755017.woff2} +0 -0
  610. /package/es/icon/{iconfont.1792979107495.ttf → iconfont.1793007755017.ttf} +0 -0
  611. /package/es/icon/{iconfont.1792979107495.woff → iconfont.1793007755017.woff} +0 -0
  612. /package/es/icon/{iconfont.1792979107495.woff2 → iconfont.1793007755017.woff2} +0 -0
  613. /package/es/{iconfont.1792979107495.ttf → iconfont.1793007755017.ttf} +0 -0
  614. /package/es/{iconfont.1792979107495.woff → iconfont.1793007755017.woff} +0 -0
  615. /package/es/{iconfont.1792979107495.woff2 → iconfont.1793007755017.woff2} +0 -0
  616. /package/es/vxe-icon/{iconfont.1792979107495.ttf → iconfont.1793007755017.ttf} +0 -0
  617. /package/es/vxe-icon/{iconfont.1792979107495.woff → iconfont.1793007755017.woff} +0 -0
  618. /package/es/vxe-icon/{iconfont.1792979107495.woff2 → iconfont.1793007755017.woff2} +0 -0
  619. /package/lib/icon/style/{iconfont.1792979107495.ttf → iconfont.1793007755017.ttf} +0 -0
  620. /package/lib/icon/style/{iconfont.1792979107495.woff → iconfont.1793007755017.woff} +0 -0
  621. /package/lib/icon/style/{iconfont.1792979107495.woff2 → iconfont.1793007755017.woff2} +0 -0
  622. /package/lib/{iconfont.1792979107495.ttf → iconfont.1793007755017.ttf} +0 -0
  623. /package/lib/{iconfont.1792979107495.woff → iconfont.1793007755017.woff} +0 -0
  624. /package/lib/{iconfont.1792979107495.woff2 → iconfont.1793007755017.woff2} +0 -0
  625. /package/lib/vxe-icon/style/{iconfont.1792979107495.ttf → iconfont.1793007755017.ttf} +0 -0
  626. /package/lib/vxe-icon/style/{iconfont.1792979107495.woff → iconfont.1793007755017.woff} +0 -0
  627. /package/lib/vxe-icon/style/{iconfont.1792979107495.woff2 → iconfont.1793007755017.woff2} +0 -0
@@ -1,809 +1,922 @@
1
- import { h, Teleport, PropType, ref, inject, watch, computed, provide, onBeforeUnmount, reactive, nextTick, onMounted } from 'vue'
2
- import { defineVxeComponent } from '../../ui/src/comp'
3
- import XEUtils from 'xe-utils'
4
- import { VxeUI } from '../../ui'
5
- import { getEventTargetNode, getPopupContainer, toCssUnit, updatePanelPlacement } from '../../ui/src/dom'
6
- import { getLastZIndex, nextZIndex, getFuncText } from '../../ui/src/utils'
7
- import { getSlotVNs } from '../../ui/src/vn'
8
- import VxeInputComponent from '../../input'
9
- import VxeScrollbarComponent from '../../scrollbar'
10
-
11
- import type { VxeIconPickerPropTypes, VxeIconPickerConstructor, IconPickerInternalData, VxeInputConstructor, ValueOf, IconPickerReactData, VxeIconPickerEmits, IconPickerMethods, IconPickerPrivateRef, VxeIconPickerMethods, VxeIconPickerDefines, VxeDrawerConstructor, VxeDrawerMethods, VxeFormDefines, VxeFormConstructor, VxeFormPrivateMethods, VxeModalConstructor, VxeModalMethods, VxeComponentStyleType } from '../../../types'
12
- import type { VxeTableConstructor, VxeTablePrivateMethods } from '../../../types/components/table'
13
-
14
- const { getConfig, getIcon, getI18n, baseUtils, globalEvents, createEvent, renderer, useFns, GLOBAL_EVENT_KEYS, renderEmptyElement } = VxeUI
15
- const { getDefVal } = baseUtils
16
-
17
- function createReactData (): IconPickerReactData {
18
- return {
19
- initialized: false,
20
- selectIcon: '',
21
- panelIndex: 0,
22
- panelStyle: {},
23
- panelPlacement: null,
24
- visiblePanel: false,
25
- isAniVisible: false,
26
- isActivated: false,
27
- searchValue: '',
28
- iconList: []
29
- }
30
- }
31
-
32
- function createInternalData (): IconPickerInternalData {
33
- return {
34
- fullList: []
35
- // hpTimeout: undefined
36
- }
37
- }
38
-
39
- export default defineVxeComponent({
40
- name: 'VxeIconPicker',
41
- props: {
42
- modelValue: String as PropType<VxeIconPickerPropTypes.ModelValue>,
43
- placeholder: String as PropType<VxeIconPickerPropTypes.Placeholder>,
44
- clearable: Boolean as PropType<VxeIconPickerPropTypes.Clearable>,
45
- size: {
46
- type: String as PropType<VxeIconPickerPropTypes.Size>,
47
- default: () => getConfig().iconPicker.size || getConfig().size
48
- },
49
- className: [String, Function] as PropType<VxeIconPickerPropTypes.ClassName>,
50
- /**
51
- * 已废弃,请使用 popupConfig.className
52
- * @deprecated
53
- */
54
- popupClassName: [String, Function] as PropType<VxeIconPickerPropTypes.PopupClassName>,
55
- width: [Number, String] as PropType<VxeIconPickerPropTypes.Width>,
56
- showIconTitle: {
57
- type: Boolean as PropType<VxeIconPickerPropTypes.ShowIconTitle>,
58
- default: () => getConfig().iconPicker.showIconTitle
59
- },
60
- readonly: {
61
- type: Boolean as PropType<VxeIconPickerPropTypes.Readonly>,
62
- default: null
63
- },
64
- disabled: {
65
- type: Boolean as PropType<VxeIconPickerPropTypes.Disabled>,
66
- default: null
67
- },
68
- filterable: {
69
- type: Boolean as PropType<VxeIconPickerPropTypes.Filterable>,
70
- default: () => getConfig().iconPicker.filterable
71
- },
72
- filterConfig: Object as PropType<VxeIconPickerPropTypes.FilterConfig>,
73
- icons: Array as PropType<VxeIconPickerPropTypes.Icons>,
74
- placement: String as PropType<VxeIconPickerPropTypes.Placement>,
75
- popupConfig: Object as PropType<VxeIconPickerPropTypes.PopupConfig>,
76
- transfer: {
77
- type: Boolean as PropType<VxeIconPickerPropTypes.Transfer>,
78
- default: null
79
- },
80
- useScrollbar: {
81
- type: Boolean as PropType<VxeIconPickerPropTypes.UseScrollbar>,
82
- default: () => getDefVal(getConfig().iconPicker.useScrollbar, getConfig().useScrollbar)
83
- },
84
- scrollbarConfig: Object as PropType<VxeIconPickerPropTypes.ScrollbarConfig>
85
- },
86
- emits: [
87
- 'update:modelValue',
88
- 'change',
89
- 'clear',
90
- 'click'
91
- ] as VxeIconPickerEmits,
92
- setup (props, context) {
93
- const { emit } = context
94
-
95
- const $xeModal = inject<(VxeModalConstructor & VxeModalMethods) | null>('$xeModal', null)
96
- const $xeDrawer = inject<(VxeDrawerConstructor & VxeDrawerMethods) | null>('$xeDrawer', null)
97
- const $xeTable = inject<(VxeTableConstructor & VxeTablePrivateMethods) | null>('$xeTable', null)
98
- const $xeForm = inject<(VxeFormConstructor & VxeFormPrivateMethods) | null>('$xeForm', null)
99
- const formItemInfo = inject<VxeFormDefines.ProvideItemInfo | null>('xeFormItemInfo', null)
100
-
101
- const xID = XEUtils.uniqueId()
102
-
103
- const { computeSize } = useFns.useSize(props)
104
- const { computeIsVScrollbar } = useFns.useVScrollbar(props)
105
-
106
- const reactData = reactive(createReactData())
107
-
108
- const internalData = createInternalData()
109
-
110
- const refElem = ref<HTMLDivElement>()
111
- const refInput = ref<HTMLInputElement>()
112
- const refOptionPanel = ref<HTMLDivElement>()
113
-
114
- const refInpSearch = ref<VxeInputConstructor>()
115
-
116
- const refMaps: IconPickerPrivateRef = {
117
- refElem
118
- }
119
-
120
- const $xeIconPicker = {
121
- xID,
122
- props,
123
- context,
124
- reactData,
125
- getRefMaps: () => refMaps
126
- } as unknown as VxeIconPickerConstructor & VxeIconPickerMethods
127
-
128
- let iconPickerMethods = {} as IconPickerMethods
129
-
130
- const computeFormReadonly = computed(() => {
131
- const { readonly } = props
132
- if (readonly === null) {
133
- if ($xeForm) {
134
- return $xeForm.props.readonly
135
- }
136
- return false
137
- }
138
- return readonly
139
- })
140
-
141
- const computeIsDisabled = computed(() => {
142
- const { disabled } = props
143
- if (disabled === null) {
144
- if ($xeForm) {
145
- return $xeForm.props.disabled
146
- }
147
- return false
148
- }
149
- return disabled
150
- })
151
-
152
- const computeBtnTransfer = computed(() => {
153
- const { transfer } = props
154
- const popupOpts = computePopupOpts.value
155
- if (XEUtils.isBoolean(popupOpts.transfer)) {
156
- return popupOpts.transfer
157
- }
158
- if (transfer === null) {
159
- const globalTransfer = getConfig().iconPicker.transfer
160
- if (XEUtils.isBoolean(globalTransfer)) {
161
- return globalTransfer
162
- }
163
- if ($xeTable || $xeModal || $xeDrawer || $xeForm) {
164
- return true
165
- }
166
- }
167
- return transfer
168
- })
169
-
170
- const computeInpPlaceholder = computed(() => {
171
- const { placeholder } = props
172
- if (placeholder) {
173
- return getFuncText(placeholder)
174
- }
175
- const globalPlaceholder = getConfig().select.placeholder
176
- if (globalPlaceholder) {
177
- return getFuncText(globalPlaceholder)
178
- }
179
- return getI18n('vxe.base.pleaseSelect')
180
- })
181
-
182
- const computeCurrStyle = computed(() => {
183
- const { width } = props
184
- const stys: VxeComponentStyleType = {}
185
- if (width) {
186
- stys.width = toCssUnit(width)
187
- }
188
- return stys
189
- })
190
-
191
- const computeWrapperStyle = computed(() => {
192
- const popupOpts = computePopupOpts.value
193
- const { chunkSize, height, chunkWidth, maxHeight } = popupOpts
194
- const stys: VxeComponentStyleType = {
195
- '--vxe-ui-icon-picker-item-width': chunkWidth ? toCssUnit(chunkWidth) : `${100 / (chunkSize || 4)}%`
196
- }
197
- if (height) {
198
- stys['--vxe-ui-icon-picker-panel-height'] = toCssUnit(height)
199
- }
200
- if (maxHeight) {
201
- stys['--vxe-ui-icon-picker-panel-max-height'] = toCssUnit(maxHeight)
202
- }
203
- return stys
204
- })
205
-
206
- const computeIconList = computed<VxeIconPickerDefines.IconItemObj[]>(() => {
207
- let { icons } = props
208
- if (!icons || !icons.length) {
209
- icons = getConfig().iconPicker.icons || []
210
- }
211
- return icons.map(item => {
212
- if (XEUtils.isString(item)) {
213
- return {
214
- title: item,
215
- icon: `vxe-icon-${`${item || ''}`.replace(/^vxe-icon-/, '')}`
216
- }
217
- }
218
- return {
219
- title: `${item.title || ''}`,
220
- icon: item.icon || '',
221
- iconRender: item.iconRender
222
- }
223
- })
224
- })
225
-
226
- const computeFilterOpts = computed(() => {
227
- return Object.assign({}, getConfig().iconPicker.filterConfig, props.filterConfig)
228
- })
229
-
230
- const computePopupOpts = computed(() => {
231
- return Object.assign({}, getConfig().iconPicker.popupConfig, props.popupConfig)
232
- })
233
-
234
- const computeSelectIconItem = computed(() => {
235
- const { selectIcon } = reactData
236
- const iconList = computeIconList.value
237
- return selectIcon ? iconList.find(item => item.icon === selectIcon) : null
238
- })
239
-
240
- const computeScrollbarOpts = computed(() => {
241
- return Object.assign({}, getConfig().iconPicker.scrollbarConfig, props.scrollbarConfig)
242
- })
243
-
244
- const computeScrollbarProps = computed(() => {
245
- const scrollbarOpts = computeScrollbarOpts.value
246
- const { viewClassName, viewInnerClassName } = scrollbarOpts
247
- return {
248
- width: scrollbarOpts.width,
249
- height: scrollbarOpts.height,
250
- autoHide: scrollbarOpts.autoHide,
251
- visible: scrollbarOpts.visible,
252
- xConfig: scrollbarOpts.xConfig,
253
- yConfig: scrollbarOpts.yConfig,
254
- className: scrollbarOpts.className,
255
- viewAttrs: scrollbarOpts.viewAttrs,
256
- viewClassName: 'vxe-ico-picker--scrollbar-list-wrapper-view' + (viewClassName ? (' ' + viewClassName) : ''),
257
- viewInnerClassName: 'vxe-ico-picker--scrollbar-list-wrapper-inner' + (viewClassName ? (' ' + viewInnerClassName) : '')
258
- }
259
- })
260
-
261
- const updateZindex = () => {
262
- if (reactData.panelIndex < getLastZIndex()) {
263
- reactData.panelIndex = nextZIndex()
264
- }
265
- }
266
-
267
- const updatePlacement = () => {
268
- const { placement } = props
269
- const { panelIndex } = reactData
270
- const targetElem = refElem.value
271
- const panelElem = refOptionPanel.value
272
- const btnTransfer = computeBtnTransfer.value
273
- const popupOpts = computePopupOpts.value
274
- const { width } = popupOpts
275
- const handleStyle = () => {
276
- const ppObj = updatePanelPlacement(targetElem, panelElem, {
277
- placement: popupOpts.placement || placement,
278
- defaultPlacement: popupOpts.defaultPlacement,
279
- appendTo: popupOpts.appendTo,
280
- teleportTo: btnTransfer
281
- })
282
- const panelStyle: { [key: string]: string | number } = Object.assign(ppObj.style, {
283
- zIndex: panelIndex,
284
- minWidth: undefined
285
- })
286
- if (width) {
287
- Object.assign(panelStyle, {
288
- width: toCssUnit(width)
289
- })
290
- }
291
- reactData.panelStyle = panelStyle
292
- reactData.panelPlacement = ppObj.placement
293
- }
294
- handleStyle()
295
- return nextTick().then(handleStyle)
296
- }
297
-
298
- const showOptionPanel = () => {
299
- const { hpTimeout } = internalData
300
- const isDisabled = computeIsDisabled.value
301
- if (!isDisabled) {
302
- if (hpTimeout) {
303
- clearTimeout(hpTimeout)
304
- internalData.hpTimeout = undefined
305
- }
306
- if (!reactData.initialized) {
307
- reactData.initialized = true
308
- }
309
- reactData.isActivated = true
310
- reactData.isAniVisible = true
311
- setTimeout(() => {
312
- reactData.visiblePanel = true
313
- handleFocusSearch()
314
- updatePlacement()
315
- }, 10)
316
- updateZindex()
317
- updatePlacement()
318
- }
319
- }
320
-
321
- const hideOptionPanel = () => {
322
- reactData.visiblePanel = false
323
- internalData.hpTimeout = setTimeout(() => {
324
- reactData.isAniVisible = false
325
- }, 350)
326
- }
327
-
328
- const handleFocusSearch = () => {
329
- if (props.filterable) {
330
- nextTick(() => {
331
- const inpSearch = refInpSearch.value
332
- if (inpSearch) {
333
- inpSearch.focus()
334
- }
335
- })
336
- }
337
- }
338
-
339
- const handleData = () => {
340
- const { modelValue } = props
341
- const { searchValue } = reactData
342
- const filterOpts = computeFilterOpts.value
343
- const { filterMethod } = filterOpts
344
- const iconList = computeIconList.value
345
- let visibleList = iconList
346
- if (searchValue) {
347
- const searchTxt = `${searchValue}`.toLowerCase()
348
- visibleList = iconList.filter(item => {
349
- if (filterMethod) {
350
- return filterMethod({ option: item, value: modelValue, searchValue: searchTxt, $iconPicker: $xeIconPicker })
351
- }
352
- return (item.title && `${item.title}`.toLowerCase().indexOf(searchTxt) > -1) || (item.icon && `${item.icon}`.indexOf(searchTxt) > -1)
353
- })
354
- }
355
- reactData.iconList = visibleList
356
- }
357
-
358
- const changeEvent = (evnt: Event, selectValue: any) => {
359
- reactData.selectIcon = selectValue
360
- if (selectValue !== props.modelValue) {
361
- emit('update:modelValue', selectValue)
362
- dispatchEvent('change', { value: selectValue }, evnt)
363
- // 自动更新校验状态
364
- if ($xeForm && formItemInfo) {
365
- $xeForm.triggerItemEvent(evnt, formItemInfo.itemConfig.field, selectValue)
366
- }
367
- }
368
- }
369
-
370
- const focusEvent = () => {
371
- const isDisabled = computeIsDisabled.value
372
- if (!isDisabled) {
373
- if (!reactData.visiblePanel) {
374
- showOptionPanel()
375
- }
376
- }
377
- }
378
-
379
- const blurEvent = () => {
380
- reactData.isActivated = false
381
- }
382
-
383
- const clearValueEvent = (evnt: Event, selectValue: any) => {
384
- changeEvent(evnt, selectValue)
385
- dispatchEvent('clear', { value: selectValue }, evnt)
386
- }
387
-
388
- const clearEvent = (params: any, evnt: Event) => {
389
- clearValueEvent(evnt, null)
390
- hideOptionPanel()
391
- }
392
-
393
- const togglePanelEvent = (evnt: MouseEvent) => {
394
- evnt.preventDefault()
395
- if (reactData.visiblePanel) {
396
- hideOptionPanel()
397
- } else {
398
- showOptionPanel()
399
- }
400
- }
401
-
402
- const clickEvent = (evnt: MouseEvent) => {
403
- togglePanelEvent(evnt)
404
- dispatchEvent('click', {}, evnt)
405
- }
406
-
407
- const handleGlobalMousedownEvent = (evnt: MouseEvent) => {
408
- const { visiblePanel } = reactData
409
- const isDisabled = computeIsDisabled.value
410
- if (!isDisabled) {
411
- const el = refElem.value
412
- const panelElem = refOptionPanel.value
413
- reactData.isActivated = getEventTargetNode(evnt, el).flag || getEventTargetNode(evnt, panelElem).flag
414
- if (visiblePanel && !reactData.isActivated) {
415
- hideOptionPanel()
416
- }
417
- }
418
- }
419
-
420
- const handleGlobalKeydownEvent = (evnt: KeyboardEvent) => {
421
- const { clearable } = props
422
- const { visiblePanel } = reactData
423
- const isDisabled = computeIsDisabled.value
424
- if (!isDisabled) {
425
- const isTab = globalEvents.hasKey(evnt, GLOBAL_EVENT_KEYS.TAB)
426
- const isEnter = globalEvents.hasKey(evnt, GLOBAL_EVENT_KEYS.ENTER)
427
- const isEsc = globalEvents.hasKey(evnt, GLOBAL_EVENT_KEYS.ESCAPE)
428
- const isUpArrow = globalEvents.hasKey(evnt, GLOBAL_EVENT_KEYS.ARROW_UP)
429
- const isDwArrow = globalEvents.hasKey(evnt, GLOBAL_EVENT_KEYS.ARROW_DOWN)
430
- const isDel = globalEvents.hasKey(evnt, GLOBAL_EVENT_KEYS.DELETE)
431
- const isSpacebar = globalEvents.hasKey(evnt, GLOBAL_EVENT_KEYS.SPACEBAR)
432
- if (isTab) {
433
- reactData.isActivated = false
434
- }
435
- if (visiblePanel) {
436
- if (isEsc || isTab) {
437
- hideOptionPanel()
438
- } else if (isEnter) {
439
- evnt.preventDefault()
440
- evnt.stopPropagation()
441
- // changeOptionEvent(evnt, currentValue, currentOption)
442
- } else if (isUpArrow || isDwArrow) {
443
- evnt.preventDefault()
444
- // let { firstOption, offsetOption } = findOffsetOption(currentValue, isUpArrow)
445
- // if (!offsetOption && !findVisibleOption(currentValue)) {
446
- // offsetOption = firstOption
447
- // }
448
- // setCurrentOption(offsetOption)
449
- // scrollToOption(offsetOption, isDwArrow)
450
- } else if (isSpacebar) {
451
- evnt.preventDefault()
452
- }
453
- } else if ((isUpArrow || isDwArrow || isEnter || isSpacebar) && reactData.isActivated) {
454
- evnt.preventDefault()
455
- showOptionPanel()
456
- }
457
- if (reactData.isActivated) {
458
- if (isDel && clearable) {
459
- clearValueEvent(evnt, null)
460
- }
461
- }
462
- }
463
- }
464
-
465
- const handleGlobalBlurEvent = () => {
466
- const { visiblePanel, isActivated } = reactData
467
- if (visiblePanel) {
468
- hideOptionPanel()
469
- }
470
- if (isActivated) {
471
- reactData.isActivated = false
472
- }
473
- if (visiblePanel || isActivated) {
474
- const $input = refInput.value
475
- if ($input) {
476
- $input.blur()
477
- }
478
- }
479
- }
480
-
481
- const handleGlobalResizeEvent = () => {
482
- const { visiblePanel } = reactData
483
- if (visiblePanel) {
484
- updatePlacement()
485
- }
486
- }
487
-
488
- const handleGlobalScrollEvent = () => {
489
- const { visiblePanel } = reactData
490
- if (visiblePanel) {
491
- updatePlacement()
492
- }
493
- }
494
-
495
- const dispatchEvent = (type: ValueOf<VxeIconPickerEmits>, params: Record<string, any>, evnt: Event | null) => {
496
- emit(type, createEvent(evnt, { $iconPicker: $xeIconPicker }, params))
497
- }
498
-
499
- iconPickerMethods = {
500
- dispatchEvent,
501
- isPanelVisible () {
502
- return reactData.visiblePanel
503
- },
504
- togglePanel () {
505
- if (reactData.visiblePanel) {
506
- hideOptionPanel()
507
- } else {
508
- showOptionPanel()
509
- }
510
- return nextTick()
511
- },
512
- hidePanel () {
513
- if (reactData.visiblePanel) {
514
- hideOptionPanel()
515
- }
516
- return nextTick()
517
- },
518
- showPanel () {
519
- if (!reactData.visiblePanel) {
520
- showOptionPanel()
521
- }
522
- return nextTick()
523
- },
524
- focus () {
525
- const $input = refInput.value
526
- reactData.isActivated = true
527
- if ($input) {
528
- $input.blur()
529
- }
530
- return nextTick()
531
- },
532
- blur () {
533
- const $input = refInput.value
534
- if ($input) {
535
- $input.blur()
536
- }
537
- reactData.isActivated = false
538
- return nextTick()
539
- }
540
- }
541
-
542
- const handleClickIconEvent = (evnt: MouseEvent, item: VxeIconPickerDefines.IconItemObj) => {
543
- const value = item.icon
544
- changeEvent(evnt, value)
545
- hideOptionPanel()
546
- }
547
-
548
- const modelSearchEvent = (value: string) => {
549
- reactData.searchValue = value
550
- }
551
-
552
- const focusSearchEvent = () => {
553
- reactData.isActivated = true
554
- }
555
-
556
- const handleSearchEvent = () => {
557
- handleData()
558
- }
559
-
560
- const triggerSearchEvent = XEUtils.debounce(handleSearchEvent, 350, { trailing: true })
561
-
562
- Object.assign($xeIconPicker, iconPickerMethods)
563
-
564
- const renderIconWrapper = () => {
565
- const { showIconTitle } = props
566
- const { selectIcon, iconList } = reactData
567
- const isVScrollbar = computeIsVScrollbar.value
568
- const scrollbarProps = computeScrollbarProps.value
569
-
570
- if (!iconList.length) {
571
- return h('div', {
572
- class: 'vxe-ico-picker--empty-placeholder'
573
- }, getI18n('vxe.iconPicker.emptyText'))
574
- }
575
- const iconVNs = iconList.map(item => {
576
- const { iconRender } = item
577
- const compConf = iconRender ? renderer.get(iconRender.name) : null
578
- const iconMethod = compConf ? compConf.renderIconPickerOptionIcon : null
579
- return h('div', {
580
- class: ['vxe-ico-picker--item', {
581
- 'is--selected': selectIcon === item.icon
582
- }]
583
- }, [
584
- h('div', {
585
- class: 'vxe-ico-picker--item-inner',
586
- onClick (evnt) {
587
- const isDisabled = computeIsDisabled.value
588
- if (!isDisabled) {
589
- handleClickIconEvent(evnt, item)
590
- }
591
- }
592
- }, [
593
- h('div', {
594
- class: 'vxe-ico-picker--item-icon'
595
- }, iconMethod && iconRender
596
- ? getSlotVNs(iconMethod(iconRender, { $iconPicker: $xeIconPicker, option: item }))
597
- : [
598
- h('i', {
599
- class: item.icon || ''
600
- })
601
- ]),
602
- showIconTitle
603
- ? h('div', {
604
- class: 'vxe-ico-picker--item-title'
605
- }, `${item.title || ''}`)
606
- : renderEmptyElement($xeIconPicker)
607
- ])
608
- ])
609
- })
610
- if (isVScrollbar) {
611
- return h(VxeScrollbarComponent, {
612
- class: 'vxe-ico-picker--scrollbar-list-wrapper',
613
- ...scrollbarProps
614
- }, {
615
- default: () => iconVNs
616
- })
617
- }
618
- return h('div', {
619
- class: 'vxe-ico-picker--list-wrapper'
620
- }, [
621
- h('div', {
622
- class: 'vxe-ico-picker--list'
623
- }, iconVNs)
624
- ])
625
- }
626
-
627
- const renderIconView = () => {
628
- const { selectIcon } = reactData
629
- const selectIconItem = computeSelectIconItem.value
630
- if (selectIconItem) {
631
- const { iconRender } = selectIconItem
632
- const compConf = iconRender ? renderer.get(iconRender.name) : null
633
- const oIconMethod = compConf ? compConf.renderIconPickerOptionIcon : null
634
- if (oIconMethod && iconRender) {
635
- return h('div', {
636
- key: 'inc',
637
- class: 'vxe-ico-picker--icon'
638
- }, getSlotVNs(oIconMethod(iconRender, { $iconPicker: $xeIconPicker, option: selectIconItem })))
639
- }
640
- }
641
- return h('div', {
642
- key: 'ind',
643
- class: 'vxe-ico-picker--icon'
644
- }, [
645
- h('i', {
646
- class: selectIcon
647
- })
648
- ])
649
- }
650
-
651
- const renderVN = () => {
652
- const { className, clearable, filterable } = props
653
- const { initialized, isActivated, isAniVisible, visiblePanel, selectIcon } = reactData
654
- const vSize = computeSize.value
655
- const isDisabled = computeIsDisabled.value
656
- const btnTransfer = computeBtnTransfer.value
657
- const formReadonly = computeFormReadonly.value
658
-
659
- if (formReadonly) {
660
- return h('div', {
661
- ref: refElem,
662
- class: ['vxe-ico-picker--readonly', className]
663
- }, [
664
- h('i', {
665
- class: selectIcon
666
- })
667
- ])
668
- }
669
- const currStyle = computeCurrStyle.value
670
- const inpPlaceholder = computeInpPlaceholder.value
671
- const wrapperStyle = computeWrapperStyle.value
672
- const popupOpts = computePopupOpts.value
673
- const { appendTo } = popupOpts
674
- const ppClassName = popupOpts.className || props.popupClassName
675
- return h('div', {
676
- ref: refElem,
677
- class: ['vxe-ico-picker', className ? (XEUtils.isFunction(className) ? className({ $iconPicker: $xeIconPicker }) : className) : '', {
678
- [`size--${vSize}`]: vSize,
679
- 'show--clear': clearable && !isDisabled && !!selectIcon,
680
- 'is--visible': visiblePanel,
681
- 'is--disabled': isDisabled,
682
- 'is--active': isActivated
683
- }],
684
- style: currStyle
685
- }, [
686
- h('div', {
687
- class: 'vxe-ico-picker--inner',
688
- onClick: clickEvent
689
- }, [
690
- h('input', {
691
- ref: refInput,
692
- class: 'vxe-ico-picker--input',
693
- onFocus: focusEvent,
694
- onBlur: blurEvent
695
- }),
696
- selectIcon
697
- ? renderIconView()
698
- : h('div', {
699
- class: 'vxe-ico-picker--placeholder'
700
- }, inpPlaceholder),
701
- h('div', {
702
- class: 'vxe-ico-picker--suffix'
703
- }, [
704
- h('div', {
705
- class: 'vxe-ico-picker--clear-icon',
706
- onClick: clearEvent
707
- }, [
708
- h('i', {
709
- class: getIcon().INPUT_CLEAR
710
- })
711
- ]),
712
- h('div', {
713
- class: 'vxe-ico-picker--suffix-icon'
714
- }, [
715
- h('i', {
716
- class: visiblePanel ? getIcon().ICON_PICKER_OPEN : getIcon().ICON_PICKER_CLOSE
717
- })
718
- ])
719
- ])
720
- ]),
721
- h(Teleport, {
722
- to: getPopupContainer(appendTo),
723
- disabled: btnTransfer ? !initialized : true
724
- }, [
725
- h('div', {
726
- ref: refOptionPanel,
727
- class: ['vxe-table--ignore-clear vxe-ico-picker--panel', ppClassName ? (XEUtils.isFunction(ppClassName) ? ppClassName({ $iconPicker: $xeIconPicker }) : ppClassName) : '', {
728
- [`size--${vSize}`]: vSize,
729
- 'is--transfer': btnTransfer,
730
- 'ani--leave': isAniVisible,
731
- 'ani--enter': visiblePanel
732
- }],
733
- placement: reactData.panelPlacement,
734
- style: reactData.panelStyle
735
- }, [
736
- initialized && (visiblePanel || isAniVisible)
737
- ? h('div', {
738
- class: 'vxe-ico-picker--panel-wrapper',
739
- style: wrapperStyle
740
- }, [
741
- filterable
742
- ? h('div', {
743
- class: 'vxe-ico-picker--panel-search'
744
- }, [
745
- h(VxeInputComponent, {
746
- ref: refInpSearch,
747
- class: 'vxe-ico-picker-search--input',
748
- modelValue: reactData.searchValue,
749
- type: 'text',
750
- clearable: true,
751
- disabled: false,
752
- readonly: false,
753
- placeholder: getI18n('vxe.iconPicker.search'),
754
- prefixIcon: getIcon().INPUT_SEARCH,
755
- 'onUpdate:modelValue': modelSearchEvent,
756
- onFocus: focusSearchEvent,
757
- onChange: triggerSearchEvent,
758
- onSearch: triggerSearchEvent
759
- })
760
- ])
761
- : renderEmptyElement($xeIconPicker),
762
- renderIconWrapper()
763
- ])
764
- : renderEmptyElement($xeIconPicker)
765
- ])
766
- ])
767
- ])
768
- }
769
-
770
- reactData.selectIcon = `${props.modelValue || ''}`
771
- handleData()
772
-
773
- watch(() => props.modelValue, (val) => {
774
- reactData.selectIcon = `${val || ''}`
775
- })
776
-
777
- watch(computeIconList, () => {
778
- handleData()
779
- })
780
-
781
- onMounted(() => {
782
- globalEvents.on($xeIconPicker, 'mousedown', handleGlobalMousedownEvent)
783
- globalEvents.on($xeIconPicker, 'keydown', handleGlobalKeydownEvent)
784
- globalEvents.on($xeIconPicker, 'blur', handleGlobalBlurEvent)
785
- globalEvents.on($xeIconPicker, 'resize', handleGlobalResizeEvent)
786
- globalEvents.on($xeIconPicker, 'scroll', handleGlobalScrollEvent)
787
- })
788
-
789
- onBeforeUnmount(() => {
790
- globalEvents.off($xeIconPicker, 'mousewheel')
791
- globalEvents.off($xeIconPicker, 'mousedown')
792
- globalEvents.off($xeIconPicker, 'keydown')
793
- globalEvents.off($xeIconPicker, 'blur')
794
- globalEvents.off($xeIconPicker, 'resize')
795
- globalEvents.off($xeIconPicker, 'scroll')
796
- XEUtils.assign(reactData, createReactData())
797
- XEUtils.assign(internalData, createInternalData())
798
- })
799
-
800
- provide('$xeIconPicker', $xeIconPicker)
801
-
802
- $xeIconPicker.renderVN = renderVN
803
-
804
- return $xeIconPicker
805
- },
806
- render () {
807
- return this.renderVN()
808
- }
809
- })
1
+ import { h, Teleport, PropType, ref, inject, watch, computed, provide, onBeforeUnmount, reactive, nextTick, onMounted } from 'vue'
2
+ import { defineVxeComponent } from '../../ui/src/comp'
3
+ import XEUtils from 'xe-utils'
4
+ import { VxeUI } from '@vxe-ui/core'
5
+ import { getEventTargetNode, getPopupContainer, toCssUnit, updatePanelPlacement } from '../../ui/src/dom'
6
+ import { getLastZIndex, nextZIndex, getFuncText } from '../../ui/src/utils'
7
+ import { getSlotVNs } from '../../ui/src/vn'
8
+ import VxeInputComponent from '../../input'
9
+ import VxeScrollbarComponent from '../../scrollbar'
10
+
11
+ import type {
12
+ VxeIconPickerPropTypes,
13
+ VxeIconPickerConstructor,
14
+ IconPickerInternalData,
15
+ VxeInputConstructor,
16
+ ValueOf,
17
+ IconPickerReactData,
18
+ VxeIconPickerEmits,
19
+ IconPickerMethods,
20
+ IconPickerPrivateRef,
21
+ VxeIconPickerMethods,
22
+ VxeIconPickerDefines,
23
+ VxeDrawerConstructor,
24
+ VxeDrawerMethods,
25
+ VxeFormDefines,
26
+ VxeFormConstructor,
27
+ VxeFormPrivateMethods,
28
+ VxeModalConstructor,
29
+ VxeModalMethods,
30
+ VxeComponentStyleType
31
+ } from '../../../types'
32
+ import type { VxeTableConstructor, VxeTablePrivateMethods } from '../../../types/components/table'
33
+
34
+ const { getConfig, getIcon, getI18n, baseUtils, globalEvents, createEvent, renderer, useFns, GLOBAL_EVENT_KEYS, renderEmptyElement } = VxeUI
35
+ const { getDefVal } = baseUtils
36
+
37
+ function createReactData(): IconPickerReactData {
38
+ return {
39
+ initialized: false,
40
+ selectIcon: '',
41
+ panelIndex: 0,
42
+ panelStyle: {},
43
+ panelPlacement: null,
44
+ visiblePanel: false,
45
+ isAniVisible: false,
46
+ isActivated: false,
47
+ searchValue: '',
48
+ iconList: []
49
+ }
50
+ }
51
+
52
+ function createInternalData(): IconPickerInternalData {
53
+ return {
54
+ fullList: []
55
+ // hpTimeout: undefined
56
+ }
57
+ }
58
+
59
+ export default defineVxeComponent({
60
+ name: 'VxeIconPicker',
61
+ props: {
62
+ modelValue: String as PropType<VxeIconPickerPropTypes.ModelValue>,
63
+ placeholder: String as PropType<VxeIconPickerPropTypes.Placeholder>,
64
+ clearable: Boolean as PropType<VxeIconPickerPropTypes.Clearable>,
65
+ size: {
66
+ type: String as PropType<VxeIconPickerPropTypes.Size>,
67
+ default: () => getConfig().iconPicker.size || getConfig().size
68
+ },
69
+ className: [String, Function] as PropType<VxeIconPickerPropTypes.ClassName>,
70
+ /**
71
+ * 已废弃,请使用 popupConfig.className
72
+ * @deprecated
73
+ */
74
+ popupClassName: [String, Function] as PropType<VxeIconPickerPropTypes.PopupClassName>,
75
+ width: [Number, String] as PropType<VxeIconPickerPropTypes.Width>,
76
+ showIconTitle: {
77
+ type: Boolean as PropType<VxeIconPickerPropTypes.ShowIconTitle>,
78
+ default: () => getConfig().iconPicker.showIconTitle
79
+ },
80
+ readonly: {
81
+ type: Boolean as PropType<VxeIconPickerPropTypes.Readonly>,
82
+ default: null
83
+ },
84
+ disabled: {
85
+ type: Boolean as PropType<VxeIconPickerPropTypes.Disabled>,
86
+ default: null
87
+ },
88
+ filterable: {
89
+ type: Boolean as PropType<VxeIconPickerPropTypes.Filterable>,
90
+ default: () => getConfig().iconPicker.filterable
91
+ },
92
+ filterConfig: Object as PropType<VxeIconPickerPropTypes.FilterConfig>,
93
+ icons: Array as PropType<VxeIconPickerPropTypes.Icons>,
94
+ placement: String as PropType<VxeIconPickerPropTypes.Placement>,
95
+ popupConfig: Object as PropType<VxeIconPickerPropTypes.PopupConfig>,
96
+ transfer: {
97
+ type: Boolean as PropType<VxeIconPickerPropTypes.Transfer>,
98
+ default: null
99
+ },
100
+ useScrollbar: {
101
+ type: Boolean as PropType<VxeIconPickerPropTypes.UseScrollbar>,
102
+ default: () => getDefVal(getConfig().iconPicker.useScrollbar, getConfig().useScrollbar)
103
+ },
104
+ scrollbarConfig: Object as PropType<VxeIconPickerPropTypes.ScrollbarConfig>
105
+ },
106
+ emits: ['update:modelValue', 'change', 'clear', 'click'] as VxeIconPickerEmits,
107
+ setup(props, context) {
108
+ const { emit } = context
109
+
110
+ const $xeModal = inject<(VxeModalConstructor & VxeModalMethods) | null>('$xeModal', null)
111
+ const $xeDrawer = inject<(VxeDrawerConstructor & VxeDrawerMethods) | null>('$xeDrawer', null)
112
+ const $xeTable = inject<(VxeTableConstructor & VxeTablePrivateMethods) | null>('$xeTable', null)
113
+ const $xeForm = inject<(VxeFormConstructor & VxeFormPrivateMethods) | null>('$xeForm', null)
114
+ const formItemInfo = inject<VxeFormDefines.ProvideItemInfo | null>('xeFormItemInfo', null)
115
+
116
+ const xID = XEUtils.uniqueId()
117
+
118
+ const { computeSize } = useFns.useSize(props)
119
+ const { computeIsVScrollbar } = useFns.useVScrollbar(props)
120
+
121
+ const reactData = reactive(createReactData())
122
+
123
+ const internalData = createInternalData()
124
+
125
+ const refElem = ref<HTMLDivElement>()
126
+ const refInput = ref<HTMLInputElement>()
127
+ const refOptionPanel = ref<HTMLDivElement>()
128
+
129
+ const refInpSearch = ref<VxeInputConstructor>()
130
+
131
+ const refMaps: IconPickerPrivateRef = {
132
+ refElem
133
+ }
134
+
135
+ const $xeIconPicker = {
136
+ xID,
137
+ props,
138
+ context,
139
+ reactData,
140
+ getRefMaps: () => refMaps
141
+ } as unknown as VxeIconPickerConstructor & VxeIconPickerMethods
142
+
143
+ let iconPickerMethods = {} as IconPickerMethods
144
+
145
+ const computeFormReadonly = computed(() => {
146
+ const { readonly } = props
147
+ if (readonly === null) {
148
+ if ($xeForm) {
149
+ return $xeForm.props.readonly
150
+ }
151
+ return false
152
+ }
153
+ return readonly
154
+ })
155
+
156
+ const computeIsDisabled = computed(() => {
157
+ const { disabled } = props
158
+ if (disabled === null) {
159
+ if ($xeForm) {
160
+ return $xeForm.props.disabled
161
+ }
162
+ return false
163
+ }
164
+ return disabled
165
+ })
166
+
167
+ const computeBtnTransfer = computed(() => {
168
+ const { transfer } = props
169
+ const popupOpts = computePopupOpts.value
170
+ if (XEUtils.isBoolean(popupOpts.transfer)) {
171
+ return popupOpts.transfer
172
+ }
173
+ if (transfer === null) {
174
+ const globalTransfer = getConfig().iconPicker.transfer
175
+ if (XEUtils.isBoolean(globalTransfer)) {
176
+ return globalTransfer
177
+ }
178
+ if ($xeTable || $xeModal || $xeDrawer || $xeForm) {
179
+ return true
180
+ }
181
+ }
182
+ return transfer
183
+ })
184
+
185
+ const computeInpPlaceholder = computed(() => {
186
+ const { placeholder } = props
187
+ if (placeholder) {
188
+ return getFuncText(placeholder)
189
+ }
190
+ const globalPlaceholder = getConfig().select.placeholder
191
+ if (globalPlaceholder) {
192
+ return getFuncText(globalPlaceholder)
193
+ }
194
+ return getI18n('vxe.base.pleaseSelect')
195
+ })
196
+
197
+ const computeCurrStyle = computed(() => {
198
+ const { width } = props
199
+ const stys: VxeComponentStyleType = {}
200
+ if (width) {
201
+ stys.width = toCssUnit(width)
202
+ }
203
+ return stys
204
+ })
205
+
206
+ const computeWrapperStyle = computed(() => {
207
+ const popupOpts = computePopupOpts.value
208
+ const { chunkSize, height, chunkWidth, maxHeight } = popupOpts
209
+ const stys: VxeComponentStyleType = {
210
+ '--vxe-ui-icon-picker-item-width': chunkWidth ? toCssUnit(chunkWidth) : `${100 / (chunkSize || 4)}%`
211
+ }
212
+ if (height) {
213
+ stys['--vxe-ui-icon-picker-panel-height'] = toCssUnit(height)
214
+ }
215
+ if (maxHeight) {
216
+ stys['--vxe-ui-icon-picker-panel-max-height'] = toCssUnit(maxHeight)
217
+ }
218
+ return stys
219
+ })
220
+
221
+ const computeIconList = computed<VxeIconPickerDefines.IconItemObj[]>(() => {
222
+ let { icons } = props
223
+ if (!icons || !icons.length) {
224
+ icons = getConfig().iconPicker.icons || []
225
+ }
226
+ return icons.map((item) => {
227
+ if (XEUtils.isString(item)) {
228
+ return {
229
+ title: item,
230
+ icon: `vxe-icon-${`${item || ''}`.replace(/^vxe-icon-/, '')}`
231
+ }
232
+ }
233
+ return {
234
+ title: `${item.title || ''}`,
235
+ icon: item.icon || '',
236
+ iconRender: item.iconRender
237
+ }
238
+ })
239
+ })
240
+
241
+ const computeFilterOpts = computed(() => {
242
+ return Object.assign({}, getConfig().iconPicker.filterConfig, props.filterConfig)
243
+ })
244
+
245
+ const computePopupOpts = computed(() => {
246
+ return Object.assign({}, getConfig().iconPicker.popupConfig, props.popupConfig)
247
+ })
248
+
249
+ const computeSelectIconItem = computed(() => {
250
+ const { selectIcon } = reactData
251
+ const iconList = computeIconList.value
252
+ return selectIcon ? iconList.find((item) => item.icon === selectIcon) : null
253
+ })
254
+
255
+ const computeScrollbarOpts = computed(() => {
256
+ return Object.assign({}, getConfig().iconPicker.scrollbarConfig, props.scrollbarConfig)
257
+ })
258
+
259
+ const computeScrollbarProps = computed(() => {
260
+ const scrollbarOpts = computeScrollbarOpts.value
261
+ const { viewClassName, viewInnerClassName } = scrollbarOpts
262
+ return {
263
+ width: scrollbarOpts.width,
264
+ height: scrollbarOpts.height,
265
+ autoHide: scrollbarOpts.autoHide,
266
+ visible: scrollbarOpts.visible,
267
+ xConfig: scrollbarOpts.xConfig,
268
+ yConfig: scrollbarOpts.yConfig,
269
+ className: scrollbarOpts.className,
270
+ viewAttrs: scrollbarOpts.viewAttrs,
271
+ viewClassName: 'vxe-ico-picker--scrollbar-list-wrapper-view' + (viewClassName ? ' ' + viewClassName : ''),
272
+ viewInnerClassName: 'vxe-ico-picker--scrollbar-list-wrapper-inner' + (viewClassName ? ' ' + viewInnerClassName : '')
273
+ }
274
+ })
275
+
276
+ const updateZindex = () => {
277
+ if (reactData.panelIndex < getLastZIndex()) {
278
+ reactData.panelIndex = nextZIndex()
279
+ }
280
+ }
281
+
282
+ const updatePlacement = () => {
283
+ const { placement } = props
284
+ const { panelIndex } = reactData
285
+ const targetElem = refElem.value
286
+ const panelElem = refOptionPanel.value
287
+ const btnTransfer = computeBtnTransfer.value
288
+ const popupOpts = computePopupOpts.value
289
+ const { width } = popupOpts
290
+ const handleStyle = () => {
291
+ const ppObj = updatePanelPlacement(targetElem, panelElem, {
292
+ placement: popupOpts.placement || placement,
293
+ defaultPlacement: popupOpts.defaultPlacement,
294
+ appendTo: popupOpts.appendTo,
295
+ teleportTo: btnTransfer
296
+ })
297
+ const panelStyle: { [key: string]: string | number } = Object.assign(ppObj.style, {
298
+ zIndex: panelIndex,
299
+ minWidth: undefined
300
+ })
301
+ if (width) {
302
+ Object.assign(panelStyle, {
303
+ width: toCssUnit(width)
304
+ })
305
+ }
306
+ reactData.panelStyle = panelStyle
307
+ reactData.panelPlacement = ppObj.placement
308
+ }
309
+ handleStyle()
310
+ return nextTick().then(handleStyle)
311
+ }
312
+
313
+ const showOptionPanel = () => {
314
+ const { hpTimeout } = internalData
315
+ const isDisabled = computeIsDisabled.value
316
+ if (!isDisabled) {
317
+ if (hpTimeout) {
318
+ clearTimeout(hpTimeout)
319
+ internalData.hpTimeout = undefined
320
+ }
321
+ if (!reactData.initialized) {
322
+ reactData.initialized = true
323
+ }
324
+ reactData.isActivated = true
325
+ reactData.isAniVisible = true
326
+ setTimeout(() => {
327
+ reactData.visiblePanel = true
328
+ handleFocusSearch()
329
+ updatePlacement()
330
+ }, 10)
331
+ updateZindex()
332
+ updatePlacement()
333
+ }
334
+ }
335
+
336
+ const hideOptionPanel = () => {
337
+ reactData.visiblePanel = false
338
+ internalData.hpTimeout = setTimeout(() => {
339
+ reactData.isAniVisible = false
340
+ }, 350)
341
+ }
342
+
343
+ const handleFocusSearch = () => {
344
+ if (props.filterable) {
345
+ nextTick(() => {
346
+ const inpSearch = refInpSearch.value
347
+ if (inpSearch) {
348
+ inpSearch.focus()
349
+ }
350
+ })
351
+ }
352
+ }
353
+
354
+ const handleData = () => {
355
+ const { modelValue } = props
356
+ const { searchValue } = reactData
357
+ const filterOpts = computeFilterOpts.value
358
+ const { filterMethod } = filterOpts
359
+ const iconList = computeIconList.value
360
+ let visibleList = iconList
361
+ if (searchValue) {
362
+ const searchTxt = `${searchValue}`.toLowerCase()
363
+ visibleList = iconList.filter((item) => {
364
+ if (filterMethod) {
365
+ return filterMethod({ option: item, value: modelValue, searchValue: searchTxt, $iconPicker: $xeIconPicker })
366
+ }
367
+ return (item.title && `${item.title}`.toLowerCase().indexOf(searchTxt) > -1) || (item.icon && `${item.icon}`.indexOf(searchTxt) > -1)
368
+ })
369
+ }
370
+ reactData.iconList = visibleList
371
+ }
372
+
373
+ const changeEvent = (evnt: Event, selectValue: any) => {
374
+ reactData.selectIcon = selectValue
375
+ if (selectValue !== props.modelValue) {
376
+ emit('update:modelValue', selectValue)
377
+ dispatchEvent('change', { value: selectValue }, evnt)
378
+ // 自动更新校验状态
379
+ if ($xeForm && formItemInfo) {
380
+ $xeForm.triggerItemEvent(evnt, formItemInfo.itemConfig.field, selectValue)
381
+ }
382
+ }
383
+ }
384
+
385
+ const focusEvent = () => {
386
+ const isDisabled = computeIsDisabled.value
387
+ if (!isDisabled) {
388
+ if (!reactData.visiblePanel) {
389
+ showOptionPanel()
390
+ }
391
+ }
392
+ }
393
+
394
+ const blurEvent = () => {
395
+ reactData.isActivated = false
396
+ }
397
+
398
+ const clearValueEvent = (evnt: Event, selectValue: any) => {
399
+ changeEvent(evnt, selectValue)
400
+ dispatchEvent('clear', { value: selectValue }, evnt)
401
+ }
402
+
403
+ const clearEvent = (params: any, evnt: Event) => {
404
+ clearValueEvent(evnt, null)
405
+ hideOptionPanel()
406
+ }
407
+
408
+ const togglePanelEvent = (evnt: MouseEvent) => {
409
+ evnt.preventDefault()
410
+ if (reactData.visiblePanel) {
411
+ hideOptionPanel()
412
+ } else {
413
+ showOptionPanel()
414
+ }
415
+ }
416
+
417
+ const clickEvent = (evnt: MouseEvent) => {
418
+ togglePanelEvent(evnt)
419
+ dispatchEvent('click', {}, evnt)
420
+ }
421
+
422
+ const handleGlobalMousedownEvent = (evnt: MouseEvent) => {
423
+ const { visiblePanel } = reactData
424
+ const isDisabled = computeIsDisabled.value
425
+ if (!isDisabled) {
426
+ const el = refElem.value
427
+ const panelElem = refOptionPanel.value
428
+ reactData.isActivated = getEventTargetNode(evnt, el).flag || getEventTargetNode(evnt, panelElem).flag
429
+ if (visiblePanel && !reactData.isActivated) {
430
+ hideOptionPanel()
431
+ }
432
+ }
433
+ }
434
+
435
+ const handleGlobalKeydownEvent = (evnt: KeyboardEvent) => {
436
+ const { clearable } = props
437
+ const { visiblePanel } = reactData
438
+ const isDisabled = computeIsDisabled.value
439
+ if (!isDisabled) {
440
+ const isTab = globalEvents.hasKey(evnt, GLOBAL_EVENT_KEYS.TAB)
441
+ const isEnter = globalEvents.hasKey(evnt, GLOBAL_EVENT_KEYS.ENTER)
442
+ const isEsc = globalEvents.hasKey(evnt, GLOBAL_EVENT_KEYS.ESCAPE)
443
+ const isUpArrow = globalEvents.hasKey(evnt, GLOBAL_EVENT_KEYS.ARROW_UP)
444
+ const isDwArrow = globalEvents.hasKey(evnt, GLOBAL_EVENT_KEYS.ARROW_DOWN)
445
+ const isDel = globalEvents.hasKey(evnt, GLOBAL_EVENT_KEYS.DELETE)
446
+ const isSpacebar = globalEvents.hasKey(evnt, GLOBAL_EVENT_KEYS.SPACEBAR)
447
+ if (isTab) {
448
+ reactData.isActivated = false
449
+ }
450
+ if (visiblePanel) {
451
+ if (isEsc || isTab) {
452
+ hideOptionPanel()
453
+ } else if (isEnter) {
454
+ evnt.preventDefault()
455
+ evnt.stopPropagation()
456
+ // changeOptionEvent(evnt, currentValue, currentOption)
457
+ } else if (isUpArrow || isDwArrow) {
458
+ evnt.preventDefault()
459
+ // let { firstOption, offsetOption } = findOffsetOption(currentValue, isUpArrow)
460
+ // if (!offsetOption && !findVisibleOption(currentValue)) {
461
+ // offsetOption = firstOption
462
+ // }
463
+ // setCurrentOption(offsetOption)
464
+ // scrollToOption(offsetOption, isDwArrow)
465
+ } else if (isSpacebar) {
466
+ evnt.preventDefault()
467
+ }
468
+ } else if ((isUpArrow || isDwArrow || isEnter || isSpacebar) && reactData.isActivated) {
469
+ evnt.preventDefault()
470
+ showOptionPanel()
471
+ }
472
+ if (reactData.isActivated) {
473
+ if (isDel && clearable) {
474
+ clearValueEvent(evnt, null)
475
+ }
476
+ }
477
+ }
478
+ }
479
+
480
+ const handleGlobalBlurEvent = () => {
481
+ const { visiblePanel, isActivated } = reactData
482
+ if (visiblePanel) {
483
+ hideOptionPanel()
484
+ }
485
+ if (isActivated) {
486
+ reactData.isActivated = false
487
+ }
488
+ if (visiblePanel || isActivated) {
489
+ const $input = refInput.value
490
+ if ($input) {
491
+ $input.blur()
492
+ }
493
+ }
494
+ }
495
+
496
+ const handleGlobalResizeEvent = () => {
497
+ const { visiblePanel } = reactData
498
+ if (visiblePanel) {
499
+ updatePlacement()
500
+ }
501
+ }
502
+
503
+ const handleGlobalScrollEvent = () => {
504
+ const { visiblePanel } = reactData
505
+ if (visiblePanel) {
506
+ updatePlacement()
507
+ }
508
+ }
509
+
510
+ const dispatchEvent = (type: ValueOf<VxeIconPickerEmits>, params: Record<string, any>, evnt: Event | null) => {
511
+ emit(type, createEvent(evnt, { $iconPicker: $xeIconPicker }, params))
512
+ }
513
+
514
+ iconPickerMethods = {
515
+ dispatchEvent,
516
+ isPanelVisible() {
517
+ return reactData.visiblePanel
518
+ },
519
+ togglePanel() {
520
+ if (reactData.visiblePanel) {
521
+ hideOptionPanel()
522
+ } else {
523
+ showOptionPanel()
524
+ }
525
+ return nextTick()
526
+ },
527
+ hidePanel() {
528
+ if (reactData.visiblePanel) {
529
+ hideOptionPanel()
530
+ }
531
+ return nextTick()
532
+ },
533
+ showPanel() {
534
+ if (!reactData.visiblePanel) {
535
+ showOptionPanel()
536
+ }
537
+ return nextTick()
538
+ },
539
+ focus() {
540
+ const $input = refInput.value
541
+ reactData.isActivated = true
542
+ if ($input) {
543
+ $input.blur()
544
+ }
545
+ return nextTick()
546
+ },
547
+ blur() {
548
+ const $input = refInput.value
549
+ if ($input) {
550
+ $input.blur()
551
+ }
552
+ reactData.isActivated = false
553
+ return nextTick()
554
+ }
555
+ }
556
+
557
+ const handleClickIconEvent = (evnt: MouseEvent, item: VxeIconPickerDefines.IconItemObj) => {
558
+ const value = item.icon
559
+ changeEvent(evnt, value)
560
+ hideOptionPanel()
561
+ }
562
+
563
+ const modelSearchEvent = (value: string) => {
564
+ reactData.searchValue = value
565
+ }
566
+
567
+ const focusSearchEvent = () => {
568
+ reactData.isActivated = true
569
+ }
570
+
571
+ const handleSearchEvent = () => {
572
+ handleData()
573
+ }
574
+
575
+ const triggerSearchEvent = XEUtils.debounce(handleSearchEvent, 350, { trailing: true })
576
+
577
+ Object.assign($xeIconPicker, iconPickerMethods)
578
+
579
+ const renderIconWrapper = () => {
580
+ const { showIconTitle } = props
581
+ const { selectIcon, iconList } = reactData
582
+ const isVScrollbar = computeIsVScrollbar.value
583
+ const scrollbarProps = computeScrollbarProps.value
584
+
585
+ if (!iconList.length) {
586
+ return h(
587
+ 'div',
588
+ {
589
+ class: 'vxe-ico-picker--empty-placeholder'
590
+ },
591
+ getI18n('vxe.iconPicker.emptyText')
592
+ )
593
+ }
594
+ const iconVNs = iconList.map((item) => {
595
+ const { iconRender } = item
596
+ const compConf = iconRender ? renderer.get(iconRender.name) : null
597
+ const iconMethod = compConf ? compConf.renderIconPickerOptionIcon : null
598
+ return h(
599
+ 'div',
600
+ {
601
+ class: [
602
+ 'vxe-ico-picker--item',
603
+ {
604
+ 'is--selected': selectIcon === item.icon
605
+ }
606
+ ]
607
+ },
608
+ [
609
+ h(
610
+ 'div',
611
+ {
612
+ class: 'vxe-ico-picker--item-inner',
613
+ onClick(evnt) {
614
+ const isDisabled = computeIsDisabled.value
615
+ if (!isDisabled) {
616
+ handleClickIconEvent(evnt, item)
617
+ }
618
+ }
619
+ },
620
+ [
621
+ h(
622
+ 'div',
623
+ {
624
+ class: 'vxe-ico-picker--item-icon'
625
+ },
626
+ iconMethod && iconRender
627
+ ? getSlotVNs(iconMethod(iconRender, { $iconPicker: $xeIconPicker, option: item }))
628
+ : [
629
+ h('i', {
630
+ class: item.icon || ''
631
+ })
632
+ ]
633
+ ),
634
+ showIconTitle
635
+ ? h(
636
+ 'div',
637
+ {
638
+ class: 'vxe-ico-picker--item-title'
639
+ },
640
+ `${item.title || ''}`
641
+ )
642
+ : renderEmptyElement($xeIconPicker)
643
+ ]
644
+ )
645
+ ]
646
+ )
647
+ })
648
+ if (isVScrollbar) {
649
+ return h(
650
+ VxeScrollbarComponent,
651
+ {
652
+ class: 'vxe-ico-picker--scrollbar-list-wrapper',
653
+ ...scrollbarProps
654
+ },
655
+ {
656
+ default: () => iconVNs
657
+ }
658
+ )
659
+ }
660
+ return h(
661
+ 'div',
662
+ {
663
+ class: 'vxe-ico-picker--list-wrapper'
664
+ },
665
+ [
666
+ h(
667
+ 'div',
668
+ {
669
+ class: 'vxe-ico-picker--list'
670
+ },
671
+ iconVNs
672
+ )
673
+ ]
674
+ )
675
+ }
676
+
677
+ const renderIconView = () => {
678
+ const { selectIcon } = reactData
679
+ const selectIconItem = computeSelectIconItem.value
680
+ if (selectIconItem) {
681
+ const { iconRender } = selectIconItem
682
+ const compConf = iconRender ? renderer.get(iconRender.name) : null
683
+ const oIconMethod = compConf ? compConf.renderIconPickerOptionIcon : null
684
+ if (oIconMethod && iconRender) {
685
+ return h(
686
+ 'div',
687
+ {
688
+ key: 'inc',
689
+ class: 'vxe-ico-picker--icon'
690
+ },
691
+ getSlotVNs(oIconMethod(iconRender, { $iconPicker: $xeIconPicker, option: selectIconItem }))
692
+ )
693
+ }
694
+ }
695
+ return h(
696
+ 'div',
697
+ {
698
+ key: 'ind',
699
+ class: 'vxe-ico-picker--icon'
700
+ },
701
+ [
702
+ h('i', {
703
+ class: selectIcon
704
+ })
705
+ ]
706
+ )
707
+ }
708
+
709
+ const renderVN = () => {
710
+ const { className, clearable, filterable } = props
711
+ const { initialized, isActivated, isAniVisible, visiblePanel, selectIcon } = reactData
712
+ const vSize = computeSize.value
713
+ const isDisabled = computeIsDisabled.value
714
+ const btnTransfer = computeBtnTransfer.value
715
+ const formReadonly = computeFormReadonly.value
716
+
717
+ if (formReadonly) {
718
+ return h(
719
+ 'div',
720
+ {
721
+ ref: refElem,
722
+ class: ['vxe-ico-picker--readonly', className]
723
+ },
724
+ [
725
+ h('i', {
726
+ class: selectIcon
727
+ })
728
+ ]
729
+ )
730
+ }
731
+ const currStyle = computeCurrStyle.value
732
+ const inpPlaceholder = computeInpPlaceholder.value
733
+ const wrapperStyle = computeWrapperStyle.value
734
+ const popupOpts = computePopupOpts.value
735
+ const { appendTo } = popupOpts
736
+ const ppClassName = popupOpts.className || props.popupClassName
737
+ return h(
738
+ 'div',
739
+ {
740
+ ref: refElem,
741
+ class: [
742
+ 'vxe-ico-picker',
743
+ className ? (XEUtils.isFunction(className) ? className({ $iconPicker: $xeIconPicker }) : className) : '',
744
+ {
745
+ [`size--${vSize}`]: vSize,
746
+ 'show--clear': clearable && !isDisabled && !!selectIcon,
747
+ 'is--visible': visiblePanel,
748
+ 'is--disabled': isDisabled,
749
+ 'is--active': isActivated
750
+ }
751
+ ],
752
+ style: currStyle
753
+ },
754
+ [
755
+ h(
756
+ 'div',
757
+ {
758
+ class: 'vxe-ico-picker--inner',
759
+ onClick: clickEvent
760
+ },
761
+ [
762
+ h('input', {
763
+ ref: refInput,
764
+ class: 'vxe-ico-picker--input',
765
+ onFocus: focusEvent,
766
+ onBlur: blurEvent
767
+ }),
768
+ selectIcon
769
+ ? renderIconView()
770
+ : h(
771
+ 'div',
772
+ {
773
+ class: 'vxe-ico-picker--placeholder'
774
+ },
775
+ inpPlaceholder
776
+ ),
777
+ h(
778
+ 'div',
779
+ {
780
+ class: 'vxe-ico-picker--suffix'
781
+ },
782
+ [
783
+ h(
784
+ 'div',
785
+ {
786
+ class: 'vxe-ico-picker--clear-icon',
787
+ onClick: clearEvent
788
+ },
789
+ [
790
+ h('i', {
791
+ class: getIcon().INPUT_CLEAR
792
+ })
793
+ ]
794
+ ),
795
+ h(
796
+ 'div',
797
+ {
798
+ class: 'vxe-ico-picker--suffix-icon'
799
+ },
800
+ [
801
+ h('i', {
802
+ class: visiblePanel ? getIcon().ICON_PICKER_OPEN : getIcon().ICON_PICKER_CLOSE
803
+ })
804
+ ]
805
+ )
806
+ ]
807
+ )
808
+ ]
809
+ ),
810
+ h(
811
+ Teleport,
812
+ {
813
+ to: getPopupContainer(appendTo),
814
+ disabled: btnTransfer ? !initialized : true
815
+ },
816
+ [
817
+ h(
818
+ 'div',
819
+ {
820
+ ref: refOptionPanel,
821
+ class: [
822
+ 'vxe-table--ignore-clear vxe-ico-picker--panel',
823
+ ppClassName ? (XEUtils.isFunction(ppClassName) ? ppClassName({ $iconPicker: $xeIconPicker }) : ppClassName) : '',
824
+ {
825
+ [`size--${vSize}`]: vSize,
826
+ 'is--transfer': btnTransfer,
827
+ 'ani--leave': isAniVisible,
828
+ 'ani--enter': visiblePanel
829
+ }
830
+ ],
831
+ placement: reactData.panelPlacement,
832
+ style: reactData.panelStyle
833
+ },
834
+ [
835
+ initialized && (visiblePanel || isAniVisible)
836
+ ? h(
837
+ 'div',
838
+ {
839
+ class: 'vxe-ico-picker--panel-wrapper',
840
+ style: wrapperStyle
841
+ },
842
+ [
843
+ filterable
844
+ ? h(
845
+ 'div',
846
+ {
847
+ class: 'vxe-ico-picker--panel-search'
848
+ },
849
+ [
850
+ h(VxeInputComponent, {
851
+ ref: refInpSearch,
852
+ class: 'vxe-ico-picker-search--input',
853
+ modelValue: reactData.searchValue,
854
+ type: 'text',
855
+ clearable: true,
856
+ disabled: false,
857
+ readonly: false,
858
+ placeholder: getI18n('vxe.iconPicker.search'),
859
+ prefixIcon: getIcon().INPUT_SEARCH,
860
+ 'onUpdate:modelValue': modelSearchEvent,
861
+ onFocus: focusSearchEvent,
862
+ onChange: triggerSearchEvent,
863
+ onSearch: triggerSearchEvent
864
+ })
865
+ ]
866
+ )
867
+ : renderEmptyElement($xeIconPicker),
868
+ renderIconWrapper()
869
+ ]
870
+ )
871
+ : renderEmptyElement($xeIconPicker)
872
+ ]
873
+ )
874
+ ]
875
+ )
876
+ ]
877
+ )
878
+ }
879
+
880
+ reactData.selectIcon = `${props.modelValue || ''}`
881
+ handleData()
882
+
883
+ watch(
884
+ () => props.modelValue,
885
+ (val) => {
886
+ reactData.selectIcon = `${val || ''}`
887
+ }
888
+ )
889
+
890
+ watch(computeIconList, () => {
891
+ handleData()
892
+ })
893
+
894
+ onMounted(() => {
895
+ globalEvents.on($xeIconPicker, 'mousedown', handleGlobalMousedownEvent)
896
+ globalEvents.on($xeIconPicker, 'keydown', handleGlobalKeydownEvent)
897
+ globalEvents.on($xeIconPicker, 'blur', handleGlobalBlurEvent)
898
+ globalEvents.on($xeIconPicker, 'resize', handleGlobalResizeEvent)
899
+ globalEvents.on($xeIconPicker, 'scroll', handleGlobalScrollEvent)
900
+ })
901
+
902
+ onBeforeUnmount(() => {
903
+ globalEvents.off($xeIconPicker, 'mousewheel')
904
+ globalEvents.off($xeIconPicker, 'mousedown')
905
+ globalEvents.off($xeIconPicker, 'keydown')
906
+ globalEvents.off($xeIconPicker, 'blur')
907
+ globalEvents.off($xeIconPicker, 'resize')
908
+ globalEvents.off($xeIconPicker, 'scroll')
909
+ XEUtils.assign(reactData, createReactData())
910
+ XEUtils.assign(internalData, createInternalData())
911
+ })
912
+
913
+ provide('$xeIconPicker', $xeIconPicker)
914
+
915
+ $xeIconPicker.renderVN = renderVN
916
+
917
+ return $xeIconPicker
918
+ },
919
+ render() {
920
+ return this.renderVN()
921
+ }
922
+ })