pdm-ui-kit 0.1.32 → 0.1.33
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/esm2020/lib/components/button-group/button-group.component.mjs +1 -7
- package/esm2020/lib/components/date-picker/date-picker.component.mjs +60 -6
- package/esm2020/lib/components/popover/popover.component.mjs +74 -10
- package/esm2020/lib/components/select/select.component.mjs +60 -7
- package/fesm2015/pdm-ui-kit.mjs +192 -24
- package/fesm2015/pdm-ui-kit.mjs.map +1 -1
- package/fesm2020/pdm-ui-kit.mjs +189 -24
- package/fesm2020/pdm-ui-kit.mjs.map +1 -1
- package/lib/components/date-picker/date-picker.component.d.ts +6 -0
- package/lib/components/popover/popover.component.d.ts +15 -4
- package/lib/components/select/select.component.d.ts +11 -2
- package/package.json +1 -1
package/fesm2020/pdm-ui-kit.mjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as i1 from '@angular/common';
|
|
2
2
|
import { CommonModule } from '@angular/common';
|
|
3
3
|
import * as i0 from '@angular/core';
|
|
4
|
-
import { EventEmitter, Component, ChangeDetectionStrategy, Input, Output, HostListener,
|
|
4
|
+
import { EventEmitter, Component, ChangeDetectionStrategy, Input, Output, HostListener, ViewChild, ViewChildren, NgModule } from '@angular/core';
|
|
5
5
|
import { icons } from 'lucide';
|
|
6
6
|
import * as i1$1 from '@angular/platform-browser';
|
|
7
7
|
import { format } from 'date-fns';
|
|
@@ -313,7 +313,6 @@ class PdmButtonGroupComponent {
|
|
|
313
313
|
'[&>pdm-button>button]:!rounded-none',
|
|
314
314
|
'[&>pdm-button:first-child>button]:!rounded-l-md',
|
|
315
315
|
'[&>pdm-button:last-child>button]:!rounded-r-md',
|
|
316
|
-
'[&>pdm-button:not(:first-child)>button]:!border-l-0',
|
|
317
316
|
'[&>pdm-input>div>input]:!rounded-none',
|
|
318
317
|
'[&>pdm-input:first-child>div>input]:!rounded-l-md',
|
|
319
318
|
'[&>pdm-input:last-child>div>input]:!rounded-r-md',
|
|
@@ -331,12 +330,10 @@ class PdmButtonGroupComponent {
|
|
|
331
330
|
'[&>pdm-tooltip>span>pdm-button>button]:!rounded-none',
|
|
332
331
|
'[&>pdm-tooltip:first-child>span>pdm-button>button]:!rounded-l-md',
|
|
333
332
|
'[&>pdm-tooltip:last-child>span>pdm-button>button]:!rounded-r-md',
|
|
334
|
-
'[&>pdm-tooltip:not(:first-child)>span>pdm-button>button]:!border-l-0',
|
|
335
333
|
'[&>pdm-tooltip>span>pdm-button>button]:shadow-none',
|
|
336
334
|
'[&>pdm-tooltip>span>button]:!rounded-none',
|
|
337
335
|
'[&>pdm-tooltip:first-child>span>button]:!rounded-l-md',
|
|
338
336
|
'[&>pdm-tooltip:last-child>span>button]:!rounded-r-md',
|
|
339
|
-
'[&>pdm-tooltip:not(:first-child)>span>button]:!border-l-0',
|
|
340
337
|
'[&>pdm-tooltip>span>button]:shadow-none',
|
|
341
338
|
'[&>pdm-tooltip>span>pdm-input>div>input]:!rounded-none',
|
|
342
339
|
'[&>pdm-tooltip:first-child>span>pdm-input>div>input]:!rounded-l-md',
|
|
@@ -396,7 +393,6 @@ class PdmButtonGroupComponent {
|
|
|
396
393
|
'[&>pdm-input>div>input]:bg-background',
|
|
397
394
|
'[&>pdm-input>div>input]:shadow-none',
|
|
398
395
|
'[&>pdm-button>button]:shadow-none',
|
|
399
|
-
'[&>pdm-button:not(:first-child)>button]:!border-t-0',
|
|
400
396
|
'[&>pdm-tooltip>span>*]:rounded-none',
|
|
401
397
|
'[&>pdm-tooltip:first-child>span>*]:rounded-t-md',
|
|
402
398
|
'[&>pdm-tooltip:last-child>span>*]:rounded-b-md',
|
|
@@ -404,12 +400,10 @@ class PdmButtonGroupComponent {
|
|
|
404
400
|
'[&>pdm-tooltip>span>pdm-button>button]:!rounded-none',
|
|
405
401
|
'[&>pdm-tooltip:first-child>span>pdm-button>button]:!rounded-t-md',
|
|
406
402
|
'[&>pdm-tooltip:last-child>span>pdm-button>button]:!rounded-b-md',
|
|
407
|
-
'[&>pdm-tooltip:not(:first-child)>span>pdm-button>button]:!border-t-0',
|
|
408
403
|
'[&>pdm-tooltip>span>pdm-button>button]:shadow-none',
|
|
409
404
|
'[&>pdm-tooltip>span>button]:!rounded-none',
|
|
410
405
|
'[&>pdm-tooltip:first-child>span>button]:!rounded-t-md',
|
|
411
406
|
'[&>pdm-tooltip:last-child>span>button]:!rounded-b-md',
|
|
412
|
-
'[&>pdm-tooltip:not(:first-child)>span>button]:!border-t-0',
|
|
413
407
|
'[&>pdm-tooltip>span>button]:shadow-none',
|
|
414
408
|
'[&>pdm-tooltip>span>pdm-input>div>input]:!rounded-none',
|
|
415
409
|
'[&>pdm-tooltip:first-child>span>pdm-input>div>input]:!rounded-t-md',
|
|
@@ -1961,6 +1955,7 @@ class PdmDatePickerComponent {
|
|
|
1961
1955
|
this._open = false;
|
|
1962
1956
|
this.instanceId = `pdm-date-picker-${++nextDatePickerId}`;
|
|
1963
1957
|
this.triggerFocused = false;
|
|
1958
|
+
this.panelPlacement = 'bottom';
|
|
1964
1959
|
this.id = '';
|
|
1965
1960
|
this.variant = 'single';
|
|
1966
1961
|
this.label = '';
|
|
@@ -1990,6 +1985,12 @@ class PdmDatePickerComponent {
|
|
|
1990
1985
|
}
|
|
1991
1986
|
set open(value) {
|
|
1992
1987
|
this._open = !!value;
|
|
1988
|
+
if (this._open) {
|
|
1989
|
+
this.schedulePanelPlacementUpdate();
|
|
1990
|
+
}
|
|
1991
|
+
else {
|
|
1992
|
+
this.panelPlacement = 'bottom';
|
|
1993
|
+
}
|
|
1993
1994
|
this.cdr.markForCheck();
|
|
1994
1995
|
}
|
|
1995
1996
|
get open() {
|
|
@@ -2071,7 +2072,9 @@ class PdmDatePickerComponent {
|
|
|
2071
2072
|
}
|
|
2072
2073
|
get panelClasses() {
|
|
2073
2074
|
return [
|
|
2074
|
-
|
|
2075
|
+
this.panelPlacement === 'top'
|
|
2076
|
+
? 'absolute bottom-full left-0 z-30 mb-2'
|
|
2077
|
+
: 'absolute left-0 top-full z-30 mt-2',
|
|
2075
2078
|
this.panelClassName
|
|
2076
2079
|
];
|
|
2077
2080
|
}
|
|
@@ -2135,14 +2138,47 @@ class PdmDatePickerComponent {
|
|
|
2135
2138
|
this.setOpen(false);
|
|
2136
2139
|
}
|
|
2137
2140
|
}
|
|
2141
|
+
onViewportChange() {
|
|
2142
|
+
this.updatePanelPlacement();
|
|
2143
|
+
}
|
|
2138
2144
|
setOpen(nextOpen) {
|
|
2139
2145
|
if (this._open === nextOpen) {
|
|
2140
2146
|
return;
|
|
2141
2147
|
}
|
|
2142
2148
|
this._open = nextOpen;
|
|
2143
2149
|
this.openChange.emit(this._open);
|
|
2150
|
+
if (this._open) {
|
|
2151
|
+
this.schedulePanelPlacementUpdate();
|
|
2152
|
+
}
|
|
2153
|
+
else {
|
|
2154
|
+
this.panelPlacement = 'bottom';
|
|
2155
|
+
}
|
|
2144
2156
|
this.cdr.markForCheck();
|
|
2145
2157
|
}
|
|
2158
|
+
schedulePanelPlacementUpdate() {
|
|
2159
|
+
setTimeout(() => this.updatePanelPlacement());
|
|
2160
|
+
}
|
|
2161
|
+
updatePanelPlacement() {
|
|
2162
|
+
if (!this._open) {
|
|
2163
|
+
return;
|
|
2164
|
+
}
|
|
2165
|
+
const triggerEl = this.triggerRef?.nativeElement;
|
|
2166
|
+
const panelEl = this.panelRef?.nativeElement;
|
|
2167
|
+
if (!triggerEl || !panelEl || typeof window === 'undefined') {
|
|
2168
|
+
return;
|
|
2169
|
+
}
|
|
2170
|
+
const viewportHeight = window.innerHeight;
|
|
2171
|
+
const gap = 8;
|
|
2172
|
+
const triggerRect = triggerEl.getBoundingClientRect();
|
|
2173
|
+
const panelHeight = panelEl.offsetHeight;
|
|
2174
|
+
const spaceBelow = Math.max(0, viewportHeight - triggerRect.bottom - gap);
|
|
2175
|
+
const spaceAbove = Math.max(0, triggerRect.top - gap);
|
|
2176
|
+
const nextPlacement = spaceBelow < panelHeight && spaceAbove > spaceBelow ? 'top' : 'bottom';
|
|
2177
|
+
if (this.panelPlacement !== nextPlacement) {
|
|
2178
|
+
this.panelPlacement = nextPlacement;
|
|
2179
|
+
this.cdr.markForCheck();
|
|
2180
|
+
}
|
|
2181
|
+
}
|
|
2146
2182
|
formatDate(date) {
|
|
2147
2183
|
try {
|
|
2148
2184
|
return format(date, this.format || 'MMM d, yyyy');
|
|
@@ -2162,11 +2198,17 @@ class PdmDatePickerComponent {
|
|
|
2162
2198
|
}
|
|
2163
2199
|
}
|
|
2164
2200
|
PdmDatePickerComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: PdmDatePickerComponent, deps: [{ token: i0.ElementRef }, { token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Component });
|
|
2165
|
-
PdmDatePickerComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.3.0", type: PdmDatePickerComponent, selector: "pdm-date-picker", inputs: { id: "id", variant: "variant", label: "label", labelClassName: "labelClassName", className: "className", triggerClassName: "triggerClassName", panelClassName: "panelClassName", placeholder: "placeholder", rangePlaceholder: "rangePlaceholder", format: "format", disabled: "disabled", readonly: "readonly", required: "required", invalid: "invalid", allowSameDayRange: "allowSameDayRange", closeOnSelect: "closeOnSelect", minDate: "minDate", maxDate: "maxDate", minYear: "minYear", maxYear: "maxYear", disabledDates: "disabledDates", isDateDisabled: "isDateDisabled", open: "open", value: "value", rangeValue: "rangeValue" }, outputs: { valueChange: "valueChange", rangeValueChange: "rangeValueChange", openChange: "openChange", monthChange: "monthChange" }, host: { listeners: { "document:keydown.escape": "onEscape()", "document:click": "onDocumentClick($event)" } }, ngImport: i0, template: "<div [ngClass]=\"rootClasses\">\n <pdm-label *ngIf=\"label\" [forId]=\"triggerId\" [required]=\"required\" [className]=\"labelClassName\">\n {{ label }}\n </pdm-label>\n\n <div class=\"relative inline-block w-full\">\n <button\n type=\"button\"\n [id]=\"triggerId\"\n [disabled]=\"disabled\"\n [attr.aria-expanded]=\"open\"\n [attr.aria-controls]=\"panelId\"\n [attr.aria-haspopup]=\"'dialog'\"\n [attr.aria-invalid]=\"invalid\"\n [ngClass]=\"triggerClasses\"\n [attr.title]=\"displayText\"\n (click)=\"toggleOpen()\"\n (focus)=\"onTriggerFocus()\"\n (blur)=\"onTriggerBlur()\"\n >\n <span class=\"flex h-5 w-5 shrink-0 items-center justify-center p-0.5 text-muted-foreground\" aria-hidden=\"true\">\n <svg viewBox=\"0 0 24 24\" class=\"h-4 w-4\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"1.8\">\n <path d=\"M8 2v4\" stroke-linecap=\"round\" stroke-linejoin=\"round\"></path>\n <path d=\"M16 2v4\" stroke-linecap=\"round\" stroke-linejoin=\"round\"></path>\n <rect x=\"3\" y=\"4.5\" width=\"18\" height=\"16.5\" rx=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"></rect>\n <path d=\"M3 9.5h18\" stroke-linecap=\"round\" stroke-linejoin=\"round\"></path>\n </svg>\n </span>\n\n <span [ngClass]=\"textClasses\">{{ displayText }}</span>\n </button>\n\n <div *ngIf=\"open\" [id]=\"panelId\" [ngClass]=\"panelClasses\" role=\"dialog\" [attr.aria-labelledby]=\"label ? triggerId : null\">\n <pdm-calendar\n [variant]=\"resolvedVariant\"\n [value]=\"value\"\n [rangeValue]=\"rangeValue\"\n [readonly]=\"readonly\"\n [allowSameDayRange]=\"allowSameDayRange\"\n [minDate]=\"minDate\"\n [maxDate]=\"maxDate\"\n [minYear]=\"minYear\"\n [maxYear]=\"maxYear\"\n [disabledDates]=\"disabledDates\"\n [isDateDisabled]=\"isDateDisabled\"\n (valueChange)=\"onCalendarValueChange($event)\"\n (rangeValueChange)=\"onCalendarRangeValueChange($event)\"\n (monthChange)=\"onCalendarMonthChange($event)\"\n ></pdm-calendar>\n </div>\n </div>\n</div>\n", dependencies: [{ kind: "directive", type: i1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "component", type: PdmCalendarComponent, selector: "pdm-calendar", inputs: ["variant", "className", "disabledDates", "minDate", "maxDate", "minYear", "maxYear", "isDateDisabled", "allowSameDayRange", "readonly", "value", "rangeValue", "month"], outputs: ["valueChange", "rangeValueChange", "monthChange", "dateClick", "disabledDateClick"] }, { kind: "component", type: PdmLabelComponent, selector: "pdm-label", inputs: ["forId", "required", "className"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
2201
|
+
PdmDatePickerComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.3.0", type: PdmDatePickerComponent, selector: "pdm-date-picker", inputs: { id: "id", variant: "variant", label: "label", labelClassName: "labelClassName", className: "className", triggerClassName: "triggerClassName", panelClassName: "panelClassName", placeholder: "placeholder", rangePlaceholder: "rangePlaceholder", format: "format", disabled: "disabled", readonly: "readonly", required: "required", invalid: "invalid", allowSameDayRange: "allowSameDayRange", closeOnSelect: "closeOnSelect", minDate: "minDate", maxDate: "maxDate", minYear: "minYear", maxYear: "maxYear", disabledDates: "disabledDates", isDateDisabled: "isDateDisabled", open: "open", value: "value", rangeValue: "rangeValue" }, outputs: { valueChange: "valueChange", rangeValueChange: "rangeValueChange", openChange: "openChange", monthChange: "monthChange" }, host: { listeners: { "document:keydown.escape": "onEscape()", "document:click": "onDocumentClick($event)", "window:resize": "onViewportChange()", "window:scroll": "onViewportChange()" } }, viewQueries: [{ propertyName: "triggerRef", first: true, predicate: ["triggerEl"], descendants: true }, { propertyName: "panelRef", first: true, predicate: ["panelEl"], descendants: true }], ngImport: i0, template: "<div [ngClass]=\"rootClasses\">\n <pdm-label *ngIf=\"label\" [forId]=\"triggerId\" [required]=\"required\" [className]=\"labelClassName\">\n {{ label }}\n </pdm-label>\n\n <div class=\"relative inline-block w-full\">\n <button\n #triggerEl\n type=\"button\"\n [id]=\"triggerId\"\n [disabled]=\"disabled\"\n [attr.aria-expanded]=\"open\"\n [attr.aria-controls]=\"panelId\"\n [attr.aria-haspopup]=\"'dialog'\"\n [attr.aria-invalid]=\"invalid\"\n [ngClass]=\"triggerClasses\"\n [attr.title]=\"displayText\"\n (click)=\"toggleOpen()\"\n (focus)=\"onTriggerFocus()\"\n (blur)=\"onTriggerBlur()\"\n >\n <span class=\"flex h-5 w-5 shrink-0 items-center justify-center p-0.5 text-muted-foreground\" aria-hidden=\"true\">\n <svg viewBox=\"0 0 24 24\" class=\"h-4 w-4\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"1.8\">\n <path d=\"M8 2v4\" stroke-linecap=\"round\" stroke-linejoin=\"round\"></path>\n <path d=\"M16 2v4\" stroke-linecap=\"round\" stroke-linejoin=\"round\"></path>\n <rect x=\"3\" y=\"4.5\" width=\"18\" height=\"16.5\" rx=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"></rect>\n <path d=\"M3 9.5h18\" stroke-linecap=\"round\" stroke-linejoin=\"round\"></path>\n </svg>\n </span>\n\n <span [ngClass]=\"textClasses\">{{ displayText }}</span>\n </button>\n\n <div *ngIf=\"open\" #panelEl [id]=\"panelId\" [ngClass]=\"panelClasses\" role=\"dialog\" [attr.aria-labelledby]=\"label ? triggerId : null\">\n <pdm-calendar\n [variant]=\"resolvedVariant\"\n [value]=\"value\"\n [rangeValue]=\"rangeValue\"\n [readonly]=\"readonly\"\n [allowSameDayRange]=\"allowSameDayRange\"\n [minDate]=\"minDate\"\n [maxDate]=\"maxDate\"\n [minYear]=\"minYear\"\n [maxYear]=\"maxYear\"\n [disabledDates]=\"disabledDates\"\n [isDateDisabled]=\"isDateDisabled\"\n (valueChange)=\"onCalendarValueChange($event)\"\n (rangeValueChange)=\"onCalendarRangeValueChange($event)\"\n (monthChange)=\"onCalendarMonthChange($event)\"\n ></pdm-calendar>\n </div>\n </div>\n</div>\n", dependencies: [{ kind: "directive", type: i1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "component", type: PdmCalendarComponent, selector: "pdm-calendar", inputs: ["variant", "className", "disabledDates", "minDate", "maxDate", "minYear", "maxYear", "isDateDisabled", "allowSameDayRange", "readonly", "value", "rangeValue", "month"], outputs: ["valueChange", "rangeValueChange", "monthChange", "dateClick", "disabledDateClick"] }, { kind: "component", type: PdmLabelComponent, selector: "pdm-label", inputs: ["forId", "required", "className"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
2166
2202
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: PdmDatePickerComponent, decorators: [{
|
|
2167
2203
|
type: Component,
|
|
2168
|
-
args: [{ selector: 'pdm-date-picker', changeDetection: ChangeDetectionStrategy.OnPush, template: "<div [ngClass]=\"rootClasses\">\n <pdm-label *ngIf=\"label\" [forId]=\"triggerId\" [required]=\"required\" [className]=\"labelClassName\">\n {{ label }}\n </pdm-label>\n\n <div class=\"relative inline-block w-full\">\n <button\n type=\"button\"\n [id]=\"triggerId\"\n [disabled]=\"disabled\"\n [attr.aria-expanded]=\"open\"\n [attr.aria-controls]=\"panelId\"\n [attr.aria-haspopup]=\"'dialog'\"\n [attr.aria-invalid]=\"invalid\"\n [ngClass]=\"triggerClasses\"\n [attr.title]=\"displayText\"\n (click)=\"toggleOpen()\"\n (focus)=\"onTriggerFocus()\"\n (blur)=\"onTriggerBlur()\"\n >\n <span class=\"flex h-5 w-5 shrink-0 items-center justify-center p-0.5 text-muted-foreground\" aria-hidden=\"true\">\n <svg viewBox=\"0 0 24 24\" class=\"h-4 w-4\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"1.8\">\n <path d=\"M8 2v4\" stroke-linecap=\"round\" stroke-linejoin=\"round\"></path>\n <path d=\"M16 2v4\" stroke-linecap=\"round\" stroke-linejoin=\"round\"></path>\n <rect x=\"3\" y=\"4.5\" width=\"18\" height=\"16.5\" rx=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"></rect>\n <path d=\"M3 9.5h18\" stroke-linecap=\"round\" stroke-linejoin=\"round\"></path>\n </svg>\n </span>\n\n <span [ngClass]=\"textClasses\">{{ displayText }}</span>\n </button>\n\n <div *ngIf=\"open\" [id]=\"panelId\" [ngClass]=\"panelClasses\" role=\"dialog\" [attr.aria-labelledby]=\"label ? triggerId : null\">\n <pdm-calendar\n [variant]=\"resolvedVariant\"\n [value]=\"value\"\n [rangeValue]=\"rangeValue\"\n [readonly]=\"readonly\"\n [allowSameDayRange]=\"allowSameDayRange\"\n [minDate]=\"minDate\"\n [maxDate]=\"maxDate\"\n [minYear]=\"minYear\"\n [maxYear]=\"maxYear\"\n [disabledDates]=\"disabledDates\"\n [isDateDisabled]=\"isDateDisabled\"\n (valueChange)=\"onCalendarValueChange($event)\"\n (rangeValueChange)=\"onCalendarRangeValueChange($event)\"\n (monthChange)=\"onCalendarMonthChange($event)\"\n ></pdm-calendar>\n </div>\n </div>\n</div>\n" }]
|
|
2169
|
-
}], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: i0.ChangeDetectorRef }]; }, propDecorators: {
|
|
2204
|
+
args: [{ selector: 'pdm-date-picker', changeDetection: ChangeDetectionStrategy.OnPush, template: "<div [ngClass]=\"rootClasses\">\n <pdm-label *ngIf=\"label\" [forId]=\"triggerId\" [required]=\"required\" [className]=\"labelClassName\">\n {{ label }}\n </pdm-label>\n\n <div class=\"relative inline-block w-full\">\n <button\n #triggerEl\n type=\"button\"\n [id]=\"triggerId\"\n [disabled]=\"disabled\"\n [attr.aria-expanded]=\"open\"\n [attr.aria-controls]=\"panelId\"\n [attr.aria-haspopup]=\"'dialog'\"\n [attr.aria-invalid]=\"invalid\"\n [ngClass]=\"triggerClasses\"\n [attr.title]=\"displayText\"\n (click)=\"toggleOpen()\"\n (focus)=\"onTriggerFocus()\"\n (blur)=\"onTriggerBlur()\"\n >\n <span class=\"flex h-5 w-5 shrink-0 items-center justify-center p-0.5 text-muted-foreground\" aria-hidden=\"true\">\n <svg viewBox=\"0 0 24 24\" class=\"h-4 w-4\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"1.8\">\n <path d=\"M8 2v4\" stroke-linecap=\"round\" stroke-linejoin=\"round\"></path>\n <path d=\"M16 2v4\" stroke-linecap=\"round\" stroke-linejoin=\"round\"></path>\n <rect x=\"3\" y=\"4.5\" width=\"18\" height=\"16.5\" rx=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"></rect>\n <path d=\"M3 9.5h18\" stroke-linecap=\"round\" stroke-linejoin=\"round\"></path>\n </svg>\n </span>\n\n <span [ngClass]=\"textClasses\">{{ displayText }}</span>\n </button>\n\n <div *ngIf=\"open\" #panelEl [id]=\"panelId\" [ngClass]=\"panelClasses\" role=\"dialog\" [attr.aria-labelledby]=\"label ? triggerId : null\">\n <pdm-calendar\n [variant]=\"resolvedVariant\"\n [value]=\"value\"\n [rangeValue]=\"rangeValue\"\n [readonly]=\"readonly\"\n [allowSameDayRange]=\"allowSameDayRange\"\n [minDate]=\"minDate\"\n [maxDate]=\"maxDate\"\n [minYear]=\"minYear\"\n [maxYear]=\"maxYear\"\n [disabledDates]=\"disabledDates\"\n [isDateDisabled]=\"isDateDisabled\"\n (valueChange)=\"onCalendarValueChange($event)\"\n (rangeValueChange)=\"onCalendarRangeValueChange($event)\"\n (monthChange)=\"onCalendarMonthChange($event)\"\n ></pdm-calendar>\n </div>\n </div>\n</div>\n" }]
|
|
2205
|
+
}], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: i0.ChangeDetectorRef }]; }, propDecorators: { triggerRef: [{
|
|
2206
|
+
type: ViewChild,
|
|
2207
|
+
args: ['triggerEl']
|
|
2208
|
+
}], panelRef: [{
|
|
2209
|
+
type: ViewChild,
|
|
2210
|
+
args: ['panelEl']
|
|
2211
|
+
}], id: [{
|
|
2170
2212
|
type: Input
|
|
2171
2213
|
}], variant: [{
|
|
2172
2214
|
type: Input
|
|
@@ -2230,6 +2272,12 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.3.0", ngImpor
|
|
|
2230
2272
|
}], onDocumentClick: [{
|
|
2231
2273
|
type: HostListener,
|
|
2232
2274
|
args: ['document:click', ['$event']]
|
|
2275
|
+
}], onViewportChange: [{
|
|
2276
|
+
type: HostListener,
|
|
2277
|
+
args: ['window:resize']
|
|
2278
|
+
}, {
|
|
2279
|
+
type: HostListener,
|
|
2280
|
+
args: ['window:scroll']
|
|
2233
2281
|
}] } });
|
|
2234
2282
|
|
|
2235
2283
|
class PdmDialogComponent {
|
|
@@ -3140,8 +3188,9 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.3.0", ngImpor
|
|
|
3140
3188
|
}] } });
|
|
3141
3189
|
|
|
3142
3190
|
class PdmSelectComponent {
|
|
3143
|
-
constructor(elementRef) {
|
|
3191
|
+
constructor(elementRef, cdr) {
|
|
3144
3192
|
this.elementRef = elementRef;
|
|
3193
|
+
this.cdr = cdr;
|
|
3145
3194
|
this.id = '';
|
|
3146
3195
|
this.value = '';
|
|
3147
3196
|
this.options = [];
|
|
@@ -3150,6 +3199,8 @@ class PdmSelectComponent {
|
|
|
3150
3199
|
this.className = '';
|
|
3151
3200
|
this.placeholder = 'Select an option';
|
|
3152
3201
|
this.open = false;
|
|
3202
|
+
this.panelPlacement = 'bottom';
|
|
3203
|
+
this.panelMaxHeightPx = null;
|
|
3153
3204
|
this.valueChange = new EventEmitter();
|
|
3154
3205
|
}
|
|
3155
3206
|
get selectedOption() {
|
|
@@ -3158,10 +3209,22 @@ class PdmSelectComponent {
|
|
|
3158
3209
|
get selectedLabel() {
|
|
3159
3210
|
return this.selectedOption?.label || this.placeholder;
|
|
3160
3211
|
}
|
|
3212
|
+
get panelClasses() {
|
|
3213
|
+
return [
|
|
3214
|
+
'absolute left-0 z-50 w-full overflow-y-auto rounded-md border border-border bg-popover p-1 text-popover-foreground shadow-md',
|
|
3215
|
+
this.panelPlacement === 'top' ? 'bottom-[calc(100%+4px)]' : 'top-[calc(100%+4px)]'
|
|
3216
|
+
];
|
|
3217
|
+
}
|
|
3161
3218
|
toggle() {
|
|
3162
3219
|
if (this.disabled)
|
|
3163
3220
|
return;
|
|
3164
3221
|
this.open = !this.open;
|
|
3222
|
+
if (this.open) {
|
|
3223
|
+
this.schedulePanelPlacementUpdate();
|
|
3224
|
+
return;
|
|
3225
|
+
}
|
|
3226
|
+
this.panelPlacement = 'bottom';
|
|
3227
|
+
this.panelMaxHeightPx = null;
|
|
3165
3228
|
}
|
|
3166
3229
|
onChange(event) {
|
|
3167
3230
|
this.valueChange.emit(event.target.value);
|
|
@@ -3182,13 +3245,39 @@ class PdmSelectComponent {
|
|
|
3182
3245
|
onEscape() {
|
|
3183
3246
|
this.open = false;
|
|
3184
3247
|
}
|
|
3248
|
+
onViewportChange() {
|
|
3249
|
+
this.updatePanelPlacement();
|
|
3250
|
+
}
|
|
3251
|
+
schedulePanelPlacementUpdate() {
|
|
3252
|
+
setTimeout(() => this.updatePanelPlacement());
|
|
3253
|
+
}
|
|
3254
|
+
updatePanelPlacement() {
|
|
3255
|
+
if (!this.open)
|
|
3256
|
+
return;
|
|
3257
|
+
const triggerEl = this.triggerRef?.nativeElement;
|
|
3258
|
+
const panelEl = this.panelRef?.nativeElement;
|
|
3259
|
+
if (!triggerEl || !panelEl || typeof window === 'undefined') {
|
|
3260
|
+
return;
|
|
3261
|
+
}
|
|
3262
|
+
const viewportHeight = window.innerHeight;
|
|
3263
|
+
const gap = 4;
|
|
3264
|
+
const triggerRect = triggerEl.getBoundingClientRect();
|
|
3265
|
+
const panelHeight = panelEl.offsetHeight;
|
|
3266
|
+
const spaceBelow = Math.max(0, viewportHeight - triggerRect.bottom - gap);
|
|
3267
|
+
const spaceAbove = Math.max(0, triggerRect.top - gap);
|
|
3268
|
+
const nextPlacement = spaceBelow < panelHeight && spaceAbove > spaceBelow ? 'top' : 'bottom';
|
|
3269
|
+
const availableHeight = nextPlacement === 'top' ? spaceAbove : spaceBelow;
|
|
3270
|
+
this.panelPlacement = nextPlacement;
|
|
3271
|
+
this.panelMaxHeightPx = Math.max(120, Math.min(384, Math.floor(availableHeight)));
|
|
3272
|
+
this.cdr.markForCheck();
|
|
3273
|
+
}
|
|
3185
3274
|
}
|
|
3186
|
-
PdmSelectComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: PdmSelectComponent, deps: [{ token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Component });
|
|
3187
|
-
PdmSelectComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.3.0", type: PdmSelectComponent, selector: "pdm-select", inputs: { id: "id", value: "value", options: "options", disabled: "disabled", invalid: "invalid", className: "className", placeholder: "placeholder" }, outputs: { valueChange: "valueChange" }, host: { listeners: { "document:click": "onDocumentClick($event)", "document:keydown.escape": "onEscape()" } }, ngImport: i0, template: "<div [ngClass]=\"['relative', className || 'w-full']\">\n <button\n type=\"button\"\n [id]=\"id\"\n [disabled]=\"disabled\"\n [attr.aria-invalid]=\"invalid\"\n [attr.aria-expanded]=\"open\"\n [attr.data-state]=\"open ? 'open' : 'closed'\"\n aria-haspopup=\"listbox\"\n (click)=\"toggle()\"\n [ngClass]=\"[\n 'border-input focus-visible:border-ring focus-visible:ring-2 focus-visible:ring-ring/50 aria-invalid:ring-2 aria-invalid:ring-destructive aria-invalid:border-destructive flex h-9 w-full appearance-none items-center justify-between rounded-md border bg-background px-3 py-2 text-sm shadow-sm outline-none disabled:cursor-not-allowed disabled:opacity-50',\n ]\"\n >\n <span\n [ngClass]=\"[\n 'min-w-0 flex-1 truncate text-left leading-5',\n selectedOption\n ? 'font-medium text-foreground'\n : 'font-normal text-muted-foreground',\n ]\"\n >\n {{ selectedLabel }}\n </span>\n <pdm-icon\n name=\"chevron-down\"\n [size]=\"16\"\n className=\"shrink-0 text-muted-foreground\"\n ></pdm-icon>\n </button>\n\n <div\n *ngIf=\"open\"\n role=\"listbox\"\n [attr.aria-labelledby]=\"id || null\"\n
|
|
3275
|
+
PdmSelectComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: PdmSelectComponent, deps: [{ token: i0.ElementRef }, { token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Component });
|
|
3276
|
+
PdmSelectComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.3.0", type: PdmSelectComponent, selector: "pdm-select", inputs: { id: "id", value: "value", options: "options", disabled: "disabled", invalid: "invalid", className: "className", placeholder: "placeholder" }, outputs: { valueChange: "valueChange" }, host: { listeners: { "document:click": "onDocumentClick($event)", "document:keydown.escape": "onEscape()", "window:resize": "onViewportChange()", "window:scroll": "onViewportChange()" } }, viewQueries: [{ propertyName: "triggerRef", first: true, predicate: ["triggerEl"], descendants: true }, { propertyName: "panelRef", first: true, predicate: ["panelEl"], descendants: true }], ngImport: i0, template: "<div [ngClass]=\"['relative', className || 'w-full']\">\n <button\n #triggerEl\n type=\"button\"\n [id]=\"id\"\n [disabled]=\"disabled\"\n [attr.aria-invalid]=\"invalid\"\n [attr.aria-expanded]=\"open\"\n [attr.data-state]=\"open ? 'open' : 'closed'\"\n aria-haspopup=\"listbox\"\n (click)=\"toggle()\"\n [ngClass]=\"[\n 'border-input focus-visible:border-ring focus-visible:ring-2 focus-visible:ring-ring/50 aria-invalid:ring-2 aria-invalid:ring-destructive aria-invalid:border-destructive flex h-9 w-full appearance-none items-center justify-between rounded-md border bg-background px-3 py-2 text-sm shadow-sm outline-none disabled:cursor-not-allowed disabled:opacity-50',\n ]\"\n >\n <span\n [ngClass]=\"[\n 'min-w-0 flex-1 truncate text-left leading-5',\n selectedOption\n ? 'font-medium text-foreground'\n : 'font-normal text-muted-foreground',\n ]\"\n >\n {{ selectedLabel }}\n </span>\n <pdm-icon\n name=\"chevron-down\"\n [size]=\"16\"\n className=\"shrink-0 text-muted-foreground\"\n ></pdm-icon>\n </button>\n\n <div\n *ngIf=\"open\"\n #panelEl\n role=\"listbox\"\n [attr.aria-labelledby]=\"id || null\"\n [ngClass]=\"panelClasses\"\n [style.max-height.px]=\"panelMaxHeightPx\"\n >\n <button\n *ngFor=\"let option of options\"\n type=\"button\"\n role=\"option\"\n [attr.aria-selected]=\"option.value === value\"\n [disabled]=\"option.disabled\"\n (click)=\"selectOption(option)\"\n [ngClass]=\"[\n 'flex w-full appearance-none items-center justify-between rounded-sm border-0 bg-transparent px-2 py-1.5 text-left text-sm outline-none transition-colors',\n option.disabled\n ? 'cursor-not-allowed opacity-50'\n : 'hover:bg-accent hover:text-accent-foreground focus-visible:bg-accent focus-visible:text-accent-foreground',\n option.value === value ? 'text-foreground' : '',\n ]\"\n >\n <span class=\"min-w-0 flex-1 truncate leading-5\">{{ option.label }}</span>\n <span\n *ngIf=\"option.value === value\"\n class=\"ml-2 flex shrink-0 items-center justify-end\"\n >\n <pdm-icon\n name=\"check\"\n [size]=\"16\"\n className=\"shrink-0 text-current\"\n ></pdm-icon>\n </span>\n </button>\n </div>\n\n <select\n class=\"sr-only\"\n tabindex=\"-1\"\n aria-hidden=\"true\"\n [value]=\"value\"\n (change)=\"onChange($event)\"\n >\n <option\n *ngFor=\"let option of options\"\n [value]=\"option.value\"\n [disabled]=\"option.disabled\"\n >\n {{ option.label }}\n </option>\n </select>\n</div>\n", dependencies: [{ kind: "directive", type: i1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "component", type: PdmIconComponent, selector: "pdm-icon", inputs: ["name", "library", "assetUrl", "size", "strokeWidth", "className", "ariaLabel", "decorative"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
3188
3277
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: PdmSelectComponent, decorators: [{
|
|
3189
3278
|
type: Component,
|
|
3190
|
-
args: [{ selector: 'pdm-select', changeDetection: ChangeDetectionStrategy.OnPush, template: "<div [ngClass]=\"['relative', className || 'w-full']\">\n <button\n type=\"button\"\n [id]=\"id\"\n [disabled]=\"disabled\"\n [attr.aria-invalid]=\"invalid\"\n [attr.aria-expanded]=\"open\"\n [attr.data-state]=\"open ? 'open' : 'closed'\"\n aria-haspopup=\"listbox\"\n (click)=\"toggle()\"\n [ngClass]=\"[\n 'border-input focus-visible:border-ring focus-visible:ring-2 focus-visible:ring-ring/50 aria-invalid:ring-2 aria-invalid:ring-destructive aria-invalid:border-destructive flex h-9 w-full appearance-none items-center justify-between rounded-md border bg-background px-3 py-2 text-sm shadow-sm outline-none disabled:cursor-not-allowed disabled:opacity-50',\n ]\"\n >\n <span\n [ngClass]=\"[\n 'min-w-0 flex-1 truncate text-left leading-5',\n selectedOption\n ? 'font-medium text-foreground'\n : 'font-normal text-muted-foreground',\n ]\"\n >\n {{ selectedLabel }}\n </span>\n <pdm-icon\n name=\"chevron-down\"\n [size]=\"16\"\n className=\"shrink-0 text-muted-foreground\"\n ></pdm-icon>\n </button>\n\n <div\n *ngIf=\"open\"\n role=\"listbox\"\n [attr.aria-labelledby]=\"id || null\"\n
|
|
3191
|
-
}], ctorParameters: function () { return [{ type: i0.ElementRef }]; }, propDecorators: { id: [{
|
|
3279
|
+
args: [{ selector: 'pdm-select', changeDetection: ChangeDetectionStrategy.OnPush, template: "<div [ngClass]=\"['relative', className || 'w-full']\">\n <button\n #triggerEl\n type=\"button\"\n [id]=\"id\"\n [disabled]=\"disabled\"\n [attr.aria-invalid]=\"invalid\"\n [attr.aria-expanded]=\"open\"\n [attr.data-state]=\"open ? 'open' : 'closed'\"\n aria-haspopup=\"listbox\"\n (click)=\"toggle()\"\n [ngClass]=\"[\n 'border-input focus-visible:border-ring focus-visible:ring-2 focus-visible:ring-ring/50 aria-invalid:ring-2 aria-invalid:ring-destructive aria-invalid:border-destructive flex h-9 w-full appearance-none items-center justify-between rounded-md border bg-background px-3 py-2 text-sm shadow-sm outline-none disabled:cursor-not-allowed disabled:opacity-50',\n ]\"\n >\n <span\n [ngClass]=\"[\n 'min-w-0 flex-1 truncate text-left leading-5',\n selectedOption\n ? 'font-medium text-foreground'\n : 'font-normal text-muted-foreground',\n ]\"\n >\n {{ selectedLabel }}\n </span>\n <pdm-icon\n name=\"chevron-down\"\n [size]=\"16\"\n className=\"shrink-0 text-muted-foreground\"\n ></pdm-icon>\n </button>\n\n <div\n *ngIf=\"open\"\n #panelEl\n role=\"listbox\"\n [attr.aria-labelledby]=\"id || null\"\n [ngClass]=\"panelClasses\"\n [style.max-height.px]=\"panelMaxHeightPx\"\n >\n <button\n *ngFor=\"let option of options\"\n type=\"button\"\n role=\"option\"\n [attr.aria-selected]=\"option.value === value\"\n [disabled]=\"option.disabled\"\n (click)=\"selectOption(option)\"\n [ngClass]=\"[\n 'flex w-full appearance-none items-center justify-between rounded-sm border-0 bg-transparent px-2 py-1.5 text-left text-sm outline-none transition-colors',\n option.disabled\n ? 'cursor-not-allowed opacity-50'\n : 'hover:bg-accent hover:text-accent-foreground focus-visible:bg-accent focus-visible:text-accent-foreground',\n option.value === value ? 'text-foreground' : '',\n ]\"\n >\n <span class=\"min-w-0 flex-1 truncate leading-5\">{{ option.label }}</span>\n <span\n *ngIf=\"option.value === value\"\n class=\"ml-2 flex shrink-0 items-center justify-end\"\n >\n <pdm-icon\n name=\"check\"\n [size]=\"16\"\n className=\"shrink-0 text-current\"\n ></pdm-icon>\n </span>\n </button>\n </div>\n\n <select\n class=\"sr-only\"\n tabindex=\"-1\"\n aria-hidden=\"true\"\n [value]=\"value\"\n (change)=\"onChange($event)\"\n >\n <option\n *ngFor=\"let option of options\"\n [value]=\"option.value\"\n [disabled]=\"option.disabled\"\n >\n {{ option.label }}\n </option>\n </select>\n</div>\n" }]
|
|
3280
|
+
}], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: i0.ChangeDetectorRef }]; }, propDecorators: { id: [{
|
|
3192
3281
|
type: Input
|
|
3193
3282
|
}], value: [{
|
|
3194
3283
|
type: Input
|
|
@@ -3204,12 +3293,24 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.3.0", ngImpor
|
|
|
3204
3293
|
type: Input
|
|
3205
3294
|
}], valueChange: [{
|
|
3206
3295
|
type: Output
|
|
3296
|
+
}], triggerRef: [{
|
|
3297
|
+
type: ViewChild,
|
|
3298
|
+
args: ['triggerEl']
|
|
3299
|
+
}], panelRef: [{
|
|
3300
|
+
type: ViewChild,
|
|
3301
|
+
args: ['panelEl']
|
|
3207
3302
|
}], onDocumentClick: [{
|
|
3208
3303
|
type: HostListener,
|
|
3209
3304
|
args: ['document:click', ['$event']]
|
|
3210
3305
|
}], onEscape: [{
|
|
3211
3306
|
type: HostListener,
|
|
3212
3307
|
args: ['document:keydown.escape']
|
|
3308
|
+
}], onViewportChange: [{
|
|
3309
|
+
type: HostListener,
|
|
3310
|
+
args: ['window:resize']
|
|
3311
|
+
}, {
|
|
3312
|
+
type: HostListener,
|
|
3313
|
+
args: ['window:scroll']
|
|
3213
3314
|
}] } });
|
|
3214
3315
|
|
|
3215
3316
|
class PdmPaginationComponent {
|
|
@@ -3280,14 +3381,37 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.3.0", ngImpor
|
|
|
3280
3381
|
}] } });
|
|
3281
3382
|
|
|
3282
3383
|
class PdmPopoverComponent {
|
|
3283
|
-
constructor(elementRef) {
|
|
3384
|
+
constructor(elementRef, cdr) {
|
|
3284
3385
|
this.elementRef = elementRef;
|
|
3285
|
-
this.
|
|
3386
|
+
this.cdr = cdr;
|
|
3387
|
+
this._open = false;
|
|
3286
3388
|
this.triggerText = 'Open';
|
|
3287
3389
|
this.className = '';
|
|
3288
3390
|
this.panelClassName = '';
|
|
3289
3391
|
this.showTrigger = true;
|
|
3290
3392
|
this.openChange = new EventEmitter();
|
|
3393
|
+
this.panelPlacement = 'bottom';
|
|
3394
|
+
}
|
|
3395
|
+
set open(value) {
|
|
3396
|
+
this._open = !!value;
|
|
3397
|
+
if (this._open) {
|
|
3398
|
+
this.schedulePanelPlacementUpdate();
|
|
3399
|
+
}
|
|
3400
|
+
else {
|
|
3401
|
+
this.panelPlacement = 'bottom';
|
|
3402
|
+
}
|
|
3403
|
+
this.cdr.markForCheck();
|
|
3404
|
+
}
|
|
3405
|
+
get open() {
|
|
3406
|
+
return this._open;
|
|
3407
|
+
}
|
|
3408
|
+
get panelClasses() {
|
|
3409
|
+
return [
|
|
3410
|
+
this.panelPlacement === 'top'
|
|
3411
|
+
? 'absolute bottom-full left-0 z-30 mb-2 min-w-80 rounded-md border border-border bg-popover p-4 text-popover-foreground shadow-md'
|
|
3412
|
+
: 'absolute left-0 top-full z-30 mt-2 min-w-80 rounded-md border border-border bg-popover p-4 text-popover-foreground shadow-md',
|
|
3413
|
+
this.panelClassName
|
|
3414
|
+
];
|
|
3291
3415
|
}
|
|
3292
3416
|
toggle() {
|
|
3293
3417
|
this.open = !this.open;
|
|
@@ -3308,15 +3432,39 @@ class PdmPopoverComponent {
|
|
|
3308
3432
|
this.openChange.emit(false);
|
|
3309
3433
|
}
|
|
3310
3434
|
}
|
|
3435
|
+
onViewportChange() {
|
|
3436
|
+
this.updatePanelPlacement();
|
|
3437
|
+
}
|
|
3438
|
+
schedulePanelPlacementUpdate() {
|
|
3439
|
+
setTimeout(() => this.updatePanelPlacement());
|
|
3440
|
+
}
|
|
3441
|
+
updatePanelPlacement() {
|
|
3442
|
+
if (!this.open)
|
|
3443
|
+
return;
|
|
3444
|
+
const anchorEl = this.triggerRef?.nativeElement || this.anchorRef?.nativeElement;
|
|
3445
|
+
const panelEl = this.panelRef?.nativeElement;
|
|
3446
|
+
if (!anchorEl || !panelEl || typeof window === 'undefined') {
|
|
3447
|
+
return;
|
|
3448
|
+
}
|
|
3449
|
+
const viewportHeight = window.innerHeight;
|
|
3450
|
+
const gap = 8;
|
|
3451
|
+
const anchorRect = anchorEl.getBoundingClientRect();
|
|
3452
|
+
const panelHeight = panelEl.offsetHeight;
|
|
3453
|
+
const spaceBelow = Math.max(0, viewportHeight - anchorRect.bottom - gap);
|
|
3454
|
+
const spaceAbove = Math.max(0, anchorRect.top - gap);
|
|
3455
|
+
const nextPlacement = spaceBelow < panelHeight && spaceAbove > spaceBelow ? 'top' : 'bottom';
|
|
3456
|
+
if (this.panelPlacement !== nextPlacement) {
|
|
3457
|
+
this.panelPlacement = nextPlacement;
|
|
3458
|
+
this.cdr.markForCheck();
|
|
3459
|
+
}
|
|
3460
|
+
}
|
|
3311
3461
|
}
|
|
3312
|
-
PdmPopoverComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: PdmPopoverComponent, deps: [{ token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Component });
|
|
3313
|
-
PdmPopoverComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.3.0", type: PdmPopoverComponent, selector: "pdm-popover", inputs: {
|
|
3462
|
+
PdmPopoverComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: PdmPopoverComponent, deps: [{ token: i0.ElementRef }, { token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Component });
|
|
3463
|
+
PdmPopoverComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.3.0", type: PdmPopoverComponent, selector: "pdm-popover", inputs: { triggerText: "triggerText", className: "className", panelClassName: "panelClassName", showTrigger: "showTrigger", open: "open" }, outputs: { openChange: "openChange" }, host: { listeners: { "document:keydown.escape": "onEsc()", "document:click": "onDocumentClick($event)", "window:resize": "onViewportChange()", "window:scroll": "onViewportChange()" } }, viewQueries: [{ propertyName: "anchorRef", first: true, predicate: ["anchorEl"], descendants: true }, { propertyName: "triggerRef", first: true, predicate: ["triggerEl"], descendants: true }, { propertyName: "panelRef", first: true, predicate: ["panelEl"], descendants: true }], ngImport: i0, template: "<div #anchorEl class=\"relative inline-block\" [ngClass]=\"className\">\n <button #triggerEl *ngIf=\"showTrigger\" type=\"button\" class=\"inline-flex h-9 appearance-none items-center justify-center rounded-md border border-input bg-background px-3 text-sm font-medium text-foreground shadow-sm\" [attr.aria-expanded]=\"open\" (click)=\"toggle()\">{{ triggerText }}</button>\n <div #panelEl *ngIf=\"open || !showTrigger\" [ngClass]=\"panelClasses\">\n <ng-content></ng-content>\n </div>\n</div>\n", dependencies: [{ kind: "directive", type: i1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
3314
3464
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: PdmPopoverComponent, decorators: [{
|
|
3315
3465
|
type: Component,
|
|
3316
|
-
args: [{ selector: 'pdm-popover', changeDetection: ChangeDetectionStrategy.OnPush, template: "<div class=\"relative inline-block\" [ngClass]=\"className\">\n <button *ngIf=\"showTrigger\" type=\"button\" class=\"inline-flex h-9 appearance-none items-center justify-center rounded-md border border-input bg-background px-3 text-sm font-medium text-foreground shadow-sm\" [attr.aria-expanded]=\"open\" (click)=\"toggle()\">{{ triggerText }}</button>\n <div *ngIf=\"open || !showTrigger\" [ngClass]=\"
|
|
3317
|
-
}], ctorParameters: function () { return [{ type: i0.ElementRef }]; }, propDecorators: {
|
|
3318
|
-
type: Input
|
|
3319
|
-
}], triggerText: [{
|
|
3466
|
+
args: [{ selector: 'pdm-popover', changeDetection: ChangeDetectionStrategy.OnPush, template: "<div #anchorEl class=\"relative inline-block\" [ngClass]=\"className\">\n <button #triggerEl *ngIf=\"showTrigger\" type=\"button\" class=\"inline-flex h-9 appearance-none items-center justify-center rounded-md border border-input bg-background px-3 text-sm font-medium text-foreground shadow-sm\" [attr.aria-expanded]=\"open\" (click)=\"toggle()\">{{ triggerText }}</button>\n <div #panelEl *ngIf=\"open || !showTrigger\" [ngClass]=\"panelClasses\">\n <ng-content></ng-content>\n </div>\n</div>\n" }]
|
|
3467
|
+
}], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: i0.ChangeDetectorRef }]; }, propDecorators: { triggerText: [{
|
|
3320
3468
|
type: Input
|
|
3321
3469
|
}], className: [{
|
|
3322
3470
|
type: Input
|
|
@@ -3326,12 +3474,29 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.3.0", ngImpor
|
|
|
3326
3474
|
type: Input
|
|
3327
3475
|
}], openChange: [{
|
|
3328
3476
|
type: Output
|
|
3477
|
+
}], anchorRef: [{
|
|
3478
|
+
type: ViewChild,
|
|
3479
|
+
args: ['anchorEl']
|
|
3480
|
+
}], triggerRef: [{
|
|
3481
|
+
type: ViewChild,
|
|
3482
|
+
args: ['triggerEl']
|
|
3483
|
+
}], panelRef: [{
|
|
3484
|
+
type: ViewChild,
|
|
3485
|
+
args: ['panelEl']
|
|
3486
|
+
}], open: [{
|
|
3487
|
+
type: Input
|
|
3329
3488
|
}], onEsc: [{
|
|
3330
3489
|
type: HostListener,
|
|
3331
3490
|
args: ['document:keydown.escape']
|
|
3332
3491
|
}], onDocumentClick: [{
|
|
3333
3492
|
type: HostListener,
|
|
3334
3493
|
args: ['document:click', ['$event']]
|
|
3494
|
+
}], onViewportChange: [{
|
|
3495
|
+
type: HostListener,
|
|
3496
|
+
args: ['window:resize']
|
|
3497
|
+
}, {
|
|
3498
|
+
type: HostListener,
|
|
3499
|
+
args: ['window:scroll']
|
|
3335
3500
|
}] } });
|
|
3336
3501
|
|
|
3337
3502
|
class PdmProgressComponent {
|