vxe-pc-ui 3.15.24 → 3.15.26
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/date-panel/src/date-panel.js +63 -40
- package/es/date-panel/src/util.js +11 -1
- package/es/date-picker/src/date-picker.js +19 -12
- package/es/date-range-picker/src/date-range-picker.js +102 -19
- package/es/icon/style.css +1 -1
- package/es/list/src/list.js +560 -13
- package/es/list/src/util.js +8 -0
- package/es/list/style.css +10 -4
- package/es/list/style.min.css +1 -1
- package/es/style.css +1 -1
- package/es/style.min.css +1 -1
- package/es/ui/index.js +4 -1
- package/es/ui/src/log.js +1 -1
- package/es/vxe-list/style.css +10 -4
- package/es/vxe-list/style.min.css +1 -1
- package/lib/date-panel/src/date-panel.js +65 -40
- package/lib/date-panel/src/date-panel.min.js +1 -1
- package/lib/date-panel/src/util.js +14 -2
- package/lib/date-panel/src/util.min.js +1 -1
- package/lib/date-picker/src/date-picker.js +19 -12
- package/lib/date-picker/src/date-picker.min.js +1 -1
- package/lib/date-range-picker/src/date-range-picker.js +111 -18
- package/lib/date-range-picker/src/date-range-picker.min.js +1 -1
- package/lib/icon/style/style.css +1 -1
- package/lib/icon/style/style.min.css +1 -1
- package/lib/index.umd.js +863 -87
- package/lib/index.umd.min.js +1 -1
- package/lib/list/src/list.js +605 -11
- package/lib/list/src/list.min.js +1 -1
- package/lib/list/src/util.js +14 -0
- package/lib/list/src/util.min.js +1 -0
- package/lib/list/style/style.css +10 -4
- package/lib/list/style/style.min.css +1 -1
- package/lib/style.css +1 -1
- package/lib/style.min.css +1 -1
- package/lib/ui/index.js +4 -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/lib/vxe-list/style/style.css +10 -4
- package/lib/vxe-list/style/style.min.css +1 -1
- package/package.json +1 -1
- package/packages/date-panel/src/date-panel.ts +65 -40
- package/packages/date-panel/src/util.ts +14 -2
- package/packages/date-picker/src/date-picker.ts +20 -12
- package/packages/date-range-picker/src/date-range-picker.ts +100 -19
- package/packages/list/src/list.ts +588 -13
- package/packages/list/src/util.ts +11 -0
- package/packages/ui/index.ts +3 -0
- package/styles/components/list.scss +8 -4
- package/types/components/date-panel.d.ts +3 -1
- package/types/components/date-range-picker.d.ts +2 -2
- package/types/components/list.d.ts +120 -4
- package/types/components/tree.d.ts +3 -7
- package/types/ui/menus.d.ts +13 -1
- /package/es/icon/{iconfont.1783233735491.ttf → iconfont.1783301643461.ttf} +0 -0
- /package/es/icon/{iconfont.1783233735491.woff → iconfont.1783301643461.woff} +0 -0
- /package/es/icon/{iconfont.1783233735491.woff2 → iconfont.1783301643461.woff2} +0 -0
- /package/es/{iconfont.1783233735491.ttf → iconfont.1783301643461.ttf} +0 -0
- /package/es/{iconfont.1783233735491.woff → iconfont.1783301643461.woff} +0 -0
- /package/es/{iconfont.1783233735491.woff2 → iconfont.1783301643461.woff2} +0 -0
- /package/lib/icon/style/{iconfont.1783233735491.ttf → iconfont.1783301643461.ttf} +0 -0
- /package/lib/icon/style/{iconfont.1783233735491.woff → iconfont.1783301643461.woff} +0 -0
- /package/lib/icon/style/{iconfont.1783233735491.woff2 → iconfont.1783301643461.woff2} +0 -0
- /package/lib/{iconfont.1783233735491.ttf → iconfont.1783301643461.ttf} +0 -0
- /package/lib/{iconfont.1783233735491.woff → iconfont.1783301643461.woff} +0 -0
- /package/lib/{iconfont.1783233735491.woff2 → iconfont.1783301643461.woff2} +0 -0
|
@@ -1,18 +1,24 @@
|
|
|
1
1
|
import { PropType, CreateElement, VNode } from 'vue'
|
|
2
2
|
import { defineVxeComponent } from '../../ui/src/comp'
|
|
3
3
|
import XEUtils, { XEBrowse } from 'xe-utils'
|
|
4
|
-
import { getConfig, getIcon, getI18n, globalEvents, globalResize, createEvent, globalMixins, renderEmptyElement } from '../../ui'
|
|
4
|
+
import { VxeUI, getConfig, getIcon, getI18n, menus, globalEvents, globalResize, createEvent, globalMixins, renderEmptyElement } from '../../ui'
|
|
5
5
|
import { crossListDragRowGlobal, getCrossListDragRowInfo } from './store'
|
|
6
6
|
import { addClass, getTpImg, isScale, removeClass, toCssUnit } from '../../ui/src/dom'
|
|
7
7
|
import { isEnableConf, getText, enModelValue, deModelValue } from '../../ui/src/utils'
|
|
8
8
|
import { getSlotVNs } from '../../ui/src/vn'
|
|
9
9
|
import { createComponentLog } from '../../ui/src/log'
|
|
10
10
|
import { moveRowAnimateToTb, clearRowAnimate } from '../../ui/src/anime'
|
|
11
|
+
import { getItemCacheObj } from './util'
|
|
11
12
|
import VxeLoadingComponent from '../../loading/src/loading'
|
|
12
13
|
|
|
13
14
|
import type { VxeListPropTypes, VxeListEmits, VxeComponentSizeType, ListReactData, VxeListDefines, ValueOf, ListInternalData, VxeListConstructor, VxeListPrivateMethods, VxeComponentStyleType } from '../../../types'
|
|
14
15
|
|
|
15
|
-
const { errLog } = createComponentLog('tree')
|
|
16
|
+
const { warnLog, errLog } = createComponentLog('tree')
|
|
17
|
+
|
|
18
|
+
let crossListDragRowObj: {
|
|
19
|
+
$oldList: VxeListConstructor & VxeListPrivateMethods
|
|
20
|
+
$newList: (VxeListConstructor & VxeListPrivateMethods) | null
|
|
21
|
+
} | null = null
|
|
16
22
|
|
|
17
23
|
function eqRowKey (rowKey1: any, rowKey2: any) {
|
|
18
24
|
return ('' + rowKey1) === ('' + rowKey2)
|
|
@@ -46,8 +52,11 @@ function createReactData (): ListReactData {
|
|
|
46
52
|
updateCheckboxFlag: 1,
|
|
47
53
|
isAllChecked: false,
|
|
48
54
|
isAllIndeterminate: false,
|
|
55
|
+
insertRowFlag: 1,
|
|
56
|
+
removeRowFlag: 1,
|
|
49
57
|
dragRow: null,
|
|
50
|
-
dragTipText: ''
|
|
58
|
+
dragTipText: '',
|
|
59
|
+
isCrossDragRow: false
|
|
51
60
|
}
|
|
52
61
|
}
|
|
53
62
|
|
|
@@ -55,7 +64,9 @@ function createInternalData (): ListInternalData {
|
|
|
55
64
|
return {
|
|
56
65
|
resizeObserver: undefined,
|
|
57
66
|
fullData: [],
|
|
67
|
+
afterList: [],
|
|
58
68
|
fullKeyMaps: {},
|
|
69
|
+
rowMaps: {},
|
|
59
70
|
lastScrollLeft: 0,
|
|
60
71
|
lastScrollTop: 0,
|
|
61
72
|
scrollYStore: {
|
|
@@ -66,7 +77,9 @@ function createInternalData (): ListInternalData {
|
|
|
66
77
|
rowHeight: 0
|
|
67
78
|
},
|
|
68
79
|
currentRow: null,
|
|
69
|
-
selectCheckboxMaps: {}
|
|
80
|
+
selectCheckboxMaps: {},
|
|
81
|
+
insertRowMaps: {},
|
|
82
|
+
removeRowMaps: {}
|
|
70
83
|
// prevDragRow: null,
|
|
71
84
|
// prevDragPos: ''
|
|
72
85
|
}
|
|
@@ -92,6 +105,10 @@ export default /* define-vxe-component start */ defineVxeComponent({
|
|
|
92
105
|
default: () => getConfig().list.autoResize
|
|
93
106
|
},
|
|
94
107
|
syncResize: [Boolean, String, Number] as PropType<VxeListPropTypes.SyncResize>,
|
|
108
|
+
showSeq: {
|
|
109
|
+
type: Boolean as PropType<VxeListPropTypes.ShowSeq>,
|
|
110
|
+
default: () => getConfig().list.showSeq
|
|
111
|
+
},
|
|
95
112
|
showRadio: {
|
|
96
113
|
type: Boolean as PropType<VxeListPropTypes.ShowRadio>,
|
|
97
114
|
default: () => getConfig().list.showRadio
|
|
@@ -106,6 +123,7 @@ export default /* define-vxe-component start */ defineVxeComponent({
|
|
|
106
123
|
checkboxConfig: Object as PropType<VxeListPropTypes.CheckboxConfig>,
|
|
107
124
|
rowConfig: Object as PropType<VxeListPropTypes.RowConfig>,
|
|
108
125
|
dragConfig: Object as PropType<VxeListPropTypes.DragConfig>,
|
|
126
|
+
menuConfig: Object as PropType<VxeListPropTypes.MenuConfig>,
|
|
109
127
|
virtualYConfig: Object as PropType<VxeListPropTypes.VirtualYConfig>,
|
|
110
128
|
scrollY: Object as PropType<VxeListPropTypes.ScrollY>
|
|
111
129
|
},
|
|
@@ -180,6 +198,12 @@ export default /* define-vxe-component start */ defineVxeComponent({
|
|
|
180
198
|
|
|
181
199
|
return Object.assign({ showIcon: true }, getConfig().list.checkboxConfig, props.checkboxConfig)
|
|
182
200
|
},
|
|
201
|
+
computeMenuOpts () {
|
|
202
|
+
const $xeList = this
|
|
203
|
+
const props = $xeList
|
|
204
|
+
|
|
205
|
+
return Object.assign({}, getConfig().list.menuConfig, props.menuConfig)
|
|
206
|
+
},
|
|
183
207
|
computeWrapperStyles () {
|
|
184
208
|
const $xeList = this
|
|
185
209
|
|
|
@@ -282,6 +306,30 @@ export default /* define-vxe-component start */ defineVxeComponent({
|
|
|
282
306
|
internalData.selectCheckboxMaps = selectMaps
|
|
283
307
|
$xeList.updateCheckboxStatus()
|
|
284
308
|
},
|
|
309
|
+
updateAfterDataIndex () {
|
|
310
|
+
const $xeList = this
|
|
311
|
+
const internalData = $xeList.internalData
|
|
312
|
+
|
|
313
|
+
const { afterList, rowMaps } = internalData
|
|
314
|
+
const keyField = $xeList.computeKeyField
|
|
315
|
+
let vtIndex = 0
|
|
316
|
+
afterList.forEach((item, index) => {
|
|
317
|
+
const roweid = getRowIdByField(item, keyField)
|
|
318
|
+
const rowRest = rowMaps[roweid]
|
|
319
|
+
if (rowRest) {
|
|
320
|
+
rowRest._index = vtIndex
|
|
321
|
+
} else {
|
|
322
|
+
const rest = {
|
|
323
|
+
item,
|
|
324
|
+
index,
|
|
325
|
+
$index: -1,
|
|
326
|
+
_index: vtIndex
|
|
327
|
+
}
|
|
328
|
+
rowMaps[roweid] = rest
|
|
329
|
+
}
|
|
330
|
+
vtIndex++
|
|
331
|
+
})
|
|
332
|
+
},
|
|
285
333
|
cacheRowMap () {
|
|
286
334
|
const $xeList = this
|
|
287
335
|
const internalData = $xeList.internalData
|
|
@@ -306,17 +354,21 @@ export default /* define-vxe-component start */ defineVxeComponent({
|
|
|
306
354
|
|
|
307
355
|
const { scrollYStore } = internalData
|
|
308
356
|
const sYOpts = $xeList.computeSYOpts
|
|
309
|
-
const fullData = datas
|
|
357
|
+
const fullData = datas ? datas.slice(0) : []
|
|
310
358
|
Object.assign(scrollYStore, {
|
|
311
359
|
startIndex: 0,
|
|
312
360
|
endIndex: 1,
|
|
313
361
|
visibleSize: 0
|
|
314
362
|
})
|
|
315
363
|
internalData.fullData = fullData
|
|
364
|
+
internalData.insertRowMaps = {}
|
|
365
|
+
reactData.insertRowFlag++
|
|
366
|
+
internalData.removeRowMaps = {}
|
|
367
|
+
reactData.removeRowFlag++
|
|
316
368
|
// 如果gt为0,则总是启用
|
|
317
369
|
reactData.scrollYLoad = !!sYOpts.enabled && sYOpts.gt > -1 && (sYOpts.gt === 0 || sYOpts.gt <= fullData.length)
|
|
318
370
|
$xeList.cacheRowMap()
|
|
319
|
-
$xeList.handleData()
|
|
371
|
+
$xeList.handleData(true)
|
|
320
372
|
$xeList.updateRadioModeValue()
|
|
321
373
|
$xeList.updateCheckboxModeValue()
|
|
322
374
|
return $xeList.computeScrollLoad().then(() => {
|
|
@@ -383,14 +435,37 @@ export default /* define-vxe-component start */ defineVxeComponent({
|
|
|
383
435
|
reactData.bodyHeight = scrollYLoad ? fullData.length * scrollYStore.rowHeight : 0
|
|
384
436
|
reactData.topSpaceHeight = scrollYLoad ? Math.max(scrollYStore.startIndex * scrollYStore.rowHeight, 0) : 0
|
|
385
437
|
},
|
|
386
|
-
|
|
438
|
+
updateAfterFullData () {
|
|
439
|
+
const $xeList = this
|
|
440
|
+
const internalData = $xeList.internalData
|
|
441
|
+
|
|
442
|
+
const { fullData } = internalData
|
|
443
|
+
internalData.afterList = fullData.slice(0)
|
|
444
|
+
$xeList.updateAfterDataIndex()
|
|
445
|
+
},
|
|
446
|
+
handleData (force?: boolean) {
|
|
387
447
|
const $xeList = this
|
|
388
448
|
const reactData = $xeList.reactData
|
|
389
449
|
const internalData = $xeList.internalData
|
|
390
450
|
|
|
391
451
|
const { scrollYLoad } = reactData
|
|
392
|
-
const { fullData, scrollYStore } = internalData
|
|
393
|
-
|
|
452
|
+
const { fullData, scrollYStore, rowMaps } = internalData
|
|
453
|
+
const keyField = $xeList.computeKeyField
|
|
454
|
+
if (force) {
|
|
455
|
+
// 更新数据,处理筛选和排序
|
|
456
|
+
$xeList.updateAfterFullData()
|
|
457
|
+
}
|
|
458
|
+
const rowList = scrollYLoad ? fullData.slice(scrollYStore.startIndex, scrollYStore.endIndex) : fullData.slice(0)
|
|
459
|
+
if (keyField) {
|
|
460
|
+
rowList.forEach((item, $index) => {
|
|
461
|
+
const rowid = getRowIdByField(item, keyField)
|
|
462
|
+
const rowRest = rowMaps[rowid]
|
|
463
|
+
if (rowRest) {
|
|
464
|
+
rowRest.$index = $index
|
|
465
|
+
}
|
|
466
|
+
})
|
|
467
|
+
}
|
|
468
|
+
reactData.rowList = rowList
|
|
394
469
|
return $xeList.$nextTick()
|
|
395
470
|
},
|
|
396
471
|
updateYData () {
|
|
@@ -966,6 +1041,13 @@ export default /* define-vxe-component start */ defineVxeComponent({
|
|
|
966
1041
|
$xeList.emitRadioMode(value)
|
|
967
1042
|
$xeList.dispatchEvent('radio-change', { row, value, checked: isChecked }, evnt)
|
|
968
1043
|
},
|
|
1044
|
+
handleRowDragEndClearStatus () {
|
|
1045
|
+
const $xeList = this
|
|
1046
|
+
|
|
1047
|
+
$xeList.clearRowDragData()
|
|
1048
|
+
$xeList.clearCrossListDragStatus()
|
|
1049
|
+
$xeList.recalculate()
|
|
1050
|
+
},
|
|
969
1051
|
clearRowDropOrigin () {
|
|
970
1052
|
const $xeList = this
|
|
971
1053
|
|
|
@@ -1028,7 +1110,7 @@ export default /* define-vxe-component start */ defineVxeComponent({
|
|
|
1028
1110
|
const $xeList = this
|
|
1029
1111
|
const crossListDragRowInfo = getCrossListDragRowInfo($xeList as VxeListConstructor & VxeListPrivateMethods)
|
|
1030
1112
|
|
|
1031
|
-
|
|
1113
|
+
crossListDragRowObj = null
|
|
1032
1114
|
crossListDragRowInfo.row = null
|
|
1033
1115
|
},
|
|
1034
1116
|
clearDragStatus () {
|
|
@@ -1046,11 +1128,12 @@ export default /* define-vxe-component start */ defineVxeComponent({
|
|
|
1046
1128
|
handleRowDragMousedownEvent (evnt: MouseEvent, params: { row: any }) {
|
|
1047
1129
|
const $xeList = this
|
|
1048
1130
|
const reactData = $xeList.reactData
|
|
1131
|
+
const crossListDragRowInfo = getCrossListDragRowInfo($xeList as VxeListConstructor & VxeListPrivateMethods)
|
|
1049
1132
|
|
|
1050
1133
|
evnt.stopPropagation()
|
|
1051
1134
|
const { row } = params
|
|
1052
1135
|
const dragConfig = $xeList.computeDragOpts
|
|
1053
|
-
const { trigger, dragStartMethod } = dragConfig
|
|
1136
|
+
const { isCrossListDrag, trigger, dragStartMethod } = dragConfig
|
|
1054
1137
|
const dragEl = evnt.currentTarget as HTMLElement
|
|
1055
1138
|
const rowEl = trigger === 'row' ? dragEl : (dragEl.parentElement as HTMLElement).parentElement as HTMLElement
|
|
1056
1139
|
$xeList.clearRowDropOrigin()
|
|
@@ -1060,6 +1143,10 @@ export default /* define-vxe-component start */ defineVxeComponent({
|
|
|
1060
1143
|
$xeList.hideDropTip()
|
|
1061
1144
|
return
|
|
1062
1145
|
}
|
|
1146
|
+
if (isCrossListDrag) {
|
|
1147
|
+
crossListDragRowInfo.row = row
|
|
1148
|
+
crossListDragRowObj = { $oldList: $xeList, $newList: null }
|
|
1149
|
+
}
|
|
1063
1150
|
const dragstartEventParams: VxeListDefines.RowDragstartEventParams = {
|
|
1064
1151
|
row
|
|
1065
1152
|
}
|
|
@@ -1288,6 +1375,16 @@ export default /* define-vxe-component start */ defineVxeComponent({
|
|
|
1288
1375
|
|
|
1289
1376
|
const { dragRow } = reactData
|
|
1290
1377
|
const { prevDragRow, prevDragPos } = internalData
|
|
1378
|
+
const dragConfig = $xeList.computeDragOpts
|
|
1379
|
+
const { isCrossListDrag } = dragConfig
|
|
1380
|
+
// 跨列表拖拽
|
|
1381
|
+
if (isCrossListDrag && crossListDragRowObj) {
|
|
1382
|
+
const { $newList } = crossListDragRowObj
|
|
1383
|
+
if ($newList && $newList.xID !== $xeList.xID) {
|
|
1384
|
+
$newList.handleCrossListRowDragInsertEvent(evnt)
|
|
1385
|
+
return
|
|
1386
|
+
}
|
|
1387
|
+
}
|
|
1291
1388
|
$xeList.handleRowDragSwapEvent(evnt, dragRow, prevDragRow, prevDragPos)
|
|
1292
1389
|
},
|
|
1293
1390
|
handleRowDragDragoverEvent (evnt: DragEvent) {
|
|
@@ -1378,6 +1475,460 @@ export default /* define-vxe-component start */ defineVxeComponent({
|
|
|
1378
1475
|
|
|
1379
1476
|
$xeList.dispatchEvent('row-dblclick', { row }, evnt)
|
|
1380
1477
|
},
|
|
1478
|
+
insertListRow (newRecords: any[], isAppend: boolean) {
|
|
1479
|
+
const $xeList = this
|
|
1480
|
+
const internalData = $xeList.internalData
|
|
1481
|
+
|
|
1482
|
+
const { fullData, rowMaps } = internalData
|
|
1483
|
+
const keyField = $xeList.computeKeyField
|
|
1484
|
+
const funcName = isAppend ? 'push' : 'unshift'
|
|
1485
|
+
newRecords.forEach((item) => {
|
|
1486
|
+
const rowid = getRowIdByField(item, keyField)
|
|
1487
|
+
const rowRest = getItemCacheObj(item)
|
|
1488
|
+
fullData[funcName](item)
|
|
1489
|
+
rowMaps[rowid] = rowRest
|
|
1490
|
+
})
|
|
1491
|
+
},
|
|
1492
|
+
handleInsertRowAt (records: any[], targetRowOrRowKey: any, isInsertNextRow?: any) {
|
|
1493
|
+
const $xeList = this
|
|
1494
|
+
const reactData = $xeList.reactData
|
|
1495
|
+
const internalData = $xeList.internalData
|
|
1496
|
+
|
|
1497
|
+
const { fullData, rowMaps, removeRowMaps, insertRowMaps } = internalData
|
|
1498
|
+
const keyField = $xeList.computeKeyField
|
|
1499
|
+
if (!keyField) {
|
|
1500
|
+
errLog('vxe.error.reqSupportProp', ['insert() | insertAt() | insertNextAt()', 'row-config.keyField'])
|
|
1501
|
+
return Promise.resolve({ row: null, rows: [] })
|
|
1502
|
+
}
|
|
1503
|
+
if (!XEUtils.isArray(records)) {
|
|
1504
|
+
records = [records]
|
|
1505
|
+
}
|
|
1506
|
+
let targetRow = targetRowOrRowKey
|
|
1507
|
+
if (XEUtils.isString(targetRowOrRowKey) || XEUtils.isNumber(targetRowOrRowKey)) {
|
|
1508
|
+
const rowRest = rowMaps[targetRowOrRowKey]
|
|
1509
|
+
if (rowRest) {
|
|
1510
|
+
targetRow = rowRest.item
|
|
1511
|
+
}
|
|
1512
|
+
}
|
|
1513
|
+
if (!records.length) {
|
|
1514
|
+
return Promise.resolve({ row: null, rows: [] })
|
|
1515
|
+
}
|
|
1516
|
+
const newRecords = records.map(record => XEUtils.assign({}, record))
|
|
1517
|
+
|
|
1518
|
+
if (XEUtils.eqNull(targetRow)) {
|
|
1519
|
+
$xeList.insertListRow(newRecords, false)
|
|
1520
|
+
} else {
|
|
1521
|
+
if (targetRow === -1) {
|
|
1522
|
+
$xeList.insertListRow(newRecords, true)
|
|
1523
|
+
} else {
|
|
1524
|
+
const rowIndex = fullData.findIndex(item => targetRow[keyField] === item[keyField])
|
|
1525
|
+
if (rowIndex > -1) {
|
|
1526
|
+
newRecords.forEach(item => {
|
|
1527
|
+
const rowid = getRowIdByField(item, keyField)
|
|
1528
|
+
const rowRest = getItemCacheObj(item)
|
|
1529
|
+
rowMaps[rowid] = rowRest
|
|
1530
|
+
})
|
|
1531
|
+
let targetIndex = rowIndex
|
|
1532
|
+
if (isInsertNextRow) {
|
|
1533
|
+
targetIndex = targetIndex + 1
|
|
1534
|
+
}
|
|
1535
|
+
fullData.splice(targetIndex, 0, ...newRecords)
|
|
1536
|
+
} else {
|
|
1537
|
+
warnLog('vxe.error.unableInsert')
|
|
1538
|
+
$xeList.insertListRow(newRecords, true)
|
|
1539
|
+
}
|
|
1540
|
+
}
|
|
1541
|
+
}
|
|
1542
|
+
|
|
1543
|
+
newRecords.forEach((newItem: any) => {
|
|
1544
|
+
const rowid = getRowIdByField(newItem, keyField)
|
|
1545
|
+
// 如果是被删除的数据,则还原状态
|
|
1546
|
+
if (removeRowMaps[rowid]) {
|
|
1547
|
+
delete removeRowMaps[rowid]
|
|
1548
|
+
if (insertRowMaps[rowid]) {
|
|
1549
|
+
delete insertRowMaps[rowid]
|
|
1550
|
+
}
|
|
1551
|
+
} else {
|
|
1552
|
+
insertRowMaps[rowid] = newItem
|
|
1553
|
+
}
|
|
1554
|
+
})
|
|
1555
|
+
|
|
1556
|
+
reactData.removeRowFlag++
|
|
1557
|
+
reactData.insertRowFlag++
|
|
1558
|
+
$xeList.cacheRowMap()
|
|
1559
|
+
$xeList.handleData(true)
|
|
1560
|
+
$xeList.updateAfterDataIndex()
|
|
1561
|
+
$xeList.updateCheckboxStatus()
|
|
1562
|
+
if (reactData.scrollYLoad) {
|
|
1563
|
+
$xeList.updateYSpace()
|
|
1564
|
+
}
|
|
1565
|
+
return $xeList.$nextTick().then(() => {
|
|
1566
|
+
return {
|
|
1567
|
+
row: newRecords.length ? newRecords[newRecords.length - 1] : null,
|
|
1568
|
+
rows: newRecords
|
|
1569
|
+
}
|
|
1570
|
+
})
|
|
1571
|
+
},
|
|
1572
|
+
insert (records: any) {
|
|
1573
|
+
const $xeList = this
|
|
1574
|
+
|
|
1575
|
+
return $xeList.handleInsertRowAt(records, null)
|
|
1576
|
+
},
|
|
1577
|
+
insertAt (records: any, targetRowOrRowKey?: any) {
|
|
1578
|
+
const $xeList = this
|
|
1579
|
+
|
|
1580
|
+
return $xeList.handleInsertRowAt(records, targetRowOrRowKey)
|
|
1581
|
+
},
|
|
1582
|
+
insertNextAt (records: any, targetRowOrRowKey?: any) {
|
|
1583
|
+
const $xeList = this
|
|
1584
|
+
|
|
1585
|
+
return $xeList.handleInsertRowAt(records, targetRowOrRowKey, true)
|
|
1586
|
+
},
|
|
1587
|
+
getInsertRecords () {
|
|
1588
|
+
const $xeList = this
|
|
1589
|
+
const internalData = $xeList.internalData
|
|
1590
|
+
|
|
1591
|
+
const { insertRowMaps } = internalData
|
|
1592
|
+
const insertRecords: any[] = []
|
|
1593
|
+
XEUtils.each(insertRowMaps, (item) => {
|
|
1594
|
+
insertRecords.push(item)
|
|
1595
|
+
})
|
|
1596
|
+
return insertRecords
|
|
1597
|
+
},
|
|
1598
|
+
isInsertByRow (row: any) {
|
|
1599
|
+
const $xeList = this
|
|
1600
|
+
const reactData = $xeList.reactData
|
|
1601
|
+
const internalData = $xeList.internalData
|
|
1602
|
+
|
|
1603
|
+
const rowid = $xeList.getRowId(row)
|
|
1604
|
+
return !!reactData.insertRowFlag && !!internalData.insertRowMaps[rowid]
|
|
1605
|
+
},
|
|
1606
|
+
remove (rows: any) {
|
|
1607
|
+
const $xeList = this
|
|
1608
|
+
const reactData = $xeList.reactData
|
|
1609
|
+
const internalData = $xeList.internalData
|
|
1610
|
+
|
|
1611
|
+
const { fullData, insertRowMaps, removeRowMaps } = internalData
|
|
1612
|
+
const keyField = $xeList.computeKeyField
|
|
1613
|
+
if (!keyField) {
|
|
1614
|
+
errLog('vxe.error.reqSupportProp', ['insert() | insertAt() | insertNextAt()', 'row-config.keyField'])
|
|
1615
|
+
return Promise.resolve({ row: null, rows: [] })
|
|
1616
|
+
}
|
|
1617
|
+
let delList: any[] = []
|
|
1618
|
+
if (!rows) {
|
|
1619
|
+
rows = fullData
|
|
1620
|
+
} else if (!XEUtils.isArray(rows)) {
|
|
1621
|
+
rows = [rows]
|
|
1622
|
+
}
|
|
1623
|
+
if (!rows.length) {
|
|
1624
|
+
return Promise.resolve({ row: null, rows: [] })
|
|
1625
|
+
}
|
|
1626
|
+
|
|
1627
|
+
// 如果是新增,则保存记录
|
|
1628
|
+
rows.forEach((item: any) => {
|
|
1629
|
+
if (!$xeList.isInsertByRow(item)) {
|
|
1630
|
+
const rowid = $xeList.getRowId(item)
|
|
1631
|
+
removeRowMaps[rowid] = item
|
|
1632
|
+
}
|
|
1633
|
+
})
|
|
1634
|
+
|
|
1635
|
+
// 从数据源中移除
|
|
1636
|
+
if (fullData === rows) {
|
|
1637
|
+
rows = delList = fullData.slice(0)
|
|
1638
|
+
internalData.fullData = []
|
|
1639
|
+
} else {
|
|
1640
|
+
rows.forEach((item: any) => {
|
|
1641
|
+
const rowid = $xeList.getRowId(item)
|
|
1642
|
+
const rowIndex = XEUtils.findIndexOf(fullData, item => rowid === $xeList.getRowId(item))
|
|
1643
|
+
if (rowIndex > -1) {
|
|
1644
|
+
const rItems = fullData.splice(rowIndex, 1)
|
|
1645
|
+
delList.push(rItems[0])
|
|
1646
|
+
}
|
|
1647
|
+
})
|
|
1648
|
+
}
|
|
1649
|
+
|
|
1650
|
+
// 从新增中移除已删除的数据
|
|
1651
|
+
rows.forEach((item: any) => {
|
|
1652
|
+
const rowid = $xeList.getRowId(item)
|
|
1653
|
+
if (insertRowMaps[rowid]) {
|
|
1654
|
+
delete insertRowMaps[rowid]
|
|
1655
|
+
}
|
|
1656
|
+
})
|
|
1657
|
+
|
|
1658
|
+
reactData.removeRowFlag++
|
|
1659
|
+
reactData.insertRowFlag++
|
|
1660
|
+
$xeList.cacheRowMap()
|
|
1661
|
+
$xeList.handleData(true)
|
|
1662
|
+
$xeList.updateAfterDataIndex()
|
|
1663
|
+
$xeList.updateCheckboxStatus()
|
|
1664
|
+
if (reactData.scrollYLoad) {
|
|
1665
|
+
$xeList.updateYSpace()
|
|
1666
|
+
}
|
|
1667
|
+
return $xeList.$nextTick().then(() => {
|
|
1668
|
+
return $xeList.recalculate()
|
|
1669
|
+
}).then(() => {
|
|
1670
|
+
return { row: delList.length ? delList[delList.length - 1] : null, rows: delList }
|
|
1671
|
+
})
|
|
1672
|
+
},
|
|
1673
|
+
getRemoveRecords () {
|
|
1674
|
+
const $xeList = this
|
|
1675
|
+
const internalData = $xeList.internalData
|
|
1676
|
+
|
|
1677
|
+
const { removeRowMaps } = internalData
|
|
1678
|
+
const removeRecords: any[] = []
|
|
1679
|
+
XEUtils.each(removeRowMaps, (item) => {
|
|
1680
|
+
removeRecords.push(item)
|
|
1681
|
+
})
|
|
1682
|
+
return removeRecords
|
|
1683
|
+
},
|
|
1684
|
+
isRemoveByRow (row: any) {
|
|
1685
|
+
const $xeList = this
|
|
1686
|
+
const reactData = $xeList.reactData
|
|
1687
|
+
const internalData = $xeList.internalData
|
|
1688
|
+
|
|
1689
|
+
const rowid = $xeList.getRowId(row)
|
|
1690
|
+
return !!reactData.removeRowFlag && !!internalData.removeRowMaps[rowid]
|
|
1691
|
+
},
|
|
1692
|
+
handleCrossListRowDragCancelEvent () {
|
|
1693
|
+
const $xeList = this
|
|
1694
|
+
|
|
1695
|
+
$xeList.clearRowDragData()
|
|
1696
|
+
$xeList.clearCrossListDragStatus()
|
|
1697
|
+
},
|
|
1698
|
+
/**
|
|
1699
|
+
* 处理跨树拖拽完成
|
|
1700
|
+
*/
|
|
1701
|
+
handleCrossListRowDragFinishEvent (evnt: DragEvent) {
|
|
1702
|
+
const $xeList = this
|
|
1703
|
+
const reactData = $xeList.reactData
|
|
1704
|
+
const internalData = $xeList.internalData
|
|
1705
|
+
const crossListDragRowInfo = getCrossListDragRowInfo($xeList as VxeListConstructor & VxeListPrivateMethods)
|
|
1706
|
+
|
|
1707
|
+
const { rowList } = reactData
|
|
1708
|
+
const { rowMaps } = internalData
|
|
1709
|
+
const dragOpts = $xeList.computeDragOpts
|
|
1710
|
+
const { animation, isCrossListDrag } = dragOpts
|
|
1711
|
+
const el = $xeList.$refs.refElem as HTMLDivElement
|
|
1712
|
+
if (!el) {
|
|
1713
|
+
return
|
|
1714
|
+
}
|
|
1715
|
+
if (isCrossListDrag && crossListDragRowObj && crossListDragRowInfo) {
|
|
1716
|
+
const { row: dragRow } = crossListDragRowInfo
|
|
1717
|
+
if (dragRow) {
|
|
1718
|
+
const dragRowid = $xeList.getRowId(dragRow)
|
|
1719
|
+
const dragRowRest = rowMaps[dragRowid]
|
|
1720
|
+
let dragRowHeight = 0
|
|
1721
|
+
let rsIndex = -1
|
|
1722
|
+
if (dragRowRest) {
|
|
1723
|
+
if (animation) {
|
|
1724
|
+
const oldItemEl = el.querySelector<HTMLElement>(`.vxe-list--row[rowid="${dragRowid}"]`)
|
|
1725
|
+
const targetItemEl = oldItemEl
|
|
1726
|
+
if (targetItemEl) {
|
|
1727
|
+
dragRowHeight = targetItemEl.offsetHeight
|
|
1728
|
+
}
|
|
1729
|
+
}
|
|
1730
|
+
rsIndex = dragRowRest.$index
|
|
1731
|
+
}
|
|
1732
|
+
const dragRangeList = rsIndex > -1 && rsIndex < rowList.length - 1 ? rowList.slice(rsIndex + 1) : []
|
|
1733
|
+
const dragList = [dragRow]
|
|
1734
|
+
$xeList.remove(dragList).then(() => {
|
|
1735
|
+
if (animation && dragRowHeight && dragRangeList.length) {
|
|
1736
|
+
const wrapperEl = el
|
|
1737
|
+
const dtClss: string[] = []
|
|
1738
|
+
dragRangeList.forEach(item => {
|
|
1739
|
+
const rowid = $xeList.getRowId(item)
|
|
1740
|
+
dtClss.push(`.vxe-list--row[rowid="${rowid}"]`)
|
|
1741
|
+
})
|
|
1742
|
+
const dtTrList = wrapperEl.querySelectorAll<HTMLElement>(dtClss.join(','))
|
|
1743
|
+
moveRowAnimateToTb(dtTrList, dragRowHeight)
|
|
1744
|
+
}
|
|
1745
|
+
})
|
|
1746
|
+
$xeList.dispatchEvent('row-remove-dragend', {
|
|
1747
|
+
row: dragRow
|
|
1748
|
+
}, evnt)
|
|
1749
|
+
$xeList.handleRowDragEndClearStatus()
|
|
1750
|
+
}
|
|
1751
|
+
}
|
|
1752
|
+
},
|
|
1753
|
+
/**
|
|
1754
|
+
* 处理跨树拖至新的空树
|
|
1755
|
+
*/
|
|
1756
|
+
handleCrossListRowDragoverEmptyEvent (evnt: DragEvent) {
|
|
1757
|
+
const $xeList = this
|
|
1758
|
+
const reactData = $xeList.reactData
|
|
1759
|
+
const internalData = $xeList.internalData
|
|
1760
|
+
|
|
1761
|
+
const { rowList } = reactData
|
|
1762
|
+
const dragOpts = $xeList.computeDragOpts
|
|
1763
|
+
const { isCrossListDrag } = dragOpts
|
|
1764
|
+
if (isCrossListDrag && crossListDragRowObj && !rowList.length) {
|
|
1765
|
+
const { $oldList, $newList } = crossListDragRowObj
|
|
1766
|
+
if ($oldList) {
|
|
1767
|
+
const oldListReactData = $oldList as unknown as ListReactData
|
|
1768
|
+
if ($oldList.xID !== $xeList.xID) {
|
|
1769
|
+
if ($newList && $newList.xID !== $xeList.xID) {
|
|
1770
|
+
$newList.hideCrossListRowDropClearStatus()
|
|
1771
|
+
}
|
|
1772
|
+
evnt.preventDefault()
|
|
1773
|
+
$oldList.hideCrossListRowDropClearStatus()
|
|
1774
|
+
crossListDragRowObj.$newList = $xeList
|
|
1775
|
+
internalData.prevDragRow = null
|
|
1776
|
+
reactData.dragTipText = oldListReactData.dragTipText
|
|
1777
|
+
$xeList.showDropTip(evnt, evnt.currentTarget as HTMLDivElement, true, '')
|
|
1778
|
+
}
|
|
1779
|
+
}
|
|
1780
|
+
}
|
|
1781
|
+
},
|
|
1782
|
+
/**
|
|
1783
|
+
* 处理跨树拖插入
|
|
1784
|
+
*/
|
|
1785
|
+
handleCrossListRowDragInsertEvent (evnt: DragEvent) {
|
|
1786
|
+
const $xeList = this
|
|
1787
|
+
const reactData = $xeList.reactData
|
|
1788
|
+
const internalData = $xeList.internalData
|
|
1789
|
+
const crossListDragRowInfo = getCrossListDragRowInfo($xeList as VxeListConstructor & VxeListPrivateMethods)
|
|
1790
|
+
|
|
1791
|
+
const { prevDragRow, prevDragPos } = internalData
|
|
1792
|
+
const dragOpts = $xeList.computeDragOpts
|
|
1793
|
+
const { animation, isCrossListDrag, dragEndMethod } = dragOpts
|
|
1794
|
+
// 跨表拖拽
|
|
1795
|
+
if (isCrossListDrag && crossListDragRowObj && crossListDragRowInfo) {
|
|
1796
|
+
const { row: oldRow } = crossListDragRowInfo
|
|
1797
|
+
const { $oldList } = crossListDragRowObj
|
|
1798
|
+
const el = $xeList.$refs.refElem as HTMLDivElement
|
|
1799
|
+
if (!el) {
|
|
1800
|
+
return
|
|
1801
|
+
}
|
|
1802
|
+
if ($oldList && oldRow) {
|
|
1803
|
+
const dragRow = oldRow
|
|
1804
|
+
let dragOffsetIndex = -1
|
|
1805
|
+
if (prevDragRow) {
|
|
1806
|
+
dragOffsetIndex = prevDragPos === 'bottom' ? 1 : 0
|
|
1807
|
+
}
|
|
1808
|
+
const dragParams = {
|
|
1809
|
+
oldRow: dragRow,
|
|
1810
|
+
newRow: prevDragRow,
|
|
1811
|
+
dragRow,
|
|
1812
|
+
dragPos: prevDragPos as 'top' | 'bottom',
|
|
1813
|
+
offsetIndex: dragOffsetIndex as 0 | 1
|
|
1814
|
+
}
|
|
1815
|
+
const errRest = {
|
|
1816
|
+
status: false
|
|
1817
|
+
}
|
|
1818
|
+
Promise.resolve(dragEndMethod ? dragEndMethod(dragParams) : true).then((status) => {
|
|
1819
|
+
if (!status) {
|
|
1820
|
+
if ($oldList) {
|
|
1821
|
+
if ($oldList.xID !== $xeList.xID) {
|
|
1822
|
+
$oldList.handleCrossListRowDragCancelEvent(evnt)
|
|
1823
|
+
}
|
|
1824
|
+
}
|
|
1825
|
+
$xeList.handleRowDragEndClearStatus()
|
|
1826
|
+
return errRest
|
|
1827
|
+
}
|
|
1828
|
+
let insertRest: Promise<any> = Promise.resolve()
|
|
1829
|
+
const dragList = [dragRow]
|
|
1830
|
+
$oldList.handleCrossListRowDragFinishEvent(evnt)
|
|
1831
|
+
if (prevDragRow) {
|
|
1832
|
+
if (prevDragPos === 'bottom') {
|
|
1833
|
+
insertRest = $xeList.insertNextAt(dragList, prevDragRow)
|
|
1834
|
+
} else {
|
|
1835
|
+
insertRest = $xeList.insertAt(dragList, prevDragRow)
|
|
1836
|
+
}
|
|
1837
|
+
} else {
|
|
1838
|
+
insertRest = $xeList.insert(dragList)
|
|
1839
|
+
}
|
|
1840
|
+
$xeList.dispatchEvent('row-insert-dragend', {
|
|
1841
|
+
oldRow,
|
|
1842
|
+
newRow: prevDragRow,
|
|
1843
|
+
dragRow,
|
|
1844
|
+
dragPos: prevDragPos as any,
|
|
1845
|
+
offsetIndex: dragOffsetIndex
|
|
1846
|
+
}, evnt)
|
|
1847
|
+
$xeList.clearRowDragData()
|
|
1848
|
+
|
|
1849
|
+
insertRest.then(() => {
|
|
1850
|
+
const { rowList } = reactData
|
|
1851
|
+
const { rowMaps } = internalData
|
|
1852
|
+
const oldRowid = $xeList.getRowId(dragRow)
|
|
1853
|
+
const oldRowRest = rowMaps[oldRowid]
|
|
1854
|
+
let dragRowHeight = 0
|
|
1855
|
+
let rsIndex = -1
|
|
1856
|
+
if (oldRowRest) {
|
|
1857
|
+
if (animation) {
|
|
1858
|
+
const oldItemEl = el.querySelector<HTMLElement>(`.vxe-list--row[rowid="${oldRowid}"]`)
|
|
1859
|
+
const targetItemEl = oldItemEl
|
|
1860
|
+
if (targetItemEl) {
|
|
1861
|
+
dragRowHeight = targetItemEl.offsetHeight
|
|
1862
|
+
}
|
|
1863
|
+
}
|
|
1864
|
+
rsIndex = oldRowRest.$index
|
|
1865
|
+
}
|
|
1866
|
+
const dragRangeList = rsIndex > -1 ? rowList.slice(rsIndex) : []
|
|
1867
|
+
if (animation && dragRowHeight && dragRangeList.length) {
|
|
1868
|
+
const wrapperEl = el
|
|
1869
|
+
const dtClss: string[] = []
|
|
1870
|
+
dragRangeList.forEach(item => {
|
|
1871
|
+
const rowid = $xeList.getRowId(item)
|
|
1872
|
+
dtClss.push(`.vxe-list--row[rowid="${rowid}"]`)
|
|
1873
|
+
})
|
|
1874
|
+
const dtTrList = wrapperEl.querySelectorAll<HTMLElement>(dtClss.join(','))
|
|
1875
|
+
moveRowAnimateToTb(dtTrList, -dragRowHeight)
|
|
1876
|
+
}
|
|
1877
|
+
})
|
|
1878
|
+
})
|
|
1879
|
+
}
|
|
1880
|
+
}
|
|
1881
|
+
},
|
|
1882
|
+
hideCrossListRowDropClearStatus () {
|
|
1883
|
+
const $xeList = this
|
|
1884
|
+
|
|
1885
|
+
$xeList.hideDropTip()
|
|
1886
|
+
},
|
|
1887
|
+
handleContextmenuEvent (evnt: MouseEvent, row: any) {
|
|
1888
|
+
const $xeList = this
|
|
1889
|
+
const props = $xeList
|
|
1890
|
+
const reactData = $xeList.reactData
|
|
1891
|
+
const internalData = $xeList.internalData
|
|
1892
|
+
|
|
1893
|
+
const { menuConfig } = props
|
|
1894
|
+
const menuOpts = $xeList.computeMenuOpts
|
|
1895
|
+
const rowOpts = $xeList.computeRowOpts
|
|
1896
|
+
const { isCurrent } = rowOpts
|
|
1897
|
+
if (menuConfig ? isEnableConf(menuOpts) : menuOpts.enabled) {
|
|
1898
|
+
const { options, visibleMethod } = menuOpts
|
|
1899
|
+
if (!visibleMethod || visibleMethod({ $list: $xeList, options, row })) {
|
|
1900
|
+
if (isCurrent) {
|
|
1901
|
+
$xeList.changeCurrentEvent(evnt, row)
|
|
1902
|
+
} else if (internalData.currentRow) {
|
|
1903
|
+
internalData.currentRow = null
|
|
1904
|
+
reactData.currRowFlag++
|
|
1905
|
+
}
|
|
1906
|
+
if (VxeUI.contextMenu) {
|
|
1907
|
+
VxeUI.contextMenu.openByEvent(evnt, {
|
|
1908
|
+
options,
|
|
1909
|
+
events: {
|
|
1910
|
+
optionClick (eventParams) {
|
|
1911
|
+
const { option } = eventParams
|
|
1912
|
+
const gMenuOpts = menus.get(option.code)
|
|
1913
|
+
const tmMethod = gMenuOpts ? gMenuOpts.listMenuMethod : null
|
|
1914
|
+
const params = {
|
|
1915
|
+
menu: option,
|
|
1916
|
+
row,
|
|
1917
|
+
$event: evnt,
|
|
1918
|
+
$list: $xeList
|
|
1919
|
+
}
|
|
1920
|
+
if (tmMethod) {
|
|
1921
|
+
tmMethod(params, evnt)
|
|
1922
|
+
}
|
|
1923
|
+
$xeList.dispatchEvent('menu-click', params, eventParams.$event)
|
|
1924
|
+
}
|
|
1925
|
+
}
|
|
1926
|
+
})
|
|
1927
|
+
}
|
|
1928
|
+
}
|
|
1929
|
+
}
|
|
1930
|
+
$xeList.dispatchEvent('row-menu', { row }, evnt)
|
|
1931
|
+
},
|
|
1381
1932
|
|
|
1382
1933
|
//
|
|
1383
1934
|
// Render
|
|
@@ -1501,6 +2052,7 @@ export default /* define-vxe-component start */ defineVxeComponent({
|
|
|
1501
2052
|
const { selectRadioRow, currRowFlag, updateCheckboxFlag } = reactData
|
|
1502
2053
|
const { selectCheckboxMaps, currentRow } = internalData
|
|
1503
2054
|
const contentSlot = slots.content
|
|
2055
|
+
const extraSlot = slots.extra
|
|
1504
2056
|
const dragOpts = $xeList.computeDragOpts
|
|
1505
2057
|
const { trigger, icon, disabledMethod, visibleMethod } = dragOpts
|
|
1506
2058
|
const rowOpts = $xeList.computeRowOpts
|
|
@@ -1573,12 +2125,21 @@ export default /* define-vxe-component start */ defineVxeComponent({
|
|
|
1573
2125
|
class: 'vxe-list--row-content'
|
|
1574
2126
|
}, contentSlot ? contentSlot(rowParams) : (contentField ? getText(row[contentField]) : ''))
|
|
1575
2127
|
)
|
|
2128
|
+
if (extraSlot) {
|
|
2129
|
+
ctVNs.push(
|
|
2130
|
+
h('div', {
|
|
2131
|
+
key: 'ct7',
|
|
2132
|
+
class: 'vxe-list--row-extra'
|
|
2133
|
+
}, extraSlot(rowParams))
|
|
2134
|
+
)
|
|
2135
|
+
}
|
|
1576
2136
|
|
|
1577
2137
|
const rowOns: {
|
|
1578
2138
|
mousedown: (evnt: MouseEvent) => void
|
|
1579
2139
|
mouseup: (evnt: MouseEvent) => void
|
|
1580
2140
|
click: (evnt: MouseEvent) => void
|
|
1581
2141
|
dblclick: (evnt: MouseEvent) => void
|
|
2142
|
+
contextmenu?: (evnt: MouseEvent) => void
|
|
1582
2143
|
dragstart?: (evnt: DragEvent) => void
|
|
1583
2144
|
dragend?: (evnt: DragEvent) => void
|
|
1584
2145
|
dragover?: (evnt: DragEvent) => void
|
|
@@ -1592,6 +2153,9 @@ export default /* define-vxe-component start */ defineVxeComponent({
|
|
|
1592
2153
|
},
|
|
1593
2154
|
dblclick (evnt: MouseEvent) {
|
|
1594
2155
|
$xeList.handleRowDblclickEvent(evnt, row)
|
|
2156
|
+
},
|
|
2157
|
+
contextmenu (evnt) {
|
|
2158
|
+
$xeList.handleContextmenuEvent(evnt, row)
|
|
1595
2159
|
}
|
|
1596
2160
|
}
|
|
1597
2161
|
// 拖拽行事件
|
|
@@ -1634,16 +2198,24 @@ export default /* define-vxe-component start */ defineVxeComponent({
|
|
|
1634
2198
|
const radioOpts = $xeList.computeRadioOpts
|
|
1635
2199
|
const checkboxOpts = $xeList.computeCheckboxOpts
|
|
1636
2200
|
const dragOpts = $xeList.computeDragOpts
|
|
1637
|
-
const { trigger } = dragOpts
|
|
2201
|
+
const { trigger, isCrossListDrag } = dragOpts
|
|
1638
2202
|
const rowOpts = $xeList.computeRowOpts
|
|
1639
2203
|
const { isHover, padding } = rowOpts
|
|
1640
2204
|
const showDefChekboxHead = showCheckbox && checkboxOpts.showHeader !== false
|
|
2205
|
+
|
|
2206
|
+
const leOns: {
|
|
2207
|
+
dragover?: (...args: any[]) => void
|
|
2208
|
+
} = { }
|
|
2209
|
+
if (isCrossListDrag && !rowList.length) {
|
|
2210
|
+
leOns.dragover = $xeList.handleCrossListRowDragoverEmptyEvent
|
|
2211
|
+
}
|
|
1641
2212
|
return h('div', {
|
|
1642
2213
|
ref: 'refElem',
|
|
1643
2214
|
class: ['vxe-list', className ? (XEUtils.isFunction(className) ? className({ $list: $xeList }) : className) : '', {
|
|
1644
2215
|
[`size--${vSize}`]: vSize,
|
|
1645
2216
|
'is--loading': loading
|
|
1646
2217
|
}],
|
|
2218
|
+
on: leOns,
|
|
1647
2219
|
style: wrapperStyles
|
|
1648
2220
|
}, [
|
|
1649
2221
|
headerSlot || showDefChekboxHead
|
|
@@ -1786,11 +2358,14 @@ export default /* define-vxe-component start */ defineVxeComponent({
|
|
|
1786
2358
|
const props = $xeList
|
|
1787
2359
|
const internalData = $xeList.internalData
|
|
1788
2360
|
|
|
1789
|
-
const { showRadio, showCheckbox } = props
|
|
2361
|
+
const { showSeq, showRadio, showCheckbox } = props
|
|
1790
2362
|
const rowOpts = $xeList.computeRowOpts
|
|
1791
2363
|
const { useKey, keyField } = rowOpts
|
|
1792
2364
|
const isDrag = $xeList.computeIsDrag
|
|
1793
2365
|
if (!keyField) {
|
|
2366
|
+
if (showSeq) {
|
|
2367
|
+
errLog('vxe.error.reqSupportProp', ['show-seq', 'row-config.keyField'])
|
|
2368
|
+
}
|
|
1794
2369
|
if (showRadio) {
|
|
1795
2370
|
errLog('vxe.error.reqSupportProp', ['show-radio', 'row-config.keyField'])
|
|
1796
2371
|
}
|