bkui-vue 0.0.1-beta.365 → 0.0.1-beta.367

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
@@ -1669,6 +1669,9 @@ function isElement$2(obj) {
1669
1669
  return typeof obj === "object" && obj.nodeType === 1 && typeof obj.style === "object" && typeof obj.ownerDocument === "object";
1670
1670
  }
1671
1671
  }
1672
+ function hasOverflowEllipsis(element) {
1673
+ return element.offsetWidth < element.scrollWidth || element.offsetHeight < element.scrollHeight;
1674
+ }
1672
1675
  class BKPopover {
1673
1676
  constructor(reference2, popperRefer, options) {
1674
1677
  var _a, _b;
@@ -10907,6 +10910,7 @@ var Component$r = defineComponent({
10907
10910
  underline: PropTypes.bool.def(false),
10908
10911
  target: PropTypes.string.def("_self")
10909
10912
  },
10913
+ emits: ["click"],
10910
10914
  setup(props2, {
10911
10915
  emit
10912
10916
  }) {
@@ -17822,25 +17826,6 @@ const hasRootScrollY = (root, querySelector, offsetHeight = 0) => {
17822
17826
  }
17823
17827
  return false;
17824
17828
  };
17825
- const getElementTextWidth = (element, text) => {
17826
- function getTextWidth(text2, font) {
17827
- const canvas = getTextWidth.canvas || (getTextWidth.canvas = document.createElement("canvas"));
17828
- const context = canvas.getContext("2d");
17829
- context.font = font;
17830
- const metrics = context.measureText(text2);
17831
- return metrics.width;
17832
- }
17833
- function getCssStyle(element2, prop) {
17834
- return window.getComputedStyle(element2, null).getPropertyValue(prop);
17835
- }
17836
- function getCanvasFont(el = document.body) {
17837
- const fontWeight = getCssStyle(el, "font-weight") || "normal";
17838
- const fontSize = getCssStyle(el, "font-size") || "16px";
17839
- const fontFamily = getCssStyle(el, "font-family") || "Times New Roman";
17840
- return `${fontWeight} ${fontSize} ${fontFamily}`;
17841
- }
17842
- return getTextWidth(text || (element == null ? void 0 : element.innerHTML), getCanvasFont(element));
17843
- };
17844
17829
  const isColumnHidden = (settingFields, column, checked) => {
17845
17830
  const isSettingField = (col) => settingFields.some((field) => field.field === resolvePropVal(col, ["field", "type"], [col]));
17846
17831
  return isSettingField(column) && checked.length && !checked.includes(resolvePropVal(column, ["field", "type"], [column]));
@@ -17981,12 +17966,15 @@ var TableCell = defineComponent({
17981
17966
  }
17982
17967
  if (typeof showOverflowTooltip === "object") {
17983
17968
  disabled = showOverflowTooltip.disabled;
17969
+ content = showOverflowTooltip.content || refRoot.value.innerText;
17984
17970
  if (typeof showOverflowTooltip.content === "function") {
17985
17971
  content = showOverflowTooltip.content(props2.column, props2.row);
17986
17972
  }
17987
- content = showOverflowTooltip.content || refRoot.value.innerText;
17988
17973
  mode = showOverflowTooltip.mode || "auto";
17989
17974
  }
17975
+ if (typeof disabled === "function") {
17976
+ disabled = Reflect.apply(disabled, this, [props2.column, props2.row]);
17977
+ }
17990
17978
  return {
17991
17979
  disabled,
17992
17980
  content,
@@ -17994,20 +17982,16 @@ var TableCell = defineComponent({
17994
17982
  };
17995
17983
  };
17996
17984
  const resolveOverflowTooltip = () => {
17997
- if (!refRoot.value || /selection|index|expand/.test(props2.column.type) || !isElement$2(refRoot.value)) {
17985
+ if (!refRoot.value || !isElement$2(refRoot.value)) {
17998
17986
  return;
17999
17987
  }
18000
17988
  const {
18001
- content,
18002
- mode
17989
+ mode,
17990
+ disabled
18003
17991
  } = resolveTooltipOption();
17992
+ isTipsEnabled.value = !disabled;
18004
17993
  if (mode === "auto") {
18005
- const textWidth = getElementTextWidth(refRoot.value, content);
18006
- const cellWidth = refRoot.value.clientWidth;
18007
- const computedStyle = window.getComputedStyle(refRoot.value);
18008
- const paddingWidth = ["padding-left", "padding-right"].reduce((width, prop) => width + Number(computedStyle.getPropertyValue(prop).replace("px", "")), 0);
18009
- const cellInnerWidth = cellWidth - paddingWidth;
18010
- isTipsEnabled.value = textWidth > cellInnerWidth;
17994
+ isTipsEnabled.value = hasOverflowEllipsis(refRoot.value);
18011
17995
  }
18012
17996
  if (mode === "static") {
18013
17997
  isTipsEnabled.value = true;