vxe-pc-ui 0.0.2 → 0.1.0

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 (714) hide show
  1. package/es/anchor/src/anchor.js +1 -1
  2. package/es/anchor-link/index.js +1 -1
  3. package/es/{button-group → button}/src/button-group.js +2 -2
  4. package/es/button/src/button.js +3 -3
  5. package/es/button/style.css +17 -17
  6. package/es/button/style.min.css +1 -1
  7. package/es/button-group/index.js +1 -1
  8. package/es/checkbox/index.js +10 -0
  9. package/es/checkbox/src/checkbox.js +116 -0
  10. package/es/checkbox/src/group.js +108 -0
  11. package/es/checkbox/style.css +107 -0
  12. package/es/checkbox/style.min.css +1 -0
  13. package/es/checkbox-group/index.js +10 -0
  14. package/es/col/index.js +1 -1
  15. package/es/components.js +98 -35
  16. package/es/dynamics/index.js +27 -0
  17. package/es/form/index.js +8 -0
  18. package/es/form/src/form-config-item.js +178 -0
  19. package/es/form/src/form-gather.js +47 -0
  20. package/es/form/src/form-item.js +228 -0
  21. package/es/form/src/form.js +665 -0
  22. package/es/form/src/itemInfo.js +39 -0
  23. package/es/form/src/render.js +68 -0
  24. package/es/form/src/util.js +65 -0
  25. package/es/form/style.css +321 -0
  26. package/es/form/style.min.css +1 -0
  27. package/es/form-design/index.js +8 -0
  28. package/es/form-design/src/form-design.js +79 -0
  29. package/es/form-design/src/setting.js +12 -0
  30. package/es/form-design/src/util.js +8 -0
  31. package/es/form-design/src/view.js +113 -0
  32. package/es/form-design/src/widget.js +104 -0
  33. package/es/form-design/style.css +97 -0
  34. package/es/form-design/style.min.css +1 -0
  35. package/es/form-gather/index.js +8 -0
  36. package/es/form-item/index.js +8 -0
  37. package/es/icon/style.css +540 -1
  38. package/es/icon/style.min.css +1 -1
  39. package/es/input/index.js +10 -0
  40. package/es/input/src/date.js +41 -0
  41. package/es/input/src/input.js +2333 -0
  42. package/es/input/src/number.js +10 -0
  43. package/es/input/style.css +1000 -0
  44. package/es/input/style.min.css +1 -0
  45. package/es/layout-aside/style.css +1 -0
  46. package/es/layout-aside/style.min.css +1 -1
  47. package/es/layout-body/style.css +1 -0
  48. package/es/layout-body/style.min.css +1 -1
  49. package/es/layout-footer/style.css +1 -0
  50. package/es/layout-footer/style.min.css +1 -1
  51. package/es/layout-header/style.css +1 -0
  52. package/es/layout-header/style.min.css +1 -1
  53. package/es/list-design/index.js +8 -0
  54. package/es/{design/src/design.js → list-design/src/list-design.js} +7 -7
  55. package/es/loading/index.js +8 -0
  56. package/es/loading/src/loading.js +53 -0
  57. package/es/loading/style.css +75 -0
  58. package/es/loading/style.min.css +1 -0
  59. package/es/modal/index.js +96 -0
  60. package/es/modal/src/modal.js +876 -0
  61. package/es/modal/style.css +323 -0
  62. package/es/modal/style.min.css +1 -0
  63. package/es/optgroup/index.js +10 -0
  64. package/es/optgroup/style.css +0 -0
  65. package/es/optgroup/style.min.css +0 -0
  66. package/es/option/index.js +10 -0
  67. package/es/option/style.css +0 -0
  68. package/es/option/style.min.css +0 -0
  69. package/es/pager/index.js +10 -0
  70. package/es/pager/src/pager.js +539 -0
  71. package/es/pager/style.css +319 -0
  72. package/es/pager/style.min.css +1 -0
  73. package/es/pulldown/index.js +10 -0
  74. package/es/pulldown/src/pulldown.js +328 -0
  75. package/es/pulldown/style.css +57 -0
  76. package/es/pulldown/style.min.css +1 -0
  77. package/es/radio/index.js +10 -0
  78. package/es/radio/src/button.js +113 -0
  79. package/es/radio/src/group.js +93 -0
  80. package/es/radio/src/radio.js +118 -0
  81. package/es/radio/style.css +143 -0
  82. package/es/radio/style.min.css +1 -0
  83. package/es/radio-button/index.js +10 -0
  84. package/es/radio-button/style.css +0 -0
  85. package/es/radio-button/style.min.css +0 -0
  86. package/es/radio-group/index.js +10 -0
  87. package/es/radio-group/style.css +0 -0
  88. package/es/radio-group/style.min.css +0 -0
  89. package/es/select/index.js +10 -0
  90. package/es/select/src/optgroup.js +31 -0
  91. package/es/select/src/option.js +31 -0
  92. package/es/select/src/optionInfo.js +16 -0
  93. package/es/select/src/select.js +992 -0
  94. package/es/select/src/util.js +36 -0
  95. package/es/select/style.css +201 -0
  96. package/es/select/style.min.css +1 -0
  97. package/es/style.css +1 -1
  98. package/es/style.min.css +1 -1
  99. package/es/switch/index.js +10 -0
  100. package/es/switch/src/switch.js +151 -0
  101. package/es/switch/style.css +97 -0
  102. package/es/switch/style.min.css +1 -0
  103. package/es/textarea/index.js +10 -0
  104. package/es/textarea/src/textarea.js +245 -0
  105. package/es/textarea/style.css +102 -0
  106. package/es/textarea/style.min.css +1 -0
  107. package/es/tooltip/index.js +8 -0
  108. package/es/tooltip/src/tooltip.js +336 -0
  109. package/es/tooltip/style.css +103 -0
  110. package/es/tooltip/style.min.css +1 -0
  111. package/es/ui/src/core.js +12 -2
  112. package/es/ui/src/dom.js +20 -0
  113. package/es/ui/src/globalStore.js +119 -4
  114. package/es/ui/src/i18n.js +7 -0
  115. package/es/ui/src/log.js +2 -2
  116. package/es/ui/src/renderer.js +67 -0
  117. package/es/ui/src/store.js +41 -0
  118. package/es/ui/src/utils.js +10 -0
  119. package/es/ui/src/validators.js +5 -0
  120. package/es/ui/src/vn.js +10 -0
  121. package/es/vxe-button/style.css +17 -17
  122. package/es/vxe-button/style.min.css +1 -1
  123. package/es/vxe-checkbox/index.js +3 -0
  124. package/es/vxe-checkbox/style.css +107 -0
  125. package/es/vxe-checkbox/style.min.css +1 -0
  126. package/es/vxe-checkbox-group/index.js +3 -0
  127. package/es/vxe-checkbox-group/style.css +0 -0
  128. package/es/vxe-checkbox-group/style.min.css +0 -0
  129. package/es/vxe-form/index.js +3 -0
  130. package/es/vxe-form/style.css +321 -0
  131. package/es/vxe-form/style.min.css +1 -0
  132. package/es/vxe-form-design/index.js +3 -0
  133. package/es/vxe-form-design/style.css +97 -0
  134. package/es/vxe-form-design/style.min.css +1 -0
  135. package/es/vxe-form-gather/index.js +3 -0
  136. package/es/vxe-form-gather/style.css +0 -0
  137. package/es/vxe-form-gather/style.min.css +0 -0
  138. package/es/vxe-form-item/index.js +3 -0
  139. package/es/vxe-form-item/style.css +0 -0
  140. package/es/vxe-form-item/style.min.css +0 -0
  141. package/es/vxe-icon/style.css +540 -1
  142. package/es/vxe-icon/style.min.css +1 -1
  143. package/es/vxe-input/index.js +3 -0
  144. package/es/vxe-input/style.css +1000 -0
  145. package/es/vxe-input/style.min.css +1 -0
  146. package/es/vxe-layout-aside/style.css +1 -0
  147. package/es/vxe-layout-aside/style.min.css +1 -1
  148. package/es/vxe-layout-body/style.css +1 -0
  149. package/es/vxe-layout-body/style.min.css +1 -1
  150. package/es/vxe-layout-footer/style.css +1 -0
  151. package/es/vxe-layout-footer/style.min.css +1 -1
  152. package/es/vxe-layout-header/style.css +1 -0
  153. package/es/vxe-layout-header/style.min.css +1 -1
  154. package/es/vxe-list-design/index.js +3 -0
  155. package/es/vxe-list-design/style.css +0 -0
  156. package/es/vxe-list-design/style.min.css +0 -0
  157. package/es/vxe-loading/index.js +3 -0
  158. package/es/vxe-loading/style.css +75 -0
  159. package/es/vxe-loading/style.min.css +1 -0
  160. package/es/vxe-modal/index.js +3 -0
  161. package/es/vxe-modal/style.css +323 -0
  162. package/es/vxe-modal/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 +319 -0
  171. package/es/vxe-pager/style.min.css +1 -0
  172. package/es/vxe-pulldown/index.js +3 -0
  173. package/es/vxe-pulldown/style.css +57 -0
  174. package/es/vxe-pulldown/style.min.css +1 -0
  175. package/es/vxe-radio/index.js +3 -0
  176. package/es/vxe-radio/style.css +143 -0
  177. package/es/vxe-radio/style.min.css +1 -0
  178. package/es/vxe-radio-button/index.js +3 -0
  179. package/es/vxe-radio-button/style.css +0 -0
  180. package/es/vxe-radio-button/style.min.css +0 -0
  181. package/es/vxe-radio-group/index.js +3 -0
  182. package/es/vxe-radio-group/style.css +0 -0
  183. package/es/vxe-radio-group/style.min.css +0 -0
  184. package/es/vxe-select/index.js +3 -0
  185. package/es/vxe-select/style.css +201 -0
  186. package/es/vxe-select/style.min.css +1 -0
  187. package/es/vxe-switch/index.js +3 -0
  188. package/es/vxe-switch/style.css +97 -0
  189. package/es/vxe-switch/style.min.css +1 -0
  190. package/es/vxe-textarea/index.js +3 -0
  191. package/es/vxe-textarea/style.css +102 -0
  192. package/es/vxe-textarea/style.min.css +1 -0
  193. package/es/vxe-tooltip/index.js +3 -0
  194. package/es/vxe-tooltip/style.css +103 -0
  195. package/es/vxe-tooltip/style.min.css +1 -0
  196. package/lib/anchor/src/anchor.js +1 -1
  197. package/lib/anchor/src/anchor.min.js +1 -1
  198. package/lib/anchor-link/index.js +1 -1
  199. package/lib/anchor-link/index.min.js +1 -1
  200. package/lib/{button-group → button}/src/button-group.js +2 -2
  201. package/lib/button/src/button-group.min.js +1 -0
  202. package/lib/button/src/button.js +3 -3
  203. package/lib/button/src/button.min.js +1 -1
  204. package/lib/button/style/style.css +17 -17
  205. package/lib/button/style/style.min.css +1 -1
  206. package/lib/button-group/index.js +1 -1
  207. package/lib/button-group/index.min.js +1 -1
  208. package/lib/checkbox/index.js +17 -0
  209. package/lib/checkbox/index.min.js +1 -0
  210. package/lib/checkbox/src/checkbox.js +144 -0
  211. package/lib/checkbox/src/checkbox.min.js +1 -0
  212. package/lib/checkbox/src/group.js +129 -0
  213. package/lib/checkbox/src/group.min.js +1 -0
  214. package/lib/checkbox/style/style.css +107 -0
  215. package/lib/checkbox/style/style.min.css +1 -0
  216. package/lib/checkbox-group/index.js +17 -0
  217. package/lib/checkbox-group/index.min.js +1 -0
  218. package/lib/checkbox-group/style/style.css +0 -0
  219. package/lib/checkbox-group/style/style.min.css +0 -0
  220. package/lib/col/index.js +1 -1
  221. package/lib/col/index.min.js +1 -1
  222. package/lib/components.js +290 -63
  223. package/lib/components.min.js +1 -1
  224. package/lib/dynamics/index.js +36 -0
  225. package/lib/dynamics/index.min.js +1 -0
  226. package/lib/form/index.js +15 -0
  227. package/lib/form/index.min.js +1 -0
  228. package/lib/form/src/form-config-item.js +192 -0
  229. package/lib/form/src/form-config-item.min.js +1 -0
  230. package/lib/form/src/form-gather.js +57 -0
  231. package/lib/form/src/form-gather.min.js +1 -0
  232. package/lib/form/src/form-item.js +247 -0
  233. package/lib/form/src/form-item.min.js +1 -0
  234. package/lib/form/src/form.js +768 -0
  235. package/lib/form/src/form.min.js +1 -0
  236. package/lib/form/src/itemInfo.js +47 -0
  237. package/lib/form/src/itemInfo.min.js +1 -0
  238. package/lib/form/src/render.js +84 -0
  239. package/lib/form/src/render.min.js +1 -0
  240. package/lib/form/src/util.js +108 -0
  241. package/lib/form/src/util.min.js +1 -0
  242. package/lib/form/style/index.js +1 -0
  243. package/lib/form/style/style.css +321 -0
  244. package/lib/form/style/style.min.css +1 -0
  245. package/lib/form-design/index.js +15 -0
  246. package/lib/form-design/index.min.js +1 -0
  247. package/lib/form-design/src/form-design.js +87 -0
  248. package/lib/form-design/src/form-design.min.js +1 -0
  249. package/lib/form-design/src/setting.js +18 -0
  250. package/lib/form-design/src/setting.min.js +1 -0
  251. package/lib/form-design/src/util.js +17 -0
  252. package/lib/form-design/src/util.min.js +1 -0
  253. package/lib/form-design/src/view.js +147 -0
  254. package/lib/form-design/src/view.min.js +1 -0
  255. package/lib/form-design/src/widget.js +114 -0
  256. package/lib/form-design/src/widget.min.js +1 -0
  257. package/lib/form-design/style/index.js +1 -0
  258. package/lib/form-design/style/style.css +97 -0
  259. package/lib/form-design/style/style.min.css +1 -0
  260. package/lib/form-gather/index.js +15 -0
  261. package/lib/form-gather/index.min.js +1 -0
  262. package/lib/form-gather/style/index.js +1 -0
  263. package/lib/form-gather/style/style.css +0 -0
  264. package/lib/form-gather/style/style.min.css +0 -0
  265. package/lib/form-item/index.js +15 -0
  266. package/lib/form-item/index.min.js +1 -0
  267. package/lib/form-item/style/index.js +1 -0
  268. package/lib/form-item/style/style.css +0 -0
  269. package/lib/form-item/style/style.min.css +0 -0
  270. package/lib/icon/style/style.css +540 -1
  271. package/lib/icon/style/style.min.css +1 -1
  272. package/lib/index.umd.js +10741 -782
  273. package/lib/index.umd.min.js +1 -1
  274. package/lib/input/index.js +17 -0
  275. package/lib/input/index.min.js +1 -0
  276. package/lib/input/src/date.js +46 -0
  277. package/lib/input/src/date.min.js +1 -0
  278. package/lib/input/src/input.js +2546 -0
  279. package/lib/input/src/input.min.js +1 -0
  280. package/lib/input/src/number.js +18 -0
  281. package/lib/input/src/number.min.js +1 -0
  282. package/lib/input/style/index.js +1 -0
  283. package/lib/input/style/style.css +1000 -0
  284. package/lib/input/style/style.min.css +1 -0
  285. package/lib/layout-aside/style/style.css +1 -0
  286. package/lib/layout-aside/style/style.min.css +1 -1
  287. package/lib/layout-body/style/style.css +1 -0
  288. package/lib/layout-body/style/style.min.css +1 -1
  289. package/lib/layout-footer/style/style.css +1 -0
  290. package/lib/layout-footer/style/style.min.css +1 -1
  291. package/lib/layout-header/style/style.css +1 -0
  292. package/lib/layout-header/style/style.min.css +1 -1
  293. package/lib/list-design/index.js +15 -0
  294. package/lib/list-design/index.min.js +1 -0
  295. package/lib/{design/src/design.js → list-design/src/list-design.js} +7 -7
  296. package/lib/list-design/src/list-design.min.js +1 -0
  297. package/lib/list-design/style/index.js +1 -0
  298. package/lib/list-design/style/style.css +0 -0
  299. package/lib/list-design/style/style.min.css +0 -0
  300. package/lib/loading/index.js +15 -0
  301. package/lib/loading/index.min.js +1 -0
  302. package/lib/loading/src/loading.js +49 -0
  303. package/lib/loading/src/loading.min.js +1 -0
  304. package/lib/loading/style/index.js +1 -0
  305. package/lib/loading/style/style.css +75 -0
  306. package/lib/loading/style/style.min.css +1 -0
  307. package/lib/modal/index.js +110 -0
  308. package/lib/modal/index.min.js +1 -0
  309. package/lib/modal/src/modal.js +1064 -0
  310. package/lib/modal/src/modal.min.js +1 -0
  311. package/lib/modal/style/index.js +1 -0
  312. package/lib/modal/style/style.css +323 -0
  313. package/lib/modal/style/style.min.css +1 -0
  314. package/lib/optgroup/index.js +17 -0
  315. package/lib/optgroup/index.min.js +1 -0
  316. package/lib/optgroup/style/index.js +1 -0
  317. package/lib/optgroup/style/style.css +0 -0
  318. package/lib/optgroup/style/style.min.css +0 -0
  319. package/lib/option/index.js +17 -0
  320. package/lib/option/index.min.js +1 -0
  321. package/lib/option/style/index.js +1 -0
  322. package/lib/option/style/style.css +0 -0
  323. package/lib/option/style/style.min.css +0 -0
  324. package/lib/pager/index.js +17 -0
  325. package/lib/pager/index.min.js +1 -0
  326. package/lib/pager/src/pager.js +593 -0
  327. package/lib/pager/src/pager.min.js +1 -0
  328. package/lib/pager/style/index.js +1 -0
  329. package/lib/pager/style/style.css +319 -0
  330. package/lib/pager/style/style.min.css +1 -0
  331. package/lib/pulldown/index.js +17 -0
  332. package/lib/pulldown/index.min.js +1 -0
  333. package/lib/pulldown/src/pulldown.js +359 -0
  334. package/lib/pulldown/src/pulldown.min.js +1 -0
  335. package/lib/pulldown/style/index.js +1 -0
  336. package/lib/pulldown/style/style.css +57 -0
  337. package/lib/pulldown/style/style.min.css +1 -0
  338. package/lib/radio/index.js +17 -0
  339. package/lib/radio/index.min.js +1 -0
  340. package/lib/radio/src/button.js +135 -0
  341. package/lib/radio/src/button.min.js +1 -0
  342. package/lib/radio/src/group.js +108 -0
  343. package/lib/radio/src/group.min.js +1 -0
  344. package/lib/radio/src/radio.js +139 -0
  345. package/lib/radio/src/radio.min.js +1 -0
  346. package/lib/radio/style/index.js +1 -0
  347. package/lib/radio/style/style.css +143 -0
  348. package/lib/radio/style/style.min.css +1 -0
  349. package/lib/radio-button/index.js +17 -0
  350. package/lib/radio-button/index.min.js +1 -0
  351. package/lib/radio-button/style/index.js +1 -0
  352. package/lib/radio-button/style/style.css +0 -0
  353. package/lib/radio-button/style/style.min.css +0 -0
  354. package/lib/radio-group/index.js +17 -0
  355. package/lib/radio-group/index.min.js +1 -0
  356. package/lib/radio-group/style/index.js +1 -0
  357. package/lib/radio-group/style/style.css +0 -0
  358. package/lib/radio-group/style/style.min.css +0 -0
  359. package/lib/select/index.js +17 -0
  360. package/lib/select/index.min.js +1 -0
  361. package/lib/select/src/optgroup.js +47 -0
  362. package/lib/select/src/optgroup.min.js +1 -0
  363. package/lib/select/src/option.js +45 -0
  364. package/lib/select/src/option.min.js +1 -0
  365. package/lib/select/src/optionInfo.js +24 -0
  366. package/lib/select/src/optionInfo.min.js +1 -0
  367. package/lib/select/src/select.js +1104 -0
  368. package/lib/select/src/select.min.js +1 -0
  369. package/lib/select/src/util.js +57 -0
  370. package/lib/select/src/util.min.js +1 -0
  371. package/lib/select/style/index.js +1 -0
  372. package/lib/select/style/style.css +201 -0
  373. package/lib/select/style/style.min.css +1 -0
  374. package/lib/style.css +1 -1
  375. package/lib/style.min.css +1 -1
  376. package/lib/switch/index.js +17 -0
  377. package/lib/switch/index.min.js +1 -0
  378. package/lib/switch/src/switch.js +161 -0
  379. package/lib/switch/src/switch.min.js +1 -0
  380. package/lib/switch/style/index.js +1 -0
  381. package/lib/switch/style/style.css +97 -0
  382. package/lib/switch/style/style.min.css +1 -0
  383. package/lib/textarea/index.js +17 -0
  384. package/lib/textarea/index.min.js +1 -0
  385. package/lib/textarea/src/textarea.js +298 -0
  386. package/lib/textarea/src/textarea.min.js +1 -0
  387. package/lib/textarea/style/index.js +1 -0
  388. package/lib/textarea/style/style.css +102 -0
  389. package/lib/textarea/style/style.min.css +1 -0
  390. package/lib/tooltip/index.js +15 -0
  391. package/lib/tooltip/index.min.js +1 -0
  392. package/lib/tooltip/src/tooltip.js +418 -0
  393. package/lib/tooltip/src/tooltip.min.js +1 -0
  394. package/lib/tooltip/style/index.js +1 -0
  395. package/lib/tooltip/style/style.css +103 -0
  396. package/lib/tooltip/style/style.min.css +1 -0
  397. package/lib/ui/src/core.js +49 -2
  398. package/lib/ui/src/core.min.js +1 -1
  399. package/lib/ui/src/dom.js +22 -0
  400. package/lib/ui/src/dom.min.js +1 -1
  401. package/lib/ui/src/globalStore.js +119 -4
  402. package/lib/ui/src/globalStore.min.js +1 -1
  403. package/lib/ui/src/i18n.js +14 -0
  404. package/lib/ui/src/i18n.min.js +1 -0
  405. package/lib/ui/src/log.js +2 -3
  406. package/lib/ui/src/log.min.js +1 -1
  407. package/lib/ui/src/renderer.js +77 -0
  408. package/lib/ui/src/renderer.min.js +1 -0
  409. package/lib/ui/src/store.js +49 -0
  410. package/lib/ui/src/store.min.js +1 -0
  411. package/lib/ui/src/utils.js +12 -0
  412. package/lib/ui/src/utils.min.js +1 -1
  413. package/lib/ui/src/validators.js +14 -0
  414. package/lib/ui/src/validators.min.js +1 -0
  415. package/lib/ui/src/vn.js +18 -0
  416. package/lib/ui/src/vn.min.js +1 -0
  417. package/lib/vxe-button/style/style.css +17 -17
  418. package/lib/vxe-button/style/style.min.css +1 -1
  419. package/lib/vxe-checkbox/index.js +22 -0
  420. package/lib/vxe-checkbox/index.min.js +1 -0
  421. package/lib/vxe-checkbox/style/index.js +1 -0
  422. package/lib/vxe-checkbox/style/style.css +107 -0
  423. package/lib/vxe-checkbox/style/style.min.css +1 -0
  424. package/lib/vxe-checkbox-group/index.js +22 -0
  425. package/lib/vxe-checkbox-group/index.min.js +1 -0
  426. package/lib/vxe-checkbox-group/style/index.js +1 -0
  427. package/lib/vxe-checkbox-group/style/style.css +0 -0
  428. package/lib/vxe-checkbox-group/style/style.min.css +0 -0
  429. package/lib/{vxe-design → vxe-form}/index.js +5 -5
  430. package/lib/vxe-form/index.min.js +1 -0
  431. package/lib/vxe-form/style/index.js +1 -0
  432. package/lib/vxe-form/style/style.css +321 -0
  433. package/lib/vxe-form/style/style.min.css +1 -0
  434. package/lib/vxe-form-design/index.js +22 -0
  435. package/lib/vxe-form-design/index.min.js +1 -0
  436. package/lib/vxe-form-design/style/index.js +1 -0
  437. package/lib/vxe-form-design/style/style.css +97 -0
  438. package/lib/vxe-form-design/style/style.min.css +1 -0
  439. package/lib/vxe-form-gather/index.js +22 -0
  440. package/lib/vxe-form-gather/index.min.js +1 -0
  441. package/lib/vxe-form-gather/style/index.js +1 -0
  442. package/lib/vxe-form-gather/style/style.css +0 -0
  443. package/lib/vxe-form-gather/style/style.min.css +0 -0
  444. package/lib/vxe-form-item/index.js +22 -0
  445. package/lib/vxe-form-item/index.min.js +1 -0
  446. package/lib/vxe-form-item/style/index.js +1 -0
  447. package/lib/vxe-form-item/style/style.css +0 -0
  448. package/lib/vxe-form-item/style/style.min.css +0 -0
  449. package/lib/vxe-icon/style/style.css +540 -1
  450. package/lib/vxe-icon/style/style.min.css +1 -1
  451. package/lib/vxe-input/index.js +22 -0
  452. package/lib/vxe-input/index.min.js +1 -0
  453. package/lib/vxe-input/style/index.js +1 -0
  454. package/lib/vxe-input/style/style.css +1000 -0
  455. package/lib/vxe-input/style/style.min.css +1 -0
  456. package/lib/vxe-layout-aside/style/style.css +1 -0
  457. package/lib/vxe-layout-aside/style/style.min.css +1 -1
  458. package/lib/vxe-layout-body/style/style.css +1 -0
  459. package/lib/vxe-layout-body/style/style.min.css +1 -1
  460. package/lib/vxe-layout-footer/style/style.css +1 -0
  461. package/lib/vxe-layout-footer/style/style.min.css +1 -1
  462. package/lib/vxe-layout-header/style/style.css +1 -0
  463. package/lib/vxe-layout-header/style/style.min.css +1 -1
  464. package/lib/vxe-list-design/index.js +22 -0
  465. package/lib/vxe-list-design/index.min.js +1 -0
  466. package/lib/vxe-list-design/style/index.js +1 -0
  467. package/lib/vxe-list-design/style/style.css +0 -0
  468. package/lib/vxe-list-design/style/style.min.css +0 -0
  469. package/lib/vxe-loading/index.js +22 -0
  470. package/lib/vxe-loading/index.min.js +1 -0
  471. package/lib/vxe-loading/style/index.js +1 -0
  472. package/lib/vxe-loading/style/style.css +75 -0
  473. package/lib/vxe-loading/style/style.min.css +1 -0
  474. package/lib/vxe-modal/index.js +22 -0
  475. package/lib/vxe-modal/index.min.js +1 -0
  476. package/lib/vxe-modal/style/index.js +1 -0
  477. package/lib/vxe-modal/style/style.css +323 -0
  478. package/lib/vxe-modal/style/style.min.css +1 -0
  479. package/lib/vxe-optgroup/index.js +22 -0
  480. package/lib/vxe-optgroup/index.min.js +1 -0
  481. package/lib/vxe-optgroup/style/index.js +1 -0
  482. package/lib/vxe-optgroup/style/style.css +0 -0
  483. package/lib/vxe-optgroup/style/style.min.css +0 -0
  484. package/lib/vxe-option/index.js +22 -0
  485. package/lib/vxe-option/index.min.js +1 -0
  486. package/lib/vxe-option/style/index.js +1 -0
  487. package/lib/vxe-option/style/style.css +0 -0
  488. package/lib/vxe-option/style/style.min.css +0 -0
  489. package/lib/vxe-pager/index.js +22 -0
  490. package/lib/vxe-pager/index.min.js +1 -0
  491. package/lib/vxe-pager/style/index.js +1 -0
  492. package/lib/vxe-pager/style/style.css +319 -0
  493. package/lib/vxe-pager/style/style.min.css +1 -0
  494. package/lib/vxe-pulldown/index.js +22 -0
  495. package/lib/vxe-pulldown/index.min.js +1 -0
  496. package/lib/vxe-pulldown/style/index.js +1 -0
  497. package/lib/vxe-pulldown/style/style.css +57 -0
  498. package/lib/vxe-pulldown/style/style.min.css +1 -0
  499. package/lib/vxe-radio/index.js +22 -0
  500. package/lib/vxe-radio/index.min.js +1 -0
  501. package/lib/vxe-radio/style/index.js +1 -0
  502. package/lib/vxe-radio/style/style.css +143 -0
  503. package/lib/vxe-radio/style/style.min.css +1 -0
  504. package/lib/vxe-radio-button/index.js +22 -0
  505. package/lib/vxe-radio-button/index.min.js +1 -0
  506. package/lib/vxe-radio-button/style/index.js +1 -0
  507. package/lib/vxe-radio-button/style/style.css +0 -0
  508. package/lib/vxe-radio-button/style/style.min.css +0 -0
  509. package/lib/vxe-radio-group/index.js +22 -0
  510. package/lib/vxe-radio-group/index.min.js +1 -0
  511. package/lib/vxe-radio-group/style/index.js +1 -0
  512. package/lib/vxe-radio-group/style/style.css +0 -0
  513. package/lib/vxe-radio-group/style/style.min.css +0 -0
  514. package/lib/vxe-select/index.js +22 -0
  515. package/lib/vxe-select/index.min.js +1 -0
  516. package/lib/vxe-select/style/index.js +1 -0
  517. package/lib/vxe-select/style/style.css +201 -0
  518. package/lib/vxe-select/style/style.min.css +1 -0
  519. package/lib/vxe-switch/index.js +22 -0
  520. package/lib/vxe-switch/index.min.js +1 -0
  521. package/lib/vxe-switch/style/index.js +1 -0
  522. package/lib/vxe-switch/style/style.css +97 -0
  523. package/lib/vxe-switch/style/style.min.css +1 -0
  524. package/lib/vxe-textarea/index.js +22 -0
  525. package/lib/vxe-textarea/index.min.js +1 -0
  526. package/lib/vxe-textarea/style/index.js +1 -0
  527. package/lib/vxe-textarea/style/style.css +102 -0
  528. package/lib/vxe-textarea/style/style.min.css +1 -0
  529. package/lib/vxe-tooltip/index.js +22 -0
  530. package/lib/vxe-tooltip/index.min.js +1 -0
  531. package/lib/vxe-tooltip/style/index.js +1 -0
  532. package/lib/vxe-tooltip/style/style.css +103 -0
  533. package/lib/vxe-tooltip/style/style.min.css +1 -0
  534. package/package.json +1 -1
  535. package/packages/anchor/src/anchor.ts +1 -1
  536. package/packages/anchor-link/index.ts +1 -1
  537. package/packages/{button-group → button}/src/button-group.ts +2 -2
  538. package/packages/button/src/button.ts +3 -3
  539. package/packages/button-group/index.ts +1 -1
  540. package/packages/checkbox/index.ts +15 -0
  541. package/packages/checkbox/src/checkbox.ts +131 -0
  542. package/packages/checkbox/src/group.ts +127 -0
  543. package/packages/checkbox-group/index.ts +15 -0
  544. package/packages/col/index.ts +1 -1
  545. package/packages/components.ts +100 -35
  546. package/packages/dynamics/index.ts +34 -0
  547. package/packages/form/index.ts +11 -0
  548. package/packages/form/src/form-config-item.ts +193 -0
  549. package/packages/form/src/form-gather.ts +60 -0
  550. package/packages/form/src/form-item.ts +253 -0
  551. package/packages/form/src/form.ts +716 -0
  552. package/packages/form/src/itemInfo.ts +43 -0
  553. package/packages/form/src/render.ts +83 -0
  554. package/packages/form/src/util.ts +79 -0
  555. package/packages/form-design/index.ts +11 -0
  556. package/packages/form-design/src/form-design.ts +99 -0
  557. package/packages/form-design/src/setting.ts +13 -0
  558. package/packages/form-design/src/util.ts +10 -0
  559. package/packages/form-design/src/view.ts +125 -0
  560. package/packages/form-design/src/widget.ts +117 -0
  561. package/packages/form-gather/index.ts +11 -0
  562. package/packages/form-item/index.ts +11 -0
  563. package/packages/icon/src/icon.ts +1 -1
  564. package/packages/input/index.ts +15 -0
  565. package/packages/input/src/date.ts +42 -0
  566. package/packages/input/src/input.ts +2480 -0
  567. package/packages/input/src/number.ts +12 -0
  568. package/packages/list-design/index.ts +11 -0
  569. package/packages/list-design/src/list-design.ts +55 -0
  570. package/packages/loading/index.ts +11 -0
  571. package/packages/loading/src/loading.ts +56 -0
  572. package/packages/modal/index.ts +110 -0
  573. package/packages/modal/src/modal.ts +950 -0
  574. package/packages/optgroup/index.ts +15 -0
  575. package/packages/option/index.ts +15 -0
  576. package/packages/pager/index.ts +15 -0
  577. package/packages/pager/src/pager.ts +595 -0
  578. package/packages/pulldown/index.ts +15 -0
  579. package/packages/pulldown/src/pulldown.ts +349 -0
  580. package/packages/radio/index.ts +15 -0
  581. package/packages/radio/src/button.ts +132 -0
  582. package/packages/radio/src/group.ts +110 -0
  583. package/packages/radio/src/radio.ts +137 -0
  584. package/packages/radio-button/index.ts +15 -0
  585. package/packages/radio-group/index.ts +15 -0
  586. package/packages/select/index.ts +15 -0
  587. package/packages/select/src/optgroup.ts +39 -0
  588. package/packages/select/src/option.ts +38 -0
  589. package/packages/select/src/optionInfo.ts +20 -0
  590. package/packages/select/src/select.ts +1034 -0
  591. package/packages/select/src/util.ts +47 -0
  592. package/packages/switch/index.ts +15 -0
  593. package/packages/switch/src/switch.ts +171 -0
  594. package/packages/textarea/index.ts +15 -0
  595. package/packages/textarea/src/textarea.ts +273 -0
  596. package/packages/tooltip/index.ts +11 -0
  597. package/packages/tooltip/src/tooltip.ts +360 -0
  598. package/packages/ui/src/core.ts +13 -1
  599. package/packages/ui/src/dom.ts +23 -0
  600. package/packages/ui/src/globalStore.ts +122 -5
  601. package/packages/ui/src/i18n.ts +8 -0
  602. package/packages/ui/src/log.ts +2 -2
  603. package/packages/ui/src/renderer.ts +71 -0
  604. package/packages/ui/src/store.ts +49 -0
  605. package/packages/ui/src/utils.ts +12 -0
  606. package/packages/ui/src/validators.ts +9 -0
  607. package/packages/ui/src/vn.ts +14 -0
  608. package/styles/all.scss +30 -10
  609. package/styles/base/common.scss +13 -0
  610. package/styles/components/button.scss +8 -8
  611. package/styles/components/checkbox-group.scss +0 -0
  612. package/styles/components/checkbox.scss +91 -0
  613. package/styles/components/form-design.scss +93 -0
  614. package/styles/components/form-gather.scss +0 -0
  615. package/styles/components/form-item.scss +0 -0
  616. package/styles/components/form.scss +339 -0
  617. package/styles/components/icon.scss +3 -1
  618. package/styles/components/input.scss +911 -0
  619. package/styles/components/layout-aside.scss +1 -0
  620. package/styles/components/layout-body.scss +1 -0
  621. package/styles/components/layout-footer.scss +1 -0
  622. package/styles/components/layout-header.scss +1 -0
  623. package/styles/components/list-design.scss +0 -0
  624. package/styles/components/list.scss +26 -0
  625. package/styles/components/loading.scss +84 -0
  626. package/styles/components/modal.scss +383 -0
  627. package/styles/components/old-icon.scss +712 -0
  628. package/styles/components/optgroup.scss +0 -0
  629. package/styles/components/option.scss +0 -0
  630. package/styles/components/pager.scss +287 -0
  631. package/styles/components/pulldown.scss +55 -0
  632. package/styles/components/radio-button.scss +0 -0
  633. package/styles/components/radio-group.scss +0 -0
  634. package/styles/components/radio.scss +149 -0
  635. package/styles/components/select.scss +226 -0
  636. package/styles/components/switch.scss +113 -0
  637. package/styles/components/textarea.scss +102 -0
  638. package/styles/components/tooltip.scss +124 -0
  639. package/styles/helpers/mixin.scss +12 -12
  640. package/styles/theme/base.scss +143 -6
  641. package/types/all.d.ts +66 -33
  642. package/types/{component → components}/anchor-link.d.ts +17 -2
  643. package/types/{component → components}/anchor.d.ts +10 -2
  644. package/types/{component → components}/breadcrumb-item.d.ts +12 -1
  645. package/types/{component → components}/breadcrumb.d.ts +10 -2
  646. package/types/{component → components}/button-group.d.ts +11 -3
  647. package/types/{component → components}/button.d.ts +14 -3
  648. package/types/components/checkbox-group.d.ts +112 -0
  649. package/types/components/checkbox.d.ts +119 -0
  650. package/types/{component → components}/col.d.ts +9 -1
  651. package/types/components/form-design.d.ts +88 -0
  652. package/types/components/form-gather.d.ts +75 -0
  653. package/types/components/form-item.d.ts +231 -0
  654. package/types/components/form.d.ts +349 -0
  655. package/types/{component → components}/icon.d.ts +7 -2
  656. package/types/components/input.d.ts +375 -0
  657. package/types/{component → components}/layout-aside.d.ts +10 -2
  658. package/types/{component → components}/layout-body.d.ts +10 -2
  659. package/types/{component → components}/layout-container.d.ts +10 -2
  660. package/types/{component → components}/layout-footer.d.ts +10 -2
  661. package/types/{component → components}/layout-header.d.ts +7 -1
  662. package/types/components/list-design.d.ts +67 -0
  663. package/types/components/loading.d.ts +66 -0
  664. package/types/components/modal.d.ts +381 -0
  665. package/types/components/optgroup.d.ts +80 -0
  666. package/types/components/option.d.ts +99 -0
  667. package/types/components/pager.d.ts +208 -0
  668. package/types/components/pulldown.d.ts +134 -0
  669. package/types/components/radio-button.d.ts +99 -0
  670. package/types/components/radio-group.d.ts +107 -0
  671. package/types/components/radio.d.ts +119 -0
  672. package/types/{component → components}/row.d.ts +10 -2
  673. package/types/components/select.d.ts +274 -0
  674. package/types/components/switch.d.ts +118 -0
  675. package/types/components/textarea.d.ts +212 -0
  676. package/types/components/tooltip.d.ts +122 -0
  677. package/types/ui/global-config.d.ts +43 -6
  678. package/types/ui/global-icon.d.ts +80 -10
  679. package/types/ui/index.d.ts +25 -2
  680. package/types/ui/renderer.d.ts +239 -0
  681. package/types/ui/validators.d.ts +26 -0
  682. package/es/design/index.js +0 -8
  683. package/es/vxe-design/index.js +0 -3
  684. package/lib/button-group/src/button-group.min.js +0 -1
  685. package/lib/design/index.js +0 -15
  686. package/lib/design/index.min.js +0 -1
  687. package/lib/design/src/design.min.js +0 -1
  688. package/lib/vxe-design/index.min.js +0 -1
  689. package/packages/design/index.ts +0 -11
  690. package/packages/design/src/design.ts +0 -55
  691. package/styles/components/design.scss +0 -1
  692. package/types/component/design.d.ts +0 -63
  693. /package/es/{anchor-link → anchor}/src/anchor-link.js +0 -0
  694. /package/es/{anchor-link → anchor}/src/util.js +0 -0
  695. /package/es/{design → checkbox-group}/style.css +0 -0
  696. /package/es/{design → checkbox-group}/style.min.css +0 -0
  697. /package/es/{vxe-design → form-gather}/style.css +0 -0
  698. /package/es/{vxe-design → form-gather}/style.min.css +0 -0
  699. /package/{lib/design/style → es/form-item}/style.css +0 -0
  700. /package/{lib/design/style → es/form-item}/style.min.css +0 -0
  701. /package/{lib/vxe-design/style → es/list-design}/style.css +0 -0
  702. /package/{lib/vxe-design/style → es/list-design}/style.min.css +0 -0
  703. /package/es/{col → row}/src/col.js +0 -0
  704. /package/lib/{anchor-link → anchor}/src/anchor-link.js +0 -0
  705. /package/lib/{anchor-link → anchor}/src/anchor-link.min.js +0 -0
  706. /package/lib/{anchor-link → anchor}/src/util.js +0 -0
  707. /package/lib/{anchor-link → anchor}/src/util.min.js +0 -0
  708. /package/lib/{vxe-design → checkbox}/style/index.js +0 -0
  709. /package/lib/{design → checkbox-group}/style/index.js +0 -0
  710. /package/lib/{col → row}/src/col.js +0 -0
  711. /package/lib/{col → row}/src/col.min.js +0 -0
  712. /package/packages/{anchor-link → anchor}/src/anchor-link.ts +0 -0
  713. /package/packages/{anchor-link → anchor}/src/util.ts +0 -0
  714. /package/packages/{col → row}/src/col.ts +0 -0
