Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
xuliangzhan committed Mar 21, 2021
1 parent 8049d15 commit 2ad10d5
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 7 deletions.
27 changes: 22 additions & 5 deletions index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,23 @@ function getItemProps (renderOpts: RenderOptions, params: FormItemRenderParams,
return XEUtils.assign(vSize ? { size: vSize } : {}, defaultProps, renderOpts.props, { [getModelProp(renderOpts)]: value })
}

function formatText (cellValue: any) {
return '' + (isEmptyValue(cellValue) ? '' : cellValue)
}

function getCellLabelVNs (h: CreateElement, renderOpts: ColumnEditRenderOptions, params: ColumnEditRenderParams, cellLabel: any) {
const { placeholder } = renderOpts
return [
h('span', {
class: 'vxe-cell--label'
}, placeholder && isEmptyValue(cellLabel) ? [
h('span', {
class: 'vxe-cell--placeholder'
}, formatText(placeholder))
] : formatText(cellLabel))
]
}

function getNativeOns (renderOpts: RenderOptions, params: RenderParams) {
const { nativeEvents } = renderOpts
const nativeOns: { [type: string]: Function } = {}
Expand Down Expand Up @@ -192,7 +209,7 @@ function getSelectCellValue (renderOpts: ColumnCellRenderOptions, params: Column
return cellLabel
}).join(', ')
}
return null
return ''
}

function getCascaderCellValue (renderOpts: RenderOptions, params: ColumnCellRenderParams) {
Expand Down Expand Up @@ -322,7 +339,7 @@ function renderOptions (h: CreateElement, options: any[], optionProps: OptionPro
}

function cellText (h: CreateElement, cellValue: any) {
return ['' + (isEmptyValue(cellValue) ? '' : cellValue)]
return [formatText(cellValue)]
}

function createFormItemRender (defaultProps?: { [key: string]: any }) {
Expand Down Expand Up @@ -494,7 +511,7 @@ export const VXETablePluginIView = {
]
},
renderCell (h, renderOpts, params) {
return cellText(h, getSelectCellValue(renderOpts, params))
return getCellLabelVNs(h, renderOpts, params, getSelectCellValue(renderOpts, params))
},
renderFilter (h, renderOpts, params) {
const { options = [], optionGroups, optionProps = {}, optionGroupProps = {} } = renderOpts
Expand Down Expand Up @@ -638,7 +655,7 @@ export const VXETablePluginIView = {
Cascader: {
renderEdit: createEditRender({ transfer: true }),
renderCell (h, renderOpts, params) {
return cellText(h, getCascaderCellValue(renderOpts, params))
return getCellLabelVNs(h, renderOpts, params, getCascaderCellValue(renderOpts, params))
},
renderItem: createFormItemRender(),
renderItemContent: createFormItemRender(),
Expand All @@ -648,7 +665,7 @@ export const VXETablePluginIView = {
DatePicker: {
renderEdit: createEditRender({ transfer: true }),
renderCell (h, renderOpts, params) {
return cellText(h, getDatePickerCellValue(renderOpts, params))
return getCellLabelVNs(h, renderOpts, params, getDatePickerCellValue(renderOpts, params))
},
renderFilter (h, renderOpts, params) {
const { column } = params
Expand Down
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-plugin-iview",
"version": "1.11.0",
"version": "1.11.1",
"description": "基于 vxe-table 表格的适配插件,用于兼容 iview、view-design 组件库",
"scripts": {
"lib": "gulp build"
Expand Down Expand Up @@ -53,7 +53,7 @@
"xe-utils": "^3.1.11"
},
"peerDependencies": {
"vxe-table": "^2.10.0"
"vxe-table": "^2.10.0 || ^3.2.0"
},
"repository": {
"type": "git",
Expand Down

0 comments on commit 2ad10d5

Please sign in to comment.