bkui-vue 2.0.1-beta.40 → 2.0.1-beta.41

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 (57) hide show
  1. package/dist/index.cjs.js +63 -63
  2. package/dist/index.esm.js +16186 -16112
  3. package/dist/index.umd.js +63 -63
  4. package/dist/style.css +1 -1
  5. package/dist/style.variable.css +1 -1
  6. package/lib/checkbox/index.js +2 -1
  7. package/lib/index.js +1 -1
  8. package/lib/scrollbar/{scrollbar.css → css/scrollbar.css} +90 -75
  9. package/lib/scrollbar/css/scrollbar.less +139 -0
  10. package/lib/scrollbar/{scrollbar.variable.css → css/scrollbar.variable.css} +89 -74
  11. package/lib/scrollbar/handlers/click-rail.d.ts +2 -0
  12. package/lib/scrollbar/handlers/drag-thumb.d.ts +1 -0
  13. package/lib/scrollbar/handlers/keyboard.d.ts +2 -0
  14. package/lib/scrollbar/handlers/mouse-wheel.d.ts +2 -0
  15. package/lib/scrollbar/handlers/touch.d.ts +4 -0
  16. package/lib/scrollbar/helper/class-names.d.ts +21 -0
  17. package/lib/scrollbar/helper/css.d.ts +3 -0
  18. package/lib/scrollbar/helper/dom.d.ts +4 -0
  19. package/lib/scrollbar/helper/event-manager.d.ts +20 -0
  20. package/lib/scrollbar/helper/util.d.ts +11 -0
  21. package/lib/scrollbar/index.d.ts +133 -13
  22. package/lib/scrollbar/index.js +1331 -18489
  23. package/lib/scrollbar/process-scroll-diff.d.ts +1 -0
  24. package/lib/scrollbar/update-geometry.d.ts +8 -0
  25. package/lib/styles/index.d.ts +1 -0
  26. package/lib/table/components/table-cell.d.ts +11 -0
  27. package/lib/table/hooks/use-columns.d.ts +4 -1
  28. package/lib/table/hooks/use-layout.d.ts +1 -0
  29. package/lib/table/hooks/use-settings.d.ts +2 -2
  30. package/lib/table/index.d.ts +23 -0
  31. package/lib/table/index.js +233 -77
  32. package/lib/table/props.d.ts +9 -1
  33. package/lib/table/table.css +126 -109
  34. package/lib/table/table.d.ts +11 -0
  35. package/lib/table/table.less +49 -30
  36. package/lib/table/table.variable.css +126 -109
  37. package/lib/table/utils.d.ts +15 -15
  38. package/lib/table-column/index.js +8 -0
  39. package/lib/tree/index.d.ts +3 -3
  40. package/lib/tree/tree.css +90 -83
  41. package/lib/tree/tree.d.ts +1 -1
  42. package/lib/tree/tree.variable.css +90 -83
  43. package/lib/virtual-render/index.d.ts +0 -23
  44. package/lib/virtual-render/index.js +54 -106
  45. package/lib/virtual-render/props.d.ts +0 -6
  46. package/lib/virtual-render/use-scrollbar.d.ts +3 -17
  47. package/lib/virtual-render/virtual-render.css +89 -82
  48. package/lib/virtual-render/virtual-render.d.ts +0 -11
  49. package/lib/virtual-render/virtual-render.less +2 -11
  50. package/lib/virtual-render/virtual-render.variable.css +89 -82
  51. package/package.json +1 -1
  52. package/lib/scrollbar/scrollbar-core/can-use-dom.d.ts +0 -2
  53. package/lib/scrollbar/scrollbar-core/helpers.d.ts +0 -5
  54. package/lib/scrollbar/scrollbar-core/index.d.ts +0 -242
  55. package/lib/scrollbar/scrollbar-core/mouse-wheel.d.ts +0 -5
  56. package/lib/scrollbar/scrollbar-core/scrollbar-width.d.ts +0 -1
  57. package/lib/scrollbar/scrollbar.less +0 -119
@@ -17661,6 +17661,9 @@ var IColSortBehavior;
17661
17661
  */
17662
17662
  IColSortBehavior["interdependent"] = "interdependent";
17663
17663
  })(IColSortBehavior || (IColSortBehavior = {}));
