vxe-table 4.1.20 → 4.2.0-beta.2
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.en.md +2 -4
- package/README.md +2 -3
- package/README.zh-TW.md +2 -4
- package/es/button/index.js +1 -1
- package/es/checkbox/index.js +1 -1
- package/es/checkbox-group/index.js +1 -1
- package/es/colgroup/index.js +3 -2
- package/es/column/index.js +3 -2
- package/es/edit/src/hook.js +2 -1
- package/es/export/index.js +2 -2
- package/es/export/src/hook.js +2 -1
- package/es/export/src/util.js +3 -5
- package/es/filter/index.js +1 -1
- package/es/filter/src/hook.js +17 -10
- package/es/footer/index.js +1 -1
- package/es/footer/src/footer.js +3 -2
- package/es/form/index.js +1 -1
- package/es/form/src/form-gather.js +3 -3
- package/es/form/src/form-item.js +4 -4
- package/es/form/src/form.js +36 -43
- package/es/form/src/render.js +15 -10
- package/es/form/src/util.js +6 -0
- package/es/form-gather/index.js +1 -1
- package/es/form-item/index.js +1 -1
- package/es/grid/index.js +1 -1
- package/es/grid/src/grid.js +2 -1
- package/es/header/index.js +1 -1
- package/es/header/src/header.js +1 -1
- package/es/input/index.js +1 -1
- package/es/input/src/date.js +41 -0
- package/es/input/src/input.js +4 -51
- package/es/input/src/number.js +10 -0
- package/es/list/index.js +1 -1
- package/es/menu/index.js +1 -1
- package/es/modal/index.js +1 -1
- package/es/modal/src/modal.js +2 -1
- package/es/optgroup/index.js +1 -1
- package/es/option/index.js +1 -1
- package/es/pager/index.js +1 -1
- package/es/pager/src/pager.js +13 -2
- package/es/pulldown/index.js +1 -1
- package/es/radio/index.js +1 -1
- package/es/radio-button/index.js +1 -1
- package/es/radio-group/index.js +1 -1
- package/es/select/index.js +1 -1
- package/es/select/style.css +1 -1
- package/es/style.css +1 -1
- package/es/style.min.css +1 -1
- package/es/switch/index.js +1 -1
- package/es/table/index.js +1 -1
- package/es/table/src/body.js +32 -11
- package/es/table/src/cell.js +3 -3
- package/es/table/src/column.js +3 -1
- package/es/table/src/columnInfo.js +5 -4
- package/es/table/src/emits.js +5 -1
- package/es/table/src/props.js +5 -2
- package/es/table/src/table.js +120 -86
- package/es/table/src/util.js +5 -3
- package/es/textarea/index.js +1 -1
- package/es/toolbar/index.js +1 -1
- package/es/toolbar/src/toolbar.js +2 -1
- package/es/tools/dom.js +9 -0
- package/es/tools/log.js +13 -0
- package/es/tools/utils.js +0 -12
- package/es/tooltip/index.js +1 -1
- package/es/tooltip/src/tooltip.js +85 -45
- package/es/tooltip/style.css +1 -1
- package/es/v-x-e-table/index.js +1 -0
- package/es/v-x-e-table/src/conf.js +12 -7
- package/es/v-x-e-table/src/interceptor.js +1 -1
- package/es/v-x-e-table/src/renderer.js +2 -1
- package/es/v-x-e-table/src/store.js +1 -1
- package/helper/vetur/attributes.json +31 -11
- package/helper/vetur/tags.json +8 -3
- package/lib/button/index.js +3 -2
- package/lib/button/index.min.js +1 -1
- package/lib/checkbox/index.js +3 -2
- package/lib/checkbox/index.min.js +1 -1
- package/lib/checkbox-group/index.js +3 -2
- package/lib/checkbox-group/index.min.js +1 -1
- package/lib/colgroup/index.js +6 -4
- package/lib/colgroup/index.min.js +1 -1
- package/lib/column/index.js +6 -4
- package/lib/column/index.min.js +1 -1
- package/lib/edit/src/hook.js +7 -5
- package/lib/edit/src/hook.min.js +1 -1
- package/lib/export/index.js +5 -4
- package/lib/export/index.min.js +1 -1
- package/lib/export/src/hook.js +14 -12
- package/lib/export/src/hook.min.js +1 -1
- package/lib/export/src/util.js +7 -9
- package/lib/export/src/util.min.js +1 -1
- package/lib/filter/index.js +3 -2
- package/lib/filter/index.min.js +1 -1
- package/lib/filter/src/hook.js +24 -13
- package/lib/filter/src/hook.min.js +1 -1
- package/lib/footer/index.js +3 -2
- package/lib/footer/index.min.js +1 -1
- package/lib/footer/src/footer.js +7 -3
- package/lib/footer/src/footer.min.js +1 -1
- package/lib/form/index.js +3 -2
- package/lib/form/index.min.js +1 -1
- package/lib/form/src/form-gather.js +3 -3
- package/lib/form/src/form-gather.min.js +1 -1
- package/lib/form/src/form-item.js +3 -3
- package/lib/form/src/form-item.min.js +1 -1
- package/lib/form/src/form.js +45 -58
- package/lib/form/src/form.min.js +1 -1
- package/lib/form/src/render.js +24 -10
- package/lib/form/src/render.min.js +1 -1
- package/lib/form/src/util.js +11 -0
- package/lib/form/src/util.min.js +1 -1
- package/lib/form-gather/index.js +3 -2
- package/lib/form-gather/index.min.js +1 -1
- package/lib/form-item/index.js +3 -2
- package/lib/form-item/index.min.js +1 -1
- package/lib/grid/index.js +3 -2
- package/lib/grid/index.min.js +1 -1
- package/lib/grid/src/grid.js +16 -14
- package/lib/grid/src/grid.min.js +1 -1
- package/lib/header/index.js +3 -2
- package/lib/header/index.min.js +1 -1
- package/lib/header/src/header.js +1 -1
- package/lib/header/src/header.min.js +1 -1
- package/lib/index.umd.js +584 -415
- package/lib/index.umd.min.js +1 -2
- package/lib/input/index.js +3 -2
- package/lib/input/index.min.js +1 -1
- package/lib/input/src/date.js +56 -0
- package/lib/input/src/date.min.js +1 -0
- package/lib/input/src/input.js +13 -67
- package/lib/input/src/input.min.js +1 -1
- package/lib/input/src/number.js +23 -0
- package/lib/input/src/number.min.js +1 -0
- package/lib/list/index.js +3 -2
- package/lib/list/index.min.js +1 -1
- package/lib/menu/index.js +3 -2
- package/lib/menu/index.min.js +1 -1
- package/lib/modal/index.js +3 -2
- package/lib/modal/index.min.js +1 -1
- package/lib/modal/src/modal.js +3 -1
- package/lib/modal/src/modal.min.js +1 -1
- package/lib/optgroup/index.js +3 -2
- package/lib/optgroup/index.min.js +1 -1
- package/lib/option/index.js +3 -2
- package/lib/option/index.min.js +1 -1
- package/lib/pager/index.js +3 -2
- package/lib/pager/index.min.js +1 -1
- package/lib/pager/src/pager.js +15 -1
- package/lib/pager/src/pager.min.js +1 -1
- package/lib/pulldown/index.js +3 -2
- package/lib/pulldown/index.min.js +1 -1
- package/lib/radio/index.js +3 -2
- package/lib/radio/index.min.js +1 -1
- package/lib/radio-button/index.js +3 -2
- package/lib/radio-button/index.min.js +1 -1
- package/lib/radio-group/index.js +3 -2
- package/lib/radio-group/index.min.js +1 -1
- package/lib/select/index.js +3 -2
- package/lib/select/index.min.js +1 -1
- package/lib/select/style/style.css +1 -1
- package/lib/select/style/style.min.css +1 -1
- package/lib/style.css +1 -1
- package/lib/style.min.css +1 -1
- package/lib/switch/index.js +3 -2
- package/lib/switch/index.min.js +1 -1
- package/lib/table/index.js +3 -2
- package/lib/table/index.min.js +1 -1
- package/lib/table/src/body.js +32 -11
- package/lib/table/src/body.min.js +1 -1
- package/lib/table/src/cell.js +3 -3
- package/lib/table/src/cell.min.js +1 -1
- package/lib/table/src/column.js +3 -1
- package/lib/table/src/column.min.js +1 -1
- package/lib/table/src/columnInfo.js +13 -9
- package/lib/table/src/columnInfo.min.js +1 -1
- package/lib/table/src/emits.js +1 -1
- package/lib/table/src/emits.min.js +1 -1
- package/lib/table/src/props.js +5 -2
- package/lib/table/src/table.js +187 -148
- package/lib/table/src/table.min.js +1 -1
- package/lib/table/src/util.js +5 -3
- package/lib/table/src/util.min.js +1 -1
- package/lib/textarea/index.js +3 -2
- package/lib/textarea/index.min.js +1 -1
- package/lib/toolbar/index.js +3 -2
- package/lib/toolbar/index.min.js +1 -1
- package/lib/toolbar/src/toolbar.js +4 -2
- package/lib/toolbar/src/toolbar.min.js +1 -1
- package/lib/tools/dom.js +12 -1
- package/lib/tools/dom.min.js +1 -1
- package/lib/tools/log.js +29 -0
- package/lib/tools/log.min.js +1 -0
- package/lib/tools/utils.js +0 -20
- package/lib/tools/utils.min.js +1 -1
- package/lib/tooltip/index.js +3 -3
- package/lib/tooltip/index.min.js +1 -1
- package/lib/tooltip/src/tooltip.js +114 -60
- package/lib/tooltip/src/tooltip.min.js +1 -1
- package/lib/tooltip/style/style.css +1 -1
- package/lib/tooltip/style/style.min.css +1 -1
- package/lib/v-x-e-table/index.js +1 -0
- package/lib/v-x-e-table/index.min.js +1 -1
- package/lib/v-x-e-table/src/conf.js +12 -7
- package/lib/v-x-e-table/src/conf.min.js +1 -1
- package/lib/v-x-e-table/src/interceptor.js +3 -3
- package/lib/v-x-e-table/src/interceptor.min.js +1 -1
- package/lib/v-x-e-table/src/renderer.js +3 -1
- package/lib/v-x-e-table/src/renderer.min.js +1 -1
- package/lib/v-x-e-table/src/store.js +2 -2
- package/lib/v-x-e-table/src/store.min.js +1 -1
- package/package.json +4 -4
- package/packages/button/index.ts +2 -1
- package/packages/checkbox/index.ts +2 -1
- package/packages/checkbox-group/index.ts +2 -1
- package/packages/colgroup/index.ts +4 -2
- package/packages/column/index.ts +4 -2
- package/packages/edit/src/hook.ts +2 -1
- package/packages/export/index.ts +3 -2
- package/packages/export/src/hook.ts +2 -1
- package/packages/export/src/util.ts +4 -6
- package/packages/filter/index.ts +2 -1
- package/packages/filter/src/hook.ts +17 -10
- package/packages/footer/index.ts +2 -1
- package/packages/footer/src/footer.ts +3 -2
- package/packages/form/index.ts +2 -1
- package/packages/form/src/form-gather.ts +3 -3
- package/packages/form/src/form-item.ts +4 -4
- package/packages/form/src/form.ts +38 -46
- package/packages/form/src/render.ts +8 -6
- package/packages/form/src/util.ts +8 -1
- package/packages/form-gather/index.ts +2 -1
- package/packages/form-item/index.ts +2 -1
- package/packages/grid/index.ts +2 -1
- package/packages/grid/src/grid.ts +2 -1
- package/packages/header/index.ts +2 -1
- package/packages/header/src/header.ts +1 -1
- package/packages/input/index.ts +2 -1
- package/packages/input/src/date.ts +42 -0
- package/packages/input/src/input.ts +3 -51
- package/packages/input/src/number.ts +12 -0
- package/packages/list/index.ts +2 -1
- package/packages/menu/index.ts +2 -1
- package/packages/modal/index.ts +2 -1
- package/packages/modal/src/modal.ts +2 -1
- package/packages/optgroup/index.ts +2 -1
- package/packages/option/index.ts +2 -1
- package/packages/pager/index.ts +2 -1
- package/packages/pager/src/pager.ts +17 -3
- package/packages/pulldown/index.ts +2 -1
- package/packages/radio/index.ts +2 -1
- package/packages/radio-button/index.ts +2 -1
- package/packages/radio-group/index.ts +2 -1
- package/packages/select/index.ts +2 -1
- package/packages/switch/index.ts +2 -1
- package/packages/table/index.ts +2 -1
- package/packages/table/src/body.ts +33 -12
- package/packages/table/src/cell.ts +3 -3
- package/packages/table/src/column.ts +3 -1
- package/packages/table/src/columnInfo.ts +5 -3
- package/packages/table/src/emits.ts +5 -1
- package/packages/table/src/props.ts +5 -2
- package/packages/table/src/table.ts +120 -84
- package/packages/table/src/util.ts +5 -3
- package/packages/textarea/index.ts +2 -1
- package/packages/toolbar/index.ts +2 -1
- package/packages/toolbar/src/toolbar.ts +2 -1
- package/packages/tools/dom.ts +11 -0
- package/packages/tools/log.ts +16 -0
- package/packages/tools/utils.ts +0 -15
- package/packages/tooltip/index.ts +2 -1
- package/packages/tooltip/src/tooltip.ts +87 -46
- package/packages/v-x-e-table/index.ts +1 -0
- package/packages/v-x-e-table/src/conf.ts +12 -7
- package/packages/v-x-e-table/src/interceptor.ts +1 -1
- package/packages/v-x-e-table/src/renderer.ts +2 -1
- package/packages/v-x-e-table/src/store.ts +1 -1
- package/styles/select.scss +1 -1
- package/styles/tooltip.scss +1 -1
- package/types/all.d.ts +2 -2
- package/types/button.d.ts +54 -54
- package/types/checkbox-group.d.ts +21 -21
- package/types/checkbox.d.ts +30 -30
- package/types/colgroup.d.ts +16 -16
- package/types/column.d.ts +172 -161
- package/types/component.d.ts +9 -9
- package/types/edit.d.ts +35 -35
- package/types/export.d.ts +101 -101
- package/types/filter.d.ts +19 -19
- package/types/footer.d.ts +1 -1
- package/types/form-gather.d.ts +3 -3
- package/types/form-item.d.ts +68 -66
- package/types/form.d.ts +136 -131
- package/types/grid.d.ts +257 -257
- package/types/header.d.ts +1 -1
- package/types/icon.d.ts +1 -1
- package/types/input.d.ts +162 -162
- package/types/keyboard.d.ts +6 -6
- package/types/list.d.ts +54 -54
- package/types/menu.d.ts +33 -33
- package/types/modal.d.ts +160 -160
- package/types/optgroup.d.ts +5 -5
- package/types/option.d.ts +19 -19
- package/types/pager.d.ts +65 -61
- package/types/plugins/pro.d.ts +245 -215
- package/types/pulldown.d.ts +36 -36
- package/types/radio-button.d.ts +25 -25
- package/types/radio-group.d.ts +20 -20
- package/types/radio.d.ts +27 -27
- package/types/select.d.ts +82 -82
- package/types/switch.d.ts +40 -40
- package/types/table.d.ts +1422 -1336
- package/types/textarea.d.ts +71 -71
- package/types/toolbar.d.ts +65 -65
- package/types/tooltip.d.ts +50 -44
- package/types/v-x-e-table/commands.d.ts +12 -12
- package/types/v-x-e-table/formats.d.ts +10 -10
- package/types/v-x-e-table/hooks.d.ts +9 -9
- package/types/v-x-e-table/index.d.ts +51 -43
- package/types/v-x-e-table/interceptor.d.ts +26 -26
- package/types/v-x-e-table/menus.d.ts +13 -13
- package/types/v-x-e-table/renderer.d.ts +128 -128
- package/types/v-x-e-table/setup.d.ts +55 -55
- package/types/validator.d.ts +28 -28
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
import { defineComponent, h, ref, Ref, resolveComponent, ComponentOptions,
|
|
1
|
+
import { defineComponent, h, ref, Ref, resolveComponent, ComponentOptions, createCommentVNode, provide, computed, reactive, watch, nextTick, PropType, VNode, onMounted } from 'vue'
|
|
2
2
|
import XEUtils from 'xe-utils'
|
|
3
3
|
import GlobalConfig from '../../v-x-e-table/src/conf'
|
|
4
4
|
import { VXETable } from '../../v-x-e-table'
|
|
5
|
-
import {
|
|
5
|
+
import { getFuncText, isEnableConf, eqEmptyValue } from '../../tools/utils'
|
|
6
|
+
import { errLog } from '../../tools/log'
|
|
6
7
|
import { scrollToView } from '../../tools/dom'
|
|
7
|
-
import { createItem } from './util'
|
|
8
|
+
import { createItem, handleFieldOrItem } from './util'
|
|
8
9
|
import { renderTitle } from './render'
|
|
9
10
|
import { useSize } from '../../hooks/size'
|
|
10
11
|
|
|
@@ -113,7 +114,6 @@ export default defineComponent({
|
|
|
113
114
|
|
|
114
115
|
const internalData = reactive<FormInternalData>({
|
|
115
116
|
tooltipTimeout: null,
|
|
116
|
-
tooltipActive: false,
|
|
117
117
|
tooltipStore: {
|
|
118
118
|
item: null,
|
|
119
119
|
visible: false
|
|
@@ -129,24 +129,8 @@ export default defineComponent({
|
|
|
129
129
|
return Object.assign({}, GlobalConfig.form.validConfig, props.validConfig)
|
|
130
130
|
})
|
|
131
131
|
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
const handleTooltipLeaveMethod = () => {
|
|
135
|
-
const tooltipOpts = computeTooltipOpts.value
|
|
136
|
-
setTimeout(() => {
|
|
137
|
-
if (!internalData.tooltipActive) {
|
|
138
|
-
formMethods.closeTooltip()
|
|
139
|
-
}
|
|
140
|
-
}, tooltipOpts.leaveDelay)
|
|
141
|
-
return false
|
|
142
|
-
}
|
|
143
|
-
|
|
144
|
-
computeTooltipOpts = computed(() => {
|
|
145
|
-
const opts: VxeFormPropTypes.TooltipOpts = Object.assign({ leaveDelay: 300 }, GlobalConfig.form.tooltipConfig, props.tooltipConfig)
|
|
146
|
-
if (opts.enterable) {
|
|
147
|
-
opts.leaveMethod = handleTooltipLeaveMethod
|
|
148
|
-
}
|
|
149
|
-
return opts
|
|
132
|
+
const computeTooltipOpts = computed(() => {
|
|
133
|
+
return Object.assign({}, GlobalConfig.tooltip, GlobalConfig.form.tooltipConfig, props.tooltipConfig)
|
|
150
134
|
})
|
|
151
135
|
|
|
152
136
|
const refMaps: FormPrivateRef = {
|
|
@@ -208,6 +192,11 @@ export default defineComponent({
|
|
|
208
192
|
return itemList
|
|
209
193
|
}
|
|
210
194
|
|
|
195
|
+
const getItemByField = (field: string) => {
|
|
196
|
+
const rest = XEUtils.findTree(reactData.formItems, item => item.field === field, { children: 'children' })
|
|
197
|
+
return rest ? rest.item : null
|
|
198
|
+
}
|
|
199
|
+
|
|
211
200
|
const getCollapseStatus = () => {
|
|
212
201
|
return reactData.collapseAll
|
|
213
202
|
}
|
|
@@ -226,15 +215,14 @@ export default defineComponent({
|
|
|
226
215
|
formMethods.dispatchEvent('collapse', { status, collapse: status, data: props.data }, evnt)
|
|
227
216
|
}
|
|
228
217
|
|
|
229
|
-
const clearValidate = (
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
const item = itemList.find((item) => item.field === field)
|
|
218
|
+
const clearValidate = (fieldOrItem?: VxeFormItemPropTypes.Field | VxeFormDefines.ItemInfo) => {
|
|
219
|
+
if (fieldOrItem) {
|
|
220
|
+
const item = handleFieldOrItem($xeform, fieldOrItem)
|
|
233
221
|
if (item) {
|
|
234
222
|
item.showError = false
|
|
235
223
|
}
|
|
236
224
|
} else {
|
|
237
|
-
|
|
225
|
+
getItems().forEach((item) => {
|
|
238
226
|
item.showError = false
|
|
239
227
|
})
|
|
240
228
|
}
|
|
@@ -267,10 +255,9 @@ export default defineComponent({
|
|
|
267
255
|
}
|
|
268
256
|
|
|
269
257
|
const handleFocus = (fields: string[]) => {
|
|
270
|
-
const itemList = getItems()
|
|
271
258
|
const el = refElem.value
|
|
272
259
|
fields.some((property, index) => {
|
|
273
|
-
const item =
|
|
260
|
+
const item = getItemByField(property)
|
|
274
261
|
if (item && isEnableConf(item.itemRender)) {
|
|
275
262
|
const { itemRender } = item
|
|
276
263
|
const compConf = VXETable.renderer.get(itemRender.name)
|
|
@@ -428,8 +415,9 @@ export default defineComponent({
|
|
|
428
415
|
return beginValidate(getItems(), '', callback)
|
|
429
416
|
}
|
|
430
417
|
|
|
431
|
-
const validateField = (
|
|
432
|
-
|
|
418
|
+
const validateField = (fieldOrItem: VxeFormItemPropTypes.Field | VxeFormDefines.ItemInfo, callback: any) => {
|
|
419
|
+
const item = handleFieldOrItem($xeform, fieldOrItem)
|
|
420
|
+
return beginValidate(item ? [item] : [], '', callback)
|
|
433
421
|
}
|
|
434
422
|
|
|
435
423
|
const submitEvent = (evnt: Event) => {
|
|
@@ -459,7 +447,7 @@ export default defineComponent({
|
|
|
459
447
|
return nextTick()
|
|
460
448
|
}
|
|
461
449
|
|
|
462
|
-
const
|
|
450
|
+
const triggerTitleTipEvent = (evnt: MouseEvent, params: {
|
|
463
451
|
item: VxeFormDefines.ItemInfo;
|
|
464
452
|
}) => {
|
|
465
453
|
const { item } = params
|
|
@@ -469,8 +457,9 @@ export default defineComponent({
|
|
|
469
457
|
const content = (overflowElem.textContent || '').trim()
|
|
470
458
|
const isCellOverflow = overflowElem.scrollWidth > overflowElem.clientWidth
|
|
471
459
|
clearTimeout(internalData.tooltipTimeout)
|
|
472
|
-
|
|
473
|
-
|
|
460
|
+
if (tooltipStore.item !== item) {
|
|
461
|
+
closeTooltip()
|
|
462
|
+
}
|
|
474
463
|
if (content && isCellOverflow) {
|
|
475
464
|
Object.assign(tooltipStore, {
|
|
476
465
|
item,
|
|
@@ -482,13 +471,16 @@ export default defineComponent({
|
|
|
482
471
|
}
|
|
483
472
|
}
|
|
484
473
|
|
|
485
|
-
const
|
|
474
|
+
const handleTitleTipLeaveEvent = () => {
|
|
486
475
|
const tooltipOpts = computeTooltipOpts.value
|
|
487
|
-
|
|
476
|
+
let $tooltip = refTooltip.value
|
|
477
|
+
if ($tooltip) {
|
|
478
|
+
$tooltip.setActived(false)
|
|
479
|
+
}
|
|
488
480
|
if (tooltipOpts.enterable) {
|
|
489
481
|
internalData.tooltipTimeout = setTimeout(() => {
|
|
490
|
-
|
|
491
|
-
if ($tooltip && !$tooltip.
|
|
482
|
+
$tooltip = refTooltip.value
|
|
483
|
+
if ($tooltip && !$tooltip.isActived()) {
|
|
492
484
|
closeTooltip()
|
|
493
485
|
}
|
|
494
486
|
}, tooltipOpts.leaveDelay)
|
|
@@ -510,8 +502,7 @@ export default defineComponent({
|
|
|
510
502
|
clearValidate(property)
|
|
511
503
|
})
|
|
512
504
|
.catch(({ rule }) => {
|
|
513
|
-
const
|
|
514
|
-
const item = itemList.find((item) => item.field === property)
|
|
505
|
+
const item = getItemByField(property)
|
|
515
506
|
if (item) {
|
|
516
507
|
item.showError = true
|
|
517
508
|
item.errRule = rule
|
|
@@ -524,7 +515,7 @@ export default defineComponent({
|
|
|
524
515
|
const { data, rules, titleOverflow: allTitleOverflow } = props
|
|
525
516
|
const { collapseAll } = reactData
|
|
526
517
|
const validOpts = computeValidOpts.value
|
|
527
|
-
return itemList.map((item
|
|
518
|
+
return itemList.map((item) => {
|
|
528
519
|
const { slots, title, visible, folding, visibleMethod, field, collapseNode, itemRender, showError, errRule, className, titleOverflow, children } = item
|
|
529
520
|
const compConf = isEnableConf(itemRender) ? VXETable.renderer.get(itemRender.name) : null
|
|
530
521
|
const defaultSlot = slots ? slots.default : null
|
|
@@ -596,9 +587,9 @@ export default defineComponent({
|
|
|
596
587
|
}
|
|
597
588
|
const ons = showTooltip ? {
|
|
598
589
|
onMouseenter (evnt: MouseEvent) {
|
|
599
|
-
|
|
590
|
+
triggerTitleTipEvent(evnt, params)
|
|
600
591
|
},
|
|
601
|
-
onMouseleave:
|
|
592
|
+
onMouseleave: handleTitleTipLeaveEvent
|
|
602
593
|
} : {}
|
|
603
594
|
return h('div', {
|
|
604
595
|
class: ['vxe-form--item', item.id, span ? `vxe-col--${span} is--span` : '', className ? (XEUtils.isFunction(className) ? className(params) : className) : '', {
|
|
@@ -608,7 +599,7 @@ export default defineComponent({
|
|
|
608
599
|
'is--active': !itemVisibleMethod || itemVisibleMethod(params),
|
|
609
600
|
'is--error': showError
|
|
610
601
|
}],
|
|
611
|
-
key:
|
|
602
|
+
key: item.id
|
|
612
603
|
}, [
|
|
613
604
|
h('div', {
|
|
614
605
|
class: 'vxe-form--item-inner'
|
|
@@ -642,14 +633,15 @@ export default defineComponent({
|
|
|
642
633
|
updateStatus,
|
|
643
634
|
toggleCollapse,
|
|
644
635
|
getItems,
|
|
636
|
+
getItemByField,
|
|
645
637
|
closeTooltip
|
|
646
638
|
}
|
|
647
639
|
|
|
648
640
|
const formPrivateMethods: VxeFormPrivateMethods = {
|
|
649
641
|
callSlot,
|
|
650
642
|
toggleCollapseEvent,
|
|
651
|
-
|
|
652
|
-
|
|
643
|
+
triggerTitleTipEvent,
|
|
644
|
+
handleTitleTipLeaveEvent
|
|
653
645
|
}
|
|
654
646
|
|
|
655
647
|
Object.assign($xeform, formMethods, formPrivateMethods)
|
|
@@ -27,7 +27,9 @@ function renderSuffixIcon (titleSuffix: VxeFormItemPropTypes.TitleSuffix) {
|
|
|
27
27
|
|
|
28
28
|
export function renderTitle ($xeform: VxeFormConstructor & VxeFormPrivateMethods, item: VxeFormDefines.ItemInfo) {
|
|
29
29
|
const { data } = $xeform.props
|
|
30
|
+
const { computeTooltipOpts } = $xeform.getComputeMaps()
|
|
30
31
|
const { slots, field, itemRender, titlePrefix, titleSuffix } = item
|
|
32
|
+
const tooltipOpts = computeTooltipOpts.value
|
|
31
33
|
const compConf = isEnableConf(itemRender) ? VXETable.renderer.get(itemRender.name) : null
|
|
32
34
|
const params = { data, property: field, item, $form: $xeform }
|
|
33
35
|
const titleSlot = slots ? slots.title : null
|
|
@@ -37,9 +39,9 @@ export function renderTitle ($xeform: VxeFormConstructor & VxeFormPrivateMethods
|
|
|
37
39
|
titVNs.push(
|
|
38
40
|
(titlePrefix.content || titlePrefix.message)
|
|
39
41
|
? h(resolveComponent('vxe-tooltip') as ComponentOptions, {
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
42
|
+
...tooltipOpts,
|
|
43
|
+
...titlePrefix,
|
|
44
|
+
content: getFuncText(titlePrefix.content || titlePrefix.message)
|
|
43
45
|
}, {
|
|
44
46
|
default: () => renderPrefixIcon(titlePrefix)
|
|
45
47
|
})
|
|
@@ -61,9 +63,9 @@ export function renderTitle ($xeform: VxeFormConstructor & VxeFormPrivateMethods
|
|
|
61
63
|
fixVNs.push(
|
|
62
64
|
(titleSuffix.content || titleSuffix.message)
|
|
63
65
|
? h(resolveComponent('vxe-tooltip') as ComponentOptions, {
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
66
|
+
...tooltipOpts,
|
|
67
|
+
...titleSuffix,
|
|
68
|
+
content: getFuncText(titleSuffix.content || titleSuffix.message)
|
|
67
69
|
}, {
|
|
68
70
|
default: () => renderSuffixIcon(titleSuffix)
|
|
69
71
|
})
|
|
@@ -2,7 +2,7 @@ import { watch } from 'vue'
|
|
|
2
2
|
import XEUtils from 'xe-utils'
|
|
3
3
|
import { ItemInfo } from './itemInfo'
|
|
4
4
|
|
|
5
|
-
import { VxeFormConstructor } from '../../../types/all'
|
|
5
|
+
import { VxeFormConstructor, VxeFormDefines } from '../../../types/all'
|
|
6
6
|
|
|
7
7
|
export interface XEFormItemProvide {
|
|
8
8
|
formItem: ItemInfo;
|
|
@@ -16,6 +16,13 @@ export function createItem ($xeform: VxeFormConstructor, _vm: any) {
|
|
|
16
16
|
return isFormItem(_vm) ? _vm : new ItemInfo($xeform, _vm)
|
|
17
17
|
}
|
|
18
18
|
|
|
19
|
+
export const handleFieldOrItem = ($xeform: VxeFormConstructor, fieldOrItem: string | VxeFormDefines.ItemInfo) => {
|
|
20
|
+
if (fieldOrItem) {
|
|
21
|
+
return XEUtils.isString(fieldOrItem) ? $xeform.getItemByField(fieldOrItem) : fieldOrItem
|
|
22
|
+
}
|
|
23
|
+
return null
|
|
24
|
+
}
|
|
25
|
+
|
|
19
26
|
export function watchItem (props: any, formItem: ItemInfo) {
|
|
20
27
|
Object.keys(props).forEach(name => {
|
|
21
28
|
watch(() => props[name], (value: any) => {
|
|
@@ -4,9 +4,10 @@ import { dynamicApp } from '../dynamics'
|
|
|
4
4
|
|
|
5
5
|
export const FormGather = Object.assign(VxeFormGatherComponent, {
|
|
6
6
|
install (app: App) {
|
|
7
|
-
dynamicApp.component(VxeFormGatherComponent.name, VxeFormGatherComponent)
|
|
8
7
|
app.component(VxeFormGatherComponent.name, VxeFormGatherComponent)
|
|
9
8
|
}
|
|
10
9
|
})
|
|
11
10
|
|
|
11
|
+
dynamicApp.component(VxeFormGatherComponent.name, VxeFormGatherComponent)
|
|
12
|
+
|
|
12
13
|
export default FormGather
|
|
@@ -4,9 +4,10 @@ import { dynamicApp } from '../dynamics'
|
|
|
4
4
|
|
|
5
5
|
export const FormItem = Object.assign(VxeFormItemComponent, {
|
|
6
6
|
install (app: App) {
|
|
7
|
-
dynamicApp.component(VxeFormItemComponent.name, VxeFormItemComponent)
|
|
8
7
|
app.component(VxeFormItemComponent.name, VxeFormItemComponent)
|
|
9
8
|
}
|
|
10
9
|
})
|
|
11
10
|
|
|
11
|
+
dynamicApp.component(VxeFormItemComponent.name, VxeFormItemComponent)
|
|
12
|
+
|
|
12
13
|
export default FormItem
|
package/packages/grid/index.ts
CHANGED
|
@@ -4,9 +4,10 @@ import { dynamicApp } from '../dynamics'
|
|
|
4
4
|
|
|
5
5
|
export const Grid = Object.assign(VxeGridComponent, {
|
|
6
6
|
install (app: App) {
|
|
7
|
-
dynamicApp.component(VxeGridComponent.name, VxeGridComponent)
|
|
8
7
|
app.component(VxeGridComponent.name, VxeGridComponent)
|
|
9
8
|
}
|
|
10
9
|
})
|
|
11
10
|
|
|
11
|
+
dynamicApp.component(VxeGridComponent.name, VxeGridComponent)
|
|
12
|
+
|
|
12
13
|
export default Grid
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { defineComponent, h, PropType, ref, Ref, computed, provide, getCurrentInstance, resolveComponent, ComponentOptions, reactive, onUnmounted, watch, nextTick, VNode, ComponentPublicInstance, onMounted } from 'vue'
|
|
2
2
|
import XEUtils from 'xe-utils'
|
|
3
|
-
import {
|
|
3
|
+
import { getLastZIndex, nextZIndex, isEnableConf } from '../../tools/utils'
|
|
4
4
|
import { getOffsetHeight, getPaddingTopBottomSize, getDomNode } from '../../tools/dom'
|
|
5
|
+
import { errLog } from '../../tools/log'
|
|
5
6
|
import GlobalConfig from '../../v-x-e-table/src/conf'
|
|
6
7
|
import { VXETable } from '../../v-x-e-table'
|
|
7
8
|
import tableComponentProps from '../../table/src/props'
|
package/packages/header/index.ts
CHANGED
|
@@ -4,9 +4,10 @@ import { dynamicApp } from '../dynamics'
|
|
|
4
4
|
|
|
5
5
|
export const Header = Object.assign(VxeTableHeader, {
|
|
6
6
|
install (app: App) {
|
|
7
|
-
dynamicApp.component(VxeTableHeader.name, VxeTableHeader)
|
|
8
7
|
app.component(VxeTableHeader.name, VxeTableHeader)
|
|
9
8
|
}
|
|
10
9
|
})
|
|
11
10
|
|
|
11
|
+
dynamicApp.component(VxeTableHeader.name, VxeTableHeader)
|
|
12
|
+
|
|
12
13
|
export default Header
|
|
@@ -263,7 +263,7 @@ export default defineComponent({
|
|
|
263
263
|
rowspan: column.rowSpan > 1 ? column.rowSpan : null,
|
|
264
264
|
style: headerCellStyle ? (XEUtils.isFunction(headerCellStyle) ? headerCellStyle(params) : headerCellStyle) : null,
|
|
265
265
|
...thOns,
|
|
266
|
-
key: columnKey || isColGroup ? column.id : $columnIndex
|
|
266
|
+
key: columnKey || columnOpts.useKey || isColGroup ? column.id : $columnIndex
|
|
267
267
|
}, [
|
|
268
268
|
h('div', {
|
|
269
269
|
class: ['vxe-cell', {
|
package/packages/input/index.ts
CHANGED
|
@@ -4,9 +4,10 @@ import { dynamicApp } from '../dynamics'
|
|
|
4
4
|
|
|
5
5
|
export const Input = Object.assign(VxeInputConstructor, {
|
|
6
6
|
install (app: App) {
|
|
7
|
-
dynamicApp.component(VxeInputConstructor.name, VxeInputConstructor)
|
|
8
7
|
app.component(VxeInputConstructor.name, VxeInputConstructor)
|
|
9
8
|
}
|
|
10
9
|
})
|
|
11
10
|
|
|
11
|
+
dynamicApp.component(VxeInputConstructor.name, VxeInputConstructor)
|
|
12
|
+
|
|
12
13
|
export default Input
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import XEUtils from 'xe-utils'
|
|
2
|
+
|
|
3
|
+
import { VxeInputPropTypes } from '../../../types/all'
|
|
4
|
+
|
|
5
|
+
export function toStringTimeDate (str: VxeInputPropTypes.ModelValue) {
|
|
6
|
+
if (str) {
|
|
7
|
+
const rest = new Date()
|
|
8
|
+
let h = 0
|
|
9
|
+
let m = 0
|
|
10
|
+
let s = 0
|
|
11
|
+
if (XEUtils.isDate(str)) {
|
|
12
|
+
h = str.getHours()
|
|
13
|
+
m = str.getMinutes()
|
|
14
|
+
s = str.getSeconds()
|
|
15
|
+
} else {
|
|
16
|
+
str = XEUtils.toValueString(str)
|
|
17
|
+
const parses = str.match(/^(\d{1,2})(:(\d{1,2}))?(:(\d{1,2}))?/)
|
|
18
|
+
if (parses) {
|
|
19
|
+
h = XEUtils.toNumber(parses[1])
|
|
20
|
+
m = XEUtils.toNumber(parses[3])
|
|
21
|
+
s = XEUtils.toNumber(parses[5])
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
rest.setHours(h)
|
|
25
|
+
rest.setMinutes(m)
|
|
26
|
+
rest.setSeconds(s)
|
|
27
|
+
return rest
|
|
28
|
+
}
|
|
29
|
+
return new Date('')
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
export function getDateQuarter (date: Date) {
|
|
33
|
+
const month = date.getMonth()
|
|
34
|
+
if (month < 3) {
|
|
35
|
+
return 1
|
|
36
|
+
} else if (month < 6) {
|
|
37
|
+
return 2
|
|
38
|
+
} else if (month < 9) {
|
|
39
|
+
return 3
|
|
40
|
+
}
|
|
41
|
+
return 4
|
|
42
|
+
}
|
|
@@ -5,6 +5,8 @@ import { useSize } from '../../hooks/size'
|
|
|
5
5
|
import { getFuncText, getLastZIndex, nextZIndex } from '../../tools/utils'
|
|
6
6
|
import { hasClass, getAbsolutePos, getEventTargetNode } from '../../tools/dom'
|
|
7
7
|
import { GlobalEvent, hasEventKey, EVENT_KEYS } from '../../tools/event'
|
|
8
|
+
import { toStringTimeDate, getDateQuarter } from './date'
|
|
9
|
+
import { handleNumber, toFloatValueFixed } from './number'
|
|
8
10
|
|
|
9
11
|
import { VNodeStyle, VxeInputConstructor, VxeInputEmits, InputReactData, InputMethods, VxeInputPropTypes, InputPrivateRef } from '../../../types/all'
|
|
10
12
|
|
|
@@ -52,33 +54,6 @@ const yearSize = 20
|
|
|
52
54
|
const monthSize = 20
|
|
53
55
|
const quarterSize = 8
|
|
54
56
|
|
|
55
|
-
function toStringTimeDate (str: VxeInputPropTypes.ModelValue) {
|
|
56
|
-
if (str) {
|
|
57
|
-
const rest = new Date()
|
|
58
|
-
let h = 0
|
|
59
|
-
let m = 0
|
|
60
|
-
let s = 0
|
|
61
|
-
if (XEUtils.isDate(str)) {
|
|
62
|
-
h = str.getHours()
|
|
63
|
-
m = str.getMinutes()
|
|
64
|
-
s = str.getSeconds()
|
|
65
|
-
} else {
|
|
66
|
-
str = XEUtils.toValueString(str)
|
|
67
|
-
const parses = str.match(/^(\d{1,2})(:(\d{1,2}))?(:(\d{1,2}))?/)
|
|
68
|
-
if (parses) {
|
|
69
|
-
h = XEUtils.toNumber(parses[1])
|
|
70
|
-
m = XEUtils.toNumber(parses[3])
|
|
71
|
-
s = XEUtils.toNumber(parses[5])
|
|
72
|
-
}
|
|
73
|
-
}
|
|
74
|
-
rest.setHours(h)
|
|
75
|
-
rest.setMinutes(m)
|
|
76
|
-
rest.setSeconds(s)
|
|
77
|
-
return rest
|
|
78
|
-
}
|
|
79
|
-
return new Date('')
|
|
80
|
-
}
|
|
81
|
-
|
|
82
57
|
export default defineComponent({
|
|
83
58
|
name: 'VxeInput',
|
|
84
59
|
props: {
|
|
@@ -410,18 +385,6 @@ export default defineComponent({
|
|
|
410
385
|
return XEUtils.chunk(yearList, 4)
|
|
411
386
|
})
|
|
412
387
|
|
|
413
|
-
const getDateQuarter = (date: Date) => {
|
|
414
|
-
const month = date.getMonth()
|
|
415
|
-
if (month < 3) {
|
|
416
|
-
return 1
|
|
417
|
-
} else if (month < 6) {
|
|
418
|
-
return 2
|
|
419
|
-
} else if (month < 9) {
|
|
420
|
-
return 3
|
|
421
|
-
}
|
|
422
|
-
return 4
|
|
423
|
-
}
|
|
424
|
-
|
|
425
388
|
const computeQuarterList = computed(() => {
|
|
426
389
|
const { selectMonth, currentDate } = reactData
|
|
427
390
|
const quarters: DateQuarterItem[] = []
|
|
@@ -609,18 +572,7 @@ export default defineComponent({
|
|
|
609
572
|
return immediate || !(type === 'text' || type === 'number' || type === 'integer' || type === 'float')
|
|
610
573
|
})
|
|
611
574
|
|
|
612
|
-
const
|
|
613
|
-
return XEUtils.isString(val) ? val.replace(/,/g, '') : val
|
|
614
|
-
}
|
|
615
|
-
|
|
616
|
-
function toFloatValueFixed (inputValue: string | number, digitsValue: number) {
|
|
617
|
-
if (/^-/.test('' + inputValue)) {
|
|
618
|
-
return XEUtils.toFixed(XEUtils.ceil(inputValue, digitsValue), digitsValue)
|
|
619
|
-
}
|
|
620
|
-
return XEUtils.toFixed(XEUtils.floor(inputValue, digitsValue), digitsValue)
|
|
621
|
-
}
|
|
622
|
-
|
|
623
|
-
function getNumberValue (val: any) {
|
|
575
|
+
const getNumberValue = (val: any) => {
|
|
624
576
|
const { type, exponential } = props
|
|
625
577
|
const inpMaxlength = computeInpMaxlength.value
|
|
626
578
|
const digitsValue = computeDigitsValue.value
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import XEUtils from 'xe-utils'
|
|
2
|
+
|
|
3
|
+
export function handleNumber (val: string | number) {
|
|
4
|
+
return XEUtils.isString(val) ? val.replace(/,/g, '') : val
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
export function toFloatValueFixed (inputValue: string | number, digitsValue: number) {
|
|
8
|
+
if (/^-/.test('' + inputValue)) {
|
|
9
|
+
return XEUtils.toFixed(XEUtils.ceil(inputValue, digitsValue), digitsValue)
|
|
10
|
+
}
|
|
11
|
+
return XEUtils.toFixed(XEUtils.floor(inputValue, digitsValue), digitsValue)
|
|
12
|
+
}
|
package/packages/list/index.ts
CHANGED
|
@@ -4,9 +4,10 @@ import { dynamicApp } from '../dynamics'
|
|
|
4
4
|
|
|
5
5
|
export const List = Object.assign(VxeListComponent, {
|
|
6
6
|
install (app: App) {
|
|
7
|
-
dynamicApp.component(VxeListComponent.name, VxeListComponent)
|
|
8
7
|
app.component(VxeListComponent.name, VxeListComponent)
|
|
9
8
|
}
|
|
10
9
|
})
|
|
11
10
|
|
|
11
|
+
dynamicApp.component(VxeListComponent.name, VxeListComponent)
|
|
12
|
+
|
|
12
13
|
export default List
|
package/packages/menu/index.ts
CHANGED
|
@@ -8,9 +8,10 @@ export const Menu = {
|
|
|
8
8
|
Panel: PanelComponent,
|
|
9
9
|
install (app: App) {
|
|
10
10
|
VXETable.hooks.add('$tableMenu', menuHook)
|
|
11
|
-
dynamicApp.component(PanelComponent.name, PanelComponent)
|
|
12
11
|
app.component(PanelComponent.name, PanelComponent)
|
|
13
12
|
}
|
|
14
13
|
}
|
|
15
14
|
|
|
15
|
+
dynamicApp.component(PanelComponent.name, PanelComponent)
|
|
16
|
+
|
|
16
17
|
export default Menu
|
package/packages/modal/index.ts
CHANGED
|
@@ -98,10 +98,11 @@ export const modal = ModalController
|
|
|
98
98
|
|
|
99
99
|
export const Modal = Object.assign(VxeModalComponent, {
|
|
100
100
|
install: function (app: App) {
|
|
101
|
-
dynamicApp.component(VxeModalComponent.name, VxeModalComponent)
|
|
102
101
|
app.component(VxeModalComponent.name, VxeModalComponent)
|
|
103
102
|
VXETable.modal = ModalController
|
|
104
103
|
}
|
|
105
104
|
})
|
|
106
105
|
|
|
106
|
+
dynamicApp.component(VxeModalComponent.name, VxeModalComponent)
|
|
107
|
+
|
|
107
108
|
export default Modal
|
|
@@ -2,7 +2,8 @@ import { defineComponent, h, Teleport, ref, Ref, computed, reactive, nextTick, w
|
|
|
2
2
|
import XEUtils from 'xe-utils'
|
|
3
3
|
import { useSize } from '../../hooks/size'
|
|
4
4
|
import { getDomNode, getEventTargetNode } from '../../tools/dom'
|
|
5
|
-
import {
|
|
5
|
+
import { getLastZIndex, nextZIndex, getFuncText } from '../../tools/utils'
|
|
6
|
+
import { errLog } from '../../tools/log'
|
|
6
7
|
import { GlobalEvent, hasEventKey, EVENT_KEYS } from '../../tools/event'
|
|
7
8
|
import GlobalConfig from '../../v-x-e-table/src/conf'
|
|
8
9
|
import VxeButtonConstructor from '../../button/src/button'
|
|
@@ -4,9 +4,10 @@ import { dynamicApp } from '../dynamics'
|
|
|
4
4
|
|
|
5
5
|
export const Optgroup = Object.assign(VxeOptgroupComponent, {
|
|
6
6
|
install: function (app: App) {
|
|
7
|
-
dynamicApp.component(VxeOptgroupComponent.name, VxeOptgroupComponent)
|
|
8
7
|
app.component(VxeOptgroupComponent.name, VxeOptgroupComponent)
|
|
9
8
|
}
|
|
10
9
|
})
|
|
11
10
|
|
|
11
|
+
dynamicApp.component(VxeOptgroupComponent.name, VxeOptgroupComponent)
|
|
12
|
+
|
|
12
13
|
export default Optgroup
|
package/packages/option/index.ts
CHANGED
|
@@ -4,9 +4,10 @@ import { dynamicApp } from '../dynamics'
|
|
|
4
4
|
|
|
5
5
|
export const Option = Object.assign(VxeOptionComponent, {
|
|
6
6
|
install: function (app: App) {
|
|
7
|
-
dynamicApp.component(VxeOptionComponent.name, VxeOptionComponent)
|
|
8
7
|
app.component(VxeOptionComponent.name, VxeOptionComponent)
|
|
9
8
|
}
|
|
10
9
|
})
|
|
11
10
|
|
|
11
|
+
dynamicApp.component(VxeOptionComponent.name, VxeOptionComponent)
|
|
12
|
+
|
|
12
13
|
export default Option
|
package/packages/pager/index.ts
CHANGED
|
@@ -4,9 +4,10 @@ import { dynamicApp } from '../dynamics'
|
|
|
4
4
|
|
|
5
5
|
export const Pager = Object.assign(VxePagerComponent, {
|
|
6
6
|
install: function (app: App) {
|
|
7
|
-
dynamicApp.component(VxePagerComponent.name, VxePagerComponent)
|
|
8
7
|
app.component(VxePagerComponent.name, VxePagerComponent)
|
|
9
8
|
}
|
|
10
9
|
})
|
|
11
10
|
|
|
11
|
+
dynamicApp.component(VxePagerComponent.name, VxePagerComponent)
|
|
12
|
+
|
|
12
13
|
export default Pager
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { defineComponent, h, PropType, computed, inject, resolveComponent, ComponentOptions, ref, Ref, nextTick } from 'vue'
|
|
1
|
+
import { defineComponent, h, PropType, computed, inject, resolveComponent, ComponentOptions, ref, Ref, reactive, nextTick, watch } from 'vue'
|
|
2
2
|
import XEUtils from 'xe-utils'
|
|
3
3
|
import GlobalConfig from '../../v-x-e-table/src/conf'
|
|
4
4
|
import { hasEventKey, EVENT_KEYS } from '../../tools/event'
|
|
5
5
|
import { useSize } from '../../hooks/size'
|
|
6
6
|
|
|
7
|
-
import { VxePagerPropTypes, VxePagerConstructor, VxePagerEmits, VxeSelectEvents, PagerPrivateRef, VxeGridConstructor, PagerMethods, PagerPrivateMethods, VxePagerPrivateMethods } from '../../../types/all'
|
|
7
|
+
import { VxePagerPropTypes, VxePagerConstructor, VxePagerEmits, VxeSelectEvents, PagerPrivateRef, VxeGridConstructor, PagerMethods, PagerPrivateMethods, VxePagerPrivateMethods, PagerReactData } from '../../../types/all'
|
|
8
8
|
|
|
9
9
|
export default defineComponent({
|
|
10
10
|
name: 'VxePager',
|
|
@@ -57,6 +57,10 @@ export default defineComponent({
|
|
|
57
57
|
|
|
58
58
|
const $xegrid = inject('$xegrid', null as VxeGridConstructor | null)
|
|
59
59
|
|
|
60
|
+
const reactData = reactive<PagerReactData>({
|
|
61
|
+
inpCurrPage: props.currentPage
|
|
62
|
+
})
|
|
63
|
+
|
|
60
64
|
const refElem = ref() as Ref<HTMLDivElement>
|
|
61
65
|
|
|
62
66
|
const refMaps: PagerPrivateRef = {
|
|
@@ -165,6 +169,11 @@ export default defineComponent({
|
|
|
165
169
|
pagerMethods.dispatchEvent('page-change', { type: 'size', pageSize, currentPage: Math.min(props.currentPage, getPageCount(props.total, pageSize)) })
|
|
166
170
|
}
|
|
167
171
|
|
|
172
|
+
const jumpInputEvent = (evnt: KeyboardEvent) => {
|
|
173
|
+
const inputElem: HTMLInputElement = evnt.target as HTMLInputElement
|
|
174
|
+
reactData.inpCurrPage = inputElem.value
|
|
175
|
+
}
|
|
176
|
+
|
|
168
177
|
const jumpKeydownEvent = (evnt: KeyboardEvent) => {
|
|
169
178
|
if (hasEventKey(evnt, EVENT_KEYS.ENTER)) {
|
|
170
179
|
triggerJumpEvent(evnt)
|
|
@@ -337,9 +346,10 @@ export default defineComponent({
|
|
|
337
346
|
}, GlobalConfig.i18n('vxe.pager.goto')) : null,
|
|
338
347
|
h('input', {
|
|
339
348
|
class: 'vxe-pager--goto',
|
|
340
|
-
value:
|
|
349
|
+
value: reactData.inpCurrPage,
|
|
341
350
|
type: 'text',
|
|
342
351
|
autocomplete: 'off',
|
|
352
|
+
onInput: jumpInputEvent,
|
|
343
353
|
onKeydown: jumpKeydownEvent,
|
|
344
354
|
onBlur: triggerJumpEvent
|
|
345
355
|
}),
|
|
@@ -405,6 +415,10 @@ export default defineComponent({
|
|
|
405
415
|
|
|
406
416
|
Object.assign($xepager, pagerMethods, pagerPrivateMethods)
|
|
407
417
|
|
|
418
|
+
watch(() => props.currentPage, (value) => {
|
|
419
|
+
reactData.inpCurrPage = value
|
|
420
|
+
})
|
|
421
|
+
|
|
408
422
|
const renderVN = () => {
|
|
409
423
|
const { align, layouts, className } = props
|
|
410
424
|
const childNodes = []
|
|
@@ -4,9 +4,10 @@ import { dynamicApp } from '../dynamics'
|
|
|
4
4
|
|
|
5
5
|
export const Pulldown = Object.assign(VxePulldownComponent, {
|
|
6
6
|
install: function (app: App) {
|
|
7
|
-
dynamicApp.component(VxePulldownComponent.name, VxePulldownComponent)
|
|
8
7
|
app.component(VxePulldownComponent.name, VxePulldownComponent)
|
|
9
8
|
}
|
|
10
9
|
})
|
|
11
10
|
|
|
11
|
+
dynamicApp.component(VxePulldownComponent.name, VxePulldownComponent)
|
|
12
|
+
|
|
12
13
|
export default Pulldown
|
package/packages/radio/index.ts
CHANGED
|
@@ -4,9 +4,10 @@ import { dynamicApp } from '../dynamics'
|
|
|
4
4
|
|
|
5
5
|
export const Radio = Object.assign(VxeRadioComponent, {
|
|
6
6
|
install: function (app: App) {
|
|
7
|
-
dynamicApp.component(VxeRadioComponent.name, VxeRadioComponent)
|
|
8
7
|
app.component(VxeRadioComponent.name, VxeRadioComponent)
|
|
9
8
|
}
|
|
10
9
|
})
|
|
11
10
|
|
|
11
|
+
dynamicApp.component(VxeRadioComponent.name, VxeRadioComponent)
|
|
12
|
+
|
|
12
13
|
export default Radio
|