Skip to content

Commit

Permalink
releases 4.9.0
Browse files Browse the repository at this point in the history
  • Loading branch information
xuliangzhan committed Nov 18, 2024
1 parent bbbe1c2 commit f340c28
Show file tree
Hide file tree
Showing 22 changed files with 1,027 additions and 588 deletions.
2 changes: 1 addition & 1 deletion README.en.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
[![pull requests closed](https://img.shields.io/github/issues-pr-closed/x-extends/vxe-table.svg)](https://github.com/x-extends/vxe-table/pulls?q=is%3Apr+is%3Aclosed)
[![npm license](https://img.shields.io/github/license/mashape/apistatus.svg)](LICENSE)

A [vue](https://www.npmjs.com/package/vue) based PC form component, support add delete change check, virtual tree, column drag and drop, lazy loading, shortcut menu, data verification, import/export/print, form rendering, custom template, renderer, JSON configuration...
A [vue](https://www.npmjs.com/package/vue) based PC form component, support add delete change check, virtual tree, drag and drop, lazy loading, shortcut menu, data verification, import/export/print, form rendering, custom template, renderer, JSON configuration...

## Browser Support

Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
[![pull requests closed](https://img.shields.io/github/issues-pr-closed/x-extends/vxe-table.svg)](https://github.com/x-extends/vxe-table/pulls?q=is%3Apr+is%3Aclosed)
[![npm license](https://img.shields.io/github/license/mashape/apistatus.svg)](LICENSE)

一个基于 [vue](https://www.npmjs.com/package/vue) 的 PC 端表单/表格组件,支持增删改查、虚拟树、列拖拽、懒加载、快捷菜单、数据校验、导入/导出/打印、表单渲染、自定义模板、渲染器、JSON 配置式...
一个基于 [vue](https://www.npmjs.com/package/vue) 的 PC 端表单/表格组件,支持增删改查、虚拟树、拖拽排序、懒加载、快捷菜单、数据校验、导入/导出/打印、表单渲染、自定义模板、渲染器、JSON 配置式...

* 设计理念
* 面向现代浏览器,高效的简洁 API 设计
Expand Down
2 changes: 1 addition & 1 deletion README.zh-TW.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
[![pull requests closed](https://img.shields.io/github/issues-pr-closed/x-extends/vxe-table.svg)](https://github.com/x-extends/vxe-table/pulls?q=is%3Apr+is%3Aclosed)
[![npm license](https://img.shields.io/github/license/mashape/apistatus.svg)](LICENSE)

一個基於 [vue](https://www.npmjs.com/package/vue) 的PC端表格組件,支持增刪改查、虛擬樹、列拖拽、懶加載、快捷菜單、數據校驗、導入/匯出/列印、表單渲染、自定義模板、渲染器、JSON 配置式…
一個基於 [vue](https://www.npmjs.com/package/vue) 的PC端表格組件,支持增刪改查、虛擬樹、拖拽排序、懶加載、快捷菜單、數據校驗、導入/匯出/列印、表單渲染、自定義模板、渲染器、JSON 配置式…

## 瀏覽器支持

Expand Down
7 changes: 6 additions & 1 deletion examples/views/table/TableTest2.vue
Original file line number Diff line number Diff line change
Expand Up @@ -6,19 +6,21 @@
border
stripe
resizable
show-footer
highlight-hover-row
height="400"
ref="tableRef"
id="bbbbb"
:row-config="{useKey: true,drag:true}"
:column-config="{useKey: true}"
:column-config="{useKey: true,drag: 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"
:footer-data="demo1.footerData"
@row-dragstart="rowDragstartEvent"
@row-dragover="rowDragoverEvent"
@row-dragend="rowDragendEvent">
Expand Down Expand Up @@ -85,6 +87,9 @@ const customConfig = reactive<VxeTablePropTypes.CustomConfig>({
const demo1 = reactive({
loading: false,
tableData: [] as any[],
footerData: [
{ role: '777', name: '11', sex11: '22', sex22: '44', name1: '66', sex: '5656', age: '666' }
],
sexList: [
{ label: '', value: '0' },
{ label: '', value: '1' }
Expand Down
1 change: 0 additions & 1 deletion examples/views/table/TableTest9.vue
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
:column-config="{resizable: true}"
:scroll-x="{enabled: true, gt: 0}"
:scroll-y="{enabled: true, gt: 0}"
:checkbox-config="{labelField: 'name', highlight: true, range: true}"
:data="tableData">
<vxe-column type="checkbox" width="60"></vxe-column>
<vxe-column field="col0" title="列0" width="100"></vxe-column>
Expand Down
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","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":"工具栏"}}
{"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","row-drag-config","column-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","row-drag-config","column-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":"工具栏"}}
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "vxe-table",
"version": "4.8.16",
"description": "一个基于 vue 的 PC 端表格组件,支持增删改查、虚拟树、列拖拽,懒加载、快捷菜单、数据校验、树形结构、打印、导入导出、自定义模板、渲染器、JSON 配置式...",
"version": "4.9.0",
"description": "一个基于 vue 的 PC 端表格组件,支持增删改查、虚拟树、拖拽排序,懒加载、快捷菜单、数据校验、树形结构、打印、导入导出、自定义模板、渲染器、JSON 配置式...",
"scripts": {
"update": "npm install --legacy-peer-deps",
"serve": "vue-cli-service serve",
Expand All @@ -28,7 +28,7 @@
"style": "lib/style.css",
"typings": "types/index.d.ts",
"dependencies": {
"vxe-pc-ui": "^4.2.54"
"vxe-pc-ui": "^4.3.0"
},
"devDependencies": {
"@types/resize-observer-browser": "^0.1.11",
Expand Down
4 changes: 4 additions & 0 deletions packages/table/module/custom/hook.ts
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,10 @@ VxeUI.hooks.add('tableCustomModule', {
column.visible = column.renderVisible
}
})
reactData.isDragColMove = true
setTimeout(() => {
reactData.isDragColMove = false
}, 1000)
return $xeTable.saveCustomStore('confirm')
}

Expand Down
81 changes: 47 additions & 34 deletions packages/table/module/edit/hook.ts
Original file line number Diff line number Diff line change
Expand Up @@ -256,6 +256,41 @@ hooks.add('tableEditModule', {
})
}

const handleClearEdit = (evnt: Event | null, targetRow?: any) => {
const { editStore } = reactData
const { actived, focused } = editStore
const { row, column } = actived
const validOpts = computeValidOpts.value
if (row || column) {
if (targetRow && getRowid($xeTable, targetRow) !== getRowid($xeTable, row)) {
return nextTick()
}
syncActivedCell()
actived.args = null
actived.row = null
actived.column = null
$xeTable.updateFooter()
$xeTable.dispatchEvent('edit-closed', {
row,
rowIndex: $xeTable.getRowIndex(row),
$rowIndex: $xeTable.getVMRowIndex(row),
column,
columnIndex: $xeTable.getColumnIndex(column),
$columnIndex: $xeTable.getVMColumnIndex(column)
}, evnt || null)
}
if (validOpts.autoClear) {
if (validOpts.msgMode !== 'full' || getConfig().cellVaildMode === 'obsolete') {
if ($xeTable.clearValidate) {
return $xeTable.clearValidate()
}
}
}
focused.row = null
focused.column = null
return nextTick()
}

editMethods = {
/**
* 往表格中插入临时数据
Expand Down Expand Up @@ -514,46 +549,18 @@ hooks.add('tableEditModule', {
}
return null
},
clearActived (evnt) {
clearActived (row) {
// 即将废弃
if (process.env.VUE_APP_VXE_ENV === 'development') {
warnLog('vxe.error.delFunc', ['clearActived', 'clearEdit'])
}
return this.clearEdit(evnt)
return this.clearEdit(row)
},
/**
* 清除激活的编辑
*/
clearEdit (evnt) {
const { editStore } = reactData
const { actived, focused } = editStore
const { row, column } = actived
const validOpts = computeValidOpts.value
if (row || column) {
syncActivedCell()
actived.args = null
actived.row = null
actived.column = null
$xeTable.updateFooter()
$xeTable.dispatchEvent('edit-closed', {
row,
rowIndex: $xeTable.getRowIndex(row),
$rowIndex: $xeTable.getVMRowIndex(row),
column,
columnIndex: $xeTable.getColumnIndex(column),
$columnIndex: $xeTable.getVMColumnIndex(column)
}, evnt || null)
}
if (validOpts.autoClear) {
if (validOpts.msgMode !== 'full' || getConfig().cellVaildMode === 'obsolete') {
if ($xeTable.clearValidate) {
return $xeTable.clearValidate()
}
}
}
focused.row = null
focused.column = null
return nextTick()
clearEdit (row) {
return handleClearEdit(null, row)
},
/**
* 清除所选中源状态
Expand Down Expand Up @@ -687,7 +694,7 @@ hooks.add('tableEditModule', {
}
$xeTable.closeTooltip()
if (actived.column) {
editMethods.clearEdit(evnt)
handleClearEdit(evnt)
}
type = 'edit-activated'
column.renderHeight = cell.offsetHeight
Expand Down Expand Up @@ -765,6 +772,12 @@ hooks.add('tableEditModule', {
handleActived (params, evnt) {
return editPrivateMethods.handleEdit(params, evnt)
},
/**
* 处理取消编辑
* @param evnt
* @returns
*/
handleClearEdit,
/**
* 处理聚焦
*/
Expand Down Expand Up @@ -836,7 +849,7 @@ hooks.add('tableEditModule', {
const selectMethod = () => {
if (isMouseSelected && (selected.row !== row || selected.column !== column)) {
if (actived.row !== row || (editOpts.mode === 'cell' ? actived.column !== column : false)) {
editMethods.clearEdit(evnt)
handleClearEdit(evnt)
editMethods.clearSelected()
if ($xeTable.clearCellAreas) {
$xeTable.clearCellAreas()
Expand Down
5 changes: 2 additions & 3 deletions packages/table/module/filter/hook.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { nextTick } from 'vue'
import XEUtils from 'xe-utils'
import { VxeUI } from '../../../ui'
import { toFilters, handleFieldOrColumn } from '../../src/util'
import { toFilters, handleFieldOrColumn, getRefElem } from '../../src/util'
import { getDomNode, triggerEvent } from '../../../ui/src/dom'
import { isEnableConf } from '../../../ui/src/utils'

Expand Down Expand Up @@ -251,8 +251,7 @@ hooks.add('tableFilterModule', {
const { elemStore } = internalData
const { fixed } = column
return $xeTable.scrollToColumn(column).then(() => {
const headerWrapperRef = elemStore[`${fixed || 'main'}-header-wrapper`] || elemStore['main-header-wrapper']
const headerWrapperElem = headerWrapperRef ? headerWrapperRef.value : null
const headerWrapperElem = getRefElem(elemStore[`${fixed || 'main'}-header-wrapper`] || elemStore['main-header-wrapper'])
if (headerWrapperElem) {
const filterBtnElem = headerWrapperElem.querySelector(`.vxe-header--column.${column.id} .vxe-filter--btn`) as HTMLElement
triggerEvent(filterBtnElem, 'click')
Expand Down
4 changes: 2 additions & 2 deletions packages/table/module/keyboard/hook.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import XEUtils from 'xe-utils'
import { VxeUI } from '../../../ui'
import { getRefElem } from '../../src/util'
import { browse, hasClass, getAbsolutePos, addClass, removeClass, getEventTargetNode } from '../../../ui/src/dom'

import type { TableKeyboardPrivateMethods } from '../../../../types'
Expand Down Expand Up @@ -79,8 +80,7 @@ hooks.add('tableKeyboardModule', {
const { elemStore } = internalData
const disX = evnt.clientX
const disY = evnt.clientY
const bodyWrapperRef = elemStore[`${column.fixed || 'main'}-body-wrapper`] || elemStore['main-body-wrapper']
const bodyWrapperElem = bodyWrapperRef ? bodyWrapperRef.value : null
const bodyWrapperElem = getRefElem(elemStore[`${column.fixed || 'main'}-body-wrapper`] || elemStore['main-body-wrapper'])
if (!bodyWrapperElem) {
return
}
Expand Down
Loading

0 comments on commit f340c28

Please sign in to comment.