vxe-table 3.11.30 → 3.11.32
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 +8 -1
- package/es/index.css +1 -1
- package/es/index.min.css +1 -1
- package/es/style.css +1 -1
- package/es/style.min.css +1 -1
- package/es/table/module/keyboard/mixin.js +1 -26
- package/es/table/src/body.js +15 -3
- package/es/table/src/cell.js +23 -19
- package/es/table/src/header.js +33 -22
- package/es/table/src/methods.js +205 -46
- package/es/table/src/table.js +18 -11
- package/es/table/style.css +36 -0
- package/es/table/style.min.css +1 -1
- package/es/ui/index.js +1 -1
- package/es/ui/src/log.js +1 -1
- package/es/vxe-table/style.css +36 -0
- package/es/vxe-table/style.min.css +1 -1
- package/lib/grid/src/grid.js +8 -1
- package/lib/grid/src/grid.min.js +1 -1
- package/lib/index.css +1 -1
- package/lib/index.min.css +1 -1
- package/lib/index.umd.js +343 -142
- package/lib/index.umd.min.js +1 -1
- package/lib/style.css +1 -1
- package/lib/style.min.css +1 -1
- package/lib/table/module/keyboard/mixin.js +0 -32
- package/lib/table/module/keyboard/mixin.min.js +1 -1
- package/lib/table/src/body.js +16 -3
- package/lib/table/src/body.min.js +1 -1
- package/lib/table/src/cell.js +23 -17
- package/lib/table/src/cell.min.js +1 -1
- package/lib/table/src/header.js +35 -26
- package/lib/table/src/header.min.js +1 -1
- package/lib/table/src/methods.js +240 -46
- package/lib/table/src/methods.min.js +1 -1
- package/lib/table/src/table.js +19 -11
- package/lib/table/src/table.min.js +1 -1
- package/lib/table/style/style.css +36 -0
- package/lib/table/style/style.min.css +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/lib/vxe-table/style/style.css +36 -0
- package/lib/vxe-table/style/style.min.css +1 -1
- package/package.json +2 -2
- package/packages/grid/src/grid.ts +9 -1
- package/packages/table/module/keyboard/mixin.ts +1 -26
- package/packages/table/src/body.ts +14 -3
- package/packages/table/src/cell.ts +23 -19
- package/packages/table/src/header.ts +34 -22
- package/packages/table/src/methods.ts +220 -46
- package/packages/table/src/table.ts +20 -12
- package/styles/components/table.scss +36 -0
- /package/es/{iconfont.1734099731402.ttf → iconfont.1734331305049.ttf} +0 -0
- /package/es/{iconfont.1734099731402.woff → iconfont.1734331305049.woff} +0 -0
- /package/es/{iconfont.1734099731402.woff2 → iconfont.1734331305049.woff2} +0 -0
- /package/lib/{iconfont.1734099731402.ttf → iconfont.1734331305049.ttf} +0 -0
- /package/lib/{iconfont.1734099731402.woff → iconfont.1734331305049.woff} +0 -0
- /package/lib/{iconfont.1734099731402.woff2 → iconfont.1734331305049.woff2} +0 -0
|
@@ -53,22 +53,24 @@ function renderCellDragIcon (h: CreateElement, params: any) {
|
|
|
53
53
|
const tableProps = $table
|
|
54
54
|
const { dragConfig } = tableProps
|
|
55
55
|
const rowDragOpts = $table.computeRowDragOpts
|
|
56
|
-
const { icon, disabledMethod } = rowDragOpts
|
|
56
|
+
const { icon, trigger, disabledMethod } = rowDragOpts
|
|
57
57
|
const rDisabledMethod = disabledMethod || (dragConfig ? dragConfig.rowDisabledMethod : null)
|
|
58
58
|
const isDisabled = rDisabledMethod && rDisabledMethod(params)
|
|
59
|
+
const ons: Record<string, any> = {}
|
|
60
|
+
if (trigger !== 'cell') {
|
|
61
|
+
ons.mousedown = (evnt: MouseEvent) => {
|
|
62
|
+
if (!isDisabled) {
|
|
63
|
+
$table.handleCellDragMousedownEvent(evnt, params)
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
ons.mouseup = $table.handleCellDragMouseupEvent
|
|
67
|
+
}
|
|
59
68
|
return h('span', {
|
|
60
69
|
key: 'dg',
|
|
61
70
|
class: ['vxe-cell--drag-handle', {
|
|
62
71
|
'is--disabled': isDisabled
|
|
63
72
|
}],
|
|
64
|
-
on:
|
|
65
|
-
mousedown (evnt: DragEvent) {
|
|
66
|
-
if (!isDisabled) {
|
|
67
|
-
$table.handleCellDragMousedownEvent(evnt, params)
|
|
68
|
-
}
|
|
69
|
-
},
|
|
70
|
-
mouseup: $table.handleCellDragMouseupEvent
|
|
71
|
-
}
|
|
73
|
+
on: ons
|
|
72
74
|
}, [
|
|
73
75
|
h('i', {
|
|
74
76
|
class: icon || (dragConfig ? dragConfig.rowIcon : '') || getIcon().TABLE_DRAG_ROW
|
|
@@ -106,23 +108,25 @@ function renderHeaderCellDragIcon (h: CreateElement, params: VxeTableDefines.Cel
|
|
|
106
108
|
const { $table, column } = params
|
|
107
109
|
const columnOpts = $table.computeColumnOpts
|
|
108
110
|
const columnDragOpts = $table.computeColumnDragOpts
|
|
109
|
-
const { showIcon, icon, isCrossDrag, visibleMethod, disabledMethod } = columnDragOpts
|
|
110
|
-
const isDisabled = disabledMethod && disabledMethod(params)
|
|
111
|
+
const { showIcon, icon, trigger, isCrossDrag, visibleMethod, disabledMethod } = columnDragOpts
|
|
111
112
|
if (columnOpts.drag && showIcon && (!visibleMethod || visibleMethod(params))) {
|
|
112
113
|
if (!column.fixed && (isCrossDrag || !column.parentId)) {
|
|
114
|
+
const isDisabled = disabledMethod && disabledMethod(params)
|
|
115
|
+
const ons: Record<string, any> = {}
|
|
116
|
+
if (trigger !== 'cell') {
|
|
117
|
+
ons.mousedown = (evnt: MouseEvent) => {
|
|
118
|
+
if (!isDisabled) {
|
|
119
|
+
$table.handleHeaderCellDragMousedownEvent(evnt, params)
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
ons.mouseup = $table.handleHeaderCellDragMouseupEvent
|
|
123
|
+
}
|
|
113
124
|
return h('span', {
|
|
114
125
|
key: 'dg',
|
|
115
126
|
class: ['vxe-cell--drag-handle', {
|
|
116
127
|
'is--disabled': isDisabled
|
|
117
128
|
}],
|
|
118
|
-
on:
|
|
119
|
-
mousedown (evnt: MouseEvent) {
|
|
120
|
-
if (!isDisabled) {
|
|
121
|
-
$table.handleHeaderCellDragMousedownEvent(evnt, params)
|
|
122
|
-
}
|
|
123
|
-
},
|
|
124
|
-
mouseup: $table.handleHeaderCellDragMouseupEvent
|
|
125
|
-
}
|
|
129
|
+
on: ons
|
|
126
130
|
}, [
|
|
127
131
|
h('i', {
|
|
128
132
|
class: icon || getIcon().TABLE_DRAG_COLUMN
|
|
@@ -12,9 +12,14 @@ const { renderer } = VxeUI
|
|
|
12
12
|
const cellType = 'header'
|
|
13
13
|
|
|
14
14
|
const renderRows = (h: CreateElement, _vm: any, cols: VxeTableDefines.ColumnInfo[], $rowIndex: number) => {
|
|
15
|
-
const
|
|
16
|
-
const
|
|
15
|
+
const $xeTable = _vm.$parent
|
|
16
|
+
const $xeGrid = $xeTable.xegrid
|
|
17
17
|
|
|
18
|
+
const { fixedType } = _vm
|
|
19
|
+
|
|
20
|
+
const { resizable: allResizable, border, columnKey, headerCellClassName, headerCellStyle, showHeaderOverflow: allColumnHeaderOverflow, headerAlign: allHeaderAlign, align: allAlign, currentColumn, scrollXLoad, overflowX, scrollbarWidth, mouseConfig, columnOpts } = $xeTable
|
|
21
|
+
const columnDragOpts = $xeTable.computeColumnDragOpts
|
|
22
|
+
const { disabledMethod: dragDisabledMethod } = columnDragOpts
|
|
18
23
|
return cols.map((column: any, $columnIndex: any) => {
|
|
19
24
|
const { type, showHeaderOverflow, headerAlign, align, headerClassName, editRender, cellRender } = column
|
|
20
25
|
// const { enabled } = tooltipOpts
|
|
@@ -29,30 +34,40 @@ const renderRows = (h: CreateElement, _vm: any, cols: VxeTableDefines.ColumnInfo
|
|
|
29
34
|
const showTitle = headOverflow === 'title'
|
|
30
35
|
const showTooltip = headOverflow === true || headOverflow === 'tooltip'
|
|
31
36
|
let hasEllipsis = showTitle || showTooltip || showEllipsis
|
|
32
|
-
const thOns: any = {}
|
|
33
37
|
const hasFilter = column.filters && column.filters.some((item: any) => item.checked)
|
|
34
|
-
const columnIndex = $
|
|
35
|
-
const _columnIndex = $
|
|
36
|
-
const params = { $table: $
|
|
38
|
+
const columnIndex = $xeTable.getColumnIndex(column)
|
|
39
|
+
const _columnIndex = $xeTable.getVTColumnIndex(column)
|
|
40
|
+
const params = { $table: $xeTable, $grid: $xeGrid, $rowIndex, column, columnIndex, $columnIndex, _columnIndex, fixed: fixedType, type: cellType, isHidden: fixedHiddenColumn, hasFilter }
|
|
41
|
+
const thAttrs: Record<string, string | number | null> = {
|
|
42
|
+
colid,
|
|
43
|
+
colspan: column.colSpan > 1 ? column.colSpan : null,
|
|
44
|
+
rowspan: column.rowSpan > 1 ? column.rowSpan : null
|
|
45
|
+
}
|
|
46
|
+
const thOns: any = {
|
|
47
|
+
click: (evnt: MouseEvent) => $xeTable.triggerHeaderCellClickEvent(evnt, params),
|
|
48
|
+
dblclick: (evnt: MouseEvent) => $xeTable.triggerHeaderCellDblclickEvent(evnt, params)
|
|
49
|
+
}
|
|
37
50
|
// 虚拟滚动不支持动态高度
|
|
38
51
|
if (scrollXLoad && !hasEllipsis) {
|
|
39
52
|
showEllipsis = hasEllipsis = true
|
|
40
53
|
}
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
thOns.dblclick = (evnt: any) => $xetable.triggerHeaderCellDblclickEvent(evnt, params)
|
|
54
|
+
const isColDragCell = columnOpts.drag && columnDragOpts.trigger === 'cell'
|
|
55
|
+
let isDisabledDrag = false
|
|
56
|
+
if (isColDragCell) {
|
|
57
|
+
isDisabledDrag = !!(dragDisabledMethod && dragDisabledMethod(params))
|
|
46
58
|
}
|
|
47
59
|
// 按下事件处理
|
|
48
|
-
if (mouseConfig) {
|
|
49
|
-
thOns.mousedown = (evnt: any) => $
|
|
60
|
+
if (mouseConfig || isColDragCell) {
|
|
61
|
+
thOns.mousedown = (evnt: any) => $xeTable.triggerHeaderCellMousedownEvent(evnt, params)
|
|
50
62
|
}
|
|
51
|
-
//
|
|
63
|
+
// 拖拽列事件
|
|
52
64
|
if (columnOpts.drag) {
|
|
53
|
-
thOns.dragstart = $
|
|
54
|
-
thOns.dragend = $
|
|
55
|
-
thOns.dragover = $
|
|
65
|
+
thOns.dragstart = $xeTable.handleHeaderCellDragDragstartEvent
|
|
66
|
+
thOns.dragend = $xeTable.handleHeaderCellDragDragendEvent
|
|
67
|
+
thOns.dragover = $xeTable.handleHeaderCellDragDragoverEvent
|
|
68
|
+
if (isColDragCell) {
|
|
69
|
+
thOns.mouseup = $xeTable.handleHeaderCellDragMouseupEvent
|
|
70
|
+
}
|
|
56
71
|
}
|
|
57
72
|
return h('th', {
|
|
58
73
|
class: ['vxe-header--column', colid, {
|
|
@@ -66,13 +81,10 @@ const renderRows = (h: CreateElement, _vm: any, cols: VxeTableDefines.ColumnInfo
|
|
|
66
81
|
'is--sortable': column.sortable,
|
|
67
82
|
'col--filter': !!column.filters,
|
|
68
83
|
'is--filter-active': hasFilter,
|
|
84
|
+
'is--drag-disabled': isDisabledDrag,
|
|
69
85
|
'col--current': currentColumn === column
|
|
70
86
|
}, getClass(headerClassName, params), getClass(headerCellClassName, params)],
|
|
71
|
-
attrs:
|
|
72
|
-
colid,
|
|
73
|
-
colspan: column.colSpan > 1 ? column.colSpan : null,
|
|
74
|
-
rowspan: column.rowSpan > 1 ? column.rowSpan : null
|
|
75
|
-
},
|
|
87
|
+
attrs: thAttrs,
|
|
76
88
|
style: headerCellStyle ? (XEUtils.isFunction(headerCellStyle) ? headerCellStyle(params) : headerCellStyle) : null,
|
|
77
89
|
on: thOns,
|
|
78
90
|
key: columnKey || columnOpts.useKey || columnOpts.drag || isColGroup ? colid : $columnIndex
|
|
@@ -815,16 +815,13 @@ const Methods = {
|
|
|
815
815
|
* @param {Array} datas 数据
|
|
816
816
|
*/
|
|
817
817
|
loadData (datas: any) {
|
|
818
|
-
const {
|
|
818
|
+
const { initStatus } = this
|
|
819
819
|
return this.loadTableData(datas).then(() => {
|
|
820
820
|
this.inited = true
|
|
821
821
|
this.initStatus = true
|
|
822
822
|
if (!initStatus) {
|
|
823
823
|
this.handleLoadDefaults()
|
|
824
824
|
}
|
|
825
|
-
if (!inited) {
|
|
826
|
-
this.handleInitDefaults()
|
|
827
|
-
}
|
|
828
825
|
return this.recalculate()
|
|
829
826
|
})
|
|
830
827
|
},
|
|
@@ -833,7 +830,6 @@ const Methods = {
|
|
|
833
830
|
* @param {Array} datas 数据
|
|
834
831
|
*/
|
|
835
832
|
reloadData (datas: any) {
|
|
836
|
-
const { inited } = this
|
|
837
833
|
return this.clearAll()
|
|
838
834
|
.then(() => {
|
|
839
835
|
this.inited = true
|
|
@@ -842,9 +838,6 @@ const Methods = {
|
|
|
842
838
|
})
|
|
843
839
|
.then(() => {
|
|
844
840
|
this.handleLoadDefaults()
|
|
845
|
-
if (!inited) {
|
|
846
|
-
this.handleInitDefaults()
|
|
847
|
-
}
|
|
848
841
|
return this.recalculate()
|
|
849
842
|
})
|
|
850
843
|
},
|
|
@@ -4020,23 +4013,74 @@ const Methods = {
|
|
|
4020
4013
|
* @param {Array/Row} rows 行数据
|
|
4021
4014
|
* @param {Boolean} value 是否选中
|
|
4022
4015
|
*/
|
|
4023
|
-
setCheckboxRow (rows: any,
|
|
4016
|
+
setCheckboxRow (rows: any, checked: any) {
|
|
4017
|
+
const $xeTable = this
|
|
4018
|
+
|
|
4024
4019
|
if (rows && !XEUtils.isArray(rows)) {
|
|
4025
4020
|
rows = [rows]
|
|
4026
4021
|
}
|
|
4027
|
-
return
|
|
4022
|
+
return $xeTable.handleCheckedCheckboxRow(rows, checked, true)
|
|
4023
|
+
},
|
|
4024
|
+
setCheckboxRowKey (keys: any, checked: boolean) {
|
|
4025
|
+
const $xeTable = this
|
|
4026
|
+
const internalData = $xeTable
|
|
4027
|
+
|
|
4028
|
+
const { fullAllDataRowIdData } = internalData
|
|
4029
|
+
if (keys && !XEUtils.isArray(keys)) {
|
|
4030
|
+
keys = [keys]
|
|
4031
|
+
}
|
|
4032
|
+
const rows: any = []
|
|
4033
|
+
keys.forEach((rowid: string) => {
|
|
4034
|
+
const rowRest = fullAllDataRowIdData[rowid]
|
|
4035
|
+
if (rowRest) {
|
|
4036
|
+
rows.push(rowRest.row)
|
|
4037
|
+
}
|
|
4038
|
+
})
|
|
4039
|
+
return $xeTable.handleCheckedCheckboxRow(rows, checked, true)
|
|
4028
4040
|
},
|
|
4029
4041
|
isCheckedByCheckboxRow (row: any) {
|
|
4030
|
-
const
|
|
4031
|
-
const
|
|
4042
|
+
const $xeTable = this
|
|
4043
|
+
const reactData = $xeTable
|
|
4044
|
+
|
|
4045
|
+
const { selectCheckboxMaps } = reactData
|
|
4046
|
+
const checkboxOpts = $xeTable.computeCheckboxOpts
|
|
4047
|
+
const { checkField } = checkboxOpts
|
|
4032
4048
|
if (checkField) {
|
|
4033
4049
|
return XEUtils.get(row, checkField)
|
|
4034
4050
|
}
|
|
4035
|
-
return !!selectCheckboxMaps[getRowid(
|
|
4051
|
+
return !!selectCheckboxMaps[getRowid($xeTable, row)]
|
|
4052
|
+
},
|
|
4053
|
+
isCheckedByCheckboxRowKey (rowid: string) {
|
|
4054
|
+
const $xeTable = this
|
|
4055
|
+
const reactData = $xeTable
|
|
4056
|
+
const internalData = $xeTable
|
|
4057
|
+
|
|
4058
|
+
const { selectCheckboxMaps } = reactData
|
|
4059
|
+
const { fullAllDataRowIdData } = internalData
|
|
4060
|
+
const checkboxOpts = $xeTable.computeCheckboxOpts
|
|
4061
|
+
const { checkField } = checkboxOpts
|
|
4062
|
+
if (checkField) {
|
|
4063
|
+
const rowRest = fullAllDataRowIdData[rowid]
|
|
4064
|
+
if (rowRest) {
|
|
4065
|
+
return XEUtils.get(rowRest.row, checkField)
|
|
4066
|
+
}
|
|
4067
|
+
return false
|
|
4068
|
+
}
|
|
4069
|
+
return !!selectCheckboxMaps[rowid]
|
|
4036
4070
|
},
|
|
4037
4071
|
isIndeterminateByCheckboxRow (row: any) {
|
|
4038
|
-
const
|
|
4039
|
-
|
|
4072
|
+
const $xeTable = this
|
|
4073
|
+
const reactData = $xeTable
|
|
4074
|
+
|
|
4075
|
+
const { treeIndeterminateMaps } = reactData
|
|
4076
|
+
return !!treeIndeterminateMaps[getRowid($xeTable, row)] && !$xeTable.isCheckedByCheckboxRow(row)
|
|
4077
|
+
},
|
|
4078
|
+
isIndeterminateByCheckboxRowKey (rowid: string) {
|
|
4079
|
+
const $xeTable = this
|
|
4080
|
+
const reactData = $xeTable
|
|
4081
|
+
|
|
4082
|
+
const { treeIndeterminateMaps } = reactData
|
|
4083
|
+
return !!treeIndeterminateMaps[rowid] && !$xeTable.isCheckedByCheckboxRowKey(rowid)
|
|
4040
4084
|
},
|
|
4041
4085
|
/**
|
|
4042
4086
|
* 切换选中
|
|
@@ -4762,7 +4806,24 @@ const Methods = {
|
|
|
4762
4806
|
return this.$nextTick()
|
|
4763
4807
|
},
|
|
4764
4808
|
isCheckedByRadioRow (row: any) {
|
|
4765
|
-
|
|
4809
|
+
const $xeTable = this
|
|
4810
|
+
const reactData = $xeTable
|
|
4811
|
+
|
|
4812
|
+
const { selectRadioRow } = reactData
|
|
4813
|
+
if (row && selectRadioRow) {
|
|
4814
|
+
return $xeTable.eqRow(selectRadioRow, row)
|
|
4815
|
+
}
|
|
4816
|
+
return false
|
|
4817
|
+
},
|
|
4818
|
+
isCheckedByRadioRowKey (key: string) {
|
|
4819
|
+
const $xeTable = this
|
|
4820
|
+
const reactData = $xeTable
|
|
4821
|
+
|
|
4822
|
+
const { selectRadioRow } = reactData
|
|
4823
|
+
if (selectRadioRow) {
|
|
4824
|
+
return key === getRowid($xeTable, selectRadioRow)
|
|
4825
|
+
}
|
|
4826
|
+
return false
|
|
4766
4827
|
},
|
|
4767
4828
|
handleCheckedRadioRow (row: any, isForce: any) {
|
|
4768
4829
|
const { radioOpts } = this
|
|
@@ -4778,7 +4839,24 @@ const Methods = {
|
|
|
4778
4839
|
* @param {Row} row 行对象
|
|
4779
4840
|
*/
|
|
4780
4841
|
setRadioRow (row: any) {
|
|
4781
|
-
|
|
4842
|
+
const $xeTable = this
|
|
4843
|
+
|
|
4844
|
+
return $xeTable.handleCheckedRadioRow(row, true)
|
|
4845
|
+
},
|
|
4846
|
+
/**
|
|
4847
|
+
* 用于单选行,设置某一行为选中状态
|
|
4848
|
+
* @param key 行主键
|
|
4849
|
+
*/
|
|
4850
|
+
setRadioRowKey (rowid: any) {
|
|
4851
|
+
const $xeTable = this
|
|
4852
|
+
const internalData = $xeTable
|
|
4853
|
+
|
|
4854
|
+
const { fullAllDataRowIdData } = internalData
|
|
4855
|
+
const rowRest = fullAllDataRowIdData[rowid]
|
|
4856
|
+
if (rowRest) {
|
|
4857
|
+
return $xeTable.handleCheckedRadioRow(rowRest.row, true)
|
|
4858
|
+
}
|
|
4859
|
+
return $xeTable.$nextTick()
|
|
4782
4860
|
},
|
|
4783
4861
|
/**
|
|
4784
4862
|
* 用于当前行,手动清空当前高亮的状态
|
|
@@ -4913,6 +4991,8 @@ const Methods = {
|
|
|
4913
4991
|
* 如果是双击模式,则单击后选中状态
|
|
4914
4992
|
*/
|
|
4915
4993
|
triggerCellClickEvent (evnt: any, params: any) {
|
|
4994
|
+
const $xeTable = this
|
|
4995
|
+
|
|
4916
4996
|
const { highlightCurrentRow, editStore, radioOpts, expandOpts, treeOpts, keyboardOpts, editConfig, editOpts, checkboxOpts, rowOpts } = this
|
|
4917
4997
|
const { actived, focused } = editStore
|
|
4918
4998
|
const { row, column } = params
|
|
@@ -4976,6 +5056,20 @@ const Methods = {
|
|
|
4976
5056
|
}
|
|
4977
5057
|
}
|
|
4978
5058
|
}
|
|
5059
|
+
// 如果是双击编辑模式
|
|
5060
|
+
if (isEnableConf(editConfig) && editOpts.trigger === 'dblclick') {
|
|
5061
|
+
if (actived.row && actived.column) {
|
|
5062
|
+
if (editOpts.mode === 'row') {
|
|
5063
|
+
if (!$xeTable.eqRow(actived.row, row)) {
|
|
5064
|
+
$xeTable.handleClearEdit(evnt)
|
|
5065
|
+
}
|
|
5066
|
+
} else if (editOpts.mode === 'cell') {
|
|
5067
|
+
if (!$xeTable.eqRow(actived.row, row) || actived.column.id !== column.id) {
|
|
5068
|
+
$xeTable.handleClearEdit(evnt)
|
|
5069
|
+
}
|
|
5070
|
+
}
|
|
5071
|
+
}
|
|
5072
|
+
}
|
|
4979
5073
|
this.emitEvent('cell-click', params, evnt)
|
|
4980
5074
|
},
|
|
4981
5075
|
/**
|
|
@@ -5062,6 +5156,79 @@ const Methods = {
|
|
|
5062
5156
|
$xeTable.handleColumnSortEvent(evnt, column)
|
|
5063
5157
|
}
|
|
5064
5158
|
},
|
|
5159
|
+
/**
|
|
5160
|
+
* 表头单元格按下事件
|
|
5161
|
+
*/
|
|
5162
|
+
triggerHeaderCellMousedownEvent (evnt: any, params: any) {
|
|
5163
|
+
const $xeTable = this
|
|
5164
|
+
const props = $xeTable
|
|
5165
|
+
|
|
5166
|
+
const { mouseConfig } = props
|
|
5167
|
+
const mouseOpts = $xeTable.computeMouseOpts
|
|
5168
|
+
const columnOpts = $xeTable.computeColumnOpts
|
|
5169
|
+
const columnDragOpts = $xeTable.computeColumnDragOpts
|
|
5170
|
+
const { trigger, disabledMethod } = columnDragOpts
|
|
5171
|
+
const cell = evnt.currentTarget
|
|
5172
|
+
const triggerInput = cell && cell.tagName && cell.tagName.toLowerCase() === 'input'
|
|
5173
|
+
const triggerCheckbox = getEventTargetNode(evnt, cell, 'vxe-cell--checkbox').flag
|
|
5174
|
+
const triggerSort = getEventTargetNode(evnt, cell, 'vxe-cell--sort').flag
|
|
5175
|
+
const triggerFilter = getEventTargetNode(evnt, cell, 'vxe-cell--filter').flag
|
|
5176
|
+
let triggerDrag = false
|
|
5177
|
+
if (!(triggerInput || triggerCheckbox || triggerSort || triggerFilter)) {
|
|
5178
|
+
if (columnOpts.drag && trigger === 'cell' && !(disabledMethod && disabledMethod(params))) {
|
|
5179
|
+
triggerDrag = true
|
|
5180
|
+
$xeTable.handleHeaderCellDragMousedownEvent(evnt, params)
|
|
5181
|
+
}
|
|
5182
|
+
}
|
|
5183
|
+
if (!triggerDrag && mouseConfig && mouseOpts.area && $xeTable.handleHeaderCellAreaEvent) {
|
|
5184
|
+
$xeTable.handleHeaderCellAreaEvent(evnt, Object.assign({ cell, triggerSort, triggerFilter }, params))
|
|
5185
|
+
}
|
|
5186
|
+
$xeTable.focus()
|
|
5187
|
+
if ($xeTable.closeMenu) {
|
|
5188
|
+
$xeTable.closeMenu()
|
|
5189
|
+
}
|
|
5190
|
+
},
|
|
5191
|
+
/**
|
|
5192
|
+
* 单元格按下事件
|
|
5193
|
+
*/
|
|
5194
|
+
triggerCellMousedownEvent (evnt: any, params: any) {
|
|
5195
|
+
const $xeTable = this
|
|
5196
|
+
|
|
5197
|
+
const { column } = params
|
|
5198
|
+
const { type, treeNode } = column
|
|
5199
|
+
const isRadioType = type === 'radio'
|
|
5200
|
+
const isCheckboxType = type === 'checkbox'
|
|
5201
|
+
const isExpandType = type === 'expand'
|
|
5202
|
+
const rowOpts = $xeTable.computeRowOpts
|
|
5203
|
+
const rowDragOpts = $xeTable.computeRowDragOpts
|
|
5204
|
+
const { trigger, disabledMethod } = rowDragOpts
|
|
5205
|
+
const cell = evnt.currentTarget
|
|
5206
|
+
params.cell = cell
|
|
5207
|
+
const triggerInput = cell && cell.tagName && cell.tagName.toLowerCase() === 'input'
|
|
5208
|
+
const triggerRadio = isRadioType && getEventTargetNode(evnt, cell, 'vxe-cell--radio').flag
|
|
5209
|
+
const triggerCheckbox = isCheckboxType && getEventTargetNode(evnt, cell, 'vxe-cell--checkbox').flag
|
|
5210
|
+
const triggerTreeNode = treeNode && getEventTargetNode(evnt, cell, 'vxe-tree--btn-wrapper').flag
|
|
5211
|
+
const triggerExpandNode = isExpandType && getEventTargetNode(evnt, cell, 'vxe-table--expanded').flag
|
|
5212
|
+
let isColDragCell = false
|
|
5213
|
+
if (rowOpts.drag) {
|
|
5214
|
+
isColDragCell = trigger === 'row' || (column.dragSort && trigger === 'cell')
|
|
5215
|
+
}
|
|
5216
|
+
let triggerDrag = false
|
|
5217
|
+
if (!(triggerInput || triggerRadio || triggerCheckbox || triggerTreeNode || triggerExpandNode)) {
|
|
5218
|
+
if (isColDragCell && !(disabledMethod && disabledMethod(params))) {
|
|
5219
|
+
triggerDrag = true
|
|
5220
|
+
$xeTable.handleCellDragMousedownEvent(evnt, params)
|
|
5221
|
+
}
|
|
5222
|
+
}
|
|
5223
|
+
if (!triggerDrag && $xeTable.handleCellMousedownEvent) {
|
|
5224
|
+
$xeTable.handleCellMousedownEvent(evnt, params)
|
|
5225
|
+
}
|
|
5226
|
+
$xeTable.focus()
|
|
5227
|
+
$xeTable.closeFilter()
|
|
5228
|
+
if ($xeTable.closeMenu) {
|
|
5229
|
+
$xeTable.closeMenu()
|
|
5230
|
+
}
|
|
5231
|
+
},
|
|
5065
5232
|
/**
|
|
5066
5233
|
* 行拖拽
|
|
5067
5234
|
*/
|
|
@@ -5301,12 +5468,13 @@ const Methods = {
|
|
|
5301
5468
|
const props = $xeTable
|
|
5302
5469
|
const reactData = $xeTable
|
|
5303
5470
|
|
|
5471
|
+
evnt.stopPropagation()
|
|
5304
5472
|
const { dragConfig } = props
|
|
5305
5473
|
const rowDragOpts = $xeTable.computeRowDragOpts
|
|
5306
|
-
const { dragStartMethod } = rowDragOpts
|
|
5474
|
+
const { trigger, dragStartMethod } = rowDragOpts
|
|
5307
5475
|
const { row } = params
|
|
5308
5476
|
const dragEl = evnt.currentTarget as HTMLElement
|
|
5309
|
-
const tdEl = dragEl.parentElement?.parentElement as HTMLElement
|
|
5477
|
+
const tdEl = trigger === 'cell' || trigger === 'row' ? dragEl : dragEl.parentElement?.parentElement as HTMLElement
|
|
5310
5478
|
const trEl = tdEl.parentElement as HTMLElement
|
|
5311
5479
|
const dStartMethod = dragStartMethod || (dragConfig ? dragConfig.dragStartMethod : null)
|
|
5312
5480
|
reactData.isDragRowMove = false
|
|
@@ -5558,11 +5726,12 @@ const Methods = {
|
|
|
5558
5726
|
const $xeTable = this
|
|
5559
5727
|
const reactData = $xeTable
|
|
5560
5728
|
|
|
5729
|
+
evnt.stopPropagation()
|
|
5561
5730
|
const columnDragOpts = $xeTable.computeColumnDragOpts
|
|
5562
|
-
const { dragStartMethod } = columnDragOpts
|
|
5731
|
+
const { trigger, dragStartMethod } = columnDragOpts
|
|
5563
5732
|
const { column } = params
|
|
5564
5733
|
const dragEl = evnt.currentTarget as HTMLElement
|
|
5565
|
-
const thEl = dragEl.parentElement?.parentElement as HTMLElement
|
|
5734
|
+
const thEl = trigger === 'cell' ? dragEl : dragEl.parentElement?.parentElement as HTMLElement
|
|
5566
5735
|
reactData.isDragColMove = false
|
|
5567
5736
|
clearColDropOrigin($xeTable)
|
|
5568
5737
|
if (dragStartMethod && !dragStartMethod(params)) {
|
|
@@ -5590,62 +5759,66 @@ const Methods = {
|
|
|
5590
5759
|
reactData.isDragColMove = false
|
|
5591
5760
|
},
|
|
5592
5761
|
setPendingRow (rows: any, status: any) {
|
|
5593
|
-
const
|
|
5594
|
-
const
|
|
5762
|
+
const $xeTable = this
|
|
5763
|
+
const reactData = $xeTable
|
|
5764
|
+
|
|
5765
|
+
const pendingMaps = Object.assign({}, reactData.pendingRowMaps)
|
|
5595
5766
|
if (rows && !XEUtils.isArray(rows)) {
|
|
5596
5767
|
rows = [rows]
|
|
5597
5768
|
}
|
|
5598
5769
|
if (status) {
|
|
5599
5770
|
rows.forEach((row: any) => {
|
|
5600
|
-
const rowid = getRowid(
|
|
5771
|
+
const rowid = getRowid($xeTable, row)
|
|
5601
5772
|
if (rowid && !pendingMaps[rowid]) {
|
|
5602
|
-
pendingList.push(row)
|
|
5603
5773
|
pendingMaps[rowid] = row
|
|
5604
5774
|
}
|
|
5605
5775
|
})
|
|
5606
5776
|
} else {
|
|
5607
5777
|
rows.forEach((row: any) => {
|
|
5608
|
-
const rowid = getRowid(
|
|
5778
|
+
const rowid = getRowid($xeTable, row)
|
|
5609
5779
|
if (rowid && pendingMaps[rowid]) {
|
|
5610
|
-
const pendingIndex = this.findRowIndexOf(pendingList, row)
|
|
5611
|
-
if (pendingIndex > -1) {
|
|
5612
|
-
pendingList.splice(pendingIndex, 1)
|
|
5613
|
-
}
|
|
5614
5780
|
delete pendingMaps[rowid]
|
|
5615
5781
|
}
|
|
5616
5782
|
})
|
|
5617
5783
|
}
|
|
5618
|
-
|
|
5619
|
-
|
|
5620
|
-
return this.$nextTick()
|
|
5784
|
+
reactData.pendingRowMaps = pendingMaps
|
|
5785
|
+
return $xeTable.$nextTick()
|
|
5621
5786
|
},
|
|
5622
5787
|
togglePendingRow (rows: any) {
|
|
5623
|
-
const
|
|
5624
|
-
const
|
|
5788
|
+
const $xeTable = this
|
|
5789
|
+
const reactData = $xeTable
|
|
5790
|
+
|
|
5791
|
+
const pendingMaps = Object.assign({}, reactData.pendingRowMaps)
|
|
5625
5792
|
if (rows && !XEUtils.isArray(rows)) {
|
|
5626
5793
|
rows = [rows]
|
|
5627
5794
|
}
|
|
5628
5795
|
rows.forEach((row: any) => {
|
|
5629
|
-
const rowid = getRowid(
|
|
5796
|
+
const rowid = getRowid($xeTable, row)
|
|
5630
5797
|
if (rowid) {
|
|
5631
5798
|
if (pendingMaps[rowid]) {
|
|
5632
|
-
const pendingIndex = this.findRowIndexOf(pendingList, row)
|
|
5633
|
-
if (pendingIndex > -1) {
|
|
5634
|
-
pendingList.splice(pendingIndex, 1)
|
|
5635
|
-
}
|
|
5636
5799
|
delete pendingMaps[rowid]
|
|
5637
5800
|
} else {
|
|
5638
|
-
pendingList.push(row)
|
|
5639
5801
|
pendingMaps[rowid] = row
|
|
5640
5802
|
}
|
|
5641
5803
|
}
|
|
5642
5804
|
})
|
|
5643
|
-
|
|
5644
|
-
|
|
5645
|
-
return this.$nextTick()
|
|
5805
|
+
reactData.pendingRowMaps = pendingMaps
|
|
5806
|
+
return $xeTable.$nextTick()
|
|
5646
5807
|
},
|
|
5647
5808
|
getPendingRecords () {
|
|
5648
|
-
|
|
5809
|
+
const $xeTable = this
|
|
5810
|
+
const reactData = $xeTable
|
|
5811
|
+
const internalData = $xeTable
|
|
5812
|
+
|
|
5813
|
+
const { pendingRowMaps } = reactData
|
|
5814
|
+
const { fullAllDataRowIdData } = internalData
|
|
5815
|
+
const insertRecords: any[] = []
|
|
5816
|
+
XEUtils.each(pendingRowMaps, (row, rowid) => {
|
|
5817
|
+
if (fullAllDataRowIdData[rowid]) {
|
|
5818
|
+
insertRecords.push(row)
|
|
5819
|
+
}
|
|
5820
|
+
})
|
|
5821
|
+
return insertRecords
|
|
5649
5822
|
},
|
|
5650
5823
|
hasPendingByRow (row: any) {
|
|
5651
5824
|
const { pendingRowMaps } = this
|
|
@@ -5654,7 +5827,6 @@ const Methods = {
|
|
|
5654
5827
|
},
|
|
5655
5828
|
clearPendingRow () {
|
|
5656
5829
|
this.pendingRowMaps = {}
|
|
5657
|
-
this.pendingRowList = []
|
|
5658
5830
|
return this.$nextTick()
|
|
5659
5831
|
},
|
|
5660
5832
|
sort (sortConfs: any, sortOrder: any) {
|
|
@@ -6545,6 +6717,8 @@ const Methods = {
|
|
|
6545
6717
|
}
|
|
6546
6718
|
internalData.lastScrollTop = scrollTop
|
|
6547
6719
|
}
|
|
6720
|
+
reactData.isDragColMove = false
|
|
6721
|
+
reactData.isDragRowMove = false
|
|
6548
6722
|
reactData.lastScrollTime = Date.now()
|
|
6549
6723
|
const evntParams = {
|
|
6550
6724
|
scrollTop,
|
|
@@ -23,7 +23,7 @@ import keyboardMixin from '../module/keyboard/mixin'
|
|
|
23
23
|
import validatorMixin from '../module/validator/mixin'
|
|
24
24
|
import customMixin from '../module/custom/mixin'
|
|
25
25
|
|
|
26
|
-
import type { VxeLoadingComponent, VxeTooltipComponent, VxeTabsConstructor, VxeTabsPrivateMethods } from 'vxe-pc-ui'
|
|
26
|
+
import type { VxeLoadingComponent, VxeTooltipComponent, VxeTabsConstructor, VxeTabsPrivateMethods, VxeComponentStyleType } from 'vxe-pc-ui'
|
|
27
27
|
|
|
28
28
|
const { getConfig, getIcon, getI18n, renderer, globalResize, globalEvents, globalMixins, renderEmptyElement } = VxeUI
|
|
29
29
|
|
|
@@ -291,8 +291,6 @@ export default {
|
|
|
291
291
|
reColumnFlag: 0,
|
|
292
292
|
// 已标记的对象集
|
|
293
293
|
pendingRowMaps: {},
|
|
294
|
-
// 已标记的行
|
|
295
|
-
pendingRowList: [],
|
|
296
294
|
// 自定义列相关的信息
|
|
297
295
|
customStore: {
|
|
298
296
|
btnEl: null,
|
|
@@ -777,6 +775,18 @@ export default {
|
|
|
777
775
|
y: overflowY && scrollYLoad
|
|
778
776
|
}
|
|
779
777
|
},
|
|
778
|
+
computeTableStyle () {
|
|
779
|
+
const $xeTable = this
|
|
780
|
+
const reactData = $xeTable
|
|
781
|
+
|
|
782
|
+
const { tableData } = reactData
|
|
783
|
+
const columnOpts = $xeTable.computeColumnOpts
|
|
784
|
+
const stys: VxeComponentStyleType = {}
|
|
785
|
+
if (columnOpts.drag) {
|
|
786
|
+
stys['--vxe-ui-table-drag-column-move-delay'] = `${Math.max(0.06, Math.min(0.3, tableData.length / 800))}s`
|
|
787
|
+
}
|
|
788
|
+
return stys
|
|
789
|
+
},
|
|
780
790
|
tabsResizeFlag () {
|
|
781
791
|
const $xeTable = this
|
|
782
792
|
const $xeTabs = $xeTable.$xeTabs
|
|
@@ -786,16 +796,13 @@ export default {
|
|
|
786
796
|
} as any,
|
|
787
797
|
watch: {
|
|
788
798
|
data (value: any) {
|
|
789
|
-
const {
|
|
799
|
+
const { initStatus } = this
|
|
790
800
|
this.loadTableData(value).then(() => {
|
|
791
801
|
this.inited = true
|
|
792
802
|
this.initStatus = true
|
|
793
803
|
if (!initStatus) {
|
|
794
804
|
this.handleLoadDefaults()
|
|
795
805
|
}
|
|
796
|
-
if (!inited) {
|
|
797
|
-
this.handleInitDefaults()
|
|
798
|
-
}
|
|
799
806
|
// const checkboxColumn = this.tableFullColumn.find(column => column.type === 'checkbox')
|
|
800
807
|
// if (checkboxColumn && this.tableFullData.length > 300 && !this.checkboxOpts.checkField) {
|
|
801
808
|
// warnLog('vxe.error.checkProp', ['checkbox-config.checkField'])
|
|
@@ -1065,7 +1072,7 @@ export default {
|
|
|
1065
1072
|
if (this.editRules && !this._validate) {
|
|
1066
1073
|
errLog('vxe.error.reqModule', ['Validator'])
|
|
1067
1074
|
}
|
|
1068
|
-
if ((this.checkboxOpts.range || this.keyboardConfig || this.mouseConfig) && !this.
|
|
1075
|
+
if ((this.checkboxOpts.range || this.keyboardConfig || this.mouseConfig) && !this.handleCellMousedownEvent) {
|
|
1069
1076
|
errLog('vxe.error.reqModule', ['Keyboard'])
|
|
1070
1077
|
}
|
|
1071
1078
|
if ((this.printConfig || this.importConfig || this.exportConfig) && !this._exportData) {
|
|
@@ -1089,8 +1096,8 @@ export default {
|
|
|
1089
1096
|
this.inited = true
|
|
1090
1097
|
this.initStatus = true
|
|
1091
1098
|
this.handleLoadDefaults()
|
|
1092
|
-
this.handleInitDefaults()
|
|
1093
1099
|
}
|
|
1100
|
+
this.handleInitDefaults()
|
|
1094
1101
|
this.updateStyle()
|
|
1095
1102
|
})
|
|
1096
1103
|
globalEvents.on(this, 'paste', this.handleGlobalPasteEvent)
|
|
@@ -1245,6 +1252,8 @@ export default {
|
|
|
1245
1252
|
const vSize = computeSize
|
|
1246
1253
|
const virtualScrollBars = $xeTable.computeVirtualScrollBars
|
|
1247
1254
|
const isArea = mouseConfig && mouseOpts.area
|
|
1255
|
+
const tableStyle = $xeTable.computeTableStyle
|
|
1256
|
+
const columnDragOpts = $xeTable.computeColumnDragOpts
|
|
1248
1257
|
return h('div', {
|
|
1249
1258
|
ref: 'refElem',
|
|
1250
1259
|
class: ['vxe-table', 'vxe-table--render-default', `tid_${tId}`, vSize ? `size--${vSize}` : '', `border--${tableBorder}`, {
|
|
@@ -1260,6 +1269,7 @@ export default {
|
|
|
1260
1269
|
'column--highlight': columnOpts.isHover || highlightHoverColumn,
|
|
1261
1270
|
'checkbox--range': checkboxOpts.range,
|
|
1262
1271
|
'column--calc': isCalcColumn,
|
|
1272
|
+
'col--drag-cell': columnOpts.drag && columnDragOpts.trigger === 'cell',
|
|
1263
1273
|
'is--header': showHeader,
|
|
1264
1274
|
'is--footer': showFooter,
|
|
1265
1275
|
'is--group': isGroup,
|
|
@@ -1277,9 +1287,7 @@ export default {
|
|
|
1277
1287
|
'is--virtual-x': scrollXLoad,
|
|
1278
1288
|
'is--virtual-y': scrollYLoad
|
|
1279
1289
|
}],
|
|
1280
|
-
style:
|
|
1281
|
-
'--vxe-ui-table-drag-column-move-delay': `${Math.max(0.05, Math.min(0.3, tableData.length / 800))}s`
|
|
1282
|
-
},
|
|
1290
|
+
style: tableStyle,
|
|
1283
1291
|
attrs: {
|
|
1284
1292
|
spellcheck: false
|
|
1285
1293
|
},
|