vxe-table 3.21.2 → 3.21.3
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/index.css +1 -1
- package/es/index.min.css +1 -1
- package/es/locale/lang/ar-EG.js +4 -0
- package/es/locale/lang/de-DE.js +4 -0
- package/es/locale/lang/en-US.js +4 -0
- package/es/locale/lang/es-ES.js +4 -0
- package/es/locale/lang/fr-FR.js +4 -0
- package/es/locale/lang/hu-HU.js +4 -0
- package/es/locale/lang/hy-AM.js +4 -0
- package/es/locale/lang/id-ID.js +4 -0
- package/es/locale/lang/it-IT.js +4 -0
- package/es/locale/lang/ja-JP.js +4 -0
- package/es/locale/lang/ko-KR.js +4 -0
- package/es/locale/lang/ms-MY.js +4 -0
- package/es/locale/lang/nb-NO.js +4 -0
- package/es/locale/lang/pt-BR.js +4 -0
- package/es/locale/lang/ru-RU.js +4 -0
- package/es/locale/lang/th-TH.js +4 -0
- package/es/locale/lang/ug-CN.js +4 -0
- package/es/locale/lang/uk-UA.js +4 -0
- package/es/locale/lang/uz-UZ.js +4 -0
- package/es/locale/lang/vi-VN.js +4 -0
- package/es/locale/lang/zh-CHT.js +4 -0
- package/es/locale/lang/zh-CN.js +4 -0
- package/es/style.css +1 -1
- package/es/style.min.css +1 -1
- package/es/table/module/custom/panel.js +28 -20
- package/es/table/module/export/export-panel.js +29 -16
- package/es/table/module/export/mixin.js +121 -26
- package/es/table/src/methods.js +82 -31
- package/es/table/src/table.js +16 -0
- package/es/table/src/util.js +3 -1
- package/es/table/style.css +1 -1
- package/es/table/style.min.css +1 -1
- package/es/ui/index.js +1 -1
- package/es/ui/src/log.js +1 -1
- package/es/vxe-table/style.css +1 -1
- package/es/vxe-table/style.min.css +1 -1
- package/lib/index.css +1 -1
- package/lib/index.min.css +1 -1
- package/lib/index.umd.js +221 -63
- package/lib/index.umd.min.js +1 -1
- package/lib/locale/lang/ar-EG.js +4 -0
- package/lib/locale/lang/ar-EG.min.js +1 -1
- package/lib/locale/lang/ar-EG.umd.js +4 -0
- package/lib/locale/lang/de-DE.js +4 -0
- package/lib/locale/lang/de-DE.min.js +1 -1
- package/lib/locale/lang/de-DE.umd.js +4 -0
- package/lib/locale/lang/en-US.js +4 -0
- package/lib/locale/lang/en-US.min.js +1 -1
- package/lib/locale/lang/en-US.umd.js +4 -0
- package/lib/locale/lang/es-ES.js +4 -0
- package/lib/locale/lang/es-ES.min.js +1 -1
- package/lib/locale/lang/es-ES.umd.js +4 -0
- package/lib/locale/lang/fr-FR.js +4 -0
- package/lib/locale/lang/fr-FR.min.js +1 -1
- package/lib/locale/lang/fr-FR.umd.js +4 -0
- package/lib/locale/lang/hu-HU.js +4 -0
- package/lib/locale/lang/hu-HU.min.js +1 -1
- package/lib/locale/lang/hu-HU.umd.js +4 -0
- package/lib/locale/lang/hy-AM.js +4 -0
- package/lib/locale/lang/hy-AM.min.js +1 -1
- package/lib/locale/lang/hy-AM.umd.js +4 -0
- package/lib/locale/lang/id-ID.js +4 -0
- package/lib/locale/lang/id-ID.min.js +1 -1
- package/lib/locale/lang/id-ID.umd.js +4 -0
- package/lib/locale/lang/it-IT.js +4 -0
- package/lib/locale/lang/it-IT.min.js +1 -1
- package/lib/locale/lang/it-IT.umd.js +4 -0
- package/lib/locale/lang/ja-JP.js +4 -0
- package/lib/locale/lang/ja-JP.min.js +1 -1
- package/lib/locale/lang/ja-JP.umd.js +4 -0
- package/lib/locale/lang/ko-KR.js +4 -0
- package/lib/locale/lang/ko-KR.min.js +1 -1
- package/lib/locale/lang/ko-KR.umd.js +4 -0
- package/lib/locale/lang/ms-MY.js +4 -0
- package/lib/locale/lang/ms-MY.min.js +1 -1
- package/lib/locale/lang/ms-MY.umd.js +4 -0
- package/lib/locale/lang/nb-NO.js +4 -0
- package/lib/locale/lang/nb-NO.min.js +1 -1
- package/lib/locale/lang/nb-NO.umd.js +4 -0
- package/lib/locale/lang/pt-BR.js +4 -0
- package/lib/locale/lang/pt-BR.min.js +1 -1
- package/lib/locale/lang/pt-BR.umd.js +4 -0
- package/lib/locale/lang/ru-RU.js +4 -0
- package/lib/locale/lang/ru-RU.min.js +1 -1
- package/lib/locale/lang/ru-RU.umd.js +4 -0
- package/lib/locale/lang/th-TH.js +4 -0
- package/lib/locale/lang/th-TH.min.js +1 -1
- package/lib/locale/lang/th-TH.umd.js +4 -0
- package/lib/locale/lang/ug-CN.js +4 -0
- package/lib/locale/lang/ug-CN.min.js +1 -1
- package/lib/locale/lang/ug-CN.umd.js +4 -0
- package/lib/locale/lang/uk-UA.js +4 -0
- package/lib/locale/lang/uk-UA.min.js +1 -1
- package/lib/locale/lang/uk-UA.umd.js +4 -0
- package/lib/locale/lang/uz-UZ.js +4 -0
- package/lib/locale/lang/uz-UZ.min.js +1 -1
- package/lib/locale/lang/uz-UZ.umd.js +4 -0
- package/lib/locale/lang/vi-VN.js +4 -0
- package/lib/locale/lang/vi-VN.min.js +1 -1
- package/lib/locale/lang/vi-VN.umd.js +4 -0
- package/lib/locale/lang/zh-CHT.js +4 -0
- package/lib/locale/lang/zh-CHT.min.js +1 -1
- package/lib/locale/lang/zh-CHT.umd.js +4 -0
- package/lib/locale/lang/zh-CN.js +4 -0
- package/lib/locale/lang/zh-CN.min.js +1 -1
- package/lib/locale/lang/zh-CN.umd.js +4 -0
- package/lib/style.css +1 -1
- package/lib/style.min.css +1 -1
- package/lib/table/module/custom/panel.js +29 -18
- package/lib/table/module/custom/panel.min.js +1 -1
- package/lib/table/module/export/export-panel.js +26 -13
- package/lib/table/module/export/export-panel.min.js +1 -1
- package/lib/table/module/export/mixin.js +139 -27
- package/lib/table/module/export/mixin.min.js +1 -1
- package/lib/table/src/methods.js +2 -2
- package/lib/table/src/methods.min.js +1 -1
- package/lib/table/src/table.js +16 -0
- package/lib/table/src/table.min.js +1 -1
- package/lib/table/src/util.js +3 -1
- package/lib/table/src/util.min.js +1 -1
- package/lib/table/style/style.css +1 -1
- package/lib/table/style/style.min.css +1 -1
- package/lib/ui/index.js +1 -1
- 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 +1 -1
- package/lib/vxe-table/style/style.min.css +1 -1
- package/package.json +2 -2
- package/packages/locale/lang/ar-EG.ts +4 -0
- package/packages/locale/lang/de-DE.ts +4 -0
- package/packages/locale/lang/en-US.ts +4 -0
- package/packages/locale/lang/es-ES.ts +4 -0
- package/packages/locale/lang/fr-FR.ts +4 -0
- package/packages/locale/lang/hu-HU.ts +4 -0
- package/packages/locale/lang/hy-AM.ts +4 -0
- package/packages/locale/lang/id-ID.ts +4 -0
- package/packages/locale/lang/it-IT.ts +4 -0
- package/packages/locale/lang/ja-JP.ts +4 -0
- package/packages/locale/lang/ko-KR.ts +4 -0
- package/packages/locale/lang/ms-MY.ts +4 -0
- package/packages/locale/lang/nb-NO.ts +4 -0
- package/packages/locale/lang/pt-BR.ts +4 -0
- package/packages/locale/lang/ru-RU.ts +4 -0
- package/packages/locale/lang/th-TH.ts +4 -0
- package/packages/locale/lang/ug-CN.ts +4 -0
- package/packages/locale/lang/uk-UA.ts +4 -0
- package/packages/locale/lang/uz-UZ.ts +4 -0
- package/packages/locale/lang/vi-VN.ts +4 -0
- package/packages/locale/lang/zh-CHT.ts +4 -0
- package/packages/locale/lang/zh-CN.ts +4 -0
- package/packages/table/module/custom/panel.ts +29 -21
- package/packages/table/module/export/export-panel.ts +29 -17
- package/packages/table/module/export/mixin.ts +122 -27
- package/packages/table/src/methods.ts +82 -31
- package/packages/table/src/table.ts +18 -0
- package/packages/table/src/util.ts +3 -1
- package/styles/components/table-module/export.scss +1 -1
- /package/es/{iconfont.1779778409753.ttf → iconfont.1779843521280.ttf} +0 -0
- /package/es/{iconfont.1779778409753.woff → iconfont.1779843521280.woff} +0 -0
- /package/es/{iconfont.1779778409753.woff2 → iconfont.1779843521280.woff2} +0 -0
- /package/lib/{iconfont.1779778409753.ttf → iconfont.1779843521280.ttf} +0 -0
- /package/lib/{iconfont.1779778409753.woff → iconfont.1779843521280.woff} +0 -0
- /package/lib/{iconfont.1779778409753.woff2 → iconfont.1779843521280.woff2} +0 -0
|
@@ -15,12 +15,6 @@ let htmlCellElem: any
|
|
|
15
15
|
const csvBOM = '\ufeff'
|
|
16
16
|
const enterSymbol = '\r\n'
|
|
17
17
|
|
|
18
|
-
function hasTreeChildren ($xeTable: VxeTableConstructor, row: any) {
|
|
19
|
-
const treeOpts = $xeTable.computeTreeOpts
|
|
20
|
-
const childrenField = treeOpts.children || treeOpts.childrenField
|
|
21
|
-
return row[childrenField] && row[childrenField].length
|
|
22
|
-
}
|
|
23
|
-
|
|
24
18
|
function getSeq ($xeTable: VxeTableConstructor, cellValue: any, row: any, $rowIndex: number, column: VxeTableDefines.ColumnInfo, $columnIndex: number) {
|
|
25
19
|
const seqOpts = $xeTable.computeSeqOpts
|
|
26
20
|
const seqMd = seqOpts.seqMethod || (column as any).seqMethod
|
|
@@ -64,33 +58,119 @@ const toStringValue = (cellValue: any) => {
|
|
|
64
58
|
|
|
65
59
|
function getBodyLabelData ($xeTable: VxeTableConstructor, opts: VxeTablePropTypes.ExportHandleOptions, columns: VxeTableDefines.ColumnInfo[], datas: any[]) {
|
|
66
60
|
const props = $xeTable
|
|
61
|
+
const reactData = $xeTable as unknown as TableReactData
|
|
67
62
|
|
|
68
|
-
const {
|
|
63
|
+
const { isTreeAllExpanded, isRowGroupAllExpanded, mode } = opts
|
|
69
64
|
const { treeConfig } = props
|
|
65
|
+
const { isRowGroupStatus } = reactData
|
|
70
66
|
const radioOpts = $xeTable.computeRadioOpts
|
|
71
67
|
const checkboxOpts = $xeTable.computeCheckboxOpts
|
|
72
68
|
const treeOpts = $xeTable.computeTreeOpts
|
|
73
69
|
const columnOpts = $xeTable.computeColumnOpts
|
|
70
|
+
const aggregateOpts = $xeTable.computeAggregateOpts
|
|
74
71
|
if (!htmlCellElem) {
|
|
75
72
|
htmlCellElem = document.createElement('div')
|
|
76
73
|
}
|
|
74
|
+
const { handleGetRowId } = createHandleGetRowId($xeTable)
|
|
75
|
+
if (isRowGroupStatus) {
|
|
76
|
+
// 如果是数据分组
|
|
77
|
+
// 如果是数据分组
|
|
78
|
+
const { mapChildrenField } = aggregateOpts
|
|
79
|
+
const rest: any[] = []
|
|
80
|
+
const expandMaps: Record<string, boolean> = {}
|
|
81
|
+
const useMaps: Record<string, boolean> = {}
|
|
82
|
+
XEUtils.eachTree(datas, (item, $rowIndex, items, path, parentItem, nodes) => {
|
|
83
|
+
const row = item._row || item
|
|
84
|
+
const rowid = handleGetRowId(row)
|
|
85
|
+
if (useMaps[rowid]) {
|
|
86
|
+
return
|
|
87
|
+
}
|
|
88
|
+
const parentRow = parentItem && parentItem._row ? parentItem._row : parentItem
|
|
89
|
+
const pRowid = parentRow ? handleGetRowId(parentRow) : ''
|
|
90
|
+
if ((isRowGroupAllExpanded || !parentRow || (expandMaps[pRowid] && $xeTable.isRowExpandByRow(parentRow)))) {
|
|
91
|
+
const hasRowChild = mapChildrenField && row[mapChildrenField] && row[mapChildrenField].length
|
|
92
|
+
const item: any = {
|
|
93
|
+
_row: row,
|
|
94
|
+
_level: nodes.length - 1,
|
|
95
|
+
_hasChild: hasRowChild,
|
|
96
|
+
_expand: hasRowChild && $xeTable.isRowExpandByRow(row)
|
|
97
|
+
}
|
|
98
|
+
columns.forEach((column, $columnIndex) => {
|
|
99
|
+
let cellValue: string | number | boolean | null = ''
|
|
100
|
+
const renderOpts = column.editRender || column.cellRender
|
|
101
|
+
let bodyExportMethod: VxeColumnPropTypes.ExportMethod | undefined = column.exportMethod || columnOpts.exportMethod
|
|
102
|
+
if (!bodyExportMethod && renderOpts && renderOpts.name) {
|
|
103
|
+
const compConf = renderer.get(renderOpts.name)
|
|
104
|
+
if (compConf) {
|
|
105
|
+
bodyExportMethod = compConf.tableExportMethod || compConf.exportMethod
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
if (!bodyExportMethod) {
|
|
109
|
+
bodyExportMethod = columnOpts.exportMethod
|
|
110
|
+
}
|
|
111
|
+
if (bodyExportMethod) {
|
|
112
|
+
cellValue = bodyExportMethod({ $table: $xeTable, row, column, options: opts })
|
|
113
|
+
} else {
|
|
114
|
+
switch (column.type) {
|
|
115
|
+
case 'seq': {
|
|
116
|
+
const seqVal = path.map((num, i) => i % 2 === 0 ? (Number(num) + 1) : '.').join('')
|
|
117
|
+
cellValue = mode === 'all' ? seqVal : getSeq($xeTable, seqVal, row, $rowIndex, column, $columnIndex)
|
|
118
|
+
break
|
|
119
|
+
}
|
|
120
|
+
case 'checkbox':
|
|
121
|
+
cellValue = toBooleanValue($xeTable.isCheckedByCheckboxRow(row))
|
|
122
|
+
item._checkboxLabel = checkboxOpts.labelField ? XEUtils.get(row, checkboxOpts.labelField) : ''
|
|
123
|
+
item._checkboxDisabled = checkboxOpts.checkMethod && !checkboxOpts.checkMethod({ $table: $xeTable, row })
|
|
124
|
+
break
|
|
125
|
+
case 'radio':
|
|
126
|
+
cellValue = toBooleanValue($xeTable.isCheckedByRadioRow(row))
|
|
127
|
+
item._radioLabel = radioOpts.labelField ? XEUtils.get(row, radioOpts.labelField) : ''
|
|
128
|
+
item._radioDisabled = radioOpts.checkMethod && !radioOpts.checkMethod({ $table: $xeTable, row })
|
|
129
|
+
break
|
|
130
|
+
default:
|
|
131
|
+
if (opts.original) {
|
|
132
|
+
cellValue = getCellValue(row, column)
|
|
133
|
+
} else {
|
|
134
|
+
cellValue = $xeTable.getCellLabel(row, column)
|
|
135
|
+
if (column.type === 'html') {
|
|
136
|
+
htmlCellElem.innerHTML = cellValue
|
|
137
|
+
cellValue = htmlCellElem.innerText.trim()
|
|
138
|
+
} else {
|
|
139
|
+
const cell = $xeTable.getCellElement(row, column)
|
|
140
|
+
if (cell && !hasClass(cell, 'is--progress')) {
|
|
141
|
+
cellValue = cell.innerText.trim()
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
item[column.id] = toStringValue(cellValue)
|
|
148
|
+
})
|
|
149
|
+
useMaps[rowid] = true
|
|
150
|
+
if (pRowid) {
|
|
151
|
+
expandMaps[pRowid] = true
|
|
152
|
+
}
|
|
153
|
+
rest.push(Object.assign(item, row))
|
|
154
|
+
}
|
|
155
|
+
}, { children: mapChildrenField })
|
|
156
|
+
return rest
|
|
157
|
+
}
|
|
77
158
|
if (treeConfig) {
|
|
78
159
|
const childrenField = treeOpts.children || treeOpts.childrenField
|
|
79
|
-
//
|
|
160
|
+
// 如果是树结构
|
|
80
161
|
const rest: any[] = []
|
|
81
162
|
const expandMaps: Record<string, boolean> = {}
|
|
82
163
|
const useMaps: Record<string, boolean> = {}
|
|
83
|
-
|
|
84
|
-
XEUtils.eachTree(datas, (item, $rowIndex, items, path, parent, nodes) => {
|
|
164
|
+
XEUtils.eachTree(datas, (item, $rowIndex, items, path, parentItem, nodes) => {
|
|
85
165
|
const row = item._row || item
|
|
86
166
|
const rowid = handleGetRowId(row)
|
|
87
167
|
if (useMaps[rowid]) {
|
|
88
168
|
return
|
|
89
169
|
}
|
|
90
|
-
const parentRow =
|
|
170
|
+
const parentRow = parentItem && parentItem._row ? parentItem._row : parentItem
|
|
91
171
|
const pRowid = parentRow ? handleGetRowId(parentRow) : ''
|
|
92
|
-
if ((
|
|
93
|
-
const hasRowChild =
|
|
172
|
+
if ((isTreeAllExpanded || !parentRow || (expandMaps[pRowid] && $xeTable.isTreeExpandByRow(parentRow)))) {
|
|
173
|
+
const hasRowChild = row[childrenField] && row[childrenField].length
|
|
94
174
|
const item: any = {
|
|
95
175
|
_row: row,
|
|
96
176
|
_level: nodes.length - 1,
|
|
@@ -1005,10 +1085,11 @@ function handleExportAndPrint ($xeTable: VxeTableConstructor, options: VxeTableP
|
|
|
1005
1085
|
const $xeGGWrapper = $xeGrid || $xeGantt
|
|
1006
1086
|
|
|
1007
1087
|
const { treeConfig, showHeader, showFooter } = props
|
|
1008
|
-
const { initStore, isGroup, footerTableData, exportStore, exportParams } = reactData
|
|
1088
|
+
const { initStore, isGroup, rowGroupList, footerTableData, exportStore, exportParams } = reactData
|
|
1009
1089
|
const { collectColumn, mergeBodyList, mergeFooterList } = internalData
|
|
1010
1090
|
const exportOpts = $xeTable.computeExportOpts
|
|
1011
|
-
const hasTree = treeConfig
|
|
1091
|
+
const hasTree = !!treeConfig
|
|
1092
|
+
const hasRowGroup = rowGroupList.length > 0
|
|
1012
1093
|
const customOpts = $xeTable.computeCustomOpts
|
|
1013
1094
|
const selectRecords = $xeTable.getCheckboxRecords()
|
|
1014
1095
|
const proxyOpts = $xeGGWrapper ? $xeGGWrapper.computeProxyOpts : {}
|
|
@@ -1025,6 +1106,13 @@ function handleExportAndPrint ($xeTable: VxeTableConstructor, options: VxeTableP
|
|
|
1025
1106
|
current: 'current',
|
|
1026
1107
|
modes: (proxyOpts.ajax && proxyOpts.ajax.queryAll ? ['all'] : []).concat(['current', 'selected', 'empty'])
|
|
1027
1108
|
}, options)
|
|
1109
|
+
|
|
1110
|
+
// 已废弃,参数 isAllExpand
|
|
1111
|
+
if (XEUtils.isBoolean((defOpts as any).isAllExpand)) {
|
|
1112
|
+
warnLog('vxe.error.delProp', ['isAllExpand', 'isTreeAllExpanded'])
|
|
1113
|
+
defOpts.isTreeAllExpanded = (defOpts as any).isAllExpand
|
|
1114
|
+
}
|
|
1115
|
+
|
|
1028
1116
|
const types = defOpts.types || XEUtils.keys(exportOpts._typeMaps)
|
|
1029
1117
|
const modes = defOpts.modes || []
|
|
1030
1118
|
const checkMethod = customOpts.checkMethod
|
|
@@ -1065,17 +1153,16 @@ function handleExportAndPrint ($xeTable: VxeTableConstructor, options: VxeTableP
|
|
|
1065
1153
|
column.disabled = (parent && parent.disabled) || (checkMethod ? !checkMethod({ $table: $xeTable, column }) : false)
|
|
1066
1154
|
})
|
|
1067
1155
|
// 更新条件
|
|
1068
|
-
|
|
1069
|
-
|
|
1070
|
-
|
|
1071
|
-
|
|
1072
|
-
|
|
1073
|
-
|
|
1074
|
-
|
|
1075
|
-
|
|
1076
|
-
|
|
1077
|
-
|
|
1078
|
-
})
|
|
1156
|
+
exportStore.columns = exportColumns
|
|
1157
|
+
exportStore.typeList = typeList
|
|
1158
|
+
exportStore.modeList = modeList
|
|
1159
|
+
exportStore.hasFooter = hasFooter
|
|
1160
|
+
exportStore.hasMerge = hasMerge
|
|
1161
|
+
exportStore.hasTree = hasTree
|
|
1162
|
+
exportStore.hasRowGroup = hasRowGroup
|
|
1163
|
+
exportStore.isPrint = !!isPrint
|
|
1164
|
+
exportStore.hasColgroup = isGroup
|
|
1165
|
+
exportStore.visible = true
|
|
1079
1166
|
// 默认参数
|
|
1080
1167
|
Object.assign(exportParams, {
|
|
1081
1168
|
mode: selectRecords.length ? 'selected' : 'current'
|
|
@@ -1212,7 +1299,8 @@ export default {
|
|
|
1212
1299
|
// filename: '',
|
|
1213
1300
|
// sheetName: '',
|
|
1214
1301
|
// original: false,
|
|
1215
|
-
//
|
|
1302
|
+
// isTreeAllExpanded: false,
|
|
1303
|
+
// isRowGroupAllExpanded: false,
|
|
1216
1304
|
// data: null,
|
|
1217
1305
|
// remote: false,
|
|
1218
1306
|
// dataFilterMethod: null,
|
|
@@ -1222,6 +1310,13 @@ export default {
|
|
|
1222
1310
|
// beforeExportMethod: null,
|
|
1223
1311
|
// afterExportMethod: null
|
|
1224
1312
|
}, exportOpts, options)
|
|
1313
|
+
|
|
1314
|
+
// 已废弃,参数 isAllExpand
|
|
1315
|
+
if (XEUtils.isBoolean((opts as any).isAllExpand)) {
|
|
1316
|
+
warnLog('vxe.error.delProp', ['isAllExpand', 'isTreeAllExpanded'])
|
|
1317
|
+
opts.isTreeAllExpanded = (opts as any).isAllExpand
|
|
1318
|
+
}
|
|
1319
|
+
|
|
1225
1320
|
let { filename, sheetName, type, mode, columns, original, columnFilterMethod, beforeExportMethod, includeFields, excludeFields } = opts
|
|
1226
1321
|
let groups: any[] = []
|
|
1227
1322
|
const selectRecords = $xeTable.getCheckboxRecords()
|
|
@@ -3327,12 +3327,12 @@ function updateGroupData ($xeTable: VxeTableConstructor & VxeTablePrivateMethods
|
|
|
3327
3327
|
}
|
|
3328
3328
|
}
|
|
3329
3329
|
|
|
3330
|
-
function handleGroupData ($xeTable: VxeTableConstructor & VxeTablePrivateMethods, list: any[], rowGroups: VxeTableDefines.RowGroupItem[]) {
|
|
3330
|
+
function handleGroupData ($xeTable: VxeTableConstructor & VxeTablePrivateMethods, list: any[], rowGroups: VxeTableDefines.RowGroupItem[], isCombinedField?: boolean) {
|
|
3331
3331
|
let fullData = list
|
|
3332
3332
|
let treeData = list
|
|
3333
3333
|
if (rowGroups) {
|
|
3334
3334
|
const aggregateOpts = $xeTable.computeAggregateOpts
|
|
3335
|
-
const { rowField, parentField, childrenField, mapChildrenField } = aggregateOpts
|
|
3335
|
+
const { rowField, parentField, separator, childrenField, mapChildrenField } = aggregateOpts
|
|
3336
3336
|
const rowOpts = $xeTable.computeRowOpts
|
|
3337
3337
|
const checkboxOpts = $xeTable.computeCheckboxOpts
|
|
3338
3338
|
const { checkField } = checkboxOpts
|
|
@@ -3344,11 +3344,26 @@ function handleGroupData ($xeTable: VxeTableConstructor & VxeTablePrivateMethods
|
|
|
3344
3344
|
const groupField = rgItem.field
|
|
3345
3345
|
const groupColumn = $xeTable.getColumnByField(groupField)
|
|
3346
3346
|
const groupMaps: Record<string, any[]> = {}
|
|
3347
|
+
const groupCombinedMaps: Record<string, any[]> = {}
|
|
3347
3348
|
const aggList: VxeTableDefines.AggregateRowInfo[] = []
|
|
3348
3349
|
const rowkey = getRowkey($xeTable)
|
|
3349
3350
|
list.forEach((row) => {
|
|
3350
3351
|
const cellValue = groupColumn ? $xeTable.getCellLabel(row, groupColumn) : XEUtils.get(row, groupField)
|
|
3351
|
-
|
|
3352
|
+
let groupValue = XEUtils.eqNull(cellValue) ? '' : cellValue
|
|
3353
|
+
if (isCombinedField) {
|
|
3354
|
+
const groupVals = [groupValue]
|
|
3355
|
+
rowGroups.slice(1).forEach(ogItem => {
|
|
3356
|
+
const ogField = ogItem.field
|
|
3357
|
+
const ogColumn = $xeTable.getColumnByField(ogField)
|
|
3358
|
+
const ocValue = ogColumn ? $xeTable.getCellLabel(row, ogColumn) : XEUtils.get(row, ogField)
|
|
3359
|
+
const ogValue = XEUtils.eqNull(ocValue) ? '' : ocValue
|
|
3360
|
+
groupValue += (separator || ' / ') + ogValue
|
|
3361
|
+
groupVals.push(ogValue)
|
|
3362
|
+
})
|
|
3363
|
+
if (!groupCombinedMaps[groupValue]) {
|
|
3364
|
+
groupCombinedMaps[groupValue] = groupVals
|
|
3365
|
+
}
|
|
3366
|
+
}
|
|
3352
3367
|
let childList = groupMaps[groupValue]
|
|
3353
3368
|
if (!childList) {
|
|
3354
3369
|
childList = []
|
|
@@ -3359,33 +3374,61 @@ function handleGroupData ($xeTable: VxeTableConstructor & VxeTablePrivateMethods
|
|
|
3359
3374
|
}
|
|
3360
3375
|
childList.push(row)
|
|
3361
3376
|
})
|
|
3362
|
-
|
|
3363
|
-
|
|
3364
|
-
|
|
3365
|
-
|
|
3366
|
-
|
|
3367
|
-
|
|
3368
|
-
|
|
3369
|
-
|
|
3370
|
-
|
|
3371
|
-
|
|
3372
|
-
|
|
3373
|
-
|
|
3374
|
-
|
|
3375
|
-
|
|
3376
|
-
|
|
3377
|
-
|
|
3378
|
-
|
|
3379
|
-
|
|
3380
|
-
|
|
3381
|
-
|
|
3382
|
-
|
|
3383
|
-
|
|
3384
|
-
|
|
3385
|
-
|
|
3386
|
-
|
|
3387
|
-
|
|
3388
|
-
|
|
3377
|
+
if (isCombinedField) {
|
|
3378
|
+
XEUtils.objectEach(groupMaps, (childList, groupValue) => {
|
|
3379
|
+
const aggRow: VxeTableDefines.AggregateRowInfo = {
|
|
3380
|
+
isAggregate: true,
|
|
3381
|
+
aggData: {},
|
|
3382
|
+
groupContent: groupValue,
|
|
3383
|
+
groupCombineds: groupCombinedMaps[groupValue],
|
|
3384
|
+
groupField,
|
|
3385
|
+
childCount: 0,
|
|
3386
|
+
[rowField]: getRowUniqueId(),
|
|
3387
|
+
[parentField]: null,
|
|
3388
|
+
[childrenField]: childList,
|
|
3389
|
+
[mapChildrenField]: childList
|
|
3390
|
+
}
|
|
3391
|
+
aggRow[rowkey] = createRowId(rowOpts, aggRow, rowkey)
|
|
3392
|
+
if (checkField) {
|
|
3393
|
+
aggRow[checkField] = false
|
|
3394
|
+
}
|
|
3395
|
+
if (indeterminateField) {
|
|
3396
|
+
aggRow[indeterminateField] = false
|
|
3397
|
+
}
|
|
3398
|
+
aggList.push(aggRow)
|
|
3399
|
+
treeData.push(aggRow)
|
|
3400
|
+
fullData.push(aggRow)
|
|
3401
|
+
})
|
|
3402
|
+
} else {
|
|
3403
|
+
XEUtils.objectEach(groupMaps, (childList, groupValue) => {
|
|
3404
|
+
const { fullData: childFullData, treeData: childTreeData } = handleGroupData($xeTable, childList, rowGroups.slice(1))
|
|
3405
|
+
const aggRow: VxeTableDefines.AggregateRowInfo = {
|
|
3406
|
+
isAggregate: true,
|
|
3407
|
+
aggData: {},
|
|
3408
|
+
groupContent: groupValue,
|
|
3409
|
+
groupCombineds: [],
|
|
3410
|
+
groupField,
|
|
3411
|
+
childCount: 0,
|
|
3412
|
+
[rowField]: getRowUniqueId(),
|
|
3413
|
+
[parentField]: null,
|
|
3414
|
+
[childrenField]: childTreeData,
|
|
3415
|
+
[mapChildrenField]: childTreeData
|
|
3416
|
+
}
|
|
3417
|
+
aggRow[rowkey] = createRowId(rowOpts, aggRow, rowkey)
|
|
3418
|
+
if (checkField) {
|
|
3419
|
+
aggRow[checkField] = false
|
|
3420
|
+
}
|
|
3421
|
+
if (indeterminateField) {
|
|
3422
|
+
aggRow[indeterminateField] = false
|
|
3423
|
+
}
|
|
3424
|
+
aggList.push(aggRow)
|
|
3425
|
+
treeData.push(aggRow)
|
|
3426
|
+
fullData.push(aggRow)
|
|
3427
|
+
if (childFullData.length) {
|
|
3428
|
+
fullData.push(...childFullData)
|
|
3429
|
+
}
|
|
3430
|
+
})
|
|
3431
|
+
}
|
|
3389
3432
|
handleeGroupSummary($xeTable, aggList)
|
|
3390
3433
|
}
|
|
3391
3434
|
}
|
|
@@ -3395,6 +3438,14 @@ function handleGroupData ($xeTable: VxeTableConstructor & VxeTablePrivateMethods
|
|
|
3395
3438
|
}
|
|
3396
3439
|
}
|
|
3397
3440
|
|
|
3441
|
+
function initGroupData ($xeTable: VxeTableConstructor & VxeTablePrivateMethods, list: any[], rowGroups: VxeTableDefines.RowGroupItem[]) {
|
|
3442
|
+
const aggregateOpts = $xeTable.computeAggregateOpts
|
|
3443
|
+
const { mode } = aggregateOpts
|
|
3444
|
+
const isCombinedField = mode === 'combined'
|
|
3445
|
+
const groupRest = handleGroupData($xeTable, list, rowGroups, isCombinedField)
|
|
3446
|
+
return groupRest
|
|
3447
|
+
}
|
|
3448
|
+
|
|
3398
3449
|
/**
|
|
3399
3450
|
* 加载表格数据
|
|
3400
3451
|
* @param {Array} datas 数据
|
|
@@ -3460,7 +3511,7 @@ function loadTableData ($xeTable: VxeTableConstructor & VxeTablePrivateMethods,
|
|
|
3460
3511
|
treeData = fullData.slice(0)
|
|
3461
3512
|
}
|
|
3462
3513
|
} else if ((aggregateConfig || rowGroupConfig) && rowGroupList.length) {
|
|
3463
|
-
const groupRest =
|
|
3514
|
+
const groupRest = initGroupData($xeTable, fullData, rowGroupList)
|
|
3464
3515
|
treeData = groupRest.treeData
|
|
3465
3516
|
fullData = groupRest.fullData
|
|
3466
3517
|
isRGroup = true
|
|
@@ -828,6 +828,12 @@ export default {
|
|
|
828
828
|
|
|
829
829
|
return Object.assign({}, getConfig().table.aggregateConfig || getConfig().table.rowGroupConfig, props.aggregateConfig || props.rowGroupConfig)
|
|
830
830
|
},
|
|
831
|
+
computeAggregateMode () {
|
|
832
|
+
const $xeTable = this as VxeTableConstructor & VxeTablePrivateMethods
|
|
833
|
+
|
|
834
|
+
const aggregateOpts = $xeTable.computeAggregateOpts
|
|
835
|
+
return aggregateOpts.mode
|
|
836
|
+
},
|
|
831
837
|
computeAggregateAccuracyOpts () {
|
|
832
838
|
const $xeTable = this as VxeTableConstructor & VxeTablePrivateMethods
|
|
833
839
|
const props = $xeTable
|
|
@@ -1651,6 +1657,15 @@ export default {
|
|
|
1651
1657
|
$xeTable.reloadData(tableFullData)
|
|
1652
1658
|
})
|
|
1653
1659
|
}
|
|
1660
|
+
},
|
|
1661
|
+
computeAggregateMode () {
|
|
1662
|
+
const $xeTable = this as VxeTableConstructor & VxeTablePrivateMethods
|
|
1663
|
+
const reactData = $xeTable as unknown as TableReactData
|
|
1664
|
+
const internalData = $xeTable as unknown as TableInternalData
|
|
1665
|
+
|
|
1666
|
+
if (reactData.isRowGroupStatus) {
|
|
1667
|
+
this.loadTableData(internalData.tableSynchData, false, true)
|
|
1668
|
+
}
|
|
1654
1669
|
}
|
|
1655
1670
|
} as any,
|
|
1656
1671
|
created () {
|
|
@@ -1768,6 +1783,9 @@ export default {
|
|
|
1768
1783
|
if (exportConfig && exportOpts.types && !exportOpts.exportMethod && !XEUtils.includeArrays(XEUtils.keys(exportOpts._typeMaps), exportOpts.types)) {
|
|
1769
1784
|
warnLog('vxe.error.errProp', [`export-config.types=${exportOpts.types.join(',')}`, exportOpts.types.filter((type) => XEUtils.includes(XEUtils.keys(exportOpts._typeMaps), type)).join(',') || XEUtils.keys(exportOpts._typeMaps).join(',')])
|
|
1770
1785
|
}
|
|
1786
|
+
if (exportConfig && XEUtils.isBoolean((exportOpts as any).isAllExpand)) {
|
|
1787
|
+
warnLog('vxe.error.delProp', ['isAllExpand', 'isTreeAllExpanded'])
|
|
1788
|
+
}
|
|
1771
1789
|
|
|
1772
1790
|
if (!props.id) {
|
|
1773
1791
|
if ((props.customConfig ? isEnableConf(customOpts) : customOpts.enabled) && customOpts.storage) {
|
|
@@ -340,6 +340,7 @@ export function createReactData (): TableReactData {
|
|
|
340
340
|
hasFooter: false,
|
|
341
341
|
hasMerge: false,
|
|
342
342
|
hasTree: false,
|
|
343
|
+
hasRowGroup: false,
|
|
343
344
|
hasColgroup: false,
|
|
344
345
|
visible: false
|
|
345
346
|
},
|
|
@@ -350,7 +351,8 @@ export function createReactData (): TableReactData {
|
|
|
350
351
|
type: '',
|
|
351
352
|
isColgroup: false,
|
|
352
353
|
isMerge: false,
|
|
353
|
-
|
|
354
|
+
isTreeAllExpanded: false,
|
|
355
|
+
isRowGroupAllExpanded: false,
|
|
354
356
|
useStyle: false,
|
|
355
357
|
original: false,
|
|
356
358
|
message: true,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|