vxe-table 4.11.17 → 4.11.19
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/render/index.js +88 -57
- package/es/table/src/body.js +11 -6
- package/es/table/src/footer.js +7 -2
- package/es/table/src/table.js +188 -67
- package/es/table/src/util.js +13 -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 +335 -143
- package/lib/index.umd.min.js +1 -1
- package/lib/style.css +1 -1
- package/lib/table/render/index.js +96 -62
- package/lib/table/render/index.min.js +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 +203 -66
- package/lib/table/src/table.min.js +1 -1
- package/lib/table/src/util.js +16 -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/render/index.ts +87 -55
- package/packages/table/src/body.ts +10 -5
- package/packages/table/src/footer.ts +7 -2
- package/packages/table/src/table.ts +187 -67
- package/packages/table/src/util.ts +15 -3
- /package/es/{iconfont.1741140593243.ttf → iconfont.1741333398347.ttf} +0 -0
- /package/es/{iconfont.1741140593243.woff → iconfont.1741333398347.woff} +0 -0
- /package/es/{iconfont.1741140593243.woff2 → iconfont.1741333398347.woff2} +0 -0
- /package/lib/{iconfont.1741140593243.ttf → iconfont.1741333398347.ttf} +0 -0
- /package/lib/{iconfont.1741140593243.woff → iconfont.1741333398347.woff} +0 -0
- /package/lib/{iconfont.1741140593243.woff2 → iconfont.1741333398347.woff2} +0 -0
|
@@ -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 } 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'
|
|
@@ -2846,7 +2846,7 @@ export default defineComponent({
|
|
|
2846
2846
|
// warnLog('vxe.error.reqProp', ['table.show-overflow'])
|
|
2847
2847
|
// }
|
|
2848
2848
|
if (props.spanMethod) {
|
|
2849
|
-
|
|
2849
|
+
errLog('vxe.error.scrollErrProp', ['table.span-method'])
|
|
2850
2850
|
}
|
|
2851
2851
|
}
|
|
2852
2852
|
|
|
@@ -3524,6 +3524,9 @@ export default defineComponent({
|
|
|
3524
3524
|
|
|
3525
3525
|
tableMethods = {
|
|
3526
3526
|
dispatchEvent,
|
|
3527
|
+
getEl () {
|
|
3528
|
+
return refElem.value
|
|
3529
|
+
},
|
|
3527
3530
|
/**
|
|
3528
3531
|
* 重置表格的一切数据状态
|
|
3529
3532
|
*/
|
|
@@ -3841,12 +3844,12 @@ export default defineComponent({
|
|
|
3841
3844
|
*/
|
|
3842
3845
|
revertData (rows: any, field) {
|
|
3843
3846
|
const { keepSource, treeConfig } = props
|
|
3844
|
-
const { fullAllDataRowIdData, tableSourceData, sourceDataRowIdData, tableFullData, afterFullData } = internalData
|
|
3847
|
+
const { fullAllDataRowIdData, fullDataRowIdData, tableSourceData, sourceDataRowIdData, tableFullData, afterFullData } = internalData
|
|
3845
3848
|
const treeOpts = computeTreeOpts.value
|
|
3846
3849
|
const { transform } = treeOpts
|
|
3847
3850
|
if (!keepSource) {
|
|
3848
3851
|
if (process.env.VUE_APP_VXE_ENV === 'development') {
|
|
3849
|
-
|
|
3852
|
+
errLog('vxe.error.reqProp', ['keep-source'])
|
|
3850
3853
|
}
|
|
3851
3854
|
return nextTick()
|
|
3852
3855
|
}
|
|
@@ -3860,22 +3863,22 @@ export default defineComponent({
|
|
|
3860
3863
|
}
|
|
3861
3864
|
let reDelFlag = false
|
|
3862
3865
|
if (targetRows.length) {
|
|
3863
|
-
targetRows.forEach((
|
|
3864
|
-
|
|
3865
|
-
|
|
3866
|
-
|
|
3867
|
-
|
|
3868
|
-
|
|
3869
|
-
|
|
3870
|
-
|
|
3871
|
-
|
|
3872
|
-
|
|
3873
|
-
|
|
3874
|
-
|
|
3875
|
-
|
|
3876
|
-
|
|
3877
|
-
tableFullData.unshift(
|
|
3878
|
-
afterFullData.unshift(
|
|
3866
|
+
targetRows.forEach((item: any) => {
|
|
3867
|
+
const rowid = getRowid($xeTable, item)
|
|
3868
|
+
const rowRest = fullAllDataRowIdData[rowid]
|
|
3869
|
+
if (rowRest) {
|
|
3870
|
+
const row = rowRest.row
|
|
3871
|
+
if (!$xeTable.isInsertByRow(row)) {
|
|
3872
|
+
const oRow = sourceDataRowIdData[rowid]
|
|
3873
|
+
if (oRow && row) {
|
|
3874
|
+
if (field) {
|
|
3875
|
+
XEUtils.set(row, field, XEUtils.clone(XEUtils.get(oRow, field), true))
|
|
3876
|
+
} else {
|
|
3877
|
+
XEUtils.destructuring(row, XEUtils.clone(oRow, true))
|
|
3878
|
+
}
|
|
3879
|
+
if (!fullDataRowIdData[rowid] && $xeTable.isRemoveByRow(row)) {
|
|
3880
|
+
tableFullData.unshift(row)
|
|
3881
|
+
afterFullData.unshift(row)
|
|
3879
3882
|
reDelFlag = true
|
|
3880
3883
|
}
|
|
3881
3884
|
}
|
|
@@ -4032,18 +4035,20 @@ export default defineComponent({
|
|
|
4032
4035
|
},
|
|
4033
4036
|
/**
|
|
4034
4037
|
* 检查行或列数据是否发生改变
|
|
4035
|
-
* @param {Row}
|
|
4038
|
+
* @param {Row} rowOrId 行对象
|
|
4036
4039
|
* @param {String} field 字段名
|
|
4037
4040
|
*/
|
|
4038
|
-
isUpdateByRow (
|
|
4041
|
+
isUpdateByRow (rowOrId, field) {
|
|
4039
4042
|
const { keepSource } = props
|
|
4040
4043
|
const { tableFullColumn, fullDataRowIdData, sourceDataRowIdData } = internalData
|
|
4041
4044
|
if (keepSource) {
|
|
4042
|
-
const rowid = getRowid($xeTable,
|
|
4045
|
+
const rowid = XEUtils.isString(rowOrId) || XEUtils.isNumber(rowOrId) ? rowOrId : getRowid($xeTable, rowOrId)
|
|
4046
|
+
const rowRest = fullDataRowIdData[rowid]
|
|
4043
4047
|
// 新增的数据不需要检测
|
|
4044
|
-
if (!
|
|
4048
|
+
if (!rowRest) {
|
|
4045
4049
|
return false
|
|
4046
4050
|
}
|
|
4051
|
+
const row = rowRest.row
|
|
4047
4052
|
const oRow = sourceDataRowIdData[rowid]
|
|
4048
4053
|
if (oRow) {
|
|
4049
4054
|
if (arguments.length > 1) {
|
|
@@ -4107,6 +4112,92 @@ export default defineComponent({
|
|
|
4107
4112
|
tableColumn: reactData.tableColumn.slice(0)
|
|
4108
4113
|
}
|
|
4109
4114
|
},
|
|
4115
|
+
/**
|
|
4116
|
+
* 移动列到指定列的位置
|
|
4117
|
+
* @param fieldOrColumn
|
|
4118
|
+
* @param targetFieldOrColumn
|
|
4119
|
+
* @param options
|
|
4120
|
+
*/
|
|
4121
|
+
moveColumnTo (fieldOrColumn, targetFieldOrColumn, options) {
|
|
4122
|
+
const { fullColumnIdData, visibleColumn } = internalData
|
|
4123
|
+
const { dragToChild, dragPos, isCrossDrag } = Object.assign({}, options)
|
|
4124
|
+
const dragCol = handleFieldOrColumn($xeTable, fieldOrColumn)
|
|
4125
|
+
let prevDragCol: VxeTableDefines.ColumnInfo | null = null
|
|
4126
|
+
const colRest = dragCol ? fullColumnIdData[dragCol.id] : null
|
|
4127
|
+
let defPos: 'left' | 'right' = 'left'
|
|
4128
|
+
if (XEUtils.isNumber(targetFieldOrColumn)) {
|
|
4129
|
+
if (colRest && targetFieldOrColumn) {
|
|
4130
|
+
let currList = colRest.items
|
|
4131
|
+
let offsetIndex = colRest._index + targetFieldOrColumn
|
|
4132
|
+
if (isCrossDrag) {
|
|
4133
|
+
currList = visibleColumn
|
|
4134
|
+
offsetIndex = colRest._index + targetFieldOrColumn
|
|
4135
|
+
}
|
|
4136
|
+
if (offsetIndex > 0 && offsetIndex < currList.length - 1) {
|
|
4137
|
+
prevDragCol = currList[offsetIndex]
|
|
4138
|
+
}
|
|
4139
|
+
if (targetFieldOrColumn > 0) {
|
|
4140
|
+
defPos = 'right'
|
|
4141
|
+
}
|
|
4142
|
+
}
|
|
4143
|
+
} else {
|
|
4144
|
+
prevDragCol = handleFieldOrColumn($xeTable, targetFieldOrColumn)
|
|
4145
|
+
const targetColRest = prevDragCol ? fullColumnIdData[prevDragCol.id] : null
|
|
4146
|
+
if (colRest && targetColRest) {
|
|
4147
|
+
if (targetColRest._index > colRest._index) {
|
|
4148
|
+
defPos = 'right'
|
|
4149
|
+
}
|
|
4150
|
+
}
|
|
4151
|
+
}
|
|
4152
|
+
return $xeTable.handleColDragSwapEvent(null, true, dragCol, prevDragCol, dragPos || defPos, dragToChild === true)
|
|
4153
|
+
},
|
|
4154
|
+
/**
|
|
4155
|
+
* 移动行到指定行的位置
|
|
4156
|
+
* @param rowidOrRow
|
|
4157
|
+
* @param targetRowidOrRow
|
|
4158
|
+
* @param options
|
|
4159
|
+
*/
|
|
4160
|
+
moveRowTo (rowidOrRow, targetRowidOrRow, options) {
|
|
4161
|
+
const { treeConfig } = props
|
|
4162
|
+
const { fullAllDataRowIdData, afterFullData } = internalData
|
|
4163
|
+
const { dragToChild, dragPos, isCrossDrag } = Object.assign({}, options)
|
|
4164
|
+
const treeOpts = computeTreeOpts.value
|
|
4165
|
+
const dragRow = handleRowidOrRow($xeTable, rowidOrRow)
|
|
4166
|
+
let prevDragRow: any = null
|
|
4167
|
+
let defPos: 'top' | 'bottom' = 'top'
|
|
4168
|
+
const rowRest = dragRow ? fullAllDataRowIdData[getRowid($xeTable, dragRow)] : null
|
|
4169
|
+
if (XEUtils.isNumber(targetRowidOrRow)) {
|
|
4170
|
+
if (rowRest && targetRowidOrRow) {
|
|
4171
|
+
let currList = afterFullData
|
|
4172
|
+
let offsetIndex = rowRest._index + targetRowidOrRow
|
|
4173
|
+
if (treeConfig) {
|
|
4174
|
+
currList = rowRest.items
|
|
4175
|
+
if (treeOpts.transform) {
|
|
4176
|
+
offsetIndex = rowRest.treeIndex + targetRowidOrRow
|
|
4177
|
+
if (isCrossDrag) {
|
|
4178
|
+
currList = afterFullData
|
|
4179
|
+
offsetIndex = rowRest._index + targetRowidOrRow
|
|
4180
|
+
}
|
|
4181
|
+
}
|
|
4182
|
+
}
|
|
4183
|
+
if (offsetIndex >= 0 && offsetIndex <= currList.length - 1) {
|
|
4184
|
+
prevDragRow = currList[offsetIndex]
|
|
4185
|
+
}
|
|
4186
|
+
if (targetRowidOrRow > 0) {
|
|
4187
|
+
defPos = 'bottom'
|
|
4188
|
+
}
|
|
4189
|
+
}
|
|
4190
|
+
} else {
|
|
4191
|
+
prevDragRow = handleRowidOrRow($xeTable, targetRowidOrRow)
|
|
4192
|
+
const targetRowRest = prevDragRow ? fullAllDataRowIdData[getRowid($xeTable, prevDragRow)] : null
|
|
4193
|
+
if (rowRest && targetRowRest) {
|
|
4194
|
+
if (targetRowRest._index > rowRest._index) {
|
|
4195
|
+
defPos = 'bottom'
|
|
4196
|
+
}
|
|
4197
|
+
}
|
|
4198
|
+
}
|
|
4199
|
+
return $xeTable.handleRowDragSwapEvent(null, true, dragRow, prevDragRow, dragPos || defPos, dragToChild === true)
|
|
4200
|
+
},
|
|
4110
4201
|
/**
|
|
4111
4202
|
* 获取表格的全量列
|
|
4112
4203
|
*/
|
|
@@ -6712,7 +6803,15 @@ export default defineComponent({
|
|
|
6712
6803
|
if (el) {
|
|
6713
6804
|
const parentElem = el.parentNode as HTMLElement
|
|
6714
6805
|
const parentPaddingSize = height === '100%' || height === 'auto' ? getPaddingTopBottomSize(parentElem) : 0
|
|
6715
|
-
|
|
6806
|
+
let parentWrapperHeight = 0
|
|
6807
|
+
if (parentElem) {
|
|
6808
|
+
if ($xeGrid && hasClass(parentElem, 'vxe-grid--table-wrapper')) {
|
|
6809
|
+
parentWrapperHeight = $xeGrid.getParentHeight()
|
|
6810
|
+
} else {
|
|
6811
|
+
parentWrapperHeight = parentElem.clientHeight
|
|
6812
|
+
}
|
|
6813
|
+
}
|
|
6814
|
+
return Math.floor(parentWrapperHeight - parentPaddingSize)
|
|
6716
6815
|
}
|
|
6717
6816
|
return 0
|
|
6718
6817
|
},
|
|
@@ -8125,6 +8224,9 @@ export default defineComponent({
|
|
|
8125
8224
|
const { afterFullData, tableFullData } = internalData
|
|
8126
8225
|
const dEndMethod = dragEndMethod || (dragConfig ? dragConfig.dragEndMethod : null)
|
|
8127
8226
|
const dragOffsetIndex = prevDragPos === 'bottom' ? 1 : 0
|
|
8227
|
+
const errRest = {
|
|
8228
|
+
status: false
|
|
8229
|
+
}
|
|
8128
8230
|
if (prevDragRow && dragRow) {
|
|
8129
8231
|
// 判断是否有拖动
|
|
8130
8232
|
if (prevDragRow !== dragRow) {
|
|
@@ -8139,7 +8241,7 @@ export default defineComponent({
|
|
|
8139
8241
|
const isDragToChildFlag = isSelfToChildDrag && dragToChildMethod ? dragToChildMethod(dragParams) : prevDragToChild
|
|
8140
8242
|
return Promise.resolve(dEndMethod ? dEndMethod(dragParams) : true).then((status) => {
|
|
8141
8243
|
if (!status) {
|
|
8142
|
-
return
|
|
8244
|
+
return errRest
|
|
8143
8245
|
}
|
|
8144
8246
|
|
|
8145
8247
|
let oafIndex = -1
|
|
@@ -8170,11 +8272,11 @@ export default defineComponent({
|
|
|
8170
8272
|
if (isPeerDrag && !isCrossDrag) {
|
|
8171
8273
|
if (oldRest.row[parentField] !== newRest.row[parentField]) {
|
|
8172
8274
|
// 非同级
|
|
8173
|
-
return
|
|
8275
|
+
return errRest
|
|
8174
8276
|
}
|
|
8175
8277
|
} else {
|
|
8176
8278
|
if (!isCrossDrag) {
|
|
8177
|
-
return
|
|
8279
|
+
return errRest
|
|
8178
8280
|
}
|
|
8179
8281
|
if (oldAllMaps[newRowid]) {
|
|
8180
8282
|
isSelfToChildStatus = true
|
|
@@ -8185,7 +8287,7 @@ export default defineComponent({
|
|
|
8185
8287
|
content: getI18n('vxe.error.treeDragChild')
|
|
8186
8288
|
})
|
|
8187
8289
|
}
|
|
8188
|
-
return
|
|
8290
|
+
return errRest
|
|
8189
8291
|
}
|
|
8190
8292
|
}
|
|
8191
8293
|
}
|
|
@@ -8193,13 +8295,13 @@ export default defineComponent({
|
|
|
8193
8295
|
// 子到根
|
|
8194
8296
|
|
|
8195
8297
|
if (!isCrossDrag) {
|
|
8196
|
-
return
|
|
8298
|
+
return errRest
|
|
8197
8299
|
}
|
|
8198
8300
|
} else if (newLevel) {
|
|
8199
8301
|
// 根到子
|
|
8200
8302
|
|
|
8201
8303
|
if (!isCrossDrag) {
|
|
8202
|
-
return
|
|
8304
|
+
return errRest
|
|
8203
8305
|
}
|
|
8204
8306
|
if (oldAllMaps[newRowid]) {
|
|
8205
8307
|
isSelfToChildStatus = true
|
|
@@ -8210,7 +8312,7 @@ export default defineComponent({
|
|
|
8210
8312
|
content: getI18n('vxe.error.treeDragChild')
|
|
8211
8313
|
})
|
|
8212
8314
|
}
|
|
8213
|
-
return
|
|
8315
|
+
return errRest
|
|
8214
8316
|
}
|
|
8215
8317
|
}
|
|
8216
8318
|
} else {
|
|
@@ -8274,28 +8376,36 @@ export default defineComponent({
|
|
|
8274
8376
|
if (reactData.scrollYLoad) {
|
|
8275
8377
|
$xeTable.updateScrollYSpace()
|
|
8276
8378
|
}
|
|
8277
|
-
|
|
8379
|
+
|
|
8380
|
+
if (evnt) {
|
|
8381
|
+
dispatchEvent('row-dragend', {
|
|
8382
|
+
oldRow: dragRow,
|
|
8383
|
+
newRow: prevDragRow,
|
|
8384
|
+
dragRow,
|
|
8385
|
+
dragPos: prevDragPos as any,
|
|
8386
|
+
dragToChild: isDragToChildFlag,
|
|
8387
|
+
offsetIndex: dragOffsetIndex,
|
|
8388
|
+
_index: {
|
|
8389
|
+
newIndex: nafIndex,
|
|
8390
|
+
oldIndex: oafIndex
|
|
8391
|
+
}
|
|
8392
|
+
}, evnt)
|
|
8393
|
+
}
|
|
8394
|
+
|
|
8395
|
+
return nextTick().then(() => {
|
|
8278
8396
|
$xeTable.updateCellAreas()
|
|
8279
8397
|
$xeTable.recalculate()
|
|
8280
|
-
})
|
|
8281
|
-
|
|
8282
|
-
|
|
8283
|
-
oldRow: dragRow,
|
|
8284
|
-
newRow: prevDragRow,
|
|
8285
|
-
dragRow,
|
|
8286
|
-
dragPos: prevDragPos as any,
|
|
8287
|
-
dragToChild: isDragToChildFlag,
|
|
8288
|
-
offsetIndex: dragOffsetIndex,
|
|
8289
|
-
_index: {
|
|
8290
|
-
newIndex: nafIndex,
|
|
8291
|
-
oldIndex: oafIndex
|
|
8398
|
+
}).then(() => {
|
|
8399
|
+
return {
|
|
8400
|
+
status: true
|
|
8292
8401
|
}
|
|
8293
|
-
}
|
|
8402
|
+
})
|
|
8294
8403
|
}).catch(() => {
|
|
8404
|
+
return errRest
|
|
8295
8405
|
})
|
|
8296
8406
|
}
|
|
8297
8407
|
}
|
|
8298
|
-
return Promise.resolve()
|
|
8408
|
+
return Promise.resolve(errRest)
|
|
8299
8409
|
},
|
|
8300
8410
|
handleRowDragDragendEvent (evnt) {
|
|
8301
8411
|
const { treeConfig } = props
|
|
@@ -8420,6 +8530,9 @@ export default defineComponent({
|
|
|
8420
8530
|
const { isPeerDrag, isCrossDrag, isSelfToChildDrag, isToChildDrag, dragEndMethod, dragToChildMethod } = columnDragOpts
|
|
8421
8531
|
const { collectColumn } = internalData
|
|
8422
8532
|
const dragOffsetIndex = prevDragPos === 'right' ? 1 : 0
|
|
8533
|
+
const errRest = {
|
|
8534
|
+
status: false
|
|
8535
|
+
}
|
|
8423
8536
|
if (prevDragCol && dragCol) {
|
|
8424
8537
|
// 判断是否有拖动
|
|
8425
8538
|
if (prevDragCol !== dragCol) {
|
|
@@ -8436,7 +8549,7 @@ export default defineComponent({
|
|
|
8436
8549
|
const isDragToChildFlag = isSelfToChildDrag && dragToChildMethod ? dragToChildMethod(dragParams) : prevDragToChild
|
|
8437
8550
|
return Promise.resolve(dragEndMethod ? dragEndMethod(dragParams) : true).then((status) => {
|
|
8438
8551
|
if (!status) {
|
|
8439
|
-
return
|
|
8552
|
+
return errRest
|
|
8440
8553
|
}
|
|
8441
8554
|
|
|
8442
8555
|
let oafIndex = -1
|
|
@@ -8455,11 +8568,11 @@ export default defineComponent({
|
|
|
8455
8568
|
if (isPeerDrag && !isCrossDrag) {
|
|
8456
8569
|
if (dragColumn.parentId !== newColumn.parentId) {
|
|
8457
8570
|
// 非同级
|
|
8458
|
-
return
|
|
8571
|
+
return errRest
|
|
8459
8572
|
}
|
|
8460
8573
|
} else {
|
|
8461
8574
|
if (!isCrossDrag) {
|
|
8462
|
-
return
|
|
8575
|
+
return errRest
|
|
8463
8576
|
}
|
|
8464
8577
|
|
|
8465
8578
|
if (oldAllMaps[newColumn.id]) {
|
|
@@ -8471,7 +8584,7 @@ export default defineComponent({
|
|
|
8471
8584
|
content: getI18n('vxe.error.treeDragChild')
|
|
8472
8585
|
})
|
|
8473
8586
|
}
|
|
8474
|
-
return
|
|
8587
|
+
return errRest
|
|
8475
8588
|
}
|
|
8476
8589
|
}
|
|
8477
8590
|
}
|
|
@@ -8479,13 +8592,13 @@ export default defineComponent({
|
|
|
8479
8592
|
// 子到根
|
|
8480
8593
|
|
|
8481
8594
|
if (!isCrossDrag) {
|
|
8482
|
-
return
|
|
8595
|
+
return errRest
|
|
8483
8596
|
}
|
|
8484
8597
|
} else if (newColumn.parentId) {
|
|
8485
8598
|
// 根到子
|
|
8486
8599
|
|
|
8487
8600
|
if (!isCrossDrag) {
|
|
8488
|
-
return
|
|
8601
|
+
return errRest
|
|
8489
8602
|
}
|
|
8490
8603
|
if (oldAllMaps[newColumn.id]) {
|
|
8491
8604
|
isSelfToChildStatus = true
|
|
@@ -8496,7 +8609,7 @@ export default defineComponent({
|
|
|
8496
8609
|
content: getI18n('vxe.error.treeDragChild')
|
|
8497
8610
|
})
|
|
8498
8611
|
}
|
|
8499
|
-
return
|
|
8612
|
+
return errRest
|
|
8500
8613
|
}
|
|
8501
8614
|
}
|
|
8502
8615
|
} else {
|
|
@@ -8560,27 +8673,34 @@ export default defineComponent({
|
|
|
8560
8673
|
}
|
|
8561
8674
|
}
|
|
8562
8675
|
|
|
8563
|
-
|
|
8564
|
-
|
|
8565
|
-
|
|
8566
|
-
|
|
8567
|
-
|
|
8568
|
-
|
|
8569
|
-
|
|
8570
|
-
|
|
8571
|
-
|
|
8572
|
-
|
|
8573
|
-
|
|
8574
|
-
|
|
8676
|
+
if (evnt) {
|
|
8677
|
+
dispatchEvent('column-dragend', {
|
|
8678
|
+
oldColumn: dragColumn,
|
|
8679
|
+
newColumn,
|
|
8680
|
+
dragColumn,
|
|
8681
|
+
dragPos: prevDragPos,
|
|
8682
|
+
dragToChild: isDragToChildFlag,
|
|
8683
|
+
offsetIndex: dragOffsetIndex,
|
|
8684
|
+
_index: {
|
|
8685
|
+
newIndex: nafIndex,
|
|
8686
|
+
oldIndex: oafIndex
|
|
8687
|
+
}
|
|
8688
|
+
}, evnt)
|
|
8689
|
+
}
|
|
8575
8690
|
|
|
8576
8691
|
if (isSyncColumn) {
|
|
8577
8692
|
$xeTable.handleColDragSwapColumn()
|
|
8578
8693
|
}
|
|
8694
|
+
|
|
8695
|
+
return {
|
|
8696
|
+
status: true
|
|
8697
|
+
}
|
|
8579
8698
|
}).catch(() => {
|
|
8699
|
+
return errRest
|
|
8580
8700
|
})
|
|
8581
8701
|
}
|
|
8582
8702
|
}
|
|
8583
|
-
return Promise.resolve()
|
|
8703
|
+
return Promise.resolve(errRest)
|
|
8584
8704
|
},
|
|
8585
8705
|
handleHeaderCellDragDragendEvent (evnt) {
|
|
8586
8706
|
const { dragCol } = reactData
|
|
@@ -101,15 +101,19 @@ export function getRowUniqueId () {
|
|
|
101
101
|
export function getRowkey ($xeTable: VxeTableConstructor) {
|
|
102
102
|
const { props } = $xeTable
|
|
103
103
|
const { computeRowOpts } = $xeTable.getComputeMaps()
|
|
104
|
-
const { rowId } = props
|
|
105
104
|
const rowOpts = computeRowOpts.value
|
|
106
|
-
return rowId || rowOpts.keyField || '_X_ROW_KEY'
|
|
105
|
+
return `${props.rowId || rowOpts.keyField || '_X_ROW_KEY'}`
|
|
107
106
|
}
|
|
108
107
|
|
|
109
108
|
// 行主键 value
|
|
110
109
|
export function getRowid ($xeTable: VxeTableConstructor, row: any) {
|
|
111
110
|
const rowid = XEUtils.get(row, getRowkey($xeTable))
|
|
112
|
-
return
|
|
111
|
+
return encodeRowid(rowid)
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
// 编码行主键
|
|
115
|
+
export function encodeRowid (rowVal: string) {
|
|
116
|
+
return XEUtils.eqNull(rowVal) ? '' : encodeURIComponent(rowVal)
|
|
113
117
|
}
|
|
114
118
|
|
|
115
119
|
export interface XEColumnInstance {
|
|
@@ -123,6 +127,14 @@ export const handleFieldOrColumn = ($xeTable: VxeTableConstructor, fieldOrColumn
|
|
|
123
127
|
return null
|
|
124
128
|
}
|
|
125
129
|
|
|
130
|
+
export const handleRowidOrRow = ($xeTable: VxeTableConstructor, rowidOrRow: any) => {
|
|
131
|
+
if (rowidOrRow) {
|
|
132
|
+
const rowid = XEUtils.isString(rowidOrRow) || XEUtils.isNumber(rowidOrRow) ? rowidOrRow : getRowid($xeTable, rowidOrRow)
|
|
133
|
+
return $xeTable.getRowById(rowid)
|
|
134
|
+
}
|
|
135
|
+
return null
|
|
136
|
+
}
|
|
137
|
+
|
|
126
138
|
function getPaddingLeftRightSize (elem: HTMLElement | null) {
|
|
127
139
|
if (elem) {
|
|
128
140
|
const computedStyle = getComputedStyle(elem)
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|