@vxe-ui/plugin-menu 3.3.4 → 3.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 +36 -26
- package/dist/index.umd.min.js +1 -1
- package/es/index.esm.js +35 -26
- package/es/index.js +35 -26
- package/lib/index.common.js +36 -26
- package/lib/index.js +36 -26
- package/lib/index.umd.js +36 -26
- package/lib/index.umd.min.js +1 -1
- package/package.json +1 -1
- package/src/index.ts +34 -24
package/lib/index.js
CHANGED
|
@@ -4,10 +4,20 @@ 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
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { "default": e }; }
|
|
9
10
|
var VxeUI;
|
|
10
11
|
var handleCopy;
|
|
12
|
+
/**
|
|
13
|
+
* 用于开关类型的配置项
|
|
14
|
+
* 局部启用规则:conf={}
|
|
15
|
+
* 局部禁用规则:conf={enabled:false}
|
|
16
|
+
* 全局默认启用规则:conf.enabled=true
|
|
17
|
+
*/
|
|
18
|
+
function hasEnableConf(conf, opts) {
|
|
19
|
+
return opts && (conf ? opts.enabled !== false : opts.enabled);
|
|
20
|
+
}
|
|
11
21
|
var columnIndexOf = function columnIndexOf(cols, column) {
|
|
12
22
|
return _xeUtils["default"].findIndexOf(cols, function (item) {
|
|
13
23
|
return item.id === column.id;
|
|
@@ -86,7 +96,7 @@ function handleCopyOrCut(params, isCut) {
|
|
|
86
96
|
var mouseConfig = props.mouseConfig;
|
|
87
97
|
var mouseOpts = $table.computeMouseOpts;
|
|
88
98
|
var text = '';
|
|
89
|
-
if (mouseConfig && mouseOpts.area) {
|
|
99
|
+
if (hasEnableConf(mouseConfig, mouseOpts) && mouseOpts.area) {
|
|
90
100
|
if (isCut) {
|
|
91
101
|
$table.triggerCutCellAreaEvent($event);
|
|
92
102
|
} else {
|
|
@@ -154,7 +164,7 @@ function getBeenMerges(params) {
|
|
|
154
164
|
visibleData = _$table$getTableData2.visibleData;
|
|
155
165
|
var _$table$getTableColum2 = $table.getTableColumn(),
|
|
156
166
|
visibleColumn = _$table$getTableColum2.visibleColumn;
|
|
157
|
-
var cellAreas = mouseConfig && mouseOpts.area ? $table.getCellAreas() : [];
|
|
167
|
+
var cellAreas = hasEnableConf(mouseConfig, mouseOpts) && mouseOpts.area ? $table.getCellAreas() : [];
|
|
158
168
|
var mergeList = $table.getMergeCells();
|
|
159
169
|
return mergeList.filter(function (_ref) {
|
|
160
170
|
var mergeRowIndex = _ref.row,
|
|
@@ -313,7 +323,7 @@ function checkPrivilege(item, params) {
|
|
|
313
323
|
case 'OPEN_FIND':
|
|
314
324
|
case 'OPEN_REPLACE':
|
|
315
325
|
{
|
|
316
|
-
item.disabled = !(mouseConfig && mouseOpts.area);
|
|
326
|
+
item.disabled = !(hasEnableConf(mouseConfig, mouseOpts) && mouseOpts.area);
|
|
317
327
|
break;
|
|
318
328
|
}
|
|
319
329
|
case 'EDIT_CELL':
|
|
@@ -328,7 +338,7 @@ function checkPrivilege(item, params) {
|
|
|
328
338
|
case 'PASTE_CELL':
|
|
329
339
|
case 'PASTE_AREA_CELL':
|
|
330
340
|
{
|
|
331
|
-
var cellAreas = mouseConfig && mouseOpts.area ? $table.getCellAreas() : [];
|
|
341
|
+
var cellAreas = hasEnableConf(mouseConfig, mouseOpts) && mouseOpts.area ? $table.getCellAreas() : [];
|
|
332
342
|
item.disabled = cellAreas.length > 1;
|
|
333
343
|
if (!item.disabled) {
|
|
334
344
|
switch (code) {
|
|
@@ -346,7 +356,7 @@ function checkPrivilege(item, params) {
|
|
|
346
356
|
case 'MERGE_OR_CLEAR':
|
|
347
357
|
case 'MERGE_CELL':
|
|
348
358
|
{
|
|
349
|
-
var _cellAreas = mouseConfig && mouseOpts.area ? $table.getCellAreas() : [];
|
|
359
|
+
var _cellAreas = hasEnableConf(mouseConfig, mouseOpts) && mouseOpts.area ? $table.getCellAreas() : [];
|
|
350
360
|
item.disabled = !_cellAreas.length || _cellAreas.length === 1 && _cellAreas[0].rows.length === 1 && _cellAreas[0].cols.length === 1 || !checkCellOverlay(params, _cellAreas);
|
|
351
361
|
break;
|
|
352
362
|
}
|
|
@@ -477,11 +487,11 @@ var VxeUIPluginMenu = exports.VxeUIPluginMenu = {
|
|
|
477
487
|
var pVersion = 3;
|
|
478
488
|
var sVersion = 13;
|
|
479
489
|
if (!VxeUI.checkVersion(VxeUI.tableVersion, pVersion, sVersion)) {
|
|
480
|
-
console.error("[@vxe-ui/plugin-menu 3.
|
|
490
|
+
console.error("[@vxe-ui/plugin-menu 3.4.0] ".concat(VxeUI.getI18n('vxe.error.errorVersion', ["vxe-table@".concat(VxeUI.tableVersion || '?'), "vxe-table v".concat(pVersion, ".").concat(sVersion, "+")])));
|
|
481
491
|
}
|
|
482
492
|
} else {
|
|
483
493
|
if (!/^(3)\./.test(VxeUI.uiVersion || VxeUI.tableVersion)) {
|
|
484
|
-
console.error('[@vxe-ui/plugin-menu 3.
|
|
494
|
+
console.error('[@vxe-ui/plugin-menu 3.4.0] Requires vxe-table 3.9.0+ version. https://vxeui.com/other3/#/plugin-menu/install');
|
|
485
495
|
}
|
|
486
496
|
}
|
|
487
497
|
pluginConfig(options);
|
|
@@ -528,7 +538,7 @@ var VxeUIPluginMenu = exports.VxeUIPluginMenu = {
|
|
|
528
538
|
var tableProps = $table;
|
|
529
539
|
var mouseConfig = tableProps.mouseConfig;
|
|
530
540
|
var mouseOpts = $table.computeMouseOpts;
|
|
531
|
-
if (mouseConfig && mouseOpts.area) {
|
|
541
|
+
if (hasEnableConf(mouseConfig, mouseOpts) && mouseOpts.area) {
|
|
532
542
|
var cellAreas = $table.getCellAreas();
|
|
533
543
|
if (cellAreas && cellAreas.length) {
|
|
534
544
|
cellAreas.forEach(function (areaItem) {
|
|
@@ -559,7 +569,7 @@ var VxeUIPluginMenu = exports.VxeUIPluginMenu = {
|
|
|
559
569
|
var tableProps = $table;
|
|
560
570
|
var mouseConfig = tableProps.mouseConfig;
|
|
561
571
|
var mouseOpts = $table.computeMouseOpts;
|
|
562
|
-
if (mouseConfig && mouseOpts.area) {
|
|
572
|
+
if (hasEnableConf(mouseConfig, mouseOpts) && mouseOpts.area) {
|
|
563
573
|
var cellAreas = $table.getCellAreas();
|
|
564
574
|
if (cellAreas && cellAreas.length) {
|
|
565
575
|
cellAreas.forEach(function (areaItem) {
|
|
@@ -610,8 +620,8 @@ var VxeUIPluginMenu = exports.VxeUIPluginMenu = {
|
|
|
610
620
|
var tableProps = $table;
|
|
611
621
|
var mouseConfig = tableProps.mouseConfig;
|
|
612
622
|
var mouseOpts = $table.computeMouseOpts;
|
|
613
|
-
if (mouseConfig && mouseOpts.area) {
|
|
614
|
-
var cellAreas =
|
|
623
|
+
if (hasEnableConf(mouseConfig, mouseOpts) && mouseOpts.area) {
|
|
624
|
+
var cellAreas = mouseOpts.area ? $table.getCellAreas() : [];
|
|
615
625
|
cellAreas.forEach(function (areaItem) {
|
|
616
626
|
var rows = areaItem.rows,
|
|
617
627
|
cols = areaItem.cols;
|
|
@@ -646,7 +656,7 @@ var VxeUIPluginMenu = exports.VxeUIPluginMenu = {
|
|
|
646
656
|
var tableProps = $table;
|
|
647
657
|
var mouseConfig = tableProps.mouseConfig;
|
|
648
658
|
var mouseOpts = $table.computeMouseOpts;
|
|
649
|
-
if (mouseConfig && mouseOpts.area) {
|
|
659
|
+
if (hasEnableConf(mouseConfig, mouseOpts) && mouseOpts.area) {
|
|
650
660
|
var _$table$getTableData4 = $table.getTableData(),
|
|
651
661
|
visibleData = _$table$getTableData4.visibleData;
|
|
652
662
|
var _$table$getTableColum4 = $table.getTableColumn(),
|
|
@@ -671,7 +681,7 @@ var VxeUIPluginMenu = exports.VxeUIPluginMenu = {
|
|
|
671
681
|
var tableProps = $table;
|
|
672
682
|
var mouseConfig = tableProps.mouseConfig;
|
|
673
683
|
var mouseOpts = $table.computeMouseOpts;
|
|
674
|
-
if (mouseConfig && mouseOpts.area) {
|
|
684
|
+
if (hasEnableConf(mouseConfig, mouseOpts) && mouseOpts.area) {
|
|
675
685
|
var _$table$getTableColum5 = $table.getTableColumn(),
|
|
676
686
|
visibleColumn = _$table$getTableColum5.visibleColumn;
|
|
677
687
|
var cellAreas = $table.getCellAreas();
|
|
@@ -711,7 +721,7 @@ var VxeUIPluginMenu = exports.VxeUIPluginMenu = {
|
|
|
711
721
|
var tableProps = $table;
|
|
712
722
|
var mouseConfig = tableProps.mouseConfig;
|
|
713
723
|
var mouseOpts = $table.computeMouseOpts;
|
|
714
|
-
if (mouseConfig && mouseOpts.area) {
|
|
724
|
+
if (hasEnableConf(mouseConfig, mouseOpts) && mouseOpts.area) {
|
|
715
725
|
var _$table$getTableColum6 = $table.getTableColumn(),
|
|
716
726
|
visibleColumn = _$table$getTableColum6.visibleColumn;
|
|
717
727
|
var cellAreas = $table.getCellAreas();
|
|
@@ -751,7 +761,7 @@ var VxeUIPluginMenu = exports.VxeUIPluginMenu = {
|
|
|
751
761
|
var tableProps = $table;
|
|
752
762
|
var mouseConfig = tableProps.mouseConfig;
|
|
753
763
|
var mouseOpts = $table.computeMouseOpts;
|
|
754
|
-
if (mouseConfig && mouseOpts.area) {
|
|
764
|
+
if (hasEnableConf(mouseConfig, mouseOpts) && mouseOpts.area) {
|
|
755
765
|
var _$table$getTableData5 = $table.getTableData(),
|
|
756
766
|
visibleData = _$table$getTableData5.visibleData;
|
|
757
767
|
var cellAreas = $table.getCellAreas();
|
|
@@ -791,7 +801,7 @@ var VxeUIPluginMenu = exports.VxeUIPluginMenu = {
|
|
|
791
801
|
var tableProps = $table;
|
|
792
802
|
var mouseConfig = tableProps.mouseConfig;
|
|
793
803
|
var mouseOpts = $table.computeMouseOpts;
|
|
794
|
-
if (mouseConfig && mouseOpts.area) {
|
|
804
|
+
if (hasEnableConf(mouseConfig, mouseOpts) && mouseOpts.area) {
|
|
795
805
|
var _$table$getTableData6 = $table.getTableData(),
|
|
796
806
|
visibleData = _$table$getTableData6.visibleData;
|
|
797
807
|
var cellAreas = $table.getCellAreas();
|
|
@@ -832,7 +842,7 @@ var VxeUIPluginMenu = exports.VxeUIPluginMenu = {
|
|
|
832
842
|
var tableProps = $table;
|
|
833
843
|
var mouseConfig = tableProps.mouseConfig;
|
|
834
844
|
var mouseOpts = $table.computeMouseOpts;
|
|
835
|
-
if (mouseConfig && mouseOpts.area) {
|
|
845
|
+
if (hasEnableConf(mouseConfig, mouseOpts) && mouseOpts.area) {
|
|
836
846
|
var cellAreas = $table.getCellAreas();
|
|
837
847
|
if (cellAreas && cellAreas.length) {
|
|
838
848
|
cellAreas.forEach(function (areaItem) {
|
|
@@ -942,7 +952,7 @@ var VxeUIPluginMenu = exports.VxeUIPluginMenu = {
|
|
|
942
952
|
var tableProps = $table;
|
|
943
953
|
var mouseConfig = tableProps.mouseConfig;
|
|
944
954
|
var mouseOpts = $table.computeMouseOpts;
|
|
945
|
-
if (mouseConfig && mouseOpts.area) {
|
|
955
|
+
if (hasEnableConf(mouseConfig, mouseOpts) && mouseOpts.area) {
|
|
946
956
|
$table.triggerPasteCellAreaEvent($event);
|
|
947
957
|
} else {
|
|
948
958
|
var clipboard = getClipboardObj();
|
|
@@ -963,7 +973,7 @@ var VxeUIPluginMenu = exports.VxeUIPluginMenu = {
|
|
|
963
973
|
var tableProps = $table;
|
|
964
974
|
var mouseConfig = tableProps.mouseConfig;
|
|
965
975
|
var mouseOpts = $table.computeMouseOpts;
|
|
966
|
-
if (mouseConfig && mouseOpts.area) {
|
|
976
|
+
if (hasEnableConf(mouseConfig, mouseOpts) && mouseOpts.area) {
|
|
967
977
|
$table.triggerPasteCellAreaEvent($event);
|
|
968
978
|
}
|
|
969
979
|
}
|
|
@@ -1134,7 +1144,7 @@ var VxeUIPluginMenu = exports.VxeUIPluginMenu = {
|
|
|
1134
1144
|
var mouseOpts = $table.computeMouseOpts;
|
|
1135
1145
|
$table.insert(menu.params || {}).then(function (_ref7) {
|
|
1136
1146
|
var rows = _ref7.rows;
|
|
1137
|
-
if (column && mouseConfig && mouseOpts.area) {
|
|
1147
|
+
if (column && hasEnableConf(mouseConfig, mouseOpts) && mouseOpts.area) {
|
|
1138
1148
|
$table.setCellAreas([{
|
|
1139
1149
|
startRow: _xeUtils["default"].first(rows),
|
|
1140
1150
|
endRow: _xeUtils["default"].last(rows),
|
|
@@ -1159,7 +1169,7 @@ var VxeUIPluginMenu = exports.VxeUIPluginMenu = {
|
|
|
1159
1169
|
var mouseOpts = $table.computeMouseOpts;
|
|
1160
1170
|
(row ? $table.insertAt(menu.params || {}, row) : $table.insert(menu.params || {})).then(function (_ref8) {
|
|
1161
1171
|
var rows = _ref8.rows;
|
|
1162
|
-
if (column && mouseConfig && mouseOpts.area) {
|
|
1172
|
+
if (column && hasEnableConf(mouseConfig, mouseOpts) && mouseOpts.area) {
|
|
1163
1173
|
$table.setCellAreas([{
|
|
1164
1174
|
startRow: _xeUtils["default"].first(rows),
|
|
1165
1175
|
endRow: _xeUtils["default"].last(rows),
|
|
@@ -1190,7 +1200,7 @@ var VxeUIPluginMenu = exports.VxeUIPluginMenu = {
|
|
|
1190
1200
|
});
|
|
1191
1201
|
(row ? $table.insertAt(records, row) : $table.insert(records)).then(function (_ref0) {
|
|
1192
1202
|
var rows = _ref0.rows;
|
|
1193
|
-
if (column && mouseConfig && mouseOpts.area) {
|
|
1203
|
+
if (column && hasEnableConf(mouseConfig, mouseOpts) && mouseOpts.area) {
|
|
1194
1204
|
$table.setCellAreas([{
|
|
1195
1205
|
startRow: _xeUtils["default"].first(rows),
|
|
1196
1206
|
endRow: _xeUtils["default"].last(rows),
|
|
@@ -1217,7 +1227,7 @@ var VxeUIPluginMenu = exports.VxeUIPluginMenu = {
|
|
|
1217
1227
|
var mouseOpts = $table.computeMouseOpts;
|
|
1218
1228
|
(row ? $table.insertNextAt(menu.params || {}, row) : $table.insert(menu.params || {})).then(function (_ref1) {
|
|
1219
1229
|
var rows = _ref1.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),
|
|
@@ -1248,7 +1258,7 @@ var VxeUIPluginMenu = exports.VxeUIPluginMenu = {
|
|
|
1248
1258
|
});
|
|
1249
1259
|
(row ? $table.insertNextAt(records, row) : $table.insert(records)).then(function (_ref11) {
|
|
1250
1260
|
var rows = _ref11.rows;
|
|
1251
|
-
if (column && mouseConfig && mouseOpts.area) {
|
|
1261
|
+
if (column && hasEnableConf(mouseConfig, mouseOpts) && mouseOpts.area) {
|
|
1252
1262
|
$table.setCellAreas([{
|
|
1253
1263
|
startRow: _xeUtils["default"].first(rows),
|
|
1254
1264
|
endRow: _xeUtils["default"].last(rows),
|
|
@@ -1451,8 +1461,8 @@ var VxeUIPluginMenu = exports.VxeUIPluginMenu = {
|
|
|
1451
1461
|
var tableProps = $table;
|
|
1452
1462
|
var mouseConfig = tableProps.mouseConfig;
|
|
1453
1463
|
var mouseOpts = $table.computeMouseOpts;
|
|
1454
|
-
if (mouseConfig && mouseOpts.area) {
|
|
1455
|
-
var cellAreas =
|
|
1464
|
+
if (hasEnableConf(mouseConfig, mouseOpts) && mouseOpts.area) {
|
|
1465
|
+
var cellAreas = $table.getCellAreas();
|
|
1456
1466
|
cellAreas.forEach(function (areaItem) {
|
|
1457
1467
|
var rows = areaItem.rows;
|
|
1458
1468
|
$table.remove(rows);
|
package/lib/index.umd.js
CHANGED
|
@@ -21,10 +21,20 @@
|
|
|
21
21
|
value: true
|
|
22
22
|
});
|
|
23
23
|
exports$1["default"] = exports$1.VxeUIPluginMenu = void 0;
|
|
24
|
+
exports$1.hasEnableConf = hasEnableConf;
|
|
24
25
|
var _xeUtils = _interopRequireDefault(require$$0);
|
|
25
26
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { "default": e }; }
|
|
26
27
|
var VxeUI;
|
|
27
28
|
var handleCopy;
|
|
29
|
+
/**
|
|
30
|
+
* 用于开关类型的配置项
|
|
31
|
+
* 局部启用规则:conf={}
|
|
32
|
+
* 局部禁用规则:conf={enabled:false}
|
|
33
|
+
* 全局默认启用规则:conf.enabled=true
|
|
34
|
+
*/
|
|
35
|
+
function hasEnableConf(conf, opts) {
|
|
36
|
+
return opts && (conf ? opts.enabled !== false : opts.enabled);
|
|
37
|
+
}
|
|
28
38
|
var columnIndexOf = function columnIndexOf(cols, column) {
|
|
29
39
|
return _xeUtils["default"].findIndexOf(cols, function (item) {
|
|
30
40
|
return item.id === column.id;
|
|
@@ -103,7 +113,7 @@
|
|
|
103
113
|
var mouseConfig = props.mouseConfig;
|
|
104
114
|
var mouseOpts = $table.computeMouseOpts;
|
|
105
115
|
var text = '';
|
|
106
|
-
if (mouseConfig && mouseOpts.area) {
|
|
116
|
+
if (hasEnableConf(mouseConfig, mouseOpts) && mouseOpts.area) {
|
|
107
117
|
if (isCut) {
|
|
108
118
|
$table.triggerCutCellAreaEvent($event);
|
|
109
119
|
} else {
|
|
@@ -171,7 +181,7 @@
|
|
|
171
181
|
visibleData = _$table$getTableData2.visibleData;
|
|
172
182
|
var _$table$getTableColum2 = $table.getTableColumn(),
|
|
173
183
|
visibleColumn = _$table$getTableColum2.visibleColumn;
|
|
174
|
-
var cellAreas = mouseConfig && mouseOpts.area ? $table.getCellAreas() : [];
|
|
184
|
+
var cellAreas = hasEnableConf(mouseConfig, mouseOpts) && mouseOpts.area ? $table.getCellAreas() : [];
|
|
175
185
|
var mergeList = $table.getMergeCells();
|
|
176
186
|
return mergeList.filter(function (_ref) {
|
|
177
187
|
var mergeRowIndex = _ref.row,
|
|
@@ -330,7 +340,7 @@
|
|
|
330
340
|
case 'OPEN_FIND':
|
|
331
341
|
case 'OPEN_REPLACE':
|
|
332
342
|
{
|
|
333
|
-
item.disabled = !(mouseConfig && mouseOpts.area);
|
|
343
|
+
item.disabled = !(hasEnableConf(mouseConfig, mouseOpts) && mouseOpts.area);
|
|
334
344
|
break;
|
|
335
345
|
}
|
|
336
346
|
case 'EDIT_CELL':
|
|
@@ -345,7 +355,7 @@
|
|
|
345
355
|
case 'PASTE_CELL':
|
|
346
356
|
case 'PASTE_AREA_CELL':
|
|
347
357
|
{
|
|
348
|
-
var cellAreas = mouseConfig && mouseOpts.area ? $table.getCellAreas() : [];
|
|
358
|
+
var cellAreas = hasEnableConf(mouseConfig, mouseOpts) && mouseOpts.area ? $table.getCellAreas() : [];
|
|
349
359
|
item.disabled = cellAreas.length > 1;
|
|
350
360
|
if (!item.disabled) {
|
|
351
361
|
switch (code) {
|
|
@@ -363,7 +373,7 @@
|
|
|
363
373
|
case 'MERGE_OR_CLEAR':
|
|
364
374
|
case 'MERGE_CELL':
|
|
365
375
|
{
|
|
366
|
-
var _cellAreas = mouseConfig && mouseOpts.area ? $table.getCellAreas() : [];
|
|
376
|
+
var _cellAreas = hasEnableConf(mouseConfig, mouseOpts) && mouseOpts.area ? $table.getCellAreas() : [];
|
|
367
377
|
item.disabled = !_cellAreas.length || _cellAreas.length === 1 && _cellAreas[0].rows.length === 1 && _cellAreas[0].cols.length === 1 || !checkCellOverlay(params, _cellAreas);
|
|
368
378
|
break;
|
|
369
379
|
}
|
|
@@ -494,11 +504,11 @@
|
|
|
494
504
|
var pVersion = 3;
|
|
495
505
|
var sVersion = 13;
|
|
496
506
|
if (!VxeUI.checkVersion(VxeUI.tableVersion, pVersion, sVersion)) {
|
|
497
|
-
console.error("[@vxe-ui/plugin-menu 3.
|
|
507
|
+
console.error("[@vxe-ui/plugin-menu 3.4.0] ".concat(VxeUI.getI18n('vxe.error.errorVersion', ["vxe-table@".concat(VxeUI.tableVersion || '?'), "vxe-table v".concat(pVersion, ".").concat(sVersion, "+")])));
|
|
498
508
|
}
|
|
499
509
|
} else {
|
|
500
510
|
if (!/^(3)\./.test(VxeUI.uiVersion || VxeUI.tableVersion)) {
|
|
501
|
-
console.error('[@vxe-ui/plugin-menu 3.
|
|
511
|
+
console.error('[@vxe-ui/plugin-menu 3.4.0] Requires vxe-table 3.9.0+ version. https://vxeui.com/other3/#/plugin-menu/install');
|
|
502
512
|
}
|
|
503
513
|
}
|
|
504
514
|
pluginConfig(options);
|
|
@@ -545,7 +555,7 @@
|
|
|
545
555
|
var tableProps = $table;
|
|
546
556
|
var mouseConfig = tableProps.mouseConfig;
|
|
547
557
|
var mouseOpts = $table.computeMouseOpts;
|
|
548
|
-
if (mouseConfig && mouseOpts.area) {
|
|
558
|
+
if (hasEnableConf(mouseConfig, mouseOpts) && mouseOpts.area) {
|
|
549
559
|
var cellAreas = $table.getCellAreas();
|
|
550
560
|
if (cellAreas && cellAreas.length) {
|
|
551
561
|
cellAreas.forEach(function (areaItem) {
|
|
@@ -576,7 +586,7 @@
|
|
|
576
586
|
var tableProps = $table;
|
|
577
587
|
var mouseConfig = tableProps.mouseConfig;
|
|
578
588
|
var mouseOpts = $table.computeMouseOpts;
|
|
579
|
-
if (mouseConfig && mouseOpts.area) {
|
|
589
|
+
if (hasEnableConf(mouseConfig, mouseOpts) && mouseOpts.area) {
|
|
580
590
|
var cellAreas = $table.getCellAreas();
|
|
581
591
|
if (cellAreas && cellAreas.length) {
|
|
582
592
|
cellAreas.forEach(function (areaItem) {
|
|
@@ -627,8 +637,8 @@
|
|
|
627
637
|
var tableProps = $table;
|
|
628
638
|
var mouseConfig = tableProps.mouseConfig;
|
|
629
639
|
var mouseOpts = $table.computeMouseOpts;
|
|
630
|
-
if (mouseConfig && mouseOpts.area) {
|
|
631
|
-
var cellAreas =
|
|
640
|
+
if (hasEnableConf(mouseConfig, mouseOpts) && mouseOpts.area) {
|
|
641
|
+
var cellAreas = mouseOpts.area ? $table.getCellAreas() : [];
|
|
632
642
|
cellAreas.forEach(function (areaItem) {
|
|
633
643
|
var rows = areaItem.rows,
|
|
634
644
|
cols = areaItem.cols;
|
|
@@ -663,7 +673,7 @@
|
|
|
663
673
|
var tableProps = $table;
|
|
664
674
|
var mouseConfig = tableProps.mouseConfig;
|
|
665
675
|
var mouseOpts = $table.computeMouseOpts;
|
|
666
|
-
if (mouseConfig && mouseOpts.area) {
|
|
676
|
+
if (hasEnableConf(mouseConfig, mouseOpts) && mouseOpts.area) {
|
|
667
677
|
var _$table$getTableData4 = $table.getTableData(),
|
|
668
678
|
visibleData = _$table$getTableData4.visibleData;
|
|
669
679
|
var _$table$getTableColum4 = $table.getTableColumn(),
|
|
@@ -688,7 +698,7 @@
|
|
|
688
698
|
var tableProps = $table;
|
|
689
699
|
var mouseConfig = tableProps.mouseConfig;
|
|
690
700
|
var mouseOpts = $table.computeMouseOpts;
|
|
691
|
-
if (mouseConfig && mouseOpts.area) {
|
|
701
|
+
if (hasEnableConf(mouseConfig, mouseOpts) && mouseOpts.area) {
|
|
692
702
|
var _$table$getTableColum5 = $table.getTableColumn(),
|
|
693
703
|
visibleColumn = _$table$getTableColum5.visibleColumn;
|
|
694
704
|
var cellAreas = $table.getCellAreas();
|
|
@@ -728,7 +738,7 @@
|
|
|
728
738
|
var tableProps = $table;
|
|
729
739
|
var mouseConfig = tableProps.mouseConfig;
|
|
730
740
|
var mouseOpts = $table.computeMouseOpts;
|
|
731
|
-
if (mouseConfig && mouseOpts.area) {
|
|
741
|
+
if (hasEnableConf(mouseConfig, mouseOpts) && mouseOpts.area) {
|
|
732
742
|
var _$table$getTableColum6 = $table.getTableColumn(),
|
|
733
743
|
visibleColumn = _$table$getTableColum6.visibleColumn;
|
|
734
744
|
var cellAreas = $table.getCellAreas();
|
|
@@ -768,7 +778,7 @@
|
|
|
768
778
|
var tableProps = $table;
|
|
769
779
|
var mouseConfig = tableProps.mouseConfig;
|
|
770
780
|
var mouseOpts = $table.computeMouseOpts;
|
|
771
|
-
if (mouseConfig && mouseOpts.area) {
|
|
781
|
+
if (hasEnableConf(mouseConfig, mouseOpts) && mouseOpts.area) {
|
|
772
782
|
var _$table$getTableData5 = $table.getTableData(),
|
|
773
783
|
visibleData = _$table$getTableData5.visibleData;
|
|
774
784
|
var cellAreas = $table.getCellAreas();
|
|
@@ -808,7 +818,7 @@
|
|
|
808
818
|
var tableProps = $table;
|
|
809
819
|
var mouseConfig = tableProps.mouseConfig;
|
|
810
820
|
var mouseOpts = $table.computeMouseOpts;
|
|
811
|
-
if (mouseConfig && mouseOpts.area) {
|
|
821
|
+
if (hasEnableConf(mouseConfig, mouseOpts) && mouseOpts.area) {
|
|
812
822
|
var _$table$getTableData6 = $table.getTableData(),
|
|
813
823
|
visibleData = _$table$getTableData6.visibleData;
|
|
814
824
|
var cellAreas = $table.getCellAreas();
|
|
@@ -849,7 +859,7 @@
|
|
|
849
859
|
var tableProps = $table;
|
|
850
860
|
var mouseConfig = tableProps.mouseConfig;
|
|
851
861
|
var mouseOpts = $table.computeMouseOpts;
|
|
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) {
|
|
@@ -959,7 +969,7 @@
|
|
|
959
969
|
var tableProps = $table;
|
|
960
970
|
var mouseConfig = tableProps.mouseConfig;
|
|
961
971
|
var mouseOpts = $table.computeMouseOpts;
|
|
962
|
-
if (mouseConfig && mouseOpts.area) {
|
|
972
|
+
if (hasEnableConf(mouseConfig, mouseOpts) && mouseOpts.area) {
|
|
963
973
|
$table.triggerPasteCellAreaEvent($event);
|
|
964
974
|
} else {
|
|
965
975
|
var clipboard = getClipboardObj();
|
|
@@ -980,7 +990,7 @@
|
|
|
980
990
|
var tableProps = $table;
|
|
981
991
|
var mouseConfig = tableProps.mouseConfig;
|
|
982
992
|
var mouseOpts = $table.computeMouseOpts;
|
|
983
|
-
if (mouseConfig && mouseOpts.area) {
|
|
993
|
+
if (hasEnableConf(mouseConfig, mouseOpts) && mouseOpts.area) {
|
|
984
994
|
$table.triggerPasteCellAreaEvent($event);
|
|
985
995
|
}
|
|
986
996
|
}
|
|
@@ -1151,7 +1161,7 @@
|
|
|
1151
1161
|
var mouseOpts = $table.computeMouseOpts;
|
|
1152
1162
|
$table.insert(menu.params || {}).then(function (_ref7) {
|
|
1153
1163
|
var rows = _ref7.rows;
|
|
1154
|
-
if (column && mouseConfig && mouseOpts.area) {
|
|
1164
|
+
if (column && hasEnableConf(mouseConfig, mouseOpts) && mouseOpts.area) {
|
|
1155
1165
|
$table.setCellAreas([{
|
|
1156
1166
|
startRow: _xeUtils["default"].first(rows),
|
|
1157
1167
|
endRow: _xeUtils["default"].last(rows),
|
|
@@ -1176,7 +1186,7 @@
|
|
|
1176
1186
|
var mouseOpts = $table.computeMouseOpts;
|
|
1177
1187
|
(row ? $table.insertAt(menu.params || {}, row) : $table.insert(menu.params || {})).then(function (_ref8) {
|
|
1178
1188
|
var rows = _ref8.rows;
|
|
1179
|
-
if (column && mouseConfig && mouseOpts.area) {
|
|
1189
|
+
if (column && hasEnableConf(mouseConfig, mouseOpts) && mouseOpts.area) {
|
|
1180
1190
|
$table.setCellAreas([{
|
|
1181
1191
|
startRow: _xeUtils["default"].first(rows),
|
|
1182
1192
|
endRow: _xeUtils["default"].last(rows),
|
|
@@ -1207,7 +1217,7 @@
|
|
|
1207
1217
|
});
|
|
1208
1218
|
(row ? $table.insertAt(records, row) : $table.insert(records)).then(function (_ref0) {
|
|
1209
1219
|
var rows = _ref0.rows;
|
|
1210
|
-
if (column && mouseConfig && mouseOpts.area) {
|
|
1220
|
+
if (column && hasEnableConf(mouseConfig, mouseOpts) && mouseOpts.area) {
|
|
1211
1221
|
$table.setCellAreas([{
|
|
1212
1222
|
startRow: _xeUtils["default"].first(rows),
|
|
1213
1223
|
endRow: _xeUtils["default"].last(rows),
|
|
@@ -1234,7 +1244,7 @@
|
|
|
1234
1244
|
var mouseOpts = $table.computeMouseOpts;
|
|
1235
1245
|
(row ? $table.insertNextAt(menu.params || {}, row) : $table.insert(menu.params || {})).then(function (_ref1) {
|
|
1236
1246
|
var rows = _ref1.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),
|
|
@@ -1265,7 +1275,7 @@
|
|
|
1265
1275
|
});
|
|
1266
1276
|
(row ? $table.insertNextAt(records, row) : $table.insert(records)).then(function (_ref11) {
|
|
1267
1277
|
var rows = _ref11.rows;
|
|
1268
|
-
if (column && mouseConfig && mouseOpts.area) {
|
|
1278
|
+
if (column && hasEnableConf(mouseConfig, mouseOpts) && mouseOpts.area) {
|
|
1269
1279
|
$table.setCellAreas([{
|
|
1270
1280
|
startRow: _xeUtils["default"].first(rows),
|
|
1271
1281
|
endRow: _xeUtils["default"].last(rows),
|
|
@@ -1468,8 +1478,8 @@
|
|
|
1468
1478
|
var tableProps = $table;
|
|
1469
1479
|
var mouseConfig = tableProps.mouseConfig;
|
|
1470
1480
|
var mouseOpts = $table.computeMouseOpts;
|
|
1471
|
-
if (mouseConfig && mouseOpts.area) {
|
|
1472
|
-
var cellAreas =
|
|
1481
|
+
if (hasEnableConf(mouseConfig, mouseOpts) && mouseOpts.area) {
|
|
1482
|
+
var cellAreas = $table.getCellAreas();
|
|
1473
1483
|
cellAreas.forEach(function (areaItem) {
|
|
1474
1484
|
var rows = areaItem.rows;
|
|
1475
1485
|
$table.remove(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")):"function"==typeof define&&define.amd?define(["xe-utils"],t):(e="undefined"!=typeof globalThis?globalThis:e||self).VxeUIPluginMenu=t(e.XEUtils)})(this,function(e){function t(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var n,u,i,c,a,m,R,l={};function o(n){return{tableMenuMethod:function(e){var t=e.$table;c.default.eachTree([e.column],function(e){e.fixed=n}),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,n;try{t=e,a||((a=document.createElement("textarea")).id="$XECopy",(n=a.style).width="48px",n.height="24px",n.position="fixed",n.zIndex="0",n.left="-500px",n.top="-500px",document.body.appendChild(a)),a.value=null==t?"":""+t,a.select(),a.setSelectionRange(0,a.value.length),document.execCommand("copy"),a.blur()}catch(e){}}function r(e,t){var n,a,l,o=e.$event,r=e.$table,s=e.row,e=e.column;s&&e&&(n=r.mouseConfig,l=r.computeMouseOpts,a="",n&&l.area?(t?r.triggerCutCellAreaEvent(o):r.triggerCopyCellAreaEvent(o),a=(n=M())?n.text:""):(a=c.default.toValueString(c.default.get(s,e.field)),l={text:a,html:""},(t=u.globalStore)?t.clipboard=l:u.config&&(u.config.clipboard=l)),(c.default.isFunction(i)?i:d)(a))}function s(t){return function(e){e=e.$grid;e&&e.commitProxy(t)}}function _(e){var u=e.$table,e=u.mouseConfig,t=u.computeMouseOpts,i=u.getTableData().visibleData,c=u.getTableColumn().visibleColumn,n=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 n.some(function(e){var t=e.rows,e=e.cols,n=R(u,i,t[0]),t=R(u,i,t[t.length-1]),a=m(c,e[0]),e=m(c,e[e.length-1]);return n<=l&&l+r-1<=t&&a<=o&&o+s-1<=e})})}function E(e){var t=e.$table,e=_(e);return e.length&&t.removeMergeCells(e),e}function f(e,t){var n=e.code,a=t.$table,l=t.$grid,o=t.row,r=t.column,s=t.type,u=a.editConfig,i=a.mouseConfig;switch(n){case"CLEAR_ALL_SORT":var c=a.getSortColumns();e.disabled=!c.length;break;case"CLEAR_ALL_FILTER":c=a.getCheckedFilters();e.disabled=!c.length;break;case"CLEAR_ALL_MERGE":var c=a.getMergeCells(),d=a.getMergeFooterItems();e.disabled=!c.length&&!d.length;break;case"CLEAR_MERGE_CELL":c=_(t);e.disabled=!c.length;break;case"COPY_TITLE":e.disabled=!r||"header"!==s;break;case"SELECT_ALL_AREA":d=a.getTableData().visibleData,c=a.getTableColumn().visibleColumn;e.disabled=!d.length||!c.length;break;case"SELECT_AREA_TO_LEFT":case"SELECT_AREA_TO_RIGHT":case"SELECT_AREA_TO_TOP":case"SELECT_AREA_TO_BOTTON":e.disabled=!r||!o;break;case"DELETE_CHECKBOX_ROW":d=a.getCheckboxRecords();e.disabled=!d.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 E=a.computeMouseOpts,f=!!r.parentId;switch(n){case"CLEAR_SORT":e.disabled=!r.sortable||!r.order;break;case"SORT_ASC":case"SORT_DESC":e.disabled=!r.sortable;break;case"FILTER_CELL":case"CLEAR_FILTER":e.disabled=!r.filters||!r.filters.length,e.disabled||"CLEAR_FILTER"===n&&(e.disabled=!r.filters.some(function(e){return e.checked}));break;case"REVERT_CELL":e.disabled=!o||!r.field||!a.isUpdateByRow(o,r.field);break;case"REVERT_ROW":e.disabled=!o||!r.field||!a.isUpdateByRow(o);break;case"OPEN_FIND":case"OPEN_REPLACE":e.disabled=!(i&&E.area);break;case"EDIT_CELL":e.disabled=!u||!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 C=i&&E.area?a.getCellAreas():[];if(e.disabled=1<C.length,!e.disabled)switch(n){case"PASTE_CELL":case"PASTE_AREA_CELL":var b=M();e.disabled=!b||!b.text}break;case"MERGE_OR_CLEAR":case"MERGE_CELL":C=i&&E.area?a.getCellAreas():[];e.disabled=!C.length||1===C.length&&1===C[0].rows.length&&1===C[0].cols.length||!((e,t)=>{for(var n=e.$table,a=n.getTableData().visibleData,l=n.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=R(n,a,f),b=0,M=c.length;b<M;b++){var _=c[b],_=C+":"+m(l,_);if(o[_])return;o[_]=!0}return 1})(t,C);break;case"FIXED_LEFT_COLUMN":e.disabled=f||"left"===r.fixed;break;case"FIXED_RIGHT_COLUMN":e.disabled=f||"right"===r.fixed;break;case"CLEAR_FIXED_COLUMN":e.disabled=f||!r.fixed}}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 C(t){return t.options.forEach(function(e){e.forEach(function(e){f(e,t),e.children&&e.children.forEach(function(e){f(e,t)})})}),!0}function b(){return new Promise(function(t){var n,a;u.modal?(n=u.getComponent("VxeNumberInput"))?(a=1,u.modal.alert({title:"请输入行数",width:220,maskClosable:!1,slots:{default:function(e,t){return t(n,{props:{value:a,min:1,max:100,type:"integer",align:"center",controlConfig:{layout:"default"}},style:{width:"100%"},on:{modelValue:function(e){a=e}}})}}}).then(function(e){t("confirm"===e?{size:a||1}:{size:0})})):(console.error(u.getI18n("vxe.error.reqComp",["vxe-number-input"])),t({size:0})):t({size:0})})}function h(){location.reload()}function g(){history.forward()}function L(){history.back()}function A(e){e&&e.copy&&(i=e.copy)}return n||(n=1,n=l,Object.defineProperty(n,"__esModule",{value:!0}),n.default=n.VxeUIPluginMenu=void 0,c=(e=e)&&e.__esModule?e:{default:e},m=function(e,t){return c.default.findIndexOf(e,function(e){return e.id===t.id})},R=function(e,t,n){return e.findRowIndexOf(t,n)},e=n.VxeUIPluginMenu={setConfig:A,install:function(e,t){(u=e).checkVersion?u.checkVersion(u.tableVersion,3,13)||console.error("[@vxe-ui/plugin-menu 3.3.4] ".concat(u.getI18n("vxe.error.errorVersion",["vxe-table@".concat(u.tableVersion||"?"),"vxe-table v".concat(3,".").concat(13,"+")]))):/^(3)\./.test(u.uiVersion||u.tableVersion)||console.error("[@vxe-ui/plugin-menu 3.3.4] Requires vxe-table 3.9.0+ version. https://vxeui.com/other3/#/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:g,treeMenuMethod:g,calendarMenuMethod:g,menuMenuMethod:g,formDesignMenuMethod:g},SYSTEM_PAGE_BACK:{tableMenuMethod:L,treeMenuMethod:L,calendarMenuMethod:L,menuMenuMethod:L,formDesignMenuMethod:L},CLEAR_CELL:{tableMenuMethod:function(e){var t,n,a=e.$table,l=e.row,e=e.column;l&&e&&(n=a.mouseConfig,t=a.computeMouseOpts,n&&t.area?(n=a.getCellAreas())&&n.length&&n.forEach(function(e){var n=e.rows;e.cols.forEach(function(t){n.forEach(function(e){a.clearData(e,t.field)})})}):a.clearData(l,e.field))}},CLEAR_AREA_CELL:{tableMenuMethod:function(e){var t,n,a=e.$table,l=e.row,e=e.column;l&&e&&(n=a.mouseConfig,t=a.computeMouseOpts,n&&t.area?(n=a.getCellAreas())&&n.length&&n.forEach(function(e){var n=e.rows;e.cols.forEach(function(t){n.forEach(function(e){a.clearData(e,t.field)})})}):a.clearData(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 a=e.$table,t=e.row,e=e.column,n=a.mouseConfig,l=a.computeMouseOpts;n&&l.area?(n&&l.area?a.getCellAreas():[]).forEach(function(e){var t=e.rows,n=e.cols;t.forEach(function(t){n.forEach(function(e){a.clearData(t)})})}):t&&e&&a.clearData(t)}},CLEAR_ALL:{tableMenuMethod:function(e){e.$table.clearData()}},SELECT_ALL_AREA:{tableMenuMethod:function(e){var e=e.$table,t=e.mouseConfig,n=e.computeMouseOpts;t&&n.area&&(t=e.getTableData().visibleData,n=e.getTableColumn().visibleColumn,e.setCellAreas([{startRow:c.default.first(t),endRow:c.default.last(t),startColumn:c.default.first(n),endColumn:c.default.last(n)}]))}},SELECT_AREA_TO_LEFT:{tableMenuMethod:function(e){var t=e.$table,n=e.row,e=e.column,a=t.mouseConfig,l=t.computeMouseOpts;a&&l.area&&(a=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(a),endColumn:c.default.last(l.cols)}],{column:e,row:n})):t.setCellAreas([{startRow:n,endRow:n,startColumn:c.default.first(a),endColumn:e}],{column:e,row:n}))}},SELECT_AREA_TO_RIGHT:{tableMenuMethod:function(e){var t=e.$table,n=e.row,e=e.column,a=t.mouseConfig,l=t.computeMouseOpts;a&&l.area&&(a=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(a)}],{column:e,row:n})):t.setCellAreas([{startRow:n,endRow:n,startColumn:e,endColumn:c.default.last(a)}],{column:e,row:n}))}},SELECT_AREA_TO_TOP:{tableMenuMethod:function(e){var t=e.$table,n=e.row,e=e.column,a=t.mouseConfig,l=t.computeMouseOpts;a&&l.area&&(a=t.getTableData().visibleData,1===(l=t.getCellAreas()).length?(l=l[0],t.setCellAreas([{startRow:c.default.first(a),endRow:c.default.last(l.rows),startColumn:c.default.first(l.cols),endColumn:c.default.last(l.cols)}],{column:e,row:n})):t.setCellAreas([{startRow:c.default.first(a),endRow:n,startColumn:e,endColumn:e}],{column:e,row:n}))}},SELECT_AREA_TO_BOTTON:{tableMenuMethod:function(e){var t=e.$table,n=e.row,e=e.column,a=t.mouseConfig,l=t.computeMouseOpts;a&&l.area&&(a=t.getTableData().visibleData,1===(l=t.getCellAreas()).length?(l=l[0],t.setCellAreas([{startRow:c.default.first(l.rows),endRow:c.default.last(a),startColumn:c.default.first(l.cols),endColumn:c.default.last(l.cols)}],{column:e,row:n})):t.setCellAreas([{startRow:n,endRow:c.default.last(a),startColumn:e,endColumn:e}],{column:e,row:n}))}},REVERT_CELL:{tableMenuMethod:function(e){var t,n,a=e.$table,l=e.row,e=e.column;l&&e&&(n=a.mouseConfig,t=a.computeMouseOpts,n&&t.area?(n=a.getCellAreas())&&n.length&&n.forEach(function(e){var n=e.rows;e.cols.forEach(function(t){n.forEach(function(e){a.revertData(e,t.field)})})}):a.revertData(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){r(e)}},COPY_AREA_CELL:{tableMenuMethod:function(e){r(e)}},CUT_CELL:{tableMenuMethod:function(e){r(e,!0)}},CUT_AREA_CELL:{tableMenuMethod:function(e){r(e,!0)}},PASTE_CELL:{tableMenuMethod:function(e){var t=e.$event,n=e.$table,a=e.row,e=e.column,l=n.mouseConfig,o=n.computeMouseOpts;l&&o.area?n.triggerPasteCellAreaEvent(t):(l=M())&&l.text&&c.default.set(a,e.field,l.text)}},PASTE_AREA_CELL:{tableMenuMethod:function(e){var t=e.$event,e=e.$table,n=e.mouseConfig,a=e.computeMouseOpts;n&&a.area&&e.triggerPasteCellAreaEvent(t)}},MERGE_OR_CLEAR:{tableMenuMethod:function(e){var t=e.$event,n=e.$table,a=n.getCellAreas(),e=_(e),l=!1,e=(e.length?n.removeMergeCells(e):(l=!0,n.setMergeCells(a.map(function(e){var t=e.rows,e=e.cols;return{row:t[0],col:e[0],rowspan:t.length,colspan:e.length}}))),a.map(function(e){return{rows:e.rows,cols:e.cols}}));n.dispatchEvent("cell-area-merge",{status:l,targetAreas:e},t)}},MERGE_CELL:{tableMenuMethod:function(e){var t=e.$event,n=e.$table,a=n.getTableData().visibleData,l=n.getTableColumn().visibleColumn,o=n.getCellAreas();E(e),o.some(function(e){return e.rows.length===a.length||e.cols.length===l.length})?u.modal&&u.modal.message({content:u.getI18n("vxe.pro.area.mergeErr"),status:"error",id:"operErr"}):(n.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}}),n.dispatchEvent("cell-area-merge",{status:!0,targetAreas:e},t))}},CLEAR_MERGE_CELL:{tableMenuMethod:function(e){var t=e.$event,n=e.$table,e=E(e);e.length&&n.dispatchEvent("clear-cell-area-merge",{mergeCells:e},t)}},CLEAR_ALL_MERGE:{tableMenuMethod:function(e){var t=e.$event,e=e.$table,n=e.getMergeCells(),a=e.getMergeFooterItems();e.clearMergeCells(),e.clearMergeFooterItems(),e.dispatchEvent("clear-merge",{mergeCells:n,mergeFooterItems:a},t)}},EDIT_CELL:{tableMenuMethod:function(e){var t=e.$table,n=e.row,e=e.column;t.setEditCell?t.setEditCell(n,e):t.setActiveCell(n,e.field)}},EDIT_ROW:{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,n=e.column,a=t.mouseConfig,l=t.computeMouseOpts;t.insert(e.menu.params||{}).then(function(e){e=e.rows;n&&a&&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,n=e.menu,a=e.row,l=e.column,o=t.mouseConfig,r=t.computeMouseOpts;(a?t.insertAt(n.params||{},a):t.insert(n.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,n=e.menu,a=e.row,l=e.column,o=t.mouseConfig,r=t.computeMouseOpts;b().then(function(e){var e=e.size;e&&(e=c.default.range(0,e).map(function(){return Object.assign({},n.params)}),(a?t.insertAt(e,a):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,n=e.menu,a=e.row,l=e.column,o=t.mouseConfig,r=t.computeMouseOpts;(a?t.insertNextAt(n.params||{},a):t.insert(n.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,n=e.menu,a=e.row,l=e.column,o=t.mouseConfig,r=t.computeMouseOpts;b().then(function(e){var e=e.size;e&&(e=c.default.range(0,e).map(function(){return Object.assign({},n.params)}),(a?t.insertNextAt(e,a):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,n=e.column,a=e.menu.params||[],e=Object.assign({},a[0]||{});t.insert(e).then(function(e){e=e.row;t.setEditCell?t.setEditCell(e,a[1]||n):t.setActiveCell(e,a[1]||n.field)})}},INSERT_EDIT_ROW:{tableMenuMethod:function(e){var t=e.$table,n=e.column,a=e.menu.params||[],e=Object.assign({},a[0]||{});t.insert(e).then(function(e){e=e.row;t.setEditCell?t.setEditCell(e,a[1]||n):t.setActiveCell(e,a[1]||n.field)})}},INSERT_AT_ACTIVED_ROW:{tableMenuMethod:function(e){var t=e.$table,n=e.row,a=e.column,l=e.menu.params||[],e=Object.assign({},l[0]||{});(n?t.insertAt(e,n):t.insert(e)).then(function(e){e=e.row;t.setEditCell?t.setEditCell(e,l[1]||a):t.setActiveCell(e,l[1]||a.field)})}},INSERT_AT_EDIT_ROW:{tableMenuMethod:function(e){var t=e.$table,n=e.row,a=e.column,l=e.menu.params||[],e=Object.assign({},l[0]||{});(n?t.insertAt(e,n):t.insert(e)).then(function(e){e=e.row;t.setEditCell?t.setEditCell(e,l[1]||a):t.setActiveCell(e,l[1]||a.field)})}},BATCH_INSERT_AT_EDIT_ROW:{tableMenuMethod:function(e){var t=e.$table,n=e.row,a=e.column,l=e.menu.params||[];b().then(function(e){var e=e.size;e&&(e=c.default.range(0,e).map(function(){return Object.assign({},l[0])}),(n?t.insertAt(e,n):t.insert(e)).then(function(e){e=e.row;t.setEditCell?t.setEditCell(e,l[1]||a):t.setActiveCell(e,l[1]||a.field)}))})}},INSERT_NEXT_AT_EDIT_ROW:{tableMenuMethod:function(e){var t=e.$table,n=e.row,a=e.column,l=e.menu.params||[],e=Object.assign({},l[0]||{});(n?t.insertNextAt(e,n):t.insert(e)).then(function(e){e=e.row;t.setEditCell?t.setEditCell(e,l[1]||a):t.setActiveCell(e,l[1]||a.field)})}},BATCH_INSERT_NEXT_AT_EDIT_ROW:{tableMenuMethod:function(e){var t=e.$table,n=e.row,a=e.column,l=e.menu.params||[];b().then(function(e){var e=e.size;e&&(e=c.default.range(0,e).map(function(){return Object.assign({},l[0])}),(n?t.insertNextAt(e,n):t.insert(e)).then(function(e){e=e.row;t.setEditCell?t.setEditCell(e,l[1]||a):t.setActiveCell(e,l[1]||a.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,n=t.mouseConfig,a=t.computeMouseOpts;n&&a.area?(n&&a.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,n=e.$table,e=e.column;e&&n.triggerSortEvent(t,e,null)}},CLEAR_ALL_SORT:{tableMenuMethod:function(e){var t=e.$event,e=e.$table,n=e.getSortColumns();n.length&&(e.clearSort(),e.dispatchEvent("clear-sort",{sortList:n},t))}},SORT_ASC:{tableMenuMethod:function(e){var t=e.$event,n=e.$table,e=e.column;e&&n.triggerSortEvent(t,e,"asc")}},SORT_DESC:{tableMenuMethod:function(e){var t=e.$event,n=e.$table,e=e.column;e&&n.triggerSortEvent(t,e,"desc")}},CLEAR_FILTER:{tableMenuMethod:function(e){var t=e.$event,n=e.$table,e=e.column;e&&(n.handleClearFilter(e),n.confirmFilterEvent(t))}},CLEAR_ALL_FILTER:{tableMenuMethod:function(e){var t=e.$event,e=e.$table,n=e.getCheckedFilters();n.length&&(e.clearFilter(),e.dispatchEvent("clear-filter",{filterList:n},t))}},FILTER_CELL:{tableMenuMethod:function(e){var t,n=e.$table,a=e.row,e=e.column;a&&e&&(t=e.field,(e=e.filters).length)&&((e=e[0]).data=c.default.get(a,t),e.checked=!0,n.updateData())}},EXPORT_ROW:{tableMenuMethod:function(e){var t=e.$table,n=e.menu,e=e.row;e&&t.exportData(c.default.assign({},n.params?n.params[0]:{},{data:[e]}))}},EXPORT_CHECKBOX_ROW:{tableMenuMethod:function(e){var t=e.$table,e=e.menu,n={data:t.getCheckboxRecords()};t.exportData(c.default.assign({},e.params?e.params[0]:{},n))}},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,n={data:t.getCheckboxRecords()};t.print(c.default.assign(n,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:o("left"),FIXED_RIGHT_COLUMN:o("right"),CLEAR_FIXED_COLUMN:o(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:s("initial")},COMMIT_PROXY_QUERY:{tableMenuMethod:s("query")},COMMIT_PROXY_RELOAD:{tableMenuMethod:s("reload")},COMMIT_PROXY_DELETE:{tableMenuMethod:s("delete")},COMMIT_PROXY_SAVE:{tableMenuMethod:s("save")}}),u.interceptor.add("event.showMenu",C)}},"undefined"!=typeof window&&window.VxeUI&&window.VxeUI.use&&window.VxeUI.use(e),n.default=e),t(l)});
|
|
1
|
+
((e,t)=>{"object"==typeof exports&&"undefined"!=typeof module?module.exports=t(require("xe-utils")):"function"==typeof define&&define.amd?define(["xe-utils"],t):(e="undefined"!=typeof globalThis?globalThis:e||self).VxeUIPluginMenu=t(e.XEUtils)})(this,function(e){function t(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var n,s,u,i,a,m,R,l={};function M(e,t){return t&&(e?!1!==t.enabled:t.enabled)}function o(n){return{tableMenuMethod:function(e){var t=e.$table;i.default.eachTree([e.column],function(e){e.fixed=n}),t.refreshColumn()}}}function _(){var e=s.globalStore;return e?e.clipboard||"":(e=s.config)&&e.clipboard?e.clipboard:null}function c(e){var t,n;try{t=e,a||((a=document.createElement("textarea")).id="$XECopy",(n=a.style).width="48px",n.height="24px",n.position="fixed",n.zIndex="0",n.left="-500px",n.top="-500px",document.body.appendChild(a)),a.value=null==t?"":""+t,a.select(),a.setSelectionRange(0,a.value.length),document.execCommand("copy"),a.blur()}catch(e){}}function r(e,t){var n,a,l=e.$event,o=e.$table,r=e.row,e=e.column;r&&e&&(a="",M(o.mouseConfig,n=o.computeMouseOpts)&&n.area?(t?o.triggerCutCellAreaEvent(l):o.triggerCopyCellAreaEvent(l),a=(n=_())?n.text:""):(a=i.default.toValueString(i.default.get(r,e.field)),t={text:a,html:""},(o=s.globalStore)?o.clipboard=t:s.config&&(s.config.clipboard=t)),(i.default.isFunction(u)?u:c)(a))}function d(t){return function(e){e=e.$grid;e&&e.commitProxy(t)}}function h(e){var u=e.$table,e=u.mouseConfig,t=u.computeMouseOpts,i=u.getTableData().visibleData,c=u.getTableColumn().visibleColumn,n=M(e,t)&&t.area?u.getCellAreas():[];return u.getMergeCells().filter(function(e){var l=e.row,o=e.col,r=e.rowspan,s=e.colspan;return n.some(function(e){var t=e.rows,e=e.cols,n=R(u,i,t[0]),t=R(u,i,t[t.length-1]),a=m(c,e[0]),e=m(c,e[e.length-1]);return n<=l&&l+r-1<=t&&a<=o&&o+s-1<=e})})}function E(e){var t=e.$table,e=h(e);return e.length&&t.removeMergeCells(e),e}function f(e,t){var n=e.code,a=t.$table,l=t.$grid,o=t.row,r=t.column,s=t.type,u=a.editConfig,i=a.mouseConfig;switch(n){case"CLEAR_ALL_SORT":var c=a.getSortColumns();e.disabled=!c.length;break;case"CLEAR_ALL_FILTER":c=a.getCheckedFilters();e.disabled=!c.length;break;case"CLEAR_ALL_MERGE":var c=a.getMergeCells(),d=a.getMergeFooterItems();e.disabled=!c.length&&!d.length;break;case"CLEAR_MERGE_CELL":c=h(t);e.disabled=!c.length;break;case"COPY_TITLE":e.disabled=!r||"header"!==s;break;case"SELECT_ALL_AREA":d=a.getTableData().visibleData,c=a.getTableColumn().visibleColumn;e.disabled=!d.length||!c.length;break;case"SELECT_AREA_TO_LEFT":case"SELECT_AREA_TO_RIGHT":case"SELECT_AREA_TO_TOP":case"SELECT_AREA_TO_BOTTON":e.disabled=!r||!o;break;case"DELETE_CHECKBOX_ROW":d=a.getCheckboxRecords();e.disabled=!d.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 E=a.computeMouseOpts,f=!!r.parentId;switch(n){case"CLEAR_SORT":e.disabled=!r.sortable||!r.order;break;case"SORT_ASC":case"SORT_DESC":e.disabled=!r.sortable;break;case"FILTER_CELL":case"CLEAR_FILTER":e.disabled=!r.filters||!r.filters.length,e.disabled||"CLEAR_FILTER"===n&&(e.disabled=!r.filters.some(function(e){return e.checked}));break;case"REVERT_CELL":e.disabled=!o||!r.field||!a.isUpdateByRow(o,r.field);break;case"REVERT_ROW":e.disabled=!o||!r.field||!a.isUpdateByRow(o);break;case"OPEN_FIND":case"OPEN_REPLACE":e.disabled=!(M(i,E)&&E.area);break;case"EDIT_CELL":e.disabled=!u||!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 C=M(i,E)&&E.area?a.getCellAreas():[];if(e.disabled=1<C.length,!e.disabled)switch(n){case"PASTE_CELL":case"PASTE_AREA_CELL":var b=_();e.disabled=!b||!b.text}break;case"MERGE_OR_CLEAR":case"MERGE_CELL":C=M(i,E)&&E.area?a.getCellAreas():[];e.disabled=!C.length||1===C.length&&1===C[0].rows.length&&1===C[0].cols.length||!((e,t)=>{for(var n=e.$table,a=n.getTableData().visibleData,l=n.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=R(n,a,f),b=0,M=c.length;b<M;b++){var _=c[b],_=C+":"+m(l,_);if(o[_])return;o[_]=!0}return 1})(t,C);break;case"FIXED_LEFT_COLUMN":e.disabled=f||"left"===r.fixed;break;case"FIXED_RIGHT_COLUMN":e.disabled=f||"right"===r.fixed;break;case"CLEAR_FIXED_COLUMN":e.disabled=f||!r.fixed}}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 C(t){return t.options.forEach(function(e){e.forEach(function(e){f(e,t),e.children&&e.children.forEach(function(e){f(e,t)})})}),!0}function b(){return new Promise(function(t){var n,a;s.modal?(n=s.getComponent("VxeNumberInput"))?(a=1,s.modal.alert({title:"请输入行数",width:220,maskClosable:!1,slots:{default:function(e,t){return t(n,{props:{value:a,min:1,max:100,type:"integer",align:"center",controlConfig:{layout:"default"}},style:{width:"100%"},on:{modelValue:function(e){a=e}}})}}}).then(function(e){t("confirm"===e?{size:a||1}:{size:0})})):(console.error(s.getI18n("vxe.error.reqComp",["vxe-number-input"])),t({size:0})):t({size:0})})}function g(){location.reload()}function L(){history.forward()}function A(){history.back()}function T(e){e&&e.copy&&(u=e.copy)}return n||(n=1,n=l,Object.defineProperty(n,"__esModule",{value:!0}),n.default=n.VxeUIPluginMenu=void 0,n.hasEnableConf=M,i=(e=e)&&e.__esModule?e:{default:e},m=function(e,t){return i.default.findIndexOf(e,function(e){return e.id===t.id})},R=function(e,t,n){return e.findRowIndexOf(t,n)},e=n.VxeUIPluginMenu={setConfig:T,install:function(e,t){(s=e).checkVersion?s.checkVersion(s.tableVersion,3,13)||console.error("[@vxe-ui/plugin-menu 3.4.0] ".concat(s.getI18n("vxe.error.errorVersion",["vxe-table@".concat(s.tableVersion||"?"),"vxe-table v".concat(3,".").concat(13,"+")]))):/^(3)\./.test(s.uiVersion||s.tableVersion)||console.error("[@vxe-ui/plugin-menu 3.4.0] Requires vxe-table 3.9.0+ version. https://vxeui.com/other3/#/plugin-menu/install"),T(t),s.menus.mixin({SYSTEM_PAGE_REFRESH:{tableMenuMethod:g,treeMenuMethod:g,calendarMenuMethod:g,menuMenuMethod:g,formDesignMenuMethod:g},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,a=e.$table,n=e.row,e=e.column;n&&e&&(M(a.mouseConfig,t=a.computeMouseOpts)&&t.area?(t=a.getCellAreas())&&t.length&&t.forEach(function(e){var n=e.rows;e.cols.forEach(function(t){n.forEach(function(e){a.clearData(e,t.field)})})}):a.clearData(n,e.field))}},CLEAR_AREA_CELL:{tableMenuMethod:function(e){var t,a=e.$table,n=e.row,e=e.column;n&&e&&(M(a.mouseConfig,t=a.computeMouseOpts)&&t.area?(t=a.getCellAreas())&&t.length&&t.forEach(function(e){var n=e.rows;e.cols.forEach(function(t){n.forEach(function(e){a.clearData(e,t.field)})})}):a.clearData(n,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 a=e.$table,t=e.row,e=e.column,n=a.mouseConfig,l=a.computeMouseOpts;M(n,l)&&l.area?(l.area?a.getCellAreas():[]).forEach(function(e){var t=e.rows,n=e.cols;t.forEach(function(t){n.forEach(function(e){a.clearData(t)})})}):t&&e&&a.clearData(t)}},CLEAR_ALL:{tableMenuMethod:function(e){e.$table.clearData()}},SELECT_ALL_AREA:{tableMenuMethod:function(e){var e=e.$table,t=e.mouseConfig,n=e.computeMouseOpts;M(t,n)&&n.area&&(t=e.getTableData().visibleData,n=e.getTableColumn().visibleColumn,e.setCellAreas([{startRow:i.default.first(t),endRow:i.default.last(t),startColumn:i.default.first(n),endColumn:i.default.last(n)}]))}},SELECT_AREA_TO_LEFT:{tableMenuMethod:function(e){var t=e.$table,n=e.row,e=e.column,a=t.mouseConfig,l=t.computeMouseOpts;M(a,l)&&l.area&&(a=t.getTableColumn().visibleColumn,1===(l=t.getCellAreas()).length?(l=l[0],t.setCellAreas([{startRow:i.default.first(l.rows),endRow:i.default.last(l.rows),startColumn:i.default.first(a),endColumn:i.default.last(l.cols)}],{column:e,row:n})):t.setCellAreas([{startRow:n,endRow:n,startColumn:i.default.first(a),endColumn:e}],{column:e,row:n}))}},SELECT_AREA_TO_RIGHT:{tableMenuMethod:function(e){var t=e.$table,n=e.row,e=e.column,a=t.mouseConfig,l=t.computeMouseOpts;M(a,l)&&l.area&&(a=t.getTableColumn().visibleColumn,1===(l=t.getCellAreas()).length?(l=l[0],t.setCellAreas([{startRow:i.default.first(l.rows),endRow:i.default.last(l.rows),startColumn:i.default.first(l.cols),endColumn:i.default.last(a)}],{column:e,row:n})):t.setCellAreas([{startRow:n,endRow:n,startColumn:e,endColumn:i.default.last(a)}],{column:e,row:n}))}},SELECT_AREA_TO_TOP:{tableMenuMethod:function(e){var t=e.$table,n=e.row,e=e.column,a=t.mouseConfig,l=t.computeMouseOpts;M(a,l)&&l.area&&(a=t.getTableData().visibleData,1===(l=t.getCellAreas()).length?(l=l[0],t.setCellAreas([{startRow:i.default.first(a),endRow:i.default.last(l.rows),startColumn:i.default.first(l.cols),endColumn:i.default.last(l.cols)}],{column:e,row:n})):t.setCellAreas([{startRow:i.default.first(a),endRow:n,startColumn:e,endColumn:e}],{column:e,row:n}))}},SELECT_AREA_TO_BOTTON:{tableMenuMethod:function(e){var t=e.$table,n=e.row,e=e.column,a=t.mouseConfig,l=t.computeMouseOpts;M(a,l)&&l.area&&(a=t.getTableData().visibleData,1===(l=t.getCellAreas()).length?(l=l[0],t.setCellAreas([{startRow:i.default.first(l.rows),endRow:i.default.last(a),startColumn:i.default.first(l.cols),endColumn:i.default.last(l.cols)}],{column:e,row:n})):t.setCellAreas([{startRow:n,endRow:i.default.last(a),startColumn:e,endColumn:e}],{column:e,row:n}))}},REVERT_CELL:{tableMenuMethod:function(e){var t,a=e.$table,n=e.row,e=e.column;n&&e&&(M(a.mouseConfig,t=a.computeMouseOpts)&&t.area?(t=a.getCellAreas())&&t.length&&t.forEach(function(e){var n=e.rows;e.cols.forEach(function(t){n.forEach(function(e){a.revertData(e,t.field)})})}):a.revertData(n,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:c)(e)}},COPY_CELL:{tableMenuMethod:function(e){r(e)}},COPY_AREA_CELL:{tableMenuMethod:function(e){r(e)}},CUT_CELL:{tableMenuMethod:function(e){r(e,!0)}},CUT_AREA_CELL:{tableMenuMethod:function(e){r(e,!0)}},PASTE_CELL:{tableMenuMethod:function(e){var t=e.$event,n=e.$table,a=e.row,e=e.column,l=n.mouseConfig,o=n.computeMouseOpts;M(l,o)&&o.area?n.triggerPasteCellAreaEvent(t):(l=_())&&l.text&&i.default.set(a,e.field,l.text)}},PASTE_AREA_CELL:{tableMenuMethod:function(e){var t=e.$event,e=e.$table,n=e.mouseConfig,a=e.computeMouseOpts;M(n,a)&&a.area&&e.triggerPasteCellAreaEvent(t)}},MERGE_OR_CLEAR:{tableMenuMethod:function(e){var t=e.$event,n=e.$table,a=n.getCellAreas(),e=h(e),l=!1,e=(e.length?n.removeMergeCells(e):(l=!0,n.setMergeCells(a.map(function(e){var t=e.rows,e=e.cols;return{row:t[0],col:e[0],rowspan:t.length,colspan:e.length}}))),a.map(function(e){return{rows:e.rows,cols:e.cols}}));n.dispatchEvent("cell-area-merge",{status:l,targetAreas:e},t)}},MERGE_CELL:{tableMenuMethod:function(e){var t=e.$event,n=e.$table,a=n.getTableData().visibleData,l=n.getTableColumn().visibleColumn,o=n.getCellAreas();E(e),o.some(function(e){return e.rows.length===a.length||e.cols.length===l.length})?s.modal&&s.modal.message({content:s.getI18n("vxe.pro.area.mergeErr"),status:"error",id:"operErr"}):(n.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}}),n.dispatchEvent("cell-area-merge",{status:!0,targetAreas:e},t))}},CLEAR_MERGE_CELL:{tableMenuMethod:function(e){var t=e.$event,n=e.$table,e=E(e);e.length&&n.dispatchEvent("clear-cell-area-merge",{mergeCells:e},t)}},CLEAR_ALL_MERGE:{tableMenuMethod:function(e){var t=e.$event,e=e.$table,n=e.getMergeCells(),a=e.getMergeFooterItems();e.clearMergeCells(),e.clearMergeFooterItems(),e.dispatchEvent("clear-merge",{mergeCells:n,mergeFooterItems:a},t)}},EDIT_CELL:{tableMenuMethod:function(e){var t=e.$table,n=e.row,e=e.column;t.setEditCell?t.setEditCell(n,e):t.setActiveCell(n,e.field)}},EDIT_ROW:{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,n=e.column,a=t.mouseConfig,l=t.computeMouseOpts;t.insert(e.menu.params||{}).then(function(e){e=e.rows;n&&M(a,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,n=e.menu,a=e.row,l=e.column,o=t.mouseConfig,r=t.computeMouseOpts;(a?t.insertAt(n.params||{},a):t.insert(n.params||{})).then(function(e){e=e.rows;l&&M(o,r)&&r.area&&t.setCellAreas([{startRow:i.default.first(e),endRow:i.default.last(e),startColumn:l,endColumn:l}])})}},BATCH_INSERT_AT_ROW:{tableMenuMethod:function(e){var t=e.$table,n=e.menu,a=e.row,l=e.column,o=t.mouseConfig,r=t.computeMouseOpts;b().then(function(e){var e=e.size;e&&(e=i.default.range(0,e).map(function(){return Object.assign({},n.params)}),(a?t.insertAt(e,a):t.insert(e)).then(function(e){e=e.rows;l&&M(o,r)&&r.area&&t.setCellAreas([{startRow:i.default.first(e),endRow:i.default.last(e),startColumn:l,endColumn:l}])}))})}},INSERT_NEXT_AT_ROW:{tableMenuMethod:function(e){var t=e.$table,n=e.menu,a=e.row,l=e.column,o=t.mouseConfig,r=t.computeMouseOpts;(a?t.insertNextAt(n.params||{},a):t.insert(n.params||{})).then(function(e){e=e.rows;l&&M(o,r)&&r.area&&t.setCellAreas([{startRow:i.default.first(e),endRow:i.default.last(e),startColumn:l,endColumn:l}])})}},BATCH_INSERT_NEXT_AT_ROW:{tableMenuMethod:function(e){var t=e.$table,n=e.menu,a=e.row,l=e.column,o=t.mouseConfig,r=t.computeMouseOpts;b().then(function(e){var e=e.size;e&&(e=i.default.range(0,e).map(function(){return Object.assign({},n.params)}),(a?t.insertNextAt(e,a):t.insert(e)).then(function(e){e=e.rows;l&&M(o,r)&&r.area&&t.setCellAreas([{startRow:i.default.first(e),endRow:i.default.last(e),startColumn:l,endColumn:l}])}))})}},INSERT_ACTIVED_ROW:{tableMenuMethod:function(e){var t=e.$table,n=e.column,a=e.menu.params||[],e=Object.assign({},a[0]||{});t.insert(e).then(function(e){e=e.row;t.setEditCell?t.setEditCell(e,a[1]||n):t.setActiveCell(e,a[1]||n.field)})}},INSERT_EDIT_ROW:{tableMenuMethod:function(e){var t=e.$table,n=e.column,a=e.menu.params||[],e=Object.assign({},a[0]||{});t.insert(e).then(function(e){e=e.row;t.setEditCell?t.setEditCell(e,a[1]||n):t.setActiveCell(e,a[1]||n.field)})}},INSERT_AT_ACTIVED_ROW:{tableMenuMethod:function(e){var t=e.$table,n=e.row,a=e.column,l=e.menu.params||[],e=Object.assign({},l[0]||{});(n?t.insertAt(e,n):t.insert(e)).then(function(e){e=e.row;t.setEditCell?t.setEditCell(e,l[1]||a):t.setActiveCell(e,l[1]||a.field)})}},INSERT_AT_EDIT_ROW:{tableMenuMethod:function(e){var t=e.$table,n=e.row,a=e.column,l=e.menu.params||[],e=Object.assign({},l[0]||{});(n?t.insertAt(e,n):t.insert(e)).then(function(e){e=e.row;t.setEditCell?t.setEditCell(e,l[1]||a):t.setActiveCell(e,l[1]||a.field)})}},BATCH_INSERT_AT_EDIT_ROW:{tableMenuMethod:function(e){var t=e.$table,n=e.row,a=e.column,l=e.menu.params||[];b().then(function(e){var e=e.size;e&&(e=i.default.range(0,e).map(function(){return Object.assign({},l[0])}),(n?t.insertAt(e,n):t.insert(e)).then(function(e){e=e.row;t.setEditCell?t.setEditCell(e,l[1]||a):t.setActiveCell(e,l[1]||a.field)}))})}},INSERT_NEXT_AT_EDIT_ROW:{tableMenuMethod:function(e){var t=e.$table,n=e.row,a=e.column,l=e.menu.params||[],e=Object.assign({},l[0]||{});(n?t.insertNextAt(e,n):t.insert(e)).then(function(e){e=e.row;t.setEditCell?t.setEditCell(e,l[1]||a):t.setActiveCell(e,l[1]||a.field)})}},BATCH_INSERT_NEXT_AT_EDIT_ROW:{tableMenuMethod:function(e){var t=e.$table,n=e.row,a=e.column,l=e.menu.params||[];b().then(function(e){var e=e.size;e&&(e=i.default.range(0,e).map(function(){return Object.assign({},l[0])}),(n?t.insertNextAt(e,n):t.insert(e)).then(function(e){e=e.row;t.setEditCell?t.setEditCell(e,l[1]||a):t.setActiveCell(e,l[1]||a.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,n=t.mouseConfig,a=t.computeMouseOpts;M(n,a)&&a.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,n=e.$table,e=e.column;e&&n.triggerSortEvent(t,e,null)}},CLEAR_ALL_SORT:{tableMenuMethod:function(e){var t=e.$event,e=e.$table,n=e.getSortColumns();n.length&&(e.clearSort(),e.dispatchEvent("clear-sort",{sortList:n},t))}},SORT_ASC:{tableMenuMethod:function(e){var t=e.$event,n=e.$table,e=e.column;e&&n.triggerSortEvent(t,e,"asc")}},SORT_DESC:{tableMenuMethod:function(e){var t=e.$event,n=e.$table,e=e.column;e&&n.triggerSortEvent(t,e,"desc")}},CLEAR_FILTER:{tableMenuMethod:function(e){var t=e.$event,n=e.$table,e=e.column;e&&(n.handleClearFilter(e),n.confirmFilterEvent(t))}},CLEAR_ALL_FILTER:{tableMenuMethod:function(e){var t=e.$event,e=e.$table,n=e.getCheckedFilters();n.length&&(e.clearFilter(),e.dispatchEvent("clear-filter",{filterList:n},t))}},FILTER_CELL:{tableMenuMethod:function(e){var t,n=e.$table,a=e.row,e=e.column;a&&e&&(t=e.field,(e=e.filters).length)&&((e=e[0]).data=i.default.get(a,t),e.checked=!0,n.updateData())}},EXPORT_ROW:{tableMenuMethod:function(e){var t=e.$table,n=e.menu,e=e.row;e&&t.exportData(i.default.assign({},n.params?n.params[0]:{},{data:[e]}))}},EXPORT_CHECKBOX_ROW:{tableMenuMethod:function(e){var t=e.$table,e=e.menu,n={data:t.getCheckboxRecords()};t.exportData(i.default.assign({},e.params?e.params[0]:{},n))}},EXPORT_ALL:{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,n={data:t.getCheckboxRecords()};t.print(i.default.assign(n,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:o("left"),FIXED_RIGHT_COLUMN:o("right"),CLEAR_FIXED_COLUMN:o(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:d("initial")},COMMIT_PROXY_QUERY:{tableMenuMethod:d("query")},COMMIT_PROXY_RELOAD:{tableMenuMethod:d("reload")},COMMIT_PROXY_DELETE:{tableMenuMethod:d("delete")},COMMIT_PROXY_SAVE:{tableMenuMethod:d("save")}}),s.interceptor.add("event.showMenu",C)}},"undefined"!=typeof window&&window.VxeUI&&window.VxeUI.use&&window.VxeUI.use(e),n.default=e),t(l)});
|