primeng
Version:
PrimeNG is a premium UI library for Angular featuring a rich set of 90+ components, a theme designer, various theme alternatives such as Material, Bootstrap, Tailwind, premium templates and professional support. In addition, it integrates with PrimeBlock,
1 lines • 11.7 kB
Source Map (JSON)
{"version":3,"file":"primeng-timeline.mjs","sources":["../../src/timeline/style/timelinestyle.ts","../../src/timeline/timeline.ts","../../src/timeline/primeng-timeline.ts"],"sourcesContent":["import { Injectable } from '@angular/core';\nimport { style } from '@primeuix/styles/timeline';\nimport { BaseStyle } from 'primeng/base';\n\nconst classes = {\n root: ({ instance }) => ['p-timeline p-component', 'p-timeline-' + instance.align(), 'p-timeline-' + instance.layout()],\n event: 'p-timeline-event',\n eventOpposite: 'p-timeline-event-opposite',\n eventSeparator: 'p-timeline-event-separator',\n eventMarker: 'p-timeline-event-marker',\n eventConnector: 'p-timeline-event-connector',\n eventContent: 'p-timeline-event-content'\n};\n\n@Injectable()\nexport class TimelineStyle extends BaseStyle {\n name = 'timeline';\n\n style = style;\n\n classes = classes;\n}\n\n/**\n *\n * Timeline visualizes a series of chained events.\n *\n * [Live Demo](https://primeng.dev/timeline)\n *\n * @module timelinestyle\n *\n */\nexport enum TimelineClasses {\n /**\n * Class name of the root element\n */\n root = 'p-timeline',\n /**\n * Class name of the event element\n */\n event = 'p-timeline-event',\n /**\n * Class name of the event opposite element\n */\n eventOpposite = 'p-timeline-event-opposite',\n /**\n * Class name of the event separator element\n */\n eventSeparator = 'p-timeline-event-separator',\n /**\n * Class name of the event marker element\n */\n eventMarker = 'p-timeline-event-marker',\n /**\n * Class name of the event connector element\n */\n eventConnector = 'p-timeline-event-connector',\n /**\n * Class name of the event content element\n */\n eventContent = 'p-timeline-event-content'\n}\n\nexport interface TimelineStyle extends BaseStyle {}\n","import { NgTemplateOutlet } from '@angular/common';\nimport { ChangeDetectionStrategy, Component, computed, contentChild, inject, InjectionToken, input, NgModule, TemplateRef, ViewEncapsulation } from '@angular/core';\nimport { BlockableUI } from 'primeng/api';\nimport { BaseComponent, PARENT_INSTANCE } from 'primeng/basecomponent';\nimport { Bind } from 'primeng/bind';\nimport { TimelineAlign, TimelineItemTemplateContext, TimelineLayout, TimelinePassThrough } from 'primeng/types/timeline';\nimport { TimelineStyle } from './style/timelinestyle';\n\nconst TIMELINE_INSTANCE = new InjectionToken<Timeline>('TIMELINE_INSTANCE');\n\n/**\n * Timeline visualizes a series of chained events.\n * @group Components\n */\n@Component({\n selector: 'p-timeline',\n standalone: true,\n imports: [NgTemplateOutlet, Bind],\n template: `\n @for (event of value(); track $index; let last = $last) {\n <div [pBind]=\"ptm('event')\" [class]=\"cx('event')\" [attr.data-p]=\"dataP()\">\n <div [pBind]=\"ptm('eventOpposite')\" [class]=\"cx('eventOpposite')\" [attr.data-p]=\"dataP()\">\n <ng-container *ngTemplateOutlet=\"oppositeTemplate(); context: { $implicit: event }\"></ng-container>\n </div>\n <div [pBind]=\"ptm('eventSeparator')\" [class]=\"cx('eventSeparator')\" [attr.data-p]=\"dataP()\">\n @if (markerTemplate()) {\n <ng-container *ngTemplateOutlet=\"markerTemplate()!; context: { $implicit: event }\"></ng-container>\n } @else {\n <div [pBind]=\"ptm('eventMarker')\" [class]=\"cx('eventMarker')\" [attr.data-p]=\"dataP()\"></div>\n }\n @if (!last) {\n <div [pBind]=\"ptm('eventConnector')\" [class]=\"cx('eventConnector')\" [attr.data-p]=\"dataP()\"></div>\n }\n </div>\n <div [pBind]=\"ptm('eventContent')\" [class]=\"cx('eventContent')\" [attr.data-p]=\"dataP()\">\n <ng-container *ngTemplateOutlet=\"contentTemplate(); context: { $implicit: event }\"></ng-container>\n </div>\n </div>\n }\n `,\n changeDetection: ChangeDetectionStrategy.OnPush,\n encapsulation: ViewEncapsulation.None,\n providers: [TimelineStyle, { provide: TIMELINE_INSTANCE, useExisting: Timeline }, { provide: PARENT_INSTANCE, useExisting: Timeline }],\n host: {\n '[class]': \"cx('root')\",\n '[attr.data-p]': 'dataP()'\n },\n hostDirectives: [Bind]\n})\nexport class Timeline extends BaseComponent<TimelinePassThrough> implements BlockableUI {\n componentName = 'Timeline';\n\n bindDirectiveInstance = inject(Bind, { self: true });\n\n $pcTimeline: Timeline | undefined = inject(TIMELINE_INSTANCE, { optional: true, skipSelf: true }) ?? undefined;\n\n onAfterViewChecked() {\n this.bindDirectiveInstance.setAttrs(this.ptms(['host', 'root']));\n }\n /**\n * An array of events to display.\n * @group Props\n */\n value = input<any[]>();\n /**\n * Position of the timeline bar relative to the content. Valid values are \"left\", \"right\" for vertical layout and \"top\", \"bottom\" for horizontal layout.\n * @group Props\n */\n align = input<TimelineAlign>('left');\n /**\n * Orientation of the timeline.\n * @group Props\n */\n layout = input<TimelineLayout>('vertical');\n /**\n * Custom content template.\n * @param {TimelineItemTemplateContext} context - item context.\n * @see {@link TimelineItemTemplateContext}\n * @group Templates\n */\n contentTemplate = contentChild<TemplateRef<TimelineItemTemplateContext>>('content', { descendants: false });\n\n /**\n * Custom opposite item template.\n * @param {TimelineItemTemplateContext} context - item context.\n * @see {@link TimelineItemTemplateContext}\n * @group Templates\n */\n oppositeTemplate = contentChild<TemplateRef<TimelineItemTemplateContext>>('opposite', { descendants: false });\n\n /**\n * Custom marker template.\n * @param {TimelineItemTemplateContext} context - item context.\n * @see {@link TimelineItemTemplateContext}\n * @group Templates\n */\n markerTemplate = contentChild<TemplateRef<TimelineItemTemplateContext>>('marker', { descendants: false });\n\n _componentStyle = inject(TimelineStyle);\n\n dataP = computed(() =>\n this.cn({\n [this.layout()]: this.layout(),\n [this.align()]: this.align()\n })\n );\n\n getBlockableElement(): HTMLElement {\n return this.el.nativeElement.children[0];\n }\n}\n\n@NgModule({\n imports: [Timeline],\n exports: [Timeline]\n})\nexport class TimelineModule {}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public_api';\n"],"names":[],"mappings":";;;;;;;;;;AAIA,MAAM,OAAO,GAAG;IACZ,IAAI,EAAE,CAAC,EAAE,QAAQ,EAAE,KAAK,CAAC,wBAAwB,EAAE,aAAa,GAAG,Q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