Skip to content

Commit

Permalink
releases 4.7.43
Browse files Browse the repository at this point in the history
  • Loading branch information
xuliangzhan committed Jul 4, 2024
1 parent a318a35 commit 409265b
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 27 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.42",
"version": "4.7.43",
"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.0.47"
"vxe-pc-ui": "^4.0.48"
},
"devDependencies": {
"@types/resize-observer-browser": "^0.1.11",
Expand Down
57 changes: 32 additions & 25 deletions packages/table/render/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -289,7 +289,7 @@ function nativeEditRender (renderOpts: any, params: any) {
]
}

function defaultCellRender (renderOpts: any, params: any) {
function buttonCellRender (renderOpts: any, params: any) {
return [
h(getDefaultComponent(renderOpts), {
...getCellEditProps(renderOpts, params, null),
Expand All @@ -298,7 +298,7 @@ function defaultCellRender (renderOpts: any, params: any) {
]
}

function defaultEditRender (renderOpts: VxeGlobalRendererHandles.RenderEditOptions, params: VxeGlobalRendererHandles.RenderEditParams) {
function defaultEditRender (renderOpts: VxeGlobalRendererHandles.RenderTableEditOptions, params: VxeGlobalRendererHandles.RenderEditParams) {
const { row, column } = params
const cellValue = getCellValue(row, column)
return [
Expand All @@ -309,11 +309,24 @@ function defaultEditRender (renderOpts: VxeGlobalRendererHandles.RenderEditOptio
]
}

function radioAndCheckboxEditRender (renderOpts: VxeGlobalRendererHandles.RenderTableEditOptions, params: VxeGlobalRendererHandles.RenderEditParams) {
const { options } = renderOpts
const { row, column } = params
const cellValue = getCellValue(row, column)
return [
h(getDefaultComponent(renderOpts), {
options,
...getCellEditProps(renderOpts, params, cellValue),
...getEditOns(renderOpts, params)
})
]
}

/**
* 已废弃
* @deprecated
*/
function oldEditRender (renderOpts: VxeGlobalRendererHandles.RenderEditOptions, params: VxeGlobalRendererHandles.RenderEditParams) {
function oldEditRender (renderOpts: VxeGlobalRendererHandles.RenderTableEditOptions, params: VxeGlobalRendererHandles.RenderEditParams) {
const { row, column } = params
const cellValue = getCellValue(row, column)
return [
Expand Down Expand Up @@ -520,12 +533,12 @@ renderer.mixin({
select: {
renderEdit: nativeSelectEditRender,
renderDefault: nativeSelectEditRender,
renderCell (renderOpts: any, params: any) {
renderCell (renderOpts, params) {
return getCellLabelVNs(renderOpts, params, getSelectCellValue(renderOpts, params))
},
renderFilter (renderOpts: any, params: any) {
renderFilter (renderOpts, params) {
const { column } = params
return column.filters.map((option: any, oIndex: any) => {
return column.filters.map((option, oIndex) => {
return h('select', {
key: oIndex,
class: 'vxe-default-select',
Expand All @@ -541,7 +554,7 @@ renderer.mixin({
VxeInput: {
autofocus: '.vxe-input--inner',
renderEdit: defaultEditRender,
renderCell (renderOpts: any, params: any) {
renderCell (renderOpts, params) {
const { props = {} } = renderOpts
const { row, column } = params
const digits = props.digits || getConfig().input?.digits || 2
Expand Down Expand Up @@ -569,7 +582,7 @@ renderer.mixin({
VxeNumberInput: {
autofocus: '.vxe-number-input--inner',
renderEdit: defaultEditRender,
renderCell (renderOpts: any, params: any) {
renderCell (renderOpts, params) {
const { props = {} } = renderOpts
const { row, column } = params
const digits = props.digits || getConfig().numberInput?.digits || 2
Expand All @@ -590,7 +603,7 @@ renderer.mixin({
VxeDatePicker: {
autofocus: '.vxe-date-picker--inner',
renderEdit: defaultEditRender,
renderCell (renderOpts: any, params: any) {
renderCell (renderOpts, params) {
const { props = {} } = renderOpts
const { row, column } = params
let cellValue = XEUtils.get(row, column.property)
Expand All @@ -615,7 +628,7 @@ renderer.mixin({
autofocus: '.vxe-textarea--inner'
},
VxeButton: {
renderDefault: defaultCellRender
renderDefault: buttonCellRender
},
VxeButtonGroup: {
renderDefault (renderOpts, params) {
Expand All @@ -633,13 +646,13 @@ renderer.mixin({
autofocus: '.vxe-input--inner',
renderEdit: defaultSelectEditRender,
renderDefault: defaultSelectEditRender,
renderCell (renderOpts: any, params: any) {
renderCell (renderOpts, params) {
return getCellLabelVNs(renderOpts, params, getSelectCellValue(renderOpts, params))
},
renderFilter (renderOpts: any, params: any) {
renderFilter (renderOpts, params) {
const { column } = params
const { options, optionProps, optionGroups, optionGroupProps } = renderOpts
return column.filters.map((option: any, oIndex: any) => {
return column.filters.map((option, oIndex) => {
const optionValue = option.data
return h(getDefaultComponent(renderOpts), {
key: oIndex,
Expand All @@ -651,17 +664,11 @@ renderer.mixin({
defaultFilterMethod: handleFilterMethod,
exportMethod: handleExportSelectMethod
},
VxeRadio: {
renderDefault: defaultCellRender
},
VxeRadioGroup: {
renderDefault: defaultCellRender
},
VxeCheckbox: {
renderDefault: defaultCellRender
renderDefault: radioAndCheckboxEditRender
},
VxeCheckboxGroup: {
renderDefault: defaultCellRender
renderDefault: radioAndCheckboxEditRender
},
VxeSwitch: {
autofocus: '.vxe-switch--button',
Expand All @@ -676,7 +683,7 @@ renderer.mixin({
$input: {
autofocus: '.vxe-input--inner',
renderEdit: oldEditRender,
renderCell (renderOpts: any, params: any) {
renderCell (renderOpts, params) {
const { props = {} } = renderOpts
const { row, column } = params
const digits = props.digits || getConfig().input?.digits || 2
Expand Down Expand Up @@ -713,13 +720,13 @@ renderer.mixin({
autofocus: '.vxe-input--inner',
renderEdit: oldSelectEditRender,
renderDefault: oldSelectEditRender,
renderCell (renderOpts: any, params: any) {
renderCell (renderOpts, params) {
return getCellLabelVNs(renderOpts, params, getSelectCellValue(renderOpts, params))
},
renderFilter (renderOpts: any, params: any) {
renderFilter (renderOpts, params) {
const { column } = params
const { options, optionProps, optionGroups, optionGroupProps } = renderOpts
return column.filters.map((option: any, oIndex: any) => {
return column.filters.map((option, oIndex) => {
const optionValue = option.data
return h(getOldComponent(renderOpts), {
key: oIndex,
Expand Down

0 comments on commit 409265b

Please sign in to comment.