vxe-table 3.11.9 → 3.11.12

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 (56) hide show
  1. package/es/index.css +1 -1
  2. package/es/index.min.css +1 -1
  3. package/es/style.css +1 -1
  4. package/es/style.min.css +1 -1
  5. package/es/table/module/edit/mixin.js +57 -30
  6. package/es/table/module/export/import-panel.js +3 -3
  7. package/es/table/src/body.js +12 -12
  8. package/es/table/src/columnInfo.js +3 -1
  9. package/es/table/src/methods.js +17 -7
  10. package/es/table/src/table.js +0 -1
  11. package/es/table/style.css +1 -1
  12. package/es/table/style.min.css +1 -1
  13. package/es/ui/index.js +1 -1
  14. package/es/ui/src/log.js +1 -1
  15. package/es/vxe-table/style.css +1 -1
  16. package/es/vxe-table/style.min.css +1 -1
  17. package/lib/index.css +1 -1
  18. package/lib/index.min.css +1 -1
  19. package/lib/index.umd.js +134 -66
  20. package/lib/index.umd.min.js +1 -1
  21. package/lib/style.css +1 -1
  22. package/lib/style.min.css +1 -1
  23. package/lib/table/module/edit/mixin.js +93 -42
  24. package/lib/table/module/edit/mixin.min.js +1 -1
  25. package/lib/table/module/export/import-panel.js +3 -2
  26. package/lib/table/module/export/import-panel.min.js +1 -1
  27. package/lib/table/src/body.js +12 -12
  28. package/lib/table/src/body.min.js +1 -1
  29. package/lib/table/src/columnInfo.js +5 -1
  30. package/lib/table/src/columnInfo.min.js +1 -1
  31. package/lib/table/src/methods.js +19 -6
  32. package/lib/table/src/methods.min.js +1 -1
  33. package/lib/table/src/table.js +0 -1
  34. package/lib/table/src/table.min.js +1 -1
  35. package/lib/table/style/style.css +1 -1
  36. package/lib/table/style/style.min.css +1 -1
  37. package/lib/ui/index.js +1 -1
  38. package/lib/ui/index.min.js +1 -1
  39. package/lib/ui/src/log.js +1 -1
  40. package/lib/ui/src/log.min.js +1 -1
  41. package/lib/vxe-table/style/style.css +1 -1
  42. package/lib/vxe-table/style/style.min.css +1 -1
  43. package/package.json +2 -2
  44. package/packages/table/module/edit/mixin.ts +61 -31
  45. package/packages/table/module/export/import-panel.ts +3 -3
  46. package/packages/table/src/body.ts +12 -12
  47. package/packages/table/src/columnInfo.ts +3 -1
  48. package/packages/table/src/methods.ts +20 -7
  49. package/packages/table/src/table.ts +0 -1
  50. package/styles/components/table.scss +1 -1
  51. /package/es/{iconfont.1732607941851.ttf → iconfont.1732797517080.ttf} +0 -0
  52. /package/es/{iconfont.1732607941851.woff → iconfont.1732797517080.woff} +0 -0
  53. /package/es/{iconfont.1732607941851.woff2 → iconfont.1732797517080.woff2} +0 -0
  54. /package/lib/{iconfont.1732607941851.ttf → iconfont.1732797517080.ttf} +0 -0
  55. /package/lib/{iconfont.1732607941851.woff → iconfont.1732797517080.woff} +0 -0
  56. /package/lib/{iconfont.1732607941851.woff2 → iconfont.1732797517080.woff2} +0 -0
@@ -49,20 +49,34 @@ function insertTreeRow (_vm: any, newRecords: any[], isAppend: any) {
49
49
  }
50
50
 
