UNPKG

hongluan-ui

Version:
115 lines (112 loc) 4.76 kB
import { defineComponent, ref, computed, resolveComponent, openBlock, createBlock, Transition, withCtx, withDirectives, createElementVNode, normalizeClass, renderSlot, createVNode, createCommentVNode, createElementBlock, createTextVNode, toDisplayString, vShow } from 'vue'; import '../../../hooks/index.mjs'; import { HlIcon } from '../../icon/index.mjs'; import '../../system-icon/index.mjs'; import { alertProps } from './alert.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 SystemClose from '../../system-icon/src/close.mjs'; import { useNamespace } from '../../../hooks/use-namespace/index.mjs'; const _sfc_main = defineComponent({ name: "Alert", components: { HlIcon, SystemSuccess, SystemInfo, SystemWarning, SystemError, SystemClose }, props: alertProps, emits: ["close"], setup(props, { emit }) { const visible = ref(true); const typeClass = computed(() => `${props.type}`); const iconName = computed(() => props.type || "info"); const close = (evt) => { visible.value = false; emit("close", evt); }; const { namespace } = useNamespace("alert"); return { namespace, visible, typeClass, iconName, close }; } }); function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) { const _component_system_success = resolveComponent("system-success"); const _component_system_info = resolveComponent("system-info"); const _component_system_warning = resolveComponent("system-warning"); const _component_system_error = resolveComponent("system-error"); const _component_hl_icon = resolveComponent("hl-icon"); const _component_system_close = resolveComponent("system-close"); return openBlock(), createBlock(Transition, { name: "alert-fade" }, { default: withCtx(() => [ withDirectives(createElementVNode("div", { class: normalizeClass([_ctx.namespace, _ctx.typeClass, { "has-description": _ctx.description || _ctx.$slots.default, [_ctx.effect]: true, "dashed": _ctx.dashed }]), role: "alert" }, [ _ctx.showIcon ? renderSlot(_ctx.$slots, "icon", { key: 0 }, () => [ createVNode(_component_hl_icon, { class: "alert-icon" }, { default: withCtx(() => [ _ctx.iconName === "success" ? (openBlock(), createBlock(_component_system_success, { key: 0 })) : createCommentVNode("v-if", true), _ctx.iconName === "info" ? (openBlock(), createBlock(_component_system_info, { key: 1 })) : createCommentVNode("v-if", true), _ctx.iconName === "warning" ? (openBlock(), createBlock(_component_system_warning, { key: 2 })) : createCommentVNode("v-if", true), _ctx.iconName === "danger" || _ctx.iconName === "error" ? (openBlock(), createBlock(_component_system_error, { key: 3 })) : createCommentVNode("v-if", true) ]), _: 1 }) ]) : createCommentVNode("v-if", true), createElementVNode("div", { class: "alert-content" }, [ _ctx.title || _ctx.$slots.title ? (openBlock(), createElementBlock("span", { key: 0, class: "title" }, [ renderSlot(_ctx.$slots, "title", {}, () => [ createTextVNode(toDisplayString(_ctx.title), 1) ]) ])) : createCommentVNode("v-if", true), _ctx.$slots.default || !!_ctx.description ? (openBlock(), createElementBlock("div", { key: 1, class: "description" }, [ renderSlot(_ctx.$slots, "default", {}, () => [ createTextVNode(toDisplayString(_ctx.description), 1) ]) ])) : createCommentVNode("v-if", true) ]), _ctx.closable && !_ctx.closeText ? (openBlock(), createBlock(_component_hl_icon, { key: 1, class: "alert-close", onClick: _ctx.close }, { default: withCtx(() => [ createVNode(_component_system_close) ]), _: 1 }, 8, ["onClick"])) : (openBlock(), createElementBlock("div", { key: 2, class: "alert-customed", onClick: _ctx.close }, toDisplayString(_ctx.closeText), 9, ["onClick"])) ], 2), [ [vShow, _ctx.visible] ]) ]), _: 3 }); } var Alert = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render]]); export { Alert as default }; //# sourceMappingURL=alert2.mjs.map