bkui-vue 2.0.1-beta.57.table.1 → 2.0.1-beta.57.table.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.
package/lib/index.js CHANGED
@@ -4,5 +4,5 @@ export { default } from './preset';
4
4
  export * from './config-provider';
5
5
  export * from './directives';
6
6
  export * as plugins from './plugins';
7
- export const version = "2.0.1-beta.57.table.1";
7
+ export const version = "2.0.1-beta.57.table.2";
8
8
  window.__bkui_vue_version__ = version;
@@ -6,6 +6,7 @@ declare const _default: (props: TablePropTypes, ctx: any) => {
6
6
  renderBody: (list: any, childrend?: any, fixedRows?: any) => JSX.Element;
7
7
  renderFooter: (childrend?: any) => JSX.Element;
8
8
  renderFixedBottom: () => JSX.Element;
9
+ getBodyHeight: (height: any) => number;
9
10
  setBodyHeight: (height: number, withHeadFoot?: boolean) => void;
10
11
  setVirtualBodyHeight: (height: number) => void;
11
12
  setFootHeight: (height: number) => void;
@@ -21356,10 +21356,13 @@ function use_layout_objectSpread(e) { for (var r = 1; r < arguments.length; r++)
21356
21356
  }
21357
21357
  return null;
21358
21358
  });
