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