@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 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.3.4] ".concat(VxeUI.getI18n('vxe.error.errorVersion', ["vxe-table@".concat(VxeUI.tableVersion || '?'), "vxe-table v".concat(pVersion, ".").concat(sVersion, "+")])));
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.3.4] Requires vxe-table 3.9.0+ version. https://vxeui.com/other3/#/plugin-menu/install');
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 = mouseConfig && mouseOpts.area ? $table.getCellAreas() : [];
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 = mouseConfig && mouseOpts.area ? $table.getCellAreas() : [];
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);
@@ -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)});
package/es/index.esm.js CHANGED
@@ -1,6 +1,15 @@
1
1
  import XEUtils from 'xe-utils';
2
2
  let VxeUI;
3
3
  let handleCopy;
4
+ /**
5
+ * 用于开关类型的配置项
6
+ * 局部启用规则:conf={}
7
+ * 局部禁用规则:conf={enabled:false}
8
+ * 全局默认启用规则:conf.enabled=true
9
+ */
10
+ export function hasEnableConf(conf, opts) {
11
+ return opts && (conf ? opts.enabled !== false : opts.enabled);
12
+ }
4
13
  const columnIndexOf = (cols, column) => {
5
14
  return XEUtils.findIndexOf(cols, item => item.id === column.id);
6
15
  };
