quang 20.4.6 → 20.5.0
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/auth/index.d.ts +4 -5
- package/fesm2022/quang-auth.mjs +20 -20
- package/fesm2022/quang-auth.mjs.map +1 -1
- package/fesm2022/quang-components-autocomplete.mjs +4 -4
- package/fesm2022/quang-components-autocomplete.mjs.map +1 -1
- package/fesm2022/quang-components-checkbox.mjs +4 -4
- package/fesm2022/quang-components-checkbox.mjs.map +1 -1
- package/fesm2022/quang-components-date.mjs +5 -5
- package/fesm2022/quang-components-date.mjs.map +1 -1
- package/fesm2022/quang-components-input.mjs +4 -4
- package/fesm2022/quang-components-input.mjs.map +1 -1
- package/fesm2022/quang-components-paginator.mjs +14 -14
- package/fesm2022/quang-components-paginator.mjs.map +1 -1
- package/fesm2022/quang-components-select.mjs +4 -4
- package/fesm2022/quang-components-select.mjs.map +1 -1
- package/fesm2022/quang-components-shared.mjs +8 -8
- package/fesm2022/quang-components-shared.mjs.map +1 -1
- package/fesm2022/quang-components-table.mjs +4 -4
- package/fesm2022/quang-components-table.mjs.map +1 -1
- package/fesm2022/quang-components-wysiwyg.mjs +4 -4
- package/fesm2022/quang-components-wysiwyg.mjs.map +1 -1
- package/fesm2022/quang-device.mjs +3 -3
- package/fesm2022/quang-device.mjs.map +1 -1
- package/fesm2022/quang-loader.mjs +7 -7
- package/fesm2022/quang-loader.mjs.map +1 -1
- package/fesm2022/quang-overlay-modal.mjs +90 -12
- package/fesm2022/quang-overlay-modal.mjs.map +1 -1
- package/fesm2022/quang-overlay-popover.mjs +8 -8
- package/fesm2022/quang-overlay-popover.mjs.map +1 -1
- package/fesm2022/quang-overlay-shared.mjs +11 -11
- package/fesm2022/quang-overlay-shared.mjs.map +1 -1
- package/fesm2022/quang-overlay-toast.mjs +7 -7
- package/fesm2022/quang-overlay-toast.mjs.map +1 -1
- package/fesm2022/quang-overlay-tooltip.mjs +8 -8
- package/fesm2022/quang-overlay-tooltip.mjs.map +1 -1
- package/fesm2022/quang-translation.mjs +6 -6
- package/fesm2022/quang-translation.mjs.map +1 -1
- package/overlay/modal/index.d.ts +39 -5
- package/overlay/toast/index.d.ts +2 -3
- package/package.json +12 -12
|
@@ -4,7 +4,7 @@ import * as i2 from '@angular/cdk/portal';
|
|
|
4
4
|
import { PortalModule, CdkPortal } from '@angular/cdk/portal';
|
|
5
5
|
import { NgStyle } from '@angular/common';
|
|
6
6
|
import * as i0 from '@angular/core';
|
|
7
|
-
import { output, input, computed, inject, DestroyRef, ViewChild, ChangeDetectionStrategy, Component, EnvironmentInjector, ApplicationRef, signal, createComponent, Injectable } from '@angular/core';
|
|
7
|
+
import { output, input, computed, inject, DestroyRef, ViewChild, ChangeDetectionStrategy, Component, InjectionToken, EnvironmentInjector, ApplicationRef, signal, Injector, createComponent, Injectable } from '@angular/core';
|
|
8
8
|
import { takeUntilDestroyed } from '@angular/core/rxjs-interop';
|
|
9
9
|
import { Subject } from 'rxjs';
|
|
10
10
|
|
|
@@ -100,16 +100,43 @@ class QuangModalComponent {
|
|
|
100
100
|
this.overlayRef?.detach();
|
|
101
101
|
this.overlayRef?.dispose();
|
|
102
102
|
}
|
|
103
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.
|
|
104
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "20.3.
|
|
103
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.10", ngImport: i0, type: QuangModalComponent, deps: [{ token: i1.Overlay }], target: i0.ɵɵFactoryTarget.Component }); }
|
|
104
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "20.3.10", type: QuangModalComponent, isStandalone: true, selector: "quang-modal", inputs: { position: { classPropertyName: "position", publicName: "position", isSignal: true, isRequired: true, transformFunction: null }, height: { classPropertyName: "height", publicName: "height", isSignal: true, isRequired: false, transformFunction: null }, width: { classPropertyName: "width", publicName: "width", isSignal: true, isRequired: false, transformFunction: null }, padding: { classPropertyName: "padding", publicName: "padding", isSignal: true, isRequired: false, transformFunction: null }, containerClass: { classPropertyName: "containerClass", publicName: "containerClass", isSignal: true, isRequired: false, transformFunction: null }, animationMode: { classPropertyName: "animationMode", publicName: "animationMode", isSignal: true, isRequired: false, transformFunction: null }, backgroundColor: { classPropertyName: "backgroundColor", publicName: "backgroundColor", isSignal: true, isRequired: false, transformFunction: null }, showBackdrop: { classPropertyName: "showBackdrop", publicName: "showBackdrop", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { backdropClick: "backdropClick" }, viewQueries: [{ propertyName: "portal", first: true, predicate: CdkPortal, descendants: true }], ngImport: i0, template: "<ng-template cdkPortal>\n <div\n [ngStyle]=\"{\n '--quang-modal-panel-width': width(),\n '--quang-modal-panel-height': height(),\n '--quang-modal-panel-background': backgroundColor(),\n '--quang-modal-panel-padding': padding(),\n }\"\n class=\"dialog {{ containerClass() }} {{ animationClassEnter() }}\"\n >\n <div class=\"dialog__header\">\n <ng-content select=\"[header]\"></ng-content>\n </div>\n <div class=\"dialog__body\">\n <ng-content select=\"[body]\"></ng-content>\n </div>\n <div class=\"dialog__footer\">\n <ng-content select=\"[footer]\"></ng-content>\n </div>\n </div>\n</ng-template>\n", styles: [".dialog{background-color:var(--quang-modal-panel-background, var(--bs-body-bg, initial));position:relative;display:flex;flex-direction:column;width:var(--quang-modal-panel-width);height:var(--quang-modal-panel-height);padding:var(--quang-modal-panel-padding)}.dialog__header{display:flex;flex-direction:column;width:100%}.dialog__body{flex:1;overflow:auto}.dialog__footer{display:flex;justify-content:flex-end}::ng-deep .cdk-global-scrollblock{overflow-y:auto}@keyframes left-to-right_enter{0%{transform:translate(-100%)}to{transform:translate(0)}}.left-to-right-enter-active{animation:left-to-right_enter .5s ease-in-out forwards}@keyframes right-to-left_enter{0%{transform:translate(100%)}to{transform:translate(0)}}.right-to-left-enter-active{animation:right-to-left_enter .5s ease-in-out forwards}@keyframes top-to-bottom_enter{0%{transform:translateY(-100%)}to{transform:translateY(0)}}.top-to-bottom-enter-active{animation:top-to-bottom_enter .5s ease-in-out forwards}@keyframes bottom-to-top_enter{0%{transform:translateY(100%)}to{transform:translateY(0)}}.top-to-bottom-enter-active{animation:bottom-to-top_enter .5s ease-in-out forwards}@keyframes fade_enter{0%{opacity:0}to{opacity:1}}.fade-enter-active{animation:fade_enter .5s ease-in-out forwards}\n"], dependencies: [{ kind: "ngmodule", type: PortalModule }, { kind: "directive", type: i2.CdkPortal, selector: "[cdkPortal]", exportAs: ["cdkPortal"] }, { kind: "directive", type: NgStyle, selector: "[ngStyle]", inputs: ["ngStyle"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
105
105
|
}
|
|
106
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.
|
|
106
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.10", ngImport: i0, type: QuangModalComponent, decorators: [{
|
|
107
107
|
type: Component,
|
|
108
108
|
args: [{ selector: 'quang-modal', imports: [PortalModule, NgStyle], changeDetection: ChangeDetectionStrategy.OnPush, template: "<ng-template cdkPortal>\n <div\n [ngStyle]=\"{\n '--quang-modal-panel-width': width(),\n '--quang-modal-panel-height': height(),\n '--quang-modal-panel-background': backgroundColor(),\n '--quang-modal-panel-padding': padding(),\n }\"\n class=\"dialog {{ containerClass() }} {{ animationClassEnter() }}\"\n >\n <div class=\"dialog__header\">\n <ng-content select=\"[header]\"></ng-content>\n </div>\n <div class=\"dialog__body\">\n <ng-content select=\"[body]\"></ng-content>\n </div>\n <div class=\"dialog__footer\">\n <ng-content select=\"[footer]\"></ng-content>\n </div>\n </div>\n</ng-template>\n", styles: [".dialog{background-color:var(--quang-modal-panel-background, var(--bs-body-bg, initial));position:relative;display:flex;flex-direction:column;width:var(--quang-modal-panel-width);height:var(--quang-modal-panel-height);padding:var(--quang-modal-panel-padding)}.dialog__header{display:flex;flex-direction:column;width:100%}.dialog__body{flex:1;overflow:auto}.dialog__footer{display:flex;justify-content:flex-end}::ng-deep .cdk-global-scrollblock{overflow-y:auto}@keyframes left-to-right_enter{0%{transform:translate(-100%)}to{transform:translate(0)}}.left-to-right-enter-active{animation:left-to-right_enter .5s ease-in-out forwards}@keyframes right-to-left_enter{0%{transform:translate(100%)}to{transform:translate(0)}}.right-to-left-enter-active{animation:right-to-left_enter .5s ease-in-out forwards}@keyframes top-to-bottom_enter{0%{transform:translateY(-100%)}to{transform:translateY(0)}}.top-to-bottom-enter-active{animation:top-to-bottom_enter .5s ease-in-out forwards}@keyframes bottom-to-top_enter{0%{transform:translateY(100%)}to{transform:translateY(0)}}.top-to-bottom-enter-active{animation:bottom-to-top_enter .5s ease-in-out forwards}@keyframes fade_enter{0%{opacity:0}to{opacity:1}}.fade-enter-active{animation:fade_enter .5s ease-in-out forwards}\n"] }]
|
|
109
109
|
}], ctorParameters: () => [{ type: i1.Overlay }], propDecorators: { portal: [{
|
|
110
110
|
type: ViewChild,
|
|
111
111
|
args: [CdkPortal]
|
|
112
|
-
}] } });
|
|
112
|
+
}], backdropClick: [{ type: i0.Output, args: ["backdropClick"] }], position: [{ type: i0.Input, args: [{ isSignal: true, alias: "position", required: true }] }], height: [{ type: i0.Input, args: [{ isSignal: true, alias: "height", required: false }] }], width: [{ type: i0.Input, args: [{ isSignal: true, alias: "width", required: false }] }], padding: [{ type: i0.Input, args: [{ isSignal: true, alias: "padding", required: false }] }], containerClass: [{ type: i0.Input, args: [{ isSignal: true, alias: "containerClass", required: false }] }], animationMode: [{ type: i0.Input, args: [{ isSignal: true, alias: "animationMode", required: false }] }], backgroundColor: [{ type: i0.Input, args: [{ isSignal: true, alias: "backgroundColor", required: false }] }], showBackdrop: [{ type: i0.Input, args: [{ isSignal: true, alias: "showBackdrop", required: false }] }] } });
|
|
113
|
+
|
|
114
|
+
/**
|
|
115
|
+
* Injection token for the modal ID
|
|
116
|
+
*/
|
|
117
|
+
const MODAL_ID = new InjectionToken('MODAL_ID');
|
|
118
|
+
/**
|
|
119
|
+
* Helper class to manage modal closure from within the modal component
|
|
120
|
+
*/
|
|
121
|
+
class ModalRef {
|
|
122
|
+
constructor() {
|
|
123
|
+
this.modalService = inject(QuangModalService);
|
|
124
|
+
this.modalId = inject(MODAL_ID);
|
|
125
|
+
}
|
|
126
|
+
/**
|
|
127
|
+
* Close the modal with optional data
|
|
128
|
+
* @param data Optional data to pass when closing the modal (e.g., which button was clicked)
|
|
129
|
+
*/
|
|
130
|
+
close(data) {
|
|
131
|
+
this.modalService.close(this.modalId, data);
|
|
132
|
+
}
|
|
133
|
+
/**
|
|
134
|
+
* Get the current modal ID
|
|
135
|
+
*/
|
|
136
|
+
getId() {
|
|
137
|
+
return this.modalId;
|
|
138
|
+
}
|
|
139
|
+
}
|
|
113
140
|
|
|
114
141
|
class QuangModalService {
|
|
115
142
|
constructor() {
|
|
@@ -127,8 +154,19 @@ class QuangModalService {
|
|
|
127
154
|
}
|
|
128
155
|
showModal(component, options, componentInputs) {
|
|
129
156
|
const id = this.generateId();
|
|
130
|
-
// Create
|
|
157
|
+
// Create a Subject for this modal's close event
|
|
158
|
+
const closeSubject = new Subject();
|
|
159
|
+
// Create an injector that provides the modal ID and ModalRef
|
|
160
|
+
const modalInjector = Injector.create({
|
|
161
|
+
providers: [
|
|
162
|
+
{ provide: MODAL_ID, useValue: id },
|
|
163
|
+
{ provide: ModalRef, useClass: ModalRef },
|
|
164
|
+
],
|
|
165
|
+
parent: this.environmentInjector,
|
|
166
|
+
});
|
|
167
|
+
// Create the content component instance first with the modal injector
|
|
131
168
|
const contentRef = createComponent(component, {
|
|
169
|
+
elementInjector: modalInjector,
|
|
132
170
|
environmentInjector: this.environmentInjector,
|
|
133
171
|
});
|
|
134
172
|
// Set component inputs if provided
|
|
@@ -164,7 +202,7 @@ class QuangModalService {
|
|
|
164
202
|
modalRef.setInput('showBackdrop', options.showBackdrop);
|
|
165
203
|
// Subscribe to backdrop click to close modal
|
|
166
204
|
modalRef.instance.backdropClick.subscribe(() => {
|
|
167
|
-
this.
|
|
205
|
+
this.close(id);
|
|
168
206
|
});
|
|
169
207
|
// Attach components to the application
|
|
170
208
|
this.appRef.attachView(contentRef.hostView);
|
|
@@ -176,10 +214,34 @@ class QuangModalService {
|
|
|
176
214
|
id,
|
|
177
215
|
modalRef,
|
|
178
216
|
contentRef,
|
|
217
|
+
closeSubject,
|
|
179
218
|
};
|
|
180
219
|
this.modalInstances.update((instances) => [...instances, modalInstance]);
|
|
181
|
-
return id;
|
|
220
|
+
return { id, closeCallback: closeSubject.asObservable() };
|
|
221
|
+
}
|
|
222
|
+
/**
|
|
223
|
+
* Closes a modal by its ID and emits optional data.
|
|
224
|
+
* @param id The ID of the modal to close.
|
|
225
|
+
* @param data Optional data to emit on close.
|
|
226
|
+
*/
|
|
227
|
+
close(id, data) {
|
|
228
|
+
const instances = this.modalInstances();
|
|
229
|
+
const instance = instances.find((inst) => inst.id === id);
|
|
230
|
+
if (instance) {
|
|
231
|
+
// Emit the data through the subject before destroying
|
|
232
|
+
instance.closeSubject.next(data);
|
|
233
|
+
instance.closeSubject.complete();
|
|
234
|
+
// Remove the modal
|
|
235
|
+
this.hideModal(id);
|
|
236
|
+
}
|
|
237
|
+
else {
|
|
238
|
+
console.warn('[QuangModalService] Modal not found:', id);
|
|
239
|
+
}
|
|
182
240
|
}
|
|
241
|
+
/**
|
|
242
|
+
* Hides a modal by its ID.
|
|
243
|
+
* @param id The ID of the modal to hide. If not provided, hides the last opened modal.
|
|
244
|
+
*/
|
|
183
245
|
hideModal(id) {
|
|
184
246
|
if (id) {
|
|
185
247
|
// Find and remove modal by id
|
|
@@ -187,22 +249,38 @@ class QuangModalService {
|
|
|
187
249
|
const index = instances.findIndex((instance) => instance.id === id);
|
|
188
250
|
if (index !== -1) {
|
|
189
251
|
const modalToClose = instances[index];
|
|
252
|
+
// Complete the subject if not already completed
|
|
253
|
+
if (!modalToClose.closeSubject.closed) {
|
|
254
|
+
modalToClose.closeSubject.next(undefined);
|
|
255
|
+
modalToClose.closeSubject.complete();
|
|
256
|
+
}
|
|
190
257
|
this.destroyModalInstance(modalToClose);
|
|
191
258
|
this.modalInstances.update((instances) => instances.filter((_, i) => i !== index));
|
|
192
259
|
// Emit modal closed event
|
|
193
260
|
this.modalClosedSubject.next(id);
|
|
194
261
|
}
|
|
262
|
+
else {
|
|
263
|
+
console.warn('[QuangModalService] Modal not found in instances:', id);
|
|
264
|
+
}
|
|
195
265
|
}
|
|
196
266
|
else {
|
|
197
267
|
// Remove last modal (LIFO - Last In First Out)
|
|
198
268
|
const instances = this.modalInstances();
|
|
199
269
|
const lastModal = instances[instances.length - 1];
|
|
200
270
|
if (lastModal) {
|
|
271
|
+
// Complete the subject if not already completed
|
|
272
|
+
if (!lastModal.closeSubject.closed) {
|
|
273
|
+
lastModal.closeSubject.next(undefined);
|
|
274
|
+
lastModal.closeSubject.complete();
|
|
275
|
+
}
|
|
201
276
|
this.destroyModalInstance(lastModal);
|
|
202
277
|
this.modalInstances.update((instances) => instances.slice(0, -1));
|
|
203
278
|
// Emit modal closed event
|
|
204
279
|
this.modalClosedSubject.next(lastModal.id);
|
|
205
280
|
}
|
|
281
|
+
else {
|
|
282
|
+
console.warn('[QuangModalService] No modals to hide');
|
|
283
|
+
}
|
|
206
284
|
}
|
|
207
285
|
}
|
|
208
286
|
destroyModalInstance(instance) {
|
|
@@ -223,10 +301,10 @@ class QuangModalService {
|
|
|
223
301
|
this.idCounter.update((count) => count + 1);
|
|
224
302
|
return `modal-${this.idCounter()}-${Date.now()}`;
|
|
225
303
|
}
|
|
226
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.
|
|
227
|
-
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.
|
|
304
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.10", ngImport: i0, type: QuangModalService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
305
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.10", ngImport: i0, type: QuangModalService, providedIn: 'root' }); }
|
|
228
306
|
}
|
|
229
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.
|
|
307
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.10", ngImport: i0, type: QuangModalService, decorators: [{
|
|
230
308
|
type: Injectable,
|
|
231
309
|
args: [{
|
|
232
310
|
providedIn: 'root',
|
|
@@ -237,5 +315,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.3", ngImpor
|
|
|
237
315
|
* Generated bundle index. Do not edit.
|
|
238
316
|
*/
|
|
239
317
|
|
|
240
|
-
export { QuangModalComponent, QuangModalService };
|
|
318
|
+
export { MODAL_ID, ModalRef, QuangModalComponent, QuangModalService };
|
|
241
319
|
//# sourceMappingURL=quang-overlay-modal.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"quang-overlay-modal.mjs","sources":["../../../projects/quang/overlay/modal/modal.component.ts","../../../projects/quang/overlay/modal/modal.component.html","../../../projects/quang/overlay/modal/modal.service.ts","../../../projects/quang/overlay/modal/quang-overlay-modal.ts"],"sourcesContent":["import { Overlay, OverlayConfig, OverlayRef } from '@angular/cdk/overlay'\nimport { CdkPortal, PortalModule } from '@angular/cdk/portal'\nimport { NgStyle } from '@angular/common'\nimport {\n AfterViewInit,\n ChangeDetectionStrategy,\n Component,\n DestroyRef,\n OnDestroy,\n ViewChild,\n computed,\n inject,\n input,\n output,\n} from '@angular/core'\nimport { takeUntilDestroyed } from '@angular/core/rxjs-interop'\n\nimport { ModalAnimationMode } from './models/ModalAnimationMode'\n\n@Component({\n selector: 'quang-modal',\n imports: [PortalModule, NgStyle],\n templateUrl: './modal.component.html',\n styleUrl: './modal.component.scss',\n changeDetection: ChangeDetectionStrategy.OnPush,\n})\n/**\n * Modal component that leverages Angular CDK's Overlay and Portal modules to create modals with flexible positioning and configurations.\n *\n * @usageNotes\n * The component can be shown by using its selector `quang-modal` with a boolean binded to the Angular directive `*ngIf`.\n *\n * Its structure is divided in 3 `ng-content` to set the header, body and footer.\n * Every section has its own selector and can be used to render custom content in a simple way.\n *\n * `header` section is placed on top, `footer` section is placed on bottom.\n *\n * @example\n * <quang-modal\n * (backdropClick)=\"closeModal()\"\n * *ngIf=\"showModal\"\n * position=\"right\"\n * >\n * <ng-container header>\n * <h2>Modal header</h2>\n * </ng-container>\n * <ng-container body>\n * <h3>Modal body</h3>\n * </ng-container>\n * <ng-container footer>\n * <h3>Modal footer</h3>\n * </ng-container>\n * </quang-modal>\n */\nexport class QuangModalComponent implements AfterViewInit, OnDestroy {\n @ViewChild(CdkPortal) public readonly portal?: CdkPortal\n\n backdropClick = output<void>()\n\n position = input.required<'right' | 'left' | 'center'>()\n\n height = input<string>('80vh')\n\n width = input<string>('80vw')\n\n padding = input<string>('0 1rem')\n\n containerClass = input<string>('')\n\n animationMode = input<ModalAnimationMode>()\n\n backgroundColor = input<string>()\n\n showBackdrop = input<boolean>(true)\n\n positionStrategy = computed(() => {\n switch (this.position()) {\n case 'right':\n return this.overlay.position().global().right().top()\n case 'left':\n return this.overlay.position().global().left().top()\n case 'center':\n default:\n return this.overlay.position().global().centerHorizontally().centerVertically()\n }\n })\n\n animationClassEnter = computed(() => {\n switch (this.animationMode()) {\n case 'SLIDE_FROM_LEFT_TO_RIGHT':\n return 'left-to-right-enter-active'\n case 'SLIDE_FROM_RIGHT_TO_LEFT':\n return 'right-to-left-enter-active'\n case 'SLIDE_TOP_TO_BOTTOM':\n return 'top-to-bottom-enter-active'\n case 'SLIDE_BOTTOM_TO_TOP':\n return 'top-to-bottom-enter-active'\n case 'FADE':\n return 'fade-enter-active'\n default:\n return ''\n }\n })\n\n private readonly destroyRef = inject(DestroyRef)\n\n private overlayConfig?: OverlayConfig\n\n private overlayRef?: OverlayRef\n\n constructor(private readonly overlay: Overlay) {}\n\n ngAfterViewInit(): void {\n this.overlayConfig = new OverlayConfig({\n hasBackdrop: true,\n positionStrategy: this.positionStrategy(),\n scrollStrategy: this.overlay.scrollStrategies.block(),\n backdropClass: this.showBackdrop() ? undefined : '',\n })\n this.overlayRef = this.overlay.create(this.overlayConfig)\n this.overlayRef\n .backdropClick()\n .pipe(takeUntilDestroyed(this.destroyRef))\n .subscribe(() => {\n this.backdropClick.emit()\n })\n this.overlayRef?.attach(this.portal)\n }\n\n ngOnDestroy(): void {\n this.closeModal()\n }\n\n closeModal(): void {\n this.overlayRef?.detach()\n this.overlayRef?.dispose()\n }\n}\n","<ng-template cdkPortal>\n <div\n [ngStyle]=\"{\n '--quang-modal-panel-width': width(),\n '--quang-modal-panel-height': height(),\n '--quang-modal-panel-background': backgroundColor(),\n '--quang-modal-panel-padding': padding(),\n }\"\n class=\"dialog {{ containerClass() }} {{ animationClassEnter() }}\"\n >\n <div class=\"dialog__header\">\n <ng-content select=\"[header]\"></ng-content>\n </div>\n <div class=\"dialog__body\">\n <ng-content select=\"[body]\"></ng-content>\n </div>\n <div class=\"dialog__footer\">\n <ng-content select=\"[footer]\"></ng-content>\n </div>\n </div>\n</ng-template>\n","import {\n ApplicationRef,\n EnvironmentInjector,\n Injectable,\n Type,\n computed,\n createComponent,\n inject,\n signal,\n} from '@angular/core'\n\nimport { Subject } from 'rxjs'\n\nimport { QuangModalComponent } from './modal.component'\n\nimport { ModalInstance } from './models/ModalInstance'\nimport { ModalOptions } from './models/ModalOptions'\n\n@Injectable({\n providedIn: 'root',\n})\nexport class QuangModalService {\n private readonly environmentInjector = inject(EnvironmentInjector)\n private readonly appRef = inject(ApplicationRef)\n\n private modalInstances = signal<ModalInstance[]>([])\n private idCounter = signal(0)\n\n // Computed properties for easier access\n public modalCount = computed(() => this.modalInstances().length)\n public hasOpenModals = computed(() => this.modalInstances().length > 0)\n public modalIds = computed(() => this.modalInstances().map((instance) => instance.id))\n\n // Subject to emit when modals are closed\n private modalClosedSubject = new Subject<string>()\n public modalClosed$ = this.modalClosedSubject.asObservable()\n\n showModal<T = unknown>(component: Type<T>, options: ModalOptions, componentInputs?: Record<string, unknown>): string {\n const id = this.generateId()\n\n // Create the content component instance first\n const contentRef = createComponent(component, {\n environmentInjector: this.environmentInjector,\n })\n\n // Set component inputs if provided\n if (componentInputs) {\n Object.entries(componentInputs).forEach(([key, value]) => {\n contentRef.setInput(key, value)\n })\n }\n\n // Create the modal component instance with content projected in body slot\n const modalRef = createComponent(QuangModalComponent, {\n environmentInjector: this.environmentInjector,\n projectableNodes: [\n [], // header slot (empty)\n [contentRef.location.nativeElement], // body slot (content component)\n [], // footer slot (empty)\n ],\n })\n\n // Set modal inputs from options\n modalRef.setInput('position', options.position)\n if (options.height !== undefined) modalRef.setInput('height', options.height)\n if (options.width !== undefined) modalRef.setInput('width', options.width)\n if (options.padding !== undefined) modalRef.setInput('padding', options.padding)\n if (options.containerClass !== undefined) modalRef.setInput('containerClass', options.containerClass)\n if (options.animationMode !== undefined) modalRef.setInput('animationMode', options.animationMode)\n if (options.backgroundColor !== undefined) modalRef.setInput('backgroundColor', options.backgroundColor)\n if (options.showBackdrop !== undefined) modalRef.setInput('showBackdrop', options.showBackdrop)\n\n // Subscribe to backdrop click to close modal\n modalRef.instance.backdropClick.subscribe(() => {\n this.hideModal(id)\n })\n\n // Attach components to the application\n this.appRef.attachView(contentRef.hostView)\n this.appRef.attachView(modalRef.hostView)\n\n // Add modal to DOM\n document.body.appendChild(modalRef.location.nativeElement)\n\n // Store modal instance\n const modalInstance: ModalInstance = {\n id,\n modalRef,\n contentRef,\n }\n this.modalInstances.update((instances) => [...instances, modalInstance])\n\n return id\n }\n\n hideModal(id?: string): void {\n if (id) {\n // Find and remove modal by id\n const instances = this.modalInstances()\n const index = instances.findIndex((instance: ModalInstance) => instance.id === id)\n if (index !== -1) {\n const modalToClose = instances[index]\n this.destroyModalInstance(modalToClose)\n this.modalInstances.update((instances) => instances.filter((_, i) => i !== index))\n // Emit modal closed event\n this.modalClosedSubject.next(id)\n }\n } else {\n // Remove last modal (LIFO - Last In First Out)\n const instances = this.modalInstances()\n const lastModal = instances[instances.length - 1]\n if (lastModal) {\n this.destroyModalInstance(lastModal)\n this.modalInstances.update((instances) => instances.slice(0, -1))\n // Emit modal closed event\n this.modalClosedSubject.next(lastModal.id)\n }\n }\n }\n\n private destroyModalInstance(instance: ModalInstance): void {\n // Close the modal component (triggers overlay cleanup)\n instance.modalRef.instance.closeModal()\n\n // Detach from application\n this.appRef.detachView(instance.contentRef.hostView)\n this.appRef.detachView(instance.modalRef.hostView)\n\n // Remove from DOM if still attached\n if (instance.modalRef.location.nativeElement.parentNode) {\n instance.modalRef.location.nativeElement.parentNode.removeChild(instance.modalRef.location.nativeElement)\n }\n\n // Destroy component references\n instance.contentRef.destroy()\n instance.modalRef.destroy()\n }\n\n private generateId(): string {\n this.idCounter.update((count) => count + 1)\n return `modal-${this.idCounter()}-${Date.now()}`\n }\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;;;;;AA0BA;;;;;;;;;;;;;;;;;;;;;;;;;;;AA2BG;MACU,mBAAmB,CAAA;AAwD9B,IAAA,WAAA,CAA6B,OAAgB,EAAA;QAAhB,IAAA,CAAA,OAAO,GAAP,OAAO;QArDpC,IAAA,CAAA,aAAa,GAAG,MAAM,EAAQ;AAE9B,QAAA,IAAA,CAAA,QAAQ,GAAG,KAAK,CAAC,QAAQ,mDAA+B;AAExD,QAAA,IAAA,CAAA,MAAM,GAAG,KAAK,CAAS,MAAM,kDAAC;AAE9B,QAAA,IAAA,CAAA,KAAK,GAAG,KAAK,CAAS,MAAM,iDAAC;AAE7B,QAAA,IAAA,CAAA,OAAO,GAAG,KAAK,CAAS,QAAQ,mDAAC;AAEjC,QAAA,IAAA,CAAA,cAAc,GAAG,KAAK,CAAS,EAAE,0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.mjs","sources":["../../../projects/quang/overlay/modal/modal.component.ts","../../../projects/quang/overlay/modal/modal.component.html","../../../projects/quang/overlay/modal/modal-ref.ts","../../../projects/quang/overlay/modal/modal.service.ts","../../../projects/quang/overlay/modal/quang-overlay-modal.ts"],"sourcesContent":["import { Overlay, OverlayConfig, OverlayRef } from '@angular/cdk/overlay'\nimport { CdkPortal, PortalModule } from '@angular/cdk/portal'\nimport { NgStyle } from '@angular/common'\nimport {\n AfterViewInit,\n ChangeDetectionStrategy,\n Component,\n DestroyRef,\n OnDestroy,\n ViewChild,\n computed,\n inject,\n input,\n output,\n} from '@angular/core'\nimport { takeUntilDestroyed } from '@angular/core/rxjs-interop'\n\nimport { ModalAnimationMode } from './models/ModalAnimationMode'\n\n@Component({\n selector: 'quang-modal',\n imports: [PortalModule, NgStyle],\n templateUrl: './modal.component.html',\n styleUrl: './modal.component.scss',\n changeDetection: ChangeDetectionStrategy.OnPush,\n})\n/**\n * Modal component that leverages Angular CDK's Overlay and Portal modules to create modals with flexible positioning and configurations.\n *\n * @usageNotes\n * The component can be shown by using its selector `quang-modal` with a boolean binded to the Angular directive `*ngIf`.\n *\n * Its structure is divided in 3 `ng-content` to set the header, body and footer.\n * Every section has its own selector and can be used to render custom content in a simple way.\n *\n * `header` section is placed on top, `footer` section is placed on bottom.\n *\n * @example\n * <quang-modal\n * (backdropClick)=\"closeModal()\"\n * *ngIf=\"showModal\"\n * position=\"right\"\n * >\n * <ng-container header>\n * <h2>Modal header</h2>\n * </ng-container>\n * <ng-container body>\n * <h3>Modal body</h3>\n * </ng-container>\n * <ng-container footer>\n * <h3>Modal footer</h3>\n * </ng-container>\n * </quang-modal>\n */\nexport class QuangModalComponent implements AfterViewInit, OnDestroy {\n @ViewChild(CdkPortal) public readonly portal?: CdkPortal\n\n backdropClick = output<void>()\n\n position = input.required<'right' | 'left' | 'center'>()\n\n height = input<string>('80vh')\n\n width = input<string>('80vw')\n\n padding = input<string>('0 1rem')\n\n containerClass = input<string>('')\n\n animationMode = input<ModalAnimationMode>()\n\n backgroundColor = input<string>()\n\n showBackdrop = input<boolean>(true)\n\n positionStrategy = computed(() => {\n switch (this.position()) {\n case 'right':\n return this.overlay.position().global().right().top()\n case 'left':\n return this.overlay.position().global().left().top()\n case 'center':\n default:\n return this.overlay.position().global().centerHorizontally().centerVertically()\n }\n })\n\n animationClassEnter = computed(() => {\n switch (this.animationMode()) {\n case 'SLIDE_FROM_LEFT_TO_RIGHT':\n return 'left-to-right-enter-active'\n case 'SLIDE_FROM_RIGHT_TO_LEFT':\n return 'right-to-left-enter-active'\n case 'SLIDE_TOP_TO_BOTTOM':\n return 'top-to-bottom-enter-active'\n case 'SLIDE_BOTTOM_TO_TOP':\n return 'top-to-bottom-enter-active'\n case 'FADE':\n return 'fade-enter-active'\n default:\n return ''\n }\n })\n\n private readonly destroyRef = inject(DestroyRef)\n\n private overlayConfig?: OverlayConfig\n\n private overlayRef?: OverlayRef\n\n constructor(private readonly overlay: Overlay) {}\n\n ngAfterViewInit(): void {\n this.overlayConfig = new OverlayConfig({\n hasBackdrop: true,\n positionStrategy: this.positionStrategy(),\n scrollStrategy: this.overlay.scrollStrategies.block(),\n backdropClass: this.showBackdrop() ? undefined : '',\n })\n this.overlayRef = this.overlay.create(this.overlayConfig)\n this.overlayRef\n .backdropClick()\n .pipe(takeUntilDestroyed(this.destroyRef))\n .subscribe(() => {\n this.backdropClick.emit()\n })\n this.overlayRef?.attach(this.portal)\n }\n\n ngOnDestroy(): void {\n this.closeModal()\n }\n\n closeModal(): void {\n this.overlayRef?.detach()\n this.overlayRef?.dispose()\n }\n}\n","<ng-template cdkPortal>\n <div\n [ngStyle]=\"{\n '--quang-modal-panel-width': width(),\n '--quang-modal-panel-height': height(),\n '--quang-modal-panel-background': backgroundColor(),\n '--quang-modal-panel-padding': padding(),\n }\"\n class=\"dialog {{ containerClass() }} {{ animationClassEnter() }}\"\n >\n <div class=\"dialog__header\">\n <ng-content select=\"[header]\"></ng-content>\n </div>\n <div class=\"dialog__body\">\n <ng-content select=\"[body]\"></ng-content>\n </div>\n <div class=\"dialog__footer\">\n <ng-content select=\"[footer]\"></ng-content>\n </div>\n </div>\n</ng-template>\n","import { InjectionToken, inject } from '@angular/core'\n\nimport { QuangModalService } from './modal.service'\n\n/**\n * Injection token for the modal ID\n */\nexport const MODAL_ID = new InjectionToken<string>('MODAL_ID')\n\n/**\n * Helper class to manage modal closure from within the modal component\n */\nexport class ModalRef {\n private readonly modalService = inject(QuangModalService)\n private readonly modalId = inject(MODAL_ID)\n\n /**\n * Close the modal with optional data\n * @param data Optional data to pass when closing the modal (e.g., which button was clicked)\n */\n close(data?: object): void {\n this.modalService.close(this.modalId, data)\n }\n\n /**\n * Get the current modal ID\n */\n getId(): string {\n return this.modalId\n }\n}\n","import {\n ApplicationRef,\n EnvironmentInjector,\n Injectable,\n Injector,\n Type,\n computed,\n createComponent,\n inject,\n signal,\n} from '@angular/core'\n\nimport { Observable, Subject } from 'rxjs'\n\nimport { QuangModalComponent } from './modal.component'\n\nimport { ModalOptions } from './models'\nimport { ModalInstance } from './models/ModalInstance'\n\nimport { MODAL_ID, ModalRef } from './modal-ref'\n\n@Injectable({\n providedIn: 'root',\n})\nexport class QuangModalService {\n private readonly environmentInjector = inject(EnvironmentInjector)\n private readonly appRef = inject(ApplicationRef)\n\n private modalInstances = signal<ModalInstance[]>([])\n private idCounter = signal(0)\n\n // Computed properties for easier access\n public modalCount = computed(() => this.modalInstances().length)\n public hasOpenModals = computed(() => this.modalInstances().length > 0)\n public modalIds = computed(() => this.modalInstances().map((instance) => instance.id))\n\n // Subject to emit when modals are closed\n private modalClosedSubject = new Subject<string>()\n public modalClosed$ = this.modalClosedSubject.asObservable()\n\n showModal<T = unknown>(\n component: Type<T>,\n options: ModalOptions,\n componentInputs?: Record<string, unknown>\n ): { id: string; closeCallback: Observable<object | undefined> } {\n const id = this.generateId()\n\n // Create a Subject for this modal's close event\n const closeSubject = new Subject<object | undefined>()\n\n // Create an injector that provides the modal ID and ModalRef\n const modalInjector = Injector.create({\n providers: [\n { provide: MODAL_ID, useValue: id },\n { provide: ModalRef, useClass: ModalRef },\n ],\n parent: this.environmentInjector,\n })\n\n // Create the content component instance first with the modal injector\n const contentRef = createComponent(component, {\n elementInjector: modalInjector,\n environmentInjector: this.environmentInjector,\n })\n\n // Set component inputs if provided\n if (componentInputs) {\n Object.entries(componentInputs).forEach(([key, value]) => {\n contentRef.setInput(key, value)\n })\n }\n\n // Create the modal component instance with content projected in body slot\n const modalRef = createComponent(QuangModalComponent, {\n environmentInjector: this.environmentInjector,\n projectableNodes: [\n [], // header slot (empty)\n [contentRef.location.nativeElement], // body slot (content component)\n [], // footer slot (empty)\n ],\n })\n\n // Set modal inputs from options\n modalRef.setInput('position', options.position)\n if (options.height !== undefined) modalRef.setInput('height', options.height)\n if (options.width !== undefined) modalRef.setInput('width', options.width)\n if (options.padding !== undefined) modalRef.setInput('padding', options.padding)\n if (options.containerClass !== undefined) modalRef.setInput('containerClass', options.containerClass)\n if (options.animationMode !== undefined) modalRef.setInput('animationMode', options.animationMode)\n if (options.backgroundColor !== undefined) modalRef.setInput('backgroundColor', options.backgroundColor)\n if (options.showBackdrop !== undefined) modalRef.setInput('showBackdrop', options.showBackdrop)\n\n // Subscribe to backdrop click to close modal\n modalRef.instance.backdropClick.subscribe(() => {\n this.close(id)\n })\n\n // Attach components to the application\n this.appRef.attachView(contentRef.hostView)\n this.appRef.attachView(modalRef.hostView)\n\n // Add modal to DOM\n document.body.appendChild(modalRef.location.nativeElement)\n\n // Store modal instance\n const modalInstance: ModalInstance = {\n id,\n modalRef,\n contentRef,\n closeSubject,\n }\n this.modalInstances.update((instances) => [...instances, modalInstance])\n return { id, closeCallback: closeSubject.asObservable() }\n }\n\n /**\n * Closes a modal by its ID and emits optional data.\n * @param id The ID of the modal to close.\n * @param data Optional data to emit on close.\n */\n close(id: string, data?: object): void {\n const instances = this.modalInstances()\n const instance = instances.find((inst) => inst.id === id)\n\n if (instance) {\n // Emit the data through the subject before destroying\n instance.closeSubject.next(data)\n instance.closeSubject.complete()\n\n // Remove the modal\n this.hideModal(id)\n } else {\n console.warn('[QuangModalService] Modal not found:', id)\n }\n }\n\n /**\n * Hides a modal by its ID.\n * @param id The ID of the modal to hide. If not provided, hides the last opened modal.\n */\n hideModal(id?: string): void {\n if (id) {\n // Find and remove modal by id\n const instances = this.modalInstances()\n const index = instances.findIndex((instance: ModalInstance) => instance.id === id)\n if (index !== -1) {\n const modalToClose = instances[index]\n // Complete the subject if not already completed\n if (!modalToClose.closeSubject.closed) {\n modalToClose.closeSubject.next(undefined)\n modalToClose.closeSubject.complete()\n }\n this.destroyModalInstance(modalToClose)\n this.modalInstances.update((instances) => instances.filter((_, i) => i !== index))\n // Emit modal closed event\n this.modalClosedSubject.next(id)\n } else {\n console.warn('[QuangModalService] Modal not found in instances:', id)\n }\n } else {\n // Remove last modal (LIFO - Last In First Out)\n const instances = this.modalInstances()\n const lastModal = instances[instances.length - 1]\n if (lastModal) {\n // Complete the subject if not already completed\n if (!lastModal.closeSubject.closed) {\n lastModal.closeSubject.next(undefined)\n lastModal.closeSubject.complete()\n }\n this.destroyModalInstance(lastModal)\n this.modalInstances.update((instances) => instances.slice(0, -1))\n // Emit modal closed event\n this.modalClosedSubject.next(lastModal.id)\n } else {\n console.warn('[QuangModalService] No modals to hide')\n }\n }\n }\n\n private destroyModalInstance(instance: ModalInstance): void {\n // Close the modal component (triggers overlay cleanup)\n instance.modalRef.instance.closeModal()\n\n // Detach from application\n this.appRef.detachView(instance.contentRef.hostView)\n this.appRef.detachView(instance.modalRef.hostView)\n\n // Remove from DOM if still attached\n if (instance.modalRef.location.nativeElement.parentNode) {\n instance.modalRef.location.nativeElement.parentNode.removeChild(instance.modalRef.location.nativeElement)\n }\n\n // Destroy component references\n instance.contentRef.destroy()\n instance.modalRef.destroy()\n }\n\n private generateId(): string {\n this.idCounter.update((count) => count + 1)\n return `modal-${this.idCounter()}-${Date.now()}`\n }\n}\n","/**\n * Gener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|
});
|
|
40
40
|
}
|
|
41
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.
|
|
42
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.
|
|
41
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.10", ngImport: i0, type: QuangPopoverComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
42
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.10", type: QuangPopoverComponent, isStandalone: true, selector: "quang-popover", inputs: { overlayContent: { classPropertyName: "overlayContent", publicName: "overlayContent", isSignal: true, isRequired: false, transformFunction: null }, payload: { classPropertyName: "payload", publicName: "payload", isSignal: true, isRequired: false, transformFunction: null } }, ngImport: i0, template: "@if (overlayContent()) {\n <div\n [ngClass]=\"getPopoverPosition()\"\n class=\"popover-container\"\n >\n <ng-container\n [ngTemplateOutlet]=\"overlayContent()\"\n [ngTemplateOutletContext]=\"{\n $implicit: payload(),\n }\"\n ></ng-container>\n </div>\n}\n", styles: [":host{--bs-popover-border-width: 1px;--bs-popover-arrow-width: .5rem;--bs-popover-arrow-border: var(--bs-border-color, #000);--box-shadow-bg: rgba(0, 0, 0, .16)}.popover-container{box-shadow:var(--box-shadow-bg);background:var(--bs-body-bg, #fff);border:var(--bs-popover-border-width) solid var(--bs-border-color, #000);position:relative;padding:1rem;pointer-events:all}.popover-container.center-bottom:after,.popover-container.center-bottom:before{bottom:100%;left:50%;transform:translate(-50%)}.popover-container.start-bottom:after,.popover-container.start-bottom:before{bottom:100%;left:85%;transform:translate(-50%)}.popover-container.end-bottom:after,.popover-container.end-bottom:before{bottom:100%;left:15%;transform:translate(-50%)}.popover-container.center-top:after,.popover-container.center-top:before{top:100%;left:50%;transform:translate(-50%) rotate(180deg)}.popover-container.start-top:after,.popover-container.start-top:before{top:100%;left:85%;transform:translate(-50%) rotate(180deg)}.popover-container.end-top:after,.popover-container.end-top:before{top:100%;left:15%;transform:translate(-50%) rotate(180deg)}.popover-container.end-center:after,.popover-container.end-center:before{right:100%;top:50%;transform:translateY(-50%) rotate(270deg)}.popover-container.start-center:after,.popover-container.start-center:before{left:100%;top:50%;transform:translateY(-50%) rotate(90deg)}.popover-container:after,.popover-container:before{content:\"\";display:block;position:absolute;width:0;height:0;border-style:solid}.popover-container:after{border-color:transparent transparent var(--bs-body-bg, #fff) transparent;border-width:var(--bs-popover-arrow-width)}.popover-container:before{border-color:transparent transparent var(--bs-border-color, #000) transparent;border-width:calc(var(--bs-popover-arrow-width) + 1px)}\n"], dependencies: [{ kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "directive", type: NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
43
43
|
}
|
|
44
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.
|
|
44
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.10", ngImport: i0, type: QuangPopoverComponent, decorators: [{
|
|
45
45
|
type: Component,
|
|
46
46
|
args: [{ selector: 'quang-popover', imports: [NgTemplateOutlet, NgClass], changeDetection: ChangeDetectionStrategy.OnPush, template: "@if (overlayContent()) {\n <div\n [ngClass]=\"getPopoverPosition()\"\n class=\"popover-container\"\n >\n <ng-container\n [ngTemplateOutlet]=\"overlayContent()\"\n [ngTemplateOutletContext]=\"{\n $implicit: payload(),\n }\"\n ></ng-container>\n </div>\n}\n", styles: [":host{--bs-popover-border-width: 1px;--bs-popover-arrow-width: .5rem;--bs-popover-arrow-border: var(--bs-border-color, #000);--box-shadow-bg: rgba(0, 0, 0, .16)}.popover-container{box-shadow:var(--box-shadow-bg);background:var(--bs-body-bg, #fff);border:var(--bs-popover-border-width) solid var(--bs-border-color, #000);position:relative;padding:1rem;pointer-events:all}.popover-container.center-bottom:after,.popover-container.center-bottom:before{bottom:100%;left:50%;transform:translate(-50%)}.popover-container.start-bottom:after,.popover-container.start-bottom:before{bottom:100%;left:85%;transform:translate(-50%)}.popover-container.end-bottom:after,.popover-container.end-bottom:before{bottom:100%;left:15%;transform:translate(-50%)}.popover-container.center-top:after,.popover-container.center-top:before{top:100%;left:50%;transform:translate(-50%) rotate(180deg)}.popover-container.start-top:after,.popover-container.start-top:before{top:100%;left:85%;transform:translate(-50%) rotate(180deg)}.popover-container.end-top:after,.popover-container.end-top:before{top:100%;left:15%;transform:translate(-50%) rotate(180deg)}.popover-container.end-center:after,.popover-container.end-center:before{right:100%;top:50%;transform:translateY(-50%) rotate(270deg)}.popover-container.start-center:after,.popover-container.start-center:before{left:100%;top:50%;transform:translateY(-50%) rotate(90deg)}.popover-container:after,.popover-container:before{content:\"\";display:block;position:absolute;width:0;height:0;border-style:solid}.popover-container:after{border-color:transparent transparent var(--bs-body-bg, #fff) transparent;border-width:var(--bs-popover-arrow-width)}.popover-container:before{border-color:transparent transparent var(--bs-border-color, #000) transparent;border-width:calc(var(--bs-popover-arrow-width) + 1px)}\n"] }]
|
|
47
|
-
}] });
|
|
47
|
+
}], propDecorators: { overlayContent: [{ type: i0.Input, args: [{ isSignal: true, alias: "overlayContent", required: false }] }], payload: [{ type: i0.Input, args: [{ isSignal: true, alias: "payload", required: false }] }] } });
|
|
48
48
|
|
|
49
49
|
class QuangPopoverDirective extends QuangBaseOverlayDirective {
|
|
50
50
|
constructor() {
|
|
@@ -52,15 +52,15 @@ class QuangPopoverDirective extends QuangBaseOverlayDirective {
|
|
|
52
52
|
this.targetComponentType = signal(QuangPopoverComponent, ...(ngDevMode ? [{ debugName: "targetComponentType" }] : []));
|
|
53
53
|
this.content = input.required(...(ngDevMode ? [{ debugName: "content", alias: 'quangPopover' }] : [{ alias: 'quangPopover' }]));
|
|
54
54
|
}
|
|
55
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.
|
|
56
|
-
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "20.3.
|
|
55
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.10", ngImport: i0, type: QuangPopoverDirective, deps: null, target: i0.ɵɵFactoryTarget.Directive }); }
|
|
56
|
+
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "20.3.10", type: QuangPopoverDirective, isStandalone: true, selector: "[quangPopover]", inputs: { content: { classPropertyName: "content", publicName: "quangPopover", isSignal: true, isRequired: true, transformFunction: null } }, usesInheritance: true, ngImport: i0 }); }
|
|
57
57
|
}
|
|
58
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.
|
|
58
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.10", ngImport: i0, type: QuangPopoverDirective, decorators: [{
|
|
59
59
|
type: Directive,
|
|
60
60
|
args: [{
|
|
61
61
|
selector: '[quangPopover]',
|
|
62
62
|
}]
|
|
63
|
-
}] });
|
|
63
|
+
}], propDecorators: { content: [{ type: i0.Input, args: [{ isSignal: true, alias: "quangPopover", required: true }] }] } });
|
|
64
64
|
|
|
65
65
|
/**
|
|
66
66
|
* Generated bundle index. Do not edit.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"quang-overlay-popover.mjs","sources":["../../../projects/quang/overlay/popover/popover.component.ts","../../../projects/quang/overlay/popover/popover.component.html","../../../projects/quang/overlay/popover/popover.directive.ts","../../../projects/quang/overlay/popover/quang-overlay-popover.ts"],"sourcesContent":["import { ConnectionPositionPair } from '@angular/cdk/overlay'\nimport { NgClass, NgTemplateOutlet } from '@angular/common'\nimport { ChangeDetectionStrategy, Component, TemplateRef, input, signal } from '@angular/core'\nimport { takeUntilDestroyed, toObservable } from '@angular/core/rxjs-interop'\n\nimport { QuangBaseOverlayComponent } from 'quang/overlay/shared'\n\n@Component({\n selector: 'quang-popover',\n imports: [NgTemplateOutlet, NgClass],\n templateUrl: './popover.component.html',\n styleUrl: './popover.component.scss',\n changeDetection: ChangeDetectionStrategy.OnPush,\n})\n/**\n * Popover component that can render custom content, passed from the outside as a `TemplateRef`\n * @example\n * <button\n [quangPopover]=\"popoverTest\"\n [scrollCloseThreshold]=\"undefined\"\n class=\"btn popover-test-button\"\n overlayPosition=\"top\"\n showMethod=\"click\"\n >\n {{ 'buttons.popover' | transloco }}\n <span>CLICK</span>\n </button>\n <ng-template #popoverTest> <span>test works!</span> <button type=\"button\">click!</button> </ng-template>\n */\nexport class QuangPopoverComponent implements QuangBaseOverlayComponent {\n overlayContent = input<TemplateRef<any> | null>(null)\n\n positionPair = signal<ConnectionPositionPair | null>(null)\n\n payload = input<any>()\n\n getPopoverPosition = signal<string>('')\n\n onChangePositionPair$ = toObservable(this.positionPair)\n .pipe(takeUntilDestroyed())\n .subscribe((positionPair) => {\n const originX = positionPair?.originX\n const originY = positionPair?.originY\n if (originX && originY) {\n this.getPopoverPosition.set(`${originX}-${originY}`)\n } else {\n this.getPopoverPosition.set('')\n }\n })\n}\n","@if (overlayContent()) {\n <div\n [ngClass]=\"getPopoverPosition()\"\n class=\"popover-container\"\n >\n <ng-container\n [ngTemplateOutlet]=\"overlayContent()\"\n [ngTemplateOutletContext]=\"{\n $implicit: payload(),\n }\"\n ></ng-container>\n </div>\n}\n","import { ComponentType } from '@angular/cdk/portal'\nimport { Directive, TemplateRef, input, signal } from '@angular/core'\n\nimport { QuangBaseOverlayDirective } from 'quang/overlay/shared'\n\nimport { QuangPopoverComponent } from './popover.component'\n\n@Directive({\n selector: '[quangPopover]',\n})\nexport class QuangPopoverDirective extends QuangBaseOverlayDirective<QuangPopoverComponent> {\n override targetComponentType = signal<ComponentType<QuangPopoverComponent> | undefined>(QuangPopoverComponent)\n\n override content = input.required<TemplateRef<any> | null>({ alias: 'quangPopover' })\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;AAcA;;;;;;;;;;;;;;AAcG;MACU,qBAAqB,CAAA;AAtBlC,IAAA,WAAA,GAAA;AAuBE,QAAA,IAAA,CAAA,cAAc,GAAG,KAAK,CAA0B,IAAI,0DAAC;AAErD,QAAA,IAAA,CAAA,YAAY,GAAG,MAAM,CAAgC,IAAI,wDAAC;QAE1D,IAAA,CAAA,OAAO,GAAG,KAAK,CAAA,IAAA,SAAA,GAAA,CAAA,SAAA,EAAA,EAAA,SAAA,EAAA,SAAA,EAAA,CAAA,GAAA,EAAA,CAAA,CAAO;AAEtB,QAAA,IAAA,CAAA,kBAAkB,GAAG,MAAM,CAAS,EAAE,8DAAC;AAEvC,QAAA,IAAA,CAAA,qBAAqB,GAAG,YAAY,CAAC,IAAI,CAAC,YAAY;aACnD,IAAI,CAAC,kBAAkB,EAAE;AACzB,aAAA,SAAS,CAAC,CAAC,YAAY,KAAI;AAC1B,YAAA,MAAM,OAAO,GAAG,YAAY,EAAE,OAAO;AACrC,YAAA,MAAM,OAAO,GAAG,YAAY,EAAE,OAAO;AACrC,YAAA,IAAI,OAAO,IAAI,OAAO,EAAE;gBACtB,IAAI,CAAC,kBAAkB,CAAC,GAAG,CAAC,CAAA,EAAG,OAAO,CAAA,CAAA,EAAI,OAAO,CAAA,CAAE,CAAC;YACtD;iBAAO;AACL,gBAAA,IAAI,CAAC,kBAAkB,CAAC,GAAG,CAAC,EAAE,CAAC;YACjC;AACF,QAAA,CAAC,CAAC;AACL,IAAA
|
|
1
|
+
{"version":3,"file":"quang-overlay-popover.mjs","sources":["../../../projects/quang/overlay/popover/popover.component.ts","../../../projects/quang/overlay/popover/popover.component.html","../../../projects/quang/overlay/popover/popover.directive.ts","../../../projects/quang/overlay/popover/quang-overlay-popover.ts"],"sourcesContent":["import { ConnectionPositionPair } from '@angular/cdk/overlay'\nimport { NgClass, NgTemplateOutlet } from '@angular/common'\nimport { ChangeDetectionStrategy, Component, TemplateRef, input, signal } from '@angular/core'\nimport { takeUntilDestroyed, toObservable } from '@angular/core/rxjs-interop'\n\nimport { QuangBaseOverlayComponent } from 'quang/overlay/shared'\n\n@Component({\n selector: 'quang-popover',\n imports: [NgTemplateOutlet, NgClass],\n templateUrl: './popover.component.html',\n styleUrl: './popover.component.scss',\n changeDetection: ChangeDetectionStrategy.OnPush,\n})\n/**\n * Popover component that can render custom content, passed from the outside as a `TemplateRef`\n * @example\n * <button\n [quangPopover]=\"popoverTest\"\n [scrollCloseThreshold]=\"undefined\"\n class=\"btn popover-test-button\"\n overlayPosition=\"top\"\n showMethod=\"click\"\n >\n {{ 'buttons.popover' | transloco }}\n <span>CLICK</span>\n </button>\n <ng-template #popoverTest> <span>test works!</span> <button type=\"button\">click!</button> </ng-template>\n */\nexport class QuangPopoverComponent implements QuangBaseOverlayComponent {\n overlayContent = input<TemplateRef<any> | null>(null)\n\n positionPair = signal<ConnectionPositionPair | null>(null)\n\n payload = input<any>()\n\n getPopoverPosition = signal<string>('')\n\n onChangePositionPair$ = toObservable(this.positionPair)\n .pipe(takeUntilDestroyed())\n .subscribe((positionPair) => {\n const originX = positionPair?.originX\n const originY = positionPair?.originY\n if (originX && originY) {\n this.getPopoverPosition.set(`${originX}-${originY}`)\n } else {\n this.getPopoverPosition.set('')\n }\n })\n}\n","@if (overlayContent()) {\n <div\n [ngClass]=\"getPopoverPosition()\"\n class=\"popover-container\"\n >\n <ng-container\n [ngTemplateOutlet]=\"overlayContent()\"\n [ngTemplateOutletContext]=\"{\n $implicit: payload(),\n }\"\n ></ng-container>\n </div>\n}\n","import { ComponentType } from '@angular/cdk/portal'\nimport { Directive, TemplateRef, input, signal } from '@angular/core'\n\nimport { QuangBaseOverlayDirective } from 'quang/overlay/shared'\n\nimport { QuangPopoverComponent } from './popover.component'\n\n@Directive({\n selector: '[quangPopover]',\n})\nexport class QuangPopoverDirective extends QuangBaseOverlayDirective<QuangPopoverComponent> {\n override targetComponentType = signal<ComponentType<QuangPopoverComponent> | undefined>(QuangPopoverComponent)\n\n override content = input.required<TemplateRef<any> | null>({ alias: 'quangPopover' })\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;AAcA;;;;;;;;;;;;;;AAcG;MACU,qBAAqB,CAAA;AAtBlC,IAAA,WAAA,GAAA;AAuBE,QAAA,IAAA,CAAA,cAAc,GAAG,KAAK,CAA0B,IAAI,0DAAC;AAErD,QAAA,IAAA,CAAA,YAAY,GAAG,MAAM,CAAgC,IAAI,wDAAC;QAE1D,IAAA,CAAA,OAAO,GAAG,KAAK,CAAA,IAAA,SAAA,GAAA,CAAA,SAAA,EAAA,EAAA,SAAA,EAAA,SAAA,EAAA,CAAA,GAAA,EAAA,CAAA,CAAO;AAEtB,QAAA,IAAA,CAAA,kBAAkB,GAAG,MAAM,CAAS,EAAE,8DAAC;AAEvC,QAAA,IAAA,CAAA,qBAAqB,GAAG,YAAY,CAAC,IAAI,CAAC,YAAY;aACnD,IAAI,CAAC,kBAAkB,EAAE;AACzB,aAAA,SAAS,CAAC,CAAC,YAAY,KAAI;AAC1B,YAAA,MAAM,OAAO,GAAG,YAAY,EAAE,OAAO;AACrC,YAAA,MAAM,OAAO,GAAG,YAAY,EAAE,OAAO;AACrC,YAAA,IAAI,OAAO,IAAI,OAAO,EAAE;gBACtB,IAAI,CAAC,kBAAkB,CAAC,GAAG,CAAC,CAAA,EAAG,OAAO,CAAA,CAAA,EAAI,OAAO,CAAA,CAAE,CAAC;YACtD;iBAAO;AACL,gBAAA,IAAI,CAAC,kBAAkB,CAAC,GAAG,CAAC,EAAE,CAAC;YACjC;AACF,QAAA,CAAC,CAAC;AACL,IAAA;+GApBY,qBAAqB,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,SAAA,EAAA,CAAA,CAAA;AAArB,IAAA,SAAA,IAAA,CAAA,IAAA,GAAA,EAAA,CAAA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,cAAc,EAAA,CAAA,GAAA,CAAvB,EAAE,KAAK,EAAE,cAAc,EAAE,GAAC;AACtF,IAAA;+GAJY,qBAAqB,EAAA,IAAA,EAAA,IAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,SAAA,EAAA,CAAA,CAAA;mGAArB,qBAAqB,EAAA,YAAA,EAAA,IAAA,EAAA,QAAA,EAAA,gBAAA,EAAA,MAAA,EAAA,EAAA,OAAA,EAAA,EAAA,iBAAA,EAAA,SAAA,EAAA,UAAA,EAAA,cAAA,EAAA,QAAA,EAAA,IAAA,EAAA,UAAA,EAAA,IAAA,EAAA,iBAAA,EAAA,IAAA,EAAA,EAAA,EAAA,eAAA,EAAA,IAAA,EAAA,QAAA,EAAA,EAAA,EAAA,CAAA,CAAA;;4FAArB,qBAAqB,EAAA,UAAA,EAAA,CAAA;kBAHjC,SAAS;AAAC,YAAA,IAAA,EAAA,CAAA;AACT,oBAAA,QAAQ,EAAE,gBAAgB;AAC3B,iBAAA;;;ACTD;;AAEG;;;;"}
|
|
@@ -14,16 +14,16 @@ class QuangBaseOverlayComponent {
|
|
|
14
14
|
this.payload = input(...(ngDevMode ? [undefined, { debugName: "payload" }] : []));
|
|
15
15
|
this.positionPair = signal(null, ...(ngDevMode ? [{ debugName: "positionPair" }] : []));
|
|
16
16
|
}
|
|
17
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.
|
|
18
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "20.3.
|
|
17
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.10", ngImport: i0, type: QuangBaseOverlayComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
18
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "20.3.10", type: QuangBaseOverlayComponent, isStandalone: true, selector: "quang-base-overlay-component", inputs: { overlayContent: { classPropertyName: "overlayContent", publicName: "overlayContent", isSignal: true, isRequired: true, transformFunction: null }, payload: { classPropertyName: "payload", publicName: "payload", isSignal: true, isRequired: false, transformFunction: null } }, ngImport: i0, template: ``, isInline: true }); }
|
|
19
19
|
}
|
|
20
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.
|
|
20
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.10", ngImport: i0, type: QuangBaseOverlayComponent, decorators: [{
|
|
21
21
|
type: Component,
|
|
22
22
|
args: [{
|
|
23
23
|
selector: 'quang-base-overlay-component',
|
|
24
24
|
template: ``,
|
|
25
25
|
}]
|
|
26
|
-
}] });
|
|
26
|
+
}], propDecorators: { overlayContent: [{ type: i0.Input, args: [{ isSignal: true, alias: "overlayContent", required: true }] }], payload: [{ type: i0.Input, args: [{ isSignal: true, alias: "payload", required: false }] }] } });
|
|
27
27
|
|
|
28
28
|
class QuangBaseOverlayDirective {
|
|
29
29
|
constructor() {
|
|
@@ -198,12 +198,12 @@ class QuangBaseOverlayDirective {
|
|
|
198
198
|
ngOnDestroy() {
|
|
199
199
|
this.detachOverlay();
|
|
200
200
|
}
|
|
201
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.
|
|
202
|
-
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "20.3.
|
|
201
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.10", ngImport: i0, type: QuangBaseOverlayDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
202
|
+
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "20.3.10", type: QuangBaseOverlayDirective, isStandalone: true, inputs: { scrollCloseThreshold: { classPropertyName: "scrollCloseThreshold", publicName: "scrollCloseThreshold", isSignal: true, isRequired: false, transformFunction: null }, showMethod: { classPropertyName: "showMethod", publicName: "showMethod", isSignal: true, isRequired: false, transformFunction: null }, content: { classPropertyName: "content", publicName: "content", isSignal: true, isRequired: true, transformFunction: null }, quangOverlayPayload: { classPropertyName: "quangOverlayPayload", publicName: "quangOverlayPayload", isSignal: true, isRequired: false, transformFunction: null }, overlayPosition: { classPropertyName: "overlayPosition", publicName: "overlayPosition", isSignal: true, isRequired: false, transformFunction: null } }, host: { listeners: { "click": "onClick()", "mouseenter": "onHover()", "mouseleave": "onLeave()" } }, ngImport: i0 }); }
|
|
203
203
|
}
|
|
204
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.
|
|
204
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.10", ngImport: i0, type: QuangBaseOverlayDirective, decorators: [{
|
|
205
205
|
type: Directive
|
|
206
|
-
}], propDecorators: { onClick: [{
|
|
206
|
+
}], propDecorators: { scrollCloseThreshold: [{ type: i0.Input, args: [{ isSignal: true, alias: "scrollCloseThreshold", required: false }] }], showMethod: [{ type: i0.Input, args: [{ isSignal: true, alias: "showMethod", required: false }] }], content: [{ type: i0.Input, args: [{ isSignal: true, alias: "content", required: true }] }], quangOverlayPayload: [{ type: i0.Input, args: [{ isSignal: true, alias: "quangOverlayPayload", required: false }] }], overlayPosition: [{ type: i0.Input, args: [{ isSignal: true, alias: "overlayPosition", required: false }] }], onClick: [{
|
|
207
207
|
type: HostListener,
|
|
208
208
|
args: ['click']
|
|
209
209
|
}], onHover: [{
|
|
@@ -340,10 +340,10 @@ class CustomViewportRuler {
|
|
|
340
340
|
? { width: document.documentElement.clientWidth, height: document.documentElement.clientHeight }
|
|
341
341
|
: { width: 0, height: 0 };
|
|
342
342
|
}
|
|
343
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.
|
|
344
|
-
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.
|
|
343
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.10", ngImport: i0, type: CustomViewportRuler, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
344
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.10", ngImport: i0, type: CustomViewportRuler, providedIn: 'root' }); }
|
|
345
345
|
}
|
|
346
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.
|
|
346
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.10", ngImport: i0, type: CustomViewportRuler, decorators: [{
|
|
347
347
|
type: Injectable,
|
|
348
348
|
args: [{ providedIn: 'root' }]
|
|
349
349
|
}], ctorParameters: () => [] });
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"quang-overlay-shared.mjs","sources":["../../../projects/quang/overlay/shared/quang-base-overlay.component.ts","../../../projects/quang/overlay/shared/quang-base-overlay.directive.ts","../../../projects/quang/overlay/shared/CustomViewportRuler.ts","../../../projects/quang/overlay/shared/quang-overlay-shared.ts"],"sourcesContent":["import { ConnectionPositionPair } from '@angular/cdk/overlay'\nimport { Component, input, signal } from '@angular/core'\n\n@Component({\n selector: 'quang-base-overlay-component',\n\n template: ``,\n})\nexport abstract class QuangBaseOverlayComponent {\n overlayContent = input.required<any>()\n\n payload = input<any>()\n\n positionPair = signal<ConnectionPositionPair | null>(null)\n}\n","import {\n ConnectedOverlayPositionChange,\n ConnectedPosition,\n FlexibleConnectedPositionStrategy,\n Overlay,\n OverlayPositionBuilder,\n OverlayRef,\n} from '@angular/cdk/overlay'\nimport { ComponentPortal, ComponentType } from '@angular/cdk/portal'\nimport {\n ComponentRef,\n DestroyRef,\n Directive,\n ElementRef,\n HostListener,\n OnDestroy,\n computed,\n inject,\n input,\n signal,\n} from '@angular/core'\nimport { takeUntilDestroyed } from '@angular/core/rxjs-interop'\n\nimport { QuangBaseOverlayComponent } from './quang-base-overlay.component'\n\n@Directive()\nexport abstract class QuangBaseOverlayDirective<T extends QuangBaseOverlayComponent> implements OnDestroy {\n targetComponentType = signal<ComponentType<T> | undefined>(undefined)\n\n /**\n * The amount of pixels needed for the popover to automatically disappear. If undefined the popover will not disappear on scroll\n * Default: 100\n * @default 100\n */\n scrollCloseThreshold = input<number | undefined>(100)\n\n showMethod = input<'click' | 'hover'>('click')\n\n content = input.required<any>()\n\n quangOverlayPayload = input<any>()\n\n closeOnClickOutside = true\n\n overlayPosition = input<\n 'top' | 'top-left' | 'top-right' | 'bottom' | 'bottom-left' | 'bottom-right' | 'left' | 'right'\n >('top')\n\n destroyRef = inject(DestroyRef)\n\n private top = signal<ConnectedPosition>({\n originX: 'center',\n originY: 'top',\n overlayX: 'center',\n overlayY: 'bottom',\n offsetY: -8,\n })\n\n private topLeft = signal<ConnectedPosition>({\n originX: 'start',\n originY: 'top',\n overlayX: 'end',\n overlayY: 'bottom',\n offsetY: -8,\n offsetX: 40,\n })\n\n private topRight = signal<ConnectedPosition>({\n originX: 'end',\n originY: 'top',\n overlayX: 'end',\n overlayY: 'bottom',\n offsetY: -8,\n offsetX: 40,\n })\n\n private bottom = signal<ConnectedPosition>({\n originX: 'center',\n originY: 'bottom',\n overlayX: 'center',\n overlayY: 'top',\n offsetY: 8,\n })\n\n private bottomLeft = signal<ConnectedPosition>({\n originX: 'start',\n originY: 'bottom',\n overlayX: 'end',\n overlayY: 'top',\n offsetY: 8,\n offsetX: 40,\n })\n\n private bottomRight = signal<ConnectedPosition>({\n originX: 'end',\n originY: 'bottom',\n overlayX: 'end',\n overlayY: 'top',\n offsetY: 8,\n offsetX: 40,\n })\n\n private left = signal<ConnectedPosition>({\n originX: 'start',\n originY: 'center',\n overlayX: 'end',\n overlayY: 'center',\n offsetX: -8,\n })\n\n private right = signal<ConnectedPosition>({\n originX: 'end',\n originY: 'center',\n overlayX: 'start',\n overlayY: 'center',\n offsetX: 8,\n })\n\n tooltipPosition = computed((): ConnectedPosition[] => {\n switch (this.overlayPosition()) {\n case 'top':\n return [this.top(), this.bottom()]\n case 'top-left':\n return [this.topLeft(), this.bottomLeft()]\n case 'top-right':\n return [this.topRight(), this.bottomRight()]\n case 'bottom':\n return [this.bottom(), this.top()]\n case 'bottom-left':\n return [this.bottomLeft(), this.topLeft()]\n case 'bottom-right':\n return [this.bottomRight(), this.topRight()]\n case 'left':\n return [this.left(), this.right()]\n case 'right':\n return [this.right(), this.left()]\n default:\n return [this.top(), this.bottom()]\n }\n })\n\n private overlayRef = signal<OverlayRef | null>(null)\n\n private readonly overlay = signal(inject(Overlay))\n\n private readonly overlayPositionBuilder = signal(inject(OverlayPositionBuilder))\n\n private readonly elementRef = signal(inject(ElementRef))\n\n private positionStrategy = signal<FlexibleConnectedPositionStrategy | undefined>(undefined)\n\n private componentOverlayRef = signal<ComponentRef<T> | null>(null)\n\n @HostListener('click') onClick(): void {\n if (this.showMethod() === 'click') this.showHideOverlay()\n }\n\n @HostListener('mouseenter') onHover(): void {\n if (this.showMethod() === 'hover') this.showHideOverlay()\n }\n\n @HostListener('mouseleave') onLeave(): void {\n if (this.showMethod() === 'hover') this.detachOverlay()\n }\n\n attachOverlay(): void {\n const targetComponentType = this.targetComponentType()\n if (!targetComponentType) {\n return\n }\n this.positionStrategy.set(\n this.overlayPositionBuilder().flexibleConnectedTo(this.elementRef()).withPositions(this.tooltipPosition())\n )\n\n this.overlayRef.set(\n this.overlay().create({\n positionStrategy: this.positionStrategy(),\n scrollStrategy: this.scrollCloseThreshold()\n ? this.overlay().scrollStrategies.close({ threshold: this.scrollCloseThreshold() })\n : this.overlay().scrollStrategies.noop(),\n hasBackdrop: this.showMethod() === 'click',\n backdropClass: '',\n })\n )\n\n const componentPortal = new ComponentPortal(targetComponentType)\n const createdOverlay = this.overlayRef()\n if (createdOverlay) {\n this.componentOverlayRef.set(createdOverlay.attach(componentPortal))\n const componentOverlayRefInstance = this.componentOverlayRef()?.instance\n if (componentOverlayRefInstance) {\n componentOverlayRefInstance.overlayContent = this.content\n componentOverlayRefInstance.payload = this.quangOverlayPayload\n }\n }\n this.positionStrategy()\n ?.positionChanges.pipe(takeUntilDestroyed(this.destroyRef))\n .subscribe((position) => {\n const positionRef: ConnectedOverlayPositionChange = position as ConnectedOverlayPositionChange\n const componentOverlayRefInstance = this.componentOverlayRef()?.instance\n if (componentOverlayRefInstance) {\n componentOverlayRefInstance.positionPair.set(positionRef.connectionPair)\n }\n })\n this.overlayRef()\n ?.backdropClick()\n .pipe(takeUntilDestroyed(this.destroyRef))\n .subscribe(() => {\n if (this.closeOnClickOutside) {\n this.detachOverlay()\n }\n })\n }\n\n detachOverlay(): void {\n this.overlayRef()?.detach()\n this.overlayRef()?.dispose()\n }\n\n showHideOverlay(): void {\n if (this.overlayRef()?.hasAttached()) {\n this.detachOverlay()\n } else {\n this.attachOverlay()\n }\n }\n\n ngOnDestroy(): void {\n this.detachOverlay()\n }\n}\n","import { Platform } from '@angular/cdk/platform'\nimport { DEFAULT_RESIZE_TIME, ViewportScrollPosition } from '@angular/cdk/scrolling'\nimport { DOCUMENT } from '@angular/common'\nimport { Injectable, NgZone, OnDestroy, inject } from '@angular/core'\n\nimport { Observable, Subject, auditTime } from 'rxjs'\n\n/**\n * Class cloe of [ViewportRuler](https://github.com/angular/components/blob/master/src/cdk/scrolling/viewport-ruler.ts)\n * To fix the wrong reported size of the viewport on mobile devices with hidden url bars\n * Issues references:\n * https://github.com/angular/components/issues/18890\n * https://github.com/angular/components/issues/27739\n *\n * To use this component provide it instead of `ViewportRuler`\n *\n * @example\n * providers: [\n * {\n * provide: ViewportRuler,\n * useClass: CustomViewportRuler\n * }\n * ]\n */\n@Injectable({ providedIn: 'root' })\nexport class CustomViewportRuler implements OnDestroy {\n /** Used to reference correct document/window */\n // protected _document: Document\n /** Cached viewport dimensions. */\n private _viewportSize: { width: number; height: number } | null = null\n /** Stream of viewport change events. */\n private readonly _change = new Subject<Event>()\n\n private readonly _platform = inject(Platform)\n private readonly ngZone = inject(NgZone)\n private readonly _document = inject(DOCUMENT, { optional: true }) || document\n\n constructor() {\n this.ngZone.runOutsideAngular(() => {\n if (this._platform.isBrowser) {\n const window = this._getWindow()\n\n // Note that bind the events ourselves, rather than going through something like RxJS's\n // `fromEvent` so that we can ensure that they're bound outside of the NgZone.\n window.addEventListener('resize', this._changeListener)\n window.addEventListener('orientationchange', this._changeListener)\n }\n\n // Clear the cached position so that the viewport is re-measured next time it is required.\n // We don't need to keep track of the subscription, because it is completed on destroy.\n this.change().subscribe(() => (this._viewportSize = null))\n })\n }\n\n ngOnDestroy() {\n if (this._platform.isBrowser) {\n const window = this._getWindow()\n window.removeEventListener('resize', this._changeListener)\n window.removeEventListener('orientationchange', this._changeListener)\n }\n\n this._change.complete()\n }\n\n /** Returns the viewport's width and height. */\n getViewportSize(): Readonly<{ width: number; height: number }> {\n if (!this._viewportSize) {\n this._updateViewportSize()\n }\n\n const output = { width: this._viewportSize!.width, height: this._viewportSize!.height }\n\n // If we're not on a browser, don't cache the size since it'll be mocked out anyway.\n if (!this._platform.isBrowser) {\n this._viewportSize = null!\n }\n\n return output\n }\n\n /** Gets a DOMRect for the viewport's bounds. */\n getViewportRect() {\n // Use the document element's bounding rect rather than the window scroll properties\n // (e.g. pageYOffset, scrollY) due to in issue in Chrome and IE where window scroll\n // properties and client coordinates (boundingClientRect, clientX/Y, etc.) are in different\n // conceptual viewports. Under most circumstances these viewports are equivalent, but they\n // can disagree when the page is pinch-zoomed (on devices that support touch).\n // See https://bugs.chromium.org/p/chromium/issues/detail?id=489206#c4\n // We use the documentElement instead of the body because, by default (without a css reset)\n // browsers typically give the document body an 8px margin, which is not included in\n // getBoundingClientRect().\n const scrollPosition = this.getViewportScrollPosition()\n const { width, height } = this.getViewportSize()\n\n return {\n top: scrollPosition.top,\n left: scrollPosition.left,\n bottom: scrollPosition.top + height,\n right: scrollPosition.left + width,\n height,\n width,\n }\n }\n\n /** Gets the (top, left) scroll position of the viewport. */\n getViewportScrollPosition(): ViewportScrollPosition {\n // While we can get a reference to the fake document\n // during SSR, it doesn't have getBoundingClientRect.\n if (!this._platform.isBrowser) {\n return { top: 0, left: 0 }\n }\n\n // The top-left-corner of the viewport is determined by the scroll position of the document\n // body, normally just (scrollLeft, scrollTop). However, Chrome and Firefox disagree about\n // whether `document.body` or `document.documentElement` is the scrolled element, so reading\n // `scrollTop` and `scrollLeft` is inconsistent. However, using the bounding rect of\n // `document.documentElement` works consistently, where the `top` and `left` values will\n // equal negative the scroll position.\n const document = this._document\n const window = this._getWindow()\n const documentElement = document.documentElement!\n const documentRect = documentElement.getBoundingClientRect()\n\n const top = -documentRect.top || document.body.scrollTop || window.scrollY || documentElement.scrollTop || 0\n\n const left = -documentRect.left || document.body.scrollLeft || window.scrollX || documentElement.scrollLeft || 0\n\n return { top, left }\n }\n\n /**\n * Returns a stream that emits whenever the size of the viewport changes.\n * This stream emits outside of the Angular zone.\n * @param throttleTime Time in milliseconds to throttle the stream.\n */\n change(throttleTime: number = DEFAULT_RESIZE_TIME): Observable<Event> {\n return throttleTime > 0 ? this._change.pipe(auditTime(throttleTime)) : this._change\n }\n\n /** Event listener that will be used to handle the viewport change events. */\n private _changeListener = (event: Event) => {\n this._change.next(event)\n }\n\n /** Use defaultView of injected document if available or fallback to global window reference */\n private _getWindow(): Window {\n return this._document.defaultView || window\n }\n\n /** Updates the cached viewport size. */\n private _updateViewportSize() {\n this._viewportSize = this._platform.isBrowser\n ? { width: document.documentElement.clientWidth, height: document.documentElement.clientHeight }\n : { width: 0, height: 0 }\n }\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;;;;;MAQsB,yBAAyB,CAAA;AAL/C,IAAA,WAAA,GAAA;AAME,QAAA,IAAA,CAAA,cAAc,GAAG,KAAK,CAAC,QAAQ,yDAAO;QAEtC,IAAA,CAAA,OAAO,GAAG,KAAK,CAAA,IAAA,SAAA,GAAA,CAAA,SAAA,EAAA,EAAA,SAAA,EAAA,SAAA,EAAA,CAAA,GAA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AAK,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE;IAC7B;8GAjIW,mBAAmB,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,UAAA,EAAA,CAAA,CAAA;AAAnB,IAAA,SAAA,IAAA,CAAA,KAAA,GAAA,EAAA,CAAA,qBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,QAAA,EAAA,QAAA,EAAA,EAAA,EAAA,IAAA,EAAA,mBAAmB,cADN,MAAM,EAAA,CAAA,CAAA;;2FACnB,mBAAmB,EAAA,UAAA,EAAA,CAAA;kBAD/B,UAAU;mBAAC,EAAE,UAAU,EAAE,MAAM,EAAE;;;ACxBlC;;AAEG;;;;"}
|
|
1
|
+
{"version":3,"file":"quang-overlay-shared.mjs","sources":["../../../projects/quang/overlay/shared/quang-base-overlay.component.ts","../../../projects/quang/overlay/shared/quang-base-overlay.directive.ts","../../../projects/quang/overlay/shared/CustomViewportRuler.ts","../../../projects/quang/overlay/shared/quang-overlay-shared.ts"],"sourcesContent":["import { ConnectionPositionPair } from '@angular/cdk/overlay'\nimport { Component, input, signal } from '@angular/core'\n\n@Component({\n selector: 'quang-base-overlay-component',\n\n template: ``,\n})\nexport abstract class QuangBaseOverlayComponent {\n overlayContent = input.required<any>()\n\n payload = input<any>()\n\n positionPair = signal<ConnectionPositionPair | null>(null)\n}\n","import {\n ConnectedOverlayPositionChange,\n ConnectedPosition,\n FlexibleConnectedPositionStrategy,\n Overlay,\n OverlayPositionBuilder,\n OverlayRef,\n} from '@angular/cdk/overlay'\nimport { ComponentPortal, ComponentType } from '@angular/cdk/portal'\nimport {\n ComponentRef,\n DestroyRef,\n Directive,\n ElementRef,\n HostListener,\n OnDestroy,\n computed,\n inject,\n input,\n signal,\n} from '@angular/core'\nimport { takeUntilDestroyed } from '@angular/core/rxjs-interop'\n\nimport { QuangBaseOverlayComponent } from './quang-base-overlay.component'\n\n@Directive()\nexport abstract class QuangBaseOverlayDirective<T extends QuangBaseOverlayComponent> implements OnDestroy {\n targetComponentType = signal<ComponentType<T> | undefined>(undefined)\n\n /**\n * The amount of pixels needed for the popover to automatically disappear. If undefined the popover will not disappear on scroll\n * Default: 100\n * @default 100\n */\n scrollCloseThreshold = input<number | undefined>(100)\n\n showMethod = input<'click' | 'hover'>('click')\n\n content = input.required<any>()\n\n quangOverlayPayload = input<any>()\n\n closeOnClickOutside = true\n\n overlayPosition = input<\n 'top' | 'top-left' | 'top-right' | 'bottom' | 'bottom-left' | 'bottom-right' | 'left' | 'right'\n >('top')\n\n destroyRef = inject(DestroyRef)\n\n private top = signal<ConnectedPosition>({\n originX: 'center',\n originY: 'top',\n overlayX: 'center',\n overlayY: 'bottom',\n offsetY: -8,\n })\n\n private topLeft = signal<ConnectedPosition>({\n originX: 'start',\n originY: 'top',\n overlayX: 'end',\n overlayY: 'bottom',\n offsetY: -8,\n offsetX: 40,\n })\n\n private topRight = signal<ConnectedPosition>({\n originX: 'end',\n originY: 'top',\n overlayX: 'end',\n overlayY: 'bottom',\n offsetY: -8,\n offsetX: 40,\n })\n\n private bottom = signal<ConnectedPosition>({\n originX: 'center',\n originY: 'bottom',\n overlayX: 'center',\n overlayY: 'top',\n offsetY: 8,\n })\n\n private bottomLeft = signal<ConnectedPosition>({\n originX: 'start',\n originY: 'bottom',\n overlayX: 'end',\n overlayY: 'top',\n offsetY: 8,\n offsetX: 40,\n })\n\n private bottomRight = signal<ConnectedPosition>({\n originX: 'end',\n originY: 'bottom',\n overlayX: 'end',\n overlayY: 'top',\n offsetY: 8,\n offsetX: 40,\n })\n\n private left = signal<ConnectedPosition>({\n originX: 'start',\n originY: 'center',\n overlayX: 'end',\n overlayY: 'center',\n offsetX: -8,\n })\n\n private right = signal<ConnectedPosition>({\n originX: 'end',\n originY: 'center',\n overlayX: 'start',\n overlayY: 'center',\n offsetX: 8,\n })\n\n tooltipPosition = computed((): ConnectedPosition[] => {\n switch (this.overlayPosition()) {\n case 'top':\n return [this.top(), this.bottom()]\n case 'top-left':\n return [this.topLeft(), this.bottomLeft()]\n case 'top-right':\n return [this.topRight(), this.bottomRight()]\n case 'bottom':\n return [this.bottom(), this.top()]\n case 'bottom-left':\n return [this.bottomLeft(), this.topLeft()]\n case 'bottom-right':\n return [this.bottomRight(), this.topRight()]\n case 'left':\n return [this.left(), this.right()]\n case 'right':\n return [this.right(), this.left()]\n default:\n return [this.top(), this.bottom()]\n }\n })\n\n private overlayRef = signal<OverlayRef | null>(null)\n\n private readonly overlay = signal(inject(Overlay))\n\n private readonly overlayPositionBuilder = signal(inject(OverlayPositionBuilder))\n\n private readonly elementRef = signal(inject(ElementRef))\n\n private positionStrategy = signal<FlexibleConnectedPositionStrategy | undefined>(undefined)\n\n private componentOverlayRef = signal<ComponentRef<T> | null>(null)\n\n @HostListener('click') onClick(): void {\n if (this.showMethod() === 'click') this.showHideOverlay()\n }\n\n @HostListener('mouseenter') onHover(): void {\n if (this.showMethod() === 'hover') this.showHideOverlay()\n }\n\n @HostListener('mouseleave') onLeave(): void {\n if (this.showMethod() === 'hover') this.detachOverlay()\n }\n\n attachOverlay(): void {\n const targetComponentType = this.targetComponentType()\n if (!targetComponentType) {\n return\n }\n this.positionStrategy.set(\n this.overlayPositionBuilder().flexibleConnectedTo(this.elementRef()).withPositions(this.tooltipPosition())\n )\n\n this.overlayRef.set(\n this.overlay().create({\n positionStrategy: this.positionStrategy(),\n scrollStrategy: this.scrollCloseThreshold()\n ? this.overlay().scrollStrategies.close({ threshold: this.scrollCloseThreshold() })\n : this.overlay().scrollStrategies.noop(),\n hasBackdrop: this.showMethod() === 'click',\n backdropClass: '',\n })\n )\n\n const componentPortal = new ComponentPortal(targetComponentType)\n const createdOverlay = this.overlayRef()\n if (createdOverlay) {\n this.componentOverlayRef.set(createdOverlay.attach(componentPortal))\n const componentOverlayRefInstance = this.componentOverlayRef()?.instance\n if (componentOverlayRefInstance) {\n componentOverlayRefInstance.overlayContent = this.content\n componentOverlayRefInstance.payload = this.quangOverlayPayload\n }\n }\n this.positionStrategy()\n ?.positionChanges.pipe(takeUntilDestroyed(this.destroyRef))\n .subscribe((position) => {\n const positionRef: ConnectedOverlayPositionChange = position as ConnectedOverlayPositionChange\n const componentOverlayRefInstance = this.componentOverlayRef()?.instance\n if (componentOverlayRefInstance) {\n componentOverlayRefInstance.positionPair.set(positionRef.connectionPair)\n }\n })\n this.overlayRef()\n ?.backdropClick()\n .pipe(takeUntilDestroyed(this.destroyRef))\n .subscribe(() => {\n if (this.closeOnClickOutside) {\n this.detachOverlay()\n }\n })\n }\n\n detachOverlay(): void {\n this.overlayRef()?.detach()\n this.overlayRef()?.dispose()\n }\n\n showHideOverlay(): void {\n if (this.overlayRef()?.hasAttached()) {\n this.detachOverlay()\n } else {\n this.attachOverlay()\n }\n }\n\n ngOnDestroy(): void {\n this.detachOverlay()\n }\n}\n","import { Platform } from '@angular/cdk/platform'\nimport { DEFAULT_RESIZE_TIME, ViewportScrollPosition } from '@angular/cdk/scrolling'\nimport { DOCUMENT } from '@angular/common'\nimport { Injectable, NgZone, OnDestroy, inject } from '@angular/core'\n\nimport { Observable, Subject, auditTime } from 'rxjs'\n\n/**\n * Class cloe of [ViewportRuler](https://github.com/angular/components/blob/master/src/cdk/scrolling/viewport-ruler.ts)\n * To fix the wrong reported size of the viewport on mobile devices with hidden url bars\n * Issues references:\n * https://github.com/angular/components/issues/18890\n * https://github.com/angular/components/issues/27739\n *\n * To use this component provide it instead of `ViewportRuler`\n *\n * @example\n * providers: [\n * {\n * provide: ViewportRuler,\n * useClass: CustomViewportRuler\n * }\n * ]\n */\n@Injectable({ providedIn: 'root' })\nexport class CustomViewportRuler implements OnDestroy {\n /** Used to reference correct document/window */\n // protected _document: Document\n /** Cached viewport dimensions. */\n private _viewportSize: { width: number; height: number } | null = null\n /** Stream of viewport change events. */\n private readonly _change = new Subject<Event>()\n\n private readonly _platform = inject(Platform)\n private readonly ngZone = inject(NgZone)\n private readonly _document = inject(DOCUMENT, { optional: true }) || document\n\n constructor() {\n this.ngZone.runOutsideAngular(() => {\n if (this._platform.isBrowser) {\n const window = this._getWindow()\n\n // Note that bind the events ourselves, rather than going through something like RxJS's\n // `fromEvent` so that we can ensure that they're bound outside of the NgZone.\n window.addEventListener('resize', this._changeListener)\n window.addEventListener('orientationchange', this._changeListener)\n }\n\n // Clear the cached position so that the viewport is re-measured next time it is required.\n // We don't need to keep track of the subscription, because it is completed on destroy.\n this.change().subscribe(() => (this._viewportSize = null))\n })\n }\n\n ngOnDestroy() {\n if (this._platform.isBrowser) {\n const window = this._getWindow()\n window.removeEventListener('resize', this._changeListener)\n window.removeEventListener('orientationchange', this._changeListener)\n }\n\n this._change.complete()\n }\n\n /** Returns the viewport's width and height. */\n getViewportSize(): Readonly<{ width: number; height: number }> {\n if (!this._viewportSize) {\n this._updateViewportSize()\n }\n\n const output = { width: this._viewportSize!.width, height: this._viewportSize!.height }\n\n // If we're not on a browser, don't cache the size since it'll be mocked out anyway.\n if (!this._platform.isBrowser) {\n this._viewportSize = null!\n }\n\n return output\n }\n\n /** Gets a DOMRect for the viewport's bounds. */\n getViewportRect() {\n // Use the document element's bounding rect rather than the window scroll properties\n // (e.g. pageYOffset, scrollY) due to in issue in Chrome and IE where window scroll\n // properties and client coordinates (boundingClientRect, clientX/Y, etc.) are in different\n // conceptual viewports. Under most circumstances these viewports are equivalent, but they\n // can disagree when the page is pinch-zoomed (on devices that support touch).\n // See https://bugs.chromium.org/p/chromium/issues/detail?id=489206#c4\n // We use the documentElement instead of the body because, by default (without a css reset)\n // browsers typically give the document body an 8px margin, which is not included in\n // getBoundingClientRect().\n const scrollPosition = this.getViewportScrollPosition()\n const { width, height } = this.getViewportSize()\n\n return {\n top: scrollPosition.top,\n left: scrollPosition.left,\n bottom: scrollPosition.top + height,\n right: scrollPosition.left + width,\n height,\n width,\n }\n }\n\n /** Gets the (top, left) scroll position of the viewport. */\n getViewportScrollPosition(): ViewportScrollPosition {\n // While we can get a reference to the fake document\n // during SSR, it doesn't have getBoundingClientRect.\n if (!this._platform.isBrowser) {\n return { top: 0, left: 0 }\n }\n\n // The top-left-corner of the viewport is determined by the scroll position of the document\n // body, normally just (scrollLeft, scrollTop). However, Chrome and Firefox disagree about\n // whether `document.body` or `document.documentElement` is the scrolled element, so reading\n // `scrollTop` and `scrollLeft` is inconsistent. However, using the bounding rect of\n // `document.documentElement` works consistently, where the `top` and `left` values will\n // equal negative the scroll position.\n const document = this._document\n const window = this._getWindow()\n const documentElement = document.documentElement!\n const documentRect = documentElement.getBoundingClientRect()\n\n const top = -documentRect.top || document.body.scrollTop || window.scrollY || documentElement.scrollTop || 0\n\n const left = -documentRect.left || document.body.scrollLeft || window.scrollX || documentElement.scrollLeft || 0\n\n return { top, left }\n }\n\n /**\n * Returns a stream that emits whenever the size of the viewport changes.\n * This stream emits outside of the Angular zone.\n * @param throttleTime Time in milliseconds to throttle the stream.\n */\n change(throttleTime: number = DEFAULT_RESIZE_TIME): Observable<Event> {\n return throttleTime > 0 ? this._change.pipe(auditTime(throttleTime)) : this._change\n }\n\n /** Event listener that will be used to handle the viewport change events. */\n private _changeListener = (event: Event) => {\n this._change.next(event)\n }\n\n /** Use defaultView of injected document if available or fallback to global window reference */\n private _getWindow(): Window {\n return this._document.defaultView || window\n }\n\n /** Updates the cached viewport size. */\n private _updateViewportSize() {\n this._viewportSize = this._platform.isBrowser\n ? { width: document.documentElement.clientWidth, height: document.documentElement.clientHeight }\n : { width: 0, height: 0 }\n }\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;;;;;MAQsB,yBAAyB,CAAA;AAL/C,IAAA,WAAA,GAAA;AAME,QAAA,IAAA,CAAA,cAAc,GAAG,KAAK,CAAC,QAAQ,yDAAO;QAEtC,IAAA,CAAA,OAAO,GAAG,KAAK,CAAA,IAAA,SAAA,GAAA,CAAA,SAAA,EAAA,EAAA,SAAA,EAAA,SAAA,EAAA,CAAA,GAAA,EAAA,CAAA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