From 0731b7f70f7d17198d678fcfe85b6bdb2f258e55 Mon Sep 17 00:00:00 2001 From: xuliangzhan Date: Fri, 5 Jul 2024 13:09:12 +0800 Subject: [PATCH] releases 4.7.45 --- package.json | 4 ++-- packages/table/src/table.ts | 28 +++++++++++++++++++++------- styles/components/table.scss | 9 ++++++++- 3 files changed, 31 insertions(+), 10 deletions(-) diff --git a/package.json b/package.json index 29dff5c731..ab360366c7 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "vxe-table", - "version": "4.7.44", + "version": "4.7.45", "description": "一个基于 vue 的 PC 端表格组件,支持增删改查、虚拟树、列拖拽,懒加载、快捷菜单、数据校验、树形结构、打印、导入导出、自定义模板、渲染器、JSON 配置式...", "scripts": { "update": "npm install --legacy-peer-deps", @@ -28,7 +28,7 @@ "style": "lib/style.css", "typings": "types/index.d.ts", "dependencies": { - "vxe-pc-ui": "^4.0.48" + "vxe-pc-ui": "^4.0.49" }, "devDependencies": { "@types/resize-observer-browser": "^0.1.11", diff --git a/packages/table/src/table.ts b/packages/table/src/table.ts index 4a0fdc021c..d90f36fd4a 100644 --- a/packages/table/src/table.ts +++ b/packages/table/src/table.ts @@ -5882,7 +5882,7 @@ export default defineComponent({ } tableMethods.dispatchEvent('header-cell-click', Object.assign({ triggerResizable, triggerSort, triggerFilter, cell }, params), evnt) if (columnOpts.isCurrent || props.highlightCurrentColumn) { - tableMethods.setCurrentColumn(column) + tablePrivateMethods.triggerCurrentColumnEvent(evnt, params) } }, triggerHeaderCellDblclickEvent (evnt, params) { @@ -6092,13 +6092,25 @@ export default defineComponent({ tableMethods.dispatchEvent('radio-change', { oldValue, newValue, ...params }, evnt) } }, + triggerCurrentColumnEvent (evnt, params) { + const columnOpts = computeColumnOpts + const { currentMethod } = columnOpts.value + const { column } = params + if (!currentMethod || currentMethod({ column })) { + tableMethods.setCurrentColumn(column) + } + }, triggerCurrentRowEvent (evnt, params) { const { currentRow: oldValue } = reactData + const rowOpts = computeRowOpts + const { currentMethod } = rowOpts.value const { row: newValue } = params const isChange = oldValue !== newValue - tableMethods.setCurrentRow(newValue) - if (isChange) { - tableMethods.dispatchEvent('current-change', { oldValue, newValue, ...params }, evnt) + if (!currentMethod || currentMethod({ row: newValue })) { + tableMethods.setCurrentRow(newValue) + if (isChange) { + tableMethods.dispatchEvent('current-change', { oldValue, newValue, ...params }, evnt) + } } }, /** @@ -6718,9 +6730,9 @@ export default defineComponent({ if (mouseOpts.area && mouseOpts.selected) { warnLog('vxe.error.errConflicts', ['mouse-config.area', 'mouse-config.selected']) } - if (mouseOpts.area && checkboxOpts.range) { - warnLog('vxe.error.errConflicts', ['mouse-config.area', 'checkbox-config.range']) - } + // if (mouseOpts.area && checkboxOpts.range) { + // warnLog('vxe.error.errConflicts', ['mouse-config.area', 'checkbox-config.range']) + // } if (props.treeConfig && mouseOpts.area) { errLog('vxe.error.noTree', ['mouse-config.area']) } @@ -6843,6 +6855,7 @@ export default defineComponent({ const loadingSlot = slots.loading const tipConfig = computeTipConfig.value const validOpts = computeValidOpts.value + const checkboxOpts = computeCheckboxOpts.value const treeOpts = computeTreeOpts.value const rowOpts = computeRowOpts.value const columnOpts = computeColumnOpts.value @@ -6865,6 +6878,7 @@ export default defineComponent({ 'cell--area': mouseConfig && mouseOpts.area, 'row--highlight': rowOpts.isHover || highlightHoverRow, 'column--highlight': columnOpts.isHover || highlightHoverColumn, + 'checkbox--range': checkboxOpts.range, 'is--header': showHeader, 'is--footer': showFooter, 'is--group': isGroup, diff --git a/styles/components/table.scss b/styles/components/table.scss index 1e7be89695..c807e6e2b1 100644 --- a/styles/components/table.scss +++ b/styles/components/table.scss @@ -619,8 +619,15 @@ } } } + &.checkbox--range, + &.cell--selected { + .vxe-body--column { + user-select: none; + } + } &.cell--area { - .vxe-body--row { + .vxe-table--body-wrapper, + .vxe-body--column { user-select: none; } }