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,3000 @@
1
+ import { PropType, CreateElement, VNode } from 'vue'
2
+ import { defineVxeComponent } from '../../ui/src/comp'
3
+ import XEUtils from 'xe-utils'
4
+ import { getConfig, getIcon, getI18n, globalEvents, GLOBAL_EVENT_KEYS, createEvent, globalMixins, renderEmptyElement } from '../../ui'
5
+ import { getFuncText, getLastZIndex, nextZIndex } from '../../ui/src/utils'
6
+ import { hasClass, getAbsolutePos, getEventTargetNode } from '../../ui/src/dom'
7
+ import { toStringTimeDate, getDateQuarter } from '../../date-picker/src/util'
8
+ import { handleNumber, toFloatValueFixed } from '../../number-input/src/util'
9
+ import { getSlotVNs } from '../..//ui/src/vn'
10
+
11
+ import type { VxeInputConstructor, VxeInputEmits, InputInternalData, InputReactData, ValueOf, VxeInputPropTypes, VxeComponentStyleType, VxeFormConstructor, VxeFormPrivateMethods, VxeFormDefines, VxeComponentSizeType, VxeTableConstructor, VxeTablePrivateMethods, VxeDrawerConstructor, VxeDrawerMethods, VxeModalConstructor, VxeModalMethods, VxeDatePickerDefines } from '../../../types'
12
+
13
+ export default defineVxeComponent({
14
+ name: 'VxeInput',
15
+ mixins: [
16
+ globalMixins.sizeMixin
17
+ ],
18
+ model: {
19
+ prop: 'value',
20
+ event: 'modelValue'
21
+ },
22
+ props: {
23
+ value: [String, Number, Date] as PropType<VxeInputPropTypes.ModelValue>,
24
+ immediate: {
25
+ type: Boolean as PropType<VxeInputPropTypes.Immediate>,
26
+ default: true
27
+ },
28
+ name: String as PropType<VxeInputPropTypes.Name>,
29
+ type: {
30
+ type: String as PropType<VxeInputPropTypes.Type>,
31
+ default: 'text'
32
+ },
33
+ clearable: {
34
+ type: Boolean as PropType<VxeInputPropTypes.Clearable>,
35
+ default: () => getConfig().input.clearable
36
+ },
37
+ readonly: {
38
+ type: Boolean as PropType<VxeInputPropTypes.Readonly>,
39
+ default: null
40
+ },
41
+ disabled: {
42
+ type: Boolean as PropType<VxeInputPropTypes.Disabled>,
43
+ default: null
44
+ },
45
+ placeholder: String as PropType<VxeInputPropTypes.Placeholder>,
46
+ maxLength: [String, Number] as PropType<VxeInputPropTypes.MaxLength>,
47
+ autoComplete: {
48
+ type: String as PropType<VxeInputPropTypes.AutoComplete>,
49
+ default: 'off'
50
+ },
51
+ align: String as PropType<VxeInputPropTypes.Align>,
52
+ form: String as PropType<VxeInputPropTypes.Form>,
53
+ className: String as PropType<VxeInputPropTypes.ClassName>,
54
+ size: {
55
+ type: String as PropType<VxeInputPropTypes.Size>,
56
+ default: () => getConfig().input.size || getConfig().size
57
+ },
58
+ multiple: Boolean as PropType<VxeInputPropTypes.Multiple>,
59
+
60
+ // text
61
+ showWordCount: Boolean as PropType<VxeInputPropTypes.ShowWordCount>,
62
+ countMethod: Function as PropType<VxeInputPropTypes.CountMethod>,
63
+
64
+ // number、integer、float
65
+ min: {
66
+ type: [String, Number] as PropType<VxeInputPropTypes.Min>,
67
+ default: null
68
+ },
69
+ max: {
70
+ type: [String, Number] as PropType<VxeInputPropTypes.Max>,
71
+ default: null
72
+ },
73
+ step: [String, Number] as PropType<VxeInputPropTypes.Step>,
74
+ exponential: {
75
+ type: Boolean as PropType<VxeInputPropTypes.Exponential>,
76
+ default: () => getConfig().input.exponential
77
+ },
78
+
79
+ // number、integer、float、password
80
+ controls: {
81
+ type: Boolean as PropType<VxeInputPropTypes.Controls>,
82
+ default: () => getConfig().input.controls
83
+ },
84
+
85
+ // float
86
+ digits: {
87
+ type: [String, Number] as PropType<VxeInputPropTypes.Digits>,
88
+ default: () => getConfig().input.digits
89
+ },
90
+
91
+ // date、week、month、quarter、year
92
+ startDate: {
93
+ type: [String, Number, Date] as PropType<VxeInputPropTypes.MinDate>,
94
+ default: () => getConfig().input.startDate
95
+ },
96
+ endDate: {
97
+ type: [String, Number, Date] as PropType<VxeInputPropTypes.MaxDate>,
98
+ default: () => getConfig().input.endDate
99
+ },
100
+ minDate: [String, Number, Date] as PropType<VxeInputPropTypes.MinDate>,
101
+ maxDate: [String, Number, Date] as PropType<VxeInputPropTypes.MaxDate>,
102
+ // 已废弃 startWeek,被 startDay 替换
103
+ startWeek: Number as PropType<VxeInputPropTypes.StartDay>,
104
+ startDay: {
105
+ type: [String, Number] as PropType<VxeInputPropTypes.StartDay>,
106
+ default: () => getConfig().input.startDay
107
+ },
108
+ labelFormat: String as PropType<VxeInputPropTypes.LabelFormat>,
109
+ valueFormat: String as PropType<VxeInputPropTypes.ValueFormat>,
110
+ editable: {
111
+ type: Boolean as PropType<VxeInputPropTypes.Editable>,
112
+ default: true
113
+ },
114
+ festivalMethod: {
115
+ type: Function as PropType<VxeInputPropTypes.FestivalMethod>,
116
+ default: () => getConfig().input.festivalMethod
117
+ },
118
+ disabledMethod: {
119
+ type: Function as PropType<VxeInputPropTypes.DisabledMethod>,
120
+ default: () => getConfig().input.disabledMethod
121
+ },
122
+
123
+ // week
124
+ selectDay: {
125
+ type: [String, Number] as PropType<VxeInputPropTypes.SelectDay>,
126
+ default: () => getConfig().input.selectDay
127
+ },
128
+
129
+ prefixIcon: String as PropType<VxeInputPropTypes.PrefixIcon>,
130
+ suffixIcon: String as PropType<VxeInputPropTypes.SuffixIcon>,
131
+ placement: String as PropType<VxeInputPropTypes.Placement>,
132
+ transfer: {
133
+ type: Boolean as PropType<VxeInputPropTypes.Transfer>,
134
+ default: null
135
+ },
136
+
137
+ // 已废弃
138
+ maxlength: [String, Number] as PropType<VxeInputPropTypes.Maxlength>,
139
+ // 已废弃
140
+ autocomplete: String as PropType<VxeInputPropTypes.Autocomplete>
141
+ },
142
+ inject: {
143
+ $xeModal: {
144
+ default: null
145
+ },
146
+ $xeDrawer: {
147
+ default: null
148
+ },
149
+ $xeTable: {
150
+ default: null
151
+ },
152
+ $xeForm: {
153
+ default: null
154
+ },
155
+ formItemInfo: {
156
+ from: 'xeFormItemInfo',
157
+ default: null
158
+ }
159
+ },
160
+ provide () {
161
+ const $xeSelect = this
162
+ return {
163
+ $xeSelect
164
+ }
165
+ },
166
+ data () {
167
+ const xID = XEUtils.uniqueId()
168
+ const reactData: InputReactData = {
169
+ initialized: false,
170
+ panelIndex: 0,
171
+ showPwd: false,
172
+ visiblePanel: false,
173
+ isAniVisible: false,
174
+ panelStyle: {},
175
+ panelPlacement: '',
176
+ isActivated: false,
177
+ inputValue: '',
178
+ datetimePanelValue: null,
179
+ datePanelValue: null,
180
+ datePanelLabel: '',
181
+ datePanelType: 'day',
182
+ selectMonth: null,
183
+ currentDate: null
184
+ }
185
+ const internalData: InputInternalData = {
186
+ yearSize: 12,
187
+ monthSize: 20,
188
+ quarterSize: 8,
189
+ hpTimeout: undefined,
190
+ dnTimeout: undefined
191
+ }
192
+ return {
193
+ xID,
194
+ reactData,
195
+ internalData
196
+ }
197
+ },
198
+ computed: {
199
+ ...({} as {
200
+ computeSize(): VxeComponentSizeType
201
+ $xeModal(): (VxeModalConstructor & VxeModalMethods) | null
202
+ $xeDrawer(): (VxeDrawerConstructor & VxeDrawerMethods) | null
203
+ $xeTable(): (VxeTableConstructor & VxeTablePrivateMethods) | null
204
+ $xeForm(): (VxeFormConstructor & VxeFormPrivateMethods) | null
205
+ formItemInfo(): VxeFormDefines.ProvideItemInfo | null
206
+ }),
207
+ computeBtnTransfer () {
208
+ const $xeInput = this
209
+ const props = $xeInput
210
+ const $xeTable = $xeInput.$xeTable
211
+ const $xeModal = $xeInput.$xeModal
212
+ const $xeDrawer = $xeInput.$xeDrawer
213
+ const $xeForm = $xeInput.$xeForm
214
+
215
+ const { transfer } = props
216
+ if (transfer === null) {
217
+ const globalTransfer = getConfig().input.transfer
218
+ if (XEUtils.isBoolean(globalTransfer)) {
219
+ return globalTransfer
220
+ }
221
+ if ($xeTable || $xeModal || $xeDrawer || $xeForm) {
222
+ return true
223
+ }
224
+ }
225
+ return transfer
226
+ },
227
+ computeFormReadonly () {
228
+ const $xeInput = this
229
+ const $xeForm = $xeInput.$xeForm
230
+
231
+ if ($xeForm) {
232
+ return $xeForm.readonly
233
+ }
234
+ return false
235
+ },
236
+ computeIsReadonly () {
237
+ const $xeInput = this
238
+ const props = $xeInput
239
+
240
+ const { readonly } = props
241
+ return readonly
242
+ },
243
+ computeIsDisabled () {
244
+ const $xeInput = this
245
+ const props = $xeInput
246
+ const $xeForm = $xeInput.$xeForm
247
+
248
+ const { disabled } = props
249
+ if (disabled === null) {
250
+ if ($xeForm) {
251
+ return $xeForm.disabled
252
+ }
253
+ return false
254
+ }
255
+ return disabled
256
+ },
257
+ computeInpMaxLength () {
258
+ const $xeInput = this
259
+ const props = $xeInput
260
+
261
+ const { maxLength, maxlength } = props
262
+ const maxLen = maxLength || maxlength
263
+ const isNumType = $xeInput.computeIsNumType
264
+ // 数值最大长度限制 16 位,包含小数
265
+ if (isNumType) {
266
+ if (!XEUtils.toNumber(maxLen)) {
267
+ return 16
268
+ }
269
+ }
270
+ return maxLen
271
+ },
272
+ computeIsDateTimeType () {
273
+ const $xeInput = this
274
+ const props = $xeInput
275
+
276
+ const { type } = props
277
+ return type === 'time' || type === 'datetime'
278
+ },
279
+ computeIsNumType () {
280
+ const $xeInput = this
281
+ const props = $xeInput
282
+
283
+ return ['number', 'integer', 'float'].indexOf(props.type) > -1
284
+ },
285
+ computeInputCount (this: any) {
286
+ const $xeInput = this
287
+ const reactData = $xeInput.reactData
288
+
289
+ return XEUtils.getSize(reactData.inputValue)
290
+ },
291
+ computeIsCountError () {
292
+ const $xeInput = this
293
+
294
+ const inputCount = $xeInput.computeInputCount as number
295
+ const inpMaxLength = $xeInput.computeInpMaxLength
296
+ return inpMaxLength && inputCount > XEUtils.toNumber(inpMaxLength)
297
+ },
298
+ computeIsDatePickerType () {
299
+ const $xeInput = this
300
+ const props = $xeInput
301
+
302
+ const isDateTimeType = $xeInput.computeIsDateTimeType as boolean
303
+ return isDateTimeType || ['date', 'week', 'month', 'quarter', 'year'].indexOf(props.type) > -1
304
+ },
305
+ computeIsPawdType () {
306
+ const $xeInput = this
307
+ const props = $xeInput
308
+
309
+ return props.type === 'password'
310
+ },
311
+ computeIsSearchType () {
312
+ const $xeInput = this
313
+ const props = $xeInput
314
+
315
+ return props.type === 'search'
316
+ },
317
+ computeDigitsValue () {
318
+ const $xeInput = this
319
+ const props = $xeInput
320
+
321
+ return XEUtils.toInteger(props.digits) || 1
322
+ },
323
+ computeStepValue () {
324
+ const $xeInput = this
325
+ const props = $xeInput
326
+
327
+ const { type } = props
328
+ const digitsValue = $xeInput.computeDigitsValue as number
329
+ const step = props.step
330
+ if (type === 'integer') {
331
+ return XEUtils.toInteger(step) || 1
332
+ } else if (type === 'float') {
333
+ return XEUtils.toNumber(step) || (1 / Math.pow(10, digitsValue))
334
+ }
335
+ return XEUtils.toNumber(step) || 1
336
+ },
337
+ computeIsClearable () {
338
+ const $xeInput = this
339
+ const props = $xeInput
340
+
341
+ const { type } = props
342
+ const isNumType = $xeInput.computeIsNumType as boolean
343
+ const isDatePickerType = $xeInput.computeIsDatePickerType as boolean
344
+ const isPawdType = $xeInput.computeIsPawdType
345
+ return props.clearable && (isPawdType || isNumType || isDatePickerType || type === 'text' || type === 'search')
346
+ },
347
+ computeDateStartTime () {
348
+ const $xeInput = this
349
+ const props = $xeInput
350
+
351
+ return props.startDate ? XEUtils.toStringDate(props.startDate) : null
352
+ },
353
+ computeDateEndTime () {
354
+ const $xeInput = this
355
+ const props = $xeInput
356
+
357
+ return props.endDate ? XEUtils.toStringDate(props.endDate) : null
358
+ },
359
+ computeSupportMultiples () {
360
+ const $xeInput = this
361
+ const props = $xeInput
362
+
363
+ return ['date', 'week', 'month', 'quarter', 'year'].indexOf(props.type) > -1
364
+ },
365
+ computeDateListValue (this: any) {
366
+ const $xeInput = this
367
+ const props = $xeInput
368
+
369
+ const { value, multiple } = props
370
+ const isDatePickerType = $xeInput.computeIsDatePickerType as boolean
371
+ const dateValueFormat = $xeInput.computeDateValueFormat
372
+ if (multiple && value && isDatePickerType) {
373
+ return XEUtils.toValueString(value).split(',').map(item => {
374
+ const date = $xeInput.parseDate(item, dateValueFormat)
375
+ if (XEUtils.isValidDate(date)) {
376
+ return date
377
+ }
378
+ return date
379
+ }) as Date[]
380
+ }
381
+ return []
382
+ },
383
+ computeDateMultipleValue () {
384
+ const $xeInput = this
385
+
386
+ const dateListValue = $xeInput.computeDateListValue as Date[]
387
+ const dateValueFormat = $xeInput.computeDateValueFormat as string
388
+ return dateListValue.map(date => XEUtils.toDateString(date, dateValueFormat))
389
+ },
390
+ computeDateMultipleLabel () {
391
+ const $xeInput = this
392
+
393
+ const dateListValue = $xeInput.computeDateListValue as Date[]
394
+ const dateLabelFormat = $xeInput.computeDateLabelFormat as string
395
+ return dateListValue.map(date => XEUtils.toDateString(date, dateLabelFormat)).join(', ')
396
+ },
397
+ computeDateValueFormat () {
398
+ const $xeInput = this
399
+ const props = $xeInput
400
+
401
+ const { type, valueFormat } = props
402
+ if (valueFormat) {
403
+ return valueFormat
404
+ }
405
+ if (type === 'time') {
406
+ return 'HH:mm:ss'
407
+ }
408
+ if (type === 'datetime') {
409
+ return 'yyyy-MM-dd HH:mm:ss'
410
+ }
411
+ return 'yyyy-MM-dd'
412
+ },
413
+ computeDateValue (this: any) {
414
+ const $xeInput = this
415
+ const props = $xeInput
416
+
417
+ const { value } = props
418
+ const isDatePickerType = $xeInput.computeIsDatePickerType as boolean
419
+ const dateValueFormat = $xeInput.computeDateValueFormat as string
420
+ let val = null
421
+ if (value && isDatePickerType) {
422
+ const date = $xeInput.parseDate(value, dateValueFormat)
423
+ if (XEUtils.isValidDate(date)) {
424
+ val = date
425
+ }
426
+ }
427
+ return val
428
+ },
429
+ computeIsDisabledPrevDateBtn (this: any) {
430
+ const $xeInput = this
431
+ const reactData = $xeInput.reactData
432
+
433
+ const dateStartTime = $xeInput.computeDateStartTime as Date | null
434
+ const { selectMonth } = reactData
435
+ if (selectMonth && dateStartTime) {
436
+ return selectMonth <= dateStartTime
437
+ }
438
+ return false
439
+ },
440
+ computeIsDisabledNextDateBtn (this: any) {
441
+ const $xeInput = this
442
+ const reactData = $xeInput.reactData
443
+
444
+ const dateEndTime = $xeInput.computeDateEndTime as Date | null
445
+ const { selectMonth } = reactData
446
+ if (selectMonth && dateEndTime) {
447
+ return selectMonth >= dateEndTime
448
+ }
449
+ return false
450
+ },
451
+ computeDateTimeLabel (this: any) {
452
+ const $xeInput = this
453
+ const reactData = $xeInput.reactData
454
+
455
+ const { datetimePanelValue } = reactData
456
+ const hasTimeSecond = $xeInput.computeHasTimeSecond as boolean
457
+ if (datetimePanelValue) {
458
+ return XEUtils.toDateString(datetimePanelValue, hasTimeSecond ? 'HH:mm:ss' : 'HH:mm')
459
+ }
460
+ return ''
461
+ },
462
+ computeDateHMSTime () {
463
+ const $xeInput = this
464
+
465
+ const dateValue = $xeInput.computeDateValue
466
+ const isDateTimeType = $xeInput.computeIsDateTimeType as boolean
467
+ return dateValue && isDateTimeType ? (dateValue.getHours() * 3600 + dateValue.getMinutes() * 60 + dateValue.getSeconds()) * 1000 : 0
468
+ },
469
+ computeDateLabelFormat () {
470
+ const $xeInput = this
471
+ const props = $xeInput
472
+
473
+ const { labelFormat } = props
474
+ const isDatePickerType = $xeInput.computeIsDatePickerType as boolean
475
+ const dateValueFormat = $xeInput.computeDateValueFormat as string
476
+ if (isDatePickerType) {
477
+ return labelFormat || dateValueFormat || getI18n(`vxe.input.date.labelFormat.${props.type}`)
478
+ }
479
+ return ''
480
+ },
481
+ computeYearList () {
482
+ const $xeInput = this
483
+ const reactData = $xeInput.reactData
484
+ const internalData = $xeInput.internalData
485
+
486
+ const { selectMonth, currentDate } = reactData
487
+ const { yearSize } = internalData
488
+ const years: VxeDatePickerDefines.DateYearItem[] = []
489
+ if (selectMonth && currentDate) {
490
+ const currFullYear = currentDate.getFullYear()
491
+ const selectFullYear = selectMonth.getFullYear()
492
+ const startYearDate = new Date(selectFullYear - selectFullYear % yearSize, 0, 1)
493
+ for (let index = -4; index < yearSize + 4; index++) {
494
+ const date = XEUtils.getWhatYear(startYearDate, index, 'first')
495
+ const itemFullYear = date.getFullYear()
496
+ years.push({
497
+ date,
498
+ isCurrent: true,
499
+ isPrev: index < 0,
500
+ isNow: currFullYear === itemFullYear,
501
+ isNext: index >= yearSize,
502
+ year: itemFullYear
503
+ })
504
+ }
505
+ }
506
+ return years
507
+ },
508
+ computeSelectDatePanelLabel (this: any) {
509
+ const $xeInput = this
510
+ const reactData = $xeInput.reactData
511
+
512
+ const isDatePickerType = $xeInput.computeIsDatePickerType
513
+ if (isDatePickerType) {
514
+ const { datePanelType, selectMonth } = reactData
515
+ const yearList = $xeInput.computeYearList as VxeDatePickerDefines.DateYearItem[]
516
+ let year = ''
517
+ let month
518
+ if (selectMonth) {
519
+ year = selectMonth.getFullYear()
520
+ month = selectMonth.getMonth() + 1
521
+ }
522
+ if (datePanelType === 'quarter') {
523
+ return getI18n('vxe.input.date.quarterLabel', [year])
524
+ } else if (datePanelType === 'month') {
525
+ return getI18n('vxe.input.date.monthLabel', [year])
526
+ } else if (datePanelType === 'year') {
527
+ return yearList.length ? `${yearList[0].year} - ${yearList[yearList.length - 1].year}` : ''
528
+ }
529
+ return getI18n('vxe.input.date.dayLabel', [year, month ? getI18n(`vxe.input.date.m${month}`) : '-'])
530
+ }
531
+ return ''
532
+ },
533
+ computeFirstDayOfWeek () {
534
+ const $xeInput = this
535
+ const props = $xeInput
536
+
537
+ const { startDay, startWeek } = props
538
+ return XEUtils.toNumber(XEUtils.isNumber(startDay) || XEUtils.isString(startDay) ? startDay : startWeek) as VxeInputPropTypes.StartDay
539
+ },
540
+ computeWeekDatas () {
541
+ const $xeInput = this
542
+
543
+ const weeks = []
544
+ const isDatePickerType = $xeInput.computeIsDatePickerType
545
+ if (isDatePickerType) {
546
+ let sWeek = $xeInput.computeFirstDayOfWeek as VxeInputPropTypes.StartDay
547
+ weeks.push(sWeek)
548
+ for (let index = 0; index < 6; index++) {
549
+ if (sWeek >= 6) {
550
+ sWeek = 0
551
+ } else {
552
+ sWeek++
553
+ }
554
+ weeks.push(sWeek)
555
+ }
556
+ }
557
+ return weeks
558
+ },
559
+ computeDateHeaders () {
560
+ const $xeInput = this
561
+
562
+ const isDatePickerType = $xeInput.computeIsDatePickerType
563
+ if (isDatePickerType) {
564
+ const weekDatas = $xeInput.computeWeekDatas as number[]
565
+ return weekDatas.map((day) => {
566
+ return {
567
+ value: day,
568
+ label: getI18n(`vxe.input.date.weeks.w${day}`)
569
+ }
570
+ })
571
+ }
572
+ return []
573
+ },
574
+ computeWeekHeaders () {
575
+ const $xeInput = this
576
+
577
+ const isDatePickerType = $xeInput.computeIsDatePickerType
578
+ if (isDatePickerType) {
579
+ const dateHeaders = $xeInput.computeDateHeaders as {
580
+ value: number;
581
+ label: string;
582
+ }[]
583
+ return [{ label: getI18n('vxe.input.date.weeks.w') }].concat(dateHeaders)
584
+ }
585
+ return []
586
+ },
587
+ computeYearDatas () {
588
+ const $xeInput = this
589
+
590
+ const yearList = $xeInput.computeYearList as VxeDatePickerDefines.DateYearItem[]
591
+ return XEUtils.chunk(yearList, 4)
592
+ },
593
+ computeQuarterList () {
594
+ const $xeInput = this
595
+ const reactData = $xeInput.reactData
596
+ const internalData = $xeInput.internalData
597
+
598
+ const { selectMonth, currentDate } = reactData
599
+ const { quarterSize } = internalData
600
+ const quarters: VxeDatePickerDefines.DateQuarterItem[] = []
601
+ if (selectMonth && currentDate) {
602
+ const currFullYear = currentDate.getFullYear()
603
+ const currQuarter = getDateQuarter(currentDate)
604
+ const firstYear = XEUtils.getWhatYear(selectMonth, 0, 'first')
605
+ const selFullYear = firstYear.getFullYear()
606
+ for (let index = -2; index < quarterSize - 2; index++) {
607
+ const date = XEUtils.getWhatQuarter(firstYear, index)
608
+ const itemFullYear = date.getFullYear()
609
+ const itemQuarter = getDateQuarter(date)
610
+ const isPrev = itemFullYear < selFullYear
611
+ quarters.push({
612
+ date,
613
+ isPrev,
614
+ isCurrent: itemFullYear === selFullYear,
615
+ isNow: itemFullYear === currFullYear && itemQuarter === currQuarter,
616
+ isNext: !isPrev && itemFullYear > selFullYear,
617
+ quarter: itemQuarter
618
+ })
619
+ }
620
+ }
621
+ return quarters
622
+ },
623
+ computeQuarterDatas () {
624
+ const $xeInput = this
625
+
626
+ const quarterList = $xeInput.computeQuarterList as VxeDatePickerDefines.DateQuarterItem[]
627
+ return XEUtils.chunk(quarterList, 2)
628
+ },
629
+ computeMonthList () {
630
+ const $xeInput = this
631
+ const reactData = $xeInput.reactData
632
+ const internalData = $xeInput.internalData
633
+
634
+ const { selectMonth, currentDate } = reactData
635
+ const { monthSize } = internalData
636
+ const months: VxeDatePickerDefines.DateMonthItem[] = []
637
+ if (selectMonth && currentDate) {
638
+ const currFullYear = currentDate.getFullYear()
639
+ const currMonth = currentDate.getMonth()
640
+ const selFullYear = XEUtils.getWhatYear(selectMonth, 0, 'first').getFullYear()
641
+ for (let index = -4; index < monthSize - 4; index++) {
642
+ const date = XEUtils.getWhatYear(selectMonth, 0, index)
643
+ const itemFullYear = date.getFullYear()
644
+ const itemMonth = date.getMonth()
645
+ const isPrev = itemFullYear < selFullYear
646
+ months.push({
647
+ date,
648
+ isPrev,
649
+ isCurrent: itemFullYear === selFullYear,
650
+ isNow: itemFullYear === currFullYear && itemMonth === currMonth,
651
+ isNext: !isPrev && itemFullYear > selFullYear,
652
+ month: itemMonth
653
+ })
654
+ }
655
+ }
656
+ return months
657
+ },
658
+ computeMonthDatas () {
659
+ const $xeInput = this
660
+
661
+ const monthList = $xeInput.computeMonthList as VxeDatePickerDefines.DateMonthItem[]
662
+ return XEUtils.chunk(monthList, 4)
663
+ },
664
+ computeDayList () {
665
+ const $xeInput = this
666
+ const reactData = $xeInput.reactData
667
+
668
+ const { selectMonth, currentDate } = reactData
669
+ const days: VxeDatePickerDefines.DateDayItem[] = []
670
+ if (selectMonth && currentDate) {
671
+ const dateHMSTime = $xeInput.computeDateHMSTime
672
+ const weekDatas = $xeInput.computeWeekDatas
673
+ const currFullYear = currentDate.getFullYear()
674
+ const currMonth = currentDate.getMonth()
675
+ const currDate = currentDate.getDate()
676
+ const selFullYear = selectMonth.getFullYear()
677
+ const selMonth = selectMonth.getMonth()
678
+ const selDay = selectMonth.getDay()
679
+ const prevOffsetDate = -weekDatas.indexOf(selDay)
680
+ const startDayDate = new Date(XEUtils.getWhatDay(selectMonth, prevOffsetDate).getTime() + dateHMSTime)
681
+ for (let index = 0; index < 42; index++) {
682
+ const date = XEUtils.getWhatDay(startDayDate, index)
683
+ const itemFullYear = date.getFullYear()
684
+ const itemMonth = date.getMonth()
685
+ const itemDate = date.getDate()
686
+ const isPrev = date < selectMonth
687
+ days.push({
688
+ date,
689
+ isPrev,
690
+ isCurrent: itemFullYear === selFullYear && itemMonth === selMonth,
691
+ isNow: itemFullYear === currFullYear && itemMonth === currMonth && itemDate === currDate,
692
+ isNext: !isPrev && selMonth !== itemMonth,
693
+ label: itemDate
694
+ })
695
+ }
696
+ }
697
+ return days
698
+ },
699
+ computeDayDatas () {
700
+ const $xeInput = this
701
+
702
+ const dayList = $xeInput.computeDayList as VxeDatePickerDefines.DateDayItem[]
703
+ return XEUtils.chunk(dayList, 7)
704
+ },
705
+ computeWeekDates () {
706
+ const $xeInput = this
707
+
708
+ const dayDatas = $xeInput.computeDayDatas as VxeDatePickerDefines.DateDayItem[][]
709
+ const firstDayOfWeek = $xeInput.computeFirstDayOfWeek
710
+ return dayDatas.map((list) => {
711
+ const firstItem = list[0]
712
+ const item: VxeDatePickerDefines.DateDayItem = {
713
+ date: firstItem.date,
714
+ isWeekNumber: true,
715
+ isPrev: false,
716
+ isCurrent: false,
717
+ isNow: false,
718
+ isNext: false,
719
+ label: XEUtils.getYearWeek(firstItem.date, firstDayOfWeek)
720
+ }
721
+ return [item].concat(list)
722
+ })
723
+ },
724
+ computeHourList () {
725
+ const $xeInput = this
726
+
727
+ const list: VxeDatePickerDefines.DateHourMinuteSecondItem[] = []
728
+ const isDateTimeType = $xeInput.computeIsDateTimeType
729
+ if (isDateTimeType) {
730
+ for (let index = 0; index < 24; index++) {
731
+ list.push({
732
+ value: index,
733
+ label: ('' + index).padStart(2, '0')
734
+ })
735
+ }
736
+ }
737
+ return list
738
+ },
739
+ computeMinuteList () {
740
+ const $xeInput = this
741
+
742
+ const list: VxeDatePickerDefines.DateHourMinuteSecondItem[] = []
743
+ const isDateTimeType = $xeInput.computeIsDateTimeType
744
+ if (isDateTimeType) {
745
+ for (let index = 0; index < 60; index++) {
746
+ list.push({
747
+ value: index,
748
+ label: ('' + index).padStart(2, '0')
749
+ })
750
+ }
751
+ }
752
+ return list
753
+ },
754
+ computeHasTimeMinute () {
755
+ const $xeInput = this
756
+
757
+ const dateValueFormat = $xeInput.computeDateValueFormat as string
758
+ return !/HH/.test(dateValueFormat) || /mm/.test(dateValueFormat)
759
+ },
760
+ computeHasTimeSecond () {
761
+ const $xeInput = this
762
+
763
+ const dateValueFormat = $xeInput.computeDateValueFormat as string
764
+ return !/HH/.test(dateValueFormat) || /ss/.test(dateValueFormat)
765
+ },
766
+ computeSecondList () {
767
+ const $xeInput = this
768
+
769
+ const minuteList = $xeInput.computeMinuteList as VxeDatePickerDefines.DateHourMinuteSecondItem[]
770
+ return minuteList
771
+ },
772
+ computeInputReadonly () {
773
+ const $xeInput = this
774
+ const props = $xeInput
775
+
776
+ const { type, editable, multiple } = props
777
+ const isReadonly = $xeInput.computeIsReadonly
778
+ return isReadonly || multiple || !editable || type === 'week' || type === 'quarter'
779
+ },
780
+ computeInputType (this: any) {
781
+ const $xeInput = this
782
+ const props = $xeInput
783
+ const reactData = $xeInput.reactData
784
+
785
+ const { type } = props
786
+ const { showPwd } = reactData
787
+ const isNumType = $xeInput.computeIsNumType as boolean
788
+ const isDatePickerType = $xeInput.computeIsDatePickerType
789
+ const isPawdType = $xeInput.computeIsPawdType as boolean
790
+ if (isDatePickerType || isNumType || (isPawdType && showPwd) || type === 'number') {
791
+ return 'text'
792
+ }
793
+ return type
794
+ },
795
+ computeInpPlaceholder () {
796
+ const $xeInput = this
797
+ const props = $xeInput
798
+
799
+ const { placeholder } = props
800
+ if (placeholder) {
801
+ return getFuncText(placeholder)
802
+ }
803
+ const globalPlaceholder = getConfig().input.placeholder
804
+ if (globalPlaceholder) {
805
+ return getFuncText(globalPlaceholder)
806
+ }
807
+ return getI18n('vxe.base.pleaseInput')
808
+ },
809
+ computeInpImmediate () {
810
+ const $xeInput = this
811
+ const props = $xeInput
812
+
813
+ const { type, immediate } = props
814
+ return immediate || !(type === 'text' || type === 'number' || type === 'integer' || type === 'float')
815
+ },
816
+ computeNumValue (this: any) {
817
+ const $xeInput = this
818
+ const props = $xeInput
819
+ const reactData = $xeInput.reactData
820
+
821
+ const { type } = props
822
+ const { inputValue } = reactData
823
+ const isNumType = $xeInput.computeIsNumType as boolean
824
+ if (isNumType) {
825
+ return type === 'integer' ? XEUtils.toInteger(handleNumber(inputValue)) : XEUtils.toNumber(handleNumber(inputValue))
826
+ }
827
+ return 0
828
+ },
829
+ computeIsDisabledSubtractNumber (this: any) {
830
+ const $xeInput = this
831
+ const props = $xeInput
832
+ const reactData = $xeInput.reactData
833
+
834
+ const { min } = props
835
+ const { inputValue } = reactData
836
+ const isNumType = $xeInput.computeIsNumType as boolean
837
+ const numValue = $xeInput.computeNumValue as number
838
+ // 当有值时再进行判断
839
+ if ((inputValue || inputValue === 0) && isNumType && min !== null) {
840
+ return numValue <= XEUtils.toNumber(min)
841
+ }
842
+ return false
843
+ },
844
+ computeIsDisabledAddNumber (this: any) {
845
+ const $xeInput = this
846
+ const props = $xeInput
847
+ const reactData = $xeInput.reactData
848
+
849
+ const { max } = props
850
+ const { inputValue } = reactData
851
+ const isNumType = $xeInput.computeIsNumType as boolean
852
+ const numValue = $xeInput.computeNumValue as number
853
+ // 当有值时再进行判断
854
+ if ((inputValue || inputValue === 0) && isNumType && max !== null) {
855
+ return numValue >= XEUtils.toNumber(max)
856
+ }
857
+ return false
858
+ }
859
+ },
860
+ methods: {
861
+ //
862
+ // Method
863
+ //
864
+ dispatchEvent (type: ValueOf<VxeInputEmits>, params: Record<string, any>, evnt: Event | null) {
865
+ const $xeInput = this
866
+ $xeInput.$emit(type, createEvent(evnt, { $input: $xeInput }, params))
867
+ },
868
+ emitModel (value: any) {
869
+ const $xeInput = this
870
+
871
+ $xeInput.$emit('modelValue', value)
872
+ },
873
+ focus () {
874
+ const $xeInput = this
875
+ const reactData = $xeInput.reactData
876
+
877
+ const inputElem = $xeInput.$refs.refInputTarget as HTMLInputElement
878
+ reactData.isActivated = true
879
+ inputElem.focus()
880
+ return $xeInput.$nextTick()
881
+ },
882
+ blur () {
883
+ const $xeInput = this
884
+ const reactData = $xeInput.reactData
885
+
886
+ const inputElem = $xeInput.$refs.refInputTarget as HTMLInputElement
887
+ inputElem.blur()
888
+ reactData.isActivated = false
889
+ return $xeInput.$nextTick()
890
+ },
891
+ select () {
892
+ const $xeInput = this
893
+ const reactData = $xeInput.reactData
894
+
895
+ const inputElem = $xeInput.$refs.refInputTarget as HTMLInputElement
896
+ inputElem.select()
897
+ reactData.isActivated = false
898
+ return $xeInput.$nextTick()
899
+ },
900
+ parseDate (value: VxeInputPropTypes.ModelValue, format: string) {
901
+ const $xeInput = this
902
+ const props = $xeInput
903
+
904
+ const { type } = props
905
+ if (type === 'time') {
906
+ return toStringTimeDate(value)
907
+ }
908
+ return XEUtils.toStringDate(value, format)
909
+ },
910
+ getNumberValue (val: any) {
911
+ const $xeInput = this
912
+ const props = $xeInput
913
+
914
+ const { type, exponential } = props
915
+ const inpMaxLength = $xeInput.computeInpMaxLength
916
+ const digitsValue = $xeInput.computeDigitsValue
917
+ const restVal = (type === 'float' ? toFloatValueFixed(val, digitsValue) : XEUtils.toValueString(val))
918
+ if (exponential && (val === restVal || XEUtils.toValueString(val).toLowerCase() === XEUtils.toNumber(restVal).toExponential())) {
919
+ return val
920
+ }
921
+ return restVal.slice(0, inpMaxLength)
922
+ },
923
+ triggerEvent (evnt: Event & { type: 'input' | 'change' | 'keydown' | 'keyup' | 'wheel' | 'click' | 'focus' | 'blur' }) {
924
+ const $xeInput = this
925
+ const reactData = $xeInput.reactData
926
+
927
+ const { inputValue } = reactData
928
+ $xeInput.dispatchEvent(evnt.type, { value: inputValue }, evnt)
929
+ },
930
+ handleChange (value: string, evnt: Event | { type: string }) {
931
+ const $xeInput = this
932
+ const props = $xeInput
933
+ const reactData = $xeInput.reactData
934
+ const $xeForm = $xeInput.$xeForm
935
+ const formItemInfo = $xeInput.formItemInfo
936
+
937
+ reactData.inputValue = value
938
+ $xeInput.emitModel(value)
939
+ $xeInput.dispatchEvent('input', { value }, evnt as any)
940
+ if (XEUtils.toValueString(props.value) !== value) {
941
+ $xeInput.dispatchEvent('change', { value }, evnt as any)
942
+ // 自动更新校验状态
943
+ if ($xeForm && formItemInfo) {
944
+ $xeForm.triggerItemEvent(evnt, formItemInfo.itemConfig.field, value)
945
+ }
946
+ }
947
+ },
948
+ emitInputEvent (value: any, evnt: Event) {
949
+ const $xeInput = this
950
+ const reactData = $xeInput.reactData
951
+
952
+ const isDatePickerType = $xeInput.computeIsDatePickerType
953
+ const inpImmediate = $xeInput.computeInpImmediate
954
+ reactData.inputValue = value
955
+ if (!isDatePickerType) {
956
+ if (inpImmediate) {
957
+ $xeInput.handleChange(value, evnt)
958
+ } else {
959
+ $xeInput.dispatchEvent('input', { value }, evnt)
960
+ }
961
+ }
962
+ },
963
+ inputEvent (evnt: Event & { type: 'input' }) {
964
+ const $xeInput = this
965
+
966
+ const inputElem = evnt.target as HTMLInputElement
967
+ const value = inputElem.value
968
+ $xeInput.emitInputEvent(value, evnt)
969
+ },
970
+ changeEvent (evnt: Event & { type: 'change' }) {
971
+ const $xeInput = this
972
+
973
+ const inpImmediate = $xeInput.computeInpImmediate
974
+ if (!inpImmediate) {
975
+ $xeInput.triggerEvent(evnt)
976
+ }
977
+ },
978
+ focusEvent (evnt: Event & { type: 'focus' }) {
979
+ const $xeInput = this
980
+ const reactData = $xeInput.reactData
981
+
982
+ reactData.isActivated = true
983
+ const isDatePickerType = $xeInput.computeIsDatePickerType
984
+ if (isDatePickerType) {
985
+ $xeInput.datePickerOpenEvent(evnt)
986
+ }
987
+ $xeInput.triggerEvent(evnt)
988
+ },
989
+ clickPrefixEvent (evnt: Event) {
990
+ const $xeInput = this
991
+ const reactData = $xeInput.reactData
992
+
993
+ const isDisabled = $xeInput.computeIsDisabled
994
+ if (!isDisabled) {
995
+ const { inputValue } = reactData
996
+ $xeInput.dispatchEvent('prefix-click', { value: inputValue }, evnt)
997
+ }
998
+ },
999
+ hidePanel () {
1000
+ const $xeInput = this
1001
+ const reactData = $xeInput.reactData
1002
+ const internalData = $xeInput.internalData
1003
+
1004
+ return new Promise<void>(resolve => {
1005
+ reactData.visiblePanel = false
1006
+ internalData.hpTimeout = window.setTimeout(() => {
1007
+ reactData.isAniVisible = false
1008
+ resolve()
1009
+ }, 350)
1010
+ })
1011
+ },
1012
+ clearValueEvent (evnt: Event, value: VxeInputPropTypes.ModelValue) {
1013
+ const $xeInput = this
1014
+ const props = $xeInput
1015
+
1016
+ const { type } = props
1017
+ const isNumType = $xeInput.computeIsNumType
1018
+ const isDatePickerType = $xeInput.computeIsDatePickerType
1019
+ if (isDatePickerType) {
1020
+ $xeInput.hidePanel()
1021
+ }
1022
+ if (isNumType || ['text', 'search', 'password'].indexOf(type) > -1) {
1023
+ $xeInput.focus()
1024
+ }
1025
+ $xeInput.handleChange('', evnt)
1026
+ $xeInput.dispatchEvent('clear', { value }, evnt)
1027
+ },
1028
+ clickSuffixEvent (evnt: Event) {
1029
+ const $xeInput = this
1030
+ const reactData = $xeInput.reactData
1031
+
1032
+ const isDisabled = $xeInput.computeIsDisabled
1033
+ if (!isDisabled) {
1034
+ const { inputValue } = reactData
1035
+ $xeInput.dispatchEvent('suffix-click', { value: inputValue }, evnt)
1036
+ }
1037
+ },
1038
+ dateParseValue (value?: VxeInputPropTypes.ModelValue) {
1039
+ const $xeInput = this
1040
+ const props = $xeInput
1041
+ const reactData = $xeInput.reactData
1042
+
1043
+ const { type } = props
1044
+ const dateLabelFormat = $xeInput.computeDateLabelFormat
1045
+ const dateValueFormat = $xeInput.computeDateValueFormat
1046
+ const firstDayOfWeek = $xeInput.computeFirstDayOfWeek
1047
+ let dValue: Date | null = null
1048
+ let dLabel = ''
1049
+ if (value) {
1050
+ dValue = $xeInput.parseDate(value, dateValueFormat)
1051
+ }
1052
+ if (XEUtils.isValidDate(dValue)) {
1053
+ dLabel = XEUtils.toDateString(dValue, dateLabelFormat, { firstDay: firstDayOfWeek })
1054
+ // 由于年份和第几周是冲突的行为,所以需要特殊处理,判断是否跨年
1055
+ if (dateLabelFormat && type === 'week') {
1056
+ const firstWeekDate = XEUtils.getWhatWeek(dValue, 0, firstDayOfWeek, firstDayOfWeek)
1057
+ if (firstWeekDate.getFullYear() < dValue.getFullYear()) {
1058
+ const yyIndex = dateLabelFormat.indexOf('yyyy')
1059
+ if (yyIndex > -1) {
1060
+ const yyNum = Number(dLabel.substring(yyIndex, yyIndex + 4))
1061
+ if (yyNum && !isNaN(yyNum)) {
1062
+ dLabel = dLabel.replace(`${yyNum}`, `${yyNum - 1}`)
1063
+ }
1064
+ }
1065
+ }
1066
+ }
1067
+ } else {
1068
+ dValue = null
1069
+ }
1070
+ reactData.datePanelValue = dValue
1071
+ reactData.datePanelLabel = dLabel
1072
+ },
1073
+ /**
1074
+ * 值变化时处理
1075
+ */
1076
+ changeValue () {
1077
+ const $xeInput = this
1078
+ const props = $xeInput
1079
+ const reactData = $xeInput.reactData
1080
+
1081
+ const isDatePickerType = $xeInput.computeIsDatePickerType
1082
+ const { inputValue } = reactData
1083
+ if (isDatePickerType) {
1084
+ $xeInput.dateParseValue(inputValue)
1085
+ reactData.inputValue = props.multiple ? $xeInput.computeDateMultipleLabel : reactData.datePanelLabel
1086
+ }
1087
+ },
1088
+ /**
1089
+ * 检查初始值
1090
+ */
1091
+ initValue () {
1092
+ const $xeInput = this
1093
+ const props = $xeInput
1094
+ const reactData = $xeInput.reactData
1095
+
1096
+ const { type } = props
1097
+ const { inputValue } = reactData
1098
+ const isDatePickerType = $xeInput.computeIsDatePickerType
1099
+ const digitsValue = $xeInput.computeDigitsValue
1100
+ if (isDatePickerType) {
1101
+ $xeInput.changeValue()
1102
+ } else if (type === 'float') {
1103
+ if (inputValue) {
1104
+ const validValue = toFloatValueFixed(inputValue, digitsValue)
1105
+ if (inputValue !== validValue) {
1106
+ $xeInput.handleChange(validValue, { type: 'init' })
1107
+ }
1108
+ }
1109
+ }
1110
+ },
1111
+ validMaxNum (num: number | string) {
1112
+ const $xeInput = this
1113
+ const props = $xeInput
1114
+
1115
+ return props.max === null || XEUtils.toNumber(num) <= XEUtils.toNumber(props.max)
1116
+ },
1117
+ validMinNum (num: number | string) {
1118
+ const $xeInput = this
1119
+ const props = $xeInput
1120
+
1121
+ return props.min === null || XEUtils.toNumber(num) >= XEUtils.toNumber(props.min)
1122
+ },
1123
+ dateRevert () {
1124
+ const $xeInput = this
1125
+ const props = $xeInput
1126
+ const reactData = $xeInput.reactData
1127
+
1128
+ reactData.inputValue = props.multiple ? $xeInput.computeDateMultipleLabel : reactData.datePanelLabel
1129
+ },
1130
+ dateCheckMonth (date: Date) {
1131
+ const $xeInput = this
1132
+ const reactData = $xeInput.reactData
1133
+
1134
+ const month = XEUtils.getWhatMonth(date, 0, 'first')
1135
+ if (!XEUtils.isEqual(month, reactData.selectMonth)) {
1136
+ reactData.selectMonth = month
1137
+ }
1138
+ },
1139
+ dateChange (date: Date) {
1140
+ const $xeInput = this
1141
+ const props = $xeInput
1142
+ const reactData = $xeInput.reactData
1143
+
1144
+ const { multiple } = props
1145
+ const { datetimePanelValue } = reactData
1146
+ const isDateTimeType = $xeInput.computeIsDateTimeType
1147
+ const dateValueFormat = $xeInput.computeDateValueFormat
1148
+ const firstDayOfWeek = $xeInput.computeFirstDayOfWeek
1149
+ if (props.type === 'week') {
1150
+ const sWeek = XEUtils.toNumber(props.selectDay) as VxeInputPropTypes.SelectDay
1151
+ date = XEUtils.getWhatWeek(date, 0, sWeek, firstDayOfWeek)
1152
+ } else if (isDateTimeType) {
1153
+ date.setHours(datetimePanelValue.getHours())
1154
+ date.setMinutes(datetimePanelValue.getMinutes())
1155
+ date.setSeconds(datetimePanelValue.getSeconds())
1156
+ }
1157
+ const inpVal = XEUtils.toDateString(date, dateValueFormat, { firstDay: firstDayOfWeek })
1158
+ $xeInput.dateCheckMonth(date)
1159
+ if (multiple) {
1160
+ // 如果为多选
1161
+ const dateMultipleValue = $xeInput.computeDateMultipleValue
1162
+ if (isDateTimeType) {
1163
+ // 如果是datetime特殊类型
1164
+ const dateListValue = [...$xeInput.computeDateListValue]
1165
+ const datetimeRest: Date[] = []
1166
+ const eqIndex = XEUtils.findIndexOf(dateListValue, val => XEUtils.isDateSame(date, val, 'yyyyMMdd'))
1167
+ if (eqIndex === -1) {
1168
+ dateListValue.push(date)
1169
+ } else {
1170
+ dateListValue.splice(eqIndex, 1)
1171
+ }
1172
+ dateListValue.forEach(item => {
1173
+ if (item) {
1174
+ item.setHours(datetimePanelValue.getHours())
1175
+ item.setMinutes(datetimePanelValue.getMinutes())
1176
+ item.setSeconds(datetimePanelValue.getSeconds())
1177
+ datetimeRest.push(item)
1178
+ }
1179
+ })
1180
+ $xeInput.handleChange(datetimeRest.map(date => XEUtils.toDateString(date, dateValueFormat)).join(','), { type: 'update' })
1181
+ } else {
1182
+ // 如果是日期类型
1183
+ if (dateMultipleValue.some(val => XEUtils.isEqual(val, inpVal))) {
1184
+ $xeInput.handleChange(dateMultipleValue.filter(val => !XEUtils.isEqual(val, inpVal)).join(','), { type: 'update' })
1185
+ } else {
1186
+ $xeInput.handleChange(dateMultipleValue.concat([inpVal]).join(','), { type: 'update' })
1187
+ }
1188
+ }
1189
+ } else {
1190
+ // 如果为单选
1191
+ if (!XEUtils.isEqual(props.value, inpVal)) {
1192
+ $xeInput.handleChange(inpVal, { type: 'update' })
1193
+ }
1194
+ }
1195
+ },
1196
+ afterCheckValue () {
1197
+ const $xeInput = this
1198
+ const props = $xeInput
1199
+ const reactData = $xeInput.reactData
1200
+
1201
+ const { type, min, max, exponential } = props
1202
+ const { inputValue, datetimePanelValue } = reactData
1203
+ const isNumType = $xeInput.computeIsNumType
1204
+ const isDatePickerType = $xeInput.computeIsDatePickerType
1205
+ const dateLabelFormat = $xeInput.computeDateLabelFormat
1206
+ const inputReadonly = $xeInput.computeInputReadonly
1207
+ if (!inputReadonly) {
1208
+ if (isNumType) {
1209
+ if (inputValue) {
1210
+ let inpNumVal: number | string = type === 'integer' ? XEUtils.toInteger(handleNumber(inputValue)) : XEUtils.toNumber(handleNumber(inputValue))
1211
+ if (!$xeInput.validMinNum(inpNumVal)) {
1212
+ inpNumVal = min
1213
+ } else if (!$xeInput.validMaxNum(inpNumVal)) {
1214
+ inpNumVal = max
1215
+ }
1216
+ if (exponential) {
1217
+ const inpStringVal = XEUtils.toValueString(inputValue).toLowerCase()
1218
+ if (inpStringVal === XEUtils.toNumber(inpNumVal).toExponential()) {
1219
+ inpNumVal = inpStringVal
1220
+ }
1221
+ }
1222
+ $xeInput.handleChange($xeInput.getNumberValue(inpNumVal), { type: 'check' })
1223
+ }
1224
+ } else if (isDatePickerType) {
1225
+ if (inputValue) {
1226
+ let inpDateVal: VxeInputPropTypes.ModelValue = $xeInput.parseDate(inputValue, dateLabelFormat as string)
1227
+ if (XEUtils.isValidDate(inpDateVal)) {
1228
+ if (type === 'time') {
1229
+ inpDateVal = XEUtils.toDateString(inpDateVal, dateLabelFormat)
1230
+ if (inputValue !== inpDateVal) {
1231
+ $xeInput.handleChange(inpDateVal, { type: 'check' })
1232
+ }
1233
+ reactData.inputValue = inpDateVal
1234
+ } else {
1235
+ let isChange = false
1236
+ const firstDayOfWeek = $xeInput.computeFirstDayOfWeek
1237
+ if (type === 'datetime') {
1238
+ const dateValue = $xeInput.computeDateValue
1239
+ if (inputValue !== XEUtils.toDateString(dateValue, dateLabelFormat) || inputValue !== XEUtils.toDateString(inpDateVal, dateLabelFormat)) {
1240
+ isChange = true
1241
+ datetimePanelValue.setHours(inpDateVal.getHours())
1242
+ datetimePanelValue.setMinutes(inpDateVal.getMinutes())
1243
+ datetimePanelValue.setSeconds(inpDateVal.getSeconds())
1244
+ }
1245
+ } else {
1246
+ isChange = true
1247
+ }
1248
+ reactData.inputValue = XEUtils.toDateString(inpDateVal, dateLabelFormat, { firstDay: firstDayOfWeek })
1249
+ if (isChange) {
1250
+ $xeInput.dateChange(inpDateVal)
1251
+ }
1252
+ }
1253
+ } else {
1254
+ $xeInput.dateRevert()
1255
+ }
1256
+ } else {
1257
+ $xeInput.handleChange('', { type: 'check' })
1258
+ }
1259
+ }
1260
+ }
1261
+ },
1262
+ blurEvent (evnt: Event & { type: 'blur' }) {
1263
+ const $xeInput = this
1264
+ const reactData = $xeInput.reactData
1265
+
1266
+ const { inputValue } = reactData
1267
+ const inpImmediate = $xeInput.computeInpImmediate
1268
+ if (!inpImmediate) {
1269
+ $xeInput.handleChange(inputValue, evnt)
1270
+ }
1271
+ $xeInput.afterCheckValue()
1272
+ if (!reactData.visiblePanel) {
1273
+ reactData.isActivated = false
1274
+ }
1275
+ $xeInput.dispatchEvent('blur', { value: inputValue }, evnt)
1276
+ },
1277
+ // 密码
1278
+ passwordToggleEvent (evnt: Event) {
1279
+ const $xeInput = this
1280
+ const reactData = $xeInput.reactData
1281
+
1282
+ const { showPwd } = reactData
1283
+ const isDisabled = $xeInput.computeIsDisabled
1284
+ const isReadonly = $xeInput.computeIsReadonly
1285
+ if (!isDisabled && !isReadonly) {
1286
+ reactData.showPwd = !showPwd
1287
+ }
1288
+ $xeInput.dispatchEvent('toggle-visible', { visible: reactData.showPwd }, evnt)
1289
+ },
1290
+ // 搜索
1291
+ searchEvent (evnt: Event) {
1292
+ const $xeInput = this
1293
+
1294
+ $xeInput.dispatchEvent('search-click', {}, evnt)
1295
+ },
1296
+ // 数值
1297
+ numberChange (isPlus: boolean, evnt: Event) {
1298
+ const $xeInput = this
1299
+ const props = $xeInput
1300
+ const reactData = $xeInput.reactData
1301
+
1302
+ const { min, max, type } = props
1303
+ const { inputValue } = reactData
1304
+ const stepValue = $xeInput.computeStepValue
1305
+ const numValue = type === 'integer' ? XEUtils.toInteger(handleNumber(inputValue)) : XEUtils.toNumber(handleNumber(inputValue))
1306
+ const newValue = isPlus ? XEUtils.add(numValue, stepValue) : XEUtils.subtract(numValue, stepValue)
1307
+ let restNum: number | string
1308
+ if (!$xeInput.validMinNum(newValue)) {
1309
+ restNum = min
1310
+ } else if (!$xeInput.validMaxNum(newValue)) {
1311
+ restNum = max
1312
+ } else {
1313
+ restNum = newValue
1314
+ }
1315
+ $xeInput.emitInputEvent($xeInput.getNumberValue(restNum), evnt as (Event & { type: 'input' }))
1316
+ },
1317
+ numberNextEvent (evnt: Event) {
1318
+ const $xeInput = this
1319
+
1320
+ const isDisabled = $xeInput.computeIsDisabled
1321
+ const isReadonly = $xeInput.computeIsReadonly
1322
+ const isDisabledSubtractNumber = $xeInput.computeIsDisabledSubtractNumber
1323
+ $xeInput.numberStopDown()
1324
+ if (!isDisabled && !isReadonly && !isDisabledSubtractNumber) {
1325
+ $xeInput.numberChange(false, evnt)
1326
+ }
1327
+ $xeInput.dispatchEvent('next-number', {}, evnt)
1328
+ },
1329
+ numberDownNextEvent (evnt: Event) {
1330
+ const $xeInput = this
1331
+ const internalData = $xeInput.internalData
1332
+
1333
+ internalData.dnTimeout = window.setTimeout(() => {
1334
+ $xeInput.numberNextEvent(evnt)
1335
+ $xeInput.numberDownNextEvent(evnt)
1336
+ }, 60)
1337
+ },
1338
+ numberPrevEvent (evnt: Event) {
1339
+ const $xeInput = this
1340
+
1341
+ const isDisabled = $xeInput.computeIsDisabled
1342
+ const isReadonly = $xeInput.computeIsReadonly
1343
+ const isDisabledAddNumber = $xeInput.computeIsDisabledAddNumber
1344
+ $xeInput.numberStopDown()
1345
+ if (!isDisabled && !isReadonly && !isDisabledAddNumber) {
1346
+ $xeInput.numberChange(true, evnt)
1347
+ }
1348
+ $xeInput.dispatchEvent('prev-number', {}, evnt)
1349
+ },
1350
+ numberKeydownEvent (evnt: KeyboardEvent) {
1351
+ const $xeInput = this
1352
+
1353
+ const isUpArrow = globalEvents.hasKey(evnt, GLOBAL_EVENT_KEYS.ARROW_UP)
1354
+ const isDwArrow = globalEvents.hasKey(evnt, GLOBAL_EVENT_KEYS.ARROW_DOWN)
1355
+ if (isUpArrow || isDwArrow) {
1356
+ evnt.preventDefault()
1357
+ if (isUpArrow) {
1358
+ $xeInput.numberPrevEvent(evnt)
1359
+ } else {
1360
+ $xeInput.numberNextEvent(evnt)
1361
+ }
1362
+ }
1363
+ },
1364
+ keydownEvent (evnt: KeyboardEvent & { type: 'keydown' }) {
1365
+ const $xeInput = this
1366
+ const props = $xeInput
1367
+
1368
+ const { exponential, controls } = props
1369
+ const isNumType = $xeInput.computeIsNumType
1370
+ if (isNumType) {
1371
+ const isCtrlKey = evnt.ctrlKey
1372
+ const isShiftKey = evnt.shiftKey
1373
+ const isAltKey = evnt.altKey
1374
+ const keyCode = evnt.keyCode
1375
+ const isEsc = globalEvents.hasKey(evnt, GLOBAL_EVENT_KEYS.ESCAPE)
1376
+ const isUpArrow = globalEvents.hasKey(evnt, GLOBAL_EVENT_KEYS.ARROW_UP)
1377
+ const isDwArrow = globalEvents.hasKey(evnt, GLOBAL_EVENT_KEYS.ARROW_DOWN)
1378
+ if (!isCtrlKey && !isShiftKey && !isAltKey && (globalEvents.hasKey(evnt, GLOBAL_EVENT_KEYS.SPACEBAR) || ((!exponential || keyCode !== 69) && (keyCode >= 65 && keyCode <= 90)) || (keyCode >= 186 && keyCode <= 188) || keyCode >= 191)) {
1379
+ evnt.preventDefault()
1380
+ }
1381
+ if (isEsc) {
1382
+ $xeInput.afterCheckValue()
1383
+ } else if (isUpArrow || isDwArrow) {
1384
+ if (controls) {
1385
+ $xeInput.numberKeydownEvent(evnt)
1386
+ }
1387
+ }
1388
+ }
1389
+ $xeInput.triggerEvent(evnt)
1390
+ },
1391
+ keyupEvent (evnt: KeyboardEvent & { type: 'keyup' }) {
1392
+ const $xeInput = this
1393
+
1394
+ $xeInput.triggerEvent(evnt)
1395
+ },
1396
+ // 数值
1397
+ numberStopDown () {
1398
+ const $xeInput = this
1399
+ const internalData = $xeInput.internalData
1400
+
1401
+ const { dnTimeout } = internalData
1402
+ if (dnTimeout) {
1403
+ clearTimeout(dnTimeout)
1404
+ internalData.dnTimeout = undefined
1405
+ }
1406
+ },
1407
+ numberDownPrevEvent (evnt: Event) {
1408
+ const $xeInput = this
1409
+ const internalData = $xeInput.internalData
1410
+
1411
+ internalData.dnTimeout = window.setTimeout(() => {
1412
+ $xeInput.numberPrevEvent(evnt)
1413
+ $xeInput.numberDownPrevEvent(evnt)
1414
+ }, 60)
1415
+ },
1416
+ numberMousedownEvent (evnt: MouseEvent) {
1417
+ const $xeInput = this
1418
+ const internalData = $xeInput.internalData
1419
+
1420
+ $xeInput.numberStopDown()
1421
+ if (evnt.button === 0) {
1422
+ const isPrevNumber = hasClass(evnt.currentTarget, 'is--prev')
1423
+ if (isPrevNumber) {
1424
+ $xeInput.numberPrevEvent(evnt)
1425
+ } else {
1426
+ $xeInput.numberNextEvent(evnt)
1427
+ }
1428
+ internalData.dnTimeout = window.setTimeout(() => {
1429
+ if (isPrevNumber) {
1430
+ $xeInput.numberDownPrevEvent(evnt)
1431
+ } else {
1432
+ $xeInput.numberDownNextEvent(evnt)
1433
+ }
1434
+ }, 500)
1435
+ }
1436
+ },
1437
+ wheelEvent (evnt: WheelEvent & {
1438
+ type: 'wheel';
1439
+ wheelDelta: number;
1440
+ }) {
1441
+ const $xeInput = this
1442
+ const props = $xeInput
1443
+ const reactData = $xeInput.reactData
1444
+
1445
+ const isNumType = $xeInput.computeIsNumType
1446
+ if (isNumType && props.controls) {
1447
+ if (reactData.isActivated) {
1448
+ const delta = evnt.deltaY
1449
+ if (delta > 0) {
1450
+ $xeInput.numberNextEvent(evnt)
1451
+ } else if (delta < 0) {
1452
+ $xeInput.numberPrevEvent(evnt)
1453
+ }
1454
+ evnt.preventDefault()
1455
+ }
1456
+ }
1457
+ $xeInput.triggerEvent(evnt)
1458
+ },
1459
+ // 日期
1460
+ dateMonthHandle (date: Date, offsetMonth: number) {
1461
+ const $xeInput = this
1462
+ const reactData = $xeInput.reactData
1463
+
1464
+ reactData.selectMonth = XEUtils.getWhatMonth(date, offsetMonth, 'first')
1465
+ },
1466
+ dateNowHandle () {
1467
+ const $xeInput = this
1468
+ const reactData = $xeInput.reactData
1469
+
1470
+ const currentDate = XEUtils.getWhatDay(Date.now(), 0, 'first')
1471
+ reactData.currentDate = currentDate
1472
+ $xeInput.dateMonthHandle(currentDate, 0)
1473
+ },
1474
+ dateToggleTypeEvent () {
1475
+ const $xeInput = this
1476
+ const reactData = $xeInput.reactData
1477
+
1478
+ let { datePanelType } = reactData
1479
+ if (datePanelType === 'month' || datePanelType === 'quarter') {
1480
+ datePanelType = 'year'
1481
+ } else {
1482
+ datePanelType = 'month'
1483
+ }
1484
+ reactData.datePanelType = datePanelType
1485
+ },
1486
+ datePrevEvent (evnt: Event) {
1487
+ const $xeInput = this
1488
+ const props = $xeInput
1489
+ const reactData = $xeInput.reactData
1490
+ const internalData = $xeInput.internalData
1491
+
1492
+ const { type } = props
1493
+ const { datePanelType, selectMonth } = reactData
1494
+ const { yearSize } = internalData
1495
+ const isDisabledPrevDateBtn = $xeInput.computeIsDisabledPrevDateBtn
1496
+ if (!isDisabledPrevDateBtn) {
1497
+ if (type === 'year') {
1498
+ reactData.selectMonth = XEUtils.getWhatYear(selectMonth, -yearSize, 'first')
1499
+ } else if (type === 'month' || type === 'quarter') {
1500
+ if (datePanelType === 'year') {
1501
+ reactData.selectMonth = XEUtils.getWhatYear(selectMonth, -yearSize, 'first')
1502
+ } else {
1503
+ reactData.selectMonth = XEUtils.getWhatYear(selectMonth, -1, 'first')
1504
+ }
1505
+ } else {
1506
+ if (datePanelType === 'year') {
1507
+ reactData.selectMonth = XEUtils.getWhatYear(selectMonth, -yearSize, 'first')
1508
+ } else if (datePanelType === 'month') {
1509
+ reactData.selectMonth = XEUtils.getWhatYear(selectMonth, -1, 'first')
1510
+ } else {
1511
+ reactData.selectMonth = XEUtils.getWhatMonth(selectMonth, -1, 'first')
1512
+ }
1513
+ }
1514
+ $xeInput.dispatchEvent('date-prev', { type }, evnt)
1515
+ }
1516
+ },
1517
+ dateTodayMonthEvent (evnt: Event) {
1518
+ const $xeInput = this
1519
+ const props = $xeInput
1520
+ const reactData = $xeInput.reactData
1521
+
1522
+ $xeInput.dateNowHandle()
1523
+ if (!props.multiple) {
1524
+ $xeInput.dateChange(reactData.currentDate)
1525
+ $xeInput.hidePanel()
1526
+ }
1527
+ $xeInput.dispatchEvent('date-today', { type: props.type }, evnt)
1528
+ },
1529
+ dateNextEvent (evnt: Event) {
1530
+ const $xeInput = this
1531
+ const props = $xeInput
1532
+ const reactData = $xeInput.reactData
1533
+ const internalData = $xeInput.internalData
1534
+
1535
+ const { type } = props
1536
+ const { datePanelType, selectMonth } = reactData
1537
+ const { yearSize } = internalData
1538
+ const isDisabledNextDateBtn = $xeInput.computeIsDisabledNextDateBtn
1539
+ if (!isDisabledNextDateBtn) {
1540
+ if (type === 'year') {
1541
+ reactData.selectMonth = XEUtils.getWhatYear(selectMonth, yearSize, 'first')
1542
+ } else if (type === 'month' || type === 'quarter') {
1543
+ if (datePanelType === 'year') {
1544
+ reactData.selectMonth = XEUtils.getWhatYear(selectMonth, yearSize, 'first')
1545
+ } else {
1546
+ reactData.selectMonth = XEUtils.getWhatYear(selectMonth, 1, 'first')
1547
+ }
1548
+ } else {
1549
+ if (datePanelType === 'year') {
1550
+ reactData.selectMonth = XEUtils.getWhatYear(selectMonth, yearSize, 'first')
1551
+ } else if (datePanelType === 'month') {
1552
+ reactData.selectMonth = XEUtils.getWhatYear(selectMonth, 1, 'first')
1553
+ } else {
1554
+ reactData.selectMonth = XEUtils.getWhatMonth(selectMonth, 1, 'first')
1555
+ }
1556
+ }
1557
+ $xeInput.dispatchEvent('date-next', { type }, evnt)
1558
+ }
1559
+ },
1560
+ isDateDisabled (item: { date: Date }) {
1561
+ const $xeInput = this
1562
+ const props = $xeInput
1563
+ const reactData = $xeInput.reactData
1564
+
1565
+ const { disabledMethod } = props
1566
+ const { datePanelType } = reactData
1567
+ return disabledMethod && disabledMethod({ type: datePanelType, viewType: datePanelType, date: item.date, $input: $xeInput as VxeInputConstructor })
1568
+ },
1569
+ dateSelectItem (date: Date) {
1570
+ const $xeInput = this
1571
+ const props = $xeInput
1572
+ const reactData = $xeInput.reactData
1573
+
1574
+ const { type, multiple } = props
1575
+ const { datePanelType } = reactData
1576
+ if (type === 'month') {
1577
+ if (datePanelType === 'year') {
1578
+ reactData.datePanelType = 'month'
1579
+ $xeInput.dateCheckMonth(date)
1580
+ } else {
1581
+ $xeInput.dateChange(date)
1582
+ if (!multiple) {
1583
+ $xeInput.hidePanel()
1584
+ }
1585
+ }
1586
+ } else if (type === 'year') {
1587
+ $xeInput.dateChange(date)
1588
+ if (!multiple) {
1589
+ $xeInput.hidePanel()
1590
+ }
1591
+ } else if (type === 'quarter') {
1592
+ if (datePanelType === 'year') {
1593
+ reactData.datePanelType = 'quarter'
1594
+ $xeInput.dateCheckMonth(date)
1595
+ } else {
1596
+ $xeInput.dateChange(date)
1597
+ if (!multiple) {
1598
+ $xeInput.hidePanel()
1599
+ }
1600
+ }
1601
+ } else {
1602
+ if (datePanelType === 'month') {
1603
+ reactData.datePanelType = type === 'week' ? type : 'day'
1604
+ $xeInput.dateCheckMonth(date)
1605
+ } else if (datePanelType === 'year') {
1606
+ reactData.datePanelType = 'month'
1607
+ $xeInput.dateCheckMonth(date)
1608
+ } else {
1609
+ $xeInput.dateChange(date)
1610
+ if (type === 'datetime') {
1611
+ // 日期带时间
1612
+ } else {
1613
+ if (!multiple) {
1614
+ $xeInput.hidePanel()
1615
+ }
1616
+ }
1617
+ }
1618
+ }
1619
+ },
1620
+ dateSelectEvent (item: VxeDatePickerDefines.DateYearItem | VxeDatePickerDefines.DateQuarterItem | VxeDatePickerDefines.DateMonthItem | VxeDatePickerDefines.DateDayItem) {
1621
+ const $xeInput = this
1622
+
1623
+ if (!$xeInput.isDateDisabled(item)) {
1624
+ $xeInput.dateSelectItem(item.date)
1625
+ }
1626
+ },
1627
+ dateMoveDay (offsetDay: Date) {
1628
+ const $xeInput = this
1629
+
1630
+ if (!$xeInput.isDateDisabled({ date: offsetDay })) {
1631
+ const dayList = $xeInput.computeDayList
1632
+ if (!dayList.some((item) => XEUtils.isDateSame(item.date, offsetDay, 'yyyyMMdd'))) {
1633
+ $xeInput.dateCheckMonth(offsetDay)
1634
+ }
1635
+ $xeInput.dateParseValue(offsetDay)
1636
+ }
1637
+ },
1638
+ dateMoveYear (offsetYear: Date) {
1639
+ const $xeInput = this
1640
+
1641
+ if (!$xeInput.isDateDisabled({ date: offsetYear })) {
1642
+ const yearList = $xeInput.computeYearList
1643
+ if (!yearList.some((item) => XEUtils.isDateSame(item.date, offsetYear, 'yyyy'))) {
1644
+ $xeInput.dateCheckMonth(offsetYear)
1645
+ }
1646
+ $xeInput.dateParseValue(offsetYear)
1647
+ }
1648
+ },
1649
+ dateMoveQuarter (offsetQuarter: Date) {
1650
+ const $xeInput = this
1651
+
1652
+ if (!$xeInput.isDateDisabled({ date: offsetQuarter })) {
1653
+ const quarterList = $xeInput.computeQuarterList
1654
+ if (!quarterList.some((item) => XEUtils.isDateSame(item.date, offsetQuarter, 'yyyyq'))) {
1655
+ $xeInput.dateCheckMonth(offsetQuarter)
1656
+ }
1657
+ $xeInput.dateParseValue(offsetQuarter)
1658
+ }
1659
+ },
1660
+ dateMoveMonth (offsetMonth: Date) {
1661
+ const $xeInput = this
1662
+
1663
+ if (!$xeInput.isDateDisabled({ date: offsetMonth })) {
1664
+ const monthList = $xeInput.computeMonthList
1665
+ if (!monthList.some((item) => XEUtils.isDateSame(item.date, offsetMonth, 'yyyyMM'))) {
1666
+ $xeInput.dateCheckMonth(offsetMonth)
1667
+ }
1668
+ $xeInput.dateParseValue(offsetMonth)
1669
+ }
1670
+ },
1671
+ dateMouseenterEvent (item: VxeDatePickerDefines.DateYearItem | VxeDatePickerDefines.DateQuarterItem | VxeDatePickerDefines.DateMonthItem | VxeDatePickerDefines.DateDayItem) {
1672
+ const $xeInput = this
1673
+ const reactData = $xeInput.reactData
1674
+
1675
+ if (!$xeInput.isDateDisabled(item)) {
1676
+ const { datePanelType } = reactData
1677
+ if (datePanelType === 'month') {
1678
+ $xeInput.dateMoveMonth(item.date)
1679
+ } else if (datePanelType === 'quarter') {
1680
+ $xeInput.dateMoveQuarter(item.date)
1681
+ } else if (datePanelType === 'year') {
1682
+ $xeInput.dateMoveYear(item.date)
1683
+ } else {
1684
+ $xeInput.dateMoveDay(item.date)
1685
+ }
1686
+ }
1687
+ },
1688
+ updateTimePos (liElem: Element) {
1689
+ if (liElem) {
1690
+ const height = (liElem as HTMLElement).offsetHeight
1691
+ const ulElem = liElem.parentNode as HTMLElement
1692
+ ulElem.scrollTop = (liElem as HTMLElement).offsetTop - height * 4
1693
+ }
1694
+ },
1695
+ dateTimeChangeEvent (evnt: Event) {
1696
+ const $xeInput = this
1697
+ const reactData = $xeInput.reactData
1698
+
1699
+ reactData.datetimePanelValue = new Date(reactData.datetimePanelValue.getTime())
1700
+ $xeInput.updateTimePos(evnt.currentTarget as HTMLLIElement)
1701
+ },
1702
+ dateHourEvent (evnt: MouseEvent, item: VxeDatePickerDefines.DateHourMinuteSecondItem) {
1703
+ const $xeInput = this
1704
+ const reactData = $xeInput.reactData
1705
+
1706
+ reactData.datetimePanelValue.setHours(item.value)
1707
+ $xeInput.dateTimeChangeEvent(evnt)
1708
+ },
1709
+ dateConfirmEvent () {
1710
+ const $xeInput = this
1711
+ const props = $xeInput
1712
+ const reactData = $xeInput.reactData
1713
+
1714
+ const { multiple } = props
1715
+ const { datetimePanelValue } = reactData
1716
+ const dateValue = $xeInput.computeDateValue
1717
+ const isDateTimeType = $xeInput.computeIsDateTimeType
1718
+ if (isDateTimeType) {
1719
+ const dateValueFormat = $xeInput.computeDateValueFormat
1720
+ if (multiple) {
1721
+ // 如果为多选
1722
+ const dateMultipleValue = $xeInput.computeDateMultipleValue
1723
+ if (isDateTimeType) {
1724
+ // 如果是datetime特殊类型
1725
+ const dateListValue = [...$xeInput.computeDateListValue]
1726
+ const datetimeRest: Date[] = []
1727
+ dateListValue.forEach(item => {
1728
+ if (item) {
1729
+ item.setHours(datetimePanelValue.getHours())
1730
+ item.setMinutes(datetimePanelValue.getMinutes())
1731
+ item.setSeconds(datetimePanelValue.getSeconds())
1732
+ datetimeRest.push(item)
1733
+ }
1734
+ })
1735
+ $xeInput.handleChange(datetimeRest.map(date => XEUtils.toDateString(date, dateValueFormat)).join(','), { type: 'update' })
1736
+ } else {
1737
+ // 如果是日期类型
1738
+ $xeInput.handleChange(dateMultipleValue.join(','), { type: 'update' })
1739
+ }
1740
+ } else {
1741
+ $xeInput.dateChange(dateValue || reactData.currentDate)
1742
+ }
1743
+ }
1744
+ $xeInput.hidePanel()
1745
+ },
1746
+ dateMinuteEvent (evnt: MouseEvent, item: VxeDatePickerDefines.DateHourMinuteSecondItem) {
1747
+ const $xeInput = this
1748
+ const reactData = $xeInput.reactData
1749
+
1750
+ reactData.datetimePanelValue.setMinutes(item.value)
1751
+ $xeInput.dateTimeChangeEvent(evnt)
1752
+ },
1753
+ dateSecondEvent (evnt: MouseEvent, item: VxeDatePickerDefines.DateHourMinuteSecondItem) {
1754
+ const $xeInput = this
1755
+ const reactData = $xeInput.reactData
1756
+
1757
+ reactData.datetimePanelValue.setSeconds(item.value)
1758
+ $xeInput.dateTimeChangeEvent(evnt)
1759
+ },
1760
+ dateOffsetEvent (evnt: KeyboardEvent) {
1761
+ const $xeInput = this
1762
+ const reactData = $xeInput.reactData
1763
+
1764
+ const { isActivated, datePanelValue, datePanelType } = reactData
1765
+ if (isActivated) {
1766
+ evnt.preventDefault()
1767
+ const isLeftArrow = globalEvents.hasKey(evnt, GLOBAL_EVENT_KEYS.ARROW_LEFT)
1768
+ const isUpArrow = globalEvents.hasKey(evnt, GLOBAL_EVENT_KEYS.ARROW_UP)
1769
+ const isRightArrow = globalEvents.hasKey(evnt, GLOBAL_EVENT_KEYS.ARROW_RIGHT)
1770
+ const isDwArrow = globalEvents.hasKey(evnt, GLOBAL_EVENT_KEYS.ARROW_DOWN)
1771
+ if (datePanelType === 'year') {
1772
+ let offsetYear = XEUtils.getWhatYear(datePanelValue || Date.now(), 0, 'first')
1773
+ if (isLeftArrow) {
1774
+ offsetYear = XEUtils.getWhatYear(offsetYear, -1)
1775
+ } else if (isUpArrow) {
1776
+ offsetYear = XEUtils.getWhatYear(offsetYear, -4)
1777
+ } else if (isRightArrow) {
1778
+ offsetYear = XEUtils.getWhatYear(offsetYear, 1)
1779
+ } else if (isDwArrow) {
1780
+ offsetYear = XEUtils.getWhatYear(offsetYear, 4)
1781
+ }
1782
+ $xeInput.dateMoveYear(offsetYear)
1783
+ } else if (datePanelType === 'quarter') {
1784
+ let offsetQuarter = XEUtils.getWhatQuarter(datePanelValue || Date.now(), 0, 'first')
1785
+ if (isLeftArrow) {
1786
+ offsetQuarter = XEUtils.getWhatQuarter(offsetQuarter, -1)
1787
+ } else if (isUpArrow) {
1788
+ offsetQuarter = XEUtils.getWhatQuarter(offsetQuarter, -2)
1789
+ } else if (isRightArrow) {
1790
+ offsetQuarter = XEUtils.getWhatQuarter(offsetQuarter, 1)
1791
+ } else if (isDwArrow) {
1792
+ offsetQuarter = XEUtils.getWhatQuarter(offsetQuarter, 2)
1793
+ }
1794
+ $xeInput.dateMoveQuarter(offsetQuarter)
1795
+ } else if (datePanelType === 'month') {
1796
+ let offsetMonth = XEUtils.getWhatMonth(datePanelValue || Date.now(), 0, 'first')
1797
+ if (isLeftArrow) {
1798
+ offsetMonth = XEUtils.getWhatMonth(offsetMonth, -1)
1799
+ } else if (isUpArrow) {
1800
+ offsetMonth = XEUtils.getWhatMonth(offsetMonth, -4)
1801
+ } else if (isRightArrow) {
1802
+ offsetMonth = XEUtils.getWhatMonth(offsetMonth, 1)
1803
+ } else if (isDwArrow) {
1804
+ offsetMonth = XEUtils.getWhatMonth(offsetMonth, 4)
1805
+ }
1806
+ $xeInput.dateMoveMonth(offsetMonth)
1807
+ } else {
1808
+ let offsetDay = datePanelValue || XEUtils.getWhatDay(Date.now(), 0, 'first')
1809
+ const firstDayOfWeek = $xeInput.computeFirstDayOfWeek
1810
+ if (isLeftArrow) {
1811
+ offsetDay = XEUtils.getWhatDay(offsetDay, -1)
1812
+ } else if (isUpArrow) {
1813
+ offsetDay = XEUtils.getWhatWeek(offsetDay, -1, firstDayOfWeek)
1814
+ } else if (isRightArrow) {
1815
+ offsetDay = XEUtils.getWhatDay(offsetDay, 1)
1816
+ } else if (isDwArrow) {
1817
+ offsetDay = XEUtils.getWhatWeek(offsetDay, 1, firstDayOfWeek)
1818
+ }
1819
+ $xeInput.dateMoveDay(offsetDay)
1820
+ }
1821
+ }
1822
+ },
1823
+ datePgOffsetEvent (evnt: KeyboardEvent) {
1824
+ const $xeInput = this
1825
+ const reactData = $xeInput.reactData
1826
+
1827
+ const { isActivated } = reactData
1828
+ if (isActivated) {
1829
+ const isPgUp = globalEvents.hasKey(evnt, GLOBAL_EVENT_KEYS.PAGE_UP)
1830
+ evnt.preventDefault()
1831
+ if (isPgUp) {
1832
+ $xeInput.datePrevEvent(evnt)
1833
+ } else {
1834
+ $xeInput.dateNextEvent(evnt)
1835
+ }
1836
+ }
1837
+ },
1838
+ dateOpenPanel () {
1839
+ const $xeInput = this
1840
+ const props = $xeInput
1841
+ const reactData = $xeInput.reactData
1842
+
1843
+ const { type } = props
1844
+ const isDateTimeType = $xeInput.computeIsDateTimeType
1845
+ const dateValue = $xeInput.computeDateValue
1846
+ if (['year', 'quarter', 'month', 'week'].indexOf(type) > -1) {
1847
+ reactData.datePanelType = type as 'year' | 'quarter' | 'month' | 'week'
1848
+ } else {
1849
+ reactData.datePanelType = 'day'
1850
+ }
1851
+ reactData.currentDate = XEUtils.getWhatDay(Date.now(), 0, 'first')
1852
+ if (dateValue) {
1853
+ $xeInput.dateMonthHandle(dateValue, 0)
1854
+ $xeInput.dateParseValue(dateValue)
1855
+ } else {
1856
+ $xeInput.dateNowHandle()
1857
+ }
1858
+ if (isDateTimeType) {
1859
+ reactData.datetimePanelValue = reactData.datePanelValue || XEUtils.getWhatDay(Date.now(), 0, 'first')
1860
+ $xeInput.$nextTick(() => {
1861
+ const timeBodyElem = $xeInput.$refs.refInputTimeBody as HTMLDivElement
1862
+ XEUtils.arrayEach(timeBodyElem.querySelectorAll('li.is--selected'), (elem) => {
1863
+ $xeInput.updateTimePos(elem)
1864
+ })
1865
+ })
1866
+ }
1867
+ },
1868
+ // 弹出面板
1869
+ updateZindex () {
1870
+ const $xeInput = this
1871
+ const reactData = $xeInput.reactData
1872
+
1873
+ if (reactData.panelIndex < getLastZIndex()) {
1874
+ reactData.panelIndex = nextZIndex()
1875
+ }
1876
+ },
1877
+ updatePlacement () {
1878
+ const $xeInput = this
1879
+ const props = $xeInput
1880
+ const reactData = $xeInput.reactData
1881
+
1882
+ return $xeInput.$nextTick().then(() => {
1883
+ const { placement } = props
1884
+ const { panelIndex } = reactData
1885
+ const targetElem = $xeInput.$refs.refInputTarget as HTMLInputElement
1886
+ const panelElem = $xeInput.$refs.refInputPanel as HTMLDivElement
1887
+ const btnTransfer = $xeInput.computeBtnTransfer
1888
+ if (targetElem && panelElem) {
1889
+ const targetHeight = targetElem.offsetHeight
1890
+ const targetWidth = targetElem.offsetWidth
1891
+ const panelHeight = panelElem.offsetHeight
1892
+ const panelWidth = panelElem.offsetWidth
1893
+ const marginSize = 5
1894
+ const panelStyle: VxeComponentStyleType = {
1895
+ zIndex: panelIndex
1896
+ }
1897
+ const { boundingTop, boundingLeft, visibleHeight, visibleWidth } = getAbsolutePos(targetElem)
1898
+ let panelPlacement: VxeInputPropTypes.Placement = 'bottom'
1899
+ if (btnTransfer) {
1900
+ let left = boundingLeft
1901
+ let top = boundingTop + targetHeight
1902
+ if (placement === 'top') {
1903
+ panelPlacement = 'top'
1904
+ top = boundingTop - panelHeight
1905
+ } else if (!placement) {
1906
+ // 如果下面不够放,则向上
1907
+ if (top + panelHeight + marginSize > visibleHeight) {
1908
+ panelPlacement = 'top'
1909
+ top = boundingTop - panelHeight
1910
+ }
1911
+ // 如果上面不够放,则向下(优先)
1912
+ if (top < marginSize) {
1913
+ panelPlacement = 'bottom'
1914
+ top = boundingTop + targetHeight
1915
+ }
1916
+ }
1917
+ // 如果溢出右边
1918
+ if (left + panelWidth + marginSize > visibleWidth) {
1919
+ left -= left + panelWidth + marginSize - visibleWidth
1920
+ }
1921
+ // 如果溢出左边
1922
+ if (left < marginSize) {
1923
+ left = marginSize
1924
+ }
1925
+ Object.assign(panelStyle, {
1926
+ left: `${left}px`,
1927
+ top: `${top}px`,
1928
+ minWidth: `${targetWidth}px`
1929
+ })
1930
+ } else {
1931
+ if (placement === 'top') {
1932
+ panelPlacement = 'top'
1933
+ panelStyle.bottom = `${targetHeight}px`
1934
+ } else if (!placement) {
1935
+ // 如果下面不够放,则向上
1936
+ panelStyle.top = `${targetHeight}px`
1937
+ if (boundingTop + targetHeight + panelHeight > visibleHeight) {
1938
+ // 如果上面不够放,则向下(优先)
1939
+ if (boundingTop - targetHeight - panelHeight > marginSize) {
1940
+ panelPlacement = 'top'
1941
+ panelStyle.top = ''
1942
+ panelStyle.bottom = `${targetHeight}px`
1943
+ }
1944
+ }
1945
+ }
1946
+ }
1947
+ reactData.panelStyle = panelStyle
1948
+ reactData.panelPlacement = panelPlacement
1949
+ return $xeInput.$nextTick()
1950
+ }
1951
+ })
1952
+ },
1953
+ showPanel () {
1954
+ const $xeInput = this
1955
+ const reactData = $xeInput.reactData
1956
+ const internalData = $xeInput.internalData
1957
+
1958
+ const { visiblePanel } = reactData
1959
+ const { hpTimeout } = internalData
1960
+ const isDisabled = $xeInput.computeIsDisabled
1961
+ const isDatePickerType = $xeInput.computeIsDatePickerType
1962
+ const btnTransfer = $xeInput.computeBtnTransfer
1963
+ if (!isDisabled && !visiblePanel) {
1964
+ const panelElem = $xeInput.$refs.refInputPanel as HTMLElement
1965
+ if (!reactData.initialized) {
1966
+ reactData.initialized = true
1967
+ if (btnTransfer) {
1968
+ if (panelElem) {
1969
+ document.body.appendChild(panelElem)
1970
+ }
1971
+ }
1972
+ }
1973
+ if (hpTimeout) {
1974
+ clearTimeout(hpTimeout)
1975
+ internalData.hpTimeout = undefined
1976
+ }
1977
+ reactData.isActivated = true
1978
+ reactData.isAniVisible = true
1979
+ if (isDatePickerType) {
1980
+ $xeInput.dateOpenPanel()
1981
+ }
1982
+ setTimeout(() => {
1983
+ reactData.visiblePanel = true
1984
+ }, 10)
1985
+ $xeInput.updateZindex()
1986
+ return $xeInput.updatePlacement()
1987
+ }
1988
+ return $xeInput.$nextTick()
1989
+ },
1990
+ datePickerOpenEvent (evnt: Event) {
1991
+ const $xeInput = this
1992
+
1993
+ const isReadonly = $xeInput.computeIsReadonly
1994
+ if (!isReadonly) {
1995
+ evnt.preventDefault()
1996
+ $xeInput.showPanel()
1997
+ }
1998
+ },
1999
+ clickEvent (evnt: Event & { type: 'click' }) {
2000
+ const $xeInput = this
2001
+
2002
+ $xeInput.triggerEvent(evnt)
2003
+ },
2004
+ handleGlobalMousedownEvent (evnt: Event) {
2005
+ const $xeInput = this
2006
+ const reactData = $xeInput.reactData
2007
+
2008
+ const { visiblePanel, isActivated } = reactData
2009
+ const isDatePickerType = $xeInput.computeIsDatePickerType
2010
+ const el = $xeInput.$refs.refElem as HTMLDivElement
2011
+ const panelWrapperElem = $xeInput.$refs.refPanelWrapper as HTMLDivElement
2012
+ const isDisabled = $xeInput.computeIsDisabled
2013
+ if (!isDisabled && isActivated) {
2014
+ reactData.isActivated = getEventTargetNode(evnt, el).flag || getEventTargetNode(evnt, panelWrapperElem).flag
2015
+ if (!reactData.isActivated) {
2016
+ // 如果是日期类型
2017
+ if (isDatePickerType) {
2018
+ if (visiblePanel) {
2019
+ $xeInput.hidePanel()
2020
+ $xeInput.afterCheckValue()
2021
+ }
2022
+ } else {
2023
+ $xeInput.afterCheckValue()
2024
+ }
2025
+ }
2026
+ }
2027
+ },
2028
+ handleGlobalKeydownEvent (evnt: KeyboardEvent) {
2029
+ const $xeInput = this
2030
+ const props = $xeInput
2031
+ const reactData = $xeInput.reactData
2032
+
2033
+ const { clearable } = props
2034
+ const { visiblePanel } = reactData
2035
+ const isDisabled = $xeInput.computeIsDisabled
2036
+ const isDatePickerType = $xeInput.computeIsDatePickerType
2037
+ if (!isDisabled) {
2038
+ const isTab = globalEvents.hasKey(evnt, GLOBAL_EVENT_KEYS.TAB)
2039
+ const isDel = globalEvents.hasKey(evnt, GLOBAL_EVENT_KEYS.DELETE)
2040
+ const isEsc = globalEvents.hasKey(evnt, GLOBAL_EVENT_KEYS.ESCAPE)
2041
+ const isEnter = globalEvents.hasKey(evnt, GLOBAL_EVENT_KEYS.ENTER)
2042
+ const isLeftArrow = globalEvents.hasKey(evnt, GLOBAL_EVENT_KEYS.ARROW_LEFT)
2043
+ const isUpArrow = globalEvents.hasKey(evnt, GLOBAL_EVENT_KEYS.ARROW_UP)
2044
+ const isRightArrow = globalEvents.hasKey(evnt, GLOBAL_EVENT_KEYS.ARROW_RIGHT)
2045
+ const isDwArrow = globalEvents.hasKey(evnt, GLOBAL_EVENT_KEYS.ARROW_DOWN)
2046
+ const isPgUp = globalEvents.hasKey(evnt, GLOBAL_EVENT_KEYS.PAGE_UP)
2047
+ const isPgDn = globalEvents.hasKey(evnt, GLOBAL_EVENT_KEYS.PAGE_DOWN)
2048
+ const operArrow = isLeftArrow || isUpArrow || isRightArrow || isDwArrow
2049
+ let isActivated = reactData.isActivated
2050
+ if (isTab) {
2051
+ if (isActivated) {
2052
+ $xeInput.afterCheckValue()
2053
+ }
2054
+ isActivated = false
2055
+ reactData.isActivated = isActivated
2056
+ } else if (operArrow) {
2057
+ if (isDatePickerType) {
2058
+ if (isActivated) {
2059
+ if (visiblePanel) {
2060
+ $xeInput.dateOffsetEvent(evnt)
2061
+ } else if (isUpArrow || isDwArrow) {
2062
+ $xeInput.datePickerOpenEvent(evnt)
2063
+ }
2064
+ }
2065
+ }
2066
+ } else if (isEnter) {
2067
+ if (isDatePickerType) {
2068
+ if (visiblePanel) {
2069
+ if (reactData.datePanelValue) {
2070
+ $xeInput.dateSelectItem(reactData.datePanelValue)
2071
+ } else {
2072
+ $xeInput.hidePanel()
2073
+ }
2074
+ } else if (isActivated) {
2075
+ $xeInput.datePickerOpenEvent(evnt)
2076
+ }
2077
+ }
2078
+ } else if (isPgUp || isPgDn) {
2079
+ if (isDatePickerType) {
2080
+ if (isActivated) {
2081
+ $xeInput.datePgOffsetEvent(evnt)
2082
+ }
2083
+ }
2084
+ }
2085
+ if (isTab || isEsc) {
2086
+ if (visiblePanel) {
2087
+ $xeInput.hidePanel()
2088
+ }
2089
+ } else if (isDel && clearable) {
2090
+ if (isActivated) {
2091
+ $xeInput.clearValueEvent(evnt, null)
2092
+ }
2093
+ }
2094
+ }
2095
+ },
2096
+ handleGlobalMousewheelEvent (evnt: Event) {
2097
+ const $xeInput = this
2098
+ const reactData = $xeInput.reactData
2099
+
2100
+ const { visiblePanel } = reactData
2101
+ const isDisabled = $xeInput.computeIsDisabled
2102
+ if (!isDisabled) {
2103
+ if (visiblePanel) {
2104
+ const panelWrapperElem = $xeInput.$refs.refPanelWrapper as HTMLDivElement
2105
+ if (getEventTargetNode(evnt, panelWrapperElem).flag) {
2106
+ $xeInput.updatePlacement()
2107
+ } else {
2108
+ $xeInput.hidePanel()
2109
+ $xeInput.afterCheckValue()
2110
+ }
2111
+ }
2112
+ }
2113
+ },
2114
+ handleGlobalBlurEvent () {
2115
+ const $xeInput = this
2116
+ const reactData = $xeInput.reactData
2117
+
2118
+ const { isActivated, visiblePanel } = reactData
2119
+ if (visiblePanel) {
2120
+ $xeInput.hidePanel()
2121
+ $xeInput.afterCheckValue()
2122
+ } else if (isActivated) {
2123
+ $xeInput.afterCheckValue()
2124
+ }
2125
+ },
2126
+
2127
+ //
2128
+ // Render
2129
+ //
2130
+ renderDateLabel (h: CreateElement, item: VxeDatePickerDefines.DateYearItem | VxeDatePickerDefines.DateQuarterItem | VxeDatePickerDefines.DateMonthItem | VxeDatePickerDefines.DateDayItem, label: string | number) {
2131
+ const $xeInput = this
2132
+ const props = $xeInput
2133
+ const reactData = $xeInput.reactData
2134
+
2135
+ const { festivalMethod } = props
2136
+ if (festivalMethod) {
2137
+ const { datePanelType } = reactData
2138
+ const festivalRest = festivalMethod({ type: datePanelType, viewType: datePanelType, date: item.date, $input: $xeInput as VxeInputConstructor })
2139
+ const festivalItem = festivalRest ? (XEUtils.isString(festivalRest) ? { label: festivalRest } : festivalRest) : {}
2140
+ const extraItem = festivalItem.extra ? (XEUtils.isString(festivalItem.extra) ? { label: festivalItem.extra } : festivalItem.extra) : null
2141
+ const labels = [
2142
+ h('span', {
2143
+ class: ['vxe-input--date-label', {
2144
+ 'is-notice': festivalItem.notice
2145
+ }]
2146
+ }, extraItem && extraItem.label
2147
+ ? [
2148
+ h('span', `${label || ''}`),
2149
+ h('span', {
2150
+ class: ['vxe-input--date-label--extra', extraItem.important ? 'is-important' : '', extraItem.className],
2151
+ style: extraItem.style
2152
+ }, XEUtils.toValueString(extraItem.label))
2153
+ ]
2154
+ : [`${label || ''}`])
2155
+ ]
2156
+ const festivalLabel = festivalItem.label
2157
+ if (festivalLabel) {
2158
+ // 默认最多支持3个节日重叠
2159
+ const festivalLabels = XEUtils.toValueString(festivalLabel).split(',')
2160
+ labels.push(
2161
+ h('span', {
2162
+ class: ['vxe-input--date-festival', festivalItem.important ? 'is-important' : '', festivalItem.className],
2163
+ style: festivalItem.style
2164
+ }, [
2165
+ festivalLabels.length > 1
2166
+ ? h('span', {
2167
+ class: ['vxe-input--date-festival--overlap', `overlap--${festivalLabels.length}`]
2168
+ }, festivalLabels.map(label => h('span', label.substring(0, 3))))
2169
+ : h('span', {
2170
+ class: 'vxe-input--date-festival--label'
2171
+ }, festivalLabels[0].substring(0, 3))
2172
+ ])
2173
+ )
2174
+ }
2175
+ return labels
2176
+ }
2177
+ return [`${label || ''}`]
2178
+ },
2179
+ renderDateDayTable (h: CreateElement) {
2180
+ const $xeInput = this
2181
+ const props = $xeInput
2182
+ const reactData = $xeInput.reactData
2183
+
2184
+ const { multiple } = props
2185
+ const { datePanelType, datePanelValue } = reactData
2186
+ const dateValue = $xeInput.computeDateValue
2187
+ const dateHeaders = $xeInput.computeDateHeaders
2188
+ const dayDatas = $xeInput.computeDayDatas
2189
+ const dateListValue = $xeInput.computeDateListValue
2190
+ const matchFormat = 'yyyyMMdd'
2191
+ return [
2192
+ h('table', {
2193
+ class: `vxe-input--date-${datePanelType}-view`,
2194
+ attrs: {
2195
+ cellspacing: 0,
2196
+ cellpadding: 0,
2197
+ border: 0
2198
+ }
2199
+ }, [
2200
+ h('thead', [
2201
+ h('tr', dateHeaders.map((item) => {
2202
+ return h('th', item.label)
2203
+ }))
2204
+ ]),
2205
+ h('tbody', dayDatas.map((rows) => {
2206
+ return h('tr', rows.map((item) => {
2207
+ return h('td', {
2208
+ class: {
2209
+ 'is--prev': item.isPrev,
2210
+ 'is--current': item.isCurrent,
2211
+ 'is--now': item.isNow,
2212
+ 'is--next': item.isNext,
2213
+ 'is--disabled': $xeInput.isDateDisabled(item),
2214
+ 'is--selected': multiple ? dateListValue.some(val => XEUtils.isDateSame(val, item.date, matchFormat)) : XEUtils.isDateSame(dateValue, item.date, matchFormat),
2215
+ 'is--hover': XEUtils.isDateSame(datePanelValue, item.date, matchFormat)
2216
+ },
2217
+ on: {
2218
+ click: () => $xeInput.dateSelectEvent(item),
2219
+ mouseenter: () => $xeInput.dateMouseenterEvent(item)
2220
+ }
2221
+ }, $xeInput.renderDateLabel(h, item, item.label))
2222
+ }))
2223
+ }))
2224
+ ])
2225
+ ]
2226
+ },
2227
+ renderDateWeekTable (h: CreateElement) {
2228
+ const $xeInput = this
2229
+ const props = $xeInput
2230
+ const reactData = $xeInput.reactData
2231
+
2232
+ const { multiple } = props
2233
+ const { datePanelType, datePanelValue } = reactData
2234
+ const dateValue = $xeInput.computeDateValue
2235
+ const weekHeaders = $xeInput.computeWeekHeaders
2236
+ const weekDates = $xeInput.computeWeekDates
2237
+ const dateListValue = $xeInput.computeDateListValue
2238
+ const matchFormat = 'yyyyMMdd'
2239
+ return [
2240
+ h('table', {
2241
+ class: `vxe-input--date-${datePanelType}-view`,
2242
+ attrs: {
2243
+ cellspacing: 0,
2244
+ cellpadding: 0,
2245
+ border: 0
2246
+ }
2247
+ }, [
2248
+ h('thead', [
2249
+ h('tr', weekHeaders.map((item) => {
2250
+ return h('th', item.label)
2251
+ }))
2252
+ ]),
2253
+ h('tbody', weekDates.map((rows) => {
2254
+ const isSelected = multiple ? rows.some((item) => dateListValue.some(val => XEUtils.isDateSame(val, item.date, matchFormat))) : rows.some((item) => XEUtils.isDateSame(dateValue, item.date, matchFormat))
2255
+ const isHover = rows.some((item) => XEUtils.isDateSame(datePanelValue, item.date, matchFormat))
2256
+ return h('tr', rows.map((item) => {
2257
+ return h('td', {
2258
+ class: {
2259
+ 'is--prev': item.isPrev,
2260
+ 'is--current': item.isCurrent,
2261
+ 'is--now': item.isNow,
2262
+ 'is--next': item.isNext,
2263
+ 'is--disabled': $xeInput.isDateDisabled(item),
2264
+ 'is--selected': isSelected,
2265
+ 'is--hover': isHover
2266
+ },
2267
+ on: {
2268
+ click: () => $xeInput.dateSelectEvent(item),
2269
+ mouseenter: () => $xeInput.dateMouseenterEvent(item)
2270
+ }
2271
+ }, $xeInput.renderDateLabel(h, item, item.label))
2272
+ }))
2273
+ }))
2274
+ ])
2275
+ ]
2276
+ },
2277
+ renderDateMonthTable (h: CreateElement) {
2278
+ const $xeInput = this
2279
+ const props = $xeInput
2280
+ const reactData = $xeInput.reactData
2281
+
2282
+ const { multiple } = props
2283
+ const { datePanelType, datePanelValue } = reactData
2284
+ const dateValue = $xeInput.computeDateValue
2285
+ const monthDatas = $xeInput.computeMonthDatas
2286
+ const dateListValue = $xeInput.computeDateListValue
2287
+ const matchFormat = 'yyyyMM'
2288
+ return [
2289
+ h('table', {
2290
+ class: `vxe-input--date-${datePanelType}-view`,
2291
+ attrs: {
2292
+ cellspacing: 0,
2293
+ cellpadding: 0,
2294
+ border: 0
2295
+ }
2296
+ }, [
2297
+ h('tbody', monthDatas.map((rows) => {
2298
+ return h('tr', rows.map((item) => {
2299
+ return h('td', {
2300
+ class: {
2301
+ 'is--prev': item.isPrev,
2302
+ 'is--current': item.isCurrent,
2303
+ 'is--now': item.isNow,
2304
+ 'is--next': item.isNext,
2305
+ 'is--disabled': $xeInput.isDateDisabled(item),
2306
+ 'is--selected': multiple ? dateListValue.some(val => XEUtils.isDateSame(val, item.date, matchFormat)) : XEUtils.isDateSame(dateValue, item.date, matchFormat),
2307
+ 'is--hover': XEUtils.isDateSame(datePanelValue, item.date, matchFormat)
2308
+ },
2309
+ on: {
2310
+ click: () => $xeInput.dateSelectEvent(item),
2311
+ mouseenter: () => $xeInput.dateMouseenterEvent(item)
2312
+ }
2313
+ }, $xeInput.renderDateLabel(h, item, getI18n(`vxe.input.date.months.m${item.month}`)))
2314
+ }))
2315
+ }))
2316
+ ])
2317
+ ]
2318
+ },
2319
+ renderDateQuarterTable (h: CreateElement) {
2320
+ const $xeInput = this
2321
+ const props = $xeInput
2322
+ const reactData = $xeInput.reactData
2323
+
2324
+ const { multiple } = props
2325
+ const { datePanelType, datePanelValue } = reactData
2326
+ const dateValue = $xeInput.computeDateValue
2327
+ const quarterDatas = $xeInput.computeQuarterDatas
2328
+ const dateListValue = $xeInput.computeDateListValue
2329
+ const matchFormat = 'yyyyq'
2330
+ return [
2331
+ h('table', {
2332
+ class: `vxe-input--date-${datePanelType}-view`,
2333
+ attrs: {
2334
+ cellspacing: 0,
2335
+ cellpadding: 0,
2336
+ border: 0
2337
+ }
2338
+ }, [
2339
+ h('tbody', quarterDatas.map((rows) => {
2340
+ return h('tr', rows.map((item) => {
2341
+ return h('td', {
2342
+ class: {
2343
+ 'is--prev': item.isPrev,
2344
+ 'is--current': item.isCurrent,
2345
+ 'is--now': item.isNow,
2346
+ 'is--next': item.isNext,
2347
+ 'is--disabled': $xeInput.isDateDisabled(item),
2348
+ 'is--selected': multiple ? dateListValue.some(val => XEUtils.isDateSame(val, item.date, matchFormat)) : XEUtils.isDateSame(dateValue, item.date, matchFormat),
2349
+ 'is--hover': XEUtils.isDateSame(datePanelValue, item.date, matchFormat)
2350
+ },
2351
+ on: {
2352
+ click: () => $xeInput.dateSelectEvent(item),
2353
+ mouseenter: () => $xeInput.dateMouseenterEvent(item)
2354
+ }
2355
+ }, $xeInput.renderDateLabel(h, item, getI18n(`vxe.input.date.quarters.q${item.quarter}`)))
2356
+ }))
2357
+ }))
2358
+ ])
2359
+ ]
2360
+ },
2361
+ renderDateYearTable (h: CreateElement) {
2362
+ const $xeInput = this
2363
+ const props = $xeInput
2364
+ const reactData = $xeInput.reactData
2365
+
2366
+ const { multiple } = props
2367
+ const { datePanelType, datePanelValue } = reactData
2368
+ const dateValue = $xeInput.computeDateValue
2369
+ const yearDatas = $xeInput.computeYearDatas
2370
+ const dateListValue = $xeInput.computeDateListValue
2371
+ const matchFormat = 'yyyy'
2372
+ return [
2373
+ h('table', {
2374
+ class: `vxe-input--date-${datePanelType}-view`,
2375
+ attrs: {
2376
+ cellspacing: 0,
2377
+ cellpadding: 0,
2378
+ border: 0
2379
+ }
2380
+ }, [
2381
+ h('tbody', yearDatas.map((rows) => {
2382
+ return h('tr', rows.map((item) => {
2383
+ return h('td', {
2384
+ class: {
2385
+ 'is--prev': item.isPrev,
2386
+ 'is--current': item.isCurrent,
2387
+ 'is--now': item.isNow,
2388
+ 'is--next': item.isNext,
2389
+ 'is--disabled': $xeInput.isDateDisabled(item),
2390
+ 'is--selected': multiple ? dateListValue.some(val => XEUtils.isDateSame(val, item.date, matchFormat)) : XEUtils.isDateSame(dateValue, item.date, matchFormat),
2391
+ 'is--hover': XEUtils.isDateSame(datePanelValue, item.date, matchFormat)
2392
+ },
2393
+ on: {
2394
+ click: () => $xeInput.dateSelectEvent(item),
2395
+ mouseenter: () => $xeInput.dateMouseenterEvent(item)
2396
+ }
2397
+ }, $xeInput.renderDateLabel(h, item, item.year))
2398
+ }))
2399
+ }))
2400
+ ])
2401
+ ]
2402
+ },
2403
+ renderDateTable (h: CreateElement) {
2404
+ const $xeInput = this
2405
+ const reactData = $xeInput.reactData
2406
+
2407
+ const { datePanelType } = reactData
2408
+ switch (datePanelType) {
2409
+ case 'week' :
2410
+ return $xeInput.renderDateWeekTable(h)
2411
+ case 'month' :
2412
+ return $xeInput.renderDateMonthTable(h)
2413
+ case 'quarter' :
2414
+ return $xeInput.renderDateQuarterTable(h)
2415
+ case 'year' :
2416
+ return $xeInput.renderDateYearTable(h)
2417
+ }
2418
+ return $xeInput.renderDateDayTable(h)
2419
+ },
2420
+ renderDatePanel (h: CreateElement) {
2421
+ const $xeInput = this
2422
+ const props = $xeInput
2423
+ const reactData = $xeInput.reactData
2424
+
2425
+ const { multiple } = props
2426
+ const { datePanelType } = reactData
2427
+ const isDisabledPrevDateBtn = $xeInput.computeIsDisabledPrevDateBtn
2428
+ const isDisabledNextDateBtn = $xeInput.computeIsDisabledNextDateBtn
2429
+ const selectDatePanelLabel = $xeInput.computeSelectDatePanelLabel
2430
+ return [
2431
+ h('div', {
2432
+ class: 'vxe-input--date-picker-header'
2433
+ }, [
2434
+ h('div', {
2435
+ class: 'vxe-input--date-picker-type-wrapper'
2436
+ }, [
2437
+ datePanelType === 'year'
2438
+ ? h('span', {
2439
+ class: 'vxe-input--date-picker-label'
2440
+ }, selectDatePanelLabel)
2441
+ : h('span', {
2442
+ class: 'vxe-input--date-picker-btn',
2443
+ on: {
2444
+ click: $xeInput.dateToggleTypeEvent
2445
+ }
2446
+ }, selectDatePanelLabel)
2447
+ ]),
2448
+ h('div', {
2449
+ class: 'vxe-input--date-picker-btn-wrapper'
2450
+ }, [
2451
+ h('span', {
2452
+ class: ['vxe-input--date-picker-btn vxe-input--date-picker-prev-btn', {
2453
+ 'is--disabled': isDisabledPrevDateBtn
2454
+ }],
2455
+ on: {
2456
+ click: $xeInput.datePrevEvent
2457
+ }
2458
+ }, [
2459
+ h('i', {
2460
+ class: 'vxe-icon-caret-left'
2461
+ })
2462
+ ]),
2463
+ h('span', {
2464
+ class: 'vxe-input--date-picker-btn vxe-input--date-picker-current-btn',
2465
+ on: {
2466
+ click: $xeInput.dateTodayMonthEvent
2467
+ }
2468
+ }, [
2469
+ h('i', {
2470
+ class: 'vxe-icon-dot'
2471
+ })
2472
+ ]),
2473
+ h('span', {
2474
+ class: ['vxe-input--date-picker-btn vxe-input--date-picker-next-btn', {
2475
+ 'is--disabled': isDisabledNextDateBtn
2476
+ }],
2477
+ on: {
2478
+ click: $xeInput.dateNextEvent
2479
+ }
2480
+ }, [
2481
+ h('i', {
2482
+ class: 'vxe-icon-caret-right'
2483
+ })
2484
+ ]),
2485
+ multiple && $xeInput.computeSupportMultiples
2486
+ ? h('span', {
2487
+ class: 'vxe-input--date-picker-btn vxe-input--date-picker-confirm-btn'
2488
+ }, [
2489
+ h('button', {
2490
+ class: 'vxe-input--date-picker-confirm',
2491
+ attrs: {
2492
+ type: 'button'
2493
+ },
2494
+ on: {
2495
+ click: $xeInput.dateConfirmEvent
2496
+ }
2497
+ }, getI18n('vxe.button.confirm'))
2498
+ ])
2499
+ : null
2500
+ ])
2501
+ ]),
2502
+ h('div', {
2503
+ class: 'vxe-input--date-picker-body'
2504
+ }, $xeInput.renderDateTable(h))
2505
+ ]
2506
+ },
2507
+ renderTimePanel (h: CreateElement) {
2508
+ const $xeInput = this
2509
+ const reactData = $xeInput.reactData
2510
+
2511
+ const { datetimePanelValue } = reactData
2512
+ const dateTimeLabel = $xeInput.computeDateTimeLabel
2513
+ const hourList = $xeInput.computeHourList
2514
+ const hasTimeMinute = $xeInput.computeHasTimeMinute
2515
+ const minuteList = $xeInput.computeMinuteList
2516
+ const hasTimeSecond = $xeInput.computeHasTimeSecond
2517
+ const secondList = $xeInput.computeSecondList
2518
+ return [
2519
+ h('div', {
2520
+ class: 'vxe-input--time-picker-header'
2521
+ }, [
2522
+ hasTimeMinute
2523
+ ? h('span', {
2524
+ class: 'vxe-input--time-picker-title'
2525
+ }, dateTimeLabel)
2526
+ : renderEmptyElement($xeInput),
2527
+ h('div', {
2528
+ class: 'vxe-input--time-picker-btn'
2529
+ }, [
2530
+ h('button', {
2531
+ class: 'vxe-input--time-picker-confirm',
2532
+ attrs: {
2533
+ type: 'button'
2534
+ },
2535
+ on: {
2536
+ click: $xeInput.dateConfirmEvent
2537
+ }
2538
+ }, getI18n('vxe.button.confirm'))
2539
+ ])
2540
+ ]),
2541
+ h('div', {
2542
+ ref: 'refInputTimeBody',
2543
+ class: 'vxe-input--time-picker-body'
2544
+ }, [
2545
+ h('ul', {
2546
+ class: 'vxe-input--time-picker-hour-list'
2547
+ }, hourList.map((item, index) => {
2548
+ return h('li', {
2549
+ key: index,
2550
+ class: {
2551
+ 'is--selected': datetimePanelValue && datetimePanelValue.getHours() === item.value
2552
+ },
2553
+ on: {
2554
+ click: (evnt: MouseEvent) => $xeInput.dateHourEvent(evnt, item)
2555
+ }
2556
+ }, item.label)
2557
+ })),
2558
+ hasTimeMinute
2559
+ ? h('ul', {
2560
+ class: 'vxe-input--time-picker-minute-list'
2561
+ }, minuteList.map((item, index) => {
2562
+ return h('li', {
2563
+ key: index,
2564
+ class: {
2565
+ 'is--selected': datetimePanelValue && datetimePanelValue.getMinutes() === item.value
2566
+ },
2567
+ on: {
2568
+ click: (evnt: MouseEvent) => $xeInput.dateMinuteEvent(evnt, item)
2569
+ }
2570
+ }, item.label)
2571
+ }))
2572
+ : renderEmptyElement($xeInput),
2573
+ hasTimeMinute && hasTimeSecond
2574
+ ? h('ul', {
2575
+ class: 'vxe-input--time-picker-second-list'
2576
+ }, secondList.map((item, index) => {
2577
+ return h('li', {
2578
+ key: index,
2579
+ class: {
2580
+ 'is--selected': datetimePanelValue && datetimePanelValue.getSeconds() === item.value
2581
+ },
2582
+ on: {
2583
+ click: (evnt: MouseEvent) => $xeInput.dateSecondEvent(evnt, item)
2584
+ }
2585
+ }, item.label)
2586
+ }))
2587
+ : renderEmptyElement($xeInput)
2588
+ ])
2589
+ ]
2590
+ },
2591
+ renderPanel (h: CreateElement) {
2592
+ const $xeInput = this
2593
+ const props = $xeInput
2594
+ const reactData = $xeInput.reactData
2595
+
2596
+ const { type } = props
2597
+ const { initialized, isAniVisible, visiblePanel, panelPlacement, panelStyle } = reactData
2598
+ const vSize = $xeInput.computeSize
2599
+ const btnTransfer = $xeInput.computeBtnTransfer
2600
+ const isDatePickerType = $xeInput.computeIsDatePickerType
2601
+ const renders = []
2602
+ if (isDatePickerType) {
2603
+ if (type === 'datetime') {
2604
+ renders.push(
2605
+ h('div', {
2606
+ key: type,
2607
+ ref: 'refPanelWrapper',
2608
+ class: 'vxe-input--panel-layout-wrapper'
2609
+ }, [
2610
+ h('div', {
2611
+ class: 'vxe-input--panel-left-wrapper'
2612
+ }, $xeInput.renderDatePanel(h)),
2613
+ h('div', {
2614
+ class: 'vxe-input--panel-right-wrapper'
2615
+ }, $xeInput.renderTimePanel(h))
2616
+ ])
2617
+ )
2618
+ } else if (type === 'time') {
2619
+ renders.push(
2620
+ h('div', {
2621
+ key: type,
2622
+ ref: 'refPanelWrapper',
2623
+ class: 'vxe-input--panel-wrapper'
2624
+ }, $xeInput.renderTimePanel(h))
2625
+ )
2626
+ } else {
2627
+ renders.push(
2628
+ h('div', {
2629
+ key: type || 'default',
2630
+ ref: 'refPanelWrapper',
2631
+ class: 'vxe-input--panel-wrapper'
2632
+ }, $xeInput.renderDatePanel(h))
2633
+ )
2634
+ }
2635
+ return h('div', {
2636
+ ref: 'refInputPanel',
2637
+ class: ['vxe-table--ignore-clear vxe-input--panel', `type--${type}`, {
2638
+ [`size--${vSize}`]: vSize,
2639
+ 'is--transfer': btnTransfer,
2640
+ 'ani--leave': isAniVisible,
2641
+ 'ani--enter': visiblePanel
2642
+ }],
2643
+ attrs: {
2644
+ placement: panelPlacement
2645
+ },
2646
+ style: panelStyle
2647
+ }, initialized ? renders : [])
2648
+ }
2649
+ return renderEmptyElement($xeInput)
2650
+ },
2651
+ renderNumberIcon (h: CreateElement) {
2652
+ const $xeInput = this
2653
+
2654
+ const isDisabledAddNumber = $xeInput.computeIsDisabledAddNumber
2655
+ const isDisabledSubtractNumber = $xeInput.computeIsDisabledSubtractNumber
2656
+ return h('div', {
2657
+ class: 'vxe-input--control-icon'
2658
+ }, [
2659
+ h('div', {
2660
+ class: 'vxe-input--number-icon'
2661
+ }, [
2662
+ h('div', {
2663
+ class: ['vxe-input--number-btn is--prev', {
2664
+ 'is--disabled': isDisabledAddNumber
2665
+ }],
2666
+ on: {
2667
+
2668
+ mousedown: $xeInput.numberMousedownEvent,
2669
+ mouseup: $xeInput.numberStopDown,
2670
+ mouseleave: $xeInput.numberStopDown
2671
+ }
2672
+ }, [
2673
+ h('i', {
2674
+ class: getIcon().NUMBER_INPUT_PREV_NUM
2675
+ })
2676
+ ]),
2677
+ h('div', {
2678
+ class: ['vxe-input--number-btn is--next', {
2679
+ 'is--disabled': isDisabledSubtractNumber
2680
+ }],
2681
+ on: {
2682
+ mousedown: $xeInput.numberMousedownEvent,
2683
+ mouseup: $xeInput.numberStopDown,
2684
+ mouseleave: $xeInput.numberStopDown
2685
+ }
2686
+ }, [
2687
+ h('i', {
2688
+ class: getIcon().NUMBER_INPUT_NEXT_NUM
2689
+ })
2690
+ ])
2691
+ ])
2692
+ ])
2693
+ },
2694
+ renderDatePickerIcon (h: CreateElement) {
2695
+ const $xeInput = this
2696
+
2697
+ return h('div', {
2698
+ class: 'vxe-input--control-icon',
2699
+ on: {
2700
+ click: $xeInput.datePickerOpenEvent
2701
+ }
2702
+ }, [
2703
+ h('i', {
2704
+ class: ['vxe-input--date-picker-icon', getIcon().DATE_PICKER_DATE]
2705
+ })
2706
+ ])
2707
+ },
2708
+ renderSearchIcon (h: CreateElement) {
2709
+ const $xeInput = this
2710
+
2711
+ return h('div', {
2712
+ class: 'vxe-input--control-icon',
2713
+ on: {
2714
+ click: $xeInput.searchEvent
2715
+ }
2716
+ }, [
2717
+ h('i', {
2718
+ class: ['vxe-input--search-icon', getIcon().INPUT_SEARCH]
2719
+ })
2720
+ ])
2721
+ },
2722
+ renderPasswordIcon (h: CreateElement) {
2723
+ const $xeInput = this
2724
+ const reactData = $xeInput.reactData
2725
+
2726
+ const { showPwd } = reactData
2727
+ return h('div', {
2728
+ class: 'vxe-input--control-icon',
2729
+ on: {
2730
+ click: $xeInput.passwordToggleEvent
2731
+ }
2732
+ }, [
2733
+ h('i', {
2734
+ class: ['vxe-input--password-icon', showPwd ? getIcon().PASSWORD_INPUT_SHOW_PWD : getIcon().PASSWORD_INPUT_HIDE_PWD]
2735
+ })
2736
+ ])
2737
+ },
2738
+ renderPrefixIcon (h: CreateElement) {
2739
+ const $xeInput = this
2740
+ const props = $xeInput
2741
+ const slots = $xeInput.$scopedSlots
2742
+
2743
+ const { prefixIcon } = props
2744
+ const prefixSlot = slots.prefix
2745
+ return prefixSlot || prefixIcon
2746
+ ? h('div', {
2747
+ class: 'vxe-input--prefix',
2748
+ on: {
2749
+ click: $xeInput.clickPrefixEvent
2750
+ }
2751
+ }, [
2752
+ h('div', {
2753
+ class: 'vxe-input--prefix-icon'
2754
+ }, prefixSlot
2755
+ ? getSlotVNs(prefixSlot({}))
2756
+ : [
2757
+ h('i', {
2758
+ class: prefixIcon
2759
+ })
2760
+ ])
2761
+ ])
2762
+ : null
2763
+ },
2764
+ renderSuffixIcon (h: CreateElement) {
2765
+ const $xeInput = this
2766
+ const props = $xeInput
2767
+ const slots = $xeInput.$scopedSlots
2768
+ const reactData = $xeInput.reactData
2769
+
2770
+ const { suffixIcon } = props
2771
+ const { inputValue } = reactData
2772
+ const suffixSlot = slots.suffix
2773
+ const isDisabled = $xeInput.computeIsDisabled
2774
+ const isNumType = $xeInput.computeIsNumType
2775
+ const isDatePickerType = $xeInput.computeIsDatePickerType
2776
+ const isPawdType = $xeInput.computeIsPawdType
2777
+ const isSearchType = $xeInput.computeIsSearchType
2778
+ const isClearable = $xeInput.computeIsClearable
2779
+ const isExtraBtn = isPawdType || isNumType || isDatePickerType || isSearchType
2780
+ return isClearable || suffixSlot || suffixIcon || isExtraBtn
2781
+ ? h('div', {
2782
+ class: ['vxe-input--suffix', {
2783
+ 'is--clear': isClearable && !isDisabled && !(inputValue === '' || XEUtils.eqNull(inputValue))
2784
+ }]
2785
+ }, [
2786
+ isClearable
2787
+ ? h('div', {
2788
+ class: 'vxe-input--clear-icon',
2789
+ on: {
2790
+ click: $xeInput.clearValueEvent
2791
+ }
2792
+ }, [
2793
+ h('i', {
2794
+ class: getIcon().INPUT_CLEAR
2795
+ })
2796
+ ])
2797
+ : renderEmptyElement($xeInput),
2798
+ isExtraBtn ? $xeInput.renderExtraSuffixIcon(h) : renderEmptyElement($xeInput),
2799
+ suffixSlot || suffixIcon
2800
+ ? h('div', {
2801
+ class: 'vxe-input--suffix-icon',
2802
+ on: {
2803
+ click: $xeInput.clickSuffixEvent
2804
+ }
2805
+ }, suffixSlot
2806
+ ? getSlotVNs(suffixSlot({}))
2807
+ : [
2808
+ h('i', {
2809
+ class: suffixIcon
2810
+ })
2811
+ ])
2812
+ : renderEmptyElement($xeInput)
2813
+ ])
2814
+ : null
2815
+ },
2816
+ renderExtraSuffixIcon (h: CreateElement) {
2817
+ const $xeInput = this
2818
+ const props = $xeInput
2819
+
2820
+ const { controls } = props
2821
+ const isNumType = $xeInput.computeIsNumType
2822
+ const isDatePickerType = $xeInput.computeIsDatePickerType
2823
+ const isPawdType = $xeInput.computeIsPawdType
2824
+ const isSearchType = $xeInput.computeIsSearchType
2825
+ if (isPawdType) {
2826
+ return $xeInput.renderPasswordIcon(h)
2827
+ }
2828
+ if (isNumType) {
2829
+ if (controls) {
2830
+ return $xeInput.renderNumberIcon(h)
2831
+ }
2832
+ }
2833
+ if (isDatePickerType) {
2834
+ return $xeInput.renderDatePickerIcon(h)
2835
+ }
2836
+ if (isSearchType) {
2837
+ return $xeInput.renderSearchIcon(h)
2838
+ }
2839
+ return renderEmptyElement($xeInput)
2840
+ },
2841
+ renderVN (h: CreateElement): VNode {
2842
+ const $xeInput = this
2843
+ const props = $xeInput
2844
+ const reactData = $xeInput.reactData
2845
+
2846
+ const { className, controls, type, align, showWordCount, countMethod, name, autoComplete, autocomplete } = props
2847
+ const { inputValue, visiblePanel, isActivated } = reactData
2848
+ const vSize = $xeInput.computeSize
2849
+ const isDisabled = $xeInput.computeIsDisabled
2850
+ const formReadonly = $xeInput.computeFormReadonly
2851
+ if (formReadonly) {
2852
+ return h('div', {
2853
+ ref: 'refElem',
2854
+ class: ['vxe-input--readonly', `type--${type}`, className]
2855
+ }, inputValue)
2856
+ }
2857
+ const isCountError = $xeInput.computeIsCountError
2858
+ const inputCount = $xeInput.computeInputCount
2859
+ const inputReadonly = $xeInput.computeInputReadonly
2860
+ const inpMaxLength = $xeInput.computeInpMaxLength
2861
+ const inputType = $xeInput.computeInputType
2862
+ const inpPlaceholder = $xeInput.computeInpPlaceholder
2863
+ const isClearable = $xeInput.computeIsClearable
2864
+ const isWordCount = showWordCount && ['text', 'search'].includes(type)
2865
+ const prefix = $xeInput.renderPrefixIcon(h)
2866
+ const suffix = $xeInput.renderSuffixIcon(h)
2867
+ return h('div', {
2868
+ ref: 'refElem',
2869
+ class: ['vxe-input', `type--${type}`, className, {
2870
+ [`size--${vSize}`]: vSize,
2871
+ [`is--${align}`]: align,
2872
+ 'is--controls': controls,
2873
+ 'is--prefix': !!prefix,
2874
+ 'is--suffix': !!suffix,
2875
+ 'is--visible': visiblePanel,
2876
+ 'is--count': isWordCount,
2877
+ 'is--disabled': isDisabled,
2878
+ 'is--active': isActivated,
2879
+ 'show--clear': isClearable && !isDisabled && !(inputValue === '' || XEUtils.eqNull(inputValue))
2880
+ }],
2881
+ attrs: {
2882
+ spellcheck: false
2883
+ }
2884
+ }, [
2885
+ prefix || renderEmptyElement($xeInput),
2886
+ h('div', {
2887
+ class: 'vxe-input--wrapper'
2888
+ }, [
2889
+ h('input', {
2890
+ ref: 'refInputTarget',
2891
+ class: 'vxe-input--inner',
2892
+ domProps: {
2893
+ value: inputValue
2894
+ },
2895
+ attrs: {
2896
+ name,
2897
+ type: inputType,
2898
+ placeholder: inpPlaceholder,
2899
+ maxlength: inpMaxLength,
2900
+ readonly: inputReadonly,
2901
+ disabled: isDisabled,
2902
+ autocomplete: autoComplete || autocomplete
2903
+ },
2904
+ on: {
2905
+ keydown: $xeInput.keydownEvent,
2906
+ keyup: $xeInput.keyupEvent,
2907
+ wheel: $xeInput.wheelEvent,
2908
+ click: $xeInput.clickEvent,
2909
+ input: $xeInput.inputEvent,
2910
+ change: $xeInput.changeEvent,
2911
+ focus: $xeInput.focusEvent,
2912
+ blur: $xeInput.blurEvent
2913
+ }
2914
+ })
2915
+ ]),
2916
+ suffix || renderEmptyElement($xeInput),
2917
+ // 下拉面板
2918
+ $xeInput.renderPanel(h),
2919
+ // 字数统计
2920
+ isWordCount
2921
+ ? h('span', {
2922
+ class: ['vxe-input--count', {
2923
+ 'is--error': isCountError
2924
+ }]
2925
+ }, countMethod ? `${countMethod({ value: inputValue })}` : `${inputCount}${inpMaxLength ? `/${inpMaxLength}` : ''}`)
2926
+ : renderEmptyElement($xeInput)
2927
+ ])
2928
+ }
2929
+ },
2930
+ watch: {
2931
+ value (val) {
2932
+ const $xeInput = this
2933
+ const reactData = $xeInput.reactData
2934
+
2935
+ reactData.inputValue = val
2936
+ $xeInput.changeValue()
2937
+ },
2938
+ type () {
2939
+ const $xeInput = this
2940
+ const props = $xeInput
2941
+ const reactData = $xeInput.reactData
2942
+
2943
+ // 切换类型是重置内置变量
2944
+ Object.assign(reactData, {
2945
+ inputValue: props.value,
2946
+ datetimePanelValue: null,
2947
+ datePanelValue: null,
2948
+ datePanelLabel: '',
2949
+ datePanelType: 'day',
2950
+ selectMonth: null,
2951
+ currentDate: null
2952
+ })
2953
+ $xeInput.initValue()
2954
+ },
2955
+ computeDateLabelFormat () {
2956
+ const $xeInput = this
2957
+ const props = $xeInput
2958
+ const reactData = $xeInput.reactData
2959
+
2960
+ const isDatePickerType = $xeInput.computeIsDatePickerType
2961
+ if (isDatePickerType) {
2962
+ $xeInput.dateParseValue(reactData.datePanelValue)
2963
+ reactData.inputValue = props.multiple ? $xeInput.computeDateMultipleLabel : reactData.datePanelLabel
2964
+ }
2965
+ }
2966
+ },
2967
+ created () {
2968
+ const $xeInput = this
2969
+ const props = $xeInput
2970
+ const reactData = $xeInput.reactData
2971
+
2972
+ reactData.inputValue = props.value
2973
+ $xeInput.initValue()
2974
+ },
2975
+ mounted () {
2976
+ const $xeInput = this
2977
+
2978
+ globalEvents.on($xeInput, 'mousewheel', $xeInput.handleGlobalMousewheelEvent)
2979
+ globalEvents.on($xeInput, 'mousedown', $xeInput.handleGlobalMousedownEvent)
2980
+ globalEvents.on($xeInput, 'keydown', $xeInput.handleGlobalKeydownEvent)
2981
+ globalEvents.on($xeInput, 'blur', $xeInput.handleGlobalBlurEvent)
2982
+ },
2983
+ beforeDestroy () {
2984
+ const $xeInput = this
2985
+
2986
+ const panelElem = $xeInput.$refs.refInputPanel as HTMLElement | undefined
2987
+ if (panelElem && panelElem.parentNode) {
2988
+ panelElem.parentNode.removeChild(panelElem)
2989
+ }
2990
+ $xeInput.numberStopDown()
2991
+ $xeInput.afterCheckValue()
2992
+ globalEvents.off($xeInput, 'mousewheel')
2993
+ globalEvents.off($xeInput, 'mousedown')
2994
+ globalEvents.off($xeInput, 'keydown')
2995
+ globalEvents.off($xeInput, 'blur')
2996
+ },
2997
+ render (this: any, h) {
2998
+ return this.renderVN(h)
2999
+ }
3000
+ })