UNPKG

various-ui

Version:

This is a test version of the Vue 3 component library

103 lines (98 loc) 3.35 kB
'use strict'; Object.defineProperty(exports, '__esModule', { value: true }); var vue = require('vue'); var component = require('./src/component.js'); var composable = require('./src/composable.js'); const _hoisted_1 = { class: "ui-simplebar-content" }; const __default__ = vue.defineComponent({ name: "UiSimplebar" }); var _sfc_main = /* @__PURE__ */ vue.defineComponent({ ...__default__, props: component.UiSimplebarPropsOption, emits: component.UiSimplebarEmits, setup(__props, { expose: __expose, emit: __emit }) { const emits = __emit; const define = __props; const { refs, vars, nodes, binds, methods } = composable.useComposable(define, emits); const { slideway, container } = nodes; const { visible } = refs; const move = (top) => { vue.nextTick(() => { var _a; (_a = container.value) == null ? void 0 : _a.scrollTo({ top, behavior: "smooth" }); }); }; vue.onBeforeUnmount(() => { var _a; return (_a = vars.observer) == null ? void 0 : _a.disconnect(); }); vue.onMounted(() => { var _a; const node = (_a = container.value) == null ? void 0 : _a.querySelector(".ui-simplebar-content"); if (node) { vars.observer = new ResizeObserver(() => methods.init()); vars.observer.observe(node); } }); ; __expose({ move }); return (_ctx, _cache) => { return vue.openBlock(), vue.createElementBlock( "div", { class: vue.normalizeClass(["ui-simplebar", define.trigger == "Hover" ? "ui-simplebar-hover" : ""]) }, [ vue.createCommentVNode(" * \u8F68\u9053 "), vue.unref(visible) ? (vue.openBlock(), vue.createElementBlock( "div", { key: 0, class: "ui-simplebar-slideway", ref_key: "slideway", ref: slideway, onMousedown: _cache[1] || (_cache[1] = vue.withModifiers( //@ts-ignore (...args) => vue.unref(methods).move && vue.unref(methods).move(...args), ["self"] )) }, [ vue.createElementVNode( "div", vue.mergeProps({ class: "ui-simplebar-bar" }, vue.unref(binds).bar, { onMousedown: _cache[0] || (_cache[0] = //@ts-ignore (...args) => vue.unref(methods).drag && vue.unref(methods).drag(...args)) }), null, 16 /* FULL_PROPS */ ) ], 544 /* NEED_HYDRATION, NEED_PATCH */ )) : vue.createCommentVNode("v-if", true), vue.createCommentVNode(" * \u5185\u5BB9 "), vue.createElementVNode( "div", vue.mergeProps({ class: "ui-simplebar-container", ref_key: "container", ref: container }, vue.unref(binds).container), [ vue.createElementVNode("div", _hoisted_1, [ vue.renderSlot(_ctx.$slots, "default") ]) ], 16 /* FULL_PROPS */ ) ], 2 /* CLASS */ ); }; } }); exports.default = _sfc_main; //# sourceMappingURL=index.vue2.js.map