UNPKG

@opensig/opendesign

Version:

48 lines (47 loc) 1.24 kB
"use strict"; const vue = require("vue"); const core = require("@vueuse/core"); const _sfc_main = /* @__PURE__ */ vue.defineComponent({ __name: "VirtualListItem", props: { index: {}, mainSize: {}, layout: {}, observeResize: { type: Boolean } }, emits: ["resize"], setup(__props, { emit: __emit }) { const props = __props; const emits = __emit; const itemRef = vue.ref(); const itemStyle = vue.computed(() => { if (props.mainSize == null) { return void 0; } const sizeProp = props.layout === "horizontal" ? "width" : "height"; return { [sizeProp]: `${props.mainSize}px` }; }); core.useResizeObserver(itemRef, (entries) => { if (props.observeResize && entries[0]) { emits("resize", entries[0], props.index); } }); return (_ctx, _cache) => { return vue.openBlock(), vue.createElementBlock( "div", { ref_key: "itemRef", ref: itemRef, style: vue.normalizeStyle(itemStyle.value), class: "o-virtual-render-item" }, [ vue.renderSlot(_ctx.$slots, "default") ], 4 /* STYLE */ ); }; } }); module.exports = _sfc_main;