1 | import * as i0 from '@angular/core';
|
---|
2 | import { EventEmitter, Component, ChangeDetectionStrategy, ViewEncapsulation, Input, Output, NgModule } from '@angular/core';
|
---|
3 | import * as i2 from '@angular/common';
|
---|
4 | import { CommonModule } from '@angular/common';
|
---|
5 | import * as i1 from '@angular/router';
|
---|
6 | import { RouterModule } from '@angular/router';
|
---|
7 | import * as i3 from 'primeng/tooltip';
|
---|
8 | import { TooltipModule } from 'primeng/tooltip';
|
---|
9 |
|
---|
10 | class Steps {
|
---|
11 | constructor(router, route, cd) {
|
---|
12 | this.router = router;
|
---|
13 | this.route = route;
|
---|
14 | this.cd = cd;
|
---|
15 | this.activeIndex = 0;
|
---|
16 | this.readonly = true;
|
---|
17 | this.activeIndexChange = new EventEmitter();
|
---|
18 | }
|
---|
19 | ngOnInit() {
|
---|
20 | this.subscription = this.router.events.subscribe(() => this.cd.markForCheck());
|
---|
21 | }
|
---|
22 | itemClick(event, item, i) {
|
---|
23 | if (this.readonly || item.disabled) {
|
---|
24 | event.preventDefault();
|
---|
25 | return;
|
---|
26 | }
|
---|
27 | this.activeIndexChange.emit(i);
|
---|
28 | if (!item.url) {
|
---|
29 | event.preventDefault();
|
---|
30 | }
|
---|
31 | if (item.command) {
|
---|
32 | item.command({
|
---|
33 | originalEvent: event,
|
---|
34 | item: item,
|
---|
35 | index: i
|
---|
36 | });
|
---|
37 | }
|
---|
38 | }
|
---|
39 | isClickableRouterLink(item) {
|
---|
40 | return item.routerLink && !this.readonly && !item.disabled;
|
---|
41 | }
|
---|
42 | isActive(item, index) {
|
---|
43 | if (item.routerLink)
|
---|
44 | return this.router.isActive(item.routerLink, false) || this.router.isActive(this.router.createUrlTree([item.routerLink], { relativeTo: this.route }).toString(), false);
|
---|
45 | else
|
---|
46 | return index === this.activeIndex;
|
---|
47 | }
|
---|
48 | ngOnDestroy() {
|
---|
49 | if (this.subscription) {
|
---|
50 | this.subscription.unsubscribe();
|
---|
51 | }
|
---|
52 | }
|
---|
53 | }
|
---|
54 | Steps.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: Steps, deps: [{ token: i1.Router }, { token: i1.ActivatedRoute }, { token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Component });
|
---|
55 | Steps.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.0.0", type: Steps, selector: "p-steps", inputs: { activeIndex: "activeIndex", model: "model", readonly: "readonly", style: "style", styleClass: "styleClass" }, outputs: { activeIndexChange: "activeIndexChange" }, host: { classAttribute: "p-element" }, ngImport: i0, template: `
|
---|
56 | <div [ngClass]="{'p-steps p-component':true,'p-readonly':readonly}" [ngStyle]="style" [class]="styleClass">
|
---|
57 | <ul role="tablist">
|
---|
58 | <li *ngFor="let item of model; let i = index" class="p-steps-item" #menuitem [ngStyle]="item.style" [class]="item.styleClass" role="tab" [attr.aria-selected]="i === activeIndex" [attr.aria-expanded]="i === activeIndex" pTooltip [tooltipOptions]="item.tooltipOptions"
|
---|
59 | [ngClass]="{'p-highlight p-steps-current': isActive(item, i), 'p-disabled': item.disabled || (readonly && !isActive(item, i))}">
|
---|
60 | <a *ngIf="isClickableRouterLink(item); else elseBlock" [routerLink]="item.routerLink" [queryParams]="item.queryParams" role="presentation" [routerLinkActive]="'p-menuitem-link-active'" [routerLinkActiveOptions]="item.routerLinkActiveOptions||{exact:false}" class="p-menuitem-link"
|
---|
61 | (click)="itemClick($event, item, i)" (keydown.enter)="itemClick($event, item, i)" [attr.target]="item.target" [attr.id]="item.id" [attr.tabindex]="item.disabled || readonly ? null : (item.tabindex ? item.tabindex : '0')"
|
---|
62 | [fragment]="item.fragment" [queryParamsHandling]="item.queryParamsHandling" [preserveFragment]="item.preserveFragment" [skipLocationChange]="item.skipLocationChange" [replaceUrl]="item.replaceUrl" [state]="item.state">
|
---|
63 | <span class="p-steps-number">{{i + 1}}</span>
|
---|
64 | <span class="p-steps-title" *ngIf="item.escape !== false; else htmlLabel">{{item.label}}</span>
|
---|
65 | <ng-template #htmlLabel><span class="p-steps-title" [innerHTML]="item.label"></span></ng-template>
|
---|
66 | </a>
|
---|
67 | <ng-template #elseBlock>
|
---|
68 | <a [attr.href]="item.url" class="p-menuitem-link" role="presentation" (click)="itemClick($event, item, i)" (keydown.enter)="itemClick($event, item, i)" [attr.target]="item.target" [attr.id]="item.id"
|
---|
69 | [attr.tabindex]="item.disabled||(i !== activeIndex && readonly) ? null : (item.tabindex ? item.tabindex : '0')">
|
---|
70 | <span class="p-steps-number">{{i + 1}}</span>
|
---|
71 | <span class="p-steps-title" *ngIf="item.escape !== false; else htmlRouteLabel">{{item.label}}</span>
|
---|
72 | <ng-template #htmlRouteLabel><span class="p-steps-title" [innerHTML]="item.label"></span></ng-template>
|
---|
73 | </a>
|
---|
74 | </ng-template>
|
---|
75 | </li>
|
---|
76 | </ul>
|
---|
77 | </div>
|
---|
78 | `, isInline: true, styles: [".p-steps{position:relative}.p-steps ul{padding:0;margin:0;list-style-type:none;display:flex}.p-steps-item{position:relative;display:flex;justify-content:center;flex:1 1 auto}.p-steps-item .p-menuitem-link{display:inline-flex;flex-direction:column;align-items:center;overflow:hidden;text-decoration:none}.p-steps.p-steps-readonly .p-steps-item{cursor:auto}.p-steps-item.p-steps-current .p-menuitem-link{cursor:default}.p-steps-title{white-space:nowrap}.p-steps-number{display:flex;align-items:center;justify-content:center}.p-steps-title{display:block}\n"], directives: [{ type: i2.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { type: i2.NgStyle, selector: "[ngStyle]", inputs: ["ngStyle"] }, { type: i2.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { type: i3.Tooltip, selector: "[pTooltip]", inputs: ["tooltipPosition", "tooltipEvent", "appendTo", "positionStyle", "tooltipStyleClass", "tooltipZIndex", "escape", "showDelay", "hideDelay", "life", "positionTop", "positionLeft", "pTooltip", "tooltipDisabled", "tooltipOptions"] }, { type: i2.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i1.RouterLinkWithHref, selector: "a[routerLink],area[routerLink]", inputs: ["target", "queryParams", "fragment", "queryParamsHandling", "preserveFragment", "skipLocationChange", "replaceUrl", "state", "relativeTo", "routerLink"] }, { type: i1.RouterLinkActive, selector: "[routerLinkActive]", inputs: ["routerLinkActiveOptions", "routerLinkActive"], outputs: ["isActiveChange"], exportAs: ["routerLinkActive"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
|
---|
79 | i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: Steps, decorators: [{
|
---|
80 | type: Component,
|
---|
81 | args: [{ selector: 'p-steps', template: `
|
---|
82 | <div [ngClass]="{'p-steps p-component':true,'p-readonly':readonly}" [ngStyle]="style" [class]="styleClass">
|
---|
83 | <ul role="tablist">
|
---|
84 | <li *ngFor="let item of model; let i = index" class="p-steps-item" #menuitem [ngStyle]="item.style" [class]="item.styleClass" role="tab" [attr.aria-selected]="i === activeIndex" [attr.aria-expanded]="i === activeIndex" pTooltip [tooltipOptions]="item.tooltipOptions"
|
---|
85 | [ngClass]="{'p-highlight p-steps-current': isActive(item, i), 'p-disabled': item.disabled || (readonly && !isActive(item, i))}">
|
---|
86 | <a *ngIf="isClickableRouterLink(item); else elseBlock" [routerLink]="item.routerLink" [queryParams]="item.queryParams" role="presentation" [routerLinkActive]="'p-menuitem-link-active'" [routerLinkActiveOptions]="item.routerLinkActiveOptions||{exact:false}" class="p-menuitem-link"
|
---|
87 | (click)="itemClick($event, item, i)" (keydown.enter)="itemClick($event, item, i)" [attr.target]="item.target" [attr.id]="item.id" [attr.tabindex]="item.disabled || readonly ? null : (item.tabindex ? item.tabindex : '0')"
|
---|
88 | [fragment]="item.fragment" [queryParamsHandling]="item.queryParamsHandling" [preserveFragment]="item.preserveFragment" [skipLocationChange]="item.skipLocationChange" [replaceUrl]="item.replaceUrl" [state]="item.state">
|
---|
89 | <span class="p-steps-number">{{i + 1}}</span>
|
---|
90 | <span class="p-steps-title" *ngIf="item.escape !== false; else htmlLabel">{{item.label}}</span>
|
---|
91 | <ng-template #htmlLabel><span class="p-steps-title" [innerHTML]="item.label"></span></ng-template>
|
---|
92 | </a>
|
---|
93 | <ng-template #elseBlock>
|
---|
94 | <a [attr.href]="item.url" class="p-menuitem-link" role="presentation" (click)="itemClick($event, item, i)" (keydown.enter)="itemClick($event, item, i)" [attr.target]="item.target" [attr.id]="item.id"
|
---|
95 | [attr.tabindex]="item.disabled||(i !== activeIndex && readonly) ? null : (item.tabindex ? item.tabindex : '0')">
|
---|
96 | <span class="p-steps-number">{{i + 1}}</span>
|
---|
97 | <span class="p-steps-title" *ngIf="item.escape !== false; else htmlRouteLabel">{{item.label}}</span>
|
---|
98 | <ng-template #htmlRouteLabel><span class="p-steps-title" [innerHTML]="item.label"></span></ng-template>
|
---|
99 | </a>
|
---|
100 | </ng-template>
|
---|
101 | </li>
|
---|
102 | </ul>
|
---|
103 | </div>
|
---|
104 | `, changeDetection: ChangeDetectionStrategy.OnPush, encapsulation: ViewEncapsulation.None, host: {
|
---|
105 | 'class': 'p-element'
|
---|
106 | }, styles: [".p-steps{position:relative}.p-steps ul{padding:0;margin:0;list-style-type:none;display:flex}.p-steps-item{position:relative;display:flex;justify-content:center;flex:1 1 auto}.p-steps-item .p-menuitem-link{display:inline-flex;flex-direction:column;align-items:center;overflow:hidden;text-decoration:none}.p-steps.p-steps-readonly .p-steps-item{cursor:auto}.p-steps-item.p-steps-current .p-menuitem-link{cursor:default}.p-steps-title{white-space:nowrap}.p-steps-number{display:flex;align-items:center;justify-content:center}.p-steps-title{display:block}\n"] }]
|
---|
107 | }], ctorParameters: function () { return [{ type: i1.Router }, { type: i1.ActivatedRoute }, { type: i0.ChangeDetectorRef }]; }, propDecorators: { activeIndex: [{
|
---|
108 | type: Input
|
---|
109 | }], model: [{
|
---|
110 | type: Input
|
---|
111 | }], readonly: [{
|
---|
112 | type: Input
|
---|
113 | }], style: [{
|
---|
114 | type: Input
|
---|
115 | }], styleClass: [{
|
---|
116 | type: Input
|
---|
117 | }], activeIndexChange: [{
|
---|
118 | type: Output
|
---|
119 | }] } });
|
---|
120 | class StepsModule {
|
---|
121 | }
|
---|
122 | StepsModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: StepsModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
---|
123 | StepsModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: StepsModule, declarations: [Steps], imports: [CommonModule, RouterModule, TooltipModule], exports: [Steps, RouterModule, TooltipModule] });
|
---|
124 | StepsModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: StepsModule, imports: [[CommonModule, RouterModule, TooltipModule], RouterModule, TooltipModule] });
|
---|
125 | i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: StepsModule, decorators: [{
|
---|
126 | type: NgModule,
|
---|
127 | args: [{
|
---|
128 | imports: [CommonModule, RouterModule, TooltipModule],
|
---|
129 | exports: [Steps, RouterModule, TooltipModule],
|
---|
130 | declarations: [Steps]
|
---|
131 | }]
|
---|
132 | }] });
|
---|
133 |
|
---|
134 | /**
|
---|
135 | * Generated bundle index. Do not edit.
|
---|
136 | */
|
---|
137 |
|
---|
138 | export { Steps, StepsModule };
|
---|