vxe-table 4.10.6-beta.8 → 4.10.6
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 +1 -1
- package/es/index.css +1 -1
- package/es/index.min.css +1 -1
- package/es/locale/lang/ar-EG.js +2 -1
- package/es/locale/lang/de-DE.js +2 -1
- package/es/locale/lang/en-US.js +4 -3
- package/es/locale/lang/es-ES.js +2 -1
- package/es/locale/lang/fr-FR.js +2 -1
- package/es/locale/lang/hu-HU.js +2 -1
- package/es/locale/lang/hy-AM.js +2 -1
- package/es/locale/lang/it-IT.js +2 -1
- package/es/locale/lang/ja-JP.js +2 -1
- package/es/locale/lang/ko-KR.js +2 -1
- package/es/locale/lang/nb-NO.js +2 -1
- package/es/locale/lang/pt-BR.js +2 -1
- package/es/locale/lang/ru-RU.js +4 -3
- package/es/locale/lang/th-TH.js +2 -1
- package/es/locale/lang/ug-CN.js +2 -1
- package/es/locale/lang/uk-UA.js +518 -517
- package/es/locale/lang/vi-VN.js +2 -1
- package/es/locale/lang/zh-CHT.js +2 -1
- package/es/locale/lang/zh-CN.js +2 -1
- package/es/style.css +1 -1
- package/es/style.min.css +1 -1
- package/es/table/module/edit/hook.js +7 -7
- package/es/table/module/export/hook.js +97 -62
- package/es/table/module/keyboard/hook.js +63 -27
- package/es/table/src/body.js +128 -81
- package/es/table/src/cell.js +41 -55
- package/es/table/src/column.js +13 -1
- package/es/table/src/columnInfo.js +3 -0
- package/es/table/src/emits.js +2 -0
- package/es/table/src/footer.js +48 -10
- package/es/table/src/header.js +70 -168
- package/es/table/src/props.js +14 -4
- package/es/table/src/table.js +884 -426
- package/es/table/src/util.js +77 -62
- package/es/table/style.css +253 -189
- package/es/table/style.min.css +1 -1
- package/es/ui/index.js +26 -11
- package/es/ui/src/log.js +1 -1
- package/es/vxe-table/style.css +253 -189
- package/es/vxe-table/style.min.css +1 -1
- package/lib/grid/src/grid.js +1 -1
- 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 +1533 -917
- package/lib/index.umd.min.js +1 -1
- package/lib/locale/lang/ar-EG.js +2 -1
- package/lib/locale/lang/ar-EG.min.js +1 -1
- package/lib/locale/lang/de-DE.js +2 -1
- package/lib/locale/lang/de-DE.min.js +1 -1
- package/lib/locale/lang/en-US.js +4 -3
- package/lib/locale/lang/en-US.min.js +1 -1
- package/lib/locale/lang/en-US.umd.js +4 -3
- package/lib/locale/lang/es-ES.js +2 -1
- package/lib/locale/lang/es-ES.min.js +1 -1
- package/lib/locale/lang/es-ES.umd.js +2 -1
- package/lib/locale/lang/fr-FR.js +2 -1
- package/lib/locale/lang/fr-FR.min.js +1 -1
- package/lib/locale/lang/hu-HU.js +2 -1
- package/lib/locale/lang/hu-HU.min.js +1 -1
- package/lib/locale/lang/hu-HU.umd.js +2 -1
- package/lib/locale/lang/hy-AM.js +2 -1
- package/lib/locale/lang/hy-AM.min.js +1 -1
- package/lib/locale/lang/it-IT.js +2 -1
- package/lib/locale/lang/it-IT.min.js +1 -1
- package/lib/locale/lang/ja-JP.js +2 -1
- package/lib/locale/lang/ja-JP.min.js +1 -1
- package/lib/locale/lang/ja-JP.umd.js +2 -1
- package/lib/locale/lang/ko-KR.js +2 -1
- package/lib/locale/lang/ko-KR.min.js +1 -1
- package/lib/locale/lang/ko-KR.umd.js +2 -1
- package/lib/locale/lang/nb-NO.js +2 -1
- package/lib/locale/lang/nb-NO.min.js +1 -1
- package/lib/locale/lang/pt-BR.js +2 -1
- package/lib/locale/lang/pt-BR.min.js +1 -1
- package/lib/locale/lang/pt-BR.umd.js +2 -1
- package/lib/locale/lang/ru-RU.js +4 -3
- package/lib/locale/lang/ru-RU.min.js +1 -1
- package/lib/locale/lang/ru-RU.umd.js +4 -3
- package/lib/locale/lang/th-TH.js +2 -1
- package/lib/locale/lang/th-TH.min.js +1 -1
- package/lib/locale/lang/ug-CN.js +2 -1
- package/lib/locale/lang/ug-CN.min.js +1 -1
- package/lib/locale/lang/uk-UA.js +518 -517
- package/lib/locale/lang/uk-UA.min.js +1 -1
- package/lib/locale/lang/uk-UA.umd.js +518 -517
- package/lib/locale/lang/vi-VN.js +2 -1
- package/lib/locale/lang/vi-VN.min.js +1 -1
- package/lib/locale/lang/zh-CHT.js +2 -1
- package/lib/locale/lang/zh-CHT.min.js +1 -1
- package/lib/locale/lang/zh-CN.js +2 -1
- package/lib/locale/lang/zh-CN.min.js +1 -1
- package/lib/locale/lang/zh-CN.umd.js +2 -1
- package/lib/style.css +1 -1
- package/lib/style.min.css +1 -1
- package/lib/table/module/edit/hook.js +7 -2
- package/lib/table/module/edit/hook.min.js +1 -1
- package/lib/table/module/export/hook.js +97 -57
- package/lib/table/module/export/hook.min.js +1 -1
- package/lib/table/module/keyboard/hook.js +71 -28
- package/lib/table/module/keyboard/hook.min.js +1 -1
- package/lib/table/src/body.js +129 -80
- package/lib/table/src/body.min.js +1 -1
- package/lib/table/src/cell.js +32 -42
- package/lib/table/src/cell.min.js +1 -1
- package/lib/table/src/column.js +13 -1
- package/lib/table/src/column.min.js +1 -1
- package/lib/table/src/columnInfo.js +3 -0
- package/lib/table/src/columnInfo.min.js +1 -1
- package/lib/table/src/emits.js +1 -1
- package/lib/table/src/emits.min.js +1 -1
- package/lib/table/src/footer.js +48 -8
- package/lib/table/src/footer.min.js +1 -1
- package/lib/table/src/header.js +54 -181
- package/lib/table/src/header.min.js +1 -1
- package/lib/table/src/props.js +14 -4
- package/lib/table/src/props.min.js +1 -1
- package/lib/table/src/table.js +935 -417
- package/lib/table/src/table.min.js +1 -1
- package/lib/table/src/util.js +100 -82
- package/lib/table/src/util.min.js +1 -1
- package/lib/table/style/style.css +253 -189
- package/lib/table/style/style.min.css +1 -1
- package/lib/ui/index.js +26 -11
- 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 +253 -189
- package/lib/vxe-table/style/style.min.css +1 -1
- package/package.json +2 -2
- package/packages/grid/src/grid.ts +1 -1
- package/packages/locale/lang/ar-EG.ts +2 -1
- package/packages/locale/lang/de-DE.ts +2 -1
- package/packages/locale/lang/en-US.ts +4 -3
- package/packages/locale/lang/es-ES.ts +2 -1
- package/packages/locale/lang/fr-FR.ts +2 -1
- package/packages/locale/lang/hu-HU.ts +2 -1
- package/packages/locale/lang/hy-AM.ts +2 -1
- package/packages/locale/lang/it-IT.ts +2 -1
- package/packages/locale/lang/ja-JP.ts +2 -1
- package/packages/locale/lang/ko-KR.ts +2 -1
- package/packages/locale/lang/nb-NO.ts +2 -1
- package/packages/locale/lang/pt-BR.ts +2 -1
- package/packages/locale/lang/ru-RU.ts +4 -3
- package/packages/locale/lang/th-TH.ts +2 -1
- package/packages/locale/lang/ug-CN.ts +2 -1
- package/packages/locale/lang/uk-UA.ts +518 -517
- package/packages/locale/lang/vi-VN.ts +2 -1
- package/packages/locale/lang/zh-CHT.ts +2 -1
- package/packages/locale/lang/zh-CN.ts +2 -1
- package/packages/table/module/edit/hook.ts +7 -7
- package/packages/table/module/export/hook.ts +118 -65
- package/packages/table/module/keyboard/hook.ts +59 -25
- package/packages/table/src/body.ts +148 -91
- package/packages/table/src/cell.ts +41 -63
- package/packages/table/src/column.ts +13 -1
- package/packages/table/src/columnInfo.ts +3 -0
- package/packages/table/src/emits.ts +5 -1
- package/packages/table/src/footer.ts +51 -11
- package/packages/table/src/header.ts +70 -168
- package/packages/table/src/props.ts +14 -5
- package/packages/table/src/table.ts +890 -428
- package/packages/table/src/util.ts +81 -62
- package/packages/ui/index.ts +25 -10
- package/styles/components/table.scss +319 -271
- package/styles/theme/base.scss +4 -6
- package/styles/theme/dark.scss +1 -0
- package/styles/theme/light.scss +1 -0
- package/styles/variable.scss +1 -1
- /package/es/{iconfont.1736840923205.ttf → iconfont.1738985856004.ttf} +0 -0
- /package/es/{iconfont.1736840923205.woff → iconfont.1738985856004.woff} +0 -0
- /package/es/{iconfont.1736840923205.woff2 → iconfont.1738985856004.woff2} +0 -0
- /package/lib/{iconfont.1736840923205.ttf → iconfont.1738985856004.ttf} +0 -0
- /package/lib/{iconfont.1736840923205.woff → iconfont.1738985856004.woff} +0 -0
- /package/lib/{iconfont.1736840923205.woff2 → iconfont.1738985856004.woff2} +0 -0
|
@@ -86,7 +86,7 @@ hooks.add('tableEditModule', {
|
|
|
86
86
|
}
|
|
87
87
|
parentChilds[funcName](item)
|
|
88
88
|
mapChilds[funcName](item)
|
|
89
|
-
const rest = { row: item, rowid, seq: -1, index: -1, _index: -1, $index: -1, treeIndex: -1, items: parentChilds, parent: parentRow, level: parentLevel + 1, height: 0, oTop: 0 }
|
|
89
|
+
const rest = { row: item, rowid, seq: -1, index: -1, _index: -1, $index: -1, treeIndex: -1, items: parentChilds, parent: parentRow, level: parentLevel + 1, height: 0, resizeHeight: 0, oTop: 0 }
|
|
90
90
|
fullDataRowIdData[rowid] = rest
|
|
91
91
|
fullAllDataRowIdData[rowid] = rest
|
|
92
92
|
} else {
|
|
@@ -97,7 +97,7 @@ hooks.add('tableEditModule', {
|
|
|
97
97
|
}
|
|
98
98
|
afterFullData[funcName](item)
|
|
99
99
|
tableFullTreeData[funcName](item)
|
|
100
|
-
const rest = { row: item, rowid, seq: -1, index: -1, _index: -1, $index: -1, treeIndex: -1, items: tableFullTreeData, parent: null, level: 0, height: 0, oTop: 0 }
|
|
100
|
+
const rest = { row: item, rowid, seq: -1, index: -1, _index: -1, $index: -1, treeIndex: -1, items: tableFullTreeData, parent: null, level: 0, height: 0, resizeHeight: 0, oTop: 0 }
|
|
101
101
|
fullDataRowIdData[rowid] = rest
|
|
102
102
|
fullAllDataRowIdData[rowid] = rest
|
|
103
103
|
}
|
|
@@ -122,7 +122,7 @@ hooks.add('tableEditModule', {
|
|
|
122
122
|
} else {
|
|
123
123
|
newRecords.forEach(item => {
|
|
124
124
|
const rowid = getRowid($xeTable, item)
|
|
125
|
-
const rest = { row: item, rowid, seq: -1, index: -1, _index: -1, $index: -1, treeIndex: -1, items: afterFullData, parent: null, level: 0, height: 0, oTop: 0 }
|
|
125
|
+
const rest = { row: item, rowid, seq: -1, index: -1, _index: -1, $index: -1, treeIndex: -1, items: afterFullData, parent: null, level: 0, height: 0, resizeHeight: 0, oTop: 0 }
|
|
126
126
|
fullDataRowIdData[rowid] = rest
|
|
127
127
|
fullAllDataRowIdData[rowid] = rest
|
|
128
128
|
afterFullData.unshift(item)
|
|
@@ -144,7 +144,7 @@ hooks.add('tableEditModule', {
|
|
|
144
144
|
} else {
|
|
145
145
|
newRecords.forEach(item => {
|
|
146
146
|
const rowid = getRowid($xeTable, item)
|
|
147
|
-
const rest = { row: item, rowid, seq: -1, index: -1, _index: -1, treeIndex: -1, $index: -1, items: afterFullData, parent: null, level: 0, height: 0, oTop: 0 }
|
|
147
|
+
const rest = { row: item, rowid, seq: -1, index: -1, _index: -1, treeIndex: -1, $index: -1, items: afterFullData, parent: null, level: 0, height: 0, resizeHeight: 0, oTop: 0 }
|
|
148
148
|
fullDataRowIdData[rowid] = rest
|
|
149
149
|
fullAllDataRowIdData[rowid] = rest
|
|
150
150
|
afterFullData.push(item)
|
|
@@ -184,7 +184,7 @@ hooks.add('tableEditModule', {
|
|
|
184
184
|
targetIndex = targetIndex + 1
|
|
185
185
|
}
|
|
186
186
|
parentMapChilds.splice(targetIndex, 0, item)
|
|
187
|
-
const rest = { row: item, rowid, seq: -1, index: -1, _index: -1, $index: -1, treeIndex: -1, items: parentMapChilds, parent: parentRow, level: parentLevel + 1, height: 0, oTop: 0 }
|
|
187
|
+
const rest = { row: item, rowid, seq: -1, index: -1, _index: -1, $index: -1, treeIndex: -1, items: parentMapChilds, parent: parentRow, level: parentLevel + 1, height: 0, resizeHeight: 0, oTop: 0 }
|
|
188
188
|
fullDataRowIdData[rowid] = rest
|
|
189
189
|
fullAllDataRowIdData[rowid] = rest
|
|
190
190
|
})
|
|
@@ -251,7 +251,7 @@ hooks.add('tableEditModule', {
|
|
|
251
251
|
const rowid = getRowid($xeTable, newRow)
|
|
252
252
|
insertMaps[rowid] = newRow
|
|
253
253
|
})
|
|
254
|
-
$xeTable.cacheRowMap()
|
|
254
|
+
$xeTable.cacheRowMap(false)
|
|
255
255
|
$xeTable.updateScrollYStatus()
|
|
256
256
|
$xeTable.handleTableData(treeConfig && transform)
|
|
257
257
|
if (!(treeConfig && transform)) {
|
|
@@ -469,7 +469,7 @@ hooks.add('tableEditModule', {
|
|
|
469
469
|
editStore.insertMaps = insertDataRowMaps
|
|
470
470
|
reactData.pendingRowMaps = pendingDataRowMaps
|
|
471
471
|
$xeTable.updateFooter()
|
|
472
|
-
$xeTable.cacheRowMap()
|
|
472
|
+
$xeTable.cacheRowMap(false)
|
|
473
473
|
$xeTable.handleTableData(treeConfig && transform)
|
|
474
474
|
if (!(treeConfig && transform)) {
|
|
475
475
|
$xeTable.updateAfterDataIndex()
|
|
@@ -126,8 +126,8 @@ function toTxtCellLabel (val: any) {
|
|
|
126
126
|
return val
|
|
127
127
|
}
|
|
128
128
|
|
|
129
|
-
function getElementsByTagName (elem: any, qualifiedName: any)
|
|
130
|
-
return elem.getElementsByTagName(qualifiedName)
|
|
129
|
+
function getElementsByTagName (elem: any, qualifiedName: any) {
|
|
130
|
+
return elem.getElementsByTagName(qualifiedName) as HTMLElement[]
|
|
131
131
|
}
|
|
132
132
|
|
|
133
133
|
function getTxtCellKey (now: number) {
|
|
@@ -143,7 +143,25 @@ function getTxtCellValue (val: any, vMaps: any) {
|
|
|
143
143
|
return rest.replace(/^"+$/g, (qVal: any) => '"'.repeat(Math.ceil(qVal.length / 2)))
|
|
144
144
|
}
|
|
145
145
|
|
|
146
|
-
function
|
|
146
|
+
function toExportField (tableConf: {
|
|
147
|
+
fieldMaps: Record<string, VxeTableDefines.ColumnInfo>
|
|
148
|
+
titleMaps: Record<string, VxeTableDefines.ColumnInfo>
|
|
149
|
+
}, field: string) {
|
|
150
|
+
const { fieldMaps, titleMaps } = tableConf
|
|
151
|
+
// title 转 field
|
|
152
|
+
if (!fieldMaps[field]) {
|
|
153
|
+
const teCol = titleMaps[field]
|
|
154
|
+
if (teCol && teCol.field) {
|
|
155
|
+
field = teCol.field
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
return field
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
function parseCsvAndTxt (tableConf: {
|
|
162
|
+
fieldMaps: Record<string, VxeTableDefines.ColumnInfo>
|
|
163
|
+
titleMaps: Record<string, VxeTableDefines.ColumnInfo>
|
|
164
|
+
}, content: string, cellSeparator: string) {
|
|
147
165
|
const list = content.split(enterSymbol)
|
|
148
166
|
const rows: any[] = []
|
|
149
167
|
let fields: string[] = []
|
|
@@ -162,9 +180,9 @@ function parseCsvAndTxt (columns: any[], content: string, cellSeparator: string)
|
|
|
162
180
|
vMaps[key] = replaceTxtCell(cVal, vMaps)
|
|
163
181
|
return key
|
|
164
182
|
})
|
|
165
|
-
const cells = rVal.split(cellSeparator)
|
|
183
|
+
const cells: string[] = rVal.split(cellSeparator)
|
|
166
184
|
if (!fields.length) {
|
|
167
|
-
fields = cells.map((val) => getTxtCellValue(val.trim(), vMaps))
|
|
185
|
+
fields = cells.map((val: string) => toExportField(tableConf, getTxtCellValue(val.trim(), vMaps)))
|
|
168
186
|
} else {
|
|
169
187
|
cells.forEach((val, colIndex) => {
|
|
170
188
|
if (colIndex < fields.length) {
|
|
@@ -179,20 +197,29 @@ function parseCsvAndTxt (columns: any[], content: string, cellSeparator: string)
|
|
|
179
197
|
return { fields, rows }
|
|
180
198
|
}
|
|
181
199
|
|
|
182
|
-
function parseCsv (
|
|
183
|
-
|
|
200
|
+
function parseCsv (tableConf: {
|
|
201
|
+
fieldMaps: Record<string, VxeTableDefines.ColumnInfo>
|
|
202
|
+
titleMaps: Record<string, VxeTableDefines.ColumnInfo>
|
|
203
|
+
}, content: string) {
|
|
204
|
+
return parseCsvAndTxt(tableConf, content, ',')
|
|
184
205
|
}
|
|
185
206
|
|
|
186
|
-
function parseTxt (
|
|
187
|
-
|
|
207
|
+
function parseTxt (tableConf: {
|
|
208
|
+
fieldMaps: Record<string, VxeTableDefines.ColumnInfo>
|
|
209
|
+
titleMaps: Record<string, VxeTableDefines.ColumnInfo>
|
|
210
|
+
}, content: string) {
|
|
211
|
+
return parseCsvAndTxt(tableConf, content, '\t')
|
|
188
212
|
}
|
|
189
213
|
|
|
190
|
-
function parseHTML (
|
|
214
|
+
function parseHTML (tableConf: {
|
|
215
|
+
fieldMaps: Record<string, VxeTableDefines.ColumnInfo>
|
|
216
|
+
titleMaps: Record<string, VxeTableDefines.ColumnInfo>
|
|
217
|
+
}, content: string) {
|
|
191
218
|
const domParser = new DOMParser()
|
|
192
219
|
const xmlDoc = domParser.parseFromString(content, 'text/html')
|
|
193
220
|
const bodyNodes = getElementsByTagName(xmlDoc, 'body')
|
|
194
|
-
const rows: any = []
|
|
195
|
-
const fields:
|
|
221
|
+
const rows: any[] = []
|
|
222
|
+
const fields: string[] = []
|
|
196
223
|
if (bodyNodes.length) {
|
|
197
224
|
const tableNodes = getElementsByTagName(bodyNodes[0], 'table')
|
|
198
225
|
if (tableNodes.length) {
|
|
@@ -200,7 +227,7 @@ function parseHTML (columns: any, content: any) {
|
|
|
200
227
|
if (theadNodes.length) {
|
|
201
228
|
XEUtils.arrayEach(getElementsByTagName(theadNodes[0], 'tr'), rowNode => {
|
|
202
229
|
XEUtils.arrayEach(getElementsByTagName(rowNode, 'th'), cellNode => {
|
|
203
|
-
fields.push(cellNode.textContent)
|
|
230
|
+
fields.push(toExportField(tableConf, cellNode.textContent || ''))
|
|
204
231
|
})
|
|
205
232
|
})
|
|
206
233
|
const tbodyNodes = getElementsByTagName(tableNodes[0], 'tbody')
|
|
@@ -221,19 +248,22 @@ function parseHTML (columns: any, content: any) {
|
|
|
221
248
|
return { fields, rows }
|
|
222
249
|
}
|
|
223
250
|
|
|
224
|
-
function parseXML (
|
|
251
|
+
function parseXML (tableConf: {
|
|
252
|
+
fieldMaps: Record<string, VxeTableDefines.ColumnInfo>
|
|
253
|
+
titleMaps: Record<string, VxeTableDefines.ColumnInfo>
|
|
254
|
+
}, content: string) {
|
|
225
255
|
const domParser = new DOMParser()
|
|
226
256
|
const xmlDoc = domParser.parseFromString(content, 'application/xml')
|
|
227
257
|
const sheetNodes = getElementsByTagName(xmlDoc, 'Worksheet')
|
|
228
|
-
const rows: any = []
|
|
229
|
-
const fields:
|
|
258
|
+
const rows: any[] = []
|
|
259
|
+
const fields: string[] = []
|
|
230
260
|
if (sheetNodes.length) {
|
|
231
261
|
const tableNodes = getElementsByTagName(sheetNodes[0], 'Table')
|
|
232
262
|
if (tableNodes.length) {
|
|
233
263
|
const rowNodes = getElementsByTagName(tableNodes[0], 'Row')
|
|
234
264
|
if (rowNodes.length) {
|
|
235
265
|
XEUtils.arrayEach(getElementsByTagName(rowNodes[0], 'Cell'), cellNode => {
|
|
236
|
-
fields.push(cellNode.textContent)
|
|
266
|
+
fields.push(toExportField(tableConf, cellNode.textContent || ''))
|
|
237
267
|
})
|
|
238
268
|
XEUtils.arrayEach(rowNodes, (rowNode, index) => {
|
|
239
269
|
if (index) {
|
|
@@ -263,22 +293,6 @@ function clearColumnConvert (columns: any) {
|
|
|
263
293
|
}, { children: 'children' })
|
|
264
294
|
}
|
|
265
295
|
|
|
266
|
-
/**
|
|
267
|
-
* 检查导入的列是否完整
|
|
268
|
-
* @param {Array} fields 字段名列表
|
|
269
|
-
* @param {Array} rows 数据列表
|
|
270
|
-
*/
|
|
271
|
-
function checkImportData (columns: any[], fields: string[]) {
|
|
272
|
-
const tableFields: string[] = []
|
|
273
|
-
columns.forEach((column) => {
|
|
274
|
-
const field = column.field
|
|
275
|
-
if (field) {
|
|
276
|
-
tableFields.push(field)
|
|
277
|
-
}
|
|
278
|
-
})
|
|
279
|
-
return fields.some(field => tableFields.indexOf(field) > -1)
|
|
280
|
-
}
|
|
281
|
-
|
|
282
296
|
const tableExportMethodKeys: (keyof TableExportMethods)[] = ['exportData', 'importByFile', 'importData', 'saveFile', 'readFile', 'print', 'getPrintHtml', 'openImport', 'closeImport', 'openExport', 'closeExport', 'openPrint', 'closePrint']
|
|
283
297
|
|
|
284
298
|
hooks.add('tableExportModule', {
|
|
@@ -820,22 +834,38 @@ hooks.add('tableExportModule', {
|
|
|
820
834
|
fields: string[];
|
|
821
835
|
rows: any[];
|
|
822
836
|
} = { fields: [], rows: [] }
|
|
837
|
+
const tableFieldMaps: Record<string, VxeTableDefines.ColumnInfo> = {}
|
|
838
|
+
const tableTitleMaps: Record<string, VxeTableDefines.ColumnInfo> = {}
|
|
839
|
+
tableFullColumn.forEach((column) => {
|
|
840
|
+
const field = column.field
|
|
841
|
+
const title = column.getTitle()
|
|
842
|
+
if (field) {
|
|
843
|
+
tableFieldMaps[field] = column
|
|
844
|
+
}
|
|
845
|
+
if (title) {
|
|
846
|
+
tableTitleMaps[column.getTitle()] = column
|
|
847
|
+
}
|
|
848
|
+
})
|
|
849
|
+
const tableConf = {
|
|
850
|
+
fieldMaps: tableFieldMaps,
|
|
851
|
+
titleMaps: tableTitleMaps
|
|
852
|
+
}
|
|
823
853
|
switch (opts.type) {
|
|
824
854
|
case 'csv':
|
|
825
|
-
rest = parseCsv(
|
|
855
|
+
rest = parseCsv(tableConf, content)
|
|
826
856
|
break
|
|
827
857
|
case 'txt':
|
|
828
|
-
rest = parseTxt(
|
|
858
|
+
rest = parseTxt(tableConf, content)
|
|
829
859
|
break
|
|
830
860
|
case 'html':
|
|
831
|
-
rest = parseHTML(
|
|
861
|
+
rest = parseHTML(tableConf, content)
|
|
832
862
|
break
|
|
833
863
|
case 'xml':
|
|
834
|
-
rest = parseXML(
|
|
864
|
+
rest = parseXML(tableConf, content)
|
|
835
865
|
break
|
|
836
866
|
}
|
|
837
867
|
const { fields, rows } = rest
|
|
838
|
-
const status =
|
|
868
|
+
const status = fields.some(field => tableFieldMaps[field] || tableTitleMaps[field])
|
|
839
869
|
if (status) {
|
|
840
870
|
$xeTable.createData(rows)
|
|
841
871
|
.then((data: any) => {
|
|
@@ -944,6 +974,45 @@ hooks.add('tableExportModule', {
|
|
|
944
974
|
})
|
|
945
975
|
}
|
|
946
976
|
|
|
977
|
+
const handleFilterColumns = (exportOpts: VxeTablePropTypes.ExportConfig, column: VxeTableDefines.ColumnInfo, columns: VxeTableDefines.ColumnInfo[] | VxeTablePropTypes.ExportOrPrintColumnOption[]) => {
|
|
978
|
+
return columns.some((item: any) => {
|
|
979
|
+
if (isColumnInfo(item)) {
|
|
980
|
+
return column.id === (item as any).id
|
|
981
|
+
} else if (XEUtils.isString(item)) {
|
|
982
|
+
return column.field === item
|
|
983
|
+
} else {
|
|
984
|
+
const colid = item.id || item.colId
|
|
985
|
+
const type = item.type
|
|
986
|
+
const field = item.field
|
|
987
|
+
if (colid) {
|
|
988
|
+
return column.id === colid
|
|
989
|
+
} else if (field && type) {
|
|
990
|
+
return column.field === field && column.type === type
|
|
991
|
+
} else if (field) {
|
|
992
|
+
return column.field === field
|
|
993
|
+
} else if (type) {
|
|
994
|
+
return column.type === type
|
|
995
|
+
}
|
|
996
|
+
}
|
|
997
|
+
return false
|
|
998
|
+
})
|
|
999
|
+
}
|
|
1000
|
+
|
|
1001
|
+
const handleFilterFields = (exportOpts: VxeTablePropTypes.ExportConfig, column: VxeTableDefines.ColumnInfo, includeFields: string[] | undefined, excludeFields: string[] | undefined) => {
|
|
1002
|
+
if (excludeFields) {
|
|
1003
|
+
if (XEUtils.includes(excludeFields, column.field)) {
|
|
1004
|
+
return false
|
|
1005
|
+
}
|
|
1006
|
+
}
|
|
1007
|
+
if (includeFields) {
|
|
1008
|
+
if (XEUtils.includes(includeFields, column.field)) {
|
|
1009
|
+
return true
|
|
1010
|
+
}
|
|
1011
|
+
return false
|
|
1012
|
+
}
|
|
1013
|
+
return exportOpts.original ? column.field : defaultFilterExportColumn(column)
|
|
1014
|
+
}
|
|
1015
|
+
|
|
947
1016
|
const handleExportAndPrint = (options: VxeTablePropTypes.ExportOpts | VxeTablePropTypes.ExportConfig, isPrint?: boolean) => {
|
|
948
1017
|
const { treeConfig, showHeader, showFooter } = props
|
|
949
1018
|
const { initStore, mergeList, mergeFooterList, isGroup, footerTableData, exportStore, exportParams } = reactData
|
|
@@ -969,7 +1038,7 @@ hooks.add('tableExportModule', {
|
|
|
969
1038
|
const modes: string[] = defOpts.modes || []
|
|
970
1039
|
const checkMethod = customOpts.checkMethod
|
|
971
1040
|
const exportColumns = collectColumn.slice(0)
|
|
972
|
-
const { columns } = defOpts
|
|
1041
|
+
const { columns, excludeFields, includeFields } = defOpts
|
|
973
1042
|
// 处理类型
|
|
974
1043
|
const typeList = types.map((value) => {
|
|
975
1044
|
return {
|
|
@@ -992,33 +1061,17 @@ hooks.add('tableExportModule', {
|
|
|
992
1061
|
// 默认选中
|
|
993
1062
|
XEUtils.eachTree(exportColumns, (column, index, items, path, parent) => {
|
|
994
1063
|
const isColGroup = column.children && column.children.length
|
|
995
|
-
|
|
996
|
-
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
|
|
1002
|
-
} else {
|
|
1003
|
-
const colid = item.id || item.colId
|
|
1004
|
-
const type = item.type
|
|
1005
|
-
const field = item.field
|
|
1006
|
-
if (colid) {
|
|
1007
|
-
return column.id === colid
|
|
1008
|
-
} else if (field && type) {
|
|
1009
|
-
return column.field === field && column.type === type
|
|
1010
|
-
} else if (field) {
|
|
1011
|
-
return column.field === field
|
|
1012
|
-
} else if (type) {
|
|
1013
|
-
return column.type === type
|
|
1014
|
-
}
|
|
1015
|
-
}
|
|
1016
|
-
return false
|
|
1017
|
-
})
|
|
1018
|
-
: column.visible
|
|
1019
|
-
column.halfChecked = false
|
|
1020
|
-
column.disabled = (parent && parent.disabled) || (checkMethod ? !checkMethod({ column }) : false)
|
|
1064
|
+
let isChecked = false
|
|
1065
|
+
if (columns && columns.length) {
|
|
1066
|
+
isChecked = handleFilterColumns(defOpts, column, columns)
|
|
1067
|
+
} else if (excludeFields || includeFields) {
|
|
1068
|
+
isChecked = handleFilterFields(defOpts, column, includeFields, excludeFields)
|
|
1069
|
+
} else {
|
|
1070
|
+
isChecked = column.visible && (isColGroup || defaultFilterExportColumn(column))
|
|
1021
1071
|
}
|
|
1072
|
+
column.checked = isChecked
|
|
1073
|
+
column.halfChecked = false
|
|
1074
|
+
column.disabled = (parent && parent.disabled) || (checkMethod ? !checkMethod({ column }) : false)
|
|
1022
1075
|
})
|
|
1023
1076
|
// 更新条件
|
|
1024
1077
|
Object.assign(exportStore, {
|
|
@@ -33,33 +33,61 @@ hooks.add('tableKeyboardModule', {
|
|
|
33
33
|
setupTable ($xeTable) {
|
|
34
34
|
const { props, reactData, internalData } = $xeTable
|
|
35
35
|
const { refElem } = $xeTable.getRefMaps()
|
|
36
|
-
const { computeEditOpts, computeCheckboxOpts, computeMouseOpts, computeTreeOpts } = $xeTable.getComputeMaps()
|
|
36
|
+
const { computeEditOpts, computeCheckboxOpts, computeMouseOpts, computeTreeOpts, computeRowOpts, computeCellOpts, computeDefaultRowHeight } = $xeTable.getComputeMaps()
|
|
37
37
|
|
|
38
38
|
function getCheckboxRangeRows (evnt: MouseEvent, params: any, targetTrElem: HTMLElement, trRect: DOMRect, offsetClientTop: number, moveRange: number) {
|
|
39
|
+
const { showOverflow } = props
|
|
40
|
+
const { fullAllDataRowIdData, isResizeCellHeight } = internalData
|
|
41
|
+
const rowOpts = computeRowOpts.value
|
|
42
|
+
const cellOpts = computeCellOpts.value
|
|
43
|
+
const defaultRowHeight = computeDefaultRowHeight.value
|
|
44
|
+
const { row } = params
|
|
39
45
|
let countHeight = 0
|
|
40
46
|
let rangeRows: any[] = []
|
|
41
47
|
let moveSize = 0
|
|
42
48
|
const isDown = moveRange > 0
|
|
43
|
-
const { scrollYLoad
|
|
49
|
+
const { scrollYLoad } = reactData
|
|
44
50
|
const { afterFullData } = internalData
|
|
51
|
+
if (isDown) {
|
|
52
|
+
moveSize = offsetClientTop + moveRange
|
|
53
|
+
} else {
|
|
54
|
+
moveSize = (trRect.height - offsetClientTop) + Math.abs(moveRange)
|
|
55
|
+
}
|
|
45
56
|
if (scrollYLoad) {
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
57
|
+
const _rowIndex = $xeTable.getVTRowIndex(row)
|
|
58
|
+
const isCustomCellHeight = isResizeCellHeight || cellOpts.height || rowOpts.height
|
|
59
|
+
if (!isCustomCellHeight && showOverflow) {
|
|
60
|
+
if (isDown) {
|
|
61
|
+
rangeRows = afterFullData.slice(_rowIndex, _rowIndex + Math.ceil(moveSize / defaultRowHeight))
|
|
62
|
+
} else {
|
|
63
|
+
rangeRows = afterFullData.slice(_rowIndex - Math.floor(moveSize / defaultRowHeight), _rowIndex + 1)
|
|
64
|
+
}
|
|
54
65
|
} else {
|
|
55
|
-
|
|
66
|
+
if (isDown) {
|
|
67
|
+
for (let i = _rowIndex; i < afterFullData.length; i++) {
|
|
68
|
+
const item = afterFullData[i]
|
|
69
|
+
const rowid = $xeTable.getRowid(item)
|
|
70
|
+
const rowRest = fullAllDataRowIdData[rowid] || {}
|
|
71
|
+
countHeight += rowRest.resizeHeight || cellOpts.height || rowOpts.height || defaultRowHeight
|
|
72
|
+
rangeRows.push(item)
|
|
73
|
+
if (countHeight > moveSize) {
|
|
74
|
+
return rangeRows
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
} else {
|
|
78
|
+
for (let len = _rowIndex; len >= 0; len--) {
|
|
79
|
+
const item = afterFullData[len]
|
|
80
|
+
const rowid = $xeTable.getRowid(item)
|
|
81
|
+
const rowRest = fullAllDataRowIdData[rowid] || {}
|
|
82
|
+
countHeight += rowRest.resizeHeight || cellOpts.height || rowOpts.height || defaultRowHeight
|
|
83
|
+
rangeRows.push(item)
|
|
84
|
+
if (countHeight > moveSize) {
|
|
85
|
+
return rangeRows
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
}
|
|
56
89
|
}
|
|
57
90
|
} else {
|
|
58
|
-
if (isDown) {
|
|
59
|
-
moveSize = evnt.clientY - trRect.y
|
|
60
|
-
} else {
|
|
61
|
-
moveSize = trRect.y - evnt.clientY + trRect.height
|
|
62
|
-
}
|
|
63
91
|
const siblingProp = isDown ? 'next' : 'previous'
|
|
64
92
|
while (targetTrElem && countHeight < moveSize) {
|
|
65
93
|
const rowNodeRest = $xeTable.getRowNode(targetTrElem)
|
|
@@ -74,19 +102,25 @@ hooks.add('tableKeyboardModule', {
|
|
|
74
102
|
}
|
|
75
103
|
|
|
76
104
|
const handleCheckboxRangeEvent = (evnt: any, params: any) => {
|
|
105
|
+
const { elemStore } = internalData
|
|
106
|
+
const bodyScrollElem = getRefElem(elemStore['main-body-scroll'])
|
|
107
|
+
const leftScrollElem = getRefElem(elemStore['left-body-scroll'])
|
|
108
|
+
const rightScrollElem = getRefElem(elemStore['right-body-scroll'])
|
|
77
109
|
const { column, cell } = params
|
|
78
110
|
if (column.type === 'checkbox') {
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
111
|
+
let bodyWrapperElem = bodyScrollElem as HTMLElement
|
|
112
|
+
if (leftScrollElem && column.fixed === 'left') {
|
|
113
|
+
bodyWrapperElem = leftScrollElem
|
|
114
|
+
} else if (rightScrollElem && column.fixed === 'right') {
|
|
115
|
+
bodyWrapperElem = rightScrollElem
|
|
116
|
+
}
|
|
84
117
|
if (!bodyWrapperElem) {
|
|
85
118
|
return
|
|
86
119
|
}
|
|
120
|
+
const el = refElem.value
|
|
121
|
+
const disX = evnt.clientX
|
|
122
|
+
const disY = evnt.clientY
|
|
87
123
|
const checkboxRangeElem = bodyWrapperElem.querySelector('.vxe-table--checkbox-range') as HTMLElement
|
|
88
|
-
const domMousemove = document.onmousemove
|
|
89
|
-
const domMouseup = document.onmouseup
|
|
90
124
|
const trElem = cell.parentElement as HTMLElement
|
|
91
125
|
const selectRecords = $xeTable.getCheckboxRecords()
|
|
92
126
|
let lastRangeRows: any[] = []
|
|
@@ -215,8 +249,8 @@ hooks.add('tableKeyboardModule', {
|
|
|
215
249
|
stopMouseScroll()
|
|
216
250
|
removeClass(el, 'drag--range')
|
|
217
251
|
checkboxRangeElem.removeAttribute('style')
|
|
218
|
-
document.onmousemove =
|
|
219
|
-
document.onmouseup =
|
|
252
|
+
document.onmousemove = null
|
|
253
|
+
document.onmouseup = null
|
|
220
254
|
triggerEvent('end', evnt)
|
|
221
255
|
}
|
|
222
256
|
triggerEvent('start', evnt)
|