1 | import * as i0 from '@angular/core';
|
---|
2 | import { Component, ChangeDetectionStrategy, ViewEncapsulation, Input, ContentChildren, NgModule } from '@angular/core';
|
---|
3 | import * as i1 from '@angular/common';
|
---|
4 | import { CommonModule } from '@angular/common';
|
---|
5 | import { PrimeTemplate, SharedModule } from 'primeng/api';
|
---|
6 | import * as i2 from '@angular/router';
|
---|
7 | import { RouterModule } from '@angular/router';
|
---|
8 | import * as i3 from 'primeng/ripple';
|
---|
9 | import { RippleModule } from 'primeng/ripple';
|
---|
10 | import * as i4 from 'primeng/tooltip';
|
---|
11 | import { TooltipModule } from 'primeng/tooltip';
|
---|
12 |
|
---|
13 | class Dock {
|
---|
14 | constructor(el, cd) {
|
---|
15 | this.el = el;
|
---|
16 | this.cd = cd;
|
---|
17 | this.model = null;
|
---|
18 | this.position = "bottom";
|
---|
19 | this.currentIndex = -3;
|
---|
20 | }
|
---|
21 | ngAfterContentInit() {
|
---|
22 | this.templates.forEach((item) => {
|
---|
23 | switch (item.getType()) {
|
---|
24 | case 'item':
|
---|
25 | this.itemTemplate = item.template;
|
---|
26 | break;
|
---|
27 | default:
|
---|
28 | this.itemTemplate = item.template;
|
---|
29 | break;
|
---|
30 | }
|
---|
31 | });
|
---|
32 | }
|
---|
33 | onListMouseLeave() {
|
---|
34 | this.currentIndex = -3;
|
---|
35 | this.cd.markForCheck();
|
---|
36 | }
|
---|
37 | onItemMouseEnter(index) {
|
---|
38 | this.currentIndex = index;
|
---|
39 | if (index === 1) {
|
---|
40 | }
|
---|
41 | this.cd.markForCheck();
|
---|
42 | }
|
---|
43 | onItemClick(e, item) {
|
---|
44 | if (item.command) {
|
---|
45 | item.command({ originalEvent: e, item });
|
---|
46 | }
|
---|
47 | }
|
---|
48 | get containerClass() {
|
---|
49 | return {
|
---|
50 | ['p-dock p-component ' + ` p-dock-${this.position}`]: true
|
---|
51 | };
|
---|
52 | }
|
---|
53 | isClickableRouterLink(item) {
|
---|
54 | return item.routerLink && !item.disabled;
|
---|
55 | }
|
---|
56 | itemClass(index) {
|
---|
57 | return {
|
---|
58 | 'p-dock-item': true,
|
---|
59 | 'p-dock-item-second-prev': (this.currentIndex - 2) === index,
|
---|
60 | 'p-dock-item-prev': (this.currentIndex - 1) === index,
|
---|
61 | 'p-dock-item-current': this.currentIndex === index,
|
---|
62 | 'p-dock-item-next': (this.currentIndex + 1) === index,
|
---|
63 | 'p-dock-item-second-next': (this.currentIndex + 2) === index
|
---|
64 | };
|
---|
65 | }
|
---|
66 | }
|
---|
67 | Dock.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: Dock, deps: [{ token: i0.ElementRef }, { token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Component });
|
---|
68 | Dock.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.0.0", type: Dock, selector: "p-dock", inputs: { id: "id", style: "style", styleClass: "styleClass", model: "model", position: "position" }, host: { classAttribute: "p-element" }, queries: [{ propertyName: "templates", predicate: PrimeTemplate }], ngImport: i0, template: `
|
---|
69 | <div [attr.id]="id" [ngClass]="containerClass" [ngStyle]="style" [class]="styleClass">
|
---|
70 | <div class="p-dock-list-container">
|
---|
71 | <ul #list class="p-dock-list" role="menu" (mouseleave)="onListMouseLeave()">
|
---|
72 | <li *ngFor="let item of model; let i = index" [ngClass]="itemClass(i)" (mouseenter)="onItemMouseEnter(i)">
|
---|
73 | <a *ngIf="isClickableRouterLink(item); else elseBlock" pRipple [routerLink]="item.routerLink" [queryParams]="item.queryParams"
|
---|
74 | [ngClass]="{'p-disabled':item.disabled}" class="p-dock-action" role="menuitem" [routerLinkActiveOptions]="item.routerLinkActiveOptions||{exact:false}" (click)="onItemClick($event, item)" (keydown.enter)="onItemClick($event, item, i)"
|
---|
75 | [attr.target]="item.target" [attr.id]="item.id" [attr.tabindex]="item.disabled || readonly ? null : (item.tabindex ? item.tabindex : '0')" pTooltip [tooltipOptions]="item.tooltipOptions"
|
---|
76 | [fragment]="item.fragment" [queryParamsHandling]="item.queryParamsHandling" [preserveFragment]="item.preserveFragment" [skipLocationChange]="item.skipLocationChange" [replaceUrl]="item.replaceUrl" [state]="item.state">
|
---|
77 | <span class="p-dock-action-icon" *ngIf="item.icon && !itemTemplate" [ngClass]="item.icon"></span>
|
---|
78 | <ng-container *ngTemplateOutlet="itemTemplate; context: {$implicit: item}"></ng-container>
|
---|
79 | </a>
|
---|
80 | <ng-template #elseBlock>
|
---|
81 | <a [tooltipPosition]="item.tooltipPosition" [attr.href]="item.url||null" class="p-dock-action" role="menuitem" pRipple (click)="onItemClick($event, item)" pTooltip [tooltipOptions]="item.tooltipOptions"
|
---|
82 | [ngClass]="{'p-disabled':item.disabled}" (keydown.enter)="onItemClick($event, item, i)" [attr.target]="item.target" [attr.id]="item.id" [attr.tabindex]="item.disabled||(i !== activeIndex && readonly) ? null : (item.tabindex ? item.tabindex : '0')">
|
---|
83 | <span class="p-dock-action-icon" *ngIf="item.icon && !itemTemplate" [ngClass]="item.icon"></span>
|
---|
84 | <ng-container *ngTemplateOutlet="itemTemplate; context: {$implicit: item}"></ng-container>
|
---|
85 | </a>
|
---|
86 | </ng-template>
|
---|
87 | </li>
|
---|
88 | </ul>
|
---|
89 | </div>
|
---|
90 | </div>
|
---|
91 | `, isInline: true, styles: [".p-dock{position:absolute;z-index:1;display:flex;justify-content:center;align-items:center;pointer-events:none}.p-dock-list-container{display:flex;pointer-events:auto}.p-dock-list{margin:0;padding:0;list-style:none;display:flex;align-items:center;justify-content:center}.p-dock-item{transition:all .2s cubic-bezier(.4,0,.2,1);will-change:transform}.p-dock-action{display:flex;flex-direction:column;align-items:center;justify-content:center;position:relative;overflow:hidden;cursor:default}.p-dock-item-second-prev,.p-dock-item-second-next{transform:scale(1.2)}.p-dock-item-prev,.p-dock-item-next{transform:scale(1.4)}.p-dock-item-current{transform:scale(1.6);z-index:1}.p-dock-top{left:0;top:0;width:100%}.p-dock-top .p-dock-item{transform-origin:center top}.p-dock-bottom{left:0;bottom:0;width:100%}.p-dock-bottom .p-dock-item{transform-origin:center bottom}.p-dock-right{right:0;top:0;height:100%}.p-dock-right .p-dock-item{transform-origin:center right}.p-dock-right .p-dock-list{flex-direction:column}.p-dock-left{left:0;top:0;height:100%}.p-dock-left .p-dock-item{transform-origin:center left}.p-dock-left .p-dock-list{flex-direction:column}\n"], directives: [{ type: i1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { type: i1.NgStyle, selector: "[ngStyle]", inputs: ["ngStyle"] }, { type: i1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i2.RouterLinkWithHref, selector: "a[routerLink],area[routerLink]", inputs: ["target", "queryParams", "fragment", "queryParamsHandling", "preserveFragment", "skipLocationChange", "replaceUrl", "state", "relativeTo", "routerLink"] }, { type: i3.Ripple, selector: "[pRipple]" }, { type: i4.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 });
|
---|
92 | i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: Dock, decorators: [{
|
---|
93 | type: Component,
|
---|
94 | args: [{ selector: 'p-dock', template: `
|
---|
95 | <div [attr.id]="id" [ngClass]="containerClass" [ngStyle]="style" [class]="styleClass">
|
---|
96 | <div class="p-dock-list-container">
|
---|
97 | <ul #list class="p-dock-list" role="menu" (mouseleave)="onListMouseLeave()">
|
---|
98 | <li *ngFor="let item of model; let i = index" [ngClass]="itemClass(i)" (mouseenter)="onItemMouseEnter(i)">
|
---|
99 | <a *ngIf="isClickableRouterLink(item); else elseBlock" pRipple [routerLink]="item.routerLink" [queryParams]="item.queryParams"
|
---|
100 | [ngClass]="{'p-disabled':item.disabled}" class="p-dock-action" role="menuitem" [routerLinkActiveOptions]="item.routerLinkActiveOptions||{exact:false}" (click)="onItemClick($event, item)" (keydown.enter)="onItemClick($event, item, i)"
|
---|
101 | [attr.target]="item.target" [attr.id]="item.id" [attr.tabindex]="item.disabled || readonly ? null : (item.tabindex ? item.tabindex : '0')" pTooltip [tooltipOptions]="item.tooltipOptions"
|
---|
102 | [fragment]="item.fragment" [queryParamsHandling]="item.queryParamsHandling" [preserveFragment]="item.preserveFragment" [skipLocationChange]="item.skipLocationChange" [replaceUrl]="item.replaceUrl" [state]="item.state">
|
---|
103 | <span class="p-dock-action-icon" *ngIf="item.icon && !itemTemplate" [ngClass]="item.icon"></span>
|
---|
104 | <ng-container *ngTemplateOutlet="itemTemplate; context: {$implicit: item}"></ng-container>
|
---|
105 | </a>
|
---|
106 | <ng-template #elseBlock>
|
---|
107 | <a [tooltipPosition]="item.tooltipPosition" [attr.href]="item.url||null" class="p-dock-action" role="menuitem" pRipple (click)="onItemClick($event, item)" pTooltip [tooltipOptions]="item.tooltipOptions"
|
---|
108 | [ngClass]="{'p-disabled':item.disabled}" (keydown.enter)="onItemClick($event, item, i)" [attr.target]="item.target" [attr.id]="item.id" [attr.tabindex]="item.disabled||(i !== activeIndex && readonly) ? null : (item.tabindex ? item.tabindex : '0')">
|
---|
109 | <span class="p-dock-action-icon" *ngIf="item.icon && !itemTemplate" [ngClass]="item.icon"></span>
|
---|
110 | <ng-container *ngTemplateOutlet="itemTemplate; context: {$implicit: item}"></ng-container>
|
---|
111 | </a>
|
---|
112 | </ng-template>
|
---|
113 | </li>
|
---|
114 | </ul>
|
---|
115 | </div>
|
---|
116 | </div>
|
---|
117 | `, changeDetection: ChangeDetectionStrategy.OnPush, encapsulation: ViewEncapsulation.None, host: {
|
---|
118 | 'class': 'p-element'
|
---|
119 | }, styles: [".p-dock{position:absolute;z-index:1;display:flex;justify-content:center;align-items:center;pointer-events:none}.p-dock-list-container{display:flex;pointer-events:auto}.p-dock-list{margin:0;padding:0;list-style:none;display:flex;align-items:center;justify-content:center}.p-dock-item{transition:all .2s cubic-bezier(.4,0,.2,1);will-change:transform}.p-dock-action{display:flex;flex-direction:column;align-items:center;justify-content:center;position:relative;overflow:hidden;cursor:default}.p-dock-item-second-prev,.p-dock-item-second-next{transform:scale(1.2)}.p-dock-item-prev,.p-dock-item-next{transform:scale(1.4)}.p-dock-item-current{transform:scale(1.6);z-index:1}.p-dock-top{left:0;top:0;width:100%}.p-dock-top .p-dock-item{transform-origin:center top}.p-dock-bottom{left:0;bottom:0;width:100%}.p-dock-bottom .p-dock-item{transform-origin:center bottom}.p-dock-right{right:0;top:0;height:100%}.p-dock-right .p-dock-item{transform-origin:center right}.p-dock-right .p-dock-list{flex-direction:column}.p-dock-left{left:0;top:0;height:100%}.p-dock-left .p-dock-item{transform-origin:center left}.p-dock-left .p-dock-list{flex-direction:column}\n"] }]
|
---|
120 | }], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: i0.ChangeDetectorRef }]; }, propDecorators: { id: [{
|
---|
121 | type: Input
|
---|
122 | }], style: [{
|
---|
123 | type: Input
|
---|
124 | }], styleClass: [{
|
---|
125 | type: Input
|
---|
126 | }], model: [{
|
---|
127 | type: Input
|
---|
128 | }], position: [{
|
---|
129 | type: Input
|
---|
130 | }], templates: [{
|
---|
131 | type: ContentChildren,
|
---|
132 | args: [PrimeTemplate]
|
---|
133 | }] } });
|
---|
134 | class DockModule {
|
---|
135 | }
|
---|
136 | DockModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: DockModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
---|
137 | DockModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: DockModule, declarations: [Dock], imports: [CommonModule, RouterModule, RippleModule, TooltipModule], exports: [Dock, SharedModule, TooltipModule, RouterModule] });
|
---|
138 | DockModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: DockModule, imports: [[CommonModule, RouterModule, RippleModule, TooltipModule], SharedModule, TooltipModule, RouterModule] });
|
---|
139 | i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: DockModule, decorators: [{
|
---|
140 | type: NgModule,
|
---|
141 | args: [{
|
---|
142 | imports: [CommonModule, RouterModule, RippleModule, TooltipModule],
|
---|
143 | exports: [Dock, SharedModule, TooltipModule, RouterModule],
|
---|
144 | declarations: [Dock]
|
---|
145 | }]
|
---|
146 | }] });
|
---|
147 |
|
---|
148 | /**
|
---|
149 | * Generated bundle index. Do not edit.
|
---|
150 | */
|
---|
151 |
|
---|
152 | export { Dock, DockModule };
|
---|