diff --git a/package.json b/package.json index 851ede5f5c..c019398047 100644 --- a/package.json +++ b/package.json @@ -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", @@ -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", diff --git a/packages/table/module/edit/hook.ts b/packages/table/module/edit/hook.ts index d637318d32..d5eccc4ae2 100644 --- a/packages/table/module/edit/hook.ts +++ b/packages/table/module/edit/hook.ts @@ -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) { @@ -800,8 +804,13 @@ hooks.add('tableEditModule', { } } } else { - // 显示到可视区中 - $xeTable.scrollToRow(row, column) + // 是否自动定位 + if (editOpts.autoPos) { + if (!column.fixed) { + // 显示到可视区中 + $xeTable.scrollToRow(row, column) + } + } } } }, diff --git a/packages/ui/index.ts b/packages/ui/index.ts index 8274cddb20..4ae137043d 100644 --- a/packages/ui/index.ts +++ b/packages/ui/index.ts @@ -109,7 +109,8 @@ VxeUI.setConfig({ editConfig: { // mode: 'cell', showIcon: true, - showAsterisk: true + showAsterisk: true, + autoFocus: true }, importConfig: { _typeMaps: { diff --git a/styles/components/table.scss b/styles/components/table.scss index 5d29992484..b1b9ee8d11 100644 --- a/styles/components/table.scss +++ b/styles/components/table.scss @@ -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); } }