vxe-table 4.19.1 → 4.19.3
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/all.esm.js +31932 -0
- package/dist/style.css +1 -0
- package/dist/style.min.css +1 -0
- package/es/index.css +1 -1
- package/es/index.min.css +1 -1
- package/es/locale/lang/ar-EG.js +6 -2
- package/es/locale/lang/de-DE.js +6 -2
- package/es/locale/lang/en-US.js +6 -2
- package/es/locale/lang/es-ES.js +6 -2
- package/es/locale/lang/fr-FR.js +6 -2
- package/es/locale/lang/hu-HU.js +6 -2
- package/es/locale/lang/hy-AM.js +6 -2
- package/es/locale/lang/id-ID.js +6 -2
- package/es/locale/lang/it-IT.js +6 -2
- package/es/locale/lang/ja-JP.js +6 -2
- package/es/locale/lang/ko-KR.js +6 -2
- package/es/locale/lang/ms-MY.js +6 -2
- package/es/locale/lang/nb-NO.js +6 -2
- package/es/locale/lang/pt-BR.js +6 -2
- package/es/locale/lang/ru-RU.js +6 -2
- package/es/locale/lang/th-TH.js +6 -2
- package/es/locale/lang/ug-CN.js +6 -2
- package/es/locale/lang/uk-UA.js +6 -2
- package/es/locale/lang/uz-UZ.js +6 -2
- package/es/locale/lang/vi-VN.js +6 -2
- package/es/locale/lang/zh-CHT.js +6 -2
- package/es/locale/lang/zh-CN.js +6 -2
- package/es/style.css +1 -1
- package/es/style.min.css +1 -1
- package/es/table/module/custom/panel.js +29 -22
- package/es/table/module/export/export-panel.js +27 -16
- package/es/table/module/export/hook.js +120 -27
- package/es/table/module/validator/hook.js +2 -2
- package/es/table/src/cell.js +1 -1
- package/es/table/src/column.js +2 -0
- package/es/table/src/columnInfo.js +1 -0
- package/es/table/src/table.js +94 -31
- package/es/table/src/util.js +3 -1
- package/es/table/style.css +1 -1
- package/es/table/style.min.css +1 -1
- package/es/ui/index.js +1 -1
- package/es/ui/src/log.js +1 -1
- package/es/vxe-table/style.css +1 -1
- package/es/vxe-table/style.min.css +1 -1
- package/lib/index.css +1 -1
- package/lib/index.min.css +1 -1
- package/lib/index.umd.js +213 -75
- package/lib/index.umd.min.js +1 -1
- package/lib/locale/lang/ar-EG.js +6 -2
- package/lib/locale/lang/ar-EG.min.js +1 -1
- package/lib/locale/lang/ar-EG.umd.js +6 -2
- package/lib/locale/lang/de-DE.js +6 -2
- package/lib/locale/lang/de-DE.min.js +1 -1
- package/lib/locale/lang/de-DE.umd.js +6 -2
- package/lib/locale/lang/en-US.js +6 -2
- package/lib/locale/lang/en-US.min.js +1 -1
- package/lib/locale/lang/en-US.umd.js +6 -2
- package/lib/locale/lang/es-ES.js +6 -2
- package/lib/locale/lang/es-ES.min.js +1 -1
- package/lib/locale/lang/es-ES.umd.js +6 -2
- package/lib/locale/lang/fr-FR.js +6 -2
- package/lib/locale/lang/fr-FR.min.js +1 -1
- package/lib/locale/lang/fr-FR.umd.js +6 -2
- package/lib/locale/lang/hu-HU.js +6 -2
- package/lib/locale/lang/hu-HU.min.js +1 -1
- package/lib/locale/lang/hu-HU.umd.js +6 -2
- package/lib/locale/lang/hy-AM.js +6 -2
- package/lib/locale/lang/hy-AM.min.js +1 -1
- package/lib/locale/lang/hy-AM.umd.js +6 -2
- package/lib/locale/lang/id-ID.js +6 -2
- package/lib/locale/lang/id-ID.min.js +1 -1
- package/lib/locale/lang/id-ID.umd.js +6 -2
- package/lib/locale/lang/it-IT.js +6 -2
- package/lib/locale/lang/it-IT.min.js +1 -1
- package/lib/locale/lang/it-IT.umd.js +6 -2
- package/lib/locale/lang/ja-JP.js +6 -2
- package/lib/locale/lang/ja-JP.min.js +1 -1
- package/lib/locale/lang/ja-JP.umd.js +6 -2
- package/lib/locale/lang/ko-KR.js +6 -2
- package/lib/locale/lang/ko-KR.min.js +1 -1
- package/lib/locale/lang/ko-KR.umd.js +6 -2
- package/lib/locale/lang/ms-MY.js +6 -2
- package/lib/locale/lang/ms-MY.min.js +1 -1
- package/lib/locale/lang/ms-MY.umd.js +6 -2
- package/lib/locale/lang/nb-NO.js +6 -2
- package/lib/locale/lang/nb-NO.min.js +1 -1
- package/lib/locale/lang/nb-NO.umd.js +6 -2
- package/lib/locale/lang/pt-BR.js +6 -2
- package/lib/locale/lang/pt-BR.min.js +1 -1
- package/lib/locale/lang/pt-BR.umd.js +6 -2
- package/lib/locale/lang/ru-RU.js +6 -2
- package/lib/locale/lang/ru-RU.min.js +1 -1
- package/lib/locale/lang/ru-RU.umd.js +6 -2
- package/lib/locale/lang/th-TH.js +6 -2
- package/lib/locale/lang/th-TH.min.js +1 -1
- package/lib/locale/lang/th-TH.umd.js +6 -2
- package/lib/locale/lang/ug-CN.js +6 -2
- package/lib/locale/lang/ug-CN.min.js +1 -1
- package/lib/locale/lang/ug-CN.umd.js +6 -2
- package/lib/locale/lang/uk-UA.js +6 -2
- package/lib/locale/lang/uk-UA.min.js +1 -1
- package/lib/locale/lang/uk-UA.umd.js +6 -2
- package/lib/locale/lang/uz-UZ.js +6 -2
- package/lib/locale/lang/uz-UZ.min.js +1 -1
- package/lib/locale/lang/uz-UZ.umd.js +6 -2
- package/lib/locale/lang/vi-VN.js +6 -2
- package/lib/locale/lang/vi-VN.min.js +1 -1
- package/lib/locale/lang/vi-VN.umd.js +6 -2
- package/lib/locale/lang/zh-CHT.js +6 -2
- package/lib/locale/lang/zh-CHT.min.js +1 -1
- package/lib/locale/lang/zh-CHT.umd.js +6 -2
- package/lib/locale/lang/zh-CN.js +6 -2
- package/lib/locale/lang/zh-CN.min.js +1 -1
- package/lib/locale/lang/zh-CN.umd.js +6 -2
- package/lib/style.css +1 -1
- package/lib/style.min.css +1 -1
- package/lib/table/module/custom/panel.js +30 -21
- package/lib/table/module/custom/panel.min.js +1 -1
- package/lib/table/module/export/export-panel.js +22 -13
- package/lib/table/module/export/export-panel.min.js +1 -1
- package/lib/table/module/export/hook.js +139 -28
- package/lib/table/module/export/hook.min.js +1 -1
- package/lib/table/module/validator/hook.js +2 -2
- package/lib/table/module/validator/hook.min.js +1 -1
- package/lib/table/src/cell.js +1 -1
- package/lib/table/src/cell.min.js +1 -1
- package/lib/table/src/column.js +2 -0
- 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/table.js +5 -5
- package/lib/table/src/table.min.js +1 -1
- package/lib/table/src/util.js +3 -1
- package/lib/table/src/util.min.js +1 -1
- package/lib/table/style/style.css +1 -1
- package/lib/table/style/style.min.css +1 -1
- package/lib/ui/index.js +1 -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 +1 -1
- package/lib/vxe-table/style/style.min.css +1 -1
- package/package.json +5 -2
- package/packages/locale/lang/ar-EG.ts +6 -2
- package/packages/locale/lang/de-DE.ts +6 -2
- package/packages/locale/lang/en-US.ts +6 -2
- package/packages/locale/lang/es-ES.ts +6 -2
- package/packages/locale/lang/fr-FR.ts +6 -2
- package/packages/locale/lang/hu-HU.ts +6 -2
- package/packages/locale/lang/hy-AM.ts +6 -2
- package/packages/locale/lang/id-ID.ts +6 -2
- package/packages/locale/lang/it-IT.ts +6 -2
- package/packages/locale/lang/ja-JP.ts +6 -2
- package/packages/locale/lang/ko-KR.ts +6 -2
- package/packages/locale/lang/ms-MY.ts +6 -2
- package/packages/locale/lang/nb-NO.ts +6 -2
- package/packages/locale/lang/pt-BR.ts +6 -2
- package/packages/locale/lang/ru-RU.ts +6 -2
- package/packages/locale/lang/th-TH.ts +6 -2
- package/packages/locale/lang/ug-CN.ts +6 -2
- package/packages/locale/lang/uk-UA.ts +6 -2
- package/packages/locale/lang/uz-UZ.ts +6 -2
- package/packages/locale/lang/vi-VN.ts +6 -2
- package/packages/locale/lang/zh-CHT.ts +6 -2
- package/packages/locale/lang/zh-CN.ts +6 -2
- package/packages/table/module/custom/panel.ts +30 -23
- package/packages/table/module/export/export-panel.ts +27 -16
- package/packages/table/module/export/hook.ts +121 -28
- package/packages/table/module/validator/hook.ts +2 -2
- package/packages/table/src/cell.ts +1 -1
- package/packages/table/src/column.ts +2 -0
- package/packages/table/src/columnInfo.ts +1 -0
- package/packages/table/src/table.ts +96 -31
- package/packages/table/src/util.ts +3 -1
- package/styles/components/table-module/export.scss +1 -1
- /package/es/{iconfont.1779447258442.ttf → iconfont.1779843543280.ttf} +0 -0
- /package/es/{iconfont.1779447258442.woff → iconfont.1779843543280.woff} +0 -0
- /package/es/{iconfont.1779447258442.woff2 → iconfont.1779843543280.woff2} +0 -0
- /package/lib/{iconfont.1779447258442.ttf → iconfont.1779843543280.ttf} +0 -0
- /package/lib/{iconfont.1779447258442.woff → iconfont.1779843543280.woff} +0 -0
- /package/lib/{iconfont.1779447258442.woff2 → iconfont.1779843543280.woff2} +0 -0
|
@@ -322,7 +322,7 @@ export default defineVxeComponent({
|
|
|
322
322
|
const { immediate } = customOpts;
|
|
323
323
|
const trEl = evnt.currentTarget;
|
|
324
324
|
const columnDragOpts = computeColumnDragOpts.value;
|
|
325
|
-
const { isCrossDrag, isSelfToChildDrag, isToChildDrag, dragEndMethod } = columnDragOpts;
|
|
325
|
+
const { isCrossDrag, isPeerDrag, isSelfToChildDrag, isToChildDrag, dragEndMethod } = columnDragOpts;
|
|
326
326
|
const { dragCol } = customPanelReactData;
|
|
327
327
|
const { prevDragCol, prevDragGroupField, prevDragAggFnColid, prevDragPos, prevDragToChild } = customPanelInternalData;
|
|
328
328
|
const dragOffsetIndex = prevDragPos === 'bottom' ? 1 : 0;
|
|
@@ -360,20 +360,28 @@ export default defineVxeComponent({
|
|
|
360
360
|
if (immediate) {
|
|
361
361
|
if (dragColumn.parentId && newColumn.parentId) {
|
|
362
362
|
// 子到子
|
|
363
|
-
if (!isCrossDrag) {
|
|
364
|
-
|
|
363
|
+
if (isPeerDrag && !isCrossDrag) {
|
|
364
|
+
if (dragColumn.parentId !== newColumn.parentId) {
|
|
365
|
+
// 非同级
|
|
366
|
+
return;
|
|
367
|
+
}
|
|
365
368
|
}
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
if (!(isCrossDrag && isSelfToChildDrag)) {
|
|
369
|
-
if (VxeUI.modal) {
|
|
370
|
-
VxeUI.modal.message({
|
|
371
|
-
status: 'error',
|
|
372
|
-
content: getI18n('vxe.error.treeDragChild')
|
|
373
|
-
});
|
|
374
|
-
}
|
|
369
|
+
else {
|
|
370
|
+
if (!isCrossDrag) {
|
|
375
371
|
return;
|
|
376
372
|
}
|
|
373
|
+
if (oldAllMaps[newColumn.id]) {
|
|
374
|
+
isSelfToChildStatus = true;
|
|
375
|
+
if (!(isCrossDrag && isSelfToChildDrag)) {
|
|
376
|
+
if (VxeUI.modal) {
|
|
377
|
+
VxeUI.modal.message({
|
|
378
|
+
status: 'error',
|
|
379
|
+
content: getI18n('vxe.error.treeDragChild')
|
|
380
|
+
});
|
|
381
|
+
}
|
|
382
|
+
return;
|
|
383
|
+
}
|
|
384
|
+
}
|
|
377
385
|
}
|
|
378
386
|
}
|
|
379
387
|
else if (dragColumn.parentId) {
|
|
@@ -500,7 +508,7 @@ export default defineVxeComponent({
|
|
|
500
508
|
const customOpts = computeCustomOpts.value;
|
|
501
509
|
const { showSortDragButton, allowSort, immediate } = customOpts;
|
|
502
510
|
const columnDragOpts = computeColumnDragOpts.value;
|
|
503
|
-
const { isCrossDrag, isToChildDrag } = columnDragOpts;
|
|
511
|
+
const { isCrossDrag, isPeerDrag, isToChildDrag } = columnDragOpts;
|
|
504
512
|
const optEl = evnt.currentTarget;
|
|
505
513
|
const isControlKey = hasControlKey(evnt);
|
|
506
514
|
const colid = optEl.getAttribute('colid');
|
|
@@ -509,16 +517,16 @@ export default defineVxeComponent({
|
|
|
509
517
|
customPanelInternalData.prevDragGroupField = null;
|
|
510
518
|
customPanelInternalData.prevDragAggFnColid = null;
|
|
511
519
|
// 是否移入有效列
|
|
512
|
-
if (column && (isCrossDrag || column.level === 1)) {
|
|
520
|
+
if (column && (isCrossDrag || isPeerDrag || column.level === 1)) {
|
|
513
521
|
evnt.preventDefault();
|
|
514
522
|
const offsetY = evnt.clientY - optEl.getBoundingClientRect().y;
|
|
515
523
|
const dragPos = offsetY < optEl.clientHeight / 2 ? 'top' : 'bottom';
|
|
516
524
|
if (!dragCol ||
|
|
517
525
|
!(showSortDragButton && allowSort) ||
|
|
518
526
|
(dragCol && dragCol.id === column.id) ||
|
|
519
|
-
(!isCrossDrag && column.level > 1) ||
|
|
527
|
+
(!isCrossDrag && (isPeerDrag ? dragCol.parentId !== column.parentId : column.level > 1)) ||
|
|
520
528
|
(!immediate && column.level > 1) ||
|
|
521
|
-
(!isCrossDrag && dragCol.level > 1) ||
|
|
529
|
+
(!isCrossDrag && (isPeerDrag ? dragCol.parentId !== column.parentId : dragCol.level > 1)) ||
|
|
522
530
|
(!immediate && dragCol.level > 1)) {
|
|
523
531
|
showDropTip(evnt, optEl, false, dragPos);
|
|
524
532
|
return;
|
|
@@ -648,13 +656,12 @@ export default defineVxeComponent({
|
|
|
648
656
|
const { treeConfig, rowGroupConfig, aggregateConfig } = tableProps;
|
|
649
657
|
const { isCustomStatus, customColumnList, isCustomDragStatus } = tableReactData;
|
|
650
658
|
const customOpts = computeCustomOpts.value;
|
|
651
|
-
const { immediate } = customOpts;
|
|
652
659
|
const columnDragOpts = computeColumnDragOpts.value;
|
|
653
660
|
const { popupStyle } = customStore;
|
|
654
|
-
const { checkMethod, visibleMethod, allowVisible, allowSort, allowFixed, allowGroup, allowValues, trigger, placement, showSortDragButton, showSortMoveButton, showSortPutButton } = customOpts;
|
|
661
|
+
const { immediate, checkMethod, visibleMethod, allowVisible, allowSort, allowFixed, allowGroup, allowValues, trigger, placement, showSortDragButton, showSortMoveButton, showSortPutButton } = customOpts;
|
|
655
662
|
const isMaxFixedColumn = computeIsMaxFixedColumn.value;
|
|
656
663
|
const vSize = computeSize.value;
|
|
657
|
-
const { isCrossDrag } = columnDragOpts;
|
|
664
|
+
const { isCrossDrag, isPeerDrag } = columnDragOpts;
|
|
658
665
|
const slots = customOpts.slots || {};
|
|
659
666
|
const headerSlot = slots.header;
|
|
660
667
|
const topSlot = slots.top;
|
|
@@ -688,7 +695,7 @@ export default defineVxeComponent({
|
|
|
688
695
|
const colTitle = formatText(column.getTitle(), 1);
|
|
689
696
|
const isDisabled = checkMethod ? !checkMethod({ $table: $xeTable, column }) : false;
|
|
690
697
|
const isHidden = !isChecked;
|
|
691
|
-
const showSortBtn = (
|
|
698
|
+
const showSortBtn = (isCrossDrag || isPeerDrag ? immediate : false) || column.level === 1;
|
|
692
699
|
colVNs.push(h('li', {
|
|
693
700
|
key: column.id,
|
|
694
701
|
colid: column.id,
|
|
@@ -984,7 +991,7 @@ export default defineVxeComponent({
|
|
|
984
991
|
const modalOpts = Object.assign({}, modalOptions);
|
|
985
992
|
const drawerOpts = Object.assign({}, drawerOptions);
|
|
986
993
|
const isMaxFixedColumn = computeIsMaxFixedColumn.value;
|
|
987
|
-
const { isCrossDrag } = columnDragOpts;
|
|
994
|
+
const { isCrossDrag, isPeerDrag } = columnDragOpts;
|
|
988
995
|
const slots = customOpts.slots || {};
|
|
989
996
|
const headerSlot = slots.header;
|
|
990
997
|
const topSlot = slots.top;
|
|
@@ -1031,7 +1038,7 @@ export default defineVxeComponent({
|
|
|
1031
1038
|
const isColGroup = column.children && column.children.length;
|
|
1032
1039
|
const isDisabled = checkMethod ? !checkMethod({ $table: $xeTable, column }) : false;
|
|
1033
1040
|
const isHidden = !isChecked;
|
|
1034
|
-
const showSortBtn = (
|
|
1041
|
+
const showSortBtn = (isCrossDrag || isPeerDrag ? immediate : false) || column.level === 1;
|
|
1035
1042
|
trVNs.push(h('tr', {
|
|
1036
1043
|
key: column.id,
|
|
1037
1044
|
colid: column.id,
|
|
@@ -150,7 +150,7 @@ export default defineVxeComponent({
|
|
|
150
150
|
const $xeGantt = $xeTable.xeGantt;
|
|
151
151
|
const { defaultOptions, storeData } = props;
|
|
152
152
|
const { isAll: isAllChecked, isIndeterminate: isAllIndeterminate } = reactData;
|
|
153
|
-
const { hasTree, hasMerge, isPrint, hasColgroup, columns } = storeData;
|
|
153
|
+
const { hasTree, hasRowGroup, hasMerge, isPrint, hasColgroup, columns } = storeData;
|
|
154
154
|
const { isHeader } = defaultOptions;
|
|
155
155
|
const colVNs = [];
|
|
156
156
|
const checkedAll = computeCheckedAll.value;
|
|
@@ -380,6 +380,17 @@ export default defineVxeComponent({
|
|
|
380
380
|
}
|
|
381
381
|
})
|
|
382
382
|
: renderEmptyElement($xeTable),
|
|
383
|
+
VxeUICheckboxComponent
|
|
384
|
+
? h(VxeUICheckboxComponent, {
|
|
385
|
+
modelValue: defaultOptions.isFooter,
|
|
386
|
+
disabled: !storeData.hasFooter,
|
|
387
|
+
title: getI18n('vxe.export.expFooterTitle'),
|
|
388
|
+
content: getI18n('vxe.export.expOptFooter'),
|
|
389
|
+
'onUpdate:modelValue'(value) {
|
|
390
|
+
defaultOptions.isFooter = value;
|
|
391
|
+
}
|
|
392
|
+
})
|
|
393
|
+
: renderEmptyElement($xeTable),
|
|
383
394
|
VxeUICheckboxComponent
|
|
384
395
|
? h(VxeUICheckboxComponent, {
|
|
385
396
|
modelValue: isHeader ? defaultOptions.isTitle : false,
|
|
@@ -438,30 +449,30 @@ export default defineVxeComponent({
|
|
|
438
449
|
'onUpdate:modelValue'(value) {
|
|
439
450
|
defaultOptions.useStyle = value;
|
|
440
451
|
}
|
|
441
|
-
})
|
|
452
|
+
})
|
|
453
|
+
]),
|
|
454
|
+
h('div', {
|
|
455
|
+
class: 'vxe-table-export--panel-option-row'
|
|
456
|
+
}, [
|
|
442
457
|
VxeUICheckboxComponent
|
|
443
458
|
? h(VxeUICheckboxComponent, {
|
|
444
|
-
modelValue: hasTree ? defaultOptions.
|
|
459
|
+
modelValue: hasTree ? defaultOptions.isTreeAllExpanded : false,
|
|
445
460
|
disabled: hasEmptyData || !hasTree,
|
|
446
|
-
title: getI18n('vxe.export.
|
|
447
|
-
content: getI18n('vxe.export.
|
|
461
|
+
title: getI18n('vxe.export.expTreeAllExpandTitle'),
|
|
462
|
+
content: getI18n('vxe.export.expOptTreeAllExpand'),
|
|
448
463
|
'onUpdate:modelValue'(value) {
|
|
449
|
-
defaultOptions.
|
|
464
|
+
defaultOptions.isTreeAllExpanded = value;
|
|
450
465
|
}
|
|
451
466
|
})
|
|
452
|
-
: renderEmptyElement($xeTable)
|
|
453
|
-
]),
|
|
454
|
-
h('div', {
|
|
455
|
-
class: 'vxe-table-export--panel-option-row'
|
|
456
|
-
}, [
|
|
467
|
+
: renderEmptyElement($xeTable),
|
|
457
468
|
VxeUICheckboxComponent
|
|
458
469
|
? h(VxeUICheckboxComponent, {
|
|
459
|
-
modelValue: defaultOptions.
|
|
460
|
-
disabled: !
|
|
461
|
-
title: getI18n('vxe.export.
|
|
462
|
-
content: getI18n('vxe.export.
|
|
470
|
+
modelValue: hasRowGroup ? defaultOptions.isRowGroupAllExpanded : false,
|
|
471
|
+
disabled: hasEmptyData || !hasRowGroup,
|
|
472
|
+
title: getI18n('vxe.export.expRowGroupAllExpandTitle'),
|
|
473
|
+
content: getI18n('vxe.export.expOptRowGroupAllExpand'),
|
|
463
474
|
'onUpdate:modelValue'(value) {
|
|
464
|
-
defaultOptions.
|
|
475
|
+
defaultOptions.isRowGroupAllExpanded = value;
|
|
465
476
|
}
|
|
466
477
|
})
|
|
467
478
|
: renderEmptyElement($xeTable)
|
|
@@ -256,12 +256,7 @@ const tableExportMethodKeys = ['exportData', 'importByFile', 'importData', 'save
|
|
|
256
256
|
hooks.add('tableExportModule', {
|
|
257
257
|
setupTable($xeTable) {
|
|
258
258
|
const { props, reactData, internalData } = $xeTable;
|
|
259
|
-
const { computeTreeOpts, computePrintOpts, computeExportOpts, computeImportOpts, computeCustomOpts, computeSeqOpts, computeRadioOpts, computeCheckboxOpts, computeColumnOpts } = $xeTable.getComputeMaps();
|
|
260
|
-
const hasTreeChildren = (row) => {
|
|
261
|
-
const treeOpts = computeTreeOpts.value;
|
|
262
|
-
const childrenField = treeOpts.children || treeOpts.childrenField;
|
|
263
|
-
return row[childrenField] && row[childrenField].length;
|
|
264
|
-
};
|
|
259
|
+
const { computeTreeOpts, computePrintOpts, computeExportOpts, computeImportOpts, computeCustomOpts, computeSeqOpts, computeRadioOpts, computeCheckboxOpts, computeColumnOpts, computeAggregateOpts } = $xeTable.getComputeMaps();
|
|
265
260
|
const getSeq = (cellValue, row, $rowIndex, column, $columnIndex) => {
|
|
266
261
|
const seqOpts = computeSeqOpts.value;
|
|
267
262
|
const seqMd = seqOpts.seqMethod || column.seqMethod;
|
|
@@ -292,32 +287,119 @@ hooks.add('tableExportModule', {
|
|
|
292
287
|
return eqEmptyValue(cellValue) ? '' : `${cellValue}`;
|
|
293
288
|
};
|
|
294
289
|
const getBodyLabelData = (opts, columns, datas) => {
|
|
295
|
-
const {
|
|
290
|
+
const { isTreeAllExpanded, isRowGroupAllExpanded, mode } = opts;
|
|
296
291
|
const { treeConfig } = props;
|
|
292
|
+
const { isRowGroupStatus } = reactData;
|
|
297
293
|
const radioOpts = computeRadioOpts.value;
|
|
298
294
|
const checkboxOpts = computeCheckboxOpts.value;
|
|
299
295
|
const treeOpts = computeTreeOpts.value;
|
|
300
296
|
const columnOpts = computeColumnOpts.value;
|
|
297
|
+
const aggregateOpts = computeAggregateOpts.value;
|
|
301
298
|
if (!htmlCellElem) {
|
|
302
299
|
htmlCellElem = document.createElement('div');
|
|
303
300
|
}
|
|
301
|
+
const { handleGetRowId } = createHandleGetRowId($xeTable);
|
|
302
|
+
if (isRowGroupStatus) {
|
|
303
|
+
// 如果是数据分组
|
|
304
|
+
const { mapChildrenField } = aggregateOpts;
|
|
305
|
+
const rest = [];
|
|
306
|
+
const expandMaps = {};
|
|
307
|
+
const useMaps = {};
|
|
308
|
+
XEUtils.eachTree(datas, (item, $rowIndex, items, path, parentItem, nodes) => {
|
|
309
|
+
const row = item._row || item;
|
|
310
|
+
const rowid = handleGetRowId(row);
|
|
311
|
+
if (useMaps[rowid]) {
|
|
312
|
+
return;
|
|
313
|
+
}
|
|
314
|
+
const parentRow = parentItem && parentItem._row ? parentItem._row : parentItem;
|
|
315
|
+
const pRowid = parentRow ? handleGetRowId(parentRow) : '';
|
|
316
|
+
if ((isRowGroupAllExpanded || !parentRow || (expandMaps[pRowid] && $xeTable.isRowExpandByRow(parentRow)))) {
|
|
317
|
+
const hasRowChild = mapChildrenField && row[mapChildrenField] && row[mapChildrenField].length;
|
|
318
|
+
const item = {
|
|
319
|
+
_row: row,
|
|
320
|
+
_level: nodes.length - 1,
|
|
321
|
+
_hasChild: hasRowChild,
|
|
322
|
+
_expand: hasRowChild && $xeTable.isRowExpandByRow(row)
|
|
323
|
+
};
|
|
324
|
+
columns.forEach((column, $columnIndex) => {
|
|
325
|
+
let cellValue = '';
|
|
326
|
+
const renderOpts = column.editRender || column.cellRender;
|
|
327
|
+
let bodyExportMethod = column.exportMethod || columnOpts.exportMethod;
|
|
328
|
+
if (!bodyExportMethod && renderOpts && renderOpts.name) {
|
|
329
|
+
const compConf = renderer.get(renderOpts.name);
|
|
330
|
+
if (compConf) {
|
|
331
|
+
bodyExportMethod = compConf.tableExportMethod || compConf.exportMethod;
|
|
332
|
+
}
|
|
333
|
+
}
|
|
334
|
+
if (!bodyExportMethod) {
|
|
335
|
+
bodyExportMethod = columnOpts.exportMethod;
|
|
336
|
+
}
|
|
337
|
+
if (bodyExportMethod) {
|
|
338
|
+
cellValue = bodyExportMethod({ $table: $xeTable, row, column, options: opts });
|
|
339
|
+
}
|
|
340
|
+
else {
|
|
341
|
+
switch (column.type) {
|
|
342
|
+
case 'seq': {
|
|
343
|
+
const seqVal = path.map((num, i) => i % 2 === 0 ? (Number(num) + 1) : '.').join('');
|
|
344
|
+
cellValue = mode === 'all' ? seqVal : getSeq(seqVal, row, $rowIndex, column, $columnIndex);
|
|
345
|
+
break;
|
|
346
|
+
}
|
|
347
|
+
case 'checkbox':
|
|
348
|
+
cellValue = toBooleanValue($xeTable.isCheckedByCheckboxRow(row));
|
|
349
|
+
item._checkboxLabel = checkboxOpts.labelField ? XEUtils.get(row, checkboxOpts.labelField) : '';
|
|
350
|
+
item._checkboxDisabled = checkboxOpts.checkMethod && !checkboxOpts.checkMethod({ $table: $xeTable, row });
|
|
351
|
+
break;
|
|
352
|
+
case 'radio':
|
|
353
|
+
cellValue = toBooleanValue($xeTable.isCheckedByRadioRow(row));
|
|
354
|
+
item._radioLabel = radioOpts.labelField ? XEUtils.get(row, radioOpts.labelField) : '';
|
|
355
|
+
item._radioDisabled = radioOpts.checkMethod && !radioOpts.checkMethod({ $table: $xeTable, row });
|
|
356
|
+
break;
|
|
357
|
+
default:
|
|
358
|
+
if (opts.original) {
|
|
359
|
+
cellValue = getCellValue(row, column);
|
|
360
|
+
}
|
|
361
|
+
else {
|
|
362
|
+
cellValue = $xeTable.getCellLabel(row, column);
|
|
363
|
+
if (column.type === 'html') {
|
|
364
|
+
htmlCellElem.innerHTML = cellValue;
|
|
365
|
+
cellValue = htmlCellElem.innerText.trim();
|
|
366
|
+
}
|
|
367
|
+
else {
|
|
368
|
+
const cell = $xeTable.getCellElement(row, column);
|
|
369
|
+
if (cell && !hasClass(cell, 'is--progress')) {
|
|
370
|
+
cellValue = cell.innerText.trim();
|
|
371
|
+
}
|
|
372
|
+
}
|
|
373
|
+
}
|
|
374
|
+
}
|
|
375
|
+
}
|
|
376
|
+
item[column.id] = toStringValue(cellValue);
|
|
377
|
+
});
|
|
378
|
+
useMaps[rowid] = true;
|
|
379
|
+
if (pRowid) {
|
|
380
|
+
expandMaps[pRowid] = true;
|
|
381
|
+
}
|
|
382
|
+
rest.push(Object.assign(item, row));
|
|
383
|
+
}
|
|
384
|
+
}, { children: mapChildrenField });
|
|
385
|
+
return rest;
|
|
386
|
+
}
|
|
304
387
|
if (treeConfig) {
|
|
388
|
+
// 如果是树结构
|
|
305
389
|
const childrenField = treeOpts.children || treeOpts.childrenField;
|
|
306
|
-
// 如果是树表格只允许导出数据源
|
|
307
390
|
const rest = [];
|
|
308
391
|
const expandMaps = {};
|
|
309
392
|
const useMaps = {};
|
|
310
|
-
|
|
311
|
-
XEUtils.eachTree(datas, (item, $rowIndex, items, path, parent, nodes) => {
|
|
393
|
+
XEUtils.eachTree(datas, (item, $rowIndex, items, path, parentItem, nodes) => {
|
|
312
394
|
const row = item._row || item;
|
|
313
395
|
const rowid = handleGetRowId(row);
|
|
314
396
|
if (useMaps[rowid]) {
|
|
315
397
|
return;
|
|
316
398
|
}
|
|
317
|
-
const parentRow =
|
|
399
|
+
const parentRow = parentItem && parentItem._row ? parentItem._row : parentItem;
|
|
318
400
|
const pRowid = parentRow ? handleGetRowId(parentRow) : '';
|
|
319
|
-
if ((
|
|
320
|
-
const hasRowChild =
|
|
401
|
+
if ((isTreeAllExpanded || !parentRow || (expandMaps[pRowid] && $xeTable.isTreeExpandByRow(parentRow)))) {
|
|
402
|
+
const hasRowChild = row[childrenField] && row[childrenField].length;
|
|
321
403
|
const item = {
|
|
322
404
|
_row: row,
|
|
323
405
|
_level: nodes.length - 1,
|
|
@@ -972,10 +1054,11 @@ hooks.add('tableExportModule', {
|
|
|
972
1054
|
const $xeGantt = $xeTable.xeGantt;
|
|
973
1055
|
const $xeGGWrapper = $xeGrid || $xeGantt;
|
|
974
1056
|
const { treeConfig, showHeader, showFooter } = props;
|
|
975
|
-
const { initStore, isGroup, footerTableData, exportStore, exportParams } = reactData;
|
|
1057
|
+
const { initStore, isGroup, rowGroupList, footerTableData, exportStore, exportParams } = reactData;
|
|
976
1058
|
const { collectColumn, mergeBodyList, mergeFooterList } = internalData;
|
|
977
1059
|
const exportOpts = computeExportOpts.value;
|
|
978
|
-
const hasTree = treeConfig;
|
|
1060
|
+
const hasTree = !!treeConfig;
|
|
1061
|
+
const hasRowGroup = rowGroupList.length > 0;
|
|
979
1062
|
const customOpts = computeCustomOpts.value;
|
|
980
1063
|
const selectRecords = $xeTable.getCheckboxRecords();
|
|
981
1064
|
const proxyOpts = $xeGGWrapper ? $xeGGWrapper.getComputeMaps().computeProxyOpts.value : {};
|
|
@@ -992,6 +1075,11 @@ hooks.add('tableExportModule', {
|
|
|
992
1075
|
current: 'current',
|
|
993
1076
|
modes: (proxyOpts.ajax && proxyOpts.ajax.queryAll ? ['all'] : []).concat(['current', 'selected', 'empty'])
|
|
994
1077
|
}, options);
|
|
1078
|
+
// 已废弃,参数 isAllExpand
|
|
1079
|
+
if (XEUtils.isBoolean(defOpts.isAllExpand)) {
|
|
1080
|
+
warnLog('vxe.error.delProp', ['isAllExpand', 'isTreeAllExpanded']);
|
|
1081
|
+
defOpts.isTreeAllExpanded = defOpts.isAllExpand;
|
|
1082
|
+
}
|
|
995
1083
|
const types = defOpts.types || XEUtils.keys(exportOpts._typeMaps);
|
|
996
1084
|
const modes = defOpts.modes || [];
|
|
997
1085
|
const checkMethod = customOpts.checkMethod;
|
|
@@ -1034,17 +1122,16 @@ hooks.add('tableExportModule', {
|
|
|
1034
1122
|
column.disabled = (parent && parent.disabled) || (checkMethod ? !checkMethod({ $table: $xeTable, column }) : false);
|
|
1035
1123
|
});
|
|
1036
1124
|
// 更新条件
|
|
1037
|
-
|
|
1038
|
-
|
|
1039
|
-
|
|
1040
|
-
|
|
1041
|
-
|
|
1042
|
-
|
|
1043
|
-
|
|
1044
|
-
|
|
1045
|
-
|
|
1046
|
-
|
|
1047
|
-
});
|
|
1125
|
+
exportStore.columns = exportColumns;
|
|
1126
|
+
exportStore.typeList = typeList;
|
|
1127
|
+
exportStore.modeList = modeList;
|
|
1128
|
+
exportStore.hasFooter = hasFooter;
|
|
1129
|
+
exportStore.hasMerge = hasMerge;
|
|
1130
|
+
exportStore.hasTree = hasTree;
|
|
1131
|
+
exportStore.hasRowGroup = hasRowGroup;
|
|
1132
|
+
exportStore.isPrint = !!isPrint;
|
|
1133
|
+
exportStore.hasColgroup = isGroup;
|
|
1134
|
+
exportStore.visible = true;
|
|
1048
1135
|
// 默认参数
|
|
1049
1136
|
Object.assign(exportParams, {
|
|
1050
1137
|
mode: selectRecords.length ? 'selected' : 'current'
|
|
@@ -1124,7 +1211,8 @@ hooks.add('tableExportModule', {
|
|
|
1124
1211
|
// filename: '',
|
|
1125
1212
|
// sheetName: '',
|
|
1126
1213
|
// original: false,
|
|
1127
|
-
//
|
|
1214
|
+
// isTreeAllExpanded: false,
|
|
1215
|
+
// isRowGroupAllExpanded: false,
|
|
1128
1216
|
// data: null,
|
|
1129
1217
|
// remote: false,
|
|
1130
1218
|
// dataFilterMethod: null,
|
|
@@ -1134,6 +1222,11 @@ hooks.add('tableExportModule', {
|
|
|
1134
1222
|
// beforeExportMethod: null,
|
|
1135
1223
|
// afterExportMethod: null
|
|
1136
1224
|
}, exportOpts, options);
|
|
1225
|
+
// 已废弃,参数 isAllExpand
|
|
1226
|
+
if (XEUtils.isBoolean(opts.isAllExpand)) {
|
|
1227
|
+
warnLog('vxe.error.delProp', ['isAllExpand', 'isTreeAllExpanded']);
|
|
1228
|
+
opts.isTreeAllExpanded = opts.isAllExpand;
|
|
1229
|
+
}
|
|
1137
1230
|
let { filename, sheetName, type, mode, columns, original, columnFilterMethod, beforeExportMethod, includeFields, excludeFields } = opts;
|
|
1138
1231
|
let groups = [];
|
|
1139
1232
|
const selectRecords = $xeTable.getCheckboxRecords();
|
|
@@ -440,7 +440,7 @@ hooks.add('tableValidatorModule', {
|
|
|
440
440
|
const errorRules = [];
|
|
441
441
|
const syncValidList = [];
|
|
442
442
|
if (field && editRules) {
|
|
443
|
-
const rules = XEUtils.get(editRules, field);
|
|
443
|
+
const rules = column.rules ? column.rules : XEUtils.get(editRules, field);
|
|
444
444
|
if (rules) {
|
|
445
445
|
const cellValue = XEUtils.isUndefined(val) ? XEUtils.get(row, field) : val;
|
|
446
446
|
rules.forEach((rule) => {
|
|
@@ -514,7 +514,7 @@ hooks.add('tableValidatorModule', {
|
|
|
514
514
|
const { editRules } = props;
|
|
515
515
|
const { field } = column;
|
|
516
516
|
if (field && editRules) {
|
|
517
|
-
const rules = XEUtils.get(editRules, field);
|
|
517
|
+
const rules = column.rules ? column.rules : XEUtils.get(editRules, field);
|
|
518
518
|
return rules && !!XEUtils.find(rules, rule => type === 'all' || !rule.trigger || type === rule.trigger);
|
|
519
519
|
}
|
|
520
520
|
return false;
|
package/es/table/src/cell.js
CHANGED
|
@@ -1089,7 +1089,7 @@ export const Cell = {
|
|
|
1089
1089
|
const editRenderOpts = isEnableEdit && isEnableConf(editRender) ? editRender : null;
|
|
1090
1090
|
let isRequired = false;
|
|
1091
1091
|
if (editRules) {
|
|
1092
|
-
const columnRules = XEUtils.get(editRules, column.field);
|
|
1092
|
+
const columnRules = column.rules ? column.rules : XEUtils.get(editRules, column.field);
|
|
1093
1093
|
if (columnRules) {
|
|
1094
1094
|
isRequired = columnRules.some((rule) => rule.required);
|
|
1095
1095
|
}
|
package/es/table/src/column.js
CHANGED
|
@@ -101,6 +101,7 @@ export class ColumnInfo {
|
|
|
101
101
|
filterRecoverMethod: _vm.filterRecoverMethod,
|
|
102
102
|
filterRender: filterRender,
|
|
103
103
|
floatingFilters: _vm.floatingFilters,
|
|
104
|
+
rules: _vm.rules,
|
|
104
105
|
rowGroupNode: _vm.rowGroupNode,
|
|
105
106
|
treeNode: _vm.treeNode,
|
|
106
107
|
dragSort: _vm.dragSort,
|