@vxe-ui/plugin-menu 3.2.2 → 3.3.1

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
@@ -1,1709 +1,1723 @@
1
1
  (function (global, factory) {
2
- if (typeof define === "function" && define.amd) {
3
- define("@vxe-ui/plugin-menu", ["exports", "xe-utils"], factory);
4
- } else if (typeof exports !== "undefined") {
5
- factory(exports, require("xe-utils"));
6
- } else {
7
- var mod = {
8
- exports: {}
9
- };
10
- factory(mod.exports, global.XEUtils);
11
- global.VxeUIPluginMenu = mod.exports.default;
12
- }
13
- })(typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : this, function (_exports, _xeUtils) {
14
- "use strict";
2
+ typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory(require('xe-utils')) :
3
+ typeof define === 'function' && define.amd ? define(['xe-utils'], factory) :
4
+ (global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.VxeUIPluginMenu = factory(global.XEUtils));
5
+ })(this, (function (require$$0) { 'use strict';
15
6
 
16
- Object.defineProperty(_exports, "__esModule", {
17
- value: true
18
- });
19
- _exports["default"] = _exports.VxeUIPluginMenu = void 0;
20
- _xeUtils = _interopRequireDefault(_xeUtils);
21
- function _interopRequireDefault(e) { return e && e.__esModule ? e : { "default": e }; }
22
- var VxeUI;
23
- var handleCopy;
24
- var columnIndexOf = function columnIndexOf(cols, column) {
25
- return _xeUtils["default"].findIndexOf(cols, function (item) {
26
- return item.id === column.id;
27
- });
28
- };
29
- var rowIndexOf = function rowIndexOf($table, rows, row) {
30
- return $table.findRowIndexOf(rows, row);
31
- };
32
- function handleFixedColumn(fixed) {
33
- return {
34
- tableMenuMethod: function tableMenuMethod(params) {
35
- var $table = params.$table,
36
- column = params.column;
37
- _xeUtils["default"].eachTree([column], function (column) {
38
- column.fixed = fixed;
39
- });
40
- $table.refreshColumn();
41
- }
42
- };
43
- }
44
- function getClipboardObj() {
45
- var globalStore = VxeUI.globalStore;
46
- if (globalStore) {
47
- return globalStore.clipboard || '';
48
- }
49
- // 兼容老版本
50
- var globalConfig = VxeUI.config;
51
- if (globalConfig && globalConfig.clipboard) {
52
- return globalConfig.clipboard;
53
- }
54
- return null;
55
- }
56
- function setClipboardConfig(clipObj) {
57
- var globalStore = VxeUI.globalStore;
58
- if (globalStore) {
59
- globalStore.clipboard = clipObj;
60
- } else if (VxeUI.config) {
61
- // 兼容老版本
62
- VxeUI.config.clipboard = clipObj;
63
- }
64
- }
65
- var copyElem;
66
- function handleText(content) {
67
- if (!copyElem) {
68
- copyElem = document.createElement('textarea');
69
- copyElem.id = '$XECopy';
70
- var styles = copyElem.style;
71
- styles.width = '48px';
72
- styles.height = '24px';
73
- styles.position = 'fixed';
74
- styles.zIndex = '0';
75
- styles.left = '-500px';
76
- styles.top = '-500px';
77
- document.body.appendChild(copyElem);
78
- }
79
- copyElem.value = content === null || content === undefined ? '' : '' + content;
80
- }
81
- function copyText(content) {
82
- var result = false;
83
- try {
84
- handleText(content);
85
- copyElem.select();
86
- copyElem.setSelectionRange(0, copyElem.value.length);
87
- result = document.execCommand('copy');
88
- copyElem.blur();
89
- } catch (e) {}
90
- return result;
91
- }
92
- function handleCopyOrCut(params, isCut) {
93
- var $event = params.$event,
94
- $table = params.$table,
95
- row = params.row,
96
- column = params.column;
97
- if (row && column) {
98
- var props = $table;
99
- var mouseConfig = props.mouseConfig;
100
- var mouseOpts = $table.computeMouseOpts;
101
- var text = '';
102
- if (mouseConfig && mouseOpts.area) {
103
- if (isCut) {
104
- $table.triggerCutCellAreaEvent($event);
105
- } else {
106
- $table.triggerCopyCellAreaEvent($event);
107
- }
108
- var clipboard = getClipboardObj();
109
- text = clipboard ? clipboard.text : '';
110
- } else {
111
- // 操作内置剪贴板
112
- text = _xeUtils["default"].toValueString(_xeUtils["default"].get(row, column.field));
113
- setClipboardConfig({
114
- text: text,
115
- html: ''
116
- });
117
- }
118
- // 开始复制操作
119
- if (_xeUtils["default"].isFunction(handleCopy)) {
120
- handleCopy(text);
121
- } else {
122
- copyText(text);
123
- }
124
- }
125
- }
126
- function createCommitHandle(code) {
127
- return function (params) {
128
- var $grid = params.$grid;
129
- if ($grid) {
130
- $grid.commitProxy(code);
131
- }
132
- };
133
- }
134
- function checkCellOverlay(params, cellAreas) {
135
- var $table = params.$table;
136
- var _$table$getTableData = $table.getTableData(),
137
- visibleData = _$table$getTableData.visibleData;
138
- var _$table$getTableColum = $table.getTableColumn(),
139
- visibleColumn = _$table$getTableColum.visibleColumn;
140
- var indexMaps = {};
141
- for (var aIndex = 0, areaSize = cellAreas.length; aIndex < areaSize; aIndex++) {
142
- var areaItem = cellAreas[aIndex];
143
- var rows = areaItem.rows,
144
- cols = areaItem.cols;
145
- for (var rIndex = 0, rowSize = rows.length; rIndex < rowSize; rIndex++) {
146
- var offsetRow = rows[rIndex];
147
- var orIndex = rowIndexOf($table, visibleData, offsetRow);
148
- for (var cIndex = 0, colSize = cols.length; cIndex < colSize; cIndex++) {
149
- var offsetColumn = cols[cIndex];
150
- var ocIndex = columnIndexOf(visibleColumn, offsetColumn);
151
- var key = orIndex + ':' + ocIndex;
152
- if (indexMaps[key]) {
153
- return false;
154
- }
155
- indexMaps[key] = true;
156
- }
157
- }
158
- }
159
- return true;
160
- }
161
- function getBeenMerges(params) {
162
- var $table = params.$table;
163
- var tableProps = $table;
164
- var mouseConfig = tableProps.mouseConfig;
165
- var mouseOpts = $table.computeMouseOpts;
166
- var _$table$getTableData2 = $table.getTableData(),
167
- visibleData = _$table$getTableData2.visibleData;
168
- var _$table$getTableColum2 = $table.getTableColumn(),
169
- visibleColumn = _$table$getTableColum2.visibleColumn;
170
- var cellAreas = mouseConfig && mouseOpts.area ? $table.getCellAreas() : [];
171
- var mergeList = $table.getMergeCells();
172
- return mergeList.filter(function (_ref) {
173
- var mergeRowIndex = _ref.row,
174
- mergeColIndex = _ref.col,
175
- mergeRowspan = _ref.rowspan,
176
- mergeColspan = _ref.colspan;
177
- return cellAreas.some(function (areaItem) {
178
- var rows = areaItem.rows,
179
- cols = areaItem.cols;
180
- var startRowIndex = rowIndexOf($table, visibleData, rows[0]);
181
- var endRowIndex = rowIndexOf($table, visibleData, rows[rows.length - 1]);
182
- var startColIndex = columnIndexOf(visibleColumn, cols[0]);
183
- var endColIndex = columnIndexOf(visibleColumn, cols[cols.length - 1]);
184
- return mergeRowIndex >= startRowIndex && mergeRowIndex + mergeRowspan - 1 <= endRowIndex && mergeColIndex >= startColIndex && mergeColIndex + mergeColspan - 1 <= endColIndex;
185
- });
186
- });
187
- }
188
- function handleClearMergeCells(params) {
189
- var $table = params.$table;
190
- var beenMerges = getBeenMerges(params);
191
- if (beenMerges.length) {
192
- $table.removeMergeCells(beenMerges);
193
- }
194
- return beenMerges;
195
- }
196
- function checkPrivilege(item, params) {
197
- var code = item.code;
198
- var $table = params.$table,
199
- $grid = params.$grid,
200
- row = params.row,
201
- column = params.column,
202
- type = params.type;
203
- var tableProps = $table;
204
- var editConfig = tableProps.editConfig,
205
- mouseConfig = tableProps.mouseConfig;
206
- switch (code) {
207
- case 'CLEAR_ALL_SORT':
208
- {
209
- var sortList = $table.getSortColumns();
210
- item.disabled = !sortList.length;
211
- break;
212
- }
213
- case 'CLEAR_ALL_FILTER':
214
- {
215
- var filterList = $table.getCheckedFilters();
216
- item.disabled = !filterList.length;
217
- break;
218
- }
219
- case 'CLEAR_ALL_MERGE':
220
- {
221
- var mergeCells = $table.getMergeCells();
222
- var mergeFooterItems = $table.getMergeFooterItems();
223
- item.disabled = !mergeCells.length && !mergeFooterItems.length;
224
- break;
225
- }
226
- case 'CLEAR_MERGE_CELL':
227
- {
228
- var beenMerges = getBeenMerges(params);
229
- item.disabled = !beenMerges.length;
230
- break;
231
- }
232
- case 'COPY_TITLE':
233
- {
234
- item.disabled = !column || type !== 'header';
235
- break;
236
- }
237
- case 'SELECT_ALL_AREA':
238
- {
239
- var _$table$getTableData3 = $table.getTableData(),
240
- visibleData = _$table$getTableData3.visibleData;
241
- var _$table$getTableColum3 = $table.getTableColumn(),
242
- visibleColumn = _$table$getTableColum3.visibleColumn;
243
- item.disabled = !visibleData.length || !visibleColumn.length;
244
- break;
245
- }
246
- case 'SELECT_AREA_TO_LEFT':
247
- case 'SELECT_AREA_TO_RIGHT':
248
- case 'SELECT_AREA_TO_TOP':
249
- case 'SELECT_AREA_TO_BOTTON':
250
- {
251
- item.disabled = !column || !row;
252
- break;
253
- }
254
- case 'DELETE_CHECKBOX_ROW':
255
- {
256
- var selectRecords = $table.getCheckboxRecords();
257
- item.disabled = !selectRecords.length;
258
- break;
259
- }
260
- case 'EDIT_CELL':
261
- case 'CLEAR_CELL':
262
- case 'CLEAR_ROW':
263
- case 'COPY_CELL':
264
- case 'CUT_CELL':
265
- case 'PASTE_CELL':
266
- case 'MERGE_OR_CLEAR':
267
- case 'MERGE_CELL':
268
- case 'REVERT_CELL':
269
- case 'REVERT_ROW':
270
- case 'DELETE_ROW':
271
- case 'DELETE_AREA_ROW':
272
- case 'CLEAR_SORT':
273
- case 'SORT_ASC':
274
- case 'SORT_DESC':
275
- case 'CLEAR_FILTER':
276
- case 'FILTER_CELL':
277
- case 'EXPORT_ROW':
278
- case 'OPEN_FIND':
279
- case 'OPEN_REPLACE':
280
- case 'HIDDEN_COLUMN':
281
- case 'FIXED_LEFT_COLUMN':
282
- case 'FIXED_RIGHT_COLUMN':
283
- case 'CLEAR_FIXED_COLUMN':
284
- {
285
- item.disabled = !column;
286
- if (column) {
287
- var mouseOpts = $table.computeMouseOpts;
288
- var isChildCol = !!column.parentId;
289
- switch (code) {
290
- case 'CLEAR_SORT':
291
- {
292
- item.disabled = !column.sortable || !column.order;
293
- break;
294
- }
295
- case 'SORT_ASC':
296
- case 'SORT_DESC':
297
- item.disabled = !column.sortable;
298
- break;
299
- case 'FILTER_CELL':
300
- case 'CLEAR_FILTER':
301
- item.disabled = !column.filters || !column.filters.length;
302
- if (!item.disabled) {
303
- switch (code) {
304
- case 'CLEAR_FILTER':
305
- item.disabled = !column.filters.some(function (option) {
306
- return option.checked;
307
- });
308
- break;
309
- }
310
- }
311
- break;
312
- case 'REVERT_CELL':
313
- {
314
- item.disabled = !row || !column.field || !$table.isUpdateByRow(row, column.field);
315
- break;
316
- }
317
- case 'REVERT_ROW':
318
- {
319
- item.disabled = !row || !column.field || !$table.isUpdateByRow(row);
320
- break;
321
- }
322
- case 'OPEN_FIND':
323
- case 'OPEN_REPLACE':
324
- {
325
- item.disabled = !(mouseConfig && mouseOpts.area);
326
- break;
327
- }
328
- case 'EDIT_CELL':
329
- {
330
- item.disabled = !editConfig || !column.editRender;
331
- break;
332
- }
333
- case 'COPY_CELL':
334
- case 'CUT_CELL':
335
- case 'PASTE_CELL':
336
- {
337
- var cellAreas = mouseConfig && mouseOpts.area ? $table.getCellAreas() : [];
338
- item.disabled = cellAreas.length > 1;
339
- if (!item.disabled) {
340
- switch (code) {
341
- case 'PASTE_CELL':
342
- {
343
- var clipboard = getClipboardObj();
344
- item.disabled = !clipboard || !clipboard.text;
345
- break;
346
- }
347
- }
348
- }
349
- break;
350
- }
351
- case 'MERGE_OR_CLEAR':
352
- case 'MERGE_CELL':
353
- {
354
- var _cellAreas = mouseConfig && mouseOpts.area ? $table.getCellAreas() : [];
355
- item.disabled = !_cellAreas.length || _cellAreas.length === 1 && _cellAreas[0].rows.length === 1 && _cellAreas[0].cols.length === 1 || !checkCellOverlay(params, _cellAreas);
356
- break;
357
- }
358
- case 'FIXED_LEFT_COLUMN':
359
- item.disabled = isChildCol || column.fixed === 'left';
360
- break;
361
- case 'FIXED_RIGHT_COLUMN':
362
- item.disabled = isChildCol || column.fixed === 'right';
363
- break;
364
- case 'CLEAR_FIXED_COLUMN':
365
- item.disabled = isChildCol || !column.fixed;
366
- break;
367
- }
368
- }
369
- break;
370
- }
371
- case 'COMMIT_PROXY_INITIAL':
372
- case 'COMMIT_PROXY_QUERY':
373
- case 'COMMIT_PROXY_RELOAD':
374
- case 'COMMIT_PROXY_DELETE':
375
- case 'COMMIT_PROXY_SAVE':
376
- {
377
- item.disabled = !$grid;
378
- break;
379
- }
380
- }
381
- }
382
- function handlePrivilegeEvent(params) {
383
- params.options.forEach(function (list) {
384
- list.forEach(function (item) {
385
- checkPrivilege(item, params);
386
- if (item.children) {
387
- item.children.forEach(function (child) {
388
- checkPrivilege(child, params);
389
- });
390
- }
391
- });
392
- });
393
- return true;
394
- }
395
- function selectMultipleRows() {
396
- return new Promise(function (resolve) {
397
- if (VxeUI.modal) {
398
- var VxeUINumberInputComponent = VxeUI.getComponent('VxeNumberInput');
399
- if (VxeUINumberInputComponent) {
400
- var rowSize = 1;
401
- VxeUI.modal.alert({
402
- title: '请输入行数',
403
- width: 220,
404
- maskClosable: false,
405
- slots: {
406
- "default": function _default(params, h) {
407
- return h(VxeUINumberInputComponent, {
408
- style: {
409
- width: '100%'
410
- },
411
- props: {
412
- value: rowSize,
413
- min: 1,
414
- max: 100,
415
- align: 'center',
416
- controlConfig: {
417
- layout: 'default'
418
- }
419
- },
420
- on: {
421
- modelValue: function modelValue(value) {
422
- rowSize = value;
423
- }
424
- }
425
- });
426
- }
427
- }
428
- }).then(function (type) {
429
- if (type === 'confirm') {
430
- resolve({
431
- size: rowSize || 1
432
- });
433
- } else {
434
- resolve({
435
- size: 0
436
- });
437
- }
438
- });
439
- } else {
440
- console.error(VxeUI.getI18n('vxe.error.reqComp', ['vxe-number-input']));
441
- resolve({
442
- size: 0
443
- });
444
- }
445
- } else {
446
- resolve({
447
- size: 0
448
- });
449
- }
450
- });
451
- }
452
- /**
453
- * 浏览器-刷新页面(对应按键F5)
454
- */
455
- function systemPageRefresh() {
456
- location.reload();
457
- }
458
- /**
459
- * 浏览器-前进
460
- */
461
- function systemPageforward() {
462
- history.forward();
463
- }
464
- /**
465
- * 浏览器-后退
466
- */
467
- function systemPageBack() {
468
- history.back();
469
- }
470
- function pluginConfig(options) {
471
- if (options && options.copy) {
472
- handleCopy = options.copy;
473
- }
474
- }
475
- var VxeUIPluginMenu = _exports.VxeUIPluginMenu = {
476
- setConfig: pluginConfig,
477
- install: function install(core, options) {
478
- VxeUI = core;
479
- // 检查版本
480
- if (VxeUI.checkVersion) {
481
- var pVersion = 3;
482
- var sVersion = 13;
483
- if (!VxeUI.checkVersion(VxeUI.tableVersion, pVersion, sVersion)) {
484
- console.error("[@vxe-ui/plugin-menu 3.2.2] ".concat(VxeUI.getI18n('vxe.error.errorVersion', ["vxe-table@".concat(VxeUI.tableVersion || '?'), "vxe-table v".concat(pVersion, ".").concat(sVersion, "+")])));
485
- }
486
- } else {
487
- if (!/^(3)\./.test(VxeUI.uiVersion || VxeUI.tableVersion)) {
488
- console.error('[@vxe-ui/plugin-menu 3.2.2] Requires vxe-table 3.9.0+ version. https://vxeui.com/other3/#/plugin-menu/install');
489
- }
490
- }
491
- pluginConfig(options);
492
- VxeUI.menus.mixin({
493
- /**
494
- * 浏览器-刷新页面(对应按键F5)
495
- */
496
- SYSTEM_PAGE_REFRESH: {
497
- tableMenuMethod: systemPageRefresh,
498
- treeMenuMethod: systemPageRefresh,
499
- calendarMenuMethod: systemPageRefresh,
500
- menuMenuMethod: systemPageRefresh,
501
- formDesignMenuMethod: systemPageRefresh
502
- },
503
- /**
504
- * 浏览器-前进
505
- */
506
- SYSTEM_PAGE_FORWARD: {
507
- tableMenuMethod: systemPageforward,
508
- treeMenuMethod: systemPageforward,
509
- calendarMenuMethod: systemPageforward,
510
- menuMenuMethod: systemPageforward,
511
- formDesignMenuMethod: systemPageforward
512
- },
513
- /**
514
- * 浏览器-后退
515
- */
516
- SYSTEM_PAGE_BACK: {
517
- tableMenuMethod: systemPageBack,
518
- treeMenuMethod: systemPageBack,
519
- calendarMenuMethod: systemPageBack,
520
- menuMenuMethod: systemPageBack,
521
- formDesignMenuMethod: systemPageBack
522
- },
523
- /**
524
- * 清除单元格数据的值;如果启用 mouse-config.area 功能,则清除区域范围内的单元格数据
525
- */
526
- CLEAR_CELL: {
527
- tableMenuMethod: function tableMenuMethod(params) {
528
- var $table = params.$table,
529
- row = params.row,
530
- column = params.column;
531
- if (row && column) {
532
- var tableProps = $table;
533
- var mouseConfig = tableProps.mouseConfig;
534
- var mouseOpts = $table.computeMouseOpts;
535
- if (mouseConfig && mouseOpts.area) {
536
- var cellAreas = $table.getCellAreas();
537
- if (cellAreas && cellAreas.length) {
538
- cellAreas.forEach(function (areaItem) {
539
- var rows = areaItem.rows,
540
- cols = areaItem.cols;
541
- cols.forEach(function (column) {
542
- rows.forEach(function (row) {
543
- $table.clearData(row, column.field);
544
- });
545
- });
546
- });
547
- }
548
- } else {
549
- $table.clearData(row, column.field);
550
- }
551
- }
552
- }
553
- },
554
- /**
555
- * 清除行数据的值
556
- */
557
- CLEAR_ROW: {
558
- tableMenuMethod: function tableMenuMethod(params) {
559
- var $table = params.$table,
560
- row = params.row;
561
- if (row) {
562
- $table.clearData(row);
563
- }
564
- }
565
- },
566
- /**
567
- * 清除复选框选中行数据的值
568
- */
569
- CLEAR_CHECKBOX_ROW: {
570
- tableMenuMethod: function tableMenuMethod(params) {
571
- var $table = params.$table;
572
- $table.clearData($table.getCheckboxRecords());
573
- }
574
- },
575
- /**
576
- * 清除区域选择范围内数据的值
577
- */
578
- CLEAR_AREA_ROW: {
579
- tableMenuMethod: function tableMenuMethod(params) {
580
- var $table = params.$table,
581
- row = params.row,
582
- column = params.column;
583
- var tableProps = $table;
584
- var mouseConfig = tableProps.mouseConfig;
585
- var mouseOpts = $table.computeMouseOpts;
586
- if (mouseConfig && mouseOpts.area) {
587
- var cellAreas = mouseConfig && mouseOpts.area ? $table.getCellAreas() : [];
588
- cellAreas.forEach(function (areaItem) {
589
- var rows = areaItem.rows,
590
- cols = areaItem.cols;
591
- rows.forEach(function (row) {
592
- cols.forEach(function (column) {
593
- $table.clearData(row);
594
- });
595
- });
596
- });
597
- } else {
598
- if (row && column) {
599
- $table.clearData(row);
600
- }
601
- }
602
- }
603
- },
604
- /**
605
- * 清除所有数据的值
606
- */
607
- CLEAR_ALL: {
608
- tableMenuMethod: function tableMenuMethod(params) {
609
- var $table = params.$table;
610
- $table.clearData();
611
- }
612
- },
613
- /**
614
- * 选取所有区域
615
- */
616
- SELECT_ALL_AREA: {
617
- tableMenuMethod: function tableMenuMethod(params) {
618
- var $table = params.$table;
619
- var tableProps = $table;
620
- var mouseConfig = tableProps.mouseConfig;
621
- var mouseOpts = $table.computeMouseOpts;
622
- if (mouseConfig && mouseOpts.area) {
623
- var _$table$getTableData4 = $table.getTableData(),
624
- visibleData = _$table$getTableData4.visibleData;
625
- var _$table$getTableColum4 = $table.getTableColumn(),
626
- visibleColumn = _$table$getTableColum4.visibleColumn;
627
- $table.setCellAreas([{
628
- startRow: _xeUtils["default"].first(visibleData),
629
- endRow: _xeUtils["default"].last(visibleData),
630
- startColumn: _xeUtils["default"].first(visibleColumn),
631
- endColumn: _xeUtils["default"].last(visibleColumn)
632
- }]);
633
- }
634
- }
635
- },
636
- /**
637
- * 以当前单元格为起点,范围选取到左侧单元格
638
- */
639
- SELECT_AREA_TO_LEFT: {
640
- tableMenuMethod: function tableMenuMethod(params) {
641
- var $table = params.$table,
642
- row = params.row,
643
- column = params.column;
644
- var tableProps = $table;
645
- var mouseConfig = tableProps.mouseConfig;
646
- var mouseOpts = $table.computeMouseOpts;
647
- if (mouseConfig && mouseOpts.area) {
648
- var _$table$getTableColum5 = $table.getTableColumn(),
649
- visibleColumn = _$table$getTableColum5.visibleColumn;
650
- var cellAreas = $table.getCellAreas();
651
- if (cellAreas.length === 1) {
652
- var fitstArea = cellAreas[0];
653
- $table.setCellAreas([{
654
- startRow: _xeUtils["default"].first(fitstArea.rows),
655
- endRow: _xeUtils["default"].last(fitstArea.rows),
656
- startColumn: _xeUtils["default"].first(visibleColumn),
657
- endColumn: _xeUtils["default"].last(fitstArea.cols)
658
- }], {
659
- column: column,
660
- row: row
661
- });
662
- } else {
663
- $table.setCellAreas([{
664
- startRow: row,
665
- endRow: row,
666
- startColumn: _xeUtils["default"].first(visibleColumn),
667
- endColumn: column
668
- }], {
669
- column: column,
670
- row: row
671
- });
672
- }
673
- }
674
- }
675
- },
676
- /**
677
- * 以当前单元格为起点,范围选取到右侧单元格
678
- */
679
- SELECT_AREA_TO_RIGHT: {
680
- tableMenuMethod: function tableMenuMethod(params) {
681
- var $table = params.$table,
682
- row = params.row,
683
- column = params.column;
684
- var tableProps = $table;
685
- var mouseConfig = tableProps.mouseConfig;
686
- var mouseOpts = $table.computeMouseOpts;
687
- if (mouseConfig && mouseOpts.area) {
688
- var _$table$getTableColum6 = $table.getTableColumn(),
689
- visibleColumn = _$table$getTableColum6.visibleColumn;
690
- var cellAreas = $table.getCellAreas();
691
- if (cellAreas.length === 1) {
692
- var fitstArea = cellAreas[0];
693
- $table.setCellAreas([{
694
- startRow: _xeUtils["default"].first(fitstArea.rows),
695
- endRow: _xeUtils["default"].last(fitstArea.rows),
696
- startColumn: _xeUtils["default"].first(fitstArea.cols),
697
- endColumn: _xeUtils["default"].last(visibleColumn)
698
- }], {
699
- column: column,
700
- row: row
701
- });
702
- } else {
703
- $table.setCellAreas([{
704
- startRow: row,
705
- endRow: row,
706
- startColumn: column,
707
- endColumn: _xeUtils["default"].last(visibleColumn)
708
- }], {
709
- column: column,
710
- row: row
711
- });
712
- }
713
- }
714
- }
715
- },
716
- /**
717
- * 以当前单元格为起点,范围选取到顶部单元格
718
- */
719
- SELECT_AREA_TO_TOP: {
720
- tableMenuMethod: function tableMenuMethod(params) {
721
- var $table = params.$table,
722
- row = params.row,
723
- column = params.column;
724
- var tableProps = $table;
725
- var mouseConfig = tableProps.mouseConfig;
726
- var mouseOpts = $table.computeMouseOpts;
727
- if (mouseConfig && mouseOpts.area) {
728
- var _$table$getTableData5 = $table.getTableData(),
729
- visibleData = _$table$getTableData5.visibleData;
730
- var cellAreas = $table.getCellAreas();
731
- if (cellAreas.length === 1) {
732
- var fitstArea = cellAreas[0];
733
- $table.setCellAreas([{
734
- startRow: _xeUtils["default"].first(visibleData),
735
- endRow: _xeUtils["default"].last(fitstArea.rows),
736
- startColumn: _xeUtils["default"].first(fitstArea.cols),
737
- endColumn: _xeUtils["default"].last(fitstArea.cols)
738
- }], {
739
- column: column,
740
- row: row
741
- });
742
- } else {
743
- $table.setCellAreas([{
744
- startRow: _xeUtils["default"].first(visibleData),
745
- endRow: row,
746
- startColumn: column,
747
- endColumn: column
748
- }], {
749
- column: column,
750
- row: row
751
- });
752
- }
753
- }
754
- }
755
- },
756
- /**
757
- * 以当前单元格为起点,范围选取到底部单元格
758
- */
759
- SELECT_AREA_TO_BOTTON: {
760
- tableMenuMethod: function tableMenuMethod(params) {
761
- var $table = params.$table,
762
- row = params.row,
763
- column = params.column;
764
- var tableProps = $table;
765
- var mouseConfig = tableProps.mouseConfig;
766
- var mouseOpts = $table.computeMouseOpts;
767
- if (mouseConfig && mouseOpts.area) {
768
- var _$table$getTableData6 = $table.getTableData(),
769
- visibleData = _$table$getTableData6.visibleData;
770
- var cellAreas = $table.getCellAreas();
771
- if (cellAreas.length === 1) {
772
- var fitstArea = cellAreas[0];
773
- $table.setCellAreas([{
774
- startRow: _xeUtils["default"].first(fitstArea.rows),
775
- endRow: _xeUtils["default"].last(visibleData),
776
- startColumn: _xeUtils["default"].first(fitstArea.cols),
777
- endColumn: _xeUtils["default"].last(fitstArea.cols)
778
- }], {
779
- column: column,
780
- row: row
781
- });
782
- } else {
783
- $table.setCellAreas([{
784
- startRow: row,
785
- endRow: _xeUtils["default"].last(visibleData),
786
- startColumn: column,
787
- endColumn: column
788
- }], {
789
- column: column,
790
- row: row
791
- });
792
- }
793
- }
794
- }
795
- },
796
- /**
797
- * 还原单元格数据的值;如果启用 mouse-config.area 功能,则还原区域范围内的单元格数据
798
- */
799
- REVERT_CELL: {
800
- tableMenuMethod: function tableMenuMethod(params) {
801
- var $table = params.$table,
802
- row = params.row,
803
- column = params.column;
804
- if (row && column) {
805
- var tableProps = $table;
806
- var mouseConfig = tableProps.mouseConfig;
807
- var mouseOpts = $table.computeMouseOpts;
808
- if (mouseConfig && mouseOpts.area) {
809
- var cellAreas = $table.getCellAreas();
810
- if (cellAreas && cellAreas.length) {
811
- cellAreas.forEach(function (areaItem) {
812
- var rows = areaItem.rows,
813
- cols = areaItem.cols;
814
- cols.forEach(function (column) {
815
- rows.forEach(function (row) {
816
- $table.revertData(row, column.field);
817
- });
818
- });
819
- });
820
- }
821
- } else {
822
- $table.revertData(row, column.field);
823
- }
824
- }
825
- }
826
- },
827
- /**
828
- * 还原行数据的值
829
- */
830
- REVERT_ROW: {
831
- tableMenuMethod: function tableMenuMethod(params) {
832
- var $table = params.$table,
833
- row = params.row;
834
- if (row) {
835
- $table.revertData(row);
836
- }
837
- }
838
- },
839
- /**
840
- * 还原复选框选中行数据的值
841
- */
842
- REVERT_CHECKBOX_ROW: {
843
- tableMenuMethod: function tableMenuMethod(params) {
844
- var $table = params.$table;
845
- $table.revertData($table.getCheckboxRecords());
846
- }
847
- },
848
- /**
849
- * 还原所有数据的值
850
- */
851
- REVERT_ALL: {
852
- tableMenuMethod: function tableMenuMethod(params) {
853
- var $table = params.$table;
854
- $table.revertData();
855
- }
856
- },
857
- /**
858
- * 复制列头标题
859
- */
860
- COPY_TITLE: {
861
- tableMenuMethod: function tableMenuMethod(params) {
862
- var column = params.column;
863
- var text = column.getTitle();
864
- if (text) {
865
- // 开始复制操作
866
- if (_xeUtils["default"].isFunction(handleCopy)) {
867
- handleCopy(text);
868
- } else {
869
- copyText(text);
870
- }
871
- }
872
- }
873
- },
874
- /**
875
- * 复制单元格数据的值;如果启用 mouse-config.area 功能,则复制区域范围内的单元格数据,支持 Excel 和 WPS
876
- */
877
- COPY_CELL: {
878
- tableMenuMethod: function tableMenuMethod(params) {
879
- handleCopyOrCut(params);
880
- }
881
- },
882
- /**
883
- * 剪贴单元格数据的值;如果启用 mouse-config.area 功能,则剪贴区域范围内的单元格数据,支持 Excel 和 WPS
884
- */
885
- CUT_CELL: {
886
- tableMenuMethod: function tableMenuMethod(params) {
887
- handleCopyOrCut(params, true);
888
- }
889
- },
890
- /**
891
- * 粘贴从表格中被复制的数据;如果启用 mouse-config.area 功能,则粘贴区域范围内的单元格数据,不支持读取剪贴板
892
- */
893
- PASTE_CELL: {
894
- tableMenuMethod: function tableMenuMethod(params) {
895
- var $event = params.$event,
896
- $table = params.$table,
897
- row = params.row,
898
- column = params.column;
899
- var tableProps = $table;
900
- var mouseConfig = tableProps.mouseConfig;
901
- var mouseOpts = $table.computeMouseOpts;
902
- if (mouseConfig && mouseOpts.area) {
903
- $table.triggerPasteCellAreaEvent($event);
904
- } else {
905
- var clipboard = getClipboardObj();
906
- // 读取内置剪贴板
907
- if (clipboard && clipboard.text) {
908
- _xeUtils["default"].set(row, column.field, clipboard.text);
909
- }
910
- }
911
- }
912
- },
913
- /**
914
- * 如果启用 mouse-config.area 功能,如果所选区域内已存在合并单元格,则取消临时合并,否则临时合并
915
- */
916
- MERGE_OR_CLEAR: {
917
- tableMenuMethod: function tableMenuMethod(params) {
918
- var $event = params.$event,
919
- $table = params.$table;
920
- var cellAreas = $table.getCellAreas();
921
- var beenMerges = getBeenMerges(params);
922
- var status = false;
923
- if (beenMerges.length) {
924
- $table.removeMergeCells(beenMerges);
925
- } else {
926
- status = true;
927
- $table.setMergeCells(cellAreas.map(function (_ref2) {
928
- var rows = _ref2.rows,
929
- cols = _ref2.cols;
930
- return {
931
- row: rows[0],
932
- col: cols[0],
933
- rowspan: rows.length,
934
- colspan: cols.length
935
- };
936
- }));
937
- }
938
- var targetAreas = cellAreas.map(function (_ref3) {
939
- var rows = _ref3.rows,
940
- cols = _ref3.cols;
941
- return {
942
- rows: rows,
943
- cols: cols
944
- };
945
- });
946
- $table.dispatchEvent('cell-area-merge', {
947
- status: status,
948
- targetAreas: targetAreas
949
- }, $event);
950
- }
951
- },
952
- /**
953
- * 如果启用 mouse-config.area 功能,临时合并区域范围内的单元格,不管是否存在已合并
954
- */
955
- MERGE_CELL: {
956
- tableMenuMethod: function tableMenuMethod(params) {
957
- var $event = params.$event,
958
- $table = params.$table;
959
- var _$table$getTableData7 = $table.getTableData(),
960
- visibleData = _$table$getTableData7.visibleData;
961
- var _$table$getTableColum7 = $table.getTableColumn(),
962
- visibleColumn = _$table$getTableColum7.visibleColumn;
963
- var cellAreas = $table.getCellAreas();
964
- handleClearMergeCells(params);
965
- if (cellAreas.some(function (_ref4) {
966
- var rows = _ref4.rows,
967
- cols = _ref4.cols;
968
- return rows.length === visibleData.length || cols.length === visibleColumn.length;
969
- })) {
970
- if (VxeUI.modal) {
971
- VxeUI.modal.message({
972
- content: VxeUI.getI18n('vxe.pro.area.mergeErr'),
973
- status: 'error',
974
- id: 'operErr'
975
- });
976
- }
977
- return;
978
- }
979
- $table.setMergeCells(cellAreas.map(function (_ref5) {
980
- var rows = _ref5.rows,
981
- cols = _ref5.cols;
982
- return {
983
- row: rows[0],
984
- col: cols[0],
985
- rowspan: rows.length,
986
- colspan: cols.length
987
- };
988
- }));
989
- var targetAreas = cellAreas.map(function (_ref6) {
990
- var rows = _ref6.rows,
991
- cols = _ref6.cols;
992
- return {
993
- rows: rows,
994
- cols: cols
995
- };
996
- });
997
- $table.dispatchEvent('cell-area-merge', {
998
- status: true,
999
- targetAreas: targetAreas
1000
- }, $event);
1001
- }
1002
- },
1003
- /**
1004
- * 如果启用 mouse-config.area 功能,清除区域范围内单元格的临时合并状态
1005
- */
1006
- CLEAR_MERGE_CELL: {
1007
- tableMenuMethod: function tableMenuMethod(params) {
1008
- var $event = params.$event,
1009
- $table = params.$table;
1010
- var beenMerges = handleClearMergeCells(params);
1011
- if (beenMerges.length) {
1012
- $table.dispatchEvent('clear-cell-area-merge', {
1013
- mergeCells: beenMerges
1014
- }, $event);
1015
- }
1016
- }
1017
- },
1018
- /**
1019
- * 清除所有单元格及表尾的临时合并状态
1020
- */
1021
- CLEAR_ALL_MERGE: {
1022
- tableMenuMethod: function tableMenuMethod(params) {
1023
- var $event = params.$event,
1024
- $table = params.$table;
1025
- var mergeCells = $table.getMergeCells();
1026
- var mergeFooterItems = $table.getMergeFooterItems();
1027
- $table.clearMergeCells();
1028
- $table.clearMergeFooterItems();
1029
- $table.dispatchEvent('clear-merge', {
1030
- mergeCells: mergeCells,
1031
- mergeFooterItems: mergeFooterItems
1032
- }, $event);
1033
- }
1034
- },
1035
- /**
1036
- * 编辑单元格
1037
- */
1038
- EDIT_CELL: {
1039
- tableMenuMethod: function tableMenuMethod(params) {
1040
- var $table = params.$table,
1041
- row = params.row,
1042
- column = params.column;
1043
- if ($table.setEditCell) {
1044
- $table.setEditCell(row, column);
1045
- } else {
1046
- // 兼容老版本
1047
- $table.setActiveCell(row, column.field);
1048
- }
1049
- }
1050
- },
1051
- /**
1052
- * 编辑行
1053
- */
1054
- EDIT_ROW: {
1055
- tableMenuMethod: function tableMenuMethod(params) {
1056
- var $table = params.$table,
1057
- row = params.row;
1058
- if ($table.setEditRow) {
1059
- $table.setEditRow(row);
1060
- } else {
1061
- // 兼容老版本
1062
- $table.setActiveRow(row);
1063
- }
1064
- }
1065
- },
1066
- /**
1067
- * 插入数据
1068
- */
1069
- INSERT_ROW: {
1070
- tableMenuMethod: function tableMenuMethod(params) {
1071
- var $table = params.$table,
1072
- menu = params.menu,
1073
- column = params.column;
1074
- var tableProps = $table;
1075
- var mouseConfig = tableProps.mouseConfig;
1076
- var mouseOpts = $table.computeMouseOpts;
1077
- $table.insert(menu.params || {}).then(function (_ref7) {
1078
- var rows = _ref7.rows;
1079
- if (column && mouseConfig && mouseOpts.area) {
1080
- $table.setCellAreas([{
1081
- startRow: _xeUtils["default"].first(rows),
1082
- endRow: _xeUtils["default"].last(rows),
1083
- startColumn: column,
1084
- endColumn: column
1085
- }]);
1086
- }
1087
- });
1088
- }
1089
- },
1090
- /**
1091
- * 插入数据到指定位置
1092
- */
1093
- INSERT_AT_ROW: {
1094
- tableMenuMethod: function tableMenuMethod(params) {
1095
- var $table = params.$table,
1096
- menu = params.menu,
1097
- row = params.row,
1098
- column = params.column;
1099
- var tableProps = $table;
1100
- var mouseConfig = tableProps.mouseConfig;
1101
- var mouseOpts = $table.computeMouseOpts;
1102
- (row ? $table.insertAt(menu.params || {}, row) : $table.insert(menu.params || {})).then(function (_ref8) {
1103
- var rows = _ref8.rows;
1104
- if (column && mouseConfig && mouseOpts.area) {
1105
- $table.setCellAreas([{
1106
- startRow: _xeUtils["default"].first(rows),
1107
- endRow: _xeUtils["default"].last(rows),
1108
- startColumn: column,
1109
- endColumn: column
1110
- }]);
1111
- }
1112
- });
1113
- }
1114
- },
1115
- /**
1116
- * 插入多行数据
1117
- */
1118
- BATCH_INSERT_AT_ROW: {
1119
- tableMenuMethod: function tableMenuMethod(params) {
1120
- var $table = params.$table,
1121
- menu = params.menu,
1122
- row = params.row,
1123
- column = params.column;
1124
- var tableProps = $table;
1125
- var mouseConfig = tableProps.mouseConfig;
1126
- var mouseOpts = $table.computeMouseOpts;
1127
- selectMultipleRows().then(function (_ref9) {
1128
- var size = _ref9.size;
1129
- if (size) {
1130
- var records = _xeUtils["default"].range(0, size).map(function () {
1131
- return Object.assign({}, menu.params);
1132
- });
1133
- (row ? $table.insertAt(records, row) : $table.insert(records)).then(function (_ref0) {
1134
- var rows = _ref0.rows;
1135
- if (column && mouseConfig && mouseOpts.area) {
1136
- $table.setCellAreas([{
1137
- startRow: _xeUtils["default"].first(rows),
1138
- endRow: _xeUtils["default"].last(rows),
1139
- startColumn: column,
1140
- endColumn: column
1141
- }]);
1142
- }
1143
- });
1144
- }
1145
- });
1146
- }
1147
- },
1148
- /**
1149
- * 插入数据到指定位置
1150
- */
1151
- INSERT_NEXT_AT_ROW: {
1152
- tableMenuMethod: function tableMenuMethod(params) {
1153
- var $table = params.$table,
1154
- menu = params.menu,
1155
- row = params.row,
1156
- column = params.column;
1157
- var tableProps = $table;
1158
- var mouseConfig = tableProps.mouseConfig;
1159
- var mouseOpts = $table.computeMouseOpts;
1160
- (row ? $table.insertNextAt(menu.params || {}, row) : $table.insert(menu.params || {})).then(function (_ref1) {
1161
- var rows = _ref1.rows;
1162
- if (column && mouseConfig && mouseOpts.area) {
1163
- $table.setCellAreas([{
1164
- startRow: _xeUtils["default"].first(rows),
1165
- endRow: _xeUtils["default"].last(rows),
1166
- startColumn: column,
1167
- endColumn: column
1168
- }]);
1169
- }
1170
- });
1171
- }
1172
- },
1173
- /**
1174
- * 插入数据到指定位置
1175
- */
1176
- BATCH_INSERT_NEXT_AT_ROW: {
1177
- tableMenuMethod: function tableMenuMethod(params) {
1178
- var $table = params.$table,
1179
- menu = params.menu,
1180
- row = params.row,
1181
- column = params.column;
1182
- var tableProps = $table;
1183
- var mouseConfig = tableProps.mouseConfig;
1184
- var mouseOpts = $table.computeMouseOpts;
1185
- selectMultipleRows().then(function (_ref10) {
1186
- var size = _ref10.size;
1187
- if (size) {
1188
- var records = _xeUtils["default"].range(0, size).map(function () {
1189
- return Object.assign({}, menu.params);
1190
- });
1191
- (row ? $table.insertNextAt(records, row) : $table.insert(records)).then(function (_ref11) {
1192
- var rows = _ref11.rows;
1193
- if (column && mouseConfig && mouseOpts.area) {
1194
- $table.setCellAreas([{
1195
- startRow: _xeUtils["default"].first(rows),
1196
- endRow: _xeUtils["default"].last(rows),
1197
- startColumn: column,
1198
- endColumn: column
1199
- }]);
1200
- }
1201
- });
1202
- }
1203
- });
1204
- }
1205
- },
1206
- /**
1207
- * 插入数据并激活编辑状态
1208
- * @deprecated
1209
- */
1210
- INSERT_ACTIVED_ROW: {
1211
- tableMenuMethod: function tableMenuMethod(params) {
1212
- var $table = params.$table,
1213
- menu = params.menu,
1214
- column = params.column;
1215
- var args = menu.params || []; // [{}, 'field']
1216
- var record = Object.assign({}, args[0] || {});
1217
- $table.insert(record).then(function (_ref12) {
1218
- var row = _ref12.row;
1219
- if ($table.setEditCell) {
1220
- $table.setEditCell(row, args[1] || column);
1221
- } else {
1222
- // 兼容老版本
1223
- $table.setActiveCell(row, args[1] || column.field);
1224
- }
1225
- });
1226
- }
1227
- },
1228
- /**
1229
- * 插入数据并激活编辑状态
1230
- * @deprecated
1231
- */
1232
- INSERT_EDIT_ROW: {
1233
- tableMenuMethod: function tableMenuMethod(params) {
1234
- var $table = params.$table,
1235
- menu = params.menu,
1236
- column = params.column;
1237
- var args = menu.params || []; // [{}, 'field']
1238
- var record = Object.assign({}, args[0] || {});
1239
- $table.insert(record).then(function (_ref13) {
1240
- var row = _ref13.row;
1241
- if ($table.setEditCell) {
1242
- $table.setEditCell(row, args[1] || column);
1243
- } else {
1244
- // 兼容老版本
1245
- $table.setActiveCell(row, args[1] || column.field);
1246
- }
1247
- });
1248
- }
1249
- },
1250
- /**
1251
- * 插入数据到指定位置并激活编辑状态
1252
- */
1253
- INSERT_AT_ACTIVED_ROW: {
1254
- tableMenuMethod: function tableMenuMethod(params) {
1255
- var $table = params.$table,
1256
- menu = params.menu,
1257
- row = params.row,
1258
- column = params.column;
1259
- var args = menu.params || []; // [{}, 'field']
1260
- var record = Object.assign({}, args[0] || {});
1261
- (row ? $table.insertAt(record, row) : $table.insert(record)).then(function (_ref14) {
1262
- var row = _ref14.row;
1263
- if ($table.setEditCell) {
1264
- $table.setEditCell(row, args[1] || column);
1265
- } else {
1266
- // 兼容老版本
1267
- $table.setActiveCell(row, args[1] || column.field);
1268
- }
1269
- });
1270
- }
1271
- },
1272
- /**
1273
- * 插入数据到指定位置并激活编辑状态
1274
- */
1275
- INSERT_AT_EDIT_ROW: {
1276
- tableMenuMethod: function tableMenuMethod(params) {
1277
- var $table = params.$table,
1278
- menu = params.menu,
1279
- row = params.row,
1280
- column = params.column;
1281
- var args = menu.params || []; // [{}, 'field']
1282
- var record = Object.assign({}, args[0] || {});
1283
- (row ? $table.insertAt(record, row) : $table.insert(record)).then(function (_ref15) {
1284
- var row = _ref15.row;
1285
- if ($table.setEditCell) {
1286
- $table.setEditCell(row, args[1] || column);
1287
- } else {
1288
- // 兼容老版本
1289
- $table.setActiveCell(row, args[1] || column.field);
1290
- }
1291
- });
1292
- }
1293
- },
1294
- /**
1295
- * 批量插入数据到指定位置并激活编辑状态
1296
- */
1297
- BATCH_INSERT_AT_EDIT_ROW: {
1298
- tableMenuMethod: function tableMenuMethod(params) {
1299
- var $table = params.$table,
1300
- menu = params.menu,
1301
- row = params.row,
1302
- column = params.column;
1303
- var args = menu.params || []; // [{}, 'field']
1304
- selectMultipleRows().then(function (_ref16) {
1305
- var size = _ref16.size;
1306
- if (size) {
1307
- var records = _xeUtils["default"].range(0, size).map(function () {
1308
- return Object.assign({}, args[0]);
1309
- });
1310
- (row ? $table.insertAt(records, row) : $table.insert(records)).then(function (_ref17) {
1311
- var row = _ref17.row;
1312
- if ($table.setEditCell) {
1313
- $table.setEditCell(row, args[1] || column);
1314
- } else {
1315
- // 兼容老版本
1316
- $table.setActiveCell(row, args[1] || column.field);
1317
- }
1318
- });
1319
- }
1320
- });
1321
- }
1322
- },
1323
- /**
1324
- * 插入数据到指定位置并激活编辑状态
1325
- */
1326
- INSERT_NEXT_AT_EDIT_ROW: {
1327
- tableMenuMethod: function tableMenuMethod(params) {
1328
- var $table = params.$table,
1329
- menu = params.menu,
1330
- row = params.row,
1331
- column = params.column;
1332
- var args = menu.params || []; // [{}, 'field']
1333
- var record = Object.assign({}, args[0] || {});
1334
- (row ? $table.insertNextAt(record, row) : $table.insert(record)).then(function (_ref18) {
1335
- var row = _ref18.row;
1336
- if ($table.setEditCell) {
1337
- $table.setEditCell(row, args[1] || column);
1338
- } else {
1339
- // 兼容老版本
1340
- $table.setActiveCell(row, args[1] || column.field);
1341
- }
1342
- });
1343
- }
1344
- },
1345
- /**
1346
- * 批量插入数据到指定位置并激活编辑状态
1347
- */
1348
- BATCH_INSERT_NEXT_AT_EDIT_ROW: {
1349
- tableMenuMethod: function tableMenuMethod(params) {
1350
- var $table = params.$table,
1351
- menu = params.menu,
1352
- row = params.row,
1353
- column = params.column;
1354
- var args = menu.params || []; // [{}, 'field']
1355
- selectMultipleRows().then(function (_ref19) {
1356
- var size = _ref19.size;
1357
- if (size) {
1358
- var records = _xeUtils["default"].range(0, size).map(function () {
1359
- return Object.assign({}, args[0]);
1360
- });
1361
- (row ? $table.insertNextAt(records, row) : $table.insert(records)).then(function (_ref20) {
1362
- var row = _ref20.row;
1363
- if ($table.setEditCell) {
1364
- $table.setEditCell(row, args[1] || column);
1365
- } else {
1366
- // 兼容老版本
1367
- $table.setActiveCell(row, args[1] || column.field);
1368
- }
1369
- });
1370
- }
1371
- });
1372
- }
1373
- },
1374
- /**
1375
- * 移除行数据
1376
- */
1377
- DELETE_ROW: {
1378
- tableMenuMethod: function tableMenuMethod(params) {
1379
- var $table = params.$table,
1380
- row = params.row;
1381
- if (row) {
1382
- $table.remove(row);
1383
- }
1384
- }
1385
- },
1386
- /**
1387
- * 如果启用 mouse-config.area 功能,移除所选区域行数据
1388
- */
1389
- DELETE_AREA_ROW: {
1390
- tableMenuMethod: function tableMenuMethod(params) {
1391
- var $table = params.$table,
1392
- row = params.row;
1393
- var tableProps = $table;
1394
- var mouseConfig = tableProps.mouseConfig;
1395
- var mouseOpts = $table.computeMouseOpts;
1396
- if (mouseConfig && mouseOpts.area) {
1397
- var cellAreas = mouseConfig && mouseOpts.area ? $table.getCellAreas() : [];
1398
- cellAreas.forEach(function (areaItem) {
1399
- var rows = areaItem.rows;
1400
- $table.remove(rows);
1401
- });
1402
- } else {
1403
- if (row) {
1404
- $table.remove(row);
1405
- }
1406
- }
1407
- }
1408
- },
1409
- /**
1410
- * 移除复选框选中行数据
1411
- */
1412
- DELETE_CHECKBOX_ROW: {
1413
- tableMenuMethod: function tableMenuMethod(params) {
1414
- var $table = params.$table;
1415
- $table.removeCheckboxRow();
1416
- }
1417
- },
1418
- /**
1419
- * 移除所有行数据
1420
- */
1421
- DELETE_ALL: {
1422
- tableMenuMethod: function tableMenuMethod(params) {
1423
- var $table = params.$table;
1424
- $table.remove();
1425
- }
1426
- },
1427
- /**
1428
- * 清除所选列排序条件
1429
- */
1430
- CLEAR_SORT: {
1431
- tableMenuMethod: function tableMenuMethod(params) {
1432
- var $event = params.$event,
1433
- $table = params.$table,
1434
- column = params.column;
1435
- if (column) {
1436
- $table.triggerSortEvent($event, column, null);
1437
- }
1438
- }
1439
- },
1440
- /**
1441
- * 清除所有排序条件
1442
- */
1443
- CLEAR_ALL_SORT: {
1444
- tableMenuMethod: function tableMenuMethod(params) {
1445
- var $event = params.$event,
1446
- $table = params.$table;
1447
- var sortList = $table.getSortColumns();
1448
- if (sortList.length) {
1449
- $table.clearSort();
1450
- $table.dispatchEvent('clear-sort', {
1451
- sortList: sortList
1452
- }, $event);
1453
- }
1454
- }
1455
- },
1456
- /**
1457
- * 按所选列的值升序
1458
- */
1459
- SORT_ASC: {
1460
- tableMenuMethod: function tableMenuMethod(params) {
1461
- var $event = params.$event,
1462
- $table = params.$table,
1463
- column = params.column;
1464
- if (column) {
1465
- $table.triggerSortEvent($event, column, 'asc');
1466
- }
1467
- }
1468
- },
1469
- /**
1470
- * 按所选列的值倒序
1471
- */
1472
- SORT_DESC: {
1473
- tableMenuMethod: function tableMenuMethod(params) {
1474
- var $event = params.$event,
1475
- $table = params.$table,
1476
- column = params.column;
1477
- if (column) {
1478
- $table.triggerSortEvent($event, column, 'desc');
1479
- }
1480
- }
1481
- },
1482
- /**
1483
- * 清除复选框选中列的筛选条件
1484
- */
1485
- CLEAR_FILTER: {
1486
- tableMenuMethod: function tableMenuMethod(params) {
1487
- var $event = params.$event,
1488
- $table = params.$table,
1489
- column = params.column;
1490
- if (column) {
1491
- $table.handleClearFilter(column);
1492
- $table.confirmFilterEvent($event);
1493
- }
1494
- }
1495
- },
1496
- /**
1497
- * 清除所有列筛选条件
1498
- */
1499
- CLEAR_ALL_FILTER: {
1500
- tableMenuMethod: function tableMenuMethod(params) {
1501
- var $event = params.$event,
1502
- $table = params.$table;
1503
- var filterList = $table.getCheckedFilters();
1504
- if (filterList.length) {
1505
- $table.clearFilter();
1506
- $table.dispatchEvent('clear-filter', {
1507
- filterList: filterList
1508
- }, $event);
1509
- }
1510
- }
1511
- },
1512
- /**
1513
- * 根据单元格值筛选
1514
- */
1515
- FILTER_CELL: {
1516
- tableMenuMethod: function tableMenuMethod(params) {
1517
- var $table = params.$table,
1518
- row = params.row,
1519
- column = params.column;
1520
- if (row && column) {
1521
- var field = column.field,
1522
- filters = column.filters;
1523
- if (filters.length) {
1524
- var option = filters[0];
1525
- option.data = _xeUtils["default"].get(row, field);
1526
- option.checked = true;
1527
- $table.updateData();
1528
- }
1529
- }
1530
- }
1531
- },
1532
- /**
1533
- * 导出行数据
1534
- */
1535
- EXPORT_ROW: {
1536
- tableMenuMethod: function tableMenuMethod(params) {
1537
- var $table = params.$table,
1538
- menu = params.menu,
1539
- row = params.row;
1540
- if (row) {
1541
- var opts = {
1542
- data: [row]
1543
- };
1544
- $table.exportData(_xeUtils["default"].assign({}, menu.params ? menu.params[0] : {}, opts));
1545
- }
1546
- }
1547
- },
1548
- /**
1549
- * 导出复选框选中行数据
1550
- */
1551
- EXPORT_CHECKBOX_ROW: {
1552
- tableMenuMethod: function tableMenuMethod(params) {
1553
- var $table = params.$table,
1554
- menu = params.menu;
1555
- var opts = {
1556
- data: $table.getCheckboxRecords()
1557
- };
1558
- $table.exportData(_xeUtils["default"].assign({}, menu.params ? menu.params[0] : {}, opts));
1559
- }
1560
- },
1561
- /**
1562
- * 导出所有行数据
1563
- */
1564
- EXPORT_ALL: {
1565
- tableMenuMethod: function tableMenuMethod(params) {
1566
- var $table = params.$table,
1567
- menu = params.menu;
1568
- $table.exportData(menu.params);
1569
- }
1570
- },
1571
- /**
1572
- * 打印所有行数据
1573
- */
1574
- PRINT_ALL: {
1575
- tableMenuMethod: function tableMenuMethod(params) {
1576
- var $table = params.$table,
1577
- menu = params.menu;
1578
- $table.print(menu.params);
1579
- }
1580
- },
1581
- /**
1582
- * 打印复选框选中行
1583
- */
1584
- PRINT_CHECKBOX_ROW: {
1585
- tableMenuMethod: function tableMenuMethod(params) {
1586
- var $table = params.$table,
1587
- menu = params.menu;
1588
- var opts = {
1589
- data: $table.getCheckboxRecords()
1590
- };
1591
- $table.print(_xeUtils["default"].assign(opts, menu.params));
1592
- }
1593
- },
1594
- /**
1595
- * 打开查找功能
1596
- */
1597
- OPEN_FIND: {
1598
- tableMenuMethod: function tableMenuMethod(params) {
1599
- var $event = params.$event,
1600
- $table = params.$table;
1601
- $table.triggerFNROpenEvent($event, 'find');
1602
- }
1603
- },
1604
- /**
1605
- * 打开替换功能
1606
- */
1607
- OPEN_REPLACE: {
1608
- tableMenuMethod: function tableMenuMethod(params) {
1609
- var $event = params.$event,
1610
- $table = params.$table;
1611
- $table.triggerFNROpenEvent($event, 'replace');
1612
- }
1613
- },
1614
- /**
1615
- * 隐藏当前列
1616
- */
1617
- HIDDEN_COLUMN: {
1618
- tableMenuMethod: function tableMenuMethod(params) {
1619
- var $table = params.$table,
1620
- column = params.column;
1621
- if (column) {
1622
- $table.hideColumn(column);
1623
- }
1624
- }
1625
- },
1626
- /**
1627
- * 将列固定到左侧
1628
- */
1629
- FIXED_LEFT_COLUMN: handleFixedColumn('left'),
1630
- /**
1631
- * 将列固定到右侧
1632
- */
1633
- FIXED_RIGHT_COLUMN: handleFixedColumn('right'),
1634
- /**
1635
- * 清除固定列
1636
- */
1637
- CLEAR_FIXED_COLUMN: handleFixedColumn(null),
1638
- /**
1639
- * 重置列的可视状态
1640
- */
1641
- RESET_COLUMN: {
1642
- tableMenuMethod: function tableMenuMethod(params) {
1643
- var $table = params.$table;
1644
- $table.resetColumn({
1645
- visible: true,
1646
- resizable: false
1647
- });
1648
- }
1649
- },
1650
- /**
1651
- * 重置列宽状态
1652
- */
1653
- RESET_RESIZABLE: {
1654
- tableMenuMethod: function tableMenuMethod(params) {
1655
- var $table = params.$table;
1656
- $table.resetColumn({
1657
- visible: false,
1658
- resizable: true
1659
- });
1660
- }
1661
- },
1662
- /**
1663
- * 重置列的所有状态
1664
- */
1665
- RESET_ALL: {
1666
- tableMenuMethod: function tableMenuMethod(params) {
1667
- var $table = params.$table;
1668
- $table.resetColumn(true);
1669
- }
1670
- },
1671
- /**
1672
- * 用于 proxy-config,重新初始化,恢复到初始状态,触发对应的 ajax.query
1673
- */
1674
- COMMIT_PROXY_INITIAL: {
1675
- tableMenuMethod: createCommitHandle('initial')
1676
- },
1677
- /**
1678
- * 用于 proxy-config,重新加载,如果有分页,返回第一页,触发对应的 ajax.query
1679
- */
1680
- COMMIT_PROXY_QUERY: {
1681
- tableMenuMethod: createCommitHandle('query')
1682
- },
1683
- /**
1684
- * 用于 proxy-config,刷新当前页,触发对应的 ajax.quer
1685
- */
1686
- COMMIT_PROXY_RELOAD: {
1687
- tableMenuMethod: createCommitHandle('reload')
1688
- },
1689
- /**
1690
- * 用于 proxy-config,直接删除,触发对应的 ajax.delete
1691
- */
1692
- COMMIT_PROXY_DELETE: {
1693
- tableMenuMethod: createCommitHandle('delete')
1694
- },
1695
- /**
1696
- * 用于 proxy-config,保存数据,触发对应的 ajax.save
1697
- */
1698
- COMMIT_PROXY_SAVE: {
1699
- tableMenuMethod: createCommitHandle('save')
1700
- }
1701
- });
1702
- VxeUI.interceptor.add('event.showMenu', handlePrivilegeEvent);
1703
- }
1704
- };
1705
- if (typeof window !== 'undefined' && window.VxeUI && window.VxeUI.use) {
1706
- window.VxeUI.use(VxeUIPluginMenu);
1707
- }
1708
- var _default2 = _exports["default"] = VxeUIPluginMenu;
1709
- });
7
+ function getDefaultExportFromCjs (x) {
8
+ return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
9
+ }
10
+
11
+ var lib = {};
12
+
13
+ var hasRequiredLib;
14
+
15
+ function requireLib () {
16
+ if (hasRequiredLib) return lib;
17
+ hasRequiredLib = 1;
18
+ (function (exports$1) {
19
+
20
+ Object.defineProperty(exports$1, "__esModule", {
21
+ value: true
22
+ });
23
+ exports$1["default"] = exports$1.VxeUIPluginMenu = void 0;
24
+ var _xeUtils = _interopRequireDefault(require$$0);
25
+ function _interopRequireDefault(e) { return e && e.__esModule ? e : { "default": e }; }
26
+ var VxeUI;
27
+ var handleCopy;
28
+ var columnIndexOf = function columnIndexOf(cols, column) {
29
+ return _xeUtils["default"].findIndexOf(cols, function (item) {
30
+ return item.id === column.id;
31
+ });
32
+ };
33
+ var rowIndexOf = function rowIndexOf($table, rows, row) {
34
+ return $table.findRowIndexOf(rows, row);
35
+ };
36
+ function handleFixedColumn(fixed) {
37
+ return {
38
+ tableMenuMethod: function tableMenuMethod(params) {
39
+ var $table = params.$table,
40
+ column = params.column;
41
+ _xeUtils["default"].eachTree([column], function (column) {
42
+ column.fixed = fixed;
43
+ });
44
+ $table.refreshColumn();
45
+ }
46
+ };
47
+ }
48
+ function getClipboardObj() {
49
+ var globalStore = VxeUI.globalStore;
50
+ if (globalStore) {
51
+ return globalStore.clipboard || '';
52
+ }
53
+ // 兼容老版本
54
+ var globalConfig = VxeUI.config;
55
+ if (globalConfig && globalConfig.clipboard) {
56
+ return globalConfig.clipboard;
57
+ }
58
+ return null;
59
+ }
60
+ function setClipboardConfig(clipObj) {
61
+ var globalStore = VxeUI.globalStore;
62
+ if (globalStore) {
63
+ globalStore.clipboard = clipObj;
64
+ } else if (VxeUI.config) {
65
+ // 兼容老版本
66
+ VxeUI.config.clipboard = clipObj;
67
+ }
68
+ }
69
+ var copyElem;
70
+ function handleText(content) {
71
+ if (!copyElem) {
72
+ copyElem = document.createElement('textarea');
73
+ copyElem.id = '$XECopy';
74
+ var styles = copyElem.style;
75
+ styles.width = '48px';
76
+ styles.height = '24px';
77
+ styles.position = 'fixed';
78
+ styles.zIndex = '0';
79
+ styles.left = '-500px';
80
+ styles.top = '-500px';
81
+ document.body.appendChild(copyElem);
82
+ }
83
+ copyElem.value = content === null || content === undefined ? '' : '' + content;
84
+ }
85
+ function copyText(content) {
86
+ var result = false;
87
+ try {
88
+ handleText(content);
89
+ copyElem.select();
90
+ copyElem.setSelectionRange(0, copyElem.value.length);
91
+ result = document.execCommand('copy');
92
+ copyElem.blur();
93
+ } catch (e) {}
94
+ return result;
95
+ }
96
+ function handleCopyOrCut(params, isCut) {
97
+ var $event = params.$event,
98
+ $table = params.$table,
99
+ row = params.row,
100
+ column = params.column;
101
+ if (row && column) {
102
+ var props = $table;
103
+ var mouseConfig = props.mouseConfig;
104
+ var mouseOpts = $table.computeMouseOpts;
105
+ var text = '';
106
+ if (mouseConfig && mouseOpts.area) {
107
+ if (isCut) {
108
+ $table.triggerCutCellAreaEvent($event);
109
+ } else {
110
+ $table.triggerCopyCellAreaEvent($event);
111
+ }
112
+ var clipboard = getClipboardObj();
113
+ text = clipboard ? clipboard.text : '';
114
+ } else {
115
+ // 操作内置剪贴板
116
+ text = _xeUtils["default"].toValueString(_xeUtils["default"].get(row, column.field));
117
+ setClipboardConfig({
118
+ text: text,
119
+ html: ''
120
+ });
121
+ }
122
+ // 开始复制操作
123
+ if (_xeUtils["default"].isFunction(handleCopy)) {
124
+ handleCopy(text);
125
+ } else {
126
+ copyText(text);
127
+ }
128
+ }
129
+ }
130
+ function createCommitHandle(code) {
131
+ return function (params) {
132
+ var $grid = params.$grid;
133
+ if ($grid) {
134
+ $grid.commitProxy(code);
135
+ }
136
+ };
137
+ }
138
+ function checkCellOverlay(params, cellAreas) {
139
+ var $table = params.$table;
140
+ var _$table$getTableData = $table.getTableData(),
141
+ visibleData = _$table$getTableData.visibleData;
142
+ var _$table$getTableColum = $table.getTableColumn(),
143
+ visibleColumn = _$table$getTableColum.visibleColumn;
144
+ var indexMaps = {};
145
+ for (var aIndex = 0, areaSize = cellAreas.length; aIndex < areaSize; aIndex++) {
146
+ var areaItem = cellAreas[aIndex];
147
+ var rows = areaItem.rows,
148
+ cols = areaItem.cols;
149
+ for (var rIndex = 0, rowSize = rows.length; rIndex < rowSize; rIndex++) {
150
+ var offsetRow = rows[rIndex];
151
+ var orIndex = rowIndexOf($table, visibleData, offsetRow);
152
+ for (var cIndex = 0, colSize = cols.length; cIndex < colSize; cIndex++) {
153
+ var offsetColumn = cols[cIndex];
154
+ var ocIndex = columnIndexOf(visibleColumn, offsetColumn);
155
+ var key = orIndex + ':' + ocIndex;
156
+ if (indexMaps[key]) {
157
+ return false;
158
+ }
159
+ indexMaps[key] = true;
160
+ }
161
+ }
162
+ }
163
+ return true;
164
+ }
165
+ function getBeenMerges(params) {
166
+ var $table = params.$table;
167
+ var tableProps = $table;
168
+ var mouseConfig = tableProps.mouseConfig;
169
+ var mouseOpts = $table.computeMouseOpts;
170
+ var _$table$getTableData2 = $table.getTableData(),
171
+ visibleData = _$table$getTableData2.visibleData;
172
+ var _$table$getTableColum2 = $table.getTableColumn(),
173
+ visibleColumn = _$table$getTableColum2.visibleColumn;
174
+ var cellAreas = mouseConfig && mouseOpts.area ? $table.getCellAreas() : [];
175
+ var mergeList = $table.getMergeCells();
176
+ return mergeList.filter(function (_ref) {
177
+ var mergeRowIndex = _ref.row,
178
+ mergeColIndex = _ref.col,
179
+ mergeRowspan = _ref.rowspan,
180
+ mergeColspan = _ref.colspan;
181
+ return cellAreas.some(function (areaItem) {
182
+ var rows = areaItem.rows,
183
+ cols = areaItem.cols;
184
+ var startRowIndex = rowIndexOf($table, visibleData, rows[0]);
185
+ var endRowIndex = rowIndexOf($table, visibleData, rows[rows.length - 1]);
186
+ var startColIndex = columnIndexOf(visibleColumn, cols[0]);
187
+ var endColIndex = columnIndexOf(visibleColumn, cols[cols.length - 1]);
188
+ return mergeRowIndex >= startRowIndex && mergeRowIndex + mergeRowspan - 1 <= endRowIndex && mergeColIndex >= startColIndex && mergeColIndex + mergeColspan - 1 <= endColIndex;
189
+ });
190
+ });
191
+ }
192
+ function handleClearMergeCells(params) {
193
+ var $table = params.$table;
194
+ var beenMerges = getBeenMerges(params);
195
+ if (beenMerges.length) {
196
+ $table.removeMergeCells(beenMerges);
197
+ }
198
+ return beenMerges;
199
+ }
200
+ function checkPrivilege(item, params) {
201
+ var code = item.code;
202
+ var $table = params.$table,
203
+ $grid = params.$grid,
204
+ row = params.row,
205
+ column = params.column,
206
+ type = params.type;
207
+ var tableProps = $table;
208
+ var editConfig = tableProps.editConfig,
209
+ mouseConfig = tableProps.mouseConfig;
210
+ switch (code) {
211
+ case 'CLEAR_ALL_SORT':
212
+ {
213
+ var sortList = $table.getSortColumns();
214
+ item.disabled = !sortList.length;
215
+ break;
216
+ }
217
+ case 'CLEAR_ALL_FILTER':
218
+ {
219
+ var filterList = $table.getCheckedFilters();
220
+ item.disabled = !filterList.length;
221
+ break;
222
+ }
223
+ case 'CLEAR_ALL_MERGE':
224
+ {
225
+ var mergeCells = $table.getMergeCells();
226
+ var mergeFooterItems = $table.getMergeFooterItems();
227
+ item.disabled = !mergeCells.length && !mergeFooterItems.length;
228
+ break;
229
+ }
230
+ case 'CLEAR_MERGE_CELL':
231
+ {
232
+ var beenMerges = getBeenMerges(params);
233
+ item.disabled = !beenMerges.length;
234
+ break;
235
+ }
236
+ case 'COPY_TITLE':
237
+ {
238
+ item.disabled = !column || type !== 'header';
239
+ break;
240
+ }
241
+ case 'SELECT_ALL_AREA':
242
+ {
243
+ var _$table$getTableData3 = $table.getTableData(),
244
+ visibleData = _$table$getTableData3.visibleData;
245
+ var _$table$getTableColum3 = $table.getTableColumn(),
246
+ visibleColumn = _$table$getTableColum3.visibleColumn;
247
+ item.disabled = !visibleData.length || !visibleColumn.length;
248
+ break;
249
+ }
250
+ case 'SELECT_AREA_TO_LEFT':
251
+ case 'SELECT_AREA_TO_RIGHT':
252
+ case 'SELECT_AREA_TO_TOP':
253
+ case 'SELECT_AREA_TO_BOTTON':
254
+ {
255
+ item.disabled = !column || !row;
256
+ break;
257
+ }
258
+ case 'DELETE_CHECKBOX_ROW':
259
+ {
260
+ var selectRecords = $table.getCheckboxRecords();
261
+ item.disabled = !selectRecords.length;
262
+ break;
263
+ }
264
+ case 'EDIT_CELL':
265
+ case 'CLEAR_CELL':
266
+ case 'CLEAR_ROW':
267
+ case 'COPY_CELL':
268
+ case 'CUT_CELL':
269
+ case 'PASTE_CELL':
270
+ case 'MERGE_OR_CLEAR':
271
+ case 'MERGE_CELL':
272
+ case 'REVERT_CELL':
273
+ case 'REVERT_ROW':
274
+ case 'DELETE_ROW':
275
+ case 'DELETE_AREA_ROW':
276
+ case 'CLEAR_SORT':
277
+ case 'SORT_ASC':
278
+ case 'SORT_DESC':
279
+ case 'CLEAR_FILTER':
280
+ case 'FILTER_CELL':
281
+ case 'EXPORT_ROW':
282
+ case 'OPEN_FIND':
283
+ case 'OPEN_REPLACE':
284
+ case 'HIDDEN_COLUMN':
285
+ case 'FIXED_LEFT_COLUMN':
286
+ case 'FIXED_RIGHT_COLUMN':
287
+ case 'CLEAR_FIXED_COLUMN':
288
+ {
289
+ item.disabled = !column;
290
+ if (column) {
291
+ var mouseOpts = $table.computeMouseOpts;
292
+ var isChildCol = !!column.parentId;
293
+ switch (code) {
294
+ case 'CLEAR_SORT':
295
+ {
296
+ item.disabled = !column.sortable || !column.order;
297
+ break;
298
+ }
299
+ case 'SORT_ASC':
300
+ case 'SORT_DESC':
301
+ item.disabled = !column.sortable;
302
+ break;
303
+ case 'FILTER_CELL':
304
+ case 'CLEAR_FILTER':
305
+ item.disabled = !column.filters || !column.filters.length;
306
+ if (!item.disabled) {
307
+ switch (code) {
308
+ case 'CLEAR_FILTER':
309
+ item.disabled = !column.filters.some(function (option) {
310
+ return option.checked;
311
+ });
312
+ break;
313
+ }
314
+ }
315
+ break;
316
+ case 'REVERT_CELL':
317
+ {
318
+ item.disabled = !row || !column.field || !$table.isUpdateByRow(row, column.field);
319
+ break;
320
+ }
321
+ case 'REVERT_ROW':
322
+ {
323
+ item.disabled = !row || !column.field || !$table.isUpdateByRow(row);
324
+ break;
325
+ }
326
+ case 'OPEN_FIND':
327
+ case 'OPEN_REPLACE':
328
+ {
329
+ item.disabled = !(mouseConfig && mouseOpts.area);
330
+ break;
331
+ }
332
+ case 'EDIT_CELL':
333
+ {
334
+ item.disabled = !editConfig || !column.editRender;
335
+ break;
336
+ }
337
+ case 'COPY_CELL':
338
+ case 'CUT_CELL':
339
+ case 'PASTE_CELL':
340
+ {
341
+ var cellAreas = mouseConfig && mouseOpts.area ? $table.getCellAreas() : [];
342
+ item.disabled = cellAreas.length > 1;
343
+ if (!item.disabled) {
344
+ switch (code) {
345
+ case 'PASTE_CELL':
346
+ {
347
+ var clipboard = getClipboardObj();
348
+ item.disabled = !clipboard || !clipboard.text;
349
+ break;
350
+ }
351
+ }
352
+ }
353
+ break;
354
+ }
355
+ case 'MERGE_OR_CLEAR':
356
+ case 'MERGE_CELL':
357
+ {
358
+ var _cellAreas = mouseConfig && mouseOpts.area ? $table.getCellAreas() : [];
359
+ item.disabled = !_cellAreas.length || _cellAreas.length === 1 && _cellAreas[0].rows.length === 1 && _cellAreas[0].cols.length === 1 || !checkCellOverlay(params, _cellAreas);
360
+ break;
361
+ }
362
+ case 'FIXED_LEFT_COLUMN':
363
+ item.disabled = isChildCol || column.fixed === 'left';
364
+ break;
365
+ case 'FIXED_RIGHT_COLUMN':
366
+ item.disabled = isChildCol || column.fixed === 'right';
367
+ break;
368
+ case 'CLEAR_FIXED_COLUMN':
369
+ item.disabled = isChildCol || !column.fixed;
370
+ break;
371
+ }
372
+ }
373
+ break;
374
+ }
375
+ case 'COMMIT_PROXY_INITIAL':
376
+ case 'COMMIT_PROXY_QUERY':
377
+ case 'COMMIT_PROXY_RELOAD':
378
+ case 'COMMIT_PROXY_DELETE':
379
+ case 'COMMIT_PROXY_SAVE':
380
+ {
381
+ item.disabled = !$grid;
382
+ break;
383
+ }
384
+ }
385
+ }
386
+ function handlePrivilegeEvent(params) {
387
+ params.options.forEach(function (list) {
388
+ list.forEach(function (item) {
389
+ checkPrivilege(item, params);
390
+ if (item.children) {
391
+ item.children.forEach(function (child) {
392
+ checkPrivilege(child, params);
393
+ });
394
+ }
395
+ });
396
+ });
397
+ return true;
398
+ }
399
+ function selectMultipleRows() {
400
+ return new Promise(function (resolve) {
401
+ if (VxeUI.modal) {
402
+ var VxeUINumberInputComponent = VxeUI.getComponent('VxeNumberInput');
403
+ if (VxeUINumberInputComponent) {
404
+ var rowSize = 1;
405
+ VxeUI.modal.alert({
406
+ title: '请输入行数',
407
+ width: 220,
408
+ maskClosable: false,
409
+ slots: {
410
+ "default": function _default(params, h) {
411
+ return h(VxeUINumberInputComponent, {
412
+ props: {
413
+ value: rowSize,
414
+ min: 1,
415
+ max: 100,
416
+ type: 'integer',
417
+ align: 'center',
418
+ controlConfig: {
419
+ layout: 'default'
420
+ }
421
+ },
422
+ style: {
423
+ width: '100%'
424
+ },
425
+ on: {
426
+ modelValue: function modelValue(value) {
427
+ rowSize = value;
428
+ }
429
+ }
430
+ });
431
+ }
432
+ }
433
+ }).then(function (type) {
434
+ if (type === 'confirm') {
435
+ resolve({
436
+ size: rowSize || 1
437
+ });
438
+ } else {
439
+ resolve({
440
+ size: 0
441
+ });
442
+ }
443
+ });
444
+ } else {
445
+ console.error(VxeUI.getI18n('vxe.error.reqComp', ['vxe-number-input']));
446
+ resolve({
447
+ size: 0
448
+ });
449
+ }
450
+ } else {
451
+ resolve({
452
+ size: 0
453
+ });
454
+ }
455
+ });
456
+ }
457
+ /**
458
+ * 浏览器-刷新页面(对应按键F5)
459
+ */
460
+ function systemPageRefresh() {
461
+ location.reload();
462
+ }
463
+ /**
464
+ * 浏览器-前进
465
+ */
466
+ function systemPageforward() {
467
+ history.forward();
468
+ }
469
+ /**
470
+ * 浏览器-后退
471
+ */
472
+ function systemPageBack() {
473
+ history.back();
474
+ }
475
+ function pluginConfig(options) {
476
+ if (options && options.copy) {
477
+ handleCopy = options.copy;
478
+ }
479
+ }
480
+ var VxeUIPluginMenu = exports$1.VxeUIPluginMenu = {
481
+ setConfig: pluginConfig,
482
+ install: function install(core, options) {
483
+ VxeUI = core;
484
+ // 检查版本
485
+ if (VxeUI.checkVersion) {
486
+ var pVersion = 3;
487
+ var sVersion = 13;
488
+ if (!VxeUI.checkVersion(VxeUI.tableVersion, pVersion, sVersion)) {
489
+ console.error("[@vxe-ui/plugin-menu 3.3.1] ".concat(VxeUI.getI18n('vxe.error.errorVersion', ["vxe-table@".concat(VxeUI.tableVersion || '?'), "vxe-table v".concat(pVersion, ".").concat(sVersion, "+")])));
490
+ }
491
+ } else {
492
+ if (!/^(3)\./.test(VxeUI.uiVersion || VxeUI.tableVersion)) {
493
+ console.error('[@vxe-ui/plugin-menu 3.3.1] Requires vxe-table 3.9.0+ version. https://vxeui.com/other3/#/plugin-menu/install');
494
+ }
495
+ }
496
+ pluginConfig(options);
497
+ VxeUI.menus.mixin({
498
+ /**
499
+ * 浏览器-刷新页面(对应按键F5)
500
+ */
501
+ SYSTEM_PAGE_REFRESH: {
502
+ tableMenuMethod: systemPageRefresh,
503
+ treeMenuMethod: systemPageRefresh,
504
+ calendarMenuMethod: systemPageRefresh,
505
+ menuMenuMethod: systemPageRefresh,
506
+ formDesignMenuMethod: systemPageRefresh
507
+ },
508
+ /**
509
+ * 浏览器-前进
510
+ */
511
+ SYSTEM_PAGE_FORWARD: {
512
+ tableMenuMethod: systemPageforward,
513
+ treeMenuMethod: systemPageforward,
514
+ calendarMenuMethod: systemPageforward,
515
+ menuMenuMethod: systemPageforward,
516
+ formDesignMenuMethod: systemPageforward
517
+ },
518
+ /**
519
+ * 浏览器-后退
520
+ */
521
+ SYSTEM_PAGE_BACK: {
522
+ tableMenuMethod: systemPageBack,
523
+ treeMenuMethod: systemPageBack,
524
+ calendarMenuMethod: systemPageBack,
525
+ menuMenuMethod: systemPageBack,
526
+ formDesignMenuMethod: systemPageBack
527
+ },
528
+ /**
529
+ * 清除单元格数据的值;如果启用 mouse-config.area 功能,则清除区域范围内的单元格数据
530
+ */
531
+ CLEAR_CELL: {
532
+ tableMenuMethod: function tableMenuMethod(params) {
533
+ var $table = params.$table,
534
+ row = params.row,
535
+ column = params.column;
536
+ if (row && column) {
537
+ var tableProps = $table;
538
+ var mouseConfig = tableProps.mouseConfig;
539
+ var mouseOpts = $table.computeMouseOpts;
540
+ if (mouseConfig && mouseOpts.area) {
541
+ var cellAreas = $table.getCellAreas();
542
+ if (cellAreas && cellAreas.length) {
543
+ cellAreas.forEach(function (areaItem) {
544
+ var rows = areaItem.rows,
545
+ cols = areaItem.cols;
546
+ cols.forEach(function (column) {
547
+ rows.forEach(function (row) {
548
+ $table.clearData(row, column.field);
549
+ });
550
+ });
551
+ });
552
+ }
553
+ } else {
554
+ $table.clearData(row, column.field);
555
+ }
556
+ }
557
+ }
558
+ },
559
+ /**
560
+ * 清除行数据的值
561
+ */
562
+ CLEAR_ROW: {
563
+ tableMenuMethod: function tableMenuMethod(params) {
564
+ var $table = params.$table,
565
+ row = params.row;
566
+ if (row) {
567
+ $table.clearData(row);
568
+ }
569
+ }
570
+ },
571
+ /**
572
+ * 清除复选框选中行数据的值
573
+ */
574
+ CLEAR_CHECKBOX_ROW: {
575
+ tableMenuMethod: function tableMenuMethod(params) {
576
+ var $table = params.$table;
577
+ $table.clearData($table.getCheckboxRecords());
578
+ }
579
+ },
580
+ /**
581
+ * 清除区域选择范围内数据的值
582
+ */
583
+ CLEAR_AREA_ROW: {
584
+ tableMenuMethod: function tableMenuMethod(params) {
585
+ var $table = params.$table,
586
+ row = params.row,
587
+ column = params.column;
588
+ var tableProps = $table;
589
+ var mouseConfig = tableProps.mouseConfig;
590
+ var mouseOpts = $table.computeMouseOpts;
591
+ if (mouseConfig && mouseOpts.area) {
592
+ var cellAreas = mouseConfig && mouseOpts.area ? $table.getCellAreas() : [];
593
+ cellAreas.forEach(function (areaItem) {
594
+ var rows = areaItem.rows,
595
+ cols = areaItem.cols;
596
+ rows.forEach(function (row) {
597
+ cols.forEach(function (column) {
598
+ $table.clearData(row);
599
+ });
600
+ });
601
+ });
602
+ } else {
603
+ if (row && column) {
604
+ $table.clearData(row);
605
+ }
606
+ }
607
+ }
608
+ },
609
+ /**
610
+ * 清除所有数据的值
611
+ */
612
+ CLEAR_ALL: {
613
+ tableMenuMethod: function tableMenuMethod(params) {
614
+ var $table = params.$table;
615
+ $table.clearData();
616
+ }
617
+ },
618
+ /**
619
+ * 选取所有区域
620
+ */
621
+ SELECT_ALL_AREA: {
622
+ tableMenuMethod: function tableMenuMethod(params) {
623
+ var $table = params.$table;
624
+ var tableProps = $table;
625
+ var mouseConfig = tableProps.mouseConfig;
626
+ var mouseOpts = $table.computeMouseOpts;
627
+ if (mouseConfig && mouseOpts.area) {
628
+ var _$table$getTableData4 = $table.getTableData(),
629
+ visibleData = _$table$getTableData4.visibleData;
630
+ var _$table$getTableColum4 = $table.getTableColumn(),
631
+ visibleColumn = _$table$getTableColum4.visibleColumn;
632
+ $table.setCellAreas([{
633
+ startRow: _xeUtils["default"].first(visibleData),
634
+ endRow: _xeUtils["default"].last(visibleData),
635
+ startColumn: _xeUtils["default"].first(visibleColumn),
636
+ endColumn: _xeUtils["default"].last(visibleColumn)
637
+ }]);
638
+ }
639
+ }
640
+ },
641
+ /**
642
+ * 以当前单元格为起点,范围选取到左侧单元格
643
+ */
644
+ SELECT_AREA_TO_LEFT: {
645
+ tableMenuMethod: function tableMenuMethod(params) {
646
+ var $table = params.$table,
647
+ row = params.row,
648
+ column = params.column;
649
+ var tableProps = $table;
650
+ var mouseConfig = tableProps.mouseConfig;
651
+ var mouseOpts = $table.computeMouseOpts;
652
+ if (mouseConfig && mouseOpts.area) {
653
+ var _$table$getTableColum5 = $table.getTableColumn(),
654
+ visibleColumn = _$table$getTableColum5.visibleColumn;
655
+ var cellAreas = $table.getCellAreas();
656
+ if (cellAreas.length === 1) {
657
+ var fitstArea = cellAreas[0];
658
+ $table.setCellAreas([{
659
+ startRow: _xeUtils["default"].first(fitstArea.rows),
660
+ endRow: _xeUtils["default"].last(fitstArea.rows),
661
+ startColumn: _xeUtils["default"].first(visibleColumn),
662
+ endColumn: _xeUtils["default"].last(fitstArea.cols)
663
+ }], {
664
+ column: column,
665
+ row: row
666
+ });
667
+ } else {
668
+ $table.setCellAreas([{
669
+ startRow: row,
670
+ endRow: row,
671
+ startColumn: _xeUtils["default"].first(visibleColumn),
672
+ endColumn: column
673
+ }], {
674
+ column: column,
675
+ row: row
676
+ });
677
+ }
678
+ }
679
+ }
680
+ },
681
+ /**
682
+ * 以当前单元格为起点,范围选取到右侧单元格
683
+ */
684
+ SELECT_AREA_TO_RIGHT: {
685
+ tableMenuMethod: function tableMenuMethod(params) {
686
+ var $table = params.$table,
687
+ row = params.row,
688
+ column = params.column;
689
+ var tableProps = $table;
690
+ var mouseConfig = tableProps.mouseConfig;
691
+ var mouseOpts = $table.computeMouseOpts;
692
+ if (mouseConfig && mouseOpts.area) {
693
+ var _$table$getTableColum6 = $table.getTableColumn(),
694
+ visibleColumn = _$table$getTableColum6.visibleColumn;
695
+ var cellAreas = $table.getCellAreas();
696
+ if (cellAreas.length === 1) {
697
+ var fitstArea = cellAreas[0];
698
+ $table.setCellAreas([{
699
+ startRow: _xeUtils["default"].first(fitstArea.rows),
700
+ endRow: _xeUtils["default"].last(fitstArea.rows),
701
+ startColumn: _xeUtils["default"].first(fitstArea.cols),
702
+ endColumn: _xeUtils["default"].last(visibleColumn)
703
+ }], {
704
+ column: column,
705
+ row: row
706
+ });
707
+ } else {
708
+ $table.setCellAreas([{
709
+ startRow: row,
710
+ endRow: row,
711
+ startColumn: column,
712
+ endColumn: _xeUtils["default"].last(visibleColumn)
713
+ }], {
714
+ column: column,
715
+ row: row
716
+ });
717
+ }
718
+ }
719
+ }
720
+ },
721
+ /**
722
+ * 以当前单元格为起点,范围选取到顶部单元格
723
+ */
724
+ SELECT_AREA_TO_TOP: {
725
+ tableMenuMethod: function tableMenuMethod(params) {
726
+ var $table = params.$table,
727
+ row = params.row,
728
+ column = params.column;
729
+ var tableProps = $table;
730
+ var mouseConfig = tableProps.mouseConfig;
731
+ var mouseOpts = $table.computeMouseOpts;
732
+ if (mouseConfig && mouseOpts.area) {
733
+ var _$table$getTableData5 = $table.getTableData(),
734
+ visibleData = _$table$getTableData5.visibleData;
735
+ var cellAreas = $table.getCellAreas();
736
+ if (cellAreas.length === 1) {
737
+ var fitstArea = cellAreas[0];
738
+ $table.setCellAreas([{
739
+ startRow: _xeUtils["default"].first(visibleData),
740
+ endRow: _xeUtils["default"].last(fitstArea.rows),
741
+ startColumn: _xeUtils["default"].first(fitstArea.cols),
742
+ endColumn: _xeUtils["default"].last(fitstArea.cols)
743
+ }], {
744
+ column: column,
745
+ row: row
746
+ });
747
+ } else {
748
+ $table.setCellAreas([{
749
+ startRow: _xeUtils["default"].first(visibleData),
750
+ endRow: row,
751
+ startColumn: column,
752
+ endColumn: column
753
+ }], {
754
+ column: column,
755
+ row: row
756
+ });
757
+ }
758
+ }
759
+ }
760
+ },
761
+ /**
762
+ * 以当前单元格为起点,范围选取到底部单元格
763
+ */
764
+ SELECT_AREA_TO_BOTTON: {
765
+ tableMenuMethod: function tableMenuMethod(params) {
766
+ var $table = params.$table,
767
+ row = params.row,
768
+ column = params.column;
769
+ var tableProps = $table;
770
+ var mouseConfig = tableProps.mouseConfig;
771
+ var mouseOpts = $table.computeMouseOpts;
772
+ if (mouseConfig && mouseOpts.area) {
773
+ var _$table$getTableData6 = $table.getTableData(),
774
+ visibleData = _$table$getTableData6.visibleData;
775
+ var cellAreas = $table.getCellAreas();
776
+ if (cellAreas.length === 1) {
777
+ var fitstArea = cellAreas[0];
778
+ $table.setCellAreas([{
779
+ startRow: _xeUtils["default"].first(fitstArea.rows),
780
+ endRow: _xeUtils["default"].last(visibleData),
781
+ startColumn: _xeUtils["default"].first(fitstArea.cols),
782
+ endColumn: _xeUtils["default"].last(fitstArea.cols)
783
+ }], {
784
+ column: column,
785
+ row: row
786
+ });
787
+ } else {
788
+ $table.setCellAreas([{
789
+ startRow: row,
790
+ endRow: _xeUtils["default"].last(visibleData),
791
+ startColumn: column,
792
+ endColumn: column
793
+ }], {
794
+ column: column,
795
+ row: row
796
+ });
797
+ }
798
+ }
799
+ }
800
+ },
801
+ /**
802
+ * 还原单元格数据的值;如果启用 mouse-config.area 功能,则还原区域范围内的单元格数据
803
+ */
804
+ REVERT_CELL: {
805
+ tableMenuMethod: function tableMenuMethod(params) {
806
+ var $table = params.$table,
807
+ row = params.row,
808
+ column = params.column;
809
+ if (row && column) {
810
+ var tableProps = $table;
811
+ var mouseConfig = tableProps.mouseConfig;
812
+ var mouseOpts = $table.computeMouseOpts;
813
+ if (mouseConfig && mouseOpts.area) {
814
+ var cellAreas = $table.getCellAreas();
815
+ if (cellAreas && cellAreas.length) {
816
+ cellAreas.forEach(function (areaItem) {
817
+ var rows = areaItem.rows,
818
+ cols = areaItem.cols;
819
+ cols.forEach(function (column) {
820
+ rows.forEach(function (row) {
821
+ $table.revertData(row, column.field);
822
+ });
823
+ });
824
+ });
825
+ }
826
+ } else {
827
+ $table.revertData(row, column.field);
828
+ }
829
+ }
830
+ }
831
+ },
832
+ /**
833
+ * 还原行数据的值
834
+ */
835
+ REVERT_ROW: {
836
+ tableMenuMethod: function tableMenuMethod(params) {
837
+ var $table = params.$table,
838
+ row = params.row;
839
+ if (row) {
840
+ $table.revertData(row);
841
+ }
842
+ }
843
+ },
844
+ /**
845
+ * 还原复选框选中行数据的值
846
+ */
847
+ REVERT_CHECKBOX_ROW: {
848
+ tableMenuMethod: function tableMenuMethod(params) {
849
+ var $table = params.$table;
850
+ $table.revertData($table.getCheckboxRecords());
851
+ }
852
+ },
853
+ /**
854
+ * 还原所有数据的值
855
+ */
856
+ REVERT_ALL: {
857
+ tableMenuMethod: function tableMenuMethod(params) {
858
+ var $table = params.$table;
859
+ $table.revertData();
860
+ }
861
+ },
862
+ /**
863
+ * 复制列头标题
864
+ */
865
+ COPY_TITLE: {
866
+ tableMenuMethod: function tableMenuMethod(params) {
867
+ var column = params.column;
868
+ var text = column.getTitle();
869
+ if (text) {
870
+ // 开始复制操作
871
+ if (_xeUtils["default"].isFunction(handleCopy)) {
872
+ handleCopy(text);
873
+ } else {
874
+ copyText(text);
875
+ }
876
+ }
877
+ }
878
+ },
879
+ /**
880
+ * 复制单元格数据的值;如果启用 mouse-config.area 功能,则复制区域范围内的单元格数据,支持 Excel 和 WPS
881
+ */
882
+ COPY_CELL: {
883
+ tableMenuMethod: function tableMenuMethod(params) {
884
+ handleCopyOrCut(params);
885
+ }
886
+ },
887
+ /**
888
+ * 剪贴单元格数据的值;如果启用 mouse-config.area 功能,则剪贴区域范围内的单元格数据,支持 Excel 和 WPS
889
+ */
890
+ CUT_CELL: {
891
+ tableMenuMethod: function tableMenuMethod(params) {
892
+ handleCopyOrCut(params, true);
893
+ }
894
+ },
895
+ /**
896
+ * 粘贴从表格中被复制的数据;如果启用 mouse-config.area 功能,则粘贴区域范围内的单元格数据,不支持读取剪贴板
897
+ */
898
+ PASTE_CELL: {
899
+ tableMenuMethod: function tableMenuMethod(params) {
900
+ var $event = params.$event,
901
+ $table = params.$table,
902
+ row = params.row,
903
+ column = params.column;
904
+ var tableProps = $table;
905
+ var mouseConfig = tableProps.mouseConfig;
906
+ var mouseOpts = $table.computeMouseOpts;
907
+ if (mouseConfig && mouseOpts.area) {
908
+ $table.triggerPasteCellAreaEvent($event);
909
+ } else {
910
+ var clipboard = getClipboardObj();
911
+ // 读取内置剪贴板
912
+ if (clipboard && clipboard.text) {
913
+ _xeUtils["default"].set(row, column.field, clipboard.text);
914
+ }
915
+ }
916
+ }
917
+ },
918
+ /**
919
+ * 如果启用 mouse-config.area 功能,如果所选区域内已存在合并单元格,则取消临时合并,否则临时合并
920
+ */
921
+ MERGE_OR_CLEAR: {
922
+ tableMenuMethod: function tableMenuMethod(params) {
923
+ var $event = params.$event,
924
+ $table = params.$table;
925
+ var cellAreas = $table.getCellAreas();
926
+ var beenMerges = getBeenMerges(params);
927
+ var status = false;
928
+ if (beenMerges.length) {
929
+ $table.removeMergeCells(beenMerges);
930
+ } else {
931
+ status = true;
932
+ $table.setMergeCells(cellAreas.map(function (_ref2) {
933
+ var rows = _ref2.rows,
934
+ cols = _ref2.cols;
935
+ return {
936
+ row: rows[0],
937
+ col: cols[0],
938
+ rowspan: rows.length,
939
+ colspan: cols.length
940
+ };
941
+ }));
942
+ }
943
+ var targetAreas = cellAreas.map(function (_ref3) {
944
+ var rows = _ref3.rows,
945
+ cols = _ref3.cols;
946
+ return {
947
+ rows: rows,
948
+ cols: cols
949
+ };
950
+ });
951
+ $table.dispatchEvent('cell-area-merge', {
952
+ status: status,
953
+ targetAreas: targetAreas
954
+ }, $event);
955
+ }
956
+ },
957
+ /**
958
+ * 如果启用 mouse-config.area 功能,临时合并区域范围内的单元格,不管是否存在已合并
959
+ */
960
+ MERGE_CELL: {
961
+ tableMenuMethod: function tableMenuMethod(params) {
962
+ var $event = params.$event,
963
+ $table = params.$table;
964
+ var _$table$getTableData7 = $table.getTableData(),
965
+ visibleData = _$table$getTableData7.visibleData;
966
+ var _$table$getTableColum7 = $table.getTableColumn(),
967
+ visibleColumn = _$table$getTableColum7.visibleColumn;
968
+ var cellAreas = $table.getCellAreas();
969
+ handleClearMergeCells(params);
970
+ if (cellAreas.some(function (_ref4) {
971
+ var rows = _ref4.rows,
972
+ cols = _ref4.cols;
973
+ return rows.length === visibleData.length || cols.length === visibleColumn.length;
974
+ })) {
975
+ if (VxeUI.modal) {
976
+ VxeUI.modal.message({
977
+ content: VxeUI.getI18n('vxe.pro.area.mergeErr'),
978
+ status: 'error',
979
+ id: 'operErr'
980
+ });
981
+ }
982
+ return;
983
+ }
984
+ $table.setMergeCells(cellAreas.map(function (_ref5) {
985
+ var rows = _ref5.rows,
986
+ cols = _ref5.cols;
987
+ return {
988
+ row: rows[0],
989
+ col: cols[0],
990
+ rowspan: rows.length,
991
+ colspan: cols.length
992
+ };
993
+ }));
994
+ var targetAreas = cellAreas.map(function (_ref6) {
995
+ var rows = _ref6.rows,
996
+ cols = _ref6.cols;
997
+ return {
998
+ rows: rows,
999
+ cols: cols
1000
+ };
1001
+ });
1002
+ $table.dispatchEvent('cell-area-merge', {
1003
+ status: true,
1004
+ targetAreas: targetAreas
1005
+ }, $event);
1006
+ }
1007
+ },
1008
+ /**
1009
+ * 如果启用 mouse-config.area 功能,清除区域范围内单元格的临时合并状态
1010
+ */
1011
+ CLEAR_MERGE_CELL: {
1012
+ tableMenuMethod: function tableMenuMethod(params) {
1013
+ var $event = params.$event,
1014
+ $table = params.$table;
1015
+ var beenMerges = handleClearMergeCells(params);
1016
+ if (beenMerges.length) {
1017
+ $table.dispatchEvent('clear-cell-area-merge', {
1018
+ mergeCells: beenMerges
1019
+ }, $event);
1020
+ }
1021
+ }
1022
+ },
1023
+ /**
1024
+ * 清除所有单元格及表尾的临时合并状态
1025
+ */
1026
+ CLEAR_ALL_MERGE: {
1027
+ tableMenuMethod: function tableMenuMethod(params) {
1028
+ var $event = params.$event,
1029
+ $table = params.$table;
1030
+ var mergeCells = $table.getMergeCells();
1031
+ var mergeFooterItems = $table.getMergeFooterItems();
1032
+ $table.clearMergeCells();
1033
+ $table.clearMergeFooterItems();
1034
+ $table.dispatchEvent('clear-merge', {
1035
+ mergeCells: mergeCells,
1036
+ mergeFooterItems: mergeFooterItems
1037
+ }, $event);
1038
+ }
1039
+ },
1040
+ /**
1041
+ * 编辑单元格
1042
+ */
1043
+ EDIT_CELL: {
1044
+ tableMenuMethod: function tableMenuMethod(params) {
1045
+ var $table = params.$table,
1046
+ row = params.row,
1047
+ column = params.column;
1048
+ if ($table.setEditCell) {
1049
+ $table.setEditCell(row, column);
1050
+ } else {
1051
+ // 兼容老版本
1052
+ $table.setActiveCell(row, column.field);
1053
+ }
1054
+ }
1055
+ },
1056
+ /**
1057
+ * 编辑行
1058
+ */
1059
+ EDIT_ROW: {
1060
+ tableMenuMethod: function tableMenuMethod(params) {
1061
+ var $table = params.$table,
1062
+ row = params.row;
1063
+ if ($table.setEditRow) {
1064
+ $table.setEditRow(row);
1065
+ } else {
1066
+ // 兼容老版本
1067
+ $table.setActiveRow(row);
1068
+ }
1069
+ }
1070
+ },
1071
+ /**
1072
+ * 插入数据
1073
+ */
1074
+ INSERT_ROW: {
1075
+ tableMenuMethod: function tableMenuMethod(params) {
1076
+ var $table = params.$table,
1077
+ menu = params.menu,
1078
+ column = params.column;
1079
+ var tableProps = $table;
1080
+ var mouseConfig = tableProps.mouseConfig;
1081
+ var mouseOpts = $table.computeMouseOpts;
1082
+ $table.insert(menu.params || {}).then(function (_ref7) {
1083
+ var rows = _ref7.rows;
1084
+ if (column && mouseConfig && mouseOpts.area) {
1085
+ $table.setCellAreas([{
1086
+ startRow: _xeUtils["default"].first(rows),
1087
+ endRow: _xeUtils["default"].last(rows),
1088
+ startColumn: column,
1089
+ endColumn: column
1090
+ }]);
1091
+ }
1092
+ });
1093
+ }
1094
+ },
1095
+ /**
1096
+ * 插入数据到指定位置
1097
+ */
1098
+ INSERT_AT_ROW: {
1099
+ tableMenuMethod: function tableMenuMethod(params) {
1100
+ var $table = params.$table,
1101
+ menu = params.menu,
1102
+ row = params.row,
1103
+ column = params.column;
1104
+ var tableProps = $table;
1105
+ var mouseConfig = tableProps.mouseConfig;
1106
+ var mouseOpts = $table.computeMouseOpts;
1107
+ (row ? $table.insertAt(menu.params || {}, row) : $table.insert(menu.params || {})).then(function (_ref8) {
1108
+ var rows = _ref8.rows;
1109
+ if (column && mouseConfig && mouseOpts.area) {
1110
+ $table.setCellAreas([{
1111
+ startRow: _xeUtils["default"].first(rows),
1112
+ endRow: _xeUtils["default"].last(rows),
1113
+ startColumn: column,
1114
+ endColumn: column
1115
+ }]);
1116
+ }
1117
+ });
1118
+ }
1119
+ },
1120
+ /**
1121
+ * 插入多行数据
1122
+ */
1123
+ BATCH_INSERT_AT_ROW: {
1124
+ tableMenuMethod: function tableMenuMethod(params) {
1125
+ var $table = params.$table,
1126
+ menu = params.menu,
1127
+ row = params.row,
1128
+ column = params.column;
1129
+ var tableProps = $table;
1130
+ var mouseConfig = tableProps.mouseConfig;
1131
+ var mouseOpts = $table.computeMouseOpts;
1132
+ selectMultipleRows().then(function (_ref9) {
1133
+ var size = _ref9.size;
1134
+ if (size) {
1135
+ var records = _xeUtils["default"].range(0, size).map(function () {
1136
+ return Object.assign({}, menu.params);
1137
+ });
1138
+ (row ? $table.insertAt(records, row) : $table.insert(records)).then(function (_ref0) {
1139
+ var rows = _ref0.rows;
1140
+ if (column && mouseConfig && mouseOpts.area) {
1141
+ $table.setCellAreas([{
1142
+ startRow: _xeUtils["default"].first(rows),
1143
+ endRow: _xeUtils["default"].last(rows),
1144
+ startColumn: column,
1145
+ endColumn: column
1146
+ }]);
1147
+ }
1148
+ });
1149
+ }
1150
+ });
1151
+ }
1152
+ },
1153
+ /**
1154
+ * 插入数据到指定位置
1155
+ */
1156
+ INSERT_NEXT_AT_ROW: {
1157
+ tableMenuMethod: function tableMenuMethod(params) {
1158
+ var $table = params.$table,
1159
+ menu = params.menu,
1160
+ row = params.row,
1161
+ column = params.column;
1162
+ var tableProps = $table;
1163
+ var mouseConfig = tableProps.mouseConfig;
1164
+ var mouseOpts = $table.computeMouseOpts;
1165
+ (row ? $table.insertNextAt(menu.params || {}, row) : $table.insert(menu.params || {})).then(function (_ref1) {
1166
+ var rows = _ref1.rows;
1167
+ if (column && mouseConfig && mouseOpts.area) {
1168
+ $table.setCellAreas([{
1169
+ startRow: _xeUtils["default"].first(rows),
1170
+ endRow: _xeUtils["default"].last(rows),
1171
+ startColumn: column,
1172
+ endColumn: column
1173
+ }]);
1174
+ }
1175
+ });
1176
+ }
1177
+ },
1178
+ /**
1179
+ * 插入数据到指定位置
1180
+ */
1181
+ BATCH_INSERT_NEXT_AT_ROW: {
1182
+ tableMenuMethod: function tableMenuMethod(params) {
1183
+ var $table = params.$table,
1184
+ menu = params.menu,
1185
+ row = params.row,
1186
+ column = params.column;
1187
+ var tableProps = $table;
1188
+ var mouseConfig = tableProps.mouseConfig;
1189
+ var mouseOpts = $table.computeMouseOpts;
1190
+ selectMultipleRows().then(function (_ref10) {
1191
+ var size = _ref10.size;
1192
+ if (size) {
1193
+ var records = _xeUtils["default"].range(0, size).map(function () {
1194
+ return Object.assign({}, menu.params);
1195
+ });
1196
+ (row ? $table.insertNextAt(records, row) : $table.insert(records)).then(function (_ref11) {
1197
+ var rows = _ref11.rows;
1198
+ if (column && mouseConfig && mouseOpts.area) {
1199
+ $table.setCellAreas([{
1200
+ startRow: _xeUtils["default"].first(rows),
1201
+ endRow: _xeUtils["default"].last(rows),
1202
+ startColumn: column,
1203
+ endColumn: column
1204
+ }]);
1205
+ }
1206
+ });
1207
+ }
1208
+ });
1209
+ }
1210
+ },
1211
+ /**
1212
+ * 插入数据并激活编辑状态
1213
+ * @deprecated
1214
+ */
1215
+ INSERT_ACTIVED_ROW: {
1216
+ tableMenuMethod: function tableMenuMethod(params) {
1217
+ var $table = params.$table,
1218
+ menu = params.menu,
1219
+ column = params.column;
1220
+ var args = menu.params || []; // [{}, 'field']
1221
+ var record = Object.assign({}, args[0] || {});
1222
+ $table.insert(record).then(function (_ref12) {
1223
+ var row = _ref12.row;
1224
+ if ($table.setEditCell) {
1225
+ $table.setEditCell(row, args[1] || column);
1226
+ } else {
1227
+ // 兼容老版本
1228
+ $table.setActiveCell(row, args[1] || column.field);
1229
+ }
1230
+ });
1231
+ }
1232
+ },
1233
+ /**
1234
+ * 插入数据并激活编辑状态
1235
+ * @deprecated
1236
+ */
1237
+ INSERT_EDIT_ROW: {
1238
+ tableMenuMethod: function tableMenuMethod(params) {
1239
+ var $table = params.$table,
1240
+ menu = params.menu,
1241
+ column = params.column;
1242
+ var args = menu.params || []; // [{}, 'field']
1243
+ var record = Object.assign({}, args[0] || {});
1244
+ $table.insert(record).then(function (_ref13) {
1245
+ var row = _ref13.row;
1246
+ if ($table.setEditCell) {
1247
+ $table.setEditCell(row, args[1] || column);
1248
+ } else {
1249
+ // 兼容老版本
1250
+ $table.setActiveCell(row, args[1] || column.field);
1251
+ }
1252
+ });
1253
+ }
1254
+ },
1255
+ /**
1256
+ * 插入数据到指定位置并激活编辑状态
1257
+ */
1258
+ INSERT_AT_ACTIVED_ROW: {
1259
+ tableMenuMethod: function tableMenuMethod(params) {
1260
+ var $table = params.$table,
1261
+ menu = params.menu,
1262
+ row = params.row,
1263
+ column = params.column;
1264
+ var args = menu.params || []; // [{}, 'field']
1265
+ var record = Object.assign({}, args[0] || {});
1266
+ (row ? $table.insertAt(record, row) : $table.insert(record)).then(function (_ref14) {
1267
+ var row = _ref14.row;
1268
+ if ($table.setEditCell) {
1269
+ $table.setEditCell(row, args[1] || column);
1270
+ } else {
1271
+ // 兼容老版本
1272
+ $table.setActiveCell(row, args[1] || column.field);
1273
+ }
1274
+ });
1275
+ }
1276
+ },
1277
+ /**
1278
+ * 插入数据到指定位置并激活编辑状态
1279
+ */
1280
+ INSERT_AT_EDIT_ROW: {
1281
+ tableMenuMethod: function tableMenuMethod(params) {
1282
+ var $table = params.$table,
1283
+ menu = params.menu,
1284
+ row = params.row,
1285
+ column = params.column;
1286
+ var args = menu.params || []; // [{}, 'field']
1287
+ var record = Object.assign({}, args[0] || {});
1288
+ (row ? $table.insertAt(record, row) : $table.insert(record)).then(function (_ref15) {
1289
+ var row = _ref15.row;
1290
+ if ($table.setEditCell) {
1291
+ $table.setEditCell(row, args[1] || column);
1292
+ } else {
1293
+ // 兼容老版本
1294
+ $table.setActiveCell(row, args[1] || column.field);
1295
+ }
1296
+ });
1297
+ }
1298
+ },
1299
+ /**
1300
+ * 批量插入数据到指定位置并激活编辑状态
1301
+ */
1302
+ BATCH_INSERT_AT_EDIT_ROW: {
1303
+ tableMenuMethod: function tableMenuMethod(params) {
1304
+ var $table = params.$table,
1305
+ menu = params.menu,
1306
+ row = params.row,
1307
+ column = params.column;
1308
+ var args = menu.params || []; // [{}, 'field']
1309
+ selectMultipleRows().then(function (_ref16) {
1310
+ var size = _ref16.size;
1311
+ if (size) {
1312
+ var records = _xeUtils["default"].range(0, size).map(function () {
1313
+ return Object.assign({}, args[0]);
1314
+ });
1315
+ (row ? $table.insertAt(records, row) : $table.insert(records)).then(function (_ref17) {
1316
+ var row = _ref17.row;
1317
+ if ($table.setEditCell) {
1318
+ $table.setEditCell(row, args[1] || column);
1319
+ } else {
1320
+ // 兼容老版本
1321
+ $table.setActiveCell(row, args[1] || column.field);
1322
+ }
1323
+ });
1324
+ }
1325
+ });
1326
+ }
1327
+ },
1328
+ /**
1329
+ * 插入数据到指定位置并激活编辑状态
1330
+ */
1331
+ INSERT_NEXT_AT_EDIT_ROW: {
1332
+ tableMenuMethod: function tableMenuMethod(params) {
1333
+ var $table = params.$table,
1334
+ menu = params.menu,
1335
+ row = params.row,
1336
+ column = params.column;
1337
+ var args = menu.params || []; // [{}, 'field']
1338
+ var record = Object.assign({}, args[0] || {});
1339
+ (row ? $table.insertNextAt(record, row) : $table.insert(record)).then(function (_ref18) {
1340
+ var row = _ref18.row;
1341
+ if ($table.setEditCell) {
1342
+ $table.setEditCell(row, args[1] || column);
1343
+ } else {
1344
+ // 兼容老版本
1345
+ $table.setActiveCell(row, args[1] || column.field);
1346
+ }
1347
+ });
1348
+ }
1349
+ },
1350
+ /**
1351
+ * 批量插入数据到指定位置并激活编辑状态
1352
+ */
1353
+ BATCH_INSERT_NEXT_AT_EDIT_ROW: {
1354
+ tableMenuMethod: function tableMenuMethod(params) {
1355
+ var $table = params.$table,
1356
+ menu = params.menu,
1357
+ row = params.row,
1358
+ column = params.column;
1359
+ var args = menu.params || []; // [{}, 'field']
1360
+ selectMultipleRows().then(function (_ref19) {
1361
+ var size = _ref19.size;
1362
+ if (size) {
1363
+ var records = _xeUtils["default"].range(0, size).map(function () {
1364
+ return Object.assign({}, args[0]);
1365
+ });
1366
+ (row ? $table.insertNextAt(records, row) : $table.insert(records)).then(function (_ref20) {
1367
+ var row = _ref20.row;
1368
+ if ($table.setEditCell) {
1369
+ $table.setEditCell(row, args[1] || column);
1370
+ } else {
1371
+ // 兼容老版本
1372
+ $table.setActiveCell(row, args[1] || column.field);
1373
+ }
1374
+ });
1375
+ }
1376
+ });
1377
+ }
1378
+ },
1379
+ /**
1380
+ * 移除行数据
1381
+ */
1382
+ DELETE_ROW: {
1383
+ tableMenuMethod: function tableMenuMethod(params) {
1384
+ var $table = params.$table,
1385
+ row = params.row;
1386
+ if (row) {
1387
+ $table.remove(row);
1388
+ }
1389
+ }
1390
+ },
1391
+ /**
1392
+ * 如果启用 mouse-config.area 功能,移除所选区域行数据
1393
+ */
1394
+ DELETE_AREA_ROW: {
1395
+ tableMenuMethod: function tableMenuMethod(params) {
1396
+ var $table = params.$table,
1397
+ row = params.row;
1398
+ var tableProps = $table;
1399
+ var mouseConfig = tableProps.mouseConfig;
1400
+ var mouseOpts = $table.computeMouseOpts;
1401
+ if (mouseConfig && mouseOpts.area) {
1402
+ var cellAreas = mouseConfig && mouseOpts.area ? $table.getCellAreas() : [];
1403
+ cellAreas.forEach(function (areaItem) {
1404
+ var rows = areaItem.rows;
1405
+ $table.remove(rows);
1406
+ });
1407
+ } else {
1408
+ if (row) {
1409
+ $table.remove(row);
1410
+ }
1411
+ }
1412
+ }
1413
+ },
1414
+ /**
1415
+ * 移除复选框选中行数据
1416
+ */
1417
+ DELETE_CHECKBOX_ROW: {
1418
+ tableMenuMethod: function tableMenuMethod(params) {
1419
+ var $table = params.$table;
1420
+ $table.removeCheckboxRow();
1421
+ }
1422
+ },
1423
+ /**
1424
+ * 移除所有行数据
1425
+ */
1426
+ DELETE_ALL: {
1427
+ tableMenuMethod: function tableMenuMethod(params) {
1428
+ var $table = params.$table;
1429
+ $table.remove();
1430
+ }
1431
+ },
1432
+ /**
1433
+ * 清除所选列排序条件
1434
+ */
1435
+ CLEAR_SORT: {
1436
+ tableMenuMethod: function tableMenuMethod(params) {
1437
+ var $event = params.$event,
1438
+ $table = params.$table,
1439
+ column = params.column;
1440
+ if (column) {
1441
+ $table.triggerSortEvent($event, column, null);
1442
+ }
1443
+ }
1444
+ },
1445
+ /**
1446
+ * 清除所有排序条件
1447
+ */
1448
+ CLEAR_ALL_SORT: {
1449
+ tableMenuMethod: function tableMenuMethod(params) {
1450
+ var $event = params.$event,
1451
+ $table = params.$table;
1452
+ var sortList = $table.getSortColumns();
1453
+ if (sortList.length) {
1454
+ $table.clearSort();
1455
+ $table.dispatchEvent('clear-sort', {
1456
+ sortList: sortList
1457
+ }, $event);
1458
+ }
1459
+ }
1460
+ },
1461
+ /**
1462
+ * 按所选列的值升序
1463
+ */
1464
+ SORT_ASC: {
1465
+ tableMenuMethod: function tableMenuMethod(params) {
1466
+ var $event = params.$event,
1467
+ $table = params.$table,
1468
+ column = params.column;
1469
+ if (column) {
1470
+ $table.triggerSortEvent($event, column, 'asc');
1471
+ }
1472
+ }
1473
+ },
1474
+ /**
1475
+ * 按所选列的值倒序
1476
+ */
1477
+ SORT_DESC: {
1478
+ tableMenuMethod: function tableMenuMethod(params) {
1479
+ var $event = params.$event,
1480
+ $table = params.$table,
1481
+ column = params.column;
1482
+ if (column) {
1483
+ $table.triggerSortEvent($event, column, 'desc');
1484
+ }
1485
+ }
1486
+ },
1487
+ /**
1488
+ * 清除复选框选中列的筛选条件
1489
+ */
1490
+ CLEAR_FILTER: {
1491
+ tableMenuMethod: function tableMenuMethod(params) {
1492
+ var $event = params.$event,
1493
+ $table = params.$table,
1494
+ column = params.column;
1495
+ if (column) {
1496
+ $table.handleClearFilter(column);
1497
+ $table.confirmFilterEvent($event);
1498
+ }
1499
+ }
1500
+ },
1501
+ /**
1502
+ * 清除所有列筛选条件
1503
+ */
1504
+ CLEAR_ALL_FILTER: {
1505
+ tableMenuMethod: function tableMenuMethod(params) {
1506
+ var $event = params.$event,
1507
+ $table = params.$table;
1508
+ var filterList = $table.getCheckedFilters();
1509
+ if (filterList.length) {
1510
+ $table.clearFilter();
1511
+ $table.dispatchEvent('clear-filter', {
1512
+ filterList: filterList
1513
+ }, $event);
1514
+ }
1515
+ }
1516
+ },
1517
+ /**
1518
+ * 根据单元格值筛选
1519
+ */
1520
+ FILTER_CELL: {
1521
+ tableMenuMethod: function tableMenuMethod(params) {
1522
+ var $table = params.$table,
1523
+ row = params.row,
1524
+ column = params.column;
1525
+ if (row && column) {
1526
+ var field = column.field,
1527
+ filters = column.filters;
1528
+ if (filters.length) {
1529
+ var option = filters[0];
1530
+ option.data = _xeUtils["default"].get(row, field);
1531
+ option.checked = true;
1532
+ $table.updateData();
1533
+ }
1534
+ }
1535
+ }
1536
+ },
1537
+ /**
1538
+ * 导出行数据
1539
+ */
1540
+ EXPORT_ROW: {
1541
+ tableMenuMethod: function tableMenuMethod(params) {
1542
+ var $table = params.$table,
1543
+ menu = params.menu,
1544
+ row = params.row;
1545
+ if (row) {
1546
+ var opts = {
1547
+ data: [row]
1548
+ };
1549
+ $table.exportData(_xeUtils["default"].assign({}, menu.params ? menu.params[0] : {}, opts));
1550
+ }
1551
+ }
1552
+ },
1553
+ /**
1554
+ * 导出复选框选中行数据
1555
+ */
1556
+ EXPORT_CHECKBOX_ROW: {
1557
+ tableMenuMethod: function tableMenuMethod(params) {
1558
+ var $table = params.$table,
1559
+ menu = params.menu;
1560
+ var opts = {
1561
+ data: $table.getCheckboxRecords()
1562
+ };
1563
+ $table.exportData(_xeUtils["default"].assign({}, menu.params ? menu.params[0] : {}, opts));
1564
+ }
1565
+ },
1566
+ /**
1567
+ * 导出所有行数据
1568
+ */
1569
+ EXPORT_ALL: {
1570
+ tableMenuMethod: function tableMenuMethod(params) {
1571
+ var $table = params.$table,
1572
+ menu = params.menu;
1573
+ $table.exportData(menu.params);
1574
+ }
1575
+ },
1576
+ /**
1577
+ * 打印所有行数据
1578
+ */
1579
+ PRINT_ALL: {
1580
+ tableMenuMethod: function tableMenuMethod(params) {
1581
+ var $table = params.$table,
1582
+ menu = params.menu;
1583
+ $table.print(menu.params);
1584
+ }
1585
+ },
1586
+ /**
1587
+ * 打印复选框选中行
1588
+ */
1589
+ PRINT_CHECKBOX_ROW: {
1590
+ tableMenuMethod: function tableMenuMethod(params) {
1591
+ var $table = params.$table,
1592
+ menu = params.menu;
1593
+ var opts = {
1594
+ data: $table.getCheckboxRecords()
1595
+ };
1596
+ $table.print(_xeUtils["default"].assign(opts, menu.params));
1597
+ }
1598
+ },
1599
+ /**
1600
+ * 打开查找功能
1601
+ */
1602
+ OPEN_FIND: {
1603
+ tableMenuMethod: function tableMenuMethod(params) {
1604
+ var $event = params.$event,
1605
+ $table = params.$table;
1606
+ $table.triggerFNROpenEvent($event, 'find');
1607
+ }
1608
+ },
1609
+ /**
1610
+ * 打开替换功能
1611
+ */
1612
+ OPEN_REPLACE: {
1613
+ tableMenuMethod: function tableMenuMethod(params) {
1614
+ var $event = params.$event,
1615
+ $table = params.$table;
1616
+ $table.triggerFNROpenEvent($event, 'replace');
1617
+ }
1618
+ },
1619
+ /**
1620
+ * 隐藏当前列
1621
+ */
1622
+ HIDDEN_COLUMN: {
1623
+ tableMenuMethod: function tableMenuMethod(params) {
1624
+ var $table = params.$table,
1625
+ column = params.column;
1626
+ if (column) {
1627
+ $table.hideColumn(column);
1628
+ }
1629
+ }
1630
+ },
1631
+ /**
1632
+ * 将列固定到左侧
1633
+ */
1634
+ FIXED_LEFT_COLUMN: handleFixedColumn('left'),
1635
+ /**
1636
+ * 将列固定到右侧
1637
+ */
1638
+ FIXED_RIGHT_COLUMN: handleFixedColumn('right'),
1639
+ /**
1640
+ * 清除固定列
1641
+ */
1642
+ CLEAR_FIXED_COLUMN: handleFixedColumn(null),
1643
+ /**
1644
+ * 重置列的可视状态
1645
+ */
1646
+ RESET_COLUMN: {
1647
+ tableMenuMethod: function tableMenuMethod(params) {
1648
+ var $table = params.$table;
1649
+ $table.resetColumn({
1650
+ visible: true,
1651
+ resizable: false
1652
+ });
1653
+ }
1654
+ },
1655
+ /**
1656
+ * 重置列宽状态
1657
+ */
1658
+ RESET_RESIZABLE: {
1659
+ tableMenuMethod: function tableMenuMethod(params) {
1660
+ var $table = params.$table;
1661
+ $table.resetColumn({
1662
+ visible: false,
1663
+ resizable: true
1664
+ });
1665
+ }
1666
+ },
1667
+ /**
1668
+ * 重置列的所有状态
1669
+ */
1670
+ RESET_ALL: {
1671
+ tableMenuMethod: function tableMenuMethod(params) {
1672
+ var $table = params.$table;
1673
+ $table.resetColumn(true);
1674
+ }
1675
+ },
1676
+ /**
1677
+ * 用于 proxy-config,重新初始化,恢复到初始状态,触发对应的 ajax.query
1678
+ */
1679
+ COMMIT_PROXY_INITIAL: {
1680
+ tableMenuMethod: createCommitHandle('initial')
1681
+ },
1682
+ /**
1683
+ * 用于 proxy-config,重新加载,如果有分页,返回第一页,触发对应的 ajax.query
1684
+ */
1685
+ COMMIT_PROXY_QUERY: {
1686
+ tableMenuMethod: createCommitHandle('query')
1687
+ },
1688
+ /**
1689
+ * 用于 proxy-config,刷新当前页,触发对应的 ajax.quer
1690
+ */
1691
+ COMMIT_PROXY_RELOAD: {
1692
+ tableMenuMethod: createCommitHandle('reload')
1693
+ },
1694
+ /**
1695
+ * 用于 proxy-config,直接删除,触发对应的 ajax.delete
1696
+ */
1697
+ COMMIT_PROXY_DELETE: {
1698
+ tableMenuMethod: createCommitHandle('delete')
1699
+ },
1700
+ /**
1701
+ * 用于 proxy-config,保存数据,触发对应的 ajax.save
1702
+ */
1703
+ COMMIT_PROXY_SAVE: {
1704
+ tableMenuMethod: createCommitHandle('save')
1705
+ }
1706
+ });
1707
+ VxeUI.interceptor.add('event.showMenu', handlePrivilegeEvent);
1708
+ }
1709
+ };
1710
+ if (typeof window !== 'undefined' && window.VxeUI && window.VxeUI.use) {
1711
+ window.VxeUI.use(VxeUIPluginMenu);
1712
+ }
1713
+ exports$1["default"] = VxeUIPluginMenu;
1714
+ } (lib));
1715
+ return lib;
1716
+ }
1717
+
1718
+ var libExports = requireLib();
1719
+ var index = /*@__PURE__*/getDefaultExportFromCjs(libExports);
1720
+
1721
+ return index;
1722
+
1723
+ }));