vxe-table 4.9.26 → 4.9.28
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 +7 -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/edit/hook.js +10 -3
- package/es/table/module/keyboard/hook.js +2 -31
- package/es/table/src/body.js +16 -4
- package/es/table/src/cell.js +21 -21
- package/es/table/src/header.js +21 -5
- package/es/table/src/table.js +106 -39
- 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 +7 -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 +207 -110
- 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/edit/hook.js +10 -4
- package/lib/table/module/edit/hook.min.js +1 -1
- package/lib/table/module/keyboard/hook.js +1 -36
- package/lib/table/module/keyboard/hook.min.js +1 -1
- package/lib/table/src/body.js +18 -4
- package/lib/table/src/body.min.js +1 -1
- package/lib/table/src/cell.js +27 -19
- package/lib/table/src/cell.min.js +1 -1
- package/lib/table/src/header.js +23 -7
- package/lib/table/src/header.min.js +1 -1
- package/lib/table/src/table.js +122 -39
- 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 +8 -1
- package/packages/table/module/edit/hook.ts +10 -3
- package/packages/table/module/keyboard/hook.ts +2 -31
- package/packages/table/src/body.ts +16 -4
- package/packages/table/src/cell.ts +23 -15
- package/packages/table/src/header.ts +20 -6
- package/packages/table/src/table.ts +107 -42
- package/styles/components/table.scss +36 -0
- /package/es/{iconfont.1734150615727.ttf → iconfont.1734331313492.ttf} +0 -0
- /package/es/{iconfont.1734150615727.woff → iconfont.1734331313492.woff} +0 -0
- /package/es/{iconfont.1734150615727.woff2 → iconfont.1734331313492.woff2} +0 -0
- /package/lib/{iconfont.1734150615727.ttf → iconfont.1734331313492.ttf} +0 -0
- /package/lib/{iconfont.1734150615727.woff → iconfont.1734331313492.woff} +0 -0
- /package/lib/{iconfont.1734150615727.woff2 → iconfont.1734331313492.woff2} +0 -0
|
@@ -36,7 +36,7 @@ export default defineComponent({
|
|
|
36
36
|
|
|
37
37
|
const { xID, props: tableProps, context: tableContext, reactData: tableReactData, internalData: tableInternalData } = $xeTable
|
|
38
38
|
const { refTableBody, refTableHeader, refTableFooter, refTableLeftBody, refTableRightBody, refScrollXHandleElem, refScrollYHandleElem } = $xeTable.getRefMaps()
|
|
39
|
-
const { computeEditOpts, computeMouseOpts, computeAreaOpts, computeSYOpts, computeEmptyOpts, computeKeyboardOpts, computeTooltipOpts, computeRadioOpts, computeExpandOpts, computeTreeOpts, computeCheckboxOpts, computeCellOpts, computeValidOpts, computeRowOpts, computeColumnOpts } = $xeTable.getComputeMaps()
|
|
39
|
+
const { computeEditOpts, computeMouseOpts, computeAreaOpts, computeSYOpts, computeEmptyOpts, computeKeyboardOpts, computeTooltipOpts, computeRadioOpts, computeExpandOpts, computeTreeOpts, computeCheckboxOpts, computeCellOpts, computeValidOpts, computeRowOpts, computeColumnOpts, computeRowDragOpts } = $xeTable.getComputeMaps()
|
|
40
40
|
|
|
41
41
|
const refElem = ref() as Ref<HTMLDivElement>
|
|
42
42
|
const refBodyTable = ref() as Ref<HTMLTableElement>
|
|
@@ -140,6 +140,8 @@ export default defineComponent({
|
|
|
140
140
|
const editOpts = computeEditOpts.value
|
|
141
141
|
const tooltipOpts = computeTooltipOpts.value
|
|
142
142
|
const rowOpts = computeRowOpts.value
|
|
143
|
+
const rowDragOpts = computeRowDragOpts.value
|
|
144
|
+
const { disabledMethod: dragDisabledMethod } = rowDragOpts
|
|
143
145
|
const sYOpts = computeSYOpts.value
|
|
144
146
|
const columnOpts = computeColumnOpts.value
|
|
145
147
|
const mouseOpts = computeMouseOpts.value
|
|
@@ -195,6 +197,14 @@ export default defineComponent({
|
|
|
195
197
|
data: tableData,
|
|
196
198
|
items
|
|
197
199
|
}
|
|
200
|
+
let isColDragCell = false
|
|
201
|
+
let isDisabledDrag = false
|
|
202
|
+
if (rowOpts.drag) {
|
|
203
|
+
isColDragCell = rowDragOpts.trigger === 'row' || (column.dragSort && rowDragOpts.trigger === 'cell')
|
|
204
|
+
}
|
|
205
|
+
if (isColDragCell) {
|
|
206
|
+
isDisabledDrag = !!(dragDisabledMethod && dragDisabledMethod(params))
|
|
207
|
+
}
|
|
198
208
|
// hover 进入事件
|
|
199
209
|
if (showTitle || showTooltip || showAllTip || tooltipConfig) {
|
|
200
210
|
tdOns.onMouseenter = (evnt: MouseEvent) => {
|
|
@@ -223,7 +233,7 @@ export default defineComponent({
|
|
|
223
233
|
}
|
|
224
234
|
}
|
|
225
235
|
// 按下事件处理
|
|
226
|
-
if (checkboxOpts.range || mouseConfig) {
|
|
236
|
+
if (isColDragCell || checkboxOpts.range || mouseConfig) {
|
|
227
237
|
tdOns.onMousedown = (evnt: MouseEvent) => {
|
|
228
238
|
$xeTable.triggerCellMousedownEvent(evnt, params)
|
|
229
239
|
}
|
|
@@ -367,6 +377,8 @@ export default defineComponent({
|
|
|
367
377
|
'col--edit': isEdit,
|
|
368
378
|
'col--ellipsis': hasEllipsis,
|
|
369
379
|
'fixed--hidden': fixedHiddenColumn,
|
|
380
|
+
'is--drag-cell': isColDragCell,
|
|
381
|
+
'is--drag-disabled': isDisabledDrag,
|
|
370
382
|
'col--dirty': isDirty,
|
|
371
383
|
'col--active': editConfig && isEdit && (actived.row === row && (actived.column === column || editOpts.mode === 'row')),
|
|
372
384
|
'col--valid-error': !!errorValidItem,
|
|
@@ -387,7 +399,7 @@ export default defineComponent({
|
|
|
387
399
|
|
|
388
400
|
const renderRows = (fixedType: any, tableData: any, tableColumn: any) => {
|
|
389
401
|
const { stripe, rowKey, highlightHoverRow, rowClassName, rowStyle, showOverflow: allColumnOverflow, editConfig, treeConfig } = tableProps
|
|
390
|
-
const { hasFixedColumn, treeExpandedMaps, scrollYLoad, rowExpandedMaps, expandColumn, selectRadioRow, pendingRowMaps,
|
|
402
|
+
const { hasFixedColumn, treeExpandedMaps, scrollYLoad, rowExpandedMaps, expandColumn, selectRadioRow, pendingRowMaps, isDragColMove } = tableReactData
|
|
391
403
|
const { fullAllDataRowIdData } = tableInternalData
|
|
392
404
|
const checkboxOpts = computeCheckboxOpts.value
|
|
393
405
|
const radioOpts = computeRadioOpts.value
|
|
@@ -463,7 +475,7 @@ export default defineComponent({
|
|
|
463
475
|
'row--new': isNewRow && (editOpts.showStatus || editOpts.showInsertStatus),
|
|
464
476
|
'row--radio': radioOpts.highlight && $xeTable.eqRow(selectRadioRow, row),
|
|
465
477
|
'row--checked': checkboxOpts.highlight && $xeTable.isCheckedByCheckboxRow(row),
|
|
466
|
-
'row--pending':
|
|
478
|
+
'row--pending': !!pendingRowMaps[rowid]
|
|
467
479
|
},
|
|
468
480
|
getPropClass(rowClassName, params)
|
|
469
481
|
]
|
|
@@ -50,20 +50,24 @@ function renderCellDragIcon (params: VxeTableDefines.CellRenderBodyParams) {
|
|
|
50
50
|
const { dragConfig } = tableProps
|
|
51
51
|
const { computeRowDragOpts } = $table.getComputeMaps()
|
|
52
52
|
const rowDragOpts = computeRowDragOpts.value
|
|
53
|
-
const { icon, disabledMethod } = rowDragOpts
|
|
53
|
+
const { icon, trigger, disabledMethod } = rowDragOpts
|
|
54
54
|
const rDisabledMethod = disabledMethod || (dragConfig ? dragConfig.rowDisabledMethod : null)
|
|
55
55
|
const isDisabled = rDisabledMethod && rDisabledMethod(params)
|
|
56
|
+
const ons: Record<string, any> = {}
|
|
57
|
+
if (trigger !== 'cell') {
|
|
58
|
+
ons.onMousedown = (evnt: MouseEvent) => {
|
|
59
|
+
if (!isDisabled) {
|
|
60
|
+
$table.handleCellDragMousedownEvent(evnt, params)
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
ons.onMouseup = $table.handleCellDragMouseupEvent
|
|
64
|
+
}
|
|
56
65
|
return h('span', {
|
|
57
66
|
key: 'dg',
|
|
58
67
|
class: ['vxe-cell--drag-handle', {
|
|
59
68
|
'is--disabled': isDisabled
|
|
60
69
|
}],
|
|
61
|
-
|
|
62
|
-
if (!isDisabled) {
|
|
63
|
-
$table.handleCellDragMousedownEvent(evnt, params)
|
|
64
|
-
}
|
|
65
|
-
},
|
|
66
|
-
onMouseup: $table.handleCellDragMouseupEvent
|
|
70
|
+
...ons
|
|
67
71
|
}, [
|
|
68
72
|
h('i', {
|
|
69
73
|
class: icon || (dragConfig ? dragConfig.rowIcon : '') || getIcon().TABLE_DRAG_ROW
|
|
@@ -103,21 +107,25 @@ function renderHeaderCellDragIcon (params: VxeTableDefines.CellRenderHeaderParam
|
|
|
103
107
|
const { computeColumnOpts, computeColumnDragOpts } = $table.getComputeMaps()
|
|
104
108
|
const columnOpts = computeColumnOpts.value
|
|
105
109
|
const columnDragOpts = computeColumnDragOpts.value
|
|
106
|
-
const { showIcon, icon, isCrossDrag, visibleMethod, disabledMethod } = columnDragOpts
|
|
107
|
-
const isDisabled = disabledMethod && disabledMethod(params)
|
|
110
|
+
const { showIcon, icon, trigger, isCrossDrag, visibleMethod, disabledMethod } = columnDragOpts
|
|
108
111
|
if (columnOpts.drag && showIcon && (!visibleMethod || visibleMethod(params))) {
|
|
109
112
|
if (!column.fixed && (isCrossDrag || !column.parentId)) {
|
|
113
|
+
const isDisabled = disabledMethod && disabledMethod(params)
|
|
114
|
+
const ons: Record<string, any> = {}
|
|
115
|
+
if (trigger !== 'cell') {
|
|
116
|
+
ons.onMousedown = (evnt: MouseEvent) => {
|
|
117
|
+
if (!isDisabled) {
|
|
118
|
+
$table.handleHeaderCellDragMousedownEvent(evnt, params)
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
ons.onMouseup = $table.handleHeaderCellDragMouseupEvent
|
|
122
|
+
}
|
|
110
123
|
return h('span', {
|
|
111
124
|
key: 'dg',
|
|
112
125
|
class: ['vxe-cell--drag-handle', {
|
|
113
126
|
'is--disabled': isDisabled
|
|
114
127
|
}],
|
|
115
|
-
|
|
116
|
-
if (!isDisabled) {
|
|
117
|
-
$table.handleHeaderCellDragMousedownEvent(evnt, params)
|
|
118
|
-
}
|
|
119
|
-
},
|
|
120
|
-
onMouseup: $table.handleHeaderCellDragMouseupEvent
|
|
128
|
+
...ons
|
|
121
129
|
}, [
|
|
122
130
|
h('i', {
|
|
123
131
|
class: icon || getIcon().TABLE_DRAG_COLUMN
|
|
@@ -27,7 +27,7 @@ export default defineComponent({
|
|
|
27
27
|
|
|
28
28
|
const { xID, props: tableProps, reactData: tableReactData, internalData: tableInternalData } = $xeTable
|
|
29
29
|
const { refElem: tableRefElem, refTableBody, refLeftContainer, refRightContainer, refCellResizeBar, refCellResizeTip } = $xeTable.getRefMaps()
|
|
30
|
-
const { computeColumnOpts, computeResizableOpts } = $xeTable.getComputeMaps()
|
|
30
|
+
const { computeColumnOpts, computeColumnDragOpts, computeResizableOpts } = $xeTable.getComputeMaps()
|
|
31
31
|
|
|
32
32
|
const headerColumn = ref([] as VxeTableDefines.ColumnInfo[][])
|
|
33
33
|
|
|
@@ -169,6 +169,8 @@ export default defineComponent({
|
|
|
169
169
|
const { resizable: allResizable, border, columnKey, headerCellClassName, headerCellStyle, showHeaderOverflow: allColumnHeaderOverflow, headerAlign: allHeaderAlign, align: allAlign, mouseConfig } = tableProps
|
|
170
170
|
const { currentColumn, scrollXLoad, overflowX, scrollbarWidth } = tableReactData
|
|
171
171
|
const columnOpts = computeColumnOpts.value
|
|
172
|
+
const columnDragOpts = computeColumnDragOpts.value
|
|
173
|
+
const { disabledMethod: dragDisabledMethod } = columnDragOpts
|
|
172
174
|
return cols.map((column, $columnIndex) => {
|
|
173
175
|
const { type, showHeaderOverflow, headerAlign, align, headerClassName, editRender, cellRender } = column
|
|
174
176
|
const colid = column.id
|
|
@@ -186,6 +188,11 @@ export default defineComponent({
|
|
|
186
188
|
const columnIndex = $xeTable.getColumnIndex(column)
|
|
187
189
|
const _columnIndex = $xeTable.getVTColumnIndex(column)
|
|
188
190
|
const params: VxeTableDefines.CellRenderHeaderParams = { $table: $xeTable, $grid: $xeTable.xegrid, $rowIndex, column, columnIndex, $columnIndex, _columnIndex, fixed: fixedType, type: renderType, isHidden: fixedHiddenColumn, hasFilter }
|
|
191
|
+
const thAttrs: Record<string, string | number | null> = {
|
|
192
|
+
colid,
|
|
193
|
+
colspan: column.colSpan > 1 ? column.colSpan : null,
|
|
194
|
+
rowspan: column.rowSpan > 1 ? column.rowSpan : null
|
|
195
|
+
}
|
|
189
196
|
const thOns: any = {
|
|
190
197
|
onClick: (evnt: MouseEvent) => $xeTable.triggerHeaderCellClickEvent(evnt, params),
|
|
191
198
|
onDblclick: (evnt: MouseEvent) => $xeTable.triggerHeaderCellDblclickEvent(evnt, params)
|
|
@@ -194,15 +201,23 @@ export default defineComponent({
|
|
|
194
201
|
if (scrollXLoad && !hasEllipsis) {
|
|
195
202
|
showEllipsis = hasEllipsis = true
|
|
196
203
|
}
|
|
204
|
+
const isColDragCell = columnOpts.drag && columnDragOpts.trigger === 'cell'
|
|
205
|
+
let isDisabledDrag = false
|
|
206
|
+
if (isColDragCell) {
|
|
207
|
+
isDisabledDrag = !!(dragDisabledMethod && dragDisabledMethod(params))
|
|
208
|
+
}
|
|
197
209
|
// 按下事件处理
|
|
198
|
-
if (mouseConfig) {
|
|
210
|
+
if (mouseConfig || isColDragCell) {
|
|
199
211
|
thOns.onMousedown = (evnt: MouseEvent) => $xeTable.triggerHeaderCellMousedownEvent(evnt, params)
|
|
200
212
|
}
|
|
201
|
-
//
|
|
213
|
+
// 拖拽列事件
|
|
202
214
|
if (columnOpts.drag) {
|
|
203
215
|
thOns.onDragstart = $xeTable.handleHeaderCellDragDragstartEvent
|
|
204
216
|
thOns.onDragend = $xeTable.handleHeaderCellDragDragendEvent
|
|
205
217
|
thOns.onDragover = $xeTable.handleHeaderCellDragDragoverEvent
|
|
218
|
+
if (isColDragCell) {
|
|
219
|
+
thOns.onMouseup = $xeTable.handleHeaderCellDragMouseupEvent
|
|
220
|
+
}
|
|
206
221
|
}
|
|
207
222
|
return h('th', {
|
|
208
223
|
class: ['vxe-header--column', colid, {
|
|
@@ -216,15 +231,14 @@ export default defineComponent({
|
|
|
216
231
|
'is--sortable': column.sortable,
|
|
217
232
|
'col--filter': !!column.filters,
|
|
218
233
|
'is--filter-active': hasFilter,
|
|
234
|
+
'is--drag-disabled': isDisabledDrag,
|
|
219
235
|
'col--current': currentColumn === column
|
|
220
236
|
},
|
|
221
237
|
headerClassName ? (XEUtils.isFunction(headerClassName) ? headerClassName(params) : headerClassName) : '',
|
|
222
238
|
headerCellClassName ? (XEUtils.isFunction(headerCellClassName) ? headerCellClassName(params) : headerCellClassName) : ''
|
|
223
239
|
],
|
|
224
|
-
colid,
|
|
225
|
-
colspan: column.colSpan > 1 ? column.colSpan : null,
|
|
226
|
-
rowspan: column.rowSpan > 1 ? column.rowSpan : null,
|
|
227
240
|
style: headerCellStyle ? (XEUtils.isFunction(headerCellStyle) ? headerCellStyle(params) : headerCellStyle) : null,
|
|
241
|
+
...thAttrs,
|
|
228
242
|
...thOns,
|
|
229
243
|
key: columnKey || columnOpts.useKey || columnOpts.drag || isColGroup ? colid : $columnIndex
|
|
230
244
|
}, [
|
|
@@ -114,8 +114,6 @@ export default defineComponent({
|
|
|
114
114
|
reColumnFlag: 0,
|
|
115
115
|
// 已标记的对象集
|
|
116
116
|
pendingRowMaps: {},
|
|
117
|
-
// 已标记的行
|
|
118
|
-
pendingRowList: [],
|
|
119
117
|
// 初始化标识
|
|
120
118
|
initStore: {
|
|
121
119
|
filter: false,
|
|
@@ -3261,16 +3259,13 @@ export default defineComponent({
|
|
|
3261
3259
|
* @param {Array} datas 数据
|
|
3262
3260
|
*/
|
|
3263
3261
|
loadData (datas) {
|
|
3264
|
-
const {
|
|
3262
|
+
const { initStatus } = internalData
|
|
3265
3263
|
return loadTableData(datas).then(() => {
|
|
3266
3264
|
internalData.inited = true
|
|
3267
3265
|
internalData.initStatus = true
|
|
3268
3266
|
if (!initStatus) {
|
|
3269
3267
|
handleLoadDefaults()
|
|
3270
3268
|
}
|
|
3271
|
-
if (!inited) {
|
|
3272
|
-
handleInitDefaults()
|
|
3273
|
-
}
|
|
3274
3269
|
return tableMethods.recalculate()
|
|
3275
3270
|
})
|
|
3276
3271
|
},
|
|
@@ -3279,7 +3274,6 @@ export default defineComponent({
|
|
|
3279
3274
|
* @param {Array} datas 数据
|
|
3280
3275
|
*/
|
|
3281
3276
|
reloadData (datas) {
|
|
3282
|
-
const { inited } = internalData
|
|
3283
3277
|
return tableMethods.clearAll()
|
|
3284
3278
|
.then(() => {
|
|
3285
3279
|
internalData.inited = true
|
|
@@ -3288,9 +3282,6 @@ export default defineComponent({
|
|
|
3288
3282
|
})
|
|
3289
3283
|
.then(() => {
|
|
3290
3284
|
handleLoadDefaults()
|
|
3291
|
-
if (!inited) {
|
|
3292
|
-
handleInitDefaults()
|
|
3293
|
-
}
|
|
3294
3285
|
return tableMethods.recalculate()
|
|
3295
3286
|
})
|
|
3296
3287
|
},
|
|
@@ -4520,8 +4511,7 @@ export default defineComponent({
|
|
|
4520
4511
|
return nextTick()
|
|
4521
4512
|
},
|
|
4522
4513
|
setPendingRow (rows: any | any[], status: boolean) {
|
|
4523
|
-
const pendingMaps = {
|
|
4524
|
-
const pendingList = [...reactData.pendingRowList]
|
|
4514
|
+
const pendingMaps = Object.assign({}, reactData.pendingRowMaps)
|
|
4525
4515
|
if (rows && !XEUtils.isArray(rows)) {
|
|
4526
4516
|
rows = [rows]
|
|
4527
4517
|
}
|
|
@@ -4529,7 +4519,6 @@ export default defineComponent({
|
|
|
4529
4519
|
rows.forEach((row: any) => {
|
|
4530
4520
|
const rowid = getRowid($xeTable, row)
|
|
4531
4521
|
if (rowid && !pendingMaps[rowid]) {
|
|
4532
|
-
pendingList.push(row)
|
|
4533
4522
|
pendingMaps[rowid] = row
|
|
4534
4523
|
}
|
|
4535
4524
|
})
|
|
@@ -4537,21 +4526,15 @@ export default defineComponent({
|
|
|
4537
4526
|
rows.forEach((row: any) => {
|
|
4538
4527
|
const rowid = getRowid($xeTable, row)
|
|
4539
4528
|
if (rowid && pendingMaps[rowid]) {
|
|
4540
|
-
const pendingIndex = $xeTable.findRowIndexOf(pendingList, row)
|
|
4541
|
-
if (pendingIndex > -1) {
|
|
4542
|
-
pendingList.splice(pendingIndex, 1)
|
|
4543
|
-
}
|
|
4544
4529
|
delete pendingMaps[rowid]
|
|
4545
4530
|
}
|
|
4546
4531
|
})
|
|
4547
4532
|
}
|
|
4548
4533
|
reactData.pendingRowMaps = pendingMaps
|
|
4549
|
-
reactData.pendingRowList = pendingList
|
|
4550
4534
|
return nextTick()
|
|
4551
4535
|
},
|
|
4552
4536
|
togglePendingRow (rows: any | any[]) {
|
|
4553
|
-
const pendingMaps = {
|
|
4554
|
-
const pendingList = [...reactData.pendingRowList]
|
|
4537
|
+
const pendingMaps = Object.assign({}, reactData.pendingRowMaps)
|
|
4555
4538
|
if (rows && !XEUtils.isArray(rows)) {
|
|
4556
4539
|
rows = [rows]
|
|
4557
4540
|
}
|
|
@@ -4559,19 +4542,13 @@ export default defineComponent({
|
|
|
4559
4542
|
const rowid = getRowid($xeTable, row)
|
|
4560
4543
|
if (rowid) {
|
|
4561
4544
|
if (pendingMaps[rowid]) {
|
|
4562
|
-
const pendingIndex = $xeTable.findRowIndexOf(pendingList, row)
|
|
4563
|
-
if (pendingIndex > -1) {
|
|
4564
|
-
pendingList.splice(pendingIndex, 1)
|
|
4565
|
-
}
|
|
4566
4545
|
delete pendingMaps[rowid]
|
|
4567
4546
|
} else {
|
|
4568
|
-
pendingList.push(row)
|
|
4569
4547
|
pendingMaps[rowid] = row
|
|
4570
4548
|
}
|
|
4571
4549
|
}
|
|
4572
4550
|
})
|
|
4573
4551
|
reactData.pendingRowMaps = pendingMaps
|
|
4574
|
-
reactData.pendingRowList = pendingList
|
|
4575
4552
|
return nextTick()
|
|
4576
4553
|
},
|
|
4577
4554
|
hasPendingByRow (row) {
|
|
@@ -4583,12 +4560,18 @@ export default defineComponent({
|
|
|
4583
4560
|
return !!pendingRowMaps[rowid]
|
|
4584
4561
|
},
|
|
4585
4562
|
getPendingRecords () {
|
|
4586
|
-
const {
|
|
4587
|
-
|
|
4563
|
+
const { pendingRowMaps } = reactData
|
|
4564
|
+
const { fullAllDataRowIdData } = internalData
|
|
4565
|
+
const insertRecords: any[] = []
|
|
4566
|
+
XEUtils.each(pendingRowMaps, (row, rowid) => {
|
|
4567
|
+
if (fullAllDataRowIdData[rowid]) {
|
|
4568
|
+
insertRecords.push(row)
|
|
4569
|
+
}
|
|
4570
|
+
})
|
|
4571
|
+
return insertRecords
|
|
4588
4572
|
},
|
|
4589
4573
|
clearPendingRow () {
|
|
4590
4574
|
reactData.pendingRowMaps = {}
|
|
4591
|
-
reactData.pendingRowList = []
|
|
4592
4575
|
return nextTick()
|
|
4593
4576
|
},
|
|
4594
4577
|
sort (sortConfs: any, sortOrder?: VxeTablePropTypes.SortOrder) {
|
|
@@ -6944,6 +6927,20 @@ export default defineComponent({
|
|
|
6944
6927
|
}
|
|
6945
6928
|
}
|
|
6946
6929
|
}
|
|
6930
|
+
// 如果是双击编辑模式
|
|
6931
|
+
if (isEnableConf(editConfig) && editOpts.trigger === 'dblclick') {
|
|
6932
|
+
if (actived.row && actived.column) {
|
|
6933
|
+
if (editOpts.mode === 'row') {
|
|
6934
|
+
if (!$xeTable.eqRow(actived.row, row)) {
|
|
6935
|
+
$xeTable.handleClearEdit(evnt)
|
|
6936
|
+
}
|
|
6937
|
+
} else if (editOpts.mode === 'cell') {
|
|
6938
|
+
if (!$xeTable.eqRow(actived.row, row) || actived.column.id !== column.id) {
|
|
6939
|
+
$xeTable.handleClearEdit(evnt)
|
|
6940
|
+
}
|
|
6941
|
+
}
|
|
6942
|
+
}
|
|
6943
|
+
}
|
|
6947
6944
|
dispatchEvent('cell-click', params, evnt)
|
|
6948
6945
|
},
|
|
6949
6946
|
/**
|
|
@@ -7171,6 +7168,74 @@ export default defineComponent({
|
|
|
7171
7168
|
$xeTable.handleColumnSortEvent(evnt, column)
|
|
7172
7169
|
}
|
|
7173
7170
|
},
|
|
7171
|
+
/**
|
|
7172
|
+
* 表头单元格按下事件
|
|
7173
|
+
*/
|
|
7174
|
+
triggerHeaderCellMousedownEvent (evnt, params) {
|
|
7175
|
+
const { mouseConfig } = props
|
|
7176
|
+
const mouseOpts = computeMouseOpts.value
|
|
7177
|
+
const columnOpts = computeColumnOpts.value
|
|
7178
|
+
const columnDragOpts = computeColumnDragOpts.value
|
|
7179
|
+
const { trigger, disabledMethod } = columnDragOpts
|
|
7180
|
+
const cell = evnt.currentTarget as HTMLDivElement
|
|
7181
|
+
const triggerInput = cell && cell.tagName && cell.tagName.toLowerCase() === 'input'
|
|
7182
|
+
const triggerCheckbox = getEventTargetNode(evnt, cell, 'vxe-cell--checkbox').flag
|
|
7183
|
+
const triggerSort = getEventTargetNode(evnt, cell, 'vxe-cell--sort').flag
|
|
7184
|
+
const triggerFilter = getEventTargetNode(evnt, cell, 'vxe-cell--filter').flag
|
|
7185
|
+
let triggerDrag = false
|
|
7186
|
+
if (!(triggerInput || triggerCheckbox || triggerSort || triggerFilter)) {
|
|
7187
|
+
if (columnOpts.drag && trigger === 'cell' && !(disabledMethod && disabledMethod(params))) {
|
|
7188
|
+
triggerDrag = true
|
|
7189
|
+
$xeTable.handleHeaderCellDragMousedownEvent(evnt, params)
|
|
7190
|
+
}
|
|
7191
|
+
}
|
|
7192
|
+
if (!triggerDrag && mouseConfig && mouseOpts.area && $xeTable.handleHeaderCellAreaEvent) {
|
|
7193
|
+
$xeTable.handleHeaderCellAreaEvent(evnt, Object.assign({ cell, triggerSort, triggerFilter }, params))
|
|
7194
|
+
}
|
|
7195
|
+
$xeTable.focus()
|
|
7196
|
+
if ($xeTable.closeMenu) {
|
|
7197
|
+
$xeTable.closeMenu()
|
|
7198
|
+
}
|
|
7199
|
+
},
|
|
7200
|
+
/**
|
|
7201
|
+
* 单元格按下事件
|
|
7202
|
+
*/
|
|
7203
|
+
triggerCellMousedownEvent (evnt, params) {
|
|
7204
|
+
const { column } = params
|
|
7205
|
+
const { type, treeNode } = column
|
|
7206
|
+
const isRadioType = type === 'radio'
|
|
7207
|
+
const isCheckboxType = type === 'checkbox'
|
|
7208
|
+
const isExpandType = type === 'expand'
|
|
7209
|
+
const rowOpts = computeRowOpts.value
|
|
7210
|
+
const rowDragOpts = computeRowDragOpts.value
|
|
7211
|
+
const { trigger, disabledMethod } = rowDragOpts
|
|
7212
|
+
const cell = evnt.currentTarget
|
|
7213
|
+
params.cell = cell
|
|
7214
|
+
const triggerInput = cell && cell.tagName && cell.tagName.toLowerCase() === 'input'
|
|
7215
|
+
const triggerRadio = isRadioType && getEventTargetNode(evnt, cell, 'vxe-cell--radio').flag
|
|
7216
|
+
const triggerCheckbox = isCheckboxType && getEventTargetNode(evnt, cell, 'vxe-cell--checkbox').flag
|
|
7217
|
+
const triggerTreeNode = treeNode && getEventTargetNode(evnt, cell, 'vxe-tree--btn-wrapper').flag
|
|
7218
|
+
const triggerExpandNode = isExpandType && getEventTargetNode(evnt, cell, 'vxe-table--expanded').flag
|
|
7219
|
+
let isColDragCell = false
|
|
7220
|
+
if (rowOpts.drag) {
|
|
7221
|
+
isColDragCell = trigger === 'row' || (column.dragSort && trigger === 'cell')
|
|
7222
|
+
}
|
|
7223
|
+
let triggerDrag = false
|
|
7224
|
+
if (!(triggerInput || triggerRadio || triggerCheckbox || triggerTreeNode || triggerExpandNode)) {
|
|
7225
|
+
if (isColDragCell && !(disabledMethod && disabledMethod(params))) {
|
|
7226
|
+
triggerDrag = true
|
|
7227
|
+
$xeTable.handleCellDragMousedownEvent(evnt, params)
|
|
7228
|
+
}
|
|
7229
|
+
}
|
|
7230
|
+
if (!triggerDrag && $xeTable.handleCellMousedownEvent) {
|
|
7231
|
+
$xeTable.handleCellMousedownEvent(evnt, params)
|
|
7232
|
+
}
|
|
7233
|
+
$xeTable.focus()
|
|
7234
|
+
$xeTable.closeFilter()
|
|
7235
|
+
if ($xeTable.closeMenu) {
|
|
7236
|
+
$xeTable.closeMenu()
|
|
7237
|
+
}
|
|
7238
|
+
},
|
|
7174
7239
|
/**
|
|
7175
7240
|
* 行拖拽
|
|
7176
7241
|
*/
|
|
@@ -7396,15 +7461,15 @@ export default defineComponent({
|
|
|
7396
7461
|
}
|
|
7397
7462
|
},
|
|
7398
7463
|
handleCellDragMousedownEvent (evnt, params) {
|
|
7464
|
+
evnt.stopPropagation()
|
|
7399
7465
|
const { dragConfig } = props
|
|
7400
7466
|
const rowDragOpts = computeRowDragOpts.value
|
|
7401
|
-
const { dragStartMethod } = rowDragOpts
|
|
7467
|
+
const { trigger, dragStartMethod } = rowDragOpts
|
|
7402
7468
|
const { row } = params
|
|
7403
7469
|
const dragEl = evnt.currentTarget as HTMLElement
|
|
7404
|
-
const tdEl = dragEl.parentElement?.parentElement as HTMLElement
|
|
7470
|
+
const tdEl = trigger === 'cell' || trigger === 'row' ? dragEl : dragEl.parentElement?.parentElement as HTMLElement
|
|
7405
7471
|
const trEl = tdEl.parentElement as HTMLElement
|
|
7406
7472
|
const dStartMethod = dragStartMethod || (dragConfig ? dragConfig.dragStartMethod : null)
|
|
7407
|
-
reactData.isDragRowMove = false
|
|
7408
7473
|
clearRowDropOrigin()
|
|
7409
7474
|
if (dStartMethod && !dStartMethod(params)) {
|
|
7410
7475
|
trEl.draggable = false
|
|
@@ -7644,11 +7709,12 @@ export default defineComponent({
|
|
|
7644
7709
|
}
|
|
7645
7710
|
},
|
|
7646
7711
|
handleHeaderCellDragMousedownEvent (evnt, params) {
|
|
7712
|
+
evnt.stopPropagation()
|
|
7647
7713
|
const columnDragOpts = computeColumnDragOpts.value
|
|
7648
|
-
const { dragStartMethod } = columnDragOpts
|
|
7714
|
+
const { trigger, dragStartMethod } = columnDragOpts
|
|
7649
7715
|
const { column } = params
|
|
7650
7716
|
const dragEl = evnt.currentTarget as HTMLElement
|
|
7651
|
-
const thEl = dragEl.parentElement?.parentElement as HTMLElement
|
|
7717
|
+
const thEl = trigger === 'cell' ? dragEl : dragEl.parentElement?.parentElement as HTMLElement
|
|
7652
7718
|
reactData.isDragColMove = false
|
|
7653
7719
|
clearColDropOrigin()
|
|
7654
7720
|
if (dragStartMethod && !dragStartMethod(params)) {
|
|
@@ -7732,6 +7798,8 @@ export default defineComponent({
|
|
|
7732
7798
|
}
|
|
7733
7799
|
internalData.lastScrollTop = scrollTop
|
|
7734
7800
|
}
|
|
7801
|
+
reactData.isDragColMove = false
|
|
7802
|
+
reactData.isDragRowMove = false
|
|
7735
7803
|
reactData.lastScrollTime = Date.now()
|
|
7736
7804
|
const evntParams = {
|
|
7737
7805
|
scrollTop,
|
|
@@ -8184,6 +8252,7 @@ export default defineComponent({
|
|
|
8184
8252
|
const resizableOpts = computeResizableOpts.value
|
|
8185
8253
|
const isArea = mouseConfig && mouseOpts.area
|
|
8186
8254
|
const tableStyle = computeTableStyle.value
|
|
8255
|
+
const columnDragOpts = computeColumnDragOpts.value
|
|
8187
8256
|
return h('div', {
|
|
8188
8257
|
ref: refElem,
|
|
8189
8258
|
class: ['vxe-table', 'vxe-table--render-default', `tid_${xID}`, `border--${tableBorder}`, {
|
|
@@ -8200,6 +8269,7 @@ export default defineComponent({
|
|
|
8200
8269
|
'column--highlight': columnOpts.isHover || highlightHoverColumn,
|
|
8201
8270
|
'checkbox--range': checkboxOpts.range,
|
|
8202
8271
|
'column--calc': isCalcColumn,
|
|
8272
|
+
'col--drag-cell': columnOpts.drag && columnDragOpts.trigger === 'cell',
|
|
8203
8273
|
'is--header': showHeader,
|
|
8204
8274
|
'is--footer': showFooter,
|
|
8205
8275
|
'is--group': isGroup,
|
|
@@ -8468,7 +8538,7 @@ export default defineComponent({
|
|
|
8468
8538
|
dataFlag.value++
|
|
8469
8539
|
})
|
|
8470
8540
|
watch(dataFlag, () => {
|
|
8471
|
-
const {
|
|
8541
|
+
const { initStatus } = internalData
|
|
8472
8542
|
loadTableData(props.data || []).then(() => {
|
|
8473
8543
|
const { scrollXLoad, scrollYLoad, expandColumn } = reactData
|
|
8474
8544
|
internalData.inited = true
|
|
@@ -8476,9 +8546,6 @@ export default defineComponent({
|
|
|
8476
8546
|
if (!initStatus) {
|
|
8477
8547
|
handleLoadDefaults()
|
|
8478
8548
|
}
|
|
8479
|
-
if (!inited) {
|
|
8480
|
-
handleInitDefaults()
|
|
8481
|
-
}
|
|
8482
8549
|
if (process.env.VUE_APP_VXE_ENV === 'development') {
|
|
8483
8550
|
// const checkboxOpts = computeCheckboxOpts.value
|
|
8484
8551
|
// const checkboxColumn = internalData.tableFullColumn.find(column => column.type === 'checkbox')
|
|
@@ -8758,7 +8825,7 @@ export default defineComponent({
|
|
|
8758
8825
|
if (props.editRules && !$xeTable.validate) {
|
|
8759
8826
|
errLog('vxe.error.reqModule', ['Validator'])
|
|
8760
8827
|
}
|
|
8761
|
-
if ((checkboxOpts.range || props.keyboardConfig || props.mouseConfig) && !$xeTable.
|
|
8828
|
+
if ((checkboxOpts.range || props.keyboardConfig || props.mouseConfig) && !$xeTable.handleCellMousedownEvent) {
|
|
8762
8829
|
errLog('vxe.error.reqModule', ['Keyboard'])
|
|
8763
8830
|
}
|
|
8764
8831
|
if ((props.printConfig || props.importConfig || props.exportConfig) && !$xeTable.exportData) {
|
|
@@ -8783,8 +8850,8 @@ export default defineComponent({
|
|
|
8783
8850
|
internalData.inited = true
|
|
8784
8851
|
internalData.initStatus = true
|
|
8785
8852
|
handleLoadDefaults()
|
|
8786
|
-
handleInitDefaults()
|
|
8787
8853
|
}
|
|
8854
|
+
handleInitDefaults()
|
|
8788
8855
|
updateStyle()
|
|
8789
8856
|
})
|
|
8790
8857
|
|
|
@@ -8825,8 +8892,6 @@ export default defineComponent({
|
|
|
8825
8892
|
tablePrivateMethods.preventEvent(null, 'mounted', { $table: $xeTable })
|
|
8826
8893
|
})
|
|
8827
8894
|
|
|
8828
|
-
;(window as any).aaaa = $xeTable
|
|
8829
|
-
|
|
8830
8895
|
onBeforeUnmount(() => {
|
|
8831
8896
|
if (resizeObserver) {
|
|
8832
8897
|
resizeObserver.disconnect()
|
|
@@ -677,6 +677,24 @@
|
|
|
677
677
|
}
|
|
678
678
|
}
|
|
679
679
|
}
|
|
680
|
+
&.col--drag-cell {
|
|
681
|
+
.vxe-header--column {
|
|
682
|
+
user-select: none;
|
|
683
|
+
&:not(.is--drag-disabled) {
|
|
684
|
+
cursor: grab;
|
|
685
|
+
&:active {
|
|
686
|
+
cursor: grabbing;
|
|
687
|
+
}
|
|
688
|
+
&:hover {
|
|
689
|
+
color: var(--vxe-ui-font-primary-color);
|
|
690
|
+
}
|
|
691
|
+
}
|
|
692
|
+
&.is--drag-disabled {
|
|
693
|
+
color: var(--vxe-ui-input-disabled-color);
|
|
694
|
+
cursor: not-allowed;
|
|
695
|
+
}
|
|
696
|
+
}
|
|
697
|
+
}
|
|
680
698
|
&.column--highlight {
|
|
681
699
|
.vxe-header--column {
|
|
682
700
|
&:not(.col--seq) {
|
|
@@ -1368,6 +1386,24 @@
|
|
|
1368
1386
|
}
|
|
1369
1387
|
}
|
|
1370
1388
|
}
|
|
1389
|
+
.vxe-body--column {
|
|
1390
|
+
&.is--drag-cell {
|
|
1391
|
+
user-select: none;
|
|
1392
|
+
&:not(.is--drag-disabled) {
|
|
1393
|
+
cursor: grab;
|
|
1394
|
+
&:active {
|
|
1395
|
+
cursor: grabbing;
|
|
1396
|
+
}
|
|
1397
|
+
&:hover {
|
|
1398
|
+
color: var(--vxe-ui-font-primary-color);
|
|
1399
|
+
}
|
|
1400
|
+
}
|
|
1401
|
+
&.is--drag-disabled {
|
|
1402
|
+
color: var(--vxe-ui-input-disabled-color);
|
|
1403
|
+
cursor: not-allowed;
|
|
1404
|
+
}
|
|
1405
|
+
}
|
|
1406
|
+
}
|
|
1371
1407
|
.vxe-body--row-list-move {
|
|
1372
1408
|
transition-property: transform;
|
|
1373
1409
|
transition-duration: 0.35s;
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|