vxe-table 3.19.20 → 3.19.22
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/es/grid/src/grid.js +148 -33
- package/es/style.css +1 -1
- package/es/table/render/index.js +113 -4
- package/es/table/src/cell.js +10 -8
- package/es/table/src/methods.js +176 -74
- package/es/table/src/table.js +12 -2
- package/es/ui/index.js +3 -2
- package/es/ui/src/log.js +1 -1
- package/lib/grid/src/grid.js +166 -48
- package/lib/grid/src/grid.min.js +1 -1
- package/lib/index.umd.js +367 -89
- package/lib/index.umd.min.js +1 -1
- package/lib/style.css +1 -1
- package/lib/table/render/index.js +140 -10
- package/lib/table/render/index.min.js +1 -1
- package/lib/table/src/cell.js +13 -7
- package/lib/table/src/cell.min.js +1 -1
- package/lib/table/src/methods.js +160 -56
- package/lib/table/src/methods.min.js +1 -1
- package/lib/table/src/table.js +15 -2
- package/lib/table/src/table.min.js +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/package.json +2 -2
- package/packages/grid/src/grid.ts +148 -35
- package/packages/table/render/index.ts +115 -4
- package/packages/table/src/cell.ts +10 -8
- package/packages/table/src/methods.ts +176 -72
- package/packages/table/src/table.ts +13 -2
- package/packages/ui/index.ts +2 -1
- /package/es/{iconfont.1764045838630.ttf → iconfont.1764380622607.ttf} +0 -0
- /package/es/{iconfont.1764045838630.woff → iconfont.1764380622607.woff} +0 -0
- /package/es/{iconfont.1764045838630.woff2 → iconfont.1764380622607.woff2} +0 -0
- /package/lib/{iconfont.1764045838630.ttf → iconfont.1764380622607.ttf} +0 -0
- /package/lib/{iconfont.1764045838630.woff → iconfont.1764380622607.woff} +0 -0
- /package/lib/{iconfont.1764045838630.woff2 → iconfont.1764380622607.woff2} +0 -0
|
@@ -52,6 +52,7 @@ XEUtils.each(VxeTableComponent.methods, (fn, name) => {
|
|
|
52
52
|
|
|
53
53
|
function createInternalData (): GridInternalData {
|
|
54
54
|
return {
|
|
55
|
+
uFoot: false
|
|
55
56
|
}
|
|
56
57
|
}
|
|
57
58
|
|
|
@@ -76,6 +77,7 @@ export default /* define-vxe-component start */ defineVxeComponent({
|
|
|
76
77
|
editRules: PropType<VxeTablePropTypes.EditRules>
|
|
77
78
|
animat: PropType<VxeTablePropTypes.Animat>
|
|
78
79
|
scrollbarConfig: PropType<VxeTablePropTypes.ScrollbarConfig>
|
|
80
|
+
showFooter: PropType<VxeTablePropTypes.ShowFooter>
|
|
79
81
|
params: PropType<VxeTablePropTypes.Params>
|
|
80
82
|
}),
|
|
81
83
|
|
|
@@ -111,6 +113,7 @@ export default /* define-vxe-component start */ defineVxeComponent({
|
|
|
111
113
|
filterData: [],
|
|
112
114
|
formData: {},
|
|
113
115
|
sortData: [],
|
|
116
|
+
footerData: [],
|
|
114
117
|
tZindex: 0,
|
|
115
118
|
tablePage: {
|
|
116
119
|
total: 0,
|
|
@@ -235,7 +238,9 @@ export default /* define-vxe-component start */ defineVxeComponent({
|
|
|
235
238
|
const rest: any = {}
|
|
236
239
|
const gridProps: any = props
|
|
237
240
|
propKeys.forEach(key => {
|
|
238
|
-
|
|
241
|
+
if (gridProps[key] !== undefined) {
|
|
242
|
+
rest[key] = gridProps[key]
|
|
243
|
+
}
|
|
239
244
|
})
|
|
240
245
|
return rest
|
|
241
246
|
},
|
|
@@ -244,15 +249,22 @@ export default /* define-vxe-component start */ defineVxeComponent({
|
|
|
244
249
|
const props = $xeGrid
|
|
245
250
|
const reactData = $xeGrid.reactData
|
|
246
251
|
|
|
247
|
-
const { seqConfig, pagerConfig, editConfig, proxyConfig } = props
|
|
248
|
-
const { isZMax, tablePage } = reactData
|
|
252
|
+
const { showFooter, seqConfig, pagerConfig, editConfig, proxyConfig } = props
|
|
253
|
+
const { isZMax, tablePage, footerData } = reactData
|
|
249
254
|
const tableExtendProps = $xeGrid.computeTableExtendProps as any
|
|
250
|
-
const proxyOpts = $xeGrid.computeProxyOpts
|
|
251
|
-
const pagerOpts = $xeGrid.computePagerOpts
|
|
252
|
-
const isLoading = $xeGrid.computeIsLoading
|
|
255
|
+
const proxyOpts = $xeGrid.computeProxyOpts as VxeGridPropTypes.ProxyConfig
|
|
256
|
+
const pagerOpts = $xeGrid.computePagerOpts as VxeGridPropTypes.PagerConfig
|
|
257
|
+
const isLoading = $xeGrid.computeIsLoading as boolean
|
|
253
258
|
const tProps = Object.assign({}, tableExtendProps)
|
|
259
|
+
if (showFooter && !tProps.footerData) {
|
|
260
|
+
// 如果未设置自己的标位数据,则使用代理的
|
|
261
|
+
tProps.footerData = footerData
|
|
262
|
+
} else if (proxyOpts.footer && footerData.length) {
|
|
263
|
+
// 如果代理标为数据,且未请求到数据,则用自己的
|
|
264
|
+
tProps.footerData = footerData
|
|
265
|
+
}
|
|
254
266
|
if (isZMax) {
|
|
255
|
-
if (
|
|
267
|
+
if (tProps.maxHeight) {
|
|
256
268
|
tProps.maxHeight = '100%'
|
|
257
269
|
} else {
|
|
258
270
|
tProps.height = '100%'
|
|
@@ -514,6 +526,7 @@ export default /* define-vxe-component start */ defineVxeComponent({
|
|
|
514
526
|
const $xeGrid = this
|
|
515
527
|
const props = $xeGrid
|
|
516
528
|
const reactData = $xeGrid.reactData
|
|
529
|
+
const internalData = $xeGrid.internalData
|
|
517
530
|
|
|
518
531
|
const { proxyConfig, formConfig } = props
|
|
519
532
|
const { proxyInited } = reactData
|
|
@@ -523,14 +536,31 @@ export default /* define-vxe-component start */ defineVxeComponent({
|
|
|
523
536
|
if (isEnableConf(formConfig) && proxyOpts.form && formOpts.items) {
|
|
524
537
|
reactData.formData = $xeGrid.getDefaultFormData()
|
|
525
538
|
}
|
|
526
|
-
if (!proxyInited
|
|
539
|
+
if (!proxyInited) {
|
|
527
540
|
reactData.proxyInited = true
|
|
528
|
-
|
|
529
|
-
$xeGrid.
|
|
530
|
-
|
|
541
|
+
if (proxyOpts.autoLoad !== false) {
|
|
542
|
+
$xeGrid.$nextTick().then(() => {
|
|
543
|
+
internalData.uFoot = true
|
|
544
|
+
const rest = $xeGrid.commitProxy('initial')
|
|
545
|
+
internalData.uFoot = false
|
|
546
|
+
$xeGrid.updateQueryFooter()
|
|
547
|
+
return rest
|
|
548
|
+
}).then((rest) => {
|
|
549
|
+
$xeGrid.dispatchEvent('proxy-query', { ...rest, isInited: true }, new Event('initial'))
|
|
550
|
+
})
|
|
551
|
+
}
|
|
531
552
|
}
|
|
532
553
|
}
|
|
533
554
|
},
|
|
555
|
+
updateQueryFooter () {
|
|
556
|
+
const $xeGrid = this
|
|
557
|
+
|
|
558
|
+
const proxyOpts = $xeGrid.computeProxyOpts
|
|
559
|
+
const { ajax } = proxyOpts
|
|
560
|
+
if (ajax && ajax.queryFooter) {
|
|
561
|
+
return $xeGrid.commitProxy('queryFooter')
|
|
562
|
+
}
|
|
563
|
+
},
|
|
534
564
|
handleGlobalKeydownEvent (evnt: KeyboardEvent) {
|
|
535
565
|
const $xeGrid = this
|
|
536
566
|
const reactData = $xeGrid.reactData
|
|
@@ -605,6 +635,7 @@ export default /* define-vxe-component start */ defineVxeComponent({
|
|
|
605
635
|
const $xeGrid = this
|
|
606
636
|
const props = $xeGrid
|
|
607
637
|
const reactData = $xeGrid.reactData
|
|
638
|
+
const internalData = $xeGrid.internalData
|
|
608
639
|
|
|
609
640
|
/**
|
|
610
641
|
* 已废弃
|
|
@@ -612,15 +643,15 @@ export default /* define-vxe-component start */ defineVxeComponent({
|
|
|
612
643
|
*/
|
|
613
644
|
const toolbar = (props as any).toolbar
|
|
614
645
|
|
|
615
|
-
const { proxyConfig, toolbarConfig, pagerConfig, editRules, validConfig } = props
|
|
646
|
+
const { showFooter, proxyConfig, toolbarConfig, pagerConfig, editRules, validConfig } = props
|
|
616
647
|
const { tablePage } = reactData
|
|
617
648
|
const isActiveMsg = $xeGrid.computeIsActiveMsg
|
|
618
649
|
const isRespMsg = $xeGrid.computeIsRespMsg
|
|
619
650
|
const proxyOpts = $xeGrid.computeProxyOpts
|
|
620
651
|
const pagerOpts = $xeGrid.computePagerOpts
|
|
621
652
|
const toolbarOpts = $xeGrid.computeToolbarOpts
|
|
622
|
-
const { beforeQuery, afterQuery, beforeDelete, afterDelete, beforeSave, afterSave, ajax = {} } = proxyOpts
|
|
623
|
-
const resConfigs = proxyOpts.response || proxyOpts.props || {}
|
|
653
|
+
const { beforeQuery, afterQuery, beforeQueryFooter, afterQueryFooter, beforeDelete, afterDelete, beforeSave, afterSave, ajax = {} } = proxyOpts
|
|
654
|
+
const resConfigs = (proxyOpts.response || proxyOpts.props || {}) as VxeGridDefines.ProxyConfigResponseConfig
|
|
624
655
|
const $xeTable = $xeGrid.$refs.refTable as VxeTableConstructor & VxeTablePrivateMethods
|
|
625
656
|
let formData = $xeGrid.getFormData()
|
|
626
657
|
let button: VxeToolbarPropTypes.ButtonConfig | null = null
|
|
@@ -669,10 +700,10 @@ export default /* define-vxe-component start */ defineVxeComponent({
|
|
|
669
700
|
case 'initial':
|
|
670
701
|
case 'reload':
|
|
671
702
|
case 'query': {
|
|
672
|
-
const
|
|
673
|
-
const
|
|
674
|
-
const
|
|
675
|
-
if (
|
|
703
|
+
const qMethods = ajax.query
|
|
704
|
+
const qsMethods = ajax.querySuccess
|
|
705
|
+
const qeMethods = ajax.queryError
|
|
706
|
+
if (qMethods) {
|
|
676
707
|
const isInited = code === 'initial'
|
|
677
708
|
const isReload = code === 'reload'
|
|
678
709
|
if (!isInited && reactData.tableLoading) {
|
|
@@ -750,24 +781,25 @@ export default /* define-vxe-component start */ defineVxeComponent({
|
|
|
750
781
|
sorts: sortList,
|
|
751
782
|
filters: filterList,
|
|
752
783
|
form: formData,
|
|
753
|
-
options:
|
|
784
|
+
options: qMethods
|
|
754
785
|
}
|
|
755
786
|
reactData.sortData = sortList
|
|
756
787
|
reactData.filterData = filterList
|
|
757
788
|
reactData.tableLoading = true
|
|
758
789
|
return Promise.all([
|
|
759
|
-
Promise.resolve((beforeQuery ||
|
|
790
|
+
Promise.resolve((beforeQuery || qMethods)(commitParams, ...args)),
|
|
760
791
|
operPromise
|
|
761
792
|
]).then(([rest]) => {
|
|
762
793
|
let tableData: any[] = []
|
|
763
794
|
reactData.tableLoading = false
|
|
764
795
|
if (rest) {
|
|
796
|
+
const reParams = { data: rest, $table: $xeTable, $grid: $xeGrid as VxeGridConstructor, $gantt: null }
|
|
765
797
|
if (pagerConfig && isEnableConf(pagerOpts)) {
|
|
766
798
|
const totalProp = resConfigs.total
|
|
767
|
-
const total = (XEUtils.isFunction(totalProp) ? totalProp(
|
|
799
|
+
const total = (XEUtils.isFunction(totalProp) ? totalProp(reParams) : XEUtils.get(rest, totalProp || 'page.total')) || 0
|
|
768
800
|
tablePage.total = XEUtils.toNumber(total)
|
|
769
801
|
const resultProp = resConfigs.result
|
|
770
|
-
tableData = (XEUtils.isFunction(resultProp) ? resultProp(
|
|
802
|
+
tableData = (XEUtils.isFunction(resultProp) ? resultProp(reParams) : XEUtils.get(rest, resultProp || 'result')) || []
|
|
771
803
|
// 检验当前页码,不能超出当前最大页数
|
|
772
804
|
const pageCount = Math.max(Math.ceil(total / tablePage.pageSize), 1)
|
|
773
805
|
if (tablePage.currentPage > pageCount) {
|
|
@@ -775,7 +807,18 @@ export default /* define-vxe-component start */ defineVxeComponent({
|
|
|
775
807
|
}
|
|
776
808
|
} else {
|
|
777
809
|
const listProp = resConfigs.list
|
|
778
|
-
|
|
810
|
+
if (XEUtils.isArray(rest)) {
|
|
811
|
+
tableData = rest
|
|
812
|
+
} else if (listProp) {
|
|
813
|
+
tableData = (XEUtils.isFunction(listProp) ? listProp(reParams) : XEUtils.get(rest, listProp)) || []
|
|
814
|
+
}
|
|
815
|
+
}
|
|
816
|
+
if (showFooter) {
|
|
817
|
+
const fdProp = resConfigs.footerData
|
|
818
|
+
const footerList = fdProp ? (XEUtils.isFunction(fdProp) ? fdProp(reParams) : XEUtils.get(rest, fdProp)) : []
|
|
819
|
+
if (XEUtils.isArray(footerList)) {
|
|
820
|
+
reactData.footerData = footerList
|
|
821
|
+
}
|
|
779
822
|
}
|
|
780
823
|
}
|
|
781
824
|
if ($xeTable) {
|
|
@@ -791,14 +834,14 @@ export default /* define-vxe-component start */ defineVxeComponent({
|
|
|
791
834
|
if (afterQuery) {
|
|
792
835
|
afterQuery(commitParams, ...args)
|
|
793
836
|
}
|
|
794
|
-
if (
|
|
795
|
-
|
|
837
|
+
if (qsMethods) {
|
|
838
|
+
qsMethods({ ...commitParams, response: rest })
|
|
796
839
|
}
|
|
797
840
|
return { status: true }
|
|
798
841
|
}).catch((rest) => {
|
|
799
842
|
reactData.tableLoading = false
|
|
800
|
-
if (
|
|
801
|
-
|
|
843
|
+
if (qeMethods) {
|
|
844
|
+
qeMethods({ ...commitParams, response: rest })
|
|
802
845
|
}
|
|
803
846
|
return { status: false }
|
|
804
847
|
})
|
|
@@ -807,11 +850,50 @@ export default /* define-vxe-component start */ defineVxeComponent({
|
|
|
807
850
|
}
|
|
808
851
|
break
|
|
809
852
|
}
|
|
853
|
+
case 'queryFooter': {
|
|
854
|
+
const qfMethods = ajax.queryFooter
|
|
855
|
+
const qfSuccessMethods = ajax.queryFooterSuccess
|
|
856
|
+
const qfErrorMethods = ajax.queryFooterError
|
|
857
|
+
if (qfMethods) {
|
|
858
|
+
let filterList: VxeTableDefines.FilterCheckedParams[] = []
|
|
859
|
+
if ($xeTable) {
|
|
860
|
+
filterList = $xeTable.getCheckedFilters()
|
|
861
|
+
}
|
|
862
|
+
const commitParams = {
|
|
863
|
+
$table: $xeTable,
|
|
864
|
+
$grid: $xeGrid,
|
|
865
|
+
$gantt: null,
|
|
866
|
+
code,
|
|
867
|
+
button,
|
|
868
|
+
filters: filterList,
|
|
869
|
+
form: formData,
|
|
870
|
+
options: qfMethods
|
|
871
|
+
}
|
|
872
|
+
return Promise.resolve((beforeQueryFooter || qfMethods)(commitParams, ...args)).then(rest => {
|
|
873
|
+
reactData.footerData = XEUtils.isArray(rest) ? rest : []
|
|
874
|
+
if (afterQueryFooter) {
|
|
875
|
+
afterQueryFooter(commitParams, ...args)
|
|
876
|
+
}
|
|
877
|
+
if (qfSuccessMethods) {
|
|
878
|
+
qfSuccessMethods({ ...commitParams, response: rest })
|
|
879
|
+
}
|
|
880
|
+
return { status: true }
|
|
881
|
+
}).catch((rest) => {
|
|
882
|
+
if (qfErrorMethods) {
|
|
883
|
+
qfErrorMethods({ ...commitParams, response: rest })
|
|
884
|
+
}
|
|
885
|
+
return { status: false }
|
|
886
|
+
})
|
|
887
|
+
} else {
|
|
888
|
+
errLog('vxe.error.notFunc', ['[grid] proxy-config.ajax.queryFooter'])
|
|
889
|
+
}
|
|
890
|
+
break
|
|
891
|
+
}
|
|
810
892
|
case 'delete': {
|
|
811
|
-
const
|
|
893
|
+
const dMethods = ajax.delete
|
|
812
894
|
const deleteSuccessMethods = ajax.deleteSuccess
|
|
813
895
|
const deleteErrorMethods = ajax.deleteError
|
|
814
|
-
if (
|
|
896
|
+
if (dMethods) {
|
|
815
897
|
const selectRecords = $xeTable.getCheckboxRecords()
|
|
816
898
|
const removeRecords = selectRecords.filter((row) => !$xeTable.isInsertByRow(row))
|
|
817
899
|
const body = { removeRecords }
|
|
@@ -823,7 +905,7 @@ export default /* define-vxe-component start */ defineVxeComponent({
|
|
|
823
905
|
button,
|
|
824
906
|
body,
|
|
825
907
|
form: formData,
|
|
826
|
-
options:
|
|
908
|
+
options: dMethods
|
|
827
909
|
}
|
|
828
910
|
const applyArgs = [commitParams].concat(args)
|
|
829
911
|
if (selectRecords.length) {
|
|
@@ -832,7 +914,7 @@ export default /* define-vxe-component start */ defineVxeComponent({
|
|
|
832
914
|
return $xeTable.remove(selectRecords)
|
|
833
915
|
}
|
|
834
916
|
reactData.tableLoading = true
|
|
835
|
-
return Promise.resolve((beforeDelete ||
|
|
917
|
+
return Promise.resolve((beforeDelete || dMethods)(...applyArgs))
|
|
836
918
|
.then(rest => {
|
|
837
919
|
reactData.tableLoading = false
|
|
838
920
|
$xeTable.setPendingRow(removeRecords, false)
|
|
@@ -844,7 +926,10 @@ export default /* define-vxe-component start */ defineVxeComponent({
|
|
|
844
926
|
if (afterDelete) {
|
|
845
927
|
afterDelete(...applyArgs)
|
|
846
928
|
} else {
|
|
929
|
+
internalData.uFoot = true
|
|
847
930
|
$xeGrid.commitProxy('query')
|
|
931
|
+
internalData.uFoot = false
|
|
932
|
+
$xeGrid.updateQueryFooter()
|
|
848
933
|
}
|
|
849
934
|
if (deleteSuccessMethods) {
|
|
850
935
|
deleteSuccessMethods({ ...commitParams, response: rest })
|
|
@@ -926,7 +1011,10 @@ export default /* define-vxe-component start */ defineVxeComponent({
|
|
|
926
1011
|
if (afterSave) {
|
|
927
1012
|
afterSave(...applyArgs)
|
|
928
1013
|
} else {
|
|
1014
|
+
internalData.uFoot = true
|
|
929
1015
|
$xeGrid.commitProxy('query')
|
|
1016
|
+
internalData.uFoot = false
|
|
1017
|
+
$xeGrid.updateQueryFooter()
|
|
930
1018
|
}
|
|
931
1019
|
if (saveSuccessMethods) {
|
|
932
1020
|
saveSuccessMethods({ ...commitParams, response: rest })
|
|
@@ -1114,13 +1202,26 @@ export default /* define-vxe-component start */ defineVxeComponent({
|
|
|
1114
1202
|
},
|
|
1115
1203
|
triggerToolbarCommitEvent (params: any, evnt: any) {
|
|
1116
1204
|
const $xeGrid = this
|
|
1205
|
+
const internalData = $xeGrid.internalData
|
|
1117
1206
|
|
|
1118
1207
|
const { code } = params
|
|
1119
|
-
|
|
1120
|
-
|
|
1121
|
-
|
|
1208
|
+
if (code) {
|
|
1209
|
+
const isUf = ['reload', 'delete', 'save'].includes(code)
|
|
1210
|
+
if (isUf) {
|
|
1211
|
+
internalData.uFoot = true
|
|
1122
1212
|
}
|
|
1123
|
-
|
|
1213
|
+
const rest = $xeGrid.commitProxy(params, evnt).then((rest) => {
|
|
1214
|
+
if (code && rest && rest.status && ['query', 'reload', 'delete', 'save'].includes(code)) {
|
|
1215
|
+
$xeGrid.dispatchEvent(code === 'delete' || code === 'save' ? `proxy-${code as 'delete' | 'save'}` : 'proxy-query', { ...rest, isReload: code === 'reload' }, evnt)
|
|
1216
|
+
}
|
|
1217
|
+
})
|
|
1218
|
+
if (isUf) {
|
|
1219
|
+
$xeGrid.updateQueryFooter()
|
|
1220
|
+
}
|
|
1221
|
+
internalData.uFoot = false
|
|
1222
|
+
return rest
|
|
1223
|
+
}
|
|
1224
|
+
return $xeGrid.$nextTick()
|
|
1124
1225
|
},
|
|
1125
1226
|
triggerToolbarBtnEvent (button: any, evnt: any) {
|
|
1126
1227
|
const $xeGrid = this
|
|
@@ -1188,6 +1289,7 @@ export default /* define-vxe-component start */ defineVxeComponent({
|
|
|
1188
1289
|
const $xeGrid = this
|
|
1189
1290
|
const props = $xeGrid
|
|
1190
1291
|
const reactData = $xeGrid.reactData
|
|
1292
|
+
const internalData = $xeGrid.internalData
|
|
1191
1293
|
const $xeTable = $xeGrid.$refs.refTable as VxeTableConstructor & VxeTablePrivateMethods
|
|
1192
1294
|
|
|
1193
1295
|
const { proxyConfig } = props
|
|
@@ -1198,9 +1300,12 @@ export default /* define-vxe-component start */ defineVxeComponent({
|
|
|
1198
1300
|
reactData.filterData = params.filterList
|
|
1199
1301
|
if (proxyConfig && isEnableConf(proxyOpts)) {
|
|
1200
1302
|
reactData.tablePage.currentPage = 1
|
|
1303
|
+
internalData.uFoot = true
|
|
1201
1304
|
$xeGrid.commitProxy('query').then((rest) => {
|
|
1202
1305
|
$xeGrid.dispatchEvent('proxy-query', rest, params.$event)
|
|
1203
1306
|
})
|
|
1307
|
+
internalData.uFoot = false
|
|
1308
|
+
$xeGrid.updateQueryFooter()
|
|
1204
1309
|
}
|
|
1205
1310
|
}
|
|
1206
1311
|
},
|
|
@@ -1220,6 +1325,7 @@ export default /* define-vxe-component start */ defineVxeComponent({
|
|
|
1220
1325
|
const $xeGrid = this
|
|
1221
1326
|
const props = $xeGrid
|
|
1222
1327
|
const reactData = $xeGrid.reactData
|
|
1328
|
+
const internalData = $xeGrid.internalData
|
|
1223
1329
|
|
|
1224
1330
|
const { proxyConfig } = props
|
|
1225
1331
|
const proxyOpts = $xeGrid.computeProxyOpts
|
|
@@ -1227,15 +1333,19 @@ export default /* define-vxe-component start */ defineVxeComponent({
|
|
|
1227
1333
|
return
|
|
1228
1334
|
}
|
|
1229
1335
|
if (proxyConfig && isEnableConf(proxyOpts)) {
|
|
1336
|
+
internalData.uFoot = true
|
|
1230
1337
|
$xeGrid.commitProxy('reload').then((rest) => {
|
|
1231
1338
|
$xeGrid.dispatchEvent('proxy-query', { ...rest, isReload: true }, params.$event)
|
|
1232
1339
|
})
|
|
1340
|
+
internalData.uFoot = false
|
|
1341
|
+
$xeGrid.updateQueryFooter()
|
|
1233
1342
|
}
|
|
1234
1343
|
$xeGrid.dispatchEvent('form-submit', params, params.$event)
|
|
1235
1344
|
},
|
|
1236
1345
|
resetFormEvent (params: VxeFormDefines.ResetEventParams) {
|
|
1237
1346
|
const $xeGrid = this
|
|
1238
1347
|
const props = $xeGrid
|
|
1348
|
+
const internalData = $xeGrid.internalData
|
|
1239
1349
|
|
|
1240
1350
|
const $xeTable = $xeGrid.$refs.refTable as VxeTableConstructor & VxeTablePrivateMethods
|
|
1241
1351
|
const { proxyConfig } = props
|
|
@@ -1243,9 +1353,12 @@ export default /* define-vxe-component start */ defineVxeComponent({
|
|
|
1243
1353
|
const proxyOpts = $xeGrid.computeProxyOpts
|
|
1244
1354
|
if (proxyConfig && isEnableConf(proxyOpts)) {
|
|
1245
1355
|
$xeTable.clearScroll()
|
|
1356
|
+
internalData.uFoot = true
|
|
1246
1357
|
$xeGrid.commitProxy('reload').then((rest) => {
|
|
1247
1358
|
$xeGrid.dispatchEvent('proxy-query', { ...rest, isReload: true }, $event)
|
|
1248
1359
|
})
|
|
1360
|
+
internalData.uFoot = false
|
|
1361
|
+
$xeGrid.updateQueryFooter()
|
|
1249
1362
|
}
|
|
1250
1363
|
$xeGrid.dispatchEvent('form-reset', params, $event)
|
|
1251
1364
|
},
|
|
@@ -657,9 +657,8 @@ function oldSelectEditRender (h: CreateElement, renderOpts: VxeGlobalRendererHan
|
|
|
657
657
|
]
|
|
658
658
|
}
|
|
659
659
|
|
|
660
|
-
function
|
|
660
|
+
function handleSelectCellValue (cellValue: any, renderOpts: VxeGlobalRendererHandles.RenderTableCellOptions) {
|
|
661
661
|
const { options, optionGroups, optionProps = {}, optionGroupProps = {}, props = {} } = renderOpts
|
|
662
|
-
const cellValue = XEUtils.get(row, column.field)
|
|
663
662
|
let selectItem: any
|
|
664
663
|
const labelProp = optionProps.label || 'label'
|
|
665
664
|
const valueProp = optionProps.value || 'value'
|
|
@@ -696,14 +695,18 @@ function getSelectCellValue (renderOpts: VxeGlobalRendererHandles.RenderTableCel
|
|
|
696
695
|
return ''
|
|
697
696
|
}
|
|
698
697
|
|
|
698
|
+
function getSelectCellValue (renderOpts: VxeGlobalRendererHandles.RenderTableCellOptions, { row, column }: any) {
|
|
699
|
+
const cellValue = XEUtils.get(row, column.field)
|
|
700
|
+
return handleSelectCellValue(cellValue, renderOpts)
|
|
701
|
+
}
|
|
702
|
+
|
|
699
703
|
function handleExportSelectMethod (params: any) {
|
|
700
704
|
const { row, column, options } = params
|
|
701
705
|
return options.original ? getCellValue(row, column) : getSelectCellValue(column.editRender || column.cellRender, params)
|
|
702
706
|
}
|
|
703
707
|
|
|
704
|
-
function
|
|
708
|
+
function handleTreeSelectCellValue (cellValue: any, renderOpts: VxeGlobalRendererHandles.RenderTableEditOptions) {
|
|
705
709
|
const { options, optionProps = {} } = renderOpts
|
|
706
|
-
const cellValue = XEUtils.get(row, column.field)
|
|
707
710
|
const labelProp = optionProps.label || 'label'
|
|
708
711
|
const valueProp = optionProps.value || 'value'
|
|
709
712
|
const childrenProp = optionProps.children || 'children'
|
|
@@ -721,6 +724,11 @@ function getTreeSelectCellValue (renderOpts: VxeGlobalRendererHandles.RenderTabl
|
|
|
721
724
|
return ''
|
|
722
725
|
}
|
|
723
726
|
|
|
727
|
+
function getTreeSelectCellValue (renderOpts: VxeGlobalRendererHandles.RenderTableEditOptions, { row, column }: any) {
|
|
728
|
+
const cellValue = XEUtils.get(row, column.field)
|
|
729
|
+
return handleTreeSelectCellValue(cellValue, renderOpts)
|
|
730
|
+
}
|
|
731
|
+
|
|
724
732
|
function handleExportTreeSelectMethod (params: any) {
|
|
725
733
|
const { row, column, options } = params
|
|
726
734
|
return options.original ? getCellValue(row, column) : getTreeSelectCellValue(column.editRender || column.cellRender, params)
|
|
@@ -782,6 +790,91 @@ function handleNumberCell (h: CreateElement, renderOpts: VxeGlobalRendererHandle
|
|
|
782
790
|
: {})
|
|
783
791
|
}
|
|
784
792
|
|
|
793
|
+
function handleFormatSelect (renderOpts: VxeGlobalRendererHandles.RenderTableDefaultOptions, params: VxeGlobalRendererHandles.TableCellFormatterParams | VxeGlobalRendererHandles.TableCellCopyMethodParams) {
|
|
794
|
+
const { cellValue } = params
|
|
795
|
+
return handleSelectCellValue(cellValue, renderOpts)
|
|
796
|
+
}
|
|
797
|
+
|
|
798
|
+
function handleSetSelectValue (renderOpts: VxeGlobalRendererHandles.RenderTableDefaultOptions, params: VxeGlobalRendererHandles.TableCellFormatterParams | VxeGlobalRendererHandles.TableCellCopyMethodParams) {
|
|
799
|
+
const { row, column, cellValue } = params
|
|
800
|
+
const { field } = column
|
|
801
|
+
if (field) {
|
|
802
|
+
const { options, optionGroups, optionProps = {}, optionGroupProps = {}, props } = renderOpts
|
|
803
|
+
if (isEmptyValue(cellValue)) {
|
|
804
|
+
XEUtils.set(row, field, props && props.multiple ? [] : null)
|
|
805
|
+
return
|
|
806
|
+
}
|
|
807
|
+
const isMultiVal = XEUtils.indexOf(`${cellValue}`, ',') > -1
|
|
808
|
+
const labelProp = optionProps.label || 'label'
|
|
809
|
+
const valueProp = optionProps.value || 'value'
|
|
810
|
+
const labelMpas: Record<string, any> = {}
|
|
811
|
+
if (optionGroups && optionGroups.length) {
|
|
812
|
+
const groupOptions = optionGroupProps.options || 'options'
|
|
813
|
+
for (let i = 0; i < optionGroups.length; i++) {
|
|
814
|
+
const opts = optionGroups[i][groupOptions] || {}
|
|
815
|
+
for (let j = 0; j < opts.length; j++) {
|
|
816
|
+
const item = opts[j]
|
|
817
|
+
if (isMultiVal) {
|
|
818
|
+
labelMpas[item[labelProp]] = item
|
|
819
|
+
/* eslint-disable eqeqeq */
|
|
820
|
+
} else if (item[labelProp] == cellValue) {
|
|
821
|
+
XEUtils.set(row, field, item[valueProp])
|
|
822
|
+
return
|
|
823
|
+
}
|
|
824
|
+
}
|
|
825
|
+
}
|
|
826
|
+
} else {
|
|
827
|
+
if (options) {
|
|
828
|
+
for (let i = 0; i < options.length; i++) {
|
|
829
|
+
const item = options[i]
|
|
830
|
+
if (isMultiVal) {
|
|
831
|
+
labelMpas[item[labelProp]] = item
|
|
832
|
+
/* eslint-disable eqeqeq */
|
|
833
|
+
} else if (item[labelProp] == cellValue) {
|
|
834
|
+
XEUtils.set(row, field, item[valueProp])
|
|
835
|
+
return
|
|
836
|
+
}
|
|
837
|
+
}
|
|
838
|
+
}
|
|
839
|
+
}
|
|
840
|
+
if (isMultiVal) {
|
|
841
|
+
XEUtils.set(row, field, (isMultiVal
|
|
842
|
+
? cellValue.split(',')
|
|
843
|
+
: [cellValue]).map((label: any) => {
|
|
844
|
+
const item = labelMpas[label]
|
|
845
|
+
return item ? item[valueProp] : label
|
|
846
|
+
}))
|
|
847
|
+
} else {
|
|
848
|
+
XEUtils.set(row, field, cellValue)
|
|
849
|
+
}
|
|
850
|
+
}
|
|
851
|
+
}
|
|
852
|
+
|
|
853
|
+
function handleFormatTreeSelect (renderOpts: VxeGlobalRendererHandles.RenderTableDefaultOptions, params: VxeGlobalRendererHandles.TableCellFormatterParams | VxeGlobalRendererHandles.TableCellCopyMethodParams) {
|
|
854
|
+
const { cellValue } = params
|
|
855
|
+
return handleTreeSelectCellValue(cellValue, renderOpts)
|
|
856
|
+
}
|
|
857
|
+
|
|
858
|
+
function handleSetTreeSelectValue (renderOpts: VxeGlobalRendererHandles.RenderTableDefaultOptions, params: VxeGlobalRendererHandles.TableCellFormatterParams | VxeGlobalRendererHandles.TableCellCopyMethodParams) {
|
|
859
|
+
const { row, column, cellValue } = params
|
|
860
|
+
const { field } = column
|
|
861
|
+
if (field) {
|
|
862
|
+
const { options, optionProps = {} } = renderOpts
|
|
863
|
+
const labelProp = optionProps.label || 'label'
|
|
864
|
+
const valueProp = optionProps.value || 'value'
|
|
865
|
+
const childrenProp = optionProps.children || 'children'
|
|
866
|
+
const matchRest = XEUtils.findTree(options || [], item => XEUtils.get(item, labelProp) === cellValue, { children: childrenProp })
|
|
867
|
+
if (matchRest) {
|
|
868
|
+
const selectItem = matchRest.item
|
|
869
|
+
if (selectItem) {
|
|
870
|
+
XEUtils.set(row, field, selectItem[valueProp])
|
|
871
|
+
return
|
|
872
|
+
}
|
|
873
|
+
}
|
|
874
|
+
XEUtils.set(row, field, cellValue)
|
|
875
|
+
}
|
|
876
|
+
}
|
|
877
|
+
|
|
785
878
|
/**
|
|
786
879
|
* 表格 - 渲染器
|
|
787
880
|
*/
|
|
@@ -815,6 +908,9 @@ renderer.mixin({
|
|
|
815
908
|
renderOpts.optionGroups ? renderNativeOptgroups(h, renderOpts, params, renderNativeOptions) : renderNativeOptions(h, renderOpts.options, renderOpts, params))
|
|
816
909
|
})
|
|
817
910
|
},
|
|
911
|
+
tableCellFormatter: handleFormatSelect,
|
|
912
|
+
tableCellCopyMethod: handleFormatSelect,
|
|
913
|
+
tableCellPasteMethod: handleSetSelectValue,
|
|
818
914
|
tableFilterDefaultMethod: handleFilterMethod,
|
|
819
915
|
tableExportMethod: handleExportSelectMethod
|
|
820
916
|
},
|
|
@@ -1049,6 +1145,9 @@ renderer.mixin({
|
|
|
1049
1145
|
on: getFloatingFilterOns(renderOpts, params, option)
|
|
1050
1146
|
})
|
|
1051
1147
|
},
|
|
1148
|
+
tableCellFormatter: handleFormatSelect,
|
|
1149
|
+
tableCellCopyMethod: handleFormatSelect,
|
|
1150
|
+
tableCellPasteMethod: handleSetSelectValue,
|
|
1052
1151
|
tableFilterDefaultMethod: handleFilterMethod,
|
|
1053
1152
|
tableExportMethod: handleExportSelectMethod
|
|
1054
1153
|
},
|
|
@@ -1099,6 +1198,9 @@ renderer.mixin({
|
|
|
1099
1198
|
renderTableDefault (h, renderOpts, params) {
|
|
1100
1199
|
return getCellLabelVNs(h, renderOpts, params, getSelectCellValue(renderOpts, params))
|
|
1101
1200
|
},
|
|
1201
|
+
tableCellFormatter: handleFormatSelect,
|
|
1202
|
+
tableCellCopyMethod: handleFormatSelect,
|
|
1203
|
+
tableCellPasteMethod: handleSetSelectValue,
|
|
1102
1204
|
tableFilterDefaultMethod: handleFilterMethod,
|
|
1103
1205
|
tableExportMethod: handleExportSelectMethod
|
|
1104
1206
|
},
|
|
@@ -1108,6 +1210,9 @@ renderer.mixin({
|
|
|
1108
1210
|
renderTableCell (h, renderOpts, params) {
|
|
1109
1211
|
return getCellLabelVNs(h, renderOpts, params, getTreeSelectCellValue(renderOpts, params))
|
|
1110
1212
|
},
|
|
1213
|
+
tableCellFormatter: handleFormatTreeSelect,
|
|
1214
|
+
tableCellCopyMethod: handleFormatTreeSelect,
|
|
1215
|
+
tableCellPasteMethod: handleSetTreeSelectValue,
|
|
1111
1216
|
tableExportMethod: handleExportTreeSelectMethod
|
|
1112
1217
|
},
|
|
1113
1218
|
VxeTableSelect: {
|
|
@@ -1116,6 +1221,9 @@ renderer.mixin({
|
|
|
1116
1221
|
renderTableCell (h, renderOpts, params) {
|
|
1117
1222
|
return getCellLabelVNs(h, renderOpts, params, getTreeSelectCellValue(renderOpts, params))
|
|
1118
1223
|
},
|
|
1224
|
+
tableCellFormatter: handleFormatTreeSelect,
|
|
1225
|
+
tableCellCopyMethod: handleFormatTreeSelect,
|
|
1226
|
+
tableCellPasteMethod: handleSetTreeSelectValue,
|
|
1119
1227
|
tableExportMethod: handleExportTreeSelectMethod
|
|
1120
1228
|
},
|
|
1121
1229
|
/**
|
|
@@ -1131,6 +1239,9 @@ renderer.mixin({
|
|
|
1131
1239
|
renderTableDefault (h, renderOpts, params) {
|
|
1132
1240
|
return getCellLabelVNs(h, renderOpts, params, getTreeSelectCellValue(renderOpts, params))
|
|
1133
1241
|
},
|
|
1242
|
+
tableCellFormatter: handleFormatTreeSelect,
|
|
1243
|
+
tableCellCopyMethod: handleFormatTreeSelect,
|
|
1244
|
+
tableCellPasteMethod: handleSetTreeSelectValue,
|
|
1134
1245
|
tableExportMethod: handleExportTreeSelectMethod
|
|
1135
1246
|
},
|
|
1136
1247
|
VxeColorPicker: {
|
|
@@ -385,8 +385,9 @@ export const Cell = {
|
|
|
385
385
|
const aggRow: VxeTableDefines.AggregateRowInfo = row
|
|
386
386
|
const { fullColumnFieldData } = tableInternalData
|
|
387
387
|
const aggregateOpts = $table.computeAggregateOpts
|
|
388
|
-
const { mode, showTotal, totalMethod, countFields, contentMethod, mapChildrenField } = aggregateOpts
|
|
389
|
-
const
|
|
388
|
+
const { mode, showTotal, totalMethod, countFields, contentMethod, formatValuesMethod, mapChildrenField } = aggregateOpts
|
|
389
|
+
const aggData = aggRow.aggData
|
|
390
|
+
const currAggData = aggData ? aggData[field] : null
|
|
390
391
|
const groupField = aggRow.groupField
|
|
391
392
|
const groupContent = aggRow.groupContent
|
|
392
393
|
const childList = mapChildrenField ? (aggRow[mapChildrenField] || []) : []
|
|
@@ -427,9 +428,10 @@ export const Cell = {
|
|
|
427
428
|
} else if ($table.getPivotTableAggregateCellAggValue) {
|
|
428
429
|
cellValue = $table.getPivotTableAggregateCellAggValue(params)
|
|
429
430
|
} else if (aggFunc === true || (countFields && countFields.includes(field))) {
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
431
|
+
cellValue = currAggData ? currAggData.value : childCount
|
|
432
|
+
ctParams.aggValue = cellValue
|
|
433
|
+
if (formatValuesMethod) {
|
|
434
|
+
cellValue = formatValuesMethod(ctParams)
|
|
433
435
|
}
|
|
434
436
|
}
|
|
435
437
|
} else {
|
|
@@ -480,7 +482,7 @@ export const Cell = {
|
|
|
480
482
|
const { rowGroupExpandedFlag } = tableReactData
|
|
481
483
|
const { rowGroupExpandedMaps } = tableInternalData
|
|
482
484
|
const aggregateOpts = $table.computeAggregateOpts
|
|
483
|
-
const { mode, padding, indent } = aggregateOpts
|
|
485
|
+
const { mode, padding, indent, showIcon, iconOpen, iconClose } = aggregateOpts
|
|
484
486
|
const rowid = getRowid($table, row)
|
|
485
487
|
const isExpand = !!rowGroupExpandedFlag && !!rowGroupExpandedMaps[rowid]
|
|
486
488
|
return h('div', {
|
|
@@ -493,7 +495,7 @@ export const Cell = {
|
|
|
493
495
|
}
|
|
494
496
|
: undefined
|
|
495
497
|
}, [
|
|
496
|
-
row.isAggregate
|
|
498
|
+
showIcon && row.isAggregate
|
|
497
499
|
? h('span', {
|
|
498
500
|
class: 'vxe-row-group--node-btn',
|
|
499
501
|
on: {
|
|
@@ -503,7 +505,7 @@ export const Cell = {
|
|
|
503
505
|
}
|
|
504
506
|
}, [
|
|
505
507
|
h('i', {
|
|
506
|
-
class: isExpand ? getIcon().TABLE_ROW_GROUP_OPEN : getIcon().TABLE_ROW_GROUP_CLOSE
|
|
508
|
+
class: isExpand ? (iconOpen || getIcon().TABLE_ROW_GROUP_OPEN) : (iconClose || getIcon().TABLE_ROW_GROUP_CLOSE)
|
|
507
509
|
})
|
|
508
510
|
])
|
|
509
511
|
: renderEmptyElement($table),
|