2022-09-06 12:03:37 +00:00
|
|
|
<template>
|
2024-02-11 23:48:46 +00:00
|
|
|
<div :class="cx('root')" v-bind="ptmi('root')">
|
2023-07-11 11:11:03 +00:00
|
|
|
<div v-for="(item, index) of value" :key="getKey(item, index)" :class="cx('event')" v-bind="getPTOptions('event', index)">
|
2024-05-02 06:27:51 +00:00
|
|
|
<div :class="cx('eventOpposite', { index })" v-bind="getPTOptions('eventOpposite', index)">
|
2022-09-06 12:03:37 +00:00
|
|
|
<slot name="opposite" :item="item" :index="index"></slot>
|
|
|
|
</div>
|
2024-05-02 06:27:51 +00:00
|
|
|
<div :class="cx('eventSeparator')" v-bind="getPTOptions('eventSeparator', index)">
|
2022-09-06 12:03:37 +00:00
|
|
|
<slot name="marker" :item="item" :index="index">
|
2024-05-02 06:27:51 +00:00
|
|
|
<div :class="cx('eventMarker')" v-bind="getPTOptions('eventMarker', index)"></div>
|
2022-09-06 12:03:37 +00:00
|
|
|
</slot>
|
2022-09-14 11:26:01 +00:00
|
|
|
<slot v-if="index !== value.length - 1" name="connector" :item="item" :index="index">
|
2024-05-02 06:27:51 +00:00
|
|
|
<div :class="cx('eventConnector')" v-bind="getPTOptions('eventConnector', index)"></div>
|
2022-09-06 12:03:37 +00:00
|
|
|
</slot>
|
|
|
|
</div>
|
2024-05-02 06:27:51 +00:00
|
|
|
<div :class="cx('eventContent')" v-bind="getPTOptions('eventContent', index)">
|
2022-09-06 12:03:37 +00:00
|
|
|
<slot name="content" :item="item" :index="index"></slot>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script>
|
2022-09-14 11:26:01 +00:00
|
|
|
import { ObjectUtils } from 'primevue/utils';
|
2023-06-13 13:24:14 +00:00
|
|
|
import BaseTimeline from './BaseTimeline.vue';
|
2022-09-06 12:03:37 +00:00
|
|
|
|
|
|
|
export default {
|
|
|
|
name: 'Timeline',
|
2023-06-13 13:24:14 +00:00
|
|
|
extends: BaseTimeline,
|
2024-02-11 23:48:46 +00:00
|
|
|
inheritAttrs: false,
|
2022-09-06 12:03:37 +00:00
|
|
|
methods: {
|
|
|
|
getKey(item, index) {
|
|
|
|
return this.dataKey ? ObjectUtils.resolveFieldData(item, this.dataKey) : index;
|
2023-07-11 11:11:03 +00:00
|
|
|
},
|
|
|
|
getPTOptions(key, index) {
|
|
|
|
return this.ptm(key, {
|
|
|
|
context: {
|
|
|
|
index,
|
|
|
|
count: this.value.length
|
|
|
|
}
|
|
|
|
});
|
2022-09-06 12:03:37 +00:00
|
|
|
}
|
|
|
|
}
|
2022-09-14 11:26:01 +00:00
|
|
|
};
|
2022-09-06 12:03:37 +00:00
|
|
|
</script>
|