release 2.9.19
This commit is contained in:
@@ -79,7 +79,8 @@ Latest ✔ | Latest ✔ | Latest ✔ | Latest ✔ | Latest ✔ |
|
||||
* [x] Keyboard navigation
|
||||
* [x] Modal
|
||||
* [x] Renderer
|
||||
* [x] Virtual Scroller
|
||||
* [x] Virtual scroller
|
||||
* [x] Virtual merger
|
||||
* [x] (pro) Cell area selection
|
||||
* [x] (pro) Cell copy & paste
|
||||
* [x] (pro) Cell find and replace
|
||||
|
||||
@@ -80,6 +80,7 @@ Latest ✔ | Latest ✔ | Latest ✔ | Latest ✔ | Latest ✔ |
|
||||
* [x] 模态窗口
|
||||
* [x] 渲染器
|
||||
* [x] 虚拟滚动
|
||||
* [x] 虚拟合并
|
||||
* [x] (pro) 单元格区域选取
|
||||
* [x] (pro) 单元格复制/粘贴
|
||||
* [x] (pro) 单元格查找和替换
|
||||
|
||||
@@ -80,6 +80,7 @@ Latest ✔ | Latest ✔ | Latest ✔ | Latest ✔ | Latest ✔ |
|
||||
* [x] 模態視窗
|
||||
* [x] 渲染器
|
||||
* [x] 虛擬滾動
|
||||
* [x] 虛擬合併
|
||||
* [x] (pro) 儲存格區域選取
|
||||
* [x] (pro) 儲存格複製/粘貼
|
||||
* [x] (pro) 儲存格查找和替換
|
||||
|
||||
@@ -13,4 +13,4 @@
|
||||
var s = document.getElementsByTagName("script")[0];
|
||||
s.parentNode.insertBefore(hm, s);
|
||||
}
|
||||
})();</script><link href=/vxe-table/static/js/chunk-1b979dc0.a7208679.js rel=prefetch><link href=/vxe-table/static/js/chunk-2d216214.a9b84dcf.js rel=prefetch><link href=/vxe-table/static/js/chunk-2d216257.6a8b5f89.js rel=prefetch><link href=/vxe-table/static/css/chunk-vendors.cfd9ba4a.css rel=preload as=style><link href=/vxe-table/static/css/index.385bcafb.css rel=preload as=style><link href=/vxe-table/static/js/chunk-vendors.5740306f.js rel=preload as=script><link href=/vxe-table/static/js/index.34fda8df.js rel=preload as=script><link href=/vxe-table/static/css/chunk-vendors.cfd9ba4a.css rel=stylesheet><link href=/vxe-table/static/css/index.385bcafb.css rel=stylesheet></head><body><noscript><strong>We're sorry but vxe-table doesn't work properly without JavaScript enabled. Please enable it to continue.</strong></noscript><div id=app></div><script src=/vxe-table/static/js/chunk-vendors.5740306f.js></script><script src=/vxe-table/static/js/index.34fda8df.js></script></body></html>
|
||||
})();</script><link href=/vxe-table/static/js/chunk-1b979dc0.a7208679.js rel=prefetch><link href=/vxe-table/static/js/chunk-2d216214.a9b84dcf.js rel=prefetch><link href=/vxe-table/static/js/chunk-2d216257.6a8b5f89.js rel=prefetch><link href=/vxe-table/static/css/chunk-vendors.cfd9ba4a.css rel=preload as=style><link href=/vxe-table/static/css/index.385bcafb.css rel=preload as=style><link href=/vxe-table/static/js/chunk-vendors.5740306f.js rel=preload as=script><link href=/vxe-table/static/js/index.6ddbf0eb.js rel=preload as=script><link href=/vxe-table/static/css/chunk-vendors.cfd9ba4a.css rel=stylesheet><link href=/vxe-table/static/css/index.385bcafb.css rel=stylesheet></head><body><noscript><strong>We're sorry but vxe-table doesn't work properly without JavaScript enabled. Please enable it to continue.</strong></noscript><div id=app></div><script src=/vxe-table/static/js/chunk-vendors.5740306f.js></script><script src=/vxe-table/static/js/index.6ddbf0eb.js></script></body></html>
|
||||
1
docs/static/js/index.34fda8df.js
vendored
1
docs/static/js/index.34fda8df.js
vendored
File diff suppressed because one or more lines are too long
1
docs/static/js/index.6ddbf0eb.js
vendored
Normal file
1
docs/static/js/index.6ddbf0eb.js
vendored
Normal file
File diff suppressed because one or more lines are too long
@@ -13,4 +13,4 @@
|
||||
var s = document.getElementsByTagName("script")[0];
|
||||
s.parentNode.insertBefore(hm, s);
|
||||
}
|
||||
})();</script><link href=/vxe-table/v1/static/css/chunk-vendors.5ca25808.css rel=preload as=style><link href=/vxe-table/v1/static/css/index.c2ce30e6.css rel=preload as=style><link href=/vxe-table/v1/static/js/chunk-vendors.66fa3899.js rel=preload as=script><link href=/vxe-table/v1/static/js/index.7e79c7aa.js rel=preload as=script><link href=/vxe-table/v1/static/css/chunk-vendors.5ca25808.css rel=stylesheet><link href=/vxe-table/v1/static/css/index.c2ce30e6.css rel=stylesheet></head><body><noscript><strong>We're sorry but vxe-table doesn't work properly without JavaScript enabled. Please enable it to continue.</strong></noscript><div id=app></div><script src=/vxe-table/v1/static/js/chunk-vendors.66fa3899.js></script><script src=/vxe-table/v1/static/js/index.7e79c7aa.js></script></body></html>
|
||||
})();</script><link href=/vxe-table/v1/static/css/chunk-vendors.5ca25808.css rel=preload as=style><link href=/vxe-table/v1/static/css/index.c2ce30e6.css rel=preload as=style><link href=/vxe-table/v1/static/js/chunk-vendors.66fa3899.js rel=preload as=script><link href=/vxe-table/v1/static/js/index.eacb6ff1.js rel=preload as=script><link href=/vxe-table/v1/static/css/chunk-vendors.5ca25808.css rel=stylesheet><link href=/vxe-table/v1/static/css/index.c2ce30e6.css rel=stylesheet></head><body><noscript><strong>We're sorry but vxe-table doesn't work properly without JavaScript enabled. Please enable it to continue.</strong></noscript><div id=app></div><script src=/vxe-table/v1/static/js/chunk-vendors.66fa3899.js></script><script src=/vxe-table/v1/static/js/index.eacb6ff1.js></script></body></html>
|
||||
File diff suppressed because one or more lines are too long
1
docs/v1/static/js/index.eacb6ff1.js
Normal file
1
docs/v1/static/js/index.eacb6ff1.js
Normal file
File diff suppressed because one or more lines are too long
@@ -13,4 +13,4 @@
|
||||
var s = document.getElementsByTagName("script")[0];
|
||||
s.parentNode.insertBefore(hm, s);
|
||||
}
|
||||
})();</script><link href=/vxe-table/v2/static/css/chunk-vendors.88b16125.css rel=preload as=style><link href=/vxe-table/v2/static/css/index.409efcab.css rel=preload as=style><link href=/vxe-table/v2/static/js/chunk-vendors.91cdd506.js rel=preload as=script><link href=/vxe-table/v2/static/js/index.fa064b0a.js rel=preload as=script><link href=/vxe-table/v2/static/css/chunk-vendors.88b16125.css rel=stylesheet><link href=/vxe-table/v2/static/css/index.409efcab.css rel=stylesheet></head><body><noscript><strong>We're sorry but vxe-table doesn't work properly without JavaScript enabled. Please enable it to continue.</strong></noscript><div id=app></div><script src=/vxe-table/v2/static/js/chunk-vendors.91cdd506.js></script><script src=/vxe-table/v2/static/js/index.fa064b0a.js></script></body></html>
|
||||
})();</script><link href=/vxe-table/v2/static/css/chunk-vendors.88b16125.css rel=preload as=style><link href=/vxe-table/v2/static/css/index.409efcab.css rel=preload as=style><link href=/vxe-table/v2/static/js/chunk-vendors.91cdd506.js rel=preload as=script><link href=/vxe-table/v2/static/js/index.3b2d5f97.js rel=preload as=script><link href=/vxe-table/v2/static/css/chunk-vendors.88b16125.css rel=stylesheet><link href=/vxe-table/v2/static/css/index.409efcab.css rel=stylesheet></head><body><noscript><strong>We're sorry but vxe-table doesn't work properly without JavaScript enabled. Please enable it to continue.</strong></noscript><div id=app></div><script src=/vxe-table/v2/static/js/chunk-vendors.91cdd506.js></script><script src=/vxe-table/v2/static/js/index.3b2d5f97.js></script></body></html>
|
||||
1
docs/v2/static/js/index.3b2d5f97.js
Normal file
1
docs/v2/static/js/index.3b2d5f97.js
Normal file
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@@ -90,8 +90,8 @@ export default {
|
||||
methods: {
|
||||
footerMethod ({ columns, data }) {
|
||||
const footerData = [
|
||||
columns.map((column, columnIndex) => {
|
||||
if (columnIndex === 0) {
|
||||
columns.map((column, _columnIndex) => {
|
||||
if (_columnIndex === 0) {
|
||||
return '平均'
|
||||
}
|
||||
// 合并为一列显示
|
||||
@@ -100,8 +100,8 @@ export default {
|
||||
}
|
||||
return null
|
||||
}),
|
||||
columns.map((column, columnIndex) => {
|
||||
if (columnIndex === 0) {
|
||||
columns.map((column, _columnIndex) => {
|
||||
if (_columnIndex === 0) {
|
||||
return '和值'
|
||||
}
|
||||
// 合并为一列显示
|
||||
@@ -113,14 +113,14 @@ export default {
|
||||
]
|
||||
return footerData
|
||||
},
|
||||
colspanMethod ({ rowIndex, columnIndex }) {
|
||||
if (rowIndex % 2 === 0) {
|
||||
if (columnIndex === 2) {
|
||||
colspanMethod ({ _rowIndex, _columnIndex }) {
|
||||
if (_rowIndex % 2 === 0) {
|
||||
if (_columnIndex === 2) {
|
||||
return {
|
||||
rowspan: 1,
|
||||
colspan: 2
|
||||
}
|
||||
} else if (columnIndex === 3) {
|
||||
} else if (_columnIndex === 3) {
|
||||
return {
|
||||
rowspan: 0,
|
||||
colspan: 0
|
||||
@@ -128,13 +128,13 @@ export default {
|
||||
}
|
||||
}
|
||||
},
|
||||
footerColspanMethod ({ columnIndex }) {
|
||||
if (columnIndex === 3) {
|
||||
footerColspanMethod ({ _columnIndex }) {
|
||||
if (_columnIndex === 3) {
|
||||
return {
|
||||
rowspan: 1,
|
||||
colspan: 2
|
||||
}
|
||||
} else if (columnIndex === 4) {
|
||||
} else if (_columnIndex === 4) {
|
||||
return {
|
||||
rowspan: 0,
|
||||
colspan: 0
|
||||
@@ -172,8 +172,8 @@ export default {
|
||||
methods: {
|
||||
footerMethod ({ columns, data }) {
|
||||
const footerData = [
|
||||
columns.map((column, columnIndex) => {
|
||||
if (columnIndex === 0) {
|
||||
columns.map((column, _columnIndex) => {
|
||||
if (_columnIndex === 0) {
|
||||
return '平均'
|
||||
}
|
||||
if (['content'].includes(column.property)) {
|
||||
@@ -181,8 +181,8 @@ export default {
|
||||
}
|
||||
return null
|
||||
}),
|
||||
columns.map((column, columnIndex) => {
|
||||
if (columnIndex === 0) {
|
||||
columns.map((column, _columnIndex) => {
|
||||
if (_columnIndex === 0) {
|
||||
return '和值'
|
||||
}
|
||||
if (['content'].includes(column.property)) {
|
||||
@@ -194,18 +194,18 @@ export default {
|
||||
return footerData
|
||||
},
|
||||
// 通用行合并函数(将相同多列数据合并为一行)
|
||||
rowspanMethod ({ row, $rowIndex, column, data }) {
|
||||
rowspanMethod ({ row, _rowIndex, column, visibleData }) {
|
||||
let fields = ['key']
|
||||
let cellValue = row[column.property]
|
||||
if (cellValue && fields.includes(column.property)) {
|
||||
let prevRow = data[$rowIndex - 1]
|
||||
let nextRow = data[$rowIndex + 1]
|
||||
let prevRow = visibleData[_rowIndex - 1]
|
||||
let nextRow = visibleData[_rowIndex + 1]
|
||||
if (prevRow && prevRow[column.property] === cellValue) {
|
||||
return { rowspan: 0, colspan: 0 }
|
||||
} else {
|
||||
let countRowspan = 1
|
||||
while (nextRow && nextRow[column.property] === cellValue) {
|
||||
nextRow = data[++countRowspan + $rowIndex]
|
||||
nextRow = visibleData[++countRowspan + _rowIndex]
|
||||
}
|
||||
if (countRowspan > 1) {
|
||||
return { rowspan: countRowspan, colspan: 1 }
|
||||
@@ -213,13 +213,13 @@ export default {
|
||||
}
|
||||
}
|
||||
},
|
||||
footerRowspanMethod ({ $rowIndex, columnIndex }) {
|
||||
if ($rowIndex === 0) {
|
||||
if (columnIndex === 2) {
|
||||
footerRowspanMethod ({ _rowIndex, _columnIndex }) {
|
||||
if (_rowIndex === 0) {
|
||||
if (_columnIndex === 2) {
|
||||
return { rowspan: 2, colspan: 1 }
|
||||
}
|
||||
} else if ($rowIndex === 1) {
|
||||
if (columnIndex === 2) {
|
||||
} else if (_rowIndex === 1) {
|
||||
if (_columnIndex === 2) {
|
||||
return { rowspan: 0, colspan: 0 }
|
||||
}
|
||||
}
|
||||
@@ -241,8 +241,8 @@ export default {
|
||||
methods: {
|
||||
footerMethod ({ columns, data }) {
|
||||
const footerData = [
|
||||
columns.map((column, columnIndex) => {
|
||||
if (columnIndex === 0) {
|
||||
columns.map((column, _columnIndex) => {
|
||||
if (_columnIndex === 0) {
|
||||
return '平均'
|
||||
}
|
||||
// 合并为一列显示
|
||||
@@ -254,8 +254,8 @@ export default {
|
||||
}
|
||||
return null
|
||||
}),
|
||||
columns.map((column, columnIndex) => {
|
||||
if (columnIndex === 0) {
|
||||
columns.map((column, _columnIndex) => {
|
||||
if (_columnIndex === 0) {
|
||||
return '和值'
|
||||
}
|
||||
// 合并为一列显示
|
||||
@@ -270,14 +270,14 @@ export default {
|
||||
]
|
||||
return footerData
|
||||
},
|
||||
colspanMethod ({ rowIndex, columnIndex }) {
|
||||
if (rowIndex % 2 === 0) {
|
||||
if (columnIndex === 2) {
|
||||
colspanMethod ({ _rowIndex, _columnIndex }) {
|
||||
if (_rowIndex % 2 === 0) {
|
||||
if (_columnIndex === 2) {
|
||||
return {
|
||||
rowspan: 1,
|
||||
colspan: 2
|
||||
}
|
||||
} else if (columnIndex === 3) {
|
||||
} else if (_columnIndex === 3) {
|
||||
return {
|
||||
rowspan: 0,
|
||||
colspan: 0
|
||||
@@ -285,13 +285,13 @@ export default {
|
||||
}
|
||||
}
|
||||
},
|
||||
footerColspanMethod ({ columnIndex }) {
|
||||
if (columnIndex === 3) {
|
||||
footerColspanMethod ({ _columnIndex }) {
|
||||
if (_columnIndex === 3) {
|
||||
return {
|
||||
rowspan: 1,
|
||||
colspan: 2
|
||||
}
|
||||
} else if (columnIndex === 4) {
|
||||
} else if (_columnIndex === 4) {
|
||||
return {
|
||||
rowspan: 0,
|
||||
colspan: 0
|
||||
@@ -299,18 +299,18 @@ export default {
|
||||
}
|
||||
},
|
||||
// 通用行合并函数(将相同多列数据合并为一行)
|
||||
rowspanMethod ({ row, $rowIndex, column, data }) {
|
||||
rowspanMethod ({ row, _rowIndex, column, visibleData }) {
|
||||
const fields = ['key']
|
||||
const cellValue = row[column.property]
|
||||
if (cellValue && fields.includes(column.property)) {
|
||||
const prevRow = data[$rowIndex - 1]
|
||||
let nextRow = data[$rowIndex + 1]
|
||||
const prevRow = visibleData[_rowIndex - 1]
|
||||
let nextRow = visibleData[_rowIndex + 1]
|
||||
if (prevRow && prevRow[column.property] === cellValue) {
|
||||
return { rowspan: 0, colspan: 0 }
|
||||
} else {
|
||||
let countRowspan = 1
|
||||
while (nextRow && nextRow[column.property] === cellValue) {
|
||||
nextRow = data[++countRowspan + $rowIndex]
|
||||
nextRow = visibleData[++countRowspan + _rowIndex]
|
||||
}
|
||||
if (countRowspan > 1) {
|
||||
return { rowspan: countRowspan, colspan: 1 }
|
||||
@@ -318,13 +318,13 @@ export default {
|
||||
}
|
||||
}
|
||||
},
|
||||
footerRowspanMethod ({ $rowIndex, columnIndex }) {
|
||||
if ($rowIndex === 0) {
|
||||
if (columnIndex === 2) {
|
||||
footerRowspanMethod ({ _rowIndex, _columnIndex }) {
|
||||
if (_rowIndex === 0) {
|
||||
if (_columnIndex === 2) {
|
||||
return { rowspan: 2, colspan: 1 }
|
||||
}
|
||||
} else if ($rowIndex === 1) {
|
||||
if (columnIndex === 2) {
|
||||
} else if (_rowIndex === 1) {
|
||||
if (_columnIndex === 2) {
|
||||
return { rowspan: 0, colspan: 0 }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<template>
|
||||
<div>
|
||||
<p class="tip">
|
||||
合并列,通过自定义 <table-api-link prop="span-method"/> 合并方法使用 $rowIndex 获取渲染中的行索引,rowIndex 指向真实数据的行索引,可以根据不同场景使用<br>
|
||||
合并列,通过自定义 <table-api-link prop="span-method"/> 合并方法<br>
|
||||
<span class="red">(注:<table-api-link prop="span-method"/> ,不能用于固定列,合并的逻辑都是自行实现的,该示例仅供参考)</span>
|
||||
</p>
|
||||
|
||||
@@ -57,29 +57,6 @@
|
||||
<code class="javascript">{{ demoCodes[3] }}</code>
|
||||
</pre>
|
||||
|
||||
<p class="tip">通用单元格合并,按区域合并 { row: 起始行, col: 起始列, rowspan: 合并几行, colspan: 合并几列 }</p>
|
||||
|
||||
<vxe-table
|
||||
border
|
||||
resizable
|
||||
height="300"
|
||||
:scroll-y="{gt: -1}"
|
||||
:span-method="mergeMethod"
|
||||
:data="tableData">
|
||||
<vxe-table-column type="seq" width="60"></vxe-table-column>
|
||||
<vxe-table-column field="name" title="Name"></vxe-table-column>
|
||||
<vxe-table-column field="role" title="Role"></vxe-table-column>
|
||||
<vxe-table-column field="sex" title="Sex"></vxe-table-column>
|
||||
<vxe-table-column field="age" title="Age"></vxe-table-column>
|
||||
<vxe-table-column field="date12" title="Date"></vxe-table-column>
|
||||
</vxe-table>
|
||||
|
||||
<p class="demo-code">{{ $t('app.body.button.showCode') }}</p>
|
||||
|
||||
<pre>
|
||||
<code class="xml">{{ demoCodes[4] }}</code>
|
||||
<code class="javascript">{{ demoCodes[5] }}</code>
|
||||
</pre>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
@@ -133,11 +110,11 @@ export default {
|
||||
this.tableData = window.MOCK_DATA_LIST.slice(0, 10)
|
||||
},
|
||||
methods: {
|
||||
colspanMethod ({ rowIndex, columnIndex }) {
|
||||
colspanMethod ({ rowIndex, _columnIndex }) {
|
||||
if (rowIndex % 2 === 0) {
|
||||
if (columnIndex === 2) {
|
||||
if (_columnIndex === 2) {
|
||||
return { rowspan: 1, colspan: 2 }
|
||||
} else if (columnIndex === 3) {
|
||||
} else if (_columnIndex === 3) {
|
||||
return { rowspan: 0, colspan: 0 }
|
||||
}
|
||||
}
|
||||
@@ -171,18 +148,18 @@ export default {
|
||||
},
|
||||
methods: {
|
||||
// 通用行合并函数(将相同多列数据合并为一行)
|
||||
mergeRowMethod ({ row, $rowIndex, column, data }) {
|
||||
mergeRowMethod ({ row, _rowIndex, column, visibleData }) {
|
||||
const fields = ['key']
|
||||
const cellValue = XEUtils.get(row, column.property)
|
||||
if (cellValue && fields.includes(column.property)) {
|
||||
const prevRow = data[$rowIndex - 1]
|
||||
let nextRow = data[$rowIndex + 1]
|
||||
const prevRow = visibleData[_rowIndex - 1]
|
||||
let nextRow = visibleData[_rowIndex + 1]
|
||||
if (prevRow && XEUtils.get(prevRow, column.property) === cellValue) {
|
||||
return { rowspan: 0, colspan: 0 }
|
||||
} else {
|
||||
let countRowspan = 1
|
||||
while (nextRow && XEUtils.get(nextRow, column.property) === cellValue) {
|
||||
nextRow = data[++countRowspan + $rowIndex]
|
||||
nextRow = visibleData[++countRowspan + _rowIndex]
|
||||
}
|
||||
if (countRowspan > 1) {
|
||||
return { rowspan: countRowspan, colspan: 1 }
|
||||
@@ -192,54 +169,6 @@ export default {
|
||||
}
|
||||
}
|
||||
}
|
||||
`,
|
||||
`
|
||||
<vxe-table
|
||||
border
|
||||
resizable
|
||||
height="300"
|
||||
:scroll-y="{gt: -1}"
|
||||
:span-method="mergeMethod"
|
||||
:data="tableData">
|
||||
<vxe-table-column type="seq" width="60"></vxe-table-column>
|
||||
<vxe-table-column field="name" title="Name"></vxe-table-column>
|
||||
<vxe-table-column field="role" title="Role"></vxe-table-column>
|
||||
<vxe-table-column field="sex" title="Sex"></vxe-table-column>
|
||||
<vxe-table-column field="age" title="Age"></vxe-table-column>
|
||||
<vxe-table-column field="date12" title="Date"></vxe-table-column>
|
||||
</vxe-table>
|
||||
`,
|
||||
`
|
||||
export default {
|
||||
data () {
|
||||
return {
|
||||
tableData: [],
|
||||
mergeCells: [
|
||||
{ row: 1, col: 1, rowspan: 3, colspan: 3 },
|
||||
{ row: 6, col: 0, rowspan: 2, colspan: 2 }
|
||||
]
|
||||
}
|
||||
},
|
||||
created () {
|
||||
this.tableData = window.MOCK_DATA_LIST.slice(0, 10)
|
||||
},
|
||||
methods: {
|
||||
// 通用单元格合并函数(将指定区域进行合并)
|
||||
mergeMethod ({ rowIndex, columnIndex }) {
|
||||
const { mergeCells } = this
|
||||
for (let mIndex = 0; mIndex < mergeCells.length; mIndex++) {
|
||||
const { row, col, rowspan, colspan } = mergeCells[mIndex]
|
||||
if (row === rowIndex && col === columnIndex) {
|
||||
return { rowspan, colspan }
|
||||
}
|
||||
if (rowIndex >= row && rowIndex < row + rowspan && columnIndex >= col && columnIndex < col + colspan) {
|
||||
return { rowspan: 0, colspan: 0 }
|
||||
}
|
||||
}
|
||||
return { rowspan: 1, colspan: 1 }
|
||||
}
|
||||
}
|
||||
}
|
||||
`
|
||||
]
|
||||
}
|
||||
@@ -263,38 +192,24 @@ export default {
|
||||
}
|
||||
},
|
||||
// 通用行合并函数(将相同多列数据合并为一行)
|
||||
mergeRowMethod ({ row, $rowIndex, column, data }) {
|
||||
mergeRowMethod ({ row, _rowIndex, column, visibleData }) {
|
||||
const fields = ['key']
|
||||
const cellValue = XEUtils.get(row, column.property)
|
||||
if (cellValue && fields.includes(column.property)) {
|
||||
const prevRow = data[$rowIndex - 1]
|
||||
let nextRow = data[$rowIndex + 1]
|
||||
const prevRow = visibleData[_rowIndex - 1]
|
||||
let nextRow = visibleData[_rowIndex + 1]
|
||||
if (prevRow && XEUtils.get(prevRow, column.property) === cellValue) {
|
||||
return { rowspan: 0, colspan: 0 }
|
||||
} else {
|
||||
let countRowspan = 1
|
||||
while (nextRow && XEUtils.get(nextRow, column.property) === cellValue) {
|
||||
nextRow = data[++countRowspan + $rowIndex]
|
||||
nextRow = visibleData[++countRowspan + _rowIndex]
|
||||
}
|
||||
if (countRowspan > 1) {
|
||||
return { rowspan: countRowspan, colspan: 1 }
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
// 通用单元格合并函数(将指定区域进行合并)
|
||||
mergeMethod ({ rowIndex, columnIndex }) {
|
||||
const { mergeCells } = this
|
||||
for (let mIndex = 0; mIndex < mergeCells.length; mIndex++) {
|
||||
const { row, col, rowspan, colspan } = mergeCells[mIndex]
|
||||
if (row === rowIndex && col === columnIndex) {
|
||||
return { rowspan, colspan }
|
||||
}
|
||||
if (rowIndex >= row && rowIndex < row + rowspan && columnIndex >= col && columnIndex < col + colspan) {
|
||||
return { rowspan: 0, colspan: 0 }
|
||||
}
|
||||
}
|
||||
return { rowspan: 1, colspan: 1 }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -204,18 +204,18 @@ export default {
|
||||
this.tableData = list
|
||||
},
|
||||
// 通用行合并函数(将相同多列数据合并为一行)
|
||||
rowspanMethod ({ row, $rowIndex, column, data }) {
|
||||
rowspanMethod ({ row, _rowIndex, column, visibleData }) {
|
||||
const fields = ['name1', 'name2', 'name3']
|
||||
const cellValue = XEUtils.get(row, column.property)
|
||||
if (cellValue && fields.includes(column.property)) {
|
||||
const prevRow = data[$rowIndex - 1]
|
||||
let nextRow = data[$rowIndex + 1]
|
||||
const prevRow = visibleData[_rowIndex - 1]
|
||||
let nextRow = visibleData[_rowIndex + 1]
|
||||
if (prevRow && XEUtils.get(prevRow, column.property) === cellValue) {
|
||||
return { rowspan: 0, colspan: 0 }
|
||||
} else {
|
||||
let countRowspan = 1
|
||||
while (nextRow && XEUtils.get(nextRow, column.property) === cellValue) {
|
||||
nextRow = data[++countRowspan + $rowIndex]
|
||||
nextRow = visibleData[++countRowspan + _rowIndex]
|
||||
}
|
||||
if (countRowspan > 1) {
|
||||
return { rowspan: countRowspan, colspan: 1 }
|
||||
@@ -354,18 +354,18 @@ export default {
|
||||
this.tableData = list
|
||||
},
|
||||
// 通用行合并函数(将相同多列数据合并为一行)
|
||||
rowspanMethod ({ row, $rowIndex, column, data }) {
|
||||
rowspanMethod ({ row, _rowIndex, column, visibleData }) {
|
||||
const fields = ['name1', 'name2', 'name3']
|
||||
const cellValue = XEUtils.get(row, column.property)
|
||||
if (cellValue && fields.includes(column.property)) {
|
||||
const prevRow = data[$rowIndex - 1]
|
||||
let nextRow = data[$rowIndex + 1]
|
||||
const prevRow = visibleData[_rowIndex - 1]
|
||||
let nextRow = visibleData[_rowIndex + 1]
|
||||
if (prevRow && XEUtils.get(prevRow, column.property) === cellValue) {
|
||||
return { rowspan: 0, colspan: 0 }
|
||||
} else {
|
||||
let countRowspan = 1
|
||||
while (nextRow && XEUtils.get(nextRow, column.property) === cellValue) {
|
||||
nextRow = data[++countRowspan + $rowIndex]
|
||||
nextRow = visibleData[++countRowspan + _rowIndex]
|
||||
}
|
||||
if (countRowspan > 1) {
|
||||
return { rowspan: countRowspan, colspan: 1 }
|
||||
|
||||
@@ -147,18 +147,18 @@ export default {
|
||||
}
|
||||
},
|
||||
// 通用行合并函数(将相同多列数据合并为一行)
|
||||
rowspanMethod ({ row, $rowIndex, column, data }) {
|
||||
rowspanMethod ({ row, _rowIndex, column, visibleData }) {
|
||||
let fields = ['key']
|
||||
let cellValue = row[column.property]
|
||||
if (cellValue && fields.includes(column.property)) {
|
||||
let prevRow = data[$rowIndex - 1]
|
||||
let nextRow = data[$rowIndex + 1]
|
||||
let prevRow = visibleData[_rowIndex - 1]
|
||||
let nextRow = visibleData[_rowIndex + 1]
|
||||
if (prevRow && prevRow[column.property] === cellValue) {
|
||||
return { rowspan: 0, colspan: 0 }
|
||||
} else {
|
||||
let countRowspan = 1
|
||||
while (nextRow && nextRow[column.property] === cellValue) {
|
||||
nextRow = data[++countRowspan + $rowIndex]
|
||||
nextRow = visibleData[++countRowspan + _rowIndex]
|
||||
}
|
||||
if (countRowspan > 1) {
|
||||
return { rowspan: countRowspan, colspan: 1 }
|
||||
@@ -214,18 +214,18 @@ export default {
|
||||
}
|
||||
},
|
||||
// 通用行合并函数(将相同多列数据合并为一行)
|
||||
rowspanMethod ({ row, $rowIndex, column, data }) {
|
||||
rowspanMethod ({ row, _rowIndex, column, visibleData }) {
|
||||
const fields = ['key']
|
||||
const cellValue = row[column.property]
|
||||
if (cellValue && fields.includes(column.property)) {
|
||||
const prevRow = data[$rowIndex - 1]
|
||||
let nextRow = data[$rowIndex + 1]
|
||||
const prevRow = visibleData[_rowIndex - 1]
|
||||
let nextRow = visibleData[_rowIndex + 1]
|
||||
if (prevRow && prevRow[column.property] === cellValue) {
|
||||
return { rowspan: 0, colspan: 0 }
|
||||
} else {
|
||||
let countRowspan = 1
|
||||
while (nextRow && nextRow[column.property] === cellValue) {
|
||||
nextRow = data[++countRowspan + $rowIndex]
|
||||
nextRow = visibleData[++countRowspan + _rowIndex]
|
||||
}
|
||||
if (countRowspan > 1) {
|
||||
return { rowspan: countRowspan, colspan: 1 }
|
||||
|
||||
@@ -186,18 +186,18 @@ export default {
|
||||
return ''
|
||||
},
|
||||
// 通用行合并函数(将相同多列数据合并为一行)
|
||||
rowspanMethod ({ row, $rowIndex, column, data }) {
|
||||
rowspanMethod ({ row, _rowIndex, column, visibleData }) {
|
||||
let fields = ['sex']
|
||||
let cellValue = row[column.property]
|
||||
if (cellValue && fields.includes(column.property)) {
|
||||
let prevRow = data[$rowIndex - 1]
|
||||
let nextRow = data[$rowIndex + 1]
|
||||
let prevRow = visibleData[_rowIndex - 1]
|
||||
let nextRow = visibleData[_rowIndex + 1]
|
||||
if (prevRow && prevRow[column.property] === cellValue) {
|
||||
return { rowspan: 0, colspan: 0 }
|
||||
} else {
|
||||
let countRowspan = 1
|
||||
while (nextRow && nextRow[column.property] === cellValue) {
|
||||
nextRow = data[++countRowspan + $rowIndex]
|
||||
nextRow = visibleData[++countRowspan + _rowIndex]
|
||||
}
|
||||
if (countRowspan > 1) {
|
||||
return { rowspan: countRowspan, colspan: 1 }
|
||||
@@ -276,18 +276,18 @@ export default {
|
||||
})
|
||||
},
|
||||
// 通用行合并函数(将相同多列数据合并为一行)
|
||||
rowspanMethod ({ row, $rowIndex, column, data }) {
|
||||
rowspanMethod ({ row, _rowIndex, column, visibleData }) {
|
||||
const fields = ['sex']
|
||||
const cellValue = row[column.property]
|
||||
if (cellValue && fields.includes(column.property)) {
|
||||
const prevRow = data[$rowIndex - 1]
|
||||
let nextRow = data[$rowIndex + 1]
|
||||
const prevRow = visibleData[_rowIndex - 1]
|
||||
let nextRow = visibleData[_rowIndex + 1]
|
||||
if (prevRow && prevRow[column.property] === cellValue) {
|
||||
return { rowspan: 0, colspan: 0 }
|
||||
} else {
|
||||
let countRowspan = 1
|
||||
while (nextRow && nextRow[column.property] === cellValue) {
|
||||
nextRow = data[++countRowspan + $rowIndex]
|
||||
nextRow = visibleData[++countRowspan + _rowIndex]
|
||||
}
|
||||
if (countRowspan > 1) {
|
||||
return { rowspan: countRowspan, colspan: 1 }
|
||||
|
||||
@@ -80,10 +80,11 @@ function mergeMethod (mergeList, _rowIndex, _columnIndex) {
|
||||
/**
|
||||
* 渲染列
|
||||
*/
|
||||
function renderColumn (h, _vm, $xetable, $seq, seq, rowid, fixedType, rowLevel, row, rowIndex, $rowIndex, column, $columnIndex, columns, items) {
|
||||
function renderColumn (h, _vm, $xetable, $seq, seq, rowid, fixedType, rowLevel, row, rowIndex, $rowIndex, _rowIndex, column, $columnIndex, columns, items) {
|
||||
const {
|
||||
_e,
|
||||
$listeners: tableListeners,
|
||||
afterFullData,
|
||||
tableData,
|
||||
height,
|
||||
columnKey,
|
||||
@@ -131,7 +132,7 @@ function renderColumn (h, _vm, $xetable, $seq, seq, rowid, fixedType, rowLevel,
|
||||
const bindMouseenter = tableListeners['cell-mouseenter']
|
||||
const bindMouseleave = tableListeners['cell-mouseleave']
|
||||
const triggerDblclick = (editRender && editConfig && editOpts.trigger === 'dblclick')
|
||||
const params = { $table: $xetable, $seq, seq, rowid, row, rowIndex, $rowIndex, column, columnIndex, $columnIndex, _columnIndex, fixed: fixedType, type: cellType, isHidden: fixedHiddenColumn, level: rowLevel, data: tableData, items }
|
||||
const params = { $table: $xetable, $seq, seq, rowid, row, rowIndex, $rowIndex, _rowIndex, column, columnIndex, $columnIndex, _columnIndex, fixed: fixedType, type: cellType, isHidden: fixedHiddenColumn, level: rowLevel, visibleData: afterFullData, data: tableData, items }
|
||||
// 虚拟滚动不支持动态高度
|
||||
if ((scrollXLoad || scrollYLoad) && !hasEllipsis) {
|
||||
showEllipsis = hasEllipsis = true
|
||||
@@ -193,7 +194,6 @@ function renderColumn (h, _vm, $xetable, $seq, seq, rowid, fixedType, rowLevel,
|
||||
}
|
||||
// 合并行或列
|
||||
if (mergeList.length) {
|
||||
const _rowIndex = $xetable._getRowIndex(row)
|
||||
const spanRest = mergeMethod(mergeList, _rowIndex, _columnIndex)
|
||||
if (spanRest) {
|
||||
const { rowspan, colspan } = spanRest
|
||||
@@ -303,6 +303,7 @@ function renderRows (h, _vm, $xetable, $seq, rowLevel, fixedType, tableData, tab
|
||||
if (scrollYLoad) {
|
||||
seq += scrollYStore.startIndex
|
||||
}
|
||||
const _rowIndex = $xetable._getRowIndex(row)
|
||||
// 确保任何情况下 rowIndex 都精准指向真实 data 索引
|
||||
rowIndex = $xetable.getRowIndex(row)
|
||||
// 事件绑定
|
||||
@@ -337,7 +338,7 @@ function renderRows (h, _vm, $xetable, $seq, rowLevel, fixedType, tableData, tab
|
||||
key: rowKey || treeConfig ? rowid : $rowIndex,
|
||||
on: trOn
|
||||
}, tableColumn.map((column, $columnIndex) => {
|
||||
return renderColumn(h, _vm, $xetable, $seq, seq, rowid, fixedType, rowLevel, row, rowIndex, $rowIndex, column, $columnIndex, tableColumn, tableData)
|
||||
return renderColumn(h, _vm, $xetable, $seq, seq, rowid, fixedType, rowLevel, row, rowIndex, $rowIndex, _rowIndex, column, $columnIndex, tableColumn, tableData)
|
||||
}))
|
||||
)
|
||||
// 如果行被展开了
|
||||
|
||||
@@ -3616,6 +3616,9 @@ const Methods = {
|
||||
* @param {MergeOptions[]} merges { row: Row|number, column: ColumnInfo|number, rowspan: number, colspan: number }
|
||||
*/
|
||||
setMergeCells (merges) {
|
||||
if (this.spanMethod) {
|
||||
UtilTools.error('vxe.error.errConflicts', ['merge-cells', 'span-method'])
|
||||
}
|
||||
setMerges(this, merges, this.mergeList, this.afterFullData)
|
||||
return this.$nextTick().then(() => this.updateCellAreas())
|
||||
},
|
||||
@@ -3624,6 +3627,9 @@ const Methods = {
|
||||
* @param {MergeOptions[]} merges 多个或数组 [{row:Row|number, col:ColumnInfo|number}]
|
||||
*/
|
||||
removeMergeCells (merges) {
|
||||
if (this.spanMethod) {
|
||||
UtilTools.error('vxe.error.errConflicts', ['merge-cells', 'span-method'])
|
||||
}
|
||||
const rest = removeMerges(this, merges, this.mergeList, this.afterFullData)
|
||||
return this.$nextTick().then(() => {
|
||||
this.updateCellAreas()
|
||||
@@ -3647,10 +3653,16 @@ const Methods = {
|
||||
this.setMergeFooterItems(this.mergeFooterItems)
|
||||
},
|
||||
setMergeFooterItems (merges) {
|
||||
if (this.footerSpanMethod) {
|
||||
UtilTools.error('vxe.error.errConflicts', ['merge-footer-items', 'footer-span-method'])
|
||||
}
|
||||
setMerges(this, merges, this.mergeFooterList, null)
|
||||
return this.$nextTick().then(() => this.updateCellAreas())
|
||||
},
|
||||
removeMergeFooterItems (merges) {
|
||||
if (this.footerSpanMethod) {
|
||||
UtilTools.error('vxe.error.errConflicts', ['merge-footer-items', 'footer-span-method'])
|
||||
}
|
||||
const rest = removeMerges(this, merges, this.mergeFooterList, null)
|
||||
return this.$nextTick().then(() => {
|
||||
this.updateCellAreas()
|
||||
|
||||
Reference in New Issue
Block a user