@filip.mazev/modal 0.0.3 → 0.0.5

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.
Files changed (36) hide show
  1. package/fesm2022/filip.mazev-modal.mjs +97 -61
  2. package/fesm2022/filip.mazev-modal.mjs.map +1 -1
  3. package/package.json +4 -5
  4. package/src/assets/default-theme.css +1 -1
  5. package/types/filip.mazev-modal.d.ts +510 -0
  6. package/index.d.ts +0 -5
  7. package/lib/classes/generic-modal-config.d.ts +0 -26
  8. package/lib/classes/generic-modal-ref.d.ts +0 -52
  9. package/lib/classes/generic-modal-style.config.d.ts +0 -17
  10. package/lib/classes/generic-modal.d.ts +0 -19
  11. package/lib/components/generic-modal.d.ts +0 -60
  12. package/lib/components/views/backdrop/modal-backdrop.d.ts +0 -8
  13. package/lib/components/views/banner/modal-banner.d.ts +0 -9
  14. package/lib/components/views/centered/modal-centered.d.ts +0 -23
  15. package/lib/components/views/side/modal-side.d.ts +0 -26
  16. package/lib/components/views/swipeable/modal-swipeable.d.ts +0 -32
  17. package/lib/constants/generic-modal-animation.constants.d.ts +0 -4
  18. package/lib/constants/generic-modal-common.constants.d.ts +0 -1
  19. package/lib/constants/generic-modal-swipe.constants.d.ts +0 -3
  20. package/lib/constants/generic-modal-text.constants.d.ts +0 -4
  21. package/lib/enums/generic-modal-errors.enum.d.ts +0 -6
  22. package/lib/enums/generic-modal-state.enum.d.ts +0 -6
  23. package/lib/enums/generic-modal-warnings.enum.d.ts +0 -7
  24. package/lib/interfaces/igeneric-close-result.interface.d.ts +0 -5
  25. package/lib/interfaces/igeneric-confirm-close.interface.d.ts +0 -24
  26. package/lib/interfaces/igeneric-modal-component.interface.d.ts +0 -28
  27. package/lib/interfaces/igeneric-modal-config.interface.d.ts +0 -45
  28. package/lib/interfaces/igeneric-modal-ref.interface.d.ts +0 -25
  29. package/lib/interfaces/igeneric-modal-service.interface.d.ts +0 -22
  30. package/lib/interfaces/igeneric-modal-style-config.interface.d.ts +0 -28
  31. package/lib/interfaces/igeneric-modal-view.interface.d.ts +0 -18
  32. package/lib/interfaces/igeneric-swipeable-modal-config.d.ts +0 -5
  33. package/lib/services/generic-modal.service.d.ts +0 -40
  34. package/lib/tokens/generic-modal-data.token.d.ts +0 -2
  35. package/lib/types/modal.types.d.ts +0 -2
  36. package/public-api.d.ts +0 -29
