Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
xuliangzhan committed Sep 1, 2020
1 parent 22c6fc8 commit 2c62904
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 10 deletions.
25 changes: 16 additions & 9 deletions index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,8 @@ function handleCopyOrCut(params: MenuLinkParams, isCut?: boolean) {
if (row && column) {
let text = ''
if ($table.mouseConfig && $table.mouseOpts.area) {
if (isCut) {
$table.cutCellArea()
} else {
$table.copyCellArea()
}
const clipRest = isCut ? $table.cutCellArea() : $table.copyCellArea()
text = clipRest.text
} else {
const { $vxe } = $table
text = XEUtils.toString(XEUtils.get(row, column.property))
Expand Down Expand Up @@ -610,16 +607,26 @@ function handlePrivilegeEvent(params: InterceptorMenuParams) {
})
}

interface VXETablePluginMenusOptions {
copy?: typeof handleCopy;
}

function setup (options?: VXETablePluginMenusOptions) {
if (options && options.copy) {
handleCopy = options.copy
}
}

/**
* 基于 vxe-table 表格的增强插件,提供实用的快捷菜单集
*/
export const VXETablePluginMenus = {
install({ interceptor, menus }: typeof VXETable, options?: { copy?: typeof handleCopy }) {
if (options && options.copy) {
handleCopy = options.copy
} else if (window.XEClipboard) {
setup,
install({ interceptor, menus }: typeof VXETable, options?: VXETablePluginMenusOptions) {
if (window.XEClipboard) {
handleCopy = window.XEClipboard.copy
}
setup(options)
interceptor.add('event.showMenu', handlePrivilegeEvent)
menus.mixin(menuMap)
}
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.4.6",
"version": "1.4.7",
"description": "基于 vxe-table 表格的增强插件,提供实用的快捷菜单集",
"scripts": {
"lib": "gulp build"
Expand Down

0 comments on commit 2c62904

Please sign in to comment.