vxe-table 3.14.0-beta.20 → 3.14.0-beta.21

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 (45) hide show
  1. package/es/style.css +1 -1
  2. package/es/table/module/edit/mixin.js +14 -9
  3. package/es/table/module/validator/mixin.js +2 -2
  4. package/es/table/src/body.js +10 -10
  5. package/es/table/src/cell.js +15 -11
  6. package/es/table/src/methods.js +509 -458
  7. package/es/table/src/table.js +46 -26
  8. package/es/table/src/util.js +2 -2
  9. package/es/ui/index.js +1 -1
  10. package/es/ui/src/log.js +1 -1
  11. package/lib/index.umd.js +761 -670
  12. package/lib/index.umd.min.js +1 -1
  13. package/lib/style.css +1 -1
  14. package/lib/table/module/edit/mixin.js +16 -11
  15. package/lib/table/module/edit/mixin.min.js +1 -1
  16. package/lib/table/module/validator/mixin.js +3 -3
  17. package/lib/table/module/validator/mixin.min.js +1 -1
  18. package/lib/table/src/body.js +16 -11
  19. package/lib/table/src/body.min.js +1 -1
  20. package/lib/table/src/cell.js +22 -13
  21. package/lib/table/src/cell.min.js +1 -1
  22. package/lib/table/src/methods.js +623 -559
  23. package/lib/table/src/methods.min.js +1 -1
  24. package/lib/table/src/table.js +51 -25
  25. package/lib/table/src/table.min.js +1 -1
  26. package/lib/table/src/util.js +2 -2
  27. package/lib/table/src/util.min.js +1 -1
  28. package/lib/ui/index.js +1 -1
  29. package/lib/ui/index.min.js +1 -1
  30. package/lib/ui/src/log.js +1 -1
  31. package/lib/ui/src/log.min.js +1 -1
  32. package/package.json +2 -2
  33. package/packages/table/module/edit/mixin.ts +17 -12
  34. package/packages/table/module/validator/mixin.ts +2 -2
  35. package/packages/table/src/body.ts +10 -10
  36. package/packages/table/src/cell.ts +15 -11
  37. package/packages/table/src/methods.ts +559 -481
  38. package/packages/table/src/table.ts +53 -31
  39. package/packages/table/src/util.ts +2 -2
  40. /package/es/{iconfont.1742353673989.ttf → iconfont.1742437924038.ttf} +0 -0
  41. /package/es/{iconfont.1742353673989.woff → iconfont.1742437924038.woff} +0 -0
  42. /package/es/{iconfont.1742353673989.woff2 → iconfont.1742437924038.woff2} +0 -0
  43. /package/lib/{iconfont.1742353673989.ttf → iconfont.1742437924038.ttf} +0 -0
  44. /package/lib/{iconfont.1742353673989.woff → iconfont.1742437924038.woff} +0 -0
  45. /package/lib/{iconfont.1742353673989.woff2 → iconfont.1742437924038.woff2} +0 -0
@@ -2,7 +2,7 @@ import { PropType, CreateElement } from 'vue'
2
2
  import XEUtils from 'xe-utils'
3
3
  import { VxeUI } from '../../ui'
4
4
  import { isEnableConf, getClass } from '../../ui/src/utils'
5
- import { getOffsetSize, calcTreeLine, mergeBodyMethod, getRowid } from './util'
5
+ import { getOffsetSize, calcTreeLine, mergeBodyMethod, getRowid, createHandleGetRowId } from './util'
6
6
  import { updateCellTitle } from '../../ui/src/dom'
7
7
  import { getSlotVNs } from '../../ui/src/vn'
8
8
 
@@ -22,7 +22,7 @@ const isVMScrollProcess = ($xeTable: VxeTableConstructor & VxeTablePrivateMethod
22
22
  return !!(isDragResize || (lastScrollTime && Date.now() < lastScrollTime + (delayHover as number)))
23
23
  }
