Skip to content

Commit 31318bb

Browse files
committed
releases 3.24.0
1 parent d6c7572 commit 31318bb

9 files changed

Lines changed: 45 additions & 25 deletions

File tree

‎package.json‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "vxe-table",
3-
"version": "3.23.11",
3+
"version": "3.24.0-beta.0",
44
"description": "A PC-end table component based on Vxe UI, supporting copy-paste, data pivot table, and high-performance virtual list table solution.",
55
"scripts": {
66
"update": "npm install --legacy-peer-deps",
@@ -65,7 +65,7 @@
6565
"vue-i18n": "^8.15.1",
6666
"vue-router": "^3.5.1",
6767
"vue-template-compiler": "2.6.14",
68-
"vxe-pc-ui": "3.18.10"
68+
"vxe-pc-ui": "3.18.11"
6969
},
7070
"vetur": {
7171
"tags": "helper/vetur/tags.json",

‎packages/table/module/export/mixin.ts‎

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ function getBodyLabelData ($xeTable: VxeTableConstructor & VxeTablePrivateMethod
6666
const { isTreeAllExpanded, isRowGroupAllExpanded, mode: expMode } = opts
6767
const { treeConfig } = props
6868
const { isRowGroupStatus } = reactData
69-
const { fullColumnFieldData } = internalData
69+
const { fullColumnFieldData, fullAllDataRowIdData } = internalData
7070
const radioOpts = $xeTable.computeRadioOpts
7171
const checkboxOpts = $xeTable.computeCheckboxOpts
7272
const treeOpts = $xeTable.computeTreeOpts
@@ -216,8 +216,9 @@ function getBodyLabelData ($xeTable: VxeTableConstructor & VxeTablePrivateMethod
216216
return rest
217217
}
218218
if (treeConfig) {
219-
const childrenField = treeOpts.children || treeOpts.childrenField
220219
// 如果是树结构
220+
const { seqMode } = treeOpts
221+
const childrenField = treeOpts.children || treeOpts.childrenField
221222
const rest: any[] = []
222223
const expandMaps: Record<string, boolean> = {}
223224
const useMaps: Record<string, boolean> = {}
@@ -237,6 +238,7 @@ function getBodyLabelData ($xeTable: VxeTableConstructor & VxeTablePrivateMethod
237238
_hasChild: hasRowChild,
238239
_expand: hasRowChild && $xeTable.isTreeExpandByRow(row)
239240
}
241+
const rowRest = fullAllDataRowIdData[rowid] || {}
240242
columns.forEach((column, $columnIndex) => {
241243
let cellValue: string | number | boolean | null = ''
242244
const renderOpts = column.editRender || column.cellRender
@@ -255,7 +257,10 @@ function getBodyLabelData ($xeTable: VxeTableConstructor & VxeTablePrivateMethod
255257
} else {
256258
switch (column.type) {
257259
case 'seq': {
258-
const seqVal = path.map((num, i) => i % 2 === 0 ? (Number(num) + 1) : '.').join('')
260+
let seqVal: number | string = path.map((num, i) => i % 2 === 0 ? (Number(num) + 1) : '.').join('')
261+
if (seqMode === 'increasing') {
262+
seqVal = rowRest ? (rowRest._index + 1) : -1
263+
}
259264
cellValue = expMode === 'all' ? seqVal : getSeq($xeTable, seqVal, row, $rowIndex, column, $columnIndex)
260265
break
261266
}

‎packages/table/src/cell.ts‎

Lines changed: 19 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -477,16 +477,24 @@ export const Cell = {
477477
if (defaultSlot) {
478478
return renderCellBaseVNs(h, params, $table.callSlot(defaultSlot, params, h))
479479
}
480-
const renderOpts = editRenderOpts || cellRenderOpts
481-
// 如果是编辑表格:renderTableCell > formatter
482-
// 如果是查看表格:renderTableDefault > formatter
483-
if (renderOpts) {
484-
const compConf = renderer.get(renderOpts.name)
485-
if (compConf) {
486-
const renderFn = editRenderOpts ? (compConf.renderTableCell || compConf.renderCell) : (compConf.renderTableDefault || compConf.renderDefault)
487-
if (renderFn) {
488-
return renderCellBaseVNs(h, params, getSlotVNs(renderFn.call($table, h, renderOpts, Object.assign({ $type: editRenderOpts ? 'edit' : 'cell' }, params))))
489-
}
480+
// 如果是编辑模式-查看:slot default > formatter > cellRender.renderTableDefault > editRender.renderTableCell > editRender.renderTableDefault > cellRender.tableCellFormatter > editRender.tableCellFormatter > field
481+
// 如果是查看表格:slot default > formatter > cellRender。renderTableDefault > cellRender.tableCellFormatter > field
482+
const cellCompConf = cellRenderOpts ? renderer.get(cellRenderOpts.name) : null
483+
if (cellRenderOpts) {
484+
const cellDefaultRenderFn = cellCompConf ? (cellCompConf.renderTableDefault || cellCompConf.renderDefault) : null
485+
if (cellDefaultRenderFn && cellRenderOpts) {
486+
return renderCellBaseVNs(h, params, getSlotVNs(cellDefaultRenderFn(h, cellRenderOpts, Object.assign({ $type: editRenderOpts ? 'edit' : 'cell' }, params))))
487+
}
488+
}
489+
if (editRenderOpts) {
490+
const editCompConf = editRenderOpts ? renderer.get(editRenderOpts.name) : null
491+
const editCellRenderFn = editCompConf
492+
? (
493+
(editCompConf.renderTableCell || editCompConf.renderCell) ||
494+
(editCompConf.renderTableDefault || editCompConf.renderDefault))
495+
: null
496+
if (editCellRenderFn) {
497+
return renderCellBaseVNs(h, params, getSlotVNs(editCellRenderFn(h, editRenderOpts, Object.assign({ $type: editRenderOpts ? 'edit' : 'cell' }, params))))
490498
}
491499
}
492500
cellValue = $table.getCellLabel(row, column)
@@ -1319,6 +1327,7 @@ export const Cell = {
13191327
}
13201328
}
13211329

1330+
// slot default > formatter
13221331
if (formatter) {
13231332
return renderCellBaseVNs(h, params, [
13241333
h('span', {

‎packages/table/src/methods.ts‎

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5774,13 +5774,17 @@ const tableMethods: any = {
57745774
clOpSize = cellRender.options ? cellRender.options.length : 0
57755775
clOgSize = cellRender.optionGroups ? cellRender.optionGroups.length : 0
57765776
}
5777-
// formatter > tableCellFormatter
5778-
const renderOpts = formatter ? null : (editConfig && isEnableConf(editRender) ? editRender : (isEnableConf(cellRender) ? cellRender : null))
5779-
const compConf = renderOpts ? renderer.get(renderOpts.name) : null
5780-
const tcFormatter = compConf ? compConf.tableCellFormatter : null
5777+
const isEnableEdit = editConfig && isEnableConf(editConfig)
5778+
const editRenderOpts = formatter ? null : (isEnableEdit && isEnableConf(editRender) ? editRender : null)
5779+
const cellRenderOpts = formatter ? null : (isEnableConf(cellRender) ? cellRender : null)
5780+
// formatter > cellRender.tableCellFormatter > editRender.tableCellFormatter
5781+
const cellCompConf = cellRenderOpts ? renderer.get(cellRenderOpts.name) : null
5782+
const editCompConf = editRenderOpts ? renderer.get(editRenderOpts.name) : null
5783+
const cellDfFormatter = cellCompConf ? cellCompConf.tableCellFormatter : null
5784+
const editDfFormatter = editCompConf ? editCompConf.tableCellFormatter : null
57815785
const cellValue = getCellValue(row, column)
57825786
let cellLabel = cellValue
5783-
if (formatter || tcFormatter) {
5787+
if (formatter || cellDfFormatter || editDfFormatter) {
57845788
let formatData: Record<string, VxeTableDefines.RowCacheFormatObj> | undefined
57855789
const { fullAllDataRowIdData } = internalData
57865790
const rowid = getRowid($xeTable, row)
@@ -5818,8 +5822,10 @@ const tableMethods: any = {
58185822
} else {
58195823
cellLabel = formatter(formatParams)
58205824
}
5821-
} else if (renderOpts && tcFormatter) {
5822-
cellLabel = tcFormatter(renderOpts, formatParams)
5825+
} else if (cellRenderOpts && cellDfFormatter) {
5826+
cellLabel = cellDfFormatter(cellRenderOpts, formatParams)
5827+
} else if (editRenderOpts && editDfFormatter) {
5828+
cellLabel = editDfFormatter(editRenderOpts, formatParams)
58235829
}
58245830
if (formatData) {
58255831
const ftValue = [cellValue, etOpSize, etOgSize, clOpSize, clOgSize]

0 commit comments

Comments
 (0)