Skip to content

Commit

Permalink
releases 4.7.79
Browse files Browse the repository at this point in the history
  • Loading branch information
xuliangzhan committed Sep 12, 2024
1 parent 7d918fd commit 774c24f
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 29 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.78",
"version": "4.7.79",
"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.1.25"
"vxe-pc-ui": "^4.1.27"
},
"devDependencies": {
"@types/resize-observer-browser": "^0.1.11",
Expand Down
31 changes: 4 additions & 27 deletions packages/table/render/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand All @@ -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
}
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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)) {
Expand All @@ -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
}, () => {
Expand Down
25 changes: 25 additions & 0 deletions packages/ui/src/vn.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 774c24f

Please sign in to comment.