vxe-table 3.4.5 → 3.4.7-beta.2

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 (47) hide show
  1. package/README.en.md +1 -1
  2. package/README.md +1 -1
  3. package/README.zh-TW.md +1 -1
  4. package/lib/button/src/button.js +15 -14
  5. package/lib/button/src/button.min.js +1 -1
  6. package/lib/edit/src/mixin.js +19 -25
  7. package/lib/edit/src/mixin.min.js +1 -1
  8. package/lib/export/src/mixin.js +25 -10
  9. package/lib/export/src/mixin.min.js +1 -1
  10. package/lib/filter/src/mixin.js +25 -1
  11. package/lib/filter/src/mixin.min.js +1 -1
  12. package/lib/grid/src/grid.js +6 -3
  13. package/lib/grid/src/grid.min.js +1 -1
  14. package/lib/index.umd.js +713 -423
  15. package/lib/index.umd.min.js +1 -1
  16. package/lib/select/src/select.js +1 -1
  17. package/lib/select/src/select.min.js +1 -1
  18. package/lib/table/src/body.js +9 -17
  19. package/lib/table/src/body.min.js +1 -1
  20. package/lib/table/src/cell.js +16 -17
  21. package/lib/table/src/cell.min.js +1 -1
  22. package/lib/table/src/methods.js +503 -317
  23. package/lib/table/src/methods.min.js +1 -1
  24. package/lib/table/src/table.js +6 -6
  25. package/lib/table/src/util.js +7 -0
  26. package/lib/table/src/util.min.js +1 -1
  27. package/lib/tools/src/dom.js +2 -9
  28. package/lib/tools/src/dom.min.js +1 -1
  29. package/lib/tools/src/utils.js +1 -1
  30. package/lib/tools/src/utils.min.js +1 -1
  31. package/lib/v-x-e-table/src/conf.js +5 -1
  32. package/lib/v-x-e-table/src/conf.min.js +1 -1
  33. package/package.json +3 -3
  34. package/packages/button/src/button.js +14 -14
  35. package/packages/edit/src/mixin.js +18 -21
  36. package/packages/export/src/mixin.js +17 -6
  37. package/packages/filter/src/mixin.js +20 -1
  38. package/packages/grid/src/grid.js +6 -2
  39. package/packages/select/src/select.js +1 -1
  40. package/packages/table/src/body.js +12 -16
  41. package/packages/table/src/cell.js +15 -15
  42. package/packages/table/src/methods.js +149 -47
  43. package/packages/table/src/table.js +6 -6
  44. package/packages/table/src/util.js +4 -0
  45. package/packages/tools/src/dom.js +2 -7
  46. package/packages/tools/src/utils.js +1 -1
  47. package/packages/v-x-e-table/src/conf.js +5 -1
@@ -3,7 +3,7 @@ import GlobalConfig from '../../v-x-e-table/src/conf'
3
3
  import Cell from './cell'
4
4
  import VXETable from '../../v-x-e-table'
5
5
  import { UtilTools, DomTools } from '../../tools'
6
- import { clearTableAllStatus, handleFieldOrColumn, restoreScrollLocation, restoreScrollListener } from './util'
6
+ import { clearTableAllStatus, handleFieldOrColumn, restoreScrollLocation, restoreScrollListener, toTreePathSeq } from './util'
7
7
  import { eqEmptyValue, isEnableConf } from '../../tools/src/utils'
8
8
  import { browse, getPaddingTopBottomSize, setScrollTop, setScrollLeft } from '../../tools/src/dom'
9
9
  import { formats } from '../../v-x-e-table/src/formats'
@@ -301,9 +301,33 @@ const Methods = {
301
301
  return this.handleTableData(true).then(this.updateFooter).then(this.recalculate)
302
302
  },
