@vxe-ui/plugin-menu 3.3.2 → 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.
@@ -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,
@@ -246,10 +256,14 @@ function checkPrivilege(item, params) {
246
256
  }
247
257
  case 'EDIT_CELL':
248
258
  case 'CLEAR_CELL':
259
+ case 'CLEAR_AREA_CELL':
249
260
  case 'CLEAR_ROW':
250
261
  case 'COPY_CELL':
262
+ case 'COPY_AREA_CELL':
251
263
  case 'CUT_CELL':
264
+ case 'CUT_AREA_CELL':
252
265
  case 'PASTE_CELL':
266
+ case 'PASTE_AREA_CELL':
253
267
  case 'MERGE_OR_CLEAR':
254
268
  case 'MERGE_CELL':
255
269
  case 'REVERT_CELL':
@@ -309,7 +323,7 @@ function checkPrivilege(item, params) {
309
323
  case 'OPEN_FIND':
310
324
  case 'OPEN_REPLACE':
311
325
  {
312
- item.disabled = !(mouseConfig && mouseOpts.area);
326
+ item.disabled = !(hasEnableConf(mouseConfig, mouseOpts) && mouseOpts.area);
313
327
  break;
314
328
  }
315
329
  case 'EDIT_CELL':
@@ -318,14 +332,18 @@ function checkPrivilege(item, params) {
318
332
  break;
319
333
  }
320
334
  case 'COPY_CELL':
335
+ case 'COPY_AREA_CELL':
321
336
  case 'CUT_CELL':
337
+ case 'CUT_AREA_CELL':
322
338
  case 'PASTE_CELL':
339
+ case 'PASTE_AREA_CELL':
323
340
  {
324
- var cellAreas = mouseConfig && mouseOpts.area ? $table.getCellAreas() : [];
341
+ var cellAreas = hasEnableConf(mouseConfig, mouseOpts) && mouseOpts.area ? $table.getCellAreas() : [];
325
342
  item.disabled = cellAreas.length > 1;
326
343
  if (!item.disabled) {
327
344
  switch (code) {
328
345
  case 'PASTE_CELL':
346
+ case 'PASTE_AREA_CELL':
329
347
  {
330
348
  var clipboard = getClipboardObj();
331
349
  item.disabled = !clipboard || !clipboard.text;
@@ -338,7 +356,7 @@ function checkPrivilege(item, params) {
338
356
  case 'MERGE_OR_CLEAR':
339
357
  case 'MERGE_CELL':
340
358
  {
341
- var _cellAreas = mouseConfig && mouseOpts.area ? $table.getCellAreas() : [];
359
+ var _cellAreas = hasEnableConf(mouseConfig, mouseOpts) && mouseOpts.area ? $table.getCellAreas() : [];
342
360
  item.disabled = !_cellAreas.length || _cellAreas.length === 1 && _cellAreas[0].rows.length === 1 && _cellAreas[0].cols.length === 1 || !checkCellOverlay(params, _cellAreas);
343
361
  break;
344
362
  }
@@ -469,11 +487,11 @@ var VxeUIPluginMenu = exports.VxeUIPluginMenu = {
469
487
  var pVersion = 3;
470
488
  var sVersion = 13;
471
489
  if (!VxeUI.checkVersion(VxeUI.tableVersion, pVersion, sVersion)) {
472
- console.error("[@vxe-ui/plugin-menu 3.3.2] ".concat(VxeUI.getI18n('vxe.error.errorVersion', ["vxe-table@".concat(VxeUI.tableVersion || '?'), "vxe-table v".concat(pVersion, ".").concat(sVersion, "+")])));
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, "+")])));
473
491
  }
474
492
  } else {
475
493
  if (!/^(3)\./.test(VxeUI.uiVersion || VxeUI.tableVersion)) {
476
- console.error('[@vxe-ui/plugin-menu 3.3.2] Requires vxe-table 3.9.0+ version. https://vxeui.com/other3/#/plugin-menu/install');
494
+ console.error('[@vxe-ui/plugin-menu 3.4.0] Requires vxe-table 3.9.0+ version. https://vxeui.com/other3/#/plugin-menu/install');
477
495
  }
478
496
  }
479
497
  pluginConfig(options);
@@ -520,7 +538,38 @@ var VxeUIPluginMenu = exports.VxeUIPluginMenu = {
520
538
  var tableProps = $table;
521
539
  var mouseConfig = tableProps.mouseConfig;
522
540
  var mouseOpts = $table.computeMouseOpts;
523
- if (mouseConfig && mouseOpts.area) {
541
+ if (hasEnableConf(mouseConfig, mouseOpts) && mouseOpts.area) {
542
+ var cellAreas = $table.getCellAreas();
543
+ if (cellAreas && cellAreas.length) {
544
+ cellAreas.forEach(function (areaItem) {
545
+ var rows = areaItem.rows,
546
+ cols = areaItem.cols;
547
+ cols.forEach(function (column) {
548
+ rows.forEach(function (row) {
549
+ $table.clearData(row, column.field);
550
+ });
551
+ });
552
+ });
553
+ }
554
+ } else {
555
+ $table.clearData(row, column.field);
556
+ }
557
+ }
558
+ }
559
+ },
560
+ /**
561
+ * 清除单元格数据的值;如果启用 mouse-config.area 功能,则清除区域范围内的单元格数据
562
+ */
563
+ CLEAR_AREA_CELL: {
564
+ tableMenuMethod: function tableMenuMethod(params) {
565
+ var $table = params.$table,
566
+ row = params.row,
567
+ column = params.column;
568
+ if (row && column) {
569
+ var tableProps = $table;
570
+ var mouseConfig = tableProps.mouseConfig;
571
+ var mouseOpts = $table.computeMouseOpts;
572
+ if (hasEnableConf(mouseConfig, mouseOpts) && mouseOpts.area) {
524
573
  var cellAreas = $table.getCellAreas();
525
574
  if (cellAreas && cellAreas.length) {
526
575
  cellAreas.forEach(function (areaItem) {
@@ -571,8 +620,8 @@ var VxeUIPluginMenu = exports.VxeUIPluginMenu = {
571
620
  var tableProps = $table;
572
621
  var mouseConfig = tableProps.mouseConfig;
573
622
  var mouseOpts = $table.computeMouseOpts;
574
- if (mouseConfig && mouseOpts.area) {
575
- var cellAreas = mouseConfig && mouseOpts.area ? $table.getCellAreas() : [];
623
+ if (hasEnableConf(mouseConfig, mouseOpts) && mouseOpts.area) {
624
+ var cellAreas = mouseOpts.area ? $table.getCellAreas() : [];
576
625
  cellAreas.forEach(function (areaItem) {
577
626
  var rows = areaItem.rows,
578
627
  cols = areaItem.cols;
@@ -607,7 +656,7 @@ var VxeUIPluginMenu = exports.VxeUIPluginMenu = {
607
656
  var tableProps = $table;
608
657
  var mouseConfig = tableProps.mouseConfig;
609
658
  var mouseOpts = $table.computeMouseOpts;
610
- if (mouseConfig && mouseOpts.area) {
659
+ if (hasEnableConf(mouseConfig, mouseOpts) && mouseOpts.area) {
611
660
  var _$table$getTableData4 = $table.getTableData(),
612
661
  visibleData = _$table$getTableData4.visibleData;
613
662
  var _$table$getTableColum4 = $table.getTableColumn(),
@@ -632,7 +681,7 @@ var VxeUIPluginMenu = exports.VxeUIPluginMenu = {
632
681
  var tableProps = $table;
633
682
  var mouseConfig = tableProps.mouseConfig;
634
683
  var mouseOpts = $table.computeMouseOpts;
635
- if (mouseConfig && mouseOpts.area) {
684
+ if (hasEnableConf(mouseConfig, mouseOpts) && mouseOpts.area) {
636
685
  var _$table$getTableColum5 = $table.getTableColumn(),
637
686
  visibleColumn = _$table$getTableColum5.visibleColumn;
638
687
  var cellAreas = $table.getCellAreas();
@@ -672,7 +721,7 @@ var VxeUIPluginMenu = exports.VxeUIPluginMenu = {
672
721
  var tableProps = $table;
673
722
  var mouseConfig = tableProps.mouseConfig;
674
723
  var mouseOpts = $table.computeMouseOpts;
675
- if (mouseConfig && mouseOpts.area) {
724
+ if (hasEnableConf(mouseConfig, mouseOpts) && mouseOpts.area) {
676
725
  var _$table$getTableColum6 = $table.getTableColumn(),
677
726
  visibleColumn = _$table$getTableColum6.visibleColumn;
678
727
  var cellAreas = $table.getCellAreas();
@@ -712,7 +761,7 @@ var VxeUIPluginMenu = exports.VxeUIPluginMenu = {
712
761
  var tableProps = $table;
713
762
  var mouseConfig = tableProps.mouseConfig;
714
763
  var mouseOpts = $table.computeMouseOpts;
715
- if (mouseConfig && mouseOpts.area) {
764
+ if (hasEnableConf(mouseConfig, mouseOpts) && mouseOpts.area) {
716
765
  var _$table$getTableData5 = $table.getTableData(),
717
766
  visibleData = _$table$getTableData5.visibleData;
718
767
  var cellAreas = $table.getCellAreas();
@@ -752,7 +801,7 @@ var VxeUIPluginMenu = exports.VxeUIPluginMenu = {
752
801
  var tableProps = $table;
753
802
  var mouseConfig = tableProps.mouseConfig;
754
803
  var mouseOpts = $table.computeMouseOpts;
755
- if (mouseConfig && mouseOpts.area) {
804
+ if (hasEnableConf(mouseConfig, mouseOpts) && mouseOpts.area) {
756
805
  var _$table$getTableData6 = $table.getTableData(),
757
806
  visibleData = _$table$getTableData6.visibleData;
758
807
  var cellAreas = $table.getCellAreas();
@@ -793,7 +842,7 @@ var VxeUIPluginMenu = exports.VxeUIPluginMenu = {
793
842
  var tableProps = $table;
794
843
  var mouseConfig = tableProps.mouseConfig;
795
844
  var mouseOpts = $table.computeMouseOpts;
796
- if (mouseConfig && mouseOpts.area) {
845
+ if (hasEnableConf(mouseConfig, mouseOpts) && mouseOpts.area) {
797
846
  var cellAreas = $table.getCellAreas();
798
847
  if (cellAreas && cellAreas.length) {
799
848
  cellAreas.forEach(function (areaItem) {
@@ -867,6 +916,14 @@ var VxeUIPluginMenu = exports.VxeUIPluginMenu = {
867
916
  handleCopyOrCut(params);
868
917
  }
869
918
  },
919
+ /**
920
+ * 复制单元格数据的值;用于 mouse-config.area 功能,复制区域范围内的单元格数据,支持 Excel 和 WPS
921
+ */
922
+ COPY_AREA_CELL: {
923
+ tableMenuMethod: function tableMenuMethod(params) {
924
+ handleCopyOrCut(params);
925
+ }
926
+ },
870
927
  /**
871
928
  * 剪贴单元格数据的值;如果启用 mouse-config.area 功能,则剪贴区域范围内的单元格数据,支持 Excel 和 WPS
872
929
  */
@@ -875,6 +932,14 @@ var VxeUIPluginMenu = exports.VxeUIPluginMenu = {
875
932
  handleCopyOrCut(params, true);
876
933
  }
877
934
  },
935
+ /**
936
+ * 剪贴单元格数据的值;用于 mouse-config.area 功能,剪贴区域范围内的单元格数据,支持 Excel 和 WPS
937
+ */
938
+ CUT_AREA_CELL: {
939
+ tableMenuMethod: function tableMenuMethod(params) {
940
+ handleCopyOrCut(params, true);
941
+ }
942
+ },
878
943
  /**
879
944
  * 粘贴从表格中被复制的数据;如果启用 mouse-config.area 功能,则粘贴区域范围内的单元格数据,不支持读取剪贴板
880
945
  */
@@ -887,7 +952,7 @@ var VxeUIPluginMenu = exports.VxeUIPluginMenu = {
887
952
  var tableProps = $table;
888
953
  var mouseConfig = tableProps.mouseConfig;
889
954
  var mouseOpts = $table.computeMouseOpts;
890
- if (mouseConfig && mouseOpts.area) {
955
+ if (hasEnableConf(mouseConfig, mouseOpts) && mouseOpts.area) {
891
956
  $table.triggerPasteCellAreaEvent($event);
892
957
  } else {
893
958
  var clipboard = getClipboardObj();
@@ -898,6 +963,21 @@ var VxeUIPluginMenu = exports.VxeUIPluginMenu = {
898
963
  }
899
964
  }
900
965
  },
966
+ /**
967
+ * 粘贴从表格中被复制的数据;用于 mouse-config.area 功能,粘贴区域范围内的单元格数据,不支持读取剪贴板
968
+ */
969
+ PASTE_AREA_CELL: {
970
+ tableMenuMethod: function tableMenuMethod(params) {
971
+ var $event = params.$event,
972
+ $table = params.$table;
973
+ var tableProps = $table;
974
+ var mouseConfig = tableProps.mouseConfig;
975
+ var mouseOpts = $table.computeMouseOpts;
976
+ if (hasEnableConf(mouseConfig, mouseOpts) && mouseOpts.area) {
977
+ $table.triggerPasteCellAreaEvent($event);
978
+ }
979
+ }
980
+ },
901
981
  /**
902
982
  * 如果启用 mouse-config.area 功能,如果所选区域内已存在合并单元格,则取消临时合并,否则临时合并
903
983
  */
@@ -1064,7 +1144,7 @@ var VxeUIPluginMenu = exports.VxeUIPluginMenu = {
1064
1144
  var mouseOpts = $table.computeMouseOpts;
1065
1145
  $table.insert(menu.params || {}).then(function (_ref7) {
1066
1146
  var rows = _ref7.rows;
1067
- if (column && mouseConfig && mouseOpts.area) {
1147
+ if (column && hasEnableConf(mouseConfig, mouseOpts) && mouseOpts.area) {
1068
1148
  $table.setCellAreas([{
1069
1149
  startRow: _xeUtils["default"].first(rows),
1070
1150
  endRow: _xeUtils["default"].last(rows),
@@ -1089,7 +1169,7 @@ var VxeUIPluginMenu = exports.VxeUIPluginMenu = {
1089
1169
  var mouseOpts = $table.computeMouseOpts;
1090
1170
  (row ? $table.insertAt(menu.params || {}, row) : $table.insert(menu.params || {})).then(function (_ref8) {
1091
1171
  var rows = _ref8.rows;
1092
- if (column && mouseConfig && mouseOpts.area) {
1172
+ if (column && hasEnableConf(mouseConfig, mouseOpts) && mouseOpts.area) {
1093
1173
  $table.setCellAreas([{
1094
1174
  startRow: _xeUtils["default"].first(rows),
1095
1175
  endRow: _xeUtils["default"].last(rows),
@@ -1120,7 +1200,7 @@ var VxeUIPluginMenu = exports.VxeUIPluginMenu = {
1120
1200
  });
1121
1201
  (row ? $table.insertAt(records, row) : $table.insert(records)).then(function (_ref0) {
1122
1202
  var rows = _ref0.rows;
1123
- if (column && mouseConfig && mouseOpts.area) {
1203
+ if (column && hasEnableConf(mouseConfig, mouseOpts) && mouseOpts.area) {
1124
1204
  $table.setCellAreas([{
1125
1205
  startRow: _xeUtils["default"].first(rows),
1126
1206
  endRow: _xeUtils["default"].last(rows),
@@ -1147,7 +1227,7 @@ var VxeUIPluginMenu = exports.VxeUIPluginMenu = {
1147
1227
  var mouseOpts = $table.computeMouseOpts;
1148
1228
  (row ? $table.insertNextAt(menu.params || {}, row) : $table.insert(menu.params || {})).then(function (_ref1) {
1149
1229
  var rows = _ref1.rows;
1150
- if (column && mouseConfig && mouseOpts.area) {
1230
+ if (column && hasEnableConf(mouseConfig, mouseOpts) && mouseOpts.area) {
1151
1231
  $table.setCellAreas([{
1152
1232
  startRow: _xeUtils["default"].first(rows),
1153
1233
  endRow: _xeUtils["default"].last(rows),
@@ -1178,7 +1258,7 @@ var VxeUIPluginMenu = exports.VxeUIPluginMenu = {
1178
1258
  });
1179
1259
  (row ? $table.insertNextAt(records, row) : $table.insert(records)).then(function (_ref11) {
1180
1260
  var rows = _ref11.rows;
1181
- if (column && mouseConfig && mouseOpts.area) {
1261
+ if (column && hasEnableConf(mouseConfig, mouseOpts) && mouseOpts.area) {
1182
1262
  $table.setCellAreas([{
1183
1263
  startRow: _xeUtils["default"].first(rows),
1184
1264
  endRow: _xeUtils["default"].last(rows),
@@ -1381,8 +1461,8 @@ var VxeUIPluginMenu = exports.VxeUIPluginMenu = {
1381
1461
  var tableProps = $table;
1382
1462
  var mouseConfig = tableProps.mouseConfig;
1383
1463
  var mouseOpts = $table.computeMouseOpts;
1384
- if (mouseConfig && mouseOpts.area) {
1385
- var cellAreas = mouseConfig && mouseOpts.area ? $table.getCellAreas() : [];
1464
+ if (hasEnableConf(mouseConfig, mouseOpts) && mouseOpts.area) {
1465
+ var cellAreas = $table.getCellAreas();
1386
1466
  cellAreas.forEach(function (areaItem) {
1387
1467
  var rows = areaItem.rows;
1388
1468
  $table.remove(rows);
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,
@@ -246,10 +256,14 @@ function checkPrivilege(item, params) {
246
256
  }
247
257
  case 'EDIT_CELL':
248
258
  case 'CLEAR_CELL':
259
+ case 'CLEAR_AREA_CELL':
249
260
  case 'CLEAR_ROW':
250
261
  case 'COPY_CELL':
262
+ case 'COPY_AREA_CELL':
251
263
  case 'CUT_CELL':
264
+ case 'CUT_AREA_CELL':
252
265
  case 'PASTE_CELL':
266
+ case 'PASTE_AREA_CELL':
253
267
  case 'MERGE_OR_CLEAR':
254
268
  case 'MERGE_CELL':
255
269
  case 'REVERT_CELL':
@@ -309,7 +323,7 @@ function checkPrivilege(item, params) {
309
323
  case 'OPEN_FIND':
310
324
  case 'OPEN_REPLACE':
311
325
  {
312
- item.disabled = !(mouseConfig && mouseOpts.area);
326
+ item.disabled = !(hasEnableConf(mouseConfig, mouseOpts) && mouseOpts.area);
313
327
  break;
314
328
  }
315
329
  case 'EDIT_CELL':
@@ -318,14 +332,18 @@ function checkPrivilege(item, params) {
318
332
  break;
319
333
  }
320
334
  case 'COPY_CELL':
335
+ case 'COPY_AREA_CELL':
321
336
  case 'CUT_CELL':
337
+ case 'CUT_AREA_CELL':
322
338
  case 'PASTE_CELL':
339
+ case 'PASTE_AREA_CELL':
323
340
  {
324
- var cellAreas = mouseConfig && mouseOpts.area ? $table.getCellAreas() : [];
341
+ var cellAreas = hasEnableConf(mouseConfig, mouseOpts) && mouseOpts.area ? $table.getCellAreas() : [];
325
342
  item.disabled = cellAreas.length > 1;
326
343
  if (!item.disabled) {
327
344
  switch (code) {
328
345
  case 'PASTE_CELL':
346
+ case 'PASTE_AREA_CELL':
329
347
  {
330
348
  var clipboard = getClipboardObj();
331
349
  item.disabled = !clipboard || !clipboard.text;
@@ -338,7 +356,7 @@ function checkPrivilege(item, params) {
338
356
  case 'MERGE_OR_CLEAR':
339
357
  case 'MERGE_CELL':
340
358
  {
341
- var _cellAreas = mouseConfig && mouseOpts.area ? $table.getCellAreas() : [];
359
+ var _cellAreas = hasEnableConf(mouseConfig, mouseOpts) && mouseOpts.area ? $table.getCellAreas() : [];
342
360
  item.disabled = !_cellAreas.length || _cellAreas.length === 1 && _cellAreas[0].rows.length === 1 && _cellAreas[0].cols.length === 1 || !checkCellOverlay(params, _cellAreas);
343
361
  break;
344
362
  }
@@ -469,11 +487,11 @@ var VxeUIPluginMenu = exports.VxeUIPluginMenu = {
469
487
  var pVersion = 3;
470
488
  var sVersion = 13;
471
489
  if (!VxeUI.checkVersion(VxeUI.tableVersion, pVersion, sVersion)) {
472
- console.error("[@vxe-ui/plugin-menu 3.3.2] ".concat(VxeUI.getI18n('vxe.error.errorVersion', ["vxe-table@".concat(VxeUI.tableVersion || '?'), "vxe-table v".concat(pVersion, ".").concat(sVersion, "+")])));
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, "+")])));
473
491
  }
474
492
  } else {
475
493
  if (!/^(3)\./.test(VxeUI.uiVersion || VxeUI.tableVersion)) {
476
- console.error('[@vxe-ui/plugin-menu 3.3.2] Requires vxe-table 3.9.0+ version. https://vxeui.com/other3/#/plugin-menu/install');
494
+ console.error('[@vxe-ui/plugin-menu 3.4.0] Requires vxe-table 3.9.0+ version. https://vxeui.com/other3/#/plugin-menu/install');
477
495
  }
478
496
  }
479
497
  pluginConfig(options);
@@ -520,7 +538,38 @@ var VxeUIPluginMenu = exports.VxeUIPluginMenu = {
520
538
  var tableProps = $table;
521
539
  var mouseConfig = tableProps.mouseConfig;
522
540
  var mouseOpts = $table.computeMouseOpts;
523
- if (mouseConfig && mouseOpts.area) {
541
+ if (hasEnableConf(mouseConfig, mouseOpts) && mouseOpts.area) {
542
+ var cellAreas = $table.getCellAreas();
543
+ if (cellAreas && cellAreas.length) {
544
+ cellAreas.forEach(function (areaItem) {
545
+ var rows = areaItem.rows,
546
+ cols = areaItem.cols;
547
+ cols.forEach(function (column) {
548
+ rows.forEach(function (row) {
549
+ $table.clearData(row, column.field);
550
+ });
551
+ });
552
+ });
553
+ }
554
+ } else {
555
+ $table.clearData(row, column.field);
556
+ }
557
+ }
558
+ }
559
+ },
560
+ /**
561
+ * 清除单元格数据的值;如果启用 mouse-config.area 功能,则清除区域范围内的单元格数据
562
+ */
563
+ CLEAR_AREA_CELL: {
564
+ tableMenuMethod: function tableMenuMethod(params) {
565
+ var $table = params.$table,
566
+ row = params.row,
567
+ column = params.column;
568
+ if (row && column) {
569
+ var tableProps = $table;
570
+ var mouseConfig = tableProps.mouseConfig;
571
+ var mouseOpts = $table.computeMouseOpts;
572
+ if (hasEnableConf(mouseConfig, mouseOpts) && mouseOpts.area) {
524
573
  var cellAreas = $table.getCellAreas();
525
574
  if (cellAreas && cellAreas.length) {
526
575
  cellAreas.forEach(function (areaItem) {
@@ -571,8 +620,8 @@ var VxeUIPluginMenu = exports.VxeUIPluginMenu = {
571
620
  var tableProps = $table;
572
621
  var mouseConfig = tableProps.mouseConfig;
573
622
  var mouseOpts = $table.computeMouseOpts;
574
- if (mouseConfig && mouseOpts.area) {
575
- var cellAreas = mouseConfig && mouseOpts.area ? $table.getCellAreas() : [];
623
+ if (hasEnableConf(mouseConfig, mouseOpts) && mouseOpts.area) {
624
+ var cellAreas = mouseOpts.area ? $table.getCellAreas() : [];
576
625
  cellAreas.forEach(function (areaItem) {
577
626
  var rows = areaItem.rows,
578
627
  cols = areaItem.cols;
@@ -607,7 +656,7 @@ var VxeUIPluginMenu = exports.VxeUIPluginMenu = {
607
656
  var tableProps = $table;
608
657
  var mouseConfig = tableProps.mouseConfig;
609
658
  var mouseOpts = $table.computeMouseOpts;
610
- if (mouseConfig && mouseOpts.area) {
659
+ if (hasEnableConf(mouseConfig, mouseOpts) && mouseOpts.area) {
611
660
  var _$table$getTableData4 = $table.getTableData(),
612
661
  visibleData = _$table$getTableData4.visibleData;
613
662
  var _$table$getTableColum4 = $table.getTableColumn(),
@@ -632,7 +681,7 @@ var VxeUIPluginMenu = exports.VxeUIPluginMenu = {
632
681
  var tableProps = $table;
633
682
  var mouseConfig = tableProps.mouseConfig;
634
683
  var mouseOpts = $table.computeMouseOpts;
635
- if (mouseConfig && mouseOpts.area) {
684
+ if (hasEnableConf(mouseConfig, mouseOpts) && mouseOpts.area) {
636
685
  var _$table$getTableColum5 = $table.getTableColumn(),
637
686
  visibleColumn = _$table$getTableColum5.visibleColumn;
638
687
  var cellAreas = $table.getCellAreas();
@@ -672,7 +721,7 @@ var VxeUIPluginMenu = exports.VxeUIPluginMenu = {
672
721
  var tableProps = $table;
673
722
  var mouseConfig = tableProps.mouseConfig;
674
723
  var mouseOpts = $table.computeMouseOpts;
675
- if (mouseConfig && mouseOpts.area) {
724
+ if (hasEnableConf(mouseConfig, mouseOpts) && mouseOpts.area) {
676
725
  var _$table$getTableColum6 = $table.getTableColumn(),
677
726
  visibleColumn = _$table$getTableColum6.visibleColumn;
678
727
  var cellAreas = $table.getCellAreas();
@@ -712,7 +761,7 @@ var VxeUIPluginMenu = exports.VxeUIPluginMenu = {
712
761
  var tableProps = $table;
713
762
  var mouseConfig = tableProps.mouseConfig;
714
763
  var mouseOpts = $table.computeMouseOpts;
715
- if (mouseConfig && mouseOpts.area) {
764
+ if (hasEnableConf(mouseConfig, mouseOpts) && mouseOpts.area) {
716
765
  var _$table$getTableData5 = $table.getTableData(),
717
766
  visibleData = _$table$getTableData5.visibleData;
718
767
  var cellAreas = $table.getCellAreas();
@@ -752,7 +801,7 @@ var VxeUIPluginMenu = exports.VxeUIPluginMenu = {
752
801
  var tableProps = $table;
753
802
  var mouseConfig = tableProps.mouseConfig;
754
803
  var mouseOpts = $table.computeMouseOpts;
755
- if (mouseConfig && mouseOpts.area) {
804
+ if (hasEnableConf(mouseConfig, mouseOpts) && mouseOpts.area) {
756
805
  var _$table$getTableData6 = $table.getTableData(),
757
806
  visibleData = _$table$getTableData6.visibleData;
758
807
  var cellAreas = $table.getCellAreas();
@@ -793,7 +842,7 @@ var VxeUIPluginMenu = exports.VxeUIPluginMenu = {
793
842
  var tableProps = $table;
794
843
  var mouseConfig = tableProps.mouseConfig;
795
844
  var mouseOpts = $table.computeMouseOpts;
796
- if (mouseConfig && mouseOpts.area) {
845
+ if (hasEnableConf(mouseConfig, mouseOpts) && mouseOpts.area) {
797
846
  var cellAreas = $table.getCellAreas();
798
847
  if (cellAreas && cellAreas.length) {
799
848
  cellAreas.forEach(function (areaItem) {
@@ -867,6 +916,14 @@ var VxeUIPluginMenu = exports.VxeUIPluginMenu = {
867
916
  handleCopyOrCut(params);
868
917
  }
869
918
  },
919
+ /**
920
+ * 复制单元格数据的值;用于 mouse-config.area 功能,复制区域范围内的单元格数据,支持 Excel 和 WPS
921
+ */
922
+ COPY_AREA_CELL: {
923
+ tableMenuMethod: function tableMenuMethod(params) {
924
+ handleCopyOrCut(params);
925
+ }
926
+ },
870
927
  /**
871
928
  * 剪贴单元格数据的值;如果启用 mouse-config.area 功能,则剪贴区域范围内的单元格数据,支持 Excel 和 WPS
872
929
  */
@@ -875,6 +932,14 @@ var VxeUIPluginMenu = exports.VxeUIPluginMenu = {
875
932
  handleCopyOrCut(params, true);
876
933
  }
877
934
  },
935
+ /**
936
+ * 剪贴单元格数据的值;用于 mouse-config.area 功能,剪贴区域范围内的单元格数据,支持 Excel 和 WPS
937
+ */
938
+ CUT_AREA_CELL: {
939
+ tableMenuMethod: function tableMenuMethod(params) {
940
+ handleCopyOrCut(params, true);
941
+ }
942
+ },
878
943
  /**
879
944
  * 粘贴从表格中被复制的数据;如果启用 mouse-config.area 功能,则粘贴区域范围内的单元格数据,不支持读取剪贴板
880
945
  */
@@ -887,7 +952,7 @@ var VxeUIPluginMenu = exports.VxeUIPluginMenu = {
887
952
  var tableProps = $table;
888
953
  var mouseConfig = tableProps.mouseConfig;
889
954
  var mouseOpts = $table.computeMouseOpts;
890
- if (mouseConfig && mouseOpts.area) {
955
+ if (hasEnableConf(mouseConfig, mouseOpts) && mouseOpts.area) {
891
956
  $table.triggerPasteCellAreaEvent($event);
892
957
  } else {
893
958
  var clipboard = getClipboardObj();
@@ -898,6 +963,21 @@ var VxeUIPluginMenu = exports.VxeUIPluginMenu = {
898
963
  }
899
964
  }
900
965
  },
966
+ /**
967
+ * 粘贴从表格中被复制的数据;用于 mouse-config.area 功能,粘贴区域范围内的单元格数据,不支持读取剪贴板
968
+ */
969
+ PASTE_AREA_CELL: {
970
+ tableMenuMethod: function tableMenuMethod(params) {
971
+ var $event = params.$event,
972
+ $table = params.$table;
973
+ var tableProps = $table;
974
+ var mouseConfig = tableProps.mouseConfig;
975
+ var mouseOpts = $table.computeMouseOpts;
976
+ if (hasEnableConf(mouseConfig, mouseOpts) && mouseOpts.area) {
977
+ $table.triggerPasteCellAreaEvent($event);
978
+ }
979
+ }
980
+ },
901
981
  /**
902
982
  * 如果启用 mouse-config.area 功能,如果所选区域内已存在合并单元格,则取消临时合并,否则临时合并
903
983
  */
@@ -1064,7 +1144,7 @@ var VxeUIPluginMenu = exports.VxeUIPluginMenu = {
1064
1144
  var mouseOpts = $table.computeMouseOpts;
1065
1145
  $table.insert(menu.params || {}).then(function (_ref7) {
1066
1146
  var rows = _ref7.rows;
1067
- if (column && mouseConfig && mouseOpts.area) {
1147
+ if (column && hasEnableConf(mouseConfig, mouseOpts) && mouseOpts.area) {
1068
1148
  $table.setCellAreas([{
1069
1149
  startRow: _xeUtils["default"].first(rows),
1070
1150
  endRow: _xeUtils["default"].last(rows),
@@ -1089,7 +1169,7 @@ var VxeUIPluginMenu = exports.VxeUIPluginMenu = {
1089
1169
  var mouseOpts = $table.computeMouseOpts;
1090
1170
  (row ? $table.insertAt(menu.params || {}, row) : $table.insert(menu.params || {})).then(function (_ref8) {
1091
1171
  var rows = _ref8.rows;
1092
- if (column && mouseConfig && mouseOpts.area) {
1172
+ if (column && hasEnableConf(mouseConfig, mouseOpts) && mouseOpts.area) {
1093
1173
  $table.setCellAreas([{
1094
1174
  startRow: _xeUtils["default"].first(rows),
1095
1175
  endRow: _xeUtils["default"].last(rows),
@@ -1120,7 +1200,7 @@ var VxeUIPluginMenu = exports.VxeUIPluginMenu = {
1120
1200
  });
1121
1201
  (row ? $table.insertAt(records, row) : $table.insert(records)).then(function (_ref0) {
1122
1202
  var rows = _ref0.rows;
1123
- if (column && mouseConfig && mouseOpts.area) {
1203
+ if (column && hasEnableConf(mouseConfig, mouseOpts) && mouseOpts.area) {
1124
1204
  $table.setCellAreas([{
1125
1205
  startRow: _xeUtils["default"].first(rows),
1126
1206
  endRow: _xeUtils["default"].last(rows),
@@ -1147,7 +1227,7 @@ var VxeUIPluginMenu = exports.VxeUIPluginMenu = {
1147
1227
  var mouseOpts = $table.computeMouseOpts;
1148
1228
  (row ? $table.insertNextAt(menu.params || {}, row) : $table.insert(menu.params || {})).then(function (_ref1) {
1149
1229
  var rows = _ref1.rows;
1150
- if (column && mouseConfig && mouseOpts.area) {
1230
+ if (column && hasEnableConf(mouseConfig, mouseOpts) && mouseOpts.area) {
1151
1231
  $table.setCellAreas([{
1152
1232
  startRow: _xeUtils["default"].first(rows),
1153
1233
  endRow: _xeUtils["default"].last(rows),
@@ -1178,7 +1258,7 @@ var VxeUIPluginMenu = exports.VxeUIPluginMenu = {
1178
1258
  });
1179
1259
  (row ? $table.insertNextAt(records, row) : $table.insert(records)).then(function (_ref11) {
1180
1260
  var rows = _ref11.rows;
1181
- if (column && mouseConfig && mouseOpts.area) {
1261
+ if (column && hasEnableConf(mouseConfig, mouseOpts) && mouseOpts.area) {
1182
1262
  $table.setCellAreas([{
1183
1263
  startRow: _xeUtils["default"].first(rows),
1184
1264
  endRow: _xeUtils["default"].last(rows),
@@ -1381,8 +1461,8 @@ var VxeUIPluginMenu = exports.VxeUIPluginMenu = {
1381
1461
  var tableProps = $table;
1382
1462
  var mouseConfig = tableProps.mouseConfig;
1383
1463
  var mouseOpts = $table.computeMouseOpts;
1384
- if (mouseConfig && mouseOpts.area) {
1385
- var cellAreas = mouseConfig && mouseOpts.area ? $table.getCellAreas() : [];
1464
+ if (hasEnableConf(mouseConfig, mouseOpts) && mouseOpts.area) {
1465
+ var cellAreas = $table.getCellAreas();
1386
1466
  cellAreas.forEach(function (areaItem) {
1387
1467
  var rows = areaItem.rows;
1388
1468
  $table.remove(rows);