@vxe-ui/plugin-menu 4.3.2 → 4.4.0
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/dist/index.umd.js +134 -52
- package/dist/index.umd.min.js +1 -1
- package/es/index.esm.js +101 -26
- package/es/index.js +101 -26
- package/lib/index.common.js +134 -52
- package/lib/index.js +134 -52
- package/lib/index.umd.js +134 -52
- package/lib/index.umd.min.js +1 -1
- package/package.json +17 -18
- package/src/index.ts +100 -24
package/dist/index.umd.js
CHANGED
|
@@ -21,11 +21,21 @@
|
|
|
21
21
|
value: true
|
|
22
22
|
});
|
|
23
23
|
exports["default"] = exports.VxeUIPluginMenu = void 0;
|
|
24
|
+
exports.hasEnableConf = hasEnableConf;
|
|
24
25
|
var _xeUtils = _interopRequireDefault(require$$0);
|
|
25
26
|
var _vue = require$$1;
|
|
26
27
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { "default": e }; }
|
|
27
28
|
var VxeUI;
|
|
28
29
|
var handleCopy;
|
|
30
|
+
/**
|
|
31
|
+
* 用于开关类型的配置项
|
|
32
|
+
* 局部启用规则:conf={}
|
|
33
|
+
* 局部禁用规则:conf={enabled:false}
|
|
34
|
+
* 全局默认启用规则:conf.enabled=true
|
|
35
|
+
*/
|
|
36
|
+
function hasEnableConf(conf, opts) {
|
|
37
|
+
return opts && (conf ? opts.enabled !== false : opts.enabled);
|
|
38
|
+
}
|
|
29
39
|
var columnIndexOf = function columnIndexOf(cols, column) {
|
|
30
40
|
return _xeUtils["default"].findIndexOf(cols, function (item) {
|
|
31
41
|
return item.id === column.id;
|
|
@@ -105,8 +115,8 @@
|
|
|
105
115
|
var _$table$getComputeMap = $table.getComputeMaps(),
|
|
106
116
|
computeMouseOpts = _$table$getComputeMap.computeMouseOpts;
|
|
107
117
|
var mouseOpts = computeMouseOpts.value;
|
|
108
|
-
var text
|
|
109
|
-
if (mouseConfig && mouseOpts.area) {
|
|
118
|
+
var text;
|
|
119
|
+
if (hasEnableConf(mouseConfig, mouseOpts) && mouseOpts.area) {
|
|
110
120
|
if (isCut) {
|
|
111
121
|
$table.triggerCutCellAreaEvent($event);
|
|
112
122
|
} else {
|
|
@@ -176,7 +186,7 @@
|
|
|
176
186
|
visibleData = _$table$getTableData2.visibleData;
|
|
177
187
|
var _$table$getTableColum2 = $table.getTableColumn(),
|
|
178
188
|
visibleColumn = _$table$getTableColum2.visibleColumn;
|
|
179
|
-
var cellAreas = mouseConfig && mouseOpts.area ? $table.getCellAreas() : [];
|
|
189
|
+
var cellAreas = hasEnableConf(mouseConfig, mouseOpts) && mouseOpts.area ? $table.getCellAreas() : [];
|
|
180
190
|
var mergeList = $table.getMergeCells();
|
|
181
191
|
return mergeList.filter(function (_ref) {
|
|
182
192
|
var mergeRowIndex = _ref.row,
|
|
@@ -268,10 +278,14 @@
|
|
|
268
278
|
}
|
|
269
279
|
case 'EDIT_CELL':
|
|
270
280
|
case 'CLEAR_CELL':
|
|
281
|
+
case 'CLEAR_AREA_CELL':
|
|
271
282
|
case 'CLEAR_ROW':
|
|
272
283
|
case 'COPY_CELL':
|
|
284
|
+
case 'COPY_AREA_CELL':
|
|
273
285
|
case 'CUT_CELL':
|
|
286
|
+
case 'CUT_AREA_CELL':
|
|
274
287
|
case 'PASTE_CELL':
|
|
288
|
+
case 'PASTE_AREA_CELL':
|
|
275
289
|
case 'MERGE_OR_CLEAR':
|
|
276
290
|
case 'MERGE_CELL':
|
|
277
291
|
case 'REVERT_CELL':
|
|
@@ -333,7 +347,7 @@
|
|
|
333
347
|
case 'OPEN_FIND':
|
|
334
348
|
case 'OPEN_REPLACE':
|
|
335
349
|
{
|
|
336
|
-
item.disabled = !(mouseConfig && mouseOpts.area);
|
|
350
|
+
item.disabled = !(hasEnableConf(mouseConfig, mouseOpts) && mouseOpts.area);
|
|
337
351
|
break;
|
|
338
352
|
}
|
|
339
353
|
case 'EDIT_CELL':
|
|
@@ -342,14 +356,18 @@
|
|
|
342
356
|
break;
|
|
343
357
|
}
|
|
344
358
|
case 'COPY_CELL':
|
|
359
|
+
case 'COPY_AREA_CELL':
|
|
345
360
|
case 'CUT_CELL':
|
|
361
|
+
case 'CUT_AREA_CELL':
|
|
346
362
|
case 'PASTE_CELL':
|
|
363
|
+
case 'PASTE_AREA_CELL':
|
|
347
364
|
{
|
|
348
|
-
var cellAreas = mouseConfig && mouseOpts.area ? $table.getCellAreas() : [];
|
|
365
|
+
var cellAreas = hasEnableConf(mouseConfig, mouseOpts) && mouseOpts.area ? $table.getCellAreas() : [];
|
|
349
366
|
item.disabled = cellAreas.length > 1;
|
|
350
367
|
if (!item.disabled) {
|
|
351
368
|
switch (code) {
|
|
352
369
|
case 'PASTE_CELL':
|
|
370
|
+
case 'PASTE_AREA_CELL':
|
|
353
371
|
{
|
|
354
372
|
var clipboard = getClipboardObj();
|
|
355
373
|
item.disabled = !clipboard || !clipboard.text;
|
|
@@ -362,7 +380,7 @@
|
|
|
362
380
|
case 'MERGE_OR_CLEAR':
|
|
363
381
|
case 'MERGE_CELL':
|
|
364
382
|
{
|
|
365
|
-
var _cellAreas = mouseConfig && mouseOpts.area ? $table.getCellAreas() : [];
|
|
383
|
+
var _cellAreas = hasEnableConf(mouseConfig, mouseOpts) && mouseOpts.area ? $table.getCellAreas() : [];
|
|
366
384
|
item.disabled = !_cellAreas.length || _cellAreas.length === 1 && _cellAreas[0].rows.length === 1 && _cellAreas[0].cols.length === 1 || !checkCellOverlay(params, _cellAreas);
|
|
367
385
|
break;
|
|
368
386
|
}
|
|
@@ -492,11 +510,11 @@
|
|
|
492
510
|
var pVersion = 4;
|
|
493
511
|
var sVersion = 11;
|
|
494
512
|
if (!VxeUI.checkVersion(VxeUI.tableVersion, pVersion, sVersion)) {
|
|
495
|
-
console.error("[@vxe-ui/plugin-menu 4.
|
|
513
|
+
console.error("[@vxe-ui/plugin-menu 4.4.0] ".concat(VxeUI.getI18n('vxe.error.errorVersion', ["vxe-table@".concat(VxeUI.tableVersion || '?'), "vxe-table v".concat(pVersion, ".").concat(sVersion, "+")]), " https://vxeui.com/other4/#/plugin-menu/install"));
|
|
496
514
|
}
|
|
497
515
|
} else {
|
|
498
516
|
if (!/^(4)\./.test(VxeUI.uiVersion || VxeUI.tableVersion)) {
|
|
499
|
-
console.error('[@vxe-ui/plugin-menu 4.
|
|
517
|
+
console.error('[@vxe-ui/plugin-menu 4.4.0] Requires vxe-table 4.7.0+ version. https://vxeui.com/other4/#/plugin-menu/install');
|
|
500
518
|
}
|
|
501
519
|
}
|
|
502
520
|
pluginSetup(options);
|
|
@@ -545,7 +563,7 @@
|
|
|
545
563
|
var _$table$getComputeMap4 = $table.getComputeMaps(),
|
|
546
564
|
computeMouseOpts = _$table$getComputeMap4.computeMouseOpts;
|
|
547
565
|
var mouseOpts = computeMouseOpts.value;
|
|
548
|
-
if (mouseConfig && mouseOpts.area) {
|
|
566
|
+
if (hasEnableConf(mouseConfig, mouseOpts) && mouseOpts.area) {
|
|
549
567
|
var cellAreas = $table.getCellAreas();
|
|
550
568
|
if (cellAreas && cellAreas.length) {
|
|
551
569
|
cellAreas.forEach(function (areaItem) {
|
|
@@ -564,6 +582,37 @@
|
|
|
564
582
|
}
|
|
565
583
|
}
|
|
566
584
|
},
|
|
585
|
+
/**
|
|
586
|
+
* 用于 mouse-config.area 功能,清除区域范围内的单元格数据
|
|
587
|
+
*/
|
|
588
|
+
CLEAR_AREA_CELL: {
|
|
589
|
+
tableMenuMethod: function tableMenuMethod(params) {
|
|
590
|
+
var $table = params.$table,
|
|
591
|
+
row = params.row,
|
|
592
|
+
column = params.column;
|
|
593
|
+
if (row && column) {
|
|
594
|
+
var tableProps = $table.props;
|
|
595
|
+
var mouseConfig = tableProps.mouseConfig;
|
|
596
|
+
var _$table$getComputeMap5 = $table.getComputeMaps(),
|
|
597
|
+
computeMouseOpts = _$table$getComputeMap5.computeMouseOpts;
|
|
598
|
+
var mouseOpts = computeMouseOpts.value;
|
|
599
|
+
if (hasEnableConf(mouseConfig, mouseOpts) && mouseOpts.area) {
|
|
600
|
+
var cellAreas = $table.getCellAreas();
|
|
601
|
+
if (cellAreas && cellAreas.length) {
|
|
602
|
+
cellAreas.forEach(function (areaItem) {
|
|
603
|
+
var rows = areaItem.rows,
|
|
604
|
+
cols = areaItem.cols;
|
|
605
|
+
cols.forEach(function (column) {
|
|
606
|
+
rows.forEach(function (row) {
|
|
607
|
+
$table.clearData(row, column.field);
|
|
608
|
+
});
|
|
609
|
+
});
|
|
610
|
+
});
|
|
611
|
+
}
|
|
612
|
+
}
|
|
613
|
+
}
|
|
614
|
+
}
|
|
615
|
+
},
|
|
567
616
|
/**
|
|
568
617
|
* 清除行数据的值
|
|
569
618
|
*/
|
|
@@ -595,11 +644,11 @@
|
|
|
595
644
|
column = params.column;
|
|
596
645
|
var tableProps = $table.props;
|
|
597
646
|
var mouseConfig = tableProps.mouseConfig;
|
|
598
|
-
var _$table$
|
|
599
|
-
computeMouseOpts = _$table$
|
|
647
|
+
var _$table$getComputeMap6 = $table.getComputeMaps(),
|
|
648
|
+
computeMouseOpts = _$table$getComputeMap6.computeMouseOpts;
|
|
600
649
|
var mouseOpts = computeMouseOpts.value;
|
|
601
|
-
if (mouseConfig && mouseOpts.area) {
|
|
602
|
-
var cellAreas =
|
|
650
|
+
if (hasEnableConf(mouseConfig, mouseOpts) && mouseOpts.area) {
|
|
651
|
+
var cellAreas = mouseOpts.area ? $table.getCellAreas() : [];
|
|
603
652
|
cellAreas.forEach(function (areaItem) {
|
|
604
653
|
var rows = areaItem.rows;
|
|
605
654
|
$table.clearData(rows);
|
|
@@ -628,10 +677,10 @@
|
|
|
628
677
|
var $table = params.$table;
|
|
629
678
|
var tableProps = $table.props;
|
|
630
679
|
var mouseConfig = tableProps.mouseConfig;
|
|
631
|
-
var _$table$
|
|
632
|
-
computeMouseOpts = _$table$
|
|
680
|
+
var _$table$getComputeMap7 = $table.getComputeMaps(),
|
|
681
|
+
computeMouseOpts = _$table$getComputeMap7.computeMouseOpts;
|
|
633
682
|
var mouseOpts = computeMouseOpts.value;
|
|
634
|
-
if (mouseConfig && mouseOpts.area) {
|
|
683
|
+
if (hasEnableConf(mouseConfig, mouseOpts) && mouseOpts.area) {
|
|
635
684
|
var _$table$getTableData4 = $table.getTableData(),
|
|
636
685
|
visibleData = _$table$getTableData4.visibleData;
|
|
637
686
|
var _$table$getTableColum4 = $table.getTableColumn(),
|
|
@@ -655,10 +704,10 @@
|
|
|
655
704
|
column = params.column;
|
|
656
705
|
var tableProps = $table.props;
|
|
657
706
|
var mouseConfig = tableProps.mouseConfig;
|
|
658
|
-
var _$table$
|
|
659
|
-
computeMouseOpts = _$table$
|
|
707
|
+
var _$table$getComputeMap8 = $table.getComputeMaps(),
|
|
708
|
+
computeMouseOpts = _$table$getComputeMap8.computeMouseOpts;
|
|
660
709
|
var mouseOpts = computeMouseOpts.value;
|
|
661
|
-
if (row && column && mouseConfig && mouseOpts.area) {
|
|
710
|
+
if (row && column && hasEnableConf(mouseConfig, mouseOpts) && mouseOpts.area) {
|
|
662
711
|
var _$table$getTableColum5 = $table.getTableColumn(),
|
|
663
712
|
visibleColumn = _$table$getTableColum5.visibleColumn;
|
|
664
713
|
var cellAreas = $table.getCellAreas();
|
|
@@ -697,10 +746,10 @@
|
|
|
697
746
|
column = params.column;
|
|
698
747
|
var tableProps = $table.props;
|
|
699
748
|
var mouseConfig = tableProps.mouseConfig;
|
|
700
|
-
var _$table$
|
|
701
|
-
computeMouseOpts = _$table$
|
|
749
|
+
var _$table$getComputeMap9 = $table.getComputeMaps(),
|
|
750
|
+
computeMouseOpts = _$table$getComputeMap9.computeMouseOpts;
|
|
702
751
|
var mouseOpts = computeMouseOpts.value;
|
|
703
|
-
if (row && column && mouseConfig && mouseOpts.area) {
|
|
752
|
+
if (row && column && hasEnableConf(mouseConfig, mouseOpts) && mouseOpts.area) {
|
|
704
753
|
var _$table$getTableColum6 = $table.getTableColumn(),
|
|
705
754
|
visibleColumn = _$table$getTableColum6.visibleColumn;
|
|
706
755
|
var cellAreas = $table.getCellAreas();
|
|
@@ -739,10 +788,10 @@
|
|
|
739
788
|
column = params.column;
|
|
740
789
|
var tableProps = $table.props;
|
|
741
790
|
var mouseConfig = tableProps.mouseConfig;
|
|
742
|
-
var _$table$
|
|
743
|
-
computeMouseOpts = _$table$
|
|
791
|
+
var _$table$getComputeMap0 = $table.getComputeMaps(),
|
|
792
|
+
computeMouseOpts = _$table$getComputeMap0.computeMouseOpts;
|
|
744
793
|
var mouseOpts = computeMouseOpts.value;
|
|
745
|
-
if (row && column && mouseConfig && mouseOpts.area) {
|
|
794
|
+
if (row && column && hasEnableConf(mouseConfig, mouseOpts) && mouseOpts.area) {
|
|
746
795
|
var _$table$getTableData5 = $table.getTableData(),
|
|
747
796
|
visibleData = _$table$getTableData5.visibleData;
|
|
748
797
|
var cellAreas = $table.getCellAreas();
|
|
@@ -781,10 +830,10 @@
|
|
|
781
830
|
column = params.column;
|
|
782
831
|
var tableProps = $table.props;
|
|
783
832
|
var mouseConfig = tableProps.mouseConfig;
|
|
784
|
-
var _$table$
|
|
785
|
-
computeMouseOpts = _$table$
|
|
833
|
+
var _$table$getComputeMap1 = $table.getComputeMaps(),
|
|
834
|
+
computeMouseOpts = _$table$getComputeMap1.computeMouseOpts;
|
|
786
835
|
var mouseOpts = computeMouseOpts.value;
|
|
787
|
-
if (row && column && mouseConfig && mouseOpts.area) {
|
|
836
|
+
if (row && column && hasEnableConf(mouseConfig, mouseOpts) && mouseOpts.area) {
|
|
788
837
|
var _$table$getTableData6 = $table.getTableData(),
|
|
789
838
|
visibleData = _$table$getTableData6.visibleData;
|
|
790
839
|
var cellAreas = $table.getCellAreas();
|
|
@@ -824,10 +873,10 @@
|
|
|
824
873
|
if (row && column) {
|
|
825
874
|
var tableProps = $table.props;
|
|
826
875
|
var mouseConfig = tableProps.mouseConfig;
|
|
827
|
-
var _$table$
|
|
828
|
-
computeMouseOpts = _$table$
|
|
876
|
+
var _$table$getComputeMap10 = $table.getComputeMaps(),
|
|
877
|
+
computeMouseOpts = _$table$getComputeMap10.computeMouseOpts;
|
|
829
878
|
var mouseOpts = computeMouseOpts.value;
|
|
830
|
-
if (mouseConfig && mouseOpts.area) {
|
|
879
|
+
if (hasEnableConf(mouseConfig, mouseOpts) && mouseOpts.area) {
|
|
831
880
|
var cellAreas = $table.getCellAreas();
|
|
832
881
|
if (cellAreas && cellAreas.length) {
|
|
833
882
|
cellAreas.forEach(function (areaItem) {
|
|
@@ -901,6 +950,14 @@
|
|
|
901
950
|
handleCopyOrCut(params);
|
|
902
951
|
}
|
|
903
952
|
},
|
|
953
|
+
/**
|
|
954
|
+
* 复制单元格数据的值;用于 mouse-config.area 功能,复制区域范围内的单元格数据,支持 Excel 和 WPS
|
|
955
|
+
*/
|
|
956
|
+
COPY_AREA_CELL: {
|
|
957
|
+
tableMenuMethod: function tableMenuMethod(params) {
|
|
958
|
+
handleCopyOrCut(params);
|
|
959
|
+
}
|
|
960
|
+
},
|
|
904
961
|
/**
|
|
905
962
|
* 剪贴单元格数据的值;如果启用 mouse-config.area 功能,则剪贴区域范围内的单元格数据,支持 Excel 和 WPS
|
|
906
963
|
*/
|
|
@@ -909,6 +966,14 @@
|
|
|
909
966
|
handleCopyOrCut(params, true);
|
|
910
967
|
}
|
|
911
968
|
},
|
|
969
|
+
/**
|
|
970
|
+
* 剪贴单元格数据的值;用于 mouse-config.area 功能,剪贴区域范围内的单元格数据,支持 Excel 和 WPS
|
|
971
|
+
*/
|
|
972
|
+
CUT_AREA_CELL: {
|
|
973
|
+
tableMenuMethod: function tableMenuMethod(params) {
|
|
974
|
+
handleCopyOrCut(params, true);
|
|
975
|
+
}
|
|
976
|
+
},
|
|
912
977
|
/**
|
|
913
978
|
* 粘贴从表格中被复制的数据;如果启用 mouse-config.area 功能,则粘贴区域范围内的单元格数据,不支持读取剪贴板
|
|
914
979
|
*/
|
|
@@ -920,10 +985,10 @@
|
|
|
920
985
|
column = params.column;
|
|
921
986
|
var tableProps = $table.props;
|
|
922
987
|
var mouseConfig = tableProps.mouseConfig;
|
|
923
|
-
var _$table$
|
|
924
|
-
computeMouseOpts = _$table$
|
|
988
|
+
var _$table$getComputeMap11 = $table.getComputeMaps(),
|
|
989
|
+
computeMouseOpts = _$table$getComputeMap11.computeMouseOpts;
|
|
925
990
|
var mouseOpts = computeMouseOpts.value;
|
|
926
|
-
if (mouseConfig && mouseOpts.area) {
|
|
991
|
+
if (hasEnableConf(mouseConfig, mouseOpts) && mouseOpts.area) {
|
|
927
992
|
$table.triggerPasteCellAreaEvent($event);
|
|
928
993
|
} else {
|
|
929
994
|
var clipboard = getClipboardObj();
|
|
@@ -934,6 +999,23 @@
|
|
|
934
999
|
}
|
|
935
1000
|
}
|
|
936
1001
|
},
|
|
1002
|
+
/**
|
|
1003
|
+
* 粘贴从表格中被复制的数据;用于 mouse-config.area 功能,粘贴区域范围内的单元格数据,不支持读取剪贴板
|
|
1004
|
+
*/
|
|
1005
|
+
PASTE_AREA_CELL: {
|
|
1006
|
+
tableMenuMethod: function tableMenuMethod(params) {
|
|
1007
|
+
var $event = params.$event,
|
|
1008
|
+
$table = params.$table;
|
|
1009
|
+
var tableProps = $table.props;
|
|
1010
|
+
var mouseConfig = tableProps.mouseConfig;
|
|
1011
|
+
var _$table$getComputeMap12 = $table.getComputeMaps(),
|
|
1012
|
+
computeMouseOpts = _$table$getComputeMap12.computeMouseOpts;
|
|
1013
|
+
var mouseOpts = computeMouseOpts.value;
|
|
1014
|
+
if (hasEnableConf(mouseConfig, mouseOpts) && mouseOpts.area) {
|
|
1015
|
+
$table.triggerPasteCellAreaEvent($event);
|
|
1016
|
+
}
|
|
1017
|
+
}
|
|
1018
|
+
},
|
|
937
1019
|
/**
|
|
938
1020
|
* 如果启用 mouse-config.area 功能,如果所选区域内已存在合并单元格,则取消临时合并,否则临时合并
|
|
939
1021
|
*/
|
|
@@ -1097,12 +1179,12 @@
|
|
|
1097
1179
|
column = params.column;
|
|
1098
1180
|
var tableProps = $table.props;
|
|
1099
1181
|
var mouseConfig = tableProps.mouseConfig;
|
|
1100
|
-
var _$table$
|
|
1101
|
-
computeMouseOpts = _$table$
|
|
1182
|
+
var _$table$getComputeMap13 = $table.getComputeMaps(),
|
|
1183
|
+
computeMouseOpts = _$table$getComputeMap13.computeMouseOpts;
|
|
1102
1184
|
var mouseOpts = computeMouseOpts.value;
|
|
1103
1185
|
$table.insert(menu.params || {}).then(function (_ref7) {
|
|
1104
1186
|
var rows = _ref7.rows;
|
|
1105
|
-
if (column && mouseConfig && mouseOpts.area) {
|
|
1187
|
+
if (column && hasEnableConf(mouseConfig, mouseOpts) && mouseOpts.area) {
|
|
1106
1188
|
$table.setCellAreas([{
|
|
1107
1189
|
startRow: _xeUtils["default"].first(rows),
|
|
1108
1190
|
endRow: _xeUtils["default"].last(rows),
|
|
@@ -1124,12 +1206,12 @@
|
|
|
1124
1206
|
column = params.column;
|
|
1125
1207
|
var tableProps = $table.props;
|
|
1126
1208
|
var mouseConfig = tableProps.mouseConfig;
|
|
1127
|
-
var _$table$
|
|
1128
|
-
computeMouseOpts = _$table$
|
|
1209
|
+
var _$table$getComputeMap14 = $table.getComputeMaps(),
|
|
1210
|
+
computeMouseOpts = _$table$getComputeMap14.computeMouseOpts;
|
|
1129
1211
|
var mouseOpts = computeMouseOpts.value;
|
|
1130
1212
|
(row ? $table.insertAt(menu.params || {}, row) : $table.insert(menu.params || {})).then(function (_ref8) {
|
|
1131
1213
|
var rows = _ref8.rows;
|
|
1132
|
-
if (column && mouseConfig && mouseOpts.area) {
|
|
1214
|
+
if (column && hasEnableConf(mouseConfig, mouseOpts) && mouseOpts.area) {
|
|
1133
1215
|
$table.setCellAreas([{
|
|
1134
1216
|
startRow: _xeUtils["default"].first(rows),
|
|
1135
1217
|
endRow: _xeUtils["default"].last(rows),
|
|
@@ -1151,8 +1233,8 @@
|
|
|
1151
1233
|
column = params.column;
|
|
1152
1234
|
var tableProps = $table.props;
|
|
1153
1235
|
var mouseConfig = tableProps.mouseConfig;
|
|
1154
|
-
var _$table$
|
|
1155
|
-
computeMouseOpts = _$table$
|
|
1236
|
+
var _$table$getComputeMap15 = $table.getComputeMaps(),
|
|
1237
|
+
computeMouseOpts = _$table$getComputeMap15.computeMouseOpts;
|
|
1156
1238
|
var mouseOpts = computeMouseOpts.value;
|
|
1157
1239
|
selectMultipleRows().then(function (_ref9) {
|
|
1158
1240
|
var size = _ref9.size;
|
|
@@ -1162,7 +1244,7 @@
|
|
|
1162
1244
|
});
|
|
1163
1245
|
(row ? $table.insertAt(records, row) : $table.insert(records)).then(function (_ref0) {
|
|
1164
1246
|
var rows = _ref0.rows;
|
|
1165
|
-
if (column && mouseConfig && mouseOpts.area) {
|
|
1247
|
+
if (column && hasEnableConf(mouseConfig, mouseOpts) && mouseOpts.area) {
|
|
1166
1248
|
$table.setCellAreas([{
|
|
1167
1249
|
startRow: _xeUtils["default"].first(rows),
|
|
1168
1250
|
endRow: _xeUtils["default"].last(rows),
|
|
@@ -1186,12 +1268,12 @@
|
|
|
1186
1268
|
column = params.column;
|
|
1187
1269
|
var tableProps = $table.props;
|
|
1188
1270
|
var mouseConfig = tableProps.mouseConfig;
|
|
1189
|
-
var _$table$
|
|
1190
|
-
computeMouseOpts = _$table$
|
|
1271
|
+
var _$table$getComputeMap16 = $table.getComputeMaps(),
|
|
1272
|
+
computeMouseOpts = _$table$getComputeMap16.computeMouseOpts;
|
|
1191
1273
|
var mouseOpts = computeMouseOpts.value;
|
|
1192
1274
|
(row ? $table.insertNextAt(menu.params || {}, row) : $table.insert(menu.params || {})).then(function (_ref1) {
|
|
1193
1275
|
var rows = _ref1.rows;
|
|
1194
|
-
if (column && mouseConfig && mouseOpts.area) {
|
|
1276
|
+
if (column && hasEnableConf(mouseConfig, mouseOpts) && mouseOpts.area) {
|
|
1195
1277
|
$table.setCellAreas([{
|
|
1196
1278
|
startRow: _xeUtils["default"].first(rows),
|
|
1197
1279
|
endRow: _xeUtils["default"].last(rows),
|
|
@@ -1213,8 +1295,8 @@
|
|
|
1213
1295
|
column = params.column;
|
|
1214
1296
|
var tableProps = $table.props;
|
|
1215
1297
|
var mouseConfig = tableProps.mouseConfig;
|
|
1216
|
-
var _$table$
|
|
1217
|
-
computeMouseOpts = _$table$
|
|
1298
|
+
var _$table$getComputeMap17 = $table.getComputeMaps(),
|
|
1299
|
+
computeMouseOpts = _$table$getComputeMap17.computeMouseOpts;
|
|
1218
1300
|
var mouseOpts = computeMouseOpts.value;
|
|
1219
1301
|
selectMultipleRows().then(function (_ref10) {
|
|
1220
1302
|
var size = _ref10.size;
|
|
@@ -1224,7 +1306,7 @@
|
|
|
1224
1306
|
});
|
|
1225
1307
|
(row ? $table.insertNextAt(records, row) : $table.insert(records)).then(function (_ref11) {
|
|
1226
1308
|
var rows = _ref11.rows;
|
|
1227
|
-
if (column && mouseConfig && mouseOpts.area) {
|
|
1309
|
+
if (column && hasEnableConf(mouseConfig, mouseOpts) && mouseOpts.area) {
|
|
1228
1310
|
$table.setCellAreas([{
|
|
1229
1311
|
startRow: _xeUtils["default"].first(rows),
|
|
1230
1312
|
endRow: _xeUtils["default"].last(rows),
|
|
@@ -1426,10 +1508,10 @@
|
|
|
1426
1508
|
row = params.row;
|
|
1427
1509
|
var tableProps = $table.props;
|
|
1428
1510
|
var mouseConfig = tableProps.mouseConfig;
|
|
1429
|
-
var _$table$
|
|
1430
|
-
computeMouseOpts = _$table$
|
|
1511
|
+
var _$table$getComputeMap18 = $table.getComputeMaps(),
|
|
1512
|
+
computeMouseOpts = _$table$getComputeMap18.computeMouseOpts;
|
|
1431
1513
|
var mouseOpts = computeMouseOpts.value;
|
|
1432
|
-
if (mouseConfig && mouseOpts.area) {
|
|
1514
|
+
if (hasEnableConf(mouseConfig, mouseOpts) && mouseOpts.area) {
|
|
1433
1515
|
var cellAreas = $table.getCellAreas();
|
|
1434
1516
|
cellAreas.forEach(function (areaItem) {
|
|
1435
1517
|
var rows = areaItem.rows;
|
package/dist/index.umd.min.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
((e,t)=>{"object"==typeof exports&&"undefined"!=typeof module?module.exports=t(require("xe-utils"),require("vue")):"function"==typeof define&&define.amd?define(["xe-utils","vue"],t):(e="undefined"!=typeof globalThis?globalThis:e||self).VxeUIPluginMenu=t(e.XEUtils,e.Vue)})(this,function(e,t){function a(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var n,u,i,c,l,o,_,g,r={};function s(a){return{tableMenuMethod:function(e){var t=e.$table;c.default.eachTree([e.column],function(e){e.fixed=a}),t.refreshColumn()}}}function m(){var e=u.globalStore;return e?e.clipboard||"":(e=u.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 E(e,t){var a,n,l,o=e.$event,r=e.$table,s=e.row,e=e.column;s&&e&&(a=r.props.mouseConfig,l=r.getComputeMaps().computeMouseOpts.value,n="",a&&l.area?(t?r.triggerCutCellAreaEvent(o):r.triggerCopyCellAreaEvent(o),n=(a=m())?a.text:""):(n=c.default.toValueString(c.default.get(s,e.field)),l={text:n,html:""},(t=u.globalStore)?t.clipboard=l:u.config&&(u.config.clipboard=l)),(c.default.isFunction(i)?i:d)(n))}function f(t){return function(e){e=e.$grid;e&&e.commitProxy(t)}}function b(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 l=e.row,o=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<=l&&l+r-1<=t&&n<=o&&o+s-1<=e})})}function C(e){var t=e.$table,e=b(e);return e.length&&t.removeMergeCells(e),e}function M(e,t){var a=e.code,n=t.$table,l=t.$grid,o=t.row,r=t.column,s=t.type,u=n.props,i=u.editConfig,c=u.mouseConfig;switch(a){case"CLEAR_ALL_SORT":var d=n.getSortColumns();e.disabled=!d.length;break;case"CLEAR_ALL_FILTER":d=n.getCheckedFilters();e.disabled=!d.length;break;case"CLEAR_ALL_MERGE":var d=n.getMergeCells(),E=n.getMergeFooterItems();e.disabled=!d.length&&!E.length;break;case"CLEAR_MERGE_CELL":d=b(t);e.disabled=!d.length;break;case"COPY_TITLE":e.disabled=!r||"header"!==s;break;case"SELECT_ALL_AREA":E=n.getTableData().visibleData,d=n.getTableColumn().visibleColumn;e.disabled=!E.length||!d.length;break;case"SELECT_AREA_TO_LEFT":case"SELECT_AREA_TO_RIGHT":case"SELECT_AREA_TO_TOP":case"SELECT_AREA_TO_BOTTON":e.disabled=!r||!o;break;case"DELETE_CHECKBOX_ROW":E=n.getCheckboxRecords();e.disabled=!E.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"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 f=n.getComputeMaps().computeMouseOpts.value,C=!!r.parentId;switch(a){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"===a&&(e.disabled=!r.filters.some(function(e){return e.checked}));break;case"REVERT_CELL":e.disabled=!o||!r.field||!n.isUpdateByRow(o,r.field);break;case"REVERT_ROW":e.disabled=!o||!r.field||!n.isUpdateByRow(o);break;case"OPEN_FIND":case"OPEN_REPLACE":e.disabled=!(c&&f.area);break;case"EDIT_CELL":e.disabled=!i||!r.editRender;break;case"COPY_CELL":case"CUT_CELL":case"PASTE_CELL":var M=c&&f.area?n.getCellAreas():[];e.disabled=1<M.length,e.disabled||"PASTE_CELL"===a&&(M=m(),e.disabled=!M||!M.text);break;case"MERGE_OR_CLEAR":case"MERGE_CELL":M=c&&f.area?n.getCellAreas():[];e.disabled=!M.length||1===M.length&&1===M[0].rows.length&&1===M[0].cols.length||!((e,t)=>{for(var a=e.$table,n=a.getTableData().visibleData,l=a.getTableColumn().visibleColumn,o={},r=0,s=t.length;r<s;r++)for(var u=t[r],i=u.rows,c=u.cols,d=0,E=i.length;d<E;d++)for(var f=i[d],C=g(a,n,f),M=0,m=c.length;M<m;M++){var b=c[M],b=C+":"+_(l,b);if(o[b])return;o[b]=!0}return 1})(t,M);break;case"FIXED_LEFT_COLUMN":e.disabled=C||"left"===r.fixed;break;case"FIXED_RIGHT_COLUMN":e.disabled=C||"right"===r.fixed;break;case"CLEAR_FIXED_COLUMN":e.disabled=C||!r.fixed}}break;case"COMMIT_PROXY_INITIAL":case"COMMIT_PROXY_QUERY":case"COMMIT_PROXY_RELOAD":case"COMMIT_PROXY_DELETE":case"COMMIT_PROXY_SAVE":e.disabled=!l}}function R(t){return t.options.forEach(function(e){e.forEach(function(e){M(e,t),e.children&&e.children.forEach(function(e){M(e,t)})})}),!0}function p(){return new Promise(function(t){var e,a;u.modal?(e=u.getComponent("VxeNumberInput"))?(a=(0,l.ref)(1),u.modal.alert({title:"请输入行数",width:220,maskClosable:!1,slots:{default:function(){return(0,l.h)(e,{modelValue:a.value,min:1,max:100,type:"integer",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(u.getI18n("vxe.error.reqComp",["vxe-number-input"])),t({size:0})):t({size:0})})}function h(){location.reload()}function v(){history.forward()}function L(){history.back()}function T(e){e&&e.copy&&(i=e.copy)}return n||(n=1,n=r,Object.defineProperty(n,"__esModule",{value:!0}),n.default=n.VxeUIPluginMenu=void 0,c=(e=e)&&e.__esModule?e:{default:e},l=t,_=function(e,t){return c.default.findIndexOf(e,function(e){return e.id===t.id})},g=function(e,t,a){return e.findRowIndexOf(t,a)},e=n.VxeUIPluginMenu={setConfig:T,install:function(e,t){(u=e).checkVersion?u.checkVersion(u.tableVersion,4,11)||console.error("[@vxe-ui/plugin-menu 4.3.2] ".concat(u.getI18n("vxe.error.errorVersion",["vxe-table@".concat(u.tableVersion||"?"),"vxe-table v".concat(4,".").concat(11,"+")])," https://vxeui.com/other4/#/plugin-menu/install")):/^(4)\./.test(u.uiVersion||u.tableVersion)||console.error("[@vxe-ui/plugin-menu 4.3.2] Requires vxe-table 4.7.0+ version. https://vxeui.com/other4/#/plugin-menu/install"),T(t),u.menus.mixin({SYSTEM_PAGE_REFRESH:{tableMenuMethod:h,treeMenuMethod:h,calendarMenuMethod:h,menuMenuMethod:h,formDesignMenuMethod:h},SYSTEM_PAGE_FORWARD:{tableMenuMethod:v,treeMenuMethod:v,calendarMenuMethod:v,menuMenuMethod:v,formDesignMenuMethod:v},SYSTEM_PAGE_BACK:{tableMenuMethod:L,treeMenuMethod:L,calendarMenuMethod:L,menuMenuMethod:L,formDesignMenuMethod:L},CLEAR_CELL:{tableMenuMethod:function(e){var t,a,n=e.$table,l=e.row,e=e.column;l&&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(l,e.field))}},CLEAR_ROW:{tableMenuMethod:function(e){var t=e.$table,e=e.row;e&&t.clearData(e)}},CLEAR_CHECKBOX_ROW:{tableMenuMethod:function(e){e=e.$table;e.clearData(e.getCheckboxRecords())}},CLEAR_AREA_ROW:{tableMenuMethod:function(e){var t=e.$table,a=e.row,e=e.column,n=t.props.mouseConfig,l=t.getComputeMaps().computeMouseOpts.value;n&&l.area?(n&&l.area?t.getCellAreas():[]).forEach(function(e){e=e.rows;t.clearData(e)}):a&&e&&t.clearData(a)}},CLEAR_ALL:{tableMenuMethod:function(e){e.$table.clearData()}},SELECT_ALL_AREA:{tableMenuMethod: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:c.default.first(t),endRow:c.default.last(t),startColumn:c.default.first(a),endColumn:c.default.last(a)}]))}},SELECT_AREA_TO_LEFT:{tableMenuMethod:function(e){var t=e.$table,a=e.row,e=e.column,n=t.props.mouseConfig,l=t.getComputeMaps().computeMouseOpts.value;a&&e&&n&&l.area&&(n=t.getTableColumn().visibleColumn,1===(l=t.getCellAreas()).length?(l=l[0],t.setCellAreas([{startRow:c.default.first(l.rows),endRow:c.default.last(l.rows),startColumn:c.default.first(n),endColumn:c.default.last(l.cols)}],{column:e,row:a})):t.setCellAreas([{startRow:a,endRow:a,startColumn:c.default.first(n),endColumn:e}],{column:e,row:a}))}},SELECT_AREA_TO_RIGHT:{tableMenuMethod:function(e){var t=e.$table,a=e.row,e=e.column,n=t.props.mouseConfig,l=t.getComputeMaps().computeMouseOpts.value;a&&e&&n&&l.area&&(n=t.getTableColumn().visibleColumn,1===(l=t.getCellAreas()).length?(l=l[0],t.setCellAreas([{startRow:c.default.first(l.rows),endRow:c.default.last(l.rows),startColumn:c.default.first(l.cols),endColumn:c.default.last(n)}],{column:e,row:a})):t.setCellAreas([{startRow:a,endRow:a,startColumn:e,endColumn:c.default.last(n)}],{column:e,row:a}))}},SELECT_AREA_TO_TOP:{tableMenuMethod:function(e){var t=e.$table,a=e.row,e=e.column,n=t.props.mouseConfig,l=t.getComputeMaps().computeMouseOpts.value;a&&e&&n&&l.area&&(n=t.getTableData().visibleData,1===(l=t.getCellAreas()).length?(l=l[0],t.setCellAreas([{startRow:c.default.first(n),endRow:c.default.last(l.rows),startColumn:c.default.first(l.cols),endColumn:c.default.last(l.cols)}],{column:e,row:a})):t.setCellAreas([{startRow:c.default.first(n),endRow:a,startColumn:e,endColumn:e}],{column:e,row:a}))}},SELECT_AREA_TO_BOTTON:{tableMenuMethod:function(e){var t=e.$table,a=e.row,e=e.column,n=t.props.mouseConfig,l=t.getComputeMaps().computeMouseOpts.value;a&&e&&n&&l.area&&(n=t.getTableData().visibleData,1===(l=t.getCellAreas()).length?(l=l[0],t.setCellAreas([{startRow:c.default.first(l.rows),endRow:c.default.last(n),startColumn:c.default.first(l.cols),endColumn:c.default.last(l.cols)}],{column:e,row:a})):t.setCellAreas([{startRow:a,endRow:c.default.last(n),startColumn:e,endColumn:e}],{column:e,row:a}))}},REVERT_CELL:{tableMenuMethod:function(e){var t,a,n=e.$table,l=e.row,e=e.column;l&&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(l,e.field))}},REVERT_ROW:{tableMenuMethod:function(e){var t=e.$table,e=e.row;e&&t.revertData(e)}},REVERT_CHECKBOX_ROW:{tableMenuMethod:function(e){e=e.$table;e.revertData(e.getCheckboxRecords())}},REVERT_ALL:{tableMenuMethod:function(e){e.$table.revertData()}},COPY_TITLE:{tableMenuMethod:function(e){e=e.column.getTitle();e&&(c.default.isFunction(i)?i:d)(e)}},COPY_CELL:{tableMenuMethod:function(e){E(e)}},CUT_CELL:{tableMenuMethod:function(e){E(e,!0)}},PASTE_CELL:{tableMenuMethod:function(e){var t=e.$event,a=e.$table,n=e.row,e=e.column,l=a.props.mouseConfig,o=a.getComputeMaps().computeMouseOpts.value;l&&o.area?a.triggerPasteCellAreaEvent(t):(l=m())&&l.text&&c.default.set(n,e.field,l.text)}},MERGE_OR_CLEAR:{tableMenuMethod:function(e){var t=e.$event,a=e.$table,n=a.getCellAreas(),e=b(e),l=!1,e=(e.length?a.removeMergeCells(e):(l=!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:l,targetAreas:e},t)}},MERGE_CELL:{tableMenuMethod:function(e){var t=e.$event,a=e.$table,n=a.getTableData().visibleData,l=a.getTableColumn().visibleColumn,o=a.getCellAreas();C(e),o.some(function(e){return e.rows.length===n.length||e.cols.length===l.length})?u.modal&&u.modal.message({content:u.getI18n("vxe.pro.area.mergeErr"),status:"error",id:"operErr"}):(a.setMergeCells(o.map(function(e){var t=e.rows,e=e.cols;return{row:t[0],col:e[0],rowspan:t.length,colspan:e.length}})),e=o.map(function(e){return{rows:e.rows,cols:e.cols}}),a.dispatchEvent("cell-area-merge",{status:!0,targetAreas:e},t))}},CLEAR_MERGE_CELL:{tableMenuMethod:function(e){var t=e.$event,a=e.$table,e=C(e);e.length&&a.dispatchEvent("clear-cell-area-merge",{mergeCells:e},t)}},CLEAR_ALL_MERGE:{tableMenuMethod: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:{tableMenuMethod: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:{tableMenuMethod:function(e){var t=e.$table,e=e.row;t.setEditRow?t.setEditRow(e):t.setActiveRow(e)}},INSERT_ROW:{tableMenuMethod:function(e){var t=e.$table,a=e.menu,n=e.column,l=t.props.mouseConfig,o=t.getComputeMaps().computeMouseOpts.value;t.insert(a.params||{}).then(function(e){e=e.rows;n&&l&&o.area&&t.setCellAreas([{startRow:c.default.first(e),endRow:c.default.last(e),startColumn:n,endColumn:n}])})}},INSERT_AT_ROW:{tableMenuMethod:function(e){var t=e.$table,a=e.menu,n=e.row,l=e.column,o=t.props.mouseConfig,r=t.getComputeMaps().computeMouseOpts.value;(n?t.insertAt(a.params||{},n):t.insert(a.params||{})).then(function(e){e=e.rows;l&&o&&r.area&&t.setCellAreas([{startRow:c.default.first(e),endRow:c.default.last(e),startColumn:l,endColumn:l}])})}},BATCH_INSERT_AT_ROW:{tableMenuMethod:function(e){var t=e.$table,a=e.menu,n=e.row,l=e.column,o=t.props.mouseConfig,r=t.getComputeMaps().computeMouseOpts.value;p().then(function(e){var e=e.size;e&&(e=c.default.range(0,e).map(function(){return Object.assign({},a.params)}),(n?t.insertAt(e,n):t.insert(e)).then(function(e){e=e.rows;l&&o&&r.area&&t.setCellAreas([{startRow:c.default.first(e),endRow:c.default.last(e),startColumn:l,endColumn:l}])}))})}},INSERT_NEXT_AT_ROW:{tableMenuMethod:function(e){var t=e.$table,a=e.menu,n=e.row,l=e.column,o=t.props.mouseConfig,r=t.getComputeMaps().computeMouseOpts.value;(n?t.insertNextAt(a.params||{},n):t.insert(a.params||{})).then(function(e){e=e.rows;l&&o&&r.area&&t.setCellAreas([{startRow:c.default.first(e),endRow:c.default.last(e),startColumn:l,endColumn:l}])})}},BATCH_INSERT_NEXT_AT_ROW:{tableMenuMethod:function(e){var t=e.$table,a=e.menu,n=e.row,l=e.column,o=t.props.mouseConfig,r=t.getComputeMaps().computeMouseOpts.value;p().then(function(e){var e=e.size;e&&(e=c.default.range(0,e).map(function(){return Object.assign({},a.params)}),(n?t.insertNextAt(e,n):t.insert(e)).then(function(e){e=e.rows;l&&o&&r.area&&t.setCellAreas([{startRow:c.default.first(e),endRow:c.default.last(e),startColumn:l,endColumn:l}])}))})}},INSERT_ACTIVED_ROW:{tableMenuMethod:function(e){var t=e.$table,a=e.column,n=e.menu.params||[],e=Object.assign({},n[0]||{});t.insert(e).then(function(e){e=e.row;t.setEditCell?t.setEditCell(e,n[1]||a):t.setActiveCell(e,n[1]||a.field)})}},INSERT_EDIT_ROW:{tableMenuMethod:function(e){var t=e.$table,a=e.column,n=e.menu.params||[],e=Object.assign({},n[0]||{});t.insert(e).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:{tableMenuMethod:function(e){var t=e.$table,a=e.row,n=e.column,l=e.menu.params||[],e=Object.assign({},l[0]||{});(a?t.insertAt(e,a):t.insert(e)).then(function(e){e=e.row;t.setEditCell?t.setEditCell(e,l[1]||n):t.setActiveCell(e,l[1]||n.field)})}},INSERT_AT_EDIT_ROW:{tableMenuMethod:function(e){var t=e.$table,a=e.row,n=e.column,l=e.menu.params||[],e=Object.assign({},l[0]||{});(a?t.insertAt(e,a):t.insert(e)).then(function(e){e=e.row;t.setEditCell?t.setEditCell(e,l[1]||n):t.setActiveCell(e,l[1]||n.field)})}},BATCH_INSERT_AT_EDIT_ROW:{tableMenuMethod:function(e){var t=e.$table,a=e.row,n=e.column,l=e.menu.params||[];p().then(function(e){var e=e.size;e&&(e=c.default.range(0,e).map(function(){return Object.assign({},l[0])}),(a?t.insertAt(e,a):t.insert(e)).then(function(e){e=e.row;t.setEditCell?t.setEditCell(e,l[1]||n):t.setActiveCell(e,l[1]||n.field)}))})}},INSERT_NEXT_AT_EDIT_ROW:{tableMenuMethod:function(e){var t=e.$table,a=e.row,n=e.column,l=e.menu.params||[],e=Object.assign({},l[0]||{});(a?t.insertNextAt(e,a):t.insert(e)).then(function(e){e=e.row;t.setEditCell?t.setEditCell(e,l[1]||n):t.setActiveCell(e,l[1]||n.field)})}},BATCH_INSERT_NEXT_AT_EDIT_ROW:{tableMenuMethod:function(e){var t=e.$table,a=e.row,n=e.column,l=e.menu.params||[];p().then(function(e){var e=e.size;e&&(e=c.default.range(0,e).map(function(){return Object.assign({},l[0])}),(a?t.insertNextAt(e,a):t.insert(e)).then(function(e){e=e.row;t.setEditCell?t.setEditCell(e,l[1]||n):t.setActiveCell(e,l[1]||n.field)}))})}},DELETE_ROW:{tableMenuMethod:function(e){var t=e.$table,e=e.row;e&&t.remove(e)}},DELETE_AREA_ROW:{tableMenuMethod: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:{tableMenuMethod:function(e){e.$table.removeCheckboxRow()}},DELETE_ALL:{tableMenuMethod:function(e){e.$table.remove()}},CLEAR_SORT:{tableMenuMethod:function(e){var t=e.$event,a=e.$table,e=e.column;e&&a.triggerSortEvent(t,e,null)}},CLEAR_ALL_SORT:{tableMenuMethod: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:{tableMenuMethod:function(e){var t=e.$event,a=e.$table,e=e.column;e&&a.triggerSortEvent(t,e,"asc")}},SORT_DESC:{tableMenuMethod:function(e){var t=e.$event,a=e.$table,e=e.column;e&&a.triggerSortEvent(t,e,"desc")}},CLEAR_FILTER:{tableMenuMethod:function(e){var t=e.$event,a=e.$table,e=e.column;e&&(a.handleClearFilter(e),a.confirmFilterEvent(t))}},CLEAR_ALL_FILTER:{tableMenuMethod: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:{tableMenuMethod: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=c.default.get(n,t),e.checked=!0,a.updateData())}},EXPORT_ROW:{tableMenuMethod:function(e){var t=e.$table,a=e.menu,e=e.row;e&&t.exportData(c.default.assign({},a.params?a.params[0]:{},{data:[e]}))}},EXPORT_CHECKBOX_ROW:{tableMenuMethod:function(e){var t=e.$table,e=e.menu,a={data:t.getCheckboxRecords()};t.exportData(c.default.assign({},e.params?e.params[0]:{},a))}},EXPORT_ALL:{tableMenuMethod:function(e){e.$table.exportData(e.menu.params)}},PRINT_ALL:{tableMenuMethod:function(e){e.$table.print(e.menu.params)}},PRINT_CHECKBOX_ROW:{tableMenuMethod:function(e){var t=e.$table,e=e.menu,a={data:t.getCheckboxRecords()};t.print(c.default.assign(a,e.params))}},OPEN_FIND:{tableMenuMethod:function(e){var t=e.$event,e=e.$table;e.triggerFnrOpenEvent?e.triggerFnrOpenEvent(t,"find"):e.triggerFNROpenEvent(t,"find")}},OPEN_REPLACE:{tableMenuMethod:function(e){var t=e.$event,e=e.$table;e.triggerFnrOpenEvent?e.triggerFnrOpenEvent(t,"replace"):e.triggerFNROpenEvent(t,"replace")}},HIDDEN_COLUMN:{tableMenuMethod:function(e){var t=e.$table,e=e.column;e&&t.hideColumn(e)}},FIXED_LEFT_COLUMN:s("left"),FIXED_RIGHT_COLUMN:s("right"),CLEAR_FIXED_COLUMN:s(null),RESET_COLUMN:{tableMenuMethod:function(e){e.$table.resetColumn({visible:!0,resizable:!1})}},RESET_RESIZABLE:{tableMenuMethod:function(e){e.$table.resetColumn({visible:!1,resizable:!0})}},RESET_ALL:{tableMenuMethod:function(e){e.$table.resetColumn(!0)}},COMMIT_PROXY_INITIAL:{tableMenuMethod:f("initial")},COMMIT_PROXY_QUERY:{tableMenuMethod:f("query")},COMMIT_PROXY_RELOAD:{tableMenuMethod:f("reload")},COMMIT_PROXY_DELETE:{tableMenuMethod:f("delete")},COMMIT_PROXY_SAVE:{tableMenuMethod:f("save")}}),u.interceptor.add("event.showMenu",R)}},"undefined"!=typeof window&&window.VxeUI&&window.VxeUI.use&&window.VxeUI.use(e),n.default=e),a(r)});
|
|
1
|
+
((e,t)=>{"object"==typeof exports&&"undefined"!=typeof module?module.exports=t(require("xe-utils"),require("vue")):"function"==typeof define&&define.amd?define(["xe-utils","vue"],t):(e="undefined"!=typeof globalThis?globalThis:e||self).VxeUIPluginMenu=t(e.XEUtils,e.Vue)})(this,function(e,t){function a(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var n,s,u,i,o,l,_,R,r={};function b(e,t){return t&&(e?!1!==t.enabled:t.enabled)}function c(a){return{tableMenuMethod:function(e){var t=e.$table;i.default.eachTree([e.column],function(e){e.fixed=a}),t.refreshColumn()}}}function p(){var e=s.globalStore;return e?e.clipboard||"":(e=s.config)&&e.clipboard?e.clipboard:null}function d(e){var t,a;try{t=e,l||((l=document.createElement("textarea")).id="$XECopy",(a=l.style).width="48px",a.height="24px",a.position="fixed",a.zIndex="0",a.left="-500px",a.top="-500px",document.body.appendChild(l)),l.value=null==t?"":""+t,l.select(),l.setSelectionRange(0,l.value.length),document.execCommand("copy"),l.blur()}catch(e){}}function E(e,t){var a,n,o=e.$event,l=e.$table,r=e.row,e=e.column;r&&e&&(b(l.props.mouseConfig,a=l.getComputeMaps().computeMouseOpts.value)&&a.area?(t?l.triggerCutCellAreaEvent(o):l.triggerCopyCellAreaEvent(o),n=(a=p())?a.text:""):(n=i.default.toValueString(i.default.get(r,e.field)),t={text:n,html:""},(l=s.globalStore)?l.clipboard=t:s.config&&(s.config.clipboard=t)),(i.default.isFunction(u)?u:d)(n))}function C(t){return function(e){e=e.$grid;e&&e.commitProxy(t)}}function g(e){var u=e.$table,e=u.props.mouseConfig,t=u.getComputeMaps().computeMouseOpts.value,i=u.getTableData().visibleData,c=u.getTableColumn().visibleColumn,a=b(e,t)&&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=R(u,i,t[0]),t=R(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 f(e){var t=e.$table,e=g(e);return e.length&&t.removeMergeCells(e),e}function M(e,t){var a=e.code,n=t.$table,o=t.$grid,l=t.row,r=t.column,s=t.type,u=n.props,i=u.editConfig,c=u.mouseConfig;switch(a){case"CLEAR_ALL_SORT":var d=n.getSortColumns();e.disabled=!d.length;break;case"CLEAR_ALL_FILTER":d=n.getCheckedFilters();e.disabled=!d.length;break;case"CLEAR_ALL_MERGE":var d=n.getMergeCells(),E=n.getMergeFooterItems();e.disabled=!d.length&&!E.length;break;case"CLEAR_MERGE_CELL":d=g(t);e.disabled=!d.length;break;case"COPY_TITLE":e.disabled=!r||"header"!==s;break;case"SELECT_ALL_AREA":E=n.getTableData().visibleData,d=n.getTableColumn().visibleColumn;e.disabled=!E.length||!d.length;break;case"SELECT_AREA_TO_LEFT":case"SELECT_AREA_TO_RIGHT":case"SELECT_AREA_TO_TOP":case"SELECT_AREA_TO_BOTTON":e.disabled=!r||!l;break;case"DELETE_CHECKBOX_ROW":E=n.getCheckboxRecords();e.disabled=!E.length;break;case"EDIT_CELL":case"CLEAR_CELL":case"CLEAR_AREA_CELL":case"CLEAR_ROW":case"COPY_CELL":case"COPY_AREA_CELL":case"CUT_CELL":case"CUT_AREA_CELL":case"PASTE_CELL":case"PASTE_AREA_CELL":case"MERGE_OR_CLEAR":case"MERGE_CELL":case"REVERT_CELL":case"REVERT_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 C=n.getComputeMaps().computeMouseOpts.value,f=!!r.parentId;switch(a){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"===a&&(e.disabled=!r.filters.some(function(e){return e.checked}));break;case"REVERT_CELL":e.disabled=!l||!r.field||!n.isUpdateByRow(l,r.field);break;case"REVERT_ROW":e.disabled=!l||!r.field||!n.isUpdateByRow(l);break;case"OPEN_FIND":case"OPEN_REPLACE":e.disabled=!(b(c,C)&&C.area);break;case"EDIT_CELL":e.disabled=!i||!r.editRender;break;case"COPY_CELL":case"COPY_AREA_CELL":case"CUT_CELL":case"CUT_AREA_CELL":case"PASTE_CELL":case"PASTE_AREA_CELL":var M=b(c,C)&&C.area?n.getCellAreas():[];if(e.disabled=1<M.length,!e.disabled)switch(a){case"PASTE_CELL":case"PASTE_AREA_CELL":var m=p();e.disabled=!m||!m.text}break;case"MERGE_OR_CLEAR":case"MERGE_CELL":M=b(c,C)&&C.area?n.getCellAreas():[];e.disabled=!M.length||1===M.length&&1===M[0].rows.length&&1===M[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,E=i.length;d<E;d++)for(var C=i[d],f=R(a,n,C),M=0,m=c.length;M<m;M++){var b=c[M],b=f+":"+_(o,b);if(l[b])return;l[b]=!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}}break;case"COMMIT_PROXY_INITIAL":case"COMMIT_PROXY_QUERY":case"COMMIT_PROXY_RELOAD":case"COMMIT_PROXY_DELETE":case"COMMIT_PROXY_SAVE":e.disabled=!o}}function m(t){return t.options.forEach(function(e){e.forEach(function(e){M(e,t),e.children&&e.children.forEach(function(e){M(e,t)})})}),!0}function h(){return new Promise(function(t){var e,a;s.modal?(e=s.getComponent("VxeNumberInput"))?(a=(0,o.ref)(1),s.modal.alert({title:"请输入行数",width:220,maskClosable:!1,slots:{default:function(){return(0,o.h)(e,{modelValue:a.value,min:1,max:100,type:"integer",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(s.getI18n("vxe.error.reqComp",["vxe-number-input"])),t({size:0})):t({size:0})})}function v(){location.reload()}function L(){history.forward()}function A(){history.back()}function T(e){e&&e.copy&&(u=e.copy)}return n||(n=1,n=r,Object.defineProperty(n,"__esModule",{value:!0}),n.default=n.VxeUIPluginMenu=void 0,n.hasEnableConf=b,i=(e=e)&&e.__esModule?e:{default:e},o=t,_=function(e,t){return i.default.findIndexOf(e,function(e){return e.id===t.id})},R=function(e,t,a){return e.findRowIndexOf(t,a)},e=n.VxeUIPluginMenu={setConfig:T,install:function(e,t){(s=e).checkVersion?s.checkVersion(s.tableVersion,4,11)||console.error("[@vxe-ui/plugin-menu 4.4.0] ".concat(s.getI18n("vxe.error.errorVersion",["vxe-table@".concat(s.tableVersion||"?"),"vxe-table v".concat(4,".").concat(11,"+")])," https://vxeui.com/other4/#/plugin-menu/install")):/^(4)\./.test(s.uiVersion||s.tableVersion)||console.error("[@vxe-ui/plugin-menu 4.4.0] Requires vxe-table 4.7.0+ version. https://vxeui.com/other4/#/plugin-menu/install"),T(t),s.menus.mixin({SYSTEM_PAGE_REFRESH:{tableMenuMethod:v,treeMenuMethod:v,calendarMenuMethod:v,menuMenuMethod:v,formDesignMenuMethod:v},SYSTEM_PAGE_FORWARD:{tableMenuMethod:L,treeMenuMethod:L,calendarMenuMethod:L,menuMenuMethod:L,formDesignMenuMethod:L},SYSTEM_PAGE_BACK:{tableMenuMethod:A,treeMenuMethod:A,calendarMenuMethod:A,menuMenuMethod:A,formDesignMenuMethod:A},CLEAR_CELL:{tableMenuMethod:function(e){var t,n=e.$table,a=e.row,e=e.column;a&&e&&(b(n.props.mouseConfig,t=n.getComputeMaps().computeMouseOpts.value)&&t.area?(t=n.getCellAreas())&&t.length&&t.forEach(function(e){var a=e.rows;e.cols.forEach(function(t){a.forEach(function(e){n.clearData(e,t.field)})})}):n.clearData(a,e.field))}},CLEAR_AREA_CELL:{tableMenuMethod:function(e){var n=e.$table;e.row&&e.column&&b(n.props.mouseConfig,e=n.getComputeMaps().computeMouseOpts.value)&&e.area&&(e=n.getCellAreas())&&e.length&&e.forEach(function(e){var a=e.rows;e.cols.forEach(function(t){a.forEach(function(e){n.clearData(e,t.field)})})})}},CLEAR_ROW:{tableMenuMethod:function(e){var t=e.$table,e=e.row;e&&t.clearData(e)}},CLEAR_CHECKBOX_ROW:{tableMenuMethod:function(e){e=e.$table;e.clearData(e.getCheckboxRecords())}},CLEAR_AREA_ROW:{tableMenuMethod:function(e){var t=e.$table,a=e.row,e=e.column,n=t.props.mouseConfig,o=t.getComputeMaps().computeMouseOpts.value;b(n,o)&&o.area?(o.area?t.getCellAreas():[]).forEach(function(e){e=e.rows;t.clearData(e)}):a&&e&&t.clearData(a)}},CLEAR_ALL:{tableMenuMethod:function(e){e.$table.clearData()}},SELECT_ALL_AREA:{tableMenuMethod:function(e){var e=e.$table,t=e.props.mouseConfig,a=e.getComputeMaps().computeMouseOpts.value;b(t,a)&&a.area&&(t=e.getTableData().visibleData,a=e.getTableColumn().visibleColumn,e.setCellAreas([{startRow:i.default.first(t),endRow:i.default.last(t),startColumn:i.default.first(a),endColumn:i.default.last(a)}]))}},SELECT_AREA_TO_LEFT:{tableMenuMethod:function(e){var t=e.$table,a=e.row,e=e.column,n=t.props.mouseConfig,o=t.getComputeMaps().computeMouseOpts.value;a&&e&&b(n,o)&&o.area&&(n=t.getTableColumn().visibleColumn,1===(o=t.getCellAreas()).length?(o=o[0],t.setCellAreas([{startRow:i.default.first(o.rows),endRow:i.default.last(o.rows),startColumn:i.default.first(n),endColumn:i.default.last(o.cols)}],{column:e,row:a})):t.setCellAreas([{startRow:a,endRow:a,startColumn:i.default.first(n),endColumn:e}],{column:e,row:a}))}},SELECT_AREA_TO_RIGHT:{tableMenuMethod:function(e){var t=e.$table,a=e.row,e=e.column,n=t.props.mouseConfig,o=t.getComputeMaps().computeMouseOpts.value;a&&e&&b(n,o)&&o.area&&(n=t.getTableColumn().visibleColumn,1===(o=t.getCellAreas()).length?(o=o[0],t.setCellAreas([{startRow:i.default.first(o.rows),endRow:i.default.last(o.rows),startColumn:i.default.first(o.cols),endColumn:i.default.last(n)}],{column:e,row:a})):t.setCellAreas([{startRow:a,endRow:a,startColumn:e,endColumn:i.default.last(n)}],{column:e,row:a}))}},SELECT_AREA_TO_TOP:{tableMenuMethod:function(e){var t=e.$table,a=e.row,e=e.column,n=t.props.mouseConfig,o=t.getComputeMaps().computeMouseOpts.value;a&&e&&b(n,o)&&o.area&&(n=t.getTableData().visibleData,1===(o=t.getCellAreas()).length?(o=o[0],t.setCellAreas([{startRow:i.default.first(n),endRow:i.default.last(o.rows),startColumn:i.default.first(o.cols),endColumn:i.default.last(o.cols)}],{column:e,row:a})):t.setCellAreas([{startRow:i.default.first(n),endRow:a,startColumn:e,endColumn:e}],{column:e,row:a}))}},SELECT_AREA_TO_BOTTON:{tableMenuMethod:function(e){var t=e.$table,a=e.row,e=e.column,n=t.props.mouseConfig,o=t.getComputeMaps().computeMouseOpts.value;a&&e&&b(n,o)&&o.area&&(n=t.getTableData().visibleData,1===(o=t.getCellAreas()).length?(o=o[0],t.setCellAreas([{startRow:i.default.first(o.rows),endRow:i.default.last(n),startColumn:i.default.first(o.cols),endColumn:i.default.last(o.cols)}],{column:e,row:a})):t.setCellAreas([{startRow:a,endRow:i.default.last(n),startColumn:e,endColumn:e}],{column:e,row:a}))}},REVERT_CELL:{tableMenuMethod:function(e){var t,n=e.$table,a=e.row,e=e.column;a&&e&&(b(n.props.mouseConfig,t=n.getComputeMaps().computeMouseOpts.value)&&t.area?(t=n.getCellAreas())&&t.length&&t.forEach(function(e){var a=e.rows;e.cols.forEach(function(t){a.forEach(function(e){n.revertData(e,t.field)})})}):n.revertData(a,e.field))}},REVERT_ROW:{tableMenuMethod:function(e){var t=e.$table,e=e.row;e&&t.revertData(e)}},REVERT_CHECKBOX_ROW:{tableMenuMethod:function(e){e=e.$table;e.revertData(e.getCheckboxRecords())}},REVERT_ALL:{tableMenuMethod:function(e){e.$table.revertData()}},COPY_TITLE:{tableMenuMethod:function(e){e=e.column.getTitle();e&&(i.default.isFunction(u)?u:d)(e)}},COPY_CELL:{tableMenuMethod:function(e){E(e)}},COPY_AREA_CELL:{tableMenuMethod:function(e){E(e)}},CUT_CELL:{tableMenuMethod:function(e){E(e,!0)}},CUT_AREA_CELL:{tableMenuMethod:function(e){E(e,!0)}},PASTE_CELL:{tableMenuMethod:function(e){var t=e.$event,a=e.$table,n=e.row,e=e.column,o=a.props.mouseConfig,l=a.getComputeMaps().computeMouseOpts.value;b(o,l)&&l.area?a.triggerPasteCellAreaEvent(t):(o=p())&&o.text&&i.default.set(n,e.field,o.text)}},PASTE_AREA_CELL:{tableMenuMethod:function(e){var t=e.$event,e=e.$table,a=e.props.mouseConfig,n=e.getComputeMaps().computeMouseOpts.value;b(a,n)&&n.area&&e.triggerPasteCellAreaEvent(t)}},MERGE_OR_CLEAR:{tableMenuMethod:function(e){var t=e.$event,a=e.$table,n=a.getCellAreas(),e=g(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:{tableMenuMethod:function(e){var t=e.$event,a=e.$table,n=a.getTableData().visibleData,o=a.getTableColumn().visibleColumn,l=a.getCellAreas();f(e),l.some(function(e){return e.rows.length===n.length||e.cols.length===o.length})?s.modal&&s.modal.message({content:s.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:{tableMenuMethod:function(e){var t=e.$event,a=e.$table,e=f(e);e.length&&a.dispatchEvent("clear-cell-area-merge",{mergeCells:e},t)}},CLEAR_ALL_MERGE:{tableMenuMethod: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:{tableMenuMethod: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:{tableMenuMethod:function(e){var t=e.$table,e=e.row;t.setEditRow?t.setEditRow(e):t.setActiveRow(e)}},INSERT_ROW:{tableMenuMethod: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&&b(o,l)&&l.area&&t.setCellAreas([{startRow:i.default.first(e),endRow:i.default.last(e),startColumn:n,endColumn:n}])})}},INSERT_AT_ROW:{tableMenuMethod: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):t.insert(a.params||{})).then(function(e){e=e.rows;o&&b(l,r)&&r.area&&t.setCellAreas([{startRow:i.default.first(e),endRow:i.default.last(e),startColumn:o,endColumn:o}])})}},BATCH_INSERT_AT_ROW:{tableMenuMethod:function(e){var t=e.$table,a=e.menu,n=e.row,o=e.column,l=t.props.mouseConfig,r=t.getComputeMaps().computeMouseOpts.value;h().then(function(e){var e=e.size;e&&(e=i.default.range(0,e).map(function(){return Object.assign({},a.params)}),(n?t.insertAt(e,n):t.insert(e)).then(function(e){e=e.rows;o&&b(l,r)&&r.area&&t.setCellAreas([{startRow:i.default.first(e),endRow:i.default.last(e),startColumn:o,endColumn:o}])}))})}},INSERT_NEXT_AT_ROW:{tableMenuMethod: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):t.insert(a.params||{})).then(function(e){e=e.rows;o&&b(l,r)&&r.area&&t.setCellAreas([{startRow:i.default.first(e),endRow:i.default.last(e),startColumn:o,endColumn:o}])})}},BATCH_INSERT_NEXT_AT_ROW:{tableMenuMethod:function(e){var t=e.$table,a=e.menu,n=e.row,o=e.column,l=t.props.mouseConfig,r=t.getComputeMaps().computeMouseOpts.value;h().then(function(e){var e=e.size;e&&(e=i.default.range(0,e).map(function(){return Object.assign({},a.params)}),(n?t.insertNextAt(e,n):t.insert(e)).then(function(e){e=e.rows;o&&b(l,r)&&r.area&&t.setCellAreas([{startRow:i.default.first(e),endRow:i.default.last(e),startColumn:o,endColumn:o}])}))})}},INSERT_ACTIVED_ROW:{tableMenuMethod:function(e){var t=e.$table,a=e.column,n=e.menu.params||[],e=Object.assign({},n[0]||{});t.insert(e).then(function(e){e=e.row;t.setEditCell?t.setEditCell(e,n[1]||a):t.setActiveCell(e,n[1]||a.field)})}},INSERT_EDIT_ROW:{tableMenuMethod:function(e){var t=e.$table,a=e.column,n=e.menu.params||[],e=Object.assign({},n[0]||{});t.insert(e).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:{tableMenuMethod:function(e){var t=e.$table,a=e.row,n=e.column,o=e.menu.params||[],e=Object.assign({},o[0]||{});(a?t.insertAt(e,a):t.insert(e)).then(function(e){e=e.row;t.setEditCell?t.setEditCell(e,o[1]||n):t.setActiveCell(e,o[1]||n.field)})}},INSERT_AT_EDIT_ROW:{tableMenuMethod:function(e){var t=e.$table,a=e.row,n=e.column,o=e.menu.params||[],e=Object.assign({},o[0]||{});(a?t.insertAt(e,a):t.insert(e)).then(function(e){e=e.row;t.setEditCell?t.setEditCell(e,o[1]||n):t.setActiveCell(e,o[1]||n.field)})}},BATCH_INSERT_AT_EDIT_ROW:{tableMenuMethod:function(e){var t=e.$table,a=e.row,n=e.column,o=e.menu.params||[];h().then(function(e){var e=e.size;e&&(e=i.default.range(0,e).map(function(){return Object.assign({},o[0])}),(a?t.insertAt(e,a):t.insert(e)).then(function(e){e=e.row;t.setEditCell?t.setEditCell(e,o[1]||n):t.setActiveCell(e,o[1]||n.field)}))})}},INSERT_NEXT_AT_EDIT_ROW:{tableMenuMethod:function(e){var t=e.$table,a=e.row,n=e.column,o=e.menu.params||[],e=Object.assign({},o[0]||{});(a?t.insertNextAt(e,a):t.insert(e)).then(function(e){e=e.row;t.setEditCell?t.setEditCell(e,o[1]||n):t.setActiveCell(e,o[1]||n.field)})}},BATCH_INSERT_NEXT_AT_EDIT_ROW:{tableMenuMethod:function(e){var t=e.$table,a=e.row,n=e.column,o=e.menu.params||[];h().then(function(e){var e=e.size;e&&(e=i.default.range(0,e).map(function(){return Object.assign({},o[0])}),(a?t.insertNextAt(e,a):t.insert(e)).then(function(e){e=e.row;t.setEditCell?t.setEditCell(e,o[1]||n):t.setActiveCell(e,o[1]||n.field)}))})}},DELETE_ROW:{tableMenuMethod:function(e){var t=e.$table,e=e.row;e&&t.remove(e)}},DELETE_AREA_ROW:{tableMenuMethod:function(e){var t=e.$table,e=e.row,a=t.props.mouseConfig,n=t.getComputeMaps().computeMouseOpts.value;b(a,n)&&n.area?t.getCellAreas().forEach(function(e){e=e.rows;t.remove(e)}):e&&t.remove(e)}},DELETE_CHECKBOX_ROW:{tableMenuMethod:function(e){e.$table.removeCheckboxRow()}},DELETE_ALL:{tableMenuMethod:function(e){e.$table.remove()}},CLEAR_SORT:{tableMenuMethod:function(e){var t=e.$event,a=e.$table,e=e.column;e&&a.triggerSortEvent(t,e,null)}},CLEAR_ALL_SORT:{tableMenuMethod: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:{tableMenuMethod:function(e){var t=e.$event,a=e.$table,e=e.column;e&&a.triggerSortEvent(t,e,"asc")}},SORT_DESC:{tableMenuMethod:function(e){var t=e.$event,a=e.$table,e=e.column;e&&a.triggerSortEvent(t,e,"desc")}},CLEAR_FILTER:{tableMenuMethod:function(e){var t=e.$event,a=e.$table,e=e.column;e&&(a.handleClearFilter(e),a.confirmFilterEvent(t))}},CLEAR_ALL_FILTER:{tableMenuMethod: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:{tableMenuMethod: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=i.default.get(n,t),e.checked=!0,a.updateData())}},EXPORT_ROW:{tableMenuMethod:function(e){var t=e.$table,a=e.menu,e=e.row;e&&t.exportData(i.default.assign({},a.params?a.params[0]:{},{data:[e]}))}},EXPORT_CHECKBOX_ROW:{tableMenuMethod:function(e){var t=e.$table,e=e.menu,a={data:t.getCheckboxRecords()};t.exportData(i.default.assign({},e.params?e.params[0]:{},a))}},EXPORT_ALL:{tableMenuMethod:function(e){e.$table.exportData(e.menu.params)}},PRINT_ALL:{tableMenuMethod:function(e){e.$table.print(e.menu.params)}},PRINT_CHECKBOX_ROW:{tableMenuMethod:function(e){var t=e.$table,e=e.menu,a={data:t.getCheckboxRecords()};t.print(i.default.assign(a,e.params))}},OPEN_FIND:{tableMenuMethod:function(e){var t=e.$event,e=e.$table;e.triggerFnrOpenEvent?e.triggerFnrOpenEvent(t,"find"):e.triggerFNROpenEvent(t,"find")}},OPEN_REPLACE:{tableMenuMethod:function(e){var t=e.$event,e=e.$table;e.triggerFnrOpenEvent?e.triggerFnrOpenEvent(t,"replace"):e.triggerFNROpenEvent(t,"replace")}},HIDDEN_COLUMN:{tableMenuMethod:function(e){var t=e.$table,e=e.column;e&&t.hideColumn(e)}},FIXED_LEFT_COLUMN:c("left"),FIXED_RIGHT_COLUMN:c("right"),CLEAR_FIXED_COLUMN:c(null),RESET_COLUMN:{tableMenuMethod:function(e){e.$table.resetColumn({visible:!0,resizable:!1})}},RESET_RESIZABLE:{tableMenuMethod:function(e){e.$table.resetColumn({visible:!1,resizable:!0})}},RESET_ALL:{tableMenuMethod:function(e){e.$table.resetColumn(!0)}},COMMIT_PROXY_INITIAL:{tableMenuMethod:C("initial")},COMMIT_PROXY_QUERY:{tableMenuMethod:C("query")},COMMIT_PROXY_RELOAD:{tableMenuMethod:C("reload")},COMMIT_PROXY_DELETE:{tableMenuMethod:C("delete")},COMMIT_PROXY_SAVE:{tableMenuMethod:C("save")}}),s.interceptor.add("event.showMenu",m)}},"undefined"!=typeof window&&window.VxeUI&&window.VxeUI.use&&window.VxeUI.use(e),n.default=e),a(r)});
|