@tplc/wot 1.0.7 → 1.0.8

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 (518) hide show
  1. package/CHANGELOG.md +7 -0
  2. package/components/common/AbortablePromise.ts +3 -11
  3. package/components/common/abstracts/_config.scss +1 -1
  4. package/components/common/abstracts/_function.scss +26 -13
  5. package/components/common/abstracts/_mixin.scss +117 -71
  6. package/components/common/abstracts/variable.scss +325 -697
  7. package/components/common/base64.ts +1 -2
  8. package/components/common/canvasHelper.ts +1 -1
  9. package/components/common/interceptor.ts +43 -0
  10. package/components/common/props.ts +8 -8
  11. package/components/common/util.ts +145 -60
  12. package/components/composables/index.ts +11 -0
  13. package/components/composables/useChildren.ts +9 -18
  14. package/components/composables/useCountDown.ts +2 -2
  15. package/components/composables/useLockScroll.ts +1 -3
  16. package/components/composables/useParent.ts +4 -4
  17. package/components/composables/usePopover.ts +43 -60
  18. package/components/composables/useQueue.ts +2 -2
  19. package/components/composables/useTouch.ts +2 -3
  20. package/components/composables/useTranslate.ts +2 -13
  21. package/components/composables/useUpload.ts +389 -0
  22. package/components/wd-action-sheet/index.scss +22 -22
  23. package/components/wd-action-sheet/types.ts +11 -21
  24. package/components/wd-action-sheet/wd-action-sheet.vue +21 -40
  25. package/components/wd-backtop/index.scss +5 -5
  26. package/components/wd-backtop/types.ts +3 -15
  27. package/components/wd-backtop/wd-backtop.vue +12 -20
  28. package/components/wd-badge/index.scss +14 -10
  29. package/components/wd-badge/types.ts +6 -9
  30. package/components/wd-badge/wd-badge.vue +29 -37
  31. package/components/wd-button/index.scss +76 -80
  32. package/components/wd-button/types.ts +43 -13
  33. package/components/wd-button/wd-button.vue +41 -22
  34. package/components/wd-calendar/index.scss +58 -145
  35. package/components/wd-calendar/types.ts +23 -41
  36. package/components/wd-calendar/wd-calendar.vue +123 -130
  37. package/components/wd-calendar-view/month/index.scss +33 -65
  38. package/components/wd-calendar-view/month/month.vue +80 -113
  39. package/components/wd-calendar-view/month/types.ts +2 -1
  40. package/components/wd-calendar-view/monthPanel/index.scss +15 -15
  41. package/components/wd-calendar-view/monthPanel/month-panel.vue +64 -78
  42. package/components/wd-calendar-view/monthPanel/types.ts +58 -10
  43. package/components/wd-calendar-view/types.ts +12 -36
  44. package/components/wd-calendar-view/utils.ts +14 -36
  45. package/components/wd-calendar-view/wd-calendar-view.vue +7 -7
  46. package/components/wd-calendar-view/year/index.scss +18 -13
  47. package/components/wd-calendar-view/year/types.ts +2 -1
  48. package/components/wd-calendar-view/year/year.vue +25 -43
  49. package/components/wd-calendar-view/yearPanel/index.scss +4 -4
  50. package/components/wd-calendar-view/yearPanel/types.ts +2 -2
  51. package/components/wd-calendar-view/yearPanel/year-panel.vue +36 -41
  52. package/components/wd-card/index.scss +11 -10
  53. package/components/wd-card/types.ts +1 -1
  54. package/components/wd-card/wd-card.vue +6 -9
  55. package/components/wd-cell/index.scss +56 -41
  56. package/components/wd-cell/types.ts +23 -8
  57. package/components/wd-cell/wd-cell.vue +48 -18
  58. package/components/wd-cell-group/index.scss +8 -7
  59. package/components/wd-cell-group/types.ts +1 -1
  60. package/components/wd-cell-group/wd-cell-group.vue +5 -5
  61. package/components/wd-checkbox/index.scss +35 -35
  62. package/components/wd-checkbox/types.ts +6 -6
  63. package/components/wd-checkbox/wd-checkbox.vue +12 -20
  64. package/components/wd-checkbox-group/index.scss +4 -4
  65. package/components/wd-checkbox-group/types.ts +2 -2
  66. package/components/wd-checkbox-group/wd-checkbox-group.vue +9 -12
  67. package/components/wd-circle/index.scss +5 -5
  68. package/components/wd-circle/types.ts +2 -2
  69. package/components/wd-circle/wd-circle.vue +18 -40
  70. package/components/wd-col/index.scss +2 -2
  71. package/components/wd-col/types.ts +1 -1
  72. package/components/wd-col/wd-col.vue +11 -53
  73. package/components/wd-col-picker/index.scss +41 -115
  74. package/components/wd-col-picker/types.ts +10 -14
  75. package/components/wd-col-picker/wd-col-picker.vue +103 -155
  76. package/components/wd-collapse/index.scss +7 -13
  77. package/components/wd-collapse/types.ts +4 -10
  78. package/components/wd-collapse/wd-collapse.vue +22 -55
  79. package/components/wd-collapse-item/index.scss +16 -5
  80. package/components/wd-collapse-item/types.ts +14 -2
  81. package/components/wd-collapse-item/wd-collapse-item.vue +70 -81
  82. package/components/wd-config-provider/types.ts +69 -40
  83. package/components/wd-config-provider/wd-config-provider.vue +11 -11
  84. package/components/wd-count-down/index.scss +3 -2
  85. package/components/wd-count-down/types.ts +1 -1
  86. package/components/wd-count-down/wd-count-down.vue +5 -5
  87. package/components/wd-count-to/index.scss +2 -1
  88. package/components/wd-count-to/types.ts +10 -3
  89. package/components/wd-count-to/wd-count-to.vue +9 -18
  90. package/components/wd-curtain/index.scss +28 -23
  91. package/components/wd-curtain/types.ts +46 -9
  92. package/components/wd-curtain/wd-curtain.vue +45 -47
  93. package/components/wd-datetime-picker/index.scss +65 -145
  94. package/components/wd-datetime-picker/types.ts +41 -31
  95. package/components/wd-datetime-picker/wd-datetime-picker.vue +307 -333
  96. package/components/wd-datetime-picker-view/types.ts +29 -46
  97. package/components/wd-datetime-picker-view/util.ts +30 -0
  98. package/components/wd-datetime-picker-view/wd-datetime-picker-view.vue +104 -119
  99. package/components/wd-divider/index.scss +78 -10
  100. package/components/wd-divider/types.ts +26 -3
  101. package/components/wd-divider/wd-divider.vue +33 -10
  102. package/components/wd-drop-menu/index.scss +17 -45
  103. package/components/wd-drop-menu/types.ts +3 -3
  104. package/components/wd-drop-menu/wd-drop-menu.vue +61 -25
  105. package/components/wd-drop-menu-item/index.scss +15 -15
  106. package/components/wd-drop-menu-item/types.ts +18 -15
  107. package/components/wd-drop-menu-item/wd-drop-menu-item.vue +33 -54
  108. package/components/wd-fab/index.scss +13 -12
  109. package/components/wd-fab/types.ts +9 -4
  110. package/components/wd-fab/wd-fab.vue +70 -51
  111. package/components/wd-floating-panel/index.scss +64 -0
  112. package/components/wd-floating-panel/type.ts +32 -0
  113. package/components/wd-floating-panel/wd-floating-panel.vue +140 -0
  114. package/components/wd-form/types.ts +8 -16
  115. package/components/wd-form/wd-form.vue +67 -45
  116. package/components/wd-form-item/index.scss +3 -2
  117. package/components/wd-form-item/types.ts +2 -8
  118. package/components/wd-form-item/wd-form-item.vue +3 -3
  119. package/components/wd-grid/index.scss +2 -2
  120. package/components/wd-grid/types.ts +5 -0
  121. package/components/wd-grid/wd-grid.vue +11 -12
  122. package/components/wd-grid-item/index.scss +44 -33
  123. package/components/wd-grid-item/types.ts +7 -4
  124. package/components/wd-grid-item/wd-grid-item.vue +39 -44
  125. package/components/wd-icon/index.scss +311 -303
  126. package/components/wd-icon/types.ts +3 -3
  127. package/components/wd-icon/wd-icon.vue +6 -6
  128. package/components/wd-img/types.ts +1 -1
  129. package/components/wd-img/wd-img.vue +12 -4
  130. package/components/wd-img-cropper/index.scss +43 -39
  131. package/components/wd-img-cropper/types.ts +6 -8
  132. package/components/wd-img-cropper/wd-img-cropper.vue +132 -127
  133. package/components/wd-index-anchor/index.scss +7 -6
  134. package/components/wd-index-anchor/type.ts +2 -2
  135. package/components/wd-index-anchor/wd-index-anchor.vue +3 -9
  136. package/components/wd-index-bar/index.scss +5 -5
  137. package/components/wd-index-bar/type.ts +3 -2
  138. package/components/wd-index-bar/wd-index-bar.vue +15 -51
  139. package/components/wd-input/index.scss +44 -33
  140. package/components/wd-input/types.ts +40 -19
  141. package/components/wd-input/wd-input.vue +58 -42
  142. package/components/wd-input-number/index.scss +23 -31
  143. package/components/wd-input-number/types.ts +42 -14
  144. package/components/wd-input-number/wd-input-number.vue +374 -141
  145. package/components/wd-keyboard/constants.ts +81 -0
  146. package/components/wd-keyboard/index.scss +102 -0
  147. package/components/wd-keyboard/key/index.scss +79 -0
  148. package/components/wd-keyboard/key/index.vue +71 -0
  149. package/components/wd-keyboard/key/types.ts +11 -0
  150. package/components/wd-keyboard/types.ts +92 -0
  151. package/components/wd-keyboard/wd-keyboard.vue +206 -0
  152. package/components/wd-loading/index.scss +9 -6
  153. package/components/wd-loading/types.ts +1 -1
  154. package/components/wd-loading/wd-loading.vue +9 -9
  155. package/components/wd-loadmore/index.scss +5 -5
  156. package/components/wd-loadmore/types.ts +8 -2
  157. package/components/wd-loadmore/wd-loadmore.vue +28 -13
  158. package/components/wd-message-box/index.scss +21 -34
  159. package/components/wd-message-box/index.ts +30 -29
  160. package/components/wd-message-box/types.ts +33 -8
  161. package/components/wd-message-box/wd-message-box.vue +130 -152
  162. package/components/wd-navbar/index.scss +14 -24
  163. package/components/wd-navbar/types.ts +1 -1
  164. package/components/wd-navbar/wd-navbar.vue +14 -45
  165. package/components/wd-navbar-capsule/index.scss +16 -15
  166. package/components/wd-navbar-capsule/types.ts +8 -0
  167. package/components/wd-navbar-capsule/wd-navbar-capsule.vue +8 -4
  168. package/components/wd-notice-bar/index.scss +15 -33
  169. package/components/wd-notice-bar/types.ts +14 -3
  170. package/components/wd-notice-bar/wd-notice-bar.vue +109 -66
  171. package/components/wd-notify/index.scss +5 -5
  172. package/components/wd-notify/index.ts +17 -15
  173. package/components/wd-notify/types.ts +4 -0
  174. package/components/wd-notify/wd-notify.vue +21 -19
  175. package/components/wd-number-keyboard/index.scss +10 -10
  176. package/components/wd-number-keyboard/key/index.scss +7 -5
  177. package/components/wd-number-keyboard/key/index.vue +6 -9
  178. package/components/wd-number-keyboard/key/types.ts +1 -1
  179. package/components/wd-number-keyboard/types.ts +4 -0
  180. package/components/wd-number-keyboard/wd-number-keyboard.vue +22 -44
  181. package/components/wd-overlay/index.scss +3 -3
  182. package/components/wd-overlay/types.ts +2 -2
  183. package/components/wd-overlay/wd-overlay.vue +7 -15
  184. package/components/wd-pagination/index.scss +17 -17
  185. package/components/wd-pagination/types.ts +1 -1
  186. package/components/wd-pagination/wd-pagination.vue +10 -21
  187. package/components/wd-password-input/index.scss +7 -6
  188. package/components/wd-password-input/types.ts +2 -8
  189. package/components/wd-password-input/wd-password-input.vue +6 -15
  190. package/components/wd-picker/index.scss +46 -153
  191. package/components/wd-picker/types.ts +22 -19
  192. package/components/wd-picker/wd-picker.vue +89 -86
  193. package/components/wd-picker-view/index.scss +13 -12
  194. package/components/wd-picker-view/types.ts +16 -26
  195. package/components/wd-picker-view/wd-picker-view.vue +32 -24
  196. package/components/wd-popover/index.scss +29 -36
  197. package/components/wd-popover/types.ts +1 -1
  198. package/components/wd-popover/wd-popover.vue +20 -56
  199. package/components/wd-popup/index.scss +47 -75
  200. package/components/wd-popup/types.ts +40 -4
  201. package/components/wd-popup/wd-popup.vue +100 -157
  202. package/components/wd-progress/index.scss +20 -14
  203. package/components/wd-progress/types.ts +10 -6
  204. package/components/wd-progress/wd-progress.vue +137 -141
  205. package/components/wd-radio/index.scss +54 -53
  206. package/components/wd-radio/types.ts +15 -6
  207. package/components/wd-radio/wd-radio.vue +41 -59
  208. package/components/wd-radio-group/index.scss +5 -5
  209. package/components/wd-radio-group/types.ts +4 -1
  210. package/components/wd-radio-group/wd-radio-group.vue +6 -9
  211. package/components/wd-rate/index.scss +1 -1
  212. package/components/wd-rate/types.ts +10 -5
  213. package/components/wd-rate/wd-rate.vue +35 -17
  214. package/components/wd-resize/index.scss +2 -1
  215. package/components/wd-resize/types.ts +1 -1
  216. package/components/wd-resize/wd-resize.vue +11 -22
  217. package/components/wd-root-portal/wd-root-portal.vue +50 -0
  218. package/components/wd-row/index.scss +1 -1
  219. package/components/wd-row/types.ts +1 -1
  220. package/components/wd-row/wd-row.vue +14 -35
  221. package/components/wd-search/index.scss +29 -29
  222. package/components/wd-search/types.ts +22 -3
  223. package/components/wd-search/wd-search.vue +70 -120
  224. package/components/wd-segmented/index.scss +19 -15
  225. package/components/wd-segmented/types.ts +16 -4
  226. package/components/wd-segmented/wd-segmented.vue +34 -34
  227. package/components/wd-select-picker/index.scss +55 -122
  228. package/components/wd-select-picker/types.ts +29 -36
  229. package/components/wd-select-picker/wd-select-picker.vue +128 -274
  230. package/components/wd-sidebar/index.scss +5 -5
  231. package/components/wd-sidebar/types.ts +22 -3
  232. package/components/wd-sidebar/wd-sidebar.vue +26 -4
  233. package/components/wd-sidebar-item/index.scss +17 -13
  234. package/components/wd-sidebar-item/types.ts +3 -3
  235. package/components/wd-sidebar-item/wd-sidebar-item.vue +12 -10
  236. package/components/wd-signature/index.scss +31 -0
  237. package/components/wd-signature/types.ts +263 -0
  238. package/components/wd-signature/wd-signature.vue +630 -0
  239. package/components/wd-skeleton/index.scss +8 -13
  240. package/components/wd-skeleton/types.ts +6 -6
  241. package/components/wd-skeleton/wd-skeleton.vue +15 -31
  242. package/components/wd-slider/index.scss +24 -17
  243. package/components/wd-slider/types.ts +45 -17
  244. package/components/wd-slider/wd-slider.vue +275 -297
  245. package/components/wd-sort-button/index.scss +10 -7
  246. package/components/wd-sort-button/types.ts +1 -1
  247. package/components/wd-sort-button/wd-sort-button.vue +7 -14
  248. package/components/wd-status-tip/index.scss +8 -8
  249. package/components/wd-status-tip/types.ts +8 -2
  250. package/components/wd-status-tip/wd-status-tip.vue +14 -37
  251. package/components/wd-step/index.scss +29 -30
  252. package/components/wd-step/types.ts +1 -1
  253. package/components/wd-step/wd-step.vue +8 -9
  254. package/components/wd-steps/index.scss +1 -1
  255. package/components/wd-steps/types.ts +1 -1
  256. package/components/wd-steps/wd-steps.vue +5 -5
  257. package/components/wd-sticky/index.scss +1 -1
  258. package/components/wd-sticky/types.ts +1 -1
  259. package/components/wd-sticky/wd-sticky.vue +21 -29
  260. package/components/wd-sticky-box/index.scss +1 -1
  261. package/components/wd-sticky-box/wd-sticky-box.vue +7 -6
  262. package/components/wd-swipe-action/index.scss +1 -1
  263. package/components/wd-swipe-action/types.ts +2 -5
  264. package/components/wd-swipe-action/wd-swipe-action.vue +9 -22
  265. package/components/wd-swiper-nav/index.scss +22 -16
  266. package/components/wd-swiper-nav/types.ts +1 -9
  267. package/components/wd-swiper-nav/wd-swiper-nav.vue +2 -5
  268. package/components/wd-switch/index.scss +15 -15
  269. package/components/wd-switch/types.ts +8 -6
  270. package/components/wd-switch/wd-switch.vue +15 -15
  271. package/components/wd-tab/index.scss +11 -3
  272. package/components/wd-tab/types.ts +11 -1
  273. package/components/wd-tab/wd-tab.vue +28 -36
  274. package/components/wd-tabbar/index.scss +12 -7
  275. package/components/wd-tabbar/types.ts +3 -18
  276. package/components/wd-tabbar/wd-tabbar.vue +10 -23
  277. package/components/wd-tabbar-item/index.scss +15 -12
  278. package/components/wd-tabbar-item/types.ts +3 -3
  279. package/components/wd-tabbar-item/wd-tabbar-item.vue +11 -13
  280. package/components/wd-table/index.scss +40 -9
  281. package/components/wd-table/types.ts +13 -15
  282. package/components/wd-table/wd-table.vue +123 -94
  283. package/components/wd-table-col/index.scss +6 -4
  284. package/components/wd-table-col/types.ts +1 -1
  285. package/components/wd-table-col/wd-table-col.vue +12 -12
  286. package/components/wd-tag/index.scss +19 -19
  287. package/components/wd-tag/types.ts +1 -1
  288. package/components/wd-tag/wd-tag.vue +14 -20
  289. package/components/wd-text/index.scss +4 -1
  290. package/components/wd-text/types.ts +4 -4
  291. package/components/wd-text/wd-text.vue +12 -11
  292. package/components/wd-textarea/index.scss +51 -41
  293. package/components/wd-textarea/types.ts +24 -34
  294. package/components/wd-textarea/wd-textarea.vue +59 -66
  295. package/components/wd-toast/index.scss +31 -18
  296. package/components/wd-toast/index.ts +26 -43
  297. package/components/wd-toast/types.ts +117 -3
  298. package/components/wd-toast/wd-toast.vue +49 -69
  299. package/components/wd-tooltip/index.scss +21 -16
  300. package/components/wd-tooltip/types.ts +8 -3
  301. package/components/wd-tooltip/wd-tooltip.vue +17 -43
  302. package/components/wd-tour/index.scss +123 -0
  303. package/components/wd-tour/types.ts +153 -0
  304. package/components/wd-tour/wd-tour.vue +509 -0
  305. package/components/wd-transition/index.scss +39 -35
  306. package/components/wd-transition/types.ts +27 -9
  307. package/components/wd-transition/wd-transition.vue +45 -34
  308. package/components/wd-upload/index.scss +23 -21
  309. package/components/wd-upload/types.ts +43 -30
  310. package/components/wd-upload/wd-upload.vue +183 -247
  311. package/components/wd-video-preview/index.scss +9 -9
  312. package/components/wd-video-preview/types.ts +1 -1
  313. package/components/wd-video-preview/wd-video-preview.vue +18 -22
  314. package/components/wd-watermark/index.scss +7 -7
  315. package/components/wd-watermark/types.ts +2 -8
  316. package/components/wd-watermark/wd-watermark.vue +38 -135
  317. package/dayjs/constant.js +26 -0
  318. package/dayjs/index.d.ts +430 -0
  319. package/dayjs/index.js +542 -0
  320. package/dayjs/locale/en.js +13 -0
  321. package/dayjs/utils.js +59 -0
  322. package/global.d.ts +97 -91
  323. package/index.ts +2 -10
  324. package/locale/index.ts +3 -15
  325. package/locale/lang/ar-SA.ts +133 -0
  326. package/locale/lang/de-DE.ts +133 -0
  327. package/locale/lang/en-US.ts +31 -26
  328. package/locale/lang/es-ES.ts +133 -0
  329. package/locale/lang/fr-FR.ts +133 -0
  330. package/locale/lang/ja-JP.ts +133 -0
  331. package/locale/lang/ko-KR.ts +133 -0
  332. package/locale/lang/pt-PT.ts +133 -0
  333. package/locale/lang/ru-RU.ts +133 -0
  334. package/locale/lang/th-TH.ts +28 -22
  335. package/locale/lang/tr-TR.ts +138 -0
  336. package/locale/lang/ug-CN.ts +137 -0
  337. package/locale/lang/vi-VN.ts +27 -30
  338. package/locale/lang/zh-CN.ts +32 -22
  339. package/locale/lang/zh-HK.ts +18 -31
  340. package/locale/lang/zh-TW.ts +22 -31
  341. package/package.json +1 -1
  342. package/types/components/common/interceptor.d.ts +15 -0
  343. package/types/components/common/util.d.ts +61 -1
  344. package/types/components/composables/useCell.d.ts +1 -1
  345. package/types/components/composables/useLockScroll.d.ts +1 -2
  346. package/types/components/composables/useParent.d.ts +1 -1
  347. package/types/components/composables/usePopover.d.ts +2 -2
  348. package/types/components/composables/useUpload.d.ts +41 -0
  349. package/types/components/wd-action-sheet/types.d.ts +13 -4
  350. package/types/components/wd-action-sheet/wd-action-sheet.vue.d.ts +20 -11
  351. package/types/components/wd-backtop/types.d.ts +1 -9
  352. package/types/components/wd-backtop/wd-backtop.vue.d.ts +6 -25
  353. package/types/components/wd-badge/types.d.ts +3 -6
  354. package/types/components/wd-badge/wd-badge.vue.d.ts +7 -14
  355. package/types/components/wd-button/types.d.ts +44 -8
  356. package/types/components/wd-button/wd-button.vue.d.ts +13 -9
  357. package/types/components/wd-calendar/types.d.ts +24 -18
  358. package/types/components/wd-calendar/wd-calendar.vue.d.ts +48 -32
  359. package/types/components/wd-calendar-view/month/month.vue.d.ts +11 -3
  360. package/types/components/wd-calendar-view/month/types.d.ts +4 -0
  361. package/types/components/wd-calendar-view/monthPanel/month-panel.vue.d.ts +18 -12
  362. package/types/components/wd-calendar-view/monthPanel/types.d.ts +48 -6
  363. package/types/components/wd-calendar-view/types.d.ts +11 -4
  364. package/types/components/wd-calendar-view/utils.d.ts +3 -12
  365. package/types/components/wd-calendar-view/wd-calendar-view.vue.d.ts +1 -1
  366. package/types/components/wd-calendar-view/year/types.d.ts +4 -0
  367. package/types/components/wd-calendar-view/year/year.vue.d.ts +11 -3
  368. package/types/components/wd-cell/types.d.ts +37 -1
  369. package/types/components/wd-cell/wd-cell.vue.d.ts +53 -9
  370. package/types/components/wd-checkbox/wd-checkbox.vue.d.ts +2 -2
  371. package/types/components/wd-checkbox-group/wd-checkbox-group.vue.d.ts +2 -2
  372. package/types/components/wd-circle/wd-circle.vue.d.ts +3 -3
  373. package/types/components/wd-col-picker/types.d.ts +14 -0
  374. package/types/components/wd-col-picker/wd-col-picker.vue.d.ts +36 -19
  375. package/types/components/wd-collapse/types.d.ts +1 -5
  376. package/types/components/wd-collapse/wd-collapse.vue.d.ts +3 -11
  377. package/types/components/wd-collapse-item/types.d.ts +19 -1
  378. package/types/components/wd-collapse-item/wd-collapse-item.vue.d.ts +20 -1
  379. package/types/components/wd-config-provider/types.d.ts +64 -7
  380. package/types/components/wd-config-provider/wd-config-provider.vue.d.ts +1 -1
  381. package/types/components/wd-count-to/types.d.ts +11 -0
  382. package/types/components/wd-count-to/wd-count-to.vue.d.ts +13 -4
  383. package/types/components/wd-curtain/types.d.ts +56 -0
  384. package/types/components/wd-curtain/wd-curtain.vue.d.ts +152 -77
  385. package/types/components/wd-datetime-picker/types.d.ts +49 -15
  386. package/types/components/wd-datetime-picker/wd-datetime-picker.vue.d.ts +75 -38
  387. package/types/components/wd-datetime-picker-view/types.d.ts +36 -14
  388. package/types/components/wd-datetime-picker-view/util.d.ts +12 -0
  389. package/types/components/wd-datetime-picker-view/wd-datetime-picker-view.vue.d.ts +35 -9
  390. package/types/components/wd-divider/types.d.ts +32 -4
  391. package/types/components/wd-divider/wd-divider.vue.d.ts +30 -7
  392. package/types/components/wd-drop-menu/types.d.ts +3 -3
  393. package/types/components/wd-drop-menu/wd-drop-menu.vue.d.ts +8 -8
  394. package/types/components/wd-drop-menu-item/types.d.ts +27 -15
  395. package/types/components/wd-drop-menu-item/wd-drop-menu-item.vue.d.ts +47 -36
  396. package/types/components/wd-fab/types.d.ts +19 -3
  397. package/types/components/wd-fab/wd-fab.vue.d.ts +13 -1
  398. package/types/components/wd-floating-panel/type.d.ts +54 -0
  399. package/types/components/wd-floating-panel/wd-floating-panel.vue.d.ts +109 -0
  400. package/types/components/wd-form/types.d.ts +1 -1
  401. package/types/components/wd-form/wd-form.vue.d.ts +2 -2
  402. package/types/components/wd-form-item/wd-form-item.vue.d.ts +2 -2
  403. package/types/components/wd-grid/types.d.ts +5 -0
  404. package/types/components/wd-grid/wd-grid.vue.d.ts +2 -0
  405. package/types/components/wd-grid-item/types.d.ts +4 -1
  406. package/types/components/wd-grid-item/wd-grid-item.vue.d.ts +3 -3
  407. package/types/components/wd-icon/types.d.ts +1 -1
  408. package/types/components/wd-icon/wd-icon.vue.d.ts +3 -3
  409. package/types/components/wd-img/types.d.ts +4 -1
  410. package/types/components/wd-img/wd-img.vue.d.ts +11 -4
  411. package/types/components/wd-img-cropper/types.d.ts +7 -0
  412. package/types/components/wd-img-cropper/wd-img-cropper.vue.d.ts +12 -3
  413. package/types/components/wd-index-bar/type.d.ts +2 -1
  414. package/types/components/wd-index-bar/wd-index-bar.vue.d.ts +1 -5
  415. package/types/components/wd-input/types.d.ts +53 -37
  416. package/types/components/wd-input/wd-input.vue.d.ts +50 -52
  417. package/types/components/wd-input-number/types.d.ts +51 -6
  418. package/types/components/wd-input-number/wd-input-number.vue.d.ts +152 -125
  419. package/types/components/wd-keyboard/constants.d.ts +8 -0
  420. package/types/components/wd-keyboard/key/index.vue.d.ts +70 -0
  421. package/types/components/wd-keyboard/key/types.d.ts +23 -0
  422. package/types/components/wd-keyboard/types.d.ts +137 -0
  423. package/types/components/wd-keyboard/wd-keyboard.vue.d.ts +200 -0
  424. package/types/components/wd-loading/wd-loading.vue.d.ts +2 -2
  425. package/types/components/wd-loadmore/types.d.ts +7 -4
  426. package/types/components/wd-loadmore/wd-loadmore.vue.d.ts +5 -9
  427. package/types/components/wd-message-box/index.d.ts +3 -8
  428. package/types/components/wd-message-box/types.d.ts +36 -5
  429. package/types/components/wd-message-box/wd-message-box.vue.d.ts +18 -2
  430. package/types/components/wd-navbar/wd-navbar.vue.d.ts +3 -3
  431. package/types/components/wd-navbar-capsule/types.d.ts +12 -0
  432. package/types/components/wd-navbar-capsule/wd-navbar-capsule.vue.d.ts +27 -4
  433. package/types/components/wd-notice-bar/types.d.ts +9 -1
  434. package/types/components/wd-notice-bar/wd-notice-bar.vue.d.ts +7 -5
  435. package/types/components/wd-notify/types.d.ts +7 -0
  436. package/types/components/wd-notify/wd-notify.vue.d.ts +13 -4
  437. package/types/components/wd-number-keyboard/types.d.ts +7 -0
  438. package/types/components/wd-number-keyboard/wd-number-keyboard.vue.d.ts +18 -9
  439. package/types/components/wd-overlay/wd-overlay.vue.d.ts +2 -2
  440. package/types/components/wd-pagination/wd-pagination.vue.d.ts +1 -1
  441. package/types/components/wd-password-input/wd-password-input.vue.d.ts +2 -2
  442. package/types/components/wd-picker/types.d.ts +28 -2
  443. package/types/components/wd-picker/wd-picker.vue.d.ts +55 -19
  444. package/types/components/wd-picker-view/types.d.ts +10 -0
  445. package/types/components/wd-picker-view/wd-picker-view.vue.d.ts +15 -3
  446. package/types/components/wd-popover/wd-popover.vue.d.ts +4 -4
  447. package/types/components/wd-popup/types.d.ts +44 -5
  448. package/types/components/wd-popup/wd-popup.vue.d.ts +35 -24
  449. package/types/components/wd-progress/types.d.ts +6 -3
  450. package/types/components/wd-progress/wd-progress.vue.d.ts +4 -6
  451. package/types/components/wd-qr-code/uqrcode.vue.d.ts +3 -3
  452. package/types/components/wd-qr-code/wd-qr-code.vue.d.ts +4 -4
  453. package/types/components/wd-radio/types.d.ts +8 -0
  454. package/types/components/wd-radio/wd-radio.vue.d.ts +7 -0
  455. package/types/components/wd-radio-group/types.d.ts +7 -1
  456. package/types/components/wd-radio-group/wd-radio-group.vue.d.ts +11 -2
  457. package/types/components/wd-rate/types.d.ts +9 -0
  458. package/types/components/wd-rate/wd-rate.vue.d.ts +13 -4
  459. package/types/components/wd-root-portal/wd-root-portal.vue.d.ts +26 -0
  460. package/types/components/wd-search/types.d.ts +16 -1
  461. package/types/components/wd-search/wd-search.vue.d.ts +28 -8
  462. package/types/components/wd-segmented/types.d.ts +10 -1
  463. package/types/components/wd-segmented/wd-segmented.vue.d.ts +6 -4
  464. package/types/components/wd-select-picker/types.d.ts +37 -22
  465. package/types/components/wd-select-picker/wd-select-picker.vue.d.ts +59 -30
  466. package/types/components/wd-sidebar/types.d.ts +19 -3
  467. package/types/components/wd-sidebar/wd-sidebar.vue.d.ts +4 -2
  468. package/types/components/wd-signature/types.d.ts +252 -0
  469. package/types/components/wd-signature/wd-signature.vue.d.ts +229 -0
  470. package/types/components/wd-skeleton/types.d.ts +3 -4
  471. package/types/components/wd-skeleton/wd-skeleton.vue.d.ts +10 -10
  472. package/types/components/wd-slider/types.d.ts +39 -15
  473. package/types/components/wd-slider/wd-slider.vue.d.ts +12 -38
  474. package/types/components/wd-sort-button/wd-sort-button.vue.d.ts +3 -3
  475. package/types/components/wd-status-tip/types.d.ts +9 -0
  476. package/types/components/wd-status-tip/wd-status-tip.vue.d.ts +69 -49
  477. package/types/components/wd-steps/wd-steps.vue.d.ts +1 -1
  478. package/types/components/wd-sticky/wd-sticky.vue.d.ts +3 -7
  479. package/types/components/wd-swipe-action/wd-swipe-action.vue.d.ts +3 -3
  480. package/types/components/wd-swiper/wd-swiper.vue.d.ts +4 -4
  481. package/types/components/wd-swiper-nav/types.d.ts +0 -14
  482. package/types/components/wd-swiper-nav/wd-swiper-nav.vue.d.ts +0 -18
  483. package/types/components/wd-switch/types.d.ts +0 -1
  484. package/types/components/wd-switch/wd-switch.vue.d.ts +2 -5
  485. package/types/components/wd-tab/types.d.ts +16 -3
  486. package/types/components/wd-tab/wd-tab.vue.d.ts +12 -4
  487. package/types/components/wd-tabbar/types.d.ts +1 -1
  488. package/types/components/wd-tabbar/wd-tabbar.vue.d.ts +5 -5
  489. package/types/components/wd-tabbar-item/wd-tabbar-item.vue.d.ts +1 -1
  490. package/types/components/wd-table/types.d.ts +12 -8
  491. package/types/components/wd-table/wd-table.vue.d.ts +16 -13
  492. package/types/components/wd-table-col/wd-table-col.vue.d.ts +1 -1
  493. package/types/components/wd-tabs/wd-tabs.vue.d.ts +7 -7
  494. package/types/components/wd-tag/wd-tag.vue.d.ts +4 -4
  495. package/types/components/wd-text/types.d.ts +2 -2
  496. package/types/components/wd-text/wd-text.vue.d.ts +7 -7
  497. package/types/components/wd-textarea/types.d.ts +41 -39
  498. package/types/components/wd-textarea/wd-textarea.vue.d.ts +46 -46
  499. package/types/components/wd-toast/index.d.ts +1 -6
  500. package/types/components/wd-toast/types.d.ts +127 -5
  501. package/types/components/wd-toast/wd-toast.vue.d.ts +101 -0
  502. package/types/components/wd-tooltip/types.d.ts +1 -1
  503. package/types/components/wd-tooltip/wd-tooltip.vue.d.ts +7 -7
  504. package/types/components/wd-tour/types.d.ts +194 -0
  505. package/types/components/wd-tour/wd-tour.vue.d.ts +267 -0
  506. package/types/components/wd-transition/types.d.ts +22 -7
  507. package/types/components/wd-transition/wd-transition.vue.d.ts +33 -20
  508. package/types/components/wd-upload/types.d.ts +39 -10
  509. package/types/components/wd-upload/wd-upload.vue.d.ts +42 -16
  510. package/types/components/wd-watermark/wd-watermark.vue.d.ts +7 -7
  511. package/types/locale/index.d.ts +0 -3
  512. package/types/locale/lang/zh-CN.d.ts +9 -0
  513. package/components/wd-datetime-picker-view/index.scss +0 -0
  514. package/components/wd-form/index.scss +0 -10
  515. package/components/wd-upload/utils.ts +0 -152
  516. package/types/components/common/dayjs.d.ts +0 -26
  517. package/types/components/wd-upload/utils.d.ts +0 -11
  518. package/types/locale/lang/en-US.d.ts +0 -128
