@vxe-ui/plugin-menu 4.0.9 → 4.0.11
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/README.md +5 -0
- package/dist/index.common.js +371 -78
- package/dist/index.umd.js +371 -78
- package/dist/index.umd.min.js +1 -1
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -35,6 +35,11 @@ VxeUI.use(VxeUIPluginMenu)
|
|
|
35
35
|
| CLEAR_CHECKBOX_ROW | 清除复选框选中行数据的值 | — |
|
|
36
36
|
| CLEAR_AREA_ROW | 如果启用 mouse-config.area 功能,清除区域选择范围内数据的值,否则清除行数据的值 | — |
|
|
37
37
|
| CLEAR_ALL | 清除所有数据的值 | — |
|
|
38
|
+
| SELECT_ALL_AREA | 如果启用 mouse-config.area 功能,选择所有单元格 | — |
|
|
39
|
+
| SELECT_AREA_TO_LEFT | 如果启用 mouse-config.area 功能,以当前单元格为起点,范围选取到左侧单元格 | — |
|
|
40
|
+
| SELECT_AREA_TO_RIGHT | 如果启用 mouse-config.area 功能,以当前单元格为起点,范围选取到右侧单元格 | — |
|
|
41
|
+
| SELECT_AREA_TO_TOP | 如果启用 mouse-config.area 功能,以当前单元格为起点,范围选取到顶部单元格 | — |
|
|
42
|
+
| SELECT_AREA_TO_BOTTON | 如果启用 mouse-config.area 功能,以当前单元格为起点,范围选取到底部单元格 | — |
|
|
38
43
|
| REVERT_CELL | 还原单元格数据的值;如果启用 mouse-config.area 功能,则还原区域范围内的单元格数据 | — |
|
|
39
44
|
| REVERT_ROW | 还原行数据的值 | — |
|
|
40
45
|
| REVERT_CHECKBOX_ROW | 还原复选框选中行数据的值 | — |
|
package/dist/index.common.js
CHANGED
|
@@ -217,6 +217,23 @@ function checkPrivilege(item, params) {
|
|
|
217
217
|
item.disabled = !column || type !== 'header';
|
|
218
218
|
break;
|
|
219
219
|
}
|
|
220
|
+
case 'SELECT_ALL_AREA':
|
|
221
|
+
{
|
|
222
|
+
var _$table$getTableData3 = $table.getTableData(),
|
|
223
|
+
visibleData = _$table$getTableData3.visibleData;
|
|
224
|
+
var _$table$getTableColum3 = $table.getTableColumn(),
|
|
225
|
+
visibleColumn = _$table$getTableColum3.visibleColumn;
|
|
226
|
+
item.disabled = !(visibleData.length || visibleColumn.length);
|
|
227
|
+
break;
|
|
228
|
+
}
|
|
229
|
+
case 'SELECT_AREA_TO_LEFT':
|
|
230
|
+
case 'SELECT_AREA_TO_RIGHT':
|
|
231
|
+
case 'SELECT_AREA_TO_TOP':
|
|
232
|
+
case 'SELECT_AREA_TO_BOTTON':
|
|
233
|
+
{
|
|
234
|
+
item.disabled = !column || !row;
|
|
235
|
+
break;
|
|
236
|
+
}
|
|
220
237
|
case 'EDIT_CELL':
|
|
221
238
|
case 'CLEAR_CELL':
|
|
222
239
|
case 'CLEAR_ROW':
|
|
@@ -351,8 +368,8 @@ function handlePrivilegeEvent(params) {
|
|
|
351
368
|
function selectMultipleRows() {
|
|
352
369
|
return new Promise(function (resolve) {
|
|
353
370
|
if (VxeUI.modal) {
|
|
354
|
-
var
|
|
355
|
-
if (
|
|
371
|
+
var VxeUINumberInputComponent = VxeUI.getComponent('VxeNumberInput');
|
|
372
|
+
if (VxeUINumberInputComponent) {
|
|
356
373
|
var rowSize = (0, _vue.ref)(1);
|
|
357
374
|
VxeUI.modal.alert({
|
|
358
375
|
title: '请输入行数',
|
|
@@ -360,11 +377,14 @@ function selectMultipleRows() {
|
|
|
360
377
|
maskClosable: false,
|
|
361
378
|
slots: {
|
|
362
379
|
"default": function _default() {
|
|
363
|
-
return (0, _vue.h)(
|
|
380
|
+
return (0, _vue.h)(VxeUINumberInputComponent, {
|
|
364
381
|
modelValue: rowSize.value,
|
|
365
382
|
min: 1,
|
|
366
383
|
max: 100,
|
|
367
384
|
align: 'center',
|
|
385
|
+
controlConfig: {
|
|
386
|
+
layout: 'default'
|
|
387
|
+
},
|
|
368
388
|
style: {
|
|
369
389
|
width: '100%'
|
|
370
390
|
},
|
|
@@ -412,7 +432,7 @@ var VxeUIPluginMenu = exports.VxeUIPluginMenu = {
|
|
|
412
432
|
VxeUI = core;
|
|
413
433
|
// 检查版本
|
|
414
434
|
if (!/^(4)\./.test(VxeUI.uiVersion)) {
|
|
415
|
-
console.error('[@vxe-ui/plugin-menu 4.0.
|
|
435
|
+
console.error('[@vxe-ui/plugin-menu 4.0.11] Requires vxe-table 4.7.0+ version. https://vxeui.com/other4/#/plugin-menu/install');
|
|
416
436
|
}
|
|
417
437
|
pluginSetup(options);
|
|
418
438
|
VxeUI.menus.mixin({
|
|
@@ -505,6 +525,199 @@ var VxeUIPluginMenu = exports.VxeUIPluginMenu = {
|
|
|
505
525
|
$table.clearData();
|
|
506
526
|
}
|
|
507
527
|
},
|
|
528
|
+
/**
|
|
529
|
+
* 选取所有区域
|
|
530
|
+
*/
|
|
531
|
+
SELECT_ALL_AREA: {
|
|
532
|
+
menuMethod: function menuMethod(params) {
|
|
533
|
+
var $table = params.$table;
|
|
534
|
+
var tableProps = $table.props;
|
|
535
|
+
var mouseConfig = tableProps.mouseConfig;
|
|
536
|
+
var _$table$getComputeMap6 = $table.getComputeMaps(),
|
|
537
|
+
computeMouseOpts = _$table$getComputeMap6.computeMouseOpts;
|
|
538
|
+
var mouseOpts = computeMouseOpts.value;
|
|
539
|
+
if (mouseConfig && mouseOpts.area) {
|
|
540
|
+
var _$table$getTableData4 = $table.getTableData(),
|
|
541
|
+
visibleData = _$table$getTableData4.visibleData;
|
|
542
|
+
var _$table$getTableColum4 = $table.getTableColumn(),
|
|
543
|
+
visibleColumn = _$table$getTableColum4.visibleColumn;
|
|
544
|
+
$table.setCellAreas([{
|
|
545
|
+
startRow: _xeUtils["default"].first(visibleData),
|
|
546
|
+
endRow: _xeUtils["default"].last(visibleData),
|
|
547
|
+
startColumn: _xeUtils["default"].first(visibleColumn),
|
|
548
|
+
endColumn: _xeUtils["default"].last(visibleColumn)
|
|
549
|
+
}]);
|
|
550
|
+
}
|
|
551
|
+
}
|
|
552
|
+
},
|
|
553
|
+
/**
|
|
554
|
+
* 以当前单元格为起点,范围选取到左侧单元格
|
|
555
|
+
*/
|
|
556
|
+
SELECT_AREA_TO_LEFT: {
|
|
557
|
+
menuMethod: function menuMethod(params) {
|
|
558
|
+
var $table = params.$table,
|
|
559
|
+
row = params.row,
|
|
560
|
+
column = params.column;
|
|
561
|
+
var tableProps = $table.props;
|
|
562
|
+
var mouseConfig = tableProps.mouseConfig;
|
|
563
|
+
var _$table$getComputeMap7 = $table.getComputeMaps(),
|
|
564
|
+
computeMouseOpts = _$table$getComputeMap7.computeMouseOpts;
|
|
565
|
+
var mouseOpts = computeMouseOpts.value;
|
|
566
|
+
if (row && column && mouseConfig && mouseOpts.area) {
|
|
567
|
+
var _$table$getTableColum5 = $table.getTableColumn(),
|
|
568
|
+
visibleColumn = _$table$getTableColum5.visibleColumn;
|
|
569
|
+
var cellAreas = $table.getCellAreas();
|
|
570
|
+
if (cellAreas.length === 1) {
|
|
571
|
+
var fitstArea = cellAreas[0];
|
|
572
|
+
$table.setCellAreas([{
|
|
573
|
+
startRow: _xeUtils["default"].first(fitstArea.rows),
|
|
574
|
+
endRow: _xeUtils["default"].last(fitstArea.rows),
|
|
575
|
+
startColumn: _xeUtils["default"].first(visibleColumn),
|
|
576
|
+
endColumn: _xeUtils["default"].last(fitstArea.cols)
|
|
577
|
+
}], {
|
|
578
|
+
column: column,
|
|
579
|
+
row: row
|
|
580
|
+
});
|
|
581
|
+
} else {
|
|
582
|
+
$table.setCellAreas([{
|
|
583
|
+
startRow: row,
|
|
584
|
+
endRow: row,
|
|
585
|
+
startColumn: _xeUtils["default"].first(visibleColumn),
|
|
586
|
+
endColumn: column
|
|
587
|
+
}], {
|
|
588
|
+
column: column,
|
|
589
|
+
row: row
|
|
590
|
+
});
|
|
591
|
+
}
|
|
592
|
+
}
|
|
593
|
+
}
|
|
594
|
+
},
|
|
595
|
+
/**
|
|
596
|
+
* 以当前单元格为起点,范围选取到右侧单元格
|
|
597
|
+
*/
|
|
598
|
+
SELECT_AREA_TO_RIGHT: {
|
|
599
|
+
menuMethod: function menuMethod(params) {
|
|
600
|
+
var $table = params.$table,
|
|
601
|
+
row = params.row,
|
|
602
|
+
column = params.column;
|
|
603
|
+
var tableProps = $table.props;
|
|
604
|
+
var mouseConfig = tableProps.mouseConfig;
|
|
605
|
+
var _$table$getComputeMap8 = $table.getComputeMaps(),
|
|
606
|
+
computeMouseOpts = _$table$getComputeMap8.computeMouseOpts;
|
|
607
|
+
var mouseOpts = computeMouseOpts.value;
|
|
608
|
+
if (row && column && mouseConfig && mouseOpts.area) {
|
|
609
|
+
var _$table$getTableColum6 = $table.getTableColumn(),
|
|
610
|
+
visibleColumn = _$table$getTableColum6.visibleColumn;
|
|
611
|
+
var cellAreas = $table.getCellAreas();
|
|
612
|
+
if (cellAreas.length === 1) {
|
|
613
|
+
var fitstArea = cellAreas[0];
|
|
614
|
+
$table.setCellAreas([{
|
|
615
|
+
startRow: _xeUtils["default"].first(fitstArea.rows),
|
|
616
|
+
endRow: _xeUtils["default"].last(fitstArea.rows),
|
|
617
|
+
startColumn: _xeUtils["default"].first(fitstArea.cols),
|
|
618
|
+
endColumn: _xeUtils["default"].last(visibleColumn)
|
|
619
|
+
}], {
|
|
620
|
+
column: column,
|
|
621
|
+
row: row
|
|
622
|
+
});
|
|
623
|
+
} else {
|
|
624
|
+
$table.setCellAreas([{
|
|
625
|
+
startRow: row,
|
|
626
|
+
endRow: row,
|
|
627
|
+
startColumn: column,
|
|
628
|
+
endColumn: _xeUtils["default"].last(visibleColumn)
|
|
629
|
+
}], {
|
|
630
|
+
column: column,
|
|
631
|
+
row: row
|
|
632
|
+
});
|
|
633
|
+
}
|
|
634
|
+
}
|
|
635
|
+
}
|
|
636
|
+
},
|
|
637
|
+
/**
|
|
638
|
+
* 以当前单元格为起点,范围选取到顶部单元格
|
|
639
|
+
*/
|
|
640
|
+
SELECT_AREA_TO_TOP: {
|
|
641
|
+
menuMethod: function menuMethod(params) {
|
|
642
|
+
var $table = params.$table,
|
|
643
|
+
row = params.row,
|
|
644
|
+
column = params.column;
|
|
645
|
+
var tableProps = $table.props;
|
|
646
|
+
var mouseConfig = tableProps.mouseConfig;
|
|
647
|
+
var _$table$getComputeMap9 = $table.getComputeMaps(),
|
|
648
|
+
computeMouseOpts = _$table$getComputeMap9.computeMouseOpts;
|
|
649
|
+
var mouseOpts = computeMouseOpts.value;
|
|
650
|
+
if (row && column && mouseConfig && mouseOpts.area) {
|
|
651
|
+
var _$table$getTableData5 = $table.getTableData(),
|
|
652
|
+
visibleData = _$table$getTableData5.visibleData;
|
|
653
|
+
var cellAreas = $table.getCellAreas();
|
|
654
|
+
if (cellAreas.length === 1) {
|
|
655
|
+
var fitstArea = cellAreas[0];
|
|
656
|
+
$table.setCellAreas([{
|
|
657
|
+
startRow: _xeUtils["default"].first(visibleData),
|
|
658
|
+
endRow: _xeUtils["default"].last(fitstArea.rows),
|
|
659
|
+
startColumn: _xeUtils["default"].first(fitstArea.cols),
|
|
660
|
+
endColumn: _xeUtils["default"].last(fitstArea.cols)
|
|
661
|
+
}], {
|
|
662
|
+
column: column,
|
|
663
|
+
row: row
|
|
664
|
+
});
|
|
665
|
+
} else {
|
|
666
|
+
$table.setCellAreas([{
|
|
667
|
+
startRow: _xeUtils["default"].first(visibleData),
|
|
668
|
+
endRow: row,
|
|
669
|
+
startColumn: column,
|
|
670
|
+
endColumn: column
|
|
671
|
+
}], {
|
|
672
|
+
column: column,
|
|
673
|
+
row: row
|
|
674
|
+
});
|
|
675
|
+
}
|
|
676
|
+
}
|
|
677
|
+
}
|
|
678
|
+
},
|
|
679
|
+
/**
|
|
680
|
+
* 以当前单元格为起点,范围选取到底部单元格
|
|
681
|
+
*/
|
|
682
|
+
SELECT_AREA_TO_BOTTON: {
|
|
683
|
+
menuMethod: function menuMethod(params) {
|
|
684
|
+
var $table = params.$table,
|
|
685
|
+
row = params.row,
|
|
686
|
+
column = params.column;
|
|
687
|
+
var tableProps = $table.props;
|
|
688
|
+
var mouseConfig = tableProps.mouseConfig;
|
|
689
|
+
var _$table$getComputeMap10 = $table.getComputeMaps(),
|
|
690
|
+
computeMouseOpts = _$table$getComputeMap10.computeMouseOpts;
|
|
691
|
+
var mouseOpts = computeMouseOpts.value;
|
|
692
|
+
if (row && column && mouseConfig && mouseOpts.area) {
|
|
693
|
+
var _$table$getTableData6 = $table.getTableData(),
|
|
694
|
+
visibleData = _$table$getTableData6.visibleData;
|
|
695
|
+
var cellAreas = $table.getCellAreas();
|
|
696
|
+
if (cellAreas.length === 1) {
|
|
697
|
+
var fitstArea = cellAreas[0];
|
|
698
|
+
$table.setCellAreas([{
|
|
699
|
+
startRow: _xeUtils["default"].first(fitstArea.rows),
|
|
700
|
+
endRow: _xeUtils["default"].last(visibleData),
|
|
701
|
+
startColumn: _xeUtils["default"].first(fitstArea.cols),
|
|
702
|
+
endColumn: _xeUtils["default"].last(fitstArea.cols)
|
|
703
|
+
}], {
|
|
704
|
+
column: column,
|
|
705
|
+
row: row
|
|
706
|
+
});
|
|
707
|
+
} else {
|
|
708
|
+
$table.setCellAreas([{
|
|
709
|
+
startRow: row,
|
|
710
|
+
endRow: _xeUtils["default"].last(visibleData),
|
|
711
|
+
startColumn: column,
|
|
712
|
+
endColumn: column
|
|
713
|
+
}], {
|
|
714
|
+
column: column,
|
|
715
|
+
row: row
|
|
716
|
+
});
|
|
717
|
+
}
|
|
718
|
+
}
|
|
719
|
+
}
|
|
720
|
+
},
|
|
508
721
|
/**
|
|
509
722
|
* 还原单元格数据的值;如果启用 mouse-config.area 功能,则还原区域范围内的单元格数据
|
|
510
723
|
*/
|
|
@@ -516,8 +729,8 @@ var VxeUIPluginMenu = exports.VxeUIPluginMenu = {
|
|
|
516
729
|
if (row && column) {
|
|
517
730
|
var tableProps = $table.props;
|
|
518
731
|
var mouseConfig = tableProps.mouseConfig;
|
|
519
|
-
var _$table$
|
|
520
|
-
computeMouseOpts = _$table$
|
|
732
|
+
var _$table$getComputeMap11 = $table.getComputeMaps(),
|
|
733
|
+
computeMouseOpts = _$table$getComputeMap11.computeMouseOpts;
|
|
521
734
|
var mouseOpts = computeMouseOpts.value;
|
|
522
735
|
if (mouseConfig && mouseOpts.area) {
|
|
523
736
|
var cellAreas = $table.getCellAreas();
|
|
@@ -612,8 +825,8 @@ var VxeUIPluginMenu = exports.VxeUIPluginMenu = {
|
|
|
612
825
|
column = params.column;
|
|
613
826
|
var tableProps = $table.props;
|
|
614
827
|
var mouseConfig = tableProps.mouseConfig;
|
|
615
|
-
var _$table$
|
|
616
|
-
computeMouseOpts = _$table$
|
|
828
|
+
var _$table$getComputeMap12 = $table.getComputeMaps(),
|
|
829
|
+
computeMouseOpts = _$table$getComputeMap12.computeMouseOpts;
|
|
617
830
|
var mouseOpts = computeMouseOpts.value;
|
|
618
831
|
if (mouseConfig && mouseOpts.area) {
|
|
619
832
|
$table.triggerPasteCellAreaEvent($event);
|
|
@@ -672,10 +885,10 @@ var VxeUIPluginMenu = exports.VxeUIPluginMenu = {
|
|
|
672
885
|
menuMethod: function menuMethod(params) {
|
|
673
886
|
var $event = params.$event,
|
|
674
887
|
$table = params.$table;
|
|
675
|
-
var _$table$
|
|
676
|
-
visibleData = _$table$
|
|
677
|
-
var _$table$
|
|
678
|
-
visibleColumn = _$table$
|
|
888
|
+
var _$table$getTableData7 = $table.getTableData(),
|
|
889
|
+
visibleData = _$table$getTableData7.visibleData;
|
|
890
|
+
var _$table$getTableColum7 = $table.getTableColumn(),
|
|
891
|
+
visibleColumn = _$table$getTableColum7.visibleColumn;
|
|
679
892
|
var cellAreas = $table.getCellAreas();
|
|
680
893
|
handleClearMergeCells(params);
|
|
681
894
|
if (cellAreas.some(function (_ref4) {
|
|
@@ -783,50 +996,24 @@ var VxeUIPluginMenu = exports.VxeUIPluginMenu = {
|
|
|
783
996
|
* 插入数据
|
|
784
997
|
*/
|
|
785
998
|
INSERT_ROW: {
|
|
786
|
-
menuMethod: function menuMethod(params) {
|
|
787
|
-
var $table = params.$table,
|
|
788
|
-
menu = params.menu;
|
|
789
|
-
$table.insert(menu.params || {});
|
|
790
|
-
}
|
|
791
|
-
},
|
|
792
|
-
/**
|
|
793
|
-
* 插入数据并激活编辑状态
|
|
794
|
-
* @deprecated
|
|
795
|
-
*/
|
|
796
|
-
INSERT_ACTIVED_ROW: {
|
|
797
|
-
menuMethod: function menuMethod(params) {
|
|
798
|
-
var $table = params.$table,
|
|
799
|
-
menu = params.menu,
|
|
800
|
-
column = params.column;
|
|
801
|
-
var args = menu.params || []; // [{}, 'field']
|
|
802
|
-
$table.insert(args[0] || {}).then(function (_ref7) {
|
|
803
|
-
var row = _ref7.row;
|
|
804
|
-
if ($table.setEditCell) {
|
|
805
|
-
$table.setEditCell(row, args[1] || column);
|
|
806
|
-
} else {
|
|
807
|
-
// 兼容老版本
|
|
808
|
-
$table.setActiveCell(row, args[1] || column.field);
|
|
809
|
-
}
|
|
810
|
-
});
|
|
811
|
-
}
|
|
812
|
-
},
|
|
813
|
-
/**
|
|
814
|
-
* 插入数据并激活编辑状态
|
|
815
|
-
* @deprecated
|
|
816
|
-
*/
|
|
817
|
-
INSERT_EDIT_ROW: {
|
|
818
999
|
menuMethod: function menuMethod(params) {
|
|
819
1000
|
var $table = params.$table,
|
|
820
1001
|
menu = params.menu,
|
|
821
1002
|
column = params.column;
|
|
822
|
-
var
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
1003
|
+
var tableProps = $table.props;
|
|
1004
|
+
var mouseConfig = tableProps.mouseConfig;
|
|
1005
|
+
var _$table$getComputeMap13 = $table.getComputeMaps(),
|
|
1006
|
+
computeMouseOpts = _$table$getComputeMap13.computeMouseOpts;
|
|
1007
|
+
var mouseOpts = computeMouseOpts.value;
|
|
1008
|
+
$table.insert(menu.params || {}).then(function (_ref7) {
|
|
1009
|
+
var rows = _ref7.rows;
|
|
1010
|
+
if (column && mouseConfig && mouseOpts.area) {
|
|
1011
|
+
$table.setCellAreas([{
|
|
1012
|
+
startRow: _xeUtils["default"].first(rows),
|
|
1013
|
+
endRow: _xeUtils["default"].last(rows),
|
|
1014
|
+
startColumn: column,
|
|
1015
|
+
endColumn: column
|
|
1016
|
+
}]);
|
|
830
1017
|
}
|
|
831
1018
|
});
|
|
832
1019
|
}
|
|
@@ -838,9 +1025,25 @@ var VxeUIPluginMenu = exports.VxeUIPluginMenu = {
|
|
|
838
1025
|
menuMethod: function menuMethod(params) {
|
|
839
1026
|
var $table = params.$table,
|
|
840
1027
|
menu = params.menu,
|
|
841
|
-
row = params.row
|
|
1028
|
+
row = params.row,
|
|
1029
|
+
column = params.column;
|
|
1030
|
+
var tableProps = $table.props;
|
|
1031
|
+
var mouseConfig = tableProps.mouseConfig;
|
|
1032
|
+
var _$table$getComputeMap14 = $table.getComputeMaps(),
|
|
1033
|
+
computeMouseOpts = _$table$getComputeMap14.computeMouseOpts;
|
|
1034
|
+
var mouseOpts = computeMouseOpts.value;
|
|
842
1035
|
if (row) {
|
|
843
|
-
$table.insertAt(menu.params || {}, row)
|
|
1036
|
+
$table.insertAt(menu.params || {}, row).then(function (_ref8) {
|
|
1037
|
+
var rows = _ref8.rows;
|
|
1038
|
+
if (column && mouseConfig && mouseOpts.area) {
|
|
1039
|
+
$table.setCellAreas([{
|
|
1040
|
+
startRow: _xeUtils["default"].first(rows),
|
|
1041
|
+
endRow: _xeUtils["default"].last(rows),
|
|
1042
|
+
startColumn: column,
|
|
1043
|
+
endColumn: column
|
|
1044
|
+
}]);
|
|
1045
|
+
}
|
|
1046
|
+
});
|
|
844
1047
|
}
|
|
845
1048
|
}
|
|
846
1049
|
},
|
|
@@ -851,14 +1054,30 @@ var VxeUIPluginMenu = exports.VxeUIPluginMenu = {
|
|
|
851
1054
|
menuMethod: function menuMethod(params) {
|
|
852
1055
|
var $table = params.$table,
|
|
853
1056
|
menu = params.menu,
|
|
854
|
-
row = params.row
|
|
1057
|
+
row = params.row,
|
|
1058
|
+
column = params.column;
|
|
1059
|
+
var tableProps = $table.props;
|
|
1060
|
+
var mouseConfig = tableProps.mouseConfig;
|
|
1061
|
+
var _$table$getComputeMap15 = $table.getComputeMaps(),
|
|
1062
|
+
computeMouseOpts = _$table$getComputeMap15.computeMouseOpts;
|
|
1063
|
+
var mouseOpts = computeMouseOpts.value;
|
|
855
1064
|
if (row) {
|
|
856
1065
|
selectMultipleRows().then(function (_ref9) {
|
|
857
1066
|
var size = _ref9.size;
|
|
858
1067
|
if (size) {
|
|
859
1068
|
$table.insertAt(_xeUtils["default"].range(0, size).map(function () {
|
|
860
1069
|
return Object.assign({}, menu.params);
|
|
861
|
-
}), row)
|
|
1070
|
+
}), row).then(function (_ref10) {
|
|
1071
|
+
var rows = _ref10.rows;
|
|
1072
|
+
if (column && mouseConfig && mouseOpts.area) {
|
|
1073
|
+
$table.setCellAreas([{
|
|
1074
|
+
startRow: _xeUtils["default"].first(rows),
|
|
1075
|
+
endRow: _xeUtils["default"].last(rows),
|
|
1076
|
+
startColumn: column,
|
|
1077
|
+
endColumn: column
|
|
1078
|
+
}]);
|
|
1079
|
+
}
|
|
1080
|
+
});
|
|
862
1081
|
}
|
|
863
1082
|
});
|
|
864
1083
|
}
|
|
@@ -871,9 +1090,25 @@ var VxeUIPluginMenu = exports.VxeUIPluginMenu = {
|
|
|
871
1090
|
menuMethod: function menuMethod(params) {
|
|
872
1091
|
var $table = params.$table,
|
|
873
1092
|
menu = params.menu,
|
|
874
|
-
row = params.row
|
|
1093
|
+
row = params.row,
|
|
1094
|
+
column = params.column;
|
|
1095
|
+
var tableProps = $table.props;
|
|
1096
|
+
var mouseConfig = tableProps.mouseConfig;
|
|
1097
|
+
var _$table$getComputeMap16 = $table.getComputeMaps(),
|
|
1098
|
+
computeMouseOpts = _$table$getComputeMap16.computeMouseOpts;
|
|
1099
|
+
var mouseOpts = computeMouseOpts.value;
|
|
875
1100
|
if (row) {
|
|
876
|
-
$table.insertNextAt(menu.params || {}, row)
|
|
1101
|
+
$table.insertNextAt(menu.params || {}, row).then(function (_ref11) {
|
|
1102
|
+
var rows = _ref11.rows;
|
|
1103
|
+
if (column && mouseConfig && mouseOpts.area) {
|
|
1104
|
+
$table.setCellAreas([{
|
|
1105
|
+
startRow: _xeUtils["default"].first(rows),
|
|
1106
|
+
endRow: _xeUtils["default"].last(rows),
|
|
1107
|
+
startColumn: column,
|
|
1108
|
+
endColumn: column
|
|
1109
|
+
}]);
|
|
1110
|
+
}
|
|
1111
|
+
});
|
|
877
1112
|
}
|
|
878
1113
|
}
|
|
879
1114
|
},
|
|
@@ -884,19 +1119,77 @@ var VxeUIPluginMenu = exports.VxeUIPluginMenu = {
|
|
|
884
1119
|
menuMethod: function menuMethod(params) {
|
|
885
1120
|
var $table = params.$table,
|
|
886
1121
|
menu = params.menu,
|
|
887
|
-
row = params.row
|
|
1122
|
+
row = params.row,
|
|
1123
|
+
column = params.column;
|
|
1124
|
+
var tableProps = $table.props;
|
|
1125
|
+
var mouseConfig = tableProps.mouseConfig;
|
|
1126
|
+
var _$table$getComputeMap17 = $table.getComputeMaps(),
|
|
1127
|
+
computeMouseOpts = _$table$getComputeMap17.computeMouseOpts;
|
|
1128
|
+
var mouseOpts = computeMouseOpts.value;
|
|
888
1129
|
if (row) {
|
|
889
|
-
selectMultipleRows().then(function (
|
|
890
|
-
var size =
|
|
1130
|
+
selectMultipleRows().then(function (_ref12) {
|
|
1131
|
+
var size = _ref12.size;
|
|
891
1132
|
if (size) {
|
|
892
1133
|
$table.insertNextAt(_xeUtils["default"].range(0, size).map(function () {
|
|
893
1134
|
return Object.assign({}, menu.params);
|
|
894
|
-
}), row)
|
|
1135
|
+
}), row).then(function (_ref13) {
|
|
1136
|
+
var rows = _ref13.rows;
|
|
1137
|
+
if (column && mouseConfig && mouseOpts.area) {
|
|
1138
|
+
$table.setCellAreas([{
|
|
1139
|
+
startRow: _xeUtils["default"].first(rows),
|
|
1140
|
+
endRow: _xeUtils["default"].last(rows),
|
|
1141
|
+
startColumn: column,
|
|
1142
|
+
endColumn: column
|
|
1143
|
+
}]);
|
|
1144
|
+
}
|
|
1145
|
+
});
|
|
895
1146
|
}
|
|
896
1147
|
});
|
|
897
1148
|
}
|
|
898
1149
|
}
|
|
899
1150
|
},
|
|
1151
|
+
/**
|
|
1152
|
+
* 插入数据并激活编辑状态
|
|
1153
|
+
* @deprecated
|
|
1154
|
+
*/
|
|
1155
|
+
INSERT_ACTIVED_ROW: {
|
|
1156
|
+
menuMethod: function menuMethod(params) {
|
|
1157
|
+
var $table = params.$table,
|
|
1158
|
+
menu = params.menu,
|
|
1159
|
+
column = params.column;
|
|
1160
|
+
var args = menu.params || []; // [{}, 'field']
|
|
1161
|
+
$table.insert(args[0] || {}).then(function (_ref14) {
|
|
1162
|
+
var row = _ref14.row;
|
|
1163
|
+
if ($table.setEditCell) {
|
|
1164
|
+
$table.setEditCell(row, args[1] || column);
|
|
1165
|
+
} else {
|
|
1166
|
+
// 兼容老版本
|
|
1167
|
+
$table.setActiveCell(row, args[1] || column.field);
|
|
1168
|
+
}
|
|
1169
|
+
});
|
|
1170
|
+
}
|
|
1171
|
+
},
|
|
1172
|
+
/**
|
|
1173
|
+
* 插入数据并激活编辑状态
|
|
1174
|
+
* @deprecated
|
|
1175
|
+
*/
|
|
1176
|
+
INSERT_EDIT_ROW: {
|
|
1177
|
+
menuMethod: function menuMethod(params) {
|
|
1178
|
+
var $table = params.$table,
|
|
1179
|
+
menu = params.menu,
|
|
1180
|
+
column = params.column;
|
|
1181
|
+
var args = menu.params || []; // [{}, 'field']
|
|
1182
|
+
$table.insert(args[0] || {}).then(function (_ref15) {
|
|
1183
|
+
var row = _ref15.row;
|
|
1184
|
+
if ($table.setEditCell) {
|
|
1185
|
+
$table.setEditCell(row, args[1] || column);
|
|
1186
|
+
} else {
|
|
1187
|
+
// 兼容老版本
|
|
1188
|
+
$table.setActiveCell(row, args[1] || column.field);
|
|
1189
|
+
}
|
|
1190
|
+
});
|
|
1191
|
+
}
|
|
1192
|
+
},
|
|
900
1193
|
/**
|
|
901
1194
|
* 插入数据到指定位置并激活编辑状态
|
|
902
1195
|
*/
|
|
@@ -908,8 +1201,8 @@ var VxeUIPluginMenu = exports.VxeUIPluginMenu = {
|
|
|
908
1201
|
column = params.column;
|
|
909
1202
|
if (row) {
|
|
910
1203
|
var args = menu.params || []; // [{}, 'field']
|
|
911
|
-
$table.insertAt(args[0] || {}, row).then(function (
|
|
912
|
-
var row =
|
|
1204
|
+
$table.insertAt(args[0] || {}, row).then(function (_ref16) {
|
|
1205
|
+
var row = _ref16.row;
|
|
913
1206
|
if ($table.setEditCell) {
|
|
914
1207
|
$table.setEditCell(row, args[1] || column);
|
|
915
1208
|
} else {
|
|
@@ -931,8 +1224,8 @@ var VxeUIPluginMenu = exports.VxeUIPluginMenu = {
|
|
|
931
1224
|
column = params.column;
|
|
932
1225
|
if (row) {
|
|
933
1226
|
var args = menu.params || []; // [{}, 'field']
|
|
934
|
-
$table.insertAt(args[0] || {}, row).then(function (
|
|
935
|
-
var row =
|
|
1227
|
+
$table.insertAt(args[0] || {}, row).then(function (_ref17) {
|
|
1228
|
+
var row = _ref17.row;
|
|
936
1229
|
if ($table.setEditCell) {
|
|
937
1230
|
$table.setEditCell(row, args[1] || column);
|
|
938
1231
|
} else {
|
|
@@ -954,13 +1247,13 @@ var VxeUIPluginMenu = exports.VxeUIPluginMenu = {
|
|
|
954
1247
|
column = params.column;
|
|
955
1248
|
if (row) {
|
|
956
1249
|
var args = menu.params || []; // [{}, 'field']
|
|
957
|
-
selectMultipleRows().then(function (
|
|
958
|
-
var size =
|
|
1250
|
+
selectMultipleRows().then(function (_ref18) {
|
|
1251
|
+
var size = _ref18.size;
|
|
959
1252
|
if (size) {
|
|
960
1253
|
$table.insertAt(_xeUtils["default"].range(0, size).map(function () {
|
|
961
1254
|
return Object.assign({}, args[0]);
|
|
962
|
-
}), row).then(function (
|
|
963
|
-
var row =
|
|
1255
|
+
}), row).then(function (_ref19) {
|
|
1256
|
+
var row = _ref19.row;
|
|
964
1257
|
if ($table.setEditCell) {
|
|
965
1258
|
$table.setEditCell(row, args[1] || column);
|
|
966
1259
|
} else {
|
|
@@ -984,8 +1277,8 @@ var VxeUIPluginMenu = exports.VxeUIPluginMenu = {
|
|
|
984
1277
|
column = params.column;
|
|
985
1278
|
if (row) {
|
|
986
1279
|
var args = menu.params || []; // [{}, 'field']
|
|
987
|
-
$table.insertNextAt(args[0] || {}, row).then(function (
|
|
988
|
-
var row =
|
|
1280
|
+
$table.insertNextAt(args[0] || {}, row).then(function (_ref20) {
|
|
1281
|
+
var row = _ref20.row;
|
|
989
1282
|
if ($table.setEditCell) {
|
|
990
1283
|
$table.setEditCell(row, args[1] || column);
|
|
991
1284
|
} else {
|
|
@@ -1007,13 +1300,13 @@ var VxeUIPluginMenu = exports.VxeUIPluginMenu = {
|
|
|
1007
1300
|
column = params.column;
|
|
1008
1301
|
if (row) {
|
|
1009
1302
|
var args = menu.params || []; // [{}, 'field']
|
|
1010
|
-
selectMultipleRows().then(function (
|
|
1011
|
-
var size =
|
|
1303
|
+
selectMultipleRows().then(function (_ref21) {
|
|
1304
|
+
var size = _ref21.size;
|
|
1012
1305
|
if (size) {
|
|
1013
1306
|
$table.insertNextAt(_xeUtils["default"].range(0, size).map(function () {
|
|
1014
1307
|
return Object.assign({}, args[0]);
|
|
1015
|
-
}), row).then(function (
|
|
1016
|
-
var row =
|
|
1308
|
+
}), row).then(function (_ref22) {
|
|
1309
|
+
var row = _ref22.row;
|
|
1017
1310
|
if ($table.setEditCell) {
|
|
1018
1311
|
$table.setEditCell(row, args[1] || column);
|
|
1019
1312
|
} else {
|
|
@@ -1047,8 +1340,8 @@ var VxeUIPluginMenu = exports.VxeUIPluginMenu = {
|
|
|
1047
1340
|
row = params.row;
|
|
1048
1341
|
var tableProps = $table.props;
|
|
1049
1342
|
var mouseConfig = tableProps.mouseConfig;
|
|
1050
|
-
var _$table$
|
|
1051
|
-
computeMouseOpts = _$table$
|
|
1343
|
+
var _$table$getComputeMap18 = $table.getComputeMaps(),
|
|
1344
|
+
computeMouseOpts = _$table$getComputeMap18.computeMouseOpts;
|
|
1052
1345
|
var mouseOpts = computeMouseOpts.value;
|
|
1053
1346
|
if (mouseConfig && mouseOpts.area) {
|
|
1054
1347
|
var cellAreas = $table.getCellAreas();
|
package/dist/index.umd.js
CHANGED
|
@@ -229,6 +229,23 @@
|
|
|
229
229
|
item.disabled = !column || type !== 'header';
|
|
230
230
|
break;
|
|
231
231
|
}
|
|
232
|
+
case 'SELECT_ALL_AREA':
|
|
233
|
+
{
|
|
234
|
+
var _$table$getTableData3 = $table.getTableData(),
|
|
235
|
+
visibleData = _$table$getTableData3.visibleData;
|
|
236
|
+
var _$table$getTableColum3 = $table.getTableColumn(),
|
|
237
|
+
visibleColumn = _$table$getTableColum3.visibleColumn;
|
|
238
|
+
item.disabled = !(visibleData.length || visibleColumn.length);
|
|
239
|
+
break;
|
|
240
|
+
}
|
|
241
|
+
case 'SELECT_AREA_TO_LEFT':
|
|
242
|
+
case 'SELECT_AREA_TO_RIGHT':
|
|
243
|
+
case 'SELECT_AREA_TO_TOP':
|
|
244
|
+
case 'SELECT_AREA_TO_BOTTON':
|
|
245
|
+
{
|
|
246
|
+
item.disabled = !column || !row;
|
|
247
|
+
break;
|
|
248
|
+
}
|
|
232
249
|
case 'EDIT_CELL':
|
|
233
250
|
case 'CLEAR_CELL':
|
|
234
251
|
case 'CLEAR_ROW':
|
|
@@ -363,8 +380,8 @@
|
|
|
363
380
|
function selectMultipleRows() {
|
|
364
381
|
return new Promise(function (resolve) {
|
|
365
382
|
if (VxeUI.modal) {
|
|
366
|
-
var
|
|
367
|
-
if (
|
|
383
|
+
var VxeUINumberInputComponent = VxeUI.getComponent('VxeNumberInput');
|
|
384
|
+
if (VxeUINumberInputComponent) {
|
|
368
385
|
var rowSize = (0, _vue.ref)(1);
|
|
369
386
|
VxeUI.modal.alert({
|
|
370
387
|
title: '请输入行数',
|
|
@@ -372,11 +389,14 @@
|
|
|
372
389
|
maskClosable: false,
|
|
373
390
|
slots: {
|
|
374
391
|
"default": function _default() {
|
|
375
|
-
return (0, _vue.h)(
|
|
392
|
+
return (0, _vue.h)(VxeUINumberInputComponent, {
|
|
376
393
|
modelValue: rowSize.value,
|
|
377
394
|
min: 1,
|
|
378
395
|
max: 100,
|
|
379
396
|
align: 'center',
|
|
397
|
+
controlConfig: {
|
|
398
|
+
layout: 'default'
|
|
399
|
+
},
|
|
380
400
|
style: {
|
|
381
401
|
width: '100%'
|
|
382
402
|
},
|
|
@@ -424,7 +444,7 @@
|
|
|
424
444
|
VxeUI = core;
|
|
425
445
|
// 检查版本
|
|
426
446
|
if (!/^(4)\./.test(VxeUI.uiVersion)) {
|
|
427
|
-
console.error('[@vxe-ui/plugin-menu 4.0.
|
|
447
|
+
console.error('[@vxe-ui/plugin-menu 4.0.11] Requires vxe-table 4.7.0+ version. https://vxeui.com/other4/#/plugin-menu/install');
|
|
428
448
|
}
|
|
429
449
|
pluginSetup(options);
|
|
430
450
|
VxeUI.menus.mixin({
|
|
@@ -517,6 +537,199 @@
|
|
|
517
537
|
$table.clearData();
|
|
518
538
|
}
|
|
519
539
|
},
|
|
540
|
+
/**
|
|
541
|
+
* 选取所有区域
|
|
542
|
+
*/
|
|
543
|
+
SELECT_ALL_AREA: {
|
|
544
|
+
menuMethod: function menuMethod(params) {
|
|
545
|
+
var $table = params.$table;
|
|
546
|
+
var tableProps = $table.props;
|
|
547
|
+
var mouseConfig = tableProps.mouseConfig;
|
|
548
|
+
var _$table$getComputeMap6 = $table.getComputeMaps(),
|
|
549
|
+
computeMouseOpts = _$table$getComputeMap6.computeMouseOpts;
|
|
550
|
+
var mouseOpts = computeMouseOpts.value;
|
|
551
|
+
if (mouseConfig && mouseOpts.area) {
|
|
552
|
+
var _$table$getTableData4 = $table.getTableData(),
|
|
553
|
+
visibleData = _$table$getTableData4.visibleData;
|
|
554
|
+
var _$table$getTableColum4 = $table.getTableColumn(),
|
|
555
|
+
visibleColumn = _$table$getTableColum4.visibleColumn;
|
|
556
|
+
$table.setCellAreas([{
|
|
557
|
+
startRow: _xeUtils["default"].first(visibleData),
|
|
558
|
+
endRow: _xeUtils["default"].last(visibleData),
|
|
559
|
+
startColumn: _xeUtils["default"].first(visibleColumn),
|
|
560
|
+
endColumn: _xeUtils["default"].last(visibleColumn)
|
|
561
|
+
}]);
|
|
562
|
+
}
|
|
563
|
+
}
|
|
564
|
+
},
|
|
565
|
+
/**
|
|
566
|
+
* 以当前单元格为起点,范围选取到左侧单元格
|
|
567
|
+
*/
|
|
568
|
+
SELECT_AREA_TO_LEFT: {
|
|
569
|
+
menuMethod: function menuMethod(params) {
|
|
570
|
+
var $table = params.$table,
|
|
571
|
+
row = params.row,
|
|
572
|
+
column = params.column;
|
|
573
|
+
var tableProps = $table.props;
|
|
574
|
+
var mouseConfig = tableProps.mouseConfig;
|
|
575
|
+
var _$table$getComputeMap7 = $table.getComputeMaps(),
|
|
576
|
+
computeMouseOpts = _$table$getComputeMap7.computeMouseOpts;
|
|
577
|
+
var mouseOpts = computeMouseOpts.value;
|
|
578
|
+
if (row && column && mouseConfig && mouseOpts.area) {
|
|
579
|
+
var _$table$getTableColum5 = $table.getTableColumn(),
|
|
580
|
+
visibleColumn = _$table$getTableColum5.visibleColumn;
|
|
581
|
+
var cellAreas = $table.getCellAreas();
|
|
582
|
+
if (cellAreas.length === 1) {
|
|
583
|
+
var fitstArea = cellAreas[0];
|
|
584
|
+
$table.setCellAreas([{
|
|
585
|
+
startRow: _xeUtils["default"].first(fitstArea.rows),
|
|
586
|
+
endRow: _xeUtils["default"].last(fitstArea.rows),
|
|
587
|
+
startColumn: _xeUtils["default"].first(visibleColumn),
|
|
588
|
+
endColumn: _xeUtils["default"].last(fitstArea.cols)
|
|
589
|
+
}], {
|
|
590
|
+
column: column,
|
|
591
|
+
row: row
|
|
592
|
+
});
|
|
593
|
+
} else {
|
|
594
|
+
$table.setCellAreas([{
|
|
595
|
+
startRow: row,
|
|
596
|
+
endRow: row,
|
|
597
|
+
startColumn: _xeUtils["default"].first(visibleColumn),
|
|
598
|
+
endColumn: column
|
|
599
|
+
}], {
|
|
600
|
+
column: column,
|
|
601
|
+
row: row
|
|
602
|
+
});
|
|
603
|
+
}
|
|
604
|
+
}
|
|
605
|
+
}
|
|
606
|
+
},
|
|
607
|
+
/**
|
|
608
|
+
* 以当前单元格为起点,范围选取到右侧单元格
|
|
609
|
+
*/
|
|
610
|
+
SELECT_AREA_TO_RIGHT: {
|
|
611
|
+
menuMethod: function menuMethod(params) {
|
|
612
|
+
var $table = params.$table,
|
|
613
|
+
row = params.row,
|
|
614
|
+
column = params.column;
|
|
615
|
+
var tableProps = $table.props;
|
|
616
|
+
var mouseConfig = tableProps.mouseConfig;
|
|
617
|
+
var _$table$getComputeMap8 = $table.getComputeMaps(),
|
|
618
|
+
computeMouseOpts = _$table$getComputeMap8.computeMouseOpts;
|
|
619
|
+
var mouseOpts = computeMouseOpts.value;
|
|
620
|
+
if (row && column && mouseConfig && mouseOpts.area) {
|
|
621
|
+
var _$table$getTableColum6 = $table.getTableColumn(),
|
|
622
|
+
visibleColumn = _$table$getTableColum6.visibleColumn;
|
|
623
|
+
var cellAreas = $table.getCellAreas();
|
|
624
|
+
if (cellAreas.length === 1) {
|
|
625
|
+
var fitstArea = cellAreas[0];
|
|
626
|
+
$table.setCellAreas([{
|
|
627
|
+
startRow: _xeUtils["default"].first(fitstArea.rows),
|
|
628
|
+
endRow: _xeUtils["default"].last(fitstArea.rows),
|
|
629
|
+
startColumn: _xeUtils["default"].first(fitstArea.cols),
|
|
630
|
+
endColumn: _xeUtils["default"].last(visibleColumn)
|
|
631
|
+
}], {
|
|
632
|
+
column: column,
|
|
633
|
+
row: row
|
|
634
|
+
});
|
|
635
|
+
} else {
|
|
636
|
+
$table.setCellAreas([{
|
|
637
|
+
startRow: row,
|
|
638
|
+
endRow: row,
|
|
639
|
+
startColumn: column,
|
|
640
|
+
endColumn: _xeUtils["default"].last(visibleColumn)
|
|
641
|
+
}], {
|
|
642
|
+
column: column,
|
|
643
|
+
row: row
|
|
644
|
+
});
|
|
645
|
+
}
|
|
646
|
+
}
|
|
647
|
+
}
|
|
648
|
+
},
|
|
649
|
+
/**
|
|
650
|
+
* 以当前单元格为起点,范围选取到顶部单元格
|
|
651
|
+
*/
|
|
652
|
+
SELECT_AREA_TO_TOP: {
|
|
653
|
+
menuMethod: function menuMethod(params) {
|
|
654
|
+
var $table = params.$table,
|
|
655
|
+
row = params.row,
|
|
656
|
+
column = params.column;
|
|
657
|
+
var tableProps = $table.props;
|
|
658
|
+
var mouseConfig = tableProps.mouseConfig;
|
|
659
|
+
var _$table$getComputeMap9 = $table.getComputeMaps(),
|
|
660
|
+
computeMouseOpts = _$table$getComputeMap9.computeMouseOpts;
|
|
661
|
+
var mouseOpts = computeMouseOpts.value;
|
|
662
|
+
if (row && column && mouseConfig && mouseOpts.area) {
|
|
663
|
+
var _$table$getTableData5 = $table.getTableData(),
|
|
664
|
+
visibleData = _$table$getTableData5.visibleData;
|
|
665
|
+
var cellAreas = $table.getCellAreas();
|
|
666
|
+
if (cellAreas.length === 1) {
|
|
667
|
+
var fitstArea = cellAreas[0];
|
|
668
|
+
$table.setCellAreas([{
|
|
669
|
+
startRow: _xeUtils["default"].first(visibleData),
|
|
670
|
+
endRow: _xeUtils["default"].last(fitstArea.rows),
|
|
671
|
+
startColumn: _xeUtils["default"].first(fitstArea.cols),
|
|
672
|
+
endColumn: _xeUtils["default"].last(fitstArea.cols)
|
|
673
|
+
}], {
|
|
674
|
+
column: column,
|
|
675
|
+
row: row
|
|
676
|
+
});
|
|
677
|
+
} else {
|
|
678
|
+
$table.setCellAreas([{
|
|
679
|
+
startRow: _xeUtils["default"].first(visibleData),
|
|
680
|
+
endRow: row,
|
|
681
|
+
startColumn: column,
|
|
682
|
+
endColumn: column
|
|
683
|
+
}], {
|
|
684
|
+
column: column,
|
|
685
|
+
row: row
|
|
686
|
+
});
|
|
687
|
+
}
|
|
688
|
+
}
|
|
689
|
+
}
|
|
690
|
+
},
|
|
691
|
+
/**
|
|
692
|
+
* 以当前单元格为起点,范围选取到底部单元格
|
|
693
|
+
*/
|
|
694
|
+
SELECT_AREA_TO_BOTTON: {
|
|
695
|
+
menuMethod: function menuMethod(params) {
|
|
696
|
+
var $table = params.$table,
|
|
697
|
+
row = params.row,
|
|
698
|
+
column = params.column;
|
|
699
|
+
var tableProps = $table.props;
|
|
700
|
+
var mouseConfig = tableProps.mouseConfig;
|
|
701
|
+
var _$table$getComputeMap10 = $table.getComputeMaps(),
|
|
702
|
+
computeMouseOpts = _$table$getComputeMap10.computeMouseOpts;
|
|
703
|
+
var mouseOpts = computeMouseOpts.value;
|
|
704
|
+
if (row && column && mouseConfig && mouseOpts.area) {
|
|
705
|
+
var _$table$getTableData6 = $table.getTableData(),
|
|
706
|
+
visibleData = _$table$getTableData6.visibleData;
|
|
707
|
+
var cellAreas = $table.getCellAreas();
|
|
708
|
+
if (cellAreas.length === 1) {
|
|
709
|
+
var fitstArea = cellAreas[0];
|
|
710
|
+
$table.setCellAreas([{
|
|
711
|
+
startRow: _xeUtils["default"].first(fitstArea.rows),
|
|
712
|
+
endRow: _xeUtils["default"].last(visibleData),
|
|
713
|
+
startColumn: _xeUtils["default"].first(fitstArea.cols),
|
|
714
|
+
endColumn: _xeUtils["default"].last(fitstArea.cols)
|
|
715
|
+
}], {
|
|
716
|
+
column: column,
|
|
717
|
+
row: row
|
|
718
|
+
});
|
|
719
|
+
} else {
|
|
720
|
+
$table.setCellAreas([{
|
|
721
|
+
startRow: row,
|
|
722
|
+
endRow: _xeUtils["default"].last(visibleData),
|
|
723
|
+
startColumn: column,
|
|
724
|
+
endColumn: column
|
|
725
|
+
}], {
|
|
726
|
+
column: column,
|
|
727
|
+
row: row
|
|
728
|
+
});
|
|
729
|
+
}
|
|
730
|
+
}
|
|
731
|
+
}
|
|
732
|
+
},
|
|
520
733
|
/**
|
|
521
734
|
* 还原单元格数据的值;如果启用 mouse-config.area 功能,则还原区域范围内的单元格数据
|
|
522
735
|
*/
|
|
@@ -528,8 +741,8 @@
|
|
|
528
741
|
if (row && column) {
|
|
529
742
|
var tableProps = $table.props;
|
|
530
743
|
var mouseConfig = tableProps.mouseConfig;
|
|
531
|
-
var _$table$
|
|
532
|
-
computeMouseOpts = _$table$
|
|
744
|
+
var _$table$getComputeMap11 = $table.getComputeMaps(),
|
|
745
|
+
computeMouseOpts = _$table$getComputeMap11.computeMouseOpts;
|
|
533
746
|
var mouseOpts = computeMouseOpts.value;
|
|
534
747
|
if (mouseConfig && mouseOpts.area) {
|
|
535
748
|
var cellAreas = $table.getCellAreas();
|
|
@@ -624,8 +837,8 @@
|
|
|
624
837
|
column = params.column;
|
|
625
838
|
var tableProps = $table.props;
|
|
626
839
|
var mouseConfig = tableProps.mouseConfig;
|
|
627
|
-
var _$table$
|
|
628
|
-
computeMouseOpts = _$table$
|
|
840
|
+
var _$table$getComputeMap12 = $table.getComputeMaps(),
|
|
841
|
+
computeMouseOpts = _$table$getComputeMap12.computeMouseOpts;
|
|
629
842
|
var mouseOpts = computeMouseOpts.value;
|
|
630
843
|
if (mouseConfig && mouseOpts.area) {
|
|
631
844
|
$table.triggerPasteCellAreaEvent($event);
|
|
@@ -684,10 +897,10 @@
|
|
|
684
897
|
menuMethod: function menuMethod(params) {
|
|
685
898
|
var $event = params.$event,
|
|
686
899
|
$table = params.$table;
|
|
687
|
-
var _$table$
|
|
688
|
-
visibleData = _$table$
|
|
689
|
-
var _$table$
|
|
690
|
-
visibleColumn = _$table$
|
|
900
|
+
var _$table$getTableData7 = $table.getTableData(),
|
|
901
|
+
visibleData = _$table$getTableData7.visibleData;
|
|
902
|
+
var _$table$getTableColum7 = $table.getTableColumn(),
|
|
903
|
+
visibleColumn = _$table$getTableColum7.visibleColumn;
|
|
691
904
|
var cellAreas = $table.getCellAreas();
|
|
692
905
|
handleClearMergeCells(params);
|
|
693
906
|
if (cellAreas.some(function (_ref4) {
|
|
@@ -795,50 +1008,24 @@
|
|
|
795
1008
|
* 插入数据
|
|
796
1009
|
*/
|
|
797
1010
|
INSERT_ROW: {
|
|
798
|
-
menuMethod: function menuMethod(params) {
|
|
799
|
-
var $table = params.$table,
|
|
800
|
-
menu = params.menu;
|
|
801
|
-
$table.insert(menu.params || {});
|
|
802
|
-
}
|
|
803
|
-
},
|
|
804
|
-
/**
|
|
805
|
-
* 插入数据并激活编辑状态
|
|
806
|
-
* @deprecated
|
|
807
|
-
*/
|
|
808
|
-
INSERT_ACTIVED_ROW: {
|
|
809
|
-
menuMethod: function menuMethod(params) {
|
|
810
|
-
var $table = params.$table,
|
|
811
|
-
menu = params.menu,
|
|
812
|
-
column = params.column;
|
|
813
|
-
var args = menu.params || []; // [{}, 'field']
|
|
814
|
-
$table.insert(args[0] || {}).then(function (_ref7) {
|
|
815
|
-
var row = _ref7.row;
|
|
816
|
-
if ($table.setEditCell) {
|
|
817
|
-
$table.setEditCell(row, args[1] || column);
|
|
818
|
-
} else {
|
|
819
|
-
// 兼容老版本
|
|
820
|
-
$table.setActiveCell(row, args[1] || column.field);
|
|
821
|
-
}
|
|
822
|
-
});
|
|
823
|
-
}
|
|
824
|
-
},
|
|
825
|
-
/**
|
|
826
|
-
* 插入数据并激活编辑状态
|
|
827
|
-
* @deprecated
|
|
828
|
-
*/
|
|
829
|
-
INSERT_EDIT_ROW: {
|
|
830
1011
|
menuMethod: function menuMethod(params) {
|
|
831
1012
|
var $table = params.$table,
|
|
832
1013
|
menu = params.menu,
|
|
833
1014
|
column = params.column;
|
|
834
|
-
var
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
|
|
1015
|
+
var tableProps = $table.props;
|
|
1016
|
+
var mouseConfig = tableProps.mouseConfig;
|
|
1017
|
+
var _$table$getComputeMap13 = $table.getComputeMaps(),
|
|
1018
|
+
computeMouseOpts = _$table$getComputeMap13.computeMouseOpts;
|
|
1019
|
+
var mouseOpts = computeMouseOpts.value;
|
|
1020
|
+
$table.insert(menu.params || {}).then(function (_ref7) {
|
|
1021
|
+
var rows = _ref7.rows;
|
|
1022
|
+
if (column && mouseConfig && mouseOpts.area) {
|
|
1023
|
+
$table.setCellAreas([{
|
|
1024
|
+
startRow: _xeUtils["default"].first(rows),
|
|
1025
|
+
endRow: _xeUtils["default"].last(rows),
|
|
1026
|
+
startColumn: column,
|
|
1027
|
+
endColumn: column
|
|
1028
|
+
}]);
|
|
842
1029
|
}
|
|
843
1030
|
});
|
|
844
1031
|
}
|
|
@@ -850,9 +1037,25 @@
|
|
|
850
1037
|
menuMethod: function menuMethod(params) {
|
|
851
1038
|
var $table = params.$table,
|
|
852
1039
|
menu = params.menu,
|
|
853
|
-
row = params.row
|
|
1040
|
+
row = params.row,
|
|
1041
|
+
column = params.column;
|
|
1042
|
+
var tableProps = $table.props;
|
|
1043
|
+
var mouseConfig = tableProps.mouseConfig;
|
|
1044
|
+
var _$table$getComputeMap14 = $table.getComputeMaps(),
|
|
1045
|
+
computeMouseOpts = _$table$getComputeMap14.computeMouseOpts;
|
|
1046
|
+
var mouseOpts = computeMouseOpts.value;
|
|
854
1047
|
if (row) {
|
|
855
|
-
$table.insertAt(menu.params || {}, row)
|
|
1048
|
+
$table.insertAt(menu.params || {}, row).then(function (_ref8) {
|
|
1049
|
+
var rows = _ref8.rows;
|
|
1050
|
+
if (column && mouseConfig && mouseOpts.area) {
|
|
1051
|
+
$table.setCellAreas([{
|
|
1052
|
+
startRow: _xeUtils["default"].first(rows),
|
|
1053
|
+
endRow: _xeUtils["default"].last(rows),
|
|
1054
|
+
startColumn: column,
|
|
1055
|
+
endColumn: column
|
|
1056
|
+
}]);
|
|
1057
|
+
}
|
|
1058
|
+
});
|
|
856
1059
|
}
|
|
857
1060
|
}
|
|
858
1061
|
},
|
|
@@ -863,14 +1066,30 @@
|
|
|
863
1066
|
menuMethod: function menuMethod(params) {
|
|
864
1067
|
var $table = params.$table,
|
|
865
1068
|
menu = params.menu,
|
|
866
|
-
row = params.row
|
|
1069
|
+
row = params.row,
|
|
1070
|
+
column = params.column;
|
|
1071
|
+
var tableProps = $table.props;
|
|
1072
|
+
var mouseConfig = tableProps.mouseConfig;
|
|
1073
|
+
var _$table$getComputeMap15 = $table.getComputeMaps(),
|
|
1074
|
+
computeMouseOpts = _$table$getComputeMap15.computeMouseOpts;
|
|
1075
|
+
var mouseOpts = computeMouseOpts.value;
|
|
867
1076
|
if (row) {
|
|
868
1077
|
selectMultipleRows().then(function (_ref9) {
|
|
869
1078
|
var size = _ref9.size;
|
|
870
1079
|
if (size) {
|
|
871
1080
|
$table.insertAt(_xeUtils["default"].range(0, size).map(function () {
|
|
872
1081
|
return Object.assign({}, menu.params);
|
|
873
|
-
}), row)
|
|
1082
|
+
}), row).then(function (_ref10) {
|
|
1083
|
+
var rows = _ref10.rows;
|
|
1084
|
+
if (column && mouseConfig && mouseOpts.area) {
|
|
1085
|
+
$table.setCellAreas([{
|
|
1086
|
+
startRow: _xeUtils["default"].first(rows),
|
|
1087
|
+
endRow: _xeUtils["default"].last(rows),
|
|
1088
|
+
startColumn: column,
|
|
1089
|
+
endColumn: column
|
|
1090
|
+
}]);
|
|
1091
|
+
}
|
|
1092
|
+
});
|
|
874
1093
|
}
|
|
875
1094
|
});
|
|
876
1095
|
}
|
|
@@ -883,9 +1102,25 @@
|
|
|
883
1102
|
menuMethod: function menuMethod(params) {
|
|
884
1103
|
var $table = params.$table,
|
|
885
1104
|
menu = params.menu,
|
|
886
|
-
row = params.row
|
|
1105
|
+
row = params.row,
|
|
1106
|
+
column = params.column;
|
|
1107
|
+
var tableProps = $table.props;
|
|
1108
|
+
var mouseConfig = tableProps.mouseConfig;
|
|
1109
|
+
var _$table$getComputeMap16 = $table.getComputeMaps(),
|
|
1110
|
+
computeMouseOpts = _$table$getComputeMap16.computeMouseOpts;
|
|
1111
|
+
var mouseOpts = computeMouseOpts.value;
|
|
887
1112
|
if (row) {
|
|
888
|
-
$table.insertNextAt(menu.params || {}, row)
|
|
1113
|
+
$table.insertNextAt(menu.params || {}, row).then(function (_ref11) {
|
|
1114
|
+
var rows = _ref11.rows;
|
|
1115
|
+
if (column && mouseConfig && mouseOpts.area) {
|
|
1116
|
+
$table.setCellAreas([{
|
|
1117
|
+
startRow: _xeUtils["default"].first(rows),
|
|
1118
|
+
endRow: _xeUtils["default"].last(rows),
|
|
1119
|
+
startColumn: column,
|
|
1120
|
+
endColumn: column
|
|
1121
|
+
}]);
|
|
1122
|
+
}
|
|
1123
|
+
});
|
|
889
1124
|
}
|
|
890
1125
|
}
|
|
891
1126
|
},
|
|
@@ -896,19 +1131,77 @@
|
|
|
896
1131
|
menuMethod: function menuMethod(params) {
|
|
897
1132
|
var $table = params.$table,
|
|
898
1133
|
menu = params.menu,
|
|
899
|
-
row = params.row
|
|
1134
|
+
row = params.row,
|
|
1135
|
+
column = params.column;
|
|
1136
|
+
var tableProps = $table.props;
|
|
1137
|
+
var mouseConfig = tableProps.mouseConfig;
|
|
1138
|
+
var _$table$getComputeMap17 = $table.getComputeMaps(),
|
|
1139
|
+
computeMouseOpts = _$table$getComputeMap17.computeMouseOpts;
|
|
1140
|
+
var mouseOpts = computeMouseOpts.value;
|
|
900
1141
|
if (row) {
|
|
901
|
-
selectMultipleRows().then(function (
|
|
902
|
-
var size =
|
|
1142
|
+
selectMultipleRows().then(function (_ref12) {
|
|
1143
|
+
var size = _ref12.size;
|
|
903
1144
|
if (size) {
|
|
904
1145
|
$table.insertNextAt(_xeUtils["default"].range(0, size).map(function () {
|
|
905
1146
|
return Object.assign({}, menu.params);
|
|
906
|
-
}), row)
|
|
1147
|
+
}), row).then(function (_ref13) {
|
|
1148
|
+
var rows = _ref13.rows;
|
|
1149
|
+
if (column && mouseConfig && mouseOpts.area) {
|
|
1150
|
+
$table.setCellAreas([{
|
|
1151
|
+
startRow: _xeUtils["default"].first(rows),
|
|
1152
|
+
endRow: _xeUtils["default"].last(rows),
|
|
1153
|
+
startColumn: column,
|
|
1154
|
+
endColumn: column
|
|
1155
|
+
}]);
|
|
1156
|
+
}
|
|
1157
|
+
});
|
|
907
1158
|
}
|
|
908
1159
|
});
|
|
909
1160
|
}
|
|
910
1161
|
}
|
|
911
1162
|
},
|
|
1163
|
+
/**
|
|
1164
|
+
* 插入数据并激活编辑状态
|
|
1165
|
+
* @deprecated
|
|
1166
|
+
*/
|
|
1167
|
+
INSERT_ACTIVED_ROW: {
|
|
1168
|
+
menuMethod: function menuMethod(params) {
|
|
1169
|
+
var $table = params.$table,
|
|
1170
|
+
menu = params.menu,
|
|
1171
|
+
column = params.column;
|
|
1172
|
+
var args = menu.params || []; // [{}, 'field']
|
|
1173
|
+
$table.insert(args[0] || {}).then(function (_ref14) {
|
|
1174
|
+
var row = _ref14.row;
|
|
1175
|
+
if ($table.setEditCell) {
|
|
1176
|
+
$table.setEditCell(row, args[1] || column);
|
|
1177
|
+
} else {
|
|
1178
|
+
// 兼容老版本
|
|
1179
|
+
$table.setActiveCell(row, args[1] || column.field);
|
|
1180
|
+
}
|
|
1181
|
+
});
|
|
1182
|
+
}
|
|
1183
|
+
},
|
|
1184
|
+
/**
|
|
1185
|
+
* 插入数据并激活编辑状态
|
|
1186
|
+
* @deprecated
|
|
1187
|
+
*/
|
|
1188
|
+
INSERT_EDIT_ROW: {
|
|
1189
|
+
menuMethod: function menuMethod(params) {
|
|
1190
|
+
var $table = params.$table,
|
|
1191
|
+
menu = params.menu,
|
|
1192
|
+
column = params.column;
|
|
1193
|
+
var args = menu.params || []; // [{}, 'field']
|
|
1194
|
+
$table.insert(args[0] || {}).then(function (_ref15) {
|
|
1195
|
+
var row = _ref15.row;
|
|
1196
|
+
if ($table.setEditCell) {
|
|
1197
|
+
$table.setEditCell(row, args[1] || column);
|
|
1198
|
+
} else {
|
|
1199
|
+
// 兼容老版本
|
|
1200
|
+
$table.setActiveCell(row, args[1] || column.field);
|
|
1201
|
+
}
|
|
1202
|
+
});
|
|
1203
|
+
}
|
|
1204
|
+
},
|
|
912
1205
|
/**
|
|
913
1206
|
* 插入数据到指定位置并激活编辑状态
|
|
914
1207
|
*/
|
|
@@ -920,8 +1213,8 @@
|
|
|
920
1213
|
column = params.column;
|
|
921
1214
|
if (row) {
|
|
922
1215
|
var args = menu.params || []; // [{}, 'field']
|
|
923
|
-
$table.insertAt(args[0] || {}, row).then(function (
|
|
924
|
-
var row =
|
|
1216
|
+
$table.insertAt(args[0] || {}, row).then(function (_ref16) {
|
|
1217
|
+
var row = _ref16.row;
|
|
925
1218
|
if ($table.setEditCell) {
|
|
926
1219
|
$table.setEditCell(row, args[1] || column);
|
|
927
1220
|
} else {
|
|
@@ -943,8 +1236,8 @@
|
|
|
943
1236
|
column = params.column;
|
|
944
1237
|
if (row) {
|
|
945
1238
|
var args = menu.params || []; // [{}, 'field']
|
|
946
|
-
$table.insertAt(args[0] || {}, row).then(function (
|
|
947
|
-
var row =
|
|
1239
|
+
$table.insertAt(args[0] || {}, row).then(function (_ref17) {
|
|
1240
|
+
var row = _ref17.row;
|
|
948
1241
|
if ($table.setEditCell) {
|
|
949
1242
|
$table.setEditCell(row, args[1] || column);
|
|
950
1243
|
} else {
|
|
@@ -966,13 +1259,13 @@
|
|
|
966
1259
|
column = params.column;
|
|
967
1260
|
if (row) {
|
|
968
1261
|
var args = menu.params || []; // [{}, 'field']
|
|
969
|
-
selectMultipleRows().then(function (
|
|
970
|
-
var size =
|
|
1262
|
+
selectMultipleRows().then(function (_ref18) {
|
|
1263
|
+
var size = _ref18.size;
|
|
971
1264
|
if (size) {
|
|
972
1265
|
$table.insertAt(_xeUtils["default"].range(0, size).map(function () {
|
|
973
1266
|
return Object.assign({}, args[0]);
|
|
974
|
-
}), row).then(function (
|
|
975
|
-
var row =
|
|
1267
|
+
}), row).then(function (_ref19) {
|
|
1268
|
+
var row = _ref19.row;
|
|
976
1269
|
if ($table.setEditCell) {
|
|
977
1270
|
$table.setEditCell(row, args[1] || column);
|
|
978
1271
|
} else {
|
|
@@ -996,8 +1289,8 @@
|
|
|
996
1289
|
column = params.column;
|
|
997
1290
|
if (row) {
|
|
998
1291
|
var args = menu.params || []; // [{}, 'field']
|
|
999
|
-
$table.insertNextAt(args[0] || {}, row).then(function (
|
|
1000
|
-
var row =
|
|
1292
|
+
$table.insertNextAt(args[0] || {}, row).then(function (_ref20) {
|
|
1293
|
+
var row = _ref20.row;
|
|
1001
1294
|
if ($table.setEditCell) {
|
|
1002
1295
|
$table.setEditCell(row, args[1] || column);
|
|
1003
1296
|
} else {
|
|
@@ -1019,13 +1312,13 @@
|
|
|
1019
1312
|
column = params.column;
|
|
1020
1313
|
if (row) {
|
|
1021
1314
|
var args = menu.params || []; // [{}, 'field']
|
|
1022
|
-
selectMultipleRows().then(function (
|
|
1023
|
-
var size =
|
|
1315
|
+
selectMultipleRows().then(function (_ref21) {
|
|
1316
|
+
var size = _ref21.size;
|
|
1024
1317
|
if (size) {
|
|
1025
1318
|
$table.insertNextAt(_xeUtils["default"].range(0, size).map(function () {
|
|
1026
1319
|
return Object.assign({}, args[0]);
|
|
1027
|
-
}), row).then(function (
|
|
1028
|
-
var row =
|
|
1320
|
+
}), row).then(function (_ref22) {
|
|
1321
|
+
var row = _ref22.row;
|
|
1029
1322
|
if ($table.setEditCell) {
|
|
1030
1323
|
$table.setEditCell(row, args[1] || column);
|
|
1031
1324
|
} else {
|
|
@@ -1059,8 +1352,8 @@
|
|
|
1059
1352
|
row = params.row;
|
|
1060
1353
|
var tableProps = $table.props;
|
|
1061
1354
|
var mouseConfig = tableProps.mouseConfig;
|
|
1062
|
-
var _$table$
|
|
1063
|
-
computeMouseOpts = _$table$
|
|
1355
|
+
var _$table$getComputeMap18 = $table.getComputeMaps(),
|
|
1356
|
+
computeMouseOpts = _$table$getComputeMap18.computeMouseOpts;
|
|
1064
1357
|
var mouseOpts = computeMouseOpts.value;
|
|
1065
1358
|
if (mouseConfig && mouseOpts.area) {
|
|
1066
1359
|
var cellAreas = $table.getCellAreas();
|
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","vue"],t):"undefined"!=typeof exports?t(exports,require("xe-utils"),require("vue")):(t(t={},e.XEUtils,e.Vue),e.VxeUIPluginMenu=t)})("undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:this,function(e,i,a){var s,c;Object.defineProperty(e,"__esModule",{value:!0}),e.default=e.VxeUIPluginMenu=void 0,i=(t=i)&&t.__esModule?t:{default:t};var o,g=function(e,t){return i.default.findIndexOf(e,function(e){return e.id===t.id})},h=function(e,t,n){return e.findRowIndexOf(t,n)};function n(n){return{menuMethod:function(e){var t=e.$table;i.default.eachTree([e.column],function(e){e.fixed=n}),t.refreshColumn()}}}function C(){var e=s.globalStore;return e?e.clipboard||"":(e=s.config)&&e.clipboard?e.clipboard:null}function E(e){var t,n;try{t=e,o||((o=document.createElement("textarea")).id="$XECopy",(n=o.style).width="48px",n.height="24px",n.position="fixed",n.zIndex="0",n.left="-500px",n.top="-500px",document.body.appendChild(o)),o.value=null==t?"":""+t,o.select(),o.setSelectionRange(0,o.value.length),document.execCommand("copy"),o.blur()}catch(e){}}function r(e,t){var n,a,o,r=e.$event,l=e.$table,u=e.row,e=e.column;u&&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=i.default.toValueString(i.default.get(u,e.field)),o={text:a,html:""},(t=s.globalStore)?t.clipboard=o:s.config&&(s.config.clipboard=o)),(i.default.isFunction(c)?c:E)(a))}function _(e){var i=e.$table,e=i.props.mouseConfig,t=i.getComputeMaps().computeMouseOpts.value,s=i.getTableData().visibleData,c=i.getTableColumn().visibleColumn,n=e&&t.area?i.getCellAreas():[];return i.getMergeCells().filter(function(e){var o=e.row,r=e.col,l=e.rowspan,u=e.colspan;return n.some(function(e){var t=e.rows,e=e.cols,n=h(i,s,t[0]),t=h(i,s,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+u-1<=e})})}function l(e){var t=e.$table,e=_(e);return e.length&&t.removeMergeCells(e),e}function u(e,t){var n=e.code,a=t.$table,o=t.row,r=t.column,l=t.type,u=a.props,i=u.editConfig,s=u.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=_(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=!(s&&d.area);break;case"EDIT_CELL":e.disabled=!i||!r.editRender;break;case"COPY_CELL":case"CUT_CELL":case"PASTE_CELL":var m=s&&d.area?a.getCellAreas():[];e.disabled=1<m.length,e.disabled||"PASTE_CELL"===n&&(m=C(),e.disabled=!m||!m.text);break;case"MERGE_OR_CLEAR":case"MERGE_CELL":m=s&&d.area?a.getCellAreas():[];e.disabled=!m.length||1===m.length&&1===m[0].rows.length&&1===m[0].cols.length||!((e,t)=>{for(var n=e.$table,a=n.getTableData().visibleData,o=n.getTableColumn().visibleColumn,r={},l=0,u=t.length;l<u;l++)for(var i=t[l],s=i.rows,c=i.cols,E=0,d=s.length;E<d;E++)for(var f=s[E],m=h(n,a,f),C=0,_=c.length;C<_;C++){var R=c[C],R=m+":"+g(o,R);if(r[R])return;r[R]=!0}return 1})(t,m);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 d(t){return t.options.forEach(function(e){e.forEach(function(e){u(e,t),e.children&&e.children.forEach(function(e){u(e,t)})})}),!0}function f(){return new Promise(function(t){var e,n;s.modal?(e=s.getComponent("VxeNumberInput"))?(n=(0,a.ref)(1),s.modal.alert({title:"请输入行数",width:220,maskClosable:!1,slots:{default:function(){return(0,a.h)(e,{modelValue:n.value,min:1,max:100,align:"center",style:{width:"100%"},"onUpdate:modelValue":function(e){n.value=e}})}}}).then(function(e){t("confirm"===e?{size:n.value||1}:{size:0})})):(console.error(s.getI18n("vxe.error.reqComp",["vxe-number-input"])),t({size:0})):t({size:0})})}function m(e){e&&e.copy&&(c=e.copy)}var t=e.VxeUIPluginMenu={setConfig:m,install:function(e,t){s=e,/^(4)\./.test(s.uiVersion)||console.error("[@vxe-ui/plugin-menu 4.0.9] Requires vxe-table 4.7.0++ version. https://vxeui.com/other4/#/plugin-menu/install"),m(t),s.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&&(i.default.isFunction(c)?c:E)(e)}},COPY_CELL:{menuMethod:function(e){r(e)}},CUT_CELL:{menuMethod:function(e){r(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&&i.default.set(a,e.field,o.text)}},MERGE_OR_CLEAR:{menuMethod:function(e){var t=e.$event,n=e.$table,a=n.getCellAreas(),e=_(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})?s.modal&&s.modal.message({content:s.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)}},BATCH_INSERT_AT_ROW:{menuMethod:function(e){var t=e.$table,n=e.menu,a=e.row;a&&f().then(function(e){e=e.size;e&&t.insertAt(i.default.range(0,e).map(function(){return Object.assign({},n.params)}),a)})}},INSERT_NEXT_AT_ROW:{menuMethod:function(e){var t=e.$table,n=e.row;n&&t.insertNextAt(e.menu.params||{},n)}},BATCH_INSERT_NEXT_AT_ROW:{menuMethod:function(e){var t=e.$table,n=e.menu,a=e.row;a&&f().then(function(e){e=e.size;e&&t.insertNextAt(i.default.range(0,e).map(function(){return Object.assign({},n.params)}),a)})}},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)}))}},BATCH_INSERT_AT_EDIT_ROW:{menuMethod:function(e){var t,n=e.$table,a=e.row,o=e.column;a&&(t=e.menu.params||[],f().then(function(e){e=e.size;e&&n.insertAt(i.default.range(0,e).map(function(){return Object.assign({},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_NEXT_AT_EDIT_ROW:{menuMethod:function(e){var t,n=e.$table,a=e.row,o=e.column;a&&(t=e.menu.params||[],n.insertNextAt(t[0]||{},a).then(function(e){e=e.row;n.setEditCell?n.setEditCell(e,t[1]||o):n.setActiveCell(e,t[1]||o.field)}))}},BATCH_INSERT_NEXT_AT_EDIT_ROW:{menuMethod:function(e){var t,n=e.$table,a=e.row,o=e.column;a&&(t=e.menu.params||[],f().then(function(e){e=e.size;e&&n.insertNextAt(i.default.range(0,e).map(function(){return Object.assign({},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=i.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(i.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(i.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(i.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)}}}),s.interceptor.add("event.showMenu",d)}};"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","vue"],t):"undefined"!=typeof exports?t(exports,require("xe-utils"),require("vue")):(t(t={},e.XEUtils,e.Vue),e.VxeUIPluginMenu=t)})("undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:this,function(e,u,n){var i,c;Object.defineProperty(e,"__esModule",{value:!0}),e.default=e.VxeUIPluginMenu=void 0,u=(t=u)&&t.__esModule?t:{default:t};var o,_=function(e,t){return u.default.findIndexOf(e,function(e){return e.id===t.id})},g=function(e,t,a){return e.findRowIndexOf(t,a)};function a(a){return{menuMethod:function(e){var t=e.$table;u.default.eachTree([e.column],function(e){e.fixed=a}),t.refreshColumn()}}}function C(){var e=i.globalStore;return e?e.clipboard||"":(e=i.config)&&e.clipboard?e.clipboard:null}function d(e){var t,a;try{t=e,o||((o=document.createElement("textarea")).id="$XECopy",(a=o.style).width="48px",a.height="24px",a.position="fixed",a.zIndex="0",a.left="-500px",a.top="-500px",document.body.appendChild(o)),o.value=null==t?"":""+t,o.select(),o.setSelectionRange(0,o.value.length),document.execCommand("copy"),o.blur()}catch(e){}}function l(e,t){var a,n,o,l=e.$event,r=e.$table,s=e.row,e=e.column;s&&e&&(a=r.props.mouseConfig,o=r.getComputeMaps().computeMouseOpts.value,n="",a&&o.area?(t?r.triggerCutCellAreaEvent(l):r.triggerCopyCellAreaEvent(l),n=(a=C())?a.text:""):(n=u.default.toValueString(u.default.get(s,e.field)),o={text:n,html:""},(t=i.globalStore)?t.clipboard=o:i.config&&(i.config.clipboard=o)),(u.default.isFunction(c)?c:d)(n))}function p(e){var u=e.$table,e=u.props.mouseConfig,t=u.getComputeMaps().computeMouseOpts.value,i=u.getTableData().visibleData,c=u.getTableColumn().visibleColumn,a=e&&t.area?u.getCellAreas():[];return u.getMergeCells().filter(function(e){var o=e.row,l=e.col,r=e.rowspan,s=e.colspan;return a.some(function(e){var t=e.rows,e=e.cols,a=g(u,i,t[0]),t=g(u,i,t[t.length-1]),n=_(c,e[0]),e=_(c,e[e.length-1]);return a<=o&&o+r-1<=t&&n<=l&&l+s-1<=e})})}function r(e){var t=e.$table,e=p(e);return e.length&&t.removeMergeCells(e),e}function s(e,t){var a=e.code,n=t.$table,o=t.row,l=t.column,r=t.type,s=n.props,u=s.editConfig,i=s.mouseConfig;switch(a){case"CLEAR_ALL_SORT":var c=n.getSortColumns();e.disabled=!c.length;break;case"CLEAR_ALL_FILTER":c=n.getCheckedFilters();e.disabled=!c.length;break;case"CLEAR_ALL_MERGE":var c=n.getMergeCells(),d=n.getMergeFooterItems();e.disabled=!c.length&&!d.length;break;case"CLEAR_MERGE_CELL":c=p(t);e.disabled=!c.length;break;case"COPY_TITLE":e.disabled=!l||"header"!==r;break;case"SELECT_ALL_AREA":d=n.getTableData().visibleData,c=n.getTableColumn().visibleColumn;e.disabled=!(d.length||c.length);break;case"SELECT_AREA_TO_LEFT":case"SELECT_AREA_TO_RIGHT":case"SELECT_AREA_TO_TOP":case"SELECT_AREA_TO_BOTTON":e.disabled=!l||!o;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=!l,l){var m=n.getComputeMaps().computeMouseOpts.value,f=!!l.parentId;switch(a){case"CLEAR_SORT":e.disabled=!l.sortable||!l.order;break;case"SORT_ASC":case"SORT_DESC":e.disabled=!l.sortable;break;case"FILTER_CELL":case"CLEAR_FILTER":e.disabled=!l.filters||!l.filters.length,e.disabled||"CLEAR_FILTER"===a&&(e.disabled=!l.filters.some(function(e){return e.checked}));break;case"REVERT_CELL":e.disabled=!o||!l.field||!n.isUpdateByRow(o,l.field);break;case"REVERT_ROW":e.disabled=!o||!l.field||!n.isUpdateByRow(o);break;case"OPEN_FIND":case"OPEN_REPLACE":e.disabled=!(i&&m.area);break;case"EDIT_CELL":e.disabled=!u||!l.editRender;break;case"COPY_CELL":case"CUT_CELL":case"PASTE_CELL":var E=i&&m.area?n.getCellAreas():[];e.disabled=1<E.length,e.disabled||"PASTE_CELL"===a&&(E=C(),e.disabled=!E||!E.text);break;case"MERGE_OR_CLEAR":case"MERGE_CELL":E=i&&m.area?n.getCellAreas():[];e.disabled=!E.length||1===E.length&&1===E[0].rows.length&&1===E[0].cols.length||!((e,t)=>{for(var a=e.$table,n=a.getTableData().visibleData,o=a.getTableColumn().visibleColumn,l={},r=0,s=t.length;r<s;r++)for(var u=t[r],i=u.rows,c=u.cols,d=0,m=i.length;d<m;d++)for(var f=i[d],E=g(a,n,f),C=0,p=c.length;C<p;C++){var R=c[C],R=E+":"+_(o,R);if(l[R])return;l[R]=!0}return 1})(t,E);break;case"FIXED_LEFT_COLUMN":e.disabled=f||"left"===l.fixed;break;case"FIXED_RIGHT_COLUMN":e.disabled=f||"right"===l.fixed;break;case"CLEAR_FIXED_COLUMN":e.disabled=f||!l.fixed}}}}function m(t){return t.options.forEach(function(e){e.forEach(function(e){s(e,t),e.children&&e.children.forEach(function(e){s(e,t)})})}),!0}function f(){return new Promise(function(t){var e,a;i.modal?(e=i.getComponent("VxeNumberInput"))?(a=(0,n.ref)(1),i.modal.alert({title:"请输入行数",width:220,maskClosable:!1,slots:{default:function(){return(0,n.h)(e,{modelValue:a.value,min:1,max:100,align:"center",controlConfig:{layout:"default"},style:{width:"100%"},"onUpdate:modelValue":function(e){a.value=e}})}}}).then(function(e){t("confirm"===e?{size:a.value||1}:{size:0})})):(console.error(i.getI18n("vxe.error.reqComp",["vxe-number-input"])),t({size:0})):t({size:0})})}function E(e){e&&e.copy&&(c=e.copy)}var t=e.VxeUIPluginMenu={setConfig:E,install:function(e,t){i=e,/^(4)\./.test(i.uiVersion)||console.error("[@vxe-ui/plugin-menu 4.0.11] Requires vxe-table 4.7.0+ version. https://vxeui.com/other4/#/plugin-menu/install"),E(t),i.menus.mixin({CLEAR_CELL:{menuMethod:function(e){var t,a,n=e.$table,o=e.row,e=e.column;o&&e&&(a=n.props.mouseConfig,t=n.getComputeMaps().computeMouseOpts.value,a&&t.area?(a=n.getCellAreas())&&a.length&&a.forEach(function(e){var a=e.rows;e.cols.forEach(function(t){a.forEach(function(e){n.clearData(e,t.field)})})}):n.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,a=e.row,e=e.column,n=t.props.mouseConfig,o=t.getComputeMaps().computeMouseOpts.value;n&&o.area?(n&&o.area?t.getCellAreas():[]).forEach(function(e){e=e.rows;t.clearData(e)}):a&&e&&t.clearData(a)}},CLEAR_ALL:{menuMethod:function(e){e.$table.clearData()}},SELECT_ALL_AREA:{menuMethod:function(e){var e=e.$table,t=e.props.mouseConfig,a=e.getComputeMaps().computeMouseOpts.value;t&&a.area&&(t=e.getTableData().visibleData,a=e.getTableColumn().visibleColumn,e.setCellAreas([{startRow:u.default.first(t),endRow:u.default.last(t),startColumn:u.default.first(a),endColumn:u.default.last(a)}]))}},SELECT_AREA_TO_LEFT:{menuMethod:function(e){var t=e.$table,a=e.row,e=e.column,n=t.props.mouseConfig,o=t.getComputeMaps().computeMouseOpts.value;a&&e&&n&&o.area&&(n=t.getTableColumn().visibleColumn,1===(o=t.getCellAreas()).length?(o=o[0],t.setCellAreas([{startRow:u.default.first(o.rows),endRow:u.default.last(o.rows),startColumn:u.default.first(n),endColumn:u.default.last(o.cols)}],{column:e,row:a})):t.setCellAreas([{startRow:a,endRow:a,startColumn:u.default.first(n),endColumn:e}],{column:e,row:a}))}},SELECT_AREA_TO_RIGHT:{menuMethod:function(e){var t=e.$table,a=e.row,e=e.column,n=t.props.mouseConfig,o=t.getComputeMaps().computeMouseOpts.value;a&&e&&n&&o.area&&(n=t.getTableColumn().visibleColumn,1===(o=t.getCellAreas()).length?(o=o[0],t.setCellAreas([{startRow:u.default.first(o.rows),endRow:u.default.last(o.rows),startColumn:u.default.first(o.cols),endColumn:u.default.last(n)}],{column:e,row:a})):t.setCellAreas([{startRow:a,endRow:a,startColumn:e,endColumn:u.default.last(n)}],{column:e,row:a}))}},SELECT_AREA_TO_TOP:{menuMethod:function(e){var t=e.$table,a=e.row,e=e.column,n=t.props.mouseConfig,o=t.getComputeMaps().computeMouseOpts.value;a&&e&&n&&o.area&&(n=t.getTableData().visibleData,1===(o=t.getCellAreas()).length?(o=o[0],t.setCellAreas([{startRow:u.default.first(n),endRow:u.default.last(o.rows),startColumn:u.default.first(o.cols),endColumn:u.default.last(o.cols)}],{column:e,row:a})):t.setCellAreas([{startRow:u.default.first(n),endRow:a,startColumn:e,endColumn:e}],{column:e,row:a}))}},SELECT_AREA_TO_BOTTON:{menuMethod:function(e){var t=e.$table,a=e.row,e=e.column,n=t.props.mouseConfig,o=t.getComputeMaps().computeMouseOpts.value;a&&e&&n&&o.area&&(n=t.getTableData().visibleData,1===(o=t.getCellAreas()).length?(o=o[0],t.setCellAreas([{startRow:u.default.first(o.rows),endRow:u.default.last(n),startColumn:u.default.first(o.cols),endColumn:u.default.last(o.cols)}],{column:e,row:a})):t.setCellAreas([{startRow:a,endRow:u.default.last(n),startColumn:e,endColumn:e}],{column:e,row:a}))}},REVERT_CELL:{menuMethod:function(e){var t,a,n=e.$table,o=e.row,e=e.column;o&&e&&(a=n.props.mouseConfig,t=n.getComputeMaps().computeMouseOpts.value,a&&t.area?(a=n.getCellAreas())&&a.length&&a.forEach(function(e){var a=e.rows;e.cols.forEach(function(t){a.forEach(function(e){n.revertData(e,t.field)})})}):n.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:d)(e)}},COPY_CELL:{menuMethod:function(e){l(e)}},CUT_CELL:{menuMethod:function(e){l(e,!0)}},PASTE_CELL:{menuMethod:function(e){var t=e.$event,a=e.$table,n=e.row,e=e.column,o=a.props.mouseConfig,l=a.getComputeMaps().computeMouseOpts.value;o&&l.area?a.triggerPasteCellAreaEvent(t):(o=C())&&o.text&&u.default.set(n,e.field,o.text)}},MERGE_OR_CLEAR:{menuMethod:function(e){var t=e.$event,a=e.$table,n=a.getCellAreas(),e=p(e),o=!1,e=(e.length?a.removeMergeCells(e):(o=!0,a.setMergeCells(n.map(function(e){var t=e.rows,e=e.cols;return{row:t[0],col:e[0],rowspan:t.length,colspan:e.length}}))),n.map(function(e){return{rows:e.rows,cols:e.cols}}));a.dispatchEvent("cell-area-merge",{status:o,targetAreas:e},t)}},MERGE_CELL:{menuMethod:function(e){var t=e.$event,a=e.$table,n=a.getTableData().visibleData,o=a.getTableColumn().visibleColumn,l=a.getCellAreas();r(e),l.some(function(e){return e.rows.length===n.length||e.cols.length===o.length})?i.modal&&i.modal.message({content:i.getI18n("vxe.pro.area.mergeErr"),status:"error",id:"operErr"}):(a.setMergeCells(l.map(function(e){var t=e.rows,e=e.cols;return{row:t[0],col:e[0],rowspan:t.length,colspan:e.length}})),e=l.map(function(e){return{rows:e.rows,cols:e.cols}}),a.dispatchEvent("cell-area-merge",{status:!0,targetAreas:e},t))}},CLEAR_MERGE_CELL:{menuMethod:function(e){var t=e.$event,a=e.$table,e=r(e);e.length&&a.dispatchEvent("clear-cell-area-merge",{mergeCells:e},t)}},CLEAR_ALL_MERGE:{menuMethod:function(e){var t=e.$event,e=e.$table,a=e.getMergeCells(),n=e.getMergeFooterItems();e.clearMergeCells(),e.clearMergeFooterItems(),e.dispatchEvent("clear-merge",{mergeCells:a,mergeFooterItems:n},t)}},EDIT_CELL:{menuMethod:function(e){var t=e.$table,a=e.row,e=e.column;t.setEditCell?t.setEditCell(a,e):t.setActiveCell(a,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){var t=e.$table,a=e.menu,n=e.column,o=t.props.mouseConfig,l=t.getComputeMaps().computeMouseOpts.value;t.insert(a.params||{}).then(function(e){e=e.rows;n&&o&&l.area&&t.setCellAreas([{startRow:u.default.first(e),endRow:u.default.last(e),startColumn:n,endColumn:n}])})}},INSERT_AT_ROW:{menuMethod:function(e){var t=e.$table,a=e.menu,n=e.row,o=e.column,l=t.props.mouseConfig,r=t.getComputeMaps().computeMouseOpts.value;n&&t.insertAt(a.params||{},n).then(function(e){e=e.rows;o&&l&&r.area&&t.setCellAreas([{startRow:u.default.first(e),endRow:u.default.last(e),startColumn:o,endColumn:o}])})}},BATCH_INSERT_AT_ROW:{menuMethod:function(e){var t=e.$table,a=e.menu,n=e.row,o=e.column,l=t.props.mouseConfig,r=t.getComputeMaps().computeMouseOpts.value;n&&f().then(function(e){e=e.size;e&&t.insertAt(u.default.range(0,e).map(function(){return Object.assign({},a.params)}),n).then(function(e){e=e.rows;o&&l&&r.area&&t.setCellAreas([{startRow:u.default.first(e),endRow:u.default.last(e),startColumn:o,endColumn:o}])})})}},INSERT_NEXT_AT_ROW:{menuMethod:function(e){var t=e.$table,a=e.menu,n=e.row,o=e.column,l=t.props.mouseConfig,r=t.getComputeMaps().computeMouseOpts.value;n&&t.insertNextAt(a.params||{},n).then(function(e){e=e.rows;o&&l&&r.area&&t.setCellAreas([{startRow:u.default.first(e),endRow:u.default.last(e),startColumn:o,endColumn:o}])})}},BATCH_INSERT_NEXT_AT_ROW:{menuMethod:function(e){var t=e.$table,a=e.menu,n=e.row,o=e.column,l=t.props.mouseConfig,r=t.getComputeMaps().computeMouseOpts.value;n&&f().then(function(e){e=e.size;e&&t.insertNextAt(u.default.range(0,e).map(function(){return Object.assign({},a.params)}),n).then(function(e){e=e.rows;o&&l&&r.area&&t.setCellAreas([{startRow:u.default.first(e),endRow:u.default.last(e),startColumn:o,endColumn:o}])})})}},INSERT_ACTIVED_ROW:{menuMethod:function(e){var t=e.$table,a=e.column,n=e.menu.params||[];t.insert(n[0]||{}).then(function(e){e=e.row;t.setEditCell?t.setEditCell(e,n[1]||a):t.setActiveCell(e,n[1]||a.field)})}},INSERT_EDIT_ROW:{menuMethod:function(e){var t=e.$table,a=e.column,n=e.menu.params||[];t.insert(n[0]||{}).then(function(e){e=e.row;t.setEditCell?t.setEditCell(e,n[1]||a):t.setActiveCell(e,n[1]||a.field)})}},INSERT_AT_ACTIVED_ROW:{menuMethod:function(e){var t,a=e.$table,n=e.row,o=e.column;n&&(t=e.menu.params||[],a.insertAt(t[0]||{},n).then(function(e){e=e.row;a.setEditCell?a.setEditCell(e,t[1]||o):a.setActiveCell(e,t[1]||o.field)}))}},INSERT_AT_EDIT_ROW:{menuMethod:function(e){var t,a=e.$table,n=e.row,o=e.column;n&&(t=e.menu.params||[],a.insertAt(t[0]||{},n).then(function(e){e=e.row;a.setEditCell?a.setEditCell(e,t[1]||o):a.setActiveCell(e,t[1]||o.field)}))}},BATCH_INSERT_AT_EDIT_ROW:{menuMethod:function(e){var t,a=e.$table,n=e.row,o=e.column;n&&(t=e.menu.params||[],f().then(function(e){e=e.size;e&&a.insertAt(u.default.range(0,e).map(function(){return Object.assign({},t[0])}),n).then(function(e){e=e.row;a.setEditCell?a.setEditCell(e,t[1]||o):a.setActiveCell(e,t[1]||o.field)})}))}},INSERT_NEXT_AT_EDIT_ROW:{menuMethod:function(e){var t,a=e.$table,n=e.row,o=e.column;n&&(t=e.menu.params||[],a.insertNextAt(t[0]||{},n).then(function(e){e=e.row;a.setEditCell?a.setEditCell(e,t[1]||o):a.setActiveCell(e,t[1]||o.field)}))}},BATCH_INSERT_NEXT_AT_EDIT_ROW:{menuMethod:function(e){var t,a=e.$table,n=e.row,o=e.column;n&&(t=e.menu.params||[],f().then(function(e){e=e.size;e&&a.insertNextAt(u.default.range(0,e).map(function(){return Object.assign({},t[0])}),n).then(function(e){e=e.row;a.setEditCell?a.setEditCell(e,t[1]||o):a.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,a=t.props.mouseConfig,n=t.getComputeMaps().computeMouseOpts.value;a&&n.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,a=e.$table,e=e.column;e&&a.triggerSortEvent(t,e,null)}},CLEAR_ALL_SORT:{menuMethod:function(e){var t=e.$event,e=e.$table,a=e.getSortColumns();a.length&&(e.clearSort(),e.dispatchEvent("clear-sort",{sortList:a},t))}},SORT_ASC:{menuMethod:function(e){var t=e.$event,a=e.$table,e=e.column;e&&a.triggerSortEvent(t,e,"asc")}},SORT_DESC:{menuMethod:function(e){var t=e.$event,a=e.$table,e=e.column;e&&a.triggerSortEvent(t,e,"desc")}},CLEAR_FILTER:{menuMethod:function(e){var t=e.$event,a=e.$table,e=e.column;e&&(a.handleClearFilter(e),a.confirmFilterEvent(t))}},CLEAR_ALL_FILTER:{menuMethod:function(e){var t=e.$event,e=e.$table,a=e.getCheckedFilters();a.length&&(e.clearFilter(),e.dispatchEvent("clear-filter",{filterList:a},t))}},FILTER_CELL:{menuMethod:function(e){var t,a=e.$table,n=e.row,e=e.column;n&&e&&(t=e.field,(e=e.filters).length)&&((e=e[0]).data=u.default.get(n,t),e.checked=!0,a.updateData())}},EXPORT_ROW:{menuMethod:function(e){var t=e.$table,a=e.menu,e=e.row;e&&t.exportData(u.default.assign({},a.params?a.params[0]:{},{data:[e]}))}},EXPORT_CHECKBOX_ROW:{menuMethod:function(e){var t=e.$table,e=e.menu,a={data:t.getCheckboxRecords()};t.exportData(u.default.assign({},e.params?e.params[0]:{},a))}},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,a={data:t.getCheckboxRecords()};t.print(u.default.assign(a,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:a("left"),FIXED_RIGHT_COLUMN:a("right"),CLEAR_FIXED_COLUMN:a(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",m)}};"undefined"!=typeof window&&window.VxeUI&&window.VxeUI.use&&window.VxeUI.use(t),e.default=t});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vxe-ui/plugin-menu",
|
|
3
|
-
"version": "4.0.
|
|
3
|
+
"version": "4.0.11",
|
|
4
4
|
"description": "Vxe UI plug-in supports context menu.",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"lib": "gulp build"
|
|
@@ -51,8 +51,8 @@
|
|
|
51
51
|
"sass": "^1.55.0",
|
|
52
52
|
"typescript": "~4.7.4",
|
|
53
53
|
"vue": "3.4.27",
|
|
54
|
-
"vxe-pc-ui": "^4.
|
|
55
|
-
"vxe-table": "^4.
|
|
54
|
+
"vxe-pc-ui": "^4.7.0",
|
|
55
|
+
"vxe-table": "^4.14.0"
|
|
56
56
|
},
|
|
57
57
|
"repository": {
|
|
58
58
|
"type": "git",
|