tdesign-vue-next
Version:
TDesign Component for vue-next
73 lines (69 loc) • 2.52 kB
JavaScript
/**
* tdesign v1.20.2
* (c) 2026 tdesign
* @license MIT
*/
import { defineComponent, ref, onMounted, onUpdated, createVNode } from 'vue';
import { u as usePrefixClass } from '../../_chunks/dep-9ce910b6.mjs';
import 'lodash-es';
import '../../_chunks/dep-557b68dd.mjs';
import '../../_chunks/dep-26d65784.mjs';
import '../../_chunks/dep-f038e2b4.mjs';
import '../../_chunks/dep-05bddb06.mjs';
import '../../_chunks/dep-57027bda.mjs';
import '../../config-provider/hooks/useConfig.mjs';
import '../../config-provider/utils/context.mjs';
import '../../_chunks/dep-57949dcd.mjs';
import '../../_chunks/dep-cafb5eac.mjs';
import '../../_chunks/dep-f1da7269.mjs';
import '../../_chunks/dep-ea5fbe21.mjs';
import '../../_chunks/dep-192d0c88.mjs';
import '../../_chunks/dep-652c99fe.mjs';
import '../../_chunks/dep-5b369203.mjs';
import '../../_chunks/dep-a4f55e3b.mjs';
import '../../_chunks/dep-98dac781.mjs';
import '../../_chunks/dep-920eff5b.mjs';
var PopupOverflowContent = defineComponent({
name: "PopupOverflowContent",
props: {
foldIndex: {
type: Number,
required: true
}
},
setup: function setup(props, ctx) {
var classPrefix = usePrefixClass();
var wrapperRef = ref();
var hideBeforeFoldIndex = function hideBeforeFoldIndex() {
if (!wrapperRef.value) return;
var menuItemClass = "".concat(classPrefix.value, "-menu__item");
var submenuClass = "".concat(classPrefix.value, "-submenu");
var items = [];
var _collect = function collect(parent, depth) {
if (depth > 3) return;
Array.from(parent.children).forEach(function (el) {
if (!(el instanceof HTMLElement)) return;
if (el.classList.contains(menuItemClass) || el.classList.contains(submenuClass)) {
items.push(el);
} else {
_collect(el, depth + 1);
}
});
};
_collect(wrapperRef.value, 0);
items.forEach(function (el, index) {
el.style.display = index < props.foldIndex ? "none" : "";
});
};
onMounted(hideBeforeFoldIndex);
onUpdated(hideBeforeFoldIndex);
return function () {
var _ctx$slots$default, _ctx$slots;
return createVNode("div", {
"ref": wrapperRef
}, [(_ctx$slots$default = (_ctx$slots = ctx.slots)["default"]) === null || _ctx$slots$default === void 0 ? void 0 : _ctx$slots$default.call(_ctx$slots)]);
};
}
});
export { PopupOverflowContent as default };
//# sourceMappingURL=popup-overflow-content.mjs.map