@ks89/angular-modal-gallery 12.0.0 → 14.0.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.
Files changed (125) hide show
  1. package/CHANGELOG.md +26 -0
  2. package/CONTRIBUTING.md +8 -11
  3. package/LICENSE +1 -1
  4. package/README.md +10 -6
  5. package/fesm2022/ks89-angular-modal-gallery.mjs +832 -909
  6. package/fesm2022/ks89-angular-modal-gallery.mjs.map +1 -1
  7. package/index.d.ts +2528 -3
  8. package/package.json +8 -10
  9. package/esm2022/ks89-angular-modal-gallery.mjs +0 -5
  10. package/esm2022/lib/components/accessibility-default.mjs +0 -41
  11. package/esm2022/lib/components/accessible.component.mjs +0 -130
  12. package/esm2022/lib/components/carousel/carousel-previews/carousel-previews.component.mjs +0 -456
  13. package/esm2022/lib/components/carousel/carousel.component.mjs +0 -738
  14. package/esm2022/lib/components/components.mjs +0 -50
  15. package/esm2022/lib/components/current-image/current-image.component.mjs +0 -607
  16. package/esm2022/lib/components/current-image/loading-spinner/loading-spinner.component.mjs +0 -80
  17. package/esm2022/lib/components/dots/dots.component.mjs +0 -124
  18. package/esm2022/lib/components/modal-gallery/attach-to-overlay.service.mjs +0 -42
  19. package/esm2022/lib/components/modal-gallery/modal-gallery-ref.mjs +0 -103
  20. package/esm2022/lib/components/modal-gallery/modal-gallery.component.mjs +0 -499
  21. package/esm2022/lib/components/modal-gallery/modal-gallery.service.mjs +0 -168
  22. package/esm2022/lib/components/modal-gallery/modal-gallery.tokens.mjs +0 -26
  23. package/esm2022/lib/components/plain-gallery/plain-gallery.component.mjs +0 -249
  24. package/esm2022/lib/components/previews/previews.component.mjs +0 -263
  25. package/esm2022/lib/components/upper-buttons/upper-buttons-default.mjs +0 -76
  26. package/esm2022/lib/components/upper-buttons/upper-buttons.component.mjs +0 -243
  27. package/esm2022/lib/directives/a-tag-bg-image.directive.mjs +0 -78
  28. package/esm2022/lib/directives/click-outside.directive.mjs +0 -91
  29. package/esm2022/lib/directives/description.directive.mjs +0 -98
  30. package/esm2022/lib/directives/direction.directive.mjs +0 -73
  31. package/esm2022/lib/directives/directives.mjs +0 -51
  32. package/esm2022/lib/directives/fallback-image.directive.mjs +0 -59
  33. package/esm2022/lib/directives/keyboard-navigation.directive.mjs +0 -64
  34. package/esm2022/lib/directives/margin.directive.mjs +0 -84
  35. package/esm2022/lib/directives/max-size.directive.mjs +0 -75
  36. package/esm2022/lib/directives/size.directive.mjs +0 -76
  37. package/esm2022/lib/directives/swipe.directive.mjs +0 -116
  38. package/esm2022/lib/directives/wrap.directive.mjs +0 -74
  39. package/esm2022/lib/modal-gallery.module.mjs +0 -88
  40. package/esm2022/lib/model/accessibility.interface.mjs +0 -25
  41. package/esm2022/lib/model/action.enum.mjs +0 -36
  42. package/esm2022/lib/model/buttons-config.interface.mjs +0 -62
  43. package/esm2022/lib/model/carousel-config.interface.mjs +0 -25
  44. package/esm2022/lib/model/carousel-image-config.interface.mjs +0 -25
  45. package/esm2022/lib/model/carousel-preview-config.interface.mjs +0 -25
  46. package/esm2022/lib/model/current-image-config.interface.mjs +0 -25
  47. package/esm2022/lib/model/description.interface.mjs +0 -33
  48. package/esm2022/lib/model/dots-config.interface.mjs +0 -25
  49. package/esm2022/lib/model/image-internal.class.mjs +0 -35
  50. package/esm2022/lib/model/image.class.mjs +0 -56
  51. package/esm2022/lib/model/interaction-event.interface.mjs +0 -2
  52. package/esm2022/lib/model/keyboard-config.interface.mjs +0 -25
  53. package/esm2022/lib/model/keyboard.enum.mjs +0 -35
  54. package/esm2022/lib/model/lib-config.interface.mjs +0 -25
  55. package/esm2022/lib/model/loading-config.interface.mjs +0 -37
  56. package/esm2022/lib/model/max-size.interface.mjs +0 -25
  57. package/esm2022/lib/model/modal-gallery-config.interface.mjs +0 -25
  58. package/esm2022/lib/model/plain-gallery-config.interface.mjs +0 -55
  59. package/esm2022/lib/model/play-config.interface.mjs +0 -25
  60. package/esm2022/lib/model/preview-config.interface.mjs +0 -25
  61. package/esm2022/lib/model/size.interface.mjs +0 -25
  62. package/esm2022/lib/model/slide-config.interface.mjs +0 -25
  63. package/esm2022/lib/services/config.service.mjs +0 -388
  64. package/esm2022/lib/services/id-validator.service.mjs +0 -71
  65. package/esm2022/lib/utils/image.util.mjs +0 -48
  66. package/esm2022/lib/utils/user-input.util.mjs +0 -104
  67. package/esm2022/public-api.mjs +0 -42
  68. package/lib/components/accessibility-default.d.ts +0 -5
  69. package/lib/components/accessible.component.d.ts +0 -50
  70. package/lib/components/carousel/carousel-previews/carousel-previews.component.d.ts +0 -195
  71. package/lib/components/carousel/carousel.component.d.ts +0 -276
  72. package/lib/components/components.d.ts +0 -15
  73. package/lib/components/current-image/current-image.component.d.ts +0 -282
  74. package/lib/components/current-image/loading-spinner/loading-spinner.component.d.ts +0 -55
  75. package/lib/components/dots/dots.component.d.ts +0 -81
  76. package/lib/components/modal-gallery/attach-to-overlay.service.d.ts +0 -20
  77. package/lib/components/modal-gallery/modal-gallery-ref.d.ts +0 -64
  78. package/lib/components/modal-gallery/modal-gallery.component.d.ts +0 -246
  79. package/lib/components/modal-gallery/modal-gallery.service.d.ts +0 -100
  80. package/lib/components/modal-gallery/modal-gallery.tokens.d.ts +0 -3
  81. package/lib/components/plain-gallery/plain-gallery.component.d.ts +0 -135
  82. package/lib/components/previews/previews.component.d.ts +0 -155
  83. package/lib/components/upper-buttons/upper-buttons-default.d.ts +0 -29
  84. package/lib/components/upper-buttons/upper-buttons.component.d.ts +0 -132
  85. package/lib/directives/a-tag-bg-image.directive.d.ts +0 -38
  86. package/lib/directives/click-outside.directive.d.ts +0 -24
  87. package/lib/directives/description.directive.d.ts +0 -33
  88. package/lib/directives/direction.directive.d.ts +0 -36
  89. package/lib/directives/directives.d.ts +0 -15
  90. package/lib/directives/fallback-image.directive.d.ts +0 -16
  91. package/lib/directives/keyboard-navigation.directive.d.ts +0 -24
  92. package/lib/directives/margin.directive.d.ts +0 -44
  93. package/lib/directives/max-size.directive.d.ts +0 -33
  94. package/lib/directives/size.directive.d.ts +0 -33
  95. package/lib/directives/swipe.directive.d.ts +0 -35
  96. package/lib/directives/wrap.directive.d.ts +0 -36
  97. package/lib/modal-gallery.module.d.ts +0 -32
  98. package/lib/model/accessibility.interface.d.ts +0 -40
  99. package/lib/model/action.enum.d.ts +0 -11
  100. package/lib/model/buttons-config.interface.d.ts +0 -57
  101. package/lib/model/carousel-config.interface.d.ts +0 -11
  102. package/lib/model/carousel-image-config.interface.d.ts +0 -8
  103. package/lib/model/carousel-preview-config.interface.d.ts +0 -22
  104. package/lib/model/current-image-config.interface.d.ts +0 -12
  105. package/lib/model/description.interface.d.ts +0 -39
  106. package/lib/model/dots-config.interface.d.ts +0 -6
  107. package/lib/model/image-internal.class.d.ts +0 -9
  108. package/lib/model/image.class.d.ts +0 -64
  109. package/lib/model/interaction-event.interface.d.ts +0 -6
  110. package/lib/model/keyboard-config.interface.d.ts +0 -8
  111. package/lib/model/keyboard.enum.d.ts +0 -13
  112. package/lib/model/lib-config.interface.d.ts +0 -39
  113. package/lib/model/loading-config.interface.d.ts +0 -19
  114. package/lib/model/max-size.interface.d.ts +0 -8
  115. package/lib/model/modal-gallery-config.interface.d.ts +0 -16
  116. package/lib/model/plain-gallery-config.interface.d.ts +0 -57
  117. package/lib/model/play-config.interface.d.ts +0 -8
  118. package/lib/model/preview-config.interface.d.ts +0 -12
  119. package/lib/model/size.interface.d.ts +0 -8
  120. package/lib/model/slide-config.interface.d.ts +0 -17
  121. package/lib/services/config.service.d.ts +0 -39
  122. package/lib/services/id-validator.service.d.ts +0 -25
  123. package/lib/utils/image.util.d.ts +0 -10
  124. package/lib/utils/user-input.util.d.ts +0 -80
  125. package/public-api.d.ts +0 -31
