vxe-table 3.20.13 → 3.21.0-beta.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (57) hide show
  1. package/es/style.css +1 -1
  2. package/es/table/module/edit/mixin.js +33 -12
  3. package/es/table/module/keyboard/mixin.js +2 -2
  4. package/es/table/src/cell.js +3 -3
  5. package/es/table/src/column.js +6 -3
  6. package/es/table/src/group.js +6 -3
  7. package/es/table/src/methods.js +365 -165
  8. package/es/table/src/props.js +2 -2
  9. package/es/table/src/table.js +13 -6
  10. package/es/table/src/util.js +12 -3
  11. package/es/ui/index.js +3 -3
  12. package/es/ui/src/dom.js +4 -0
  13. package/es/ui/src/log.js +1 -1
  14. package/lib/index.umd.js +364 -302
  15. package/lib/index.umd.min.js +1 -1
  16. package/lib/style.css +1 -1
  17. package/lib/table/module/edit/mixin.js +39 -12
  18. package/lib/table/module/edit/mixin.min.js +1 -1
  19. package/lib/table/module/keyboard/mixin.js +2 -2
  20. package/lib/table/module/keyboard/mixin.min.js +1 -1
  21. package/lib/table/src/cell.js +3 -3
  22. package/lib/table/src/column.js +6 -3
  23. package/lib/table/src/column.min.js +1 -1
  24. package/lib/table/src/group.js +6 -3
  25. package/lib/table/src/group.min.js +1 -1
  26. package/lib/table/src/methods.js +35 -29
  27. package/lib/table/src/methods.min.js +1 -1
  28. package/lib/table/src/props.js +2 -2
  29. package/lib/table/src/props.min.js +1 -1
  30. package/lib/table/src/table.js +15 -6
  31. package/lib/table/src/table.min.js +1 -1
  32. package/lib/table/src/util.js +12 -3
  33. package/lib/table/src/util.min.js +1 -1
  34. package/lib/ui/index.js +3 -3
  35. package/lib/ui/index.min.js +1 -1
  36. package/lib/ui/src/dom.js +5 -0
  37. package/lib/ui/src/dom.min.js +1 -1
  38. package/lib/ui/src/log.js +1 -1
  39. package/lib/ui/src/log.min.js +1 -1
  40. package/package.json +3 -3
  41. package/packages/table/module/edit/mixin.ts +47 -12
  42. package/packages/table/module/keyboard/mixin.ts +2 -2
  43. package/packages/table/src/cell.ts +5 -5
  44. package/packages/table/src/column.ts +10 -7
  45. package/packages/table/src/group.ts +10 -6
  46. package/packages/table/src/methods.ts +376 -161
  47. package/packages/table/src/props.ts +3 -3
  48. package/packages/table/src/table.ts +13 -6
  49. package/packages/table/src/util.ts +16 -6
  50. package/packages/ui/index.ts +2 -2
  51. package/packages/ui/src/dom.ts +5 -0
  52. /package/es/{iconfont.1776926445391.ttf → iconfont.1777796331871.ttf} +0 -0
  53. /package/es/{iconfont.1776926445391.woff → iconfont.1777796331871.woff} +0 -0
  54. /package/es/{iconfont.1776926445391.woff2 → iconfont.1777796331871.woff2} +0 -0
  55. /package/lib/{iconfont.1776926445391.ttf → iconfont.1777796331871.ttf} +0 -0
  56. /package/lib/{iconfont.1776926445391.woff → iconfont.1777796331871.woff} +0 -0
  57. /package/lib/{iconfont.1776926445391.woff2 → iconfont.1777796331871.woff2} +0 -0