@@ -0,0 +1,510 @@
1
+ import * as _angular_core from '@angular/core';
2
+ import { Type, ComponentRef, OnDestroy, ViewContainerRef, Renderer2, Injector, OnInit, TemplateRef, ElementRef, InputSignal, OutputEmitterRef, QueryList, ChangeDetectorRef, InjectionToken } from '@angular/core';
3
+ import { Observable, Subject } from 'rxjs';
4
+ import { ComponentType } from '@angular/cdk/portal';
5
+ import * as _filip_mazev_modal from '@filip.mazev/modal';
6
+ import { WindowDimensions } from 'common-parts';
7
+
8
+ type ModalCloseMode = "cancel" | "confirm";
9
+ type ModalPoistion = "center" | "right" | "left";
10
+
11
+ interface IGenericSwipeableModalConfig {
12
+ upSwipeLimit?: number;
13
+ downSwipeLimit?: number;
14
+ customHeight?: number;
15
+ }
16
+
17
+ /**
18
+ * IGenericModalStyleConfig
19
+ * @param {center' | 'left' | 'right'} position (optional) The position of the modal (can be center, left, or right), will default to center
20
+ * @param {boolean} handleMobile (optional) Whether the modal should open in a mobile configuration when going to a certain screen size
21
+ * @param {boolean} animate (optional) Whether the modal should have animations or not, will default to true
22
+ * @param {boolean} hasBackdrop (optional) Whether the modal should have a backdrop or not, will default to true
23
+ * @param {number} closeDelay (optional) The delay in milliseconds before the modal closes, will default to GENERIC_MODAL_DEFAULT_ANIM_DURATION (175)
24
+ * @param {IGenericSwipeableModalConfig} mobileConfig (optional) The configuration for the swipeable modal, will default to an empty object
25
+ * @param {boolean} contentWrapper (optional) Whether the content should be wrapped in a default-styled div or not, will default to true
26
+ * @param {string} wrapperClasses (optional) The classes to apply to the wrapper of the modal
27
+ * @param {string} wrapperStyles (optional) The styles to apply to the wrapper of the modal
28
+ * @param {boolean} overrideFullHeight (optional) Whether the modal should override the full height of the modal or not, will default to false
29
+ */
30
+ interface IGenericModalStyleConfig {
31
+ position?: ModalPoistion;
32
+ handleMobile?: boolean;
33
+ animate?: boolean;
34
+ hasBackdrop?: boolean;
35
+ closeDelay?: number;
36
+ showCloseButton?: boolean;
37
+ mobileConfig?: IGenericSwipeableModalConfig;
38
+ contentWrapper?: boolean;
39
+ wrapperClasses?: string;
40
+ wrapperStyles?: string;
41
+ overrideFullHeight?: boolean;
42
+ }
43
+
44
+ /**
45
+ * Interface for the Generic Confirm Close Modal
46
+ * @param {ComponentType<any>} confirmModalComponent The component to use for the confirm modal
47
+ * @param {boolean} confirmClose (required) Whether the modal should confirm close or not
48
+ * @param {boolean} confirmOnSubmit (optional) Whether the modal should confirm on submit or not, will default to false (if false, will only need to confirm when close state is 'cancel')
49
+ * @param {IGenericModalStyleConfig} style (optional) The style configuration for the modal
50
+ * @param {D | null} data (optional) The data to pass to the component of the modal, the component needs to have the @Inject(GENERIC_MODAL_DATA) data: any; decorator to receive this data
51
+ * @param {string} bannerText (optional) The text to display in the banner of the modal
52
+ * @param {string[]} bannerIcons (optional) The icons to display in the banner of the modal
53
+ * @param {boolean} bypassSelfCheck (optional) Whether the modal should bypass the self check or not, will default to false (if true, will not check if the modal is the same as the one that opened it)
54
+ */
55
+ interface IGenericConfirmCloseConfig<ConfirmComponentData = any, ConfirmComponent extends GenericModal<ConfirmComponentData, undefined> = GenericModal<ConfirmComponentData, undefined>> {
56
+ confirmModalComponent: ComponentType<ConfirmComponent>;
57
+ confirmClose: boolean;
58
+ confirmOnSubmit?: boolean;
59
+ style?: IGenericModalStyleConfig;
60
+ data?: ConfirmComponentData | null;
61
+ bannerText?: string;
62
+ bannerIcons?: string[];
63
+ bypassSelfCheck?: boolean;
64
+ }
65
+
66
+ /**
67
+ * IGenericModalConfig<D>, the configuration for the generic modal
68
+ * @param {boolean} open (optional) Whether the modal should be open or not, will default to true
69
+ * @param {Function} afterClose (optional) The function to run after the modal closes
70
+ * @param {IGenericConfirmCloseConfig<ConfirmComponent, ConfirmComponentData>} confirmCloseConfig (optional) The configuration for the confirm close modal, will default to { confirmClose: false }
71
+ * @param {boolean} disableClose (optional) Whether the modal should be closable or not, will default to false (this applies to the close button and backdrop)
72
+ * @param {boolean} disableCloseOnBackdropClick (optional) Whether the modal shouldn't be closable when the user clicks on the backdrop, will default to false
73
+ * @param {boolean} disableCloseOnNavigation (optional) Whether the modal should be closable or not when the user navigates away from the page, will default to false
74
+ * @param {boolean} enableExtremeOverflowHandling (optional) Whether the modal should enable the extreme overflow handling (may cause issues with keypress registration) or not, will default to false
75
+ * @param {boolean} webkitOnlyOverflowMobileHandling (optional) Whether the modal should only handle overflow for webkit browsers on mobile or should it handle it for all browsers, will default to true
76
+ * @param {boolean} closeOnSwipeBack (optional) Whether the modal should close when swiped back on mobile devices, will default to false
77
+ * @param {D | null} data (optional) The data to pass to the component of the modal, the component needs to have the @Inject(GENERIC_MODAL_DATA) data: any; decorator to receive this data
78
+ * @param {IGenericModalStyleConfig} style (optional) The style configuration for the modal, will default to an empty object
79
+ * @param {boolean} showCloseButton (optional) Whether the modal should show a close button or not, will default to true
80
+ * @param {string} bannerText (optional) The text to display in the banner of the modal
81
+ * @param {string} bannerTextAnnotatedString (optional) The annotated string (in bold style, in addition to some text) to display in the banner of the modal, will default to an empty string
82
+ * @param {string[]} bannerIcons (optional) The icons to display in the banner of the modal
83
+ * @param {string} contentClasses (optional) The classes to apply to the content of the modal
84
+ * @param {string} contentStyles (optional) The styles to apply to the content of the modal
85
+ * @param {string} id (optional) The id of the modal (set at the top level of the modal), will default to a random string
86
+ */
87
+ interface IGenericModalConfig<D = undefined, ConfirmComponentData = any, ConfirmComponent extends GenericModal<ConfirmComponentData, undefined> = GenericModal<ConfirmComponentData, undefined>> {
88
+ open?: boolean;
89
+ afterClose?: Function;
90
+ confirmCloseConfig?: IGenericConfirmCloseConfig<ConfirmComponentData, ConfirmComponent>;
91
+ disableClose?: boolean;
92
+ disableCloseOnBackdropClick?: boolean;
93
+ disableCloseOnNavigation?: boolean;
94
+ enableExtremeOverflowHandling?: boolean;
95
+ webkitOnlyOverflowMobileHandling?: boolean;
96
+ closeOnSwipeBack?: boolean;
97
+ data?: D | null;
98
+ style?: IGenericModalStyleConfig;
99
+ bannerText?: string;
100
+ bannerTextAnnotatedString?: string;
101
+ bannerIcons?: string[];
102
+ contentClasses?: string;
103
+ contentStyles?: string;
104
+ disableConsoleWarnings?: boolean;
105
+ disableConsoleInfo?: boolean;
106
+ id?: string;
107
+ }
108
+
109
+ declare class GenericModalConfig<D = unknown, ConfirmComponentData = any, ConfirmComponent extends GenericModal<ConfirmComponentData, undefined> = GenericModal<ConfirmComponentData, undefined>> {
110
+ open: boolean;
111
+ afterClose?: Function;
112
+ confirmCloseConfig?: IGenericConfirmCloseConfig<ConfirmComponentData, ConfirmComponent>;
113
+ disableClose: boolean;
114
+ disableCloseOnBackdropClick: boolean;
115
+ disableCloseOnNavigation: boolean;
116
+ enableExtremeOverflowHandling?: boolean;
117
+ webkitOnlyOverflowMobileHandling?: boolean;
118
+ closeOnSwipeBack: boolean;
119
+ data: D | null;
120
+ style: IGenericModalStyleConfig;
121
+ bannerText: string;
122
+ bannerTextAnnotatedString: string;
123
+ bannerIcons: string[];
124
+ contentClasses: string;
125
+ contentStyles: string;
126
+ disableConsoleWarnings: boolean;
127
+ disableConsoleInfo: boolean;
128
+ id: string;
129
+ constructor(config?: IGenericModalConfig<D, ConfirmComponentData, ConfirmComponent>);
130
+ }
131
+
132
+ declare enum GenericModalState {
133
+ OPEN = "open",
134
+ OPENING = "opening",
135
+ CLOSED = "closed",
136
+ CLOSING = "closing"
137
+ }
138
+
139
+ interface IGenericCloseResult<R = any> {
140
+ data?: R;
141
+ state: ModalCloseMode;
142
+ }
143
+
144
+ interface IGenericModalRef<D = any, R = any, C extends GenericModal<D, R> = GenericModal<D, R>> {
145
+ modalContainer: Type<GenericModalComponent<D, R, C>>;
146
+ modalContainerRef: ComponentRef<GenericModalComponent<D, R, C>>;
147
+ modalContainerElement: HTMLElement;
148
+ parentElement?: HTMLElement;
149
+ componentRef: ComponentRef<C>;
150
+ modalState$(): Observable<GenericModalState>;
151
+ selfIdentifier: {
152
+ constructor: Function;
153
+ };
154
+ modalConfig?: GenericModalConfig<D>;
155
+ afterClosed(): Observable<IGenericCloseResult<R>>;
156
+ backdropClick(): Observable<MouseEvent>;
157
+ open(): void;
158
+ close: (state: "confirm" | "cancel", result: R | undefined, forceClose: boolean, fromSelf: boolean, from: {
159
+ constructor: Function;
160
+ } | undefined) => void;
161
+ }
162
+
163
+ interface IGenericModalService extends OnDestroy {
164
+ viewContainer?: ViewContainerRef;
165
+ register: (viewContainer: ViewContainerRef, renderer: Renderer2) => void;
166
+ open: (component: ComponentType<any>, config?: IGenericModalConfig<any>) => GenericModalRef<any, any, any>;
167
+ close: (self: {
168
+ constructor: Function;
169
+ }, fromCloseFunction: boolean | undefined) => void;
170
+ closeAll: () => void;
171
+ get: (self: {
172
+ constructor: Function;
173
+ }) => GenericModalRef<any, any, any> | GenericModalComponent<any, any, any> | undefined;
174
+ getSubscribe(self: {
175
+ constructor: Function;
176
+ }): Observable<GenericModalRef<any, any, any> | GenericModalComponent<any, any, any> | undefined>;
177
+ modalsCount: () => number;
178
+ }
179
+
180
+ declare class GenericModalService implements IGenericModalService {
181
+ private router;
182
+ protected injector: Injector;
183
+ private modals;
184
+ private modalsSubject;
185
+ viewContainer?: ViewContainerRef;
186
+ renderer?: Renderer2;
187
+ private unsubscribe$;
188
+ constructor();
189
+ ngOnDestroy(): void;
190
+ private createSubscriptions;
191
+ register(viewContainer: ViewContainerRef, renderer: Renderer2): void;
192
+ open<D, R, C extends GenericModal<D, R> = GenericModal<D, R>>(component: ComponentType<C>, config?: IGenericModalConfig<D>): GenericModalRef<D, R, C>;
193
+ close(self: {
194
+ constructor: Function;
195
+ }, fromCloseFunction?: boolean | undefined): void;
196
+ closeAll(onNavigate?: boolean): void;
197
+ get<D, R, C extends GenericModal<D, R> = GenericModal<D, R>>(self: {
198
+ constructor: Function;
199
+ }): GenericModalRef<D, R, C> | GenericModalComponent<D, R, C> | undefined;
200
+ getSubscribe<D, R, C extends GenericModal<D, R> = GenericModal<D, R>>(self: {
201
+ constructor: Function;
202
+ }): Observable<GenericModalRef<D, R, C> | GenericModalComponent<D, R, C> | undefined>;
203
+ modalsCount(): number;
204
+ find(self: {
205
+ constructor: Function;
206
+ }): boolean;
207
+ modalRequestedTypeCheck(modal: GenericModalRef | GenericModalComponent | undefined): boolean;
208
+ static ɵfac: _angular_core.ɵɵFactoryDeclaration<GenericModalService, never>;
209
+ static ɵprov: _angular_core.ɵɵInjectableDeclaration<GenericModalService>;
210
+ }
211
+
212
+ declare class GenericModalRef<D = unknown, R = any, C extends GenericModal<D, R> = GenericModal<D, R>> implements IGenericModalRef<D, R, C> {
213
+ private modalService;
214
+ private _modalContainer;
215
+ private set modalContainer(value);
216
+ get modalContainer(): Type<GenericModalComponent<D, R, C>>;
217
+ private _modalContainerRef;
218
+ private set modalContainerRef(value);
219
+ get modalContainerRef(): ComponentRef<GenericModalComponent<D, R, C>>;
220
+ private _modalContainerElement;
221
+ private set modalContainerElement(value);
222
+ get modalContainerElement(): HTMLElement;
223
+ private _parentElement;
224
+ private set parentElement(value);
225
+ get parentElement(): HTMLElement | undefined;
226
+ private _componentRef;
227
+ private set componentRef(value);
228
+ get componentRef(): ComponentRef<C>;
229
+ private _modalState;
230
+ private modalState;
231
+ modalState$(): Observable<GenericModalState>;
232
+ private getStatus;
233
+ private _selfIdentifier;
234
+ private set selfIdentifier(value);
235
+ get selfIdentifier(): {
236
+ constructor: Function;
237
+ };
238
+ private _modalConfig?;
239
+ private set modalConfig(value);
240
+ get modalConfig(): GenericModalConfig<D> | undefined;
241
+ private backdropClickSubject;
242
+ backdropClick(): Observable<MouseEvent>;
243
+ private backdropClicked;
244
+ private afterCloseSubject;
245
+ afterClosed(): Observable<IGenericCloseResult<R>>;
246
+ private afterClose;
247
+ constructor(componentRef: ComponentRef<C>, selfIdentifier: {
248
+ constructor: Function;
249
+ }, modalContainerRef: ComponentRef<GenericModalComponent<D, R, C>>, modalService: GenericModalService, modalConfig?: GenericModalConfig<D>);
250
+ open(): Promise<void>;
251
+ close(state?: ModalCloseMode, result?: R | undefined, forceClose?: boolean): void;
252
+ private handleClose;
253
+ }
254
+
255
+ declare abstract class GenericModal<D, R> implements OnDestroy {
256
+ protected genericModalService: GenericModalService;
257
+ modal?: GenericModalRef<D, R>;
258
+ protected modalGetSubscription$: Subject<void>;
259
+ constructor();
260
+ ngOnDestroy(): void;
261
+ protected createModalSubscription(): void;
262
+ protected unsubscribeModalGet(): void;
263
+ abstract afterModalGet(): void;
264
+ abstract onDestroy(): void;
265
+ close(): void;
266
+ static ɵfac: _angular_core.ɵɵFactoryDeclaration<GenericModal<any, any>, never>;
267
+ static ɵprov: _angular_core.ɵɵInjectableDeclaration<GenericModal<any, any>>;
268
+ }
269
+
270
+ /**
271
+ * Interface for the Generic Modal Component
272
+ * @param {ComponentRef<any>} componentRef (optional) The component reference (the component that is being displayed in the modal), will default to undefined (for non-dynamic modals)
273
+ * @param {GenericModalConfig} config (optional) The configuration for the modal, will default to default values for the configuration
274
+ * @param {boolean} isOpen (required) Whether the modal is open or not
275
+ * @param {number} animationDuration (required) The duration of the animation (in milliseconds)
276
+ * @param {boolean} isSwipeableModalActive (required) Whether the swipeable modal is active (open) or not
277
+ * @param {Subject<MouseEvent>} backdropClickSubject (required) The subject for the backdrop click event, will be used to listen for backdrop clicks
278
+ * @param {Observable<MouseEvent>} backdropClick (required) The observable for the backdrop click event, will be used to listen for backdrop clicks (subscribed to the backdropClickSubject)
279
+ * @param {Function} closeFunction (optional) The outside function to run when the modal closes (received from the config)
280
+ * @param {Function} close (required) The function to run when the modal closes, will return the result of the modal
281
+ * @param {Function} setFooterTemplate (required) The function to set the footer template of the modal
282
+ */
283
+ interface IGenericModalComponenet<D = any, R = any, C extends GenericModal<D, R> = GenericModal<D, R>> extends OnInit, OnDestroy {
284
+ componentRef?: ComponentRef<C>;
285
+ config?: GenericModalConfig<D>;
286
+ isOpen: boolean;
287
+ animationDuration: number;
288
+ isSwipeableModalActive: boolean;
289
+ backdropClickSubject: Subject<MouseEvent>;
290
+ backdropClick: Observable<MouseEvent>;
291
+ closeFunction?: Function;
292
+ close: (state: ModalCloseMode, result: R | undefined, fromInsideInteraction: boolean, forceClose: boolean) => void;
293
+ setFooterTemplate: (template: TemplateRef<any>) => void;
294
+ }
295
+
296
+ declare class ModalSwipeable implements OnInit, OnDestroy {
297
+ readonly footerTemplate: _angular_core.InputSignal<TemplateRef<any> | null>;
298
+ readonly config: _angular_core.InputSignal<GenericModalConfig<any, any, _filip_mazev_modal.GenericModal<any, undefined>> | undefined>;
299
+ readonly isOpen: _angular_core.InputSignal<boolean>;
300
+ readonly isAnimated: _angular_core.InputSignal<boolean>;
301
+ readonly animationDuration: _angular_core.InputSignal<number>;
302
+ readonly close: _angular_core.OutputEmitterRef<ModalCloseMode | undefined>;
303
+ currentTranslateY: number;
304
+ isSwipingVerticallyFinished: boolean;
305
+ protected isSwipingVertically: boolean;
306
+ protected downSwipeLimit: number;
307
+ protected upSwipeLimit: number;
308
+ protected windowInnerHeight: number;
309
+ protected isTrackingSwipe: boolean;
310
+ private isTouchActive;
311
+ private swipeableModalInitiated;
312
+ private globalPointerListenerAdded;
313
+ private touchDetectionUnsubscribe$;
314
+ verticalSwipeTarget?: ElementRef;
315
+ modalContent?: ElementRef;
316
+ ngOnInit(): void;
317
+ ngOnDestroy(): void;
318
+ private startVerticalSwipeDetection;
319
+ private stopVerticalSwipeDetection;
320
+ private initSwipeableModalParams;
321
+ private monitorInputType;
322
+ static ɵfac: _angular_core.ɵɵFactoryDeclaration<ModalSwipeable, never>;
323
+ static ɵcmp: _angular_core.ɵɵComponentDeclaration<ModalSwipeable, "modal-swipeable", never, { "footerTemplate": { "alias": "footerTemplate"; "required": true; "isSignal": true; }; "config": { "alias": "config"; "required": true; "isSignal": true; }; "isOpen": { "alias": "isOpen"; "required": true; "isSignal": true; }; "isAnimated": { "alias": "isAnimated"; "required": true; "isSignal": true; }; "animationDuration": { "alias": "animationDuration"; "required": true; "isSignal": true; }; }, { "close": "close"; }, never, ["*"], true, never>;
324
+ }
325
+
326
+ interface IGenericModalView<D = unknown> {
327
+ footerTemplate: InputSignal<TemplateRef<any> | null>;
328
+ config: InputSignal<GenericModalConfig<D> | undefined>;
329
+ isOpen: InputSignal<boolean>;
330
+ isAnimated: InputSignal<boolean>;
331
+ isSwipeableModalActive: InputSignal<boolean>;
332
+ animationDuration: InputSignal<number>;
333
+ hasDefaultContentWrapperClass: InputSignal<boolean>;
334
+ hasBanner: InputSignal<boolean>;
335
+ close: OutputEmitterRef<ModalCloseMode | undefined>;
336
+ swipeableComponents: QueryList<ModalSwipeable>;
337
+ get modalClasses(): {
338
+ [key: string]: boolean;
339
+ };
340
+ }
341
+
342
+ declare class ModalCentered<D = unknown> implements IGenericModalView<D> {
343
+ readonly footerTemplate: _angular_core.InputSignal<TemplateRef<any> | null>;
344
+ readonly config: _angular_core.InputSignal<GenericModalConfig<D, any, _filip_mazev_modal.GenericModal<any, undefined>> | undefined>;
345
+ readonly isOpen: _angular_core.InputSignal<boolean>;
346
+ readonly isAnimated: _angular_core.InputSignal<boolean>;
347
+ readonly isSwipeableModalActive: _angular_core.InputSignal<boolean>;
348
+ readonly animationDuration: _angular_core.InputSignal<number>;
349
+ readonly hasDefaultContentWrapperClass: _angular_core.InputSignal<boolean>;
350
+ readonly hasBanner: _angular_core.InputSignal<boolean>;
351
+ readonly close: _angular_core.OutputEmitterRef<ModalCloseMode | undefined>;
352
+ readonly onBackdropClick: _angular_core.OutputEmitterRef<MouseEvent>;
353
+ swipeableComponents: QueryList<ModalSwipeable>;
354
+ get modalClasses(): {
355
+ [key: string]: boolean;
356
+ };
357
+ static ɵfac: _angular_core.ɵɵFactoryDeclaration<ModalCentered<any>, never>;
358
+ static ɵcmp: _angular_core.ɵɵComponentDeclaration<ModalCentered<any>, "modal-centered", never, { "footerTemplate": { "alias": "footerTemplate"; "required": true; "isSignal": true; }; "config": { "alias": "config"; "required": true; "isSignal": true; }; "isOpen": { "alias": "isOpen"; "required": true; "isSignal": true; }; "isAnimated": { "alias": "isAnimated"; "required": true; "isSignal": true; }; "isSwipeableModalActive": { "alias": "isSwipeableModalActive"; "required": true; "isSignal": true; }; "animationDuration": { "alias": "animationDuration"; "required": true; "isSignal": true; }; "hasDefaultContentWrapperClass": { "alias": "hasDefaultContentWrapperClass"; "required": true; "isSignal": true; }; "hasBanner": { "alias": "hasBanner"; "required": true; "isSignal": true; }; }, { "close": "close"; "onBackdropClick": "onBackdropClick"; }, never, ["*"], true, never>;
359
+ }
360
+
361
+ declare class ModalSide<D = unknown> implements IGenericModalView<D> {
362
+ readonly footerTemplate: _angular_core.InputSignal<TemplateRef<any> | null>;
363
+ readonly config: _angular_core.InputSignal<GenericModalConfig<D, any, _filip_mazev_modal.GenericModal<any, undefined>> | undefined>;
364
+ readonly isOpen: _angular_core.InputSignal<boolean>;
365
+ private _innerIsOpen;
366
+ set innerIsOpen(value: boolean);
367
+ get innerIsOpen(): boolean;
368
+ readonly isAnimated: _angular_core.InputSignal<boolean>;
369
+ readonly isSwipeableModalActive: _angular_core.InputSignal<boolean>;
370
+ readonly animationDuration: _angular_core.InputSignal<number>;
371
+ readonly hasDefaultContentWrapperClass: _angular_core.InputSignal<boolean>;
372
+ readonly hasBanner: _angular_core.InputSignal<boolean>;
373
+ readonly close: _angular_core.OutputEmitterRef<ModalCloseMode | undefined>;
374
+ swipeableComponents: QueryList<ModalSwipeable>;
375
+ constructor();
376
+ get modalClasses(): {
377
+ [key: string]: boolean;
378
+ };
379
+ static ɵfac: _angular_core.ɵɵFactoryDeclaration<ModalSide<any>, never>;
380
+ static ɵcmp: _angular_core.ɵɵComponentDeclaration<ModalSide<any>, "modal-side", never, { "footerTemplate": { "alias": "footerTemplate"; "required": true; "isSignal": true; }; "config": { "alias": "config"; "required": true; "isSignal": true; }; "isOpen": { "alias": "isOpen"; "required": true; "isSignal": true; }; "isAnimated": { "alias": "isAnimated"; "required": true; "isSignal": true; }; "isSwipeableModalActive": { "alias": "isSwipeableModalActive"; "required": true; "isSignal": true; }; "animationDuration": { "alias": "animationDuration"; "required": true; "isSignal": true; }; "hasDefaultContentWrapperClass": { "alias": "hasDefaultContentWrapperClass"; "required": true; "isSignal": true; }; "hasBanner": { "alias": "hasBanner"; "required": true; "isSignal": true; }; }, { "close": "close"; }, never, ["*"], true, never>;
381
+ }
382
+
383
+ declare class GenericModalComponent<D = unknown, R = any, C extends GenericModal<D, R> = GenericModal<D, R>> implements IGenericModalComponenet<D, R, C> {
384
+ private modalService;
385
+ private windowDimensionService;
386
+ private scrollLockService;
387
+ private deviceTypeService;
388
+ cdr: ChangeDetectorRef;
389
+ readonly afterClose: _angular_core.OutputEmitterRef<void>;
390
+ readonly animationDuration: number;
391
+ componentRef: ComponentRef<C>;
392
+ config?: GenericModalConfig<D>;
393
+ closeFunction?: Function;
394
+ backdropClickSubject: Subject<MouseEvent>;
395
+ backdropClick: Observable<MouseEvent>;
396
+ private _isOpen;
397
+ get isOpen(): boolean;
398
+ private set isOpen(value);
399
+ isSwipeableModalActive: boolean;
400
+ isAnimated: boolean;
401
+ isCentered: boolean;
402
+ isSide: boolean;
403
+ protected hasBanner: boolean;
404
+ protected hasDefaultContentWrapperClass: boolean;
405
+ protected footerTemplate: _angular_core.WritableSignal<TemplateRef<any> | null>;
406
+ private isConfirmCloseModalOpen;
407
+ private isSpecialMobileOverflowHandlingEnabled;
408
+ private isScrollDisabled;
409
+ protected windowDimensions: WindowDimensions;
410
+ private unsubscribe$;
411
+ modalContainer?: ElementRef;
412
+ sideModalComponents?: QueryList<ModalSide>;
413
+ centeredModalComponents?: QueryList<ModalCentered>;
414
+ contentTemplate?: TemplateRef<HTMLElement>;
415
+ dynamicContainer?: ViewContainerRef;
416
+ constructor();
417
+ ngOnInit(): void;
418
+ ngAfterViewInit(): void;
419
+ ngOnDestroy(): void;
420
+ private createSubscriptions;
421
+ private handleWindowDimensionChange;
422
+ private initParamsFromConfig;
423
+ setFooterTemplate(template: TemplateRef<any>): void;
424
+ close(state?: ModalCloseMode, result?: R | undefined, fromInsideInteraction?: boolean, forceClose?: boolean): void;
425
+ private handleClose;
426
+ protected onBackdropClick(event: MouseEvent): void;
427
+ private shouldOpenConfirmCloseModal;
428
+ private shouldOpenConfirmCloseModalSelfCheck;
429
+ private getSwipeableModal;
430
+ private resetSwipeableModalPosition;
431
+ private setSwipeableModalFinishedState;
432
+ static ɵfac: _angular_core.ɵɵFactoryDeclaration<GenericModalComponent<any, any, any>, never>;
433
+ static ɵcmp: _angular_core.ɵɵComponentDeclaration<GenericModalComponent<any, any, any>, "generic-modal", never, {}, { "afterClose": "afterClose"; }, never, never, true, never>;
434
+ }
435
+
436
+ declare class ModalBackdrop {
437
+ readonly isAnimated: _angular_core.InputSignal<boolean>;
438
+ readonly isOpen: _angular_core.InputSignal<boolean>;
439
+ readonly click: _angular_core.OutputEmitterRef<MouseEvent>;
440
+ static ɵfac: _angular_core.ɵɵFactoryDeclaration<ModalBackdrop, never>;
441
+ static ɵcmp: _angular_core.ɵɵComponentDeclaration<ModalBackdrop, "modal-backdrop", never, { "isAnimated": { "alias": "isAnimated"; "required": false; "isSignal": true; }; "isOpen": { "alias": "isOpen"; "required": false; "isSignal": true; }; }, { "click": "click"; }, never, never, true, never>;
442
+ }
443
+
444
+ declare class ModalBanner<D = unknown> {
445
+ readonly config: _angular_core.InputSignal<GenericModalConfig<D, any, _filip_mazev_modal.GenericModal<any, undefined>> | undefined>;
446
+ readonly close: _angular_core.OutputEmitterRef<ModalCloseMode | undefined>;
447
+ static ɵfac: _angular_core.ɵɵFactoryDeclaration<ModalBanner<any>, never>;
448
+ static ɵcmp: _angular_core.ɵɵComponentDeclaration<ModalBanner<any>, "modal-banner", never, { "config": { "alias": "config"; "required": true; "isSignal": true; }; }, { "close": "close"; }, never, never, true, never>;
449
+ }
450
+
451
+ declare class GenericModalStyleConfig implements IGenericModalStyleConfig {
452
+ position: ModalPoistion;
453
+ handleMobile: boolean;
454
+ animate: boolean;
455
+ hasBackdrop: boolean;
456
+ closeDelay?: number;
457
+ showCloseButton?: boolean;
458
+ mobileConfig: IGenericSwipeableModalConfig;
459
+ contentWrapper: boolean;
460
+ wrapperClasses: string;
461
+ wrapperStyles: string;
462
+ overrideFullHeight: boolean;
463
+ constructor(config?: IGenericModalStyleConfig);
464
+ }
465
+
466
+ declare const GENERIC_MODAL_DEFAULT_ANIM_DURATION = 175;
467
+ declare const GENERIC_MODAL_DEFAULT_INTERNAL_ANIM_DURATION = 350;
468
+ declare const GENERIC_MODAL_DEFAULT_ANIM_DURATION_MULTIPLIER_SMALL = 0.65;
469
+ declare const GENERIC_MODAL_DEFAULT_ANIM_DURATION_MULTIPLIER_LARGE = 0.85;
470
+
471
+ declare const EMPTY_STRING = "";
472
+
473
+ declare const GENERIC_MODAL_DOWN_SWIPE_LIMIT = 2;
474
+ declare const GENERIC_MODAL_UP_SWIPE_LIMIT = 1;
475
+ declare const GENERIC_MODAL_SWIPE_VELOCITY_THRESHOLD = 80;
476
+
477
+ declare const LOWEST_CHARACTER_CAP = 23;
478
+ declare const LOWER_CHARACTER_CAP = 33;
479
+ declare const MID_CHARACTER_CAP = 49;
480
+ declare const UPPER_CHARACTER_CAP = 60;
481
+
482
+ declare enum GenericModalErrors {
483
+ MODAL_DOESNT_MATCH_THE_REQUESTED_TYPES = "The modal doesn't match the requested types.",
484
+ GENERIC_MODAL_SERVICE_RENDERER_NOT_SET = "ViewContainer and Renderer not set, please set the view container in the constructor of app.module.ts / app.ts (by calling register), before opening a modal",
485
+ PARENT_MODAL_CANT_BE_THE_SAME_AS_CHILD = "Parent modal cannot be the same as the child modal",
486
+ PARENT_MODAL_NOT_FOUND = "Parent modal does not exist",
487
+ PARENT_MODAL_NOT_PROVIDED = "No parent modal provided for multilevel modal"
488
+ }
489
+
490
+ declare enum GenericModalWarnings {
491
+ NO_PARENT_PROVIDED = "No parent modal provided for multilevel modal. Please provide a parent modal or set openAsMultilevel to false.",
492
+ MULTILEVEL_INLINE_NOT_SUPPORTED = "As of this version, opening a multi-level modal from inline HTML is not possible. Please set openAsMultilevel to false or open your modal through the GenericModalService! Opening modal as normal modal.",
493
+ MULTILEVEL_NO_PARENT = "Cannot open a multilevel modal with only one modal open. Please open another modal before opening a multilevel modal or set openAsMultilevel to false.",
494
+ PARENT_MODAL_NOT_SET = "Error setting parent modal. Opening modal as normal modal",
495
+ CONFIRM_MODAL_NESTING_NOT_SUPPORTED = "Cannot open a confirm modal from within a confirm modal. If you want to allow this behaviour, set bypassSelfCheck to true in the confirmCloseConfig.",
496
+ FOOTER_DIRECTIVE_OUTSIDE_MODAL = "[ModalFooter] Directive used outside of a GenericModalComponent."
497
+ }
498
+
499
+ declare class ModalFooterDirective {
500
+ private templateRef;
501
+ private modal;
502
+ constructor();
503
+ static ɵfac: _angular_core.ɵɵFactoryDeclaration<ModalFooterDirective, never>;
504
+ static ɵdir: _angular_core.ɵɵDirectiveDeclaration<ModalFooterDirective, "[modalFooter]", never, {}, {}, never, never, true, never>;
505
+ }
506
+
507
+ declare const GENERIC_MODAL_DATA: InjectionToken<any>;
508
+
509
+ export { EMPTY_STRING, GENERIC_MODAL_DATA, GENERIC_MODAL_DEFAULT_ANIM_DURATION, GENERIC_MODAL_DEFAULT_ANIM_DURATION_MULTIPLIER_LARGE, GENERIC_MODAL_DEFAULT_ANIM_DURATION_MULTIPLIER_SMALL, GENERIC_MODAL_DEFAULT_INTERNAL_ANIM_DURATION, GENERIC_MODAL_DOWN_SWIPE_LIMIT, GENERIC_MODAL_SWIPE_VELOCITY_THRESHOLD, GENERIC_MODAL_UP_SWIPE_LIMIT, GenericModal, GenericModalComponent, GenericModalConfig, GenericModalErrors, GenericModalRef, GenericModalService, GenericModalState, GenericModalStyleConfig, GenericModalWarnings, LOWER_CHARACTER_CAP, LOWEST_CHARACTER_CAP, MID_CHARACTER_CAP, ModalBackdrop, ModalBanner, ModalCentered, ModalFooterDirective, ModalSide, ModalSwipeable, UPPER_CHARACTER_CAP };
510
+ export type { IGenericCloseResult, IGenericConfirmCloseConfig, IGenericModalComponenet, IGenericModalConfig, IGenericModalRef, IGenericModalService, IGenericModalStyleConfig, IGenericModalView, IGenericSwipeableModalConfig, ModalCloseMode, ModalPoistion };
package/index.d.ts DELETED
@@ -1,5 +0,0 @@
1
- /**
2
- * Generated bundle index. Do not edit.
3
- */
4
- /// <amd-module name="@filip.mazev/modal" />
5
- export * from './public-api';
@@ -1,26 +0,0 @@
1
- import { IGenericConfirmCloseConfig } from "../interfaces/igeneric-confirm-close.interface";
2
- import { IGenericModalConfig } from "../interfaces/igeneric-modal-config.interface";
3
- import { IGenericModalStyleConfig } from "../interfaces/igeneric-modal-style-config.interface";
4
- import { GenericModal } from "./generic-modal";
5
- export declare class GenericModalConfig<D = unknown, ConfirmComponentData = any, ConfirmComponent extends GenericModal<ConfirmComponentData, undefined> = GenericModal<ConfirmComponentData, undefined>> {
6
- open: boolean;
7
- afterClose?: Function;
8
- confirmCloseConfig?: IGenericConfirmCloseConfig<ConfirmComponentData, ConfirmComponent>;
9
- disableClose: boolean;
10
- disableCloseOnBackdropClick: boolean;
11
- disableCloseOnNavigation: boolean;
12
- enableExtremeOverflowHandling?: boolean;
13
- webkitOnlyOverflowMobileHandling?: boolean;
14
- closeOnSwipeBack: boolean;
15
- data: D | null;
16
- style: IGenericModalStyleConfig;
17
- bannerText: string;
18
- bannerTextAnnotatedString: string;
19
- bannerIcons: string[];
20
- contentClasses: string;
21
- contentStyles: string;
22
- disableConsoleWarnings: boolean;
23
- disableConsoleInfo: boolean;
24
- id: string;
25
- constructor(config?: IGenericModalConfig<D, ConfirmComponentData, ConfirmComponent>);
26
- }
@@ -1,52 +0,0 @@
1
- import { ComponentRef, Type } from "@angular/core";
2
- import { Observable } from "rxjs";
3
- import { GenericModalConfig } from "./generic-modal-config";
4
- import { GenericModalComponent } from "../components/generic-modal";
5
- import { GenericModalState } from "../enums/generic-modal-state.enum";
6
- import { IGenericCloseResult } from "../interfaces/igeneric-close-result.interface";
7
- import { IGenericModalRef } from "../interfaces/igeneric-modal-ref.interface";
8
- import { GenericModalService } from "../services/generic-modal.service";
9
- import { ModalCloseMode } from "../types/modal.types";
10
- import { GenericModal } from "./generic-modal";
11
- export declare class GenericModalRef<D = unknown, R = any, C extends GenericModal<D, R> = GenericModal<D, R>> implements IGenericModalRef<D, R, C> {
12
- private modalService;
13
- private _modalContainer;
14
- private set modalContainer(value);
15
- get modalContainer(): Type<GenericModalComponent<D, R, C>>;
16
- private _modalContainerRef;
17
- private set modalContainerRef(value);
18
- get modalContainerRef(): ComponentRef<GenericModalComponent<D, R, C>>;
19
- private _modalContainerElement;
20
- private set modalContainerElement(value);
21
- get modalContainerElement(): HTMLElement;
22
- private _parentElement;
23
- private set parentElement(value);
24
- get parentElement(): HTMLElement | undefined;
25
- private _componentRef;
26
- private set componentRef(value);
27
- get componentRef(): ComponentRef<C>;
28
- private _modalState;
29
- private modalState;
30
- modalState$(): Observable<GenericModalState>;
31
- private getStatus;
32
- private _selfIdentifier;
33
- private set selfIdentifier(value);
34
- get selfIdentifier(): {
35
- constructor: Function;
36
- };
37
- private _modalConfig?;
38
- private set modalConfig(value);
39
- get modalConfig(): GenericModalConfig<D> | undefined;
40
- private backdropClickSubject;
41
- backdropClick(): Observable<MouseEvent>;
42
- private backdropClicked;
43
- private afterCloseSubject;
44
- afterClosed(): Observable<IGenericCloseResult<R>>;
45
- private afterClose;
46
- constructor(componentRef: ComponentRef<C>, selfIdentifier: {
47
- constructor: Function;
48
- }, modalContainerRef: ComponentRef<GenericModalComponent<D, R, C>>, modalService: GenericModalService, modalConfig?: GenericModalConfig<D>);
49
- open(): Promise<void>;
50
- close(state?: ModalCloseMode, result?: R | undefined, forceClose?: boolean): void;
51
- private handleClose;
52
- }
@@ -1,17 +0,0 @@
1
- import { IGenericModalStyleConfig } from "../interfaces/igeneric-modal-style-config.interface";
2
- import { IGenericSwipeableModalConfig } from "../interfaces/igeneric-swipeable-modal-config";
3
- import { ModalPoistion } from "../types/modal.types";
4
- export declare class GenericModalStyleConfig implements IGenericModalStyleConfig {
5
- position: ModalPoistion;
6
- handleMobile: boolean;
7
- animate: boolean;
8
- hasBackdrop: boolean;
9
- closeDelay?: number;
10
- showCloseButton?: boolean;
11
- mobileConfig: IGenericSwipeableModalConfig;
12
- contentWrapper: boolean;
13
- wrapperClasses: string;
14
- wrapperStyles: string;
15
- overrideFullHeight: boolean;
16
- constructor(config?: IGenericModalStyleConfig);
17
- }
@@ -1,19 +0,0 @@
1
- import { OnDestroy } from "@angular/core";
2
- import { GenericModalRef } from "./generic-modal-ref";
3
- import { Subject } from "rxjs";
4
- import { GenericModalService } from "../services/generic-modal.service";
5
- import * as i0 from "@angular/core";
6
- export declare abstract class GenericModal<D, R> implements OnDestroy {
7
- protected genericModalService: GenericModalService;
8
- modal?: GenericModalRef<D, R>;
9
- protected modalGetSubscription$: Subject<void>;
10
- constructor();
11
- ngOnDestroy(): void;
12
- protected createModalSubscription(): void;
13
- protected unsubscribeModalGet(): void;
14
- abstract afterModalGet(): void;
15
- abstract onDestroy(): void;
16
- close(): void;
17
- static ɵfac: i0.ɵɵFactoryDeclaration<GenericModal<any, any>, never>;
18
- static ɵprov: i0.ɵɵInjectableDeclaration<GenericModal<any, any>>;
19
- }