@@ -75,7 +84,7 @@ function handleCopyOrCut(params, isCut) {
75
84
  const { mouseConfig } = props;
76
85
  const mouseOpts = $table.computeMouseOpts;
77
86
  let text = '';
78
- if (mouseConfig && mouseOpts.area) {
87
+ if (hasEnableConf(mouseConfig, mouseOpts) && mouseOpts.area) {
79
88
  if (isCut) {
80
89
  $table.triggerCutCellAreaEvent($event);
81
90
  }
@@ -138,7 +147,7 @@ function getBeenMerges(params) {
138
147
  const mouseOpts = $table.computeMouseOpts;
139
148
  const { visibleData } = $table.getTableData();
140
149
  const { visibleColumn } = $table.getTableColumn();
141
- const cellAreas = mouseConfig && mouseOpts.area ? $table.getCellAreas() : [];
150
+ const cellAreas = hasEnableConf(mouseConfig, mouseOpts) && mouseOpts.area ? $table.getCellAreas() : [];
142
151
  const mergeList = $table.getMergeCells();
143
152
  return mergeList.filter(({ row: mergeRowIndex, col: mergeColIndex, rowspan: mergeRowspan, colspan: mergeColspan }) => {
144
153
  return cellAreas.some(areaItem => {
@@ -270,7 +279,7 @@ function checkPrivilege(item, params) {
270
279
  }
271
280
  case 'OPEN_FIND':
272
281
  case 'OPEN_REPLACE': {
273
- item.disabled = !(mouseConfig && mouseOpts.area);
282
+ item.disabled = !(hasEnableConf(mouseConfig, mouseOpts) && mouseOpts.area);
274
283
  break;
275
284
  }
276
285
  case 'EDIT_CELL': {
@@ -283,7 +292,7 @@ function checkPrivilege(item, params) {
283
292
  case 'CUT_AREA_CELL':
284
293
  case 'PASTE_CELL':
285
294
  case 'PASTE_AREA_CELL': {
286
- const cellAreas = mouseConfig && mouseOpts.area ? $table.getCellAreas() : [];
295
+ const cellAreas = hasEnableConf(mouseConfig, mouseOpts) && mouseOpts.area ? $table.getCellAreas() : [];
287
296
  item.disabled = cellAreas.length > 1;
288
297
  if (!item.disabled) {
289
298
  switch (code) {
@@ -299,7 +308,7 @@ function checkPrivilege(item, params) {
299
308
  }
300
309
  case 'MERGE_OR_CLEAR':
301
310
  case 'MERGE_CELL': {
302
- const cellAreas = mouseConfig && mouseOpts.area ? $table.getCellAreas() : [];
311
+ const cellAreas = hasEnableConf(mouseConfig, mouseOpts) && mouseOpts.area ? $table.getCellAreas() : [];
303
312
  item.disabled = !cellAreas.length || (cellAreas.length === 1 && cellAreas[0].rows.length === 1 && cellAreas[0].cols.length === 1) || !checkCellOverlay(params, cellAreas);
304
313
  break;
305
314
  }
@@ -432,12 +441,12 @@ export const VxeUIPluginMenu = {
432
441
  const pVersion = 3;
433
442
  const sVersion = 13;
434
443
  if (!VxeUI.checkVersion(VxeUI.tableVersion, pVersion, sVersion)) {
435
- console.error(`[@vxe-ui/plugin-menu 3.3.4] ${VxeUI.getI18n('vxe.error.errorVersion', [`vxe-table@${VxeUI.tableVersion || '?'}`, `vxe-table v${pVersion}.${sVersion}+`])}`);
444
+ console.error(`[@vxe-ui/plugin-menu 3.4.0] ${VxeUI.getI18n('vxe.error.errorVersion', [`vxe-table@${VxeUI.tableVersion || '?'}`, `vxe-table v${pVersion}.${sVersion}+`])}`);
436
445
  }
437
446
  }
438
447
  else {
439
448
  if (!/^(3)\./.test(VxeUI.uiVersion || VxeUI.tableVersion)) {
440
- console.error('[@vxe-ui/plugin-menu 3.3.4] Requires vxe-table 3.9.0+ version. https://vxeui.com/other3/#/plugin-menu/install');
449
+ console.error('[@vxe-ui/plugin-menu 3.4.0] Requires vxe-table 3.9.0+ version. https://vxeui.com/other3/#/plugin-menu/install');
441
450
  }
442
451
  }
443
452
  pluginConfig(options);
@@ -482,7 +491,7 @@ export const VxeUIPluginMenu = {
482
491
  const tableProps = $table;
483
492
  const { mouseConfig } = tableProps;
484
493
  const mouseOpts = $table.computeMouseOpts;
485
- if (mouseConfig && mouseOpts.area) {
494
+ if (hasEnableConf(mouseConfig, mouseOpts) && mouseOpts.area) {
486
495
  const cellAreas = $table.getCellAreas();
487
496
  if (cellAreas && cellAreas.length) {
488
497
  cellAreas.forEach(areaItem => {
@@ -511,7 +520,7 @@ export const VxeUIPluginMenu = {
511
520
  const tableProps = $table;
512
521
  const { mouseConfig } = tableProps;
513
522
  const mouseOpts = $table.computeMouseOpts;
514
- if (mouseConfig && mouseOpts.area) {
523
+ if (hasEnableConf(mouseConfig, mouseOpts) && mouseOpts.area) {
515
524
  const cellAreas = $table.getCellAreas();
516
525
  if (cellAreas && cellAreas.length) {
517
526
  cellAreas.forEach(areaItem => {
@@ -559,8 +568,8 @@ export const VxeUIPluginMenu = {
559
568
  const tableProps = $table;
560
569
  const { mouseConfig } = tableProps;
561
570
  const mouseOpts = $table.computeMouseOpts;
562
- if (mouseConfig && mouseOpts.area) {
563
- const cellAreas = mouseConfig && mouseOpts.area ? $table.getCellAreas() : [];
571
+ if (hasEnableConf(mouseConfig, mouseOpts) && mouseOpts.area) {
572
+ const cellAreas = mouseOpts.area ? $table.getCellAreas() : [];
564
573
  cellAreas.forEach(areaItem => {
565
574
  const { rows, cols } = areaItem;
566
575
  rows.forEach(row => {
@@ -595,7 +604,7 @@ export const VxeUIPluginMenu = {
595
604
  const tableProps = $table;
596
605
  const { mouseConfig } = tableProps;
597
606
  const mouseOpts = $table.computeMouseOpts;
598
- if (mouseConfig && mouseOpts.area) {
607
+ if (hasEnableConf(mouseConfig, mouseOpts) && mouseOpts.area) {
599
608
  const { visibleData } = $table.getTableData();
600
609
  const { visibleColumn } = $table.getTableColumn();
601
610
  $table.setCellAreas([{
@@ -616,7 +625,7 @@ export const VxeUIPluginMenu = {
616
625
  const tableProps = $table;
617
626
  const { mouseConfig } = tableProps;
618
627
  const mouseOpts = $table.computeMouseOpts;
619
- if (mouseConfig && mouseOpts.area) {
628
+ if (hasEnableConf(mouseConfig, mouseOpts) && mouseOpts.area) {
620
629
  const { visibleColumn } = $table.getTableColumn();
621
630
  const cellAreas = $table.getCellAreas();
622
631
  if (cellAreas.length === 1) {
@@ -648,7 +657,7 @@ export const VxeUIPluginMenu = {
648
657
  const tableProps = $table;
649
658
  const { mouseConfig } = tableProps;
650
659
  const mouseOpts = $table.computeMouseOpts;
651
- if (mouseConfig && mouseOpts.area) {
660
+ if (hasEnableConf(mouseConfig, mouseOpts) && mouseOpts.area) {
652
661
  const { visibleColumn } = $table.getTableColumn();
653
662
  const cellAreas = $table.getCellAreas();
654
663
  if (cellAreas.length === 1) {
@@ -680,7 +689,7 @@ export const VxeUIPluginMenu = {
680
689
  const tableProps = $table;
681
690
  const { mouseConfig } = tableProps;
682
691
  const mouseOpts = $table.computeMouseOpts;
683
- if (mouseConfig && mouseOpts.area) {
692
+ if (hasEnableConf(mouseConfig, mouseOpts) && mouseOpts.area) {
684
693
  const { visibleData } = $table.getTableData();
685
694
  const cellAreas = $table.getCellAreas();
686
695
  if (cellAreas.length === 1) {
@@ -712,7 +721,7 @@ export const VxeUIPluginMenu = {
712
721
  const tableProps = $table;
713
722
  const { mouseConfig } = tableProps;
714
723
  const mouseOpts = $table.computeMouseOpts;
715
- if (mouseConfig && mouseOpts.area) {
724
+ if (hasEnableConf(mouseConfig, mouseOpts) && mouseOpts.area) {
716
725
  const { visibleData } = $table.getTableData();
717
726
  const cellAreas = $table.getCellAreas();
718
727
  if (cellAreas.length === 1) {
@@ -745,7 +754,7 @@ export const VxeUIPluginMenu = {
745
754
  const tableProps = $table;
746
755
  const { mouseConfig } = tableProps;
747
756
  const mouseOpts = $table.computeMouseOpts;
748
- if (mouseConfig && mouseOpts.area) {
757
+ if (hasEnableConf(mouseConfig, mouseOpts) && mouseOpts.area) {
749
758
  const cellAreas = $table.getCellAreas();
750
759
  if (cellAreas && cellAreas.length) {
751
760
  cellAreas.forEach(areaItem => {
@@ -852,7 +861,7 @@ export const VxeUIPluginMenu = {
852
861
  const tableProps = $table;
853
862
  const { mouseConfig } = tableProps;
854
863
  const mouseOpts = $table.computeMouseOpts;
855
- if (mouseConfig && mouseOpts.area) {
864
+ if (hasEnableConf(mouseConfig, mouseOpts) && mouseOpts.area) {
856
865
  $table.triggerPasteCellAreaEvent($event);
857
866
  }
858
867
  else {
@@ -873,7 +882,7 @@ export const VxeUIPluginMenu = {
873
882
  const tableProps = $table;
874
883
  const { mouseConfig } = tableProps;
875
884
  const mouseOpts = $table.computeMouseOpts;
876
- if (mouseConfig && mouseOpts.area) {
885
+ if (hasEnableConf(mouseConfig, mouseOpts) && mouseOpts.area) {
877
886
  $table.triggerPasteCellAreaEvent($event);
878
887
  }
879
888
  }
@@ -998,7 +1007,7 @@ export const VxeUIPluginMenu = {
998
1007
  const { mouseConfig } = tableProps;
999
1008
  const mouseOpts = $table.computeMouseOpts;
1000
1009
  $table.insert(menu.params || {}).then(({ rows }) => {
1001
- if (column && mouseConfig && mouseOpts.area) {
1010
+ if (column && hasEnableConf(mouseConfig, mouseOpts) && mouseOpts.area) {
1002
1011
  $table.setCellAreas([
1003
1012
  { startRow: XEUtils.first(rows), endRow: XEUtils.last(rows), startColumn: column, endColumn: column }
1004
1013
  ]);
@@ -1016,7 +1025,7 @@ export const VxeUIPluginMenu = {
1016
1025
  const { mouseConfig } = tableProps;
1017
1026
  const mouseOpts = $table.computeMouseOpts;
1018
1027
  (row ? $table.insertAt(menu.params || {}, row) : $table.insert(menu.params || {})).then(({ rows }) => {
1019
- if (column && mouseConfig && mouseOpts.area) {
1028
+ if (column && hasEnableConf(mouseConfig, mouseOpts) && mouseOpts.area) {
1020
1029
  $table.setCellAreas([
1021
1030
  { startRow: XEUtils.first(rows), endRow: XEUtils.last(rows), startColumn: column, endColumn: column }
1022
1031
  ]);
@@ -1037,7 +1046,7 @@ export const VxeUIPluginMenu = {
1037
1046
  if (size) {
1038
1047
  const records = XEUtils.range(0, size).map(() => Object.assign({}, menu.params));
1039
1048
  (row ? $table.insertAt(records, row) : $table.insert(records)).then(({ rows }) => {
1040
- if (column && mouseConfig && mouseOpts.area) {
1049
+ if (column && hasEnableConf(mouseConfig, mouseOpts) && mouseOpts.area) {
1041
1050
  $table.setCellAreas([
1042
1051
  { startRow: XEUtils.first(rows), endRow: XEUtils.last(rows), startColumn: column, endColumn: column }
1043
1052
  ]);
@@ -1057,7 +1066,7 @@ export const VxeUIPluginMenu = {
1057
1066
  const { mouseConfig } = tableProps;
1058
1067
  const mouseOpts = $table.computeMouseOpts;
1059
1068
  (row ? $table.insertNextAt(menu.params || {}, row) : $table.insert(menu.params || {})).then(({ rows }) => {
1060
- if (column && mouseConfig && mouseOpts.area) {
1069
+ if (column && hasEnableConf(mouseConfig, mouseOpts) && mouseOpts.area) {
1061
1070
  $table.setCellAreas([
1062
1071
  { startRow: XEUtils.first(rows), endRow: XEUtils.last(rows), startColumn: column, endColumn: column }
1063
1072
  ]);
@@ -1078,7 +1087,7 @@ export const VxeUIPluginMenu = {
1078
1087
  if (size) {
1079
1088
  const records = XEUtils.range(0, size).map(() => Object.assign({}, menu.params));
1080
1089
  (row ? $table.insertNextAt(records, row) : $table.insert(records)).then(({ rows }) => {
1081
- if (column && mouseConfig && mouseOpts.area) {
1090
+ if (column && hasEnableConf(mouseConfig, mouseOpts) && mouseOpts.area) {
1082
1091
  $table.setCellAreas([
1083
1092
  { startRow: XEUtils.first(rows), endRow: XEUtils.last(rows), startColumn: column, endColumn: column }
1084
1093
  ]);
@@ -1251,8 +1260,8 @@ export const VxeUIPluginMenu = {
1251
1260
  const tableProps = $table;
1252
1261
  const { mouseConfig } = tableProps;
1253
1262
  const mouseOpts = $table.computeMouseOpts;
1254
- if (mouseConfig && mouseOpts.area) {
1255
- const cellAreas = mouseConfig && mouseOpts.area ? $table.getCellAreas() : [];
1263
+ if (hasEnableConf(mouseConfig, mouseOpts) && mouseOpts.area) {
1264
+ const cellAreas = $table.getCellAreas();
1256
1265
  cellAreas.forEach(areaItem => {
1257
1266
  const { rows } = areaItem;
1258
1267
  $table.remove(rows);