{"version":3,"file":"ng-zorro-antd-timeline.mjs","names":[],"sources":["../../components/timeline/timeline.service.ts","../../components/timeline/typings.ts","../../components/timeline/timeline-item.component.ts","../../components/timeline/timeline.component.ts","../../components/timeline/timeline.module.ts"],"sourcesContent":["/**\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://github.com/NG-ZORRO/ng-zorro-antd/blob/master/LICENSE\n */\n\nimport { Injectable } from '@angular/core';\nimport { ReplaySubject } from 'rxjs';\n\n@Injectable()\nexport class TimelineService {\n  check$ = new ReplaySubject<void>(1);\n\n  markForCheck(): void {\n    this.check$.next();\n  }\n}\n","/**\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://github.com/NG-ZORRO/ng-zorro-antd/blob/master/LICENSE\n */\n\nexport type NzTimelineMode = 'left' | 'alternate' | 'right' | 'custom';\n\nexport type NzTimelinePosition = 'left' | 'right';\n\nexport const TimelineTimeDefaultColors = ['red', 'blue', 'green', 'grey', 'gray'] as const;\nexport type NzTimelineItemColor = (typeof TimelineTimeDefaultColors)[number] | string;\n","/**\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://github.com/NG-ZORRO/ng-zorro-antd/blob/master/LICENSE\n */\n\nimport {\n  ChangeDetectorRef,\n  Component,\n  inject,\n  Input,\n  OnChanges,\n  SimpleChanges,\n  TemplateRef,\n  ViewChild,\n  ViewEncapsulation\n} from '@angular/core';\n\nimport { NzOutletModule } from 'ng-zorro-antd/core/outlet';\n\nimport { TimelineService } from './timeline.service';\nimport { NzTimelineItemColor, NzTimelinePosition, TimelineTimeDefaultColors } from './typings';\n\nfunction isDefaultColor(color?: string): boolean {\n  return TimelineTimeDefaultColors.findIndex(i => i === color) !== -1;\n}\n\n@Component({\n  selector: 'nz-timeline-item, [nz-timeline-item]',\n  exportAs: 'nzTimelineItem',\n  template: `\n    <ng-template #template>\n      <li\n        class=\"ant-timeline-item\"\n        [class.ant-timeline-item-right]=\"(nzPosition || position) === 'right'\"\n        [class.ant-timeline-item-left]=\"(nzPosition || position) === 'left'\"\n        [class.ant-timeline-item-last]=\"isLast\"\n      >\n        @if (nzLabel) {\n          <div class=\"ant-timeline-item-label\">\n            <ng-container *nzStringTemplateOutlet=\"nzLabel\">{{ nzLabel }}</ng-container>\n          </div>\n        }\n        <div class=\"ant-timeline-item-tail\"></div>\n        <div\n          class=\"ant-timeline-item-head\"\n          [class.ant-timeline-item-head-red]=\"nzColor === 'red'\"\n          [class.ant-timeline-item-head-blue]=\"nzColor === 'blue'\"\n          [class.ant-timeline-item-head-green]=\"nzColor === 'green'\"\n          [class.ant-timeline-item-head-gray]=\"nzColor === 'gray'\"\n          [class.ant-timeline-item-head-custom]=\"!!nzDot\"\n          [style.border-color]=\"borderColor\"\n        >\n          <ng-container *nzStringTemplateOutlet=\"nzDot\">{{ nzDot }}</ng-container>\n        </div>\n        <div class=\"ant-timeline-item-content\">\n          <ng-content />\n        </div>\n      </li>\n    </ng-template>\n  `,\n  imports: [NzOutletModule],\n  encapsulation: ViewEncapsulation.None\n})\nexport class NzTimelineItemComponent implements OnChanges {\n  private cdr = inject(ChangeDetectorRef);\n  private timelineService = inject(TimelineService);\n\n  @ViewChild('template', { static: false }) template!: TemplateRef<void>;\n\n  @Input() nzPosition?: NzTimelinePosition;\n  @Input() nzColor: NzTimelineItemColor = 'blue';\n  @Input() nzDot?: string | TemplateRef<void>;\n  @Input() nzLabel?: string | TemplateRef<void>;\n\n  isLast = false;\n  borderColor: string | null = null;\n  position?: NzTimelinePosition;\n\n  ngOnChanges(changes: SimpleChanges): void {\n    this.timelineService.markForCheck();\n    const { nzColor } = changes;\n    if (nzColor) {\n      this.updateCustomColor();\n    }\n  }\n\n  detectChanges(): void {\n    this.cdr.detectChanges();\n  }\n\n  private updateCustomColor(): void {\n    this.borderColor = isDefaultColor(this.nzColor) ? null : this.nzColor;\n  }\n}\n","/**\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://github.com/NG-ZORRO/ng-zorro-antd/blob/master/LICENSE\n */\n\nimport { Directionality } from '@angular/cdk/bidi';\nimport { NgTemplateOutlet } from '@angular/common';\nimport {\n  AfterContentInit,\n  ChangeDetectorRef,\n  Component,\n  ContentChildren,\n  Input,\n  OnChanges,\n  OnInit,\n  QueryList,\n  SimpleChange,\n  SimpleChanges,\n  TemplateRef,\n  ViewEncapsulation,\n  booleanAttribute,\n  inject,\n  DestroyRef\n} from '@angular/core';\nimport { takeUntilDestroyed } from '@angular/core/rxjs-interop';\n\nimport { NzOutletModule } from 'ng-zorro-antd/core/outlet';\nimport { NzIconModule } from 'ng-zorro-antd/icon';\n\nimport { NzTimelineItemComponent } from './timeline-item.component';\nimport { TimelineService } from './timeline.service';\nimport { NzTimelineMode, NzTimelinePosition } from './typings';\n\n@Component({\n  selector: 'nz-timeline',\n  exportAs: 'nzTimeline',\n  encapsulation: ViewEncapsulation.None,\n  providers: [TimelineService],\n  template: `\n    <ul\n      class=\"ant-timeline\"\n      [class.ant-timeline-label]=\"hasLabelItem\"\n      [class.ant-timeline-right]=\"!hasLabelItem && nzMode === 'right'\"\n      [class.ant-timeline-alternate]=\"nzMode === 'alternate' || nzMode === 'custom'\"\n      [class.ant-timeline-pending]=\"!!nzPending\"\n      [class.ant-timeline-reverse]=\"nzReverse\"\n      [class.ant-timeline-rtl]=\"dir() === 'rtl'\"\n    >\n      <!-- pending dot (reversed) -->\n      @if (nzReverse) {\n        <ng-container [ngTemplateOutlet]=\"pendingTemplate\" />\n      }\n      <!-- timeline items -->\n      @for (item of timelineItems; track item) {\n        <ng-template [ngTemplateOutlet]=\"item.template\" />\n      }\n      @if (!nzReverse) {\n        <ng-container [ngTemplateOutlet]=\"pendingTemplate\" />\n      }\n      <!-- pending dot -->\n    </ul>\n    <ng-template #pendingTemplate>\n      @if (nzPending) {\n        <li class=\"ant-timeline-item ant-timeline-item-pending\">\n          <div class=\"ant-timeline-item-tail\"></div>\n          <div class=\"ant-timeline-item-head ant-timeline-item-head-custom ant-timeline-item-head-blue\">\n            <ng-container *nzStringTemplateOutlet=\"nzPendingDot\">\n              {{ nzPendingDot }}\n              @if (!nzPendingDot) {\n                <nz-icon nzType=\"loading\" />\n              }\n            </ng-container>\n          </div>\n          <div class=\"ant-timeline-item-content\">\n            <ng-container *nzStringTemplateOutlet=\"nzPending\">\n              {{ isPendingBoolean ? '' : nzPending }}\n            </ng-container>\n          </div>\n        </li>\n      }\n    </ng-template>\n    <!-- Grasp items -->\n    <ng-content />\n  `,\n  imports: [NgTemplateOutlet, NzOutletModule, NzIconModule]\n})\nexport class NzTimelineComponent implements AfterContentInit, OnChanges, OnInit {\n  private cdr = inject(ChangeDetectorRef);\n  private timelineService = inject(TimelineService);\n  protected readonly dir = inject(Directionality).valueSignal;\n  private destroyRef = inject(DestroyRef);\n\n  @ContentChildren(NzTimelineItemComponent) listOfItems!: QueryList<NzTimelineItemComponent>;\n\n  @Input() nzMode: NzTimelineMode = 'left';\n  @Input() nzPending?: string | boolean | TemplateRef<void>;\n  @Input() nzPendingDot?: string | TemplateRef<void>;\n  @Input({ transform: booleanAttribute }) nzReverse: boolean = false;\n\n  isPendingBoolean: boolean = false;\n  timelineItems: NzTimelineItemComponent[] = [];\n  hasLabelItem = false;\n\n  ngOnChanges(changes: SimpleChanges): void {\n    const { nzMode, nzReverse, nzPending } = changes;\n\n    if (simpleChangeActivated(nzMode) || simpleChangeActivated(nzReverse)) {\n      this.updateChildren();\n    }\n\n    if (nzPending) {\n      this.isPendingBoolean = nzPending.currentValue === true;\n    }\n  }\n\n  ngOnInit(): void {\n    this.timelineService.check$.pipe(takeUntilDestroyed(this.destroyRef)).subscribe(() => {\n      this.cdr.markForCheck();\n    });\n  }\n\n  ngAfterContentInit(): void {\n    this.updateChildren();\n\n    this.listOfItems.changes.pipe(takeUntilDestroyed(this.destroyRef)).subscribe(() => {\n      this.updateChildren();\n    });\n  }\n\n  private updateChildren(): void {\n    if (this.listOfItems && this.listOfItems.length) {\n      const length = this.listOfItems.length;\n      let hasLabelItem = false;\n\n      this.listOfItems.forEach((item: NzTimelineItemComponent, index: number) => {\n        item.isLast = !this.nzReverse ? index === length - 1 : index === 0;\n        item.position = getInferredTimelineItemPosition(index, this.nzMode);\n\n        if (!hasLabelItem && item.nzLabel) {\n          hasLabelItem = true;\n        }\n\n        item.detectChanges();\n      });\n\n      this.timelineItems = this.nzReverse ? this.listOfItems.toArray().reverse() : this.listOfItems.toArray();\n      this.hasLabelItem = hasLabelItem;\n    } else {\n      this.timelineItems = [];\n      this.hasLabelItem = false;\n    }\n\n    this.cdr.markForCheck();\n  }\n}\n\nfunction simpleChangeActivated(simpleChange?: SimpleChange): boolean {\n  return !!(simpleChange && (simpleChange.previousValue !== simpleChange.currentValue || simpleChange.isFirstChange()));\n}\n\nfunction getInferredTimelineItemPosition(index: number, mode: NzTimelineMode): NzTimelinePosition | undefined {\n  if (mode === 'custom') {\n    return undefined;\n  } else if (mode === 'left' || mode === 'right') {\n    return mode;\n  } else {\n    return mode === 'alternate' && index % 2 === 0 ? 'left' : 'right';\n  }\n}\n","/**\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://github.com/NG-ZORRO/ng-zorro-antd/blob/master/LICENSE\n */\n\nimport { NgModule } from '@angular/core';\n\nimport { NzTimelineItemComponent } from './timeline-item.component';\nimport { NzTimelineComponent } from './timeline.component';\n\n@NgModule({\n  imports: [NzTimelineItemComponent, NzTimelineComponent],\n  exports: [NzTimelineItemComponent, NzTimelineComponent]\n})\nexport class NzTimelineModule {}\n"],"mappings":";;;;;;;;;;AASA,IAAa,kBAAb,MAAa,gBAAe;CAC1B,SAAS,IAAI,cAAoB,CAAC;CAElC,eAAY;EACV,KAAK,OAAO,KAAI;CAClB;CALW,OAAA,OAAA,GAAA,mBAAA;EAAA,YAAA;EAAA,SAAA;EAAA,UAAA;EAAA,MAAA;EAAe,MAAA,CAAA;EAAA,QAAA,GAAA,gBAAA;CAAA,CAAA;CAAf,OAAA,QAAA,GAAA,sBAAA;EAAA,YA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