@autotaxatiepartners/ngx-gallery 2.0.2 → 2.0.3

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 (106) hide show
  1. package/.editorconfig +13 -0
  2. package/.eslintrc.json +51 -0
  3. package/.travis.yml +38 -0
  4. package/angular.json +108 -0
  5. package/package.json +64 -37
  6. package/projects/gallery/.eslintrc.json +55 -0
  7. package/projects/gallery/README.md +24 -0
  8. package/projects/gallery/karma.conf.js +52 -0
  9. package/projects/gallery/ng-package.json +7 -0
  10. package/projects/gallery/package.json +32 -0
  11. package/projects/gallery/src/lib/ngx-gallery-action/ngx-gallery-action.component.html +4 -0
  12. package/projects/gallery/src/lib/ngx-gallery-action/ngx-gallery-action.component.scss +21 -0
  13. package/projects/gallery/src/lib/ngx-gallery-action/ngx-gallery-action.component.spec.ts +25 -0
  14. package/projects/gallery/src/lib/ngx-gallery-action/ngx-gallery-action.component.ts +28 -0
  15. package/projects/gallery/src/lib/ngx-gallery-action.ts +23 -0
  16. package/projects/gallery/src/lib/ngx-gallery-animation.ts +6 -0
  17. package/projects/gallery/src/lib/ngx-gallery-arrows/ngx-gallery-arrows.component.html +27 -0
  18. package/projects/gallery/src/lib/ngx-gallery-arrows/ngx-gallery-arrows.component.scss +45 -0
  19. package/projects/gallery/src/lib/ngx-gallery-arrows/ngx-gallery-arrows.component.spec.ts +25 -0
  20. package/projects/gallery/src/lib/ngx-gallery-arrows/ngx-gallery-arrows.component.ts +28 -0
  21. package/projects/gallery/src/lib/ngx-gallery-bullets/ngx-gallery-bullets.component.html +4 -0
  22. package/projects/gallery/src/lib/ngx-gallery-bullets/ngx-gallery-bullets.component.scss +26 -0
  23. package/projects/gallery/src/lib/ngx-gallery-bullets/ngx-gallery-bullets.component.spec.ts +25 -0
  24. package/projects/gallery/src/lib/ngx-gallery-bullets/ngx-gallery-bullets.component.ts +25 -0
  25. package/projects/gallery/src/lib/ngx-gallery-image/ngx-gallery-image.component.html +49 -0
  26. package/projects/gallery/src/lib/ngx-gallery-image/ngx-gallery-image.component.scss +106 -0
  27. package/projects/gallery/src/lib/ngx-gallery-image/ngx-gallery-image.component.spec.ts +35 -0
  28. package/projects/gallery/src/lib/ngx-gallery-image/ngx-gallery-image.component.ts +381 -0
  29. package/projects/gallery/src/lib/ngx-gallery-image-size.ts +4 -0
  30. package/projects/gallery/src/lib/ngx-gallery-image.ts +31 -0
  31. package/projects/gallery/src/lib/ngx-gallery-layout.ts +4 -0
  32. package/projects/gallery/src/lib/ngx-gallery-options.ts +261 -0
  33. package/projects/gallery/src/lib/ngx-gallery-order.ts +5 -0
  34. package/projects/gallery/src/lib/ngx-gallery-ordered-image.ts +19 -0
  35. package/projects/gallery/src/lib/ngx-gallery-preview/ngx-gallery-preview.component.html +117 -0
  36. package/projects/gallery/src/lib/ngx-gallery-preview/ngx-gallery-preview.component.scss +121 -0
  37. package/projects/gallery/src/lib/ngx-gallery-preview/ngx-gallery-preview.component.spec.ts +34 -0
  38. package/projects/gallery/src/lib/ngx-gallery-preview/ngx-gallery-preview.component.ts +619 -0
  39. package/projects/gallery/src/lib/ngx-gallery-thumbnails/ngx-gallery-thumbnails.component.html +45 -0
  40. package/projects/gallery/src/lib/ngx-gallery-thumbnails/ngx-gallery-thumbnails.component.scss +87 -0
  41. package/projects/gallery/src/lib/ngx-gallery-thumbnails/ngx-gallery-thumbnails.component.spec.ts +31 -0
  42. package/projects/gallery/src/lib/ngx-gallery-thumbnails/ngx-gallery-thumbnails.component.ts +298 -0
  43. package/projects/gallery/src/lib/ngx-gallery.component.html +53 -0
  44. package/projects/gallery/src/lib/ngx-gallery.component.scss +77 -0
  45. package/projects/gallery/src/lib/ngx-gallery.component.spec.ts +37 -0
  46. package/projects/gallery/src/lib/ngx-gallery.component.ts +336 -0
  47. package/projects/gallery/src/lib/ngx-gallery.module.ts +29 -0
  48. package/projects/gallery/src/lib/ngx-gallery.service.spec.ts +18 -0
  49. package/projects/gallery/src/lib/ngx-gallery.service.ts +71 -0
  50. package/projects/gallery/src/public-api.ts +20 -0
  51. package/projects/gallery/src/test.ts +17 -0
  52. package/projects/gallery/tsconfig.lib.json +14 -0
  53. package/projects/gallery/tsconfig.lib.prod.json +9 -0
  54. package/projects/gallery/tsconfig.spec.json +16 -0
  55. package/projects/gallery-app/.browserslistrc +12 -0
  56. package/projects/gallery-app/.eslintrc.json +40 -0
  57. package/projects/gallery-app/e2e/protractor.conf.js +32 -0
  58. package/projects/gallery-app/e2e/src/app.e2e-spec.ts +23 -0
  59. package/projects/gallery-app/e2e/src/app.po.ts +11 -0
  60. package/projects/gallery-app/e2e/tsconfig.json +13 -0
  61. package/projects/gallery-app/karma.conf.js +32 -0
  62. package/projects/gallery-app/src/app/app-routing.module.ts +11 -0
  63. package/projects/gallery-app/src/app/app.component.html +4 -0
  64. package/projects/gallery-app/src/app/app.component.scss +9 -0
  65. package/projects/gallery-app/src/app/app.component.spec.ts +35 -0
  66. package/projects/gallery-app/src/app/app.component.ts +82 -0
  67. package/projects/gallery-app/src/app/app.module.ts +20 -0
  68. package/projects/gallery-app/src/assets/.gitkeep +0 -0
  69. package/projects/gallery-app/src/assets/img/gallery/1-big.jpeg +0 -0
  70. package/projects/gallery-app/src/assets/img/gallery/1-medium.jpeg +0 -0
  71. package/projects/gallery-app/src/assets/img/gallery/1-small.jpeg +0 -0
  72. package/projects/gallery-app/src/assets/img/gallery/2-big.jpeg +0 -0
  73. package/projects/gallery-app/src/assets/img/gallery/2-medium.jpeg +0 -0
  74. package/projects/gallery-app/src/assets/img/gallery/2-small.jpeg +0 -0
  75. package/projects/gallery-app/src/assets/img/gallery/3-big.jpeg +0 -0
  76. package/projects/gallery-app/src/assets/img/gallery/3-medium.jpeg +0 -0
  77. package/projects/gallery-app/src/assets/img/gallery/3-small.jpeg +0 -0
  78. package/projects/gallery-app/src/assets/img/gallery/4-big.jpeg +0 -0
  79. package/projects/gallery-app/src/assets/img/gallery/4-medium.jpeg +0 -0
  80. package/projects/gallery-app/src/assets/img/gallery/4-small.jpeg +0 -0
  81. package/projects/gallery-app/src/assets/img/gallery/5-big.jpeg +0 -0
  82. package/projects/gallery-app/src/assets/img/gallery/5-medium.jpeg +0 -0
  83. package/projects/gallery-app/src/assets/img/gallery/5-small.jpeg +0 -0
  84. package/projects/gallery-app/src/assets/img/gallery/6-big.jpeg +0 -0
  85. package/projects/gallery-app/src/assets/img/gallery/6-medium.jpeg +0 -0
  86. package/projects/gallery-app/src/assets/img/gallery/6-small.jpeg +0 -0
  87. package/projects/gallery-app/src/assets/img/gallery/7-big.jpeg +0 -0
  88. package/projects/gallery-app/src/assets/img/gallery/7-medium.jpeg +0 -0
  89. package/projects/gallery-app/src/assets/img/gallery/7-small.jpeg +0 -0
  90. package/projects/gallery-app/src/assets/img/gallery/8-big.jpeg +0 -0
  91. package/projects/gallery-app/src/assets/img/gallery/8-medium.jpeg +0 -0
  92. package/projects/gallery-app/src/assets/img/gallery/8-small.jpeg +0 -0
  93. package/projects/gallery-app/src/environments/environment.prod.ts +3 -0
  94. package/projects/gallery-app/src/environments/environment.ts +16 -0
  95. package/projects/gallery-app/src/favicon.ico +0 -0
  96. package/projects/gallery-app/src/index.html +13 -0
  97. package/projects/gallery-app/src/main.ts +12 -0
  98. package/projects/gallery-app/src/polyfills.ts +53 -0
  99. package/projects/gallery-app/src/styles.scss +1 -0
  100. package/projects/gallery-app/src/test.ts +16 -0
  101. package/projects/gallery-app/tsconfig.app.json +17 -0
  102. package/projects/gallery-app/tsconfig.spec.json +18 -0
  103. package/tsconfig.json +43 -0
  104. package/fesm2022/autotaxatiepartners-ngx-gallery.mjs +0 -1756
  105. package/fesm2022/autotaxatiepartners-ngx-gallery.mjs.map +0 -1
  106. package/index.d.ts +0 -591
