bkui-vue 0.0.1-beta.68 → 0.0.1-beta.70

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/dist/index.esm.js CHANGED
@@ -12468,10 +12468,11 @@ var useTagRender = (props, ctx) => {
12468
12468
  renderAs,
12469
12469
  contentAs
12470
12470
  } = props;
12471
- const handleScrollCallback = (event, _startIndex, _endIndex, _scrollTop, translateY, scrollLeft) => {
12471
+ const handleScrollCallback = (event, _startIndex, _endIndex, _scrollTop, translateY, scrollLeft, pos) => {
12472
12472
  ctx.emit("content-scroll", [event, {
12473
12473
  translateY,
12474
- translateX: scrollLeft
12474
+ translateX: scrollLeft,
12475
+ pos
12475
12476
  }]);
12476
12477
  };
12477
12478
  const vVirtualRender = resolveDirective("bkVirtualRender");
@@ -12535,7 +12536,8 @@ function computedVirtualIndex(lineHeight, callback, pagination2, el, event) {
12535
12536
  targetEndIndex = endValue.startIndex + targetStartIndex + 1;
12536
12537
  }
12537
12538
  if (elScrollTop !== scrollTop || targetStartIndex !== startIndex || targetEndIndex !== endIndex) {
12538
- typeof callback === "function" && callback(event, targetStartIndex, targetEndIndex, elScrollTop, translateY, elScrollLeft);
12539
+ const bottom2 = el.scrollHeight - el.offsetHeight - el.scrollTop;
12540
+ typeof callback === "function" && callback(event, targetStartIndex, targetEndIndex, elScrollTop, translateY, elScrollLeft, { bottom: bottom2 });
12539
12541
  }
12540
12542
  }
