bkui-vue 0.0.1-beta.366 → 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.cjs.js +12 -12
- package/dist/index.esm.js +12 -29
- package/dist/index.umd.js +12 -12
- package/lib/shared/helper.d.ts +9 -0
- package/lib/shared/index.js +1 -1
- package/lib/table/index.js +1 -1
- package/package.json +1 -2
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;
|
@@ -17823,25 +17826,6 @@ const hasRootScrollY = (root, querySelector, offsetHeight = 0) => {
|
|
17823
17826
|
}
|
17824
17827
|
return false;
|
17825
17828
|
};
|
17826
|
-
const getElementTextWidth = (element, text) => {
|
17827
|
-
function getTextWidth(text2, font) {
|
17828
|
-
const canvas = getTextWidth.canvas || (getTextWidth.canvas = document.createElement("canvas"));
|
17829
|
-
const context = canvas.getContext("2d");
|
17830
|
-
context.font = font;
|
17831
|
-
const metrics = context.measureText(text2);
|
17832
|
-
return metrics.width;
|
17833
|
-
}
|
17834
|
-
function getCssStyle(element2, prop) {
|
17835
|
-
return window.getComputedStyle(element2, null).getPropertyValue(prop);
|
17836
|
-
}
|
17837
|
-
function getCanvasFont(el = document.body) {
|
17838
|
-
const fontWeight = getCssStyle(el, "font-weight") || "normal";
|
17839
|
-
const fontSize = getCssStyle(el, "font-size") || "16px";
|
17840
|
-
const fontFamily = getCssStyle(el, "font-family") || "Times New Roman";
|
17841
|
-
return `${fontWeight} ${fontSize} ${fontFamily}`;
|
17842
|
-
}
|
17843
|
-
return getTextWidth(text || (element == null ? void 0 : element.innerHTML), getCanvasFont(element));
|
17844
|
-
};
|
17845
17829
|
const isColumnHidden = (settingFields, column, checked) => {
|
17846
17830
|
const isSettingField = (col) => settingFields.some((field) => field.field === resolvePropVal(col, ["field", "type"], [col]));
|
17847
17831
|
return isSettingField(column) && checked.length && !checked.includes(resolvePropVal(column, ["field", "type"], [column]));
|
@@ -17982,12 +17966,15 @@ var TableCell = defineComponent({
|
|
17982
17966
|
}
|
17983
17967
|
if (typeof showOverflowTooltip === "object") {
|
17984
17968
|
disabled = showOverflowTooltip.disabled;
|
17969
|
+
content = showOverflowTooltip.content || refRoot.value.innerText;
|
17985
17970
|
if (typeof showOverflowTooltip.content === "function") {
|
17986
17971
|
content = showOverflowTooltip.content(props2.column, props2.row);
|
17987
17972
|
}
|
17988
|
-
content = showOverflowTooltip.content || refRoot.value.innerText;
|
17989
17973
|
mode = showOverflowTooltip.mode || "auto";
|
17990
17974
|
}
|
17975
|
+
if (typeof disabled === "function") {
|
17976
|
+
disabled = Reflect.apply(disabled, this, [props2.column, props2.row]);
|
17977
|
+
}
|
17991
17978
|
return {
|
17992
17979
|
disabled,
|
17993
17980
|
content,
|
@@ -17995,20 +17982,16 @@ var TableCell = defineComponent({
|
|
17995
17982
|
};
|
17996
17983
|
};
|
17997
17984
|
const resolveOverflowTooltip = () => {
|
17998
|
-
if (!refRoot.value ||
|
17985
|
+
if (!refRoot.value || !isElement$2(refRoot.value)) {
|
17999
17986
|
return;
|
18000
17987
|
}
|
18001
17988
|
const {
|
18002
|
-
|
18003
|
-
|
17989
|
+
mode,
|
17990
|
+
disabled
|
18004
17991
|
} = resolveTooltipOption();
|
17992
|
+
isTipsEnabled.value = !disabled;
|
18005
17993
|
if (mode === "auto") {
|
18006
|
-
|
18007
|
-
const cellWidth = refRoot.value.clientWidth;
|
18008
|
-
const computedStyle = window.getComputedStyle(refRoot.value);
|
18009
|
-
const paddingWidth = ["padding-left", "padding-right"].reduce((width, prop) => width + Number(computedStyle.getPropertyValue(prop).replace("px", "")), 0);
|
18010
|
-
const cellInnerWidth = cellWidth - paddingWidth;
|
18011
|
-
isTipsEnabled.value = textWidth > cellInnerWidth;
|
17994
|
+
isTipsEnabled.value = hasOverflowEllipsis(refRoot.value);
|
18012
17995
|
}
|
18013
17996
|
if (mode === "static") {
|
18014
17997
|
isTipsEnabled.value = true;
|