source: trip-planner-front/node_modules/primeng/fesm2020/primeng-cascadeselect.mjs@ 6fe77af

Last change on this file since 6fe77af was 59329aa, checked in by Ema <ema_spirova@…>, 3 years ago

adding photos

  • Property mode set to 100644
File size: 35.6 KB
Line 
1import * as i0 from '@angular/core';
2import { forwardRef, EventEmitter, Component, ViewEncapsulation, ChangeDetectionStrategy, Inject, Input, Output, ViewChild, ContentChildren, NgModule } from '@angular/core';
3import * as i1 from '@angular/common';
4import { CommonModule } from '@angular/common';
5import * as i3 from 'primeng/api';
6import { PrimeTemplate, SharedModule } from 'primeng/api';
7import { ObjectUtils, ZIndexUtils } from 'primeng/utils';
8import { DomHandler, ConnectedOverlayScrollHandler } from 'primeng/dom';
9import { trigger, transition, style, animate } from '@angular/animations';
10import { NG_VALUE_ACCESSOR } from '@angular/forms';
11import * as i2 from 'primeng/ripple';
12import { RippleModule } from 'primeng/ripple';
13
14const CASCADESELECT_VALUE_ACCESSOR = {
15 provide: NG_VALUE_ACCESSOR,
16 useExisting: forwardRef(() => CascadeSelect),
17 multi: true
18};
19class CascadeSelectSub {
20 constructor(cascadeSelect, el) {
21 this.el = el;
22 this.level = 0;
23 this.onSelect = new EventEmitter();
24 this.onGroupSelect = new EventEmitter();
25 this.activeOption = null;
26 this.cascadeSelect = cascadeSelect;
27 }
28 get parentActive() {
29 return this._parentActive;
30 }
31 ;
32 set parentActive(val) {
33 if (!val) {
34 this.activeOption = null;
35 }
36 this._parentActive = val;
37 }
38 ngOnInit() {
39 if (this.selectionPath && this.options && !this.dirty) {
40 for (let option of this.options) {
41 if (this.selectionPath.includes(option)) {
42 this.activeOption = option;
43 break;
44 }
45 }
46 }
47 if (!this.root) {
48 this.position();
49 }
50 }
51 onOptionClick(event, option) {
52 if (this.isOptionGroup(option)) {
53 this.activeOption = (this.activeOption === option) ? null : option;
54 this.onGroupSelect.emit({
55 originalEvent: event,
56 value: option
57 });
58 }
59 else {
60 this.onSelect.emit({
61 originalEvent: event,
62 value: this.getOptionValue(option)
63 });
64 }
65 }
66 onOptionSelect(event) {
67 this.onSelect.emit(event);
68 }
69 onOptionGroupSelect(event) {
70 this.onGroupSelect.emit(event);
71 }
72 getOptionLabel(option) {
73 return this.optionLabel ? ObjectUtils.resolveFieldData(option, this.optionLabel) : option;
74 }
75 getOptionValue(option) {
76 return this.optionValue ? ObjectUtils.resolveFieldData(option, this.optionValue) : option;
77 }
78 getOptionGroupLabel(optionGroup) {
79 return this.optionGroupLabel ? ObjectUtils.resolveFieldData(optionGroup, this.optionGroupLabel) : null;
80 }
81 getOptionGroupChildren(optionGroup) {
82 return ObjectUtils.resolveFieldData(optionGroup, this.optionGroupChildren[this.level]);
83 }
84 isOptionGroup(option) {
85 return Object.prototype.hasOwnProperty.call(option, this.optionGroupChildren[this.level]);
86 }
87 getOptionLabelToRender(option) {
88 return this.isOptionGroup(option) ? this.getOptionGroupLabel(option) : this.getOptionLabel(option);
89 }
90 getItemClass(option) {
91 return {
92 'p-cascadeselect-item': true,
93 'p-cascadeselect-item-group': this.isOptionGroup(option),
94 'p-cascadeselect-item-active p-highlight': this.isOptionActive(option)
95 };
96 }
97 isOptionActive(option) {
98 return this.activeOption === option;
99 }
100 onKeyDown(event, option, index) {
101 let listItem = event.currentTarget.parentElement;
102 switch (event.key) {
103 case 'Down':
104 case 'ArrowDown':
105 var nextItem = this.el.nativeElement.children[0].children[index + 1];
106 if (nextItem) {
107 nextItem.children[0].focus();
108 }
109 event.preventDefault();
110 break;
111 case 'Up':
112 case 'ArrowUp':
113 var prevItem = this.el.nativeElement.children[0].children[index - 1];
114 if (prevItem) {
115 prevItem.children[0].focus();
116 }
117 event.preventDefault();
118 break;
119 case 'Right':
120 case 'ArrowRight':
121 if (this.isOptionGroup(option)) {
122 if (this.isOptionActive(option)) {
123 listItem.children[1].children[0].children[0].children[0].focus();
124 }
125 else {
126 this.activeOption = option;
127 }
128 }
129 event.preventDefault();
130 break;
131 case 'Left':
132 case 'ArrowLeft':
133 this.activeOption = null;
134 var parentList = listItem.parentElement.parentElement.parentElement;
135 if (parentList) {
136 parentList.children[0].focus();
137 }
138 event.preventDefault();
139 break;
140 case 'Enter':
141 this.onOptionClick(event, option);
142 event.preventDefault();
143 break;
144 case 'Tab':
145 case 'Escape':
146 this.cascadeSelect.hide();
147 event.preventDefault();
148 break;
149 }
150 }
151 position() {
152 const parentItem = this.el.nativeElement.parentElement;
153 const containerOffset = DomHandler.getOffset(parentItem);
154 const viewport = DomHandler.getViewport();
155 const sublistWidth = this.el.nativeElement.children[0].offsetParent ? this.el.nativeElement.children[0].offsetWidth : DomHandler.getHiddenElementOuterWidth(this.el.nativeElement.children[0]);
156 const itemOuterWidth = DomHandler.getOuterWidth(parentItem.children[0]);
157 if ((parseInt(containerOffset.left, 10) + itemOuterWidth + sublistWidth) > (viewport.width - DomHandler.calculateScrollbarWidth())) {
158 this.el.nativeElement.children[0].style.left = '-200%';
159 }
160 }
161}
162CascadeSelectSub.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: CascadeSelectSub, deps: [{ token: forwardRef(() => CascadeSelect) }, { token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Component });
163CascadeSelectSub.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.0.0", type: CascadeSelectSub, selector: "p-cascadeSelectSub", inputs: { selectionPath: "selectionPath", options: "options", optionGroupChildren: "optionGroupChildren", optionTemplate: "optionTemplate", level: "level", optionLabel: "optionLabel", optionValue: "optionValue", optionGroupLabel: "optionGroupLabel", dirty: "dirty", root: "root", parentActive: "parentActive" }, outputs: { onSelect: "onSelect", onGroupSelect: "onGroupSelect" }, ngImport: i0, template: `
164 <ul class="p-cascadeselect-panel p-cascadeselect-items" [ngClass]="{'p-cascadeselect-panel-root': root}" role="listbox" aria-orientation="horizontal">
165 <ng-template ngFor let-option [ngForOf]="options" let-i="index">
166 <li [ngClass]="getItemClass(option)" role="none">
167 <div class="p-cascadeselect-item-content" (click)="onOptionClick($event, option)" tabindex="0" (keydown)="onKeyDown($event, option, i)" pRipple>
168 <ng-container *ngIf="optionTemplate;else defaultOptionTemplate">
169 <ng-container *ngTemplateOutlet="optionTemplate; context: {$implicit: option}"></ng-container>
170 </ng-container>
171 <ng-template #defaultOptionTemplate>
172 <span class="p-cascadeselect-item-text">{{getOptionLabelToRender(option)}}</span>
173 </ng-template>
174 <span class="p-cascadeselect-group-icon pi pi-angle-right" *ngIf="isOptionGroup(option)"></span>
175 </div>
176 <p-cascadeSelectSub *ngIf="isOptionGroup(option) && isOptionActive(option)" class="p-cascadeselect-sublist" [selectionPath]="selectionPath" [options]="getOptionGroupChildren(option)"
177 [optionLabel]="optionLabel" [optionValue]="optionValue" [level]="level + 1" (onSelect)="onOptionSelect($event)" (onOptionGroupSelect)="onOptionGroupSelect()"
178 [optionGroupLabel]="optionGroupLabel" [optionGroupChildren]="optionGroupChildren" [parentActive]="isOptionActive(option)" [dirty]="dirty" [optionTemplate]="optionTemplate">
179 </p-cascadeSelectSub>
180 </li>
181 </ng-template>
182 </ul>
183 `, isInline: true, components: [{ type: CascadeSelectSub, selector: "p-cascadeSelectSub", inputs: ["selectionPath", "options", "optionGroupChildren", "optionTemplate", "level", "optionLabel", "optionValue", "optionGroupLabel", "dirty", "root", "parentActive"], outputs: ["onSelect", "onGroupSelect"] }], directives: [{ type: i1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { type: i1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { type: i2.Ripple, selector: "[pRipple]" }, { type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i1.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
184i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: CascadeSelectSub, decorators: [{
185 type: Component,
186 args: [{
187 selector: 'p-cascadeSelectSub',
188 template: `
189 <ul class="p-cascadeselect-panel p-cascadeselect-items" [ngClass]="{'p-cascadeselect-panel-root': root}" role="listbox" aria-orientation="horizontal">
190 <ng-template ngFor let-option [ngForOf]="options" let-i="index">
191 <li [ngClass]="getItemClass(option)" role="none">
192 <div class="p-cascadeselect-item-content" (click)="onOptionClick($event, option)" tabindex="0" (keydown)="onKeyDown($event, option, i)" pRipple>
193 <ng-container *ngIf="optionTemplate;else defaultOptionTemplate">
194 <ng-container *ngTemplateOutlet="optionTemplate; context: {$implicit: option}"></ng-container>
195 </ng-container>
196 <ng-template #defaultOptionTemplate>
197 <span class="p-cascadeselect-item-text">{{getOptionLabelToRender(option)}}</span>
198 </ng-template>
199 <span class="p-cascadeselect-group-icon pi pi-angle-right" *ngIf="isOptionGroup(option)"></span>
200 </div>
201 <p-cascadeSelectSub *ngIf="isOptionGroup(option) && isOptionActive(option)" class="p-cascadeselect-sublist" [selectionPath]="selectionPath" [options]="getOptionGroupChildren(option)"
202 [optionLabel]="optionLabel" [optionValue]="optionValue" [level]="level + 1" (onSelect)="onOptionSelect($event)" (onOptionGroupSelect)="onOptionGroupSelect()"
203 [optionGroupLabel]="optionGroupLabel" [optionGroupChildren]="optionGroupChildren" [parentActive]="isOptionActive(option)" [dirty]="dirty" [optionTemplate]="optionTemplate">
204 </p-cascadeSelectSub>
205 </li>
206 </ng-template>
207 </ul>
208 `,
209 encapsulation: ViewEncapsulation.None,
210 changeDetection: ChangeDetectionStrategy.OnPush
211 }]
212 }], ctorParameters: function () { return [{ type: undefined, decorators: [{
213 type: Inject,
214 args: [forwardRef(() => CascadeSelect)]
215 }] }, { type: i0.ElementRef }]; }, propDecorators: { selectionPath: [{
216 type: Input
217 }], options: [{
218 type: Input
219 }], optionGroupChildren: [{
220 type: Input
221 }], optionTemplate: [{
222 type: Input
223 }], level: [{
224 type: Input
225 }], optionLabel: [{
226 type: Input
227 }], optionValue: [{
228 type: Input
229 }], optionGroupLabel: [{
230 type: Input
231 }], dirty: [{
232 type: Input
233 }], root: [{
234 type: Input
235 }], onSelect: [{
236 type: Output
237 }], onGroupSelect: [{
238 type: Output
239 }], parentActive: [{
240 type: Input
241 }] } });
242class CascadeSelect {
243 constructor(el, cd, config, overlayService) {
244 this.el = el;
245 this.cd = cd;
246 this.config = config;
247 this.overlayService = overlayService;
248 this.showTransitionOptions = '.12s cubic-bezier(0, 0, 0.2, 1)';
249 this.hideTransitionOptions = '.1s linear';
250 this.onChange = new EventEmitter();
251 this.onGroupChange = new EventEmitter();
252 this.onShow = new EventEmitter();
253 this.onHide = new EventEmitter();
254 this.onBeforeShow = new EventEmitter();
255 this.onBeforeHide = new EventEmitter();
256 this.selectionPath = null;
257 this.focused = false;
258 this.filled = false;
259 this.overlayVisible = false;
260 this.dirty = false;
261 this.onModelChange = () => { };
262 this.onModelTouched = () => { };
263 }
264 ngOnInit() {
265 this.updateSelectionPath();
266 }
267 ngAfterContentInit() {
268 this.templates.forEach((item) => {
269 switch (item.getType()) {
270 case 'value':
271 this.valueTemplate = item.template;
272 break;
273 case 'option':
274 this.optionTemplate = item.template;
275 break;
276 }
277 });
278 }
279 onOptionSelect(event) {
280 this.value = event.value;
281 this.updateSelectionPath();
282 this.onModelChange(this.value);
283 this.onChange.emit(event);
284 this.hide();
285 this.focusInputEl.nativeElement.focus();
286 }
287 onOptionGroupSelect(event) {
288 this.dirty = true;
289 this.onGroupChange.emit(event);
290 }
291 getOptionLabel(option) {
292 return this.optionLabel ? ObjectUtils.resolveFieldData(option, this.optionLabel) : option;
293 }
294 getOptionValue(option) {
295 return this.optionValue ? ObjectUtils.resolveFieldData(option, this.optionValue) : option;
296 }
297 getOptionGroupChildren(optionGroup, level) {
298 return ObjectUtils.resolveFieldData(optionGroup, this.optionGroupChildren[level]);
299 }
300 isOptionGroup(option, level) {
301 return Object.prototype.hasOwnProperty.call(option, this.optionGroupChildren[level]);
302 }
303 updateSelectionPath() {
304 let path;
305 if (this.value != null && this.options) {
306 for (let option of this.options) {
307 path = this.findModelOptionInGroup(option, 0);
308 if (path) {
309 break;
310 }
311 }
312 }
313 this.selectionPath = path;
314 this.updateFilledState();
315 }
316 updateFilledState() {
317 this.filled = !(this.selectionPath == null || this.selectionPath.length == 0);
318 }
319 findModelOptionInGroup(option, level) {
320 if (this.isOptionGroup(option, level)) {
321 let selectedOption;
322 for (let childOption of this.getOptionGroupChildren(option, level)) {
323 selectedOption = this.findModelOptionInGroup(childOption, level + 1);
324 if (selectedOption) {
325 selectedOption.unshift(option);
326 return selectedOption;
327 }
328 }
329 }
330 else if ((ObjectUtils.equals(this.value, this.getOptionValue(option), this.dataKey))) {
331 return [option];
332 }
333 return null;
334 }
335 show() {
336 this.onBeforeShow.emit();
337 this.overlayVisible = true;
338 }
339 hide() {
340 this.onBeforeHide.emit();
341 this.overlayVisible = false;
342 this.cd.markForCheck();
343 }
344 onClick(event) {
345 if (this.disabled) {
346 return;
347 }
348 if (!this.overlayEl || !this.overlayEl || !this.overlayEl.contains(event.target)) {
349 if (this.overlayVisible) {
350 this.hide();
351 }
352 else {
353 this.show();
354 }
355 this.focusInputEl.nativeElement.focus();
356 }
357 }
358 onFocus() {
359 this.focused = true;
360 }
361 onBlur() {
362 this.focused = false;
363 }
364 onOverlayClick(event) {
365 this.overlayService.add({
366 originalEvent: event,
367 target: this.el.nativeElement
368 });
369 }
370 onOverlayAnimationStart(event) {
371 switch (event.toState) {
372 case 'visible':
373 this.overlayEl = event.element;
374 this.onOverlayEnter();
375 break;
376 }
377 }
378 onOverlayAnimationDone(event) {
379 switch (event.toState) {
380 case 'void':
381 this.onOverlayLeave();
382 break;
383 }
384 }
385 onOverlayEnter() {
386 ZIndexUtils.set('overlay', this.overlayEl, this.config.zIndex.overlay);
387 this.appendContainer();
388 this.alignOverlay();
389 this.bindOutsideClickListener();
390 this.bindScrollListener();
391 this.bindResizeListener();
392 this.onShow.emit();
393 }
394 onOverlayLeave() {
395 this.unbindOutsideClickListener();
396 this.unbindScrollListener();
397 this.unbindResizeListener();
398 this.onHide.emit();
399 ZIndexUtils.clear(this.overlayEl);
400 this.overlayEl = null;
401 this.dirty = false;
402 }
403 writeValue(value) {
404 this.value = value;
405 this.updateSelectionPath();
406 this.cd.markForCheck();
407 }
408 registerOnChange(fn) {
409 this.onModelChange = fn;
410 }
411 registerOnTouched(fn) {
412 this.onModelTouched = fn;
413 }
414 setDisabledState(val) {
415 this.disabled = val;
416 this.cd.markForCheck();
417 }
418 alignOverlay() {
419 if (this.appendTo) {
420 DomHandler.absolutePosition(this.overlayEl, this.containerEl.nativeElement);
421 this.overlayEl.style.minWidth = DomHandler.getOuterWidth(this.containerEl.nativeElement) + 'px';
422 }
423 else {
424 DomHandler.relativePosition(this.overlayEl, this.containerEl.nativeElement);
425 }
426 }
427 bindOutsideClickListener() {
428 if (!this.outsideClickListener) {
429 this.outsideClickListener = (event) => {
430 if (this.overlayVisible && this.overlayEl && !this.containerEl.nativeElement.contains(event.target) && !this.overlayEl.contains(event.target)) {
431 this.hide();
432 }
433 };
434 document.addEventListener('click', this.outsideClickListener);
435 }
436 }
437 unbindOutsideClickListener() {
438 if (this.outsideClickListener) {
439 document.removeEventListener('click', this.outsideClickListener);
440 this.outsideClickListener = null;
441 }
442 }
443 bindScrollListener() {
444 if (!this.scrollHandler) {
445 this.scrollHandler = new ConnectedOverlayScrollHandler(this.containerEl.nativeElement, () => {
446 if (this.overlayVisible) {
447 this.hide();
448 }
449 });
450 }
451 this.scrollHandler.bindScrollListener();
452 }
453 unbindScrollListener() {
454 if (this.scrollHandler) {
455 this.scrollHandler.unbindScrollListener();
456 }
457 }
458 bindResizeListener() {
459 if (!this.resizeListener) {
460 this.resizeListener = () => {
461 if (this.overlayVisible) {
462 this.hide();
463 }
464 };
465 window.addEventListener('resize', this.resizeListener);
466 }
467 }
468 unbindResizeListener() {
469 if (this.resizeListener) {
470 window.removeEventListener('resize', this.resizeListener);
471 this.resizeListener = null;
472 }
473 }
474 appendContainer() {
475 if (this.appendTo) {
476 if (this.appendTo === 'body')
477 document.body.appendChild(this.overlayEl);
478 else
479 document.getElementById(this.appendTo).appendChild(this.overlayEl);
480 }
481 }
482 restoreAppend() {
483 if (this.overlayEl && this.appendTo) {
484 if (this.appendTo === 'body')
485 document.body.removeChild(this.overlayEl);
486 else
487 document.getElementById(this.appendTo).removeChild(this.overlayEl);
488 }
489 }
490 label() {
491 if (this.selectionPath)
492 return this.getOptionLabel(this.selectionPath[this.selectionPath.length - 1]);
493 else
494 return this.placeholder || 'p-emptylabel';
495 }
496 onKeyDown(event) {
497 switch (event.code) {
498 case 'Down':
499 case 'ArrowDown':
500 if (this.overlayVisible) {
501 DomHandler.findSingle(this.overlayEl, '.p-cascadeselect-item').children[0].focus();
502 }
503 else if (event.altKey && this.options && this.options.length) {
504 this.show();
505 }
506 event.preventDefault();
507 break;
508 case 'Space':
509 case 'Enter':
510 if (!this.overlayVisible)
511 this.show();
512 else
513 this.hide();
514 event.preventDefault();
515 break;
516 case 'Tab':
517 case 'Escape':
518 if (this.overlayVisible) {
519 this.hide();
520 event.preventDefault();
521 }
522 break;
523 }
524 }
525 containerClass() {
526 return {
527 'p-cascadeselect p-component p-inputwrapper': true,
528 'p-disabled': this.disabled,
529 'p-focus': this.focused
530 };
531 }
532 labelClass() {
533 return {
534 'p-cascadeselect-label': true,
535 'p-placeholder': this.label() === this.placeholder,
536 'p-cascadeselect-label-empty': !this.value && (this.label() === 'p-emptylabel' || this.label().length === 0)
537 };
538 }
539 ngOnDestroy() {
540 this.restoreAppend();
541 this.unbindOutsideClickListener();
542 this.unbindResizeListener();
543 if (this.scrollHandler) {
544 this.scrollHandler.destroy();
545 this.scrollHandler = null;
546 }
547 this.overlayEl = null;
548 }
549}
550CascadeSelect.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: CascadeSelect, deps: [{ token: i0.ElementRef }, { token: i0.ChangeDetectorRef }, { token: i3.PrimeNGConfig }, { token: i3.OverlayService }], target: i0.ɵɵFactoryTarget.Component });
551CascadeSelect.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.0.0", type: CascadeSelect, selector: "p-cascadeSelect", inputs: { styleClass: "styleClass", style: "style", options: "options", optionLabel: "optionLabel", optionValue: "optionValue", optionGroupLabel: "optionGroupLabel", optionGroupChildren: "optionGroupChildren", placeholder: "placeholder", value: "value", dataKey: "dataKey", inputId: "inputId", tabindex: "tabindex", ariaLabelledBy: "ariaLabelledBy", appendTo: "appendTo", disabled: "disabled", rounded: "rounded", showTransitionOptions: "showTransitionOptions", hideTransitionOptions: "hideTransitionOptions" }, outputs: { onChange: "onChange", onGroupChange: "onGroupChange", onShow: "onShow", onHide: "onHide", onBeforeShow: "onBeforeShow", onBeforeHide: "onBeforeHide" }, host: { properties: { "class.p-inputwrapper-filled": "filled", "class.p-inputwrapper-focus": "focused || overlayVisible" }, classAttribute: "p-element p-inputwrapper" }, providers: [CASCADESELECT_VALUE_ACCESSOR], queries: [{ propertyName: "templates", predicate: PrimeTemplate }], viewQueries: [{ propertyName: "focusInputEl", first: true, predicate: ["focusInput"], descendants: true }, { propertyName: "containerEl", first: true, predicate: ["container"], descendants: true }], ngImport: i0, template: `
552 <div #container [ngClass]="containerClass()" [class]="styleClass" [ngStyle]="style" (click)="onClick($event)">
553 <div class="p-hidden-accessible">
554 <input #focusInput type="text" [attr.id]="inputId" readonly [disabled]="disabled" (focus)="onFocus()" (blur)="onBlur()" (keydown)="onKeyDown($event)" [attr.tabindex]="tabindex"
555 aria-haspopup="listbox" [attr.aria-expanded]="overlayVisible" [attr.aria-labelledby]="ariaLabelledBy">
556 </div>
557 <span [ngClass]="labelClass()">
558 <ng-container *ngIf="valueTemplate;else defaultValueTemplate">
559 <ng-container *ngTemplateOutlet="valueTemplate; context: {$implicit: value, placeholder: placeholder}"></ng-container>
560 </ng-container>
561 <ng-template #defaultValueTemplate>
562 {{label()}}
563 </ng-template>
564 </span>
565 <div class="p-cascadeselect-trigger" role="button" aria-haspopup="listbox" [attr.aria-expanded]="overlayVisible">
566 <span class="p-cascadeselect-trigger-icon pi pi-chevron-down"></span>
567 </div>
568 <div class="p-cascadeselect-panel p-component" *ngIf="overlayVisible" (click)="onOverlayClick($event)"
569 [@overlayAnimation]="{value: 'visible', params: {showTransitionParams: showTransitionOptions, hideTransitionParams: hideTransitionOptions}}" (@overlayAnimation.start)="onOverlayAnimationStart($event)" (@overlayAnimation.done)="onOverlayAnimationDone($event)">
570 <div class="p-cascadeselect-items-wrapper">
571 <p-cascadeSelectSub [options]="options" [selectionPath]="selectionPath" class="p-cascadeselect-items"
572 [optionLabel]="optionLabel" [optionValue]="optionValue" [level]="0" [optionTemplate]="optionTemplate"
573 [optionGroupLabel]="optionGroupLabel" [optionGroupChildren]="optionGroupChildren"
574 (onSelect)="onOptionSelect($event)" (onGroupSelect)="onOptionGroupSelect($event)" [dirty]="dirty" [root]="true">
575 </p-cascadeSelectSub>
576 </div>
577 </div>
578 </div>
579 `, isInline: true, styles: [".p-cascadeselect{display:inline-flex;cursor:pointer;position:relative;-webkit-user-select:none;-ms-user-select:none;user-select:none}.p-cascadeselect-trigger{display:flex;align-items:center;justify-content:center;flex-shrink:0}.p-cascadeselect-label{display:block;white-space:nowrap;overflow:hidden;flex:1 1 auto;width:1%;text-overflow:ellipsis;cursor:pointer}.p-cascadeselect-label-empty{overflow:hidden;visibility:hidden}.p-cascadeselect .p-cascadeselect-panel{min-width:100%}.p-cascadeselect-panel{position:absolute;top:0;left:0}.p-cascadeselect-item{cursor:pointer;font-weight:normal;white-space:nowrap}.p-cascadeselect-item-content{display:flex;align-items:center;overflow:hidden;position:relative}.p-cascadeselect-group-icon{margin-left:auto}.p-cascadeselect-items{margin:0;padding:0;list-style-type:none}.p-fluid .p-cascadeselect{display:flex}.p-fluid .p-cascadeselect .p-cascadeselect-label{width:1%}.p-cascadeselect-sublist{position:absolute;min-width:100%;z-index:1;display:none}.p-cascadeselect-item-active{overflow:visible!important}.p-cascadeselect-item-active>.p-cascadeselect-sublist{display:block;left:100%;top:0}\n"], components: [{ type: CascadeSelectSub, selector: "p-cascadeSelectSub", inputs: ["selectionPath", "options", "optionGroupChildren", "optionTemplate", "level", "optionLabel", "optionValue", "optionGroupLabel", "dirty", "root", "parentActive"], outputs: ["onSelect", "onGroupSelect"] }], 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: i1.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet"] }], animations: [
580 trigger('overlayAnimation', [
581 transition(':enter', [
582 style({ opacity: 0, transform: 'scaleY(0.8)' }),
583 animate('{{showTransitionParams}}')
584 ]),
585 transition(':leave', [
586 animate('{{hideTransitionParams}}', style({ opacity: 0 }))
587 ])
588 ])
589 ], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
590i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: CascadeSelect, decorators: [{
591 type: Component,
592 args: [{ selector: 'p-cascadeSelect', template: `
593 <div #container [ngClass]="containerClass()" [class]="styleClass" [ngStyle]="style" (click)="onClick($event)">
594 <div class="p-hidden-accessible">
595 <input #focusInput type="text" [attr.id]="inputId" readonly [disabled]="disabled" (focus)="onFocus()" (blur)="onBlur()" (keydown)="onKeyDown($event)" [attr.tabindex]="tabindex"
596 aria-haspopup="listbox" [attr.aria-expanded]="overlayVisible" [attr.aria-labelledby]="ariaLabelledBy">
597 </div>
598 <span [ngClass]="labelClass()">
599 <ng-container *ngIf="valueTemplate;else defaultValueTemplate">
600 <ng-container *ngTemplateOutlet="valueTemplate; context: {$implicit: value, placeholder: placeholder}"></ng-container>
601 </ng-container>
602 <ng-template #defaultValueTemplate>
603 {{label()}}
604 </ng-template>
605 </span>
606 <div class="p-cascadeselect-trigger" role="button" aria-haspopup="listbox" [attr.aria-expanded]="overlayVisible">
607 <span class="p-cascadeselect-trigger-icon pi pi-chevron-down"></span>
608 </div>
609 <div class="p-cascadeselect-panel p-component" *ngIf="overlayVisible" (click)="onOverlayClick($event)"
610 [@overlayAnimation]="{value: 'visible', params: {showTransitionParams: showTransitionOptions, hideTransitionParams: hideTransitionOptions}}" (@overlayAnimation.start)="onOverlayAnimationStart($event)" (@overlayAnimation.done)="onOverlayAnimationDone($event)">
611 <div class="p-cascadeselect-items-wrapper">
612 <p-cascadeSelectSub [options]="options" [selectionPath]="selectionPath" class="p-cascadeselect-items"
613 [optionLabel]="optionLabel" [optionValue]="optionValue" [level]="0" [optionTemplate]="optionTemplate"
614 [optionGroupLabel]="optionGroupLabel" [optionGroupChildren]="optionGroupChildren"
615 (onSelect)="onOptionSelect($event)" (onGroupSelect)="onOptionGroupSelect($event)" [dirty]="dirty" [root]="true">
616 </p-cascadeSelectSub>
617 </div>
618 </div>
619 </div>
620 `, animations: [
621 trigger('overlayAnimation', [
622 transition(':enter', [
623 style({ opacity: 0, transform: 'scaleY(0.8)' }),
624 animate('{{showTransitionParams}}')
625 ]),
626 transition(':leave', [
627 animate('{{hideTransitionParams}}', style({ opacity: 0 }))
628 ])
629 ])
630 ], host: {
631 'class': 'p-element p-inputwrapper',
632 '[class.p-inputwrapper-filled]': 'filled',
633 '[class.p-inputwrapper-focus]': 'focused || overlayVisible'
634 }, providers: [CASCADESELECT_VALUE_ACCESSOR], changeDetection: ChangeDetectionStrategy.OnPush, encapsulation: ViewEncapsulation.None, styles: [".p-cascadeselect{display:inline-flex;cursor:pointer;position:relative;-webkit-user-select:none;-ms-user-select:none;user-select:none}.p-cascadeselect-trigger{display:flex;align-items:center;justify-content:center;flex-shrink:0}.p-cascadeselect-label{display:block;white-space:nowrap;overflow:hidden;flex:1 1 auto;width:1%;text-overflow:ellipsis;cursor:pointer}.p-cascadeselect-label-empty{overflow:hidden;visibility:hidden}.p-cascadeselect .p-cascadeselect-panel{min-width:100%}.p-cascadeselect-panel{position:absolute;top:0;left:0}.p-cascadeselect-item{cursor:pointer;font-weight:normal;white-space:nowrap}.p-cascadeselect-item-content{display:flex;align-items:center;overflow:hidden;position:relative}.p-cascadeselect-group-icon{margin-left:auto}.p-cascadeselect-items{margin:0;padding:0;list-style-type:none}.p-fluid .p-cascadeselect{display:flex}.p-fluid .p-cascadeselect .p-cascadeselect-label{width:1%}.p-cascadeselect-sublist{position:absolute;min-width:100%;z-index:1;display:none}.p-cascadeselect-item-active{overflow:visible!important}.p-cascadeselect-item-active>.p-cascadeselect-sublist{display:block;left:100%;top:0}\n"] }]
635 }], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: i0.ChangeDetectorRef }, { type: i3.PrimeNGConfig }, { type: i3.OverlayService }]; }, propDecorators: { styleClass: [{
636 type: Input
637 }], style: [{
638 type: Input
639 }], options: [{
640 type: Input
641 }], optionLabel: [{
642 type: Input
643 }], optionValue: [{
644 type: Input
645 }], optionGroupLabel: [{
646 type: Input
647 }], optionGroupChildren: [{
648 type: Input
649 }], placeholder: [{
650 type: Input
651 }], value: [{
652 type: Input
653 }], dataKey: [{
654 type: Input
655 }], inputId: [{
656 type: Input
657 }], tabindex: [{
658 type: Input
659 }], ariaLabelledBy: [{
660 type: Input
661 }], appendTo: [{
662 type: Input
663 }], disabled: [{
664 type: Input
665 }], rounded: [{
666 type: Input
667 }], showTransitionOptions: [{
668 type: Input
669 }], hideTransitionOptions: [{
670 type: Input
671 }], focusInputEl: [{
672 type: ViewChild,
673 args: ['focusInput']
674 }], containerEl: [{
675 type: ViewChild,
676 args: ['container']
677 }], onChange: [{
678 type: Output
679 }], onGroupChange: [{
680 type: Output
681 }], onShow: [{
682 type: Output
683 }], onHide: [{
684 type: Output
685 }], onBeforeShow: [{
686 type: Output
687 }], onBeforeHide: [{
688 type: Output
689 }], templates: [{
690 type: ContentChildren,
691 args: [PrimeTemplate]
692 }] } });
693class CascadeSelectModule {
694}
695CascadeSelectModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: CascadeSelectModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
696CascadeSelectModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: CascadeSelectModule, declarations: [CascadeSelect, CascadeSelectSub], imports: [CommonModule, SharedModule, RippleModule], exports: [CascadeSelect, CascadeSelectSub, SharedModule] });
697CascadeSelectModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: CascadeSelectModule, imports: [[CommonModule, SharedModule, RippleModule], SharedModule] });
698i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: CascadeSelectModule, decorators: [{
699 type: NgModule,
700 args: [{
701 imports: [CommonModule, SharedModule, RippleModule],
702 exports: [CascadeSelect, CascadeSelectSub, SharedModule],
703 declarations: [CascadeSelect, CascadeSelectSub]
704 }]
705 }] });
706
707/**
708 * Generated bundle index. Do not edit.
709 */
710
711export { CASCADESELECT_VALUE_ACCESSOR, CascadeSelect, CascadeSelectModule, CascadeSelectSub };
Note: See TracBrowser for help on using the repository browser.