@@ -1,39 +1,39 @@
1
1
  <template>
2
- <view
3
- :class="`wd-input-number ${!bordered ? 'is-no-border' : ''} ${customClass} ${disabled ? 'is-disabled' : ''} ${withoutInput ? 'is-without-input' : ''}`"
4
- :style="customStyle"
5
- >
2
+ <view :class="`wd-input-number ${customClass} ${disabled ? 'is-disabled' : ''} ${withoutInput ? 'is-without-input' : ''}`" :style="customStyle">
3
+ <!-- 减号按钮 -->
6
4
  <view
7
5
  :class="`wd-input-number__action ${minDisabled || disableMinus ? 'is-disabled' : ''}`"
8
- @click="sub"
6
+ @click="handleClick('sub')"
7
+ @touchstart="handleTouchStart('sub')"
8
+ @touchend.stop="handleTouchEnd"
9
9
  >
10
- <slot name="decrease" />
11
- <wd-icon
12
- name="decrease"
13
- custom-class="wd-input-number__action-icon"
14
- v-if="!$slots.decrease"
15
- ></wd-icon>
10
+ <wd-icon name="decrease" custom-class="wd-input-number__action-icon"></wd-icon>
16
11
  </view>
12
+ <!-- 输入框 -->
17
13
  <view v-if="!withoutInput" class="wd-input-number__inner" @click.stop="">
