UNPKG

5.76 kBJavaScriptView Raw
1(function (global, factory) {
2 typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@angular/core'), require('@angular/common'), require('@angular/router')) :
3 typeof define === 'function' && define.amd ? define('primeng/steps', ['exports', '@angular/core', '@angular/common', '@angular/router'], factory) :
4 (global = global || self, factory((global.primeng = global.primeng || {}, global.primeng.steps = {}), global.ng.core, global.ng.common, global.ng.router));
5}(this, (function (exports, core, common, router) { 'use strict';
6
7 var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
8 var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
9 if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
10 else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
11 return c > 3 && r && Object.defineProperty(target, key, r), r;
12 };
13 var Steps = /** @class */ (function () {
14 function Steps() {
15 this.activeIndex = 0;
16 this.readonly = true;
17 this.activeIndexChange = new core.EventEmitter();
18 }
19 Steps.prototype.itemClick = function (event, item, i) {
20 if (this.readonly || item.disabled) {
21 event.preventDefault();
22 return;
23 }
24 this.activeIndexChange.emit(i);
25 if (!item.url) {
26 event.preventDefault();
27 }
28 if (item.command) {
29 item.command({
30 originalEvent: event,
31 item: item,
32 index: i
33 });
34 }
35 };
36 __decorate([
37 core.Input()
38 ], Steps.prototype, "activeIndex", void 0);
39 __decorate([
40 core.Input()
41 ], Steps.prototype, "model", void 0);
42 __decorate([
43 core.Input()
44 ], Steps.prototype, "readonly", void 0);
45 __decorate([
46 core.Input()
47 ], Steps.prototype, "style", void 0);
48 __decorate([
49 core.Input()
50 ], Steps.prototype, "styleClass", void 0);
51 __decorate([
52 core.Output()
53 ], Steps.prototype, "activeIndexChange", void 0);
54 Steps = __decorate([
55 core.Component({
56 selector: 'p-steps',
57 template: "\n <div [ngClass]=\"{'ui-steps ui-widget ui-helper-clearfix':true,'ui-steps-readonly':readonly}\" [ngStyle]=\"style\" [class]=\"styleClass\">\n <ul role=\"tablist\">\n <li *ngFor=\"let item of model; let i = index\" class=\"ui-steps-item\" #menuitem [ngStyle]=\"item.style\" [class]=\"item.styleClass\" role=\"tab\" [attr.aria-selected]=\"i === activeIndex\" [attr.aria-expanded]=\"i === activeIndex\"\n [ngClass]=\"{'ui-state-highlight ui-steps-current':(i === activeIndex),\n 'ui-state-default':(i !== activeIndex),\n 'ui-state-complete':(i < activeIndex),\n 'ui-state-disabled ui-steps-incomplete':item.disabled||(i !== activeIndex && readonly)}\">\n <a *ngIf=\"!item.routerLink\" [attr.href]=\"item.url\" class=\"ui-menuitem-link\" role=\"presentation\" (click)=\"itemClick($event, item, i)\" (keydown.enter)=\"itemClick($event, item, i)\" [attr.target]=\"item.target\" [attr.id]=\"item.id\" \n [attr.tabindex]=\"item.disabled||(i !== activeIndex && readonly) ? null : (item.tabindex ? item.tabindex : '0')\">\n <span class=\"ui-steps-number\">{{i + 1}}</span>\n <span class=\"ui-steps-title\">{{item.label}}</span>\n </a>\n <a *ngIf=\"item.routerLink\" [routerLink]=\"item.routerLink\" [queryParams]=\"item.queryParams\" role=\"presentation\" [routerLinkActive]=\"'ui-menuitem-link-active'\" [routerLinkActiveOptions]=\"item.routerLinkActiveOptions||{exact:false}\" class=\"ui-menuitem-link\" \n (click)=\"itemClick($event, item, i)\" (keydown.enter)=\"itemClick($event, item, i)\" [attr.target]=\"item.target\" [attr.id]=\"item.id\" [attr.tabindex]=\"item.disabled||(i !== activeIndex && readonly) ? null : (item.tabindex ? item.tabindex : '0')\"\n [fragment]=\"item.fragment\" [queryParamsHandling]=\"item.queryParamsHandling\" [preserveFragment]=\"item.preserveFragment\" [skipLocationChange]=\"item.skipLocationChange\" [replaceUrl]=\"item.replaceUrl\" [state]=\"item.state\">\n <span class=\"ui-steps-number\">{{i + 1}}</span>\n <span class=\"ui-steps-title\">{{item.label}}</span>\n </a>\n </li>\n </ul>\n </div>\n ",
58 changeDetection: core.ChangeDetectionStrategy.Default
59 })
60 ], Steps);
61 return Steps;
62 }());
63 var StepsModule = /** @class */ (function () {
64 function StepsModule() {
65 }
66 StepsModule = __decorate([
67 core.NgModule({
68 imports: [common.CommonModule, router.RouterModule],
69 exports: [Steps, router.RouterModule],
70 declarations: [Steps]
71 })
72 ], StepsModule);
73 return StepsModule;
74 }());
75
76 exports.Steps = Steps;
77 exports.StepsModule = StepsModule;
78
79 Object.defineProperty(exports, '__esModule', { value: true });
80
81})));
82//# sourceMappingURL=primeng-steps.umd.js.map