@ks89/angular-modal-gallery 9.0.1 → 9.1.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.
@@ -1,4 +1,4 @@
1
- import { ChangeDetectorRef, OnDestroy, OnInit } from '@angular/core';
1
+ import { ChangeDetectorRef, OnDestroy, OnInit, TemplateRef } from '@angular/core';
2
2
  import { DomSanitizer } from '@angular/platform-browser';
3
3
  import { ImageModalEvent } from '../../model/image.class';
4
4
  import { ConfigService } from '../../services/config.service';
@@ -76,6 +76,10 @@ export declare class ModalGalleryComponent implements OnInit, OnDestroy {
76
76
  * Array of `InternalLibImage` representing the model of this library with all images, thumbs and so on.
77
77
  */
78
78
  images: InternalLibImage[];
79
+ /**
80
+ * Optional template reference to use to render previews.
81
+ */
82
+ customPreviewsTemplate?: TemplateRef<HTMLElement>;
79
83
  /**
80
84
  * `Image` that is visible right now.
81
85
  */
@@ -1,4 +1,4 @@
1
- import { EventEmitter, OnChanges, OnInit, SimpleChanges } from '@angular/core';
1
+ import { EventEmitter, OnChanges, OnInit, SimpleChanges, TemplateRef } from '@angular/core';
2
2
  import { AccessibleComponent } from '../accessible.component';
3
3
  import { AccessibilityConfig } from '../../model/accessibility.interface';
4
4
  import { Image, ImageEvent } from '../../model/image.class';
@@ -28,6 +28,13 @@ export declare class PreviewsComponent extends AccessibleComponent implements On
28
28
  * thumbs and so on.
29
29
  */
30
30
  images: InternalLibImage[] | undefined;
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>;
31
38
  /**
32
39
  * Output to emit the clicked preview. The payload contains the `ImageEvent` associated to the clicked preview.
33
40
  */
@@ -62,11 +69,11 @@ export declare class PreviewsComponent extends AccessibleComponent implements On
62
69
  */
63
70
  previews: InternalLibImage[];
64
71
  /**
65
- * Start index of the input images used to display previews.
72
+ * Start index (included) of the input images used to display previews.
66
73
  */
67
74
  start: number;
68
75
  /**
69
- * End index of the input images used to display previews.
76
+ * End index (excluded) of the input images used to display previews.
70
77
  */
71
78
  end: number;
72
79
  defaultPreviewSize: Size;
@@ -114,6 +121,16 @@ export declare class PreviewsComponent extends AccessibleComponent implements On
114
121
  * @returns number the id of the item
115
122
  */
116
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;
117
134
  /**
118
135
  * Private method to init previews based on the currentImage and the full array of images.
119
136
  * The current image in mandatory to show always the current preview (as highlighted).
@@ -121,14 +138,6 @@ export declare class PreviewsComponent extends AccessibleComponent implements On
121
138
  * @param InternalLibImage[] images is the array of all images.
122
139
  */
123
140
  private initPreviews;
124
- /**
125
- * Private method to init both `start` and `end` to the beginning.
126
- */
127
- private setBeginningIndexesPreviews;
128
- /**
129
- * Private method to init both `start` and `end` to the end.
130
- */
131
- private setEndIndexesPreviews;
132
141
  /**
133
142
  * Private method to update both `start` and `end` based on the currentImage.
134
143
  */
@@ -141,16 +150,6 @@ export declare class PreviewsComponent extends AccessibleComponent implements On
141
150
  * Private method to update the visible previews navigating to the left (previous).
142
151
  */
143
152
  private previous;
144
- /**
145
- * Private method to block/permit sliding between previews.
146
- * @param number boundaryIndex is the first or the last index of `images` input array
147
- * @returns boolean if true block sliding, otherwise not
148
- */
149
- private isPreventSliding;
150
- /**
151
- * Private method to handle navigation changing the previews array and other variables.
152
- */
153
- private updatePreviews;
154
153
  static ɵfac: i0.ɵɵFactoryDeclaration<PreviewsComponent, never>;
155
- static ɵcmp: i0.ɵɵComponentDeclaration<PreviewsComponent, "ks-previews", never, { "id": "id"; "currentImage": "currentImage"; "images": "images"; }, { "clickPreview": "clickPreview"; }, never, never>;
154
+ static ɵcmp: i0.ɵɵComponentDeclaration<PreviewsComponent, "ks-previews", never, { "id": "id"; "currentImage": "currentImage"; "images": "images"; "customTemplate": "customTemplate"; }, { "clickPreview": "clickPreview"; }, never, never>;
156
155
  }
@@ -1,3 +1,4 @@
1
+ import { TemplateRef } from '@angular/core';
1
2
  import { Image } from './image.class';
2
3
  import { ModalLibConfig } from './lib-config.interface';
3
4
  export interface ModalGalleryConfig {
@@ -5,4 +6,11 @@ export interface ModalGalleryConfig {
5
6
  images: Image[];
6
7
  currentImage: Image;
7
8
  libConfig?: ModalLibConfig;
9
+ /**
10
+ * Optional template reference for the rendering of previews.
11
+ * Template may access following context variables:
12
+ * - "preview": the `Image` object of the preview
13
+ * - "defaultTemplate": the template used by default to render the preview (in case the need is to augment it)
14
+ */
15
+ previewsTemplate?: TemplateRef<HTMLElement>;
8
16
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ks89/angular-modal-gallery",
3
- "version": "9.0.1",
3
+ "version": "9.1.0",
4
4
  "description": "Image gallery for Angular",
5
5
  "license": "MIT",
6
6
  "author": "Stefano Cappa",