18
14
  <input
19
15
  class="wd-input-number__input"
20
16
  :style="`${inputWidth ? 'width: ' + inputWidth : ''}`"
21
- type="digit"
17
+ :type="inputType"
18
+ :input-mode="precision ? 'decimal' : 'numeric'"
22
19
  :disabled="disabled || disableInput"
23
- v-model="inputValue"
20
+ :value="String(inputValue)"
24
21
  :placeholder="placeholder"
22
+ :adjust-position="adjustPosition"
25
23
  @input="handleInput"
26
24
  @focus="handleFocus"
27
25
  @blur="handleBlur"
28
26
  />
29
27
  <view class="wd-input-number__input-border"></view>
30
28
  </view>
29
+ <!-- 加号按钮 -->
31
30
  <view
32
31
  :class="`wd-input-number__action ${maxDisabled || disablePlus ? 'is-disabled' : ''}`"
33
- @click="add"
32
+ @click="handleClick('add')"
33
+ @touchstart="handleTouchStart('add')"
34
+ @touchend.stop="handleTouchEnd"
34
35
  >
35
- <slot name="increase" />
36
- <wd-icon name="add" custom-class="wd-input-number__action-icon" v-if="!$slots.increase" />
36
+ <wd-icon name="add" custom-class="wd-input-number__action-icon"></wd-icon>
37
37
  </view>
