[59329aa] | 1 | import * as i0 from '@angular/core';
|
---|
| 2 | import { forwardRef, Component, Inject, Input, ContentChildren, EventEmitter, ChangeDetectionStrategy, ViewEncapsulation, ViewChild, Output, NgModule } from '@angular/core';
|
---|
| 3 | import * as i1 from '@angular/common';
|
---|
| 4 | import { CommonModule } from '@angular/common';
|
---|
| 5 | import * as i3 from 'primeng/tooltip';
|
---|
| 6 | import { TooltipModule } from 'primeng/tooltip';
|
---|
| 7 | import * as i2 from 'primeng/ripple';
|
---|
| 8 | import { RippleModule } from 'primeng/ripple';
|
---|
| 9 | import { PrimeTemplate, SharedModule } from 'primeng/api';
|
---|
| 10 | import { DomHandler } from 'primeng/dom';
|
---|
| 11 |
|
---|
| 12 | let idx = 0;
|
---|
| 13 | class TabPanel {
|
---|
| 14 | constructor(tabView, viewContainer, cd) {
|
---|
| 15 | this.viewContainer = viewContainer;
|
---|
| 16 | this.cd = cd;
|
---|
| 17 | this.cache = true;
|
---|
| 18 | this.tooltipPosition = 'top';
|
---|
| 19 | this.tooltipPositionStyle = 'absolute';
|
---|
| 20 | this.id = `p-tabpanel-${idx++}`;
|
---|
| 21 | this.tabView = tabView;
|
---|
| 22 | }
|
---|
| 23 | ngAfterContentInit() {
|
---|
| 24 | this.templates.forEach((item) => {
|
---|
| 25 | switch (item.getType()) {
|
---|
| 26 | case 'header':
|
---|
| 27 | this.headerTemplate = item.template;
|
---|
| 28 | break;
|
---|
| 29 | case 'content':
|
---|
| 30 | this.contentTemplate = item.template;
|
---|
| 31 | break;
|
---|
| 32 | default:
|
---|
| 33 | this.contentTemplate = item.template;
|
---|
| 34 | break;
|
---|
| 35 | }
|
---|
| 36 | });
|
---|
| 37 | }
|
---|
| 38 | get selected() {
|
---|
| 39 | return this._selected;
|
---|
| 40 | }
|
---|
| 41 | set selected(val) {
|
---|
| 42 | this._selected = val;
|
---|
| 43 | if (!this.loaded) {
|
---|
| 44 | this.cd.detectChanges();
|
---|
| 45 | }
|
---|
| 46 | if (val)
|
---|
| 47 | this.loaded = true;
|
---|
| 48 | }
|
---|
| 49 | get disabled() {
|
---|
| 50 | return this._disabled;
|
---|
| 51 | }
|
---|
| 52 | ;
|
---|
| 53 | set disabled(disabled) {
|
---|
| 54 | this._disabled = disabled;
|
---|
| 55 | this.tabView.cd.markForCheck();
|
---|
| 56 | }
|
---|
| 57 | get header() {
|
---|
| 58 | return this._header;
|
---|
| 59 | }
|
---|
| 60 | set header(header) {
|
---|
| 61 | this._header = header;
|
---|
| 62 | this.tabView.cd.markForCheck();
|
---|
| 63 | }
|
---|
| 64 | get leftIcon() {
|
---|
| 65 | return this._leftIcon;
|
---|
| 66 | }
|
---|
| 67 | set leftIcon(leftIcon) {
|
---|
| 68 | this._leftIcon = leftIcon;
|
---|
| 69 | this.tabView.cd.markForCheck();
|
---|
| 70 | }
|
---|
| 71 | get rightIcon() {
|
---|
| 72 | return this._rightIcon;
|
---|
| 73 | }
|
---|
| 74 | set rightIcon(rightIcon) {
|
---|
| 75 | this._rightIcon = rightIcon;
|
---|
| 76 | this.tabView.cd.markForCheck();
|
---|
| 77 | }
|
---|
| 78 | ngOnDestroy() {
|
---|
| 79 | this.view = null;
|
---|
| 80 | }
|
---|
| 81 | }
|
---|
| 82 | TabPanel.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: TabPanel, deps: [{ token: forwardRef(() => TabView) }, { token: i0.ViewContainerRef }, { token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Component });
|
---|
| 83 | TabPanel.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.0.0", type: TabPanel, selector: "p-tabPanel", inputs: { closable: "closable", headerStyle: "headerStyle", headerStyleClass: "headerStyleClass", cache: "cache", tooltip: "tooltip", tooltipPosition: "tooltipPosition", tooltipPositionStyle: "tooltipPositionStyle", tooltipStyleClass: "tooltipStyleClass", selected: "selected", disabled: "disabled", header: "header", leftIcon: "leftIcon", rightIcon: "rightIcon" }, host: { classAttribute: "p-element" }, queries: [{ propertyName: "templates", predicate: PrimeTemplate }], ngImport: i0, template: `
|
---|
| 84 | <div [attr.id]="id" class="p-tabview-panel" [hidden]="!selected"
|
---|
| 85 | role="tabpanel" [attr.aria-hidden]="!selected" [attr.aria-labelledby]="id + '-label'" *ngIf="!closed">
|
---|
| 86 | <ng-content></ng-content>
|
---|
| 87 | <ng-container *ngIf="contentTemplate && (cache ? loaded : selected)">
|
---|
| 88 | <ng-container *ngTemplateOutlet="contentTemplate"></ng-container>
|
---|
| 89 | </ng-container>
|
---|
| 90 | </div>
|
---|
| 91 | `, isInline: true, directives: [{ type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i1.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet"] }] });
|
---|
| 92 | i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: TabPanel, decorators: [{
|
---|
| 93 | type: Component,
|
---|
| 94 | args: [{
|
---|
| 95 | selector: 'p-tabPanel',
|
---|
| 96 | template: `
|
---|
| 97 | <div [attr.id]="id" class="p-tabview-panel" [hidden]="!selected"
|
---|
| 98 | role="tabpanel" [attr.aria-hidden]="!selected" [attr.aria-labelledby]="id + '-label'" *ngIf="!closed">
|
---|
| 99 | <ng-content></ng-content>
|
---|
| 100 | <ng-container *ngIf="contentTemplate && (cache ? loaded : selected)">
|
---|
| 101 | <ng-container *ngTemplateOutlet="contentTemplate"></ng-container>
|
---|
| 102 | </ng-container>
|
---|
| 103 | </div>
|
---|
| 104 | `,
|
---|
| 105 | host: {
|
---|
| 106 | 'class': 'p-element'
|
---|
| 107 | }
|
---|
| 108 | }]
|
---|
| 109 | }], ctorParameters: function () { return [{ type: undefined, decorators: [{
|
---|
| 110 | type: Inject,
|
---|
| 111 | args: [forwardRef(() => TabView)]
|
---|
| 112 | }] }, { type: i0.ViewContainerRef }, { type: i0.ChangeDetectorRef }]; }, propDecorators: { closable: [{
|
---|
| 113 | type: Input
|
---|
| 114 | }], headerStyle: [{
|
---|
| 115 | type: Input
|
---|
| 116 | }], headerStyleClass: [{
|
---|
| 117 | type: Input
|
---|
| 118 | }], cache: [{
|
---|
| 119 | type: Input
|
---|
| 120 | }], tooltip: [{
|
---|
| 121 | type: Input
|
---|
| 122 | }], tooltipPosition: [{
|
---|
| 123 | type: Input
|
---|
| 124 | }], tooltipPositionStyle: [{
|
---|
| 125 | type: Input
|
---|
| 126 | }], tooltipStyleClass: [{
|
---|
| 127 | type: Input
|
---|
| 128 | }], templates: [{
|
---|
| 129 | type: ContentChildren,
|
---|
| 130 | args: [PrimeTemplate]
|
---|
| 131 | }], selected: [{
|
---|
| 132 | type: Input
|
---|
| 133 | }], disabled: [{
|
---|
| 134 | type: Input
|
---|
| 135 | }], header: [{
|
---|
| 136 | type: Input
|
---|
| 137 | }], leftIcon: [{
|
---|
| 138 | type: Input
|
---|
| 139 | }], rightIcon: [{
|
---|
| 140 | type: Input
|
---|
| 141 | }] } });
|
---|
| 142 | class TabView {
|
---|
| 143 | constructor(el, cd) {
|
---|
| 144 | this.el = el;
|
---|
| 145 | this.cd = cd;
|
---|
| 146 | this.orientation = 'top';
|
---|
| 147 | this.onChange = new EventEmitter();
|
---|
| 148 | this.onClose = new EventEmitter();
|
---|
| 149 | this.activeIndexChange = new EventEmitter();
|
---|
| 150 | this.backwardIsDisabled = true;
|
---|
| 151 | this.forwardIsDisabled = false;
|
---|
| 152 | }
|
---|
| 153 | ngAfterContentInit() {
|
---|
| 154 | this.initTabs();
|
---|
| 155 | this.tabPanels.changes.subscribe(_ => {
|
---|
| 156 | this.initTabs();
|
---|
| 157 | });
|
---|
| 158 | }
|
---|
| 159 | ngAfterViewChecked() {
|
---|
| 160 | if (this.tabChanged) {
|
---|
| 161 | this.updateInkBar();
|
---|
| 162 | this.tabChanged = false;
|
---|
| 163 | }
|
---|
| 164 | }
|
---|
| 165 | initTabs() {
|
---|
| 166 | this.tabs = this.tabPanels.toArray();
|
---|
| 167 | let selectedTab = this.findSelectedTab();
|
---|
| 168 | if (!selectedTab && this.tabs.length) {
|
---|
| 169 | if (this.activeIndex != null && this.tabs.length > this.activeIndex)
|
---|
| 170 | this.tabs[this.activeIndex].selected = true;
|
---|
| 171 | else
|
---|
| 172 | this.tabs[0].selected = true;
|
---|
| 173 | this.tabChanged = true;
|
---|
| 174 | }
|
---|
| 175 | this.cd.markForCheck();
|
---|
| 176 | }
|
---|
| 177 | open(event, tab) {
|
---|
| 178 | if (tab.disabled) {
|
---|
| 179 | if (event) {
|
---|
| 180 | event.preventDefault();
|
---|
| 181 | }
|
---|
| 182 | return;
|
---|
| 183 | }
|
---|
| 184 | if (!tab.selected) {
|
---|
| 185 | let selectedTab = this.findSelectedTab();
|
---|
| 186 | if (selectedTab) {
|
---|
| 187 | selectedTab.selected = false;
|
---|
| 188 | }
|
---|
| 189 | this.tabChanged = true;
|
---|
| 190 | tab.selected = true;
|
---|
| 191 | let selectedTabIndex = this.findTabIndex(tab);
|
---|
| 192 | this.preventActiveIndexPropagation = true;
|
---|
| 193 | this.activeIndexChange.emit(selectedTabIndex);
|
---|
| 194 | this.onChange.emit({ originalEvent: event, index: selectedTabIndex });
|
---|
| 195 | this.updateScrollBar(selectedTabIndex);
|
---|
| 196 | }
|
---|
| 197 | if (event) {
|
---|
| 198 | event.preventDefault();
|
---|
| 199 | }
|
---|
| 200 | }
|
---|
| 201 | close(event, tab) {
|
---|
| 202 | if (this.controlClose) {
|
---|
| 203 | this.onClose.emit({
|
---|
| 204 | originalEvent: event,
|
---|
| 205 | index: this.findTabIndex(tab),
|
---|
| 206 | close: () => {
|
---|
| 207 | this.closeTab(tab);
|
---|
| 208 | }
|
---|
| 209 | });
|
---|
| 210 | }
|
---|
| 211 | else {
|
---|
| 212 | this.closeTab(tab);
|
---|
| 213 | this.onClose.emit({
|
---|
| 214 | originalEvent: event,
|
---|
| 215 | index: this.findTabIndex(tab)
|
---|
| 216 | });
|
---|
| 217 | }
|
---|
| 218 | event.stopPropagation();
|
---|
| 219 | }
|
---|
| 220 | closeTab(tab) {
|
---|
| 221 | if (tab.disabled) {
|
---|
| 222 | return;
|
---|
| 223 | }
|
---|
| 224 | if (tab.selected) {
|
---|
| 225 | this.tabChanged = true;
|
---|
| 226 | tab.selected = false;
|
---|
| 227 | for (let i = 0; i < this.tabs.length; i++) {
|
---|
| 228 | let tabPanel = this.tabs[i];
|
---|
| 229 | if (!tabPanel.closed && !tab.disabled) {
|
---|
| 230 | tabPanel.selected = true;
|
---|
| 231 | break;
|
---|
| 232 | }
|
---|
| 233 | }
|
---|
| 234 | }
|
---|
| 235 | tab.closed = true;
|
---|
| 236 | }
|
---|
| 237 | findSelectedTab() {
|
---|
| 238 | for (let i = 0; i < this.tabs.length; i++) {
|
---|
| 239 | if (this.tabs[i].selected) {
|
---|
| 240 | return this.tabs[i];
|
---|
| 241 | }
|
---|
| 242 | }
|
---|
| 243 | return null;
|
---|
| 244 | }
|
---|
| 245 | findTabIndex(tab) {
|
---|
| 246 | let index = -1;
|
---|
| 247 | for (let i = 0; i < this.tabs.length; i++) {
|
---|
| 248 | if (this.tabs[i] == tab) {
|
---|
| 249 | index = i;
|
---|
| 250 | break;
|
---|
| 251 | }
|
---|
| 252 | }
|
---|
| 253 | return index;
|
---|
| 254 | }
|
---|
| 255 | getBlockableElement() {
|
---|
| 256 | return this.el.nativeElement.children[0];
|
---|
| 257 | }
|
---|
| 258 | get activeIndex() {
|
---|
| 259 | return this._activeIndex;
|
---|
| 260 | }
|
---|
| 261 | set activeIndex(val) {
|
---|
| 262 | this._activeIndex = val;
|
---|
| 263 | if (this.preventActiveIndexPropagation) {
|
---|
| 264 | this.preventActiveIndexPropagation = false;
|
---|
| 265 | return;
|
---|
| 266 | }
|
---|
| 267 | if (this.tabs && this.tabs.length && this._activeIndex != null && this.tabs.length > this._activeIndex) {
|
---|
| 268 | this.findSelectedTab().selected = false;
|
---|
| 269 | this.tabs[this._activeIndex].selected = true;
|
---|
| 270 | this.tabChanged = true;
|
---|
| 271 | this.updateScrollBar(val);
|
---|
| 272 | }
|
---|
| 273 | }
|
---|
| 274 | updateInkBar() {
|
---|
| 275 | let tabHeader = DomHandler.findSingle(this.navbar.nativeElement, 'li.p-highlight');
|
---|
| 276 | this.inkbar.nativeElement.style.width = DomHandler.getWidth(tabHeader) + 'px';
|
---|
| 277 | this.inkbar.nativeElement.style.left = DomHandler.getOffset(tabHeader).left - DomHandler.getOffset(this.navbar.nativeElement).left + 'px';
|
---|
| 278 | }
|
---|
| 279 | updateScrollBar(index) {
|
---|
| 280 | let tabHeader = this.navbar.nativeElement.children[index];
|
---|
| 281 | tabHeader.scrollIntoView({ block: 'nearest' });
|
---|
| 282 | }
|
---|
| 283 | updateButtonState() {
|
---|
| 284 | const content = this.content.nativeElement;
|
---|
| 285 | const { scrollLeft, scrollWidth } = content;
|
---|
| 286 | const width = DomHandler.getWidth(content);
|
---|
| 287 | this.backwardIsDisabled = scrollLeft === 0;
|
---|
| 288 | this.forwardIsDisabled = scrollLeft === scrollWidth - width;
|
---|
| 289 | }
|
---|
| 290 | onScroll(event) {
|
---|
| 291 | this.scrollable && this.updateButtonState();
|
---|
| 292 | event.preventDefault();
|
---|
| 293 | }
|
---|
| 294 | getVisibleButtonWidths() {
|
---|
| 295 | return [this.prevBtn?.nativeElement, this.nextBtn?.nativeElement].reduce((acc, el) => el ? acc + DomHandler.getWidth(el) : acc, 0);
|
---|
| 296 | }
|
---|
| 297 | navBackward() {
|
---|
| 298 | const content = this.content.nativeElement;
|
---|
| 299 | const width = DomHandler.getWidth(content) - this.getVisibleButtonWidths();
|
---|
| 300 | const pos = content.scrollLeft - width;
|
---|
| 301 | content.scrollLeft = pos <= 0 ? 0 : pos;
|
---|
| 302 | }
|
---|
| 303 | navForward() {
|
---|
| 304 | const content = this.content.nativeElement;
|
---|
| 305 | const width = DomHandler.getWidth(content) - this.getVisibleButtonWidths();
|
---|
| 306 | const pos = content.scrollLeft + width;
|
---|
| 307 | const lastPos = content.scrollWidth - width;
|
---|
| 308 | content.scrollLeft = pos >= lastPos ? lastPos : pos;
|
---|
| 309 | }
|
---|
| 310 | }
|
---|
| 311 | TabView.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: TabView, deps: [{ token: i0.ElementRef }, { token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Component });
|
---|
| 312 | TabView.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.0.0", type: TabView, selector: "p-tabView", inputs: { orientation: "orientation", style: "style", styleClass: "styleClass", controlClose: "controlClose", scrollable: "scrollable", activeIndex: "activeIndex" }, outputs: { onChange: "onChange", onClose: "onClose", activeIndexChange: "activeIndexChange" }, host: { classAttribute: "p-element" }, queries: [{ propertyName: "tabPanels", predicate: TabPanel }], viewQueries: [{ propertyName: "content", first: true, predicate: ["content"], descendants: true }, { propertyName: "navbar", first: true, predicate: ["navbar"], descendants: true }, { propertyName: "prevBtn", first: true, predicate: ["prevBtn"], descendants: true }, { propertyName: "nextBtn", first: true, predicate: ["nextBtn"], descendants: true }, { propertyName: "inkbar", first: true, predicate: ["inkbar"], descendants: true }], ngImport: i0, template: `
|
---|
| 313 | <div [ngClass]="{'p-tabview p-component': true, 'p-tabview-scrollable': scrollable}" [ngStyle]="style" [class]="styleClass">
|
---|
| 314 | <div class="p-tabview-nav-container">
|
---|
| 315 | <button *ngIf="scrollable && !backwardIsDisabled" #prevBtn class="p-tabview-nav-prev p-tabview-nav-btn p-link" (click)="navBackward()" type="button" pRipple>
|
---|
| 316 | <span class="pi pi-chevron-left"></span>
|
---|
| 317 | </button>
|
---|
| 318 | <div #content class="p-tabview-nav-content" (scroll)="onScroll($event)">
|
---|
| 319 | <ul #navbar class="p-tabview-nav" role="tablist">
|
---|
| 320 | <ng-template ngFor let-tab [ngForOf]="tabs">
|
---|
| 321 | <li role="presentation" [ngClass]="{'p-highlight': tab.selected, 'p-disabled': tab.disabled}" [ngStyle]="tab.headerStyle" [class]="tab.headerStyleClass" *ngIf="!tab.closed">
|
---|
| 322 | <a role="tab" class="p-tabview-nav-link" [attr.id]="tab.id + '-label'" [attr.aria-selected]="tab.selected" [attr.aria-controls]="tab.id" [pTooltip]="tab.tooltip" [tooltipPosition]="tab.tooltipPosition"
|
---|
| 323 | [attr.aria-selected]="tab.selected" [positionStyle]="tab.tooltipPositionStyle" [tooltipStyleClass]="tab.tooltipStyleClass"
|
---|
| 324 | (click)="open($event,tab)" (keydown.enter)="open($event,tab)" pRipple [attr.tabindex]="tab.disabled ? null : '0'">
|
---|
| 325 | <ng-container *ngIf="!tab.headerTemplate">
|
---|
| 326 | <span class="p-tabview-left-icon" [ngClass]="tab.leftIcon" *ngIf="tab.leftIcon"></span>
|
---|
| 327 | <span class="p-tabview-title">{{tab.header}}</span>
|
---|
| 328 | <span class="p-tabview-right-icon" [ngClass]="tab.rightIcon" *ngIf="tab.rightIcon"></span>
|
---|
| 329 | </ng-container>
|
---|
| 330 | <ng-container *ngTemplateOutlet="tab.headerTemplate"></ng-container>
|
---|
| 331 | <span *ngIf="tab.closable" class="p-tabview-close pi pi-times" (click)="close($event,tab)"></span>
|
---|
| 332 | </a>
|
---|
| 333 | </li>
|
---|
| 334 | </ng-template>
|
---|
| 335 | <li #inkbar class="p-tabview-ink-bar"></li>
|
---|
| 336 | </ul>
|
---|
| 337 | </div>
|
---|
| 338 | <button *ngIf="scrollable && !forwardIsDisabled" #nextBtn class="p-tabview-nav-next p-tabview-nav-btn p-link" (click)="navForward()" type="button" pRipple>
|
---|
| 339 | <span class="pi pi-chevron-right"></span>
|
---|
| 340 | </button>
|
---|
| 341 | </div>
|
---|
| 342 | <div class="p-tabview-panels">
|
---|
| 343 | <ng-content></ng-content>
|
---|
| 344 | </div>
|
---|
| 345 | </div>
|
---|
| 346 | `, isInline: true, styles: [".p-tabview-nav-container{position:relative}.p-tabview-scrollable .p-tabview-nav-container{overflow:hidden}.p-tabview-nav-content{overflow-x:auto;overflow-y:hidden;scroll-behavior:smooth;scrollbar-width:none;-ms-scroll-chaining:contain auto;overscroll-behavior:contain auto}.p-tabview-nav{display:flex;margin:0;padding:0;list-style-type:none;flex:1 1 auto}.p-tabview-nav-link{cursor:pointer;-webkit-user-select:none;-ms-user-select:none;user-select:none;display:flex;align-items:center;position:relative;text-decoration:none;overflow:hidden}.p-tabview-ink-bar{display:none;z-index:1}.p-tabview-nav-link:focus{z-index:1}.p-tabview-title{line-height:1;white-space:nowrap}.p-tabview-nav-btn{position:absolute;top:0;z-index:2;height:100%;display:flex;align-items:center;justify-content:center}.p-tabview-nav-prev{left:0}.p-tabview-nav-next{right:0}.p-tabview-nav-content::-webkit-scrollbar{display:none}.p-tabview-close{z-index:1}\n"], directives: [{ type: i1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { type: i1.NgStyle, selector: "[ngStyle]", inputs: ["ngStyle"] }, { type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i2.Ripple, selector: "[pRipple]" }, { type: i1.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: i1.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
|
---|
| 347 | i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: TabView, decorators: [{
|
---|
| 348 | type: Component,
|
---|
| 349 | args: [{ selector: 'p-tabView', template: `
|
---|
| 350 | <div [ngClass]="{'p-tabview p-component': true, 'p-tabview-scrollable': scrollable}" [ngStyle]="style" [class]="styleClass">
|
---|
| 351 | <div class="p-tabview-nav-container">
|
---|
| 352 | <button *ngIf="scrollable && !backwardIsDisabled" #prevBtn class="p-tabview-nav-prev p-tabview-nav-btn p-link" (click)="navBackward()" type="button" pRipple>
|
---|
| 353 | <span class="pi pi-chevron-left"></span>
|
---|
| 354 | </button>
|
---|
| 355 | <div #content class="p-tabview-nav-content" (scroll)="onScroll($event)">
|
---|
| 356 | <ul #navbar class="p-tabview-nav" role="tablist">
|
---|
| 357 | <ng-template ngFor let-tab [ngForOf]="tabs">
|
---|
| 358 | <li role="presentation" [ngClass]="{'p-highlight': tab.selected, 'p-disabled': tab.disabled}" [ngStyle]="tab.headerStyle" [class]="tab.headerStyleClass" *ngIf="!tab.closed">
|
---|
| 359 | <a role="tab" class="p-tabview-nav-link" [attr.id]="tab.id + '-label'" [attr.aria-selected]="tab.selected" [attr.aria-controls]="tab.id" [pTooltip]="tab.tooltip" [tooltipPosition]="tab.tooltipPosition"
|
---|
| 360 | [attr.aria-selected]="tab.selected" [positionStyle]="tab.tooltipPositionStyle" [tooltipStyleClass]="tab.tooltipStyleClass"
|
---|
| 361 | (click)="open($event,tab)" (keydown.enter)="open($event,tab)" pRipple [attr.tabindex]="tab.disabled ? null : '0'">
|
---|
| 362 | <ng-container *ngIf="!tab.headerTemplate">
|
---|
| 363 | <span class="p-tabview-left-icon" [ngClass]="tab.leftIcon" *ngIf="tab.leftIcon"></span>
|
---|
| 364 | <span class="p-tabview-title">{{tab.header}}</span>
|
---|
| 365 | <span class="p-tabview-right-icon" [ngClass]="tab.rightIcon" *ngIf="tab.rightIcon"></span>
|
---|
| 366 | </ng-container>
|
---|
| 367 | <ng-container *ngTemplateOutlet="tab.headerTemplate"></ng-container>
|
---|
| 368 | <span *ngIf="tab.closable" class="p-tabview-close pi pi-times" (click)="close($event,tab)"></span>
|
---|
| 369 | </a>
|
---|
| 370 | </li>
|
---|
| 371 | </ng-template>
|
---|
| 372 | <li #inkbar class="p-tabview-ink-bar"></li>
|
---|
| 373 | </ul>
|
---|
| 374 | </div>
|
---|
| 375 | <button *ngIf="scrollable && !forwardIsDisabled" #nextBtn class="p-tabview-nav-next p-tabview-nav-btn p-link" (click)="navForward()" type="button" pRipple>
|
---|
| 376 | <span class="pi pi-chevron-right"></span>
|
---|
| 377 | </button>
|
---|
| 378 | </div>
|
---|
| 379 | <div class="p-tabview-panels">
|
---|
| 380 | <ng-content></ng-content>
|
---|
| 381 | </div>
|
---|
| 382 | </div>
|
---|
| 383 | `, changeDetection: ChangeDetectionStrategy.OnPush, encapsulation: ViewEncapsulation.None, host: {
|
---|
| 384 | 'class': 'p-element'
|
---|
| 385 | }, styles: [".p-tabview-nav-container{position:relative}.p-tabview-scrollable .p-tabview-nav-container{overflow:hidden}.p-tabview-nav-content{overflow-x:auto;overflow-y:hidden;scroll-behavior:smooth;scrollbar-width:none;-ms-scroll-chaining:contain auto;overscroll-behavior:contain auto}.p-tabview-nav{display:flex;margin:0;padding:0;list-style-type:none;flex:1 1 auto}.p-tabview-nav-link{cursor:pointer;-webkit-user-select:none;-ms-user-select:none;user-select:none;display:flex;align-items:center;position:relative;text-decoration:none;overflow:hidden}.p-tabview-ink-bar{display:none;z-index:1}.p-tabview-nav-link:focus{z-index:1}.p-tabview-title{line-height:1;white-space:nowrap}.p-tabview-nav-btn{position:absolute;top:0;z-index:2;height:100%;display:flex;align-items:center;justify-content:center}.p-tabview-nav-prev{left:0}.p-tabview-nav-next{right:0}.p-tabview-nav-content::-webkit-scrollbar{display:none}.p-tabview-close{z-index:1}\n"] }]
|
---|
| 386 | }], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: i0.ChangeDetectorRef }]; }, propDecorators: { orientation: [{
|
---|
| 387 | type: Input
|
---|
| 388 | }], style: [{
|
---|
| 389 | type: Input
|
---|
| 390 | }], styleClass: [{
|
---|
| 391 | type: Input
|
---|
| 392 | }], controlClose: [{
|
---|
| 393 | type: Input
|
---|
| 394 | }], scrollable: [{
|
---|
| 395 | type: Input
|
---|
| 396 | }], content: [{
|
---|
| 397 | type: ViewChild,
|
---|
| 398 | args: ['content']
|
---|
| 399 | }], navbar: [{
|
---|
| 400 | type: ViewChild,
|
---|
| 401 | args: ['navbar']
|
---|
| 402 | }], prevBtn: [{
|
---|
| 403 | type: ViewChild,
|
---|
| 404 | args: ['prevBtn']
|
---|
| 405 | }], nextBtn: [{
|
---|
| 406 | type: ViewChild,
|
---|
| 407 | args: ['nextBtn']
|
---|
| 408 | }], inkbar: [{
|
---|
| 409 | type: ViewChild,
|
---|
| 410 | args: ['inkbar']
|
---|
| 411 | }], tabPanels: [{
|
---|
| 412 | type: ContentChildren,
|
---|
| 413 | args: [TabPanel]
|
---|
| 414 | }], onChange: [{
|
---|
| 415 | type: Output
|
---|
| 416 | }], onClose: [{
|
---|
| 417 | type: Output
|
---|
| 418 | }], activeIndexChange: [{
|
---|
| 419 | type: Output
|
---|
| 420 | }], activeIndex: [{
|
---|
| 421 | type: Input
|
---|
| 422 | }] } });
|
---|
| 423 | class TabViewModule {
|
---|
| 424 | }
|
---|
| 425 | TabViewModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: TabViewModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
---|
| 426 | TabViewModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: TabViewModule, declarations: [TabView, TabPanel], imports: [CommonModule, SharedModule, TooltipModule, RippleModule], exports: [TabView, TabPanel, SharedModule] });
|
---|
| 427 | TabViewModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: TabViewModule, imports: [[CommonModule, SharedModule, TooltipModule, RippleModule], SharedModule] });
|
---|
| 428 | i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: TabViewModule, decorators: [{
|
---|
| 429 | type: NgModule,
|
---|
| 430 | args: [{
|
---|
| 431 | imports: [CommonModule, SharedModule, TooltipModule, RippleModule],
|
---|
| 432 | exports: [TabView, TabPanel, SharedModule],
|
---|
| 433 | declarations: [TabView, TabPanel]
|
---|
| 434 | }]
|
---|
| 435 | }] });
|
---|
| 436 |
|
---|
| 437 | /**
|
---|
| 438 | * Generated bundle index. Do not edit.
|
---|
| 439 | */
|
---|
| 440 |
|
---|
| 441 | export { TabPanel, TabView, TabViewModule };
|
---|