vxe-table 4.14.0-beta.0 → 4.14.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 -1
- package/README.ja-JP.md +2 -1
- package/README.md +4 -2
- package/README.zh-TW.md +2 -1
- package/es/grid/src/grid.js +127 -94
- package/es/index.css +1 -1
- package/es/index.min.css +1 -1
- package/es/style.css +1 -1
- package/es/style.min.css +1 -1
- package/es/table/module/custom/hook.js +0 -4
- package/es/table/module/custom/panel.js +0 -1
- package/es/table/module/keyboard/hook.js +2 -2
- package/es/table/src/anime.js +46 -0
- package/es/table/src/body.js +9 -24
- package/es/table/src/columnInfo.js +5 -0
- package/es/table/src/footer.js +5 -22
- package/es/table/src/header.js +4 -21
- package/es/table/src/table.js +562 -358
- package/es/table/src/util.js +1 -1
- package/es/table/style.css +8 -8
- package/es/table/style.min.css +1 -1
- package/es/ui/index.js +3 -2
- package/es/ui/src/log.js +1 -1
- package/es/vxe-table/style.css +8 -8
- package/es/vxe-table/style.min.css +1 -1
- package/lib/grid/src/grid.js +143 -98
- package/lib/grid/src/grid.min.js +1 -1
- package/lib/index.css +1 -1
- package/lib/index.min.css +1 -1
- package/lib/index.umd.js +255 -208
- package/lib/index.umd.min.js +1 -1
- package/lib/style.css +1 -1
- package/lib/style.min.css +1 -1
- package/lib/table/module/custom/hook.js +0 -4
- package/lib/table/module/custom/hook.min.js +1 -1
- package/lib/table/module/custom/panel.js +0 -1
- package/lib/table/module/custom/panel.min.js +1 -1
- package/lib/table/module/keyboard/hook.js +2 -2
- package/lib/table/module/keyboard/hook.min.js +1 -1
- package/lib/table/src/anime.js +56 -0
- package/lib/table/src/anime.min.js +1 -0
- package/lib/table/src/body.js +3 -26
- package/lib/table/src/body.min.js +1 -1
- package/lib/table/src/columnInfo.js +5 -0
- package/lib/table/src/columnInfo.min.js +1 -1
- package/lib/table/src/footer.js +2 -20
- package/lib/table/src/footer.min.js +1 -1
- package/lib/table/src/header.js +2 -19
- package/lib/table/src/header.min.js +1 -1
- package/lib/table/src/table.js +47 -34
- package/lib/table/src/table.min.js +1 -1
- package/lib/table/src/util.js +2 -2
- package/lib/table/src/util.min.js +1 -1
- package/lib/table/style/style.css +8 -8
- package/lib/table/style/style.min.css +1 -1
- package/lib/ui/index.js +3 -2
- 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/vxe-table/style/style.css +8 -8
- package/lib/vxe-table/style/style.min.css +1 -1
- package/package.json +1 -1
- package/packages/grid/src/grid.ts +136 -101
- package/packages/table/module/custom/hook.ts +0 -4
- package/packages/table/module/custom/panel.ts +0 -1
- package/packages/table/module/keyboard/hook.ts +2 -2
- package/packages/table/src/anime.ts +52 -0
- package/packages/table/src/body.ts +15 -38
- package/packages/table/src/columnInfo.ts +5 -0
- package/packages/table/src/footer.ts +5 -22
- package/packages/table/src/header.ts +4 -21
- package/packages/table/src/table.ts +570 -361
- package/packages/table/src/util.ts +1 -1
- package/packages/ui/index.ts +2 -1
- package/styles/components/table.scss +9 -9
- /package/es/{iconfont.1750770364548.ttf → iconfont.1751195167653.ttf} +0 -0
- /package/es/{iconfont.1750770364548.woff → iconfont.1751195167653.woff} +0 -0
- /package/es/{iconfont.1750770364548.woff2 → iconfont.1751195167653.woff2} +0 -0
- /package/lib/{iconfont.1750770364548.ttf → iconfont.1751195167653.ttf} +0 -0
- /package/lib/{iconfont.1750770364548.woff → iconfont.1751195167653.woff} +0 -0
- /package/lib/{iconfont.1750770364548.woff2 → iconfont.1751195167653.woff2} +0 -0
|
@@ -9,7 +9,7 @@ import VxeToolbarComponent from '../../toolbar/src/toolbar'
|
|
|
9
9
|
import tableComponentProps from '../../table/src/props'
|
|
10
10
|
import tableComponentEmits from '../../table/src/emits'
|
|
11
11
|
import { getSlotVNs } from '../../ui/src/vn'
|
|
12
|
-
import { errLog } from '../../ui/src/log'
|
|
12
|
+
import { warnLog, errLog } from '../../ui/src/log'
|
|
13
13
|
|
|
14
14
|
import type { ValueOf, VxePagerComponent, VxeFormComponent, VxeFormEvents, VxeFormInstance, VxePagerEvents, VxeFormItemProps, VxePagerInstance, VxeComponentStyleType } from 'vxe-pc-ui'
|
|
15
15
|
import type { VxeTableMethods, VxeGridConstructor, VxeGridEmits, GridReactData, VxeGridPropTypes, VxeToolbarPropTypes, GridMethods, GridPrivateMethods, VxeGridPrivateComputed, VxeGridPrivateMethods, VxeToolbarInstance, GridPrivateRef, VxeTableProps, VxeTableConstructor, VxeTablePrivateMethods, VxeTableEvents, VxeTableDefines, VxeTableEventProps, VxeGridProps } from '../../../types'
|
|
@@ -119,29 +119,29 @@ export default defineVxeComponent({
|
|
|
119
119
|
})
|
|
120
120
|
|
|
121
121
|
const computeProxyOpts = computed(() => {
|
|
122
|
-
return XEUtils.merge({}, XEUtils.clone(getConfig().grid.proxyConfig, true), props.proxyConfig)
|
|
122
|
+
return XEUtils.merge({}, XEUtils.clone(getConfig().grid.proxyConfig, true), props.proxyConfig)
|
|
123
123
|
})
|
|
124
124
|
|
|
125
125
|
const computeIsRespMsg = computed(() => {
|
|
126
126
|
const proxyOpts = computeProxyOpts.value
|
|
127
|
-
return XEUtils.isBoolean(proxyOpts.message) ? proxyOpts.message : proxyOpts.showResponseMsg
|
|
127
|
+
return !!(XEUtils.isBoolean(proxyOpts.message) ? proxyOpts.message : proxyOpts.showResponseMsg)
|
|
128
128
|
})
|
|
129
129
|
|
|
130
130
|
const computeIsActiveMsg = computed(() => {
|
|
131
131
|
const proxyOpts = computeProxyOpts.value
|
|
132
|
-
return proxyOpts.showActiveMsg
|
|
132
|
+
return !!proxyOpts.showActiveMsg
|
|
133
133
|
})
|
|
134
134
|
|
|
135
135
|
const computePagerOpts = computed(() => {
|
|
136
|
-
return Object.assign({}, getConfig().grid.pagerConfig, props.pagerConfig)
|
|
136
|
+
return Object.assign({}, getConfig().grid.pagerConfig, props.pagerConfig)
|
|
137
137
|
})
|
|
138
138
|
|
|
139
139
|
const computeFormOpts = computed(() => {
|
|
140
|
-
return Object.assign({}, getConfig().grid.formConfig, props.formConfig)
|
|
140
|
+
return Object.assign({}, getConfig().grid.formConfig, props.formConfig)
|
|
141
141
|
})
|
|
142
142
|
|
|
143
143
|
const computeToolbarOpts = computed(() => {
|
|
144
|
-
return Object.assign({}, getConfig().grid.toolbarConfig, props.toolbarConfig)
|
|
144
|
+
return Object.assign({}, getConfig().grid.toolbarConfig, props.toolbarConfig)
|
|
145
145
|
})
|
|
146
146
|
|
|
147
147
|
const computeZoomOpts = computed(() => {
|
|
@@ -175,11 +175,12 @@ export default defineVxeComponent({
|
|
|
175
175
|
})
|
|
176
176
|
|
|
177
177
|
const computeTableProps = computed(() => {
|
|
178
|
-
const { seqConfig, pagerConfig,
|
|
179
|
-
const { isZMax,
|
|
178
|
+
const { seqConfig, pagerConfig, editConfig, proxyConfig } = props
|
|
179
|
+
const { isZMax, tablePage } = reactData
|
|
180
180
|
const tableExtendProps = computeTableExtendProps.value
|
|
181
181
|
const proxyOpts = computeProxyOpts.value
|
|
182
182
|
const pagerOpts = computePagerOpts.value
|
|
183
|
+
const isLoading = computeIsLoading.value
|
|
183
184
|
const tProps = Object.assign({}, tableExtendProps)
|
|
184
185
|
if (isZMax) {
|
|
185
186
|
if (tableExtendProps.maxHeight) {
|
|
@@ -189,7 +190,7 @@ export default defineVxeComponent({
|
|
|
189
190
|
}
|
|
190
191
|
}
|
|
191
192
|
if (proxyConfig && isEnableConf(proxyOpts)) {
|
|
192
|
-
tProps.loading =
|
|
193
|
+
tProps.loading = isLoading
|
|
193
194
|
if (pagerConfig && proxyOpts.seq && isEnableConf(pagerOpts)) {
|
|
194
195
|
tProps.seqConfig = Object.assign({}, seqConfig, { startIndex: (tablePage.currentPage - 1) * tablePage.pageSize })
|
|
195
196
|
}
|
|
@@ -242,6 +243,14 @@ export default defineVxeComponent({
|
|
|
242
243
|
return pagerOpts.total
|
|
243
244
|
})
|
|
244
245
|
|
|
246
|
+
const computeIsLoading = computed(() => {
|
|
247
|
+
const { loading, proxyConfig } = props
|
|
248
|
+
const { tableLoading } = reactData
|
|
249
|
+
const proxyOpts = computeProxyOpts.value
|
|
250
|
+
const { showLoading } = proxyOpts
|
|
251
|
+
return loading || (tableLoading && showLoading && proxyConfig && isEnableConf(proxyOpts))
|
|
252
|
+
})
|
|
253
|
+
|
|
245
254
|
const refMaps: GridPrivateRef = {
|
|
246
255
|
refElem,
|
|
247
256
|
refTable,
|
|
@@ -390,12 +399,12 @@ export default defineVxeComponent({
|
|
|
390
399
|
reactData.sortData = params.sortList
|
|
391
400
|
if (proxyConfig && isEnableConf(proxyOpts)) {
|
|
392
401
|
reactData.tablePage.currentPage = 1
|
|
393
|
-
|
|
394
|
-
|
|
402
|
+
$xeGrid.commitProxy('query').then((rest) => {
|
|
403
|
+
$xeGrid.dispatchEvent('proxy-query', rest, params.$event)
|
|
395
404
|
})
|
|
396
405
|
}
|
|
397
406
|
}
|
|
398
|
-
|
|
407
|
+
$xeGrid.dispatchEvent('sort-change', params, params.$event)
|
|
399
408
|
}
|
|
400
409
|
|
|
401
410
|
const filterChangeEvent: VxeTableEvents.FilterChange = (params) => {
|
|
@@ -409,12 +418,12 @@ export default defineVxeComponent({
|
|
|
409
418
|
reactData.filterData = params.filterList
|
|
410
419
|
if (proxyConfig && isEnableConf(proxyOpts)) {
|
|
411
420
|
reactData.tablePage.currentPage = 1
|
|
412
|
-
|
|
413
|
-
|
|
421
|
+
$xeGrid.commitProxy('query').then((rest) => {
|
|
422
|
+
$xeGrid.dispatchEvent('proxy-query', rest, params.$event)
|
|
414
423
|
})
|
|
415
424
|
}
|
|
416
425
|
}
|
|
417
|
-
|
|
426
|
+
$xeGrid.dispatchEvent('filter-change', params, params.$event)
|
|
418
427
|
}
|
|
419
428
|
|
|
420
429
|
const submitFormEvent: VxeFormEvents.Submit = (params) => {
|
|
@@ -424,35 +433,35 @@ export default defineVxeComponent({
|
|
|
424
433
|
return
|
|
425
434
|
}
|
|
426
435
|
if (proxyConfig && isEnableConf(proxyOpts)) {
|
|
427
|
-
|
|
428
|
-
|
|
436
|
+
$xeGrid.commitProxy('reload').then((rest) => {
|
|
437
|
+
$xeGrid.dispatchEvent('proxy-query', { ...rest, isReload: true }, params.$event)
|
|
429
438
|
})
|
|
430
439
|
}
|
|
431
|
-
|
|
440
|
+
$xeGrid.dispatchEvent('form-submit', params, params.$event)
|
|
432
441
|
}
|
|
433
442
|
|
|
434
443
|
const resetFormEvent: VxeFormEvents.Reset = (params) => {
|
|
444
|
+
const $xeTable = refTable.value
|
|
435
445
|
const { proxyConfig } = props
|
|
436
446
|
const { $event } = params
|
|
437
447
|
const proxyOpts = computeProxyOpts.value
|
|
438
|
-
const $xeTable = refTable.value
|
|
439
448
|
if (proxyConfig && isEnableConf(proxyOpts)) {
|
|
440
449
|
$xeTable.clearScroll()
|
|
441
|
-
|
|
442
|
-
|
|
450
|
+
$xeGrid.commitProxy('reload').then((rest) => {
|
|
451
|
+
$xeGrid.dispatchEvent('proxy-query', { ...rest, isReload: true }, $event)
|
|
443
452
|
})
|
|
444
453
|
}
|
|
445
|
-
|
|
454
|
+
$xeGrid.dispatchEvent('form-reset', params, $event)
|
|
446
455
|
}
|
|
447
456
|
|
|
448
457
|
const submitInvalidEvent: VxeFormEvents.SubmitInvalid = (params) => {
|
|
449
|
-
|
|
458
|
+
$xeGrid.dispatchEvent('form-submit-invalid', params, params.$event)
|
|
450
459
|
}
|
|
451
460
|
|
|
452
461
|
const collapseEvent: VxeFormEvents.Collapse = (params) => {
|
|
453
462
|
const { $event } = params
|
|
454
|
-
|
|
455
|
-
|
|
463
|
+
$xeGrid.dispatchEvent('form-toggle-collapse', params, $event)
|
|
464
|
+
$xeGrid.dispatchEvent('form-collapse', params, $event)
|
|
456
465
|
}
|
|
457
466
|
|
|
458
467
|
const handleZoom = (isMax?: boolean) => {
|
|
@@ -464,9 +473,9 @@ export default defineVxeComponent({
|
|
|
464
473
|
}
|
|
465
474
|
}
|
|
466
475
|
return nextTick()
|
|
467
|
-
.then(() =>
|
|
476
|
+
.then(() => $xeGrid.recalculate(true))
|
|
468
477
|
.then(() => {
|
|
469
|
-
setTimeout(() =>
|
|
478
|
+
setTimeout(() => $xeGrid.recalculate(true), 15)
|
|
470
479
|
return reactData.isZMax
|
|
471
480
|
})
|
|
472
481
|
}
|
|
@@ -520,8 +529,8 @@ export default defineVxeComponent({
|
|
|
520
529
|
} else {
|
|
521
530
|
if (formOpts.items) {
|
|
522
531
|
const formSlots: { [key: string]: () => VNode[] } = {}
|
|
523
|
-
if (!formOpts.inited) {
|
|
524
|
-
formOpts.inited = true
|
|
532
|
+
if (!(formOpts as any).inited) {
|
|
533
|
+
(formOpts as any).inited = true
|
|
525
534
|
const beforeItem = proxyOpts.beforeItem
|
|
526
535
|
if (proxyOpts && beforeItem) {
|
|
527
536
|
formOpts.items.forEach((item) => {
|
|
@@ -631,12 +640,13 @@ export default defineVxeComponent({
|
|
|
631
640
|
* 渲染表格顶部区域
|
|
632
641
|
*/
|
|
633
642
|
const renderTop = () => {
|
|
634
|
-
|
|
643
|
+
const topSlot = slots.top
|
|
644
|
+
if (topSlot) {
|
|
635
645
|
return h('div', {
|
|
636
646
|
ref: refTopWrapper,
|
|
637
647
|
key: 'top',
|
|
638
648
|
class: 'vxe-grid--top-wrapper'
|
|
639
|
-
},
|
|
649
|
+
}, topSlot({ $grid: $xeGrid }))
|
|
640
650
|
}
|
|
641
651
|
return renderEmptyElement($xeGrid)
|
|
642
652
|
}
|
|
@@ -830,6 +840,30 @@ export default defineVxeComponent({
|
|
|
830
840
|
tableCompEvents[type] = (...args: any[]) => emit(name, ...args)
|
|
831
841
|
})
|
|
832
842
|
|
|
843
|
+
const getDefaultFormData = () => {
|
|
844
|
+
const formOpts = computeFormOpts.value
|
|
845
|
+
if (formOpts.items) {
|
|
846
|
+
const fData: any = {}
|
|
847
|
+
formOpts.items.forEach(item => {
|
|
848
|
+
const { field, itemRender } = item
|
|
849
|
+
if (field) {
|
|
850
|
+
let itemValue: any = null
|
|
851
|
+
if (itemRender) {
|
|
852
|
+
const { defaultValue } = itemRender
|
|
853
|
+
if (XEUtils.isFunction(defaultValue)) {
|
|
854
|
+
itemValue = defaultValue({ item })
|
|
855
|
+
} else if (!XEUtils.isUndefined(defaultValue)) {
|
|
856
|
+
itemValue = defaultValue
|
|
857
|
+
}
|
|
858
|
+
}
|
|
859
|
+
fData[field] = itemValue
|
|
860
|
+
}
|
|
861
|
+
})
|
|
862
|
+
return fData
|
|
863
|
+
}
|
|
864
|
+
return {}
|
|
865
|
+
}
|
|
866
|
+
|
|
833
867
|
const initProxy = () => {
|
|
834
868
|
const { proxyConfig, formConfig } = props
|
|
835
869
|
const { proxyInited } = reactData
|
|
@@ -837,40 +871,24 @@ export default defineVxeComponent({
|
|
|
837
871
|
const formOpts = computeFormOpts.value
|
|
838
872
|
if (proxyConfig && isEnableConf(proxyOpts)) {
|
|
839
873
|
if (formConfig && isEnableConf(formOpts) && proxyOpts.form && formOpts.items) {
|
|
840
|
-
|
|
841
|
-
formOpts.items.forEach(item => {
|
|
842
|
-
const { field, itemRender } = item
|
|
843
|
-
if (field) {
|
|
844
|
-
let itemValue: any = null
|
|
845
|
-
if (itemRender) {
|
|
846
|
-
const { defaultValue } = itemRender
|
|
847
|
-
if (XEUtils.isFunction(defaultValue)) {
|
|
848
|
-
itemValue = defaultValue({ item })
|
|
849
|
-
} else if (!XEUtils.isUndefined(defaultValue)) {
|
|
850
|
-
itemValue = defaultValue
|
|
851
|
-
}
|
|
852
|
-
}
|
|
853
|
-
fData[field] = itemValue
|
|
854
|
-
}
|
|
855
|
-
})
|
|
856
|
-
reactData.formData = fData
|
|
874
|
+
reactData.formData = getDefaultFormData()
|
|
857
875
|
}
|
|
858
876
|
if (!proxyInited) {
|
|
859
877
|
reactData.proxyInited = true
|
|
860
878
|
if (proxyOpts.autoLoad !== false) {
|
|
861
|
-
nextTick().then(() => gridMethods.commitProxy('
|
|
862
|
-
gridMethods.dispatchEvent('proxy-query', { ...rest, isInited: true }, new Event('
|
|
879
|
+
nextTick().then(() => gridMethods.commitProxy('initial')).then((rest) => {
|
|
880
|
+
gridMethods.dispatchEvent('proxy-query', { ...rest, isInited: true }, new Event('initial'))
|
|
863
881
|
})
|
|
864
882
|
}
|
|
865
883
|
}
|
|
866
884
|
}
|
|
867
885
|
}
|
|
868
886
|
|
|
869
|
-
const handleGlobalKeydownEvent = (evnt:
|
|
887
|
+
const handleGlobalKeydownEvent = (evnt: KeyboardEvent) => {
|
|
870
888
|
const zoomOpts = computeZoomOpts.value
|
|
871
889
|
const isEsc = globalEvents.hasKey(evnt, GLOBAL_EVENT_KEYS.ESCAPE)
|
|
872
890
|
if (isEsc && reactData.isZMax && zoomOpts.escRestore !== false) {
|
|
873
|
-
|
|
891
|
+
$xeGrid.triggerZoomEvent(evnt)
|
|
874
892
|
}
|
|
875
893
|
}
|
|
876
894
|
|
|
@@ -888,7 +906,7 @@ export default defineVxeComponent({
|
|
|
888
906
|
* @param {String/Object} code 字符串或对象
|
|
889
907
|
*/
|
|
890
908
|
commitProxy (proxyTarget: string | VxeToolbarPropTypes.ButtonConfig, ...args: any[]) {
|
|
891
|
-
const { toolbarConfig, pagerConfig, editRules, validConfig } = props
|
|
909
|
+
const { proxyConfig, toolbarConfig, pagerConfig, editRules, validConfig } = props
|
|
892
910
|
const { tablePage } = reactData
|
|
893
911
|
const isActiveMsg = computeIsActiveMsg.value
|
|
894
912
|
const isRespMsg = computeIsRespMsg.value
|
|
@@ -898,7 +916,7 @@ export default defineVxeComponent({
|
|
|
898
916
|
const { beforeQuery, afterQuery, beforeDelete, afterDelete, beforeSave, afterSave, ajax = {} } = proxyOpts
|
|
899
917
|
const resConfigs = proxyOpts.response || proxyOpts.props || {}
|
|
900
918
|
const $xeTable = refTable.value
|
|
901
|
-
|
|
919
|
+
let formData = getFormData()
|
|
902
920
|
let button: VxeToolbarPropTypes.ButtonConfig | null = null
|
|
903
921
|
let code: string | null = null
|
|
904
922
|
if (XEUtils.isString(proxyTarget)) {
|
|
@@ -941,14 +959,14 @@ export default defineVxeComponent({
|
|
|
941
959
|
break
|
|
942
960
|
case 'reset_custom':
|
|
943
961
|
return $xeTable.resetCustom(true)
|
|
944
|
-
case '
|
|
962
|
+
case 'initial':
|
|
945
963
|
case 'reload':
|
|
946
964
|
case 'query': {
|
|
947
965
|
const ajaxMethods = ajax.query
|
|
948
966
|
const querySuccessMethods = ajax.querySuccess
|
|
949
967
|
const queryErrorMethods = ajax.queryError
|
|
950
968
|
if (ajaxMethods) {
|
|
951
|
-
const isInited = code === '
|
|
969
|
+
const isInited = code === 'initial'
|
|
952
970
|
const isReload = code === 'reload'
|
|
953
971
|
if (!isInited && reactData.tableLoading) {
|
|
954
972
|
return nextTick()
|
|
@@ -958,6 +976,7 @@ export default defineVxeComponent({
|
|
|
958
976
|
let pageParams: any = {}
|
|
959
977
|
if (pagerConfig) {
|
|
960
978
|
if (isInited || isReload) {
|
|
979
|
+
// 重置分页
|
|
961
980
|
tablePage.currentPage = 1
|
|
962
981
|
}
|
|
963
982
|
if (isEnableConf(pagerOpts)) {
|
|
@@ -965,26 +984,41 @@ export default defineVxeComponent({
|
|
|
965
984
|
}
|
|
966
985
|
}
|
|
967
986
|
if (isInited) {
|
|
968
|
-
|
|
987
|
+
// 重置代理表单数据
|
|
988
|
+
if (proxyConfig && isEnableConf(proxyOpts) && proxyOpts.form) {
|
|
989
|
+
formData = getDefaultFormData()
|
|
990
|
+
reactData.formData = formData
|
|
991
|
+
}
|
|
969
992
|
if ($xeTable) {
|
|
993
|
+
const tableInternalData = $xeTable.internalData
|
|
994
|
+
const { tableFullColumn, fullColumnFieldData } = tableInternalData
|
|
970
995
|
const { computeSortOpts } = $xeTable.getComputeMaps()
|
|
971
996
|
const sortOpts = computeSortOpts.value
|
|
972
|
-
defaultSort = sortOpts.defaultSort
|
|
973
|
-
|
|
974
|
-
|
|
975
|
-
if (defaultSort) {
|
|
976
|
-
if (!XEUtils.isArray(defaultSort)) {
|
|
977
|
-
defaultSort = [defaultSort]
|
|
978
|
-
}
|
|
979
|
-
sortList = defaultSort.map((item) => {
|
|
980
|
-
return {
|
|
981
|
-
field: item.field,
|
|
982
|
-
property: item.field,
|
|
983
|
-
order: item.order
|
|
984
|
-
}
|
|
997
|
+
let defaultSort = sortOpts.defaultSort
|
|
998
|
+
tableFullColumn.forEach((column) => {
|
|
999
|
+
column.order = null
|
|
985
1000
|
})
|
|
986
|
-
|
|
987
|
-
|
|
1001
|
+
// 如果使用默认排序
|
|
1002
|
+
if (defaultSort) {
|
|
1003
|
+
if (!XEUtils.isArray(defaultSort)) {
|
|
1004
|
+
defaultSort = [defaultSort]
|
|
1005
|
+
}
|
|
1006
|
+
sortList = defaultSort.map((item) => {
|
|
1007
|
+
const { field, order } = item
|
|
1008
|
+
const colRest = fullColumnFieldData[field]
|
|
1009
|
+
if (colRest) {
|
|
1010
|
+
const column = colRest.column
|
|
1011
|
+
if (column) {
|
|
1012
|
+
column.order = order
|
|
1013
|
+
}
|
|
1014
|
+
}
|
|
1015
|
+
return {
|
|
1016
|
+
field,
|
|
1017
|
+
property: field,
|
|
1018
|
+
order
|
|
1019
|
+
}
|
|
1020
|
+
})
|
|
1021
|
+
}
|
|
988
1022
|
filterList = $xeTable.getCheckedFilters()
|
|
989
1023
|
}
|
|
990
1024
|
} else {
|
|
@@ -1310,23 +1344,23 @@ export default defineVxeComponent({
|
|
|
1310
1344
|
},
|
|
1311
1345
|
triggerToolbarCommitEvent (params, evnt) {
|
|
1312
1346
|
const { code } = params
|
|
1313
|
-
return
|
|
1347
|
+
return $xeGrid.commitProxy(params, evnt).then((rest) => {
|
|
1314
1348
|
if (code && rest && rest.status && ['query', 'reload', 'delete', 'save'].includes(code)) {
|
|
1315
|
-
|
|
1349
|
+
$xeGrid.dispatchEvent(code === 'delete' || code === 'save' ? `proxy-${code as 'delete' | 'save'}` : 'proxy-query', { ...rest, isReload: code === 'reload' }, evnt)
|
|
1316
1350
|
}
|
|
1317
1351
|
})
|
|
1318
1352
|
},
|
|
1319
1353
|
triggerToolbarBtnEvent (button, evnt) {
|
|
1320
|
-
|
|
1321
|
-
|
|
1354
|
+
$xeGrid.triggerToolbarCommitEvent(button, evnt)
|
|
1355
|
+
$xeGrid.dispatchEvent('toolbar-button-click', { code: button.code, button }, evnt)
|
|
1322
1356
|
},
|
|
1323
1357
|
triggerToolbarTolEvent (tool, evnt) {
|
|
1324
|
-
|
|
1325
|
-
|
|
1358
|
+
$xeGrid.triggerToolbarCommitEvent(tool, evnt)
|
|
1359
|
+
$xeGrid.dispatchEvent('toolbar-tool-click', { code: tool.code, tool }, evnt)
|
|
1326
1360
|
},
|
|
1327
1361
|
triggerZoomEvent (evnt) {
|
|
1328
|
-
|
|
1329
|
-
|
|
1362
|
+
$xeGrid.zoom()
|
|
1363
|
+
$xeGrid.dispatchEvent('zoom', { type: reactData.isZMax ? 'max' : 'revert' }, evnt)
|
|
1330
1364
|
}
|
|
1331
1365
|
}
|
|
1332
1366
|
|
|
@@ -1356,6 +1390,23 @@ export default defineVxeComponent({
|
|
|
1356
1390
|
}
|
|
1357
1391
|
})
|
|
1358
1392
|
|
|
1393
|
+
const renderVN = () => {
|
|
1394
|
+
const vSize = computeSize.value
|
|
1395
|
+
const styles = computeStyles.value
|
|
1396
|
+
const isLoading = computeIsLoading.value
|
|
1397
|
+
return h('div', {
|
|
1398
|
+
ref: refElem,
|
|
1399
|
+
class: ['vxe-grid', {
|
|
1400
|
+
[`size--${vSize}`]: vSize,
|
|
1401
|
+
'is--animat': !!props.animat,
|
|
1402
|
+
'is--round': props.round,
|
|
1403
|
+
'is--maximize': reactData.isZMax,
|
|
1404
|
+
'is--loading': isLoading
|
|
1405
|
+
}],
|
|
1406
|
+
style: styles
|
|
1407
|
+
}, renderLayout())
|
|
1408
|
+
}
|
|
1409
|
+
|
|
1359
1410
|
const columnFlag = ref(0)
|
|
1360
1411
|
watch(() => props.columns ? props.columns.length : -1, () => {
|
|
1361
1412
|
columnFlag.value++
|
|
@@ -1402,6 +1453,7 @@ export default defineVxeComponent({
|
|
|
1402
1453
|
onMounted(() => {
|
|
1403
1454
|
nextTick(() => {
|
|
1404
1455
|
const { columns } = props
|
|
1456
|
+
const proxyOpts = computeProxyOpts.value
|
|
1405
1457
|
|
|
1406
1458
|
if (props.formConfig) {
|
|
1407
1459
|
if (!VxeUIFormComponent) {
|
|
@@ -1415,15 +1467,14 @@ export default defineVxeComponent({
|
|
|
1415
1467
|
}
|
|
1416
1468
|
|
|
1417
1469
|
// const { data, columns, proxyConfig } = props
|
|
1418
|
-
// const proxyOpts = computeProxyOpts.value
|
|
1419
1470
|
// const formOpts = computeFormOpts.value
|
|
1420
1471
|
// if (isEnableConf(proxyConfig) && (data || (proxyOpts.form && formOpts.data))) {
|
|
1421
1472
|
// errLog('vxe.error.errConflicts', ['grid.data', 'grid.proxy-config'])
|
|
1422
1473
|
// }
|
|
1423
1474
|
|
|
1424
|
-
|
|
1425
|
-
|
|
1426
|
-
|
|
1475
|
+
if (proxyOpts.props) {
|
|
1476
|
+
warnLog('vxe.error.delProp', ['proxy-config.props', 'proxy-config.response'])
|
|
1477
|
+
}
|
|
1427
1478
|
|
|
1428
1479
|
if (columns && columns.length) {
|
|
1429
1480
|
$xeGrid.loadColumn(columns)
|
|
@@ -1438,22 +1489,6 @@ export default defineVxeComponent({
|
|
|
1438
1489
|
globalEvents.off($xeGrid, 'keydown')
|
|
1439
1490
|
})
|
|
1440
1491
|
|
|
1441
|
-
const renderVN = () => {
|
|
1442
|
-
const vSize = computeSize.value
|
|
1443
|
-
const styles = computeStyles.value
|
|
1444
|
-
return h('div', {
|
|
1445
|
-
ref: refElem,
|
|
1446
|
-
class: ['vxe-grid', {
|
|
1447
|
-
[`size--${vSize}`]: vSize,
|
|
1448
|
-
'is--animat': !!props.animat,
|
|
1449
|
-
'is--round': props.round,
|
|
1450
|
-
'is--maximize': reactData.isZMax,
|
|
1451
|
-
'is--loading': props.loading || reactData.tableLoading
|
|
1452
|
-
}],
|
|
1453
|
-
style: styles
|
|
1454
|
-
}, renderLayout())
|
|
1455
|
-
}
|
|
1456
|
-
|
|
1457
1492
|
$xeGrid.renderVN = renderVN
|
|
1458
1493
|
|
|
1459
1494
|
provide('$xeGrid', $xeGrid)
|
|
@@ -111,10 +111,6 @@ VxeUI.hooks.add('tableCustomModule', {
|
|
|
111
111
|
}
|
|
112
112
|
})
|
|
113
113
|
reactData.isCustomStatus = true
|
|
114
|
-
reactData.isDragColMove = true
|
|
115
|
-
setTimeout(() => {
|
|
116
|
-
reactData.isDragColMove = false
|
|
117
|
-
}, 1000)
|
|
118
114
|
return $xeTable.saveCustomStore('confirm').then(() => {
|
|
119
115
|
if (allowGroup && allowValues && ($xeTable as any).handlePivotTableAggregateData) {
|
|
120
116
|
if (rowGroupList.length !== aggHandleFields.length || rowGroupList.some((conf, i) => conf.field !== aggHandleFields[i])) {
|
|
@@ -268,8 +268,8 @@ hooks.add('tableKeyboardModule', {
|
|
|
268
268
|
const checkboxOpts = computeCheckboxOpts.value
|
|
269
269
|
const mouseOpts = computeMouseOpts.value
|
|
270
270
|
const editOpts = computeEditOpts.value
|
|
271
|
-
if (mouseConfig && mouseOpts.area && $xeTable.
|
|
272
|
-
return $xeTable.
|
|
271
|
+
if (mouseConfig && mouseOpts.area && $xeTable.triggerCellAreaMousednEvent) {
|
|
272
|
+
return $xeTable.triggerCellAreaMousednEvent(evnt, params)
|
|
273
273
|
} else {
|
|
274
274
|
if (checkboxConfig && checkboxOpts.range) {
|
|
275
275
|
handleCheckboxRangeEvent(evnt, params)
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
|
|
2
|
+
import XEUtils from 'xe-utils'
|
|
3
|
+
import { addClass, removeClass } from '../../ui/src/dom'
|
|
4
|
+
|
|
5
|
+
const rowMoveCls = 'row--drag-move'
|
|
6
|
+
const colMoveClass = 'col--drag-move'
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* 上下拖拽
|
|
10
|
+
*/
|
|
11
|
+
export function moveRowAnimateToTb (elemList: NodeListOf<HTMLElement> | HTMLDivElement[], offsetTop: number) {
|
|
12
|
+
XEUtils.arrayEach(elemList, trEl => {
|
|
13
|
+
trEl.style.transform = `translateY(${offsetTop}px)`
|
|
14
|
+
})
|
|
15
|
+
requestAnimationFrame(() => {
|
|
16
|
+
XEUtils.arrayEach(elemList, trEl => {
|
|
17
|
+
addClass(trEl, rowMoveCls)
|
|
18
|
+
trEl.style.transform = ''
|
|
19
|
+
})
|
|
20
|
+
})
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export function clearRowAnimate (elem: HTMLElement | undefined) {
|
|
24
|
+
setTimeout(() => {
|
|
25
|
+
if (elem) {
|
|
26
|
+
XEUtils.arrayEach(elem.querySelectorAll(`.vxe-body--row.${rowMoveCls}`), elem => removeClass(elem, rowMoveCls))
|
|
27
|
+
}
|
|
28
|
+
}, 500)
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* 左右拖拽
|
|
33
|
+
*/
|
|
34
|
+
export function moveColAnimateToLr (elemList: NodeListOf<HTMLElement> | HTMLDivElement[], offsetLeft: number) {
|
|
35
|
+
XEUtils.arrayEach(elemList, trEl => {
|
|
36
|
+
trEl.style.transform = `translateX(${offsetLeft}px)`
|
|
37
|
+
})
|
|
38
|
+
requestAnimationFrame(() => {
|
|
39
|
+
XEUtils.arrayEach(elemList, trEl => {
|
|
40
|
+
addClass(trEl, colMoveClass)
|
|
41
|
+
trEl.style.transform = ''
|
|
42
|
+
})
|
|
43
|
+
})
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
export function clearColAnimate (elem: HTMLElement | undefined) {
|
|
47
|
+
setTimeout(() => {
|
|
48
|
+
if (elem) {
|
|
49
|
+
XEUtils.arrayEach(elem.querySelectorAll(`.vxe-table--column.${colMoveClass}`), elem => removeClass(elem, colMoveClass))
|
|
50
|
+
}
|
|
51
|
+
}, 500)
|
|
52
|
+
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { h, ref, Ref, PropType, inject, nextTick, onMounted, onUnmounted } from 'vue'
|
|
2
2
|
import { defineVxeComponent } from '../../ui/src/comp'
|
|
3
3
|
import XEUtils from 'xe-utils'
|
|
4
4
|
import { VxeUI } from '../../ui'
|
|
@@ -28,7 +28,7 @@ export default defineVxeComponent({
|
|
|
28
28
|
const $xeTable = inject('$xeTable', {} as VxeTableConstructor & VxeTablePrivateMethods)
|
|
29
29
|
|
|
30
30
|
const { xID, props: tableProps, context: tableContext, reactData: tableReactData, internalData: tableInternalData } = $xeTable
|
|
31
|
-
const { computeEditOpts, computeMouseOpts, computeCellOffsetWidth, computeAreaOpts, computeDefaultRowHeight, computeEmptyOpts, computeTooltipOpts, computeRadioOpts, computeExpandOpts, computeTreeOpts, computeCheckboxOpts, computeCellOpts, computeValidOpts, computeRowOpts, computeColumnOpts, computeRowDragOpts,
|
|
31
|
+
const { computeEditOpts, computeMouseOpts, computeCellOffsetWidth, computeAreaOpts, computeDefaultRowHeight, computeEmptyOpts, computeTooltipOpts, computeRadioOpts, computeExpandOpts, computeTreeOpts, computeCheckboxOpts, computeCellOpts, computeValidOpts, computeRowOpts, computeColumnOpts, computeRowDragOpts, computeResizableOpts, computeVirtualXOpts, computeVirtualYOpts } = $xeTable.getComputeMaps()
|
|
32
32
|
|
|
33
33
|
const refElem = ref() as Ref<HTMLDivElement>
|
|
34
34
|
const refBodyScroll = ref() as Ref<HTMLDivElement>
|
|
@@ -434,7 +434,7 @@ export default defineVxeComponent({
|
|
|
434
434
|
|
|
435
435
|
return h('td', {
|
|
436
436
|
class: [
|
|
437
|
-
'vxe-body--column',
|
|
437
|
+
'vxe-table--column vxe-body--column',
|
|
438
438
|
colid,
|
|
439
439
|
cellVerticalAlign ? `col--vertical-${cellVerticalAlign}` : '',
|
|
440
440
|
cellAlign ? `col--${cellAlign}` : '',
|
|
@@ -474,7 +474,7 @@ export default defineVxeComponent({
|
|
|
474
474
|
const $xeGrid = $xeTable.xeGrid
|
|
475
475
|
|
|
476
476
|
const { stripe, rowKey, highlightHoverRow, rowClassName, rowStyle, editConfig, treeConfig } = tableProps
|
|
477
|
-
const { hasFixedColumn, treeExpandedFlag,
|
|
477
|
+
const { hasFixedColumn, treeExpandedFlag, scrollXLoad, scrollYLoad, isAllOverflow, rowExpandedFlag, expandColumn, selectRadioRow, pendingRowFlag, rowExpandHeightFlag, isRowGroupStatus } = tableReactData
|
|
478
478
|
const { fullAllDataRowIdData, fullColumnIdData, treeExpandedMaps, pendingRowMaps, rowExpandedMaps } = tableInternalData
|
|
479
479
|
const checkboxOpts = computeCheckboxOpts.value
|
|
480
480
|
const radioOpts = computeRadioOpts.value
|
|
@@ -482,7 +482,6 @@ export default defineVxeComponent({
|
|
|
482
482
|
const editOpts = computeEditOpts.value
|
|
483
483
|
const rowOpts = computeRowOpts.value
|
|
484
484
|
const columnOpts = computeColumnOpts.value
|
|
485
|
-
const columnDragOpts = computeColumnDragOpts.value
|
|
486
485
|
const { transform, seqMode } = treeOpts
|
|
487
486
|
const childrenField = treeOpts.children || treeOpts.childrenField
|
|
488
487
|
const rows: any[] = []
|
|
@@ -562,25 +561,13 @@ export default defineVxeComponent({
|
|
|
562
561
|
return renderTdColumn(seq, rowid, fixedType, isOptimizeMode, rowLevel, row, rowIndex, $rowIndex, _rowIndex, column, $columnIndex, tableColumn, tableData)
|
|
563
562
|
})
|
|
564
563
|
rows.push(
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
key: rowKey || scrollXLoad || scrollYLoad || rowOpts.useKey || rowOpts.drag || columnOpts.drag || isRowGroupStatus || treeConfig ? rowid : $rowIndex,
|
|
573
|
-
...trOn
|
|
574
|
-
}, {
|
|
575
|
-
default: () => tdVNs
|
|
576
|
-
})
|
|
577
|
-
: h('tr', {
|
|
578
|
-
class: trClass,
|
|
579
|
-
rowid: rowid,
|
|
580
|
-
style: rowStyle ? (XEUtils.isFunction(rowStyle) ? rowStyle(params) : rowStyle) : null,
|
|
581
|
-
key: rowKey || scrollXLoad || scrollYLoad || rowOpts.useKey || rowOpts.drag || columnOpts.drag || isRowGroupStatus || treeConfig ? rowid : $rowIndex,
|
|
582
|
-
...trOn
|
|
583
|
-
}, tdVNs)
|
|
564
|
+
h('tr', {
|
|
565
|
+
class: trClass,
|
|
566
|
+
rowid: rowid,
|
|
567
|
+
style: rowStyle ? (XEUtils.isFunction(rowStyle) ? rowStyle(params) : rowStyle) : null,
|
|
568
|
+
key: rowKey || scrollXLoad || scrollYLoad || rowOpts.useKey || rowOpts.drag || columnOpts.drag || isRowGroupStatus || treeConfig ? rowid : $rowIndex,
|
|
569
|
+
...trOn
|
|
570
|
+
}, tdVNs)
|
|
584
571
|
)
|
|
585
572
|
// 如果行被展开了
|
|
586
573
|
if (isExpandRow) {
|
|
@@ -715,12 +702,10 @@ export default defineVxeComponent({
|
|
|
715
702
|
|
|
716
703
|
const { fixedColumn, fixedType, tableColumn } = props
|
|
717
704
|
const { spanMethod, footerSpanMethod, mouseConfig } = tableProps
|
|
718
|
-
const { isGroup, tableData,
|
|
705
|
+
const { isGroup, tableData, isColLoading, overflowX, scrollXLoad, scrollYLoad, isAllOverflow, expandColumn, dragRow, dragCol } = tableReactData
|
|
719
706
|
const { visibleColumn, fullAllDataRowIdData, fullColumnIdData } = tableInternalData
|
|
720
|
-
const rowOpts = computeRowOpts.value
|
|
721
707
|
const emptyOpts = computeEmptyOpts.value
|
|
722
708
|
const mouseOpts = computeMouseOpts.value
|
|
723
|
-
const rowDragOpts = computeRowDragOpts.value
|
|
724
709
|
const expandOpts = computeExpandOpts.value
|
|
725
710
|
|
|
726
711
|
let renderDataList = tableData
|
|
@@ -860,17 +845,9 @@ export default defineVxeComponent({
|
|
|
860
845
|
/**
|
|
861
846
|
* 内容
|
|
862
847
|
*/
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
name: `vxe-body--row-list${isDragRowMove ? '' : '-disabled'}`,
|
|
867
|
-
tag: 'tbody'
|
|
868
|
-
}, {
|
|
869
|
-
default: () => renderRows(fixedType, isOptimizeMode, renderDataList, renderColumnList)
|
|
870
|
-
})
|
|
871
|
-
: h('tbody', {
|
|
872
|
-
ref: refBodyTBody
|
|
873
|
-
}, renderRows(fixedType, isOptimizeMode, renderDataList, renderColumnList))
|
|
848
|
+
h('tbody', {
|
|
849
|
+
ref: refBodyTBody
|
|
850
|
+
}, renderRows(fixedType, isOptimizeMode, renderDataList, renderColumnList))
|
|
874
851
|
]),
|
|
875
852
|
h('div', {
|
|
876
853
|
class: 'vxe-table--checkbox-range'
|