vxe-pc-ui 4.1.20 → 4.1.21

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 (231) hide show
  1. package/README.md +82 -1
  2. package/es/anchor/src/anchor-link.js +1 -1
  3. package/es/anchor/src/anchor.js +1 -1
  4. package/es/breadcrumb/src/breadcrumb.js +1 -1
  5. package/es/button/src/button-group.js +4 -1
  6. package/es/calendar/src/calendar.js +64 -32
  7. package/es/carousel/src/carousel-item.js +13 -3
  8. package/es/carousel/src/carousel.js +16 -8
  9. package/es/checkbox/src/checkbox.js +30 -14
  10. package/es/checkbox/src/group.js +17 -8
  11. package/es/collapse-pane/index.js +1 -1
  12. package/es/countdown/src/countdown.js +1 -1
  13. package/es/date-picker/src/date-picker.js +12 -12
  14. package/es/drawer/src/drawer.js +1 -1
  15. package/es/form/render/index.js +1 -2
  16. package/es/form/src/form-config-item.js +4 -3
  17. package/es/form/src/form-gather.js +5 -3
  18. package/es/form/src/form-item.js +15 -10
  19. package/es/form/src/form.js +11 -8
  20. package/es/form/src/render.js +2 -1
  21. package/es/form/src/util.js +2 -1
  22. package/es/icon/style.css +1 -1
  23. package/es/icon-picker/src/icon-picker.js +22 -10
  24. package/es/image/src/group.js +4 -1
  25. package/es/image/src/preview.js +1 -1
  26. package/es/input/src/input.js +129 -65
  27. package/es/layout-aside/src/layout-aside.js +1 -1
  28. package/es/list/src/list.js +7 -5
  29. package/es/list-design/src/list-design.js +1 -1
  30. package/es/list-design/src/list-view.js +1 -1
  31. package/es/loading/src/loading.js +1 -1
  32. package/es/menu/src/menu.js +1 -1
  33. package/es/number-input/src/number-input.js +6 -6
  34. package/es/pager/src/pager.js +85 -45
  35. package/es/password-input/src/password-input.js +2 -2
  36. package/es/print/src/page-break.js +11 -2
  37. package/es/print/src/print.js +6 -4
  38. package/es/radio/src/group.js +5 -2
  39. package/es/row/src/row.js +1 -1
  40. package/es/select/src/optgroup.js +11 -8
  41. package/es/select/src/option.js +9 -7
  42. package/es/select/src/select.js +32 -29
  43. package/es/select/src/util.js +2 -2
  44. package/es/style.css +1 -1
  45. package/es/style.min.css +1 -1
  46. package/es/tabs/src/tab-pane.js +13 -3
  47. package/es/tabs/src/tabs.js +57 -47
  48. package/es/textarea/src/textarea.js +4 -4
  49. package/es/tooltip/src/tooltip.js +1 -1
  50. package/es/tree/src/tree.js +6 -3
  51. package/es/tree-select/src/tree-select.js +16 -9
  52. package/es/ui/index.js +1 -7
  53. package/es/ui/src/log.js +1 -1
  54. package/es/upload/src/upload.js +5 -5
  55. package/lib/anchor/src/anchor-link.js +1 -1
  56. package/lib/anchor/src/anchor-link.min.js +1 -1
  57. package/lib/anchor/src/anchor.js +1 -1
  58. package/lib/anchor/src/anchor.min.js +1 -1
  59. package/lib/breadcrumb/src/breadcrumb.js +1 -1
  60. package/lib/breadcrumb/src/breadcrumb.min.js +1 -1
  61. package/lib/button/src/button-group.js +4 -1
  62. package/lib/button/src/button-group.min.js +1 -1
  63. package/lib/calendar/src/calendar.js +42 -24
  64. package/lib/calendar/src/calendar.min.js +1 -1
  65. package/lib/carousel/src/carousel-item.js +16 -3
  66. package/lib/carousel/src/carousel-item.min.js +1 -1
  67. package/lib/carousel/src/carousel.js +18 -8
  68. package/lib/carousel/src/carousel.min.js +1 -1
  69. package/lib/checkbox/src/checkbox.js +16 -12
  70. package/lib/checkbox/src/checkbox.min.js +1 -1
  71. package/lib/checkbox/src/group.js +10 -7
  72. package/lib/checkbox/src/group.min.js +1 -1
  73. package/lib/collapse-pane/index.js +1 -1
  74. package/lib/collapse-pane/index.min.js +1 -1
  75. package/lib/countdown/src/countdown.js +1 -1
  76. package/lib/countdown/src/countdown.min.js +1 -1
  77. package/lib/date-picker/src/date-picker.js +12 -12
  78. package/lib/drawer/src/drawer.js +1 -1
  79. package/lib/drawer/src/drawer.min.js +1 -1
  80. package/lib/form/render/index.js +1 -4
  81. package/lib/form/render/index.min.js +1 -1
  82. package/lib/form/src/form-config-item.js +4 -5
  83. package/lib/form/src/form-config-item.min.js +1 -1
  84. package/lib/form/src/form-gather.js +11 -9
  85. package/lib/form/src/form-gather.min.js +1 -1
  86. package/lib/form/src/form-item.js +11 -12
  87. package/lib/form/src/form-item.min.js +1 -1
  88. package/lib/form/src/form.js +7 -7
  89. package/lib/form/src/form.min.js +1 -1
  90. package/lib/form/src/render.js +2 -1
  91. package/lib/form/src/util.js +2 -1
  92. package/lib/icon/style/style.css +1 -1
  93. package/lib/icon/style/style.min.css +1 -1
  94. package/lib/icon-picker/src/icon-picker.js +20 -11
  95. package/lib/icon-picker/src/icon-picker.min.js +1 -1
  96. package/lib/image/src/group.js +4 -1
  97. package/lib/image/src/group.min.js +1 -1
  98. package/lib/image/src/preview.js +1 -1
  99. package/lib/image/src/preview.min.js +1 -1
  100. package/lib/index.umd.js +522 -377
  101. package/lib/index.umd.min.js +1 -1
  102. package/lib/input/src/input.js +77 -50
  103. package/lib/input/src/input.min.js +1 -1
  104. package/lib/layout-aside/src/layout-aside.js +1 -1
  105. package/lib/layout-aside/src/layout-aside.min.js +1 -1
  106. package/lib/list/src/list.js +9 -5
  107. package/lib/list/src/list.min.js +1 -1
  108. package/lib/list-design/src/list-design.js +1 -1
  109. package/lib/list-design/src/list-design.min.js +1 -1
  110. package/lib/list-design/src/list-view.js +1 -1
  111. package/lib/list-design/src/list-view.min.js +1 -1
  112. package/lib/loading/src/loading.js +1 -1
  113. package/lib/loading/src/loading.min.js +1 -1
  114. package/lib/menu/src/menu.js +1 -1
  115. package/lib/menu/src/menu.min.js +1 -1
  116. package/lib/number-input/src/number-input.js +6 -6
  117. package/lib/pager/src/pager.js +40 -39
  118. package/lib/pager/src/pager.min.js +1 -1
  119. package/lib/password-input/src/password-input.js +2 -2
  120. package/lib/print/src/page-break.js +14 -2
  121. package/lib/print/src/page-break.min.js +1 -1
  122. package/lib/print/src/print.js +8 -6
  123. package/lib/print/src/print.min.js +1 -1
  124. package/lib/radio/src/group.js +5 -2
  125. package/lib/radio/src/group.min.js +1 -1
  126. package/lib/row/src/row.js +1 -1
  127. package/lib/row/src/row.min.js +1 -1
  128. package/lib/select/src/optgroup.js +12 -9
  129. package/lib/select/src/optgroup.min.js +1 -1
  130. package/lib/select/src/option.js +9 -7
  131. package/lib/select/src/option.min.js +1 -1
  132. package/lib/select/src/select.js +33 -32
  133. package/lib/select/src/select.min.js +1 -1
  134. package/lib/select/src/util.js +2 -2
  135. package/lib/select/src/util.min.js +1 -1
  136. package/lib/style.css +1 -1
  137. package/lib/style.min.css +1 -1
  138. package/lib/tabs/src/tab-pane.js +16 -3
  139. package/lib/tabs/src/tab-pane.min.js +1 -1
  140. package/lib/tabs/src/tabs.js +62 -50
  141. package/lib/tabs/src/tabs.min.js +1 -1
  142. package/lib/textarea/src/textarea.js +4 -4
  143. package/lib/tooltip/src/tooltip.js +1 -1
  144. package/lib/tooltip/src/tooltip.min.js +1 -1
  145. package/lib/tree/src/tree.js +2 -2
  146. package/lib/tree/src/tree.min.js +1 -1
  147. package/lib/tree-select/src/tree-select.js +11 -7
  148. package/lib/tree-select/src/tree-select.min.js +1 -1
  149. package/lib/ui/index.js +3 -10
  150. package/lib/ui/index.min.js +1 -1
  151. package/lib/ui/src/log.js +1 -1
  152. package/lib/ui/src/log.min.js +1 -1
  153. package/lib/upload/src/upload.js +5 -5
  154. package/lib/upload/src/upload.min.js +1 -1
  155. package/package.json +2 -2
  156. package/packages/anchor/src/anchor-link.ts +2 -2
  157. package/packages/anchor/src/anchor.ts +2 -2
  158. package/packages/breadcrumb/src/breadcrumb.ts +2 -2
  159. package/packages/button/src/button-group.ts +4 -1
  160. package/packages/calendar/src/calendar.ts +67 -35
  161. package/packages/carousel/src/carousel-item.ts +19 -4
  162. package/packages/carousel/src/carousel.ts +19 -11
  163. package/packages/checkbox/src/checkbox.ts +34 -15
  164. package/packages/checkbox/src/group.ts +22 -10
  165. package/packages/collapse-pane/index.ts +1 -1
  166. package/packages/countdown/src/countdown.ts +2 -2
  167. package/packages/date-picker/src/date-picker.ts +12 -12
  168. package/packages/drawer/src/drawer.ts +2 -2
  169. package/packages/form/render/index.ts +1 -3
  170. package/packages/form/src/form-config-item.ts +4 -3
  171. package/packages/form/src/form-gather.ts +5 -3
  172. package/packages/form/src/form-item.ts +15 -10
  173. package/packages/form/src/form.ts +12 -10
  174. package/packages/form/src/render.ts +2 -1
  175. package/packages/form/src/util.ts +2 -1
  176. package/packages/icon-picker/src/icon-picker.ts +26 -13
  177. package/packages/image/src/group.ts +4 -1
  178. package/packages/image/src/preview.ts +2 -2
  179. package/packages/input/src/input.ts +133 -71
  180. package/packages/layout-aside/src/layout-aside.ts +2 -2
  181. package/packages/list/src/list.ts +12 -11
  182. package/packages/list-design/src/list-design.ts +2 -2
  183. package/packages/list-design/src/list-view.ts +2 -2
  184. package/packages/loading/src/loading.ts +2 -2
  185. package/packages/menu/src/menu.ts +2 -2
  186. package/packages/number-input/src/number-input.ts +6 -6
  187. package/packages/pager/src/pager.ts +91 -50
  188. package/packages/password-input/src/password-input.ts +2 -2
  189. package/packages/print/src/page-break.ts +18 -4
  190. package/packages/print/src/print.ts +10 -5
  191. package/packages/radio/src/group.ts +6 -3
  192. package/packages/row/src/row.ts +2 -2
  193. package/packages/select/src/optgroup.ts +16 -13
  194. package/packages/select/src/option.ts +10 -8
  195. package/packages/select/src/select.ts +42 -36
  196. package/packages/select/src/util.ts +3 -3
  197. package/packages/tabs/src/tab-pane.ts +20 -5
  198. package/packages/tabs/src/tabs.ts +59 -49
  199. package/packages/textarea/src/textarea.ts +4 -4
  200. package/packages/tooltip/src/tooltip.ts +2 -2
  201. package/packages/tree/src/tree.ts +7 -4
  202. package/packages/tree-select/src/tree-select.ts +20 -12
  203. package/packages/ui/index.ts +0 -7
  204. package/packages/upload/src/upload.ts +6 -6
  205. package/types/components/calendar.d.ts +6 -0
  206. package/types/components/carousel.d.ts +5 -0
  207. package/types/components/form.d.ts +4 -2
  208. package/types/components/icon-picker.d.ts +4 -0
  209. package/types/components/input.d.ts +9 -1
  210. package/types/components/list.d.ts +1 -0
  211. package/types/components/optgroup.d.ts +10 -4
  212. package/types/components/tabs.d.ts +4 -0
  213. package/types/components/toolbar.d.ts +5 -0
  214. package/types/components/tree-select.d.ts +4 -0
  215. package/types/ui/index.d.ts +0 -22
  216. /package/es/{collapse-pane → collapse}/src/collapse-pane.js +0 -0
  217. /package/es/icon/style/{iconfont.1725680652286.ttf → iconfont.1725941866604.ttf} +0 -0
  218. /package/es/icon/style/{iconfont.1725680652286.woff → iconfont.1725941866604.woff} +0 -0
  219. /package/es/icon/style/{iconfont.1725680652286.woff2 → iconfont.1725941866604.woff2} +0 -0
  220. /package/es/{iconfont.1725680652286.ttf → iconfont.1725941866604.ttf} +0 -0
  221. /package/es/{iconfont.1725680652286.woff → iconfont.1725941866604.woff} +0 -0
  222. /package/es/{iconfont.1725680652286.woff2 → iconfont.1725941866604.woff2} +0 -0
  223. /package/lib/{collapse-pane → collapse}/src/collapse-pane.js +0 -0
  224. /package/lib/{collapse-pane → collapse}/src/collapse-pane.min.js +0 -0
  225. /package/lib/icon/style/{iconfont.1725680652286.ttf → iconfont.1725941866604.ttf} +0 -0
  226. /package/lib/icon/style/{iconfont.1725680652286.woff → iconfont.1725941866604.woff} +0 -0
  227. /package/lib/icon/style/{iconfont.1725680652286.woff2 → iconfont.1725941866604.woff2} +0 -0
  228. /package/lib/{iconfont.1725680652286.ttf → iconfont.1725941866604.ttf} +0 -0
  229. /package/lib/{iconfont.1725680652286.woff → iconfont.1725941866604.woff} +0 -0
  230. /package/lib/{iconfont.1725680652286.woff2 → iconfont.1725941866604.woff2} +0 -0
  231. /package/packages/{collapse-pane → collapse}/src/collapse-pane.ts +0 -0
