vxe-table 3.11.21 → 3.11.22
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/{iconfont.1733469864818.ttf → iconfont.1733702408214.ttf} +0 -0
- package/es/iconfont.1733702408214.woff +0 -0
- package/es/iconfont.1733702408214.woff2 +0 -0
- package/es/index.css +1 -1
- package/es/index.min.css +1 -1
- package/es/locale/lang/ar-EG.js +2 -0
- package/es/locale/lang/de-DE.js +2 -0
- package/es/locale/lang/en-US.js +3 -1
- package/es/locale/lang/es-ES.js +2 -0
- package/es/locale/lang/fr-FR.js +2 -0
- package/es/locale/lang/hu-HU.js +2 -0
- package/es/locale/lang/hy-AM.js +2 -0
- package/es/locale/lang/ja-JP.js +2 -0
- package/es/locale/lang/ko-KR.js +2 -0
- package/es/locale/lang/nb-NO.js +2 -0
- package/es/locale/lang/pt-BR.js +2 -0
- package/es/locale/lang/ru-RU.js +2 -0
- package/es/locale/lang/ug-CN.js +2 -0
- package/es/locale/lang/uk-UA.js +2 -0
- package/es/locale/lang/vi-VN.js +2 -0
- package/es/locale/lang/zh-CHT.js +2 -0
- package/es/locale/lang/zh-CN.js +2 -0
- package/es/style.css +1 -1
- package/es/style.min.css +1 -1
- package/es/table/module/custom/mixin.js +8 -3
- package/es/table/module/custom/panel.js +44 -27
- package/es/table/src/body.js +2 -2
- package/es/table/src/cell.js +7 -2
- package/es/table/src/header.js +1 -1
- package/es/table/src/methods.js +175 -43
- package/es/table/src/table.js +31 -4
- package/es/table/style.css +62 -4
- 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 +62 -4
- package/es/vxe-table/style.min.css +1 -1
- package/lib/{iconfont.1733469864818.ttf → iconfont.1733702408214.ttf} +0 -0
- package/lib/iconfont.1733702408214.woff +0 -0
- package/lib/iconfont.1733702408214.woff2 +0 -0
- package/lib/index.css +1 -1
- package/lib/index.min.css +1 -1
- package/lib/index.umd.js +297 -92
- package/lib/index.umd.min.js +1 -1
- package/lib/locale/lang/ar-EG.js +2 -0
- package/lib/locale/lang/ar-EG.min.js +1 -1
- package/lib/locale/lang/de-DE.js +2 -0
- package/lib/locale/lang/de-DE.min.js +1 -1
- package/lib/locale/lang/en-US.js +3 -1
- package/lib/locale/lang/en-US.min.js +1 -1
- package/lib/locale/lang/en-US.umd.js +3 -1
- package/lib/locale/lang/es-ES.js +2 -0
- package/lib/locale/lang/es-ES.min.js +1 -1
- package/lib/locale/lang/es-ES.umd.js +2 -0
- package/lib/locale/lang/fr-FR.js +2 -0
- package/lib/locale/lang/fr-FR.min.js +1 -1
- package/lib/locale/lang/hu-HU.js +2 -0
- package/lib/locale/lang/hu-HU.min.js +1 -1
- package/lib/locale/lang/hu-HU.umd.js +2 -0
- package/lib/locale/lang/hy-AM.js +2 -0
- package/lib/locale/lang/hy-AM.min.js +1 -1
- package/lib/locale/lang/ja-JP.js +2 -0
- package/lib/locale/lang/ja-JP.min.js +1 -1
- package/lib/locale/lang/ja-JP.umd.js +2 -0
- package/lib/locale/lang/ko-KR.js +2 -0
- package/lib/locale/lang/ko-KR.min.js +1 -1
- package/lib/locale/lang/ko-KR.umd.js +2 -0
- package/lib/locale/lang/nb-NO.js +2 -0
- package/lib/locale/lang/nb-NO.min.js +1 -1
- package/lib/locale/lang/pt-BR.js +2 -0
- package/lib/locale/lang/pt-BR.min.js +1 -1
- package/lib/locale/lang/pt-BR.umd.js +2 -0
- package/lib/locale/lang/ru-RU.js +2 -0
- package/lib/locale/lang/ru-RU.min.js +1 -1
- package/lib/locale/lang/ru-RU.umd.js +2 -0
- package/lib/locale/lang/ug-CN.js +2 -0
- package/lib/locale/lang/ug-CN.min.js +1 -1
- package/lib/locale/lang/uk-UA.js +2 -0
- package/lib/locale/lang/uk-UA.min.js +1 -1
- package/lib/locale/lang/uk-UA.umd.js +2 -0
- package/lib/locale/lang/vi-VN.js +2 -0
- package/lib/locale/lang/vi-VN.min.js +1 -1
- package/lib/locale/lang/zh-CHT.js +2 -0
- package/lib/locale/lang/zh-CHT.min.js +1 -1
- package/lib/locale/lang/zh-CHT.umd.js +2 -0
- package/lib/locale/lang/zh-CN.js +2 -0
- package/lib/locale/lang/zh-CN.min.js +1 -1
- package/lib/locale/lang/zh-CN.umd.js +2 -0
- package/lib/style.css +1 -1
- package/lib/style.min.css +1 -1
- package/lib/table/module/custom/mixin.js +8 -3
- package/lib/table/module/custom/mixin.min.js +1 -1
- package/lib/table/module/custom/panel.js +49 -37
- package/lib/table/module/custom/panel.min.js +1 -1
- package/lib/table/src/body.js +2 -2
- package/lib/table/src/body.min.js +1 -1
- package/lib/table/src/cell.js +6 -1
- package/lib/table/src/cell.min.js +1 -1
- package/lib/table/src/header.js +1 -1
- package/lib/table/src/header.min.js +1 -1
- package/lib/table/src/methods.js +199 -43
- package/lib/table/src/methods.min.js +1 -1
- package/lib/table/src/table.js +25 -3
- package/lib/table/src/table.min.js +1 -1
- package/lib/table/style/style.css +62 -4
- 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 +62 -4
- package/lib/vxe-table/style/style.min.css +1 -1
- package/package.json +2 -2
- package/packages/locale/lang/ar-EG.ts +2 -0
- package/packages/locale/lang/de-DE.ts +2 -0
- package/packages/locale/lang/en-US.ts +3 -1
- package/packages/locale/lang/es-ES.ts +2 -0
- package/packages/locale/lang/fr-FR.ts +2 -0
- package/packages/locale/lang/hu-HU.ts +2 -0
- package/packages/locale/lang/hy-AM.ts +2 -0
- package/packages/locale/lang/ja-JP.ts +2 -0
- package/packages/locale/lang/ko-KR.ts +2 -0
- package/packages/locale/lang/nb-NO.ts +2 -0
- package/packages/locale/lang/pt-BR.ts +2 -0
- package/packages/locale/lang/ru-RU.ts +2 -0
- package/packages/locale/lang/ug-CN.ts +2 -0
- package/packages/locale/lang/uk-UA.ts +2 -0
- package/packages/locale/lang/vi-VN.ts +2 -0
- package/packages/locale/lang/zh-CHT.ts +2 -0
- package/packages/locale/lang/zh-CN.ts +2 -0
- package/packages/table/module/custom/mixin.ts +9 -3
- package/packages/table/module/custom/panel.ts +48 -27
- package/packages/table/src/body.ts +2 -2
- package/packages/table/src/cell.ts +8 -2
- package/packages/table/src/header.ts +1 -1
- package/packages/table/src/methods.ts +187 -45
- package/packages/table/src/table.ts +34 -4
- package/packages/ui/index.ts +3 -0
- package/styles/components/icon.scss +13 -1
- package/styles/components/table.scss +53 -3
- package/styles/icon/iconfont.ttf +0 -0
- package/styles/icon/iconfont.woff +0 -0
- package/styles/icon/iconfont.woff2 +0 -0
- package/styles/theme/dark.scss +1 -0
- package/styles/theme/light.scss +1 -0
- package/styles/variable.scss +1 -0
- package/es/iconfont.1733469864818.woff +0 -0
- package/es/iconfont.1733469864818.woff2 +0 -0
- package/lib/iconfont.1733469864818.woff +0 -0
- package/lib/iconfont.1733469864818.woff2 +0 -0
|
@@ -21,11 +21,15 @@ function updateDropHint(_vm, evnt) {
|
|
|
21
21
|
}
|
|
22
22
|
const renderSimplePanel = (h, _vm) => {
|
|
23
23
|
const VxeUIButtonComponent = VxeUI.getComponent('VxeButton');
|
|
24
|
+
const props = _vm;
|
|
24
25
|
const $xeTable = _vm.$xeTable;
|
|
25
|
-
const
|
|
26
|
-
const {
|
|
26
|
+
const reactData = $xeTable;
|
|
27
|
+
const { customStore } = props;
|
|
28
|
+
const { isCustomStatus, customColumnList } = reactData;
|
|
29
|
+
const customOpts = $xeTable.computeCustomOpts;
|
|
27
30
|
const { maxHeight } = customStore;
|
|
28
31
|
const { checkMethod, visibleMethod, allowVisible, allowSort, allowFixed, trigger, placement } = customOpts;
|
|
32
|
+
const isMaxFixedColumn = $xeTable.computeIsMaxFixedColumn;
|
|
29
33
|
const slots = customOpts.slots || {};
|
|
30
34
|
const headerSlot = slots.header;
|
|
31
35
|
const topSlot = slots.top;
|
|
@@ -34,19 +38,21 @@ const renderSimplePanel = (h, _vm) => {
|
|
|
34
38
|
const footerSlot = slots.footer;
|
|
35
39
|
const colVNs = [];
|
|
36
40
|
const customWrapperOns = {};
|
|
41
|
+
const isAllChecked = customStore.isAll;
|
|
42
|
+
const isAllIndeterminate = customStore.isIndeterminate;
|
|
43
|
+
const dragColumn = _vm.dragColumn;
|
|
37
44
|
// hover 触发
|
|
38
45
|
if (trigger === 'hover') {
|
|
39
46
|
customWrapperOns.mouseenter = _vm.handleWrapperMouseenterEvent;
|
|
40
47
|
customWrapperOns.mouseleave = _vm.handleWrapperMouseleaveEvent;
|
|
41
48
|
}
|
|
42
|
-
const isAllChecked = customStore.isAll;
|
|
43
|
-
const isAllIndeterminate = customStore.isIndeterminate;
|
|
44
49
|
const params = {
|
|
45
50
|
$table: $xeTable,
|
|
46
51
|
$grid: $xeTable.xegrid,
|
|
47
52
|
columns: customColumnList,
|
|
48
53
|
isAllChecked,
|
|
49
|
-
isAllIndeterminate
|
|
54
|
+
isAllIndeterminate,
|
|
55
|
+
isCustomStatus
|
|
50
56
|
};
|
|
51
57
|
XEUtils.eachTree(customColumnList, (column, index, items, path, parent) => {
|
|
52
58
|
const isVisible = visibleMethod ? visibleMethod({ column }) : true;
|
|
@@ -94,7 +100,7 @@ const renderSimplePanel = (h, _vm) => {
|
|
|
94
100
|
class: ['vxe-checkbox--icon', isIndeterminate ? getIcon().TABLE_CHECKBOX_INDETERMINATE : (isChecked ? getIcon().TABLE_CHECKBOX_CHECKED : getIcon().TABLE_CHECKBOX_UNCHECKED)]
|
|
95
101
|
})
|
|
96
102
|
])
|
|
97
|
-
:
|
|
103
|
+
: renderEmptyElement($xeTable),
|
|
98
104
|
allowSort && column.level === 1
|
|
99
105
|
? h('div', {
|
|
100
106
|
class: 'vxe-table-custom--sort-option'
|
|
@@ -118,7 +124,7 @@ const renderSimplePanel = (h, _vm) => {
|
|
|
118
124
|
})
|
|
119
125
|
])
|
|
120
126
|
])
|
|
121
|
-
:
|
|
127
|
+
: renderEmptyElement($xeTable),
|
|
122
128
|
column.type === 'html'
|
|
123
129
|
? h('div', {
|
|
124
130
|
key: '1',
|
|
@@ -167,7 +173,7 @@ const renderSimplePanel = (h, _vm) => {
|
|
|
167
173
|
}
|
|
168
174
|
})
|
|
169
175
|
])
|
|
170
|
-
:
|
|
176
|
+
: renderEmptyElement($xeTable)
|
|
171
177
|
]));
|
|
172
178
|
}
|
|
173
179
|
});
|
|
@@ -263,7 +269,8 @@ const renderSimplePanel = (h, _vm) => {
|
|
|
263
269
|
h(VxeUIButtonComponent, {
|
|
264
270
|
props: {
|
|
265
271
|
mode: 'text',
|
|
266
|
-
content: customOpts.resetButtonText || getI18n('vxe.table.customRestore')
|
|
272
|
+
content: customOpts.resetButtonText || getI18n('vxe.table.customRestore'),
|
|
273
|
+
disabled: !isCustomStatus
|
|
267
274
|
},
|
|
268
275
|
on: {
|
|
269
276
|
click: _vm.resetCustomEvent
|
|
@@ -289,7 +296,7 @@ const renderSimplePanel = (h, _vm) => {
|
|
|
289
296
|
}
|
|
290
297
|
}),
|
|
291
298
|
customOpts.immediate
|
|
292
|
-
?
|
|
299
|
+
? renderEmptyElement($xeTable)
|
|
293
300
|
: h(VxeUIButtonComponent, {
|
|
294
301
|
props: {
|
|
295
302
|
mode: 'text',
|
|
@@ -313,15 +320,22 @@ const renderPopupPanel = (h, _vm) => {
|
|
|
313
320
|
const VxeUINumberInputComponent = VxeUI.getComponent('VxeInput');
|
|
314
321
|
const VxeUITooltipComponent = VxeUI.getComponent('VxeTooltip');
|
|
315
322
|
const $xeTableCustomPanel = _vm;
|
|
323
|
+
const props = _vm;
|
|
316
324
|
const $xeTable = _vm.$xeTable;
|
|
317
|
-
const
|
|
318
|
-
const
|
|
325
|
+
const tableProps = $xeTable;
|
|
326
|
+
const reactData = $xeTable;
|
|
327
|
+
const { customStore } = props;
|
|
328
|
+
const { resizable: allResizable } = tableProps;
|
|
329
|
+
const { isCustomStatus, customColumnList } = reactData;
|
|
330
|
+
const customOpts = $xeTable.computeCustomOpts;
|
|
319
331
|
const { mode, modalOptions, drawerOptions, allowVisible, allowSort, allowFixed, allowResizable, checkMethod, visibleMethod } = customOpts;
|
|
332
|
+
const columnOpts = $xeTable.computeColumnOpts;
|
|
320
333
|
const { maxFixedSize } = columnOpts;
|
|
321
334
|
const resizableOpts = $xeTable.computeResizableOpts;
|
|
322
335
|
const { minWidth: reMinWidth, maxWidth: reMaxWidth } = resizableOpts;
|
|
323
336
|
const modalOpts = Object.assign({}, modalOptions);
|
|
324
337
|
const drawerOpts = Object.assign({}, drawerOptions);
|
|
338
|
+
const isMaxFixedColumn = $xeTable.computeIsMaxFixedColumn;
|
|
325
339
|
const slots = customOpts.slots || {};
|
|
326
340
|
const headerSlot = slots.header;
|
|
327
341
|
const topSlot = slots.top;
|
|
@@ -331,12 +345,14 @@ const renderPopupPanel = (h, _vm) => {
|
|
|
331
345
|
const trVNs = [];
|
|
332
346
|
const isAllChecked = customStore.isAll;
|
|
333
347
|
const isAllIndeterminate = customStore.isIndeterminate;
|
|
348
|
+
const dragColumn = _vm.dragColumn;
|
|
334
349
|
const params = {
|
|
335
350
|
$table: $xeTable,
|
|
336
351
|
$grid: $xeTable.xegrid,
|
|
337
352
|
columns: customColumnList,
|
|
338
353
|
isAllChecked,
|
|
339
|
-
isAllIndeterminate
|
|
354
|
+
isAllIndeterminate,
|
|
355
|
+
isCustomStatus
|
|
340
356
|
};
|
|
341
357
|
XEUtils.eachTree(customColumnList, (column, index, items, path, parent) => {
|
|
342
358
|
const isVisible = visibleMethod ? visibleMethod({ column }) : true;
|
|
@@ -405,7 +421,7 @@ const renderPopupPanel = (h, _vm) => {
|
|
|
405
421
|
})
|
|
406
422
|
])
|
|
407
423
|
])
|
|
408
|
-
:
|
|
424
|
+
: renderEmptyElement($xeTable),
|
|
409
425
|
allowSort
|
|
410
426
|
? h('td', {
|
|
411
427
|
class: 'vxe-table-custom-popup--column-item col--sort'
|
|
@@ -431,7 +447,7 @@ const renderPopupPanel = (h, _vm) => {
|
|
|
431
447
|
])
|
|
432
448
|
: h('span', '-')
|
|
433
449
|
])
|
|
434
|
-
:
|
|
450
|
+
: renderEmptyElement($xeTable),
|
|
435
451
|
h('td', {
|
|
436
452
|
class: 'vxe-table-custom-popup--column-item col--name'
|
|
437
453
|
}, [
|
|
@@ -475,7 +491,7 @@ const renderPopupPanel = (h, _vm) => {
|
|
|
475
491
|
})
|
|
476
492
|
: renderEmptyElement($xeTableCustomPanel))
|
|
477
493
|
])
|
|
478
|
-
:
|
|
494
|
+
: renderEmptyElement($xeTable),
|
|
479
495
|
allowFixed
|
|
480
496
|
? h('td', {
|
|
481
497
|
class: 'vxe-table-custom-popup--column-item col--fixed'
|
|
@@ -501,7 +517,7 @@ const renderPopupPanel = (h, _vm) => {
|
|
|
501
517
|
}
|
|
502
518
|
})
|
|
503
519
|
])
|
|
504
|
-
:
|
|
520
|
+
: renderEmptyElement($xeTable)
|
|
505
521
|
]));
|
|
506
522
|
}
|
|
507
523
|
});
|
|
@@ -528,12 +544,12 @@ const renderPopupPanel = (h, _vm) => {
|
|
|
528
544
|
? h('col', {
|
|
529
545
|
class: 'vxe-table-custom-popup--table-col-seq'
|
|
530
546
|
})
|
|
531
|
-
:
|
|
547
|
+
: renderEmptyElement($xeTable),
|
|
532
548
|
allowSort
|
|
533
549
|
? h('col', {
|
|
534
550
|
class: 'vxe-table-custom-popup--table-col-sort'
|
|
535
551
|
})
|
|
536
|
-
:
|
|
552
|
+
: renderEmptyElement($xeTable),
|
|
537
553
|
h('col', {
|
|
538
554
|
class: 'vxe-table-custom-popup--table-col-title'
|
|
539
555
|
}),
|
|
@@ -541,12 +557,12 @@ const renderPopupPanel = (h, _vm) => {
|
|
|
541
557
|
? h('col', {
|
|
542
558
|
class: 'vxe-table-custom-popup--table-col-width'
|
|
543
559
|
})
|
|
544
|
-
:
|
|
560
|
+
: renderEmptyElement($xeTable),
|
|
545
561
|
allowFixed
|
|
546
562
|
? h('col', {
|
|
547
563
|
class: 'vxe-table-custom-popup--table-col-fixed'
|
|
548
564
|
})
|
|
549
|
-
:
|
|
565
|
+
: renderEmptyElement($xeTable)
|
|
550
566
|
]),
|
|
551
567
|
h('thead', {}, [
|
|
552
568
|
h('tr', {}, [
|
|
@@ -572,7 +588,7 @@ const renderPopupPanel = (h, _vm) => {
|
|
|
572
588
|
}, getI18n('vxe.toolbar.customAll'))
|
|
573
589
|
])
|
|
574
590
|
])
|
|
575
|
-
:
|
|
591
|
+
: renderEmptyElement($xeTable),
|
|
576
592
|
allowSort
|
|
577
593
|
? h('th', {}, [
|
|
578
594
|
h('span', {
|
|
@@ -595,14 +611,14 @@ const renderPopupPanel = (h, _vm) => {
|
|
|
595
611
|
})
|
|
596
612
|
: renderEmptyElement($xeTableCustomPanel)
|
|
597
613
|
])
|
|
598
|
-
:
|
|
614
|
+
: renderEmptyElement($xeTable),
|
|
599
615
|
h('th', {}, getI18n('vxe.custom.setting.colTitle')),
|
|
600
616
|
allowResizable
|
|
601
617
|
? h('th', {}, getI18n('vxe.custom.setting.colResizable'))
|
|
602
|
-
:
|
|
618
|
+
: renderEmptyElement($xeTable),
|
|
603
619
|
allowFixed
|
|
604
620
|
? h('th', {}, getI18n(`vxe.custom.setting.${maxFixedSize ? 'colFixedMax' : 'colFixed'}`, [maxFixedSize]))
|
|
605
|
-
:
|
|
621
|
+
: renderEmptyElement($xeTable)
|
|
606
622
|
])
|
|
607
623
|
]),
|
|
608
624
|
h('transition-group', {
|
|
@@ -622,7 +638,7 @@ const renderPopupPanel = (h, _vm) => {
|
|
|
622
638
|
h('div', {
|
|
623
639
|
ref: 'dragHintElemRef',
|
|
624
640
|
class: 'vxe-table-custom-popup--drag-hint'
|
|
625
|
-
}, getI18n('vxe.custom.cstmDragTarget', [
|
|
641
|
+
}, getI18n('vxe.custom.cstmDragTarget', [dragColumn ? dragColumn.getTitle() : '']))
|
|
626
642
|
]);
|
|
627
643
|
},
|
|
628
644
|
footer: () => {
|
|
@@ -634,7 +650,8 @@ const renderPopupPanel = (h, _vm) => {
|
|
|
634
650
|
}, [
|
|
635
651
|
h(VxeUIButtonComponent, {
|
|
636
652
|
props: {
|
|
637
|
-
content: customOpts.resetButtonText || getI18n('vxe.custom.cstmRestore')
|
|
653
|
+
content: customOpts.resetButtonText || getI18n('vxe.custom.cstmRestore'),
|
|
654
|
+
disabled: !isCustomStatus
|
|
638
655
|
},
|
|
639
656
|
on: {
|
|
640
657
|
click: _vm.resetCustomEvent
|
package/es/table/src/body.js
CHANGED
|
@@ -330,12 +330,12 @@ function renderRows(h, _vm, $xeTable, fixedType, tableData, tableColumn) {
|
|
|
330
330
|
if (editConfig) {
|
|
331
331
|
isNewRow = $xeTable.isInsertByRow(row);
|
|
332
332
|
}
|
|
333
|
-
if (treeConfig && !scrollYLoad && !
|
|
333
|
+
if (treeConfig && !scrollYLoad && !transform) {
|
|
334
334
|
rowChildren = row[childrenField];
|
|
335
335
|
isExpandTree = rowChildren && rowChildren.length && !!treeExpandedMaps[rowid];
|
|
336
336
|
}
|
|
337
337
|
// 拖拽行事件
|
|
338
|
-
if (rowOpts.drag && !
|
|
338
|
+
if (rowOpts.drag && (!treeConfig || transform)) {
|
|
339
339
|
trOn.dragstart = (evnt) => {
|
|
340
340
|
$xeTable.handleRowDragDragstartEvent(evnt);
|
|
341
341
|
};
|
package/es/table/src/cell.js
CHANGED
|
@@ -75,11 +75,16 @@ function renderCellBaseVNs(h, params, content) {
|
|
|
75
75
|
const { treeConfig, dragConfig } = tableProps;
|
|
76
76
|
const rowOpts = $table.computeRowOpts;
|
|
77
77
|
const rowDragOpts = $table.computeRowDragOpts;
|
|
78
|
-
const { showIcon, visibleMethod } = rowDragOpts;
|
|
78
|
+
const { showIcon, isCrossDrag, visibleMethod } = rowDragOpts;
|
|
79
79
|
const rVisibleMethod = visibleMethod || (dragConfig ? dragConfig.rowVisibleMethod : null);
|
|
80
80
|
const vns = XEUtils.isArray(content) ? content : [content];
|
|
81
81
|
if (dragSort && rowOpts.drag && ((showIcon || (dragConfig ? dragConfig.showRowIcon : false)) && (!rVisibleMethod || rVisibleMethod(params)))) {
|
|
82
|
-
if (
|
|
82
|
+
if (treeConfig) {
|
|
83
|
+
if (isCrossDrag || !level) {
|
|
84
|
+
vns.unshift(renderCellDragIcon(h, params));
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
else {
|
|
83
88
|
vns.unshift(renderCellDragIcon(h, params));
|
|
84
89
|
}
|
|
85
90
|
}
|
package/es/table/src/header.js
CHANGED
|
@@ -42,7 +42,7 @@ const renderRows = (h, _vm, cols, $rowIndex) => {
|
|
|
42
42
|
thOns.mousedown = (evnt) => $xetable.triggerHeaderCellMousedownEvent(evnt, params);
|
|
43
43
|
}
|
|
44
44
|
// 拖拽行事件
|
|
45
|
-
if (columnOpts.drag
|
|
45
|
+
if (columnOpts.drag) {
|
|
46
46
|
thOns.dragstart = $xetable.handleHeaderCellDragDragstartEvent;
|
|
47
47
|
thOns.dragend = $xetable.handleHeaderCellDragDragendEvent;
|
|
48
48
|
thOns.dragover = $xetable.handleHeaderCellDragDragoverEvent;
|
package/es/table/src/methods.js
CHANGED
|
@@ -414,7 +414,7 @@ const updateColDropTipContent = ($xeTable, tdEl) => {
|
|
|
414
414
|
}
|
|
415
415
|
reactData.dragTipText = tipContent;
|
|
416
416
|
};
|
|
417
|
-
function showDropTip($xeTable, evnt, trEl, thEl, dragPos) {
|
|
417
|
+
function showDropTip($xeTable, evnt, trEl, thEl, showLine, dragPos) {
|
|
418
418
|
const reactData = $xeTable;
|
|
419
419
|
const el = $xeTable.$refs.refElem;
|
|
420
420
|
if (!el) {
|
|
@@ -425,27 +425,33 @@ function showDropTip($xeTable, evnt, trEl, thEl, dragPos) {
|
|
|
425
425
|
if (trEl) {
|
|
426
426
|
const rdLineEl = $xeTable.$refs.refDragRowLineElem;
|
|
427
427
|
if (rdLineEl) {
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
top = Math.
|
|
428
|
+
if (showLine) {
|
|
429
|
+
const trRect = trEl.getBoundingClientRect();
|
|
430
|
+
rdLineEl.style.display = 'block';
|
|
431
|
+
rdLineEl.style.top = `${Math.max(1, trRect.y - wrapperRect.y)}px`;
|
|
432
|
+
rdLineEl.style.height = `${trRect.height}px`;
|
|
433
|
+
rdLineEl.style.width = `${wrapperRect.width - scrollbarWidth}px`;
|
|
434
|
+
rdLineEl.setAttribute('drag-pos', dragPos);
|
|
435
|
+
}
|
|
436
|
+
else {
|
|
437
|
+
rdLineEl.style.display = '';
|
|
432
438
|
}
|
|
433
|
-
rdLineEl.style.top = `${top}px`;
|
|
434
|
-
rdLineEl.style.width = `${wrapperRect.width - scrollbarWidth}px`;
|
|
435
|
-
rdLineEl.style.display = 'block';
|
|
436
439
|
}
|
|
437
440
|
}
|
|
438
441
|
else if (thEl) {
|
|
439
442
|
const cdLineEl = $xeTable.$refs.refDragColLineElem;
|
|
440
443
|
if (cdLineEl) {
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
left = Math.
|
|
444
|
+
if (showLine) {
|
|
445
|
+
const thRect = thEl.getBoundingClientRect();
|
|
446
|
+
cdLineEl.style.display = 'block';
|
|
447
|
+
cdLineEl.style.left = `${Math.max(1, thRect.x - wrapperRect.x)}px`;
|
|
448
|
+
cdLineEl.style.width = `${thRect.width}px`;
|
|
449
|
+
cdLineEl.style.height = `${wrapperRect.height - scrollbarHeight}px`;
|
|
450
|
+
cdLineEl.setAttribute('drag-pos', dragPos);
|
|
451
|
+
}
|
|
452
|
+
else {
|
|
453
|
+
cdLineEl.style.display = '';
|
|
445
454
|
}
|
|
446
|
-
cdLineEl.style.left = `${left}px`;
|
|
447
|
-
cdLineEl.style.height = `${wrapperRect.height - scrollbarHeight}px`;
|
|
448
|
-
cdLineEl.style.display = 'block';
|
|
449
455
|
}
|
|
450
456
|
}
|
|
451
457
|
const rdTipEl = $xeTable.$refs.refDragTipElem;
|
|
@@ -453,6 +459,7 @@ function showDropTip($xeTable, evnt, trEl, thEl, dragPos) {
|
|
|
453
459
|
rdTipEl.style.display = 'block';
|
|
454
460
|
rdTipEl.style.top = `${Math.min(el.clientHeight - el.scrollTop - rdTipEl.clientHeight, evnt.clientY - wrapperRect.y)}px`;
|
|
455
461
|
rdTipEl.style.left = `${Math.min(el.clientWidth - el.scrollLeft - rdTipEl.clientWidth - 16, evnt.clientX - wrapperRect.x)}px`;
|
|
462
|
+
rdTipEl.setAttribute('drag-status', showLine ? 'normal' : 'disabled');
|
|
456
463
|
}
|
|
457
464
|
}
|
|
458
465
|
const hideDropTip = ($xeTable) => {
|
|
@@ -932,6 +939,7 @@ const Methods = {
|
|
|
932
939
|
cacheItem = { row, rowid, seq, index: -1, _index: -1, $index: -1, items, parent, level, height: 0 };
|
|
933
940
|
}
|
|
934
941
|
if (isSource) {
|
|
942
|
+
cacheItem.level = level;
|
|
935
943
|
cacheItem.index = treeConfig && parent ? -1 : index;
|
|
936
944
|
fullDataRowIdMaps[rowid] = cacheItem;
|
|
937
945
|
}
|
|
@@ -1634,6 +1642,15 @@ const Methods = {
|
|
|
1634
1642
|
tableColumn: this.tableColumn.slice(0)
|
|
1635
1643
|
};
|
|
1636
1644
|
},
|
|
1645
|
+
/**
|
|
1646
|
+
* 获取表格的全量列
|
|
1647
|
+
*/
|
|
1648
|
+
getFullColumns() {
|
|
1649
|
+
const $xeTable = this;
|
|
1650
|
+
const internalData = $xeTable;
|
|
1651
|
+
const { collectColumn } = internalData;
|
|
1652
|
+
return collectColumn.slice(0);
|
|
1653
|
+
},
|
|
1637
1654
|
/**
|
|
1638
1655
|
* 获取数据,和 data 的行为一致,也可以指定索引获取数据
|
|
1639
1656
|
*/
|
|
@@ -2000,6 +2017,28 @@ const Methods = {
|
|
|
2000
2017
|
footerData: footerTableData.slice(0)
|
|
2001
2018
|
};
|
|
2002
2019
|
},
|
|
2020
|
+
/**
|
|
2021
|
+
* 获取表格的全量数据,如果是 tree-config 则返回带层级的树结构
|
|
2022
|
+
*/
|
|
2023
|
+
getFullData() {
|
|
2024
|
+
const $xeTable = this;
|
|
2025
|
+
const props = $xeTable;
|
|
2026
|
+
const internalData = $xeTable;
|
|
2027
|
+
const { treeConfig } = props;
|
|
2028
|
+
const { tableFullData, tableFullTreeData } = internalData;
|
|
2029
|
+
if (treeConfig) {
|
|
2030
|
+
const treeOpts = $xeTable.computeTreeOpts;
|
|
2031
|
+
const { transform, mapChildrenField } = treeOpts;
|
|
2032
|
+
const childrenField = treeOpts.children || treeOpts.childrenField;
|
|
2033
|
+
if (transform) {
|
|
2034
|
+
return XEUtils.toArrayTree(XEUtils.toTreeArray(tableFullTreeData, {
|
|
2035
|
+
children: mapChildrenField
|
|
2036
|
+
}), { children: childrenField });
|
|
2037
|
+
}
|
|
2038
|
+
return tableFullTreeData.slice(0);
|
|
2039
|
+
}
|
|
2040
|
+
return tableFullData.slice(0);
|
|
2041
|
+
},
|
|
2003
2042
|
/**
|
|
2004
2043
|
* 处理数据加载默认行为
|
|
2005
2044
|
* 默认执行一次,除非被重置
|
|
@@ -2197,7 +2236,10 @@ const Methods = {
|
|
|
2197
2236
|
return this.refreshColumn(true);
|
|
2198
2237
|
},
|
|
2199
2238
|
handleCustomRestore(storeData) {
|
|
2200
|
-
|
|
2239
|
+
const $xetable = this;
|
|
2240
|
+
const reactData = $xetable;
|
|
2241
|
+
const internalData = $xetable;
|
|
2242
|
+
let { collectColumn } = internalData;
|
|
2201
2243
|
const { resizableData, sortData, visibleData, fixedData } = storeData;
|
|
2202
2244
|
let hasCustomSort = false;
|
|
2203
2245
|
// 处理还原
|
|
@@ -2224,9 +2266,13 @@ const Methods = {
|
|
|
2224
2266
|
// 如果自定义了顺序
|
|
2225
2267
|
if (hasCustomSort) {
|
|
2226
2268
|
collectColumn = XEUtils.orderBy(collectColumn, 'renderSortNumber');
|
|
2227
|
-
|
|
2228
|
-
|
|
2269
|
+
internalData.collectColumn = collectColumn;
|
|
2270
|
+
internalData.tableFullColumn = getColumnList(collectColumn);
|
|
2229
2271
|
}
|
|
2272
|
+
reactData.isCustomStatus = true;
|
|
2273
|
+
}
|
|
2274
|
+
else {
|
|
2275
|
+
reactData.isCustomStatus = false;
|
|
2230
2276
|
}
|
|
2231
2277
|
},
|
|
2232
2278
|
/**
|
|
@@ -5012,11 +5058,13 @@ const Methods = {
|
|
|
5012
5058
|
const internalData = $xeTable;
|
|
5013
5059
|
const { treeConfig, dragConfig } = props;
|
|
5014
5060
|
const rowDragOpts = $xeTable.computeRowDragOpts;
|
|
5015
|
-
const {
|
|
5061
|
+
const { fullAllDataRowIdData } = internalData;
|
|
5062
|
+
const { isCrossDrag, isSelfToChildDrag, dragEndMethod } = rowDragOpts;
|
|
5016
5063
|
const treeOpts = $xeTable.computeTreeOpts;
|
|
5017
|
-
const { transform } = treeOpts;
|
|
5064
|
+
const { transform, mapChildrenField, parentField } = treeOpts;
|
|
5065
|
+
const childrenField = treeOpts.children || treeOpts.childrenField;
|
|
5018
5066
|
const { dragRow } = reactData;
|
|
5019
|
-
const { afterFullData,
|
|
5067
|
+
const { afterFullData, tableFullData, prevDragRow, prevDragPos } = internalData;
|
|
5020
5068
|
const dEndMethod = dragEndMethod || (dragConfig ? dragConfig.dragEndMethod : null);
|
|
5021
5069
|
const dragOffsetIndex = prevDragPos === 'bottom' ? 1 : 0;
|
|
5022
5070
|
if (prevDragRow && dragRow) {
|
|
@@ -5035,27 +5083,98 @@ const Methods = {
|
|
|
5035
5083
|
}
|
|
5036
5084
|
let oafIndex = -1;
|
|
5037
5085
|
let nafIndex = -1;
|
|
5086
|
+
// 如果为树结构
|
|
5038
5087
|
if (treeConfig) {
|
|
5039
|
-
|
|
5040
|
-
|
|
5041
|
-
|
|
5042
|
-
|
|
5043
|
-
|
|
5044
|
-
|
|
5045
|
-
|
|
5046
|
-
|
|
5047
|
-
|
|
5048
|
-
|
|
5049
|
-
|
|
5050
|
-
|
|
5088
|
+
if (transform) {
|
|
5089
|
+
// 移出源位置
|
|
5090
|
+
const oldRowid = getRowid($xeTable, dragRow);
|
|
5091
|
+
const oldRest = fullAllDataRowIdData[oldRowid];
|
|
5092
|
+
const newRowid = getRowid($xeTable, prevDragRow);
|
|
5093
|
+
const newRest = fullAllDataRowIdData[newRowid];
|
|
5094
|
+
if (oldRest && newRest) {
|
|
5095
|
+
const { level: oldLevel } = oldRest;
|
|
5096
|
+
const { level: newLevel } = newRest;
|
|
5097
|
+
const oldAllMaps = {};
|
|
5098
|
+
XEUtils.eachTree([dragRow], item => {
|
|
5099
|
+
oldAllMaps[getRowid($xeTable, item)] = item;
|
|
5100
|
+
}, { children: mapChildrenField });
|
|
5101
|
+
let isSelfToChildStatus = false;
|
|
5102
|
+
if (oldLevel && newLevel) {
|
|
5103
|
+
// 子到子
|
|
5104
|
+
if (!isCrossDrag) {
|
|
5105
|
+
return;
|
|
5106
|
+
}
|
|
5107
|
+
if (oldAllMaps[newRowid]) {
|
|
5108
|
+
if (!isSelfToChildDrag) {
|
|
5109
|
+
isSelfToChildStatus = true;
|
|
5110
|
+
if (VxeUI.modal) {
|
|
5111
|
+
VxeUI.modal.message({
|
|
5112
|
+
status: 'error',
|
|
5113
|
+
content: getI18n('vxe.error.treeDragChild')
|
|
5114
|
+
});
|
|
5115
|
+
}
|
|
5116
|
+
return;
|
|
5117
|
+
}
|
|
5118
|
+
}
|
|
5119
|
+
}
|
|
5120
|
+
else if (oldLevel) {
|
|
5121
|
+
// 子到根
|
|
5122
|
+
if (!isCrossDrag) {
|
|
5123
|
+
return;
|
|
5124
|
+
}
|
|
5125
|
+
}
|
|
5126
|
+
else if (newLevel) {
|
|
5127
|
+
// 根到子
|
|
5128
|
+
if (!isCrossDrag) {
|
|
5129
|
+
return;
|
|
5130
|
+
}
|
|
5131
|
+
if (oldAllMaps[newRowid]) {
|
|
5132
|
+
isSelfToChildStatus = true;
|
|
5133
|
+
if (!isSelfToChildDrag) {
|
|
5134
|
+
if (VxeUI.modal) {
|
|
5135
|
+
VxeUI.modal.message({
|
|
5136
|
+
status: 'error',
|
|
5137
|
+
content: getI18n('vxe.error.treeDragChild')
|
|
5138
|
+
});
|
|
5139
|
+
}
|
|
5140
|
+
return;
|
|
5141
|
+
}
|
|
5142
|
+
}
|
|
5143
|
+
}
|
|
5144
|
+
else {
|
|
5145
|
+
// 根到根
|
|
5146
|
+
}
|
|
5147
|
+
const fullList = XEUtils.toTreeArray(internalData.afterTreeFullData, { children: childrenField });
|
|
5148
|
+
// 移出
|
|
5149
|
+
const otfIndex = $xeTable.findRowIndexOf(fullList, dragRow);
|
|
5150
|
+
fullList.splice(otfIndex, 1);
|
|
5151
|
+
// 插入
|
|
5152
|
+
const ptfIndex = $xeTable.findRowIndexOf(fullList, prevDragRow);
|
|
5153
|
+
const ntfIndex = ptfIndex + dragOffsetIndex;
|
|
5154
|
+
fullList.splice(ntfIndex, 0, dragRow);
|
|
5155
|
+
// 改变层级
|
|
5156
|
+
if (isSelfToChildStatus && isSelfToChildDrag) {
|
|
5157
|
+
XEUtils.each(dragRow[childrenField], childRow => {
|
|
5158
|
+
childRow[parentField] = dragRow[parentField];
|
|
5159
|
+
});
|
|
5160
|
+
}
|
|
5161
|
+
dragRow[parentField] = prevDragRow[parentField];
|
|
5162
|
+
internalData.tableFullTreeData = XEUtils.toArrayTree(fullList, {
|
|
5163
|
+
key: treeOpts.rowField,
|
|
5164
|
+
parentKey: treeOpts.parentField,
|
|
5165
|
+
children: childrenField,
|
|
5166
|
+
mapChildren: treeOpts.mapChildrenField
|
|
5167
|
+
});
|
|
5168
|
+
}
|
|
5169
|
+
}
|
|
5051
5170
|
}
|
|
5052
5171
|
else {
|
|
5053
|
-
//
|
|
5172
|
+
// 移出
|
|
5054
5173
|
oafIndex = $xeTable.findRowIndexOf(afterFullData, dragRow);
|
|
5055
5174
|
const otfIndex = $xeTable.findRowIndexOf(tableFullData, dragRow);
|
|
5056
5175
|
afterFullData.splice(oafIndex, 1);
|
|
5057
5176
|
tableFullData.splice(otfIndex, 1);
|
|
5058
|
-
//
|
|
5177
|
+
// 插入
|
|
5059
5178
|
const pafIndex = $xeTable.findRowIndexOf(afterFullData, prevDragRow);
|
|
5060
5179
|
const ptfIndex = $xeTable.findRowIndexOf(tableFullData, prevDragRow);
|
|
5061
5180
|
nafIndex = pafIndex + dragOffsetIndex;
|
|
@@ -5064,9 +5183,9 @@ const Methods = {
|
|
|
5064
5183
|
tableFullData.splice(ntfIndex, 0, dragRow);
|
|
5065
5184
|
}
|
|
5066
5185
|
reactData.isDragRowMove = true;
|
|
5067
|
-
$xeTable.cacheRowMap();
|
|
5068
|
-
$xeTable.updateScrollYStatus();
|
|
5069
5186
|
$xeTable.handleTableData(treeConfig && transform);
|
|
5187
|
+
$xeTable.cacheRowMap(true);
|
|
5188
|
+
$xeTable.updateScrollYStatus();
|
|
5070
5189
|
if (!(treeConfig && transform)) {
|
|
5071
5190
|
$xeTable.updateAfterDataIndex();
|
|
5072
5191
|
}
|
|
@@ -5102,25 +5221,34 @@ const Methods = {
|
|
|
5102
5221
|
},
|
|
5103
5222
|
handleRowDragDragoverEvent(evnt) {
|
|
5104
5223
|
const $xeTable = this;
|
|
5224
|
+
const props = $xeTable;
|
|
5105
5225
|
const internalData = $xeTable;
|
|
5106
5226
|
const reactData = $xeTable;
|
|
5227
|
+
const { treeConfig } = props;
|
|
5228
|
+
const { fullAllDataRowIdData } = internalData;
|
|
5107
5229
|
const { dragRow } = reactData;
|
|
5230
|
+
const rowDragOpts = $xeTable.computeRowDragOpts;
|
|
5231
|
+
const { isCrossDrag } = rowDragOpts;
|
|
5108
5232
|
if (!dragRow) {
|
|
5109
5233
|
evnt.preventDefault();
|
|
5110
5234
|
return;
|
|
5111
5235
|
}
|
|
5112
5236
|
const trEl = evnt.currentTarget;
|
|
5113
|
-
const rowid = trEl.getAttribute('rowid');
|
|
5114
|
-
const
|
|
5115
|
-
if (
|
|
5116
|
-
|
|
5237
|
+
const rowid = trEl.getAttribute('rowid') || '';
|
|
5238
|
+
const rest = fullAllDataRowIdData[rowid];
|
|
5239
|
+
if (rest) {
|
|
5240
|
+
const row = rest.row;
|
|
5117
5241
|
evnt.preventDefault();
|
|
5118
5242
|
const { dragRow } = reactData;
|
|
5119
5243
|
const offsetY = evnt.clientY - trEl.getBoundingClientRect().y;
|
|
5120
5244
|
const dragPos = offsetY < trEl.clientHeight / 2 ? 'top' : 'bottom';
|
|
5245
|
+
if ($xeTable.eqRow(dragRow, row) || (!isCrossDrag && treeConfig && rest.level)) {
|
|
5246
|
+
showDropTip($xeTable, evnt, trEl, null, false, dragPos);
|
|
5247
|
+
return;
|
|
5248
|
+
}
|
|
5121
5249
|
internalData.prevDragRow = row;
|
|
5122
5250
|
internalData.prevDragPos = dragPos;
|
|
5123
|
-
showDropTip($xeTable, evnt, trEl, null, dragPos);
|
|
5251
|
+
showDropTip($xeTable, evnt, trEl, null, true, dragPos);
|
|
5124
5252
|
$xeTable.dispatchEvent('row-dragover', {
|
|
5125
5253
|
oldRow: dragRow,
|
|
5126
5254
|
targetRow: row,
|
|
@@ -5274,9 +5402,13 @@ const Methods = {
|
|
|
5274
5402
|
const { dragCol } = reactData;
|
|
5275
5403
|
const offsetX = evnt.clientX - thEl.getBoundingClientRect().x;
|
|
5276
5404
|
const dragPos = offsetX < thEl.clientWidth / 2 ? 'left' : 'right';
|
|
5405
|
+
if (dragCol.id === column.id || column.parentId) {
|
|
5406
|
+
showDropTip($xeTable, evnt, null, thEl, false, dragPos);
|
|
5407
|
+
return;
|
|
5408
|
+
}
|
|
5277
5409
|
internalData.prevDragCol = column;
|
|
5278
5410
|
internalData.prevDragPos = dragPos;
|
|
5279
|
-
showDropTip($xeTable, evnt, null, thEl, dragPos);
|
|
5411
|
+
showDropTip($xeTable, evnt, null, thEl, true, dragPos);
|
|
5280
5412
|
$xeTable.dispatchEvent('column-dragover', {
|
|
5281
5413
|
oldColumn: dragCol,
|
|
5282
5414
|
targetColumn: column,
|