vxe-table 4.13.22 → 4.13.24

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 (46) 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/src/cell.js +25 -11
  6. package/es/table/src/util.js +16 -21
  7. package/es/table/style.css +15 -6
  8. package/es/table/style.min.css +1 -1
  9. package/es/ui/index.js +1 -1
  10. package/es/ui/src/dom.js +6 -0
  11. package/es/ui/src/log.js +1 -1
  12. package/es/vxe-table/style.css +15 -6
  13. package/es/vxe-table/style.min.css +1 -1
  14. package/helper/vetur/attributes.json +1 -1
  15. package/helper/vetur/tags.json +1 -1
  16. package/lib/index.css +1 -1
  17. package/lib/index.min.css +1 -1
  18. package/lib/index.umd.js +41 -32
  19. package/lib/index.umd.min.js +1 -1
  20. package/lib/style.css +1 -1
  21. package/lib/style.min.css +1 -1
  22. package/lib/table/src/cell.js +16 -10
  23. package/lib/table/src/cell.min.js +1 -1
  24. package/lib/table/src/util.js +17 -20
  25. package/lib/table/src/util.min.js +1 -1
  26. package/lib/table/style/style.css +15 -6
  27. package/lib/table/style/style.min.css +1 -1
  28. package/lib/ui/index.js +1 -1
  29. package/lib/ui/index.min.js +1 -1
  30. package/lib/ui/src/dom.js +7 -0
  31. package/lib/ui/src/dom.min.js +1 -1
  32. package/lib/ui/src/log.js +1 -1
  33. package/lib/ui/src/log.min.js +1 -1
  34. package/lib/vxe-table/style/style.css +15 -6
  35. package/lib/vxe-table/style/style.min.css +1 -1
  36. package/package.json +1 -1
  37. package/packages/table/src/cell.ts +25 -11
  38. package/packages/table/src/util.ts +16 -22
  39. package/packages/ui/src/dom.ts +7 -0
  40. package/styles/components/table.scss +23 -15
  41. /package/es/{iconfont.1746836522499.ttf → iconfont.1747008151774.ttf} +0 -0
  42. /package/es/{iconfont.1746836522499.woff → iconfont.1747008151774.woff} +0 -0
  43. /package/es/{iconfont.1746836522499.woff2 → iconfont.1747008151774.woff2} +0 -0
  44. /package/lib/{iconfont.1746836522499.ttf → iconfont.1747008151774.ttf} +0 -0
  45. /package/lib/{iconfont.1746836522499.woff → iconfont.1747008151774.woff} +0 -0
  46. /package/lib/{iconfont.1746836522499.woff2 → iconfont.1747008151774.woff2} +0 -0
@@ -1,7 +1,7 @@
1
1
  import { watch, reactive, nextTick } from 'vue'
2
2
  import XEUtils from 'xe-utils'
3
3
  import { ColumnInfo } from './columnInfo'
4
- import { isPx, isScale } from '../../ui/src/dom'
4
+ import { isPx, isScale, queryElement } from '../../ui/src/dom'
5
5
  import { eqEmptyValue } from '../../ui/src/utils'
6
6
 
7
7
  import type { VxeTableConstructor, VxeTablePrivateMethods, VxeTableDefines } from '../../../types'
@@ -191,7 +191,7 @@ function getPaddingLeftRightSize (elem: HTMLElement | null) {
191
191
  return 0
192
192
  }
193
193
 
