优化渲染器
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "vxe-table",
|
||||
"version": "4.2.7-beta.1",
|
||||
"version": "4.2.7-beta.3",
|
||||
"description": "一个基于 vue 的 PC 端表格组件,支持增删改查、虚拟列表、虚拟树、懒加载、快捷菜单、数据校验、树形结构、打印导出、表单渲染、数据分页、弹窗、自定义模板、渲染器、贼灵活的配置项、扩展接口等...",
|
||||
"scripts": {
|
||||
"serve": "vue-cli-service serve",
|
||||
|
||||
@@ -669,18 +669,21 @@ const editHook: VxeGlobalHooksHandles.HookOptions = {
|
||||
const { editRender } = column
|
||||
if (isEnableConf(editRender)) {
|
||||
const compRender = renderer.get(editRender.name)
|
||||
const { autofocus, autoselect } = editRender
|
||||
let { autofocus, autoselect } = editRender
|
||||
let inputElem
|
||||
// 如果指定了聚焦 class
|
||||
if (autofocus) {
|
||||
inputElem = cell.querySelector(autofocus)
|
||||
if (!autofocus && compRender) {
|
||||
autofocus = compRender.autofocus
|
||||
}
|
||||
// 渲染器的聚焦处理
|
||||
if (!inputElem && compRender && compRender.autofocus) {
|
||||
inputElem = cell.querySelector(compRender.autofocus)
|
||||
// 如果指定了聚焦 class
|
||||
if (XEUtils.isFunction(autofocus)) {
|
||||
inputElem = autofocus.call(this, params)
|
||||
} else if (autofocus) {
|
||||
inputElem = cell.querySelector(autofocus)
|
||||
if (inputElem) {
|
||||
inputElem.focus()
|
||||
}
|
||||
}
|
||||
if (inputElem) {
|
||||
inputElem.focus()
|
||||
if (autoselect) {
|
||||
inputElem.select()
|
||||
} else {
|
||||
|
||||
@@ -220,7 +220,6 @@ export default defineComponent({
|
||||
class: [
|
||||
'vxe-table--filter-wrapper',
|
||||
'filter--prevent-default',
|
||||
compConf && compConf.className ? compConf.className : '',
|
||||
getPropClass(filterClassName, params),
|
||||
{
|
||||
'is--animat': $xetable.props.animat,
|
||||
|
||||
@@ -21,13 +21,17 @@ export class Store {
|
||||
}
|
||||
|
||||
add (name: string, render: any): Store {
|
||||
const conf = this.store[name]
|
||||
// 检测是否覆盖
|
||||
if (process.env.VUE_APP_VXE_TABLE_ENV === 'development') {
|
||||
if (!XEUtils.eqNull(this.store[name]) && this.store[name] !== render) {
|
||||
warnLog('vxe.error.coverProp', [(this as any)._name, name])
|
||||
}
|
||||
const confKeys = XEUtils.keys(conf)
|
||||
XEUtils.each(render, (item, key) => {
|
||||
if (confKeys.includes(key)) {
|
||||
warnLog('vxe.error.coverProp', [name, key])
|
||||
}
|
||||
})
|
||||
}
|
||||
this.store[name] = render
|
||||
this.store[name] = conf ? XEUtils.merge(conf, render) : render
|
||||
return this
|
||||
}
|
||||
|
||||
|
||||
2
types/v-x-e-table/renderer.d.ts
vendored
2
types/v-x-e-table/renderer.d.ts
vendored
@@ -30,7 +30,7 @@ export interface DefineRendererOption<T> {
|
||||
footerExportMethod?(params: VxeGlobalRendererHandles.FooterExportMethodParams): string
|
||||
|
||||
// 编辑渲染
|
||||
autofocus?: string
|
||||
autofocus?: string | ((params: VxeGlobalRendererHandles.RenderEditParams | VxeGlobalRendererHandles.RenderCellParams) => HTMLElement | null)
|
||||
renderEdit?(renderOpts: VxeGlobalRendererHandles.RenderEditOptions, params: VxeGlobalRendererHandles.RenderEditParams): T
|
||||
renderCell?(renderOpts: VxeGlobalRendererHandles.RenderCellOptions, params: VxeGlobalRendererHandles.RenderCellParams): T
|
||||
|
||||
|
||||
Reference in New Issue
Block a user