17664
+ // export enum BkScrollBehavior {
17665
+ // AUTO = 'auto',
17666
+ // };
17664
17667
  var tableProps = {
17665
17668
  /**
17666
17669
  * 渲染列表
@@ -17876,6 +17879,10 @@ var tableProps = {
17876
17879
  * 是否监表格尺寸变化而响应式重新计算渲染
17877
17880
  */
17878
17881
  observerResize: shared_namespaceObject.PropTypes.bool.def(true),
17882
+ /**
17883
+ * 是否使用IntersectionObserver监听表格Cell进如有可视区域再渲染
17884
+ */
17885
+ intersectionObserver: shared_namespaceObject.PropTypes.bool.def(false),
17879
17886
  // 对齐方式
17880
17887
  align: TableAlign,
17881
17888
  headerAlign: TableAlign,
@@ -17910,6 +17917,7 @@ var tableProps = {
17910
17917
  * 启用Scrollbar
17911
17918
  */
17912
17919
  scrollbar: shared_namespaceObject.PropTypes.bool.def(true),
17920
+ // scrollbehavior: toType<`${ScrollBehavior}`>('ScrollBehavior', {
17913
17921
  /**
17914
17922
  * 固定在底部的配置项
17915
17923
  */
@@ -18126,13 +18134,13 @@ var CELL_EVENT_TYPES = defineProperty_defineProperty(defineProperty_defineProper
18126
18134
 
18127
18135
 
18128
18136
 
18129
-
18130
18137
  /* harmony default export */ const use_column_resize = (function (columns, _ref) {
18131
18138
  var afterResize = _ref.afterResize;
18132
18139
  var getColumnAttribute = columns.getColumnAttribute,
18133
18140
  getColumnOrderWidth = columns.getColumnOrderWidth,
18134
18141
  setColumnAttribute = columns.setColumnAttribute,
18135
- setNextColumnWidth = columns.setNextColumnWidth;
18142
+ setNextColumnWidth = columns.setNextColumnWidth,
18143
+ getPreColumn = columns.getPreColumn;
18136
18144
  var getColListener = function getColListener(col) {
18137
18145
  return getColumnAttribute(col, COLUMN_ATTRIBUTE.LISTENERS);
18138
18146
  };
@@ -18148,7 +18156,11 @@ var CELL_EVENT_TYPES = defineProperty_defineProperty(defineProperty_defineProper
18148
18156
  var isDraging = false;
18149
18157
  var startX = 0;
18150
18158
  var dragColumn = null;
18151
- var dragStartOffsetX = 0;
18159
+ var poinerPlacement = 'right';
18160
+ var headTable = null;
18161
+ var mouseMoveColumn = null;
18162
+ var dragWidth = 0;
18163
+ var cellCursorStore = new WeakMap();
18152
18164
  var dragOffsetX = (0,external_vue_namespaceObject.ref)(-1000);
18153
18165
  var ORDER_LIST = [COLUMN_ATTRIBUTE.WIDTH];
18154
18166
  var stopDefaultEvent = function stopDefaultEvent(e) {
@@ -18160,90 +18172,119 @@ var CELL_EVENT_TYPES = defineProperty_defineProperty(defineProperty_defineProper
18160
18172
  stopDefaultEvent(e);
18161
18173
  isMouseDown = false;
18162
18174
  isDraging = false;
18163
- var diff = e.clientX - startX;
18164
- var resolveWidth = getColumnOrderWidth(dragColumn, ORDER_LIST) + diff;
18175
+ var resolveWidth = getColumnOrderWidth(dragColumn, ORDER_LIST) + dragWidth;
18165
18176
  var minWidth = getColumnOrderWidth(dragColumn, [COLUMN_ATTRIBUTE.COL_MIN_WIDTH]);
18166
18177
  var calcWidth = resolveWidth > minWidth ? resolveWidth : minWidth;
18167
18178
  setNextColumnWidth(dragColumn, calcWidth);
18168
18179
  setColumnAttribute(dragColumn, COLUMN_ATTRIBUTE.WIDTH, calcWidth);
18169
18180
  document.removeEventListener('mouseup', handleMouseUp);
18170
- document.removeEventListener('mousemove', handleMouseMove);
18171
- startX = 0;
18172
18181
  dragOffsetX.value = -1000;
18173
- dragColumn = null;
18174
- var target = e.target.closest('th');
18175
- removeCursor(target);
18182
+ dragWidth = 0;
18183
+ removeCursor(headTable);
18176
18184
  afterResize === null || afterResize === void 0 || afterResize();
18185
+ headTable = null;
18186
+ var target = e.target;
18187
+ handleMouseoutDragSection(target);
18188
+ dragColumn = null;
18177
18189
  };
18178
- var updateOffsetX = function updateOffsetX(e) {
18179
- return (0,shared_namespaceObject.throttle)(function () {
18180
- var diff = e.clientX - startX;
18181
- var resolveWidth = getColumnOrderWidth(dragColumn, ORDER_LIST) + diff;
18182
- var minWidth = getColumnOrderWidth(dragColumn, [COLUMN_ATTRIBUTE.COL_MIN_WIDTH]);
18183
- if (minWidth < resolveWidth) {
18184
- dragOffsetX.value = e.clientX - startX + dragStartOffsetX;
18185
- }
18186
- });
18187
- };
18188
- var handleMouseMove = function handleMouseMove(e) {
18190
+ var handleMouseDragMove = function handleMouseDragMove(e) {
18189
18191
  stopDefaultEvent(e);
18190
- updateOffsetX(e)();
18192
+ document.body.style.setProperty('user-select', 'none');
18193
+ var diff = e.clientX - startX;
18194
+ dragWidth = dragWidth + diff;
18195
+ startX = e.clientX;
18196
+ var resolveWidth = getColumnOrderWidth(dragColumn, ORDER_LIST) + diff;
18197
+ var minWidth = getColumnOrderWidth(dragColumn, [COLUMN_ATTRIBUTE.COL_MIN_WIDTH]);
18198
+ if (minWidth < resolveWidth) {
18199
+ dragOffsetX.value = dragOffsetX.value + diff;
18200
+ }
18191
18201
  };
18192
18202
  var setNodeCursor = function () {
18193
18203
  return (0,lodash.debounce)(function (target) {
18194
- var _target$style;
18195
- target === null || target === void 0 || (_target$style = target.style) === null || _target$style === void 0 || _target$style.setProperty('cursor', 'col-resize');
18204
+ document.body.style.setProperty('user-select', 'none');
18196
18205
  target === null || target === void 0 || target.classList.add('col-resize-hover');
18197
18206
  });
18198
18207
  }();
18199
18208
  var removeCursor = function removeCursor(target) {
18200
- var _target$style2;
18201
18209
  setNodeCursor.cancel();
18202
- target === null || target === void 0 || (_target$style2 = target.style) === null || _target$style2 === void 0 || _target$style2.removeProperty('cursor');
18210
+ document.body.style.removeProperty('user-select');
18203
18211
  target === null || target === void 0 || target.classList.remove('col-resize-hover');
18204
18212
  };
18205
- var handler = defineProperty_defineProperty(defineProperty_defineProperty(defineProperty_defineProperty({}, EVENTS.MOUSE_DOWN, function (e, column) {
18213
+ var handlemouseDownEvent = function handlemouseDownEvent(e) {
18206
18214
  if (!isInDragSection) {
18207
18215
  return;
18208
18216
  }
18209
- isMouseDown = true;
18210
- var target = e.target.closest('th');
18217
+ removePointerClass(e.target);
18218
+ startX = e.clientX;
18219
+ var column = poinerPlacement === 'left' ? getPreColumn(mouseMoveColumn) : mouseMoveColumn;
18211
18220
  setColumnAttribute(column, COLUMN_ATTRIBUTE.COL_IS_DRAG, true);
18212
- setNodeCursor(target);
18213
18221
  dragColumn = column;
18214
- startX = e.clientX;
18215
- var targetTable = e.target.closest('table');
18216
- dragStartOffsetX = startX - targetTable.getBoundingClientRect().left;
18217
- updateOffsetX(e)();
18222
+ headTable = e.target.closest('table');
18223
+ var rect = headTable.getBoundingClientRect();
18224
+ dragOffsetX.value = e.clientX - rect.left;
18225
+ setNodeCursor(headTable);
18226
+ isMouseDown = true;
18218
18227
  document.addEventListener('mouseup', handleMouseUp);
18219
- document.addEventListener('mousemove', handleMouseMove);
18220
- target === null || target === void 0 || target.classList.remove('col-resize-hover');
18221
- }), EVENTS.MOUSE_MOVE, function (e, _column) {
18222
- if (isMouseDown && !isDraging) {
18223
- isDraging = true;
18228
+ };
18229
+ var removePointerClass = function removePointerClass(target) {
18230
+ var _target$parentElement;
18231
+ var targetElements = target === null || target === void 0 || (_target$parentElement = target.parentElement) === null || _target$parentElement === void 0 || (_target$parentElement = _target$parentElement.parentElement) === null || _target$parentElement === void 0 ? void 0 : _target$parentElement.querySelectorAll('.col-pointer-hover');
18232
+ targetElements.forEach(function (element) {
18233
+ element === null || element === void 0 || element.classList.remove('col-pointer-hover');
18234
+ element === null || element === void 0 || element.classList.remove('poiner-left');
18235
+ element === null || element === void 0 || element.classList.remove('poiner-right');
18236
+ });
18237
+ };
18238
+ var addPointerClass = function addPointerClass(target, poinerPlacement) {
18239
+ var targetTh = target.parentElement;
18240
+ targetTh === null || targetTh === void 0 || targetTh.classList.add('col-pointer-hover');
18241
+ targetTh === null || targetTh === void 0 || targetTh.classList.add("poiner-".concat(poinerPlacement));
18242
+ var nextTarget = poinerPlacement === 'right' ? targetTh.nextElementSibling : targetTh.previousElementSibling;
18243
+ var nextPlacement = poinerPlacement === 'right' ? 'left' : 'right';
18244
+ nextTarget === null || nextTarget === void 0 || nextTarget.classList.add('col-pointer-hover');
18245
+ nextTarget === null || nextTarget === void 0 || nextTarget.classList.add("poiner-".concat(nextPlacement));
18246
+ };
18247
+ var handleMouseoutDragSection = function handleMouseoutDragSection(target) {
18248
+ if (!isDraging) {
18249
+ dragOffsetX.value = -1000;
18250
+ target.classList.remove('cell-resize');
18251
+ removePointerClass(target);
18252
+ cellCursorStore.set(target, false);
18253
+ document.removeEventListener('mousedown', handlemouseDownEvent);
18224
18254
  }
18225
- var target = e.target.closest('th');
18226
- if (isDraging) {
18227
- target.style.setProperty('user-select', 'none');
18255
+ };
18256
+ var handler = defineProperty_defineProperty(defineProperty_defineProperty({}, EVENTS.MOUSE_MOVE, function (e, column, index) {
18257
+ stopDefaultEvent(e);
18258
+ if (isMouseDown) {
18259
+ isDraging = true;
18260
+ handleMouseDragMove(e);
18261
+ return;
18228
18262
  }
18263
+ var target = e.target;
18229
18264
  if (!isDraging) {
18230
18265
  if (!target) {
18231
18266
  return;
18232
18267
  }
18233
- var rect = target.getBoundingClientRect();
18234
- if (rect.width > 12 && rect.right - e.pageX < 12) {
18268
+ var offsetWidth = target.offsetWidth;
18269
+ var mouseOffsetX = e.offsetX;
18270
+ if (offsetWidth > 12 && (offsetWidth - mouseOffsetX < 8 || mouseOffsetX < 8 && index > 0)) {
18235
18271
  isInDragSection = true;
18236
- setNodeCursor(target);
18272
+ poinerPlacement = mouseOffsetX < 8 ? 'left' : 'right';
18273
+ if (!cellCursorStore.get(target)) {
18274
+ cellCursorStore.set(target, true);
18275
+ target.classList.add('cell-resize');
18276
+ addPointerClass(target, poinerPlacement);
18277
+ mouseMoveColumn = column;
18278
+ document.addEventListener('mousedown', handlemouseDownEvent);
18279
+ }
18237
18280
  } else {
18238
- removeCursor(target);
18239
18281
  isInDragSection = false;
18282
+ handleMouseoutDragSection(target);
18240
18283
  }
18241
18284
  }
18242
- }), EVENTS.MOUSE_OUT, function (e, _column) {
18243
- var target = e.target.closest('th');
18244
- if (!isDraging) {
18245
- removeCursor(target);
18246
- }
18285
+ }), EVENTS.MOUSE_OUT, function (e, _column, _index) {
18286
+ var target = e.target;
18287
+ handleMouseoutDragSection(target);
18247
18288
  });
18248
18289
  var getEventName = function getEventName(event) {
18249
18290
  return "".concat(pluginName, "_").concat(event);
@@ -19832,6 +19873,7 @@ var getElementTextWidth = function getElementTextWidth(element, text) {
19832
19873
  */
19833
19874
  function getTextWidth(text, font) {
19834
19875
  // re-use canvas object for better performance
19876
+ // @ts-ignore
19835
19877
  var canvas = getTextWidth.canvas || (getTextWidth.canvas = document.createElement('canvas'));
19836
19878
  var context = canvas.getContext('2d');
19837
19879
  context.font = font;
@@ -19915,8 +19957,8 @@ var getSortFn = function getSortFn(column, sortType) {
19915
19957
  var sortFn = typeof ((_column$sort = column.sort) === null || _column$sort === void 0 ? void 0 : _column$sort.sortFn) === 'function' ? (_column$sort2 = column.sort) === null || _column$sort2 === void 0 ? void 0 : _column$sort2.sortFn : sortFn0;
19916
19958
  return sortType === SORT_OPTION.NULL ? function (_a, _b) {
19917
19959
  return true;
19918
- } : function (_a, _b, index0, index1) {
19919
- return sortFn(_a, _b, index0, index1) * (sortType === SORT_OPTION.DESC ? -1 : 1);
19960
+ } : function (a, b, index0, index1) {
19961
+ return sortFn(a, b, index0, index1) * (sortType === SORT_OPTION.DESC ? -1 : 1);
19920
19962
  };
19921
19963
  };
19922
19964
  var getNextSortType = function getNextSortType(sortType) {
@@ -20238,7 +20280,7 @@ var useColumns = function useColumns(props) {
20238
20280
  }
20239
20281
  return minWidth;
20240
20282
  };
20241
- var resolveEventListener = function resolveEventListener(col) {
20283
+ var resolveEventListener = function resolveEventListener(col, index) {
20242
20284
  var listeners = getColumnAttribute(col, COLUMN_ATTRIBUTE.LISTENERS);
20243
20285
  if (!listeners) {
20244
20286
  return {};
@@ -20247,7 +20289,7 @@ var useColumns = function useColumns(props) {
20247
20289
  var eventName = key.split('_').slice(-1)[0];
20248
20290
  return Object.assign(handle, defineProperty_defineProperty({}, eventName, function (e) {
20249
20291
  listeners.get(key).forEach(function (fn) {
20250
- return Reflect.apply(fn, use_columns_this, [e, col]);
20292
+ return Reflect.apply(fn, use_columns_this, [e, col, index]);
20251
20293
  });
20252
20294
  }));
20253
20295
  }, {});
@@ -20621,6 +20663,36 @@ var useColumns = function useColumns(props) {
20621
20663
  setColumnAttribute(col, COLUMN_ATTRIBUTE.SELECTION_INDETERMINATE, false);
20622
20664
  }
20623
20665
  };
20666
+ var getPreColumn = function getPreColumn(col) {
20667
+ var index = visibleColumns.findIndex(function (item) {
20668
+ return item === col;
20669
+ });
20670
+ var preIndex = index - 1;
20671
+ return visibleColumns[preIndex];
20672
+ };
20673
+ var getColumnIndex = function getColumnIndex(col) {
20674
+ return visibleColumns.findIndex(function (item) {
20675
+ return item === col;
20676
+ });
20677
+ };
20678
+ var getLeftColumnsWidth = function getLeftColumnsWidth(col) {
20679
+ var includingSelf = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
20680
+ var isContinue = true;
20681
+ var width = 0;
20682
+ var index = 0;
20683
+ while (isContinue && index < visibleColumns.length) {
20684
+ if (col === visibleColumns[index]) {
20685
+ if (includingSelf) {
20686
+ width = width + getColumnWidth(visibleColumns[index]);
20687
+ }
20688
+ isContinue = false;
20689
+ break;
20690
+ }
20691
+ width = width + getColumnWidth(visibleColumns[index]);
20692
+ index = index + 1;
20693
+ }
20694
+ return width;
20695
+ };
20624
20696
  return {
20625
20697
  needColSpan: needColSpan,
20626
20698
  needRowSpan: needRowSpan,
@@ -20648,7 +20720,10 @@ var useColumns = function useColumns(props) {
20648
20720
  getColumnRefAttribute: getColumnRefAttribute,
20649
20721
  getColumnCalcWidth: getColumnCalcWidth,
20650
20722
  getColumnWidth: getColumnWidth,
20723
+ getLeftColumnsWidth: getLeftColumnsWidth,
20651
20724
  getGroupAttribute: getGroupAttribute,
20725
+ getPreColumn: getPreColumn,
20726
+ getColumnIndex: getColumnIndex,
20652
20727
  resolveEventListener: resolveEventListener,
20653
20728
  setColumnIsHidden: setColumnIsHidden,
20654
20729
  setColumnResizeWidth: setColumnResizeWidth,
@@ -21016,8 +21091,9 @@ const loading_less_namespaceObject = loading_less_x({ });
21016
21091
  var refScrollLoading = (0,external_vue_namespaceObject.toRef)(props, 'scrollLoading');
21017
21092
  var getLoadingOption = function getLoadingOption() {
21018
21093
  if (typeof refScrollLoading.value === 'boolean') {
21094
+ var _props$fixedBottom$lo, _props$fixedBottom;
21019
21095
  return {
21020
- loading: !!refScrollLoading.value,
21096
+ loading: !!refScrollLoading.value || ((_props$fixedBottom$lo = (_props$fixedBottom = props.fixedBottom) === null || _props$fixedBottom === void 0 ? void 0 : _props$fixedBottom.loading) !== null && _props$fixedBottom$lo !== void 0 ? _props$fixedBottom$lo : false),
21021
21097
  inline: true,
21022
21098
  title: '',
21023
21099
  size: loading_namespaceObject.BkLoadingSize.Normal,
@@ -21028,7 +21104,8 @@ const loading_less_namespaceObject = loading_less_x({ });
21028
21104
  return refScrollLoading.value;
21029
21105
  };
21030
21106
  var isRender = (0,external_vue_namespaceObject.computed)(function () {
21031
- return refScrollLoading.value !== null && (typeof refScrollLoading.value === 'boolean' && refScrollLoading.value || typeof_typeof(refScrollLoading.value) === 'object');
21107
+ var _props$fixedBottom$lo2, _props$fixedBottom2;
21108
+ return refScrollLoading.value !== null && (typeof refScrollLoading.value === 'boolean' && refScrollLoading.value || typeof_typeof(refScrollLoading.value) === 'object') || ((_props$fixedBottom$lo2 = (_props$fixedBottom2 = props.fixedBottom) === null || _props$fixedBottom2 === void 0 ? void 0 : _props$fixedBottom2.loading) !== null && _props$fixedBottom$lo2 !== void 0 ? _props$fixedBottom$lo2 : false);
21032
21109
  });
21033
21110
  var renderScrollLoading = function renderScrollLoading() {
21034
21111
  var _ctx$slots$fixedBotto3, _ctx$slots$fixedBotto4, _ctx$slots2;
@@ -21114,8 +21191,12 @@ function use_layout_objectSpread(e) { for (var r = 1; r < arguments.length; r++)
21114
21191
  var lineHeight = (0,external_vue_namespaceObject.ref)((_props$rowHeight = props.rowHeight) !== null && _props$rowHeight !== void 0 ? _props$rowHeight : LINE_HEIGHT);
21115
21192
  var headerRowCount = (0,external_vue_namespaceObject.ref)(1);
21116
21193
  var fixedBottomHeight = (0,external_vue_namespaceObject.computed)(function () {
21117
- var _props$fixedBottom, _props$fixedBottom$he, _props$fixedBottom2, _props$fixedBottom$he2, _props$fixedBottom3;
21118
- return ((_props$fixedBottom = props.fixedBottom) === null || _props$fixedBottom === void 0 ? void 0 : _props$fixedBottom.position) === 'relative' ? (_props$fixedBottom$he = (_props$fixedBottom2 = props.fixedBottom) === null || _props$fixedBottom2 === void 0 ? void 0 : _props$fixedBottom2.height) !== null && _props$fixedBottom$he !== void 0 ? _props$fixedBottom$he : LINE_HEIGHT : (_props$fixedBottom$he2 = (_props$fixedBottom3 = props.fixedBottom) === null || _props$fixedBottom3 === void 0 ? void 0 : _props$fixedBottom3.height) !== null && _props$fixedBottom$he2 !== void 0 ? _props$fixedBottom$he2 : 0;
21194
+ var _ctx$slots;
21195
+ if ((_ctx$slots = ctx.slots) !== null && _ctx$slots !== void 0 && _ctx$slots.fixedBottom) {
21196
+ var _props$fixedBottom, _props$fixedBottom$he, _props$fixedBottom2;
21197
+ return ((_props$fixedBottom = props.fixedBottom) === null || _props$fixedBottom === void 0 ? void 0 : _props$fixedBottom.position) === 'relative' ? (_props$fixedBottom$he = (_props$fixedBottom2 = props.fixedBottom) === null || _props$fixedBottom2 === void 0 ? void 0 : _props$fixedBottom2.height) !== null && _props$fixedBottom$he !== void 0 ? _props$fixedBottom$he : LINE_HEIGHT : 0;
21198
+ }
21199
+ return 0;
21119
21200
  });
21120
21201
  var _usePrefix = (0,config_provider_namespaceObject.usePrefix)(),
21121
21202
  resolveClassName = _usePrefix.resolveClassName;
@@ -21190,14 +21271,14 @@ function use_layout_objectSpread(e) { for (var r = 1; r < arguments.length; r++)
21190
21271
  return (0,shared_namespaceObject.classes)(defineProperty_defineProperty(defineProperty_defineProperty({}, resolveClassName('table-footer'), true), 'is-hidden', footHeight.value === 0));
21191
21272
  });
21192
21273
  var renderContainer = function renderContainer(childrend) {
21193
- var _ctx$slots$default, _ctx$slots;
21274
+ var _ctx$slots$default, _ctx$slots2;
21194
21275
  return (0,external_vue_namespaceObject.createVNode)("div", {
21195
21276
  "ref": refRoot,
21196
21277
  "style": tableStyle.value,
21197
21278
  "class": tableClass.value
21198
21279
  }, [childrend, (0,external_vue_namespaceObject.createVNode)(ghost_body, null, {
21199
21280
  "default": function _default() {
21200
- return [(_ctx$slots$default = (_ctx$slots = ctx.slots)["default"]) === null || _ctx$slots$default === void 0 ? void 0 : _ctx$slots$default.call(_ctx$slots)];
21281
+ return [(_ctx$slots$default = (_ctx$slots2 = ctx.slots)["default"]) === null || _ctx$slots$default === void 0 ? void 0 : _ctx$slots$default.call(_ctx$slots2)];
21201
21282
  }
21202
21283
  })]);
21203
21284
  };
@@ -21240,6 +21321,9 @@ function use_layout_objectSpread(e) { for (var r = 1; r < arguments.length; r++)
21240
21321
  var setBodyHeight = function setBodyHeight(height) {
21241
21322
  bodyHeight.value = height - headHeight.value - fixedBottomHeight.value - footHeight.value;
21242
21323
  };
21324
+ var setVirtualBodyHeight = function setVirtualBodyHeight(height) {
21325
+ bodyHeight.value = height;
21326
+ };
21243
21327
  var footHeight = (0,external_vue_namespaceObject.ref)(0);
21244
21328
  var footerStyle = (0,external_vue_namespaceObject.computed)(function () {
21245
21329
  return {
@@ -21299,11 +21383,11 @@ function use_layout_objectSpread(e) { for (var r = 1; r < arguments.length; r++)
21299
21383
  var fixedWrapperClass = resolveClassName('table-fixed');
21300
21384
  var fixedBottomRow = resolveClassName('table-fixed-bottom');
21301
21385
  var fixedBottomLoadingStyle = (0,external_vue_namespaceObject.computed)(function () {
21302
- var _props$fixedBottom$po, _props$fixedBottom4, _props$fixedBottom$he3, _props$fixedBottom5;
21386
+ var _props$fixedBottom$po, _props$fixedBottom3, _props$fixedBottom$he2, _props$fixedBottom4;
21303
21387
  return {
21304
21388
  minHeight: "".concat(lineHeight.value, "px"),
21305
- position: (_props$fixedBottom$po = (_props$fixedBottom4 = props.fixedBottom) === null || _props$fixedBottom4 === void 0 ? void 0 : _props$fixedBottom4.position) !== null && _props$fixedBottom$po !== void 0 ? _props$fixedBottom$po : 'absolute',
21306
- height: (_props$fixedBottom$he3 = (_props$fixedBottom5 = props.fixedBottom) === null || _props$fixedBottom5 === void 0 ? void 0 : _props$fixedBottom5.height) !== null && _props$fixedBottom$he3 !== void 0 ? _props$fixedBottom$he3 : null
21389
+ position: (_props$fixedBottom$po = (_props$fixedBottom3 = props.fixedBottom) === null || _props$fixedBottom3 === void 0 ? void 0 : _props$fixedBottom3.position) !== null && _props$fixedBottom$po !== void 0 ? _props$fixedBottom$po : 'absolute',
21390
+ height: (_props$fixedBottom$he2 = (_props$fixedBottom4 = props.fixedBottom) === null || _props$fixedBottom4 === void 0 ? void 0 : _props$fixedBottom4.height) !== null && _props$fixedBottom$he2 !== void 0 ? _props$fixedBottom$he2 : null
21307
21391
  };
21308
21392
  });
21309
21393
  (0,external_vue_namespaceObject.onMounted)(function () {
@@ -21375,6 +21459,7 @@ function use_layout_objectSpread(e) { for (var r = 1; r < arguments.length; r++)
21375
21459
  renderFooter: renderFooter,
21376
21460
  renderFixedBottom: renderFixedBottom,
21377
21461
  setBodyHeight: setBodyHeight,
21462
+ setVirtualBodyHeight: setVirtualBodyHeight,
21378
21463
  setFootHeight: setFootHeight,
21379
21464
  setTranslateX: setTranslateX,
21380
21465
  setDragOffsetX: setDragOffsetX,
@@ -21672,6 +21757,7 @@ const directives_namespaceObject = directives_x({ ["bkEllipsisInstance"]: () =>
21672
21757
  parentSetting: IOverflowTooltipPropType,
21673
21758
  title: shared_namespaceObject.PropTypes.string.def(undefined),
21674
21759
  observerResize: shared_namespaceObject.PropTypes.bool.def(true),
21760
+ intersectionObserver: shared_namespaceObject.PropTypes.bool.def(false),
21675
21761
  isHead: shared_namespaceObject.PropTypes.bool.def(false),
21676
21762
  isExpandChild: shared_namespaceObject.PropTypes.bool.def(false),
21677
21763
  headExplain: shared_namespaceObject.PropTypes.string,
@@ -21684,6 +21770,7 @@ const directives_namespaceObject = directives_x({ ["bkEllipsisInstance"]: () =>
21684
21770
  var slots = _ref.slots;
21685
21771
  var refRoot = (0,external_vue_namespaceObject.ref)();
21686
21772
  var isTipsEnabled = (0,external_vue_namespaceObject.ref)(false);
21773
+ var renderSlots = (0,external_vue_namespaceObject.ref)(!props.intersectionObserver);
21687
21774
  var cellStyle = (0,external_vue_namespaceObject.computed)(function () {
21688
21775
  return {
21689
21776
  textAlign: props.column.textAlign,
@@ -21846,7 +21933,8 @@ const directives_namespaceObject = directives_x({ ["bkEllipsisInstance"]: () =>
21846
21933
  bkEllipsisIns = null;
21847
21934
  }
21848
21935
  };
21849
- (0,external_vue_namespaceObject.onMounted)(function () {
21936
+ var resizeObserverIns = null;
21937
+ var onComponentRender = function onComponentRender() {
21850
21938
  var _resolveTooltipOption2 = resolveTooltipOption(),
21851
21939
  disabled = _resolveTooltipOption2.disabled,
21852
21940
  resizerWay = _resolveTooltipOption2.resizerWay,
@@ -21854,20 +21942,47 @@ const directives_namespaceObject = directives_x({ ["bkEllipsisInstance"]: () =>
21854
21942
  if (!disabled) {
21855
21943
  resolveOverflowTooltip();
21856
21944
  if (watchCellResize !== false && props.observerResize) {
21857
- var observerIns = observerResize(refRoot.value, function () {
21945
+ resizeObserverIns = observerResize(refRoot.value, function () {
21858
21946
  resolveOverflowTooltip();
21859
21947
  }, 60, true, resizerWay);
21860
- observerIns.start();
21861
- (0,external_vue_namespaceObject.onBeforeUnmount)(function () {
21862
- observerIns.disconnect();
21863
- observerIns = null;
21864
- });
21948
+ resizeObserverIns.start();
21949
+ }
21950
+ }
21951
+ };
21952
+ var intersectionObserver = null;
21953
+ var initObserver = function initObserver() {
21954
+ var _intersectionObserver;
21955
+ if (!props.intersectionObserver) {
21956
+ return;
21957
+ }
21958
+ intersectionObserver = new IntersectionObserver(function (entries) {
21959
+ if (entries[0].intersectionRatio <= 0) {
21960
+ var _bkEllipsisIns2;
21961
+ renderSlots.value = false;
21962
+ (_bkEllipsisIns2 = bkEllipsisIns) === null || _bkEllipsisIns2 === void 0 || _bkEllipsisIns2.destroyInstance(refRoot.value);
21963
+ return;
21865
21964
  }
21965
+ renderSlots.value = true;
21966
+ onComponentRender();
21967
+ }, {
21968
+ threshold: 0.5
21969
+ });
21970
+ (_intersectionObserver = intersectionObserver) === null || _intersectionObserver === void 0 || _intersectionObserver.observe(refRoot.value);
21971
+ };
21972
+ (0,external_vue_namespaceObject.onMounted)(function () {
21973
+ initObserver();
21974
+ if (!renderSlots.value) {
21975
+ return;
21866
21976
  }
21977
+ onComponentRender();
21867
21978
  });
21868
21979
  (0,external_vue_namespaceObject.onBeforeUnmount)(function () {
21869
- var _bkEllipsisIns2;
21870
- (_bkEllipsisIns2 = bkEllipsisIns) === null || _bkEllipsisIns2 === void 0 || _bkEllipsisIns2.destroyInstance(refRoot.value);
21980
+ var _resizeObserverIns, _bkEllipsisIns3, _intersectionObserver2;
21981
+ (_resizeObserverIns = resizeObserverIns) === null || _resizeObserverIns === void 0 || _resizeObserverIns.disconnect();
21982
+ resizeObserverIns = null;
21983
+ (_bkEllipsisIns3 = bkEllipsisIns) === null || _bkEllipsisIns3 === void 0 || _bkEllipsisIns3.destroyInstance(refRoot.value);
21984
+ (_intersectionObserver2 = intersectionObserver) === null || _intersectionObserver2 === void 0 || _intersectionObserver2.disconnect();
21985
+ intersectionObserver = null;
21871
21986
  });
21872
21987
  var hasExplain = props.headExplain || props.column.explain;
21873
21988
  return function () {
@@ -21876,7 +21991,7 @@ const directives_namespaceObject = directives_x({ ["bkEllipsisInstance"]: () =>
21876
21991
  "ref": refRoot,
21877
21992
  "style": cellStyle.value,
21878
21993
  "class": ['cell', props.column.type, hasExplain ? 'explain' : '']
21879
- }, [(_slots$default = slots["default"]) === null || _slots$default === void 0 ? void 0 : _slots$default.call(slots)]);
21994
+ }, [renderSlots.value ? (_slots$default = slots["default"]) === null || _slots$default === void 0 ? void 0 : _slots$default.call(slots) : '--']);
21880
21995
  };
21881
21996
  }
21882
21997
  }));
@@ -22913,7 +23028,7 @@ function use_head_isSlot(s) {
22913
23028
  "onClick": function onClick() {
22914
23029
  return handleColumnHeadClick();
22915
23030
  }
22916
- }, columns.resolveEventListener(column)), [renderHeadCell()]);
23031
+ }, columns.resolveEventListener(column, index)), [renderHeadCell()]);
22917
23032
  };
22918
23033
  return {
22919
23034
  getTH: getTH
@@ -23129,6 +23244,22 @@ function use_render_isSlot(s) {
23129
23244
  }, [renderColgroup(), renderHeader()]);
23130
23245
  };
23131
23246
  /** **************************************** Rows Render ******************************* **/
23247
+ var renderAppendLastRow = function renderAppendLastRow() {
23248
+ if (ctx.slots.appendLastRow) {
23249
+ var rowId = 'append-last-row';
23250
+ return (0,external_vue_namespaceObject.createVNode)(table_row, {
23251
+ "key": rowId
23252
+ }, {
23253
+ "default": function _default() {
23254
+ return [(0,external_vue_namespaceObject.createVNode)("tr", {
23255
+ "key": rowId
23256
+ }, [(0,external_vue_namespaceObject.createVNode)("td", {
23257
+ "colspan": columns.visibleColumns.length
23258
+ }, [ctx.slots.appendLastRow()])])];
23259
+ }
23260
+ });
23261
+ }
23262
+ };
23132
23263
  /**
23133
23264
  * 渲染Table Body
23134
23265
  * @returns
@@ -23141,7 +23272,7 @@ function use_render_isSlot(s) {
23141
23272
  var result = getRowRender(row, rowIndex, preRow, dataList, rowSpanMap, needRowSpan);
23142
23273
  preRow = row;
23143
23274
  return result;
23144
- })]);
23275
+ }), renderAppendLastRow()]);
23145
23276
  };
23146
23277
  var getRowHeight = function getRowHeight(row, rowIndex) {
23147
23278
  if (typeof props.rowHeight === 'function' || /^\d+/.test("".concat(props.rowHeight))) {
@@ -23343,6 +23474,7 @@ function use_render_isSlot(s) {
23343
23474
  "class": tdCtxClass,
23344
23475
  "column": column,
23345
23476
  "data-id": cellKey,
23477
+ "intersectionObserver": props.intersectionObserver,
23346
23478
  "isExpandChild": isChild,
23347
23479
  "observerResize": props.observerResize,
23348
23480
  "parentSetting": props.showOverflowTooltip,
@@ -23666,9 +23798,33 @@ var useRows = function useRows(props) {
23666
23798
  var setRowExpand = function setRowExpand(row, isExpand) {
23667
23799
  setRowAttribute(row, TABLE_ROW_ATTRIBUTE.ROW_EXPAND, isExpand);
23668
23800
  };
23801
+ /**
23802
+ * 分批渲染数据
23803
+ * @param rowList
23804
+ * @returns
23805
+ */
23806
+ var batchPushRowList = function batchPushRowList(rowList) {
23807
+ var startIndex = 0;
23808
+ var size = 50;
23809
+ var batchPushItem = function batchPushItem() {
23810
+ var endIndex = startIndex + size;
23811
+ pageRowList.push.apply(pageRowList, _toConsumableArray(rowList.slice(startIndex, endIndex)));
23812
+ if (endIndex < rowList.length) {
23813
+ startIndex = endIndex;
23814
+ setTimeout(function () {
23815
+ batchPushItem();
23816
+ });
23817
+ }
23818
+ };
23819
+ if (rowList.length > size) {
23820
+ batchPushItem();
23821
+ return;
23822
+ }
23823
+ pageRowList.push.apply(pageRowList, _toConsumableArray(rowList));
23824
+ };
23669
23825
  var setPageRowList = function setPageRowList(rowList) {
23670
23826
  pageRowList.length = 0;
23671
- pageRowList.push.apply(pageRowList, _toConsumableArray(rowList));
23827
+ batchPushRowList(rowList);
23672
23828
  };
23673
23829
  var clearSelection = function clearSelection() {
23674
23830
  tableRowList.value.forEach(function (row) {
@@ -61,7 +61,7 @@ export type ISortOption = {
61
61
  };
62
62
  export declare const ISortType: import("vue-types").VueTypeDef<ISortPropShape>;
63
63
  export type ISortShape = {
64
- sortFn?: (...args: any[]) => boolean;
64
+ sortFn?: (...args: any[]) => number;
65
65
  sortScope?: SortScope;
66
66
  value?: SORT_OPTION;
67
67
  };
@@ -558,6 +558,14 @@ export declare const tableProps: {
558
558
  } & {
559
559
  default: boolean;
560
560
  };
561
+ /**
562
+ * 是否使用IntersectionObserver监听表格Cell进如有可视区域再渲染
563
+ */
564
+ intersectionObserver: import("vue-types").VueTypeValidableDef<boolean> & {
565
+ default: boolean;
566
+ } & {
567
+ default: boolean;
568
+ };
561
569
  align: import("vue-types").VueTypeDef<"" | "left" | "right" | "center">;
562
570
  headerAlign: import("vue-types").VueTypeDef<"" | "left" | "right" | "center">;
563
571
  /**