UNPKG

@vuesax-alpha/nightly

Version:
187 lines (184 loc) • 6.68 kB
import { defineComponent, ref, computed, unref, openBlock, createElementBlock, normalizeClass, normalizeStyle, createElementVNode, toDisplayString, createCommentVNode, createBlock, Fragment } from 'vue'; import '../../../hooks/index.mjs'; import { IconLoading } from '../../icon/index.mjs'; import '../../../utils/index.mjs'; import { loadingProps } from './loading.mjs'; import _export_sfc from '../../../_virtual/plugin-vue_export-helper.mjs'; import { useGlobalComponentSettings } from '../../../hooks/use-global-config/index.mjs'; import { useColor } from '../../../hooks/use-common-props/index.mjs'; import { useProp } from '../../../hooks/use-prop/index.mjs'; import { getVsColor } from '../../../utils/color.mjs'; const __default__ = defineComponent({ name: "VsLoading" }); const _sfc_main = defineComponent({ ...__default__, props: loadingProps, setup(__props, { expose: __expose }) { const props = __props; const { ns, zIndex } = useGlobalComponentSettings("loading"); const { currentZIndex } = zIndex; const loadingRef = ref(); const color = useColor("primary"); const background = useProp("background"); const type = useProp("type"); const loadingKls = computed(() => [ ns.b(), type.value && ns.m(type.value), ns.is("has-target", !!unref(props.target)) ]); const loadingStyles = computed(() => [ ns.cssVar({ color: getVsColor(color), background: getVsColor(background), opacity: `${unref(props.opacity)}` }), { zIndex: unref(currentZIndex) } ]); const close = () => { var _a; (_a = loadingRef.value) == null ? void 0 : _a.remove(); }; __expose({ close }); return (_ctx, _cache) => { return openBlock(), createElementBlock( "div", { ref_key: "loadingRef", ref: loadingRef, class: normalizeClass(loadingKls.value), style: normalizeStyle(loadingStyles.value) }, [ createElementVNode( "div", { class: normalizeClass(unref(ns).e("load")), style: normalizeStyle([{ transform: `scale(${unref(_ctx.scale)})` }]) }, [ createElementVNode( "div", { class: normalizeClass(unref(ns).e("animation")) }, [ unref(_ctx.percent) ? (openBlock(), createElementBlock( "div", { key: 0, class: normalizeClass(unref(ns).em("load", "percent")) }, toDisplayString(unref(_ctx.percent)), 3 )) : createCommentVNode("v-if", true), unref(unref(type)) === "default" ? (openBlock(), createBlock(unref(IconLoading), { key: 1 })) : createCommentVNode("v-if", true), createElementVNode( "div", { class: normalizeClass([unref(ns).em("animation", "item"), unref(ns).em("animation", "item-1")]) }, null, 2 ), createElementVNode( "div", { class: normalizeClass([unref(ns).em("animation", "item"), unref(ns).em("animation", "item-2")]) }, null, 2 ), createElementVNode( "div", { class: normalizeClass([unref(ns).em("animation", "item"), unref(ns).em("animation", "item-3")]) }, null, 2 ), unref(unref(type)) === "ball" ? (openBlock(), createElementBlock( Fragment, { key: 2 }, [ createElementVNode( "div", { class: normalizeClass([ unref(ns).em("animation", "shadow"), unref(ns).em("animation", "shadow-1") ]) }, null, 2 ), createElementVNode( "div", { class: normalizeClass([ unref(ns).em("animation", "shadow"), unref(ns).em("animation", "shadow-2") ]) }, null, 2 ), createElementVNode( "div", { class: normalizeClass([ unref(ns).em("animation", "shadow"), unref(ns).em("animation", "shadow-3") ]) }, null, 2 ) ], 64 )) : createCommentVNode("v-if", true) ], 2 ), unref(_ctx.text) ? (openBlock(), createElementBlock( "div", { key: 0, class: normalizeClass(unref(ns).e("text")) }, toDisplayString(unref(_ctx.text)), 3 )) : createCommentVNode("v-if", true) ], 6 ), unref(_ctx.progress) ? (openBlock(), createElementBlock( "div", { key: 0, class: normalizeClass(unref(ns).e("progress")) }, [ createElementVNode( "div", { class: normalizeClass(unref(ns).e("progress-bar")), style: normalizeStyle([{ width: `${unref(_ctx.progress)}%` }]) }, null, 6 ) ], 2 )) : createCommentVNode("v-if", true) ], 6 ); }; } }); var LoadingConstructor = /* @__PURE__ */ _export_sfc(_sfc_main, [["__file", "/home/runner/work/vuesax-alpha/vuesax-alpha/packages/components/loading/src/loading.vue"]]); export { LoadingConstructor as default }; //# sourceMappingURL=loading2.mjs.map