1
0
mirror of synced 2025-11-06 04:10:39 +08:00
This commit is contained in:
xuliangzhan
2022-09-25 11:36:48 +08:00
parent 1b586be72b
commit 7f97523626
4 changed files with 49 additions and 38 deletions

1
.gitignore vendored
View File

@@ -1,4 +1,5 @@
.DS_Store
.history
node_modules
/dist
package-lock.json

View File

@@ -4,6 +4,11 @@ const uglify = require('gulp-uglify')
const babel = require('gulp-babel')
const rename = require('gulp-rename')
const replace = require('gulp-replace')
const dartSass = require('sass')
const gulpSass = require('gulp-sass')
const sass = gulpSass(dartSass)
const cleanCSS = require('gulp-clean-css')
const prefixer = require('gulp-autoprefixer')
const sourcemaps = require('gulp-sourcemaps')
const ts = require('gulp-typescript')
const pack = require('./package.json')

View File

@@ -128,8 +128,8 @@ function exportXLSX (params: VxeGlobalInterceptorHandles.InterceptorExportParams
let beforeRowCount = 0
const colHead: any = {}
columns.forEach((column) => {
const { id, property, renderWidth } = column
colHead[id] = original ? property : column.getTitle()
const { id, field, renderWidth } = column
colHead[id] = original ? field : column.getTitle()
sheetCols.push({
key: id,
width: XEUtils.ceil(renderWidth / 8, 1)
@@ -148,7 +148,7 @@ function exportXLSX (params: VxeGlobalInterceptorHandles.InterceptorExportParams
const { _colSpan, _rowSpan } = column
const validColumn = getValidColumn(column)
const columnIndex = columns.indexOf(validColumn)
groupHead[validColumn.id] = original ? validColumn.property : column.getTitle()
groupHead[validColumn.id] = original ? validColumn.field : column.getTitle()
if (_colSpan > 1 || _rowSpan > 1) {
sheetMerges.push({
s: { r: rIndex, c: columnIndex },
@@ -246,18 +246,20 @@ function exportXLSX (params: VxeGlobalInterceptorHandles.InterceptorExportParams
}
excelRow.eachCell(excelCell => {
const excelCol = sheet.getColumn(excelCell.col)
const column: any = $table.getColumnById(excelCol.key as string)
const { align } = column
setExcelCellStyle(excelCell, align || allAlign)
if (useStyle) {
Object.assign(excelCell, {
font: {
color: {
argb: defaultCellFontColor
}
},
border: getDefaultBorderStyle()
})
const column = $table.getColumnById(excelCol.key as string)
if (column) {
const { align } = column
setExcelCellStyle(excelCell, align || allAlign)
if (useStyle) {
Object.assign(excelCell, {
font: {
color: {
argb: defaultCellFontColor
}
},
border: getDefaultBorderStyle()
})
}
}
})
})
@@ -268,18 +270,20 @@ function exportXLSX (params: VxeGlobalInterceptorHandles.InterceptorExportParams
}
excelRow.eachCell(excelCell => {
const excelCol = sheet.getColumn(excelCell.col)
const column: any = $table.getColumnById(excelCol.key as string)
const { footerAlign, align } = column
setExcelCellStyle(excelCell, footerAlign || align || allFooterAlign || allAlign)
if (useStyle) {
Object.assign(excelCell, {
font: {
color: {
argb: defaultCellFontColor
}
},
border: getDefaultBorderStyle()
})
const column = $table.getColumnById(excelCol.key as string)
if (column) {
const { footerAlign, align } = column
setExcelCellStyle(excelCell, footerAlign || align || allFooterAlign || allAlign)
if (useStyle) {
Object.assign(excelCell, {
font: {
color: {
argb: defaultCellFontColor
}
},
border: getDefaultBorderStyle()
})
}
}
})
})
@@ -362,7 +366,7 @@ function importXLSX (params: VxeGlobalInterceptorHandles.InterceptorImportParams
fileReader.onload = (evnt) => {
const tableFields: string[] = []
columns.forEach((column) => {
const field = column.property
const field = column.field
if (field) {
tableFields.push(field)
}

View File

@@ -1,6 +1,6 @@
{
"name": "vxe-table-plugin-export-xlsx",
"version": "3.0.3",
"version": "3.0.4",
"description": "基于 vxe-table 的表格插件,支持导出 xlsx 格式",
"scripts": {
"lib": "gulp build"
@@ -33,24 +33,25 @@
"eslint-plugin-promise": "^4.2.1",
"eslint-plugin-standard": "^4.0.2",
"eslint-plugin-typescript": "^0.14.0",
"exceljs": "^4.2.0",
"exceljs": "^4.3.0",
"gulp": "^4.0.2",
"gulp-autoprefixer": "^7.0.1",
"gulp-autoprefixer": "^8.0.0",
"gulp-babel": "^8.0.0",
"gulp-clean-css": "^4.3.0",
"gulp-concat": "^2.6.1",
"gulp-rename": "^2.0.0",
"gulp-replace": "^1.0.0",
"gulp-sass": "^4.1.0",
"gulp-sourcemaps": "^2.6.5",
"gulp-replace": "^1.1.3",
"gulp-sass": "^5.1.0",
"gulp-sourcemaps": "^3.0.0",
"gulp-typescript": "^5.0.1",
"gulp-uglify": "^3.0.2",
"markdown-doctest": "^1.1.0",
"prettier": "^2.1.2",
"typescript": "^4.0.5",
"vue": "^3.2.14",
"vxe-table": "^4.0.28",
"xe-utils": "^3.4.0"
"sass": "^1.55.0",
"typescript": "^4.6.4",
"vue": "^3.2.39",
"vxe-table": "^4.3.5",
"xe-utils": "^3.5.6"
},
"peerDependencies": {
"vxe-table": "^4.0.27"