@koi-design/uxd-ui 13.2.11 → 13.2.12

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/uxd-ui.esm.mjs CHANGED
@@ -1,4 +1,4 @@
1
- /*! @koi-design/uxd-ui@13.2.11 */
1
+ /*! @koi-design/uxd-ui@13.2.12 */
2
2
 
3
3
  import { defineComponent, reactive, watch, provide, inject, computed, onMounted, ref, onBeforeUnmount, openBlock, createElementBlock, createElementVNode, normalizeClass, normalizeStyle, renderSlot, withDirectives, vShow, createBlock, resolveDynamicComponent, createCommentVNode, toRaw, resolveComponent, Transition, withCtx, createVNode, toDisplayString, isVNode, Comment as Comment$1, Fragment, Text as Text$1, h, shallowRef, toRef, nextTick, onUpdated, onUnmounted, cloneVNode, Teleport, toRefs, withModifiers, mergeProps, renderList, onBeforeUpdate, createTextVNode, watchEffect, onActivated, onDeactivated, normalizeProps, guardReactiveProps, createStaticVNode, withKeys, TransitionGroup, createApp, onBeforeMount } from 'vue';
4
4
  import { URoundClose, USolidCheckmarkCircle, USolidCloseCircle, USolidAlertCircle, USolidInfoCircle, ULineLoading, URoundSearch, URoundCloseCircle, URoundEyeOpen, URoundEyeOff, URoundCheck, ULineEnter, ULineUp, ULineDown, ULineRight, ULineMenu, URoundDown, USolidCheck, USolidRemove, UColorfulEmpty, ULineSearch, ULineLeft, USolidDown, ULineSortRight, ULineLeftDouble, ULineRightDouble, URoundCalendar, ULineShrink, ULineMagnify, ULineRefreshLeft, ULineRefreshRight, ULineScreenOpen, ULineScaleToOriginal, USolidCaretLeft, USolidCaretRight, ULineUnfold, ULinePack, ULinePicture, ULineAlertCircle, USolidStar, UColorfulNotFound, UColorfulStatisticsEmpty, UColorfulMessageEmpty, USolidFilter, USolidCaretUp, USolidCaretDown, ULineCanDrag, ULineAdd, URoundTime, ULineText, ULineDelete, USolidHelpCircle, URoundHelpCircle, ULineInfoCircle, ULineCheckmarkCircle } from '@koi-design/uxd-icon';
@@ -32660,20 +32660,35 @@ function getWidth(width, tableWidth) {
32660
32660
  }
32661
32661
  return _width;
32662
32662
  }