21359
+ var getBodyHeight = function getBodyHeight(height) {
21360
+ return height - headHeight.value - fixedBottomHeight.value - footHeight.value;
21361
+ };
21359
21362
  var setBodyHeight = function setBodyHeight(height) {
21360
21363
  var withHeadFoot = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
21361
21364
  if (withHeadFoot) {
21362
- bodyHeight.value = height - headHeight.value - fixedBottomHeight.value - footHeight.value;
21365
+ bodyHeight.value = getBodyHeight(height);
21363
21366
  return;
21364
21367
  }
21365
21368
  bodyHeight.value = height;
@@ -21503,6 +21506,7 @@ function use_layout_objectSpread(e) { for (var r = 1; r < arguments.length; r++)
21503
21506
  renderBody: renderBody,
21504
21507
  renderFooter: renderFooter,
21505
21508
  renderFixedBottom: renderFixedBottom,
21509
+ getBodyHeight: getBodyHeight,
21506
21510
  setBodyHeight: setBodyHeight,
21507
21511
  setVirtualBodyHeight: setVirtualBodyHeight,
21508
21512
  setFootHeight: setFootHeight,
@@ -24442,6 +24446,7 @@ var useSettings = function useSettings(props, ctx, columns, afterSetting) {
24442
24446
  setOffsetRight = _useLayout.setOffsetRight,
24443
24447
  setHeaderRowCount = _useLayout.setHeaderRowCount,
24444
24448
  setLineHeight = _useLayout.setLineHeight,
24449
+ getBodyHeight = _useLayout.getBodyHeight,
24445
24450
  refBody = _useLayout.refBody,
24446
24451
  refRoot = _useLayout.refRoot;
24447
24452
  var scrollTo = function scrollTo() {
@@ -24613,8 +24618,17 @@ var useSettings = function useSettings(props, ctx, columns, afterSetting) {
24613
24618
  });
24614
24619
  });
24615
24620
  var setRowsBodyHeight = function setRowsBodyHeight() {
24616
- if (props.height === '100%') {
24617
- setBodyHeight(rows.getCurrentPageRowsHeight(), false);
24621
+ if (props.height === '100%' || props.height === 'auto') {
24622
+ var rowsHeight = rows.getCurrentPageRowsHeight();
24623
+ var bodyHeight = rowsHeight;
24624
+ if (/^\d+\.?\d*(px)?$/.test("".concat(props.maxHeight))) {
24625
+ var maxHeight = getBodyHeight(Number("".concat(props.maxHeight).replace('px', '')));
24626
+ if (bodyHeight > maxHeight) {
24627
+ setBodyHeight(maxHeight, false);
24628
+ return;
24629
+ }
24630
+ }
24631
+ setBodyHeight(bodyHeight, false);
24618
24632
  }
24619
24633
  };
24620
24634
  (0,external_vue_namespaceObject.watch)(function () {
@@ -24678,12 +24692,15 @@ var useSettings = function useSettings(props, ctx, columns, afterSetting) {
24678
24692
  }, {
24679
24693
  immediate: true
24680
24694
  });
24681
- (0,external_vue_namespaceObject.watch)(function () {
24682
- return [rows.pageRowList.length];
24683
- }, function () {
24684
- var _refBody$value2, _refBody$value2$updat;
24685
- scrollTo(undefined, 0);
24686
- refBody === null || refBody === void 0 || (_refBody$value2 = refBody.value) === null || _refBody$value2 === void 0 || (_refBody$value2$updat = _refBody$value2.updateScroll) === null || _refBody$value2$updat === void 0 || _refBody$value2$updat.call(_refBody$value2);
24695
+ var pageListLength = (0,external_vue_namespaceObject.computed)(function () {
24696
+ return rows.pageRowList.length;
24697
+ });
24698
+ (0,external_vue_namespaceObject.watch)(pageListLength, function (val, old) {
24699
+ if (val < old) {
24700
+ var _refBody$value2, _refBody$value2$updat;
24701
+ refBody === null || refBody === void 0 || (_refBody$value2 = refBody.value) === null || _refBody$value2 === void 0 || (_refBody$value2$updat = _refBody$value2.updateScroll) === null || _refBody$value2$updat === void 0 || _refBody$value2$updat.call(_refBody$value2);
24702
+ scrollTo(undefined, 0);
24703
+ }
24687
24704
  });
24688
24705
  ctx.expose({
24689
24706
  setRowExpand: rows.setRowExpand,
@@ -17624,16 +17624,18 @@ var virtualRenderProps = _objectSpread({
17624
17624
  });
17625
17625
  };
17626
17626
  var scrollTo = function scrollTo(x, y) {
17627
- instance.scrollTo({
17627
+ var _instance;
17628
+ (_instance = instance) === null || _instance === void 0 || _instance.scrollTo({
17628
17629
  x: x,
17629
17630
  y: y
17630
17631
  });
17631
17632
  };
17632
17633
  var updateScrollHeight = function updateScrollHeight(height) {
17633
- var _instance;
17634
- if ((_instance = instance) !== null && _instance !== void 0 && _instance.element) {
17635
- instance.element.scrollHeight = height;
17636
- instance.update();
17634
+ var _instance2;
17635
+ if ((_instance2 = instance) !== null && _instance2 !== void 0 && _instance2.element) {
17636
+ var _instance3, _instance4;
17637
+ ((_instance3 = instance) === null || _instance3 === void 0 ? void 0 : _instance3.element).scrollHeight = height;
17638
+ (_instance4 = instance) === null || _instance4 === void 0 || _instance4.update();
17637
17639
  }
17638
17640
  };
17639
17641
  return {
@@ -17641,8 +17643,8 @@ var virtualRenderProps = _objectSpread({
17641
17643
  instance: instance,
17642
17644
  scrollTo: scrollTo,
17643
17645
  update: function update() {
17644
- var _instance2;
17645
- return (_instance2 = instance) === null || _instance2 === void 0 ? void 0 : _instance2.update();
17646
+ var _instance5;
17647
+ return (_instance5 = instance) === null || _instance5 === void 0 ? void 0 : _instance5.update();
17646
17648
  },
17647
17649
  updateScrollHeight: updateScrollHeight
17648
17650
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "bkui-vue",
3
- "version": "2.0.1-beta.57.table.1",
3
+ "version": "2.0.1-beta.57.table.2",
4
4
  "workspaces": [
5
5
  "packages/**",
6
6
  "scripts/cli",