vxe-table 3.15.29 → 3.15.31
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 +39 -42
- package/es/style.css +1 -1
- package/es/table/module/edit/mixin.js +11 -27
- package/es/table/module/export/mixin.js +75 -143
- package/es/table/module/menu/mixin.js +2 -6
- package/es/table/module/validator/mixin.js +99 -41
- package/es/table/src/methods.js +12 -36
- package/es/table/src/table.js +6 -8
- package/es/ui/index.js +1 -1
- package/es/ui/src/log.js +1 -1
- package/lib/grid/src/grid.js +24 -26
- package/lib/grid/src/grid.min.js +1 -1
- package/lib/index.umd.js +271 -572
- package/lib/index.umd.min.js +1 -1
- package/lib/style.css +1 -1
- package/lib/table/module/edit/mixin.js +11 -27
- package/lib/table/module/edit/mixin.min.js +1 -1
- package/lib/table/module/export/mixin.js +101 -184
- package/lib/table/module/export/mixin.min.js +1 -1
- package/lib/table/module/menu/mixin.js +2 -6
- package/lib/table/module/menu/mixin.min.js +1 -1
- package/lib/table/module/validator/mixin.js +97 -40
- package/lib/table/module/validator/mixin.min.js +1 -1
- package/lib/table/src/methods.js +12 -36
- package/lib/table/src/methods.min.js +1 -1
- package/lib/table/src/table.js +8 -10
- package/lib/table/src/table.min.js +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/package.json +1 -1
- package/packages/grid/src/grid.ts +39 -41
- package/packages/table/module/edit/mixin.ts +11 -27
- package/packages/table/module/export/mixin.ts +105 -162
- package/packages/table/module/menu/mixin.ts +2 -6
- package/packages/table/module/validator/mixin.ts +101 -40
- package/packages/table/src/methods.ts +12 -36
- package/packages/table/src/table.ts +6 -8
- /package/es/{iconfont.1747286367921.ttf → iconfont.1747621179042.ttf} +0 -0
- /package/es/{iconfont.1747286367921.woff → iconfont.1747621179042.woff} +0 -0
- /package/es/{iconfont.1747286367921.woff2 → iconfont.1747621179042.woff2} +0 -0
- /package/lib/{iconfont.1747286367921.ttf → iconfont.1747621179042.ttf} +0 -0
- /package/lib/{iconfont.1747286367921.woff → iconfont.1747621179042.woff} +0 -0
- /package/lib/{iconfont.1747286367921.woff2 → iconfont.1747621179042.woff2} +0 -0
|
@@ -12,10 +12,6 @@ const { getI18n, renderer } = VxeUI
|
|
|
12
12
|
|
|
13
13
|
let htmlCellElem: any
|
|
14
14
|
|
|
15
|
-
// 导入
|
|
16
|
-
let fileForm: any
|
|
17
|
-
let fileInput: any
|
|
18
|
-
|
|
19
15
|
const csvBOM = '\ufeff'
|
|
20
16
|
const enterSymbol = '\r\n'
|
|
21
17
|
|
|
@@ -42,11 +38,11 @@ function getSeq ($xeTable: VxeTableConstructor, cellValue: any, row: any, $rowIn
|
|
|
42
38
|
return cellValue
|
|
43
39
|
}
|
|
44
40
|
|
|
45
|
-
function defaultFilterExportColumn (column:
|
|
46
|
-
return column.field || ['seq', 'checkbox', 'radio'].indexOf(column.type)
|
|
41
|
+
function defaultFilterExportColumn (column: VxeTableDefines.ColumnInfo) {
|
|
42
|
+
return !!column.field || ['seq', 'checkbox', 'radio'].indexOf(column.type || '') === -1
|
|
47
43
|
}
|
|
48
44
|
|
|
49
|
-
function toTableBorder (border:
|
|
45
|
+
function toTableBorder (border: VxeTablePropTypes.Border | undefined) {
|
|
50
46
|
if (border === true) {
|
|
51
47
|
return 'full'
|
|
52
48
|
}
|
|
@@ -510,7 +506,7 @@ function toHtml ($xeTable: VxeTableConstructor & VxeTablePrivateMethods, opts: V
|
|
|
510
506
|
return isPrint ? tables.join('') : createHtmlPage(opts, tables.join(''))
|
|
511
507
|
}
|
|
512
508
|
|
|
513
|
-
function toXML ($xeTable:
|
|
509
|
+
function toXML ($xeTable: VxeTableConstructor & VxeTablePrivateMethods, opts: any, columns: any[], datas: any[]) {
|
|
514
510
|
const reactData = $xeTable as unknown as TableReactData
|
|
515
511
|
|
|
516
512
|
let xml = [
|
|
@@ -564,53 +560,21 @@ function getContent ($xeTable: VxeTableConstructor & VxeTablePrivateMethods, opt
|
|
|
564
560
|
return ''
|
|
565
561
|
}
|
|
566
562
|
|
|
567
|
-
|
|
568
|
-
* 保存文件到本地
|
|
569
|
-
* @param {*} options 参数
|
|
570
|
-
*/
|
|
571
|
-
export function saveLocalFile (options: any) {
|
|
572
|
-
const { filename, type, content } = options
|
|
573
|
-
const name = `${filename}.${type}`
|
|
574
|
-
if (window.Blob) {
|
|
575
|
-
const blob = content instanceof Blob ? content : getExportBlobByContent(XEUtils.toValueString(content), options)
|
|
576
|
-
if ((navigator as any).msSaveBlob) {
|
|
577
|
-
(navigator as any).msSaveBlob(blob, name)
|
|
578
|
-
} else {
|
|
579
|
-
const url = URL.createObjectURL(blob as any)
|
|
580
|
-
const linkElem = document.createElement('a')
|
|
581
|
-
linkElem.target = '_blank'
|
|
582
|
-
linkElem.download = name
|
|
583
|
-
linkElem.href = url
|
|
584
|
-
document.body.appendChild(linkElem)
|
|
585
|
-
linkElem.click()
|
|
586
|
-
document.body.removeChild(linkElem)
|
|
587
|
-
requestAnimationFrame(() => {
|
|
588
|
-
if (linkElem.parentNode) {
|
|
589
|
-
linkElem.parentNode.removeChild(linkElem)
|
|
590
|
-
}
|
|
591
|
-
URL.revokeObjectURL(url)
|
|
592
|
-
})
|
|
593
|
-
}
|
|
594
|
-
return Promise.resolve()
|
|
595
|
-
}
|
|
596
|
-
return Promise.reject(new Error(getI18n('vxe.error.notExp')))
|
|
597
|
-
}
|
|
598
|
-
|
|
599
|
-
function downloadFile ($xeTable: any, opts: any, content: any) {
|
|
563
|
+
function downloadFile ($xeTable: VxeTableConstructor & VxeTablePrivateMethods, opts: any, content: any) {
|
|
600
564
|
const { filename, type, download } = opts
|
|
601
565
|
if (!download) {
|
|
602
566
|
const blob = getExportBlobByContent(content, opts)
|
|
603
567
|
return Promise.resolve({ type, content, blob })
|
|
604
568
|
}
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
569
|
+
if (VxeUI.saveFile) {
|
|
570
|
+
VxeUI.saveFile({ filename, type, content }).then(() => {
|
|
571
|
+
if (opts.message !== false) {
|
|
572
|
+
if (VxeUI.modal) {
|
|
573
|
+
VxeUI.modal.message({ content: getI18n('vxe.table.expSuccess'), status: 'success' })
|
|
574
|
+
}
|
|
610
575
|
}
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
})
|
|
576
|
+
})
|
|
577
|
+
}
|
|
614
578
|
}
|
|
615
579
|
|
|
616
580
|
function clearColumnConvert (columns: any) {
|
|
@@ -623,7 +587,7 @@ function clearColumnConvert (columns: any) {
|
|
|
623
587
|
}, { children: 'children' })
|
|
624
588
|
}
|
|
625
589
|
|
|
626
|
-
function handleExport ($xeTable:
|
|
590
|
+
function handleExport ($xeTable: VxeTableConstructor & VxeTablePrivateMethods, opts: VxeTablePropTypes.ExportHandleOptions) {
|
|
627
591
|
const $xeGrid = $xeTable.$xeGrid
|
|
628
592
|
|
|
629
593
|
const { remote, columns, colgroups, exportMethod, afterExportMethod } = opts
|
|
@@ -977,58 +941,6 @@ function handleCloseExport () {
|
|
|
977
941
|
return Promise.resolve()
|
|
978
942
|
}
|
|
979
943
|
|
|
980
|
-
/**
|
|
981
|
-
* 读取本地文件
|
|
982
|
-
* @param {*} options 参数
|
|
983
|
-
*/
|
|
984
|
-
export function readLocalFile (options: any = {}) {
|
|
985
|
-
if (!fileForm) {
|
|
986
|
-
fileForm = document.createElement('form')
|
|
987
|
-
fileInput = document.createElement('input')
|
|
988
|
-
fileForm.className = 'vxe-table--file-form'
|
|
989
|
-
fileInput.name = 'file'
|
|
990
|
-
fileInput.type = 'file'
|
|
991
|
-
fileForm.appendChild(fileInput)
|
|
992
|
-
document.body.appendChild(fileForm)
|
|
993
|
-
}
|
|
994
|
-
return new Promise((resolve, reject) => {
|
|
995
|
-
const types = options.types || []
|
|
996
|
-
const isAllType = !types.length || types.some((type: any) => type === '*')
|
|
997
|
-
fileInput.multiple = !!options.multiple
|
|
998
|
-
fileInput.accept = isAllType ? '' : `.${types.join(', .')}`
|
|
999
|
-
fileInput.onchange = (evnt: any) => {
|
|
1000
|
-
const { files } = evnt.target
|
|
1001
|
-
const file = files[0]
|
|
1002
|
-
let errType
|
|
1003
|
-
// 校验类型
|
|
1004
|
-
if (!isAllType) {
|
|
1005
|
-
for (let fIndex = 0; fIndex < files.length; fIndex++) {
|
|
1006
|
-
const { type } = parseFile(files[fIndex])
|
|
1007
|
-
if (!XEUtils.includes(types, type)) {
|
|
1008
|
-
errType = type
|
|
1009
|
-
break
|
|
1010
|
-
}
|
|
1011
|
-
}
|
|
1012
|
-
}
|
|
1013
|
-
if (!errType) {
|
|
1014
|
-
resolve({ status: true, files, file })
|
|
1015
|
-
} else {
|
|
1016
|
-
if (options.message !== false) {
|
|
1017
|
-
// 检测弹窗模块
|
|
1018
|
-
if (!VxeUI.modal) {
|
|
1019
|
-
errLog('vxe.error.reqModule', ['Modal'])
|
|
1020
|
-
}
|
|
1021
|
-
VxeUI.modal.message({ content: getI18n('vxe.error.notType', [errType]), status: 'error' })
|
|
1022
|
-
}
|
|
1023
|
-
const params = { status: false, files, file }
|
|
1024
|
-
reject(params)
|
|
1025
|
-
}
|
|
1026
|
-
}
|
|
1027
|
-
fileForm.reset()
|
|
1028
|
-
fileInput.click()
|
|
1029
|
-
})
|
|
1030
|
-
}
|
|
1031
|
-
|
|
1032
944
|
function handleFilterColumns (exportOpts: VxeTablePropTypes.ExportConfig, column: VxeTableDefines.ColumnInfo, columns: VxeTableDefines.ColumnInfo[] | VxeTablePropTypes.ExportOrPrintColumnOption[]) {
|
|
1033
945
|
return columns.some((item: any) => {
|
|
1034
946
|
if (isColumnInfo(item)) {
|
|
@@ -1065,7 +977,7 @@ function handleFilterFields (exportOpts: VxeTablePropTypes.ExportConfig, column:
|
|
|
1065
977
|
}
|
|
1066
978
|
return false
|
|
1067
979
|
}
|
|
1068
|
-
return exportOpts.original ? column.field : defaultFilterExportColumn(column)
|
|
980
|
+
return exportOpts.original ? !!column.field : defaultFilterExportColumn(column)
|
|
1069
981
|
}
|
|
1070
982
|
|
|
1071
983
|
function handleExportAndPrint ($xeTable: VxeTableConstructor, options: VxeTablePropTypes.ExportOpts | VxeTablePropTypes.ExportConfig, isPrint?: any) {
|
|
@@ -1121,7 +1033,7 @@ function handleExportAndPrint ($xeTable: VxeTableConstructor, options: VxeTableP
|
|
|
1121
1033
|
})
|
|
1122
1034
|
// 默认选中
|
|
1123
1035
|
XEUtils.eachTree(exportColumns, (column, index, items, path, parent) => {
|
|
1124
|
-
const isColGroup = column.children && column.children.length
|
|
1036
|
+
const isColGroup = column.children && column.children.length > 0
|
|
1125
1037
|
let isChecked = false
|
|
1126
1038
|
if (columns && columns.length) {
|
|
1127
1039
|
isChecked = handleFilterColumns(defOpts, column, columns)
|
|
@@ -1249,16 +1161,16 @@ export default {
|
|
|
1249
1161
|
* 如果是启用了虚拟滚动,则只能导出数据源,可以配合 dataFilterMethod 函数转换数据
|
|
1250
1162
|
* @param {Object} options 参数
|
|
1251
1163
|
*/
|
|
1252
|
-
_exportData (options
|
|
1253
|
-
const $xeTable = this
|
|
1164
|
+
_exportData (options?: VxeTablePropTypes.ExportConfig) {
|
|
1165
|
+
const $xeTable = this as VxeTableConstructor & VxeTablePrivateMethods
|
|
1254
1166
|
const props = $xeTable
|
|
1255
|
-
const reactData = $xeTable
|
|
1256
|
-
const internalData = $xeTable
|
|
1167
|
+
const reactData = $xeTable as unknown as TableReactData
|
|
1168
|
+
const internalData = $xeTable as unknown as TableInternalData
|
|
1257
1169
|
const $xeGrid = $xeTable.$xeGrid as VxeGridConstructor
|
|
1258
1170
|
|
|
1259
1171
|
const { treeConfig, showHeader, showFooter } = props
|
|
1260
|
-
const {
|
|
1261
|
-
const { tableFullColumn, afterFullData, mergeBodyList,
|
|
1172
|
+
const { isGroup } = reactData
|
|
1173
|
+
const { tableFullColumn, afterFullData, collectColumn, mergeBodyList, mergeFooterList } = internalData
|
|
1262
1174
|
const exportOpts = $xeTable.computeExportOpts
|
|
1263
1175
|
const treeOpts = $xeTable.computeTreeOpts
|
|
1264
1176
|
const proxyOpts = $xeGrid ? $xeGrid.computeProxyOpts : {}
|
|
@@ -1294,10 +1206,14 @@ export default {
|
|
|
1294
1206
|
if (!mode) {
|
|
1295
1207
|
mode = selectRecords.length ? 'selected' : 'current'
|
|
1296
1208
|
}
|
|
1297
|
-
|
|
1298
|
-
|
|
1299
|
-
|
|
1300
|
-
|
|
1209
|
+
let isCustomCol = false
|
|
1210
|
+
let customCols = []
|
|
1211
|
+
if (columns && columns.length) {
|
|
1212
|
+
isCustomCol = true
|
|
1213
|
+
customCols = columns
|
|
1214
|
+
} else {
|
|
1215
|
+
customCols = XEUtils.searchTree(collectColumn, column => {
|
|
1216
|
+
const isColGroup = column.children && column.children.length > 0
|
|
1301
1217
|
let isChecked = false
|
|
1302
1218
|
if (columns && columns.length) {
|
|
1303
1219
|
isChecked = handleFilterColumns(opts, column, columns)
|
|
@@ -1308,10 +1224,11 @@ export default {
|
|
|
1308
1224
|
}
|
|
1309
1225
|
return isChecked
|
|
1310
1226
|
}, { children: 'children', mapChildren: 'childNodes', original: true })
|
|
1227
|
+
}
|
|
1311
1228
|
const handleOptions: VxeTablePropTypes.ExportHandleOptions = Object.assign({ } as { data: any[], colgroups: any[], columns: any[] }, opts, { filename: '', sheetName: '' })
|
|
1312
1229
|
// 如果设置源数据,则默认导出设置了字段的列
|
|
1313
|
-
if (!
|
|
1314
|
-
|
|
1230
|
+
if (!isCustomCol && !columnFilterMethod) {
|
|
1231
|
+
columnFilterMethod = ({ column }) => {
|
|
1315
1232
|
if (excludeFields) {
|
|
1316
1233
|
if (XEUtils.includes(excludeFields, column.field)) {
|
|
1317
1234
|
return false
|
|
@@ -1323,8 +1240,9 @@ export default {
|
|
|
1323
1240
|
}
|
|
1324
1241
|
return false
|
|
1325
1242
|
}
|
|
1326
|
-
return original ? column.field : defaultFilterExportColumn(column)
|
|
1243
|
+
return original ? !!column.field : defaultFilterExportColumn(column)
|
|
1327
1244
|
}
|
|
1245
|
+
handleOptions.columnFilterMethod = columnFilterMethod
|
|
1328
1246
|
}
|
|
1329
1247
|
if (customCols) {
|
|
1330
1248
|
handleOptions._isCustomColumn = true
|
|
@@ -1356,7 +1274,7 @@ export default {
|
|
|
1356
1274
|
children: 'childNodes',
|
|
1357
1275
|
mapChildren: '_children'
|
|
1358
1276
|
}),
|
|
1359
|
-
(column, index) => isColumnInfo(column) && (!columnFilterMethod || columnFilterMethod({ column: column as any, $columnIndex: index })),
|
|
1277
|
+
(column, index) => isColumnInfo(column) && (!columnFilterMethod || columnFilterMethod({ $table: $xeTable, column: column as any, $columnIndex: index })),
|
|
1360
1278
|
{
|
|
1361
1279
|
children: '_children',
|
|
1362
1280
|
mapChildren: 'childNodes',
|
|
@@ -1364,7 +1282,7 @@ export default {
|
|
|
1364
1282
|
}
|
|
1365
1283
|
)
|
|
1366
1284
|
} else {
|
|
1367
|
-
groups = XEUtils.searchTree(isGroup ? collectColumn : tableFullColumn, (column, index) => column.visible && (!columnFilterMethod || columnFilterMethod({ column, $columnIndex: index })), { children: 'children', mapChildren: 'childNodes', original: true })
|
|
1285
|
+
groups = XEUtils.searchTree(isGroup ? collectColumn : tableFullColumn, (column, index) => column.visible && (!columnFilterMethod || columnFilterMethod({ $table: $xeTable, column, $columnIndex: index })), { children: 'children', mapChildren: 'childNodes', original: true })
|
|
1368
1286
|
}
|
|
1369
1287
|
// 获取所有列
|
|
1370
1288
|
const cols: VxeTableDefines.ColumnInfo[] = []
|
|
@@ -1410,10 +1328,8 @@ export default {
|
|
|
1410
1328
|
// 检查类型,如果为自定义导出,则不需要校验类型
|
|
1411
1329
|
if (!handleOptions.exportMethod && !XEUtils.includes(XEUtils.keys(exportOpts._typeMaps), type)) {
|
|
1412
1330
|
errLog('vxe.error.notType', [type])
|
|
1413
|
-
if (
|
|
1414
|
-
|
|
1415
|
-
warnLog('vxe.error.reqPlugin', [4, 'plugin-export-xlsx'])
|
|
1416
|
-
}
|
|
1331
|
+
if (['xlsx', 'pdf'].includes(type)) {
|
|
1332
|
+
warnLog('vxe.error.reqPlugin', [4, 'plugin-export-xlsx'])
|
|
1417
1333
|
}
|
|
1418
1334
|
const params = { status: false }
|
|
1419
1335
|
return Promise.reject(params)
|
|
@@ -1434,10 +1350,8 @@ export default {
|
|
|
1434
1350
|
handleOptions.data = selectRecords
|
|
1435
1351
|
}
|
|
1436
1352
|
} else if (mode === 'all') {
|
|
1437
|
-
if (
|
|
1438
|
-
|
|
1439
|
-
warnLog('vxe.error.errProp', ['all', 'mode=current,selected'])
|
|
1440
|
-
}
|
|
1353
|
+
if (!$xeGrid) {
|
|
1354
|
+
errLog('vxe.error.errProp', ['all', 'mode=current,selected'])
|
|
1441
1355
|
}
|
|
1442
1356
|
|
|
1443
1357
|
if ($xeGrid && !handleOptions.remote) {
|
|
@@ -1450,10 +1364,8 @@ export default {
|
|
|
1450
1364
|
const queryAllSuccessMethods = ajax.queryAllSuccess
|
|
1451
1365
|
const queryAllErrorMethods = ajax.queryAllError
|
|
1452
1366
|
|
|
1453
|
-
if (
|
|
1454
|
-
|
|
1455
|
-
warnLog('vxe.error.notFunc', ['proxy-config.ajax.queryAll'])
|
|
1456
|
-
}
|
|
1367
|
+
if (!ajaxMethods) {
|
|
1368
|
+
errLog('vxe.error.notFunc', ['proxy-config.ajax.queryAll'])
|
|
1457
1369
|
}
|
|
1458
1370
|
|
|
1459
1371
|
if (ajaxMethods) {
|
|
@@ -1491,15 +1403,19 @@ export default {
|
|
|
1491
1403
|
}
|
|
1492
1404
|
return handleExport($xeTable, handleOptions)
|
|
1493
1405
|
},
|
|
1494
|
-
_importByFile (file:
|
|
1406
|
+
_importByFile (file: File, options: VxeTablePropTypes.ImportConfig) {
|
|
1407
|
+
const $xeTable = this as VxeTableConstructor & VxeTablePrivateMethods
|
|
1408
|
+
|
|
1495
1409
|
const opts = Object.assign({}, options)
|
|
1496
1410
|
const { beforeImportMethod } = opts
|
|
1497
1411
|
if (beforeImportMethod) {
|
|
1498
|
-
beforeImportMethod({ options: opts, $table:
|
|
1412
|
+
beforeImportMethod({ options: opts, $table: $xeTable })
|
|
1499
1413
|
}
|
|
1500
|
-
return handleFileImport(
|
|
1414
|
+
return handleFileImport($xeTable, file, opts)
|
|
1501
1415
|
},
|
|
1502
|
-
_importData (options
|
|
1416
|
+
_importData (options?: VxeTablePropTypes.ImportConfig) {
|
|
1417
|
+
const $xeTable = this as VxeTableConstructor & VxeTablePrivateMethods
|
|
1418
|
+
|
|
1503
1419
|
const { importOpts } = this
|
|
1504
1420
|
const opts = Object.assign({
|
|
1505
1421
|
types: XEUtils.keys(importOpts._typeMaps)
|
|
@@ -1510,24 +1426,32 @@ export default {
|
|
|
1510
1426
|
if (beforeImportMethod) {
|
|
1511
1427
|
beforeImportMethod({ options: opts, $table: this })
|
|
1512
1428
|
}
|
|
1513
|
-
return
|
|
1429
|
+
return VxeUI.readFile(opts).catch(e => {
|
|
1514
1430
|
if (afterImportMethod) {
|
|
1515
|
-
afterImportMethod({ status: false, options: opts, $table:
|
|
1431
|
+
afterImportMethod({ status: false, options: opts, $table: $xeTable })
|
|
1516
1432
|
}
|
|
1517
1433
|
return Promise.reject(e)
|
|
1518
|
-
}).then((params
|
|
1434
|
+
}).then((params) => {
|
|
1519
1435
|
const { file } = params
|
|
1520
|
-
return handleFileImport(
|
|
1436
|
+
return handleFileImport($xeTable, file, opts)
|
|
1521
1437
|
})
|
|
1522
1438
|
},
|
|
1523
|
-
_saveFile (options:
|
|
1524
|
-
|
|
1439
|
+
_saveFile (options: {
|
|
1440
|
+
filename: string
|
|
1441
|
+
type: string
|
|
1442
|
+
content: string | Blob
|
|
1443
|
+
}) {
|
|
1444
|
+
return VxeUI.saveFile(options)
|
|
1525
1445
|
},
|
|
1526
|
-
_readFile (options
|
|
1527
|
-
|
|
1446
|
+
_readFile (options?: {
|
|
1447
|
+
multiple?: boolean
|
|
1448
|
+
types?: string[]
|
|
1449
|
+
message?: boolean
|
|
1450
|
+
}) {
|
|
1451
|
+
return VxeUI.readFile(options)
|
|
1528
1452
|
},
|
|
1529
|
-
_print (options
|
|
1530
|
-
const $xeTable = this
|
|
1453
|
+
_print (options?: VxeTablePropTypes.PrintConfig) {
|
|
1454
|
+
const $xeTable = this as VxeTableConstructor & VxeTablePrivateMethods
|
|
1531
1455
|
const $xeGrid = $xeTable.$xeGrid
|
|
1532
1456
|
|
|
1533
1457
|
const opts = Object.assign({
|
|
@@ -1607,7 +1531,7 @@ export default {
|
|
|
1607
1531
|
})
|
|
1608
1532
|
},
|
|
1609
1533
|
_getPrintHtml (options: VxeTablePropTypes.PrintConfig) {
|
|
1610
|
-
const $xeTable = this
|
|
1534
|
+
const $xeTable = this as VxeTableConstructor & VxeTablePrivateMethods
|
|
1611
1535
|
|
|
1612
1536
|
const printOpts = $xeTable.computePrintOpts
|
|
1613
1537
|
const opts = Object.assign({
|
|
@@ -1631,24 +1555,30 @@ export default {
|
|
|
1631
1555
|
}
|
|
1632
1556
|
return Promise.resolve()
|
|
1633
1557
|
},
|
|
1634
|
-
_openImport (options
|
|
1635
|
-
const
|
|
1558
|
+
_openImport (options?: VxeTablePropTypes.ImportConfig) {
|
|
1559
|
+
const $xeTable = this as VxeTableConstructor & VxeTablePrivateMethods
|
|
1560
|
+
const props = $xeTable
|
|
1561
|
+
const reactData = $xeTable as unknown as TableReactData
|
|
1562
|
+
|
|
1563
|
+
const { treeConfig, importConfig } = props
|
|
1564
|
+
const { initStore, importStore, importParams } = reactData
|
|
1565
|
+
const importOpts = $xeTable.computeImportOpts
|
|
1636
1566
|
const defOpts = Object.assign({
|
|
1637
1567
|
mode: 'insertTop',
|
|
1638
1568
|
message: true,
|
|
1639
1569
|
types: XEUtils.keys(importOpts._typeMaps),
|
|
1640
1570
|
modes: ['insertTop', 'covering']
|
|
1641
|
-
},
|
|
1571
|
+
}, importOpts, options)
|
|
1642
1572
|
const types = defOpts.types || []
|
|
1643
1573
|
const modes = defOpts.modes || []
|
|
1644
|
-
const isTree = !!
|
|
1574
|
+
const isTree = !!treeConfig
|
|
1645
1575
|
if (isTree) {
|
|
1646
1576
|
if (defOpts.message) {
|
|
1647
1577
|
VxeUI.modal.message({ content: getI18n('vxe.error.treeNotImp'), status: 'error' })
|
|
1648
1578
|
}
|
|
1649
1579
|
return
|
|
1650
1580
|
}
|
|
1651
|
-
if (!
|
|
1581
|
+
if (!importConfig) {
|
|
1652
1582
|
errLog('vxe.error.reqProp', ['import-config'])
|
|
1653
1583
|
}
|
|
1654
1584
|
// 处理类型
|
|
@@ -1670,7 +1600,7 @@ export default {
|
|
|
1670
1600
|
label: getI18n(`vxe.import.modes.${item}`)
|
|
1671
1601
|
}
|
|
1672
1602
|
})
|
|
1673
|
-
Object.assign(
|
|
1603
|
+
Object.assign(importStore, {
|
|
1674
1604
|
file: null,
|
|
1675
1605
|
type: '',
|
|
1676
1606
|
filename: '',
|
|
@@ -1678,27 +1608,40 @@ export default {
|
|
|
1678
1608
|
typeList,
|
|
1679
1609
|
visible: true
|
|
1680
1610
|
})
|
|
1681
|
-
Object.assign(
|
|
1682
|
-
if (!modeList.some(
|
|
1683
|
-
|
|
1611
|
+
Object.assign(importParams, defOpts)
|
|
1612
|
+
if (!modeList.some(item => item.value === importParams.mode)) {
|
|
1613
|
+
importParams.mode = modeList[0].value
|
|
1684
1614
|
}
|
|
1685
|
-
|
|
1615
|
+
initStore.import = true
|
|
1686
1616
|
},
|
|
1687
1617
|
_closeExport: handleCloseExport,
|
|
1688
1618
|
_openExport (options: any) {
|
|
1689
|
-
const
|
|
1690
|
-
|
|
1619
|
+
const $xeTable = this as VxeTableConstructor & VxeTablePrivateMethods
|
|
1620
|
+
const props = $xeTable
|
|
1621
|
+
|
|
1622
|
+
const exportOpts = $xeTable.computeExportOpts
|
|
1623
|
+
const defOpts = Object.assign({
|
|
1624
|
+
message: true,
|
|
1625
|
+
types: XEUtils.keys(exportOpts._typeMaps)
|
|
1626
|
+
}, exportOpts, options)
|
|
1627
|
+
if (!props.exportConfig) {
|
|
1691
1628
|
errLog('vxe.error.reqProp', ['export-config'])
|
|
1692
1629
|
}
|
|
1693
|
-
return handleExportAndPrint(
|
|
1630
|
+
return handleExportAndPrint($xeTable, defOpts)
|
|
1694
1631
|
},
|
|
1695
1632
|
_closePrint: handleCloseExport,
|
|
1696
1633
|
_openPrint (options: any) {
|
|
1697
|
-
const
|
|
1698
|
-
|
|
1634
|
+
const $xeTable = this as VxeTableConstructor & VxeTablePrivateMethods
|
|
1635
|
+
const props = $xeTable
|
|
1636
|
+
|
|
1637
|
+
const printOpts = $xeTable.computePrintOpts
|
|
1638
|
+
const defOpts = Object.assign({
|
|
1639
|
+
message: true
|
|
1640
|
+
}, printOpts, options)
|
|
1641
|
+
if (!props.printConfig) {
|
|
1699
1642
|
errLog('vxe.error.reqProp', ['print-config'])
|
|
1700
1643
|
}
|
|
1701
|
-
return handleExportAndPrint(
|
|
1644
|
+
return handleExportAndPrint($xeTable, defOpts, true)
|
|
1702
1645
|
}
|
|
1703
1646
|
} as any
|
|
1704
1647
|
} as any
|
|
@@ -116,9 +116,7 @@ export default {
|
|
|
116
116
|
this.handleOpenMenuEvent(evnt, layout, params)
|
|
117
117
|
// 在 v4 中废弃事件 cell-context-menu、header-cell-context-menu、footer-cell-context-menu
|
|
118
118
|
if (this.$listeners[`${typePrefix}cell-context-menu`]) {
|
|
119
|
-
|
|
120
|
-
warnLog('vxe.error.delEvent', [`${typePrefix}cell-context-menu`, `${typePrefix}cell-menu`])
|
|
121
|
-
}
|
|
119
|
+
warnLog('vxe.error.delEvent', [`${typePrefix}cell-context-menu`, `${typePrefix}cell-menu`])
|
|
122
120
|
this.emitEvent(`${typePrefix}cell-context-menu`, params, evnt)
|
|
123
121
|
} else {
|
|
124
122
|
this.emitEvent(`${typePrefix}cell-menu`, params, evnt)
|
|
@@ -270,9 +268,7 @@ export default {
|
|
|
270
268
|
}
|
|
271
269
|
// 在 v4 中废弃事件 context-menu-click
|
|
272
270
|
if (this.$listeners['context-menu-click']) {
|
|
273
|
-
|
|
274
|
-
warnLog('vxe.error.delEvent', ['context-menu-click', 'menu-click'])
|
|
275
|
-
}
|
|
271
|
+
warnLog('vxe.error.delEvent', ['context-menu-click', 'menu-click'])
|
|
276
272
|
this.emitEvent('context-menu-click', params, evnt)
|
|
277
273
|
} else {
|
|
278
274
|
this.emitEvent('menu-click', params, evnt)
|