vxe-pc-ui 4.1.19 → 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.
- package/README.md +83 -2
- package/es/anchor/src/anchor-link.js +1 -1
- package/es/anchor/src/anchor.js +1 -1
- package/es/breadcrumb/src/breadcrumb.js +1 -1
- package/es/button/src/button-group.js +4 -1
- package/es/button/src/button.js +2 -1
- package/es/calendar/src/calendar.js +64 -32
- package/es/card/src/card.js +4 -3
- package/es/carousel/src/carousel-item.js +13 -3
- package/es/carousel/src/carousel.js +16 -8
- package/es/checkbox/src/checkbox.js +30 -14
- package/es/checkbox/src/group.js +17 -8
- package/es/collapse-pane/index.js +1 -1
- package/es/countdown/src/countdown.js +17 -8
- package/es/date-picker/src/date-picker.js +148 -69
- package/es/drawer/src/drawer.js +86 -46
- package/es/form/render/index.js +1 -2
- package/es/form/src/form-config-item.js +4 -3
- package/es/form/src/form-gather.js +5 -3
- package/es/form/src/form-item.js +15 -10
- package/es/form/src/form.js +11 -8
- package/es/form/src/render.js +2 -1
- package/es/form/src/util.js +2 -1
- package/es/icon/src/icon.js +3 -0
- package/es/icon/style.css +1 -1
- package/es/icon-picker/src/icon-picker.js +24 -11
- package/es/image/src/group.js +4 -1
- package/es/image/src/preview.js +1 -1
- package/es/input/src/input.js +131 -66
- package/es/layout-aside/src/layout-aside.js +1 -1
- package/es/list/src/list.js +7 -5
- package/es/list-design/src/list-design.js +1 -1
- package/es/list-design/src/list-view.js +1 -1
- package/es/loading/src/loading.js +4 -1
- package/es/menu/src/menu.js +4 -3
- package/es/number-input/src/number-input.js +100 -77
- package/es/pager/src/pager.js +85 -45
- package/es/password-input/src/password-input.js +2 -2
- package/es/print/src/page-break.js +11 -2
- package/es/print/src/print.js +6 -4
- package/es/pulldown/src/pulldown.js +19 -13
- package/es/radio/src/button.js +2 -2
- package/es/radio/src/group.js +8 -4
- package/es/row/src/row.js +1 -1
- package/es/select/src/optgroup.js +19 -10
- package/es/select/src/option.js +17 -9
- package/es/select/src/select.js +64 -41
- package/es/select/src/util.js +2 -2
- package/es/style.css +1 -1
- package/es/style.min.css +1 -1
- package/es/tabs/src/tab-pane.js +13 -3
- package/es/tabs/src/tabs.js +57 -47
- package/es/textarea/src/textarea.js +28 -10
- package/es/tooltip/src/tooltip.js +107 -78
- package/es/tree/src/tree.js +6 -3
- package/es/tree-select/src/tree-select.js +18 -10
- package/es/ui/index.js +1 -7
- package/es/ui/src/log.js +1 -1
- package/es/upload/src/upload.js +5 -5
- package/lib/anchor/src/anchor-link.js +1 -1
- package/lib/anchor/src/anchor-link.min.js +1 -1
- package/lib/anchor/src/anchor.js +1 -1
- package/lib/anchor/src/anchor.min.js +1 -1
- package/lib/breadcrumb/src/breadcrumb.js +1 -1
- package/lib/breadcrumb/src/breadcrumb.min.js +1 -1
- package/lib/button/src/button-group.js +4 -1
- package/lib/button/src/button-group.min.js +1 -1
- package/lib/button/src/button.js +2 -1
- package/lib/button/src/button.min.js +1 -1
- package/lib/calendar/src/calendar.js +42 -24
- package/lib/calendar/src/calendar.min.js +1 -1
- package/lib/card/src/card.js +6 -5
- package/lib/card/src/card.min.js +1 -1
- package/lib/carousel/src/carousel-item.js +16 -3
- package/lib/carousel/src/carousel-item.min.js +1 -1
- package/lib/carousel/src/carousel.js +18 -8
- package/lib/carousel/src/carousel.min.js +1 -1
- package/lib/checkbox/src/checkbox.js +16 -12
- package/lib/checkbox/src/checkbox.min.js +1 -1
- package/lib/checkbox/src/group.js +10 -7
- package/lib/checkbox/src/group.min.js +1 -1
- package/lib/collapse-pane/index.js +1 -1
- package/lib/collapse-pane/index.min.js +1 -1
- package/lib/countdown/src/countdown.js +15 -7
- package/lib/countdown/src/countdown.min.js +1 -1
- package/lib/date-picker/src/date-picker.js +124 -62
- package/lib/date-picker/src/date-picker.min.js +1 -1
- package/lib/drawer/src/drawer.js +15 -30
- package/lib/drawer/src/drawer.min.js +1 -1
- package/lib/form/render/index.js +1 -4
- package/lib/form/render/index.min.js +1 -1
- package/lib/form/src/form-config-item.js +4 -5
- package/lib/form/src/form-config-item.min.js +1 -1
- package/lib/form/src/form-gather.js +11 -9
- package/lib/form/src/form-gather.min.js +1 -1
- package/lib/form/src/form-item.js +11 -12
- package/lib/form/src/form-item.min.js +1 -1
- package/lib/form/src/form.js +7 -7
- package/lib/form/src/form.min.js +1 -1
- package/lib/form/src/render.js +2 -1
- package/lib/form/src/util.js +2 -1
- package/lib/icon/src/icon.js +3 -0
- package/lib/icon/src/icon.min.js +1 -1
- package/lib/icon/style/style.css +1 -1
- package/lib/icon/style/style.min.css +1 -1
- package/lib/icon-picker/src/icon-picker.js +22 -12
- package/lib/icon-picker/src/icon-picker.min.js +1 -1
- package/lib/image/src/group.js +4 -1
- package/lib/image/src/group.min.js +1 -1
- package/lib/image/src/preview.js +1 -1
- package/lib/image/src/preview.min.js +1 -1
- package/lib/index.umd.js +884 -649
- package/lib/index.umd.min.js +1 -1
- package/lib/input/src/input.js +79 -51
- package/lib/input/src/input.min.js +1 -1
- package/lib/layout-aside/src/layout-aside.js +1 -1
- package/lib/layout-aside/src/layout-aside.min.js +1 -1
- package/lib/list/src/list.js +9 -5
- package/lib/list/src/list.min.js +1 -1
- package/lib/list-design/src/list-design.js +1 -1
- package/lib/list-design/src/list-design.min.js +1 -1
- package/lib/list-design/src/list-view.js +1 -1
- package/lib/list-design/src/list-view.min.js +1 -1
- package/lib/loading/src/loading.js +4 -1
- package/lib/loading/src/loading.min.js +1 -1
- package/lib/menu/src/menu.js +4 -3
- package/lib/menu/src/menu.min.js +1 -1
- package/lib/number-input/src/number-input.js +67 -69
- package/lib/number-input/src/number-input.min.js +1 -1
- package/lib/pager/src/pager.js +40 -39
- package/lib/pager/src/pager.min.js +1 -1
- package/lib/password-input/src/password-input.js +2 -2
- package/lib/print/src/page-break.js +14 -2
- package/lib/print/src/page-break.min.js +1 -1
- package/lib/print/src/print.js +8 -6
- package/lib/print/src/print.min.js +1 -1
- package/lib/pulldown/src/pulldown.js +19 -13
- package/lib/pulldown/src/pulldown.min.js +1 -1
- package/lib/radio/src/button.js +2 -2
- package/lib/radio/src/group.js +8 -4
- package/lib/radio/src/group.min.js +1 -1
- package/lib/row/src/row.js +1 -1
- package/lib/row/src/row.min.js +1 -1
- package/lib/select/src/optgroup.js +12 -9
- package/lib/select/src/optgroup.min.js +1 -1
- package/lib/select/src/option.js +9 -7
- package/lib/select/src/option.min.js +1 -1
- package/lib/select/src/select.js +52 -41
- package/lib/select/src/select.min.js +1 -1
- package/lib/select/src/util.js +2 -2
- package/lib/select/src/util.min.js +1 -1
- package/lib/style.css +1 -1
- package/lib/style.min.css +1 -1
- package/lib/tabs/src/tab-pane.js +16 -3
- package/lib/tabs/src/tab-pane.min.js +1 -1
- package/lib/tabs/src/tabs.js +62 -50
- package/lib/tabs/src/tabs.min.js +1 -1
- package/lib/textarea/src/textarea.js +4 -4
- package/lib/tooltip/src/tooltip.js +96 -88
- package/lib/tooltip/src/tooltip.min.js +1 -1
- package/lib/tree/src/tree.js +2 -2
- package/lib/tree/src/tree.min.js +1 -1
- package/lib/tree-select/src/tree-select.js +13 -8
- package/lib/tree-select/src/tree-select.min.js +1 -1
- package/lib/ui/index.js +3 -10
- package/lib/ui/index.min.js +1 -1
- package/lib/ui/src/log.js +1 -1
- package/lib/ui/src/log.min.js +1 -1
- package/lib/upload/src/upload.js +5 -5
- package/lib/upload/src/upload.min.js +1 -1
- package/package.json +2 -2
- package/packages/anchor/src/anchor-link.ts +2 -2
- package/packages/anchor/src/anchor.ts +2 -2
- package/packages/breadcrumb/src/breadcrumb.ts +2 -2
- package/packages/button/src/button-group.ts +4 -1
- package/packages/button/src/button.ts +6 -5
- package/packages/calendar/src/calendar.ts +67 -35
- package/packages/card/src/card.ts +6 -4
- package/packages/carousel/src/carousel-item.ts +19 -4
- package/packages/carousel/src/carousel.ts +19 -11
- package/packages/checkbox/src/checkbox.ts +34 -15
- package/packages/checkbox/src/group.ts +22 -10
- package/packages/collapse-pane/index.ts +1 -1
- package/packages/countdown/src/countdown.ts +20 -11
- package/packages/date-picker/src/date-picker.ts +160 -80
- package/packages/drawer/src/drawer.ts +91 -50
- package/packages/form/render/index.ts +1 -3
- package/packages/form/src/form-config-item.ts +4 -3
- package/packages/form/src/form-gather.ts +5 -3
- package/packages/form/src/form-item.ts +15 -10
- package/packages/form/src/form.ts +12 -10
- package/packages/form/src/render.ts +2 -1
- package/packages/form/src/util.ts +2 -1
- package/packages/icon/src/icon.ts +3 -0
- package/packages/icon-picker/src/icon-picker.ts +31 -17
- package/packages/image/src/group.ts +4 -1
- package/packages/image/src/preview.ts +2 -2
- package/packages/input/src/input.ts +138 -75
- package/packages/layout-aside/src/layout-aside.ts +2 -2
- package/packages/list/src/list.ts +12 -11
- package/packages/list-design/src/list-design.ts +2 -2
- package/packages/list-design/src/list-view.ts +2 -2
- package/packages/loading/src/loading.ts +5 -2
- package/packages/menu/src/menu.ts +5 -4
- package/packages/number-input/src/number-input.ts +102 -79
- package/packages/pager/src/pager.ts +91 -50
- package/packages/password-input/src/password-input.ts +2 -2
- package/packages/print/src/page-break.ts +18 -4
- package/packages/print/src/print.ts +10 -5
- package/packages/pulldown/src/pulldown.ts +28 -22
- package/packages/radio/src/button.ts +2 -2
- package/packages/radio/src/group.ts +9 -5
- package/packages/row/src/row.ts +2 -2
- package/packages/select/src/optgroup.ts +22 -13
- package/packages/select/src/option.ts +18 -10
- package/packages/select/src/select.ts +79 -52
- package/packages/select/src/util.ts +3 -3
- package/packages/tabs/src/tab-pane.ts +20 -5
- package/packages/tabs/src/tabs.ts +59 -49
- package/packages/textarea/src/textarea.ts +28 -10
- package/packages/tooltip/src/tooltip.ts +118 -84
- package/packages/tree/src/tree.ts +7 -4
- package/packages/tree-select/src/tree-select.ts +25 -16
- package/packages/ui/index.ts +0 -7
- package/packages/upload/src/upload.ts +6 -6
- package/types/components/calendar.d.ts +6 -0
- package/types/components/carousel.d.ts +5 -0
- package/types/components/countdown.d.ts +4 -0
- package/types/components/date-picker.d.ts +23 -5
- package/types/components/drawer.d.ts +0 -1
- package/types/components/form.d.ts +4 -2
- package/types/components/icon-picker.d.ts +4 -0
- package/types/components/input.d.ts +9 -1
- package/types/components/list.d.ts +1 -0
- package/types/components/number-input.d.ts +6 -2
- package/types/components/optgroup.d.ts +10 -4
- package/types/components/pulldown.d.ts +5 -1
- package/types/components/select.d.ts +4 -0
- package/types/components/tabs.d.ts +4 -0
- package/types/components/toolbar.d.ts +5 -0
- package/types/components/tooltip.d.ts +4 -0
- package/types/components/tree-select.d.ts +4 -0
- package/types/ui/index.d.ts +0 -22
- /package/es/{collapse-pane → collapse}/src/collapse-pane.js +0 -0
- /package/es/icon/style/{iconfont.1725597808239.ttf → iconfont.1725941866604.ttf} +0 -0
- /package/es/icon/style/{iconfont.1725597808239.woff → iconfont.1725941866604.woff} +0 -0
- /package/es/icon/style/{iconfont.1725597808239.woff2 → iconfont.1725941866604.woff2} +0 -0
- /package/es/{iconfont.1725597808239.ttf → iconfont.1725941866604.ttf} +0 -0
- /package/es/{iconfont.1725597808239.woff → iconfont.1725941866604.woff} +0 -0
- /package/es/{iconfont.1725597808239.woff2 → iconfont.1725941866604.woff2} +0 -0
- /package/lib/{collapse-pane → collapse}/src/collapse-pane.js +0 -0
- /package/lib/{collapse-pane → collapse}/src/collapse-pane.min.js +0 -0
- /package/lib/icon/style/{iconfont.1725597808239.ttf → iconfont.1725941866604.ttf} +0 -0
- /package/lib/icon/style/{iconfont.1725597808239.woff → iconfont.1725941866604.woff} +0 -0
- /package/lib/icon/style/{iconfont.1725597808239.woff2 → iconfont.1725941866604.woff2} +0 -0
- /package/lib/{iconfont.1725597808239.ttf → iconfont.1725941866604.ttf} +0 -0
- /package/lib/{iconfont.1725597808239.woff → iconfont.1725941866604.woff} +0 -0
- /package/lib/{iconfont.1725597808239.woff2 → iconfont.1725941866604.woff2} +0 -0
- /package/packages/{collapse-pane → collapse}/src/collapse-pane.ts +0 -0
|
@@ -135,14 +135,17 @@ export default defineComponent({
|
|
|
135
135
|
])
|
|
136
136
|
}
|
|
137
137
|
|
|
138
|
-
$xeLoading.renderVN = renderVN
|
|
139
|
-
|
|
140
138
|
watch(() => props.modelValue, () => {
|
|
141
139
|
handleInit()
|
|
142
140
|
})
|
|
143
141
|
|
|
144
142
|
handleInit()
|
|
145
143
|
|
|
144
|
+
$xeLoading.renderVN = renderVN
|
|
145
|
+
|
|
146
146
|
return $xeLoading
|
|
147
|
+
},
|
|
148
|
+
render () {
|
|
149
|
+
return this.renderVN()
|
|
147
150
|
}
|
|
148
151
|
})
|
|
@@ -157,8 +157,9 @@ export default defineComponent({
|
|
|
157
157
|
const handleClickMenu = (evnt: KeyboardEvent, item: VxeMenuDefines.MenuItem) => {
|
|
158
158
|
const { routerLink, hasChild } = item
|
|
159
159
|
if (routerLink) {
|
|
160
|
-
|
|
161
|
-
|
|
160
|
+
const value = item.itemKey
|
|
161
|
+
reactData.activeName = value
|
|
162
|
+
emit('update:modelValue', value)
|
|
162
163
|
} else {
|
|
163
164
|
if (hasChild) {
|
|
164
165
|
handleClickIconCollapse(evnt, item)
|
|
@@ -282,8 +283,6 @@ export default defineComponent({
|
|
|
282
283
|
])
|
|
283
284
|
}
|
|
284
285
|
|
|
285
|
-
$xeMenu.renderVN = renderVN
|
|
286
|
-
|
|
287
286
|
const optFlag = ref(0)
|
|
288
287
|
watch(() => props.options ? props.options.length : -1, () => {
|
|
289
288
|
optFlag.value++
|
|
@@ -313,6 +312,8 @@ export default defineComponent({
|
|
|
313
312
|
updateMenuConfig()
|
|
314
313
|
updateActiveMenu(true)
|
|
315
314
|
|
|
315
|
+
$xeMenu.renderVN = renderVN
|
|
316
|
+
|
|
316
317
|
return $xeMenu
|
|
317
318
|
},
|
|
318
319
|
render () {
|
|
@@ -6,16 +6,25 @@ import { hasClass, getEventTargetNode } from '../../ui/src/dom'
|
|
|
6
6
|
import { getSlotVNs } from '../..//ui/src/vn'
|
|
7
7
|
import { handleNumber, toFloatValueFixed } from './util'
|
|
8
8
|
|
|
9
|
-
import type { VxeNumberInputConstructor, VxeNumberInputEmits, NumberInputReactData, NumberInputMethods, VxeNumberInputPropTypes, InputPrivateRef, VxeFormConstructor, VxeFormPrivateMethods, VxeFormDefines } from '../../../types'
|
|
9
|
+
import type { VxeNumberInputConstructor, NumberInputInternalData, VxeNumberInputEmits, NumberInputReactData, NumberInputMethods, VxeNumberInputPropTypes, InputPrivateRef, VxeFormConstructor, VxeFormPrivateMethods, VxeFormDefines, ValueOf } from '../../../types'
|
|
10
10
|
|
|
11
11
|
export default defineComponent({
|
|
12
12
|
name: 'VxeNumberInput',
|
|
13
13
|
props: {
|
|
14
14
|
modelValue: [String, Number] as PropType<VxeNumberInputPropTypes.ModelValue>,
|
|
15
|
-
immediate: {
|
|
15
|
+
immediate: {
|
|
16
|
+
type: Boolean as PropType<VxeNumberInputPropTypes.Immediate>,
|
|
17
|
+
default: true
|
|
18
|
+
},
|
|
16
19
|
name: String as PropType<VxeNumberInputPropTypes.Name>,
|
|
17
|
-
type: {
|
|
18
|
-
|
|
20
|
+
type: {
|
|
21
|
+
type: String as PropType<VxeNumberInputPropTypes.Type>,
|
|
22
|
+
default: 'number'
|
|
23
|
+
},
|
|
24
|
+
clearable: {
|
|
25
|
+
type: Boolean as PropType<VxeNumberInputPropTypes.Clearable>,
|
|
26
|
+
default: () => getConfig().numberInput.clearable
|
|
27
|
+
},
|
|
19
28
|
readonly: {
|
|
20
29
|
type: Boolean as PropType<VxeNumberInputPropTypes.Readonly>,
|
|
21
30
|
default: null
|
|
@@ -33,20 +42,38 @@ export default defineComponent({
|
|
|
33
42
|
align: String as PropType<VxeNumberInputPropTypes.Align>,
|
|
34
43
|
form: String as PropType<VxeNumberInputPropTypes.Form>,
|
|
35
44
|
className: String as PropType<VxeNumberInputPropTypes.ClassName>,
|
|
36
|
-
size: {
|
|
45
|
+
size: {
|
|
46
|
+
type: String as PropType<VxeNumberInputPropTypes.Size>,
|
|
47
|
+
default: () => getConfig().numberInput.size || getConfig().size
|
|
48
|
+
},
|
|
37
49
|
multiple: Boolean as PropType<VxeNumberInputPropTypes.Multiple>,
|
|
38
50
|
|
|
39
51
|
// number、integer、float
|
|
40
|
-
min: {
|
|
41
|
-
|
|
52
|
+
min: {
|
|
53
|
+
type: [String, Number] as PropType<VxeNumberInputPropTypes.Min>,
|
|
54
|
+
default: null
|
|
55
|
+
},
|
|
56
|
+
max: {
|
|
57
|
+
type: [String, Number] as PropType<VxeNumberInputPropTypes.Max>,
|
|
58
|
+
default: null
|
|
59
|
+
},
|
|
42
60
|
step: [String, Number] as PropType<VxeNumberInputPropTypes.Step>,
|
|
43
|
-
exponential: {
|
|
61
|
+
exponential: {
|
|
62
|
+
type: Boolean as PropType<VxeNumberInputPropTypes.Exponential>,
|
|
63
|
+
default: () => getConfig().numberInput.exponential
|
|
64
|
+
},
|
|
44
65
|
|
|
45
66
|
// number、integer、float
|
|
46
|
-
controls: {
|
|
67
|
+
controls: {
|
|
68
|
+
type: Boolean as PropType<VxeNumberInputPropTypes.Controls>,
|
|
69
|
+
default: () => getConfig().numberInput.controls
|
|
70
|
+
},
|
|
47
71
|
|
|
48
72
|
// float
|
|
49
|
-
digits: {
|
|
73
|
+
digits: {
|
|
74
|
+
type: [String, Number] as PropType<VxeNumberInputPropTypes.Digits>,
|
|
75
|
+
default: () => getConfig().numberInput.digits
|
|
76
|
+
},
|
|
50
77
|
|
|
51
78
|
prefixIcon: String as PropType<VxeNumberInputPropTypes.PrefixIcon>,
|
|
52
79
|
suffixIcon: String as PropType<VxeNumberInputPropTypes.SuffixIcon>,
|
|
@@ -87,6 +114,10 @@ export default defineComponent({
|
|
|
87
114
|
inputValue: props.modelValue
|
|
88
115
|
})
|
|
89
116
|
|
|
117
|
+
const internalData: NumberInputInternalData = {
|
|
118
|
+
dnTimeout: undefined
|
|
119
|
+
}
|
|
120
|
+
|
|
90
121
|
const refElem = ref() as Ref<HTMLDivElement>
|
|
91
122
|
const refInputTarget = ref() as Ref<HTMLInputElement>
|
|
92
123
|
const refInputPanel = ref() as Ref<HTMLDivElement>
|
|
@@ -101,10 +132,11 @@ export default defineComponent({
|
|
|
101
132
|
props,
|
|
102
133
|
context,
|
|
103
134
|
reactData,
|
|
135
|
+
internalData,
|
|
104
136
|
getRefMaps: () => refMaps
|
|
105
137
|
} as unknown as VxeNumberInputConstructor
|
|
106
138
|
|
|
107
|
-
let
|
|
139
|
+
let numberInputMethods = {} as NumberInputMethods
|
|
108
140
|
|
|
109
141
|
const computeFormReadonly = computed(() => {
|
|
110
142
|
const { readonly } = props
|
|
@@ -128,10 +160,6 @@ export default defineComponent({
|
|
|
128
160
|
return disabled
|
|
129
161
|
})
|
|
130
162
|
|
|
131
|
-
const computeIsNumType = computed(() => {
|
|
132
|
-
return true
|
|
133
|
-
})
|
|
134
|
-
|
|
135
163
|
const computeDigitsValue = computed(() => {
|
|
136
164
|
return XEUtils.toInteger(props.digits) || 1
|
|
137
165
|
})
|
|
@@ -170,7 +198,7 @@ export default defineComponent({
|
|
|
170
198
|
return getI18n('vxe.base.pleaseInput')
|
|
171
199
|
})
|
|
172
200
|
|
|
173
|
-
const
|
|
201
|
+
const computeInpMaxLength = computed(() => {
|
|
174
202
|
const { maxLength, maxlength } = props
|
|
175
203
|
// 数值最大长度限制 16 位,包含小数
|
|
176
204
|
return XEUtils.toNumber(maxLength || maxlength) || 16
|
|
@@ -184,11 +212,7 @@ export default defineComponent({
|
|
|
184
212
|
const computeNumValue = computed(() => {
|
|
185
213
|
const { type } = props
|
|
186
214
|
const { inputValue } = reactData
|
|
187
|
-
|
|
188
|
-
if (isNumType) {
|
|
189
|
-
return type === 'integer' ? XEUtils.toInteger(handleNumber(inputValue)) : XEUtils.toNumber(handleNumber(inputValue))
|
|
190
|
-
}
|
|
191
|
-
return 0
|
|
215
|
+
return type === 'integer' ? XEUtils.toInteger(handleNumber(inputValue)) : XEUtils.toNumber(handleNumber(inputValue))
|
|
192
216
|
})
|
|
193
217
|
|
|
194
218
|
const computeNumLabel = computed(() => {
|
|
@@ -199,10 +223,9 @@ export default defineComponent({
|
|
|
199
223
|
const computeIsDisabledSubtractNumber = computed(() => {
|
|
200
224
|
const { min } = props
|
|
201
225
|
const { inputValue } = reactData
|
|
202
|
-
const isNumType = computeIsNumType.value
|
|
203
226
|
const numValue = computeNumValue.value
|
|
204
227
|
// 当有值时再进行判断
|
|
205
|
-
if ((inputValue || inputValue === 0) &&
|
|
228
|
+
if ((inputValue || inputValue === 0) && min !== null) {
|
|
206
229
|
return numValue <= XEUtils.toNumber(min)
|
|
207
230
|
}
|
|
208
231
|
return false
|
|
@@ -211,10 +234,9 @@ export default defineComponent({
|
|
|
211
234
|
const computeIsDisabledAddNumber = computed(() => {
|
|
212
235
|
const { max } = props
|
|
213
236
|
const { inputValue } = reactData
|
|
214
|
-
const isNumType = computeIsNumType.value
|
|
215
237
|
const numValue = computeNumValue.value
|
|
216
238
|
// 当有值时再进行判断
|
|
217
|
-
if ((inputValue || inputValue === 0) &&
|
|
239
|
+
if ((inputValue || inputValue === 0) && max !== null) {
|
|
218
240
|
return numValue >= XEUtils.toNumber(max)
|
|
219
241
|
}
|
|
220
242
|
return false
|
|
@@ -222,29 +244,30 @@ export default defineComponent({
|
|
|
222
244
|
|
|
223
245
|
const getNumberValue = (val: any) => {
|
|
224
246
|
const { type, exponential } = props
|
|
225
|
-
const
|
|
247
|
+
const inpMaxLength = computeInpMaxLength.value
|
|
226
248
|
const digitsValue = computeDigitsValue.value
|
|
227
249
|
const restVal = (type === 'float' ? toFloatValueFixed(val, digitsValue) : XEUtils.toValueString(val))
|
|
228
250
|
if (exponential && (val === restVal || XEUtils.toValueString(val).toLowerCase() === XEUtils.toNumber(restVal).toExponential())) {
|
|
229
251
|
return val
|
|
230
252
|
}
|
|
231
|
-
return restVal.slice(0,
|
|
253
|
+
return restVal.slice(0, inpMaxLength)
|
|
232
254
|
}
|
|
233
255
|
|
|
234
256
|
const triggerEvent = (evnt: Event & { type: 'input' | 'change' | 'keydown' | 'keyup' | 'wheel' | 'click' | 'focus' | 'blur' }) => {
|
|
235
257
|
const { inputValue } = reactData
|
|
236
|
-
|
|
258
|
+
numberInputMethods.dispatchEvent(evnt.type, { value: inputValue }, evnt)
|
|
237
259
|
}
|
|
238
260
|
|
|
239
|
-
const
|
|
261
|
+
const handleChange = (val: number | null, inputValue: string, evnt: Event | { type: string }) => {
|
|
262
|
+
const value = val ? Number(val) : null
|
|
240
263
|
const isChange = Number(value) !== props.modelValue
|
|
241
264
|
if (isChange) {
|
|
242
265
|
reactData.inputValue = inputValue || ''
|
|
243
|
-
emit('update:modelValue', value
|
|
266
|
+
emit('update:modelValue', value)
|
|
244
267
|
}
|
|
245
|
-
|
|
268
|
+
numberInputMethods.dispatchEvent('input', { value }, evnt as Event)
|
|
246
269
|
if (isChange) {
|
|
247
|
-
|
|
270
|
+
numberInputMethods.dispatchEvent('change', { value }, evnt as Event)
|
|
248
271
|
// 自动更新校验状态
|
|
249
272
|
if ($xeForm && formItemInfo) {
|
|
250
273
|
$xeForm.triggerItemEvent(evnt, formItemInfo.itemConfig.field, value)
|
|
@@ -257,9 +280,9 @@ export default defineComponent({
|
|
|
257
280
|
const value = inputValue ? XEUtils.toNumber(inputValue) : null
|
|
258
281
|
reactData.inputValue = inputValue
|
|
259
282
|
if (inpImmediate) {
|
|
260
|
-
|
|
283
|
+
handleChange(value, inputValue, evnt)
|
|
261
284
|
} else {
|
|
262
|
-
|
|
285
|
+
numberInputMethods.dispatchEvent('input', { value }, evnt)
|
|
263
286
|
}
|
|
264
287
|
}
|
|
265
288
|
|
|
@@ -285,21 +308,21 @@ export default defineComponent({
|
|
|
285
308
|
const isDisabled = computeIsDisabled.value
|
|
286
309
|
if (!isDisabled) {
|
|
287
310
|
const { inputValue } = reactData
|
|
288
|
-
|
|
311
|
+
numberInputMethods.dispatchEvent('prefix-click', { value: inputValue }, evnt)
|
|
289
312
|
}
|
|
290
313
|
}
|
|
291
314
|
|
|
292
315
|
const clearValueEvent = (evnt: Event, value: VxeNumberInputPropTypes.ModelValue) => {
|
|
293
316
|
focus()
|
|
294
|
-
|
|
295
|
-
|
|
317
|
+
handleChange(null, '', evnt)
|
|
318
|
+
numberInputMethods.dispatchEvent('clear', { value }, evnt)
|
|
296
319
|
}
|
|
297
320
|
|
|
298
321
|
const clickSuffixEvent = (evnt: Event) => {
|
|
299
322
|
const isDisabled = computeIsDisabled.value
|
|
300
323
|
if (!isDisabled) {
|
|
301
324
|
const { inputValue } = reactData
|
|
302
|
-
|
|
325
|
+
numberInputMethods.dispatchEvent('suffix-click', { value: inputValue }, evnt)
|
|
303
326
|
}
|
|
304
327
|
}
|
|
305
328
|
|
|
@@ -319,7 +342,7 @@ export default defineComponent({
|
|
|
319
342
|
validValue = Number(textValue)
|
|
320
343
|
}
|
|
321
344
|
if (inputValue !== validValue) {
|
|
322
|
-
|
|
345
|
+
handleChange(validValue, textValue, { type: 'init' })
|
|
323
346
|
}
|
|
324
347
|
}
|
|
325
348
|
}
|
|
@@ -352,7 +375,7 @@ export default defineComponent({
|
|
|
352
375
|
}
|
|
353
376
|
}
|
|
354
377
|
const inpValue = getNumberValue(inpNumVal)
|
|
355
|
-
|
|
378
|
+
handleChange(inpValue === null ? null : Number(inpValue), inpValue, { type: 'check' })
|
|
356
379
|
}
|
|
357
380
|
}
|
|
358
381
|
}
|
|
@@ -362,11 +385,11 @@ export default defineComponent({
|
|
|
362
385
|
const inpImmediate = computeInpImmediate.value
|
|
363
386
|
const value = inputValue ? Number(inputValue) : null
|
|
364
387
|
if (!inpImmediate) {
|
|
365
|
-
|
|
388
|
+
handleChange(value, `${inputValue || ''}`, evnt)
|
|
366
389
|
}
|
|
367
390
|
afterCheckValue()
|
|
368
391
|
reactData.isActivated = false
|
|
369
|
-
|
|
392
|
+
numberInputMethods.dispatchEvent('blur', { value }, evnt)
|
|
370
393
|
}
|
|
371
394
|
|
|
372
395
|
// 数值
|
|
@@ -387,21 +410,19 @@ export default defineComponent({
|
|
|
387
410
|
emitInputEvent(getNumberValue(restNum), evnt as (Event & { type: 'input' }))
|
|
388
411
|
}
|
|
389
412
|
|
|
390
|
-
let downbumTimeout: number
|
|
391
|
-
|
|
392
413
|
const numberNextEvent = (evnt: Event) => {
|
|
393
414
|
const isDisabled = computeIsDisabled.value
|
|
394
415
|
const formReadonly = computeFormReadonly.value
|
|
395
416
|
const isDisabledSubtractNumber = computeIsDisabledSubtractNumber.value
|
|
396
|
-
|
|
417
|
+
numberStopDown()
|
|
397
418
|
if (!isDisabled && !formReadonly && !isDisabledSubtractNumber) {
|
|
398
419
|
numberChange(false, evnt)
|
|
399
420
|
}
|
|
400
|
-
|
|
421
|
+
numberInputMethods.dispatchEvent('next-number', {}, evnt)
|
|
401
422
|
}
|
|
402
423
|
|
|
403
424
|
const numberDownNextEvent = (evnt: Event) => {
|
|
404
|
-
|
|
425
|
+
internalData.dnTimeout = window.setTimeout(() => {
|
|
405
426
|
numberNextEvent(evnt)
|
|
406
427
|
numberDownNextEvent(evnt)
|
|
407
428
|
}, 60)
|
|
@@ -411,11 +432,11 @@ export default defineComponent({
|
|
|
411
432
|
const isDisabled = computeIsDisabled.value
|
|
412
433
|
const formReadonly = computeFormReadonly.value
|
|
413
434
|
const isDisabledAddNumber = computeIsDisabledAddNumber.value
|
|
414
|
-
|
|
435
|
+
numberStopDown()
|
|
415
436
|
if (!isDisabled && !formReadonly && !isDisabledAddNumber) {
|
|
416
437
|
numberChange(true, evnt)
|
|
417
438
|
}
|
|
418
|
-
|
|
439
|
+
numberInputMethods.dispatchEvent('prev-number', {}, evnt)
|
|
419
440
|
}
|
|
420
441
|
|
|
421
442
|
const numberKeydownEvent = (evnt: KeyboardEvent) => {
|
|
@@ -433,24 +454,21 @@ export default defineComponent({
|
|
|
433
454
|
|
|
434
455
|
const keydownEvent = (evnt: KeyboardEvent & { type: 'keydown' }) => {
|
|
435
456
|
const { exponential, controls } = props
|
|
436
|
-
const
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
if (controls) {
|
|
452
|
-
numberKeydownEvent(evnt)
|
|
453
|
-
}
|
|
457
|
+
const isCtrlKey = evnt.ctrlKey
|
|
458
|
+
const isShiftKey = evnt.shiftKey
|
|
459
|
+
const isAltKey = evnt.altKey
|
|
460
|
+
const keyCode = evnt.keyCode
|
|
461
|
+
const isEsc = globalEvents.hasKey(evnt, GLOBAL_EVENT_KEYS.ESCAPE)
|
|
462
|
+
const isUpArrow = globalEvents.hasKey(evnt, GLOBAL_EVENT_KEYS.ARROW_UP)
|
|
463
|
+
const isDwArrow = globalEvents.hasKey(evnt, GLOBAL_EVENT_KEYS.ARROW_DOWN)
|
|
464
|
+
if (!isCtrlKey && !isShiftKey && !isAltKey && (globalEvents.hasKey(evnt, GLOBAL_EVENT_KEYS.SPACEBAR) || ((!exponential || keyCode !== 69) && (keyCode >= 65 && keyCode <= 90)) || (keyCode >= 186 && keyCode <= 188) || keyCode >= 191)) {
|
|
465
|
+
evnt.preventDefault()
|
|
466
|
+
}
|
|
467
|
+
if (isEsc) {
|
|
468
|
+
afterCheckValue()
|
|
469
|
+
} else if (isUpArrow || isDwArrow) {
|
|
470
|
+
if (controls) {
|
|
471
|
+
numberKeydownEvent(evnt)
|
|
454
472
|
}
|
|
455
473
|
}
|
|
456
474
|
triggerEvent(evnt)
|
|
@@ -463,11 +481,15 @@ export default defineComponent({
|
|
|
463
481
|
// 数值
|
|
464
482
|
|
|
465
483
|
const numberStopDown = () => {
|
|
466
|
-
|
|
484
|
+
const { dnTimeout } = internalData
|
|
485
|
+
if (dnTimeout) {
|
|
486
|
+
clearTimeout(dnTimeout)
|
|
487
|
+
internalData.dnTimeout = undefined
|
|
488
|
+
}
|
|
467
489
|
}
|
|
468
490
|
|
|
469
491
|
const numberDownPrevEvent = (evnt: Event) => {
|
|
470
|
-
|
|
492
|
+
internalData.dnTimeout = window.setTimeout(() => {
|
|
471
493
|
numberPrevEvent(evnt)
|
|
472
494
|
numberDownPrevEvent(evnt)
|
|
473
495
|
}, 60)
|
|
@@ -482,7 +504,7 @@ export default defineComponent({
|
|
|
482
504
|
} else {
|
|
483
505
|
numberNextEvent(evnt)
|
|
484
506
|
}
|
|
485
|
-
|
|
507
|
+
internalData.dnTimeout = window.setTimeout(() => {
|
|
486
508
|
if (isPrevNumber) {
|
|
487
509
|
numberDownPrevEvent(evnt)
|
|
488
510
|
} else {
|
|
@@ -496,8 +518,7 @@ export default defineComponent({
|
|
|
496
518
|
type: 'wheel';
|
|
497
519
|
wheelDelta: number;
|
|
498
520
|
}) => {
|
|
499
|
-
|
|
500
|
-
if (isNumType && props.controls) {
|
|
521
|
+
if (props.controls) {
|
|
501
522
|
if (reactData.isActivated) {
|
|
502
523
|
const delta = evnt.deltaY
|
|
503
524
|
if (delta > 0) {
|
|
@@ -661,10 +682,12 @@ export default defineComponent({
|
|
|
661
682
|
return createCommentVNode()
|
|
662
683
|
}
|
|
663
684
|
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
685
|
+
const dispatchEvent = (type: ValueOf<VxeNumberInputEmits>, params: Record<string, any>, evnt: Event | null) => {
|
|
686
|
+
emit(type, createEvent(evnt, { $numberInput: $xeNumberInput }, params))
|
|
687
|
+
}
|
|
688
|
+
|
|
689
|
+
numberInputMethods = {
|
|
690
|
+
dispatchEvent,
|
|
668
691
|
|
|
669
692
|
focus () {
|
|
670
693
|
const inputElem = refInputTarget.value
|
|
@@ -686,7 +709,7 @@ export default defineComponent({
|
|
|
686
709
|
}
|
|
687
710
|
}
|
|
688
711
|
|
|
689
|
-
Object.assign($xeNumberInput,
|
|
712
|
+
Object.assign($xeNumberInput, numberInputMethods)
|
|
690
713
|
|
|
691
714
|
const renderVN = () => {
|
|
692
715
|
const { className, controls, type, align, name, autocomplete, autoComplete } = props
|
|
@@ -702,7 +725,7 @@ export default defineComponent({
|
|
|
702
725
|
}, numLabel)
|
|
703
726
|
}
|
|
704
727
|
const inputReadonly = computeInputReadonly.value
|
|
705
|
-
const
|
|
728
|
+
const inpMaxLength = computeInpMaxLength.value
|
|
706
729
|
const inpPlaceholder = computeInpPlaceholder.value
|
|
707
730
|
const isClearable = computeIsClearable.value
|
|
708
731
|
const prefix = renderPrefixIcon()
|
|
@@ -732,7 +755,7 @@ export default defineComponent({
|
|
|
732
755
|
name,
|
|
733
756
|
type: 'text',
|
|
734
757
|
placeholder: inpPlaceholder,
|
|
735
|
-
maxlength:
|
|
758
|
+
maxlength: inpMaxLength,
|
|
736
759
|
readonly: inputReadonly,
|
|
737
760
|
disabled: isDisabled,
|
|
738
761
|
autocomplete: autoComplete || autocomplete,
|
|
@@ -5,39 +5,78 @@ import { errLog } from '../../ui/src/log'
|
|
|
5
5
|
import VxeSelectComponent from '../../select/src/select'
|
|
6
6
|
import VxeInputComponent from '../../input/src/input'
|
|
7
7
|
|
|
8
|
-
import type { VxePagerPropTypes, VxePagerConstructor, VxePagerEmits, VxeSelectEvents, PagerPrivateRef, PagerMethods, PagerPrivateMethods, VxePagerPrivateMethods, PagerReactData, VxeGridConstructor, VxeGridPrivateMethods, VxeInputEvents } from '../../../types'
|
|
8
|
+
import type { VxePagerPropTypes, VxePagerConstructor, VxePagerEmits, VxeSelectEvents, ValueOf, PagerPrivateRef, PagerMethods, PagerPrivateMethods, VxePagerPrivateMethods, PagerReactData, VxeGridConstructor, VxeGridPrivateMethods, VxeInputEvents } from '../../../types'
|
|
9
9
|
|
|
10
10
|
export default defineComponent({
|
|
11
11
|
name: 'VxePager',
|
|
12
12
|
props: {
|
|
13
|
-
size: {
|
|
13
|
+
size: {
|
|
14
|
+
type: String as PropType<VxePagerPropTypes.Size>,
|
|
15
|
+
default: () => getConfig().pager.size || getConfig().size
|
|
16
|
+
},
|
|
14
17
|
// 自定义布局
|
|
15
|
-
layouts: {
|
|
18
|
+
layouts: {
|
|
19
|
+
type: Array as PropType<VxePagerPropTypes.Layouts>,
|
|
20
|
+
default: () => getConfig().pager.layouts || ['PrevJump', 'PrevPage', 'Jump', 'PageCount', 'NextPage', 'NextJump', 'Sizes', 'Total']
|
|
21
|
+
},
|
|
16
22
|
// 当前页
|
|
17
|
-
currentPage: {
|
|
23
|
+
currentPage: {
|
|
24
|
+
type: Number as PropType<VxePagerPropTypes.CurrentPage>,
|
|
25
|
+
default: 1
|
|
26
|
+
},
|
|
18
27
|
// 加载中
|
|
19
28
|
loading: Boolean as PropType<VxePagerPropTypes.Loading>,
|
|
20
29
|
// 每页大小
|
|
21
|
-
pageSize: {
|
|
30
|
+
pageSize: {
|
|
31
|
+
type: Number as PropType<VxePagerPropTypes.PageSize>,
|
|
32
|
+
default: () => getConfig().pager.pageSize || 10
|
|
33
|
+
},
|
|
22
34
|
// 总条数
|
|
23
35
|
total: { type: Number as PropType<VxePagerPropTypes.Total>, default: 0 },
|
|
24
36
|
// 显示页码按钮的数量
|
|
25
|
-
pagerCount: {
|
|
37
|
+
pagerCount: {
|
|
38
|
+
type: Number as PropType<VxePagerPropTypes.PagerCount>,
|
|
39
|
+
default: () => getConfig().pager.pagerCount || 7
|
|
40
|
+
},
|
|
26
41
|
// 每页大小选项列表
|
|
27
|
-
pageSizes: {
|
|
42
|
+
pageSizes: {
|
|
43
|
+
type: Array as PropType<VxePagerPropTypes.PageSizes>,
|
|
44
|
+
default: () => getConfig().pager.pageSizes || [10, 15, 20, 50, 100]
|
|
45
|
+
},
|
|
28
46
|
// 列对其方式
|
|
29
|
-
align: {
|
|
47
|
+
align: {
|
|
48
|
+
type: String as PropType<VxePagerPropTypes.Align>,
|
|
49
|
+
default: () => getConfig().pager.align
|
|
50
|
+
},
|
|
30
51
|
// 带边框
|
|
31
|
-
border: {
|
|
52
|
+
border: {
|
|
53
|
+
type: Boolean as PropType<VxePagerPropTypes.Border>,
|
|
54
|
+
default: () => getConfig().pager.border
|
|
55
|
+
},
|
|
32
56
|
// 带背景颜色
|
|
33
|
-
background: {
|
|
57
|
+
background: {
|
|
58
|
+
type: Boolean as PropType<VxePagerPropTypes.Background>,
|
|
59
|
+
default: () => getConfig().pager.background
|
|
60
|
+
},
|
|
34
61
|
// 配套的样式
|
|
35
|
-
perfect: {
|
|
62
|
+
perfect: {
|
|
63
|
+
type: Boolean as PropType<VxePagerPropTypes.Perfect>,
|
|
64
|
+
default: () => getConfig().pager.perfect
|
|
65
|
+
},
|
|
36
66
|
// 当只有一页时隐藏
|
|
37
|
-
autoHidden: {
|
|
38
|
-
|
|
67
|
+
autoHidden: {
|
|
68
|
+
type: Boolean as PropType<VxePagerPropTypes.AutoHidden>,
|
|
69
|
+
default: () => getConfig().pager.autoHidden
|
|
70
|
+
},
|
|
71
|
+
transfer: {
|
|
72
|
+
type: Boolean as PropType<VxePagerPropTypes.Transfer>,
|
|
73
|
+
default: () => getConfig().pager.transfer
|
|
74
|
+
},
|
|
39
75
|
className: [String, Function] as PropType<VxePagerPropTypes.ClassName>,
|
|
40
|
-
pageSizePlacement: {
|
|
76
|
+
pageSizePlacement: {
|
|
77
|
+
type: String as PropType<VxePagerPropTypes.PageSizePlacement>,
|
|
78
|
+
default: () => getConfig().pager.pageSizePlacement
|
|
79
|
+
},
|
|
41
80
|
// 自定义图标
|
|
42
81
|
iconPrevPage: String as PropType<VxePagerPropTypes.IconPrevPage>,
|
|
43
82
|
iconJumpPrev: String as PropType<VxePagerPropTypes.IconJumpPrev>,
|
|
@@ -71,6 +110,37 @@ export default defineComponent({
|
|
|
71
110
|
refElem
|
|
72
111
|
}
|
|
73
112
|
|
|
113
|
+
const computePageCount = computed(() => {
|
|
114
|
+
return getPageCount(props.total, props.pageSize)
|
|
115
|
+
})
|
|
116
|
+
|
|
117
|
+
const computeNumList = computed(() => {
|
|
118
|
+
const { pagerCount } = props
|
|
119
|
+
const pageCount = computePageCount.value
|
|
120
|
+
const len = pageCount > pagerCount ? pagerCount - 2 : pagerCount
|
|
121
|
+
const rest = []
|
|
122
|
+
for (let index = 0; index < len; index++) {
|
|
123
|
+
rest.push(index)
|
|
124
|
+
}
|
|
125
|
+
return rest
|
|
126
|
+
})
|
|
127
|
+
|
|
128
|
+
const computeOffsetNumber = computed(() => {
|
|
129
|
+
return Math.floor((props.pagerCount - 2) / 2)
|
|
130
|
+
})
|
|
131
|
+
|
|
132
|
+
const computeSizeList = computed(() => {
|
|
133
|
+
return props.pageSizes.map((item) => {
|
|
134
|
+
if (XEUtils.isNumber(item)) {
|
|
135
|
+
return {
|
|
136
|
+
value: item,
|
|
137
|
+
label: `${getI18n('vxe.pager.pagesize', [item])}`
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
return { value: '', label: '', ...item }
|
|
141
|
+
})
|
|
142
|
+
})
|
|
143
|
+
|
|
74
144
|
const $xePager = {
|
|
75
145
|
xID,
|
|
76
146
|
props,
|
|
@@ -85,10 +155,6 @@ export default defineComponent({
|
|
|
85
155
|
return Math.max(Math.ceil(total / size), 1)
|
|
86
156
|
}
|
|
87
157
|
|
|
88
|
-
const computePageCount = computed(() => {
|
|
89
|
-
return getPageCount(props.total, props.pageSize)
|
|
90
|
-
})
|
|
91
|
-
|
|
92
158
|
const jumpPageEvent = (evnt: Event, currentPage: number) => {
|
|
93
159
|
emit('update:currentPage', currentPage)
|
|
94
160
|
if (evnt && currentPage !== props.currentPage) {
|
|
@@ -115,33 +181,6 @@ export default defineComponent({
|
|
|
115
181
|
changeCurrentPage(current, $event)
|
|
116
182
|
}
|
|
117
183
|
|
|
118
|
-
const computeNumList = computed(() => {
|
|
119
|
-
const { pagerCount } = props
|
|
120
|
-
const pageCount = computePageCount.value
|
|
121
|
-
const len = pageCount > pagerCount ? pagerCount - 2 : pagerCount
|
|
122
|
-
const rest = []
|
|
123
|
-
for (let index = 0; index < len; index++) {
|
|
124
|
-
rest.push(index)
|
|
125
|
-
}
|
|
126
|
-
return rest
|
|
127
|
-
})
|
|
128
|
-
|
|
129
|
-
const computeOffsetNumber = computed(() => {
|
|
130
|
-
return Math.floor((props.pagerCount - 2) / 2)
|
|
131
|
-
})
|
|
132
|
-
|
|
133
|
-
const computeSizeList = computed(() => {
|
|
134
|
-
return props.pageSizes.map((item) => {
|
|
135
|
-
if (XEUtils.isNumber(item)) {
|
|
136
|
-
return {
|
|
137
|
-
value: item,
|
|
138
|
-
label: `${getI18n('vxe.pager.pagesize', [item])}`
|
|
139
|
-
}
|
|
140
|
-
}
|
|
141
|
-
return { value: '', label: '', ...item }
|
|
142
|
-
})
|
|
143
|
-
})
|
|
144
|
-
|
|
145
184
|
const handleHomePage = (evnt?: Event) => {
|
|
146
185
|
const { currentPage } = props
|
|
147
186
|
if (currentPage > 1) {
|
|
@@ -345,7 +384,7 @@ export default defineComponent({
|
|
|
345
384
|
class: 'vxe-pager--num-btn',
|
|
346
385
|
type: 'button',
|
|
347
386
|
onClick: (evnt: Event) => jumpPageEvent(evnt, 1)
|
|
348
|
-
}, 1),
|
|
387
|
+
}, '1'),
|
|
349
388
|
renderPrevJump('span')
|
|
350
389
|
)
|
|
351
390
|
}
|
|
@@ -360,7 +399,7 @@ export default defineComponent({
|
|
|
360
399
|
}],
|
|
361
400
|
type: 'button',
|
|
362
401
|
onClick: (evnt: Event) => jumpPageEvent(evnt, number)
|
|
363
|
-
}, number)
|
|
402
|
+
}, `${number}`)
|
|
364
403
|
)
|
|
365
404
|
}
|
|
366
405
|
})
|
|
@@ -456,10 +495,12 @@ export default defineComponent({
|
|
|
456
495
|
}, getI18n('vxe.pager.total', [props.total]))
|
|
457
496
|
}
|
|
458
497
|
|
|
498
|
+
const dispatchEvent = (type: ValueOf<VxePagerEmits>, params: Record<string, any>, evnt: Event | null) => {
|
|
499
|
+
emit(type, createEvent(evnt, { $pager: $xePager }, params))
|
|
500
|
+
}
|
|
501
|
+
|
|
459
502
|
pagerMethods = {
|
|
460
|
-
dispatchEvent
|
|
461
|
-
emit(type, createEvent(evnt, { $pager: $xePager }, params))
|
|
462
|
-
},
|
|
503
|
+
dispatchEvent,
|
|
463
504
|
homePage () {
|
|
464
505
|
handleHomePage()
|
|
465
506
|
return nextTick()
|