@@ -0,0 +1,2333 @@
1
+ import { defineComponent, h, Teleport, ref, computed, reactive, inject, nextTick, watch, onUnmounted } from 'vue';
2
+ import XEUtils from 'xe-utils';
3
+ import globalConfigStore from '../../ui/src/globalStore';
4
+ import iconConfigStore from '../../ui/src/iconStore';
5
+ import { useSize } from '../../hooks/size';
6
+ import { getFuncText, getLastZIndex, nextZIndex } from '../../ui/src/utils';
7
+ import { hasClass, getAbsolutePos, getEventTargetNode } from '../../ui/src/dom';
8
+ import { GlobalEvent, hasEventKey, EVENT_KEYS } from '../../ui/src/event';
9
+ import { getI18n } from '../../ui/src/i18n';
10
+ import { toStringTimeDate, getDateQuarter } from './date';
11
+ import { handleNumber, toFloatValueFixed } from './number';
12
+ const yearSize = 12;
13
+ const monthSize = 20;
14
+ const quarterSize = 8;
15
+ export default defineComponent({
16
+ name: 'VxeInput',
17
+ props: {
18
+ modelValue: [String, Number, Date],
19
+ immediate: { type: Boolean, default: true },
20
+ name: String,
21
+ type: { type: String, default: 'text' },
22
+ clearable: { type: Boolean, default: () => globalConfigStore.input.clearable },
23
+ readonly: Boolean,
24
+ disabled: Boolean,
25
+ placeholder: {
26
+ type: String,
27
+ default: () => XEUtils.eqNull(globalConfigStore.input.placeholder) ? getI18n('vxe.base.pleaseInput') : globalConfigStore.input.placeholder
28
+ },
29
+ maxlength: [String, Number],
30
+ autocomplete: { type: String, default: 'off' },
31
+ align: String,
32
+ form: String,
33
+ className: String,
34
+ size: { type: String, default: () => globalConfigStore.input.size || globalConfigStore.size },
35
+ multiple: Boolean,
36
+ // text
37
+ showWordCount: Boolean,
38
+ countMethod: Function,
39
+ // number、integer、float
40
+ min: { type: [String, Number], default: null },
41
+ max: { type: [String, Number], default: null },
42
+ step: [String, Number],
43
+ exponential: { type: Boolean, default: () => globalConfigStore.input.exponential },
44
+ // number、integer、float、password
45
+ controls: { type: Boolean, default: () => globalConfigStore.input.controls },
46
+ // float
47
+ digits: { type: [String, Number], default: () => globalConfigStore.input.digits },
48
+ // date、week、month、quarter、year
49
+ startDate: { type: [String, Number, Date], default: () => globalConfigStore.input.startDate },
50
+ endDate: { type: [String, Number, Date], default: () => globalConfigStore.input.endDate },
51
+ minDate: [String, Number, Date],
52
+ maxDate: [String, Number, Date],
53
+ // 已废弃 startWeek,被 startDay 替换
54
+ startWeek: Number,
55
+ startDay: { type: [String, Number], default: () => globalConfigStore.input.startDay },
56
+ labelFormat: { type: String, default: () => globalConfigStore.input.labelFormat },
57
+ valueFormat: { type: String, default: () => globalConfigStore.input.valueFormat },
58
+ editable: { type: Boolean, default: true },
59
+ festivalMethod: { type: Function, default: () => globalConfigStore.input.festivalMethod },
60
+ disabledMethod: { type: Function, default: () => globalConfigStore.input.disabledMethod },
61
+ // week
62
+ selectDay: { type: [String, Number], default: () => globalConfigStore.input.selectDay },
63
+ prefixIcon: String,
64
+ suffixIcon: String,
65
+ placement: String,
66
+ transfer: { type: Boolean, default: () => globalConfigStore.input.transfer }
67
+ },
68
+ emits: [
69
+ 'update:modelValue',
70
+ 'input',
71
+ 'change',
72
+ 'keydown',
73
+ 'keyup',
74
+ 'wheel',
75
+ 'click',
76
+ 'focus',
77
+ 'blur',
78
+ 'clear',
79
+ 'search-click',
80
+ 'toggle-visible',
81
+ 'prev-number',
82
+ 'next-number',
83
+ 'prefix-click',
84
+ 'suffix-click',
85
+ 'date-prev',
86
+ 'date-today',
87
+ 'date-next'
88
+ ],
89
+ setup(props, context) {
90
+ const { slots, emit } = context;
91
+ const $xeform = inject('$xeForm', null);
92
+ const $xeformiteminfo = inject('$xeFormItemInfo', null);
93
+ const xID = XEUtils.uniqueId();
94
+ const computeSize = useSize(props);
95
+ const reactData = reactive({
96
+ inited: false,
97
+ panelIndex: 0,
98
+ showPwd: false,
99
+ visiblePanel: false,
100
+ animatVisible: false,
101
+ panelStyle: null,
102
+ panelPlacement: '',
103
+ isActivated: false,
104
+ inputValue: props.modelValue,
105
+ datetimePanelValue: null,
106
+ datePanelValue: null,
107
+ datePanelLabel: '',
108
+ datePanelType: 'day',
109
+ selectMonth: null,
110
+ currentDate: null
111
+ });
112
+ const refElem = ref();
113
+ const refInputTarget = ref();
114
+ const refInputPanel = ref();
115
+ const refInputTimeBody = ref();
116
+ const refMaps = {
117
+ refElem,
118
+ refInput: refInputTarget
119
+ };
120
+ const $xeinput = {
121
+ xID,
122
+ props,
123
+ context,
124
+ reactData,
125
+ getRefMaps: () => refMaps
126
+ };
127
+ let inputMethods = {};
128
+ const parseDate = (value, format) => {
129
+ const { type } = props;
130
+ if (type === 'time') {
131
+ return toStringTimeDate(value);
132
+ }
133
+ return XEUtils.toStringDate(value, format);
134
+ };
135
+ const computeIsDateTimeType = computed(() => {
136
+ const { type } = props;
137
+ return type === 'time' || type === 'datetime';
138
+ });
139
+ const computeIsNumType = computed(() => {
140
+ return ['number', 'integer', 'float'].indexOf(props.type) > -1;
141
+ });
142
+ const computeInputCount = computed(() => {
143
+ return XEUtils.getSize(reactData.inputValue);
144
+ });
145
+ const computeIsCountError = computed(() => {
146
+ const inputCount = computeInputCount.value;
147
+ return props.maxlength && inputCount > XEUtils.toNumber(props.maxlength);
148
+ });
149
+ const computeIsDatePickerType = computed(() => {
150
+ const isDateTimeType = computeIsDateTimeType.value;
151
+ return isDateTimeType || ['date', 'week', 'month', 'quarter', 'year'].indexOf(props.type) > -1;
152
+ });
153
+ const computeIsPawdType = computed(() => {
154
+ return props.type === 'password';
155
+ });
156
+ const computeIsSearchType = computed(() => {
157
+ return props.type === 'search';
158
+ });
159
+ const computeDigitsValue = computed(() => {
160
+ return XEUtils.toInteger(props.digits) || 1;
161
+ });
162
+ const computeStepValue = computed(() => {
163
+ const { type } = props;
164
+ const digitsValue = computeDigitsValue.value;
165
+ const step = props.step;
166
+ if (type === 'integer') {
167
+ return XEUtils.toInteger(step) || 1;
168
+ }
169
+ else if (type === 'float') {
170
+ return XEUtils.toNumber(step) || (1 / Math.pow(10, digitsValue));
171
+ }
172
+ return XEUtils.toNumber(step) || 1;
173
+ });
174
+ const computeIsClearable = computed(() => {
175
+ const { type } = props;
176
+ const isNumType = computeIsNumType.value;
177
+ const isDatePickerType = computeIsDatePickerType.value;
178
+ const isPawdType = computeIsPawdType.value;
179
+ return props.clearable && (isPawdType || isNumType || isDatePickerType || type === 'text' || type === 'search');
180
+ });
181
+ const computeDateStartTime = computed(() => {
182
+ return props.startDate ? XEUtils.toStringDate(props.startDate) : null;
183
+ });
184
+ const computeDateEndTime = computed(() => {
185
+ return props.endDate ? XEUtils.toStringDate(props.endDate) : null;
186
+ });
187
+ const computeSupportMultiples = computed(() => {
188
+ return ['date', 'week', 'month', 'quarter', 'year'].includes(props.type);
189
+ });
190
+ const computeDateListValue = computed(() => {
191
+ const { modelValue, multiple } = props;
192
+ const isDatePickerType = computeIsDatePickerType.value;
193
+ const dateValueFormat = computeDateValueFormat.value;
194
+ if (multiple && modelValue && isDatePickerType) {
195
+ return XEUtils.toValueString(modelValue).split(',').map(item => {
196
+ const date = parseDate(item, dateValueFormat);
197
+ if (XEUtils.isValidDate(date)) {
198
+ return date;
199
+ }
200
+ return null;
201
+ });
202
+ }
203
+ return [];
204
+ });
205
+ const computeDateMultipleValue = computed(() => {
206
+ const dateListValue = computeDateListValue.value;
207
+ const dateValueFormat = computeDateValueFormat.value;
208
+ return dateListValue.map(date => XEUtils.toDateString(date, dateValueFormat));
209
+ });
210
+ const computeDateMultipleLabel = computed(() => {
211
+ const dateListValue = computeDateListValue.value;
212
+ const dateLabelFormat = computeDateLabelFormat.value;
213
+ return dateListValue.map(date => XEUtils.toDateString(date, dateLabelFormat)).join(', ');
214
+ });
215
+ const computeDateValueFormat = computed(() => {
216
+ const { type } = props;
217
+ return type === 'time' ? 'HH:mm:ss' : (props.valueFormat || (type === 'datetime' ? 'yyyy-MM-dd HH:mm:ss' : 'yyyy-MM-dd'));
218
+ });
219
+ const computeDateValue = computed(() => {
220
+ const { modelValue } = props;
221
+ const isDatePickerType = computeIsDatePickerType.value;
222
+ const dateValueFormat = computeDateValueFormat.value;
223
+ let val = null;
224
+ if (modelValue && isDatePickerType) {
225
+ const date = parseDate(modelValue, dateValueFormat);
226
+ if (XEUtils.isValidDate(date)) {
227
+ val = date;
228
+ }
229
+ }
230
+ return val;
231
+ });
232
+ const computeIsDisabledPrevDateBtn = computed(() => {
233
+ const dateStartTime = computeDateStartTime.value;
234
+ const { selectMonth } = reactData;
235
+ if (selectMonth && dateStartTime) {
236
+ return selectMonth <= dateStartTime;
237
+ }
238
+ return false;
239
+ });
240
+ const computeIsDisabledNextDateBtn = computed(() => {
241
+ const dateEndTime = computeDateEndTime.value;
242
+ const { selectMonth } = reactData;
243
+ if (selectMonth && dateEndTime) {
244
+ return selectMonth >= dateEndTime;
245
+ }
246
+ return false;
247
+ });
248
+ const computeDateTimeLabel = computed(() => {
249
+ const { datetimePanelValue } = reactData;
250
+ if (datetimePanelValue) {
251
+ return XEUtils.toDateString(datetimePanelValue, 'HH:mm:ss');
252
+ }
253
+ return '';
254
+ });
255
+ const computeDateHMSTime = computed(() => {
256
+ const dateValue = computeDateValue.value;
257
+ const isDateTimeType = computeIsDateTimeType.value;
258
+ return dateValue && isDateTimeType ? (dateValue.getHours() * 3600 + dateValue.getMinutes() * 60 + dateValue.getSeconds()) * 1000 : 0;
259
+ });
260
+ const computeDateLabelFormat = computed(() => {
261
+ const isDatePickerType = computeIsDatePickerType.value;
262
+ if (isDatePickerType) {
263
+ return props.labelFormat || getI18n(`vxe.input.date.labelFormat.${props.type}`);
264
+ }
265
+ return null;
266
+ });
267
+ const computeYearList = computed(() => {
268
+ const { selectMonth, currentDate } = reactData;
269
+ const years = [];
270
+ if (selectMonth && currentDate) {
271
+ const currFullYear = currentDate.getFullYear();
272
+ const selectFullYear = selectMonth.getFullYear();
273
+ const startYearDate = new Date(selectFullYear - selectFullYear % yearSize, 0, 1);
274
+ for (let index = -4; index < yearSize + 4; index++) {
275
+ const date = XEUtils.getWhatYear(startYearDate, index, 'first');
276
+ const itemFullYear = date.getFullYear();
277
+ years.push({
278
+ date,
279
+ isCurrent: true,
280
+ isPrev: index < 0,
281
+ isNow: currFullYear === itemFullYear,
282
+ isNext: index >= yearSize,
283
+ year: itemFullYear
284
+ });
285
+ }
286
+ }
287
+ return years;
288
+ });
289
+ const computeSelectDatePanelLabel = computed(() => {
290
+ const isDatePickerType = computeIsDatePickerType.value;
291
+ if (isDatePickerType) {
292
+ const { datePanelType, selectMonth } = reactData;
293
+ const yearList = computeYearList.value;
294
+ let year = '';
295
+ let month;
296
+ if (selectMonth) {
297
+ year = selectMonth.getFullYear();
298
+ month = selectMonth.getMonth() + 1;
299
+ }
300
+ if (datePanelType === 'quarter') {
301
+ return getI18n('vxe.input.date.quarterLabel', [year]);
302
+ }
303
+ else if (datePanelType === 'month') {
304
+ return getI18n('vxe.input.date.monthLabel', [year]);
305
+ }
306
+ else if (datePanelType === 'year') {
307
+ return yearList.length ? `${yearList[0].year} - ${yearList[yearList.length - 1].year}` : '';
308
+ }
309
+ return getI18n('vxe.input.date.dayLabel', [year, month ? getI18n(`vxe.input.date.m${month}`) : '-']);
310
+ }
311
+ return '';
312
+ });
313
+ const computeFirstDayOfWeek = computed(() => {
314
+ const { startDay, startWeek } = props;
315
+ return XEUtils.toNumber(XEUtils.isNumber(startDay) || XEUtils.isString(startDay) ? startDay : startWeek);
316
+ });
317
+ const computeWeekDatas = computed(() => {
318
+ const weeks = [];
319
+ const isDatePickerType = computeIsDatePickerType.value;
320
+ if (isDatePickerType) {
321
+ let sWeek = computeFirstDayOfWeek.value;
322
+ weeks.push(sWeek);
323
+ for (let index = 0; index < 6; index++) {
324
+ if (sWeek >= 6) {
325
+ sWeek = 0;
326
+ }
327
+ else {
328
+ sWeek++;
329
+ }
330
+ weeks.push(sWeek);
331
+ }
332
+ }
333
+ return weeks;
334
+ });
335
+ const computeDateHeaders = computed(() => {
336
+ const isDatePickerType = computeIsDatePickerType.value;
337
+ if (isDatePickerType) {
338
+ const weekDatas = computeWeekDatas.value;
339
+ return weekDatas.map((day) => {
340
+ return {
341
+ value: day,
342
+ label: getI18n(`vxe.input.date.weeks.w${day}`)
343
+ };
344
+ });
345
+ }
346
+ return [];
347
+ });
348
+ const computeWeekHeaders = computed(() => {
349
+ const isDatePickerType = computeIsDatePickerType.value;
350
+ if (isDatePickerType) {
351
+ const dateHeaders = computeDateHeaders.value;
352
+ return [{ label: getI18n('vxe.input.date.weeks.w') }].concat(dateHeaders);
353
+ }
354
+ return [];
355
+ });
356
+ const computeYearDatas = computed(() => {
357
+ const yearList = computeYearList.value;
358
+ return XEUtils.chunk(yearList, 4);
359
+ });
360
+ const computeQuarterList = computed(() => {
361
+ const { selectMonth, currentDate } = reactData;
362
+ const quarters = [];
363
+ if (selectMonth && currentDate) {
364
+ const currFullYear = currentDate.getFullYear();
365
+ const currQuarter = getDateQuarter(currentDate);
366
+ const firstYear = XEUtils.getWhatYear(selectMonth, 0, 'first');
367
+ const selFullYear = firstYear.getFullYear();
368
+ for (let index = -2; index < quarterSize - 2; index++) {
369
+ const date = XEUtils.getWhatQuarter(firstYear, index);
370
+ const itemFullYear = date.getFullYear();
371
+ const itemQuarter = getDateQuarter(date);
372
+ const isPrev = itemFullYear < selFullYear;
373
+ quarters.push({
374
+ date,
375
+ isPrev,
376
+ isCurrent: itemFullYear === selFullYear,
377
+ isNow: itemFullYear === currFullYear && itemQuarter === currQuarter,
378
+ isNext: !isPrev && itemFullYear > selFullYear,
379
+ quarter: itemQuarter
380
+ });
381
+ }
382
+ }
383
+ return quarters;
384
+ });
385
+ const computeQuarterDatas = computed(() => {
386
+ const quarterList = computeQuarterList.value;
387
+ return XEUtils.chunk(quarterList, 2);
388
+ });
389
+ const computeMonthList = computed(() => {
390
+ const { selectMonth, currentDate } = reactData;
391
+ const months = [];
392
+ if (selectMonth && currentDate) {
393
+ const currFullYear = currentDate.getFullYear();
394
+ const currMonth = currentDate.getMonth();
395
+ const selFullYear = XEUtils.getWhatYear(selectMonth, 0, 'first').getFullYear();
396
+ for (let index = -4; index < monthSize - 4; index++) {
397
+ const date = XEUtils.getWhatYear(selectMonth, 0, index);
398
+ const itemFullYear = date.getFullYear();
399
+ const itemMonth = date.getMonth();
400
+ const isPrev = itemFullYear < selFullYear;
401
+ months.push({
402
+ date,
403
+ isPrev,
404
+ isCurrent: itemFullYear === selFullYear,
405
+ isNow: itemFullYear === currFullYear && itemMonth === currMonth,
406
+ isNext: !isPrev && itemFullYear > selFullYear,
407
+ month: itemMonth
408
+ });
409
+ }
410
+ }
411
+ return months;
412
+ });
413
+ const computeMonthDatas = computed(() => {
414
+ const monthList = computeMonthList.value;
415
+ return XEUtils.chunk(monthList, 4);
416
+ });
417
+ const computeDayList = computed(() => {
418
+ const { selectMonth, currentDate } = reactData;
419
+ const days = [];
420
+ if (selectMonth && currentDate) {
421
+ const dateHMSTime = computeDateHMSTime.value;
422
+ const weekDatas = computeWeekDatas.value;
423
+ const currFullYear = currentDate.getFullYear();
424
+ const currMonth = currentDate.getMonth();
425
+ const currDate = currentDate.getDate();
426
+ const selFullYear = selectMonth.getFullYear();
427
+ const selMonth = selectMonth.getMonth();
428
+ const selDay = selectMonth.getDay();
429
+ const prevOffsetDate = -weekDatas.indexOf(selDay);
430
+ const startDayDate = new Date(XEUtils.getWhatDay(selectMonth, prevOffsetDate).getTime() + dateHMSTime);
431
+ for (let index = 0; index < 42; index++) {
432
+ const date = XEUtils.getWhatDay(startDayDate, index);
433
+ const itemFullYear = date.getFullYear();
434
+ const itemMonth = date.getMonth();
435
+ const itemDate = date.getDate();
436
+ const isPrev = date < selectMonth;
437
+ days.push({
438
+ date,
439
+ isPrev,
440
+ isCurrent: itemFullYear === selFullYear && itemMonth === selMonth,
441
+ isNow: itemFullYear === currFullYear && itemMonth === currMonth && itemDate === currDate,
442
+ isNext: !isPrev && selMonth !== itemMonth,
443
+ label: itemDate
444
+ });
445
+ }
446
+ }
447
+ return days;
448
+ });
449
+ const computeDayDatas = computed(() => {
450
+ const dayList = computeDayList.value;
451
+ return XEUtils.chunk(dayList, 7);
452
+ });
453
+ const computeWeekDates = computed(() => {
454
+ const dayDatas = computeDayDatas.value;
455
+ const firstDayOfWeek = computeFirstDayOfWeek.value;
456
+ return dayDatas.map((list) => {
457
+ const firstItem = list[0];
458
+ const item = {
459
+ date: firstItem.date,
460
+ isWeekNumber: true,
461
+ isPrev: false,
462
+ isCurrent: false,
463
+ isNow: false,
464
+ isNext: false,
465
+ label: XEUtils.getYearWeek(firstItem.date, firstDayOfWeek)
466
+ };
467
+ return [item].concat(list);
468
+ });
469
+ });
470
+ const computeHourList = computed(() => {
471
+ const list = [];
472
+ const isDateTimeType = computeIsDateTimeType.value;
473
+ if (isDateTimeType) {
474
+ for (let index = 0; index < 24; index++) {
475
+ list.push({
476
+ value: index,
477
+ label: ('' + index).padStart(2, '0')
478
+ });
479
+ }
480
+ }
481
+ return list;
482
+ });
483
+ const computeMinuteList = computed(() => {
484
+ const list = [];
485
+ const isDateTimeType = computeIsDateTimeType.value;
486
+ if (isDateTimeType) {
487
+ for (let index = 0; index < 60; index++) {
488
+ list.push({
489
+ value: index,
490
+ label: ('' + index).padStart(2, '0')
491
+ });
492
+ }
493
+ }
494
+ return list;
495
+ });
496
+ const computeSecondList = computed(() => {
497
+ const minuteList = computeMinuteList.value;
498
+ return minuteList;
499
+ });
500
+ const computeInpReadonly = computed(() => {
501
+ const { type, readonly, editable, multiple } = props;
502
+ return readonly || multiple || !editable || type === 'week' || type === 'quarter';
503
+ });
504
+ const computeInputType = computed(() => {
505
+ const { type } = props;
506
+ const { showPwd } = reactData;
507
+ const isNumType = computeIsNumType.value;
508
+ const isDatePickerType = computeIsDatePickerType.value;
509
+ const isPawdType = computeIsPawdType.value;
510
+ if (isDatePickerType || isNumType || (isPawdType && showPwd) || type === 'number') {
511
+ return 'text';
512
+ }
513
+ return type;
514
+ });
515
+ const computeInpPlaceholder = computed(() => {
516
+ const { placeholder } = props;
517
+ if (placeholder) {
518
+ return getFuncText(placeholder);
519
+ }
520
+ return '';
521
+ });
522
+ const computeInpMaxlength = computed(() => {
523
+ const { maxlength } = props;
524
+ const isNumType = computeIsNumType.value;
525
+ // 数值最大长度限制 16 位,包含小数
526
+ return isNumType && !XEUtils.toNumber(maxlength) ? 16 : maxlength;
527
+ });
528
+ const computeInpImmediate = computed(() => {
529
+ const { type, immediate } = props;
530
+ return immediate || !(type === 'text' || type === 'number' || type === 'integer' || type === 'float');
531
+ });
532
+ const computeNumValue = computed(() => {
533
+ const { type } = props;
534
+ const { inputValue } = reactData;
535
+ const isNumType = computeIsNumType.value;
536
+ if (isNumType) {
537
+ return type === 'integer' ? XEUtils.toInteger(handleNumber(inputValue)) : XEUtils.toNumber(handleNumber(inputValue));
538
+ }
539
+ return 0;
540
+ });
541
+ const computeIsDisabledSubtractNumber = computed(() => {
542
+ const { min } = props;
543
+ const { inputValue } = reactData;
544
+ const isNumType = computeIsNumType.value;
545
+ const numValue = computeNumValue.value;
546
+ // 当有值时再进行判断
547
+ if ((inputValue || inputValue === 0) && isNumType && min !== null) {
548
+ return numValue <= XEUtils.toNumber(min);
549
+ }
550
+ return false;
551
+ });
552
+ const computeIsDisabledAddNumber = computed(() => {
553
+ const { max } = props;
554
+ const { inputValue } = reactData;
555
+ const isNumType = computeIsNumType.value;
556
+ const numValue = computeNumValue.value;
557
+ // 当有值时再进行判断
558
+ if ((inputValue || inputValue === 0) && isNumType && max !== null) {
559
+ return numValue >= XEUtils.toNumber(max);
560
+ }
561
+ return false;
562
+ });
563
+ const getNumberValue = (val) => {
564
+ const { type, exponential } = props;
565
+ const inpMaxlength = computeInpMaxlength.value;
566
+ const digitsValue = computeDigitsValue.value;
567
+ const restVal = (type === 'float' ? toFloatValueFixed(val, digitsValue) : XEUtils.toValueString(val));
568
+ if (exponential && (val === restVal || XEUtils.toValueString(val).toLowerCase() === XEUtils.toNumber(restVal).toExponential())) {
569
+ return val;
570
+ }
571
+ return restVal.slice(0, inpMaxlength);
572
+ };
573
+ const triggerEvent = (evnt) => {
574
+ const { inputValue } = reactData;
575
+ inputMethods.dispatchEvent(evnt.type, { value: inputValue }, evnt);
576
+ };
577
+ const emitModel = (value, evnt) => {
578
+ reactData.inputValue = value;
579
+ emit('update:modelValue', value);
580
+ inputMethods.dispatchEvent('input', { value }, evnt);
581
+ if (XEUtils.toValueString(props.modelValue) !== value) {
582
+ inputMethods.dispatchEvent('change', { value }, evnt);
583
+ // 自动更新校验状态
584
+ if ($xeform && $xeformiteminfo) {
585
+ $xeform.triggerItemEvent(evnt, $xeformiteminfo.itemConfig.field, value);
586
+ }
587
+ }
588
+ };
589
+ const emitInputEvent = (value, evnt) => {
590
+ const isDatePickerType = computeIsDatePickerType.value;
591
+ const inpImmediate = computeInpImmediate.value;
592
+ reactData.inputValue = value;
593
+ if (!isDatePickerType) {
594
+ if (inpImmediate) {
595
+ emitModel(value, evnt);
596
+ }
597
+ else {
598
+ inputMethods.dispatchEvent('input', { value }, evnt);
599
+ }
600
+ }
601
+ };
602
+ const inputEvent = (evnt) => {
603
+ const inputElem = evnt.target;
604
+ const value = inputElem.value;
605
+ emitInputEvent(value, evnt);
606
+ };
607
+ const changeEvent = (evnt) => {
608
+ const inpImmediate = computeInpImmediate.value;
609
+ if (!inpImmediate) {
610
+ triggerEvent(evnt);
611
+ }
612
+ };
613
+ const focusEvent = (evnt) => {
614
+ reactData.isActivated = true;
615
+ const isDatePickerType = computeIsDatePickerType.value;
616
+ if (isDatePickerType) {
617
+ datePickerOpenEvent(evnt);
618
+ }
619
+ triggerEvent(evnt);
620
+ };
621
+ const clickPrefixEvent = (evnt) => {
622
+ const { disabled } = props;
623
+ if (!disabled) {
624
+ const { inputValue } = reactData;
625
+ inputMethods.dispatchEvent('prefix-click', { value: inputValue }, evnt);
626
+ }
627
+ };
628
+ let hidePanelTimeout;
629
+ const hidePanel = () => {
630
+ return new Promise(resolve => {
631
+ reactData.visiblePanel = false;
632
+ hidePanelTimeout = window.setTimeout(() => {
633
+ reactData.animatVisible = false;
634
+ resolve();
635
+ }, 350);
636
+ });
637
+ };
638
+ const clearValueEvent = (evnt, value) => {
639
+ const { type } = props;
640
+ const isNumType = computeIsNumType.value;
641
+ const isDatePickerType = computeIsDatePickerType.value;
642
+ if (isDatePickerType) {
643
+ hidePanel();
644
+ }
645
+ if (isNumType || ['text', 'search', 'password'].indexOf(type) > -1) {
646
+ focus();
647
+ }
648
+ inputMethods.dispatchEvent('clear', { value }, evnt);
649
+ };
650
+ const clickSuffixEvent = (evnt) => {
651
+ const { disabled } = props;
652
+ if (!disabled) {
653
+ if (hasClass(evnt.currentTarget, 'is--clear')) {
654
+ emitModel('', evnt);
655
+ clearValueEvent(evnt, '');
656
+ }
657
+ else {
658
+ const { inputValue } = reactData;
659
+ inputMethods.dispatchEvent('suffix-click', { value: inputValue }, evnt);
660
+ }
661
+ }
662
+ };
663
+ const dateParseValue = (value) => {
664
+ const { type } = props;
665
+ const { valueFormat } = props;
666
+ const dateLabelFormat = computeDateLabelFormat.value;
667
+ const firstDayOfWeek = computeFirstDayOfWeek.value;
668
+ let dValue = null;
669
+ let dLabel = '';
670
+ if (value) {
671
+ dValue = parseDate(value, valueFormat);
672
+ }
673
+ if (XEUtils.isValidDate(dValue)) {
674
+ dLabel = XEUtils.toDateString(dValue, dateLabelFormat, { firstDay: firstDayOfWeek });
675
+ // 由于年份和第几周是冲突的行为,所以需要特殊处理,判断是否跨年
676
+ if (dateLabelFormat && type === 'week') {
677
+ const firstWeekDate = XEUtils.getWhatWeek(dValue, 0, firstDayOfWeek, firstDayOfWeek);
678
+ if (firstWeekDate.getFullYear() < dValue.getFullYear()) {
679
+ const yyIndex = dateLabelFormat.indexOf('yyyy');
680
+ if (yyIndex > -1) {
681
+ const yyNum = Number(dLabel.substring(yyIndex, yyIndex + 4));
682
+ if (yyNum && !isNaN(yyNum)) {
683
+ dLabel = dLabel.replace(`${yyNum}`, `${yyNum - 1}`);
684
+ }
685
+ }
686
+ }
687
+ }
688
+ }
689
+ else {
690
+ dValue = null;
691
+ }
692
+ reactData.datePanelValue = dValue;
693
+ reactData.datePanelLabel = dLabel;
694
+ };
695
+ /**
696
+ * 值变化时处理
697
+ */
698
+ const changeValue = () => {
699
+ const isDatePickerType = computeIsDatePickerType.value;
700
+ const { inputValue } = reactData;
701
+ if (isDatePickerType) {
702
+ dateParseValue(inputValue);
703
+ reactData.inputValue = props.multiple ? computeDateMultipleLabel.value : reactData.datePanelLabel;
704
+ }
705
+ };
706
+ /**
707
+ * 检查初始值
708
+ */
709
+ const initValue = () => {
710
+ const { type } = props;
711
+ const { inputValue } = reactData;
712
+ const isDatePickerType = computeIsDatePickerType.value;
713
+ const digitsValue = computeDigitsValue.value;
714
+ if (isDatePickerType) {
715
+ changeValue();
716
+ }
717
+ else if (type === 'float') {
718
+ if (inputValue) {
719
+ const validValue = toFloatValueFixed(inputValue, digitsValue);
720
+ if (inputValue !== validValue) {
721
+ emitModel(validValue, { type: 'init' });
722
+ }
723
+ }
724
+ }
725
+ };
726
+ const vaildMaxNum = (num) => {
727
+ return props.max === null || XEUtils.toNumber(num) <= XEUtils.toNumber(props.max);
728
+ };
729
+ const vaildMinNum = (num) => {
730
+ return props.min === null || XEUtils.toNumber(num) >= XEUtils.toNumber(props.min);
731
+ };
732
+ const dateRevert = () => {
733
+ reactData.inputValue = props.multiple ? computeDateMultipleLabel.value : reactData.datePanelLabel;
734
+ };
735
+ const dateCheckMonth = (date) => {
736
+ const month = XEUtils.getWhatMonth(date, 0, 'first');
737
+ if (!XEUtils.isEqual(month, reactData.selectMonth)) {
738
+ reactData.selectMonth = month;
739
+ }
740
+ };
741
+ const dateChange = (date) => {
742
+ const { modelValue, multiple } = props;
743
+ const { datetimePanelValue } = reactData;
744
+ const isDateTimeType = computeIsDateTimeType.value;
745
+ const dateValueFormat = computeDateValueFormat.value;
746
+ const firstDayOfWeek = computeFirstDayOfWeek.value;
747
+ if (props.type === 'week') {
748
+ const sWeek = XEUtils.toNumber(props.selectDay);
749
+ date = XEUtils.getWhatWeek(date, 0, sWeek, firstDayOfWeek);
750
+ }
751
+ else if (isDateTimeType) {
752
+ date.setHours(datetimePanelValue.getHours());
753
+ date.setMinutes(datetimePanelValue.getMinutes());
754
+ date.setSeconds(datetimePanelValue.getSeconds());
755
+ }
756
+ const inpVal = XEUtils.toDateString(date, dateValueFormat, { firstDay: firstDayOfWeek });
757
+ dateCheckMonth(date);
758
+ if (multiple) {
759
+ // 如果为多选
760
+ const dateMultipleValue = computeDateMultipleValue.value;
761
+ if (isDateTimeType) {
762
+ // 如果是datetime特殊类型
763
+ const dateListValue = [...computeDateListValue.value];
764
+ const datetimeRest = [];
765
+ const eqIndex = XEUtils.findIndexOf(dateListValue, val => XEUtils.isDateSame(date, val, 'yyyyMMdd'));
766
+ if (eqIndex === -1) {
767
+ dateListValue.push(date);
768
+ }
769
+ else {
770
+ dateListValue.splice(eqIndex, 1);
771
+ }
772
+ dateListValue.forEach(item => {
773
+ if (item) {
774
+ item.setHours(datetimePanelValue.getHours());
775
+ item.setMinutes(datetimePanelValue.getMinutes());
776
+ item.setSeconds(datetimePanelValue.getSeconds());
777
+ datetimeRest.push(item);
778
+ }
779
+ });
780
+ emitModel(datetimeRest.map(date => XEUtils.toDateString(date, dateValueFormat)).join(','), { type: 'update' });
781
+ }
782
+ else {
783
+ // 如果是日期类型
784
+ if (dateMultipleValue.some(val => XEUtils.isEqual(val, inpVal))) {
785
+ emitModel(dateMultipleValue.filter(val => !XEUtils.isEqual(val, inpVal)).join(','), { type: 'update' });
786
+ }
787
+ else {
788
+ emitModel(dateMultipleValue.concat([inpVal]).join(','), { type: 'update' });
789
+ }
790
+ }
791
+ }
792
+ else {
793
+ // 如果为单选
794
+ if (!XEUtils.isEqual(modelValue, inpVal)) {
795
+ emitModel(inpVal, { type: 'update' });
796
+ }
797
+ }
798
+ };
799
+ const afterCheckValue = () => {
800
+ const { type, min, max, exponential } = props;
801
+ const { inputValue, datetimePanelValue } = reactData;
802
+ const isNumType = computeIsNumType.value;
803
+ const isDatePickerType = computeIsDatePickerType.value;
804
+ const dateLabelFormat = computeDateLabelFormat.value;
805
+ const inpReadonly = computeInpReadonly.value;
806
+ if (!inpReadonly) {
807
+ if (isNumType) {
808
+ if (inputValue) {
809
+ let inpNumVal = type === 'integer' ? XEUtils.toInteger(handleNumber(inputValue)) : XEUtils.toNumber(handleNumber(inputValue));
810
+ if (!vaildMinNum(inpNumVal)) {
811
+ inpNumVal = min;
812
+ }
813
+ else if (!vaildMaxNum(inpNumVal)) {
814
+ inpNumVal = max;
815
+ }
816
+ if (exponential) {
817
+ const inpStringVal = XEUtils.toValueString(inputValue).toLowerCase();
818
+ if (inpStringVal === XEUtils.toNumber(inpNumVal).toExponential()) {
819
+ inpNumVal = inpStringVal;
820
+ }
821
+ }
822
+ emitModel(getNumberValue(inpNumVal), { type: 'check' });
823
+ }
824
+ }
825
+ else if (isDatePickerType) {
826
+ if (inputValue) {
827
+ let inpDateVal = parseDate(inputValue, dateLabelFormat);
828
+ if (XEUtils.isValidDate(inpDateVal)) {
829
+ if (type === 'time') {
830
+ inpDateVal = XEUtils.toDateString(inpDateVal, dateLabelFormat);
831
+ if (inputValue !== inpDateVal) {
832
+ emitModel(inpDateVal, { type: 'check' });
833
+ }
834
+ reactData.inputValue = inpDateVal;
835
+ }
836
+ else {
837
+ let isChange = false;
838
+ const firstDayOfWeek = computeFirstDayOfWeek.value;
839
+ if (type === 'datetime') {
840
+ const dateValue = computeDateValue.value;
841
+ if (inputValue !== XEUtils.toDateString(dateValue, dateLabelFormat) || inputValue !== XEUtils.toDateString(inpDateVal, dateLabelFormat)) {
842
+ isChange = true;
843
+ datetimePanelValue.setHours(inpDateVal.getHours());
844
+ datetimePanelValue.setMinutes(inpDateVal.getMinutes());
845
+ datetimePanelValue.setSeconds(inpDateVal.getSeconds());
846
+ }
847
+ }
848
+ else {
849
+ isChange = true;
850
+ }
851
+ reactData.inputValue = XEUtils.toDateString(inpDateVal, dateLabelFormat, { firstDay: firstDayOfWeek });
852
+ if (isChange) {
853
+ dateChange(inpDateVal);
854
+ }
855
+ }
856
+ }
857
+ else {
858
+ dateRevert();
859
+ }
860
+ }
861
+ else {
862
+ emitModel('', { type: 'check' });
863
+ }
864
+ }
865
+ }
866
+ };
867
+ const blurEvent = (evnt) => {
868
+ const { inputValue } = reactData;
869
+ const inpImmediate = computeInpImmediate.value;
870
+ if (!inpImmediate) {
871
+ emitModel(inputValue, evnt);
872
+ }
873
+ afterCheckValue();
874
+ if (!reactData.visiblePanel) {
875
+ reactData.isActivated = false;
876
+ }
877
+ inputMethods.dispatchEvent('blur', { value: inputValue }, evnt);
878
+ };
879
+ // 密码
880
+ const passwordToggleEvent = (evnt) => {
881
+ const { readonly, disabled } = props;
882
+ const { showPwd } = reactData;
883
+ if (!disabled && !readonly) {
884
+ reactData.showPwd = !showPwd;
885
+ }
886
+ inputMethods.dispatchEvent('toggle-visible', { visible: reactData.showPwd }, evnt);
887
+ };
888
+ // 密码
889
+ // 搜索
890
+ const searchEvent = (evnt) => {
891
+ inputMethods.dispatchEvent('search-click', {}, evnt);
892
+ };
893
+ // 搜索
894
+ // 数值
895
+ const numberChange = (isPlus, evnt) => {
896
+ const { min, max, type } = props;
897
+ const { inputValue } = reactData;
898
+ const stepValue = computeStepValue.value;
899
+ const numValue = type === 'integer' ? XEUtils.toInteger(handleNumber(inputValue)) : XEUtils.toNumber(handleNumber(inputValue));
900
+ const newValue = isPlus ? XEUtils.add(numValue, stepValue) : XEUtils.subtract(numValue, stepValue);
901
+ let restNum;
902
+ if (!vaildMinNum(newValue)) {
903
+ restNum = min;
904
+ }
905
+ else if (!vaildMaxNum(newValue)) {
906
+ restNum = max;
907
+ }
908
+ else {
909
+ restNum = newValue;
910
+ }
911
+ emitInputEvent(getNumberValue(restNum), evnt);
912
+ };
913
+ let downbumTimeout;
914
+ const numberNextEvent = (evnt) => {
915
+ const { readonly, disabled } = props;
916
+ const isDisabledSubtractNumber = computeIsDisabledSubtractNumber.value;
917
+ clearTimeout(downbumTimeout);
918
+ if (!disabled && !readonly && !isDisabledSubtractNumber) {
919
+ numberChange(false, evnt);
920
+ }
921
+ inputMethods.dispatchEvent('next-number', {}, evnt);
922
+ };
923
+ const numberDownNextEvent = (evnt) => {
924
+ downbumTimeout = window.setTimeout(() => {
925
+ numberNextEvent(evnt);
926
+ numberDownNextEvent(evnt);
927
+ }, 60);
928
+ };
929
+ const numberPrevEvent = (evnt) => {
930
+ const { readonly, disabled } = props;
931
+ const isDisabledAddNumber = computeIsDisabledAddNumber.value;
932
+ clearTimeout(downbumTimeout);
933
+ if (!disabled && !readonly && !isDisabledAddNumber) {
934
+ numberChange(true, evnt);
935
+ }
936
+ inputMethods.dispatchEvent('prev-number', {}, evnt);
937
+ };
938
+ const numberKeydownEvent = (evnt) => {
939
+ const isUpArrow = hasEventKey(evnt, EVENT_KEYS.ARROW_UP);
940
+ const isDwArrow = hasEventKey(evnt, EVENT_KEYS.ARROW_DOWN);
941
+ if (isUpArrow || isDwArrow) {
942
+ evnt.preventDefault();
943
+ if (isUpArrow) {
944
+ numberPrevEvent(evnt);
945
+ }
946
+ else {
947
+ numberNextEvent(evnt);
948
+ }
949
+ }
950
+ };
951
+ const keydownEvent = (evnt) => {
952
+ const { exponential, controls } = props;
953
+ const isNumType = computeIsNumType.value;
954
+ if (isNumType) {
955
+ const isCtrlKey = evnt.ctrlKey;
956
+ const isShiftKey = evnt.shiftKey;
957
+ const isAltKey = evnt.altKey;
958
+ const keyCode = evnt.keyCode;
959
+ if (!isCtrlKey && !isShiftKey && !isAltKey && (hasEventKey(evnt, EVENT_KEYS.SPACEBAR) || ((!exponential || keyCode !== 69) && (keyCode >= 65 && keyCode <= 90)) || (keyCode >= 186 && keyCode <= 188) || keyCode >= 191)) {
960
+ evnt.preventDefault();
961
+ }
962
+ if (controls) {
963
+ numberKeydownEvent(evnt);
964
+ }
965
+ }
966
+ triggerEvent(evnt);
967
+ };
968
+ const keyupEvent = (evnt) => {
969
+ triggerEvent(evnt);
970
+ };
971
+ // 数值
972
+ const numberStopDown = () => {
973
+ clearTimeout(downbumTimeout);
974
+ };
975
+ const numberDownPrevEvent = (evnt) => {
976
+ downbumTimeout = window.setTimeout(() => {
977
+ numberPrevEvent(evnt);
978
+ numberDownPrevEvent(evnt);
979
+ }, 60);
980
+ };
981
+ const numberMousedownEvent = (evnt) => {
982
+ numberStopDown();
983
+ if (evnt.button === 0) {
984
+ const isPrevNumber = hasClass(evnt.currentTarget, 'is--prev');
985
+ if (isPrevNumber) {
986
+ numberPrevEvent(evnt);
987
+ }
988
+ else {
989
+ numberNextEvent(evnt);
990
+ }
991
+ downbumTimeout = window.setTimeout(() => {
992
+ if (isPrevNumber) {
993
+ numberDownPrevEvent(evnt);
994
+ }
995
+ else {
996
+ numberDownNextEvent(evnt);
997
+ }
998
+ }, 500);
999
+ }
1000
+ };
1001
+ const wheelEvent = (evnt) => {
1002
+ const isNumType = computeIsNumType.value;
1003
+ if (isNumType && props.controls) {
1004
+ if (reactData.isActivated) {
1005
+ const delta = evnt.deltaY;
1006
+ if (delta > 0) {
1007
+ numberNextEvent(evnt);
1008
+ }
1009
+ else if (delta < 0) {
1010
+ numberPrevEvent(evnt);
1011
+ }
1012
+ evnt.preventDefault();
1013
+ }
1014
+ }
1015
+ triggerEvent(evnt);
1016
+ };
1017
+ // 日期
1018
+ const dateMonthHandle = (date, offsetMonth) => {
1019
+ reactData.selectMonth = XEUtils.getWhatMonth(date, offsetMonth, 'first');
1020
+ };
1021
+ const dateNowHandle = () => {
1022
+ const currentDate = XEUtils.getWhatDay(Date.now(), 0, 'first');
1023
+ reactData.currentDate = currentDate;
1024
+ dateMonthHandle(currentDate, 0);
1025
+ };
1026
+ const dateToggleTypeEvent = () => {
1027
+ let { datePanelType } = reactData;
1028
+ if (datePanelType === 'month' || datePanelType === 'quarter') {
1029
+ datePanelType = 'year';
1030
+ }
1031
+ else {
1032
+ datePanelType = 'month';
1033
+ }
1034
+ reactData.datePanelType = datePanelType;
1035
+ };
1036
+ const datePrevEvent = (evnt) => {
1037
+ const { type } = props;
1038
+ const { datePanelType, selectMonth } = reactData;
1039
+ const isDisabledPrevDateBtn = computeIsDisabledPrevDateBtn.value;
1040
+ if (!isDisabledPrevDateBtn) {
1041
+ if (type === 'year') {
1042
+ reactData.selectMonth = XEUtils.getWhatYear(selectMonth, -yearSize, 'first');
1043
+ }
1044
+ else if (type === 'month' || type === 'quarter') {
1045
+ if (datePanelType === 'year') {
1046
+ reactData.selectMonth = XEUtils.getWhatYear(selectMonth, -yearSize, 'first');
1047
+ }
1048
+ else {
1049
+ reactData.selectMonth = XEUtils.getWhatYear(selectMonth, -1, 'first');
1050
+ }
1051
+ }
1052
+ else {
1053
+ if (datePanelType === 'year') {
1054
+ reactData.selectMonth = XEUtils.getWhatYear(selectMonth, -yearSize, 'first');
1055
+ }
1056
+ else if (datePanelType === 'month') {
1057
+ reactData.selectMonth = XEUtils.getWhatYear(selectMonth, -1, 'first');
1058
+ }
1059
+ else {
1060
+ reactData.selectMonth = XEUtils.getWhatMonth(selectMonth, -1, 'first');
1061
+ }
1062
+ }
1063
+ inputMethods.dispatchEvent('date-prev', { type }, evnt);
1064
+ }
1065
+ };
1066
+ const dateTodayMonthEvent = (evnt) => {
1067
+ dateNowHandle();
1068
+ if (!props.multiple) {
1069
+ dateChange(reactData.currentDate);
1070
+ hidePanel();
1071
+ }
1072
+ inputMethods.dispatchEvent('date-today', { type: props.type }, evnt);
1073
+ };
1074
+ const dateNextEvent = (evnt) => {
1075
+ const { type } = props;
1076
+ const { datePanelType, selectMonth } = reactData;
1077
+ const isDisabledNextDateBtn = computeIsDisabledNextDateBtn.value;
1078
+ if (!isDisabledNextDateBtn) {
1079
+ if (type === 'year') {
1080
+ reactData.selectMonth = XEUtils.getWhatYear(selectMonth, yearSize, 'first');
1081
+ }
1082
+ else if (type === 'month' || type === 'quarter') {
1083
+ if (datePanelType === 'year') {
1084
+ reactData.selectMonth = XEUtils.getWhatYear(selectMonth, yearSize, 'first');
1085
+ }
1086
+ else {
1087
+ reactData.selectMonth = XEUtils.getWhatYear(selectMonth, 1, 'first');
1088
+ }
1089
+ }
1090
+ else {
1091
+ if (datePanelType === 'year') {
1092
+ reactData.selectMonth = XEUtils.getWhatYear(selectMonth, yearSize, 'first');
1093
+ }
1094
+ else if (datePanelType === 'month') {
1095
+ reactData.selectMonth = XEUtils.getWhatYear(selectMonth, 1, 'first');
1096
+ }
1097
+ else {
1098
+ reactData.selectMonth = XEUtils.getWhatMonth(selectMonth, 1, 'first');
1099
+ }
1100
+ }
1101
+ inputMethods.dispatchEvent('date-next', { type }, evnt);
1102
+ }
1103
+ };
1104
+ const isDateDisabled = (item) => {
1105
+ const { disabledMethod } = props;
1106
+ const { datePanelType } = reactData;
1107
+ return disabledMethod && disabledMethod({ type: datePanelType, viewType: datePanelType, date: item.date, $input: $xeinput });
1108
+ };
1109
+ const dateSelectItem = (date) => {
1110
+ const { type, multiple } = props;
1111
+ const { datePanelType } = reactData;
1112
+ if (type === 'month') {
1113
+ if (datePanelType === 'year') {
1114
+ reactData.datePanelType = 'month';
1115
+ dateCheckMonth(date);
1116
+ }
1117
+ else {
1118
+ dateChange(date);
1119
+ if (!multiple) {
1120
+ hidePanel();
1121
+ }
1122
+ }
1123
+ }
1124
+ else if (type === 'year') {
1125
+ dateChange(date);
1126
+ if (!multiple) {
1127
+ hidePanel();
1128
+ }
1129
+ }
1130
+ else if (type === 'quarter') {
1131
+ if (datePanelType === 'year') {
1132
+ reactData.datePanelType = 'quarter';
1133
+ dateCheckMonth(date);
1134
+ }
1135
+ else {
1136
+ dateChange(date);
1137
+ if (!multiple) {
1138
+ hidePanel();
1139
+ }
1140
+ }
1141
+ }
1142
+ else {
1143
+ if (datePanelType === 'month') {
1144
+ reactData.datePanelType = type === 'week' ? type : 'day';
1145
+ dateCheckMonth(date);
1146
+ }
1147
+ else if (datePanelType === 'year') {
1148
+ reactData.datePanelType = 'month';
1149
+ dateCheckMonth(date);
1150
+ }
1151
+ else {
1152
+ dateChange(date);
1153
+ if (type === 'datetime') {
1154
+ // 日期带时间
1155
+ }
1156
+ else {
1157
+ if (!multiple) {
1158
+ hidePanel();
1159
+ }
1160
+ }
1161
+ }
1162
+ }
1163
+ };
1164
+ const dateSelectEvent = (item) => {
1165
+ if (!isDateDisabled(item)) {
1166
+ dateSelectItem(item.date);
1167
+ }
1168
+ };
1169
+ const dateMoveDay = (offsetDay) => {
1170
+ if (!isDateDisabled({ date: offsetDay })) {
1171
+ const dayList = computeDayList.value;
1172
+ if (!dayList.some((item) => XEUtils.isDateSame(item.date, offsetDay, 'yyyyMMdd'))) {
1173
+ dateCheckMonth(offsetDay);
1174
+ }
1175
+ dateParseValue(offsetDay);
1176
+ }
1177
+ };
1178
+ const dateMoveYear = (offsetYear) => {
1179
+ if (!isDateDisabled({ date: offsetYear })) {
1180
+ const yearList = computeYearList.value;
1181
+ if (!yearList.some((item) => XEUtils.isDateSame(item.date, offsetYear, 'yyyy'))) {
1182
+ dateCheckMonth(offsetYear);
1183
+ }
1184
+ dateParseValue(offsetYear);
1185
+ }
1186
+ };
1187
+ const dateMoveQuarter = (offsetQuarter) => {
1188
+ if (!isDateDisabled({ date: offsetQuarter })) {
1189
+ const quarterList = computeQuarterList.value;
1190
+ if (!quarterList.some((item) => XEUtils.isDateSame(item.date, offsetQuarter, 'yyyyq'))) {
1191
+ dateCheckMonth(offsetQuarter);
1192
+ }
1193
+ dateParseValue(offsetQuarter);
1194
+ }
1195
+ };
1196
+ const dateMoveMonth = (offsetMonth) => {
1197
+ if (!isDateDisabled({ date: offsetMonth })) {
1198
+ const monthList = computeMonthList.value;
1199
+ if (!monthList.some((item) => XEUtils.isDateSame(item.date, offsetMonth, 'yyyyMM'))) {
1200
+ dateCheckMonth(offsetMonth);
1201
+ }
1202
+ dateParseValue(offsetMonth);
1203
+ }
1204
+ };
1205
+ const dateMouseenterEvent = (item) => {
1206
+ if (!isDateDisabled(item)) {
1207
+ const { datePanelType } = reactData;
1208
+ if (datePanelType === 'month') {
1209
+ dateMoveMonth(item.date);
1210
+ }
1211
+ else if (datePanelType === 'quarter') {
1212
+ dateMoveQuarter(item.date);
1213
+ }
1214
+ else if (datePanelType === 'year') {
1215
+ dateMoveYear(item.date);
1216
+ }
1217
+ else {
1218
+ dateMoveDay(item.date);
1219
+ }
1220
+ }
1221
+ };
1222
+ const updateTimePos = (liElem) => {
1223
+ if (liElem) {
1224
+ const height = liElem.offsetHeight;
1225
+ const ulElem = liElem.parentNode;
1226
+ ulElem.scrollTop = liElem.offsetTop - height * 4;
1227
+ }
1228
+ };
1229
+ const dateTimeChangeEvent = (evnt) => {
1230
+ reactData.datetimePanelValue = new Date(reactData.datetimePanelValue.getTime());
1231
+ updateTimePos(evnt.currentTarget);
1232
+ };
1233
+ const dateHourEvent = (evnt, item) => {
1234
+ reactData.datetimePanelValue.setHours(item.value);
1235
+ dateTimeChangeEvent(evnt);
1236
+ };
1237
+ const dateConfirmEvent = () => {
1238
+ const { multiple } = props;
1239
+ const { datetimePanelValue } = reactData;
1240
+ const dateValue = computeDateValue.value;
1241
+ const isDateTimeType = computeIsDateTimeType.value;
1242
+ if (isDateTimeType) {
1243
+ const dateValueFormat = computeDateValueFormat.value;
1244
+ if (multiple) {
1245
+ // 如果为多选
1246
+ const dateMultipleValue = computeDateMultipleValue.value;
1247
+ if (isDateTimeType) {
1248
+ // 如果是datetime特殊类型
1249
+ const dateListValue = [...computeDateListValue.value];
1250
+ const datetimeRest = [];
1251
+ dateListValue.forEach(item => {
1252
+ if (item) {
1253
+ item.setHours(datetimePanelValue.getHours());
1254
+ item.setMinutes(datetimePanelValue.getMinutes());
1255
+ item.setSeconds(datetimePanelValue.getSeconds());
1256
+ datetimeRest.push(item);
1257
+ }
1258
+ });
1259
+ emitModel(datetimeRest.map(date => XEUtils.toDateString(date, dateValueFormat)).join(','), { type: 'update' });
1260
+ }
1261
+ else {
1262
+ // 如果是日期类型
1263
+ emitModel(dateMultipleValue.join(','), { type: 'update' });
1264
+ }
1265
+ }
1266
+ else {
1267
+ dateChange(dateValue || reactData.currentDate);
1268
+ }
1269
+ }
1270
+ hidePanel();
1271
+ };
1272
+ const dateMinuteEvent = (evnt, item) => {
1273
+ reactData.datetimePanelValue.setMinutes(item.value);
1274
+ dateTimeChangeEvent(evnt);
1275
+ };
1276
+ const dateSecondEvent = (evnt, item) => {
1277
+ reactData.datetimePanelValue.setSeconds(item.value);
1278
+ dateTimeChangeEvent(evnt);
1279
+ };
1280
+ const dateOffsetEvent = (evnt) => {
1281
+ const { isActivated, datePanelValue, datePanelType } = reactData;
1282
+ if (isActivated) {
1283
+ evnt.preventDefault();
1284
+ const isLeftArrow = hasEventKey(evnt, EVENT_KEYS.ARROW_LEFT);
1285
+ const isUpArrow = hasEventKey(evnt, EVENT_KEYS.ARROW_UP);
1286
+ const isRightArrow = hasEventKey(evnt, EVENT_KEYS.ARROW_RIGHT);
1287
+ const isDwArrow = hasEventKey(evnt, EVENT_KEYS.ARROW_DOWN);
1288
+ if (datePanelType === 'year') {
1289
+ let offsetYear = XEUtils.getWhatYear(datePanelValue || Date.now(), 0, 'first');
1290
+ if (isLeftArrow) {
1291
+ offsetYear = XEUtils.getWhatYear(offsetYear, -1);
1292
+ }
1293
+ else if (isUpArrow) {
1294
+ offsetYear = XEUtils.getWhatYear(offsetYear, -4);
1295
+ }
1296
+ else if (isRightArrow) {
1297
+ offsetYear = XEUtils.getWhatYear(offsetYear, 1);
1298
+ }
1299
+ else if (isDwArrow) {
1300
+ offsetYear = XEUtils.getWhatYear(offsetYear, 4);
1301
+ }
1302
+ dateMoveYear(offsetYear);
1303
+ }
1304
+ else if (datePanelType === 'quarter') {
1305
+ let offsetQuarter = XEUtils.getWhatQuarter(datePanelValue || Date.now(), 0, 'first');
1306
+ if (isLeftArrow) {
1307
+ offsetQuarter = XEUtils.getWhatQuarter(offsetQuarter, -1);
1308
+ }
1309
+ else if (isUpArrow) {
1310
+ offsetQuarter = XEUtils.getWhatQuarter(offsetQuarter, -2);
1311
+ }
1312
+ else if (isRightArrow) {
1313
+ offsetQuarter = XEUtils.getWhatQuarter(offsetQuarter, 1);
1314
+ }
1315
+ else if (isDwArrow) {
1316
+ offsetQuarter = XEUtils.getWhatQuarter(offsetQuarter, 2);
1317
+ }
1318
+ dateMoveQuarter(offsetQuarter);
1319
+ }
1320
+ else if (datePanelType === 'month') {
1321
+ let offsetMonth = XEUtils.getWhatMonth(datePanelValue || Date.now(), 0, 'first');
1322
+ if (isLeftArrow) {
1323
+ offsetMonth = XEUtils.getWhatMonth(offsetMonth, -1);
1324
+ }
1325
+ else if (isUpArrow) {
1326
+ offsetMonth = XEUtils.getWhatMonth(offsetMonth, -4);
1327
+ }
1328
+ else if (isRightArrow) {
1329
+ offsetMonth = XEUtils.getWhatMonth(offsetMonth, 1);
1330
+ }
1331
+ else if (isDwArrow) {
1332
+ offsetMonth = XEUtils.getWhatMonth(offsetMonth, 4);
1333
+ }
1334
+ dateMoveMonth(offsetMonth);
1335
+ }
1336
+ else {
1337
+ let offsetDay = datePanelValue || XEUtils.getWhatDay(Date.now(), 0, 'first');
1338
+ const firstDayOfWeek = computeFirstDayOfWeek.value;
1339
+ if (isLeftArrow) {
1340
+ offsetDay = XEUtils.getWhatDay(offsetDay, -1);
1341
+ }
1342
+ else if (isUpArrow) {
1343
+ offsetDay = XEUtils.getWhatWeek(offsetDay, -1, firstDayOfWeek);
1344
+ }
1345
+ else if (isRightArrow) {
1346
+ offsetDay = XEUtils.getWhatDay(offsetDay, 1);
1347
+ }
1348
+ else if (isDwArrow) {
1349
+ offsetDay = XEUtils.getWhatWeek(offsetDay, 1, firstDayOfWeek);
1350
+ }
1351
+ dateMoveDay(offsetDay);
1352
+ }
1353
+ }
1354
+ };
1355
+ const datePgOffsetEvent = (evnt) => {
1356
+ const { isActivated } = reactData;
1357
+ if (isActivated) {
1358
+ const isPgUp = hasEventKey(evnt, EVENT_KEYS.PAGE_UP);
1359
+ evnt.preventDefault();
1360
+ if (isPgUp) {
1361
+ datePrevEvent(evnt);
1362
+ }
1363
+ else {
1364
+ dateNextEvent(evnt);
1365
+ }
1366
+ }
1367
+ };
1368
+ const dateOpenPanel = () => {
1369
+ const { type } = props;
1370
+ const isDateTimeType = computeIsDateTimeType.value;
1371
+ const dateValue = computeDateValue.value;
1372
+ if (['year', 'quarter', 'month', 'week'].indexOf(type) > -1) {
1373
+ reactData.datePanelType = type;
1374
+ }
1375
+ else {
1376
+ reactData.datePanelType = 'day';
1377
+ }
1378
+ reactData.currentDate = XEUtils.getWhatDay(Date.now(), 0, 'first');
1379
+ if (dateValue) {
1380
+ dateMonthHandle(dateValue, 0);
1381
+ dateParseValue(dateValue);
1382
+ }
1383
+ else {
1384
+ dateNowHandle();
1385
+ }
1386
+ if (isDateTimeType) {
1387
+ reactData.datetimePanelValue = reactData.datePanelValue || XEUtils.getWhatDay(Date.now(), 0, 'first');
1388
+ nextTick(() => {
1389
+ const timeBodyElem = refInputTimeBody.value;
1390
+ XEUtils.arrayEach(timeBodyElem.querySelectorAll('li.is--selected'), updateTimePos);
1391
+ });
1392
+ }
1393
+ };
1394
+ // 日期
1395
+ // 弹出面板
1396
+ const updateZindex = () => {
1397
+ if (reactData.panelIndex < getLastZIndex()) {
1398
+ reactData.panelIndex = nextZIndex();
1399
+ }
1400
+ };
1401
+ const updatePlacement = () => {
1402
+ return nextTick().then(() => {
1403
+ const { transfer, placement } = props;
1404
+ const { panelIndex } = reactData;
1405
+ const targetElem = refInputTarget.value;
1406
+ const panelElem = refInputPanel.value;
1407
+ if (targetElem && panelElem) {
1408
+ const targetHeight = targetElem.offsetHeight;
1409
+ const targetWidth = targetElem.offsetWidth;
1410
+ const panelHeight = panelElem.offsetHeight;
1411
+ const panelWidth = panelElem.offsetWidth;
1412
+ const marginSize = 5;
1413
+ const panelStyle = {
1414
+ zIndex: panelIndex
1415
+ };
1416
+ const { boundingTop, boundingLeft, visibleHeight, visibleWidth } = getAbsolutePos(targetElem);
1417
+ let panelPlacement = 'bottom';
1418
+ console.log(getAbsolutePos(targetElem));
1419
+ if (transfer) {
1420
+ let left = boundingLeft;
1421
+ let top = boundingTop + targetHeight;
1422
+ if (placement === 'top') {
1423
+ panelPlacement = 'top';
1424
+ top = boundingTop - panelHeight;
1425
+ }
1426
+ else if (!placement) {
1427
+ // 如果下面不够放,则向上
1428
+ if (top + panelHeight + marginSize > visibleHeight) {
1429
+ panelPlacement = 'top';
1430
+ top = boundingTop - panelHeight;
1431
+ }
1432
+ // 如果上面不够放,则向下(优先)
1433
+ if (top < marginSize) {
1434
+ panelPlacement = 'bottom';
1435
+ top = boundingTop + targetHeight;
1436
+ }
1437
+ }
1438
+ // 如果溢出右边
1439
+ if (left + panelWidth + marginSize > visibleWidth) {
1440
+ left -= left + panelWidth + marginSize - visibleWidth;
1441
+ }
1442
+ // 如果溢出左边
1443
+ if (left < marginSize) {
1444
+ left = marginSize;
1445
+ }
1446
+ Object.assign(panelStyle, {
1447
+ left: `${left}px`,
1448
+ top: `${top}px`,
1449
+ minWidth: `${targetWidth}px`
1450
+ });
1451
+ }
1452
+ else {
1453
+ if (placement === 'top') {
1454
+ panelPlacement = 'top';
1455
+ panelStyle.bottom = `${targetHeight}px`;
1456
+ }
1457
+ else if (!placement) {
1458
+ // 如果下面不够放,则向上
1459
+ if (boundingTop + targetHeight + panelHeight > visibleHeight) {
1460
+ // 如果上面不够放,则向下(优先)
1461
+ if (boundingTop - targetHeight - panelHeight > marginSize) {
1462
+ panelPlacement = 'top';
1463
+ panelStyle.bottom = `${targetHeight}px`;
1464
+ }
1465
+ }
1466
+ }
1467
+ }
1468
+ reactData.panelStyle = panelStyle;
1469
+ reactData.panelPlacement = panelPlacement;
1470
+ return nextTick();
1471
+ }
1472
+ });
1473
+ };
1474
+ const showPanel = () => {
1475
+ const { disabled } = props;
1476
+ const { visiblePanel } = reactData;
1477
+ const isDatePickerType = computeIsDatePickerType.value;
1478
+ if (!disabled && !visiblePanel) {
1479
+ if (!reactData.inited) {
1480
+ reactData.inited = true;
1481
+ }
1482
+ clearTimeout(hidePanelTimeout);
1483
+ reactData.isActivated = true;
1484
+ reactData.animatVisible = true;
1485
+ if (isDatePickerType) {
1486
+ dateOpenPanel();
1487
+ }
1488
+ setTimeout(() => {
1489
+ reactData.visiblePanel = true;
1490
+ }, 10);
1491
+ updateZindex();
1492
+ return updatePlacement();
1493
+ }
1494
+ return nextTick();
1495
+ };
1496
+ const datePickerOpenEvent = (evnt) => {
1497
+ const { readonly } = props;
1498
+ if (!readonly) {
1499
+ evnt.preventDefault();
1500
+ showPanel();
1501
+ }
1502
+ };
1503
+ const clickEvent = (evnt) => {
1504
+ triggerEvent(evnt);
1505
+ };
1506
+ // 弹出面板
1507
+ // 全局事件
1508
+ const handleGlobalMousedownEvent = (evnt) => {
1509
+ const { disabled } = props;
1510
+ const { visiblePanel, isActivated } = reactData;
1511
+ const isDatePickerType = computeIsDatePickerType.value;
1512
+ const el = refElem.value;
1513
+ const panelElem = refInputPanel.value;
1514
+ if (!disabled && isActivated) {
1515
+ reactData.isActivated = getEventTargetNode(evnt, el).flag || getEventTargetNode(evnt, panelElem).flag;
1516
+ if (!reactData.isActivated) {
1517
+ // 如果是日期类型
1518
+ if (isDatePickerType) {
1519
+ if (visiblePanel) {
1520
+ hidePanel();
1521
+ afterCheckValue();
1522
+ }
1523
+ }
1524
+ else {
1525
+ afterCheckValue();
1526
+ }
1527
+ }
1528
+ }
1529
+ };
1530
+ const handleGlobalKeydownEvent = (evnt) => {
1531
+ const { clearable, disabled } = props;
1532
+ const { visiblePanel } = reactData;
1533
+ const isDatePickerType = computeIsDatePickerType.value;
1534
+ if (!disabled) {
1535
+ const isTab = hasEventKey(evnt, EVENT_KEYS.TAB);
1536
+ const isDel = hasEventKey(evnt, EVENT_KEYS.DELETE);
1537
+ const isEsc = hasEventKey(evnt, EVENT_KEYS.ESCAPE);
1538
+ const isEnter = hasEventKey(evnt, EVENT_KEYS.ENTER);
1539
+ const isLeftArrow = hasEventKey(evnt, EVENT_KEYS.ARROW_LEFT);
1540
+ const isUpArrow = hasEventKey(evnt, EVENT_KEYS.ARROW_UP);
1541
+ const isRightArrow = hasEventKey(evnt, EVENT_KEYS.ARROW_RIGHT);
1542
+ const isDwArrow = hasEventKey(evnt, EVENT_KEYS.ARROW_DOWN);
1543
+ const isPgUp = hasEventKey(evnt, EVENT_KEYS.PAGE_UP);
1544
+ const isPgDn = hasEventKey(evnt, EVENT_KEYS.PAGE_DOWN);
1545
+ const operArrow = isLeftArrow || isUpArrow || isRightArrow || isDwArrow;
1546
+ let isActivated = reactData.isActivated;
1547
+ if (isTab) {
1548
+ if (isActivated) {
1549
+ afterCheckValue();
1550
+ }
1551
+ isActivated = false;
1552
+ reactData.isActivated = isActivated;
1553
+ }
1554
+ else if (operArrow) {
1555
+ if (isDatePickerType) {
1556
+ if (isActivated) {
1557
+ if (visiblePanel) {
1558
+ dateOffsetEvent(evnt);
1559
+ }
1560
+ else if (isUpArrow || isDwArrow) {
1561
+ datePickerOpenEvent(evnt);
1562
+ }
1563
+ }
1564
+ }
1565
+ }
1566
+ else if (isEnter) {
1567
+ if (isDatePickerType) {
1568
+ if (visiblePanel) {
1569
+ if (reactData.datePanelValue) {
1570
+ dateSelectItem(reactData.datePanelValue);
1571
+ }
1572
+ else {
1573
+ hidePanel();
1574
+ }
1575
+ }
1576
+ else if (isActivated) {
1577
+ datePickerOpenEvent(evnt);
1578
+ }
1579
+ }
1580
+ }
1581
+ else if (isPgUp || isPgDn) {
1582
+ if (isDatePickerType) {
1583
+ if (isActivated) {
1584
+ datePgOffsetEvent(evnt);
1585
+ }
1586
+ }
1587
+ }
1588
+ if (isTab || isEsc) {
1589
+ if (visiblePanel) {
1590
+ hidePanel();
1591
+ }
1592
+ }
1593
+ else if (isDel && clearable) {
1594
+ if (isActivated) {
1595
+ clearValueEvent(evnt, null);
1596
+ }
1597
+ }
1598
+ }
1599
+ };
1600
+ const handleGlobalMousewheelEvent = (evnt) => {
1601
+ const { disabled } = props;
1602
+ const { visiblePanel } = reactData;
1603
+ if (!disabled) {
1604
+ if (visiblePanel) {
1605
+ const panelElem = refInputPanel.value;
1606
+ if (getEventTargetNode(evnt, panelElem).flag) {
1607
+ updatePlacement();
1608
+ }
1609
+ else {
1610
+ hidePanel();
1611
+ afterCheckValue();
1612
+ }
1613
+ }
1614
+ }
1615
+ };
1616
+ const handleGlobalBlurEvent = () => {
1617
+ const { isActivated, visiblePanel } = reactData;
1618
+ if (visiblePanel) {
1619
+ hidePanel();
1620
+ afterCheckValue();
1621
+ }
1622
+ else if (isActivated) {
1623
+ afterCheckValue();
1624
+ }
1625
+ };
1626
+ const renderDateLabel = (item, label) => {
1627
+ const { festivalMethod } = props;
1628
+ if (festivalMethod) {
1629
+ const { datePanelType } = reactData;
1630
+ const festivalRest = festivalMethod({ type: datePanelType, viewType: datePanelType, date: item.date, $input: $xeinput });
1631
+ const festivalItem = festivalRest ? (XEUtils.isString(festivalRest) ? { label: festivalRest } : festivalRest) : {};
1632
+ const extraItem = festivalItem.extra ? (XEUtils.isString(festivalItem.extra) ? { label: festivalItem.extra } : festivalItem.extra) : null;
1633
+ const labels = [
1634
+ h('span', {
1635
+ class: ['vxe-input--date-label', {
1636
+ 'is-notice': festivalItem.notice
1637
+ }]
1638
+ }, extraItem && extraItem.label
1639
+ ? [
1640
+ h('span', label),
1641
+ h('span', {
1642
+ class: ['vxe-input--date-label--extra', extraItem.important ? 'is-important' : '', extraItem.className],
1643
+ style: extraItem.style
1644
+ }, XEUtils.toValueString(extraItem.label))
1645
+ ]
1646
+ : label)
1647
+ ];
1648
+ const festivalLabel = festivalItem.label;
1649
+ if (festivalLabel) {
1650
+ // 默认最多支持3个节日重叠
1651
+ const festivalLabels = XEUtils.toValueString(festivalLabel).split(',');
1652
+ labels.push(h('span', {
1653
+ class: ['vxe-input--date-festival', festivalItem.important ? 'is-important' : '', festivalItem.className],
1654
+ style: festivalItem.style
1655
+ }, [
1656
+ festivalLabels.length > 1
1657
+ ? h('span', {
1658
+ class: ['vxe-input--date-festival--overlap', `overlap--${festivalLabels.length}`]
1659
+ }, festivalLabels.map(label => h('span', label.substring(0, 3))))
1660
+ : h('span', {
1661
+ class: 'vxe-input--date-festival--label'
1662
+ }, festivalLabels[0].substring(0, 3))
1663
+ ]));
1664
+ }
1665
+ return labels;
1666
+ }
1667
+ return label;
1668
+ };
1669
+ const renderDateDayTable = () => {
1670
+ const { multiple } = props;
1671
+ const { datePanelType, datePanelValue } = reactData;
1672
+ const dateValue = computeDateValue.value;
1673
+ const dateHeaders = computeDateHeaders.value;
1674
+ const dayDatas = computeDayDatas.value;
1675
+ const dateListValue = computeDateListValue.value;
1676
+ const matchFormat = 'yyyyMMdd';
1677
+ return [
1678
+ h('table', {
1679
+ class: `vxe-input--date-${datePanelType}-view`,
1680
+ cellspacing: 0,
1681
+ cellpadding: 0,
1682
+ border: 0
1683
+ }, [
1684
+ h('thead', [
1685
+ h('tr', dateHeaders.map((item) => {
1686
+ return h('th', item.label);
1687
+ }))
1688
+ ]),
1689
+ h('tbody', dayDatas.map((rows) => {
1690
+ return h('tr', rows.map((item) => {
1691
+ return h('td', {
1692
+ class: {
1693
+ 'is--prev': item.isPrev,
1694
+ 'is--current': item.isCurrent,
1695
+ 'is--now': item.isNow,
1696
+ 'is--next': item.isNext,
1697
+ 'is--disabled': isDateDisabled(item),
1698
+ 'is--selected': multiple ? dateListValue.some(val => XEUtils.isDateSame(val, item.date, matchFormat)) : XEUtils.isDateSame(dateValue, item.date, matchFormat),
1699
+ 'is--hover': XEUtils.isDateSame(datePanelValue, item.date, matchFormat)
1700
+ },
1701
+ onClick: () => dateSelectEvent(item),
1702
+ onMouseenter: () => dateMouseenterEvent(item)
1703
+ }, renderDateLabel(item, item.label));
1704
+ }));
1705
+ }))
1706
+ ])
1707
+ ];
1708
+ };
1709
+ const renderDateWeekTable = () => {
1710
+ const { multiple } = props;
1711
+ const { datePanelType, datePanelValue } = reactData;
1712
+ const dateValue = computeDateValue.value;
1713
+ const weekHeaders = computeWeekHeaders.value;
1714
+ const weekDates = computeWeekDates.value;
1715
+ const dateListValue = computeDateListValue.value;
1716
+ const matchFormat = 'yyyyMMdd';
1717
+ return [
1718
+ h('table', {
1719
+ class: `vxe-input--date-${datePanelType}-view`,
1720
+ cellspacing: 0,
1721
+ cellpadding: 0,
1722
+ border: 0
1723
+ }, [
1724
+ h('thead', [
1725
+ h('tr', weekHeaders.map((item) => {
1726
+ return h('th', item.label);
1727
+ }))
1728
+ ]),
1729
+ h('tbody', weekDates.map((rows) => {
1730
+ const isSelected = multiple ? rows.some((item) => dateListValue.some(val => XEUtils.isDateSame(val, item.date, matchFormat))) : rows.some((item) => XEUtils.isDateSame(dateValue, item.date, matchFormat));
1731
+ const isHover = rows.some((item) => XEUtils.isDateSame(datePanelValue, item.date, matchFormat));
1732
+ return h('tr', rows.map((item) => {
1733
+ return h('td', {
1734
+ class: {
1735
+ 'is--prev': item.isPrev,
1736
+ 'is--current': item.isCurrent,
1737
+ 'is--now': item.isNow,
1738
+ 'is--next': item.isNext,
1739
+ 'is--disabled': isDateDisabled(item),
1740
+ 'is--selected': isSelected,
1741
+ 'is--hover': isHover
1742
+ },
1743
+ // event
1744
+ onClick: () => dateSelectEvent(item),
1745
+ onMouseenter: () => dateMouseenterEvent(item)
1746
+ }, renderDateLabel(item, item.label));
1747
+ }));
1748
+ }))
1749
+ ])
1750
+ ];
1751
+ };
1752
+ const renderDateMonthTable = () => {
1753
+ const { multiple } = props;
1754
+ const { datePanelType, datePanelValue } = reactData;
1755
+ const dateValue = computeDateValue.value;
1756
+ const monthDatas = computeMonthDatas.value;
1757
+ const dateListValue = computeDateListValue.value;
1758
+ const matchFormat = 'yyyyMM';
1759
+ return [
1760
+ h('table', {
1761
+ class: `vxe-input--date-${datePanelType}-view`,
1762
+ cellspacing: 0,
1763
+ cellpadding: 0,
1764
+ border: 0
1765
+ }, [
1766
+ h('tbody', monthDatas.map((rows) => {
1767
+ return h('tr', rows.map((item) => {
1768
+ return h('td', {
1769
+ class: {
1770
+ 'is--prev': item.isPrev,
1771
+ 'is--current': item.isCurrent,
1772
+ 'is--now': item.isNow,
1773
+ 'is--next': item.isNext,
1774
+ 'is--disabled': isDateDisabled(item),
1775
+ 'is--selected': multiple ? dateListValue.some(val => XEUtils.isDateSame(val, item.date, matchFormat)) : XEUtils.isDateSame(dateValue, item.date, matchFormat),
1776
+ 'is--hover': XEUtils.isDateSame(datePanelValue, item.date, matchFormat)
1777
+ },
1778
+ onClick: () => dateSelectEvent(item),
1779
+ onMouseenter: () => dateMouseenterEvent(item)
1780
+ }, renderDateLabel(item, getI18n(`vxe.input.date.months.m${item.month}`)));
1781
+ }));
1782
+ }))
1783
+ ])
1784
+ ];
1785
+ };
1786
+ const renderDateQuarterTable = () => {
1787
+ const { multiple } = props;
1788
+ const { datePanelType, datePanelValue } = reactData;
1789
+ const dateValue = computeDateValue.value;
1790
+ const quarterDatas = computeQuarterDatas.value;
1791
+ const dateListValue = computeDateListValue.value;
1792
+ const matchFormat = 'yyyyq';
1793
+ return [
1794
+ h('table', {
1795
+ class: `vxe-input--date-${datePanelType}-view`,
1796
+ cellspacing: 0,
1797
+ cellpadding: 0,
1798
+ border: 0
1799
+ }, [
1800
+ h('tbody', quarterDatas.map((rows) => {
1801
+ return h('tr', rows.map((item) => {
1802
+ return h('td', {
1803
+ class: {
1804
+ 'is--prev': item.isPrev,
1805
+ 'is--current': item.isCurrent,
1806
+ 'is--now': item.isNow,
1807
+ 'is--next': item.isNext,
1808
+ 'is--disabled': isDateDisabled(item),
1809
+ 'is--selected': multiple ? dateListValue.some(val => XEUtils.isDateSame(val, item.date, matchFormat)) : XEUtils.isDateSame(dateValue, item.date, matchFormat),
1810
+ 'is--hover': XEUtils.isDateSame(datePanelValue, item.date, matchFormat)
1811
+ },
1812
+ onClick: () => dateSelectEvent(item),
1813
+ onMouseenter: () => dateMouseenterEvent(item)
1814
+ }, renderDateLabel(item, getI18n(`vxe.input.date.quarters.q${item.quarter}`)));
1815
+ }));
1816
+ }))
1817
+ ])
1818
+ ];
1819
+ };
1820
+ const renderDateYearTable = () => {
1821
+ const { multiple } = props;
1822
+ const { datePanelType, datePanelValue } = reactData;
1823
+ const dateValue = computeDateValue.value;
1824
+ const yearDatas = computeYearDatas.value;
1825
+ const dateListValue = computeDateListValue.value;
1826
+ const matchFormat = 'yyyy';
1827
+ return [
1828
+ h('table', {
1829
+ class: `vxe-input--date-${datePanelType}-view`,
1830
+ cellspacing: 0,
1831
+ cellpadding: 0,
1832
+ border: 0
1833
+ }, [
1834
+ h('tbody', yearDatas.map((rows) => {
1835
+ return h('tr', rows.map((item) => {
1836
+ return h('td', {
1837
+ class: {
1838
+ 'is--prev': item.isPrev,
1839
+ 'is--current': item.isCurrent,
1840
+ 'is--now': item.isNow,
1841
+ 'is--next': item.isNext,
1842
+ 'is--disabled': isDateDisabled(item),
1843
+ 'is--selected': multiple ? dateListValue.some(val => XEUtils.isDateSame(val, item.date, matchFormat)) : XEUtils.isDateSame(dateValue, item.date, matchFormat),
1844
+ 'is--hover': XEUtils.isDateSame(datePanelValue, item.date, matchFormat)
1845
+ },
1846
+ onClick: () => dateSelectEvent(item),
1847
+ onMouseenter: () => dateMouseenterEvent(item)
1848
+ }, renderDateLabel(item, item.year));
1849
+ }));
1850
+ }))
1851
+ ])
1852
+ ];
1853
+ };
1854
+ const renderDateTable = () => {
1855
+ const { datePanelType } = reactData;
1856
+ switch (datePanelType) {
1857
+ case 'week':
1858
+ return renderDateWeekTable();
1859
+ case 'month':
1860
+ return renderDateMonthTable();
1861
+ case 'quarter':
1862
+ return renderDateQuarterTable();
1863
+ case 'year':
1864
+ return renderDateYearTable();
1865
+ }
1866
+ return renderDateDayTable();
1867
+ };
1868
+ const renderDatePanel = () => {
1869
+ const { multiple } = props;
1870
+ const { datePanelType } = reactData;
1871
+ const isDisabledPrevDateBtn = computeIsDisabledPrevDateBtn.value;
1872
+ const isDisabledNextDateBtn = computeIsDisabledNextDateBtn.value;
1873
+ const selectDatePanelLabel = computeSelectDatePanelLabel.value;
1874
+ return [
1875
+ h('div', {
1876
+ class: 'vxe-input--date-picker-header'
1877
+ }, [
1878
+ h('div', {
1879
+ class: 'vxe-input--date-picker-type-wrapper'
1880
+ }, [
1881
+ datePanelType === 'year'
1882
+ ? h('span', {
1883
+ class: 'vxe-input--date-picker-label'
1884
+ }, selectDatePanelLabel)
1885
+ : h('span', {
1886
+ class: 'vxe-input--date-picker-btn',
1887
+ onClick: dateToggleTypeEvent
1888
+ }, selectDatePanelLabel)
1889
+ ]),
1890
+ h('div', {
1891
+ class: 'vxe-input--date-picker-btn-wrapper'
1892
+ }, [
1893
+ h('span', {
1894
+ class: ['vxe-input--date-picker-btn vxe-input--date-picker-prev-btn', {
1895
+ 'is--disabled': isDisabledPrevDateBtn
1896
+ }],
1897
+ onClick: datePrevEvent
1898
+ }, [
1899
+ h('i', {
1900
+ class: 'vxe-icon-caret-left'
1901
+ })
1902
+ ]),
1903
+ h('span', {
1904
+ class: 'vxe-input--date-picker-btn vxe-input--date-picker-current-btn',
1905
+ onClick: dateTodayMonthEvent
1906
+ }, [
1907
+ h('i', {
1908
+ class: 'vxe-icon-dot'
1909
+ })
1910
+ ]),
1911
+ h('span', {
1912
+ class: ['vxe-input--date-picker-btn vxe-input--date-picker-next-btn', {
1913
+ 'is--disabled': isDisabledNextDateBtn
1914
+ }],
1915
+ onClick: dateNextEvent
1916
+ }, [
1917
+ h('i', {
1918
+ class: 'vxe-icon-caret-right'
1919
+ })
1920
+ ]),
1921
+ multiple && computeSupportMultiples.value
1922
+ ? h('span', {
1923
+ class: 'vxe-input--date-picker-btn vxe-input--date-picker-confirm-btn'
1924
+ }, [
1925
+ h('button', {
1926
+ class: 'vxe-input--date-picker-confirm',
1927
+ type: 'button',
1928
+ onClick: dateConfirmEvent
1929
+ }, getI18n('vxe.button.confirm'))
1930
+ ])
1931
+ : null
1932
+ ])
1933
+ ]),
1934
+ h('div', {
1935
+ class: 'vxe-input--date-picker-body'
1936
+ }, renderDateTable())
1937
+ ];
1938
+ };
1939
+ const renderTimePanel = () => {
1940
+ const { datetimePanelValue } = reactData;
1941
+ const dateTimeLabel = computeDateTimeLabel.value;
1942
+ const hourList = computeHourList.value;
1943
+ const minuteList = computeMinuteList.value;
1944
+ const secondList = computeSecondList.value;
1945
+ return [
1946
+ h('div', {
1947
+ class: 'vxe-input--time-picker-header'
1948
+ }, [
1949
+ h('span', {
1950
+ class: 'vxe-input--time-picker-title'
1951
+ }, dateTimeLabel),
1952
+ h('button', {
1953
+ class: 'vxe-input--time-picker-confirm',
1954
+ type: 'button',
1955
+ onClick: dateConfirmEvent
1956
+ }, getI18n('vxe.button.confirm'))
1957
+ ]),
1958
+ h('div', {
1959
+ ref: refInputTimeBody,
1960
+ class: 'vxe-input--time-picker-body'
1961
+ }, [
1962
+ h('ul', {
1963
+ class: 'vxe-input--time-picker-hour-list'
1964
+ }, hourList.map((item, index) => {
1965
+ return h('li', {
1966
+ key: index,
1967
+ class: {
1968
+ 'is--selected': datetimePanelValue && datetimePanelValue.getHours() === item.value
1969
+ },
1970
+ onClick: (evnt) => dateHourEvent(evnt, item)
1971
+ }, item.label);
1972
+ })),
1973
+ h('ul', {
1974
+ class: 'vxe-input--time-picker-minute-list'
1975
+ }, minuteList.map((item, index) => {
1976
+ return h('li', {
1977
+ key: index,
1978
+ class: {
1979
+ 'is--selected': datetimePanelValue && datetimePanelValue.getMinutes() === item.value
1980
+ },
1981
+ onClick: (evnt) => dateMinuteEvent(evnt, item)
1982
+ }, item.label);
1983
+ })),
1984
+ h('ul', {
1985
+ class: 'vxe-input--time-picker-second-list'
1986
+ }, secondList.map((item, index) => {
1987
+ return h('li', {
1988
+ key: index,
1989
+ class: {
1990
+ 'is--selected': datetimePanelValue && datetimePanelValue.getSeconds() === item.value
1991
+ },
1992
+ onClick: (evnt) => dateSecondEvent(evnt, item)
1993
+ }, item.label);
1994
+ }))
1995
+ ])
1996
+ ];
1997
+ };
1998
+ const renderPanel = () => {
1999
+ const { type, transfer } = props;
2000
+ const { inited, animatVisible, visiblePanel, panelPlacement, panelStyle } = reactData;
2001
+ const vSize = computeSize.value;
2002
+ const isDatePickerType = computeIsDatePickerType.value;
2003
+ const renders = [];
2004
+ if (isDatePickerType) {
2005
+ if (type === 'datetime') {
2006
+ renders.push(h('div', {
2007
+ class: 'vxe-input--panel-layout-wrapper'
2008
+ }, [
2009
+ h('div', {
2010
+ class: 'vxe-input--panel-left-wrapper'
2011
+ }, renderDatePanel()),
2012
+ h('div', {
2013
+ class: 'vxe-input--panel-right-wrapper'
2014
+ }, renderTimePanel())
2015
+ ]));
2016
+ }
2017
+ else if (type === 'time') {
2018
+ renders.push(h('div', {
2019
+ class: 'vxe-input--panel-wrapper'
2020
+ }, renderTimePanel()));
2021
+ }
2022
+ else {
2023
+ renders.push(h('div', {
2024
+ class: 'vxe-input--panel-wrapper'
2025
+ }, renderDatePanel()));
2026
+ }
2027
+ return h(Teleport, {
2028
+ to: 'body',
2029
+ disabled: transfer ? !inited : true
2030
+ }, [
2031
+ h('div', {
2032
+ ref: refInputPanel,
2033
+ class: ['vxe-table--ignore-clear vxe-input--panel', `type--${type}`, {
2034
+ [`size--${vSize}`]: vSize,
2035
+ 'is--transfer': transfer,
2036
+ 'animat--leave': animatVisible,
2037
+ 'animat--enter': visiblePanel
2038
+ }],
2039
+ placement: panelPlacement,
2040
+ style: panelStyle
2041
+ }, renders)
2042
+ ]);
2043
+ }
2044
+ return null;
2045
+ };
2046
+ const renderNumberIcon = () => {
2047
+ const isDisabledAddNumber = computeIsDisabledAddNumber.value;
2048
+ const isDisabledSubtractNumber = computeIsDisabledSubtractNumber.value;
2049
+ return h('span', {
2050
+ class: 'vxe-input--number-suffix'
2051
+ }, [
2052
+ h('span', {
2053
+ class: ['vxe-input--number-prev is--prev', {
2054
+ 'is--disabled': isDisabledAddNumber
2055
+ }],
2056
+ onMousedown: numberMousedownEvent,
2057
+ onMouseup: numberStopDown,
2058
+ onMouseleave: numberStopDown
2059
+ }, [
2060
+ h('i', {
2061
+ class: ['vxe-input--number-prev-icon', iconConfigStore.INPUT_PREV_NUM]
2062
+ })
2063
+ ]),
2064
+ h('span', {
2065
+ class: ['vxe-input--number-next is--next', {
2066
+ 'is--disabled': isDisabledSubtractNumber
2067
+ }],
2068
+ onMousedown: numberMousedownEvent,
2069
+ onMouseup: numberStopDown,
2070
+ onMouseleave: numberStopDown
2071
+ }, [
2072
+ h('i', {
2073
+ class: ['vxe-input--number-next-icon', iconConfigStore.INPUT_NEXT_NUM]
2074
+ })
2075
+ ])
2076
+ ]);
2077
+ };
2078
+ const renderDatePickerIcon = () => {
2079
+ return h('span', {
2080
+ class: 'vxe-input--date-picker-suffix',
2081
+ onClick: datePickerOpenEvent
2082
+ }, [
2083
+ h('i', {
2084
+ class: ['vxe-input--date-picker-icon', iconConfigStore.INPUT_DATE]
2085
+ })
2086
+ ]);
2087
+ };
2088
+ const renderSearchIcon = () => {
2089
+ return h('span', {
2090
+ class: 'vxe-input--search-suffix',
2091
+ onClick: searchEvent
2092
+ }, [
2093
+ h('i', {
2094
+ class: ['vxe-input--search-icon', iconConfigStore.INPUT_SEARCH]
2095
+ })
2096
+ ]);
2097
+ };
2098
+ const renderPasswordIcon = () => {
2099
+ const { showPwd } = reactData;
2100
+ return h('span', {
2101
+ class: 'vxe-input--password-suffix',
2102
+ onClick: passwordToggleEvent
2103
+ }, [
2104
+ h('i', {
2105
+ class: ['vxe-input--password-icon', showPwd ? iconConfigStore.INPUT_SHOW_PWD : iconConfigStore.INPUT_PWD]
2106
+ })
2107
+ ]);
2108
+ };
2109
+ const rendePrefixIcon = () => {
2110
+ const { prefixIcon } = props;
2111
+ const prefixSlot = slots.prefix;
2112
+ const icons = [];
2113
+ if (prefixSlot) {
2114
+ icons.push(h('span', {
2115
+ class: 'vxe-input--prefix-icon'
2116
+ }, prefixSlot({})));
2117
+ }
2118
+ else if (prefixIcon) {
2119
+ icons.push(h('i', {
2120
+ class: ['vxe-input--prefix-icon', prefixIcon]
2121
+ }));
2122
+ }
2123
+ return icons.length
2124
+ ? h('span', {
2125
+ class: 'vxe-input--prefix',
2126
+ onClick: clickPrefixEvent
2127
+ }, icons)
2128
+ : null;
2129
+ };
2130
+ const renderSuffixIcon = () => {
2131
+ const { disabled, suffixIcon } = props;
2132
+ const { inputValue } = reactData;
2133
+ const suffixSlot = slots.suffix;
2134
+ const isClearable = computeIsClearable.value;
2135
+ const icons = [];
2136
+ if (suffixSlot) {
2137
+ icons.push(h('span', {
2138
+ class: 'vxe-input--suffix-icon'
2139
+ }, suffixSlot({})));
2140
+ }
2141
+ else if (suffixIcon) {
2142
+ icons.push(h('i', {
2143
+ class: ['vxe-input--suffix-icon', suffixIcon]
2144
+ }));
2145
+ }
2146
+ if (isClearable) {
2147
+ icons.push(h('i', {
2148
+ class: ['vxe-input--clear-icon', iconConfigStore.INPUT_CLEAR]
2149
+ }));
2150
+ }
2151
+ return icons.length
2152
+ ? h('span', {
2153
+ class: ['vxe-input--suffix', {
2154
+ 'is--clear': isClearable && !disabled && !(inputValue === '' || XEUtils.eqNull(inputValue))
2155
+ }],
2156
+ onClick: clickSuffixEvent
2157
+ }, icons)
2158
+ : null;
2159
+ };
2160
+ const renderExtraSuffixIcon = () => {
2161
+ const { controls } = props;
2162
+ const isNumType = computeIsNumType.value;
2163
+ const isDatePickerType = computeIsDatePickerType.value;
2164
+ const isPawdType = computeIsPawdType.value;
2165
+ const isSearchType = computeIsSearchType.value;
2166
+ let icons;
2167
+ if (isPawdType) {
2168
+ icons = renderPasswordIcon();
2169
+ }
2170
+ else if (isNumType) {
2171
+ if (controls) {
2172
+ icons = renderNumberIcon();
2173
+ }
2174
+ }
2175
+ else if (isDatePickerType) {
2176
+ icons = renderDatePickerIcon();
2177
+ }
2178
+ else if (isSearchType) {
2179
+ icons = renderSearchIcon();
2180
+ }
2181
+ return icons
2182
+ ? h('span', {
2183
+ class: 'vxe-input--extra-suffix'
2184
+ }, [icons])
2185
+ : null;
2186
+ };
2187
+ inputMethods = {
2188
+ dispatchEvent(type, params, evnt) {
2189
+ emit(type, Object.assign({ $input: $xeinput, $event: evnt }, params));
2190
+ },
2191
+ focus() {
2192
+ const inputElem = refInputTarget.value;
2193
+ reactData.isActivated = true;
2194
+ inputElem.focus();
2195
+ return nextTick();
2196
+ },
2197
+ blur() {
2198
+ const inputElem = refInputTarget.value;
2199
+ inputElem.blur();
2200
+ reactData.isActivated = false;
2201
+ return nextTick();
2202
+ },
2203
+ select() {
2204
+ const inputElem = refInputTarget.value;
2205
+ inputElem.select();
2206
+ reactData.isActivated = false;
2207
+ return nextTick();
2208
+ },
2209
+ showPanel,
2210
+ hidePanel,
2211
+ updatePlacement
2212
+ };
2213
+ Object.assign($xeinput, inputMethods);
2214
+ watch(() => props.modelValue, (val) => {
2215
+ reactData.inputValue = val;
2216
+ changeValue();
2217
+ });
2218
+ watch(() => props.type, () => {
2219
+ // 切换类型是重置内置变量
2220
+ Object.assign(reactData, {
2221
+ inputValue: props.modelValue,
2222
+ datetimePanelValue: null,
2223
+ datePanelValue: null,
2224
+ datePanelLabel: '',
2225
+ datePanelType: 'day',
2226
+ selectMonth: null,
2227
+ currentDate: null
2228
+ });
2229
+ initValue();
2230
+ });
2231
+ watch(computeDateLabelFormat, () => {
2232
+ const isDatePickerType = computeIsDatePickerType.value;
2233
+ if (isDatePickerType) {
2234
+ dateParseValue(reactData.datePanelValue);
2235
+ reactData.inputValue = props.multiple ? computeDateMultipleLabel.value : reactData.datePanelLabel;
2236
+ }
2237
+ });
2238
+ nextTick(() => {
2239
+ GlobalEvent.on($xeinput, 'mousewheel', handleGlobalMousewheelEvent);
2240
+ GlobalEvent.on($xeinput, 'mousedown', handleGlobalMousedownEvent);
2241
+ GlobalEvent.on($xeinput, 'keydown', handleGlobalKeydownEvent);
2242
+ GlobalEvent.on($xeinput, 'blur', handleGlobalBlurEvent);
2243
+ });
2244
+ onUnmounted(() => {
2245
+ numberStopDown();
2246
+ GlobalEvent.off($xeinput, 'mousewheel');
2247
+ GlobalEvent.off($xeinput, 'mousedown');
2248
+ GlobalEvent.off($xeinput, 'keydown');
2249
+ GlobalEvent.off($xeinput, 'blur');
2250
+ });
2251
+ initValue();
2252
+ const renderVN = () => {
2253
+ const { className, controls, type, align, showWordCount, countMethod, name, disabled, readonly, autocomplete } = props;
2254
+ const { inputValue, visiblePanel, isActivated } = reactData;
2255
+ const vSize = computeSize.value;
2256
+ const isCountError = computeIsCountError.value;
2257
+ const inputCount = computeInputCount.value;
2258
+ const isDatePickerType = computeIsDatePickerType.value;
2259
+ const inpReadonly = computeInpReadonly.value;
2260
+ const inpMaxlength = computeInpMaxlength.value;
2261
+ const inputType = computeInputType.value;
2262
+ const inpPlaceholder = computeInpPlaceholder.value;
2263
+ const childs = [];
2264
+ const prefix = rendePrefixIcon();
2265
+ const suffix = renderSuffixIcon();
2266
+ // 前缀图标
2267
+ if (prefix) {
2268
+ childs.push(prefix);
2269
+ }
2270
+ // 输入框
2271
+ childs.push(h('input', {
2272
+ ref: refInputTarget,
2273
+ class: 'vxe-input--inner',
2274
+ value: inputValue,
2275
+ name,
2276
+ type: inputType,
2277
+ placeholder: inpPlaceholder,
2278
+ maxlength: inpMaxlength,
2279
+ readonly: inpReadonly,
2280
+ disabled,
2281
+ autocomplete,
2282
+ onKeydown: keydownEvent,
2283
+ onKeyup: keyupEvent,
2284
+ onWheel: wheelEvent,
2285
+ onClick: clickEvent,
2286
+ onInput: inputEvent,
2287
+ onChange: changeEvent,
2288
+ onFocus: focusEvent,
2289
+ onBlur: blurEvent
2290
+ }));
2291
+ // 后缀图标
2292
+ if (suffix) {
2293
+ childs.push(suffix);
2294
+ }
2295
+ // 特殊功能图标
2296
+ childs.push(renderExtraSuffixIcon());
2297
+ // 面板容器
2298
+ if (isDatePickerType) {
2299
+ childs.push(renderPanel());
2300
+ }
2301
+ let isWordCount = false;
2302
+ // 统计字数
2303
+ if (showWordCount && ['text', 'search'].includes(type)) {
2304
+ isWordCount = true;
2305
+ childs.push(h('span', {
2306
+ class: ['vxe-input--count', {
2307
+ 'is--error': isCountError
2308
+ }]
2309
+ }, countMethod ? `${countMethod({ value: inputValue })}` : `${inputCount}${inpMaxlength ? `/${inpMaxlength}` : ''}`));
2310
+ }
2311
+ return h('div', {
2312
+ ref: refElem,
2313
+ class: ['vxe-input', `type--${type}`, className, {
2314
+ [`size--${vSize}`]: vSize,
2315
+ [`is--${align}`]: align,
2316
+ 'is--controls': controls,
2317
+ 'is--prefix': !!prefix,
2318
+ 'is--suffix': !!suffix,
2319
+ 'is--readonly': readonly,
2320
+ 'is--visivle': visiblePanel,
2321
+ 'is--count': isWordCount,
2322
+ 'is--disabled': disabled,
2323
+ 'is--active': isActivated
2324
+ }]
2325
+ }, childs);
2326
+ };
2327
+ $xeinput.renderVN = renderVN;
2328
+ return $xeinput;
2329
+ },
2330
+ render() {
2331
+ return this.renderVN();
2332
+ }
2333
+ });