bkui-vue 0.0.2-beta.95 → 0.0.2-beta.97

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.
@@ -5441,7 +5441,7 @@ function use_render_objectSpread(target) { for (var i = 1; i < arguments.length;
5441
5441
  function use_render_isSlot(s) {
5442
5442
  return typeof s === 'function' || Object.prototype.toString.call(s) === '[object Object]' && !(0,external_vue_namespaceObject.isVNode)(s);
5443
5443
  }
5444
- /* harmony default export */ const use_render = (function (props, context, tableResp, styleRef, head) {
5444
+ /* harmony default export */ const use_render = (function (props, context, tableResp, styleRef, head, root, resetTableHeight) {
5445
5445
  var t = (0,external_config_provider_namespaceObject.useLocale)('table');
5446
5446
  var uuid = (0,node_modules_uuid.v4)();
5447
5447
  var formatData = (0,external_vue_namespaceObject.computed)(function () {
@@ -5483,6 +5483,9 @@ function use_render_isSlot(s) {
5483
5483
  tableResp.formatData.settings.height = height;
5484
5484
  if (checked.length) {
5485
5485
  tableResp.setColumnAttributeBySettings(props.settings, checked);
5486
+ (0,external_vue_namespaceObject.nextTick)(function () {
5487
+ resetTableHeight(root.value);
5488
+ });
5486
5489
  }
5487
5490
  context.emit(EMIT_EVENTS.SETTING_CHANGE, {
5488
5491
  checked: checked,
@@ -6266,7 +6269,7 @@ function table_objectSpread(target) { for (var i = 1; i < arguments.length; i++)
6266
6269
  hasScrollY: hasScrollYRef.value
6267
6270
  };
6268
6271
  });
6269
- var _useRender = use_render(props, ctx, tableSchema, styleRef, head),
6272
+ var _useRender = use_render(props, ctx, tableSchema, styleRef, head, root, resetTableHeight),
6270
6273
  renderTableBodySchema = _useRender.renderTableBodySchema,
6271
6274
  renderTableFooter = _useRender.renderTableFooter,
6272
6275
  renderTableHeadSchema = _useRender.renderTableHeadSchema;
@@ -228,9 +228,7 @@ declare const _default: import("vue").DefineComponent<{
228
228
  rowIndex: number;
229
229
  columnIndex: number;
230
230
  }) => boolean;
231
- rowMouseEnter: (_e: MouseEvent, _row: any, _index: number, _rows: any[], _this: any) => boolean; /**
232
- * 确保在所有数据渲染完毕再执行fix column计算
233
- */
231
+ rowMouseEnter: (_e: MouseEvent, _row: any, _index: number, _rows: any[], _this: any) => boolean;
234
232
  rowMouseLeave: (_e: MouseEvent, _row: any, _index: number, _rows: any[], _this: any) => boolean;
235
233
  }, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
236
234
  data: import("vue-types").VueTypeDef<any[]> & {
@@ -1,7 +1,7 @@
1
1
  import { SetupContext } from 'vue';
2
2
  import { TablePropTypes } from './props';
3
3
  import { ITableResponse } from './use-attributes';
4
- declare const _default: (props: TablePropTypes, context: SetupContext<any>, tableResp: ITableResponse, styleRef: any, head: any) => {
4
+ declare const _default: (props: TablePropTypes, context: SetupContext<any>, tableResp: ITableResponse, styleRef: any, head: any, root: any, resetTableHeight: any) => {
5
5
  renderTableHeadSchema: () => (string | JSX.Element)[];
6
6
  renderTableBodySchema: (rows: any[]) => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
7
7
  [key: string]: any;
package/lib/tree/index.js CHANGED
@@ -1747,6 +1747,7 @@ var use_node_action_this = undefined;
1747
1747
  * @returns
1748
1748
  */
1749
1749
  var getVirtualLines = function getVirtualLines(node) {
1750
+ var _getNodeAttr;
1750
1751
  if (!props.levelLine) {
1751
1752
  return null;
1752
1753
  }
@@ -1755,7 +1756,7 @@ var use_node_action_this = undefined;
1755
1756
  '--depth': dpth
1756
1757
  };
1757
1758
  };
1758
- var maxDeep = getNodeAttr(node, NODE_ATTRIBUTES.DEPTH) + 1;
1759
+ var maxDeep = ((_getNodeAttr = getNodeAttr(node, NODE_ATTRIBUTES.DEPTH)) !== null && _getNodeAttr !== void 0 ? _getNodeAttr : 0) + 1;
1759
1760
  return new Array(maxDeep).fill('').map(function (_, index) {
1760
1761
  return index;
1761
1762
  }).filter(function (depth) {
@@ -2191,6 +2192,9 @@ var use_tree_init_this = undefined;
2191
2192
  var target = treeSchema.get(node);
2192
2193
  if (Object.prototype.hasOwnProperty.call(target, attrName)) {
2193
2194
  if (typeof callFn === 'function' && Reflect.apply(callFn, self, [target, attrName, attrValue, node])) {
2195
+ if (target[attrName] === attrValue) {
2196
+ return;
2197
+ }
2194
2198
  Object.assign(target, _defineProperty({}, attrName, attrValue));
2195
2199
  loopUpdateNodeAttr(target[NODE_ATTRIBUTES.PARENT], attrName, attrValue, callFn);
2196
2200
  }
@@ -327,40 +327,35 @@ function getMatchedIndex(maxCount, maxHeight, groupItemCount, callback) {
327
327
  diffHeight: diffHeight
328
328
  };
329
329
  }
330
- function computedVirtualIndex(lineHeight, callback, pagination, el, event, height) {
331
- if (!el) {
330
+ function computedVirtualIndex(lineHeight, callback, pagination, _el, event) {
331
+ if (!event.target) {
332
332
  return;
333
333
  }
334
- var elScrollTop = el.scrollTop;
335
- var elScrollLeft = el.scrollLeft;
336
- var scrollTop = pagination.scrollTop,
337
- count = pagination.count,
338
- groupItemCount = pagination.groupItemCount,
339
- startIndex = pagination.startIndex,
340
- endIndex = pagination.endIndex,
341
- scrollLeft = pagination.scrollLeft;
342
- var offsetHeight = /^\d+(\.\d*)?$/.test(height) ? height : el.offsetHeight;
334
+ var elScrollTop = event.target.scrollTop;
335
+ var elScrollLeft = event.target.scrollLeft;
336
+ var elScrollHeight = event.target.scrollHeight;
337
+ var elOffsetHeight = event.target.offsetHeight;
338
+ var count = pagination.count,
339
+ groupItemCount = pagination.groupItemCount;
343
340
  var targetStartIndex = 0;
344
341
  var targetEndIndex = 0;
345
342
  var translateY = 0;
346
343
  if (typeof lineHeight === 'number') {
347
344
  targetStartIndex = Math.floor(elScrollTop / lineHeight);
348
- targetEndIndex = Math.ceil(offsetHeight / lineHeight) + targetStartIndex;
345
+ targetEndIndex = Math.ceil(elOffsetHeight / lineHeight) + targetStartIndex;
349
346
  translateY = elScrollTop % lineHeight;
350
347
  }
351
348
  if (typeof lineHeight === 'function') {
352
349
  var startValue = getMatchedIndex(count, elScrollTop, groupItemCount, lineHeight);
353
350
  targetStartIndex = startValue.startIndex > 0 ? startValue.startIndex : 0;
354
351
  translateY = startValue.diffHeight;
355
- var endValue = getMatchedIndex(count, offsetHeight, groupItemCount, lineHeight);
356
- targetEndIndex = endValue.startIndex + targetStartIndex + 1;
357
- }
358
- if (elScrollTop !== scrollTop || targetStartIndex !== startIndex || targetEndIndex !== endIndex || scrollLeft !== elScrollLeft) {
359
- var bottom = el.scrollHeight - el.offsetHeight - el.scrollTop;
360
- typeof callback === 'function' && callback(event, targetStartIndex, targetEndIndex, elScrollTop, translateY, elScrollLeft, {
361
- bottom: bottom >= 0 ? bottom : 0
362
- });
352
+ var endValue = getMatchedIndex(count, elOffsetHeight, groupItemCount, lineHeight);
353
+ targetEndIndex = endValue.startIndex + targetStartIndex;
363
354
  }
355
+ var bottom = elScrollHeight - elOffsetHeight - elScrollTop;
356
+ typeof callback === 'function' && callback(event, targetStartIndex, targetEndIndex, elScrollTop, translateY, elScrollLeft, {
357
+ bottom: bottom >= 0 ? bottom : 0
358
+ });
364
359
  return {
365
360
  targetStartIndex: targetStartIndex,
366
361
  targetEndIndex: targetEndIndex,
@@ -402,7 +397,6 @@ var VisibleRender = /*#__PURE__*/function () {
402
397
  count = pagination.count,
403
398
  scrollTop = pagination.scrollTop,
404
399
  scrollLeft = pagination.scrollLeft;
405
- var height = this.binding.height;
406
400
  computedVirtualIndex(lineHeight, handleScrollCallback, {
407
401
  scrollTop: scrollTop,
408
402
  startIndex: startIndex,
@@ -410,7 +404,7 @@ var VisibleRender = /*#__PURE__*/function () {
410
404
  groupItemCount: groupItemCount,
411
405
  count: count,
412
406
  scrollLeft: scrollLeft
413
- }, this.wrapper, e, height);
407
+ }, this.wrapper, e);
414
408
  }
415
409
  }, {
416
410
  key: "executeThrottledRender",
@@ -646,16 +640,31 @@ function virtual_render_objectSpread(target) { for (var i = 1; i < arguments.len
646
640
  pos: {},
647
641
  groupItemCount: props.groupItemCount
648
642
  });
643
+ var calcList = (0,external_vue_namespaceObject.ref)([]);
649
644
  /** 指令触发Scroll事件,计算当前startIndex & endIndex & scrollTop & translateY */
650
645
  var handleScrollCallback = function handleScrollCallback(event, startIndex, endIndex, scrollTop, translateY, scrollLeft, pos) {
651
- pagination.startIndex = startIndex;
652
- pagination.endIndex = endIndex;
653
- pagination.scrollTop = scrollTop;
654
- // 设置偏移量,避免行高较大时出现卡顿式的滚动
655
- pagination.translateY = translateY;
656
- pagination.translateX = scrollLeft;
657
- pagination.scrollLeft = scrollLeft;
658
- Object.assign(pagination.pos, pos || {});
646
+ var translateX = scrollLeft;
647
+ Object.assign(pagination, {
648
+ startIndex: startIndex,
649
+ endIndex: endIndex,
650
+ scrollTop: scrollTop,
651
+ translateX: translateX,
652
+ translateY: translateY,
653
+ scrollLeft: scrollLeft,
654
+ pos: pos
655
+ });
656
+ var start = pagination.startIndex * props.groupItemCount;
657
+ var end = (pagination.endIndex + props.preloadItemCount) * props.groupItemCount;
658
+ var total = localList.value.length;
659
+ if (total < end) {
660
+ var contentLength = end - start;
661
+ calcList.value = localList.value.slice(start, total);
662
+ end = total + 1;
663
+ start = end - contentLength;
664
+ start = start < 0 ? 0 : start;
665
+ }
666
+ var value = localList.value.slice(start, end + 10);
667
+ calcList.value = value;
659
668
  if (event) {
660
669
  ctx.emit('content-scroll', [event, pagination]);
661
670
  }
@@ -668,12 +677,6 @@ function virtual_render_objectSpread(target) { for (var i = 1; i < arguments.len
668
677
  var _instance;
669
678
  (_instance = instance) === null || _instance === void 0 ? void 0 : _instance.uninstall();
670
679
  });
671
- var resolveHeight = (0,external_vue_namespaceObject.computed)(function () {
672
- if (/^\d+(\.\d*)?(px)?$/.test("".concat(props.height))) {
673
- return Number("".concat(props.height).replace(/px$/, ''));
674
- }
675
- return props.height;
676
- });
677
680
  (0,external_vue_namespaceObject.watch)(function () {
678
681
  return [props.lineHeight, props.height, props.list, props.maxHeight];
679
682
  }, function () {
@@ -723,15 +726,11 @@ function virtual_render_objectSpread(target) { for (var i = 1; i < arguments.len
723
726
  left: 0,
724
727
  top: 0
725
728
  };
729
+ var el = refRoot.value;
726
730
  (0,external_vue_namespaceObject.nextTick)(function () {
727
- var el = refRoot.value;
728
- var _computedVirtualIndex = computedVirtualIndex(props.lineHeight, handleScrollCallback, pagination, el, null, resolveHeight.value),
729
- targetStartIndex = _computedVirtualIndex.targetStartIndex,
730
- targetEndIndex = _computedVirtualIndex.targetEndIndex,
731
- elScrollTop = _computedVirtualIndex.elScrollTop,
732
- translateY = _computedVirtualIndex.translateY,
733
- elScrollLeft = _computedVirtualIndex.elScrollLeft;
734
- handleScrollCallback(null, targetStartIndex, targetEndIndex, elScrollTop, translateY, elScrollLeft, {});
731
+ computedVirtualIndex(props.lineHeight, handleScrollCallback, pagination, el, {
732
+ target: el
733
+ });
735
734
  });
736
735
  };
737
736
  /** 映射传入的数组为新的数组,增加 $index属性,用来处理唯一Index */
@@ -745,10 +744,6 @@ function virtual_render_objectSpread(target) { for (var i = 1; i < arguments.len
745
744
  });
746
745
  });
747
746
  });
748
- /** 计算出来的当前页数据 */
749
- var calcList = (0,external_vue_namespaceObject.computed)(function () {
750
- return localList.value.slice(pagination.startIndex * props.groupItemCount, (pagination.endIndex + props.preloadItemCount) * props.groupItemCount);
751
- });
752
747
  /** 展示列表内容区域样式 */
753
748
  var innerContentStyle = (0,external_vue_namespaceObject.computed)(function () {
754
749
  return props.scrollPosition === 'content' ? {
@@ -1,4 +1,4 @@
1
- export declare function computedVirtualIndex(lineHeight: any, callback: any, pagination: any, el: any, event: any, height: any): {
1
+ export declare function computedVirtualIndex(lineHeight: any, callback: any, pagination: any, _el: any, event: any): {
2
2
  targetStartIndex: number;
3
3
  targetEndIndex: number;
4
4
  elScrollTop: any;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "bkui-vue",
3
- "version": "0.0.2-beta.95",
3
+ "version": "0.0.2-beta.97",
4
4
  "workspaces": {
5
5
  "packages": [
6
6
  "packages/!(**.bak)*",
@@ -52,7 +52,7 @@
52
52
  "@babel/plugin-transform-runtime": "~7.22.9",
53
53
  "@babel/preset-env": "~7.22.9",
54
54
  "@babel/preset-typescript": "~7.22.5",
55
- "@blueking/magicbox-header": "~1.1.60",
55
+ "@blueking/magicbox-header": "~1.1.61",
56
56
  "@commitlint/cli": "~16.2.3",
57
57
  "@commitlint/config-conventional": "~16.2.1",
58
58
  "@types/jest": "~29.5.3",