vxe-table 3.20.13 → 3.21.0-beta.0
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/style.css +1 -1
- package/es/table/module/edit/mixin.js +33 -12
- package/es/table/module/keyboard/mixin.js +2 -2
- package/es/table/src/cell.js +3 -3
- package/es/table/src/column.js +6 -3
- package/es/table/src/group.js +6 -3
- package/es/table/src/methods.js +365 -165
- package/es/table/src/props.js +2 -2
- package/es/table/src/table.js +13 -6
- package/es/table/src/util.js +12 -3
- package/es/ui/index.js +3 -3
- package/es/ui/src/dom.js +4 -0
- package/es/ui/src/log.js +1 -1
- package/lib/index.umd.js +364 -302
- package/lib/index.umd.min.js +1 -1
- package/lib/style.css +1 -1
- package/lib/table/module/edit/mixin.js +39 -12
- package/lib/table/module/edit/mixin.min.js +1 -1
- package/lib/table/module/keyboard/mixin.js +2 -2
- package/lib/table/module/keyboard/mixin.min.js +1 -1
- package/lib/table/src/cell.js +3 -3
- package/lib/table/src/column.js +6 -3
- package/lib/table/src/column.min.js +1 -1
- package/lib/table/src/group.js +6 -3
- package/lib/table/src/group.min.js +1 -1
- package/lib/table/src/methods.js +35 -29
- package/lib/table/src/methods.min.js +1 -1
- package/lib/table/src/props.js +2 -2
- package/lib/table/src/props.min.js +1 -1
- package/lib/table/src/table.js +15 -6
- package/lib/table/src/table.min.js +1 -1
- package/lib/table/src/util.js +12 -3
- package/lib/table/src/util.min.js +1 -1
- package/lib/ui/index.js +3 -3
- package/lib/ui/index.min.js +1 -1
- package/lib/ui/src/dom.js +5 -0
- package/lib/ui/src/dom.min.js +1 -1
- package/lib/ui/src/log.js +1 -1
- package/lib/ui/src/log.min.js +1 -1
- package/package.json +3 -3
- package/packages/table/module/edit/mixin.ts +47 -12
- package/packages/table/module/keyboard/mixin.ts +2 -2
- package/packages/table/src/cell.ts +5 -5
- package/packages/table/src/column.ts +10 -7
- package/packages/table/src/group.ts +10 -6
- package/packages/table/src/methods.ts +376 -161
- package/packages/table/src/props.ts +3 -3
- package/packages/table/src/table.ts +13 -6
- package/packages/table/src/util.ts +16 -6
- package/packages/ui/index.ts +2 -2
- package/packages/ui/src/dom.ts +5 -0
- /package/es/{iconfont.1776926445391.ttf → iconfont.1777796331871.ttf} +0 -0
- /package/es/{iconfont.1776926445391.woff → iconfont.1777796331871.woff} +0 -0
- /package/es/{iconfont.1776926445391.woff2 → iconfont.1777796331871.woff2} +0 -0
- /package/lib/{iconfont.1776926445391.ttf → iconfont.1777796331871.ttf} +0 -0
- /package/lib/{iconfont.1776926445391.woff → iconfont.1777796331871.woff} +0 -0
- /package/lib/{iconfont.1776926445391.woff2 → iconfont.1777796331871.woff2} +0 -0
|
@@ -45,7 +45,7 @@ function syncActivedCell ($xeTable: VxeTableConstructor & VxeTablePrivateMethods
|
|
|
45
45
|
const editOpts = $xeTable.computeEditOpts
|
|
46
46
|
const { actived } = editStore
|
|
47
47
|
const { row, column } = actived
|
|
48
|
-
if (row
|
|
48
|
+
if (row && column) {
|
|
49
49
|
if (editOpts.mode === 'row') {
|
|
50
50
|
tableColumn.forEach((column) => setEditColumnModel(row, column))
|
|
51
51
|
} else {
|
|
@@ -94,6 +94,7 @@ function insertTreeRow ($xeTable: VxeTableConstructor & VxeTablePrivateMethods,
|
|
|
94
94
|
fullAllDataRowIdData[rowid] = rest
|
|
95
95
|
}
|
|
96
96
|
})
|
|
97
|
+
$xeTable.handleClearStack()
|
|
97
98
|
}
|
|
98
99
|
|
|
99
100
|
// function insertGroupRow ($xeTable: VxeTableConstructor & VxeTablePrivateMethods, newRecords: any[], isAppend: boolean) {
|
|
@@ -153,6 +154,7 @@ function handleInsertRowAt ($xeTable: VxeTableConstructor & VxeTablePrivateMetho
|
|
|
153
154
|
mergeItem.row = mergeRowIndex + newRecords.length
|
|
154
155
|
}
|
|
155
156
|
})
|
|
157
|
+
$xeTable.handleClearStack()
|
|
156
158
|
}
|
|
157
159
|
} else {
|
|
158
160
|
if (targetRow === -1) {
|
|
@@ -175,6 +177,7 @@ function handleInsertRowAt ($xeTable: VxeTableConstructor & VxeTablePrivateMetho
|
|
|
175
177
|
afterFullData.push(item)
|
|
176
178
|
tableFullData.push(item)
|
|
177
179
|
})
|
|
180
|
+
$xeTable.handleClearStack()
|
|
178
181
|
}
|
|
179
182
|
} else {
|
|
180
183
|
// 如果为虚拟树
|
|
@@ -226,6 +229,7 @@ function handleInsertRowAt ($xeTable: VxeTableConstructor & VxeTablePrivateMetho
|
|
|
226
229
|
parentChilds.splice(targetIndex, 0, ...treeRecords)
|
|
227
230
|
}
|
|
228
231
|
}
|
|
232
|
+
$xeTable.handleClearStack()
|
|
229
233
|
} else {
|
|
230
234
|
warnLog('vxe.error.unableInsert')
|
|
231
235
|
insertTreeRow($xeTable, newRecords, true)
|
|
@@ -272,6 +276,7 @@ function handleInsertRowAt ($xeTable: VxeTableConstructor & VxeTablePrivateMetho
|
|
|
272
276
|
mergeItem.rowspan = mergeRowspan + newRecords.length
|
|
273
277
|
}
|
|
274
278
|
})
|
|
279
|
+
$xeTable.handleClearStack()
|
|
275
280
|
}
|
|
276
281
|
}
|
|
277
282
|
}
|
|
@@ -358,10 +363,10 @@ function handleClearEdit ($xeTable: VxeTableConstructor & VxeTablePrivateMethods
|
|
|
358
363
|
return $xeTable.$nextTick()
|
|
359
364
|
}
|
|
360
365
|
syncActivedCell($xeTable)
|
|
366
|
+
$xeTable.updateFooter()
|
|
361
367
|
actived.args = null
|
|
362
368
|
actived.row = null
|
|
363
369
|
actived.column = null
|
|
364
|
-
$xeTable.updateFooter()
|
|
365
370
|
$xeTable.dispatchEvent('edit-closed', {
|
|
366
371
|
row,
|
|
367
372
|
rowIndex: $xeTable.getRowIndex(row),
|
|
@@ -383,7 +388,11 @@ function handleClearEdit ($xeTable: VxeTableConstructor & VxeTablePrivateMethods
|
|
|
383
388
|
return $xeTable.$nextTick().then(() => $xeTable.updateCellAreas())
|
|
384
389
|
}
|
|
385
390
|
|
|
386
|
-
function handleEditActive ($xeTable: VxeTableConstructor & VxeTablePrivateMethods, params: any, evnt: Event | null,
|
|
391
|
+
function handleEditActive ($xeTable: VxeTableConstructor & VxeTablePrivateMethods, params: any, evnt: Event | null, options: {
|
|
392
|
+
isClear?: boolean
|
|
393
|
+
isFocus?: boolean
|
|
394
|
+
isPos?: boolean
|
|
395
|
+
}) {
|
|
387
396
|
const props = $xeTable
|
|
388
397
|
const reactData = $xeTable as unknown as TableReactData
|
|
389
398
|
const $xeGrid = $xeTable.$xeGrid
|
|
@@ -395,6 +404,7 @@ function handleEditActive ($xeTable: VxeTableConstructor & VxeTablePrivateMethod
|
|
|
395
404
|
const { actived, focused } = editStore
|
|
396
405
|
const { row, column } = params
|
|
397
406
|
const { editRender } = column
|
|
407
|
+
const { isFocus, isPos, isClear } = options
|
|
398
408
|
const cell = (params.cell || $xeTable.getCellElement(row, column))
|
|
399
409
|
const beforeEditMethod = editOpts.beforeEditMethod || editOpts.activeMethod
|
|
400
410
|
params.cell = cell
|
|
@@ -421,6 +431,10 @@ function handleEditActive ($xeTable: VxeTableConstructor & VxeTablePrivateMethod
|
|
|
421
431
|
actived.args = params
|
|
422
432
|
actived.row = row
|
|
423
433
|
actived.column = column
|
|
434
|
+
$xeTable.handlePushStack()
|
|
435
|
+
if (isClear) {
|
|
436
|
+
setCellValue(row, column, null)
|
|
437
|
+
}
|
|
424
438
|
if (mode === 'row') {
|
|
425
439
|
tableColumn.forEach((column: any) => getEditColumnModel(row, column))
|
|
426
440
|
} else {
|
|
@@ -465,7 +479,7 @@ function handleEditActive ($xeTable: VxeTableConstructor & VxeTablePrivateMethod
|
|
|
465
479
|
$xeTable.clearCopyCellArea()
|
|
466
480
|
}
|
|
467
481
|
}
|
|
468
|
-
if (oldColumn !== column) {
|
|
482
|
+
if (oldColumn && oldColumn !== column) {
|
|
469
483
|
const { model: oldModel } = oldColumn
|
|
470
484
|
if (oldModel.update) {
|
|
471
485
|
setCellValue(row, oldColumn, oldModel.value)
|
|
@@ -491,11 +505,16 @@ function handleEditActive ($xeTable: VxeTableConstructor & VxeTablePrivateMethod
|
|
|
491
505
|
return $xeTable.$nextTick()
|
|
492
506
|
}
|
|
493
507
|
|
|
494
|
-
function handleEditCell ($xeTable: VxeTableConstructor & VxeTablePrivateMethods, row: any, fieldOrColumn: string | VxeTableDefines.ColumnInfo,
|
|
508
|
+
function handleEditCell ($xeTable: VxeTableConstructor & VxeTablePrivateMethods, row: any, fieldOrColumn: string | VxeTableDefines.ColumnInfo | null, options: {
|
|
509
|
+
isClear?: boolean | undefined;
|
|
510
|
+
isFocus?: boolean | undefined;
|
|
511
|
+
isPos?: boolean | undefined;
|
|
512
|
+
}) {
|
|
495
513
|
const props = $xeTable
|
|
496
514
|
const internalData = $xeTable as unknown as TableInternalData
|
|
497
515
|
|
|
498
516
|
const { editConfig } = props
|
|
517
|
+
const { isPos } = options
|
|
499
518
|
const column = XEUtils.isString(fieldOrColumn) ? $xeTable.getColumnByField(fieldOrColumn) : fieldOrColumn
|
|
500
519
|
if (row && column && isEnableConf(editConfig) && isEnableConf(column.editRender) && !$xeTable.isAggregateRecord(row)) {
|
|
501
520
|
return Promise.resolve(isPos ? $xeTable.scrollToRow(row, column) : null).then(() => {
|
|
@@ -508,7 +527,7 @@ function handleEditCell ($xeTable: VxeTableConstructor & VxeTablePrivateMethods,
|
|
|
508
527
|
columnIndex: $xeTable.getColumnIndex(column),
|
|
509
528
|
cell,
|
|
510
529
|
$table: $xeTable
|
|
511
|
-
}, null,
|
|
530
|
+
}, null, options)
|
|
512
531
|
internalData._lastCallTime = Date.now()
|
|
513
532
|
}
|
|
514
533
|
return $xeTable.$nextTick()
|
|
@@ -661,6 +680,7 @@ export default {
|
|
|
661
680
|
reactData.removeRowFlag++
|
|
662
681
|
reactData.insertRowFlag++
|
|
663
682
|
reactData.pendingRowFlag++
|
|
683
|
+
$xeTable.handleClearStack()
|
|
664
684
|
$xeTable.cacheRowMap(false)
|
|
665
685
|
$xeTable.handleTableData(treeConfig && transform)
|
|
666
686
|
$xeTable.updateFooter()
|
|
@@ -789,10 +809,15 @@ export default {
|
|
|
789
809
|
/**
|
|
790
810
|
* 处理激活编辑
|
|
791
811
|
*/
|
|
792
|
-
handleEdit (params: any, evnt: any
|
|
812
|
+
handleEdit (params: any, evnt: any, options?: {
|
|
813
|
+
isClear?: boolean
|
|
814
|
+
}) {
|
|
793
815
|
const $xeTable = this as VxeTableConstructor & VxeTablePrivateMethods
|
|
794
816
|
|
|
795
|
-
return handleEditActive($xeTable, params, evnt,
|
|
817
|
+
return handleEditActive($xeTable, params, evnt, Object.assign({
|
|
818
|
+
isFocus: true,
|
|
819
|
+
isPos: true
|
|
820
|
+
}, options))
|
|
796
821
|
},
|
|
797
822
|
/**
|
|
798
823
|
* @deprecated
|
|
@@ -967,7 +992,9 @@ export default {
|
|
|
967
992
|
/**
|
|
968
993
|
* 激活行编辑
|
|
969
994
|
*/
|
|
970
|
-
_setEditRow (row: any, fieldOrColumn
|
|
995
|
+
_setEditRow (row: any, fieldOrColumn?: boolean | string | VxeTableDefines.ColumnInfo<any> | null, options?: {
|
|
996
|
+
isClear?: boolean
|
|
997
|
+
}) {
|
|
971
998
|
const $xeTable = this as VxeTableConstructor & VxeTablePrivateMethods
|
|
972
999
|
const internalData = $xeTable as unknown as TableInternalData
|
|
973
1000
|
|
|
@@ -980,7 +1007,10 @@ export default {
|
|
|
980
1007
|
column = XEUtils.isString(fieldOrColumn) ? $xeTable.getColumnByField(fieldOrColumn) : fieldOrColumn
|
|
981
1008
|
}
|
|
982
1009
|
}
|
|
983
|
-
return handleEditCell($xeTable, row, column,
|
|
1010
|
+
return handleEditCell($xeTable, row, column, Object.assign({
|
|
1011
|
+
isPos,
|
|
1012
|
+
isFocus: isPos
|
|
1013
|
+
}, options))
|
|
984
1014
|
},
|
|
985
1015
|
_setActiveCell (row: any, fieldOrColumn: any) {
|
|
986
1016
|
const $xeTable = this as VxeTableConstructor & VxeTablePrivateMethods
|
|
@@ -992,10 +1022,15 @@ export default {
|
|
|
992
1022
|
/**
|
|
993
1023
|
* 激活单元格编辑
|
|
994
1024
|
*/
|
|
995
|
-
_setEditCell (row: any, fieldOrColumn: any
|
|
1025
|
+
_setEditCell (row: any, fieldOrColumn: string | VxeTableDefines.ColumnInfo<any> | null, options?: {
|
|
1026
|
+
isClear?: boolean
|
|
1027
|
+
}) {
|
|
996
1028
|
const $xeTable = this as VxeTableConstructor & VxeTablePrivateMethods
|
|
997
1029
|
|
|
998
|
-
return handleEditCell($xeTable, row, fieldOrColumn,
|
|
1030
|
+
return handleEditCell($xeTable, row, fieldOrColumn, Object.assign({
|
|
1031
|
+
isFocus: true,
|
|
1032
|
+
isPos: true
|
|
1033
|
+
}, options))
|
|
999
1034
|
},
|
|
1000
1035
|
/**
|
|
1001
1036
|
* 只对 trigger=dblclick 有效,选中单元格
|
|
@@ -494,8 +494,8 @@ export default {
|
|
|
494
494
|
const checkboxOpts = $xeTable.computeCheckboxOpts
|
|
495
495
|
const mouseOpts = $xeTable.computeMouseOpts
|
|
496
496
|
const editOpts = $xeTable.computeEditOpts
|
|
497
|
-
if (mouseConfig && mouseOpts.area && $xeTable.
|
|
498
|
-
return $xeTable.
|
|
497
|
+
if (mouseConfig && mouseOpts.area && $xeTable.triggerCelllAreaMnEvent) {
|
|
498
|
+
return $xeTable.triggerCelllAreaMnEvent(evnt, params)
|
|
499
499
|
} else {
|
|
500
500
|
if (checkboxConfig && checkboxOpts.range) {
|
|
501
501
|
handleCheckboxRangeEvent($xeTable, evnt, params)
|
|
@@ -344,8 +344,8 @@ function renderFooterHandle (h: CreateElement, params: VxeTableDefines.CellRende
|
|
|
344
344
|
}
|
|
345
345
|
|
|
346
346
|
export const Cell = {
|
|
347
|
-
createColumn ($xeTable: VxeTableConstructor & VxeTablePrivateMethods,
|
|
348
|
-
const { type } =
|
|
347
|
+
createColumn ($xeTable: VxeTableConstructor & VxeTablePrivateMethods, columnOpts: VxeTableDefines.ColumnOptions | VxeTableDefines.ColumnInfo) {
|
|
348
|
+
const { type } = columnOpts
|
|
349
349
|
const renConfs: any = {
|
|
350
350
|
renderHeader: renderHeaderHandle,
|
|
351
351
|
renderCell: renderCellHandle,
|
|
@@ -354,7 +354,7 @@ export const Cell = {
|
|
|
354
354
|
if (type === 'expand') {
|
|
355
355
|
renConfs.renderData = Cell.renderExpandData
|
|
356
356
|
}
|
|
357
|
-
return createColumn($xeTable,
|
|
357
|
+
return createColumn($xeTable, columnOpts, renConfs)
|
|
358
358
|
},
|
|
359
359
|
/**
|
|
360
360
|
* 列头标题
|
|
@@ -376,7 +376,7 @@ export const Cell = {
|
|
|
376
376
|
const compConf = renderer.get(renderOpts.name)
|
|
377
377
|
const rtHeader = compConf ? (compConf.renderTableHeader || compConf.renderHeader) : null
|
|
378
378
|
if (rtHeader) {
|
|
379
|
-
return getSlotVNs(renderTitleContent(h, params, rtHeader.call($table, h, renderOpts, params)))
|
|
379
|
+
return getSlotVNs(renderTitleContent(h, params, rtHeader.call($table, h, renderOpts, params))) as VNode[]
|
|
380
380
|
}
|
|
381
381
|
}
|
|
382
382
|
return renderTitleContent(h, params, formatText(column.getTitle(), 1))
|
|
@@ -1280,6 +1280,6 @@ export const Cell = {
|
|
|
1280
1280
|
}
|
|
1281
1281
|
return Cell.renderDefaultCell(h, cellParams)
|
|
1282
1282
|
}
|
|
1283
|
-
}
|
|
1283
|
+
}
|
|
1284
1284
|
|
|
1285
1285
|
export default Cell
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { PropType } from 'vue'
|
|
2
|
-
import Cell from './cell'
|
|
1
|
+
import { PropType, CreateElement } from 'vue'
|
|
3
2
|
import { defineVxeComponent } from '../../ui/src/comp'
|
|
4
3
|
import { assembleColumn, destroyColumn } from './util'
|
|
4
|
+
import Cell from './cell'
|
|
5
5
|
|
|
6
6
|
import type { VxeColumnPropTypes, VxeTableConstructor, VxeTablePrivateMethods } from '../../../types'
|
|
7
7
|
|
|
@@ -171,8 +171,9 @@ export default /* define-vxe-component start */ defineVxeComponent({
|
|
|
171
171
|
name: 'VxeColumn',
|
|
172
172
|
props: columnProps,
|
|
173
173
|
provide () {
|
|
174
|
+
const $xeColumn = this
|
|
174
175
|
return {
|
|
175
|
-
$xeColumn
|
|
176
|
+
$xeColumn,
|
|
176
177
|
$xeGrid: null,
|
|
177
178
|
$xeGantt: null
|
|
178
179
|
}
|
|
@@ -186,10 +187,12 @@ export default /* define-vxe-component start */ defineVxeComponent({
|
|
|
186
187
|
}
|
|
187
188
|
},
|
|
188
189
|
watch: columnWatch,
|
|
189
|
-
created (this
|
|
190
|
+
created (this) {
|
|
191
|
+
const $xeColumn = this
|
|
192
|
+
const props = $xeColumn
|
|
190
193
|
const $xeTable = this.$xeTable as VxeTableConstructor & VxeTablePrivateMethods
|
|
191
194
|
|
|
192
|
-
this.columnConfig =
|
|
195
|
+
this.columnConfig = Cell.createColumn($xeTable, props)
|
|
193
196
|
},
|
|
194
197
|
mounted () {
|
|
195
198
|
this.columnConfig.slots = this.$scopedSlots
|
|
@@ -198,8 +201,8 @@ export default /* define-vxe-component start */ defineVxeComponent({
|
|
|
198
201
|
destroyed () {
|
|
199
202
|
destroyColumn(this)
|
|
200
203
|
},
|
|
201
|
-
render (
|
|
204
|
+
render (h: CreateElement) {
|
|
202
205
|
return h('div', this.$slots.default)
|
|
203
206
|
},
|
|
204
|
-
methods: Cell
|
|
207
|
+
methods: Cell as any
|
|
205
208
|
}) /* define-vxe-component end */
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { CreateElement } from 'vue'
|
|
2
2
|
import { defineVxeComponent } from '../../ui/src/comp'
|
|
3
3
|
import { assembleColumn, destroyColumn } from './util'
|
|
4
4
|
import { columnProps, columnWatch } from './column'
|
|
5
|
+
import Cell from './cell'
|
|
5
6
|
|
|
6
7
|
import type { VxeTableConstructor, VxeTablePrivateMethods } from '../../../types'
|
|
7
8
|
|
|
@@ -9,8 +10,9 @@ export default /* define-vxe-component start */ defineVxeComponent({
|
|
|
9
10
|
name: 'VxeColgroup',
|
|
10
11
|
props: columnProps,
|
|
11
12
|
provide () {
|
|
13
|
+
const $xeColgroup = this
|
|
12
14
|
return {
|
|
13
|
-
$xeColumn:
|
|
15
|
+
$xeColumn: $xeColgroup,
|
|
14
16
|
$xeGrid: null,
|
|
15
17
|
$xeGantt: null
|
|
16
18
|
}
|
|
@@ -24,10 +26,12 @@ export default /* define-vxe-component start */ defineVxeComponent({
|
|
|
24
26
|
}
|
|
25
27
|
},
|
|
26
28
|
watch: columnWatch,
|
|
27
|
-
created (this
|
|
29
|
+
created (this) {
|
|
30
|
+
const $xeColgroup = this
|
|
31
|
+
const props = $xeColgroup
|
|
28
32
|
const $xeTable = this.$xeTable as VxeTableConstructor & VxeTablePrivateMethods
|
|
29
33
|
|
|
30
|
-
this.columnConfig =
|
|
34
|
+
this.columnConfig = Cell.createColumn($xeTable, props)
|
|
31
35
|
},
|
|
32
36
|
mounted () {
|
|
33
37
|
const { $scopedSlots } = this
|
|
@@ -44,8 +48,8 @@ export default /* define-vxe-component start */ defineVxeComponent({
|
|
|
44
48
|
destroyed () {
|
|
45
49
|
destroyColumn(this)
|
|
46
50
|
},
|
|
47
|
-
render (
|
|
51
|
+
render (h: CreateElement) {
|
|
48
52
|
return h('div', this.$slots.default)
|
|
49
53
|
},
|
|
50
|
-
methods: Cell
|
|
54
|
+
methods: Cell as any
|
|
51
55
|
}) /* define-vxe-component end */
|