From 774c24fdcecba3b01397baa1f59e25e6368e7815 Mon Sep 17 00:00:00 2001 From: xuliangzhan Date: Thu, 12 Sep 2024 12:44:48 +0800 Subject: [PATCH] releases 4.7.79 --- package.json | 4 ++-- packages/table/render/index.ts | 31 ++++--------------------------- packages/ui/src/vn.ts | 25 +++++++++++++++++++++++++ 3 files changed, 31 insertions(+), 29 deletions(-) diff --git a/package.json b/package.json index 2587323640..524fe111d7 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "vxe-table", - "version": "4.7.78", + "version": "4.7.79", "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.1.25" + "vxe-pc-ui": "^4.1.27" }, "devDependencies": { "@types/resize-observer-browser": "^0.1.11", diff --git a/packages/table/render/index.ts b/packages/table/render/index.ts index 4d0cd04ba4..9f8ab9797d 100644 --- a/packages/table/render/index.ts +++ b/packages/table/render/index.ts @@ -3,7 +3,7 @@ import XEUtils from 'xe-utils' import { VxeUI } from '../../ui' import { getCellValue, setCellValue } from '../../table/src/util' import { getFuncText, formatText, isEmptyValue } from '../../ui/src/utils' -import { getOnName } from '../../ui/src/vn' +import { getOnName, getModelEvent, getChangeEvent } from '../../ui/src/vn' import { errLog } from '../../ui/src/log' import type { VxeButtonComponent } from 'vxe-pc-ui' @@ -15,29 +15,6 @@ const componentDefaultModelProp = 'modelValue' const defaultCompProps = { transfer: true } -function getModelEvent (renderOpts: any) { - switch (renderOpts.name) { - case 'input': - case 'textarea': - return 'input' - } - return 'update:modelValue' -} - -function getChangeEvent (renderOpts: any) { - switch (renderOpts.name) { - case 'input': - case 'textarea': - case 'VxeInput': - case 'VxeNumberInput': - case 'VxeTextarea': - case '$input': - case '$textarea': - return 'input' - } - return 'change' -} - function parseDate (value: any, props: any) { return value && props.valueFormat ? XEUtils.toStringDate(value, props.valueFormat) : value } @@ -133,7 +110,7 @@ function getCellLabelVNs (renderOpts: any, params: any, cellLabel: any) { * @param modelFunc * @param changeFunc */ -function getElementOns (renderOpts: any, params: any, modelFunc?: any, changeFunc?: any) { +function getNativeElementOns (renderOpts: any, params: any, modelFunc?: any, changeFunc?: any) { const { events } = renderOpts const modelEvent = getModelEvent(renderOpts) const changeEvent = getChangeEvent(renderOpts) @@ -246,7 +223,7 @@ function getFilterOns (renderOpts: any, params: any, option: any) { function getNativeEditOns (renderOpts: any, params: any) { const { $table, row, column } = params const { model } = column - return getElementOns(renderOpts, params, (evnt: any) => { + return getNativeElementOns(renderOpts, params, (evnt: any) => { // 处理 model 值双向绑定 const cellValue = evnt.target.value if (isImmediateCell(renderOpts, params)) { @@ -263,7 +240,7 @@ function getNativeEditOns (renderOpts: any, params: any) { } function getNativeFilterOns (renderOpts: any, params: any, option: any) { - return getElementOns(renderOpts, params, (evnt: any) => { + return getNativeElementOns(renderOpts, params, (evnt: any) => { // 处理 model 值双向绑定 option.data = evnt.target.value }, () => { diff --git a/packages/ui/src/vn.ts b/packages/ui/src/vn.ts index 41bf47464d..9342c8794b 100644 --- a/packages/ui/src/vn.ts +++ b/packages/ui/src/vn.ts @@ -6,6 +6,31 @@ export function getOnName (type: string) { return 'on' + type.substring(0, 1).toLocaleUpperCase() + type.substring(1) } +export function getModelEvent (renderOpts: any) { + switch (renderOpts.name) { + case 'input': + case 'textarea': + return 'input' + case 'select': + return 'change' + } + return 'update:modelValue' +} + +export function getChangeEvent (renderOpts: any) { + switch (renderOpts.name) { + case 'input': + case 'textarea': + case 'VxeInput': + case 'VxeNumberInput': + case 'VxeTextarea': + case '$input': + case '$textarea': + return 'input' + } + return 'change' +} + export function getSlotVNs (vns: VxeComponentSlotType | VxeComponentSlotType[]) { if (XEUtils.isArray(vns)) { return vns