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/fesm2015/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';
|
|
@@ -315,7 +315,6 @@ class PdmButtonGroupComponent {
|
|
|
315
315
|
'[&>pdm-button>button]:!rounded-none',
|
|
316
316
|
'[&>pdm-button:first-child>button]:!rounded-l-md',
|
|
317
317
|
'[&>pdm-button:last-child>button]:!rounded-r-md',
|
|
318
|
-
'[&>pdm-button:not(:first-child)>button]:!border-l-0',
|
|
319
318
|
'[&>pdm-input>div>input]:!rounded-none',
|
|
320
319
|
'[&>pdm-input:first-child>div>input]:!rounded-l-md',
|
|
321
320
|
'[&>pdm-input:last-child>div>input]:!rounded-r-md',
|
|
@@ -333,12 +332,10 @@ class PdmButtonGroupComponent {
|
|
|
333
332
|
'[&>pdm-tooltip>span>pdm-button>button]:!rounded-none',
|
|
334
333
|
'[&>pdm-tooltip:first-child>span>pdm-button>button]:!rounded-l-md',
|
|
335
334
|
'[&>pdm-tooltip:last-child>span>pdm-button>button]:!rounded-r-md',
|
|
336
|
-
'[&>pdm-tooltip:not(:first-child)>span>pdm-button>button]:!border-l-0',
|
|
337
335
|
'[&>pdm-tooltip>span>pdm-button>button]:shadow-none',
|
|
338
336
|
'[&>pdm-tooltip>span>button]:!rounded-none',
|
|
339
337
|
'[&>pdm-tooltip:first-child>span>button]:!rounded-l-md',
|
|
340
338
|
'[&>pdm-tooltip:last-child>span>button]:!rounded-r-md',
|
|
341
|
-
'[&>pdm-tooltip:not(:first-child)>span>button]:!border-l-0',
|
|
342
339
|
'[&>pdm-tooltip>span>button]:shadow-none',
|
|
343
340
|
'[&>pdm-tooltip>span>pdm-input>div>input]:!rounded-none',
|
|
344
341
|
'[&>pdm-tooltip:first-child>span>pdm-input>div>input]:!rounded-l-md',
|
|
@@ -398,7 +395,6 @@ class PdmButtonGroupComponent {
|
|
|
398
395
|
'[&>pdm-input>div>input]:bg-background',
|
|
399
396
|
'[&>pdm-input>div>input]:shadow-none',
|
|
400
397
|
'[&>pdm-button>button]:shadow-none',
|
|
401
|
-
'[&>pdm-button:not(:first-child)>button]:!border-t-0',
|
|
402
398
|
'[&>pdm-tooltip>span>*]:rounded-none',
|
|
403
399
|
'[&>pdm-tooltip:first-child>span>*]:rounded-t-md',
|
|
404
400
|
'[&>pdm-tooltip:last-child>span>*]:rounded-b-md',
|
|
@@ -406,12 +402,10 @@ class PdmButtonGroupComponent {
|
|
|
406
402
|
'[&>pdm-tooltip>span>pdm-button>button]:!rounded-none',
|
|
407
403
|
'[&>pdm-tooltip:first-child>span>pdm-button>button]:!rounded-t-md',
|
|
408
404
|
'[&>pdm-tooltip:last-child>span>pdm-button>button]:!rounded-b-md',
|
|
409
|
-
'[&>pdm-tooltip:not(:first-child)>span>pdm-button>button]:!border-t-0',
|
|
410
405
|
'[&>pdm-tooltip>span>pdm-button>button]:shadow-none',
|
|
411
406
|
'[&>pdm-tooltip>span>button]:!rounded-none',
|
|
412
407
|
'[&>pdm-tooltip:first-child>span>button]:!rounded-t-md',
|
|
413
408
|
'[&>pdm-tooltip:last-child>span>button]:!rounded-b-md',
|
|
414
|
-
'[&>pdm-tooltip:not(:first-child)>span>button]:!border-t-0',
|
|
415
409
|
'[&>pdm-tooltip>span>button]:shadow-none',
|
|
416
410
|
'[&>pdm-tooltip>span>pdm-input>div>input]:!rounded-none',
|
|
417
411
|
'[&>pdm-tooltip:first-child>span>pdm-input>div>input]:!rounded-t-md',
|
|
@@ -1972,6 +1966,7 @@ class PdmDatePickerComponent {
|
|
|
1972
1966
|
this._open = false;
|
|
1973
1967
|
this.instanceId = `pdm-date-picker-${++nextDatePickerId}`;
|
|
1974
1968
|
this.triggerFocused = false;
|
|
1969
|
+
this.panelPlacement = 'bottom';
|
|
1975
1970
|
this.id = '';
|
|
1976
1971
|
this.variant = 'single';
|
|
1977
1972
|
this.label = '';
|
|
@@ -2001,6 +1996,12 @@ class PdmDatePickerComponent {
|
|
|
2001
1996
|
}
|
|
2002
1997
|
set open(value) {
|
|
2003
1998
|
this._open = !!value;
|
|
1999
|
+
if (this._open) {
|
|
2000
|
+
this.schedulePanelPlacementUpdate();
|
|
2001
|
+
}
|
|
2002
|
+
else {
|
|
2003
|
+
this.panelPlacement = 'bottom';
|
|
2004
|
+
}
|
|
2004
2005
|
this.cdr.markForCheck();
|
|
2005
2006
|
}
|
|
2006
2007
|
get open() {
|
|
@@ -2084,7 +2085,9 @@ class PdmDatePickerComponent {
|
|
|
2084
2085
|
}
|
|
2085
2086
|
get panelClasses() {
|
|
2086
2087
|
return [
|
|
2087
|
-
|
|
2088
|
+
this.panelPlacement === 'top'
|
|
2089
|
+
? 'absolute bottom-full left-0 z-30 mb-2'
|
|
2090
|
+
: 'absolute left-0 top-full z-30 mt-2',
|
|
2088
2091
|
this.panelClassName
|
|
2089
2092
|
];
|
|
2090
2093
|
}
|
|
@@ -2149,14 +2152,48 @@ class PdmDatePickerComponent {
|
|
|
2149
2152
|
this.setOpen(false);
|
|
2150
2153
|
}
|
|
2151
2154
|
}
|
|
2155
|
+
onViewportChange() {
|
|
2156
|
+
this.updatePanelPlacement();
|
|
2157
|
+
}
|
|
2152
2158
|
setOpen(nextOpen) {
|
|
2153
2159
|
if (this._open === nextOpen) {
|
|
2154
2160
|
return;
|
|
2155
2161
|
}
|
|
2156
2162
|
this._open = nextOpen;
|
|
2157
2163
|
this.openChange.emit(this._open);
|
|
2164
|
+
if (this._open) {
|
|
2165
|
+
this.schedulePanelPlacementUpdate();
|
|
2166
|
+
}
|
|
2167
|
+
else {
|
|
2168
|
+
this.panelPlacement = 'bottom';
|
|
2169
|
+
}
|
|
2158
2170
|
this.cdr.markForCheck();
|
|
2159
2171
|
}
|
|
2172
|
+
schedulePanelPlacementUpdate() {
|
|
2173
|
+
setTimeout(() => this.updatePanelPlacement());
|
|
2174
|
+
}
|
|
2175
|
+
updatePanelPlacement() {
|
|
2176
|
+
var _a, _b;
|
|
2177
|
+
if (!this._open) {
|
|
2178
|
+
return;
|
|
2179
|
+
}
|
|
2180
|
+
const triggerEl = (_a = this.triggerRef) === null || _a === void 0 ? void 0 : _a.nativeElement;
|
|
2181
|
+
const panelEl = (_b = this.panelRef) === null || _b === void 0 ? void 0 : _b.nativeElement;
|
|
2182
|
+
if (!triggerEl || !panelEl || typeof window === 'undefined') {
|
|
2183
|
+
return;
|
|
2184
|
+
}
|
|
2185
|
+
const viewportHeight = window.innerHeight;
|
|
2186
|
+
const gap = 8;
|
|
2187
|
+
const triggerRect = triggerEl.getBoundingClientRect();
|
|
2188
|
+
const panelHeight = panelEl.offsetHeight;
|
|
2189
|
+
const spaceBelow = Math.max(0, viewportHeight - triggerRect.bottom - gap);
|
|
2190
|
+
const spaceAbove = Math.max(0, triggerRect.top - gap);
|
|
2191
|
+
const nextPlacement = spaceBelow < panelHeight && spaceAbove > spaceBelow ? 'top' : 'bottom';
|
|
2192
|
+
if (this.panelPlacement !== nextPlacement) {
|
|
2193
|
+
this.panelPlacement = nextPlacement;
|
|
2194
|
+
this.cdr.markForCheck();
|
|
2195
|
+
}
|
|
2196
|
+
}
|
|
2160
2197
|
formatDate(date) {
|
|
2161
2198
|
try {
|
|
2162
2199
|
return format(date, this.format || 'MMM d, yyyy');
|
|
@@ -2176,11 +2213,17 @@ class PdmDatePickerComponent {
|
|
|
2176
2213
|
}
|
|
2177
2214
|
}
|
|
2178
2215
|
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 });
|
|
2179
|
-
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 });
|
|
2216
|
+
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 });
|
|
2180
2217
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: PdmDatePickerComponent, decorators: [{
|
|
2181
2218
|
type: Component,
|
|
2182
|
-
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" }]
|
|
2183
|
-
}], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: i0.ChangeDetectorRef }]; }, propDecorators: {
|
|
2219
|
+
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" }]
|
|
2220
|
+
}], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: i0.ChangeDetectorRef }]; }, propDecorators: { triggerRef: [{
|
|
2221
|
+
type: ViewChild,
|
|
2222
|
+
args: ['triggerEl']
|
|
2223
|
+
}], panelRef: [{
|
|
2224
|
+
type: ViewChild,
|
|
2225
|
+
args: ['panelEl']
|
|
2226
|
+
}], id: [{
|
|
2184
2227
|
type: Input
|
|
2185
2228
|
}], variant: [{
|
|
2186
2229
|
type: Input
|
|
@@ -2244,6 +2287,12 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.3.0", ngImpor
|
|
|
2244
2287
|
}], onDocumentClick: [{
|
|
2245
2288
|
type: HostListener,
|
|
2246
2289
|
args: ['document:click', ['$event']]
|
|
2290
|
+
}], onViewportChange: [{
|
|
2291
|
+
type: HostListener,
|
|
2292
|
+
args: ['window:resize']
|
|
2293
|
+
}, {
|
|
2294
|
+
type: HostListener,
|
|
2295
|
+
args: ['window:scroll']
|
|
2247
2296
|
}] } });
|
|
2248
2297
|
|
|
2249
2298
|
class PdmDialogComponent {
|
|
@@ -3155,8 +3204,9 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.3.0", ngImpor
|
|
|
3155
3204
|
}] } });
|
|
3156
3205
|
|
|
3157
3206
|
class PdmSelectComponent {
|
|
3158
|
-
constructor(elementRef) {
|
|
3207
|
+
constructor(elementRef, cdr) {
|
|
3159
3208
|
this.elementRef = elementRef;
|
|
3209
|
+
this.cdr = cdr;
|
|
3160
3210
|
this.id = '';
|
|
3161
3211
|
this.value = '';
|
|
3162
3212
|
this.options = [];
|
|
@@ -3165,6 +3215,8 @@ class PdmSelectComponent {
|
|
|
3165
3215
|
this.className = '';
|
|
3166
3216
|
this.placeholder = 'Select an option';
|
|
3167
3217
|
this.open = false;
|
|
3218
|
+
this.panelPlacement = 'bottom';
|
|
3219
|
+
this.panelMaxHeightPx = null;
|
|
3168
3220
|
this.valueChange = new EventEmitter();
|
|
3169
3221
|
}
|
|
3170
3222
|
get selectedOption() {
|
|
@@ -3174,10 +3226,22 @@ class PdmSelectComponent {
|
|
|
3174
3226
|
var _a;
|
|
3175
3227
|
return ((_a = this.selectedOption) === null || _a === void 0 ? void 0 : _a.label) || this.placeholder;
|
|
3176
3228
|
}
|
|
3229
|
+
get panelClasses() {
|
|
3230
|
+
return [
|
|
3231
|
+
'absolute left-0 z-50 w-full overflow-y-auto rounded-md border border-border bg-popover p-1 text-popover-foreground shadow-md',
|
|
3232
|
+
this.panelPlacement === 'top' ? 'bottom-[calc(100%+4px)]' : 'top-[calc(100%+4px)]'
|
|
3233
|
+
];
|
|
3234
|
+
}
|
|
3177
3235
|
toggle() {
|
|
3178
3236
|
if (this.disabled)
|
|
3179
3237
|
return;
|
|
3180
3238
|
this.open = !this.open;
|
|
3239
|
+
if (this.open) {
|
|
3240
|
+
this.schedulePanelPlacementUpdate();
|
|
3241
|
+
return;
|
|
3242
|
+
}
|
|
3243
|
+
this.panelPlacement = 'bottom';
|
|
3244
|
+
this.panelMaxHeightPx = null;
|
|
3181
3245
|
}
|
|
3182
3246
|
onChange(event) {
|
|
3183
3247
|
this.valueChange.emit(event.target.value);
|
|
@@ -3198,13 +3262,40 @@ class PdmSelectComponent {
|
|
|
3198
3262
|
onEscape() {
|
|
3199
3263
|
this.open = false;
|
|
3200
3264
|
}
|
|
3265
|
+
onViewportChange() {
|
|
3266
|
+
this.updatePanelPlacement();
|
|
3267
|
+
}
|
|
3268
|
+
schedulePanelPlacementUpdate() {
|
|
3269
|
+
setTimeout(() => this.updatePanelPlacement());
|
|
3270
|
+
}
|
|
3271
|
+
updatePanelPlacement() {
|
|
3272
|
+
var _a, _b;
|
|
3273
|
+
if (!this.open)
|
|
3274
|
+
return;
|
|
3275
|
+
const triggerEl = (_a = this.triggerRef) === null || _a === void 0 ? void 0 : _a.nativeElement;
|
|
3276
|
+
const panelEl = (_b = this.panelRef) === null || _b === void 0 ? void 0 : _b.nativeElement;
|
|
3277
|
+
if (!triggerEl || !panelEl || typeof window === 'undefined') {
|
|
3278
|
+
return;
|
|
3279
|
+
}
|
|
3280
|
+
const viewportHeight = window.innerHeight;
|
|
3281
|
+
const gap = 4;
|
|
3282
|
+
const triggerRect = triggerEl.getBoundingClientRect();
|
|
3283
|
+
const panelHeight = panelEl.offsetHeight;
|
|
3284
|
+
const spaceBelow = Math.max(0, viewportHeight - triggerRect.bottom - gap);
|
|
3285
|
+
const spaceAbove = Math.max(0, triggerRect.top - gap);
|
|
3286
|
+
const nextPlacement = spaceBelow < panelHeight && spaceAbove > spaceBelow ? 'top' : 'bottom';
|
|
3287
|
+
const availableHeight = nextPlacement === 'top' ? spaceAbove : spaceBelow;
|
|
3288
|
+
this.panelPlacement = nextPlacement;
|
|
3289
|
+
this.panelMaxHeightPx = Math.max(120, Math.min(384, Math.floor(availableHeight)));
|
|
3290
|
+
this.cdr.markForCheck();
|
|
3291
|
+
}
|
|
3201
3292
|
}
|
|
3202
|
-
PdmSelectComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: PdmSelectComponent, deps: [{ token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Component });
|
|
3203
|
-
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
|
|
3293
|
+
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 });
|
|
3294
|
+
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 });
|
|
3204
3295
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: PdmSelectComponent, decorators: [{
|
|
3205
3296
|
type: Component,
|
|
3206
|
-
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
|
|
3207
|
-
}], ctorParameters: function () { return [{ type: i0.ElementRef }]; }, propDecorators: { id: [{
|
|
3297
|
+
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" }]
|
|
3298
|
+
}], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: i0.ChangeDetectorRef }]; }, propDecorators: { id: [{
|
|
3208
3299
|
type: Input
|
|
3209
3300
|
}], value: [{
|
|
3210
3301
|
type: Input
|
|
@@ -3220,12 +3311,24 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.3.0", ngImpor
|
|
|
3220
3311
|
type: Input
|
|
3221
3312
|
}], valueChange: [{
|
|
3222
3313
|
type: Output
|
|
3314
|
+
}], triggerRef: [{
|
|
3315
|
+
type: ViewChild,
|
|
3316
|
+
args: ['triggerEl']
|
|
3317
|
+
}], panelRef: [{
|
|
3318
|
+
type: ViewChild,
|
|
3319
|
+
args: ['panelEl']
|
|
3223
3320
|
}], onDocumentClick: [{
|
|
3224
3321
|
type: HostListener,
|
|
3225
3322
|
args: ['document:click', ['$event']]
|
|
3226
3323
|
}], onEscape: [{
|
|
3227
3324
|
type: HostListener,
|
|
3228
3325
|
args: ['document:keydown.escape']
|
|
3326
|
+
}], onViewportChange: [{
|
|
3327
|
+
type: HostListener,
|
|
3328
|
+
args: ['window:resize']
|
|
3329
|
+
}, {
|
|
3330
|
+
type: HostListener,
|
|
3331
|
+
args: ['window:scroll']
|
|
3229
3332
|
}] } });
|
|
3230
3333
|
|
|
3231
3334
|
class PdmPaginationComponent {
|
|
@@ -3296,14 +3399,37 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.3.0", ngImpor
|
|
|
3296
3399
|
}] } });
|
|
3297
3400
|
|
|
3298
3401
|
class PdmPopoverComponent {
|
|
3299
|
-
constructor(elementRef) {
|
|
3402
|
+
constructor(elementRef, cdr) {
|
|
3300
3403
|
this.elementRef = elementRef;
|
|
3301
|
-
this.
|
|
3404
|
+
this.cdr = cdr;
|
|
3405
|
+
this._open = false;
|
|
3302
3406
|
this.triggerText = 'Open';
|
|
3303
3407
|
this.className = '';
|
|
3304
3408
|
this.panelClassName = '';
|
|
3305
3409
|
this.showTrigger = true;
|
|
3306
3410
|
this.openChange = new EventEmitter();
|
|
3411
|
+
this.panelPlacement = 'bottom';
|
|
3412
|
+
}
|
|
3413
|
+
set open(value) {
|
|
3414
|
+
this._open = !!value;
|
|
3415
|
+
if (this._open) {
|
|
3416
|
+
this.schedulePanelPlacementUpdate();
|
|
3417
|
+
}
|
|
3418
|
+
else {
|
|
3419
|
+
this.panelPlacement = 'bottom';
|
|
3420
|
+
}
|
|
3421
|
+
this.cdr.markForCheck();
|
|
3422
|
+
}
|
|
3423
|
+
get open() {
|
|
3424
|
+
return this._open;
|
|
3425
|
+
}
|
|
3426
|
+
get panelClasses() {
|
|
3427
|
+
return [
|
|
3428
|
+
this.panelPlacement === 'top'
|
|
3429
|
+
? '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'
|
|
3430
|
+
: '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',
|
|
3431
|
+
this.panelClassName
|
|
3432
|
+
];
|
|
3307
3433
|
}
|
|
3308
3434
|
toggle() {
|
|
3309
3435
|
this.open = !this.open;
|
|
@@ -3324,15 +3450,40 @@ class PdmPopoverComponent {
|
|
|
3324
3450
|
this.openChange.emit(false);
|
|
3325
3451
|
}
|
|
3326
3452
|
}
|
|
3453
|
+
onViewportChange() {
|
|
3454
|
+
this.updatePanelPlacement();
|
|
3455
|
+
}
|
|
3456
|
+
schedulePanelPlacementUpdate() {
|
|
3457
|
+
setTimeout(() => this.updatePanelPlacement());
|
|
3458
|
+
}
|
|
3459
|
+
updatePanelPlacement() {
|
|
3460
|
+
var _a, _b, _c;
|
|
3461
|
+
if (!this.open)
|
|
3462
|
+
return;
|
|
3463
|
+
const anchorEl = ((_a = this.triggerRef) === null || _a === void 0 ? void 0 : _a.nativeElement) || ((_b = this.anchorRef) === null || _b === void 0 ? void 0 : _b.nativeElement);
|
|
3464
|
+
const panelEl = (_c = this.panelRef) === null || _c === void 0 ? void 0 : _c.nativeElement;
|
|
3465
|
+
if (!anchorEl || !panelEl || typeof window === 'undefined') {
|
|
3466
|
+
return;
|
|
3467
|
+
}
|
|
3468
|
+
const viewportHeight = window.innerHeight;
|
|
3469
|
+
const gap = 8;
|
|
3470
|
+
const anchorRect = anchorEl.getBoundingClientRect();
|
|
3471
|
+
const panelHeight = panelEl.offsetHeight;
|
|
3472
|
+
const spaceBelow = Math.max(0, viewportHeight - anchorRect.bottom - gap);
|
|
3473
|
+
const spaceAbove = Math.max(0, anchorRect.top - gap);
|
|
3474
|
+
const nextPlacement = spaceBelow < panelHeight && spaceAbove > spaceBelow ? 'top' : 'bottom';
|
|
3475
|
+
if (this.panelPlacement !== nextPlacement) {
|
|
3476
|
+
this.panelPlacement = nextPlacement;
|
|
3477
|
+
this.cdr.markForCheck();
|
|
3478
|
+
}
|
|
3479
|
+
}
|
|
3327
3480
|
}
|
|
3328
|
-
PdmPopoverComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: PdmPopoverComponent, deps: [{ token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Component });
|
|
3329
|
-
PdmPopoverComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.3.0", type: PdmPopoverComponent, selector: "pdm-popover", inputs: {
|
|
3481
|
+
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 });
|
|
3482
|
+
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 });
|
|
3330
3483
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: PdmPopoverComponent, decorators: [{
|
|
3331
3484
|
type: Component,
|
|
3332
|
-
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]=\"
|
|
3333
|
-
}], ctorParameters: function () { return [{ type: i0.ElementRef }]; }, propDecorators: {
|
|
3334
|
-
type: Input
|
|
3335
|
-
}], triggerText: [{
|
|
3485
|
+
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" }]
|
|
3486
|
+
}], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: i0.ChangeDetectorRef }]; }, propDecorators: { triggerText: [{
|
|
3336
3487
|
type: Input
|
|
3337
3488
|
}], className: [{
|
|
3338
3489
|
type: Input
|
|
@@ -3342,12 +3493,29 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.3.0", ngImpor
|
|
|
3342
3493
|
type: Input
|
|
3343
3494
|
}], openChange: [{
|
|
3344
3495
|
type: Output
|
|
3496
|
+
}], anchorRef: [{
|
|
3497
|
+
type: ViewChild,
|
|
3498
|
+
args: ['anchorEl']
|
|
3499
|
+
}], triggerRef: [{
|
|
3500
|
+
type: ViewChild,
|
|
3501
|
+
args: ['triggerEl']
|
|
3502
|
+
}], panelRef: [{
|
|
3503
|
+
type: ViewChild,
|
|
3504
|
+
args: ['panelEl']
|
|
3505
|
+
}], open: [{
|
|
3506
|
+
type: Input
|
|
3345
3507
|
}], onEsc: [{
|
|
3346
3508
|
type: HostListener,
|
|
3347
3509
|
args: ['document:keydown.escape']
|
|
3348
3510
|
}], onDocumentClick: [{
|
|
3349
3511
|
type: HostListener,
|
|
3350
3512
|
args: ['document:click', ['$event']]
|
|
3513
|
+
}], onViewportChange: [{
|
|
3514
|
+
type: HostListener,
|
|
3515
|
+
args: ['window:resize']
|
|
3516
|
+
}, {
|
|
3517
|
+
type: HostListener,
|
|
3518
|
+
args: ['window:scroll']
|
|
3351
3519
|
}] } });
|
|
3352
3520
|
|
|
3353
3521
|
class PdmProgressComponent {
|