38
38
  </view>
39
39
  </template>
@@ -44,188 +44,421 @@ export default {
44
44
  options: {
45
45
  virtualHost: true,
46
46
  addGlobalClass: true,
47
- styleIsolation: 'shared',
48
- },
47
+ styleIsolation: 'shared'
48
+ }
49
49
  }
50
50
  </script>
51
51
 
52
52
  <script lang="ts" setup>
53
- import { ref, watch } from 'vue'
54
- import { debounce, isDef, isEqual } from '../common/util'
55
- import { inputNumberProps } from './types'
53
+ import wdIcon from '../wd-icon/wd-icon.vue'
54
+ import { computed, nextTick, ref, watch } from 'vue'
55
+ import { isDef, isEqual } from '../common/util'
56
+ import { inputNumberProps, type OperationType } from './types'
57
+ import { callInterceptor } from '../common/interceptor'
56
58
 
57
59
  const props = defineProps(inputNumberProps)
58
- const emit = defineEmits(['focus', 'blur', 'change', 'update:modelValue'])
59
-
60
- const minDisabled = ref<boolean>(false)
61
- const maxDisabled = ref<boolean>(false)
62
- const inputValue = ref<string | number>('') // 输入框的值
63
-
60
+ const emit = defineEmits<{
61
+ /**
62
+ * 数值变化事件
63
+ */
64
+ (e: 'change', value: { value: number | string }): void
65
+ /**
66
+ * 输入框聚焦事件
67
+ */
68
+ (e: 'focus', detail: any): void
69
+ /**
70
+ * 输入框失焦事件
71
+ */
72
+ (e: 'blur', value: { value: string | number }): void
73
+ /**
74
+ * v-model 更新事件
75
+ */
76
+ (e: 'update:modelValue', value: number | string): void
77
+ }>()
78
+ const inputValue = ref<string | number>(getInitValue())
79
+ let longPressTimer: ReturnType<typeof setTimeout> | null = null
80
+
81
+ /**
82
+ * 判断数字是否达到最小值限制
83
+ */
84
+ const minDisabled = computed(() => {
85
+ const val = toNumber(inputValue.value)
86
+ return props.disabled || val <= props.min || addStep(val, -props.step) < props.min
87
+ })
88
+
89
+ /**
90
+ * 判断数字是否达到最大值限制
91
+ */
92
+ const maxDisabled = computed(() => {
93
+ const val = toNumber(inputValue.value)
94
+ return props.disabled || val >= props.max || addStep(val, props.step) > props.max
95
+ })
96
+
97
+ // 监听 modelValue 变化
64
98
  watch(
65
99
  () => props.modelValue,
66
- (newValue) => {
67
- inputValue.value = newValue
68
- splitDisabled(newValue)
69
- },
70
- { immediate: true, deep: true },
100
+ (val) => {
101
+ inputValue.value = formatValue(val)
102
+ }
71
103
  )
