@ks89/angular-modal-gallery 13.0.0 → 15.0.0-alpha.1
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/CHANGELOG.md +47 -0
- package/CONTRIBUTING.md +3 -3
- package/LICENSE +1 -1
- package/README.md +9 -6
- package/fesm2022/ks89-angular-modal-gallery.mjs +1497 -1534
- package/fesm2022/ks89-angular-modal-gallery.mjs.map +1 -1
- package/index.d.ts +2475 -3
- package/package.json +9 -9
- package/lib/components/accessibility-default.d.ts +0 -5
- package/lib/components/accessible.component.d.ts +0 -50
- package/lib/components/carousel/carousel-previews/carousel-previews.component.d.ts +0 -195
- package/lib/components/carousel/carousel.component.d.ts +0 -276
- package/lib/components/components.d.ts +0 -15
- package/lib/components/current-image/current-image.component.d.ts +0 -282
- package/lib/components/current-image/loading-spinner/loading-spinner.component.d.ts +0 -55
- package/lib/components/dots/dots.component.d.ts +0 -81
- package/lib/components/modal-gallery/attach-to-overlay.service.d.ts +0 -20
- package/lib/components/modal-gallery/modal-gallery-ref.d.ts +0 -64
- package/lib/components/modal-gallery/modal-gallery.component.d.ts +0 -246
- package/lib/components/modal-gallery/modal-gallery.service.d.ts +0 -100
- package/lib/components/modal-gallery/modal-gallery.tokens.d.ts +0 -3
- package/lib/components/plain-gallery/plain-gallery.component.d.ts +0 -135
- package/lib/components/previews/previews.component.d.ts +0 -155
- package/lib/components/upper-buttons/upper-buttons-default.d.ts +0 -29
- package/lib/components/upper-buttons/upper-buttons.component.d.ts +0 -132
- package/lib/directives/a-tag-bg-image.directive.d.ts +0 -38
- package/lib/directives/click-outside.directive.d.ts +0 -24
- package/lib/directives/description.directive.d.ts +0 -33
- package/lib/directives/direction.directive.d.ts +0 -36
- package/lib/directives/directives.d.ts +0 -15
- package/lib/directives/fallback-image.directive.d.ts +0 -16
- package/lib/directives/keyboard-navigation.directive.d.ts +0 -24
- package/lib/directives/margin.directive.d.ts +0 -44
- package/lib/directives/max-size.directive.d.ts +0 -33
- package/lib/directives/size.directive.d.ts +0 -33
- package/lib/directives/swipe.directive.d.ts +0 -35
- package/lib/directives/wrap.directive.d.ts +0 -36
- package/lib/modal-gallery.module.d.ts +0 -32
- package/lib/model/accessibility.interface.d.ts +0 -40
- package/lib/model/action.enum.d.ts +0 -11
- package/lib/model/buttons-config.interface.d.ts +0 -57
- package/lib/model/carousel-config.interface.d.ts +0 -11
- package/lib/model/carousel-image-config.interface.d.ts +0 -8
- package/lib/model/carousel-preview-config.interface.d.ts +0 -22
- package/lib/model/current-image-config.interface.d.ts +0 -12
- package/lib/model/description.interface.d.ts +0 -39
- package/lib/model/dots-config.interface.d.ts +0 -6
- package/lib/model/image-internal.class.d.ts +0 -9
- package/lib/model/image.class.d.ts +0 -64
- package/lib/model/interaction-event.interface.d.ts +0 -6
- package/lib/model/keyboard-config.interface.d.ts +0 -8
- package/lib/model/keyboard.enum.d.ts +0 -13
- package/lib/model/lib-config.interface.d.ts +0 -39
- package/lib/model/loading-config.interface.d.ts +0 -19
- package/lib/model/max-size.interface.d.ts +0 -8
- package/lib/model/modal-gallery-config.interface.d.ts +0 -16
- package/lib/model/plain-gallery-config.interface.d.ts +0 -57
- package/lib/model/play-config.interface.d.ts +0 -8
- package/lib/model/preview-config.interface.d.ts +0 -12
- package/lib/model/size.interface.d.ts +0 -8
- package/lib/model/slide-config.interface.d.ts +0 -17
- package/lib/services/config.service.d.ts +0 -39
- package/lib/services/id-validator.service.d.ts +0 -25
- package/lib/utils/image.util.d.ts +0 -10
- package/lib/utils/user-input.util.d.ts +0 -80
- package/public-api.d.ts +0 -36
|
@@ -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,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
|
-
}
|
|
@@ -1,155 +0,0 @@
|
|
|
1
|
-
import { EventEmitter, OnChanges, OnInit, SimpleChanges, TemplateRef } from '@angular/core';
|
|
2
|
-
import { AccessibleComponent } from '../accessible.component';
|
|
3
|
-
import { AccessibilityConfig } from '../../model/accessibility.interface';
|
|
4
|
-
import { Image, ImageEvent } from '../../model/image.class';
|
|
5
|
-
import { InternalLibImage } from '../../model/image-internal.class';
|
|
6
|
-
import { PreviewConfig } from '../../model/preview-config.interface';
|
|
7
|
-
import { SlideConfig } from '../../model/slide-config.interface';
|
|
8
|
-
import { Action } from '../../model/action.enum';
|
|
9
|
-
import { ConfigService } from '../../services/config.service';
|
|
10
|
-
import { Size } from '../../model/size.interface';
|
|
11
|
-
import * as i0 from "@angular/core";
|
|
12
|
-
/**
|
|
13
|
-
* Component with image previews
|
|
14
|
-
*/
|
|
15
|
-
export declare class PreviewsComponent extends AccessibleComponent implements OnInit, OnChanges {
|
|
16
|
-
private configService;
|
|
17
|
-
/**
|
|
18
|
-
* Unique id (>=0) of the current instance of this library. This is required when you are using
|
|
19
|
-
* the service to call modal gallery.
|
|
20
|
-
*/
|
|
21
|
-
id: number;
|
|
22
|
-
/**
|
|
23
|
-
* Object of type `InternalLibImage` that represent the visible image.
|
|
24
|
-
*/
|
|
25
|
-
currentImage: InternalLibImage;
|
|
26
|
-
/**
|
|
27
|
-
* Array of `InternalLibImage` that represent the model of this library with all images,
|
|
28
|
-
* thumbs and so on.
|
|
29
|
-
*/
|
|
30
|
-
images: InternalLibImage[];
|
|
31
|
-
/**
|
|
32
|
-
* Optional template reference for the rendering of previews.
|
|
33
|
-
* Template may access following context variables:
|
|
34
|
-
* - preview: the `Image` object
|
|
35
|
-
* - defaultTemplate: the template used by default to render the preview (in case the need is to wrap it)
|
|
36
|
-
*/
|
|
37
|
-
customTemplate?: TemplateRef<HTMLElement>;
|
|
38
|
-
/**
|
|
39
|
-
* Output to emit the clicked preview. The payload contains the `ImageEvent` associated to the clicked preview.
|
|
40
|
-
*/
|
|
41
|
-
clickPreview: EventEmitter<ImageEvent>;
|
|
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
|
-
/**
|
|
48
|
-
* Object of type `SlideConfig` to get `infinite sliding`.
|
|
49
|
-
*/
|
|
50
|
-
slideConfig: SlideConfig | undefined;
|
|
51
|
-
/**
|
|
52
|
-
* Object of type `PreviewConfig` to init PreviewsComponent's features.
|
|
53
|
-
* For instance, it contains a param to show/hide this component, sizes.
|
|
54
|
-
*/
|
|
55
|
-
previewConfig: PreviewConfig | undefined;
|
|
56
|
-
/**
|
|
57
|
-
* Enum of type `Action` that represents a mouse click on a button.
|
|
58
|
-
* Declared here to be used inside the template.
|
|
59
|
-
*/
|
|
60
|
-
clickAction: Action;
|
|
61
|
-
/**
|
|
62
|
-
* Enum of type `Action` that represents a keyboard action.
|
|
63
|
-
* Declared here to be used inside the template.
|
|
64
|
-
*/
|
|
65
|
-
keyboardAction: Action;
|
|
66
|
-
/**
|
|
67
|
-
* Array of `InternalLibImage` exposed to the template. This field is initialized
|
|
68
|
-
* applying transformations, default values and so on to the input of the same type.
|
|
69
|
-
*/
|
|
70
|
-
previews: InternalLibImage[];
|
|
71
|
-
/**
|
|
72
|
-
* Start index (included) of the input images used to display previews.
|
|
73
|
-
*/
|
|
74
|
-
start: number;
|
|
75
|
-
/**
|
|
76
|
-
* End index (excluded) of the input images used to display previews.
|
|
77
|
-
*/
|
|
78
|
-
end: number;
|
|
79
|
-
defaultPreviewSize: Size;
|
|
80
|
-
constructor(configService: ConfigService);
|
|
81
|
-
/**
|
|
82
|
-
* Method ´ngOnInit´ to build `configPreview` applying a default value and also to
|
|
83
|
-
* init the `previews` array.
|
|
84
|
-
* This is an angular lifecycle hook, so its called automatically by Angular itself.
|
|
85
|
-
* In particular, it's called only one time!!!
|
|
86
|
-
*/
|
|
87
|
-
ngOnInit(): void;
|
|
88
|
-
/**
|
|
89
|
-
* Method to check if an image is active (i.e. a preview image).
|
|
90
|
-
* @param InternalLibImage preview is an image to check if it's active or not
|
|
91
|
-
* @returns boolean true if is active, false otherwise
|
|
92
|
-
*/
|
|
93
|
-
isActive(preview: InternalLibImage): boolean;
|
|
94
|
-
/**
|
|
95
|
-
* Method ´ngOnChanges´ to update `previews` array.
|
|
96
|
-
* Also, both `start` and `end` local variables will be updated accordingly.
|
|
97
|
-
* This is an angular lifecycle hook, so its called automatically by Angular itself.
|
|
98
|
-
* In particular, it's called when any data-bound property of a directive changes!!!
|
|
99
|
-
*/
|
|
100
|
-
ngOnChanges(changes: SimpleChanges): void;
|
|
101
|
-
/**
|
|
102
|
-
* Method called by events from both keyboard and mouse on a preview.
|
|
103
|
-
* This will trigger the `clickpreview` output with the input preview as its payload.
|
|
104
|
-
* @param InternalLibImage preview that triggered this method
|
|
105
|
-
* @param KeyboardEvent | MouseEvent event payload
|
|
106
|
-
* @param Action action that triggered the source event or `Action.NORMAL` if not specified
|
|
107
|
-
*/
|
|
108
|
-
onImageEvent(preview: InternalLibImage, event: KeyboardEvent | MouseEvent, action?: Action): void;
|
|
109
|
-
/**
|
|
110
|
-
* Method called by events from both keyboard and mouse on a navigation arrow.
|
|
111
|
-
* It also emits an event to specify which arrow.
|
|
112
|
-
* @param string direction of the navigation that can be either 'next' or 'prev'
|
|
113
|
-
* @param KeyboardEvent | MouseEvent event payload
|
|
114
|
-
* @param Action action that triggered the source event or `Action.NORMAL` if not specified
|
|
115
|
-
*/
|
|
116
|
-
onNavigationEvent(direction: string, event: KeyboardEvent | MouseEvent, action?: Action): void;
|
|
117
|
-
/**
|
|
118
|
-
* Method used in the template to track ids in ngFor.
|
|
119
|
-
* @param number index of the array
|
|
120
|
-
* @param Image item of the array
|
|
121
|
-
* @returns number the id of the item
|
|
122
|
-
*/
|
|
123
|
-
trackById(index: number, item: Image): number;
|
|
124
|
-
/**
|
|
125
|
-
* Indicates if the previews 'left arrow' should be displayed or not.
|
|
126
|
-
* @returns
|
|
127
|
-
*/
|
|
128
|
-
displayLeftPreviewsArrow(): boolean;
|
|
129
|
-
/**
|
|
130
|
-
* Indicates if the previews 'right arrow' should be displayed or not.
|
|
131
|
-
* @returns
|
|
132
|
-
*/
|
|
133
|
-
displayRightPreviewsArrow(): boolean;
|
|
134
|
-
/**
|
|
135
|
-
* Private method to init previews based on the currentImage and the full array of images.
|
|
136
|
-
* The current image in mandatory to show always the current preview (as highlighted).
|
|
137
|
-
* @param InternalLibImage currentImage to decide how to show previews, because I always want to see the current image as highlighted
|
|
138
|
-
* @param InternalLibImage[] images is the array of all images.
|
|
139
|
-
*/
|
|
140
|
-
private initPreviews;
|
|
141
|
-
/**
|
|
142
|
-
* Private method to update both `start` and `end` based on the currentImage.
|
|
143
|
-
*/
|
|
144
|
-
private setIndexesPreviews;
|
|
145
|
-
/**
|
|
146
|
-
* Private method to update the visible previews navigating to the right (next).
|
|
147
|
-
*/
|
|
148
|
-
private next;
|
|
149
|
-
/**
|
|
150
|
-
* Private method to update the visible previews navigating to the left (previous).
|
|
151
|
-
*/
|
|
152
|
-
private previous;
|
|
153
|
-
static ɵfac: i0.ɵɵFactoryDeclaration<PreviewsComponent, never>;
|
|
154
|
-
static ɵcmp: i0.ɵɵComponentDeclaration<PreviewsComponent, "ks-previews", never, { "id": { "alias": "id"; "required": false; }; "currentImage": { "alias": "currentImage"; "required": false; }; "images": { "alias": "images"; "required": false; }; "customTemplate": { "alias": "customTemplate"; "required": false; }; }, { "clickPreview": "clickPreview"; }, never, never, false, never>;
|
|
155
|
-
}
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import { ButtonConfig } from '../../model/buttons-config.interface';
|
|
2
|
-
import { Size } from '../../model/size.interface';
|
|
3
|
-
/**
|
|
4
|
-
* Default button size object
|
|
5
|
-
*/
|
|
6
|
-
export declare const KS_DEFAULT_SIZE: Size;
|
|
7
|
-
/**
|
|
8
|
-
* Default close button object
|
|
9
|
-
*/
|
|
10
|
-
export declare const KS_DEFAULT_BTN_CLOSE: ButtonConfig;
|
|
11
|
-
/**
|
|
12
|
-
* Default download button object
|
|
13
|
-
*/
|
|
14
|
-
export declare const KS_DEFAULT_BTN_DOWNLOAD: ButtonConfig;
|
|
15
|
-
/**
|
|
16
|
-
* Default exturl button object
|
|
17
|
-
*/
|
|
18
|
-
export declare const KS_DEFAULT_BTN_EXTURL: ButtonConfig;
|
|
19
|
-
/**
|
|
20
|
-
* Default delete button object
|
|
21
|
-
*/
|
|
22
|
-
export declare const KS_DEFAULT_BTN_DELETE: ButtonConfig;
|
|
23
|
-
/**
|
|
24
|
-
* Default full-screen button object
|
|
25
|
-
*/
|
|
26
|
-
export declare const KS_DEFAULT_BTN_FULL_SCREEN: ButtonConfig;
|
|
27
|
-
/**
|
|
28
|
-
* Default rotate button object
|
|
29
|
-
*/
|