vxe-table 3.8.8-beta.7 → 3.8.8-beta.9

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 (135) hide show
  1. package/lib/button/index.js +2 -0
  2. package/lib/button/index.min.js +1 -1
  3. package/lib/button-group/index.js +2 -0
  4. package/lib/button-group/index.min.js +1 -1
  5. package/lib/checkbox/index.js +2 -0
  6. package/lib/checkbox/index.min.js +1 -1
  7. package/lib/checkbox-group/index.js +2 -0
  8. package/lib/checkbox-group/index.min.js +1 -1
  9. package/lib/colgroup/index.js +2 -0
  10. package/lib/colgroup/index.min.js +1 -1
  11. package/lib/column/index.js +2 -0
  12. package/lib/column/index.min.js +1 -1
  13. package/lib/edit/src/mixin.js +4 -4
  14. package/lib/edit/src/mixin.min.js +1 -1
  15. package/lib/export/src/mixin.js +39 -29
  16. package/lib/export/src/mixin.min.js +1 -1
  17. package/lib/form/index.js +2 -0
  18. package/lib/form/index.min.js +1 -1
  19. package/lib/form-gather/index.js +2 -0
  20. package/lib/form-gather/index.min.js +1 -1
  21. package/lib/form-item/index.js +2 -0
  22. package/lib/form-item/index.min.js +1 -1
  23. package/lib/grid/index.js +1 -0
  24. package/lib/grid/index.min.js +1 -1
  25. package/lib/icon/index.js +2 -0
  26. package/lib/icon/index.min.js +1 -1
  27. package/lib/icon/style/style.css +1 -1
  28. package/lib/icon/style/style.min.css +1 -1
  29. package/lib/index.css +1 -1
  30. package/lib/index.umd.js +261 -133
  31. package/lib/index.umd.min.js +1 -1
  32. package/lib/input/index.js +2 -0
  33. package/lib/input/index.min.js +1 -1
  34. package/lib/keyboard/src/mixin.js +2 -2
  35. package/lib/keyboard/src/mixin.min.js +1 -1
  36. package/lib/list/index.js +2 -0
  37. package/lib/list/index.min.js +1 -1
  38. package/lib/loading/index.js +2 -0
  39. package/lib/loading/index.min.js +1 -1
  40. package/lib/menu/src/mixin.js +1 -1
  41. package/lib/menu/src/mixin.min.js +1 -1
  42. package/lib/modal/index.js +1 -0
  43. package/lib/modal/index.min.js +1 -1
  44. package/lib/optgroup/index.js +2 -0
  45. package/lib/optgroup/index.min.js +1 -1
  46. package/lib/option/index.js +2 -0
  47. package/lib/option/index.min.js +1 -1
  48. package/lib/pager/index.js +2 -0
  49. package/lib/pager/index.min.js +1 -1
  50. package/lib/pulldown/index.js +2 -0
  51. package/lib/pulldown/index.min.js +1 -1
  52. package/lib/radio/index.js +2 -0
  53. package/lib/radio/index.min.js +1 -1
  54. package/lib/radio-button/index.js +2 -0
  55. package/lib/radio-button/index.min.js +1 -1
  56. package/lib/radio-group/index.js +2 -0
  57. package/lib/radio-group/index.min.js +1 -1
  58. package/lib/select/index.js +2 -0
  59. package/lib/select/index.min.js +1 -1
  60. package/lib/style.css +1 -1
  61. package/lib/style.min.css +1 -1
  62. package/lib/switch/index.js +2 -0
  63. package/lib/switch/index.min.js +1 -1
  64. package/lib/table/index.js +1 -0
  65. package/lib/table/index.min.js +1 -1
  66. package/lib/table/src/cell.js +0 -6
  67. package/lib/table/src/cell.min.js +1 -1
  68. package/lib/table/src/methods.js +96 -67
  69. package/lib/table/src/methods.min.js +1 -1
  70. package/lib/table/src/table.js +6 -6
  71. package/lib/table/src/table.min.js +1 -1
  72. package/lib/textarea/index.js +2 -0
  73. package/lib/textarea/index.min.js +1 -1
  74. package/lib/toolbar/index.js +2 -0
  75. package/lib/toolbar/index.min.js +1 -1
  76. package/lib/tools/log.js +1 -1
  77. package/lib/tools/log.min.js +1 -1
  78. package/lib/tooltip/index.js +1 -0
  79. package/lib/tooltip/index.min.js +1 -1
  80. package/lib/v-x-e-table/index.js +61 -25
  81. package/lib/v-x-e-table/index.min.js +1 -1
  82. package/lib/v-x-e-table/src/conf.js +6 -1
  83. package/lib/v-x-e-table/src/conf.min.js +1 -1
  84. package/lib/v-x-e-table/src/theme.js +5 -0
  85. package/lib/v-x-e-table/src/theme.min.js +1 -1
  86. package/lib/validator/src/mixin.js +1 -1
  87. package/lib/validator/src/mixin.min.js +1 -1
  88. package/package.json +1 -1
  89. package/packages/button/index.js +2 -0
  90. package/packages/button-group/index.js +2 -0
  91. package/packages/checkbox/index.js +2 -0
  92. package/packages/checkbox-group/index.js +2 -0
  93. package/packages/colgroup/index.js +2 -0
  94. package/packages/column/index.js +2 -0
  95. package/packages/edit/src/mixin.js +4 -4
  96. package/packages/export/src/mixin.js +33 -20
  97. package/packages/form/index.js +2 -0
  98. package/packages/form-gather/index.js +2 -0
  99. package/packages/form-item/index.js +2 -0
  100. package/packages/grid/index.js +4 -3
  101. package/packages/icon/index.js +2 -0
  102. package/packages/input/index.js +2 -0
  103. package/packages/keyboard/src/mixin.js +2 -2
  104. package/packages/list/index.js +2 -0
  105. package/packages/loading/index.js +2 -0
  106. package/packages/menu/src/mixin.js +1 -1
  107. package/packages/modal/index.js +5 -3
  108. package/packages/optgroup/index.js +2 -0
  109. package/packages/option/index.js +2 -0
  110. package/packages/pager/index.js +2 -0
  111. package/packages/pulldown/index.js +2 -0
  112. package/packages/radio/index.js +2 -0
  113. package/packages/radio-button/index.js +2 -0
  114. package/packages/radio-group/index.js +2 -0
  115. package/packages/select/index.js +2 -0
  116. package/packages/switch/index.js +2 -0
  117. package/packages/table/index.js +10 -9
  118. package/packages/table/src/cell.js +0 -6
  119. package/packages/table/src/methods.js +82 -53
  120. package/packages/table/src/table.js +4 -4
  121. package/packages/textarea/index.js +2 -0
  122. package/packages/toolbar/index.js +2 -0
  123. package/packages/tooltip/index.js +3 -2
  124. package/packages/v-x-e-table/index.js +44 -22
  125. package/packages/v-x-e-table/src/conf.js +6 -1
  126. package/packages/v-x-e-table/src/theme.js +5 -0
  127. package/packages/validator/src/mixin.js +1 -1
  128. package/types/table.d.ts +4 -0
  129. package/types/v-x-e-table/index.d.ts +10 -0
  130. /package/lib/icon/style/{iconfont.1718470675024.ttf → iconfont.1719196942508.ttf} +0 -0
  131. /package/lib/icon/style/{iconfont.1718470675024.woff → iconfont.1719196942508.woff} +0 -0
  132. /package/lib/icon/style/{iconfont.1718470675024.woff2 → iconfont.1719196942508.woff2} +0 -0
  133. /package/lib/{iconfont.1718470675024.ttf → iconfont.1719196942508.ttf} +0 -0
  134. /package/lib/{iconfont.1718470675024.woff → iconfont.1719196942508.woff} +0 -0
  135. /package/lib/{iconfont.1718470675024.woff2 → iconfont.1719196942508.woff2} +0 -0