72
104
 
73
- watch(
74
- [() => props.max, () => props.min],
75
- () => {
76
- updateBoundary(true)
77
- },
78
- { immediate: true, deep: true },
79
- )
105
+ // 监听 max, min, precision 变化时重新格式化当前值
106
+ watch([() => props.max, () => props.min, () => props.precision], () => {
107
+ const val = toNumber(inputValue.value)
108
+ inputValue.value = formatValue(val)
109
+ })
110
+
111
+ /**
112
+ * 获取初始值
113
+ */
114
+ function getInitValue() {
115
+ if (!props.updateOnInit) {
116
+ // 不自动修正时,仅做显示格式化,不修正值
117
+ return formatDisplay(props.modelValue)
118
+ }
80
119
 
81
- watch(
82
- () => props.disabled,
83
- (newValue) => {
84
- minDisabled.value = newValue
85
- maxDisabled.value = newValue
86
- },
87
- { immediate: true, deep: true },
88
- )
120
+ const formatted = formatValue(props.modelValue)
89
121
 
90
- function updateBoundary(formMaxMinDiff = false) {
91
- debounce(() => {
92
- const value = formatValue(inputValue.value)
93
- if (!isEqual(inputValue.value, value)) {
94
- setValue(value, true, formMaxMinDiff)
95
- }
96
- splitDisabled(value)
97
- }, 30)()
122
+ // 如果格式化后的值与原始值不同,同步到外部
123
+ if (!isEqual(String(formatted), String(props.modelValue))) {
124
+ emit('update:modelValue', formatted)
125
+ }
126
+ return formatted
98
127
  }
99
128
 
100
- function splitDisabled(value: number | string) {
101
- const { disabled, min, max, step } = props
102
- minDisabled.value = disabled || Number(value) <= min || changeStep(value, -step) < min
103
- maxDisabled.value = disabled || Number(value) >= max || changeStep(value, step) > max
129
+ /**
130
+ * 获取数字的小数位数
131
+ */
132
+ function getPrecision(val?: number) {
133
+ if (!isDef(val)) return 0
134
+ const str = val.toString()
135
+ const dotIndex = str.indexOf('.')
136
+ return dotIndex === -1 ? 0 : str.length - dotIndex - 1
104
137
  }
105
138
 
106
- function toPrecision(value: number) {
107
- return Number(
108
- parseFloat(
109
- `${Math.round(value * Math.pow(10, props.precision)) / Math.pow(10, props.precision)}`,
110
- ).toFixed(props.precision),
111
- )
139
+ /**
140
+ * 按指定精度处理数值
141
+ */
142
+ function toPrecision(val: number) {
143
+ const precision = Number(props.precision)
144
+ return Math.round(val * Math.pow(10, precision)) / Math.pow(10, precision)
112
145
  }
113
146
 
114
- function getPrecision(value?: number) {
115
- if (value === undefined) return 0
116
- const valueString = value.toString()
117
- const dotPosition = valueString.indexOf('.')
118
- let precision = 0
119
- if (dotPosition !== -1) {
120
- precision = valueString.length - dotPosition - 1
147
+ /**
148
+ * 将字符串或数字转换为标准数值
149
+ */
150
+ function toNumber(val: string | number): number {
151
+ // 空值处理
152
+ if (props.allowNull && (!isDef(val) || val === '')) {
153
+ return NaN
121
154
  }
122
- return precision
123
- }
124
155
 
125
- function toStrictlyStep(value: number | string) {
126
- const stepPrecision = getPrecision(props.step)
127
- const precisionFactory = Math.pow(10, stepPrecision)
128
- return (Math.round(Number(value) / props.step) * precisionFactory * props.step) / precisionFactory
156
+ if (!isDef(val) || val === '') {
157
+ return props.min
158
+ }
159
+
160
+ let str = String(val)
161
+
162
+ // 处理中间输入状态
163
+ if (str.endsWith('.')) str = str.slice(0, -1)
164
+ if (str.startsWith('.')) str = '0' + str
165
+ if (str.startsWith('-.')) str = '-0' + str.substring(1)
166
+ if (str === '-' || str === '') return props.min
167
+
168
+ let num = Number(str)
169
+ if (isNaN(num)) num = props.min
170
+
171
+ return normalizeValue(num)
129
172
  }
130
173
 
131
- function setValue(value: string | number, change: boolean = true, formMaxMinDiff = false) {
132
- if (props.allowNull && (!isDef(value) || value === '')) {
133
- dispatchChangeEvent(value, change, formMaxMinDiff)
134
- return
174
+ /**
175
+ * 标准化数值(应用步进、边界、精度规则)
176
+ */
177
+ function normalizeValue(val: number): number {
178
+ let result = val
179
+
180
+ // 严格步进
181
+ if (props.stepStrictly) {
182
+ const stepPrecision = getPrecision(props.step)
183
+ const factor = Math.pow(10, stepPrecision)
184
+ result = (Math.round(result / props.step) * factor * props.step) / factor
135
185
  }
136
186
 
187
+ // 边界限制
137
188
  if (props.stepStrictly) {
138
- value = toStrictlyStep(value)
189
+ result = applyStrictBounds(result, props.min, props.max)
190
+ } else {
191
+ result = Math.min(Math.max(result, props.min), props.max)
139
192
  }
140
- if ((value || value === 0) && props.precision !== undefined) {
141
- value = toPrecision(Number(value))
193
+
194
+ // 精度处理
195
+ if (isDef(props.precision)) {
196
+ result = toPrecision(result)
142
197
  }
143
- if (Number(value) > props.max) value = toPrecision(props.max)
144
- if (Number(value) < props.min) value = toPrecision(props.min)
145
- dispatchChangeEvent(value, change, formMaxMinDiff)
198
+
199
+ return result
146
200
  }
147
201
 
148
- function changeStep(val: string | number, step: number) {
149
- val = Number(val)
202
+ /**
203
+ * 严格步进模式下的边界处理
204
+ */
205
+ function applyStrictBounds(val: number, min: number, max: number): number {
206
+ if (val >= min && val <= max) return val
150
207
 
151
- if (isNaN(val)) {
152
- return props.min
208
+ const stepPrecision = getPrecision(props.step)
209
+ const factor = Math.pow(10, stepPrecision)
210
+
211
+ if (val < min) {
212
+ const minSteps = Math.ceil((min * factor) / (props.step * factor))
213
+ const candidate = toPrecision((minSteps * props.step * factor) / factor)
214
+ if (candidate > max) {
215
+ const maxSteps = Math.floor((max * factor) / (props.step * factor))
216
+ return toPrecision((maxSteps * props.step * factor) / factor)
217
+ }
218
+ return candidate
153
219
  }
154
220
 
155
- const precisionFactory = Math.pow(10, props.precision)
156
- return toPrecision((val * precisionFactory + step * precisionFactory) / precisionFactory)
221
+ if (val > max) {
222
+ const maxSteps = Math.floor((max * factor) / (props.step * factor))
223
+ const candidate = toPrecision((maxSteps * props.step * factor) / factor)
224
+ if (candidate < min) {
225
+ const minSteps = Math.ceil((min * factor) / (props.step * factor))
226
+ return toPrecision((minSteps * props.step * factor) / factor)
227
+ }
228
+ return candidate
229
+ }
230
+
231
+ return val
157
232
  }
158
233
 
159
- function sub() {
160
- if (minDisabled.value || props.disableMinus) return
234
+ /**
235
+ * 格式化值用于显示(包含修正逻辑)
236
+ */
237
+ function formatValue(val: string | number): string | number {
238
+ if (props.allowNull && (!isDef(val) || val === '')) {
239
+ return ''
240
+ }
161
241
 
162
- const newValue = changeStep(inputValue.value, -props.step)
163
- dispatchChangeEvent(newValue)
242
+ const num = toNumber(val)
243
+ const precision = Number(props.precision)
244
+ if (!isDef(props.precision)) {
245
+ return num
246
+ }
247
+ return precision === 0 ? Number(num.toFixed(0)) : num.toFixed(precision)
164
248
  }
165
249
 
166
- function add() {
167
- if (maxDisabled.value || props.disablePlus) return
250
+ /**
251
+ * 仅做显示格式化,不包含值修正逻辑
252
+ */
253
+ function formatDisplay(val: string | number): string | number {
254
+ if (props.allowNull && (!isDef(val) || val === '')) {
255
+ return ''
256
+ }
168
257
 
169
- const newValue = changeStep(inputValue.value, props.step)
170
- dispatchChangeEvent(newValue)
171
- }
258
+ if (!isDef(val) || val === '') {
259
+ return props.min
260
+ }
172
261
 
173
- function handleInput(event: any) {
174
- const value = event.detail.value || ''
175
- dispatchChangeEvent(value)
176
- }
262
+ let num = Number(val)
263
+ if (isNaN(num)) {
264
+ return props.min
265
+ }
177
266
 
178
- function handleFocus(event: any) {
179
- emit('focus', event.detail)
267
+ const precision = Number(props.precision)
268
+ if (!isDef(props.precision)) {
269
+ return num
270
+ }
271
+ return precision === 0 ? Number(num.toFixed(0)) : num.toFixed(precision)
180
272
  }
181
273
 
182
- function handleBlur() {
183
- const value = formatValue(inputValue.value)
184
- if (!isEqual(inputValue.value, value)) {
185
- setValue(value)
186
- }
187
- emit('blur', {
188
- value,
189
- })
274
+ /**
275
+ * 检查是否为中间输入状态
276
+ */
277
+ function isIntermediate(val: string): boolean {
278
+ if (!val) return false
279
+ const str = String(val)
280
+ return str.endsWith('.') || str.startsWith('.') || str.startsWith('-.') || str === '-' || (Number(props.precision) > 0 && str.indexOf('.') === -1)
190
281
  }
191
282
 
192
- function dispatchChangeEvent(
193
- value: string | number,
194
- change: boolean = true,
195
- formMaxMinDiff = false,
196
- ) {
197
- if (isEqual(inputValue.value, value)) {
198
- return
283
+ /**
284
+ * 清理输入值
285
+ */
286
+ function cleanInput(val: string): string {
287
+ if (!val) return ''
288
+
289
+ // 清理非数字、小数点、负号
290
+ let cleaned = val.replace(/[^\d.-]/g, '')
291
+
292
+ // 处理负号,保证负号只出现在最前面
293
+ const hasNegative = cleaned.startsWith('-')
294
+ cleaned = cleaned.replace(/-/g, '')
295
+ if (hasNegative) cleaned = '-' + cleaned
296
+
297
+ // 处理小数点
298
+ const precision = Number(props.precision)
299
+ if (precision > 0) {
300
+ const parts = cleaned.split('.')
301
+ if (parts.length > 2) {
302
+ cleaned = parts[0] + '.' + parts.slice(1).join('')
303
+ }
304
+ } else {
305
+ cleaned = cleaned.split('.')[0]
199
306
  }
200
- const mode = inputValue.value > value ? 'sub' : 'add'
201
- inputValue.value = value
202
- change && emit('update:modelValue', inputValue.value)
203
- change && !formMaxMinDiff && emit('change', { value, mode })
307
+
308
+ // 处理以点开头的情况
309
+ if (cleaned.startsWith('.')) return '0' + cleaned
310
+ if (cleaned.startsWith('-.')) return '-0' + cleaned.substring(1)
311
+
312
+ return cleaned
204
313
  }
205
314
 
206
- function formatValue(value: string | number) {
207
- if (props.allowNull && (!isDef(value) || value === '')) {
208
- return ''
209
- }
315
+ /**
316
+ * 更新值并触发事件
317
+ */
318
+ function updateValue(val: string | number) {
319
+ // 空值处理
320
+ if (props.allowNull && (!isDef(val) || val === '')) {
321
+ if (isEqual('', String(props.modelValue))) {
322
+ inputValue.value = ''
323
+ return
324
+ }
210
325
 
211
- value = Number(value)
326
+ const doUpdate = () => {
327
+ inputValue.value = ''
328
+ emit('update:modelValue', '')
329
+ emit('change', { value: '' })
330
+ }
212
331
 
213
- if (isNaN(value)) {
214
- value = props.min
332
+ callInterceptor(props.beforeChange, { args: [''], done: doUpdate })
333
+ return
215
334
  }
216
335
 
217
- if (props.stepStrictly) {
218
- value = toStrictlyStep(value)
336
+ const num = toNumber(val)
337
+ const display = formatValue(val)
338
+
339
+ if (isEqual(String(num), String(props.modelValue))) {
340
+ inputValue.value = display
341
+ return
219
342
  }
220
343
 
221
- if (props.precision !== undefined) {
222
- value = value.toFixed(props.precision)
344
+ const doUpdate = () => {
345
+ inputValue.value = display
346
+ emit('update:modelValue', num)
347
+ emit('change', { value: num })
223
348
  }
224
349
 
225
- return Number(value)
350
+ callInterceptor(props.beforeChange, { args: [num], done: doUpdate })
351
+ }
352
+
353
+ /**
354
+ * 按步进值增减
355
+ */
356
+ function addStep(val: string | number, step: number) {
357
+ const num = Number(val)
358
+ if (isNaN(num)) return normalizeValue(props.min)
359
+
360
+ const precision = Math.max(getPrecision(num), getPrecision(step))
361
+ const factor = Math.pow(10, precision)
362
+ const result = (num * factor + step * factor) / factor
363
+ return normalizeValue(result)
364
+ }
365
+
366
+ /**
367
+ * 处理按钮点击
368
+ */
369
+ function handleClick(type: OperationType) {
370
+ const step = type === 'add' ? props.step : -props.step
371
+ if ((step < 0 && (minDisabled.value || props.disableMinus)) || (step > 0 && (maxDisabled.value || props.disablePlus))) return
372
+
373
+ const newVal = addStep(inputValue.value, step)
374
+ updateValue(newVal)
375
+ }
376
+
377
+ /**
378
+ * 处理输入事件
379
+ */
380
+ function handleInput(event: any) {
381
+ const rawVal = event.detail.value || ''
382
+
383
+ // 立即更新显示
384
+ inputValue.value = rawVal
385
+
386
+ nextTick(() => {
387
+ // 空值处理
388
+ if (rawVal === '') {
389
+ inputValue.value = ''
390
+ if (props.immediateChange && props.allowNull) {
391
+ updateValue('')
392
+ }
393
+ return
394
+ }
395
+
396
+ // 清理输入
397
+ const cleaned = cleanInput(rawVal)
398
+
399
+ // 中间状态处理
400
+ if (Number(props.precision) > 0 && isIntermediate(cleaned)) {
401
+ inputValue.value = cleaned
402
+ return
403
+ }
404
+
405
+ // 正常输入处理
406
+ inputValue.value = cleaned
407
+ if (props.immediateChange) {
408
+ updateValue(cleaned)
409
+ }
410
+ })
411
+ }
412
+
413
+ /**
414
+ * 处理失焦事件
415
+ */
416
+ function handleBlur(event: any) {
417
+ const val = event.detail.value || ''
418
+ updateValue(val)
419
+ emit('blur', { value: val })
420
+ }
421
+
422
+ /**
423
+ * 处理聚焦事件
424
+ */
425
+ function handleFocus(event: any) {
426
+ emit('focus', event.detail)
427
+ }
428
+
429
+ /**
430
+ * 长按逻辑
431
+ */
432
+ function longPressStep(type: OperationType) {
433
+ clearLongPressTimer()
434
+ longPressTimer = setTimeout(() => {
435
+ handleClick(type)
436
+ longPressStep(type)
437
+ }, 250)
438
+ }
439
+
440
+ function handleTouchStart(type: OperationType) {
441
+ if (!props.longPress) return
442
+ clearLongPressTimer()
443
+ longPressTimer = setTimeout(() => {
444
+ handleClick(type)
445
+ longPressStep(type)
446
+ }, 600)
447
+ }
448
+
449
+ function handleTouchEnd() {
450
+ if (!props.longPress) return
451
+ clearLongPressTimer()
452
+ }
453
+
454
+ function clearLongPressTimer() {
455
+ if (longPressTimer) {
456
+ clearTimeout(longPressTimer)
457
+ longPressTimer = null
458
+ }
226
459
  }
227
460
  </script>
228
461
 
229
462
  <style lang="scss" scoped>
230
- @import './index';
463
+ @import './index.scss';
231
464
  </style>
@@ -0,0 +1,81 @@
1
+ /**
2
+ * 车牌号键盘-省份简称
3
+ */
4
+ export const CAR_KEYBOARD_AREAS = [
5
+ '京',
6
+ '沪',
7
+ '粤',
8
+ '津',
9
+ '冀',
10
+ '豫',
11
+ '云',
12
+ '辽',
13
+ '黑',
14
+ '湘',
15
+ '皖',
16
+ '鲁',
17
+ '苏',
18
+ '浙',
19
+ '赣',
20
+ '鄂',
21
+ '桂',
22
+ '甘',
23
+ '晋',
24
+ '陕',
25
+ '蒙',
26
+ '吉',
27
+ '闽',
28
+ '贵',
29
+ '渝',
30
+ '川',
31
+ '青',
32
+ '琼',
33
+ '宁',
34
+ '挂',
35
+ '藏',
36
+ '港',
37
+ '澳',
38
+ '新',
39
+ '使',
40
+ '学'
41
+ ]
42
+
43
+ /**
44
+ * 车牌号键盘-数字和字母(不包含I和O,因为车牌号规则中不使用这两个字母)
45
+ */
46
+ export const CAR_KEYBOARD_KEYS = [
47
+ 1,
48
+ 2,
49
+ 3,
50
+ 4,
51
+ 5,
52
+ 6,
53
+ 7,
54
+ 8,
55
+ 9,
56
+ 0,
57
+ 'Q',
58
+ 'W',
59
+ 'E',
60
+ 'R',
61
+ 'T',
62
+ 'Y',
63
+ 'U',
64
+ 'P',
65
+ 'A',
66
+ 'S',
67
+ 'D',
68
+ 'F',
69
+ 'G',
70
+ 'H',
71
+ 'J',
72
+ 'K',
73
+ 'L',
74
+ 'Z',
75
+ 'X',
76
+ 'C',
77
+ 'V',
78
+ 'B',
79
+ 'N',
80
+ 'M'
81
+ ]