UNPKG

hongluan-ui

Version:
125 lines (120 loc) 4.26 kB
'use strict'; Object.defineProperty(exports, '__esModule', { value: true }); var vue = require('vue'); require('../../../hooks/index.js'); require('../../../utils/index.js'); var index = require('../../icon/index.js'); require('../../system-icon/index.js'); var pluginVue_exportHelper = require('../../../_virtual/plugin-vue_export-helper.js'); var success = require('../../system-icon/src/success.js'); var info = require('../../system-icon/src/info.js'); var warning = require('../../system-icon/src/warning.js'); var error = require('../../system-icon/src/error.js'); var loading = require('../../system-icon/src/loading.js'); var index$1 = require('../../../hooks/use-namespace/index.js'); var validator = require('../../../utils/vue/validator.js'); const _sfc_main = vue.defineComponent({ name: "Spinner", components: { HlIcon: index.HlIcon, SystemSuccess: success["default"], SystemInfo: info["default"], SystemWarning: warning["default"], SystemError: error["default"], SystemLoading: loading["default"] }, props: { status: { type: String, default: "" }, animation: { type: String, default: "around-right" }, duration: { type: String, default: "" }, color: { type: String }, size: String }, setup(props) { const { namespace } = index$1.useNamespace("spinner"); const definedSize = vue.ref(false); const style = vue.ref({ "--spinner-color": props.color, "--spinner-duration": props.duration }); if (validator.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 = vue.resolveComponent("system-loading"); const _component_system_info = vue.resolveComponent("system-info"); const _component_hl_icon = vue.resolveComponent("hl-icon"); const _component_system_success = vue.resolveComponent("system-success"); const _component_system_warning = vue.resolveComponent("system-warning"); const _component_system_error = vue.resolveComponent("system-error"); return vue.openBlock(), vue.createElementBlock("div", { ref: "iconRef", class: vue.normalizeClass([ _ctx.namespace, _ctx.animation, _ctx.status ? `is-finish ${_ctx.status}` : "", _ctx.definedSize && _ctx.size ? _ctx.size : "" ]), style: vue.normalizeStyle(_ctx.style) }, [ vue.createElementVNode("div", { class: "spinner-wrap" }, [ vue.renderSlot(_ctx.$slots, "default", {}, () => [ vue.createVNode(_component_system_loading) ]) ]), vue.createElementVNode("div", { class: "show-result" }, [ _ctx.status === "info" ? vue.renderSlot(_ctx.$slots, "info", { key: 0 }, () => [ vue.createVNode(_component_hl_icon, null, { default: vue.withCtx(() => [ vue.createVNode(_component_system_info) ]), _: 1 }) ]) : _ctx.status === "success" ? vue.renderSlot(_ctx.$slots, "success", { key: 1 }, () => [ vue.createVNode(_component_hl_icon, null, { default: vue.withCtx(() => [ vue.createVNode(_component_system_success) ]), _: 1 }) ]) : _ctx.status === "warning" ? vue.renderSlot(_ctx.$slots, "warning", { key: 2 }, () => [ vue.createVNode(_component_hl_icon, null, { default: vue.withCtx(() => [ vue.createVNode(_component_system_warning) ]), _: 1 }) ]) : _ctx.status === "error" || !_ctx.status ? vue.renderSlot(_ctx.$slots, "error", { key: 3 }, () => [ vue.createVNode(_component_hl_icon, null, { default: vue.withCtx(() => [ vue.createVNode(_component_system_error) ]), _: 1 }) ]) : vue.createCommentVNode("v-if", true) ]) ], 6); } var Spinner = /* @__PURE__ */ pluginVue_exportHelper["default"](_sfc_main, [["render", _sfc_render]]); exports["default"] = Spinner; //# sourceMappingURL=index.js.map