bkui-vue 2.0.1-beta.56 → 2.0.1-beta.57.table.1

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.
@@ -17640,6 +17640,10 @@ var virtualRenderProps = _objectSpread({
17640
17640
  init: init,
17641
17641
  instance: instance,
17642
17642
  scrollTo: scrollTo,
17643
+ update: function update() {
17644
+ var _instance2;
17645
+ return (_instance2 = instance) === null || _instance2 === void 0 ? void 0 : _instance2.update();
17646
+ },
17643
17647
  updateScrollHeight: updateScrollHeight
17644
17648
  };
17645
17649
  });
@@ -17802,10 +17806,29 @@ var VisibleRender = /*#__PURE__*/function () {
17802
17806
  this.wrapper = el;
17803
17807
  var throttleDelay = binding.value.throttleDelay;
17804
17808
  this.delay = throttleDelay;
17809
+ this.delegateWrapper = undefined;
17805
17810
  }
17806
17811
  _createClass(VisibleRender, [{
17812
+ key: "scrollHeight",
17813
+ get: function get() {
17814
+ var _this$delegateWrapper, _this$delegateWrapper2, _this$wrapper;
17815
+ return (_this$delegateWrapper = (_this$delegateWrapper2 = this.delegateWrapper) === null || _this$delegateWrapper2 === void 0 ? void 0 : _this$delegateWrapper2.scrollHeight) !== null && _this$delegateWrapper !== void 0 ? _this$delegateWrapper : (_this$wrapper = this.wrapper) === null || _this$wrapper === void 0 ? void 0 : _this$wrapper.scrollHeight;
17816
+ }
17817
+ }, {
17818
+ key: "offsetHeight",
17819
+ get: function get() {
17820
+ var _this$delegateWrapper3, _this$delegateWrapper4, _this$wrapper2;
17821
+ return (_this$delegateWrapper3 = (_this$delegateWrapper4 = this.delegateWrapper) === null || _this$delegateWrapper4 === void 0 ? void 0 : _this$delegateWrapper4.offsetHeight) !== null && _this$delegateWrapper3 !== void 0 ? _this$delegateWrapper3 : (_this$wrapper2 = this.wrapper) === null || _this$wrapper2 === void 0 ? void 0 : _this$wrapper2.offsetHeight;
17822
+ }
17823
+ }, {
17824
+ key: "setDelegateWrapper",
17825
+ value: function setDelegateWrapper(el) {
17826
+ this.delegateWrapper = el;
17827
+ }
17828
+ }, {
17807
17829
  key: "render",
17808
17830
  value: function render(e) {
17831
+ var _this$delegateWrapper5;
17809
17832
  var _this$binding$value = this.binding.value,
17810
17833
  _this$binding$value$l = _this$binding$value.lineHeight,
17811
17834
  lineHeight = _this$binding$value$l === void 0 ? 30 : _this$binding$value$l,
@@ -17817,7 +17840,7 @@ var VisibleRender = /*#__PURE__*/function () {
17817
17840
  var _e$offset, _e$offset$x, _e$offset2;
17818
17841
  var elScrollTop = (_e$offset = e.offset) === null || _e$offset === void 0 ? void 0 : _e$offset.y;
17819
17842
  var elScrollLeft = (_e$offset$x = (_e$offset2 = e.offset) === null || _e$offset2 === void 0 ? void 0 : _e$offset2.x) !== null && _e$offset$x !== void 0 ? _e$offset$x : 0;
17820
- var bottom = this.wrapper.scrollHeight - this.wrapper.offsetHeight - elScrollTop;
17843
+ var bottom = this.scrollHeight - this.offsetHeight - elScrollTop;
17821
17844
  handleScrollCallback(e, null, null, elScrollTop, elScrollTop, elScrollLeft, {
17822
17845
  bottom: bottom >= 0 ? bottom : 0,
17823
17846
  scrollbar: e
@@ -17837,7 +17860,7 @@ var VisibleRender = /*#__PURE__*/function () {
17837
17860
  groupItemCount: groupItemCount,
17838
17861
  count: count,
17839
17862
  scrollLeft: scrollLeft
17840
- }, this.wrapper, e);
17863
+ }, (_this$delegateWrapper5 = this.delegateWrapper) !== null && _this$delegateWrapper5 !== void 0 ? _this$delegateWrapper5 : this.wrapper, e);
17841
17864
  }
17842
17865
  }, {
17843
17866
  key: "executeThrottledRender",
@@ -17847,14 +17870,14 @@ var VisibleRender = /*#__PURE__*/function () {
17847
17870
  }, {
17848
17871
  key: "install",
17849
17872
  value: function install() {
17850
- var _this$wrapper;
17851
- (_this$wrapper = this.wrapper) === null || _this$wrapper === void 0 || _this$wrapper.addEventListener('scroll', this.executeThrottledRender.bind(this));
17873
+ var _this$wrapper3;
17874
+ (_this$wrapper3 = this.wrapper) === null || _this$wrapper3 === void 0 || _this$wrapper3.addEventListener('scroll', this.executeThrottledRender.bind(this));
17852
17875
  }
17853
17876
  }, {
17854
17877
  key: "uninstall",
17855
17878
  value: function uninstall() {
17856
- var _this$wrapper2, _this$wrapper2$remove;
17857
- (_this$wrapper2 = this.wrapper) === null || _this$wrapper2 === void 0 || (_this$wrapper2$remove = _this$wrapper2.removeListener) === null || _this$wrapper2$remove === void 0 || _this$wrapper2$remove.call(_this$wrapper2, 'scroll', this.executeThrottledRender.bind(this));
17879
+ var _this$wrapper4, _this$wrapper4$remove;
17880
+ (_this$wrapper4 = this.wrapper) === null || _this$wrapper4 === void 0 || (_this$wrapper4$remove = _this$wrapper4.removeListener) === null || _this$wrapper4$remove === void 0 || _this$wrapper4$remove.call(_this$wrapper4, 'scroll', this.executeThrottledRender.bind(this));
17858
17881
  }
17859
17882
  }, {
17860
17883
  key: "setBinding",
@@ -18073,11 +18096,23 @@ function virtual_render_objectSpread(e) { for (var r = 1; r < arguments.length;
18073
18096
  rendAsTag = _useTagRender.rendAsTag;
18074
18097
  return rendAsTag;
18075
18098
  }
18099
+ var refRoot = (0,external_vue_namespaceObject.ref)(null);
18100
+ /** 如果有分组状态,计算总行数 */
18101
+ var listLength = (0,external_vue_namespaceObject.ref)(0);
18102
+ /** 实际高度,根据行高和总行数计算出来的实际高度 */
18103
+ var innerHeight = (0,external_vue_namespaceObject.ref)(0);
18104
+ var contentHeight = (0,external_vue_namespaceObject.ref)(0);
18105
+ var virtualRoot = (0,external_vue_namespaceObject.ref)(null);
18076
18106
  var getRowHeightArgs = function getRowHeightArgs(startIndex) {
18077
18107
  var start = startIndex * props.groupItemCount;
18078
18108
  var end = (startIndex + 1) * props.groupItemCount;
18109
+ if (end > listLength.value) {
18110
+ var count = end - start;
18111
+ end = listLength.value;
18112
+ start = end - count;
18113
+ }
18079
18114
  return {
18080
- index: startIndex,
18115
+ index: start,
18081
18116
  rows: props.list.slice(start, end),
18082
18117
  items: [start, end],
18083
18118
  type: 'virtual'
@@ -18101,17 +18136,11 @@ function virtual_render_objectSpread(e) { for (var r = 1; r < arguments.length;
18101
18136
  scrollbar: props.scrollbar
18102
18137
  };
18103
18138
  });
18104
- var refRoot = (0,external_vue_namespaceObject.ref)(null);
18105
- /** 如果有分组状态,计算总行数 */
18106
- var listLength = (0,external_vue_namespaceObject.ref)(0);
18107
- /** 实际高度,根据行高和总行数计算出来的实际高度 */
18108
- var innerHeight = (0,external_vue_namespaceObject.ref)(0);
18109
- var contentHeight = (0,external_vue_namespaceObject.ref)(0);
18110
- var virtualRoot = (0,external_vue_namespaceObject.ref)(null);
18111
18139
  var _useScrollbar = use_scrollbar(props),
18112
18140
  init = _useScrollbar.init,
18113
18141
  scrollTo = _useScrollbar.scrollTo,
18114
- updateScrollHeight = _useScrollbar.updateScrollHeight;
18142
+ updateScrollHeight = _useScrollbar.updateScrollHeight,
18143
+ update = _useScrollbar.update;
18115
18144
  var instance = null;
18116
18145
  var pagination = (0,external_vue_namespaceObject.reactive)({
18117
18146
  startIndex: 0,
@@ -18125,9 +18154,15 @@ function virtual_render_objectSpread(e) { for (var r = 1; r < arguments.length;
18125
18154
  groupItemCount: props.groupItemCount
18126
18155
  });
18127
18156
  var calcList = (0,external_vue_namespaceObject.ref)([]);
18128
- var getLastPageIndex = function getLastPageIndex() {
18157
+ var getOffsetHeight = function getOffsetHeight() {
18158
+ if (typeof props.height === 'number') {
18159
+ return props.height;
18160
+ }
18129
18161
  // @ts-ignore
18130
- var elHeight = virtualRoot.value.offsetHeight;
18162
+ return virtualRoot.value.offsetHeight;
18163
+ };
18164
+ var getLastPageIndex = function getLastPageIndex() {
18165
+ var elHeight = getOffsetHeight();
18131
18166
  var startIndex = Math.ceil(listLength.value / props.groupItemCount);
18132
18167
  var rowsHeight = 0;
18133
18168
  var lastHeight = 0;
@@ -18236,7 +18271,11 @@ function virtual_render_objectSpread(e) { for (var r = 1; r < arguments.length;
18236
18271
  top: 0
18237
18272
  };
18238
18273
  var el = refRoot.value;
18239
- computedVirtualIndex(props.lineHeight, handleScrollCallback, pagination, el, {
18274
+ var container = typeof props.height === 'number' ? {
18275
+ scrollHeight: innerHeight.value,
18276
+ offsetHeight: props.height
18277
+ } : el;
18278
+ computedVirtualIndex(props.lineHeight, handleScrollCallback, pagination, container, {
18240
18279
  target: el
18241
18280
  });
18242
18281
  };
@@ -18292,31 +18331,50 @@ function virtual_render_objectSpread(e) { for (var r = 1; r < arguments.length;
18292
18331
  };
18293
18332
  var _useFixTop = use_fix_top(props, scrollTo),
18294
18333
  fixToTop = _useFixTop.fixToTop;
18295
- (0,external_vue_namespaceObject.watch)(function () {
18296
- return [props.list];
18297
- }, function () {
18334
+ var setDelegateEl = function setDelegateEl() {
18298
18335
  var _instance3;
18299
- (_instance3 = instance) === null || _instance3 === void 0 || _instance3.setBinding(binding);
18336
+ var el = refRoot.value;
18337
+ var container = typeof props.height === 'number' ? {
18338
+ scrollHeight: innerHeight.value,
18339
+ offsetHeight: props.height
18340
+ } : el;
18341
+ (_instance3 = instance) === null || _instance3 === void 0 || _instance3.setDelegateWrapper(container);
18342
+ };
18343
+ var updateVirtualInstance = function updateVirtualInstance() {
18344
+ var _instance4;
18345
+ (_instance4 = instance) === null || _instance4 === void 0 || _instance4.setBinding(binding);
18300
18346
  handleChangeListConfig();
18301
18347
  updateScrollHeight(contentHeight.value);
18348
+ setDelegateEl();
18349
+ update();
18302
18350
  afterListDataReset();
18303
18351
  (0,external_vue_namespaceObject.nextTick)(function () {
18304
- var _instance4;
18305
- (_instance4 = instance) === null || _instance4 === void 0 || _instance4.executeThrottledRender.call(instance, {
18352
+ var _instance5;
18353
+ (_instance5 = instance) === null || _instance5 === void 0 || _instance5.executeThrottledRender.call(instance, {
18306
18354
  offset: {
18307
18355
  x: pagination.scrollLeft,
18308
18356
  y: pagination.scrollTop
18309
18357
  }
18310
18358
  });
18311
18359
  });
18360
+ };
18361
+ (0,external_vue_namespaceObject.watch)(function () {
18362
+ return props.height;
18363
+ }, function () {
18364
+ updateVirtualInstance();
18365
+ });
18366
+ (0,external_vue_namespaceObject.watch)(function () {
18367
+ return [props.list, props.list.length];
18368
+ }, function () {
18369
+ updateVirtualInstance();
18312
18370
  }, {
18313
- immediate: true,
18314
- deep: true
18371
+ immediate: true
18315
18372
  });
18316
18373
  ctx.expose({
18317
18374
  reset: reset,
18318
18375
  scrollTo: scrollTo,
18319
18376
  fixToTop: fixToTop,
18377
+ updateScroll: update,
18320
18378
  refRoot: refRoot,
18321
18379
  refContent: refRoot
18322
18380
  });
@@ -5,6 +5,7 @@ declare const _default: (props: VirtualRenderProps) => {
5
5
  init: (target: Ref<Partial<Element> & Partial<VirtualElement>>) => void;
6
6
  instance: BkScrollbar;
7
7
  scrollTo: (x: any, y: any) => void;
8
+ update: () => void;
8
9
  updateScrollHeight: (height: number) => void;
9
10
  };
10
11
  export default _default;
@@ -16,7 +16,11 @@ export declare class VisibleRender {
16
16
  private binding;
17
17
  private wrapper;
18
18
  private delay;
19
+ private delegateWrapper;
19
20
  constructor(binding: any, el: any);
21
+ get scrollHeight(): any;
22
+ get offsetHeight(): any;
23
+ setDelegateWrapper(el: any): void;
20
24
  render(e: any): void;
21
25
  executeThrottledRender(e: any): void;
22
26
  install(): void;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "bkui-vue",
3
- "version": "2.0.1-beta.56",
3
+ "version": "2.0.1-beta.57.table.1",
4
4
  "workspaces": [
5
5
  "packages/**",
6
6
  "scripts/cli",