Skip to content

Commit

Permalink
releases 4.8.1
Browse files Browse the repository at this point in the history
  • Loading branch information
xuliangzhan committed Nov 6, 2024
1 parent 2caf94c commit ced75a1
Show file tree
Hide file tree
Showing 28 changed files with 645 additions and 146 deletions.
37 changes: 25 additions & 12 deletions examples/views/table/TableTest2.vue
Original file line number Diff line number Diff line change
Expand Up @@ -10,38 +10,41 @@
height="400"
ref="tableRef"
id="bbbbb"
:row-config="{useKey: true}"
:row-config="{useKey: true,drag:true}"
:column-config="{useKey: true}"
:custom-config="customConfig"
:loading="demo1.loading"
:import-config="{modes: importModes}"
:export-config="{modes: exportModes}"
:expand-config="{iconOpen: 'vxe-icon-question-circle-fill', iconClose: 'vxe-icon-question-circle-fill'}"
:checkbox-config="{labelField: 'id', highlight: true, range: true}"
:data="demo1.tableData">
<vxe-column type="seq" width="60"></vxe-column>
<vxe-column type="checkbox" title="ID" width="140"></vxe-column>
:data="demo1.tableData"
@row-dragstart="rowDragstartEvent"
@row-dragover="rowDragoverEvent"
@row-dragend="rowDragendEvent">
<vxe-column type="seq" width="60" drag-sort></vxe-column>
<vxe-column type="checkbox" title="ID" width="140" drag-sort></vxe-column>
<vxe-colgroup title="分组1">
<vxe-colgroup title="分组2">
<vxe-column type="expand" field="role" title="Role">
<vxe-column type="expand" field="role" title="Role" drag-sort>
<template #content="{ row }">
<div>{{ row.name }}</div>
</template>
</vxe-column>
<vxe-column field="name" title="Name" sortable></vxe-column>
<vxe-column field="name" title="Name" drag-sort sortable></vxe-column>
</vxe-colgroup>
</vxe-colgroup>
<vxe-column field="sex11" title="<span style='color:red;'>Sex222</span>" type="html"></vxe-column>
<vxe-column field="sex22" title="<span style='color:red;'>Sex1111</span>" type="html" :visible="false"></vxe-column>
<vxe-column field="name1" title="Name1" sortable></vxe-column>
<vxe-column field="sex" title="Sex" :filters="demo1.sexList" :filter-multiple="false" :formatter="formatterSex"></vxe-column>
<vxe-column field="sex11" title="<span style='color:red;'>Sex222</span>" type="html" drag-sort></vxe-column>
<vxe-column field="sex22" title="<span style='color:red;'>Sex1111</span>" type="html" drag-sort :visible="false"></vxe-column>
<vxe-column field="name1" title="Name1" sortable drag-sort ></vxe-column>
<vxe-column field="sex" title="Sex" :filters="demo1.sexList" :filter-multiple="false" :formatter="formatterSex" drag-sort></vxe-column>
<vxe-column
field="age"
title="Age"
sortable
:filters="demo1.ageOptions"
:filter-method="filterAgeMethod"></vxe-column>
<vxe-column field="address" title="Address" show-overflow></vxe-column>
:filter-method="filterAgeMethod" drag-sort></vxe-column>
<vxe-column field="address" title="Address" show-overflow drag-sort></vxe-column>
</vxe-table>
</div>
</template>
Expand Down Expand Up @@ -146,6 +149,16 @@ onMounted(() => {
}, 100)
})
const rowDragstartEvent = (params: any) => {
console.log(params)
}
const rowDragoverEvent = (params: any) => {
console.log(params)
}
const rowDragendEvent = (params: any) => {
console.log(params)
}
nextTick(() => {
// 将表格和工具栏进行关联
const $table = tableRef.value
Expand Down
150 changes: 125 additions & 25 deletions examples/views/table/TableTest9.vue
Original file line number Diff line number Diff line change
@@ -1,40 +1,140 @@
<template>
<div>
<vxe-grid v-bind="gridOptions"></vxe-grid>
<p>
<vxe-button @click="insertEvent">新增</vxe-button>
<vxe-button @click="validEvent">快速校验变动数据</vxe-button>
<vxe-button @click="getInsertEvent">获取新增</vxe-button>
<vxe-button @click="getRemoveEvent">获取删除</vxe-button>
<vxe-button @click="getUpdateEvent">获取修改</vxe-button>
</p>

<vxe-grid ref="gridRef" v-bind="gridOptions"></vxe-grid>
</div>
</template>

<script setup>
import { reactive } from 'vue'
const gridOptions = reactive({
<script lang="ts" setup>
import { ref, reactive } from 'vue'
import { VxeUI } from '../..//../packages'
import { VxeGridProps, VxeGridInstance } from '../..//../types'
interface RowVO {
id: number
name: string
role: string
sex: string
age: number
address: string
}
const gridRef = ref<VxeGridInstance<RowVO>>()
const gridOptions = reactive<VxeGridProps<RowVO>>({
border: true,
showOverflow: true,
height: 600,
scrollY: {
enabled: true,
gt: 0
keepSource: true,
height: 300,
editConfig: {
trigger: 'click',
mode: 'cell',
showStatus: true
},
editRules: {
name: [
{ required: true, message: '请输入名称' },
{
validator ({ cellValue }) {
// 模拟服务端校验
return new Promise((resolve, reject) => {
setTimeout(() => {
if (cellValue && (cellValue.length < 3 || cellValue.length > 50)) {
reject(new Error('名称长度在 3 到 50 个字符之间'))
} else {
resolve()
}
}, 100)
})
}
}
],
role: [
{
validator ({ cellValue }) {
if (cellValue && !['Develop', 'Test', 'Designer', 'PM'].includes(cellValue)) {
return new Error('角色输入不正确')
}
}
}
],
sex: [
{ required: true, message: '性别必须填写' },
{ pattern: /^[0,1]{1}$/, message: '格式不正确' }
],
age: [
{ pattern: '^[0-9]{0,3}$', message: '格式不正确' }
]
},
columns: [
{ type: 'seq', width: 70 },
{ field: 'name', title: 'Name' },
{ field: 'role', title: 'Role' },
{ field: 'sex', title: 'Sex' }
{ type: 'seq', width: 50 },
{ field: 'name', title: 'Name', editRender: { name: 'VxeInput' } },
{ field: 'sex', title: 'Sex', editRender: { name: 'VxeInput' } },
{ field: 'age', title: 'Age', editRender: { name: 'VxeInput', props: { type: 'integer' } } },
{ field: 'address', title: 'Address', editRender: { name: 'VxeInput' } }
],
data: []
data: [
{ id: 10001, name: 'Test1', role: 'Develop', sex: '0', age: 28, address: 'test abc' },
{ id: 10002, name: '', role: 'Test', sex: '1', age: 22, address: 'Guangzhou' },
{ id: 10003, name: 'Test3', role: 'PM', sex: '', age: 32, address: 'Shanghai' },
{ id: 10004, name: 'Test4', role: 'Designer', sex: '', age: 23, address: 'test abc' },
{ id: 10005, name: '', role: '', sex: '1', age: 30, address: 'Shanghai' },
{ id: 10006, name: 'Test6', role: 'Designer', sex: '1', age: 21, address: 'test abc' }
]
})
// 模拟行数据
const loadList = (size = 200) => {
const dataList = []
for (let i = 0; i < size; i++) {
dataList.push({
id: 10000 + i,
name: 'Test' + i,
role: 'Developer',
sex: ''
})
const validEvent = async () => {
const $grid = gridRef.value
if ($grid) {
const errMap = await $grid.validate()
if (errMap) {
VxeUI.modal.message({ status: 'error', content: '校验不通过!' })
} else {
VxeUI.modal.message({ status: 'success', content: '校验成功!' })
}
}
}
const insertEvent = async () => {
const $grid = gridRef.value
if ($grid) {
const { row: newRow } = await $grid.insert({})
// 插入一条数据并触发校验
const errMap = await $grid.validate(newRow)
if (errMap) {
// 校验失败
}
}
gridOptions.data = dataList
}
loadList(500)
const getInsertEvent = () => {
const $grid = gridRef.value
if ($grid) {
const insertRecords = $grid.getInsertRecords()
VxeUI.modal.alert(insertRecords.length)
}
}
const getRemoveEvent = () => {
const $grid = gridRef.value
if ($grid) {
const removeRecords = $grid.getRemoveRecords()
VxeUI.modal.alert(removeRecords.length)
}
}
const getUpdateEvent = () => {
const $grid = gridRef.value
if ($grid) {
const updateRecords = $grid.getUpdateRecords()
VxeUI.modal.alert(updateRecords.length)
}
}
</script>
2 changes: 1 addition & 1 deletion helper/vetur/attributes.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion helper/vetur/tags.json
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"vxe-table":{"attributes":["id","data","height","min-height","max-height","auto-resize","sync-resize","resizable","stripe","border","padding","round","size","loading","align","header-align","footer-align","show-header","highlight-current-row","highlight-hover-row","highlight-current-column","highlight-hover-column","row-class-name","cell-class-name","header-row-class-name","header-cell-class-name","footer-row-class-name","footer-cell-class-name","cell-style","header-cell-style","footer-cell-style","row-style","header-row-style","footer-row-style","show-footer","footer-data","footer-method","merge-cells","merge-footer-items","span-method","footer-span-method","show-overflow","show-header-overflow","show-footer-overflow","column-key","row-key","row-id","keep-source","column-config","cell-config","row-config","resize-config","resizable-config","seq-config","sort-config","filter-config","export-config","import-config","print-config","radio-config","checkbox-config","tooltip-config","expand-config","tree-config","menu-config","clip-config","fnr-config","mouse-config","area-config","keyboard-config","edit-config","valid-config","edit-rules","empty-text","empty-render","loading-config","custom-config","scroll-x","scroll-y","params"],"subtags":["vxe-colgroup","vxe-column"],"description":"基础表格"},"vxe-colgroup":{"attributes":["field","title","width","min-width","resizable","visible","fixed","align","header-align","show-overflow","show-header-overflow","header-class-name"],"subtags":["vxe-column"],"description":"基础表格 - 分组列"},"vxe-column":{"attributes":["type","field","title","width","min-width","resizable","visible","fixed","align","header-align","footer-align","show-overflow","show-header-overflow","show-footer-overflow","class-name","header-class-name","footer-class-name","formatter","sortable","sort-by","sort-type","filters","filter-multiple","filter-method","filter-reset-method","filter-recover-method","filter-render","header-export-method","export-method","footer-export-method","title-help","title-prefix","title-suffix","cell-type","cell-render","edit-render","content-render","tree-node","params","col-id"],"description":"基础表格 - 列"},"vxe-grid":{"attributes":["id","columns","data","height","min-height","max-height","auto-resize","sync-resize","resizable","stripe","border","padding","round","size","loading","align","header-align","footer-align","show-header","highlight-current-row","highlight-hover-row","highlight-current-column","highlight-hover-column","row-class-name","cell-class-name","header-row-class-name","header-cell-class-name","footer-row-class-name","footer-cell-class-name","cell-style","header-cell-style","footer-cell-style","row-style","header-row-style","footer-row-style","show-footer","footer-data","footer-method","merge-cells","merge-footer-items","span-method","footer-span-method","show-overflow","show-header-overflow","show-footer-overflow","column-key","row-key","row-id","keep-source","column-config","cell-config","row-config","resize-config","resizable-config","seq-config","sort-config","filter-config","export-config","import-config","print-config","radio-config","checkbox-config","tooltip-config","expand-config","tree-config","menu-config","clip-config","fnr-config","mouse-config","area-config","keyboard-config","edit-config","valid-config","edit-rules","empty-text","empty-render","loading-config","custom-config","scroll-x","scroll-y","params","form-config","toolbar-config","pager-config","proxy-config","zoom-config","layouts"],"description":"配置式表格"},"vxe-toolbar":{"attributes":["size","loading","class-name","import","export","print","refresh","custom","buttons","tools"],"description":"工具栏"}}
{"vxe-table":{"attributes":["id","data","height","min-height","max-height","auto-resize","sync-resize","resizable","stripe","border","padding","round","size","loading","align","header-align","footer-align","show-header","highlight-current-row","highlight-hover-row","highlight-current-column","highlight-hover-column","row-class-name","cell-class-name","header-row-class-name","header-cell-class-name","footer-row-class-name","footer-cell-class-name","cell-style","header-cell-style","footer-cell-style","row-style","header-row-style","footer-row-style","show-footer","footer-data","footer-method","merge-cells","merge-footer-items","span-method","footer-span-method","show-overflow","show-header-overflow","show-footer-overflow","column-key","row-key","row-id","keep-source","column-config","cell-config","row-config","resize-config","resizable-config","seq-config","sort-config","drag-config","filter-config","export-config","import-config","print-config","radio-config","checkbox-config","tooltip-config","expand-config","tree-config","menu-config","clip-config","fnr-config","mouse-config","area-config","keyboard-config","edit-config","valid-config","edit-rules","empty-text","empty-render","loading-config","custom-config","scroll-x","scroll-y","params"],"subtags":["vxe-colgroup","vxe-column"],"description":"基础表格"},"vxe-colgroup":{"attributes":["field","title","width","min-width","resizable","visible","fixed","align","header-align","show-overflow","show-header-overflow","header-class-name"],"subtags":["vxe-column"],"description":"基础表格 - 分组列"},"vxe-column":{"attributes":["type","field","title","width","min-width","resizable","visible","fixed","align","header-align","footer-align","show-overflow","show-header-overflow","show-footer-overflow","class-name","header-class-name","footer-class-name","formatter","sortable","sort-by","sort-type","filters","filter-multiple","filter-method","filter-reset-method","filter-recover-method","filter-render","header-export-method","export-method","footer-export-method","title-help","title-prefix","title-suffix","cell-type","cell-render","edit-render","content-render","tree-node","params","col-id"],"description":"基础表格 - 列"},"vxe-grid":{"attributes":["id","columns","data","height","min-height","max-height","auto-resize","sync-resize","resizable","stripe","border","padding","round","size","loading","align","header-align","footer-align","show-header","highlight-current-row","highlight-hover-row","highlight-current-column","highlight-hover-column","row-class-name","cell-class-name","header-row-class-name","header-cell-class-name","footer-row-class-name","footer-cell-class-name","cell-style","header-cell-style","footer-cell-style","row-style","header-row-style","footer-row-style","show-footer","footer-data","footer-method","merge-cells","merge-footer-items","span-method","footer-span-method","show-overflow","show-header-overflow","show-footer-overflow","column-key","row-key","row-id","keep-source","column-config","cell-config","row-config","resize-config","resizable-config","seq-config","sort-config","drag-config","filter-config","export-config","import-config","print-config","radio-config","checkbox-config","tooltip-config","expand-config","tree-config","menu-config","clip-config","fnr-config","mouse-config","area-config","keyboard-config","edit-config","valid-config","edit-rules","empty-text","empty-render","loading-config","custom-config","scroll-x","scroll-y","params","form-config","toolbar-config","pager-config","proxy-config","zoom-config","layouts"],"description":"配置式表格"},"vxe-toolbar":{"attributes":["size","loading","class-name","import","export","print","refresh","custom","buttons","tools"],"description":"工具栏"}}
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.8.0",
"version": "4.8.1",
"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.38"
"vxe-pc-ui": "^4.2.42"
},
"devDependencies": {
"@types/resize-observer-browser": "^0.1.11",
Expand Down
6 changes: 4 additions & 2 deletions packages/locale/lang/en-US.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ export default {
impSuccess: 'Successfully imported {0} records',
expLoading: 'Exporting',
expSuccess: 'Export success',
expError: 'Export failure',
expFilename: 'Export_{0}',
expOriginFilename: 'Export_original_{0}',
customTitle: 'Column settings',
Expand All @@ -70,7 +71,8 @@ export default {
customClose: 'Close',
customCancel: 'Cancel',
customRestore: 'Restore',
maxFixedCol: 'The maximum number of Freeze columns cannot exceed {0}'
maxFixedCol: 'The maximum number of Freeze columns cannot exceed {0}',
dragTip: 'Moving: {0}'
},
grid: {
selectOneRecord: 'Please choose at least one piece of record!',
Expand Down Expand Up @@ -121,7 +123,7 @@ export default {
cstmCancel: 'Cancelar',
cstmConfirm: 'Confirm',
cstmConfirmRestore: 'Please confirm whether to restore the default column configuration?',
cstmDragTarget: 'Moving target: {0}',
cstmDragTarget: 'Moving: {0}',
setting: {
colSort: 'Sort',
sortHelpTip: 'Click and drag the icon to adjust the order of the columns.',
Expand Down
6 changes: 4 additions & 2 deletions packages/locale/lang/es-ES.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ export default {
impSuccess: 'Se importaron {0} registros con éxito',
expLoading: 'Exportando',
expSuccess: 'Éxito al exportar',
expError: 'Export failure',
expFilename: 'Exportar_{0}',
expOriginFilename: 'Exportar_original_{0}',
customTitle: 'Configuraciones de columna',
Expand All @@ -70,7 +71,8 @@ export default {
customClose: 'Close',
customCancel: 'Cancel',
customRestore: 'Restore',
maxFixedCol: 'The maximum number of Freeze columns cannot exceed {0}'
maxFixedCol: 'The maximum number of Freeze columns cannot exceed {0}',
dragTip: 'Moving: {0}'
},
grid: {
selectOneRecord: '¡Seleccione al menos un registro!',
Expand Down Expand Up @@ -121,7 +123,7 @@ export default {
cstmCancel: 'Cancelar',
cstmConfirm: 'Confirm',
cstmConfirmRestore: 'Please confirm whether to restore the default column configuration?',
cstmDragTarget: 'Moving target: {0}',
cstmDragTarget: 'Moving: {0}',
setting: {
colSort: 'Sort',
sortHelpTip: 'Click and drag the icon to adjust the order of the columns.',
Expand Down
6 changes: 4 additions & 2 deletions packages/locale/lang/hu-HU.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ export default {
impSuccess: '{0} rekord sikeresen importálva',
expLoading: 'Exportálás',
expSuccess: 'Az exportálás sikeres volt',
expError: 'Export failure',
expFilename: 'Exportálás_{0}',
expOriginFilename: 'export_source_{0}',
customTitle: 'Oszlopbeállítások',
Expand All @@ -70,7 +71,8 @@ export default {
customClose: 'bezárás',
customCancel: 'Mégsem',
customRestore: 'Alapértelmezés visszaállítása',
maxFixedCol: 'A rögzített oszlopok maximális száma nem haladhatja meg a következőt: {0}'
maxFixedCol: 'A rögzített oszlopok maximális száma nem haladhatja meg a következőt: {0}',
dragTip: '移动:{0}'
},
grid: {
selectOneRecord: 'Kérjük, válasszon legalább egy rekordot!',
Expand Down Expand Up @@ -121,7 +123,7 @@ export default {
cstmCancel: 'Mégsem',
cstmConfirm: 'Persze',
cstmConfirmRestore: 'Kérjük, erősítse meg, hogy visszaállítja-e az alapértelmezett oszlopkonfigurációt?',
cstmDragTarget: 'Cél mozgatása: {0}',
cstmDragTarget: '移动:{0}',
setting: {
colSort: 'fajta',
sortHelpTip: 'Kattintson és húzza az ikont az oszlopok sorrendjének módosításához',
Expand Down
Loading

0 comments on commit ced75a1

Please sign in to comment.