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