Skip to content

Commit

Permalink
releases 4.7.83
Browse files Browse the repository at this point in the history
  • Loading branch information
xuliangzhan committed Sep 26, 2024
1 parent 4d2be73 commit d18b1bc
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 20 deletions.
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.82",
"version": "4.7.83",
"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.5"
"vxe-pc-ui": "^4.2.7"
},
"devDependencies": {
"@types/resize-observer-browser": "^0.1.11",
Expand Down
39 changes: 24 additions & 15 deletions packages/table/module/edit/hook.ts
Original file line number Diff line number Diff line change
Expand Up @@ -768,24 +768,28 @@ hooks.add('tableEditModule', {
handleFocus (params) {
const { row, column, cell } = params
const { editRender } = column
const editOpts = computeEditOpts.value
if (isEnableConf(editRender)) {
const compRender = renderer.get(editRender.name)
let autoFocus = editRender.autofocus || editRender.autoFocus
let autoSelect = editRender.autoSelect || editRender.autoselect
let inputElem
if (!autoFocus && compRender) {
autoFocus = compRender.tableAutoFocus || compRender.tableAutofocus || compRender.autofocus
}
if (!autoSelect && compRender) {
autoSelect = compRender.tableAutoSelect || compRender.autoselect
}
// 如果指定了聚焦 class
if (XEUtils.isFunction(autoFocus)) {
inputElem = autoFocus(params)
} else if (autoFocus) {
inputElem = cell.querySelector(autoFocus)
if (inputElem) {
inputElem.focus()
// 是否启用聚焦
if (editOpts.autoFocus) {
if (!autoFocus && compRender) {
autoFocus = compRender.tableAutoFocus || compRender.tableAutofocus || compRender.autofocus
}
if (!autoSelect && compRender) {
autoSelect = compRender.tableAutoSelect || compRender.autoselect
}
// 如果指定了聚焦 class
if (XEUtils.isFunction(autoFocus)) {
inputElem = autoFocus(params)
} else if (autoFocus) {
inputElem = cell.querySelector(autoFocus)
if (inputElem) {
inputElem.focus()
}
}
}
if (inputElem) {
Expand All @@ -800,8 +804,13 @@ hooks.add('tableEditModule', {
}
}
} else {
// 显示到可视区中
$xeTable.scrollToRow(row, column)
// 是否自动定位
if (editOpts.autoPos) {
if (!column.fixed) {
// 显示到可视区中
$xeTable.scrollToRow(row, column)
}
}
}
}
},
Expand Down
3 changes: 2 additions & 1 deletion packages/ui/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,8 @@ VxeUI.setConfig({
editConfig: {
// mode: 'cell',
showIcon: true,
showAsterisk: true
showAsterisk: true,
autoFocus: true
},
importConfig: {
_typeMaps: {
Expand Down
4 changes: 2 additions & 2 deletions styles/components/table.scss
Original file line number Diff line number Diff line change
Expand Up @@ -528,12 +528,12 @@
font-family: var(--vxe-ui-font-family);
direction: ltr;
.vxe-table--body-wrapper {
table {
& > table {
background-color: var(--vxe-ui-layout-background-color);
}
}
.vxe-table--footer-wrapper {
table {
& > table {
background-color: var(--vxe-ui-table-footer-background-color);
}
}
Expand Down

0 comments on commit d18b1bc

Please sign in to comment.