vxe-pc-ui 3.0.0 → 3.0.1

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