303
303
  handleTableData (force) {
304
- const { scrollYLoad, scrollYStore } = this
305
- const fullData = force ? this.updateAfterFullData() : this.afterFullData
306
- this.tableData = scrollYLoad ? fullData.slice(scrollYStore.startIndex, scrollYStore.endIndex) : fullData.slice(0)
304
+ const { treeConfig, scrollYLoad, scrollYStore, fullDataRowIdData, treeExpandeds, treeOpts } = this
305
+ let fullList = []
306
+ // 是否进行数据处理
307
+ if (force) {
308
+ this.updateAfterFullData()
309
+ }
310
+ // 如果为虚拟树,将树结构拍平
311
+ if (treeConfig && treeOpts.transform) {
312
+ const expandMaps = new Map()
313
+ XEUtils.eachTree(this.afterTreeFullData, (row, index, items, path, parent) => {
314
+ if (!parent || (expandMaps.has(parent) && treeExpandeds.indexOf(parent) > -1)) {
315
+ expandMaps.set(row, 1)
316
+ fullList.push(row)
317
+ }
318
+ }, { children: treeOpts.mapChildren })
319
+ } else {
320
+ fullList = this.afterFullData
321
+ }
322
+ const tableData = scrollYLoad ? fullList.slice(scrollYStore.startIndex, scrollYStore.endIndex) : fullList.slice(0)
323
+ tableData.forEach((row, $index) => {
324
+ const rowid = getRowid(this, row)
325
+ const rest = fullDataRowIdData[rowid]
326
+ if (rest) {
327
+ rest.$index = $index
328
+ }
329
+ })
330
+ this.tableData = tableData
307
331
  return this.$nextTick()
308
332
  },
