vxe-table 4.10.6-beta.2 → 4.10.6-beta.4

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 (48) 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/body.js +2 -1
  6. package/es/table/src/footer.js +2 -1
  7. package/es/table/src/header.js +29 -19
  8. package/es/table/src/table.js +11 -5
  9. package/es/table/style.css +7 -4
  10. package/es/table/style.min.css +1 -1
  11. package/es/ui/index.js +1 -1
  12. package/es/ui/src/log.js +1 -1
  13. package/es/vxe-table/style.css +7 -4
  14. package/es/vxe-table/style.min.css +1 -1
  15. package/lib/index.css +1 -1
  16. package/lib/index.min.css +1 -1
  17. package/lib/index.umd.js +44 -26
  18. package/lib/index.umd.min.js +1 -1
  19. package/lib/style.css +1 -1
  20. package/lib/style.min.css +1 -1
  21. package/lib/table/src/body.js +2 -1
  22. package/lib/table/src/body.min.js +1 -1
  23. package/lib/table/src/footer.js +2 -1
  24. package/lib/table/src/footer.min.js +1 -1
  25. package/lib/table/src/header.js +27 -17
  26. package/lib/table/src/header.min.js +1 -1
  27. package/lib/table/src/table.js +11 -5
  28. package/lib/table/src/table.min.js +1 -1
  29. package/lib/table/style/style.css +7 -4
  30. package/lib/table/style/style.min.css +1 -1
  31. package/lib/ui/index.js +1 -1
  32. package/lib/ui/index.min.js +1 -1
  33. package/lib/ui/src/log.js +1 -1
  34. package/lib/ui/src/log.min.js +1 -1
  35. package/lib/vxe-table/style/style.css +7 -4
  36. package/lib/vxe-table/style/style.min.css +1 -1
  37. package/package.json +1 -1
  38. package/packages/table/src/body.ts +2 -1
  39. package/packages/table/src/footer.ts +2 -1
  40. package/packages/table/src/header.ts +29 -19
  41. package/packages/table/src/table.ts +11 -5
  42. package/styles/components/table.scss +7 -5
  43. /package/es/{iconfont.1736736829304.ttf → iconfont.1736759340059.ttf} +0 -0
  44. /package/es/{iconfont.1736736829304.woff → iconfont.1736759340059.woff} +0 -0
  45. /package/es/{iconfont.1736736829304.woff2 → iconfont.1736759340059.woff2} +0 -0
  46. /package/lib/{iconfont.1736736829304.ttf → iconfont.1736759340059.ttf} +0 -0
  47. /package/lib/{iconfont.1736736829304.woff → iconfont.1736759340059.woff} +0 -0
  48. /package/lib/{iconfont.1736736829304.woff2 → iconfont.1736759340059.woff2} +0 -0
@@ -1,7 +1,7 @@
1
1
  import { defineComponent, TransitionGroup, h, ref, Ref, PropType, inject, nextTick, watch, onMounted, onUnmounted } from 'vue'
2
2
  import XEUtils from 'xe-utils'
3
3
  import { VxeUI } from '../../ui'
4
- import { convertHeaderColumnToRows, getColReMinWidth } from './util'
4
+ import { convertHeaderColumnToRows, getColReMinWidth, getRefElem } from './util'
5
5
  import { hasClass, getOffsetPos, addClass, removeClass } from '../../ui/src/dom'
6
6
 
7
7
  import type { VxeTablePrivateMethods, VxeTableConstructor, VxeTableMethods, VxeTableDefines, VxeColumnPropTypes } from '../../../types'
