vxe-pc-ui 3.0.0 → 3.0.2

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 (626) hide show
  1. package/README.md +23 -25
  2. package/es/button/src/button.js +3 -0
  3. package/es/calendar/index.js +12 -0
  4. package/es/calendar/src/calendar.js +1227 -0
  5. package/es/calendar/style.css +247 -0
  6. package/es/calendar/style.min.css +1 -0
  7. package/es/carousel/index.js +12 -0
  8. package/es/carousel/src/carousel-item.js +100 -0
  9. package/es/carousel/src/carousel.js +418 -0
  10. package/es/carousel/src/util.js +17 -0
  11. package/es/carousel/style.css +185 -0
  12. package/es/carousel/style.min.css +1 -0
  13. package/es/carousel-item/index.js +12 -0
  14. package/es/carousel-item/style.css +0 -0
  15. package/es/carousel-item/style.min.css +0 -0
  16. package/es/checkbox/index.js +12 -0
  17. package/es/checkbox/src/checkbox.js +164 -0
  18. package/es/checkbox/src/group.js +159 -0
  19. package/es/checkbox/style.css +117 -0
  20. package/es/checkbox/style.min.css +1 -0
  21. package/es/checkbox-group/index.js +12 -0
  22. package/es/checkbox-group/style.css +0 -0
  23. package/es/checkbox-group/style.min.css +0 -0
  24. package/es/collapse/index.js +12 -0
  25. package/es/collapse/src/collapse-pane.js +39 -0
  26. package/es/collapse/src/collapse.js +39 -0
  27. package/es/collapse/style.css +0 -0
  28. package/es/collapse/style.min.css +0 -0
  29. package/es/collapse-pane/index.js +12 -0
  30. package/es/collapse-pane/style.css +0 -0
  31. package/es/collapse-pane/style.min.css +0 -0
  32. package/es/components.js +66 -66
  33. package/es/date-picker/src/date-picker.js +20 -13
  34. package/es/drawer/src/drawer.js +17 -12
  35. package/es/form/index.js +13 -0
  36. package/es/form/render/index.js +461 -0
  37. package/es/form/src/form-config-item.js +201 -0
  38. package/es/form/src/form-gather.js +87 -0
  39. package/es/form/src/form-item.js +291 -0
  40. package/es/form/src/form.js +762 -0
  41. package/es/form/src/itemInfo.js +43 -0
  42. package/es/form/src/render.js +78 -0
  43. package/es/form/src/util.js +66 -0
  44. package/es/form/style.css +470 -0
  45. package/es/form/style.min.css +1 -0
  46. package/es/form-gather/index.js +12 -0
  47. package/es/form-gather/style.css +0 -0
  48. package/es/form-gather/style.min.css +0 -0
  49. package/es/form-item/index.js +12 -0
  50. package/es/form-item/style.css +0 -0
  51. package/es/form-item/style.min.css +0 -0
  52. package/es/icon/style.css +1 -1
  53. package/es/icon-picker/index.js +12 -0
  54. package/es/icon-picker/src/icon-picker.js +672 -0
  55. package/es/icon-picker/style.css +207 -0
  56. package/es/icon-picker/style.min.css +1 -0
  57. package/es/image/src/preview.js +1 -2
  58. package/es/input/index.js +12 -0
  59. package/es/input/src/input.js +2896 -0
  60. package/es/input/style.css +941 -0
  61. package/es/input/style.min.css +1 -0
  62. package/es/layout-footer/src/layout-footer.js +2 -1
  63. package/es/layout-header/src/layout-header.js +2 -1
  64. package/es/list/index.js +12 -0
  65. package/es/list/src/list.js +373 -0
  66. package/es/list/style.css +28 -0
  67. package/es/list/style.min.css +1 -0
  68. package/es/loading/src/loading.js +5 -0
  69. package/es/menu/src/menu.js +6 -2
  70. package/es/modal/src/modal.js +7 -4
  71. package/es/number-input/src/number-input.js +11 -7
  72. package/es/optgroup/index.js +12 -0
  73. package/es/optgroup/style.css +0 -0
  74. package/es/optgroup/style.min.css +0 -0
  75. package/es/option/index.js +12 -0
  76. package/es/option/style.css +0 -0
  77. package/es/option/style.min.css +0 -0
  78. package/es/pager/index.js +12 -0
  79. package/es/pager/src/pager.js +687 -0
  80. package/es/pager/style.css +303 -0
  81. package/es/pager/style.min.css +1 -0
  82. package/es/password-input/index.js +12 -0
  83. package/es/password-input/src/password-input.js +392 -0
  84. package/es/password-input/style.css +604 -0
  85. package/es/password-input/style.min.css +1 -0
  86. package/es/pulldown/src/pulldown.js +11 -3
  87. package/es/radio/src/button.js +6 -2
  88. package/es/radio/src/group.js +6 -2
  89. package/es/radio/src/radio.js +6 -2
  90. package/es/select/index.js +12 -0
  91. package/es/select/src/optgroup.js +90 -0
  92. package/es/select/src/option-info.js +16 -0
  93. package/es/select/src/option.js +86 -0
  94. package/es/select/src/select.js +1284 -0
  95. package/es/select/src/util.js +36 -0
  96. package/es/select/style.css +207 -0
  97. package/es/select/style.min.css +1 -0
  98. package/es/style.css +1 -1
  99. package/es/style.min.css +1 -1
  100. package/es/switch/src/switch.js +6 -2
  101. package/es/tab-pane/index.js +12 -0
  102. package/es/tab-pane/style.css +0 -0
  103. package/es/tab-pane/style.min.css +0 -0
  104. package/es/tabs/index.js +12 -0
  105. package/es/tabs/src/tab-pane.js +119 -0
  106. package/es/tabs/src/tabs.js +598 -0
  107. package/es/tabs/src/util.js +17 -0
  108. package/es/tabs/style.css +342 -0
  109. package/es/tabs/style.min.css +1 -0
  110. package/es/textarea/src/textarea.js +9 -5
  111. package/es/tooltip/src/tooltip.js +6 -1
  112. package/es/tree/index.js +12 -0
  113. package/es/tree/src/tree.js +1216 -0
  114. package/es/tree/style.css +219 -0
  115. package/es/tree/style.min.css +1 -0
  116. package/es/tree-select/index.js +12 -0
  117. package/es/tree-select/src/tree-select.js +685 -0
  118. package/es/tree-select/style.css +129 -0
  119. package/es/tree-select/style.min.css +1 -0
  120. package/es/ui/index.js +1 -1
  121. package/es/ui/src/log.js +1 -1
  122. package/es/ui/src/vn.js +1 -1
  123. package/es/upload/src/upload.js +9 -5
  124. package/es/vxe-calendar/index.js +3 -0
  125. package/es/vxe-calendar/style.css +247 -0
  126. package/es/vxe-calendar/style.min.css +1 -0
  127. package/es/vxe-carousel/index.js +3 -0
  128. package/es/vxe-carousel/style.css +185 -0
  129. package/es/vxe-carousel/style.min.css +1 -0
  130. package/es/vxe-carousel-item/index.js +3 -0
  131. package/es/vxe-carousel-item/style.css +0 -0
  132. package/es/vxe-carousel-item/style.min.css +0 -0
  133. package/es/vxe-checkbox/index.js +3 -0
  134. package/es/vxe-checkbox/style.css +117 -0
  135. package/es/vxe-checkbox/style.min.css +1 -0
  136. package/es/vxe-checkbox-group/index.js +3 -0
  137. package/es/vxe-checkbox-group/style.css +0 -0
  138. package/es/vxe-checkbox-group/style.min.css +0 -0
  139. package/es/vxe-collapse/index.js +3 -0
  140. package/es/vxe-collapse/style.css +0 -0
  141. package/es/vxe-collapse/style.min.css +0 -0
  142. package/es/vxe-collapse-pane/index.js +3 -0
  143. package/es/vxe-collapse-pane/style.css +0 -0
  144. package/es/vxe-collapse-pane/style.min.css +0 -0
  145. package/es/vxe-form/index.js +3 -0
  146. package/es/vxe-form/style.css +470 -0
  147. package/es/vxe-form/style.min.css +1 -0
  148. package/es/vxe-form-gather/index.js +3 -0
  149. package/es/vxe-form-gather/style.css +0 -0
  150. package/es/vxe-form-gather/style.min.css +0 -0
  151. package/es/vxe-form-item/index.js +3 -0
  152. package/es/vxe-form-item/style.css +0 -0
  153. package/es/vxe-form-item/style.min.css +0 -0
  154. package/es/vxe-icon-picker/index.js +3 -0
  155. package/es/vxe-icon-picker/style.css +207 -0
  156. package/es/vxe-icon-picker/style.min.css +1 -0
  157. package/es/vxe-input/index.js +3 -0
  158. package/es/vxe-input/style.css +941 -0
  159. package/es/vxe-input/style.min.css +1 -0
  160. package/es/vxe-list/index.js +3 -0
  161. package/es/vxe-list/style.css +28 -0
  162. package/es/vxe-list/style.min.css +1 -0
  163. package/es/vxe-optgroup/index.js +3 -0
  164. package/es/vxe-optgroup/style.css +0 -0
  165. package/es/vxe-optgroup/style.min.css +0 -0
  166. package/es/vxe-option/index.js +3 -0
  167. package/es/vxe-option/style.css +0 -0
  168. package/es/vxe-option/style.min.css +0 -0
  169. package/es/vxe-pager/index.js +3 -0
  170. package/es/vxe-pager/style.css +303 -0
  171. package/es/vxe-pager/style.min.css +1 -0
  172. package/es/vxe-password-input/index.js +3 -0
  173. package/es/vxe-password-input/style.css +604 -0
  174. package/es/vxe-password-input/style.min.css +1 -0
  175. package/es/vxe-select/index.js +3 -0
  176. package/es/vxe-select/style.css +207 -0
  177. package/es/vxe-select/style.min.css +1 -0
  178. package/es/vxe-tab-pane/index.js +3 -0
  179. package/es/vxe-tab-pane/style.css +0 -0
  180. package/es/vxe-tab-pane/style.min.css +0 -0
  181. package/es/vxe-tabs/index.js +3 -0
  182. package/es/vxe-tabs/style.css +342 -0
  183. package/es/vxe-tabs/style.min.css +1 -0
  184. package/es/vxe-tree/index.js +3 -0
  185. package/es/vxe-tree/style.css +219 -0
  186. package/es/vxe-tree/style.min.css +1 -0
  187. package/es/vxe-tree-select/index.js +3 -0
  188. package/es/vxe-tree-select/style.css +129 -0
  189. package/es/vxe-tree-select/style.min.css +1 -0
  190. package/lib/button/src/button.js +3 -0
  191. package/lib/button/src/button.min.js +1 -1
  192. package/lib/calendar/index.js +19 -0
  193. package/lib/calendar/index.min.js +1 -0
  194. package/lib/calendar/src/calendar.js +1286 -0
  195. package/lib/calendar/src/calendar.min.js +1 -0
  196. package/lib/calendar/style/index.js +1 -0
  197. package/lib/calendar/style/style.css +247 -0
  198. package/lib/calendar/style/style.min.css +1 -0
  199. package/lib/carousel/index.js +19 -0
  200. package/lib/carousel/index.min.js +1 -0
  201. package/lib/carousel/src/carousel-item.js +107 -0
  202. package/lib/carousel/src/carousel-item.min.js +1 -0
  203. package/lib/carousel/src/carousel.js +437 -0
  204. package/lib/carousel/src/carousel.min.js +1 -0
  205. package/lib/carousel/src/util.js +27 -0
  206. package/lib/carousel/src/util.min.js +1 -0
  207. package/lib/carousel/style/index.js +1 -0
  208. package/lib/carousel/style/style.css +185 -0
  209. package/lib/carousel/style/style.min.css +1 -0
  210. package/lib/carousel-item/index.js +19 -0
  211. package/lib/carousel-item/index.min.js +1 -0
  212. package/lib/carousel-item/style/index.js +1 -0
  213. package/lib/carousel-item/style/style.css +0 -0
  214. package/lib/carousel-item/style/style.min.css +0 -0
  215. package/lib/checkbox/index.js +19 -0
  216. package/lib/checkbox/index.min.js +1 -0
  217. package/lib/checkbox/src/checkbox.js +174 -0
  218. package/lib/checkbox/src/checkbox.min.js +1 -0
  219. package/lib/checkbox/src/group.js +169 -0
  220. package/lib/checkbox/src/group.min.js +1 -0
  221. package/lib/checkbox/style/index.js +1 -0
  222. package/lib/checkbox/style/style.css +117 -0
  223. package/lib/checkbox/style/style.min.css +1 -0
  224. package/lib/checkbox-group/index.js +19 -0
  225. package/lib/checkbox-group/index.min.js +1 -0
  226. package/lib/checkbox-group/style/index.js +1 -0
  227. package/lib/checkbox-group/style/style.css +0 -0
  228. package/lib/checkbox-group/style/style.min.css +0 -0
  229. package/lib/collapse/index.js +19 -0
  230. package/lib/collapse/index.min.js +1 -0
  231. package/lib/collapse/src/collapse-pane.js +48 -0
  232. package/lib/collapse/src/collapse-pane.min.js +1 -0
  233. package/lib/collapse/src/collapse.js +48 -0
  234. package/lib/collapse/src/collapse.min.js +1 -0
  235. package/lib/collapse/style/index.js +1 -0
  236. package/lib/collapse/style/style.css +0 -0
  237. package/lib/collapse/style/style.min.css +0 -0
  238. package/lib/collapse-pane/index.js +19 -0
  239. package/lib/collapse-pane/index.min.js +1 -0
  240. package/lib/collapse-pane/style/index.js +1 -0
  241. package/lib/collapse-pane/style/style.css +0 -0
  242. package/lib/collapse-pane/style/style.min.css +0 -0
  243. package/lib/components.js +271 -97
  244. package/lib/components.min.js +1 -1
  245. package/lib/date-picker/src/date-picker.js +20 -13
  246. package/lib/date-picker/src/date-picker.min.js +1 -1
  247. package/lib/drawer/src/drawer.js +17 -12
  248. package/lib/drawer/src/drawer.min.js +1 -1
  249. package/lib/form/index.js +20 -0
  250. package/lib/form/index.min.js +1 -0
  251. package/lib/form/render/index.js +509 -0
  252. package/lib/form/render/index.min.js +1 -0
  253. package/lib/form/src/form-config-item.js +210 -0
  254. package/lib/form/src/form-config-item.min.js +1 -0
  255. package/lib/form/src/form-gather.js +99 -0
  256. package/lib/form/src/form-gather.min.js +1 -0
  257. package/lib/form/src/form-item.js +299 -0
  258. package/lib/form/src/form-item.min.js +1 -0
  259. package/lib/form/src/form.js +856 -0
  260. package/lib/form/src/form.min.js +1 -0
  261. package/lib/form/src/itemInfo.js +60 -0
  262. package/lib/form/src/itemInfo.min.js +1 -0
  263. package/lib/form/src/render.js +94 -0
  264. package/lib/form/src/render.min.js +1 -0
  265. package/lib/form/src/util.js +93 -0
  266. package/lib/form/src/util.min.js +1 -0
  267. package/lib/form/style/index.js +1 -0
  268. package/lib/form/style/style.css +470 -0
  269. package/lib/form/style/style.min.css +1 -0
  270. package/lib/form-gather/index.js +19 -0
  271. package/lib/form-gather/index.min.js +1 -0
  272. package/lib/form-gather/style/index.js +1 -0
  273. package/lib/form-gather/style/style.css +0 -0
  274. package/lib/form-gather/style/style.min.css +0 -0
  275. package/lib/form-item/index.js +19 -0
  276. package/lib/form-item/index.min.js +1 -0
  277. package/lib/form-item/style/index.js +1 -0
  278. package/lib/form-item/style/style.css +0 -0
  279. package/lib/form-item/style/style.min.css +0 -0
  280. package/lib/icon/style/style.css +1 -1
  281. package/lib/icon/style/style.min.css +1 -1
  282. package/lib/icon-picker/index.js +19 -0
  283. package/lib/icon-picker/index.min.js +1 -0
  284. package/lib/icon-picker/src/icon-picker.js +650 -0
  285. package/lib/icon-picker/src/icon-picker.min.js +1 -0
  286. package/lib/icon-picker/style/index.js +1 -0
  287. package/lib/icon-picker/style/style.css +207 -0
  288. package/lib/icon-picker/style/style.min.css +1 -0
  289. package/lib/image/src/preview.js +1 -2
  290. package/lib/image/src/preview.min.js +1 -1
  291. package/lib/index.umd.js +23171 -8764
  292. package/lib/index.umd.min.js +1 -1
  293. package/lib/input/index.js +19 -0
  294. package/lib/input/index.min.js +1 -0
  295. package/lib/input/src/input.js +2901 -0
  296. package/lib/input/src/input.min.js +1 -0
  297. package/lib/input/style/index.js +1 -0
  298. package/lib/input/style/style.css +941 -0
  299. package/lib/input/style/style.min.css +1 -0
  300. package/lib/layout-footer/src/layout-footer.js +2 -1
  301. package/lib/layout-header/src/layout-header.js +2 -1
  302. package/lib/list/index.js +19 -0
  303. package/lib/list/index.min.js +1 -0
  304. package/lib/list/src/list.js +415 -0
  305. package/lib/list/src/list.min.js +1 -0
  306. package/lib/list/style/index.js +1 -0
  307. package/lib/list/style/style.css +28 -0
  308. package/lib/list/style/style.min.css +1 -0
  309. package/lib/loading/src/loading.js +5 -0
  310. package/lib/loading/src/loading.min.js +1 -1
  311. package/lib/menu/src/menu.js +6 -2
  312. package/lib/menu/src/menu.min.js +1 -1
  313. package/lib/modal/src/modal.js +7 -4
  314. package/lib/modal/src/modal.min.js +1 -1
  315. package/lib/number-input/src/number-input.js +11 -7
  316. package/lib/number-input/src/number-input.min.js +1 -1
  317. package/lib/optgroup/index.js +19 -0
  318. package/lib/optgroup/index.min.js +1 -0
  319. package/lib/optgroup/style/index.js +1 -0
  320. package/lib/optgroup/style/style.css +0 -0
  321. package/lib/optgroup/style/style.min.css +0 -0
  322. package/lib/option/index.js +19 -0
  323. package/lib/option/index.min.js +1 -0
  324. package/lib/option/style/index.js +1 -0
  325. package/lib/option/style/style.css +0 -0
  326. package/lib/option/style/style.min.css +0 -0
  327. package/lib/pager/index.js +19 -0
  328. package/lib/pager/index.min.js +1 -0
  329. package/lib/pager/src/pager.js +714 -0
  330. package/lib/pager/src/pager.min.js +1 -0
  331. package/lib/pager/style/index.js +1 -0
  332. package/lib/pager/style/style.css +303 -0
  333. package/lib/pager/style/style.min.css +1 -0
  334. package/lib/password-input/index.js +19 -0
  335. package/lib/password-input/index.min.js +1 -0
  336. package/lib/password-input/src/password-input.js +402 -0
  337. package/lib/password-input/src/password-input.min.js +1 -0
  338. package/lib/password-input/style/index.js +1 -0
  339. package/lib/password-input/style/style.css +604 -0
  340. package/lib/password-input/style/style.min.css +1 -0
  341. package/lib/pulldown/src/pulldown.js +11 -3
  342. package/lib/pulldown/src/pulldown.min.js +1 -1
  343. package/lib/radio/src/button.js +6 -2
  344. package/lib/radio/src/button.min.js +1 -1
  345. package/lib/radio/src/group.js +6 -2
  346. package/lib/radio/src/group.min.js +1 -1
  347. package/lib/radio/src/radio.js +6 -2
  348. package/lib/radio/src/radio.min.js +1 -1
  349. package/lib/select/index.js +19 -0
  350. package/lib/select/index.min.js +1 -0
  351. package/lib/select/src/optgroup.js +97 -0
  352. package/lib/select/src/optgroup.min.js +1 -0
  353. package/lib/select/src/option-info.js +33 -0
  354. package/lib/select/src/option-info.min.js +1 -0
  355. package/lib/select/src/option.js +93 -0
  356. package/lib/select/src/option.min.js +1 -0
  357. package/lib/select/src/select.js +1330 -0
  358. package/lib/select/src/select.min.js +1 -0
  359. package/lib/select/src/util.js +51 -0
  360. package/lib/select/src/util.min.js +1 -0
  361. package/lib/select/style/index.js +1 -0
  362. package/lib/select/style/style.css +207 -0
  363. package/lib/select/style/style.min.css +1 -0
  364. package/lib/style.css +1 -1
  365. package/lib/style.min.css +1 -1
  366. package/lib/switch/src/switch.js +6 -2
  367. package/lib/switch/src/switch.min.js +1 -1
  368. package/lib/tab-pane/index.js +19 -0
  369. package/lib/tab-pane/index.min.js +1 -0
  370. package/lib/tab-pane/style/index.js +1 -0
  371. package/lib/tab-pane/style/style.css +0 -0
  372. package/lib/tab-pane/style/style.min.css +0 -0
  373. package/lib/tabs/index.js +19 -0
  374. package/lib/tabs/index.min.js +1 -0
  375. package/lib/tabs/src/tab-pane.js +128 -0
  376. package/lib/tabs/src/tab-pane.min.js +1 -0
  377. package/lib/tabs/src/tabs.js +635 -0
  378. package/lib/tabs/src/tabs.min.js +1 -0
  379. package/lib/tabs/src/util.js +29 -0
  380. package/lib/tabs/src/util.min.js +1 -0
  381. package/lib/tabs/style/index.js +1 -0
  382. package/lib/tabs/style/style.css +342 -0
  383. package/lib/tabs/style/style.min.css +1 -0
  384. package/lib/textarea/src/textarea.js +9 -5
  385. package/lib/textarea/src/textarea.min.js +1 -1
  386. package/lib/tooltip/src/tooltip.js +6 -1
  387. package/lib/tooltip/src/tooltip.min.js +1 -1
  388. package/lib/tree/index.js +19 -0
  389. package/lib/tree/index.min.js +1 -0
  390. package/lib/tree/src/tree.js +1324 -0
  391. package/lib/tree/src/tree.min.js +1 -0
  392. package/lib/tree/style/index.js +1 -0
  393. package/lib/tree/style/style.css +219 -0
  394. package/lib/tree/style/style.min.css +1 -0
  395. package/lib/tree-select/index.js +19 -0
  396. package/lib/tree-select/index.min.js +1 -0
  397. package/lib/tree-select/src/tree-select.js +695 -0
  398. package/lib/tree-select/src/tree-select.min.js +1 -0
  399. package/lib/tree-select/style/index.js +1 -0
  400. package/lib/tree-select/style/style.css +129 -0
  401. package/lib/tree-select/style/style.min.css +1 -0
  402. package/lib/ui/index.js +1 -1
  403. package/lib/ui/index.min.js +1 -1
  404. package/lib/ui/src/log.js +1 -1
  405. package/lib/ui/src/log.min.js +1 -1
  406. package/lib/ui/src/vn.js +1 -1
  407. package/lib/ui/src/vn.min.js +1 -1
  408. package/lib/upload/src/upload.js +9 -5
  409. package/lib/upload/src/upload.min.js +1 -1
  410. package/lib/vxe-calendar/index.js +23 -0
  411. package/lib/vxe-calendar/index.min.js +1 -0
  412. package/lib/vxe-calendar/style/index.js +1 -0
  413. package/lib/vxe-calendar/style/style.css +247 -0
  414. package/lib/vxe-calendar/style/style.min.css +1 -0
  415. package/lib/vxe-carousel/index.js +23 -0
  416. package/lib/vxe-carousel/index.min.js +1 -0
  417. package/lib/vxe-carousel/style/index.js +1 -0
  418. package/lib/vxe-carousel/style/style.css +185 -0
  419. package/lib/vxe-carousel/style/style.min.css +1 -0
  420. package/lib/vxe-carousel-item/index.js +23 -0
  421. package/lib/vxe-carousel-item/index.min.js +1 -0
  422. package/lib/vxe-carousel-item/style/index.js +1 -0
  423. package/lib/vxe-carousel-item/style/style.css +0 -0
  424. package/lib/vxe-carousel-item/style/style.min.css +0 -0
  425. package/lib/vxe-checkbox/index.js +23 -0
  426. package/lib/vxe-checkbox/index.min.js +1 -0
  427. package/lib/vxe-checkbox/style/index.js +1 -0
  428. package/lib/vxe-checkbox/style/style.css +117 -0
  429. package/lib/vxe-checkbox/style/style.min.css +1 -0
  430. package/lib/vxe-checkbox-group/index.js +23 -0
  431. package/lib/vxe-checkbox-group/index.min.js +1 -0
  432. package/lib/vxe-checkbox-group/style/index.js +1 -0
  433. package/lib/vxe-checkbox-group/style/style.css +0 -0
  434. package/lib/vxe-checkbox-group/style/style.min.css +0 -0
  435. package/lib/vxe-collapse/index.js +23 -0
  436. package/lib/vxe-collapse/index.min.js +1 -0
  437. package/lib/vxe-collapse/style/index.js +1 -0
  438. package/lib/vxe-collapse/style/style.css +0 -0
  439. package/lib/vxe-collapse/style/style.min.css +0 -0
  440. package/lib/vxe-collapse-pane/index.js +23 -0
  441. package/lib/vxe-collapse-pane/index.min.js +1 -0
  442. package/lib/vxe-collapse-pane/style/index.js +1 -0
  443. package/lib/vxe-collapse-pane/style/style.css +0 -0
  444. package/lib/vxe-collapse-pane/style/style.min.css +0 -0
  445. package/lib/vxe-form/index.js +23 -0
  446. package/lib/vxe-form/index.min.js +1 -0
  447. package/lib/vxe-form/style/index.js +1 -0
  448. package/lib/vxe-form/style/style.css +470 -0
  449. package/lib/vxe-form/style/style.min.css +1 -0
  450. package/lib/vxe-form-gather/index.js +23 -0
  451. package/lib/vxe-form-gather/index.min.js +1 -0
  452. package/lib/vxe-form-gather/style/index.js +1 -0
  453. package/lib/vxe-form-gather/style/style.css +0 -0
  454. package/lib/vxe-form-gather/style/style.min.css +0 -0
  455. package/lib/vxe-form-item/index.js +23 -0
  456. package/lib/vxe-form-item/index.min.js +1 -0
  457. package/lib/vxe-form-item/style/index.js +1 -0
  458. package/lib/vxe-form-item/style/style.css +0 -0
  459. package/lib/vxe-form-item/style/style.min.css +0 -0
  460. package/lib/vxe-icon-picker/index.js +23 -0
  461. package/lib/vxe-icon-picker/index.min.js +1 -0
  462. package/lib/vxe-icon-picker/style/index.js +1 -0
  463. package/lib/vxe-icon-picker/style/style.css +207 -0
  464. package/lib/vxe-icon-picker/style/style.min.css +1 -0
  465. package/lib/vxe-input/index.js +23 -0
  466. package/lib/vxe-input/index.min.js +1 -0
  467. package/lib/vxe-input/style/index.js +1 -0
  468. package/lib/vxe-input/style/style.css +941 -0
  469. package/lib/vxe-input/style/style.min.css +1 -0
  470. package/lib/vxe-list/index.js +23 -0
  471. package/lib/vxe-list/index.min.js +1 -0
  472. package/lib/vxe-list/style/index.js +1 -0
  473. package/lib/vxe-list/style/style.css +28 -0
  474. package/lib/vxe-list/style/style.min.css +1 -0
  475. package/lib/vxe-optgroup/index.js +23 -0
  476. package/lib/vxe-optgroup/index.min.js +1 -0
  477. package/lib/vxe-optgroup/style/index.js +1 -0
  478. package/lib/vxe-optgroup/style/style.css +0 -0
  479. package/lib/vxe-optgroup/style/style.min.css +0 -0
  480. package/lib/vxe-option/index.js +23 -0
  481. package/lib/vxe-option/index.min.js +1 -0
  482. package/lib/vxe-option/style/index.js +1 -0
  483. package/lib/vxe-option/style/style.css +0 -0
  484. package/lib/vxe-option/style/style.min.css +0 -0
  485. package/lib/vxe-pager/index.js +23 -0
  486. package/lib/vxe-pager/index.min.js +1 -0
  487. package/lib/vxe-pager/style/index.js +1 -0
  488. package/lib/vxe-pager/style/style.css +303 -0
  489. package/lib/vxe-pager/style/style.min.css +1 -0
  490. package/lib/vxe-password-input/index.js +23 -0
  491. package/lib/vxe-password-input/index.min.js +1 -0
  492. package/lib/vxe-password-input/style/index.js +1 -0
  493. package/lib/vxe-password-input/style/style.css +604 -0
  494. package/lib/vxe-password-input/style/style.min.css +1 -0
  495. package/lib/vxe-select/index.js +23 -0
  496. package/lib/vxe-select/index.min.js +1 -0
  497. package/lib/vxe-select/style/index.js +1 -0
  498. package/lib/vxe-select/style/style.css +207 -0
  499. package/lib/vxe-select/style/style.min.css +1 -0
  500. package/lib/vxe-tab-pane/index.js +23 -0
  501. package/lib/vxe-tab-pane/index.min.js +1 -0
  502. package/lib/vxe-tab-pane/style/index.js +1 -0
  503. package/lib/vxe-tab-pane/style/style.css +0 -0
  504. package/lib/vxe-tab-pane/style/style.min.css +0 -0
  505. package/lib/vxe-tabs/index.js +23 -0
  506. package/lib/vxe-tabs/index.min.js +1 -0
  507. package/lib/vxe-tabs/style/index.js +1 -0
  508. package/lib/vxe-tabs/style/style.css +342 -0
  509. package/lib/vxe-tabs/style/style.min.css +1 -0
  510. package/lib/vxe-tree/index.js +23 -0
  511. package/lib/vxe-tree/index.min.js +1 -0
  512. package/lib/vxe-tree/style/index.js +1 -0
  513. package/lib/vxe-tree/style/style.css +219 -0
  514. package/lib/vxe-tree/style/style.min.css +1 -0
  515. package/lib/vxe-tree-select/index.js +23 -0
  516. package/lib/vxe-tree-select/index.min.js +1 -0
  517. package/lib/vxe-tree-select/style/index.js +1 -0
  518. package/lib/vxe-tree-select/style/style.css +129 -0
  519. package/lib/vxe-tree-select/style/style.min.css +1 -0
  520. package/package.json +1 -1
  521. package/packages/button/src/button.ts +3 -0
  522. package/packages/calendar/index.ts +16 -0
  523. package/packages/calendar/src/calendar.ts +1281 -0
  524. package/packages/carousel/index.ts +16 -0
  525. package/packages/carousel/src/carousel-item.ts +114 -0
  526. package/packages/carousel/src/carousel.ts +449 -0
  527. package/packages/carousel/src/util.ts +21 -0
  528. package/packages/carousel-item/index.ts +16 -0
  529. package/packages/checkbox/index.ts +16 -0
  530. package/packages/checkbox/src/checkbox.ts +182 -0
  531. package/packages/checkbox/src/group.ts +184 -0
  532. package/packages/checkbox-group/index.ts +16 -0
  533. package/packages/collapse/index.ts +16 -0
  534. package/packages/collapse/src/collapse-pane.ts +47 -0
  535. package/packages/collapse/src/collapse.ts +47 -0
  536. package/packages/collapse-pane/index.ts +16 -0
  537. package/packages/components.ts +66 -66
  538. package/packages/date-picker/src/date-picker.ts +21 -13
  539. package/packages/drawer/src/drawer.ts +18 -12
  540. package/packages/form/index.ts +17 -0
  541. package/packages/form/render/index.ts +499 -0
  542. package/packages/form/src/form-config-item.ts +219 -0
  543. package/packages/form/src/form-gather.ts +104 -0
  544. package/packages/form/src/form-item.ts +322 -0
  545. package/packages/form/src/form.ts +809 -0
  546. package/packages/form/src/itemInfo.ts +47 -0
  547. package/packages/form/src/render.ts +98 -0
  548. package/packages/form/src/util.ts +80 -0
  549. package/packages/form-gather/index.ts +16 -0
  550. package/packages/form-item/index.ts +16 -0
  551. package/packages/icon-picker/index.ts +16 -0
  552. package/packages/icon-picker/src/icon-picker.ts +716 -0
  553. package/packages/image/src/preview.ts +1 -2
  554. package/packages/input/index.ts +16 -0
  555. package/packages/input/src/input.ts +3000 -0
  556. package/packages/layout-footer/src/layout-footer.ts +5 -3
  557. package/packages/layout-header/src/layout-header.ts +2 -1
  558. package/packages/list/index.ts +16 -0
  559. package/packages/list/src/list.ts +403 -0
  560. package/packages/loading/src/loading.ts +6 -0
  561. package/packages/menu/src/menu.ts +7 -2
  562. package/packages/modal/src/modal.ts +8 -4
  563. package/packages/number-input/src/number-input.ts +12 -7
  564. package/packages/optgroup/index.ts +16 -0
  565. package/packages/option/index.ts +16 -0
  566. package/packages/pager/index.ts +16 -0
  567. package/packages/pager/src/pager.ts +743 -0
  568. package/packages/password-input/index.ts +16 -0
  569. package/packages/password-input/src/password-input.ts +432 -0
  570. package/packages/pulldown/src/pulldown.ts +12 -3
  571. package/packages/radio/src/button.ts +7 -2
  572. package/packages/radio/src/group.ts +7 -2
  573. package/packages/radio/src/radio.ts +7 -2
  574. package/packages/select/index.ts +16 -0
  575. package/packages/select/src/optgroup.ts +107 -0
  576. package/packages/select/src/option-info.ts +20 -0
  577. package/packages/select/src/option.ts +103 -0
  578. package/packages/select/src/select.ts +1341 -0
  579. package/packages/select/src/util.ts +47 -0
  580. package/packages/switch/src/switch.ts +7 -2
  581. package/packages/tab-pane/index.ts +16 -0
  582. package/packages/tabs/index.ts +16 -0
  583. package/packages/tabs/src/tab-pane.ts +136 -0
  584. package/packages/tabs/src/tabs.ts +636 -0
  585. package/packages/tabs/src/util.ts +21 -0
  586. package/packages/textarea/src/textarea.ts +10 -5
  587. package/packages/tooltip/src/tooltip.ts +7 -1
  588. package/packages/tree/index.ts +16 -0
  589. package/packages/tree/src/tree.ts +1292 -0
  590. package/packages/tree-select/index.ts +16 -0
  591. package/packages/tree-select/src/tree-select.ts +743 -0
  592. package/packages/ui/src/vn.ts +1 -1
  593. package/packages/upload/src/upload.ts +10 -5
  594. package/types/components/calendar.d.ts +6 -0
  595. package/types/components/carousel.d.ts +5 -0
  596. package/types/components/colgroup.d.ts +1 -0
  597. package/types/components/column.d.ts +1 -0
  598. package/types/components/drawer.d.ts +11 -10
  599. package/types/components/form-item.d.ts +1 -1
  600. package/types/components/form.d.ts +8 -1
  601. package/types/components/icon-picker.d.ts +4 -0
  602. package/types/components/input.d.ts +9 -1
  603. package/types/components/list.d.ts +1 -0
  604. package/types/components/optgroup.d.ts +10 -4
  605. package/types/components/table.d.ts +43 -4
  606. package/types/components/tabs.d.ts +4 -0
  607. package/types/components/toolbar.d.ts +5 -0
  608. package/types/components/tree-select.d.ts +4 -0
  609. package/types/ui/index.d.ts +0 -5
  610. package/types/ui/renderer.d.ts +37 -36
  611. package/types/handles/form-design.d.ts +0 -4
  612. package/types/handles/index.d.ts +0 -3
  613. package/types/handles/list-design.d.ts +0 -4
  614. package/types/handles/table.d.ts +0 -4
  615. /package/es/icon/style/{iconfont.1725630285930.ttf → iconfont.1725869586078.ttf} +0 -0
  616. /package/es/icon/style/{iconfont.1725630285930.woff → iconfont.1725869586078.woff} +0 -0
  617. /package/es/icon/style/{iconfont.1725630285930.woff2 → iconfont.1725869586078.woff2} +0 -0
  618. /package/es/{iconfont.1725630285930.ttf → iconfont.1725869586078.ttf} +0 -0
  619. /package/es/{iconfont.1725630285930.woff → iconfont.1725869586078.woff} +0 -0
  620. /package/es/{iconfont.1725630285930.woff2 → iconfont.1725869586078.woff2} +0 -0
  621. /package/lib/icon/style/{iconfont.1725630285930.ttf → iconfont.1725869586078.ttf} +0 -0
  622. /package/lib/icon/style/{iconfont.1725630285930.woff → iconfont.1725869586078.woff} +0 -0
  623. /package/lib/icon/style/{iconfont.1725630285930.woff2 → iconfont.1725869586078.woff2} +0 -0
  624. /package/lib/{iconfont.1725630285930.ttf → iconfont.1725869586078.ttf} +0 -0
  625. /package/lib/{iconfont.1725630285930.woff → iconfont.1725869586078.woff} +0 -0
  626. /package/lib/{iconfont.1725630285930.woff2 → iconfont.1725869586078.woff2} +0 -0
