fix menu-config.enabled 修改导致报错问题 #2509

This commit is contained in:
xuliangzhan
2024-08-07 22:17:13 +08:00
parent 89af65ae30
commit fc64edf05e
7 changed files with 63 additions and 45 deletions

View File

@@ -1,6 +1,6 @@
# vxe-table # 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) [![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) [![npm version](https://img.shields.io/npm/v/vxe-table.svg?style=flat-square)](https://www.npmjs.com/package/vxe-table)

View File

@@ -1,6 +1,6 @@
# vxe-table # 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) [![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) [![npm version](https://img.shields.io/npm/v/vxe-table.svg?style=flat-square)](https://www.npmjs.com/package/vxe-table)
@@ -59,8 +59,8 @@ Latest ✔ | Latest ✔ | Latest ✔ | Latest ✔ | Latest ✔ |
* [x] 虛擬滾動 * [x] 虛擬滾動
* [x] 虛擬合併 * [x] 虛擬合併
* [x] CSS 變量主題 * [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/)) 儲存格查找和替換
* [x] ([企業版](https://vxetable.cn/pluginDocs/)) 全鍵盤操作 * [x] ([企業版](https://vxetable.cn/pluginDocs/)) 全鍵盤操作

View File

@@ -28,7 +28,7 @@
"style": "lib/style.css", "style": "lib/style.css",
"typings": "types/index.d.ts", "typings": "types/index.d.ts",
"dependencies": { "dependencies": {
"vxe-pc-ui": "^4.0.88" "vxe-pc-ui": "^4.0.91"
}, },
"devDependencies": { "devDependencies": {
"@types/resize-observer-browser": "^0.1.11", "@types/resize-observer-browser": "^0.1.11",

View File

@@ -19,7 +19,7 @@ export default defineComponent({
refElem refElem
} }
const $xemenupanel: any = { const $xeMenuPanel: any = {
xID, xID,
props, props,
context, context,
@@ -123,9 +123,9 @@ export default defineComponent({
]) ])
} }
$xemenupanel.renderVN = renderVN $xeMenuPanel.renderVN = renderVN
return $xemenupanel return $xeMenuPanel
}, },
render () { render () {
return this.renderVN() return this.renderVN()

View File

@@ -7,7 +7,7 @@ const { getConfig } = VxeUI
export default { export default {
/** 基本属性 */ /** 基本属性 */
id: String as PropType<VxeTablePropTypes.ID>, id: [String, Function] as PropType<VxeTablePropTypes.ID>,
// 数据 // 数据
data: Array as PropType<any[]>, data: Array as PropType<any[]>,
// 表格的高度 // 表格的高度

View File

@@ -363,6 +363,17 @@ export default defineComponent({
const $xeGrid = inject<(VxeGridConstructor & VxeGridPrivateMethods) | null>('$xeGrid', null) const $xeGrid = inject<(VxeGridConstructor & VxeGridPrivateMethods) | null>('$xeGrid', null)
let $xeToolbar: VxeToolbarConstructor 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(() => { const computeValidOpts = computed(() => {
return Object.assign({}, getConfig().table.validConfig, props.validConfig) as VxeTablePropTypes.ValidOpts return Object.assign({}, getConfig().table.validConfig, props.validConfig) as VxeTablePropTypes.ValidOpts
}) })
@@ -622,6 +633,7 @@ export default defineComponent({
const computeMaps: VxeTablePrivateComputed = { const computeMaps: VxeTablePrivateComputed = {
computeSize, computeSize,
computeTableId,
computeValidOpts, computeValidOpts,
computeSXOpts, computeSXOpts,
computeSYOpts, computeSYOpts,
@@ -943,7 +955,8 @@ export default defineComponent({
* 还原自定义列操作状态 * 还原自定义列操作状态
*/ */
const restoreCustomStorage = () => { const restoreCustomStorage = () => {
const { id, customConfig } = props const { customConfig } = props
const tableId = computeTableId.value
const customOpts = computeCustomOpts.value const customOpts = computeCustomOpts.value
const { storage, restoreStore } = customOpts const { storage, restoreStore } = customOpts
const isAllCustom = storage === true const isAllCustom = storage === true
@@ -953,14 +966,14 @@ export default defineComponent({
const isCustomFixed = isAllCustom || storageOpts.fixed const isCustomFixed = isAllCustom || storageOpts.fixed
const isCustomSort = isAllCustom || storageOpts.sort const isCustomSort = isAllCustom || storageOpts.sort
if (customConfig && (isCustomResizable || isCustomVisible || isCustomFixed || isCustomSort)) { if (customConfig && (isCustomResizable || isCustomVisible || isCustomFixed || isCustomSort)) {
if (!id) { if (!tableId) {
errLog('vxe.error.reqProp', ['id']) errLog('vxe.error.reqProp', ['id'])
return return
} }
const storeData: VxeTableDefines.CustomStoreData = getCustomStorageMap(id) const storeData: VxeTableDefines.CustomStoreData = getCustomStorageMap(tableId)
if (restoreStore) { if (restoreStore) {
return Promise.resolve( return Promise.resolve(
restoreStore({ id, type: 'restore', storeData }) restoreStore({ id: tableId, type: 'restore', storeData })
).then(storeData => { ).then(storeData => {
if (!storeData) { if (!storeData) {
return return
@@ -4823,9 +4836,9 @@ export default defineComponent({
$xeTable.clearSelected() $xeTable.clearSelected()
} }
if (areaOpts.autoClear) { if (areaOpts.autoClear) {
if ($xeTable.clearCellAreas) { if ($xeTable.getCellAreas) {
const cellAreas = $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', {}, () => { tablePrivateMethods.preventEvent(evnt, 'event.clearAreas', {}, () => {
$xeTable.clearCellAreas() $xeTable.clearCellAreas()
$xeTable.clearCopyCellArea() $xeTable.clearCopyCellArea()
@@ -5503,7 +5516,7 @@ export default defineComponent({
Object.assign(reactData.columnStore, { resizeList, pxList, pxMinList, scaleList, scaleMinList, autoList, remainList }) Object.assign(reactData.columnStore, { resizeList, pxList, pxMinList, scaleList, scaleMinList, autoList, remainList })
}, },
saveCustomStore (type) { saveCustomStore (type) {
const { id } = props const tableId = computeTableId.value
const customOpts = computeCustomOpts.value const customOpts = computeCustomOpts.value
const { updateStore, storage } = customOpts const { updateStore, storage } = customOpts
const isAllCustom = storage === true const isAllCustom = storage === true
@@ -5513,7 +5526,7 @@ export default defineComponent({
const isCustomFixed = isAllCustom || storageOpts.fixed const isCustomFixed = isAllCustom || storageOpts.fixed
const isCustomSort = isAllCustom || storageOpts.sort const isCustomSort = isAllCustom || storageOpts.sort
if (isCustomResizable || isCustomVisible || isCustomFixed || isCustomSort) { if (isCustomResizable || isCustomVisible || isCustomFixed || isCustomSort) {
if (!id) { if (!tableId) {
errLog('vxe.error.reqProp', ['id']) errLog('vxe.error.reqProp', ['id'])
return nextTick() return nextTick()
} }
@@ -5527,12 +5540,12 @@ export default defineComponent({
: tableMethods.getCustomStoreData() : tableMethods.getCustomStoreData()
if (updateStore) { if (updateStore) {
return updateStore({ return updateStore({
id, id: tableId,
type, type,
storeData storeData
}) })
} else { } else {
setCustomStorageMap(id, type === 'reset' ? null : storeData) setCustomStorageMap(tableId, type === 'reset' ? null : storeData)
} }
} }
return nextTick() return nextTick()
@@ -7093,34 +7106,37 @@ export default defineComponent({
}) })
: createCommentVNode(), : createCommentVNode(),
/** /**
* 通用提示 * 提示相关
*/ */
VxeUITooltipComponent VxeUITooltipComponent
? h(VxeUITooltipComponent, { ? h('div', {}, [
ref: refCommTooltip, /**
isArrow: false, * 通用提示
enterable: false */
}) h(VxeUITooltipComponent, {
: createCommentVNode(), ref: refCommTooltip,
/** isArrow: false,
* 工具提示 enterable: false
*/ }),
VxeUITooltipComponent /**
? h(VxeUITooltipComponent, Object.assign({ * 工具提示
ref: refTooltip */
}, tipConfig, tooltipStore.currOpts)) h(VxeUITooltipComponent, Object.assign({
: createCommentVNode(), ref: refTooltip
/** }, tipConfig, tooltipStore.currOpts)),
* 校验提示 /**
*/ * 校验提示
VxeUITooltipComponent && props.editRules && validOpts.showMessage && (validOpts.message === 'default' ? !height : validOpts.message === 'tooltip') */
? h(VxeUITooltipComponent, { props.editRules && validOpts.showMessage && (validOpts.message === 'default' ? !height : validOpts.message === 'tooltip')
ref: refValidTooltip, ? h(VxeUITooltipComponent, {
class: [{ ref: refValidTooltip,
'old-cell-valid': editRules && getConfig().cellVaildMode === 'obsolete' class: [{
}, 'vxe-table--valid-error'], 'old-cell-valid': editRules && getConfig().cellVaildMode === 'obsolete'
...(validOpts.message === 'tooltip' || tableData.length === 1 ? validTipOpts : {}) as any }, 'vxe-table--valid-error'],
}) ...(validOpts.message === 'tooltip' || tableData.length === 1 ? validTipOpts : {}) as any
})
: createCommentVNode()
])
: createCommentVNode() : createCommentVNode()
]) ])
} }

View File

@@ -1,3 +1,5 @@
@import './old-icon.scss';
@font-face { @font-face {
font-family: "vxetableiconfont"; font-family: "vxetableiconfont";
src: src: