vxe-table 4.10.6-beta.7 → 4.10.6-beta.9

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 (49) 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 +40 -27
  6. package/es/table/src/footer.js +4 -4
  7. package/es/table/src/header.js +11 -6
  8. package/es/table/src/table.js +298 -226
  9. package/es/table/style.css +128 -38
  10. package/es/table/style.min.css +1 -1
  11. package/es/ui/index.js +7 -5
  12. package/es/ui/src/log.js +1 -1
  13. package/es/vxe-table/style.css +128 -38
  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 +347 -270
  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 +33 -25
  22. package/lib/table/src/body.min.js +1 -1
  23. package/lib/table/src/footer.js +4 -4
  24. package/lib/table/src/footer.min.js +1 -1
  25. package/lib/table/src/header.js +14 -6
  26. package/lib/table/src/header.min.js +1 -1
  27. package/lib/table/src/table.js +288 -229
  28. package/lib/table/src/table.min.js +1 -1
  29. package/lib/table/style/style.css +128 -38
  30. package/lib/table/style/style.min.css +1 -1
  31. package/lib/ui/index.js +7 -5
  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 +128 -38
  36. package/lib/vxe-table/style/style.min.css +1 -1
  37. package/package.json +1 -1
  38. package/packages/table/src/body.ts +40 -25
  39. package/packages/table/src/footer.ts +4 -4
  40. package/packages/table/src/header.ts +11 -6
  41. package/packages/table/src/table.ts +309 -236
  42. package/packages/ui/index.ts +6 -4
  43. package/styles/components/table.scss +158 -60
  44. /package/es/{iconfont.1736820154664.ttf → iconfont.1736854674495.ttf} +0 -0
  45. /package/es/{iconfont.1736820154664.woff → iconfont.1736854674495.woff} +0 -0
  46. /package/es/{iconfont.1736820154664.woff2 → iconfont.1736854674495.woff2} +0 -0
  47. /package/lib/{iconfont.1736820154664.ttf → iconfont.1736854674495.ttf} +0 -0
  48. /package/lib/{iconfont.1736820154664.woff → iconfont.1736854674495.woff} +0 -0
  49. /package/lib/{iconfont.1736820154664.woff2 → iconfont.1736854674495.woff2} +0 -0
@@ -235,6 +235,29 @@ export default defineComponent({
235
235
  if (!fixedHiddenColumn && editConfig && (editRender || cellRender) && (editOpts.showStatus || editOpts.showUpdateStatus)) {
236
236
  isDirty = $xeTable.isUpdateByRow(row, column.field);
237
237
  }
238
+ const isVNAutoHeight = scrollYLoad && !hasEllipsis;
239
+ let cellHeight = 0;
240
+ const vnHeight = isCalcCellHeight ? rest.height : 0;
241
+ if (hasEllipsis) {
242
+ if (customRHeight) {
243
+ cellHeight = customRHeight;
244
+ }
245
+ else if (!isAllOverflow) {
246
+ cellHeight = vnHeight || defaultRowHeight || 18;
247
+ }
248
+ }
249
+ else {
250
+ cellHeight = vnHeight || defaultRowHeight || 18;
251
+ }
252
+ const tcStyle = {};
253
+ if (cellHeight) {
254
+ if (hasEllipsis) {
255
+ tcStyle.maxHeight = `${cellHeight}px`;
256
+ }
257
+ else if (isVNAutoHeight) {
258
+ tcStyle.height = `${cellHeight}px`;
259
+ }
260
+ }
238
261
  const tdVNs = [];
239
262
  if (fixedHiddenColumn && (allColumnOverflow ? isAllOverflow : allColumnOverflow)) {
240
263
  tdVNs.push(h('div', {
@@ -243,9 +266,7 @@ export default defineComponent({
243
266
  'c--tooltip': showTooltip,
244
267
  'c--ellipsis': showEllipsis
245
268
  }],
246
- style: {
247
- maxHeight: hasEllipsis && (customRHeight || defaultRowHeight) ? `${customRHeight || defaultRowHeight}px` : ''
248
- }
269
+ style: tcStyle
249
270
  }));
250
271
  }
251
272
  else {
@@ -256,11 +277,15 @@ export default defineComponent({
256
277
  'c--tooltip': showTooltip,
257
278
  'c--ellipsis': showEllipsis
258
279
  }],
259
- style: {
260
- maxHeight: hasEllipsis && (customRHeight || defaultRowHeight) ? `${customRHeight || defaultRowHeight}px` : ''
261
- },
280
+ style: tcStyle,
262
281
  title: showTitle ? $xeTable.getCellLabel(row, column) : null
263
- }, column.renderCell(params)));
282
+ }, isVNAutoHeight
283
+ ? [
284
+ h('div', {
285
+ class: 'vxe-cell--auto-wrapper'
286
+ }, column.renderCell(params))
287
+ ]
288
+ : column.renderCell(params)));
264
289
  if (showValidTip && errorValidItem) {
265
290
  const errRule = errorValidItem.rule;
266
291
  const validSlot = slots ? slots.valid : null;
@@ -287,19 +312,6 @@ export default defineComponent({
287
312
  ]));
