vxe-pc-ui 4.20.34 → 4.20.35

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 (367) hide show
  1. package/dist/all.esm.js +45718 -45038
  2. package/dist/all.esm.min.js +3 -3
  3. package/dist/style.css +307 -1
  4. package/dist/style.mini.css +1 -1
  5. package/es/alert/src/alert.js +117 -114
  6. package/es/anchor/src/anchor-link.js +110 -107
  7. package/es/anchor/src/anchor.js +212 -209
  8. package/es/avatar/src/avatar.js +132 -129
  9. package/es/backtop/src/backtop.js +267 -264
  10. package/es/badge/src/badge.js +102 -99
  11. package/es/breadcrumb/src/breadcrumb-item.js +104 -101
  12. package/es/breadcrumb/src/breadcrumb.js +70 -67
  13. package/es/button/src/button-group.js +88 -85
  14. package/es/calendar/src/calendar.js +1371 -1368
  15. package/es/card/src/card.js +235 -232
  16. package/es/carousel/src/carousel-item.js +78 -75
  17. package/es/carousel/src/carousel.js +392 -389
  18. package/es/cascader/src/cascader.js +1667 -1664
  19. package/es/checkbox/src/button.js +198 -195
  20. package/es/checkbox/src/checkbox.js +181 -178
  21. package/es/checkbox/src/group.js +210 -207
  22. package/es/collapse/src/collapse-pane.js +98 -95
  23. package/es/collapse/src/collapse.js +340 -337
  24. package/es/color-picker/src/color-picker.js +1116 -1113
  25. package/es/components.d.ts +1 -0
  26. package/es/components.js +3 -0
  27. package/es/context-menu/src/context-menu.js +601 -598
  28. package/es/countdown/src/countdown.js +224 -221
  29. package/es/date-panel/src/date-panel.js +1905 -1902
  30. package/es/date-picker/src/date-picker.js +1537 -1534
  31. package/es/date-range-picker/src/date-range-picker.js +1412 -1409
  32. package/es/divider/src/divider.js +80 -77
  33. package/es/drawer/src/drawer.js +778 -775
  34. package/es/empty/src/empty.js +100 -97
  35. package/es/form/src/form-group.js +74 -71
  36. package/es/form/src/form-item.js +76 -73
  37. package/es/form/src/form.js +789 -786
  38. package/es/icon/src/icon.js +59 -56
  39. package/es/icon/style.css +1 -1
  40. package/es/icon/style.mini.css +1 -1
  41. package/es/icon-picker/src/icon-picker.js +719 -716
  42. package/es/image/src/group.js +130 -127
  43. package/es/image/src/image.js +243 -240
  44. package/es/image/src/preview.js +627 -624
  45. package/es/index.esm.js +2 -0
  46. package/es/index.js +2 -0
  47. package/es/input/src/input.js +2700 -2697
  48. package/es/layout-aside/src/layout-aside.js +138 -135
  49. package/es/layout-body/src/layout-body.js +145 -142
  50. package/es/layout-container/src/layout-container.js +71 -68
  51. package/es/layout-footer/src/layout-footer.js +60 -57
  52. package/es/layout-header/src/layout-header.js +58 -55
  53. package/es/link/src/link.js +131 -128
  54. package/es/list/src/list.js +2174 -2171
  55. package/es/loading/src/loading.js +141 -138
  56. package/es/mention/src/mention.js +49 -46
  57. package/es/menu/src/menu.js +799 -796
  58. package/es/modal/src/modal.js +1519 -1527
  59. package/es/notice-bar/src/notice-bar.js +168 -165
  60. package/es/number-input/src/number-input.js +1094 -1091
  61. package/es/pager/src/pager.js +767 -764
  62. package/es/password-input/src/password-input.js +431 -428
  63. package/es/print/src/page-break.js +63 -60
  64. package/es/print/src/print.js +303 -300
  65. package/es/pulldown/src/pulldown.js +403 -400
  66. package/es/radio/src/button.js +214 -211
  67. package/es/radio/src/group.js +195 -192
  68. package/es/radio/src/radio.js +194 -191
  69. package/es/rate/src/rate.js +164 -161
  70. package/es/result/src/result.js +116 -113
  71. package/es/row/src/col.js +133 -130
  72. package/es/row/src/row.js +111 -108
  73. package/es/scrollbar/src/scrollbar.js +518 -515
  74. package/es/segmented/src/segmented.js +240 -237
  75. package/es/select/src/optgroup.js +44 -41
  76. package/es/select/src/option.js +39 -36
  77. package/es/select/src/select.js +1914 -1896
  78. package/es/slider/src/slider.js +419 -416
  79. package/es/space/src/space.js +190 -187
  80. package/es/splitter/src/splitter-panel.js +146 -143
  81. package/es/splitter/src/splitter.js +917 -914
  82. package/es/step-item/index.d.ts +76 -0
  83. package/es/step-item/index.js +17 -0
  84. package/es/steps/index.d.ts +288 -34
  85. package/es/steps/src/step-info.d.ts +6 -0
  86. package/es/steps/src/step-info.js +20 -0
  87. package/es/steps/src/step-item.d.ts +14 -0
  88. package/es/steps/src/step-item.js +39 -0
  89. package/es/steps/src/steps.d.ts +68 -8
  90. package/es/steps/src/steps.js +299 -47
  91. package/es/steps/src/util.d.ts +7 -0
  92. package/es/steps/src/util.js +44 -0
  93. package/es/steps/style.css +297 -0
  94. package/es/steps/style.mini.css +1 -0
  95. package/es/style.css +307 -1
  96. package/es/style.mini.css +1 -1
  97. package/es/switch/src/switch.js +228 -225
  98. package/es/table-select/src/table-select.js +865 -862
  99. package/es/table-transfer/src/table-transfer.js +61 -58
  100. package/es/tabs/src/tab-pane.js +102 -99
  101. package/es/tabs/src/tabs.js +936 -933
  102. package/es/tag/src/tag.js +163 -160
  103. package/es/text/src/text.js +232 -229
  104. package/es/text-ellipsis/src/text-ellipsis.js +252 -249
  105. package/es/textarea/src/textarea.js +434 -431
  106. package/es/timeline/src/timeline.js +74 -36
  107. package/es/timeline/src/util.js +7 -4
  108. package/es/tip/src/tip.js +117 -114
  109. package/es/tooltip/src/tooltip.js +552 -549
  110. package/es/tour/src/tour.js +49 -46
  111. package/es/transfer/src/transfer.js +95 -92
  112. package/es/tree/src/tree.js +3379 -3376
  113. package/es/tree-select/src/tree-select.js +969 -966
  114. package/es/ui/index.js +8 -2
  115. package/es/ui/src/log.js +1 -1
  116. package/es/upload/src/upload.js +1791 -1788
  117. package/es/vxe-icon/style.css +1 -1
  118. package/es/vxe-icon/style.mini.css +1 -1
  119. package/es/vxe-steps/style.css +297 -0
  120. package/es/vxe-steps/style.mini.css +1 -0
  121. package/es/watermark/src/watermark.js +158 -155
  122. package/lib/alert/src/alert.js +117 -114
  123. package/lib/anchor/src/anchor-link.js +110 -107
  124. package/lib/anchor/src/anchor.js +212 -209
  125. package/lib/avatar/src/avatar.js +132 -129
  126. package/lib/backtop/src/backtop.js +267 -264
  127. package/lib/badge/src/badge.js +102 -99
  128. package/lib/breadcrumb/src/breadcrumb-item.js +104 -101
  129. package/lib/breadcrumb/src/breadcrumb.js +70 -67
  130. package/lib/button/src/button-group.js +88 -85
  131. package/lib/calendar/src/calendar.js +1371 -1368
  132. package/lib/card/src/card.js +235 -232
  133. package/lib/carousel/src/carousel-item.js +78 -75
  134. package/lib/carousel/src/carousel.js +392 -389
  135. package/lib/cascader/src/cascader.js +1665 -1662
  136. package/lib/checkbox/src/button.js +198 -195
  137. package/lib/checkbox/src/checkbox.js +181 -178
  138. package/lib/checkbox/src/group.js +210 -207
  139. package/lib/collapse/src/collapse-pane.js +98 -95
  140. package/lib/collapse/src/collapse.js +340 -337
  141. package/lib/color-picker/src/color-picker.js +1116 -1113
  142. package/lib/components.js +3 -0
  143. package/lib/context-menu/src/context-menu.js +601 -598
  144. package/lib/countdown/src/countdown.js +224 -221
  145. package/lib/date-panel/src/date-panel.js +1905 -1902
  146. package/lib/date-picker/src/date-picker.js +1537 -1534
  147. package/lib/date-range-picker/src/date-range-picker.js +1412 -1409
  148. package/lib/divider/src/divider.js +80 -77
  149. package/lib/drawer/src/drawer.js +778 -775
  150. package/lib/empty/src/empty.js +100 -97
  151. package/lib/form/src/form-group.js +74 -71
  152. package/lib/form/src/form-item.js +76 -73
  153. package/lib/form/src/form.js +789 -786
  154. package/lib/icon/src/icon.js +59 -56
  155. package/lib/icon/style/style.css +1 -1
  156. package/lib/icon/style/style.mini.css +1 -1
  157. package/lib/icon-picker/src/icon-picker.js +719 -716
  158. package/lib/image/src/group.js +130 -127
  159. package/lib/image/src/image.js +243 -240
  160. package/lib/image/src/preview.js +627 -624
  161. package/lib/index.common.js +2 -0
  162. package/lib/index.js +2 -0
  163. package/lib/index.umd.js +47411 -46732
  164. package/lib/index.umd.min.js +3 -3
  165. package/lib/input/src/input.js +2700 -2697
  166. package/lib/layout-aside/src/layout-aside.js +138 -135
  167. package/lib/layout-body/src/layout-body.js +145 -142
  168. package/lib/layout-container/src/layout-container.js +71 -68
  169. package/lib/layout-footer/src/layout-footer.js +60 -57
  170. package/lib/layout-header/src/layout-header.js +58 -55
  171. package/lib/link/src/link.js +131 -128
  172. package/lib/list/src/list.js +2173 -2170
  173. package/lib/loading/src/loading.js +141 -138
  174. package/lib/mention/src/mention.js +49 -46
  175. package/lib/menu/src/menu.js +799 -796
  176. package/lib/modal/src/modal.js +1519 -1527
  177. package/lib/notice-bar/src/notice-bar.js +168 -165
  178. package/lib/number-input/src/number-input.js +1094 -1091
  179. package/lib/pager/src/pager.js +767 -764
  180. package/lib/password-input/src/password-input.js +431 -428
  181. package/lib/print/src/page-break.js +63 -60
  182. package/lib/print/src/print.js +303 -300
  183. package/lib/pulldown/src/pulldown.js +403 -400
  184. package/lib/radio/src/button.js +214 -211
  185. package/lib/radio/src/group.js +195 -192
  186. package/lib/radio/src/radio.js +194 -191
  187. package/lib/rate/src/rate.js +164 -161
  188. package/lib/result/src/result.js +116 -113
  189. package/lib/row/src/col.js +133 -130
  190. package/lib/row/src/row.js +111 -108
  191. package/lib/scrollbar/src/scrollbar.js +518 -515
  192. package/lib/segmented/src/segmented.js +240 -237
  193. package/lib/select/src/optgroup.js +44 -41
  194. package/lib/select/src/option.js +39 -36
  195. package/lib/select/src/select.js +1915 -1897
  196. package/lib/slider/src/slider.js +419 -416
  197. package/lib/space/src/space.js +190 -187
  198. package/lib/splitter/src/splitter-panel.js +146 -143
  199. package/lib/splitter/src/splitter.js +917 -914
  200. package/lib/step-item/index.js +47 -0
  201. package/lib/steps/src/step-info.js +49 -0
  202. package/lib/steps/src/step-item.js +59 -0
  203. package/lib/steps/src/steps.js +298 -46
  204. package/lib/steps/src/util.js +74 -0
  205. package/lib/steps/style/style.css +297 -0
  206. package/lib/steps/style/style.mini.css +1 -0
  207. package/lib/style.css +307 -1
  208. package/lib/style.mini.css +1 -1
  209. package/lib/switch/src/switch.js +228 -225
  210. package/lib/table-select/src/table-select.js +865 -862
  211. package/lib/table-transfer/src/table-transfer.js +61 -58
  212. package/lib/tabs/src/tab-pane.js +102 -99
  213. package/lib/tabs/src/tabs.js +936 -933
  214. package/lib/tag/src/tag.js +163 -160
  215. package/lib/text/src/text.js +232 -229
  216. package/lib/text-ellipsis/src/text-ellipsis.js +252 -249
  217. package/lib/textarea/src/textarea.js +434 -431
  218. package/lib/timeline/src/timeline.js +74 -36
  219. package/lib/timeline/src/util.js +7 -4
  220. package/lib/tip/src/tip.js +117 -114
  221. package/lib/tooltip/src/tooltip.js +552 -549
  222. package/lib/tour/src/tour.js +49 -46
  223. package/lib/transfer/src/transfer.js +95 -92
  224. package/lib/tree/src/tree.js +3379 -3376
  225. package/lib/tree-select/src/tree-select.js +969 -966
  226. package/lib/ui/index.js +8 -2
  227. package/lib/ui/src/log.js +1 -1
  228. package/lib/upload/src/upload.js +1788 -1785
  229. package/lib/vxe-icon/style/style.css +1 -1
  230. package/lib/vxe-icon/style/style.mini.css +1 -1
  231. package/lib/vxe-steps/style/style.css +297 -0
  232. package/lib/vxe-steps/style/style.mini.css +1 -0
  233. package/lib/watermark/src/watermark.js +158 -155
  234. package/package.json +1 -1
  235. package/packages/alert/src/alert.ts +2 -2
  236. package/packages/anchor/src/anchor-link.ts +2 -2
  237. package/packages/anchor/src/anchor.ts +2 -2
  238. package/packages/avatar/src/avatar.ts +2 -2
  239. package/packages/backtop/src/backtop.ts +2 -2
  240. package/packages/badge/src/badge.ts +2 -2
  241. package/packages/breadcrumb/src/breadcrumb-item.ts +2 -2
  242. package/packages/breadcrumb/src/breadcrumb.ts +2 -2
  243. package/packages/button/src/button-group.ts +2 -2
  244. package/packages/calendar/src/calendar.ts +2 -2
  245. package/packages/card/src/card.ts +2 -2
  246. package/packages/carousel/src/carousel-item.ts +2 -2
  247. package/packages/carousel/src/carousel.ts +2 -2
  248. package/packages/cascader/src/cascader.ts +2 -2
  249. package/packages/checkbox/src/button.ts +3 -15
  250. package/packages/checkbox/src/checkbox.ts +2 -2
  251. package/packages/checkbox/src/group.ts +2 -2
  252. package/packages/collapse/src/collapse-pane.ts +2 -2
  253. package/packages/collapse/src/collapse.ts +2 -2
  254. package/packages/color-picker/src/color-picker.ts +2 -2
  255. package/packages/components.ts +3 -0
  256. package/packages/context-menu/src/context-menu.ts +3 -16
  257. package/packages/countdown/src/countdown.ts +2 -2
  258. package/packages/date-panel/src/date-panel.ts +2 -2
  259. package/packages/date-picker/src/date-picker.ts +2 -2
  260. package/packages/date-range-picker/src/date-range-picker.ts +2 -2
  261. package/packages/divider/src/divider.ts +2 -2
  262. package/packages/drawer/src/drawer.ts +2 -2
  263. package/packages/empty/src/empty.ts +2 -2
  264. package/packages/form/src/form-group.ts +2 -2
  265. package/packages/form/src/form-item.ts +2 -2
  266. package/packages/form/src/form.ts +2 -2
  267. package/packages/icon/src/icon.ts +2 -2
  268. package/packages/icon-picker/src/icon-picker.ts +2 -2
  269. package/packages/image/src/group.ts +2 -2
  270. package/packages/image/src/image.ts +2 -2
  271. package/packages/image/src/preview.ts +3 -16
  272. package/packages/index.ts +2 -2
  273. package/packages/input/src/input.ts +2 -2
  274. package/packages/layout-aside/src/layout-aside.ts +2 -2
  275. package/packages/layout-body/src/layout-body.ts +2 -2
  276. package/packages/layout-container/src/layout-container.ts +3 -14
  277. package/packages/layout-footer/src/layout-footer.ts +2 -2
  278. package/packages/layout-header/src/layout-header.ts +2 -2
  279. package/packages/link/src/link.ts +2 -2
  280. package/packages/list/src/list.ts +2 -2
  281. package/packages/loading/src/loading.ts +2 -2
  282. package/packages/mention/src/mention.ts +2 -2
  283. package/packages/menu/src/menu.ts +2 -2
  284. package/packages/modal/src/modal.ts +5 -20
  285. package/packages/notice-bar/src/notice-bar.ts +2 -2
  286. package/packages/number-input/src/number-input.ts +3 -17
  287. package/packages/pager/src/pager.ts +2 -2
  288. package/packages/password-input/src/password-input.ts +2 -2
  289. package/packages/print/src/page-break.ts +2 -2
  290. package/packages/print/src/print.ts +2 -2
  291. package/packages/pulldown/src/pulldown.ts +2 -2
  292. package/packages/radio/src/button.ts +3 -16
  293. package/packages/radio/src/group.ts +3 -17
  294. package/packages/radio/src/radio.ts +2 -2
  295. package/packages/rate/src/rate.ts +2 -2
  296. package/packages/result/src/result.ts +2 -2
  297. package/packages/row/src/col.ts +2 -2
  298. package/packages/row/src/row.ts +2 -2
  299. package/packages/scrollbar/src/scrollbar.ts +3 -4
  300. package/packages/segmented/src/segmented.ts +2 -2
  301. package/packages/select/src/optgroup.ts +2 -2
  302. package/packages/select/src/option.ts +2 -2
  303. package/packages/select/src/select.ts +33 -19
  304. package/packages/slider/src/slider.ts +2 -2
  305. package/packages/space/src/space.ts +2 -2
  306. package/packages/splitter/src/splitter-panel.ts +2 -2
  307. package/packages/splitter/src/splitter.ts +2 -2
  308. package/packages/step-item/index.ts +16 -0
  309. package/packages/steps/src/step-info.ts +18 -0
  310. package/packages/steps/src/step-item.ts +41 -0
  311. package/packages/steps/src/steps.ts +273 -13
  312. package/packages/steps/src/util.ts +44 -0
  313. package/packages/switch/src/switch.ts +2 -2
  314. package/packages/table-select/src/table-select.ts +2 -2
  315. package/packages/table-transfer/src/table-transfer.ts +3 -15
  316. package/packages/tabs/src/tab-pane.ts +2 -2
  317. package/packages/tabs/src/tabs.ts +2 -2
  318. package/packages/tag/src/tag.ts +2 -2
  319. package/packages/text/src/text.ts +2 -2
  320. package/packages/text-ellipsis/src/text-ellipsis.ts +2 -2
  321. package/packages/textarea/src/textarea.ts +2 -2
  322. package/packages/timeline/src/timeline-info.ts +17 -17
  323. package/packages/timeline/src/timeline.ts +93 -49
  324. package/packages/timeline/src/util.ts +44 -41
  325. package/packages/tip/src/tip.ts +2 -2
  326. package/packages/tooltip/src/tooltip.ts +2 -2
  327. package/packages/tour/src/tour.ts +2 -2
  328. package/packages/transfer/src/transfer.ts +2 -2
  329. package/packages/tree/src/tree.ts +2 -2
  330. package/packages/tree-select/src/tree-select.ts +2 -2
  331. package/packages/ui/index.ts +8 -1
  332. package/packages/upload/src/upload.ts +2 -2
  333. package/packages/watermark/src/watermark.ts +2 -2
  334. package/styles/all.scss +1 -0
  335. package/styles/components/step-item.scss +0 -0
  336. package/styles/components/steps.scss +354 -0
  337. package/styles/theme/base.scss +9 -0
  338. package/types/all.d.ts +3 -0
  339. package/types/components/gantt.d.ts +1 -3
  340. package/types/components/select.d.ts +1 -13
  341. package/types/components/step-item.d.ts +72 -0
  342. package/types/components/steps.d.ts +67 -8
  343. package/types/components/table.d.ts +7 -66
  344. package/types/handles/form-design.d.ts +1 -4
  345. package/types/ui/global-config.d.ts +2 -0
  346. package/types/ui/global-icon.d.ts +7 -0
  347. /package/dist/{iconfont.1793330162657.ttf → iconfont.1793359478136.ttf} +0 -0
  348. /package/dist/{iconfont.1793330162657.woff → iconfont.1793359478136.woff} +0 -0
  349. /package/dist/{iconfont.1793330162657.woff2 → iconfont.1793359478136.woff2} +0 -0
  350. /package/es/icon/{iconfont.1793330162657.ttf → iconfont.1793359478136.ttf} +0 -0
  351. /package/es/icon/{iconfont.1793330162657.woff → iconfont.1793359478136.woff} +0 -0
  352. /package/es/icon/{iconfont.1793330162657.woff2 → iconfont.1793359478136.woff2} +0 -0
  353. /package/es/{iconfont.1793330162657.ttf → iconfont.1793359478136.ttf} +0 -0
  354. /package/es/{iconfont.1793330162657.woff → iconfont.1793359478136.woff} +0 -0
  355. /package/es/{iconfont.1793330162657.woff2 → iconfont.1793359478136.woff2} +0 -0
  356. /package/es/vxe-icon/{iconfont.1793330162657.ttf → iconfont.1793359478136.ttf} +0 -0
  357. /package/es/vxe-icon/{iconfont.1793330162657.woff → iconfont.1793359478136.woff} +0 -0
  358. /package/es/vxe-icon/{iconfont.1793330162657.woff2 → iconfont.1793359478136.woff2} +0 -0
  359. /package/lib/icon/style/{iconfont.1793330162657.ttf → iconfont.1793359478136.ttf} +0 -0
  360. /package/lib/icon/style/{iconfont.1793330162657.woff → iconfont.1793359478136.woff} +0 -0
  361. /package/lib/icon/style/{iconfont.1793330162657.woff2 → iconfont.1793359478136.woff2} +0 -0
  362. /package/lib/{iconfont.1793330162657.ttf → iconfont.1793359478136.ttf} +0 -0
  363. /package/lib/{iconfont.1793330162657.woff → iconfont.1793359478136.woff} +0 -0
  364. /package/lib/{iconfont.1793330162657.woff2 → iconfont.1793359478136.woff2} +0 -0
  365. /package/lib/vxe-icon/style/{iconfont.1793330162657.ttf → iconfont.1793359478136.ttf} +0 -0
  366. /package/lib/vxe-icon/style/{iconfont.1793330162657.woff → iconfont.1793359478136.woff} +0 -0
  367. /package/lib/vxe-icon/style/{iconfont.1793330162657.woff2 → iconfont.1793359478136.woff2} +0 -0
