vxe-table 3.13.19 → 3.13.20
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 -0
- 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/methods.js +182 -53
- package/es/table/src/util.js +18 -5
- package/es/ui/index.js +1 -1
- package/es/ui/src/log.js +1 -1
- package/lib/grid/src/grid.js +4 -0
- package/lib/grid/src/grid.min.js +1 -1
- package/lib/index.umd.js +250 -78
- 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/methods.js +209 -64
- package/lib/table/src/methods.min.js +1 -1
- package/lib/table/src/util.js +21 -5
- 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 +5 -0
- package/packages/table/src/body.ts +10 -5
- package/packages/table/src/footer.ts +7 -2
- package/packages/table/src/methods.ts +202 -60
- package/packages/table/src/util.ts +20 -5
- /package/es/{iconfont.1741224103306.ttf → iconfont.1741333380103.ttf} +0 -0
- /package/es/{iconfont.1741224103306.woff → iconfont.1741333380103.woff} +0 -0
- /package/es/{iconfont.1741224103306.woff2 → iconfont.1741333380103.woff2} +0 -0
- /package/lib/{iconfont.1741224103306.ttf → iconfont.1741333380103.ttf} +0 -0
- /package/lib/{iconfont.1741224103306.woff → iconfont.1741333380103.woff} +0 -0
- /package/lib/{iconfont.1741224103306.woff2 → iconfont.1741333380103.woff2} +0 -0
|
@@ -3,7 +3,7 @@ import { browse, getTpImg, isPx, isScale, hasClass, addClass, removeClass, getEv
|
|
|
3
3
|
import { getLastZIndex, nextZIndex, hasChildrenList, getFuncText, isEnableConf, formatText, eqEmptyValue } from '../../ui/src/utils'
|
|
4
4
|
import { VxeUI } from '../../ui'
|
|
5
5
|
import Cell from './cell'
|
|
6
|
-
import { getRowUniqueId, clearTableAllStatus, getRowkey, getRowid, rowToVisible, colToVisible, getCellValue, setCellValue, handleFieldOrColumn, toTreePathSeq, restoreScrollLocation, getRootColumn, getColReMinWidth, getRefElem } from './util'
|
|
6
|
+
import { getRowUniqueId, clearTableAllStatus, getRowkey, getRowid, rowToVisible, colToVisible, getCellValue, setCellValue, handleRowidOrRow, handleFieldOrColumn, toTreePathSeq, restoreScrollLocation, getRootColumn, getColReMinWidth, getRefElem } from './util'
|
|
7
7
|
import { getSlotVNs } from '../../ui/src/vn'
|
|
8
8
|
import { warnLog, errLog } from '../../ui/src/log'
|
|
9
9
|
|
|
@@ -2286,6 +2286,11 @@ const Methods = {
|
|
|
2286
2286
|
}
|
|
2287
2287
|
return []
|
|
2288
2288
|
},
|
|
2289
|
+
getEl () {
|
|
2290
|
+
const $xeTable = this as VxeTableConstructor & VxeTablePrivateMethods
|
|
2291
|
+
|
|
2292
|
+
return $xeTable.$refs.refElem as HTMLDivElement
|
|
2293
|
+
},
|
|
2289
2294
|
/**
|
|
2290
2295
|
* 获取父容器元素
|
|
2291
2296
|
*/
|
|
@@ -3247,22 +3252,28 @@ const Methods = {
|
|
|
3247
3252
|
},
|
|
3248
3253
|
/**
|
|
3249
3254
|
* 检查行或列数据是否发生改变
|
|
3250
|
-
* @param {Row}
|
|
3255
|
+
* @param {Row} rowOrId 行对象
|
|
3251
3256
|
* @param {String} field 字段名
|
|
3252
3257
|
*/
|
|
3253
|
-
isUpdateByRow (
|
|
3254
|
-
const
|
|
3258
|
+
isUpdateByRow (rowOrId: any, field?: string | null) {
|
|
3259
|
+
const $xeTable = this as VxeTableConstructor & VxeTablePrivateMethods
|
|
3260
|
+
const props = $xeTable
|
|
3261
|
+
const internalData = $xeTable as unknown as TableInternalData
|
|
3262
|
+
|
|
3263
|
+
const { keepSource } = props
|
|
3264
|
+
const { tableFullColumn, fullDataRowIdData, sourceDataRowIdData } = internalData
|
|
3255
3265
|
if (keepSource) {
|
|
3256
|
-
const rowid = getRowid(
|
|
3266
|
+
const rowid = XEUtils.isString(rowOrId) || XEUtils.isNumber(rowOrId) ? rowOrId : getRowid($xeTable, rowOrId)
|
|
3267
|
+
const rowRest = fullDataRowIdData[rowid]
|
|
3257
3268
|
// 新增的数据不需要检测
|
|
3258
|
-
if (!
|
|
3269
|
+
if (!rowRest) {
|
|
3259
3270
|
return false
|
|
3260
3271
|
}
|
|
3261
|
-
const
|
|
3262
|
-
|
|
3263
|
-
|
|
3272
|
+
const row = rowRest.row
|
|
3273
|
+
const oRow = sourceDataRowIdData[rowid]
|
|
3274
|
+
if (oRow) {
|
|
3264
3275
|
if (arguments.length > 1) {
|
|
3265
|
-
return !eqCellValue(oRow, row, field)
|
|
3276
|
+
return !eqCellValue(oRow, row, field as string)
|
|
3266
3277
|
}
|
|
3267
3278
|
for (let index = 0, len = tableFullColumn.length; index < len; index++) {
|
|
3268
3279
|
const property = tableFullColumn[index].field
|
|
@@ -3322,6 +3333,107 @@ const Methods = {
|
|
|
3322
3333
|
tableColumn: this.tableColumn.slice(0)
|
|
3323
3334
|
}
|
|
3324
3335
|
},
|
|
3336
|
+
/**
|
|
3337
|
+
* 移动列到指定列的位置
|
|
3338
|
+
* @param fieldOrColumn
|
|
3339
|
+
* @param targetFieldOrColumn
|
|
3340
|
+
* @param options
|
|
3341
|
+
*/
|
|
3342
|
+
moveColumnTo (fieldOrColumn: VxeTableDefines.ColumnInfo, targetFieldOrColumn: VxeTableDefines.ColumnInfo, options?: {
|
|
3343
|
+
isCrossDrag?: boolean
|
|
3344
|
+
dragToChild?: boolean;
|
|
3345
|
+
dragPos?: 'left' | 'right' | '' | null;
|
|
3346
|
+
}) {
|
|
3347
|
+
const $xeTable = this as VxeTableConstructor & VxeTablePrivateMethods
|
|
3348
|
+
const internalData = $xeTable as unknown as TableInternalData
|
|
3349
|
+
|
|
3350
|
+
const { fullColumnIdData, visibleColumn } = internalData
|
|
3351
|
+
const { dragToChild, dragPos, isCrossDrag } = Object.assign({}, options)
|
|
3352
|
+
const dragCol = handleFieldOrColumn($xeTable, fieldOrColumn)
|
|
3353
|
+
let prevDragCol: VxeTableDefines.ColumnInfo | null = null
|
|
3354
|
+
const colRest = dragCol ? fullColumnIdData[dragCol.id] : null
|
|
3355
|
+
let defPos: 'left' | 'right' = 'left'
|
|
3356
|
+
if (XEUtils.isNumber(targetFieldOrColumn)) {
|
|
3357
|
+
if (colRest && targetFieldOrColumn) {
|
|
3358
|
+
let currList = colRest.items
|
|
3359
|
+
let offsetIndex = colRest._index + targetFieldOrColumn
|
|
3360
|
+
if (isCrossDrag) {
|
|
3361
|
+
currList = visibleColumn
|
|
3362
|
+
offsetIndex = colRest._index + targetFieldOrColumn
|
|
3363
|
+
}
|
|
3364
|
+
if (offsetIndex > 0 && offsetIndex < currList.length - 1) {
|
|
3365
|
+
prevDragCol = currList[offsetIndex]
|
|
3366
|
+
}
|
|
3367
|
+
if (targetFieldOrColumn > 0) {
|
|
3368
|
+
defPos = 'right'
|
|
3369
|
+
}
|
|
3370
|
+
}
|
|
3371
|
+
} else {
|
|
3372
|
+
prevDragCol = handleFieldOrColumn($xeTable, targetFieldOrColumn)
|
|
3373
|
+
const targetColRest = prevDragCol ? fullColumnIdData[prevDragCol.id] : null
|
|
3374
|
+
if (colRest && targetColRest) {
|
|
3375
|
+
if (targetColRest._index > colRest._index) {
|
|
3376
|
+
defPos = 'right'
|
|
3377
|
+
}
|
|
3378
|
+
}
|
|
3379
|
+
}
|
|
3380
|
+
return $xeTable.handleColDragSwapEvent(null, true, dragCol, prevDragCol, dragPos || defPos, dragToChild === true)
|
|
3381
|
+
},
|
|
3382
|
+
/**
|
|
3383
|
+
* 移动行到指定行的位置
|
|
3384
|
+
* @param rowidOrRow
|
|
3385
|
+
* @param targetRowidOrRow
|
|
3386
|
+
* @param options
|
|
3387
|
+
*/
|
|
3388
|
+
moveRowTo (rowidOrRow: any, targetRowidOrRow: any, options?: {
|
|
3389
|
+
isCrossDrag?: boolean
|
|
3390
|
+
dragToChild?: boolean;
|
|
3391
|
+
dragPos?: 'top' | 'bottom' | '' | null;
|
|
3392
|
+
}) {
|
|
3393
|
+
const $xeTable = this as VxeTableConstructor & VxeTablePrivateMethods
|
|
3394
|
+
const props = $xeTable
|
|
3395
|
+
const internalData = $xeTable as unknown as TableInternalData
|
|
3396
|
+
|
|
3397
|
+
const { treeConfig } = props
|
|
3398
|
+
const { fullAllDataRowIdData, afterFullData } = internalData
|
|
3399
|
+
const { dragToChild, dragPos, isCrossDrag } = Object.assign({}, options)
|
|
3400
|
+
const treeOpts = $xeTable.computeTreeOpts
|
|
3401
|
+
const dragRow = handleRowidOrRow($xeTable, rowidOrRow)
|
|
3402
|
+
let prevDragRow: any = null
|
|
3403
|
+
let defPos: 'top' | 'bottom' = 'top'
|
|
3404
|
+
const rowRest = dragRow ? fullAllDataRowIdData[getRowid($xeTable, dragRow)] : null
|
|
3405
|
+
if (XEUtils.isNumber(targetRowidOrRow)) {
|
|
3406
|
+
if (rowRest && targetRowidOrRow) {
|
|
3407
|
+
let currList = afterFullData
|
|
3408
|
+
let offsetIndex = rowRest._index + targetRowidOrRow
|
|
3409
|
+
if (treeConfig) {
|
|
3410
|
+
currList = rowRest.items
|
|
3411
|
+
if (treeOpts.transform) {
|
|
3412
|
+
offsetIndex = rowRest.treeIndex + targetRowidOrRow
|
|
3413
|
+
if (isCrossDrag) {
|
|
3414
|
+
currList = afterFullData
|
|
3415
|
+
offsetIndex = rowRest._index + targetRowidOrRow
|
|
3416
|
+
}
|
|
3417
|
+
}
|
|
3418
|
+
}
|
|
3419
|
+
if (offsetIndex >= 0 && offsetIndex <= currList.length - 1) {
|
|
3420
|
+
prevDragRow = currList[offsetIndex]
|
|
3421
|
+
}
|
|
3422
|
+
if (targetRowidOrRow > 0) {
|
|
3423
|
+
defPos = 'bottom'
|
|
3424
|
+
}
|
|
3425
|
+
}
|
|
3426
|
+
} else {
|
|
3427
|
+
prevDragRow = handleRowidOrRow($xeTable, targetRowidOrRow)
|
|
3428
|
+
const targetRowRest = prevDragRow ? fullAllDataRowIdData[getRowid($xeTable, prevDragRow)] : null
|
|
3429
|
+
if (rowRest && targetRowRest) {
|
|
3430
|
+
if (targetRowRest._index > rowRest._index) {
|
|
3431
|
+
defPos = 'bottom'
|
|
3432
|
+
}
|
|
3433
|
+
}
|
|
3434
|
+
}
|
|
3435
|
+
return $xeTable.handleRowDragSwapEvent(null, true, dragRow, prevDragRow, dragPos || defPos, dragToChild === true)
|
|
3436
|
+
},
|
|
3325
3437
|
/**
|
|
3326
3438
|
* 获取表格的全量列
|
|
3327
3439
|
*/
|
|
@@ -3342,21 +3454,30 @@ const Methods = {
|
|
|
3342
3454
|
/**
|
|
3343
3455
|
* 用于多选行,获取已选中的数据
|
|
3344
3456
|
*/
|
|
3345
|
-
getCheckboxRecords (isFull:
|
|
3346
|
-
const
|
|
3457
|
+
getCheckboxRecords (isFull: boolean) {
|
|
3458
|
+
const $xeTable = this as VxeTableConstructor & VxeTablePrivateMethods
|
|
3459
|
+
const props = $xeTable
|
|
3460
|
+
const reactData = $xeTable as unknown as TableReactData
|
|
3461
|
+
const internalData = $xeTable as unknown as TableInternalData
|
|
3462
|
+
|
|
3463
|
+
const { treeConfig } = props
|
|
3464
|
+
const { selectCheckboxMaps } = reactData
|
|
3465
|
+
const { tableFullData, afterFullData, afterTreeFullData, tableFullTreeData, fullDataRowIdData, afterFullRowMaps } = internalData
|
|
3466
|
+
const treeOpts = $xeTable.computeTreeOpts
|
|
3467
|
+
const checkboxOpts = $xeTable.computeCheckboxOpts
|
|
3347
3468
|
const { transform, mapChildrenField } = treeOpts
|
|
3348
3469
|
const { checkField } = checkboxOpts
|
|
3349
3470
|
const childrenField = treeOpts.children || treeOpts.childrenField
|
|
3350
|
-
|
|
3351
|
-
let rowList = []
|
|
3471
|
+
let rowList: any[] = []
|
|
3352
3472
|
if (checkField) {
|
|
3353
3473
|
if (treeConfig) {
|
|
3474
|
+
const currTableData = isFull ? (transform ? tableFullTreeData : tableFullData) : (transform ? afterTreeFullData : afterFullData)
|
|
3354
3475
|
rowList = XEUtils.filterTree(currTableData, row => XEUtils.get(row, checkField), { children: transform ? mapChildrenField : childrenField })
|
|
3355
3476
|
} else {
|
|
3356
|
-
|
|
3477
|
+
const currTableData = isFull ? tableFullData : afterFullData
|
|
3478
|
+
rowList = currTableData.filter((row) => XEUtils.get(row, checkField))
|
|
3357
3479
|
}
|
|
3358
3480
|
} else {
|
|
3359
|
-
const { selectCheckboxMaps, fullDataRowIdData } = this
|
|
3360
3481
|
XEUtils.each(selectCheckboxMaps, (row, rowid) => {
|
|
3361
3482
|
if (isFull) {
|
|
3362
3483
|
if (fullDataRowIdData[rowid]) {
|
|
@@ -6543,7 +6664,7 @@ const Methods = {
|
|
|
6543
6664
|
evnt.dataTransfer.setDragImage(getTpImg(), 0, 0)
|
|
6544
6665
|
}
|
|
6545
6666
|
},
|
|
6546
|
-
handleRowDragSwapEvent (evnt: DragEvent, isSyncRow: boolean | undefined, dragRow: any, prevDragRow: any, prevDragPos: '' | 'top' | 'bottom' | 'left' | 'right' | undefined, prevDragToChild: boolean | undefined) {
|
|
6667
|
+
handleRowDragSwapEvent (evnt: DragEvent | null, isSyncRow: boolean | undefined, dragRow: any, prevDragRow: any, prevDragPos: '' | 'top' | 'bottom' | 'left' | 'right' | undefined, prevDragToChild: boolean | undefined) {
|
|
6547
6668
|
const $xeTable = this as VxeTableConstructor & VxeTablePrivateMethods
|
|
6548
6669
|
const props = $xeTable
|
|
6549
6670
|
const reactData = $xeTable as unknown as TableReactData
|
|
@@ -6559,6 +6680,9 @@ const Methods = {
|
|
|
6559
6680
|
const { afterFullData, tableFullData } = internalData
|
|
6560
6681
|
const dEndMethod = dragEndMethod || (dragConfig ? dragConfig.dragEndMethod : null)
|
|
6561
6682
|
const dragOffsetIndex = prevDragPos === 'bottom' ? 1 : 0
|
|
6683
|
+
const errRest = {
|
|
6684
|
+
status: false
|
|
6685
|
+
}
|
|
6562
6686
|
if (prevDragRow && dragRow) {
|
|
6563
6687
|
// 判断是否有拖动
|
|
6564
6688
|
if (prevDragRow !== dragRow) {
|
|
@@ -6573,7 +6697,7 @@ const Methods = {
|
|
|
6573
6697
|
const isDragToChildFlag = isSelfToChildDrag && dragToChildMethod ? dragToChildMethod(dragParams) : prevDragToChild
|
|
6574
6698
|
return Promise.resolve(dEndMethod ? dEndMethod(dragParams) : true).then((status) => {
|
|
6575
6699
|
if (!status) {
|
|
6576
|
-
return
|
|
6700
|
+
return errRest
|
|
6577
6701
|
}
|
|
6578
6702
|
|
|
6579
6703
|
let oafIndex = -1
|
|
@@ -6604,11 +6728,11 @@ const Methods = {
|
|
|
6604
6728
|
if (isPeerDrag && !isCrossDrag) {
|
|
6605
6729
|
if (oldRest.row[parentField] !== newRest.row[parentField]) {
|
|
6606
6730
|
// 非同级
|
|
6607
|
-
return
|
|
6731
|
+
return errRest
|
|
6608
6732
|
}
|
|
6609
6733
|
} else {
|
|
6610
6734
|
if (!isCrossDrag) {
|
|
6611
|
-
return
|
|
6735
|
+
return errRest
|
|
6612
6736
|
}
|
|
6613
6737
|
if (oldAllMaps[newRowid]) {
|
|
6614
6738
|
isSelfToChildStatus = true
|
|
@@ -6619,7 +6743,7 @@ const Methods = {
|
|
|
6619
6743
|
content: getI18n('vxe.error.treeDragChild')
|
|
6620
6744
|
})
|
|
6621
6745
|
}
|
|
6622
|
-
return
|
|
6746
|
+
return errRest
|
|
6623
6747
|
}
|
|
6624
6748
|
}
|
|
6625
6749
|
}
|
|
@@ -6627,13 +6751,13 @@ const Methods = {
|
|
|
6627
6751
|
// 子到根
|
|
6628
6752
|
|
|
6629
6753
|
if (!isCrossDrag) {
|
|
6630
|
-
return
|
|
6754
|
+
return errRest
|
|
6631
6755
|
}
|
|
6632
6756
|
} else if (newLevel) {
|
|
6633
6757
|
// 根到子
|
|
6634
6758
|
|
|
6635
6759
|
if (!isCrossDrag) {
|
|
6636
|
-
return
|
|
6760
|
+
return errRest
|
|
6637
6761
|
}
|
|
6638
6762
|
if (oldAllMaps[newRowid]) {
|
|
6639
6763
|
isSelfToChildStatus = true
|
|
@@ -6644,7 +6768,7 @@ const Methods = {
|
|
|
6644
6768
|
content: getI18n('vxe.error.treeDragChild')
|
|
6645
6769
|
})
|
|
6646
6770
|
}
|
|
6647
|
-
return
|
|
6771
|
+
return errRest
|
|
6648
6772
|
}
|
|
6649
6773
|
}
|
|
6650
6774
|
} else {
|
|
@@ -6708,28 +6832,36 @@ const Methods = {
|
|
|
6708
6832
|
if (reactData.scrollYLoad) {
|
|
6709
6833
|
$xeTable.updateScrollYSpace()
|
|
6710
6834
|
}
|
|
6711
|
-
|
|
6835
|
+
|
|
6836
|
+
if (evnt) {
|
|
6837
|
+
$xeTable.dispatchEvent('row-dragend', {
|
|
6838
|
+
oldRow: dragRow,
|
|
6839
|
+
newRow: prevDragRow,
|
|
6840
|
+
dragRow,
|
|
6841
|
+
dragPos: prevDragPos as any,
|
|
6842
|
+
dragToChild: isDragToChildFlag,
|
|
6843
|
+
offsetIndex: dragOffsetIndex,
|
|
6844
|
+
_index: {
|
|
6845
|
+
newIndex: nafIndex,
|
|
6846
|
+
oldIndex: oafIndex
|
|
6847
|
+
}
|
|
6848
|
+
}, evnt)
|
|
6849
|
+
}
|
|
6850
|
+
|
|
6851
|
+
return $xeTable.$nextTick().then(() => {
|
|
6712
6852
|
$xeTable.updateCellAreas()
|
|
6713
6853
|
$xeTable.recalculate()
|
|
6714
|
-
})
|
|
6715
|
-
|
|
6716
|
-
|
|
6717
|
-
oldRow: dragRow,
|
|
6718
|
-
newRow: prevDragRow,
|
|
6719
|
-
dragRow,
|
|
6720
|
-
dragPos: prevDragPos as any,
|
|
6721
|
-
dragToChild: isDragToChildFlag,
|
|
6722
|
-
offsetIndex: dragOffsetIndex,
|
|
6723
|
-
_index: {
|
|
6724
|
-
newIndex: nafIndex,
|
|
6725
|
-
oldIndex: oafIndex
|
|
6854
|
+
}).then(() => {
|
|
6855
|
+
return {
|
|
6856
|
+
status: true
|
|
6726
6857
|
}
|
|
6727
|
-
}
|
|
6858
|
+
})
|
|
6728
6859
|
}).catch(() => {
|
|
6860
|
+
return errRest
|
|
6729
6861
|
})
|
|
6730
6862
|
}
|
|
6731
6863
|
}
|
|
6732
|
-
return Promise.resolve()
|
|
6864
|
+
return Promise.resolve(errRest)
|
|
6733
6865
|
},
|
|
6734
6866
|
handleRowDragDragendEvent (evnt: DragEvent) {
|
|
6735
6867
|
const $xeTable = this as VxeTableConstructor & VxeTablePrivateMethods
|
|
@@ -6868,7 +7000,7 @@ const Methods = {
|
|
|
6868
7000
|
$xeTable.saveCustomStore('update:sort')
|
|
6869
7001
|
})
|
|
6870
7002
|
},
|
|
6871
|
-
handleColDragSwapEvent (evnt: DragEvent, isSyncColumn: boolean | undefined, dragCol: VxeTableDefines.ColumnInfo | null | undefined, prevDragCol: VxeTableDefines.ColumnInfo | undefined, prevDragPos: '' | 'top' | 'bottom' | 'left' | 'right' | undefined, prevDragToChild: boolean | undefined) {
|
|
7003
|
+
handleColDragSwapEvent (evnt: DragEvent | null, isSyncColumn: boolean | undefined, dragCol: VxeTableDefines.ColumnInfo | null | undefined, prevDragCol: VxeTableDefines.ColumnInfo | undefined, prevDragPos: '' | 'top' | 'bottom' | 'left' | 'right' | undefined, prevDragToChild: boolean | undefined) {
|
|
6872
7004
|
const $xeTable = this
|
|
6873
7005
|
const props = $xeTable
|
|
6874
7006
|
const reactData = $xeTable
|
|
@@ -6879,6 +7011,9 @@ const Methods = {
|
|
|
6879
7011
|
const { isPeerDrag, isCrossDrag, isSelfToChildDrag, isToChildDrag, dragEndMethod, dragToChildMethod } = columnDragOpts
|
|
6880
7012
|
const { collectColumn } = internalData
|
|
6881
7013
|
const dragOffsetIndex = prevDragPos === 'right' ? 1 : 0
|
|
7014
|
+
const errRest = {
|
|
7015
|
+
status: false
|
|
7016
|
+
}
|
|
6882
7017
|
if (prevDragCol && dragCol) {
|
|
6883
7018
|
// 判断是否有拖动
|
|
6884
7019
|
if (prevDragCol !== dragCol) {
|
|
@@ -6895,7 +7030,7 @@ const Methods = {
|
|
|
6895
7030
|
const isDragToChildFlag = isSelfToChildDrag && dragToChildMethod ? dragToChildMethod(dragParams) : prevDragToChild
|
|
6896
7031
|
return Promise.resolve(dragEndMethod ? dragEndMethod(dragParams) : true).then((status) => {
|
|
6897
7032
|
if (!status) {
|
|
6898
|
-
return
|
|
7033
|
+
return errRest
|
|
6899
7034
|
}
|
|
6900
7035
|
|
|
6901
7036
|
let oafIndex = -1
|
|
@@ -6914,11 +7049,11 @@ const Methods = {
|
|
|
6914
7049
|
if (isPeerDrag && !isCrossDrag) {
|
|
6915
7050
|
if (dragColumn.parentId !== newColumn.parentId) {
|
|
6916
7051
|
// 非同级
|
|
6917
|
-
return
|
|
7052
|
+
return errRest
|
|
6918
7053
|
}
|
|
6919
7054
|
} else {
|
|
6920
7055
|
if (!isCrossDrag) {
|
|
6921
|
-
return
|
|
7056
|
+
return errRest
|
|
6922
7057
|
}
|
|
6923
7058
|
|
|
6924
7059
|
if (oldAllMaps[newColumn.id]) {
|
|
@@ -6930,7 +7065,7 @@ const Methods = {
|
|
|
6930
7065
|
content: getI18n('vxe.error.treeDragChild')
|
|
6931
7066
|
})
|
|
6932
7067
|
}
|
|
6933
|
-
return
|
|
7068
|
+
return errRest
|
|
6934
7069
|
}
|
|
6935
7070
|
}
|
|
6936
7071
|
}
|
|
@@ -6938,13 +7073,13 @@ const Methods = {
|
|
|
6938
7073
|
// 子到根
|
|
6939
7074
|
|
|
6940
7075
|
if (!isCrossDrag) {
|
|
6941
|
-
return
|
|
7076
|
+
return errRest
|
|
6942
7077
|
}
|
|
6943
7078
|
} else if (newColumn.parentId) {
|
|
6944
7079
|
// 根到子
|
|
6945
7080
|
|
|
6946
7081
|
if (!isCrossDrag) {
|
|
6947
|
-
return
|
|
7082
|
+
return errRest
|
|
6948
7083
|
}
|
|
6949
7084
|
if (oldAllMaps[newColumn.id]) {
|
|
6950
7085
|
isSelfToChildStatus = true
|
|
@@ -6955,7 +7090,7 @@ const Methods = {
|
|
|
6955
7090
|
content: getI18n('vxe.error.treeDragChild')
|
|
6956
7091
|
})
|
|
6957
7092
|
}
|
|
6958
|
-
return
|
|
7093
|
+
return errRest
|
|
6959
7094
|
}
|
|
6960
7095
|
}
|
|
6961
7096
|
} else {
|
|
@@ -7019,27 +7154,34 @@ const Methods = {
|
|
|
7019
7154
|
}
|
|
7020
7155
|
}
|
|
7021
7156
|
|
|
7022
|
-
|
|
7023
|
-
|
|
7024
|
-
|
|
7025
|
-
|
|
7026
|
-
|
|
7027
|
-
|
|
7028
|
-
|
|
7029
|
-
|
|
7030
|
-
|
|
7031
|
-
|
|
7032
|
-
|
|
7033
|
-
|
|
7157
|
+
if (evnt) {
|
|
7158
|
+
$xeTable.dispatchEvent('column-dragend', {
|
|
7159
|
+
oldColumn: dragColumn,
|
|
7160
|
+
newColumn,
|
|
7161
|
+
dragColumn,
|
|
7162
|
+
dragPos: prevDragPos,
|
|
7163
|
+
dragToChild: isDragToChildFlag,
|
|
7164
|
+
offsetIndex: dragOffsetIndex,
|
|
7165
|
+
_index: {
|
|
7166
|
+
newIndex: nafIndex,
|
|
7167
|
+
oldIndex: oafIndex
|
|
7168
|
+
}
|
|
7169
|
+
}, evnt)
|
|
7170
|
+
}
|
|
7034
7171
|
|
|
7035
7172
|
if (isSyncColumn) {
|
|
7036
7173
|
$xeTable.handleColDragSwapColumn()
|
|
7037
7174
|
}
|
|
7175
|
+
|
|
7176
|
+
return {
|
|
7177
|
+
status: true
|
|
7178
|
+
}
|
|
7038
7179
|
}).catch(() => {
|
|
7180
|
+
return errRest
|
|
7039
7181
|
})
|
|
7040
7182
|
}
|
|
7041
7183
|
}
|
|
7042
|
-
return Promise.resolve()
|
|
7184
|
+
return Promise.resolve(errRest)
|
|
7043
7185
|
},
|
|
7044
7186
|
handleHeaderCellDragDragendEvent (evnt: DragEvent) {
|
|
7045
7187
|
const $xeTable = this
|
|
@@ -102,14 +102,21 @@ export function getRowUniqueId () {
|
|
|
102
102
|
}
|
|
103
103
|
|
|
104
104
|
// 行主键 key
|
|
105
|
-
export function getRowkey ($
|
|
106
|
-
|
|
105
|
+
export function getRowkey ($xeTable: any) {
|
|
106
|
+
const props = $xeTable
|
|
107
|
+
const rowOpts = $xeTable.computeRowOpts
|
|
108
|
+
return `${props.rowId || rowOpts.keyField || '_X_ROW_KEY'}`
|
|
107
109
|
}
|
|
108
110
|
|
|
109
111
|
// 行主键 value
|
|
110
112
|
export function getRowid ($xetable: any, row: any) {
|
|
111
113
|
const rowid = XEUtils.get(row, getRowkey($xetable))
|
|
112
|
-
return
|
|
114
|
+
return encodeRowid(rowid)
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
// 编码行主键
|
|
118
|
+
export function encodeRowid (rowVal: string) {
|
|
119
|
+
return XEUtils.eqNull(rowVal) ? '' : encodeURIComponent(rowVal)
|
|
113
120
|
}
|
|
114
121
|
|
|
115
122
|
function getPaddingLeftRightSize (elem: any) {
|
|
@@ -139,9 +146,17 @@ export function getCellHeight (height: number | 'unset' | undefined | null) {
|
|
|
139
146
|
return height || 0
|
|
140
147
|
}
|
|
141
148
|
|
|
142
|
-
export function handleFieldOrColumn (
|
|
149
|
+
export function handleFieldOrColumn ($xeTable: VxeTableConstructor, fieldOrColumn: any) {
|
|
143
150
|
if (fieldOrColumn) {
|
|
144
|
-
return XEUtils.isString(fieldOrColumn) || XEUtils.isNumber(fieldOrColumn) ?
|
|
151
|
+
return XEUtils.isString(fieldOrColumn) || XEUtils.isNumber(fieldOrColumn) ? $xeTable.getColumnByField(`${fieldOrColumn}`) : fieldOrColumn
|
|
152
|
+
}
|
|
153
|
+
return null
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
export const handleRowidOrRow = ($xeTable: VxeTableConstructor, rowidOrRow: any) => {
|
|
157
|
+
if (rowidOrRow) {
|
|
158
|
+
const rowid = XEUtils.isString(rowidOrRow) || XEUtils.isNumber(rowidOrRow) ? rowidOrRow : getRowid($xeTable, rowidOrRow)
|
|
159
|
+
return $xeTable.getRowById(rowid)
|
|
145
160
|
}
|
|
146
161
|
return null
|
|
147
162
|
}
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|