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