Skip to content

Commit

Permalink
releases 4.7.95
Browse files Browse the repository at this point in the history
  • Loading branch information
xuliangzhan committed Oct 25, 2024
1 parent 4de1bc8 commit 6b6a38d
Show file tree
Hide file tree
Showing 4 changed files with 51 additions and 39 deletions.
76 changes: 40 additions & 36 deletions examples/views/table/TableTest9.vue
Original file line number Diff line number Diff line change
@@ -1,48 +1,52 @@
<template>
<div>树形表格</div>
<vxe-table
ref="tableRef1"
:tree-config="{ rowField: 'id' }"
:checkbox-config="{ labelField: 'id' }"
:data="tableData1"
>
<vxe-column type="checkbox" field="id" title="id" tree-node></vxe-column>
</vxe-table>
<button @click="selectRow1">选中第一行(有bug)</button>

<div>非树形表格</div>
<vxe-table
ref="tableRef2"
:checkbox-config="{ labelField: 'id' }"
:data="tableData2"
>
<vxe-column type="checkbox" field="id" title="id"></vxe-column>
</vxe-table>
<button @click="selectRow2">选中第一行(可以正常工作)</button>
<div>
<vxe-button @click="exportEvent">直接导出 Txt 文件</vxe-button>
<vxe-table
show-footer
ref="tableRef"
:export-config="{}"
:footer-data="footerData"
:data="tableData">
<vxe-column field="seq" type="seq" width="70"></vxe-column>
<vxe-column field="name" title="Name"></vxe-column>
<vxe-column field="sex" title="Sex"></vxe-column>
<vxe-column field="age" title="Age"></vxe-column>
</vxe-table>
</div>
</template>

<script lang="ts" setup>
import { ref } from 'vue'
const tableRef1 = ref()
const selectRow1 = () => {
tableRef1.value.setCheckboxRow([tableData1.value[0]], true)
import { VxeTableInstance } from '../../../types'
interface RowVO {
id: number
name: string
role: string
sex: string
age: number
address: string
}
const tableData1 = ref([
{ id: 10000 },
{ id: 10050, children: [{ id: 24300, children: [{ id: 20045 }] }] }
const tableRef = ref<VxeTableInstance>()
const tableData = ref<RowVO[]>([
{ id: 10001, name: 'Test1', role: 'Develop', sex: 'Man', age: 28, address: 'test abc' },
{ id: 10002, name: 'Test2', role: 'Test', sex: 'Women', age: 22, address: 'Guangzhou' },
{ id: 10003, name: 'Test3', role: 'PM', sex: 'Man', age: 32, address: 'Shanghai' },
{ id: 10004, name: 'Test4', role: 'Designer', sex: 'Women', age: 24, address: 'Shanghai' }
])
const tableRef2 = ref()
const footerData = ref([
{ seq: '合计', sex: '666', age: '999' }
])
const selectRow2 = () => {
tableRef2.value.setCheckboxRow([tableData2.value[0]], true)
const exportEvent = () => {
const $table = tableRef.value
if ($table) {
$table.exportData({
type: 'txt'
})
}
}
const tableData2 = ref([
{ id: 10000 },
{ id: 10050, children: [{ id: 24300, children: [{ id: 20045 }] }] }
])
</script>
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.7.94",
"version": "4.7.95",
"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.2.26"
"vxe-pc-ui": "^4.2.31"
},
"devDependencies": {
"@types/resize-observer-browser": "^0.1.11",
Expand Down
2 changes: 1 addition & 1 deletion packages/table/module/export/hook.ts
Original file line number Diff line number Diff line change
Expand Up @@ -522,7 +522,7 @@ hooks.add('tableExportModule', {
const { footerTableData } = reactData
const footers = getFooterData(opts, footerTableData)
footers.forEach((row: any) => {
content += columns.map((column: any) => toTxtCellLabel(getFooterCellValue(opts, row, column))).join(',') + enterSymbol
content += columns.map((column: any) => toTxtCellLabel(getFooterCellValue(opts, row, column))).join('\t') + enterSymbol
})
}
return content
Expand Down
8 changes: 8 additions & 0 deletions packages/table/render/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -691,6 +691,14 @@ renderer.mixin({
},
tableExportMethod: handleExportTreeSelectMethod
},
VxeTableSelect: {
tableAutoFocus: 'input',
renderTableEdit: defaultTreeSelectEditRender,
renderTableCell (renderOpts, params) {
return getCellLabelVNs(renderOpts, params, getTreeSelectCellValue(renderOpts, params))
},
tableExportMethod: handleExportTreeSelectMethod
},
VxeIconPicker: {
tableAutoFocus: 'input',
renderTableEdit: defaultEditRender,
Expand Down

0 comments on commit 6b6a38d

Please sign in to comment.