UNPKG

element-plus

Version:

A Component Library for Vue 3

1 lines 2.1 kB
{"version":3,"file":"timeline-item2.mjs","names":[],"sources":["../../../../../../packages/components/timeline/src/timeline-item.vue"],"sourcesContent":["<template>\n <li :class=\"timelineItemKls\">\n <div :class=\"ns.e('tail')\" />\n <div\n v-if=\"!$slots.dot\"\n :class=\"defaultNodeKls\"\n :style=\"{\n backgroundColor: color,\n }\"\n >\n <el-icon v-if=\"icon\" :class=\"ns.e('icon')\">\n <component :is=\"icon\" />\n </el-icon>\n </div>\n <div v-if=\"$slots.dot\" :class=\"ns.e('dot')\">\n <slot name=\"dot\" />\n </div>\n\n <div :class=\"ns.e('wrapper')\">\n <div\n v-if=\"!hideTimestamp && placement === 'top'\"\n :class=\"[ns.e('timestamp'), ns.is('top')]\"\n >\n {{ timestamp }}\n </div>\n\n <div :class=\"ns.e('content')\">\n <slot />\n </div>\n\n <div\n v-if=\"!hideTimestamp && placement === 'bottom'\"\n :class=\"[ns.e('timestamp'), ns.is('bottom')]\"\n >\n {{ timestamp }}\n </div>\n </div>\n </li>\n</template>\n\n<script lang=\"ts\" setup>\nimport { computed, inject } from 'vue'\nimport { ElIcon } from '@element-plus/components/icon'\nimport { useNamespace } from '@element-plus/hooks'\nimport { TIMELINE_INJECTION_KEY } from './tokens'\n\nimport type { TimelineProvider } from './tokens'\nimport type { TimelineItemProps } from './timeline-item'\n\ndefineOptions({\n name: 'ElTimelineItem',\n})\n\nconst props = withDefaults(defineProps<TimelineItemProps>(), {\n timestamp: '',\n placement: 'bottom',\n type: '',\n color: '',\n size: 'normal',\n})\nconst { props: timelineProps } = inject<TimelineProvider>(\n TIMELINE_INJECTION_KEY\n)!\n\nconst ns = useNamespace('timeline-item')\nconst defaultNodeKls = computed(() => [\n ns.e('node'),\n ns.em('node', props.size || ''),\n ns.em('node', props.type || ''),\n ns.is('hollow', props.hollow),\n])\n\nconst timelineItemKls = computed(() => [\n ns.b(),\n { [ns.e('center')]: props.center },\n ns.is(timelineProps.mode),\n])\n</script>\n"],"mappings":""}