vxe-table 4.12.0-beta.8 → 4.12.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/grid/src/grid.js +58 -44
- package/es/locale/lang/ar-EG.js +7 -1
- package/es/locale/lang/de-DE.js +7 -1
- package/es/locale/lang/en-US.js +7 -1
- package/es/locale/lang/es-ES.js +7 -1
- package/es/locale/lang/fr-FR.js +7 -1
- package/es/locale/lang/hu-HU.js +7 -1
- package/es/locale/lang/hy-AM.js +7 -1
- package/es/locale/lang/id-ID.js +7 -1
- package/es/locale/lang/it-IT.js +7 -1
- package/es/locale/lang/ja-JP.js +7 -1
- package/es/locale/lang/ko-KR.js +7 -1
- package/es/locale/lang/nb-NO.js +7 -1
- package/es/locale/lang/pt-BR.js +7 -1
- package/es/locale/lang/ru-RU.js +7 -1
- package/es/locale/lang/th-TH.js +7 -1
- package/es/locale/lang/ug-CN.js +7 -1
- package/es/locale/lang/uk-UA.js +7 -1
- package/es/locale/lang/vi-VN.js +7 -1
- package/es/locale/lang/zh-CHT.js +7 -1
- package/es/locale/lang/zh-CN.js +7 -1
- package/es/style.css +1 -1
- package/es/table/module/custom/hook.js +1 -1
- package/es/table/module/custom/panel.js +4 -2
- package/es/table/module/edit/hook.js +11 -12
- package/es/table/module/export/export-panel.js +3 -2
- package/es/table/module/export/import-panel.js +3 -2
- package/es/table/module/filter/panel.js +12 -2
- package/es/table/module/keyboard/hook.js +105 -30
- package/es/table/module/menu/hook.js +2 -1
- package/es/table/module/validator/hook.js +4 -3
- package/es/table/render/index.js +3 -3
- package/es/table/src/body.js +40 -21
- package/es/table/src/cell.js +43 -24
- package/es/table/src/columnInfo.js +2 -2
- package/es/table/src/footer.js +12 -7
- package/es/table/src/header.js +12 -7
- package/es/table/src/props.js +4 -0
- package/es/table/src/table.js +444 -423
- package/es/table/src/util.js +34 -6
- package/es/ui/index.js +2 -1
- package/es/ui/src/log.js +1 -1
- package/helper/vetur/attributes.json +1 -1
- package/helper/vetur/tags.json +1 -1
- package/lib/grid/src/grid.js +55 -48
- package/lib/grid/src/grid.min.js +1 -1
- package/lib/index.umd.js +515 -302
- package/lib/index.umd.min.js +1 -1
- package/lib/locale/lang/ar-EG.js +7 -1
- package/lib/locale/lang/ar-EG.min.js +1 -1
- package/lib/locale/lang/de-DE.js +7 -1
- package/lib/locale/lang/de-DE.min.js +1 -1
- package/lib/locale/lang/en-US.js +7 -1
- package/lib/locale/lang/en-US.min.js +1 -1
- package/lib/locale/lang/en-US.umd.js +7 -1
- package/lib/locale/lang/es-ES.js +7 -1
- package/lib/locale/lang/es-ES.min.js +1 -1
- package/lib/locale/lang/es-ES.umd.js +7 -1
- package/lib/locale/lang/fr-FR.js +7 -1
- package/lib/locale/lang/fr-FR.min.js +1 -1
- package/lib/locale/lang/hu-HU.js +7 -1
- package/lib/locale/lang/hu-HU.min.js +1 -1
- package/lib/locale/lang/hu-HU.umd.js +7 -1
- package/lib/locale/lang/hy-AM.js +7 -1
- package/lib/locale/lang/hy-AM.min.js +1 -1
- package/lib/locale/lang/id-ID.js +7 -1
- package/lib/locale/lang/id-ID.min.js +1 -1
- package/lib/locale/lang/it-IT.js +7 -1
- package/lib/locale/lang/it-IT.min.js +1 -1
- package/lib/locale/lang/ja-JP.js +7 -1
- package/lib/locale/lang/ja-JP.min.js +1 -1
- package/lib/locale/lang/ja-JP.umd.js +7 -1
- package/lib/locale/lang/ko-KR.js +7 -1
- package/lib/locale/lang/ko-KR.min.js +1 -1
- package/lib/locale/lang/ko-KR.umd.js +7 -1
- package/lib/locale/lang/nb-NO.js +7 -1
- package/lib/locale/lang/nb-NO.min.js +1 -1
- package/lib/locale/lang/pt-BR.js +7 -1
- package/lib/locale/lang/pt-BR.min.js +1 -1
- package/lib/locale/lang/pt-BR.umd.js +7 -1
- package/lib/locale/lang/ru-RU.js +7 -1
- package/lib/locale/lang/ru-RU.min.js +1 -1
- package/lib/locale/lang/ru-RU.umd.js +7 -1
- package/lib/locale/lang/th-TH.js +7 -1
- package/lib/locale/lang/th-TH.min.js +1 -1
- package/lib/locale/lang/ug-CN.js +7 -1
- package/lib/locale/lang/ug-CN.min.js +1 -1
- package/lib/locale/lang/uk-UA.js +7 -1
- package/lib/locale/lang/uk-UA.min.js +1 -1
- package/lib/locale/lang/uk-UA.umd.js +7 -1
- package/lib/locale/lang/vi-VN.js +7 -1
- package/lib/locale/lang/vi-VN.min.js +1 -1
- package/lib/locale/lang/zh-CHT.js +7 -1
- package/lib/locale/lang/zh-CHT.min.js +1 -1
- package/lib/locale/lang/zh-CN.js +7 -1
- package/lib/locale/lang/zh-CN.min.js +1 -1
- package/lib/locale/lang/zh-CN.umd.js +7 -1
- package/lib/style.css +1 -1
- package/lib/table/module/custom/hook.js +1 -1
- package/lib/table/module/custom/hook.min.js +1 -1
- package/lib/table/module/custom/panel.js +4 -2
- package/lib/table/module/custom/panel.min.js +1 -1
- package/lib/table/module/edit/hook.js +13 -13
- package/lib/table/module/edit/hook.min.js +1 -1
- package/lib/table/module/export/export-panel.js +3 -2
- package/lib/table/module/export/export-panel.min.js +1 -1
- package/lib/table/module/export/import-panel.js +3 -2
- package/lib/table/module/export/import-panel.min.js +1 -1
- package/lib/table/module/filter/panel.js +8 -2
- package/lib/table/module/filter/panel.min.js +1 -1
- package/lib/table/module/keyboard/hook.js +113 -31
- package/lib/table/module/keyboard/hook.min.js +1 -1
- package/lib/table/module/menu/hook.js +2 -1
- package/lib/table/module/menu/hook.min.js +1 -1
- package/lib/table/module/validator/hook.js +5 -4
- package/lib/table/module/validator/hook.min.js +1 -1
- package/lib/table/render/index.js +4 -3
- package/lib/table/render/index.min.js +1 -1
- package/lib/table/src/body.js +48 -20
- package/lib/table/src/body.min.js +1 -1
- package/lib/table/src/cell.js +49 -25
- package/lib/table/src/cell.min.js +1 -1
- package/lib/table/src/columnInfo.js +2 -4
- package/lib/table/src/columnInfo.min.js +1 -1
- package/lib/table/src/footer.js +12 -5
- package/lib/table/src/footer.min.js +1 -1
- package/lib/table/src/header.js +12 -5
- package/lib/table/src/header.min.js +1 -1
- package/lib/table/src/props.js +4 -0
- package/lib/table/src/props.min.js +1 -1
- package/lib/table/src/table.js +534 -459
- package/lib/table/src/table.min.js +1 -1
- package/lib/table/src/util.js +36 -6
- package/lib/table/src/util.min.js +1 -1
- package/lib/ui/index.js +2 -1
- package/lib/ui/index.min.js +1 -1
- package/lib/ui/src/log.js +1 -1
- package/lib/ui/src/log.min.js +1 -1
- package/package.json +2 -2
- package/packages/grid/src/grid.ts +62 -50
- package/packages/locale/lang/ar-EG.ts +7 -1
- package/packages/locale/lang/de-DE.ts +7 -1
- package/packages/locale/lang/en-US.ts +7 -1
- package/packages/locale/lang/es-ES.ts +7 -1
- package/packages/locale/lang/fr-FR.ts +7 -1
- package/packages/locale/lang/hu-HU.ts +7 -1
- package/packages/locale/lang/hy-AM.ts +7 -1
- package/packages/locale/lang/id-ID.ts +7 -1
- package/packages/locale/lang/it-IT.ts +7 -1
- package/packages/locale/lang/ja-JP.ts +7 -1
- package/packages/locale/lang/ko-KR.ts +7 -1
- package/packages/locale/lang/nb-NO.ts +7 -1
- package/packages/locale/lang/pt-BR.ts +7 -1
- package/packages/locale/lang/ru-RU.ts +7 -1
- package/packages/locale/lang/th-TH.ts +7 -1
- package/packages/locale/lang/ug-CN.ts +7 -1
- package/packages/locale/lang/uk-UA.ts +7 -1
- package/packages/locale/lang/vi-VN.ts +7 -1
- package/packages/locale/lang/zh-CHT.ts +7 -1
- package/packages/locale/lang/zh-CN.ts +7 -1
- package/packages/table/module/custom/hook.ts +1 -1
- package/packages/table/module/custom/panel.ts +6 -2
- package/packages/table/module/edit/hook.ts +12 -12
- package/packages/table/module/export/export-panel.ts +4 -2
- package/packages/table/module/export/import-panel.ts +4 -2
- package/packages/table/module/filter/panel.ts +12 -2
- package/packages/table/module/keyboard/hook.ts +106 -32
- package/packages/table/module/menu/hook.ts +3 -1
- package/packages/table/module/validator/hook.ts +5 -3
- package/packages/table/render/index.ts +3 -4
- package/packages/table/src/body.ts +41 -21
- package/packages/table/src/cell.ts +43 -24
- package/packages/table/src/columnInfo.ts +3 -2
- package/packages/table/src/footer.ts +13 -7
- package/packages/table/src/header.ts +13 -7
- package/packages/table/src/props.ts +4 -0
- package/packages/table/src/table.ts +451 -421
- package/packages/table/src/util.ts +39 -6
- package/packages/ui/index.ts +1 -0
- /package/es/{iconfont.1741333670965.ttf → iconfont.1742955995631.ttf} +0 -0
- /package/es/{iconfont.1741333670965.woff → iconfont.1742955995631.woff} +0 -0
- /package/es/{iconfont.1741333670965.woff2 → iconfont.1742955995631.woff2} +0 -0
- /package/lib/{iconfont.1741333670965.ttf → iconfont.1742955995631.ttf} +0 -0
- /package/lib/{iconfont.1741333670965.woff → iconfont.1742955995631.woff} +0 -0
- /package/lib/{iconfont.1741333670965.woff2 → iconfont.1742955995631.woff2} +0 -0
|
@@ -93,6 +93,8 @@ export default defineComponent({
|
|
|
93
93
|
}
|
|
94
94
|
|
|
95
95
|
const renderVN = () => {
|
|
96
|
+
const $xeGrid = $xeTable.xeGrid
|
|
97
|
+
|
|
96
98
|
const { defaultOptions, storeData } = props
|
|
97
99
|
const selectName = computeSelectName.value
|
|
98
100
|
const hasFile = computeHasFile.value
|
|
@@ -127,7 +129,7 @@ export default defineComponent({
|
|
|
127
129
|
default: () => {
|
|
128
130
|
const params = {
|
|
129
131
|
$table: $xeTable,
|
|
130
|
-
$grid: $
|
|
132
|
+
$grid: $xeGrid,
|
|
131
133
|
options: defaultOptions,
|
|
132
134
|
params: defaultOptions.params as any
|
|
133
135
|
}
|
|
@@ -204,7 +206,7 @@ export default defineComponent({
|
|
|
204
206
|
footer () {
|
|
205
207
|
const params = {
|
|
206
208
|
$table: $xeTable,
|
|
207
|
-
$grid: $
|
|
209
|
+
$grid: $xeGrid,
|
|
208
210
|
options: defaultOptions,
|
|
209
211
|
params: defaultOptions.params as any
|
|
210
212
|
}
|
|
@@ -97,13 +97,23 @@ export default defineComponent({
|
|
|
97
97
|
if (filterSlot) {
|
|
98
98
|
return [
|
|
99
99
|
h('div', {
|
|
100
|
-
class: 'vxe-table--filter-template'
|
|
100
|
+
class: 'vxe-table--filter-template',
|
|
101
|
+
style: maxHeight
|
|
102
|
+
? {
|
|
103
|
+
maxHeight: `${maxHeight}px`
|
|
104
|
+
}
|
|
105
|
+
: {}
|
|
101
106
|
}, $xeTable.callSlot(filterSlot, params))
|
|
102
107
|
]
|
|
103
108
|
} else if (rtFilter) {
|
|
104
109
|
return [
|
|
105
110
|
h('div', {
|
|
106
|
-
class: 'vxe-table--filter-template'
|
|
111
|
+
class: 'vxe-table--filter-template',
|
|
112
|
+
style: maxHeight
|
|
113
|
+
? {
|
|
114
|
+
maxHeight: `${maxHeight}px`
|
|
115
|
+
}
|
|
116
|
+
: {}
|
|
107
117
|
}, getSlotVNs(rtFilter(filterRender, params)))
|
|
108
118
|
]
|
|
109
119
|
}
|
|
@@ -3,7 +3,7 @@ import { VxeUI } from '../../../ui'
|
|
|
3
3
|
import { getRefElem } from '../../src/util'
|
|
4
4
|
import { browse, hasClass, getAbsolutePos, addClass, removeClass } from '../../../ui/src/dom'
|
|
5
5
|
|
|
6
|
-
import type { TableKeyboardPrivateMethods } from '../../../../types'
|
|
6
|
+
import type { TableKeyboardPrivateMethods, VxeTableDefines } from '../../../../types'
|
|
7
7
|
|
|
8
8
|
const { hooks } = VxeUI
|
|
9
9
|
|
|
@@ -33,7 +33,7 @@ hooks.add('tableKeyboardModule', {
|
|
|
33
33
|
setupTable ($xeTable) {
|
|
34
34
|
const { props, reactData, internalData } = $xeTable
|
|
35
35
|
const { refElem } = $xeTable.getRefMaps()
|
|
36
|
-
const { computeEditOpts, computeCheckboxOpts, computeMouseOpts, computeTreeOpts, computeRowOpts, computeCellOpts, computeDefaultRowHeight } = $xeTable.getComputeMaps()
|
|
36
|
+
const { computeEditOpts, computeCheckboxOpts, computeMouseOpts, computeTreeOpts, computeRowOpts, computeColumnOpts, computeCellOpts, computeDefaultRowHeight, computeCurrentRowOpts, computeCurrentColumnOpts } = $xeTable.getComputeMaps()
|
|
37
37
|
|
|
38
38
|
function getCheckboxRangeRows (evnt: MouseEvent, params: any, targetTrElem: HTMLElement, trRect: DOMRect, offsetClientTop: number, moveRange: number) {
|
|
39
39
|
const { showOverflow } = props
|
|
@@ -276,13 +276,47 @@ hooks.add('tableKeyboardModule', {
|
|
|
276
276
|
}
|
|
277
277
|
}
|
|
278
278
|
|
|
279
|
+
const handleMoveSelected = (evnt: any, args: any, isLeftArrow: boolean, isUpArrow: boolean, isRightArrow: boolean, isDwArrow: boolean) => {
|
|
280
|
+
const { afterFullData, visibleColumn } = internalData
|
|
281
|
+
const params = Object.assign({}, args)
|
|
282
|
+
const _rowIndex = $xeTable.getVTRowIndex(params.row)
|
|
283
|
+
const _columnIndex = $xeTable.getVTColumnIndex(params.column)
|
|
284
|
+
evnt.preventDefault()
|
|
285
|
+
if (isUpArrow && _rowIndex > 0) {
|
|
286
|
+
// 移动到上一行
|
|
287
|
+
params.rowIndex = _rowIndex - 1
|
|
288
|
+
params.row = afterFullData[params.rowIndex]
|
|
289
|
+
} else if (isDwArrow && _rowIndex < afterFullData.length - 1) {
|
|
290
|
+
// 移动到下一行
|
|
291
|
+
params.rowIndex = _rowIndex + 1
|
|
292
|
+
params.row = afterFullData[params.rowIndex]
|
|
293
|
+
} else if (isLeftArrow && _columnIndex) {
|
|
294
|
+
// 移动到左侧单元格
|
|
295
|
+
params.columnIndex = _columnIndex - 1
|
|
296
|
+
params.column = visibleColumn[params.columnIndex]
|
|
297
|
+
} else if (isRightArrow && _columnIndex < visibleColumn.length - 1) {
|
|
298
|
+
// 移动到右侧单元格
|
|
299
|
+
params.columnIndex = _columnIndex + 1
|
|
300
|
+
params.column = visibleColumn[params.columnIndex]
|
|
301
|
+
}
|
|
302
|
+
$xeTable.scrollToRow(params.row, params.column).then(() => {
|
|
303
|
+
params.cell = $xeTable.getCellElement(params.row, params.column)
|
|
304
|
+
$xeTable.handleSelected(params, evnt)
|
|
305
|
+
})
|
|
306
|
+
return params
|
|
307
|
+
}
|
|
308
|
+
|
|
279
309
|
const keyboardMethods: TableKeyboardPrivateMethods = {
|
|
280
310
|
// 处理 Tab 键移动
|
|
281
311
|
moveTabSelected (args, isLeft, evnt) {
|
|
282
312
|
const { editConfig } = props
|
|
283
313
|
const { afterFullData, visibleColumn } = internalData
|
|
284
314
|
const editOpts = computeEditOpts.value
|
|
285
|
-
|
|
315
|
+
const rowOpts = computeRowOpts.value
|
|
316
|
+
const currentRowOpts = computeCurrentRowOpts.value
|
|
317
|
+
const columnOpts = computeColumnOpts.value
|
|
318
|
+
const currentColumnOpts = computeCurrentColumnOpts.value
|
|
319
|
+
let targetRow: any
|
|
286
320
|
let targetRowIndex: any
|
|
287
321
|
let targetColumnIndex: any
|
|
288
322
|
const params = Object.assign({}, args)
|
|
@@ -324,18 +358,28 @@ hooks.add('tableKeyboardModule', {
|
|
|
324
358
|
params.columnIndex = targetColumnIndex
|
|
325
359
|
params.column = targetColumn
|
|
326
360
|
params.cell = $xeTable.getCellElement(params.row, params.column)
|
|
361
|
+
if (rowOpts.isCurrent && currentRowOpts.isFollowSelected) {
|
|
362
|
+
$xeTable.triggerCurrentRowEvent(evnt, params)
|
|
363
|
+
}
|
|
364
|
+
if (columnOpts.isCurrent && currentColumnOpts.isFollowSelected) {
|
|
365
|
+
$xeTable.triggerCurrentColumnEvent(evnt, params)
|
|
366
|
+
}
|
|
327
367
|
if (editConfig) {
|
|
328
368
|
if (editOpts.trigger === 'click' || editOpts.trigger === 'dblclick') {
|
|
329
369
|
if (editOpts.mode === 'row') {
|
|
330
370
|
$xeTable.handleEdit(params, evnt)
|
|
331
371
|
} else {
|
|
332
372
|
$xeTable.scrollToRow(params.row, params.column)
|
|
333
|
-
.then(() =>
|
|
373
|
+
.then(() => {
|
|
374
|
+
$xeTable.handleSelected(params, evnt)
|
|
375
|
+
})
|
|
334
376
|
}
|
|
335
377
|
}
|
|
336
378
|
} else {
|
|
337
379
|
$xeTable.scrollToRow(params.row, params.column)
|
|
338
|
-
.then(() =>
|
|
380
|
+
.then(() => {
|
|
381
|
+
$xeTable.handleSelected(params, evnt)
|
|
382
|
+
})
|
|
339
383
|
}
|
|
340
384
|
}
|
|
341
385
|
},
|
|
@@ -347,7 +391,6 @@ hooks.add('tableKeyboardModule', {
|
|
|
347
391
|
const treeOpts = computeTreeOpts.value
|
|
348
392
|
const childrenField = treeOpts.children || treeOpts.childrenField
|
|
349
393
|
let targetRow
|
|
350
|
-
evnt.preventDefault()
|
|
351
394
|
if (currentRow) {
|
|
352
395
|
if (treeConfig) {
|
|
353
396
|
const { index, items } = XEUtils.findTree(afterFullData, item => item === currentRow, { children: childrenField })
|
|
@@ -368,6 +411,7 @@ hooks.add('tableKeyboardModule', {
|
|
|
368
411
|
targetRow = afterFullData[0]
|
|
369
412
|
}
|
|
370
413
|
if (targetRow) {
|
|
414
|
+
evnt.preventDefault()
|
|
371
415
|
const params = {
|
|
372
416
|
$table: $xeTable,
|
|
373
417
|
row: targetRow,
|
|
@@ -378,34 +422,64 @@ hooks.add('tableKeyboardModule', {
|
|
|
378
422
|
.then(() => $xeTable.triggerCurrentRowEvent(evnt, params))
|
|
379
423
|
}
|
|
380
424
|
},
|
|
425
|
+
// 处理当前列方向键移动
|
|
426
|
+
moveCurrentColumn (isLeftArrow, isRightArrow, evnt) {
|
|
427
|
+
const { currentColumn } = reactData
|
|
428
|
+
const { visibleColumn } = internalData
|
|
429
|
+
let targetCol: VxeTableDefines.ColumnInfo | null = null
|
|
430
|
+
if (currentColumn) {
|
|
431
|
+
const _columnIndex = $xeTable.getVTColumnIndex(currentColumn)
|
|
432
|
+
if (isLeftArrow && _columnIndex > 0) {
|
|
433
|
+
targetCol = visibleColumn[_columnIndex - 1]
|
|
434
|
+
} else if (isRightArrow && _columnIndex < visibleColumn.length - 1) {
|
|
435
|
+
targetCol = visibleColumn[_columnIndex + 1]
|
|
436
|
+
}
|
|
437
|
+
} else {
|
|
438
|
+
targetCol = visibleColumn[0]
|
|
439
|
+
}
|
|
440
|
+
if (targetCol) {
|
|
441
|
+
evnt.preventDefault()
|
|
442
|
+
const params = {
|
|
443
|
+
$table: $xeTable,
|
|
444
|
+
column: targetCol,
|
|
445
|
+
columnIndex: $xeTable.getColumnIndex(targetCol),
|
|
446
|
+
$columnIndex: $xeTable.getVMColumnIndex(targetCol)
|
|
447
|
+
}
|
|
448
|
+
$xeTable.scrollToColumn(targetCol)
|
|
449
|
+
.then(() => $xeTable.triggerCurrentColumnEvent(evnt, params))
|
|
450
|
+
}
|
|
451
|
+
},
|
|
381
452
|
// 处理可编辑方向键移动
|
|
382
|
-
|
|
383
|
-
const {
|
|
384
|
-
const
|
|
385
|
-
const
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
if (isUpArrow &&
|
|
389
|
-
|
|
390
|
-
params.rowIndex = _rowIndex - 1
|
|
391
|
-
params.row = afterFullData[params.rowIndex]
|
|
392
|
-
} else if (isDwArrow && _rowIndex < afterFullData.length - 1) {
|
|
393
|
-
// 移动到下一行
|
|
394
|
-
params.rowIndex = _rowIndex + 1
|
|
395
|
-
params.row = afterFullData[params.rowIndex]
|
|
396
|
-
} else if (isLeftArrow && _columnIndex) {
|
|
397
|
-
// 移动到左侧单元格
|
|
398
|
-
params.columnIndex = _columnIndex - 1
|
|
399
|
-
params.column = visibleColumn[params.columnIndex]
|
|
400
|
-
} else if (isRightArrow && _columnIndex < visibleColumn.length - 1) {
|
|
401
|
-
// 移动到右侧单元格
|
|
402
|
-
params.columnIndex = _columnIndex + 1
|
|
403
|
-
params.column = visibleColumn[params.columnIndex]
|
|
453
|
+
moveArrowSelected (args, isLeftArrow, isUpArrow, isRightArrow, isDwArrow, evnt) {
|
|
454
|
+
const { highlightCurrentRow, highlightCurrentColumn } = props
|
|
455
|
+
const rowOpts = computeRowOpts.value
|
|
456
|
+
const columnOpts = computeColumnOpts.value
|
|
457
|
+
handleMoveSelected(evnt, args, isLeftArrow, isUpArrow, isRightArrow, isDwArrow)
|
|
458
|
+
// 当前行按键上下移动
|
|
459
|
+
if ((isUpArrow || isDwArrow) && (rowOpts.isCurrent || highlightCurrentRow)) {
|
|
460
|
+
$xeTable.moveCurrentRow(isUpArrow, isDwArrow, evnt)
|
|
404
461
|
}
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
$xeTable.
|
|
408
|
-
}
|
|
462
|
+
// 当前行按键左右移动
|
|
463
|
+
if ((isLeftArrow || isRightArrow) && (columnOpts.isCurrent || highlightCurrentColumn)) {
|
|
464
|
+
$xeTable.moveCurrentColumn(isLeftArrow, isRightArrow, evnt)
|
|
465
|
+
}
|
|
466
|
+
},
|
|
467
|
+
moveEnterSelected (args, isLeftArrow, isUpArrow, isRightArrow, isDwArrow, evnt) {
|
|
468
|
+
const rowOpts = computeRowOpts.value
|
|
469
|
+
const currentRowOpts = computeCurrentRowOpts.value
|
|
470
|
+
const columnOpts = computeColumnOpts.value
|
|
471
|
+
const currentColumnOpts = computeCurrentColumnOpts.value
|
|
472
|
+
const params = handleMoveSelected(evnt, args, isLeftArrow, isUpArrow, isRightArrow, isDwArrow)
|
|
473
|
+
if ((rowOpts.isCurrent && currentRowOpts.isFollowSelected)) {
|
|
474
|
+
$xeTable.triggerCurrentRowEvent(evnt, params)
|
|
475
|
+
}
|
|
476
|
+
if (columnOpts.isCurrent && currentColumnOpts.isFollowSelected) {
|
|
477
|
+
$xeTable.triggerCurrentColumnEvent(evnt, params)
|
|
478
|
+
}
|
|
479
|
+
},
|
|
480
|
+
// 已废弃,待删除
|
|
481
|
+
moveSelected (args, isLeftArrow, isUpArrow, isRightArrow, isDwArrow, evnt) {
|
|
482
|
+
handleMoveSelected(evnt, args, isLeftArrow, isUpArrow, isRightArrow, isDwArrow)
|
|
409
483
|
},
|
|
410
484
|
handleCellMousedownEvent
|
|
411
485
|
}
|
|
@@ -279,10 +279,12 @@ hooks.add('tableMenuModule', {
|
|
|
279
279
|
* 快捷菜单点击事件
|
|
280
280
|
*/
|
|
281
281
|
ctxMenuLinkEvent (evnt, menu) {
|
|
282
|
+
const $xeGrid = $xeTable.xeGrid
|
|
283
|
+
|
|
282
284
|
// 如果一级菜单有配置 code 则允许点击,否则不能点击
|
|
283
285
|
if (!menu.disabled && (menu.code || !menu.children || !menu.children.length)) {
|
|
284
286
|
const gMenuOpts = menus.get(menu.code)
|
|
285
|
-
const params = Object.assign({}, internalData._currMenuParams, { menu, $table: $xeTable, $grid: $
|
|
287
|
+
const params = Object.assign({}, internalData._currMenuParams, { menu, $table: $xeTable, $grid: $xeGrid, $event: evnt })
|
|
286
288
|
const tmMethod = gMenuOpts ? (gMenuOpts.tableMenuMethod || gMenuOpts.menuMethod) : null
|
|
287
289
|
if (tmMethod) {
|
|
288
290
|
tmMethod(params, evnt)
|
|
@@ -109,8 +109,8 @@ hooks.add('tableValidatorModule', {
|
|
|
109
109
|
const beginValidate = (rows: any, cols: VxeTableDefines.ColumnInfo[] | null, cb: any, isFull?: boolean): Promise<any> => {
|
|
110
110
|
const validRest: any = {}
|
|
111
111
|
const { editRules, treeConfig } = props
|
|
112
|
-
const { editStore
|
|
113
|
-
const { afterFullData } = internalData
|
|
112
|
+
const { editStore } = reactData
|
|
113
|
+
const { afterFullData, pendingRowMaps } = internalData
|
|
114
114
|
const { removeMaps } = editStore
|
|
115
115
|
const treeOpts = computeTreeOpts.value
|
|
116
116
|
const childrenField = treeOpts.children || treeOpts.childrenField
|
|
@@ -382,6 +382,8 @@ hooks.add('tableValidatorModule', {
|
|
|
382
382
|
* trigger=blur|change 触发方式(除非特殊场景,否则默认为空就行)
|
|
383
383
|
*/
|
|
384
384
|
validCellRules (validType, row, column, val) {
|
|
385
|
+
const $xeGrid = $xeTable.xeGrid
|
|
386
|
+
|
|
385
387
|
const { editRules } = props
|
|
386
388
|
const { field } = column
|
|
387
389
|
const errorRules: Rule[] = []
|
|
@@ -404,7 +406,7 @@ hooks.add('tableValidatorModule', {
|
|
|
404
406
|
columnIndex: $xeTable.getColumnIndex(column),
|
|
405
407
|
field: column.field,
|
|
406
408
|
$table: $xeTable,
|
|
407
|
-
$grid: $
|
|
409
|
+
$grid: $xeGrid
|
|
408
410
|
}
|
|
409
411
|
let customValid: any
|
|
410
412
|
if (XEUtils.isString(validator)) {
|
|
@@ -6,10 +6,9 @@ import { getFuncText, formatText, isEmptyValue } from '../../ui/src/utils'
|
|
|
6
6
|
import { getOnName, getModelEvent, getChangeEvent } from '../../ui/src/vn'
|
|
7
7
|
import { errLog } from '../../ui/src/log'
|
|
8
8
|
|
|
9
|
-
import type { VxeButtonComponent } from 'vxe-pc-ui'
|
|
10
9
|
import type { VxeGlobalRendererHandles, VxeColumnPropTypes, VxeTableConstructor, VxeTablePrivateMethods } from '../../../types'
|
|
11
10
|
|
|
12
|
-
const { getConfig, renderer, getI18n } = VxeUI
|
|
11
|
+
const { getConfig, renderer, getI18n, getComponent } = VxeUI
|
|
13
12
|
|
|
14
13
|
const componentDefaultModelProp = 'modelValue'
|
|
15
14
|
|
|
@@ -41,7 +40,7 @@ function getOldComponentName (name: string) {
|
|
|
41
40
|
}
|
|
42
41
|
|
|
43
42
|
function getDefaultComponent ({ name }: any) {
|
|
44
|
-
return
|
|
43
|
+
return getComponent(name)
|
|
45
44
|
}
|
|
46
45
|
|
|
47
46
|
/**
|
|
@@ -393,7 +392,7 @@ function oldEditRender (renderOpts: VxeGlobalRendererHandles.RenderTableEditOpti
|
|
|
393
392
|
*/
|
|
394
393
|
function oldButtonEditRender (renderOpts: any, params: any) {
|
|
395
394
|
return [
|
|
396
|
-
h(
|
|
395
|
+
h(getComponent('vxe-button'), {
|
|
397
396
|
...getCellEditProps(renderOpts, params, null),
|
|
398
397
|
...getComponentOns(renderOpts, params)
|
|
399
398
|
})
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { defineComponent, TransitionGroup, h, ref, Ref, PropType, inject, nextTick, onMounted, onUnmounted } from 'vue'
|
|
2
2
|
import XEUtils from 'xe-utils'
|
|
3
3
|
import { VxeUI } from '../../ui'
|
|
4
|
-
import { getOffsetSize, calcTreeLine, mergeBodyMethod, getRowid } from './util'
|
|
4
|
+
import { getOffsetSize, calcTreeLine, mergeBodyMethod, getRowid, createHandleGetRowId } from './util'
|
|
5
5
|
import { updateCellTitle, getPropClass } from '../../ui/src/dom'
|
|
6
6
|
import { isEnableConf } from '../../ui/src/utils'
|
|
7
7
|
import { getSlotVNs } from '../../ui/src/vn'
|
|
@@ -27,7 +27,7 @@ export default defineComponent({
|
|
|
27
27
|
const $xeTable = inject('$xeTable', {} as VxeTableConstructor & VxeTablePrivateMethods)
|
|
28
28
|
|
|
29
29
|
const { xID, props: tableProps, context: tableContext, reactData: tableReactData, internalData: tableInternalData } = $xeTable
|
|
30
|
-
const { computeEditOpts, computeMouseOpts, computeAreaOpts, computeDefaultRowHeight, computeEmptyOpts, computeTooltipOpts, computeRadioOpts, computeExpandOpts, computeTreeOpts, computeCheckboxOpts, computeCellOpts, computeValidOpts, computeRowOpts, computeColumnOpts, computeRowDragOpts, computeColumnDragOpts, computeResizableOpts } = $xeTable.getComputeMaps()
|
|
30
|
+
const { computeEditOpts, computeMouseOpts, computeCellOffsetWidth, computeAreaOpts, computeDefaultRowHeight, computeEmptyOpts, computeTooltipOpts, computeRadioOpts, computeExpandOpts, computeTreeOpts, computeCheckboxOpts, computeCellOpts, computeValidOpts, computeRowOpts, computeColumnOpts, computeRowDragOpts, computeColumnDragOpts, computeResizableOpts } = $xeTable.getComputeMaps()
|
|
31
31
|
|
|
32
32
|
const refElem = ref() as Ref<HTMLDivElement>
|
|
33
33
|
const refBodyScroll = ref() as Ref<HTMLDivElement>
|
|
@@ -45,7 +45,7 @@ export default defineComponent({
|
|
|
45
45
|
return !!(isDragResize || (lastScrollTime && Date.now() < lastScrollTime + (delayHover as number)))
|
|
46
46
|
}
|
|
47
47
|
|
|
48
|
-
const renderLine = (params: VxeTableDefines.CellRenderBodyParams, cellHeight: number) => {
|
|
48
|
+
const renderLine = (rowid: string, params: VxeTableDefines.CellRenderBodyParams, cellHeight: number) => {
|
|
49
49
|
const { row, column } = params
|
|
50
50
|
const { afterFullData } = tableInternalData
|
|
51
51
|
const { treeConfig } = tableProps
|
|
@@ -55,7 +55,6 @@ export default defineComponent({
|
|
|
55
55
|
if (slots && (slots as any).line) {
|
|
56
56
|
return $xeTable.callSlot((slots as any).line, params)
|
|
57
57
|
}
|
|
58
|
-
const rowid = getRowid($xeTable, row)
|
|
59
58
|
const rest = fullAllDataRowIdData[rowid]
|
|
60
59
|
let rLevel = 0
|
|
61
60
|
let prevRow = null
|
|
@@ -102,9 +101,11 @@ export default defineComponent({
|
|
|
102
101
|
columns: VxeTableDefines.ColumnInfo[],
|
|
103
102
|
items: any[]
|
|
104
103
|
) => {
|
|
105
|
-
const
|
|
104
|
+
const $xeGrid = $xeTable.xeGrid
|
|
105
|
+
|
|
106
|
+
const { fullAllDataRowIdData, fullColumnIdData, visibleColumn } = tableInternalData
|
|
106
107
|
const { columnKey, resizable: allResizable, showOverflow: allShowOverflow, border, height, cellClassName: allCellClassName, cellStyle, align: allAlign, spanMethod, mouseConfig, editConfig, editRules, tooltipConfig, padding: allPadding } = tableProps
|
|
107
|
-
const { tableData, dragRow, overflowX, currentColumn, scrollXLoad, scrollYLoad, calcCellHeightFlag, resizeHeightFlag, mergeList, editStore, isAllOverflow, validErrorMaps } = tableReactData
|
|
108
|
+
const { tableData, dragRow, overflowX, currentColumn, scrollXLoad, scrollYLoad, calcCellHeightFlag, resizeHeightFlag, resizeWidthFlag, mergeList, editStore, isAllOverflow, validErrorMaps } = tableReactData
|
|
108
109
|
const { afterFullData, scrollXStore, scrollYStore } = tableInternalData
|
|
109
110
|
const cellOpts = computeCellOpts.value
|
|
110
111
|
const validOpts = computeValidOpts.value
|
|
@@ -121,19 +122,21 @@ export default defineComponent({
|
|
|
121
122
|
const columnOpts = computeColumnOpts.value
|
|
122
123
|
const mouseOpts = computeMouseOpts.value
|
|
123
124
|
const areaOpts = computeAreaOpts.value
|
|
125
|
+
const cellOffsetWidth = computeCellOffsetWidth.value
|
|
124
126
|
const { selectCellToRow } = areaOpts
|
|
125
127
|
const { type, cellRender, editRender, align, showOverflow, className, treeNode, rowResize, padding, verticalAlign, slots } = column
|
|
126
128
|
const { verticalAlign: allVerticalAlign } = cellOpts
|
|
127
129
|
const { actived } = editStore
|
|
128
|
-
const rowRest = fullAllDataRowIdData[rowid]
|
|
130
|
+
const rowRest = fullAllDataRowIdData[rowid] || {}
|
|
129
131
|
const colid = column.id
|
|
132
|
+
const colRest = fullColumnIdData[colid] || {}
|
|
130
133
|
const renderOpts = editRender || cellRender
|
|
131
134
|
const compConf = renderOpts ? renderer.get(renderOpts.name) : null
|
|
132
135
|
const compCellClassName = compConf ? (compConf.tableCellClassName || compConf.cellClassName) : null
|
|
133
136
|
const compCellStyle = compConf ? (compConf.tableCellStyle || compConf.cellStyle) : ''
|
|
134
137
|
const showAllTip = tooltipOpts.showAll
|
|
135
|
-
const columnIndex =
|
|
136
|
-
const _columnIndex =
|
|
138
|
+
const columnIndex = colRest.index
|
|
139
|
+
const _columnIndex = colRest._index
|
|
137
140
|
const isEdit = isEnableConf(editRender)
|
|
138
141
|
const resizeHeight = resizeHeightFlag ? rowRest.resizeHeight : 0
|
|
139
142
|
let fixedHiddenColumn = fixedType ? column.fixed !== fixedType : column.fixed && overflowX
|
|
@@ -157,7 +160,7 @@ export default defineComponent({
|
|
|
157
160
|
$table: VxeTableConstructor<any> & VxeTablePrivateMethods
|
|
158
161
|
} = {
|
|
159
162
|
$table: $xeTable,
|
|
160
|
-
$grid: $
|
|
163
|
+
$grid: $xeGrid,
|
|
161
164
|
isEdit: false,
|
|
162
165
|
seq,
|
|
163
166
|
rowid,
|
|
@@ -290,6 +293,18 @@ export default defineComponent({
|
|
|
290
293
|
}
|
|
291
294
|
|
|
292
295
|
const tcStyle: Record<string, string> = {}
|
|
296
|
+
if (hasEllipsis && resizeWidthFlag) {
|
|
297
|
+
let tsColspan = tdAttrs.colspan || 0
|
|
298
|
+
if (tsColspan > 1) {
|
|
299
|
+
for (let index = 1; index < tsColspan; index++) {
|
|
300
|
+
const nextColumn = visibleColumn[columnIndex + index]
|
|
301
|
+
if (nextColumn) {
|
|
302
|
+
tsColspan += nextColumn.renderWidth
|
|
303
|
+
}
|
|
304
|
+
}
|
|
305
|
+
}
|
|
306
|
+
tcStyle.width = `${column.renderWidth - (cellOffsetWidth * tsColspan)}px`
|
|
307
|
+
}
|
|
293
308
|
if (scrollYLoad || hasEllipsis || isCsHeight || isRsHeight) {
|
|
294
309
|
tcStyle.height = `${cellHeight}px`
|
|
295
310
|
} else {
|
|
@@ -312,7 +327,7 @@ export default defineComponent({
|
|
|
312
327
|
} else {
|
|
313
328
|
// 渲染单元格
|
|
314
329
|
tdVNs.push(
|
|
315
|
-
...renderLine(cellParams, cellHeight),
|
|
330
|
+
...renderLine(rowid, cellParams, cellHeight),
|
|
316
331
|
h('div', {
|
|
317
332
|
key: 'tc',
|
|
318
333
|
class: ['vxe-cell', {
|
|
@@ -436,8 +451,8 @@ export default defineComponent({
|
|
|
436
451
|
|
|
437
452
|
const renderRows = (fixedType: 'left' | 'right' | '', isOptimizeMode: boolean, tableData: any[], tableColumn: VxeTableDefines.ColumnInfo[]) => {
|
|
438
453
|
const { stripe, rowKey, highlightHoverRow, rowClassName, rowStyle, editConfig, treeConfig } = tableProps
|
|
439
|
-
const { hasFixedColumn,
|
|
440
|
-
const { fullAllDataRowIdData } = tableInternalData
|
|
454
|
+
const { hasFixedColumn, treeExpandedFlag, isColLoading, scrollXLoad, scrollYLoad, isAllOverflow, rowExpandedFlag, expandColumn, selectRadioRow, pendingRowFlag, isDragColMove, rowExpandHeightFlag } = tableReactData
|
|
455
|
+
const { fullAllDataRowIdData, treeExpandedMaps, pendingRowMaps, rowExpandedMaps } = tableInternalData
|
|
441
456
|
const checkboxOpts = computeCheckboxOpts.value
|
|
442
457
|
const radioOpts = computeRadioOpts.value
|
|
443
458
|
const treeOpts = computeTreeOpts.value
|
|
@@ -448,6 +463,7 @@ export default defineComponent({
|
|
|
448
463
|
const { transform, seqMode } = treeOpts
|
|
449
464
|
const childrenField = treeOpts.children || treeOpts.childrenField
|
|
450
465
|
const rows: any[] = []
|
|
466
|
+
const { handleGetRowId } = createHandleGetRowId($xeTable)
|
|
451
467
|
tableData.forEach((row, $rowIndex) => {
|
|
452
468
|
const trOn: Record<string, any> = {}
|
|
453
469
|
let rowIndex = $rowIndex
|
|
@@ -468,8 +484,8 @@ export default defineComponent({
|
|
|
468
484
|
$xeTable.clearHoverRow()
|
|
469
485
|
}
|
|
470
486
|
}
|
|
471
|
-
const rowid =
|
|
472
|
-
const rowRest = fullAllDataRowIdData[rowid]
|
|
487
|
+
const rowid = handleGetRowId(row)
|
|
488
|
+
const rowRest = fullAllDataRowIdData[rowid] || {}
|
|
473
489
|
let rowLevel = 0
|
|
474
490
|
let seq: string | number = -1
|
|
475
491
|
let _rowIndex = 0
|
|
@@ -484,7 +500,7 @@ export default defineComponent({
|
|
|
484
500
|
}
|
|
485
501
|
const params = { $table: $xeTable, seq, rowid, fixed: fixedType, type: renderType, level: rowLevel, row, rowIndex, $rowIndex, _rowIndex }
|
|
486
502
|
// 行是否被展开
|
|
487
|
-
const isExpandRow = expandColumn && !!rowExpandedMaps[rowid]
|
|
503
|
+
const isExpandRow = expandColumn && !!rowExpandedFlag && !!rowExpandedMaps[rowid]
|
|
488
504
|
// 树节点是否被展开
|
|
489
505
|
let isExpandTree = false
|
|
490
506
|
let rowChildren = []
|
|
@@ -494,7 +510,7 @@ export default defineComponent({
|
|
|
494
510
|
}
|
|
495
511
|
if (treeConfig && !scrollYLoad && !transform) {
|
|
496
512
|
rowChildren = row[childrenField]
|
|
497
|
-
isExpandTree = rowChildren && rowChildren.length > 0 && !!treeExpandedMaps[rowid]
|
|
513
|
+
isExpandTree = !!treeExpandedFlag && rowChildren && rowChildren.length > 0 && !!treeExpandedMaps[rowid]
|
|
498
514
|
}
|
|
499
515
|
// 拖拽行事件
|
|
500
516
|
if (rowOpts.drag && (!treeConfig || transform)) {
|
|
@@ -513,7 +529,7 @@ export default defineComponent({
|
|
|
513
529
|
'row--new': isNewRow && (editOpts.showStatus || editOpts.showInsertStatus),
|
|
514
530
|
'row--radio': radioOpts.highlight && $xeTable.eqRow(selectRadioRow, row),
|
|
515
531
|
'row--checked': checkboxOpts.highlight && $xeTable.isCheckedByCheckboxRow(row),
|
|
516
|
-
'row--pending': !!pendingRowMaps[rowid]
|
|
532
|
+
'row--pending': !!pendingRowFlag && !!pendingRowMaps[rowid]
|
|
517
533
|
},
|
|
518
534
|
getPropClass(rowClassName, params)
|
|
519
535
|
]
|
|
@@ -639,6 +655,7 @@ export default defineComponent({
|
|
|
639
655
|
|
|
640
656
|
const renderVN = () => {
|
|
641
657
|
const { slots } = tableContext
|
|
658
|
+
const $xeGrid = $xeTable.xeGrid
|
|
642
659
|
|
|
643
660
|
const { fixedColumn, fixedType, tableColumn } = props
|
|
644
661
|
const { spanMethod, footerSpanMethod, mouseConfig } = tableProps
|
|
@@ -662,7 +679,7 @@ export default defineComponent({
|
|
|
662
679
|
}
|
|
663
680
|
}
|
|
664
681
|
|
|
665
|
-
if (fixedType || !overflowX) {
|
|
682
|
+
if (!isColLoading && (fixedType || !overflowX)) {
|
|
666
683
|
renderColumnList = visibleColumn
|
|
667
684
|
}
|
|
668
685
|
|
|
@@ -723,7 +740,7 @@ export default defineComponent({
|
|
|
723
740
|
let emptyContent: string | VxeComponentSlotType | VxeComponentSlotType[]
|
|
724
741
|
const emptySlot = slots ? slots.empty : null
|
|
725
742
|
if (emptySlot) {
|
|
726
|
-
emptyContent = $xeTable.callSlot(emptySlot, { $table: $xeTable, $grid: $
|
|
743
|
+
emptyContent = $xeTable.callSlot(emptySlot, { $table: $xeTable, $grid: $xeGrid })
|
|
727
744
|
} else {
|
|
728
745
|
const compConf = emptyOpts.name ? renderer.get(emptyOpts.name) : null
|
|
729
746
|
const rtEmptyView = compConf ? (compConf.renderTableEmpty || compConf.renderTableEmptyView || compConf.renderEmpty) : null
|
|
@@ -776,7 +793,10 @@ export default defineComponent({
|
|
|
776
793
|
}, renderColumnList.map((column, $columnIndex) => {
|
|
777
794
|
return h('col', {
|
|
778
795
|
name: column.id,
|
|
779
|
-
key: $columnIndex
|
|
796
|
+
key: $columnIndex,
|
|
797
|
+
style: {
|
|
798
|
+
width: `${column.renderWidth}px`
|
|
799
|
+
}
|
|
780
800
|
})
|
|
781
801
|
})),
|
|
782
802
|
/**
|