vxe-table 4.14.11 → 4.14.13

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.
Files changed (60) hide show
  1. package/es/locale/lang/de-DE.js +80 -80
  2. package/es/locale/lang/es-ES.js +79 -79
  3. package/es/locale/lang/ja-JP.js +82 -82
  4. package/es/locale/lang/ko-KR.js +88 -88
  5. package/es/locale/lang/ru-RU.js +84 -84
  6. package/es/locale/lang/vi-VN.js +79 -79
  7. package/es/locale/lang/zh-CHT.js +21 -21
  8. package/es/style.css +1 -1
  9. package/es/table/src/table.js +30 -122
  10. package/es/table/src/util.js +116 -0
  11. package/es/ui/index.js +1 -1
  12. package/es/ui/src/log.js +1 -1
  13. package/lib/index.umd.js +124 -45
  14. package/lib/index.umd.min.js +1 -1
  15. package/lib/locale/lang/de-DE.js +80 -80
  16. package/lib/locale/lang/de-DE.min.js +1 -1
  17. package/lib/locale/lang/de-DE.umd.js +80 -80
  18. package/lib/locale/lang/es-ES.js +79 -79
  19. package/lib/locale/lang/es-ES.min.js +1 -1
  20. package/lib/locale/lang/es-ES.umd.js +79 -79
  21. package/lib/locale/lang/ja-JP.js +82 -82
  22. package/lib/locale/lang/ja-JP.min.js +1 -1
  23. package/lib/locale/lang/ja-JP.umd.js +82 -82
  24. package/lib/locale/lang/ko-KR.js +88 -88
  25. package/lib/locale/lang/ko-KR.min.js +1 -1
  26. package/lib/locale/lang/ko-KR.umd.js +88 -88
  27. package/lib/locale/lang/ru-RU.js +84 -84
  28. package/lib/locale/lang/ru-RU.min.js +1 -1
  29. package/lib/locale/lang/ru-RU.umd.js +84 -84
  30. package/lib/locale/lang/vi-VN.js +79 -79
  31. package/lib/locale/lang/vi-VN.min.js +1 -1
  32. package/lib/locale/lang/vi-VN.umd.js +79 -79
  33. package/lib/locale/lang/zh-CHT.js +21 -21
  34. package/lib/locale/lang/zh-CHT.min.js +1 -1
  35. package/lib/locale/lang/zh-CHT.umd.js +21 -21
  36. package/lib/style.css +1 -1
  37. package/lib/table/src/table.js +6 -43
  38. package/lib/table/src/table.min.js +1 -1
  39. package/lib/table/src/util.js +117 -0
  40. package/lib/table/src/util.min.js +1 -1
  41. package/lib/ui/index.js +1 -1
  42. package/lib/ui/index.min.js +1 -1
  43. package/lib/ui/src/log.js +1 -1
  44. package/lib/ui/src/log.min.js +1 -1
  45. package/package.json +1 -1
  46. package/packages/locale/lang/de-DE.ts +80 -80
  47. package/packages/locale/lang/es-ES.ts +79 -79
  48. package/packages/locale/lang/ja-JP.ts +82 -82
  49. package/packages/locale/lang/ko-KR.ts +88 -88
  50. package/packages/locale/lang/ru-RU.ts +84 -84
  51. package/packages/locale/lang/vi-VN.ts +79 -79
  52. package/packages/locale/lang/zh-CHT.ts +21 -21
  53. package/packages/table/src/table.ts +31 -127
  54. package/packages/table/src/util.ts +121 -1
  55. /package/es/{iconfont.1754364719798.ttf → iconfont.1754456521837.ttf} +0 -0
  56. /package/es/{iconfont.1754364719798.woff → iconfont.1754456521837.woff} +0 -0
  57. /package/es/{iconfont.1754364719798.woff2 → iconfont.1754456521837.woff2} +0 -0
  58. /package/lib/{iconfont.1754364719798.ttf → iconfont.1754456521837.ttf} +0 -0
  59. /package/lib/{iconfont.1754364719798.woff → iconfont.1754456521837.woff} +0 -0
  60. /package/lib/{iconfont.1754364719798.woff2 → iconfont.1754456521837.woff2} +0 -0
@@ -4,7 +4,7 @@ import XEUtils from 'xe-utils'
4
4
  import { initTpImg, getTpImg, isPx, isScale, hasClass, addClass, removeClass, getEventTargetNode, getPaddingTopBottomSize, setScrollTop, setScrollLeft, toCssUnit, hasControlKey } from '../../ui/src/dom'
