comic-plus
Version:
<p align="center"> <img width="200px" src="./logo.png"/> </p>
98 lines (97 loc) • 4.35 kB
JavaScript
;
Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } });
const vue = require("vue");
const config = require("../../../../utils/config.js");
const typescript = require("../../../../utils/typescript.js");
require("@vueuse/core");
require("../../../../icons/index.js");
const components = require("../../../../icons/components/components.js");
const _hoisted_1 = ["onClick"];
const _hoisted_2 = { class: "cu-notice__title" };
const _hoisted_3 = { class: "cu-notice__main" };
const _hoisted_4 = ["innerHTML"];
const _sfc_main = /* @__PURE__ */ vue.defineComponent({
...{
name: "CuNoticeList"
},
__name: "list",
props: {
position: String,
list: Array
},
emits: ["empty"],
setup(__props, { emit: __emit }) {
const typeList = {
primary: components.VolumeNotice,
info: components.Info,
success: components.Success,
warning: components.Warning,
error: components.CloseOne
};
const props = __props;
const emit = __emit;
const zIndex = config.getNextZIndex();
function handleClick(item) {
var _a, _b;
(_b = (_a = item.props).click) == null ? void 0 : _b.call(_a, item.close);
}
function afterLeave() {
var _a;
if (((_a = props.list) == null ? void 0 : _a.length) === 0) {
emit("empty");
}
}
return (_ctx, _cache) => {
return vue.openBlock(), vue.createElementBlock("div", {
class: vue.normalizeClass(["cu-notice-popup", "cu-notice-popup--" + __props.position]),
style: vue.normalizeStyle({ zIndex: vue.unref(zIndex) })
}, [
vue.createVNode(vue.TransitionGroup, {
name: "cu-notice-" + __props.position,
onAfterLeave: afterLeave
}, {
default: vue.withCtx(() => [
(vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(__props.list, (item) => {
return vue.openBlock(), vue.createElementBlock("div", {
class: vue.normalizeClass(["cu-notice", [item.props.type ? "cu-notice--" + item.props.type : void 0, { "is-click": item.props.click }]]),
style: vue.normalizeStyle({ "--cu-notice-hovercolor": item.props.color }),
key: item.id,
onClick: ($event) => handleClick(item)
}, [
vue.createElementVNode("div", {
class: "cu-notice__head",
style: vue.normalizeStyle({ color: item.props.color })
}, [
vue.createElementVNode("span", _hoisted_2, [
vue.unref(typescript.isVueComponent)(item.props.icon) || typeList[item.props.type] ? (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(item.props.icon ?? typeList[item.props.type]), {
key: 0,
class: "cu-notice__head--icon"
})) : vue.createCommentVNode("", true),
vue.createTextVNode(" " + vue.toDisplayString(item.props.title), 1)
]),
item.props.showClose ? (vue.openBlock(), vue.createBlock(vue.unref(components.Close), {
key: 0,
class: "close-icon",
onClick: vue.withModifiers(($event) => item.close(item), ["stop"])
}, null, 8, ["onClick"])) : vue.createCommentVNode("", true)
], 4),
vue.createElementVNode("div", _hoisted_3, [
item.props.isVNode ? (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 0 }, [
vue.unref(typescript.isString)(item.props.content) ? (vue.openBlock(), vue.createElementBlock("div", {
key: 0,
innerHTML: item.props.content
}, null, 8, _hoisted_4)) : (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(item.props.content), { key: 1 }))
], 64)) : (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 1 }, [
vue.createTextVNode(vue.toDisplayString(item.props.content), 1)
], 64))
])
], 14, _hoisted_1);
}), 128))
]),
_: 1
}, 8, ["name"])
], 6);
};
}
});
exports.default = _sfc_main;