pdm-ui-kit 1.6.0 → 1.6.2
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/select/select.component.mjs +63 -11
- package/esm2020/src/select/select.component.mjs +63 -11
- package/fesm2015/pdm-ui-kit-src-select.mjs +62 -10
- package/fesm2015/pdm-ui-kit-src-select.mjs.map +1 -1
- package/fesm2015/pdm-ui-kit.mjs +62 -10
- package/fesm2015/pdm-ui-kit.mjs.map +1 -1
- package/fesm2020/pdm-ui-kit-src-select.mjs +62 -10
- package/fesm2020/pdm-ui-kit-src-select.mjs.map +1 -1
- package/fesm2020/pdm-ui-kit.mjs +62 -10
- package/fesm2020/pdm-ui-kit.mjs.map +1 -1
- package/package.json +1 -1
- package/select/select.component.d.ts +12 -3
- package/src/select/select.component.d.ts +12 -3
|
@@ -71,7 +71,6 @@ class PdmSelectComponent {
|
|
|
71
71
|
this.viewContainerRef = viewContainerRef;
|
|
72
72
|
this.id = "";
|
|
73
73
|
this.value = "";
|
|
74
|
-
this.options = [];
|
|
75
74
|
this.disabled = false;
|
|
76
75
|
this.invalid = false;
|
|
77
76
|
this.className = "";
|
|
@@ -80,12 +79,37 @@ class PdmSelectComponent {
|
|
|
80
79
|
this.valueChange = new EventEmitter();
|
|
81
80
|
this.overlayRef = null;
|
|
82
81
|
this.backdropSub = null;
|
|
82
|
+
this.projectedOptionsSub = null;
|
|
83
|
+
this.inputOptions = [];
|
|
84
|
+
this.projectedOptionCache = new WeakMap();
|
|
85
|
+
this.cachedProjectedOptions = [];
|
|
86
|
+
this.trackByOptionValue = (index, option) => {
|
|
87
|
+
return this.optionKey(option, index);
|
|
88
|
+
};
|
|
89
|
+
}
|
|
90
|
+
set options(value) {
|
|
91
|
+
this.inputOptions = value !== null && value !== void 0 ? value : [];
|
|
92
|
+
this.cdr.markForCheck();
|
|
93
|
+
}
|
|
94
|
+
get options() {
|
|
95
|
+
return this.inputOptions;
|
|
83
96
|
}
|
|
84
97
|
ngAfterContentInit() {
|
|
98
|
+
this.syncProjectedOptions();
|
|
85
99
|
// Re-render when projected options change (e.g. *ngFor on pdm-select-option).
|
|
86
|
-
this.projectedOptions.changes.subscribe(() =>
|
|
100
|
+
this.projectedOptionsSub = this.projectedOptions.changes.subscribe(() => {
|
|
101
|
+
this.syncProjectedOptions();
|
|
102
|
+
this.cdr.markForCheck();
|
|
103
|
+
});
|
|
104
|
+
}
|
|
105
|
+
ngDoCheck() {
|
|
106
|
+
this.syncProjectedOptions();
|
|
87
107
|
}
|
|
88
108
|
ngOnDestroy() {
|
|
109
|
+
if (this.projectedOptionsSub) {
|
|
110
|
+
this.projectedOptionsSub.unsubscribe();
|
|
111
|
+
this.projectedOptionsSub = null;
|
|
112
|
+
}
|
|
89
113
|
this.destroyOverlay();
|
|
90
114
|
}
|
|
91
115
|
/**
|
|
@@ -95,13 +119,9 @@ class PdmSelectComponent {
|
|
|
95
119
|
*/
|
|
96
120
|
get resolvedOptions() {
|
|
97
121
|
if (this.projectedOptions && this.projectedOptions.length > 0) {
|
|
98
|
-
return this.
|
|
99
|
-
label: d.resolvedLabel,
|
|
100
|
-
value: d.value,
|
|
101
|
-
disabled: d.disabled,
|
|
102
|
-
}));
|
|
122
|
+
return this.cachedProjectedOptions;
|
|
103
123
|
}
|
|
104
|
-
return this.
|
|
124
|
+
return this.inputOptions;
|
|
105
125
|
}
|
|
106
126
|
get selectedOption() {
|
|
107
127
|
return this.resolvedOptions.find((option) => option.value === this.value);
|
|
@@ -134,6 +154,38 @@ class PdmSelectComponent {
|
|
|
134
154
|
this.closePanel();
|
|
135
155
|
}
|
|
136
156
|
}
|
|
157
|
+
syncProjectedOptions() {
|
|
158
|
+
if (!this.projectedOptions || this.projectedOptions.length === 0) {
|
|
159
|
+
if (this.cachedProjectedOptions.length > 0) {
|
|
160
|
+
this.cachedProjectedOptions.length = 0;
|
|
161
|
+
}
|
|
162
|
+
return;
|
|
163
|
+
}
|
|
164
|
+
let index = 0;
|
|
165
|
+
this.projectedOptions.forEach((directive) => {
|
|
166
|
+
let option = this.projectedOptionCache.get(directive);
|
|
167
|
+
if (!option) {
|
|
168
|
+
option = {
|
|
169
|
+
label: directive.resolvedLabel,
|
|
170
|
+
value: directive.value,
|
|
171
|
+
disabled: directive.disabled,
|
|
172
|
+
};
|
|
173
|
+
this.projectedOptionCache.set(directive, option);
|
|
174
|
+
}
|
|
175
|
+
option.label = directive.resolvedLabel;
|
|
176
|
+
option.value = directive.value;
|
|
177
|
+
option.disabled = directive.disabled;
|
|
178
|
+
this.cachedProjectedOptions[index] = option;
|
|
179
|
+
index += 1;
|
|
180
|
+
});
|
|
181
|
+
if (this.cachedProjectedOptions.length !== index) {
|
|
182
|
+
this.cachedProjectedOptions.length = index;
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
optionKey(option, index) {
|
|
186
|
+
const value = option === null || option === void 0 ? void 0 : option.value;
|
|
187
|
+
return value == null ? `index:${index}` : `value:${String(value)}`;
|
|
188
|
+
}
|
|
137
189
|
openPanel() {
|
|
138
190
|
var _a;
|
|
139
191
|
if (this.overlayRef)
|
|
@@ -179,10 +231,10 @@ class PdmSelectComponent {
|
|
|
179
231
|
}
|
|
180
232
|
}
|
|
181
233
|
PdmSelectComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: PdmSelectComponent, deps: [{ token: i0.ChangeDetectorRef }, { token: i1.Overlay }, { token: i0.ViewContainerRef }], target: i0.ɵɵFactoryTarget.Component });
|
|
182
|
-
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", overlayOptions: "overlayOptions" }, outputs: { valueChange: "valueChange" }, host: { listeners: { "document:keydown.escape": "onEscape()" } }, queries: [{ propertyName: "projectedOptions", predicate: PdmSelectOptionDirective }], viewQueries: [{ propertyName: "triggerRef", first: true, predicate: ["triggerEl"], descendants: true }, { propertyName: "panelTemplateRef", first: true, predicate: ["panelTemplate"], 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 box-border items-center justify-between rounded-md border border-solid 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 <!-- Hidden native select kept for screen-reader / form fallback -->\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 resolvedOptions\"\n [value]=\"option.value\"\n [disabled]=\"option.disabled\"\n >\n {{ option.label }}\n </option>\n </select>\n\n <!-- Slot for content-projected pdm-select-option elements (hidden from layout) -->\n <span class=\"hidden\">\n <ng-content select=\"pdm-select-option\"></ng-content>\n </span>\n</div>\n\n<ng-template #panelTemplate>\n <div\n role=\"listbox\"\n [attr.aria-labelledby]=\"id || null\"\n class=\"w-full overflow-y-auto rounded-md border border-solid border-border bg-popover p-1 text-popover-foreground shadow-md max-h-96\"\n >\n <button\n *ngFor=\"let option of resolvedOptions\"\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 box-border 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</ng-template>\n", styles: [":host{display:block}\n"], dependencies: [{ kind: "directive", type: i2.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i2.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i2.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "component", type: i3.PdmIconComponent, selector: "pdm-icon", inputs: ["name", "library", "assetUrl", "size", "strokeWidth", "className", "ariaLabel", "decorative"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
234
|
+
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", overlayOptions: "overlayOptions" }, outputs: { valueChange: "valueChange" }, host: { listeners: { "document:keydown.escape": "onEscape()" } }, queries: [{ propertyName: "projectedOptions", predicate: PdmSelectOptionDirective }], viewQueries: [{ propertyName: "triggerRef", first: true, predicate: ["triggerEl"], descendants: true }, { propertyName: "panelTemplateRef", first: true, predicate: ["panelTemplate"], 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 box-border items-center justify-between rounded-md border border-solid 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 <!-- Hidden native select kept for screen-reader / form fallback -->\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 resolvedOptions; trackBy: trackByOptionValue\"\n [value]=\"option.value\"\n [disabled]=\"option.disabled\"\n >\n {{ option.label }}\n </option>\n </select>\n\n <!-- Slot for content-projected pdm-select-option elements (hidden from layout) -->\n <span class=\"hidden\">\n <ng-content select=\"pdm-select-option\"></ng-content>\n </span>\n</div>\n\n<ng-template #panelTemplate>\n <div\n role=\"listbox\"\n [attr.aria-labelledby]=\"id || null\"\n class=\"w-full overflow-y-auto rounded-md border border-solid border-border bg-popover p-1 text-popover-foreground shadow-md max-h-96\"\n >\n <button\n *ngFor=\"let option of resolvedOptions; trackBy: trackByOptionValue\"\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 box-border 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</ng-template>\n", styles: [":host{display:block}\n"], dependencies: [{ kind: "directive", type: i2.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i2.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i2.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "component", type: i3.PdmIconComponent, selector: "pdm-icon", inputs: ["name", "library", "assetUrl", "size", "strokeWidth", "className", "ariaLabel", "decorative"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
183
235
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: PdmSelectComponent, decorators: [{
|
|
184
236
|
type: Component,
|
|
185
|
-
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 box-border items-center justify-between rounded-md border border-solid 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 <!-- Hidden native select kept for screen-reader / form fallback -->\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 resolvedOptions\"\n [value]=\"option.value\"\n [disabled]=\"option.disabled\"\n >\n {{ option.label }}\n </option>\n </select>\n\n <!-- Slot for content-projected pdm-select-option elements (hidden from layout) -->\n <span class=\"hidden\">\n <ng-content select=\"pdm-select-option\"></ng-content>\n </span>\n</div>\n\n<ng-template #panelTemplate>\n <div\n role=\"listbox\"\n [attr.aria-labelledby]=\"id || null\"\n class=\"w-full overflow-y-auto rounded-md border border-solid border-border bg-popover p-1 text-popover-foreground shadow-md max-h-96\"\n >\n <button\n *ngFor=\"let option of resolvedOptions\"\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 box-border 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</ng-template>\n", styles: [":host{display:block}\n"] }]
|
|
237
|
+
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 box-border items-center justify-between rounded-md border border-solid 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 <!-- Hidden native select kept for screen-reader / form fallback -->\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 resolvedOptions; trackBy: trackByOptionValue\"\n [value]=\"option.value\"\n [disabled]=\"option.disabled\"\n >\n {{ option.label }}\n </option>\n </select>\n\n <!-- Slot for content-projected pdm-select-option elements (hidden from layout) -->\n <span class=\"hidden\">\n <ng-content select=\"pdm-select-option\"></ng-content>\n </span>\n</div>\n\n<ng-template #panelTemplate>\n <div\n role=\"listbox\"\n [attr.aria-labelledby]=\"id || null\"\n class=\"w-full overflow-y-auto rounded-md border border-solid border-border bg-popover p-1 text-popover-foreground shadow-md max-h-96\"\n >\n <button\n *ngFor=\"let option of resolvedOptions; trackBy: trackByOptionValue\"\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 box-border 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</ng-template>\n", styles: [":host{display:block}\n"] }]
|
|
186
238
|
}], ctorParameters: function () { return [{ type: i0.ChangeDetectorRef }, { type: i1.Overlay }, { type: i0.ViewContainerRef }]; }, propDecorators: { id: [{
|
|
187
239
|
type: Input
|
|
188
240
|
}], value: [{
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pdm-ui-kit-src-select.mjs","sources":["../../../src/select/select-option.directive.ts","../../../src/select/select.component.ts","../../../src/select/select.component.html","../../../src/select/select.module.ts","../../../src/select/pdm-ui-kit-src-select.ts"],"sourcesContent":["import {\n AfterContentInit,\n Directive,\n ElementRef,\n Input\n} from '@angular/core';\n\n/**\n * Directive used to declare an option inside `<pdm-select>` via content projection.\n *\n * Usage:\n * ```html\n * <pdm-select [(value)]=\"val\">\n * <pdm-select-option value=\"a\">Option A</pdm-select-option>\n * <pdm-select-option value=\"b\" [disabled]=\"true\">Option B</pdm-select-option>\n * <pdm-select-option value=\"c\" label=\"Option C\"></pdm-select-option>\n * </pdm-select>\n * ```\n *\n * When `label` is not provided, the text content of the projected node is used.\n */\n@Directive({\n selector: 'pdm-select-option'\n})\nexport class PdmSelectOptionDirective implements AfterContentInit {\n /** The option value that will be emitted on selection. */\n @Input() value = '';\n\n /** When true, the option is rendered but cannot be selected. */\n @Input() disabled = false;\n\n /**\n * Explicit label for the option.\n * When omitted, the directive reads the element's `textContent` after content init.\n */\n @Input() label = '';\n\n constructor(private readonly el: ElementRef<HTMLElement>) {}\n\n ngAfterContentInit(): void {\n // If no explicit label, harvest text from the projected node.\n if (!this.label) {\n this.label = (this.el.nativeElement.textContent ?? '').trim();\n }\n }\n\n /** Resolved label string — always non-empty after ngAfterContentInit. */\n get resolvedLabel(): string {\n return this.label || this.value;\n }\n}\n","import {\n\tAfterContentInit,\n\tChangeDetectionStrategy,\n\tChangeDetectorRef,\n\tComponent,\n\tContentChildren,\n\tElementRef,\n\tEventEmitter,\n\tHostListener,\n\tInput,\n\tOnDestroy,\n\tOutput,\n\tQueryList,\n\tViewChild,\n\tViewContainerRef,\n} from \"@angular/core\";\nimport { Overlay, OverlayRef } from \"@angular/cdk/overlay\";\nimport { TemplatePortal } from \"@angular/cdk/portal\";\nimport { Subscription } from \"rxjs\";\nimport { PdmSelectOptionDirective } from \"./select-option.directive\";\nimport { PdmOverlayOptions } from \"pdm-ui-kit/src/overlay\";\nimport { createFlexiblePositionStrategy } from \"pdm-ui-kit/src/overlay\";\nimport { Z_INDEX } from \"pdm-ui-kit/src/utils\";\n\nexport interface PdmSelectOption {\n\tlabel: string;\n\tvalue: string;\n\tdisabled?: boolean;\n}\n\n@Component({\n\tselector: \"pdm-select\",\n\ttemplateUrl: \"./select.component.html\",\n\tstyles: [\":host { display: block; }\"],\n\tchangeDetection: ChangeDetectionStrategy.OnPush,\n})\nexport class PdmSelectComponent implements AfterContentInit, OnDestroy {\n\t@Input() id = \"\";\n\t@Input() value = \"\";\n\t@Input() options: PdmSelectOption[] = [];\n\t@Input() disabled = false;\n\t@Input() invalid = false;\n\t@Input() className = \"\";\n\t@Input() placeholder = \"Select an option\";\n\t/**\n\t * Optional CDK OverlayConfig overrides.\n\t * Shallow-merged on top of component defaults — consumer always wins.\n\t * Providing `positionStrategy` or `scrollStrategy` replaces the component default entirely.\n\t */\n\t@Input() overlayOptions?: PdmOverlayOptions;\n\n\topen = false;\n\n\t@Output() valueChange = new EventEmitter<string>();\n\n\t@ViewChild(\"triggerEl\") private triggerRef?: ElementRef<HTMLElement>;\n\t@ViewChild(\"panelTemplate\") private panelTemplateRef!: any;\n\n\t/** Collects any `<pdm-select-option>` children projected into this component. */\n\t@ContentChildren(PdmSelectOptionDirective)\n\tprivate projectedOptions!: QueryList<PdmSelectOptionDirective>;\n\n\tprivate overlayRef: OverlayRef | null = null;\n\tprivate backdropSub: Subscription | null = null;\n\n\tconstructor(\n\t\tprivate readonly cdr: ChangeDetectorRef,\n\t\tprivate readonly overlay: Overlay,\n\t\tprivate readonly viewContainerRef: ViewContainerRef,\n\t) {}\n\n\tngAfterContentInit(): void {\n\t\t// Re-render when projected options change (e.g. *ngFor on pdm-select-option).\n\t\tthis.projectedOptions.changes.subscribe(() => this.cdr.markForCheck());\n\t}\n\n\tngOnDestroy(): void {\n\t\tthis.destroyOverlay();\n\t}\n\n\t/**\n\t * Returns the effective list of options.\n\t * Projected `<pdm-select-option>` children take priority over the `[options]` input.\n\t * Falls back to `[options]` when no children are projected.\n\t */\n\tget resolvedOptions(): PdmSelectOption[] {\n\t\tif (this.projectedOptions && this.projectedOptions.length > 0) {\n\t\t\treturn this.projectedOptions.map((d) => ({\n\t\t\t\tlabel: d.resolvedLabel,\n\t\t\t\tvalue: d.value,\n\t\t\t\tdisabled: d.disabled,\n\t\t\t}));\n\t\t}\n\t\treturn this.options;\n\t}\n\n\tget selectedOption(): PdmSelectOption | undefined {\n\t\treturn this.resolvedOptions.find((option) => option.value === this.value);\n\t}\n\n\tget selectedLabel(): string {\n\t\treturn this.selectedOption?.label || this.placeholder;\n\t}\n\n\ttoggle(): void {\n\t\tif (this.disabled) return;\n\t\tif (this.open) {\n\t\t\tthis.closePanel();\n\t\t} else {\n\t\t\tthis.openPanel();\n\t\t}\n\t}\n\n\tonChange(event: Event): void {\n\t\tthis.valueChange.emit((event.target as HTMLSelectElement).value);\n\t}\n\n\tselectOption(option: PdmSelectOption): void {\n\t\tif (option.disabled) return;\n\t\tthis.valueChange.emit(option.value);\n\t\tthis.closePanel();\n\t}\n\n\t@HostListener(\"document:keydown.escape\")\n\tonEscape(): void {\n\t\tif (this.open) {\n\t\t\tthis.closePanel();\n\t\t}\n\t}\n\n\tprivate openPanel(): void {\n\t\tif (this.overlayRef) return;\n\n\t\tconst triggerEl = this.triggerRef?.nativeElement;\n\t\tif (!triggerEl) return;\n\n\t\tthis.open = true;\n\t\tthis.cdr.markForCheck();\n\n\t\tconst positionStrategy = createFlexiblePositionStrategy(\n\t\t\tthis.overlay,\n\t\t\ttriggerEl,\n\t\t\t4,\n\t\t);\n\n\t\tthis.overlayRef = this.overlay.create({\n\t\t\t// CRÍTICO: z-[70] para aparecer SOBRE modals (z-[60])\n\t\t\t// panelClass se aplica al cdk-overlay-pane wrapper\n\t\t\tpanelClass: [Z_INDEX.popover],\n\t\t\tpositionStrategy,\n\t\t\tscrollStrategy: this.overlay.scrollStrategies.reposition(),\n\t\t\twidth: triggerEl.offsetWidth,\n\t\t\t// Consumer overrides are spread last — they win over every default above.\n\t\t\t...this.overlayOptions,\n\t\t});\n\n\t\tconst portal = new TemplatePortal(\n\t\t\tthis.panelTemplateRef,\n\t\t\tthis.viewContainerRef,\n\t\t);\n\t\tthis.overlayRef.attach(portal);\n\n\t\tthis.backdropSub = this.overlayRef\n\t\t\t.outsidePointerEvents()\n\t\t\t.subscribe((event) => {\n\t\t\t\tconst target = event.target as Node;\n\t\t\t\tif (!triggerEl.contains(target)) {\n\t\t\t\t\tthis.closePanel();\n\t\t\t\t}\n\t\t\t});\n\n\t\tthis.cdr.markForCheck();\n\t}\n\n\tprivate closePanel(): void {\n\t\tif (!this.overlayRef) return;\n\n\t\tthis.open = false;\n\t\tthis.destroyOverlay();\n\t\tthis.cdr.markForCheck();\n\t}\n\n\tprivate destroyOverlay(): void {\n\t\tif (this.backdropSub) {\n\t\t\tthis.backdropSub.unsubscribe();\n\t\t\tthis.backdropSub = null;\n\t\t}\n\t\tif (this.overlayRef) {\n\t\t\tthis.overlayRef.dispose();\n\t\t\tthis.overlayRef = null;\n\t\t}\n\t}\n}\n","<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 box-border items-center justify-between rounded-md border border-solid 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 <!-- Hidden native select kept for screen-reader / form fallback -->\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 resolvedOptions\"\n [value]=\"option.value\"\n [disabled]=\"option.disabled\"\n >\n {{ option.label }}\n </option>\n </select>\n\n <!-- Slot for content-projected pdm-select-option elements (hidden from layout) -->\n <span class=\"hidden\">\n <ng-content select=\"pdm-select-option\"></ng-content>\n </span>\n</div>\n\n<ng-template #panelTemplate>\n <div\n role=\"listbox\"\n [attr.aria-labelledby]=\"id || null\"\n class=\"w-full overflow-y-auto rounded-md border border-solid border-border bg-popover p-1 text-popover-foreground shadow-md max-h-96\"\n >\n <button\n *ngFor=\"let option of resolvedOptions\"\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 box-border 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</ng-template>\n","import { CommonModule } from \"@angular/common\";\nimport { NgModule } from \"@angular/core\";\nimport { OverlayModule } from \"@angular/cdk/overlay\";\nimport { PdmIconModule } from \"pdm-ui-kit/src/icon\";\nimport { PdmSelectComponent } from \"./select.component\";\nimport { PdmSelectOptionDirective } from \"./select-option.directive\";\n\nconst COMPONENTS = [PdmSelectComponent, PdmSelectOptionDirective];\n\n@NgModule({\n\timports: [CommonModule, OverlayModule, PdmIconModule],\n\tdeclarations: COMPONENTS,\n\texports: COMPONENTS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,YAAA,EAAA,CAAA,kBAAkB,EAAE,wBAAwB,CAGrD,EAAA,OAAA,EAAA,CAAA,YAAY,EAAE,aAAa,EAAE,aAAa,CAHjC,EAAA,OAAA,EAAA,CAAA,kBAAkB,EAAE,wBAAwB,CAAA,EAAA,CAAA,CAAA;AAOnD,eAAA,CAAA,IAAA,GAAA,EAAA,CAAA,mBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,QAAA,EAAA,QAAA,EAAA,EAAA,EAAA,IAAA,EAAA,eAAe,EAJjB,OAAA,EAAA,CAAA,YAAY,EAAE,aAAa,EAAE,aAAa,CAAA,EAAA,CAAA,CAAA;2FAIxC,eAAe,EAAA,UAAA,EAAA,CAAA;kBAL3B,QAAQ;AAAC,YAAA,IAAA,EAAA,CAAA;AACT,oBAAA,OAAO,EAAE,CAAC,YAAY,EAAE,aAAa,EAAE,aAAa,CAAC;AACrD,oBAAA,YAAY,EAAE,UAAU;AACxB,oBAAA,OAAO,EAAE,UAAU;iBACnB,CAAA;;;ACbD;;AAEG;;;;"}
|
|
1
|
+
{"version":3,"file":"pdm-ui-kit-src-select.mjs","sources":["../../../src/select/select-option.directive.ts","../../../src/select/select.component.ts","../../../src/select/select.component.html","../../../src/select/select.module.ts","../../../src/select/pdm-ui-kit-src-select.ts"],"sourcesContent":["import {\n AfterContentInit,\n Directive,\n ElementRef,\n Input\n} from '@angular/core';\n\n/**\n * Directive used to declare an option inside `<pdm-select>` via content projection.\n *\n * Usage:\n * ```html\n * <pdm-select [(value)]=\"val\">\n * <pdm-select-option value=\"a\">Option A</pdm-select-option>\n * <pdm-select-option value=\"b\" [disabled]=\"true\">Option B</pdm-select-option>\n * <pdm-select-option value=\"c\" label=\"Option C\"></pdm-select-option>\n * </pdm-select>\n * ```\n *\n * When `label` is not provided, the text content of the projected node is used.\n */\n@Directive({\n selector: 'pdm-select-option'\n})\nexport class PdmSelectOptionDirective implements AfterContentInit {\n /** The option value that will be emitted on selection. */\n @Input() value = '';\n\n /** When true, the option is rendered but cannot be selected. */\n @Input() disabled = false;\n\n /**\n * Explicit label for the option.\n * When omitted, the directive reads the element's `textContent` after content init.\n */\n @Input() label = '';\n\n constructor(private readonly el: ElementRef<HTMLElement>) {}\n\n ngAfterContentInit(): void {\n // If no explicit label, harvest text from the projected node.\n if (!this.label) {\n this.label = (this.el.nativeElement.textContent ?? '').trim();\n }\n }\n\n /** Resolved label string — always non-empty after ngAfterContentInit. */\n get resolvedLabel(): string {\n return this.label || this.value;\n }\n}\n","import {\n\tAfterContentInit,\n\tChangeDetectionStrategy,\n\tChangeDetectorRef,\n\tComponent,\n\tContentChildren,\n\tDoCheck,\n\tElementRef,\n\tEventEmitter,\n\tHostListener,\n\tInput,\n\tOnDestroy,\n\tOutput,\n\tQueryList,\n\tViewChild,\n\tViewContainerRef,\n} from \"@angular/core\";\nimport { Overlay, OverlayRef } from \"@angular/cdk/overlay\";\nimport { TemplatePortal } from \"@angular/cdk/portal\";\nimport { Subscription } from \"rxjs\";\nimport { PdmSelectOptionDirective } from \"./select-option.directive\";\nimport { PdmOverlayOptions } from \"pdm-ui-kit/src/overlay\";\nimport { createFlexiblePositionStrategy } from \"pdm-ui-kit/src/overlay\";\nimport { Z_INDEX } from \"pdm-ui-kit/src/utils\";\n\nexport interface PdmSelectOption {\n\tlabel: string;\n\tvalue: string;\n\tdisabled?: boolean;\n}\n\n@Component({\n\tselector: \"pdm-select\",\n\ttemplateUrl: \"./select.component.html\",\n\tstyles: [\":host { display: block; }\"],\n\tchangeDetection: ChangeDetectionStrategy.OnPush,\n})\nexport class PdmSelectComponent implements AfterContentInit, DoCheck, OnDestroy {\n\t@Input() id = \"\";\n\t@Input() value = \"\";\n\t@Input()\n\tset options(value: PdmSelectOption[] | null | undefined) {\n\t\tthis.inputOptions = value ?? [];\n\t\tthis.cdr.markForCheck();\n\t}\n\tget options(): PdmSelectOption[] {\n\t\treturn this.inputOptions;\n\t}\n\t@Input() disabled = false;\n\t@Input() invalid = false;\n\t@Input() className = \"\";\n\t@Input() placeholder = \"Select an option\";\n\t/**\n\t * Optional CDK OverlayConfig overrides.\n\t * Shallow-merged on top of component defaults — consumer always wins.\n\t * Providing `positionStrategy` or `scrollStrategy` replaces the component default entirely.\n\t */\n\t@Input() overlayOptions?: PdmOverlayOptions;\n\n\topen = false;\n\n\t@Output() valueChange = new EventEmitter<string>();\n\n\t@ViewChild(\"triggerEl\") private triggerRef?: ElementRef<HTMLElement>;\n\t@ViewChild(\"panelTemplate\") private panelTemplateRef!: any;\n\n\t/** Collects any `<pdm-select-option>` children projected into this component. */\n\t@ContentChildren(PdmSelectOptionDirective)\n\tprivate projectedOptions!: QueryList<PdmSelectOptionDirective>;\n\n\tprivate overlayRef: OverlayRef | null = null;\n\tprivate backdropSub: Subscription | null = null;\n\tprivate projectedOptionsSub: Subscription | null = null;\n\tprivate inputOptions: PdmSelectOption[] = [];\n\tprivate readonly projectedOptionCache = new WeakMap<\n\t\tPdmSelectOptionDirective,\n\t\tPdmSelectOption\n\t>();\n\tprivate readonly cachedProjectedOptions: PdmSelectOption[] = [];\n\n\tconstructor(\n\t\tprivate readonly cdr: ChangeDetectorRef,\n\t\tprivate readonly overlay: Overlay,\n\t\tprivate readonly viewContainerRef: ViewContainerRef,\n\t) {}\n\n\tngAfterContentInit(): void {\n\t\tthis.syncProjectedOptions();\n\t\t// Re-render when projected options change (e.g. *ngFor on pdm-select-option).\n\t\tthis.projectedOptionsSub = this.projectedOptions.changes.subscribe(() => {\n\t\t\tthis.syncProjectedOptions();\n\t\t\tthis.cdr.markForCheck();\n\t\t});\n\t}\n\n\tngDoCheck(): void {\n\t\tthis.syncProjectedOptions();\n\t}\n\n\tngOnDestroy(): void {\n\t\tif (this.projectedOptionsSub) {\n\t\t\tthis.projectedOptionsSub.unsubscribe();\n\t\t\tthis.projectedOptionsSub = null;\n\t\t}\n\t\tthis.destroyOverlay();\n\t}\n\n\t/**\n\t * Returns the effective list of options.\n\t * Projected `<pdm-select-option>` children take priority over the `[options]` input.\n\t * Falls back to `[options]` when no children are projected.\n\t */\n\tget resolvedOptions(): PdmSelectOption[] {\n\t\tif (this.projectedOptions && this.projectedOptions.length > 0) {\n\t\t\treturn this.cachedProjectedOptions;\n\t\t}\n\t\treturn this.inputOptions;\n\t}\n\n\tget selectedOption(): PdmSelectOption | undefined {\n\t\treturn this.resolvedOptions.find((option) => option.value === this.value);\n\t}\n\n\tget selectedLabel(): string {\n\t\treturn this.selectedOption?.label || this.placeholder;\n\t}\n\n\ttoggle(): void {\n\t\tif (this.disabled) return;\n\t\tif (this.open) {\n\t\t\tthis.closePanel();\n\t\t} else {\n\t\t\tthis.openPanel();\n\t\t}\n\t}\n\n\tonChange(event: Event): void {\n\t\tthis.valueChange.emit((event.target as HTMLSelectElement).value);\n\t}\n\n\tselectOption(option: PdmSelectOption): void {\n\t\tif (option.disabled) return;\n\t\tthis.valueChange.emit(option.value);\n\t\tthis.closePanel();\n\t}\n\n\ttrackByOptionValue = (index: number, option: PdmSelectOption): string => {\n\t\treturn this.optionKey(option, index);\n\t};\n\n\t@HostListener(\"document:keydown.escape\")\n\tonEscape(): void {\n\t\tif (this.open) {\n\t\t\tthis.closePanel();\n\t\t}\n\t}\n\n\tprivate syncProjectedOptions(): void {\n\t\tif (!this.projectedOptions || this.projectedOptions.length === 0) {\n\t\t\tif (this.cachedProjectedOptions.length > 0) {\n\t\t\t\tthis.cachedProjectedOptions.length = 0;\n\t\t\t}\n\t\t\treturn;\n\t\t}\n\n\t\tlet index = 0;\n\t\tthis.projectedOptions.forEach((directive) => {\n\t\t\tlet option = this.projectedOptionCache.get(directive);\n\t\t\tif (!option) {\n\t\t\t\toption = {\n\t\t\t\t\tlabel: directive.resolvedLabel,\n\t\t\t\t\tvalue: directive.value,\n\t\t\t\t\tdisabled: directive.disabled,\n\t\t\t\t};\n\t\t\t\tthis.projectedOptionCache.set(directive, option);\n\t\t\t}\n\n\t\t\toption.label = directive.resolvedLabel;\n\t\t\toption.value = directive.value;\n\t\t\toption.disabled = directive.disabled;\n\t\t\tthis.cachedProjectedOptions[index] = option;\n\t\t\tindex += 1;\n\t\t});\n\n\t\tif (this.cachedProjectedOptions.length !== index) {\n\t\t\tthis.cachedProjectedOptions.length = index;\n\t\t}\n\t}\n\n\tprivate optionKey(option: PdmSelectOption | null | undefined, index: number): string {\n\t\tconst value = option?.value;\n\t\treturn value == null ? `index:${index}` : `value:${String(value)}`;\n\t}\n\n\tprivate openPanel(): void {\n\t\tif (this.overlayRef) return;\n\n\t\tconst triggerEl = this.triggerRef?.nativeElement;\n\t\tif (!triggerEl) return;\n\n\t\tthis.open = true;\n\t\tthis.cdr.markForCheck();\n\n\t\tconst positionStrategy = createFlexiblePositionStrategy(\n\t\t\tthis.overlay,\n\t\t\ttriggerEl,\n\t\t\t4,\n\t\t);\n\n\t\tthis.overlayRef = this.overlay.create({\n\t\t\t// CRÍTICO: z-[70] para aparecer SOBRE modals (z-[60])\n\t\t\t// panelClass se aplica al cdk-overlay-pane wrapper\n\t\t\tpanelClass: [Z_INDEX.popover],\n\t\t\tpositionStrategy,\n\t\t\tscrollStrategy: this.overlay.scrollStrategies.reposition(),\n\t\t\twidth: triggerEl.offsetWidth,\n\t\t\t// Consumer overrides are spread last — they win over every default above.\n\t\t\t...this.overlayOptions,\n\t\t});\n\n\t\tconst portal = new TemplatePortal(\n\t\t\tthis.panelTemplateRef,\n\t\t\tthis.viewContainerRef,\n\t\t);\n\t\tthis.overlayRef.attach(portal);\n\n\t\tthis.backdropSub = this.overlayRef\n\t\t\t.outsidePointerEvents()\n\t\t\t.subscribe((event) => {\n\t\t\t\tconst target = event.target as Node;\n\t\t\t\tif (!triggerEl.contains(target)) {\n\t\t\t\t\tthis.closePanel();\n\t\t\t\t}\n\t\t\t});\n\n\t\tthis.cdr.markForCheck();\n\t}\n\n\tprivate closePanel(): void {\n\t\tif (!this.overlayRef) return;\n\n\t\tthis.open = false;\n\t\tthis.destroyOverlay();\n\t\tthis.cdr.markForCheck();\n\t}\n\n\tprivate destroyOverlay(): void {\n\t\tif (this.backdropSub) {\n\t\t\tthis.backdropSub.unsubscribe();\n\t\t\tthis.backdropSub = null;\n\t\t}\n\t\tif (this.overlayRef) {\n\t\t\tthis.overlayRef.dispose();\n\t\t\tthis.overlayRef = null;\n\t\t}\n\t}\n}\n","<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 box-border items-center justify-between rounded-md border border-solid 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 <!-- Hidden native select kept for screen-reader / form fallback -->\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 resolvedOptions; trackBy: trackByOptionValue\"\n [value]=\"option.value\"\n [disabled]=\"option.disabled\"\n >\n {{ option.label }}\n </option>\n </select>\n\n <!-- Slot for content-projected pdm-select-option elements (hidden from layout) -->\n <span class=\"hidden\">\n <ng-content select=\"pdm-select-option\"></ng-content>\n </span>\n</div>\n\n<ng-template #panelTemplate>\n <div\n role=\"listbox\"\n [attr.aria-labelledby]=\"id || null\"\n class=\"w-full overflow-y-auto rounded-md border border-solid border-border bg-popover p-1 text-popover-foreground shadow-md max-h-96\"\n >\n <button\n *ngFor=\"let option of resolvedOptions; trackBy: trackByOptionValue\"\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 box-border 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</ng-template>\n","import { CommonModule } from \"@angular/common\";\nimport { NgModule } from \"@angular/core\";\nimport { OverlayModule } from \"@angular/cdk/overlay\";\nimport { PdmIconModule } from \"pdm-ui-kit/src/icon\";\nimport { PdmSelectComponent } from \"./select.component\";\nimport { PdmSelectOptionDirective } from \"./select-option.directive\";\n\nconst COMPONENTS = [PdmSelectComponent, PdmSelectOptionDirective];\n\n@NgModule({\n\timports: [CommonModule, OverlayModule, PdmIconModule],\n\tdeclarations: COMPONENTS,\n\texports: COMPONENTS,\n})\nexport class PdmSelectModule {}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;;;;;;;;;;AAOA;;;;;;;;;;;;;AAaG;MAIU,wBAAwB,CAAA;AAanC,IAAA,WAAA,CAA6B,EAA2B,EAAA;AAA3B,QAAA,IAAE,CAAA,EAAA,GAAF,EAAE,CAAyB;;AAX/C,QAAA,IAAK,CAAA,KAAA,GA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;AAAC,YAAA,IAAA,EAAA,CAAA;AACT,oBAAA,OAAO,EAAE,CAAC,YAAY,EAAE,aAAa,EAAE,aAAa,CAAC;AACrD,oBAAA,YAAY,EAAE,UAAU;AACxB,oBAAA,OAAO,EAAE,UAAU;iBACnB,CAAA;;;ACbD;;AAEG;;;;"}
|
package/fesm2015/pdm-ui-kit.mjs
CHANGED
|
@@ -6158,7 +6158,6 @@ class PdmSelectComponent {
|
|
|
6158
6158
|
this.viewContainerRef = viewContainerRef;
|
|
6159
6159
|
this.id = "";
|
|
6160
6160
|
this.value = "";
|
|
6161
|
-
this.options = [];
|
|
6162
6161
|
this.disabled = false;
|
|
6163
6162
|
this.invalid = false;
|
|
6164
6163
|
this.className = "";
|
|
@@ -6167,12 +6166,37 @@ class PdmSelectComponent {
|
|
|
6167
6166
|
this.valueChange = new EventEmitter();
|
|
6168
6167
|
this.overlayRef = null;
|
|
6169
6168
|
this.backdropSub = null;
|
|
6169
|
+
this.projectedOptionsSub = null;
|
|
6170
|
+
this.inputOptions = [];
|
|
6171
|
+
this.projectedOptionCache = new WeakMap();
|
|
6172
|
+
this.cachedProjectedOptions = [];
|
|
6173
|
+
this.trackByOptionValue = (index, option) => {
|
|
6174
|
+
return this.optionKey(option, index);
|
|
6175
|
+
};
|
|
6176
|
+
}
|
|
6177
|
+
set options(value) {
|
|
6178
|
+
this.inputOptions = value !== null && value !== void 0 ? value : [];
|
|
6179
|
+
this.cdr.markForCheck();
|
|
6180
|
+
}
|
|
6181
|
+
get options() {
|
|
6182
|
+
return this.inputOptions;
|
|
6170
6183
|
}
|
|
6171
6184
|
ngAfterContentInit() {
|
|
6185
|
+
this.syncProjectedOptions();
|
|
6172
6186
|
// Re-render when projected options change (e.g. *ngFor on pdm-select-option).
|
|
6173
|
-
this.projectedOptions.changes.subscribe(() =>
|
|
6187
|
+
this.projectedOptionsSub = this.projectedOptions.changes.subscribe(() => {
|
|
6188
|
+
this.syncProjectedOptions();
|
|
6189
|
+
this.cdr.markForCheck();
|
|
6190
|
+
});
|
|
6191
|
+
}
|
|
6192
|
+
ngDoCheck() {
|
|
6193
|
+
this.syncProjectedOptions();
|
|
6174
6194
|
}
|
|
6175
6195
|
ngOnDestroy() {
|
|
6196
|
+
if (this.projectedOptionsSub) {
|
|
6197
|
+
this.projectedOptionsSub.unsubscribe();
|
|
6198
|
+
this.projectedOptionsSub = null;
|
|
6199
|
+
}
|
|
6176
6200
|
this.destroyOverlay();
|
|
6177
6201
|
}
|
|
6178
6202
|
/**
|
|
@@ -6182,13 +6206,9 @@ class PdmSelectComponent {
|
|
|
6182
6206
|
*/
|
|
6183
6207
|
get resolvedOptions() {
|
|
6184
6208
|
if (this.projectedOptions && this.projectedOptions.length > 0) {
|
|
6185
|
-
return this.
|
|
6186
|
-
label: d.resolvedLabel,
|
|
6187
|
-
value: d.value,
|
|
6188
|
-
disabled: d.disabled,
|
|
6189
|
-
}));
|
|
6209
|
+
return this.cachedProjectedOptions;
|
|
6190
6210
|
}
|
|
6191
|
-
return this.
|
|
6211
|
+
return this.inputOptions;
|
|
6192
6212
|
}
|
|
6193
6213
|
get selectedOption() {
|
|
6194
6214
|
return this.resolvedOptions.find((option) => option.value === this.value);
|
|
@@ -6221,6 +6241,38 @@ class PdmSelectComponent {
|
|
|
6221
6241
|
this.closePanel();
|
|
6222
6242
|
}
|
|
6223
6243
|
}
|
|
6244
|
+
syncProjectedOptions() {
|
|
6245
|
+
if (!this.projectedOptions || this.projectedOptions.length === 0) {
|
|
6246
|
+
if (this.cachedProjectedOptions.length > 0) {
|
|
6247
|
+
this.cachedProjectedOptions.length = 0;
|
|
6248
|
+
}
|
|
6249
|
+
return;
|
|
6250
|
+
}
|
|
6251
|
+
let index = 0;
|
|
6252
|
+
this.projectedOptions.forEach((directive) => {
|
|
6253
|
+
let option = this.projectedOptionCache.get(directive);
|
|
6254
|
+
if (!option) {
|
|
6255
|
+
option = {
|
|
6256
|
+
label: directive.resolvedLabel,
|
|
6257
|
+
value: directive.value,
|
|
6258
|
+
disabled: directive.disabled,
|
|
6259
|
+
};
|
|
6260
|
+
this.projectedOptionCache.set(directive, option);
|
|
6261
|
+
}
|
|
6262
|
+
option.label = directive.resolvedLabel;
|
|
6263
|
+
option.value = directive.value;
|
|
6264
|
+
option.disabled = directive.disabled;
|
|
6265
|
+
this.cachedProjectedOptions[index] = option;
|
|
6266
|
+
index += 1;
|
|
6267
|
+
});
|
|
6268
|
+
if (this.cachedProjectedOptions.length !== index) {
|
|
6269
|
+
this.cachedProjectedOptions.length = index;
|
|
6270
|
+
}
|
|
6271
|
+
}
|
|
6272
|
+
optionKey(option, index) {
|
|
6273
|
+
const value = option === null || option === void 0 ? void 0 : option.value;
|
|
6274
|
+
return value == null ? `index:${index}` : `value:${String(value)}`;
|
|
6275
|
+
}
|
|
6224
6276
|
openPanel() {
|
|
6225
6277
|
var _a;
|
|
6226
6278
|
if (this.overlayRef)
|
|
@@ -6266,10 +6318,10 @@ class PdmSelectComponent {
|
|
|
6266
6318
|
}
|
|
6267
6319
|
}
|
|
6268
6320
|
PdmSelectComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: PdmSelectComponent, deps: [{ token: i0.ChangeDetectorRef }, { token: i1$1.Overlay }, { token: i0.ViewContainerRef }], target: i0.ɵɵFactoryTarget.Component });
|
|
6269
|
-
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", overlayOptions: "overlayOptions" }, outputs: { valueChange: "valueChange" }, host: { listeners: { "document:keydown.escape": "onEscape()" } }, queries: [{ propertyName: "projectedOptions", predicate: PdmSelectOptionDirective }], viewQueries: [{ propertyName: "triggerRef", first: true, predicate: ["triggerEl"], descendants: true }, { propertyName: "panelTemplateRef", first: true, predicate: ["panelTemplate"], 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 box-border items-center justify-between rounded-md border border-solid 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 <!-- Hidden native select kept for screen-reader / form fallback -->\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 resolvedOptions\"\n [value]=\"option.value\"\n [disabled]=\"option.disabled\"\n >\n {{ option.label }}\n </option>\n </select>\n\n <!-- Slot for content-projected pdm-select-option elements (hidden from layout) -->\n <span class=\"hidden\">\n <ng-content select=\"pdm-select-option\"></ng-content>\n </span>\n</div>\n\n<ng-template #panelTemplate>\n <div\n role=\"listbox\"\n [attr.aria-labelledby]=\"id || null\"\n class=\"w-full overflow-y-auto rounded-md border border-solid border-border bg-popover p-1 text-popover-foreground shadow-md max-h-96\"\n >\n <button\n *ngFor=\"let option of resolvedOptions\"\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 box-border 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</ng-template>\n", styles: [":host{display:block}\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: i2$1.PdmIconComponent, selector: "pdm-icon", inputs: ["name", "library", "assetUrl", "size", "strokeWidth", "className", "ariaLabel", "decorative"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
6321
|
+
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", overlayOptions: "overlayOptions" }, outputs: { valueChange: "valueChange" }, host: { listeners: { "document:keydown.escape": "onEscape()" } }, queries: [{ propertyName: "projectedOptions", predicate: PdmSelectOptionDirective }], viewQueries: [{ propertyName: "triggerRef", first: true, predicate: ["triggerEl"], descendants: true }, { propertyName: "panelTemplateRef", first: true, predicate: ["panelTemplate"], 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 box-border items-center justify-between rounded-md border border-solid 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 <!-- Hidden native select kept for screen-reader / form fallback -->\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 resolvedOptions; trackBy: trackByOptionValue\"\n [value]=\"option.value\"\n [disabled]=\"option.disabled\"\n >\n {{ option.label }}\n </option>\n </select>\n\n <!-- Slot for content-projected pdm-select-option elements (hidden from layout) -->\n <span class=\"hidden\">\n <ng-content select=\"pdm-select-option\"></ng-content>\n </span>\n</div>\n\n<ng-template #panelTemplate>\n <div\n role=\"listbox\"\n [attr.aria-labelledby]=\"id || null\"\n class=\"w-full overflow-y-auto rounded-md border border-solid border-border bg-popover p-1 text-popover-foreground shadow-md max-h-96\"\n >\n <button\n *ngFor=\"let option of resolvedOptions; trackBy: trackByOptionValue\"\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 box-border 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</ng-template>\n", styles: [":host{display:block}\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: i2$1.PdmIconComponent, selector: "pdm-icon", inputs: ["name", "library", "assetUrl", "size", "strokeWidth", "className", "ariaLabel", "decorative"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
6270
6322
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: PdmSelectComponent, decorators: [{
|
|
6271
6323
|
type: Component,
|
|
6272
|
-
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 box-border items-center justify-between rounded-md border border-solid 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 <!-- Hidden native select kept for screen-reader / form fallback -->\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 resolvedOptions\"\n [value]=\"option.value\"\n [disabled]=\"option.disabled\"\n >\n {{ option.label }}\n </option>\n </select>\n\n <!-- Slot for content-projected pdm-select-option elements (hidden from layout) -->\n <span class=\"hidden\">\n <ng-content select=\"pdm-select-option\"></ng-content>\n </span>\n</div>\n\n<ng-template #panelTemplate>\n <div\n role=\"listbox\"\n [attr.aria-labelledby]=\"id || null\"\n class=\"w-full overflow-y-auto rounded-md border border-solid border-border bg-popover p-1 text-popover-foreground shadow-md max-h-96\"\n >\n <button\n *ngFor=\"let option of resolvedOptions\"\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 box-border 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</ng-template>\n", styles: [":host{display:block}\n"] }]
|
|
6324
|
+
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 box-border items-center justify-between rounded-md border border-solid 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 <!-- Hidden native select kept for screen-reader / form fallback -->\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 resolvedOptions; trackBy: trackByOptionValue\"\n [value]=\"option.value\"\n [disabled]=\"option.disabled\"\n >\n {{ option.label }}\n </option>\n </select>\n\n <!-- Slot for content-projected pdm-select-option elements (hidden from layout) -->\n <span class=\"hidden\">\n <ng-content select=\"pdm-select-option\"></ng-content>\n </span>\n</div>\n\n<ng-template #panelTemplate>\n <div\n role=\"listbox\"\n [attr.aria-labelledby]=\"id || null\"\n class=\"w-full overflow-y-auto rounded-md border border-solid border-border bg-popover p-1 text-popover-foreground shadow-md max-h-96\"\n >\n <button\n *ngFor=\"let option of resolvedOptions; trackBy: trackByOptionValue\"\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 box-border 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</ng-template>\n", styles: [":host{display:block}\n"] }]
|
|
6273
6325
|
}], ctorParameters: function () { return [{ type: i0.ChangeDetectorRef }, { type: i1$1.Overlay }, { type: i0.ViewContainerRef }]; }, propDecorators: { id: [{
|
|
6274
6326
|
type: Input
|
|
6275
6327
|
}], value: [{
|