UNPKG

hongluan-ui

Version:
121 lines (118 loc) 4.1 kB
import { defineComponent, ref, resolveComponent, openBlock, createElementBlock, normalizeClass, normalizeStyle, createElementVNode, renderSlot, createVNode, withCtx, createCommentVNode } from 'vue'; import '../../../hooks/index.mjs'; import '../../../utils/index.mjs'; import { HlIcon } from '../../icon/index.mjs'; import '../../system-icon/index.mjs'; import _export_sfc from '../../../_virtual/plugin-vue_export-helper.mjs'; import SystemSuccess from '../../system-icon/src/success.mjs'; import SystemInfo from '../../system-icon/src/info.mjs'; import SystemWarning from '../../system-icon/src/warning.mjs'; import SystemError from '../../system-icon/src/error.mjs'; import SystemLoading from '../../system-icon/src/loading.mjs'; import { useNamespace } from '../../../hooks/use-namespace/index.mjs'; import { isValidComponentSize } from '../../../utils/vue/validator.mjs'; const _sfc_main = defineComponent({ name: "Spinner", components: { HlIcon, SystemSuccess, SystemInfo, SystemWarning, SystemError, SystemLoading }, props: { status: { type: String, default: "" }, animation: { type: String, default: "around-right" }, duration: { type: String, default: "" }, color: { type: String }, size: String }, setup(props) { const { namespace } = useNamespace("spinner"); const definedSize = ref(false); const style = ref({ "--spinner-color": props.color, "--spinner-duration": props.duration }); if (isValidComponentSize(props.size)) { definedSize.value = true; } else { Object.assign(style.value, { "--spinner-width": props.size, "--spinner-height": props.size }); } return { namespace, style, definedSize }; } }); function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) { const _component_system_loading = resolveComponent("system-loading"); const _component_system_info = resolveComponent("system-info"); const _component_hl_icon = resolveComponent("hl-icon"); const _component_system_success = resolveComponent("system-success"); const _component_system_warning = resolveComponent("system-warning"); const _component_system_error = resolveComponent("system-error"); return openBlock(), createElementBlock("div", { ref: "iconRef", class: normalizeClass([ _ctx.namespace, _ctx.animation, _ctx.status ? `is-finish ${_ctx.status}` : "", _ctx.definedSize && _ctx.size ? _ctx.size : "" ]), style: normalizeStyle(_ctx.style) }, [ createElementVNode("div", { class: "spinner-wrap" }, [ renderSlot(_ctx.$slots, "default", {}, () => [ createVNode(_component_system_loading) ]) ]), createElementVNode("div", { class: "show-result" }, [ _ctx.status === "info" ? renderSlot(_ctx.$slots, "info", { key: 0 }, () => [ createVNode(_component_hl_icon, null, { default: withCtx(() => [ createVNode(_component_system_info) ]), _: 1 }) ]) : _ctx.status === "success" ? renderSlot(_ctx.$slots, "success", { key: 1 }, () => [ createVNode(_component_hl_icon, null, { default: withCtx(() => [ createVNode(_component_system_success) ]), _: 1 }) ]) : _ctx.status === "warning" ? renderSlot(_ctx.$slots, "warning", { key: 2 }, () => [ createVNode(_component_hl_icon, null, { default: withCtx(() => [ createVNode(_component_system_warning) ]), _: 1 }) ]) : _ctx.status === "error" || !_ctx.status ? renderSlot(_ctx.$slots, "error", { key: 3 }, () => [ createVNode(_component_hl_icon, null, { default: withCtx(() => [ createVNode(_component_system_error) ]), _: 1 }) ]) : createCommentVNode("v-if", true) ]) ], 6); } var Spinner = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render]]); export { Spinner as default }; //# sourceMappingURL=index.mjs.map