5
5
  import { getLastZIndex, nextZIndex, hasChildrenList, getFuncText, isEnableConf, formatText, eqEmptyValue } from '../../ui/src/utils'
6
6
  import { VxeUI } from '../../ui'
7
- import { getRowUniqueId, clearTableAllStatus, toFilters, hasDeepKey, getRowkey, getRowid, rowToVisible, colToVisible, getCellValue, setCellValue, handleRowidOrRow, handleFieldOrColumn, toTreePathSeq, restoreScrollLocation, getRootColumn, getRefElem, getColReMinWidth, createHandleUpdateRowId, createHandleGetRowId, getCalcHeight, getCellRestHeight } from './util'
7
+ import { createInternalData, getRowUniqueId, clearTableAllStatus, toFilters, hasDeepKey, getRowkey, getRowid, rowToVisible, colToVisible, getCellValue, setCellValue, handleRowidOrRow, handleFieldOrColumn, toTreePathSeq, restoreScrollLocation, getRootColumn, getRefElem, getColReMinWidth, createHandleUpdateRowId, createHandleGetRowId, getCalcHeight, getCellRestHeight } from './util'
8
8
  import { getSlotVNs } from '../../ui/src/vn'
9
9
  import { moveRowAnimateToTb, clearRowAnimate, moveColAnimateToLr, clearColAnimate } from './anime'
10
10
  import { warnLog, errLog } from '../../ui/src/log'
@@ -21,7 +21,7 @@ import TableExportPanelComponent from '../module/export/export-panel'
21
21
  import TableMenuPanelComponent from '../module/menu/panel'
22
22
 
23
23
  import type { VxeTooltipInstance, VxeTabsConstructor, VxeTabsPrivateMethods, ValueOf, VxeComponentSlotType } from 'vxe-pc-ui'
24
- import type { VxeGridConstructor, VxeGridPrivateMethods, VxeTableConstructor, TableReactData, TableInternalData, VxeTablePropTypes, VxeToolbarConstructor, TablePrivateMethods, VxeTablePrivateRef, VxeTablePrivateComputed, VxeTablePrivateMethods, TableMethods, VxeTableMethods, VxeTableDefines, VxeTableEmits, VxeTableProps, VxeColumnPropTypes, VxeTableCustomPanelConstructor } from '../../../types'
24
+ import type { VxeGridConstructor, VxeGridPrivateMethods, VxeTableConstructor, TableReactData, VxeTablePropTypes, VxeToolbarConstructor, TablePrivateMethods, VxeTablePrivateRef, VxeTablePrivateComputed, VxeTablePrivateMethods, TableMethods, VxeTableMethods, VxeTableDefines, VxeTableEmits, VxeTableProps, VxeColumnPropTypes, VxeTableCustomPanelConstructor } from '../../../types'
25
25
 
26
26
  const { getConfig, getIcon, getI18n, renderer, formats, createEvent, globalResize, interceptor, hooks, globalEvents, GLOBAL_EVENT_KEYS, useFns, renderEmptyElement } = VxeUI
27
27
 
@@ -298,123 +298,7 @@ export default defineVxeComponent({
298
298
  isColLoading: false
299
299
  })
300
300
 
