UNPKG

plus-pro-components

Version:

Page level components developed based on Element Plus.

171 lines (166 loc) 6.52 kB
'use strict'; Object.defineProperty(exports, '__esModule', { value: true }); var vue = require('vue'); var elementPlus = require('element-plus'); require('../../utils/index.js'); var is = require('../../utils/is.js'); const _hoisted_1 = { class: "plus-check-card__avatar-wrapper" }; const _hoisted_2 = { class: "plus-check-card__right-content" }; const _hoisted_3 = { key: 0, class: "plus-check-card__title" }; const _hoisted_4 = { class: "plus-check-card__title-left" }; const _hoisted_5 = { key: 1, class: "plus-check-card__description" }; var _sfc_main = /* @__PURE__ */ vue.defineComponent({ ...{ name: "PlusCheckCard" }, __name: "index", props: { modelValue: { type: Boolean, default: false }, size: { default: "default" }, avatar: { type: [String, Function], default: void 0 }, avatarProps: { default: () => ({}) }, title: { type: [String, Function], default: void 0 }, description: { type: [String, Function], default: void 0 }, disabled: { type: Boolean, default: false }, extra: { type: Function, default: void 0 } }, emits: ["update:modelValue", "change", "extra"], setup(__props, { emit: __emit }) { const classDataEnum = { large: "plus-check-card--large", default: "plus-check-card--default", small: "plus-check-card--small" }; const props = __props; const emit = __emit; const state = vue.reactive({ checked: false }); vue.watchEffect(() => { state.checked = props.modelValue; }); const getClass = () => { return props.size ? classDataEnum[props.size] : "plus-check-card--default"; }; const handleClick = () => { if (props.disabled) return; state.checked = !state.checked; emit("update:modelValue", state.checked); emit("change", state.checked); }; const handelExtra = () => { if (props.disabled) return; emit("extra"); }; return (_ctx, _cache) => { return vue.openBlock(), vue.createElementBlock( "div", { class: vue.normalizeClass(["plus-check-card", [ getClass(), state.checked ? "plus-check-card--checked" : "", _ctx.disabled ? "plus-check-card--disabled" : "" ]]), onClick: handleClick }, [ vue.createElementVNode("div", _hoisted_1, [ vue.unref(is.isFunction)(_ctx.avatar) ? (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(_ctx.avatar), { key: 0, avatar: _ctx.avatar, title: _ctx.title, description: _ctx.description }, null, 8, ["avatar", "title", "description"])) : _ctx.$slots.avatar ? vue.renderSlot(_ctx.$slots, "avatar", { key: 1, avatar: _ctx.avatar, title: _ctx.title, description: _ctx.description }) : vue.unref(is.isString)(_ctx.avatar) ? (vue.openBlock(), vue.createBlock(vue.unref(elementPlus.ElAvatar), vue.mergeProps({ key: 2, src: _ctx.avatar }, _ctx.avatarProps), null, 16, ["src"])) : vue.createCommentVNode("v-if", true) ]), vue.createElementVNode("div", _hoisted_2, [ _ctx.title || _ctx.$slots.title ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_3, [ vue.createElementVNode("div", _hoisted_4, [ vue.unref(is.isFunction)(_ctx.title) ? (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(_ctx.title), { key: 0, avatar: _ctx.avatar, title: _ctx.title, description: _ctx.description }, null, 8, ["avatar", "title", "description"])) : _ctx.$slots.title ? vue.renderSlot(_ctx.$slots, "title", { key: 1, title: _ctx.title, avatar: _ctx.avatar, description: _ctx.description }) : (vue.openBlock(), vue.createElementBlock( vue.Fragment, { key: 2 }, [ vue.createTextVNode( vue.toDisplayString(_ctx.title), 1 /* TEXT */ ) ], 64 /* STABLE_FRAGMENT */ )) ]), vue.createElementVNode("div", { class: "plus-check-card__title-right", onClick: vue.withModifiers(handelExtra, ["stop"]) }, [ vue.unref(is.isFunction)(_ctx.extra) ? (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(_ctx.extra), { key: 0, avatar: _ctx.avatar, title: _ctx.title, description: _ctx.description }, null, 8, ["avatar", "title", "description"])) : _ctx.$slots.extra ? vue.renderSlot(_ctx.$slots, "extra", { key: 1, title: _ctx.title, avatar: _ctx.avatar, description: _ctx.description }) : vue.createCommentVNode("v-if", true) ]) ])) : vue.createCommentVNode("v-if", true), _ctx.description || _ctx.$slots.description ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_5, [ vue.unref(is.isFunction)(_ctx.description) ? (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(_ctx.description), { key: 0, title: _ctx.title, avatar: _ctx.avatar, description: _ctx.description }, null, 8, ["title", "avatar", "description"])) : _ctx.$slots.description ? vue.renderSlot(_ctx.$slots, "description", { key: 1, title: _ctx.title, description: _ctx.description, avatar: _ctx.avatar }) : (vue.openBlock(), vue.createElementBlock( vue.Fragment, { key: 2 }, [ vue.createTextVNode( vue.toDisplayString(_ctx.description), 1 /* TEXT */ ) ], 64 /* STABLE_FRAGMENT */ )) ])) : vue.createCommentVNode("v-if", true) ]) ], 2 /* CLASS */ ); }; } }); exports.default = _sfc_main;