@@ -1,81 +0,0 @@
1
- import { EventEmitter, OnChanges, OnInit, SimpleChanges } from '@angular/core';
2
- import { AccessibleComponent } from '../accessible.component';
3
- import { AccessibilityConfig } from '../../model/accessibility.interface';
4
- import { Image } from '../../model/image.class';
5
- import { InternalLibImage } from '../../model/image-internal.class';
6
- import { DotsConfig } from '../../model/dots-config.interface';
7
- import { ConfigService } from '../../services/config.service';
8
- import * as i0 from "@angular/core";
9
- /**
10
- * Component with clickable dots (small circles) to navigate between images inside the modal gallery.
11
- */
12
- export declare class DotsComponent extends AccessibleComponent implements OnInit, OnChanges {
13
- private configService;
14
- /**
15
- * Unique id (>=0) of the current instance of this library. This is required when you are using
16
- * the service to call modal gallery.
17
- */
18
- id: number;
19
- /**
20
- * Object of type `InternalLibImage` that represent the visible image.
21
- */
22
- currentImage: InternalLibImage | undefined;
23
- /**
24
- * Array of `InternalLibImage` that represent the model of this library with all images,
25
- * thumbs and so on.
26
- */
27
- images: InternalLibImage[] | undefined;
28
- /**
29
- * Object of type `DotsConfig` to init DotsComponent's features.
30
- * For instance, it contains a param to show/hide this component.
31
- */
32
- dotsConfig: DotsConfig;
33
- /**
34
- * Output to emit clicks on dots. The payload contains a number that represent
35
- * the index of the clicked dot.
36
- */
37
- clickDot: EventEmitter<number>;
38
- /**
39
- * Object of type `DotsConfig` used in template.
40
- */
41
- configDots: DotsConfig | undefined;
42
- /**
43
- * Object of type `AccessibilityConfig` to init custom accessibility features.
44
- * For instance, it contains titles, alt texts, aria-labels and so on.
45
- */
46
- accessibilityConfig: AccessibilityConfig | undefined;
47
- constructor(configService: ConfigService);
48
- /**
49
- * Method ´ngOnInit´ to build `configDots` applying a default value.
50
- * This is an angular lifecycle hook, so its called automatically by Angular itself.
51
- * In particular, it's called only one time!!!
52
- */
53
- ngOnInit(): void;
54
- /**
55
- * Method ´ngOnChanges´ to change `configDots` if the input dotsConfig is changed.
56
- * This is an angular lifecycle hook, so its called automatically by Angular itself.
57
- */
58
- ngOnChanges(changes: SimpleChanges): void;
59
- /**
60
- * Method to check if an image is active (i.e. the current image).
61
- * It checks currentImage and images to prevent errors.
62
- * @param number index of the image to check if it's active or not
63
- * @returns boolean true if is active (and input params are valid), false otherwise
64
- */
65
- isActive(index: number): boolean;
66
- /**
67
- * Method called by events from keyboard and mouse.
68
- * @param number index of the dot
69
- * @param KeyboardEvent | MouseEvent event payload
70
- */
71
- onDotEvent(index: number, event: KeyboardEvent | MouseEvent): void;
72
- /**
73
- * Method used in the template to track ids in ngFor.
74
- * @param number index of the array
75
- * @param Image item of the array
76
- * @returns number the id of the item
77
- */
78
- trackById(index: number, item: Image): number;
79
- static ɵfac: i0.ɵɵFactoryDeclaration<DotsComponent, never>;
80
- static ɵcmp: i0.ɵɵComponentDeclaration<DotsComponent, "ks-dots", never, { "id": { "alias": "id"; "required": false; }; "currentImage": { "alias": "currentImage"; "required": false; }; "images": { "alias": "images"; "required": false; }; "dotsConfig": { "alias": "dotsConfig"; "required": false; }; }, { "clickDot": "clickDot"; }, never, never, false, never>;
81
- }
@@ -1,20 +0,0 @@
1
- import { Injector } from '@angular/core';
2
- import { ModalGalleryService } from './modal-gallery.service';
3
- import * as i0 from "@angular/core";
4
- export declare class AttachToOverlayService {
5
- private injector;
6
- private modalGalleryService;
7
- constructor(injector: Injector, modalGalleryService: ModalGalleryService);
8
- /**
9
- * To be called by a provider with the APP_INITIALIZER token.
10
- */
11
- initialize(): void;
12
- /**
13
- * Private method to attach ModalGalleryComponent to the overlay.
14
- * @param payload {@link AttachToOverlayPayload} with all necessary information
15
- * @private
16
- */
17
- private attachToOverlay;
18
- static ɵfac: i0.ɵɵFactoryDeclaration<AttachToOverlayService, never>;
19
- static ɵprov: i0.ɵɵInjectableDeclaration<AttachToOverlayService>;
20
- }
@@ -1,64 +0,0 @@
1
- import { OverlayRef } from '@angular/cdk/overlay';
2
- import { ImageModalEvent } from '../../model/image.class';
3
- import { ButtonEvent } from '../../model/buttons-config.interface';
4
- /**
5
- * Class that represents the modal dialog instance.
6
- * It is returned by the open method.
7
- */
8
- export declare class ModalGalleryRef {
9
- private overlayRef;
10
- private close;
11
- close$: import("rxjs").Observable<ImageModalEvent>;
12
- private show;
13
- show$: import("rxjs").Observable<ImageModalEvent>;
14
- private firstImage;
15
- firstImage$: import("rxjs").Observable<ImageModalEvent>;
16
- private lastImage;
17
- lastImage$: import("rxjs").Observable<ImageModalEvent>;
18
- private hasData;
19
- hasData$: import("rxjs").Observable<ImageModalEvent>;
20
- private buttonBeforeHook;
21
- buttonBeforeHook$: import("rxjs").Observable<ButtonEvent>;
22
- private buttonAfterHook;
23
- buttonAfterHook$: import("rxjs").Observable<ButtonEvent>;
24
- constructor(overlayRef: OverlayRef);
25
- /**
26
- * Close modal dialog, disposing the Overlay.
27
- */
28
- closeModal(): void;
29
- /**
30
- * Method to emit close event.
31
- * @param event ImageModalEvent event payload
32
- */
33
- emitClose(event: ImageModalEvent): void;
34
- /**
35
- * Method to emit show event.
36
- * @param event ImageModalEvent event payload
37
- */
38
- emitShow(event: ImageModalEvent): void;
39
- /**
40
- * Method to emit firstImage event.
41
- * @param event ImageModalEvent event payload
42
- */
43
- emitFirstImage(event: ImageModalEvent): void;
44
- /**
45
- * Method to emit lastImage event.
46
- * @param event ImageModalEvent event payload
47
- */
48
- emitLastImage(event: ImageModalEvent): void;
49
- /**
50
- * Method to emit hasData event.
51
- * @param event ImageModalEvent event payload
52
- */
53
- emitHasData(event: ImageModalEvent): void;
54
- /**
55
- * Method to emit buttonBeforeHook event.
56
- * @param event ImageModalEvent event payload
57
- */
58
- emitButtonBeforeHook(event: ButtonEvent): void;
59
- /**
60
- * Method to emit buttonAfterHook event.
61
- * @param event ImageModalEvent event payload
62
- */
63
- emitButtonAfterHook(event: ButtonEvent): void;
64
- }
@@ -1,246 +0,0 @@
1
- import { ChangeDetectorRef, OnDestroy, OnInit, TemplateRef } from '@angular/core';
2
- import { DomSanitizer } from '@angular/platform-browser';
3
- import { ImageModalEvent } from '../../model/image.class';
4
- import { ConfigService } from '../../services/config.service';
5
- import { DotsConfig } from '../../model/dots-config.interface';
6
- import { ButtonEvent, ButtonsConfig } from '../../model/buttons-config.interface';
7
- import { InternalLibImage } from '../../model/image-internal.class';
8
- import { Action } from '../../model/action.enum';
9
- import { CurrentImageComponent, ImageLoadEvent } from '../current-image/current-image.component';
10
- import { IdValidatorService } from '../../services/id-validator.service';
11
- import { KeyboardConfig } from '../../model/keyboard-config.interface';
12
- import { PreviewConfig } from '../../model/preview-config.interface';
13
- import { SlideConfig } from '../../model/slide-config.interface';
14
- import { AccessibilityConfig } from '../../model/accessibility.interface';
15
- import { PlainGalleryConfig } from '../../model/plain-gallery-config.interface';
16
- import { ModalGalleryService } from './modal-gallery.service';
17
- import { LibConfig } from '../../model/lib-config.interface';
18
- import { ModalGalleryConfig } from '../../model/modal-gallery-config.interface';
19
- import * as i0 from "@angular/core";
20
- export declare class ModalGalleryComponent implements OnInit, OnDestroy {
21
- private dialogContent;
22
- private modalGalleryService;
23
- private platformId;
24
- private changeDetectorRef;
25
- private idValidatorService;
26
- private configService;
27
- private sanitizer;
28
- /**
29
- * Reference to the CurrentImageComponent to invoke methods on it.
30
- */
31
- currentImageComponent: CurrentImageComponent | undefined;
32
- /**
33
- * Unique id (>=0) of the current instance of this library. This is useful when you are using
34
- * the service to call modal gallery without open it manually.
35
- */
36
- id: number;
37
- /**
38
- * Object of type `ButtonsConfig` to show/hide buttons.
39
- */
40
- buttonsConfig: ButtonsConfig | undefined;
41
- /**
42
- * Boolean to enable modal-gallery close behaviour when clicking
43
- * on the semi-transparent background. Enabled by default.
44
- */
45
- enableCloseOutside: boolean;
46
- /**
47
- * Object of type `DotsConfig` to init DotsComponent's features.
48
- * For instance, it contains a param to show/hide dots.
49
- */
50
- dotsConfig: DotsConfig | undefined;
51
- /**
52
- * Object of type `PreviewConfig` to init PreviewsComponent's features.
53
- * For instance, it contains a param to show/hide previews.
54
- */
55
- previewConfig: PreviewConfig | undefined;
56
- /**
57
- * Object of type `SlideConfig` to init side previews and `infinite sliding`.
58
- */
59
- slideConfig: SlideConfig | undefined;
60
- /**
61
- * Object of type `AccessibilityConfig` to init custom accessibility features.
62
- * For instance, it contains titles, alt texts, aria-labels and so on.
63
- */
64
- accessibilityConfig: AccessibilityConfig;
65
- /**
66
- * Object of type `KeyboardConfig` to assign custom keys to ESC, RIGHT and LEFT keyboard's actions.
67
- */
68
- keyboardConfig: KeyboardConfig | undefined;
69
- /**
70
- * Object of type `PlainGalleryConfig` to configure the plain gallery.
71
- */
72
- plainGalleryConfig: PlainGalleryConfig | undefined;
73
- /**
74
- * Array of `InternalLibImage` representing the model of this library with all images, thumbs and so on.
75
- */
76
- images: InternalLibImage[];
77
- /**
78
- * Optional template reference to use to render previews.
79
- */
80
- customPreviewsTemplate?: TemplateRef<HTMLElement>;
81
- /**
82
- * `Image` that is visible right now.
83
- */
84
- currentImage: InternalLibImage;
85
- /**
86
- * Boolean to open the modal gallery. False by default.
87
- */
88
- showGallery: boolean;
89
- /**
90
- * Object to configure this component.
91
- */
92
- libConfig: LibConfig | undefined;
93
- private updateImagesSubscription;
94
- /**
95
- * HostListener to catch browser's back button and destroy the gallery.
96
- * This prevents weired behaviour about scrolling.
97
- * Added to fix this issue: https://github.com/Ks89/angular-modal-gallery/issues/159
98
- */
99
- onPopState(): void;
100
- /**
101
- * HostListener to catch ctrl+s/meta+s and download the current image.
102
- * Inspired by https://netbasal.com/add-keyboard-shortcuts-to-your-angular-app-9bf2e89862b3
103
- */
104
- onSaveListener(event: KeyboardEvent): void;
105
- constructor(dialogContent: ModalGalleryConfig, modalGalleryService: ModalGalleryService, platformId: Object, changeDetectorRef: ChangeDetectorRef, idValidatorService: IdValidatorService, configService: ConfigService, sanitizer: DomSanitizer);
106
- /**
107
- * Method ´ngOnInit´ to init images calling `initImages()`.
108
- * This is an angular lifecycle hook, so its called automatically by Angular itself.
109
- * In particular, it's called only one time!!!
110
- */
111
- ngOnInit(): void;
112
- /**
113
- * Method called by custom upper buttons.
114
- * @param event ButtonEvent event payload
115
- */
116
- onCustomEmit(event: ButtonEvent): void;
117
- /**
118
- * Method called by the full-screen upper button.
119
- * @param event ButtonEvent event payload
120
- */
121
- onFullScreen(event: ButtonEvent): void;
122
- /**
123
- * Method called by the delete upper button.
124
- * @param event ButtonEvent event payload
125
- */
126
- onDelete(event: ButtonEvent): void;
127
- /**
128
- * Method called by the navigate upper button.
129
- * @param event ButtonEvent event payload
130
- */
131
- onNavigate(event: ButtonEvent): void;
132
- /**
133
- * This method is defined to be spied and replaced in unit testing with a fake method call.
134
- * It must be public to be able to use jasmine spyOn method.
135
- * @param newHref string new url
136
- */
137
- updateLocationHref(newHref: string): void;
138
- /**
139
- * Method called by the download upper button.
140
- * @param event ButtonEvent event payload
141
- */
142
- onDownload(event: ButtonEvent): void;
143
- /**
144
- * Method called by the close upper button.
145
- * @param event ButtonEvent event payload
146
- * @param action Action that triggered the close method. `Action.NORMAL` by default
147
- */
148
- onCloseGalleryButton(event: ButtonEvent, action?: Action): void;
149
- /**
150
- * Method called by CurrentImageComponent.
151
- * @param event ImageModalEvent event payload
152
- * @param action Action that triggered the close method. `Action.NORMAL` by default
153
- */
154
- onCloseGallery(event: ImageModalEvent, action?: Action): void;
155
- /**
156
- * Method to close the modal gallery specifying the action.
157
- * @param action Action action type. `Action.NORMAL` by default
158
- * @param clickOutside boolean that is true if called clicking on the modal background. False by default.
159
- */
160
- closeGallery(action?: Action, clickOutside?: boolean): void;
161
- /**
162
- * Method called when the image changes and used to update the `currentImage` object.
163
- * @param event ImageModalEvent event payload
164
- */
165
- onChangeCurrentImage(event: ImageModalEvent): void;
166
- /**
167
- * Method called when you click 'outside' (i.e. on the semi-transparent background)
168
- * to close the modal gallery if `enableCloseOutside` is true.
169
- * @param event boolean that is true to close the modal gallery, false otherwise
170
- */
171
- onClickOutside(event: boolean): void;
172
- /**
173
- * Method called when an image is loaded and the loading spinner has gone.
174
- * It sets the previouslyLoaded flag inside the Image to hide loading spinner when displayed again.
175
- * @param event ImageLoadEvent event payload
176
- */
177
- onImageLoad(event: ImageLoadEvent): void;
178
- /**
179
- * Method called when a dot is clicked and used to update the current image.
180
- * @param index number index of the clicked dot
181
- */
182
- onClickDot(index: number): void;
183
- /**
184
- * Method called when an image preview is clicked and used to update the current image.
185
- * @param event ImageModalEvent preview image
186
- */
187
- onClickPreview(event: ImageModalEvent): void;
188
- /**
189
- * Method to cleanup resources.
190
- * This is an angular lifecycle hook that is called when this component is destroyed.
191
- */
192
- ngOnDestroy(): void;
193
- /**
194
- * Method to download the current image, only if `downloadable` is true.
195
- * @private
196
- */
197
- private downloadImage;
198
- /**
199
- * Method to convert a base64 to a Blob
200
- * @param base64Data string with base64 data
201
- * @param contentType string with the MIME type
202
- * @return Blob converted from the input base64Data
203
- * @private
204
- */
205
- private base64toBlob;
206
- /**
207
- * Private method to download the current image for all browsers.
208
- * @private
209
- */
210
- private downloadImageAllBrowsers;
211
- /**
212
- * Private method to get the `ButtonEvent` to emit, merging the input `ButtonEvent`
213
- * with the current image.
214
- * @param event ButtonEvent event payload to return
215
- * @returns ButtonEvent event payload with the current image included
216
- * @private
217
- */
218
- private getButtonEventToEmit;
219
- /**
220
- * Private method to get the file name from an input path.
221
- * This is used either to get the image's name from its path or from the Image itself,
222
- * if specified as 'downloadFileName' by the user.
223
- * @param image Image image to extract its file name
224
- * @param isBase64 boolean to set if the image is a base64 file or not. False by default.
225
- * @param base64Extension string to force the extension of the base64 image. Empty string by default.
226
- * @returns string string file name of the input image.
227
- * @private
228
- */
229
- private getFileName;
230
- /**
231
- * Private method to initialize `images` as array of `Image`s.
232
- * Also, it will emit ImageModalEvent to say that images are loaded.
233
- * @private
234
- */
235
- private initImages;
236
- /**
237
- * Private method to emit events when either the last or the first image are visible.
238
- * @param action Action Enum of type Action that represents the source of the event that changed the
239
- * current image to the first one or the last one.
240
- * @param indexToCheck number is the index number of the image (the first or the last one).
241
- * @private
242
- */
243
- private emitBoundaryEvent;
244
- static ɵfac: i0.ɵɵFactoryDeclaration<ModalGalleryComponent, never>;
245
- static ɵcmp: i0.ɵɵComponentDeclaration<ModalGalleryComponent, "ks-modal-gallery", never, {}, {}, never, never, false, never>;
246
- }
@@ -1,100 +0,0 @@
1
- import { EventEmitter } from '@angular/core';
2
- import { Overlay, OverlayRef } from '@angular/cdk/overlay';
3
- import { ModalGalleryRef } from './modal-gallery-ref';
4
- import { Image, ImageModalEvent } from '../../model/image.class';
5
- import { ConfigService } from '../../services/config.service';
6
- import { ButtonEvent } from '../../model/buttons-config.interface';
7
- import { ModalGalleryConfig } from '../../model/modal-gallery-config.interface';
8
- import * as i0 from "@angular/core";
9
- /**
10
- * Payload to be emitted via {@link triggerAttachToOverlay} to enable {@link AttachToOverlayService}
11
- * to attach the {@link ModalGalleryComponent} to the overlay
12
- */
13
- export interface AttachToOverlayPayload {
14
- /**
15
- * Overlay object created using Angular CDK APIs
16
- */
17
- overlayRef: OverlayRef;
18
- /**
19
- * Dialog data to be injected into the {@link ModalGalleryComponent}
20
- * contains: id, array of images, current image and optionally the configuration object
21
- */
22
- config: ModalGalleryConfig;
23
- /**
24
- * Object to control the dialog instance
25
- */
26
- dialogRef: ModalGalleryRef;
27
- }
28
- export declare class ModalGalleryService {
29
- private overlay;
30
- private configService;
31
- private updateImages;
32
- updateImages$: import("rxjs").Observable<Image[]>;
33
- private dialogRef;
34
- triggerAttachToOverlay: EventEmitter<AttachToOverlayPayload>;
35
- constructor(overlay: Overlay, configService: ConfigService);
36
- /**
37
- * Method to open modal gallery passing the configuration
38
- * @param config ModalGalleryConfig that contains: id, array of images, current image and optionally the configuration object
39
- * @return ModalGalleryRef | undefined is the object used to listen for events.
40
- */
41
- open(config: ModalGalleryConfig): ModalGalleryRef | undefined;
42
- /**
43
- * Method to close a modal gallery previously opened.
44
- * @param id Unique identifier of the modal gallery
45
- * @param clickOutside boolean is true if closed clicking on the modal backdrop, false otherwise.
46
- */
47
- close(id: number, clickOutside: boolean): void;
48
- /**
49
- * Method to update images array.
50
- * @param images Image[] updated array of images
51
- */
52
- updateModalImages(images: Image[]): void;
53
- /**
54
- * Method to emit close event.
55
- * @param event ImageModalEvent is the event payload
56
- */
57
- emitClose(event: ImageModalEvent): void;
58
- /**
59
- * Method to emit show event.
60
- * @param event ImageModalEvent is the event payload
61
- */
62
- emitShow(event: ImageModalEvent): void;
63
- /**
64
- * Method to emit firstImage event.
65
- * @param event ImageModalEvent is the event payload
66
- */
67
- emitFirstImage(event: ImageModalEvent): void;
68
- /**
69
- * Method to emit lastImage event.
70
- * @param event ImageModalEvent is the event payload
71
- */
72
- emitLastImage(event: ImageModalEvent): void;
73
- /**
74
- * Method to emit hasData event.
75
- * @param event ImageModalEvent is the event payload
76
- */
77
- emitHasData(event: ImageModalEvent): void;
78
- /**
79
- * Method to emit buttonBeforeHook event.
80
- * @param event ButtonEvent is the event payload
81
- */
82
- emitButtonBeforeHook(event: ButtonEvent): void;
83
- /**
84
- * Method to emit buttonAfterHook event.
85
- * @param event ButtonEvent is the event payload
86
- */
87
- emitButtonAfterHook(event: ButtonEvent): void;
88
- /**
89
- * Private method to create an Overlay using Angular CDK APIs
90
- * @private
91
- */
92
- private createOverlay;
93
- /**
94
- * Private method to create an OverlayConfig instance
95
- * @private
96
- */
97
- private getOverlayConfig;
98
- static ɵfac: i0.ɵɵFactoryDeclaration<ModalGalleryService, never>;
99
- static ɵprov: i0.ɵɵInjectableDeclaration<ModalGalleryService>;
100
- }
@@ -1,3 +0,0 @@
1
- import { InjectionToken } from '@angular/core';
2
- import { ModalGalleryConfig } from '../../model/modal-gallery-config.interface';
3
- export declare const DIALOG_DATA: InjectionToken<ModalGalleryConfig>;
@@ -1,135 +0,0 @@
1
- import { EventEmitter, OnChanges, OnInit, SimpleChanges } from '@angular/core';
2
- import { AccessibilityConfig } from '../../model/accessibility.interface';
3
- import { Image } from '../../model/image.class';
4
- import { Size } from '../../model/size.interface';
5
- import { PlainGalleryConfig } from '../../model/plain-gallery-config.interface';
6
- import { ConfigService } from '../../services/config.service';
7
- import { AccessibleComponent } from '../accessible.component';
8
- import { PlainLibConfig } from '../../model/lib-config.interface';
9
- import * as i0 from "@angular/core";
10
- /**
11
- * Component with the gallery of thumbs.
12
- * In receives an array of Images, a boolean to show/hide
13
- * the gallery (feature used by imagePointer) and a config
14
- * object to customize the behaviour of this component.
15
- * Also, it emits click events as outputs.
16
- */
17
- export declare class PlainGalleryComponent extends AccessibleComponent implements OnInit, OnChanges {
18
- private configService;
19
- /**
20
- * Unique id (>=0) of the current instance of this library. This is required when you are using
21
- * the service to call modal gallery.
22
- */
23
- id: number | undefined;
24
- /**
25
- * Array of `Image` that represent the model of this library with all images, thumbs and so on.
26
- */
27
- images: Image[];
28
- /**
29
- * PlainLibConfig object to configure plain-gallery.
30
- */
31
- config: PlainLibConfig | undefined;
32
- /**
33
- * Output to emit an event when an image is clicked.
34
- */
35
- clickImage: EventEmitter<number>;
36
- /**
37
- * Object of type `PlainGalleryConfig` to configure the plain gallery.
38
- */
39
- plainGalleryConfig: PlainGalleryConfig | undefined;
40
- /**
41
- * Object of type `AccessibilityConfig` to init custom accessibility features.
42
- * For instance, it contains titles, alt texts, aria-labels and so on.
43
- */
44
- accessibilityConfig: AccessibilityConfig | undefined;
45
- /**
46
- * Bi-dimensional array of `Image` object to store images to display as plain gallery.
47
- * [] by default.
48
- */
49
- imageGrid: Image[][];
50
- /**
51
- * Size object used in the template to resize images.
52
- */
53
- size: Size | undefined;
54
- /**
55
- * Boolean passed as input to `ks-wrap` directive to configure flex-wrap css property.
56
- * However it's not enough, because you need to limit the width using `widthStyle` public variable.
57
- * For more info check https://developer.mozilla.org/it/docs/Web/CSS/flex-wrap
58
- */
59
- wrapStyle: boolean;
60
- /**
61
- * String passed as input to `ks-wrap` directive to set width to be able to force overflow.
62
- * In this way, `wrapStyle` (flex-wrap css property) will be used as requested.
63
- */
64
- widthStyle: string;
65
- /**
66
- * String passed as input to `ks-direction` directive to set the flex-direction css property.
67
- * For more info check https://developer.mozilla.org/it/docs/Web/CSS/flex-direction
68
- */
69
- directionStyle: string | undefined;
70
- /**
71
- * String passed as input to `ks-direction` directive to set the justify-content css property.
72
- * For more info check https://developer.mozilla.org/it/docs/Web/CSS/justify-content
73
- */
74
- justifyStyle: string | undefined;
75
- constructor(configService: ConfigService);
76
- /**
77
- * Method ´ngOnInit´ to init both `configPlainGallery` calling `initPlainGalleryConfig()`
78
- * and `imageGrid invoking `initImageGrid()`.
79
- * This is an angular lifecycle hook, so its called automatically by Angular itself.
80
- * In particular, it's called only one time!!!
81
- */
82
- ngOnInit(): void;
83
- /**
84
- * Method ´ngOnChanges´ to update both `imageGrid` and`plainGalleryConfig`.
85
- * This is an angular lifecycle hook, so its called automatically by Angular itself.
86
- * In particular, it's called when any data-bound property of a directive changes!!!
87
- */
88
- ngOnChanges(changes: SimpleChanges): void;
89
- /**
90
- * Method called when you click on an image of the plain (or inline) gallery.
91
- * This will emit the show event with the image as payload.
92
- * @param Image img is the Image to show
93
- */
94
- showModalGalleryByImage(img: Image): void;
95
- /**
96
- * Method called when you navigate between images.
97
- * This will emit the show event with the image as payload.
98
- * @param KeyboardEvent event that triggered the navigation
99
- * @param Image img is the Image to show
100
- */
101
- onNavigationEvent(event: KeyboardEvent, img: Image): void;
102
- /**
103
- * Method to get `alt attribute`.
104
- * `alt` specifies an alternate text for an image, if the image cannot be displayed.
105
- * @param Image image to get its alt description.
106
- * @returns string alt description of the image
107
- */
108
- getAltPlainDescriptionByImage(image: Image): string;
109
- /**
110
- * Method to get the title for an image.
111
- * @param Image image to get its title
112
- * @returns string the title of the input image
113
- */
114
- getTitleDisplay(image: Image): string;
115
- /**
116
- * Method used in the template to track ids in ngFor.
117
- * @param number index of the array
118
- * @param Image item of the array
119
- * @returns number the id of the item
120
- */
121
- trackById(index: number, item: Image): number;
122
- /**
123
- * Method called when you click on an image of the plain (or inline) gallery.
124
- * This will emit the show event with the index number as payload.
125
- * @param number index of the clicked image
126
- */
127
- private showModalGallery;
128
- /**
129
- * Private method to init both `imageGrid` and other style variables,
130
- * based on the layout type.
131
- */
132
- private initImageGrid;
133
- static ɵfac: i0.ɵɵFactoryDeclaration<PlainGalleryComponent, never>;
134
- static ɵcmp: i0.ɵɵComponentDeclaration<PlainGalleryComponent, "ks-plain-gallery", never, { "id": { "alias": "id"; "required": false; }; "images": { "alias": "images"; "required": false; }; "config": { "alias": "config"; "required": false; }; }, { "clickImage": "clickImage"; }, never, never, false, never>;
135
- }