timeline-item.mjs 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125
  1. import { defineComponent, inject, computed, openBlock, createElementBlock, normalizeClass, createElementVNode, unref, normalizeStyle, createBlock, withCtx, resolveDynamicComponent, createCommentVNode, renderSlot, toDisplayString } from 'vue';
  2. import { ElIcon } from '../../icon/index.mjs';
  3. import { timelineItemProps } from './timeline-item2.mjs';
  4. import { TIMELINE_INJECTION_KEY } from './tokens.mjs';
  5. import _export_sfc from '../../../_virtual/plugin-vue_export-helper.mjs';
  6. import { useNamespace } from '../../../hooks/use-namespace/index.mjs';
  7. const _sfc_main = defineComponent({
  8. ...{
  9. name: "ElTimelineItem"
  10. },
  11. __name: "timeline-item",
  12. props: timelineItemProps,
  13. setup(__props) {
  14. const props = __props;
  15. const { props: timelineProps } = inject(
  16. TIMELINE_INJECTION_KEY
  17. );
  18. const ns = useNamespace("timeline-item");
  19. const defaultNodeKls = computed(() => [
  20. ns.e("node"),
  21. ns.em("node", props.size || ""),
  22. ns.em("node", props.type || ""),
  23. ns.is("hollow", props.hollow)
  24. ]);
  25. const timelineItemKls = computed(() => [
  26. ns.b(),
  27. { [ns.e("center")]: props.center },
  28. ns.is(timelineProps.mode)
  29. ]);
  30. return (_ctx, _cache) => {
  31. return openBlock(), createElementBlock(
  32. "li",
  33. {
  34. class: normalizeClass(timelineItemKls.value)
  35. },
  36. [
  37. createElementVNode(
  38. "div",
  39. {
  40. class: normalizeClass(unref(ns).e("tail"))
  41. },
  42. null,
  43. 2
  44. ),
  45. !_ctx.$slots.dot ? (openBlock(), createElementBlock(
  46. "div",
  47. {
  48. key: 0,
  49. class: normalizeClass(defaultNodeKls.value),
  50. style: normalizeStyle({
  51. backgroundColor: _ctx.color
  52. })
  53. },
  54. [
  55. _ctx.icon ? (openBlock(), createBlock(unref(ElIcon), {
  56. key: 0,
  57. class: normalizeClass(unref(ns).e("icon"))
  58. }, {
  59. default: withCtx(() => [
  60. (openBlock(), createBlock(resolveDynamicComponent(_ctx.icon)))
  61. ]),
  62. _: 1
  63. }, 8, ["class"])) : createCommentVNode("v-if", true)
  64. ],
  65. 6
  66. )) : createCommentVNode("v-if", true),
  67. _ctx.$slots.dot ? (openBlock(), createElementBlock(
  68. "div",
  69. {
  70. key: 1,
  71. class: normalizeClass(unref(ns).e("dot"))
  72. },
  73. [
  74. renderSlot(_ctx.$slots, "dot")
  75. ],
  76. 2
  77. )) : createCommentVNode("v-if", true),
  78. createElementVNode(
  79. "div",
  80. {
  81. class: normalizeClass(unref(ns).e("wrapper"))
  82. },
  83. [
  84. !_ctx.hideTimestamp && _ctx.placement === "top" ? (openBlock(), createElementBlock(
  85. "div",
  86. {
  87. key: 0,
  88. class: normalizeClass([unref(ns).e("timestamp"), unref(ns).is("top")])
  89. },
  90. toDisplayString(_ctx.timestamp),
  91. 3
  92. )) : createCommentVNode("v-if", true),
  93. createElementVNode(
  94. "div",
  95. {
  96. class: normalizeClass(unref(ns).e("content"))
  97. },
  98. [
  99. renderSlot(_ctx.$slots, "default")
  100. ],
  101. 2
  102. ),
  103. !_ctx.hideTimestamp && _ctx.placement === "bottom" ? (openBlock(), createElementBlock(
  104. "div",
  105. {
  106. key: 1,
  107. class: normalizeClass([unref(ns).e("timestamp"), unref(ns).is("bottom")])
  108. },
  109. toDisplayString(_ctx.timestamp),
  110. 3
  111. )) : createCommentVNode("v-if", true)
  112. ],
  113. 2
  114. )
  115. ],
  116. 2
  117. );
  118. };
  119. }
  120. });
  121. var TimelineItem = /* @__PURE__ */ _export_sfc(_sfc_main, [["__file", "/home/runner/work/element-plus/element-plus/packages/components/timeline/src/timeline-item.vue"]]);
  122. export { TimelineItem as default };
  123. //# sourceMappingURL=timeline-item.mjs.map