@@ -0,0 +1,381 @@
1
+ import { ChangeDetectionStrategy, ChangeDetectorRef, Component, ElementRef, EventEmitter, HostListener, Input, OnChanges, OnInit, Output, SimpleChanges } from '@angular/core';
2
+ import { DomSanitizer, SafeResourceUrl, SafeStyle } from '@angular/platform-browser';
3
+ import { NgxGalleryService } from '../ngx-gallery.service';
4
+ import { NgxGalleryOrderedImage } from '../ngx-gallery-ordered-image';
5
+ import { NgxGalleryAction } from '../ngx-gallery-action';
6
+ import { NgxGalleryAnimation } from '../ngx-gallery-animation';
7
+ import { animate, AnimationEvent, state, style, transition, trigger } from '@angular/animations';
8
+
9
+ type Orientation = ('slideLeft' | 'slideRight' | 'fade' | 'rotateLeft' | 'rotateRight' | 'zoom' | 'none');
10
+
11
+ @Component({
12
+ selector: 'ngx-gallery-image',
13
+ templateUrl: './ngx-gallery-image.component.html',
14
+ styleUrls: ['./ngx-gallery-image.component.scss'],
15
+ changeDetection: ChangeDetectionStrategy.OnPush,
16
+ animations: [
17
+ trigger('animation', [
18
+ // ...
19
+ state('slideRight', style({})),
20
+ state('slideLeft', style({})),
21
+ state('fade', style({})),
22
+ state('rotateLeft', style({})),
23
+ state('rotateRight', style({})),
24
+ state('zoom', style({})),
25
+ transition('slideRight => void', [
26
+ animate('500ms ease-in-out', style({ transform: 'translateX(-100%)' }))
27
+ ]),
28
+ transition('void => slideRight', [
29
+ style({ transform: 'translateX(100%)' }),
30
+ animate('500ms ease-in-out', style({ transform: 'translateX(0)' }))
31
+ ]),
32
+ transition('slideLeft => void', [
33
+ animate('500ms ease-in-out', style({ transform: 'translateX(100%)' }))
34
+ ]),
35
+ transition('void => slideLeft', [
36
+ style({ transform: 'translateX(-100%)' }),
37
+ animate('500ms ease-in-out', style({ transform: 'translateX(0)' }))
38
+ ]),
39
+ transition('fade => void', [
40
+ animate('500ms ease-in-out', style({ opacity: '0' }))
41
+ ]),
42
+ transition('void => fade', [
43
+ style({ opacity: '0' }),
44
+ animate('500ms ease-in-out', style({ opacity: '1' }))
45
+ ]),
46
+ transition('rotateLeft => void', [
47
+ animate('500ms ease-in-out', style({ transform: 'scale(1, 1) rotate(-90deg)', opacity: '0' }))
48
+ ]),
49
+ transition('void => rotateLeft', [
50
+ style({ transform: 'scale(1, 1) rotate(-90deg)', opacity: '0' }),
51
+ animate('500ms ease-in-out', style({ transform: 'scale(1, 1) rotate(0deg)', opacity: '1' }))
52
+ ]),
53
+ transition('rotateRight => void', [
54
+ animate('500ms ease-in-out', style({ transform: 'scale(1, 1) rotate(90deg)', opacity: '0' }))
55
+ ]),
56
+ transition('void => rotateRight', [
57
+ style({ transform: 'scale(1, 1) rotate(90deg)', opacity: '0' }),
58
+ animate('500ms ease-in-out', style({ transform: 'scale(1, 1) rotate(0deg)', opacity: '1' }))
59
+ ]),
60
+ transition('zoom => void', [
61
+ animate('500ms ease-in-out', style({ transform: 'scale(2.5,2.5)', opacity: '0' }))
62
+ ]),
63
+ transition('void => zoom', [
64
+ style({ transform: 'scale(2.5,2.5)', opacity: '0' }),
65
+ animate('500ms ease-in-out', style({ transform: 'scale(1, 1)', opacity: '1' }))
66
+ ]),
67
+ ]),
68
+ ],
69
+ standalone: false
70
+ })
71
+ export class NgxGalleryImageComponent implements OnInit, OnChanges {
72
+ @Input() images: NgxGalleryOrderedImage[];
73
+ @Input() clickable: boolean;
74
+ // eslint-disable-next-line @typescript-eslint/naming-convention, no-underscore-dangle, id-blacklist, id-match
75
+ _selectedIndex;
76
+ @Input()
77
+ set selectedIndex(index: number) {
78
+ if (index > this._selectedIndex) {
79
+ let action;
80
+ if (this.animation === NgxGalleryAnimation.Slide) {
81
+ action = 'slideRight';
82
+ } else if (this.animation === NgxGalleryAnimation.Fade) {
83
+ action = 'fade';
84
+ } else if (this.animation === NgxGalleryAnimation.Rotate) {
85
+ action = 'rotateRight';
86
+ } else if (this.animation === NgxGalleryAnimation.Zoom) {
87
+ action = 'zoom';
88
+ }
89
+ this.setAction(action);
90
+ } else if (index < this._selectedIndex) {
91
+ let action;
92
+ if (this.animation === NgxGalleryAnimation.Slide) {
93
+ action = 'slideLeft';
94
+ } else if (this.animation === NgxGalleryAnimation.Fade) {
95
+ action = 'fade';
96
+ } else if (this.animation === NgxGalleryAnimation.Rotate) {
97
+ action = 'rotateLeft';
98
+ } else if (this.animation === NgxGalleryAnimation.Zoom) {
99
+ action = 'zoom';
100
+ }
101
+ this.setAction(action);
102
+ }
103
+
104
+ this._selectedIndex = index;
105
+ }
106
+
107
+ @Input() arrows: boolean;
108
+ @Input() arrowsAutoHide: boolean;
109
+ @Input() swipe: boolean;
110
+ @Input() animation: string;
111
+ @Input() size: string;
112
+ @Input() arrowPrevIcon: string;
113
+ @Input() arrowNextIcon: string;
114
+ @Input() arrowIconSize: number;
115
+ @Input() autoPlay: boolean;
116
+ @Input() autoPlayInterval: number;
117
+ @Input() autoPlayPauseOnHover: boolean;
118
+ @Input() infinityMove: boolean;
119
+ @Input() lazyLoading: boolean;
120
+ @Input() actions: NgxGalleryAction[];
121
+ @Input() descriptions: string[];
122
+ @Input() showDescription: boolean;
123
+ @Input() bullets: boolean;
124
+
125
+ @Output() imageClick = new EventEmitter();
126
+ @Output() activeChange = new EventEmitter();
127
+ @Output() animating = new EventEmitter();
128
+
129
+ canChangeImage = true;
130
+ public action: Orientation;
131
+
132
+ isAnimating = false;
133
+
134
+ private timer;
135
+
136
+ constructor(private sanitization: DomSanitizer, private changeDetectorRef: ChangeDetectorRef,
137
+ private elementRef: ElementRef, private helperService: NgxGalleryService) {
138
+ this.changeDetectorRef = changeDetectorRef;
139
+ this.action = 'none';
140
+ }
141
+
142
+ ngOnInit() {
143
+ if (this.arrows && this.arrowsAutoHide) {
144
+ this.arrows = false;
145
+ }
146
+
147
+ if (this.autoPlay) {
148
+ this.startAutoPlay();
149
+ }
150
+ }
151
+
152
+ ngOnChanges(changes: SimpleChanges): void {
153
+ if (changes['swipe']) {
154
+ this.helperService.manageSwipe(this.swipe, this.elementRef, 'image', () => this.showNext(), () => this.showPrev());
155
+ }
156
+ }
157
+
158
+ @HostListener('mouseenter') onMouseEnter() {
159
+ if (this.arrowsAutoHide && !this.arrows) {
160
+ this.arrows = true;
161
+ }
162
+
163
+ if (this.autoPlay && this.autoPlayPauseOnHover) {
164
+ this.stopAutoPlay();
165
+ }
166
+ }
167
+
168
+ @HostListener('mouseleave') onMouseLeave() {
169
+ if (this.arrowsAutoHide && this.arrows) {
170
+ this.arrows = false;
171
+ }
172
+
173
+ if (this.autoPlay && this.autoPlayPauseOnHover) {
174
+ this.startAutoPlay();
175
+ }
176
+ }
177
+
178
+ reset(index: number): void {
179
+ this._selectedIndex = index;
180
+ this.action = 'none';
181
+ }
182
+
183
+ getImages(): NgxGalleryOrderedImage[] {
184
+ if (!this.images) {
185
+ return [];
186
+ }
187
+
188
+ if (this.lazyLoading) {
189
+ const indexes = [this._selectedIndex];
190
+ const prevIndex = this._selectedIndex - 1;
191
+
192
+ if (prevIndex === -1 && this.infinityMove) {
193
+ indexes.push(this.images.length - 1);
194
+ } else if (prevIndex >= 0) {
195
+ indexes.push(prevIndex);
196
+ }
197
+
198
+ const nextIndex = this._selectedIndex + 1;
199
+
200
+ if (nextIndex === this.images.length && this.infinityMove) {
201
+ indexes.push(0);
202
+ } else if (nextIndex < this.images.length) {
203
+ indexes.push(nextIndex);
204
+ }
205
+
206
+ return this.images.filter((img, i) => indexes.indexOf(i) !== -1);
207
+ } else {
208
+ return this.images;
209
+ }
210
+ }
211
+
212
+ startAutoPlay(): void {
213
+ this.stopAutoPlay();
214
+
215
+ this.timer = setInterval(() => {
216
+ if (!this.showNext()) {
217
+ this._selectedIndex = -1;
218
+ this.showNext();
219
+ }
220
+ }, this.autoPlayInterval);
221
+ }
222
+
223
+ stopAutoPlay() {
224
+ if (this.timer) {
225
+ clearInterval(this.timer);
226
+ }
227
+ }
228
+
229
+ handleClick(event: Event, index: number): void {
230
+ if (this.clickable) {
231
+ this.imageClick.emit(index);
232
+
233
+ event.stopPropagation();
234
+ event.preventDefault();
235
+ }
236
+ }
237
+
238
+ show(index: number) {
239
+ if (this.isAnimating) {
240
+ return;
241
+ }
242
+ if (index > this._selectedIndex) {
243
+ let action;
244
+ if (this.animation === NgxGalleryAnimation.Slide) {
245
+ action = 'slideRight';
246
+ } else if (this.animation === NgxGalleryAnimation.Fade) {
247
+ action = 'fade';
248
+ } else if (this.animation === NgxGalleryAnimation.Rotate) {
249
+ action = 'rotateRight';
250
+ } else if (this.animation === NgxGalleryAnimation.Zoom) {
251
+ action = 'zoom';
252
+ }
253
+ this.setAction(action);
254
+ } else {
255
+ let action;
256
+ if (this.animation === NgxGalleryAnimation.Slide) {
257
+ action = 'slideLeft';
258
+ } else if (this.animation === NgxGalleryAnimation.Fade) {
259
+ action = 'fade';
260
+ } else if (this.animation === NgxGalleryAnimation.Rotate) {
261
+ action = 'rotateLeft';
262
+ } else if (this.animation === NgxGalleryAnimation.Zoom) {
263
+ action = 'zoom';
264
+ }
265
+ this.setAction(action);
266
+ }
267
+
268
+ this._selectedIndex = index;
269
+ this.activeChange.emit(this._selectedIndex);
270
+ this.setChangeTimeout();
271
+ }
272
+
273
+ setAction(action: Orientation) {
274
+ this.action = action;
275
+ this.changeDetectorRef.detectChanges();
276
+ }
277
+
278
+ showNext(): boolean {
279
+ if (this.isAnimating) {
280
+ return false;
281
+ }
282
+ if (this.canShowNext() && this.canChangeImage) {
283
+ let action;
284
+ if (this.animation === NgxGalleryAnimation.Slide) {
285
+ action = 'slideRight';
286
+ } else if (this.animation === NgxGalleryAnimation.Fade) {
287
+ action = 'fade';
288
+ } else if (this.animation === NgxGalleryAnimation.Rotate) {
289
+ action = 'rotateRight';
290
+ } else if (this.animation === NgxGalleryAnimation.Zoom) {
291
+ action = 'zoom';
292
+ }
293
+ this.setAction(action);
294
+ this._selectedIndex++;
295
+ if (this._selectedIndex === this.images.length) {
296
+ this._selectedIndex = 0;
297
+ }
298
+
299
+ this.activeChange.emit(this._selectedIndex);
300
+ this.setChangeTimeout();
301
+
302
+ return true;
303
+ } else {
304
+ return false;
305
+ }
306
+ }
307
+
308
+ showPrev(): void {
309
+ if (this.isAnimating) {
310
+ return;
311
+ }
312
+ if (this.canShowPrev() && this.canChangeImage) {
313
+ let action;
314
+ if (this.animation === NgxGalleryAnimation.Slide) {
315
+ action = 'slideLeft';
316
+ } else if (this.animation === NgxGalleryAnimation.Fade) {
317
+ action = 'fade';
318
+ } else if (this.animation === NgxGalleryAnimation.Rotate) {
319
+ action = 'rotateLeft';
320
+ } else if (this.animation === NgxGalleryAnimation.Zoom) {
321
+ action = 'zoom';
322
+ }
323
+ this.setAction(action);
324
+ this._selectedIndex--;
325
+ if (this._selectedIndex < 0) {
326
+ this._selectedIndex = this.images.length - 1;
327
+ }
328
+
329
+ this.activeChange.emit(this._selectedIndex);
330
+ this.setChangeTimeout();
331
+ }
332
+ }
333
+
334
+ setChangeTimeout() {
335
+ this.canChangeImage = false;
336
+ let timeout = 1000;
337
+
338
+ if (this.animation === NgxGalleryAnimation.Slide
339
+ || this.animation === NgxGalleryAnimation.Fade) {
340
+ timeout = 500;
341
+ }
342
+
343
+ setTimeout(() => {
344
+ this.canChangeImage = true;
345
+ }, timeout);
346
+ }
347
+
348
+ canShowNext(): boolean {
349
+ if (this.images) {
350
+ return this.infinityMove || this._selectedIndex < this.images.length - 1;
351
+ } else {
352
+ return false;
353
+ }
354
+ }
355
+
356
+ canShowPrev(): boolean {
357
+ if (this.images) {
358
+ return this.infinityMove || this._selectedIndex > 0;
359
+ } else {
360
+ return false;
361
+ }
362
+ }
363
+
364
+ getSafeUrl(image: string | SafeResourceUrl): SafeStyle {
365
+ return this.sanitization.bypassSecurityTrustStyle(this.helperService.getBackgroundUrl(image.toString()));
366
+ }
367
+
368
+ getFileType(fileSource: string) {
369
+ return this.helperService.getFileType(fileSource);
370
+ }
371
+
372
+ onStart(event: AnimationEvent) {
373
+ this.isAnimating = true;
374
+ this.animating.emit(true);
375
+ }
376
+
377
+ onDone(event: AnimationEvent) {
378
+ this.isAnimating = false;
379
+ this.animating.emit(false);
380
+ }
381
+ }
@@ -0,0 +1,4 @@
1
+ export class NgxGalleryImageSize {
2
+ static Cover = 'cover';
3
+ static Contain = 'contain';
4
+ }
@@ -0,0 +1,31 @@
1
+ import { SafeResourceUrl } from '@angular/platform-browser';
2
+
3
+ export interface INgxGalleryImage {
4
+ small?: string | SafeResourceUrl;
5
+ medium?: string | SafeResourceUrl;
6
+ big?: string | SafeResourceUrl;
7
+ description?: string;
8
+ url?: string;
9
+ type?: string;
10
+ label?: string;
11
+ }
12
+
13
+ export class NgxGalleryImage implements INgxGalleryImage {
14
+ small?: string | SafeResourceUrl;
15
+ medium?: string | SafeResourceUrl;
16
+ big?: string | SafeResourceUrl;
17
+ description?: string;
18
+ url?: string;
19
+ type?: string;
20
+ label?: string;
21
+
22
+ constructor(obj: INgxGalleryImage) {
23
+ this.small = obj.small;
24
+ this.medium = obj.medium;
25
+ this.big = obj.big;
26
+ this.description = obj.description;
27
+ this.url = obj.url;
28
+ this.type = obj.type;
29
+ this.label = obj.label;
30
+ }
31
+ }
@@ -0,0 +1,4 @@
1
+ export class NgxGalleryLayout {
2
+ static ThumbnailsTop = 'thumbnails-top';
3
+ static ThumbnailsBottom = 'thumbnails-bottom';
4
+ }
@@ -0,0 +1,261 @@
1
+ import {NgxGalleryAction} from './ngx-gallery-action';
2
+ import {NgxGalleryOrder} from './ngx-gallery-order';
3
+ import {NgxGalleryLayout} from './ngx-gallery-layout';
4
+ import {NgxGalleryAnimation} from './ngx-gallery-animation';
5
+ import {NgxGalleryImageSize} from './ngx-gallery-image-size';
6
+
7
+ export interface INgxGalleryOptions {
8
+ width?: string;
9
+ height?: string;
10
+ breakpoint?: number;
11
+ fullWidth?: boolean;
12
+ layout?: string;
13
+ startIndex?: number;
14
+ linkTarget?: string;
15
+ lazyLoading?: boolean;
16
+ image?: boolean;
17
+ imagePercent?: number;
18
+ imageArrows?: boolean;
19
+ imageArrowsAutoHide?: boolean;
20
+ imageSwipe?: boolean;
21
+ imageAnimation?: string;
22
+ imageSize?: string;
23
+ imageAutoPlay?: boolean;
24
+ imageAutoPlayInterval?: number;
25
+ imageAutoPlayPauseOnHover?: boolean;
26
+ imageInfinityMove?: boolean;
27
+ imageActions?: NgxGalleryAction[];
28
+ imageDescription?: boolean;
29
+ imageBullets?: boolean;
30
+ thumbnails?: boolean;
31
+ thumbnailsColumns?: number;
32
+ thumbnailsRows?: number;
33
+ thumbnailsPercent?: number;
34
+ thumbnailsMargin?: number;
35
+ thumbnailsArrows?: boolean;
36
+ thumbnailsArrowsAutoHide?: boolean;
37
+ thumbnailsSwipe?: boolean;
38
+ thumbnailsMoveSize?: number;
39
+ thumbnailsOrder?: number;
40
+ thumbnailsRemainingCount?: boolean;
41
+ thumbnailsAsLinks?: boolean;
42
+ thumbnailsAutoHide?: boolean;
43
+ thumbnailMargin?: number;
44
+ thumbnailSize?: string;
45
+ thumbnailActions?: NgxGalleryAction[];
46
+ thumbnailClasses?: string[];
47
+ preview?: boolean;
48
+ previewDescription?: boolean;
49
+ previewArrows?: boolean;
50
+ previewArrowsAutoHide?: boolean;
51
+ previewSwipe?: boolean;
52
+ previewFullscreen?: boolean;
53
+ previewForceFullscreen?: boolean;
54
+ previewCloseOnClick?: boolean;
55
+ previewCloseOnEsc?: boolean;
56
+ previewKeyboardNavigation?: boolean;
57
+ previewAnimation?: boolean;
58
+ previewAutoPlay?: boolean;
59
+ previewAutoPlayInterval?: number;
60
+ previewAutoPlayPauseOnHover?: boolean;
61
+ previewInfinityMove?: boolean;
62
+ previewZoom?: boolean;
63
+ previewZoomStep?: number;
64
+ previewZoomMax?: number;
65
+ previewZoomMin?: number;
66
+ previewRotate?: boolean;
67
+ previewDownload?: boolean;
68
+ previewCustom?: (index: number) => void;
69
+ previewBullets?: boolean;
70
+ arrowPrevIcon?: string;
71
+ arrowNextIcon?: string;
72
+ arrowIconSize?: number;
73
+ arrowIconThumbnailSize?: number;
74
+ closeIcon?: string;
75
+ fullscreenIcon?: string;
76
+ spinnerIcon?: string;
77
+ zoomInIcon?: string;
78
+ zoomOutIcon?: string;
79
+ rotateLeftIcon?: string;
80
+ rotateRightIcon?: string;
81
+ downloadIcon?: string;
82
+ actions?: NgxGalleryAction[];
83
+ }
84
+
85
+ export class NgxGalleryOptions implements INgxGalleryOptions {
86
+ width?: string;
87
+ height?: string;
88
+ breakpoint?: number;
89
+ fullWidth?: boolean;
90
+ layout?: string;
91
+ startIndex?: number;
92
+ linkTarget?: string;
93
+ lazyLoading?: boolean;
94
+ image?: boolean;
95
+ imagePercent?: number;
96
+ imageArrows?: boolean;
97
+ imageArrowsAutoHide?: boolean;
98
+ imageSwipe?: boolean;
99
+ imageAnimation?: string;
100
+ imageSize?: string;
101
+ imageAutoPlay?: boolean;
102
+ imageAutoPlayInterval?: number;
103
+ imageAutoPlayPauseOnHover?: boolean;
104
+ imageInfinityMove?: boolean;
105
+ imageActions?: NgxGalleryAction[];
106
+ imageDescription?: boolean;
107
+ imageBullets?: boolean;
108
+ thumbnails?: boolean;
109
+ thumbnailsColumns?: number;
110
+ thumbnailsRows?: number;
111
+ thumbnailsPercent?: number;
112
+ thumbnailsMargin?: number;
113
+ thumbnailsArrows?: boolean;
114
+ thumbnailsArrowsAutoHide?: boolean;
115
+ thumbnailsSwipe?: boolean;
116
+ thumbnailsMoveSize?: number;
117
+ thumbnailsOrder?: number;
118
+ thumbnailsRemainingCount?: boolean;
119
+ thumbnailsAsLinks?: boolean;
120
+ thumbnailsAutoHide?: boolean;
121
+ thumbnailMargin?: number;
122
+ thumbnailSize?: string;
123
+ thumbnailActions?: NgxGalleryAction[];
124
+ thumbnailClasses?: string[];
125
+ preview?: boolean;
126
+ previewDescription?: boolean;
127
+ previewArrows?: boolean;
128
+ previewArrowsAutoHide?: boolean;
129
+ previewSwipe?: boolean;
130
+ previewFullscreen?: boolean;
131
+ previewForceFullscreen?: boolean;
132
+ previewCloseOnClick?: boolean;
133
+ previewCloseOnEsc?: boolean;
134
+ previewKeyboardNavigation?: boolean;
135
+ previewAnimation?: boolean;
136
+ previewAutoPlay?: boolean;
137
+ previewAutoPlayInterval?: number;
138
+ previewAutoPlayPauseOnHover?: boolean;
139
+ previewInfinityMove?: boolean;
140
+ previewZoom?: boolean;
141
+ previewZoomStep?: number;
142
+ previewZoomMax?: number;
143
+ previewZoomMin?: number;
144
+ previewRotate?: boolean;
145
+ previewDownload?: boolean;
146
+ previewCustom?: (index: number) => void;
147
+ previewBullets?: boolean;
148
+ arrowPrevIcon?: string;
149
+ arrowNextIcon?: string;
150
+ arrowIconSize?: number;
151
+ arrowIconThumbnailSize?: number;
152
+ closeIcon?: string;
153
+ fullscreenIcon?: string;
154
+ spinnerIcon?: string;
155
+ zoomInIcon?: string;
156
+ zoomOutIcon?: string;
157
+ rotateLeftIcon?: string;
158
+ rotateRightIcon?: string;
159
+ downloadIcon?: string;
160
+ actions?: NgxGalleryAction[];
161
+
162
+ constructor(obj: INgxGalleryOptions) {
163
+
164
+ const preventDefaults = obj.breakpoint === undefined ? false : true;
165
+
166
+ function use<T>(source: T, defaultValue: T): T {
167
+ return obj && (source !== undefined || preventDefaults) ? source : defaultValue;
168
+ }
169
+
170
+ this.breakpoint = use(obj.breakpoint, undefined);
171
+ this.width = use(obj.width, '500px');
172
+ this.height = use(obj.height, '400px');
173
+ this.fullWidth = use(obj.fullWidth, false);
174
+ this.layout = use(obj.layout, NgxGalleryLayout.ThumbnailsBottom);
175
+ this.startIndex = use(obj.startIndex, 0);
176
+ this.linkTarget = use(obj.linkTarget, '_blank');
177
+ this.lazyLoading = use(obj.lazyLoading, true);
178
+
179
+ this.image = use(obj.image, true);
180
+ this.imagePercent = use(obj.imagePercent, 75);
181
+ this.imageArrows = use(obj.imageArrows, true);
182
+ this.imageArrowsAutoHide = use(obj.imageArrowsAutoHide, false);
183
+ this.imageSwipe = use(obj.imageSwipe, false);
184
+ this.imageAnimation = use(obj.imageAnimation, NgxGalleryAnimation.Fade);
185
+ this.imageSize = use(obj.imageSize, NgxGalleryImageSize.Cover);
186
+ this.imageAutoPlay = use(obj.imageAutoPlay, false);
187
+ this.imageAutoPlayInterval = use(obj.imageAutoPlayInterval, 2000);
188
+ this.imageAutoPlayPauseOnHover = use(obj.imageAutoPlayPauseOnHover, false);
189
+ this.imageInfinityMove = use(obj.imageInfinityMove, false);
190
+ if (obj && obj.imageActions && obj.imageActions.length) {
191
+ obj.imageActions = obj.imageActions.map(action => new NgxGalleryAction(action));
192
+ }
193
+ this.imageActions = use(obj.imageActions, []);
194
+ this.imageDescription = use(obj.imageDescription, false);
195
+ this.imageBullets = use(obj.imageBullets, false);
196
+
197
+ this.thumbnails = use(obj.thumbnails, true);
198
+ this.thumbnailsColumns = use(obj.thumbnailsColumns, 4);
199
+ this.thumbnailsRows = use(obj.thumbnailsRows, 1);
200
+ this.thumbnailsPercent = use(obj.thumbnailsPercent, 25);
201
+ this.thumbnailsMargin = use(obj.thumbnailsMargin, 10);
202
+ this.thumbnailsArrows = use(obj.thumbnailsArrows, true);
203
+ this.thumbnailsArrowsAutoHide = use(obj.thumbnailsArrowsAutoHide, false);
204
+ this.thumbnailsSwipe = use(obj.thumbnailsSwipe, false);
205
+ this.thumbnailsMoveSize = use(obj.thumbnailsMoveSize, 1);
206
+ this.thumbnailsOrder = use(obj.thumbnailsOrder, NgxGalleryOrder.Column);
207
+ this.thumbnailsRemainingCount = use(obj.thumbnailsRemainingCount, false);
208
+ this.thumbnailsAsLinks = use(obj.thumbnailsAsLinks, false);
209
+ this.thumbnailsAutoHide = use(obj.thumbnailsAutoHide, false);
210
+ this.thumbnailMargin = use(obj.thumbnailMargin, 10);
211
+ this.thumbnailSize = use(obj.thumbnailSize, NgxGalleryImageSize.Cover);
212
+ if (obj && obj.thumbnailActions && obj.thumbnailActions.length) {
213
+ obj.thumbnailActions = obj.thumbnailActions.map(action => new NgxGalleryAction(action));
214
+ }
215
+ this.thumbnailActions = use(obj.thumbnailActions, []);
216
+ this.thumbnailClasses = use(obj.thumbnailClasses, []);
217
+
218
+
219
+ this.preview = use(obj.preview, true);
220
+ this.previewDescription = use(obj.previewDescription, true);
221
+ this.previewArrows = use(obj.previewArrows, true);
222
+ this.previewArrowsAutoHide = use(obj.previewArrowsAutoHide, false);
223
+ this.previewSwipe = use(obj.previewSwipe, false);
224
+ this.previewFullscreen = use(obj.previewFullscreen, false);
225
+ this.previewForceFullscreen = use(obj.previewForceFullscreen, false);
226
+ this.previewCloseOnClick = use(obj.previewCloseOnClick, false);
227
+ this.previewCloseOnEsc = use(obj.previewCloseOnEsc, false);
228
+ this.previewKeyboardNavigation = use(obj.previewKeyboardNavigation, false);
229
+ this.previewAnimation = use(obj.previewAnimation, true);
230
+ this.previewAutoPlay = use(obj.previewAutoPlay, false);
231
+ this.previewAutoPlayInterval = use(obj.previewAutoPlayInterval, 2000);
232
+ this.previewAutoPlayPauseOnHover = use(obj.previewAutoPlayPauseOnHover, false);
233
+ this.previewInfinityMove = use(obj.previewInfinityMove, false);
234
+ this.previewZoom = use(obj.previewZoom, false);
235
+ this.previewZoomStep = use(obj.previewZoomStep, 0.1);
236
+ this.previewZoomMax = use(obj.previewZoomMax, 2);
237
+ this.previewZoomMin = use(obj.previewZoomMin, 0.5);
238
+ this.previewRotate = use(obj.previewRotate, false);
239
+ this.previewDownload = use(obj.previewDownload, false);
240
+ this.previewCustom = use(obj.previewCustom, undefined);
241
+ this.previewBullets = use(obj.previewBullets, false);
242
+
243
+ this.arrowPrevIcon = use(obj.arrowPrevIcon, 'fa fa-arrow-circle-left');
244
+ this.arrowNextIcon = use(obj.arrowNextIcon, 'fa fa-arrow-circle-right');
245
+ this.arrowIconSize = use(obj.arrowIconSize, 32);
246
+ this.arrowIconThumbnailSize = use(obj.arrowIconThumbnailSize, 24);
247
+ this.closeIcon = use(obj.closeIcon, 'fa fa-times-circle');
248
+ this.fullscreenIcon = use(obj.fullscreenIcon, 'fa fa-arrows-alt');
249
+ this.spinnerIcon = use(obj.spinnerIcon, 'fa fa-spinner fa-pulse fa-3x fa-fw');
250
+ this.zoomInIcon = use(obj.zoomInIcon, 'fa fa-search-plus');
251
+ this.zoomOutIcon = use(obj.zoomOutIcon, 'fa fa-search-minus');
252
+ this.rotateLeftIcon = use(obj.rotateLeftIcon, 'fa fa-undo');
253
+ this.rotateRightIcon = use(obj.rotateRightIcon, 'fa fa-repeat');
254
+ this.downloadIcon = use(obj.downloadIcon, 'fa fa-arrow-circle-down');
255
+
256
+ if (obj && obj.actions && obj.actions.length) {
257
+ obj.actions = obj.actions.map(action => new NgxGalleryAction(action));
258
+ }
259
+ this.actions = use(obj.actions, []);
260
+ }
261
+ }
@@ -0,0 +1,5 @@
1
+ export class NgxGalleryOrder {
2
+ static Column = 1;
3
+ static Row = 2;
4
+ static Page = 3;
5
+ }