@@ -182,7 +182,7 @@ export const tableProps = {
182
182
  * @deprecated
183
183
  */
184
184
  rowId: { type: String, default: () => getConfig().table.rowId },
185
- zIndex: Number,
185
+ zIndex: Number as PropType<VxeTablePropTypes.ZIndex>,
186
186
  emptyText: { type: String, default: () => getConfig().table.emptyText },
187
187
  keepSource: { type: Boolean, default: () => getConfig().table.keepSource },
188
188
  // 是否自动监听父容器变化去更新响应式表格宽高
@@ -300,8 +300,8 @@ export const tableProps = {
300
300
  virtualYConfig: Object as PropType<VxeTablePropTypes.VirtualYConfig>,
301
301
  // 滚动条配置项
302
302
  scrollbarConfig: Object as PropType<VxeTablePropTypes.ScrollbarConfig>,
303
- // 可撤销配置项
304
- undoHistoryConfig: Object as PropType<VxeTablePropTypes.UndoHistoryConfig>,
303
+ // 撤销/恢复历史配置项
304
+ undoRedoHistoryConfig: Object as PropType<VxeTablePropTypes.UndoRedoHistoryConfig>,
305
305
  // (即将废弃)优化相关
306
306
  animat: { type: Boolean, default: () => getConfig().table.animat },
307
307
  // (可能会被废弃的参数,不要使用)
@@ -1451,11 +1451,11 @@ export default {
1451
1451
  }
1452
1452
  return []
1453
1453
  },
1454
- computeUndoHistoryOpts () {
1454
+ computeUndoRedoHistoryOpts () {
1455
1455
  const $xeTable = this as VxeTableConstructor & VxeTablePrivateMethods
1456
1456
  const props = $xeTable
1457
1457
 
1458
- return Object.assign({}, getConfig().table.undoHistoryConfig, props.undoHistoryConfig)
1458
+ return Object.assign({}, getConfig().table.undoRedoHistoryConfig, props.undoRedoHistoryConfig)
1459
1459
  },
1460
1460
  tabsResizeFlag () {
1461
1461
  const $xeTable = this as VxeTableConstructor & VxeTablePrivateMethods
@@ -1662,7 +1662,7 @@ export default {
1662
1662
 
1663
1663
  handleKeyField($xeTable)
1664
1664
 
1665
- const { exportConfig, importConfig, treeConfig, minHeight } = props
1665
+ const { editConfig, exportConfig, importConfig, treeConfig, minHeight, keepSource } = props
1666
1666
  const { scrollXStore, scrollYStore } = internalData
1667
1667
  const columnOpts = $xeTable.computeColumnOpts
1668
1668
  const columnDragOpts = $xeTable.computeColumnDragOpts
@@ -1698,8 +1698,15 @@ export default {
1698
1698
  if (!(props.rowId || rowOpts.keyField) && (checkboxOpts.reserve || checkboxOpts.checkRowKeys || radioOpts.reserve || radioOpts.checkRowKey || expandOpts.expandRowKeys || treeOpts.expandRowKeys)) {
1699
1699
  warnLog('vxe.error.reqProp', ['row-config.keyField'])
1700
1700
  }
1701
- if (props.editConfig && editOpts.showStatus && !props.keepSource) {
1702
- warnLog('vxe.error.reqProp', ['keep-source'])
1701
+ if (editConfig) {
1702
+ if (!keepSource) {
1703
+ if (editOpts.showStatus || editOpts.showUpdateStatus || editOpts.showInsertStatus) {
1704
+ warnLog('vxe.error.reqSupportProp', ['edit-config.showStatus | showUpdateStatus | showInsertStatus', 'keep-source'])
1705
+ }
1706
+ // if (keyboardOpts.isUndoRedo) {
1707
+ // warnLog('vxe.error.reqSupportProp', ['keyboard-config.isUndoRedo', 'keep-source'])
1708
+ // }
1709
+ }
1703
1710
  }
1704
1711
  // if (treeConfig && (treeOpts.showLine || treeOpts.line) && !showOverflow) {
1705
1712
  // warnLog('vxe.error.reqProp', ['show-overflow'])
@@ -1773,7 +1780,7 @@ export default {
1773
1780
  if (rowOpts.height && !this.showOverflow) {
1774
1781
  warnLog('vxe.error.notProp', ['table.show-overflow'])
1775
1782
  }
1776
- if (!$xeTable.triggerClAreaModnEvent) {
1783
+ if (!$xeTable.triggerCelllAreaMnEvent) {
1777
1784
  if (props.areaConfig) {
1778
1785
  warnLog('vxe.error.notProp', ['area-config'])
1779
1786
  }
@@ -143,6 +143,11 @@ export function createInternalData (): TableInternalData {
143
143
  // 表尾高度
144
144
  tFooterHeight: 0,
145
145
 
146
+ stackHistoryStore: {
147
+ undoStacks: [],
148
+ redoStacks: []
149
+ },
150
+
146
151
  teleportToWrapperElem: null,
147
152
  popupToWrapperElem: null,
148
153
  customPopupToElem: null,
@@ -299,7 +304,7 @@ export function createReactData (): TableReactData {
299
304
  tooltipStore: {
300
305
  row: null,
301
306
  column: null,
302
- content: null,
307
+ content: '',
303
308
  visible: false,
304
309
  type: null,
305
310
  currOpts: {}
@@ -833,12 +838,17 @@ export function getLastChildColumn (column: VxeTableDefines.ColumnInfo): VxeTabl
833
838
  return column
834
839
  }
835
840
 
836
- export function getCellValue (row: any, column: any) {
837
- return XEUtils.get(row, column.field)
841
+ export function getCellValue (row: any, column: VxeTableDefines.ColumnInfo | null) {
842
+ if (column) {
843
+ return XEUtils.get(row, column.field)
844
+ }
845
+ return null
838
846
  }
839
847
 
840
- export function setCellValue (row: any, column:any, value: any) {
841
- return XEUtils.set(row, column.field, value)
848
+ export function setCellValue (row: any, column: VxeTableDefines.ColumnInfo | null, value: any) {
849
+ if (column) {
850
+ XEUtils.set(row, column.field, value)
851
+ }
842
852
  }
843
853
 
844
854
  export function getRefElem (refEl: any) {
@@ -907,7 +917,7 @@ export function getColumnList (columns: VxeTableDefines.ColumnInfo[]) {
907
917
  return result
908
918
  }
909
919
 
910
- export function createColumn ($xeTable: VxeTableConstructor & VxeTablePrivateMethods, options: any, renderOptions: any): any {
920
+ export function createColumn ($xeTable: VxeTableConstructor & VxeTablePrivateMethods, options: VxeTableDefines.ColumnOptions | VxeTableDefines.ColumnInfo, renderOptions: any): any {
911
921
  return isColumnInfo(options) ? options : new ColumnInfo($xeTable, options, renderOptions)
912
922
  }
913
923
 
@@ -271,8 +271,8 @@ VxeUI.setConfig({
271
271
  visible: true
272
272
  }
273
273
  },
274
- undoHistoryConfig: {
275
- isEditRow: true
274
+ undoRedoHistoryConfig: {
275
+ stackSize: 20
276
276
  }
277
277
  },
278
278
  grid: {
@@ -190,6 +190,11 @@ export function getAbsolutePos (elem: any) {
190
190
  return { boundingTop, top: scrollTop + boundingTop, boundingLeft, left: scrollLeft + boundingLeft, visibleHeight, visibleWidth }
191
191
  }
192
192
 
193
+ export function hasEventInputTarget (target: EventTarget | Element | null) {
194
+ const tagName = target ? (target as Element).tagName : ''
195
+ return tagName && ['input', 'textarea'].includes((tagName.toLowerCase()))
196
+ }
197
+
193
198
  const scrollIntoViewIfNeeded = 'scrollIntoViewIfNeeded'
194
199
  const scrollIntoView = 'scrollIntoView'
195
200