vxe-table 4.12.0-beta.9 → 4.12.1
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 +45 -36
- 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 +29 -33
- 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 -5
- package/es/table/render/index.js +3 -3
- package/es/table/src/body.js +45 -27
- 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 +501 -512
- package/es/table/src/util.js +34 -6
- package/es/ui/index.js +4 -3
- 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 +42 -40
- package/lib/grid/src/grid.min.js +1 -1
- package/lib/index.umd.js +12594 -1185
- 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 +36 -45
- 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 +6 -10
- 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 +53 -26
- 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 +594 -564
- 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 +4 -3
- 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 +49 -42
- 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 +30 -33
- 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 -5
- package/packages/table/render/index.ts +3 -4
- package/packages/table/src/body.ts +46 -27
- 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 +513 -518
- package/packages/table/src/util.ts +39 -6
- package/packages/ui/index.ts +3 -2
- /package/es/{iconfont.1741337003908.ttf → iconfont.1743045589885.ttf} +0 -0
- /package/es/{iconfont.1741337003908.woff → iconfont.1743045589885.woff} +0 -0
- /package/es/{iconfont.1741337003908.woff2 → iconfont.1743045589885.woff2} +0 -0
- /package/lib/{iconfont.1741337003908.ttf → iconfont.1743045589885.ttf} +0 -0
- /package/lib/{iconfont.1741337003908.woff → iconfont.1743045589885.woff} +0 -0
- /package/lib/{iconfont.1741337003908.woff2 → iconfont.1743045589885.woff2} +0 -0
|
@@ -106,8 +106,8 @@ hooks.add('tableEditModule', {
|
|
|
106
106
|
|
|
107
107
|
const handleInsertRowAt = (records: any, targetRow: any, isInsertNextRow?: boolean) => {
|
|
108
108
|
const { treeConfig } = props
|
|
109
|
-
const { mergeList
|
|
110
|
-
const { tableFullTreeData, afterFullData, tableFullData, fullDataRowIdData, fullAllDataRowIdData } = internalData
|
|
109
|
+
const { mergeList } = reactData
|
|
110
|
+
const { tableFullTreeData, afterFullData, tableFullData, fullDataRowIdData, fullAllDataRowIdData, insertRowMaps } = internalData
|
|
111
111
|
const treeOpts = computeTreeOpts.value
|
|
112
112
|
const { transform, rowField, mapChildrenField } = treeOpts
|
|
113
113
|
const childrenField = treeOpts.children || treeOpts.childrenField
|
|
@@ -246,11 +246,11 @@ hooks.add('tableEditModule', {
|
|
|
246
246
|
}
|
|
247
247
|
}
|
|
248
248
|
}
|
|
249
|
-
const { insertMaps } = editStore
|
|
250
249
|
newRecords.forEach(newRow => {
|
|
251
250
|
const rowid = getRowid($xeTable, newRow)
|
|
252
|
-
|
|
251
|
+
insertRowMaps[rowid] = newRow
|
|
253
252
|
})
|
|
253
|
+
reactData.insertRowFlag++
|
|
254
254
|
$xeTable.cacheRowMap(false)
|
|
255
255
|
$xeTable.updateScrollYStatus()
|
|
256
256
|
$xeTable.handleTableData(treeConfig && transform)
|
|
@@ -324,6 +324,8 @@ hooks.add('tableEditModule', {
|
|
|
324
324
|
}
|
|
325
325
|
|
|
326
326
|
const handleEditActive = (params: any, evnt: Event | null, isFocus: boolean, isPos: boolean) => {
|
|
327
|
+
const $xeGrid = $xeTable.xeGrid
|
|
328
|
+
|
|
327
329
|
const { editConfig, mouseConfig } = props
|
|
328
330
|
const { editStore, tableColumn } = reactData
|
|
329
331
|
const editOpts = computeEditOpts.value
|
|
@@ -340,7 +342,7 @@ hooks.add('tableEditModule', {
|
|
|
340
342
|
if (actived.row !== row || (mode === 'cell' ? actived.column !== column : false)) {
|
|
341
343
|
// 判断是否禁用编辑
|
|
342
344
|
let type: 'edit-disabled' | 'edit-activated' = 'edit-disabled'
|
|
343
|
-
if (!beforeEditMethod || beforeEditMethod({ ...params, $table: $xeTable, $grid: $
|
|
345
|
+
if (!beforeEditMethod || beforeEditMethod({ ...params, $table: $xeTable, $grid: $xeGrid })) {
|
|
344
346
|
if (mouseConfig) {
|
|
345
347
|
$xeTable.clearSelected()
|
|
346
348
|
if ($xeTable.clearCellAreas) {
|
|
@@ -368,7 +370,7 @@ hooks.add('tableEditModule', {
|
|
|
368
370
|
$xeTable.handleFocus(params, evnt)
|
|
369
371
|
}
|
|
370
372
|
if (afterEditMethod) {
|
|
371
|
-
afterEditMethod({ ...params, $table: $xeTable, $grid: $
|
|
373
|
+
afterEditMethod({ ...params, $table: $xeTable, $grid: $xeGrid })
|
|
372
374
|
}
|
|
373
375
|
})
|
|
374
376
|
}
|
|
@@ -490,15 +492,13 @@ hooks.add('tableEditModule', {
|
|
|
490
492
|
*/
|
|
491
493
|
remove (rows: any) {
|
|
492
494
|
const { treeConfig } = props
|
|
493
|
-
const { mergeList, editStore
|
|
494
|
-
const { tableFullTreeData, afterFullData, tableFullData } = internalData
|
|
495
|
+
const { mergeList, editStore } = reactData
|
|
496
|
+
const { tableFullTreeData, selectCheckboxMaps, afterFullData, tableFullData, pendingRowMaps, insertRowMaps, removeRowMaps } = internalData
|
|
495
497
|
const checkboxOpts = computeCheckboxOpts.value
|
|
496
498
|
const treeOpts = computeTreeOpts.value
|
|
497
499
|
const { transform, mapChildrenField } = treeOpts
|
|
498
500
|
const childrenField = treeOpts.children || treeOpts.childrenField
|
|
499
|
-
const { actived
|
|
500
|
-
const insertDataRowMaps = Object.assign({}, editStore.insertMaps)
|
|
501
|
-
const pendingDataRowMaps = Object.assign({}, reactData.pendingRowMaps)
|
|
501
|
+
const { actived } = editStore
|
|
502
502
|
const { checkField } = checkboxOpts
|
|
503
503
|
let delList: any[] = []
|
|
504
504
|
if (!rows) {
|
|
@@ -510,19 +510,18 @@ hooks.add('tableEditModule', {
|
|
|
510
510
|
rows.forEach((row: any) => {
|
|
511
511
|
if (!$xeTable.isInsertByRow(row)) {
|
|
512
512
|
const rowid = getRowid($xeTable, row)
|
|
513
|
-
|
|
513
|
+
removeRowMaps[rowid] = row
|
|
514
514
|
}
|
|
515
515
|
})
|
|
516
516
|
// 如果绑定了多选属性,则更新状态
|
|
517
517
|
if (!checkField) {
|
|
518
|
-
const selectRowMaps = { ...selectCheckboxMaps }
|
|
519
518
|
rows.forEach((row: any) => {
|
|
520
519
|
const rowid = getRowid($xeTable, row)
|
|
521
|
-
if (
|
|
522
|
-
delete
|
|
520
|
+
if (selectCheckboxMaps[rowid]) {
|
|
521
|
+
delete selectCheckboxMaps[rowid]
|
|
523
522
|
}
|
|
524
523
|
})
|
|
525
|
-
reactData.
|
|
524
|
+
reactData.updateCheckboxFlag++
|
|
526
525
|
}
|
|
527
526
|
// 从数据源中移除
|
|
528
527
|
if (tableFullData === rows) {
|
|
@@ -579,15 +578,16 @@ hooks.add('tableEditModule', {
|
|
|
579
578
|
// 从新增中移除已删除的数据
|
|
580
579
|
rows.forEach((row: any) => {
|
|
581
580
|
const rowid = getRowid($xeTable, row)
|
|
582
|
-
if (
|
|
583
|
-
delete
|
|
581
|
+
if (insertRowMaps[rowid]) {
|
|
582
|
+
delete insertRowMaps[rowid]
|
|
584
583
|
}
|
|
585
|
-
if (
|
|
586
|
-
delete
|
|
584
|
+
if (pendingRowMaps[rowid]) {
|
|
585
|
+
delete pendingRowMaps[rowid]
|
|
587
586
|
}
|
|
588
587
|
})
|
|
589
|
-
|
|
590
|
-
reactData.
|
|
588
|
+
reactData.removeRowFlag++
|
|
589
|
+
reactData.insertRowFlag++
|
|
590
|
+
reactData.pendingRowFlag++
|
|
591
591
|
$xeTable.updateFooter()
|
|
592
592
|
$xeTable.cacheRowMap(false)
|
|
593
593
|
$xeTable.handleTableData(treeConfig && transform)
|
|
@@ -656,11 +656,9 @@ hooks.add('tableEditModule', {
|
|
|
656
656
|
* 获取新增的临时数据
|
|
657
657
|
*/
|
|
658
658
|
getInsertRecords () {
|
|
659
|
-
const {
|
|
660
|
-
const { fullAllDataRowIdData } = internalData
|
|
661
|
-
const { insertMaps } = editStore
|
|
659
|
+
const { fullAllDataRowIdData, insertRowMaps } = internalData
|
|
662
660
|
const insertRecords: any[] = []
|
|
663
|
-
XEUtils.each(
|
|
661
|
+
XEUtils.each(insertRowMaps, (row, rowid) => {
|
|
664
662
|
if (fullAllDataRowIdData[rowid]) {
|
|
665
663
|
insertRecords.push(row)
|
|
666
664
|
}
|
|
@@ -671,10 +669,9 @@ hooks.add('tableEditModule', {
|
|
|
671
669
|
* 获取已删除的数据
|
|
672
670
|
*/
|
|
673
671
|
getRemoveRecords () {
|
|
674
|
-
const {
|
|
675
|
-
const { removeMaps } = editStore
|
|
672
|
+
const { removeRowMaps } = internalData
|
|
676
673
|
const removeRecords: any[] = []
|
|
677
|
-
XEUtils.each(
|
|
674
|
+
XEUtils.each(removeRowMaps, (row) => {
|
|
678
675
|
removeRecords.push(row)
|
|
679
676
|
})
|
|
680
677
|
return removeRecords
|
|
@@ -701,7 +698,7 @@ hooks.add('tableEditModule', {
|
|
|
701
698
|
if (process.env.VUE_APP_VXE_ENV === 'development') {
|
|
702
699
|
warnLog('vxe.error.delFunc', ['getActiveRecord', 'getEditRecord'])
|
|
703
700
|
}
|
|
704
|
-
return
|
|
701
|
+
return $xeTable.getEditRecord()
|
|
705
702
|
},
|
|
706
703
|
getEditRecord () {
|
|
707
704
|
const { editStore } = reactData
|
|
@@ -729,7 +726,7 @@ hooks.add('tableEditModule', {
|
|
|
729
726
|
if (process.env.VUE_APP_VXE_ENV === 'development') {
|
|
730
727
|
warnLog('vxe.error.delFunc', ['clearActived', 'clearEdit'])
|
|
731
728
|
}
|
|
732
|
-
return
|
|
729
|
+
return $xeTable.clearEdit(row)
|
|
733
730
|
},
|
|
734
731
|
/**
|
|
735
732
|
* 清除激活的编辑
|
|
@@ -753,7 +750,7 @@ hooks.add('tableEditModule', {
|
|
|
753
750
|
warnLog('vxe.error.delFunc', ['isActiveByRow', 'isEditByRow'])
|
|
754
751
|
}
|
|
755
752
|
// 即将废弃
|
|
756
|
-
return
|
|
753
|
+
return $xeTable.isEditByRow(row)
|
|
757
754
|
},
|
|
758
755
|
/**
|
|
759
756
|
* 判断行是否为激活编辑状态
|
|
@@ -914,7 +911,7 @@ hooks.add('tableEditModule', {
|
|
|
914
911
|
if (isMouseSelected && (selected.row !== row || selected.column !== column)) {
|
|
915
912
|
if (actived.row !== row || (editOpts.mode === 'cell' ? actived.column !== column : false)) {
|
|
916
913
|
handleClearEdit(evnt)
|
|
917
|
-
|
|
914
|
+
$xeTable.clearSelected()
|
|
918
915
|
if ($xeTable.clearCellAreas) {
|
|
919
916
|
$xeTable.clearCellAreas()
|
|
920
917
|
$xeTable.clearCopyCellArea()
|
|
@@ -162,6 +162,8 @@ export default defineComponent({
|
|
|
162
162
|
}
|
|
163
163
|
|
|
164
164
|
const renderVN = () => {
|
|
165
|
+
const $xeGrid = $xeTable.xeGrid
|
|
166
|
+
|
|
165
167
|
const { defaultOptions, storeData } = props
|
|
166
168
|
const { isAll: isAllChecked, isIndeterminate: isAllIndeterminate } = reactData
|
|
167
169
|
const { hasTree, hasMerge, isPrint, hasColgroup, columns } = storeData
|
|
@@ -242,7 +244,7 @@ export default defineComponent({
|
|
|
242
244
|
default: () => {
|
|
243
245
|
const params = {
|
|
244
246
|
$table: $xeTable,
|
|
245
|
-
$grid: $
|
|
247
|
+
$grid: $xeGrid,
|
|
246
248
|
options: defaultOptions,
|
|
247
249
|
columns,
|
|
248
250
|
params: defaultOptions.params as any
|
|
@@ -487,7 +489,7 @@ export default defineComponent({
|
|
|
487
489
|
footer () {
|
|
488
490
|
const params = {
|
|
489
491
|
$table: $xeTable,
|
|
490
|
-
$grid: $
|
|
492
|
+
$grid: $xeGrid,
|
|
491
493
|
options: defaultOptions,
|
|
492
494
|
columns,
|
|
493
495
|
params: defaultOptions.params as any
|
|
@@ -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,9 +109,7 @@ 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 {
|
|
113
|
-
const { afterFullData } = internalData
|
|
114
|
-
const { removeMaps } = editStore
|
|
112
|
+
const { afterFullData, pendingRowMaps, removeRowMaps } = internalData
|
|
115
113
|
const treeOpts = computeTreeOpts.value
|
|
116
114
|
const childrenField = treeOpts.children || treeOpts.childrenField
|
|
117
115
|
const validOpts = computeValidOpts.value
|
|
@@ -147,7 +145,7 @@ hooks.add('tableValidatorModule', {
|
|
|
147
145
|
const handleVaild = (row: any) => {
|
|
148
146
|
const rowid = getRowid($xeTable, row)
|
|
149
147
|
// 是否删除
|
|
150
|
-
if (
|
|
148
|
+
if (removeRowMaps[rowid]) {
|
|
151
149
|
return
|
|
152
150
|
}
|
|
153
151
|
// 是否标记删除
|
|
@@ -382,6 +380,8 @@ hooks.add('tableValidatorModule', {
|
|
|
382
380
|
* trigger=blur|change 触发方式(除非特殊场景,否则默认为空就行)
|
|
383
381
|
*/
|
|
384
382
|
validCellRules (validType, row, column, val) {
|
|
383
|
+
const $xeGrid = $xeTable.xeGrid
|
|
384
|
+
|
|
385
385
|
const { editRules } = props
|
|
386
386
|
const { field } = column
|
|
387
387
|
const errorRules: Rule[] = []
|
|
@@ -404,7 +404,7 @@ hooks.add('tableValidatorModule', {
|
|
|
404
404
|
columnIndex: $xeTable.getColumnIndex(column),
|
|
405
405
|
field: column.field,
|
|
406
406
|
$table: $xeTable,
|
|
407
|
-
$grid: $
|
|
407
|
+
$grid: $xeGrid
|
|
408
408
|
}
|
|
409
409
|
let customValid: any
|
|
410
410
|
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
|
})
|