87f9c71e42434ba4274981c8ee012af9d78bf04f663f92ec71b2dd6d37407763a116c0414e855c1ce2600371f6c88699959b90fd98851f80ae7aff9ad596e7 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107
  1. 'use strict';
  2. Object.defineProperty(exports, '__esModule', { value: true });
  3. var vue = require('vue');
  4. var index$1 = require('../../icon/index.js');
  5. var iconsVue = require('@element-plus/icons-vue');
  6. var tag = require('./tag.js');
  7. var pluginVue_exportHelper = require('../../../_virtual/plugin-vue_export-helper.js');
  8. var useFormCommonProps = require('../../form/src/hooks/use-form-common-props.js');
  9. var index = require('../../../hooks/use-namespace/index.js');
  10. const __default__ = vue.defineComponent({
  11. name: "ElTag"
  12. });
  13. const _sfc_main = /* @__PURE__ */ vue.defineComponent({
  14. ...__default__,
  15. props: tag.tagProps,
  16. emits: tag.tagEmits,
  17. setup(__props, { emit }) {
  18. const props = __props;
  19. const tagSize = useFormCommonProps.useFormSize();
  20. const ns = index.useNamespace("tag");
  21. const containerKls = vue.computed(() => {
  22. const { type, hit, effect, closable, round } = props;
  23. return [
  24. ns.b(),
  25. ns.is("closable", closable),
  26. ns.m(type || "primary"),
  27. ns.m(tagSize.value),
  28. ns.m(effect),
  29. ns.is("hit", hit),
  30. ns.is("round", round)
  31. ];
  32. });
  33. const handleClose = (event) => {
  34. emit("close", event);
  35. };
  36. const handleClick = (event) => {
  37. emit("click", event);
  38. };
  39. const handleVNodeMounted = (vnode) => {
  40. var _a, _b, _c;
  41. if ((_c = (_b = (_a = vnode == null ? void 0 : vnode.component) == null ? void 0 : _a.subTree) == null ? void 0 : _b.component) == null ? void 0 : _c.bum) {
  42. vnode.component.subTree.component.bum = null;
  43. }
  44. };
  45. return (_ctx, _cache) => {
  46. return _ctx.disableTransitions ? (vue.openBlock(), vue.createElementBlock("span", {
  47. key: 0,
  48. class: vue.normalizeClass(vue.unref(containerKls)),
  49. style: vue.normalizeStyle({ backgroundColor: _ctx.color }),
  50. onClick: handleClick
  51. }, [
  52. vue.createElementVNode("span", {
  53. class: vue.normalizeClass(vue.unref(ns).e("content"))
  54. }, [
  55. vue.renderSlot(_ctx.$slots, "default")
  56. ], 2),
  57. _ctx.closable ? (vue.openBlock(), vue.createBlock(vue.unref(index$1.ElIcon), {
  58. key: 0,
  59. class: vue.normalizeClass(vue.unref(ns).e("close")),
  60. onClick: vue.withModifiers(handleClose, ["stop"])
  61. }, {
  62. default: vue.withCtx(() => [
  63. vue.createVNode(vue.unref(iconsVue.Close))
  64. ]),
  65. _: 1
  66. }, 8, ["class", "onClick"])) : vue.createCommentVNode("v-if", true)
  67. ], 6)) : (vue.openBlock(), vue.createBlock(vue.Transition, {
  68. key: 1,
  69. name: `${vue.unref(ns).namespace.value}-zoom-in-center`,
  70. appear: "",
  71. onVnodeMounted: handleVNodeMounted
  72. }, {
  73. default: vue.withCtx(() => [
  74. vue.createElementVNode("span", {
  75. class: vue.normalizeClass(vue.unref(containerKls)),
  76. style: vue.normalizeStyle({ backgroundColor: _ctx.color }),
  77. onClick: handleClick
  78. }, [
  79. vue.createElementVNode("span", {
  80. class: vue.normalizeClass(vue.unref(ns).e("content"))
  81. }, [
  82. vue.renderSlot(_ctx.$slots, "default")
  83. ], 2),
  84. _ctx.closable ? (vue.openBlock(), vue.createBlock(vue.unref(index$1.ElIcon), {
  85. key: 0,
  86. class: vue.normalizeClass(vue.unref(ns).e("close")),
  87. onClick: vue.withModifiers(handleClose, ["stop"])
  88. }, {
  89. default: vue.withCtx(() => [
  90. vue.createVNode(vue.unref(iconsVue.Close))
  91. ]),
  92. _: 1
  93. }, 8, ["class", "onClick"])) : vue.createCommentVNode("v-if", true)
  94. ], 6)
  95. ]),
  96. _: 3
  97. }, 8, ["name"]));
  98. };
  99. }
  100. });
  101. var Tag = /* @__PURE__ */ pluginVue_exportHelper["default"](_sfc_main, [["__file", "tag.vue"]]);
  102. exports["default"] = Tag;
  103. //# sourceMappingURL=tag2.js.map