24
24
 
25
- function renderLine (h: CreateElement, _vm: any, params: VxeTableDefines.CellRenderBodyParams, cellHeight: number) {
25
+ function renderLine (h: CreateElement, _vm: any, rowid: string, params: VxeTableDefines.CellRenderBodyParams, cellHeight: number) {
26
26
  const $xeTable = _vm.$parent as VxeTableConstructor & VxeTablePrivateMethods
27
27
  const tableProps = $xeTable
28
28
  const tableInternalData = $xeTable as unknown as TableInternalData
@@ -36,7 +36,6 @@ function renderLine (h: CreateElement, _vm: any, params: VxeTableDefines.CellRen
36
36
  if (slots && (slots as any).line) {
37
37
  return $xeTable.callSlot((slots as any).line, params, h)
38
38
  }
39
- const rowid = getRowid($xeTable, row)
40
39
  const rest = fullAllDataRowIdData[rowid]
41
40
  let rLevel = 0
42
41
  let prevRow = null
@@ -299,7 +298,7 @@ function renderTdColumn (
299
298
  } else {
300
299
  // 渲染单元格
301
300
  tdVNs.push(
302
- ...renderLine(h, _vm, cellParams, cellHeight),
301
+ ...renderLine(h, _vm, rowid, cellParams, cellHeight),
303
302
  h('div', {
304
303
  key: 'tc',
305
304
  class: ['vxe-cell', {
@@ -436,8 +435,8 @@ function renderRows (h: CreateElement, _vm: any, fixedType: 'left' | 'right' | '
436
435
  const tableInternalData = $xeTable as unknown as TableInternalData
437
436
 
438
437
  const { stripe, rowKey, highlightHoverRow, rowClassName, rowStyle, editConfig, treeConfig } = tableProps
439
- const { hasFixedColumn, treeExpandedMaps, isColLoading, scrollXLoad, scrollYLoad, isAllOverflow, rowExpandedMaps, expandColumn, selectRadioRow, pendingRowMaps, isDragColMove, rowExpandHeightFlag } = tableReactData
440
- const { fullAllDataRowIdData } = tableInternalData
438
+ const { hasFixedColumn, treeExpandedFlag, isColLoading, scrollXLoad, scrollYLoad, isAllOverflow, rowExpandedFlag, expandColumn, selectRadioRow, pendingRowFlag, isDragColMove, rowExpandHeightFlag } = tableReactData
439
+ const { fullAllDataRowIdData, treeExpandedMaps, pendingRowMaps, rowExpandedMaps } = tableInternalData
441
440
  const checkboxOpts = $xeTable.computeCheckboxOpts
442
441
  const radioOpts = $xeTable.computeRadioOpts
443
442
  const treeOpts = $xeTable.computeTreeOpts
@@ -448,6 +447,7 @@ function renderRows (h: CreateElement, _vm: any, fixedType: 'left' | 'right' | '
448
447
  const { transform, seqMode } = treeOpts
449
448
  const childrenField = treeOpts.children || treeOpts.childrenField
450
449
  const rows: any[] = []
450
+ const { handleGetRowId } = createHandleGetRowId($xeTable)
451
451
  tableData.forEach((row, $rowIndex) => {
452
452
  const trOn: Record<string, any> = {}
453
453
  let rowIndex = $rowIndex
@@ -468,7 +468,7 @@ function renderRows (h: CreateElement, _vm: any, fixedType: 'left' | 'right' | '
468
468
  $xeTable.clearHoverRow()
469
469
  }
470
470
  }
471
- const rowid = getRowid($xeTable, row)
471
+ const rowid = handleGetRowId(row)
472
472
  const rowRest = fullAllDataRowIdData[rowid]
473
473
  let rowLevel = 0
474
474
  let seq: string | number = -1
@@ -484,7 +484,7 @@ function renderRows (h: CreateElement, _vm: any, fixedType: 'left' | 'right' | '
484
484
  }
485
485
  const params = { $table: $xeTable, seq, rowid, fixed: fixedType, type: renderType, level: rowLevel, row, rowIndex, $rowIndex, _rowIndex }
486
486
  // 行是否被展开
487
- const isExpandRow = expandColumn && !!rowExpandedMaps[rowid]
487
+ const isExpandRow = expandColumn && !!rowExpandedFlag && !!rowExpandedMaps[rowid]
488
488
  // 树节点是否被展开
489
489
  let isExpandTree = false
490
490
  let rowChildren = []
@@ -495,7 +495,7 @@ function renderRows (h: CreateElement, _vm: any, fixedType: 'left' | 'right' | '
495
495
  }
496
496
  if (treeConfig && !scrollYLoad && !transform) {
497
497
  rowChildren = row[childrenField]
498
- isExpandTree = rowChildren && rowChildren.length && !!treeExpandedMaps[rowid]
498
+ isExpandTree = !!treeExpandedFlag && rowChildren && rowChildren.length > 0 && !!treeExpandedMaps[rowid]
499
499
  }
500
500
  // 拖拽行事件
501
501
  if (rowOpts.drag && (!treeConfig || transform)) {
@@ -514,7 +514,7 @@ function renderRows (h: CreateElement, _vm: any, fixedType: 'left' | 'right' | '
514
514
  'row--new': isNewRow && (editOpts.showStatus || editOpts.showInsertStatus),
515
515
  'row--radio': radioOpts.highlight && selectRadioRow === row,
516
516
  'row--checked': checkboxOpts.highlight && $xeTable.isCheckedByCheckboxRow(row),
517
- 'row--pending': !!pendingRowMaps[rowid]
517
+ 'row--pending': !!pendingRowFlag && !!pendingRowMaps[rowid]
518
518
  },
519
519
  rowClassName ? (XEUtils.isFunction(rowClassName) ? rowClassName(params) : rowClassName) : ''
520
520
  ]
@@ -402,8 +402,8 @@ export const Cell = {
402
402
  const { $table, isHidden } = params
403
403
  const tableReactData = $table as unknown as TableReactData
404
404
  const tableInternalData = $table as unknown as TableInternalData
405
- const { treeExpandedMaps, treeExpandLazyLoadedMaps } = tableReactData
406
- const { fullAllDataRowIdData } = tableInternalData
405
+ const { treeExpandedFlag } = tableReactData
406
+ const { fullAllDataRowIdData, treeExpandedMaps, treeExpandLazyLoadedMaps } = tableInternalData
407
407
  const treeOpts = $table.computeTreeOpts
408
408
  const { row, column, level } = params
409
409
  const { slots } = column
@@ -423,7 +423,7 @@ export const Cell = {
423
423
  }
424
424
  if (!isHidden) {
425
425
  const rowid = getRowid($table, row)
426
- isActive = !!treeExpandedMaps[rowid]
426
+ isActive = !!treeExpandedFlag && !!treeExpandedMaps[rowid]
427
427
  if (lazy) {
428
428
  const rest = fullAllDataRowIdData[rowid]
429
429
  isLazyLoading = !!treeExpandLazyLoadedMaps[rowid]
@@ -631,8 +631,10 @@ export const Cell = {
631
631
  const { $table, row, column, isHidden } = params
632
632
  const tableProps = $table
633
633
  const tableReactData = $table as unknown as TableReactData
634
+ const tableInternalData = $table as unknown as TableInternalData
634
635
  const { treeConfig } = tableProps
635
- const { selectCheckboxMaps, treeIndeterminateMaps } = tableReactData
636
+ const { updateCheckboxFlag } = tableReactData
637
+ const { selectCheckboxMaps, treeIndeterminateRowMaps } = tableInternalData
636
638
  const checkboxOpts = $table.computeCheckboxOpts
637
639
  const { labelField, checkMethod, visibleMethod } = checkboxOpts
638
640
  const { slots } = column
@@ -645,7 +647,7 @@ export const Cell = {
645
647
  const ons: Record<string, any> = {}
646
648
  if (!isHidden) {
647
649
  const rowid = getRowid($table, row)
648
- isChecked = !!selectCheckboxMaps[rowid]
650
+ isChecked = !!updateCheckboxFlag && !!selectCheckboxMaps[rowid]
649
651
  ons.click = (evnt: any) => {
650
652
  if (!isDisabled && isVisible) {
651
653
  $table.triggerCheckRowEvent(evnt, params, !isChecked)
@@ -655,7 +657,7 @@ export const Cell = {
655
657
  isDisabled = !checkMethod({ row })
656
658
  }
657
659
  if (treeConfig) {
658
- indeterminate = !!treeIndeterminateMaps[rowid]
660
+ indeterminate = !!treeIndeterminateRowMaps[rowid]
659
661
  }
660
662
  }
661
663
  const checkboxParams = { ...params, checked: isChecked, disabled: isDisabled, visible: isVisible, indeterminate }
@@ -696,8 +698,10 @@ export const Cell = {
696
698
  const { $table, row, column, isHidden } = params
697
699
  const tableProps = $table
698
700
  const tableReactData = $table as unknown as TableReactData
701
+ const tableInternalData = $table as unknown as TableInternalData
699
702
  const { treeConfig } = tableProps
700
- const { treeIndeterminateMaps } = tableReactData
703
+ const { updateCheckboxFlag } = tableReactData
704
+ const { treeIndeterminateRowMaps } = tableInternalData
701
705
  const checkboxOpts = $table.computeCheckboxOpts
702
706
  const { labelField, checkField, checkMethod, visibleMethod } = checkboxOpts
703
707
  const indeterminateField = checkboxOpts.indeterminateField || checkboxOpts.halfField
@@ -711,7 +715,7 @@ export const Cell = {
711
715
  const ons: Record<string, any> = {}
712
716
  if (!isHidden) {
713
717
  const rowid = getRowid($table, row)
714
- isChecked = XEUtils.get(row, checkField)
718
+ isChecked = !!updateCheckboxFlag && XEUtils.get(row, checkField)
715
719
  ons.click = (evnt: any) => {
716
720
  if (!isDisabled && isVisible) {
717
721
  $table.triggerCheckRowEvent(evnt, params, !isChecked)
@@ -721,7 +725,7 @@ export const Cell = {
721
725
  isDisabled = !checkMethod({ row })
722
726
  }
723
727
  if (treeConfig) {
724
- isIndeterminate = !!treeIndeterminateMaps[rowid]
728
+ isIndeterminate = !!treeIndeterminateRowMaps[rowid]
725
729
  }
726
730
  }
727
731
  const checkboxParams = { ...params, checked: isChecked, disabled: isDisabled, visible: isVisible, indeterminate: isIndeterminate }
@@ -764,8 +768,8 @@ export const Cell = {
764
768
  */
765
769
  renderExpandCell (h: CreateElement, params: VxeTableDefines.CellRenderBodyParams & { $table: VxeTableConstructor & VxeTablePrivateMethods }) {
766
770
  const { $table, isHidden, row, column } = params
767
- const tableReactData = $table as unknown as TableReactData
768
- const { rowExpandedMaps, rowExpandLazyLoadedMaps } = tableReactData
771
+ const tableInternalData = $table as unknown as TableInternalData
772
+ const { rowExpandedMaps, rowExpandLazyLoadedMaps } = tableInternalData
769
773
  const expandOpts = $table.computeExpandOpts
770
774
  const { lazy, labelField, iconLoaded, showIcon, iconOpen, iconClose, visibleMethod } = expandOpts
771
775
  const { slots } = column