Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
xuliangzhan committed Nov 19, 2020
1 parent 72e77de commit 49b0133
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 8 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ VXETable.use(VXETablePluginMenus, {
| CLEAR_MERGE_CELL | 如果启用 mouse-config.area 功能,清除区域范围内单元格的临时合并状态 ||
| CLEAR_ALL_MERGE | 清除所有单元格及表尾的临时合并状态 ||
| COPY_CELL | 复制单元格数据的值;如果启用 mouse-config.area 功能,则复制区域范围内的单元格数据,支持 Excel 和 WPS ||
| CUT_CELL | 剪贴单元格数据的值;如果启用 mouse-config.area 功能,则剪贴区域范围内的单元格数据,支持 Excel 和 WPS ||
| CUT_CELL | (仅支持在单表区域内操作)剪贴单元格数据的值;如果启用 mouse-config.area 功能,则剪贴区域范围内的单元格数据,支持 Excel 和 WPS ||
| PASTE_CELL | 粘贴从表格中被复制的数据;如果启用 mouse-config.area 功能,则粘贴区域范围内的单元格数据,不支持读取剪贴板 ||
| INSERT_ROW | 插入数据 | records |
| INSERT_ACTIVED_ROW | 插入数据并激活编辑状态 | Array\<records, field\> |
Expand Down
15 changes: 9 additions & 6 deletions index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -598,6 +598,15 @@ function checkPrivilege(item: MenuFirstOption | MenuChildOption, params: Interce
case 'PASTE_CELL': {
const cellAreas = $table.mouseConfig && $table.mouseOpts.area ? $table.getCellAreas() : []
item.disabled = cellAreas.length > 1
if (!item.disabled) {
switch (code) {
case 'PASTE_CELL':
const { $vxe } = $table
const { clipboard } = $vxe
item.disabled = !clipboard || !clipboard.text
break
}
}
break
}
case 'MERGE_OR_CLEAR':
Expand All @@ -615,12 +624,6 @@ function checkPrivilege(item: MenuFirstOption | MenuChildOption, params: Interce
case 'CLEAR_FIXED_COLUMN':
item.disabled = isChildCol || !column.fixed
break
case 'PASTE_CELL': {
const { $vxe } = $table
const { clipboard } = $vxe
item.disabled = !clipboard || !clipboard.text
break
}
}
}
break
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "vxe-table-plugin-menus",
"version": "1.5.0",
"version": "1.5.1",
"description": "基于 vxe-table 的表格插件,提供实用的快捷菜单集",
"scripts": {
"lib": "gulp build"
Expand Down

0 comments on commit 49b0133

Please sign in to comment.