309
333
  updateScrollYStatus (fullData) {
@@ -334,13 +358,24 @@ const Methods = {
334
358
  if (!treeOpts.children) {
335
359
  UtilTools.error('vxe.error.reqProp', ['tree-config.children'])
336
360
  }
361
+ if (!treeOpts.mapChildren) {
362
+ UtilTools.error('vxe.error.reqProp', ['tree-config.mapChildren'])
363
+ }
364
+ if (treeOpts.children === treeOpts.mapChildren) {
365
+ UtilTools.error('vxe.error.errConflicts', ['tree-config.children', 'tree-config.mapChildren'])
366
+ }
337
367
  fullData.forEach(row => {
338
368
  if (row[treeOpts.children] && row[treeOpts.children].length) {
339
369
  UtilTools.warn('vxe.error.errConflicts', ['tree-config.transform', `row.${treeOpts.children}`])
340
370
  }
341
371
  })
342
372
  }
343
- treeData = XEUtils.toArrayTree(fullData, { key: treeOpts.rowField, parentKey: treeOpts.parentField, children: treeOpts.children })
373
+ treeData = XEUtils.toArrayTree(fullData, {
374
+ key: treeOpts.rowField,
375
+ parentKey: treeOpts.parentField,
376
+ children: treeOpts.children,
377
+ mapChildren: treeOpts.mapChildren
378
+ })
344
379
  fullData = treeData.slice(0)
345
380
  } else {
346
381
  treeData = fullData.slice(0)
@@ -356,7 +391,7 @@ const Methods = {
356
391
  this.scrollYLoad = sYLoad
357
392
  // 全量数据
358
393
  this.tableFullData = fullData
359
- this.treeFullData = treeData
394
+ this.tableFullTreeData = treeData
360
395
  // 缓存数据
361
396
  this.cacheRowMap(true)
362
397
  // 原始数据
@@ -530,12 +565,14 @@ const Methods = {
530
565
  * 牺牲数据组装的耗时,用来换取使用过程中的流畅
531
566
  */
532
567
  cacheRowMap (source) {
533
- const { treeConfig, treeOpts, tableFullData, fullDataRowMap, fullAllDataRowMap } = this
568
+ const { treeConfig, treeOpts, tableFullData, fullDataRowMap, fullAllDataRowMap, tableFullTreeData } = this
534
569
  let { fullDataRowIdData, fullAllDataRowIdData } = this
535
570
  const rowkey = getRowkey(this)
536
571
  const isLazy = treeConfig && treeOpts.lazy
537
572
  const handleCache = (row, index, items, path, parent, nodes) => {
538
573
  let rowid = getRowid(this, row)
574
+ const seq = treeConfig && path ? toTreePathSeq(path) : index + 1
575
+ const level = nodes ? nodes.length - 1 : 0
539
576
  if (eqEmptyValue(rowid)) {
540
577
  rowid = getRowUniqueId()
541
578
  XEUtils.set(row, rowkey, rowid)
@@ -543,7 +580,7 @@ const Methods = {
543
580
  if (isLazy && row[treeOpts.hasChild] && XEUtils.isUndefined(row[treeOpts.children])) {
544
581
  row[treeOpts.children] = null
545
582
  }
546
- const rest = { row, rowid, index: treeConfig && parent ? -1 : index, items, parent, level: nodes ? nodes.length - 1 : 0 }
583
+ const rest = { row, rowid, seq, index: treeConfig && parent ? -1 : index, _index: -1, $index: -1, items, parent, level }
547
584
  if (source) {
548
585
  fullDataRowIdData[rowid] = rest
549
586
  fullDataRowMap.set(row, rest)
@@ -558,14 +595,14 @@ const Methods = {
558
595
  fullAllDataRowIdData = this.fullAllDataRowIdData = {}
559
596
  fullAllDataRowMap.clear()
560
597
  if (treeConfig) {
561
- XEUtils.eachTree(tableFullData, handleCache, treeOpts)
598
+ XEUtils.eachTree(tableFullTreeData, handleCache, treeOpts)
562
599
  } else {
563
600
  tableFullData.forEach(handleCache)
564
601
  }
565
602
  },
566
603
  loadTreeChildren (row, childRecords) {
567
604
  const { keepSource, tableSourceData, treeOpts, fullDataRowIdData, fullDataRowMap, fullAllDataRowMap, fullAllDataRowIdData } = this
568
- const { children } = treeOpts
605
+ const { transform, children, mapChildren } = treeOpts
569
606
  const rest = fullAllDataRowIdData[getRowid(this, row)]
570
607
  const parentLevel = rest ? rest.level : 0
571
608
  return this.createData(childRecords).then((rows) => {
@@ -578,13 +615,16 @@ const Methods = {
578
615
  }
579
616
  XEUtils.eachTree(rows, (childRow, index, items, path, parent, nodes) => {
580
617
  const rowid = getRowid(this, childRow)
581
- const rest = { row: childRow, rowid, index: -1, items, parent, level: parentLevel + nodes.length }
618
+ const rest = { row: childRow, rowid, seq: -1, index: -1, _index: -1, $index: -1, items, parent, level: parentLevel + nodes.length }
582
619
  fullDataRowIdData[rowid] = rest
583
620
  fullDataRowMap.set(childRow, rest)
584
621
  fullAllDataRowIdData[rowid] = rest
585
622
  fullAllDataRowMap.set(childRow, rest)
586
623
  }, treeOpts)
587
624
  row[children] = rows
625
+ if (transform) {
626
+ row[mapChildren] = rows
627
+ }
588
628
  return rows
589
629
  })
590
630
  },
@@ -724,6 +764,21 @@ const Methods = {
724
764
  }
725
765
  return null
726
766
  },
767
+ /**
768
+ * 根据 row 获取序号
769
+ * @param {Row} row 行对象
770
+ */
771
+ getRowSeq (row) {
772
+ const { fullDataRowIdData } = this
773
+ if (row) {
774
+ const rowid = getRowid(this, row)
775
+ const rest = fullDataRowIdData[rowid]
776
+ if (rest) {
777
+ return rest.seq
778
+ }
779
+ }
780
+ return -1
781
+ },
727
782
  /**
728
783
  * 根据 row 获取相对于 data 中的索引
729
784
  * @param {Row} row 行对象
@@ -1061,10 +1116,12 @@ const Methods = {
1061
1116
  * 如果存在筛选条件,继续处理
1062
1117
  */
1063
1118
  updateAfterFullData () {
1064
- const { tableFullColumn, tableFullData, filterOpts, sortOpts } = this
1119
+ const { tableFullColumn, tableFullData, filterOpts, sortOpts, treeConfig, treeOpts, tableFullTreeData } = this
1065
1120
  const { remote: allRemoteFilter, filterMethod: allFilterMethod } = filterOpts
1066
1121
  const { remote: allRemoteSort, sortMethod: allSortMethod, multiple: sortMultiple } = sortOpts
1067
- let tableData = tableFullData.slice(0)
1122
+ const { transform } = treeOpts
1123
+ let tableData = []
1124
+ let tableTree = []
1068
1125
  const filterColumns = []
1069
1126
  const orderColumns = []
1070
1127
  tableFullColumn.forEach(column => {
@@ -1087,7 +1144,7 @@ const Methods = {
1087
1144
  }
1088
1145
  })
1089
1146
  if (filterColumns.length) {
1090
- tableData = tableData.filter(row => {
1147
+ const handleFilter = (row) => {
1091
1148
  return filterColumns.every(({ column, valueList, itemList }) => {
1092
1149
  if (valueList.length && !allRemoteFilter) {
1093
1150
  const { filterMethod, filterRender } = column
@@ -1108,7 +1165,16 @@ const Methods = {
1108
1165
  }
1109
1166
  return true
1110
1167
  })
1111
- })
1168
+ }
1169
+ if (treeConfig && transform) {
1170
+ tableTree = XEUtils.searchTree(tableFullTreeData, handleFilter, { ...treeOpts, original: true })
1171
+ } else {
1172
+ tableData = treeConfig ? tableFullTreeData.filter(handleFilter) : tableFullData.filter(handleFilter)
1173
+ tableTree = tableData
1174
+ }
1175
+ } else {
1176
+ tableData = treeConfig ? tableFullTreeData.slice(0) : tableFullData.slice(0)
1177
+ tableTree = tableData
1112
1178
  }
1113
1179
  const firstOrderColumn = orderColumns[0]
1114
1180
  if (!allRemoteSort && firstOrderColumn) {
@@ -1128,9 +1194,52 @@ const Methods = {
1128
1194
  tableData = XEUtils.orderBy(tableData, sortByConfs || [firstOrderColumn].map(({ column, order }) => [getOrderField(this, column), order]))
1129
1195
  }
1130
1196
  }
1197
+ tableTree = tableData
1131
1198
  }
1132
1199
  this.afterFullData = tableData
1133
- return tableData
1200
+ this.afterTreeFullData = tableTree
1201
+ this.updateAfterDataIndex()
1202
+ },
1203
+ /**
1204
+ * 预编译
1205
+ * 对渲染中的数据提前解析序号及索引。牺牲提前编译耗时换取渲染中额外损耗,使运行时更加流畅
1206
+ */
1207
+ updateAfterDataIndex () {
1208
+ const { treeConfig, afterFullData, fullDataRowIdData, fullAllDataRowIdData, afterTreeFullData, treeOpts } = this
1209
+ if (treeConfig) {
1210
+ XEUtils.eachTree(afterTreeFullData, (row, index, items, path) => {
1211
+ const rowid = getRowid(this, row)
1212
+ const allrest = fullAllDataRowIdData[rowid]
1213
+ const fullrest = fullDataRowIdData[rowid]
1214
+ const seq = path.map((num, i) => i % 2 === 0 ? (Number(num) + 1) : '.').join('')
1215
+ if (allrest) {
1216
+ allrest.seq = seq
1217
+ }
1218
+ if (fullrest) {
1219
+ fullrest.seq = seq
1220
+ } else {
1221
+ fullAllDataRowIdData[rowid] = { row, rowid, seq, index: -1, $index: -1, _index: index, items: [], parent: null, level: 0 }
1222
+ fullDataRowIdData[rowid] = { row, rowid, seq, index: -1, $index: -1, _index: index, items: [], parent: null, level: 0 }
1223
+ }
1224
+ }, treeOpts)
1225
+ } else {
1226
+ afterFullData.forEach((row, index) => {
1227
+ const rowid = getRowid(this, row)
1228
+ const allrest = fullAllDataRowIdData[rowid]
1229
+ const fullrest = fullDataRowIdData[rowid]
1230
+ const seq = index + 1
1231
+ if (allrest) {
1232
+ allrest.seq = seq
1233
+ }
1234
+ if (fullrest) {
1235
+ fullrest.seq = seq
1236
+ fullrest._index = index
1237
+ } else {
1238
+ fullAllDataRowIdData[rowid] = { row, rowid, seq, index: -1, $index: -1, _index: index, items: [], parent: null, level: 0 }
1239
+ fullDataRowIdData[rowid] = { row, rowid, seq, index: -1, $index: -1, _index: index, items: [], parent: null, level: 0 }
1240
+ }
1241
+ })
1242
+ }
1134
1243
  },
1135
1244
  /**
1136
1245
  * 根据行的唯一主键获取行
@@ -2097,7 +2206,7 @@ const Methods = {
2097
2206
  * 表格键盘事件
2098
2207
  */
2099
2208
  keydownEvent (evnt) {
2100
- const { filterStore, ctxMenuStore, editStore, keyboardConfig, mouseConfig, mouseOpts } = this
2209
+ const { filterStore, ctxMenuStore, editStore, keyboardConfig, mouseConfig, mouseOpts, keyboardOpts } = this
2101
2210
  const { actived } = editStore
2102
2211
  const { keyCode } = evnt
2103
2212
  const isEsc = keyCode === 27
@@ -2110,13 +2219,15 @@ const Methods = {
2110
2219
  // 如果按下了 Esc 键,关闭快捷菜单、筛选
2111
2220
  this.closeFilter()
2112
2221
  this.closeMenu()
2113
- // 如果是激活编辑状态,则取消编辑
2114
- if (actived.row) {
2115
- const params = actived.args
2116
- this.clearActived(evnt)
2117
- // 如果配置了选中功能,则为选中状态
2118
- if (mouseConfig && mouseOpts.selected) {
2119
- this.$nextTick(() => this.handleSelected(params, evnt))
2222
+ if (keyboardConfig && keyboardOpts.isEsc) {
2223
+ // 如果是激活编辑状态,则取消编辑
2224
+ if (actived.row) {
2225
+ const params = actived.args
2226
+ this.clearActived(evnt)
2227
+ // 如果配置了选中功能,则为选中状态
2228
+ if (mouseConfig && mouseOpts.selected) {
2229
+ this.$nextTick(() => this.handleSelected(params, evnt))
2230
+ }
2120
2231
  }
2121
2232
  }
2122
2233
  }
@@ -3694,7 +3805,7 @@ const Methods = {
3694
3805
  return this.handleAsyncTreeExpandChilds(row)
3695
3806
  }).then(() => {
3696
3807
  if (transform) {
3697
- return this.updateVirtualTreeData()
3808
+ return this.handleTableData()
3698
3809
  }
3699
3810
  }).then(() => {
3700
3811
  return this.recalculate()
@@ -3754,7 +3865,7 @@ const Methods = {
3754
3865
  },
3755
3866
  handleAsyncTreeExpandChilds (row) {
3756
3867
  const { fullAllDataRowMap, treeExpandeds, treeOpts, treeLazyLoadeds, checkboxOpts } = this
3757
- const { loadMethod } = treeOpts
3868
+ const { transform, loadMethod } = treeOpts
3758
3869
  const { checkStrictly } = checkboxOpts
3759
3870
  const rest = fullAllDataRowMap.get(row)
3760
3871
  return new Promise(resolve => {
@@ -3774,9 +3885,17 @@ const Methods = {
3774
3885
  if (!checkStrictly && this.isCheckedByCheckboxRow(row)) {
3775
3886
  this.setCheckboxRow(childRows, true)
3776
3887
  }
3888
+ this.$nextTick().then(() => {
3889
+ if (transform) {
3890
+ return this.handleTableData()
3891
+ }
3892
+ }).then(() => {
3893
+ return this.recalculate()
3894
+ }).then(() => resolve())
3777
3895
  })
3896
+ } else {
3897
+ this.$nextTick().then(() => this.recalculate()).then(() => resolve())
3778
3898
  }
3779
- resolve(this.$nextTick().then(this.recalculate))
3780
3899
  })
3781
3900
  })
3782
3901
  },
@@ -3840,23 +3959,6 @@ const Methods = {
3840
3959
  }
3841
3960
  return Promise.all(result).then(this.recalculate)
3842
3961
  },
3843
- updateVirtualTreeData () {
3844
- const { scrollYLoad: oldScrollYLoad, treeExpandeds, treeOpts, treeFullData } = this
3845
- const fullData = []
3846
- const expandMaps = new Map()
3847
- XEUtils.eachTree(treeFullData, (row, index, items, path, parent) => {
3848
- if (!parent || (expandMaps.has(parent) && treeExpandeds.indexOf(parent) > -1)) {
3849
- expandMaps.set(row, 1)
3850
- fullData.push(row)
3851
- }
3852
- }, treeOpts)
3853
- const scrollYLoad = this.updateScrollYStatus(fullData)
3854
- this.tableFullData = scrollYLoad ? fullData : treeFullData
3855
- if (scrollYLoad || oldScrollYLoad !== scrollYLoad) {
3856
- return this.handleTableData(true).then(() => this.recalculate())
3857
- }
3858
- return this.$nextTick()
3859
- },
3860
3962
  /**
3861
3963
  * 虚拟树的展开与收起
3862
3964
  * @param rows
@@ -3865,7 +3967,7 @@ const Methods = {
3865
3967
  */
3866
3968
  handleVirtualTreeExpand (rows, expanded) {
3867
3969
  return this.handleBaseTreeExpand(rows, expanded).then(() => {
3868
- return this.updateVirtualTreeData()
3970
+ return this.handleTableData()
3869
3971
  }).then(() => {
3870
3972
  return this.recalculate()
3871
3973
  })
@@ -3913,7 +4015,7 @@ const Methods = {
3913
4015
  if (reserve) {
3914
4016
  XEUtils.eachTree(tableFullData, row => this.handleTreeExpandReserve(row, false), treeOpts)
3915
4017
  }
3916
- return this.updateVirtualTreeData().then(() => {
4018
+ return this.handleTableData().then(() => {
3917
4019
  if (isExists) {
3918
4020
  this.recalculate()
3919
4021
  }
@@ -4422,7 +4524,7 @@ const Methods = {
4422
4524
  }
4423
4525
 
4424
4526
  // Module methods
4425
- const funcs = 'setFilter,clearFilter,getCheckedFilters,closeMenu,setActiveCellArea,getActiveCellArea,getCellAreas,clearCellAreas,copyCellArea,cutCellArea,pasteCellArea,getCopyCellArea,clearCopyCellArea,setCellAreas,openFind,openReplace,getSelectedCell,clearSelected,insert,insertAt,remove,removeCheckboxRow,removeRadioRow,removeCurrentRow,getRecordset,getInsertRecords,getRemoveRecords,getUpdateRecords,clearActived,getActiveRecord,isActiveByRow,setActiveRow,setActiveCell,setSelectCell,clearValidate,fullValidate,validate,openExport,openPrint,exportData,openImport,importData,saveFile,readFile,importByFile,print'.split(',')
4527
+ const funcs = 'setFilter,openFilter,clearFilter,getCheckedFilters,closeMenu,setActiveCellArea,getActiveCellArea,getCellAreas,clearCellAreas,copyCellArea,cutCellArea,pasteCellArea,getCopyCellArea,clearCopyCellArea,setCellAreas,openFind,openReplace,getSelectedCell,clearSelected,insert,insertAt,remove,removeCheckboxRow,removeRadioRow,removeCurrentRow,getRecordset,getInsertRecords,getRemoveRecords,getUpdateRecords,clearActived,getActiveRecord,isActiveByRow,setActiveRow,setActiveCell,setSelectCell,clearValidate,fullValidate,validate,openExport,openPrint,exportData,openImport,importData,saveFile,readFile,importByFile,print'.split(',')
4426
4528
 
4427
4529
  funcs.forEach(name => {
4428
4530
  Methods[name] = function (...args) {
@@ -114,15 +114,15 @@ export default {
114
114
  footerAlign: { type: String, default: () => GlobalConfig.table.footerAlign },
115
115
  // 是否显示表头
116
116
  showHeader: { type: Boolean, default: () => GlobalConfig.table.showHeader },
117
- // 是否要高亮当前选中行
117
+ // (即将废弃)是否要高亮当前选中行
118
118
  highlightCurrentRow: { type: Boolean, default: () => GlobalConfig.table.highlightCurrentRow },
119
- // 鼠标移到行是否要高亮显示
119
+ // (即将废弃)鼠标移到行是否要高亮显示
120
120
  highlightHoverRow: { type: Boolean, default: () => GlobalConfig.table.highlightHoverRow },
121
- // 是否要高亮当前选中列
121
+ // (即将废弃)是否要高亮当前选中列
122
122
  highlightCurrentColumn: { type: Boolean, default: () => GlobalConfig.table.highlightCurrentColumn },
123
- // 鼠标移到列是否要高亮显示
123
+ // (即将废弃)鼠标移到列是否要高亮显示
124
124
  highlightHoverColumn: { type: Boolean, default: () => GlobalConfig.table.highlightHoverColumn },
125
- // 激活单元格编辑时是否高亮显示
125
+ // (即将废弃)激活单元格编辑时是否高亮显示
126
126
  highlightCell: Boolean,
127
127
  // 是否显示表尾合计
128
128
  showFooter: Boolean,
@@ -235,7 +235,7 @@ export default {
235
235
  scrollX: Object,
236
236
  // 纵向虚拟滚动配置项
237
237
  scrollY: Object,
238
- // 优化相关
238
+ // (即将废弃)优化相关
239
239
  animat: { type: Boolean, default: () => GlobalConfig.table.animat },
240
240
  delayHover: { type: Number, default: () => GlobalConfig.table.delayHover },
241
241
  // 额外的参数
@@ -20,6 +20,10 @@ export function restoreScrollLocation (_vm, scrollLeft, scrollTop) {
20
20
  })
21
21
  }
22
22
 
23
+ export function toTreePathSeq (path) {
24
+ return path.map((num, i) => i % 2 === 0 ? (Number(num) + 1) : '.').join('')
25
+ }
26
+
23
27
  export function removeScrollListener (scrollElem) {
24
28
  if (scrollElem && scrollElem._onscroll) {
25
29
  scrollElem.onscroll = null
@@ -204,14 +204,9 @@ export const DomTools = {
204
204
  }
205
205
  },
206
206
  triggerEvent (targetElem, type) {
207
- let evnt
208
- if (typeof Event === 'function') {
209
- evnt = new Event(type)
210
- } else {
211
- evnt = document.createEvent('Event')
212
- evnt.initEvent(type, true, true)
207
+ if (targetElem) {
208
+ targetElem.dispatchEvent(new Event(type))
213
209
  }
214
- targetElem.dispatchEvent(evnt)
215
210
  },
216
211
  calcHeight ($xetable, key) {
217
212
  const val = $xetable[key]
@@ -183,7 +183,7 @@ export const UtilTools = {
183
183
  },
184
184
  // 行主键 key
185
185
  getRowkey ($xetable) {
186
- return $xetable.rowId || '_XID'
186
+ return $xetable.rowId || '_X_ID'
187
187
  },
188
188
  // 行主键 value
189
189
  getRowid ($xetable, row) {
@@ -49,7 +49,7 @@ export default {
49
49
  // storage: false,
50
50
  // checkMethod () {}
51
51
  // },
52
- // rowId: '_XID', // 行数据的唯一主键字段名
52
+ // rowId: '_X_ID', // 行数据的唯一主键字段名
53
53
  sortConfig: {
54
54
  // remote: false,
55
55
  // trigger: 'default',
@@ -67,6 +67,7 @@ export default {
67
67
  parentField: 'parentId',
68
68
  children: 'children',
69
69
  hasChild: 'hasChild',
70
+ mapChildren: '_X_CHILD',
70
71
  indent: 20,
71
72
  showIcon: true
72
73
  },
@@ -91,6 +92,9 @@ export default {
91
92
  mouseConfig: {
92
93
  extension: true
93
94
  },
95
+ keyboardConfig: {
96
+ isEsc: true
97
+ },
94
98
  areaConfig: {
95
99
  selectCellByHeader: true
96
100
  },