vxe-table 4.11.18 → 4.11.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 +45 -34
- package/es/style.css +1 -1
- package/es/table/module/keyboard/hook.js +30 -1
- package/es/table/src/body.js +11 -6
- package/es/table/src/footer.js +7 -2
- package/es/table/src/table.js +164 -48
- 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 +43 -39
- package/lib/grid/src/grid.min.js +1 -1
- package/lib/index.umd.js +293 -104
- package/lib/index.umd.min.js +1 -1
- package/lib/style.css +1 -1
- package/lib/table/module/keyboard/hook.js +31 -1
- package/lib/table/module/keyboard/hook.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 +184 -49
- 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 +49 -40
- package/packages/table/module/keyboard/hook.ts +29 -2
- package/packages/table/src/body.ts +10 -5
- package/packages/table/src/footer.ts +7 -2
- package/packages/table/src/table.ts +167 -50
- package/packages/table/src/util.ts +15 -3
- /package/es/{iconfont.1741224125327.ttf → iconfont.1741665718304.ttf} +0 -0
- /package/es/{iconfont.1741224125327.woff → iconfont.1741665718304.woff} +0 -0
- /package/es/{iconfont.1741224125327.woff2 → iconfont.1741665718304.woff2} +0 -0
- /package/lib/{iconfont.1741224125327.ttf → iconfont.1741665718304.ttf} +0 -0
- /package/lib/{iconfont.1741224125327.woff → iconfont.1741665718304.woff} +0 -0
- /package/lib/{iconfont.1741224125327.woff2 → iconfont.1741665718304.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'
|
|
@@ -867,7 +867,7 @@ export default defineComponent({
|
|
|
867
867
|
|
|
868
868
|
computeSXOpts,
|
|
869
869
|
computeSYOpts
|
|
870
|
-
}
|
|
870
|
+
} as any
|
|
871
871
|
|
|
872
872
|
const $xeTable = {
|
|
873
873
|
xID,
|
|
@@ -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,7 +3844,9 @@ export default defineComponent({
|
|
|
3841
3844
|
*/
|
|
3842
3845
|
revertData (rows: any, field) {
|
|
3843
3846
|
const { keepSource, treeConfig } = props
|
|
3847
|
+
const { editStore } = reactData
|
|
3844
3848
|
const { fullAllDataRowIdData, fullDataRowIdData, tableSourceData, sourceDataRowIdData, tableFullData, afterFullData } = internalData
|
|
3849
|
+
const removeTempMaps = { ...editStore.removeMaps }
|
|
3845
3850
|
const treeOpts = computeTreeOpts.value
|
|
3846
3851
|
const { transform } = treeOpts
|
|
3847
3852
|
if (!keepSource) {
|
|
@@ -3874,6 +3879,7 @@ export default defineComponent({
|
|
|
3874
3879
|
XEUtils.destructuring(row, XEUtils.clone(oRow, true))
|
|
3875
3880
|
}
|
|
3876
3881
|
if (!fullDataRowIdData[rowid] && $xeTable.isRemoveByRow(row)) {
|
|
3882
|
+
delete removeTempMaps[rowid]
|
|
3877
3883
|
tableFullData.unshift(row)
|
|
3878
3884
|
afterFullData.unshift(row)
|
|
3879
3885
|
reDelFlag = true
|
|
@@ -3885,6 +3891,7 @@ export default defineComponent({
|
|
|
3885
3891
|
}
|
|
3886
3892
|
if (rows) {
|
|
3887
3893
|
if (reDelFlag) {
|
|
3894
|
+
editStore.removeMaps = removeTempMaps
|
|
3888
3895
|
$xeTable.updateFooter()
|
|
3889
3896
|
$xeTable.cacheRowMap(false)
|
|
3890
3897
|
$xeTable.handleTableData(treeConfig && transform)
|
|
@@ -4032,18 +4039,20 @@ export default defineComponent({
|
|
|
4032
4039
|
},
|
|
4033
4040
|
/**
|
|
4034
4041
|
* 检查行或列数据是否发生改变
|
|
4035
|
-
* @param {Row}
|
|
4042
|
+
* @param {Row} rowOrId 行对象
|
|
4036
4043
|
* @param {String} field 字段名
|
|
4037
4044
|
*/
|
|
4038
|
-
isUpdateByRow (
|
|
4045
|
+
isUpdateByRow (rowOrId, field) {
|
|
4039
4046
|
const { keepSource } = props
|
|
4040
4047
|
const { tableFullColumn, fullDataRowIdData, sourceDataRowIdData } = internalData
|
|
4041
4048
|
if (keepSource) {
|
|
4042
|
-
const rowid = getRowid($xeTable,
|
|
4049
|
+
const rowid = XEUtils.isString(rowOrId) || XEUtils.isNumber(rowOrId) ? rowOrId : getRowid($xeTable, rowOrId)
|
|
4050
|
+
const rowRest = fullDataRowIdData[rowid]
|
|
4043
4051
|
// 新增的数据不需要检测
|
|
4044
|
-
if (!
|
|
4052
|
+
if (!rowRest) {
|
|
4045
4053
|
return false
|
|
4046
4054
|
}
|
|
4055
|
+
const row = rowRest.row
|
|
4047
4056
|
const oRow = sourceDataRowIdData[rowid]
|
|
4048
4057
|
if (oRow) {
|
|
4049
4058
|
if (arguments.length > 1) {
|
|
@@ -4107,6 +4116,92 @@ export default defineComponent({
|
|
|
4107
4116
|
tableColumn: reactData.tableColumn.slice(0)
|
|
4108
4117
|
}
|
|
4109
4118
|
},
|
|
4119
|
+
/**
|
|
4120
|
+
* 移动列到指定列的位置
|
|
4121
|
+
* @param fieldOrColumn
|
|
4122
|
+
* @param targetFieldOrColumn
|
|
4123
|
+
* @param options
|
|
4124
|
+
*/
|
|
4125
|
+
moveColumnTo (fieldOrColumn, targetFieldOrColumn, options) {
|
|
4126
|
+
const { fullColumnIdData, visibleColumn } = internalData
|
|
4127
|
+
const { dragToChild, dragPos, isCrossDrag } = Object.assign({}, options)
|
|
4128
|
+
const dragCol = handleFieldOrColumn($xeTable, fieldOrColumn)
|
|
4129
|
+
let prevDragCol: VxeTableDefines.ColumnInfo | null = null
|
|
4130
|
+
const colRest = dragCol ? fullColumnIdData[dragCol.id] : null
|
|
4131
|
+
let defPos: 'left' | 'right' = 'left'
|
|
4132
|
+
if (XEUtils.isNumber(targetFieldOrColumn)) {
|
|
4133
|
+
if (colRest && targetFieldOrColumn) {
|
|
4134
|
+
let currList = colRest.items
|
|
4135
|
+
let offsetIndex = colRest._index + targetFieldOrColumn
|
|
4136
|
+
if (isCrossDrag) {
|
|
4137
|
+
currList = visibleColumn
|
|
4138
|
+
offsetIndex = colRest._index + targetFieldOrColumn
|
|
4139
|
+
}
|
|
4140
|
+
if (offsetIndex > 0 && offsetIndex < currList.length - 1) {
|
|
4141
|
+
prevDragCol = currList[offsetIndex]
|
|
4142
|
+
}
|
|
4143
|
+
if (targetFieldOrColumn > 0) {
|
|
4144
|
+
defPos = 'right'
|
|
4145
|
+
}
|
|
4146
|
+
}
|
|
4147
|
+
} else {
|
|
4148
|
+
prevDragCol = handleFieldOrColumn($xeTable, targetFieldOrColumn)
|
|
4149
|
+
const targetColRest = prevDragCol ? fullColumnIdData[prevDragCol.id] : null
|
|
4150
|
+
if (colRest && targetColRest) {
|
|
4151
|
+
if (targetColRest._index > colRest._index) {
|
|
4152
|
+
defPos = 'right'
|
|
4153
|
+
}
|
|
4154
|
+
}
|
|
4155
|
+
}
|
|
4156
|
+
return $xeTable.handleColDragSwapEvent(null, true, dragCol, prevDragCol, dragPos || defPos, dragToChild === true)
|
|
4157
|
+
},
|
|
4158
|
+
/**
|
|
4159
|
+
* 移动行到指定行的位置
|
|
4160
|
+
* @param rowidOrRow
|
|
4161
|
+
* @param targetRowidOrRow
|
|
4162
|
+
* @param options
|
|
4163
|
+
*/
|
|
4164
|
+
moveRowTo (rowidOrRow, targetRowidOrRow, options) {
|
|
4165
|
+
const { treeConfig } = props
|
|
4166
|
+
const { fullAllDataRowIdData, afterFullData } = internalData
|
|
4167
|
+
const { dragToChild, dragPos, isCrossDrag } = Object.assign({}, options)
|
|
4168
|
+
const treeOpts = computeTreeOpts.value
|
|
4169
|
+
const dragRow = handleRowidOrRow($xeTable, rowidOrRow)
|
|
4170
|
+
let prevDragRow: any = null
|
|
4171
|
+
let defPos: 'top' | 'bottom' = 'top'
|
|
4172
|
+
const rowRest = dragRow ? fullAllDataRowIdData[getRowid($xeTable, dragRow)] : null
|
|
4173
|
+
if (XEUtils.isNumber(targetRowidOrRow)) {
|
|
4174
|
+
if (rowRest && targetRowidOrRow) {
|
|
4175
|
+
let currList = afterFullData
|
|
4176
|
+
let offsetIndex = rowRest._index + targetRowidOrRow
|
|
4177
|
+
if (treeConfig) {
|
|
4178
|
+
currList = rowRest.items
|
|
4179
|
+
if (treeOpts.transform) {
|
|
4180
|
+
offsetIndex = rowRest.treeIndex + targetRowidOrRow
|
|
4181
|
+
if (isCrossDrag) {
|
|
4182
|
+
currList = afterFullData
|
|
4183
|
+
offsetIndex = rowRest._index + targetRowidOrRow
|
|
4184
|
+
}
|
|
4185
|
+
}
|
|
4186
|
+
}
|
|
4187
|
+
if (offsetIndex >= 0 && offsetIndex <= currList.length - 1) {
|
|
4188
|
+
prevDragRow = currList[offsetIndex]
|
|
4189
|
+
}
|
|
4190
|
+
if (targetRowidOrRow > 0) {
|
|
4191
|
+
defPos = 'bottom'
|
|
4192
|
+
}
|
|
4193
|
+
}
|
|
4194
|
+
} else {
|
|
4195
|
+
prevDragRow = handleRowidOrRow($xeTable, targetRowidOrRow)
|
|
4196
|
+
const targetRowRest = prevDragRow ? fullAllDataRowIdData[getRowid($xeTable, prevDragRow)] : null
|
|
4197
|
+
if (rowRest && targetRowRest) {
|
|
4198
|
+
if (targetRowRest._index > rowRest._index) {
|
|
4199
|
+
defPos = 'bottom'
|
|
4200
|
+
}
|
|
4201
|
+
}
|
|
4202
|
+
}
|
|
4203
|
+
return $xeTable.handleRowDragSwapEvent(null, true, dragRow, prevDragRow, dragPos || defPos, dragToChild === true)
|
|
4204
|
+
},
|
|
4110
4205
|
/**
|
|
4111
4206
|
* 获取表格的全量列
|
|
4112
4207
|
*/
|
|
@@ -6261,8 +6356,9 @@ export default defineComponent({
|
|
|
6261
6356
|
// 如果按下了方向键
|
|
6262
6357
|
if (selected.row && selected.column) {
|
|
6263
6358
|
$xeTable.moveSelected(selected.args, isLeftArrow, isUpArrow, isRightArrow, isDwArrow, evnt)
|
|
6264
|
-
}
|
|
6265
|
-
|
|
6359
|
+
}
|
|
6360
|
+
// 当前行按键上下移动
|
|
6361
|
+
if ((isUpArrow || isDwArrow) && (rowOpts.isCurrent || highlightCurrentRow)) {
|
|
6266
6362
|
$xeTable.moveCurrentRow(isUpArrow, isDwArrow, evnt)
|
|
6267
6363
|
}
|
|
6268
6364
|
}
|
|
@@ -8133,6 +8229,9 @@ export default defineComponent({
|
|
|
8133
8229
|
const { afterFullData, tableFullData } = internalData
|
|
8134
8230
|
const dEndMethod = dragEndMethod || (dragConfig ? dragConfig.dragEndMethod : null)
|
|
8135
8231
|
const dragOffsetIndex = prevDragPos === 'bottom' ? 1 : 0
|
|
8232
|
+
const errRest = {
|
|
8233
|
+
status: false
|
|
8234
|
+
}
|
|
8136
8235
|
if (prevDragRow && dragRow) {
|
|
8137
8236
|
// 判断是否有拖动
|
|
8138
8237
|
if (prevDragRow !== dragRow) {
|
|
@@ -8147,7 +8246,7 @@ export default defineComponent({
|
|
|
8147
8246
|
const isDragToChildFlag = isSelfToChildDrag && dragToChildMethod ? dragToChildMethod(dragParams) : prevDragToChild
|
|
8148
8247
|
return Promise.resolve(dEndMethod ? dEndMethod(dragParams) : true).then((status) => {
|
|
8149
8248
|
if (!status) {
|
|
8150
|
-
return
|
|
8249
|
+
return errRest
|
|
8151
8250
|
}
|
|
8152
8251
|
|
|
8153
8252
|
let oafIndex = -1
|
|
@@ -8178,11 +8277,11 @@ export default defineComponent({
|
|
|
8178
8277
|
if (isPeerDrag && !isCrossDrag) {
|
|
8179
8278
|
if (oldRest.row[parentField] !== newRest.row[parentField]) {
|
|
8180
8279
|
// 非同级
|
|
8181
|
-
return
|
|
8280
|
+
return errRest
|
|
8182
8281
|
}
|
|
8183
8282
|
} else {
|
|
8184
8283
|
if (!isCrossDrag) {
|
|
8185
|
-
return
|
|
8284
|
+
return errRest
|
|
8186
8285
|
}
|
|
8187
8286
|
if (oldAllMaps[newRowid]) {
|
|
8188
8287
|
isSelfToChildStatus = true
|
|
@@ -8193,7 +8292,7 @@ export default defineComponent({
|
|
|
8193
8292
|
content: getI18n('vxe.error.treeDragChild')
|
|
8194
8293
|
})
|
|
8195
8294
|
}
|
|
8196
|
-
return
|
|
8295
|
+
return errRest
|
|
8197
8296
|
}
|
|
8198
8297
|
}
|
|
8199
8298
|
}
|
|
@@ -8201,13 +8300,13 @@ export default defineComponent({
|
|
|
8201
8300
|
// 子到根
|
|
8202
8301
|
|
|
8203
8302
|
if (!isCrossDrag) {
|
|
8204
|
-
return
|
|
8303
|
+
return errRest
|
|
8205
8304
|
}
|
|
8206
8305
|
} else if (newLevel) {
|
|
8207
8306
|
// 根到子
|
|
8208
8307
|
|
|
8209
8308
|
if (!isCrossDrag) {
|
|
8210
|
-
return
|
|
8309
|
+
return errRest
|
|
8211
8310
|
}
|
|
8212
8311
|
if (oldAllMaps[newRowid]) {
|
|
8213
8312
|
isSelfToChildStatus = true
|
|
@@ -8218,7 +8317,7 @@ export default defineComponent({
|
|
|
8218
8317
|
content: getI18n('vxe.error.treeDragChild')
|
|
8219
8318
|
})
|
|
8220
8319
|
}
|
|
8221
|
-
return
|
|
8320
|
+
return errRest
|
|
8222
8321
|
}
|
|
8223
8322
|
}
|
|
8224
8323
|
} else {
|
|
@@ -8282,28 +8381,36 @@ export default defineComponent({
|
|
|
8282
8381
|
if (reactData.scrollYLoad) {
|
|
8283
8382
|
$xeTable.updateScrollYSpace()
|
|
8284
8383
|
}
|
|
8285
|
-
|
|
8384
|
+
|
|
8385
|
+
if (evnt) {
|
|
8386
|
+
dispatchEvent('row-dragend', {
|
|
8387
|
+
oldRow: dragRow,
|
|
8388
|
+
newRow: prevDragRow,
|
|
8389
|
+
dragRow,
|
|
8390
|
+
dragPos: prevDragPos as any,
|
|
8391
|
+
dragToChild: isDragToChildFlag,
|
|
8392
|
+
offsetIndex: dragOffsetIndex,
|
|
8393
|
+
_index: {
|
|
8394
|
+
newIndex: nafIndex,
|
|
8395
|
+
oldIndex: oafIndex
|
|
8396
|
+
}
|
|
8397
|
+
}, evnt)
|
|
8398
|
+
}
|
|
8399
|
+
|
|
8400
|
+
return nextTick().then(() => {
|
|
8286
8401
|
$xeTable.updateCellAreas()
|
|
8287
8402
|
$xeTable.recalculate()
|
|
8288
|
-
})
|
|
8289
|
-
|
|
8290
|
-
|
|
8291
|
-
oldRow: dragRow,
|
|
8292
|
-
newRow: prevDragRow,
|
|
8293
|
-
dragRow,
|
|
8294
|
-
dragPos: prevDragPos as any,
|
|
8295
|
-
dragToChild: isDragToChildFlag,
|
|
8296
|
-
offsetIndex: dragOffsetIndex,
|
|
8297
|
-
_index: {
|
|
8298
|
-
newIndex: nafIndex,
|
|
8299
|
-
oldIndex: oafIndex
|
|
8403
|
+
}).then(() => {
|
|
8404
|
+
return {
|
|
8405
|
+
status: true
|
|
8300
8406
|
}
|
|
8301
|
-
}
|
|
8407
|
+
})
|
|
8302
8408
|
}).catch(() => {
|
|
8409
|
+
return errRest
|
|
8303
8410
|
})
|
|
8304
8411
|
}
|
|
8305
8412
|
}
|
|
8306
|
-
return Promise.resolve()
|
|
8413
|
+
return Promise.resolve(errRest)
|
|
8307
8414
|
},
|
|
8308
8415
|
handleRowDragDragendEvent (evnt) {
|
|
8309
8416
|
const { treeConfig } = props
|
|
@@ -8428,6 +8535,9 @@ export default defineComponent({
|
|
|
8428
8535
|
const { isPeerDrag, isCrossDrag, isSelfToChildDrag, isToChildDrag, dragEndMethod, dragToChildMethod } = columnDragOpts
|
|
8429
8536
|
const { collectColumn } = internalData
|
|
8430
8537
|
const dragOffsetIndex = prevDragPos === 'right' ? 1 : 0
|
|
8538
|
+
const errRest = {
|
|
8539
|
+
status: false
|
|
8540
|
+
}
|
|
8431
8541
|
if (prevDragCol && dragCol) {
|
|
8432
8542
|
// 判断是否有拖动
|
|
8433
8543
|
if (prevDragCol !== dragCol) {
|
|
@@ -8444,7 +8554,7 @@ export default defineComponent({
|
|
|
8444
8554
|
const isDragToChildFlag = isSelfToChildDrag && dragToChildMethod ? dragToChildMethod(dragParams) : prevDragToChild
|
|
8445
8555
|
return Promise.resolve(dragEndMethod ? dragEndMethod(dragParams) : true).then((status) => {
|
|
8446
8556
|
if (!status) {
|
|
8447
|
-
return
|
|
8557
|
+
return errRest
|
|
8448
8558
|
}
|
|
8449
8559
|
|
|
8450
8560
|
let oafIndex = -1
|
|
@@ -8463,11 +8573,11 @@ export default defineComponent({
|
|
|
8463
8573
|
if (isPeerDrag && !isCrossDrag) {
|
|
8464
8574
|
if (dragColumn.parentId !== newColumn.parentId) {
|
|
8465
8575
|
// 非同级
|
|
8466
|
-
return
|
|
8576
|
+
return errRest
|
|
8467
8577
|
}
|
|
8468
8578
|
} else {
|
|
8469
8579
|
if (!isCrossDrag) {
|
|
8470
|
-
return
|
|
8580
|
+
return errRest
|
|
8471
8581
|
}
|
|
8472
8582
|
|
|
8473
8583
|
if (oldAllMaps[newColumn.id]) {
|
|
@@ -8479,7 +8589,7 @@ export default defineComponent({
|
|
|
8479
8589
|
content: getI18n('vxe.error.treeDragChild')
|
|
8480
8590
|
})
|
|
8481
8591
|
}
|
|
8482
|
-
return
|
|
8592
|
+
return errRest
|
|
8483
8593
|
}
|
|
8484
8594
|
}
|
|
8485
8595
|
}
|
|
@@ -8487,13 +8597,13 @@ export default defineComponent({
|
|
|
8487
8597
|
// 子到根
|
|
8488
8598
|
|
|
8489
8599
|
if (!isCrossDrag) {
|
|
8490
|
-
return
|
|
8600
|
+
return errRest
|
|
8491
8601
|
}
|
|
8492
8602
|
} else if (newColumn.parentId) {
|
|
8493
8603
|
// 根到子
|
|
8494
8604
|
|
|
8495
8605
|
if (!isCrossDrag) {
|
|
8496
|
-
return
|
|
8606
|
+
return errRest
|
|
8497
8607
|
}
|
|
8498
8608
|
if (oldAllMaps[newColumn.id]) {
|
|
8499
8609
|
isSelfToChildStatus = true
|
|
@@ -8504,7 +8614,7 @@ export default defineComponent({
|
|
|
8504
8614
|
content: getI18n('vxe.error.treeDragChild')
|
|
8505
8615
|
})
|
|
8506
8616
|
}
|
|
8507
|
-
return
|
|
8617
|
+
return errRest
|
|
8508
8618
|
}
|
|
8509
8619
|
}
|
|
8510
8620
|
} else {
|
|
@@ -8568,27 +8678,34 @@ export default defineComponent({
|
|
|
8568
8678
|
}
|
|
8569
8679
|
}
|
|
8570
8680
|
|
|
8571
|
-
|
|
8572
|
-
|
|
8573
|
-
|
|
8574
|
-
|
|
8575
|
-
|
|
8576
|
-
|
|
8577
|
-
|
|
8578
|
-
|
|
8579
|
-
|
|
8580
|
-
|
|
8581
|
-
|
|
8582
|
-
|
|
8681
|
+
if (evnt) {
|
|
8682
|
+
dispatchEvent('column-dragend', {
|
|
8683
|
+
oldColumn: dragColumn,
|
|
8684
|
+
newColumn,
|
|
8685
|
+
dragColumn,
|
|
8686
|
+
dragPos: prevDragPos,
|
|
8687
|
+
dragToChild: isDragToChildFlag,
|
|
8688
|
+
offsetIndex: dragOffsetIndex,
|
|
8689
|
+
_index: {
|
|
8690
|
+
newIndex: nafIndex,
|
|
8691
|
+
oldIndex: oafIndex
|
|
8692
|
+
}
|
|
8693
|
+
}, evnt)
|
|
8694
|
+
}
|
|
8583
8695
|
|
|
8584
8696
|
if (isSyncColumn) {
|
|
8585
8697
|
$xeTable.handleColDragSwapColumn()
|
|
8586
8698
|
}
|
|
8699
|
+
|
|
8700
|
+
return {
|
|
8701
|
+
status: true
|
|
8702
|
+
}
|
|
8587
8703
|
}).catch(() => {
|
|
8704
|
+
return errRest
|
|
8588
8705
|
})
|
|
8589
8706
|
}
|
|
8590
8707
|
}
|
|
8591
|
-
return Promise.resolve()
|
|
8708
|
+
return Promise.resolve(errRest)
|
|
8592
8709
|
},
|
|
8593
8710
|
handleHeaderCellDragDragendEvent (evnt) {
|
|
8594
8711
|
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
|