@@ -40,1642 +40,1645 @@ function createInternalData() {
40
40
  laseFocusMasked: 0
41
41
  };
42
42
  }
43
- var date_picker_default = defineVxeComponent({
44
- name: "VxeDatePicker",
45
- props: {
46
- modelValue: [String, Number, Date],
47
- immediate: {
48
- type: Boolean,
49
- default: true
50
- },
51
- name: String,
52
- type: {
53
- type: String,
54
- default: "date"
55
- },
56
- width: [Number, String],
57
- clearable: {
58
- type: Boolean,
59
- default: () => getConfig().datePicker.clearable
60
- },
61
- readonly: {
62
- type: Boolean,
63
- default: null
64
- },
65
- disabled: {
66
- type: Boolean,
67
- default: null
68
- },
69
- placeholder: String,
70
- autoComplete: {
71
- type: String,
72
- default: "off"
73
- },
74
- form: String,
75
- className: String,
76
- inputClassName: {
77
- type: String,
78
- default: () => getConfig().datePicker.inputClassName
79
- },
80
- zIndex: Number,
81
- size: {
82
- type: String,
83
- default: () => getConfig().datePicker.size || getConfig().size
84
- },
85
- multiple: Boolean,
86
- limitCount: {
87
- type: [String, Number],
88
- default: () => getConfig().datePicker.limitCount
89
- },
90
- // date、week、month、quarter、year
91
- startDate: {
92
- type: [String, Number, Date],
93
- default: () => getConfig().datePicker.startDate
94
- },
95
- endDate: {
96
- type: [String, Number, Date],
97
- default: () => getConfig().datePicker.endDate
98
- },
99
- defaultDate: [String, Number, Date],
100
- defaultTime: [String, Number, Date],
101
- minDate: [String, Number, Date],
102
- maxDate: [String, Number, Date],
103
- startDay: {
104
- type: [String, Number],
105
- default: () => getConfig().datePicker.startDay
106
- },
107
- labelFormat: String,
108
- valueFormat: String,
109
- timeFormat: String,
110
- parseInputMethod: Function,
111
- editable: {
112
- type: Boolean,
113
- default: true
114
- },
115
- festivalMethod: Function,
116
- disabledMethod: Function,
117
- // week
118
- selectDay: {
119
- type: [String, Number],
120
- default: () => getConfig().datePicker.selectDay
121
- },
122
- showClearButton: {
123
- type: Boolean,
124
- default: () => getConfig().datePicker.showClearButton
125
- },
126
- showConfirmButton: {
127
- type: Boolean,
128
- default: () => getConfig().datePicker.showConfirmButton
129
- },
130
- autoClose: {
131
- type: Boolean,
132
- default: () => getConfig().datePicker.autoClose
133
- },
134
- maskedConfig: Object,
135
- prefixIcon: String,
136
- suffixIcon: String,
137
- /**
138
- * 已废弃,请使用 popupConfig.placement
139
- * @deprecated
140
- */
141
- placement: String,
142
- /**
143
- * 已废弃,请使用 popupConfig.transfer
144
- * @deprecated
145
- */
146
- transfer: {
147
- type: Boolean,
148
- default: null
43
+ var date_picker_default = (
44
+ /* define-vxe-component start */
45
+ defineVxeComponent({
46
+ name: "VxeDatePicker",
47
+ props: {
48
+ modelValue: [String, Number, Date],
49
+ immediate: {
50
+ type: Boolean,
51
+ default: true
52
+ },
53
+ name: String,
54
+ type: {
55
+ type: String,
56
+ default: "date"
57
+ },
58
+ width: [Number, String],
59
+ clearable: {
60
+ type: Boolean,
61
+ default: () => getConfig().datePicker.clearable
62
+ },
63
+ readonly: {
64
+ type: Boolean,
65
+ default: null
66
+ },
67
+ disabled: {
68
+ type: Boolean,
69
+ default: null
70
+ },
71
+ placeholder: String,
72
+ autoComplete: {
73
+ type: String,
74
+ default: "off"
75
+ },
76
+ form: String,
77
+ className: String,
78
+ inputClassName: {
79
+ type: String,
80
+ default: () => getConfig().datePicker.inputClassName
81
+ },
82
+ zIndex: Number,
83
+ size: {
84
+ type: String,
85
+ default: () => getConfig().datePicker.size || getConfig().size
86
+ },
87
+ multiple: Boolean,
88
+ limitCount: {
89
+ type: [String, Number],
90
+ default: () => getConfig().datePicker.limitCount
91
+ },
92
+ // date、week、month、quarter、year
93
+ startDate: {
94
+ type: [String, Number, Date],
95
+ default: () => getConfig().datePicker.startDate
96
+ },
97
+ endDate: {
98
+ type: [String, Number, Date],
99
+ default: () => getConfig().datePicker.endDate
100
+ },
101
+ defaultDate: [String, Number, Date],
102
+ defaultTime: [String, Number, Date],
103
+ minDate: [String, Number, Date],
104
+ maxDate: [String, Number, Date],
105
+ startDay: {
106
+ type: [String, Number],
107
+ default: () => getConfig().datePicker.startDay
108
+ },
109
+ labelFormat: String,
110
+ valueFormat: String,
111
+ timeFormat: String,
112
+ parseInputMethod: Function,
113
+ editable: {
114
+ type: Boolean,
115
+ default: true
116
+ },
117
+ festivalMethod: Function,
118
+ disabledMethod: Function,
119
+ // week
120
+ selectDay: {
121
+ type: [String, Number],
122
+ default: () => getConfig().datePicker.selectDay
123
+ },
124
+ showClearButton: {
125
+ type: Boolean,
126
+ default: () => getConfig().datePicker.showClearButton
127
+ },
128
+ showConfirmButton: {
129
+ type: Boolean,
130
+ default: () => getConfig().datePicker.showConfirmButton
131
+ },
132
+ autoClose: {
133
+ type: Boolean,
134
+ default: () => getConfig().datePicker.autoClose
135
+ },
136
+ maskedConfig: Object,
137
+ prefixIcon: String,
138
+ suffixIcon: String,
139
+ /**
140
+ * 已废弃,请使用 popupConfig.placement
141
+ * @deprecated
142
+ */
143
+ placement: String,
144
+ /**
145
+ * 已废弃,请使用 popupConfig.transfer
146
+ * @deprecated
147
+ */
148
+ transfer: {
149
+ type: Boolean,
150
+ default: null
151
+ },
152
+ timeConfig: Object,
153
+ popupConfig: Object,
154
+ shortcutConfig: Object,
155
+ /**
156
+ * 已废弃 startWeek,被 startDay 替换
157
+ * @deprecated
158
+ */
159
+ startWeek: Number
149
160
  },
150
- timeConfig: Object,
151
- popupConfig: Object,
152
- shortcutConfig: Object,
153
- /**
154
- * 已废弃 startWeek,被 startDay 替换
155
- * @deprecated
156
- */
157
- startWeek: Number
158
- },
159
- emits: ["update:modelValue", "input", "change", "keydown", "keyup", "click", "focus", "blur", "clear", "confirm", "prefix-click", "suffix-click", "date-prev", "date-today", "date-next", "shortcut-click"],
160
- setup(props, context) {
161
- const { slots, emit } = context;
162
- const $xeModal = inject("$xeModal", null);
163
- const $xeDrawer = inject("$xeDrawer", null);
164
- const $xeTable = inject("$xeTable", null);
165
- const $xeCard = inject("$xeCard", null);
166
- const $xeForm = inject("$xeForm", null);
167
- const formItemInfo = inject("xeFormItemInfo", null);
168
- const xID = XEUtils.uniqueId();
169
- const { computeSize } = useFns.useSize(props);
170
- const reactData = reactive(createReactData());
171
- const internalData = createInternalData();
172
- const defaultFuncProps = {
173
- parseInputMethod: getConfig().datePicker.parseInputMethod,
174
- festivalMethod: getConfig().datePicker.festivalMethod,
175
- disabledMethod: getConfig().datePicker.disabledMethod
176
- };
177
- const refElem = ref();
178
- const refInputTarget = ref();
179
- const refInputPanel = ref();
180
- const refPanelWrapper = ref();
181
- const refDatePanel = ref();
182
- const refMaps = {
183
- refElem,
184
- refInput: refInputTarget
185
- };
186
- const $xeDatePicker = {
187
- xID,
188
- props,
189
- context,
190
- reactData,
191
- internalData,
192
- getRefMaps: () => refMaps
193
- };
194
- const computeBtnTransfer = computed(() => {
195
- const { transfer } = props;
196
- const popupOpts = computePopupOpts.value;
197
- if (XEUtils.isBoolean(popupOpts.transfer)) {
198
- return popupOpts.transfer;
199
- }
200
- if (transfer === null) {
201
- const globalTransfer = getConfig().datePicker.transfer;
202
- if (XEUtils.isBoolean(globalTransfer)) {
203
- return globalTransfer;
204
- }
205
- if ($xeTable || $xeModal || $xeDrawer || $xeCard || $xeForm) {
206
- return true;
207
- }
208
- }
209
- return transfer;
210
- });
211
- const computeFormReadonly = computed(() => {
212
- const { readonly } = props;
213
- if (readonly === null) {
214
- if ($xeForm) {
215
- return $xeForm.props.readonly;
216
- }
217
- return false;
218
- }
219
- return readonly;
220
- });
221
- const computeIsDisabled = computed(() => {
222
- const { disabled } = props;
223
- if (disabled === null) {
224
- if ($xeForm) {
225
- return $xeForm.props.disabled;
161
+ emits: ["update:modelValue", "input", "change", "keydown", "keyup", "click", "focus", "blur", "clear", "confirm", "prefix-click", "suffix-click", "date-prev", "date-today", "date-next", "shortcut-click"],
162
+ setup(props, context) {
163
+ const { slots, emit } = context;
164
+ const $xeModal = inject("$xeModal", null);
165
+ const $xeDrawer = inject("$xeDrawer", null);
166
+ const $xeTable = inject("$xeTable", null);
167
+ const $xeCard = inject("$xeCard", null);
168
+ const $xeForm = inject("$xeForm", null);
169
+ const formItemInfo = inject("xeFormItemInfo", null);
170
+ const xID = XEUtils.uniqueId();
171
+ const { computeSize } = useFns.useSize(props);
172
+ const reactData = reactive(createReactData());
173
+ const internalData = createInternalData();
174
+ const defaultFuncProps = {
175
+ parseInputMethod: getConfig().datePicker.parseInputMethod,
176
+ festivalMethod: getConfig().datePicker.festivalMethod,
177
+ disabledMethod: getConfig().datePicker.disabledMethod
178
+ };
179
+ const refElem = ref();
180
+ const refInputTarget = ref();
181
+ const refInputPanel = ref();
182
+ const refPanelWrapper = ref();
183
+ const refDatePanel = ref();
184
+ const refMaps = {
185
+ refElem,
186
+ refInput: refInputTarget
187
+ };
188
+ const $xeDatePicker = {
189
+ xID,
190
+ props,
191
+ context,
192
+ reactData,
193
+ internalData,
194
+ getRefMaps: () => refMaps
195
+ };
196
+ const computeBtnTransfer = computed(() => {
197
+ const { transfer } = props;
198
+ const popupOpts = computePopupOpts.value;
199
+ if (XEUtils.isBoolean(popupOpts.transfer)) {
200
+ return popupOpts.transfer;
226
201
  }
227
- return false;
228
- }
229
- return disabled;
230
- });
231
- const computeIsTimeType = computed(() => {
232
- const { type } = props;
233
- return type === "time";
234
- });
235
- const computeIsTimeOrDateTimeType = computed(() => {
236
- const { type } = props;
237
- const isTimeType = computeIsTimeType.value;
238
- return isTimeType || type === "datetime";
239
- });
240
- const computeIsDatePickerType = computed(() => {
241
- const isTimeOrDateTimeType = computeIsTimeOrDateTimeType.value;
242
- return isTimeOrDateTimeType || ["date", "week", "month", "quarter", "year"].indexOf(props.type) > -1;
243
- });
244
- const computeIsClearable = computed(() => {
245
- return props.clearable;
246
- });
247
- const computeIsDatePanelType = computed(() => {
248
- const isTimeOrDateTimeType = computeIsTimeOrDateTimeType.value;
249
- return isTimeOrDateTimeType || ["date", "week", "month", "quarter", "year"].indexOf(props.type) > -1;
250
- });
251
- const computeDateListValue = computed(() => {
252
- const { modelValue, type, multiple } = props;
253
- const isDatePanelType = computeIsDatePanelType.value;
254
- const dateValueFormat = computeDateValueFormat.value;
255
- if (multiple && modelValue && isDatePanelType) {
256
- return XEUtils.toValueString(modelValue).split(",").map((item) => {
257
- const date = parseDateValue(item, type, {
258
- valueFormat: dateValueFormat
259
- });
260
- if (XEUtils.isValidDate(date)) {
261
- return date;
202
+ if (transfer === null) {
203
+ const globalTransfer = getConfig().datePicker.transfer;
204
+ if (XEUtils.isBoolean(globalTransfer)) {
205
+ return globalTransfer;
262
206
  }
263
- return date;
264
- });
265
- }
266
- return [];
267
- });
268
- const computeCurrStyle = computed(() => {
269
- const { width } = props;
270
- const stys = {};
271
- if (width) {
272
- stys.width = toCssUnit(width);
273
- }
274
- return stys;
275
- });
276
- const computeDateStartDate = computed(() => {
277
- return props.startDate ? XEUtils.toStringDate(props.startDate) : null;
278
- });
279
- const computeDateEndDate = computed(() => {
280
- return props.endDate ? XEUtils.toStringDate(props.endDate) : null;
281
- });
282
- const computeLimitMaxCount = computed(() => {
283
- return props.multiple ? XEUtils.toNumber(props.limitCount) : 0;
284
- });
285
- const computeDateMultipleValue = computed(() => {
286
- const dateListValue = computeDateListValue.value;
287
- const dateValueFormat = computeDateValueFormat.value;
288
- return dateListValue.map((date) => XEUtils.toDateString(date, dateValueFormat));
289
- });
290
- const computeOverCount = computed(() => {
291
- const { multiple } = props;
292
- const limitMaxCount = computeLimitMaxCount.value;
293
- const dateMultipleValue = computeDateMultipleValue.value;
294
- if (multiple && limitMaxCount) {
295
- return dateMultipleValue.length >= limitMaxCount;
296
- }
297
- return false;
298
- });
299
- const computeInputReadonly = computed(() => {
300
- const { type, editable, multiple } = props;
301
- const formReadonly = computeFormReadonly.value;
302
- return formReadonly || multiple || !editable || type === "week" || type === "quarter";
303
- });
304
- const computeInpPlaceholder = computed(() => {
305
- const { placeholder } = props;
306
- if (placeholder) {
307
- return getFuncText(placeholder);
308
- }
309
- const globalPlaceholder = getConfig().datePicker.placeholder;
310
- if (globalPlaceholder) {
311
- return getFuncText(globalPlaceholder);
312
- }
313
- return getI18n("vxe.base.pleaseSelect");
314
- });
315
- const computeInpImmediate = computed(() => {
316
- const { immediate } = props;
317
- return immediate;
318
- });
319
- const computeTimeOpts = computed(() => {
320
- return Object.assign({}, getConfig().datePicker.timeConfig, props.timeConfig);
321
- });
322
- const computePopupOpts = computed(() => {
323
- return Object.assign({}, getConfig().datePicker.popupConfig, props.popupConfig);
324
- });
325
- const computeShortcutOpts = computed(() => {
326
- return Object.assign({}, getConfig().datePicker.shortcutConfig, props.shortcutConfig);
327
- });
328
- const computeShortcutList = computed(() => {
329
- const shortcutOpts = computeShortcutOpts.value;
330
- const { options } = shortcutOpts;
331
- if (options) {
332
- return options.map((option, index) => {
333
- return Object.assign(
334
- {
335
- name: `${option.name || option.code || index}`
336
- },
337
- option
338
- );
339
- });
340
- }
341
- return [];
342
- });
343
- const computeDateLabelFormat = computed(() => {
344
- const { labelFormat } = props;
345
- return labelFormat || getI18n(`vxe.input.date.labelFormat.${props.type}`);
346
- });
347
- const computeDateValueFormat = computed(() => {
348
- const { type, valueFormat } = props;
349
- return handleValueFormat(type, valueFormat);
350
- });
351
- const computeDateMaskedFormat = computed(() => {
352
- const dateLabelFormat = computeDateLabelFormat.value;
353
- return dateLabelFormat;
354
- });
355
- const computeFirstDayOfWeek = computed(() => {
356
- const { startDay } = props;
357
- return XEUtils.toNumber(startDay);
358
- });
359
- const computePanelLabel = computed(() => {
360
- const { type, multiple } = props;
361
- const { inputValue } = reactData;
362
- const dateLabelFormat = computeDateLabelFormat.value;
363
- const dateValueFormat = computeDateValueFormat.value;
364
- const firstDayOfWeek = computeFirstDayOfWeek.value;
365
- const vals = inputValue ? multiple ? inputValue.split(",") : [inputValue] : [];
366
- return vals.map((val) => {
367
- const dateObj = parseDateObj(val, type, {
368
- valueFormat: dateValueFormat,
369
- labelFormat: dateLabelFormat,
370
- firstDay: firstDayOfWeek
371
- });
372
- return dateObj.label;
373
- }).join(", ");
374
- });
375
- const computeMaskedOpts = computed(() => {
376
- return Object.assign({}, getConfig().datePicker.maskedConfig, props.maskedConfig);
377
- });
378
- const computeMaskChar = computed(() => {
379
- const maskedOpts = computeMaskedOpts.value;
380
- const { maskPlaceholder } = maskedOpts;
381
- return (maskPlaceholder ? ("" + maskPlaceholder)[0] : "") || defaultMaskPlaceholder;
382
- });
383
- const updateModelValue = () => {
384
- const { modelValue } = props;
385
- let val = "";
386
- if (modelValue) {
387
- if (XEUtils.isNumber(modelValue) && /^[0-9]{11,15}$/.test(`${modelValue}`)) {
388
- val = new Date(modelValue);
389
- } else {
390
- val = modelValue;
391
- }
392
- }
393
- reactData.inputValue = val;
394
- };
395
- const handleInputLabel = (text, isUpdate) => {
396
- internalData.inputLabel = text;
397
- if (isUpdate) {
398
- reactData.labelFlag++;
399
- }
400
- };
401
- const triggerEvent = (evnt) => {
402
- const { inputValue } = reactData;
403
- dispatchEvent(evnt.type, { value: inputValue }, evnt);
404
- };
405
- const handleChange = (value, evnt) => {
406
- const { type, modelValue, valueFormat } = props;
407
- const dateValueFormat = computeDateValueFormat.value;
408
- reactData.inputValue = value;
409
- if (hasTimestampValueType(valueFormat)) {
410
- const dateVal = parseDateValue(value, type, { valueFormat: dateValueFormat });
411
- const timeNum = dateVal ? dateVal.getTime() : null;
412
- emitModel(timeNum);
413
- if (modelValue !== timeNum) {
414
- dispatchEvent("change", { value: timeNum }, evnt);
415
- if ($xeForm && formItemInfo) {
416
- $xeForm.triggerItemEvent(evnt, formItemInfo.itemConfig.field, timeNum);
207
+ if ($xeTable || $xeModal || $xeDrawer || $xeCard || $xeForm) {
208
+ return true;
417
209
  }
418
210
  }
419
- } else if (hasDateValueType(valueFormat)) {
420
- const dateVal = parseDateValue(value, type, { valueFormat: dateValueFormat });
421
- emitModel(dateVal);
422
- if (modelValue && dateVal ? XEUtils.toStringDate(modelValue).getTime() !== dateVal.getTime() : modelValue !== dateVal) {
423
- dispatchEvent("change", { value: dateVal }, evnt);
424
- if ($xeForm && formItemInfo) {
425
- $xeForm.triggerItemEvent(evnt, formItemInfo.itemConfig.field, dateVal);
211
+ return transfer;
212
+ });
213
+ const computeFormReadonly = computed(() => {
214
+ const { readonly } = props;
215
+ if (readonly === null) {
216
+ if ($xeForm) {
217
+ return $xeForm.props.readonly;
426
218
  }
219
+ return false;
427
220
  }
428
- } else {
429
- emitModel(value);
430
- if (XEUtils.toValueString(modelValue) !== value) {
431
- dispatchEvent("change", { value }, evnt);
432
- if ($xeForm && formItemInfo) {
433
- $xeForm.triggerItemEvent(evnt, formItemInfo.itemConfig.field, value);
221
+ return readonly;
222
+ });
223
+ const computeIsDisabled = computed(() => {
224
+ const { disabled } = props;
225
+ if (disabled === null) {
226
+ if ($xeForm) {
227
+ return $xeForm.props.disabled;
434
228
  }
229
+ return false;
435
230
  }
436
- }
437
- };
438
- const inputEvent = (evnt) => {
439
- const inputElem = evnt.target;
440
- const value = inputElem.value;
441
- handleInputLabel(value, true);
442
- dispatchEvent("input", { value }, evnt);
443
- };
444
- const changeEvent = (evnt) => {
445
- const inpImmediate = computeInpImmediate.value;
446
- if (!inpImmediate) {
447
- triggerEvent(evnt);
448
- }
449
- };
450
- const clickPrefixEvent = (evnt) => {
451
- const isDisabled = computeIsDisabled.value;
452
- if (!isDisabled) {
453
- const { inputValue } = reactData;
454
- dispatchEvent("prefix-click", { value: inputValue }, evnt);
455
- }
456
- };
457
- const hidePanel = () => {
458
- return new Promise((resolve) => {
459
- reactData.visiblePanel = false;
460
- internalData.hpTimeout = setTimeout(() => {
461
- reactData.isAniVisible = false;
462
- resolve();
463
- }, 350);
231
+ return disabled;
464
232
  });
465
- };
466
- const dateChange = (date, isReload) => {
467
- const { modelValue, multiple } = props;
468
- const isTimeOrDateTimeType = computeIsTimeOrDateTimeType.value;
469
- const dateValueFormat = computeDateValueFormat.value;
470
- const firstDayOfWeek = computeFirstDayOfWeek.value;
471
- if (props.type === "week") {
472
- const sWeek = XEUtils.toNumber(props.selectDay);
473
- date = XEUtils.getWhatWeek(date, 0, sWeek, firstDayOfWeek);
474
- }
475
- const inpVal = XEUtils.toDateString(date, dateValueFormat, { firstDay: firstDayOfWeek });
476
- if (multiple) {
477
- const overCount = computeOverCount.value;
478
- if (isTimeOrDateTimeType) {
479
- const dateListValue = isReload ? [] : [...computeDateListValue.value];
480
- const datetimeRest = [];
481
- const eqIndex = XEUtils.findIndexOf(dateListValue, (val) => XEUtils.isDateSame(date, val, "yyyyMMdd"));
482
- if (eqIndex === -1) {
483
- if (overCount) {
484
- return;
233
+ const computeIsTimeType = computed(() => {
234
+ const { type } = props;
235
+ return type === "time";
236
+ });
237
+ const computeIsTimeOrDateTimeType = computed(() => {
238
+ const { type } = props;
239
+ const isTimeType = computeIsTimeType.value;
240
+ return isTimeType || type === "datetime";
241
+ });
242
+ const computeIsDatePickerType = computed(() => {
243
+ const isTimeOrDateTimeType = computeIsTimeOrDateTimeType.value;
244
+ return isTimeOrDateTimeType || ["date", "week", "month", "quarter", "year"].indexOf(props.type) > -1;
245
+ });
246
+ const computeIsClearable = computed(() => {
247
+ return props.clearable;
248
+ });
249
+ const computeIsDatePanelType = computed(() => {
250
+ const isTimeOrDateTimeType = computeIsTimeOrDateTimeType.value;
251
+ return isTimeOrDateTimeType || ["date", "week", "month", "quarter", "year"].indexOf(props.type) > -1;
252
+ });
253
+ const computeDateListValue = computed(() => {
254
+ const { modelValue, type, multiple } = props;
255
+ const isDatePanelType = computeIsDatePanelType.value;
256
+ const dateValueFormat = computeDateValueFormat.value;
257
+ if (multiple && modelValue && isDatePanelType) {
258
+ return XEUtils.toValueString(modelValue).split(",").map((item) => {
259
+ const date = parseDateValue(item, type, {
260
+ valueFormat: dateValueFormat
261
+ });
262
+ if (XEUtils.isValidDate(date)) {
263
+ return date;
485
264
  }
486
- dateListValue.push(date);
265
+ return date;
266
+ });
267
+ }
268
+ return [];
269
+ });
270
+ const computeCurrStyle = computed(() => {
271
+ const { width } = props;
272
+ const stys = {};
273
+ if (width) {
274
+ stys.width = toCssUnit(width);
275
+ }
276
+ return stys;
277
+ });
278
+ const computeDateStartDate = computed(() => {
279
+ return props.startDate ? XEUtils.toStringDate(props.startDate) : null;
280
+ });
281
+ const computeDateEndDate = computed(() => {
282
+ return props.endDate ? XEUtils.toStringDate(props.endDate) : null;
283
+ });
284
+ const computeLimitMaxCount = computed(() => {
285
+ return props.multiple ? XEUtils.toNumber(props.limitCount) : 0;
286
+ });
287
+ const computeDateMultipleValue = computed(() => {
288
+ const dateListValue = computeDateListValue.value;
289
+ const dateValueFormat = computeDateValueFormat.value;
290
+ return dateListValue.map((date) => XEUtils.toDateString(date, dateValueFormat));
291
+ });
292
+ const computeOverCount = computed(() => {
293
+ const { multiple } = props;
294
+ const limitMaxCount = computeLimitMaxCount.value;
295
+ const dateMultipleValue = computeDateMultipleValue.value;
296
+ if (multiple && limitMaxCount) {
297
+ return dateMultipleValue.length >= limitMaxCount;
298
+ }
299
+ return false;
300
+ });
301
+ const computeInputReadonly = computed(() => {
302
+ const { type, editable, multiple } = props;
303
+ const formReadonly = computeFormReadonly.value;
304
+ return formReadonly || multiple || !editable || type === "week" || type === "quarter";
305
+ });
306
+ const computeInpPlaceholder = computed(() => {
307
+ const { placeholder } = props;
308
+ if (placeholder) {
309
+ return getFuncText(placeholder);
310
+ }
311
+ const globalPlaceholder = getConfig().datePicker.placeholder;
312
+ if (globalPlaceholder) {
313
+ return getFuncText(globalPlaceholder);
314
+ }
315
+ return getI18n("vxe.base.pleaseSelect");
316
+ });
317
+ const computeInpImmediate = computed(() => {
318
+ const { immediate } = props;
319
+ return immediate;
320
+ });
321
+ const computeTimeOpts = computed(() => {
322
+ return Object.assign({}, getConfig().datePicker.timeConfig, props.timeConfig);
323
+ });
324
+ const computePopupOpts = computed(() => {
325
+ return Object.assign({}, getConfig().datePicker.popupConfig, props.popupConfig);
326
+ });
327
+ const computeShortcutOpts = computed(() => {
328
+ return Object.assign({}, getConfig().datePicker.shortcutConfig, props.shortcutConfig);
329
+ });
330
+ const computeShortcutList = computed(() => {
331
+ const shortcutOpts = computeShortcutOpts.value;
332
+ const { options } = shortcutOpts;
333
+ if (options) {
334
+ return options.map((option, index) => {
335
+ return Object.assign(
336
+ {
337
+ name: `${option.name || option.code || index}`
338
+ },
339
+ option
340
+ );
341
+ });
342
+ }
343
+ return [];
344
+ });
345
+ const computeDateLabelFormat = computed(() => {
346
+ const { labelFormat } = props;
347
+ return labelFormat || getI18n(`vxe.input.date.labelFormat.${props.type}`);
348
+ });
349
+ const computeDateValueFormat = computed(() => {
350
+ const { type, valueFormat } = props;
351
+ return handleValueFormat(type, valueFormat);
352
+ });
353
+ const computeDateMaskedFormat = computed(() => {
354
+ const dateLabelFormat = computeDateLabelFormat.value;
355
+ return dateLabelFormat;
356
+ });
357
+ const computeFirstDayOfWeek = computed(() => {
358
+ const { startDay } = props;
359
+ return XEUtils.toNumber(startDay);
360
+ });
361
+ const computePanelLabel = computed(() => {
362
+ const { type, multiple } = props;
363
+ const { inputValue } = reactData;
364
+ const dateLabelFormat = computeDateLabelFormat.value;
365
+ const dateValueFormat = computeDateValueFormat.value;
366
+ const firstDayOfWeek = computeFirstDayOfWeek.value;
367
+ const vals = inputValue ? multiple ? inputValue.split(",") : [inputValue] : [];
368
+ return vals.map((val) => {
369
+ const dateObj = parseDateObj(val, type, {
370
+ valueFormat: dateValueFormat,
371
+ labelFormat: dateLabelFormat,
372
+ firstDay: firstDayOfWeek
373
+ });
374
+ return dateObj.label;
375
+ }).join(", ");
376
+ });
377
+ const computeMaskedOpts = computed(() => {
378
+ return Object.assign({}, getConfig().datePicker.maskedConfig, props.maskedConfig);
379
+ });
380
+ const computeMaskChar = computed(() => {
381
+ const maskedOpts = computeMaskedOpts.value;
382
+ const { maskPlaceholder } = maskedOpts;
383
+ return (maskPlaceholder ? ("" + maskPlaceholder)[0] : "") || defaultMaskPlaceholder;
384
+ });
385
+ const updateModelValue = () => {
386
+ const { modelValue } = props;
387
+ let val = "";
388
+ if (modelValue) {
389
+ if (XEUtils.isNumber(modelValue) && /^[0-9]{11,15}$/.test(`${modelValue}`)) {
390
+ val = new Date(modelValue);
487
391
  } else {
488
- dateListValue.splice(eqIndex, 1);
392
+ val = modelValue;
489
393
  }
490
- dateListValue.forEach((item) => {
491
- if (item) {
492
- datetimeRest.push(item);
394
+ }
395
+ reactData.inputValue = val;
396
+ };
397
+ const handleInputLabel = (text, isUpdate) => {
398
+ internalData.inputLabel = text;
399
+ if (isUpdate) {
400
+ reactData.labelFlag++;
401
+ }
402
+ };
403
+ const triggerEvent = (evnt) => {
404
+ const { inputValue } = reactData;
405
+ dispatchEvent(evnt.type, { value: inputValue }, evnt);
406
+ };
407
+ const handleChange = (value, evnt) => {
408
+ const { type, modelValue, valueFormat } = props;
409
+ const dateValueFormat = computeDateValueFormat.value;
410
+ reactData.inputValue = value;
411
+ if (hasTimestampValueType(valueFormat)) {
412
+ const dateVal = parseDateValue(value, type, { valueFormat: dateValueFormat });
413
+ const timeNum = dateVal ? dateVal.getTime() : null;
414
+ emitModel(timeNum);
415
+ if (modelValue !== timeNum) {
416
+ dispatchEvent("change", { value: timeNum }, evnt);
417
+ if ($xeForm && formItemInfo) {
418
+ $xeForm.triggerItemEvent(evnt, formItemInfo.itemConfig.field, timeNum);
493
419
  }
494
- });
495
- handleChange(datetimeRest.map((date2) => XEUtils.toDateString(date2, dateValueFormat)).join(","), { type: "update" });
420
+ }
421
+ } else if (hasDateValueType(valueFormat)) {
422
+ const dateVal = parseDateValue(value, type, { valueFormat: dateValueFormat });
423
+ emitModel(dateVal);
424
+ if (modelValue && dateVal ? XEUtils.toStringDate(modelValue).getTime() !== dateVal.getTime() : modelValue !== dateVal) {
425
+ dispatchEvent("change", { value: dateVal }, evnt);
426
+ if ($xeForm && formItemInfo) {
427
+ $xeForm.triggerItemEvent(evnt, formItemInfo.itemConfig.field, dateVal);
428
+ }
429
+ }
496
430
  } else {
497
- const dateMultipleValue = isReload ? [] : computeDateMultipleValue.value;
498
- if (dateMultipleValue.some((val) => XEUtils.isEqual(val, inpVal))) {
499
- handleChange(dateMultipleValue.filter((val) => !XEUtils.isEqual(val, inpVal)).join(","), { type: "update" });
500
- } else {
501
- if (overCount) {
502
- return;
431
+ emitModel(value);
432
+ if (XEUtils.toValueString(modelValue) !== value) {
433
+ dispatchEvent("change", { value }, evnt);
434
+ if ($xeForm && formItemInfo) {
435
+ $xeForm.triggerItemEvent(evnt, formItemInfo.itemConfig.field, value);
503
436
  }
504
- handleChange(dateMultipleValue.concat([inpVal]).join(","), { type: "update" });
505
437
  }
506
438
  }
507
- } else {
508
- if (!XEUtils.isEqual(modelValue, inpVal)) {
509
- handleChange(inpVal, { type: "update" });
510
- }
511
- }
512
- };
513
- const dateRevert = () => {
514
- const panelLabel = computePanelLabel.value;
515
- handleInputLabel(panelLabel, true);
516
- };
517
- const afterCheckValue = (inpVal) => {
518
- const { type, editable, multiple, maskedConfig } = props;
519
- const { inputLabel } = internalData;
520
- const dateLabelFormat = computeDateLabelFormat.value;
521
- const maskedOpts = computeMaskedOpts.value;
522
- const dateStartDate = computeDateStartDate.value;
523
- const dateEndDate = computeDateEndDate.value;
524
- const parseInpMethod = props.parseInputMethod || defaultFuncProps.parseInputMethod;
525
- if (!inpVal) {
526
- handleChange("", { type: "check" });
527
- return;
528
- }
529
- if (editable && !multiple && (isEnableConf(maskedConfig) || maskedOpts.enabled)) {
530
- const allMaskedKeys = dateLabelFormat.match(new RegExp(`(${inputMaskedKeys.join("|")})+`, "g"));
531
- if (allMaskedKeys) {
532
- allMaskedKeys.forEach((formatKey) => {
533
- const fkIndex = dateLabelFormat.indexOf(formatKey);
534
- if (fkIndex > -1) {
535
- const valStr = inpVal.slice(fkIndex, fkIndex + formatKey.length).replace(/\D/g, "");
536
- if (!valStr) {
439
+ };
440
+ const inputEvent = (evnt) => {
441
+ const inputElem = evnt.target;
442
+ const value = inputElem.value;
443
+ handleInputLabel(value, true);
444
+ dispatchEvent("input", { value }, evnt);
445
+ };
446
+ const changeEvent = (evnt) => {
447
+ const inpImmediate = computeInpImmediate.value;
448
+ if (!inpImmediate) {
449
+ triggerEvent(evnt);
450
+ }
451
+ };
452
+ const clickPrefixEvent = (evnt) => {
453
+ const isDisabled = computeIsDisabled.value;
454
+ if (!isDisabled) {
455
+ const { inputValue } = reactData;
456
+ dispatchEvent("prefix-click", { value: inputValue }, evnt);
457
+ }
458
+ };
459
+ const hidePanel = () => {
460
+ return new Promise((resolve) => {
461
+ reactData.visiblePanel = false;
462
+ internalData.hpTimeout = setTimeout(() => {
463
+ reactData.isAniVisible = false;
464
+ resolve();
465
+ }, 350);
466
+ });
467
+ };
468
+ const dateChange = (date, isReload) => {
469
+ const { modelValue, multiple } = props;
470
+ const isTimeOrDateTimeType = computeIsTimeOrDateTimeType.value;
471
+ const dateValueFormat = computeDateValueFormat.value;
472
+ const firstDayOfWeek = computeFirstDayOfWeek.value;
473
+ if (props.type === "week") {
474
+ const sWeek = XEUtils.toNumber(props.selectDay);
475
+ date = XEUtils.getWhatWeek(date, 0, sWeek, firstDayOfWeek);
476
+ }
477
+ const inpVal = XEUtils.toDateString(date, dateValueFormat, { firstDay: firstDayOfWeek });
478
+ if (multiple) {
479
+ const overCount = computeOverCount.value;
480
+ if (isTimeOrDateTimeType) {
481
+ const dateListValue = isReload ? [] : [...computeDateListValue.value];
482
+ const datetimeRest = [];
483
+ const eqIndex = XEUtils.findIndexOf(dateListValue, (val) => XEUtils.isDateSame(date, val, "yyyyMMdd"));
484
+ if (eqIndex === -1) {
485
+ if (overCount) {
537
486
  return;
538
487
  }
539
- let valNum = XEUtils.toNumber(valStr);
540
- if (!valNum && ["MM", "dd"].includes(formatKey)) {
541
- valNum = 1;
488
+ dateListValue.push(date);
489
+ } else {
490
+ dateListValue.splice(eqIndex, 1);
491
+ }
492
+ dateListValue.forEach((item) => {
493
+ if (item) {
494
+ datetimeRest.push(item);
542
495
  }
543
- inpVal = inpVal.slice(0, fkIndex) + XEUtils.padStart(checkDateInputFormat(valNum, formatKey), formatKey.length, "0") + inpVal.slice(fkIndex + formatKey.length);
496
+ });
497
+ handleChange(datetimeRest.map((date2) => XEUtils.toDateString(date2, dateValueFormat)).join(","), { type: "update" });
498
+ } else {
499
+ const dateMultipleValue = isReload ? [] : computeDateMultipleValue.value;
500
+ if (dateMultipleValue.some((val) => XEUtils.isEqual(val, inpVal))) {
501
+ handleChange(dateMultipleValue.filter((val) => !XEUtils.isEqual(val, inpVal)).join(","), { type: "update" });
502
+ } else {
503
+ if (overCount) {
504
+ return;
505
+ }
506
+ handleChange(dateMultipleValue.concat([inpVal]).join(","), { type: "update" });
544
507
  }
508
+ }
509
+ } else {
510
+ if (!XEUtils.isEqual(modelValue, inpVal)) {
511
+ handleChange(inpVal, { type: "update" });
512
+ }
513
+ }
514
+ };
515
+ const dateRevert = () => {
516
+ const panelLabel = computePanelLabel.value;
517
+ handleInputLabel(panelLabel, true);
518
+ };
519
+ const afterCheckValue = (inpVal) => {
520
+ const { type, editable, multiple, maskedConfig } = props;
521
+ const { inputLabel } = internalData;
522
+ const dateLabelFormat = computeDateLabelFormat.value;
523
+ const maskedOpts = computeMaskedOpts.value;
524
+ const dateStartDate = computeDateStartDate.value;
525
+ const dateEndDate = computeDateEndDate.value;
526
+ const parseInpMethod = props.parseInputMethod || defaultFuncProps.parseInputMethod;
527
+ if (!inpVal) {
528
+ handleChange("", { type: "check" });
529
+ return;
530
+ }
531
+ if (editable && !multiple && (isEnableConf(maskedConfig) || maskedOpts.enabled)) {
532
+ const allMaskedKeys = dateLabelFormat.match(new RegExp(`(${inputMaskedKeys.join("|")})+`, "g"));
533
+ if (allMaskedKeys) {
534
+ allMaskedKeys.forEach((formatKey) => {
535
+ const fkIndex = dateLabelFormat.indexOf(formatKey);
536
+ if (fkIndex > -1) {
537
+ const valStr = inpVal.slice(fkIndex, fkIndex + formatKey.length).replace(/\D/g, "");
538
+ if (!valStr) {
539
+ return;
540
+ }
541
+ let valNum = XEUtils.toNumber(valStr);
542
+ if (!valNum && ["MM", "dd"].includes(formatKey)) {
543
+ valNum = 1;
544
+ }
545
+ inpVal = inpVal.slice(0, fkIndex) + XEUtils.padStart(checkDateInputFormat(valNum, formatKey), formatKey.length, "0") + inpVal.slice(fkIndex + formatKey.length);
546
+ }
547
+ });
548
+ }
549
+ }
550
+ let inpDateVal;
551
+ if (parseInpMethod) {
552
+ inpDateVal = parseInpMethod({
553
+ $datePicker: $xeDatePicker,
554
+ type,
555
+ inputValue: inpVal,
556
+ valueFormat: dateLabelFormat
557
+ }) || null;
558
+ } else {
559
+ const $datePanel = refDatePanel.value;
560
+ if ($datePanel) {
561
+ return $datePanel.checkValue(inpVal);
562
+ }
563
+ inpDateVal = parseDateValue(inpVal, type, {
564
+ valueFormat: dateLabelFormat
545
565
  });
546
566
  }
547
- }
548
- let inpDateVal;
549
- if (parseInpMethod) {
550
- inpDateVal = parseInpMethod({
551
- $datePicker: $xeDatePicker,
552
- type,
553
- inputValue: inpVal,
554
- valueFormat: dateLabelFormat
555
- }) || null;
556
- } else {
557
- const $datePanel = refDatePanel.value;
558
- if ($datePanel) {
559
- return $datePanel.checkValue(inpVal);
567
+ if (!XEUtils.isValidDate(inpDateVal)) {
568
+ dateRevert();
569
+ return;
560
570
  }
561
- inpDateVal = parseDateValue(inpVal, type, {
562
- valueFormat: dateLabelFormat
563
- });
564
- }
565
- if (!XEUtils.isValidDate(inpDateVal)) {
566
- dateRevert();
567
- return;
568
- }
569
- if (type === "time") {
570
- const timeVal = XEUtils.toDateString(inpDateVal, dateLabelFormat);
571
- if (inputLabel !== timeVal) {
572
- handleChange(inpDateVal, { type: "check" });
573
- }
574
- handleInputLabel(timeVal, true);
575
- return;
576
- }
577
- if (dateEndDate && inpDateVal > dateEndDate) {
578
- inpDateVal = dateEndDate;
579
- }
580
- if (dateStartDate && inpDateVal < dateStartDate) {
581
- inpDateVal = dateStartDate;
582
- }
583
- let isChange = false;
584
- const firstDayOfWeek = computeFirstDayOfWeek.value;
585
- if (type === "datetime") {
586
- const dateValue = reactData.inputValue;
587
- if (inpVal !== XEUtils.toDateString(dateValue, dateLabelFormat) || inpVal !== XEUtils.toDateString(inpDateVal, dateLabelFormat)) {
571
+ if (type === "time") {
572
+ const timeVal = XEUtils.toDateString(inpDateVal, dateLabelFormat);
573
+ if (inputLabel !== timeVal) {
574
+ handleChange(inpDateVal, { type: "check" });
575
+ }
576
+ handleInputLabel(timeVal, true);
577
+ return;
578
+ }
579
+ if (dateEndDate && inpDateVal > dateEndDate) {
580
+ inpDateVal = dateEndDate;
581
+ }
582
+ if (dateStartDate && inpDateVal < dateStartDate) {
583
+ inpDateVal = dateStartDate;
584
+ }
585
+ let isChange = false;
586
+ const firstDayOfWeek = computeFirstDayOfWeek.value;
587
+ if (type === "datetime") {
588
+ const dateValue = reactData.inputValue;
589
+ if (inpVal !== XEUtils.toDateString(dateValue, dateLabelFormat) || inpVal !== XEUtils.toDateString(inpDateVal, dateLabelFormat)) {
590
+ isChange = true;
591
+ }
592
+ } else {
588
593
  isChange = true;
589
594
  }
590
- } else {
591
- isChange = true;
592
- }
593
- const label = XEUtils.toDateString(inpDateVal, dateLabelFormat, { firstDay: firstDayOfWeek });
594
- handleInputLabel(label, true);
595
- if (isChange) {
596
- dateChange(inpDateVal);
597
- }
598
- };
599
- const clearValueEvent = (evnt, value) => {
600
- const isDatePickerType = computeIsDatePickerType.value;
601
- if (isDatePickerType) {
602
- hidePanel();
603
- }
604
- handleChange("", evnt);
605
- dispatchEvent("clear", { value }, evnt);
606
- };
607
- const clickSuffixEvent = (evnt) => {
608
- const isDisabled = computeIsDisabled.value;
609
- if (!isDisabled) {
610
- const { inputValue } = reactData;
611
- dispatchEvent("suffix-click", { value: inputValue }, evnt);
612
- }
613
- };
614
- const checkMaskedInputValue = (numStr, chunkFormat, isFull) => {
615
- const maskedOpts = computeMaskedOpts.value;
616
- const { align } = maskedOpts;
617
- const maskChar = computeMaskChar.value;
618
- const numVal = XEUtils.toNumber(numStr);
619
- let restVal = checkDateInputFormat(numVal, chunkFormat);
620
- if (isFull) {
621
- if (!restVal && ["MM", "dd"].includes(chunkFormat)) {
622
- restVal = 1;
623
- }
624
- }
625
- let restStr = "" + restVal;
626
- if (numStr.length > restStr.length) {
627
- restStr = restStr.padStart(numStr.length, "0");
628
- }
629
- if (isFull) {
630
- return XEUtils.padStart(restStr, chunkFormat.length, "0");
631
- }
632
- return XEUtils[align === "right" ? "padStart" : "padEnd"](restStr, chunkFormat.length, maskChar);
633
- };
634
- const handleArrowInputDate = (evnt, isUpArrow, isDwArrow, isLtArrow, isRtArrow) => {
635
- const { type, multiple } = props;
636
- if (multiple) {
637
- return;
638
- }
639
- const targetElem = refInputTarget.value;
640
- if (!targetElem) {
641
- return;
642
- }
643
- const inpValue = targetElem.value;
644
- if (!inpValue) {
645
- return;
646
- }
647
- const dateMaskedFormat = computeDateMaskedFormat.value;
648
- const dateLabelFormat = computeDateLabelFormat.value;
649
- const firstDayOfWeek = computeFirstDayOfWeek.value;
650
- const maskChar = computeMaskChar.value;
651
- const selectionStart = targetElem.selectionStart || 0;
652
- let selectKey = dateMaskedFormat[selectionStart];
653
- if (!parseInputKayMaps[selectKey]) {
654
- selectKey = dateMaskedFormat[selectionStart - 1];
655
- }
656
- const skRest = dateMaskedFormat.match(new RegExp(selectKey + "+"));
657
- if (!skRest) {
658
- return;
659
- }
660
- if (isUpArrow || isDwArrow) {
595
+ const label = XEUtils.toDateString(inpDateVal, dateLabelFormat, { firstDay: firstDayOfWeek });
596
+ handleInputLabel(label, true);
597
+ if (isChange) {
598
+ dateChange(inpDateVal);
599
+ }
600
+ };
601
+ const clearValueEvent = (evnt, value) => {
602
+ const isDatePickerType = computeIsDatePickerType.value;
603
+ if (isDatePickerType) {
604
+ hidePanel();
605
+ }
606
+ handleChange("", evnt);
607
+ dispatchEvent("clear", { value }, evnt);
608
+ };
609
+ const clickSuffixEvent = (evnt) => {
610
+ const isDisabled = computeIsDisabled.value;
611
+ if (!isDisabled) {
612
+ const { inputValue } = reactData;
613
+ dispatchEvent("suffix-click", { value: inputValue }, evnt);
614
+ }
615
+ };
616
+ const checkMaskedInputValue = (numStr, chunkFormat, isFull) => {
617
+ const maskedOpts = computeMaskedOpts.value;
618
+ const { align } = maskedOpts;
619
+ const maskChar = computeMaskChar.value;
620
+ const numVal = XEUtils.toNumber(numStr);
621
+ let restVal = checkDateInputFormat(numVal, chunkFormat);
622
+ if (isFull) {
623
+ if (!restVal && ["MM", "dd"].includes(chunkFormat)) {
624
+ restVal = 1;
625
+ }
626
+ }
627
+ let restStr = "" + restVal;
628
+ if (numStr.length > restStr.length) {
629
+ restStr = restStr.padStart(numStr.length, "0");
630
+ }
631
+ if (isFull) {
632
+ return XEUtils.padStart(restStr, chunkFormat.length, "0");
633
+ }
634
+ return XEUtils[align === "right" ? "padStart" : "padEnd"](restStr, chunkFormat.length, maskChar);
635
+ };
636
+ const handleArrowInputDate = (evnt, isUpArrow, isDwArrow, isLtArrow, isRtArrow) => {
637
+ const { type, multiple } = props;
638
+ if (multiple) {
639
+ return;
640
+ }
641
+ const targetElem = refInputTarget.value;
642
+ if (!targetElem) {
643
+ return;
644
+ }
645
+ const inpValue = targetElem.value;
646
+ if (!inpValue) {
647
+ return;
648
+ }
649
+ const dateMaskedFormat = computeDateMaskedFormat.value;
650
+ const dateLabelFormat = computeDateLabelFormat.value;
651
+ const firstDayOfWeek = computeFirstDayOfWeek.value;
652
+ const maskChar = computeMaskChar.value;
653
+ const selectionStart = targetElem.selectionStart || 0;
654
+ let selectKey = dateMaskedFormat[selectionStart];
655
+ if (!parseInputKayMaps[selectKey]) {
656
+ selectKey = dateMaskedFormat[selectionStart - 1];
657
+ }
658
+ const skRest = dateMaskedFormat.match(new RegExp(selectKey + "+"));
659
+ if (!skRest) {
660
+ return;
661
+ }
662
+ if (isUpArrow || isDwArrow) {
663
+ const chunkFormat = skRest[0] || "";
664
+ const chunkStartIndex = skRest.index || 0;
665
+ const chunkEndIndex = chunkStartIndex + chunkFormat.length;
666
+ const chunkValue = inpValue.slice(chunkStartIndex, chunkEndIndex);
667
+ if (parseInputKayMaps[selectKey]) {
668
+ const chunkNum = (isAllSameChar(chunkValue, maskChar) ? getChunkDefaultNum(selectKey) : XEUtils.toNumber(chunkValue)) + (isUpArrow ? 1 : -1);
669
+ const restValue = inpValue.slice(0, chunkStartIndex) + checkMaskedInputValue("" + chunkNum, chunkFormat, true) + inpValue.slice(chunkEndIndex);
670
+ evnt.preventDefault();
671
+ if (restValue.indexOf(maskChar) === -1) {
672
+ const inpDateVal = parseDateValue(restValue, type, {
673
+ valueFormat: dateLabelFormat
674
+ });
675
+ if (XEUtils.isValidDate(inpDateVal)) {
676
+ const label = XEUtils.toDateString(inpDateVal, dateLabelFormat, { firstDay: firstDayOfWeek });
677
+ targetElem.value = label;
678
+ handleInputLabel(label, false);
679
+ }
680
+ } else {
681
+ targetElem.value = restValue;
682
+ handleInputLabel(restValue, false);
683
+ }
684
+ }
685
+ targetElem.setSelectionRange(chunkStartIndex, chunkEndIndex);
686
+ } else if (isLtArrow || isRtArrow) {
687
+ const currKeyIndex = inputMaskedKeys.indexOf(selectKey);
688
+ if (currKeyIndex > -1) {
689
+ const allMaskedKeys = XEUtils.map(dateMaskedFormat.match(new RegExp(`(${inputMaskedKeys.join("|")})+`, "g")) || [], (fullKey) => fullKey[0]);
690
+ const currIndex = XEUtils.findIndexOf(allMaskedKeys, (key) => selectKey === key[0]);
691
+ const targetFormatKey = isLtArrow ? allMaskedKeys[currIndex - 1] || allMaskedKeys[0] : allMaskedKeys[currIndex + 1] || allMaskedKeys[allMaskedKeys.length - 1];
692
+ const targetKey = targetFormatKey ? targetFormatKey[0] : "";
693
+ const sktRest = dateMaskedFormat.match(new RegExp(targetKey + "+"));
694
+ if (sktRest) {
695
+ evnt.preventDefault();
696
+ const mtStartIndex = sktRest.index || 0;
697
+ const mtEndIndex = mtStartIndex + sktRest[0].length;
698
+ targetElem.setSelectionRange(mtStartIndex, mtEndIndex);
699
+ }
700
+ }
701
+ }
702
+ internalData.isTriggerMasked = true;
703
+ };
704
+ const handleMaskedInputDate = (evnt) => {
705
+ const { multiple } = props;
706
+ if (multiple) {
707
+ return;
708
+ }
709
+ const targetElem = refInputTarget.value;
710
+ if (!targetElem) {
711
+ return;
712
+ }
713
+ const isControlKey = hasControlKey(evnt);
714
+ if (isControlKey) {
715
+ return;
716
+ }
717
+ evnt.preventDefault();
718
+ const eKey = evnt.key;
719
+ const isDeleleKey = globalEvents.hasKey(evnt, GLOBAL_EVENT_KEYS.DELETE);
720
+ const isBackspaceKey = globalEvents.hasKey(evnt, GLOBAL_EVENT_KEYS.BACKSPACE);
721
+ const isNumKey = eKey >= "0" && eKey <= "9";
722
+ const numKey = isNumKey ? evnt.key : "";
723
+ if (!(isDeleleKey || isBackspaceKey || isNumKey)) {
724
+ return;
725
+ }
726
+ const { isTriggerMasked } = internalData;
727
+ const maskedOpts = computeMaskedOpts.value;
728
+ const { align } = maskedOpts;
729
+ const dateMaskedFormat = computeDateMaskedFormat.value;
730
+ const maskChar = computeMaskChar.value;
731
+ let inpValue = targetElem.value || dateMaskedFormat;
732
+ const selectionStart = targetElem.selectionStart || 0;
733
+ const selectionEnd = targetElem.selectionEnd || 0;
734
+ let selectKey = dateMaskedFormat[selectionStart];
735
+ if (!parseInputKayMaps[selectKey]) {
736
+ selectKey = dateMaskedFormat[selectionStart - 1];
737
+ }
738
+ const skRest = dateMaskedFormat.match(new RegExp(selectKey + "+"));
739
+ if (!skRest) {
740
+ return;
741
+ }
742
+ const allMaskedKeys = XEUtils.map(dateMaskedFormat.match(new RegExp(`(${inputMaskedKeys.join("|")})+`, "g")) || [], (fullKey) => fullKey[0]);
661
743
  const chunkFormat = skRest[0] || "";
662
744
  const chunkStartIndex = skRest.index || 0;
663
745
  const chunkEndIndex = chunkStartIndex + chunkFormat.length;
664
- const chunkValue = inpValue.slice(chunkStartIndex, chunkEndIndex);
665
- if (parseInputKayMaps[selectKey]) {
666
- const chunkNum = (isAllSameChar(chunkValue, maskChar) ? getChunkDefaultNum(selectKey) : XEUtils.toNumber(chunkValue)) + (isUpArrow ? 1 : -1);
667
- const restValue = inpValue.slice(0, chunkStartIndex) + checkMaskedInputValue("" + chunkNum, chunkFormat, true) + inpValue.slice(chunkEndIndex);
668
- evnt.preventDefault();
669
- if (restValue.indexOf(maskChar) === -1) {
670
- const inpDateVal = parseDateValue(restValue, type, {
671
- valueFormat: dateLabelFormat
672
- });
673
- if (XEUtils.isValidDate(inpDateVal)) {
674
- const label = XEUtils.toDateString(inpDateVal, dateLabelFormat, { firstDay: firstDayOfWeek });
675
- targetElem.value = label;
676
- handleInputLabel(label, false);
746
+ const currKeyIndex = allMaskedKeys.indexOf(selectKey);
747
+ const isAllSelected = !selectionStart && selectionEnd === inpValue.length && allMaskedKeys.length > 1;
748
+ const isNotMasked = inpValue && inpValue.length !== dateMaskedFormat.length;
749
+ if (isAllSelected || isNotMasked) {
750
+ inpValue = dateMaskedFormat;
751
+ }
752
+ let chunkValue = isDeleleKey ? "" : inpValue.slice(chunkStartIndex, chunkEndIndex);
753
+ const chunkNums = chunkValue.match(/\d/g) || [];
754
+ const chunkNumList = isTriggerMasked && !isBackspaceKey ? [] : chunkNums.slice(0);
755
+ if (isNumKey) {
756
+ chunkNumList.push(numKey);
757
+ chunkValue = checkMaskedInputValue(chunkNumList.join(""), chunkFormat, false);
758
+ } else if (isBackspaceKey) {
759
+ chunkNumList.pop();
760
+ chunkValue = XEUtils[align === "right" ? "padStart" : "padEnd"](chunkNumList.join(""), chunkFormat.length, maskChar);
761
+ }
762
+ let restValue = inpValue.slice(0, chunkStartIndex) + chunkValue + inpValue.slice(chunkEndIndex);
763
+ restValue = restValue.replace(new RegExp(`(${inputMaskedKeys.join("|")})`, "g"), maskChar);
764
+ targetElem.value = restValue;
765
+ handleInputLabel(restValue, false);
766
+ if (isAllSelected) {
767
+ if (isBackspaceKey || isDeleleKey) {
768
+ const firstMaskedKeys = allMaskedKeys[0];
769
+ const firstSkRest = dateMaskedFormat.match(new RegExp(`${firstMaskedKeys}+`));
770
+ if (firstSkRest) {
771
+ const firstChunkFormat = firstSkRest[0];
772
+ targetElem.setSelectionRange(0, firstChunkFormat.length);
773
+ internalData.isTriggerMasked = true;
774
+ return;
677
775
  }
678
- } else {
679
- targetElem.value = restValue;
680
- handleInputLabel(restValue, false);
776
+ }
777
+ } else {
778
+ if (isBackspaceKey && !chunkNums.length) {
779
+ for (let i = currKeyIndex - 1; i >= 0; i--) {
780
+ const prveChunkKey = allMaskedKeys[i];
781
+ const prveSkRest = dateMaskedFormat.match(new RegExp(`${prveChunkKey}+`));
782
+ if (prveSkRest) {
783
+ const prveChunkFormat = prveSkRest[0];
784
+ const prveChunkStartIndex = prveSkRest.index || 0;
785
+ const prveChunkEndIndex = prveChunkStartIndex + prveChunkFormat.length;
786
+ let prveChunkValue = restValue.slice(prveChunkStartIndex, prveChunkEndIndex);
787
+ const prveChunkNums = prveChunkValue.match(/\d/g) || [];
788
+ if (prveChunkNums.length) {
789
+ prveChunkNums.pop();
790
+ prveChunkValue = XEUtils[align === "right" ? "padStart" : "padEnd"](prveChunkNums.join(""), prveChunkFormat.length, maskChar);
791
+ restValue = restValue.slice(0, prveChunkStartIndex) + prveChunkValue + restValue.slice(prveChunkEndIndex);
792
+ targetElem.value = restValue;
793
+ handleInputLabel(restValue, false);
794
+ targetElem.setSelectionRange(prveChunkStartIndex, prveChunkEndIndex);
795
+ return;
796
+ }
797
+ }
798
+ }
799
+ const firstMaskedKeys = allMaskedKeys[0];
800
+ const firstSkRest = dateMaskedFormat.match(new RegExp(`${firstMaskedKeys}+`));
801
+ if (firstSkRest) {
802
+ const firstChunkFormat = firstSkRest[0];
803
+ restValue = dateMaskedFormat.replace(new RegExp(`(${inputMaskedKeys.join("|")})`, "g"), maskChar);
804
+ targetElem.value = restValue;
805
+ handleInputLabel(restValue, false);
806
+ targetElem.setSelectionRange(0, firstChunkFormat.length);
807
+ internalData.isTriggerMasked = true;
808
+ return;
809
+ }
810
+ return;
681
811
  }
682
812
  }
683
- targetElem.setSelectionRange(chunkStartIndex, chunkEndIndex);
684
- } else if (isLtArrow || isRtArrow) {
685
- const currKeyIndex = inputMaskedKeys.indexOf(selectKey);
686
- if (currKeyIndex > -1) {
687
- const allMaskedKeys = XEUtils.map(dateMaskedFormat.match(new RegExp(`(${inputMaskedKeys.join("|")})+`, "g")) || [], (fullKey) => fullKey[0]);
688
- const currIndex = XEUtils.findIndexOf(allMaskedKeys, (key) => selectKey === key[0]);
689
- const targetFormatKey = isLtArrow ? allMaskedKeys[currIndex - 1] || allMaskedKeys[0] : allMaskedKeys[currIndex + 1] || allMaskedKeys[allMaskedKeys.length - 1];
690
- const targetKey = targetFormatKey ? targetFormatKey[0] : "";
691
- const sktRest = dateMaskedFormat.match(new RegExp(targetKey + "+"));
692
- if (sktRest) {
693
- evnt.preventDefault();
694
- const mtStartIndex = sktRest.index || 0;
695
- const mtEndIndex = mtStartIndex + sktRest[0].length;
696
- targetElem.setSelectionRange(mtStartIndex, mtEndIndex);
813
+ let maskStartIndex = skRest.index || 0;
814
+ let maskEndIndex = maskStartIndex + skRest[0].length;
815
+ if (chunkNumList.length >= chunkValue.length) {
816
+ const nextKeys = allMaskedKeys.slice(currKeyIndex + 1);
817
+ if (currKeyIndex > -1) {
818
+ const nextRest = nextKeys.length ? dateMaskedFormat.match(new RegExp(`(${nextKeys.join("|")})+`)) : null;
819
+ if (nextRest) {
820
+ maskStartIndex = nextRest.index || 0;
821
+ maskEndIndex = maskStartIndex + nextRest[0].length;
822
+ targetElem.setSelectionRange(maskStartIndex, maskEndIndex);
823
+ } else {
824
+ targetElem.setSelectionRange(maskStartIndex, maskEndIndex);
825
+ }
697
826
  }
827
+ internalData.isTriggerMasked = true;
828
+ return;
829
+ }
830
+ targetElem.setSelectionRange(maskStartIndex, maskEndIndex);
831
+ internalData.isTriggerMasked = false;
832
+ };
833
+ const handleMaskedSelectedDate = (evnt, isFocus) => {
834
+ internalData.fsTimeout = void 0;
835
+ const { type, multiple, modelValue } = props;
836
+ if (multiple) {
837
+ return;
838
+ }
839
+ if (!maskedTypes.includes(type)) {
840
+ return;
841
+ }
842
+ const targetElem = refInputTarget.value;
843
+ if (!targetElem) {
844
+ return;
698
845
  }
699
- }
700
- internalData.isTriggerMasked = true;
701
- };
702
- const handleMaskedInputDate = (evnt) => {
703
- const { multiple } = props;
704
- if (multiple) {
705
- return;
706
- }
707
- const targetElem = refInputTarget.value;
708
- if (!targetElem) {
709
- return;
710
- }
711
- const isControlKey = hasControlKey(evnt);
712
- if (isControlKey) {
713
- return;
714
- }
715
- evnt.preventDefault();
716
- const eKey = evnt.key;
717
- const isDeleleKey = globalEvents.hasKey(evnt, GLOBAL_EVENT_KEYS.DELETE);
718
- const isBackspaceKey = globalEvents.hasKey(evnt, GLOBAL_EVENT_KEYS.BACKSPACE);
719
- const isNumKey = eKey >= "0" && eKey <= "9";
720
- const numKey = isNumKey ? evnt.key : "";
721
- if (!(isDeleleKey || isBackspaceKey || isNumKey)) {
722
- return;
723
- }
724
- const { isTriggerMasked } = internalData;
725
- const maskedOpts = computeMaskedOpts.value;
726
- const { align } = maskedOpts;
727
- const dateMaskedFormat = computeDateMaskedFormat.value;
728
- const maskChar = computeMaskChar.value;
729
- let inpValue = targetElem.value || dateMaskedFormat;
730
- const selectionStart = targetElem.selectionStart || 0;
731
- const selectionEnd = targetElem.selectionEnd || 0;
732
- let selectKey = dateMaskedFormat[selectionStart];
733
- if (!parseInputKayMaps[selectKey]) {
734
- selectKey = dateMaskedFormat[selectionStart - 1];
735
- }
736
- const skRest = dateMaskedFormat.match(new RegExp(selectKey + "+"));
737
- if (!skRest) {
738
- return;
739
- }
740
- const allMaskedKeys = XEUtils.map(dateMaskedFormat.match(new RegExp(`(${inputMaskedKeys.join("|")})+`, "g")) || [], (fullKey) => fullKey[0]);
741
- const chunkFormat = skRest[0] || "";
742
- const chunkStartIndex = skRest.index || 0;
743
- const chunkEndIndex = chunkStartIndex + chunkFormat.length;
744
- const currKeyIndex = allMaskedKeys.indexOf(selectKey);
745
- const isAllSelected = !selectionStart && selectionEnd === inpValue.length && allMaskedKeys.length > 1;
746
- const isNotMasked = inpValue && inpValue.length !== dateMaskedFormat.length;
747
- if (isAllSelected || isNotMasked) {
748
- inpValue = dateMaskedFormat;
749
- }
750
- let chunkValue = isDeleleKey ? "" : inpValue.slice(chunkStartIndex, chunkEndIndex);
751
- const chunkNums = chunkValue.match(/\d/g) || [];
752
- const chunkNumList = isTriggerMasked && !isBackspaceKey ? [] : chunkNums.slice(0);
753
- if (isNumKey) {
754
- chunkNumList.push(numKey);
755
- chunkValue = checkMaskedInputValue(chunkNumList.join(""), chunkFormat, false);
756
- } else if (isBackspaceKey) {
757
- chunkNumList.pop();
758
- chunkValue = XEUtils[align === "right" ? "padStart" : "padEnd"](chunkNumList.join(""), chunkFormat.length, maskChar);
759
- }
760
- let restValue = inpValue.slice(0, chunkStartIndex) + chunkValue + inpValue.slice(chunkEndIndex);
761
- restValue = restValue.replace(new RegExp(`(${inputMaskedKeys.join("|")})`, "g"), maskChar);
762
- targetElem.value = restValue;
763
- handleInputLabel(restValue, false);
764
- if (isAllSelected) {
765
- if (isBackspaceKey || isDeleleKey) {
846
+ const { laseFocusMasked } = internalData;
847
+ if (laseFocusMasked && Date.now() - laseFocusMasked < 100) {
848
+ return;
849
+ }
850
+ const dateMaskedFormat = computeDateMaskedFormat.value;
851
+ const maskChar = computeMaskChar.value;
852
+ const selectionStart = targetElem.selectionStart || 0;
853
+ const selectionEnd = targetElem.selectionEnd || 0;
854
+ const inpValue = targetElem.value;
855
+ const allMaskedKeys = XEUtils.map(dateMaskedFormat.match(new RegExp(`(${inputMaskedKeys.join("|")})+`, "g")) || [], (fullKey) => fullKey[0]);
856
+ if (!inpValue) {
857
+ let restValue = dateMaskedFormat.replace(new RegExp(`(${inputMaskedKeys.join("|")})`, "g"), maskChar);
858
+ if (isFocus && modelValue) {
859
+ const chunkNums = ("" + XEUtils.toNumber(modelValue)).match(/\d/g) || [];
860
+ let useNumIndex = 0;
861
+ restValue = dateMaskedFormat.replace(new RegExp(`(${inputMaskedKeys.join("|")})`, "g"), (txt) => chunkNums[useNumIndex++] || txt);
862
+ }
766
863
  const firstMaskedKeys = allMaskedKeys[0];
767
864
  const firstSkRest = dateMaskedFormat.match(new RegExp(`${firstMaskedKeys}+`));
768
865
  if (firstSkRest) {
866
+ evnt.preventDefault();
769
867
  const firstChunkFormat = firstSkRest[0];
868
+ targetElem.value = restValue;
869
+ handleInputLabel(restValue, false);
770
870
  targetElem.setSelectionRange(0, firstChunkFormat.length);
771
- internalData.isTriggerMasked = true;
871
+ internalData.laseFocusMasked = Date.now();
772
872
  return;
773
873
  }
774
874
  }
775
- } else {
776
- if (isBackspaceKey && !chunkNums.length) {
777
- for (let i = currKeyIndex - 1; i >= 0; i--) {
778
- const prveChunkKey = allMaskedKeys[i];
779
- const prveSkRest = dateMaskedFormat.match(new RegExp(`${prveChunkKey}+`));
780
- if (prveSkRest) {
781
- const prveChunkFormat = prveSkRest[0];
782
- const prveChunkStartIndex = prveSkRest.index || 0;
783
- const prveChunkEndIndex = prveChunkStartIndex + prveChunkFormat.length;
784
- let prveChunkValue = restValue.slice(prveChunkStartIndex, prveChunkEndIndex);
785
- const prveChunkNums = prveChunkValue.match(/\d/g) || [];
786
- if (prveChunkNums.length) {
787
- prveChunkNums.pop();
788
- prveChunkValue = XEUtils[align === "right" ? "padStart" : "padEnd"](prveChunkNums.join(""), prveChunkFormat.length, maskChar);
789
- restValue = restValue.slice(0, prveChunkStartIndex) + prveChunkValue + restValue.slice(prveChunkEndIndex);
790
- targetElem.value = restValue;
791
- handleInputLabel(restValue, false);
792
- targetElem.setSelectionRange(prveChunkStartIndex, prveChunkEndIndex);
793
- return;
794
- }
795
- }
875
+ const isAllSelected = !selectionStart && selectionEnd === inpValue.length && allMaskedKeys.length > 1;
876
+ const isNotMasked = inpValue && inpValue.length !== dateMaskedFormat.length;
877
+ if (isAllSelected || isNotMasked) {
878
+ let restValue = "";
879
+ if (isNotMasked && inpValue) {
880
+ const chunkNums = inpValue.match(/\d/g) || [];
881
+ let useNumIndex = 0;
882
+ restValue = dateMaskedFormat.replace(new RegExp(`(${inputMaskedKeys.join("|")})`, "g"), () => chunkNums[useNumIndex++] || maskChar);
883
+ } else {
884
+ dateMaskedFormat.replace(new RegExp(`(${inputMaskedKeys.join("|")})`, "g"), maskChar);
796
885
  }
797
886
  const firstMaskedKeys = allMaskedKeys[0];
798
887
  const firstSkRest = dateMaskedFormat.match(new RegExp(`${firstMaskedKeys}+`));
799
888
  if (firstSkRest) {
889
+ evnt.preventDefault();
800
890
  const firstChunkFormat = firstSkRest[0];
801
- restValue = dateMaskedFormat.replace(new RegExp(`(${inputMaskedKeys.join("|")})`, "g"), maskChar);
802
891
  targetElem.value = restValue;
803
892
  handleInputLabel(restValue, false);
804
893
  targetElem.setSelectionRange(0, firstChunkFormat.length);
805
- internalData.isTriggerMasked = true;
894
+ internalData.laseFocusMasked = Date.now();
806
895
  return;
807
896
  }
808
- return;
809
897
  }
810
- }
811
- let maskStartIndex = skRest.index || 0;
812
- let maskEndIndex = maskStartIndex + skRest[0].length;
813
- if (chunkNumList.length >= chunkValue.length) {
814
- const nextKeys = allMaskedKeys.slice(currKeyIndex + 1);
815
- if (currKeyIndex > -1) {
816
- const nextRest = nextKeys.length ? dateMaskedFormat.match(new RegExp(`(${nextKeys.join("|")})+`)) : null;
817
- if (nextRest) {
818
- maskStartIndex = nextRest.index || 0;
819
- maskEndIndex = maskStartIndex + nextRest[0].length;
820
- targetElem.setSelectionRange(maskStartIndex, maskEndIndex);
821
- } else {
822
- targetElem.setSelectionRange(maskStartIndex, maskEndIndex);
898
+ let selectKey = dateMaskedFormat[selectionStart];
899
+ if (!parseInputKayMaps[selectKey]) {
900
+ selectKey = dateMaskedFormat[selectionStart - 1];
901
+ }
902
+ if (selectKey) {
903
+ evnt.stopPropagation();
904
+ const skRest = dateMaskedFormat.match(new RegExp(selectKey + "+"));
905
+ if (skRest) {
906
+ const chunkFormat = skRest[0] || "";
907
+ const chunkStartIndex = skRest.index || 0;
908
+ const chunkEndIndex = chunkStartIndex + chunkFormat.length;
909
+ targetElem.setSelectionRange(chunkStartIndex, chunkEndIndex);
910
+ internalData.isTriggerMasked = true;
911
+ internalData.laseFocusMasked = Date.now();
823
912
  }
824
913
  }
825
- internalData.isTriggerMasked = true;
826
- return;
827
- }
828
- targetElem.setSelectionRange(maskStartIndex, maskEndIndex);
829
- internalData.isTriggerMasked = false;
830
- };
831
- const handleMaskedSelectedDate = (evnt, isFocus) => {
832
- internalData.fsTimeout = void 0;
833
- const { type, multiple, modelValue } = props;
834
- if (multiple) {
835
- return;
836
- }
837
- if (!maskedTypes.includes(type)) {
838
- return;
839
- }
840
- const targetElem = refInputTarget.value;
841
- if (!targetElem) {
842
- return;
843
- }
844
- const { laseFocusMasked } = internalData;
845
- if (laseFocusMasked && Date.now() - laseFocusMasked < 100) {
846
- return;
847
- }
848
- const dateMaskedFormat = computeDateMaskedFormat.value;
849
- const maskChar = computeMaskChar.value;
850
- const selectionStart = targetElem.selectionStart || 0;
851
- const selectionEnd = targetElem.selectionEnd || 0;
852
- const inpValue = targetElem.value;
853
- const allMaskedKeys = XEUtils.map(dateMaskedFormat.match(new RegExp(`(${inputMaskedKeys.join("|")})+`, "g")) || [], (fullKey) => fullKey[0]);
854
- if (!inpValue) {
855
- let restValue = dateMaskedFormat.replace(new RegExp(`(${inputMaskedKeys.join("|")})`, "g"), maskChar);
856
- if (isFocus && modelValue) {
857
- const chunkNums = ("" + XEUtils.toNumber(modelValue)).match(/\d/g) || [];
858
- let useNumIndex = 0;
859
- restValue = dateMaskedFormat.replace(new RegExp(`(${inputMaskedKeys.join("|")})`, "g"), (txt) => chunkNums[useNumIndex++] || txt);
860
- }
861
- const firstMaskedKeys = allMaskedKeys[0];
862
- const firstSkRest = dateMaskedFormat.match(new RegExp(`${firstMaskedKeys}+`));
863
- if (firstSkRest) {
864
- evnt.preventDefault();
865
- const firstChunkFormat = firstSkRest[0];
866
- targetElem.value = restValue;
867
- handleInputLabel(restValue, false);
868
- targetElem.setSelectionRange(0, firstChunkFormat.length);
869
- internalData.laseFocusMasked = Date.now();
870
- return;
914
+ };
915
+ const blurEvent = (evnt) => {
916
+ const { inputValue } = reactData;
917
+ const inpImmediate = computeInpImmediate.value;
918
+ const value = inputValue;
919
+ if (!inpImmediate) {
920
+ handleChange(value, evnt);
871
921
  }
872
- }
873
- const isAllSelected = !selectionStart && selectionEnd === inpValue.length && allMaskedKeys.length > 1;
874
- const isNotMasked = inpValue && inpValue.length !== dateMaskedFormat.length;
875
- if (isAllSelected || isNotMasked) {
876
- let restValue = "";
877
- if (isNotMasked && inpValue) {
878
- const chunkNums = inpValue.match(/\d/g) || [];
879
- let useNumIndex = 0;
880
- restValue = dateMaskedFormat.replace(new RegExp(`(${inputMaskedKeys.join("|")})`, "g"), () => chunkNums[useNumIndex++] || maskChar);
881
- } else {
882
- dateMaskedFormat.replace(new RegExp(`(${inputMaskedKeys.join("|")})`, "g"), maskChar);
922
+ if (!reactData.visiblePanel) {
923
+ const { inputLabel } = internalData;
924
+ reactData.isActivated = false;
925
+ afterCheckValue(inputLabel);
883
926
  }
884
- const firstMaskedKeys = allMaskedKeys[0];
885
- const firstSkRest = dateMaskedFormat.match(new RegExp(`${firstMaskedKeys}+`));
886
- if (firstSkRest) {
887
- evnt.preventDefault();
888
- const firstChunkFormat = firstSkRest[0];
889
- targetElem.value = restValue;
890
- handleInputLabel(restValue, false);
891
- targetElem.setSelectionRange(0, firstChunkFormat.length);
892
- internalData.laseFocusMasked = Date.now();
893
- return;
927
+ dispatchEvent("blur", { value }, evnt);
928
+ if ($xeForm && formItemInfo) {
929
+ $xeForm.triggerItemEvent(evnt, formItemInfo.itemConfig.field, value);
930
+ }
931
+ };
932
+ const focusEvent = (evnt) => {
933
+ const { multiple, editable, maskedConfig } = props;
934
+ const { fsTimeout } = internalData;
935
+ const maskedOpts = computeMaskedOpts.value;
936
+ const popupOpts = computePopupOpts.value;
937
+ const { trigger } = popupOpts;
938
+ reactData.isActivated = true;
939
+ if (fsTimeout) {
940
+ clearTimeout(fsTimeout);
941
+ }
942
+ if (!trigger || trigger === "default") {
943
+ datePickerOpenEvent(evnt);
944
+ } else if (trigger === "icon") {
945
+ hidePanel();
946
+ }
947
+ if (editable && !multiple && (isEnableConf(maskedConfig) || maskedOpts.enabled)) {
948
+ internalData.fsTimeout = setTimeout(() => {
949
+ handleMaskedSelectedDate(evnt, true);
950
+ }, 20);
951
+ }
952
+ triggerEvent(evnt);
953
+ };
954
+ const clickEvent = (evnt) => {
955
+ const { multiple, editable, maskedConfig } = props;
956
+ const { fsTimeout } = internalData;
957
+ const maskedOpts = computeMaskedOpts.value;
958
+ if (fsTimeout) {
959
+ clearTimeout(fsTimeout);
960
+ }
961
+ if (editable && !multiple && (isEnableConf(maskedConfig) || maskedOpts.enabled)) {
962
+ internalData.fsTimeout = setTimeout(() => {
963
+ handleMaskedSelectedDate(evnt);
964
+ }, 10);
965
+ }
966
+ triggerEvent(evnt);
967
+ };
968
+ const keydownEvent = (evnt) => {
969
+ const { type, editable, maskedConfig } = props;
970
+ const { visiblePanel } = reactData;
971
+ const maskedOpts = computeMaskedOpts.value;
972
+ const isUpArrow = globalEvents.hasKey(evnt, GLOBAL_EVENT_KEYS.ARROW_UP);
973
+ const isDwArrow = globalEvents.hasKey(evnt, GLOBAL_EVENT_KEYS.ARROW_DOWN);
974
+ const isLtArrow = globalEvents.hasKey(evnt, GLOBAL_EVENT_KEYS.ARROW_LEFT);
975
+ const isRtArrow = globalEvents.hasKey(evnt, GLOBAL_EVENT_KEYS.ARROW_RIGHT);
976
+ const isEnter = globalEvents.hasKey(evnt, GLOBAL_EVENT_KEYS.ENTER);
977
+ if (editable) {
978
+ if (isEnter) {
979
+ const { inputLabel } = internalData;
980
+ if (visiblePanel) {
981
+ hidePanel();
982
+ }
983
+ afterCheckValue(inputLabel);
984
+ } else if (maskedTypes.includes(type)) {
985
+ if (isEnableConf(maskedConfig) || maskedOpts.enabled) {
986
+ if (maskedOpts.isArrow && (isUpArrow || isDwArrow || isLtArrow || isRtArrow)) {
987
+ handleArrowInputDate(evnt, isUpArrow, isDwArrow, isLtArrow, isRtArrow);
988
+ } else if (maskedOpts.isMasked) {
989
+ handleMaskedInputDate(evnt);
990
+ }
991
+ }
992
+ }
993
+ }
994
+ triggerEvent(evnt);
995
+ };
996
+ const keyupEvent = (evnt) => {
997
+ triggerEvent(evnt);
998
+ };
999
+ const confirmEvent = (evnt) => {
1000
+ const $datePanel = refDatePanel.value;
1001
+ if ($datePanel) {
1002
+ $datePanel.confirmByEvent(evnt);
894
1003
  }
895
- }
896
- let selectKey = dateMaskedFormat[selectionStart];
897
- if (!parseInputKayMaps[selectKey]) {
898
- selectKey = dateMaskedFormat[selectionStart - 1];
899
- }
900
- if (selectKey) {
901
- evnt.stopPropagation();
902
- const skRest = dateMaskedFormat.match(new RegExp(selectKey + "+"));
903
- if (skRest) {
904
- const chunkFormat = skRest[0] || "";
905
- const chunkStartIndex = skRest.index || 0;
906
- const chunkEndIndex = chunkStartIndex + chunkFormat.length;
907
- targetElem.setSelectionRange(chunkStartIndex, chunkEndIndex);
908
- internalData.isTriggerMasked = true;
909
- internalData.laseFocusMasked = Date.now();
910
- }
911
- }
912
- };
913
- const blurEvent = (evnt) => {
914
- const { inputValue } = reactData;
915
- const inpImmediate = computeInpImmediate.value;
916
- const value = inputValue;
917
- if (!inpImmediate) {
918
- handleChange(value, evnt);
919
- }
920
- if (!reactData.visiblePanel) {
921
- const { inputLabel } = internalData;
922
- reactData.isActivated = false;
923
- afterCheckValue(inputLabel);
924
- }
925
- dispatchEvent("blur", { value }, evnt);
926
- if ($xeForm && formItemInfo) {
927
- $xeForm.triggerItemEvent(evnt, formItemInfo.itemConfig.field, value);
928
- }
929
- };
930
- const focusEvent = (evnt) => {
931
- const { multiple, editable, maskedConfig } = props;
932
- const { fsTimeout } = internalData;
933
- const maskedOpts = computeMaskedOpts.value;
934
- const popupOpts = computePopupOpts.value;
935
- const { trigger } = popupOpts;
936
- reactData.isActivated = true;
937
- if (fsTimeout) {
938
- clearTimeout(fsTimeout);
939
- }
940
- if (!trigger || trigger === "default") {
941
- datePickerOpenEvent(evnt);
942
- } else if (trigger === "icon") {
943
1004
  hidePanel();
944
- }
945
- if (editable && !multiple && (isEnableConf(maskedConfig) || maskedOpts.enabled)) {
946
- internalData.fsTimeout = setTimeout(() => {
947
- handleMaskedSelectedDate(evnt, true);
948
- }, 20);
949
- }
950
- triggerEvent(evnt);
951
- };
952
- const clickEvent = (evnt) => {
953
- const { multiple, editable, maskedConfig } = props;
954
- const { fsTimeout } = internalData;
955
- const maskedOpts = computeMaskedOpts.value;
956
- if (fsTimeout) {
957
- clearTimeout(fsTimeout);
958
- }
959
- if (editable && !multiple && (isEnableConf(maskedConfig) || maskedOpts.enabled)) {
960
- internalData.fsTimeout = setTimeout(() => {
961
- handleMaskedSelectedDate(evnt);
962
- }, 10);
963
- }
964
- triggerEvent(evnt);
965
- };
966
- const keydownEvent = (evnt) => {
967
- const { type, editable, maskedConfig } = props;
968
- const { visiblePanel } = reactData;
969
- const maskedOpts = computeMaskedOpts.value;
970
- const isUpArrow = globalEvents.hasKey(evnt, GLOBAL_EVENT_KEYS.ARROW_UP);
971
- const isDwArrow = globalEvents.hasKey(evnt, GLOBAL_EVENT_KEYS.ARROW_DOWN);
972
- const isLtArrow = globalEvents.hasKey(evnt, GLOBAL_EVENT_KEYS.ARROW_LEFT);
973
- const isRtArrow = globalEvents.hasKey(evnt, GLOBAL_EVENT_KEYS.ARROW_RIGHT);
974
- const isEnter = globalEvents.hasKey(evnt, GLOBAL_EVENT_KEYS.ENTER);
975
- if (editable) {
976
- if (isEnter) {
977
- const { inputLabel } = internalData;
978
- if (visiblePanel) {
1005
+ };
1006
+ const panelChangeEvent = (params) => {
1007
+ const { multiple, autoClose } = props;
1008
+ const { value, $event } = params;
1009
+ const isTimeOrDateTimeType = computeIsTimeOrDateTimeType.value;
1010
+ handleChange(value, $event);
1011
+ if (!multiple && !isTimeOrDateTimeType) {
1012
+ if (autoClose) {
979
1013
  hidePanel();
980
1014
  }
981
- afterCheckValue(inputLabel);
982
- } else if (maskedTypes.includes(type)) {
983
- if (isEnableConf(maskedConfig) || maskedOpts.enabled) {
984
- if (maskedOpts.isArrow && (isUpArrow || isDwArrow || isLtArrow || isRtArrow)) {
985
- handleArrowInputDate(evnt, isUpArrow, isDwArrow, isLtArrow, isRtArrow);
986
- } else if (maskedOpts.isMasked) {
987
- handleMaskedInputDate(evnt);
1015
+ }
1016
+ };
1017
+ const panelConfirmEvent = (params) => {
1018
+ dispatchEvent("confirm", params, params.$event);
1019
+ };
1020
+ const panelRevertEvent = (params) => {
1021
+ handleInputLabel(params.label, true);
1022
+ };
1023
+ const handleGlobalMousedownEvent = (evnt) => {
1024
+ const { visiblePanel, isActivated } = reactData;
1025
+ const el = refElem.value;
1026
+ const panelWrapperElem = refPanelWrapper.value;
1027
+ const isDisabled = computeIsDisabled.value;
1028
+ if (!isDisabled && isActivated) {
1029
+ const currActivated = getEventTargetNode(evnt, el).flag || getEventTargetNode(evnt, panelWrapperElem).flag;
1030
+ if (currActivated !== isActivated) {
1031
+ reactData.isActivated = currActivated;
1032
+ }
1033
+ if (!currActivated) {
1034
+ if (visiblePanel) {
1035
+ hidePanel();
1036
+ const { inputLabel } = internalData;
1037
+ afterCheckValue(inputLabel);
988
1038
  }
989
1039
  }
990
1040
  }
991
- }
992
- triggerEvent(evnt);
993
- };
994
- const keyupEvent = (evnt) => {
995
- triggerEvent(evnt);
996
- };
997
- const confirmEvent = (evnt) => {
998
- const $datePanel = refDatePanel.value;
999
- if ($datePanel) {
1000
- $datePanel.confirmByEvent(evnt);
1001
- }
1002
- hidePanel();
1003
- };
1004
- const panelChangeEvent = (params) => {
1005
- const { multiple, autoClose } = props;
1006
- const { value, $event } = params;
1007
- const isTimeOrDateTimeType = computeIsTimeOrDateTimeType.value;
1008
- handleChange(value, $event);
1009
- if (!multiple && !isTimeOrDateTimeType) {
1010
- if (autoClose) {
1011
- hidePanel();
1012
- }
1013
- }
1014
- };
1015
- const panelConfirmEvent = (params) => {
1016
- dispatchEvent("confirm", params, params.$event);
1017
- };
1018
- const panelRevertEvent = (params) => {
1019
- handleInputLabel(params.label, true);
1020
- };
1021
- const handleGlobalMousedownEvent = (evnt) => {
1022
- const { visiblePanel, isActivated } = reactData;
1023
- const el = refElem.value;
1024
- const panelWrapperElem = refPanelWrapper.value;
1025
- const isDisabled = computeIsDisabled.value;
1026
- if (!isDisabled && isActivated) {
1027
- const currActivated = getEventTargetNode(evnt, el).flag || getEventTargetNode(evnt, panelWrapperElem).flag;
1028
- if (currActivated !== isActivated) {
1029
- reactData.isActivated = currActivated;
1030
- }
1031
- if (!currActivated) {
1041
+ };
1042
+ const handleGlobalKeydownEvent = (evnt) => {
1043
+ const { isActivated, visiblePanel } = reactData;
1044
+ const isDisabled = computeIsDisabled.value;
1045
+ if (!isDisabled) {
1046
+ const isTab = globalEvents.hasKey(evnt, GLOBAL_EVENT_KEYS.TAB);
1047
+ const isEsc = globalEvents.hasKey(evnt, GLOBAL_EVENT_KEYS.ESCAPE);
1048
+ if (isTab) {
1049
+ if (isActivated) {
1050
+ reactData.isActivated = false;
1051
+ }
1052
+ }
1032
1053
  if (visiblePanel) {
1033
- hidePanel();
1034
- const { inputLabel } = internalData;
1035
- afterCheckValue(inputLabel);
1054
+ if (isEsc || isTab) {
1055
+ hidePanel();
1056
+ }
1036
1057
  }
1037
1058
  }
1038
- }
1039
- };
1040
- const handleGlobalKeydownEvent = (evnt) => {
1041
- const { isActivated, visiblePanel } = reactData;
1042
- const isDisabled = computeIsDisabled.value;
1043
- if (!isDisabled) {
1044
- const isTab = globalEvents.hasKey(evnt, GLOBAL_EVENT_KEYS.TAB);
1045
- const isEsc = globalEvents.hasKey(evnt, GLOBAL_EVENT_KEYS.ESCAPE);
1046
- if (isTab) {
1047
- if (isActivated) {
1048
- reactData.isActivated = false;
1059
+ };
1060
+ const handleGlobalBlurEvent = () => {
1061
+ const { isActivated, visiblePanel } = reactData;
1062
+ if (visiblePanel) {
1063
+ hidePanel();
1064
+ }
1065
+ if (isActivated) {
1066
+ reactData.isActivated = false;
1067
+ }
1068
+ if (visiblePanel || isActivated) {
1069
+ afterCheckValue(internalData.inputLabel);
1070
+ const targetElem = refInputTarget.value;
1071
+ if (targetElem) {
1072
+ targetElem.blur();
1049
1073
  }
1050
1074
  }
1075
+ };
1076
+ const handleGlobalResizeEvent = () => {
1077
+ const { visiblePanel } = reactData;
1051
1078
  if (visiblePanel) {
1052
- if (isEsc || isTab) {
1053
- hidePanel();
1054
- }
1079
+ updatePlacement();
1055
1080
  }
1056
- }
1057
- };
1058
- const handleGlobalBlurEvent = () => {
1059
- const { isActivated, visiblePanel } = reactData;
1060
- if (visiblePanel) {
1061
- hidePanel();
1062
- }
1063
- if (isActivated) {
1064
- reactData.isActivated = false;
1065
- }
1066
- if (visiblePanel || isActivated) {
1067
- afterCheckValue(internalData.inputLabel);
1081
+ };
1082
+ const handleGlobalScrollEvent = () => {
1083
+ const { visiblePanel } = reactData;
1084
+ if (visiblePanel) {
1085
+ updatePlacement();
1086
+ }
1087
+ };
1088
+ const updateZindex = () => {
1089
+ const popupOpts = computePopupOpts.value;
1090
+ const customZIndex = popupOpts.zIndex || props.zIndex;
1091
+ if (customZIndex) {
1092
+ reactData.panelIndex = XEUtils.toNumber(customZIndex);
1093
+ } else if (reactData.panelIndex < getLastZIndex()) {
1094
+ reactData.panelIndex = nextZIndex();
1095
+ }
1096
+ };
1097
+ const updatePlacement = () => {
1098
+ const { placement } = props;
1099
+ const { panelIndex } = reactData;
1068
1100
  const targetElem = refInputTarget.value;
1069
- if (targetElem) {
1070
- targetElem.blur();
1071
- }
1072
- }
1073
- };
1074
- const handleGlobalResizeEvent = () => {
1075
- const { visiblePanel } = reactData;
1076
- if (visiblePanel) {
1077
- updatePlacement();
1078
- }
1079
- };
1080
- const handleGlobalScrollEvent = () => {
1081
- const { visiblePanel } = reactData;
1082
- if (visiblePanel) {
1083
- updatePlacement();
1084
- }
1085
- };
1086
- const updateZindex = () => {
1087
- const popupOpts = computePopupOpts.value;
1088
- const customZIndex = popupOpts.zIndex || props.zIndex;
1089
- if (customZIndex) {
1090
- reactData.panelIndex = XEUtils.toNumber(customZIndex);
1091
- } else if (reactData.panelIndex < getLastZIndex()) {
1092
- reactData.panelIndex = nextZIndex();
1093
- }
1094
- };
1095
- const updatePlacement = () => {
1096
- const { placement } = props;
1097
- const { panelIndex } = reactData;
1098
- const targetElem = refInputTarget.value;
1099
- const panelElem = refInputPanel.value;
1100
- if (!panelElem) {
1101
+ const panelElem = refInputPanel.value;
1102
+ if (!panelElem) {
1103
+ return nextTick();
1104
+ }
1105
+ const btnTransfer = computeBtnTransfer.value;
1106
+ const popupOpts = computePopupOpts.value;
1107
+ const handleStyle = () => {
1108
+ const ppObj = updatePanelPlacement(targetElem, panelElem, {
1109
+ placement: popupOpts.placement || placement,
1110
+ defaultPlacement: popupOpts.defaultPlacement,
1111
+ appendTo: popupOpts.appendTo,
1112
+ teleportTo: btnTransfer
1113
+ });
1114
+ const panelStyle = Object.assign(ppObj.style, {
1115
+ zIndex: panelIndex
1116
+ });
1117
+ reactData.panelStyle = panelStyle;
1118
+ reactData.panelPlacement = ppObj.placement;
1119
+ };
1120
+ handleStyle();
1121
+ return nextTick().then(handleStyle);
1122
+ };
1123
+ const showPanel = () => {
1124
+ const { visiblePanel } = reactData;
1125
+ const isDisabled = computeIsDisabled.value;
1126
+ if (!isDisabled && !visiblePanel) {
1127
+ if (!reactData.initialized) {
1128
+ reactData.initialized = true;
1129
+ }
1130
+ if (internalData.hpTimeout) {
1131
+ clearTimeout(internalData.hpTimeout);
1132
+ internalData.hpTimeout = void 0;
1133
+ }
1134
+ reactData.isActivated = true;
1135
+ reactData.isAniVisible = true;
1136
+ setTimeout(() => {
1137
+ reactData.visiblePanel = true;
1138
+ updatePlacement();
1139
+ }, 10);
1140
+ updateZindex();
1141
+ return updatePlacement();
1142
+ }
1101
1143
  return nextTick();
1102
- }
1103
- const btnTransfer = computeBtnTransfer.value;
1104
- const popupOpts = computePopupOpts.value;
1105
- const handleStyle = () => {
1106
- const ppObj = updatePanelPlacement(targetElem, panelElem, {
1107
- placement: popupOpts.placement || placement,
1108
- defaultPlacement: popupOpts.defaultPlacement,
1109
- appendTo: popupOpts.appendTo,
1110
- teleportTo: btnTransfer
1111
- });
1112
- const panelStyle = Object.assign(ppObj.style, {
1113
- zIndex: panelIndex
1114
- });
1115
- reactData.panelStyle = panelStyle;
1116
- reactData.panelPlacement = ppObj.placement;
1117
1144
  };
1118
- handleStyle();
1119
- return nextTick().then(handleStyle);
1120
- };
1121
- const showPanel = () => {
1122
- const { visiblePanel } = reactData;
1123
- const isDisabled = computeIsDisabled.value;
1124
- if (!isDisabled && !visiblePanel) {
1125
- if (!reactData.initialized) {
1126
- reactData.initialized = true;
1127
- }
1128
- if (internalData.hpTimeout) {
1129
- clearTimeout(internalData.hpTimeout);
1130
- internalData.hpTimeout = void 0;
1145
+ const datePickerOpenEvent = (evnt) => {
1146
+ const formReadonly = computeFormReadonly.value;
1147
+ if (!formReadonly) {
1148
+ evnt.preventDefault();
1149
+ showPanel();
1131
1150
  }
1132
- reactData.isActivated = true;
1133
- reactData.isAniVisible = true;
1134
- setTimeout(() => {
1135
- reactData.visiblePanel = true;
1136
- updatePlacement();
1137
- }, 10);
1138
- updateZindex();
1139
- return updatePlacement();
1140
- }
1141
- return nextTick();
1142
- };
1143
- const datePickerOpenEvent = (evnt) => {
1144
- const formReadonly = computeFormReadonly.value;
1145
- if (!formReadonly) {
1146
- evnt.preventDefault();
1147
- showPanel();
1148
- }
1149
- };
1150
- const clickIconEvent = (evnt) => {
1151
- const { visiblePanel } = reactData;
1152
- const popupOpts = computePopupOpts.value;
1153
- const { trigger } = popupOpts;
1154
- if (!trigger || trigger === "default" || trigger === "icon") {
1155
- if (visiblePanel) {
1156
- hidePanel();
1157
- } else {
1158
- datePickerOpenEvent(evnt);
1151
+ };
1152
+ const clickIconEvent = (evnt) => {
1153
+ const { visiblePanel } = reactData;
1154
+ const popupOpts = computePopupOpts.value;
1155
+ const { trigger } = popupOpts;
1156
+ if (!trigger || trigger === "default" || trigger === "icon") {
1157
+ if (visiblePanel) {
1158
+ hidePanel();
1159
+ } else {
1160
+ datePickerOpenEvent(evnt);
1161
+ }
1159
1162
  }
1160
- }
1161
- };
1162
- const handleShortcutEvent = ({ option, $event }) => {
1163
- const { type } = props;
1164
- const { inputValue } = reactData;
1165
- const shortcutOpts = computeShortcutOpts.value;
1166
- const { autoClose } = shortcutOpts;
1167
- const { code, clickMethod } = option;
1168
- let value = inputValue;
1169
- const shortcutParams = {
1170
- $datePicker: $xeDatePicker,
1171
- option,
1172
- value,
1173
- code
1174
1163
  };
1175
- if (!clickMethod && code) {
1176
- const gCommandOpts = commands.get(code);
1177
- const dpCommandMethod = gCommandOpts ? gCommandOpts.datePickerCommandMethod : null;
1178
- if (dpCommandMethod) {
1179
- dpCommandMethod(shortcutParams);
1180
- } else {
1181
- const dateValueFormat = computeDateValueFormat.value;
1182
- const firstDayOfWeek = computeFirstDayOfWeek.value;
1183
- switch (code) {
1184
- case "now":
1185
- case "prev":
1186
- case "next":
1187
- case "minus":
1188
- case "plus": {
1189
- const restObj = getDateByCode(code, value, type, {
1190
- valueFormat: dateValueFormat,
1191
- firstDay: firstDayOfWeek
1192
- });
1193
- value = restObj.value;
1194
- shortcutParams.value = value;
1195
- handleChange(value, $event);
1196
- break;
1164
+ const handleShortcutEvent = ({ option, $event }) => {
1165
+ const { type } = props;
1166
+ const { inputValue } = reactData;
1167
+ const shortcutOpts = computeShortcutOpts.value;
1168
+ const { autoClose } = shortcutOpts;
1169
+ const { code, clickMethod } = option;
1170
+ let value = inputValue;
1171
+ const shortcutParams = {
1172
+ $datePicker: $xeDatePicker,
1173
+ option,
1174
+ value,
1175
+ code
1176
+ };
1177
+ if (!clickMethod && code) {
1178
+ const gCommandOpts = commands.get(code);
1179
+ const dpCommandMethod = gCommandOpts ? gCommandOpts.datePickerCommandMethod : null;
1180
+ if (dpCommandMethod) {
1181
+ dpCommandMethod(shortcutParams);
1182
+ } else {
1183
+ const dateValueFormat = computeDateValueFormat.value;
1184
+ const firstDayOfWeek = computeFirstDayOfWeek.value;
1185
+ switch (code) {
1186
+ case "now":
1187
+ case "prev":
1188
+ case "next":
1189
+ case "minus":
1190
+ case "plus": {
1191
+ const restObj = getDateByCode(code, value, type, {
1192
+ valueFormat: dateValueFormat,
1193
+ firstDay: firstDayOfWeek
1194
+ });
1195
+ value = restObj.value;
1196
+ shortcutParams.value = value;
1197
+ handleChange(value, $event);
1198
+ break;
1199
+ }
1200
+ default:
1201
+ errLog("vxe.error.notCommands", [code]);
1202
+ break;
1197
1203
  }
1198
- default:
1199
- errLog("vxe.error.notCommands", [code]);
1200
- break;
1204
+ }
1205
+ } else {
1206
+ const optClickMethod = clickMethod || shortcutOpts.clickMethod;
1207
+ if (optClickMethod) {
1208
+ optClickMethod(shortcutParams);
1201
1209
  }
1202
1210
  }
1203
- } else {
1204
- const optClickMethod = clickMethod || shortcutOpts.clickMethod;
1205
- if (optClickMethod) {
1206
- optClickMethod(shortcutParams);
1211
+ if (autoClose) {
1212
+ hidePanel();
1207
1213
  }
1208
- }
1209
- if (autoClose) {
1210
- hidePanel();
1211
- }
1212
- dispatchEvent("shortcut-click", shortcutParams, $event);
1213
- };
1214
- const dispatchEvent = (type, params, evnt) => {
1215
- emit(type, createEvent(evnt, { $datePicker: $xeDatePicker }, params));
1216
- };
1217
- const emitModel = (value) => {
1218
- emit("update:modelValue", value);
1219
- };
1220
- const datePickerMethods = {
1221
- dispatchEvent,
1222
- setModelValue(value) {
1223
- reactData.inputValue = value;
1224
- emitModel(value);
1225
- },
1226
- setModelValueByEvent(evnt, value) {
1227
- handleChange(value || "", evnt);
1228
- },
1229
- focus() {
1230
- const inputElem = refInputTarget.value;
1231
- reactData.isActivated = true;
1232
- inputElem.focus();
1233
- return nextTick();
1234
- },
1235
- blur() {
1236
- const inputElem = refInputTarget.value;
1237
- inputElem.blur();
1238
- reactData.isActivated = false;
1239
- return nextTick();
1240
- },
1241
- select() {
1242
- const inputElem = refInputTarget.value;
1243
- inputElem.select();
1244
- reactData.isActivated = false;
1245
- return nextTick();
1246
- },
1247
- showPanel,
1248
- hidePanel,
1249
- updatePlacement
1250
- };
1251
- Object.assign($xeDatePicker, datePickerMethods);
1252
- const renderShortcutBtn = (pos, isVertical) => {
1253
- const shortcutOpts = computeShortcutOpts.value;
1254
- const { position, align, mode } = shortcutOpts;
1255
- const shortcutList = computeShortcutList.value;
1256
- if (isEnableConf(shortcutOpts) && shortcutList.length && (position || "left") === pos) {
1257
- return h(
1258
- "div",
1259
- {
1260
- class: `vxe-date-picker--layout-${pos}-wrapper`
1261
- },
1262
- [
1263
- h(VxeButtonGroupComponent, {
1264
- options: shortcutList,
1265
- mode,
1266
- align,
1267
- vertical: isVertical,
1268
- onClick: handleShortcutEvent
1269
- })
1270
- ]
1271
- );
1272
- }
1273
- return renderEmptyElement($xeDatePicker);
1274
- };
1275
- const renderPanel = () => {
1276
- const popupOpts = computePopupOpts.value;
1277
- if (popupOpts.enabled === false) {
1278
- return renderEmptyElement($xeDatePicker);
1279
- }
1280
- const { type, multiple, showClearButton, showConfirmButton } = props;
1281
- const { initialized, isAniVisible, visiblePanel, panelPlacement, panelStyle, inputValue } = reactData;
1282
- const vSize = computeSize.value;
1283
- const btnTransfer = computeBtnTransfer.value;
1284
- const shortcutOpts = computeShortcutOpts.value;
1285
- const isClearable = computeIsClearable.value;
1286
- const isTimeOrDateTimeType = computeIsTimeOrDateTimeType.value;
1287
- const shortcutList = computeShortcutList.value;
1288
- const timeOpts = computeTimeOpts.value;
1289
- const dateStartDate = computeDateStartDate.value;
1290
- const dateEndDate = computeDateEndDate.value;
1291
- const { appendTo } = popupOpts;
1292
- const { position } = shortcutOpts;
1293
- const headerSlot = slots.header;
1294
- const footerSlot = slots.footer;
1295
- const topSlot = slots.top;
1296
- const bottomSlot = slots.bottom;
1297
- const leftSlot = slots.left;
1298
- const rightSlot = slots.right;
1299
- const ppClassName = popupOpts.className;
1300
- const hasShortcutBtn = shortcutList.length > 0;
1301
- const showConfirmBtn = showConfirmButton === null ? isTimeOrDateTimeType || multiple : showConfirmButton;
1302
- const showClearBtn = showClearButton === null ? isClearable && showConfirmBtn && type !== "time" : showClearButton;
1303
- return h(
1304
- Teleport,
1305
- {
1306
- to: getPopupContainer(appendTo),
1307
- disabled: btnTransfer ? !initialized : true
1214
+ dispatchEvent("shortcut-click", shortcutParams, $event);
1215
+ };
1216
+ const dispatchEvent = (type, params, evnt) => {
1217
+ emit(type, createEvent(evnt, { $datePicker: $xeDatePicker }, params));
1218
+ };
1219
+ const emitModel = (value) => {
1220
+ emit("update:modelValue", value);
1221
+ };
1222
+ const datePickerMethods = {
1223
+ dispatchEvent,
1224
+ setModelValue(value) {
1225
+ reactData.inputValue = value;
1226
+ emitModel(value);
1308
1227
  },
1309
- [
1310
- h(
1311
- "div",
1312
- {
1313
- ref: refInputPanel,
1314
- class: [
1315
- "vxe-table--ignore-clear vxe-date-picker--panel",
1316
- `type--${type}`,
1317
- ppClassName ? XEUtils.isFunction(ppClassName) ? ppClassName({ $datePicker: $xeDatePicker }) : ppClassName : "",
1318
- {
1319
- [`size--${vSize}`]: vSize,
1320
- "is--transfer": btnTransfer,
1321
- "ani--leave": isAniVisible,
1322
- "ani--enter": visiblePanel,
1323
- "show--top": !!(topSlot || headerSlot || hasShortcutBtn && (position === "top" || position === "header")),
1324
- "show--bottom": !!(bottomSlot || footerSlot || hasShortcutBtn && (position === "bottom" || position === "footer")),
1325
- "show--left": !!(leftSlot || hasShortcutBtn && position === "left"),
1326
- "show--right": !!(rightSlot || hasShortcutBtn && position === "right")
1327
- }
1328
- ],
1329
- placement: panelPlacement,
1330
- style: panelStyle
1331
- },
1332
- initialized && (visiblePanel || isAniVisible) ? [
1333
- h(
1334
- "div",
1335
- {
1336
- ref: refPanelWrapper,
1337
- class: [
1338
- "vxe-date-picker--layout-all-wrapper",
1339
- `type--${type}`,
1340
- {
1341
- [`size--${vSize}`]: vSize
1342
- }
1343
- ]
1344
- },
1345
- [
1346
- topSlot ? h(
1347
- "div",
1348
- {
1349
- class: "vxe-date-picker--layout-top-wrapper"
1350
- },
1351
- topSlot({})
1352
- ) : renderShortcutBtn("top"),
1353
- h(
1354
- "div",
1355
- {
1356
- class: "vxe-date-picker--layout-body-layout-wrapper"
1357
- },
1358
- [
1359
- leftSlot ? h(
1360
- "div",
1361
- {
1362
- class: "vxe-date-picker--layout-left-wrapper"
1363
- },
1364
- leftSlot({})
1365
- ) : renderShortcutBtn("left", true),
1366
- h(
1367
- "div",
1368
- {
1369
- class: "vxe-date-picker--layout-body-content-wrapper"
1370
- },
1371
- [
1372
- headerSlot ? h(
1373
- "div",
1374
- {
1375
- class: "vxe-date-picker--layout-header-wrapper"
1376
- },
1377
- headerSlot({})
1378
- ) : renderShortcutBtn("header"),
1379
- h(
1380
- "div",
1381
- {
1382
- class: "vxe-date-picker--layout-body-wrapper"
1383
- },
1384
- [
1385
- h(VxeDatePanelComponent, {
1386
- ref: refDatePanel,
1387
- modelValue: reactData.inputValue,
1388
- type: props.type,
1389
- className: props.className,
1390
- multiple: props.multiple,
1391
- limitCount: props.limitCount,
1392
- startDate: dateStartDate,
1393
- endDate: dateEndDate,
1394
- defaultDate: props.defaultDate,
1395
- defaultTime: props.defaultTime,
1396
- minDate: props.minDate,
1397
- maxDate: props.maxDate,
1398
- startDay: props.startDay,
1399
- labelFormat: props.labelFormat,
1400
- valueFormat: props.valueFormat,
1401
- timeFormat: props.timeFormat,
1402
- timeConfig: timeOpts,
1403
- festivalMethod: props.festivalMethod || defaultFuncProps.festivalMethod,
1404
- disabledMethod: props.disabledMethod || defaultFuncProps.disabledMethod,
1405
- selectDay: props.selectDay,
1406
- onChange: panelChangeEvent,
1407
- onConfirm: panelConfirmEvent,
1408
- onRevert: panelRevertEvent
1409
- })
1410
- ]
1411
- ),
1412
- h(
1413
- "div",
1414
- {
1415
- class: "vxe-date-picker--layout-footer-wrapper"
1416
- },
1417
- [
1418
- h(
1419
- "div",
1420
- {
1421
- class: "vxe-date-picker--layout-footer-custom"
1422
- },
1423
- footerSlot ? footerSlot({}) : [renderShortcutBtn("footer")]
1424
- ),
1425
- showClearBtn || showConfirmBtn ? h(
1426
- "div",
1427
- {
1428
- class: "vxe-date-picker--layout-footer-btns"
1429
- },
1430
- [
1431
- showClearBtn ? h(VxeButtonComponent, {
1432
- size: "mini",
1433
- disabled: inputValue === "" || XEUtils.eqNull(inputValue),
1434
- content: getI18n("vxe.button.clear"),
1435
- onClick: clearValueEvent
1436
- }) : renderEmptyElement($xeDatePicker),
1437
- showConfirmBtn ? h(VxeButtonComponent, {
1438
- size: "mini",
1439
- status: "primary",
1440
- content: getI18n("vxe.button.confirm"),
1441
- onClick: confirmEvent
1442
- }) : renderEmptyElement($xeDatePicker)
1443
- ]
1444
- ) : renderEmptyElement($xeDatePicker)
1445
- ]
1446
- )
1447
- ]
1448
- ),
1449
- rightSlot ? h(
1450
- "div",
1451
- {
1452
- class: "vxe-date-picker--layout-right-wrapper"
1453
- },
1454
- rightSlot({})
1455
- ) : renderShortcutBtn("right", true)
1456
- ]
1457
- ),
1458
- bottomSlot ? h(
1459
- "div",
1460
- {
1461
- class: "vxe-date-picker--layout-bottom-wrapper"
1462
- },
1463
- bottomSlot({})
1464
- ) : renderShortcutBtn("bottom")
1465
- ]
1466
- )
1467
- ] : []
1468
- )
1469
- ]
1470
- );
1471
- };
1472
- const renderPrefixIcon = () => {
1473
- const { prefixIcon } = props;
1474
- const prefixSlot = slots.prefix;
1475
- return prefixSlot || prefixIcon ? h(
1476
- "div",
1477
- {
1478
- class: "vxe-date-picker--prefix",
1479
- onClick: clickPrefixEvent
1228
+ setModelValueByEvent(evnt, value) {
1229
+ handleChange(value || "", evnt);
1480
1230
  },
1481
- [
1482
- h(
1483
- "div",
1484
- {
1485
- class: "vxe-date-picker--prefix-icon"
1486
- },
1487
- prefixSlot ? getSlotVNs(prefixSlot({})) : [
1488
- h("i", {
1489
- class: prefixIcon
1490
- })
1491
- ]
1492
- )
1493
- ]
1494
- ) : null;
1495
- };
1496
- const renderSuffixIcon = () => {
1497
- const { suffixIcon } = props;
1498
- const { inputValue } = reactData;
1499
- const suffixSlot = slots.suffix;
1500
- const isDisabled = computeIsDisabled.value;
1501
- const isClearable = computeIsClearable.value;
1502
- return h(
1503
- "div",
1504
- {
1505
- class: [
1506
- "vxe-date-picker--suffix",
1507
- {
1508
- "is--clear": isClearable && !isDisabled && !(inputValue === "" || XEUtils.eqNull(inputValue))
1509
- }
1510
- ]
1231
+ focus() {
1232
+ const inputElem = refInputTarget.value;
1233
+ reactData.isActivated = true;
1234
+ inputElem.focus();
1235
+ return nextTick();
1236
+ },
1237
+ blur() {
1238
+ const inputElem = refInputTarget.value;
1239
+ inputElem.blur();
1240
+ reactData.isActivated = false;
1241
+ return nextTick();
1511
1242
  },
1512
- [
1513
- isClearable ? h(
1243
+ select() {
1244
+ const inputElem = refInputTarget.value;
1245
+ inputElem.select();
1246
+ reactData.isActivated = false;
1247
+ return nextTick();
1248
+ },
1249
+ showPanel,
1250
+ hidePanel,
1251
+ updatePlacement
1252
+ };
1253
+ Object.assign($xeDatePicker, datePickerMethods);
1254
+ const renderShortcutBtn = (pos, isVertical) => {
1255
+ const shortcutOpts = computeShortcutOpts.value;
1256
+ const { position, align, mode } = shortcutOpts;
1257
+ const shortcutList = computeShortcutList.value;
1258
+ if (isEnableConf(shortcutOpts) && shortcutList.length && (position || "left") === pos) {
1259
+ return h(
1514
1260
  "div",
1515
1261
  {
1516
- class: "vxe-date-picker--clear-icon",
1517
- onClick: clearValueEvent
1262
+ class: `vxe-date-picker--layout-${pos}-wrapper`
1518
1263
  },
1519
1264
  [
1520
- h("i", {
1521
- class: getIcon().INPUT_CLEAR
1265
+ h(VxeButtonGroupComponent, {
1266
+ options: shortcutList,
1267
+ mode,
1268
+ align,
1269
+ vertical: isVertical,
1270
+ onClick: handleShortcutEvent
1522
1271
  })
1523
1272
  ]
1524
- ) : renderEmptyElement($xeDatePicker),
1525
- renderExtraSuffixIcon(),
1526
- suffixSlot || suffixIcon ? h(
1527
- "div",
1528
- {
1529
- class: "vxe-date-picker--suffix-icon",
1530
- onClick: clickSuffixEvent
1531
- },
1532
- suffixSlot ? getSlotVNs(suffixSlot({})) : [
1533
- h("i", {
1534
- class: suffixIcon
1535
- })
1273
+ );
1274
+ }
1275
+ return renderEmptyElement($xeDatePicker);
1276
+ };
1277
+ const renderPanel = () => {
1278
+ const popupOpts = computePopupOpts.value;
1279
+ if (popupOpts.enabled === false) {
1280
+ return renderEmptyElement($xeDatePicker);
1281
+ }
1282
+ const { type, multiple, showClearButton, showConfirmButton } = props;
1283
+ const { initialized, isAniVisible, visiblePanel, panelPlacement, panelStyle, inputValue } = reactData;
1284
+ const vSize = computeSize.value;
1285
+ const btnTransfer = computeBtnTransfer.value;
1286
+ const shortcutOpts = computeShortcutOpts.value;
1287
+ const isClearable = computeIsClearable.value;
1288
+ const isTimeOrDateTimeType = computeIsTimeOrDateTimeType.value;
1289
+ const shortcutList = computeShortcutList.value;
1290
+ const timeOpts = computeTimeOpts.value;
1291
+ const dateStartDate = computeDateStartDate.value;
1292
+ const dateEndDate = computeDateEndDate.value;
1293
+ const { appendTo } = popupOpts;
1294
+ const { position } = shortcutOpts;
1295
+ const headerSlot = slots.header;
1296
+ const footerSlot = slots.footer;
1297
+ const topSlot = slots.top;
1298
+ const bottomSlot = slots.bottom;
1299
+ const leftSlot = slots.left;
1300
+ const rightSlot = slots.right;
1301
+ const ppClassName = popupOpts.className;
1302
+ const hasShortcutBtn = shortcutList.length > 0;
1303
+ const showConfirmBtn = showConfirmButton === null ? isTimeOrDateTimeType || multiple : showConfirmButton;
1304
+ const showClearBtn = showClearButton === null ? isClearable && showConfirmBtn && type !== "time" : showClearButton;
1305
+ return h(
1306
+ Teleport,
1307
+ {
1308
+ to: getPopupContainer(appendTo),
1309
+ disabled: btnTransfer ? !initialized : true
1310
+ },
1311
+ [
1312
+ h(
1313
+ "div",
1314
+ {
1315
+ ref: refInputPanel,
1316
+ class: [
1317
+ "vxe-table--ignore-clear vxe-date-picker--panel",
1318
+ `type--${type}`,
1319
+ ppClassName ? XEUtils.isFunction(ppClassName) ? ppClassName({ $datePicker: $xeDatePicker }) : ppClassName : "",
1320
+ {
1321
+ [`size--${vSize}`]: vSize,
1322
+ "is--transfer": btnTransfer,
1323
+ "ani--leave": isAniVisible,
1324
+ "ani--enter": visiblePanel,
1325
+ "show--top": !!(topSlot || headerSlot || hasShortcutBtn && (position === "top" || position === "header")),
1326
+ "show--bottom": !!(bottomSlot || footerSlot || hasShortcutBtn && (position === "bottom" || position === "footer")),
1327
+ "show--left": !!(leftSlot || hasShortcutBtn && position === "left"),
1328
+ "show--right": !!(rightSlot || hasShortcutBtn && position === "right")
1329
+ }
1330
+ ],
1331
+ placement: panelPlacement,
1332
+ style: panelStyle
1333
+ },
1334
+ initialized && (visiblePanel || isAniVisible) ? [
1335
+ h(
1336
+ "div",
1337
+ {
1338
+ ref: refPanelWrapper,
1339
+ class: [
1340
+ "vxe-date-picker--layout-all-wrapper",
1341
+ `type--${type}`,
1342
+ {
1343
+ [`size--${vSize}`]: vSize
1344
+ }
1345
+ ]
1346
+ },
1347
+ [
1348
+ topSlot ? h(
1349
+ "div",
1350
+ {
1351
+ class: "vxe-date-picker--layout-top-wrapper"
1352
+ },
1353
+ topSlot({})
1354
+ ) : renderShortcutBtn("top"),
1355
+ h(
1356
+ "div",
1357
+ {
1358
+ class: "vxe-date-picker--layout-body-layout-wrapper"
1359
+ },
1360
+ [
1361
+ leftSlot ? h(
1362
+ "div",
1363
+ {
1364
+ class: "vxe-date-picker--layout-left-wrapper"
1365
+ },
1366
+ leftSlot({})
1367
+ ) : renderShortcutBtn("left", true),
1368
+ h(
1369
+ "div",
1370
+ {
1371
+ class: "vxe-date-picker--layout-body-content-wrapper"
1372
+ },
1373
+ [
1374
+ headerSlot ? h(
1375
+ "div",
1376
+ {
1377
+ class: "vxe-date-picker--layout-header-wrapper"
1378
+ },
1379
+ headerSlot({})
1380
+ ) : renderShortcutBtn("header"),
1381
+ h(
1382
+ "div",
1383
+ {
1384
+ class: "vxe-date-picker--layout-body-wrapper"
1385
+ },
1386
+ [
1387
+ h(VxeDatePanelComponent, {
1388
+ ref: refDatePanel,
1389
+ modelValue: reactData.inputValue,
1390
+ type: props.type,
1391
+ className: props.className,
1392
+ multiple: props.multiple,
1393
+ limitCount: props.limitCount,
1394
+ startDate: dateStartDate,
1395
+ endDate: dateEndDate,
1396
+ defaultDate: props.defaultDate,
1397
+ defaultTime: props.defaultTime,
1398
+ minDate: props.minDate,
1399
+ maxDate: props.maxDate,
1400
+ startDay: props.startDay,
1401
+ labelFormat: props.labelFormat,
1402
+ valueFormat: props.valueFormat,
1403
+ timeFormat: props.timeFormat,
1404
+ timeConfig: timeOpts,
1405
+ festivalMethod: props.festivalMethod || defaultFuncProps.festivalMethod,
1406
+ disabledMethod: props.disabledMethod || defaultFuncProps.disabledMethod,
1407
+ selectDay: props.selectDay,
1408
+ onChange: panelChangeEvent,
1409
+ onConfirm: panelConfirmEvent,
1410
+ onRevert: panelRevertEvent
1411
+ })
1412
+ ]
1413
+ ),
1414
+ h(
1415
+ "div",
1416
+ {
1417
+ class: "vxe-date-picker--layout-footer-wrapper"
1418
+ },
1419
+ [
1420
+ h(
1421
+ "div",
1422
+ {
1423
+ class: "vxe-date-picker--layout-footer-custom"
1424
+ },
1425
+ footerSlot ? footerSlot({}) : [renderShortcutBtn("footer")]
1426
+ ),
1427
+ showClearBtn || showConfirmBtn ? h(
1428
+ "div",
1429
+ {
1430
+ class: "vxe-date-picker--layout-footer-btns"
1431
+ },
1432
+ [
1433
+ showClearBtn ? h(VxeButtonComponent, {
1434
+ size: "mini",
1435
+ disabled: inputValue === "" || XEUtils.eqNull(inputValue),
1436
+ content: getI18n("vxe.button.clear"),
1437
+ onClick: clearValueEvent
1438
+ }) : renderEmptyElement($xeDatePicker),
1439
+ showConfirmBtn ? h(VxeButtonComponent, {
1440
+ size: "mini",
1441
+ status: "primary",
1442
+ content: getI18n("vxe.button.confirm"),
1443
+ onClick: confirmEvent
1444
+ }) : renderEmptyElement($xeDatePicker)
1445
+ ]
1446
+ ) : renderEmptyElement($xeDatePicker)
1447
+ ]
1448
+ )
1449
+ ]
1450
+ ),
1451
+ rightSlot ? h(
1452
+ "div",
1453
+ {
1454
+ class: "vxe-date-picker--layout-right-wrapper"
1455
+ },
1456
+ rightSlot({})
1457
+ ) : renderShortcutBtn("right", true)
1458
+ ]
1459
+ ),
1460
+ bottomSlot ? h(
1461
+ "div",
1462
+ {
1463
+ class: "vxe-date-picker--layout-bottom-wrapper"
1464
+ },
1465
+ bottomSlot({})
1466
+ ) : renderShortcutBtn("bottom")
1467
+ ]
1468
+ )
1469
+ ] : []
1470
+ )
1471
+ ]
1472
+ );
1473
+ };
1474
+ const renderPrefixIcon = () => {
1475
+ const { prefixIcon } = props;
1476
+ const prefixSlot = slots.prefix;
1477
+ return prefixSlot || prefixIcon ? h(
1478
+ "div",
1479
+ {
1480
+ class: "vxe-date-picker--prefix",
1481
+ onClick: clickPrefixEvent
1482
+ },
1483
+ [
1484
+ h(
1485
+ "div",
1486
+ {
1487
+ class: "vxe-date-picker--prefix-icon"
1488
+ },
1489
+ prefixSlot ? getSlotVNs(prefixSlot({})) : [
1490
+ h("i", {
1491
+ class: prefixIcon
1492
+ })
1493
+ ]
1494
+ )
1495
+ ]
1496
+ ) : null;
1497
+ };
1498
+ const renderSuffixIcon = () => {
1499
+ const { suffixIcon } = props;
1500
+ const { inputValue } = reactData;
1501
+ const suffixSlot = slots.suffix;
1502
+ const isDisabled = computeIsDisabled.value;
1503
+ const isClearable = computeIsClearable.value;
1504
+ return h(
1505
+ "div",
1506
+ {
1507
+ class: [
1508
+ "vxe-date-picker--suffix",
1509
+ {
1510
+ "is--clear": isClearable && !isDisabled && !(inputValue === "" || XEUtils.eqNull(inputValue))
1511
+ }
1536
1512
  ]
1537
- ) : renderEmptyElement($xeDatePicker)
1538
- ]
1539
- );
1540
- };
1541
- const renderExtraSuffixIcon = () => {
1542
- return h(
1543
- "div",
1544
- {
1545
- class: "vxe-date-picker--control-icon",
1546
- onClick: clickIconEvent
1547
- },
1548
- [
1549
- h("i", {
1550
- class: ["vxe-date-picker--date-picker-icon", getIcon().DATE_PICKER_DATE]
1551
- })
1552
- ]
1553
- );
1554
- };
1555
- const renderVN = () => {
1556
- const { className, inputClassName, type, name, autoComplete } = props;
1557
- const { inputValue, visiblePanel, isActivated, labelFlag } = reactData;
1558
- const { inputLabel } = internalData;
1559
- const vSize = computeSize.value;
1560
- const isDisabled = computeIsDisabled.value;
1561
- const formReadonly = computeFormReadonly.value;
1562
- const panelLabel = computePanelLabel.value;
1563
- if (formReadonly) {
1513
+ },
1514
+ [
1515
+ isClearable ? h(
1516
+ "div",
1517
+ {
1518
+ class: "vxe-date-picker--clear-icon",
1519
+ onClick: clearValueEvent
1520
+ },
1521
+ [
1522
+ h("i", {
1523
+ class: getIcon().INPUT_CLEAR
1524
+ })
1525
+ ]
1526
+ ) : renderEmptyElement($xeDatePicker),
1527
+ renderExtraSuffixIcon(),
1528
+ suffixSlot || suffixIcon ? h(
1529
+ "div",
1530
+ {
1531
+ class: "vxe-date-picker--suffix-icon",
1532
+ onClick: clickSuffixEvent
1533
+ },
1534
+ suffixSlot ? getSlotVNs(suffixSlot({})) : [
1535
+ h("i", {
1536
+ class: suffixIcon
1537
+ })
1538
+ ]
1539
+ ) : renderEmptyElement($xeDatePicker)
1540
+ ]
1541
+ );
1542
+ };
1543
+ const renderExtraSuffixIcon = () => {
1564
1544
  return h(
1565
1545
  "div",
1566
1546
  {
1567
- ref: refElem,
1568
- class: ["vxe-date-picker--readonly", `type--${type}`, className]
1547
+ class: "vxe-date-picker--control-icon",
1548
+ onClick: clickIconEvent
1569
1549
  },
1570
- panelLabel
1550
+ [
1551
+ h("i", {
1552
+ class: ["vxe-date-picker--date-picker-icon", getIcon().DATE_PICKER_DATE]
1553
+ })
1554
+ ]
1571
1555
  );
1572
- }
1573
- const currStyle = computeCurrStyle.value;
1574
- const inputReadonly = computeInputReadonly.value;
1575
- const inpPlaceholder = computeInpPlaceholder.value;
1576
- const isClearable = computeIsClearable.value;
1577
- const prefix = renderPrefixIcon();
1578
- const suffix = renderSuffixIcon();
1579
- return h(
1580
- "div",
1581
- {
1582
- ref: refElem,
1583
- class: [
1584
- "vxe-date-picker",
1585
- `type--${type}`,
1586
- className,
1587
- {
1588
- [`size--${vSize}`]: vSize,
1589
- "is--prefix": !!prefix,
1590
- "is--suffix": !!suffix,
1591
- "is--visible": visiblePanel,
1592
- "is--disabled": isDisabled,
1593
- "is--active": isActivated,
1594
- "show--clear": isClearable && !isDisabled && !(inputValue === "" || XEUtils.eqNull(inputValue))
1595
- }
1596
- ],
1597
- style: currStyle,
1598
- spellcheck: false
1599
- },
1600
- [
1601
- prefix || renderEmptyElement($xeDatePicker),
1602
- h(
1556
+ };
1557
+ const renderVN = () => {
1558
+ const { className, inputClassName, type, name, autoComplete } = props;
1559
+ const { inputValue, visiblePanel, isActivated, labelFlag } = reactData;
1560
+ const { inputLabel } = internalData;
1561
+ const vSize = computeSize.value;
1562
+ const isDisabled = computeIsDisabled.value;
1563
+ const formReadonly = computeFormReadonly.value;
1564
+ const panelLabel = computePanelLabel.value;
1565
+ if (formReadonly) {
1566
+ return h(
1603
1567
  "div",
1604
1568
  {
1605
- class: "vxe-date-picker--wrapper"
1569
+ ref: refElem,
1570
+ class: ["vxe-date-picker--readonly", `type--${type}`, className]
1606
1571
  },
1607
- [
1608
- h("input", {
1609
- ref: refInputTarget,
1610
- class: "vxe-date-picker--inner" + (inputClassName ? " " + inputClassName : ""),
1611
- value: labelFlag ? inputLabel : "",
1612
- name,
1613
- type: "text",
1614
- placeholder: inpPlaceholder,
1615
- readonly: inputReadonly,
1616
- disabled: isDisabled,
1617
- autocomplete: autoComplete,
1618
- onKeydown: keydownEvent,
1619
- onKeyup: keyupEvent,
1620
- onClick: clickEvent,
1621
- onInput: inputEvent,
1622
- onChange: changeEvent,
1623
- onFocus: focusEvent,
1624
- onBlur: blurEvent
1625
- })
1626
- ]
1627
- ),
1628
- suffix || renderEmptyElement($xeDatePicker),
1629
- // 下拉面板
1630
- renderPanel()
1631
- ]
1572
+ panelLabel
1573
+ );
1574
+ }
1575
+ const currStyle = computeCurrStyle.value;
1576
+ const inputReadonly = computeInputReadonly.value;
1577
+ const inpPlaceholder = computeInpPlaceholder.value;
1578
+ const isClearable = computeIsClearable.value;
1579
+ const prefix = renderPrefixIcon();
1580
+ const suffix = renderSuffixIcon();
1581
+ return h(
1582
+ "div",
1583
+ {
1584
+ ref: refElem,
1585
+ class: [
1586
+ "vxe-date-picker",
1587
+ `type--${type}`,
1588
+ className,
1589
+ {
1590
+ [`size--${vSize}`]: vSize,
1591
+ "is--prefix": !!prefix,
1592
+ "is--suffix": !!suffix,
1593
+ "is--visible": visiblePanel,
1594
+ "is--disabled": isDisabled,
1595
+ "is--active": isActivated,
1596
+ "show--clear": isClearable && !isDisabled && !(inputValue === "" || XEUtils.eqNull(inputValue))
1597
+ }
1598
+ ],
1599
+ style: currStyle,
1600
+ spellcheck: false
1601
+ },
1602
+ [
1603
+ prefix || renderEmptyElement($xeDatePicker),
1604
+ h(
1605
+ "div",
1606
+ {
1607
+ class: "vxe-date-picker--wrapper"
1608
+ },
1609
+ [
1610
+ h("input", {
1611
+ ref: refInputTarget,
1612
+ class: "vxe-date-picker--inner" + (inputClassName ? " " + inputClassName : ""),
1613
+ value: labelFlag ? inputLabel : "",
1614
+ name,
1615
+ type: "text",
1616
+ placeholder: inpPlaceholder,
1617
+ readonly: inputReadonly,
1618
+ disabled: isDisabled,
1619
+ autocomplete: autoComplete,
1620
+ onKeydown: keydownEvent,
1621
+ onKeyup: keyupEvent,
1622
+ onClick: clickEvent,
1623
+ onInput: inputEvent,
1624
+ onChange: changeEvent,
1625
+ onFocus: focusEvent,
1626
+ onBlur: blurEvent
1627
+ })
1628
+ ]
1629
+ ),
1630
+ suffix || renderEmptyElement($xeDatePicker),
1631
+ // 下拉面板
1632
+ renderPanel()
1633
+ ]
1634
+ );
1635
+ };
1636
+ watch(computePanelLabel, (val) => {
1637
+ handleInputLabel(val, true);
1638
+ });
1639
+ watch(
1640
+ () => props.modelValue,
1641
+ () => {
1642
+ updateModelValue();
1643
+ }
1632
1644
  );
1633
- };
1634
- watch(computePanelLabel, (val) => {
1635
- handleInputLabel(val, true);
1636
- });
1637
- watch(
1638
- () => props.modelValue,
1639
- () => {
1640
- updateModelValue();
1641
- }
1642
- );
1643
- updateModelValue();
1644
- nextTick(() => {
1645
- globalEvents.on($xeDatePicker, "mousedown", handleGlobalMousedownEvent);
1646
- globalEvents.on($xeDatePicker, "keydown", handleGlobalKeydownEvent);
1647
- globalEvents.on($xeDatePicker, "blur", handleGlobalBlurEvent);
1648
- globalEvents.on($xeDatePicker, "resize", handleGlobalResizeEvent);
1649
- globalEvents.on($xeDatePicker, "scroll", handleGlobalScrollEvent);
1650
- });
1651
- onMounted(() => {
1652
- const { type, multiple, maskedConfig } = props;
1653
- if (isEnableConf(maskedConfig)) {
1654
- if (multiple) {
1655
- errLog("vxe.error.notSupportProp", ["multiple", "masked-config.enabled=true", "masked-config.enabled=false"]);
1645
+ updateModelValue();
1646
+ nextTick(() => {
1647
+ globalEvents.on($xeDatePicker, "mousedown", handleGlobalMousedownEvent);
1648
+ globalEvents.on($xeDatePicker, "keydown", handleGlobalKeydownEvent);
1649
+ globalEvents.on($xeDatePicker, "blur", handleGlobalBlurEvent);
1650
+ globalEvents.on($xeDatePicker, "resize", handleGlobalResizeEvent);
1651
+ globalEvents.on($xeDatePicker, "scroll", handleGlobalScrollEvent);
1652
+ });
1653
+ onMounted(() => {
1654
+ const { type, multiple, maskedConfig } = props;
1655
+ if (isEnableConf(maskedConfig)) {
1656
+ if (multiple) {
1657
+ errLog("vxe.error.notSupportProp", ["multiple", "masked-config.enabled=true", "masked-config.enabled=false"]);
1658
+ }
1659
+ if (!maskedTypes.includes(type)) {
1660
+ warnLog("vxe.error.notSupportProp", ["masked-config.enabled=true", `type=${type}`, `type=${maskedTypes.join("|")}`]);
1661
+ }
1656
1662
  }
1657
- if (!maskedTypes.includes(type)) {
1658
- warnLog("vxe.error.notSupportProp", ["masked-config.enabled=true", `type=${type}`, `type=${maskedTypes.join("|")}`]);
1659
- }
1660
- }
1661
- });
1662
- onUnmounted(() => {
1663
- globalEvents.off($xeDatePicker, "mousedown");
1664
- globalEvents.off($xeDatePicker, "keydown");
1665
- globalEvents.off($xeDatePicker, "blur");
1666
- globalEvents.off($xeDatePicker, "resize");
1667
- globalEvents.off($xeDatePicker, "scroll");
1668
- XEUtils.assign(reactData, createReactData());
1669
- XEUtils.assign(internalData, createInternalData());
1670
- });
1671
- provide("$xeDatePicker", $xeDatePicker);
1672
- $xeDatePicker.renderVN = renderVN;
1673
- return $xeDatePicker;
1674
- },
1675
- render() {
1676
- return this.renderVN();
1677
- }
1678
- });
1663
+ });
1664
+ onUnmounted(() => {
1665
+ globalEvents.off($xeDatePicker, "mousedown");
1666
+ globalEvents.off($xeDatePicker, "keydown");
1667
+ globalEvents.off($xeDatePicker, "blur");
1668
+ globalEvents.off($xeDatePicker, "resize");
1669
+ globalEvents.off($xeDatePicker, "scroll");
1670
+ XEUtils.assign(reactData, createReactData());
1671
+ XEUtils.assign(internalData, createInternalData());
1672
+ });
1673
+ provide("$xeDatePicker", $xeDatePicker);
1674
+ $xeDatePicker.renderVN = renderVN;
1675
+ return $xeDatePicker;
1676
+ },
1677
+ render() {
1678
+ return this.renderVN();
1679
+ }
1680
+ })
1681
+ );
1679
1682
  export {
1680
1683
  date_picker_default as default
1681
1684
  };