@@ -1103,6 +1103,63 @@ const Methods = {
1103
1103
  }
1104
1104
  return this.$nextTick()
1105
1105
  },
1106
+ getCellElement (row, fieldOrColumn) {
1107
+ const column = handleFieldOrColumn(this, fieldOrColumn)
1108
+ if (!column) {
1109
+ return null
1110
+ }
1111
+ const { $refs } = this
1112
+ const rowid = getRowid(this, row)
1113
+ let bodyElem = null
1114
+ if (column) {
1115
+ bodyElem = $refs[`${column.fixed || 'table'}Body`] || $refs.tableBody
1116
+ }
1117
+ if (bodyElem && bodyElem.$el) {
1118
+ return bodyElem.$el.querySelector(`.vxe-body--row[rowid="${rowid}"] .${column.id}`)
1119
+ }
1120
+ return null
1121
+ },
1122
+ getCellLabel (row, fieldOrColumn) {
1123
+ const column = handleFieldOrColumn(this, fieldOrColumn)
1124
+ if (!column) {
1125
+ return null
1126
+ }
1127
+ const formatter = column.formatter
1128
+ const cellValue = UtilTools.getCellValue(row, column)
1129
+ let cellLabel = cellValue
1130
+ if (formatter) {
1131
+ let rest, formatData
1132
+ const { fullAllDataRowMap } = this
1133
+ const colid = column.id
1134
+ const cacheFormat = fullAllDataRowMap.has(row)
1135
+ if (cacheFormat) {
1136
+ rest = fullAllDataRowMap.get(row)
1137
+ formatData = rest.formatData
1138
+ if (!formatData) {
1139
+ formatData = fullAllDataRowMap.get(row).formatData = {}
1140
+ }
1141
+ if (rest && formatData[colid]) {
1142
+ if (formatData[colid].value === cellValue) {
1143
+ return formatData[colid].label
1144
+ }
1145
+ }
1146
+ }
1147
+ const formatParams = { cellValue, row, rowIndex: this.getRowIndex(row), column, columnIndex: this.getColumnIndex(column) }
1148
+ if (XEUtils.isString(formatter)) {
1149
+ const gFormatOpts = formats.get(formatter)
1150
+ cellLabel = gFormatOpts && gFormatOpts.cellFormatMethod ? gFormatOpts.cellFormatMethod(formatParams) : ''
1151
+ } else if (XEUtils.isArray(formatter)) {
1152
+ const gFormatOpts = formats.get(formatter[0])
1153
+ cellLabel = gFormatOpts && gFormatOpts.cellFormatMethod ? gFormatOpts.cellFormatMethod(formatParams, ...formatter.slice(1)) : ''
1154
+ } else {
1155
+ cellLabel = formatter(formatParams)
1156
+ }
1157
+ if (formatData) {
1158
+ formatData[colid] = { value: cellValue, label: cellLabel }
1159
+ }
1160
+ }
1161
+ return cellLabel
1162
+ },
1106
1163
  /**
1107
1164
  * 检查是否为临时行数据
1108
1165
  * @param {Row} row 行对象
@@ -1156,6 +1213,13 @@ const Methods = {
1156
1213
  const columns = this.visibleColumn
1157
1214
  return XEUtils.isUndefined(columnIndex) ? columns.slice(0) : columns[columnIndex]
1158
1215
  },
1216
+ /**
1217
+ * 根据列获取列的唯一主键
1218
+ */
1219
+ getColid (fieldOrColumn) {
1220
+ const column = handleFieldOrColumn(this, fieldOrColumn)
1221
+ return column ? column.id : null
1222
+ },
1159
1223
  /**
1160
1224
  * 根据列的唯一主键获取列
1161
1225
  * @param {String} colid 列主键
@@ -2734,7 +2798,7 @@ const Methods = {
2734
2798
  const { filterStore, isCtxMenu, ctxMenuStore, editStore, editOpts, editConfig, mouseConfig, mouseOpts, keyboardConfig, keyboardOpts, treeConfig, treeOpts, highlightCurrentRow, currentRow, bodyCtxMenu, rowOpts } = this
2735
2799
  const { selected, actived } = editStore
2736
2800
  const { keyCode } = evnt
2737
- const isBack = keyCode === 8
2801
+ const hasBackspaceKey = keyCode === 8
2738
2802
  const isTab = keyCode === 9
2739
2803
  const isEnter = keyCode === 13
2740
2804
  const isEsc = keyCode === 27
@@ -2854,11 +2918,11 @@ const Methods = {
2854
2918
  } else if (actived.row || actived.column) {
2855
2919
  this.moveTabSelected(actived.args, hasShiftKey, evnt)
2856
2920
  }
2857
- } else if (keyboardConfig && (isDel || (treeConfig && (rowOpts.isCurrent || highlightCurrentRow) && currentRow ? isBack && keyboardOpts.isArrow : isBack))) {
2921
+ } else if (keyboardConfig && (treeConfig || isEnableConf(editConfig)) && (isDel || (treeConfig && (rowOpts.isCurrent || highlightCurrentRow) && currentRow ? hasBackspaceKey && keyboardOpts.isArrow : hasBackspaceKey))) {
2858
2922
  if (!isEditStatus) {
2859
2923
  const { delMethod, backMethod } = keyboardOpts
2860
2924
  // 如果是删除键
2861
- if (keyboardOpts.isDel && (selected.row || selected.column)) {
2925
+ if (keyboardOpts.isDel && isEnableConf(editConfig) && (selected.row || selected.column)) {
2862
2926
  const delPaqrams = {
2863
2927
  row: selected.row,
2864
2928
  rowIndex: this.getRowIndex(selected.row),
@@ -2871,7 +2935,7 @@ const Methods = {
2871
2935
  } else {
2872
2936
  setCellValue(selected.row, selected.column, null)
2873
2937
  }
2874
- if (isBack) {
2938
+ if (hasBackspaceKey) {
2875
2939
  if (backMethod) {
2876
2940
  backMethod({
2877
2941
  row: selected.row,
@@ -2888,7 +2952,7 @@ const Methods = {
2888
2952
  this.updateFooter()
2889
2953
  }
2890
2954
  this.emitEvent('cell-delete-value', delPaqrams, evnt)
2891
- } else if (isBack && keyboardOpts.isArrow && treeConfig && (rowOpts.isCurrent || highlightCurrentRow) && currentRow) {
2955
+ } else if (hasBackspaceKey && keyboardOpts.isArrow && treeConfig && (rowOpts.isCurrent || highlightCurrentRow) && currentRow) {
2892
2956
  // 如果树形表格回退键关闭当前行返回父节点
2893
2957
  const { parent: parentRow } = XEUtils.findTree(this.afterFullData, item => item === currentRow, { children: childrenField })
2894
2958
  if (parentRow) {
@@ -3423,6 +3487,7 @@ const Methods = {
3423
3487
  if (trigger === 'manual') {
3424
3488
  return
3425
3489
  }
3490
+ evnt.stopPropagation()
3426
3491
  if (checkboxOpts.isShiftKey && evnt.shiftKey && !this.treeConfig) {
3427
3492
  const checkboxRecords = this.getCheckboxRecords()
3428
3493
  if (checkboxRecords.length) {
@@ -3797,6 +3862,9 @@ const Methods = {
3797
3862
  if (trigger === 'manual') {
3798
3863
  return
3799
3864
  }
3865
+ if (evnt) {
3866
+ evnt.stopPropagation()
3867
+ }
3800
3868
  this.handleCheckAllEvent(evnt, value)
3801
3869
  },
3802
3870
  /**
@@ -3863,6 +3931,7 @@ const Methods = {
3863
3931
  if (trigger === 'manual') {
3864
3932
  return
3865
3933
  }
3934
+ evnt.stopPropagation()
3866
3935
  let newValue = row
3867
3936
  let isChange = oldValue !== newValue
3868
3937
  if (isChange) {
@@ -4442,6 +4511,7 @@ const Methods = {
4442
4511
  if (trigger === 'manual') {
4443
4512
  return
4444
4513
  }
4514
+ evnt.stopPropagation()
4445
4515
  const rowid = getRowid(this, row)
4446
4516
  if (!lazy || !rowExpandLazyLoadedMaps[rowid]) {
4447
4517
  const expanded = !this.isRowExpandByRow(row)
@@ -4720,6 +4790,7 @@ const Methods = {
4720
4790
  if (trigger === 'manual') {
4721
4791
  return
4722
4792
  }
4793
+ evnt.stopPropagation()
4723
4794
  const rowid = getRowid(this, row)
4724
4795
  if (!lazy || !treeExpandLazyLoadedMaps[rowid]) {
4725
4796
  const expanded = !this.isTreeExpandByRow(row)
@@ -5290,7 +5361,7 @@ const Methods = {
5290
5361
  const type = 'change'
5291
5362
  if (this.hasCellRules) {
5292
5363
  if (this.hasCellRules(type, row, column)) {
5293
- const cell = this.getCell(row, column)
5364
+ const cell = this.getCellElement(row, column)
5294
5365
  if (cell) {
5295
5366
  return this.validCellRules(type, row, column, cellValue)
5296
5367
  .then(() => {
@@ -5435,54 +5506,12 @@ const Methods = {
5435
5506
  /*************************
5436
5507
  * Publish methods
5437
5508
  *************************/