@@ -4,7 +4,7 @@ import { getConfig, getIcon, getI18n, globalEvents, createEvent, useSize, GLOBAL
4
4
  import { getEventTargetNode, getAbsolutePos } from '../../ui/src/dom'
5
5
  import { getLastZIndex, nextZIndex, getFuncText } from '../../ui/src/utils'
6
6
 
7
- import type { VxeIconPickerPropTypes, VxeIconPickerConstructor, IconPickerReactData, VxeIconPickerEmits, IconPickerMethods, IconPickerPrivateRef, VxeIconPickerMethods, VxeTableConstructor, VxeTablePrivateMethods, VxeIconPickerDefines, VxeDrawerConstructor, VxeDrawerMethods, VxeFormDefines, VxeFormConstructor, VxeFormPrivateMethods, VxeModalConstructor, VxeModalMethods } from '../../../types'
7
+ import type { VxeIconPickerPropTypes, VxeIconPickerConstructor, IconPickerInternalData, ValueOf, IconPickerReactData, VxeIconPickerEmits, IconPickerMethods, IconPickerPrivateRef, VxeIconPickerMethods, VxeTableConstructor, VxeTablePrivateMethods, VxeIconPickerDefines, VxeDrawerConstructor, VxeDrawerMethods, VxeFormDefines, VxeFormConstructor, VxeFormPrivateMethods, VxeModalConstructor, VxeModalMethods } from '../../../types'
8
8
 
9
9
  export default defineComponent({
10
10
  name: 'VxeIconPicker',
@@ -12,7 +12,10 @@ export default defineComponent({
12
12
  modelValue: String as PropType<VxeIconPickerPropTypes.ModelValue>,
13
13
  placeholder: String as PropType<VxeIconPickerPropTypes.Placeholder>,
14
14
  clearable: Boolean as PropType<VxeIconPickerPropTypes.Clearable>,
15
- size: { type: String as PropType<VxeIconPickerPropTypes.Size>, default: () => getConfig().iconPicker.size || getConfig().size },
15
+ size: {
16
+ type: String as PropType<VxeIconPickerPropTypes.Size>,
17
+ default: () => getConfig().iconPicker.size || getConfig().size
18
+ },
16
19
  className: [String, Function] as PropType<VxeIconPickerPropTypes.ClassName>,
17
20
  popupClassName: [String, Function] as PropType<VxeIconPickerPropTypes.PopupClassName>,
18
21
  showIconTitle: {
@@ -55,7 +58,7 @@ export default defineComponent({
55
58
 
56
59
  const reactData = reactive<IconPickerReactData>({
57
60
  initialized: false,
58
- selectIcon: '',
61
+ selectIcon: `${props.modelValue || ''}`,
59
62
  panelIndex: 0,
60
63
  panelStyle: {},
61
64
  panelPlacement: null,
@@ -64,6 +67,10 @@ export default defineComponent({
64
67
  isActivated: false
65
68
  })
66
69
 
70
+ const internalData: IconPickerInternalData = {
71
+ hpTimeout: undefined
72
+ }
73
+
67
74
  const refElem = ref() as Ref<HTMLDivElement>
68
75
  const refInput = ref() as Ref<HTMLInputElement>
69
76
  const refOptionPanel = ref() as Ref<HTMLDivElement>
@@ -225,12 +232,14 @@ export default defineComponent({
225
232
  })
226
233
  }
227
234
 
228
- let hidePanelTimeout: number
229
-
230
235
  const showOptionPanel = () => {
236
+ const { hpTimeout } = internalData
231
237
  const isDisabled = computeIsDisabled.value
232
238
  if (!isDisabled) {
233
- clearTimeout(hidePanelTimeout)
239
+ if (hpTimeout) {
240
+ clearTimeout(hpTimeout)
241
+ internalData.hpTimeout = undefined
242
+ }
234
243
  if (!reactData.initialized) {
235
244
  reactData.initialized = true
236
245
  }
@@ -246,7 +255,7 @@ export default defineComponent({
246
255
 
247
256
  const hideOptionPanel = () => {
248
257
  reactData.visiblePanel = false
249
- hidePanelTimeout = window.setTimeout(() => {
258
+ internalData.hpTimeout = window.setTimeout(() => {
250
259
  reactData.isAniVisible = false
251
260
  }, 350)
252
261
  }
@@ -377,10 +386,12 @@ export default defineComponent({
377
386
  hideOptionPanel()
378
387
  }
379
388
 
389
+ const dispatchEvent = (type: ValueOf<VxeIconPickerEmits>, params: Record<string, any>, evnt: Event | null) => {
390
+ emit(type, createEvent(evnt, { $iconPicker: $xeIconPicker }, params))
391
+ }
392
+
380
393
  iconPickerMethods = {
381
- dispatchEvent (type, params, evnt) {
382
- emit(type, createEvent(evnt, { $iconPicker: $xeIconPicker }, params))
383
- },
394
+ dispatchEvent,
384
395
  isPanelVisible () {
385
396
  return reactData.visiblePanel
386
397
  },
@@ -550,15 +561,15 @@ export default defineComponent({
550
561
  initialized
551
562
  ? h('div', {
552
563
  class: 'vxe-ico-picker--panel-wrapper'
553
- }, renderIconWrapper())
564
+ }, [
565
+ renderIconWrapper()
566
+ ])
554
567
  : createCommentVNode()
555
568
  ])
556
569
  ])
557
570
  ])
558
571
  }
559
572
 
560
- $xeIconPicker.renderVN = renderVN
561
-
562
573
  watch(() => props.modelValue, (val) => {
563
574
  reactData.selectIcon = `${val || ''}`
564
575
  })
@@ -579,6 +590,8 @@ export default defineComponent({
579
590
 
580
591
  provide('$xeIconPicker', $xeIconPicker)
581
592
 
593
+ $xeIconPicker.renderVN = renderVN
594
+
582
595
  return $xeIconPicker
583
596
  },
584
597
  render () {
@@ -120,6 +120,9 @@ export default defineComponent({
120
120
 
121
121
  provide('$xeImageGroup', $xeImageGroup)
122
122
 
123
- return renderVN
123
+ return $xeImageGroup
124
+ },
125
+ render () {
126
+ return this.renderVN()
124
127
  }
125
128
  })
@@ -613,8 +613,6 @@ export default defineComponent({
613
613
  ])
614
614
  }
615
615
 
616
- $xeImagePreview.renderVN = renderVN
617
-
618
616
  watch(() => props.modelValue, val => {
619
617
  reactData.activeIndex = val
620
618
  resetStyle()
@@ -637,6 +635,8 @@ export default defineComponent({
637
635
 
638
636
  provide('$xeImagePreview', $xeImagePreview)
639
637
 
638
+ $xeImagePreview.renderVN = renderVN
639
+
640
640
  return renderVN
641
641
  }
642
642
  })
@@ -7,16 +7,25 @@ import { toStringTimeDate, getDateQuarter } from '../../date-picker/src/util'
7
7
  import { handleNumber, toFloatValueFixed } from '../../number-input/src/util'
8
8
  import { getSlotVNs } from '../..//ui/src/vn'
9
9
 
10
- import type { VxeInputConstructor, VxeInputEmits, InputReactData, InputMethods, VxeInputPropTypes, InputPrivateRef, VxeFormConstructor, VxeFormPrivateMethods, VxeFormDefines, VxeTableConstructor, VxeTablePrivateMethods, VxeDrawerConstructor, VxeDrawerMethods, VxeModalConstructor, VxeModalMethods, VxeDatePickerDefines } from '../../../types'
10
+ import type { VxeInputConstructor, VxeInputEmits, InputReactData, InputMethods, ValueOf, InputInternalData, VxeInputPropTypes, InputPrivateRef, VxeFormConstructor, VxeFormPrivateMethods, VxeFormDefines, VxeTableConstructor, VxeTablePrivateMethods, VxeDrawerConstructor, VxeDrawerMethods, VxeModalConstructor, VxeModalMethods, VxeDatePickerDefines } from '../../../types'
11
11
 
12
12
  export default defineComponent({
13
13
  name: 'VxeInput',
14
14
  props: {
15
15
  modelValue: [String, Number, Date] as PropType<VxeInputPropTypes.ModelValue>,
16
- immediate: { type: Boolean as PropType<VxeInputPropTypes.Immediate>, default: true },
16
+ immediate: {
17
+ type: Boolean as PropType<VxeInputPropTypes.Immediate>,
18
+ default: true
19
+ },
17
20
  name: String as PropType<VxeInputPropTypes.Name>,
18
- type: { type: String as PropType<VxeInputPropTypes.Type>, default: 'text' },
19
- clearable: { type: Boolean as PropType<VxeInputPropTypes.Clearable>, default: () => getConfig().input.clearable },
21
+ type: {
22
+ type: String as PropType<VxeInputPropTypes.Type>,
23
+ default: 'text'
24
+ },
25
+ clearable: {
26
+ type: Boolean as PropType<VxeInputPropTypes.Clearable>,
27
+ default: () => getConfig().input.clearable
28
+ },
20
29
  readonly: {
21
30
  type: Boolean as PropType<VxeInputPropTypes.Readonly>,
22
31
  default: null
@@ -27,11 +36,17 @@ export default defineComponent({
27
36
  },
28
37
  placeholder: String as PropType<VxeInputPropTypes.Placeholder>,
29
38
  maxLength: [String, Number] as PropType<VxeInputPropTypes.MaxLength>,
30
- autoComplete: { type: String as PropType<VxeInputPropTypes.AutoComplete>, default: 'off' },
39
+ autoComplete: {
40
+ type: String as PropType<VxeInputPropTypes.AutoComplete>,
41
+ default: 'off'
42
+ },
31
43
  align: String as PropType<VxeInputPropTypes.Align>,
32
44
  form: String as PropType<VxeInputPropTypes.Form>,
33
45
  className: String as PropType<VxeInputPropTypes.ClassName>,
34
- size: { type: String as PropType<VxeInputPropTypes.Size>, default: () => getConfig().input.size || getConfig().size },
46
+ size: {
47
+ type: String as PropType<VxeInputPropTypes.Size>,
48
+ default: () => getConfig().input.size || getConfig().size
49
+ },
35
50
  multiple: Boolean as PropType<VxeInputPropTypes.Multiple>,
36
51
 
37
52
  // text
@@ -39,33 +54,69 @@ export default defineComponent({
39
54
  countMethod: Function as PropType<VxeInputPropTypes.CountMethod>,
40
55
 
41
56
  // number、integer、float
42
- min: { type: [String, Number] as PropType<VxeInputPropTypes.Min>, default: null },
43
- max: { type: [String, Number] as PropType<VxeInputPropTypes.Max>, default: null },
57
+ min: {
58
+ type: [String, Number] as PropType<VxeInputPropTypes.Min>,
59
+ default: null
60
+ },
61
+ max: {
62
+ type: [String, Number] as PropType<VxeInputPropTypes.Max>,
63
+ default: null
64
+ },
44
65
  step: [String, Number] as PropType<VxeInputPropTypes.Step>,
45
- exponential: { type: Boolean as PropType<VxeInputPropTypes.Exponential>, default: () => getConfig().input.exponential },
66
+ exponential: {
67
+ type: Boolean as PropType<VxeInputPropTypes.Exponential>,
68
+ default: () => getConfig().input.exponential
69
+ },
46
70
 
47
71
  // number、integer、float、password
48
- controls: { type: Boolean as PropType<VxeInputPropTypes.Controls>, default: () => getConfig().input.controls },
72
+ controls: {
73
+ type: Boolean as PropType<VxeInputPropTypes.Controls>,
74
+ default: () => getConfig().input.controls
75
+ },
49
76
 
50
77
  // float
51
- digits: { type: [String, Number] as PropType<VxeInputPropTypes.Digits>, default: () => getConfig().input.digits },
78
+ digits: {
79
+ type: [String, Number] as PropType<VxeInputPropTypes.Digits>,
80
+ default: () => getConfig().input.digits
81
+ },
52
82
 
53
83
  // date、week、month、quarter、year
54
- startDate: { type: [String, Number, Date] as PropType<VxeInputPropTypes.MinDate>, default: () => getConfig().input.startDate },
55
- endDate: { type: [String, Number, Date] as PropType<VxeInputPropTypes.MaxDate>, default: () => getConfig().input.endDate },
84
+ startDate: {
85
+ type: [String, Number, Date] as PropType<VxeInputPropTypes.MinDate>,
86
+ default: () => getConfig().input.startDate
87
+ },
88
+ endDate: {
89
+ type: [String, Number, Date] as PropType<VxeInputPropTypes.MaxDate>,
90
+ default: () => getConfig().input.endDate
91
+ },
56
92
  minDate: [String, Number, Date] as PropType<VxeInputPropTypes.MinDate>,
57
93
  maxDate: [String, Number, Date] as PropType<VxeInputPropTypes.MaxDate>,
58
94
  // 已废弃 startWeek,被 startDay 替换
59
95
  startWeek: Number as PropType<VxeInputPropTypes.StartDay>,
60
- startDay: { type: [String, Number] as PropType<VxeInputPropTypes.StartDay>, default: () => getConfig().input.startDay },
96
+ startDay: {
97
+ type: [String, Number] as PropType<VxeInputPropTypes.StartDay>,
98
+ default: () => getConfig().input.startDay
99
+ },
61
100
  labelFormat: String as PropType<VxeInputPropTypes.LabelFormat>,
62
101
  valueFormat: String as PropType<VxeInputPropTypes.ValueFormat>,
63
- editable: { type: Boolean as PropType<VxeInputPropTypes.Editable>, default: true },
64
- festivalMethod: { type: Function as PropType<VxeInputPropTypes.FestivalMethod>, default: () => getConfig().input.festivalMethod },
65
- disabledMethod: { type: Function as PropType<VxeInputPropTypes.DisabledMethod>, default: () => getConfig().input.disabledMethod },
102
+ editable: {
103
+ type: Boolean as PropType<VxeInputPropTypes.Editable>,
104
+ default: true
105
+ },
106
+ festivalMethod: {
107
+ type: Function as PropType<VxeInputPropTypes.FestivalMethod>,
108
+ default: () => getConfig().input.festivalMethod
109
+ },
110
+ disabledMethod: {
111
+ type: Function as PropType<VxeInputPropTypes.DisabledMethod>,
112
+ default: () => getConfig().input.disabledMethod
113
+ },
66
114
 
67
115
  // week
68
- selectDay: { type: [String, Number] as PropType<VxeInputPropTypes.SelectDay>, default: () => getConfig().input.selectDay },
116
+ selectDay: {
117
+ type: [String, Number] as PropType<VxeInputPropTypes.SelectDay>,
118
+ default: () => getConfig().input.selectDay
119
+ },
69
120
 
70
121
  prefixIcon: String as PropType<VxeInputPropTypes.PrefixIcon>,
71
122
  suffixIcon: String as PropType<VxeInputPropTypes.SuffixIcon>,
@@ -114,17 +165,13 @@ export default defineComponent({
114
165
 
115
166
  const { computeSize } = useSize(props)
116
167
 
117
- const yearSize = 12
118
- const monthSize = 20
119
- const quarterSize = 8
120
-
121
168
  const reactData = reactive<InputReactData>({
122
169
  initialized: false,
123
170
  panelIndex: 0,
124
171
  showPwd: false,
125
172
  visiblePanel: false,
126
173
  isAniVisible: false,
127
- panelStyle: null,
174
+ panelStyle: {},
128
175
  panelPlacement: '',
129
176
  isActivated: false,
130
177
  inputValue: props.modelValue,
@@ -136,6 +183,14 @@ export default defineComponent({
136
183
  currentDate: null
137
184
  })
138
185
 
186
+ const internalData: InputInternalData = {
187
+ yearSize: 12,
188
+ monthSize: 20,
189
+ quarterSize: 8,
190
+ hpTimeout: undefined,
191
+ dnTimeout: undefined
192
+ }
193
+
139
194
  const refElem = ref() as Ref<HTMLDivElement>
140
195
  const refInputTarget = ref() as Ref<HTMLInputElement>
141
196
  const refInputPanel = ref() as Ref<HTMLDivElement>
@@ -152,6 +207,7 @@ export default defineComponent({
152
207
  props,
153
208
  context,
154
209
  reactData,
210
+ internalData,
155
211
  getRefMaps: () => refMaps
156
212
  } as unknown as VxeInputConstructor
157
213
 
@@ -373,11 +429,12 @@ export default defineComponent({
373
429
  if (isDatePickerType) {
374
430
  return labelFormat || dateValueFormat || getI18n(`vxe.input.date.labelFormat.${props.type}`)
375
431
  }
376
- return null
432
+ return ''
377
433
  })
378
434
 
379
435
  const computeYearList = computed(() => {
380
436
  const { selectMonth, currentDate } = reactData
437
+ const { yearSize } = internalData
381
438
  const years: VxeDatePickerDefines.DateYearItem[] = []
382
439
  if (selectMonth && currentDate) {
383
440
  const currFullYear = currentDate.getFullYear()
@@ -475,6 +532,7 @@ export default defineComponent({
475
532
 
476
533
  const computeQuarterList = computed(() => {
477
534
  const { selectMonth, currentDate } = reactData
535
+ const { quarterSize } = internalData
478
536
  const quarters: VxeDatePickerDefines.DateQuarterItem[] = []
479
537
  if (selectMonth && currentDate) {
480
538
  const currFullYear = currentDate.getFullYear()
@@ -506,6 +564,7 @@ export default defineComponent({
506
564
 
507
565
  const computeMonthList = computed(() => {
508
566
  const { selectMonth, currentDate } = reactData
567
+ const { monthSize } = internalData
509
568
  const months: VxeDatePickerDefines.DateMonthItem[] = []
510
569
  if (selectMonth && currentDate) {
511
570
  const currFullYear = currentDate.getFullYear()
@@ -663,13 +722,6 @@ export default defineComponent({
663
722
  return getI18n('vxe.base.pleaseInput')
664
723
  })
665
724
 
666
- const computeInpMaxlength = computed(() => {
667
- const isNumType = computeIsNumType.value
668
- const inpMaxLength = computeInpMaxLength.value
669
- // 数值最大长度限制 16 位,包含小数
670
- return isNumType && !XEUtils.toNumber(inpMaxLength) ? 16 : inpMaxLength
671
- })
672
-
673
725
  const computeInpImmediate = computed(() => {
674
726
  const { type, immediate } = props
675
727
  return immediate || !(type === 'text' || type === 'number' || type === 'integer' || type === 'float')
@@ -711,13 +763,13 @@ export default defineComponent({
711
763
 
712
764
  const getNumberValue = (val: any) => {
713
765
  const { type, exponential } = props
714
- const inpMaxlength = computeInpMaxlength.value
766
+ const inpMaxLength = computeInpMaxLength.value
715
767
  const digitsValue = computeDigitsValue.value
716
768
  const restVal = (type === 'float' ? toFloatValueFixed(val, digitsValue) : XEUtils.toValueString(val))
717
769
  if (exponential && (val === restVal || XEUtils.toValueString(val).toLowerCase() === XEUtils.toNumber(restVal).toExponential())) {
718
770
  return val
719
771
  }
720
- return restVal.slice(0, inpMaxlength)
772
+ return restVal.slice(0, inpMaxLength)
721
773
  }
722
774
 
723
775
  const triggerEvent = (evnt: Event & { type: 'input' | 'change' | 'keydown' | 'keyup' | 'wheel' | 'click' | 'focus' | 'blur' }) => {
@@ -725,7 +777,7 @@ export default defineComponent({
725
777
  inputMethods.dispatchEvent(evnt.type, { value: inputValue }, evnt)
726
778
  }
727
779
 
728
- const emitModel = (value: string, evnt: Event | { type: string }) => {
780
+ const handleChange = (value: string, evnt: Event | { type: string }) => {
729
781
  reactData.inputValue = value
730
782
  emit('update:modelValue', value)
731
783
  inputMethods.dispatchEvent('input', { value }, evnt as any)
@@ -744,7 +796,7 @@ export default defineComponent({
744
796
  reactData.inputValue = value
745
797
  if (!isDatePickerType) {
746
798
  if (inpImmediate) {
747
- emitModel(value, evnt)
799
+ handleChange(value, evnt)
748
800
  } else {
749
801
  inputMethods.dispatchEvent('input', { value }, evnt)
750
802
  }
@@ -781,12 +833,10 @@ export default defineComponent({
781
833
  }
782
834
  }
783
835
 
784
- let hidePanelTimeout: number
785
-
786
836
  const hidePanel = (): Promise<void> => {
787
837
  return new Promise(resolve => {
788
838
  reactData.visiblePanel = false
789
- hidePanelTimeout = window.setTimeout(() => {
839
+ internalData.hpTimeout = window.setTimeout(() => {
790
840
  reactData.isAniVisible = false
791
841
  resolve()
792
842
  }, 350)
@@ -803,7 +853,7 @@ export default defineComponent({
803
853
  if (isNumType || ['text', 'search', 'password'].indexOf(type) > -1) {
804
854
  focus()
805
855
  }
806
- emitModel('', evnt)
856
+ handleChange('', evnt)
807
857
  inputMethods.dispatchEvent('clear', { value }, evnt)
808
858
  }
809
859
 
@@ -873,7 +923,7 @@ export default defineComponent({
873
923
  if (inputValue) {
874
924
  const validValue = toFloatValueFixed(inputValue, digitsValue)
875
925
  if (inputValue !== validValue) {
876
- emitModel(validValue, { type: 'init' })
926
+ handleChange(validValue, { type: 'init' })
877
927
  }
878
928
  }
879
929
  }
@@ -935,19 +985,19 @@ export default defineComponent({
935
985
  datetimeRest.push(item)
936
986
  }
937
987
  })
938
- emitModel(datetimeRest.map(date => XEUtils.toDateString(date, dateValueFormat)).join(','), { type: 'update' })
988
+ handleChange(datetimeRest.map(date => XEUtils.toDateString(date, dateValueFormat)).join(','), { type: 'update' })
939
989
  } else {
940
990
  // 如果是日期类型
941
991
  if (dateMultipleValue.some(val => XEUtils.isEqual(val, inpVal))) {
942
- emitModel(dateMultipleValue.filter(val => !XEUtils.isEqual(val, inpVal)).join(','), { type: 'update' })
992
+ handleChange(dateMultipleValue.filter(val => !XEUtils.isEqual(val, inpVal)).join(','), { type: 'update' })
943
993
  } else {
944
- emitModel(dateMultipleValue.concat([inpVal]).join(','), { type: 'update' })
994
+ handleChange(dateMultipleValue.concat([inpVal]).join(','), { type: 'update' })
945
995
  }
946
996
  }
947
997
  } else {
948
998
  // 如果为单选
949
999
  if (!XEUtils.isEqual(modelValue, inpVal)) {
950
- emitModel(inpVal, { type: 'update' })
1000
+ handleChange(inpVal, { type: 'update' })
951
1001
  }
952
1002
  }
953
1003
  }
@@ -974,7 +1024,7 @@ export default defineComponent({
974
1024
  inpNumVal = inpStringVal
975
1025
  }
976
1026
  }
977
- emitModel(getNumberValue(inpNumVal), { type: 'check' })
1027
+ handleChange(getNumberValue(inpNumVal), { type: 'check' })
978
1028
  }
979
1029
  } else if (isDatePickerType) {
980
1030
  if (inputValue) {
@@ -983,7 +1033,7 @@ export default defineComponent({
983
1033
  if (type === 'time') {
984
1034
  inpDateVal = XEUtils.toDateString(inpDateVal, dateLabelFormat)
985
1035
  if (inputValue !== inpDateVal) {
986
- emitModel(inpDateVal, { type: 'check' })
1036
+ handleChange(inpDateVal, { type: 'check' })
987
1037
  }
988
1038
  reactData.inputValue = inpDateVal
989
1039
  } else {
@@ -1009,7 +1059,7 @@ export default defineComponent({
1009
1059
  dateRevert()
1010
1060
  }
1011
1061
  } else {
1012
- emitModel('', { type: 'check' })
1062
+ handleChange('', { type: 'check' })
1013
1063
  }
1014
1064
  }
1015
1065
  }
@@ -1019,7 +1069,7 @@ export default defineComponent({
1019
1069
  const { inputValue } = reactData
1020
1070
  const inpImmediate = computeInpImmediate.value
1021
1071
  if (!inpImmediate) {
1022
- emitModel(inputValue, evnt)
1072
+ handleChange(inputValue, evnt)
1023
1073
  }
1024
1074
  afterCheckValue()
1025
1075
  if (!reactData.visiblePanel) {
@@ -1064,13 +1114,11 @@ export default defineComponent({
1064
1114
  emitInputEvent(getNumberValue(restNum), evnt as (Event & { type: 'input' }))
1065
1115
  }
1066
1116
 
1067
- let downbumTimeout: number
1068
-
1069
1117
  const numberNextEvent = (evnt: Event) => {
1070
1118
  const isDisabled = computeIsDisabled.value
1071
1119
  const isReadonly = computeIsReadonly.value
1072
1120
  const isDisabledSubtractNumber = computeIsDisabledSubtractNumber.value
1073
- clearTimeout(downbumTimeout)
1121
+ numberStopDown()
1074
1122
  if (!isDisabled && !isReadonly && !isDisabledSubtractNumber) {
1075
1123
  numberChange(false, evnt)
1076
1124
  }
@@ -1078,7 +1126,7 @@ export default defineComponent({
1078
1126
  }
1079
1127
 
1080
1128
  const numberDownNextEvent = (evnt: Event) => {
1081
- downbumTimeout = window.setTimeout(() => {
1129
+ internalData.dnTimeout = window.setTimeout(() => {
1082
1130
  numberNextEvent(evnt)
1083
1131
  numberDownNextEvent(evnt)
1084
1132
  }, 60)
@@ -1088,7 +1136,7 @@ export default defineComponent({
1088
1136
  const isDisabled = computeIsDisabled.value
1089
1137
  const isReadonly = computeIsReadonly.value
1090
1138
  const isDisabledAddNumber = computeIsDisabledAddNumber.value
1091
- clearTimeout(downbumTimeout)
1139
+ numberStopDown()
1092
1140
  if (!isDisabled && !isReadonly && !isDisabledAddNumber) {
1093
1141
  numberChange(true, evnt)
1094
1142
  }
@@ -1140,11 +1188,15 @@ export default defineComponent({
1140
1188
  // 数值
1141
1189
 
1142
1190
  const numberStopDown = () => {
1143
- clearTimeout(downbumTimeout)
1191
+ const { dnTimeout } = internalData
1192
+ if (dnTimeout) {
1193
+ clearTimeout(dnTimeout)
1194
+ internalData.dnTimeout = undefined
1195
+ }
1144
1196
  }
1145
1197
 
1146
1198
  const numberDownPrevEvent = (evnt: Event) => {
1147
- downbumTimeout = window.setTimeout(() => {
1199
+ internalData.dnTimeout = window.setTimeout(() => {
1148
1200
  numberPrevEvent(evnt)
1149
1201
  numberDownPrevEvent(evnt)
1150
1202
  }, 60)
@@ -1159,7 +1211,7 @@ export default defineComponent({
1159
1211
  } else {
1160
1212
  numberNextEvent(evnt)
1161
1213
  }
1162
- downbumTimeout = window.setTimeout(() => {
1214
+ internalData.dnTimeout = window.setTimeout(() => {
1163
1215
  if (isPrevNumber) {
1164
1216
  numberDownPrevEvent(evnt)
1165
1217
  } else {
@@ -1212,6 +1264,7 @@ export default defineComponent({
1212
1264
  const datePrevEvent = (evnt: Event) => {
1213
1265
  const { type } = props
1214
1266
  const { datePanelType, selectMonth } = reactData
1267
+ const { yearSize } = internalData
1215
1268
  const isDisabledPrevDateBtn = computeIsDisabledPrevDateBtn.value
1216
1269
  if (!isDisabledPrevDateBtn) {
1217
1270
  if (type === 'year') {
@@ -1247,6 +1300,7 @@ export default defineComponent({
1247
1300
  const dateNextEvent = (evnt: Event) => {
1248
1301
  const { type } = props
1249
1302
  const { datePanelType, selectMonth } = reactData
1303
+ const { yearSize } = internalData
1250
1304
  const isDisabledNextDateBtn = computeIsDisabledNextDateBtn.value
1251
1305
  if (!isDisabledNextDateBtn) {
1252
1306
  if (type === 'year') {
@@ -1425,10 +1479,10 @@ export default defineComponent({
1425
1479
  datetimeRest.push(item)
1426
1480
  }
1427
1481
  })
1428
- emitModel(datetimeRest.map(date => XEUtils.toDateString(date, dateValueFormat)).join(','), { type: 'update' })
1482
+ handleChange(datetimeRest.map(date => XEUtils.toDateString(date, dateValueFormat)).join(','), { type: 'update' })
1429
1483
  } else {
1430
1484
  // 如果是日期类型
1431
- emitModel(dateMultipleValue.join(','), { type: 'update' })
1485
+ handleChange(dateMultipleValue.join(','), { type: 'update' })
1432
1486
  }
1433
1487
  } else {
1434
1488
  dateChange(dateValue || reactData.currentDate)
@@ -1541,7 +1595,9 @@ export default defineComponent({
1541
1595
  reactData.datetimePanelValue = reactData.datePanelValue || XEUtils.getWhatDay(Date.now(), 0, 'first')
1542
1596
  nextTick(() => {
1543
1597
  const timeBodyElem = refInputTimeBody.value
1544
- XEUtils.arrayEach(timeBodyElem.querySelectorAll('li.is--selected'), updateTimePos)
1598
+ XEUtils.arrayEach(timeBodyElem.querySelectorAll('li.is--selected'), (elem) => {
1599
+ updateTimePos(elem)
1600
+ })
1545
1601
  })
1546
1602
  }
1547
1603
  }
@@ -1630,13 +1686,17 @@ export default defineComponent({
1630
1686
 
1631
1687
  const showPanel = () => {
1632
1688
  const { visiblePanel } = reactData
1689
+ const { hpTimeout } = internalData
1633
1690
  const isDisabled = computeIsDisabled.value
1634
1691
  const isDatePickerType = computeIsDatePickerType.value
1635
1692
  if (!isDisabled && !visiblePanel) {
1636
1693
  if (!reactData.initialized) {
1637
1694
  reactData.initialized = true
1638
1695
  }
1639
- clearTimeout(hidePanelTimeout)
1696
+ if (hpTimeout) {
1697
+ clearTimeout(hpTimeout)
1698
+ internalData.hpTimeout = undefined
1699
+ }
1640
1700
  reactData.isActivated = true
1641
1701
  reactData.isAniVisible = true
1642
1702
  if (isDatePickerType) {
@@ -1793,13 +1853,13 @@ export default defineComponent({
1793
1853
  }]
1794
1854
  }, extraItem && extraItem.label
1795
1855
  ? [
1796
- h('span', label),
1856
+ h('span', `${label || ''}`),
1797
1857
  h('span', {
1798
1858
  class: ['vxe-input--date-label--extra', extraItem.important ? 'is-important' : '', extraItem.className],
1799
1859
  style: extraItem.style
1800
1860
  }, XEUtils.toValueString(extraItem.label))
1801
1861
  ]
1802
- : label)
1862
+ : [`${label || ''}`])
1803
1863
  ]
1804
1864
  const festivalLabel = festivalItem.label
1805
1865
  if (festivalLabel) {
@@ -1822,7 +1882,7 @@ export default defineComponent({
1822
1882
  }
1823
1883
  return labels
1824
1884
  }
1825
- return label
1885
+ return [`${label || ''}`]
1826
1886
  }
1827
1887
 
1828
1888
  const renderDateDayTable = () => {
@@ -2393,10 +2453,12 @@ export default defineComponent({
2393
2453
  return createCommentVNode()
2394
2454
  }
2395
2455
 
2456
+ const dispatchEvent = (type: ValueOf<VxeInputEmits>, params: Record<string, any>, evnt: Event | null) => {
2457
+ emit(type, createEvent(evnt, { $input: $xeInput }, params))
2458
+ }
2459
+
2396
2460
  inputMethods = {
2397
- dispatchEvent (type, params, evnt) {
2398
- emit(type, createEvent(evnt, { $input: $xeInput }, params))
2399
- },
2461
+ dispatchEvent,
2400
2462
 
2401
2463
  focus () {
2402
2464
  const inputElem = refInputTarget.value
@@ -2438,7 +2500,7 @@ export default defineComponent({
2438
2500
  const isCountError = computeIsCountError.value
2439
2501
  const inputCount = computeInputCount.value
2440
2502
  const inputReadonly = computeInputReadonly.value
2441
- const inpMaxlength = computeInpMaxlength.value
2503
+ const inpMaxLength = computeInpMaxLength.value
2442
2504
  const inputType = computeInputType.value
2443
2505
  const inpPlaceholder = computeInpPlaceholder.value
2444
2506
  const isClearable = computeIsClearable.value
@@ -2472,7 +2534,7 @@ export default defineComponent({
2472
2534
  name,
2473
2535
  type: inputType,
2474
2536
  placeholder: inpPlaceholder,
2475
- maxlength: inpMaxlength,
2537
+ maxlength: inpMaxLength,
2476
2538
  readonly: inputReadonly,
2477
2539
  disabled: isDisabled,
2478
2540
  autocomplete: autoComplete || autocomplete,
@@ -2495,13 +2557,11 @@ export default defineComponent({
2495
2557
  class: ['vxe-input--count', {
2496
2558
  'is--error': isCountError
2497
2559
  }]
2498
- }, countMethod ? `${countMethod({ value: inputValue })}` : `${inputCount}${inpMaxlength ? `/${inpMaxlength}` : ''}`)
2560
+ }, countMethod ? `${countMethod({ value: inputValue })}` : `${inputCount}${inpMaxLength ? `/${inpMaxLength}` : ''}`)
2499
2561
  : createCommentVNode()
2500
2562
  ])
2501
2563
  }
2502
2564
 
2503
- $xeInput.renderVN = renderVN
2504
-
2505
2565
  watch(() => props.modelValue, (val) => {
2506
2566
  reactData.inputValue = val
2507
2567
  changeValue()
@@ -2547,6 +2607,8 @@ export default defineComponent({
2547
2607
 
2548
2608
  initValue()
2549
2609
 
2610
+ $xeInput.renderVN = renderVN
2611
+
2550
2612
  return $xeInput
2551
2613
  },
2552
2614
  render () {