@@ -26,7 +26,7 @@ export default defineComponent({
26
26
  const $xeTable = inject('$xeTable', {} as VxeTableConstructor & VxeTableMethods & VxeTablePrivateMethods)
27
27
 
28
28
  const { xID, props: tableProps, reactData: tableReactData, internalData: tableInternalData } = $xeTable
29
- const { refElem: tableRefElem, refTableBody, refLeftContainer, refRightContainer, refCellResizeBar, refCellResizeTip } = $xeTable.getRefMaps()
29
+ const { refElem: tableRefElem, refLeftContainer, refRightContainer, refCellResizeBar, refCellResizeTip } = $xeTable.getRefMaps()
30
30
  const { computeColumnOpts, computeColumnDragOpts, computeResizableOpts } = $xeTable.getComputeMaps()
31
31
 
32
32
  const headerColumn = ref([] as VxeTableDefines.ColumnInfo[][])
@@ -47,9 +47,8 @@ export default defineComponent({
47
47
  const resizeMousedownEvent = (evnt: MouseEvent, params: VxeTableDefines.CellRenderHeaderParams & { $table: VxeTableConstructor & VxeTablePrivateMethods }) => {
48
48
  const { column } = params
49
49
  const { fixedType } = props
50
- const { visibleColumn } = tableInternalData
50
+ const { elemStore, visibleColumn } = tableInternalData
51
51
  const resizableOpts = computeResizableOpts.value
52
- const tableBody = refTableBody.value
53
52
  const tableEl = tableRefElem.value
54
53
  const leftContainerElem = refLeftContainer.value
55
54
  const rightContainerElem = refRightContainer.value
@@ -58,10 +57,19 @@ export default defineComponent({
58
57
  const { clientX: dragClientX } = evnt
59
58
  const wrapperElem = refElem.value
60
59
  const dragBtnElem = evnt.target as HTMLDivElement
60
+ let resizeColumn = column
61
+ if (column.children && column.children.length) {
62
+ XEUtils.eachTree(column.children, childColumn => {
63
+ resizeColumn = childColumn
64
+ })
65
+ }
61
66
  const cell = dragBtnElem.parentNode as HTMLTableCellElement
62
67
  const cellParams = Object.assign(params, { cell })
63
68
  let dragLeft = 0
64
- const tableBodyElem = tableBody.$el as HTMLDivElement
69
+ const bodyScrollElem = getRefElem(elemStore['main-body-scroll'])
70
+ if (!bodyScrollElem) {
71
+ return
72
+ }
65
73
  const pos = getOffsetPos(dragBtnElem, wrapperElem)
66
74
  const dragBtnWidth = dragBtnElem.clientWidth
67
75
  const dragBtnOffsetWidth = Math.floor(dragBtnWidth / 2)
@@ -92,25 +100,25 @@ export default defineComponent({
92
100
  }
93
101
 
94
102
  // 处理拖动事件
95
- const updateEvent = function (evnt: MouseEvent) {
103
+ const updateEvent = (evnt: MouseEvent) => {
96
104
  evnt.stopPropagation()
97
105
  evnt.preventDefault()
98
106
  const offsetX = evnt.clientX - dragClientX
99
107
  let left = dragPosLeft + offsetX
100
- const scrollLeft = fixedType ? 0 : tableBodyElem.scrollLeft
108
+ const scrollLeft = fixedType ? 0 : bodyScrollElem.scrollLeft
101
109
  if (isLeftFixed) {
102
110
  // 左固定列(不允许超过右侧固定列、不允许超过右边距)
103
- left = Math.min(left, (rightContainerElem ? rightContainerElem.offsetLeft : tableBodyElem.clientWidth) - fixedOffsetWidth - minInterval)
111
+ left = Math.min(left, (rightContainerElem ? rightContainerElem.offsetLeft : bodyScrollElem.clientWidth) - fixedOffsetWidth - minInterval)
104
112
  } else if (isRightFixed) {
105
113
  // 右侧固定列(不允许超过左侧固定列、不允许超过左边距)
106
114
  dragMinLeft = (leftContainerElem ? leftContainerElem.clientWidth : 0) + fixedOffsetWidth + minInterval
107
115
  left = Math.min(left, dragPosLeft + cell.clientWidth - minInterval)
108
116
  } else {
109
- dragMinLeft = Math.max(tableBodyElem.scrollLeft, dragMinLeft)
110
- // left = Math.min(left, tableBodyElem.clientWidth + tableBodyElem.scrollLeft - 40)
117
+ dragMinLeft = Math.max(bodyScrollElem.scrollLeft, dragMinLeft)
118
+ // left = Math.min(left, bodyScrollElem.clientWidth + bodyScrollElem.scrollLeft - 40)
111
119
  }
112
120
  dragLeft = Math.max(left, dragMinLeft)
113
- const resizeBarLeft = dragLeft - scrollLeft
121
+ const resizeBarLeft = Math.max(1, dragLeft - scrollLeft)
114
122
  resizeBarElem.style.left = `${resizeBarLeft}px`
115
123
  if (resizableOpts.showDragTip && resizeTipElem) {
116
124
  const tableWidth = tableEl.clientWidth
@@ -120,13 +128,13 @@ export default defineComponent({
120
128
  const resizeTipHeight = resizeTipElem.clientHeight
121
129
  let resizeTipLeft = -resizeTipWidth
122
130
  if (resizeBarLeft < resizeTipWidth + resizeBarWidth) {
123
- resizeTipLeft = resizeTipWidth + resizeBarWidth - resizeBarLeft
131
+ resizeTipLeft = 0
124
132
  } else if (resizeBarLeft > tableWidth) {
125
133
  resizeTipLeft += tableWidth - resizeBarLeft
126
134
  }
127
135
  resizeTipElem.style.left = `${resizeTipLeft}px`
128
136
  resizeTipElem.style.top = `${Math.min(tableEl.clientHeight - resizeTipHeight, Math.max(0, evnt.clientY - wrapperRect.y - resizeTipHeight / 2))}px`
129
- resizeTipElem.textContent = getI18n('vxe.table.resizeColTip', [column.renderWidth + (isRightFixed ? dragPosLeft - dragLeft : dragLeft - dragPosLeft)])
137
+ resizeTipElem.textContent = getI18n('vxe.table.resizeColTip', [resizeColumn.renderWidth + (isRightFixed ? dragPosLeft - dragLeft : dragLeft - dragPosLeft)])
130
138
  }
131
139
  }
132
140
 
@@ -137,11 +145,11 @@ export default defineComponent({
137
145
  document.onmouseup = function (evnt) {
138
146
  document.onmousemove = domMousemove
139
147
  document.onmouseup = domMouseup
140
- const resizeWidth = column.renderWidth + (isRightFixed ? dragPosLeft - dragLeft : dragLeft - dragPosLeft)
141
- column.resizeWidth = resizeWidth
148
+ const resizeWidth = resizeColumn.renderWidth + (isRightFixed ? dragPosLeft - dragLeft : dragLeft - dragPosLeft)
149
+ resizeColumn.resizeWidth = resizeWidth
142
150
  if (resizableOpts.dragMode === 'fixed') {
143
151
  visibleColumn.forEach(item => {
144
- if (item.id !== column.id) {
152
+ if (item.id !== resizeColumn.id) {
145
153
  if (!item.resizeWidth) {
146
154
  item.resizeWidth = item.renderWidth
147
155
  }
@@ -229,6 +237,8 @@ export default defineComponent({
229
237
  thOns.onMouseup = $xeTable.handleHeaderCellDragMouseupEvent
230
238
  }
231
239
  }
240
+ const isLastColumn = $columnIndex === cols.length - 1
241
+ const showResizable = (XEUtils.isBoolean(column.resizable) ? column.resizable : (columnOpts.resizable || allResizable))
232
242
  const isAutoCellWidth = !column.resizeWidth && (column.minWidth === 'auto' || column.width === 'auto')
233
243
 
234
244
  let isPreLoadStatus = false
@@ -240,7 +250,7 @@ export default defineComponent({
240
250
  class: ['vxe-header--column', colid, {
241
251
  [`col--${headAlign}`]: headAlign,
242
252
  [`col--${type}`]: type,
243
- 'col--last': $columnIndex === cols.length - 1,
253
+ 'col--last': isLastColumn,
244
254
  'col--fixed': column.fixed,
245
255
  'col--group': isColGroup,
246
256
  'col--ellipsis': hasEllipsis,
@@ -271,7 +281,7 @@ export default defineComponent({
271
281
  /**
272
282
  * 列宽拖动
273
283
  */
274
- !fixedHiddenColumn && !isColGroup && (XEUtils.isBoolean(column.resizable) ? column.resizable : (columnOpts.resizable || allResizable))
284
+ !fixedHiddenColumn && showResizable
275
285
  ? h('div', {
276
286
  class: ['vxe-resizable', {
277
287
  'is--line': !border || border === 'none'
@@ -279,7 +289,7 @@ export default defineComponent({
279
289
  onMousedown: (evnt: MouseEvent) => resizeMousedownEvent(evnt, params),
280
290
  onDblclick: (evnt: MouseEvent) => $xeTable.handleResizeDblclickEvent(evnt, params)
281
291
  })
282
- : null
292
+ : renderEmptyElement($xeTable)
283
293
  ])
284
294
  })
285
295
  }
@@ -1192,7 +1192,7 @@ export default defineComponent({
1192
1192
  }
1193
1193
  fullColumnFieldData[field] = rest
1194
1194
  } else {
1195
- if (storage || (columnOpts.drag && (isCrossDrag || isSelfToChildDrag))) {
1195
+ if ((storage && !type) || (columnOpts.drag && (isCrossDrag || isSelfToChildDrag))) {
1196
1196
  errLog('vxe.error.reqProp', [`${column.getTitle() || type || ''} -> column.field`])
1197
1197
  }
1198
1198
  }
@@ -6616,17 +6616,23 @@ export default defineComponent({
6616
6616
  if (isDblclickAutoWidth && el) {
6617
6617
  const { fullColumnIdData } = internalData
6618
6618
  const { column } = params
6619
- const colid = column.id
6619
+ let resizeColumn = column
6620
+ if (column.children && column.children.length) {
6621
+ XEUtils.eachTree(column.children, childColumn => {
6622
+ resizeColumn = childColumn
6623
+ })
6624
+ }
6625
+ const colid = resizeColumn.id
6620
6626
  const colRest = fullColumnIdData[colid]
6621
6627
  const dragBtnElem = evnt.target as HTMLDivElement
6622
6628
  const cell = dragBtnElem.parentNode as HTMLTableCellElement
6623
6629
  const cellParams = Object.assign(params, { cell })
6624
6630
  const colMinWidth = getColReMinWidth(cellParams)
6625
- let resizeWidth = calcColumnAutoWidth(column, el)
6631
+ let resizeWidth = calcColumnAutoWidth(resizeColumn, el)
6626
6632
  if (colRest) {
6627
6633
  resizeWidth = Math.max(resizeWidth, colRest.width)
6628
6634
  }
6629
- column.resizeWidth = Math.max(colMinWidth, resizeWidth)
6635
+ resizeColumn.resizeWidth = Math.max(colMinWidth, resizeWidth)
6630
6636
  reactData._isResize = false
6631
6637
  internalData._lastResizeTime = Date.now()
6632
6638
  $xeTable.analyColumnWidth()
@@ -6860,7 +6866,7 @@ export default defineComponent({
6860
6866
  vLen++
6861
6867
  })
6862
6868
 
6863
- const isSelected = rootList.length > 0 && sLen >= vLen
6869
+ const isSelected = vLen > 0 ? sLen >= vLen : sLen >= rootList.length
6864
6870
  const halfSelect = !isSelected && (sLen >= 1 || hLen >= 1)
6865
6871
 
6866
6872
  reactData.isAllSelected = isSelected
@@ -51,19 +51,21 @@
51
51
  scrollbar-width: none;
52
52
  }
53
53
  .vxe-table--header-inner-wrapper,
54
+ .vxe-table--body-inner-wrapper,
54
55
  .vxe-table--footer-inner-wrapper {
56
+ position: relative;
55
57
  width: 100%;
56
- height: 100% ;
58
+ height: 100%;
59
+ scrollbar-width: none;
60
+ }
61
+ .vxe-table--header-inner-wrapper,
62
+ .vxe-table--footer-inner-wrapper {
57
63
  overflow-y: hidden;
58
64
  overflow-x: scroll;
59
- scrollbar-width: none;
60
65
  }
61
66
  .vxe-table--body-inner-wrapper {
62
- width: 100% ;
63
- height: 100% ;
64
67
  overflow-y: scroll;
65
68
  overflow-x: scroll;
66
- scrollbar-width: none;
67
69
  }
68
70
 
69
71
  .vxe-loading--custom-wrapper {