vxe-table 3.13.19 → 3.13.21
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 +17 -8
- 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 +197 -62
- 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 +17 -8
- package/lib/grid/src/grid.min.js +1 -1
- package/lib/index.umd.js +284 -97
- 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 +228 -75
- 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 +18 -8
- package/packages/table/src/body.ts +10 -5
- package/packages/table/src/footer.ts +7 -2
- package/packages/table/src/methods.ts +218 -69
- package/packages/table/src/util.ts +20 -5
- /package/es/{iconfont.1741224103306.ttf → iconfont.1741336846919.ttf} +0 -0
- /package/es/{iconfont.1741224103306.woff → iconfont.1741336846919.woff} +0 -0
- /package/es/{iconfont.1741224103306.woff2 → iconfont.1741336846919.woff2} +0 -0
- /package/lib/{iconfont.1741224103306.ttf → iconfont.1741336846919.ttf} +0 -0
- /package/lib/{iconfont.1741224103306.woff → iconfont.1741336846919.woff} +0 -0
- /package/lib/{iconfont.1741224103306.woff2 → iconfont.1741336846919.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
|
*/
|
|
@@ -2703,20 +2708,23 @@ const Methods = {
|
|
|
2703
2708
|
reactData.treeExpandedMaps = treeTempExpandedMaps
|
|
2704
2709
|
},
|
|
2705
2710
|
cacheSourceMap (fullData: any[]) {
|
|
2706
|
-
|
|
2711
|
+
const $xeTable = this as VxeTableConstructor & VxeTablePrivateMethods
|
|
2712
|
+
const props = $xeTable
|
|
2713
|
+
const internalData = $xeTable as unknown as TableInternalData
|
|
2714
|
+
|
|
2715
|
+
const { treeConfig } = props
|
|
2716
|
+
const treeOpts = $xeTable.computeTreeOpts
|
|
2717
|
+
let { sourceDataRowIdData } = internalData
|
|
2707
2718
|
const sourceData = XEUtils.clone(fullData, true)
|
|
2708
|
-
const rowkey = getRowkey(
|
|
2709
|
-
sourceDataRowIdData =
|
|
2719
|
+
const rowkey = getRowkey($xeTable)
|
|
2720
|
+
sourceDataRowIdData = internalData.sourceDataRowIdData = {}
|
|
2710
2721
|
const handleSourceRow = (row: any) => {
|
|
2711
|
-
let rowid = getRowid(
|
|
2722
|
+
let rowid = getRowid($xeTable, row)
|
|
2712
2723
|
if (eqEmptyValue(rowid)) {
|
|
2713
2724
|
rowid = getRowUniqueId()
|
|
2714
2725
|
XEUtils.set(row, rowkey, rowid)
|
|
2715
2726
|
}
|
|
2716
|
-
sourceDataRowIdData[rowid] =
|
|
2717
|
-
row,
|
|
2718
|
-
rowid
|
|
2719
|
-
}
|
|
2727
|
+
sourceDataRowIdData[rowid] = row
|
|
2720
2728
|
}
|
|
2721
2729
|
// 源数据缓存
|
|
2722
2730
|
if (treeConfig) {
|
|
@@ -2725,7 +2733,7 @@ const Methods = {
|
|
|
2725
2733
|
} else {
|
|
2726
2734
|
sourceData.forEach(handleSourceRow)
|
|
2727
2735
|
}
|
|
2728
|
-
|
|
2736
|
+
internalData.tableSourceData = sourceData
|
|
2729
2737
|
},
|
|
2730
2738
|
getParams () {
|
|
2731
2739
|
return this.params
|
|
@@ -3042,7 +3050,9 @@ const Methods = {
|
|
|
3042
3050
|
const internalData = $xeTable as unknown as TableInternalData
|
|
3043
3051
|
|
|
3044
3052
|
const { keepSource, treeConfig } = props
|
|
3053
|
+
const { editStore } = reactData
|
|
3045
3054
|
const { fullAllDataRowIdData, fullDataRowIdData, tableSourceData, sourceDataRowIdData, tableFullData, afterFullData } = internalData
|
|
3055
|
+
const removeTempMaps = { ...editStore.removeMaps }
|
|
3046
3056
|
const treeOpts = $xeTable.computeTreeOpts
|
|
3047
3057
|
const { transform } = treeOpts
|
|
3048
3058
|
if (!keepSource) {
|
|
@@ -3075,6 +3085,7 @@ const Methods = {
|
|
|
3075
3085
|
XEUtils.destructuring(row, XEUtils.clone(oRow, true))
|
|
3076
3086
|
}
|
|
3077
3087
|
if (!fullDataRowIdData[rowid] && $xeTable.isRemoveByRow(row)) {
|
|
3088
|
+
delete removeTempMaps[rowid]
|
|
3078
3089
|
tableFullData.unshift(row)
|
|
3079
3090
|
afterFullData.unshift(row)
|
|
3080
3091
|
reDelFlag = true
|
|
@@ -3086,6 +3097,7 @@ const Methods = {
|
|
|
3086
3097
|
}
|
|
3087
3098
|
if (rows) {
|
|
3088
3099
|
if (reDelFlag) {
|
|
3100
|
+
editStore.removeMaps = removeTempMaps
|
|
3089
3101
|
$xeTable.updateFooter()
|
|
3090
3102
|
$xeTable.cacheRowMap(false)
|
|
3091
3103
|
$xeTable.handleTableData(treeConfig && transform)
|
|
@@ -3247,22 +3259,28 @@ const Methods = {
|
|
|
3247
3259
|
},
|
|
3248
3260
|
/**
|
|
3249
3261
|
* 检查行或列数据是否发生改变
|
|
3250
|
-
* @param {Row}
|
|
3262
|
+
* @param {Row} rowOrId 行对象
|
|
3251
3263
|
* @param {String} field 字段名
|
|
3252
3264
|
*/
|
|
3253
|
-
isUpdateByRow (
|
|
3254
|
-
const
|
|
3265
|
+
isUpdateByRow (rowOrId: any, field?: string | null) {
|
|
3266
|
+
const $xeTable = this as VxeTableConstructor & VxeTablePrivateMethods
|
|
3267
|
+
const props = $xeTable
|
|
3268
|
+
const internalData = $xeTable as unknown as TableInternalData
|
|
3269
|
+
|
|
3270
|
+
const { keepSource } = props
|
|
3271
|
+
const { tableFullColumn, fullDataRowIdData, sourceDataRowIdData } = internalData
|
|
3255
3272
|
if (keepSource) {
|
|
3256
|
-
const rowid = getRowid(
|
|
3273
|
+
const rowid = XEUtils.isString(rowOrId) || XEUtils.isNumber(rowOrId) ? rowOrId : getRowid($xeTable, rowOrId)
|
|
3274
|
+
const rowRest = fullDataRowIdData[rowid]
|
|
3257
3275
|
// 新增的数据不需要检测
|
|
3258
|
-
if (!
|
|
3276
|
+
if (!rowRest) {
|
|
3259
3277
|
return false
|
|
3260
3278
|
}
|
|
3261
|
-
const
|
|
3262
|
-
|
|
3263
|
-
|
|
3279
|
+
const row = rowRest.row
|
|
3280
|
+
const oRow = sourceDataRowIdData[rowid]
|
|
3281
|
+
if (oRow) {
|
|
3264
3282
|
if (arguments.length > 1) {
|
|
3265
|
-
return !eqCellValue(oRow, row, field)
|
|
3283
|
+
return !eqCellValue(oRow, row, field as string)
|
|
3266
3284
|
}
|
|
3267
3285
|
for (let index = 0, len = tableFullColumn.length; index < len; index++) {
|
|
3268
3286
|
const property = tableFullColumn[index].field
|
|
@@ -3322,6 +3340,107 @@ const Methods = {
|
|
|
3322
3340
|
tableColumn: this.tableColumn.slice(0)
|
|
3323
3341
|
}
|
|
3324
3342
|
},
|
|
3343
|
+
/**
|
|
3344
|
+
* 移动列到指定列的位置
|
|
3345
|
+
* @param fieldOrColumn
|
|
3346
|
+
* @param targetFieldOrColumn
|
|
3347
|
+
* @param options
|
|
3348
|
+
*/
|
|
3349
|
+
moveColumnTo (fieldOrColumn: VxeTableDefines.ColumnInfo, targetFieldOrColumn: VxeTableDefines.ColumnInfo, options?: {
|
|
3350
|
+
isCrossDrag?: boolean
|
|
3351
|
+
dragToChild?: boolean;
|
|
3352
|
+
dragPos?: 'left' | 'right' | '' | null;
|
|
3353
|
+
}) {
|
|
3354
|
+
const $xeTable = this as VxeTableConstructor & VxeTablePrivateMethods
|
|
3355
|
+
const internalData = $xeTable as unknown as TableInternalData
|
|
3356
|
+
|
|
3357
|
+
const { fullColumnIdData, visibleColumn } = internalData
|
|
3358
|
+
const { dragToChild, dragPos, isCrossDrag } = Object.assign({}, options)
|
|
3359
|
+
const dragCol = handleFieldOrColumn($xeTable, fieldOrColumn)
|
|
3360
|
+
let prevDragCol: VxeTableDefines.ColumnInfo | null = null
|
|
3361
|
+
const colRest = dragCol ? fullColumnIdData[dragCol.id] : null
|
|
3362
|
+
let defPos: 'left' | 'right' = 'left'
|
|
3363
|
+
if (XEUtils.isNumber(targetFieldOrColumn)) {
|
|
3364
|
+
if (colRest && targetFieldOrColumn) {
|
|
3365
|
+
let currList = colRest.items
|
|
3366
|
+
let offsetIndex = colRest._index + targetFieldOrColumn
|
|
3367
|
+
if (isCrossDrag) {
|
|
3368
|
+
currList = visibleColumn
|
|
3369
|
+
offsetIndex = colRest._index + targetFieldOrColumn
|
|
3370
|
+
}
|
|
3371
|
+
if (offsetIndex > 0 && offsetIndex < currList.length - 1) {
|
|
3372
|
+
prevDragCol = currList[offsetIndex]
|
|
3373
|
+
}
|
|
3374
|
+
if (targetFieldOrColumn > 0) {
|
|
3375
|
+
defPos = 'right'
|
|
3376
|
+
}
|
|
3377
|
+
}
|
|
3378
|
+
} else {
|
|
3379
|
+
prevDragCol = handleFieldOrColumn($xeTable, targetFieldOrColumn)
|
|
3380
|
+
const targetColRest = prevDragCol ? fullColumnIdData[prevDragCol.id] : null
|
|
3381
|
+
if (colRest && targetColRest) {
|
|
3382
|
+
if (targetColRest._index > colRest._index) {
|
|
3383
|
+
defPos = 'right'
|
|
3384
|
+
}
|
|
3385
|
+
}
|
|
3386
|
+
}
|
|
3387
|
+
return $xeTable.handleColDragSwapEvent(null, true, dragCol, prevDragCol, dragPos || defPos, dragToChild === true)
|
|
3388
|
+
},
|
|
3389
|
+
/**
|
|
3390
|
+
* 移动行到指定行的位置
|
|
3391
|
+
* @param rowidOrRow
|
|
3392
|
+
* @param targetRowidOrRow
|
|
3393
|
+
* @param options
|
|
3394
|
+
*/
|
|
3395
|
+
moveRowTo (rowidOrRow: any, targetRowidOrRow: any, options?: {
|
|
3396
|
+
isCrossDrag?: boolean
|
|
3397
|
+
dragToChild?: boolean;
|
|
3398
|
+
dragPos?: 'top' | 'bottom' | '' | null;
|
|
3399
|
+
}) {
|
|
3400
|
+
const $xeTable = this as VxeTableConstructor & VxeTablePrivateMethods
|
|
3401
|
+
const props = $xeTable
|
|
3402
|
+
const internalData = $xeTable as unknown as TableInternalData
|
|
3403
|
+
|
|
3404
|
+
const { treeConfig } = props
|
|
3405
|
+
const { fullAllDataRowIdData, afterFullData } = internalData
|
|
3406
|
+
const { dragToChild, dragPos, isCrossDrag } = Object.assign({}, options)
|
|
3407
|
+
const treeOpts = $xeTable.computeTreeOpts
|
|
3408
|
+
const dragRow = handleRowidOrRow($xeTable, rowidOrRow)
|
|
3409
|
+
let prevDragRow: any = null
|
|
3410
|
+
let defPos: 'top' | 'bottom' = 'top'
|
|
3411
|
+
const rowRest = dragRow ? fullAllDataRowIdData[getRowid($xeTable, dragRow)] : null
|
|
3412
|
+
if (XEUtils.isNumber(targetRowidOrRow)) {
|
|
3413
|
+
if (rowRest && targetRowidOrRow) {
|
|
3414
|
+
let currList = afterFullData
|
|
3415
|
+
let offsetIndex = rowRest._index + targetRowidOrRow
|
|
3416
|
+
if (treeConfig) {
|
|
3417
|
+
currList = rowRest.items
|
|
3418
|
+
if (treeOpts.transform) {
|
|
3419
|
+
offsetIndex = rowRest.treeIndex + targetRowidOrRow
|
|
3420
|
+
if (isCrossDrag) {
|
|
3421
|
+
currList = afterFullData
|
|
3422
|
+
offsetIndex = rowRest._index + targetRowidOrRow
|
|
3423
|
+
}
|
|
3424
|
+
}
|
|
3425
|
+
}
|
|
3426
|
+
if (offsetIndex >= 0 && offsetIndex <= currList.length - 1) {
|
|
3427
|
+
prevDragRow = currList[offsetIndex]
|
|
3428
|
+
}
|
|
3429
|
+
if (targetRowidOrRow > 0) {
|
|
3430
|
+
defPos = 'bottom'
|
|
3431
|
+
}
|
|
3432
|
+
}
|
|
3433
|
+
} else {
|
|
3434
|
+
prevDragRow = handleRowidOrRow($xeTable, targetRowidOrRow)
|
|
3435
|
+
const targetRowRest = prevDragRow ? fullAllDataRowIdData[getRowid($xeTable, prevDragRow)] : null
|
|
3436
|
+
if (rowRest && targetRowRest) {
|
|
3437
|
+
if (targetRowRest._index > rowRest._index) {
|
|
3438
|
+
defPos = 'bottom'
|
|
3439
|
+
}
|
|
3440
|
+
}
|
|
3441
|
+
}
|
|
3442
|
+
return $xeTable.handleRowDragSwapEvent(null, true, dragRow, prevDragRow, dragPos || defPos, dragToChild === true)
|
|
3443
|
+
},
|
|
3325
3444
|
/**
|
|
3326
3445
|
* 获取表格的全量列
|
|
3327
3446
|
*/
|
|
@@ -3342,21 +3461,30 @@ const Methods = {
|
|
|
3342
3461
|
/**
|
|
3343
3462
|
* 用于多选行,获取已选中的数据
|
|
3344
3463
|
*/
|
|
3345
|
-
getCheckboxRecords (isFull:
|
|
3346
|
-
const
|
|
3464
|
+
getCheckboxRecords (isFull: boolean) {
|
|
3465
|
+
const $xeTable = this as VxeTableConstructor & VxeTablePrivateMethods
|
|
3466
|
+
const props = $xeTable
|
|
3467
|
+
const reactData = $xeTable as unknown as TableReactData
|
|
3468
|
+
const internalData = $xeTable as unknown as TableInternalData
|
|
3469
|
+
|
|
3470
|
+
const { treeConfig } = props
|
|
3471
|
+
const { selectCheckboxMaps } = reactData
|
|
3472
|
+
const { tableFullData, afterFullData, afterTreeFullData, tableFullTreeData, fullDataRowIdData, afterFullRowMaps } = internalData
|
|
3473
|
+
const treeOpts = $xeTable.computeTreeOpts
|
|
3474
|
+
const checkboxOpts = $xeTable.computeCheckboxOpts
|
|
3347
3475
|
const { transform, mapChildrenField } = treeOpts
|
|
3348
3476
|
const { checkField } = checkboxOpts
|
|
3349
3477
|
const childrenField = treeOpts.children || treeOpts.childrenField
|
|
3350
|
-
|
|
3351
|
-
let rowList = []
|
|
3478
|
+
let rowList: any[] = []
|
|
3352
3479
|
if (checkField) {
|
|
3353
3480
|
if (treeConfig) {
|
|
3481
|
+
const currTableData = isFull ? (transform ? tableFullTreeData : tableFullData) : (transform ? afterTreeFullData : afterFullData)
|
|
3354
3482
|
rowList = XEUtils.filterTree(currTableData, row => XEUtils.get(row, checkField), { children: transform ? mapChildrenField : childrenField })
|
|
3355
3483
|
} else {
|
|
3356
|
-
|
|
3484
|
+
const currTableData = isFull ? tableFullData : afterFullData
|
|
3485
|
+
rowList = currTableData.filter((row) => XEUtils.get(row, checkField))
|
|
3357
3486
|
}
|
|
3358
3487
|
} else {
|
|
3359
|
-
const { selectCheckboxMaps, fullDataRowIdData } = this
|
|
3360
3488
|
XEUtils.each(selectCheckboxMaps, (row, rowid) => {
|
|
3361
3489
|
if (isFull) {
|
|
3362
3490
|
if (fullDataRowIdData[rowid]) {
|
|
@@ -6543,7 +6671,7 @@ const Methods = {
|
|
|
6543
6671
|
evnt.dataTransfer.setDragImage(getTpImg(), 0, 0)
|
|
6544
6672
|
}
|
|
6545
6673
|
},
|
|
6546
|
-
handleRowDragSwapEvent (evnt: DragEvent, isSyncRow: boolean | undefined, dragRow: any, prevDragRow: any, prevDragPos: '' | 'top' | 'bottom' | 'left' | 'right' | undefined, prevDragToChild: boolean | undefined) {
|
|
6674
|
+
handleRowDragSwapEvent (evnt: DragEvent | null, isSyncRow: boolean | undefined, dragRow: any, prevDragRow: any, prevDragPos: '' | 'top' | 'bottom' | 'left' | 'right' | undefined, prevDragToChild: boolean | undefined) {
|
|
6547
6675
|
const $xeTable = this as VxeTableConstructor & VxeTablePrivateMethods
|
|
6548
6676
|
const props = $xeTable
|
|
6549
6677
|
const reactData = $xeTable as unknown as TableReactData
|
|
@@ -6559,6 +6687,9 @@ const Methods = {
|
|
|
6559
6687
|
const { afterFullData, tableFullData } = internalData
|
|
6560
6688
|
const dEndMethod = dragEndMethod || (dragConfig ? dragConfig.dragEndMethod : null)
|
|
6561
6689
|
const dragOffsetIndex = prevDragPos === 'bottom' ? 1 : 0
|
|
6690
|
+
const errRest = {
|
|
6691
|
+
status: false
|
|
6692
|
+
}
|
|
6562
6693
|
if (prevDragRow && dragRow) {
|
|
6563
6694
|
// 判断是否有拖动
|
|
6564
6695
|
if (prevDragRow !== dragRow) {
|
|
@@ -6573,7 +6704,7 @@ const Methods = {
|
|
|
6573
6704
|
const isDragToChildFlag = isSelfToChildDrag && dragToChildMethod ? dragToChildMethod(dragParams) : prevDragToChild
|
|
6574
6705
|
return Promise.resolve(dEndMethod ? dEndMethod(dragParams) : true).then((status) => {
|
|
6575
6706
|
if (!status) {
|
|
6576
|
-
return
|
|
6707
|
+
return errRest
|
|
6577
6708
|
}
|
|
6578
6709
|
|
|
6579
6710
|
let oafIndex = -1
|
|
@@ -6604,11 +6735,11 @@ const Methods = {
|
|
|
6604
6735
|
if (isPeerDrag && !isCrossDrag) {
|
|
6605
6736
|
if (oldRest.row[parentField] !== newRest.row[parentField]) {
|
|
6606
6737
|
// 非同级
|
|
6607
|
-
return
|
|
6738
|
+
return errRest
|
|
6608
6739
|
}
|
|
6609
6740
|
} else {
|
|
6610
6741
|
if (!isCrossDrag) {
|
|
6611
|
-
return
|
|
6742
|
+
return errRest
|
|
6612
6743
|
}
|
|
6613
6744
|
if (oldAllMaps[newRowid]) {
|
|
6614
6745
|
isSelfToChildStatus = true
|
|
@@ -6619,7 +6750,7 @@ const Methods = {
|
|
|
6619
6750
|
content: getI18n('vxe.error.treeDragChild')
|
|
6620
6751
|
})
|
|
6621
6752
|
}
|
|
6622
|
-
return
|
|
6753
|
+
return errRest
|
|
6623
6754
|
}
|
|
6624
6755
|
}
|
|
6625
6756
|
}
|
|
@@ -6627,13 +6758,13 @@ const Methods = {
|
|
|
6627
6758
|
// 子到根
|
|
6628
6759
|
|
|
6629
6760
|
if (!isCrossDrag) {
|
|
6630
|
-
return
|
|
6761
|
+
return errRest
|
|
6631
6762
|
}
|
|
6632
6763
|
} else if (newLevel) {
|
|
6633
6764
|
// 根到子
|
|
6634
6765
|
|
|
6635
6766
|
if (!isCrossDrag) {
|
|
6636
|
-
return
|
|
6767
|
+
return errRest
|
|
6637
6768
|
}
|
|
6638
6769
|
if (oldAllMaps[newRowid]) {
|
|
6639
6770
|
isSelfToChildStatus = true
|
|
@@ -6644,7 +6775,7 @@ const Methods = {
|
|
|
6644
6775
|
content: getI18n('vxe.error.treeDragChild')
|
|
6645
6776
|
})
|
|
6646
6777
|
}
|
|
6647
|
-
return
|
|
6778
|
+
return errRest
|
|
6648
6779
|
}
|
|
6649
6780
|
}
|
|
6650
6781
|
} else {
|
|
@@ -6708,28 +6839,36 @@ const Methods = {
|
|
|
6708
6839
|
if (reactData.scrollYLoad) {
|
|
6709
6840
|
$xeTable.updateScrollYSpace()
|
|
6710
6841
|
}
|
|
6711
|
-
|
|
6842
|
+
|
|
6843
|
+
if (evnt) {
|
|
6844
|
+
$xeTable.dispatchEvent('row-dragend', {
|
|
6845
|
+
oldRow: dragRow,
|
|
6846
|
+
newRow: prevDragRow,
|
|
6847
|
+
dragRow,
|
|
6848
|
+
dragPos: prevDragPos as any,
|
|
6849
|
+
dragToChild: isDragToChildFlag,
|
|
6850
|
+
offsetIndex: dragOffsetIndex,
|
|
6851
|
+
_index: {
|
|
6852
|
+
newIndex: nafIndex,
|
|
6853
|
+
oldIndex: oafIndex
|
|
6854
|
+
}
|
|
6855
|
+
}, evnt)
|
|
6856
|
+
}
|
|
6857
|
+
|
|
6858
|
+
return $xeTable.$nextTick().then(() => {
|
|
6712
6859
|
$xeTable.updateCellAreas()
|
|
6713
6860
|
$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
|
|
6861
|
+
}).then(() => {
|
|
6862
|
+
return {
|
|
6863
|
+
status: true
|
|
6726
6864
|
}
|
|
6727
|
-
}
|
|
6865
|
+
})
|
|
6728
6866
|
}).catch(() => {
|
|
6867
|
+
return errRest
|
|
6729
6868
|
})
|
|
6730
6869
|
}
|
|
6731
6870
|
}
|
|
6732
|
-
return Promise.resolve()
|
|
6871
|
+
return Promise.resolve(errRest)
|
|
6733
6872
|
},
|
|
6734
6873
|
handleRowDragDragendEvent (evnt: DragEvent) {
|
|
6735
6874
|
const $xeTable = this as VxeTableConstructor & VxeTablePrivateMethods
|
|
@@ -6868,7 +7007,7 @@ const Methods = {
|
|
|
6868
7007
|
$xeTable.saveCustomStore('update:sort')
|
|
6869
7008
|
})
|
|
6870
7009
|
},
|
|
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) {
|
|
7010
|
+
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
7011
|
const $xeTable = this
|
|
6873
7012
|
const props = $xeTable
|
|
6874
7013
|
const reactData = $xeTable
|
|
@@ -6879,6 +7018,9 @@ const Methods = {
|
|
|
6879
7018
|
const { isPeerDrag, isCrossDrag, isSelfToChildDrag, isToChildDrag, dragEndMethod, dragToChildMethod } = columnDragOpts
|
|
6880
7019
|
const { collectColumn } = internalData
|
|
6881
7020
|
const dragOffsetIndex = prevDragPos === 'right' ? 1 : 0
|
|
7021
|
+
const errRest = {
|
|
7022
|
+
status: false
|
|
7023
|
+
}
|
|
6882
7024
|
if (prevDragCol && dragCol) {
|
|
6883
7025
|
// 判断是否有拖动
|
|
6884
7026
|
if (prevDragCol !== dragCol) {
|
|
@@ -6895,7 +7037,7 @@ const Methods = {
|
|
|
6895
7037
|
const isDragToChildFlag = isSelfToChildDrag && dragToChildMethod ? dragToChildMethod(dragParams) : prevDragToChild
|
|
6896
7038
|
return Promise.resolve(dragEndMethod ? dragEndMethod(dragParams) : true).then((status) => {
|
|
6897
7039
|
if (!status) {
|
|
6898
|
-
return
|
|
7040
|
+
return errRest
|
|
6899
7041
|
}
|
|
6900
7042
|
|
|
6901
7043
|
let oafIndex = -1
|
|
@@ -6914,11 +7056,11 @@ const Methods = {
|
|
|
6914
7056
|
if (isPeerDrag && !isCrossDrag) {
|
|
6915
7057
|
if (dragColumn.parentId !== newColumn.parentId) {
|
|
6916
7058
|
// 非同级
|
|
6917
|
-
return
|
|
7059
|
+
return errRest
|
|
6918
7060
|
}
|
|
6919
7061
|
} else {
|
|
6920
7062
|
if (!isCrossDrag) {
|
|
6921
|
-
return
|
|
7063
|
+
return errRest
|
|
6922
7064
|
}
|
|
6923
7065
|
|
|
6924
7066
|
if (oldAllMaps[newColumn.id]) {
|
|
@@ -6930,7 +7072,7 @@ const Methods = {
|
|
|
6930
7072
|
content: getI18n('vxe.error.treeDragChild')
|
|
6931
7073
|
})
|
|
6932
7074
|
}
|
|
6933
|
-
return
|
|
7075
|
+
return errRest
|
|
6934
7076
|
}
|
|
6935
7077
|
}
|
|
6936
7078
|
}
|
|
@@ -6938,13 +7080,13 @@ const Methods = {
|
|
|
6938
7080
|
// 子到根
|
|
6939
7081
|
|
|
6940
7082
|
if (!isCrossDrag) {
|
|
6941
|
-
return
|
|
7083
|
+
return errRest
|
|
6942
7084
|
}
|
|
6943
7085
|
} else if (newColumn.parentId) {
|
|
6944
7086
|
// 根到子
|
|
6945
7087
|
|
|
6946
7088
|
if (!isCrossDrag) {
|
|
6947
|
-
return
|
|
7089
|
+
return errRest
|
|
6948
7090
|
}
|
|
6949
7091
|
if (oldAllMaps[newColumn.id]) {
|
|
6950
7092
|
isSelfToChildStatus = true
|
|
@@ -6955,7 +7097,7 @@ const Methods = {
|
|
|
6955
7097
|
content: getI18n('vxe.error.treeDragChild')
|
|
6956
7098
|
})
|
|
6957
7099
|
}
|
|
6958
|
-
return
|
|
7100
|
+
return errRest
|
|
6959
7101
|
}
|
|
6960
7102
|
}
|
|
6961
7103
|
} else {
|
|
@@ -7019,27 +7161,34 @@ const Methods = {
|
|
|
7019
7161
|
}
|
|
7020
7162
|
}
|
|
7021
7163
|
|
|
7022
|
-
|
|
7023
|
-
|
|
7024
|
-
|
|
7025
|
-
|
|
7026
|
-
|
|
7027
|
-
|
|
7028
|
-
|
|
7029
|
-
|
|
7030
|
-
|
|
7031
|
-
|
|
7032
|
-
|
|
7033
|
-
|
|
7164
|
+
if (evnt) {
|
|
7165
|
+
$xeTable.dispatchEvent('column-dragend', {
|
|
7166
|
+
oldColumn: dragColumn,
|
|
7167
|
+
newColumn,
|
|
7168
|
+
dragColumn,
|
|
7169
|
+
dragPos: prevDragPos,
|
|
7170
|
+
dragToChild: isDragToChildFlag,
|
|
7171
|
+
offsetIndex: dragOffsetIndex,
|
|
7172
|
+
_index: {
|
|
7173
|
+
newIndex: nafIndex,
|
|
7174
|
+
oldIndex: oafIndex
|
|
7175
|
+
}
|
|
7176
|
+
}, evnt)
|
|
7177
|
+
}
|
|
7034
7178
|
|
|
7035
7179
|
if (isSyncColumn) {
|
|
7036
7180
|
$xeTable.handleColDragSwapColumn()
|
|
7037
7181
|
}
|
|
7182
|
+
|
|
7183
|
+
return {
|
|
7184
|
+
status: true
|
|
7185
|
+
}
|
|
7038
7186
|
}).catch(() => {
|
|
7187
|
+
return errRest
|
|
7039
7188
|
})
|
|
7040
7189
|
}
|
|
7041
7190
|
}
|
|
7042
|
-
return Promise.resolve()
|
|
7191
|
+
return Promise.resolve(errRest)
|
|
7043
7192
|
},
|
|
7044
7193
|
handleHeaderCellDragDragendEvent (evnt: DragEvent) {
|
|
7045
7194
|
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
|