vxe-table 3.13.18 → 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/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/methods.js +222 -77
- 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 +384 -164
- 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/methods.js +247 -88
- 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/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/methods.ts +242 -84
- package/packages/table/src/util.ts +20 -5
- /package/es/{iconfont.1741140503645.ttf → iconfont.1741333380103.ttf} +0 -0
- /package/es/{iconfont.1741140503645.woff → iconfont.1741333380103.woff} +0 -0
- /package/es/{iconfont.1741140503645.woff2 → iconfont.1741333380103.woff2} +0 -0
- /package/lib/{iconfont.1741140503645.ttf → iconfont.1741333380103.ttf} +0 -0
- /package/lib/{iconfont.1741140503645.woff → iconfont.1741333380103.woff} +0 -0
- /package/lib/{iconfont.1741140503645.woff2 → iconfont.1741333380103.woff2} +0 -0
|
@@ -3,11 +3,11 @@ 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
|
|
|
10
|
-
import type { VxeTableDefines, VxeColumnPropTypes, VxeTableEmits, ValueOf, TableReactData, VxeTableConstructor, VxeToolbarConstructor, TableInternalData, VxeTablePrivateMethods, VxeTooltipInstance, VxeTablePropTypes } from '../../../types'
|
|
10
|
+
import type { VxeTableDefines, VxeColumnPropTypes, VxeTableEmits, ValueOf, TableReactData, VxeTableConstructor, VxeToolbarConstructor, TableInternalData, VxeGridConstructor, GridPrivateMethods, VxeTablePrivateMethods, VxeTooltipInstance, VxeTablePropTypes } from '../../../types'
|
|
11
11
|
|
|
12
12
|
const { getConfig, getI18n, renderer, formats, interceptor, createEvent } = VxeUI
|
|
13
13
|
|
|
@@ -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
|
*/
|
|
@@ -2297,10 +2302,26 @@ const Methods = {
|
|
|
2297
2302
|
* 获取父容器的高度
|
|
2298
2303
|
*/
|
|
2299
2304
|
getParentHeight () {
|
|
2300
|
-
const
|
|
2301
|
-
const
|
|
2302
|
-
const
|
|
2303
|
-
|
|
2305
|
+
const $xeTable = this as VxeTableConstructor & VxeTablePrivateMethods
|
|
2306
|
+
const $xeGrid = $xeTable.$xeGrid as VxeGridConstructor & GridPrivateMethods
|
|
2307
|
+
const props = $xeTable
|
|
2308
|
+
|
|
2309
|
+
const { height } = props
|
|
2310
|
+
const el = $xeTable.$refs.refElem as HTMLDivElement
|
|
2311
|
+
if (el) {
|
|
2312
|
+
const parentElem = el.parentNode as HTMLElement
|
|
2313
|
+
const parentPaddingSize = height === '100%' || height === 'auto' ? getPaddingTopBottomSize(parentElem) : 0
|
|
2314
|
+
let parentWrapperHeight = 0
|
|
2315
|
+
if (parentElem) {
|
|
2316
|
+
if ($xeGrid && hasClass(parentElem, 'vxe-grid--table-wrapper')) {
|
|
2317
|
+
parentWrapperHeight = $xeGrid.getParentHeight()
|
|
2318
|
+
} else {
|
|
2319
|
+
parentWrapperHeight = parentElem.clientHeight
|
|
2320
|
+
}
|
|
2321
|
+
}
|
|
2322
|
+
return Math.floor(parentWrapperHeight - parentPaddingSize)
|
|
2323
|
+
}
|
|
2324
|
+
return 0
|
|
2304
2325
|
},
|
|
2305
2326
|
/**
|
|
2306
2327
|
* 获取需要排除的高度
|
|
@@ -2485,7 +2506,7 @@ const Methods = {
|
|
|
2485
2506
|
// warnLog('vxe.error.reqProp', ['table.show-overflow'])
|
|
2486
2507
|
// }
|
|
2487
2508
|
if (this.spanMethod) {
|
|
2488
|
-
|
|
2509
|
+
errLog('vxe.error.scrollErrProp', ['table.span-method'])
|
|
2489
2510
|
}
|
|
2490
2511
|
}
|
|
2491
2512
|
|
|
@@ -3026,12 +3047,12 @@ const Methods = {
|
|
|
3026
3047
|
const internalData = $xeTable as unknown as TableInternalData
|
|
3027
3048
|
|
|
3028
3049
|
const { keepSource, treeConfig } = props
|
|
3029
|
-
const { fullAllDataRowIdData, tableSourceData, sourceDataRowIdData, tableFullData, afterFullData } = internalData
|
|
3050
|
+
const { fullAllDataRowIdData, fullDataRowIdData, tableSourceData, sourceDataRowIdData, tableFullData, afterFullData } = internalData
|
|
3030
3051
|
const treeOpts = $xeTable.computeTreeOpts
|
|
3031
3052
|
const { transform } = treeOpts
|
|
3032
3053
|
if (!keepSource) {
|
|
3033
3054
|
if (process.env.VUE_APP_VXE_ENV === 'development') {
|
|
3034
|
-
|
|
3055
|
+
errLog('vxe.error.reqProp', ['keep-source'])
|
|
3035
3056
|
}
|
|
3036
3057
|
return $xeTable.$nextTick()
|
|
3037
3058
|
}
|
|
@@ -3045,22 +3066,22 @@ const Methods = {
|
|
|
3045
3066
|
}
|
|
3046
3067
|
let reDelFlag = false
|
|
3047
3068
|
if (targetRows.length) {
|
|
3048
|
-
targetRows.forEach((
|
|
3049
|
-
|
|
3050
|
-
|
|
3051
|
-
|
|
3052
|
-
|
|
3053
|
-
|
|
3054
|
-
|
|
3055
|
-
|
|
3056
|
-
|
|
3057
|
-
|
|
3058
|
-
|
|
3059
|
-
|
|
3060
|
-
|
|
3061
|
-
|
|
3062
|
-
tableFullData.unshift(
|
|
3063
|
-
afterFullData.unshift(
|
|
3069
|
+
targetRows.forEach((item: any) => {
|
|
3070
|
+
const rowid = getRowid($xeTable, item)
|
|
3071
|
+
const rowRest = fullAllDataRowIdData[rowid]
|
|
3072
|
+
if (rowRest) {
|
|
3073
|
+
const row = rowRest.row
|
|
3074
|
+
if (!$xeTable.isInsertByRow(row)) {
|
|
3075
|
+
const oRow = sourceDataRowIdData[rowid]
|
|
3076
|
+
if (oRow && row) {
|
|
3077
|
+
if (field) {
|
|
3078
|
+
XEUtils.set(row, field, XEUtils.clone(XEUtils.get(oRow, field), true))
|
|
3079
|
+
} else {
|
|
3080
|
+
XEUtils.destructuring(row, XEUtils.clone(oRow, true))
|
|
3081
|
+
}
|
|
3082
|
+
if (!fullDataRowIdData[rowid] && $xeTable.isRemoveByRow(row)) {
|
|
3083
|
+
tableFullData.unshift(row)
|
|
3084
|
+
afterFullData.unshift(row)
|
|
3064
3085
|
reDelFlag = true
|
|
3065
3086
|
}
|
|
3066
3087
|
}
|
|
@@ -3231,22 +3252,28 @@ const Methods = {
|
|
|
3231
3252
|
},
|
|
3232
3253
|
/**
|
|
3233
3254
|
* 检查行或列数据是否发生改变
|
|
3234
|
-
* @param {Row}
|
|
3255
|
+
* @param {Row} rowOrId 行对象
|
|
3235
3256
|
* @param {String} field 字段名
|
|
3236
3257
|
*/
|
|
3237
|
-
isUpdateByRow (
|
|
3238
|
-
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
|
|
3239
3265
|
if (keepSource) {
|
|
3240
|
-
const rowid = getRowid(
|
|
3266
|
+
const rowid = XEUtils.isString(rowOrId) || XEUtils.isNumber(rowOrId) ? rowOrId : getRowid($xeTable, rowOrId)
|
|
3267
|
+
const rowRest = fullDataRowIdData[rowid]
|
|
3241
3268
|
// 新增的数据不需要检测
|
|
3242
|
-
if (!
|
|
3269
|
+
if (!rowRest) {
|
|
3243
3270
|
return false
|
|
3244
3271
|
}
|
|
3245
|
-
const
|
|
3246
|
-
|
|
3247
|
-
|
|
3272
|
+
const row = rowRest.row
|
|
3273
|
+
const oRow = sourceDataRowIdData[rowid]
|
|
3274
|
+
if (oRow) {
|
|
3248
3275
|
if (arguments.length > 1) {
|
|
3249
|
-
return !eqCellValue(oRow, row, field)
|
|
3276
|
+
return !eqCellValue(oRow, row, field as string)
|
|
3250
3277
|
}
|
|
3251
3278
|
for (let index = 0, len = tableFullColumn.length; index < len; index++) {
|
|
3252
3279
|
const property = tableFullColumn[index].field
|
|
@@ -3306,6 +3333,107 @@ const Methods = {
|
|
|
3306
3333
|
tableColumn: this.tableColumn.slice(0)
|
|
3307
3334
|
}
|
|
3308
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
|
+
},
|
|
3309
3437
|
/**
|
|
3310
3438
|
* 获取表格的全量列
|
|
3311
3439
|
*/
|
|
@@ -3326,21 +3454,30 @@ const Methods = {
|
|
|
3326
3454
|
/**
|
|
3327
3455
|
* 用于多选行,获取已选中的数据
|
|
3328
3456
|
*/
|
|
3329
|
-
getCheckboxRecords (isFull:
|
|
3330
|
-
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
|
|
3331
3468
|
const { transform, mapChildrenField } = treeOpts
|
|
3332
3469
|
const { checkField } = checkboxOpts
|
|
3333
3470
|
const childrenField = treeOpts.children || treeOpts.childrenField
|
|
3334
|
-
|
|
3335
|
-
let rowList = []
|
|
3471
|
+
let rowList: any[] = []
|
|
3336
3472
|
if (checkField) {
|
|
3337
3473
|
if (treeConfig) {
|
|
3474
|
+
const currTableData = isFull ? (transform ? tableFullTreeData : tableFullData) : (transform ? afterTreeFullData : afterFullData)
|
|
3338
3475
|
rowList = XEUtils.filterTree(currTableData, row => XEUtils.get(row, checkField), { children: transform ? mapChildrenField : childrenField })
|
|
3339
3476
|
} else {
|
|
3340
|
-
|
|
3477
|
+
const currTableData = isFull ? tableFullData : afterFullData
|
|
3478
|
+
rowList = currTableData.filter((row) => XEUtils.get(row, checkField))
|
|
3341
3479
|
}
|
|
3342
3480
|
} else {
|
|
3343
|
-
const { selectCheckboxMaps, fullDataRowIdData } = this
|
|
3344
3481
|
XEUtils.each(selectCheckboxMaps, (row, rowid) => {
|
|
3345
3482
|
if (isFull) {
|
|
3346
3483
|
if (fullDataRowIdData[rowid]) {
|
|
@@ -6527,7 +6664,7 @@ const Methods = {
|
|
|
6527
6664
|
evnt.dataTransfer.setDragImage(getTpImg(), 0, 0)
|
|
6528
6665
|
}
|
|
6529
6666
|
},
|
|
6530
|
-
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) {
|
|
6531
6668
|
const $xeTable = this as VxeTableConstructor & VxeTablePrivateMethods
|
|
6532
6669
|
const props = $xeTable
|
|
6533
6670
|
const reactData = $xeTable as unknown as TableReactData
|
|
@@ -6543,6 +6680,9 @@ const Methods = {
|
|
|
6543
6680
|
const { afterFullData, tableFullData } = internalData
|
|
6544
6681
|
const dEndMethod = dragEndMethod || (dragConfig ? dragConfig.dragEndMethod : null)
|
|
6545
6682
|
const dragOffsetIndex = prevDragPos === 'bottom' ? 1 : 0
|
|
6683
|
+
const errRest = {
|
|
6684
|
+
status: false
|
|
6685
|
+
}
|
|
6546
6686
|
if (prevDragRow && dragRow) {
|
|
6547
6687
|
// 判断是否有拖动
|
|
6548
6688
|
if (prevDragRow !== dragRow) {
|
|
@@ -6557,7 +6697,7 @@ const Methods = {
|
|
|
6557
6697
|
const isDragToChildFlag = isSelfToChildDrag && dragToChildMethod ? dragToChildMethod(dragParams) : prevDragToChild
|
|
6558
6698
|
return Promise.resolve(dEndMethod ? dEndMethod(dragParams) : true).then((status) => {
|
|
6559
6699
|
if (!status) {
|
|
6560
|
-
return
|
|
6700
|
+
return errRest
|
|
6561
6701
|
}
|
|
6562
6702
|
|
|
6563
6703
|
let oafIndex = -1
|
|
@@ -6588,11 +6728,11 @@ const Methods = {
|
|
|
6588
6728
|
if (isPeerDrag && !isCrossDrag) {
|
|
6589
6729
|
if (oldRest.row[parentField] !== newRest.row[parentField]) {
|
|
6590
6730
|
// 非同级
|
|
6591
|
-
return
|
|
6731
|
+
return errRest
|
|
6592
6732
|
}
|
|
6593
6733
|
} else {
|
|
6594
6734
|
if (!isCrossDrag) {
|
|
6595
|
-
return
|
|
6735
|
+
return errRest
|
|
6596
6736
|
}
|
|
6597
6737
|
if (oldAllMaps[newRowid]) {
|
|
6598
6738
|
isSelfToChildStatus = true
|
|
@@ -6603,7 +6743,7 @@ const Methods = {
|
|
|
6603
6743
|
content: getI18n('vxe.error.treeDragChild')
|
|
6604
6744
|
})
|
|
6605
6745
|
}
|
|
6606
|
-
return
|
|
6746
|
+
return errRest
|
|
6607
6747
|
}
|
|
6608
6748
|
}
|
|
6609
6749
|
}
|
|
@@ -6611,13 +6751,13 @@ const Methods = {
|
|
|
6611
6751
|
// 子到根
|
|
6612
6752
|
|
|
6613
6753
|
if (!isCrossDrag) {
|
|
6614
|
-
return
|
|
6754
|
+
return errRest
|
|
6615
6755
|
}
|
|
6616
6756
|
} else if (newLevel) {
|
|
6617
6757
|
// 根到子
|
|
6618
6758
|
|
|
6619
6759
|
if (!isCrossDrag) {
|
|
6620
|
-
return
|
|
6760
|
+
return errRest
|
|
6621
6761
|
}
|
|
6622
6762
|
if (oldAllMaps[newRowid]) {
|
|
6623
6763
|
isSelfToChildStatus = true
|
|
@@ -6628,7 +6768,7 @@ const Methods = {
|
|
|
6628
6768
|
content: getI18n('vxe.error.treeDragChild')
|
|
6629
6769
|
})
|
|
6630
6770
|
}
|
|
6631
|
-
return
|
|
6771
|
+
return errRest
|
|
6632
6772
|
}
|
|
6633
6773
|
}
|
|
6634
6774
|
} else {
|
|
@@ -6692,28 +6832,36 @@ const Methods = {
|
|
|
6692
6832
|
if (reactData.scrollYLoad) {
|
|
6693
6833
|
$xeTable.updateScrollYSpace()
|
|
6694
6834
|
}
|
|
6695
|
-
|
|
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(() => {
|
|
6696
6852
|
$xeTable.updateCellAreas()
|
|
6697
6853
|
$xeTable.recalculate()
|
|
6698
|
-
})
|
|
6699
|
-
|
|
6700
|
-
|
|
6701
|
-
oldRow: dragRow,
|
|
6702
|
-
newRow: prevDragRow,
|
|
6703
|
-
dragRow,
|
|
6704
|
-
dragPos: prevDragPos as any,
|
|
6705
|
-
dragToChild: isDragToChildFlag,
|
|
6706
|
-
offsetIndex: dragOffsetIndex,
|
|
6707
|
-
_index: {
|
|
6708
|
-
newIndex: nafIndex,
|
|
6709
|
-
oldIndex: oafIndex
|
|
6854
|
+
}).then(() => {
|
|
6855
|
+
return {
|
|
6856
|
+
status: true
|
|
6710
6857
|
}
|
|
6711
|
-
}
|
|
6858
|
+
})
|
|
6712
6859
|
}).catch(() => {
|
|
6860
|
+
return errRest
|
|
6713
6861
|
})
|
|
6714
6862
|
}
|
|
6715
6863
|
}
|
|
6716
|
-
return Promise.resolve()
|
|
6864
|
+
return Promise.resolve(errRest)
|
|
6717
6865
|
},
|
|
6718
6866
|
handleRowDragDragendEvent (evnt: DragEvent) {
|
|
6719
6867
|
const $xeTable = this as VxeTableConstructor & VxeTablePrivateMethods
|
|
@@ -6852,7 +7000,7 @@ const Methods = {
|
|
|
6852
7000
|
$xeTable.saveCustomStore('update:sort')
|
|
6853
7001
|
})
|
|
6854
7002
|
},
|
|
6855
|
-
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) {
|
|
6856
7004
|
const $xeTable = this
|
|
6857
7005
|
const props = $xeTable
|
|
6858
7006
|
const reactData = $xeTable
|
|
@@ -6863,6 +7011,9 @@ const Methods = {
|
|
|
6863
7011
|
const { isPeerDrag, isCrossDrag, isSelfToChildDrag, isToChildDrag, dragEndMethod, dragToChildMethod } = columnDragOpts
|
|
6864
7012
|
const { collectColumn } = internalData
|
|
6865
7013
|
const dragOffsetIndex = prevDragPos === 'right' ? 1 : 0
|
|
7014
|
+
const errRest = {
|
|
7015
|
+
status: false
|
|
7016
|
+
}
|
|
6866
7017
|
if (prevDragCol && dragCol) {
|
|
6867
7018
|
// 判断是否有拖动
|
|
6868
7019
|
if (prevDragCol !== dragCol) {
|
|
@@ -6879,7 +7030,7 @@ const Methods = {
|
|
|
6879
7030
|
const isDragToChildFlag = isSelfToChildDrag && dragToChildMethod ? dragToChildMethod(dragParams) : prevDragToChild
|
|
6880
7031
|
return Promise.resolve(dragEndMethod ? dragEndMethod(dragParams) : true).then((status) => {
|
|
6881
7032
|
if (!status) {
|
|
6882
|
-
return
|
|
7033
|
+
return errRest
|
|
6883
7034
|
}
|
|
6884
7035
|
|
|
6885
7036
|
let oafIndex = -1
|
|
@@ -6898,11 +7049,11 @@ const Methods = {
|
|
|
6898
7049
|
if (isPeerDrag && !isCrossDrag) {
|
|
6899
7050
|
if (dragColumn.parentId !== newColumn.parentId) {
|
|
6900
7051
|
// 非同级
|
|
6901
|
-
return
|
|
7052
|
+
return errRest
|
|
6902
7053
|
}
|
|
6903
7054
|
} else {
|
|
6904
7055
|
if (!isCrossDrag) {
|
|
6905
|
-
return
|
|
7056
|
+
return errRest
|
|
6906
7057
|
}
|
|
6907
7058
|
|
|
6908
7059
|
if (oldAllMaps[newColumn.id]) {
|
|
@@ -6914,7 +7065,7 @@ const Methods = {
|
|
|
6914
7065
|
content: getI18n('vxe.error.treeDragChild')
|
|
6915
7066
|
})
|
|
6916
7067
|
}
|
|
6917
|
-
return
|
|
7068
|
+
return errRest
|
|
6918
7069
|
}
|
|
6919
7070
|
}
|
|
6920
7071
|
}
|
|
@@ -6922,13 +7073,13 @@ const Methods = {
|
|
|
6922
7073
|
// 子到根
|
|
6923
7074
|
|
|
6924
7075
|
if (!isCrossDrag) {
|
|
6925
|
-
return
|
|
7076
|
+
return errRest
|
|
6926
7077
|
}
|
|
6927
7078
|
} else if (newColumn.parentId) {
|
|
6928
7079
|
// 根到子
|
|
6929
7080
|
|
|
6930
7081
|
if (!isCrossDrag) {
|
|
6931
|
-
return
|
|
7082
|
+
return errRest
|
|
6932
7083
|
}
|
|
6933
7084
|
if (oldAllMaps[newColumn.id]) {
|
|
6934
7085
|
isSelfToChildStatus = true
|
|
@@ -6939,7 +7090,7 @@ const Methods = {
|
|
|
6939
7090
|
content: getI18n('vxe.error.treeDragChild')
|
|
6940
7091
|
})
|
|
6941
7092
|
}
|
|
6942
|
-
return
|
|
7093
|
+
return errRest
|
|
6943
7094
|
}
|
|
6944
7095
|
}
|
|
6945
7096
|
} else {
|
|
@@ -7003,27 +7154,34 @@ const Methods = {
|
|
|
7003
7154
|
}
|
|
7004
7155
|
}
|
|
7005
7156
|
|
|
7006
|
-
|
|
7007
|
-
|
|
7008
|
-
|
|
7009
|
-
|
|
7010
|
-
|
|
7011
|
-
|
|
7012
|
-
|
|
7013
|
-
|
|
7014
|
-
|
|
7015
|
-
|
|
7016
|
-
|
|
7017
|
-
|
|
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
|
+
}
|
|
7018
7171
|
|
|
7019
7172
|
if (isSyncColumn) {
|
|
7020
7173
|
$xeTable.handleColDragSwapColumn()
|
|
7021
7174
|
}
|
|
7175
|
+
|
|
7176
|
+
return {
|
|
7177
|
+
status: true
|
|
7178
|
+
}
|
|
7022
7179
|
}).catch(() => {
|
|
7180
|
+
return errRest
|
|
7023
7181
|
})
|
|
7024
7182
|
}
|
|
7025
7183
|
}
|
|
7026
|
-
return Promise.resolve()
|
|
7184
|
+
return Promise.resolve(errRest)
|
|
7027
7185
|
},
|
|
7028
7186
|
handleHeaderCellDragDragendEvent (evnt: DragEvent) {
|
|
7029
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
|