51
51
  function handleInsertRowAt (_vm: any, records: any[], row: any, isInsertNextRow?: any) {
52
- const { tableFullTreeData, mergeList, afterFullData, editStore, tableFullData, treeConfig, fullDataRowIdData, fullAllDataRowIdData, treeOpts } = _vm
52
+ const $xeTable = _vm
53
+ const props = $xeTable
54
+ const reactData = $xeTable
55
+ const internalData = $xeTable
56
+
57
+ const { treeConfig } = props
58
+ const { mergeList, editStore } = reactData
59
+ const { tableFullTreeData, afterFullData, tableFullData, fullDataRowIdData, fullAllDataRowIdData } = internalData
60
+ const treeOpts = $xeTable.computeTreeOpts
53
61
  const { transform, rowField, mapChildrenField } = treeOpts
54
62
  const childrenField = treeOpts.children || treeOpts.childrenField
55
63
  if (!XEUtils.isArray(records)) {
56
64
  records = [records]
57
65
  }
58
- const newRecords = _vm.defineField(records.map(record => Object.assign(treeConfig && transform ? { [mapChildrenField]: [], [childrenField]: [] } : {}, record)))
66
+ const newRecords: any[] = _vm.defineField(records.map(record => Object.assign(treeConfig && transform ? { [mapChildrenField]: [], [childrenField]: [] } : {}, record)))
59
67
  if (XEUtils.eqNull(row)) {
60
68
  // 如果为虚拟树
61
69
  if (treeConfig && transform) {
62
70
  insertTreeRow(_vm, newRecords, false)
63
71
  } else {
64
- afterFullData.unshift(...newRecords)
65
- tableFullData.unshift(...newRecords)
72
+ newRecords.forEach(item => {
73
+ const rowid = getRowid($xeTable, item)
74
+ const rest = { row: item, rowid, seq: -1, index: -1, _index: -1, $index: -1, items: afterFullData, parent: null, level: 0, height: 0 }
75
+ fullDataRowIdData[rowid] = rest
76
+ fullAllDataRowIdData[rowid] = rest
77
+ afterFullData.push(item)
78
+ tableFullData.push(item)
79
+ })
66
80
  // 刷新单元格合并
67
81
  mergeList.forEach((mergeItem: any) => {
68
82
  const { row: mergeRowIndex } = mergeItem
@@ -77,8 +91,14 @@ function handleInsertRowAt (_vm: any, records: any[], row: any, isInsertNextRow?
77
91
  if (treeConfig && transform) {
78
92
  insertTreeRow(_vm, newRecords, true)
79
93
  } else {
80
- afterFullData.push(...newRecords)
81
- tableFullData.push(...newRecords)
94
+ newRecords.forEach(item => {
95
+ const rowid = getRowid($xeTable, item)
96
+ const rest = { row: item, rowid, seq: -1, index: -1, _index: -1, $index: -1, items: afterFullData, parent: null, level: 0, height: 0 }
97
+ fullDataRowIdData[rowid] = rest
98
+ fullAllDataRowIdData[rowid] = rest
99
+ afterFullData.push(item)
100
+ tableFullData.push(item)
101
+ })
82
102
  // 刷新单元格合并
83
103
  mergeList.forEach((mergeItem: any) => {
84
104
  const { row: mergeRowIndex, rowspan: mergeRowspan } = mergeItem
@@ -170,12 +190,11 @@ function handleInsertRowAt (_vm: any, records: any[], row: any, isInsertNextRow?
170
190
  }
171
191
  }
172
192
  }
173
- const { insertList, insertMaps } = editStore
174
- newRecords.forEach((newRow: any) => {
175
- const rowid = getRowid(_vm, newRow)
193
+ const { insertMaps } = editStore
194
+ newRecords.forEach(newRow => {
195
+ const rowid = getRowid($xeTable, newRow)
176
196
  insertMaps[rowid] = newRow
177
197
  })
178
- insertList.unshift(...newRecords)
179
198
  _vm.cacheRowMap()
180
199
  _vm.updateScrollYStatus()
181
200
  _vm.handleTableData(treeConfig && transform)
@@ -230,10 +249,19 @@ export default {
230
249
  * 如果为空则删除所有
231
250
  */
232
251
  _remove (rows: any[]) {
233
- const { afterFullData, tableFullData, tableFullTreeData, treeConfig, mergeList, editStore, checkboxOpts, selectCheckboxMaps, isInsertByRow, treeOpts } = this
252
+ const $xeTable = this
253
+ const props = $xeTable
254
+ const reactData = $xeTable
255
+ const internalData = $xeTable
256
+
257
+ const { treeConfig } = props
258
+ const { mergeList, editStore, selectCheckboxMaps } = reactData
259
+ const { tableFullTreeData, afterFullData, tableFullData } = internalData
260
+ const checkboxOpts = $xeTable.computeCheckboxOpts
261
+ const treeOpts = $xeTable.computeTreeOpts
234
262
  const { transform, mapChildrenField } = treeOpts
235
263
  const childrenField = treeOpts.children || treeOpts.childrenField
236
- const { actived, removeList, insertList, insertMaps } = editStore
264
+ const { actived, removeList, insertMaps } = editStore
237
265
  const { checkField } = checkboxOpts
238
266
  let delList: any[] = []
239
267
  if (!rows) {
@@ -243,7 +271,7 @@ export default {
243
271
  }
244
272
  // 如果是新增,则保存记录
245
273
  rows.forEach(row => {
246
- if (!isInsertByRow(row)) {
274
+ if (!$xeTable.isInsertByRow(row)) {
247
275
  removeList.push(row)
248
276
  }
249
277
  })
@@ -307,27 +335,25 @@ export default {
307
335
  }
308
336
  }
309
337
  // 如果当前行被激活编辑,则清除激活状态
310
- if (actived.row && this.findRowIndexOf(rows, actived.row) > -1) {
311
- this.clearEdit()
338
+ if (actived.row && $xeTable.findRowIndexOf(rows, actived.row) > -1) {
339
+ $xeTable.clearEdit()
312
340
  }
313
341
  // 从新增中移除已删除的数据
314
342
  rows.forEach((row: any) => {
315
- const rowid = getRowid(this, row)
316
- const iIndex = this.findRowIndexOf(insertList, row)
317
- if (iIndex > -1) {
318
- insertList.splice(iIndex, 1)
343
+ const rowid = getRowid($xeTable, row)
344
+ if (insertMaps[rowid]) {
345
+ delete insertMaps[rowid]
319
346
  }
320
- delete insertMaps[rowid]
321
347
  })
322
- this.handleTableData(treeConfig && transform)
348
+ $xeTable.updateFooter()
349
+ $xeTable.cacheRowMap()
350
+ $xeTable.handleTableData(treeConfig && transform)
323
351
  if (!(treeConfig && transform)) {
324
- this.updateAfterDataIndex()
352
+ $xeTable.updateAfterDataIndex()
325
353
  }
326
- this.updateFooter()
327
- this.cacheRowMap()
328
- this.checkSelectionStatus()
329
- if (this.scrollYLoad) {
330
- this.updateScrollYSpace()
354
+ $xeTable.checkSelectionStatus()
355
+ if (reactData.scrollYLoad) {
356
+ $xeTable.updateScrollYSpace()
331
357
  }
332
358
  return this.$nextTick().then(() => {
333
359
  this.updateCellAreas()
@@ -387,11 +413,15 @@ export default {
387
413
  * 获取新增的临时数据
388
414
  */
389
415
  _getInsertRecords () {
390
- const { fullAllDataRowIdData } = this
391
- const insertList = this.editStore.insertList as any[]
416
+ const $xeTable = this
417
+ const reactData = $xeTable
418
+ const internalData = $xeTable
419
+
420
+ const { editStore } = reactData
421
+ const { fullAllDataRowIdData } = internalData
422
+ const { insertMaps } = editStore
392
423
  const insertRecords: any[] = []
393
- insertList.forEach(row => {
394
- const rowid = getRowid(this, row)
424
+ XEUtils.each(insertMaps, (row, rowid) => {
395
425
  if (fullAllDataRowIdData[rowid]) {
396
426
  insertRecords.push(row)
397
427
  }
@@ -72,7 +72,7 @@ export default {
72
72
  render (this: any, h: CreateElement) {
73
73
  const $xeTable = this.$xeTable
74
74
 
75
- const { hasFile, parseTypeLabel, defaultOptions, storeData, selectName } = this
75
+ const { hasFile, loading, parseTypeLabel, defaultOptions, storeData, selectName } = this
76
76
  const slots = defaultOptions.slots || {}
77
77
  const topSlot = slots.top
78
78
  const bottomSlot = slots.bottom
@@ -95,7 +95,7 @@ export default {
95
95
  maskClosable: true,
96
96
  showMaximize: true,
97
97
  resize: true,
98
- loading: this.loading
98
+ loading
99
99
  },
100
100
  on: {
101
101
  input (value: any) {
@@ -218,7 +218,7 @@ export default {
218
218
  h('vxe-button', {
219
219
  props: {
220
220
  status: 'primary',
221
- disabled: !hasFile
221
+ disabled: !hasFile || loading
222
222
  },
223
223
  on: {
224
224
  click: this.importEvent
@@ -381,18 +381,6 @@ function renderRows (h: CreateElement, _vm: any, $xeTable: any, fixedType: any,
381
381
  $xeTable.clearHoverRow()
382
382
  }
383
383
  }
384
- // 拖拽行事件
385
- if (rowOpts.drag) {
386
- trOn.dragstart = (evnt: DragEvent) => {
387
- $xeTable.handleRowDragDragstartEvent(evnt)
388
- }
389
- trOn.dragover = (evnt: DragEvent) => {
390
- $xeTable.handleRowDragDragoverEvent(evnt)
391
- }
392
- trOn.dragend = (evnt: DragEvent) => {
393
- $xeTable.handleRowDragDragendEvent(evnt)
394
- }
395
- }
396
384
  const rowid = getRowid($xeTable, row)
397
385
  const rest = fullAllDataRowIdData[rowid]
398
386
  const rowLevel = rest ? rest.level : 0
@@ -412,6 +400,18 @@ function renderRows (h: CreateElement, _vm: any, $xeTable: any, fixedType: any,
412
400
  rowChildren = row[childrenField]
413
401
  isExpandTree = rowChildren && rowChildren.length && !!treeExpandedMaps[rowid]
414
402
  }
403
+ // 拖拽行事件
404
+ if (rowOpts.drag && !rowLevel) {
405
+ trOn.dragstart = (evnt: DragEvent) => {
406
+ $xeTable.handleRowDragDragstartEvent(evnt)
407
+ }
408
+ trOn.dragover = (evnt: DragEvent) => {
409
+ $xeTable.handleRowDragDragoverEvent(evnt)
410
+ }
411
+ trOn.dragend = (evnt: DragEvent) => {
412
+ $xeTable.handleRowDragDragendEvent(evnt)
413
+ }
414
+ }
415
415
  const trClass = [
416
416
  'vxe-body--row',
417
417
  treeConfig ? `row--level-${rowLevel}` : '',
@@ -13,6 +13,7 @@ export class ColumnInfo {
13
13
  const proxyOpts = $xegrid ? $xegrid.proxyOpts : null
14
14
  const formatter = _vm.formatter
15
15
  const visible = XEUtils.isBoolean(_vm.visible) ? _vm.visible : true
16
+ const tableProps = $xetable
16
17
 
17
18
  if (process.env.VUE_APP_VXE_ENV === 'development') {
18
19
  const types = ['seq', 'checkbox', 'radio', 'expand', 'html']
@@ -29,7 +30,8 @@ export class ColumnInfo {
29
30
  warnLog('vxe.error.errConflicts', ['column.cell-render', 'column.edit-render'])
30
31
  }
31
32
  if (_vm.type === 'expand') {
32
- if ($xetable.treeConfig && ($xetable.treeOpts.showLine || $xetable.treeOpts.line)) {
33
+ const { treeConfig } = tableProps
34
+ if (treeConfig && ($xetable.treeOpts.showLine || $xetable.treeOpts.line)) {
33
35
  errLog('vxe.error.errConflicts', ['tree-config.line', 'column.type=expand'])
34
36
  }
35
37
  }
@@ -663,7 +663,7 @@ const Methods = {
663
663
  * @param {Array} datas 数据
664
664
  */
665
665
  loadTableData (datas: any) {
666
- const { keepSource, treeConfig, treeOpts, editStore, scrollYStore, scrollXStore, lastScrollLeft, lastScrollTop, scrollYLoad: oldScrollYLoad, sXOpts, sYOpts } = this
666
+ const { keepSource, showOverflow, treeConfig, treeOpts, editStore, scrollYStore, scrollXStore, lastScrollLeft, lastScrollTop, scrollYLoad: oldScrollYLoad, sXOpts, sYOpts } = this
667
667
  const childrenField = treeOpts.children || treeOpts.childrenField
668
668
  let treeData = []
669
669
  let fullData = datas ? datas.slice(0) : []
@@ -707,7 +707,6 @@ const Methods = {
707
707
  scrollYStore.endIndex = 1
708
708
  scrollXStore.startIndex = 0
709
709
  scrollXStore.endIndex = 1
710
- editStore.insertList = []
711
710
  editStore.insertMaps = {}
712
711
  editStore.removeList = []
713
712
  editStore.removeMaps = {}
@@ -725,8 +724,15 @@ const Methods = {
725
724
  if (keepSource) {
726
725
  this.cacheSourceMap(fullData)
727
726
  }
728
- if (process.env.VUE_APP_VXE_ENV === 'development') {
729
- if (sYLoad) {
727
+ if (sYLoad) {
728
+ if (showOverflow) {
729
+ const errColumn = this.tableFullColumn.find((column: any) => column.showOverflow === false)
730
+ if (errColumn) {
731
+ errLog('vxe.error.errProp', [`column[field="${errColumn.field}"].show-overflow=false`, 'show-overflow=true'])
732
+ }
733
+ }
734
+
735
+ if (process.env.VUE_APP_VXE_ENV === 'development') {
730
736
  if (!(this.height || this.maxHeight)) {
731
737
  errLog('vxe.error.reqProp', ['table.height | table.max-height | table.scroll-y={enabled: false}'])
732
738
  }
@@ -1558,14 +1564,19 @@ const Methods = {
1558
1564
  isInsertByRow (row: any) {
1559
1565
  const { editStore } = this
1560
1566
  const rowid = getRowid(this, row)
1561
- return editStore.insertList.length && editStore.insertMaps[rowid]
1567
+ return !!editStore.insertMaps[rowid]
1562
1568
  },
1563
1569
  /**
1564
1570
  * 删除所有新增的临时数据
1565
1571
  * @returns
1566
1572
  */
1567
1573
  removeInsertRow () {
1568
- return this.remove(this.editStore.insertList)
1574
+ const $xeTable = this
1575
+ const reactData = $xeTable
1576
+
1577
+ const { editStore } = reactData
1578
+ editStore.insertMaps = {}
1579
+ return $xeTable.remove($xeTable.getInsertRecords())
1569
1580
  },
1570
1581
  /**
1571
1582
  * 检查行或列数据是否发生改变
@@ -5097,6 +5108,8 @@ const Methods = {
5097
5108
  oldIndex: oafIndex
5098
5109
  }
5099
5110
  }, evnt)
5111
+
5112
+ $xeTable.saveCustomStore('update:sort')
5100
5113
  }).catch(() => {
5101
5114
  })
5102
5115
  }
@@ -5683,7 +5696,7 @@ const Methods = {
5683
5696
  const hasChildField = treeOpts.hasChild || treeOpts.hasChildField
5684
5697
  const rowid = getRowid(this, row)
5685
5698
  if (lazy && row[hasChildField] && !treeExpandLazyLoadedMaps[rowid]) {
5686
- this.clearTreeExpandLoaded(row).then(() => {
5699
+ return this.clearTreeExpandLoaded(row).then(() => {
5687
5700
  return this.handleAsyncTreeExpandChilds(row)
5688
5701
  }).then(() => {
5689
5702
  if (transform) {
@@ -339,7 +339,6 @@ export default {
339
339
  row: null,
340
340
  column: null
341
341
  },
342
- insertList: [],
343
342
  insertMaps: {},
344
343
  removeList: [],
345
344
  removeMaps: {}
@@ -1288,7 +1288,7 @@
1288
1288
  position: absolute;
1289
1289
  top: 0;
1290
1290
  left: 0;
1291
- z-index: 9;
1291
+ z-index: 11;
1292
1292
  pointer-events: none;
1293
1293
  }
1294
1294
  .vxe-cell--drag-handle {