@vxe-ui/plugin-menu 4.0.4 → 4.0.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +20 -20
- package/README.md +130 -129
- package/dist/index.common.js +25 -2
- package/dist/index.umd.js +25 -2
- package/dist/index.umd.min.js +1 -1
- package/package.json +73 -72
- package/types/index.d.ts +14 -14
package/LICENSE
CHANGED
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
MIT License
|
|
2
|
-
|
|
3
|
-
Copyright (c) 2019 Xu Liangzhan
|
|
4
|
-
|
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
-
in the Software without restriction, including without limitation the rights
|
|
8
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
-
furnished to do so, subject to the following conditions:
|
|
11
|
-
|
|
12
|
-
The above copyright notice and this permission notice shall be included in all
|
|
13
|
-
copies or substantial portions of the Software.
|
|
14
|
-
|
|
15
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2019 Xu Liangzhan
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
21
|
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,129 +1,130 @@
|
|
|
1
|
-
# @vxe-ui/plugin-menu
|
|
2
|
-
|
|
3
|
-
[Vxe UI](https://vxeui.com/) plug-in supports context menu.
|
|
4
|
-
|
|
5
|
-
## Compatibility
|
|
6
|
-
|
|
7
|
-
It corresponds to [vxe-table v4](https://www.npmjs.com/package/vxe-table) or [vxe-pc-ui v4](https://www.npmjs.com/package/vxe-pc-ui)
|
|
8
|
-
|
|
9
|
-
## Installing
|
|
10
|
-
|
|
11
|
-
```shell
|
|
12
|
-
npm install @vxe-ui/plugin-menu
|
|
13
|
-
```
|
|
14
|
-
|
|
15
|
-
```javascript
|
|
16
|
-
// ...
|
|
17
|
-
// Use vxe-pc-ui
|
|
18
|
-
import { VxeUI } from 'vxe-pc-ui'
|
|
19
|
-
// Use vxe-table
|
|
20
|
-
// import { VxeUI } from 'vxe-table'
|
|
21
|
-
import VxeUIPluginMenu from '@vxe-ui/plugin-menu'
|
|
22
|
-
// ...
|
|
23
|
-
|
|
24
|
-
VxeUI.use(VxeUIPluginMenu)
|
|
25
|
-
```
|
|
26
|
-
|
|
27
|
-
## API
|
|
28
|
-
|
|
29
|
-
### Context menu codes
|
|
30
|
-
|
|
31
|
-
| code 编码 | describe 描述 | params 参数 |
|
|
32
|
-
|------|------|------|
|
|
33
|
-
| CLEAR_CELL | 清除单元格数据的值;如果启用 mouse-config.area 功能,则清除区域范围内的单元格数据 | — |
|
|
34
|
-
| CLEAR_ROW | 清除行数据的值 | — |
|
|
35
|
-
| CLEAR_CHECKBOX_ROW | 清除复选框选中行数据的值 | — |
|
|
36
|
-
| CLEAR_AREA_ROW | 如果启用 mouse-config.area 功能,清除区域选择范围内数据的值,否则清除行数据的值 | — |
|
|
37
|
-
| CLEAR_ALL | 清除所有数据的值 | — |
|
|
38
|
-
| REVERT_CELL | 还原单元格数据的值;如果启用 mouse-config.area 功能,则还原区域范围内的单元格数据 | — |
|
|
39
|
-
| REVERT_ROW | 还原行数据的值 | — |
|
|
40
|
-
| REVERT_CHECKBOX_ROW | 还原复选框选中行数据的值 | — |
|
|
41
|
-
| REVERT_ALL | 还原所有数据的值 | — |
|
|
42
|
-
| MERGE_OR_CLEAR | 如果启用 mouse-config.area 功能,如果所选区域内已存在合并单元格,则取消临时合并,否则临时合并 | — |
|
|
43
|
-
| MERGE_CELL | 如果启用 mouse-config.area 功能,临时合并区域范围内的单元格,不管是否存在已合并 | — |
|
|
44
|
-
| CLEAR_MERGE_CELL | 如果启用 mouse-config.area 功能,清除区域范围内单元格的临时合并状态 | — |
|
|
45
|
-
| CLEAR_ALL_MERGE | 清除所有单元格及表尾的临时合并状态 | — |
|
|
46
|
-
|
|
|
47
|
-
|
|
|
48
|
-
|
|
|
49
|
-
|
|
|
50
|
-
|
|
|
51
|
-
|
|
|
52
|
-
|
|
|
53
|
-
|
|
|
54
|
-
|
|
|
55
|
-
|
|
|
56
|
-
|
|
|
57
|
-
|
|
|
58
|
-
|
|
|
59
|
-
|
|
|
60
|
-
|
|
|
61
|
-
|
|
|
62
|
-
|
|
|
63
|
-
|
|
|
64
|
-
|
|
|
65
|
-
|
|
|
66
|
-
|
|
|
67
|
-
|
|
|
68
|
-
|
|
|
69
|
-
|
|
|
70
|
-
|
|
|
71
|
-
|
|
|
72
|
-
|
|
|
73
|
-
|
|
|
74
|
-
|
|
|
75
|
-
|
|
|
76
|
-
|
|
|
77
|
-
|
|
|
78
|
-
|
|
|
79
|
-
|
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
:
|
|
88
|
-
:
|
|
89
|
-
|
|
90
|
-
<vxe-column
|
|
91
|
-
<vxe-column field="
|
|
92
|
-
<vxe-column field="
|
|
93
|
-
|
|
94
|
-
</
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
{ id:
|
|
103
|
-
{ id:
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
{ code: '
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
}
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
1
|
+
# @vxe-ui/plugin-menu
|
|
2
|
+
|
|
3
|
+
[Vxe UI](https://vxeui.com/) plug-in supports context menu.
|
|
4
|
+
|
|
5
|
+
## Compatibility
|
|
6
|
+
|
|
7
|
+
It corresponds to [vxe-table v4](https://www.npmjs.com/package/vxe-table) or [vxe-pc-ui v4](https://www.npmjs.com/package/vxe-pc-ui)
|
|
8
|
+
|
|
9
|
+
## Installing
|
|
10
|
+
|
|
11
|
+
```shell
|
|
12
|
+
npm install @vxe-ui/plugin-menu
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
```javascript
|
|
16
|
+
// ...
|
|
17
|
+
// Use vxe-pc-ui
|
|
18
|
+
import { VxeUI } from 'vxe-pc-ui'
|
|
19
|
+
// Use vxe-table
|
|
20
|
+
// import { VxeUI } from 'vxe-table'
|
|
21
|
+
import VxeUIPluginMenu from '@vxe-ui/plugin-menu'
|
|
22
|
+
// ...
|
|
23
|
+
|
|
24
|
+
VxeUI.use(VxeUIPluginMenu)
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
## API
|
|
28
|
+
|
|
29
|
+
### Context menu codes
|
|
30
|
+
|
|
31
|
+
| code 编码 | describe 描述 | params 参数 |
|
|
32
|
+
|------|------|------|
|
|
33
|
+
| CLEAR_CELL | 清除单元格数据的值;如果启用 mouse-config.area 功能,则清除区域范围内的单元格数据 | — |
|
|
34
|
+
| CLEAR_ROW | 清除行数据的值 | — |
|
|
35
|
+
| CLEAR_CHECKBOX_ROW | 清除复选框选中行数据的值 | — |
|
|
36
|
+
| CLEAR_AREA_ROW | 如果启用 mouse-config.area 功能,清除区域选择范围内数据的值,否则清除行数据的值 | — |
|
|
37
|
+
| CLEAR_ALL | 清除所有数据的值 | — |
|
|
38
|
+
| REVERT_CELL | 还原单元格数据的值;如果启用 mouse-config.area 功能,则还原区域范围内的单元格数据 | — |
|
|
39
|
+
| REVERT_ROW | 还原行数据的值 | — |
|
|
40
|
+
| REVERT_CHECKBOX_ROW | 还原复选框选中行数据的值 | — |
|
|
41
|
+
| REVERT_ALL | 还原所有数据的值 | — |
|
|
42
|
+
| MERGE_OR_CLEAR | 如果启用 mouse-config.area 功能,如果所选区域内已存在合并单元格,则取消临时合并,否则临时合并 | — |
|
|
43
|
+
| MERGE_CELL | 如果启用 mouse-config.area 功能,临时合并区域范围内的单元格,不管是否存在已合并 | — |
|
|
44
|
+
| CLEAR_MERGE_CELL | 如果启用 mouse-config.area 功能,清除区域范围内单元格的临时合并状态 | — |
|
|
45
|
+
| CLEAR_ALL_MERGE | 清除所有单元格及表尾的临时合并状态 | — |
|
|
46
|
+
| COPY_TITLE | 复制列头标题 | — |
|
|
47
|
+
| COPY_CELL | 复制单元格数据的值;如果启用 mouse-config.area 功能,则复制区域范围内的单元格数据,支持 Excel 和 WPS | — |
|
|
48
|
+
| CUT_CELL | 剪贴单元格数据的值;如果启用 mouse-config.area 功能,则剪贴区域范围内的单元格数据,支持 Excel 和 WPS | — |
|
|
49
|
+
| PASTE_CELL | (仅支持在单表区域内操作)粘贴从表格中被复制的数据;如果启用 mouse-config.area 功能,则粘贴区域范围内的单元格数据,不支持读取剪贴板 | — |
|
|
50
|
+
| EDIT_CELL | 编辑选中单元格 | — |
|
|
51
|
+
| EDIT_ROW | 编辑选中行并激活选中单元格 | — |
|
|
52
|
+
| INSERT_ROW | 插入数据 | records |
|
|
53
|
+
| INSERT_EDIT_ROW | 插入数据并激活编辑状态 | Array\<records, field\> |
|
|
54
|
+
| INSERT_AT_ROW | 插入数据到指定位置 | records |
|
|
55
|
+
| INSERT_AT_EDIT_ROW | 插入数据到指定位置并激活编辑状态 | Array\<records, field\> |
|
|
56
|
+
| DELETE_ROW | 移除行数据 | — |
|
|
57
|
+
| DELETE_AREA_ROW | 如果启用 mouse-config.area 功能,移除所选区域行数据;否则删除当前行 | — |
|
|
58
|
+
| DELETE_CHECKBOX_ROW | 移除复选框选中行数据 | — |
|
|
59
|
+
| DELETE_ALL | 移除所有行数据 | — |
|
|
60
|
+
| CLEAR_SORT | 清除所选列排序条件 | — |
|
|
61
|
+
| CLEAR_ALL_SORT | 清除所有排序条件 | — |
|
|
62
|
+
| SORT_ASC | 按所选列的值升序 | — |
|
|
63
|
+
| SORT_DESC | 按所选列的值倒序 | — |
|
|
64
|
+
| CLEAR_FILTER | 清除选中列的筛选条件 | — |
|
|
65
|
+
| CLEAR_ALL_FILTER | 清除所有列筛选条件 | — |
|
|
66
|
+
| FILTER_CELL | 根据单元格值筛选 | — |
|
|
67
|
+
| EXPORT_ROW | 导出行数据 | options |
|
|
68
|
+
| EXPORT_CHECKBOX_ROW | 导出复选框选中行数据 | options |
|
|
69
|
+
| EXPORT_ALL | 导出所有行数据 | options |
|
|
70
|
+
| PRINT_ALL | 打印所有行数据 | options |
|
|
71
|
+
| PRINT_CHECKBOX_ROW | 打印复选框选中行 | options |
|
|
72
|
+
| OPEN_FIND | 如果启用 mouse-config.area 功能,打开单元格查找功能 | — |
|
|
73
|
+
| OPEN_REPLACE | 如果启用 mouse-config.area 功能,打开单元格替换功能 | — |
|
|
74
|
+
| FIXED_LEFT_COLUMN | 将列固定到左侧 | — |
|
|
75
|
+
| FIXED_RIGHT_COLUMN | 将列固定到右侧 | — |
|
|
76
|
+
| CLEAR_FIXED_COLUMN | 清除固定列 | — |
|
|
77
|
+
| HIDDEN_COLUMN | 隐藏当前列 | — |
|
|
78
|
+
| RESET_COLUMN | 重置列的可视状态 | — |
|
|
79
|
+
| RESET_RESIZABLE | 重置列宽状态 | — |
|
|
80
|
+
| RESET_ALL | 重置列的所有状态 | — |
|
|
81
|
+
|
|
82
|
+
## Table Demo
|
|
83
|
+
|
|
84
|
+
```html
|
|
85
|
+
<template>
|
|
86
|
+
<vxe-table
|
|
87
|
+
:data="tableData"
|
|
88
|
+
:menu-config="menuConfig"
|
|
89
|
+
:edit-config="{trigger: 'click', mode: 'cell'}">
|
|
90
|
+
<vxe-column type="seq" width="60"></vxe-column>
|
|
91
|
+
<vxe-column field="name" title="Name" :edit-render="{name: 'input'}"></vxe-column>
|
|
92
|
+
<vxe-column field="sex" title="sex" :edit-render="{name: 'input'}"></vxe-column>
|
|
93
|
+
<vxe-column field="age" title="Age" :edit-render="{name: 'input'}"></vxe-column>
|
|
94
|
+
</vxe-table>
|
|
95
|
+
</template>
|
|
96
|
+
|
|
97
|
+
<script>
|
|
98
|
+
export default {
|
|
99
|
+
data () {
|
|
100
|
+
return {
|
|
101
|
+
tableData: [
|
|
102
|
+
{ id: 100, name: 'test1', age: 28, sex: '1' },
|
|
103
|
+
{ id: 101, name: 'test2', age: 32, sex: '0' },
|
|
104
|
+
{ id: 102, name: 'test3', age: 36, sex: '1' }
|
|
105
|
+
],
|
|
106
|
+
menuConfig: {
|
|
107
|
+
body: {
|
|
108
|
+
options: [
|
|
109
|
+
[
|
|
110
|
+
{ code: 'EXPORT_ALL', name: '导出.csv' },
|
|
111
|
+
{ code: 'INSERT_EDIT_ROW', name: '新增' }
|
|
112
|
+
]
|
|
113
|
+
]
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
</script>
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
## Contributors
|
|
123
|
+
|
|
124
|
+
Thank you to everyone who contributed to this project.
|
|
125
|
+
|
|
126
|
+
[](https://github.com/x-extends/vxe-ui-plugins/graphs/contributors)
|
|
127
|
+
|
|
128
|
+
## License
|
|
129
|
+
|
|
130
|
+
[MIT](LICENSE) © 2019-present, Xu Liangzhan
|
package/dist/index.common.js
CHANGED
|
@@ -180,7 +180,8 @@ function checkPrivilege(item, params) {
|
|
|
180
180
|
var code = item.code;
|
|
181
181
|
var $table = params.$table,
|
|
182
182
|
row = params.row,
|
|
183
|
-
column = params.column
|
|
183
|
+
column = params.column,
|
|
184
|
+
type = params.type;
|
|
184
185
|
var tableProps = $table.props;
|
|
185
186
|
var editConfig = tableProps.editConfig,
|
|
186
187
|
mouseConfig = tableProps.mouseConfig;
|
|
@@ -210,6 +211,11 @@ function checkPrivilege(item, params) {
|
|
|
210
211
|
item.disabled = !beenMerges.length;
|
|
211
212
|
break;
|
|
212
213
|
}
|
|
214
|
+
case 'COPY_TITLE':
|
|
215
|
+
{
|
|
216
|
+
item.disabled = !column || type !== 'header';
|
|
217
|
+
break;
|
|
218
|
+
}
|
|
213
219
|
case 'EDIT_CELL':
|
|
214
220
|
case 'CLEAR_CELL':
|
|
215
221
|
case 'CLEAR_ROW':
|
|
@@ -355,7 +361,7 @@ var VxeUIPluginMenu = exports.VxeUIPluginMenu = {
|
|
|
355
361
|
VxeUI = core;
|
|
356
362
|
// 检查版本
|
|
357
363
|
if (!/^(4)\./.test(VxeUI.uiVersion)) {
|
|
358
|
-
console.error('[plugin-menu 4.
|
|
364
|
+
console.error('[@vxe-ui/plugin-menu 4.0.6] Requires vxe-table 4.7.0+ version. https://vxeui.com/other4/#/plugin-export-xlsx/install');
|
|
359
365
|
}
|
|
360
366
|
pluginSetup(options);
|
|
361
367
|
VxeUI.menus.mixin({
|
|
@@ -511,6 +517,23 @@ var VxeUIPluginMenu = exports.VxeUIPluginMenu = {
|
|
|
511
517
|
$table.revertData();
|
|
512
518
|
}
|
|
513
519
|
},
|
|
520
|
+
/**
|
|
521
|
+
* 复制列头标题
|
|
522
|
+
*/
|
|
523
|
+
COPY_TITLE: {
|
|
524
|
+
menuMethod: function menuMethod(params) {
|
|
525
|
+
var column = params.column;
|
|
526
|
+
var text = column.getTitle();
|
|
527
|
+
if (text) {
|
|
528
|
+
// 开始复制操作
|
|
529
|
+
if (_xeUtils["default"].isFunction(handleCopy)) {
|
|
530
|
+
handleCopy(text);
|
|
531
|
+
} else {
|
|
532
|
+
copyText(text);
|
|
533
|
+
}
|
|
534
|
+
}
|
|
535
|
+
}
|
|
536
|
+
},
|
|
514
537
|
/**
|
|
515
538
|
* 复制单元格数据的值;如果启用 mouse-config.area 功能,则复制区域范围内的单元格数据,支持 Excel 和 WPS
|
|
516
539
|
*/
|
package/dist/index.umd.js
CHANGED
|
@@ -193,7 +193,8 @@
|
|
|
193
193
|
var code = item.code;
|
|
194
194
|
var $table = params.$table,
|
|
195
195
|
row = params.row,
|
|
196
|
-
column = params.column
|
|
196
|
+
column = params.column,
|
|
197
|
+
type = params.type;
|
|
197
198
|
var tableProps = $table.props;
|
|
198
199
|
var editConfig = tableProps.editConfig,
|
|
199
200
|
mouseConfig = tableProps.mouseConfig;
|
|
@@ -223,6 +224,11 @@
|
|
|
223
224
|
item.disabled = !beenMerges.length;
|
|
224
225
|
break;
|
|
225
226
|
}
|
|
227
|
+
case 'COPY_TITLE':
|
|
228
|
+
{
|
|
229
|
+
item.disabled = !column || type !== 'header';
|
|
230
|
+
break;
|
|
231
|
+
}
|
|
226
232
|
case 'EDIT_CELL':
|
|
227
233
|
case 'CLEAR_CELL':
|
|
228
234
|
case 'CLEAR_ROW':
|
|
@@ -368,7 +374,7 @@
|
|
|
368
374
|
VxeUI = core;
|
|
369
375
|
// 检查版本
|
|
370
376
|
if (!/^(4)\./.test(VxeUI.uiVersion)) {
|
|
371
|
-
console.error('[plugin-menu 4.
|
|
377
|
+
console.error('[@vxe-ui/plugin-menu 4.0.6] Requires vxe-table 4.7.0+ version. https://vxeui.com/other4/#/plugin-export-xlsx/install');
|
|
372
378
|
}
|
|
373
379
|
pluginSetup(options);
|
|
374
380
|
VxeUI.menus.mixin({
|
|
@@ -524,6 +530,23 @@
|
|
|
524
530
|
$table.revertData();
|
|
525
531
|
}
|
|
526
532
|
},
|
|
533
|
+
/**
|
|
534
|
+
* 复制列头标题
|
|
535
|
+
*/
|
|
536
|
+
COPY_TITLE: {
|
|
537
|
+
menuMethod: function menuMethod(params) {
|
|
538
|
+
var column = params.column;
|
|
539
|
+
var text = column.getTitle();
|
|
540
|
+
if (text) {
|
|
541
|
+
// 开始复制操作
|
|
542
|
+
if (_xeUtils["default"].isFunction(handleCopy)) {
|
|
543
|
+
handleCopy(text);
|
|
544
|
+
} else {
|
|
545
|
+
copyText(text);
|
|
546
|
+
}
|
|
547
|
+
}
|
|
548
|
+
}
|
|
549
|
+
},
|
|
527
550
|
/**
|
|
528
551
|
* 复制单元格数据的值;如果启用 mouse-config.area 功能,则复制区域范围内的单元格数据,支持 Excel 和 WPS
|
|
529
552
|
*/
|
package/dist/index.umd.min.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
((e,t)=>{"function"==typeof define&&define.amd?define("@vxe-ui/plugin-menu",["exports","xe-utils"],t):"undefined"!=typeof exports?t(exports,require("xe-utils")):(t(t={},e.XEUtils),e.VxeUIPluginMenu=t)})("undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:this,function(e,u){var i,c;Object.defineProperty(e,"__esModule",{value:!0}),e.default=e.VxeUIPluginMenu=void 0,u=(t=u)&&t.__esModule?t:{default:t};var a,g=function(e,t){return u.default.findIndexOf(e,function(e){return e.id===t.id})},L=function(e,t,n){return e.findRowIndexOf(t,n)};function n(n){return{menuMethod:function(e){var t=e.$table;u.default.eachTree([e.column],function(e){e.fixed=n}),t.refreshColumn()}}}function C(){var e=i.globalStore;return e?e.clipboard||"":(e=i.config)&&e.clipboard?e.clipboard:null}function E(e){var t,n;try{t=e,a||((a=document.createElement("textarea")).id="$XECopy",(n=a.style).width="48px",n.height="24px",n.position="fixed",n.zIndex="0",n.left="-500px",n.top="-500px",document.body.appendChild(a)),a.value=null==t?"":""+t,a.select(),a.setSelectionRange(0,a.value.length),document.execCommand("copy"),a.blur()}catch(e){}}function o(e,t){var n,a,o,r=e.$event,l=e.$table,s=e.row,e=e.column;s&&e&&(n=l.props.mouseConfig,o=l.getComputeMaps().computeMouseOpts.value,a="",n&&o.area?(t?l.triggerCutCellAreaEvent(r):l.triggerCopyCellAreaEvent(r),a=(n=C())?n.text:""):(a=u.default.toValueString(u.default.get(s,e.field)),o={text:a,html:""},(t=i.globalStore)?t.clipboard=o:i.config&&(i.config.clipboard=o)),(u.default.isFunction(c)?c:E)(a))}function m(e){var u=e.$table,e=u.props.mouseConfig,t=u.getComputeMaps().computeMouseOpts.value,i=u.getTableData().visibleData,c=u.getTableColumn().visibleColumn,n=e&&t.area?u.getCellAreas():[];return u.getMergeCells().filter(function(e){var o=e.row,r=e.col,l=e.rowspan,s=e.colspan;return n.some(function(e){var t=e.rows,e=e.cols,n=L(u,i,t[0]),t=L(u,i,t[t.length-1]),a=g(c,e[0]),e=g(c,e[e.length-1]);return n<=o&&o+l-1<=t&&a<=r&&r+s-1<=e})})}function l(e){var t=e.$table,e=m(e);return e.length&&t.removeMergeCells(e),e}function r(e,t){var n=e.code,a=t.$table,o=t.row,r=t.column,l=a.props,s=l.editConfig,u=l.mouseConfig;switch(n){case"CLEAR_ALL_SORT":var i=a.getSortColumns();e.disabled=!i.length;break;case"CLEAR_ALL_FILTER":i=a.getCheckedFilters();e.disabled=!i.length;break;case"CLEAR_ALL_MERGE":var i=a.getMergeCells(),c=a.getMergeFooterItems();e.disabled=!i.length&&!c.length;break;case"CLEAR_MERGE_CELL":i=m(t);e.disabled=!i.length;break;case"EDIT_CELL":case"CLEAR_CELL":case"CLEAR_ROW":case"COPY_CELL":case"CUT_CELL":case"PASTE_CELL":case"MERGE_OR_CLEAR":case"MERGE_CELL":case"REVERT_CELL":case"REVERT_ROW":case"INSERT_AT_ROW":case"INSERT_AT_ACTIVED_ROW":case"INSERT_AT_EDIT_ROW":case"DELETE_ROW":case"DELETE_AREA_ROW":case"CLEAR_SORT":case"SORT_ASC":case"SORT_DESC":case"CLEAR_FILTER":case"FILTER_CELL":case"EXPORT_ROW":case"OPEN_FIND":case"OPEN_REPLACE":case"HIDDEN_COLUMN":case"FIXED_LEFT_COLUMN":case"FIXED_RIGHT_COLUMN":case"CLEAR_FIXED_COLUMN":if(e.disabled=!r,r){var E=a.getComputeMaps().computeMouseOpts.value,d=!!r.parentId;switch(n){case"CLEAR_SORT":e.disabled=!r.sortable||!r.order;break;case"SORT_ASC":case"SORT_DESC":e.disabled=!r.sortable;break;case"FILTER_CELL":case"CLEAR_FILTER":e.disabled=!r.filters||!r.filters.length,e.disabled||"CLEAR_FILTER"===n&&(e.disabled=!r.filters.some(function(e){return e.checked}));break;case"REVERT_CELL":e.disabled=!o||!r.field||!a.isUpdateByRow(o,r.field);break;case"REVERT_ROW":e.disabled=!o||!r.field||!a.isUpdateByRow(o);break;case"OPEN_FIND":case"OPEN_REPLACE":e.disabled=!(u&&E.area);break;case"EDIT_CELL":e.disabled=!s||!r.editRender;break;case"COPY_CELL":case"CUT_CELL":case"PASTE_CELL":var f=u&&E.area?a.getCellAreas():[];e.disabled=1<f.length,e.disabled||"PASTE_CELL"===n&&(f=C(),e.disabled=!f||!f.text);break;case"MERGE_OR_CLEAR":case"MERGE_CELL":f=u&&E.area?a.getCellAreas():[];e.disabled=!f.length||1===f.length&&1===f[0].rows.length&&1===f[0].cols.length||!((e,t)=>{for(var n=e.$table,a=n.getTableData().visibleData,o=n.getTableColumn().visibleColumn,r={},l=0,s=t.length;l<s;l++)for(var u=t[l],i=u.rows,c=u.cols,E=0,d=i.length;E<d;E++)for(var f=i[E],C=L(n,a,f),m=0,R=c.length;m<R;m++){var _=c[m],_=C+":"+g(o,_);if(r[_])return;r[_]=!0}return 1})(t,f);break;case"FIXED_LEFT_COLUMN":e.disabled=d||"left"===r.fixed;break;case"FIXED_RIGHT_COLUMN":e.disabled=d||"right"===r.fixed;break;case"CLEAR_FIXED_COLUMN":e.disabled=d||!r.fixed}}}}function s(t){return t.options.forEach(function(e){e.forEach(function(e){r(e,t),e.children&&e.children.forEach(function(e){r(e,t)})})}),!0}function d(e){e&&e.copy&&(c=e.copy)}var t=e.VxeUIPluginMenu={setConfig:d,install:function(e,t){i=e,/^(4)\./.test(i.uiVersion)||console.error("[plugin-menu 4.x] Version 4.x is required"),d(t),i.menus.mixin({CLEAR_CELL:{menuMethod:function(e){var t,n,a=e.$table,o=e.row,e=e.column;o&&e&&(n=a.props.mouseConfig,t=a.getComputeMaps().computeMouseOpts.value,n&&t.area?(n=a.getCellAreas())&&n.length&&n.forEach(function(e){var n=e.rows;e.cols.forEach(function(t){n.forEach(function(e){a.clearData(e,t.field)})})}):a.clearData(o,e.field))}},CLEAR_ROW:{menuMethod:function(e){var t=e.$table,e=e.row;e&&t.clearData(e)}},CLEAR_CHECKBOX_ROW:{menuMethod:function(e){e=e.$table;e.clearData(e.getCheckboxRecords())}},CLEAR_AREA_ROW:{menuMethod:function(e){var t=e.$table,n=e.row,e=e.column,a=t.props.mouseConfig,o=t.getComputeMaps().computeMouseOpts.value;a&&o.area?(a&&o.area?t.getCellAreas():[]).forEach(function(e){e=e.rows;t.clearData(e)}):n&&e&&t.clearData(n)}},CLEAR_ALL:{menuMethod:function(e){e.$table.clearData()}},REVERT_CELL:{menuMethod:function(e){var t,n,a=e.$table,o=e.row,e=e.column;o&&e&&(n=a.props.mouseConfig,t=a.getComputeMaps().computeMouseOpts.value,n&&t.area?(n=a.getCellAreas())&&n.length&&n.forEach(function(e){var n=e.rows;e.cols.forEach(function(t){n.forEach(function(e){a.revertData(e,t.field)})})}):a.revertData(o,e.field))}},REVERT_ROW:{menuMethod:function(e){var t=e.$table,e=e.row;e&&t.revertData(e)}},REVERT_CHECKBOX_ROW:{menuMethod:function(e){e=e.$table;e.revertData(e.getCheckboxRecords())}},REVERT_ALL:{menuMethod:function(e){e.$table.revertData()}},COPY_CELL:{menuMethod:function(e){o(e)}},CUT_CELL:{menuMethod:function(e){o(e,!0)}},PASTE_CELL:{menuMethod:function(e){var t=e.$event,n=e.$table,a=e.row,e=e.column,o=n.props.mouseConfig,r=n.getComputeMaps().computeMouseOpts.value;o&&r.area?n.triggerPasteCellAreaEvent(t):(o=C())&&o.text&&u.default.set(a,e.field,o.text)}},MERGE_OR_CLEAR:{menuMethod:function(e){var t=e.$event,n=e.$table,a=n.getCellAreas(),e=m(e),o=!1,e=(e.length?n.removeMergeCells(e):(o=!0,n.setMergeCells(a.map(function(e){var t=e.rows,e=e.cols;return{row:t[0],col:e[0],rowspan:t.length,colspan:e.length}}))),a.map(function(e){return{rows:e.rows,cols:e.cols}}));n.dispatchEvent("cell-area-merge",{status:o,targetAreas:e},t)}},MERGE_CELL:{menuMethod:function(e){var t=e.$event,n=e.$table,a=n.getTableData().visibleData,o=n.getTableColumn().visibleColumn,r=n.getCellAreas();l(e),r.some(function(e){return e.rows.length===a.length||e.cols.length===o.length})?i.modal&&i.modal.message({content:i.getI18n("vxe.pro.area.mergeErr"),status:"error",id:"operErr"}):(n.setMergeCells(r.map(function(e){var t=e.rows,e=e.cols;return{row:t[0],col:e[0],rowspan:t.length,colspan:e.length}})),e=r.map(function(e){return{rows:e.rows,cols:e.cols}}),n.dispatchEvent("cell-area-merge",{status:!0,targetAreas:e},t))}},CLEAR_MERGE_CELL:{menuMethod:function(e){var t=e.$event,n=e.$table,e=l(e);e.length&&n.dispatchEvent("clear-cell-area-merge",{mergeCells:e},t)}},CLEAR_ALL_MERGE:{menuMethod:function(e){var t=e.$event,e=e.$table,n=e.getMergeCells(),a=e.getMergeFooterItems();e.clearMergeCells(),e.clearMergeFooterItems(),e.dispatchEvent("clear-merge",{mergeCells:n,mergeFooterItems:a},t)}},EDIT_CELL:{menuMethod:function(e){var t=e.$table,n=e.row,e=e.column;t.setEditCell?t.setEditCell(n,e):t.setActiveCell(n,e.field)}},EDIT_ROW:{menuMethod:function(e){var t=e.$table,e=e.row;t.setEditRow?t.setEditRow(e):t.setActiveRow(e)}},INSERT_ROW:{menuMethod:function(e){e.$table.insert(e.menu.params)}},INSERT_ACTIVED_ROW:{menuMethod:function(e){var t=e.$table,n=e.column,a=e.menu.params||[];t.insert(a[0]).then(function(e){e=e.row;t.setEditCell?t.setEditCell(e,a[1]||n):t.setActiveCell(e,a[1]||n.field)})}},INSERT_EDIT_ROW:{menuMethod:function(e){var t=e.$table,n=e.column,a=e.menu.params||[];t.insert(a[0]).then(function(e){e=e.row;t.setEditCell?t.setEditCell(e,a[1]||n):t.setActiveCell(e,a[1]||n.field)})}},INSERT_AT_ROW:{menuMethod:function(e){var t=e.$table,n=e.row;n&&t.insertAt(e.menu.params,n)}},INSERT_AT_ACTIVED_ROW:{menuMethod:function(e){var t,n=e.$table,a=e.row,o=e.column;a&&(t=e.menu.params||[],n.insertAt(t[0],a).then(function(e){e=e.row;n.setEditCell?n.setEditCell(e,t[1]||o):n.setActiveCell(e,t[1]||o.field)}))}},INSERT_AT_EDIT_ROW:{menuMethod:function(e){var t,n=e.$table,a=e.row,o=e.column;a&&(t=e.menu.params||[],n.insertAt(t[0],a).then(function(e){e=e.row;n.setEditCell?n.setEditCell(e,t[1]||o):n.setActiveCell(e,t[1]||o.field)}))}},DELETE_ROW:{menuMethod:function(e){var t=e.$table,e=e.row;e&&t.remove(e)}},DELETE_AREA_ROW:{menuMethod:function(e){var t=e.$table,e=e.row,n=t.props.mouseConfig,a=t.getComputeMaps().computeMouseOpts.value;n&&a.area?t.getCellAreas().forEach(function(e){e=e.rows;t.remove(e)}):e&&t.remove(e)}},DELETE_CHECKBOX_ROW:{menuMethod:function(e){e.$table.removeCheckboxRow()}},DELETE_ALL:{menuMethod:function(e){e.$table.remove()}},CLEAR_SORT:{menuMethod:function(e){var t=e.$event,n=e.$table,e=e.column;e&&n.triggerSortEvent(t,e,null)}},CLEAR_ALL_SORT:{menuMethod:function(e){var t=e.$event,e=e.$table,n=e.getSortColumns();n.length&&(e.clearSort(),e.dispatchEvent("clear-sort",{sortList:n},t))}},SORT_ASC:{menuMethod:function(e){var t=e.$event,n=e.$table,e=e.column;e&&n.triggerSortEvent(t,e,"asc")}},SORT_DESC:{menuMethod:function(e){var t=e.$event,n=e.$table,e=e.column;e&&n.triggerSortEvent(t,e,"desc")}},CLEAR_FILTER:{menuMethod:function(e){var t=e.$event,n=e.$table,e=e.column;e&&(n.handleClearFilter(e),n.confirmFilterEvent(t))}},CLEAR_ALL_FILTER:{menuMethod:function(e){var t=e.$event,e=e.$table,n=e.getCheckedFilters();n.length&&(e.clearFilter(),e.dispatchEvent("clear-filter",{filterList:n},t))}},FILTER_CELL:{menuMethod:function(e){var t,n=e.$table,a=e.row,e=e.column;a&&e&&(t=e.field,(e=e.filters).length)&&((e=e[0]).data=u.default.get(a,t),e.checked=!0,n.updateData())}},EXPORT_ROW:{menuMethod:function(e){var t=e.$table,n=e.menu,e=e.row;e&&t.exportData(u.default.assign({},n.params?n.params[0]:{},{data:[e]}))}},EXPORT_CHECKBOX_ROW:{menuMethod:function(e){var t=e.$table,e=e.menu,n={data:t.getCheckboxRecords()};t.exportData(u.default.assign({},e.params?e.params[0]:{},n))}},EXPORT_ALL:{menuMethod:function(e){e.$table.exportData(e.menu.params)}},PRINT_ALL:{menuMethod:function(e){e.$table.print(e.menu.params)}},PRINT_CHECKBOX_ROW:{menuMethod:function(e){var t=e.$table,e=e.menu,n={data:t.getCheckboxRecords()};t.print(u.default.assign(n,e.params))}},OPEN_FIND:{menuMethod:function(e){var t=e.$event;e.$table.triggerFNROpenEvent(t,"find")}},OPEN_REPLACE:{menuMethod:function(e){var t=e.$event;e.$table.triggerFNROpenEvent(t,"replace")}},HIDDEN_COLUMN:{menuMethod:function(e){var t=e.$table,e=e.column;e&&t.hideColumn(e)}},FIXED_LEFT_COLUMN:n("left"),FIXED_RIGHT_COLUMN:n("right"),CLEAR_FIXED_COLUMN:n(null),RESET_COLUMN:{menuMethod:function(e){e.$table.resetColumn({visible:!0,resizable:!1})}},RESET_RESIZABLE:{menuMethod:function(e){e.$table.resetColumn({visible:!1,resizable:!0})}},RESET_ALL:{menuMethod:function(e){e.$table.resetColumn(!0)}}}),i.interceptor.add("event.showMenu",s)}};"undefined"!=typeof window&&window.VxeUI&&window.VxeUI.use&&window.VxeUI.use(t),e.default=t});
|
|
1
|
+
((e,t)=>{"function"==typeof define&&define.amd?define("@vxe-ui/plugin-menu",["exports","xe-utils"],t):"undefined"!=typeof exports?t(exports,require("xe-utils")):(t(t={},e.XEUtils),e.VxeUIPluginMenu=t)})("undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:this,function(e,u){var i,c;Object.defineProperty(e,"__esModule",{value:!0}),e.default=e.VxeUIPluginMenu=void 0,u=(t=u)&&t.__esModule?t:{default:t};var a,g=function(e,t){return u.default.findIndexOf(e,function(e){return e.id===t.id})},L=function(e,t,n){return e.findRowIndexOf(t,n)};function n(n){return{menuMethod:function(e){var t=e.$table;u.default.eachTree([e.column],function(e){e.fixed=n}),t.refreshColumn()}}}function m(){var e=i.globalStore;return e?e.clipboard||"":(e=i.config)&&e.clipboard?e.clipboard:null}function E(e){var t,n;try{t=e,a||((a=document.createElement("textarea")).id="$XECopy",(n=a.style).width="48px",n.height="24px",n.position="fixed",n.zIndex="0",n.left="-500px",n.top="-500px",document.body.appendChild(a)),a.value=null==t?"":""+t,a.select(),a.setSelectionRange(0,a.value.length),document.execCommand("copy"),a.blur()}catch(e){}}function o(e,t){var n,a,o,r=e.$event,l=e.$table,s=e.row,e=e.column;s&&e&&(n=l.props.mouseConfig,o=l.getComputeMaps().computeMouseOpts.value,a="",n&&o.area?(t?l.triggerCutCellAreaEvent(r):l.triggerCopyCellAreaEvent(r),a=(n=m())?n.text:""):(a=u.default.toValueString(u.default.get(s,e.field)),o={text:a,html:""},(t=i.globalStore)?t.clipboard=o:i.config&&(i.config.clipboard=o)),(u.default.isFunction(c)?c:E)(a))}function R(e){var u=e.$table,e=u.props.mouseConfig,t=u.getComputeMaps().computeMouseOpts.value,i=u.getTableData().visibleData,c=u.getTableColumn().visibleColumn,n=e&&t.area?u.getCellAreas():[];return u.getMergeCells().filter(function(e){var o=e.row,r=e.col,l=e.rowspan,s=e.colspan;return n.some(function(e){var t=e.rows,e=e.cols,n=L(u,i,t[0]),t=L(u,i,t[t.length-1]),a=g(c,e[0]),e=g(c,e[e.length-1]);return n<=o&&o+l-1<=t&&a<=r&&r+s-1<=e})})}function l(e){var t=e.$table,e=R(e);return e.length&&t.removeMergeCells(e),e}function r(e,t){var n=e.code,a=t.$table,o=t.row,r=t.column,l=t.type,s=a.props,u=s.editConfig,i=s.mouseConfig;switch(n){case"CLEAR_ALL_SORT":var c=a.getSortColumns();e.disabled=!c.length;break;case"CLEAR_ALL_FILTER":c=a.getCheckedFilters();e.disabled=!c.length;break;case"CLEAR_ALL_MERGE":var c=a.getMergeCells(),E=a.getMergeFooterItems();e.disabled=!c.length&&!E.length;break;case"CLEAR_MERGE_CELL":c=R(t);e.disabled=!c.length;break;case"COPY_TITLE":e.disabled=!r||"header"!==l;break;case"EDIT_CELL":case"CLEAR_CELL":case"CLEAR_ROW":case"COPY_CELL":case"CUT_CELL":case"PASTE_CELL":case"MERGE_OR_CLEAR":case"MERGE_CELL":case"REVERT_CELL":case"REVERT_ROW":case"INSERT_AT_ROW":case"INSERT_AT_ACTIVED_ROW":case"INSERT_AT_EDIT_ROW":case"DELETE_ROW":case"DELETE_AREA_ROW":case"CLEAR_SORT":case"SORT_ASC":case"SORT_DESC":case"CLEAR_FILTER":case"FILTER_CELL":case"EXPORT_ROW":case"OPEN_FIND":case"OPEN_REPLACE":case"HIDDEN_COLUMN":case"FIXED_LEFT_COLUMN":case"FIXED_RIGHT_COLUMN":case"CLEAR_FIXED_COLUMN":if(e.disabled=!r,r){var d=a.getComputeMaps().computeMouseOpts.value,f=!!r.parentId;switch(n){case"CLEAR_SORT":e.disabled=!r.sortable||!r.order;break;case"SORT_ASC":case"SORT_DESC":e.disabled=!r.sortable;break;case"FILTER_CELL":case"CLEAR_FILTER":e.disabled=!r.filters||!r.filters.length,e.disabled||"CLEAR_FILTER"===n&&(e.disabled=!r.filters.some(function(e){return e.checked}));break;case"REVERT_CELL":e.disabled=!o||!r.field||!a.isUpdateByRow(o,r.field);break;case"REVERT_ROW":e.disabled=!o||!r.field||!a.isUpdateByRow(o);break;case"OPEN_FIND":case"OPEN_REPLACE":e.disabled=!(i&&d.area);break;case"EDIT_CELL":e.disabled=!u||!r.editRender;break;case"COPY_CELL":case"CUT_CELL":case"PASTE_CELL":var C=i&&d.area?a.getCellAreas():[];e.disabled=1<C.length,e.disabled||"PASTE_CELL"===n&&(C=m(),e.disabled=!C||!C.text);break;case"MERGE_OR_CLEAR":case"MERGE_CELL":C=i&&d.area?a.getCellAreas():[];e.disabled=!C.length||1===C.length&&1===C[0].rows.length&&1===C[0].cols.length||!((e,t)=>{for(var n=e.$table,a=n.getTableData().visibleData,o=n.getTableColumn().visibleColumn,r={},l=0,s=t.length;l<s;l++)for(var u=t[l],i=u.rows,c=u.cols,E=0,d=i.length;E<d;E++)for(var f=i[E],C=L(n,a,f),m=0,R=c.length;m<R;m++){var _=c[m],_=C+":"+g(o,_);if(r[_])return;r[_]=!0}return 1})(t,C);break;case"FIXED_LEFT_COLUMN":e.disabled=f||"left"===r.fixed;break;case"FIXED_RIGHT_COLUMN":e.disabled=f||"right"===r.fixed;break;case"CLEAR_FIXED_COLUMN":e.disabled=f||!r.fixed}}}}function s(t){return t.options.forEach(function(e){e.forEach(function(e){r(e,t),e.children&&e.children.forEach(function(e){r(e,t)})})}),!0}function d(e){e&&e.copy&&(c=e.copy)}var t=e.VxeUIPluginMenu={setConfig:d,install:function(e,t){i=e,/^(4)\./.test(i.uiVersion)||console.error("[@vxe-ui/plugin-menu 4.0.6] Requires vxe-table 4.7.0+ version. https://vxeui.com/other4/#/plugin-export-xlsx/install"),d(t),i.menus.mixin({CLEAR_CELL:{menuMethod:function(e){var t,n,a=e.$table,o=e.row,e=e.column;o&&e&&(n=a.props.mouseConfig,t=a.getComputeMaps().computeMouseOpts.value,n&&t.area?(n=a.getCellAreas())&&n.length&&n.forEach(function(e){var n=e.rows;e.cols.forEach(function(t){n.forEach(function(e){a.clearData(e,t.field)})})}):a.clearData(o,e.field))}},CLEAR_ROW:{menuMethod:function(e){var t=e.$table,e=e.row;e&&t.clearData(e)}},CLEAR_CHECKBOX_ROW:{menuMethod:function(e){e=e.$table;e.clearData(e.getCheckboxRecords())}},CLEAR_AREA_ROW:{menuMethod:function(e){var t=e.$table,n=e.row,e=e.column,a=t.props.mouseConfig,o=t.getComputeMaps().computeMouseOpts.value;a&&o.area?(a&&o.area?t.getCellAreas():[]).forEach(function(e){e=e.rows;t.clearData(e)}):n&&e&&t.clearData(n)}},CLEAR_ALL:{menuMethod:function(e){e.$table.clearData()}},REVERT_CELL:{menuMethod:function(e){var t,n,a=e.$table,o=e.row,e=e.column;o&&e&&(n=a.props.mouseConfig,t=a.getComputeMaps().computeMouseOpts.value,n&&t.area?(n=a.getCellAreas())&&n.length&&n.forEach(function(e){var n=e.rows;e.cols.forEach(function(t){n.forEach(function(e){a.revertData(e,t.field)})})}):a.revertData(o,e.field))}},REVERT_ROW:{menuMethod:function(e){var t=e.$table,e=e.row;e&&t.revertData(e)}},REVERT_CHECKBOX_ROW:{menuMethod:function(e){e=e.$table;e.revertData(e.getCheckboxRecords())}},REVERT_ALL:{menuMethod:function(e){e.$table.revertData()}},COPY_TITLE:{menuMethod:function(e){e=e.column.getTitle();e&&(u.default.isFunction(c)?c:E)(e)}},COPY_CELL:{menuMethod:function(e){o(e)}},CUT_CELL:{menuMethod:function(e){o(e,!0)}},PASTE_CELL:{menuMethod:function(e){var t=e.$event,n=e.$table,a=e.row,e=e.column,o=n.props.mouseConfig,r=n.getComputeMaps().computeMouseOpts.value;o&&r.area?n.triggerPasteCellAreaEvent(t):(o=m())&&o.text&&u.default.set(a,e.field,o.text)}},MERGE_OR_CLEAR:{menuMethod:function(e){var t=e.$event,n=e.$table,a=n.getCellAreas(),e=R(e),o=!1,e=(e.length?n.removeMergeCells(e):(o=!0,n.setMergeCells(a.map(function(e){var t=e.rows,e=e.cols;return{row:t[0],col:e[0],rowspan:t.length,colspan:e.length}}))),a.map(function(e){return{rows:e.rows,cols:e.cols}}));n.dispatchEvent("cell-area-merge",{status:o,targetAreas:e},t)}},MERGE_CELL:{menuMethod:function(e){var t=e.$event,n=e.$table,a=n.getTableData().visibleData,o=n.getTableColumn().visibleColumn,r=n.getCellAreas();l(e),r.some(function(e){return e.rows.length===a.length||e.cols.length===o.length})?i.modal&&i.modal.message({content:i.getI18n("vxe.pro.area.mergeErr"),status:"error",id:"operErr"}):(n.setMergeCells(r.map(function(e){var t=e.rows,e=e.cols;return{row:t[0],col:e[0],rowspan:t.length,colspan:e.length}})),e=r.map(function(e){return{rows:e.rows,cols:e.cols}}),n.dispatchEvent("cell-area-merge",{status:!0,targetAreas:e},t))}},CLEAR_MERGE_CELL:{menuMethod:function(e){var t=e.$event,n=e.$table,e=l(e);e.length&&n.dispatchEvent("clear-cell-area-merge",{mergeCells:e},t)}},CLEAR_ALL_MERGE:{menuMethod:function(e){var t=e.$event,e=e.$table,n=e.getMergeCells(),a=e.getMergeFooterItems();e.clearMergeCells(),e.clearMergeFooterItems(),e.dispatchEvent("clear-merge",{mergeCells:n,mergeFooterItems:a},t)}},EDIT_CELL:{menuMethod:function(e){var t=e.$table,n=e.row,e=e.column;t.setEditCell?t.setEditCell(n,e):t.setActiveCell(n,e.field)}},EDIT_ROW:{menuMethod:function(e){var t=e.$table,e=e.row;t.setEditRow?t.setEditRow(e):t.setActiveRow(e)}},INSERT_ROW:{menuMethod:function(e){e.$table.insert(e.menu.params)}},INSERT_ACTIVED_ROW:{menuMethod:function(e){var t=e.$table,n=e.column,a=e.menu.params||[];t.insert(a[0]).then(function(e){e=e.row;t.setEditCell?t.setEditCell(e,a[1]||n):t.setActiveCell(e,a[1]||n.field)})}},INSERT_EDIT_ROW:{menuMethod:function(e){var t=e.$table,n=e.column,a=e.menu.params||[];t.insert(a[0]).then(function(e){e=e.row;t.setEditCell?t.setEditCell(e,a[1]||n):t.setActiveCell(e,a[1]||n.field)})}},INSERT_AT_ROW:{menuMethod:function(e){var t=e.$table,n=e.row;n&&t.insertAt(e.menu.params,n)}},INSERT_AT_ACTIVED_ROW:{menuMethod:function(e){var t,n=e.$table,a=e.row,o=e.column;a&&(t=e.menu.params||[],n.insertAt(t[0],a).then(function(e){e=e.row;n.setEditCell?n.setEditCell(e,t[1]||o):n.setActiveCell(e,t[1]||o.field)}))}},INSERT_AT_EDIT_ROW:{menuMethod:function(e){var t,n=e.$table,a=e.row,o=e.column;a&&(t=e.menu.params||[],n.insertAt(t[0],a).then(function(e){e=e.row;n.setEditCell?n.setEditCell(e,t[1]||o):n.setActiveCell(e,t[1]||o.field)}))}},DELETE_ROW:{menuMethod:function(e){var t=e.$table,e=e.row;e&&t.remove(e)}},DELETE_AREA_ROW:{menuMethod:function(e){var t=e.$table,e=e.row,n=t.props.mouseConfig,a=t.getComputeMaps().computeMouseOpts.value;n&&a.area?t.getCellAreas().forEach(function(e){e=e.rows;t.remove(e)}):e&&t.remove(e)}},DELETE_CHECKBOX_ROW:{menuMethod:function(e){e.$table.removeCheckboxRow()}},DELETE_ALL:{menuMethod:function(e){e.$table.remove()}},CLEAR_SORT:{menuMethod:function(e){var t=e.$event,n=e.$table,e=e.column;e&&n.triggerSortEvent(t,e,null)}},CLEAR_ALL_SORT:{menuMethod:function(e){var t=e.$event,e=e.$table,n=e.getSortColumns();n.length&&(e.clearSort(),e.dispatchEvent("clear-sort",{sortList:n},t))}},SORT_ASC:{menuMethod:function(e){var t=e.$event,n=e.$table,e=e.column;e&&n.triggerSortEvent(t,e,"asc")}},SORT_DESC:{menuMethod:function(e){var t=e.$event,n=e.$table,e=e.column;e&&n.triggerSortEvent(t,e,"desc")}},CLEAR_FILTER:{menuMethod:function(e){var t=e.$event,n=e.$table,e=e.column;e&&(n.handleClearFilter(e),n.confirmFilterEvent(t))}},CLEAR_ALL_FILTER:{menuMethod:function(e){var t=e.$event,e=e.$table,n=e.getCheckedFilters();n.length&&(e.clearFilter(),e.dispatchEvent("clear-filter",{filterList:n},t))}},FILTER_CELL:{menuMethod:function(e){var t,n=e.$table,a=e.row,e=e.column;a&&e&&(t=e.field,(e=e.filters).length)&&((e=e[0]).data=u.default.get(a,t),e.checked=!0,n.updateData())}},EXPORT_ROW:{menuMethod:function(e){var t=e.$table,n=e.menu,e=e.row;e&&t.exportData(u.default.assign({},n.params?n.params[0]:{},{data:[e]}))}},EXPORT_CHECKBOX_ROW:{menuMethod:function(e){var t=e.$table,e=e.menu,n={data:t.getCheckboxRecords()};t.exportData(u.default.assign({},e.params?e.params[0]:{},n))}},EXPORT_ALL:{menuMethod:function(e){e.$table.exportData(e.menu.params)}},PRINT_ALL:{menuMethod:function(e){e.$table.print(e.menu.params)}},PRINT_CHECKBOX_ROW:{menuMethod:function(e){var t=e.$table,e=e.menu,n={data:t.getCheckboxRecords()};t.print(u.default.assign(n,e.params))}},OPEN_FIND:{menuMethod:function(e){var t=e.$event;e.$table.triggerFNROpenEvent(t,"find")}},OPEN_REPLACE:{menuMethod:function(e){var t=e.$event;e.$table.triggerFNROpenEvent(t,"replace")}},HIDDEN_COLUMN:{menuMethod:function(e){var t=e.$table,e=e.column;e&&t.hideColumn(e)}},FIXED_LEFT_COLUMN:n("left"),FIXED_RIGHT_COLUMN:n("right"),CLEAR_FIXED_COLUMN:n(null),RESET_COLUMN:{menuMethod:function(e){e.$table.resetColumn({visible:!0,resizable:!1})}},RESET_RESIZABLE:{menuMethod:function(e){e.$table.resetColumn({visible:!1,resizable:!0})}},RESET_ALL:{menuMethod:function(e){e.$table.resetColumn(!0)}}}),i.interceptor.add("event.showMenu",s)}};"undefined"!=typeof window&&window.VxeUI&&window.VxeUI.use&&window.VxeUI.use(t),e.default=t});
|
package/package.json
CHANGED
|
@@ -1,72 +1,73 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "@vxe-ui/plugin-menu",
|
|
3
|
-
"version": "4.0.
|
|
4
|
-
"description": "Vxe UI plug-in supports context menu.",
|
|
5
|
-
"scripts": {
|
|
6
|
-
"lib": "gulp build"
|
|
7
|
-
},
|
|
8
|
-
"files": [
|
|
9
|
-
"types",
|
|
10
|
-
"dist",
|
|
11
|
-
"*.ts",
|
|
12
|
-
"*.d.ts"
|
|
13
|
-
],
|
|
14
|
-
"main": "dist/index.common.js",
|
|
15
|
-
"unpkg": "dist/index.umd.js",
|
|
16
|
-
"jsdelivr": "dist/index.umd.js",
|
|
17
|
-
"style": "dist/style.css",
|
|
18
|
-
"typings": "types/index.d.ts",
|
|
19
|
-
"devDependencies": {
|
|
20
|
-
"@
|
|
21
|
-
"@babel/
|
|
22
|
-
"@babel/
|
|
23
|
-
"@babel/
|
|
24
|
-
"@
|
|
25
|
-
"@typescript-eslint/
|
|
26
|
-
"
|
|
27
|
-
"
|
|
28
|
-
"eslint
|
|
29
|
-
"eslint-config-
|
|
30
|
-
"eslint-
|
|
31
|
-
"eslint-
|
|
32
|
-
"eslint-plugin-
|
|
33
|
-
"eslint-plugin-
|
|
34
|
-
"eslint-plugin-
|
|
35
|
-
"eslint-plugin-
|
|
36
|
-
"eslint-plugin-
|
|
37
|
-
"
|
|
38
|
-
"gulp
|
|
39
|
-
"gulp-
|
|
40
|
-
"gulp-
|
|
41
|
-
"gulp-
|
|
42
|
-
"gulp-
|
|
43
|
-
"gulp-
|
|
44
|
-
"gulp-
|
|
45
|
-
"gulp-
|
|
46
|
-
"gulp-
|
|
47
|
-
"gulp-
|
|
48
|
-
"
|
|
49
|
-
"
|
|
50
|
-
"
|
|
51
|
-
"
|
|
52
|
-
"
|
|
53
|
-
"
|
|
54
|
-
"vxe-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
"
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
"
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
"
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
1
|
+
{
|
|
2
|
+
"name": "@vxe-ui/plugin-menu",
|
|
3
|
+
"version": "4.0.6",
|
|
4
|
+
"description": "Vxe UI plug-in supports context menu.",
|
|
5
|
+
"scripts": {
|
|
6
|
+
"lib": "gulp build"
|
|
7
|
+
},
|
|
8
|
+
"files": [
|
|
9
|
+
"types",
|
|
10
|
+
"dist",
|
|
11
|
+
"*.ts",
|
|
12
|
+
"*.d.ts"
|
|
13
|
+
],
|
|
14
|
+
"main": "dist/index.common.js",
|
|
15
|
+
"unpkg": "dist/index.umd.js",
|
|
16
|
+
"jsdelivr": "dist/index.umd.js",
|
|
17
|
+
"style": "dist/style.css",
|
|
18
|
+
"typings": "types/index.d.ts",
|
|
19
|
+
"devDependencies": {
|
|
20
|
+
"@types/node": "20.10.0",
|
|
21
|
+
"@babel/core": "^7.12.3",
|
|
22
|
+
"@babel/plugin-transform-runtime": "^7.12.1",
|
|
23
|
+
"@babel/preset-env": "^7.12.1",
|
|
24
|
+
"@babel/runtime": "^7.12.5",
|
|
25
|
+
"@typescript-eslint/eslint-plugin": "^4.6.1",
|
|
26
|
+
"@typescript-eslint/parser": "^4.6.1",
|
|
27
|
+
"del": "^6.0.0",
|
|
28
|
+
"eslint": "^7.13.0",
|
|
29
|
+
"eslint-config-prettier": "^6.15.0",
|
|
30
|
+
"eslint-config-standard": "^16.0.1",
|
|
31
|
+
"eslint-friendly-formatter": "^4.0.1",
|
|
32
|
+
"eslint-plugin-import": "^2.22.1",
|
|
33
|
+
"eslint-plugin-node": "^11.1.0",
|
|
34
|
+
"eslint-plugin-prettier": "^3.1.4",
|
|
35
|
+
"eslint-plugin-promise": "^4.2.1",
|
|
36
|
+
"eslint-plugin-standard": "^4.0.2",
|
|
37
|
+
"eslint-plugin-typescript": "^0.14.0",
|
|
38
|
+
"gulp": "^4.0.2",
|
|
39
|
+
"gulp-autoprefixer": "^8.0.0",
|
|
40
|
+
"gulp-babel": "^8.0.0",
|
|
41
|
+
"gulp-clean-css": "^4.3.0",
|
|
42
|
+
"gulp-concat": "^2.6.1",
|
|
43
|
+
"gulp-rename": "^2.0.0",
|
|
44
|
+
"gulp-replace": "^1.1.3",
|
|
45
|
+
"gulp-sass": "^5.1.0",
|
|
46
|
+
"gulp-sourcemaps": "^3.0.0",
|
|
47
|
+
"gulp-typescript": "^5.0.1",
|
|
48
|
+
"gulp-uglify": "^3.0.2",
|
|
49
|
+
"markdown-doctest": "^1.1.0",
|
|
50
|
+
"prettier": "^2.1.2",
|
|
51
|
+
"sass": "^1.55.0",
|
|
52
|
+
"typescript": "~4.7.4",
|
|
53
|
+
"vue": "3.4.27",
|
|
54
|
+
"vxe-pc-ui": "^4.3.54",
|
|
55
|
+
"vxe-table": "^4.10.0"
|
|
56
|
+
},
|
|
57
|
+
"repository": {
|
|
58
|
+
"type": "git",
|
|
59
|
+
"url": "git+https://github.com/x-extends/vxe-ui-plugins.git"
|
|
60
|
+
},
|
|
61
|
+
"keywords": [
|
|
62
|
+
"vxe-ui-plugins"
|
|
63
|
+
],
|
|
64
|
+
"author": {
|
|
65
|
+
"name": "Xu Liangzhan",
|
|
66
|
+
"email": "xu_liangzhan@163.com"
|
|
67
|
+
},
|
|
68
|
+
"license": "MIT",
|
|
69
|
+
"bugs": {
|
|
70
|
+
"url": "https://github.com/x-extends/vxe-ui-plugins/issues"
|
|
71
|
+
},
|
|
72
|
+
"homepage": "https://github.com/x-extends/vxe-ui-plugins#readme"
|
|
73
|
+
}
|
package/types/index.d.ts
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import { VxeUIExport } from 'vxe-pc-ui'
|
|
2
|
-
|
|
3
|
-
export interface VxeUIPluginMenuOptions {
|
|
4
|
-
copy?: (content: string | number) => boolean;
|
|
5
|
-
}
|
|
6
|
-
|
|
7
|
-
/**
|
|
8
|
-
* 基于 Vxe UI 的扩展插件,支持右键菜单
|
|
9
|
-
*/
|
|
10
|
-
export declare const VxeUIPluginMenu: {
|
|
11
|
-
install (VxeUI: VxeUIExport, options?: VxeUIPluginMenuOptions): void
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
export default VxeUIPluginMenu
|
|
1
|
+
import { VxeUIExport } from 'vxe-pc-ui'
|
|
2
|
+
|
|
3
|
+
export interface VxeUIPluginMenuOptions {
|
|
4
|
+
copy?: (content: string | number) => boolean;
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* 基于 Vxe UI 的扩展插件,支持右键菜单
|
|
9
|
+
*/
|
|
10
|
+
export declare const VxeUIPluginMenu: {
|
|
11
|
+
install (VxeUI: VxeUIExport, options?: VxeUIPluginMenuOptions): void
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export default VxeUIPluginMenu
|