vxe-table 4.12.0-beta.6 → 4.12.0-beta.8
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/grid/src/grid.js +4 -1
- package/es/style.css +1 -1
- package/es/table/src/body.js +11 -6
- package/es/table/src/footer.js +7 -2
- package/es/table/src/table.js +192 -74
- package/es/table/src/util.js +30 -3
- package/es/ui/index.js +1 -1
- package/es/ui/src/log.js +1 -1
- package/lib/grid/src/grid.js +4 -1
- package/lib/grid/src/grid.min.js +1 -1
- package/lib/index.umd.js +1109 -12140
- package/lib/index.umd.min.js +1 -1
- package/lib/style.css +1 -1
- package/lib/table/src/body.js +10 -5
- package/lib/table/src/body.min.js +1 -1
- package/lib/table/src/footer.js +7 -2
- package/lib/table/src/footer.min.js +1 -1
- package/lib/table/src/table.js +213 -77
- package/lib/table/src/table.min.js +1 -1
- package/lib/table/src/util.js +35 -6
- package/lib/table/src/util.min.js +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/package.json +2 -2
- package/packages/grid/src/grid.ts +4 -1
- package/packages/table/src/body.ts +10 -5
- package/packages/table/src/footer.ts +7 -2
- package/packages/table/src/table.ts +196 -75
- package/packages/table/src/util.ts +34 -3
- /package/es/{iconfont.1741224140308.ttf → iconfont.1741333670965.ttf} +0 -0
- /package/es/{iconfont.1741224140308.woff → iconfont.1741333670965.woff} +0 -0
- /package/es/{iconfont.1741224140308.woff2 → iconfont.1741333670965.woff2} +0 -0
- /package/lib/{iconfont.1741224140308.ttf → iconfont.1741333670965.ttf} +0 -0
- /package/lib/{iconfont.1741224140308.woff → iconfont.1741333670965.woff} +0 -0
- /package/lib/{iconfont.1741224140308.woff2 → iconfont.1741333670965.woff2} +0 -0
package/es/table/src/body.js
CHANGED
|
@@ -205,6 +205,7 @@ export default defineComponent({
|
|
|
205
205
|
tdOns.onDblclick = (evnt) => {
|
|
206
206
|
$xeTable.triggerCellDblclickEvent(evnt, cellParams);
|
|
207
207
|
};
|
|
208
|
+
let isMergeCell = false;
|
|
208
209
|
// 合并行或列
|
|
209
210
|
if (mergeList.length) {
|
|
210
211
|
const spanRest = mergeBodyMethod(mergeList, _rowIndex, _columnIndex);
|
|
@@ -214,9 +215,11 @@ export default defineComponent({
|
|
|
214
215
|
return null;
|
|
215
216
|
}
|
|
216
217
|
if (rowspan > 1) {
|
|
218
|
+
isMergeCell = true;
|
|
217
219
|
tdAttrs.rowspan = rowspan;
|
|
218
220
|
}
|
|
219
221
|
if (colspan > 1) {
|
|
222
|
+
isMergeCell = true;
|
|
220
223
|
tdAttrs.colspan = colspan;
|
|
221
224
|
}
|
|
222
225
|
}
|
|
@@ -249,12 +252,14 @@ export default defineComponent({
|
|
|
249
252
|
const isLastColumn = $columnIndex === columns.length - 1;
|
|
250
253
|
const isAutoCellWidth = !column.resizeWidth && (column.minWidth === 'auto' || column.width === 'auto');
|
|
251
254
|
let isVNPreEmptyStatus = false;
|
|
252
|
-
if (!
|
|
253
|
-
if (
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
255
|
+
if (!isMergeCell) {
|
|
256
|
+
if (!dragRow || getRowid($xeTable, dragRow) !== rowid) {
|
|
257
|
+
if (scrollYLoad && (_rowIndex < scrollYStore.visibleStartIndex - scrollYStore.preloadSize || _rowIndex > scrollYStore.visibleEndIndex + scrollYStore.preloadSize)) {
|
|
258
|
+
isVNPreEmptyStatus = true;
|
|
259
|
+
}
|
|
260
|
+
else if (scrollXLoad && !column.fixed && (_columnIndex < scrollXStore.visibleStartIndex - scrollXStore.preloadSize || _columnIndex > scrollXStore.visibleEndIndex + scrollXStore.preloadSize)) {
|
|
261
|
+
isVNPreEmptyStatus = true;
|
|
262
|
+
}
|
|
258
263
|
}
|
|
259
264
|
}
|
|
260
265
|
const tcStyle = {};
|
package/es/table/src/footer.js
CHANGED
|
@@ -126,6 +126,7 @@ export default defineComponent({
|
|
|
126
126
|
tfOns.onDblclick = (evnt) => {
|
|
127
127
|
$xeTable.dispatchEvent('footer-cell-dblclick', Object.assign({ cell: evnt.currentTarget }, cellParams), evnt);
|
|
128
128
|
};
|
|
129
|
+
let isMergeCell = false;
|
|
129
130
|
// 合并行或列
|
|
130
131
|
if (mergeFooterList.length) {
|
|
131
132
|
const spanRest = mergeFooterMethod(mergeFooterList, _rowIndex, _columnIndex);
|
|
@@ -135,9 +136,11 @@ export default defineComponent({
|
|
|
135
136
|
return null;
|
|
136
137
|
}
|
|
137
138
|
if (rowspan > 1) {
|
|
139
|
+
isMergeCell = true;
|
|
138
140
|
attrs.rowspan = rowspan;
|
|
139
141
|
}
|
|
140
142
|
if (colspan > 1) {
|
|
143
|
+
isMergeCell = true;
|
|
141
144
|
attrs.colspan = colspan;
|
|
142
145
|
}
|
|
143
146
|
}
|
|
@@ -158,8 +161,10 @@ export default defineComponent({
|
|
|
158
161
|
const isLastColumn = $columnIndex === tableColumn.length - 1;
|
|
159
162
|
const isAutoCellWidth = !column.resizeWidth && (column.minWidth === 'auto' || column.width === 'auto');
|
|
160
163
|
let isVNPreEmptyStatus = false;
|
|
161
|
-
if (
|
|
162
|
-
|
|
164
|
+
if (!isMergeCell) {
|
|
165
|
+
if (scrollXLoad && !column.fixed && (_columnIndex < scrollXStore.visibleStartIndex - scrollXStore.preloadSize || _columnIndex > scrollXStore.visibleEndIndex + scrollXStore.preloadSize)) {
|
|
166
|
+
isVNPreEmptyStatus = true;
|
|
167
|
+
}
|
|
163
168
|
}
|
|
164
169
|
const tcStyle = {};
|
|
165
170
|
if (hasEllipsis) {
|
package/es/table/src/table.js
CHANGED
|
@@ -9,7 +9,7 @@ import TableHeaderComponent from './header';
|
|
|
9
9
|
import TableFooterComponent from './footer';
|
|
10
10
|
import tableProps from './props';
|
|
11
11
|
import tableEmits from './emits';
|
|
12
|
-
import { getRowUniqueId, clearTableAllStatus, getRowkey, getRowid, rowToVisible, colToVisible, getCellValue, setCellValue, handleFieldOrColumn, toTreePathSeq, restoreScrollLocation, getRootColumn, getRefElem, getColReMinWidth } from './util';
|
|
12
|
+
import { getRowUniqueId, clearTableAllStatus, getRowkey, getRowid, rowToVisible, colToVisible, getCellValue, setCellValue, handleRowidOrRow, handleFieldOrColumn, toTreePathSeq, restoreScrollLocation, getRootColumn, getRefElem, getColReMinWidth, updateDeepRowKey, updateFastRowKey } from './util';
|
|
13
13
|
import { getSlotVNs } from '../../ui/src/vn';
|
|
14
14
|
import { warnLog, errLog } from '../../ui/src/log';
|
|
15
15
|
import TableCustomPanelComponent from '../module/custom/panel';
|
|
@@ -2238,6 +2238,7 @@ export default defineComponent({
|
|
|
2238
2238
|
const childrenField = treeOpts.children || treeOpts.childrenField;
|
|
2239
2239
|
const checkboxOpts = computeCheckboxOpts.value;
|
|
2240
2240
|
const { checkField, reserve, checkMethod } = checkboxOpts;
|
|
2241
|
+
// indeterminateField 仅支持读取
|
|
2241
2242
|
const indeterminateField = checkboxOpts.indeterminateField || checkboxOpts.halfField;
|
|
2242
2243
|
const selectRowMaps = {};
|
|
2243
2244
|
/**
|
|
@@ -2651,7 +2652,7 @@ export default defineComponent({
|
|
|
2651
2652
|
const { transform } = treeOpts;
|
|
2652
2653
|
const childrenField = treeOpts.children || treeOpts.childrenField;
|
|
2653
2654
|
let treeData = [];
|
|
2654
|
-
let fullData = reactive(datas ? datas.slice(0) : []); //
|
|
2655
|
+
let fullData = reactive(datas ? datas.slice(0) : []); // 转为响应式数据
|
|
2655
2656
|
if (treeConfig) {
|
|
2656
2657
|
if (transform) {
|
|
2657
2658
|
// 树结构自动转换
|
|
@@ -3438,6 +3439,9 @@ export default defineComponent({
|
|
|
3438
3439
|
};
|
|
3439
3440
|
tableMethods = {
|
|
3440
3441
|
dispatchEvent,
|
|
3442
|
+
getEl() {
|
|
3443
|
+
return refElem.value;
|
|
3444
|
+
},
|
|
3441
3445
|
/**
|
|
3442
3446
|
* 重置表格的一切数据状态
|
|
3443
3447
|
*/
|
|
@@ -3938,18 +3942,20 @@ export default defineComponent({
|
|
|
3938
3942
|
},
|
|
3939
3943
|
/**
|
|
3940
3944
|
* 检查行或列数据是否发生改变
|
|
3941
|
-
* @param {Row}
|
|
3945
|
+
* @param {Row} rowOrId 行对象、行主键
|
|
3942
3946
|
* @param {String} field 字段名
|
|
3943
3947
|
*/
|
|
3944
|
-
isUpdateByRow(
|
|
3948
|
+
isUpdateByRow(rowOrId, field) {
|
|
3945
3949
|
const { keepSource } = props;
|
|
3946
3950
|
const { tableFullColumn, fullDataRowIdData, sourceDataRowIdData } = internalData;
|
|
3947
3951
|
if (keepSource) {
|
|
3948
|
-
const rowid = getRowid($xeTable,
|
|
3952
|
+
const rowid = XEUtils.isString(rowOrId) || XEUtils.isNumber(rowOrId) ? rowOrId : getRowid($xeTable, rowOrId);
|
|
3953
|
+
const rowRest = fullDataRowIdData[rowid];
|
|
3949
3954
|
// 新增的数据不需要检测
|
|
3950
|
-
if (!
|
|
3955
|
+
if (!rowRest) {
|
|
3951
3956
|
return false;
|
|
3952
3957
|
}
|
|
3958
|
+
const row = rowRest.row;
|
|
3953
3959
|
const oRow = sourceDataRowIdData[rowid];
|
|
3954
3960
|
if (oRow) {
|
|
3955
3961
|
if (arguments.length > 1) {
|
|
@@ -4013,6 +4019,94 @@ export default defineComponent({
|
|
|
4013
4019
|
tableColumn: reactData.tableColumn.slice(0)
|
|
4014
4020
|
};
|
|
4015
4021
|
},
|
|
4022
|
+
/**
|
|
4023
|
+
* 移动列到指定列的位置
|
|
4024
|
+
* @param fieldOrColumn
|
|
4025
|
+
* @param targetFieldOrColumn
|
|
4026
|
+
* @param options
|
|
4027
|
+
*/
|
|
4028
|
+
moveColumnTo(fieldOrColumn, targetFieldOrColumn, options) {
|
|
4029
|
+
const { fullColumnIdData, visibleColumn } = internalData;
|
|
4030
|
+
const { dragToChild, dragPos, isCrossDrag } = Object.assign({}, options);
|
|
4031
|
+
const dragCol = handleFieldOrColumn($xeTable, fieldOrColumn);
|
|
4032
|
+
let prevDragCol = null;
|
|
4033
|
+
const colRest = dragCol ? fullColumnIdData[dragCol.id] : null;
|
|
4034
|
+
let defPos = 'left';
|
|
4035
|
+
if (XEUtils.isNumber(targetFieldOrColumn)) {
|
|
4036
|
+
if (colRest && targetFieldOrColumn) {
|
|
4037
|
+
let currList = colRest.items;
|
|
4038
|
+
let offsetIndex = colRest._index + targetFieldOrColumn;
|
|
4039
|
+
if (isCrossDrag) {
|
|
4040
|
+
currList = visibleColumn;
|
|
4041
|
+
offsetIndex = colRest._index + targetFieldOrColumn;
|
|
4042
|
+
}
|
|
4043
|
+
if (offsetIndex > 0 && offsetIndex < currList.length - 1) {
|
|
4044
|
+
prevDragCol = currList[offsetIndex];
|
|
4045
|
+
}
|
|
4046
|
+
if (targetFieldOrColumn > 0) {
|
|
4047
|
+
defPos = 'right';
|
|
4048
|
+
}
|
|
4049
|
+
}
|
|
4050
|
+
}
|
|
4051
|
+
else {
|
|
4052
|
+
prevDragCol = handleFieldOrColumn($xeTable, targetFieldOrColumn);
|
|
4053
|
+
const targetColRest = prevDragCol ? fullColumnIdData[prevDragCol.id] : null;
|
|
4054
|
+
if (colRest && targetColRest) {
|
|
4055
|
+
if (targetColRest._index > colRest._index) {
|
|
4056
|
+
defPos = 'right';
|
|
4057
|
+
}
|
|
4058
|
+
}
|
|
4059
|
+
}
|
|
4060
|
+
return $xeTable.handleColDragSwapEvent(null, true, dragCol, prevDragCol, dragPos || defPos, dragToChild === true);
|
|
4061
|
+
},
|
|
4062
|
+
/**
|
|
4063
|
+
* 移动行到指定行的位置
|
|
4064
|
+
* @param rowidOrRow
|
|
4065
|
+
* @param targetRowidOrRow
|
|
4066
|
+
* @param options
|
|
4067
|
+
*/
|
|
4068
|
+
moveRowTo(rowidOrRow, targetRowidOrRow, options) {
|
|
4069
|
+
const { treeConfig } = props;
|
|
4070
|
+
const { fullAllDataRowIdData, afterFullData } = internalData;
|
|
4071
|
+
const { dragToChild, dragPos, isCrossDrag } = Object.assign({}, options);
|
|
4072
|
+
const treeOpts = computeTreeOpts.value;
|
|
4073
|
+
const dragRow = handleRowidOrRow($xeTable, rowidOrRow);
|
|
4074
|
+
let prevDragRow = null;
|
|
4075
|
+
let defPos = 'top';
|
|
4076
|
+
const rowRest = dragRow ? fullAllDataRowIdData[getRowid($xeTable, dragRow)] : null;
|
|
4077
|
+
if (XEUtils.isNumber(targetRowidOrRow)) {
|
|
4078
|
+
if (rowRest && targetRowidOrRow) {
|
|
4079
|
+
let currList = afterFullData;
|
|
4080
|
+
let offsetIndex = rowRest._index + targetRowidOrRow;
|
|
4081
|
+
if (treeConfig) {
|
|
4082
|
+
currList = rowRest.items;
|
|
4083
|
+
if (treeOpts.transform) {
|
|
4084
|
+
offsetIndex = rowRest.treeIndex + targetRowidOrRow;
|
|
4085
|
+
if (isCrossDrag) {
|
|
4086
|
+
currList = afterFullData;
|
|
4087
|
+
offsetIndex = rowRest._index + targetRowidOrRow;
|
|
4088
|
+
}
|
|
4089
|
+
}
|
|
4090
|
+
}
|
|
4091
|
+
if (offsetIndex >= 0 && offsetIndex <= currList.length - 1) {
|
|
4092
|
+
prevDragRow = currList[offsetIndex];
|
|
4093
|
+
}
|
|
4094
|
+
if (targetRowidOrRow > 0) {
|
|
4095
|
+
defPos = 'bottom';
|
|
4096
|
+
}
|
|
4097
|
+
}
|
|
4098
|
+
}
|
|
4099
|
+
else {
|
|
4100
|
+
prevDragRow = handleRowidOrRow($xeTable, targetRowidOrRow);
|
|
4101
|
+
const targetRowRest = prevDragRow ? fullAllDataRowIdData[getRowid($xeTable, prevDragRow)] : null;
|
|
4102
|
+
if (rowRest && targetRowRest) {
|
|
4103
|
+
if (targetRowRest._index > rowRest._index) {
|
|
4104
|
+
defPos = 'bottom';
|
|
4105
|
+
}
|
|
4106
|
+
}
|
|
4107
|
+
}
|
|
4108
|
+
return $xeTable.handleRowDragSwapEvent(null, true, dragRow, prevDragRow, dragPos || defPos, dragToChild === true);
|
|
4109
|
+
},
|
|
4016
4110
|
/**
|
|
4017
4111
|
* 获取表格的全量列
|
|
4018
4112
|
*/
|
|
@@ -4032,6 +4126,7 @@ export default defineComponent({
|
|
|
4032
4126
|
*/
|
|
4033
4127
|
getCheckboxRecords(isFull) {
|
|
4034
4128
|
const { treeConfig } = props;
|
|
4129
|
+
const { selectCheckboxMaps } = reactData;
|
|
4035
4130
|
const { tableFullData, afterFullData, afterTreeFullData, tableFullTreeData, fullDataRowIdData, afterFullRowMaps } = internalData;
|
|
4036
4131
|
const treeOpts = computeTreeOpts.value;
|
|
4037
4132
|
const checkboxOpts = computeCheckboxOpts.value;
|
|
@@ -4039,17 +4134,17 @@ export default defineComponent({
|
|
|
4039
4134
|
const { checkField } = checkboxOpts;
|
|
4040
4135
|
const childrenField = treeOpts.children || treeOpts.childrenField;
|
|
4041
4136
|
let rowList = [];
|
|
4042
|
-
const currTableData = isFull ? (transform ? tableFullTreeData : tableFullData) : (transform ? afterTreeFullData : afterFullData);
|
|
4043
4137
|
if (checkField) {
|
|
4044
4138
|
if (treeConfig) {
|
|
4139
|
+
const currTableData = isFull ? (transform ? tableFullTreeData : tableFullData) : (transform ? afterTreeFullData : afterFullData);
|
|
4045
4140
|
rowList = XEUtils.filterTree(currTableData, row => XEUtils.get(row, checkField), { children: transform ? mapChildrenField : childrenField });
|
|
4046
4141
|
}
|
|
4047
4142
|
else {
|
|
4143
|
+
const currTableData = isFull ? tableFullData : afterFullData;
|
|
4048
4144
|
rowList = currTableData.filter((row) => XEUtils.get(row, checkField));
|
|
4049
4145
|
}
|
|
4050
4146
|
}
|
|
4051
4147
|
else {
|
|
4052
|
-
const { selectCheckboxMaps } = reactData;
|
|
4053
4148
|
XEUtils.each(selectCheckboxMaps, (row, rowid) => {
|
|
4054
4149
|
if (isFull) {
|
|
4055
4150
|
if (fullDataRowIdData[rowid]) {
|
|
@@ -4734,6 +4829,7 @@ export default defineComponent({
|
|
|
4734
4829
|
const childrenField = treeOpts.children || treeOpts.childrenField;
|
|
4735
4830
|
const checkboxOpts = computeCheckboxOpts.value;
|
|
4736
4831
|
const { checkField, reserve } = checkboxOpts;
|
|
4832
|
+
// indeterminateField 仅支持读取
|
|
4737
4833
|
const indeterminateField = checkboxOpts.indeterminateField || checkboxOpts.halfField;
|
|
4738
4834
|
if (checkField) {
|
|
4739
4835
|
const handleClearChecked = (item) => {
|
|
@@ -6750,32 +6846,19 @@ export default defineComponent({
|
|
|
6750
6846
|
const treeOpts = computeTreeOpts.value;
|
|
6751
6847
|
const childrenField = treeOpts.children || treeOpts.childrenField;
|
|
6752
6848
|
const hasChildField = treeOpts.hasChild || treeOpts.hasChildField;
|
|
6849
|
+
const { lazy } = treeOpts;
|
|
6753
6850
|
const rowkey = getRowkey($xeTable);
|
|
6851
|
+
const isDeepKey = rowkey.indexOf('.') > -1;
|
|
6754
6852
|
const fullAllDataRowIdMaps = Object.assign({}, fullAllDataRowIdData); // 存在已删除数据
|
|
6755
6853
|
const fullDataRowIdMaps = {};
|
|
6756
6854
|
const treeTempExpandedMaps = Object.assign({}, treeExpandedMaps);
|
|
6757
|
-
const
|
|
6758
|
-
|
|
6759
|
-
|
|
6760
|
-
const level = nodes ? nodes.length - 1 : 0;
|
|
6761
|
-
if (eqEmptyValue(rowid)) {
|
|
6762
|
-
rowid = getRowUniqueId();
|
|
6763
|
-
XEUtils.set(row, rowkey, rowid);
|
|
6764
|
-
}
|
|
6765
|
-
if (treeConfig && treeOpts.lazy) {
|
|
6766
|
-
const treeExpRest = treeExpandedMaps[rowid];
|
|
6767
|
-
if (row[hasChildField] && XEUtils.isUndefined(row[childrenField])) {
|
|
6768
|
-
row[childrenField] = null;
|
|
6769
|
-
}
|
|
6770
|
-
if (treeExpRest) {
|
|
6771
|
-
if (!row[childrenField] || !row[childrenField].length) {
|
|
6772
|
-
delete treeTempExpandedMaps[rowid];
|
|
6773
|
-
}
|
|
6774
|
-
}
|
|
6775
|
-
}
|
|
6776
|
-
let rowRest = fullAllDataRowIdData[rowid];
|
|
6855
|
+
const handleRowId = isDeepKey ? updateDeepRowKey : updateFastRowKey;
|
|
6856
|
+
const handleRowCache = (row, index, items, currIndex, parentRow, rowid, level, seq) => {
|
|
6857
|
+
let rowRest = fullAllDataRowIdMaps[rowid];
|
|
6777
6858
|
if (!rowRest) {
|
|
6778
6859
|
rowRest = { row, rowid, seq, index: -1, _index: -1, $index: -1, treeIndex: index, items, parent: parentRow, level, height: 0, resizeHeight: 0, oTop: 0, expandHeight: 0 };
|
|
6860
|
+
fullDataRowIdMaps[rowid] = rowRest;
|
|
6861
|
+
fullAllDataRowIdMaps[rowid] = rowRest;
|
|
6779
6862
|
}
|
|
6780
6863
|
rowRest.treeLoaded = false;
|
|
6781
6864
|
rowRest.expandLoaded = false;
|
|
@@ -6783,15 +6866,30 @@ export default defineComponent({
|
|
|
6783
6866
|
rowRest.items = items;
|
|
6784
6867
|
rowRest.parent = parentRow;
|
|
6785
6868
|
rowRest.level = level;
|
|
6786
|
-
rowRest.index =
|
|
6787
|
-
|
|
6788
|
-
fullAllDataRowIdMaps[rowid] = rowRest;
|
|
6869
|
+
rowRest.index = currIndex;
|
|
6870
|
+
rowRest.treeIndex = index;
|
|
6789
6871
|
};
|
|
6790
6872
|
if (treeConfig) {
|
|
6791
|
-
XEUtils.eachTree(tableFullTreeData,
|
|
6873
|
+
XEUtils.eachTree(tableFullTreeData, (row, index, items, path, parentRow, nodes) => {
|
|
6874
|
+
const rowid = handleRowId(row, rowkey);
|
|
6875
|
+
if (treeConfig && lazy) {
|
|
6876
|
+
const treeExpRest = treeTempExpandedMaps[rowid];
|
|
6877
|
+
if (row[hasChildField] && row[childrenField] === undefined) {
|
|
6878
|
+
row[childrenField] = null;
|
|
6879
|
+
}
|
|
6880
|
+
if (treeExpRest) {
|
|
6881
|
+
if (!row[childrenField] || !row[childrenField].length) {
|
|
6882
|
+
delete treeTempExpandedMaps[rowid];
|
|
6883
|
+
}
|
|
6884
|
+
}
|
|
6885
|
+
}
|
|
6886
|
+
handleRowCache(row, index, items, parentRow ? -1 : index, parentRow, rowid, nodes.length - 1, toTreePathSeq(path));
|
|
6887
|
+
}, { children: childrenField });
|
|
6792
6888
|
}
|
|
6793
6889
|
else {
|
|
6794
|
-
tableFullData.forEach(
|
|
6890
|
+
tableFullData.forEach((row, index, items) => {
|
|
6891
|
+
handleRowCache(row, index, items, index, null, handleRowId(row, rowkey), 0, index + 1);
|
|
6892
|
+
});
|
|
6795
6893
|
}
|
|
6796
6894
|
internalData.fullDataRowIdData = fullDataRowIdMaps;
|
|
6797
6895
|
internalData.fullAllDataRowIdData = fullAllDataRowIdMaps;
|
|
@@ -7450,6 +7548,7 @@ export default defineComponent({
|
|
|
7450
7548
|
const childrenField = treeOpts.children || treeOpts.childrenField;
|
|
7451
7549
|
const checkboxOpts = computeCheckboxOpts.value;
|
|
7452
7550
|
const { checkField, checkStrictly, checkMethod } = checkboxOpts;
|
|
7551
|
+
// indeterminateField 仅支持读取
|
|
7453
7552
|
const indeterminateField = checkboxOpts.indeterminateField || checkboxOpts.halfField;
|
|
7454
7553
|
if (checkField) {
|
|
7455
7554
|
// 树结构
|
|
@@ -8097,6 +8196,9 @@ export default defineComponent({
|
|
|
8097
8196
|
const { afterFullData, tableFullData } = internalData;
|
|
8098
8197
|
const dEndMethod = dragEndMethod || (dragConfig ? dragConfig.dragEndMethod : null);
|
|
8099
8198
|
const dragOffsetIndex = prevDragPos === 'bottom' ? 1 : 0;
|
|
8199
|
+
const errRest = {
|
|
8200
|
+
status: false
|
|
8201
|
+
};
|
|
8100
8202
|
if (prevDragRow && dragRow) {
|
|
8101
8203
|
// 判断是否有拖动
|
|
8102
8204
|
if (prevDragRow !== dragRow) {
|
|
@@ -8111,7 +8213,7 @@ export default defineComponent({
|
|
|
8111
8213
|
const isDragToChildFlag = isSelfToChildDrag && dragToChildMethod ? dragToChildMethod(dragParams) : prevDragToChild;
|
|
8112
8214
|
return Promise.resolve(dEndMethod ? dEndMethod(dragParams) : true).then((status) => {
|
|
8113
8215
|
if (!status) {
|
|
8114
|
-
return;
|
|
8216
|
+
return errRest;
|
|
8115
8217
|
}
|
|
8116
8218
|
let oafIndex = -1;
|
|
8117
8219
|
let nafIndex = -1;
|
|
@@ -8136,12 +8238,12 @@ export default defineComponent({
|
|
|
8136
8238
|
if (isPeerDrag && !isCrossDrag) {
|
|
8137
8239
|
if (oldRest.row[parentField] !== newRest.row[parentField]) {
|
|
8138
8240
|
// 非同级
|
|
8139
|
-
return;
|
|
8241
|
+
return errRest;
|
|
8140
8242
|
}
|
|
8141
8243
|
}
|
|
8142
8244
|
else {
|
|
8143
8245
|
if (!isCrossDrag) {
|
|
8144
|
-
return;
|
|
8246
|
+
return errRest;
|
|
8145
8247
|
}
|
|
8146
8248
|
if (oldAllMaps[newRowid]) {
|
|
8147
8249
|
isSelfToChildStatus = true;
|
|
@@ -8152,7 +8254,7 @@ export default defineComponent({
|
|
|
8152
8254
|
content: getI18n('vxe.error.treeDragChild')
|
|
8153
8255
|
});
|
|
8154
8256
|
}
|
|
8155
|
-
return;
|
|
8257
|
+
return errRest;
|
|
8156
8258
|
}
|
|
8157
8259
|
}
|
|
8158
8260
|
}
|
|
@@ -8160,13 +8262,13 @@ export default defineComponent({
|
|
|
8160
8262
|
else if (oldLevel) {
|
|
8161
8263
|
// 子到根
|
|
8162
8264
|
if (!isCrossDrag) {
|
|
8163
|
-
return;
|
|
8265
|
+
return errRest;
|
|
8164
8266
|
}
|
|
8165
8267
|
}
|
|
8166
8268
|
else if (newLevel) {
|
|
8167
8269
|
// 根到子
|
|
8168
8270
|
if (!isCrossDrag) {
|
|
8169
|
-
return;
|
|
8271
|
+
return errRest;
|
|
8170
8272
|
}
|
|
8171
8273
|
if (oldAllMaps[newRowid]) {
|
|
8172
8274
|
isSelfToChildStatus = true;
|
|
@@ -8177,7 +8279,7 @@ export default defineComponent({
|
|
|
8177
8279
|
content: getI18n('vxe.error.treeDragChild')
|
|
8178
8280
|
});
|
|
8179
8281
|
}
|
|
8180
|
-
return;
|
|
8282
|
+
return errRest;
|
|
8181
8283
|
}
|
|
8182
8284
|
}
|
|
8183
8285
|
}
|
|
@@ -8237,27 +8339,34 @@ export default defineComponent({
|
|
|
8237
8339
|
if (reactData.scrollYLoad) {
|
|
8238
8340
|
$xeTable.updateScrollYSpace();
|
|
8239
8341
|
}
|
|
8240
|
-
|
|
8342
|
+
if (evnt) {
|
|
8343
|
+
dispatchEvent('row-dragend', {
|
|
8344
|
+
oldRow: dragRow,
|
|
8345
|
+
newRow: prevDragRow,
|
|
8346
|
+
dragRow,
|
|
8347
|
+
dragPos: prevDragPos,
|
|
8348
|
+
dragToChild: isDragToChildFlag,
|
|
8349
|
+
offsetIndex: dragOffsetIndex,
|
|
8350
|
+
_index: {
|
|
8351
|
+
newIndex: nafIndex,
|
|
8352
|
+
oldIndex: oafIndex
|
|
8353
|
+
}
|
|
8354
|
+
}, evnt);
|
|
8355
|
+
}
|
|
8356
|
+
return nextTick().then(() => {
|
|
8241
8357
|
$xeTable.updateCellAreas();
|
|
8242
8358
|
$xeTable.recalculate();
|
|
8359
|
+
}).then(() => {
|
|
8360
|
+
return {
|
|
8361
|
+
status: true
|
|
8362
|
+
};
|
|
8243
8363
|
});
|
|
8244
|
-
dispatchEvent('row-dragend', {
|
|
8245
|
-
oldRow: dragRow,
|
|
8246
|
-
newRow: prevDragRow,
|
|
8247
|
-
dragRow,
|
|
8248
|
-
dragPos: prevDragPos,
|
|
8249
|
-
dragToChild: isDragToChildFlag,
|
|
8250
|
-
offsetIndex: dragOffsetIndex,
|
|
8251
|
-
_index: {
|
|
8252
|
-
newIndex: nafIndex,
|
|
8253
|
-
oldIndex: oafIndex
|
|
8254
|
-
}
|
|
8255
|
-
}, evnt);
|
|
8256
8364
|
}).catch(() => {
|
|
8365
|
+
return errRest;
|
|
8257
8366
|
});
|
|
8258
8367
|
}
|
|
8259
8368
|
}
|
|
8260
|
-
return Promise.resolve();
|
|
8369
|
+
return Promise.resolve(errRest);
|
|
8261
8370
|
},
|
|
8262
8371
|
handleRowDragDragendEvent(evnt) {
|
|
8263
8372
|
const { treeConfig } = props;
|
|
@@ -8384,6 +8493,9 @@ export default defineComponent({
|
|
|
8384
8493
|
const { isPeerDrag, isCrossDrag, isSelfToChildDrag, isToChildDrag, dragEndMethod, dragToChildMethod } = columnDragOpts;
|
|
8385
8494
|
const { collectColumn } = internalData;
|
|
8386
8495
|
const dragOffsetIndex = prevDragPos === 'right' ? 1 : 0;
|
|
8496
|
+
const errRest = {
|
|
8497
|
+
status: false
|
|
8498
|
+
};
|
|
8387
8499
|
if (prevDragCol && dragCol) {
|
|
8388
8500
|
// 判断是否有拖动
|
|
8389
8501
|
if (prevDragCol !== dragCol) {
|
|
@@ -8400,7 +8512,7 @@ export default defineComponent({
|
|
|
8400
8512
|
const isDragToChildFlag = isSelfToChildDrag && dragToChildMethod ? dragToChildMethod(dragParams) : prevDragToChild;
|
|
8401
8513
|
return Promise.resolve(dragEndMethod ? dragEndMethod(dragParams) : true).then((status) => {
|
|
8402
8514
|
if (!status) {
|
|
8403
|
-
return;
|
|
8515
|
+
return errRest;
|
|
8404
8516
|
}
|
|
8405
8517
|
let oafIndex = -1;
|
|
8406
8518
|
let nafIndex = -1;
|
|
@@ -8414,12 +8526,12 @@ export default defineComponent({
|
|
|
8414
8526
|
if (isPeerDrag && !isCrossDrag) {
|
|
8415
8527
|
if (dragColumn.parentId !== newColumn.parentId) {
|
|
8416
8528
|
// 非同级
|
|
8417
|
-
return;
|
|
8529
|
+
return errRest;
|
|
8418
8530
|
}
|
|
8419
8531
|
}
|
|
8420
8532
|
else {
|
|
8421
8533
|
if (!isCrossDrag) {
|
|
8422
|
-
return;
|
|
8534
|
+
return errRest;
|
|
8423
8535
|
}
|
|
8424
8536
|
if (oldAllMaps[newColumn.id]) {
|
|
8425
8537
|
isSelfToChildStatus = true;
|
|
@@ -8430,7 +8542,7 @@ export default defineComponent({
|
|
|
8430
8542
|
content: getI18n('vxe.error.treeDragChild')
|
|
8431
8543
|
});
|
|
8432
8544
|
}
|
|
8433
|
-
return;
|
|
8545
|
+
return errRest;
|
|
8434
8546
|
}
|
|
8435
8547
|
}
|
|
8436
8548
|
}
|
|
@@ -8438,13 +8550,13 @@ export default defineComponent({
|
|
|
8438
8550
|
else if (dragColumn.parentId) {
|
|
8439
8551
|
// 子到根
|
|
8440
8552
|
if (!isCrossDrag) {
|
|
8441
|
-
return;
|
|
8553
|
+
return errRest;
|
|
8442
8554
|
}
|
|
8443
8555
|
}
|
|
8444
8556
|
else if (newColumn.parentId) {
|
|
8445
8557
|
// 根到子
|
|
8446
8558
|
if (!isCrossDrag) {
|
|
8447
|
-
return;
|
|
8559
|
+
return errRest;
|
|
8448
8560
|
}
|
|
8449
8561
|
if (oldAllMaps[newColumn.id]) {
|
|
8450
8562
|
isSelfToChildStatus = true;
|
|
@@ -8455,7 +8567,7 @@ export default defineComponent({
|
|
|
8455
8567
|
content: getI18n('vxe.error.treeDragChild')
|
|
8456
8568
|
});
|
|
8457
8569
|
}
|
|
8458
|
-
return;
|
|
8570
|
+
return errRest;
|
|
8459
8571
|
}
|
|
8460
8572
|
}
|
|
8461
8573
|
}
|
|
@@ -8516,26 +8628,32 @@ export default defineComponent({
|
|
|
8516
8628
|
$xeTable.clearCopyCellArea();
|
|
8517
8629
|
}
|
|
8518
8630
|
}
|
|
8519
|
-
|
|
8520
|
-
|
|
8521
|
-
|
|
8522
|
-
|
|
8523
|
-
|
|
8524
|
-
|
|
8525
|
-
|
|
8526
|
-
|
|
8527
|
-
|
|
8528
|
-
|
|
8529
|
-
|
|
8530
|
-
|
|
8631
|
+
if (evnt) {
|
|
8632
|
+
dispatchEvent('column-dragend', {
|
|
8633
|
+
oldColumn: dragColumn,
|
|
8634
|
+
newColumn,
|
|
8635
|
+
dragColumn,
|
|
8636
|
+
dragPos: prevDragPos,
|
|
8637
|
+
dragToChild: isDragToChildFlag,
|
|
8638
|
+
offsetIndex: dragOffsetIndex,
|
|
8639
|
+
_index: {
|
|
8640
|
+
newIndex: nafIndex,
|
|
8641
|
+
oldIndex: oafIndex
|
|
8642
|
+
}
|
|
8643
|
+
}, evnt);
|
|
8644
|
+
}
|
|
8531
8645
|
if (isSyncColumn) {
|
|
8532
8646
|
$xeTable.handleColDragSwapColumn();
|
|
8533
8647
|
}
|
|
8648
|
+
return {
|
|
8649
|
+
status: true
|
|
8650
|
+
};
|
|
8534
8651
|
}).catch(() => {
|
|
8652
|
+
return errRest;
|
|
8535
8653
|
});
|
|
8536
8654
|
}
|
|
8537
8655
|
}
|
|
8538
|
-
return Promise.resolve();
|
|
8656
|
+
return Promise.resolve(errRest);
|
|
8539
8657
|
},
|
|
8540
8658
|
handleHeaderCellDragDragendEvent(evnt) {
|
|
8541
8659
|
const { dragCol } = reactData;
|
package/es/table/src/util.js
CHANGED
|
@@ -2,6 +2,7 @@ import { watch, reactive } from 'vue';
|
|
|
2
2
|
import XEUtils from 'xe-utils';
|
|
3
3
|
import { ColumnInfo } from './columnInfo';
|
|
4
4
|
import { isPx, isScale } from '../../ui/src/dom';
|
|
5
|
+
import { eqEmptyValue } from '../../ui/src/utils';
|
|
5
6
|
const getAllConvertColumns = (columns, parentColumn) => {
|
|
6
7
|
const result = [];
|
|
7
8
|
columns.forEach((column) => {
|
|
@@ -90,14 +91,33 @@ export function getRowUniqueId() {
|
|
|
90
91
|
export function getRowkey($xeTable) {
|
|
91
92
|
const { props } = $xeTable;
|
|
92
93
|
const { computeRowOpts } = $xeTable.getComputeMaps();
|
|
93
|
-
const { rowId } = props;
|
|
94
94
|
const rowOpts = computeRowOpts.value;
|
|
95
|
-
return rowId || rowOpts.keyField || '_X_ROW_KEY'
|
|
95
|
+
return `${props.rowId || rowOpts.keyField || '_X_ROW_KEY'}`;
|
|
96
96
|
}
|
|
97
97
|
// 行主键 value
|
|
98
98
|
export function getRowid($xeTable, row) {
|
|
99
99
|
const rowid = XEUtils.get(row, getRowkey($xeTable));
|
|
100
|
-
return
|
|
100
|
+
return encodeRowid(rowid);
|
|
101
|
+
}
|
|
102
|
+
// 编码行主键
|
|
103
|
+
export function encodeRowid(rowVal) {
|
|
104
|
+
return XEUtils.eqNull(rowVal) ? '' : encodeURIComponent(rowVal);
|
|
105
|
+
}
|
|
106
|
+
export function updateDeepRowKey(row, rowkey) {
|
|
107
|
+
let rowid = XEUtils.get(row, rowkey);
|
|
108
|
+
if (eqEmptyValue(rowid)) {
|
|
109
|
+
rowid = getRowUniqueId();
|
|
110
|
+
XEUtils.set(row, rowkey, rowid);
|
|
111
|
+
}
|
|
112
|
+
return rowid;
|
|
113
|
+
}
|
|
114
|
+
export function updateFastRowKey(row, rowkey) {
|
|
115
|
+
let rowid = row[rowkey];
|
|
116
|
+
if (eqEmptyValue(rowid)) {
|
|
117
|
+
rowid = getRowUniqueId();
|
|
118
|
+
row[rowkey] = rowid;
|
|
119
|
+
}
|
|
120
|
+
return rowid;
|
|
101
121
|
}
|
|
102
122
|
export const handleFieldOrColumn = ($xeTable, fieldOrColumn) => {
|
|
103
123
|
if (fieldOrColumn) {
|
|
@@ -105,6 +125,13 @@ export const handleFieldOrColumn = ($xeTable, fieldOrColumn) => {
|
|
|
105
125
|
}
|
|
106
126
|
return null;
|
|
107
127
|
};
|
|
128
|
+
export const handleRowidOrRow = ($xeTable, rowidOrRow) => {
|
|
129
|
+
if (rowidOrRow) {
|
|
130
|
+
const rowid = XEUtils.isString(rowidOrRow) || XEUtils.isNumber(rowidOrRow) ? rowidOrRow : getRowid($xeTable, rowidOrRow);
|
|
131
|
+
return $xeTable.getRowById(rowid);
|
|
132
|
+
}
|
|
133
|
+
return null;
|
|
134
|
+
};
|
|
108
135
|
function getPaddingLeftRightSize(elem) {
|
|
109
136
|
if (elem) {
|
|
110
137
|
const computedStyle = getComputedStyle(elem);
|
package/es/ui/index.js
CHANGED
package/es/ui/src/log.js
CHANGED