@@ -0,0 +1,1284 @@
1
+ import { defineVxeComponent } from '../../ui/src/comp';
2
+ import XEUtils from 'xe-utils';
3
+ import { getConfig, getIcon, getI18n, globalEvents, GLOBAL_EVENT_KEYS, createEvent, globalMixins, renderEmptyElement } from '../../ui';
4
+ import { getEventTargetNode, getAbsolutePos } from '../../ui/src/dom';
5
+ import { getLastZIndex, nextZIndex, getFuncText } from '../../ui/src/utils';
6
+ import VxeInputComponent from '../../input/src/input';
7
+ import { getSlotVNs } from '../../ui/src/vn';
8
+ function isOptionVisible(option) {
9
+ return option.visible !== false;
10
+ }
11
+ function getOptUniqueId() {
12
+ return XEUtils.uniqueId('opt_');
13
+ }
14
+ export default defineVxeComponent({
15
+ name: 'VxeSelect',
16
+ mixins: [
17
+ globalMixins.sizeMixin
18
+ ],
19
+ model: {
20
+ prop: 'value',
21
+ event: 'modelValue'
22
+ },
23
+ props: {
24
+ value: [String, Number, Boolean, Array],
25
+ clearable: Boolean,
26
+ placeholder: String,
27
+ readonly: {
28
+ type: Boolean,
29
+ default: null
30
+ },
31
+ loading: Boolean,
32
+ disabled: {
33
+ type: Boolean,
34
+ default: null
35
+ },
36
+ multiple: Boolean,
37
+ multiCharOverflow: {
38
+ type: [Number, String],
39
+ default: () => getConfig().select.multiCharOverflow
40
+ },
41
+ prefixIcon: String,
42
+ placement: String,
43
+ options: Array,
44
+ optionProps: Object,
45
+ optionGroups: Array,
46
+ optionGroupProps: Object,
47
+ optionConfig: Object,
48
+ className: [String, Function],
49
+ popupClassName: [String, Function],
50
+ max: {
51
+ type: [String, Number],
52
+ default: null
53
+ },
54
+ size: {
55
+ type: String,
56
+ default: () => getConfig().select.size || getConfig().size
57
+ },
58
+ filterable: Boolean,
59
+ filterMethod: Function,
60
+ remote: Boolean,
61
+ remoteMethod: Function,
62
+ emptyText: String,
63
+ transfer: {
64
+ type: Boolean,
65
+ default: null
66
+ },
67
+ // 已废弃,被 option-config.keyField 替换
68
+ optionId: {
69
+ type: String,
70
+ default: () => getConfig().select.optionId
71
+ },
72
+ // 已废弃,被 option-config.useKey 替换
73
+ optionKey: Boolean
74
+ },
75
+ inject: {
76
+ $xeModal: {
77
+ default: null
78
+ },
79
+ $xeDrawer: {
80
+ default: null
81
+ },
82
+ $xeTable: {
83
+ default: null
84
+ },
85
+ $xeForm: {
86
+ default: null
87
+ },
88
+ formItemInfo: {
89
+ from: 'xeFormItemInfo',
90
+ default: null
91
+ }
92
+ },
93
+ provide() {
94
+ const $xeSelect = this;
95
+ return {
96
+ $xeSelect
97
+ };
98
+ },
99
+ data() {
100
+ const xID = XEUtils.uniqueId();
101
+ const reactData = {
102
+ initialized: false,
103
+ staticOptions: [],
104
+ fullGroupList: [],
105
+ fullOptionList: [],
106
+ visibleGroupList: [],
107
+ visibleOptionList: [],
108
+ remoteValueList: [],
109
+ panelIndex: 0,
110
+ panelStyle: {},
111
+ panelPlacement: null,
112
+ currentOption: null,
113
+ currentValue: null,
114
+ triggerFocusPanel: false,
115
+ visiblePanel: false,
116
+ isAniVisible: false,
117
+ isActivated: false,
118
+ searchValue: '',
119
+ searchLoading: false
120
+ };
121
+ const internalData = {
122
+ hpTimeout: undefined
123
+ };
124
+ return {
125
+ xID,
126
+ reactData,
127
+ internalData
128
+ };
129
+ },
130
+ computed: Object.assign(Object.assign({}, {}), { computeFormReadonly() {
131
+ const $xeSelect = this;
132
+ const props = $xeSelect;
133
+ const $xeForm = $xeSelect.$xeForm;
134
+ const { readonly } = props;
135
+ if (readonly === null) {
136
+ if ($xeForm) {
137
+ return $xeForm.readonly;
138
+ }
139
+ return false;
140
+ }
141
+ return readonly;
142
+ },
143
+ computeIsDisabled() {
144
+ const $xeSelect = this;
145
+ const props = $xeSelect;
146
+ const $xeForm = $xeSelect.$xeForm;
147
+ const { disabled } = props;
148
+ if (disabled === null) {
149
+ if ($xeForm) {
150
+ return $xeForm.disabled;
151
+ }
152
+ return false;
153
+ }
154
+ return disabled;
155
+ },
156
+ computeBtnTransfer() {
157
+ const $xeSelect = this;
158
+ const props = $xeSelect;
159
+ const $xeTable = $xeSelect.$xeTable;
160
+ const $xeModal = $xeSelect.$xeModal;
161
+ const $xeDrawer = $xeSelect.$xeDrawer;
162
+ const $xeForm = $xeSelect.$xeForm;
163
+ const { transfer } = props;
164
+ if (transfer === null) {
165
+ const globalTransfer = getConfig().select.transfer;
166
+ if (XEUtils.isBoolean(globalTransfer)) {
167
+ return globalTransfer;
168
+ }
169
+ if ($xeTable || $xeModal || $xeDrawer || $xeForm) {
170
+ return true;
171
+ }
172
+ }
173
+ return transfer;
174
+ },
175
+ computeInpPlaceholder() {
176
+ const $xeSelect = this;
177
+ const props = $xeSelect;
178
+ const { placeholder } = props;
179
+ if (placeholder) {
180
+ return getFuncText(placeholder);
181
+ }
182
+ const globalPlaceholder = getConfig().select.placeholder;
183
+ if (globalPlaceholder) {
184
+ return getFuncText(globalPlaceholder);
185
+ }
186
+ return getI18n('vxe.base.pleaseSelect');
187
+ },
188
+ computePropsOpts() {
189
+ const $xeSelect = this;
190
+ const props = $xeSelect;
191
+ return Object.assign({}, props.optionProps);
192
+ },
193
+ computeGroupPropsOpts() {
194
+ const $xeSelect = this;
195
+ const props = $xeSelect;
196
+ return Object.assign({}, props.optionGroupProps);
197
+ },
198
+ computeLabelField() {
199
+ const $xeSelect = this;
200
+ const propsOpts = $xeSelect.computePropsOpts;
201
+ return propsOpts.label || 'label';
202
+ },
203
+ computeValueField() {
204
+ const $xeSelect = this;
205
+ const propsOpts = $xeSelect.computePropsOpts;
206
+ return propsOpts.value || 'value';
207
+ },
208
+ computeGroupLabelField() {
209
+ const $xeSelect = this;
210
+ const groupPropsOpts = $xeSelect.computeGroupPropsOpts;
211
+ return groupPropsOpts.label || 'label';
212
+ },
213
+ computeGroupOptionsField() {
214
+ const $xeSelect = this;
215
+ const groupPropsOpts = $xeSelect.computeGroupPropsOpts;
216
+ return groupPropsOpts.options || 'options';
217
+ },
218
+ computeIsMaximize() {
219
+ const $xeSelect = this;
220
+ const props = $xeSelect;
221
+ const { value, multiple, max } = props;
222
+ if (multiple && max) {
223
+ return (XEUtils.isArray(value) ? value.length : (XEUtils.eqNull(value) ? 0 : 1)) >= XEUtils.toNumber(max);
224
+ }
225
+ return false;
226
+ },
227
+ computeOptionOpts() {
228
+ const $xeSelect = this;
229
+ const props = $xeSelect;
230
+ return Object.assign({}, getConfig().select.optionConfig, props.optionConfig);
231
+ },
232
+ computeIsGroup() {
233
+ const $xeSelect = this;
234
+ const reactData = $xeSelect.reactData;
235
+ return reactData.fullGroupList.some((item) => item.options && item.options.length);
236
+ },
237
+ computeMultiMaxCharNum() {
238
+ const $xeSelect = this;
239
+ const props = $xeSelect;
240
+ return XEUtils.toNumber(props.multiCharOverflow);
241
+ },
242
+ computeSelectLabel() {
243
+ const $xeSelect = this;
244
+ const props = $xeSelect;
245
+ const { value, multiple, remote } = props;
246
+ const multiMaxCharNum = $xeSelect.computeMultiMaxCharNum;
247
+ if (value && multiple) {
248
+ const vals = XEUtils.isArray(value) ? value : [value];
249
+ if (remote) {
250
+ return vals.map(val => $xeSelect.getRemoteSelectLabel(val)).join(', ');
251
+ }
252
+ return vals.map((val) => {
253
+ const label = $xeSelect.getSelectLabel(val);
254
+ if (multiMaxCharNum > 0 && label.length > multiMaxCharNum) {
255
+ return `${label.substring(0, multiMaxCharNum)}...`;
256
+ }
257
+ return label;
258
+ }).join(', ');
259
+ }
260
+ if (remote) {
261
+ return $xeSelect.getRemoteSelectLabel(value);
262
+ }
263
+ return $xeSelect.getSelectLabel(value);
264
+ } }),
265
+ methods: {
266
+ //
267
+ // Method
268
+ //
269
+ dispatchEvent(type, params, evnt) {
270
+ const $xeSelect = this;
271
+ $xeSelect.$emit(type, createEvent(evnt, { $select: $xeSelect }, params));
272
+ },
273
+ emitModel(value) {
274
+ const $xeSelect = this;
275
+ $xeSelect.$emit('modelValue', value);
276
+ },
277
+ isPanelVisible() {
278
+ const $xeSelect = this;
279
+ const reactData = $xeSelect.reactData;
280
+ return reactData.visiblePanel;
281
+ },
282
+ togglePanel() {
283
+ const $xeSelect = this;
284
+ const reactData = $xeSelect.reactData;
285
+ if (reactData.visiblePanel) {
286
+ $xeSelect.hideOptionPanel();
287
+ }
288
+ else {
289
+ $xeSelect.showOptionPanel();
290
+ }
291
+ return $xeSelect.$nextTick();
292
+ },
293
+ hidePanel() {
294
+ const $xeSelect = this;
295
+ const reactData = $xeSelect.reactData;
296
+ if (reactData.visiblePanel) {
297
+ $xeSelect.hideOptionPanel();
298
+ }
299
+ return $xeSelect.$nextTick();
300
+ },
301
+ showPanel() {
302
+ const $xeSelect = this;
303
+ const reactData = $xeSelect.reactData;
304
+ if (!reactData.visiblePanel) {
305
+ $xeSelect.showOptionPanel();
306
+ }
307
+ return $xeSelect.$nextTick();
308
+ },
309
+ focus() {
310
+ const $xeSelect = this;
311
+ const reactData = $xeSelect.reactData;
312
+ const $input = $xeSelect.$refs.refInput;
313
+ reactData.isActivated = true;
314
+ $input.blur();
315
+ return $xeSelect.$nextTick();
316
+ },
317
+ blur() {
318
+ const $xeSelect = this;
319
+ const reactData = $xeSelect.reactData;
320
+ const $input = $xeSelect.$refs.refInput;
321
+ $input.blur();
322
+ reactData.isActivated = false;
323
+ return $xeSelect.$nextTick();
324
+ },
325
+ callSlot(slotFunc, params) {
326
+ const $xeSelect = this;
327
+ const slots = $xeSelect.$scopedSlots;
328
+ if (slotFunc) {
329
+ if (XEUtils.isString(slotFunc)) {
330
+ slotFunc = slots[slotFunc] || null;
331
+ }
332
+ if (XEUtils.isFunction(slotFunc)) {
333
+ return getSlotVNs(slotFunc(params));
334
+ }
335
+ }
336
+ return [];
337
+ },
338
+ findOption(optionValue) {
339
+ const $xeSelect = this;
340
+ const reactData = $xeSelect.reactData;
341
+ const { fullOptionList, fullGroupList } = reactData;
342
+ const isGroup = $xeSelect.computeIsGroup;
343
+ const valueField = $xeSelect.computeValueField;
344
+ if (isGroup) {
345
+ for (let gIndex = 0; gIndex < fullGroupList.length; gIndex++) {
346
+ const group = fullGroupList[gIndex];
347
+ if (group.options) {
348
+ for (let index = 0; index < group.options.length; index++) {
349
+ const option = group.options[index];
350
+ if (optionValue === option[valueField]) {
351
+ return option;
352
+ }
353
+ }
354
+ }
355
+ }
356
+ }
357
+ return fullOptionList.find((item) => optionValue === item[valueField]);
358
+ },
359
+ findVisibleOption(optionValue) {
360
+ const $xeSelect = this;
361
+ const reactData = $xeSelect.reactData;
362
+ const { visibleOptionList, visibleGroupList } = reactData;
363
+ const isGroup = $xeSelect.computeIsGroup;
364
+ const valueField = $xeSelect.computeValueField;
365
+ if (isGroup) {
366
+ for (let gIndex = 0; gIndex < visibleGroupList.length; gIndex++) {
367
+ const group = visibleGroupList[gIndex];
368
+ if (group.options) {
369
+ for (let index = 0; index < group.options.length; index++) {
370
+ const option = group.options[index];
371
+ if (optionValue === option[valueField]) {
372
+ return option;
373
+ }
374
+ }
375
+ }
376
+ }
377
+ }
378
+ return visibleOptionList.find((item) => optionValue === item[valueField]);
379
+ },
380
+ getRemoteSelectLabel(value) {
381
+ const $xeSelect = this;
382
+ const reactData = $xeSelect.reactData;
383
+ const { remoteValueList } = reactData;
384
+ const labelField = $xeSelect.computeLabelField;
385
+ const remoteItem = remoteValueList.find(item => value === item.key);
386
+ const item = remoteItem ? remoteItem.result : null;
387
+ return XEUtils.toValueString(item ? item[labelField] : value);
388
+ },
389
+ getSelectLabel(value) {
390
+ const $xeSelect = this;
391
+ const labelField = $xeSelect.computeLabelField;
392
+ const item = $xeSelect.findOption(value);
393
+ return XEUtils.toValueString(item ? item[labelField] : value);
394
+ },
395
+ getOptkey() {
396
+ const $xeSelect = this;
397
+ const props = $xeSelect;
398
+ const optionOpts = $xeSelect.computeOptionOpts;
399
+ return optionOpts.keyField || props.optionId || '_X_OPTION_KEY';
400
+ },
401
+ getOptid(option) {
402
+ const $xeSelect = this;
403
+ const optid = option[$xeSelect.getOptkey()];
404
+ return optid ? encodeURIComponent(optid) : '';
405
+ },
406
+ /**
407
+ * 刷新选项,当选项被动态显示/隐藏时可能会用到
408
+ */
409
+ refreshOption() {
410
+ const $xeSelect = this;
411
+ const props = $xeSelect;
412
+ const reactData = $xeSelect.reactData;
413
+ const { filterable, filterMethod } = props;
414
+ const { fullOptionList, fullGroupList, searchValue } = reactData;
415
+ const isGroup = $xeSelect.computeIsGroup;
416
+ const groupLabelField = $xeSelect.computeGroupLabelField;
417
+ const labelField = $xeSelect.computeLabelField;
418
+ const searchStr = `${searchValue || ''}`.toLowerCase();
419
+ if (isGroup) {
420
+ if (filterable && filterMethod) {
421
+ reactData.visibleGroupList = fullGroupList.filter(group => isOptionVisible(group) && filterMethod({ group, option: null, searchValue: searchStr }));
422
+ }
423
+ else if (filterable) {
424
+ reactData.visibleGroupList = fullGroupList.filter(group => isOptionVisible(group) && (!searchStr || `${group[groupLabelField]}`.toLowerCase().indexOf(searchStr) > -1));
425
+ }
426
+ else {
427
+ reactData.visibleGroupList = fullGroupList.filter(isOptionVisible);
428
+ }
429
+ }
430
+ else {
431
+ if (filterable && filterMethod) {
432
+ reactData.visibleOptionList = fullOptionList.filter(option => isOptionVisible(option) && filterMethod({ group: null, option, searchValue: searchStr }));
433
+ }
434
+ else if (filterable) {
435
+ reactData.visibleOptionList = fullOptionList.filter(option => isOptionVisible(option) && (!searchStr || `${option[labelField]}`.toLowerCase().indexOf(searchStr) > -1));
436
+ }
437
+ else {
438
+ reactData.visibleOptionList = fullOptionList.filter(isOptionVisible);
439
+ }
440
+ }
441
+ return $xeSelect.$nextTick();
442
+ },
443
+ cacheItemMap() {
444
+ const $xeSelect = this;
445
+ const reactData = $xeSelect.reactData;
446
+ const { fullOptionList, fullGroupList } = reactData;
447
+ const groupOptionsField = $xeSelect.computeGroupOptionsField;
448
+ const key = $xeSelect.getOptkey();
449
+ const handleOptis = (item) => {
450
+ if (!$xeSelect.getOptid(item)) {
451
+ item[key] = getOptUniqueId();
452
+ }
453
+ };
454
+ if (fullGroupList.length) {
455
+ fullGroupList.forEach((group) => {
456
+ handleOptis(group);
457
+ if (group[groupOptionsField]) {
458
+ group[groupOptionsField].forEach(handleOptis);
459
+ }
460
+ });
461
+ }
462
+ else if (fullOptionList.length) {
463
+ fullOptionList.forEach(handleOptis);
464
+ }
465
+ $xeSelect.refreshOption();
466
+ },
467
+ setCurrentOption(option) {
468
+ const $xeSelect = this;
469
+ const reactData = $xeSelect.reactData;
470
+ const valueField = $xeSelect.computeValueField;
471
+ if (option) {
472
+ reactData.currentOption = option;
473
+ reactData.currentValue = option[valueField];
474
+ }
475
+ },
476
+ scrollToOption(option, isAlignBottom) {
477
+ const $xeSelect = this;
478
+ return $xeSelect.$nextTick().then(() => {
479
+ if (option) {
480
+ const optWrapperElem = $xeSelect.$refs.refOptionWrapper;
481
+ const panelElem = $xeSelect.$refs.refOptionPanel;
482
+ const optElem = panelElem.querySelector(`[optid='${$xeSelect.getOptid(option)}']`);
483
+ if (optWrapperElem && optElem) {
484
+ const wrapperHeight = optWrapperElem.offsetHeight;
485
+ const offsetPadding = 5;
486
+ if (isAlignBottom) {
487
+ if (optElem.offsetTop + optElem.offsetHeight - optWrapperElem.scrollTop > wrapperHeight) {
488
+ optWrapperElem.scrollTop = optElem.offsetTop + optElem.offsetHeight - wrapperHeight;
489
+ }
490
+ }
491
+ else {
492
+ if (optElem.offsetTop + offsetPadding < optWrapperElem.scrollTop || optElem.offsetTop + offsetPadding > optWrapperElem.scrollTop + optWrapperElem.clientHeight) {
493
+ optWrapperElem.scrollTop = optElem.offsetTop - offsetPadding;
494
+ }
495
+ }
496
+ }
497
+ }
498
+ });
499
+ },
500
+ updateZindex() {
501
+ const $xeSelect = this;
502
+ const reactData = $xeSelect.reactData;
503
+ if (reactData.panelIndex < getLastZIndex()) {
504
+ reactData.panelIndex = nextZIndex();
505
+ }
506
+ },
507
+ updatePlacement() {
508
+ const $xeSelect = this;
509
+ const props = $xeSelect;
510
+ const reactData = $xeSelect.reactData;
511
+ return $xeSelect.$nextTick().then(() => {
512
+ const { placement } = props;
513
+ const { panelIndex } = reactData;
514
+ const el = $xeSelect.$refs.refElem;
515
+ const panelElem = $xeSelect.$refs.refOptionPanel;
516
+ const btnTransfer = $xeSelect.computeBtnTransfer;
517
+ if (panelElem && el) {
518
+ const targetHeight = el.offsetHeight;
519
+ const targetWidth = el.offsetWidth;
520
+ const panelHeight = panelElem.offsetHeight;
521
+ const panelWidth = panelElem.offsetWidth;
522
+ const marginSize = 5;
523
+ const panelStyle = {
524
+ zIndex: panelIndex
525
+ };
526
+ const { boundingTop, boundingLeft, visibleHeight, visibleWidth } = getAbsolutePos(el);
527
+ let panelPlacement = 'bottom';
528
+ if (btnTransfer) {
529
+ let left = boundingLeft;
530
+ let top = boundingTop + targetHeight;
531
+ if (placement === 'top') {
532
+ panelPlacement = 'top';
533
+ top = boundingTop - panelHeight;
534
+ }
535
+ else if (!placement) {
536
+ // 如果下面不够放,则向上
537
+ if (top + panelHeight + marginSize > visibleHeight) {
538
+ panelPlacement = 'top';
539
+ top = boundingTop - panelHeight;
540
+ }
541
+ // 如果上面不够放,则向下(优先)
542
+ if (top < marginSize) {
543
+ panelPlacement = 'bottom';
544
+ top = boundingTop + targetHeight;
545
+ }
546
+ }
547
+ // 如果溢出右边
548
+ if (left + panelWidth + marginSize > visibleWidth) {
549
+ left -= left + panelWidth + marginSize - visibleWidth;
550
+ }
551
+ // 如果溢出左边
552
+ if (left < marginSize) {
553
+ left = marginSize;
554
+ }
555
+ Object.assign(panelStyle, {
556
+ left: `${left}px`,
557
+ top: `${top}px`,
558
+ minWidth: `${targetWidth}px`
559
+ });
560
+ }
561
+ else {
562
+ if (placement === 'top') {
563
+ panelPlacement = 'top';
564
+ panelStyle.bottom = `${targetHeight}px`;
565
+ }
566
+ else if (!placement) {
567
+ // 如果下面不够放,则向上
568
+ if (boundingTop + targetHeight + panelHeight > visibleHeight) {
569
+ // 如果上面不够放,则向下(优先)
570
+ if (boundingTop - targetHeight - panelHeight > marginSize) {
571
+ panelPlacement = 'top';
572
+ panelStyle.bottom = `${targetHeight}px`;
573
+ }
574
+ }
575
+ }
576
+ }
577
+ reactData.panelStyle = panelStyle;
578
+ reactData.panelPlacement = panelPlacement;
579
+ return $xeSelect.$nextTick();
580
+ }
581
+ });
582
+ },
583
+ showOptionPanel() {
584
+ const $xeSelect = this;
585
+ const props = $xeSelect;
586
+ const reactData = $xeSelect.reactData;
587
+ const internalData = $xeSelect.internalData;
588
+ const { loading, filterable } = props;
589
+ const { hpTimeout } = internalData;
590
+ const isDisabled = $xeSelect.computeIsDisabled;
591
+ if (!loading && !isDisabled) {
592
+ if (hpTimeout) {
593
+ clearTimeout(hpTimeout);
594
+ internalData.hpTimeout = undefined;
595
+ }
596
+ if (!reactData.initialized) {
597
+ reactData.initialized = true;
598
+ const btnTransfer = $xeSelect.computeBtnTransfer;
599
+ const panelElem = $xeSelect.$refs.refOptionPanel;
600
+ if (btnTransfer) {
601
+ if (panelElem) {
602
+ document.body.appendChild(panelElem);
603
+ }
604
+ }
605
+ }
606
+ reactData.isActivated = true;
607
+ reactData.isAniVisible = true;
608
+ if (filterable) {
609
+ $xeSelect.refreshOption();
610
+ }
611
+ setTimeout(() => {
612
+ const { value } = props;
613
+ const currOption = $xeSelect.findOption(XEUtils.isArray(value) ? value[0] : value);
614
+ reactData.visiblePanel = true;
615
+ if (currOption) {
616
+ $xeSelect.setCurrentOption(currOption);
617
+ $xeSelect.scrollToOption(currOption);
618
+ }
619
+ $xeSelect.handleFocusSearch();
620
+ }, 10);
621
+ $xeSelect.updateZindex();
622
+ $xeSelect.updatePlacement();
623
+ }
624
+ },
625
+ hideOptionPanel() {
626
+ const $xeSelect = this;
627
+ const reactData = $xeSelect.reactData;
628
+ const internalData = $xeSelect.internalData;
629
+ reactData.searchValue = '';
630
+ reactData.searchLoading = false;
631
+ reactData.visiblePanel = false;
632
+ internalData.hpTimeout = window.setTimeout(() => {
633
+ reactData.isAniVisible = false;
634
+ }, 350);
635
+ },
636
+ changeEvent(evnt, selectValue) {
637
+ const $xeSelect = this;
638
+ const props = $xeSelect;
639
+ const $xeForm = $xeSelect.$xeForm;
640
+ const formItemInfo = $xeSelect.formItemInfo;
641
+ $xeSelect.emitModel(selectValue);
642
+ if (selectValue !== props.value) {
643
+ $xeSelect.dispatchEvent('change', { value: selectValue }, evnt);
644
+ // 自动更新校验状态
645
+ if ($xeForm && formItemInfo) {
646
+ $xeForm.triggerItemEvent(evnt, formItemInfo.itemConfig.field, selectValue);
647
+ }
648
+ }
649
+ },
650
+ clearValueEvent(evnt, selectValue) {
651
+ const $xeSelect = this;
652
+ const reactData = $xeSelect.reactData;
653
+ reactData.remoteValueList = [];
654
+ $xeSelect.changeEvent(evnt, selectValue);
655
+ $xeSelect.dispatchEvent('clear', { value: selectValue }, evnt);
656
+ },
657
+ clearEvent(params, evnt) {
658
+ const $xeSelect = this;
659
+ $xeSelect.clearValueEvent(evnt, null);
660
+ $xeSelect.hideOptionPanel();
661
+ },
662
+ changeOptionEvent(evnt, selectValue, option) {
663
+ const $xeSelect = this;
664
+ const props = $xeSelect;
665
+ const reactData = $xeSelect.reactData;
666
+ const { value, multiple } = props;
667
+ const { remoteValueList } = reactData;
668
+ if (multiple) {
669
+ let multipleValue = [];
670
+ const selectVals = XEUtils.eqNull(value) ? [] : (XEUtils.isArray(value) ? value : [value]);
671
+ const index = XEUtils.findIndexOf(selectVals, val => val === selectValue);
672
+ if (index === -1) {
673
+ multipleValue = selectVals.concat([selectValue]);
674
+ }
675
+ else {
676
+ multipleValue = selectVals.filter((val) => val !== selectValue);
677
+ }
678
+ const remoteItem = remoteValueList.find(item => item.key === selectValue);
679
+ if (remoteItem) {
680
+ remoteItem.result = option;
681
+ }
682
+ else {
683
+ remoteValueList.push({ key: selectValue, result: option });
684
+ }
685
+ $xeSelect.changeEvent(evnt, multipleValue);
686
+ }
687
+ else {
688
+ reactData.remoteValueList = [{ key: selectValue, result: option }];
689
+ $xeSelect.changeEvent(evnt, selectValue);
690
+ $xeSelect.hideOptionPanel();
691
+ }
692
+ },
693
+ handleGlobalMousewheelEvent(evnt) {
694
+ const $xeSelect = this;
695
+ const reactData = $xeSelect.reactData;
696
+ const { visiblePanel } = reactData;
697
+ const isDisabled = $xeSelect.computeIsDisabled;
698
+ if (!isDisabled) {
699
+ if (visiblePanel) {
700
+ const panelElem = $xeSelect.$refs.refOptionPanel;
701
+ if (getEventTargetNode(evnt, panelElem).flag) {
702
+ $xeSelect.updatePlacement();
703
+ }
704
+ else {
705
+ $xeSelect.hideOptionPanel();
706
+ }
707
+ }
708
+ }
709
+ },
710
+ handleGlobalMousedownEvent(evnt) {
711
+ const $xeSelect = this;
712
+ const reactData = $xeSelect.reactData;
713
+ const { visiblePanel } = reactData;
714
+ const isDisabled = $xeSelect.computeIsDisabled;
715
+ if (!isDisabled) {
716
+ const el = $xeSelect.$refs.refElem;
717
+ const panelElem = $xeSelect.$refs.refOptionPanel;
718
+ reactData.isActivated = getEventTargetNode(evnt, el).flag || getEventTargetNode(evnt, panelElem).flag;
719
+ if (visiblePanel && !reactData.isActivated) {
720
+ $xeSelect.hideOptionPanel();
721
+ }
722
+ }
723
+ },
724
+ findOffsetOption(optionValue, isUpArrow) {
725
+ const $xeSelect = this;
726
+ const reactData = $xeSelect.reactData;
727
+ const { visibleOptionList, visibleGroupList } = reactData;
728
+ const isGroup = $xeSelect.computeIsGroup;
729
+ const valueField = $xeSelect.computeValueField;
730
+ const groupOptionsField = $xeSelect.computeGroupOptionsField;
731
+ let firstOption;
732
+ let prevOption;
733
+ let nextOption;
734
+ let currOption;
735
+ if (isGroup) {
736
+ for (let gIndex = 0; gIndex < visibleGroupList.length; gIndex++) {
737
+ const group = visibleGroupList[gIndex];
738
+ const groupOptionList = group[groupOptionsField];
739
+ const isGroupDisabled = group.disabled;
740
+ if (groupOptionList) {
741
+ for (let index = 0; index < groupOptionList.length; index++) {
742
+ const option = groupOptionList[index];
743
+ const isVisible = isOptionVisible(option);
744
+ const isDisabled = isGroupDisabled || option.disabled;
745
+ if (!firstOption && !isDisabled) {
746
+ firstOption = option;
747
+ }
748
+ if (currOption) {
749
+ if (isVisible && !isDisabled) {
750
+ nextOption = option;
751
+ if (!isUpArrow) {
752
+ return { offsetOption: nextOption };
753
+ }
754
+ }
755
+ }
756
+ if (optionValue === option[valueField]) {
757
+ currOption = option;
758
+ if (isUpArrow) {
759
+ return { offsetOption: prevOption };
760
+ }
761
+ }
762
+ else {
763
+ if (isVisible && !isDisabled) {
764
+ prevOption = option;
765
+ }
766
+ }
767
+ }
768
+ }
769
+ }
770
+ }
771
+ else {
772
+ for (let index = 0; index < visibleOptionList.length; index++) {
773
+ const option = visibleOptionList[index];
774
+ const isDisabled = option.disabled;
775
+ if (!firstOption && !isDisabled) {
776
+ firstOption = option;
777
+ }
778
+ if (currOption) {
779
+ if (!isDisabled) {
780
+ nextOption = option;
781
+ if (!isUpArrow) {
782
+ return { offsetOption: nextOption };
783
+ }
784
+ }
785
+ }
786
+ if (optionValue === option[valueField]) {
787
+ currOption = option;
788
+ if (isUpArrow) {
789
+ return { offsetOption: prevOption };
790
+ }
791
+ }
792
+ else {
793
+ if (!isDisabled) {
794
+ prevOption = option;
795
+ }
796
+ }
797
+ }
798
+ }
799
+ return { firstOption };
800
+ },
801
+ handleGlobalKeydownEvent(evnt) {
802
+ const $xeSelect = this;
803
+ const props = $xeSelect;
804
+ const reactData = $xeSelect.reactData;
805
+ const { clearable } = props;
806
+ const { visiblePanel, currentValue, currentOption } = reactData;
807
+ const isDisabled = $xeSelect.computeIsDisabled;
808
+ if (!isDisabled) {
809
+ const isTab = globalEvents.hasKey(evnt, GLOBAL_EVENT_KEYS.TAB);
810
+ const isEnter = globalEvents.hasKey(evnt, GLOBAL_EVENT_KEYS.ENTER);
811
+ const isEsc = globalEvents.hasKey(evnt, GLOBAL_EVENT_KEYS.ESCAPE);
812
+ const isUpArrow = globalEvents.hasKey(evnt, GLOBAL_EVENT_KEYS.ARROW_UP);
813
+ const isDwArrow = globalEvents.hasKey(evnt, GLOBAL_EVENT_KEYS.ARROW_DOWN);
814
+ const isDel = globalEvents.hasKey(evnt, GLOBAL_EVENT_KEYS.DELETE);
815
+ const isSpacebar = globalEvents.hasKey(evnt, GLOBAL_EVENT_KEYS.SPACEBAR);
816
+ if (isTab) {
817
+ reactData.isActivated = false;
818
+ }
819
+ if (visiblePanel) {
820
+ if (isEsc || isTab) {
821
+ $xeSelect.hideOptionPanel();
822
+ }
823
+ else if (isEnter) {
824
+ evnt.preventDefault();
825
+ evnt.stopPropagation();
826
+ $xeSelect.changeOptionEvent(evnt, currentValue, currentOption);
827
+ }
828
+ else if (isUpArrow || isDwArrow) {
829
+ evnt.preventDefault();
830
+ let { firstOption, offsetOption } = $xeSelect.findOffsetOption(currentValue, isUpArrow);
831
+ if (!offsetOption && !$xeSelect.findVisibleOption(currentValue)) {
832
+ offsetOption = firstOption;
833
+ }
834
+ $xeSelect.setCurrentOption(offsetOption);
835
+ $xeSelect.scrollToOption(offsetOption, isDwArrow);
836
+ }
837
+ else if (isSpacebar) {
838
+ evnt.preventDefault();
839
+ }
840
+ }
841
+ else if ((isUpArrow || isDwArrow || isEnter || isSpacebar) && reactData.isActivated) {
842
+ evnt.preventDefault();
843
+ $xeSelect.showOptionPanel();
844
+ }
845
+ if (reactData.isActivated) {
846
+ if (isDel && clearable) {
847
+ $xeSelect.clearValueEvent(evnt, null);
848
+ }
849
+ }
850
+ }
851
+ },
852
+ handleGlobalBlurEvent() {
853
+ const $xeSelect = this;
854
+ $xeSelect.hideOptionPanel();
855
+ },
856
+ handleFocusSearch() {
857
+ const $xeSelect = this;
858
+ const props = $xeSelect;
859
+ if (props.filterable) {
860
+ $xeSelect.$nextTick(() => {
861
+ const inpSearch = $xeSelect.$refs.refInpSearch;
862
+ if (inpSearch) {
863
+ inpSearch.focus();
864
+ }
865
+ });
866
+ }
867
+ },
868
+ focusEvent(evnt) {
869
+ const $xeSelect = this;
870
+ const reactData = $xeSelect.reactData;
871
+ const isDisabled = $xeSelect.computeIsDisabled;
872
+ if (!isDisabled) {
873
+ if (!reactData.visiblePanel) {
874
+ reactData.triggerFocusPanel = true;
875
+ $xeSelect.showOptionPanel();
876
+ setTimeout(() => {
877
+ reactData.triggerFocusPanel = false;
878
+ }, 150);
879
+ }
880
+ }
881
+ $xeSelect.dispatchEvent('focus', {}, evnt);
882
+ },
883
+ clickEvent(evnt) {
884
+ const $xeSelect = this;
885
+ $xeSelect.togglePanelEvent(evnt);
886
+ $xeSelect.dispatchEvent('click', {}, evnt);
887
+ },
888
+ blurEvent(evnt) {
889
+ const $xeSelect = this;
890
+ const reactData = $xeSelect.reactData;
891
+ reactData.isActivated = false;
892
+ $xeSelect.dispatchEvent('blur', {}, evnt);
893
+ },
894
+ modelSearchEvent(value) {
895
+ const $xeSelect = this;
896
+ const reactData = $xeSelect.reactData;
897
+ reactData.searchValue = value;
898
+ },
899
+ focusSearchEvent() {
900
+ const $xeSelect = this;
901
+ const reactData = $xeSelect.reactData;
902
+ reactData.isActivated = true;
903
+ },
904
+ handleSearchEvent() {
905
+ const $xeSelect = this;
906
+ const props = $xeSelect;
907
+ const reactData = $xeSelect.reactData;
908
+ const { remote, remoteMethod } = props;
909
+ const { searchValue } = reactData;
910
+ if (remote && remoteMethod) {
911
+ reactData.searchLoading = true;
912
+ Promise.resolve(remoteMethod({ searchValue })).then(() => $xeSelect.$nextTick())
913
+ .catch(() => $xeSelect.$nextTick())
914
+ .finally(() => {
915
+ reactData.searchLoading = false;
916
+ $xeSelect.refreshOption();
917
+ });
918
+ }
919
+ else {
920
+ $xeSelect.refreshOption();
921
+ }
922
+ },
923
+ triggerSearchEvent: XEUtils.debounce(function () {
924
+ const $xeSelect = this;
925
+ $xeSelect.handleSearchEvent();
926
+ }, 350, { trailing: true }),
927
+ togglePanelEvent(params) {
928
+ const $xeSelect = this;
929
+ const reactData = $xeSelect.reactData;
930
+ const { $event } = params;
931
+ $event.preventDefault();
932
+ if (reactData.triggerFocusPanel) {
933
+ reactData.triggerFocusPanel = false;
934
+ }
935
+ else {
936
+ if (reactData.visiblePanel) {
937
+ $xeSelect.hideOptionPanel();
938
+ }
939
+ else {
940
+ $xeSelect.showOptionPanel();
941
+ }
942
+ }
943
+ },
944
+ checkOptionDisabled(isSelected, option, group) {
945
+ const $xeSelect = this;
946
+ if (option.disabled) {
947
+ return true;
948
+ }
949
+ if (group && group.disabled) {
950
+ return true;
951
+ }
952
+ const isMaximize = $xeSelect.computeIsMaximize;
953
+ if (isMaximize && !isSelected) {
954
+ return true;
955
+ }
956
+ return false;
957
+ },
958
+ //
959
+ // Render
960
+ //
961
+ renderOption(h, list, group) {
962
+ const $xeSelect = this;
963
+ const props = $xeSelect;
964
+ const slots = $xeSelect.$scopedSlots;
965
+ const reactData = $xeSelect.reactData;
966
+ const { optionKey, value } = props;
967
+ const { currentValue } = reactData;
968
+ const optionOpts = $xeSelect.computeOptionOpts;
969
+ const labelField = $xeSelect.computeLabelField;
970
+ const valueField = $xeSelect.computeValueField;
971
+ const isGroup = $xeSelect.computeIsGroup;
972
+ const { useKey } = optionOpts;
973
+ const optionSlot = slots.option;
974
+ return list.map((option, cIndex) => {
975
+ const { slots, className } = option;
976
+ const optionValue = option[valueField];
977
+ const isSelected = XEUtils.isArray(value) ? value.indexOf(optionValue) > -1 : value === optionValue;
978
+ const isVisible = !isGroup || isOptionVisible(option);
979
+ const isDisabled = $xeSelect.checkOptionDisabled(isSelected, option, group);
980
+ const optid = $xeSelect.getOptid(option);
981
+ const defaultSlot = slots ? slots.default : null;
982
+ const optParams = { option, group: null, $select: $xeSelect };
983
+ return isVisible
984
+ ? h('div', {
985
+ key: useKey || optionKey ? optid : cIndex,
986
+ class: ['vxe-select-option', className ? (XEUtils.isFunction(className) ? className(optParams) : className) : '', {
987
+ 'is--disabled': isDisabled,
988
+ 'is--selected': isSelected,
989
+ 'is--hover': currentValue === optionValue
990
+ }],
991
+ attrs: {
992
+ optid: optid
993
+ },
994
+ on: {
995
+ mousedown: (evnt) => {
996
+ const isLeftBtn = evnt.button === 0;
997
+ if (isLeftBtn) {
998
+ evnt.stopPropagation();
999
+ }
1000
+ },
1001
+ click: (evnt) => {
1002
+ if (!isDisabled) {
1003
+ $xeSelect.changeOptionEvent(evnt, optionValue, option);
1004
+ }
1005
+ },
1006
+ mouseenter: () => {
1007
+ if (!isDisabled) {
1008
+ $xeSelect.setCurrentOption(option);
1009
+ }
1010
+ }
1011
+ }
1012
+ }, optionSlot ? $xeSelect.callSlot(optionSlot, optParams) : (defaultSlot ? $xeSelect.callSlot(defaultSlot, optParams) : getFuncText(option[labelField])))
1013
+ : renderEmptyElement($xeSelect);
1014
+ });
1015
+ },
1016
+ renderOptgroup(h) {
1017
+ const $xeSelect = this;
1018
+ const props = $xeSelect;
1019
+ const slots = $xeSelect.$scopedSlots;
1020
+ const reactData = $xeSelect.reactData;
1021
+ const { optionKey } = props;
1022
+ const { visibleGroupList } = reactData;
1023
+ const optionOpts = $xeSelect.computeOptionOpts;
1024
+ const groupLabelField = $xeSelect.computeGroupLabelField;
1025
+ const groupOptionsField = $xeSelect.computeGroupOptionsField;
1026
+ const { useKey } = optionOpts;
1027
+ const optionSlot = slots.option;
1028
+ return visibleGroupList.map((group, gIndex) => {
1029
+ const { slots, className } = group;
1030
+ const optid = $xeSelect.getOptid(group);
1031
+ const isGroupDisabled = group.disabled;
1032
+ const defaultSlot = slots ? slots.default : null;
1033
+ const optParams = { option: group, group, $select: $xeSelect };
1034
+ return h('div', {
1035
+ key: useKey || optionKey ? optid : gIndex,
1036
+ class: ['vxe-optgroup', className ? (XEUtils.isFunction(className) ? className(optParams) : className) : '', {
1037
+ 'is--disabled': isGroupDisabled
1038
+ }],
1039
+ attrs: {
1040
+ optid: optid
1041
+ }
1042
+ }, [
1043
+ h('div', {
1044
+ class: 'vxe-optgroup--title'
1045
+ }, optionSlot ? $xeSelect.callSlot(optionSlot, optParams) : (defaultSlot ? $xeSelect.callSlot(defaultSlot, optParams) : getFuncText(group[groupLabelField]))),
1046
+ h('div', {
1047
+ class: 'vxe-optgroup--wrapper'
1048
+ }, $xeSelect.renderOption(h, group[groupOptionsField] || [], group))
1049
+ ]);
1050
+ });
1051
+ },
1052
+ renderOpts(h) {
1053
+ const $xeSelect = this;
1054
+ const props = $xeSelect;
1055
+ const reactData = $xeSelect.reactData;
1056
+ const { visibleGroupList, visibleOptionList, searchLoading } = reactData;
1057
+ const isGroup = $xeSelect.computeIsGroup;
1058
+ if (searchLoading) {
1059
+ return [
1060
+ h('div', {
1061
+ class: 'vxe-select--search-loading'
1062
+ }, [
1063
+ h('i', {
1064
+ class: ['vxe-select--search-icon', getIcon().SELECT_LOADED]
1065
+ }),
1066
+ h('span', {
1067
+ class: 'vxe-select--search-text'
1068
+ }, getI18n('vxe.select.loadingText'))
1069
+ ])
1070
+ ];
1071
+ }
1072
+ if (isGroup) {
1073
+ if (visibleGroupList.length) {
1074
+ return $xeSelect.renderOptgroup(h);
1075
+ }
1076
+ }
1077
+ else {
1078
+ if (visibleOptionList.length) {
1079
+ return $xeSelect.renderOption(h, visibleOptionList);
1080
+ }
1081
+ }
1082
+ return [
1083
+ h('div', {
1084
+ class: 'vxe-select--empty-placeholder'
1085
+ }, props.emptyText || getI18n('vxe.select.emptyText'))
1086
+ ];
1087
+ },
1088
+ renderVN(h) {
1089
+ const $xeSelect = this;
1090
+ const props = $xeSelect;
1091
+ const slots = $xeSelect.$scopedSlots;
1092
+ const reactData = $xeSelect.reactData;
1093
+ const { className, popupClassName, loading, filterable } = props;
1094
+ const { initialized, isActivated, visiblePanel } = reactData;
1095
+ const vSize = $xeSelect.computeSize;
1096
+ const isDisabled = $xeSelect.computeIsDisabled;
1097
+ const selectLabel = $xeSelect.computeSelectLabel;
1098
+ const btnTransfer = $xeSelect.computeBtnTransfer;
1099
+ const formReadonly = $xeSelect.computeFormReadonly;
1100
+ const inpPlaceholder = $xeSelect.computeInpPlaceholder;
1101
+ const defaultSlot = slots.default;
1102
+ const headerSlot = slots.header;
1103
+ const footerSlot = slots.footer;
1104
+ const prefixSlot = slots.prefix;
1105
+ if (formReadonly) {
1106
+ return h('div', {
1107
+ ref: 'refElem',
1108
+ class: ['vxe-select--readonly', className]
1109
+ }, [
1110
+ h('div', {
1111
+ class: 'vxe-select-slots',
1112
+ ref: 'hideOption'
1113
+ }, defaultSlot ? defaultSlot({}) : []),
1114
+ h('span', {
1115
+ class: 'vxe-select-label'
1116
+ }, [selectLabel])
1117
+ ]);
1118
+ }
1119
+ return h('div', {
1120
+ ref: 'refElem',
1121
+ class: ['vxe-select', className ? (XEUtils.isFunction(className) ? className({ $select: $xeSelect }) : className) : '', {
1122
+ [`size--${vSize}`]: vSize,
1123
+ 'is--visible': visiblePanel,
1124
+ 'is--disabled': isDisabled,
1125
+ 'is--filter': filterable,
1126
+ 'is--loading': loading,
1127
+ 'is--active': isActivated
1128
+ }]
1129
+ }, [
1130
+ h('div', {
1131
+ class: 'vxe-select-slots',
1132
+ ref: 'hideOption'
1133
+ }, defaultSlot ? defaultSlot({}) : []),
1134
+ h(VxeInputComponent, {
1135
+ ref: 'refInput',
1136
+ props: {
1137
+ clearable: props.clearable,
1138
+ placeholder: inpPlaceholder,
1139
+ readonly: true,
1140
+ disabled: isDisabled,
1141
+ type: 'text',
1142
+ prefixIcon: props.prefixIcon,
1143
+ suffixIcon: loading ? getIcon().SELECT_LOADED : (visiblePanel ? getIcon().SELECT_OPEN : getIcon().SELECT_CLOSE),
1144
+ value: selectLabel
1145
+ },
1146
+ on: {
1147
+ clear: $xeSelect.clearEvent,
1148
+ click: $xeSelect.clickEvent,
1149
+ focus: $xeSelect.focusEvent,
1150
+ blur: $xeSelect.blurEvent,
1151
+ suffixClick: $xeSelect.togglePanelEvent
1152
+ },
1153
+ scopedSlots: prefixSlot
1154
+ ? {
1155
+ prefix: () => prefixSlot({})
1156
+ }
1157
+ : {}
1158
+ }),
1159
+ h('div', {
1160
+ ref: 'refOptionPanel',
1161
+ class: ['vxe-table--ignore-clear vxe-select--panel', popupClassName ? (XEUtils.isFunction(popupClassName) ? popupClassName({ $select: $xeSelect }) : popupClassName) : '', {
1162
+ [`size--${vSize}`]: vSize,
1163
+ 'is--transfer': btnTransfer,
1164
+ 'ani--leave': !loading && reactData.isAniVisible,
1165
+ 'ani--enter': !loading && visiblePanel
1166
+ }],
1167
+ attrs: {
1168
+ placement: reactData.panelPlacement
1169
+ },
1170
+ style: reactData.panelStyle
1171
+ }, initialized
1172
+ ? [
1173
+ filterable
1174
+ ? h('div', {
1175
+ class: 'vxe-select--panel-search'
1176
+ }, [
1177
+ h(VxeInputComponent, {
1178
+ ref: 'refInpSearch',
1179
+ class: 'vxe-select-search--input',
1180
+ props: {
1181
+ value: reactData.searchValue,
1182
+ clearable: true,
1183
+ placeholder: getI18n('vxe.select.search'),
1184
+ prefixIcon: getIcon().INPUT_SEARCH
1185
+ },
1186
+ on: {
1187
+ modelValue: $xeSelect.modelSearchEvent,
1188
+ focus: $xeSelect.focusSearchEvent,
1189
+ change: $xeSelect.triggerSearchEvent,
1190
+ search: $xeSelect.triggerSearchEvent
1191
+ }
1192
+ })
1193
+ ])
1194
+ : renderEmptyElement($xeSelect),
1195
+ h('div', {
1196
+ class: 'vxe-select--panel-wrapper'
1197
+ }, [
1198
+ headerSlot
1199
+ ? h('div', {
1200
+ class: 'vxe-select--panel-header'
1201
+ }, headerSlot({}))
1202
+ : renderEmptyElement($xeSelect),
1203
+ h('div', {
1204
+ class: 'vxe-select--panel-body'
1205
+ }, [
1206
+ h('div', {
1207
+ ref: 'refOptionWrapper',
1208
+ class: 'vxe-select-option--wrapper'
1209
+ }, $xeSelect.renderOpts(h))
1210
+ ]),
1211
+ footerSlot
1212
+ ? h('div', {
1213
+ class: 'vxe-select--panel-footer'
1214
+ }, footerSlot({}))
1215
+ : renderEmptyElement($xeSelect)
1216
+ ])
1217
+ ]
1218
+ : [])
1219
+ ]);
1220
+ }
1221
+ },
1222
+ watch: {
1223
+ 'reactData.staticOptions'(val) {
1224
+ const $xeSelect = this;
1225
+ const reactData = $xeSelect.reactData;
1226
+ if (val.some((item) => item.options && item.options.length)) {
1227
+ reactData.fullOptionList = [];
1228
+ reactData.fullGroupList = val;
1229
+ }
1230
+ else {
1231
+ reactData.fullGroupList = [];
1232
+ reactData.fullOptionList = val || [];
1233
+ }
1234
+ $xeSelect.cacheItemMap();
1235
+ },
1236
+ options(val) {
1237
+ const $xeSelect = this;
1238
+ const reactData = $xeSelect.reactData;
1239
+ reactData.fullGroupList = [];
1240
+ reactData.fullOptionList = val || [];
1241
+ $xeSelect.cacheItemMap();
1242
+ },
1243
+ optionGroups(val) {
1244
+ const $xeSelect = this;
1245
+ const reactData = $xeSelect.reactData;
1246
+ reactData.fullOptionList = [];
1247
+ reactData.fullGroupList = val || [];
1248
+ $xeSelect.cacheItemMap();
1249
+ }
1250
+ },
1251
+ mounted() {
1252
+ const $xeSelect = this;
1253
+ const props = $xeSelect;
1254
+ const reactData = $xeSelect.reactData;
1255
+ $xeSelect.$nextTick(() => {
1256
+ const { options, optionGroups } = props;
1257
+ if (optionGroups) {
1258
+ reactData.fullGroupList = optionGroups;
1259
+ }
1260
+ else if (options) {
1261
+ reactData.fullOptionList = options;
1262
+ }
1263
+ $xeSelect.cacheItemMap();
1264
+ });
1265
+ globalEvents.on($xeSelect, 'mousewheel', $xeSelect.handleGlobalMousewheelEvent);
1266
+ globalEvents.on($xeSelect, 'mousedown', $xeSelect.handleGlobalMousedownEvent);
1267
+ globalEvents.on($xeSelect, 'keydown', $xeSelect.handleGlobalKeydownEvent);
1268
+ globalEvents.on($xeSelect, 'blur', $xeSelect.handleGlobalBlurEvent);
1269
+ },
1270
+ beforeDestroy() {
1271
+ const $xeSelect = this;
1272
+ const panelElem = $xeSelect.$refs.refOptionPanel;
1273
+ if (panelElem && panelElem.parentNode) {
1274
+ panelElem.parentNode.removeChild(panelElem);
1275
+ }
1276
+ globalEvents.off($xeSelect, 'mousewheel');
1277
+ globalEvents.off($xeSelect, 'mousedown');
1278
+ globalEvents.off($xeSelect, 'keydown');
1279
+ globalEvents.off($xeSelect, 'blur');
1280
+ },
1281
+ render(h) {
1282
+ return this.renderVN(h);
1283
+ }
1284
+ });