bkui-vue 0.0.1-beta.177 → 0.0.1-beta.178
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 +26 -26
- package/dist/index.esm.js +43 -9
- package/dist/index.umd.js +24 -24
- package/lib/directives/ellipsis.d.ts +4 -1
- package/lib/directives/index.js +1 -1
- package/lib/table/index.js +1 -1
- package/lib/table/props.d.ts +1 -0
- package/package.json +1 -1
package/dist/index.esm.js
CHANGED
@@ -11318,6 +11318,16 @@ const createInstance = (el, binding) => {
|
|
11318
11318
|
handleMouseLeave
|
11319
11319
|
}
|
11320
11320
|
});
|
11321
|
+
const destroyInstance = (element) => {
|
11322
|
+
var _a, _b;
|
11323
|
+
handleMouseLeave();
|
11324
|
+
(_a = element != null ? element : el) == null ? void 0 : _a.removeEventListener("mouseenter", handleMouseEnter);
|
11325
|
+
(_b = element != null ? element : el) == null ? void 0 : _b.removeEventListener("mouseleave", handleMouseLeave);
|
11326
|
+
};
|
11327
|
+
return {
|
11328
|
+
destroyInstance,
|
11329
|
+
instance
|
11330
|
+
};
|
11321
11331
|
};
|
11322
11332
|
const ellipsis = {
|
11323
11333
|
mounted(el, binding) {
|
@@ -16018,8 +16028,9 @@ const IColumnType = {
|
|
16018
16028
|
width: PropTypes.oneOfType([PropTypes.number.def(void 0), PropTypes.string.def("auto")]),
|
16019
16029
|
minWidth: PropTypes.oneOfType([PropTypes.number.def(void 0), PropTypes.string.def("auto")]).def(),
|
16020
16030
|
showOverflowTooltip: PropTypes.oneOfType([PropTypes.bool, PropTypes.shape({
|
16021
|
-
content: PropTypes.string,
|
16022
|
-
disabled: PropTypes.bool
|
16031
|
+
content: PropTypes.string.def(""),
|
16032
|
+
disabled: PropTypes.bool.def(false),
|
16033
|
+
watchCellResize: PropTypes.bool.def(true)
|
16023
16034
|
})]).def(false),
|
16024
16035
|
type: PropTypes.commonType(["selection", "index", "expand", "none"], "columnType").def("none"),
|
16025
16036
|
resizable: PropTypes.bool.def(true),
|
@@ -16890,6 +16901,8 @@ var TableCell = defineComponent({
|
|
16890
16901
|
const {
|
16891
16902
|
showOverflowTooltip = false
|
16892
16903
|
} = props2.column || {};
|
16904
|
+
let observerIns = null;
|
16905
|
+
let bkEllipsisIns = null;
|
16893
16906
|
const resolveTooltipOption = () => {
|
16894
16907
|
let disabled = true;
|
16895
16908
|
let content = refRoot.value.innerText;
|
@@ -16908,17 +16921,38 @@ var TableCell = defineComponent({
|
|
16908
16921
|
content
|
16909
16922
|
};
|
16910
16923
|
};
|
16924
|
+
const resolveOverflowTooltip = () => {
|
16925
|
+
const textWidth = getElementTextWidth(refRoot.value);
|
16926
|
+
const cellWidth = refRoot.value.clientWidth;
|
16927
|
+
isTipsEnabled.value = textWidth > cellWidth;
|
16928
|
+
if (isTipsEnabled.value) {
|
16929
|
+
const bindings = ref(resolveTooltipOption());
|
16930
|
+
if (bkEllipsisIns === null) {
|
16931
|
+
bkEllipsisIns = createInstance(refRoot.value, bindings);
|
16932
|
+
}
|
16933
|
+
} else {
|
16934
|
+
bkEllipsisIns == null ? void 0 : bkEllipsisIns.destroyInstance(refRoot.value);
|
16935
|
+
bkEllipsisIns = null;
|
16936
|
+
}
|
16937
|
+
};
|
16911
16938
|
onMounted(() => {
|
16912
|
-
|
16913
|
-
|
16914
|
-
|
16915
|
-
|
16916
|
-
|
16917
|
-
|
16918
|
-
|
16939
|
+
var _a;
|
16940
|
+
const {
|
16941
|
+
disabled
|
16942
|
+
} = resolveTooltipOption();
|
16943
|
+
if (!disabled) {
|
16944
|
+
resolveOverflowTooltip();
|
16945
|
+
if (((_a = props2.column.showOverflowTooltip) == null ? void 0 : _a.watchCellResize) !== false) {
|
16946
|
+
observerIns = observerResize(refRoot.value, () => {
|
16947
|
+
resolveOverflowTooltip();
|
16948
|
+
}, 60, true);
|
16949
|
+
observerIns.start();
|
16919
16950
|
}
|
16920
16951
|
}
|
16921
16952
|
});
|
16953
|
+
onBeforeUnmount(() => {
|
16954
|
+
bkEllipsisIns == null ? void 0 : bkEllipsisIns.destroyInstance(refRoot.value);
|
16955
|
+
});
|
16922
16956
|
return () => {
|
16923
16957
|
var _a;
|
16924
16958
|
return createVNode("div", {
|