bkui-vue 2.0.2-beta.99 → 2.1.0-dev-beta.2

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.
@@ -2219,12 +2219,10 @@ function renderContent(opts) {
2219
2219
  theme = opts.theme,
2220
2220
  extCls = opts.extCls;
2221
2221
  var isLight = theme === 'light';
2222
- var zIndex = shared_namespaceObject.bkZIndexManager.getPopperIndex();
2223
2222
  var content = document.createElement('div');
2224
2223
  var prefix = document.documentElement.style.getPropertyValue('--bk-prefix') || 'bk';
2225
2224
  content.className = "".concat((0,shared_namespaceObject.resolveClassName)('popper', prefix), " ").concat(isLight ? 'light' : 'dark', " ").concat(extCls);
2226
2225
  content.innerText = value;
2227
- content.style.zIndex = String(zIndex);
2228
2226
  renderContext(value, content);
2229
2227
  if (hasArrow) {
2230
2228
  var arrow = renderArrow();
@@ -2303,6 +2301,7 @@ function show(el) {
2303
2301
  _opts$modifiers = opts.modifiers,
2304
2302
  modifiers = _opts$modifiers === void 0 ? [] : _opts$modifiers;
2305
2303
  if (disabled) return;
2304
+ popper.style.zIndex = String(shared_namespaceObject.bkZIndexManager.getPopperIndex());
2306
2305
  renderContext(content, popper);
2307
2306
  if (hasArrow) {
2308
2307
  var arrow = renderArrow();
@@ -2638,7 +2637,8 @@ var CELL_EVENT_TYPES = defineProperty_defineProperty(defineProperty_defineProper
2638
2637
  }
2639
2638
  applyResizeResultByWidth(latestClampedWidth);
2640
2639
  afterResize === null || afterResize === void 0 || afterResize();
2641
- handleMouseoutDragSection((_e$target = e.target) !== null && _e$target !== void 0 ? _e$target : null);
2640
+ var mouseUpTh = (_e$target = e.target) === null || _e$target === void 0 ? void 0 : _e$target.closest('th');
2641
+ handleMouseoutDragSection(mouseUpTh);
2642
2642
  cleanupDrag();
2643
2643
  };
2644
2644
  // rAF 驱动:mousemove 只记录最新坐标,每帧最多更新一次辅助线
@@ -2707,11 +2707,11 @@ var CELL_EVENT_TYPES = defineProperty_defineProperty(defineProperty_defineProper
2707
2707
  }
2708
2708
  preventSelection(e);
2709
2709
  var target = e.target;
2710
- removePointerClass(target);
2711
2710
  var th = target === null || target === void 0 ? void 0 : target.closest('th');
2712
2711
  if (!th) {
2713
2712
  return;
2714
2713
  }
2714
+ removePointerClass(th);
2715
2715
  var column = poinerPlacement === 'left' ? getPreColumn(mouseMoveColumn) : mouseMoveColumn;
2716
2716
  setColumnAttribute(column, const_COLUMN_ATTRIBUTE.COL_IS_DRAG, true);
2717
2717
  dragColumn = column;
@@ -2723,38 +2723,37 @@ var CELL_EVENT_TYPES = defineProperty_defineProperty(defineProperty_defineProper
2723
2723
  setNodeCursor(headTable);
2724
2724
  isMouseDown = true;
2725
2725
  };
2726
- var removePointerClass = function removePointerClass(target) {
2727
- var _target$parentElement;
2728
- 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');
2729
- targetElements.forEach(function (element) {
2726
+ var removePointerClass = function removePointerClass(th) {
2727
+ var tr = th === null || th === void 0 ? void 0 : th.closest('tr');
2728
+ var targetElements = tr === null || tr === void 0 ? void 0 : tr.querySelectorAll('.col-pointer-hover');
2729
+ targetElements === null || targetElements === void 0 || targetElements.forEach(function (element) {
2730
2730
  element === null || element === void 0 || element.classList.remove('col-pointer-hover');
2731
2731
  element === null || element === void 0 || element.classList.remove('poiner-left');
2732
2732
  element === null || element === void 0 || element.classList.remove('poiner-right');
2733
2733
  });
2734
2734
  };
2735
- var addPointerClass = function addPointerClass(target, poinerPlacement) {
2736
- var targetTh = target.parentElement;
2737
- targetTh === null || targetTh === void 0 || targetTh.classList.add('col-pointer-hover');
2738
- targetTh === null || targetTh === void 0 || targetTh.classList.add("poiner-".concat(poinerPlacement));
2739
- var nextTarget = poinerPlacement === 'right' ? targetTh.nextElementSibling : targetTh.previousElementSibling;
2735
+ var addPointerClass = function addPointerClass(th, poinerPlacement) {
2736
+ th === null || th === void 0 || th.classList.add('col-pointer-hover');
2737
+ th === null || th === void 0 || th.classList.add("poiner-".concat(poinerPlacement));
2738
+ var nextTarget = poinerPlacement === 'right' ? th.nextElementSibling : th.previousElementSibling;
2740
2739
  var nextPlacement = poinerPlacement === 'right' ? 'left' : 'right';
2741
2740
  nextTarget === null || nextTarget === void 0 || nextTarget.classList.add('col-pointer-hover');
2742
2741
  nextTarget === null || nextTarget === void 0 || nextTarget.classList.add("poiner-".concat(nextPlacement));
2743
2742
  };
2744
- var handleMouseoutDragSection = function handleMouseoutDragSection(target) {
2743
+ var handleMouseoutDragSection = function handleMouseoutDragSection(th) {
2745
2744
  if (!isDraging) {
2746
- if (target) {
2747
- target.classList.remove('cell-resize');
2748
- removePointerClass(target);
2745
+ if (th) {
2746
+ th.classList.remove('cell-resize');
2747
+ removePointerClass(th);
2749
2748
  }
2750
- if (target) {
2751
- cellCursorStore.set(target, false);
2749
+ if (th) {
2750
+ cellCursorStore.set(th, false);
2752
2751
  }
2753
2752
  document.removeEventListener('mousedown', handlemouseDownEvent);
2754
2753
  setDragOffset(-1000);
2755
2754
  }
2756
2755
  };
2757
- var handler = defineProperty_defineProperty(defineProperty_defineProperty({}, EVENTS.MOUSE_MOVE, function (e, column, index) {
2756
+ var handler = defineProperty_defineProperty(defineProperty_defineProperty({}, EVENTS.MOUSE_MOVE, function (e, column, _index) {
2758
2757
  if (isMouseDown) {
2759
2758
  isDraging = true;
2760
2759
  return;
@@ -2771,24 +2770,32 @@ var CELL_EVENT_TYPES = defineProperty_defineProperty(defineProperty_defineProper
2771
2770
  var thRect = th.getBoundingClientRect();
2772
2771
  var offsetWidth = thRect.width;
2773
2772
  var mouseOffsetX = e.clientX - thRect.left;
2774
- if (offsetWidth > 12 && (offsetWidth - mouseOffsetX < 8 || mouseOffsetX < 8 && index > 0)) {
2773
+ var colIndex = columns.getColumnIndex(column);
2774
+ var isFirstVisible = colIndex === 0;
2775
+ if (offsetWidth > 12 && (offsetWidth - mouseOffsetX < 8 || mouseOffsetX < 8 && !isFirstVisible)) {
2775
2776
  isInDragSection = true;
2776
2777
  poinerPlacement = mouseOffsetX < 8 ? 'left' : 'right';
2777
- if (!cellCursorStore.get(target)) {
2778
- cellCursorStore.set(target, true);
2779
- target.classList.add('cell-resize');
2780
- addPointerClass(target, poinerPlacement);
2778
+ if (!cellCursorStore.get(th)) {
2779
+ cellCursorStore.set(th, true);
2780
+ th.classList.add('cell-resize');
2781
+ addPointerClass(th, poinerPlacement);
2781
2782
  mouseMoveColumn = column;
2782
2783
  document.addEventListener('mousedown', handlemouseDownEvent);
2783
2784
  }
2784
2785
  } else {
2785
2786
  isInDragSection = false;
2786
- handleMouseoutDragSection(target);
2787
+ handleMouseoutDragSection(th);
2787
2788
  }
2788
2789
  }
2789
2790
  }), EVENTS.MOUSE_OUT, function (e, _column, _index) {
2790
2791
  var target = e.target;
2791
- handleMouseoutDragSection(target);
2792
+ var th = target === null || target === void 0 ? void 0 : target.closest('th');
2793
+ if (!th) return;
2794
+ var relatedTarget = e.relatedTarget;
2795
+ if (relatedTarget && th.contains(relatedTarget)) {
2796
+ return;
2797
+ }
2798
+ handleMouseoutDragSection(th);
2792
2799
  });
2793
2800
  var getEventName = function getEventName(event) {
2794
2801
  return "".concat(pluginName, "_").concat(event);
@@ -6010,6 +6017,10 @@ function use_layout_objectSpread(e) { for (var r = 1; r < arguments.length; r++)
6010
6017
  }
6011
6018
  return 0;
6012
6019
  });
6020
+ var wrapperBorderHeight = (0,external_vue_namespaceObject.computed)(function () {
6021
+ var borders = Array.isArray(props.border) ? props.border : typeof props.border === 'string' ? [props.border] : [];
6022
+ return borders.includes('outer') || borders.includes('horizontal') ? 2 : 0;
6023
+ });
6013
6024
  var _usePrefix = (0,config_provider_namespaceObject.usePrefix)(),
6014
6025
  resolveClassName = _usePrefix.resolveClassName;
6015
6026
  var _useScrollLoading = use_scroll_loading(props, ctx),
@@ -6018,9 +6029,10 @@ function use_layout_objectSpread(e) { for (var r = 1; r < arguments.length; r++)
6018
6029
  return (0,shared_namespaceObject.classes)(defineProperty_defineProperty({}, resolveClassName('table'), true), resolvePropBorderToClassStr(props.border));
6019
6030
  });
6020
6031
  var tableStyle = (0,external_vue_namespaceObject.computed)(function () {
6032
+ var maxH = resolveNumberOrStringToPix(props.maxHeight);
6021
6033
  return {
6022
6034
  height: resolveNumberOrStringToPix(props.height),
6023
- maxHeight: resolveNumberOrStringToPix(props.maxHeight),
6035
+ maxHeight: maxH === 'auto' ? undefined : maxH,
6024
6036
  minHeight: resolveNumberOrStringToPix(props.minHeight)
6025
6037
  };
6026
6038
  });
@@ -6124,17 +6136,19 @@ function use_layout_objectSpread(e) { for (var r = 1; r < arguments.length; r++)
6124
6136
  }
6125
6137
  return null;
6126
6138
  };
6127
- // 虚拟滚动需要可计算的 viewport 高度(否则 height 会随内容撑开,无法产生滚动条)
6128
- var bodyHeight = (0,external_vue_namespaceObject.ref)(props.virtualEnabled ? '100%' : 'auto');
6139
+ var hasMaxConstraint = props.maxHeight != null && props.maxHeight !== 'auto';
6140
+ var isMaxHeightNumericPx = /^\d+\.?\d*(px)?$/.test("".concat(props.maxHeight));
6141
+ var needsFixedViewport = props.virtualEnabled || props.height === 'auto' && hasMaxConstraint && isMaxHeightNumericPx;
6142
+ var bodyHeight = (0,external_vue_namespaceObject.ref)(needsFixedViewport ? '100%' : 'auto');
6129
6143
  var bodyMaxHeight = (0,external_vue_namespaceObject.computed)(function () {
6130
- if (/^\d+\.?\d*(px|%)$/.test("".concat(tableStyle.value.maxHeight))) {
6131
- var delHeight = footHeight.value + fixedBottomHeight.value;
6132
- return "calc(".concat(tableStyle.value.maxHeight, " - ").concat(delHeight, "px)");
6144
+ var maxH = tableStyle.value.maxHeight;
6145
+ if (!maxH || maxH === 'auto' || maxH === undefined) {
6146
+ return null;
6133
6147
  }
6134
- return null;
6148
+ return '100%';
6135
6149
  });
6136
6150
  var getBodyHeight = function getBodyHeight(height) {
6137
- return height - fixedBottomHeight.value - footHeight.value;
6151
+ return height - fixedBottomHeight.value - footHeight.value - wrapperBorderHeight.value;
6138
6152
  };
6139
6153
  var setBodyHeight = function setBodyHeight(height) {
6140
6154
  var withHeadFoot = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
@@ -6299,6 +6313,7 @@ function use_layout_objectSpread(e) { for (var r = 1; r < arguments.length; r++)
6299
6313
  initRootStyleVars: initRootStyleVars,
6300
6314
  // expose for plugins that need scroll offset (e.g. column resize indicator)
6301
6315
  translateX: translateX,
6316
+ headHeight: headHeight,
6302
6317
  refRoot: refRoot,
6303
6318
  refHead: refHead,
6304
6319
  refBody: refBody,
@@ -8733,10 +8748,13 @@ function use_render_isSlot(s) {
8733
8748
  var getRowRender = function getRowRender(row, rowIndex, preRow, rowList, rowSpanMap, needRowSpan) {
8734
8749
  var isChild = arguments.length > 6 && arguments[6] !== undefined ? arguments[6] : false;
8735
8750
  var rowLength = rowList.length;
8736
- var rowStyle = [].concat(_toConsumableArray(_formatPropAsArray(props.rowStyle, [row, rowIndex])), [{
8737
- '--row-height': "".concat(getRowHeight(row, rowIndex), "px")
8751
+ var rowHeightPx = "".concat(getRowHeight(row, rowIndex), "px");
8752
+ var rowStyle = [].concat(_toConsumableArray(_formatPropAsArray(props.rowStyle, [row, rowIndex])), [props.rowHeight === 'auto' ? {
8753
+ '--row-min-height': rowHeightPx
8754
+ } : {
8755
+ '--row-height': rowHeightPx
8738
8756
  }]);
8739
- var rowClass = [].concat(_toConsumableArray(_formatPropAsArray(props.rowClass, [row, rowIndex])), ["hover-".concat(props.rowHover), rowIndex % 2 === 1 && props.stripe ? 'stripe-row' : '']);
8757
+ var rowClass = [].concat(_toConsumableArray(_formatPropAsArray(props.rowClass, [row, rowIndex])), ["hover-".concat(props.rowHover), rowIndex % 2 === 1 && props.stripe ? 'stripe-row' : '', props.rowHeight === 'auto' ? 'row-height-auto' : '']);
8740
8758
  var rowId = rows.getRowAttribute(row, const_TABLE_ROW_ATTRIBUTE.ROW_UID);
8741
8759
  return [(0,external_vue_namespaceObject.createVNode)(table_row, {
8742
8760
  "key": rowId
@@ -8978,6 +8996,9 @@ var useRows = function useRows(props) {
8978
8996
  return false;
8979
8997
  };
8980
8998
  var getSelfRowHeight = function getSelfRowHeight(row, rowIndex, type) {
8999
+ if (props.rowHeight === 'auto') {
9000
+ return LINE_HEIGHT;
9001
+ }
8981
9002
  if (typeof props.rowHeight === 'function' || /^\d+/.test("".concat(props.rowHeight))) {
8982
9003
  return _resolvePropVal(props, 'rowHeight', [{
8983
9004
  index: rowIndex,
@@ -9713,6 +9734,7 @@ var useSettings = function useSettings(props, ctx, columns, afterSetting) {
9713
9734
  setHeaderRowCount = _useLayout.setHeaderRowCount,
9714
9735
  setLineHeight = _useLayout.setLineHeight,
9715
9736
  getBodyHeight = _useLayout.getBodyHeight,
9737
+ headHeight = _useLayout.headHeight,
9716
9738
  refBody = _useLayout.refBody,
9717
9739
  refRoot = _useLayout.refRoot,
9718
9740
  translateX = _useLayout.translateX;
@@ -9723,11 +9745,14 @@ var useSettings = function useSettings(props, ctx, columns, afterSetting) {
9723
9745
  }
9724
9746
  return (_refBody$value = refBody.value) === null || _refBody$value === void 0 ? void 0 : _refBody$value.scrollTo.apply(_refBody$value, args);
9725
9747
  };
9748
+ if (props.rowHeight === 'auto' && props.virtualEnabled) {
9749
+ console.warn('[BkTable] rowHeight="auto" 与 virtualEnabled 不兼容:虚拟滚动依赖固定行高计算,auto 模式下行高由内容决定,滚动位置将不准确。请勿同时使用。');
9750
+ }
9726
9751
  if (typeof props.rowHeight === 'function') {
9727
9752
  setLineHeight(function (args) {
9728
9753
  return rows.getRowHeight(args.rows[0], args.index);
9729
9754
  });
9730
- } else {
9755
+ } else if (props.rowHeight !== 'auto') {
9731
9756
  setLineHeight(props.rowHeight);
9732
9757
  }
9733
9758
  /**
@@ -9741,7 +9766,7 @@ var useSettings = function useSettings(props, ctx, columns, afterSetting) {
9741
9766
  if ((checked === null || checked === void 0 ? void 0 : checked.length) > 0) {
9742
9767
  scrollTo(0, 0);
9743
9768
  }
9744
- if (typeof props.rowHeight !== 'function') {
9769
+ if (typeof props.rowHeight !== 'function' && props.rowHeight !== 'auto') {
9745
9770
  rows.setRowHeight(height);
9746
9771
  setLineHeight(height);
9747
9772
  }
@@ -9860,18 +9885,105 @@ var useSettings = function useSettings(props, ctx, columns, afterSetting) {
9860
9885
  });
9861
9886
  return renderList;
9862
9887
  });
9888
+ var isNumericPx = function isNumericPx(val) {
9889
+ return /^\d+\.?\d*(px)?$/.test("".concat(val));
9890
+ };
9891
+ var hasMaxHeightConstraint = function hasMaxHeightConstraint() {
9892
+ return props.maxHeight != null && props.maxHeight !== 'auto';
9893
+ };
9863
9894
  var footHeight = (0,external_vue_namespaceObject.computed)(function () {
9864
9895
  return pagination.isShowPagination.value ? props.paginationHeight : 0;
9865
9896
  });
9866
9897
  var hasNonPxHeight = function hasNonPxHeight() {
9867
- return props.height != null && props.height !== 'auto' && !/^\d+\.?\d*(px)?$/.test("".concat(props.height));
9898
+ return props.height != null && props.height !== 'auto' && !isNumericPx(props.height);
9899
+ };
9900
+ var needsDynamicBodyHeight = function needsDynamicBodyHeight() {
9901
+ return props.virtualEnabled || hasNonPxHeight() || props.height === 'auto' && hasMaxHeightConstraint();
9902
+ };
9903
+ /**
9904
+ * 计算滚动容器内的实际内容总高度
9905
+ * 滚动容器 (.bk-table-body) 内包含:
9906
+ * 1. 表头 — 由 showHead 控制是否展示,高度 = headHeight(受 headHeight/thead props) × headerRowCount(多级表头)
9907
+ * 2. 数据行 — 高度 = 各行行高之和(受 rowHeight prop 和行数据影响)
9908
+ *
9909
+ * rowHeight='auto' 时每行 schema 存储的是估算值(LINE_HEIGHT=42),
9910
+ * 不反映实际渲染高度,故改为从 DOM 读取 scrollHeight 获得真实内容高度。
9911
+ */
9912
+ var getScrollContentHeight = function getScrollContentHeight() {
9913
+ var _refBody$value3;
9914
+ var scrollEl = (_refBody$value3 = refBody.value) === null || _refBody$value3 === void 0 ? void 0 : _refBody$value3.refRoot;
9915
+ if (props.rowHeight === 'auto') {
9916
+ if (scrollEl && scrollEl.scrollHeight > 0) {
9917
+ return scrollEl.scrollHeight;
9918
+ }
9919
+ }
9920
+ var rowsHeight = rows.getCurrentPageRowsHeight();
9921
+ var scrollHeaderHeight = props.showHead ? headHeight.value : 0;
9922
+ var calculatedHeight = rowsHeight + scrollHeaderHeight;
9923
+ if (rows.pageRowList.length === 0) {
9924
+ if (scrollEl && scrollEl.scrollHeight > calculatedHeight) {
9925
+ return scrollEl.scrollHeight;
9926
+ }
9927
+ }
9928
+ return calculatedHeight;
9929
+ };
9930
+ /**
9931
+ * 获取外层容器的最大可用高度
9932
+ *
9933
+ * 当 height="auto" + 非像素值 maxHeight(如 calc(100vh - 180px))时,
9934
+ * root 容器的 offsetHeight 会因 height:auto 随内容缩小,
9935
+ * 导致异步加载数据后 offsetHeight 反映的是缩小后的高度而非实际可用空间。
9936
+ *
9937
+ * 此函数通过 getComputedStyle 获取浏览器解析后的 maxHeight 真实像素值,
9938
+ * 作为计算可用空间的天花板,打破循环依赖。
9939
+ *
9940
+ * 对于像素值 maxHeight,直接使用该数值(无循环依赖问题)。
9941
+ * 对于非 auto 的固定 height,使用 offsetHeight(不会缩小)。
9942
+ */
9943
+ var getMaxContainerHeight = function getMaxContainerHeight() {
9944
+ if (!(0,isElement_namespaceObject["default"])(refRoot.value) || refRoot.value.offsetHeight <= 0) return 0;
9945
+ if (isNumericPx(props.maxHeight)) {
9946
+ return Number("".concat(props.maxHeight).replace('px', ''));
9947
+ }
9948
+ if (props.height === 'auto' && hasMaxHeightConstraint()) {
9949
+ var resolved = parseFloat(getComputedStyle(refRoot.value).maxHeight);
9950
+ if (!isNaN(resolved) && resolved > 0) return resolved;
9951
+ }
9952
+ return refRoot.value.offsetHeight;
9953
+ };
9954
+ /**
9955
+ * 计算 height="auto" + maxHeight 模式下滚动容器的高度
9956
+ *
9957
+ * 可用空间 = getMaxContainerHeight() - 分页器(paginationHeight) - fixedBottom - 边框
9958
+ * 由 getBodyHeight 统一计算,内部已根据各 props 动态得出
9959
+ *
9960
+ * 最终高度 = min(内容高度, 可用空间)
9961
+ * 内容 < 可用空间 → 不出现滚动条
9962
+ * 内容 > 可用空间 → 限制在可用空间内,出现滚动条
9963
+ */
9964
+ var resolveContentAwareBodyHeight = function resolveContentAwareBodyHeight() {
9965
+ var containerHeight = getMaxContainerHeight();
9966
+ if (containerHeight <= 0) return false;
9967
+ var contentHeight = getScrollContentHeight();
9968
+ var availableHeight = getBodyHeight(containerHeight);
9969
+ if (availableHeight > 0 && contentHeight > 0) {
9970
+ setBodyHeight(Math.min(contentHeight, availableHeight), false);
9971
+ return true;
9972
+ }
9973
+ return false;
9868
9974
  };
9869
9975
  var setTableFootHeight = function setTableFootHeight() {
9870
9976
  setFootHeight(footHeight.value);
9871
- if (/^\d+\.?\d*(px)?$/.test("".concat(props.height))) {
9977
+ if (isNumericPx(props.height)) {
9872
9978
  setBodyHeight(Number("".concat(props.height).replace('px', '')));
9873
- } else if (hasNonPxHeight() && (0,isElement_namespaceObject["default"])(refRoot.value) && refRoot.value.offsetHeight > 0) {
9874
- setBodyHeight(refRoot.value.offsetHeight);
9979
+ } else if (needsDynamicBodyHeight() && (0,isElement_namespaceObject["default"])(refRoot.value) && refRoot.value.offsetHeight > 0) {
9980
+ if (props.height === 'auto' && hasMaxHeightConstraint()) {
9981
+ if (!resolveContentAwareBodyHeight()) {
9982
+ setBodyHeight(refRoot.value.offsetHeight);
9983
+ }
9984
+ } else {
9985
+ setBodyHeight(refRoot.value.offsetHeight);
9986
+ }
9875
9987
  }
9876
9988
  };
9877
9989
  var scrollTo00 = (0,external_vue_namespaceObject.ref)(false);
@@ -9906,21 +10018,25 @@ var useSettings = function useSettings(props, ctx, columns, afterSetting) {
9906
10018
  use_observer_resize(refRoot, function () {
9907
10019
  if (!observerResizing.value) {
9908
10020
  observerResizing.value = true;
9909
- if ((props.virtualEnabled || hasNonPxHeight()) && (0,isElement_namespaceObject["default"])(refRoot.value)) {
10021
+ if (needsDynamicBodyHeight() && (0,isElement_namespaceObject["default"])(refRoot.value)) {
9910
10022
  if (isResizeBodyHeight.value) {
9911
10023
  setTimeout(function () {
9912
10024
  isResizeBodyHeight.value = false;
9913
10025
  });
9914
10026
  return;
9915
10027
  }
9916
- var tableHeight = refRoot.value.offsetHeight;
9917
10028
  isResizeBodyHeight.value = true;
9918
- setBodyHeight(tableHeight);
10029
+ if (props.height === 'auto' && hasMaxHeightConstraint()) {
10030
+ if (!resolveContentAwareBodyHeight()) {
10031
+ setBodyHeight(refRoot.value.offsetHeight);
10032
+ }
10033
+ } else {
10034
+ setBodyHeight(refRoot.value.offsetHeight);
10035
+ }
9919
10036
  setOffsetRight();
9920
10037
  }
9921
10038
  computedColumnRect();
9922
10039
  setOffsetRight();
9923
- scrollTo(0, 0);
9924
10040
  return;
9925
10041
  }
9926
10042
  observerResizingTimer && clearTimeout(observerResizingTimer);
@@ -9929,18 +10045,15 @@ var useSettings = function useSettings(props, ctx, columns, afterSetting) {
9929
10045
  });
9930
10046
  });
9931
10047
  var setRowsBodyHeight = function setRowsBodyHeight() {
9932
- if (props.virtualEnabled) {
9933
- // 虚拟滚动下,VirtualRender 的 height 应表达“可视窗口高度”,不应被内容总高度覆盖
9934
- // - 当显式设置了 props.height(px/number)时,bodyHeight 已由 setTableFootHeight / resize 逻辑维护
9935
- // - 当显式设置了 props.maxHeight(px/number)时,可按内容高度与 maxHeight 取最小值(短列表不出现滚动条)
9936
- // - 其他情况保持现有 bodyHeight(通常来自 resize observer 或 '100%')
9937
- if (/^\d+\.?\d*(px)?$/.test("".concat(props.height))) {
9938
- return;
9939
- }
9940
- if (/^\d+\.?\d*(px)?$/.test("".concat(props.maxHeight))) {
9941
- var rowsHeight = rows.getCurrentPageRowsHeight();
9942
- var maxHeight = getBodyHeight(Number("".concat(props.maxHeight).replace('px', '')));
9943
- setBodyHeight(Math.min(rowsHeight, maxHeight), false);
10048
+ if (isNumericPx(props.height)) {
10049
+ return;
10050
+ }
10051
+ if (hasMaxHeightConstraint()) {
10052
+ if (!resolveContentAwareBodyHeight()) {
10053
+ var contentHeight = getScrollContentHeight();
10054
+ if (contentHeight > 0) {
10055
+ setBodyHeight(contentHeight, false);
10056
+ }
9944
10057
  }
9945
10058
  }
9946
10059
  };
@@ -9983,6 +10096,9 @@ var useSettings = function useSettings(props, ctx, columns, afterSetting) {
9983
10096
  return [pagination.isShowPagination.value];
9984
10097
  }, function () {
9985
10098
  setTableFootHeight();
10099
+ (0,external_vue_namespaceObject.nextTick)(function () {
10100
+ return scrollTo(0, 0);
10101
+ });
9986
10102
  }, {
9987
10103
  immediate: true
9988
10104
  });
@@ -10019,8 +10135,8 @@ var useSettings = function useSettings(props, ctx, columns, afterSetting) {
10019
10135
  });
10020
10136
  (0,external_vue_namespaceObject.watch)(pageListLength, function (val, old) {
10021
10137
  if (val < old) {
10022
- var _refBody$value3, _refBody$value3$updat;
10023
- refBody === null || refBody === void 0 || (_refBody$value3 = refBody.value) === null || _refBody$value3 === void 0 || (_refBody$value3$updat = _refBody$value3.updateScroll) === null || _refBody$value3$updat === void 0 || _refBody$value3$updat.call(_refBody$value3);
10138
+ var _refBody$value4, _refBody$value4$updat;
10139
+ refBody === null || refBody === void 0 || (_refBody$value4 = refBody.value) === null || _refBody$value4 === void 0 || (_refBody$value4$updat = _refBody$value4.updateScroll) === null || _refBody$value4$updat === void 0 || _refBody$value4$updat.call(_refBody$value4);
10024
10140
  scrollTo(undefined, 0);
10025
10141
  }
10026
10142
  });
@@ -144,7 +144,7 @@ export type SpanFunctionString = (({ column, colIndex, row, rowIndex }: {
144
144
  export declare const SpanFunctionStringType: import("vue-types").VueTypeDef<SpanFunctionString>;
145
145
  export type RowClassFunctionString = ((row: Record<string, object>) => string) | string;
146
146
  export declare const RowClassFunctionStringType: import("vue-types").VueTypeDef<RowClassFunctionString>;
147
- export type RowHeightFunctionNumber = ((type: string, row: Record<string, object>, rowIndex: number, size?: any) => number) | number;
147
+ export type RowHeightFunctionNumber = ((type: string, row: Record<string, object>, rowIndex: number, size?: any) => number) | number | 'auto';
148
148
  export declare const RowHeightFunctionNumberType: import("vue-types").VueTypeDef<RowHeightFunctionNumber>;
149
149
  type FunctionNumber = ((...args: any[]) => void) | number;
150
150
  export declare const FunctionNumberType: import("vue-types").VueTypeDef<FunctionNumber>;
@@ -1096,12 +1096,10 @@
1096
1096
  .bk-table {
1097
1097
  position: relative;
1098
1098
  width: 100%;
1099
- height: 100%;
1100
1099
  overflow: hidden;
1101
1100
  border-spacing: 0;
1102
1101
  display: flex;
1103
1102
  flex-direction: column;
1104
- max-height: fit-content;
1105
1103
  }
1106
1104
  .bk-table .bk-table-body {
1107
1105
  position: relative;
@@ -1122,8 +1120,10 @@
1122
1120
  .bk-table .bk-table-body-wrapper {
1123
1121
  position: relative;
1124
1122
  width: 100%;
1125
- height: 100%;
1123
+ flex: 1 1 auto;
1124
+ min-height: 0;
1126
1125
  overflow: hidden;
1126
+ font-size: 0;
1127
1127
  }
1128
1128
  .bk-table .bk-table-body-wrapper .bk-table-head-settings-wrapper {
1129
1129
  position: absolute;
@@ -1392,6 +1392,10 @@
1392
1392
  transform-origin: center;
1393
1393
  content: '';
1394
1394
  }
1395
+ .bk-table .bk-table-head table thead th.cell-resize,
1396
+ .bk-table .bk-table-body table thead th.cell-resize {
1397
+ cursor: col-resize;
1398
+ }
1395
1399
  .bk-table .bk-table-head table thead th .cell,
1396
1400
  .bk-table .bk-table-body table thead th .cell {
1397
1401
  display: flex;
@@ -1399,10 +1403,6 @@
1399
1403
  height: calc(var(--row-height) - 2px);
1400
1404
  color: #313238;
1401
1405
  }
1402
- .bk-table .bk-table-head table thead th .cell.cell-resize,
1403
- .bk-table .bk-table-body table thead th .cell.cell-resize {
1404
- cursor: col-resize;
1405
- }
1406
1406
  .bk-table .bk-table-head table:not(.col-resize-hover) thead th.active,
1407
1407
  .bk-table .bk-table-body table:not(.col-resize-hover) thead th.active,
1408
1408
  .bk-table .bk-table-head table:not(.col-resize-hover) thead th:hover,
@@ -1418,6 +1418,10 @@
1418
1418
  .bk-table .bk-table-body table tbody tr.stripe-row td {
1419
1419
  background-color: #fafbfd;
1420
1420
  }
1421
+ .bk-table .bk-table-head table tbody tr:last-child td,
1422
+ .bk-table .bk-table-body table tbody tr:last-child td {
1423
+ border-bottom: none;
1424
+ }
1421
1425
  .bk-table .bk-table-head table tbody tr td,
1422
1426
  .bk-table .bk-table-body table tbody tr td {
1423
1427
  background-color: #fff;
@@ -1442,6 +1446,23 @@
1442
1446
  text-align: center;
1443
1447
  cursor: move;
1444
1448
  }
1449
+ .bk-table .bk-table-head table tbody tr.row-height-auto td,
1450
+ .bk-table .bk-table-body table tbody tr.row-height-auto td {
1451
+ height: auto !important;
1452
+ min-height: var(--row-min-height, 42px);
1453
+ }
1454
+ .bk-table .bk-table-head table tbody tr.row-height-auto td .cell,
1455
+ .bk-table .bk-table-body table tbody tr.row-height-auto td .cell {
1456
+ display: flex;
1457
+ align-items: center;
1458
+ height: auto;
1459
+ min-height: calc(var(--row-min-height, 42px) - 4px);
1460
+ white-space: normal;
1461
+ overflow: visible;
1462
+ text-overflow: unset;
1463
+ word-break: break-word;
1464
+ line-height: normal;
1465
+ }
1445
1466
  .bk-table .bk-table-head table tbody tr:hover.hover-highlight td:not(.empty-cell),
1446
1467
  .bk-table .bk-table-body table tbody tr:hover.hover-highlight td:not(.empty-cell) {
1447
1468
  background: #f5f7fa;
@@ -1502,22 +1523,46 @@
1502
1523
  .bk-table .bk-table-footer.is-hidden {
1503
1524
  display: none;
1504
1525
  }
1526
+ .bk-table .bk-table-footer:not(.is-hidden) {
1527
+ border-top: 1px solid #dcdee5;
1528
+ }
1505
1529
  .bk-table.bordered-row .bk-table-head {
1506
1530
  border-bottom: 1px solid #dcdee5;
1507
1531
  }
1508
1532
  .bk-table.bordered-row .bk-table-body tbody tr td {
1509
1533
  border-bottom-color: #dcdee5;
1510
1534
  }
1511
- .bk-table.bordered-outer {
1535
+ .bk-table.bordered-outer .bk-table-body-wrapper {
1512
1536
  border: 1px solid #dcdee5;
1537
+ border-radius: 2px;
1538
+ box-sizing: border-box;
1539
+ }
1540
+ .bk-table.bordered-outer .bk-table-footer:not(.is-hidden) {
1541
+ border-left: 1px solid #dcdee5;
1542
+ border-right: 1px solid #dcdee5;
1543
+ border-bottom: 1px solid #dcdee5;
1544
+ border-radius: 0 0 2px 2px;
1545
+ box-sizing: border-box;
1546
+ }
1547
+ .bk-table.bordered-outer .bk-table-body-wrapper:has( ~ .bk-table-footer:not(.is-hidden)) {
1548
+ border-bottom: none;
1549
+ border-radius: 2px 2px 0 0;
1513
1550
  }
1514
- .bk-table.bordered-horizontal {
1551
+ .bk-table.bordered-horizontal .bk-table-body-wrapper {
1515
1552
  border-top: 1px solid #dcdee5;
1516
1553
  border-bottom: 1px solid #dcdee5;
1554
+ box-sizing: border-box;
1517
1555
  }
1518
- .bk-table.bordered-outer .__is-empty .bk-table-body-content,
1519
- .bk-table.bordered-horizontal .__is-empty .bk-table-body-content {
1556
+ .bk-table.bordered-horizontal .bk-table-footer:not(.is-hidden) {
1520
1557
  border-bottom: 1px solid #dcdee5;
1558
+ box-sizing: border-box;
1559
+ }
1560
+ .bk-table.bordered-horizontal .bk-table-body-wrapper:has( ~ .bk-table-footer:not(.is-hidden)) {
1561
+ border-bottom: none;
1562
+ }
1563
+ .bk-table.bordered-outer .bk-table-body tbody tr:last-child td,
1564
+ .bk-table.bordered-horizontal .bk-table-body tbody tr:last-child td {
1565
+ border-bottom-color: white;
1521
1566
  }
1522
1567
  .bk-table.bordered-col .bk-table-head {
1523
1568
  border-right: 1px solid #dcdee5;
@@ -1543,6 +1588,12 @@
1543
1588
  .bk-table.bordered-col .bk-table-body tbody tr:hover.hover-highlight td:not(.empty-cell) {
1544
1589
  border-right-color: #dcdee5;
1545
1590
  }
1591
+ .bk-table.bordered-col.bordered-outer .bk-table-head {
1592
+ border-right: none;
1593
+ }
1594
+ .bk-table.bordered-col.bordered-outer .bk-table-body {
1595
+ border-right: none;
1596
+ }
1546
1597
  .bk-table th,
1547
1598
  .bk-table td {
1548
1599
  border-right: 1px solid white;