Skip to content

Commit

Permalink
releases 4.9.30
Browse files Browse the repository at this point in the history
  • Loading branch information
xuliangzhan committed Dec 18, 2024
1 parent 8228c5b commit 5e1cb49
Show file tree
Hide file tree
Showing 24 changed files with 197 additions and 42 deletions.
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "vxe-table",
"version": "4.9.29",
"version": "4.9.30",
"description": "一个基于 vue 的 PC 端表格组件,支持增删改查、虚拟树、拖拽排序,懒加载、快捷菜单、数据校验、树形结构、打印、导入导出、自定义模板、渲染器、JSON 配置式...",
"scripts": {
"update": "npm install --legacy-peer-deps",
Expand Down Expand Up @@ -28,7 +28,7 @@
"style": "lib/style.css",
"typings": "types/index.d.ts",
"dependencies": {
"vxe-pc-ui": "^4.3.35"
"vxe-pc-ui": "^4.3.36"
},
"devDependencies": {
"@types/resize-observer-browser": "^0.1.11",
Expand Down
3 changes: 3 additions & 0 deletions packages/locale/lang/ar-EG.ts
Original file line number Diff line number Diff line change
Expand Up @@ -289,6 +289,9 @@ export default {
}
}
},
numberInput: {
currencySymbol: '$'
},
imagePreview: {
popupTitle: '预览',
operBtn: {
Expand Down
3 changes: 3 additions & 0 deletions packages/locale/lang/de-DE.ts
Original file line number Diff line number Diff line change
Expand Up @@ -289,6 +289,9 @@ export default {
}
}
},
numberInput: {
currencySymbol: '$'
},
imagePreview: {
popupTitle: '预览',
operBtn: {
Expand Down
3 changes: 3 additions & 0 deletions packages/locale/lang/en-US.ts
Original file line number Diff line number Diff line change
Expand Up @@ -289,6 +289,9 @@ export default {
}
}
},
numberInput: {
currencySymbol: '$'
},
imagePreview: {
popupTitle: 'Preview',
operBtn: {
Expand Down
3 changes: 3 additions & 0 deletions packages/locale/lang/es-ES.ts
Original file line number Diff line number Diff line change
Expand Up @@ -289,6 +289,9 @@ export default {
}
}
},
numberInput: {
currencySymbol: '$'
},
imagePreview: {
popupTitle: 'Preview',
operBtn: {
Expand Down
3 changes: 3 additions & 0 deletions packages/locale/lang/fr-FR.ts
Original file line number Diff line number Diff line change
Expand Up @@ -289,6 +289,9 @@ export default {
}
}
},
numberInput: {
currencySymbol: '$'
},
imagePreview: {
popupTitle: '预览',
operBtn: {
Expand Down
3 changes: 3 additions & 0 deletions packages/locale/lang/hu-HU.ts
Original file line number Diff line number Diff line change
Expand Up @@ -289,6 +289,9 @@ export default {
}
}
},
numberInput: {
currencySymbol: '$'
},
imagePreview: {
popupTitle: 'Előnézet',
operBtn: {
Expand Down
3 changes: 3 additions & 0 deletions packages/locale/lang/hy-AM.ts
Original file line number Diff line number Diff line change
Expand Up @@ -289,6 +289,9 @@ export default {
}
}
},
numberInput: {
currencySymbol: '$'
},
imagePreview: {
popupTitle: '预览',
operBtn: {
Expand Down
3 changes: 3 additions & 0 deletions packages/locale/lang/ja-JP.ts
Original file line number Diff line number Diff line change
Expand Up @@ -289,6 +289,9 @@ export default {
}
}
},
numberInput: {
currencySymbol: '$'
},
imagePreview: {
popupTitle: 'Preview',
operBtn: {
Expand Down
3 changes: 3 additions & 0 deletions packages/locale/lang/ko-KR.ts
Original file line number Diff line number Diff line change
Expand Up @@ -289,6 +289,9 @@ export default {
}
}
},
numberInput: {
currencySymbol: '$'
},
imagePreview: {
popupTitle: '预览',
operBtn: {
Expand Down
3 changes: 3 additions & 0 deletions packages/locale/lang/nb-NO.ts
Original file line number Diff line number Diff line change
Expand Up @@ -289,6 +289,9 @@ export default {
}
}
},
numberInput: {
currencySymbol: '$'
},
imagePreview: {
popupTitle: '预览',
operBtn: {
Expand Down
3 changes: 3 additions & 0 deletions packages/locale/lang/pt-BR.ts
Original file line number Diff line number Diff line change
Expand Up @@ -289,6 +289,9 @@ export default {
}
}
},
numberInput: {
currencySymbol: '$'
},
imagePreview: {
popupTitle: 'Preview',
operBtn: {
Expand Down
3 changes: 3 additions & 0 deletions packages/locale/lang/ru-RU.ts
Original file line number Diff line number Diff line change
Expand Up @@ -289,6 +289,9 @@ export default {
}
}
},
numberInput: {
currencySymbol: '$'
},
imagePreview: {
popupTitle: 'Предварительный просмотр',
operBtn: {
Expand Down
3 changes: 3 additions & 0 deletions packages/locale/lang/ug-CN.ts
Original file line number Diff line number Diff line change
Expand Up @@ -289,6 +289,9 @@ export default {
}
}
},
numberInput: {
currencySymbol: '$'
},
imagePreview: {
popupTitle: 'كۆرۈش',
operBtn: {
Expand Down
3 changes: 3 additions & 0 deletions packages/locale/lang/uk-UA.ts
Original file line number Diff line number Diff line change
Expand Up @@ -289,6 +289,9 @@ export default {
}
}
},
numberInput: {
currencySymbol: '$'
},
imagePreview: {
popupTitle: '预览',
operBtn: {
Expand Down
3 changes: 3 additions & 0 deletions packages/locale/lang/vi-VN.ts
Original file line number Diff line number Diff line change
Expand Up @@ -289,6 +289,9 @@ export default {
}
}
},
numberInput: {
currencySymbol: '$'
},
imagePreview: {
popupTitle: '预览',
operBtn: {
Expand Down
3 changes: 3 additions & 0 deletions packages/locale/lang/zh-CHT.ts
Original file line number Diff line number Diff line change
Expand Up @@ -289,6 +289,9 @@ export default {
}
}
},
numberInput: {
currencySymbol: '¥'
},
imagePreview: {
popupTitle: '預覽',
operBtn: {
Expand Down
3 changes: 3 additions & 0 deletions packages/locale/lang/zh-CN.ts
Original file line number Diff line number Diff line change
Expand Up @@ -289,6 +289,9 @@ export default {
}
}
},
numberInput: {
currencySymbol: '¥'
},
imagePreview: {
popupTitle: '预览',
operBtn: {
Expand Down
43 changes: 28 additions & 15 deletions packages/table/module/export/hook.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ const csvBOM = '\ufeff'
const enterSymbol = '\r\n'

function defaultFilterExportColumn (column: any) {
return column.property || ['seq', 'checkbox', 'radio'].indexOf(column.type) > -1
return column.field || ['seq', 'checkbox', 'radio'].indexOf(column.type) > -1
}

const getConvertColumns = (columns: any) => {
Expand Down Expand Up @@ -271,7 +271,7 @@ function clearColumnConvert (columns: any) {
function checkImportData (columns: any[], fields: string[]) {
const tableFields: string[] = []
columns.forEach((column) => {
const field = column.property
const field = column.field
if (field) {
tableFields.push(field)
}
Expand Down Expand Up @@ -313,7 +313,7 @@ hooks.add('tableExportModule', {
function getHeaderTitle (opts: any, column: any) {
const columnOpts = computeColumnOpts.value
const headExportMethod = column.headerExportMethod || columnOpts.headerExportMethod
return headExportMethod ? headExportMethod({ column, options: opts, $table: $xeTable }) : ((opts.original ? column.property : column.getTitle()) || '')
return headExportMethod ? headExportMethod({ column, options: opts, $table: $xeTable }) : ((opts.original ? column.field : column.getTitle()) || '')
}

const toBooleanValue = (cellValue: any) => {
Expand Down Expand Up @@ -414,7 +414,7 @@ hooks.add('tableExportModule', {
if (!bodyExportMethod && renderOpts && renderOpts.name) {
const compConf = renderer.get(renderOpts.name)
if (compConf) {
bodyExportMethod = compConf.exportMethod
bodyExportMethod = compConf.tableExportMethod || compConf.exportMethod
}
}
if (bodyExportMethod) {
Expand Down Expand Up @@ -995,13 +995,13 @@ hooks.add('tableExportModule', {
} else {
const colid = item.id || item.colId
const type = item.type
const field = item.property || item.field
const field = item.field
if (colid) {
return column.id === colid
} else if (field && type) {
return column.property === field && column.type === type
return column.field === field && column.type === type
} else if (field) {
return column.property === field
return column.field === field
} else if (type) {
return column.type === type
}
Expand Down Expand Up @@ -1059,7 +1059,7 @@ hooks.add('tableExportModule', {
const { tableFullColumn, afterFullData } = internalData
const exportOpts = computeExportOpts.value
const treeOpts = computeTreeOpts.value
const opts: any = Object.assign({
const opts = Object.assign({
// filename: '',
// sheetName: '',
// original: false,
Expand All @@ -1083,16 +1083,29 @@ hooks.add('tableExportModule', {
}, exportOpts, {
print: false
}, options)
const { type, mode, columns, original, beforeExportMethod } = opts
const { type, mode, columns, original, beforeExportMethod, includeFields, excludeFields } = opts
let groups: any[] = []
const customCols = columns && columns.length ? columns : null
let columnFilterMethod = opts.columnFilterMethod
// 如果设置源数据,则默认导出设置了字段的列
if (!customCols && !columnFilterMethod) {
columnFilterMethod = original ? ({ column }: any) => column.property : ({ column }: any) => defaultFilterExportColumn(column)
columnFilterMethod = ({ column }) => {
if (excludeFields) {
if (XEUtils.includes(excludeFields, column.field)) {
return false
}
}
if (includeFields) {
if (XEUtils.includes(includeFields, column.field)) {
return true
}
return false
}
return original ? column.field : defaultFilterExportColumn(column)
}
}
if (customCols) {
opts._isCustomColumn = true
(opts as any)._isCustomColumn = true
groups = XEUtils.searchTree(
XEUtils.mapTree(customCols, (item: any) => {
let targetColumn
Expand All @@ -1104,11 +1117,11 @@ hooks.add('tableExportModule', {
} else {
const colid = item.id || item.colId
const type = item.type
const field = item.property || item.field
const field = item.field
if (colid) {
targetColumn = $xeTable.getColumnById(colid)
} else if (field && type) {
targetColumn = tableFullColumn.find((column: any) => column.property === field && column.type === type)
targetColumn = tableFullColumn.find((column: any) => column.field === field && column.type === type)
} else if (field) {
targetColumn = $xeTable.getColumnByField(field)
} else if (type) {
Expand Down Expand Up @@ -1141,7 +1154,7 @@ hooks.add('tableExportModule', {
}, { children: 'childNodes' })
// 构建分组层级
opts.columns = cols
opts.colgroups = convertToRows(groups)
;(opts as any).colgroups = convertToRows(groups)
if (!opts.filename) {
opts.filename = getI18n(opts.original ? 'vxe.table.expOriginFilename' : 'vxe.table.expFilename', [XEUtils.toDateString(Date.now(), 'yyyyMMddHHmmss')])
}
Expand All @@ -1163,7 +1176,7 @@ hooks.add('tableExportModule', {

if (!opts.print) {
if (beforeExportMethod) {
beforeExportMethod({ options: opts, $table: $xeTable, $grid: $xeGrid })
beforeExportMethod({ options: opts, $table: $xeTable, $grid: $xeGrid } as any)
}
}
if (!opts.data) {
Expand Down
24 changes: 18 additions & 6 deletions packages/table/render/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -578,7 +578,8 @@ renderer.mixin({
renderTableCell (renderOpts, params) {
const { props = {} } = renderOpts
const { row, column } = params
const digits = props.digits || getConfig().input?.digits || 2
const inputConfig = getConfig().input || {}
const digits = props.digits || inputConfig.digits || 2
let cellValue = XEUtils.get(row, column.field)
if (cellValue) {
switch (props.type) {
Expand Down Expand Up @@ -609,12 +610,17 @@ renderer.mixin({
const { type } = props
let cellValue = XEUtils.get(row, column.field)
if (cellValue) {
const numberInputConfig = getConfig().numberInput || {}
if (type === 'float') {
const digits = props.digits || getConfig().numberInput.digits || 1
const digits = props.digits || numberInputConfig.digits || 1
cellValue = XEUtils.toFixed(XEUtils.floor(cellValue, digits), digits)
} else if (type === 'amount') {
const digits = props.digits || getConfig().numberInput.digits || 2
const digits = props.digits || numberInputConfig.digits || 2
cellValue = XEUtils.commafy(XEUtils.toNumber(cellValue), { digits })
const showCurrency = props.showCurrency
if (XEUtils.isBoolean(showCurrency) ? showCurrency : numberInputConfig.showCurrency) {
cellValue = `${props.currencySymbol || numberInputConfig.currencySymbol || getI18n('vxe.numberInput.currencySymbol') || ''}${cellValue}`
}
}
}
return getCellLabelVNs(renderOpts, params, cellValue)
Expand All @@ -626,19 +632,25 @@ renderer.mixin({
// 兼容老模式
const cellValue = XEUtils.isArray(row) ? row[_columnIndex] : XEUtils.get(row, column.field)
if (XEUtils.isNumber(cellValue)) {
const numberInputConfig = getConfig().numberInput || {}
if (type === 'float') {
const digits = props.digits || getConfig().numberInput.digits || 1
const digits = props.digits || numberInputConfig.digits || 1
return XEUtils.toFixed(XEUtils.floor(cellValue, digits), digits)
} else if (type === 'amount') {
const digits = props.digits || getConfig().numberInput.digits || 2
const digits = props.digits || numberInputConfig.digits || 2
return XEUtils.commafy(XEUtils.toNumber(cellValue), { digits })
}
}
return getFuncText(cellValue, 1)
},
renderTableDefault: defaultEditRender,
renderTableFilter: defaultFilterRender,
tableFilterDefaultMethod: handleInputFilterMethod
tableFilterDefaultMethod: handleInputFilterMethod,
tableExportMethod (params) {
const { row, column } = params
const cellValue = XEUtils.get(row, column.field)
return cellValue
}
},
VxeDatePicker: {
tableAutoFocus: 'input',
Expand Down
2 changes: 2 additions & 0 deletions packages/table/src/body.ts
Original file line number Diff line number Diff line change
Expand Up @@ -363,6 +363,7 @@ export default defineComponent({
)
}
}
const isAutoCellWidth = !column.resizeWidth && (column.minWidth === 'auto' || column.width === 'auto')

return h('td', {
class: [
Expand All @@ -376,6 +377,7 @@ export default defineComponent({
'col--tree-node': treeNode,
'col--edit': isEdit,
'col--ellipsis': hasEllipsis,
'fixed--width': !isAutoCellWidth,
'fixed--hidden': fixedHiddenColumn,
'is--drag-cell': isColDragCell,
'is--drag-disabled': isDisabledDrag,
Expand Down
Loading

0 comments on commit 5e1cb49

Please sign in to comment.