194
- function getElementMarginWidth (elem: HTMLElement | null) {
194
+ function getElementMarginAndWidth (elem: HTMLElement | null) {
195
195
  if (elem) {
196
196
  const computedStyle = getComputedStyle(elem)
197
197
  const marginLeft = XEUtils.toNumber(computedStyle.marginLeft)
@@ -201,10 +201,6 @@ function getElementMarginWidth (elem: HTMLElement | null) {
201
201
  return 0
202
202
  }
203
203
 
204
- function queryCellElement (cell: HTMLTableCellElement, selector: string) {
205
- return cell.querySelector('.vxe-cell' + selector) as HTMLElement | null
206
- }
207
-
208
204
  export function toFilters (filters: any) {
209
205
  if (filters && XEUtils.isArray(filters)) {
210
206
  return filters.map(({ label, value, data, resetValue, checked }) => {
@@ -304,19 +300,19 @@ export function getColReMinWidth (params: {
304
300
  const showTitle = headOverflow === 'title'
305
301
  const showTooltip = headOverflow === true || headOverflow === 'tooltip'
306
302
  const hasEllipsis = showTitle || showTooltip || showEllipsis
307
- const minTitleWidth = XEUtils.floor((XEUtils.toNumber(getComputedStyle(cell).fontSize) || 14) * 1.6)
308
- const paddingLeftRight = getPaddingLeftRightSize(cell) + getPaddingLeftRightSize(queryCellElement(cell, ''))
303
+ const minTitleWidth = XEUtils.floor((XEUtils.toNumber(getComputedStyle(cell).fontSize) || 14) * 1.8)
304
+ const paddingLeftRight = getPaddingLeftRightSize(cell) + getPaddingLeftRightSize(queryElement(cell, '.vxe-cell'))
309
305
  let mWidth = minTitleWidth + paddingLeftRight
310
306
  // 默认最小宽处理
311
307
  if (hasEllipsis) {
312
- const dragIconWidth = getPaddingLeftRightSize(queryCellElement(cell, '>.vxe-cell--drag-handle'))
313
- const checkboxIconWidth = getPaddingLeftRightSize(queryCellElement(cell, '>.vxe-cell--checkbox'))
314
- const requiredIconWidth = getElementMarginWidth(queryCellElement(cell, '>.vxe-cell--required-icon'))
315
- const editIconWidth = getElementMarginWidth(queryCellElement(cell, '>.vxe-cell--edit-icon'))
316
- const prefixIconWidth = getElementMarginWidth(queryCellElement(cell, '>.vxe-cell-title-prefix-icon'))
317
- const suffixIconWidth = getElementMarginWidth(queryCellElement(cell, '>.vxe-cell-title-suffix-icon'))
318
- const sortIconWidth = getElementMarginWidth(queryCellElement(cell, '>.vxe-cell--sort'))
319
- const filterIconWidth = getElementMarginWidth(queryCellElement(cell, '>.vxe-cell--filter'))
308
+ const dragIconWidth = getElementMarginAndWidth(queryElement(cell, '.vxe-cell--drag-handle'))
309
+ const checkboxIconWidth = getElementMarginAndWidth(queryElement(cell, '.vxe-cell--checkbox'))
310
+ const requiredIconWidth = getElementMarginAndWidth(queryElement(cell, '.vxe-cell--required-icon'))
311
+ const editIconWidth = getElementMarginAndWidth(queryElement(cell, '.vxe-cell--edit-icon'))
312
+ const prefixIconWidth = getElementMarginAndWidth(queryElement(cell, '.vxe-cell-title-prefix-icon'))
313
+ const suffixIconWidth = getElementMarginAndWidth(queryElement(cell, '.vxe-cell-title-suffix-icon'))
314
+ const sortIconWidth = getElementMarginAndWidth(queryElement(cell, '.vxe-cell--sort'))
315
+ const filterIconWidth = getElementMarginAndWidth(queryElement(cell, '.vxe-cell--filter'))
320
316
  mWidth += dragIconWidth + checkboxIconWidth + requiredIconWidth + editIconWidth + prefixIconWidth + suffixIconWidth + filterIconWidth + sortIconWidth
321
317
  }
322
318
  // 如果设置最小宽
@@ -505,7 +501,7 @@ export function rowToVisible ($xeTable: VxeTableConstructor & VxeTablePrivateMet
505
501
 
506
502
  const { computeLeftFixedWidth, computeRightFixedWidth, computeRowOpts, computeCellOpts, computeDefaultRowHeight } = $xeTable.getComputeMaps()
507
503
  const { showOverflow } = tableProps
508
- const { scrollYLoad } = reactData
504
+ const { scrollYLoad, scrollYTop } = reactData
509
505
  const { elemStore, afterFullData, fullAllDataRowIdData, isResizeCellHeight } = internalData
510
506
  const rowOpts = computeRowOpts.value
511
507
  const cellOpts = computeCellOpts.value
@@ -519,8 +515,7 @@ export function rowToVisible ($xeTable: VxeTableConstructor & VxeTablePrivateMet
519
515
  const bodyScrollTop = bodyScrollElem.scrollTop
520
516
  const trElem: HTMLTableRowElement | null = bodyScrollElem.querySelector(`[rowid="${rowid}"]`)
521
517
  if (trElem) {
522
- const trOffsetParent = trElem.offsetParent as HTMLElement
523
- const trOffsetTop = trElem.offsetTop + (trOffsetParent ? trOffsetParent.offsetTop : 0)
518
+ const trOffsetTop = trElem.offsetTop + (scrollYLoad ? scrollYTop : 0)
524
519
  const trHeight = trElem.clientHeight
525
520
  // 检测行是否在可视区中
526
521
  if (trOffsetTop < bodyScrollTop || trOffsetTop > bodyScrollTop + bodyHeight) {
@@ -562,7 +557,7 @@ export function colToVisible ($xeTable: VxeTableConstructor & VxeTablePrivateMet
562
557
  const internalData = $xeTable.internalData
563
558
 
564
559
  const { computeLeftFixedWidth, computeRightFixedWidth } = $xeTable.getComputeMaps()
565
- const { scrollXLoad } = reactData
560
+ const { scrollXLoad, scrollXLeft } = reactData
566
561
  const { elemStore, visibleColumn } = internalData
567
562
  const leftFixedWidth = computeLeftFixedWidth.value
568
563
  const rightFixedWidth = computeRightFixedWidth.value
@@ -582,8 +577,7 @@ export function colToVisible ($xeTable: VxeTableConstructor & VxeTablePrivateMet
582
577
  tdElem = bodyScrollElem.querySelector(`.${column.id}`)
583
578
  }
584
579
  if (tdElem) {
585
- const tdOffsetParent = tdElem.offsetParent as HTMLElement
586
- const tdOffsetLeft = tdElem.offsetLeft + (tdOffsetParent ? tdOffsetParent.offsetLeft : 0)
580
+ const tdOffsetLeft = tdElem.offsetLeft + (scrollXLoad ? scrollXLeft : 0)
587
581
  const cellWidth = tdElem.clientWidth
588
582
  // 检测是否在可视区中
589
583
  if (tdOffsetLeft < (bodyScrollLeft + leftFixedWidth)) {
@@ -82,6 +82,13 @@ export function toCssUnit (val?: number | string, unit = 'px') {
82
82
  return `${val || ''}`
83
83
  }
84
84
 
85
+ export function queryElement (elem: HTMLTableCellElement, selector: string) {
86
+ if (elem) {
87
+ return elem.querySelector<HTMLElement>(selector)
88
+ }
89
+ return null
90
+ }
91
+
85
92
  export function getDomNode () {
86
93
  const documentElement = document.documentElement
87
94
  const bodyElem = document.body
@@ -776,19 +776,25 @@ $btnThemeList: (
776
776
  // user-select: none;
777
777
  &.col--ellipsis {
778
778
  & > .vxe-cell {
779
- display: flex;
780
- align-items: center;
779
+ .vxe-cell--wrapper {
780
+ display: flex;
781
+ align-items: center;
782
+ .vxe-cell--drag-handle,
783
+ .vxe-cell--sort,
784
+ .vxe-cell--filter,
785
+ .vxe-cell-title-prefix-icon,
786
+ .vxe-cell-title-suffix-icon,
787
+ .vxe-cell--checkbox,
788
+ .vxe-cell-title-suffix-icon,
789
+ .vxe-cell--required-icon {
790
+ flex-shrink: 0;
791
+ }
792
+ }
781
793
  .vxe-cell--title {
782
794
  overflow: hidden;
783
795
  text-overflow: ellipsis;
784
796
  white-space: nowrap;
785
797
  }
786
- & > i,
787
- & > span {
788
- &:not(.vxe-cell--title) {
789
- flex-shrink: 0;
790
- }
791
- }
792
798
  }
793
799
  }
794
800
  .vxe-cell--required-icon {
@@ -797,14 +803,16 @@ $btnThemeList: (
797
803
  width: 0.8em;
798
804
  height: 1em;
799
805
  line-height: 1em;
800
- font-family: Verdana,Arial,Tahoma;
801
- font-weight: normal;
802
806
  position: relative;
803
- &:before {
804
- content: "*";
805
- position: absolute;
806
- left: 0;
807
- top: 0.2em;
807
+ & > i {
808
+ font-family: Verdana,Arial,Tahoma;
809
+ font-weight: normal;
810
+ &:before {
811
+ content: "*";
812
+ position: absolute;
813
+ left: 0;
814
+ top: 0.2em;
815
+ }
808
816
  }
809
817
  }
810
818
  // .vxe-cell--required-icon,