@vxe-ui/plugin-menu 4.3.4 → 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 +35 -25
- package/dist/index.umd.min.js +1 -1
- package/es/index.esm.js +34 -25
- package/es/index.js +34 -25
- package/lib/index.common.js +35 -25
- package/lib/index.js +35 -25
- package/lib/index.umd.js +35 -25
- package/lib/index.umd.min.js +1 -1
- package/package.json +1 -1
- package/src/index.ts +33 -23
package/lib/index.js
CHANGED
|
@@ -4,11 +4,21 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports["default"] = exports.VxeUIPluginMenu = void 0;
|
|
7
|
+
exports.hasEnableConf = hasEnableConf;
|
|
7
8
|
var _xeUtils = _interopRequireDefault(require("xe-utils"));
|
|
8
9
|
var _vue = require("vue");
|
|
9
10
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { "default": e }; }
|
|
10
11
|
var VxeUI;
|
|
11
12
|
var handleCopy;
|
|
13
|
+
/**
|
|
14
|
+
* 用于开关类型的配置项
|
|
15
|
+
* 局部启用规则:conf={}
|
|
16
|
+
* 局部禁用规则:conf={enabled:false}
|
|
17
|
+
* 全局默认启用规则:conf.enabled=true
|
|
18
|
+
*/
|
|
19
|
+
function hasEnableConf(conf, opts) {
|
|
20
|
+
return opts && (conf ? opts.enabled !== false : opts.enabled);
|
|
21
|
+
}
|
|
12
22
|
var columnIndexOf = function columnIndexOf(cols, column) {
|
|
13
23
|
return _xeUtils["default"].findIndexOf(cols, function (item) {
|
|
14
24
|
return item.id === column.id;
|
|
@@ -89,7 +99,7 @@ function handleCopyOrCut(params, isCut) {
|
|
|
89
99
|
computeMouseOpts = _$table$getComputeMap.computeMouseOpts;
|
|
90
100
|
var mouseOpts = computeMouseOpts.value;
|
|
91
101
|
var text;
|
|
92
|
-
if (mouseConfig && mouseOpts.area) {
|
|
102
|
+
if (hasEnableConf(mouseConfig, mouseOpts) && mouseOpts.area) {
|
|
93
103
|
if (isCut) {
|
|
94
104
|
$table.triggerCutCellAreaEvent($event);
|
|
95
105
|
} else {
|
|
@@ -159,7 +169,7 @@ function getBeenMerges(params) {
|
|
|
159
169
|
visibleData = _$table$getTableData2.visibleData;
|
|
160
170
|
var _$table$getTableColum2 = $table.getTableColumn(),
|
|
161
171
|
visibleColumn = _$table$getTableColum2.visibleColumn;
|
|
162
|
-
var cellAreas = mouseConfig && mouseOpts.area ? $table.getCellAreas() : [];
|
|
172
|
+
var cellAreas = hasEnableConf(mouseConfig, mouseOpts) && mouseOpts.area ? $table.getCellAreas() : [];
|
|
163
173
|
var mergeList = $table.getMergeCells();
|
|
164
174
|
return mergeList.filter(function (_ref) {
|
|
165
175
|
var mergeRowIndex = _ref.row,
|
|
@@ -320,7 +330,7 @@ function checkPrivilege(item, params) {
|
|
|
320
330
|
case 'OPEN_FIND':
|
|
321
331
|
case 'OPEN_REPLACE':
|
|
322
332
|
{
|
|
323
|
-
item.disabled = !(mouseConfig && mouseOpts.area);
|
|
333
|
+
item.disabled = !(hasEnableConf(mouseConfig, mouseOpts) && mouseOpts.area);
|
|
324
334
|
break;
|
|
325
335
|
}
|
|
326
336
|
case 'EDIT_CELL':
|
|
@@ -335,7 +345,7 @@ function checkPrivilege(item, params) {
|
|
|
335
345
|
case 'PASTE_CELL':
|
|
336
346
|
case 'PASTE_AREA_CELL':
|
|
337
347
|
{
|
|
338
|
-
var cellAreas = mouseConfig && mouseOpts.area ? $table.getCellAreas() : [];
|
|
348
|
+
var cellAreas = hasEnableConf(mouseConfig, mouseOpts) && mouseOpts.area ? $table.getCellAreas() : [];
|
|
339
349
|
item.disabled = cellAreas.length > 1;
|
|
340
350
|
if (!item.disabled) {
|
|
341
351
|
switch (code) {
|
|
@@ -353,7 +363,7 @@ function checkPrivilege(item, params) {
|
|
|
353
363
|
case 'MERGE_OR_CLEAR':
|
|
354
364
|
case 'MERGE_CELL':
|
|
355
365
|
{
|
|
356
|
-
var _cellAreas = mouseConfig && mouseOpts.area ? $table.getCellAreas() : [];
|
|
366
|
+
var _cellAreas = hasEnableConf(mouseConfig, mouseOpts) && mouseOpts.area ? $table.getCellAreas() : [];
|
|
357
367
|
item.disabled = !_cellAreas.length || _cellAreas.length === 1 && _cellAreas[0].rows.length === 1 && _cellAreas[0].cols.length === 1 || !checkCellOverlay(params, _cellAreas);
|
|
358
368
|
break;
|
|
359
369
|
}
|
|
@@ -483,11 +493,11 @@ var VxeUIPluginMenu = exports.VxeUIPluginMenu = {
|
|
|
483
493
|
var pVersion = 4;
|
|
484
494
|
var sVersion = 11;
|
|
485
495
|
if (!VxeUI.checkVersion(VxeUI.tableVersion, pVersion, sVersion)) {
|
|
486
|
-
console.error("[@vxe-ui/plugin-menu 4.
|
|
496
|
+
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"));
|
|
487
497
|
}
|
|
488
498
|
} else {
|
|
489
499
|
if (!/^(4)\./.test(VxeUI.uiVersion || VxeUI.tableVersion)) {
|
|
490
|
-
console.error('[@vxe-ui/plugin-menu 4.
|
|
500
|
+
console.error('[@vxe-ui/plugin-menu 4.4.0] Requires vxe-table 4.7.0+ version. https://vxeui.com/other4/#/plugin-menu/install');
|
|
491
501
|
}
|
|
492
502
|
}
|
|
493
503
|
pluginSetup(options);
|
|
@@ -536,7 +546,7 @@ var VxeUIPluginMenu = exports.VxeUIPluginMenu = {
|
|
|
536
546
|
var _$table$getComputeMap4 = $table.getComputeMaps(),
|
|
537
547
|
computeMouseOpts = _$table$getComputeMap4.computeMouseOpts;
|
|
538
548
|
var mouseOpts = computeMouseOpts.value;
|
|
539
|
-
if (mouseConfig && mouseOpts.area) {
|
|
549
|
+
if (hasEnableConf(mouseConfig, mouseOpts) && mouseOpts.area) {
|
|
540
550
|
var cellAreas = $table.getCellAreas();
|
|
541
551
|
if (cellAreas && cellAreas.length) {
|
|
542
552
|
cellAreas.forEach(function (areaItem) {
|
|
@@ -569,7 +579,7 @@ var VxeUIPluginMenu = exports.VxeUIPluginMenu = {
|
|
|
569
579
|
var _$table$getComputeMap5 = $table.getComputeMaps(),
|
|
570
580
|
computeMouseOpts = _$table$getComputeMap5.computeMouseOpts;
|
|
571
581
|
var mouseOpts = computeMouseOpts.value;
|
|
572
|
-
if (mouseConfig && mouseOpts.area) {
|
|
582
|
+
if (hasEnableConf(mouseConfig, mouseOpts) && mouseOpts.area) {
|
|
573
583
|
var cellAreas = $table.getCellAreas();
|
|
574
584
|
if (cellAreas && cellAreas.length) {
|
|
575
585
|
cellAreas.forEach(function (areaItem) {
|
|
@@ -620,8 +630,8 @@ var VxeUIPluginMenu = exports.VxeUIPluginMenu = {
|
|
|
620
630
|
var _$table$getComputeMap6 = $table.getComputeMaps(),
|
|
621
631
|
computeMouseOpts = _$table$getComputeMap6.computeMouseOpts;
|
|
622
632
|
var mouseOpts = computeMouseOpts.value;
|
|
623
|
-
if (mouseConfig && mouseOpts.area) {
|
|
624
|
-
var cellAreas =
|
|
633
|
+
if (hasEnableConf(mouseConfig, mouseOpts) && mouseOpts.area) {
|
|
634
|
+
var cellAreas = mouseOpts.area ? $table.getCellAreas() : [];
|
|
625
635
|
cellAreas.forEach(function (areaItem) {
|
|
626
636
|
var rows = areaItem.rows;
|
|
627
637
|
$table.clearData(rows);
|
|
@@ -653,7 +663,7 @@ var VxeUIPluginMenu = exports.VxeUIPluginMenu = {
|
|
|
653
663
|
var _$table$getComputeMap7 = $table.getComputeMaps(),
|
|
654
664
|
computeMouseOpts = _$table$getComputeMap7.computeMouseOpts;
|
|
655
665
|
var mouseOpts = computeMouseOpts.value;
|
|
656
|
-
if (mouseConfig && mouseOpts.area) {
|
|
666
|
+
if (hasEnableConf(mouseConfig, mouseOpts) && mouseOpts.area) {
|
|
657
667
|
var _$table$getTableData4 = $table.getTableData(),
|
|
658
668
|
visibleData = _$table$getTableData4.visibleData;
|
|
659
669
|
var _$table$getTableColum4 = $table.getTableColumn(),
|
|
@@ -680,7 +690,7 @@ var VxeUIPluginMenu = exports.VxeUIPluginMenu = {
|
|
|
680
690
|
var _$table$getComputeMap8 = $table.getComputeMaps(),
|
|
681
691
|
computeMouseOpts = _$table$getComputeMap8.computeMouseOpts;
|
|
682
692
|
var mouseOpts = computeMouseOpts.value;
|
|
683
|
-
if (row && column && mouseConfig && mouseOpts.area) {
|
|
693
|
+
if (row && column && hasEnableConf(mouseConfig, mouseOpts) && mouseOpts.area) {
|
|
684
694
|
var _$table$getTableColum5 = $table.getTableColumn(),
|
|
685
695
|
visibleColumn = _$table$getTableColum5.visibleColumn;
|
|
686
696
|
var cellAreas = $table.getCellAreas();
|
|
@@ -722,7 +732,7 @@ var VxeUIPluginMenu = exports.VxeUIPluginMenu = {
|
|
|
722
732
|
var _$table$getComputeMap9 = $table.getComputeMaps(),
|
|
723
733
|
computeMouseOpts = _$table$getComputeMap9.computeMouseOpts;
|
|
724
734
|
var mouseOpts = computeMouseOpts.value;
|
|
725
|
-
if (row && column && mouseConfig && mouseOpts.area) {
|
|
735
|
+
if (row && column && hasEnableConf(mouseConfig, mouseOpts) && mouseOpts.area) {
|
|
726
736
|
var _$table$getTableColum6 = $table.getTableColumn(),
|
|
727
737
|
visibleColumn = _$table$getTableColum6.visibleColumn;
|
|
728
738
|
var cellAreas = $table.getCellAreas();
|
|
@@ -764,7 +774,7 @@ var VxeUIPluginMenu = exports.VxeUIPluginMenu = {
|
|
|
764
774
|
var _$table$getComputeMap0 = $table.getComputeMaps(),
|
|
765
775
|
computeMouseOpts = _$table$getComputeMap0.computeMouseOpts;
|
|
766
776
|
var mouseOpts = computeMouseOpts.value;
|
|
767
|
-
if (row && column && mouseConfig && mouseOpts.area) {
|
|
777
|
+
if (row && column && hasEnableConf(mouseConfig, mouseOpts) && mouseOpts.area) {
|
|
768
778
|
var _$table$getTableData5 = $table.getTableData(),
|
|
769
779
|
visibleData = _$table$getTableData5.visibleData;
|
|
770
780
|
var cellAreas = $table.getCellAreas();
|
|
@@ -806,7 +816,7 @@ var VxeUIPluginMenu = exports.VxeUIPluginMenu = {
|
|
|
806
816
|
var _$table$getComputeMap1 = $table.getComputeMaps(),
|
|
807
817
|
computeMouseOpts = _$table$getComputeMap1.computeMouseOpts;
|
|
808
818
|
var mouseOpts = computeMouseOpts.value;
|
|
809
|
-
if (row && column && mouseConfig && mouseOpts.area) {
|
|
819
|
+
if (row && column && hasEnableConf(mouseConfig, mouseOpts) && mouseOpts.area) {
|
|
810
820
|
var _$table$getTableData6 = $table.getTableData(),
|
|
811
821
|
visibleData = _$table$getTableData6.visibleData;
|
|
812
822
|
var cellAreas = $table.getCellAreas();
|
|
@@ -849,7 +859,7 @@ var VxeUIPluginMenu = exports.VxeUIPluginMenu = {
|
|
|
849
859
|
var _$table$getComputeMap10 = $table.getComputeMaps(),
|
|
850
860
|
computeMouseOpts = _$table$getComputeMap10.computeMouseOpts;
|
|
851
861
|
var mouseOpts = computeMouseOpts.value;
|
|
852
|
-
if (mouseConfig && mouseOpts.area) {
|
|
862
|
+
if (hasEnableConf(mouseConfig, mouseOpts) && mouseOpts.area) {
|
|
853
863
|
var cellAreas = $table.getCellAreas();
|
|
854
864
|
if (cellAreas && cellAreas.length) {
|
|
855
865
|
cellAreas.forEach(function (areaItem) {
|
|
@@ -961,7 +971,7 @@ var VxeUIPluginMenu = exports.VxeUIPluginMenu = {
|
|
|
961
971
|
var _$table$getComputeMap11 = $table.getComputeMaps(),
|
|
962
972
|
computeMouseOpts = _$table$getComputeMap11.computeMouseOpts;
|
|
963
973
|
var mouseOpts = computeMouseOpts.value;
|
|
964
|
-
if (mouseConfig && mouseOpts.area) {
|
|
974
|
+
if (hasEnableConf(mouseConfig, mouseOpts) && mouseOpts.area) {
|
|
965
975
|
$table.triggerPasteCellAreaEvent($event);
|
|
966
976
|
} else {
|
|
967
977
|
var clipboard = getClipboardObj();
|
|
@@ -984,7 +994,7 @@ var VxeUIPluginMenu = exports.VxeUIPluginMenu = {
|
|
|
984
994
|
var _$table$getComputeMap12 = $table.getComputeMaps(),
|
|
985
995
|
computeMouseOpts = _$table$getComputeMap12.computeMouseOpts;
|
|
986
996
|
var mouseOpts = computeMouseOpts.value;
|
|
987
|
-
if (mouseConfig && mouseOpts.area) {
|
|
997
|
+
if (hasEnableConf(mouseConfig, mouseOpts) && mouseOpts.area) {
|
|
988
998
|
$table.triggerPasteCellAreaEvent($event);
|
|
989
999
|
}
|
|
990
1000
|
}
|
|
@@ -1157,7 +1167,7 @@ var VxeUIPluginMenu = exports.VxeUIPluginMenu = {
|
|
|
1157
1167
|
var mouseOpts = computeMouseOpts.value;
|
|
1158
1168
|
$table.insert(menu.params || {}).then(function (_ref7) {
|
|
1159
1169
|
var rows = _ref7.rows;
|
|
1160
|
-
if (column && mouseConfig && mouseOpts.area) {
|
|
1170
|
+
if (column && hasEnableConf(mouseConfig, mouseOpts) && mouseOpts.area) {
|
|
1161
1171
|
$table.setCellAreas([{
|
|
1162
1172
|
startRow: _xeUtils["default"].first(rows),
|
|
1163
1173
|
endRow: _xeUtils["default"].last(rows),
|
|
@@ -1184,7 +1194,7 @@ var VxeUIPluginMenu = exports.VxeUIPluginMenu = {
|
|
|
1184
1194
|
var mouseOpts = computeMouseOpts.value;
|
|
1185
1195
|
(row ? $table.insertAt(menu.params || {}, row) : $table.insert(menu.params || {})).then(function (_ref8) {
|
|
1186
1196
|
var rows = _ref8.rows;
|
|
1187
|
-
if (column && mouseConfig && mouseOpts.area) {
|
|
1197
|
+
if (column && hasEnableConf(mouseConfig, mouseOpts) && mouseOpts.area) {
|
|
1188
1198
|
$table.setCellAreas([{
|
|
1189
1199
|
startRow: _xeUtils["default"].first(rows),
|
|
1190
1200
|
endRow: _xeUtils["default"].last(rows),
|
|
@@ -1217,7 +1227,7 @@ var VxeUIPluginMenu = exports.VxeUIPluginMenu = {
|
|
|
1217
1227
|
});
|
|
1218
1228
|
(row ? $table.insertAt(records, row) : $table.insert(records)).then(function (_ref0) {
|
|
1219
1229
|
var rows = _ref0.rows;
|
|
1220
|
-
if (column && mouseConfig && mouseOpts.area) {
|
|
1230
|
+
if (column && hasEnableConf(mouseConfig, mouseOpts) && mouseOpts.area) {
|
|
1221
1231
|
$table.setCellAreas([{
|
|
1222
1232
|
startRow: _xeUtils["default"].first(rows),
|
|
1223
1233
|
endRow: _xeUtils["default"].last(rows),
|
|
@@ -1246,7 +1256,7 @@ var VxeUIPluginMenu = exports.VxeUIPluginMenu = {
|
|
|
1246
1256
|
var mouseOpts = computeMouseOpts.value;
|
|
1247
1257
|
(row ? $table.insertNextAt(menu.params || {}, row) : $table.insert(menu.params || {})).then(function (_ref1) {
|
|
1248
1258
|
var rows = _ref1.rows;
|
|
1249
|
-
if (column && mouseConfig && mouseOpts.area) {
|
|
1259
|
+
if (column && hasEnableConf(mouseConfig, mouseOpts) && mouseOpts.area) {
|
|
1250
1260
|
$table.setCellAreas([{
|
|
1251
1261
|
startRow: _xeUtils["default"].first(rows),
|
|
1252
1262
|
endRow: _xeUtils["default"].last(rows),
|
|
@@ -1279,7 +1289,7 @@ var VxeUIPluginMenu = exports.VxeUIPluginMenu = {
|
|
|
1279
1289
|
});
|
|
1280
1290
|
(row ? $table.insertNextAt(records, row) : $table.insert(records)).then(function (_ref11) {
|
|
1281
1291
|
var rows = _ref11.rows;
|
|
1282
|
-
if (column && mouseConfig && mouseOpts.area) {
|
|
1292
|
+
if (column && hasEnableConf(mouseConfig, mouseOpts) && mouseOpts.area) {
|
|
1283
1293
|
$table.setCellAreas([{
|
|
1284
1294
|
startRow: _xeUtils["default"].first(rows),
|
|
1285
1295
|
endRow: _xeUtils["default"].last(rows),
|
|
@@ -1484,7 +1494,7 @@ var VxeUIPluginMenu = exports.VxeUIPluginMenu = {
|
|
|
1484
1494
|
var _$table$getComputeMap18 = $table.getComputeMaps(),
|
|
1485
1495
|
computeMouseOpts = _$table$getComputeMap18.computeMouseOpts;
|
|
1486
1496
|
var mouseOpts = computeMouseOpts.value;
|
|
1487
|
-
if (mouseConfig && mouseOpts.area) {
|
|
1497
|
+
if (hasEnableConf(mouseConfig, mouseOpts) && mouseOpts.area) {
|
|
1488
1498
|
var cellAreas = $table.getCellAreas();
|
|
1489
1499
|
cellAreas.forEach(function (areaItem) {
|
|
1490
1500
|
var rows = areaItem.rows;
|
package/lib/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;
|
|
@@ -106,7 +116,7 @@
|
|
|
106
116
|
computeMouseOpts = _$table$getComputeMap.computeMouseOpts;
|
|
107
117
|
var mouseOpts = computeMouseOpts.value;
|
|
108
118
|
var text;
|
|
109
|
-
if (mouseConfig && mouseOpts.area) {
|
|
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,
|
|
@@ -337,7 +347,7 @@
|
|
|
337
347
|
case 'OPEN_FIND':
|
|
338
348
|
case 'OPEN_REPLACE':
|
|
339
349
|
{
|
|
340
|
-
item.disabled = !(mouseConfig && mouseOpts.area);
|
|
350
|
+
item.disabled = !(hasEnableConf(mouseConfig, mouseOpts) && mouseOpts.area);
|
|
341
351
|
break;
|
|
342
352
|
}
|
|
343
353
|
case 'EDIT_CELL':
|
|
@@ -352,7 +362,7 @@
|
|
|
352
362
|
case 'PASTE_CELL':
|
|
353
363
|
case 'PASTE_AREA_CELL':
|
|
354
364
|
{
|
|
355
|
-
var cellAreas = mouseConfig && mouseOpts.area ? $table.getCellAreas() : [];
|
|
365
|
+
var cellAreas = hasEnableConf(mouseConfig, mouseOpts) && mouseOpts.area ? $table.getCellAreas() : [];
|
|
356
366
|
item.disabled = cellAreas.length > 1;
|
|
357
367
|
if (!item.disabled) {
|
|
358
368
|
switch (code) {
|
|
@@ -370,7 +380,7 @@
|
|
|
370
380
|
case 'MERGE_OR_CLEAR':
|
|
371
381
|
case 'MERGE_CELL':
|
|
372
382
|
{
|
|
373
|
-
var _cellAreas = mouseConfig && mouseOpts.area ? $table.getCellAreas() : [];
|
|
383
|
+
var _cellAreas = hasEnableConf(mouseConfig, mouseOpts) && mouseOpts.area ? $table.getCellAreas() : [];
|
|
374
384
|
item.disabled = !_cellAreas.length || _cellAreas.length === 1 && _cellAreas[0].rows.length === 1 && _cellAreas[0].cols.length === 1 || !checkCellOverlay(params, _cellAreas);
|
|
375
385
|
break;
|
|
376
386
|
}
|
|
@@ -500,11 +510,11 @@
|
|
|
500
510
|
var pVersion = 4;
|
|
501
511
|
var sVersion = 11;
|
|
502
512
|
if (!VxeUI.checkVersion(VxeUI.tableVersion, pVersion, sVersion)) {
|
|
503
|
-
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"));
|
|
504
514
|
}
|
|
505
515
|
} else {
|
|
506
516
|
if (!/^(4)\./.test(VxeUI.uiVersion || VxeUI.tableVersion)) {
|
|
507
|
-
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');
|
|
508
518
|
}
|
|
509
519
|
}
|
|
510
520
|
pluginSetup(options);
|
|
@@ -553,7 +563,7 @@
|
|
|
553
563
|
var _$table$getComputeMap4 = $table.getComputeMaps(),
|
|
554
564
|
computeMouseOpts = _$table$getComputeMap4.computeMouseOpts;
|
|
555
565
|
var mouseOpts = computeMouseOpts.value;
|
|
556
|
-
if (mouseConfig && mouseOpts.area) {
|
|
566
|
+
if (hasEnableConf(mouseConfig, mouseOpts) && mouseOpts.area) {
|
|
557
567
|
var cellAreas = $table.getCellAreas();
|
|
558
568
|
if (cellAreas && cellAreas.length) {
|
|
559
569
|
cellAreas.forEach(function (areaItem) {
|
|
@@ -586,7 +596,7 @@
|
|
|
586
596
|
var _$table$getComputeMap5 = $table.getComputeMaps(),
|
|
587
597
|
computeMouseOpts = _$table$getComputeMap5.computeMouseOpts;
|
|
588
598
|
var mouseOpts = computeMouseOpts.value;
|
|
589
|
-
if (mouseConfig && mouseOpts.area) {
|
|
599
|
+
if (hasEnableConf(mouseConfig, mouseOpts) && mouseOpts.area) {
|
|
590
600
|
var cellAreas = $table.getCellAreas();
|
|
591
601
|
if (cellAreas && cellAreas.length) {
|
|
592
602
|
cellAreas.forEach(function (areaItem) {
|
|
@@ -637,8 +647,8 @@
|
|
|
637
647
|
var _$table$getComputeMap6 = $table.getComputeMaps(),
|
|
638
648
|
computeMouseOpts = _$table$getComputeMap6.computeMouseOpts;
|
|
639
649
|
var mouseOpts = computeMouseOpts.value;
|
|
640
|
-
if (mouseConfig && mouseOpts.area) {
|
|
641
|
-
var cellAreas =
|
|
650
|
+
if (hasEnableConf(mouseConfig, mouseOpts) && mouseOpts.area) {
|
|
651
|
+
var cellAreas = mouseOpts.area ? $table.getCellAreas() : [];
|
|
642
652
|
cellAreas.forEach(function (areaItem) {
|
|
643
653
|
var rows = areaItem.rows;
|
|
644
654
|
$table.clearData(rows);
|
|
@@ -670,7 +680,7 @@
|
|
|
670
680
|
var _$table$getComputeMap7 = $table.getComputeMaps(),
|
|
671
681
|
computeMouseOpts = _$table$getComputeMap7.computeMouseOpts;
|
|
672
682
|
var mouseOpts = computeMouseOpts.value;
|
|
673
|
-
if (mouseConfig && mouseOpts.area) {
|
|
683
|
+
if (hasEnableConf(mouseConfig, mouseOpts) && mouseOpts.area) {
|
|
674
684
|
var _$table$getTableData4 = $table.getTableData(),
|
|
675
685
|
visibleData = _$table$getTableData4.visibleData;
|
|
676
686
|
var _$table$getTableColum4 = $table.getTableColumn(),
|
|
@@ -697,7 +707,7 @@
|
|
|
697
707
|
var _$table$getComputeMap8 = $table.getComputeMaps(),
|
|
698
708
|
computeMouseOpts = _$table$getComputeMap8.computeMouseOpts;
|
|
699
709
|
var mouseOpts = computeMouseOpts.value;
|
|
700
|
-
if (row && column && mouseConfig && mouseOpts.area) {
|
|
710
|
+
if (row && column && hasEnableConf(mouseConfig, mouseOpts) && mouseOpts.area) {
|
|
701
711
|
var _$table$getTableColum5 = $table.getTableColumn(),
|
|
702
712
|
visibleColumn = _$table$getTableColum5.visibleColumn;
|
|
703
713
|
var cellAreas = $table.getCellAreas();
|
|
@@ -739,7 +749,7 @@
|
|
|
739
749
|
var _$table$getComputeMap9 = $table.getComputeMaps(),
|
|
740
750
|
computeMouseOpts = _$table$getComputeMap9.computeMouseOpts;
|
|
741
751
|
var mouseOpts = computeMouseOpts.value;
|
|
742
|
-
if (row && column && mouseConfig && mouseOpts.area) {
|
|
752
|
+
if (row && column && hasEnableConf(mouseConfig, mouseOpts) && mouseOpts.area) {
|
|
743
753
|
var _$table$getTableColum6 = $table.getTableColumn(),
|
|
744
754
|
visibleColumn = _$table$getTableColum6.visibleColumn;
|
|
745
755
|
var cellAreas = $table.getCellAreas();
|
|
@@ -781,7 +791,7 @@
|
|
|
781
791
|
var _$table$getComputeMap0 = $table.getComputeMaps(),
|
|
782
792
|
computeMouseOpts = _$table$getComputeMap0.computeMouseOpts;
|
|
783
793
|
var mouseOpts = computeMouseOpts.value;
|
|
784
|
-
if (row && column && mouseConfig && mouseOpts.area) {
|
|
794
|
+
if (row && column && hasEnableConf(mouseConfig, mouseOpts) && mouseOpts.area) {
|
|
785
795
|
var _$table$getTableData5 = $table.getTableData(),
|
|
786
796
|
visibleData = _$table$getTableData5.visibleData;
|
|
787
797
|
var cellAreas = $table.getCellAreas();
|
|
@@ -823,7 +833,7 @@
|
|
|
823
833
|
var _$table$getComputeMap1 = $table.getComputeMaps(),
|
|
824
834
|
computeMouseOpts = _$table$getComputeMap1.computeMouseOpts;
|
|
825
835
|
var mouseOpts = computeMouseOpts.value;
|
|
826
|
-
if (row && column && mouseConfig && mouseOpts.area) {
|
|
836
|
+
if (row && column && hasEnableConf(mouseConfig, mouseOpts) && mouseOpts.area) {
|
|
827
837
|
var _$table$getTableData6 = $table.getTableData(),
|
|
828
838
|
visibleData = _$table$getTableData6.visibleData;
|
|
829
839
|
var cellAreas = $table.getCellAreas();
|
|
@@ -866,7 +876,7 @@
|
|
|
866
876
|
var _$table$getComputeMap10 = $table.getComputeMaps(),
|
|
867
877
|
computeMouseOpts = _$table$getComputeMap10.computeMouseOpts;
|
|
868
878
|
var mouseOpts = computeMouseOpts.value;
|
|
869
|
-
if (mouseConfig && mouseOpts.area) {
|
|
879
|
+
if (hasEnableConf(mouseConfig, mouseOpts) && mouseOpts.area) {
|
|
870
880
|
var cellAreas = $table.getCellAreas();
|
|
871
881
|
if (cellAreas && cellAreas.length) {
|
|
872
882
|
cellAreas.forEach(function (areaItem) {
|
|
@@ -978,7 +988,7 @@
|
|
|
978
988
|
var _$table$getComputeMap11 = $table.getComputeMaps(),
|
|
979
989
|
computeMouseOpts = _$table$getComputeMap11.computeMouseOpts;
|
|
980
990
|
var mouseOpts = computeMouseOpts.value;
|
|
981
|
-
if (mouseConfig && mouseOpts.area) {
|
|
991
|
+
if (hasEnableConf(mouseConfig, mouseOpts) && mouseOpts.area) {
|
|
982
992
|
$table.triggerPasteCellAreaEvent($event);
|
|
983
993
|
} else {
|
|
984
994
|
var clipboard = getClipboardObj();
|
|
@@ -1001,7 +1011,7 @@
|
|
|
1001
1011
|
var _$table$getComputeMap12 = $table.getComputeMaps(),
|
|
1002
1012
|
computeMouseOpts = _$table$getComputeMap12.computeMouseOpts;
|
|
1003
1013
|
var mouseOpts = computeMouseOpts.value;
|
|
1004
|
-
if (mouseConfig && mouseOpts.area) {
|
|
1014
|
+
if (hasEnableConf(mouseConfig, mouseOpts) && mouseOpts.area) {
|
|
1005
1015
|
$table.triggerPasteCellAreaEvent($event);
|
|
1006
1016
|
}
|
|
1007
1017
|
}
|
|
@@ -1174,7 +1184,7 @@
|
|
|
1174
1184
|
var mouseOpts = computeMouseOpts.value;
|
|
1175
1185
|
$table.insert(menu.params || {}).then(function (_ref7) {
|
|
1176
1186
|
var rows = _ref7.rows;
|
|
1177
|
-
if (column && mouseConfig && mouseOpts.area) {
|
|
1187
|
+
if (column && hasEnableConf(mouseConfig, mouseOpts) && mouseOpts.area) {
|
|
1178
1188
|
$table.setCellAreas([{
|
|
1179
1189
|
startRow: _xeUtils["default"].first(rows),
|
|
1180
1190
|
endRow: _xeUtils["default"].last(rows),
|
|
@@ -1201,7 +1211,7 @@
|
|
|
1201
1211
|
var mouseOpts = computeMouseOpts.value;
|
|
1202
1212
|
(row ? $table.insertAt(menu.params || {}, row) : $table.insert(menu.params || {})).then(function (_ref8) {
|
|
1203
1213
|
var rows = _ref8.rows;
|
|
1204
|
-
if (column && mouseConfig && mouseOpts.area) {
|
|
1214
|
+
if (column && hasEnableConf(mouseConfig, mouseOpts) && mouseOpts.area) {
|
|
1205
1215
|
$table.setCellAreas([{
|
|
1206
1216
|
startRow: _xeUtils["default"].first(rows),
|
|
1207
1217
|
endRow: _xeUtils["default"].last(rows),
|
|
@@ -1234,7 +1244,7 @@
|
|
|
1234
1244
|
});
|
|
1235
1245
|
(row ? $table.insertAt(records, row) : $table.insert(records)).then(function (_ref0) {
|
|
1236
1246
|
var rows = _ref0.rows;
|
|
1237
|
-
if (column && mouseConfig && mouseOpts.area) {
|
|
1247
|
+
if (column && hasEnableConf(mouseConfig, mouseOpts) && mouseOpts.area) {
|
|
1238
1248
|
$table.setCellAreas([{
|
|
1239
1249
|
startRow: _xeUtils["default"].first(rows),
|
|
1240
1250
|
endRow: _xeUtils["default"].last(rows),
|
|
@@ -1263,7 +1273,7 @@
|
|
|
1263
1273
|
var mouseOpts = computeMouseOpts.value;
|
|
1264
1274
|
(row ? $table.insertNextAt(menu.params || {}, row) : $table.insert(menu.params || {})).then(function (_ref1) {
|
|
1265
1275
|
var rows = _ref1.rows;
|
|
1266
|
-
if (column && mouseConfig && mouseOpts.area) {
|
|
1276
|
+
if (column && hasEnableConf(mouseConfig, mouseOpts) && mouseOpts.area) {
|
|
1267
1277
|
$table.setCellAreas([{
|
|
1268
1278
|
startRow: _xeUtils["default"].first(rows),
|
|
1269
1279
|
endRow: _xeUtils["default"].last(rows),
|
|
@@ -1296,7 +1306,7 @@
|
|
|
1296
1306
|
});
|
|
1297
1307
|
(row ? $table.insertNextAt(records, row) : $table.insert(records)).then(function (_ref11) {
|
|
1298
1308
|
var rows = _ref11.rows;
|
|
1299
|
-
if (column && mouseConfig && mouseOpts.area) {
|
|
1309
|
+
if (column && hasEnableConf(mouseConfig, mouseOpts) && mouseOpts.area) {
|
|
1300
1310
|
$table.setCellAreas([{
|
|
1301
1311
|
startRow: _xeUtils["default"].first(rows),
|
|
1302
1312
|
endRow: _xeUtils["default"].last(rows),
|
|
@@ -1501,7 +1511,7 @@
|
|
|
1501
1511
|
var _$table$getComputeMap18 = $table.getComputeMaps(),
|
|
1502
1512
|
computeMouseOpts = _$table$getComputeMap18.computeMouseOpts;
|
|
1503
1513
|
var mouseOpts = computeMouseOpts.value;
|
|
1504
|
-
if (mouseConfig && mouseOpts.area) {
|
|
1514
|
+
if (hasEnableConf(mouseConfig, mouseOpts) && mouseOpts.area) {
|
|
1505
1515
|
var cellAreas = $table.getCellAreas();
|
|
1506
1516
|
cellAreas.forEach(function (areaItem) {
|
|
1507
1517
|
var rows = areaItem.rows;
|
package/lib/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,o,l,_,R,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 b(){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,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,l=e.$event,r=e.$table,s=e.row,e=e.column;s&&e&&(a=r.props.mouseConfig,o=r.getComputeMaps().computeMouseOpts.value,a&&o.area?(t?r.triggerCutCellAreaEvent(l):r.triggerCopyCellAreaEvent(l),n=(a=b())?a.text:""):(n=c.default.toValueString(c.default.get(s,e.field)),o={text:n,html:""},(t=u.globalStore)?t.clipboard=o:u.config&&(u.config.clipboard=o)),(c.default.isFunction(i)?i:d)(n))}function C(t){return function(e){e=e.$grid;e&&e.commitProxy(t)}}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=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=p(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=p(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=!(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=c&&C.area?n.getCellAreas():[];if(e.disabled=1<M.length,!e.disabled)switch(a){case"PASTE_CELL":case"PASTE_AREA_CELL":var m=b();e.disabled=!m||!m.text}break;case"MERGE_OR_CLEAR":case"MERGE_CELL":M=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 g(){return new Promise(function(t){var e,a;u.modal?(e=u.getComponent("VxeNumberInput"))?(a=(0,o.ref)(1),u.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(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 A(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},o=t,_=function(e,t){return c.default.findIndexOf(e,function(e){return e.id===t.id})},R=function(e,t,a){return e.findRowIndexOf(t,a)},e=n.VxeUIPluginMenu={setConfig:A,install:function(e,t){(u=e).checkVersion?u.checkVersion(u.tableVersion,4,11)||console.error("[@vxe-ui/plugin-menu 4.3.4] ".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.4] Requires vxe-table 4.7.0+ version. https://vxeui.com/other4/#/plugin-menu/install"),A(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,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_AREA_CELL:{tableMenuMethod:function(e){var t,n=e.$table;e.row&&e.column&&(e=n.props.mouseConfig,t=n.getComputeMaps().computeMouseOpts.value,e)&&t.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;n&&o.area?(n&&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;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,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:c.default.first(o.rows),endRow:c.default.last(o.rows),startColumn:c.default.first(n),endColumn:c.default.last(o.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,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:c.default.first(o.rows),endRow:c.default.last(o.rows),startColumn:c.default.first(o.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,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:c.default.first(n),endRow:c.default.last(o.rows),startColumn:c.default.first(o.cols),endColumn:c.default.last(o.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,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:c.default.first(o.rows),endRow:c.default.last(n),startColumn:c.default.first(o.cols),endColumn:c.default.last(o.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,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:{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)}},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;o&&l.area?a.triggerPasteCellAreaEvent(t):(o=b())&&o.text&&c.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;a&&n.area&&e.triggerPasteCellAreaEvent(t)}},MERGE_OR_CLEAR:{tableMenuMethod: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:{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})?u.modal&&u.modal.message({content:u.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&&o&&l.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,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&&l&&r.area&&t.setCellAreas([{startRow:c.default.first(e),endRow:c.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;g().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;o&&l&&r.area&&t.setCellAreas([{startRow:c.default.first(e),endRow:c.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&&l&&r.area&&t.setCellAreas([{startRow:c.default.first(e),endRow:c.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;g().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;o&&l&&r.area&&t.setCellAreas([{startRow:c.default.first(e),endRow:c.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||[];g().then(function(e){var e=e.size;e&&(e=c.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||[];g().then(function(e){var e=e.size;e&&(e=c.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;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: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")}}),u.interceptor.add("event.showMenu",m)}},"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)});
|