301
- const internalData: TableInternalData = {
302
- tZindex: 0,
303
- currKeyField: '',
304
- isCurrDeepKey: false,
305
- elemStore: {},
306
- // 存放横向 X 虚拟滚动相关的信息
307
- scrollXStore: {
308
- preloadSize: 0,
309
- offsetSize: 0,
310
- visibleSize: 0,
311
- visibleStartIndex: 0,
312
- visibleEndIndex: 0,
313
- startIndex: 0,
314
- endIndex: 0
315
- },
316
- // 存放纵向 Y 虚拟滚动相关信息
317
- scrollYStore: {
318
- preloadSize: 0,
319
- offsetSize: 0,
320
- visibleSize: 0,
321
- visibleStartIndex: 0,
322
- visibleEndIndex: 0,
323
- startIndex: 0,
324
- endIndex: 0
325
- },
326
- // 表格宽度
327
- tableWidth: 0,
328
- // 表格高度
329
- tableHeight: 0,
330
- // 表头高度
331
- headerHeight: 0,
332
- // 表尾高度
333
- footerHeight: 0,
334
- customHeight: 0,
335
- customMinHeight: 0,
336
- customMaxHeight: 0,
337
- // 当前 hover 行
338
- hoverRow: null,
339
- // 最后滚动位置
340
- lastScrollLeft: 0,
341
- lastScrollTop: 0,
342
- // 单选框属性,已选中保留的行
343
- radioReserveRow: null,
344
- // 复选框属性,已选中保留的行集合
345
- checkboxReserveRowMap: {},
346
- // 行数据,已展开保留的行集合
347
- rowExpandedReserveRowMap: {},
348
- // 树结构数据,已展开保留的行集合
349
- treeExpandedReserveRowMap: {},
350
- // 树结构数据,不确定状态的集合
351
- treeIndeterminateRowMaps: {},
352
- // 列表完整数据、条件处理后
353
- tableFullData: [],
354
- afterFullData: [],
355
- afterTreeFullData: [],
356
- afterGroupFullData: [],
357
- // 列表条件处理后数据集合
358
- afterFullRowMaps: {},
359
- // 树结构完整数据、条件处理后
360
- tableFullTreeData: [],
361
- // 行分组全量数据、条件处理后
362
- tableFullGroupData: [],
363
- tableSynchData: [],
364
- tableSourceData: [],
365
- // 收集的列配置(带分组)
366
- collectColumn: [],
367
- // 完整所有列(不带分组)
368
- tableFullColumn: [],
369
- // 渲染所有列
370
- visibleColumn: [],
371
- // 全量数据集(包括当前和已删除)
372
- fullAllDataRowIdData: {},
373
- // 数据集(仅当前)
374
- fullDataRowIdData: {},
375
- // 数据集(仅可视)
376
- visibleDataRowIdData: {},
377
- // 渲染中缓存数据
378
- sourceDataRowIdData: {},
379
- fullColumnIdData: {},
380
- fullColumnFieldData: {},
381
-
382
- // 合并单元格的数据
383
- mergeBodyList: [],
384
- mergeBodyMaps: {},
385
- // 合并表尾的数据
386
- mergeFooterList: [],
387
- mergeFooterMaps: {},
388
- // 已合并单元格数据集合
389
- mergeBodyCellMaps: {},
390
- // 已合并表尾数据集合
391
- mergeFooterCellMaps: {},
392
- // 已展开的行集合
393
- rowExpandedMaps: {},
394
- // 懒加载中的展开行的集合
395
- rowExpandLazyLoadedMaps: {},
396
- // 已展开的分组行
397
- rowGroupExpandedMaps: {},
398
- // 已展开树节点集合
399
- treeExpandedMaps: {},
400
- // 懒加载中的树节点的集合
401
- treeExpandLazyLoadedMaps: {},
402
- // 复选框属性,已选中的行集合
403
- selectCheckboxMaps: {},
404
- // 已标记的对象集
405
- pendingRowMaps: {},
406
- // 已新增的临时行
407
- insertRowMaps: {},
408
- // 已删除行
409
- removeRowMaps: {},
410
-
411
- cvCacheMaps: {},
412
-
413
- inited: false,
414
- tooltipTimeout: null,
415
- initStatus: false,
416
- isActivated: false
417
- }
301
+ const internalData = createInternalData()
418
302
 
419
303
  let tableMethods = {} as TableMethods
420
304
  let tablePrivateMethods = {} as TablePrivateMethods
