Skip to content

Commit

Permalink
fix menu-config.enabled 修改导致报错问题 #2509
Browse files Browse the repository at this point in the history
  • Loading branch information
xuliangzhan committed Aug 7, 2024
1 parent 89af65a commit fc64edf
Show file tree
Hide file tree
Showing 7 changed files with 63 additions and 45 deletions.
2 changes: 1 addition & 1 deletion README.en.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# vxe-table

[简体中文](README.md) | [繁體中文](README.zh-TW.md) | English
[简体中文](README.md) | [繁體中文](README.zh-TW.md) | English | [日本語](README.ja-JP.md)

[![star](https://gitee.com/xuliangzhan_admin/vxe-table/badge/star.svg?theme=gvp)](https://gitee.com/xuliangzhan_admin/vxe-table/stargazers)
[![npm version](https://img.shields.io/npm/v/vxe-table.svg?style=flat-square)](https://www.npmjs.com/package/vxe-table)
Expand Down
6 changes: 3 additions & 3 deletions README.zh-TW.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# vxe-table

[简体中文](README.md) | 繁體中文 | [English](README.en.md)
[简体中文](README.md) | 繁體中文 | [English](README.en.md) | [日本語](README.ja-JP.md)

[![star](https://gitee.com/xuliangzhan_admin/vxe-table/badge/star.svg?theme=gvp)](https://gitee.com/xuliangzhan_admin/vxe-table/stargazers)
[![npm version](https://img.shields.io/npm/v/vxe-table.svg?style=flat-square)](https://www.npmjs.com/package/vxe-table)
Expand Down Expand Up @@ -59,8 +59,8 @@ Latest ✔ | Latest ✔ | Latest ✔ | Latest ✔ | Latest ✔ |
* [x] 虛擬滾動
* [x] 虛擬合併
* [x] CSS 變量主題
* [x] (([企業版](https://vxetable.cn/pluginDocs/))) 儲存格區域選取
* [x] (([企業版](https://vxetable.cn/pluginDocs/))) 儲存格複製/粘貼
* [x] ([企業版](https://vxetable.cn/pluginDocs/)) 儲存格區域選取
* [x] ([企業版](https://vxetable.cn/pluginDocs/)) 儲存格複製/粘貼
* [x] ([企業版](https://vxetable.cn/pluginDocs/)) 儲存格查找和替換
* [x] ([企業版](https://vxetable.cn/pluginDocs/)) 全鍵盤操作

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
"style": "lib/style.css",
"typings": "types/index.d.ts",
"dependencies": {
"vxe-pc-ui": "^4.0.88"
"vxe-pc-ui": "^4.0.91"
},
"devDependencies": {
"@types/resize-observer-browser": "^0.1.11",
Expand Down
6 changes: 3 additions & 3 deletions packages/table/module/menu/panel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ export default defineComponent({
refElem
}

const $xemenupanel: any = {
const $xeMenuPanel: any = {
xID,
props,
context,
Expand Down Expand Up @@ -123,9 +123,9 @@ export default defineComponent({
])
}

$xemenupanel.renderVN = renderVN
$xeMenuPanel.renderVN = renderVN

return $xemenupanel
return $xeMenuPanel
},
render () {
return this.renderVN()
Expand Down
2 changes: 1 addition & 1 deletion packages/table/src/props.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ const { getConfig } = VxeUI

export default {
/** 基本属性 */
id: String as PropType<VxeTablePropTypes.ID>,
id: [String, Function] as PropType<VxeTablePropTypes.ID>,
// 数据
data: Array as PropType<any[]>,
// 表格的高度
Expand Down
88 changes: 52 additions & 36 deletions packages/table/src/table.ts
Original file line number Diff line number Diff line change
Expand Up @@ -363,6 +363,17 @@ export default defineComponent({
const $xeGrid = inject<(VxeGridConstructor & VxeGridPrivateMethods) | null>('$xeGrid', null)
let $xeToolbar: VxeToolbarConstructor

const computeTableId = computed(() => {
const { id } = props
if (id) {
if (XEUtils.isFunction(id)) {
return `${id({ $table: $xeTable, $grid: $xeGrid }) || ''}`
}
return `${id}`
}
return ''
})

const computeValidOpts = computed(() => {
return Object.assign({}, getConfig().table.validConfig, props.validConfig) as VxeTablePropTypes.ValidOpts
})
Expand Down Expand Up @@ -622,6 +633,7 @@ export default defineComponent({

const computeMaps: VxeTablePrivateComputed = {
computeSize,
computeTableId,
computeValidOpts,
computeSXOpts,
computeSYOpts,
Expand Down Expand Up @@ -943,7 +955,8 @@ export default defineComponent({
* 还原自定义列操作状态
*/
const restoreCustomStorage = () => {
const { id, customConfig } = props
const { customConfig } = props
const tableId = computeTableId.value
const customOpts = computeCustomOpts.value
const { storage, restoreStore } = customOpts
const isAllCustom = storage === true
Expand All @@ -953,14 +966,14 @@ export default defineComponent({
const isCustomFixed = isAllCustom || storageOpts.fixed
const isCustomSort = isAllCustom || storageOpts.sort
if (customConfig && (isCustomResizable || isCustomVisible || isCustomFixed || isCustomSort)) {
if (!id) {
if (!tableId) {
errLog('vxe.error.reqProp', ['id'])
return
}
const storeData: VxeTableDefines.CustomStoreData = getCustomStorageMap(id)
const storeData: VxeTableDefines.CustomStoreData = getCustomStorageMap(tableId)
if (restoreStore) {
return Promise.resolve(
restoreStore({ id, type: 'restore', storeData })
restoreStore({ id: tableId, type: 'restore', storeData })
).then(storeData => {
if (!storeData) {
return
Expand Down Expand Up @@ -4823,9 +4836,9 @@ export default defineComponent({
$xeTable.clearSelected()
}
if (areaOpts.autoClear) {
if ($xeTable.clearCellAreas) {
if ($xeTable.getCellAreas) {
const cellAreas = $xeTable.getCellAreas()
if (cellAreas.length && !getEventTargetNode(evnt, document.body, 'vxe-table--ignore-areas-clear').flag) {
if (cellAreas && cellAreas.length && !getEventTargetNode(evnt, document.body, 'vxe-table--ignore-areas-clear').flag) {
tablePrivateMethods.preventEvent(evnt, 'event.clearAreas', {}, () => {
$xeTable.clearCellAreas()
$xeTable.clearCopyCellArea()
Expand Down Expand Up @@ -5503,7 +5516,7 @@ export default defineComponent({
Object.assign(reactData.columnStore, { resizeList, pxList, pxMinList, scaleList, scaleMinList, autoList, remainList })
},
saveCustomStore (type) {
const { id } = props
const tableId = computeTableId.value
const customOpts = computeCustomOpts.value
const { updateStore, storage } = customOpts
const isAllCustom = storage === true
Expand All @@ -5513,7 +5526,7 @@ export default defineComponent({
const isCustomFixed = isAllCustom || storageOpts.fixed
const isCustomSort = isAllCustom || storageOpts.sort
if (isCustomResizable || isCustomVisible || isCustomFixed || isCustomSort) {
if (!id) {
if (!tableId) {
errLog('vxe.error.reqProp', ['id'])
return nextTick()
}
Expand All @@ -5527,12 +5540,12 @@ export default defineComponent({
: tableMethods.getCustomStoreData()
if (updateStore) {
return updateStore({
id,
id: tableId,
type,
storeData
})
} else {
setCustomStorageMap(id, type === 'reset' ? null : storeData)
setCustomStorageMap(tableId, type === 'reset' ? null : storeData)
}
}
return nextTick()
Expand Down Expand Up @@ -7093,34 +7106,37 @@ export default defineComponent({
})
: createCommentVNode(),
/**
* 通用提示
* 提示相关
*/
VxeUITooltipComponent
? h(VxeUITooltipComponent, {
ref: refCommTooltip,
isArrow: false,
enterable: false
})
: createCommentVNode(),
/**
* 工具提示
*/
VxeUITooltipComponent
? h(VxeUITooltipComponent, Object.assign({
ref: refTooltip
}, tipConfig, tooltipStore.currOpts))
: createCommentVNode(),
/**
* 校验提示
*/
VxeUITooltipComponent && props.editRules && validOpts.showMessage && (validOpts.message === 'default' ? !height : validOpts.message === 'tooltip')
? h(VxeUITooltipComponent, {
ref: refValidTooltip,
class: [{
'old-cell-valid': editRules && getConfig().cellVaildMode === 'obsolete'
}, 'vxe-table--valid-error'],
...(validOpts.message === 'tooltip' || tableData.length === 1 ? validTipOpts : {}) as any
})
? h('div', {}, [
/**
* 通用提示
*/
h(VxeUITooltipComponent, {
ref: refCommTooltip,
isArrow: false,
enterable: false
}),
/**
* 工具提示
*/
h(VxeUITooltipComponent, Object.assign({
ref: refTooltip
}, tipConfig, tooltipStore.currOpts)),
/**
* 校验提示
*/
props.editRules && validOpts.showMessage && (validOpts.message === 'default' ? !height : validOpts.message === 'tooltip')
? h(VxeUITooltipComponent, {
ref: refValidTooltip,
class: [{
'old-cell-valid': editRules && getConfig().cellVaildMode === 'obsolete'
}, 'vxe-table--valid-error'],
...(validOpts.message === 'tooltip' || tableData.length === 1 ? validTipOpts : {}) as any
})
: createCommentVNode()
])
: createCommentVNode()
])
}
Expand Down
2 changes: 2 additions & 0 deletions styles/components/icon.scss
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
@import './old-icon.scss';

@font-face {
font-family: "vxetableiconfont";
src:
Expand Down

0 comments on commit fc64edf

Please sign in to comment.