1
0
mirror of synced 2025-12-09 15:24:36 +08:00

releases 4.6.8

This commit is contained in:
xuliangzhan
2024-04-30 22:31:17 +08:00
parent 138562efe8
commit 0651a4cc28
22 changed files with 102 additions and 45 deletions

View File

@@ -6,6 +6,7 @@ import GlobalConfig from '../../v-x-e-table/src/conf'
import VxeModalComponent from '../../modal/src/modal'
import VxeButtonComponent from '../../button/src/button'
import VxeRadioGroupComponent from '../../radio/src/group'
import VxeTooltipComponent from '../../tooltip/src/tooltip'
import XEUtils from 'xe-utils'
import { VxeTableDefines, VxeTablePrivateMethods, VxeTableConstructor, VxeTableMethods, VxeTableCustomStoreObj, VxeColumnPropTypes } from '../../../types/all'
@@ -22,7 +23,7 @@ export default defineComponent({
const $xetable = inject('$xetable', {} as VxeTableConstructor & VxeTableMethods & VxeTablePrivateMethods)
const { reactData } = $xetable
const { computeCustomOpts, computeIsMaxFixedColumn } = $xetable.getComputeMaps()
const { computeCustomOpts, computeColumnOpts, computeIsMaxFixedColumn } = $xetable.getComputeMaps()
const refElem = ref() as Ref<HTMLDivElement>
const bodyElemRef = ref() as Ref<HTMLDivElement>
@@ -385,6 +386,7 @@ export default defineComponent({
const { customColumnList } = reactData
const customOpts = computeCustomOpts.value
const { checkMethod, visibleMethod } = customOpts
const columnOpts = computeColumnOpts.value
const isMaxFixedColumn = computeIsMaxFixedColumn.value
const trVNs: VNode[] = []
XEUtils.eachTree(customColumnList, (column, index, items, path, parent) => {
@@ -477,7 +479,7 @@ export default defineComponent({
modelValue: customStore.visible,
title: GlobalConfig.i18n('vxe.custom.cstmTitle'),
width: '40vw',
minWidth: 500,
minWidth: 520,
height: '50vh',
minHeight: 300,
mask: true,
@@ -502,10 +504,10 @@ export default defineComponent({
h('colgroup', {}, [
h('col', {
style: {
width: '60px'
width: '80px'
}
}),
h('col'),
h('col', {}),
h('col', {
style: {
width: '80px'
@@ -519,10 +521,24 @@ export default defineComponent({
]),
h('thead', {}, [
h('tr', {}, [
h('th', {}, GlobalConfig.i18n('vxe.custom.setting.colSort')),
h('th', {}, [
h('span', {
class: 'vxe-table-custom-popup--table-sort-help-title'
}, GlobalConfig.i18n('vxe.custom.setting.colSort')),
h(VxeTooltipComponent, {
enterable: true,
content: GlobalConfig.i18n('vxe.custom.setting.sortHelpTip')
}, {
default: () => {
return h('i', {
class: 'vxe-table-custom-popup--table-sort-help-icon vxe-icon-question-circle-fill'
})
}
})
]),
h('th', {}, GlobalConfig.i18n('vxe.custom.setting.colTitle')),
h('th', {}, GlobalConfig.i18n('vxe.custom.setting.colVisible')),
h('th', {}, GlobalConfig.i18n('vxe.custom.setting.colFixed'))
h('th', {}, GlobalConfig.i18n('vxe.custom.setting.colFixed', [columnOpts.maxFixedSize || 0]))
])
]),
h(TransitionGroup, {

View File

@@ -504,10 +504,10 @@ const editHook: VxeGlobalHooksHandles.HookOptions = {
return null
},
clearActived (evnt) {
// if (process.env.VUE_APP_VXE_TABLE_ENV === 'development') {
// warnLog('vxe.error.delFunc', ['clearActived', 'clearEdit'])
// }
// 即将废弃
if (process.env.VUE_APP_VXE_TABLE_ENV === 'development') {
warnLog('vxe.error.delFunc', ['clearActived', 'clearEdit'])
}
return this.clearEdit(evnt)
},
/**
@@ -515,7 +515,7 @@ const editHook: VxeGlobalHooksHandles.HookOptions = {
*/
clearEdit (evnt) {
const { editStore } = reactData
const { actived } = editStore
const { actived, focused } = editStore
const { row, column } = actived
if (row || column) {
syncActivedCell()
@@ -537,6 +537,8 @@ const editHook: VxeGlobalHooksHandles.HookOptions = {
return $xetable.clearValidate()
}
}
focused.row = null
focused.column = null
return nextTick()
},
/**

View File

@@ -114,9 +114,10 @@ export default {
cstmDragTarget: 'Moving target: {0}',
setting: {
colSort: 'Sort',
sortHelpTip: 'Click and drag the icon to adjust the order of the columns.',
colTitle: 'Title',
colVisible: 'Visible',
colFixed: 'Freeze column',
colFixed: 'Freeze columns (Max. {0})',
fixedLeft: 'Left',
fixedUnset: 'Unset',
fixedRight: 'Right'

View File

@@ -114,9 +114,10 @@ export default {
cstmDragTarget: 'Moving target: {0}',
setting: {
colSort: 'Sort',
sortHelpTip: 'Click and drag the icon to adjust the order of the columns.',
colTitle: 'Title',
colVisible: 'Visible',
colFixed: 'Freeze column',
colFixed: 'Freeze columns (Max {0})',
fixedLeft: 'Left',
fixedUnset: 'Unset',
fixedRight: 'Right'

View File

@@ -114,9 +114,10 @@ export default {
cstmDragTarget: '移動ターゲット: {0}',
setting: {
colSort: 'ソート',
sortHelpTip: 'Click and drag the icon to adjust the order of the columns.',
colTitle: 'タイトル',
colVisible: '表示',
colFixed: '列固定',
colFixed: '冻结列(最多 {0} 列)',
fixedLeft: '左側',
fixedUnset: '指定しない',
fixedRight: '右側'

View File

@@ -114,9 +114,10 @@ export default {
cstmDragTarget: 'Moving target: {0}',
setting: {
colSort: 'Sort',
sortHelpTip: 'Click and drag the icon to adjust the order of the columns.',
colTitle: 'Title',
colVisible: 'Visible',
colFixed: 'Freeze column',
colFixed: 'Freeze columns (Max {0})',
fixedLeft: 'Left',
fixedUnset: 'Unset',
fixedRight: 'Right'

View File

@@ -114,9 +114,10 @@ export default {
cstmDragTarget: '移动目标:{0}',
setting: {
colSort: '排序',
sortHelpTip: '点击并拖动图标可以调整列的排序',
colTitle: '标题',
colVisible: '是否显示',
colFixed: '冻结列',
colFixed: '冻结列(最多 {0} 列)',
fixedLeft: '左侧',
fixedUnset: '不设置',
fixedRight: '右侧'

View File

@@ -114,9 +114,10 @@ export default {
cstmDragTarget: '移動目標:{0}',
setting: {
colSort: '排序',
sortHelpTip: '點擊並拖動圖標可以調整列的排序',
colTitle: '標題',
colVisible: '是否顯示',
colFixed: '冻结列',
colFixed: '冻结列(最多 {0} 列)',
fixedLeft: '左側',
fixedUnset: '不設定',
fixedRight: '右側'

View File

@@ -21,7 +21,7 @@ const tableMenuHook: VxeGlobalHooksHandles.HookOptions = {
/**
* 显示快捷菜单
*/
const openContextMenu = (evnt: any, type: 'header' | 'body' | 'footer', params: any) => {
const handleOpenMenuEvent = (evnt: any, type: 'header' | 'body' | 'footer', params: any) => {
const { ctxMenuStore } = reactData
const isMenu = computeIsMenu.value
const menuOpts = computeMenuOpts.value
@@ -142,6 +142,7 @@ const tableMenuHook: VxeGlobalHooksHandles.HookOptions = {
menuPrivateMethods.ctxMenuLinkEvent(evnt, ctxMenuStore[property])
}
},
handleOpenMenuEvent,
/**
* 快捷菜单事件处理
*/
@@ -170,7 +171,7 @@ const tableMenuHook: VxeGlobalHooksHandles.HookOptions = {
if (activeArea && activeArea.row && activeArea.column) {
params.row = activeArea.row
params.column = activeArea.column
openContextMenu(evnt, type, params)
handleOpenMenuEvent(evnt, type, params)
return
}
} else if (mouseConfig && mouseOpts.selected) {
@@ -178,7 +179,7 @@ const tableMenuHook: VxeGlobalHooksHandles.HookOptions = {
if (selected.row && selected.column) {
params.row = selected.row
params.column = selected.column
openContextMenu(evnt, type, params)
handleOpenMenuEvent(evnt, type, params)
return
}
}
@@ -209,14 +210,14 @@ const tableMenuHook: VxeGlobalHooksHandles.HookOptions = {
}
}
const eventType = `${typePrefix}cell-menu` as 'cell-menu' | 'header-cell-menu' | 'footer-cell-menu'
openContextMenu(evnt, layout, params)
handleOpenMenuEvent(evnt, layout, params)
$xetable.dispatchEvent(eventType, params, evnt)
return
} else if (getEventTargetNode(evnt, el, `vxe-table--${layout}-wrapper`, target => target.getAttribute('xid') === xID).flag) {
if (menuOpts.trigger === 'cell') {
evnt.preventDefault()
} else {
openContextMenu(evnt, layout, params)
handleOpenMenuEvent(evnt, layout, params)
}
return
}

View File

@@ -187,6 +187,11 @@ export default defineComponent({
row: null,
column: null
},
// 当前被强制聚焦单元格,只会在鼠标点击后算聚焦
focused: {
row: null,
column: null
},
insertMaps: {},
removeMaps: {}
},
@@ -4046,6 +4051,7 @@ export default defineComponent({
return !!rowExpandedMaps[rowid]
},
isExpandByRow (row) {
// 已废弃
if (process.env.VUE_APP_VXE_TABLE_ENV === 'development') {
warnLog('vxe.error.delFunc', ['isExpandByRow', 'isRowExpandByRow'])
}
@@ -4546,7 +4552,7 @@ export default defineComponent({
// 如果是激活状态,点击了单元格之外
if (!getEventTargetNode(evnt, document.body, 'vxe-table--ignore-clear').flag) {
// 如果手动调用了激活单元格,避免触发源被移除后导致重复关闭
tablePrivateMethods.preventEvent(evnt, 'event.clearActived', actived.args, () => {
tablePrivateMethods.preventEvent(evnt, 'event.clearEdit', actived.args, () => {
let isClear
if (editOpts.mode === 'row') {
const rowTargetNode = getEventTargetNode(evnt, el, 'vxe-body--row')
@@ -5357,7 +5363,14 @@ export default defineComponent({
reactData.reColumnFlag++
},
preventEvent (evnt, type, args, next, end) {
const evntList = VXETable.interceptor.get(type)
let evntList = VXETable.interceptor.get(type)
// 兼容老版本
if (!evntList.length && type === 'event.clearEdit') {
evntList = VXETable.interceptor.get('event.clearActived')
}
// 兼容老版本
let rest
if (!evntList.some((func) => func(Object.assign({ $grid: $xegrid, $table: $xetable, $event: evnt }, args)) === false)) {
if (next) {
@@ -5931,7 +5944,7 @@ export default defineComponent({
const { lazy } = expandOpts
const rowid = getRowid($xetable, row)
if (!lazy || !rowExpandLazyLoadedMaps[rowid]) {
const expanded = !tableMethods.isExpandByRow(row)
const expanded = !tableMethods.isRowExpandByRow(row)
const columnIndex = tableMethods.getColumnIndex(column)
const $columnIndex = tableMethods.getVMColumnIndex(column)
tableMethods.setRowExpand(row, expanded)

View File

@@ -16,7 +16,7 @@ export const interceptor: VxeGlobalInterceptor = {
add (type, callback) {
// 检测类型
if (process.env.VUE_APP_VXE_TABLE_ENV === 'development') {
const eventTypes: VxeGlobalInterceptorHandles.Type[] = ['created', 'mounted', 'activated', 'beforeUnmount', 'unmounted', 'event.clearActived', 'event.clearFilter', 'event.clearAreas', 'event.showMenu', 'event.keydown', 'event.export', 'event.import']
const eventTypes: VxeGlobalInterceptorHandles.Type[] = ['created', 'mounted', 'activated', 'beforeUnmount', 'unmounted', 'event.clearEdit', 'event.clearActived', 'event.clearFilter', 'event.clearAreas', 'event.showMenu', 'event.keydown', 'event.export', 'event.import']
if (eventTypes.indexOf(type) === -1) {
warnLog('vxe.error.errProp', [`Interceptor.${type}`, eventTypes.join('|')])
}