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, 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
  const { getI18n, renderer, renderEmptyElement } = VxeUI;
7
7
  const renderType = 'header';
@@ -20,7 +20,7 @@ export default defineComponent({
20
20
  setup(props) {
21
21
  const $xeTable = inject('$xeTable', {});
22
22
  const { xID, props: tableProps, reactData: tableReactData, internalData: tableInternalData } = $xeTable;
23
- const { refElem: tableRefElem, refTableBody, refLeftContainer, refRightContainer, refCellResizeBar, refCellResizeTip } = $xeTable.getRefMaps();
23
+ const { refElem: tableRefElem, refLeftContainer, refRightContainer, refCellResizeBar, refCellResizeTip } = $xeTable.getRefMaps();
24
24
  const { computeColumnOpts, computeColumnDragOpts, computeResizableOpts } = $xeTable.getComputeMaps();
25
25
  const headerColumn = ref([]);
26
26
  const refElem = ref();
@@ -37,9 +37,8 @@ export default defineComponent({
37
37
  const resizeMousedownEvent = (evnt, params) => {
38
38
  const { column } = params;
39
39
  const { fixedType } = props;
40
- const { visibleColumn } = tableInternalData;
40
+ const { elemStore, visibleColumn } = tableInternalData;
41
41
  const resizableOpts = computeResizableOpts.value;
42
- const tableBody = refTableBody.value;
43
42
  const tableEl = tableRefElem.value;
44
43
  const leftContainerElem = refLeftContainer.value;
45
44
  const rightContainerElem = refRightContainer.value;
@@ -48,10 +47,19 @@ export default defineComponent({
48
47
  const { clientX: dragClientX } = evnt;
49
48
  const wrapperElem = refElem.value;
50
49
  const dragBtnElem = evnt.target;
50
+ let resizeColumn = column;
51
+ if (column.children && column.children.length) {
52
+ XEUtils.eachTree(column.children, childColumn => {
53
+ resizeColumn = childColumn;
54
+ });
55
+ }
51
56
  const cell = dragBtnElem.parentNode;
52
57
  const cellParams = Object.assign(params, { cell });
53
58
  let dragLeft = 0;
54
- const tableBodyElem = tableBody.$el;
59
+ const bodyScrollElem = getRefElem(elemStore['main-body-scroll']);
60
+ if (!bodyScrollElem) {
61
+ return;
62
+ }
55
63
  const pos = getOffsetPos(dragBtnElem, wrapperElem);
56
64
  const dragBtnWidth = dragBtnElem.clientWidth;
57
65
  const dragBtnOffsetWidth = Math.floor(dragBtnWidth / 2);
@@ -81,15 +89,15 @@ export default defineComponent({
81
89
  }
82
90
  }
83
91
  // 处理拖动事件
84
- const updateEvent = function (evnt) {
92
+ const updateEvent = (evnt) => {
85
93
  evnt.stopPropagation();
86
94
  evnt.preventDefault();
87
95
  const offsetX = evnt.clientX - dragClientX;
88
96
  let left = dragPosLeft + offsetX;
89
- const scrollLeft = fixedType ? 0 : tableBodyElem.scrollLeft;
97
+ const scrollLeft = fixedType ? 0 : bodyScrollElem.scrollLeft;
90
98
  if (isLeftFixed) {
91
99
  // 左固定列(不允许超过右侧固定列、不允许超过右边距)
92
- left = Math.min(left, (rightContainerElem ? rightContainerElem.offsetLeft : tableBodyElem.clientWidth) - fixedOffsetWidth - minInterval);
100
+ left = Math.min(left, (rightContainerElem ? rightContainerElem.offsetLeft : bodyScrollElem.clientWidth) - fixedOffsetWidth - minInterval);
93
101
  }
94
102
  else if (isRightFixed) {
95
103
  // 右侧固定列(不允许超过左侧固定列、不允许超过左边距)
@@ -97,11 +105,11 @@ export default defineComponent({
97
105
  left = Math.min(left, dragPosLeft + cell.clientWidth - minInterval);
98
106
  }
99
107
  else {
100
- dragMinLeft = Math.max(tableBodyElem.scrollLeft, dragMinLeft);
101
- // left = Math.min(left, tableBodyElem.clientWidth + tableBodyElem.scrollLeft - 40)
108
+ dragMinLeft = Math.max(bodyScrollElem.scrollLeft, dragMinLeft);
109
+ // left = Math.min(left, bodyScrollElem.clientWidth + bodyScrollElem.scrollLeft - 40)
102
110
  }
103
111
  dragLeft = Math.max(left, dragMinLeft);
104
- const resizeBarLeft = dragLeft - scrollLeft;
112
+ const resizeBarLeft = Math.max(1, dragLeft - scrollLeft);
105
113
  resizeBarElem.style.left = `${resizeBarLeft}px`;
106
114
  if (resizableOpts.showDragTip && resizeTipElem) {
107
115
  const tableWidth = tableEl.clientWidth;
@@ -111,14 +119,14 @@ export default defineComponent({
111
119
  const resizeTipHeight = resizeTipElem.clientHeight;
112
120
  let resizeTipLeft = -resizeTipWidth;
113
121
  if (resizeBarLeft < resizeTipWidth + resizeBarWidth) {
114
- resizeTipLeft = resizeTipWidth + resizeBarWidth - resizeBarLeft;
122
+ resizeTipLeft = 0;
115
123
  }
116
124
  else if (resizeBarLeft > tableWidth) {
117
125
  resizeTipLeft += tableWidth - resizeBarLeft;
118
126
  }
119
127
  resizeTipElem.style.left = `${resizeTipLeft}px`;
120
128
  resizeTipElem.style.top = `${Math.min(tableEl.clientHeight - resizeTipHeight, Math.max(0, evnt.clientY - wrapperRect.y - resizeTipHeight / 2))}px`;
121
- resizeTipElem.textContent = getI18n('vxe.table.resizeColTip', [column.renderWidth + (isRightFixed ? dragPosLeft - dragLeft : dragLeft - dragPosLeft)]);
129
+ resizeTipElem.textContent = getI18n('vxe.table.resizeColTip', [resizeColumn.renderWidth + (isRightFixed ? dragPosLeft - dragLeft : dragLeft - dragPosLeft)]);
122
130
  }
123
131
  };
124
132
  tableReactData._isResize = true;
@@ -128,11 +136,11 @@ export default defineComponent({
128
136
  document.onmouseup = function (evnt) {
129
137
  document.onmousemove = domMousemove;
130
138
  document.onmouseup = domMouseup;
131
- const resizeWidth = column.renderWidth + (isRightFixed ? dragPosLeft - dragLeft : dragLeft - dragPosLeft);
132
- column.resizeWidth = resizeWidth;
139
+ const resizeWidth = resizeColumn.renderWidth + (isRightFixed ? dragPosLeft - dragLeft : dragLeft - dragPosLeft);
140
+ resizeColumn.resizeWidth = resizeWidth;
133
141
  if (resizableOpts.dragMode === 'fixed') {
134
142
  visibleColumn.forEach(item => {
135
- if (item.id !== column.id) {
143
+ if (item.id !== resizeColumn.id) {
136
144
  if (!item.resizeWidth) {
137
145
  item.resizeWidth = item.renderWidth;
138
146
  }
@@ -217,6 +225,8 @@ export default defineComponent({
217
225
  thOns.onMouseup = $xeTable.handleHeaderCellDragMouseupEvent;
218
226
  }
219
227
  }
228
+ const isLastColumn = $columnIndex === cols.length - 1;
229
+ const showResizable = (XEUtils.isBoolean(column.resizable) ? column.resizable : (columnOpts.resizable || allResizable));
220
230
  const isAutoCellWidth = !column.resizeWidth && (column.minWidth === 'auto' || column.width === 'auto');
221
231
  let isPreLoadStatus = false;
222
232
  if (scrollXLoad && !isGroup && !column.fixed && (_columnIndex < scrollXStore.visibleStartIndex || _columnIndex > scrollXStore.visibleEndIndex)) {
@@ -225,7 +235,7 @@ export default defineComponent({
225
235
  return h('th', Object.assign(Object.assign(Object.assign({ class: ['vxe-header--column', colid, {
226
236
  [`col--${headAlign}`]: headAlign,
227
237
  [`col--${type}`]: type,
228
- 'col--last': $columnIndex === cols.length - 1,
238
+ 'col--last': isLastColumn,
229
239
  'col--fixed': column.fixed,
230
240
  'col--group': isColGroup,
231
241
  'col--ellipsis': hasEllipsis,
@@ -251,7 +261,7 @@ export default defineComponent({
251
261
  /**
252
262
  * 列宽拖动
253
263
  */
254
- !fixedHiddenColumn && !isColGroup && (XEUtils.isBoolean(column.resizable) ? column.resizable : (columnOpts.resizable || allResizable))
264
+ !fixedHiddenColumn && showResizable
255
265
  ? h('div', {
256
266
  class: ['vxe-resizable', {
257
267
  'is--line': !border || border === 'none'
@@ -259,7 +269,7 @@ export default defineComponent({
259
269
  onMousedown: (evnt) => resizeMousedownEvent(evnt, params),
260
270
  onDblclick: (evnt) => $xeTable.handleResizeDblclickEvent(evnt, params)
261
271
  })
262
- : null
272
+ : renderEmptyElement($xeTable)
263
273
  ]);
264
274
  });
265
275
  };
@@ -1097,7 +1097,7 @@ export default defineComponent({
1097
1097
  fullColumnFieldData[field] = rest;
1098
1098
  }
1099
1099
  else {
1100
- if (storage || (columnOpts.drag && (isCrossDrag || isSelfToChildDrag))) {
1100
+ if ((storage && !type) || (columnOpts.drag && (isCrossDrag || isSelfToChildDrag))) {
1101
1101
  errLog('vxe.error.reqProp', [`${column.getTitle() || type || ''} -> column.field`]);
1102
1102
  }
1103
1103
  }
@@ -6520,17 +6520,23 @@ export default defineComponent({
6520
6520
  if (isDblclickAutoWidth && el) {
6521
6521
  const { fullColumnIdData } = internalData;
6522
6522
  const { column } = params;
6523
- const colid = column.id;
6523
+ let resizeColumn = column;
6524
+ if (column.children && column.children.length) {
6525
+ XEUtils.eachTree(column.children, childColumn => {
6526
+ resizeColumn = childColumn;
6527
+ });
6528
+ }
6529
+ const colid = resizeColumn.id;
6524
6530
  const colRest = fullColumnIdData[colid];
6525
6531
  const dragBtnElem = evnt.target;
6526
6532
  const cell = dragBtnElem.parentNode;
6527
6533
  const cellParams = Object.assign(params, { cell });
6528
6534
  const colMinWidth = getColReMinWidth(cellParams);
6529
- let resizeWidth = calcColumnAutoWidth(column, el);
6535
+ let resizeWidth = calcColumnAutoWidth(resizeColumn, el);
6530
6536
  if (colRest) {
6531
6537
  resizeWidth = Math.max(resizeWidth, colRest.width);
6532
6538
  }
6533
- column.resizeWidth = Math.max(colMinWidth, resizeWidth);
6539
+ resizeColumn.resizeWidth = Math.max(colMinWidth, resizeWidth);
6534
6540
  reactData._isResize = false;
6535
6541
  internalData._lastResizeTime = Date.now();
6536
6542
  $xeTable.analyColumnWidth();
@@ -6768,7 +6774,7 @@ export default defineComponent({
6768
6774
  }
6769
6775
  vLen++;
6770
6776
  });
6771
- const isSelected = rootList.length > 0 && sLen >= vLen;
6777
+ const isSelected = vLen > 0 ? sLen >= vLen : sLen >= rootList.length;
6772
6778
  const halfSelect = !isSelected && (sLen >= 1 || hLen >= 1);
6773
6779
  reactData.isAllSelected = isSelected;
6774
6780
  reactData.isIndeterminate = halfSelect;
@@ -1738,20 +1738,23 @@
1738
1738
  }
1739
1739
 
1740
1740
  .vxe-table--header-inner-wrapper,
1741
+ .vxe-table--body-inner-wrapper,
1741
1742
  .vxe-table--footer-inner-wrapper {
1743
+ position: relative;
1742
1744
  width: 100%;
1743
1745
  height: 100%;
1746
+ scrollbar-width: none;
1747
+ }
1748
+
1749
+ .vxe-table--header-inner-wrapper,
1750
+ .vxe-table--footer-inner-wrapper {
1744
1751
  overflow-y: hidden;
1745
1752
  overflow-x: scroll;
1746
- scrollbar-width: none;
1747
1753
  }
1748
1754
 
1749
1755
  .vxe-table--body-inner-wrapper {
1750
- width: 100%;
1751
- height: 100%;
1752
1756
  overflow-y: scroll;
1753
1757
  overflow-x: scroll;
1754
- scrollbar-width: none;
1755
1758
  }
1756
1759
 
1757
1760
  .vxe-loading--custom-wrapper {