12541
12543
  function visibleRender(e, wrapper, binding) {
@@ -12543,21 +12545,16 @@ function visibleRender(e, wrapper, binding) {
12543
12545
  if (onlyScroll) {
12544
12546
  const elScrollTop = wrapper.scrollTop;
12545
12547
  const elScrollLeft = wrapper.scrollLeft;
12546
- handleScrollCallback(e, null, null, elScrollTop, elScrollTop, elScrollLeft);
12548
+ const bottom2 = wrapper.scrollHeight - wrapper.offsetHeight - wrapper.scrollTop;
12549
+ handleScrollCallback(e, null, null, elScrollTop, elScrollTop, elScrollLeft, { bottom: bottom2 });
12547
12550
  return;
12548
12551
  }
12549
12552
  const { startIndex, endIndex, groupItemCount, count, scrollTop } = pagination2;
12550
12553
  computedVirtualIndex(lineHeight, handleScrollCallback, { scrollTop, startIndex, endIndex, groupItemCount, count }, wrapper, e);
12551
12554
  }
12552
12555
  const throttledRender = (delay = 60) => lodash.exports.throttle((e, wrapper, binding) => visibleRender(e, wrapper, binding), delay);
12553
- let cachedThrottle = null;
12554
12556
  const executeThrottledRender = (e, wrapper, binding, delay = 60) => {
12555
- if (!cachedThrottle) {
12556
- cachedThrottle = throttledRender(delay);
12557
- }
12558
- if (typeof cachedThrottle === "function") {
12559
- cachedThrottle.call(globalThis, e, wrapper, binding);
12560
- }
12557
+ Reflect.apply(throttledRender(delay), globalThis, [e, wrapper, binding]);
12561
12558
  };
12562
12559
  var virtualRender = {
12563
12560
  mounted(el, binding) {
@@ -12567,11 +12564,6 @@ var virtualRender = {
12567
12564
  executeThrottledRender(e, wrapper, binding, throttleDelay);
12568
12565
  });
12569
12566
  },
12570
- updated(el, binding) {
12571
- const wrapper = el.parentNode;
12572
- const { throttleDelay } = binding.value;
12573
- executeThrottledRender(null, wrapper, binding, throttleDelay);
12574
- },
12575
12567
  unbind(el) {
12576
12568
  if (el) {
12577
12569
  const wrapper = el.parentNode;
@@ -12617,14 +12609,16 @@ var Component$a = defineComponent({
12617
12609
  translateY: 0,
12618
12610
  translateX: 0,
12619
12611
  count: 0,
12612
+ pos: {},
12620
12613
  groupItemCount: props.groupItemCount
12621
12614
  });
12622
- const handleScrollCallback = (event, startIndex, endIndex, scrollTop, translateY, scrollLeft) => {
12615
+ const handleScrollCallback = (event, startIndex, endIndex, scrollTop, translateY, scrollLeft, pos) => {
12623
12616
  pagination2.startIndex = startIndex;
12624
12617
  pagination2.endIndex = endIndex;
12625
12618
  pagination2.scrollTop = scrollTop;
12626
12619
  pagination2.translateY = translateY;
12627
12620
  pagination2.translateX = scrollLeft;
12621
+ pagination2.pos = pos;
12628
12622
  ctx.emit("content-scroll", [event, pagination2]);
12629
12623
  };
12630
12624
  onMounted(() => {
@@ -14299,8 +14293,13 @@ class TableRender {
14299
14293
  }
14300
14294
  const useClass = (props, root, reactiveProp) => {
14301
14295
  const autoHeight = ref(200);
14296
+ const hasScrollY = ref(false);
14297
+ const hasFooter = computed(() => props.pagination && props.data.length);
14302
14298
  const tableClass = computed(() => classes({
14303
- [resolveClassName("table")]: true
14299
+ [resolveClassName("table")]: true,
14300
+ "has-footer": hasFooter.value,
14301
+ "has-scroll-y": hasScrollY.value || props.virtualEnabled,
14302
+ "is-scroll-bottom": reactiveProp.pos.bottom < 2
14304
14303
  }, resolvePropBorderToClassStr(props.border)));
14305
14304
  const headClass = classes({
14306
14305
  [resolveClassName("table-head")]: true
@@ -14335,23 +14334,24 @@ const useClass = (props, root, reactiveProp) => {
14335
14334
  }
14336
14335
  return defaultValue;
14337
14336
  };
14338
- const contentStyle = computed(() => {
14337
+ const contentStyle = reactive({});
14338
+ const resolveContentStyle = () => {
14339
14339
  const resolveHeight = resolvePropHeight(props.height, autoHeight.value);
14340
14340
  const resolveHeadHeight = props.showHead ? resolvePropHeight(props.headHeight, 40) + 2 : 0;
14341
14341
  const resolveMaxHeight = resolvePropHeight(props.maxHeight, autoHeight.value);
14342
14342
  const resolveMinHeight = resolvePropHeight(props.minHeight, autoHeight.value);
14343
14343
  const resolveFooterHeight = props.pagination && props.data.length ? 40 : 0;
14344
14344
  const contentHeight = resolveHeight - resolveHeadHeight - resolveFooterHeight;
14345
- const maxHeight = resolveMaxHeight - resolveHeadHeight - resolveFooterHeight;
14345
+ const height = props.height !== "auto" ? `${contentHeight}px` : false;
14346
+ const maxHeight = height ? resolveMaxHeight - resolveHeadHeight - resolveFooterHeight : false;
14346
14347
  const minHeight = resolveMinHeight - resolveHeadHeight - resolveFooterHeight;
14347
- const height = props.height !== "auto" ? `${contentHeight}px` : "auto";
14348
- return {
14348
+ Object.assign(contentStyle, {
14349
14349
  display: "block",
14350
14350
  "max-height": `${maxHeight}px`,
14351
14351
  "min-height": `${minHeight}px`,
14352
14352
  height
14353
- };
14354
- });
14353
+ });
14354
+ };
14355
14355
  onMounted(() => {
14356
14356
  resetTableHeight(root == null ? void 0 : root.value);
14357
14357
  });
@@ -14359,9 +14359,27 @@ const useClass = (props, root, reactiveProp) => {
14359
14359
  if (rootEl) {
14360
14360
  const { height } = rootEl.parentElement.getBoundingClientRect();
14361
14361
  autoHeight.value = height;
14362
+ resolveContentStyle();
14363
+ }
14364
+ };
14365
+ const updateBorderClass = (root2) => {
14366
+ if (root2) {
14367
+ const tableBody = root2.querySelector(".bk-table-body table");
14368
+ hasScrollY.value = tableBody.offsetHeight > root2.offsetHeight;
14362
14369
  }
14363
14370
  };
14364
- return { tableClass, headClass, contentClass, footerClass, wrapperStyle, contentStyle, headStyle, resetTableHeight };
14371
+ return {
14372
+ tableClass,
14373
+ headClass,
14374
+ contentClass,
14375
+ footerClass,
14376
+ wrapperStyle,
14377
+ contentStyle,
14378
+ headStyle,
14379
+ resetTableHeight,
14380
+ updateBorderClass,
14381
+ hasFooter
14382
+ };
14365
14383
  };
14366
14384
  var Component$8 = defineComponent({
14367
14385
  name: "Table",
@@ -14387,6 +14405,9 @@ var Component$8 = defineComponent({
14387
14405
  const reactiveProp = reactive({
14388
14406
  scrollTranslateY: 0,
14389
14407
  scrollTranslateX: 0,
14408
+ pos: {
14409
+ bottom: 1
14410
+ },
14390
14411
  activeColumns,
14391
14412
  setting: {
14392
14413
  size: null,
@@ -14407,15 +14428,20 @@ var Component$8 = defineComponent({
14407
14428
  wrapperStyle,
14408
14429
  contentStyle,
14409
14430
  headStyle,
14410
- resetTableHeight
14431
+ updateBorderClass,
14432
+ hasFooter
14411
14433
  } = useClass(props, root, reactiveProp);
14412
14434
  const {
14413
14435
  renderFixedColumns,
14414
14436
  fixedWrapperClass
14415
14437
  } = useFixedColumn(props, colgroups);
14416
14438
  const tableRender = new TableRender(props, ctx, reactiveProp, colgroups);
14417
- watchEffect(() => {
14439
+ watch(() => [props.data], () => {
14418
14440
  watchEffectFn(columnFilterFn, columnSortFn);
14441
+ nextTick(() => updateBorderClass(root.value));
14442
+ }, {
14443
+ immediate: true,
14444
+ deep: true
14419
14445
  });
14420
14446
  tableRender.on(EVENTS$1.ON_SORT_BY_CLICK, (args) => {
14421
14447
  const {
@@ -14441,15 +14467,16 @@ var Component$8 = defineComponent({
14441
14467
  const pagination2 = args[1];
14442
14468
  const {
14443
14469
  translateX,
14444
- translateY
14470
+ translateY,
14471
+ pos = {}
14445
14472
  } = pagination2;
14446
14473
  reactiveProp.scrollTranslateY = translateY;
14447
14474
  reactiveProp.scrollTranslateX = translateX;
14475
+ reactiveProp.pos = pos;
14448
14476
  };
14449
14477
  onMounted(() => {
14450
14478
  observerIns = observerResize(root.value, () => {
14451
14479
  resolveColumnWidth(root.value, colgroups, 20);
14452
- resetTableHeight(root.value);
14453
14480
  }, 60, true);
14454
14481
  observerIns.start();
14455
14482
  });
@@ -14474,7 +14501,7 @@ var Component$8 = defineComponent({
14474
14501
  "ref": refVirtualRender,
14475
14502
  "lineHeight": tableRender.getRowHeight,
14476
14503
  "class": contentClass,
14477
- "style": contentStyle.value,
14504
+ "style": contentStyle,
14478
14505
  "list": pageData,
14479
14506
  "onContentScroll": handleScrollChanged,
14480
14507
  "throttleDelay": 0,
@@ -14491,7 +14518,7 @@ var Component$8 = defineComponent({
14491
14518
  }, null)]),
14492
14519
  createVNode("div", {
14493
14520
  "class": footerClass.value
14494
- }, [props.pagination && props.data.length && tableRender.renderTableFooter(localPagination.value)])
14521
+ }, [hasFooter.value && tableRender.renderTableFooter(localPagination.value)])
14495
14522
  ]);
14496
14523
  }
14497
14524
  });