288
313
  }
289
314
  }
290
- let cellHeight = '';
291
- const vnHeight = isCalcCellHeight ? rest.height : 0;
292
- if (hasEllipsis) {
293
- if (customRHeight) {
294
- cellHeight = `${customRHeight}px`;
295
- }
296
- else if (!isAllOverflow) {
297
- cellHeight = `${vnHeight || defaultRowHeight || 18}px`;
298
- }
299
- }
300
- else {
301
- cellHeight = `${vnHeight || defaultRowHeight || 18}px`;
302
- }
303
315
  if (mouseConfig && mouseOpts.area && selectCellToRow) {
304
316
  if ((!$columnIndex && selectCellToRow === true) ||
305
317
  (selectCellToRow === column.field)) {
@@ -310,12 +322,12 @@ export default defineComponent({
310
322
  }
311
323
  const isLastColumn = $columnIndex === columns.length - 1;
312
324
  const isAutoCellWidth = !column.resizeWidth && (column.minWidth === 'auto' || column.width === 'auto');
313
- let isPreLoadStatus = false;
314
- if (scrollYLoad && (_rowIndex < scrollYStore.visibleStartIndex || _rowIndex > scrollYStore.visibleEndIndex)) {
315
- isPreLoadStatus = true;
325
+ let isVNPreEmptyStatus = false;
326
+ if (scrollYLoad && (_rowIndex < scrollYStore.visibleStartIndex - scrollYStore.preloadSize || _rowIndex > scrollYStore.visibleEndIndex + scrollYStore.preloadSize)) {
327
+ isVNPreEmptyStatus = true;
316
328
  }
317
- else if (scrollXLoad && !column.fixed && (_columnIndex < scrollXStore.visibleStartIndex || _columnIndex > scrollXStore.visibleEndIndex)) {
318
- isPreLoadStatus = true;
329
+ else if (scrollXLoad && !column.fixed && (_columnIndex < scrollXStore.visibleStartIndex - scrollXStore.preloadSize || _columnIndex > scrollXStore.visibleEndIndex + scrollXStore.preloadSize)) {
330
+ isVNPreEmptyStatus = true;
319
331
  }
320
332
  return h('td', Object.assign(Object.assign(Object.assign({ class: [
321
333
  'vxe-body--column',
@@ -328,6 +340,7 @@ export default defineComponent({
328
340
  'col--tree-node': treeNode,
329
341
  'col--edit': isEdit,
330
342
  'col--ellipsis': hasEllipsis,
343
+ 'col--auto-height': isVNAutoHeight,
331
344
  'fixed--width': !isAutoCellWidth,
332
345
  'fixed--hidden': fixedHiddenColumn,
333
346
  'is--drag-cell': isRowDragCell && (isCrossDrag || isPeerDrag || !rowLevel),
@@ -341,8 +354,8 @@ export default defineComponent({
341
354
  getPropClass(className, params),
342
355
  getPropClass(allCellClassName, params)
343
356
  ], key: columnKey || scrollXLoad || scrollYLoad || columnOpts.useKey || rowOpts.useKey || columnOpts.drag ? colid : $columnIndex }, attrs), { style: Object.assign({
344
- height: cellHeight
345
- }, XEUtils.isFunction(compCellStyle) ? compCellStyle(params) : compCellStyle, XEUtils.isFunction(cellStyle) ? cellStyle(params) : cellStyle) }), tdOns), isPreLoadStatus || (isOptimizeMode && fixedHiddenColumn) ? [] : tdVNs);
357
+ height: cellHeight ? `${cellHeight}px` : ''
358
+ }, XEUtils.isFunction(compCellStyle) ? compCellStyle(params) : compCellStyle, XEUtils.isFunction(cellStyle) ? cellStyle(params) : cellStyle) }), tdOns), isVNPreEmptyStatus || (isOptimizeMode && fixedHiddenColumn) ? [] : tdVNs);
346
359
  };
347
360
  const renderRows = (fixedType, isOptimizeMode, tableData, tableColumn) => {
348
361
  const { stripe, rowKey, highlightHoverRow, rowClassName, rowStyle, showOverflow: allColumnOverflow, editConfig, treeConfig } = tableProps;
@@ -147,9 +147,9 @@ export default defineComponent({
147
147
  }
148
148
  const isLastColumn = $columnIndex === tableColumn.length - 1;
149
149
  const isAutoCellWidth = !column.resizeWidth && (column.minWidth === 'auto' || column.width === 'auto');
150
- let isPreLoadStatus = false;
151
- if (scrollXLoad && !column.fixed && (_columnIndex < scrollXStore.visibleStartIndex || _columnIndex > scrollXStore.visibleEndIndex)) {
152
- isPreLoadStatus = true;
150
+ let isVNPreEmptyStatus = false;
151
+ if (scrollXLoad && !column.fixed && (_columnIndex < scrollXStore.visibleStartIndex - scrollXStore.preloadSize || _columnIndex > scrollXStore.visibleEndIndex + scrollXStore.preloadSize)) {
152
+ isVNPreEmptyStatus = true;
153
153
  }
154
154
  return h('td', Object.assign(Object.assign(Object.assign(Object.assign({ class: ['vxe-footer--column', column.id, {
155
155
  [`col--${footAlign}`]: footAlign,
@@ -166,7 +166,7 @@ export default defineComponent({
166
166
  'c--tooltip': showTooltip,
167
167
  'c--ellipsis': showEllipsis
168
168
  }]
169
- }, isPreLoadStatus ? [] : column.renderFooter(cellParams))
169
+ }, isVNPreEmptyStatus ? [] : column.renderFooter(cellParams))
170
170
  ]);
171
171
  });
172
172
  };
@@ -21,7 +21,7 @@ export default defineComponent({
21
21
  const $xeTable = inject('$xeTable', {});
22
22
  const { xID, props: tableProps, reactData: tableReactData, internalData: tableInternalData } = $xeTable;
23
23
  const { refElem: tableRefElem, refLeftContainer, refRightContainer, refCellResizeBar, refCellResizeTip } = $xeTable.getRefMaps();
24
- const { computeColumnOpts, computeColumnDragOpts, computeResizableOpts } = $xeTable.getComputeMaps();
24
+ const { computeColumnOpts, computeColumnDragOpts, computeResizableOpts, computeScrollbarXToTop } = $xeTable.getComputeMaps();
25
25
  const headerColumn = ref([]);
26
26
  const refElem = ref();
27
27
  const refHeaderScroll = ref();
@@ -37,6 +37,7 @@ export default defineComponent({
37
37
  const resizeMousedownEvent = (evnt, params) => {
38
38
  const { column } = params;
39
39
  const { fixedType } = props;
40
+ const { scrollbarHeight } = tableReactData;
40
41
  const { elemStore, visibleColumn } = tableInternalData;
41
42
  const resizableOpts = computeResizableOpts.value;
42
43
  const tableEl = tableRefElem.value;
@@ -44,6 +45,7 @@ export default defineComponent({
44
45
  const rightContainerElem = refRightContainer.value;
45
46
  const resizeBarElem = refCellResizeBar.value;
46
47
  const resizeTipElem = refCellResizeTip.value;
48
+ const scrollbarXToTop = computeScrollbarXToTop.value;
47
49
  const { clientX: dragClientX } = evnt;
48
50
  const wrapperElem = refElem.value;
49
51
  const dragBtnElem = evnt.target;
@@ -92,6 +94,7 @@ export default defineComponent({
92
94
  const updateEvent = (evnt) => {
93
95
  evnt.stopPropagation();
94
96
  evnt.preventDefault();
97
+ const tableHeight = tableEl.clientHeight;
95
98
  const offsetX = evnt.clientX - dragClientX;
96
99
  let left = dragPosLeft + offsetX;
97
100
  const scrollLeft = fixedType ? 0 : bodyScrollElem.scrollLeft;
@@ -111,6 +114,8 @@ export default defineComponent({
111
114
  dragLeft = Math.max(left, dragMinLeft);
112
115
  const resizeBarLeft = Math.max(1, dragLeft - scrollLeft);
113
116
  resizeBarElem.style.left = `${resizeBarLeft}px`;
117
+ resizeBarElem.style.top = `${scrollbarXToTop ? scrollbarHeight : 0}px`;
118
+ resizeBarElem.style.height = `${scrollbarXToTop ? tableHeight - scrollbarHeight : tableHeight}px`;
114
119
  if (resizableOpts.showDragTip && resizeTipElem) {
115
120
  const tableWidth = tableEl.clientWidth;
116
121
  const wrapperRect = wrapperElem.getBoundingClientRect();
@@ -125,7 +130,7 @@ export default defineComponent({
125
130
  resizeTipLeft += tableWidth - resizeBarLeft;
126
131
  }
127
132
  resizeTipElem.style.left = `${resizeTipLeft}px`;
128
- resizeTipElem.style.top = `${Math.min(tableEl.clientHeight - resizeTipHeight, Math.max(0, evnt.clientY - wrapperRect.y - resizeTipHeight / 2))}px`;
133
+ resizeTipElem.style.top = `${Math.min(tableHeight - resizeTipHeight, Math.max(0, evnt.clientY - wrapperRect.y - resizeTipHeight / 2))}px`;
129
134
  resizeTipElem.textContent = getI18n('vxe.table.resizeColTip', [resizeColumn.renderWidth + (isRightFixed ? dragPosLeft - dragLeft : dragLeft - dragPosLeft)]);
130
135
  }
131
136
  };
@@ -228,9 +233,9 @@ export default defineComponent({
228
233
  const isLastColumn = $columnIndex === cols.length - 1;
229
234
  const showResizable = (XEUtils.isBoolean(column.resizable) ? column.resizable : (columnOpts.resizable || allResizable));
230
235
  const isAutoCellWidth = !column.resizeWidth && (column.minWidth === 'auto' || column.width === 'auto');
231
- let isPreLoadStatus = false;
232
- if (scrollXLoad && !isGroup && !column.fixed && (_columnIndex < scrollXStore.visibleStartIndex || _columnIndex > scrollXStore.visibleEndIndex)) {
233
- isPreLoadStatus = true;
236
+ let isVNPreEmptyStatus = false;
237
+ if (scrollXLoad && !column.fixed && (_columnIndex < scrollXStore.visibleStartIndex - scrollXStore.preloadSize || _columnIndex > scrollXStore.visibleEndIndex + scrollXStore.preloadSize)) {
238
+ isVNPreEmptyStatus = true;
234
239
  }
235
240
  return h('th', Object.assign(Object.assign(Object.assign({ class: ['vxe-header--column', colid, {
236
241
  [`col--${headAlign}`]: headAlign,
@@ -257,7 +262,7 @@ export default defineComponent({
257
262
  'c--tooltip': showTooltip,
258
263
  'c--ellipsis': showEllipsis
259
264
  }]
260
- }, isPreLoadStatus || (isOptimizeMode && fixedHiddenColumn) ? [] : column.renderHeader(params)),
265
+ }, isVNPreEmptyStatus || (isOptimizeMode && fixedHiddenColumn) ? [] : column.renderHeader(params)),
261
266
  /**
262
267
  * 列宽拖动
263
268
  */