5509
+ /**
5510
+ * 已废弃,被 getCellElement 替换
5511
+ * @deprecated
5512
+ */
5438
5513
  getCell (row, column) {
5439
- const { $refs } = this
5440
- const rowid = getRowid(this, row)
5441
- let bodyElem = null
5442
- if (column) {
5443
- bodyElem = $refs[`${column.fixed || 'table'}Body`] || $refs.tableBody
5444
- }
5445
- if (bodyElem && bodyElem.$el) {
5446
- return bodyElem.$el.querySelector(`.vxe-body--row[rowid="${rowid}"] .${column.id}`)
5447
- }
5448
- return null
5449
- },
5450
- getCellLabel (row, column) {
5451
- const formatter = column.formatter
5452
- const cellValue = UtilTools.getCellValue(row, column)
5453
- let cellLabel = cellValue
5454
- if (formatter) {
5455
- let rest, formatData
5456
- const { fullAllDataRowMap } = this
5457
- const colid = column.id
5458
- const cacheFormat = fullAllDataRowMap.has(row)
5459
- if (cacheFormat) {
5460
- rest = fullAllDataRowMap.get(row)
5461
- formatData = rest.formatData
5462
- if (!formatData) {
5463
- formatData = fullAllDataRowMap.get(row).formatData = {}
5464
- }
5465
- if (rest && formatData[colid]) {
5466
- if (formatData[colid].value === cellValue) {
5467
- return formatData[colid].label
5468
- }
5469
- }
5470
- }
5471
- const formatParams = { cellValue, row, rowIndex: this.getRowIndex(row), column, columnIndex: this.getColumnIndex(column) }
5472
- if (XEUtils.isString(formatter)) {
5473
- const gFormatOpts = formats.get(formatter)
5474
- cellLabel = gFormatOpts && gFormatOpts.cellFormatMethod ? gFormatOpts.cellFormatMethod(formatParams) : ''
5475
- } else if (XEUtils.isArray(formatter)) {
5476
- const gFormatOpts = formats.get(formatter[0])
5477
- cellLabel = gFormatOpts && gFormatOpts.cellFormatMethod ? gFormatOpts.cellFormatMethod(formatParams, ...formatter.slice(1)) : ''
5478
- } else {
5479
- cellLabel = formatter(formatParams)
5480
- }
5481
- if (formatData) {
5482
- formatData[colid] = { value: cellValue, label: cellLabel }
5483
- }
5484
- }
5485
- return cellLabel
5514
+ return this.getCellElement(row, column)
5486
5515
  },