@@ -5804,9 +5688,23 @@ export default defineVxeComponent({
5804
5688
  /**
5805
5689
  * 用于当前行,获取当前行的数据
5806
5690
  */
5807
- getCurrentRecord () {
5691
+ getCurrentRecord (isFull) {
5692
+ const { currentRow } = reactData
5693
+ const { fullDataRowIdData, afterFullRowMaps } = internalData
5808
5694
  const rowOpts = computeRowOpts.value
5809
- return rowOpts.isCurrent || props.highlightCurrentRow ? reactData.currentRow : null
5695
+ if (rowOpts.isCurrent || props.highlightCurrentRow) {
5696
+ const rowid = getRowid($xeTable, currentRow)
5697
+ if (isFull) {
5698
+ if (fullDataRowIdData[rowid]) {
5699
+ return currentRow
5700
+ }
5701
+ } else {
5702
+ if (afterFullRowMaps[rowid]) {
5703
+ return currentRow
5704
+ }
5705
+ }
5706
+ }
5707
+ return null
5810
5708
  },
5811
5709
  /**
5812
5710
  * 用于单选行,获取当已选中的数据
@@ -7940,13 +7838,17 @@ export default defineVxeComponent({
7940
7838
  cacheRowMap (isReset) {
7941
7839
  const { treeConfig } = props
7942
7840
  const { isRowGroupStatus } = reactData
7943
- const { fullAllDataRowIdData, tableFullData, tableFullTreeData, tableFullGroupData, treeExpandedMaps } = internalData
7841
+ const { currKeyField, fullAllDataRowIdData, tableFullData, tableFullTreeData, tableFullGroupData, treeExpandedMaps } = internalData
7944
7842
  const fullAllDataRowIdMaps: Record<string, VxeTableDefines.RowCacheItem> = isReset ? {} : { ...fullAllDataRowIdData } // 存在已删除数据
7945
7843
  const fullDataRowIdMaps: Record<string, VxeTableDefines.RowCacheItem> = {}
7946
7844
 
7845
+ const idMaps: Record<string, boolean> = {}
7947
7846
  const { handleUpdateRowId } = createHandleUpdateRowId($xeTable)
7948
7847
  const handleRowCache = (row: any, index: number, items: any, currIndex: number, parentRow: any, rowid: string, level: number, seq: string | number) => {
7949
7848
  let rowRest = fullAllDataRowIdMaps[rowid]
7849
+ if (idMaps[rowid]) {
7850
+ errLog('vxe.error.repeatKey', [currKeyField, rowid])
7851
+ }
7950
7852
  if (!rowRest) {
7951
7853
  rowRest = { row, rowid, seq, index: -1, _index: -1, $index: -1, treeIndex: index, items, parent: parentRow, level, height: 0, resizeHeight: 0, oTop: 0, expandHeight: 0 }
7952
7854
  fullDataRowIdMaps[rowid] = rowRest
@@ -7962,6 +7864,7 @@ export default defineVxeComponent({
7962
7864
  rowRest.index = currIndex
7963
7865
  rowRest.treeIndex = index
7964
7866
 
7867
+ idMaps[rowid] = true
7965
7868
  fullDataRowIdMaps[rowid] = rowRest
7966
7869
  fullAllDataRowIdMaps[rowid] = rowRest
7967
7870
  }
@@ -11684,7 +11587,7 @@ export default defineVxeComponent({
11684
11587
  if (value && value.length >= 50000) {
11685
11588
  warnLog('vxe.error.errLargeData', ['loadData(data), reloadData(data)'])
11686
11589
  }
11687
- loadTableData(value, false).then(() => {
11590
+ loadTableData(value, true).then(() => {
11688
11591
  const { scrollXLoad, scrollYLoad, expandColumn } = reactData
11689
11592
  const expandOpts = computeExpandOpts.value
11690
11593
  internalData.inited = true
@@ -12149,10 +12052,6 @@ export default defineVxeComponent({
12149
12052
  if ($xeTable.closeMenu) {
12150
12053
  $xeTable.closeMenu()
12151
12054
  }
12152
- tablePrivateMethods.preventEvent(null, 'beforeUnmount', { $table: $xeTable })
12153
- })
12154
-
12155
- onUnmounted(() => {
12156
12055
  globalEvents.off($xeTable, 'paste')
12157
12056
  globalEvents.off($xeTable, 'copy')
12158
12057
  globalEvents.off($xeTable, 'cut')
@@ -12162,7 +12061,12 @@ export default defineVxeComponent({
12162
12061
  globalEvents.off($xeTable, 'keydown')
12163
12062
  globalEvents.off($xeTable, 'resize')
12164
12063
  globalEvents.off($xeTable, 'contextmenu')
12064
+ tablePrivateMethods.preventEvent(null, 'beforeUnmount', { $table: $xeTable })
12065
+ })
12066
+
12067
+ onUnmounted(() => {
12165
12068
  tablePrivateMethods.preventEvent(null, 'unmounted', { $table: $xeTable })
12069
+ XEUtils.assign(internalData, createInternalData())
12166
12070
  })
12167
12071
 
12168
12072
  nextTick(() => {
@@ -4,7 +4,127 @@ import { ColumnInfo } from './columnInfo'
4
4
  import { isPx, isScale, queryElement } from '../../ui/src/dom'
5
5
  import { eqEmptyValue } from '../../ui/src/utils'
6
6
 
7
- import type { VxeTableConstructor, VxeTablePrivateMethods, VxeTableDefines, VxeTablePropTypes } from '../../../types'
7
+ import type { VxeTableConstructor, VxeTablePrivateMethods, VxeTableDefines, VxeTablePropTypes, TableInternalData } from '../../../types'
8
+
9
+ export function createInternalData (): TableInternalData {
10
+ return {
11
+ tZindex: 0,
12
+ currKeyField: '',
13
+ isCurrDeepKey: false,
14
+ elemStore: {},
15
+ // 存放横向 X 虚拟滚动相关的信息
16
+ scrollXStore: {
17
+ preloadSize: 0,
18
+ offsetSize: 0,
19
+ visibleSize: 0,
20
+ visibleStartIndex: 0,
21
+ visibleEndIndex: 0,
22
+ startIndex: 0,
23
+ endIndex: 0
24
+ },
25
+ // 存放纵向 Y 虚拟滚动相关信息
26
+ scrollYStore: {
27
+ preloadSize: 0,
28
+ offsetSize: 0,
29
+ visibleSize: 0,
30
+ visibleStartIndex: 0,
31
+ visibleEndIndex: 0,
32
+ startIndex: 0,
33
+ endIndex: 0
34
+ },
35
+ // 表格宽度
36
+ tableWidth: 0,
37
+ // 表格高度
38
+ tableHeight: 0,
39
+ // 表头高度
40
+ headerHeight: 0,
41
+ // 表尾高度
42
+ footerHeight: 0,
43
+ customHeight: 0,
44
+ customMinHeight: 0,
45
+ customMaxHeight: 0,
46
+ // 当前 hover 行
47
+ hoverRow: null,
48
+ // 最后滚动位置
49
+ lastScrollLeft: 0,
50
+ lastScrollTop: 0,
51
+ // 单选框属性,已选中保留的行
52
+ radioReserveRow: null,
53
+ // 复选框属性,已选中保留的行集合
54
+ checkboxReserveRowMap: {},
55
+ // 行数据,已展开保留的行集合
56
+ rowExpandedReserveRowMap: {},
57
+ // 树结构数据,已展开保留的行集合
58
+ treeExpandedReserveRowMap: {},
59
+ // 树结构数据,不确定状态的集合
60
+ treeIndeterminateRowMaps: {},
61
+ // 列表完整数据、条件处理后
62
+ tableFullData: [],
63
+ afterFullData: [],
64
+ afterTreeFullData: [],
65
+ afterGroupFullData: [],
66
+ // 列表条件处理后数据集合
67
+ afterFullRowMaps: {},
68
+ // 树结构完整数据、条件处理后
69
+ tableFullTreeData: [],
70
+ // 行分组全量数据、条件处理后
71
+ tableFullGroupData: [],
72
+ tableSynchData: [],
73
+ tableSourceData: [],
74
+ // 收集的列配置(带分组)
75
+ collectColumn: [],
76
+ // 完整所有列(不带分组)
77
+ tableFullColumn: [],
78
+ // 渲染所有列
79
+ visibleColumn: [],
80
+ // 全量数据集(包括当前和已删除)
81
+ fullAllDataRowIdData: {},
82
+ // 数据集(仅当前)
83
+ fullDataRowIdData: {},
84
+ // 数据集(仅可视)
85
+ visibleDataRowIdData: {},
86
+ // 渲染中缓存数据
87
+ sourceDataRowIdData: {},
88
+ fullColumnIdData: {},
89
+ fullColumnFieldData: {},
90
+
91
+ // 合并单元格的数据
92
+ mergeBodyList: [],
93
+ mergeBodyMaps: {},
94
+ // 合并表尾的数据
95
+ mergeFooterList: [],
96
+ mergeFooterMaps: {},
97
+ // 已合并单元格数据集合
98
+ mergeBodyCellMaps: {},
99
+ // 已合并表尾数据集合
100
+ mergeFooterCellMaps: {},
101
+ // 已展开的行集合
102
+ rowExpandedMaps: {},
103
+ // 懒加载中的展开行的集合
104
+ rowExpandLazyLoadedMaps: {},
105
+ // 已展开的分组行
106
+ rowGroupExpandedMaps: {},
107
+ // 已展开树节点集合
108
+ treeExpandedMaps: {},
109
+ // 懒加载中的树节点的集合
110
+ treeExpandLazyLoadedMaps: {},
111
+ // 复选框属性,已选中的行集合
112
+ selectCheckboxMaps: {},
113
+ // 已标记的对象集
114
+ pendingRowMaps: {},
115
+ // 已新增的临时行
116
+ insertRowMaps: {},
117
+ // 已删除行
118
+ removeRowMaps: {},
119
+
120
+ cvCacheMaps: {},
121
+
122
+ inited: false,
123
+ tooltipTimeout: null,
124
+ initStatus: false,
125
+ isActivated: false
126
+ }
127
+ }
8
128
 
9
129
  const getAllConvertColumns = (columns: any, parentColumn?: any) => {
10
130
  const result: any[] = []