vxe-table 3.10.1 → 3.10.2
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/es/locale/lang/en-US.js +3 -2
- package/es/locale/lang/es-ES.js +3 -2
- package/es/locale/lang/hu-HU.js +3 -2
- package/es/locale/lang/ja-JP.js +3 -2
- package/es/locale/lang/ko-KR.js +3 -2
- package/es/locale/lang/pt-BR.js +3 -2
- package/es/locale/lang/ru-RU.js +3 -2
- package/es/locale/lang/uk-UA.js +3 -2
- package/es/locale/lang/vi-VN.js +3 -2
- package/es/locale/lang/zh-CHT.js +3 -2
- package/es/locale/lang/zh-CN.js +3 -2
- package/es/style.css +1 -1
- package/es/style.min.css +1 -1
- package/es/table/module/edit/mixin.js +9 -4
- package/es/table/src/body.js +43 -24
- package/es/table/src/cell.js +54 -24
- package/es/table/src/column.js +3 -1
- package/es/table/src/columnInfo.js +1 -0
- package/es/table/src/methods.js +211 -14
- package/es/table/src/props.js +2 -0
- package/es/table/src/table.js +16 -1
- package/es/table/style.css +74 -2
- package/es/table/style.min.css +1 -1
- package/es/ui/index.js +4 -1
- package/es/ui/src/log.js +1 -1
- package/es/vxe-table/style.css +74 -2
- package/es/vxe-table/style.min.css +1 -1
- package/helper/vetur/attributes.json +1 -1
- package/helper/vetur/tags.json +1 -1
- package/lib/index.umd.js +367 -75
- package/lib/index.umd.min.js +1 -1
- package/lib/locale/lang/en-US.js +3 -2
- package/lib/locale/lang/en-US.min.js +1 -1
- package/lib/locale/lang/en-US.umd.js +3 -2
- package/lib/locale/lang/es-ES.js +3 -2
- package/lib/locale/lang/es-ES.min.js +1 -1
- package/lib/locale/lang/es-ES.umd.js +3 -2
- package/lib/locale/lang/hu-HU.js +3 -2
- package/lib/locale/lang/hu-HU.min.js +1 -1
- package/lib/locale/lang/hu-HU.umd.js +3 -2
- package/lib/locale/lang/ja-JP.js +3 -2
- package/lib/locale/lang/ja-JP.min.js +1 -1
- package/lib/locale/lang/ja-JP.umd.js +3 -2
- package/lib/locale/lang/ko-KR.js +3 -2
- package/lib/locale/lang/ko-KR.min.js +1 -1
- package/lib/locale/lang/ko-KR.umd.js +3 -2
- package/lib/locale/lang/pt-BR.js +3 -2
- package/lib/locale/lang/pt-BR.min.js +1 -1
- package/lib/locale/lang/pt-BR.umd.js +3 -2
- package/lib/locale/lang/ru-RU.js +3 -2
- package/lib/locale/lang/ru-RU.min.js +1 -1
- package/lib/locale/lang/ru-RU.umd.js +3 -2
- package/lib/locale/lang/uk-UA.js +3 -2
- package/lib/locale/lang/uk-UA.min.js +1 -1
- package/lib/locale/lang/uk-UA.umd.js +3 -2
- package/lib/locale/lang/vi-VN.js +3 -2
- package/lib/locale/lang/vi-VN.min.js +1 -1
- package/lib/locale/lang/zh-CHT.js +3 -2
- package/lib/locale/lang/zh-CHT.min.js +1 -1
- package/lib/locale/lang/zh-CHT.umd.js +3 -2
- package/lib/locale/lang/zh-CN.js +3 -2
- package/lib/locale/lang/zh-CN.min.js +1 -1
- package/lib/locale/lang/zh-CN.umd.js +3 -2
- package/lib/style.css +1 -1
- package/lib/style.min.css +1 -1
- package/lib/table/module/edit/mixin.js +9 -4
- package/lib/table/module/edit/mixin.min.js +1 -1
- package/lib/table/src/body.js +41 -22
- package/lib/table/src/body.min.js +1 -1
- package/lib/table/src/cell.js +58 -24
- package/lib/table/src/cell.min.js +1 -1
- package/lib/table/src/column.js +3 -1
- package/lib/table/src/column.min.js +1 -1
- package/lib/table/src/columnInfo.js +1 -0
- package/lib/table/src/columnInfo.min.js +1 -1
- package/lib/table/src/methods.js +227 -14
- package/lib/table/src/methods.min.js +1 -1
- package/lib/table/src/props.js +2 -0
- package/lib/table/src/props.min.js +1 -1
- package/lib/table/src/table.js +15 -2
- package/lib/table/src/table.min.js +1 -1
- package/lib/table/style/style.css +74 -2
- package/lib/table/style/style.min.css +1 -1
- package/lib/ui/index.js +4 -1
- package/lib/ui/index.min.js +1 -1
- package/lib/ui/src/log.js +1 -1
- package/lib/ui/src/log.min.js +1 -1
- package/lib/vxe-table/style/style.css +74 -2
- package/lib/vxe-table/style/style.min.css +1 -1
- package/package.json +2 -2
- package/packages/locale/lang/en-US.ts +3 -2
- package/packages/locale/lang/es-ES.ts +3 -2
- package/packages/locale/lang/hu-HU.ts +3 -2
- package/packages/locale/lang/ja-JP.ts +3 -2
- package/packages/locale/lang/ko-KR.ts +3 -2
- package/packages/locale/lang/pt-BR.ts +3 -2
- package/packages/locale/lang/ru-RU.ts +3 -2
- package/packages/locale/lang/uk-UA.ts +3 -2
- package/packages/locale/lang/vi-VN.ts +3 -2
- package/packages/locale/lang/zh-CHT.ts +3 -2
- package/packages/locale/lang/zh-CN.ts +3 -2
- package/packages/table/module/custom/panel.ts +8 -8
- package/packages/table/module/edit/mixin.ts +10 -4
- package/packages/table/src/body.ts +43 -24
- package/packages/table/src/cell.ts +58 -24
- package/packages/table/src/column.ts +3 -1
- package/packages/table/src/columnInfo.ts +1 -0
- package/packages/table/src/methods.ts +227 -14
- package/packages/table/src/props.ts +2 -0
- package/packages/table/src/table.ts +16 -1
- package/packages/ui/index.ts +3 -0
- package/styles/components/table-module/custom.scss +9 -3
- package/styles/components/table.scss +80 -0
- /package/es/{iconfont.1730710763407.ttf → iconfont.1730873052490.ttf} +0 -0
- /package/es/{iconfont.1730710763407.woff → iconfont.1730873052490.woff} +0 -0
- /package/es/{iconfont.1730710763407.woff2 → iconfont.1730873052490.woff2} +0 -0
- /package/lib/{iconfont.1730710763407.ttf → iconfont.1730873052490.ttf} +0 -0
- /package/lib/{iconfont.1730710763407.woff → iconfont.1730873052490.woff} +0 -0
- /package/lib/{iconfont.1730710763407.woff2 → iconfont.1730873052490.woff2} +0 -0
package/es/table/src/cell.js
CHANGED
|
@@ -4,7 +4,7 @@ import { getFuncText, isEnableConf, formatText, eqEmptyValue } from '../../ui/sr
|
|
|
4
4
|
import { updateCellTitle } from '../../ui/src/dom';
|
|
5
5
|
import { createColumn, getRowid } from './util';
|
|
6
6
|
import { getSlotVNs } from '../../ui/src/vn';
|
|
7
|
-
const { getI18n, getIcon, renderer, formats } = VxeUI;
|
|
7
|
+
const { getI18n, getIcon, renderer, formats, renderEmptyElement } = VxeUI;
|
|
8
8
|
function renderTitlePrefixIcon(h, params) {
|
|
9
9
|
const { $table, column } = params;
|
|
10
10
|
const titlePrefix = column.titlePrefix || column.titleHelp;
|
|
@@ -43,6 +43,34 @@ function renderTitleSuffixIcon(h, params) {
|
|
|
43
43
|
]
|
|
44
44
|
: [];
|
|
45
45
|
}
|
|
46
|
+
function renderCellDragIcon(h, params) {
|
|
47
|
+
const { $table } = params;
|
|
48
|
+
return h('span', {
|
|
49
|
+
key: 'dg',
|
|
50
|
+
class: 'vxe-cell--drag-handle',
|
|
51
|
+
on: {
|
|
52
|
+
mousedown(evnt) {
|
|
53
|
+
$table.handleCellDragMousedownEvent(evnt, params);
|
|
54
|
+
},
|
|
55
|
+
mouseup: $table.handleCellDragMouseupEvent
|
|
56
|
+
}
|
|
57
|
+
}, [
|
|
58
|
+
h('i', {
|
|
59
|
+
class: 'vxe-table-icon-drag-handle'
|
|
60
|
+
})
|
|
61
|
+
]);
|
|
62
|
+
}
|
|
63
|
+
function renderCellBaseVNs(h, params, content) {
|
|
64
|
+
const { $table, column } = params;
|
|
65
|
+
const { dragSort } = column;
|
|
66
|
+
const vns = XEUtils.isArray(content) ? content : [content];
|
|
67
|
+
const rowOpts = $table.computeRowOpts;
|
|
68
|
+
const dragOpts = $table.computeDragOpts;
|
|
69
|
+
if (dragSort && rowOpts.drag && dragOpts.showIcon) {
|
|
70
|
+
vns.unshift(renderCellDragIcon(h, params));
|
|
71
|
+
}
|
|
72
|
+
return vns;
|
|
73
|
+
}
|
|
46
74
|
function renderTitleContent(h, params, content) {
|
|
47
75
|
const { $table, column } = params;
|
|
48
76
|
const { type, showHeaderOverflow } = column;
|
|
@@ -231,7 +259,7 @@ export const Cell = {
|
|
|
231
259
|
const { slots, editRender, cellRender } = column;
|
|
232
260
|
const renderOpts = editRender || cellRender;
|
|
233
261
|
if (slots && slots.default) {
|
|
234
|
-
return $table.callSlot(slots.default, params, h);
|
|
262
|
+
return renderCellBaseVNs(h, params, $table.callSlot(slots.default, params, h));
|
|
235
263
|
}
|
|
236
264
|
if (renderOpts) {
|
|
237
265
|
const compConf = renderer.get(renderOpts.name);
|
|
@@ -239,12 +267,12 @@ export const Cell = {
|
|
|
239
267
|
const rtCell = compConf ? (compConf.renderTableCell || compConf.renderCell) : null;
|
|
240
268
|
const renderFn = editRender ? rtCell : rtDefault;
|
|
241
269
|
if (renderFn) {
|
|
242
|
-
return getSlotVNs(renderFn.call($table, h, renderOpts, Object.assign({ $type: editRender ? 'edit' : 'cell' }, params)));
|
|
270
|
+
return renderCellBaseVNs(h, params, getSlotVNs(renderFn.call($table, h, renderOpts, Object.assign({ $type: editRender ? 'edit' : 'cell' }, params))));
|
|
243
271
|
}
|
|
244
272
|
}
|
|
245
273
|
const cellValue = $table.getCellLabel(row, column);
|
|
246
274
|
const cellPlaceholder = editRender ? editRender.placeholder : '';
|
|
247
|
-
return [
|
|
275
|
+
return renderCellBaseVNs(h, params, [
|
|
248
276
|
h('span', {
|
|
249
277
|
class: 'vxe-cell--label'
|
|
250
278
|
}, [
|
|
@@ -255,7 +283,7 @@ export const Cell = {
|
|
|
255
283
|
}, formatText(getFuncText(cellPlaceholder), 1))
|
|
256
284
|
: h('span', formatText(cellValue, 1))
|
|
257
285
|
])
|
|
258
|
-
];
|
|
286
|
+
]);
|
|
259
287
|
},
|
|
260
288
|
renderTreeCell(h, params) {
|
|
261
289
|
return Cell.renderTreeIcon(h, params, Cell.renderDefaultCell.call(this, h, params));
|
|
@@ -343,11 +371,13 @@ export const Cell = {
|
|
|
343
371
|
const { treeConfig, seqOpts } = $table;
|
|
344
372
|
const { slots } = column;
|
|
345
373
|
if (slots && slots.default) {
|
|
346
|
-
return $table.callSlot(slots.default, params, h);
|
|
374
|
+
return renderCellBaseVNs(h, params, $table.callSlot(slots.default, params, h));
|
|
347
375
|
}
|
|
348
376
|
const { seq } = params;
|
|
349
377
|
const seqMethod = seqOpts.seqMethod;
|
|
350
|
-
return
|
|
378
|
+
return renderCellBaseVNs(h, params, [
|
|
379
|
+
h('span', `${formatText(seqMethod ? seqMethod(params) : treeConfig ? seq : (seqOpts.startIndex || 0) + seq, 1)}`)
|
|
380
|
+
]);
|
|
351
381
|
},
|
|
352
382
|
renderTreeIndexCell(h, params) {
|
|
353
383
|
return Cell.renderTreeIcon(h, params, Cell.renderSeqCell(h, params));
|
|
@@ -394,7 +424,7 @@ export const Cell = {
|
|
|
394
424
|
}
|
|
395
425
|
const radioParams = Object.assign(Object.assign({}, params), { checked: isChecked, disabled: isDisabled, visible: isVisible });
|
|
396
426
|
if (radioSlot) {
|
|
397
|
-
return $table.callSlot(radioSlot, radioParams, h);
|
|
427
|
+
return renderCellBaseVNs(h, params, $table.callSlot(radioSlot, radioParams, h));
|
|
398
428
|
}
|
|
399
429
|
const radioVNs = [];
|
|
400
430
|
if (isVisible) {
|
|
@@ -407,7 +437,7 @@ export const Cell = {
|
|
|
407
437
|
class: 'vxe-radio--label'
|
|
408
438
|
}, defaultSlot ? $table.callSlot(defaultSlot, radioParams, h) : XEUtils.get(row, labelField)));
|
|
409
439
|
}
|
|
410
|
-
return [
|
|
440
|
+
return renderCellBaseVNs(h, params, [
|
|
411
441
|
h('span', {
|
|
412
442
|
class: ['vxe-cell--radio', {
|
|
413
443
|
'is--checked': isChecked,
|
|
@@ -415,7 +445,7 @@ export const Cell = {
|
|
|
415
445
|
}],
|
|
416
446
|
on
|
|
417
447
|
}, radioVNs)
|
|
418
|
-
];
|
|
448
|
+
]);
|
|
419
449
|
},
|
|
420
450
|
renderTreeRadioCell(h, params) {
|
|
421
451
|
return Cell.renderTreeIcon(h, params, Cell.renderRadioCell(h, params));
|
|
@@ -507,7 +537,7 @@ export const Cell = {
|
|
|
507
537
|
}
|
|
508
538
|
const checkboxParams = Object.assign(Object.assign({}, params), { checked: isChecked, disabled: isDisabled, visible: isVisible, indeterminate });
|
|
509
539
|
if (checkboxSlot) {
|
|
510
|
-
return $table.callSlot(checkboxSlot, checkboxParams, h);
|
|
540
|
+
return renderCellBaseVNs(h, params, $table.callSlot(checkboxSlot, checkboxParams, h));
|
|
511
541
|
}
|
|
512
542
|
const checkVNs = [];
|
|
513
543
|
if (isVisible) {
|
|
@@ -520,7 +550,7 @@ export const Cell = {
|
|
|
520
550
|
class: 'vxe-checkbox--label'
|
|
521
551
|
}, defaultSlot ? $table.callSlot(defaultSlot, checkboxParams, h) : XEUtils.get(row, labelField)));
|
|
522
552
|
}
|
|
523
|
-
return [
|
|
553
|
+
return renderCellBaseVNs(h, params, [
|
|
524
554
|
h('span', {
|
|
525
555
|
class: ['vxe-cell--checkbox', {
|
|
526
556
|
'is--checked': isChecked,
|
|
@@ -530,7 +560,7 @@ export const Cell = {
|
|
|
530
560
|
}],
|
|
531
561
|
on
|
|
532
562
|
}, checkVNs)
|
|
533
|
-
];
|
|
563
|
+
]);
|
|
534
564
|
},
|
|
535
565
|
renderTreeSelectionCell(h, params) {
|
|
536
566
|
return Cell.renderTreeIcon(h, params, Cell.renderCheckboxCell(h, params));
|
|
@@ -567,7 +597,7 @@ export const Cell = {
|
|
|
567
597
|
}
|
|
568
598
|
const checkboxParams = Object.assign(Object.assign({}, params), { checked: isChecked, disabled: isDisabled, visible: isVisible, indeterminate: isIndeterminate });
|
|
569
599
|
if (checkboxSlot) {
|
|
570
|
-
return $table.callSlot(checkboxSlot, checkboxParams, h);
|
|
600
|
+
return renderCellBaseVNs(h, params, $table.callSlot(checkboxSlot, checkboxParams, h));
|
|
571
601
|
}
|
|
572
602
|
const checkVNs = [];
|
|
573
603
|
if (isVisible) {
|
|
@@ -580,7 +610,7 @@ export const Cell = {
|
|
|
580
610
|
class: 'vxe-checkbox--label'
|
|
581
611
|
}, defaultSlot ? $table.callSlot(defaultSlot, checkboxParams, h) : XEUtils.get(row, labelField)));
|
|
582
612
|
}
|
|
583
|
-
return [
|
|
613
|
+
return renderCellBaseVNs(h, params, [
|
|
584
614
|
h('span', {
|
|
585
615
|
class: ['vxe-cell--checkbox', {
|
|
586
616
|
'is--checked': isChecked,
|
|
@@ -590,7 +620,7 @@ export const Cell = {
|
|
|
590
620
|
}],
|
|
591
621
|
on
|
|
592
622
|
}, checkVNs)
|
|
593
|
-
];
|
|
623
|
+
]);
|
|
594
624
|
},
|
|
595
625
|
renderTreeSelectionCellByProp(h, params) {
|
|
596
626
|
return Cell.renderTreeIcon(h, params, Cell.renderCheckboxCellByProp(h, params));
|
|
@@ -607,7 +637,7 @@ export const Cell = {
|
|
|
607
637
|
let isAceived = false;
|
|
608
638
|
let isLazyLoading = false;
|
|
609
639
|
if (slots && slots.icon) {
|
|
610
|
-
return $table.callSlot(slots.icon, params, h);
|
|
640
|
+
return renderCellBaseVNs(h, params, $table.callSlot(slots.icon, params, h));
|
|
611
641
|
}
|
|
612
642
|
if (!isHidden) {
|
|
613
643
|
const rowid = getRowid($table, row);
|
|
@@ -616,7 +646,7 @@ export const Cell = {
|
|
|
616
646
|
isLazyLoading = !!rowExpandLazyLoadedMaps[rowid];
|
|
617
647
|
}
|
|
618
648
|
}
|
|
619
|
-
return [
|
|
649
|
+
return renderCellBaseVNs(h, params, [
|
|
620
650
|
showIcon && (!visibleMethod || visibleMethod(params))
|
|
621
651
|
? h('span', {
|
|
622
652
|
class: ['vxe-table--expanded', {
|
|
@@ -632,13 +662,13 @@ export const Cell = {
|
|
|
632
662
|
class: ['vxe-table--expand-btn', isLazyLoading ? (iconLoaded || getIcon().TABLE_EXPAND_LOADED) : (isAceived ? (iconOpen || getIcon().TABLE_EXPAND_OPEN) : (iconClose || getIcon().TABLE_EXPAND_CLOSE))]
|
|
633
663
|
})
|
|
634
664
|
])
|
|
635
|
-
:
|
|
665
|
+
: renderEmptyElement($table),
|
|
636
666
|
defaultSlot || labelField
|
|
637
667
|
? h('span', {
|
|
638
668
|
class: 'vxe-table--expand-label'
|
|
639
669
|
}, defaultSlot ? $table.callSlot(defaultSlot, params, h) : XEUtils.get(row, labelField))
|
|
640
|
-
:
|
|
641
|
-
];
|
|
670
|
+
: renderEmptyElement($table)
|
|
671
|
+
]);
|
|
642
672
|
},
|
|
643
673
|
renderExpandData(h, params) {
|
|
644
674
|
const { $table, column } = params;
|
|
@@ -662,16 +692,16 @@ export const Cell = {
|
|
|
662
692
|
const { $table, column } = params;
|
|
663
693
|
const { slots } = column;
|
|
664
694
|
if (slots && slots.default) {
|
|
665
|
-
return $table.callSlot(slots.default, params, h);
|
|
695
|
+
return renderCellBaseVNs(h, params, $table.callSlot(slots.default, params, h));
|
|
666
696
|
}
|
|
667
|
-
return [
|
|
697
|
+
return renderCellBaseVNs(h, params, [
|
|
668
698
|
h('span', {
|
|
669
699
|
class: 'vxe-cell--html',
|
|
670
700
|
domProps: {
|
|
671
701
|
innerHTML: getDefaultCellLabel(params)
|
|
672
702
|
}
|
|
673
703
|
})
|
|
674
|
-
];
|
|
704
|
+
]);
|
|
675
705
|
},
|
|
676
706
|
renderTreeHTMLCell(h, params) {
|
|
677
707
|
return Cell.renderTreeIcon(h, params, Cell.renderHTMLCell(h, params));
|
package/es/table/src/column.js
CHANGED
package/es/table/src/methods.js
CHANGED
|
@@ -311,6 +311,51 @@ function getOrderField(_vm, column) {
|
|
|
311
311
|
return cellValue;
|
|
312
312
|
};
|
|
313
313
|
}
|
|
314
|
+
function clearRowDropOrigin($xeTable) {
|
|
315
|
+
const el = $xeTable.$el;
|
|
316
|
+
if (el) {
|
|
317
|
+
const clss = 'row--drag-origin';
|
|
318
|
+
XEUtils.arrayEach(el.querySelectorAll(`.${clss}`), (elem) => {
|
|
319
|
+
elem.draggable = false;
|
|
320
|
+
removeClass(elem, clss);
|
|
321
|
+
});
|
|
322
|
+
}
|
|
323
|
+
}
|
|
324
|
+
function clearRowDropTarget($xeTable) {
|
|
325
|
+
const el = $xeTable.$el;
|
|
326
|
+
if (el) {
|
|
327
|
+
const clss = 'row--drag-active-target';
|
|
328
|
+
XEUtils.arrayEach(el.querySelectorAll(`.${clss}`), (elem) => {
|
|
329
|
+
removeClass(elem, clss);
|
|
330
|
+
});
|
|
331
|
+
}
|
|
332
|
+
}
|
|
333
|
+
function showRowDropTip(evnt, $xeTable) {
|
|
334
|
+
const rdTipEl = $xeTable.$refs.refRowDragTipElem;
|
|
335
|
+
if (!rdTipEl) {
|
|
336
|
+
return;
|
|
337
|
+
}
|
|
338
|
+
const el = $xeTable.$el;
|
|
339
|
+
if (!el) {
|
|
340
|
+
return;
|
|
341
|
+
}
|
|
342
|
+
if (rdTipEl) {
|
|
343
|
+
const wrapperRect = el.getBoundingClientRect();
|
|
344
|
+
rdTipEl.style.display = 'block';
|
|
345
|
+
rdTipEl.style.top = `${Math.min(el.clientHeight - el.scrollTop - rdTipEl.clientHeight, evnt.clientY - wrapperRect.y)}px`;
|
|
346
|
+
rdTipEl.style.left = `${Math.min(el.clientWidth - el.scrollLeft - rdTipEl.clientWidth - 16, evnt.clientX - wrapperRect.x)}px`;
|
|
347
|
+
}
|
|
348
|
+
}
|
|
349
|
+
const hideRowDropTip = ($xeTable) => {
|
|
350
|
+
const rdTipEl = $xeTable.$refs.refRowDragTipElem;
|
|
351
|
+
if (rdTipEl) {
|
|
352
|
+
rdTipEl.style.display = '';
|
|
353
|
+
}
|
|
354
|
+
};
|
|
355
|
+
const updateRowDropTipContent = ($xeTable, tdEl) => {
|
|
356
|
+
const reactData = $xeTable;
|
|
357
|
+
reactData.dragTipText = tdEl.textContent || '';
|
|
358
|
+
};
|
|
314
359
|
const Methods = {
|
|
315
360
|
callSlot(slotFunc, params, h, vNodes) {
|
|
316
361
|
if (slotFunc) {
|
|
@@ -4577,6 +4622,145 @@ const Methods = {
|
|
|
4577
4622
|
this.emitEvent('sort-change', params, evnt);
|
|
4578
4623
|
}
|
|
4579
4624
|
},
|
|
4625
|
+
handleRowDragDragstartEvent(evnt) {
|
|
4626
|
+
const img = new Image();
|
|
4627
|
+
if (evnt.dataTransfer) {
|
|
4628
|
+
evnt.dataTransfer.setDragImage(img, 0, 0);
|
|
4629
|
+
}
|
|
4630
|
+
},
|
|
4631
|
+
handleRowDragDragendEvent(evnt) {
|
|
4632
|
+
const $xeTable = this;
|
|
4633
|
+
const props = $xeTable;
|
|
4634
|
+
const reactData = $xeTable;
|
|
4635
|
+
const internalData = $xeTable;
|
|
4636
|
+
const { treeConfig } = props;
|
|
4637
|
+
const rowOpts = $xeTable.computeRowOpts;
|
|
4638
|
+
const { dragEndMethod } = rowOpts;
|
|
4639
|
+
const treeOpts = $xeTable.computeTreeOpts;
|
|
4640
|
+
const { transform } = treeOpts;
|
|
4641
|
+
const { dragRow } = reactData;
|
|
4642
|
+
const { afterFullData, tableFullData, prevDragRow, prevDragPos } = internalData;
|
|
4643
|
+
if (prevDragRow && dragRow) {
|
|
4644
|
+
// 判断是否有拖动
|
|
4645
|
+
if (prevDragRow !== dragRow) {
|
|
4646
|
+
Promise.resolve(dragEndMethod
|
|
4647
|
+
? dragEndMethod({
|
|
4648
|
+
oldRow: dragRow,
|
|
4649
|
+
newRow: prevDragRow
|
|
4650
|
+
})
|
|
4651
|
+
: true).then((status) => {
|
|
4652
|
+
if (!status) {
|
|
4653
|
+
return;
|
|
4654
|
+
}
|
|
4655
|
+
const dragOffsetIndex = prevDragPos === 'bottom' ? 1 : 0;
|
|
4656
|
+
// 移出源位置
|
|
4657
|
+
const oafIndex = $xeTable.findRowIndexOf(afterFullData, dragRow);
|
|
4658
|
+
const otfIndex = $xeTable.findRowIndexOf(tableFullData, dragRow);
|
|
4659
|
+
afterFullData.splice(oafIndex, 1);
|
|
4660
|
+
tableFullData.splice(otfIndex, 1);
|
|
4661
|
+
// 插新位置
|
|
4662
|
+
const pafIndex = $xeTable.findRowIndexOf(afterFullData, prevDragRow);
|
|
4663
|
+
const ptfIndex = $xeTable.findRowIndexOf(tableFullData, prevDragRow);
|
|
4664
|
+
const nafIndex = pafIndex + dragOffsetIndex;
|
|
4665
|
+
const ntfIndex = ptfIndex + dragOffsetIndex;
|
|
4666
|
+
afterFullData.splice(nafIndex, 0, dragRow);
|
|
4667
|
+
tableFullData.splice(ntfIndex, 0, dragRow);
|
|
4668
|
+
reactData.isDragRowMove = true;
|
|
4669
|
+
$xeTable.cacheRowMap();
|
|
4670
|
+
$xeTable.updateScrollYStatus();
|
|
4671
|
+
$xeTable.handleTableData(treeConfig && transform);
|
|
4672
|
+
if (!(treeConfig && transform)) {
|
|
4673
|
+
$xeTable.updateAfterDataIndex();
|
|
4674
|
+
}
|
|
4675
|
+
$xeTable.updateFooter();
|
|
4676
|
+
$xeTable.checkSelectionStatus();
|
|
4677
|
+
if (reactData.scrollYLoad) {
|
|
4678
|
+
$xeTable.updateScrollYSpace();
|
|
4679
|
+
}
|
|
4680
|
+
$xeTable.$nextTick().then(() => {
|
|
4681
|
+
$xeTable.updateCellAreas();
|
|
4682
|
+
return $xeTable.recalculate();
|
|
4683
|
+
});
|
|
4684
|
+
$xeTable.dispatchEvent('row-dragend', {
|
|
4685
|
+
oldRow: dragRow,
|
|
4686
|
+
newRow: prevDragRow,
|
|
4687
|
+
_index: {
|
|
4688
|
+
newIndex: nafIndex,
|
|
4689
|
+
oldIndex: oafIndex
|
|
4690
|
+
}
|
|
4691
|
+
}, evnt);
|
|
4692
|
+
}).catch(() => {
|
|
4693
|
+
});
|
|
4694
|
+
}
|
|
4695
|
+
}
|
|
4696
|
+
hideRowDropTip($xeTable);
|
|
4697
|
+
clearRowDropOrigin($xeTable);
|
|
4698
|
+
clearRowDropTarget($xeTable);
|
|
4699
|
+
reactData.dragRow = null;
|
|
4700
|
+
setTimeout(() => {
|
|
4701
|
+
reactData.isDragRowMove = false;
|
|
4702
|
+
}, 500);
|
|
4703
|
+
},
|
|
4704
|
+
handleRowDragDragoverEvent(evnt) {
|
|
4705
|
+
const $xeTable = this;
|
|
4706
|
+
const internalData = $xeTable;
|
|
4707
|
+
const reactData = $xeTable;
|
|
4708
|
+
const trEl = evnt.currentTarget;
|
|
4709
|
+
const rowid = trEl.getAttribute('rowid');
|
|
4710
|
+
const row = $xeTable.getRowById(rowid);
|
|
4711
|
+
clearRowDropTarget($xeTable);
|
|
4712
|
+
if (row) {
|
|
4713
|
+
evnt.preventDefault();
|
|
4714
|
+
evnt.preventDefault();
|
|
4715
|
+
const { dragRow } = reactData;
|
|
4716
|
+
const offsetY = evnt.clientY - trEl.getBoundingClientRect().y;
|
|
4717
|
+
const dragPos = offsetY < trEl.clientHeight / 2 ? 'top' : 'bottom';
|
|
4718
|
+
addClass(trEl, 'row--drag-active-target');
|
|
4719
|
+
trEl.setAttribute('drag-pos', dragPos);
|
|
4720
|
+
internalData.prevDragRow = row;
|
|
4721
|
+
internalData.prevDragPos = dragPos;
|
|
4722
|
+
$xeTable.dispatchEvent('row-dragover', {
|
|
4723
|
+
oldRow: dragRow,
|
|
4724
|
+
targetRow: row,
|
|
4725
|
+
dragPos
|
|
4726
|
+
}, evnt);
|
|
4727
|
+
}
|
|
4728
|
+
showRowDropTip(evnt, $xeTable);
|
|
4729
|
+
},
|
|
4730
|
+
handleCellDragMousedownEvent(evnt, params) {
|
|
4731
|
+
var _a;
|
|
4732
|
+
const $xeTable = this;
|
|
4733
|
+
const reactData = $xeTable;
|
|
4734
|
+
evnt.stopPropagation();
|
|
4735
|
+
const rowOpts = $xeTable.computeRowOpts;
|
|
4736
|
+
const { dragStartMethod } = rowOpts;
|
|
4737
|
+
const { row } = params;
|
|
4738
|
+
const dragEl = evnt.currentTarget;
|
|
4739
|
+
const tdEl = (_a = dragEl.parentNode) === null || _a === void 0 ? void 0 : _a.parentNode;
|
|
4740
|
+
const trEl = tdEl.parentNode;
|
|
4741
|
+
reactData.isDragRowMove = false;
|
|
4742
|
+
clearRowDropOrigin($xeTable);
|
|
4743
|
+
if (dragStartMethod && !dragStartMethod(params)) {
|
|
4744
|
+
trEl.draggable = false;
|
|
4745
|
+
reactData.dragRow = null;
|
|
4746
|
+
hideRowDropTip($xeTable);
|
|
4747
|
+
return;
|
|
4748
|
+
}
|
|
4749
|
+
reactData.dragRow = row;
|
|
4750
|
+
trEl.draggable = true;
|
|
4751
|
+
addClass(trEl, 'row--drag-origin');
|
|
4752
|
+
showRowDropTip(evnt, $xeTable);
|
|
4753
|
+
updateRowDropTipContent($xeTable, tdEl);
|
|
4754
|
+
$xeTable.dispatchEvent('row-dragstart', params, evnt);
|
|
4755
|
+
},
|
|
4756
|
+
handleCellDragMouseupEvent() {
|
|
4757
|
+
const $xeTable = this;
|
|
4758
|
+
const reactData = $xeTable;
|
|
4759
|
+
clearRowDropOrigin($xeTable);
|
|
4760
|
+
hideRowDropTip($xeTable);
|
|
4761
|
+
reactData.dragRow = null;
|
|
4762
|
+
reactData.isDragRowMove = false;
|
|
4763
|
+
},
|
|
4580
4764
|
setPendingRow(rows, status) {
|
|
4581
4765
|
const pendingMaps = Object.assign({}, this.pendingRowMaps);
|
|
4582
4766
|
const pendingList = [...this.pendingRowList];
|
|
@@ -5436,10 +5620,11 @@ const Methods = {
|
|
|
5436
5620
|
const bodyWidth = bodyElem ? bodyElem.clientWidth : 0;
|
|
5437
5621
|
const scrollHeight = bodyElem ? bodyElem.scrollHeight : 0;
|
|
5438
5622
|
const scrollWidth = bodyElem ? bodyElem.scrollWidth : 0;
|
|
5439
|
-
|
|
5623
|
+
const evntParams = Object.assign({ bodyHeight,
|
|
5440
5624
|
bodyWidth,
|
|
5441
5625
|
scrollHeight,
|
|
5442
|
-
scrollWidth, isX: isRollX, isY: isRollY }, params)
|
|
5626
|
+
scrollWidth, isX: isRollX, isY: isRollY }, params);
|
|
5627
|
+
$xeTable.dispatchEvent('scroll', evntParams, evnt);
|
|
5443
5628
|
},
|
|
5444
5629
|
/**
|
|
5445
5630
|
* 纵向 Y 可视渲染事件处理
|
|
@@ -5459,23 +5644,29 @@ const Methods = {
|
|
|
5459
5644
|
debounceScrollYData: XEUtils.debounce(function () {
|
|
5460
5645
|
this.loadScrollYData();
|
|
5461
5646
|
}, debounceScrollYDuration, { leading: false, trailing: true }),
|
|
5462
|
-
|
|
5647
|
+
handleSyncScrollX(scrollLeft) {
|
|
5463
5648
|
const $xeTable = this;
|
|
5464
|
-
const wrapperEl = evnt.currentTarget;
|
|
5465
5649
|
const tableHeader = $xeTable.$refs.tableHeader;
|
|
5466
5650
|
const tableBody = $xeTable.$refs.tableBody;
|
|
5467
5651
|
const tableFooter = $xeTable.$refs.tableFooter;
|
|
5468
5652
|
const bodyElem = tableBody.$el;
|
|
5469
5653
|
const headerElem = tableHeader ? tableHeader.$el : null;
|
|
5470
5654
|
const footerElem = tableFooter ? tableFooter.$el : null;
|
|
5471
|
-
const { scrollTop, scrollLeft } = wrapperEl;
|
|
5472
|
-
const isRollX = true;
|
|
5473
|
-
const isRollY = false;
|
|
5474
5655
|
$xeTable.lastScrollLeft = scrollLeft;
|
|
5475
5656
|
$xeTable.lastScrollTime = Date.now();
|
|
5476
5657
|
setScrollLeft(bodyElem, scrollLeft);
|
|
5477
5658
|
setScrollLeft(headerElem, scrollLeft);
|
|
5478
5659
|
setScrollLeft(footerElem, scrollLeft);
|
|
5660
|
+
},
|
|
5661
|
+
scrollXEvent(evnt) {
|
|
5662
|
+
const $xeTable = this;
|
|
5663
|
+
const wrapperEl = evnt.currentTarget;
|
|
5664
|
+
const { scrollTop, scrollLeft } = wrapperEl;
|
|
5665
|
+
const isRollX = true;
|
|
5666
|
+
const isRollY = false;
|
|
5667
|
+
$xeTable.lastScrollLeft = scrollLeft;
|
|
5668
|
+
$xeTable.lastScrollTime = Date.now();
|
|
5669
|
+
$xeTable.handleSyncScrollX(scrollLeft);
|
|
5479
5670
|
$xeTable.triggerScrollXEvent(evnt);
|
|
5480
5671
|
$xeTable.handleScrollEvent(evnt, isRollY, isRollX, {
|
|
5481
5672
|
type: 'table',
|
|
@@ -5487,23 +5678,29 @@ const Methods = {
|
|
|
5487
5678
|
debounceScrollYCalculate: XEUtils.debounce(function () {
|
|
5488
5679
|
this.updateScrollYSpace();
|
|
5489
5680
|
}, 1000, { leading: false, trailing: true }),
|
|
5490
|
-
|
|
5681
|
+
handleSyncScrollY(scrollTop) {
|
|
5491
5682
|
const $xeTable = this;
|
|
5492
|
-
const wrapperEl = evnt.currentTarget;
|
|
5493
5683
|
const tableBody = $xeTable.$refs.tableBody;
|
|
5494
5684
|
const leftBody = $xeTable.$refs.leftBody;
|
|
5495
5685
|
const rightBody = $xeTable.$refs.rightBody;
|
|
5496
5686
|
const bodyElem = tableBody.$el;
|
|
5497
5687
|
const leftElem = leftBody ? leftBody.$el : null;
|
|
5498
5688
|
const rightElem = rightBody ? rightBody.$el : null;
|
|
5499
|
-
const { scrollTop, scrollLeft } = wrapperEl;
|
|
5500
|
-
const isRollX = false;
|
|
5501
|
-
const isRollY = true;
|
|
5502
5689
|
$xeTable.lastScrollTop = scrollTop;
|
|
5503
5690
|
$xeTable.lastScrollTime = Date.now();
|
|
5504
5691
|
setScrollTop(bodyElem, scrollTop);
|
|
5505
5692
|
setScrollTop(leftElem, scrollTop);
|
|
5506
5693
|
setScrollTop(rightElem, scrollTop);
|
|
5694
|
+
},
|
|
5695
|
+
scrollYEvent(evnt) {
|
|
5696
|
+
const $xeTable = this;
|
|
5697
|
+
const wrapperEl = evnt.currentTarget;
|
|
5698
|
+
const { scrollTop, scrollLeft } = wrapperEl;
|
|
5699
|
+
const isRollX = false;
|
|
5700
|
+
const isRollY = true;
|
|
5701
|
+
$xeTable.lastScrollTop = scrollTop;
|
|
5702
|
+
$xeTable.lastScrollTime = Date.now();
|
|
5703
|
+
$xeTable.handleSyncScrollY(scrollTop);
|
|
5507
5704
|
$xeTable.triggerScrollYEvent(evnt);
|
|
5508
5705
|
$xeTable.handleScrollEvent(evnt, isRollY, isRollX, {
|
|
5509
5706
|
type: 'table',
|
|
@@ -5589,7 +5786,7 @@ const Methods = {
|
|
|
5589
5786
|
},
|
|
5590
5787
|
updateScrollXData() {
|
|
5591
5788
|
// this.tableColumn = []
|
|
5592
|
-
this.$nextTick(() => {
|
|
5789
|
+
return this.$nextTick().then(() => {
|
|
5593
5790
|
this.handleTableColumn();
|
|
5594
5791
|
this.updateScrollXSpace();
|
|
5595
5792
|
});
|
|
@@ -5638,7 +5835,7 @@ const Methods = {
|
|
|
5638
5835
|
updateScrollYData() {
|
|
5639
5836
|
const $xeTable = this;
|
|
5640
5837
|
// this.tableData = []
|
|
5641
|
-
this.$nextTick(() => {
|
|
5838
|
+
return this.$nextTick().then(() => {
|
|
5642
5839
|
this.handleTableData();
|
|
5643
5840
|
calcCellHeight($xeTable);
|
|
5644
5841
|
this.updateScrollYSpace();
|
package/es/table/src/props.js
CHANGED
package/es/table/src/table.js
CHANGED
|
@@ -345,6 +345,9 @@ export default {
|
|
|
345
345
|
isHeader: false,
|
|
346
346
|
isFooter: false
|
|
347
347
|
},
|
|
348
|
+
isDragRowMove: false,
|
|
349
|
+
dragRow: null,
|
|
350
|
+
dragTipText: '',
|
|
348
351
|
_isLoading: false
|
|
349
352
|
};
|
|
350
353
|
},
|
|
@@ -399,6 +402,9 @@ export default {
|
|
|
399
402
|
computeRowOpts() {
|
|
400
403
|
return Object.assign({}, getConfig().table.rowConfig, this.rowConfig);
|
|
401
404
|
},
|
|
405
|
+
computeDragOpts() {
|
|
406
|
+
return Object.assign({}, getConfig().table.dragConfig, this.dragConfig);
|
|
407
|
+
},
|
|
402
408
|
resizeOpts() {
|
|
403
409
|
return this.computeResizeOpts;
|
|
404
410
|
},
|
|
@@ -1263,9 +1269,18 @@ export default {
|
|
|
1263
1269
|
}
|
|
1264
1270
|
})
|
|
1265
1271
|
: _e(),
|
|
1272
|
+
/**
|
|
1273
|
+
* 拖拽提示
|
|
1274
|
+
*/
|
|
1275
|
+
rowOpts.drag
|
|
1276
|
+
? h('div', {
|
|
1277
|
+
ref: 'refRowDragTipElem',
|
|
1278
|
+
class: 'vxe-table--row-drag-hint'
|
|
1279
|
+
}, getI18n('vxe.table.dragTip', [this.dragTipText]))
|
|
1280
|
+
: _e(),
|
|
1266
1281
|
h('div', {}, [
|
|
1267
1282
|
/**
|
|
1268
|
-
*
|
|
1283
|
+
* 提示相关
|
|
1269
1284
|
*/
|
|
1270
1285
|
VxeUITooltipComponent
|
|
1271
1286
|
? h(VxeUITooltipComponent, {
|