5487
5516
  findRowIndexOf (list, row) {
5488
5517
  return row ? XEUtils.findIndexOf(list, item => this.eqRow(item, row)) : -1
@@ -822,11 +822,11 @@ export default {
822
822
  // }
823
823
  // 检查导入导出类型,如果自定义导入导出方法,则不校验类型
824
824
  const { exportConfig, exportOpts, importConfig, importOpts } = this
825
- if (importConfig && importOpts.types && !importOpts.importMethod && !XEUtils.includeArrays(VXETable.globalConfs.importTypes, importOpts.types)) {
826
- warnLog('vxe.error.errProp', [`export-config.types=${importOpts.types.join(',')}`, importOpts.types.filter(type => XEUtils.includes(VXETable.globalConfs.importTypes, type)).join(',') || VXETable.globalConfs.importTypes.join(',')])
825
+ if (importConfig && importOpts.types && !importOpts.importMethod && !XEUtils.includeArrays(XEUtils.keys(importOpts._typeMaps), importOpts.types)) {
826
+ warnLog('vxe.error.errProp', [`export-config.types=${importOpts.types.join(',')}`, importOpts.types.filter(type => XEUtils.includes(XEUtils.keys(importOpts._typeMaps), type)).join(',') || XEUtils.keys(importOpts._typeMaps).join(',')])
827
827
  }
828
- if (exportConfig && exportOpts.types && !exportOpts.exportMethod && !XEUtils.includeArrays(VXETable.globalConfs.exportTypes, exportOpts.types)) {
829
- warnLog('vxe.error.errProp', [`export-config.types=${exportOpts.types.join(',')}`, exportOpts.types.filter(type => XEUtils.includes(VXETable.globalConfs.exportTypes, type)).join(',') || VXETable.globalConfs.exportTypes.join(',')])
828
+ if (exportConfig && exportOpts.types && !exportOpts.exportMethod && !XEUtils.includeArrays(XEUtils.keys(importOpts._typeMaps), exportOpts.types)) {
829
+ warnLog('vxe.error.errProp', [`export-config.types=${exportOpts.types.join(',')}`, exportOpts.types.filter(type => XEUtils.includes(XEUtils.keys(importOpts._typeMaps), type)).join(',') || XEUtils.keys(importOpts._typeMaps).join(',')])
830
830
  }
831
831
  }
832
832
 
@@ -1,10 +1,12 @@
1
1
  import VxeTextareaComponent from './src/textarea'
2
+ import VxeUI from '../v-x-e-table'
2
3
 
3
4
  export const VxeTextarea = Object.assign(VxeTextareaComponent, {
4
5
  install (Vue) {
5
6
  Vue.component(VxeTextareaComponent.name, VxeTextareaComponent)
6
7
  }
7
8
  })
9
+ VxeUI.component(VxeTextareaComponent)
8
10
 
9
11
  export const Textarea = VxeTextarea
10
12
 
@@ -1,10 +1,12 @@
1
1
  import VxeToolbarComponent from './src/toolbar'
2
+ import VxeUI from '../v-x-e-table'
2
3
 
3
4
  export const VxeToolbar = Object.assign(VxeToolbarComponent, {
4
5
  install (Vue) {
5
6
  Vue.component(VxeToolbarComponent.name, VxeToolbarComponent)
6
7
  }
7
8
  })
9
+ VxeUI.component(VxeToolbarComponent)
8
10
 
9
11
  export const Toolbar = VxeToolbar
10
12
 
@@ -1,12 +1,13 @@
1
1
  import VxeTooltipComponent from './src/tooltip'
2
- import VXETable from '../v-x-e-table'
2
+ import VxeUI from '../v-x-e-table'
3
3
 
4
4
  export const VxeTooltip = Object.assign(VxeTooltipComponent, {
5
5
  install (Vue) {
6
- VXETable._tooltip = 1
6
+ VxeUI._tooltip = 1
7
7
  Vue.component(VxeTooltipComponent.name, VxeTooltipComponent)
8
8
  }
9
9
  })
10
+ VxeUI.component(VxeTooltipComponent)
10
11
 
11
12
  export const Tooltip = VxeTooltip
12
13
 
@@ -7,7 +7,7 @@ import { commands } from './src/commands'
7
7
  import { menus } from './src/menus'
8
8
  import { formats } from './src/formats'
9
9
  import { validators } from './src/validators'
10
- import { setTheme } from './src/theme'
10
+ import { setTheme, getTheme } from './src/theme'
11
11
  import { UtilTools } from '../tools/utils'
12
12
  import { errLog, warnLog } from '../tools/log'
13
13
 
@@ -17,11 +17,11 @@ export function use (Plugin, options) {
17
17
  /* eslint-disable @typescript-eslint/no-use-before-define */
18
18
  if (Plugin && Plugin.install) {
19
19
  if (installedPlugins.indexOf(Plugin) === -1) {
20
- Plugin.install(VXETable, options)
20
+ Plugin.install(VxeUI, options)
21
21
  installedPlugins.push(Plugin)
22
22
  }
23
23
  }
24
- return VXETable
24
+ return VxeUI
25
25
  }
26
26
 
27
27
  /**
@@ -31,22 +31,22 @@ function reg (key) {
31
31
  /* eslint-disable @typescript-eslint/no-use-before-define */
32
32
  // 检测安装顺序是否正确
33
33
  if (process.env.VUE_APP_VXE_TABLE_ENV === 'development') {
34
- if (VXETable.Table) {
34
+ if (VxeUI.Table) {
35
35
  errLog('vxe.error.useErr', [key])
36
36
  }
37
37
  }
38
- VXETable[`_${key}`] = 1
38
+ VxeUI[`_${key}`] = 1
39
39
  }
40
40
 
41
- function getExportOrImpotType (types, flag) {
42
- const rest = []
43
- XEUtils.objectEach(types, (val, type) => {
44
- if (val === 0 || val === flag) {
45
- rest.push(type)
46
- }
47
- })
48
- return rest
49
- }
41
+ // function getExportOrImpotType (types, flag) {
42
+ // const rest = []
43
+ // XEUtils.objectEach(types, (val, type) => {
44
+ // if (val === 0 || val === flag) {
45
+ // rest.push(type)
46
+ // }
47
+ // })
48
+ // return rest
49
+ // }
50
50
 
51
51
  /**
52
52
  * 全局参数设置
@@ -61,7 +61,7 @@ export const setConfig = (options) => {
61
61
  }
62
62
  XEUtils.merge(GlobalConfig, options)
63
63
  }
64
- return VXETable
64
+ return VxeUI
65
65
  }
66
66
 
67
67
  class VXETableConfig {
@@ -83,14 +83,14 @@ class VXETableConfig {
83
83
  * 获取所有导出类型
84
84
  */
85
85
  get exportTypes () {
86
- return getExportOrImpotType(GlobalConfig.export.types, 1)
86
+ return XEUtils.keys(GlobalConfig.table.exportConfig._typeMaps)
87
87
  }
88
88
 
89
89
  /**
90
90
  * 获取所有导入类型
91
91
  */
92
92
  get importTypes () {
93
- return getExportOrImpotType(GlobalConfig.export.types, 2)
93
+ return XEUtils.keys(GlobalConfig.table.importConfig._typeMaps)
94
94
  }
95
95
  }
96
96
 
@@ -133,14 +133,30 @@ export function setIcon (options) {
133
133
  if (options) {
134
134
  Object.assign(GlobalConfig.icon, options)
135
135
  }
136
- return VXETable
136
+ return VxeUI
137
137
  }
138
138
 
139
139
  export const globalStore = {}
140
140
 
141
- export const VXETable = {
141
+ const components = {}
142
+
143
+ export function getComponent (name) {
144
+ return components[name] || null
145
+ }
146
+
147
+ export function component (comp) {
148
+ if (comp && comp.name) {
149
+ components[comp.name] = comp
150
+ }
151
+ }
152
+
153
+ export const version = process.env.VUE_APP_VXE_TABLE_VERSION
154
+ export const tableVersion = version
155
+
156
+ export const VxeUI = {
142
157
  v,
143
- version: process.env.VUE_APP_VXE_TABLE_VERSION,
158
+ version,
159
+ tableVersion,
144
160
  reg,
145
161
  use,
146
162
  setConfig,
@@ -154,6 +170,10 @@ export const VXETable = {
154
170
  validators,
155
171
  t,
156
172
  _t,
173
+ setTheme,
174
+ getTheme,
175
+ getComponent,
176
+ component,
157
177
 
158
178
  // 已废弃
159
179
  config,
@@ -161,7 +181,7 @@ export const VXETable = {
161
181
  globalConfs
162
182
  }
163
183
 
164
- export const VxeUI = VXETable
184
+ export const VXETable = VxeUI
165
185
 
166
186
  setTheme('light')
167
187
 
@@ -171,4 +191,6 @@ export * from './src/commands'
171
191
  export * from './src/menus'
172
192
  export * from './src/formats'
173
193
 
174
- export default VXETable
194
+ export * from './src/theme'
195
+
196
+ export default VxeUI
@@ -100,7 +100,12 @@ export default {
100
100
  showAsterisk: true
101
101
  },
102
102
  importConfig: {
103
- _typeMaps: {},
103
+ _typeMaps: {
104
+ csv: 1,
105
+ html: 1,
106
+ xml: 1,
107
+ txt: 1
108
+ },
104
109
  modes: ['insert', 'covering']
105
110
  },
106
111
  exportConfig: {
@@ -5,6 +5,7 @@ export function setTheme (name) {
5
5
  if (!theme || theme === 'default') {
6
6
  theme = 'light'
7
7
  }
8
+ GlobalConfig.theme = theme
8
9
  if (typeof document !== 'undefined') {
9
10
  const documentElement = document.documentElement
10
11
  if (documentElement) {
@@ -12,3 +13,7 @@ export function setTheme (name) {
12
13
  }
13
14
  }
14
15
  }
16
+
17
+ export function getTheme () {
18
+ return GlobalConfig.theme
19
+ }
@@ -221,7 +221,7 @@ export default {
221
221
  })
222
222
  }
223
223
  const posAndFinish = () => {
224
- firstErrParams.cell = this.getCell(firstErrParams.row, firstErrParams.column)
224
+ firstErrParams.cell = this.getCellElement(firstErrParams.row, firstErrParams.column)
225
225
  DomTools.scrollToView(firstErrParams.cell)
226
226
  this.handleValidError(firstErrParams).then(finish)
227
227
  }
package/types/table.d.ts CHANGED
@@ -1558,6 +1558,10 @@ export interface TableKeyboardConfig {
1558
1558
  * 是否开启删除键功能
1559
1559
  */
1560
1560
  isDel?: boolean;
1561
+ /**
1562
+ * 是否开启回退键功能
1563
+ */
1564
+ isBack?: boolean
1561
1565
  /**
1562
1566
  * 是否开启回车移动上下行移动
1563
1567
  */
@@ -58,6 +58,7 @@ export interface VxeGlobalIcon {
58
58
 
59
59
  export type VxeGlobalConfigMethod = (options?: VXETableConfigOptions) => VxeGlobalStore
60
60
  export type VxeGlobalThemeMethod = (name?: '' | 'light' | 'dark') => VxeGlobalStore
61
+ export type VxeGlobalGetThemeMethod = () => 'light' | 'dark'
61
62
 
62
63
  /**
63
64
  * @deprecated
@@ -83,6 +84,8 @@ export const globalStore: VxeGlobalStore
83
84
 
84
85
  export const setConfig: VxeGlobalConfigMethod
85
86
  export const setTheme: VxeGlobalThemeMethod
87
+ export const getTheme: VxeGlobalGetThemeMethod
88
+
86
89
  /**
87
90
  * 请使用 setConfig
88
91
  * @deprecated
@@ -101,6 +104,9 @@ export const t: VxeGlobalI18n
101
104
  export const _t: VxeGlobalTranslate
102
105
  export const use: VxeGlobalUse
103
106
 
107
+ export function getComponent (name: string): any
108
+ export function component (comp: any): any
109
+
104
110
  /**
105
111
  * 请使用 setConfig
106
112
  * @deprecated
@@ -128,6 +134,7 @@ export interface VXETableCore {
128
134
  */
129
135
  setConfig: VxeGlobalConfigMethod;
130
136
  setTheme: VxeGlobalThemeMethod
137
+ getTheme: VxeGlobalGetThemeMethod
131
138
  setIcon: typeof setIcon
132
139
  /**
133
140
  * 读取内部数据
@@ -185,6 +192,9 @@ export interface VXETableCore {
185
192
  t: VxeGlobalI18n;
186
193
  _t: VxeGlobalTranslate;
187
194
 
195
+ getComponent: typeof getComponent,
196
+ component: typeof component,
197
+
188
198
  /**
189
199
  * 请使用 setConfig
190
200
  * @deprecated