32663
+ function applySizesMap(sizesMap, nextSizesMap) {
32664
+ Object.keys(sizesMap).forEach((key) => {
32665
+ if (!(key in nextSizesMap)) {
32666
+ delete sizesMap[key];
32667
+ }
32668
+ });
32669
+ Object.keys(nextSizesMap).forEach((key) => {
32670
+ if (sizesMap[key] !== nextSizesMap[key]) {
32671
+ sizesMap[key] = nextSizesMap[key];
32672
+ }
32673
+ });
32674
+ }
32663
32675
  function useTableResize(updatedColumns, tableRefs, prefixCls, isColumnFixed, props) {
32664
32676
  const sizesMap = reactive({});
32665
32677
  const tableWidth = ref(void 0);
32678
+ let lastWrapWidth;
32679
+ const WRAP_WIDTH_TOLERANCE = 1;
32666
32680
  const syncColumnsWidth = () => {
32667
32681
  const { bodyTable } = tableRefs;
32668
32682
  if (!bodyTable || bodyTable.getWidth() === void 0) {
32669
- return;
32683
+ return false;
32684
+ }
32685
+ let wrapWidth = bodyTable.getWidth();
32686
+ if (lastWrapWidth !== void 0 && Math.abs(wrapWidth - lastWrapWidth) <= WRAP_WIDTH_TOLERANCE) {
32687
+ wrapWidth = lastWrapWidth;
32670
32688
  }
32671
- const wrapWidth = bodyTable.getWidth();
32672
32689
  const columns = getLeafColumns(updatedColumns.value);
32673
32690
  let usedWidth = 0;
32674
- Object.keys(sizesMap).forEach((key) => {
32675
- delete sizesMap[key];
32676
- });
32691
+ const nextSizesMap = {};
32677
32692
  const minWidthColumns = [];
32678
32693
  const maxWidthColumns = [];
32679
32694
  const nothingColumns = [];
@@ -32682,15 +32697,15 @@ function useTableResize(updatedColumns, tableRefs, prefixCls, isColumnFixed, pro
32682
32697
  if (c.width) {
32683
32698
  const _width = getWidth(c.width, wrapWidth);
32684
32699
  usedWidth += _width;
32685
- sizesMap[colKey] = _width;
32700
+ nextSizesMap[colKey] = _width;
32686
32701
  } else if (c.minWidth) {
32687
32702
  const _width = getWidth(c.minWidth, wrapWidth);
32688
32703
  usedWidth += _width;
32689
- sizesMap[colKey] = _width;
32704
+ nextSizesMap[colKey] = _width;
32690
32705
  minWidthColumns.push(c);
32691
32706
  } else {
32692
32707
  const minWidth = getMinWidth(c);
32693
- sizesMap[colKey] = minWidth;
32708
+ nextSizesMap[colKey] = minWidth;
32694
32709
  usedWidth += minWidth;
32695
32710
  if (c.maxWidth) {
32696
32711
  maxWidthColumns.push(c);
@@ -32706,10 +32721,10 @@ function useTableResize(updatedColumns, tableRefs, prefixCls, isColumnFixed, pro
32706
32721
  maxWidthColumns.forEach((mc) => {
32707
32722
  avgWidth = Math.floor(unUsedWidth / length);
32708
32723
  if (getWidth(mc.maxWidth, wrapWidth) < avgWidth) {
32709
- sizesMap[mc.key] = getWidth(mc.maxWidth, wrapWidth);
32724
+ nextSizesMap[mc.key] = getWidth(mc.maxWidth, wrapWidth);
32710
32725
  unUsedWidth -= getWidth(mc.maxWidth, wrapWidth) - getMinWidth(mc);
32711
32726
  } else {
32712
- sizesMap[mc.key] += avgWidth;
32727
+ nextSizesMap[mc.key] += avgWidth;
32713
32728
  unUsedWidth -= avgWidth;
32714
32729
  }
32715
32730
  length -= 1;
@@ -32718,25 +32733,32 @@ function useTableResize(updatedColumns, tableRefs, prefixCls, isColumnFixed, pro
32718
32733
  if (avgWidth > 50 || nothingColumns.length === 0) {
32719
32734
  [...minWidthColumns, ...nothingColumns].forEach((c, i) => {
32720
32735
  if (i < length - 1) {
32721
- sizesMap[c.key] += avgWidth;
32736
+ nextSizesMap[c.key] += avgWidth;
32722
32737
  unUsedWidth -= avgWidth;
32723
32738
  } else {
32724
- sizesMap[c.key] += unUsedWidth;
32739
+ nextSizesMap[c.key] += unUsedWidth;
32725
32740
  }
32726
32741
  });
32727
32742
  } else {
32728
32743
  avgWidth = Math.floor(unUsedWidth / nothingColumns.length);
32729
32744
  nothingColumns.forEach((c, i) => {
32730
32745
  if (i < nothingColumns.length - 1) {
32731
- sizesMap[c.key] += avgWidth;
32746
+ nextSizesMap[c.key] += avgWidth;
32732
32747
  unUsedWidth -= avgWidth;
32733
32748
  } else {
32734
- sizesMap[c.key] += unUsedWidth;
32749
+ nextSizesMap[c.key] += unUsedWidth;
32735
32750
  }
32736
32751
  });
32737
32752
  }
32738
32753
  }
32739
- tableWidth.value = Object.keys(sizesMap).reduce((sum, key) => sum + sizesMap[key], 0);
32754
+ const nextTableWidth = Object.keys(nextSizesMap).reduce((sum, key) => sum + nextSizesMap[key], 0);
32755
+ lastWrapWidth = wrapWidth;
32756
+ if (shallowequal(sizesMap, nextSizesMap) && tableWidth.value === nextTableWidth) {
32757
+ return false;
32758
+ }
32759
+ applySizesMap(sizesMap, nextSizesMap);
32760
+ tableWidth.value = nextTableWidth;
32761
+ return true;
32740
32762
  };
32741
32763
  let syncHeightTimer = null;
32742
32764
  let updateBodyTableTimer = null;
@@ -32750,20 +32772,23 @@ function useTableResize(updatedColumns, tableRefs, prefixCls, isColumnFixed, pro
32750
32772
  if (!bodyDom) {
32751
32773
  return;
32752
32774
  }
32753
- const scrollToLeft = bodyDom.scrollLeft === 0;
32754
- const scrollToRight = bodyDom.scrollLeft + 1 >= bodyDom.children[0].getBoundingClientRect().width - bodyDom.getBoundingClientRect().width;
32775
+ const { scrollLeft, scrollWidth, clientWidth } = bodyDom;
32776
+ const scrollToLeft = scrollLeft <= 0;
32777
+ const scrollToRight = scrollLeft + 1 >= scrollWidth - clientWidth;
32778
+ let nextPosition = "middle";
32755
32779
  if (scrollToLeft && scrollToRight) {
32756
- scrollPosition.value = "both";
32780
+ nextPosition = "both";
32757
32781
  } else if (scrollToLeft) {
32758
- scrollPosition.value = "left";
32782
+ nextPosition = "left";
32759
32783
  } else if (scrollToRight) {
32760
- scrollPosition.value = "right";
32761
- } else {
32762
- scrollPosition.value = "middle";
32784
+ nextPosition = "right";
32785
+ }
32786
+ if (scrollPosition.value !== nextPosition) {
32787
+ scrollPosition.value = nextPosition;
32763
32788
  }
32764
32789
  };
32765
32790
  const handleResize = () => {
32766
- syncColumnsWidth();
32791
+ const changed = syncColumnsWidth();
32767
32792
  if (isColumnFixed.value) {
32768
32793
  if (syncHeightTimer) {
32769
32794
  clearTimeout(syncHeightTimer);
@@ -32773,6 +32798,9 @@ function useTableResize(updatedColumns, tableRefs, prefixCls, isColumnFixed, pro
32773
32798
  setScrollPositionClass();
32774
32799
  }, 0);
32775
32800
  }
32801
+ if (!changed) {
32802
+ return;
32803
+ }
32776
32804
  if (updateBodyTableTimer) {
32777
32805
  clearTimeout(updateBodyTableTimer);
32778
32806
  }
@@ -35797,7 +35825,7 @@ const _sfc_main$u = defineComponent({
35797
35825
  });
35798
35826
  onUpdated(() => {
35799
35827
  nextTick(() => {
35800
- handleResize();
35828
+ debouncedHandleResize();
35801
35829
  });
35802
35830
  });
35803
35831
  onBeforeUnmount(() => {
package/uxd-ui.umd.js CHANGED
@@ -1,4 +1,4 @@
1
- /*! @koi-design/uxd-ui@13.2.11 */
1
+ /*! @koi-design/uxd-ui@13.2.12 */
2
2
 
3
3
  (function (global, factory) {
4
4
  typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('vue'), require('@koi-design/uxd-icon')) :
@@ -32663,20 +32663,35 @@
32663
32663
  }
32664
32664
  return _width;
32665
32665
  }
32666
+ function applySizesMap(sizesMap, nextSizesMap) {
32667
+ Object.keys(sizesMap).forEach((key) => {
32668
+ if (!(key in nextSizesMap)) {
32669
+ delete sizesMap[key];
32670
+ }
32671
+ });
32672
+ Object.keys(nextSizesMap).forEach((key) => {
32673
+ if (sizesMap[key] !== nextSizesMap[key]) {
32674
+ sizesMap[key] = nextSizesMap[key];
32675
+ }
32676
+ });
32677
+ }
32666
32678
  function useTableResize(updatedColumns, tableRefs, prefixCls, isColumnFixed, props) {
32667
32679
  const sizesMap = vue.reactive({});
32668
32680
  const tableWidth = vue.ref(void 0);
32681
+ let lastWrapWidth;
32682
+ const WRAP_WIDTH_TOLERANCE = 1;
32669
32683
  const syncColumnsWidth = () => {
32670
32684
  const { bodyTable } = tableRefs;
32671
32685
  if (!bodyTable || bodyTable.getWidth() === void 0) {
32672
- return;
32686
+ return false;
32687
+ }
32688
+ let wrapWidth = bodyTable.getWidth();
32689
+ if (lastWrapWidth !== void 0 && Math.abs(wrapWidth - lastWrapWidth) <= WRAP_WIDTH_TOLERANCE) {
32690
+ wrapWidth = lastWrapWidth;
32673
32691
  }
32674
- const wrapWidth = bodyTable.getWidth();
32675
32692
  const columns = getLeafColumns(updatedColumns.value);
32676
32693
  let usedWidth = 0;
32677
- Object.keys(sizesMap).forEach((key) => {
32678
- delete sizesMap[key];
32679
- });
32694
+ const nextSizesMap = {};
32680
32695
  const minWidthColumns = [];
32681
32696
  const maxWidthColumns = [];
32682
32697
  const nothingColumns = [];
@@ -32685,15 +32700,15 @@
32685
32700
  if (c.width) {
32686
32701
  const _width = getWidth(c.width, wrapWidth);
32687
32702
  usedWidth += _width;
32688
- sizesMap[colKey] = _width;
32703
+ nextSizesMap[colKey] = _width;
32689
32704
  } else if (c.minWidth) {
32690
32705
  const _width = getWidth(c.minWidth, wrapWidth);
32691
32706
  usedWidth += _width;
32692
- sizesMap[colKey] = _width;
32707
+ nextSizesMap[colKey] = _width;
32693
32708
  minWidthColumns.push(c);
32694
32709
  } else {
32695
32710
  const minWidth = getMinWidth(c);
32696
- sizesMap[colKey] = minWidth;
32711
+ nextSizesMap[colKey] = minWidth;
32697
32712
  usedWidth += minWidth;
32698
32713
  if (c.maxWidth) {
32699
32714
  maxWidthColumns.push(c);
@@ -32709,10 +32724,10 @@
32709
32724
  maxWidthColumns.forEach((mc) => {
32710
32725
  avgWidth = Math.floor(unUsedWidth / length);
32711
32726
  if (getWidth(mc.maxWidth, wrapWidth) < avgWidth) {
32712
- sizesMap[mc.key] = getWidth(mc.maxWidth, wrapWidth);
32727
+ nextSizesMap[mc.key] = getWidth(mc.maxWidth, wrapWidth);
32713
32728
  unUsedWidth -= getWidth(mc.maxWidth, wrapWidth) - getMinWidth(mc);
32714
32729
  } else {
32715
- sizesMap[mc.key] += avgWidth;
32730
+ nextSizesMap[mc.key] += avgWidth;
32716
32731
  unUsedWidth -= avgWidth;
32717
32732
  }
32718
32733
  length -= 1;
@@ -32721,25 +32736,32 @@
32721
32736
  if (avgWidth > 50 || nothingColumns.length === 0) {
32722
32737
  [...minWidthColumns, ...nothingColumns].forEach((c, i) => {
32723
32738
  if (i < length - 1) {
32724
- sizesMap[c.key] += avgWidth;
32739
+ nextSizesMap[c.key] += avgWidth;
32725
32740
  unUsedWidth -= avgWidth;
32726
32741
  } else {
32727
- sizesMap[c.key] += unUsedWidth;
32742
+ nextSizesMap[c.key] += unUsedWidth;
32728
32743
  }
32729
32744
  });
32730
32745
  } else {
32731
32746
  avgWidth = Math.floor(unUsedWidth / nothingColumns.length);
32732
32747
  nothingColumns.forEach((c, i) => {
32733
32748
  if (i < nothingColumns.length - 1) {
32734
- sizesMap[c.key] += avgWidth;
32749
+ nextSizesMap[c.key] += avgWidth;
32735
32750
  unUsedWidth -= avgWidth;
32736
32751
  } else {
32737
- sizesMap[c.key] += unUsedWidth;
32752
+ nextSizesMap[c.key] += unUsedWidth;
32738
32753
  }
32739
32754
  });
32740
32755
  }
32741
32756
  }
32742
- tableWidth.value = Object.keys(sizesMap).reduce((sum, key) => sum + sizesMap[key], 0);
32757
+ const nextTableWidth = Object.keys(nextSizesMap).reduce((sum, key) => sum + nextSizesMap[key], 0);
32758
+ lastWrapWidth = wrapWidth;
32759
+ if (shallowequal(sizesMap, nextSizesMap) && tableWidth.value === nextTableWidth) {
32760
+ return false;
32761
+ }
32762
+ applySizesMap(sizesMap, nextSizesMap);
32763
+ tableWidth.value = nextTableWidth;
32764
+ return true;
32743
32765
  };
32744
32766
  let syncHeightTimer = null;
32745
32767
  let updateBodyTableTimer = null;
@@ -32753,20 +32775,23 @@
32753
32775
  if (!bodyDom) {
32754
32776
  return;
32755
32777
  }
32756
- const scrollToLeft = bodyDom.scrollLeft === 0;
32757
- const scrollToRight = bodyDom.scrollLeft + 1 >= bodyDom.children[0].getBoundingClientRect().width - bodyDom.getBoundingClientRect().width;
32778
+ const { scrollLeft, scrollWidth, clientWidth } = bodyDom;
32779
+ const scrollToLeft = scrollLeft <= 0;
32780
+ const scrollToRight = scrollLeft + 1 >= scrollWidth - clientWidth;
32781
+ let nextPosition = "middle";
32758
32782
  if (scrollToLeft && scrollToRight) {
32759
- scrollPosition.value = "both";
32783
+ nextPosition = "both";
32760
32784
  } else if (scrollToLeft) {
32761
- scrollPosition.value = "left";
32785
+ nextPosition = "left";
32762
32786
  } else if (scrollToRight) {
32763
- scrollPosition.value = "right";
32764
- } else {
32765
- scrollPosition.value = "middle";
32787
+ nextPosition = "right";
32788
+ }
32789
+ if (scrollPosition.value !== nextPosition) {
32790
+ scrollPosition.value = nextPosition;
32766
32791
  }
32767
32792
  };
32768
32793
  const handleResize = () => {
32769
- syncColumnsWidth();
32794
+ const changed = syncColumnsWidth();
32770
32795
  if (isColumnFixed.value) {
32771
32796
  if (syncHeightTimer) {
32772
32797
  clearTimeout(syncHeightTimer);
@@ -32776,6 +32801,9 @@
32776
32801
  setScrollPositionClass();
32777
32802
  }, 0);
32778
32803
  }
32804
+ if (!changed) {
32805
+ return;
32806
+ }
32779
32807
  if (updateBodyTableTimer) {
32780
32808
  clearTimeout(updateBodyTableTimer);
32781
32809
  }
@@ -35800,7 +35828,7 @@
35800
35828
  });
35801
35829
  vue.onUpdated(() => {
35802
35830
  vue.nextTick(() => {
35803
- handleResize();
35831
+ debouncedHandleResize();
35804
35832
  });
35805
35833
  });
35806
35834
  vue.onBeforeUnmount(() => {