Skip to content

Commit

Permalink
releases 3.12.17
Browse files Browse the repository at this point in the history
  • Loading branch information
xuliangzhan committed Feb 13, 2025
1 parent 86c888e commit a2db9e8
Show file tree
Hide file tree
Showing 6 changed files with 327 additions and 102 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "vxe-table",
"version": "3.12.16",
"version": "3.12.17",
"description": "一个基于 vue 的 PC 端表格组件,支持增删改查、虚拟树、拖拽排序,懒加载、快捷菜单、数据校验、树形结构、打印、导入导出、自定义模板、渲染器、JSON 配置式...",
"scripts": {
"update": "npm install --legacy-peer-deps",
Expand Down
10 changes: 5 additions & 5 deletions packages/table/module/edit/mixin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ function insertTreeRow (_vm: any, newRecords: any[], isAppend: any) {
}
parentChilds[funcName](item)
mapChilds[funcName](item)
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 }
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, expandHeight: 0 }
fullDataRowIdData[rowid] = rest
fullAllDataRowIdData[rowid] = rest
} else {
Expand All @@ -86,7 +86,7 @@ function insertTreeRow (_vm: any, newRecords: any[], isAppend: any) {
}
afterFullData[funcName](item)
tableFullTreeData[funcName](item)
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 }
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, expandHeight: 0 }
fullDataRowIdData[rowid] = rest
fullAllDataRowIdData[rowid] = rest
}
Expand Down Expand Up @@ -115,7 +115,7 @@ function handleInsertRowAt ($xeTable: any, records: any[], targetRow: any, isIns
} else {
newRecords.forEach(item => {
const rowid = getRowid($xeTable, item)
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 }
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, expandHeight: 0 }
fullDataRowIdData[rowid] = rest
fullAllDataRowIdData[rowid] = rest
afterFullData.unshift(item)
Expand All @@ -137,7 +137,7 @@ function handleInsertRowAt ($xeTable: any, records: any[], targetRow: any, isIns
} else {
newRecords.forEach(item => {
const rowid = getRowid($xeTable, item)
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 }
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, expandHeight: 0 }
fullDataRowIdData[rowid] = rest
fullAllDataRowIdData[rowid] = rest
afterFullData.push(item)
Expand Down Expand Up @@ -177,7 +177,7 @@ function handleInsertRowAt ($xeTable: any, records: any[], targetRow: any, isIns
targetIndex = targetIndex + 1
}
parentMapChilds.splice(targetIndex, 0, item)
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 }
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, expandHeight: 0 }
fullDataRowIdData[rowid] = rest
fullAllDataRowIdData[rowid] = rest
})
Expand Down
110 changes: 62 additions & 48 deletions packages/table/src/body.ts
Original file line number Diff line number Diff line change
Expand Up @@ -429,7 +429,7 @@ function renderRows (h: CreateElement, _vm: any, fixedType: 'left' | 'right' | '
const tableInternalData = $xeTable as unknown as TableInternalData

const { stripe, rowKey, highlightHoverRow, rowClassName, rowStyle, editConfig, treeConfig } = tableProps
const { hasFixedColumn, treeExpandedMaps, isColLoading, scrollXLoad, scrollYLoad, isAllOverflow, rowExpandedMaps, expandColumn, selectRadioRow, pendingRowMaps, isDragColMove } = tableReactData
const { hasFixedColumn, treeExpandedMaps, isColLoading, scrollXLoad, scrollYLoad, isAllOverflow, rowExpandedMaps, expandColumn, selectRadioRow, pendingRowMaps, isDragColMove, rowExpandHeightFlag } = tableReactData
const { fullAllDataRowIdData } = tableInternalData
const checkboxOpts = $xeTable.computeCheckboxOpts
const radioOpts = $xeTable.computeRadioOpts
Expand Down Expand Up @@ -462,18 +462,18 @@ function renderRows (h: CreateElement, _vm: any, fixedType: 'left' | 'right' | '
}
}
const rowid = getRowid($xeTable, row)
const rest = fullAllDataRowIdData[rowid]
const rowRest = fullAllDataRowIdData[rowid]
let rowLevel = 0
let seq: string | number = -1
let _rowIndex = 0
if (rest) {
rowLevel = rest.level
if (rowRest) {
rowLevel = rowRest.level
if (treeConfig && transform && seqMode === 'increasing') {
seq = rest._index + 1
seq = rowRest._index + 1
} else {
seq = rest.seq
seq = rowRest.seq
}
_rowIndex = rest._index
_rowIndex = rowRest._index
}
const params = { $table: $xeTable, seq, rowid, fixed: fixedType, type: renderType, level: rowLevel, row, rowIndex, $rowIndex, _rowIndex }
// 行是否被展开
Expand Down Expand Up @@ -542,48 +542,66 @@ function renderRows (h: CreateElement, _vm: any, fixedType: 'left' | 'right' | '
// 如果行被展开了
if (isExpandRow) {
const expandOpts = $xeTable.computeExpandOpts
const { height: expandHeight, padding } = expandOpts
const cellStyle: any = {}
if (expandHeight) {
cellStyle.height = `${expandHeight}px`
}
if (treeConfig) {
cellStyle.paddingLeft = `${(rowLevel * treeOpts.indent) + 30}px`
}
const { showOverflow } = expandColumn
const hasEllipsis = (XEUtils.isUndefined(showOverflow) || XEUtils.isNull(showOverflow)) ? isAllOverflow : showOverflow
const expandParams = { $table: $xeTable, seq, column: expandColumn, fixed: fixedType, type: renderType, level: rowLevel, row, rowIndex, $rowIndex, _rowIndex }
rows.push(
h('tr', {
class: ['vxe-body--expanded-row', {
'is--padding': padding
}],
key: `expand_${rowid}`,
style: rowStyle ? (XEUtils.isFunction(rowStyle) ? rowStyle(expandParams) : rowStyle) as VxeComponentStyleType : undefined,
on: trOn
}, [
h('td', {
class: {
'vxe-body--expanded-column': 1,
'fixed--hidden': fixedType && !hasFixedColumn,
'col--ellipsis': hasEllipsis
},
const { height: expandHeight, padding, mode: expandMode } = expandOpts
if (expandMode === 'fixed') {
rows.push(
h('tr', {
class: 'vxe-body--row-expanded-place',
key: `expand_${rowid}`,
attrs: {
colspan: tableColumn.length
rowid
}
}, [
h('div', {
class: {
'vxe-body--expanded-cell': 1,
'is--ellipsis': expandHeight
h('td', {
class: 'vxe-body--row-expanded-place-column',
attrs: {
colspan: tableColumn.length
},
style: cellStyle
style: {
height: `${rowExpandHeightFlag ? (rowRest.expandHeight || expandHeight) : 0}px`
}
})
])
)
} else {
const cellStyle: any = {}
if (expandHeight) {
cellStyle.height = `${expandHeight}px`
}
if (treeConfig) {
cellStyle.paddingLeft = `${(rowLevel * treeOpts.indent) + 30}px`
}
const { showOverflow } = expandColumn
const hasEllipsis = (XEUtils.isUndefined(showOverflow) || XEUtils.isNull(showOverflow)) ? isAllOverflow : showOverflow
const expandParams = { $table: $xeTable, seq, column: expandColumn, fixed: fixedType, type: renderType, level: rowLevel, row, rowIndex, $rowIndex, _rowIndex }
rows.push(
h('tr', {
class: ['vxe-body--expanded-row', {
'is--padding': padding
}],
key: `expand_${rowid}`
}, [
h('td', {
class: ['vxe-body--expanded-column', {
'fixed--hidden': fixedType && !hasFixedColumn,
'col--ellipsis': hasEllipsis
}],
attrs: {
colspan: tableColumn.length
}
}, [
expandColumn.renderData(h, expandParams)
h('div', {
class: ['vxe-body--expanded-cell', {
'is--ellipsis': expandHeight
}],
style: cellStyle
}, [
expandColumn.renderData(h, expandParams)
])
])
])
])
)
)
}
}
// 如果是树形表格
if (isExpandTree) {
Expand Down Expand Up @@ -656,15 +674,14 @@ export default {
const emptyOpts = $xeTable.computeEmptyOpts
const mouseOpts = $xeTable.computeMouseOpts
const rowDragOpts = $xeTable.computeRowDragOpts
const leftFixedWidth = $xeTable.computeLeftFixedWidth
const rightFixedWidth = $xeTable.computeRightFixedWidth
const expandOpts = $xeTable.computeExpandOpts

let renderDataList = tableData
let renderColumnList = tableColumn as VxeTableDefines.ColumnInfo[]
let isOptimizeMode = false
// 如果是使用优化模式
if (scrollXLoad || scrollYLoad || isAllOverflow) {
if (expandColumn || spanMethod || footerSpanMethod) {
if ((expandColumn && expandOpts.mode !== 'fixed') || spanMethod || footerSpanMethod) {
// 如果不支持优化模式
} else {
isOptimizeMode = true
Expand Down Expand Up @@ -744,9 +761,6 @@ export default {
$xeTable.triggerBodyScrollEvent(evnt, fixedType)
}
}
if (scrollYLoad || leftFixedWidth || rightFixedWidth) {
ons.wheel = $xeTable.triggerBodyWheelEvent
}

return h('div', {
ref: 'refElem',
Expand Down
Loading

0 comments on commit a2db9e8

Please sign in to comment.